diff --git a/src/burn/devices/seibusnd.cpp b/src/burn/devices/seibusnd.cpp index 4c6949bb8..74a4a1a28 100644 --- a/src/burn/devices/seibusnd.cpp +++ b/src/burn/devices/seibusnd.cpp @@ -1,570 +1,569 @@ -// -// FB Alpha Seibu sound hardware module -// -// Games using this hardware: -// -// Dead Angle 2x YM2203 + adpcm -- not implemented -// -// Dynamite Duke 1x YM3812 + 1x M6295 -// Toki 1x YM3812 + 1x M6295 -// Raiden 1x YM3812 + 1x M6295 -// Blood Brothers 1x YM3812 + 1x M6295 -// D-Con 1x YM3812 + 1x M6295 -// Legionnaire 1x YM3812 + 1x M6295 -// -// SD Gundam PSK 1x YM2151 + 1x M6295 -// Raiden II 1x YM2151 + 2x M6295 -// Raiden DX 1x YM2151 + 2x M6295 -// Zero Team 1x YM2151 + 2x M6295 -// -// Cross Shooter 1x YM2151 + ? -// Cabal 1x YM2151 + adpcm -- not implemented -// - -#include "burnint.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "burn_ym2151.h" -#include "burn_ym2203.h" -#include "msm6295.h" -#include "bitswap.h" - -static UINT8 main2sub[2]; -static UINT8 sub2main[2]; -static INT32 main2sub_pending; -static INT32 sub2main_pending; -static INT32 SeibuSoundBank; - -UINT8 *SeibuZ80DecROM; -UINT8 *SeibuZ80ROM; -UINT8 *SeibuZ80RAM; -INT32 seibu_coin_input; - -static INT32 seibu_sndcpu_frequency; -static INT32 seibu_snd_type; -static INT32 is_sdgndmps = 0; - -enum -{ - VECTOR_INIT, - RST10_ASSERT, - RST10_CLEAR, - RST18_ASSERT, - RST18_CLEAR -}; - -static void update_irq_lines(INT32 param) -{ - static INT32 irq1,irq2; - - switch(param) - { - case VECTOR_INIT: - irq1 = irq2 = 0xff; - break; - - case RST10_ASSERT: - irq1 = 0xd7; - break; - - case RST10_CLEAR: - irq1 = 0xff; - break; - - case RST18_ASSERT: - irq2 = 0xdf; - break; - - case RST18_CLEAR: - irq2 = 0xff; - break; - } - - if ((irq1 & irq2) == 0xff) { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } else { - if (irq2 == 0xdf) { - ZetSetVector(irq1 & irq2); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } - } -} - -UINT8 seibu_main_word_read(INT32 offset) -{ -#if defined FBA_DEBUG - if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_main_word_read called without init\n")); -#endif - - offset = (offset >> 1) & 7; - - switch (offset) - { - case 2: - case 3: - return sub2main[offset-2]; - case 5: - return main2sub_pending ? 1 : 0; - default: - return 0xff; - } -} - -void seibu_main_word_write(INT32 offset, UINT8 data) -{ -#if defined FBA_DEBUG - if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_main_word_write called without init\n")); -#endif - - offset = (offset >> 1) & 7; - - switch (offset) - { - case 0: - case 1: - main2sub[offset] = data; - break; - - case 4: - if (is_sdgndmps) update_irq_lines(RST10_ASSERT); - update_irq_lines(RST18_ASSERT); - break; - - case 6: - sub2main_pending = 0; - main2sub_pending = 1; - break; - - default: - break; - } -} - -void seibu_sound_mustb_write_word(INT32 /*offset*/, UINT8 data) -{ -#if defined FBA_DEBUG - if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_mustb_write_word called without init\n")); -#endif - - main2sub[0] = data & 0xff; - main2sub[1] = 0; // originally data >> 8 which is effectively 0 - - update_irq_lines(RST18_ASSERT); -} - -static void seibu_z80_bank(INT32 data) -{ - SeibuSoundBank = data & 1; - - ZetMapArea(0x8000, 0xffff, 0, SeibuZ80ROM + 0x10000 + (data & 1) * 0x8000); - ZetMapArea(0x8000, 0xffff, 2, SeibuZ80ROM + 0x10000 + (data & 1) * 0x8000); -} - -void __fastcall seibu_sound_write(UINT16 address, UINT8 data) -{ -#if defined FBA_DEBUG - if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_write called without init\n")); -#endif - - switch (address) - { - case 0x4000: - main2sub_pending = 0; - sub2main_pending = 1; - return; - - case 0x4001: - update_irq_lines(VECTOR_INIT); - return; - - case 0x4002: - // rst10 ack (unused) - return; - - case 0x4003: - update_irq_lines(RST18_CLEAR); - return; - - case 0x4007: - seibu_z80_bank(data); - return; - - case 0x4008: - switch (seibu_snd_type & 3) - { - case 0: - BurnYM3812Write(0, data); - return; - - case 1: - BurnYM2151SelectRegister(data); - return; - - case 2: - BurnYM2203Write(0, 0, data); - return; - } - return; - - case 0x4009: - switch (seibu_snd_type & 3) - { - case 0: - BurnYM3812Write(1, data); - return; - - case 1: - BurnYM2151WriteRegister(data); - return; - - case 2: - BurnYM2203Write(0, 1, data); - return; - } - return; - - case 0x4018: - case 0x4019: - sub2main[address & 1] = data; - return; - - case 0x401b: - // coin counters - return; - - case 0x6000: - MSM6295Command(0, data); - return; - - case 0x6002: - if (seibu_snd_type & 4) MSM6295Command(1, data); - return; - - // type 2 - case 0x6008: - case 0x6009: - if (seibu_snd_type == 2) BurnYM2203Write(1, address & 1, data); - return; - } -} - -UINT8 __fastcall seibu_sound_read(UINT16 address) -{ -#if defined FBA_DEBUG - if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_read called without init\n")); -#endif - - switch (address) - { - case 0x4008: - switch (seibu_snd_type & 3) - { - case 0: - return BurnYM3812Read(0); - - case 1: - return BurnYM2151ReadStatus(); - - case 2: - return BurnYM2203Read(0, 0); - } - return 0; - - case 0x4009: { - if (seibu_snd_type < 2) return 0; - return BurnYM2203Read(0, 1); - } - - case 0x4010: - case 0x4011: - return main2sub[address & 1]; - - case 0x4012: - return sub2main_pending ? 1 : 0; - - case 0x4013: - return seibu_coin_input; - - case 0x6000: - return MSM6295ReadStatus(0); - - case 0x6002: - if (seibu_snd_type & 4) return MSM6295ReadStatus(0); - } - - return 0; -} - -static UINT8 decrypt_data(INT32 a,INT32 src) -{ - if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; - if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; - if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; - if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; - if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; - - if (BIT(a,13) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,3,2,0,1); - if (BIT(a, 8) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,2,3,1,0); - - return src; -} - -static UINT8 decrypt_opcode(INT32 a,INT32 src) -{ - if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; - if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; - if (~BIT(a,13) & BIT(a,12)) src ^= 0x20; - if (~BIT(a,6) & BIT(a,1)) src ^= 0x10; - if (~BIT(a,12) & BIT(a,2)) src ^= 0x08; - if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; - if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; - if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; - - if (BIT(a,13) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,3,2,0,1); - if (BIT(a, 8) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,2,3,1,0); - if (BIT(a,12) & BIT(a,9)) src = BITSWAP08(src,7,6,4,5,3,2,1,0); - if (BIT(a,11) & ~BIT(a,6)) src = BITSWAP08(src,6,7,5,4,3,2,1,0); - - return src; -} - -static void seibu_sound_decrypt(INT32 length) -{ - for (INT32 i = 0; i < length; i++) - { - UINT8 src = SeibuZ80ROM[i]; - - SeibuZ80ROM[i] = decrypt_data(i,src); - SeibuZ80DecROM[i] = decrypt_opcode(i,src); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / seibu_sndcpu_frequency; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - update_irq_lines(RST10_ASSERT); - } else { - update_irq_lines(RST10_CLEAR); - } -} - -static void Drv2151FMIRQHandler(INT32 nStatus) -{ - DrvFMIRQHandler(0, nStatus); -} - -static double Drv2203GetTime() -{ - return (double)ZetTotalCycles() / seibu_sndcpu_frequency; -} - -void seibu_sound_reset() -{ -#if defined FBA_DEBUG - if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_reset called without init\n")); -#endif - - ZetOpen(0); - ZetReset(); - update_irq_lines(VECTOR_INIT); - ZetClose(); - - switch (seibu_snd_type & 3) - { - case 0: - BurnYM3812Reset(); - break; - - case 1: - BurnYM2151Reset(); - break; - - case 2: - BurnYM2203Reset(); - break; - } - - MSM6295Reset(0); - if (seibu_snd_type & 4) MSM6295Reset(1); - - memset (main2sub, 0, 2); - memset (sub2main, 0, 2); - main2sub_pending = 0; - sub2main_pending = 0; - - seibu_coin_input = 0; - SeibuSoundBank = 0; -} - -void seibu_sound_init(INT32 type, INT32 len, INT32 freq0 /*cpu*/, INT32 freq1 /*ym*/, INT32 freq2 /*oki*/) -{ - DebugDev_SeibuSndInitted = 1; - - seibu_snd_type = type; - - if (len && SeibuZ80DecROM != NULL) { - seibu_sound_decrypt(len); - } else { - SeibuZ80DecROM = SeibuZ80ROM; - } - - seibu_sndcpu_frequency = freq0; - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x1fff, 0, SeibuZ80ROM); - ZetMapArea(0x0000, 0x1fff, 2, SeibuZ80DecROM, SeibuZ80ROM); - ZetMapArea(0x2000, 0x27ff, 0, SeibuZ80RAM); - ZetMapArea(0x2000, 0x27ff, 1, SeibuZ80RAM); - ZetMapArea(0x2000, 0x27ff, 2, SeibuZ80RAM); - ZetSetWriteHandler(seibu_sound_write); - ZetSetReadHandler(seibu_sound_read); - ZetMemEnd(); - ZetClose(); - - switch (seibu_snd_type & 3) - { - case 0: - BurnYM3812Init(freq1, &DrvFMIRQHandler, &DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3812(freq0); - break; - - case 1: - BurnYM2151Init(freq1); - BurnYM2151SetIrqHandler(&Drv2151FMIRQHandler); - BurnYM2151SetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); - break; - - case 2: - BurnYM2203Init(2, freq1, DrvFMIRQHandler, DrvSynchroniseStream, Drv2203GetTime, 0); - BurnTimerAttachZet(freq0); - break; - } - - MSM6295Init(0, freq2, 1); - MSM6295SetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); - if (seibu_snd_type & 4) { - MSM6295Init(1, freq2, 1); - MSM6295SetRoute(1, 0.40, BURN_SND_ROUTE_BOTH); - } - - // init kludge for sdgndmps - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "sdgndmps")) { - is_sdgndmps = 1; - } -} - -void seibu_sound_exit() -{ -#if defined FBA_DEBUG - if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_exit called without init\n")); -#endif - - switch (seibu_snd_type & 3) - { - case 0: - BurnYM3812Exit(); - break; - - case 1: - BurnYM2151Exit(); - break; - - case 2: - BurnYM2203Exit(); - break; - } - - MSM6295Exit(0); - if (seibu_snd_type & 4) MSM6295Exit(1); - - ZetExit(); - - MSM6295ROM = NULL; - - SeibuZ80DecROM = NULL; - SeibuZ80ROM = NULL; - SeibuZ80RAM = NULL; - seibu_sndcpu_frequency = 0; - is_sdgndmps = 0; - - DebugDev_SeibuSndInitted = 0; -} - -void seibu_sound_update(INT16 *pbuf, INT32 nLen) -{ -#if defined FBA_DEBUG - if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_update called without init\n")); -#endif - - switch (seibu_snd_type & 3) - { - case 0: - BurnYM3812Update(pbuf, nLen); - break; - - case 1: - BurnYM2151Render(pbuf, nLen); - break; - - case 2: - BurnYM2203Update(pbuf, nLen); - break; - } - - if (seibu_snd_type & 4) - MSM6295Render(1, pbuf, nLen); - MSM6295Render(0, pbuf, nLen); -} - -void seibu_sound_scan(INT32 *pnMin, INT32 nAction) -{ -#if defined FBA_DEBUG - if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_scan called without init\n")); -#endif - - if (nAction & ACB_VOLATILE) - { - ZetScan(nAction); - - switch (seibu_snd_type & 3) - { - case 0: - BurnYM3812Scan(nAction, pnMin); - break; - - case 1: - BurnYM2203Scan(nAction, pnMin); - break; - - case 2: - BurnYM2151Scan(nAction); - break; - } - - MSM6295Scan(0, nAction); - if (seibu_snd_type & 4) { - MSM6295Scan(1, nAction); - } - - SCAN_VAR(main2sub[0]); - SCAN_VAR(main2sub[1]); - SCAN_VAR(sub2main[0]); - SCAN_VAR(sub2main[1]); - SCAN_VAR(main2sub_pending); - SCAN_VAR(sub2main_pending); - SCAN_VAR(SeibuSoundBank); - } - - if (nAction & ACB_WRITE) - { - ZetOpen(0); - seibu_z80_bank(SeibuSoundBank); - ZetClose(); - } -} +// +// FB Alpha Seibu sound hardware module +// +// Games using this hardware: +// +// Dead Angle 2x YM2203 + adpcm -- not implemented +// +// Dynamite Duke 1x YM3812 + 1x M6295 +// Toki 1x YM3812 + 1x M6295 +// Raiden 1x YM3812 + 1x M6295 +// Blood Brothers 1x YM3812 + 1x M6295 +// D-Con 1x YM3812 + 1x M6295 +// Legionnaire 1x YM3812 + 1x M6295 +// +// SD Gundam PSK 1x YM2151 + 1x M6295 +// Raiden II 1x YM2151 + 2x M6295 +// Raiden DX 1x YM2151 + 2x M6295 +// Zero Team 1x YM2151 + 2x M6295 +// +// Cross Shooter 1x YM2151 + ? +// Cabal 1x YM2151 + adpcm -- not implemented +// + +#include "burnint.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "burn_ym2151.h" +#include "burn_ym2203.h" +#include "msm6295.h" +#include "bitswap.h" + +static UINT8 main2sub[2]; +static UINT8 sub2main[2]; +static INT32 main2sub_pending; +static INT32 sub2main_pending; +static INT32 SeibuSoundBank; + +UINT8 *SeibuZ80DecROM; +UINT8 *SeibuZ80ROM; +UINT8 *SeibuZ80RAM; +INT32 seibu_coin_input; + +static INT32 seibu_sndcpu_frequency; +static INT32 seibu_snd_type; +static INT32 is_sdgndmps = 0; + +enum +{ + VECTOR_INIT, + RST10_ASSERT, + RST10_CLEAR, + RST18_ASSERT, + RST18_CLEAR +}; + +static void update_irq_lines(INT32 param) +{ + static INT32 irq1,irq2; + + switch(param) + { + case VECTOR_INIT: + irq1 = irq2 = 0xff; + break; + + case RST10_ASSERT: + irq1 = 0xd7; + break; + + case RST10_CLEAR: + irq1 = 0xff; + break; + + case RST18_ASSERT: + irq2 = 0xdf; + break; + + case RST18_CLEAR: + irq2 = 0xff; + break; + } + + if ((irq1 & irq2) == 0xff) { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } else { + if (irq2 == 0xdf) { + ZetSetVector(irq1 & irq2); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } + } +} + +UINT8 seibu_main_word_read(INT32 offset) +{ +#if defined FBA_DEBUG + if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_main_word_read called without init\n")); +#endif + + offset = (offset >> 1) & 7; + + switch (offset) + { + case 2: + case 3: + return sub2main[offset-2]; + case 5: + return main2sub_pending ? 1 : 0; + default: + return 0xff; + } +} + +void seibu_main_word_write(INT32 offset, UINT8 data) +{ +#if defined FBA_DEBUG + if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_main_word_write called without init\n")); +#endif + + offset = (offset >> 1) & 7; + + switch (offset) + { + case 0: + case 1: + main2sub[offset] = data; + break; + + case 4: + if (is_sdgndmps) update_irq_lines(RST10_ASSERT); + update_irq_lines(RST18_ASSERT); + break; + + case 6: + sub2main_pending = 0; + main2sub_pending = 1; + break; + + default: + break; + } +} + +void seibu_sound_mustb_write_word(INT32 /*offset*/, UINT8 data) +{ +#if defined FBA_DEBUG + if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_mustb_write_word called without init\n")); +#endif + + main2sub[0] = data & 0xff; + main2sub[1] = 0; // originally data >> 8 which is effectively 0 + + update_irq_lines(RST18_ASSERT); +} + +static void seibu_z80_bank(INT32 data) +{ + SeibuSoundBank = data & 1; + + ZetMapArea(0x8000, 0xffff, 0, SeibuZ80ROM + 0x10000 + (data & 1) * 0x8000); + ZetMapArea(0x8000, 0xffff, 2, SeibuZ80ROM + 0x10000 + (data & 1) * 0x8000); +} + +void __fastcall seibu_sound_write(UINT16 address, UINT8 data) +{ +#if defined FBA_DEBUG + if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_write called without init\n")); +#endif + + switch (address) + { + case 0x4000: + main2sub_pending = 0; + sub2main_pending = 1; + return; + + case 0x4001: + update_irq_lines(VECTOR_INIT); + return; + + case 0x4002: + // rst10 ack (unused) + return; + + case 0x4003: + update_irq_lines(RST18_CLEAR); + return; + + case 0x4007: + seibu_z80_bank(data); + return; + + case 0x4008: + switch (seibu_snd_type & 3) + { + case 0: + BurnYM3812Write(0, data); + return; + + case 1: + BurnYM2151SelectRegister(data); + return; + + case 2: + BurnYM2203Write(0, 0, data); + return; + } + return; + + case 0x4009: + switch (seibu_snd_type & 3) + { + case 0: + BurnYM3812Write(1, data); + return; + + case 1: + BurnYM2151WriteRegister(data); + return; + + case 2: + BurnYM2203Write(0, 1, data); + return; + } + return; + + case 0x4018: + case 0x4019: + sub2main[address & 1] = data; + return; + + case 0x401b: + // coin counters + return; + + case 0x6000: + MSM6295Command(0, data); + return; + + case 0x6002: + if (seibu_snd_type & 4) MSM6295Command(1, data); + return; + + // type 2 + case 0x6008: + case 0x6009: + if (seibu_snd_type == 2) BurnYM2203Write(1, address & 1, data); + return; + } +} + +UINT8 __fastcall seibu_sound_read(UINT16 address) +{ +#if defined FBA_DEBUG + if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_read called without init\n")); +#endif + + switch (address) + { + case 0x4008: + switch (seibu_snd_type & 3) + { + case 0: + return BurnYM3812Read(0); + + case 1: + return BurnYM2151ReadStatus(); + + case 2: + return BurnYM2203Read(0, 0); + } + return 0; + + case 0x4009: { + if (seibu_snd_type < 2) return 0; + return BurnYM2203Read(0, 1); + } + + case 0x4010: + case 0x4011: + return main2sub[address & 1]; + + case 0x4012: + return sub2main_pending ? 1 : 0; + + case 0x4013: + return seibu_coin_input; + + case 0x6000: + return MSM6295ReadStatus(0); + + case 0x6002: + if (seibu_snd_type & 4) return MSM6295ReadStatus(0); + } + + return 0; +} + +static UINT8 decrypt_data(INT32 a,INT32 src) +{ + if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; + if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; + if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; + if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; + if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; + + if (BIT(a,13) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,3,2,0,1); + if (BIT(a, 8) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,2,3,1,0); + + return src; +} + +static UINT8 decrypt_opcode(INT32 a,INT32 src) +{ + if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; + if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; + if (~BIT(a,13) & BIT(a,12)) src ^= 0x20; + if (~BIT(a,6) & BIT(a,1)) src ^= 0x10; + if (~BIT(a,12) & BIT(a,2)) src ^= 0x08; + if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; + if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; + if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; + + if (BIT(a,13) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,3,2,0,1); + if (BIT(a, 8) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,2,3,1,0); + if (BIT(a,12) & BIT(a,9)) src = BITSWAP08(src,7,6,4,5,3,2,1,0); + if (BIT(a,11) & ~BIT(a,6)) src = BITSWAP08(src,6,7,5,4,3,2,1,0); + + return src; +} + +static void seibu_sound_decrypt(INT32 length) +{ + for (INT32 i = 0; i < length; i++) + { + UINT8 src = SeibuZ80ROM[i]; + + SeibuZ80ROM[i] = decrypt_data(i,src); + SeibuZ80DecROM[i] = decrypt_opcode(i,src); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / seibu_sndcpu_frequency; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + update_irq_lines(RST10_ASSERT); + } else { + update_irq_lines(RST10_CLEAR); + } +} + +static void Drv2151FMIRQHandler(INT32 nStatus) +{ + DrvFMIRQHandler(0, nStatus); +} + +static double Drv2203GetTime() +{ + return (double)ZetTotalCycles() / seibu_sndcpu_frequency; +} + +void seibu_sound_reset() +{ +#if defined FBA_DEBUG + if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_reset called without init\n")); +#endif + + ZetOpen(0); + ZetReset(); + update_irq_lines(VECTOR_INIT); + ZetClose(); + + switch (seibu_snd_type & 3) + { + case 0: + BurnYM3812Reset(); + break; + + case 1: + BurnYM2151Reset(); + break; + + case 2: + BurnYM2203Reset(); + break; + } + + MSM6295Reset(0); + if (seibu_snd_type & 4) MSM6295Reset(1); + + memset (main2sub, 0, 2); + memset (sub2main, 0, 2); + main2sub_pending = 0; + sub2main_pending = 0; + + seibu_coin_input = 0; + SeibuSoundBank = 0; +} + +void seibu_sound_init(INT32 type, INT32 len, INT32 freq0 /*cpu*/, INT32 freq1 /*ym*/, INT32 freq2 /*oki*/) +{ + DebugDev_SeibuSndInitted = 1; + + seibu_snd_type = type; + + if (len && SeibuZ80DecROM != NULL) { + seibu_sound_decrypt(len); + } else { + SeibuZ80DecROM = SeibuZ80ROM; + } + + seibu_sndcpu_frequency = freq0; + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x1fff, 0, SeibuZ80ROM); + ZetMapArea(0x0000, 0x1fff, 2, SeibuZ80DecROM, SeibuZ80ROM); + ZetMapArea(0x2000, 0x27ff, 0, SeibuZ80RAM); + ZetMapArea(0x2000, 0x27ff, 1, SeibuZ80RAM); + ZetMapArea(0x2000, 0x27ff, 2, SeibuZ80RAM); + ZetSetWriteHandler(seibu_sound_write); + ZetSetReadHandler(seibu_sound_read); + ZetClose(); + + switch (seibu_snd_type & 3) + { + case 0: + BurnYM3812Init(freq1, &DrvFMIRQHandler, &DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3812(freq0); + break; + + case 1: + BurnYM2151Init(freq1); + BurnYM2151SetIrqHandler(&Drv2151FMIRQHandler); + BurnYM2151SetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); + break; + + case 2: + BurnYM2203Init(2, freq1, DrvFMIRQHandler, DrvSynchroniseStream, Drv2203GetTime, 0); + BurnTimerAttachZet(freq0); + break; + } + + MSM6295Init(0, freq2, 1); + MSM6295SetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); + if (seibu_snd_type & 4) { + MSM6295Init(1, freq2, 1); + MSM6295SetRoute(1, 0.40, BURN_SND_ROUTE_BOTH); + } + + // init kludge for sdgndmps + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "sdgndmps")) { + is_sdgndmps = 1; + } +} + +void seibu_sound_exit() +{ +#if defined FBA_DEBUG + if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_exit called without init\n")); +#endif + + switch (seibu_snd_type & 3) + { + case 0: + BurnYM3812Exit(); + break; + + case 1: + BurnYM2151Exit(); + break; + + case 2: + BurnYM2203Exit(); + break; + } + + MSM6295Exit(0); + if (seibu_snd_type & 4) MSM6295Exit(1); + + ZetExit(); + + MSM6295ROM = NULL; + + SeibuZ80DecROM = NULL; + SeibuZ80ROM = NULL; + SeibuZ80RAM = NULL; + seibu_sndcpu_frequency = 0; + is_sdgndmps = 0; + + DebugDev_SeibuSndInitted = 0; +} + +void seibu_sound_update(INT16 *pbuf, INT32 nLen) +{ +#if defined FBA_DEBUG + if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_update called without init\n")); +#endif + + switch (seibu_snd_type & 3) + { + case 0: + BurnYM3812Update(pbuf, nLen); + break; + + case 1: + BurnYM2151Render(pbuf, nLen); + break; + + case 2: + BurnYM2203Update(pbuf, nLen); + break; + } + + if (seibu_snd_type & 4) + MSM6295Render(1, pbuf, nLen); + MSM6295Render(0, pbuf, nLen); +} + +void seibu_sound_scan(INT32 *pnMin, INT32 nAction) +{ +#if defined FBA_DEBUG + if (!DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("seibu_sound_scan called without init\n")); +#endif + + if (nAction & ACB_VOLATILE) + { + ZetScan(nAction); + + switch (seibu_snd_type & 3) + { + case 0: + BurnYM3812Scan(nAction, pnMin); + break; + + case 1: + BurnYM2203Scan(nAction, pnMin); + break; + + case 2: + BurnYM2151Scan(nAction); + break; + } + + MSM6295Scan(0, nAction); + if (seibu_snd_type & 4) { + MSM6295Scan(1, nAction); + } + + SCAN_VAR(main2sub[0]); + SCAN_VAR(main2sub[1]); + SCAN_VAR(sub2main[0]); + SCAN_VAR(sub2main[1]); + SCAN_VAR(main2sub_pending); + SCAN_VAR(sub2main_pending); + SCAN_VAR(SeibuSoundBank); + } + + if (nAction & ACB_WRITE) + { + ZetOpen(0); + seibu_z80_bank(SeibuSoundBank); + ZetClose(); + } +} diff --git a/src/burn/drv/capcom/fcrash_snd.cpp b/src/burn/drv/capcom/fcrash_snd.cpp index 5800ccdca..e04ba7ef6 100644 --- a/src/burn/drv/capcom/fcrash_snd.cpp +++ b/src/burn/drv/capcom/fcrash_snd.cpp @@ -154,7 +154,6 @@ INT32 FcrashSoundInit() ZetMapArea(0xd000, 0xd7ff, 0, FcrashZ80Ram ); ZetMapArea(0xd000, 0xd7ff, 1, FcrashZ80Ram ); ZetMapArea(0xd000, 0xd7ff, 2, FcrashZ80Ram ); - ZetMemEnd(); ZetClose(); BurnYM2203Init(2, 24000000 / 6, NULL, FcrashSynchroniseStream, FcrashGetTime, 0); diff --git a/src/burn/drv/capcom/ps_z.cpp b/src/burn/drv/capcom/ps_z.cpp index 38f51eb2c..7d0a27466 100644 --- a/src/burn/drv/capcom/ps_z.cpp +++ b/src/burn/drv/capcom/ps_z.cpp @@ -1,206 +1,205 @@ -#include "cps.h" -#include "burn_ym2151.h" - -// PSound - Z80 -static INT32 nPsndZBank = 0; -static UINT8 *PsndZRam = NULL; - -INT32 Kodb = 0; - -// Map in the memory for the current 0zx8000-0xc000 bank -static INT32 PsndZBankMap() -{ - UINT8 *Bank; - UINT32 nOff = (nPsndZBank << 14) + 0x8000; - - if (nOff + 0x4000 > nCpsZRomLen) { // End of bank in out of range - nOff = 0; - } - - Bank = CpsZRom + nOff; - - // Read and fetch the bank - ZetMapArea(0x8000, 0xBFFF, 0, Bank); - ZetMapArea(0x8000, 0xBFFF, 2, Bank); - - return 0; -} - -// PSound Z80 memory write -void __fastcall PsndZWrite(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xF000: - BurnYM2151SelectRegister(d); -// bprintf(PRINT_NORMAL, "YM2151 select -> %02X\n", d); - break; - case 0xF001: - BurnYM2151WriteRegister(d); -// bprintf(PRINT_NORMAL, "YM2151 write -> %02X\n", d); - break; - case 0xF002: - MSM6295Command(0, d); - break; - case 0xF004: { - INT32 nNewBank = d & 0x0f; - if (nPsndZBank != nNewBank) { - nPsndZBank = nNewBank; - PsndZBankMap(); - } - break; - } - case 0xF006: // ??? Enable interrupt ??? - break; - -#ifdef FBA_DEBUG -// default: -// bprintf(PRINT_NORMAL, _T("Z80 address %04X -> %02X.\n"), a, d); -#endif - - } - return; -} - -void __fastcall kodbZWrite(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xE000: - BurnYM2151SelectRegister(d); - break; - case 0xE001: - BurnYM2151WriteRegister(d); - break; - case 0xE400: - MSM6295Command(0, d); - break; - -#ifdef FBA_DEBUG -// default: -// bprintf(PRINT_NORMAL, _T("Z80 address %04X -> %02X.\n"), a, d); -#endif - - } - return; -} - -// PSound Z80 memory read -UINT8 __fastcall PsndZRead(UINT16 a) -{ - switch (a) { - case 0xF001: - return BurnYM2151ReadStatus(); - case 0xF002: - return MSM6295ReadStatus(0); - case 0xF008: -// bprintf(PRINT_NORMAL, " -- Sound latch read (%i).\n", PsndCode); - return PsndCode; - case 0xF00A: - return PsndFade; - -#ifdef FBA_DEBUG -// default: -// bprintf(PRINT_NORMAL, _T("Z80 address %04X read.\n"), a); -#endif - - } - return 0; -} - -UINT8 __fastcall kodbZRead(UINT16 a) -{ - switch (a) { - case 0xE001: - return BurnYM2151ReadStatus(); - case 0xE400: - return MSM6295ReadStatus(0); - case 0xE800: - return PsndCode; - -#ifdef FBA_DEBUG -// default: -// bprintf(PRINT_NORMAL, _T("Z80 address %04X read.\n"), a); -#endif - - } - return 0; -} - -INT32 PsndZInit() -{ - if (nCpsZRomLen < 0x8000) { // Not enough Z80 Data - return 1; - } - if (CpsZRom == NULL) { - return 1; - } - - PsndZRam = (UINT8 *)BurnMalloc(0x800); - if (PsndZRam == NULL) { - return 1; - } - - ZetInit(0); - ZetOpen(0); - - if (Kodb) { - ZetSetReadHandler(kodbZRead); - ZetSetWriteHandler(kodbZWrite); - } else { - ZetSetReadHandler(PsndZRead); - ZetSetWriteHandler(PsndZWrite); - } - - // Read and fetch first 0x8000 of Rom - ZetMapArea(0x0000,0x7fff,0,CpsZRom); - ZetMapArea(0x0000,0x7fff,2,CpsZRom); - - // Map first Bank of Rom to 0x8000-0xc000 - nPsndZBank=0; - PsndZBankMap(); - - // Ram - ZetMapArea(0xd000,0xd7ff,0,PsndZRam); - ZetMapArea(0xd000,0xd7ff,1,PsndZRam); - ZetMapArea(0xd000,0xd7ff,2,PsndZRam); - - // Sound chip interfaces - ZetMemCallback(0xf000,0xffff,0); - ZetMemCallback(0xf000,0xffff,1); - - // In case it tries to fetch other areas - ZetMapArea(0xc000,0xcfff,2,CpsZRom); - ZetMapArea(0xd800,0xffff,2,CpsZRom); - ZetMemEnd(); - ZetClose(); - - return 0; -} - -INT32 PsndZExit() -{ - BurnFree(PsndZRam); - - ZetExit(); - return 0; -} - -// Scan the current PSound z80 state -INT32 PsndZScan(INT32 nAction) -{ - struct BurnArea ba; - ZetScan(nAction); - - MSM6295Scan(0, nAction); - BurnYM2151Scan(nAction); - - SCAN_VAR(nPsndZBank); - - // Scan Ram - memset(&ba, 0, sizeof(ba)); - ba.szName = "Z80 RAM"; - ba.Data = PsndZRam; - ba.nLen = 0x800; - BurnAcb(&ba); - - return 0; -} +#include "cps.h" +#include "burn_ym2151.h" + +// PSound - Z80 +static INT32 nPsndZBank = 0; +static UINT8 *PsndZRam = NULL; + +INT32 Kodb = 0; + +// Map in the memory for the current 0zx8000-0xc000 bank +static INT32 PsndZBankMap() +{ + UINT8 *Bank; + UINT32 nOff = (nPsndZBank << 14) + 0x8000; + + if (nOff + 0x4000 > nCpsZRomLen) { // End of bank in out of range + nOff = 0; + } + + Bank = CpsZRom + nOff; + + // Read and fetch the bank + ZetMapArea(0x8000, 0xBFFF, 0, Bank); + ZetMapArea(0x8000, 0xBFFF, 2, Bank); + + return 0; +} + +// PSound Z80 memory write +void __fastcall PsndZWrite(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xF000: + BurnYM2151SelectRegister(d); +// bprintf(PRINT_NORMAL, "YM2151 select -> %02X\n", d); + break; + case 0xF001: + BurnYM2151WriteRegister(d); +// bprintf(PRINT_NORMAL, "YM2151 write -> %02X\n", d); + break; + case 0xF002: + MSM6295Command(0, d); + break; + case 0xF004: { + INT32 nNewBank = d & 0x0f; + if (nPsndZBank != nNewBank) { + nPsndZBank = nNewBank; + PsndZBankMap(); + } + break; + } + case 0xF006: // ??? Enable interrupt ??? + break; + +#ifdef FBA_DEBUG +// default: +// bprintf(PRINT_NORMAL, _T("Z80 address %04X -> %02X.\n"), a, d); +#endif + + } + return; +} + +void __fastcall kodbZWrite(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xE000: + BurnYM2151SelectRegister(d); + break; + case 0xE001: + BurnYM2151WriteRegister(d); + break; + case 0xE400: + MSM6295Command(0, d); + break; + +#ifdef FBA_DEBUG +// default: +// bprintf(PRINT_NORMAL, _T("Z80 address %04X -> %02X.\n"), a, d); +#endif + + } + return; +} + +// PSound Z80 memory read +UINT8 __fastcall PsndZRead(UINT16 a) +{ + switch (a) { + case 0xF001: + return BurnYM2151ReadStatus(); + case 0xF002: + return MSM6295ReadStatus(0); + case 0xF008: +// bprintf(PRINT_NORMAL, " -- Sound latch read (%i).\n", PsndCode); + return PsndCode; + case 0xF00A: + return PsndFade; + +#ifdef FBA_DEBUG +// default: +// bprintf(PRINT_NORMAL, _T("Z80 address %04X read.\n"), a); +#endif + + } + return 0; +} + +UINT8 __fastcall kodbZRead(UINT16 a) +{ + switch (a) { + case 0xE001: + return BurnYM2151ReadStatus(); + case 0xE400: + return MSM6295ReadStatus(0); + case 0xE800: + return PsndCode; + +#ifdef FBA_DEBUG +// default: +// bprintf(PRINT_NORMAL, _T("Z80 address %04X read.\n"), a); +#endif + + } + return 0; +} + +INT32 PsndZInit() +{ + if (nCpsZRomLen < 0x8000) { // Not enough Z80 Data + return 1; + } + if (CpsZRom == NULL) { + return 1; + } + + PsndZRam = (UINT8 *)BurnMalloc(0x800); + if (PsndZRam == NULL) { + return 1; + } + + ZetInit(0); + ZetOpen(0); + + if (Kodb) { + ZetSetReadHandler(kodbZRead); + ZetSetWriteHandler(kodbZWrite); + } else { + ZetSetReadHandler(PsndZRead); + ZetSetWriteHandler(PsndZWrite); + } + + // Read and fetch first 0x8000 of Rom + ZetMapArea(0x0000,0x7fff,0,CpsZRom); + ZetMapArea(0x0000,0x7fff,2,CpsZRom); + + // Map first Bank of Rom to 0x8000-0xc000 + nPsndZBank=0; + PsndZBankMap(); + + // Ram + ZetMapArea(0xd000,0xd7ff,0,PsndZRam); + ZetMapArea(0xd000,0xd7ff,1,PsndZRam); + ZetMapArea(0xd000,0xd7ff,2,PsndZRam); + + // Sound chip interfaces + ZetMemCallback(0xf000,0xffff,0); + ZetMemCallback(0xf000,0xffff,1); + + // In case it tries to fetch other areas + ZetMapArea(0xc000,0xcfff,2,CpsZRom); + ZetMapArea(0xd800,0xffff,2,CpsZRom); + ZetClose(); + + return 0; +} + +INT32 PsndZExit() +{ + BurnFree(PsndZRam); + + ZetExit(); + return 0; +} + +// Scan the current PSound z80 state +INT32 PsndZScan(INT32 nAction) +{ + struct BurnArea ba; + ZetScan(nAction); + + MSM6295Scan(0, nAction); + BurnYM2151Scan(nAction); + + SCAN_VAR(nPsndZBank); + + // Scan Ram + memset(&ba, 0, sizeof(ba)); + ba.szName = "Z80 RAM"; + ba.Data = PsndZRam; + ba.nLen = 0x800; + BurnAcb(&ba); + + return 0; +} diff --git a/src/burn/drv/capcom/qs_z.cpp b/src/burn/drv/capcom/qs_z.cpp index b3b851a36..8429e8965 100644 --- a/src/burn/drv/capcom/qs_z.cpp +++ b/src/burn/drv/capcom/qs_z.cpp @@ -1,141 +1,140 @@ -#include "cps.h" -// QSound - Z80 - -static INT32 nQsndZBank = 0; - -// Map in the memory for the current 0x8000-0xc000 music bank -static INT32 QsndZBankMap() -{ - UINT32 nOff; - UINT8* Bank; - nOff = nQsndZBank << 14; - nOff += 0x8000; - - if (Cps1Qs == 0) { - if (nOff + 0x4000 > nCpsZRomLen) { // End of bank is out of range - nOff = 0; - } - Bank = CpsZRom + nOff; - } else { - if (nOff + 0x4000 > (nCpsZRomLen / 2)) { - nOff = 0; - } - Bank = CpsZRom - (nCpsZRomLen / 2) + nOff; - } - - // Read and fetch the bank - ZetMapArea(0x8000, 0xbfff, 0, Bank); - if (Cps1Qs == 0) { - ZetMapArea(0x8000, 0xbfff, 2, Bank, CpsZRom + nOff); - } else { - ZetMapArea(0x8000, 0xbfff, 2, Bank); - } - - return 0; -} - -static UINT8 QscCmd[2] = {0, 0}; - -void __fastcall QsndZWrite(UINT16 a, UINT8 d) -{ - if (a == 0xd000) { - QscCmd[0] = d; - return; - } - if (a == 0xd001) { - QscCmd[1] = d; - return; - } - if (a == 0xd002) { - QscWrite(d, (QscCmd[0] << 8) | QscCmd[1]); -// bprintf(PRINT_NORMAL, _T("QSound command %02X %04X sent.\n"), d, (QscCmd[0] << 8) | QscCmd[1]); - return; - } - if (a == 0xd003) { - INT32 nNewBank = d & 0x0f; - if (nQsndZBank != nNewBank) { - nQsndZBank = nNewBank; - QsndZBankMap(); - } - } -} - -UINT8 __fastcall QsndZRead(UINT16 a) -{ - if (a == 0xd007) { // return ready all the time - return 0x80; - } - return 0; -} - -INT32 QsndZInit() -{ - if (nCpsZRomLen < 0x8000) { // Not enough Z80 Data - return 1; - } - if (CpsZRom == NULL) { - return 1; - } - - ZetInit(0); - ZetOpen(0); - - ZetSetReadHandler(QsndZRead); - ZetSetWriteHandler(QsndZWrite); - - // Read and fetch first 0x8000 of Rom - if (Cps1Qs) { - ZetMapArea(0x0000, 0x7FFF, 0, CpsZRom - (nCpsZRomLen / 2)); - ZetMapArea(0x0000, 0x7FFF, 2, CpsZRom, CpsZRom - (nCpsZRomLen / 2)); // If it tries to fetch this area - } else { - ZetMapArea(0x0000, 0x7FFF, 0 ,CpsZRom); - ZetMapArea(0x0000, 0x7FFF, 2, CpsZRom); - } - - // Map first Bank of Rom - nQsndZBank = 0; - QsndZBankMap(); - - ZetMapArea(0xC000, 0xCFFF, 0, CpsZRamC0); - ZetMapArea(0xC000, 0xCFFF, 1, CpsZRamC0); - ZetMapArea(0xC000, 0xCFFF, 2, CpsZRamC0); - - ZetMemCallback(0xD000, 0xEFFF, 0); - ZetMemCallback(0xD000, 0xEFFF, 1); - - if (Cps1Qs) { - ZetMapArea(0xD000, 0xEFFF, 2, CpsZRom, CpsZRom - (nCpsZRomLen / 2)); // If it tries to fetch this area - } else { - ZetMapArea(0xD000, 0xEFFF, 2, CpsZRom); - } - - ZetMapArea(0xF000, 0xFFFF, 0, CpsZRamF0); - ZetMapArea(0xF000, 0xFFFF, 1, CpsZRamF0); - ZetMapArea(0xF000, 0xFFFF, 2, CpsZRamF0); - - ZetMemEnd(); - ZetClose(); - - return 0; -} - -INT32 QsndZExit() -{ - ZetExit(); - return 0; -} - -// Scan the current QSound z80 state -INT32 QsndZScan(INT32 nAction) -{ - ZetScan(nAction); // Scan Z80 - SCAN_VAR(nQsndZBank); - - if (nAction & ACB_WRITE) { // If write, bank could have changed - ZetOpen(0); - QsndZBankMap(); - ZetClose(); - } - - return 0; -} +#include "cps.h" +// QSound - Z80 + +static INT32 nQsndZBank = 0; + +// Map in the memory for the current 0x8000-0xc000 music bank +static INT32 QsndZBankMap() +{ + UINT32 nOff; + UINT8* Bank; + nOff = nQsndZBank << 14; + nOff += 0x8000; + + if (Cps1Qs == 0) { + if (nOff + 0x4000 > nCpsZRomLen) { // End of bank is out of range + nOff = 0; + } + Bank = CpsZRom + nOff; + } else { + if (nOff + 0x4000 > (nCpsZRomLen / 2)) { + nOff = 0; + } + Bank = CpsZRom - (nCpsZRomLen / 2) + nOff; + } + + // Read and fetch the bank + ZetMapArea(0x8000, 0xbfff, 0, Bank); + if (Cps1Qs == 0) { + ZetMapArea(0x8000, 0xbfff, 2, Bank, CpsZRom + nOff); + } else { + ZetMapArea(0x8000, 0xbfff, 2, Bank); + } + + return 0; +} + +static UINT8 QscCmd[2] = {0, 0}; + +void __fastcall QsndZWrite(UINT16 a, UINT8 d) +{ + if (a == 0xd000) { + QscCmd[0] = d; + return; + } + if (a == 0xd001) { + QscCmd[1] = d; + return; + } + if (a == 0xd002) { + QscWrite(d, (QscCmd[0] << 8) | QscCmd[1]); +// bprintf(PRINT_NORMAL, _T("QSound command %02X %04X sent.\n"), d, (QscCmd[0] << 8) | QscCmd[1]); + return; + } + if (a == 0xd003) { + INT32 nNewBank = d & 0x0f; + if (nQsndZBank != nNewBank) { + nQsndZBank = nNewBank; + QsndZBankMap(); + } + } +} + +UINT8 __fastcall QsndZRead(UINT16 a) +{ + if (a == 0xd007) { // return ready all the time + return 0x80; + } + return 0; +} + +INT32 QsndZInit() +{ + if (nCpsZRomLen < 0x8000) { // Not enough Z80 Data + return 1; + } + if (CpsZRom == NULL) { + return 1; + } + + ZetInit(0); + ZetOpen(0); + + ZetSetReadHandler(QsndZRead); + ZetSetWriteHandler(QsndZWrite); + + // Read and fetch first 0x8000 of Rom + if (Cps1Qs) { + ZetMapArea(0x0000, 0x7FFF, 0, CpsZRom - (nCpsZRomLen / 2)); + ZetMapArea(0x0000, 0x7FFF, 2, CpsZRom, CpsZRom - (nCpsZRomLen / 2)); // If it tries to fetch this area + } else { + ZetMapArea(0x0000, 0x7FFF, 0 ,CpsZRom); + ZetMapArea(0x0000, 0x7FFF, 2, CpsZRom); + } + + // Map first Bank of Rom + nQsndZBank = 0; + QsndZBankMap(); + + ZetMapArea(0xC000, 0xCFFF, 0, CpsZRamC0); + ZetMapArea(0xC000, 0xCFFF, 1, CpsZRamC0); + ZetMapArea(0xC000, 0xCFFF, 2, CpsZRamC0); + + ZetMemCallback(0xD000, 0xEFFF, 0); + ZetMemCallback(0xD000, 0xEFFF, 1); + + if (Cps1Qs) { + ZetMapArea(0xD000, 0xEFFF, 2, CpsZRom, CpsZRom - (nCpsZRomLen / 2)); // If it tries to fetch this area + } else { + ZetMapArea(0xD000, 0xEFFF, 2, CpsZRom); + } + + ZetMapArea(0xF000, 0xFFFF, 0, CpsZRamF0); + ZetMapArea(0xF000, 0xFFFF, 1, CpsZRamF0); + ZetMapArea(0xF000, 0xFFFF, 2, CpsZRamF0); + + ZetClose(); + + return 0; +} + +INT32 QsndZExit() +{ + ZetExit(); + return 0; +} + +// Scan the current QSound z80 state +INT32 QsndZScan(INT32 nAction) +{ + ZetScan(nAction); // Scan Z80 + SCAN_VAR(nQsndZBank); + + if (nAction & ACB_WRITE) { // If write, bank could have changed + ZetOpen(0); + QsndZBankMap(); + ZetClose(); + } + + return 0; +} diff --git a/src/burn/drv/capcom/sf2mdt_snd.cpp b/src/burn/drv/capcom/sf2mdt_snd.cpp index b663a17ca..911eee119 100644 --- a/src/burn/drv/capcom/sf2mdt_snd.cpp +++ b/src/burn/drv/capcom/sf2mdt_snd.cpp @@ -129,7 +129,6 @@ INT32 Sf2mdtSoundInit() ZetMapArea(0xd000, 0xd7ff, 0, Sf2mdtZ80Ram ); ZetMapArea(0xd000, 0xd7ff, 1, Sf2mdtZ80Ram ); ZetMapArea(0xd000, 0xd7ff, 2, Sf2mdtZ80Ram ); - ZetMemEnd(); ZetClose(); BurnYM2151Init(3579540); diff --git a/src/burn/drv/cave/d_hotdogst.cpp b/src/burn/drv/cave/d_hotdogst.cpp index 3ee416d8b..5dedd56d6 100644 --- a/src/burn/drv/cave/d_hotdogst.cpp +++ b/src/burn/drv/cave/d_hotdogst.cpp @@ -1,741 +1,740 @@ -// hotdogst -#include "cave.h" -#include "msm6295.h" -#include "burn_ym2203.h" - -#define CAVE_VBLANK_LINES 12 - -static UINT8 DrvJoy1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT16 DrvInput[2] = {0x0000, 0x0000}; - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01, *RomZ80; -static UINT8 *Ram01, *RamZ80; -static UINT8 *MSM6295ROMSrc; -static UINT8 *DefaultEEPROM = NULL; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static INT8 nVideoIRQ; -static INT8 nSoundIRQ; -static INT8 nUnknownIRQ; - -static INT8 nIRQPending; - -static INT32 nCyclesTotal[2]; -static INT32 nCyclesDone[2]; - -static UINT16 DrvSoundLatch; -static UINT8 DrvZ80Bank; -static UINT8 DrvOkiBank1; -static UINT8 DrvOkiBank2; - -static struct BurnInputInfo hotdogstInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 9, "diag"}, - {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service"}, -}; - -STDINPUTINFO(hotdogst) - -static void UpdateIRQStatus() -{ - nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0); - SekSetIRQLine(1, nIRQPending ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE); -} - -UINT8 __fastcall hotdogstReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xc80002: - return ((DrvInput[1] >> 8) ^ 0xF7) | (EEPROMRead() << 3); - default: { - bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); - } - } - return 0; -} - -void __fastcall hotdogstWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - if (~byteValue & 0x0100) { - case 0xd00000: - EEPROMWrite(byteValue & 0x04, byteValue & 0x02, byteValue & 0x08); - break; - } - default: { - bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); - - } - } -} - -UINT16 __fastcall hotdogstReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xa80000: - case 0xa80002: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - return nRet; - } - case 0xa80004: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nVideoIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - case 0xa80006: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nUnknownIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - -// case 0xa8006e: { -// return 0xff; -// } - - case 0xc80000: - return DrvInput[0] ^ 0xFFFF; - case 0xC80002: - return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11); - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); - } - } - return 0; -} - -void __fastcall hotdogstWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - case 0xa80000: - nCaveXOffset = wordValue; - return; - case 0xa80002: - nCaveYOffset = wordValue; - return; - - case 0xa80008: - CaveSpriteBuffer(); - nCaveSpriteBank = wordValue; - return; - - case 0xa8006e: { - DrvSoundLatch = wordValue; - ZetNmi(); - return; - } - - case 0xb00000: - CaveTileReg[0][0] = wordValue; - break; - case 0xb00002: - CaveTileReg[0][1] = wordValue; - break; - case 0xb00004: - CaveTileReg[0][2] = wordValue; - break; - - case 0xb80000: - CaveTileReg[1][0] = wordValue; - break; - case 0xb80002: - CaveTileReg[1][1] = wordValue; - break; - case 0xb80004: - CaveTileReg[1][2] = wordValue; - break; - - case 0xc00000: - CaveTileReg[2][0] = wordValue; - break; - case 0xc00002: - CaveTileReg[2][1] = wordValue; - break; - case 0xc00004: - CaveTileReg[2][2] = wordValue; - break; - - case 0xd00000: - if (~wordValue & 0x0100) { - wordValue >>= 8; - EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); - break; - } - case 0xd00002: { - //nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); - - } - } -} - -UINT8 __fastcall hotdogstZIn(UINT16 nAddress) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x30: { - return DrvSoundLatch & 0xff; - } - - case 0x40: { - return (DrvSoundLatch & 0xff00) >> 8; - } - - case 0x50: { - return BurnYM2203Read(0, 0); - } - - case 0x60: { - return MSM6295ReadStatus(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Read %x\n"), nAddress); - } - } - - return 0; -} - -void __fastcall hotdogstZOut(UINT16 nAddress, UINT8 nValue) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x00: { - DrvZ80Bank = nValue & 0x0f; - - ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); - return; - } - - case 0x50: { - BurnYM2203Write(0, 0, nValue); - return; - } - - case 0x51: { - BurnYM2203Write(0, 1, nValue); - return; - } - - case 0x60: { - MSM6295Command(0, nValue); - return; - } - - case 0x70: { - DrvOkiBank1 = (nValue >> 0) & 0x03; - DrvOkiBank2 = (nValue >> 4) & 0x03; - - memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000); - memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write %x, %x\n"), nAddress, nValue); - } - } -} - -UINT8 __fastcall hotdogstZRead(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall hotdogstZWrite(UINT16 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 DrvExit() -{ - EEPROMExit(); - - MSM6295Exit(0); - - CaveTileExit(); - CaveSpriteExit(); - CavePalExit(); - - SekExit(); // Deallocate 68000s - ZetExit(); - - BurnYM2203Exit(); - - DrvSoundLatch = 0; - DrvZ80Bank = 0; - DrvOkiBank1 = 0; - DrvOkiBank2 = 0; - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - MSM6295Reset(0); - - EEPROMReset(); - - nVideoIRQ = 1; - nSoundIRQ = 1; - nUnknownIRQ = 1; - - nIRQPending = 0; - - DrvSoundLatch = 0; - DrvZ80Bank = 0; - DrvOkiBank1 = 0; - DrvOkiBank2 = 0; - - return 0; -} - -static INT32 DrvDraw() -{ - CavePalUpdate4Bit(0, 128); // Update the palette - CaveClearScreen(CavePalette[0x3F00]); - - if (bDrawScreen) { -// CaveGetBitmap(); - - CaveTileRender(1); // Render tiles - } - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nCyclesVBlank; - INT32 nInterleave = 80; - - INT32 nCyclesSegment; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x0000; // Player 1 - DrvInput[1] = 0x0000; // Player 2 - for (INT32 i = 0; i < 10; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - } - CaveClearOpposites(&DrvInput[0]); - CaveClearOpposites(&DrvInput[1]); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); - nCyclesTotal[1] = (INT32)(4000000 / CAVE_REFRESHRATE); - nCyclesDone[0] = nCyclesDone[1] = 0; - - nCyclesVBlank = nCyclesTotal[0] - (INT32)((nCyclesTotal[0] * CAVE_VBLANK_LINES) / 271.5); - bVBlank = false; - - for (INT32 i = 1; i <= nInterleave; i++) { - INT32 nCurrentCPU = 0; - INT32 nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; - - // Run 68000 - - // See if we need to trigger the VBlank interrupt - if (!bVBlank && nNext > nCyclesVBlank) { - if (nCyclesDone[nCurrentCPU] < nCyclesVBlank) { - nCyclesSegment = nCyclesVBlank - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - } - - if (pBurnDraw != NULL) { - DrvDraw(); // Draw screen if needed - } - - CaveSpriteBuffer(); - - bVBlank = true; - nVideoIRQ = 0; - UpdateIRQStatus(); - } - - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - } - - SekClose(); - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - - return 0; -} - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8* Next; Next = Mem; - Rom01 = Next; Next += 0x100000; // 68K program - RomZ80 = Next; Next += 0x040000; - CaveSpriteROM = Next; Next += 0x800000; - CaveTileROM[0] = Next; Next += 0x100000; // Tile layer 0 - CaveTileROM[1] = Next; Next += 0x100000; // Tile layer 1 - CaveTileROM[2] = Next; Next += 0x100000; // Tile layer 2 - MSM6295ROM = Next; Next += 0x040000; - MSM6295ROMSrc = Next; Next += 0x080000; - DefaultEEPROM = Next; Next += 0x000080; - RamStart = Next; - Ram01 = Next; Next += 0x010000; // CPU #0 work RAM - RamZ80 = Next; Next += 0x002000; - CaveTileRAM[0] = Next; Next += 0x008000; - CaveTileRAM[1] = Next; Next += 0x008000; - CaveTileRAM[2] = Next; Next += 0x008000; - CaveSpriteRAM = Next; Next += 0x010000; - CavePalSrc = Next; Next += 0x001000; // palette - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static void NibbleSwap1(UINT8* pData, INT32 nLen) -{ - UINT8* pOrg = pData + nLen - 1; - UINT8* pDest = pData + ((nLen - 1) << 1); - - for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { - pDest[0] = *pOrg & 15; - pDest[1] = *pOrg >> 4; - } - - return; -} - -static void NibbleSwap2(UINT8* pData, INT32 nLen) -{ - UINT8* pOrg = pData + nLen - 1; - UINT8* pDest = pData + ((nLen - 1) << 1); - - for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { - pDest[1] = *pOrg & 15; - pDest[0] = *pOrg >> 4; - } - - return; -} - -static INT32 LoadRoms() -{ - BurnLoadRom(Rom01 + 1, 0, 2); - BurnLoadRom(Rom01 + 0, 1, 2); - - BurnLoadRom(RomZ80, 2, 1); - - BurnLoadRom(CaveSpriteROM + 0x000000, 3, 1); - BurnLoadRom(CaveSpriteROM + 0x200000, 4, 1); - NibbleSwap1(CaveSpriteROM, 0x400000); - - BurnLoadRom(CaveTileROM[0], 5, 1); - NibbleSwap2(CaveTileROM[0], 0x080000); - BurnLoadRom(CaveTileROM[1], 6, 1); - NibbleSwap2(CaveTileROM[1], 0x080000); - BurnLoadRom(CaveTileROM[2], 7, 1); - NibbleSwap2(CaveTileROM[2], 0x080000); - - // Load MSM6295 ADPCM data - BurnLoadRom(MSM6295ROMSrc, 8, 1); - - BurnLoadRom(DefaultEEPROM, 9, 1); - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029719; - } - - EEPROMScan(nAction, pnMin); // Scan EEPROM - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - - SCAN_VAR(nVideoIRQ); - SCAN_VAR(nSoundIRQ); - SCAN_VAR(nUnknownIRQ); - SCAN_VAR(bVBlank); - - CaveScanGraphics(); - - SCAN_VAR(DrvInput); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(DrvZ80Bank); - SCAN_VAR(DrvOkiBank1); - SCAN_VAR(DrvOkiBank2); - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetClose(); - - memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000); - memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000); - - CaveRecalcPalette = 1; - } - } - - return 0; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000; -} - -static INT32 drvZInit() -{ - ZetInit(0); - ZetOpen(0); - - ZetSetInHandler(hotdogstZIn); - ZetSetOutHandler(hotdogstZOut); - ZetSetReadHandler(hotdogstZRead); - ZetSetWriteHandler(hotdogstZWrite); - - // ROM bank 1 - ZetMapArea (0x0000, 0x3FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM - ZetMapArea (0x0000, 0x3FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM - // ROM bank 2 - ZetMapArea (0x4000, 0x7FFF, 0, RomZ80 + 0x4000); // Direct Read from ROM - ZetMapArea (0x4000, 0x7FFF, 2, RomZ80 + 0x4000); // - // RAM - ZetMapArea (0xE000, 0xFFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0xE000, 0xFFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0xE000, 0xFFFF, 2, RamZ80); // - ZetMemEnd(); - ZetClose(); - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - BurnSetRefreshRate(CAVE_REFRESHRATE); - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - EEPROMInit(&eeprom_interface_93C46); - if (!EEPROMAvailable()) EEPROMFill(DefaultEEPROM,0, 0x80); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x300000, 0x30FFFF, SM_RAM); - SekMapMemory(CavePalSrc, 0x408000, 0x408FFF, SM_RAM); // Palette RAM - SekMapMemory(CaveTileRAM[0], 0x880000, 0x887FFF, SM_RAM); - SekMapMemory(CaveTileRAM[1], 0x900000, 0x907FFF, SM_RAM); - SekMapMemory(CaveTileRAM[2], 0x980000, 0x987FFF, SM_RAM); - SekMapMemory(CaveSpriteRAM, 0xf00000, 0xf0fFFF, SM_RAM); - - SekSetReadByteHandler(0, hotdogstReadByte); - SekSetWriteByteHandler(0, hotdogstWriteByte); - SekSetReadWordHandler(0, hotdogstReadWord); - SekSetWriteWordHandler(0, hotdogstWriteWord); - SekClose(); - } - - drvZInit(); - - CavePalInit(0x8000); - CaveTileInit(); - CaveSpriteInit(2, 0x0800000); - CaveTileInitLayer(0, 0x100000, 8, 0); - CaveTileInitLayer(1, 0x100000, 8, 0); - CaveTileInitLayer(2, 0x100000, 8, 0); - - nCaveExtraXOffset = -32; - nCaveExtraYOffset = 32; - - BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.80, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); - - memcpy(MSM6295ROM, MSM6295ROMSrc, 0x40000); - MSM6295Init(0, 1056000 / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - - return 0; -} - -// Rom information -static struct BurnRomInfo hotdogstRomDesc[] = { - { "mp3.u29", 0x080000, 0x1f4e5479, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "mp4.u28", 0x080000, 0x6f1c3c4b, BRF_ESS | BRF_PRG }, // 1 - - { "mp2.u19", 0x040000, 0xff979ebe, BRF_ESS | BRF_PRG }, // 2 Z80 Code - - { "mp9.u55", 0x200000, 0x258d49ec, BRF_GRA }, // 3 Sprite data - { "mp8.u54", 0x200000, 0xbdb4d7b8, BRF_GRA }, // 4 - - { "mp7.u56", 0x080000, 0x87c21c50, BRF_GRA }, // 5 Layer 0 Tile data - { "mp6.u61", 0x080000, 0x4dafb288, BRF_GRA }, // 6 Layer 1 Tile data - { "mp5.u64", 0x080000, 0x9b26458c, BRF_GRA }, // 7 Layer 2 Tile data - - { "mp1.u65", 0x080000, 0x4868be1b, BRF_SND }, // 8 MSM6295 #1 ADPCM data - - { "eeprom-hotdogst.bin", 0x0080, 0x12b4f934, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(hotdogst) -STD_ROM_FN(hotdogst) - -struct BurnDriver BurnDrvhotdogst = { - "hotdogst", NULL, NULL, NULL, "1996", - "Hotdog Storm - The First Supersonics (International)\0", NULL, "Marble / ACE International", "Cave", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, - NULL, hotdogstRomInfo, hotdogstRomName, NULL, NULL, hotdogstInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 240, 384, 3, 4 -}; +// hotdogst +#include "cave.h" +#include "msm6295.h" +#include "burn_ym2203.h" + +#define CAVE_VBLANK_LINES 12 + +static UINT8 DrvJoy1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT16 DrvInput[2] = {0x0000, 0x0000}; + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01, *RomZ80; +static UINT8 *Ram01, *RamZ80; +static UINT8 *MSM6295ROMSrc; +static UINT8 *DefaultEEPROM = NULL; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static INT8 nVideoIRQ; +static INT8 nSoundIRQ; +static INT8 nUnknownIRQ; + +static INT8 nIRQPending; + +static INT32 nCyclesTotal[2]; +static INT32 nCyclesDone[2]; + +static UINT16 DrvSoundLatch; +static UINT8 DrvZ80Bank; +static UINT8 DrvOkiBank1; +static UINT8 DrvOkiBank2; + +static struct BurnInputInfo hotdogstInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 9, "diag"}, + {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service"}, +}; + +STDINPUTINFO(hotdogst) + +static void UpdateIRQStatus() +{ + nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0); + SekSetIRQLine(1, nIRQPending ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE); +} + +UINT8 __fastcall hotdogstReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xc80002: + return ((DrvInput[1] >> 8) ^ 0xF7) | (EEPROMRead() << 3); + default: { + bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); + } + } + return 0; +} + +void __fastcall hotdogstWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + if (~byteValue & 0x0100) { + case 0xd00000: + EEPROMWrite(byteValue & 0x04, byteValue & 0x02, byteValue & 0x08); + break; + } + default: { + bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); + + } + } +} + +UINT16 __fastcall hotdogstReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xa80000: + case 0xa80002: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + return nRet; + } + case 0xa80004: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nVideoIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + case 0xa80006: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nUnknownIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + +// case 0xa8006e: { +// return 0xff; +// } + + case 0xc80000: + return DrvInput[0] ^ 0xFFFF; + case 0xC80002: + return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11); + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); + } + } + return 0; +} + +void __fastcall hotdogstWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + case 0xa80000: + nCaveXOffset = wordValue; + return; + case 0xa80002: + nCaveYOffset = wordValue; + return; + + case 0xa80008: + CaveSpriteBuffer(); + nCaveSpriteBank = wordValue; + return; + + case 0xa8006e: { + DrvSoundLatch = wordValue; + ZetNmi(); + return; + } + + case 0xb00000: + CaveTileReg[0][0] = wordValue; + break; + case 0xb00002: + CaveTileReg[0][1] = wordValue; + break; + case 0xb00004: + CaveTileReg[0][2] = wordValue; + break; + + case 0xb80000: + CaveTileReg[1][0] = wordValue; + break; + case 0xb80002: + CaveTileReg[1][1] = wordValue; + break; + case 0xb80004: + CaveTileReg[1][2] = wordValue; + break; + + case 0xc00000: + CaveTileReg[2][0] = wordValue; + break; + case 0xc00002: + CaveTileReg[2][1] = wordValue; + break; + case 0xc00004: + CaveTileReg[2][2] = wordValue; + break; + + case 0xd00000: + if (~wordValue & 0x0100) { + wordValue >>= 8; + EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); + break; + } + case 0xd00002: { + //nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); + + } + } +} + +UINT8 __fastcall hotdogstZIn(UINT16 nAddress) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x30: { + return DrvSoundLatch & 0xff; + } + + case 0x40: { + return (DrvSoundLatch & 0xff00) >> 8; + } + + case 0x50: { + return BurnYM2203Read(0, 0); + } + + case 0x60: { + return MSM6295ReadStatus(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Read %x\n"), nAddress); + } + } + + return 0; +} + +void __fastcall hotdogstZOut(UINT16 nAddress, UINT8 nValue) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x00: { + DrvZ80Bank = nValue & 0x0f; + + ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); + return; + } + + case 0x50: { + BurnYM2203Write(0, 0, nValue); + return; + } + + case 0x51: { + BurnYM2203Write(0, 1, nValue); + return; + } + + case 0x60: { + MSM6295Command(0, nValue); + return; + } + + case 0x70: { + DrvOkiBank1 = (nValue >> 0) & 0x03; + DrvOkiBank2 = (nValue >> 4) & 0x03; + + memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000); + memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write %x, %x\n"), nAddress, nValue); + } + } +} + +UINT8 __fastcall hotdogstZRead(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall hotdogstZWrite(UINT16 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 DrvExit() +{ + EEPROMExit(); + + MSM6295Exit(0); + + CaveTileExit(); + CaveSpriteExit(); + CavePalExit(); + + SekExit(); // Deallocate 68000s + ZetExit(); + + BurnYM2203Exit(); + + DrvSoundLatch = 0; + DrvZ80Bank = 0; + DrvOkiBank1 = 0; + DrvOkiBank2 = 0; + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + MSM6295Reset(0); + + EEPROMReset(); + + nVideoIRQ = 1; + nSoundIRQ = 1; + nUnknownIRQ = 1; + + nIRQPending = 0; + + DrvSoundLatch = 0; + DrvZ80Bank = 0; + DrvOkiBank1 = 0; + DrvOkiBank2 = 0; + + return 0; +} + +static INT32 DrvDraw() +{ + CavePalUpdate4Bit(0, 128); // Update the palette + CaveClearScreen(CavePalette[0x3F00]); + + if (bDrawScreen) { +// CaveGetBitmap(); + + CaveTileRender(1); // Render tiles + } + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nCyclesVBlank; + INT32 nInterleave = 80; + + INT32 nCyclesSegment; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x0000; // Player 1 + DrvInput[1] = 0x0000; // Player 2 + for (INT32 i = 0; i < 10; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + } + CaveClearOpposites(&DrvInput[0]); + CaveClearOpposites(&DrvInput[1]); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); + nCyclesTotal[1] = (INT32)(4000000 / CAVE_REFRESHRATE); + nCyclesDone[0] = nCyclesDone[1] = 0; + + nCyclesVBlank = nCyclesTotal[0] - (INT32)((nCyclesTotal[0] * CAVE_VBLANK_LINES) / 271.5); + bVBlank = false; + + for (INT32 i = 1; i <= nInterleave; i++) { + INT32 nCurrentCPU = 0; + INT32 nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; + + // Run 68000 + + // See if we need to trigger the VBlank interrupt + if (!bVBlank && nNext > nCyclesVBlank) { + if (nCyclesDone[nCurrentCPU] < nCyclesVBlank) { + nCyclesSegment = nCyclesVBlank - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + } + + if (pBurnDraw != NULL) { + DrvDraw(); // Draw screen if needed + } + + CaveSpriteBuffer(); + + bVBlank = true; + nVideoIRQ = 0; + UpdateIRQStatus(); + } + + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + } + + SekClose(); + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + + return 0; +} + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8* Next; Next = Mem; + Rom01 = Next; Next += 0x100000; // 68K program + RomZ80 = Next; Next += 0x040000; + CaveSpriteROM = Next; Next += 0x800000; + CaveTileROM[0] = Next; Next += 0x100000; // Tile layer 0 + CaveTileROM[1] = Next; Next += 0x100000; // Tile layer 1 + CaveTileROM[2] = Next; Next += 0x100000; // Tile layer 2 + MSM6295ROM = Next; Next += 0x040000; + MSM6295ROMSrc = Next; Next += 0x080000; + DefaultEEPROM = Next; Next += 0x000080; + RamStart = Next; + Ram01 = Next; Next += 0x010000; // CPU #0 work RAM + RamZ80 = Next; Next += 0x002000; + CaveTileRAM[0] = Next; Next += 0x008000; + CaveTileRAM[1] = Next; Next += 0x008000; + CaveTileRAM[2] = Next; Next += 0x008000; + CaveSpriteRAM = Next; Next += 0x010000; + CavePalSrc = Next; Next += 0x001000; // palette + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static void NibbleSwap1(UINT8* pData, INT32 nLen) +{ + UINT8* pOrg = pData + nLen - 1; + UINT8* pDest = pData + ((nLen - 1) << 1); + + for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { + pDest[0] = *pOrg & 15; + pDest[1] = *pOrg >> 4; + } + + return; +} + +static void NibbleSwap2(UINT8* pData, INT32 nLen) +{ + UINT8* pOrg = pData + nLen - 1; + UINT8* pDest = pData + ((nLen - 1) << 1); + + for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { + pDest[1] = *pOrg & 15; + pDest[0] = *pOrg >> 4; + } + + return; +} + +static INT32 LoadRoms() +{ + BurnLoadRom(Rom01 + 1, 0, 2); + BurnLoadRom(Rom01 + 0, 1, 2); + + BurnLoadRom(RomZ80, 2, 1); + + BurnLoadRom(CaveSpriteROM + 0x000000, 3, 1); + BurnLoadRom(CaveSpriteROM + 0x200000, 4, 1); + NibbleSwap1(CaveSpriteROM, 0x400000); + + BurnLoadRom(CaveTileROM[0], 5, 1); + NibbleSwap2(CaveTileROM[0], 0x080000); + BurnLoadRom(CaveTileROM[1], 6, 1); + NibbleSwap2(CaveTileROM[1], 0x080000); + BurnLoadRom(CaveTileROM[2], 7, 1); + NibbleSwap2(CaveTileROM[2], 0x080000); + + // Load MSM6295 ADPCM data + BurnLoadRom(MSM6295ROMSrc, 8, 1); + + BurnLoadRom(DefaultEEPROM, 9, 1); + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029719; + } + + EEPROMScan(nAction, pnMin); // Scan EEPROM + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + + SCAN_VAR(nVideoIRQ); + SCAN_VAR(nSoundIRQ); + SCAN_VAR(nUnknownIRQ); + SCAN_VAR(bVBlank); + + CaveScanGraphics(); + + SCAN_VAR(DrvInput); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(DrvZ80Bank); + SCAN_VAR(DrvOkiBank1); + SCAN_VAR(DrvOkiBank2); + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetClose(); + + memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000); + memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000); + + CaveRecalcPalette = 1; + } + } + + return 0; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000; +} + +static INT32 drvZInit() +{ + ZetInit(0); + ZetOpen(0); + + ZetSetInHandler(hotdogstZIn); + ZetSetOutHandler(hotdogstZOut); + ZetSetReadHandler(hotdogstZRead); + ZetSetWriteHandler(hotdogstZWrite); + + // ROM bank 1 + ZetMapArea (0x0000, 0x3FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM + ZetMapArea (0x0000, 0x3FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM + // ROM bank 2 + ZetMapArea (0x4000, 0x7FFF, 0, RomZ80 + 0x4000); // Direct Read from ROM + ZetMapArea (0x4000, 0x7FFF, 2, RomZ80 + 0x4000); // + // RAM + ZetMapArea (0xE000, 0xFFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0xE000, 0xFFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0xE000, 0xFFFF, 2, RamZ80); // + ZetClose(); + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + BurnSetRefreshRate(CAVE_REFRESHRATE); + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + EEPROMInit(&eeprom_interface_93C46); + if (!EEPROMAvailable()) EEPROMFill(DefaultEEPROM,0, 0x80); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x300000, 0x30FFFF, SM_RAM); + SekMapMemory(CavePalSrc, 0x408000, 0x408FFF, SM_RAM); // Palette RAM + SekMapMemory(CaveTileRAM[0], 0x880000, 0x887FFF, SM_RAM); + SekMapMemory(CaveTileRAM[1], 0x900000, 0x907FFF, SM_RAM); + SekMapMemory(CaveTileRAM[2], 0x980000, 0x987FFF, SM_RAM); + SekMapMemory(CaveSpriteRAM, 0xf00000, 0xf0fFFF, SM_RAM); + + SekSetReadByteHandler(0, hotdogstReadByte); + SekSetWriteByteHandler(0, hotdogstWriteByte); + SekSetReadWordHandler(0, hotdogstReadWord); + SekSetWriteWordHandler(0, hotdogstWriteWord); + SekClose(); + } + + drvZInit(); + + CavePalInit(0x8000); + CaveTileInit(); + CaveSpriteInit(2, 0x0800000); + CaveTileInitLayer(0, 0x100000, 8, 0); + CaveTileInitLayer(1, 0x100000, 8, 0); + CaveTileInitLayer(2, 0x100000, 8, 0); + + nCaveExtraXOffset = -32; + nCaveExtraYOffset = 32; + + BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.80, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); + + memcpy(MSM6295ROM, MSM6295ROMSrc, 0x40000); + MSM6295Init(0, 1056000 / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + + return 0; +} + +// Rom information +static struct BurnRomInfo hotdogstRomDesc[] = { + { "mp3.u29", 0x080000, 0x1f4e5479, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "mp4.u28", 0x080000, 0x6f1c3c4b, BRF_ESS | BRF_PRG }, // 1 + + { "mp2.u19", 0x040000, 0xff979ebe, BRF_ESS | BRF_PRG }, // 2 Z80 Code + + { "mp9.u55", 0x200000, 0x258d49ec, BRF_GRA }, // 3 Sprite data + { "mp8.u54", 0x200000, 0xbdb4d7b8, BRF_GRA }, // 4 + + { "mp7.u56", 0x080000, 0x87c21c50, BRF_GRA }, // 5 Layer 0 Tile data + { "mp6.u61", 0x080000, 0x4dafb288, BRF_GRA }, // 6 Layer 1 Tile data + { "mp5.u64", 0x080000, 0x9b26458c, BRF_GRA }, // 7 Layer 2 Tile data + + { "mp1.u65", 0x080000, 0x4868be1b, BRF_SND }, // 8 MSM6295 #1 ADPCM data + + { "eeprom-hotdogst.bin", 0x0080, 0x12b4f934, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(hotdogst) +STD_ROM_FN(hotdogst) + +struct BurnDriver BurnDrvhotdogst = { + "hotdogst", NULL, NULL, NULL, "1996", + "Hotdog Storm - The First Supersonics (International)\0", NULL, "Marble / ACE International", "Cave", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, + NULL, hotdogstRomInfo, hotdogstRomName, NULL, NULL, hotdogstInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 240, 384, 3, 4 +}; diff --git a/src/burn/drv/cave/d_mazinger.cpp b/src/burn/drv/cave/d_mazinger.cpp index 97f1f4ee0..14af4a1f9 100644 --- a/src/burn/drv/cave/d_mazinger.cpp +++ b/src/burn/drv/cave/d_mazinger.cpp @@ -1,819 +1,818 @@ -// mazinger -#include "cave.h" -#include "msm6295.h" -#include "burn_ym2203.h" -#include "bitswap.h" - -#define CAVE_VBLANK_LINES 12 - -static UINT8 DrvJoy1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT16 DrvInput[2] = {0x0000, 0x0000}; - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01, *RomZ80; -static UINT8 *Ram01, *RamZ80; -static UINT8 *MSM6295ROMSrc; -static UINT8 *DefEEPROM = NULL; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static INT8 nVideoIRQ; -static INT8 nSoundIRQ; -static INT8 nUnknownIRQ; - -static INT8 nIRQPending; - -static INT32 nCyclesTotal[2]; -static INT32 nCyclesDone[2]; - -static INT32 SoundLatch; -static INT32 SoundLatchReply[48]; -static INT32 SoundLatchStatus; - -static INT32 SoundLatchReplyIndex; -static INT32 SoundLatchReplyMax; - -static UINT8 DrvZ80Bank; -static UINT8 DrvOkiBank1; -static UINT8 DrvOkiBank2; - -static struct BurnInputInfo mazingerInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 9, "diag"}, - {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service"}, -}; - -STDINPUTINFO(mazinger) - -static void UpdateIRQStatus() -{ - nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0); - SekSetIRQLine(1, nIRQPending ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE); -} - -UINT8 __fastcall mazingerReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x800002: - return (DrvInput[1] ^ 0xF7) | (EEPROMRead() << 3); - case 0x800003: - return (DrvInput[1] & 0xFF) ^ 0xFF; - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); - } - } - return 0; -} - -void __fastcall mazingerWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - - case 0x900000: - EEPROMWrite(byteValue & 0x04, byteValue & 0x02, byteValue & 0x08); - break; - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); - - } - } -} - -UINT16 __fastcall mazingerReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x300000: - case 0x300002: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - return nRet; - } - case 0x300004: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nVideoIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - case 0x300006: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nUnknownIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - - case 0x30006E: - if (SoundLatchReplyIndex > SoundLatchReplyMax) { - SoundLatchReplyIndex = 0; - SoundLatchReplyMax = -1; - return 0; - } - return SoundLatchReply[SoundLatchReplyIndex++]; - - case 0x800000: - return DrvInput[0] ^ 0xFFFF; - case 0x800002: - return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11); - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); - } - } - return 0; -} - -void __fastcall mazingerWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - if (sekAddress >= 0x30000a && sekAddress <= 0x300066) return; - if (sekAddress >= 0x30006a && sekAddress <= 0x30006c) return; - if (sekAddress >= 0x300004 && sekAddress <= 0x300006) return; - - switch (sekAddress) { - case 0x300000: - nCaveXOffset = wordValue; - return; - case 0x300002: - nCaveYOffset = wordValue; - return; - - case 0x300008: -// CaveSpriteBuffer(); - nCaveSpriteBank = wordValue; - return; - - case 0x30006e: - SoundLatch = wordValue; - SoundLatchStatus |= 0x0C; - - ZetNmi(); - nCyclesDone[1] += ZetRun(0x0400); - return; - - case 0x600000: - CaveTileReg[1][0] = wordValue; - break; - case 0x600002: - CaveTileReg[1][1] = wordValue; - break; - case 0x600004: - CaveTileReg[1][2] = wordValue; - break; - - case 0x700000: - CaveTileReg[0][0] = wordValue; - break; - case 0x700002: - CaveTileReg[0][1] = wordValue; - break; - case 0x700004: - CaveTileReg[0][2] = wordValue; - break; - - case 0x900000: - wordValue >>= 8; - EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); - break; - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); - - } - } -} - -void __fastcall mazingerWriteBytePalette(UINT32 sekAddress, UINT8 byteValue) -{ - CavePalWriteByte(sekAddress & 0xffff, byteValue); -} - -void __fastcall mazingerWriteWordPalette(UINT32 sekAddress, UINT16 wordValue) -{ - CavePalWriteWord(sekAddress & 0xffff, wordValue); -} - -UINT8 __fastcall mazingerZIn(UINT16 nAddress) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x30: { - SoundLatchStatus |= 0x04; - return SoundLatch & 0xFF; - } - - case 0x52: { - return BurnYM2203Read(0, 0); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Read %x\n"), nAddress); - } - } - - return 0; -} - -void __fastcall mazingerZOut(UINT16 nAddress, UINT8 nValue) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x00: { - DrvZ80Bank = nValue & 0x07; - - ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); - return; - } - - case 0x10: - if (SoundLatchReplyIndex > SoundLatchReplyMax) { - SoundLatchReplyMax = -1; - SoundLatchReplyIndex = 0; - } - SoundLatchReplyMax++; - SoundLatchReply[SoundLatchReplyMax] = nValue; - break; - - case 0x50: { - BurnYM2203Write(0, 0, nValue); - return; - } - - case 0x51: { - BurnYM2203Write(0, 1, nValue); - return; - } - - case 0x70: { - MSM6295Command(0, nValue); - return; - } - - case 0x74: { - DrvOkiBank1 = (nValue >> 0) & 0x03; - DrvOkiBank2 = (nValue >> 4) & 0x03; - - memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000); - memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write %x, %x\n"), nAddress, nValue); - } - } -} - -UINT8 __fastcall mazingerZRead(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall mazingerZWrite(UINT16 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 DrvExit() -{ - EEPROMExit(); - - MSM6295Exit(0); - - CaveTileExit(); - CaveSpriteExit(); - CavePalExit(); - - SekExit(); // Deallocate 68000s - ZetExit(); - - BurnYM2203Exit(); - - SoundLatch = 0; - DrvZ80Bank = 0; - DrvOkiBank1 = 0; - DrvOkiBank2 = 0; - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekRun(10000); // Need to run for a bit and reset to make it start - Watchdog would force reset? - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - MSM6295Reset(0); - - EEPROMReset(); - - nVideoIRQ = 1; - nSoundIRQ = 1; - nUnknownIRQ = 1; - - nIRQPending = 0; - - SoundLatch = 0; - DrvZ80Bank = 0; - DrvOkiBank1 = 0; - DrvOkiBank2 = 0; - - SoundLatch = 0; - SoundLatchStatus = 0x0C; - - memset(SoundLatchReply, 0, sizeof(SoundLatchReply)); - SoundLatchReplyIndex = 0; - SoundLatchReplyMax = -1; - - return 0; -} - -static INT32 DrvDraw() -{ - if (CaveRecalcPalette) { - CavePalUpdate8Bit(0x4400, 12); - CaveRecalcPalette = 1; - } - CavePalUpdate4Bit(0, 64); - - CaveClearScreen(CavePalette[0x3F00]); - - if (bDrawScreen) { -// CaveGetBitmap(); - - CaveTileRender(1); // Render tiles - } - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nCyclesVBlank; - - INT32 nInterleave = 80; - - INT32 nCyclesSegment; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x0000; // Player 1 - DrvInput[1] = 0x0000; // Player 2 - for (INT32 i = 0; i < 10; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - } - CaveClearOpposites(&DrvInput[0]); - CaveClearOpposites(&DrvInput[1]); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); - nCyclesTotal[1] = (INT32)(4000000 / CAVE_REFRESHRATE); - nCyclesDone[0] = nCyclesDone[1] = 0; - - nCyclesVBlank = nCyclesTotal[0] - (INT32)((nCyclesTotal[0] * CAVE_VBLANK_LINES) / 271.5); - bVBlank = false; - - for (INT32 i = 1; i <= nInterleave; i++) { - INT32 nCurrentCPU = 0; - INT32 nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; - - // Run 68000 - - // See if we need to trigger the VBlank interrupt - if (!bVBlank && nNext > nCyclesVBlank) { - if (nCyclesDone[nCurrentCPU] < nCyclesVBlank) { - nCyclesSegment = nCyclesVBlank - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - } - - if (pBurnDraw != NULL) { - DrvDraw(); // Draw screen if needed - } - - CaveSpriteBuffer(); - UINT8 Temp = nCaveSpriteBank; - nCaveSpriteBank = nCaveSpriteBankDelay; - nCaveSpriteBankDelay = Temp; - - bVBlank = true; - nVideoIRQ = 0; - nUnknownIRQ = 0; - UpdateIRQStatus(); - } - - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - } - - SekClose(); - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - - return 0; -} - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8* Next; Next = Mem; - Rom01 = Next; Next += 0x100000; // 68K program - RomZ80 = Next; Next += 0x020000; - CaveSpriteROM = Next; Next += 0x800000; - CaveTileROM[0] = Next; Next += 0x400000; // Tile layer 0 - CaveTileROM[1] = Next; Next += 0x400000; // Tile layer 1 - MSM6295ROM = Next; Next += 0x040000; - MSM6295ROMSrc = Next; Next += 0x080000; - DefEEPROM = Next; Next += 0x000080; - RamStart = Next; - Ram01 = Next; Next += 0x010000; // CPU #0 work RAM - RamZ80 = Next; Next += 0x001000; - CaveTileRAM[0] = Next; Next += 0x008000; - CaveTileRAM[1] = Next; Next += 0x008000; - CaveSpriteRAM = Next; Next += 0x010000; - CavePalSrc = Next; Next += 0x010000; // palette - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static void NibbleSwap1(UINT8* pData, INT32 nLen) -{ - UINT8* pOrg = pData + nLen - 1; - UINT8* pDest = pData + ((nLen - 1) << 1); - - for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { - pDest[0] = *pOrg & 15; - pDest[1] = *pOrg >> 4; - } - - return; -} - -static void NibbleSwap2(UINT8* pData, INT32 nLen) -{ - UINT8* pOrg = pData + nLen - 1; - UINT8* pDest = pData + ((nLen - 1) << 1); - - for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { - pDest[1] = *pOrg & 15; - pDest[0] = *pOrg >> 4; - } - - return; -} - -static INT32 LoadRoms() -{ - BurnLoadRom(Rom01 + 0x00000, 0, 1); - BurnLoadRom(Rom01 + 0x80000, 1, 1); - - BurnLoadRom(RomZ80, 2, 1); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x400000); - BurnLoadRom(pTemp + 0x000000, 3, 1); - BurnLoadRom(pTemp + 0x200000, 4, 1); - for (INT32 i = 0; i < 0x400000; i++) { - CaveSpriteROM[i ^ 0xdf88] = pTemp[BITSWAP24(i,23,22,21,20,19,9,7,3,15,4,17,14,18,2,16,5,11,8,6,13,1,10,12,0)]; - } - BurnFree(pTemp); - NibbleSwap1(CaveSpriteROM, 0x400000); - - BurnLoadRom(CaveTileROM[0], 5, 1); - NibbleSwap2(CaveTileROM[0], 0x200000); - - pTemp = (UINT8*)BurnMalloc(0x200000); - BurnLoadRom(pTemp, 6, 1); - for (INT32 i = 0; i < 0x0100000; i++) { - CaveTileROM[1][(i << 1) + 1] = (pTemp[(i << 1) + 0] & 15) | ((pTemp[(i << 1) + 1] & 15) << 4); - CaveTileROM[1][(i << 1) + 0] = (pTemp[(i << 1) + 0] >> 4) | (pTemp[(i << 1) + 1] & 240); - } - BurnFree(pTemp); - - // Load MSM6295 ADPCM data - BurnLoadRom(MSM6295ROMSrc, 7, 1); - - BurnLoadRom(DefEEPROM, 8, 1); - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x020902; - } - - EEPROMScan(nAction, pnMin); // Scan EEPROM - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - - SCAN_VAR(nVideoIRQ); - SCAN_VAR(nSoundIRQ); - SCAN_VAR(nUnknownIRQ); - SCAN_VAR(bVBlank); - - CaveScanGraphics(); - - SCAN_VAR(DrvInput); - SCAN_VAR(SoundLatch); - SCAN_VAR(DrvZ80Bank); - SCAN_VAR(DrvOkiBank1); - SCAN_VAR(DrvOkiBank2); - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetClose(); - - memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000); - memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000); - - CaveRecalcPalette = 1; - } - } - - return 0; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000; -} - -static INT32 drvZInit() -{ - ZetInit(0); - ZetOpen(0); - ZetSetInHandler(mazingerZIn); - ZetSetOutHandler(mazingerZOut); - ZetSetReadHandler(mazingerZRead); - ZetSetWriteHandler(mazingerZWrite); - - // ROM bank 1 - ZetMapArea (0x0000, 0x3FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM - ZetMapArea (0x0000, 0x3FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM - // ROM bank 2 - ZetMapArea (0x4000, 0x7FFF, 0, RomZ80 + 0x4000); // Direct Read from ROM - ZetMapArea (0x4000, 0x7FFF, 2, RomZ80 + 0x4000); // - // RAM - ZetMapArea (0xc000, 0xc7FF, 0, RamZ80 + 0x0000); // Direct Read from RAM - ZetMapArea (0xc000, 0xc7FF, 1, RamZ80 + 0x0000); // Direct Write to RAM - ZetMapArea (0xc000, 0xc7FF, 2, RamZ80 + 0x0000); // - - ZetMapArea (0xf800, 0xffFF, 0, RamZ80 + 0x0800); // Direct Read from RAM - ZetMapArea (0xf800, 0xffFF, 1, RamZ80 + 0x0800); // Direct Write to RAM - ZetMapArea (0xf800, 0xffFF, 2, RamZ80 + 0x0800); // - ZetMemEnd(); - ZetClose(); - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - BurnSetRefreshRate(CAVE_REFRESHRATE); - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x100000, 0x10FFFF, SM_RAM); - SekMapMemory(CaveSpriteRAM, 0x200000, 0x20FFFF, SM_RAM); - SekMapMemory(CaveTileRAM[1] + 0x4000, 0x400000, 0x403FFF, SM_RAM); - SekMapMemory(CaveTileRAM[1] + 0x4000, 0x404000, 0x407FFF, SM_RAM); - SekMapMemory(CaveTileRAM[0] + 0x4000, 0x500000, 0x503FFF, SM_RAM); - SekMapMemory(CaveTileRAM[0] + 0x4000, 0x504000, 0x507FFF, SM_RAM); - SekMapMemory(CavePalSrc, 0xC08000, 0xc087FF, SM_RAM); // Palette RAM - SekMapMemory(CavePalSrc + 0x8800, 0xC08800, 0xC0FFFF, SM_ROM); // Palette RAM (write goes through handler) - SekMapHandler(1, 0xC08800, 0xC0FFFF, SM_WRITE); // - - SekMapMemory(Rom01 + 0x80000, 0xD00000, 0xD7FFFF, SM_ROM); // CPU 0 ROM - - SekSetReadByteHandler(0, mazingerReadByte); - SekSetWriteByteHandler(0, mazingerWriteByte); - SekSetReadWordHandler(0, mazingerReadWord); - SekSetWriteWordHandler(0, mazingerWriteWord); - - SekSetWriteWordHandler(1, mazingerWriteWordPalette); - SekSetWriteByteHandler(1, mazingerWriteBytePalette); - SekClose(); - } - - drvZInit(); - - CavePalInit(0x8000); - CaveTileInit(); - CaveSpriteInit(2, 0x0800000); - CaveTileInitLayer(0, 0x400000, 8, 0x0000); - CaveTileInitLayer(1, 0x400000, 6, 0x4400); - - BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); - - memcpy(MSM6295ROM, MSM6295ROMSrc, 0x40000); - MSM6295Init(0, 1056000 / 132, 1); - MSM6295SetRoute(0, 2.00, BURN_SND_ROUTE_BOTH); - - EEPROMInit(&eeprom_interface_93C46); - if (!EEPROMAvailable()) EEPROMFill(DefEEPROM,0, 0x80); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - - return 0; -} - -// Rom information -static struct BurnRomInfo mazingerRomDesc[] = { - { "mzp-0.u24", 0x080000, 0x43a4279f, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "mzp-1.924", 0x080000, 0xdb40acba, BRF_ESS | BRF_PRG }, // 1 - - { "mzs.u21", 0x020000, 0xc5b4f7ed, BRF_ESS | BRF_PRG }, // 2 Z80 Code - - { "bp943a-2.u56", 0x200000, 0x97e13959, BRF_GRA }, // 3 Sprite data - { "bp943a-3.u55", 0x080000, 0x9c4957dd, BRF_GRA }, // 4 - - { "bp943a-1.u60", 0x200000, 0x46327415, BRF_GRA }, // 5 Layer 0 Tile data - { "bp943a-0.u63", 0x200000, 0xc1fed98a, BRF_GRA }, // 6 Layer 1 Tile data - - { "bp943a-4.u64", 0x080000, 0x3fc7f29a, BRF_SND }, // 7 MSM6295 #1 ADPCM data - - { "mazinger_world.nv", 0x0080, 0x4f6225c6, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(mazinger) -STD_ROM_FN(mazinger) - -static struct BurnRomInfo mazingerjRomDesc[] = { - { "mzp-0.u24", 0x080000, 0x43a4279f, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "mzp-1.924", 0x080000, 0xdb40acba, BRF_ESS | BRF_PRG }, // 1 - - { "mzs.u21", 0x020000, 0xc5b4f7ed, BRF_ESS | BRF_PRG }, // 2 Z80 Code - - { "bp943a-2.u56", 0x200000, 0x97e13959, BRF_GRA }, // 3 Sprite data - { "bp943a-3.u55", 0x080000, 0x9c4957dd, BRF_GRA }, // 4 - - { "bp943a-1.u60", 0x200000, 0x46327415, BRF_GRA }, // 5 Layer 0 Tile data - { "bp943a-0.u63", 0x200000, 0xc1fed98a, BRF_GRA }, // 6 Layer 1 Tile data - - { "bp943a-4.u64", 0x080000, 0x3fc7f29a, BRF_SND }, // 7 MSM6295 #1 ADPCM data - - { "mazinger_japan.nv", 0x0080, 0xf84a2a45, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(mazingerj) -STD_ROM_FN(mazingerj) - -struct BurnDriver BurnDrvmazinger = { - "mazinger", NULL, NULL, NULL, "1994", - "Mazinger Z (World, ver. 94/06/27)\0", NULL, "Banpresto / Dynamic Pl. Toei Animation", "Cave", - L"Mazinger Z\0\u30DE\u30B8\u30F3\u30AC\u30FC \uFF3A (World, ver. 94/06/27)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL |BDF_ORIENTATION_FLIPPED | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, - NULL, mazingerRomInfo, mazingerRomName, NULL, NULL, mazingerInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvmazingerj = { - "mazingerj", "mazinger", NULL, NULL, "1994", - "Mazinger Z (Japan, ver. 94/06/27)\0", NULL, "Banpresto / Dynamic Pl. Toei Animation", "Cave", - L"Mazinger Z\0\u30DE\u30B8\u30F3\u30AC\u30FC \uFF3A (Japan, ver. 94/06/27)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL |BDF_ORIENTATION_FLIPPED | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, - NULL, mazingerjRomInfo, mazingerjRomName, NULL, NULL, mazingerInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 240, 384, 3, 4 -}; +// mazinger +#include "cave.h" +#include "msm6295.h" +#include "burn_ym2203.h" +#include "bitswap.h" + +#define CAVE_VBLANK_LINES 12 + +static UINT8 DrvJoy1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT16 DrvInput[2] = {0x0000, 0x0000}; + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01, *RomZ80; +static UINT8 *Ram01, *RamZ80; +static UINT8 *MSM6295ROMSrc; +static UINT8 *DefEEPROM = NULL; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static INT8 nVideoIRQ; +static INT8 nSoundIRQ; +static INT8 nUnknownIRQ; + +static INT8 nIRQPending; + +static INT32 nCyclesTotal[2]; +static INT32 nCyclesDone[2]; + +static INT32 SoundLatch; +static INT32 SoundLatchReply[48]; +static INT32 SoundLatchStatus; + +static INT32 SoundLatchReplyIndex; +static INT32 SoundLatchReplyMax; + +static UINT8 DrvZ80Bank; +static UINT8 DrvOkiBank1; +static UINT8 DrvOkiBank2; + +static struct BurnInputInfo mazingerInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 9, "diag"}, + {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service"}, +}; + +STDINPUTINFO(mazinger) + +static void UpdateIRQStatus() +{ + nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0); + SekSetIRQLine(1, nIRQPending ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE); +} + +UINT8 __fastcall mazingerReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x800002: + return (DrvInput[1] ^ 0xF7) | (EEPROMRead() << 3); + case 0x800003: + return (DrvInput[1] & 0xFF) ^ 0xFF; + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); + } + } + return 0; +} + +void __fastcall mazingerWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + + case 0x900000: + EEPROMWrite(byteValue & 0x04, byteValue & 0x02, byteValue & 0x08); + break; + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); + + } + } +} + +UINT16 __fastcall mazingerReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x300000: + case 0x300002: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + return nRet; + } + case 0x300004: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nVideoIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + case 0x300006: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nUnknownIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + + case 0x30006E: + if (SoundLatchReplyIndex > SoundLatchReplyMax) { + SoundLatchReplyIndex = 0; + SoundLatchReplyMax = -1; + return 0; + } + return SoundLatchReply[SoundLatchReplyIndex++]; + + case 0x800000: + return DrvInput[0] ^ 0xFFFF; + case 0x800002: + return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11); + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); + } + } + return 0; +} + +void __fastcall mazingerWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + if (sekAddress >= 0x30000a && sekAddress <= 0x300066) return; + if (sekAddress >= 0x30006a && sekAddress <= 0x30006c) return; + if (sekAddress >= 0x300004 && sekAddress <= 0x300006) return; + + switch (sekAddress) { + case 0x300000: + nCaveXOffset = wordValue; + return; + case 0x300002: + nCaveYOffset = wordValue; + return; + + case 0x300008: +// CaveSpriteBuffer(); + nCaveSpriteBank = wordValue; + return; + + case 0x30006e: + SoundLatch = wordValue; + SoundLatchStatus |= 0x0C; + + ZetNmi(); + nCyclesDone[1] += ZetRun(0x0400); + return; + + case 0x600000: + CaveTileReg[1][0] = wordValue; + break; + case 0x600002: + CaveTileReg[1][1] = wordValue; + break; + case 0x600004: + CaveTileReg[1][2] = wordValue; + break; + + case 0x700000: + CaveTileReg[0][0] = wordValue; + break; + case 0x700002: + CaveTileReg[0][1] = wordValue; + break; + case 0x700004: + CaveTileReg[0][2] = wordValue; + break; + + case 0x900000: + wordValue >>= 8; + EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); + break; + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); + + } + } +} + +void __fastcall mazingerWriteBytePalette(UINT32 sekAddress, UINT8 byteValue) +{ + CavePalWriteByte(sekAddress & 0xffff, byteValue); +} + +void __fastcall mazingerWriteWordPalette(UINT32 sekAddress, UINT16 wordValue) +{ + CavePalWriteWord(sekAddress & 0xffff, wordValue); +} + +UINT8 __fastcall mazingerZIn(UINT16 nAddress) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x30: { + SoundLatchStatus |= 0x04; + return SoundLatch & 0xFF; + } + + case 0x52: { + return BurnYM2203Read(0, 0); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Read %x\n"), nAddress); + } + } + + return 0; +} + +void __fastcall mazingerZOut(UINT16 nAddress, UINT8 nValue) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x00: { + DrvZ80Bank = nValue & 0x07; + + ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); + return; + } + + case 0x10: + if (SoundLatchReplyIndex > SoundLatchReplyMax) { + SoundLatchReplyMax = -1; + SoundLatchReplyIndex = 0; + } + SoundLatchReplyMax++; + SoundLatchReply[SoundLatchReplyMax] = nValue; + break; + + case 0x50: { + BurnYM2203Write(0, 0, nValue); + return; + } + + case 0x51: { + BurnYM2203Write(0, 1, nValue); + return; + } + + case 0x70: { + MSM6295Command(0, nValue); + return; + } + + case 0x74: { + DrvOkiBank1 = (nValue >> 0) & 0x03; + DrvOkiBank2 = (nValue >> 4) & 0x03; + + memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000); + memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write %x, %x\n"), nAddress, nValue); + } + } +} + +UINT8 __fastcall mazingerZRead(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall mazingerZWrite(UINT16 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 DrvExit() +{ + EEPROMExit(); + + MSM6295Exit(0); + + CaveTileExit(); + CaveSpriteExit(); + CavePalExit(); + + SekExit(); // Deallocate 68000s + ZetExit(); + + BurnYM2203Exit(); + + SoundLatch = 0; + DrvZ80Bank = 0; + DrvOkiBank1 = 0; + DrvOkiBank2 = 0; + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekRun(10000); // Need to run for a bit and reset to make it start - Watchdog would force reset? + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + MSM6295Reset(0); + + EEPROMReset(); + + nVideoIRQ = 1; + nSoundIRQ = 1; + nUnknownIRQ = 1; + + nIRQPending = 0; + + SoundLatch = 0; + DrvZ80Bank = 0; + DrvOkiBank1 = 0; + DrvOkiBank2 = 0; + + SoundLatch = 0; + SoundLatchStatus = 0x0C; + + memset(SoundLatchReply, 0, sizeof(SoundLatchReply)); + SoundLatchReplyIndex = 0; + SoundLatchReplyMax = -1; + + return 0; +} + +static INT32 DrvDraw() +{ + if (CaveRecalcPalette) { + CavePalUpdate8Bit(0x4400, 12); + CaveRecalcPalette = 1; + } + CavePalUpdate4Bit(0, 64); + + CaveClearScreen(CavePalette[0x3F00]); + + if (bDrawScreen) { +// CaveGetBitmap(); + + CaveTileRender(1); // Render tiles + } + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nCyclesVBlank; + + INT32 nInterleave = 80; + + INT32 nCyclesSegment; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x0000; // Player 1 + DrvInput[1] = 0x0000; // Player 2 + for (INT32 i = 0; i < 10; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + } + CaveClearOpposites(&DrvInput[0]); + CaveClearOpposites(&DrvInput[1]); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); + nCyclesTotal[1] = (INT32)(4000000 / CAVE_REFRESHRATE); + nCyclesDone[0] = nCyclesDone[1] = 0; + + nCyclesVBlank = nCyclesTotal[0] - (INT32)((nCyclesTotal[0] * CAVE_VBLANK_LINES) / 271.5); + bVBlank = false; + + for (INT32 i = 1; i <= nInterleave; i++) { + INT32 nCurrentCPU = 0; + INT32 nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; + + // Run 68000 + + // See if we need to trigger the VBlank interrupt + if (!bVBlank && nNext > nCyclesVBlank) { + if (nCyclesDone[nCurrentCPU] < nCyclesVBlank) { + nCyclesSegment = nCyclesVBlank - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + } + + if (pBurnDraw != NULL) { + DrvDraw(); // Draw screen if needed + } + + CaveSpriteBuffer(); + UINT8 Temp = nCaveSpriteBank; + nCaveSpriteBank = nCaveSpriteBankDelay; + nCaveSpriteBankDelay = Temp; + + bVBlank = true; + nVideoIRQ = 0; + nUnknownIRQ = 0; + UpdateIRQStatus(); + } + + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + } + + SekClose(); + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + + return 0; +} + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8* Next; Next = Mem; + Rom01 = Next; Next += 0x100000; // 68K program + RomZ80 = Next; Next += 0x020000; + CaveSpriteROM = Next; Next += 0x800000; + CaveTileROM[0] = Next; Next += 0x400000; // Tile layer 0 + CaveTileROM[1] = Next; Next += 0x400000; // Tile layer 1 + MSM6295ROM = Next; Next += 0x040000; + MSM6295ROMSrc = Next; Next += 0x080000; + DefEEPROM = Next; Next += 0x000080; + RamStart = Next; + Ram01 = Next; Next += 0x010000; // CPU #0 work RAM + RamZ80 = Next; Next += 0x001000; + CaveTileRAM[0] = Next; Next += 0x008000; + CaveTileRAM[1] = Next; Next += 0x008000; + CaveSpriteRAM = Next; Next += 0x010000; + CavePalSrc = Next; Next += 0x010000; // palette + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static void NibbleSwap1(UINT8* pData, INT32 nLen) +{ + UINT8* pOrg = pData + nLen - 1; + UINT8* pDest = pData + ((nLen - 1) << 1); + + for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { + pDest[0] = *pOrg & 15; + pDest[1] = *pOrg >> 4; + } + + return; +} + +static void NibbleSwap2(UINT8* pData, INT32 nLen) +{ + UINT8* pOrg = pData + nLen - 1; + UINT8* pDest = pData + ((nLen - 1) << 1); + + for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { + pDest[1] = *pOrg & 15; + pDest[0] = *pOrg >> 4; + } + + return; +} + +static INT32 LoadRoms() +{ + BurnLoadRom(Rom01 + 0x00000, 0, 1); + BurnLoadRom(Rom01 + 0x80000, 1, 1); + + BurnLoadRom(RomZ80, 2, 1); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x400000); + BurnLoadRom(pTemp + 0x000000, 3, 1); + BurnLoadRom(pTemp + 0x200000, 4, 1); + for (INT32 i = 0; i < 0x400000; i++) { + CaveSpriteROM[i ^ 0xdf88] = pTemp[BITSWAP24(i,23,22,21,20,19,9,7,3,15,4,17,14,18,2,16,5,11,8,6,13,1,10,12,0)]; + } + BurnFree(pTemp); + NibbleSwap1(CaveSpriteROM, 0x400000); + + BurnLoadRom(CaveTileROM[0], 5, 1); + NibbleSwap2(CaveTileROM[0], 0x200000); + + pTemp = (UINT8*)BurnMalloc(0x200000); + BurnLoadRom(pTemp, 6, 1); + for (INT32 i = 0; i < 0x0100000; i++) { + CaveTileROM[1][(i << 1) + 1] = (pTemp[(i << 1) + 0] & 15) | ((pTemp[(i << 1) + 1] & 15) << 4); + CaveTileROM[1][(i << 1) + 0] = (pTemp[(i << 1) + 0] >> 4) | (pTemp[(i << 1) + 1] & 240); + } + BurnFree(pTemp); + + // Load MSM6295 ADPCM data + BurnLoadRom(MSM6295ROMSrc, 7, 1); + + BurnLoadRom(DefEEPROM, 8, 1); + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x020902; + } + + EEPROMScan(nAction, pnMin); // Scan EEPROM + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + + SCAN_VAR(nVideoIRQ); + SCAN_VAR(nSoundIRQ); + SCAN_VAR(nUnknownIRQ); + SCAN_VAR(bVBlank); + + CaveScanGraphics(); + + SCAN_VAR(DrvInput); + SCAN_VAR(SoundLatch); + SCAN_VAR(DrvZ80Bank); + SCAN_VAR(DrvOkiBank1); + SCAN_VAR(DrvOkiBank2); + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetClose(); + + memcpy(MSM6295ROM + 0x00000, MSM6295ROMSrc + 0x20000 * DrvOkiBank1, 0x20000); + memcpy(MSM6295ROM + 0x20000, MSM6295ROMSrc + 0x20000 * DrvOkiBank2, 0x20000); + + CaveRecalcPalette = 1; + } + } + + return 0; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000; +} + +static INT32 drvZInit() +{ + ZetInit(0); + ZetOpen(0); + ZetSetInHandler(mazingerZIn); + ZetSetOutHandler(mazingerZOut); + ZetSetReadHandler(mazingerZRead); + ZetSetWriteHandler(mazingerZWrite); + + // ROM bank 1 + ZetMapArea (0x0000, 0x3FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM + ZetMapArea (0x0000, 0x3FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM + // ROM bank 2 + ZetMapArea (0x4000, 0x7FFF, 0, RomZ80 + 0x4000); // Direct Read from ROM + ZetMapArea (0x4000, 0x7FFF, 2, RomZ80 + 0x4000); // + // RAM + ZetMapArea (0xc000, 0xc7FF, 0, RamZ80 + 0x0000); // Direct Read from RAM + ZetMapArea (0xc000, 0xc7FF, 1, RamZ80 + 0x0000); // Direct Write to RAM + ZetMapArea (0xc000, 0xc7FF, 2, RamZ80 + 0x0000); // + + ZetMapArea (0xf800, 0xffFF, 0, RamZ80 + 0x0800); // Direct Read from RAM + ZetMapArea (0xf800, 0xffFF, 1, RamZ80 + 0x0800); // Direct Write to RAM + ZetMapArea (0xf800, 0xffFF, 2, RamZ80 + 0x0800); // + ZetClose(); + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + BurnSetRefreshRate(CAVE_REFRESHRATE); + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x100000, 0x10FFFF, SM_RAM); + SekMapMemory(CaveSpriteRAM, 0x200000, 0x20FFFF, SM_RAM); + SekMapMemory(CaveTileRAM[1] + 0x4000, 0x400000, 0x403FFF, SM_RAM); + SekMapMemory(CaveTileRAM[1] + 0x4000, 0x404000, 0x407FFF, SM_RAM); + SekMapMemory(CaveTileRAM[0] + 0x4000, 0x500000, 0x503FFF, SM_RAM); + SekMapMemory(CaveTileRAM[0] + 0x4000, 0x504000, 0x507FFF, SM_RAM); + SekMapMemory(CavePalSrc, 0xC08000, 0xc087FF, SM_RAM); // Palette RAM + SekMapMemory(CavePalSrc + 0x8800, 0xC08800, 0xC0FFFF, SM_ROM); // Palette RAM (write goes through handler) + SekMapHandler(1, 0xC08800, 0xC0FFFF, SM_WRITE); // + + SekMapMemory(Rom01 + 0x80000, 0xD00000, 0xD7FFFF, SM_ROM); // CPU 0 ROM + + SekSetReadByteHandler(0, mazingerReadByte); + SekSetWriteByteHandler(0, mazingerWriteByte); + SekSetReadWordHandler(0, mazingerReadWord); + SekSetWriteWordHandler(0, mazingerWriteWord); + + SekSetWriteWordHandler(1, mazingerWriteWordPalette); + SekSetWriteByteHandler(1, mazingerWriteBytePalette); + SekClose(); + } + + drvZInit(); + + CavePalInit(0x8000); + CaveTileInit(); + CaveSpriteInit(2, 0x0800000); + CaveTileInitLayer(0, 0x400000, 8, 0x0000); + CaveTileInitLayer(1, 0x400000, 6, 0x4400); + + BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); + + memcpy(MSM6295ROM, MSM6295ROMSrc, 0x40000); + MSM6295Init(0, 1056000 / 132, 1); + MSM6295SetRoute(0, 2.00, BURN_SND_ROUTE_BOTH); + + EEPROMInit(&eeprom_interface_93C46); + if (!EEPROMAvailable()) EEPROMFill(DefEEPROM,0, 0x80); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + + return 0; +} + +// Rom information +static struct BurnRomInfo mazingerRomDesc[] = { + { "mzp-0.u24", 0x080000, 0x43a4279f, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "mzp-1.924", 0x080000, 0xdb40acba, BRF_ESS | BRF_PRG }, // 1 + + { "mzs.u21", 0x020000, 0xc5b4f7ed, BRF_ESS | BRF_PRG }, // 2 Z80 Code + + { "bp943a-2.u56", 0x200000, 0x97e13959, BRF_GRA }, // 3 Sprite data + { "bp943a-3.u55", 0x080000, 0x9c4957dd, BRF_GRA }, // 4 + + { "bp943a-1.u60", 0x200000, 0x46327415, BRF_GRA }, // 5 Layer 0 Tile data + { "bp943a-0.u63", 0x200000, 0xc1fed98a, BRF_GRA }, // 6 Layer 1 Tile data + + { "bp943a-4.u64", 0x080000, 0x3fc7f29a, BRF_SND }, // 7 MSM6295 #1 ADPCM data + + { "mazinger_world.nv", 0x0080, 0x4f6225c6, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(mazinger) +STD_ROM_FN(mazinger) + +static struct BurnRomInfo mazingerjRomDesc[] = { + { "mzp-0.u24", 0x080000, 0x43a4279f, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "mzp-1.924", 0x080000, 0xdb40acba, BRF_ESS | BRF_PRG }, // 1 + + { "mzs.u21", 0x020000, 0xc5b4f7ed, BRF_ESS | BRF_PRG }, // 2 Z80 Code + + { "bp943a-2.u56", 0x200000, 0x97e13959, BRF_GRA }, // 3 Sprite data + { "bp943a-3.u55", 0x080000, 0x9c4957dd, BRF_GRA }, // 4 + + { "bp943a-1.u60", 0x200000, 0x46327415, BRF_GRA }, // 5 Layer 0 Tile data + { "bp943a-0.u63", 0x200000, 0xc1fed98a, BRF_GRA }, // 6 Layer 1 Tile data + + { "bp943a-4.u64", 0x080000, 0x3fc7f29a, BRF_SND }, // 7 MSM6295 #1 ADPCM data + + { "mazinger_japan.nv", 0x0080, 0xf84a2a45, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(mazingerj) +STD_ROM_FN(mazingerj) + +struct BurnDriver BurnDrvmazinger = { + "mazinger", NULL, NULL, NULL, "1994", + "Mazinger Z (World, ver. 94/06/27)\0", NULL, "Banpresto / Dynamic Pl. Toei Animation", "Cave", + L"Mazinger Z\0\u30DE\u30B8\u30F3\u30AC\u30FC \uFF3A (World, ver. 94/06/27)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL |BDF_ORIENTATION_FLIPPED | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, + NULL, mazingerRomInfo, mazingerRomName, NULL, NULL, mazingerInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvmazingerj = { + "mazingerj", "mazinger", NULL, NULL, "1994", + "Mazinger Z (Japan, ver. 94/06/27)\0", NULL, "Banpresto / Dynamic Pl. Toei Animation", "Cave", + L"Mazinger Z\0\u30DE\u30B8\u30F3\u30AC\u30FC \uFF3A (Japan, ver. 94/06/27)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL |BDF_ORIENTATION_FLIPPED | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, + NULL, mazingerjRomInfo, mazingerjRomName, NULL, NULL, mazingerInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 240, 384, 3, 4 +}; diff --git a/src/burn/drv/cave/d_metmqstr.cpp b/src/burn/drv/cave/d_metmqstr.cpp index 7a8e96e0b..10b2bd46f 100644 --- a/src/burn/drv/cave/d_metmqstr.cpp +++ b/src/burn/drv/cave/d_metmqstr.cpp @@ -1,844 +1,843 @@ -// metmqstr -#include "cave.h" -#include "burn_ym2151.h" -#include "msm6295.h" - -#define CAVE_VBLANK_LINES 12 - -static UINT8 DrvJoy1[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT16 DrvInput[2] = {0x0000, 0x0000}; - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01, *RomZ80; -static UINT8 *Ram01, *RamZ80; -static UINT8 *MSM6295ROMSrc1, *MSM6295ROMSrc2; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static INT8 nVideoIRQ; -static INT8 nSoundIRQ; -static INT8 nUnknownIRQ; - -static INT8 nIRQPending; - -static INT32 nCyclesTotal[2]; -static INT32 nCyclesDone[2]; - -static INT32 SoundLatch; -static INT32 SoundLatchReply[48]; -static INT32 SoundLatchStatus; - -static INT32 SoundLatchReplyIndex; -static INT32 SoundLatchReplyMax; - -static UINT8 DrvZ80Bank; -static UINT8 DrvOkiBank1_1; -static UINT8 DrvOkiBank1_2; -static UINT8 DrvOkiBank2_1; -static UINT8 DrvOkiBank2_2; - -static struct BurnInputInfo metmqstrInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 10, "p1 fire 4"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 10, "p2 fire 4"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 9, "diag"}, - {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service"}, -}; - -STDINPUTINFO(metmqstr) - -static void UpdateIRQStatus() -{ - nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0); - SekSetIRQLine(1, nIRQPending ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE); -} - -UINT8 __fastcall metmqstrReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - default: { - bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); - } - } - return 0; -} - -void __fastcall metmqstrWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - if (~byteValue & 0x0100) { - case 0xd00000: - EEPROMWrite(byteValue & 0x04, byteValue & 0x02, byteValue & 0x08); - break; - } - default: { - bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); - - } - } -} - -UINT16 __fastcall metmqstrReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xa80000: - case 0xa80002: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - return nRet; - } - case 0xa80004: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nVideoIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - case 0xa80006: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nUnknownIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - - case 0xa8006C: - if (SoundLatchReplyIndex > SoundLatchReplyMax) { - return 2; - } - return 0; - - case 0xa8006E: - if (SoundLatchReplyIndex > SoundLatchReplyMax) { - SoundLatchReplyIndex = 0; - SoundLatchReplyMax = -1; - return 0; - } - return SoundLatchReply[SoundLatchReplyIndex++]; - - case 0xc80000: - return DrvInput[0] ^ 0xFFFF; - case 0xc80002: - return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11); - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); - } - } - return 0; -} - -void __fastcall metmqstrWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - if (sekAddress >= 0xa8000a && sekAddress <= 0xa80068) return; - if (sekAddress >= 0xa8006a && sekAddress <= 0xa8006c) return; - if (sekAddress >= 0xa80004 && sekAddress <= 0xa80006) return; - - switch (sekAddress) { - case 0xa80000: - nCaveXOffset = wordValue; - return; - case 0xa80002: - nCaveYOffset = wordValue; - return; - - case 0xa80008: - CaveSpriteBuffer(); - nCaveSpriteBank = wordValue; - return; - - case 0xa8006E: - SoundLatch = wordValue; - SoundLatchStatus |= 0x0C; - - ZetNmi(); - nCyclesDone[1] += ZetRun(0x0400); - return; - - case 0xb00000: - CaveTileReg[2][0] = wordValue; - break; - case 0xb00002: - CaveTileReg[2][1] = wordValue; - break; - case 0xb00004: - CaveTileReg[2][2] = wordValue; - break; - - case 0xb80000: - CaveTileReg[1][0] = wordValue; - break; - case 0xb80002: - CaveTileReg[1][1] = wordValue; - break; - case 0xb80004: - CaveTileReg[1][2] = wordValue; - break; - - case 0xc00000: - CaveTileReg[0][0] = wordValue; - break; - case 0xc00002: - CaveTileReg[0][1] = wordValue; - break; - case 0xc00004: - CaveTileReg[0][2] = wordValue; - break; - - case 0xd00000: - if (~wordValue & 0x0100) { - wordValue >>= 8; - EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); - break; - } - default: { - bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); - - } - } -} - -UINT8 __fastcall metmqstrZIn(UINT16 nAddress) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x20: { - return 0; - } - - case 0x30: - SoundLatchStatus |= 0x04; - return SoundLatch & 0xFF; - - case 0x40: - SoundLatchStatus |= 0x08; - return SoundLatch >> 8; - - case 0x51: - return BurnYM2151ReadStatus(); - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Read %x\n"), nAddress); - } - } - - return 0; -} - -void __fastcall metmqstrZOut(UINT16 nAddress, UINT8 nValue) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x00: { - DrvZ80Bank = nValue & 0x0f; - - ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); - return; - } - - case 0x50: - BurnYM2151SelectRegister(nValue); - break; - case 0x51: - BurnYM2151WriteRegister(nValue); - break; - - case 0x60: { - MSM6295Command(0, nValue); - return; - } - - case 0x70: { - DrvOkiBank1_1 = (nValue >> 0) & 0x07; - DrvOkiBank1_2 = (nValue >> 4) & 0x07; - - memcpy(MSM6295ROM + 0x000000, MSM6295ROMSrc1 + 0x20000 * DrvOkiBank1_1, 0x20000); - memcpy(MSM6295ROM + 0x020000, MSM6295ROMSrc1 + 0x20000 * DrvOkiBank1_2, 0x20000); - return; - } - - case 0x80: { - MSM6295Command(1, nValue); - return; - } - - case 0x90: { - DrvOkiBank2_1 = (nValue >> 0) & 0x07; - DrvOkiBank2_2 = (nValue >> 4) & 0x07; - - memcpy(MSM6295ROM + 0x100000, MSM6295ROMSrc2 + 0x20000 * DrvOkiBank2_1, 0x20000); - memcpy(MSM6295ROM + 0x120000, MSM6295ROMSrc2 + 0x20000 * DrvOkiBank2_2, 0x20000); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write %x, %x\n"), nAddress, nValue); - } - } -} - -UINT8 __fastcall metmqstrZRead(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall metmqstrZWrite(UINT16 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 DrvExit() -{ - EEPROMExit(); - - BurnYM2151Exit(); - MSM6295Exit(0); - MSM6295Exit(1); - - CaveTileExit(); - CaveSpriteExit(); - CavePalExit(); - - SekExit(); // Deallocate 68000s - ZetExit(); - - SoundLatch = 0; - DrvZ80Bank = 0; - DrvOkiBank1_1 = 0; - DrvOkiBank1_2 = 0; - DrvOkiBank2_1 = 0; - DrvOkiBank2_2 = 0; - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekRun(10000); // Need to run for a bit and reset to make it start - Watchdog would force reset? - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - MSM6295Reset(0); - MSM6295Reset(1); - - EEPROMReset(); - - nVideoIRQ = 1; - nSoundIRQ = 1; - nUnknownIRQ = 1; - - nIRQPending = 0; - - SoundLatch = 0; - DrvZ80Bank = 0; - DrvOkiBank1_1 = 0; - DrvOkiBank1_2 = 0; - DrvOkiBank2_1 = 0; - DrvOkiBank2_2 = 0; - - SoundLatch = 0; - SoundLatchStatus = 0x0C; - - memset(SoundLatchReply, 0, sizeof(SoundLatchReply)); - SoundLatchReplyIndex = 0; - SoundLatchReplyMax = -1; - - return 0; -} - -static INT32 DrvDraw() -{ - CavePalUpdate4Bit(0, 128); - - CaveClearScreen(CavePalette[0x7F00]); - - if (bDrawScreen) { -// CaveGetBitmap(); - - CaveTileRender(1); // Render tiles - } - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nCyclesVBlank; - INT32 nInterleave = 8; - INT32 nSoundBufferPos = 0; - - INT32 nCyclesSegment; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x0000; // Player 1 - DrvInput[1] = 0x0000; // Player 2 - for (INT32 i = 0; i < 11; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - } - CaveClearOpposites(&DrvInput[0]); - CaveClearOpposites(&DrvInput[1]); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); - nCyclesTotal[1] = (INT32)(8000000 / CAVE_REFRESHRATE); - nCyclesDone[0] = nCyclesDone[1] = 0; - - nCyclesVBlank = nCyclesTotal[0] - (INT32)((nCyclesTotal[0] * CAVE_VBLANK_LINES) / 271.5); - bVBlank = false; - - for (INT32 i = 1; i <= nInterleave; i++) { - INT32 nCurrentCPU = 0; - INT32 nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; - - // Run 68000 - - // See if we need to trigger the VBlank interrupt - if (!bVBlank && nNext > nCyclesVBlank) { - if (nCyclesDone[nCurrentCPU] < nCyclesVBlank) { - nCyclesSegment = nCyclesVBlank - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - } - - if (pBurnDraw != NULL) { - DrvDraw(); // Draw screen if needed - } - - UINT8 Temp = nCaveSpriteBank; - nCaveSpriteBank = nCaveSpriteBankDelay; - nCaveSpriteBankDelay = Temp; - - bVBlank = true; - nVideoIRQ = 0; - nUnknownIRQ = 0; - UpdateIRQStatus(); - } - - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - } - } - - SekClose(); - ZetClose(); - - return 0; -} - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8* Next; Next = Mem; - Rom01 = Next; Next += 0x180000; // 68K program - RomZ80 = Next; Next += 0x040000; - CaveSpriteROM = Next; Next += 0x1000000; - CaveTileROM[0] = Next; Next += 0x400000; // Tile layer 0 - CaveTileROM[1] = Next; Next += 0x400000; // Tile layer 1 - CaveTileROM[2] = Next; Next += 0x400000; // Tile layer 2 - MSM6295ROM = Next; Next += 0x140000; - MSM6295ROMSrc1 = Next; Next += 0x200000; - MSM6295ROMSrc2 = Next; Next += 0x200000; - RamStart = Next; - Ram01 = Next; Next += 0x018000; // CPU #0 work RAM - RamZ80 = Next; Next += 0x002000; - CaveTileRAM[0] = Next; Next += 0x008000; - CaveTileRAM[1] = Next; Next += 0x008000; - CaveTileRAM[2] = Next; Next += 0x008000; - CaveSpriteRAM = Next; Next += 0x010000; - CavePalSrc = Next; Next += 0x010000; // palette - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static void NibbleSwap1(UINT8* pData, INT32 nLen) -{ - UINT8* pOrg = pData + nLen - 1; - UINT8* pDest = pData + ((nLen - 1) << 1); - - for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { - pDest[0] = *pOrg & 15; - pDest[1] = *pOrg >> 4; - } - - return; -} - -static void NibbleSwap2(UINT8* pData, INT32 nLen) -{ - UINT8* pOrg = pData + nLen - 1; - UINT8* pDest = pData + ((nLen - 1) << 1); - - for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { - pDest[1] = *pOrg & 15; - pDest[0] = *pOrg >> 4; - } - - return; -} - -static INT32 LoadRoms() -{ - BurnLoadRom(Rom01 + 0x000000, 0, 1); - BurnLoadRom(Rom01 + 0x080000, 1, 1); - BurnLoadRom(Rom01 + 0x100000, 2, 1); - - BurnLoadRom(RomZ80, 3, 1); - - BurnLoadRom(CaveSpriteROM + 0x000000, 4, 1); - BurnLoadRom(CaveSpriteROM + 0x200000, 5, 1); - BurnLoadRom(CaveSpriteROM + 0x400000, 6, 1); - BurnLoadRom(CaveSpriteROM + 0x600000, 7, 1); - NibbleSwap1(CaveSpriteROM, 0x800000); - - BurnLoadRom(CaveTileROM[0], 8, 1); - NibbleSwap2(CaveTileROM[0], 0x200000); - - BurnLoadRom(CaveTileROM[1], 9, 1); - NibbleSwap2(CaveTileROM[1], 0x200000); - - BurnLoadRom(CaveTileROM[2], 10, 1); - NibbleSwap2(CaveTileROM[2], 0x200000); - - // Load MSM6295 ADPCM data - BurnLoadRom(MSM6295ROMSrc1, 11, 1); - BurnLoadRom(MSM6295ROMSrc2, 12, 1); - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x020902; - } - - EEPROMScan(nAction, pnMin); // Scan EEPROM - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - MSM6295Scan(1, nAction); - - SCAN_VAR(nVideoIRQ); - SCAN_VAR(nSoundIRQ); - SCAN_VAR(nUnknownIRQ); - SCAN_VAR(bVBlank); - - CaveScanGraphics(); - - SCAN_VAR(DrvInput); - SCAN_VAR(SoundLatch); - SCAN_VAR(DrvZ80Bank); - SCAN_VAR(DrvOkiBank1_1); - SCAN_VAR(DrvOkiBank1_2); - SCAN_VAR(DrvOkiBank2_1); - SCAN_VAR(DrvOkiBank2_2); - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetClose(); - - memcpy(MSM6295ROM + 0x000000, MSM6295ROMSrc1 + 0x20000 * DrvOkiBank1_1, 0x20000); - memcpy(MSM6295ROM + 0x020000, MSM6295ROMSrc1 + 0x20000 * DrvOkiBank1_2, 0x20000); - - memcpy(MSM6295ROM + 0x100000, MSM6295ROMSrc2 + 0x20000 * DrvOkiBank2_1, 0x20000); - memcpy(MSM6295ROM + 0x120000, MSM6295ROMSrc2 + 0x20000 * DrvOkiBank2_2, 0x20000); - - CaveRecalcPalette = 1; - } - } - - return 0; -} - -static INT32 drvZInit() -{ - ZetInit(0); - ZetOpen(0); - ZetSetInHandler(metmqstrZIn); - ZetSetOutHandler(metmqstrZOut); - ZetSetReadHandler(metmqstrZRead); - ZetSetWriteHandler(metmqstrZWrite); - - // ROM bank 1 - ZetMapArea (0x0000, 0x3FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM - ZetMapArea (0x0000, 0x3FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM - // ROM bank 2 - ZetMapArea (0x4000, 0x7FFF, 0, RomZ80 + 0x4000); // Direct Read from ROM - ZetMapArea (0x4000, 0x7FFF, 2, RomZ80 + 0x4000); // - // RAM - ZetMapArea (0xe000, 0xFFFF, 0, RamZ80 + 0x0000); // Direct Read from RAM - ZetMapArea (0xe000, 0xFFFF, 1, RamZ80 + 0x0000); // Direct Write to RAM - ZetMapArea (0xe000, 0xFFFF, 2, RamZ80 + 0x0000); // - ZetMemEnd(); - ZetClose(); - - return 0; -} - -static void DrvYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvInit() -{ - INT32 nLen; - - BurnSetRefreshRate(CAVE_REFRESHRATE); - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - EEPROMInit(&eeprom_interface_93C46); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Rom01 + 0x080000, 0x100000, 0x17FFFF, SM_ROM); - SekMapMemory(Rom01 + 0x100000, 0x200000, 0x27FFFF, SM_ROM); - SekMapMemory(CaveTileRAM[2], 0x880000, 0x887FFF, SM_RAM); - SekMapMemory(Ram01 + 0x00000, 0x888000, 0x88FFFF, SM_RAM); - SekMapMemory(CaveTileRAM[1], 0x900000, 0x907FFF, SM_RAM); - SekMapMemory(Ram01 + 0x08000, 0x908000, 0x90FFFF, SM_RAM); - SekMapMemory(CaveTileRAM[0], 0x980000, 0x987FFF, SM_RAM); - SekMapMemory(Ram01 + 0x10000, 0x988000, 0x98FFFF, SM_RAM); - SekMapMemory(CavePalSrc, 0x408000, 0x408FFF, SM_RAM); // Palette RAM - SekMapMemory(CaveSpriteRAM, 0xF00000, 0xF0FFFF, SM_RAM); - SekSetReadByteHandler(0, metmqstrReadByte); - SekSetWriteByteHandler(0, metmqstrWriteByte); - SekSetReadWordHandler(0, metmqstrReadWord); - SekSetWriteWordHandler(0, metmqstrWriteWord); - SekClose(); - } - - drvZInit(); - - CavePalInit(0x8000); - CaveTileInit(); - CaveSpriteInit(2, 0x1000000); - CaveTileInitLayer(0, 0x400000, 8, 0x4000); - CaveTileInitLayer(1, 0x400000, 8, 0x4000); - CaveTileInitLayer(2, 0x400000, 8, 0x4000); - - nCaveExtraXOffset = -126; - CaveSpriteVisibleXOffset = -126; - - BurnYM2151Init(4000000); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.20, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.20, BURN_SND_ROUTE_RIGHT); - - memcpy(MSM6295ROM, MSM6295ROMSrc1, 0x40000); - memcpy(MSM6295ROM + 0x100000, MSM6295ROMSrc2, 0x40000); - MSM6295Init(0, 2000000 / 132, 1); - MSM6295Init(1, 2000000 / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - - return 0; -} - -// Rom information -static struct BurnRomInfo metmqstrRomDesc[] = { - { "bp947a.u25", 0x080000, 0x0a5c3442, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bp947a.u28", 0x080000, 0x8c55decf, BRF_ESS | BRF_PRG }, // 1 - { "bp947a.u29", 0x080000, 0xcf0f3f3b, BRF_ESS | BRF_PRG }, // 2 - - { "bp947a.u20", 0x040000, 0xa4a36170, BRF_ESS | BRF_PRG }, // 3 Z80 Code - - { "bp947a.u49", 0x200000, 0x09749531, BRF_GRA }, // 4 Sprite data - { "bp947a.u50", 0x200000, 0x19cea8b2, BRF_GRA }, // 5 - { "bp947a.u51", 0x200000, 0xc19bed67, BRF_GRA }, // 6 - { "bp947a.u52", 0x200000, 0x70c64875, BRF_GRA }, // 7 - - { "bp947a.u48", 0x200000, 0x04ff6a3d, BRF_GRA }, // 8 Layer 0 Tile data - { "bp947a.u47", 0x200000, 0x0de42827, BRF_GRA }, // 9 Layer 2 Tile data - { "bp947a.u46", 0x200000, 0x0f9c906e, BRF_GRA }, // 10 Layer 2 Tile data - - { "bp947a.u42", 0x200000, 0x2ce8ff2a, BRF_SND }, // 11 MSM6295 #1 ADPCM data - { "bp947a.u37", 0x200000, 0xc3077c8f, BRF_SND }, // 12 MSM6295 #2 ADPCM data -}; - - -STD_ROM_PICK(metmqstr) -STD_ROM_FN(metmqstr) - -static struct BurnRomInfo nmasterRomDesc[] = { - { "bp947a_n.u25", 0x080000, 0x748cc514, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bp947a.u28", 0x080000, 0x8c55decf, BRF_ESS | BRF_PRG }, // 1 - { "bp947a.u29", 0x080000, 0xcf0f3f3b, BRF_ESS | BRF_PRG }, // 2 - - { "bp947a.u20", 0x040000, 0xa4a36170, BRF_ESS | BRF_PRG }, // 3 Z80 Code - - { "bp947a.u49", 0x200000, 0x09749531, BRF_GRA }, // 4 Sprite data - { "bp947a.u50", 0x200000, 0x19cea8b2, BRF_GRA }, // 5 - { "bp947a.u51", 0x200000, 0xc19bed67, BRF_GRA }, // 6 - { "bp947a.u52", 0x200000, 0x70c64875, BRF_GRA }, // 7 - - { "bp947a.u48", 0x200000, 0x04ff6a3d, BRF_GRA }, // 8 Layer 0 Tile data - { "bp947a.u47", 0x200000, 0x0de42827, BRF_GRA }, // 9 Layer 2 Tile data - { "bp947a.u46", 0x200000, 0x0f9c906e, BRF_GRA }, // 10 Layer 2 Tile data - - { "bp947a.u42", 0x200000, 0x2ce8ff2a, BRF_SND }, // 11 MSM6295 #1 ADPCM data - { "bp947a.u37", 0x200000, 0xc3077c8f, BRF_SND }, // 12 MSM6295 #2 ADPCM data -}; - - -STD_ROM_PICK(nmaster) -STD_ROM_FN(nmaster) - -struct BurnDriver BurnDrvmetmqstr = { - "metmqstr", NULL, NULL, NULL, "1995", - "Metamoqester (International)\0", NULL, "Banpresto / Pandorabox", "Cave", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, 0, - NULL, metmqstrRomInfo, metmqstrRomName, NULL, NULL, metmqstrInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvnmaster = { - "nmaster", "metmqstr", NULL, NULL, "1995", - "Oni - The Ninja Master (Japan)\0", NULL, "Banpresto / Pandorabox", "Cave", - L"\u7A4F\u5FCD - The Ninja Master (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_CLONE, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, 0, - NULL, nmasterRomInfo, nmasterRomName, NULL, NULL, metmqstrInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 384, 240, 4, 3 -}; +// metmqstr +#include "cave.h" +#include "burn_ym2151.h" +#include "msm6295.h" + +#define CAVE_VBLANK_LINES 12 + +static UINT8 DrvJoy1[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT16 DrvInput[2] = {0x0000, 0x0000}; + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01, *RomZ80; +static UINT8 *Ram01, *RamZ80; +static UINT8 *MSM6295ROMSrc1, *MSM6295ROMSrc2; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static INT8 nVideoIRQ; +static INT8 nSoundIRQ; +static INT8 nUnknownIRQ; + +static INT8 nIRQPending; + +static INT32 nCyclesTotal[2]; +static INT32 nCyclesDone[2]; + +static INT32 SoundLatch; +static INT32 SoundLatchReply[48]; +static INT32 SoundLatchStatus; + +static INT32 SoundLatchReplyIndex; +static INT32 SoundLatchReplyMax; + +static UINT8 DrvZ80Bank; +static UINT8 DrvOkiBank1_1; +static UINT8 DrvOkiBank1_2; +static UINT8 DrvOkiBank2_1; +static UINT8 DrvOkiBank2_2; + +static struct BurnInputInfo metmqstrInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 10, "p1 fire 4"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 10, "p2 fire 4"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 9, "diag"}, + {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service"}, +}; + +STDINPUTINFO(metmqstr) + +static void UpdateIRQStatus() +{ + nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0); + SekSetIRQLine(1, nIRQPending ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE); +} + +UINT8 __fastcall metmqstrReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + default: { + bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); + } + } + return 0; +} + +void __fastcall metmqstrWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + if (~byteValue & 0x0100) { + case 0xd00000: + EEPROMWrite(byteValue & 0x04, byteValue & 0x02, byteValue & 0x08); + break; + } + default: { + bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); + + } + } +} + +UINT16 __fastcall metmqstrReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xa80000: + case 0xa80002: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + return nRet; + } + case 0xa80004: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nVideoIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + case 0xa80006: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nUnknownIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + + case 0xa8006C: + if (SoundLatchReplyIndex > SoundLatchReplyMax) { + return 2; + } + return 0; + + case 0xa8006E: + if (SoundLatchReplyIndex > SoundLatchReplyMax) { + SoundLatchReplyIndex = 0; + SoundLatchReplyMax = -1; + return 0; + } + return SoundLatchReply[SoundLatchReplyIndex++]; + + case 0xc80000: + return DrvInput[0] ^ 0xFFFF; + case 0xc80002: + return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11); + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); + } + } + return 0; +} + +void __fastcall metmqstrWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + if (sekAddress >= 0xa8000a && sekAddress <= 0xa80068) return; + if (sekAddress >= 0xa8006a && sekAddress <= 0xa8006c) return; + if (sekAddress >= 0xa80004 && sekAddress <= 0xa80006) return; + + switch (sekAddress) { + case 0xa80000: + nCaveXOffset = wordValue; + return; + case 0xa80002: + nCaveYOffset = wordValue; + return; + + case 0xa80008: + CaveSpriteBuffer(); + nCaveSpriteBank = wordValue; + return; + + case 0xa8006E: + SoundLatch = wordValue; + SoundLatchStatus |= 0x0C; + + ZetNmi(); + nCyclesDone[1] += ZetRun(0x0400); + return; + + case 0xb00000: + CaveTileReg[2][0] = wordValue; + break; + case 0xb00002: + CaveTileReg[2][1] = wordValue; + break; + case 0xb00004: + CaveTileReg[2][2] = wordValue; + break; + + case 0xb80000: + CaveTileReg[1][0] = wordValue; + break; + case 0xb80002: + CaveTileReg[1][1] = wordValue; + break; + case 0xb80004: + CaveTileReg[1][2] = wordValue; + break; + + case 0xc00000: + CaveTileReg[0][0] = wordValue; + break; + case 0xc00002: + CaveTileReg[0][1] = wordValue; + break; + case 0xc00004: + CaveTileReg[0][2] = wordValue; + break; + + case 0xd00000: + if (~wordValue & 0x0100) { + wordValue >>= 8; + EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); + break; + } + default: { + bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); + + } + } +} + +UINT8 __fastcall metmqstrZIn(UINT16 nAddress) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x20: { + return 0; + } + + case 0x30: + SoundLatchStatus |= 0x04; + return SoundLatch & 0xFF; + + case 0x40: + SoundLatchStatus |= 0x08; + return SoundLatch >> 8; + + case 0x51: + return BurnYM2151ReadStatus(); + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Read %x\n"), nAddress); + } + } + + return 0; +} + +void __fastcall metmqstrZOut(UINT16 nAddress, UINT8 nValue) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x00: { + DrvZ80Bank = nValue & 0x0f; + + ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); + return; + } + + case 0x50: + BurnYM2151SelectRegister(nValue); + break; + case 0x51: + BurnYM2151WriteRegister(nValue); + break; + + case 0x60: { + MSM6295Command(0, nValue); + return; + } + + case 0x70: { + DrvOkiBank1_1 = (nValue >> 0) & 0x07; + DrvOkiBank1_2 = (nValue >> 4) & 0x07; + + memcpy(MSM6295ROM + 0x000000, MSM6295ROMSrc1 + 0x20000 * DrvOkiBank1_1, 0x20000); + memcpy(MSM6295ROM + 0x020000, MSM6295ROMSrc1 + 0x20000 * DrvOkiBank1_2, 0x20000); + return; + } + + case 0x80: { + MSM6295Command(1, nValue); + return; + } + + case 0x90: { + DrvOkiBank2_1 = (nValue >> 0) & 0x07; + DrvOkiBank2_2 = (nValue >> 4) & 0x07; + + memcpy(MSM6295ROM + 0x100000, MSM6295ROMSrc2 + 0x20000 * DrvOkiBank2_1, 0x20000); + memcpy(MSM6295ROM + 0x120000, MSM6295ROMSrc2 + 0x20000 * DrvOkiBank2_2, 0x20000); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write %x, %x\n"), nAddress, nValue); + } + } +} + +UINT8 __fastcall metmqstrZRead(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall metmqstrZWrite(UINT16 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 DrvExit() +{ + EEPROMExit(); + + BurnYM2151Exit(); + MSM6295Exit(0); + MSM6295Exit(1); + + CaveTileExit(); + CaveSpriteExit(); + CavePalExit(); + + SekExit(); // Deallocate 68000s + ZetExit(); + + SoundLatch = 0; + DrvZ80Bank = 0; + DrvOkiBank1_1 = 0; + DrvOkiBank1_2 = 0; + DrvOkiBank2_1 = 0; + DrvOkiBank2_2 = 0; + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekRun(10000); // Need to run for a bit and reset to make it start - Watchdog would force reset? + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + MSM6295Reset(0); + MSM6295Reset(1); + + EEPROMReset(); + + nVideoIRQ = 1; + nSoundIRQ = 1; + nUnknownIRQ = 1; + + nIRQPending = 0; + + SoundLatch = 0; + DrvZ80Bank = 0; + DrvOkiBank1_1 = 0; + DrvOkiBank1_2 = 0; + DrvOkiBank2_1 = 0; + DrvOkiBank2_2 = 0; + + SoundLatch = 0; + SoundLatchStatus = 0x0C; + + memset(SoundLatchReply, 0, sizeof(SoundLatchReply)); + SoundLatchReplyIndex = 0; + SoundLatchReplyMax = -1; + + return 0; +} + +static INT32 DrvDraw() +{ + CavePalUpdate4Bit(0, 128); + + CaveClearScreen(CavePalette[0x7F00]); + + if (bDrawScreen) { +// CaveGetBitmap(); + + CaveTileRender(1); // Render tiles + } + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nCyclesVBlank; + INT32 nInterleave = 8; + INT32 nSoundBufferPos = 0; + + INT32 nCyclesSegment; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x0000; // Player 1 + DrvInput[1] = 0x0000; // Player 2 + for (INT32 i = 0; i < 11; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + } + CaveClearOpposites(&DrvInput[0]); + CaveClearOpposites(&DrvInput[1]); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); + nCyclesTotal[1] = (INT32)(8000000 / CAVE_REFRESHRATE); + nCyclesDone[0] = nCyclesDone[1] = 0; + + nCyclesVBlank = nCyclesTotal[0] - (INT32)((nCyclesTotal[0] * CAVE_VBLANK_LINES) / 271.5); + bVBlank = false; + + for (INT32 i = 1; i <= nInterleave; i++) { + INT32 nCurrentCPU = 0; + INT32 nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; + + // Run 68000 + + // See if we need to trigger the VBlank interrupt + if (!bVBlank && nNext > nCyclesVBlank) { + if (nCyclesDone[nCurrentCPU] < nCyclesVBlank) { + nCyclesSegment = nCyclesVBlank - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + } + + if (pBurnDraw != NULL) { + DrvDraw(); // Draw screen if needed + } + + UINT8 Temp = nCaveSpriteBank; + nCaveSpriteBank = nCaveSpriteBankDelay; + nCaveSpriteBankDelay = Temp; + + bVBlank = true; + nVideoIRQ = 0; + nUnknownIRQ = 0; + UpdateIRQStatus(); + } + + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + MSM6295Render(1, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + MSM6295Render(1, pSoundBuf, nSegmentLength); + } + } + + SekClose(); + ZetClose(); + + return 0; +} + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8* Next; Next = Mem; + Rom01 = Next; Next += 0x180000; // 68K program + RomZ80 = Next; Next += 0x040000; + CaveSpriteROM = Next; Next += 0x1000000; + CaveTileROM[0] = Next; Next += 0x400000; // Tile layer 0 + CaveTileROM[1] = Next; Next += 0x400000; // Tile layer 1 + CaveTileROM[2] = Next; Next += 0x400000; // Tile layer 2 + MSM6295ROM = Next; Next += 0x140000; + MSM6295ROMSrc1 = Next; Next += 0x200000; + MSM6295ROMSrc2 = Next; Next += 0x200000; + RamStart = Next; + Ram01 = Next; Next += 0x018000; // CPU #0 work RAM + RamZ80 = Next; Next += 0x002000; + CaveTileRAM[0] = Next; Next += 0x008000; + CaveTileRAM[1] = Next; Next += 0x008000; + CaveTileRAM[2] = Next; Next += 0x008000; + CaveSpriteRAM = Next; Next += 0x010000; + CavePalSrc = Next; Next += 0x010000; // palette + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static void NibbleSwap1(UINT8* pData, INT32 nLen) +{ + UINT8* pOrg = pData + nLen - 1; + UINT8* pDest = pData + ((nLen - 1) << 1); + + for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { + pDest[0] = *pOrg & 15; + pDest[1] = *pOrg >> 4; + } + + return; +} + +static void NibbleSwap2(UINT8* pData, INT32 nLen) +{ + UINT8* pOrg = pData + nLen - 1; + UINT8* pDest = pData + ((nLen - 1) << 1); + + for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { + pDest[1] = *pOrg & 15; + pDest[0] = *pOrg >> 4; + } + + return; +} + +static INT32 LoadRoms() +{ + BurnLoadRom(Rom01 + 0x000000, 0, 1); + BurnLoadRom(Rom01 + 0x080000, 1, 1); + BurnLoadRom(Rom01 + 0x100000, 2, 1); + + BurnLoadRom(RomZ80, 3, 1); + + BurnLoadRom(CaveSpriteROM + 0x000000, 4, 1); + BurnLoadRom(CaveSpriteROM + 0x200000, 5, 1); + BurnLoadRom(CaveSpriteROM + 0x400000, 6, 1); + BurnLoadRom(CaveSpriteROM + 0x600000, 7, 1); + NibbleSwap1(CaveSpriteROM, 0x800000); + + BurnLoadRom(CaveTileROM[0], 8, 1); + NibbleSwap2(CaveTileROM[0], 0x200000); + + BurnLoadRom(CaveTileROM[1], 9, 1); + NibbleSwap2(CaveTileROM[1], 0x200000); + + BurnLoadRom(CaveTileROM[2], 10, 1); + NibbleSwap2(CaveTileROM[2], 0x200000); + + // Load MSM6295 ADPCM data + BurnLoadRom(MSM6295ROMSrc1, 11, 1); + BurnLoadRom(MSM6295ROMSrc2, 12, 1); + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x020902; + } + + EEPROMScan(nAction, pnMin); // Scan EEPROM + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + MSM6295Scan(1, nAction); + + SCAN_VAR(nVideoIRQ); + SCAN_VAR(nSoundIRQ); + SCAN_VAR(nUnknownIRQ); + SCAN_VAR(bVBlank); + + CaveScanGraphics(); + + SCAN_VAR(DrvInput); + SCAN_VAR(SoundLatch); + SCAN_VAR(DrvZ80Bank); + SCAN_VAR(DrvOkiBank1_1); + SCAN_VAR(DrvOkiBank1_2); + SCAN_VAR(DrvOkiBank2_1); + SCAN_VAR(DrvOkiBank2_2); + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x4000, 0x7FFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7FFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetClose(); + + memcpy(MSM6295ROM + 0x000000, MSM6295ROMSrc1 + 0x20000 * DrvOkiBank1_1, 0x20000); + memcpy(MSM6295ROM + 0x020000, MSM6295ROMSrc1 + 0x20000 * DrvOkiBank1_2, 0x20000); + + memcpy(MSM6295ROM + 0x100000, MSM6295ROMSrc2 + 0x20000 * DrvOkiBank2_1, 0x20000); + memcpy(MSM6295ROM + 0x120000, MSM6295ROMSrc2 + 0x20000 * DrvOkiBank2_2, 0x20000); + + CaveRecalcPalette = 1; + } + } + + return 0; +} + +static INT32 drvZInit() +{ + ZetInit(0); + ZetOpen(0); + ZetSetInHandler(metmqstrZIn); + ZetSetOutHandler(metmqstrZOut); + ZetSetReadHandler(metmqstrZRead); + ZetSetWriteHandler(metmqstrZWrite); + + // ROM bank 1 + ZetMapArea (0x0000, 0x3FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM + ZetMapArea (0x0000, 0x3FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM + // ROM bank 2 + ZetMapArea (0x4000, 0x7FFF, 0, RomZ80 + 0x4000); // Direct Read from ROM + ZetMapArea (0x4000, 0x7FFF, 2, RomZ80 + 0x4000); // + // RAM + ZetMapArea (0xe000, 0xFFFF, 0, RamZ80 + 0x0000); // Direct Read from RAM + ZetMapArea (0xe000, 0xFFFF, 1, RamZ80 + 0x0000); // Direct Write to RAM + ZetMapArea (0xe000, 0xFFFF, 2, RamZ80 + 0x0000); // + ZetClose(); + + return 0; +} + +static void DrvYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvInit() +{ + INT32 nLen; + + BurnSetRefreshRate(CAVE_REFRESHRATE); + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + EEPROMInit(&eeprom_interface_93C46); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Rom01 + 0x080000, 0x100000, 0x17FFFF, SM_ROM); + SekMapMemory(Rom01 + 0x100000, 0x200000, 0x27FFFF, SM_ROM); + SekMapMemory(CaveTileRAM[2], 0x880000, 0x887FFF, SM_RAM); + SekMapMemory(Ram01 + 0x00000, 0x888000, 0x88FFFF, SM_RAM); + SekMapMemory(CaveTileRAM[1], 0x900000, 0x907FFF, SM_RAM); + SekMapMemory(Ram01 + 0x08000, 0x908000, 0x90FFFF, SM_RAM); + SekMapMemory(CaveTileRAM[0], 0x980000, 0x987FFF, SM_RAM); + SekMapMemory(Ram01 + 0x10000, 0x988000, 0x98FFFF, SM_RAM); + SekMapMemory(CavePalSrc, 0x408000, 0x408FFF, SM_RAM); // Palette RAM + SekMapMemory(CaveSpriteRAM, 0xF00000, 0xF0FFFF, SM_RAM); + SekSetReadByteHandler(0, metmqstrReadByte); + SekSetWriteByteHandler(0, metmqstrWriteByte); + SekSetReadWordHandler(0, metmqstrReadWord); + SekSetWriteWordHandler(0, metmqstrWriteWord); + SekClose(); + } + + drvZInit(); + + CavePalInit(0x8000); + CaveTileInit(); + CaveSpriteInit(2, 0x1000000); + CaveTileInitLayer(0, 0x400000, 8, 0x4000); + CaveTileInitLayer(1, 0x400000, 8, 0x4000); + CaveTileInitLayer(2, 0x400000, 8, 0x4000); + + nCaveExtraXOffset = -126; + CaveSpriteVisibleXOffset = -126; + + BurnYM2151Init(4000000); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.20, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.20, BURN_SND_ROUTE_RIGHT); + + memcpy(MSM6295ROM, MSM6295ROMSrc1, 0x40000); + memcpy(MSM6295ROM + 0x100000, MSM6295ROMSrc2, 0x40000); + MSM6295Init(0, 2000000 / 132, 1); + MSM6295Init(1, 2000000 / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + + return 0; +} + +// Rom information +static struct BurnRomInfo metmqstrRomDesc[] = { + { "bp947a.u25", 0x080000, 0x0a5c3442, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bp947a.u28", 0x080000, 0x8c55decf, BRF_ESS | BRF_PRG }, // 1 + { "bp947a.u29", 0x080000, 0xcf0f3f3b, BRF_ESS | BRF_PRG }, // 2 + + { "bp947a.u20", 0x040000, 0xa4a36170, BRF_ESS | BRF_PRG }, // 3 Z80 Code + + { "bp947a.u49", 0x200000, 0x09749531, BRF_GRA }, // 4 Sprite data + { "bp947a.u50", 0x200000, 0x19cea8b2, BRF_GRA }, // 5 + { "bp947a.u51", 0x200000, 0xc19bed67, BRF_GRA }, // 6 + { "bp947a.u52", 0x200000, 0x70c64875, BRF_GRA }, // 7 + + { "bp947a.u48", 0x200000, 0x04ff6a3d, BRF_GRA }, // 8 Layer 0 Tile data + { "bp947a.u47", 0x200000, 0x0de42827, BRF_GRA }, // 9 Layer 2 Tile data + { "bp947a.u46", 0x200000, 0x0f9c906e, BRF_GRA }, // 10 Layer 2 Tile data + + { "bp947a.u42", 0x200000, 0x2ce8ff2a, BRF_SND }, // 11 MSM6295 #1 ADPCM data + { "bp947a.u37", 0x200000, 0xc3077c8f, BRF_SND }, // 12 MSM6295 #2 ADPCM data +}; + + +STD_ROM_PICK(metmqstr) +STD_ROM_FN(metmqstr) + +static struct BurnRomInfo nmasterRomDesc[] = { + { "bp947a_n.u25", 0x080000, 0x748cc514, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bp947a.u28", 0x080000, 0x8c55decf, BRF_ESS | BRF_PRG }, // 1 + { "bp947a.u29", 0x080000, 0xcf0f3f3b, BRF_ESS | BRF_PRG }, // 2 + + { "bp947a.u20", 0x040000, 0xa4a36170, BRF_ESS | BRF_PRG }, // 3 Z80 Code + + { "bp947a.u49", 0x200000, 0x09749531, BRF_GRA }, // 4 Sprite data + { "bp947a.u50", 0x200000, 0x19cea8b2, BRF_GRA }, // 5 + { "bp947a.u51", 0x200000, 0xc19bed67, BRF_GRA }, // 6 + { "bp947a.u52", 0x200000, 0x70c64875, BRF_GRA }, // 7 + + { "bp947a.u48", 0x200000, 0x04ff6a3d, BRF_GRA }, // 8 Layer 0 Tile data + { "bp947a.u47", 0x200000, 0x0de42827, BRF_GRA }, // 9 Layer 2 Tile data + { "bp947a.u46", 0x200000, 0x0f9c906e, BRF_GRA }, // 10 Layer 2 Tile data + + { "bp947a.u42", 0x200000, 0x2ce8ff2a, BRF_SND }, // 11 MSM6295 #1 ADPCM data + { "bp947a.u37", 0x200000, 0xc3077c8f, BRF_SND }, // 12 MSM6295 #2 ADPCM data +}; + + +STD_ROM_PICK(nmaster) +STD_ROM_FN(nmaster) + +struct BurnDriver BurnDrvmetmqstr = { + "metmqstr", NULL, NULL, NULL, "1995", + "Metamoqester (International)\0", NULL, "Banpresto / Pandorabox", "Cave", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, 0, + NULL, metmqstrRomInfo, metmqstrRomName, NULL, NULL, metmqstrInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvnmaster = { + "nmaster", "metmqstr", NULL, NULL, "1995", + "Oni - The Ninja Master (Japan)\0", NULL, "Banpresto / Pandorabox", "Cave", + L"\u7A4F\u5FCD - The Ninja Master (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_CLONE, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, 0, + NULL, nmasterRomInfo, nmasterRomName, NULL, NULL, metmqstrInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 384, 240, 4, 3 +}; diff --git a/src/burn/drv/cave/d_pwrinst2.cpp b/src/burn/drv/cave/d_pwrinst2.cpp index f400075f3..50a175b8d 100644 --- a/src/burn/drv/cave/d_pwrinst2.cpp +++ b/src/burn/drv/cave/d_pwrinst2.cpp @@ -1,1196 +1,1195 @@ -// pwrinst2 -#include "cave.h" -#include "msm6295.h" -#include "burn_ym2203.h" -#include "bitswap.h" - -#define CAVE_VBLANK_LINES 12 - -static UINT8 DrvJoy1[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT16 DrvInput[2] = {0x0000, 0x0000}; - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01, *RomZ80; -static UINT8 *Ram01, *RamZ80; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static INT8 nVideoIRQ; -static INT8 nSoundIRQ; -static INT8 nUnknownIRQ; - -static INT8 nIRQPending; - -static INT32 nCyclesTotal[2]; -static INT32 nCyclesDone[2]; - -static INT32 SoundLatch; -static INT32 SoundLatchReply[48]; -static INT32 SoundLatchStatus; - -static INT32 SoundLatchReplyIndex; -static INT32 SoundLatchReplyMax; - -static UINT8 DrvZ80Bank; -static UINT8 DrvOkiBank1[4]; -static UINT8 DrvOkiBank2[4]; - -static struct BurnInputInfo pwrinst2InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 10, "p1 fire 4"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 10, "p2 fire 4"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 9, "diag"}, - {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service"}, -}; - -STDINPUTINFO(pwrinst2) - -static void UpdateIRQStatus() -{ - nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0); - SekSetIRQLine(1, nIRQPending ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE); -} - -UINT8 __fastcall pwrinst2ReadByte(UINT32 sekAddress) -{ - if (sekAddress >= 0x600000 && sekAddress <= 0x6fffff) return 0; - - switch (sekAddress) { - default: { - bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); - } - } - return 0; -} - -void __fastcall pwrinst2WriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - default: { - bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); - - } - } -} - -UINT16 __fastcall pwrinst2ReadWord(UINT32 sekAddress) -{ - if (sekAddress >= 0x600000 && sekAddress <= 0x6fffff) return 0; - - switch (sekAddress) { - case 0x500000: - return DrvInput[0] ^ 0xFFFF; - case 0x500002: - return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11); - - case 0xa80000: - case 0xa80002: { - UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - return nRet; - } - - case 0xa80004: { - UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nVideoIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - case 0xa80006: { - UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nUnknownIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - - case 0xd80000: { - if (SoundLatchReplyIndex > SoundLatchReplyMax) { - SoundLatchReplyIndex = 0; - SoundLatchReplyMax = -1; - return 0; - } - return SoundLatchReply[SoundLatchReplyIndex++]; - } - - case 0xe80000: { - return ~8 + ((EEPROMRead() & 1) ? 8 : 0); - } - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); - } - } - return 0; -} - -void __fastcall pwrinst2WriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - if (sekAddress >= 0xa8000a && sekAddress <= 0xa8007c) return; - if (sekAddress >= 0xa80004 && sekAddress <= 0xa80006) return; - - switch (sekAddress) { - case 0x700000: - wordValue >>= 8; - EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); - break; - - case 0xa80000: - nCaveXOffset = wordValue; - return; - case 0xa80002: - nCaveYOffset = wordValue; - return; - - case 0xa80008: - CaveSpriteBuffer(); - nCaveSpriteBank = wordValue; - return; - - case 0xb00000: - CaveTileReg[2][0] = wordValue; - break; - case 0xb00002: - CaveTileReg[2][1] = wordValue; - break; - case 0xb00004: { - switch (wordValue & 0x0f) { - case 1: wordValue = (wordValue & ~0x000f) | 0; break; - case 2: wordValue = (wordValue & ~0x000f) | 1; break; - case 4: wordValue = (wordValue & ~0x000f) | 2; break; - default: - case 8: wordValue = (wordValue & ~0x000f) | 3; break; - } - CaveTileReg[2][2] = wordValue; - break; - } - - case 0xb80000: - CaveTileReg[0][0] = wordValue; - break; - case 0xb80002: - CaveTileReg[0][1] = wordValue; - break; - case 0xb80004: { - switch (wordValue & 0x0f) { - case 1: wordValue = (wordValue & ~0x000f) | 0; break; - case 2: wordValue = (wordValue & ~0x000f) | 1; break; - case 4: wordValue = (wordValue & ~0x000f) | 2; break; - default: - case 8: wordValue = (wordValue & ~0x000f) | 3; break; - } - CaveTileReg[0][2] = wordValue; - break; - } - - case 0xc00000: - CaveTileReg[1][0] = wordValue; - break; - case 0xc00002: - CaveTileReg[1][1] = wordValue; - break; - case 0xc00004: { - switch (wordValue & 0x0f) { - case 1: wordValue = (wordValue & ~0x000f) | 0; break; - case 2: wordValue = (wordValue & ~0x000f) | 1; break; - case 4: wordValue = (wordValue & ~0x000f) | 2; break; - default: - case 8: wordValue = (wordValue & ~0x000f) | 3; break; - } - CaveTileReg[1][2] = wordValue; - break; - } - - case 0xc80000: - CaveTileReg[3][0] = wordValue; - break; - case 0xc80002: - CaveTileReg[3][1] = wordValue; - break; - case 0xc80004: { - switch (wordValue & 0x0f) { - case 1: wordValue = (wordValue & ~0x000f) | 0; break; - case 2: wordValue = (wordValue & ~0x000f) | 1; break; - case 4: wordValue = (wordValue & ~0x000f) | 2; break; - default: - case 8: wordValue = (wordValue & ~0x000f) | 3; break; - } - CaveTileReg[3][2] = wordValue; - break; - } - - case 0xe00000: { - SoundLatch = wordValue; - SoundLatchStatus |= 0x0C; - - ZetNmi(); -// nCyclesDone[1] += ZetRun(0x0400); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); - - } - } -} - -UINT8 __fastcall pwrinst2ZIn(UINT16 nAddress) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x00: { - return MSM6295ReadStatus(0); - } - - case 0x08: { - return MSM6295ReadStatus(1); - } - - case 0x40: { - return BurnYM2203Read(0, 0); - } - - case 0x41: { - return BurnYM2203Read(0, 1); - } - - case 0x60: { - SoundLatchStatus |= 0x08; - return SoundLatch >> 8; - } - - case 0x70: { - SoundLatchStatus |= 0x04; - return SoundLatch & 0xFF; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Read %x\n"), nAddress); - } - } - - return 0; -} - -void __fastcall pwrinst2ZOut(UINT16 nAddress, UINT8 nValue) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x00: { - MSM6295Command(0, nValue); - return; - } - - case 0x08: { - MSM6295Command(1, nValue); - return; - } - - case 0x10: - case 0x11: - case 0x12: - case 0x13: - case 0x14: - case 0x15: - case 0x16: - case 0x17: { - INT32 Offset = nAddress - 0x10; - INT32 Chip = (Offset & 4) >> 2; - INT32 BankNum = Offset & 3; - UINT32 Address; - - if (Chip == 0) { - DrvOkiBank1[BankNum] = nValue; - Address = DrvOkiBank1[BankNum] * 0x10000; - MSM6295SampleData[0][BankNum] = MSM6295ROM + Address; - MSM6295SampleInfo[0][BankNum] = MSM6295ROM + Address + (BankNum << 8); - } - - if (Chip == 1) { - DrvOkiBank2[BankNum] = nValue; - Address = DrvOkiBank2[BankNum] * 0x10000; - MSM6295SampleData[1][BankNum] = MSM6295ROM + 0x400000 + Address; - MSM6295SampleInfo[1][BankNum] = MSM6295ROM + 0x400000 + Address + (BankNum << 8); - } - - return; - } - - case 0x40: { - BurnYM2203Write(0, 0, nValue); - return; - } - - case 0x41: { - BurnYM2203Write(0, 1, nValue); - return; - } - - case 0x50: { - if (SoundLatchReplyIndex > SoundLatchReplyMax) { - SoundLatchReplyMax = -1; - SoundLatchReplyIndex = 0; - } - SoundLatchReplyMax++; - SoundLatchReply[SoundLatchReplyMax] = nValue; - return; - } - - case 0x51: { - //??? - return; - } - - case 0x80: { - DrvZ80Bank = nValue & 0x07; - - ZetMapArea(0x8000, 0xbFFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetMapArea(0x8000, 0xbFFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write %x, %x\n"), nAddress, nValue); - } - } -} - -UINT8 __fastcall pwrinst2ZRead(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall pwrinst2ZWrite(UINT16 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 DrvExit() -{ - EEPROMExit(); - - MSM6295Exit(0); - MSM6295Exit(1); - - CaveTileExit(); - CaveSpriteExit(); - CavePalExit(); - - SekExit(); // Deallocate 68000s - ZetExit(); - - BurnYM2203Exit(); - - SoundLatch = 0; - DrvZ80Bank = 0; - DrvOkiBank1[0] = DrvOkiBank1[1] = DrvOkiBank1[2] = DrvOkiBank1[3] = 0; - DrvOkiBank2[0] = DrvOkiBank2[1] = DrvOkiBank2[2] = DrvOkiBank2[3] = 0; - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - MSM6295Reset(0); - MSM6295Reset(1); - - EEPROMReset(); - - nVideoIRQ = 1; - nSoundIRQ = 1; - nUnknownIRQ = 1; - - nIRQPending = 0; - - SoundLatch = 0; - SoundLatchStatus = 0x0C; - - memset(SoundLatchReply, 0, sizeof(SoundLatchReply)); - SoundLatchReplyIndex = 0; - SoundLatchReplyMax = -1; - - DrvZ80Bank = 0; - DrvOkiBank1[0] = DrvOkiBank1[1] = DrvOkiBank1[2] = DrvOkiBank1[3] = 0; - DrvOkiBank2[0] = DrvOkiBank2[1] = DrvOkiBank2[2] = DrvOkiBank2[3] = 0; - - MSM6295SampleInfo[0][0] = MSM6295ROM + 0x00000; - MSM6295SampleData[0][0] = MSM6295ROM + 0x00000; - MSM6295SampleInfo[0][1] = MSM6295ROM + 0x00100; - MSM6295SampleData[0][1] = MSM6295ROM + 0x10000; - MSM6295SampleInfo[0][2] = MSM6295ROM + 0x00200; - MSM6295SampleData[0][2] = MSM6295ROM + 0x20000; - MSM6295SampleInfo[0][3] = MSM6295ROM + 0x00300; - MSM6295SampleData[0][3] = MSM6295ROM + 0x30000; - - MSM6295SampleInfo[1][0] = MSM6295ROM + 0x400000; - MSM6295SampleData[1][0] = MSM6295ROM + 0x400000; - MSM6295SampleInfo[1][1] = MSM6295ROM + 0x400100; - MSM6295SampleData[1][1] = MSM6295ROM + 0x410000; - MSM6295SampleInfo[1][2] = MSM6295ROM + 0x400200; - MSM6295SampleData[1][2] = MSM6295ROM + 0x420000; - MSM6295SampleInfo[1][3] = MSM6295ROM + 0x400300; - MSM6295SampleData[1][3] = MSM6295ROM + 0x430000; - - return 0; -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour & 0x03E0) >> 2; // Red - r |= r >> 5; - g = (nColour & 0x7C00) >> 7; // Green - g |= g >> 5; - b = (nColour & 0x001F) << 3; // Blue - b |= b >> 5; - - return BurnHighCol(r, g, b, 0); -} - -static void DrvCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)CavePalSrc, pd = CavePalette; i < 0x2800; i++, ps++, pd++) { - *pd = CalcCol(BURN_ENDIAN_SWAP_INT16(*ps)); - } -} - -static INT32 DrvDraw() -{ - CavePalUpdate4Bit(0, 128); - DrvCalcPalette(); - - CaveClearScreen(CavePalette[0x7f00]); - - if (bDrawScreen) { -// CaveGetBitmap(); - - CaveTileRender(1); // Render tiles - } - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nCyclesVBlank; - INT32 nInterleave = 100; - - INT32 nCyclesSegment; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x0000; // Player 1 - DrvInput[1] = 0x0000; // Player 2 - for (INT32 i = 0; i < 11; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - } - CaveClearOpposites(&DrvInput[0]); - CaveClearOpposites(&DrvInput[1]); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); - nCyclesTotal[1] = (INT32)(8000000 / CAVE_REFRESHRATE); - nCyclesDone[0] = nCyclesDone[1] = 0; - - nCyclesVBlank = nCyclesTotal[0] - (INT32)((nCyclesTotal[0] * CAVE_VBLANK_LINES) / 271.5); - bVBlank = false; - - for (INT32 i = 1; i <= nInterleave; i++) { - INT32 nCurrentCPU = 0; - INT32 nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; - - // Run 68000 - - // See if we need to trigger the VBlank interrupt - if (!bVBlank && nNext > nCyclesVBlank) { - if (nCyclesDone[nCurrentCPU] < nCyclesVBlank) { - nCyclesSegment = nCyclesVBlank - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - } - - if (pBurnDraw != NULL) { - DrvDraw(); // Draw screen if needed - } - -// CaveSpriteBuffer(); - - bVBlank = true; - nVideoIRQ = 0; - UpdateIRQStatus(); - } - - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - } - - SekClose(); - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - - return 0; -} - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8* Next; Next = Mem; - Rom01 = Next; Next += 0x300000; // 68K program - RomZ80 = Next; Next += 0x040000; - CaveSpriteROM = Next; Next += 0x1000000 * 2; - CaveTileROM[0] = Next; Next += 0x400000; // Tile layer 0 - CaveTileROM[1] = Next; Next += 0x400000; // Tile layer 1 - CaveTileROM[2] = Next; Next += 0x400000; // Tile layer 2 - CaveTileROM[3] = Next; Next += 0x200000; // Tile layer 3 - MSM6295ROM = Next; Next += 0x800000; - RamStart = Next; - Ram01 = Next; Next += 0x028000; // CPU #0 work RAM - RamZ80 = Next; Next += 0x002000; - CaveTileRAM[0] = Next; Next += 0x008000; - CaveTileRAM[1] = Next; Next += 0x008000; - CaveTileRAM[2] = Next; Next += 0x008000; - CaveTileRAM[3] = Next; Next += 0x008000; - CaveSpriteRAM = Next; Next += 0x008000; - CavePalSrc = Next; Next += 0x005000; // palette - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static void NibbleSwap1(UINT8* pData, INT32 nLen) -{ - UINT8* pOrg = pData + nLen - 1; - UINT8* pDest = pData + ((nLen - 1) << 1); - - for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { - pDest[0] = *pOrg & 15; - pDest[1] = *pOrg >> 4; - } - - return; -} - -static void NibbleSwap2(UINT8* pData, INT32 nLen) -{ - UINT8* pOrg = pData + nLen - 1; - UINT8* pDest = pData + ((nLen - 1) << 1); - - for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { - pDest[1] = *pOrg & 15; - pDest[0] = *pOrg >> 4; - } - - return; -} - -static INT32 LoadRoms() -{ - BurnLoadRom(Rom01 + 0x000001, 0, 2); - BurnLoadRom(Rom01 + 0x000000, 1, 2); - BurnLoadRom(Rom01 + 0x100001, 2, 2); - BurnLoadRom(Rom01 + 0x100000, 3, 2); - - BurnLoadRom(RomZ80, 4, 1); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0xe00000); - BurnLoadRom(pTemp + 0x000000, 5, 1); - BurnLoadRom(pTemp + 0x200000, 6, 1); - BurnLoadRom(pTemp + 0x400000, 7, 1); - BurnLoadRom(pTemp + 0x600000, 8, 1); - BurnLoadRom(pTemp + 0x800000, 9, 1); - BurnLoadRom(pTemp + 0xa00000, 10, 1); - BurnLoadRom(pTemp + 0xc00000, 11, 1); - for (INT32 i = 0; i < 0xe00000; i++) { - INT32 j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7, 2,4,6,1,5,3, 0); - if (((j & 6) == 0) || ((j & 6) == 6)) j ^= 6; - CaveSpriteROM[j ^ 7] = (pTemp[i] >> 4) | (pTemp[i] << 4); - } - BurnFree(pTemp); - NibbleSwap1(CaveSpriteROM, 0xe00000); - - BurnLoadRom(CaveTileROM[0], 12, 1); - NibbleSwap2(CaveTileROM[0], 0x200000); - BurnLoadRom(CaveTileROM[1], 13, 1); - NibbleSwap2(CaveTileROM[1], 0x100000); - BurnLoadRom(CaveTileROM[2], 14, 1); - NibbleSwap2(CaveTileROM[2], 0x100000); - BurnLoadRom(CaveTileROM[3], 15, 1); - NibbleSwap2(CaveTileROM[3], 0x080000); - - // Load MSM6295 ADPCM data - BurnLoadRom(MSM6295ROM + 0x000000, 16, 1); - BurnLoadRom(MSM6295ROM + 0x200000, 17, 1); - BurnLoadRom(MSM6295ROM + 0x400000, 18, 1); - BurnLoadRom(MSM6295ROM + 0x600000, 19, 1); - - return 0; -} - -static INT32 PlegendsLoadRoms() -{ - BurnLoadRom(Rom01 + 0x000001, 0, 2); - BurnLoadRom(Rom01 + 0x000000, 1, 2); - BurnLoadRom(Rom01 + 0x100001, 2, 2); - BurnLoadRom(Rom01 + 0x100000, 3, 2); - BurnLoadRom(Rom01 + 0x200001, 4, 2); - BurnLoadRom(Rom01 + 0x200000, 5, 2); - - BurnLoadRom(RomZ80, 6, 1); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x1000000); - BurnLoadRom(pTemp + 0x000000, 7, 1); - BurnLoadRom(pTemp + 0x200000, 8, 1); - BurnLoadRom(pTemp + 0x400000, 9, 1); - BurnLoadRom(pTemp + 0x600000, 10, 1); - BurnLoadRom(pTemp + 0x800000, 11, 1); - BurnLoadRom(pTemp + 0xa00000, 12, 1); - BurnLoadRom(pTemp + 0xc00000, 13, 1); - BurnLoadRom(pTemp + 0xe00000, 14, 1); - for (INT32 i = 0; i < 0x1000000; i++) { - INT32 j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7, 2,4,6,1,5,3, 0); - if (((j & 6) == 0) || ((j & 6) == 6)) j ^= 6; - CaveSpriteROM[j ^ 7] = (pTemp[i] >> 4) | (pTemp[i] << 4); - } - BurnFree(pTemp); - NibbleSwap1(CaveSpriteROM, 0x1000000); - - BurnLoadRom(CaveTileROM[0], 15, 1); - NibbleSwap2(CaveTileROM[0], 0x200000); - BurnLoadRom(CaveTileROM[1], 16, 1); - NibbleSwap2(CaveTileROM[1], 0x200000); - BurnLoadRom(CaveTileROM[2], 17, 1); - NibbleSwap2(CaveTileROM[2], 0x200000); - BurnLoadRom(CaveTileROM[3], 18, 1); - NibbleSwap2(CaveTileROM[3], 0x080000); - - // Load MSM6295 ADPCM data - BurnLoadRom(MSM6295ROM + 0x000000, 19, 1); - BurnLoadRom(MSM6295ROM + 0x200000, 20, 1); - BurnLoadRom(MSM6295ROM + 0x400000, 21, 1); - BurnLoadRom(MSM6295ROM + 0x600000, 22, 1); - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029719; - } - - EEPROMScan(nAction, pnMin); // Scan EEPROM - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - MSM6295Scan(1, nAction); - - SCAN_VAR(nVideoIRQ); - SCAN_VAR(nSoundIRQ); - SCAN_VAR(nUnknownIRQ); - SCAN_VAR(bVBlank); - - CaveScanGraphics(); - - SCAN_VAR(DrvInput); - SCAN_VAR(SoundLatch); - SCAN_VAR(DrvZ80Bank); - SCAN_VAR(DrvOkiBank1); - SCAN_VAR(DrvOkiBank2); - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x8000, 0xbFFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetMapArea(0x8000, 0xbFFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); - ZetClose(); - - for (INT32 i = 0; i < 4; i++) { - INT32 Address = DrvOkiBank1[i] * 0x10000; - MSM6295SampleData[0][i] = MSM6295ROM + Address; - MSM6295SampleInfo[0][i] = MSM6295ROM + Address + (i << 8); - - Address = DrvOkiBank2[i] * 0x10000; - MSM6295SampleData[1][i] = MSM6295ROM + 0x400000 + Address; - MSM6295SampleInfo[1][i] = MSM6295ROM + 0x400000 + Address + (i << 8); - } - - CaveRecalcPalette = 1; - } - } - - return 0; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 8000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 8000000; -} - -static INT32 drvZInit() -{ - ZetInit(0); - ZetOpen(0); - ZetSetInHandler(pwrinst2ZIn); - ZetSetOutHandler(pwrinst2ZOut); - ZetSetReadHandler(pwrinst2ZRead); - ZetSetWriteHandler(pwrinst2ZWrite); - - // ROM bank 1 - ZetMapArea (0x0000, 0x7FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM - ZetMapArea (0x0000, 0x7FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM - // ROM bank 2 - ZetMapArea (0x8000, 0xbFFF, 0, RomZ80 + 0x8000); // Direct Read from ROM - ZetMapArea (0x8000, 0xbFFF, 2, RomZ80 + 0x8000); // - // RAM - ZetMapArea (0xE000, 0xFFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0xE000, 0xFFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0xE000, 0xFFFF, 2, RamZ80); // - ZetMemEnd(); - ZetClose(); - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - BurnSetRefreshRate(CAVE_REFRESHRATE); - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - EEPROMInit(&eeprom_interface_93C46); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x1FFFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x400000, 0x40FFFF, SM_RAM); - SekMapMemory(CaveTileRAM[2], 0x800000, 0x807FFF, SM_RAM); - SekMapMemory(CaveTileRAM[0], 0x880000, 0x887FFF, SM_RAM); - SekMapMemory(CaveTileRAM[1], 0x900000, 0x907FFF, SM_RAM); - SekMapMemory(CaveTileRAM[3] + 0x4000, 0x980000, 0x983FFF, SM_RAM); - SekMapMemory(CaveTileRAM[3] + 0x4000, 0x984000, 0x987FFF, SM_RAM); - SekMapMemory(CaveSpriteRAM, 0xa00000, 0xa07FFF, SM_RAM); - SekMapMemory(Ram01 + 0x10000, 0xa08000, 0xa1FFFF, SM_RAM); - SekMapMemory(CavePalSrc, 0xf00000, 0xf04FFF, SM_RAM); // Palette RAM - SekSetReadWordHandler(0, pwrinst2ReadWord); - SekSetWriteWordHandler(0, pwrinst2WriteWord); - SekSetReadByteHandler(0, pwrinst2ReadByte); - SekSetWriteByteHandler(0, pwrinst2WriteByte); - SekClose(); - } - - drvZInit(); - - CavePalInit(0x8000); - CaveTileInit(); - CaveSpriteInit(3, 0x0e00000 * 2); - CaveTileInitLayer(0, 0x400000, 4, 0x0800); - CaveTileInitLayer(1, 0x200000, 4, 0x1000); - CaveTileInitLayer(2, 0x200000, 4, 0x1800); - CaveTileInitLayer(3, 0x100000, 4, 0x2000); - - nCaveExtraXOffset = -112; - nCaveExtraYOffset = 1; - - BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(8000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.80, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 3000000 / 165, 1); - MSM6295Init(1, 3000000 / 165, 1); - MSM6295SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "pwrinst2")) { - UINT16 *rom = (UINT16 *)Rom01; - rom[0xD46C/2] = 0xD482; // kurara dash fix 0xd400 -> 0xd482 - } - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - - return 0; -} - -static INT32 PlegendsInit() -{ - INT32 nLen; - - BurnSetRefreshRate(CAVE_REFRESHRATE); - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (PlegendsLoadRoms()) { - return 1; - } - - EEPROMInit(&eeprom_interface_93C46); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x1FFFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x400000, 0x40FFFF, SM_RAM); - SekMapMemory(Rom01 + 0x200000, 0x600000, 0x6FFFFF, SM_ROM); - SekMapMemory(CaveTileRAM[2], 0x800000, 0x807FFF, SM_RAM); - SekMapMemory(CaveTileRAM[0], 0x880000, 0x887FFF, SM_RAM); - SekMapMemory(CaveTileRAM[1], 0x900000, 0x907FFF, SM_RAM); - SekMapMemory(CaveTileRAM[3] + 0x4000, 0x980000, 0x983FFF, SM_RAM); - SekMapMemory(CaveTileRAM[3] + 0x4000, 0x984000, 0x987FFF, SM_RAM); - SekMapMemory(CaveSpriteRAM, 0xa00000, 0xa07FFF, SM_RAM); - SekMapMemory(Ram01 + 0x10000, 0xa08000, 0xa1FFFF, SM_RAM); - SekMapMemory(CavePalSrc, 0xf00000, 0xf04FFF, SM_RAM); // Palette RAM - SekSetReadWordHandler(0, pwrinst2ReadWord); - SekSetWriteWordHandler(0, pwrinst2WriteWord); - SekSetReadByteHandler(0, pwrinst2ReadByte); - SekSetWriteByteHandler(0, pwrinst2WriteByte); - SekClose(); - } - - drvZInit(); - - CavePalInit(0x8000); - CaveTileInit(); - CaveSpriteInit(3, 0x01000000 * 2); - CaveTileInitLayer(0, 0x400000, 4, 0x0800); - CaveTileInitLayer(1, 0x400000, 4, 0x1000); - CaveTileInitLayer(2, 0x400000, 4, 0x1800); - CaveTileInitLayer(3, 0x100000, 4, 0x2000); - - nCaveExtraXOffset = -112; - nCaveExtraYOffset = 1; - - BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(8000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.80, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 3000000 / 165, 1); - MSM6295Init(1, 3000000 / 165, 1); - MSM6295SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - - return 0; -} - -// Rom information -static struct BurnRomInfo pwrinst2RomDesc[] = { - { "g02.u45", 0x080000, 0x7b33bc43, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "g02.u44", 0x080000, 0x8f6f6637, BRF_ESS | BRF_PRG }, // 1 - { "g02.u43", 0x080000, 0x178e3d24, BRF_ESS | BRF_PRG }, // 2 - { "g02.u42", 0x080000, 0xa0b4ee99, BRF_ESS | BRF_PRG }, // 3 - - { "g02.u3a", 0x020000, 0xebea5e1e, BRF_ESS | BRF_PRG }, // 4 Z80 Code - - { "g02.u61", 0x200000, 0x91e30398, BRF_GRA }, // 5 Sprite data - { "g02.u62", 0x200000, 0xd9455dd7, BRF_GRA }, // 6 - { "g02.u63", 0x200000, 0x4d20560b, BRF_GRA }, // 7 - { "g02.u64", 0x200000, 0xb17b9b6e, BRF_GRA }, // 8 - { "g02.u65", 0x200000, 0x08541878, BRF_GRA }, // 9 - { "g02.u66", 0x200000, 0xbecf2a36, BRF_GRA }, // 10 - { "g02.u67", 0x200000, 0x52fe2b8b, BRF_GRA }, // 11 - - { "g02.u78", 0x200000, 0x1eca63d2, BRF_GRA }, // 12 Layer 0 Tile data - { "g02.u81", 0x100000, 0x8a3ff685, BRF_GRA }, // 13 Layer 1 Tile data - { "g02.u89", 0x100000, 0x373e1f73, BRF_GRA }, // 14 Layer 2 Tile data - { "g02.82a", 0x080000, 0x4b3567d6, BRF_GRA }, // 15 Layer 3 Tile data - - { "g02.u53", 0x200000, 0xc4bdd9e0, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "g02.u54", 0x200000, 0x1357d50e, BRF_SND }, // 17 - { "g02.u55", 0x200000, 0x2d102898, BRF_SND }, // 18 MSM6295 #2 ADPCM data - { "g02.u56", 0x200000, 0x9ff50dda, BRF_SND }, // 19 -}; - - -STD_ROM_PICK(pwrinst2) -STD_ROM_FN(pwrinst2) - -static struct BurnRomInfo pwrinst2jRomDesc[] = { - { "g02j.u45", 0x080000, 0x42d0abd7, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "g02j.u44", 0x080000, 0x362b7af3, BRF_ESS | BRF_PRG }, // 1 - { "g02j.u43", 0x080000, 0xc94c596b, BRF_ESS | BRF_PRG }, // 2 - { "g02j.u42", 0x080000, 0x4f4c8270, BRF_ESS | BRF_PRG }, // 3 - - { "g02j.u3a", 0x020000, 0xeead01f1, BRF_ESS | BRF_PRG }, // 4 Z80 Code - - { "g02.u61", 0x200000, 0x91e30398, BRF_GRA }, // 5 Sprite data - { "g02.u62", 0x200000, 0xd9455dd7, BRF_GRA }, // 6 - { "g02.u63", 0x200000, 0x4d20560b, BRF_GRA }, // 7 - { "g02.u64", 0x200000, 0xb17b9b6e, BRF_GRA }, // 8 - { "g02.u65", 0x200000, 0x08541878, BRF_GRA }, // 9 - { "g02.u66", 0x200000, 0xbecf2a36, BRF_GRA }, // 10 - { "g02.u67", 0x200000, 0x52fe2b8b, BRF_GRA }, // 11 - - { "g02.u78", 0x200000, 0x1eca63d2, BRF_GRA }, // 12 Layer 0 Tile data - { "g02.u81", 0x100000, 0x8a3ff685, BRF_GRA }, // 13 Layer 1 Tile data - { "g02.u89", 0x100000, 0x373e1f73, BRF_GRA }, // 14 Layer 2 Tile data - { "g02j.82a", 0x080000, 0x3be86fe1, BRF_GRA }, // 15 Layer 3 Tile data - - { "g02.u53", 0x200000, 0xc4bdd9e0, BRF_SND }, // 16 MSM6295 #1 ADPCM data - { "g02.u54", 0x200000, 0x1357d50e, BRF_SND }, // 17 - { "g02.u55", 0x200000, 0x2d102898, BRF_SND }, // 18 MSM6295 #2 ADPCM data - { "g02.u56", 0x200000, 0x9ff50dda, BRF_SND }, // 19 -}; - - -STD_ROM_PICK(pwrinst2j) -STD_ROM_FN(pwrinst2j) - -static struct BurnRomInfo plegendsRomDesc[] = { - { "d12.u45", 0x080000, 0xed8a2e3d, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "d13.u44", 0x080000, 0x25821731, BRF_ESS | BRF_PRG }, // 1 - { "d14.u2", 0x080000, 0xc2cb1402, BRF_ESS | BRF_PRG }, // 2 - { "d16.u3", 0x080000, 0x50a1c63e, BRF_ESS | BRF_PRG }, // 3 - { "d15.u4", 0x080000, 0x6352cec0, BRF_ESS | BRF_PRG }, // 4 - { "d17.u5", 0x080000, 0x7af810d8, BRF_ESS | BRF_PRG }, // 5 - - { "d19.u3", 0x040000, 0x47598459, BRF_ESS | BRF_PRG }, // 6 Z80 Code - - { "g02.u61", 0x200000, 0x91e30398, BRF_GRA }, // 7 Sprite data - { "g02.u62", 0x200000, 0xd9455dd7, BRF_GRA }, // 8 - { "g02.u63", 0x200000, 0x4d20560b, BRF_GRA }, // 9 - { "g02.u64", 0x200000, 0xb17b9b6e, BRF_GRA }, // 10 - { "g02.u65", 0x200000, 0x08541878, BRF_GRA }, // 11 - { "g02.u66", 0x200000, 0xbecf2a36, BRF_GRA }, // 12 - { "atgs.u1", 0x200000, 0xaa6f34a9, BRF_GRA }, // 13 - { "atgs.u2", 0x200000, 0x553eda27, BRF_GRA }, // 14 - - { "atgs.u78", 0x200000, 0x16710ecb, BRF_GRA }, // 15 Layer 0 Tile data - { "atgs.u81", 0x200000, 0xcb2aca91, BRF_GRA }, // 16 Layer 1 Tile data - { "atgs.u89", 0x200000, 0x65f45a0f, BRF_GRA }, // 17 Layer 2 Tile data - { "text.u82", 0x080000, 0xf57333ea, BRF_GRA }, // 18 Layer 3 Tile data - - { "g02.u53", 0x200000, 0xc4bdd9e0, BRF_SND }, // 19 MSM6295 #1 ADPCM data - { "g02.u54", 0x200000, 0x1357d50e, BRF_SND }, // 20 - { "g02.u55", 0x200000, 0x2d102898, BRF_SND }, // 21 MSM6295 #2 ADPCM data - { "g02.u56", 0x200000, 0x9ff50dda, BRF_SND }, // 22 -}; - - -STD_ROM_PICK(plegends) -STD_ROM_FN(plegends) - -static struct BurnRomInfo plegendsjRomDesc[] = { - { "prog.u45", 0x080000, 0x94f53db2, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "prog.u44", 0x080000, 0xdb0ad756, BRF_ESS | BRF_PRG }, // 1 - { "pr12.u2", 0x080000, 0x0e202559, BRF_ESS | BRF_PRG }, // 2 - { "pr12.u3", 0x080000, 0x54742f21, BRF_ESS | BRF_PRG }, // 3 - { "d15.u4", 0x080000, 0x6352cec0, BRF_ESS | BRF_PRG }, // 4 - { "d17.u5", 0x080000, 0x7af810d8, BRF_ESS | BRF_PRG }, // 5 - - { "sound.u3", 0x020000, 0x36f71520, BRF_ESS | BRF_PRG }, // 6 Z80 Code - - { "g02.u61", 0x200000, 0x91e30398, BRF_GRA }, // 7 Sprite data - { "g02.u62", 0x200000, 0xd9455dd7, BRF_GRA }, // 8 - { "g02.u63", 0x200000, 0x4d20560b, BRF_GRA }, // 9 - { "g02.u64", 0x200000, 0xb17b9b6e, BRF_GRA }, // 10 - { "g02.u65", 0x200000, 0x08541878, BRF_GRA }, // 11 - { "g02.u66", 0x200000, 0xbecf2a36, BRF_GRA }, // 12 - { "atgs.u1", 0x200000, 0xaa6f34a9, BRF_GRA }, // 13 - { "atgs.u2", 0x200000, 0x553eda27, BRF_GRA }, // 14 - - { "atgs.u78", 0x200000, 0x16710ecb, BRF_GRA }, // 15 Layer 0 Tile data - { "atgs.u81", 0x200000, 0xcb2aca91, BRF_GRA }, // 16 Layer 1 Tile data - { "atgs.u89", 0x200000, 0x65f45a0f, BRF_GRA }, // 17 Layer 2 Tile data - { "text.u82", 0x080000, 0xf57333ea, BRF_GRA }, // 18 Layer 3 Tile data - - { "g02.u53", 0x200000, 0xc4bdd9e0, BRF_SND }, // 19 MSM6295 #1 ADPCM data - { "g02.u54", 0x200000, 0x1357d50e, BRF_SND }, // 20 - { "g02.u55", 0x200000, 0x2d102898, BRF_SND }, // 21 MSM6295 #2 ADPCM data - { "g02.u56", 0x200000, 0x9ff50dda, BRF_SND }, // 22 -}; - - -STD_ROM_PICK(plegendsj) -STD_ROM_FN(plegendsj) - -struct BurnDriver BurnDrvPwrinst2 = { - "pwrinst2", NULL, NULL, NULL, "1994", - "Power Instinct 2 (USA, ver. 94/04/08)\0", "Bad Music from first MSM6295", "Atlus", "Cave", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, FBF_PWRINST, - NULL, pwrinst2RomInfo, pwrinst2RomName, NULL, NULL, pwrinst2InputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPwrinst2j = { - "pwrinst2j", "pwrinst2", NULL, NULL, "1994", - "Gouketsuji Ichizoku 2 (Japan, ver. 94/04/08)\0", NULL, "Atlus", "Cave", - L"\u8C6A\u8840\u5BFA\u4E00\u65CF \uFF12 (Japan, ver. 94/04/08)\0Gouketsuji Ichizoku 2\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, FBF_PWRINST, - NULL, pwrinst2jRomInfo, pwrinst2jRomName, NULL, NULL, pwrinst2InputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPlegends = { - "plegends", NULL, NULL, NULL, "1995", - "Gouketsuji Gaiden Legends (USA, ver. 95/06/20)\0", NULL, "Atlus / KM International", "Cave", - L"\u8C6A\u8840\u5BFA\u5916\u4F1D Gogetsuji Legends (USA, ver. 95/06/20)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, FBF_PWRINST, - NULL, plegendsRomInfo, plegendsRomName, NULL, NULL, pwrinst2InputInfo, NULL, - PlegendsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPlegendsj = { - "plegendsj", "plegends", NULL, NULL, "1995", - "Gouketsuji Gaiden Saikyou Densetsu (Japan, ver. 95/06/20)\0", NULL, "Atlus", "Cave", - L"\u8C6A\u8840\u5BFA\u5916\u4F1D Gogetsuji \u6700\u5F37\u4F1D\u8AAC (Japan, ver. 95/06/20)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, FBF_PWRINST, - NULL, plegendsjRomInfo, plegendsjRomName, NULL, NULL, pwrinst2InputInfo, NULL, - PlegendsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; +// pwrinst2 +#include "cave.h" +#include "msm6295.h" +#include "burn_ym2203.h" +#include "bitswap.h" + +#define CAVE_VBLANK_LINES 12 + +static UINT8 DrvJoy1[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT16 DrvInput[2] = {0x0000, 0x0000}; + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01, *RomZ80; +static UINT8 *Ram01, *RamZ80; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static INT8 nVideoIRQ; +static INT8 nSoundIRQ; +static INT8 nUnknownIRQ; + +static INT8 nIRQPending; + +static INT32 nCyclesTotal[2]; +static INT32 nCyclesDone[2]; + +static INT32 SoundLatch; +static INT32 SoundLatchReply[48]; +static INT32 SoundLatchStatus; + +static INT32 SoundLatchReplyIndex; +static INT32 SoundLatchReplyMax; + +static UINT8 DrvZ80Bank; +static UINT8 DrvOkiBank1[4]; +static UINT8 DrvOkiBank2[4]; + +static struct BurnInputInfo pwrinst2InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 10, "p1 fire 4"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 10, "p2 fire 4"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 9, "diag"}, + {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service"}, +}; + +STDINPUTINFO(pwrinst2) + +static void UpdateIRQStatus() +{ + nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0); + SekSetIRQLine(1, nIRQPending ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE); +} + +UINT8 __fastcall pwrinst2ReadByte(UINT32 sekAddress) +{ + if (sekAddress >= 0x600000 && sekAddress <= 0x6fffff) return 0; + + switch (sekAddress) { + default: { + bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); + } + } + return 0; +} + +void __fastcall pwrinst2WriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + default: { + bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); + + } + } +} + +UINT16 __fastcall pwrinst2ReadWord(UINT32 sekAddress) +{ + if (sekAddress >= 0x600000 && sekAddress <= 0x6fffff) return 0; + + switch (sekAddress) { + case 0x500000: + return DrvInput[0] ^ 0xFFFF; + case 0x500002: + return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11); + + case 0xa80000: + case 0xa80002: { + UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + return nRet; + } + + case 0xa80004: { + UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nVideoIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + case 0xa80006: { + UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nUnknownIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + + case 0xd80000: { + if (SoundLatchReplyIndex > SoundLatchReplyMax) { + SoundLatchReplyIndex = 0; + SoundLatchReplyMax = -1; + return 0; + } + return SoundLatchReply[SoundLatchReplyIndex++]; + } + + case 0xe80000: { + return ~8 + ((EEPROMRead() & 1) ? 8 : 0); + } + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); + } + } + return 0; +} + +void __fastcall pwrinst2WriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + if (sekAddress >= 0xa8000a && sekAddress <= 0xa8007c) return; + if (sekAddress >= 0xa80004 && sekAddress <= 0xa80006) return; + + switch (sekAddress) { + case 0x700000: + wordValue >>= 8; + EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); + break; + + case 0xa80000: + nCaveXOffset = wordValue; + return; + case 0xa80002: + nCaveYOffset = wordValue; + return; + + case 0xa80008: + CaveSpriteBuffer(); + nCaveSpriteBank = wordValue; + return; + + case 0xb00000: + CaveTileReg[2][0] = wordValue; + break; + case 0xb00002: + CaveTileReg[2][1] = wordValue; + break; + case 0xb00004: { + switch (wordValue & 0x0f) { + case 1: wordValue = (wordValue & ~0x000f) | 0; break; + case 2: wordValue = (wordValue & ~0x000f) | 1; break; + case 4: wordValue = (wordValue & ~0x000f) | 2; break; + default: + case 8: wordValue = (wordValue & ~0x000f) | 3; break; + } + CaveTileReg[2][2] = wordValue; + break; + } + + case 0xb80000: + CaveTileReg[0][0] = wordValue; + break; + case 0xb80002: + CaveTileReg[0][1] = wordValue; + break; + case 0xb80004: { + switch (wordValue & 0x0f) { + case 1: wordValue = (wordValue & ~0x000f) | 0; break; + case 2: wordValue = (wordValue & ~0x000f) | 1; break; + case 4: wordValue = (wordValue & ~0x000f) | 2; break; + default: + case 8: wordValue = (wordValue & ~0x000f) | 3; break; + } + CaveTileReg[0][2] = wordValue; + break; + } + + case 0xc00000: + CaveTileReg[1][0] = wordValue; + break; + case 0xc00002: + CaveTileReg[1][1] = wordValue; + break; + case 0xc00004: { + switch (wordValue & 0x0f) { + case 1: wordValue = (wordValue & ~0x000f) | 0; break; + case 2: wordValue = (wordValue & ~0x000f) | 1; break; + case 4: wordValue = (wordValue & ~0x000f) | 2; break; + default: + case 8: wordValue = (wordValue & ~0x000f) | 3; break; + } + CaveTileReg[1][2] = wordValue; + break; + } + + case 0xc80000: + CaveTileReg[3][0] = wordValue; + break; + case 0xc80002: + CaveTileReg[3][1] = wordValue; + break; + case 0xc80004: { + switch (wordValue & 0x0f) { + case 1: wordValue = (wordValue & ~0x000f) | 0; break; + case 2: wordValue = (wordValue & ~0x000f) | 1; break; + case 4: wordValue = (wordValue & ~0x000f) | 2; break; + default: + case 8: wordValue = (wordValue & ~0x000f) | 3; break; + } + CaveTileReg[3][2] = wordValue; + break; + } + + case 0xe00000: { + SoundLatch = wordValue; + SoundLatchStatus |= 0x0C; + + ZetNmi(); +// nCyclesDone[1] += ZetRun(0x0400); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); + + } + } +} + +UINT8 __fastcall pwrinst2ZIn(UINT16 nAddress) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x00: { + return MSM6295ReadStatus(0); + } + + case 0x08: { + return MSM6295ReadStatus(1); + } + + case 0x40: { + return BurnYM2203Read(0, 0); + } + + case 0x41: { + return BurnYM2203Read(0, 1); + } + + case 0x60: { + SoundLatchStatus |= 0x08; + return SoundLatch >> 8; + } + + case 0x70: { + SoundLatchStatus |= 0x04; + return SoundLatch & 0xFF; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Read %x\n"), nAddress); + } + } + + return 0; +} + +void __fastcall pwrinst2ZOut(UINT16 nAddress, UINT8 nValue) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x00: { + MSM6295Command(0, nValue); + return; + } + + case 0x08: { + MSM6295Command(1, nValue); + return; + } + + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: { + INT32 Offset = nAddress - 0x10; + INT32 Chip = (Offset & 4) >> 2; + INT32 BankNum = Offset & 3; + UINT32 Address; + + if (Chip == 0) { + DrvOkiBank1[BankNum] = nValue; + Address = DrvOkiBank1[BankNum] * 0x10000; + MSM6295SampleData[0][BankNum] = MSM6295ROM + Address; + MSM6295SampleInfo[0][BankNum] = MSM6295ROM + Address + (BankNum << 8); + } + + if (Chip == 1) { + DrvOkiBank2[BankNum] = nValue; + Address = DrvOkiBank2[BankNum] * 0x10000; + MSM6295SampleData[1][BankNum] = MSM6295ROM + 0x400000 + Address; + MSM6295SampleInfo[1][BankNum] = MSM6295ROM + 0x400000 + Address + (BankNum << 8); + } + + return; + } + + case 0x40: { + BurnYM2203Write(0, 0, nValue); + return; + } + + case 0x41: { + BurnYM2203Write(0, 1, nValue); + return; + } + + case 0x50: { + if (SoundLatchReplyIndex > SoundLatchReplyMax) { + SoundLatchReplyMax = -1; + SoundLatchReplyIndex = 0; + } + SoundLatchReplyMax++; + SoundLatchReply[SoundLatchReplyMax] = nValue; + return; + } + + case 0x51: { + //??? + return; + } + + case 0x80: { + DrvZ80Bank = nValue & 0x07; + + ZetMapArea(0x8000, 0xbFFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetMapArea(0x8000, 0xbFFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write %x, %x\n"), nAddress, nValue); + } + } +} + +UINT8 __fastcall pwrinst2ZRead(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall pwrinst2ZWrite(UINT16 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 DrvExit() +{ + EEPROMExit(); + + MSM6295Exit(0); + MSM6295Exit(1); + + CaveTileExit(); + CaveSpriteExit(); + CavePalExit(); + + SekExit(); // Deallocate 68000s + ZetExit(); + + BurnYM2203Exit(); + + SoundLatch = 0; + DrvZ80Bank = 0; + DrvOkiBank1[0] = DrvOkiBank1[1] = DrvOkiBank1[2] = DrvOkiBank1[3] = 0; + DrvOkiBank2[0] = DrvOkiBank2[1] = DrvOkiBank2[2] = DrvOkiBank2[3] = 0; + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + MSM6295Reset(0); + MSM6295Reset(1); + + EEPROMReset(); + + nVideoIRQ = 1; + nSoundIRQ = 1; + nUnknownIRQ = 1; + + nIRQPending = 0; + + SoundLatch = 0; + SoundLatchStatus = 0x0C; + + memset(SoundLatchReply, 0, sizeof(SoundLatchReply)); + SoundLatchReplyIndex = 0; + SoundLatchReplyMax = -1; + + DrvZ80Bank = 0; + DrvOkiBank1[0] = DrvOkiBank1[1] = DrvOkiBank1[2] = DrvOkiBank1[3] = 0; + DrvOkiBank2[0] = DrvOkiBank2[1] = DrvOkiBank2[2] = DrvOkiBank2[3] = 0; + + MSM6295SampleInfo[0][0] = MSM6295ROM + 0x00000; + MSM6295SampleData[0][0] = MSM6295ROM + 0x00000; + MSM6295SampleInfo[0][1] = MSM6295ROM + 0x00100; + MSM6295SampleData[0][1] = MSM6295ROM + 0x10000; + MSM6295SampleInfo[0][2] = MSM6295ROM + 0x00200; + MSM6295SampleData[0][2] = MSM6295ROM + 0x20000; + MSM6295SampleInfo[0][3] = MSM6295ROM + 0x00300; + MSM6295SampleData[0][3] = MSM6295ROM + 0x30000; + + MSM6295SampleInfo[1][0] = MSM6295ROM + 0x400000; + MSM6295SampleData[1][0] = MSM6295ROM + 0x400000; + MSM6295SampleInfo[1][1] = MSM6295ROM + 0x400100; + MSM6295SampleData[1][1] = MSM6295ROM + 0x410000; + MSM6295SampleInfo[1][2] = MSM6295ROM + 0x400200; + MSM6295SampleData[1][2] = MSM6295ROM + 0x420000; + MSM6295SampleInfo[1][3] = MSM6295ROM + 0x400300; + MSM6295SampleData[1][3] = MSM6295ROM + 0x430000; + + return 0; +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour & 0x03E0) >> 2; // Red + r |= r >> 5; + g = (nColour & 0x7C00) >> 7; // Green + g |= g >> 5; + b = (nColour & 0x001F) << 3; // Blue + b |= b >> 5; + + return BurnHighCol(r, g, b, 0); +} + +static void DrvCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)CavePalSrc, pd = CavePalette; i < 0x2800; i++, ps++, pd++) { + *pd = CalcCol(BURN_ENDIAN_SWAP_INT16(*ps)); + } +} + +static INT32 DrvDraw() +{ + CavePalUpdate4Bit(0, 128); + DrvCalcPalette(); + + CaveClearScreen(CavePalette[0x7f00]); + + if (bDrawScreen) { +// CaveGetBitmap(); + + CaveTileRender(1); // Render tiles + } + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nCyclesVBlank; + INT32 nInterleave = 100; + + INT32 nCyclesSegment; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x0000; // Player 1 + DrvInput[1] = 0x0000; // Player 2 + for (INT32 i = 0; i < 11; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + } + CaveClearOpposites(&DrvInput[0]); + CaveClearOpposites(&DrvInput[1]); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); + nCyclesTotal[1] = (INT32)(8000000 / CAVE_REFRESHRATE); + nCyclesDone[0] = nCyclesDone[1] = 0; + + nCyclesVBlank = nCyclesTotal[0] - (INT32)((nCyclesTotal[0] * CAVE_VBLANK_LINES) / 271.5); + bVBlank = false; + + for (INT32 i = 1; i <= nInterleave; i++) { + INT32 nCurrentCPU = 0; + INT32 nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; + + // Run 68000 + + // See if we need to trigger the VBlank interrupt + if (!bVBlank && nNext > nCyclesVBlank) { + if (nCyclesDone[nCurrentCPU] < nCyclesVBlank) { + nCyclesSegment = nCyclesVBlank - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + } + + if (pBurnDraw != NULL) { + DrvDraw(); // Draw screen if needed + } + +// CaveSpriteBuffer(); + + bVBlank = true; + nVideoIRQ = 0; + UpdateIRQStatus(); + } + + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + } + + SekClose(); + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + + return 0; +} + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8* Next; Next = Mem; + Rom01 = Next; Next += 0x300000; // 68K program + RomZ80 = Next; Next += 0x040000; + CaveSpriteROM = Next; Next += 0x1000000 * 2; + CaveTileROM[0] = Next; Next += 0x400000; // Tile layer 0 + CaveTileROM[1] = Next; Next += 0x400000; // Tile layer 1 + CaveTileROM[2] = Next; Next += 0x400000; // Tile layer 2 + CaveTileROM[3] = Next; Next += 0x200000; // Tile layer 3 + MSM6295ROM = Next; Next += 0x800000; + RamStart = Next; + Ram01 = Next; Next += 0x028000; // CPU #0 work RAM + RamZ80 = Next; Next += 0x002000; + CaveTileRAM[0] = Next; Next += 0x008000; + CaveTileRAM[1] = Next; Next += 0x008000; + CaveTileRAM[2] = Next; Next += 0x008000; + CaveTileRAM[3] = Next; Next += 0x008000; + CaveSpriteRAM = Next; Next += 0x008000; + CavePalSrc = Next; Next += 0x005000; // palette + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static void NibbleSwap1(UINT8* pData, INT32 nLen) +{ + UINT8* pOrg = pData + nLen - 1; + UINT8* pDest = pData + ((nLen - 1) << 1); + + for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { + pDest[0] = *pOrg & 15; + pDest[1] = *pOrg >> 4; + } + + return; +} + +static void NibbleSwap2(UINT8* pData, INT32 nLen) +{ + UINT8* pOrg = pData + nLen - 1; + UINT8* pDest = pData + ((nLen - 1) << 1); + + for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { + pDest[1] = *pOrg & 15; + pDest[0] = *pOrg >> 4; + } + + return; +} + +static INT32 LoadRoms() +{ + BurnLoadRom(Rom01 + 0x000001, 0, 2); + BurnLoadRom(Rom01 + 0x000000, 1, 2); + BurnLoadRom(Rom01 + 0x100001, 2, 2); + BurnLoadRom(Rom01 + 0x100000, 3, 2); + + BurnLoadRom(RomZ80, 4, 1); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0xe00000); + BurnLoadRom(pTemp + 0x000000, 5, 1); + BurnLoadRom(pTemp + 0x200000, 6, 1); + BurnLoadRom(pTemp + 0x400000, 7, 1); + BurnLoadRom(pTemp + 0x600000, 8, 1); + BurnLoadRom(pTemp + 0x800000, 9, 1); + BurnLoadRom(pTemp + 0xa00000, 10, 1); + BurnLoadRom(pTemp + 0xc00000, 11, 1); + for (INT32 i = 0; i < 0xe00000; i++) { + INT32 j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7, 2,4,6,1,5,3, 0); + if (((j & 6) == 0) || ((j & 6) == 6)) j ^= 6; + CaveSpriteROM[j ^ 7] = (pTemp[i] >> 4) | (pTemp[i] << 4); + } + BurnFree(pTemp); + NibbleSwap1(CaveSpriteROM, 0xe00000); + + BurnLoadRom(CaveTileROM[0], 12, 1); + NibbleSwap2(CaveTileROM[0], 0x200000); + BurnLoadRom(CaveTileROM[1], 13, 1); + NibbleSwap2(CaveTileROM[1], 0x100000); + BurnLoadRom(CaveTileROM[2], 14, 1); + NibbleSwap2(CaveTileROM[2], 0x100000); + BurnLoadRom(CaveTileROM[3], 15, 1); + NibbleSwap2(CaveTileROM[3], 0x080000); + + // Load MSM6295 ADPCM data + BurnLoadRom(MSM6295ROM + 0x000000, 16, 1); + BurnLoadRom(MSM6295ROM + 0x200000, 17, 1); + BurnLoadRom(MSM6295ROM + 0x400000, 18, 1); + BurnLoadRom(MSM6295ROM + 0x600000, 19, 1); + + return 0; +} + +static INT32 PlegendsLoadRoms() +{ + BurnLoadRom(Rom01 + 0x000001, 0, 2); + BurnLoadRom(Rom01 + 0x000000, 1, 2); + BurnLoadRom(Rom01 + 0x100001, 2, 2); + BurnLoadRom(Rom01 + 0x100000, 3, 2); + BurnLoadRom(Rom01 + 0x200001, 4, 2); + BurnLoadRom(Rom01 + 0x200000, 5, 2); + + BurnLoadRom(RomZ80, 6, 1); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x1000000); + BurnLoadRom(pTemp + 0x000000, 7, 1); + BurnLoadRom(pTemp + 0x200000, 8, 1); + BurnLoadRom(pTemp + 0x400000, 9, 1); + BurnLoadRom(pTemp + 0x600000, 10, 1); + BurnLoadRom(pTemp + 0x800000, 11, 1); + BurnLoadRom(pTemp + 0xa00000, 12, 1); + BurnLoadRom(pTemp + 0xc00000, 13, 1); + BurnLoadRom(pTemp + 0xe00000, 14, 1); + for (INT32 i = 0; i < 0x1000000; i++) { + INT32 j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7, 2,4,6,1,5,3, 0); + if (((j & 6) == 0) || ((j & 6) == 6)) j ^= 6; + CaveSpriteROM[j ^ 7] = (pTemp[i] >> 4) | (pTemp[i] << 4); + } + BurnFree(pTemp); + NibbleSwap1(CaveSpriteROM, 0x1000000); + + BurnLoadRom(CaveTileROM[0], 15, 1); + NibbleSwap2(CaveTileROM[0], 0x200000); + BurnLoadRom(CaveTileROM[1], 16, 1); + NibbleSwap2(CaveTileROM[1], 0x200000); + BurnLoadRom(CaveTileROM[2], 17, 1); + NibbleSwap2(CaveTileROM[2], 0x200000); + BurnLoadRom(CaveTileROM[3], 18, 1); + NibbleSwap2(CaveTileROM[3], 0x080000); + + // Load MSM6295 ADPCM data + BurnLoadRom(MSM6295ROM + 0x000000, 19, 1); + BurnLoadRom(MSM6295ROM + 0x200000, 20, 1); + BurnLoadRom(MSM6295ROM + 0x400000, 21, 1); + BurnLoadRom(MSM6295ROM + 0x600000, 22, 1); + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029719; + } + + EEPROMScan(nAction, pnMin); // Scan EEPROM + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + MSM6295Scan(1, nAction); + + SCAN_VAR(nVideoIRQ); + SCAN_VAR(nSoundIRQ); + SCAN_VAR(nUnknownIRQ); + SCAN_VAR(bVBlank); + + CaveScanGraphics(); + + SCAN_VAR(DrvInput); + SCAN_VAR(SoundLatch); + SCAN_VAR(DrvZ80Bank); + SCAN_VAR(DrvOkiBank1); + SCAN_VAR(DrvOkiBank2); + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x8000, 0xbFFF, 0, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetMapArea(0x8000, 0xbFFF, 2, RomZ80 + (DrvZ80Bank * 0x4000)); + ZetClose(); + + for (INT32 i = 0; i < 4; i++) { + INT32 Address = DrvOkiBank1[i] * 0x10000; + MSM6295SampleData[0][i] = MSM6295ROM + Address; + MSM6295SampleInfo[0][i] = MSM6295ROM + Address + (i << 8); + + Address = DrvOkiBank2[i] * 0x10000; + MSM6295SampleData[1][i] = MSM6295ROM + 0x400000 + Address; + MSM6295SampleInfo[1][i] = MSM6295ROM + 0x400000 + Address + (i << 8); + } + + CaveRecalcPalette = 1; + } + } + + return 0; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 8000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 8000000; +} + +static INT32 drvZInit() +{ + ZetInit(0); + ZetOpen(0); + ZetSetInHandler(pwrinst2ZIn); + ZetSetOutHandler(pwrinst2ZOut); + ZetSetReadHandler(pwrinst2ZRead); + ZetSetWriteHandler(pwrinst2ZWrite); + + // ROM bank 1 + ZetMapArea (0x0000, 0x7FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM + ZetMapArea (0x0000, 0x7FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM + // ROM bank 2 + ZetMapArea (0x8000, 0xbFFF, 0, RomZ80 + 0x8000); // Direct Read from ROM + ZetMapArea (0x8000, 0xbFFF, 2, RomZ80 + 0x8000); // + // RAM + ZetMapArea (0xE000, 0xFFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0xE000, 0xFFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0xE000, 0xFFFF, 2, RamZ80); // + ZetClose(); + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + BurnSetRefreshRate(CAVE_REFRESHRATE); + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + EEPROMInit(&eeprom_interface_93C46); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x1FFFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x400000, 0x40FFFF, SM_RAM); + SekMapMemory(CaveTileRAM[2], 0x800000, 0x807FFF, SM_RAM); + SekMapMemory(CaveTileRAM[0], 0x880000, 0x887FFF, SM_RAM); + SekMapMemory(CaveTileRAM[1], 0x900000, 0x907FFF, SM_RAM); + SekMapMemory(CaveTileRAM[3] + 0x4000, 0x980000, 0x983FFF, SM_RAM); + SekMapMemory(CaveTileRAM[3] + 0x4000, 0x984000, 0x987FFF, SM_RAM); + SekMapMemory(CaveSpriteRAM, 0xa00000, 0xa07FFF, SM_RAM); + SekMapMemory(Ram01 + 0x10000, 0xa08000, 0xa1FFFF, SM_RAM); + SekMapMemory(CavePalSrc, 0xf00000, 0xf04FFF, SM_RAM); // Palette RAM + SekSetReadWordHandler(0, pwrinst2ReadWord); + SekSetWriteWordHandler(0, pwrinst2WriteWord); + SekSetReadByteHandler(0, pwrinst2ReadByte); + SekSetWriteByteHandler(0, pwrinst2WriteByte); + SekClose(); + } + + drvZInit(); + + CavePalInit(0x8000); + CaveTileInit(); + CaveSpriteInit(3, 0x0e00000 * 2); + CaveTileInitLayer(0, 0x400000, 4, 0x0800); + CaveTileInitLayer(1, 0x200000, 4, 0x1000); + CaveTileInitLayer(2, 0x200000, 4, 0x1800); + CaveTileInitLayer(3, 0x100000, 4, 0x2000); + + nCaveExtraXOffset = -112; + nCaveExtraYOffset = 1; + + BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(8000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.80, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 3000000 / 165, 1); + MSM6295Init(1, 3000000 / 165, 1); + MSM6295SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "pwrinst2")) { + UINT16 *rom = (UINT16 *)Rom01; + rom[0xD46C/2] = 0xD482; // kurara dash fix 0xd400 -> 0xd482 + } + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + + return 0; +} + +static INT32 PlegendsInit() +{ + INT32 nLen; + + BurnSetRefreshRate(CAVE_REFRESHRATE); + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (PlegendsLoadRoms()) { + return 1; + } + + EEPROMInit(&eeprom_interface_93C46); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x1FFFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x400000, 0x40FFFF, SM_RAM); + SekMapMemory(Rom01 + 0x200000, 0x600000, 0x6FFFFF, SM_ROM); + SekMapMemory(CaveTileRAM[2], 0x800000, 0x807FFF, SM_RAM); + SekMapMemory(CaveTileRAM[0], 0x880000, 0x887FFF, SM_RAM); + SekMapMemory(CaveTileRAM[1], 0x900000, 0x907FFF, SM_RAM); + SekMapMemory(CaveTileRAM[3] + 0x4000, 0x980000, 0x983FFF, SM_RAM); + SekMapMemory(CaveTileRAM[3] + 0x4000, 0x984000, 0x987FFF, SM_RAM); + SekMapMemory(CaveSpriteRAM, 0xa00000, 0xa07FFF, SM_RAM); + SekMapMemory(Ram01 + 0x10000, 0xa08000, 0xa1FFFF, SM_RAM); + SekMapMemory(CavePalSrc, 0xf00000, 0xf04FFF, SM_RAM); // Palette RAM + SekSetReadWordHandler(0, pwrinst2ReadWord); + SekSetWriteWordHandler(0, pwrinst2WriteWord); + SekSetReadByteHandler(0, pwrinst2ReadByte); + SekSetWriteByteHandler(0, pwrinst2WriteByte); + SekClose(); + } + + drvZInit(); + + CavePalInit(0x8000); + CaveTileInit(); + CaveSpriteInit(3, 0x01000000 * 2); + CaveTileInitLayer(0, 0x400000, 4, 0x0800); + CaveTileInitLayer(1, 0x400000, 4, 0x1000); + CaveTileInitLayer(2, 0x400000, 4, 0x1800); + CaveTileInitLayer(3, 0x100000, 4, 0x2000); + + nCaveExtraXOffset = -112; + nCaveExtraYOffset = 1; + + BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(8000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.80, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 3000000 / 165, 1); + MSM6295Init(1, 3000000 / 165, 1); + MSM6295SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + + return 0; +} + +// Rom information +static struct BurnRomInfo pwrinst2RomDesc[] = { + { "g02.u45", 0x080000, 0x7b33bc43, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "g02.u44", 0x080000, 0x8f6f6637, BRF_ESS | BRF_PRG }, // 1 + { "g02.u43", 0x080000, 0x178e3d24, BRF_ESS | BRF_PRG }, // 2 + { "g02.u42", 0x080000, 0xa0b4ee99, BRF_ESS | BRF_PRG }, // 3 + + { "g02.u3a", 0x020000, 0xebea5e1e, BRF_ESS | BRF_PRG }, // 4 Z80 Code + + { "g02.u61", 0x200000, 0x91e30398, BRF_GRA }, // 5 Sprite data + { "g02.u62", 0x200000, 0xd9455dd7, BRF_GRA }, // 6 + { "g02.u63", 0x200000, 0x4d20560b, BRF_GRA }, // 7 + { "g02.u64", 0x200000, 0xb17b9b6e, BRF_GRA }, // 8 + { "g02.u65", 0x200000, 0x08541878, BRF_GRA }, // 9 + { "g02.u66", 0x200000, 0xbecf2a36, BRF_GRA }, // 10 + { "g02.u67", 0x200000, 0x52fe2b8b, BRF_GRA }, // 11 + + { "g02.u78", 0x200000, 0x1eca63d2, BRF_GRA }, // 12 Layer 0 Tile data + { "g02.u81", 0x100000, 0x8a3ff685, BRF_GRA }, // 13 Layer 1 Tile data + { "g02.u89", 0x100000, 0x373e1f73, BRF_GRA }, // 14 Layer 2 Tile data + { "g02.82a", 0x080000, 0x4b3567d6, BRF_GRA }, // 15 Layer 3 Tile data + + { "g02.u53", 0x200000, 0xc4bdd9e0, BRF_SND }, // 16 MSM6295 #1 ADPCM data + { "g02.u54", 0x200000, 0x1357d50e, BRF_SND }, // 17 + { "g02.u55", 0x200000, 0x2d102898, BRF_SND }, // 18 MSM6295 #2 ADPCM data + { "g02.u56", 0x200000, 0x9ff50dda, BRF_SND }, // 19 +}; + + +STD_ROM_PICK(pwrinst2) +STD_ROM_FN(pwrinst2) + +static struct BurnRomInfo pwrinst2jRomDesc[] = { + { "g02j.u45", 0x080000, 0x42d0abd7, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "g02j.u44", 0x080000, 0x362b7af3, BRF_ESS | BRF_PRG }, // 1 + { "g02j.u43", 0x080000, 0xc94c596b, BRF_ESS | BRF_PRG }, // 2 + { "g02j.u42", 0x080000, 0x4f4c8270, BRF_ESS | BRF_PRG }, // 3 + + { "g02j.u3a", 0x020000, 0xeead01f1, BRF_ESS | BRF_PRG }, // 4 Z80 Code + + { "g02.u61", 0x200000, 0x91e30398, BRF_GRA }, // 5 Sprite data + { "g02.u62", 0x200000, 0xd9455dd7, BRF_GRA }, // 6 + { "g02.u63", 0x200000, 0x4d20560b, BRF_GRA }, // 7 + { "g02.u64", 0x200000, 0xb17b9b6e, BRF_GRA }, // 8 + { "g02.u65", 0x200000, 0x08541878, BRF_GRA }, // 9 + { "g02.u66", 0x200000, 0xbecf2a36, BRF_GRA }, // 10 + { "g02.u67", 0x200000, 0x52fe2b8b, BRF_GRA }, // 11 + + { "g02.u78", 0x200000, 0x1eca63d2, BRF_GRA }, // 12 Layer 0 Tile data + { "g02.u81", 0x100000, 0x8a3ff685, BRF_GRA }, // 13 Layer 1 Tile data + { "g02.u89", 0x100000, 0x373e1f73, BRF_GRA }, // 14 Layer 2 Tile data + { "g02j.82a", 0x080000, 0x3be86fe1, BRF_GRA }, // 15 Layer 3 Tile data + + { "g02.u53", 0x200000, 0xc4bdd9e0, BRF_SND }, // 16 MSM6295 #1 ADPCM data + { "g02.u54", 0x200000, 0x1357d50e, BRF_SND }, // 17 + { "g02.u55", 0x200000, 0x2d102898, BRF_SND }, // 18 MSM6295 #2 ADPCM data + { "g02.u56", 0x200000, 0x9ff50dda, BRF_SND }, // 19 +}; + + +STD_ROM_PICK(pwrinst2j) +STD_ROM_FN(pwrinst2j) + +static struct BurnRomInfo plegendsRomDesc[] = { + { "d12.u45", 0x080000, 0xed8a2e3d, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "d13.u44", 0x080000, 0x25821731, BRF_ESS | BRF_PRG }, // 1 + { "d14.u2", 0x080000, 0xc2cb1402, BRF_ESS | BRF_PRG }, // 2 + { "d16.u3", 0x080000, 0x50a1c63e, BRF_ESS | BRF_PRG }, // 3 + { "d15.u4", 0x080000, 0x6352cec0, BRF_ESS | BRF_PRG }, // 4 + { "d17.u5", 0x080000, 0x7af810d8, BRF_ESS | BRF_PRG }, // 5 + + { "d19.u3", 0x040000, 0x47598459, BRF_ESS | BRF_PRG }, // 6 Z80 Code + + { "g02.u61", 0x200000, 0x91e30398, BRF_GRA }, // 7 Sprite data + { "g02.u62", 0x200000, 0xd9455dd7, BRF_GRA }, // 8 + { "g02.u63", 0x200000, 0x4d20560b, BRF_GRA }, // 9 + { "g02.u64", 0x200000, 0xb17b9b6e, BRF_GRA }, // 10 + { "g02.u65", 0x200000, 0x08541878, BRF_GRA }, // 11 + { "g02.u66", 0x200000, 0xbecf2a36, BRF_GRA }, // 12 + { "atgs.u1", 0x200000, 0xaa6f34a9, BRF_GRA }, // 13 + { "atgs.u2", 0x200000, 0x553eda27, BRF_GRA }, // 14 + + { "atgs.u78", 0x200000, 0x16710ecb, BRF_GRA }, // 15 Layer 0 Tile data + { "atgs.u81", 0x200000, 0xcb2aca91, BRF_GRA }, // 16 Layer 1 Tile data + { "atgs.u89", 0x200000, 0x65f45a0f, BRF_GRA }, // 17 Layer 2 Tile data + { "text.u82", 0x080000, 0xf57333ea, BRF_GRA }, // 18 Layer 3 Tile data + + { "g02.u53", 0x200000, 0xc4bdd9e0, BRF_SND }, // 19 MSM6295 #1 ADPCM data + { "g02.u54", 0x200000, 0x1357d50e, BRF_SND }, // 20 + { "g02.u55", 0x200000, 0x2d102898, BRF_SND }, // 21 MSM6295 #2 ADPCM data + { "g02.u56", 0x200000, 0x9ff50dda, BRF_SND }, // 22 +}; + + +STD_ROM_PICK(plegends) +STD_ROM_FN(plegends) + +static struct BurnRomInfo plegendsjRomDesc[] = { + { "prog.u45", 0x080000, 0x94f53db2, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "prog.u44", 0x080000, 0xdb0ad756, BRF_ESS | BRF_PRG }, // 1 + { "pr12.u2", 0x080000, 0x0e202559, BRF_ESS | BRF_PRG }, // 2 + { "pr12.u3", 0x080000, 0x54742f21, BRF_ESS | BRF_PRG }, // 3 + { "d15.u4", 0x080000, 0x6352cec0, BRF_ESS | BRF_PRG }, // 4 + { "d17.u5", 0x080000, 0x7af810d8, BRF_ESS | BRF_PRG }, // 5 + + { "sound.u3", 0x020000, 0x36f71520, BRF_ESS | BRF_PRG }, // 6 Z80 Code + + { "g02.u61", 0x200000, 0x91e30398, BRF_GRA }, // 7 Sprite data + { "g02.u62", 0x200000, 0xd9455dd7, BRF_GRA }, // 8 + { "g02.u63", 0x200000, 0x4d20560b, BRF_GRA }, // 9 + { "g02.u64", 0x200000, 0xb17b9b6e, BRF_GRA }, // 10 + { "g02.u65", 0x200000, 0x08541878, BRF_GRA }, // 11 + { "g02.u66", 0x200000, 0xbecf2a36, BRF_GRA }, // 12 + { "atgs.u1", 0x200000, 0xaa6f34a9, BRF_GRA }, // 13 + { "atgs.u2", 0x200000, 0x553eda27, BRF_GRA }, // 14 + + { "atgs.u78", 0x200000, 0x16710ecb, BRF_GRA }, // 15 Layer 0 Tile data + { "atgs.u81", 0x200000, 0xcb2aca91, BRF_GRA }, // 16 Layer 1 Tile data + { "atgs.u89", 0x200000, 0x65f45a0f, BRF_GRA }, // 17 Layer 2 Tile data + { "text.u82", 0x080000, 0xf57333ea, BRF_GRA }, // 18 Layer 3 Tile data + + { "g02.u53", 0x200000, 0xc4bdd9e0, BRF_SND }, // 19 MSM6295 #1 ADPCM data + { "g02.u54", 0x200000, 0x1357d50e, BRF_SND }, // 20 + { "g02.u55", 0x200000, 0x2d102898, BRF_SND }, // 21 MSM6295 #2 ADPCM data + { "g02.u56", 0x200000, 0x9ff50dda, BRF_SND }, // 22 +}; + + +STD_ROM_PICK(plegendsj) +STD_ROM_FN(plegendsj) + +struct BurnDriver BurnDrvPwrinst2 = { + "pwrinst2", NULL, NULL, NULL, "1994", + "Power Instinct 2 (USA, ver. 94/04/08)\0", "Bad Music from first MSM6295", "Atlus", "Cave", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, FBF_PWRINST, + NULL, pwrinst2RomInfo, pwrinst2RomName, NULL, NULL, pwrinst2InputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPwrinst2j = { + "pwrinst2j", "pwrinst2", NULL, NULL, "1994", + "Gouketsuji Ichizoku 2 (Japan, ver. 94/04/08)\0", NULL, "Atlus", "Cave", + L"\u8C6A\u8840\u5BFA\u4E00\u65CF \uFF12 (Japan, ver. 94/04/08)\0Gouketsuji Ichizoku 2\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, FBF_PWRINST, + NULL, pwrinst2jRomInfo, pwrinst2jRomName, NULL, NULL, pwrinst2InputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPlegends = { + "plegends", NULL, NULL, NULL, "1995", + "Gouketsuji Gaiden Legends (USA, ver. 95/06/20)\0", NULL, "Atlus / KM International", "Cave", + L"\u8C6A\u8840\u5BFA\u5916\u4F1D Gogetsuji Legends (USA, ver. 95/06/20)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, FBF_PWRINST, + NULL, plegendsRomInfo, plegendsRomName, NULL, NULL, pwrinst2InputInfo, NULL, + PlegendsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPlegendsj = { + "plegendsj", "plegends", NULL, NULL, "1995", + "Gouketsuji Gaiden Saikyou Densetsu (Japan, ver. 95/06/20)\0", NULL, "Atlus", "Cave", + L"\u8C6A\u8840\u5BFA\u5916\u4F1D Gogetsuji \u6700\u5F37\u4F1D\u8AAC (Japan, ver. 95/06/20)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VSFIGHT, FBF_PWRINST, + NULL, plegendsjRomInfo, plegendsjRomName, NULL, NULL, pwrinst2InputInfo, NULL, + PlegendsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; diff --git a/src/burn/drv/cave/d_sailormn.cpp b/src/burn/drv/cave/d_sailormn.cpp index 6d2f2feb7..2be22c3ca 100644 --- a/src/burn/drv/cave/d_sailormn.cpp +++ b/src/burn/drv/cave/d_sailormn.cpp @@ -1,1678 +1,1677 @@ -// Pretty Soldier Sailor Moon & Air Gallet -#include "cave.h" -#include "msm6295.h" -#include "burn_ym2151.h" - -#include "bitswap.h" - -#define CAVE_VBLANK_LINES (271.5 - 240) -// #define CAVE_VBLANK_LINES (12) - -static UINT8 DrvJoy1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT16 DrvInput[2] = {0x0000, 0x0000}; - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01, *Rom02, *RomZ80; -static UINT8 *Ram01, *Ram02, *Ram03, *RamZ80; -static UINT8 *DefEEPROM; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static INT8 nVBlank; - -static INT32 nCurrentBank; - -static INT32 SoundLatch; -static INT32 SoundLatchReply[48]; -static INT32 SoundLatchStatus; - -static INT32 SoundLatchReplyIndex; -static INT32 SoundLatchReplyMax; - -static INT8 nVideoIRQ; -static INT8 nSoundIRQ; -static INT8 nUnknownIRQ; - -static INT32 nCaveCyclesDone[2]; - -INT32 nWhichGame; // 0 - sailormn/sailormno - // 1 - agallet - -static struct BurnInputInfo sailormnInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 9, "diag"}, - {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service"}, -}; - -STDINPUTINFO(sailormn) - -static void UpdateIRQStatus() -{ - INT32 nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0); - SekSetIRQLine(1, nIRQPending ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE); -} - -static void drvZ80Bankswitch(INT32 nBank) -{ - nBank &= 0x1F; - if (nBank != nCurrentBank) { - UINT8* nStartAddress = RomZ80 + (nBank << 14); - ZetMapArea(0x4000, 0x7FFF, 0, nStartAddress); - ZetMapArea(0x4000, 0x7FFF, 2, nStartAddress); - nCurrentBank = nBank; - } -} - -static void drvYM2151IRQHandler(INT32 nStatus) -{ - if (nStatus) { -// ZetRaiseIrq(255); -// nCaveCyclesDone[1] += ZetRun(0x0400); - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -UINT8 __fastcall sailormnZIn(UINT16 nAddress) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x20: { -// bprintf(PRINT_NORMAL, "Z80 read thingie.\n"); -// int nStatus = SoundLatchStatus; -// SoundLatchStatus &= ~2; -// return nStatus; - - return 0; - } - - case 0x30: -// bprintf(PRINT_NORMAL, "Z80 read soundlatch(lo)\n"); - SoundLatchStatus |= 0x04; - return SoundLatch & 0xFF; - - case 0x40: -// bprintf(PRINT_NORMAL, "Z80 read soundlatch(hi)\n"); - SoundLatchStatus |= 0x08; - return SoundLatch >> 8; - - case 0x51: -// bprintf(PRINT_NORMAL, "YM2151 status read.\n"); - return BurnYM2151ReadStatus(); - case 0x60: -// bprintf(PRINT_NORMAL, "MSM6295 #0 status read.\n"); - return MSM6295ReadStatus(0); - case 0x80: -// bprintf(PRINT_NORMAL, "MSM6295 #1 status read.\n"); - return MSM6295ReadStatus(1); - } - - return 0; -} - -void __fastcall sailormnZOut(UINT16 nAddress, UINT8 nValue) -{ - nAddress &= 0xFF; - - switch (nAddress) { - - case 0x00: - drvZ80Bankswitch(nValue); - break; - - case 0x10: -// SoundLatchStatus |= 0x02; -// SoundLatchReply = nValue; - if (SoundLatchReplyIndex > SoundLatchReplyMax) { - SoundLatchReplyMax = -1; - SoundLatchReplyIndex = 0; - } - SoundLatchReplyMax++; - SoundLatchReply[SoundLatchReplyMax] = nValue; - break; - - case 0x50: - BurnYM2151SelectRegister(nValue); - break; - case 0x51: -// bprintf(PRINT_NORMAL, "YM2151 reg %02X -> %02X\n", CaveCurrentYM2151Register, nValue); - BurnYM2151WriteRegister(nValue); - break; - - case 0x60: -// bprintf(PRINT_NORMAL, "MSM6295 #0 command sent.\n"); - MSM6295Command(0, nValue); - break; - case 0x70: - MSM6295SampleInfo[0][0] = MSM6295ROM + ((nValue & 0x0F) << 17); - MSM6295SampleInfo[0][1] = MSM6295ROM + ((nValue & 0x0F) << 17) + 0x0100; - MSM6295SampleInfo[0][2] = MSM6295ROM + ((nValue & 0x0F) << 17) + 0x0200; - MSM6295SampleInfo[0][3] = MSM6295ROM + ((nValue & 0x0F) << 17) + 0x0300; - MSM6295SampleData[0][0] = MSM6295ROM + ((nValue & 0x0F) << 17); - MSM6295SampleData[0][1] = MSM6295ROM + ((nValue & 0x0F) << 17) + 0x010000; - MSM6295SampleData[0][2] = MSM6295ROM + ((nValue & 0xF0) << 13); - MSM6295SampleData[0][3] = MSM6295ROM + ((nValue & 0xF0) << 13) + 0x010000; - break; - - case 0x80: -// bprintf(PRINT_NORMAL, "MSM6295 #1 command sent.\n"); - MSM6295Command(1, nValue); - break; - case 0xC0: - MSM6295SampleInfo[1][0] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17); - MSM6295SampleInfo[1][1] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17) + 0x0100; - MSM6295SampleInfo[1][2] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17) + 0x0200; - MSM6295SampleInfo[1][3] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17) + 0x0300; - MSM6295SampleData[1][0] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17); - MSM6295SampleData[1][1] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17) + 0x010000; - MSM6295SampleData[1][2] = MSM6295ROM + 0x0200000 + ((nValue & 0xF0) << 13); - MSM6295SampleData[1][3] = MSM6295ROM + 0x0200000 + ((nValue & 0xF0) << 13) + 0x010000; - break; - } -} - -static INT32 drvZInit() -{ - ZetInit(0); - ZetOpen(0); - - ZetSetInHandler(sailormnZIn); - ZetSetOutHandler(sailormnZOut); - - // ROM bank 1 - ZetMapArea (0x0000, 0x3FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM - ZetMapArea (0x0000, 0x3FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM - // ROM bank 2 - ZetMapArea (0x4000, 0x7FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM - ZetMapArea (0x4000, 0x7FFF, 2, RomZ80 + 0x0000); // - // RAM - ZetMapArea (0xC000, 0xDFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0xC000, 0xDFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0xC000, 0xDFFF, 2, RamZ80); // - // RAM mirror - ZetMapArea (0xE000, 0xFFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0xE000, 0xFFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0xE000, 0xFFFF, 2, RamZ80); // - - ZetMemEnd(); - ZetClose(); - - return 0; -} - -UINT8 __fastcall sailormnReadByte(UINT32 sekAddress) -{ -// bprintf(PRINT_NORMAL, "Attempt to read byte value of location %x\n", sekAddress); - - switch (sekAddress) { - case 0xB80000: - case 0xB80001: { - UINT8 nRet = ((nVBlank ^ 1) << 2) | (nUnknownIRQ << 1) | nVideoIRQ; - return nRet; - } - case 0xB80002: - case 0xB80003: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - return nRet; - } - case 0xB80004: - case 0xB80005: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nVideoIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - case 0xB80006: - case 0xB80007: { - UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nUnknownIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - - case 0x600000: - return (DrvInput[0] >> 8) ^ 0xFF; - case 0x600001: - return (DrvInput[0] & 0xFF) ^ 0xFF; - case 0x600002: - return ((DrvInput[1] >> 8) ^ 0xF7) | (EEPROMRead() << 3); - case 0x600003: - return (DrvInput[1] & 0xFF) ^ 0xFF; - -#if 0 - case 0xB8006C: - case 0xB8006D: - bprintf(PRINT_NORMAL, "Soundlatch status read (byte).\n"); -// return SoundLatchStatus & 3; - return 0; - case 0xB8006E: - case 0xB8006F: - bprintf(PRINT_NORMAL, "Sound latch read (byte).\n"); -// SoundLatchStatus = 2; -// return SoundLatchReply; - return 0; -#endif - - default: { -// bprintf(PRINT_NORMAL, "Attempt to read byte value of location %x\n", sekAddress); - } - } - return 0; -} - -UINT16 __fastcall sailormnReadWord(UINT32 sekAddress) -{ -// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); - - switch (sekAddress) { - case 0xB80000: { - UINT16 nRet = ((nVBlank ^ 1) << 2) | (nUnknownIRQ << 1) | nVideoIRQ; - return nRet; - } - case 0xB80002: { - UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - return nRet; - } - case 0xB80004: { - UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nVideoIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - case 0xB80006: { - UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; - nUnknownIRQ = 1; - UpdateIRQStatus(); - return nRet; - } - - case 0xB8006C: -// SoundLatchStatus &= ~4; -// return SoundLatchStatus & 3; - - if (SoundLatchReplyIndex > SoundLatchReplyMax) { - return 2; - } - return 0; - - case 0xB8006E: -// bprintf(PRINT_NORMAL, "Sound latch read.\n"); -// SoundLatchStatus = 2; -// return SoundLatchReply; - - if (SoundLatchReplyIndex > SoundLatchReplyMax) { - SoundLatchReplyIndex = 0; - SoundLatchReplyMax = -1; - return 0; - } -// bprintf(PRINT_NORMAL, "Sound latch reply read (%02X).\n", SoundLatchReply[SoundLatchReplyIndex]); - return SoundLatchReply[SoundLatchReplyIndex++]; - - case 0x600000: - return DrvInput[0] ^ 0xFFFF; - case 0x600002: - return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11); - - default: { -// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); - } - } - return 0; -} - -void __fastcall sailormnWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ -// bprintf(PRINT_NORMAL, "Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - - switch (sekAddress) { -// case 0xB8006E: -// SoundLatch &= 0xFF00; -// SoundLatch |= byteValue << 8; -// break; -// case 0xB8006F: -// SoundLatch &= 0x00FF; -// SoundLatch |= byteValue; -// break; - - case 0x700000: - nCaveTileBank = byteValue & 1; - EEPROMWrite(byteValue & 0x04, byteValue & 0x02, byteValue & 0x08); - return; - - default: { -// bprintf(PRINT_NORMAL, "Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } - } -} - -void __fastcall sailormnWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ -// bprintf(PRINT_NORMAL, "Attempt to write word value %x to location %x\n", wordValue, sekAddress); - - switch (sekAddress) { - case 0xA00000: - CaveTileReg[0][0] = wordValue; - return; - case 0xA00002: - CaveTileReg[0][1] = wordValue; - return; - case 0xA00004: - CaveTileReg[0][2] = wordValue; - return; - - case 0xA80000: - CaveTileReg[1][0] = wordValue; - return; - case 0xA80002: - CaveTileReg[1][1] = wordValue; - return; - case 0xA80004: - CaveTileReg[1][2] = wordValue; - return; - - case 0xB00000: - CaveTileReg[2][0] = wordValue; - return; - case 0xB00002: - CaveTileReg[2][1] = wordValue; - return; - case 0xB00004: - CaveTileReg[2][2] = wordValue; - return; - - case 0xB80000: - nCaveXOffset = wordValue; - return; - case 0xB80002: - nCaveYOffset = wordValue; - return; - case 0xB80008: - CaveSpriteBuffer(); - nCaveSpriteBank = wordValue; - return; - - case 0xB8006E: -// bprintf(PRINT_NORMAL, "Sound command sent: %04X\n", wordValue); - - SoundLatch = wordValue; - SoundLatchStatus |= 0x0C; - - ZetNmi(); - nCaveCyclesDone[1] += ZetRun(0x0400); - return; - - case 0x700000: - wordValue >>= 8; - nCaveTileBank = wordValue & 1; - EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); - return; - - default: { -// bprintf(PRINT_NORMAL, "Attempt to write word value %x to location %x\n", wordValue, sekAddress); - - } - } -} - -void __fastcall sailormnWriteBytePalette(UINT32 sekAddress, UINT8 byteValue) -{ - CavePalWriteByte(sekAddress & 0xFFFF, byteValue); -} - -void __fastcall sailormnWriteWordPalette(UINT32 sekAddress, UINT16 wordValue) -{ - CavePalWriteWord(sekAddress & 0xFFFF, wordValue); -} - -static INT32 DrvExit() -{ - EEPROMExit(); - - MSM6295Exit(0); - MSM6295Exit(1); - BurnYM2151Exit(); - - CaveTileExit(); - CaveSpriteExit(); - CavePalExit(); - - ZetExit(); - - SekExit(); // Deallocate 68000s - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - nCurrentBank = -1; - - ZetOpen(0); - drvZ80Bankswitch(0); - ZetReset(); - ZetClose(); - - EEPROMReset(); - - nVideoIRQ = 1; - nSoundIRQ = 1; - nUnknownIRQ = 1; - - SoundLatch = 0; - SoundLatchStatus = 0x0C; - - memset(SoundLatchReply, 0, sizeof(SoundLatchReply)); - SoundLatchReplyIndex = 0; - SoundLatchReplyMax = -1; - - nCaveCyclesDone[0] = nCaveCyclesDone[1] = 0; - - MSM6295Reset(0); - MSM6295Reset(1); - BurnYM2151Reset(); - - return 0; -} - -static INT32 DrvDraw() -{ - if (CaveRecalcPalette) { - CavePalUpdate8Bit(0x4400, 12); - CaveRecalcPalette = 1; - } - CavePalUpdate4Bit(0, 64); - - CaveClearScreen(CavePalette[nWhichGame ? 0x3F00 : 0x5FF0]); - - if (bDrawScreen) { -// CaveGetBitmap(); - -#if 0 - CaveTileRender(1); -#else - if (nWhichGame) { - // Air Gallet always enables row-scroll and row-select for 16x16 layers, but always without effect - // So, force tile drawing routines to ignore row-scroll and row-select - CaveTileRender(0); - } else { - CaveTileRender(1); - } -#endif - } - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nCyclesVBlank; - INT32 nInterleave = 4; - - INT32 nCyclesTotal[2]; - - INT32 nCyclesSegment; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x0000; // Player 1 - DrvInput[1] = 0x0000; // Player 2 - for (INT32 i = 0; i < 10; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - } - CaveClearOpposites(&DrvInput[0]); - CaveClearOpposites(&DrvInput[1]); - - SekNewFrame(); - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); - nCaveCyclesDone[0] = 0; -#if 0 - nCyclesTotal[1] = (INT32)((INT64)8000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); -#else - nCyclesTotal[1] = (INT32)(8000000 / CAVE_REFRESHRATE); -#endif - nCaveCyclesDone[1] -= nCyclesTotal[1]; - if (nCaveCyclesDone[1] < 0) { - nCaveCyclesDone[1] = 0; - } - - nCyclesVBlank = nCyclesTotal[0] - (INT32)((nCyclesTotal[0] * CAVE_VBLANK_LINES) / 271.5); - nVBlank = 0; - - INT32 nSoundBufferPos = 0; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU; - INT32 nNext; - - // Run 68000 - - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - - // Trigger VBlank interrupt - if (!nVBlank && nNext > nCyclesVBlank) { - if (nCaveCyclesDone[nCurrentCPU] < nCyclesVBlank) { - nCyclesSegment = nCyclesVBlank - nCaveCyclesDone[nCurrentCPU]; - nCaveCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } - - if (pBurnDraw != NULL) { - DrvDraw(); // Draw screen if needed - } - -// CaveSpriteBuffer(); - - nVBlank = 1; - nVideoIRQ = 0; - UpdateIRQStatus(); - } - - nCyclesSegment = nNext - nCaveCyclesDone[nCurrentCPU]; - if (nVBlank || (!CheckSleep(nCurrentCPU))) { // See if this CPU is busywaiting - nCaveCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCaveCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - - // Run Z80 - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCaveCyclesDone[nCurrentCPU]; - nCaveCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - - { - // Render sound segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - } - - SekClose(); - - { - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - } - } - } - - ZetClose(); - - return 0; -} - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8* Next; Next = Mem; - Rom01 = Next; Next += 0x080000; // 68K program - Rom02 = Next; Next += 0x200000; - RomZ80 = Next; Next += 0x080000; - CaveSpriteROM = Next; Next += 0x800000; - CaveTileROM[0] = Next; Next += 0x400000; // Tile layer 0 - CaveTileROM[1] = Next; Next += 0x400000; // Tile layer 1 - if (nWhichGame) { - CaveTileROM[2] = Next; Next += 0x400000; // Tile layer 2 (agallet) - } else { - CaveTileROM[2] = Next; Next += 0x01400000; // Tile layer 2 (Sailor Moon) - } - MSM6295ROM = Next; Next += 0x400000; // MSM6295 ADPCM data - DefEEPROM = Next; Next += 0x000080; - RamStart = Next; - Ram01 = Next; Next += 0x010002; // CPU #0 work RAM - Ram02 = Next; Next += 0x008000; // - Ram03 = Next; Next += 0x004002; // - RamZ80 = Next; Next += 0x002000; - CaveTileRAM[0] = Next; Next += 0x008000; - CaveTileRAM[1] = Next; Next += 0x008000; - CaveTileRAM[2] = Next; Next += 0x008002; - CaveSpriteRAM = Next; Next += 0x010002; - CavePalSrc = Next; Next += 0x010000; // palette - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static void sailormnDecodeSprites(UINT8* pData, INT32 nLen) -{ - UINT8* pOrg = pData + nLen - 1; - UINT8* pDest = pData + ((nLen - 1) << 1); - - for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { - pDest[0] = *pOrg & 15; - pDest[1] = *pOrg >> 4; - } - - return; -} - -static void sailormnDecodeTiles(UINT8* pData, INT32 nLen) -{ - UINT8* pOrg = pData + nLen - 1; - UINT8* pDest = pData + ((nLen - 1) << 1); - - for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { - pDest[1] = *pOrg & 15; - pDest[0] = *pOrg >> 4; - } - - return; -} - -static INT32 sailormnLoadRoms() -{ - UINT8* pTemp; - - // Load 68000 ROM - BurnLoadRom(Rom01, 0, 1); - BurnLoadRom(Rom02, 1, 1); - - // Load Z80 ROM - BurnLoadRom(RomZ80, 2, 1); - - pTemp = (UINT8*)BurnMalloc(0x400000); - BurnLoadRom(pTemp + 0x000000, 3, 1); - BurnLoadRom(pTemp + 0x200000, 4, 1); - for (INT32 i = 0; i < 0x400000; i++) { - CaveSpriteROM[i ^ 0x950C4] = pTemp[BITSWAP24(i, 23, 22, 21, 20, 15, 10, 12, 6, 11, 1, 13, 3, 16, 17, 2, 5, 14, 7, 18, 8, 4, 19, 9, 0)]; - } - BurnFree(pTemp); - sailormnDecodeSprites(CaveSpriteROM, 0x400000); - - BurnLoadRom(CaveTileROM[0], 5, 1); - sailormnDecodeTiles(CaveTileROM[0], 0x200000); - BurnLoadRom(CaveTileROM[1], 6, 1); - sailormnDecodeTiles(CaveTileROM[1], 0x200000); - BurnLoadRom(CaveTileROM[2] + 0x000000, 7, 1); - BurnLoadRom(CaveTileROM[2] + 0x200000, 8, 1); - BurnLoadRom(CaveTileROM[2] + 0x400000, 9, 1); - BurnLoadRom(CaveTileROM[2] + 0x600000, 10, 1); - BurnLoadRom(CaveTileROM[2] + 0x800000, 11, 1); - sailormnDecodeTiles(CaveTileROM[2], 0xA00000); - - pTemp = (UINT8*)BurnMalloc(0x600000); - BurnLoadRom(pTemp + 0x000000, 12, 1); - BurnLoadRom(pTemp + 0x200000, 13, 1); - BurnLoadRom(pTemp + 0x400000, 14, 1); - for (INT32 i = 0; i < 0x500000; i++) { - CaveTileROM[2][(i << 2) + 0] |= (pTemp[i] & 0x03) << 4; - CaveTileROM[2][(i << 2) + 1] |= (pTemp[i] & 0x0C) << 2; - CaveTileROM[2][(i << 2) + 2] |= (pTemp[i] & 0x30); - CaveTileROM[2][(i << 2) + 3] |= (pTemp[i] & 0xC0) >> 2; - } - BurnFree(pTemp); - - // Load OKIM6295 data - BurnLoadRom(MSM6295ROM + 0x0000000, 15, 1); - BurnLoadRom(MSM6295ROM + 0x0200000, 16, 1); - BurnLoadRom(MSM6295ROM + 0x0280000, 16, 1); - BurnLoadRom(MSM6295ROM + 0x0300000, 16, 1); - BurnLoadRom(MSM6295ROM + 0x0380000, 16, 1); - - BurnLoadRom(DefEEPROM, 17, 1); - - return 0; -} - -static INT32 agalletLoadRoms() -{ - // Load 68000 ROM - BurnLoadRom(Rom01, 0, 1); - - // Load Z80 ROM - BurnLoadRom(RomZ80, 1, 1); - - BurnLoadRom(CaveSpriteROM + 0x000000, 2, 1); - BurnLoadRom(CaveSpriteROM + 0x200000, 3, 1); - sailormnDecodeSprites(CaveSpriteROM, 0x400000); - - BurnLoadRom(CaveTileROM[0], 4, 1); - sailormnDecodeTiles(CaveTileROM[0], 0x200000); - BurnLoadRom(CaveTileROM[1], 5, 1); - sailormnDecodeTiles(CaveTileROM[1], 0x200000); - BurnLoadRom(CaveTileROM[2], 6, 1); - sailormnDecodeTiles(CaveTileROM[2], 0x200000); - - UINT8* pTemp = (UINT8*)BurnMalloc(0x200000); - BurnLoadRom(pTemp, 7, 1); - for (INT32 i = 0; i < 0x0100000; i++) { - CaveTileROM[2][(i << 2) + 0] |= (pTemp[i] & 0x03) << 4; - CaveTileROM[2][(i << 2) + 1] |= (pTemp[i] & 0x0C) << 2; - CaveTileROM[2][(i << 2) + 2] |= (pTemp[i] & 0x30); - CaveTileROM[2][(i << 2) + 3] |= (pTemp[i] & 0xC0) >> 2; - } - BurnFree(pTemp); - - // Load OKIM6295 data - BurnLoadRom(MSM6295ROM + 0x0000000, 8, 1); - BurnLoadRom(MSM6295ROM + 0x0200000, 9, 1); - - BurnLoadRom(DefEEPROM, 10, 1); - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029719; - } - - EEPROMScan(nAction, pnMin); // Scan EEPROM - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); // scan 68000 - ZetScan(nAction); // scan Z80 - - SCAN_VAR(SoundLatch); - SCAN_VAR(SoundLatchStatus); - SCAN_VAR(SoundLatchReply); - SCAN_VAR(SoundLatchReplyIndex); - SCAN_VAR(SoundLatchReplyMax); - - SCAN_VAR(nCurrentBank); - - MSM6295Scan(0, nAction); - MSM6295Scan(1, nAction); - BurnYM2151Scan(nAction); - - SCAN_VAR(nVideoIRQ); - SCAN_VAR(nSoundIRQ); - SCAN_VAR(nUnknownIRQ); - SCAN_VAR(nVBlank); - - CaveScanGraphics(); - - SCAN_VAR(DrvInput); - - if (nAction & ACB_WRITE) { - INT32 nBank = nCurrentBank; - nCurrentBank = -1; - ZetOpen(0); - drvZ80Bankswitch(nBank); - ZetClose(); - - CaveRecalcPalette = 1; - } - } - - return 0; -} - -static INT32 gameInit() -{ - INT32 nLen; - - BurnSetRefreshRate(CAVE_REFRESHRATE); - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - if (nWhichGame) { - // Load the roms into memory - if (agalletLoadRoms()) { - return 1; - } - } else { - // Load the roms into memory - if (sailormnLoadRoms()) { - return 1; - } - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x100000, 0x110001, SM_RAM); // ram (Air Gallet tests too far) - SekMapMemory(Rom02, 0x200000, 0x3FFFFF, SM_ROM); - SekMapMemory(Ram02, 0x400000, 0x407FFF, SM_RAM); - SekMapMemory(Ram03, 0x40C000, 0x410001, SM_RAM); // RAM (Air Gallet tests too far) - SekMapMemory(CaveSpriteRAM, 0x500000, 0x510001, SM_RAM); // Sprite RAM (Air Gallet tests too far) - SekMapMemory(CaveTileRAM[0], 0x800000, 0x807FFF, SM_RAM); - SekMapMemory(CaveTileRAM[1], 0x880000, 0x887FFF, SM_RAM); - SekMapMemory(CaveTileRAM[2], 0x900000, 0x908001, SM_RAM); // Air Gallet tests too far - - SekMapMemory(CavePalSrc, 0x408000, 0x4087FF, SM_RAM); // Palette RAM - SekMapMemory(CavePalSrc + 0x8800, 0x408800, 0x40BFFF, SM_ROM); // Palette RAM (write goes through handler) - SekMapHandler(1, 0x408800, 0x40BFFF, SM_WRITE); // - - SekSetReadWordHandler(0, sailormnReadWord); - SekSetReadByteHandler(0, sailormnReadByte); - SekSetWriteWordHandler(0, sailormnWriteWord); - SekSetWriteByteHandler(0, sailormnWriteByte); - - SekSetWriteWordHandler(1, sailormnWriteWordPalette); - SekSetWriteByteHandler(1, sailormnWriteBytePalette); - - SekClose(); - } - - drvZInit(); - - nCaveExtraXOffset = -1; - nCaveRowModeOffset = 2; - - CavePalInit(0x8000); - CaveTileInit(); - if (nWhichGame) { - CaveSpriteInit(1, 0x0800000); - } else { - CaveSpriteInit(2, 0x0800000); - } - CaveTileInitLayer(0, 0x400000, 4, 0x4400); - CaveTileInitLayer(1, 0x400000, 4, 0x4800); - if (nWhichGame) { - CaveTileInitLayer(2, 0x400000, 6, 0x4C00); - } else { - CaveTileInitLayer(2, 0x01400000, 6, 0x4C00); - } - - BurnYM2151Init(32000000 / 8); - BurnYM2151SetIrqHandler(&drvYM2151IRQHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.30, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.30, BURN_SND_ROUTE_RIGHT); - - MSM6295Init(0, 16000, 1); - MSM6295Init(1, 16000, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - - EEPROMInit(&eeprom_interface_93C46); - if (!EEPROMAvailable()) EEPROMFill(DefEEPROM,0, 0x80); - - bDrawScreen = true; - - DrvDoReset(); - - return 0; -} - -static INT32 sailormnInit() -{ - nWhichGame = 0; - return gameInit(); -} - -static INT32 agalletInit() -{ - nWhichGame = 1; - return gameInit(); -} - -// Rom information - -static struct BurnRomInfo sailormnRomDesc[] = { - { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_europe.nv", 0x0080, 0x59a7dc50, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormn) -STD_ROM_FN(sailormn) - -static struct BurnRomInfo sailormnuRomDesc[] = { - { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_usa.nv", 0x0080, 0x3915abe3, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormnu) -STD_ROM_FN(sailormnu) - -static struct BurnRomInfo sailormnjRomDesc[] = { - { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_japan.nv", 0x0080, 0xea03c30a, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormnj) -STD_ROM_FN(sailormnj) - -static struct BurnRomInfo sailormnkRomDesc[] = { - { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_korea.nv", 0x0080, 0x0e7de398, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormnk) -STD_ROM_FN(sailormnk) - -static struct BurnRomInfo sailormntRomDesc[] = { - { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_taiwan.nv", 0x0080, 0x6c7e8c2a, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormnt) -STD_ROM_FN(sailormnt) - -static struct BurnRomInfo sailormnhRomDesc[] = { - { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_hongkong.nv", 0x0080, 0x4d24c874, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormnh) -STD_ROM_FN(sailormnh) - -static struct BurnRomInfo sailormnoRomDesc[] = { - { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_europe.nv", 0x0080, 0x59a7dc50, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormno) -STD_ROM_FN(sailormno) - -static struct BurnRomInfo sailormnouRomDesc[] = { - { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_usa.nv", 0x0080, 0x3915abe3, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormnou) -STD_ROM_FN(sailormnou) - -static struct BurnRomInfo sailormnojRomDesc[] = { - { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_japan.nv", 0x0080, 0xea03c30a, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormnoj) -STD_ROM_FN(sailormnoj) - -static struct BurnRomInfo sailormnokRomDesc[] = { - { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_korea.nv", 0x0080, 0x0e7de398, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormnok) -STD_ROM_FN(sailormnok) - -static struct BurnRomInfo sailormnotRomDesc[] = { - { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_taiwan.nv", 0x0080, 0x6c7e8c2a, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormnot) -STD_ROM_FN(sailormnot) - -static struct BurnRomInfo sailormnohRomDesc[] = { - { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 - - { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code - - { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data - { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 - - { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data - { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data - - { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data - { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 - { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 - { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 - { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 - - { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 - { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 - { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 - - { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data - { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data - - { "sailormn_hongkong.nv", 0x0080, 0x4d24c874, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(sailormnoh) -STD_ROM_FN(sailormnoh) - -static struct BurnRomInfo agalletRomDesc[] = { - { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code - - { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data - { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 - - { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data - { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data - { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data - { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 - - { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data - { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - - { "agallet_europe.nv", 0x0080, 0xec38bf65, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(agallet) -STD_ROM_FN(agallet) - -static struct BurnRomInfo agalletuRomDesc[] = { - { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code - - { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data - { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 - - { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data - { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data - { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data - { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 - - { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data - { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - - { "agallet_usa.nv", 0x0080, 0x72e65056, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(agalletu) -STD_ROM_FN(agalletu) - -static struct BurnRomInfo agalletjRomDesc[] = { - { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code - - { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data - { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 - - { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data - { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data - { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data - { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 - - { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data - { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - - { "agallet_japan.nv", 0x0080, 0x0753f547, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(agalletj) -STD_ROM_FN(agalletj) - -static struct BurnRomInfo agalletkRomDesc[] = { - { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code - - { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data - { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 - - { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data - { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data - { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data - { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 - - { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data - { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - - { "agallet_korea.nv", 0x0080, 0x7f41c253, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(agalletk) -STD_ROM_FN(agalletk) - -static struct BurnRomInfo agallettRomDesc[] = { - { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code - - { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data - { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 - - { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data - { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data - { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data - { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 - - { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data - { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - - { "agallet_taiwan.nv", 0x0080, 0x0af46742, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(agallett) -STD_ROM_FN(agallett) - -static struct BurnRomInfo agallethRomDesc[] = { - { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code - - { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data - { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 - - { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data - { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data - { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data - { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 - - { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data - { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data - - { "agallet_hongkong.nv", 0x0080, 0x998d1a74, BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(agalleth) -STD_ROM_FN(agalleth) - -struct BurnDriver BurnDrvSailorMoon = { - "sailormn", NULL, NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22B, Europe)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, Europe)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnRomInfo, sailormnRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoonu = { - "sailormnu", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22B, USA)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, USA)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnuRomInfo, sailormnuRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoonj = { - "sailormnj", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22B, Japan)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnjRomInfo, sailormnjRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoonk = { - "sailormnk", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22B, Korea)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, Korea)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnkRomInfo, sailormnkRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoont = { - "sailormnt", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22B, Taiwan)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, Taiwan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormntRomInfo, sailormntRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoonh = { - "sailormnh", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22B, Hong Kong)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, Hong Kong)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnhRomInfo, sailormnhRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoonO = { - "sailormno", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22, Europe)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, Europe)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnoRomInfo, sailormnoRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoonOu = { - "sailormnou", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22, USA)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, USA)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnouRomInfo, sailormnouRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoonOj = { - "sailormnoj", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22, Japan)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnojRomInfo, sailormnojRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoonOk = { - "sailormnok", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22, Korea)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, Korea)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnokRomInfo, sailormnokRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoonOt = { - "sailormnot", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22, Taiwan)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, Taiwan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnotRomInfo, sailormnotRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSailorMoonOh = { - "sailormnoh", "sailormn", NULL, NULL,"1995", - "Pretty Soldier Sailor Moon (ver. 95/03/22, Hong Kong)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, Hong Kong)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, - NULL, sailormnohRomInfo, sailormnohRomName, NULL, NULL, sailormnInputInfo, NULL, - sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvAirGallet = { - "agallet", NULL, NULL, NULL,"1996", - "Air Gallet (Europe)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (Europe)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, - NULL, agalletRomInfo, agalletRomName, NULL, NULL, sailormnInputInfo, NULL, - agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvAirGalletu = { - "agalletu", "agallet", NULL, NULL,"1996", - "Air Gallet (USA)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (USA)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, - NULL, agalletuRomInfo, agalletuRomName, NULL, NULL, sailormnInputInfo, NULL, - agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvAirGalletj = { - "agalletj", "agallet", NULL, NULL,"1996", - "Air Gallet (Japan)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, - NULL, agalletjRomInfo, agalletjRomName, NULL, NULL, sailormnInputInfo, NULL, - agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvAirGalletk = { - "agalletk", "agallet", NULL, NULL,"1996", - "Air Gallet (Korea)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (Korea)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, - NULL, agalletkRomInfo, agalletkRomName, NULL, NULL, sailormnInputInfo, NULL, - agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvAirGallett = { - "agallett", "agallet", NULL, NULL,"1996", - "Air Gallet (Taiwan)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (Taiwan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, - NULL, agallettRomInfo, agallettRomName, NULL, NULL, sailormnInputInfo, NULL, - agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvAirGalleth = { - "agalleth", "agallet", NULL, NULL,"1996", - "Air Gallet (Hong Kong)\0", NULL, "BanPresto / Gazelle", "Cave", - L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (Hong Kong)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, - NULL, agallethRomInfo, agallethRomName, NULL, NULL, sailormnInputInfo, NULL, - agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 -}; +// Pretty Soldier Sailor Moon & Air Gallet +#include "cave.h" +#include "msm6295.h" +#include "burn_ym2151.h" + +#include "bitswap.h" + +#define CAVE_VBLANK_LINES (271.5 - 240) +// #define CAVE_VBLANK_LINES (12) + +static UINT8 DrvJoy1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT16 DrvInput[2] = {0x0000, 0x0000}; + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01, *Rom02, *RomZ80; +static UINT8 *Ram01, *Ram02, *Ram03, *RamZ80; +static UINT8 *DefEEPROM; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static INT8 nVBlank; + +static INT32 nCurrentBank; + +static INT32 SoundLatch; +static INT32 SoundLatchReply[48]; +static INT32 SoundLatchStatus; + +static INT32 SoundLatchReplyIndex; +static INT32 SoundLatchReplyMax; + +static INT8 nVideoIRQ; +static INT8 nSoundIRQ; +static INT8 nUnknownIRQ; + +static INT32 nCaveCyclesDone[2]; + +INT32 nWhichGame; // 0 - sailormn/sailormno + // 1 - agallet + +static struct BurnInputInfo sailormnInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 9, "diag"}, + {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service"}, +}; + +STDINPUTINFO(sailormn) + +static void UpdateIRQStatus() +{ + INT32 nIRQPending = (nVideoIRQ == 0 || nSoundIRQ == 0 || nUnknownIRQ == 0); + SekSetIRQLine(1, nIRQPending ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE); +} + +static void drvZ80Bankswitch(INT32 nBank) +{ + nBank &= 0x1F; + if (nBank != nCurrentBank) { + UINT8* nStartAddress = RomZ80 + (nBank << 14); + ZetMapArea(0x4000, 0x7FFF, 0, nStartAddress); + ZetMapArea(0x4000, 0x7FFF, 2, nStartAddress); + nCurrentBank = nBank; + } +} + +static void drvYM2151IRQHandler(INT32 nStatus) +{ + if (nStatus) { +// ZetRaiseIrq(255); +// nCaveCyclesDone[1] += ZetRun(0x0400); + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +UINT8 __fastcall sailormnZIn(UINT16 nAddress) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x20: { +// bprintf(PRINT_NORMAL, "Z80 read thingie.\n"); +// int nStatus = SoundLatchStatus; +// SoundLatchStatus &= ~2; +// return nStatus; + + return 0; + } + + case 0x30: +// bprintf(PRINT_NORMAL, "Z80 read soundlatch(lo)\n"); + SoundLatchStatus |= 0x04; + return SoundLatch & 0xFF; + + case 0x40: +// bprintf(PRINT_NORMAL, "Z80 read soundlatch(hi)\n"); + SoundLatchStatus |= 0x08; + return SoundLatch >> 8; + + case 0x51: +// bprintf(PRINT_NORMAL, "YM2151 status read.\n"); + return BurnYM2151ReadStatus(); + case 0x60: +// bprintf(PRINT_NORMAL, "MSM6295 #0 status read.\n"); + return MSM6295ReadStatus(0); + case 0x80: +// bprintf(PRINT_NORMAL, "MSM6295 #1 status read.\n"); + return MSM6295ReadStatus(1); + } + + return 0; +} + +void __fastcall sailormnZOut(UINT16 nAddress, UINT8 nValue) +{ + nAddress &= 0xFF; + + switch (nAddress) { + + case 0x00: + drvZ80Bankswitch(nValue); + break; + + case 0x10: +// SoundLatchStatus |= 0x02; +// SoundLatchReply = nValue; + if (SoundLatchReplyIndex > SoundLatchReplyMax) { + SoundLatchReplyMax = -1; + SoundLatchReplyIndex = 0; + } + SoundLatchReplyMax++; + SoundLatchReply[SoundLatchReplyMax] = nValue; + break; + + case 0x50: + BurnYM2151SelectRegister(nValue); + break; + case 0x51: +// bprintf(PRINT_NORMAL, "YM2151 reg %02X -> %02X\n", CaveCurrentYM2151Register, nValue); + BurnYM2151WriteRegister(nValue); + break; + + case 0x60: +// bprintf(PRINT_NORMAL, "MSM6295 #0 command sent.\n"); + MSM6295Command(0, nValue); + break; + case 0x70: + MSM6295SampleInfo[0][0] = MSM6295ROM + ((nValue & 0x0F) << 17); + MSM6295SampleInfo[0][1] = MSM6295ROM + ((nValue & 0x0F) << 17) + 0x0100; + MSM6295SampleInfo[0][2] = MSM6295ROM + ((nValue & 0x0F) << 17) + 0x0200; + MSM6295SampleInfo[0][3] = MSM6295ROM + ((nValue & 0x0F) << 17) + 0x0300; + MSM6295SampleData[0][0] = MSM6295ROM + ((nValue & 0x0F) << 17); + MSM6295SampleData[0][1] = MSM6295ROM + ((nValue & 0x0F) << 17) + 0x010000; + MSM6295SampleData[0][2] = MSM6295ROM + ((nValue & 0xF0) << 13); + MSM6295SampleData[0][3] = MSM6295ROM + ((nValue & 0xF0) << 13) + 0x010000; + break; + + case 0x80: +// bprintf(PRINT_NORMAL, "MSM6295 #1 command sent.\n"); + MSM6295Command(1, nValue); + break; + case 0xC0: + MSM6295SampleInfo[1][0] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17); + MSM6295SampleInfo[1][1] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17) + 0x0100; + MSM6295SampleInfo[1][2] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17) + 0x0200; + MSM6295SampleInfo[1][3] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17) + 0x0300; + MSM6295SampleData[1][0] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17); + MSM6295SampleData[1][1] = MSM6295ROM + 0x0200000 + ((nValue & 0x0F) << 17) + 0x010000; + MSM6295SampleData[1][2] = MSM6295ROM + 0x0200000 + ((nValue & 0xF0) << 13); + MSM6295SampleData[1][3] = MSM6295ROM + 0x0200000 + ((nValue & 0xF0) << 13) + 0x010000; + break; + } +} + +static INT32 drvZInit() +{ + ZetInit(0); + ZetOpen(0); + + ZetSetInHandler(sailormnZIn); + ZetSetOutHandler(sailormnZOut); + + // ROM bank 1 + ZetMapArea (0x0000, 0x3FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM + ZetMapArea (0x0000, 0x3FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM + // ROM bank 2 + ZetMapArea (0x4000, 0x7FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM + ZetMapArea (0x4000, 0x7FFF, 2, RomZ80 + 0x0000); // + // RAM + ZetMapArea (0xC000, 0xDFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0xC000, 0xDFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0xC000, 0xDFFF, 2, RamZ80); // + // RAM mirror + ZetMapArea (0xE000, 0xFFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0xE000, 0xFFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0xE000, 0xFFFF, 2, RamZ80); // + + ZetClose(); + + return 0; +} + +UINT8 __fastcall sailormnReadByte(UINT32 sekAddress) +{ +// bprintf(PRINT_NORMAL, "Attempt to read byte value of location %x\n", sekAddress); + + switch (sekAddress) { + case 0xB80000: + case 0xB80001: { + UINT8 nRet = ((nVBlank ^ 1) << 2) | (nUnknownIRQ << 1) | nVideoIRQ; + return nRet; + } + case 0xB80002: + case 0xB80003: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + return nRet; + } + case 0xB80004: + case 0xB80005: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nVideoIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + case 0xB80006: + case 0xB80007: { + UINT8 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nUnknownIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + + case 0x600000: + return (DrvInput[0] >> 8) ^ 0xFF; + case 0x600001: + return (DrvInput[0] & 0xFF) ^ 0xFF; + case 0x600002: + return ((DrvInput[1] >> 8) ^ 0xF7) | (EEPROMRead() << 3); + case 0x600003: + return (DrvInput[1] & 0xFF) ^ 0xFF; + +#if 0 + case 0xB8006C: + case 0xB8006D: + bprintf(PRINT_NORMAL, "Soundlatch status read (byte).\n"); +// return SoundLatchStatus & 3; + return 0; + case 0xB8006E: + case 0xB8006F: + bprintf(PRINT_NORMAL, "Sound latch read (byte).\n"); +// SoundLatchStatus = 2; +// return SoundLatchReply; + return 0; +#endif + + default: { +// bprintf(PRINT_NORMAL, "Attempt to read byte value of location %x\n", sekAddress); + } + } + return 0; +} + +UINT16 __fastcall sailormnReadWord(UINT32 sekAddress) +{ +// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); + + switch (sekAddress) { + case 0xB80000: { + UINT16 nRet = ((nVBlank ^ 1) << 2) | (nUnknownIRQ << 1) | nVideoIRQ; + return nRet; + } + case 0xB80002: { + UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + return nRet; + } + case 0xB80004: { + UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nVideoIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + case 0xB80006: { + UINT16 nRet = (nUnknownIRQ << 1) | nVideoIRQ; + nUnknownIRQ = 1; + UpdateIRQStatus(); + return nRet; + } + + case 0xB8006C: +// SoundLatchStatus &= ~4; +// return SoundLatchStatus & 3; + + if (SoundLatchReplyIndex > SoundLatchReplyMax) { + return 2; + } + return 0; + + case 0xB8006E: +// bprintf(PRINT_NORMAL, "Sound latch read.\n"); +// SoundLatchStatus = 2; +// return SoundLatchReply; + + if (SoundLatchReplyIndex > SoundLatchReplyMax) { + SoundLatchReplyIndex = 0; + SoundLatchReplyMax = -1; + return 0; + } +// bprintf(PRINT_NORMAL, "Sound latch reply read (%02X).\n", SoundLatchReply[SoundLatchReplyIndex]); + return SoundLatchReply[SoundLatchReplyIndex++]; + + case 0x600000: + return DrvInput[0] ^ 0xFFFF; + case 0x600002: + return (DrvInput[1] ^ 0xF7FF) | (EEPROMRead() << 11); + + default: { +// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); + } + } + return 0; +} + +void __fastcall sailormnWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ +// bprintf(PRINT_NORMAL, "Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + + switch (sekAddress) { +// case 0xB8006E: +// SoundLatch &= 0xFF00; +// SoundLatch |= byteValue << 8; +// break; +// case 0xB8006F: +// SoundLatch &= 0x00FF; +// SoundLatch |= byteValue; +// break; + + case 0x700000: + nCaveTileBank = byteValue & 1; + EEPROMWrite(byteValue & 0x04, byteValue & 0x02, byteValue & 0x08); + return; + + default: { +// bprintf(PRINT_NORMAL, "Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } + } +} + +void __fastcall sailormnWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ +// bprintf(PRINT_NORMAL, "Attempt to write word value %x to location %x\n", wordValue, sekAddress); + + switch (sekAddress) { + case 0xA00000: + CaveTileReg[0][0] = wordValue; + return; + case 0xA00002: + CaveTileReg[0][1] = wordValue; + return; + case 0xA00004: + CaveTileReg[0][2] = wordValue; + return; + + case 0xA80000: + CaveTileReg[1][0] = wordValue; + return; + case 0xA80002: + CaveTileReg[1][1] = wordValue; + return; + case 0xA80004: + CaveTileReg[1][2] = wordValue; + return; + + case 0xB00000: + CaveTileReg[2][0] = wordValue; + return; + case 0xB00002: + CaveTileReg[2][1] = wordValue; + return; + case 0xB00004: + CaveTileReg[2][2] = wordValue; + return; + + case 0xB80000: + nCaveXOffset = wordValue; + return; + case 0xB80002: + nCaveYOffset = wordValue; + return; + case 0xB80008: + CaveSpriteBuffer(); + nCaveSpriteBank = wordValue; + return; + + case 0xB8006E: +// bprintf(PRINT_NORMAL, "Sound command sent: %04X\n", wordValue); + + SoundLatch = wordValue; + SoundLatchStatus |= 0x0C; + + ZetNmi(); + nCaveCyclesDone[1] += ZetRun(0x0400); + return; + + case 0x700000: + wordValue >>= 8; + nCaveTileBank = wordValue & 1; + EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); + return; + + default: { +// bprintf(PRINT_NORMAL, "Attempt to write word value %x to location %x\n", wordValue, sekAddress); + + } + } +} + +void __fastcall sailormnWriteBytePalette(UINT32 sekAddress, UINT8 byteValue) +{ + CavePalWriteByte(sekAddress & 0xFFFF, byteValue); +} + +void __fastcall sailormnWriteWordPalette(UINT32 sekAddress, UINT16 wordValue) +{ + CavePalWriteWord(sekAddress & 0xFFFF, wordValue); +} + +static INT32 DrvExit() +{ + EEPROMExit(); + + MSM6295Exit(0); + MSM6295Exit(1); + BurnYM2151Exit(); + + CaveTileExit(); + CaveSpriteExit(); + CavePalExit(); + + ZetExit(); + + SekExit(); // Deallocate 68000s + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + nCurrentBank = -1; + + ZetOpen(0); + drvZ80Bankswitch(0); + ZetReset(); + ZetClose(); + + EEPROMReset(); + + nVideoIRQ = 1; + nSoundIRQ = 1; + nUnknownIRQ = 1; + + SoundLatch = 0; + SoundLatchStatus = 0x0C; + + memset(SoundLatchReply, 0, sizeof(SoundLatchReply)); + SoundLatchReplyIndex = 0; + SoundLatchReplyMax = -1; + + nCaveCyclesDone[0] = nCaveCyclesDone[1] = 0; + + MSM6295Reset(0); + MSM6295Reset(1); + BurnYM2151Reset(); + + return 0; +} + +static INT32 DrvDraw() +{ + if (CaveRecalcPalette) { + CavePalUpdate8Bit(0x4400, 12); + CaveRecalcPalette = 1; + } + CavePalUpdate4Bit(0, 64); + + CaveClearScreen(CavePalette[nWhichGame ? 0x3F00 : 0x5FF0]); + + if (bDrawScreen) { +// CaveGetBitmap(); + +#if 0 + CaveTileRender(1); +#else + if (nWhichGame) { + // Air Gallet always enables row-scroll and row-select for 16x16 layers, but always without effect + // So, force tile drawing routines to ignore row-scroll and row-select + CaveTileRender(0); + } else { + CaveTileRender(1); + } +#endif + } + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nCyclesVBlank; + INT32 nInterleave = 4; + + INT32 nCyclesTotal[2]; + + INT32 nCyclesSegment; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x0000; // Player 1 + DrvInput[1] = 0x0000; // Player 2 + for (INT32 i = 0; i < 10; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + } + CaveClearOpposites(&DrvInput[0]); + CaveClearOpposites(&DrvInput[1]); + + SekNewFrame(); + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); + nCaveCyclesDone[0] = 0; +#if 0 + nCyclesTotal[1] = (INT32)((INT64)8000000 * nBurnCPUSpeedAdjust / (0x0100 * CAVE_REFRESHRATE)); +#else + nCyclesTotal[1] = (INT32)(8000000 / CAVE_REFRESHRATE); +#endif + nCaveCyclesDone[1] -= nCyclesTotal[1]; + if (nCaveCyclesDone[1] < 0) { + nCaveCyclesDone[1] = 0; + } + + nCyclesVBlank = nCyclesTotal[0] - (INT32)((nCyclesTotal[0] * CAVE_VBLANK_LINES) / 271.5); + nVBlank = 0; + + INT32 nSoundBufferPos = 0; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU; + INT32 nNext; + + // Run 68000 + + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + + // Trigger VBlank interrupt + if (!nVBlank && nNext > nCyclesVBlank) { + if (nCaveCyclesDone[nCurrentCPU] < nCyclesVBlank) { + nCyclesSegment = nCyclesVBlank - nCaveCyclesDone[nCurrentCPU]; + nCaveCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } + + if (pBurnDraw != NULL) { + DrvDraw(); // Draw screen if needed + } + +// CaveSpriteBuffer(); + + nVBlank = 1; + nVideoIRQ = 0; + UpdateIRQStatus(); + } + + nCyclesSegment = nNext - nCaveCyclesDone[nCurrentCPU]; + if (nVBlank || (!CheckSleep(nCurrentCPU))) { // See if this CPU is busywaiting + nCaveCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCaveCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + + // Run Z80 + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCaveCyclesDone[nCurrentCPU]; + nCaveCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + + { + // Render sound segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + MSM6295Render(1, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + } + + SekClose(); + + { + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + MSM6295Render(1, pSoundBuf, nSegmentLength); + } + } + } + + ZetClose(); + + return 0; +} + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8* Next; Next = Mem; + Rom01 = Next; Next += 0x080000; // 68K program + Rom02 = Next; Next += 0x200000; + RomZ80 = Next; Next += 0x080000; + CaveSpriteROM = Next; Next += 0x800000; + CaveTileROM[0] = Next; Next += 0x400000; // Tile layer 0 + CaveTileROM[1] = Next; Next += 0x400000; // Tile layer 1 + if (nWhichGame) { + CaveTileROM[2] = Next; Next += 0x400000; // Tile layer 2 (agallet) + } else { + CaveTileROM[2] = Next; Next += 0x01400000; // Tile layer 2 (Sailor Moon) + } + MSM6295ROM = Next; Next += 0x400000; // MSM6295 ADPCM data + DefEEPROM = Next; Next += 0x000080; + RamStart = Next; + Ram01 = Next; Next += 0x010002; // CPU #0 work RAM + Ram02 = Next; Next += 0x008000; // + Ram03 = Next; Next += 0x004002; // + RamZ80 = Next; Next += 0x002000; + CaveTileRAM[0] = Next; Next += 0x008000; + CaveTileRAM[1] = Next; Next += 0x008000; + CaveTileRAM[2] = Next; Next += 0x008002; + CaveSpriteRAM = Next; Next += 0x010002; + CavePalSrc = Next; Next += 0x010000; // palette + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static void sailormnDecodeSprites(UINT8* pData, INT32 nLen) +{ + UINT8* pOrg = pData + nLen - 1; + UINT8* pDest = pData + ((nLen - 1) << 1); + + for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { + pDest[0] = *pOrg & 15; + pDest[1] = *pOrg >> 4; + } + + return; +} + +static void sailormnDecodeTiles(UINT8* pData, INT32 nLen) +{ + UINT8* pOrg = pData + nLen - 1; + UINT8* pDest = pData + ((nLen - 1) << 1); + + for (INT32 i = 0; i < nLen; i++, pOrg--, pDest -= 2) { + pDest[1] = *pOrg & 15; + pDest[0] = *pOrg >> 4; + } + + return; +} + +static INT32 sailormnLoadRoms() +{ + UINT8* pTemp; + + // Load 68000 ROM + BurnLoadRom(Rom01, 0, 1); + BurnLoadRom(Rom02, 1, 1); + + // Load Z80 ROM + BurnLoadRom(RomZ80, 2, 1); + + pTemp = (UINT8*)BurnMalloc(0x400000); + BurnLoadRom(pTemp + 0x000000, 3, 1); + BurnLoadRom(pTemp + 0x200000, 4, 1); + for (INT32 i = 0; i < 0x400000; i++) { + CaveSpriteROM[i ^ 0x950C4] = pTemp[BITSWAP24(i, 23, 22, 21, 20, 15, 10, 12, 6, 11, 1, 13, 3, 16, 17, 2, 5, 14, 7, 18, 8, 4, 19, 9, 0)]; + } + BurnFree(pTemp); + sailormnDecodeSprites(CaveSpriteROM, 0x400000); + + BurnLoadRom(CaveTileROM[0], 5, 1); + sailormnDecodeTiles(CaveTileROM[0], 0x200000); + BurnLoadRom(CaveTileROM[1], 6, 1); + sailormnDecodeTiles(CaveTileROM[1], 0x200000); + BurnLoadRom(CaveTileROM[2] + 0x000000, 7, 1); + BurnLoadRom(CaveTileROM[2] + 0x200000, 8, 1); + BurnLoadRom(CaveTileROM[2] + 0x400000, 9, 1); + BurnLoadRom(CaveTileROM[2] + 0x600000, 10, 1); + BurnLoadRom(CaveTileROM[2] + 0x800000, 11, 1); + sailormnDecodeTiles(CaveTileROM[2], 0xA00000); + + pTemp = (UINT8*)BurnMalloc(0x600000); + BurnLoadRom(pTemp + 0x000000, 12, 1); + BurnLoadRom(pTemp + 0x200000, 13, 1); + BurnLoadRom(pTemp + 0x400000, 14, 1); + for (INT32 i = 0; i < 0x500000; i++) { + CaveTileROM[2][(i << 2) + 0] |= (pTemp[i] & 0x03) << 4; + CaveTileROM[2][(i << 2) + 1] |= (pTemp[i] & 0x0C) << 2; + CaveTileROM[2][(i << 2) + 2] |= (pTemp[i] & 0x30); + CaveTileROM[2][(i << 2) + 3] |= (pTemp[i] & 0xC0) >> 2; + } + BurnFree(pTemp); + + // Load OKIM6295 data + BurnLoadRom(MSM6295ROM + 0x0000000, 15, 1); + BurnLoadRom(MSM6295ROM + 0x0200000, 16, 1); + BurnLoadRom(MSM6295ROM + 0x0280000, 16, 1); + BurnLoadRom(MSM6295ROM + 0x0300000, 16, 1); + BurnLoadRom(MSM6295ROM + 0x0380000, 16, 1); + + BurnLoadRom(DefEEPROM, 17, 1); + + return 0; +} + +static INT32 agalletLoadRoms() +{ + // Load 68000 ROM + BurnLoadRom(Rom01, 0, 1); + + // Load Z80 ROM + BurnLoadRom(RomZ80, 1, 1); + + BurnLoadRom(CaveSpriteROM + 0x000000, 2, 1); + BurnLoadRom(CaveSpriteROM + 0x200000, 3, 1); + sailormnDecodeSprites(CaveSpriteROM, 0x400000); + + BurnLoadRom(CaveTileROM[0], 4, 1); + sailormnDecodeTiles(CaveTileROM[0], 0x200000); + BurnLoadRom(CaveTileROM[1], 5, 1); + sailormnDecodeTiles(CaveTileROM[1], 0x200000); + BurnLoadRom(CaveTileROM[2], 6, 1); + sailormnDecodeTiles(CaveTileROM[2], 0x200000); + + UINT8* pTemp = (UINT8*)BurnMalloc(0x200000); + BurnLoadRom(pTemp, 7, 1); + for (INT32 i = 0; i < 0x0100000; i++) { + CaveTileROM[2][(i << 2) + 0] |= (pTemp[i] & 0x03) << 4; + CaveTileROM[2][(i << 2) + 1] |= (pTemp[i] & 0x0C) << 2; + CaveTileROM[2][(i << 2) + 2] |= (pTemp[i] & 0x30); + CaveTileROM[2][(i << 2) + 3] |= (pTemp[i] & 0xC0) >> 2; + } + BurnFree(pTemp); + + // Load OKIM6295 data + BurnLoadRom(MSM6295ROM + 0x0000000, 8, 1); + BurnLoadRom(MSM6295ROM + 0x0200000, 9, 1); + + BurnLoadRom(DefEEPROM, 10, 1); + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029719; + } + + EEPROMScan(nAction, pnMin); // Scan EEPROM + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); // scan 68000 + ZetScan(nAction); // scan Z80 + + SCAN_VAR(SoundLatch); + SCAN_VAR(SoundLatchStatus); + SCAN_VAR(SoundLatchReply); + SCAN_VAR(SoundLatchReplyIndex); + SCAN_VAR(SoundLatchReplyMax); + + SCAN_VAR(nCurrentBank); + + MSM6295Scan(0, nAction); + MSM6295Scan(1, nAction); + BurnYM2151Scan(nAction); + + SCAN_VAR(nVideoIRQ); + SCAN_VAR(nSoundIRQ); + SCAN_VAR(nUnknownIRQ); + SCAN_VAR(nVBlank); + + CaveScanGraphics(); + + SCAN_VAR(DrvInput); + + if (nAction & ACB_WRITE) { + INT32 nBank = nCurrentBank; + nCurrentBank = -1; + ZetOpen(0); + drvZ80Bankswitch(nBank); + ZetClose(); + + CaveRecalcPalette = 1; + } + } + + return 0; +} + +static INT32 gameInit() +{ + INT32 nLen; + + BurnSetRefreshRate(CAVE_REFRESHRATE); + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + if (nWhichGame) { + // Load the roms into memory + if (agalletLoadRoms()) { + return 1; + } + } else { + // Load the roms into memory + if (sailormnLoadRoms()) { + return 1; + } + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x100000, 0x110001, SM_RAM); // ram (Air Gallet tests too far) + SekMapMemory(Rom02, 0x200000, 0x3FFFFF, SM_ROM); + SekMapMemory(Ram02, 0x400000, 0x407FFF, SM_RAM); + SekMapMemory(Ram03, 0x40C000, 0x410001, SM_RAM); // RAM (Air Gallet tests too far) + SekMapMemory(CaveSpriteRAM, 0x500000, 0x510001, SM_RAM); // Sprite RAM (Air Gallet tests too far) + SekMapMemory(CaveTileRAM[0], 0x800000, 0x807FFF, SM_RAM); + SekMapMemory(CaveTileRAM[1], 0x880000, 0x887FFF, SM_RAM); + SekMapMemory(CaveTileRAM[2], 0x900000, 0x908001, SM_RAM); // Air Gallet tests too far + + SekMapMemory(CavePalSrc, 0x408000, 0x4087FF, SM_RAM); // Palette RAM + SekMapMemory(CavePalSrc + 0x8800, 0x408800, 0x40BFFF, SM_ROM); // Palette RAM (write goes through handler) + SekMapHandler(1, 0x408800, 0x40BFFF, SM_WRITE); // + + SekSetReadWordHandler(0, sailormnReadWord); + SekSetReadByteHandler(0, sailormnReadByte); + SekSetWriteWordHandler(0, sailormnWriteWord); + SekSetWriteByteHandler(0, sailormnWriteByte); + + SekSetWriteWordHandler(1, sailormnWriteWordPalette); + SekSetWriteByteHandler(1, sailormnWriteBytePalette); + + SekClose(); + } + + drvZInit(); + + nCaveExtraXOffset = -1; + nCaveRowModeOffset = 2; + + CavePalInit(0x8000); + CaveTileInit(); + if (nWhichGame) { + CaveSpriteInit(1, 0x0800000); + } else { + CaveSpriteInit(2, 0x0800000); + } + CaveTileInitLayer(0, 0x400000, 4, 0x4400); + CaveTileInitLayer(1, 0x400000, 4, 0x4800); + if (nWhichGame) { + CaveTileInitLayer(2, 0x400000, 6, 0x4C00); + } else { + CaveTileInitLayer(2, 0x01400000, 6, 0x4C00); + } + + BurnYM2151Init(32000000 / 8); + BurnYM2151SetIrqHandler(&drvYM2151IRQHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.30, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.30, BURN_SND_ROUTE_RIGHT); + + MSM6295Init(0, 16000, 1); + MSM6295Init(1, 16000, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + + EEPROMInit(&eeprom_interface_93C46); + if (!EEPROMAvailable()) EEPROMFill(DefEEPROM,0, 0x80); + + bDrawScreen = true; + + DrvDoReset(); + + return 0; +} + +static INT32 sailormnInit() +{ + nWhichGame = 0; + return gameInit(); +} + +static INT32 agalletInit() +{ + nWhichGame = 1; + return gameInit(); +} + +// Rom information + +static struct BurnRomInfo sailormnRomDesc[] = { + { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_europe.nv", 0x0080, 0x59a7dc50, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormn) +STD_ROM_FN(sailormn) + +static struct BurnRomInfo sailormnuRomDesc[] = { + { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_usa.nv", 0x0080, 0x3915abe3, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormnu) +STD_ROM_FN(sailormnu) + +static struct BurnRomInfo sailormnjRomDesc[] = { + { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_japan.nv", 0x0080, 0xea03c30a, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormnj) +STD_ROM_FN(sailormnj) + +static struct BurnRomInfo sailormnkRomDesc[] = { + { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_korea.nv", 0x0080, 0x0e7de398, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormnk) +STD_ROM_FN(sailormnk) + +static struct BurnRomInfo sailormntRomDesc[] = { + { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_taiwan.nv", 0x0080, 0x6c7e8c2a, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormnt) +STD_ROM_FN(sailormnt) + +static struct BurnRomInfo sailormnhRomDesc[] = { + { "bpsm945a.u45", 0x080000, 0x898C9515, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_hongkong.nv", 0x0080, 0x4d24c874, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormnh) +STD_ROM_FN(sailormnh) + +static struct BurnRomInfo sailormnoRomDesc[] = { + { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_europe.nv", 0x0080, 0x59a7dc50, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormno) +STD_ROM_FN(sailormno) + +static struct BurnRomInfo sailormnouRomDesc[] = { + { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_usa.nv", 0x0080, 0x3915abe3, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormnou) +STD_ROM_FN(sailormnou) + +static struct BurnRomInfo sailormnojRomDesc[] = { + { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_japan.nv", 0x0080, 0xea03c30a, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormnoj) +STD_ROM_FN(sailormnoj) + +static struct BurnRomInfo sailormnokRomDesc[] = { + { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_korea.nv", 0x0080, 0x0e7de398, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormnok) +STD_ROM_FN(sailormnok) + +static struct BurnRomInfo sailormnotRomDesc[] = { + { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_taiwan.nv", 0x0080, 0x6c7e8c2a, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormnot) +STD_ROM_FN(sailormnot) + +static struct BurnRomInfo sailormnohRomDesc[] = { + { "smprg.u45", 0x080000, 0x234F1152, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bpsm.u46", 0x200000, 0x32084E80, BRF_ESS | BRF_PRG }, // 1 + + { "bpsm945a.u9", 0x080000, 0x438DE548, BRF_ESS | BRF_PRG }, // 2 Z80 code + + { "bpsm.u76", 0x200000, 0xA243A5BA, BRF_GRA }, // 3 Sprite data + { "bpsm.u77", 0x200000, 0x5179A4AC, BRF_GRA }, // 4 + + { "bpsm.u53", 0x200000, 0xB9B15F83, BRF_GRA }, // 5 Layer 0 Tile data + { "bpsm.u54", 0x200000, 0x8F00679D, BRF_GRA }, // 6 Layer 1 Tile data + + { "bpsm.u57", 0x200000, 0x86BE7B63, BRF_GRA }, // 7 Layer 2 Tile data + { "bpsm.u58", 0x200000, 0xE0BBA83B, BRF_GRA }, // 8 + { "bpsm.u62", 0x200000, 0xA1E3BFAC, BRF_GRA }, // 9 + { "bpsm.u61", 0x200000, 0x6A014B52, BRF_GRA }, // 10 + { "bpsm.u60", 0x200000, 0x992468C0, BRF_GRA }, // 11 + + { "bpsm.u65", 0x200000, 0xF60FB7B5, BRF_GRA }, // 12 + { "bpsm.u64", 0x200000, 0x6559D31C, BRF_GRA }, // 13 + { "bpsm.u63", 0x200000, 0xD57A56B4, BRF_GRA }, // 14 + + { "bpsm.u48", 0x200000, 0x498E4ED1, BRF_SND }, // 15 MSM6295 #0 ADPCM data + { "bpsm.u47", 0x080000, 0x0F2901B9, BRF_SND }, // 16 MSM6295 #1 ADPCM data + + { "sailormn_hongkong.nv", 0x0080, 0x4d24c874, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(sailormnoh) +STD_ROM_FN(sailormnoh) + +static struct BurnRomInfo agalletRomDesc[] = { + { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code + + { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data + { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 + + { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data + { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data + { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data + { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 + + { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data + { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data + + { "agallet_europe.nv", 0x0080, 0xec38bf65, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(agallet) +STD_ROM_FN(agallet) + +static struct BurnRomInfo agalletuRomDesc[] = { + { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code + + { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data + { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 + + { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data + { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data + { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data + { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 + + { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data + { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data + + { "agallet_usa.nv", 0x0080, 0x72e65056, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(agalletu) +STD_ROM_FN(agalletu) + +static struct BurnRomInfo agalletjRomDesc[] = { + { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code + + { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data + { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 + + { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data + { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data + { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data + { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 + + { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data + { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data + + { "agallet_japan.nv", 0x0080, 0x0753f547, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(agalletj) +STD_ROM_FN(agalletj) + +static struct BurnRomInfo agalletkRomDesc[] = { + { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code + + { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data + { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 + + { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data + { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data + { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data + { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 + + { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data + { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data + + { "agallet_korea.nv", 0x0080, 0x7f41c253, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(agalletk) +STD_ROM_FN(agalletk) + +static struct BurnRomInfo agallettRomDesc[] = { + { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code + + { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data + { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 + + { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data + { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data + { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data + { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 + + { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data + { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data + + { "agallet_taiwan.nv", 0x0080, 0x0af46742, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(agallett) +STD_ROM_FN(agallett) + +static struct BurnRomInfo agallethRomDesc[] = { + { "bp962a.u45", 0x080000, 0x24815046, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "bp962a.u9", 0x080000, 0x06CADDBE, BRF_ESS | BRF_PRG }, // 1 Z80 code + + { "bp962a.u76", 0x200000, 0x858DA439, BRF_GRA }, // 2 Sprite data + { "bp962a.u77", 0x200000, 0xEA2BA35E, BRF_GRA }, // 3 + + { "bp962a.u53", 0x200000, 0xFCD9A107, BRF_GRA }, // 4 Layer 0 Tile data + { "bp962a.u54", 0x200000, 0x0CFA3409, BRF_GRA }, // 5 Layer 1 Tile data + { "bp962a.u57", 0x200000, 0x6D608957, BRF_GRA }, // 6 Layer 2 Tile data + { "bp962a.u65", 0x200000, 0x135FCF9A, BRF_GRA }, // 7 + + { "bp962a.u48", 0x200000, 0xAE00A1CE, BRF_SND }, // 8 MSM6295 #0 ADPCM data + { "bp962a.u47", 0x200000, 0x6D4E9737, BRF_SND }, // 9 MSM6295 #1 ADPCM data + + { "agallet_hongkong.nv", 0x0080, 0x998d1a74, BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(agalleth) +STD_ROM_FN(agalleth) + +struct BurnDriver BurnDrvSailorMoon = { + "sailormn", NULL, NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22B, Europe)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, Europe)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnRomInfo, sailormnRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoonu = { + "sailormnu", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22B, USA)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, USA)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnuRomInfo, sailormnuRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoonj = { + "sailormnj", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22B, Japan)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnjRomInfo, sailormnjRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoonk = { + "sailormnk", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22B, Korea)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, Korea)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnkRomInfo, sailormnkRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoont = { + "sailormnt", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22B, Taiwan)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, Taiwan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormntRomInfo, sailormntRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoonh = { + "sailormnh", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22B, Hong Kong)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22B, Hong Kong)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnhRomInfo, sailormnhRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoonO = { + "sailormno", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22, Europe)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, Europe)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnoRomInfo, sailormnoRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoonOu = { + "sailormnou", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22, USA)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, USA)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnouRomInfo, sailormnouRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoonOj = { + "sailormnoj", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22, Japan)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnojRomInfo, sailormnojRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoonOk = { + "sailormnok", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22, Korea)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, Korea)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnokRomInfo, sailormnokRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoonOt = { + "sailormnot", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22, Taiwan)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, Taiwan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnotRomInfo, sailormnotRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSailorMoonOh = { + "sailormnoh", "sailormn", NULL, NULL,"1995", + "Pretty Soldier Sailor Moon (ver. 95/03/22, Hong Kong)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Pretty Soldier Sailor Moon\0\u7F8E\u5C11\u5973\u6226\u58EB \u30BB\u30FC\u30E9\u30FC\u30E0\u30FC\u30F3 (ver. 95/03/22, Hong Kong)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_SCRFIGHT, 0, + NULL, sailormnohRomInfo, sailormnohRomName, NULL, NULL, sailormnInputInfo, NULL, + sailormnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvAirGallet = { + "agallet", NULL, NULL, NULL,"1996", + "Air Gallet (Europe)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (Europe)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, + NULL, agalletRomInfo, agalletRomName, NULL, NULL, sailormnInputInfo, NULL, + agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvAirGalletu = { + "agalletu", "agallet", NULL, NULL,"1996", + "Air Gallet (USA)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (USA)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, + NULL, agalletuRomInfo, agalletuRomName, NULL, NULL, sailormnInputInfo, NULL, + agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvAirGalletj = { + "agalletj", "agallet", NULL, NULL,"1996", + "Air Gallet (Japan)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, + NULL, agalletjRomInfo, agalletjRomName, NULL, NULL, sailormnInputInfo, NULL, + agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvAirGalletk = { + "agalletk", "agallet", NULL, NULL,"1996", + "Air Gallet (Korea)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (Korea)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, + NULL, agalletkRomInfo, agalletkRomName, NULL, NULL, sailormnInputInfo, NULL, + agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvAirGallett = { + "agallett", "agallet", NULL, NULL,"1996", + "Air Gallet (Taiwan)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (Taiwan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, + NULL, agallettRomInfo, agallettRomName, NULL, NULL, sailormnInputInfo, NULL, + agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvAirGalleth = { + "agalleth", "agallet", NULL, NULL,"1996", + "Air Gallet (Hong Kong)\0", NULL, "BanPresto / Gazelle", "Cave", + L"Air Gallet\0\u30A2\u30EF\u30A6\u30AE\u30E3\u30EC\u30C3\u30C8 (Hong Kong)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_CAVE_68K_Z80, GBF_VERSHOOT, 0, + NULL, agallethRomInfo, agallethRomName, NULL, NULL, sailormnInputInfo, NULL, + agalletInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &CaveRecalcPalette, 0x8000, 240, 320, 3, 4 +}; diff --git a/src/burn/drv/dataeast/d_cninja.cpp b/src/burn/drv/dataeast/d_cninja.cpp index cf705de9a..c947d8516 100644 --- a/src/burn/drv/dataeast/d_cninja.cpp +++ b/src/burn/drv/dataeast/d_cninja.cpp @@ -1,3330 +1,3328 @@ -// FB Alpha Caveman Ninja driver module -// Based on MAME driver by Bryan McPhail - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "h6280_intf.h" -#include "bitswap.h" -#include "deco16ic.h" -#include "burn_ym2203.h" -#include "burn_ym2151.h" -#include "msm6295.h" -#include "timer.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvHucROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvGfxROM4; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *Drv68KRAM; -static UINT8 *DrvHucRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprRAM1; -static UINT8 *DrvSprBuf; -static UINT8 *DrvSprBuf1; -static UINT8 *DrvPrtRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static INT16 *SoundBuffer; - -static UINT8 *soundlatch; -static UINT8 *flipscreen; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[3]; -static UINT8 DrvReset; -static UINT16 DrvInputs[3]; - -static INT32 scanline; -static INT32 irq_mask; -static INT32 irq_timer; - -static INT32 DrvOkiBank; - -static INT32 has_z80 = 0; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 15, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo Robocop2InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 15, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 14, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Robocop2) - -static struct BurnDIPInfo CninjaDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x01, "1" }, - {0x13, 0x01, 0x03, 0x00, "2" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x08, "Easy" }, - {0x13, 0x01, 0x0c, 0x0c, "Normal" }, - {0x13, 0x01, 0x0c, 0x04, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Restore Life Meter" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Cninja) - -static struct BurnDIPInfo CninjauDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Credit(s) to Start" }, - {0x12, 0x01, 0x80, 0x80, "1" }, - {0x12, 0x01, 0x80, 0x00, "2" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x01, "1" }, - {0x13, 0x01, 0x03, 0x00, "2" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x08, "Easy" }, - {0x13, 0x01, 0x0c, 0x0c, "Normal" }, - {0x13, 0x01, 0x0c, 0x04, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Restore Life Meter" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Cninjau) - -static struct BurnDIPInfo MutantfDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Credit(s) to Start" }, - {0x12, 0x01, 0x80, 0x80, "1" }, - {0x12, 0x01, 0x80, 0x00, "2" }, - - {0 , 0xfe, 0 , 4, "Timer Decrement" }, - {0x13, 0x01, 0x03, 0x01, "Slow" }, - {0x13, 0x01, 0x03, 0x03, "Normal" }, - {0x13, 0x01, 0x03, 0x02, "Fast" }, - {0x13, 0x01, 0x03, 0x00, "Very Fast" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x08, "Easy" }, - {0x13, 0x01, 0x0c, 0x0c, "Normal" }, - {0x13, 0x01, 0x0c, 0x04, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Life Per Stage" }, - {0x13, 0x01, 0x30, 0x00, "Least" }, - {0x13, 0x01, 0x30, 0x10, "Little" }, - {0x13, 0x01, 0x30, 0x20, "Less" }, - {0x13, 0x01, 0x30, 0x30, "Normal" }, - - {0 , 0xfe, 0 , 2, "Continues" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Mutantf) - -static struct BurnDIPInfo EdrandyDIPList[]= -{ - {0x12, 0xff, 0xff, 0xbf, NULL }, - {0x13, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x12, 0x01, 0x40, 0x00, "Off" }, - {0x12, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Credit(s) to Start" }, - {0x12, 0x01, 0x80, 0x80, "1" }, - {0x12, 0x01, 0x80, 0x00, "2" }, - - {0 , 0xfe, 0 , 4, "Player's Power" }, - {0x13, 0x01, 0x03, 0x01, "Very Low" }, - {0x13, 0x01, 0x03, 0x00, "Low" }, - {0x13, 0x01, 0x03, 0x03, "Medium" }, - {0x13, 0x01, 0x03, 0x02, "High" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x08, "Easy" }, - {0x13, 0x01, 0x0c, 0x0c, "Normal" }, - {0x13, 0x01, 0x0c, 0x04, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Continues" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Edrandy) - -static struct BurnDIPInfo EdrandcDIPList[]= -{ - {0x12, 0xff, 0xff, 0xbf, NULL }, - {0x13, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x12, 0x01, 0x40, 0x00, "Off" }, - {0x12, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Unknown" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Player's Power" }, - {0x13, 0x01, 0x03, 0x01, "Very Low" }, - {0x13, 0x01, 0x03, 0x00, "Low" }, - {0x13, 0x01, 0x03, 0x03, "Medium" }, - {0x13, 0x01, 0x03, 0x02, "High" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x08, "Easy" }, - {0x13, 0x01, 0x0c, 0x0c, "Normal" }, - {0x13, 0x01, 0x0c, 0x04, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Continues" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Edrandc) - -static struct BurnDIPInfo Robocop2DIPList[]= -{ - {0x14, 0xff, 0xff, 0xbf, NULL }, - {0x15, 0xff, 0xff, 0x7f, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x14, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x14, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x01, "1" }, - {0x15, 0x01, 0x03, 0x00, "2" }, - {0x15, 0x01, 0x03, 0x03, "3" }, - {0x15, 0x01, 0x03, 0x02, "4" }, - - {0 , 0xfe, 0 , 4, "Time" }, - {0x15, 0x01, 0x0c, 0x08, "400 Seconds" }, - {0x15, 0x01, 0x0c, 0x0c, "300 Seconds" }, - {0x15, 0x01, 0x0c, 0x04, "200 Seconds" }, - {0x15, 0x01, 0x0c, 0x00, "100 Seconds" }, - - {0 , 0xfe, 0 , 4, "Health" }, - {0x15, 0x01, 0x30, 0x00, "17" }, - {0x15, 0x01, 0x30, 0x10, "24" }, - {0x15, 0x01, 0x30, 0x30, "33" }, - {0x15, 0x01, 0x30, 0x20, "40" }, - - {0 , 0xfe, 0 , 2, "Continues" }, - {0x15, 0x01, 0x40, 0x00, "Off" }, - {0x15, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Bullets" }, - {0x16, 0x01, 0x03, 0x00, "Least" }, - {0x16, 0x01, 0x03, 0x01, "Less" }, - {0x16, 0x01, 0x03, 0x03, "Normal" }, - {0x16, 0x01, 0x03, 0x02, "More" }, - - {0 , 0xfe, 0 , 4, "Enemy Movement" }, - {0x16, 0x01, 0x0c, 0x08, "Slow" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Fast" }, - {0x16, 0x01, 0x0c, 0x00, "Fastest" }, - - {0 , 0xfe, 0 , 4, "Enemy Strength" }, - {0x16, 0x01, 0x30, 0x20, "Less" }, - {0x16, 0x01, 0x30, 0x30, "Normal" }, - {0x16, 0x01, 0x30, 0x10, "More" }, - {0x16, 0x01, 0x30, 0x00, "Most" }, - - {0 , 0xfe, 0 , 2, "Enemy Weapon Speed" }, - {0x16, 0x01, 0x40, 0x40, "Normal" }, - {0x16, 0x01, 0x40, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2, "Game Over Message" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Robocop2) - -void __fastcall cninja_main_write_word(UINT32 address, UINT16 data) -{ - deco16_write_control_word(0, address, 0x140000, data) - deco16_write_control_word(1, address, 0x150000, data) - - switch (address) - { - case 0x190000: - case 0x1a4000: - irq_mask = data & 0xff; - return; - - case 0x190002: - case 0x1a4002: - { - scanline = data & 0xff; - - if ((!BIT(scanline,1)) && (scanline > 0) && (scanline < 240)) { - irq_timer = scanline; - } else { - irq_timer = -1; - } - } - return; - - case 0x1ac000: - case 0x1b4000: - memcpy (DrvSprBuf, DrvSprRAM, 0x800); - return; - - case 0x17ff2a: - case 0x198064: - case 0x1bc0a8: - if (has_z80) { - *soundlatch = data & 0xff; - ZetNmi(); - } else { - deco16_soundlatch = data & 0xff; - h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); - } - break; - } - - if ((address & 0xfffff800) == 0x198000) { - deco16_66_prot_w(address, data, 0xffff); - return; - } - - if ((address & 0xffffff00) == 0x1bc000) { - UINT16 *ProtRam = (UINT16*)deco16_prot_ram; - ProtRam[(address - 0x1bc000) >> 1] = data; - return; - } -} - -void __fastcall cninja_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - // case 0x190000: - case 0x190001: - // case 0x1a4000: - case 0x1a4001: - irq_mask = data & 0xff; - return; - - // case 0x190002: - case 0x190003: - // case 0x1a4002: - case 0x1a4003: - { - scanline = data & 0xff; - if ((~irq_mask & 0x02) && (scanline > 0) && (scanline < 240)) { - irq_timer = scanline; - } else { - irq_timer = -1; - } - } - return; - - // case 0x1ac000: - case 0x1ac001: - // case 0x1b4000: - case 0x1b4001: - memcpy (DrvSprBuf, DrvSprRAM, 0x800); - return; - - case 0x198065: - case 0x1bc0a9: - if (has_z80) { - *soundlatch = data; - ZetNmi(); - } else { - deco16_soundlatch = data; - h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); - } - break; - } - - if ((address & 0xfffff800) == 0x198000) { - deco16_66_prot_w(address, data, 0x00ff << ((address & 1) << 3)); - return; - } - - if ((address & 0xffffff00) == 0x1bc000) { - DrvPrtRAM[(address & 0xff)^1] = data; - - return; - } - - bprintf(PRINT_NORMAL, _T("Write Byte %x, %x\n"), address, data); -} - -UINT16 __fastcall cninja_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x17ff22: - return (DrvDips[1] << 8) | (DrvDips[0] << 0); - - case 0x17ff28: - return (DrvInputs[1] & 0x07) | (deco16_vblank & 0x08); - - case 0x17ff2c: - return DrvInputs[0]; - - case 0x1a4002: - case 0x190002: - return scanline; - - case 0x1a4004: - case 0x190004: - SekSetIRQLine(3, SEK_IRQSTATUS_NONE); - SekSetIRQLine(4, SEK_IRQSTATUS_NONE); - return 0; - } - - if ((address & 0xfffffc00) == 0x1bc000) { - return deco16_104_cninja_prot_r(address); - } - - if ((address & 0xfffff800) == 0x198000) { - return deco16_60_prot_r(address); - } - - bprintf(PRINT_NORMAL, _T("Read Word %x, %x\n"), address); - - return 0; -} - -UINT8 __fastcall cninja_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x17ff22: - return DrvDips[1]; - - case 0x17ff23: - return DrvDips[0]; - - // case 0x17ff28: - case 0x17ff29: - return (DrvInputs[1] & 0x07) | (deco16_vblank & 0x08); - - case 0x17ff2c: - return DrvInputs[0] >> 8; - - case 0x17ff2d: - return DrvInputs[0]; - - // case 0x1a4002: - case 0x1a4003: - // case 0x190002: - case 0x190003: - return scanline; - - // case 0x1a4004: - case 0x1a4005: - // case 0x190004: - case 0x190005: - SekSetIRQLine(3, SEK_IRQSTATUS_NONE); - SekSetIRQLine(4, SEK_IRQSTATUS_NONE); - return 0; - } - - if ((address & 0xfffff800) == 0x198000) { - return deco16_60_prot_r(address) >> ((~address & 1) << 3); - } - - if ((address & 0xfffffc00) == 0x1bc000) { - return deco16_104_cninja_prot_r(address) >> ((~address & 1) << 3); - } - - bprintf(PRINT_NORMAL, _T("Read Byte %x, %x\n"), address); - - return 0; -} - -void __fastcall mutantf_main_write_word(UINT32 address, UINT16 data) -{ - deco16_write_control_word(0, address, 0x300000, data) - deco16_write_control_word(1, address, 0x310000, data) - - switch (address) - { - case 0x180000: - deco16_priority = data; - return; - - case 0x1a0064: - deco16_soundlatch = data & 0xff; - h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); - break; - - case 0x1c0000: - memcpy (DrvSprBuf, DrvSprRAM, 0x800); - return; - - case 0x1e0000: - memcpy (DrvSprBuf1, DrvSprRAM1, 0x800); - return; - } - - if ((address & 0xfffff800) == 0x1a0000) { - deco16_66_prot_w(address, data, 0xffff); - return; - } -} - -void __fastcall mutantf_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x180000: - case 0x180001: - deco16_priority = data; - return; - - case 0x1c0000: - case 0x1c0001: - memcpy (DrvSprBuf, DrvSprRAM, 0x800); - return; - - case 0x1e0000: - case 0x1e0001: - memcpy (DrvSprBuf1, DrvSprRAM1, 0x800); - return; - - case 0x1a0065: - deco16_soundlatch = data; - h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); - break; - } - - if ((address & 0xfffff800) == 0x1a0000) { - deco16_66_prot_w(address, data, 0x00ff << ((address & 1) << 3)); - return; - } -} - -UINT16 __fastcall mutantf_main_read_word(UINT32 address) -{ - if ((address & 0xfffff800) == 0x1a0000) { - return deco16_66_prot_r(address); - } - - return 0; -} - -UINT8 __fastcall mutantf_main_read_byte(UINT32 address) -{ - if (address == 0x1c0001) return deco16ic_71_read() & 0xff; - - if ((address & 0xfffff800) == 0x1a0000) { - return deco16_66_prot_r(address) >> ((~address & 1) << 3); - } - - return 0; -} - -void __fastcall robocop2_main_write_word(UINT32 address, UINT16 data) -{ - deco16_write_control_word(0, address, 0x140000, data) - deco16_write_control_word(1, address, 0x150000, data) - - switch (address) - { - case 0x1b0000: - irq_mask = data & 0xff; - return; - - case 0x1b0002: { - scanline = data & 0xff; - - if ((!BIT(scanline,1)) && (scanline > 0) && (scanline < 240)) { - irq_timer = scanline; - } else { - irq_timer = -1; - } - } - return; - - case 0x198000: - memcpy (DrvSprBuf, DrvSprRAM, 0x800); - return; - - case 0x18c064: - deco16_soundlatch = data & 0xff; - h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); - return;; - - case 0x1f0000: - deco16_priority = data; - return; - } -} - -void __fastcall robocop2_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x1b0000: - case 0x1b0001: - - irq_mask = data & 0xff; - return; - - case 0x1b0002: - case 0x1b0003: { - scanline = data & 0xff; - if ((~irq_mask & 0x02) && (scanline > 0) && (scanline < 240)) { - irq_timer = scanline; - } else { - irq_timer = -1; - } - } - return; - - case 0x198000: - case 0x198001: - memcpy (DrvSprBuf, DrvSprRAM, 0x800); - return; - - case 0x18c065: - deco16_soundlatch = data; - h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); - break; - - case 0x1f0000: - case 0x1f0001: - deco16_priority = data; - return; - } -} - -UINT16 __fastcall robocop2_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x18c41a: - return DrvInputs[0]; - - case 0x18c320: - return (DrvInputs[1] & 0x07) | (deco16_vblank & 0x08); - - case 0x18c4e6: - return (DrvDips[1] << 8) | (DrvDips[0] << 0); - - case 0x18c504: - return 0x0084; - - case 0x1b0002: - return scanline; - - case 0x1b0004: - SekSetIRQLine(3, SEK_IRQSTATUS_NONE); - SekSetIRQLine(4, SEK_IRQSTATUS_NONE); - return 0; - - case 0x1f8000: - return DrvDips[2]; - } - - return 0; -} - -UINT8 __fastcall robocop2_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x18c41a: - return DrvInputs[0] >> 8; - - case 0x18c41b: - return DrvInputs[0] >> 0; - - case 0x18c320: - case 0x18c321: - return (DrvInputs[1] & 0x07) | (deco16_vblank & 0x08); - - case 0x18c4e6: - return DrvDips[0]; - - case 0x18c4e7: - return DrvDips[1]; - - case 0x18c504: - case 0x18c505: - return 0x0084; - - case 0x1b0002: - case 0x1b0003: - return scanline; - - case 0x1b0004: - case 0x1b0005: - SekSetIRQLine(3, SEK_IRQSTATUS_NONE); - SekSetIRQLine(4, SEK_IRQSTATUS_NONE); - return 0; - - case 0x1f8000: - case 0x1f8001: - return DrvDips[2]; - } - - return 0; -} - -void __fastcall stoneage_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8800: - BurnYM2151SelectRegister(data); - return; - - case 0x8801: - BurnYM2151WriteRegister(data); - return; - - case 0x9800: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall stoneage_sound_read(UINT16 address) -{ - switch (address) - { - case 0x8800: - case 0x8801: - return BurnYM2151ReadStatus(); - - case 0x9800: - return MSM6295ReadStatus(0); - - case 0xa000: - ZetSetIRQLine(0x20, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -static void DrvYM2151IrqHandler(INT32 state) -{ - ZetSetIRQLine(0, state ? ZET_IRQSTATUS_ACK : ZET_IRQSTATUS_NONE); -} - -static void DrvYM2151WritePort(UINT32, UINT32 data) -{ - DrvOkiBank = data & 1; - - memcpy (DrvSndROM1, DrvSndROM1 + 0x40000 + (data & 1) * 0x40000, 0x40000); -} - -static INT32 cninja_bank_callback(const INT32 bank) -{ - if ((bank >> 4) & 0xf) return 0x0000; - return 0x1000; -} - -static INT32 mutantf_1_bank_callback(const INT32 bank) -{ - return ((bank >> 4) & 0x3) << 12; -} - -static INT32 mutantf_2_bank_callback(const INT32 bank) -{ - return ((bank >> 5) & 0x1) << 14; -} - -static INT32 robocop2_bank_callback(const INT32 bank) -{ - return (bank & 0x30) << 8; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - if (has_z80) { - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - MSM6295Reset(1); - BurnYM2151Reset(); - } else { - deco16SoundReset(); - } - - DrvYM2151WritePort(0, 0); // set initial oki bank - - deco16Reset(); - - scanline = 0; - irq_mask = 0; - irq_timer = -1; - - return 0; -} - -static void DrvBootlegCharDecode(UINT8 *gfx, INT32 len) -{ - UINT8 *dst = (UINT8*)BurnMalloc(len); - - memcpy (dst, gfx, len); - - for (INT32 r = 0; r < len; r+=4) { - for (INT32 i = 0; i < 8; i++) { - INT32 t0 = (dst[r + 3] >> (7 - (i & 7))) & 1; - INT32 t1 = (dst[r + 1] >> (7 - (i & 7))) & 1; - INT32 t2 = (dst[r + 2] >> (7 - (i & 7))) & 1; - INT32 t3 = (dst[r + 0] >> (7 - (i & 7))) & 1; - - gfx[(r * 2) + i] = (t0 << 3) | (t1 << 2) | (t2 << 1) | (t3 << 0); - } - } - - BurnFree (dst); -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x100000; - DrvZ80ROM = Next; - DrvHucROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x200000; - DrvGfxROM2 = Next; Next += 0x300000; - DrvGfxROM3 = Next; Next += 0xa00000; - DrvGfxROM4 = Next; Next += 0x100000; - - MSM6295ROM = Next; - DrvSndROM0 = Next; Next += 0x100000; - DrvSndROM1 = Next; Next += 0x0c0000; - - DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x008000; - DrvHucRAM = Next; Next += 0x002000; - DrvSprRAM = Next; Next += 0x000800; - DrvSprBuf = Next; Next += 0x000800; - DrvSprRAM1 = Next; Next += 0x000800; - DrvSprBuf1 = Next; Next += 0x000800; - DrvPalRAM = Next; Next += 0x002000; - - deco16_prot_ram = (UINT16*)Next; - DrvPrtRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - - RamEnd = Next; - - SoundBuffer = (INT16*)Next; Next += nBurnSoundLen * 2 * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static void cninja_patch() -{ - UINT16 *rom = (UINT16 *)Drv68KROM; - - for (INT32 i = 0; i < 0x80000 / 2; i++) - { - if (rom[i] == BURN_ENDIAN_SWAP_INT16(0x66ff) || rom[i] == BURN_ENDIAN_SWAP_INT16(0x67ff)) - { - if (rom[i - 4] == BURN_ENDIAN_SWAP_INT16(0x0c39) || rom[i - 4] == BURN_ENDIAN_SWAP_INT16(0x0839)) - { - rom[i - 0] = BURN_ENDIAN_SWAP_INT16(0x4e71); - rom[i - 1] = BURN_ENDIAN_SWAP_INT16(0x4e71); - rom[i - 2] = BURN_ENDIAN_SWAP_INT16(0x4e71); - rom[i - 3] = BURN_ENDIAN_SWAP_INT16(0x4e71); - rom[i - 4] = BURN_ENDIAN_SWAP_INT16(0x4e71); - } - } - } -} - -static INT32 CninjaInit() -{ - BurnSetRefreshRate(58.00); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x80001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x80000, 5, 2)) return 1; - - if (BurnLoadRom(DrvHucROM + 0x00000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00001, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 8, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x80000, 11, 1)) return 1; - - for (INT32 i = 0; i < 0x40000; i++) { - INT32 n = DrvGfxROM2[i + 0x40000]; - DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000]; - DrvGfxROM2[i + 0x80000] = n; - } - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x000001, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x100000, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x100001, 15, 2)) return 1; - - BurnByteswap(DrvGfxROM3, 0x200000); - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 16, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x40000, 17, 1)) return 1; - - deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1); - deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0); - deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0); - - deco16_sprite_decode(DrvGfxROM3, 0x200000); // 16x16 - - cninja_patch(); - } - - deco16Init(0, 1, 1); - deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2); - deco16_set_global_offsets(0, 8); - - deco16_set_color_base(2, 0x200 + 0x000); - deco16_set_color_base(3, 0x200 + 0x300); - deco16_set_bank_callback(2, cninja_bank_callback); - deco16_set_bank_callback(3, cninja_bank_callback); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0bffff, SM_ROM); - SekMapMemory(deco16_pf_ram[0], 0x144000, 0x144fff, SM_RAM); - SekMapMemory(deco16_pf_ram[1], 0x146000, 0x146fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[0], 0x14c000, 0x14c7ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[1], 0x14e000, 0x14e7ff, SM_RAM); - SekMapMemory(deco16_pf_ram[2], 0x154000, 0x154fff, SM_RAM); - SekMapMemory(deco16_pf_ram[3], 0x156000, 0x156fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[2], 0x15c000, 0x15c7ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[3], 0x15e000, 0x15e7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x184000, 0x187fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x19c000, 0x19dfff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x1a4000, 0x1a47ff, SM_RAM); - SekSetWriteWordHandler(0, cninja_main_write_word); - SekSetWriteByteHandler(0, cninja_main_write_byte); - SekSetReadWordHandler(0, cninja_main_read_word); - SekSetReadByteHandler(0, cninja_main_read_byte); - SekClose(); - - deco16SoundInit(DrvHucROM, DrvHucRAM, 8055000, 1, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60); - BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 EdrandyInit() -{ - BurnSetRefreshRate(58.00); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x80001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x80000, 5, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0xc0001, 6, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0xc0000, 7, 2)) return 1; - - if (BurnLoadRom(DrvHucROM + 0x00000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00001, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 10, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 11, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x80000, 13, 1)) return 1; - - for (INT32 i = 0; i < 0x40000; i++) { - INT32 n = DrvGfxROM2[i + 0x40000]; - DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000]; - DrvGfxROM2[i + 0x80000] = n; - } - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x000001, 15, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x100000, 16, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x100001, 17, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x200000, 18, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x200001, 19, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x300000, 20, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x300001, 21, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x400000, 22, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x400001, 23, 2)) return 1; - - BurnByteswap(DrvGfxROM3, 0x500000); - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 24, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x40000, 25, 1)) return 1; - - deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1); - deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0); - deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0); - - deco16_sprite_decode(DrvGfxROM3, 0x500000); // 16x16 - } - - deco16Init(0, 0, 1); - deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2); - deco16_set_global_offsets(0, 8); - - deco16_set_color_base(2, 0x200 + 0x000); - deco16_set_color_base(3, 0x200 + 0x300); - deco16_set_bank_callback(2, cninja_bank_callback); - deco16_set_bank_callback(3, cninja_bank_callback); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(deco16_pf_ram[0], 0x144000, 0x144fff, SM_RAM); - SekMapMemory(deco16_pf_ram[1], 0x146000, 0x146fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[0], 0x14c000, 0x14c7ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[1], 0x14e000, 0x14e7ff, SM_RAM); - SekMapMemory(deco16_pf_ram[2], 0x154000, 0x154fff, SM_RAM); - SekMapMemory(deco16_pf_ram[3], 0x156000, 0x156fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[2], 0x15c000, 0x15c7ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[3], 0x15e000, 0x15e7ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x188000, 0x189fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x194000, 0x197fff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x1bc000, 0x1bc7ff, SM_RAM); - SekSetWriteWordHandler(0, cninja_main_write_word); - SekSetWriteByteHandler(0, cninja_main_write_byte); - SekSetReadWordHandler(0, cninja_main_read_word); - SekSetReadByteHandler(0, cninja_main_read_byte); - SekClose(); - - deco16SoundInit(DrvHucROM, DrvHucRAM, 8055000, 1, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60); - BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 MutantfInit() -{ - BurnSetRefreshRate(58.00); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; - - if (BurnLoadRom(DrvHucROM + 0x00000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x00001, 6, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 7, 1)) return 1; - - memcpy (DrvGfxROM0 + 0x50000, DrvGfxROM0 + 0x10000, 0x10000); - memcpy (DrvGfxROM0 + 0x10000, DrvGfxROM1 + 0x00000, 0x40000); - memcpy (DrvGfxROM0 + 0x60000, DrvGfxROM1 + 0x40000, 0x40000); - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x80000, 9, 1)) return 1; - - for (INT32 i = 0; i < 0x40000; i++) { - INT32 n = DrvGfxROM2[i + 0x40000]; - DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000]; - DrvGfxROM2[i + 0x80000] = n; - } - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x000001, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x200000, 11, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x200001, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x400000, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x400001, 15, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM4 + 0x000001, 16, 4)) return 1; - if (BurnLoadRom(DrvGfxROM4 + 0x000003, 17, 4)) return 1; - if (BurnLoadRom(DrvGfxROM4 + 0x000000, 18, 4)) return 1; - if (BurnLoadRom(DrvGfxROM4 + 0x000002, 19, 4)) return 1; - - BurnByteswap(DrvGfxROM3, 0x500000); - BurnByteswap(DrvGfxROM4, 0x040000); - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 20, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x40000, 21, 1)) return 1; - - deco56_decrypt_gfx(DrvGfxROM0, 0xa0000); - deco56_decrypt_gfx(DrvGfxROM1, 0x80000); - - deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x0a0000, 1); - deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0); - deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0); - - deco16_sprite_decode(DrvGfxROM3, 0x500000); // 16x16 - deco16_sprite_decode(DrvGfxROM4, 0x040000); - } - - deco16Init(0, 0, 1); - deco16_set_graphics(DrvGfxROM0, 0xa0000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2); - deco16_set_global_offsets(0, 8); - - deco16_set_color_base(0, 0x000); - deco16_set_color_base(1, 0x300); - deco16_set_color_base(2, 0x200); - deco16_set_color_base(3, 0x400); - deco16_set_bank_callback(0, mutantf_1_bank_callback); - deco16_set_bank_callback(1, mutantf_2_bank_callback); - deco16_set_bank_callback(2, mutantf_1_bank_callback); - deco16_set_bank_callback(3, mutantf_1_bank_callback); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x100000, 0x103fff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x120000, 0x1207ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0x140000, 0x1407ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x160000, 0x161fff, SM_RAM); - SekMapMemory(deco16_pf_ram[0], 0x304000, 0x305fff, SM_RAM); - SekMapMemory(deco16_pf_ram[1], 0x306000, 0x307fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[0], 0x308000, 0x3087ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[1], 0x30a000, 0x30a7ff, SM_RAM); - SekMapMemory(deco16_pf_ram[2], 0x314000, 0x315fff, SM_RAM); - SekMapMemory(deco16_pf_ram[3], 0x316000, 0x317fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[2], 0x318000, 0x3187ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[3], 0x31a000, 0x31a7ff, SM_RAM); - SekSetWriteWordHandler(0, mutantf_main_write_word); - SekSetWriteByteHandler(0, mutantf_main_write_byte); - SekSetReadWordHandler(0, mutantf_main_read_word); - SekSetReadByteHandler(0, mutantf_main_read_byte); - SekClose(); - - deco16SoundInit(DrvHucROM, DrvHucRAM, 8055000, 0, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 CninjablInit() -{ - BurnSetRefreshRate(58.00); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(Drv68KROM + 0x80000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; - - UINT8 *tmp = (UINT8*)malloc(0x400000); - - if (BurnLoadRom(tmp + 0x00000, 3, 2)) return 1; - if (BurnLoadRom(tmp + 0x00001, 4, 2)) return 1; - BurnByteswap(tmp, 0x400000); - - for (INT32 i = 0; i < 0x200000; i++) tmp[i] ^= 0xff; - - memcpy (DrvGfxROM0 + 0x000000, tmp + 0x000000, 0x020000); - memcpy (DrvGfxROM1 + 0x000000, tmp + 0x080000, 0x080000); - memcpy (DrvGfxROM2 + 0x000000, tmp + 0x180000, 0x080000); - memcpy (DrvGfxROM2 + 0x080000, tmp + 0x100000, 0x080000); - memcpy (DrvGfxROM3 + 0x000000, tmp + 0x200000, 0x200000); - - if (tmp) { - free (tmp); - tmp = NULL; - } - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 5, 1)) return 1; - - DrvBootlegCharDecode(DrvGfxROM0, 0x020000); - deco16_sprite_decode(DrvGfxROM1, 0x080000); - deco16_sprite_decode(DrvGfxROM2, 0x100000); - deco16_sprite_decode(DrvGfxROM3, 0x200000); - } - - deco16Init(0, 1, 1); - deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2); - deco16_set_global_offsets(0, 8); - deco16_set_scroll_offs(3, 1, 2, 0); - deco16_set_scroll_offs(2, 1, 2, 0); - deco16_set_color_base(2, 0x200 + 0x000); - deco16_set_color_base(3, 0x200 + 0x300); - deco16_set_bank_callback(2, cninja_bank_callback); - deco16_set_bank_callback(3, cninja_bank_callback); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0bffff, SM_ROM); - SekMapMemory(DrvSprRAM, 0x138000, 0x1387ff, SM_RAM); - SekMapMemory(deco16_pf_ram[0], 0x144000, 0x144fff, SM_RAM); - SekMapMemory(deco16_pf_ram[1], 0x146000, 0x146fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[0], 0x14c000, 0x14c7ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[1], 0x14e000, 0x14e7ff, SM_RAM); - SekMapMemory(deco16_pf_ram[2], 0x154000, 0x154fff, SM_RAM); - SekMapMemory(deco16_pf_ram[3], 0x156000, 0x156fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[2], 0x15c000, 0x15c7ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[3], 0x15e000, 0x15e7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x180000, 0x187fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x19c000, 0x19dfff, SM_RAM); - SekSetWriteWordHandler(0, cninja_main_write_word); - SekSetWriteByteHandler(0, cninja_main_write_byte); - SekSetReadWordHandler(0, cninja_main_read_word); - SekSetReadByteHandler(0, cninja_main_read_byte); - SekClose(); - - has_z80 = 1; - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(stoneage_sound_write); - ZetSetReadHandler(stoneage_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3580000); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetAllRoutes(0.45, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 1006875 / 132, 1); - MSM6295Init(1, 2013750 / 132, 1); - MSM6295SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 StoneageInit() -{ - BurnSetRefreshRate(58.00); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x80001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x80000, 5, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00001, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 8, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x80000, 11, 1)) return 1; - - for (INT32 i = 0; i < 0x40000; i++) { - INT32 n = DrvGfxROM2[i + 0x40000]; - DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000]; - DrvGfxROM2[i + 0x80000] = n; - } - - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x000001, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x100000, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x100001, 15, 2)) return 1; - - BurnByteswap(DrvGfxROM3, 0x200000); - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 16, 1)) return 1; - - memset (DrvSndROM1, 0xff, 0x80000); - - deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1); - deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0); - deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0); - - deco16_sprite_decode(DrvGfxROM3, 0x200000); // 16x16 - } - - deco16Init(0, 1, 1); - deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2); - deco16_set_global_offsets(0, 8); - deco16_set_scroll_offs(3, 1, 10, 0); - deco16_set_scroll_offs(1, 1, 10, 0); - deco16_set_scroll_offs(0, 1, -2, 0); - deco16_set_color_base(2, 0x200 + 0x000); - deco16_set_color_base(3, 0x200 + 0x300); - deco16_set_bank_callback(2, cninja_bank_callback); - deco16_set_bank_callback(3, cninja_bank_callback); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0bffff, SM_ROM); - SekMapMemory(deco16_pf_ram[0], 0x144000, 0x144fff, SM_RAM); - SekMapMemory(deco16_pf_ram[1], 0x146000, 0x146fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[0], 0x14c000, 0x14c7ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[1], 0x14e000, 0x14e7ff, SM_RAM); - SekMapMemory(deco16_pf_ram[2], 0x154000, 0x154fff, SM_RAM); - SekMapMemory(deco16_pf_ram[3], 0x156000, 0x156fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[2], 0x15c000, 0x15c7ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[3], 0x15e000, 0x15e7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x184000, 0x187fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x19c000, 0x19dfff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x1a4000, 0x1a47ff, SM_RAM); - SekSetWriteWordHandler(0, cninja_main_write_word); - SekSetWriteByteHandler(0, cninja_main_write_byte); - SekSetReadWordHandler(0, cninja_main_read_word); - SekSetReadByteHandler(0, cninja_main_read_byte); - SekClose(); - - has_z80 = 1; - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(stoneage_sound_write); - ZetSetReadHandler(stoneage_sound_read); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 1006875 / 132, 1); - MSM6295Init(1, 2013750 / 132, 1); - MSM6295SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH); - - BurnYM2151Init(3580000); - BurnYM2151SetAllRoutes(0.45, BURN_SND_ROUTE_BOTH); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 Robocop2Init() -{ - BurnSetRefreshRate(58.00); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x80001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x80000, 5, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0xc0001, 6, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0xc0000, 7, 2)) return 1; - - if (BurnLoadRom(DrvHucROM + 0x00000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00001, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 10, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x80000, 12, 1)) return 1; - - for (INT32 i = 0; i < 0x40000; i++) { - INT32 n = DrvGfxROM1[i + 0x40000]; - DrvGfxROM1[i + 0x40000] = DrvGfxROM1[i + 0x80000]; - DrvGfxROM1[i + 0x80000] = n; - } - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 13, 1)) return 1; - memcpy (DrvGfxROM2 + 0x000000, DrvGfxROM3 + 0x000000, 0x040000); - memcpy (DrvGfxROM2 + 0x0c0000, DrvGfxROM3 + 0x040000, 0x040000); - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 14, 1)) return 1; - memcpy (DrvGfxROM2 + 0x040000, DrvGfxROM3 + 0x000000, 0x040000); - memcpy (DrvGfxROM2 + 0x100000, DrvGfxROM3 + 0x040000, 0x040000); - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 15, 1)) return 1; - memcpy (DrvGfxROM2 + 0x080000, DrvGfxROM3 + 0x000000, 0x040000); - memcpy (DrvGfxROM2 + 0x140000, DrvGfxROM3 + 0x040000, 0x040000); - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 16, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x000001, 17, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x100000, 18, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x100001, 19, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x200000, 20, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x200001, 21, 2)) return 1; - - BurnByteswap(DrvGfxROM3, 0x300000); - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 22, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x40000, 23, 1)) return 1; - - deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1); - deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x100000, 0); - deco16_tile_decode(DrvGfxROM2, DrvGfxROM4, 0x180000, 2); - deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x180000, 0); - - deco16_sprite_decode(DrvGfxROM3, 0x300000); // 16x16 - } - - deco16Init(0, 0, 1); - deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x100000 * 2, DrvGfxROM2, 0x180000 * 2); - deco16_set_global_offsets(0, 8); - - deco16_set_color_base(2, 0x200 + 0x000); - deco16_set_color_base(3, 0x200 + 0x300); - deco16_set_bank_callback(1, robocop2_bank_callback); - deco16_set_bank_callback(2, robocop2_bank_callback); - deco16_set_bank_callback(3, robocop2_bank_callback); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(deco16_pf_ram[0], 0x144000, 0x144fff, SM_RAM); - SekMapMemory(deco16_pf_ram[1], 0x146000, 0x146fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[0], 0x14c000, 0x14c7ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[1], 0x14e000, 0x14e7ff, SM_RAM); - SekMapMemory(deco16_pf_ram[2], 0x154000, 0x154fff, SM_RAM); - SekMapMemory(deco16_pf_ram[3], 0x156000, 0x156fff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[2], 0x15c000, 0x15c7ff, SM_RAM); - SekMapMemory(deco16_pf_rowscroll[3], 0x15e000, 0x15e7ff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x180000, 0x1807ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x1a8000, 0x1a9fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x1b8000, 0x1bbfff, SM_RAM); - SekSetWriteWordHandler(0, robocop2_main_write_word); - SekSetWriteByteHandler(0, robocop2_main_write_byte); - SekSetReadWordHandler(0, robocop2_main_read_word); - SekSetReadByteHandler(0, robocop2_main_read_byte); - SekClose(); - - deco16SoundInit(DrvHucROM, DrvHucRAM, 8055000, 1, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60); - BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - deco16Exit(); - - SekExit(); - - if (has_z80) { - ZetExit(); - has_z80 = 0; - MSM6295Exit(0); - MSM6295Exit(1); - BurnYM2151Exit(); - } else { - deco16SoundExit(); - } - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - return 0; -} - -static void cninja_draw_sprites() -{ - UINT16 *buffered_spriteram = (UINT16*)DrvSprBuf; - - for (INT32 offs = 0x400 - 4; offs >=0 ; offs -= 4) - { - INT32 x, y, sprite, color, multi, flipx, flipy, inc, flash, mult, pri = 0; - sprite = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 1]); - if (!sprite) - continue; - - x = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 2]); - - switch (x & 0xc000) - { - case 0x0000: pri = 0; break; - case 0x4000: pri = 0xf0; break; - case 0x8000: pri = 0xf0 | 0xcc; break; - case 0xc000: pri = 0xf0 | 0xcc; break; - } - - y = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs]); - flash = y & 0x1000; - if (flash && (nCurrentFrame & 1)) - continue; - - color = (x >> 9) & 0x1f; - - flipx = y & 0x2000; - flipy = y & 0x4000; - multi = (1 << ((y & 0x0600) >> 9)) - 1; - - x = x & 0x01ff; - y = y & 0x01ff; - if (x >= nScreenWidth) x -= 512; - if (y >= 256) y -= 512; - x = 240 - x; - y = 240 - y; - - sprite &= ~multi; - if (flipy) - inc = -1; - else - { - sprite += multi; - inc = 1; - } - - if (*flipscreen) - { - y = 240 - y; - x = (nScreenWidth - 16) - x; - if (flipx) flipx = 0; else flipx = 1; - if (flipy) flipy = 0; else flipy = 1; - mult = 16; - } - else - mult = -16; - - while (multi >= 0) - { - deco16_draw_prio_sprite(pTransDraw, DrvGfxROM3, sprite - multi * inc, (color << 4) + 0x300, x, y + mult * multi, flipx, flipy, pri); - - multi--; - } - } -} - -static void cninjabl_draw_sprites() -{ - UINT16 *buffered_spriteram = (UINT16*)DrvSprBuf; - INT32 offs; - INT32 endoffs; - - endoffs = 0x400 - 4; - for (offs = 0; offs < 0x400 - 4 ; offs += 4) - { - INT32 y = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 1]); - - if (y == 0x180) - { - endoffs = offs; - offs = 0x400 - 4; - } - } - - for (offs = endoffs; offs >=0 ; offs -= 4) - { - INT32 x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri = 0; - - sprite = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 0]); - y = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 1]); - - if (!sprite) - continue; - - x = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 2]); - - switch (x & 0xc000) - { - case 0x0000: pri = 0; break; - case 0x4000: pri = 0xf0; break; - case 0x8000: pri = 0xf0 | 0xcc; break; - case 0xc000: pri = 0xf0 | 0xcc; break; - } - - flash = y & 0x1000; - if (flash && (nCurrentFrame & 1)) - continue; - - colour = (x >> 9) & 0x1f; - - fx = y & 0x2000; - fy = y & 0x4000; - - multi = (1 << ((y & 0x0600) >> 9)) - 1; - - y -= multi * 16; - y += 4; - - x = x & 0x01ff; - y = y & 0x01ff; - if (x >= 256) x -= 512; - if (y >= 256) y -= 512; - x = 240 - x; - y = 240 - y; - - if (fy) - inc = -1; - else - { - sprite += multi; - inc = 1; - } - - if (*flipscreen) - { - y = 240 - y; - x = 240 - x; - if (fx) fx = 0; else fx = 1; - if (fy) fy = 0; else fy = 1; - mult = 16; - } - else - mult = -16; - - while (multi >= 0) - { - deco16_draw_prio_sprite(pTransDraw, DrvGfxROM3, sprite - multi * inc, (colour << 4) + 0x300, x, y + mult * multi, fx, fy, pri); - - multi--; - } - } -} - -static void mutantf_draw_sprites(UINT8 *ram, UINT8 *gfx, INT32 colbank, INT32 gfxbank) -{ - UINT16 *spriteptr = (UINT16*)ram; - - INT32 offs, end, inc; - - if (gfxbank == 4) - { - offs = 0; - end = 0x400; - inc = 4; - } - else - { - offs = 0x3fc; - end = -4; - inc = -4; - } - - while (offs != end) - { - INT32 x, y, sprite, colour, fx, fy, w, h, sx, sy, x_mult, y_mult; - INT32 alpha = 0xff; - - sprite = BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 3]); - if (!sprite) - { - offs += inc; - continue; - } - - sx = BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 1]); - - h = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 2]) & 0xf000) >> 12; - w = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 2]) & 0x0f00) >> 8; - - sy = BURN_ENDIAN_SWAP_INT16(spriteptr[offs]); - if ((sy & 0x2000) && (nCurrentFrame & 1)) - { - offs += inc; - continue; - } - - colour = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 2]) >> 0) & 0x1f; - - if (gfxbank == 4) - { - alpha = 0x80; - colour &= 0xf; - } - - fx = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 0]) & 0x4000); - fy = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 0]) & 0x8000); - - if (*flipscreen) - { - if (fx) fx = 0; else fx = 1; - if (fy) fy = 0; else fy = 1; - - sx = sx & 0x01ff; - sy = sy & 0x01ff; - if (sx > 0x180) sx = -(0x200 - sx); - if (sy > 0x180) sy = -(0x200 - sy); - - if (fx) { x_mult = -16; sx += 16 * w; } else { x_mult = 16; sx -= 16; } - if (fy) { y_mult = -16; sy += 16 * h; } else { y_mult = 16; sy -= 16; } - } - else - { - sx = sx & 0x01ff; - sy = sy & 0x01ff; - if (sx & 0x100) sx = -(0x100 - (sx & 0xff)); - if (sy & 0x100) sy = -(0x100 - (sy & 0xff)); - sx = 304 - sx; - sy = 240 - sy; - if (sx >= 432) sx -= 512; - if (sy >= 384) sy -= 512; - if (fx) { x_mult = -16; sx += 16; } else { x_mult = 16; sx -= 16*w; } - if (fy) { y_mult = -16; sy += 16; } else { y_mult = 16; sy -= 16*h; } - } - - for (x = 0; x < w; x++) - { - for (y = 0; y < h; y++) - { - // needs alpha blending... - deco16_draw_prio_sprite(pTransDraw, gfx, sprite + y + h * x, (colour << 4) + colbank, sx + x_mult * (w-x), sy + y_mult * (h-y), fx, fy, 0); - } - } - offs += inc; - } -} - -static INT32 CninjaDraw() -{ -// if (DrvRecalc) { - deco16_palette_recalculate(DrvPalette, DrvPalRAM); - DrvRecalc = 0; -// } - - deco16_pf12_update(); - deco16_pf34_update(); - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x200; - } - - deco16_clear_prio_map(); - - if (nSpriteEnable & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x01) | DECO16_LAYER_OPAQUE); - if (nSpriteEnable & 2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x02)); - if (nSpriteEnable & 4) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x02) | DECO16_LAYER_TRANSMASK1); - if (nSpriteEnable & 8) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x04) | DECO16_LAYER_TRANSMASK0); - - cninja_draw_sprites(); - - if (nSpriteEnable & 16) deco16_draw_layer(0, pTransDraw, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 CninjablDraw() -{ -// if (DrvRecalc) { - deco16_palette_recalculate(DrvPalette, DrvPalRAM); - DrvRecalc = 0; -// } - - deco16_pf12_update(); - deco16_pf34_update(); - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x200; - } - - deco16_clear_prio_map(); - - if (nSpriteEnable & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x01) | DECO16_LAYER_OPAQUE); - if (nSpriteEnable & 2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x02)); - if (nSpriteEnable & 4) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x02) | DECO16_LAYER_TRANSMASK1); - if (nSpriteEnable & 8) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x04) | DECO16_LAYER_TRANSMASK0); - - cninjabl_draw_sprites(); - - if (nSpriteEnable & 16) deco16_draw_layer(0, pTransDraw, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 EdrandyDraw() -{ -// if (DrvRecalc) { - deco16_palette_recalculate(DrvPalette, DrvPalRAM); - DrvRecalc = 0; -// } - - deco16_pf12_update(); - deco16_pf34_update(); - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0; - } - - deco16_clear_prio_map(); - - if (nSpriteEnable & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x01) | DECO16_LAYER_OPAQUE); - if (nSpriteEnable & 2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x02)); - if (nSpriteEnable & 4) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x04)); - - cninja_draw_sprites(); - - if (nSpriteEnable & 8) deco16_draw_layer(0, pTransDraw, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 Robocop2Draw() -{ -// if (DrvRecalc) { - deco16_palette_recalculate(DrvPalette, DrvPalRAM); - DrvRecalc = 0; -// } - - deco16_pf12_update(); - deco16_pf34_update(); - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x200; - } - - deco16_clear_prio_map(); - - INT32 layer_8bpp = 0; - - if (deco16_priority & 4) - { - deco16_set_color_mask(2, 0); - deco16_set_color_mask(3, 0); - deco16_set_graphics(2, DrvGfxROM4, 0x100000, 16); - layer_8bpp = DECO16_LAYER_8BITSPERPIXEL; - } - else - { - deco16_set_color_mask(2, 0xf); - deco16_set_color_mask(3, 0xf); - deco16_set_graphics(2, DrvGfxROM2, 0x300000, 16); - - if (nSpriteEnable & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_OPAQUE | DECO16_LAYER_PRIORITY(0x01)); - } - - if (deco16_priority & 8) { - if (nSpriteEnable & 2) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x02)); - if (nSpriteEnable & 4) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x04) | layer_8bpp); - } else { - if (nSpriteEnable & 2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x02) | layer_8bpp); - if (nSpriteEnable & 4) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x04)); - } - - cninja_draw_sprites(); - - if (nSpriteEnable & 8) deco16_draw_layer(0, pTransDraw, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - - -static INT32 MutantfDraw() -{ -// if (DrvRecalc) { - deco16_palette_recalculate(DrvPalette, DrvPalRAM); - DrvRecalc = 0; -// } - - deco16_pf12_update(); - deco16_pf34_update(); - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x400; - } - - if (nSpriteEnable & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_OPAQUE); - if (nSpriteEnable & 2) deco16_draw_layer(1, pTransDraw, 0); - if (nSpriteEnable & 4) deco16_draw_layer(2, pTransDraw, 0); - - if (deco16_priority & 1) - { - deco16_clear_prio_map(); - mutantf_draw_sprites(DrvSprBuf, DrvGfxROM3, 0x100, 3); - deco16_clear_prio_map(); - mutantf_draw_sprites(DrvSprBuf1, DrvGfxROM4, 0x700, 4); - } - else - { - deco16_clear_prio_map(); - mutantf_draw_sprites(DrvSprBuf1, DrvGfxROM4, 0x700, 4); - deco16_clear_prio_map(); - mutantf_draw_sprites(DrvSprBuf, DrvGfxROM3, 0x100, 3); - } - - if (nSpriteEnable & 8) deco16_draw_layer(0, pTransDraw, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 CninjaFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - deco16_prot_inputs = DrvInputs; - memset (DrvInputs, 0xff, 2 * sizeof(INT16)); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0); - } - - INT32 nInterleave = 256; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 12000000 / 58, 8055000 / 58 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - h6280NewFrame(); - - SekOpen(0); - h6280Open(0); - - deco16_vblank = 0; - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); - nCyclesDone[1] += h6280Run(nCyclesTotal[1] / nInterleave); - - if (irq_timer == i) { - SekSetIRQLine((irq_mask & 0x10) ? 3 : 4, SEK_IRQSTATUS_ACK); - irq_timer = -1; - } - if (i == 248) deco16_vblank = 0x08; - - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = SoundBuffer + (nSoundBufferPos << 1); - deco16SoundUpdate(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = SoundBuffer + (nSoundBufferPos << 1); - - if (nSegmentLength) { - deco16SoundUpdate(pSoundBuf, nSegmentLength); - } - - for (INT32 i = 0; i < nBurnSoundLen; i++) { - pBurnSoundOut[(i << 1) + 0] += SoundBuffer[(i << 1) + 0]; - pBurnSoundOut[(i << 1) + 1] += SoundBuffer[(i << 1) + 1]; - } - } - - h6280Close(); - SekClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - return 0; -} - -static INT32 MutantfFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - deco16_prot_inputs = DrvInputs; - memset (DrvInputs, 0xff, 2 * sizeof(INT16)); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0); - } - - INT32 nInterleave = 256; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 14000000 / 58, 8055000 / 58 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - h6280NewFrame(); - - SekOpen(0); - h6280Open(0); - - deco16_vblank = 0; - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); - nCyclesDone[1] += h6280Run(nCyclesTotal[1] / nInterleave); - - if (i == 240) deco16_vblank = 0x08; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - deco16SoundUpdate(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - deco16SoundUpdate(pSoundBuf, nSegmentLength); - } - } - - h6280Close(); - SekClose(); - - if (pBurnDraw) { - MutantfDraw(); - } - - return 0; -} - -static INT32 StoneageFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - deco16_prot_inputs = DrvInputs; - memset (DrvInputs, 0xff, 2 * sizeof(INT16)); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0); - } - - INT32 nInterleave = 256; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 12000000 / 58, 3579545 / 58 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - deco16_vblank = 0; - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); - nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave); - - if (irq_timer == i) { - SekSetIRQLine((irq_mask & 0x10) ? 3 : 4, SEK_IRQSTATUS_ACK); - irq_timer = -1; - } - if (i == 248) deco16_vblank = 0x08; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029722; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - - deco16SoundScan(nAction, pnMin); - - deco16Scan(); - - SCAN_VAR(scanline); - SCAN_VAR(irq_mask); - SCAN_VAR(irq_timer); - - SCAN_VAR(DrvOkiBank); - DrvYM2151WritePort(0, DrvOkiBank); - } - - return 0; -} - -static INT32 StoneageScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029722; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - MSM6295Scan(1, nAction); - - deco16Scan(); - - SCAN_VAR(scanline); - SCAN_VAR(irq_mask); - SCAN_VAR(irq_timer); - - SCAN_VAR(DrvOkiBank); - } - - return 0; -} - - -// Caveman Ninja (World ver 4) - -static struct BurnRomInfo cninjaRomDesc[] = { - { "gn-02-3.1k", 0x020000, 0x39aea12a, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "gn-05-2.3k", 0x020000, 0x0f4360ef, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gn-01-2.1j", 0x020000, 0xf740ef7e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "gn-04-2.3j", 0x020000, 0xc98fcb62, 1 | BRF_PRG | BRF_ESS }, // 3 - { "gn-00.rom", 0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, // 4 - { "gn-03.rom", 0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "gl-07.rom", 0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code - - { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters - { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 - - { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles - - { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles - { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 - - { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites - { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 - { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 - { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 - - { "gl-06.rom", 0x020000, 0xd92e519d, 7 | BRF_SND }, // 16 OKI M6295 Samples 0 - - { "mag-07.rom", 0x080000, 0x08eb5264, 8 | BRF_SND }, // 17 OKI M6295 Samples 1 - - { "mb7122h.7v", 0x000400, 0xa1267336, 0 | BRF_OPT }, // 18 Unused PROMs -}; - -STD_ROM_PICK(cninja) -STD_ROM_FN(cninja) - -struct BurnDriver BurnDrvCninja = { - "cninja", NULL, NULL, NULL, "1991", - "Caveman Ninja (World ver 4)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, - NULL, cninjaRomInfo, cninjaRomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, - CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - -// Caveman Ninja (alternate) - -static struct BurnRomInfo cninjaaRomDesc[] = { - { "1.1k", 0x020000, 0xa6c40959, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "4.3k", 0x020000, 0x2e01d1fd, 1 | BRF_PRG | BRF_ESS }, // 1 - { "2.2j", 0x020000, 0x18f0527c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "5.3j", 0x020000, 0xea4b6d53, 1 | BRF_PRG | BRF_ESS }, // 3 - { "gn-00.rom", 0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, // 4 - { "gn-03.rom", 0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "gl-07.rom", 0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code - - { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters - { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 - - { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles - - { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles - { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 - - { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites - { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 - { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 - { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 - - { "gl-06.rom", 0x020000, 0xd92e519d, 7 | BRF_SND }, // 16 OKI M6295 Samples 0 - - { "mag-07.rom", 0x080000, 0x08eb5264, 8 | BRF_SND }, // 17 OKI M6295 Samples 1 - - { "mb7122h.7v", 0x000400, 0xa1267336, 0 | BRF_OPT }, // 18 Unused PROMs -}; - -STD_ROM_PICK(cninjaa) -STD_ROM_FN(cninjaa) - -struct BurnDriver BurnDrvCninjaa = { - "cninjaa", "cninja", NULL, NULL, "1991", - "Caveman Ninja (alternate)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, - NULL, cninjaaRomInfo, cninjaaRomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, - CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - - -// Caveman Ninja (World ver 1) - -static struct BurnRomInfo cninja1RomDesc[] = { - { "gn-02.1k", 0x020000, 0xccc59524, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "gn-05.3k", 0x020000, 0xa002cbe4, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gn-01.1j", 0x020000, 0x18f0527c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "gn-04.3j", 0x020000, 0xea4b6d53, 1 | BRF_PRG | BRF_ESS }, // 3 - { "gn-00.rom", 0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, // 4 - { "gn-03.rom", 0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "gl-07.rom", 0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code - - { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters - { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 - - { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles - - { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles - { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 - - { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites - { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 - { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 - { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 - - { "gl-06.rom", 0x020000, 0xd92e519d, 7 | BRF_SND }, // 16 OKI M6295 Samples 0 - - { "mag-07.rom", 0x080000, 0x08eb5264, 8 | BRF_SND }, // 17 OKI M6295 Samples 1 - - { "mb7122h.7v", 0x000400, 0xa1267336, 0 | BRF_OPT }, // 18 Unused PROMs -}; - -STD_ROM_PICK(cninja1) -STD_ROM_FN(cninja1) - -struct BurnDriver BurnDrvCninja1 = { - "cninja1", "cninja", NULL, NULL, "1991", - "Caveman Ninja (World ver 1)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, - NULL, cninja1RomInfo, cninja1RomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, - CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - - -// Caveman Ninja (US ver 4) - -static struct BurnRomInfo cninjauRomDesc[] = { - { "gm-02-3.1k", 0x020000, 0xd931c3b1, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "gm-05-2.3k", 0x020000, 0x7417d3fb, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gm-01-2.1j", 0x020000, 0x72041f7e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "gm-04-2.3j", 0x020000, 0x2104d005, 1 | BRF_PRG | BRF_ESS }, // 3 - { "gn-00.rom", 0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, // 4 - { "gn-03.rom", 0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "gl-07.rom", 0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code - - { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters - { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 - - { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles - - { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles - { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 - - { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites - { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 - { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 - { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 - - { "gl-06.rom", 0x020000, 0xd92e519d, 7 | BRF_SND }, // 16 OKI M6295 Samples 0 - - { "mag-07.rom", 0x080000, 0x08eb5264, 8 | BRF_SND }, // 17 OKI M6295 Samples 1 - - { "mb7122h.7v", 0x000400, 0xa1267336, 0 | BRF_OPT }, // 18 Unused PROMs -}; - -STD_ROM_PICK(cninjau) -STD_ROM_FN(cninjau) - -struct BurnDriver BurnDrvCninjau = { - "cninjau", "cninja", NULL, NULL, "1991", - "Caveman Ninja (US ver 4)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, - NULL, cninjauRomInfo, cninjauRomName, NULL, NULL, DrvInputInfo, CninjauDIPInfo, - CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - - -// Tatakae Genshizin Joe & Mac (Japan ver 1) - -static struct BurnRomInfo joemacRomDesc[] = { - { "gl-02-2.1k", 0x020000, 0x80da12e2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "gl-05-2.3k", 0x020000, 0xfe4dbbbb, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gl-01-2.1j", 0x020000, 0x0b245307, 1 | BRF_PRG | BRF_ESS }, // 2 - { "gl-04-2.3j", 0x020000, 0x1b331f61, 1 | BRF_PRG | BRF_ESS }, // 3 - { "gn-00.rom", 0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, // 4 - { "gn-03.rom", 0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "gl-07.rom", 0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code - - { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters - { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 - - { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles - - { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles - { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 - - { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites - { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 - { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 - { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 - - { "gl-06.rom", 0x020000, 0xd92e519d, 7 | BRF_SND }, // 16 OKI M6295 Samples 0 - - { "mag-07.rom", 0x080000, 0x08eb5264, 8 | BRF_SND }, // 17 OKI M6295 Samples 1 - - { "mb7122h.7v", 0x000400, 0xa1267336, 0 | BRF_OPT }, // 18 Unused PROMs -}; - -STD_ROM_PICK(joemac) -STD_ROM_FN(joemac) - -struct BurnDriver BurnDrvJoemac = { - "joemac", "cninja", NULL, NULL, "1991", - "Tatakae Genshizin Joe & Mac (Japan ver 1)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, - NULL, joemacRomInfo, joemacRomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, - CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - - -// Stoneage (bootleg of Caveman Ninja) - -static struct BurnRomInfo stoneageRomDesc[] = { - { "sa_1_019.bin", 0x020000, 0x7fb8c44f, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "sa_1_033.bin", 0x020000, 0x961c752b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "sa_1_018.bin", 0x020000, 0xa4043022, 1 | BRF_PRG | BRF_ESS }, // 2 - { "sa_1_032.bin", 0x020000, 0xf52a3286, 1 | BRF_PRG | BRF_ESS }, // 3 - { "sa_1_017.bin", 0x020000, 0x08d6397a, 1 | BRF_PRG | BRF_ESS }, // 4 - { "sa_1_031.bin", 0x020000, 0x103079f5, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "sa_1_012.bin", 0x010000, 0x56058934, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code - - { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters - { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 - - { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles - - { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles - { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 - - { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites - { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 - { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 - { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 - - { "sa_1_069.bin", 0x040000, 0x2188f3ca, 7 | BRF_SND }, // 16 OKI M6295 Samples -}; - -STD_ROM_PICK(stoneage) -STD_ROM_FN(stoneage) - -struct BurnDriver BurnDrvStoneage = { - "stoneage", "cninja", NULL, NULL, "1991", - "Stoneage (bootleg of Caveman Ninja)\0", NULL, "bootleg", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, - NULL, stoneageRomInfo, stoneageRomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, - StoneageInit, DrvExit, StoneageFrame, CninjaDraw, StoneageScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - - -// Caveman Ninja (bootleg) - -static struct BurnRomInfo cninjablRomDesc[] = { - { "joe mac 3.68k", 0x080000, 0xdc931d80, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "joe mac 4.68k", 0x080000, 0xe8dfe0b5, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "joe mac 5.z80", 0x010000, 0xd791b9d7, 2 | BRF_PRG | BRF_ESS }, // 2 Huc6280 Code - - { "joe mac 1.gfx", 0x200000, 0x17ea5931, 3 | BRF_GRA }, // 3 Graphics (Expanded on init) - { "joe mac 2.gfx", 0x200000, 0xcc95317b, 3 | BRF_GRA }, // 4 - - { "joe mac 6.samples", 0x080000, 0xdbecad83, 4 | BRF_SND }, // 5 OKI M6295 Samples -}; - -STD_ROM_PICK(cninjabl) -STD_ROM_FN(cninjabl) - -struct BurnDriver BurnDrvCninjabl = { - "cninjabl", "cninja", NULL, NULL, "1991", - "Caveman Ninja (bootleg)\0", NULL, "bootleg", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, - NULL, cninjablRomInfo, cninjablRomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, - CninjablInit, DrvExit, StoneageFrame, CninjablDraw, StoneageScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - - -// Mutant Fighter (World ver EM-5) - -static struct BurnRomInfo mutantfRomDesc[] = { - { "hd-03-4.2c", 0x020000, 0x94859545, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "hd-00-4.2a", 0x020000, 0x3cdb648f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "hd-04-1.4c", 0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, // 2 - { "hd-01-1.4a", 0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "hd-12.21j", 0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, // 4 Huc6280 Code - - { "hd-06-1.8d", 0x010000, 0x8b7a558b, 3 | BRF_GRA }, // 5 Characters - { "hd-07-1.9d", 0x010000, 0xd2a3d449, 3 | BRF_GRA }, // 6 - - { "maf-00.8a", 0x080000, 0xe56f528d, 4 | BRF_GRA }, // 7 Foreground Tiles - - { "maf-01.9a", 0x080000, 0xc3d5173d, 5 | BRF_GRA }, // 8 Background Tiles - { "maf-02.11a", 0x080000, 0x0b37d849, 5 | BRF_GRA }, // 9 - - { "maf-03.18a", 0x100000, 0xf4366d2c, 6 | BRF_GRA }, // 10 Sprite Bank A - { "maf-04.20a", 0x100000, 0x0c8f654e, 6 | BRF_GRA }, // 11 - { "maf-05.21a", 0x080000, 0xb0cfeb80, 6 | BRF_GRA }, // 12 - { "maf-06.18d", 0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, // 13 - { "maf-07.20d", 0x100000, 0xfd6008a3, 6 | BRF_GRA }, // 14 - { "maf-08.21d", 0x080000, 0xe41cf1e7, 6 | BRF_GRA }, // 15 - - { "hf-08.15a", 0x010000, 0x93b7279f, 7 | BRF_GRA }, // 16 Sprite Bank B - { "hf-09.17a", 0x010000, 0x05e2c074, 7 | BRF_GRA }, // 17 - { "hf-10.15c", 0x010000, 0x9b06f418, 7 | BRF_GRA }, // 18 - { "hf-11.17c", 0x010000, 0x3859a531, 7 | BRF_GRA }, // 19 - - { "maf-10.20l", 0x040000, 0x7c57f48b, 8 | BRF_SND }, // 20 OKI M6295 Samples 0 - - { "maf-09.18l", 0x080000, 0x28e7ed81, 9 | BRF_SND }, // 21 OKI M6295 Samples 1 -}; - -STD_ROM_PICK(mutantf) -STD_ROM_FN(mutantf) - -struct BurnDriver BurnDrvMutantf = { - "mutantf", NULL, NULL, NULL, "1992", - "Mutant Fighter (World ver EM-5)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0, - NULL, mutantfRomInfo, mutantfRomName, NULL, NULL, DrvInputInfo, MutantfDIPInfo, - MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; - - -// Mutant Fighter (World ver EM-4) - -static struct BurnRomInfo mutantf4RomDesc[] = { - { "hd-03-3.2c", 0x020000, 0xe6f53574, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "hd-00-3.2a", 0x020000, 0xd3055454, 1 | BRF_PRG | BRF_ESS }, // 1 - { "hd-04-1.4c", 0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, // 2 - { "hd-01-1.4a", 0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "hd-12.21j", 0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, // 4 Huc6280 Code - - { "hd-06-1.8d", 0x010000, 0x8b7a558b, 3 | BRF_GRA }, // 5 Characters - { "hd-07-1.9d", 0x010000, 0xd2a3d449, 3 | BRF_GRA }, // 6 - - { "maf-00.8a", 0x080000, 0xe56f528d, 4 | BRF_GRA }, // 7 Foreground Tiles - - { "maf-01.9a", 0x080000, 0xc3d5173d, 5 | BRF_GRA }, // 8 Background Tiles - { "maf-02.11a", 0x080000, 0x0b37d849, 5 | BRF_GRA }, // 9 - - { "maf-03.18a", 0x100000, 0xf4366d2c, 6 | BRF_GRA }, // 10 Sprite Bank A - { "maf-04.20a", 0x100000, 0x0c8f654e, 6 | BRF_GRA }, // 11 - { "maf-05.21a", 0x080000, 0xb0cfeb80, 6 | BRF_GRA }, // 12 - { "maf-06.18d", 0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, // 13 - { "maf-07.20d", 0x100000, 0xfd6008a3, 6 | BRF_GRA }, // 14 - { "maf-08.21d", 0x080000, 0xe41cf1e7, 6 | BRF_GRA }, // 15 - - { "hf-08.15a", 0x010000, 0x93b7279f, 7 | BRF_GRA }, // 16 Sprite Bank B - { "hf-09.17a", 0x010000, 0x05e2c074, 7 | BRF_GRA }, // 17 - { "hf-10.15c", 0x010000, 0x9b06f418, 7 | BRF_GRA }, // 18 - { "hf-11.17c", 0x010000, 0x3859a531, 7 | BRF_GRA }, // 19 - - { "maf-10.20l", 0x040000, 0x7c57f48b, 8 | BRF_SND }, // 20 OKI M6295 Samples 0 - - { "maf-09.18l", 0x080000, 0x28e7ed81, 9 | BRF_SND }, // 21 OKI M6295 Samples 1 -}; - -STD_ROM_PICK(mutantf4) -STD_ROM_FN(mutantf4) - -struct BurnDriver BurnDrvMutantf4 = { - "mutantf4", "mutantf", NULL, NULL, "1992", - "Mutant Fighter (World ver EM-4)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0, - NULL, mutantf4RomInfo, mutantf4RomName, NULL, NULL, DrvInputInfo, MutantfDIPInfo, - MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; - - -// Mutant Fighter (World ver EM-3) - -static struct BurnRomInfo mutantf3RomDesc[] = { - { "hd-03-2.2c", 0x020000, 0x0586c4fa, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "hd-00-2.2a", 0x020000, 0x6f8ec48e, 1 | BRF_PRG | BRF_ESS }, // 1 - { "hd-04-1.4c", 0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, // 2 - { "hd-01-1.4a", 0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "hd-12.21j", 0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, // 4 Huc6280 Code - - { "hd-06-1.8d", 0x010000, 0x8b7a558b, 3 | BRF_GRA }, // 5 Characters - { "hd-07-1.9d", 0x010000, 0xd2a3d449, 3 | BRF_GRA }, // 6 - - { "maf-00.8a", 0x080000, 0xe56f528d, 4 | BRF_GRA }, // 7 Foreground Tiles - - { "maf-01.9a", 0x080000, 0xc3d5173d, 5 | BRF_GRA }, // 8 Background Tiles - { "maf-02.11a", 0x080000, 0x0b37d849, 5 | BRF_GRA }, // 9 - - { "maf-03.18a", 0x100000, 0xf4366d2c, 6 | BRF_GRA }, // 10 Sprite Bank A - { "maf-04.20a", 0x100000, 0x0c8f654e, 6 | BRF_GRA }, // 11 - { "maf-05.21a", 0x080000, 0xb0cfeb80, 6 | BRF_GRA }, // 12 - { "maf-06.18d", 0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, // 13 - { "maf-07.20d", 0x100000, 0xfd6008a3, 6 | BRF_GRA }, // 14 - { "maf-08.21d", 0x080000, 0xe41cf1e7, 6 | BRF_GRA }, // 15 - - { "hf-08.15a", 0x010000, 0x93b7279f, 7 | BRF_GRA }, // 16 Sprite Bank B - { "hf-09.17a", 0x010000, 0x05e2c074, 7 | BRF_GRA }, // 17 - { "hf-10.15c", 0x010000, 0x9b06f418, 7 | BRF_GRA }, // 18 - { "hf-11.17c", 0x010000, 0x3859a531, 7 | BRF_GRA }, // 19 - - { "maf-10.20l", 0x040000, 0x7c57f48b, 8 | BRF_SND }, // 20 OKI M6295 Samples 0 - - { "maf-09.18l", 0x080000, 0x28e7ed81, 9 | BRF_SND }, // 21 OKI M6295 Samples 1 -}; - -STD_ROM_PICK(mutantf3) -STD_ROM_FN(mutantf3) - -struct BurnDriver BurnDrvMutantf3 = { - "mutantf3", "mutantf", NULL, NULL, "1992", - "Mutant Fighter (World ver EM-3)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0, - NULL, mutantf3RomInfo, mutantf3RomName, NULL, NULL, DrvInputInfo, MutantfDIPInfo, - MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; - - -// Death Brade (Japan ver JM-3) - -static struct BurnRomInfo deathbrdRomDesc[] = { - { "hf-03-2.2c", 0x020000, 0xfb86fff3, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "hf-00-2.2a", 0x020000, 0x099aa422, 1 | BRF_PRG | BRF_ESS }, // 1 - { "hd-04-1.4c", 0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, // 2 - { "hd-01-1.4a", 0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "hd-12.21j", 0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, // 4 Huc6280 Code - - { "hd-06-1.8d", 0x010000, 0x8b7a558b, 3 | BRF_GRA }, // 5 Characters - { "hd-07-1.9d", 0x010000, 0xd2a3d449, 3 | BRF_GRA }, // 6 - - { "maf-00.8a", 0x080000, 0xe56f528d, 4 | BRF_GRA }, // 7 Foreground Tiles - - { "maf-01.9a", 0x080000, 0xc3d5173d, 5 | BRF_GRA }, // 8 Background Tiles - { "maf-02.11a", 0x080000, 0x0b37d849, 5 | BRF_GRA }, // 9 - - { "maf-03.18a", 0x100000, 0xf4366d2c, 6 | BRF_GRA }, // 10 Sprite Bank A - { "maf-04.20a", 0x100000, 0x0c8f654e, 6 | BRF_GRA }, // 11 - { "maf-05.21a", 0x080000, 0xb0cfeb80, 6 | BRF_GRA }, // 12 - { "maf-06.18d", 0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, // 13 - { "maf-07.20d", 0x100000, 0xfd6008a3, 6 | BRF_GRA }, // 14 - { "maf-08.21d", 0x080000, 0xe41cf1e7, 6 | BRF_GRA }, // 15 - - { "hf-08.15a", 0x010000, 0x93b7279f, 7 | BRF_GRA }, // 16 Sprite Bank B - { "hf-09.17a", 0x010000, 0x05e2c074, 7 | BRF_GRA }, // 17 - { "hf-10.15c", 0x010000, 0x9b06f418, 7 | BRF_GRA }, // 18 - { "hf-11.17c", 0x010000, 0x3859a531, 7 | BRF_GRA }, // 19 - - { "maf-10.20l", 0x040000, 0x7c57f48b, 8 | BRF_SND }, // 20 OKI M6295 Samples 0 - - { "maf-09.18l", 0x080000, 0x28e7ed81, 9 | BRF_SND }, // 21 OKI M6295 Samples 1 -}; - -STD_ROM_PICK(deathbrd) -STD_ROM_FN(deathbrd) - -struct BurnDriver BurnDrvDeathbrd = { - "deathbrd", "mutantf", NULL, NULL, "1992", - "Death Brade (Japan ver JM-3)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0, - NULL, deathbrdRomInfo, deathbrdRomName, NULL, NULL, DrvInputInfo, MutantfDIPInfo, - MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; - - -// The Cliffhanger - Edward Randy (World ver 3) - -static struct BurnRomInfo edrandyRomDesc[] = { - { "gg-00-2.k1", 0x020000, 0xce1ba964, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "gg-04-2.k3", 0x020000, 0x24caed19, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gg-01-2.j1", 0x020000, 0x33677b80, 1 | BRF_PRG | BRF_ESS }, // 2 - { "gg-05-2.j3", 0x020000, 0x79a68ca6, 1 | BRF_PRG | BRF_ESS }, // 3 - { "ge-02.h1", 0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, // 4 - { "ge-06.h3", 0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, // 5 - { "ge-03.f1", 0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, // 6 - { "ge-07.f3", 0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "ge-09.k13", 0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code - - { "gg-10.y6", 0x010000, 0xb96c6cbe, 3 | BRF_GRA }, // 9 Characters - { "gg-11.z6", 0x010000, 0xee567448, 3 | BRF_GRA }, // 10 - - { "mad-02", 0x080000, 0x6c76face, 4 | BRF_GRA }, // 11 Foreground Tiles - - { "mad-00", 0x080000, 0x3735b22d, 5 | BRF_GRA }, // 12 Background Tiles - { "mad-01", 0x080000, 0x7bb13e1c, 5 | BRF_GRA }, // 13 - - { "mad-03", 0x080000, 0xc0bff892, 6 | BRF_GRA }, // 14 Sprites - { "mad-05", 0x080000, 0x3f2ccf95, 6 | BRF_GRA }, // 15 - { "mad-04", 0x080000, 0x464f3eb9, 6 | BRF_GRA }, // 16 - { "mad-06", 0x080000, 0x60871f77, 6 | BRF_GRA }, // 17 - { "mad-07", 0x080000, 0xac03466e, 6 | BRF_GRA }, // 18 - { "mad-08", 0x080000, 0x1b420ec8, 6 | BRF_GRA }, // 19 - { "mad-10", 0x080000, 0x42da8ef0, 6 | BRF_GRA }, // 20 - { "mad-11", 0x080000, 0x03c1f982, 6 | BRF_GRA }, // 21 - { "mad-09", 0x080000, 0x930f4900, 6 | BRF_GRA }, // 22 - { "mad-12", 0x080000, 0xa0bd62b6, 6 | BRF_GRA }, // 23 - - { "ge-08.j13", 0x020000, 0xdfe28c7b, 7 | BRF_SND }, // 24 OKI M6295 Samples 0 - - { "mad-13", 0x080000, 0x6ab28eba, 8 | BRF_SND }, // 25 OKI M6295 Samples 1 - - { "ge-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 26 Unused PROMs -}; - -STD_ROM_PICK(edrandy) -STD_ROM_FN(edrandy) - -struct BurnDriver BurnDrvEdrandy = { - "edrandy", NULL, NULL, NULL, "1990", - "The Cliffhanger - Edward Randy (World ver 3)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, - NULL, edrandyRomInfo, edrandyRomName, NULL, NULL, DrvInputInfo, EdrandyDIPInfo, - EdrandyInit, DrvExit, CninjaFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - - -// The Cliffhanger - Edward Randy (World ver 2) - -static struct BurnRomInfo edrandy2RomDesc[] = { - { "gg00-1.k1", 0x020000, 0xa029cc4a, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "gg04-1.k3", 0x020000, 0x8b7928a4, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gg01-1.j1", 0x020000, 0x84360123, 1 | BRF_PRG | BRF_ESS }, // 2 - { "gg05-1.j3", 0x020000, 0x0bf85d9d, 1 | BRF_PRG | BRF_ESS }, // 3 - { "ge-02.h1", 0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, // 4 - { "ge-06.h3", 0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, // 5 - { "ge-03.f1", 0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, // 6 - { "ge-07.f3", 0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "ge-09.k13", 0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code - - { "gg-10.y6", 0x010000, 0xb96c6cbe, 3 | BRF_GRA }, // 9 Characters - { "gg-11.z6", 0x010000, 0xee567448, 3 | BRF_GRA }, // 10 - - { "mad-02", 0x080000, 0x6c76face, 4 | BRF_GRA }, // 11 Foreground Tiles - - { "mad-00", 0x080000, 0x3735b22d, 5 | BRF_GRA }, // 12 Background Tiles - { "mad-01", 0x080000, 0x7bb13e1c, 5 | BRF_GRA }, // 13 - - { "mad-03", 0x080000, 0xc0bff892, 6 | BRF_GRA }, // 14 Sprites - { "mad-05", 0x080000, 0x3f2ccf95, 6 | BRF_GRA }, // 15 - { "mad-04", 0x080000, 0x464f3eb9, 6 | BRF_GRA }, // 16 - { "mad-06", 0x080000, 0x60871f77, 6 | BRF_GRA }, // 17 - { "mad-07", 0x080000, 0xac03466e, 6 | BRF_GRA }, // 18 - { "mad-08", 0x080000, 0x1b420ec8, 6 | BRF_GRA }, // 19 - { "mad-10", 0x080000, 0x42da8ef0, 6 | BRF_GRA }, // 20 - { "mad-11", 0x080000, 0x03c1f982, 6 | BRF_GRA }, // 21 - { "mad-09", 0x080000, 0x930f4900, 6 | BRF_GRA }, // 22 - { "mad-12", 0x080000, 0xa0bd62b6, 6 | BRF_GRA }, // 23 - - { "ge-08.j13", 0x020000, 0xdfe28c7b, 7 | BRF_SND }, // 24 OKI M6295 Samples 0 - - { "mad-13", 0x080000, 0x6ab28eba, 8 | BRF_SND }, // 25 OKI M6295 Samples 1 - - { "ge-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 26 Unused PROMs -}; - -STD_ROM_PICK(edrandy2) -STD_ROM_FN(edrandy2) - -struct BurnDriver BurnDrvEdrandy2 = { - "edrandy2", "edrandy", NULL, NULL, "1990", - "The Cliffhanger - Edward Randy (World ver 2)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, - NULL, edrandy2RomInfo, edrandy2RomName, NULL, NULL, DrvInputInfo, EdrandcDIPInfo, - EdrandyInit, DrvExit, CninjaFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - - -// The Cliffhanger - Edward Randy (World ver 1) - -static struct BurnRomInfo edrandy1RomDesc[] = { - { "1.k1", 0x020000, 0xf184cdaa, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "5.k3", 0x020000, 0x7e3a4b81, 1 | BRF_PRG | BRF_ESS }, // 1 - { "2.j1", 0x020000, 0x212cd593, 1 | BRF_PRG | BRF_ESS }, // 2 - { "6.j3", 0x020000, 0x4a96fb07, 1 | BRF_PRG | BRF_ESS }, // 3 - { "ge-02.h1", 0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, // 4 - { "ge-06.h3", 0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, // 5 - { "ge-03.f1", 0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, // 6 - { "ge-07.f3", 0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "ge-09.k13", 0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code - - { "ge-10.y6", 0x010000, 0x2528d795, 3 | BRF_GRA }, // 9 Characters - { "ge-11.z6", 0x010000, 0xe34a931e, 3 | BRF_GRA }, // 10 - - { "mad-02", 0x080000, 0x6c76face, 4 | BRF_GRA }, // 11 Foreground Tiles - - { "mad-00", 0x080000, 0x3735b22d, 5 | BRF_GRA }, // 12 Background Tiles - { "mad-01", 0x080000, 0x7bb13e1c, 5 | BRF_GRA }, // 13 - - { "mad-03", 0x080000, 0xc0bff892, 6 | BRF_GRA }, // 14 Sprites - { "mad-05", 0x080000, 0x3f2ccf95, 6 | BRF_GRA }, // 15 - { "mad-04", 0x080000, 0x464f3eb9, 6 | BRF_GRA }, // 16 - { "mad-06", 0x080000, 0x60871f77, 6 | BRF_GRA }, // 17 - { "mad-07", 0x080000, 0xac03466e, 6 | BRF_GRA }, // 18 - { "mad-08", 0x080000, 0x1b420ec8, 6 | BRF_GRA }, // 19 - { "mad-10", 0x080000, 0x42da8ef0, 6 | BRF_GRA }, // 20 - { "mad-11", 0x080000, 0x03c1f982, 6 | BRF_GRA }, // 21 - { "mad-09", 0x080000, 0x930f4900, 6 | BRF_GRA }, // 22 - { "mad-12", 0x080000, 0xa0bd62b6, 6 | BRF_GRA }, // 23 - - { "ge-08.j13", 0x020000, 0xdfe28c7b, 7 | BRF_SND }, // 24 OKI M6295 Samples 0 - - { "mad-13", 0x080000, 0x6ab28eba, 8 | BRF_SND }, // 25 OKI M6295 Samples 1 - - { "ge-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 26 Unused PROMs -}; - -STD_ROM_PICK(edrandy1) -STD_ROM_FN(edrandy1) - -struct BurnDriver BurnDrvEdrandy1 = { - "edrandy1", "edrandy", NULL, NULL, "1990", - "The Cliffhanger - Edward Randy (World ver 1)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, - NULL, edrandy1RomInfo, edrandy1RomName, NULL, NULL, DrvInputInfo, EdrandcDIPInfo, - EdrandyInit, DrvExit, CninjaFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - - -// The Cliffhanger - Edward Randy (Japan ver 3) - -static struct BurnRomInfo edrandyjRomDesc[] = { - { "ge-00-2.k1", 0x020000, 0xb3d2403c, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ge-04-2.k3", 0x020000, 0x8a9624d6, 1 | BRF_PRG | BRF_ESS }, // 1 - { "ge-01-2.j1", 0x020000, 0x84360123, 1 | BRF_PRG | BRF_ESS }, // 2 - { "ge-05-2.j3", 0x020000, 0x0bf85d9d, 1 | BRF_PRG | BRF_ESS }, // 3 - { "ge-02.h1", 0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, // 4 - { "ge-06.h3", 0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, // 5 - { "ge-03.f1", 0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, // 6 - { "ge-07.f3", 0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "ge-09.k13", 0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code - - { "ge-10.y6", 0x010000, 0x2528d795, 3 | BRF_GRA }, // 9 Characters - { "ge-11.z6", 0x010000, 0xe34a931e, 3 | BRF_GRA }, // 10 - - { "mad-02", 0x080000, 0x6c76face, 4 | BRF_GRA }, // 11 Foreground Tiles - - { "mad-00", 0x080000, 0x3735b22d, 5 | BRF_GRA }, // 12 Background Tiles - { "mad-01", 0x080000, 0x7bb13e1c, 5 | BRF_GRA }, // 13 - - { "mad-03", 0x080000, 0xc0bff892, 6 | BRF_GRA }, // 14 Sprites - { "mad-05", 0x080000, 0x3f2ccf95, 6 | BRF_GRA }, // 15 - { "mad-04", 0x080000, 0x464f3eb9, 6 | BRF_GRA }, // 16 - { "mad-06", 0x080000, 0x60871f77, 6 | BRF_GRA }, // 17 - { "mad-07", 0x080000, 0xac03466e, 6 | BRF_GRA }, // 18 - { "mad-08", 0x080000, 0x1b420ec8, 6 | BRF_GRA }, // 19 - { "mad-10", 0x080000, 0x42da8ef0, 6 | BRF_GRA }, // 20 - { "mad-11", 0x080000, 0x03c1f982, 6 | BRF_GRA }, // 21 - { "mad-09", 0x080000, 0x930f4900, 6 | BRF_GRA }, // 22 - { "mad-12", 0x080000, 0xa0bd62b6, 6 | BRF_GRA }, // 23 - - { "ge-08.j13", 0x020000, 0xdfe28c7b, 7 | BRF_SND }, // 24 OKI M6295 Samples 0 - - { "mad-13", 0x080000, 0x6ab28eba, 8 | BRF_SND }, // 25 OKI M6295 Samples 1 - - { "ge-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 26 Unused PROMs -}; - -STD_ROM_PICK(edrandyj) -STD_ROM_FN(edrandyj) - -struct BurnDriver BurnDrvEdrandyj = { - "edrandyj", "edrandy", NULL, NULL, "1990", - "The Cliffhanger - Edward Randy (Japan ver 3)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, - NULL, edrandyjRomInfo, edrandyjRomName, NULL, NULL, DrvInputInfo, EdrandcDIPInfo, - EdrandyInit, DrvExit, CninjaFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800, - 256, 240, 4, 3 -}; - - -// Robocop 2 (Euro/Asia v0.10) - -static struct BurnRomInfo robocop2RomDesc[] = { - { "gq-03.k1", 0x020000, 0xa7e90c28, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "gq-07.k3", 0x020000, 0xd2287ec1, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gq-02.j1", 0x020000, 0x6777b8a0, 1 | BRF_PRG | BRF_ESS }, // 2 - { "gq-06.j3", 0x020000, 0xe11e27b5, 1 | BRF_PRG | BRF_ESS }, // 3 - { "go-01-1.h1", 0x020000, 0xab5356c0, 1 | BRF_PRG | BRF_ESS }, // 4 - { "go-05-1.h3", 0x020000, 0xce21bda5, 1 | BRF_PRG | BRF_ESS }, // 5 - { "go-00.f1", 0x020000, 0xa93369ea, 1 | BRF_PRG | BRF_ESS }, // 6 - { "go-04.f3", 0x020000, 0xee2f6ad9, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "gp-09.k13", 0x010000, 0x4a4e0f8d, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code - - { "gp10-1.y6", 0x010000, 0xd25d719c, 3 | BRF_GRA }, // 9 Characters - { "gp11-1.z6", 0x010000, 0x030ded47, 3 | BRF_GRA }, // 10 - - { "mah-04.z4", 0x080000, 0x9b6ca18c, 4 | BRF_GRA }, // 11 Foreground Tiles - { "mah-03.y4", 0x080000, 0x37894ddc, 4 | BRF_GRA }, // 12 - - { "mah-01.z1", 0x080000, 0x26e0dfff, 5 | BRF_GRA }, // 13 Background Tiles - { "mah-00.y1", 0x080000, 0x7bd69e41, 5 | BRF_GRA }, // 14 - { "mah-02.a1", 0x080000, 0x328a247d, 5 | BRF_GRA }, // 15 - - { "mah-05.y9", 0x080000, 0x6773e613, 6 | BRF_GRA }, // 16 Sprites - { "mah-08.y12", 0x080000, 0x88d310a5, 6 | BRF_GRA }, // 17 - { "mah-06.z9", 0x080000, 0x27a8808a, 6 | BRF_GRA }, // 18 - { "mah-09.z12", 0x080000, 0xa58c43a7, 6 | BRF_GRA }, // 19 - { "mah-07.a9", 0x080000, 0x526f4190, 6 | BRF_GRA }, // 20 - { "mah-10.a12", 0x080000, 0x14b770da, 6 | BRF_GRA }, // 21 - - { "gp-08.j13", 0x020000, 0x365183b1, 7 | BRF_SND }, // 22 OKI M6295 Samples 0 - - { "mah-11.f13", 0x080000, 0x642bc692, 8 | BRF_SND }, // 23 OKI M6295 Samples 1 - - { "go-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 24 Unused PROMs -}; - -STD_ROM_PICK(robocop2) -STD_ROM_FN(robocop2) - -struct BurnDriver BurnDrvRobocop2 = { - "robocop2", NULL, NULL, NULL, "1991", - "Robocop 2 (Euro/Asia v0.10)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, - NULL, robocop2RomInfo, robocop2RomName, NULL, NULL, Robocop2InputInfo, Robocop2DIPInfo, - Robocop2Init, DrvExit, CninjaFrame, Robocop2Draw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; - - -// Robocop 2 (US v0.05) - -static struct BurnRomInfo robocop2uRomDesc[] = { - { "robo03.k1", 0x020000, 0xf4c96cc9, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "robo07.k3", 0x020000, 0x11e53a7c, 1 | BRF_PRG | BRF_ESS }, // 1 - { "robo02.j1", 0x020000, 0xfa086a0d, 1 | BRF_PRG | BRF_ESS }, // 2 - { "robo06.j3", 0x020000, 0x703b49d0, 1 | BRF_PRG | BRF_ESS }, // 3 - { "go-01-1.h1", 0x020000, 0xab5356c0, 1 | BRF_PRG | BRF_ESS }, // 4 - { "go-05-1.h3", 0x020000, 0xce21bda5, 1 | BRF_PRG | BRF_ESS }, // 5 - { "go-00.f1", 0x020000, 0xa93369ea, 1 | BRF_PRG | BRF_ESS }, // 6 - { "go-04.f3", 0x020000, 0xee2f6ad9, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "gp-09.k13", 0x010000, 0x4a4e0f8d, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code - - { "gp10-1.y6", 0x010000, 0xd25d719c, 3 | BRF_GRA }, // 9 Characters - { "gp11-1.z6", 0x010000, 0x030ded47, 3 | BRF_GRA }, // 10 - - { "mah-04.z4", 0x080000, 0x9b6ca18c, 4 | BRF_GRA }, // 11 Foreground Tiles - { "mah-03.y4", 0x080000, 0x37894ddc, 4 | BRF_GRA }, // 12 - - { "mah-01.z1", 0x080000, 0x26e0dfff, 5 | BRF_GRA }, // 13 Background Tiles - { "mah-00.y1", 0x080000, 0x7bd69e41, 5 | BRF_GRA }, // 14 - { "mah-02.a1", 0x080000, 0x328a247d, 5 | BRF_GRA }, // 15 - - { "mah-05.y9", 0x080000, 0x6773e613, 6 | BRF_GRA }, // 16 Sprites - { "mah-08.y12", 0x080000, 0x88d310a5, 6 | BRF_GRA }, // 17 - { "mah-06.z9", 0x080000, 0x27a8808a, 6 | BRF_GRA }, // 18 - { "mah-09.z12", 0x080000, 0xa58c43a7, 6 | BRF_GRA }, // 19 - { "mah-07.a9", 0x080000, 0x526f4190, 6 | BRF_GRA }, // 20 - { "mah-10.a12", 0x080000, 0x14b770da, 6 | BRF_GRA }, // 21 - - { "gp-08.j13", 0x020000, 0x365183b1, 7 | BRF_SND }, // 22 OKI M6295 Samples 0 - - { "mah-11.f13", 0x080000, 0x642bc692, 8 | BRF_SND }, // 23 OKI M6295 Samples 1 - - { "go-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 24 Unused PROMs -}; - -STD_ROM_PICK(robocop2u) -STD_ROM_FN(robocop2u) - -struct BurnDriver BurnDrvRobocop2u = { - "robocop2u", "robocop2", NULL, NULL, "1991", - "Robocop 2 (US v0.05)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, - NULL, robocop2uRomInfo, robocop2uRomName, NULL, NULL, Robocop2InputInfo, Robocop2DIPInfo, - Robocop2Init, DrvExit, CninjaFrame, Robocop2Draw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; - - -// Robocop 2 (Japan v0.11) - -static struct BurnRomInfo robocop2jRomDesc[] = { - { "go-03-1.k1", 0x020000, 0x52506608, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "go-07-1.k3", 0x020000, 0x739cda17, 1 | BRF_PRG | BRF_ESS }, // 1 - { "go-02-1.j1", 0x020000, 0x48c0ace9, 1 | BRF_PRG | BRF_ESS }, // 2 - { "go-06-1.j3", 0x020000, 0x41abec87, 1 | BRF_PRG | BRF_ESS }, // 3 - { "go-01-1.h1", 0x020000, 0xab5356c0, 1 | BRF_PRG | BRF_ESS }, // 4 - { "go-05-1.h3", 0x020000, 0xce21bda5, 1 | BRF_PRG | BRF_ESS }, // 5 - { "go-00.f1", 0x020000, 0xa93369ea, 1 | BRF_PRG | BRF_ESS }, // 6 - { "go-04.f3", 0x020000, 0xee2f6ad9, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "gp-09.k13", 0x010000, 0x4a4e0f8d, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code - - { "gp10-1.y6", 0x010000, 0xd25d719c, 3 | BRF_GRA }, // 9 Characters - { "gp11-1.z6", 0x010000, 0x030ded47, 3 | BRF_GRA }, // 10 - - { "mah-04.z4", 0x080000, 0x9b6ca18c, 4 | BRF_GRA }, // 11 Foreground Tiles - { "mah-03.y4", 0x080000, 0x37894ddc, 4 | BRF_GRA }, // 12 - - { "mah-01.z1", 0x080000, 0x26e0dfff, 5 | BRF_GRA }, // 13 Background Tiles - { "mah-00.y1", 0x080000, 0x7bd69e41, 5 | BRF_GRA }, // 14 - { "mah-02.a1", 0x080000, 0x328a247d, 5 | BRF_GRA }, // 15 - - { "mah-05.y9", 0x080000, 0x6773e613, 6 | BRF_GRA }, // 16 Sprites - { "mah-08.y12", 0x080000, 0x88d310a5, 6 | BRF_GRA }, // 17 - { "mah-06.z9", 0x080000, 0x27a8808a, 6 | BRF_GRA }, // 18 - { "mah-09.z12", 0x080000, 0xa58c43a7, 6 | BRF_GRA }, // 19 - { "mah-07.a9", 0x080000, 0x526f4190, 6 | BRF_GRA }, // 20 - { "mah-10.a12", 0x080000, 0x14b770da, 6 | BRF_GRA }, // 21 - - { "gp-08.j13", 0x020000, 0x365183b1, 7 | BRF_SND }, // 22 OKI M6295 Samples 0 - - { "mah-11.f13", 0x080000, 0x642bc692, 8 | BRF_SND }, // 23 OKI M6295 Samples 1 - - { "go-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 24 Unused PROMs -}; - -STD_ROM_PICK(robocop2j) -STD_ROM_FN(robocop2j) - -struct BurnDriver BurnDrvRobocop2j = { - "robocop2j", "robocop2", NULL, NULL, "1991", - "Robocop 2 (Japan v0.11)\0", NULL, "Data East Corporation", "DECO IC16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, - NULL, robocop2jRomInfo, robocop2jRomName, NULL, NULL, Robocop2InputInfo, Robocop2DIPInfo, - Robocop2Init, DrvExit, CninjaFrame, Robocop2Draw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; +// FB Alpha Caveman Ninja driver module +// Based on MAME driver by Bryan McPhail + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "h6280_intf.h" +#include "bitswap.h" +#include "deco16ic.h" +#include "burn_ym2203.h" +#include "burn_ym2151.h" +#include "msm6295.h" +#include "timer.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvHucROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvGfxROM4; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *Drv68KRAM; +static UINT8 *DrvHucRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprRAM1; +static UINT8 *DrvSprBuf; +static UINT8 *DrvSprBuf1; +static UINT8 *DrvPrtRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static INT16 *SoundBuffer; + +static UINT8 *soundlatch; +static UINT8 *flipscreen; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[3]; +static UINT8 DrvReset; +static UINT16 DrvInputs[3]; + +static INT32 scanline; +static INT32 irq_mask; +static INT32 irq_timer; + +static INT32 DrvOkiBank; + +static INT32 has_z80 = 0; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 15, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo Robocop2InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 15, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 14, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Robocop2) + +static struct BurnDIPInfo CninjaDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x01, "1" }, + {0x13, 0x01, 0x03, 0x00, "2" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x08, "Easy" }, + {0x13, 0x01, 0x0c, 0x0c, "Normal" }, + {0x13, 0x01, 0x0c, 0x04, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Restore Life Meter" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Cninja) + +static struct BurnDIPInfo CninjauDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Credit(s) to Start" }, + {0x12, 0x01, 0x80, 0x80, "1" }, + {0x12, 0x01, 0x80, 0x00, "2" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x01, "1" }, + {0x13, 0x01, 0x03, 0x00, "2" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x08, "Easy" }, + {0x13, 0x01, 0x0c, 0x0c, "Normal" }, + {0x13, 0x01, 0x0c, 0x04, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Restore Life Meter" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Cninjau) + +static struct BurnDIPInfo MutantfDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Credit(s) to Start" }, + {0x12, 0x01, 0x80, 0x80, "1" }, + {0x12, 0x01, 0x80, 0x00, "2" }, + + {0 , 0xfe, 0 , 4, "Timer Decrement" }, + {0x13, 0x01, 0x03, 0x01, "Slow" }, + {0x13, 0x01, 0x03, 0x03, "Normal" }, + {0x13, 0x01, 0x03, 0x02, "Fast" }, + {0x13, 0x01, 0x03, 0x00, "Very Fast" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x08, "Easy" }, + {0x13, 0x01, 0x0c, 0x0c, "Normal" }, + {0x13, 0x01, 0x0c, 0x04, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Life Per Stage" }, + {0x13, 0x01, 0x30, 0x00, "Least" }, + {0x13, 0x01, 0x30, 0x10, "Little" }, + {0x13, 0x01, 0x30, 0x20, "Less" }, + {0x13, 0x01, 0x30, 0x30, "Normal" }, + + {0 , 0xfe, 0 , 2, "Continues" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Mutantf) + +static struct BurnDIPInfo EdrandyDIPList[]= +{ + {0x12, 0xff, 0xff, 0xbf, NULL }, + {0x13, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x12, 0x01, 0x40, 0x00, "Off" }, + {0x12, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Credit(s) to Start" }, + {0x12, 0x01, 0x80, 0x80, "1" }, + {0x12, 0x01, 0x80, 0x00, "2" }, + + {0 , 0xfe, 0 , 4, "Player's Power" }, + {0x13, 0x01, 0x03, 0x01, "Very Low" }, + {0x13, 0x01, 0x03, 0x00, "Low" }, + {0x13, 0x01, 0x03, 0x03, "Medium" }, + {0x13, 0x01, 0x03, 0x02, "High" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x08, "Easy" }, + {0x13, 0x01, 0x0c, 0x0c, "Normal" }, + {0x13, 0x01, 0x0c, 0x04, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Continues" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Edrandy) + +static struct BurnDIPInfo EdrandcDIPList[]= +{ + {0x12, 0xff, 0xff, 0xbf, NULL }, + {0x13, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x12, 0x01, 0x40, 0x00, "Off" }, + {0x12, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Unknown" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Player's Power" }, + {0x13, 0x01, 0x03, 0x01, "Very Low" }, + {0x13, 0x01, 0x03, 0x00, "Low" }, + {0x13, 0x01, 0x03, 0x03, "Medium" }, + {0x13, 0x01, 0x03, 0x02, "High" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x08, "Easy" }, + {0x13, 0x01, 0x0c, 0x0c, "Normal" }, + {0x13, 0x01, 0x0c, 0x04, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Continues" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Edrandc) + +static struct BurnDIPInfo Robocop2DIPList[]= +{ + {0x14, 0xff, 0xff, 0xbf, NULL }, + {0x15, 0xff, 0xff, 0x7f, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x14, 0x01, 0x07, 0x00, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x07, 0x01, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x07, 0x02, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x14, 0x01, 0x38, 0x00, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x38, 0x08, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x38, 0x10, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x01, "1" }, + {0x15, 0x01, 0x03, 0x00, "2" }, + {0x15, 0x01, 0x03, 0x03, "3" }, + {0x15, 0x01, 0x03, 0x02, "4" }, + + {0 , 0xfe, 0 , 4, "Time" }, + {0x15, 0x01, 0x0c, 0x08, "400 Seconds" }, + {0x15, 0x01, 0x0c, 0x0c, "300 Seconds" }, + {0x15, 0x01, 0x0c, 0x04, "200 Seconds" }, + {0x15, 0x01, 0x0c, 0x00, "100 Seconds" }, + + {0 , 0xfe, 0 , 4, "Health" }, + {0x15, 0x01, 0x30, 0x00, "17" }, + {0x15, 0x01, 0x30, 0x10, "24" }, + {0x15, 0x01, 0x30, 0x30, "33" }, + {0x15, 0x01, 0x30, 0x20, "40" }, + + {0 , 0xfe, 0 , 2, "Continues" }, + {0x15, 0x01, 0x40, 0x00, "Off" }, + {0x15, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Bullets" }, + {0x16, 0x01, 0x03, 0x00, "Least" }, + {0x16, 0x01, 0x03, 0x01, "Less" }, + {0x16, 0x01, 0x03, 0x03, "Normal" }, + {0x16, 0x01, 0x03, 0x02, "More" }, + + {0 , 0xfe, 0 , 4, "Enemy Movement" }, + {0x16, 0x01, 0x0c, 0x08, "Slow" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Fast" }, + {0x16, 0x01, 0x0c, 0x00, "Fastest" }, + + {0 , 0xfe, 0 , 4, "Enemy Strength" }, + {0x16, 0x01, 0x30, 0x20, "Less" }, + {0x16, 0x01, 0x30, 0x30, "Normal" }, + {0x16, 0x01, 0x30, 0x10, "More" }, + {0x16, 0x01, 0x30, 0x00, "Most" }, + + {0 , 0xfe, 0 , 2, "Enemy Weapon Speed" }, + {0x16, 0x01, 0x40, 0x40, "Normal" }, + {0x16, 0x01, 0x40, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2, "Game Over Message" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Robocop2) + +void __fastcall cninja_main_write_word(UINT32 address, UINT16 data) +{ + deco16_write_control_word(0, address, 0x140000, data) + deco16_write_control_word(1, address, 0x150000, data) + + switch (address) + { + case 0x190000: + case 0x1a4000: + irq_mask = data & 0xff; + return; + + case 0x190002: + case 0x1a4002: + { + scanline = data & 0xff; + + if ((!BIT(scanline,1)) && (scanline > 0) && (scanline < 240)) { + irq_timer = scanline; + } else { + irq_timer = -1; + } + } + return; + + case 0x1ac000: + case 0x1b4000: + memcpy (DrvSprBuf, DrvSprRAM, 0x800); + return; + + case 0x17ff2a: + case 0x198064: + case 0x1bc0a8: + if (has_z80) { + *soundlatch = data & 0xff; + ZetNmi(); + } else { + deco16_soundlatch = data & 0xff; + h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); + } + break; + } + + if ((address & 0xfffff800) == 0x198000) { + deco16_66_prot_w(address, data, 0xffff); + return; + } + + if ((address & 0xffffff00) == 0x1bc000) { + UINT16 *ProtRam = (UINT16*)deco16_prot_ram; + ProtRam[(address - 0x1bc000) >> 1] = data; + return; + } +} + +void __fastcall cninja_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + // case 0x190000: + case 0x190001: + // case 0x1a4000: + case 0x1a4001: + irq_mask = data & 0xff; + return; + + // case 0x190002: + case 0x190003: + // case 0x1a4002: + case 0x1a4003: + { + scanline = data & 0xff; + if ((~irq_mask & 0x02) && (scanline > 0) && (scanline < 240)) { + irq_timer = scanline; + } else { + irq_timer = -1; + } + } + return; + + // case 0x1ac000: + case 0x1ac001: + // case 0x1b4000: + case 0x1b4001: + memcpy (DrvSprBuf, DrvSprRAM, 0x800); + return; + + case 0x198065: + case 0x1bc0a9: + if (has_z80) { + *soundlatch = data; + ZetNmi(); + } else { + deco16_soundlatch = data; + h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); + } + break; + } + + if ((address & 0xfffff800) == 0x198000) { + deco16_66_prot_w(address, data, 0x00ff << ((address & 1) << 3)); + return; + } + + if ((address & 0xffffff00) == 0x1bc000) { + DrvPrtRAM[(address & 0xff)^1] = data; + + return; + } + + bprintf(PRINT_NORMAL, _T("Write Byte %x, %x\n"), address, data); +} + +UINT16 __fastcall cninja_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x17ff22: + return (DrvDips[1] << 8) | (DrvDips[0] << 0); + + case 0x17ff28: + return (DrvInputs[1] & 0x07) | (deco16_vblank & 0x08); + + case 0x17ff2c: + return DrvInputs[0]; + + case 0x1a4002: + case 0x190002: + return scanline; + + case 0x1a4004: + case 0x190004: + SekSetIRQLine(3, SEK_IRQSTATUS_NONE); + SekSetIRQLine(4, SEK_IRQSTATUS_NONE); + return 0; + } + + if ((address & 0xfffffc00) == 0x1bc000) { + return deco16_104_cninja_prot_r(address); + } + + if ((address & 0xfffff800) == 0x198000) { + return deco16_60_prot_r(address); + } + + bprintf(PRINT_NORMAL, _T("Read Word %x, %x\n"), address); + + return 0; +} + +UINT8 __fastcall cninja_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x17ff22: + return DrvDips[1]; + + case 0x17ff23: + return DrvDips[0]; + + // case 0x17ff28: + case 0x17ff29: + return (DrvInputs[1] & 0x07) | (deco16_vblank & 0x08); + + case 0x17ff2c: + return DrvInputs[0] >> 8; + + case 0x17ff2d: + return DrvInputs[0]; + + // case 0x1a4002: + case 0x1a4003: + // case 0x190002: + case 0x190003: + return scanline; + + // case 0x1a4004: + case 0x1a4005: + // case 0x190004: + case 0x190005: + SekSetIRQLine(3, SEK_IRQSTATUS_NONE); + SekSetIRQLine(4, SEK_IRQSTATUS_NONE); + return 0; + } + + if ((address & 0xfffff800) == 0x198000) { + return deco16_60_prot_r(address) >> ((~address & 1) << 3); + } + + if ((address & 0xfffffc00) == 0x1bc000) { + return deco16_104_cninja_prot_r(address) >> ((~address & 1) << 3); + } + + bprintf(PRINT_NORMAL, _T("Read Byte %x, %x\n"), address); + + return 0; +} + +void __fastcall mutantf_main_write_word(UINT32 address, UINT16 data) +{ + deco16_write_control_word(0, address, 0x300000, data) + deco16_write_control_word(1, address, 0x310000, data) + + switch (address) + { + case 0x180000: + deco16_priority = data; + return; + + case 0x1a0064: + deco16_soundlatch = data & 0xff; + h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); + break; + + case 0x1c0000: + memcpy (DrvSprBuf, DrvSprRAM, 0x800); + return; + + case 0x1e0000: + memcpy (DrvSprBuf1, DrvSprRAM1, 0x800); + return; + } + + if ((address & 0xfffff800) == 0x1a0000) { + deco16_66_prot_w(address, data, 0xffff); + return; + } +} + +void __fastcall mutantf_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x180000: + case 0x180001: + deco16_priority = data; + return; + + case 0x1c0000: + case 0x1c0001: + memcpy (DrvSprBuf, DrvSprRAM, 0x800); + return; + + case 0x1e0000: + case 0x1e0001: + memcpy (DrvSprBuf1, DrvSprRAM1, 0x800); + return; + + case 0x1a0065: + deco16_soundlatch = data; + h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); + break; + } + + if ((address & 0xfffff800) == 0x1a0000) { + deco16_66_prot_w(address, data, 0x00ff << ((address & 1) << 3)); + return; + } +} + +UINT16 __fastcall mutantf_main_read_word(UINT32 address) +{ + if ((address & 0xfffff800) == 0x1a0000) { + return deco16_66_prot_r(address); + } + + return 0; +} + +UINT8 __fastcall mutantf_main_read_byte(UINT32 address) +{ + if (address == 0x1c0001) return deco16ic_71_read() & 0xff; + + if ((address & 0xfffff800) == 0x1a0000) { + return deco16_66_prot_r(address) >> ((~address & 1) << 3); + } + + return 0; +} + +void __fastcall robocop2_main_write_word(UINT32 address, UINT16 data) +{ + deco16_write_control_word(0, address, 0x140000, data) + deco16_write_control_word(1, address, 0x150000, data) + + switch (address) + { + case 0x1b0000: + irq_mask = data & 0xff; + return; + + case 0x1b0002: { + scanline = data & 0xff; + + if ((!BIT(scanline,1)) && (scanline > 0) && (scanline < 240)) { + irq_timer = scanline; + } else { + irq_timer = -1; + } + } + return; + + case 0x198000: + memcpy (DrvSprBuf, DrvSprRAM, 0x800); + return; + + case 0x18c064: + deco16_soundlatch = data & 0xff; + h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); + return;; + + case 0x1f0000: + deco16_priority = data; + return; + } +} + +void __fastcall robocop2_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x1b0000: + case 0x1b0001: + + irq_mask = data & 0xff; + return; + + case 0x1b0002: + case 0x1b0003: { + scanline = data & 0xff; + if ((~irq_mask & 0x02) && (scanline > 0) && (scanline < 240)) { + irq_timer = scanline; + } else { + irq_timer = -1; + } + } + return; + + case 0x198000: + case 0x198001: + memcpy (DrvSprBuf, DrvSprRAM, 0x800); + return; + + case 0x18c065: + deco16_soundlatch = data; + h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); + break; + + case 0x1f0000: + case 0x1f0001: + deco16_priority = data; + return; + } +} + +UINT16 __fastcall robocop2_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x18c41a: + return DrvInputs[0]; + + case 0x18c320: + return (DrvInputs[1] & 0x07) | (deco16_vblank & 0x08); + + case 0x18c4e6: + return (DrvDips[1] << 8) | (DrvDips[0] << 0); + + case 0x18c504: + return 0x0084; + + case 0x1b0002: + return scanline; + + case 0x1b0004: + SekSetIRQLine(3, SEK_IRQSTATUS_NONE); + SekSetIRQLine(4, SEK_IRQSTATUS_NONE); + return 0; + + case 0x1f8000: + return DrvDips[2]; + } + + return 0; +} + +UINT8 __fastcall robocop2_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x18c41a: + return DrvInputs[0] >> 8; + + case 0x18c41b: + return DrvInputs[0] >> 0; + + case 0x18c320: + case 0x18c321: + return (DrvInputs[1] & 0x07) | (deco16_vblank & 0x08); + + case 0x18c4e6: + return DrvDips[0]; + + case 0x18c4e7: + return DrvDips[1]; + + case 0x18c504: + case 0x18c505: + return 0x0084; + + case 0x1b0002: + case 0x1b0003: + return scanline; + + case 0x1b0004: + case 0x1b0005: + SekSetIRQLine(3, SEK_IRQSTATUS_NONE); + SekSetIRQLine(4, SEK_IRQSTATUS_NONE); + return 0; + + case 0x1f8000: + case 0x1f8001: + return DrvDips[2]; + } + + return 0; +} + +void __fastcall stoneage_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8800: + BurnYM2151SelectRegister(data); + return; + + case 0x8801: + BurnYM2151WriteRegister(data); + return; + + case 0x9800: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall stoneage_sound_read(UINT16 address) +{ + switch (address) + { + case 0x8800: + case 0x8801: + return BurnYM2151ReadStatus(); + + case 0x9800: + return MSM6295ReadStatus(0); + + case 0xa000: + ZetSetIRQLine(0x20, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +static void DrvYM2151IrqHandler(INT32 state) +{ + ZetSetIRQLine(0, state ? ZET_IRQSTATUS_ACK : ZET_IRQSTATUS_NONE); +} + +static void DrvYM2151WritePort(UINT32, UINT32 data) +{ + DrvOkiBank = data & 1; + + memcpy (DrvSndROM1, DrvSndROM1 + 0x40000 + (data & 1) * 0x40000, 0x40000); +} + +static INT32 cninja_bank_callback(const INT32 bank) +{ + if ((bank >> 4) & 0xf) return 0x0000; + return 0x1000; +} + +static INT32 mutantf_1_bank_callback(const INT32 bank) +{ + return ((bank >> 4) & 0x3) << 12; +} + +static INT32 mutantf_2_bank_callback(const INT32 bank) +{ + return ((bank >> 5) & 0x1) << 14; +} + +static INT32 robocop2_bank_callback(const INT32 bank) +{ + return (bank & 0x30) << 8; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + if (has_z80) { + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + MSM6295Reset(1); + BurnYM2151Reset(); + } else { + deco16SoundReset(); + } + + DrvYM2151WritePort(0, 0); // set initial oki bank + + deco16Reset(); + + scanline = 0; + irq_mask = 0; + irq_timer = -1; + + return 0; +} + +static void DrvBootlegCharDecode(UINT8 *gfx, INT32 len) +{ + UINT8 *dst = (UINT8*)BurnMalloc(len); + + memcpy (dst, gfx, len); + + for (INT32 r = 0; r < len; r+=4) { + for (INT32 i = 0; i < 8; i++) { + INT32 t0 = (dst[r + 3] >> (7 - (i & 7))) & 1; + INT32 t1 = (dst[r + 1] >> (7 - (i & 7))) & 1; + INT32 t2 = (dst[r + 2] >> (7 - (i & 7))) & 1; + INT32 t3 = (dst[r + 0] >> (7 - (i & 7))) & 1; + + gfx[(r * 2) + i] = (t0 << 3) | (t1 << 2) | (t2 << 1) | (t3 << 0); + } + } + + BurnFree (dst); +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x100000; + DrvZ80ROM = Next; + DrvHucROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x200000; + DrvGfxROM2 = Next; Next += 0x300000; + DrvGfxROM3 = Next; Next += 0xa00000; + DrvGfxROM4 = Next; Next += 0x100000; + + MSM6295ROM = Next; + DrvSndROM0 = Next; Next += 0x100000; + DrvSndROM1 = Next; Next += 0x0c0000; + + DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x008000; + DrvHucRAM = Next; Next += 0x002000; + DrvSprRAM = Next; Next += 0x000800; + DrvSprBuf = Next; Next += 0x000800; + DrvSprRAM1 = Next; Next += 0x000800; + DrvSprBuf1 = Next; Next += 0x000800; + DrvPalRAM = Next; Next += 0x002000; + + deco16_prot_ram = (UINT16*)Next; + DrvPrtRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + + RamEnd = Next; + + SoundBuffer = (INT16*)Next; Next += nBurnSoundLen * 2 * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static void cninja_patch() +{ + UINT16 *rom = (UINT16 *)Drv68KROM; + + for (INT32 i = 0; i < 0x80000 / 2; i++) + { + if (rom[i] == BURN_ENDIAN_SWAP_INT16(0x66ff) || rom[i] == BURN_ENDIAN_SWAP_INT16(0x67ff)) + { + if (rom[i - 4] == BURN_ENDIAN_SWAP_INT16(0x0c39) || rom[i - 4] == BURN_ENDIAN_SWAP_INT16(0x0839)) + { + rom[i - 0] = BURN_ENDIAN_SWAP_INT16(0x4e71); + rom[i - 1] = BURN_ENDIAN_SWAP_INT16(0x4e71); + rom[i - 2] = BURN_ENDIAN_SWAP_INT16(0x4e71); + rom[i - 3] = BURN_ENDIAN_SWAP_INT16(0x4e71); + rom[i - 4] = BURN_ENDIAN_SWAP_INT16(0x4e71); + } + } + } +} + +static INT32 CninjaInit() +{ + BurnSetRefreshRate(58.00); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x80001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x80000, 5, 2)) return 1; + + if (BurnLoadRom(DrvHucROM + 0x00000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00001, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 8, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x80000, 11, 1)) return 1; + + for (INT32 i = 0; i < 0x40000; i++) { + INT32 n = DrvGfxROM2[i + 0x40000]; + DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000]; + DrvGfxROM2[i + 0x80000] = n; + } + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x000001, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x100000, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x100001, 15, 2)) return 1; + + BurnByteswap(DrvGfxROM3, 0x200000); + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 16, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x40000, 17, 1)) return 1; + + deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1); + deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0); + deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0); + + deco16_sprite_decode(DrvGfxROM3, 0x200000); // 16x16 + + cninja_patch(); + } + + deco16Init(0, 1, 1); + deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2); + deco16_set_global_offsets(0, 8); + + deco16_set_color_base(2, 0x200 + 0x000); + deco16_set_color_base(3, 0x200 + 0x300); + deco16_set_bank_callback(2, cninja_bank_callback); + deco16_set_bank_callback(3, cninja_bank_callback); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0bffff, SM_ROM); + SekMapMemory(deco16_pf_ram[0], 0x144000, 0x144fff, SM_RAM); + SekMapMemory(deco16_pf_ram[1], 0x146000, 0x146fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[0], 0x14c000, 0x14c7ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[1], 0x14e000, 0x14e7ff, SM_RAM); + SekMapMemory(deco16_pf_ram[2], 0x154000, 0x154fff, SM_RAM); + SekMapMemory(deco16_pf_ram[3], 0x156000, 0x156fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[2], 0x15c000, 0x15c7ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[3], 0x15e000, 0x15e7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x184000, 0x187fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x19c000, 0x19dfff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x1a4000, 0x1a47ff, SM_RAM); + SekSetWriteWordHandler(0, cninja_main_write_word); + SekSetWriteByteHandler(0, cninja_main_write_byte); + SekSetReadWordHandler(0, cninja_main_read_word); + SekSetReadByteHandler(0, cninja_main_read_byte); + SekClose(); + + deco16SoundInit(DrvHucROM, DrvHucRAM, 8055000, 1, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60); + BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 EdrandyInit() +{ + BurnSetRefreshRate(58.00); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x80001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x80000, 5, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0xc0001, 6, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0xc0000, 7, 2)) return 1; + + if (BurnLoadRom(DrvHucROM + 0x00000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00001, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 10, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 11, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x80000, 13, 1)) return 1; + + for (INT32 i = 0; i < 0x40000; i++) { + INT32 n = DrvGfxROM2[i + 0x40000]; + DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000]; + DrvGfxROM2[i + 0x80000] = n; + } + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x000001, 15, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x100000, 16, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x100001, 17, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x200000, 18, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x200001, 19, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x300000, 20, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x300001, 21, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x400000, 22, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x400001, 23, 2)) return 1; + + BurnByteswap(DrvGfxROM3, 0x500000); + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 24, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x40000, 25, 1)) return 1; + + deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1); + deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0); + deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0); + + deco16_sprite_decode(DrvGfxROM3, 0x500000); // 16x16 + } + + deco16Init(0, 0, 1); + deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2); + deco16_set_global_offsets(0, 8); + + deco16_set_color_base(2, 0x200 + 0x000); + deco16_set_color_base(3, 0x200 + 0x300); + deco16_set_bank_callback(2, cninja_bank_callback); + deco16_set_bank_callback(3, cninja_bank_callback); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(deco16_pf_ram[0], 0x144000, 0x144fff, SM_RAM); + SekMapMemory(deco16_pf_ram[1], 0x146000, 0x146fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[0], 0x14c000, 0x14c7ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[1], 0x14e000, 0x14e7ff, SM_RAM); + SekMapMemory(deco16_pf_ram[2], 0x154000, 0x154fff, SM_RAM); + SekMapMemory(deco16_pf_ram[3], 0x156000, 0x156fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[2], 0x15c000, 0x15c7ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[3], 0x15e000, 0x15e7ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x188000, 0x189fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x194000, 0x197fff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x1bc000, 0x1bc7ff, SM_RAM); + SekSetWriteWordHandler(0, cninja_main_write_word); + SekSetWriteByteHandler(0, cninja_main_write_byte); + SekSetReadWordHandler(0, cninja_main_read_word); + SekSetReadByteHandler(0, cninja_main_read_byte); + SekClose(); + + deco16SoundInit(DrvHucROM, DrvHucRAM, 8055000, 1, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60); + BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 MutantfInit() +{ + BurnSetRefreshRate(58.00); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; + + if (BurnLoadRom(DrvHucROM + 0x00000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x00001, 6, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 7, 1)) return 1; + + memcpy (DrvGfxROM0 + 0x50000, DrvGfxROM0 + 0x10000, 0x10000); + memcpy (DrvGfxROM0 + 0x10000, DrvGfxROM1 + 0x00000, 0x40000); + memcpy (DrvGfxROM0 + 0x60000, DrvGfxROM1 + 0x40000, 0x40000); + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x80000, 9, 1)) return 1; + + for (INT32 i = 0; i < 0x40000; i++) { + INT32 n = DrvGfxROM2[i + 0x40000]; + DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000]; + DrvGfxROM2[i + 0x80000] = n; + } + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x000001, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x200000, 11, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x200001, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x400000, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x400001, 15, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM4 + 0x000001, 16, 4)) return 1; + if (BurnLoadRom(DrvGfxROM4 + 0x000003, 17, 4)) return 1; + if (BurnLoadRom(DrvGfxROM4 + 0x000000, 18, 4)) return 1; + if (BurnLoadRom(DrvGfxROM4 + 0x000002, 19, 4)) return 1; + + BurnByteswap(DrvGfxROM3, 0x500000); + BurnByteswap(DrvGfxROM4, 0x040000); + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 20, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x40000, 21, 1)) return 1; + + deco56_decrypt_gfx(DrvGfxROM0, 0xa0000); + deco56_decrypt_gfx(DrvGfxROM1, 0x80000); + + deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x0a0000, 1); + deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0); + deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0); + + deco16_sprite_decode(DrvGfxROM3, 0x500000); // 16x16 + deco16_sprite_decode(DrvGfxROM4, 0x040000); + } + + deco16Init(0, 0, 1); + deco16_set_graphics(DrvGfxROM0, 0xa0000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2); + deco16_set_global_offsets(0, 8); + + deco16_set_color_base(0, 0x000); + deco16_set_color_base(1, 0x300); + deco16_set_color_base(2, 0x200); + deco16_set_color_base(3, 0x400); + deco16_set_bank_callback(0, mutantf_1_bank_callback); + deco16_set_bank_callback(1, mutantf_2_bank_callback); + deco16_set_bank_callback(2, mutantf_1_bank_callback); + deco16_set_bank_callback(3, mutantf_1_bank_callback); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x100000, 0x103fff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x120000, 0x1207ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0x140000, 0x1407ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x160000, 0x161fff, SM_RAM); + SekMapMemory(deco16_pf_ram[0], 0x304000, 0x305fff, SM_RAM); + SekMapMemory(deco16_pf_ram[1], 0x306000, 0x307fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[0], 0x308000, 0x3087ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[1], 0x30a000, 0x30a7ff, SM_RAM); + SekMapMemory(deco16_pf_ram[2], 0x314000, 0x315fff, SM_RAM); + SekMapMemory(deco16_pf_ram[3], 0x316000, 0x317fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[2], 0x318000, 0x3187ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[3], 0x31a000, 0x31a7ff, SM_RAM); + SekSetWriteWordHandler(0, mutantf_main_write_word); + SekSetWriteByteHandler(0, mutantf_main_write_byte); + SekSetReadWordHandler(0, mutantf_main_read_word); + SekSetReadByteHandler(0, mutantf_main_read_byte); + SekClose(); + + deco16SoundInit(DrvHucROM, DrvHucRAM, 8055000, 0, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 CninjablInit() +{ + BurnSetRefreshRate(58.00); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(Drv68KROM + 0x80000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; + + UINT8 *tmp = (UINT8*)malloc(0x400000); + + if (BurnLoadRom(tmp + 0x00000, 3, 2)) return 1; + if (BurnLoadRom(tmp + 0x00001, 4, 2)) return 1; + BurnByteswap(tmp, 0x400000); + + for (INT32 i = 0; i < 0x200000; i++) tmp[i] ^= 0xff; + + memcpy (DrvGfxROM0 + 0x000000, tmp + 0x000000, 0x020000); + memcpy (DrvGfxROM1 + 0x000000, tmp + 0x080000, 0x080000); + memcpy (DrvGfxROM2 + 0x000000, tmp + 0x180000, 0x080000); + memcpy (DrvGfxROM2 + 0x080000, tmp + 0x100000, 0x080000); + memcpy (DrvGfxROM3 + 0x000000, tmp + 0x200000, 0x200000); + + if (tmp) { + free (tmp); + tmp = NULL; + } + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 5, 1)) return 1; + + DrvBootlegCharDecode(DrvGfxROM0, 0x020000); + deco16_sprite_decode(DrvGfxROM1, 0x080000); + deco16_sprite_decode(DrvGfxROM2, 0x100000); + deco16_sprite_decode(DrvGfxROM3, 0x200000); + } + + deco16Init(0, 1, 1); + deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2); + deco16_set_global_offsets(0, 8); + deco16_set_scroll_offs(3, 1, 2, 0); + deco16_set_scroll_offs(2, 1, 2, 0); + deco16_set_color_base(2, 0x200 + 0x000); + deco16_set_color_base(3, 0x200 + 0x300); + deco16_set_bank_callback(2, cninja_bank_callback); + deco16_set_bank_callback(3, cninja_bank_callback); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0bffff, SM_ROM); + SekMapMemory(DrvSprRAM, 0x138000, 0x1387ff, SM_RAM); + SekMapMemory(deco16_pf_ram[0], 0x144000, 0x144fff, SM_RAM); + SekMapMemory(deco16_pf_ram[1], 0x146000, 0x146fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[0], 0x14c000, 0x14c7ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[1], 0x14e000, 0x14e7ff, SM_RAM); + SekMapMemory(deco16_pf_ram[2], 0x154000, 0x154fff, SM_RAM); + SekMapMemory(deco16_pf_ram[3], 0x156000, 0x156fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[2], 0x15c000, 0x15c7ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[3], 0x15e000, 0x15e7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x180000, 0x187fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x19c000, 0x19dfff, SM_RAM); + SekSetWriteWordHandler(0, cninja_main_write_word); + SekSetWriteByteHandler(0, cninja_main_write_byte); + SekSetReadWordHandler(0, cninja_main_read_word); + SekSetReadByteHandler(0, cninja_main_read_byte); + SekClose(); + + has_z80 = 1; + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(stoneage_sound_write); + ZetSetReadHandler(stoneage_sound_read); + ZetClose(); + + BurnYM2151Init(3580000); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetAllRoutes(0.45, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 1006875 / 132, 1); + MSM6295Init(1, 2013750 / 132, 1); + MSM6295SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 StoneageInit() +{ + BurnSetRefreshRate(58.00); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x80001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x80000, 5, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00001, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 8, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x80000, 11, 1)) return 1; + + for (INT32 i = 0; i < 0x40000; i++) { + INT32 n = DrvGfxROM2[i + 0x40000]; + DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000]; + DrvGfxROM2[i + 0x80000] = n; + } + + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x000001, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x100000, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x100001, 15, 2)) return 1; + + BurnByteswap(DrvGfxROM3, 0x200000); + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 16, 1)) return 1; + + memset (DrvSndROM1, 0xff, 0x80000); + + deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1); + deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0); + deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0); + + deco16_sprite_decode(DrvGfxROM3, 0x200000); // 16x16 + } + + deco16Init(0, 1, 1); + deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2); + deco16_set_global_offsets(0, 8); + deco16_set_scroll_offs(3, 1, 10, 0); + deco16_set_scroll_offs(1, 1, 10, 0); + deco16_set_scroll_offs(0, 1, -2, 0); + deco16_set_color_base(2, 0x200 + 0x000); + deco16_set_color_base(3, 0x200 + 0x300); + deco16_set_bank_callback(2, cninja_bank_callback); + deco16_set_bank_callback(3, cninja_bank_callback); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0bffff, SM_ROM); + SekMapMemory(deco16_pf_ram[0], 0x144000, 0x144fff, SM_RAM); + SekMapMemory(deco16_pf_ram[1], 0x146000, 0x146fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[0], 0x14c000, 0x14c7ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[1], 0x14e000, 0x14e7ff, SM_RAM); + SekMapMemory(deco16_pf_ram[2], 0x154000, 0x154fff, SM_RAM); + SekMapMemory(deco16_pf_ram[3], 0x156000, 0x156fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[2], 0x15c000, 0x15c7ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[3], 0x15e000, 0x15e7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x184000, 0x187fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x19c000, 0x19dfff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x1a4000, 0x1a47ff, SM_RAM); + SekSetWriteWordHandler(0, cninja_main_write_word); + SekSetWriteByteHandler(0, cninja_main_write_byte); + SekSetReadWordHandler(0, cninja_main_read_word); + SekSetReadByteHandler(0, cninja_main_read_byte); + SekClose(); + + has_z80 = 1; + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(stoneage_sound_write); + ZetSetReadHandler(stoneage_sound_read); + ZetClose(); + + MSM6295Init(0, 1006875 / 132, 1); + MSM6295Init(1, 2013750 / 132, 1); + MSM6295SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH); + + BurnYM2151Init(3580000); + BurnYM2151SetAllRoutes(0.45, BURN_SND_ROUTE_BOTH); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 Robocop2Init() +{ + BurnSetRefreshRate(58.00); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x80001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x80000, 5, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0xc0001, 6, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0xc0000, 7, 2)) return 1; + + if (BurnLoadRom(DrvHucROM + 0x00000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00001, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 10, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x80000, 12, 1)) return 1; + + for (INT32 i = 0; i < 0x40000; i++) { + INT32 n = DrvGfxROM1[i + 0x40000]; + DrvGfxROM1[i + 0x40000] = DrvGfxROM1[i + 0x80000]; + DrvGfxROM1[i + 0x80000] = n; + } + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 13, 1)) return 1; + memcpy (DrvGfxROM2 + 0x000000, DrvGfxROM3 + 0x000000, 0x040000); + memcpy (DrvGfxROM2 + 0x0c0000, DrvGfxROM3 + 0x040000, 0x040000); + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 14, 1)) return 1; + memcpy (DrvGfxROM2 + 0x040000, DrvGfxROM3 + 0x000000, 0x040000); + memcpy (DrvGfxROM2 + 0x100000, DrvGfxROM3 + 0x040000, 0x040000); + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 15, 1)) return 1; + memcpy (DrvGfxROM2 + 0x080000, DrvGfxROM3 + 0x000000, 0x040000); + memcpy (DrvGfxROM2 + 0x140000, DrvGfxROM3 + 0x040000, 0x040000); + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 16, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x000001, 17, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x100000, 18, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x100001, 19, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x200000, 20, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x200001, 21, 2)) return 1; + + BurnByteswap(DrvGfxROM3, 0x300000); + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 22, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x40000, 23, 1)) return 1; + + deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1); + deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x100000, 0); + deco16_tile_decode(DrvGfxROM2, DrvGfxROM4, 0x180000, 2); + deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x180000, 0); + + deco16_sprite_decode(DrvGfxROM3, 0x300000); // 16x16 + } + + deco16Init(0, 0, 1); + deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x100000 * 2, DrvGfxROM2, 0x180000 * 2); + deco16_set_global_offsets(0, 8); + + deco16_set_color_base(2, 0x200 + 0x000); + deco16_set_color_base(3, 0x200 + 0x300); + deco16_set_bank_callback(1, robocop2_bank_callback); + deco16_set_bank_callback(2, robocop2_bank_callback); + deco16_set_bank_callback(3, robocop2_bank_callback); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(deco16_pf_ram[0], 0x144000, 0x144fff, SM_RAM); + SekMapMemory(deco16_pf_ram[1], 0x146000, 0x146fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[0], 0x14c000, 0x14c7ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[1], 0x14e000, 0x14e7ff, SM_RAM); + SekMapMemory(deco16_pf_ram[2], 0x154000, 0x154fff, SM_RAM); + SekMapMemory(deco16_pf_ram[3], 0x156000, 0x156fff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[2], 0x15c000, 0x15c7ff, SM_RAM); + SekMapMemory(deco16_pf_rowscroll[3], 0x15e000, 0x15e7ff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x180000, 0x1807ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x1a8000, 0x1a9fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x1b8000, 0x1bbfff, SM_RAM); + SekSetWriteWordHandler(0, robocop2_main_write_word); + SekSetWriteByteHandler(0, robocop2_main_write_byte); + SekSetReadWordHandler(0, robocop2_main_read_word); + SekSetReadByteHandler(0, robocop2_main_read_byte); + SekClose(); + + deco16SoundInit(DrvHucROM, DrvHucRAM, 8055000, 1, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60); + BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + deco16Exit(); + + SekExit(); + + if (has_z80) { + ZetExit(); + has_z80 = 0; + MSM6295Exit(0); + MSM6295Exit(1); + BurnYM2151Exit(); + } else { + deco16SoundExit(); + } + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + return 0; +} + +static void cninja_draw_sprites() +{ + UINT16 *buffered_spriteram = (UINT16*)DrvSprBuf; + + for (INT32 offs = 0x400 - 4; offs >=0 ; offs -= 4) + { + INT32 x, y, sprite, color, multi, flipx, flipy, inc, flash, mult, pri = 0; + sprite = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 1]); + if (!sprite) + continue; + + x = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 2]); + + switch (x & 0xc000) + { + case 0x0000: pri = 0; break; + case 0x4000: pri = 0xf0; break; + case 0x8000: pri = 0xf0 | 0xcc; break; + case 0xc000: pri = 0xf0 | 0xcc; break; + } + + y = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs]); + flash = y & 0x1000; + if (flash && (nCurrentFrame & 1)) + continue; + + color = (x >> 9) & 0x1f; + + flipx = y & 0x2000; + flipy = y & 0x4000; + multi = (1 << ((y & 0x0600) >> 9)) - 1; + + x = x & 0x01ff; + y = y & 0x01ff; + if (x >= nScreenWidth) x -= 512; + if (y >= 256) y -= 512; + x = 240 - x; + y = 240 - y; + + sprite &= ~multi; + if (flipy) + inc = -1; + else + { + sprite += multi; + inc = 1; + } + + if (*flipscreen) + { + y = 240 - y; + x = (nScreenWidth - 16) - x; + if (flipx) flipx = 0; else flipx = 1; + if (flipy) flipy = 0; else flipy = 1; + mult = 16; + } + else + mult = -16; + + while (multi >= 0) + { + deco16_draw_prio_sprite(pTransDraw, DrvGfxROM3, sprite - multi * inc, (color << 4) + 0x300, x, y + mult * multi, flipx, flipy, pri); + + multi--; + } + } +} + +static void cninjabl_draw_sprites() +{ + UINT16 *buffered_spriteram = (UINT16*)DrvSprBuf; + INT32 offs; + INT32 endoffs; + + endoffs = 0x400 - 4; + for (offs = 0; offs < 0x400 - 4 ; offs += 4) + { + INT32 y = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 1]); + + if (y == 0x180) + { + endoffs = offs; + offs = 0x400 - 4; + } + } + + for (offs = endoffs; offs >=0 ; offs -= 4) + { + INT32 x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri = 0; + + sprite = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 0]); + y = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 1]); + + if (!sprite) + continue; + + x = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 2]); + + switch (x & 0xc000) + { + case 0x0000: pri = 0; break; + case 0x4000: pri = 0xf0; break; + case 0x8000: pri = 0xf0 | 0xcc; break; + case 0xc000: pri = 0xf0 | 0xcc; break; + } + + flash = y & 0x1000; + if (flash && (nCurrentFrame & 1)) + continue; + + colour = (x >> 9) & 0x1f; + + fx = y & 0x2000; + fy = y & 0x4000; + + multi = (1 << ((y & 0x0600) >> 9)) - 1; + + y -= multi * 16; + y += 4; + + x = x & 0x01ff; + y = y & 0x01ff; + if (x >= 256) x -= 512; + if (y >= 256) y -= 512; + x = 240 - x; + y = 240 - y; + + if (fy) + inc = -1; + else + { + sprite += multi; + inc = 1; + } + + if (*flipscreen) + { + y = 240 - y; + x = 240 - x; + if (fx) fx = 0; else fx = 1; + if (fy) fy = 0; else fy = 1; + mult = 16; + } + else + mult = -16; + + while (multi >= 0) + { + deco16_draw_prio_sprite(pTransDraw, DrvGfxROM3, sprite - multi * inc, (colour << 4) + 0x300, x, y + mult * multi, fx, fy, pri); + + multi--; + } + } +} + +static void mutantf_draw_sprites(UINT8 *ram, UINT8 *gfx, INT32 colbank, INT32 gfxbank) +{ + UINT16 *spriteptr = (UINT16*)ram; + + INT32 offs, end, inc; + + if (gfxbank == 4) + { + offs = 0; + end = 0x400; + inc = 4; + } + else + { + offs = 0x3fc; + end = -4; + inc = -4; + } + + while (offs != end) + { + INT32 x, y, sprite, colour, fx, fy, w, h, sx, sy, x_mult, y_mult; + INT32 alpha = 0xff; + + sprite = BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 3]); + if (!sprite) + { + offs += inc; + continue; + } + + sx = BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 1]); + + h = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 2]) & 0xf000) >> 12; + w = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 2]) & 0x0f00) >> 8; + + sy = BURN_ENDIAN_SWAP_INT16(spriteptr[offs]); + if ((sy & 0x2000) && (nCurrentFrame & 1)) + { + offs += inc; + continue; + } + + colour = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 2]) >> 0) & 0x1f; + + if (gfxbank == 4) + { + alpha = 0x80; + colour &= 0xf; + } + + fx = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 0]) & 0x4000); + fy = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 0]) & 0x8000); + + if (*flipscreen) + { + if (fx) fx = 0; else fx = 1; + if (fy) fy = 0; else fy = 1; + + sx = sx & 0x01ff; + sy = sy & 0x01ff; + if (sx > 0x180) sx = -(0x200 - sx); + if (sy > 0x180) sy = -(0x200 - sy); + + if (fx) { x_mult = -16; sx += 16 * w; } else { x_mult = 16; sx -= 16; } + if (fy) { y_mult = -16; sy += 16 * h; } else { y_mult = 16; sy -= 16; } + } + else + { + sx = sx & 0x01ff; + sy = sy & 0x01ff; + if (sx & 0x100) sx = -(0x100 - (sx & 0xff)); + if (sy & 0x100) sy = -(0x100 - (sy & 0xff)); + sx = 304 - sx; + sy = 240 - sy; + if (sx >= 432) sx -= 512; + if (sy >= 384) sy -= 512; + if (fx) { x_mult = -16; sx += 16; } else { x_mult = 16; sx -= 16*w; } + if (fy) { y_mult = -16; sy += 16; } else { y_mult = 16; sy -= 16*h; } + } + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + // needs alpha blending... + deco16_draw_prio_sprite(pTransDraw, gfx, sprite + y + h * x, (colour << 4) + colbank, sx + x_mult * (w-x), sy + y_mult * (h-y), fx, fy, 0); + } + } + offs += inc; + } +} + +static INT32 CninjaDraw() +{ +// if (DrvRecalc) { + deco16_palette_recalculate(DrvPalette, DrvPalRAM); + DrvRecalc = 0; +// } + + deco16_pf12_update(); + deco16_pf34_update(); + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x200; + } + + deco16_clear_prio_map(); + + if (nSpriteEnable & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x01) | DECO16_LAYER_OPAQUE); + if (nSpriteEnable & 2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x02)); + if (nSpriteEnable & 4) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x02) | DECO16_LAYER_TRANSMASK1); + if (nSpriteEnable & 8) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x04) | DECO16_LAYER_TRANSMASK0); + + cninja_draw_sprites(); + + if (nSpriteEnable & 16) deco16_draw_layer(0, pTransDraw, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 CninjablDraw() +{ +// if (DrvRecalc) { + deco16_palette_recalculate(DrvPalette, DrvPalRAM); + DrvRecalc = 0; +// } + + deco16_pf12_update(); + deco16_pf34_update(); + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x200; + } + + deco16_clear_prio_map(); + + if (nSpriteEnable & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x01) | DECO16_LAYER_OPAQUE); + if (nSpriteEnable & 2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x02)); + if (nSpriteEnable & 4) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x02) | DECO16_LAYER_TRANSMASK1); + if (nSpriteEnable & 8) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x04) | DECO16_LAYER_TRANSMASK0); + + cninjabl_draw_sprites(); + + if (nSpriteEnable & 16) deco16_draw_layer(0, pTransDraw, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 EdrandyDraw() +{ +// if (DrvRecalc) { + deco16_palette_recalculate(DrvPalette, DrvPalRAM); + DrvRecalc = 0; +// } + + deco16_pf12_update(); + deco16_pf34_update(); + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0; + } + + deco16_clear_prio_map(); + + if (nSpriteEnable & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x01) | DECO16_LAYER_OPAQUE); + if (nSpriteEnable & 2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x02)); + if (nSpriteEnable & 4) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x04)); + + cninja_draw_sprites(); + + if (nSpriteEnable & 8) deco16_draw_layer(0, pTransDraw, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 Robocop2Draw() +{ +// if (DrvRecalc) { + deco16_palette_recalculate(DrvPalette, DrvPalRAM); + DrvRecalc = 0; +// } + + deco16_pf12_update(); + deco16_pf34_update(); + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x200; + } + + deco16_clear_prio_map(); + + INT32 layer_8bpp = 0; + + if (deco16_priority & 4) + { + deco16_set_color_mask(2, 0); + deco16_set_color_mask(3, 0); + deco16_set_graphics(2, DrvGfxROM4, 0x100000, 16); + layer_8bpp = DECO16_LAYER_8BITSPERPIXEL; + } + else + { + deco16_set_color_mask(2, 0xf); + deco16_set_color_mask(3, 0xf); + deco16_set_graphics(2, DrvGfxROM2, 0x300000, 16); + + if (nSpriteEnable & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_OPAQUE | DECO16_LAYER_PRIORITY(0x01)); + } + + if (deco16_priority & 8) { + if (nSpriteEnable & 2) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x02)); + if (nSpriteEnable & 4) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x04) | layer_8bpp); + } else { + if (nSpriteEnable & 2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x02) | layer_8bpp); + if (nSpriteEnable & 4) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x04)); + } + + cninja_draw_sprites(); + + if (nSpriteEnable & 8) deco16_draw_layer(0, pTransDraw, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + + +static INT32 MutantfDraw() +{ +// if (DrvRecalc) { + deco16_palette_recalculate(DrvPalette, DrvPalRAM); + DrvRecalc = 0; +// } + + deco16_pf12_update(); + deco16_pf34_update(); + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x400; + } + + if (nSpriteEnable & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_OPAQUE); + if (nSpriteEnable & 2) deco16_draw_layer(1, pTransDraw, 0); + if (nSpriteEnable & 4) deco16_draw_layer(2, pTransDraw, 0); + + if (deco16_priority & 1) + { + deco16_clear_prio_map(); + mutantf_draw_sprites(DrvSprBuf, DrvGfxROM3, 0x100, 3); + deco16_clear_prio_map(); + mutantf_draw_sprites(DrvSprBuf1, DrvGfxROM4, 0x700, 4); + } + else + { + deco16_clear_prio_map(); + mutantf_draw_sprites(DrvSprBuf1, DrvGfxROM4, 0x700, 4); + deco16_clear_prio_map(); + mutantf_draw_sprites(DrvSprBuf, DrvGfxROM3, 0x100, 3); + } + + if (nSpriteEnable & 8) deco16_draw_layer(0, pTransDraw, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 CninjaFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + deco16_prot_inputs = DrvInputs; + memset (DrvInputs, 0xff, 2 * sizeof(INT16)); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0); + } + + INT32 nInterleave = 256; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 12000000 / 58, 8055000 / 58 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + h6280NewFrame(); + + SekOpen(0); + h6280Open(0); + + deco16_vblank = 0; + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); + nCyclesDone[1] += h6280Run(nCyclesTotal[1] / nInterleave); + + if (irq_timer == i) { + SekSetIRQLine((irq_mask & 0x10) ? 3 : 4, SEK_IRQSTATUS_ACK); + irq_timer = -1; + } + if (i == 248) deco16_vblank = 0x08; + + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = SoundBuffer + (nSoundBufferPos << 1); + deco16SoundUpdate(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = SoundBuffer + (nSoundBufferPos << 1); + + if (nSegmentLength) { + deco16SoundUpdate(pSoundBuf, nSegmentLength); + } + + for (INT32 i = 0; i < nBurnSoundLen; i++) { + pBurnSoundOut[(i << 1) + 0] += SoundBuffer[(i << 1) + 0]; + pBurnSoundOut[(i << 1) + 1] += SoundBuffer[(i << 1) + 1]; + } + } + + h6280Close(); + SekClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + return 0; +} + +static INT32 MutantfFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + deco16_prot_inputs = DrvInputs; + memset (DrvInputs, 0xff, 2 * sizeof(INT16)); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0); + } + + INT32 nInterleave = 256; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 14000000 / 58, 8055000 / 58 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + h6280NewFrame(); + + SekOpen(0); + h6280Open(0); + + deco16_vblank = 0; + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); + nCyclesDone[1] += h6280Run(nCyclesTotal[1] / nInterleave); + + if (i == 240) deco16_vblank = 0x08; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + deco16SoundUpdate(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + deco16SoundUpdate(pSoundBuf, nSegmentLength); + } + } + + h6280Close(); + SekClose(); + + if (pBurnDraw) { + MutantfDraw(); + } + + return 0; +} + +static INT32 StoneageFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + deco16_prot_inputs = DrvInputs; + memset (DrvInputs, 0xff, 2 * sizeof(INT16)); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0); + } + + INT32 nInterleave = 256; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 12000000 / 58, 3579545 / 58 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + deco16_vblank = 0; + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); + nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave); + + if (irq_timer == i) { + SekSetIRQLine((irq_mask & 0x10) ? 3 : 4, SEK_IRQSTATUS_ACK); + irq_timer = -1; + } + if (i == 248) deco16_vblank = 0x08; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + MSM6295Render(1, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + MSM6295Render(1, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029722; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + + deco16SoundScan(nAction, pnMin); + + deco16Scan(); + + SCAN_VAR(scanline); + SCAN_VAR(irq_mask); + SCAN_VAR(irq_timer); + + SCAN_VAR(DrvOkiBank); + DrvYM2151WritePort(0, DrvOkiBank); + } + + return 0; +} + +static INT32 StoneageScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029722; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + MSM6295Scan(1, nAction); + + deco16Scan(); + + SCAN_VAR(scanline); + SCAN_VAR(irq_mask); + SCAN_VAR(irq_timer); + + SCAN_VAR(DrvOkiBank); + } + + return 0; +} + + +// Caveman Ninja (World ver 4) + +static struct BurnRomInfo cninjaRomDesc[] = { + { "gn-02-3.1k", 0x020000, 0x39aea12a, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "gn-05-2.3k", 0x020000, 0x0f4360ef, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gn-01-2.1j", 0x020000, 0xf740ef7e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "gn-04-2.3j", 0x020000, 0xc98fcb62, 1 | BRF_PRG | BRF_ESS }, // 3 + { "gn-00.rom", 0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, // 4 + { "gn-03.rom", 0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "gl-07.rom", 0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code + + { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters + { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 + + { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles + + { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles + { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 + + { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites + { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 + { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 + { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 + + { "gl-06.rom", 0x020000, 0xd92e519d, 7 | BRF_SND }, // 16 OKI M6295 Samples 0 + + { "mag-07.rom", 0x080000, 0x08eb5264, 8 | BRF_SND }, // 17 OKI M6295 Samples 1 + + { "mb7122h.7v", 0x000400, 0xa1267336, 0 | BRF_OPT }, // 18 Unused PROMs +}; + +STD_ROM_PICK(cninja) +STD_ROM_FN(cninja) + +struct BurnDriver BurnDrvCninja = { + "cninja", NULL, NULL, NULL, "1991", + "Caveman Ninja (World ver 4)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, + NULL, cninjaRomInfo, cninjaRomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, + CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + +// Caveman Ninja (alternate) + +static struct BurnRomInfo cninjaaRomDesc[] = { + { "1.1k", 0x020000, 0xa6c40959, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "4.3k", 0x020000, 0x2e01d1fd, 1 | BRF_PRG | BRF_ESS }, // 1 + { "2.2j", 0x020000, 0x18f0527c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "5.3j", 0x020000, 0xea4b6d53, 1 | BRF_PRG | BRF_ESS }, // 3 + { "gn-00.rom", 0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, // 4 + { "gn-03.rom", 0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "gl-07.rom", 0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code + + { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters + { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 + + { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles + + { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles + { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 + + { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites + { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 + { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 + { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 + + { "gl-06.rom", 0x020000, 0xd92e519d, 7 | BRF_SND }, // 16 OKI M6295 Samples 0 + + { "mag-07.rom", 0x080000, 0x08eb5264, 8 | BRF_SND }, // 17 OKI M6295 Samples 1 + + { "mb7122h.7v", 0x000400, 0xa1267336, 0 | BRF_OPT }, // 18 Unused PROMs +}; + +STD_ROM_PICK(cninjaa) +STD_ROM_FN(cninjaa) + +struct BurnDriver BurnDrvCninjaa = { + "cninjaa", "cninja", NULL, NULL, "1991", + "Caveman Ninja (alternate)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, + NULL, cninjaaRomInfo, cninjaaRomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, + CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + + +// Caveman Ninja (World ver 1) + +static struct BurnRomInfo cninja1RomDesc[] = { + { "gn-02.1k", 0x020000, 0xccc59524, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "gn-05.3k", 0x020000, 0xa002cbe4, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gn-01.1j", 0x020000, 0x18f0527c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "gn-04.3j", 0x020000, 0xea4b6d53, 1 | BRF_PRG | BRF_ESS }, // 3 + { "gn-00.rom", 0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, // 4 + { "gn-03.rom", 0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "gl-07.rom", 0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code + + { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters + { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 + + { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles + + { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles + { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 + + { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites + { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 + { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 + { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 + + { "gl-06.rom", 0x020000, 0xd92e519d, 7 | BRF_SND }, // 16 OKI M6295 Samples 0 + + { "mag-07.rom", 0x080000, 0x08eb5264, 8 | BRF_SND }, // 17 OKI M6295 Samples 1 + + { "mb7122h.7v", 0x000400, 0xa1267336, 0 | BRF_OPT }, // 18 Unused PROMs +}; + +STD_ROM_PICK(cninja1) +STD_ROM_FN(cninja1) + +struct BurnDriver BurnDrvCninja1 = { + "cninja1", "cninja", NULL, NULL, "1991", + "Caveman Ninja (World ver 1)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, + NULL, cninja1RomInfo, cninja1RomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, + CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + + +// Caveman Ninja (US ver 4) + +static struct BurnRomInfo cninjauRomDesc[] = { + { "gm-02-3.1k", 0x020000, 0xd931c3b1, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "gm-05-2.3k", 0x020000, 0x7417d3fb, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gm-01-2.1j", 0x020000, 0x72041f7e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "gm-04-2.3j", 0x020000, 0x2104d005, 1 | BRF_PRG | BRF_ESS }, // 3 + { "gn-00.rom", 0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, // 4 + { "gn-03.rom", 0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "gl-07.rom", 0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code + + { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters + { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 + + { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles + + { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles + { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 + + { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites + { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 + { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 + { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 + + { "gl-06.rom", 0x020000, 0xd92e519d, 7 | BRF_SND }, // 16 OKI M6295 Samples 0 + + { "mag-07.rom", 0x080000, 0x08eb5264, 8 | BRF_SND }, // 17 OKI M6295 Samples 1 + + { "mb7122h.7v", 0x000400, 0xa1267336, 0 | BRF_OPT }, // 18 Unused PROMs +}; + +STD_ROM_PICK(cninjau) +STD_ROM_FN(cninjau) + +struct BurnDriver BurnDrvCninjau = { + "cninjau", "cninja", NULL, NULL, "1991", + "Caveman Ninja (US ver 4)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, + NULL, cninjauRomInfo, cninjauRomName, NULL, NULL, DrvInputInfo, CninjauDIPInfo, + CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + + +// Tatakae Genshizin Joe & Mac (Japan ver 1) + +static struct BurnRomInfo joemacRomDesc[] = { + { "gl-02-2.1k", 0x020000, 0x80da12e2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "gl-05-2.3k", 0x020000, 0xfe4dbbbb, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gl-01-2.1j", 0x020000, 0x0b245307, 1 | BRF_PRG | BRF_ESS }, // 2 + { "gl-04-2.3j", 0x020000, 0x1b331f61, 1 | BRF_PRG | BRF_ESS }, // 3 + { "gn-00.rom", 0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, // 4 + { "gn-03.rom", 0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "gl-07.rom", 0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code + + { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters + { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 + + { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles + + { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles + { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 + + { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites + { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 + { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 + { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 + + { "gl-06.rom", 0x020000, 0xd92e519d, 7 | BRF_SND }, // 16 OKI M6295 Samples 0 + + { "mag-07.rom", 0x080000, 0x08eb5264, 8 | BRF_SND }, // 17 OKI M6295 Samples 1 + + { "mb7122h.7v", 0x000400, 0xa1267336, 0 | BRF_OPT }, // 18 Unused PROMs +}; + +STD_ROM_PICK(joemac) +STD_ROM_FN(joemac) + +struct BurnDriver BurnDrvJoemac = { + "joemac", "cninja", NULL, NULL, "1991", + "Tatakae Genshizin Joe & Mac (Japan ver 1)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, + NULL, joemacRomInfo, joemacRomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, + CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + + +// Stoneage (bootleg of Caveman Ninja) + +static struct BurnRomInfo stoneageRomDesc[] = { + { "sa_1_019.bin", 0x020000, 0x7fb8c44f, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "sa_1_033.bin", 0x020000, 0x961c752b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "sa_1_018.bin", 0x020000, 0xa4043022, 1 | BRF_PRG | BRF_ESS }, // 2 + { "sa_1_032.bin", 0x020000, 0xf52a3286, 1 | BRF_PRG | BRF_ESS }, // 3 + { "sa_1_017.bin", 0x020000, 0x08d6397a, 1 | BRF_PRG | BRF_ESS }, // 4 + { "sa_1_031.bin", 0x020000, 0x103079f5, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "sa_1_012.bin", 0x010000, 0x56058934, 2 | BRF_PRG | BRF_ESS }, // 6 Huc6280 Code + + { "gl-08.rom", 0x010000, 0x33a2b400, 3 | BRF_GRA }, // 7 Characters + { "gl-09.rom", 0x010000, 0x5a2d4752, 3 | BRF_GRA }, // 8 + + { "mag-02.rom", 0x080000, 0xde89c69a, 4 | BRF_GRA }, // 9 Foreground Tiles + + { "mag-00.rom", 0x080000, 0xa8f05d33, 5 | BRF_GRA }, // 10 Background Tiles + { "mag-01.rom", 0x080000, 0x5b399eed, 5 | BRF_GRA }, // 11 + + { "mag-03.rom", 0x080000, 0x2220eb9f, 6 | BRF_GRA }, // 12 Sprites + { "mag-05.rom", 0x080000, 0x56a53254, 6 | BRF_GRA }, // 13 + { "mag-04.rom", 0x080000, 0x144b94cc, 6 | BRF_GRA }, // 14 + { "mag-06.rom", 0x080000, 0x82d44749, 6 | BRF_GRA }, // 15 + + { "sa_1_069.bin", 0x040000, 0x2188f3ca, 7 | BRF_SND }, // 16 OKI M6295 Samples +}; + +STD_ROM_PICK(stoneage) +STD_ROM_FN(stoneage) + +struct BurnDriver BurnDrvStoneage = { + "stoneage", "cninja", NULL, NULL, "1991", + "Stoneage (bootleg of Caveman Ninja)\0", NULL, "bootleg", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, + NULL, stoneageRomInfo, stoneageRomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, + StoneageInit, DrvExit, StoneageFrame, CninjaDraw, StoneageScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + + +// Caveman Ninja (bootleg) + +static struct BurnRomInfo cninjablRomDesc[] = { + { "joe mac 3.68k", 0x080000, 0xdc931d80, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "joe mac 4.68k", 0x080000, 0xe8dfe0b5, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "joe mac 5.z80", 0x010000, 0xd791b9d7, 2 | BRF_PRG | BRF_ESS }, // 2 Huc6280 Code + + { "joe mac 1.gfx", 0x200000, 0x17ea5931, 3 | BRF_GRA }, // 3 Graphics (Expanded on init) + { "joe mac 2.gfx", 0x200000, 0xcc95317b, 3 | BRF_GRA }, // 4 + + { "joe mac 6.samples", 0x080000, 0xdbecad83, 4 | BRF_SND }, // 5 OKI M6295 Samples +}; + +STD_ROM_PICK(cninjabl) +STD_ROM_FN(cninjabl) + +struct BurnDriver BurnDrvCninjabl = { + "cninjabl", "cninja", NULL, NULL, "1991", + "Caveman Ninja (bootleg)\0", NULL, "bootleg", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0, + NULL, cninjablRomInfo, cninjablRomName, NULL, NULL, DrvInputInfo, CninjaDIPInfo, + CninjablInit, DrvExit, StoneageFrame, CninjablDraw, StoneageScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + + +// Mutant Fighter (World ver EM-5) + +static struct BurnRomInfo mutantfRomDesc[] = { + { "hd-03-4.2c", 0x020000, 0x94859545, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "hd-00-4.2a", 0x020000, 0x3cdb648f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "hd-04-1.4c", 0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, // 2 + { "hd-01-1.4a", 0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "hd-12.21j", 0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, // 4 Huc6280 Code + + { "hd-06-1.8d", 0x010000, 0x8b7a558b, 3 | BRF_GRA }, // 5 Characters + { "hd-07-1.9d", 0x010000, 0xd2a3d449, 3 | BRF_GRA }, // 6 + + { "maf-00.8a", 0x080000, 0xe56f528d, 4 | BRF_GRA }, // 7 Foreground Tiles + + { "maf-01.9a", 0x080000, 0xc3d5173d, 5 | BRF_GRA }, // 8 Background Tiles + { "maf-02.11a", 0x080000, 0x0b37d849, 5 | BRF_GRA }, // 9 + + { "maf-03.18a", 0x100000, 0xf4366d2c, 6 | BRF_GRA }, // 10 Sprite Bank A + { "maf-04.20a", 0x100000, 0x0c8f654e, 6 | BRF_GRA }, // 11 + { "maf-05.21a", 0x080000, 0xb0cfeb80, 6 | BRF_GRA }, // 12 + { "maf-06.18d", 0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, // 13 + { "maf-07.20d", 0x100000, 0xfd6008a3, 6 | BRF_GRA }, // 14 + { "maf-08.21d", 0x080000, 0xe41cf1e7, 6 | BRF_GRA }, // 15 + + { "hf-08.15a", 0x010000, 0x93b7279f, 7 | BRF_GRA }, // 16 Sprite Bank B + { "hf-09.17a", 0x010000, 0x05e2c074, 7 | BRF_GRA }, // 17 + { "hf-10.15c", 0x010000, 0x9b06f418, 7 | BRF_GRA }, // 18 + { "hf-11.17c", 0x010000, 0x3859a531, 7 | BRF_GRA }, // 19 + + { "maf-10.20l", 0x040000, 0x7c57f48b, 8 | BRF_SND }, // 20 OKI M6295 Samples 0 + + { "maf-09.18l", 0x080000, 0x28e7ed81, 9 | BRF_SND }, // 21 OKI M6295 Samples 1 +}; + +STD_ROM_PICK(mutantf) +STD_ROM_FN(mutantf) + +struct BurnDriver BurnDrvMutantf = { + "mutantf", NULL, NULL, NULL, "1992", + "Mutant Fighter (World ver EM-5)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0, + NULL, mutantfRomInfo, mutantfRomName, NULL, NULL, DrvInputInfo, MutantfDIPInfo, + MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; + + +// Mutant Fighter (World ver EM-4) + +static struct BurnRomInfo mutantf4RomDesc[] = { + { "hd-03-3.2c", 0x020000, 0xe6f53574, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "hd-00-3.2a", 0x020000, 0xd3055454, 1 | BRF_PRG | BRF_ESS }, // 1 + { "hd-04-1.4c", 0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, // 2 + { "hd-01-1.4a", 0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "hd-12.21j", 0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, // 4 Huc6280 Code + + { "hd-06-1.8d", 0x010000, 0x8b7a558b, 3 | BRF_GRA }, // 5 Characters + { "hd-07-1.9d", 0x010000, 0xd2a3d449, 3 | BRF_GRA }, // 6 + + { "maf-00.8a", 0x080000, 0xe56f528d, 4 | BRF_GRA }, // 7 Foreground Tiles + + { "maf-01.9a", 0x080000, 0xc3d5173d, 5 | BRF_GRA }, // 8 Background Tiles + { "maf-02.11a", 0x080000, 0x0b37d849, 5 | BRF_GRA }, // 9 + + { "maf-03.18a", 0x100000, 0xf4366d2c, 6 | BRF_GRA }, // 10 Sprite Bank A + { "maf-04.20a", 0x100000, 0x0c8f654e, 6 | BRF_GRA }, // 11 + { "maf-05.21a", 0x080000, 0xb0cfeb80, 6 | BRF_GRA }, // 12 + { "maf-06.18d", 0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, // 13 + { "maf-07.20d", 0x100000, 0xfd6008a3, 6 | BRF_GRA }, // 14 + { "maf-08.21d", 0x080000, 0xe41cf1e7, 6 | BRF_GRA }, // 15 + + { "hf-08.15a", 0x010000, 0x93b7279f, 7 | BRF_GRA }, // 16 Sprite Bank B + { "hf-09.17a", 0x010000, 0x05e2c074, 7 | BRF_GRA }, // 17 + { "hf-10.15c", 0x010000, 0x9b06f418, 7 | BRF_GRA }, // 18 + { "hf-11.17c", 0x010000, 0x3859a531, 7 | BRF_GRA }, // 19 + + { "maf-10.20l", 0x040000, 0x7c57f48b, 8 | BRF_SND }, // 20 OKI M6295 Samples 0 + + { "maf-09.18l", 0x080000, 0x28e7ed81, 9 | BRF_SND }, // 21 OKI M6295 Samples 1 +}; + +STD_ROM_PICK(mutantf4) +STD_ROM_FN(mutantf4) + +struct BurnDriver BurnDrvMutantf4 = { + "mutantf4", "mutantf", NULL, NULL, "1992", + "Mutant Fighter (World ver EM-4)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0, + NULL, mutantf4RomInfo, mutantf4RomName, NULL, NULL, DrvInputInfo, MutantfDIPInfo, + MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; + + +// Mutant Fighter (World ver EM-3) + +static struct BurnRomInfo mutantf3RomDesc[] = { + { "hd-03-2.2c", 0x020000, 0x0586c4fa, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "hd-00-2.2a", 0x020000, 0x6f8ec48e, 1 | BRF_PRG | BRF_ESS }, // 1 + { "hd-04-1.4c", 0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, // 2 + { "hd-01-1.4a", 0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "hd-12.21j", 0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, // 4 Huc6280 Code + + { "hd-06-1.8d", 0x010000, 0x8b7a558b, 3 | BRF_GRA }, // 5 Characters + { "hd-07-1.9d", 0x010000, 0xd2a3d449, 3 | BRF_GRA }, // 6 + + { "maf-00.8a", 0x080000, 0xe56f528d, 4 | BRF_GRA }, // 7 Foreground Tiles + + { "maf-01.9a", 0x080000, 0xc3d5173d, 5 | BRF_GRA }, // 8 Background Tiles + { "maf-02.11a", 0x080000, 0x0b37d849, 5 | BRF_GRA }, // 9 + + { "maf-03.18a", 0x100000, 0xf4366d2c, 6 | BRF_GRA }, // 10 Sprite Bank A + { "maf-04.20a", 0x100000, 0x0c8f654e, 6 | BRF_GRA }, // 11 + { "maf-05.21a", 0x080000, 0xb0cfeb80, 6 | BRF_GRA }, // 12 + { "maf-06.18d", 0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, // 13 + { "maf-07.20d", 0x100000, 0xfd6008a3, 6 | BRF_GRA }, // 14 + { "maf-08.21d", 0x080000, 0xe41cf1e7, 6 | BRF_GRA }, // 15 + + { "hf-08.15a", 0x010000, 0x93b7279f, 7 | BRF_GRA }, // 16 Sprite Bank B + { "hf-09.17a", 0x010000, 0x05e2c074, 7 | BRF_GRA }, // 17 + { "hf-10.15c", 0x010000, 0x9b06f418, 7 | BRF_GRA }, // 18 + { "hf-11.17c", 0x010000, 0x3859a531, 7 | BRF_GRA }, // 19 + + { "maf-10.20l", 0x040000, 0x7c57f48b, 8 | BRF_SND }, // 20 OKI M6295 Samples 0 + + { "maf-09.18l", 0x080000, 0x28e7ed81, 9 | BRF_SND }, // 21 OKI M6295 Samples 1 +}; + +STD_ROM_PICK(mutantf3) +STD_ROM_FN(mutantf3) + +struct BurnDriver BurnDrvMutantf3 = { + "mutantf3", "mutantf", NULL, NULL, "1992", + "Mutant Fighter (World ver EM-3)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0, + NULL, mutantf3RomInfo, mutantf3RomName, NULL, NULL, DrvInputInfo, MutantfDIPInfo, + MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; + + +// Death Brade (Japan ver JM-3) + +static struct BurnRomInfo deathbrdRomDesc[] = { + { "hf-03-2.2c", 0x020000, 0xfb86fff3, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "hf-00-2.2a", 0x020000, 0x099aa422, 1 | BRF_PRG | BRF_ESS }, // 1 + { "hd-04-1.4c", 0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, // 2 + { "hd-01-1.4a", 0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "hd-12.21j", 0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, // 4 Huc6280 Code + + { "hd-06-1.8d", 0x010000, 0x8b7a558b, 3 | BRF_GRA }, // 5 Characters + { "hd-07-1.9d", 0x010000, 0xd2a3d449, 3 | BRF_GRA }, // 6 + + { "maf-00.8a", 0x080000, 0xe56f528d, 4 | BRF_GRA }, // 7 Foreground Tiles + + { "maf-01.9a", 0x080000, 0xc3d5173d, 5 | BRF_GRA }, // 8 Background Tiles + { "maf-02.11a", 0x080000, 0x0b37d849, 5 | BRF_GRA }, // 9 + + { "maf-03.18a", 0x100000, 0xf4366d2c, 6 | BRF_GRA }, // 10 Sprite Bank A + { "maf-04.20a", 0x100000, 0x0c8f654e, 6 | BRF_GRA }, // 11 + { "maf-05.21a", 0x080000, 0xb0cfeb80, 6 | BRF_GRA }, // 12 + { "maf-06.18d", 0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, // 13 + { "maf-07.20d", 0x100000, 0xfd6008a3, 6 | BRF_GRA }, // 14 + { "maf-08.21d", 0x080000, 0xe41cf1e7, 6 | BRF_GRA }, // 15 + + { "hf-08.15a", 0x010000, 0x93b7279f, 7 | BRF_GRA }, // 16 Sprite Bank B + { "hf-09.17a", 0x010000, 0x05e2c074, 7 | BRF_GRA }, // 17 + { "hf-10.15c", 0x010000, 0x9b06f418, 7 | BRF_GRA }, // 18 + { "hf-11.17c", 0x010000, 0x3859a531, 7 | BRF_GRA }, // 19 + + { "maf-10.20l", 0x040000, 0x7c57f48b, 8 | BRF_SND }, // 20 OKI M6295 Samples 0 + + { "maf-09.18l", 0x080000, 0x28e7ed81, 9 | BRF_SND }, // 21 OKI M6295 Samples 1 +}; + +STD_ROM_PICK(deathbrd) +STD_ROM_FN(deathbrd) + +struct BurnDriver BurnDrvDeathbrd = { + "deathbrd", "mutantf", NULL, NULL, "1992", + "Death Brade (Japan ver JM-3)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0, + NULL, deathbrdRomInfo, deathbrdRomName, NULL, NULL, DrvInputInfo, MutantfDIPInfo, + MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; + + +// The Cliffhanger - Edward Randy (World ver 3) + +static struct BurnRomInfo edrandyRomDesc[] = { + { "gg-00-2.k1", 0x020000, 0xce1ba964, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "gg-04-2.k3", 0x020000, 0x24caed19, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gg-01-2.j1", 0x020000, 0x33677b80, 1 | BRF_PRG | BRF_ESS }, // 2 + { "gg-05-2.j3", 0x020000, 0x79a68ca6, 1 | BRF_PRG | BRF_ESS }, // 3 + { "ge-02.h1", 0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, // 4 + { "ge-06.h3", 0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, // 5 + { "ge-03.f1", 0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, // 6 + { "ge-07.f3", 0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "ge-09.k13", 0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code + + { "gg-10.y6", 0x010000, 0xb96c6cbe, 3 | BRF_GRA }, // 9 Characters + { "gg-11.z6", 0x010000, 0xee567448, 3 | BRF_GRA }, // 10 + + { "mad-02", 0x080000, 0x6c76face, 4 | BRF_GRA }, // 11 Foreground Tiles + + { "mad-00", 0x080000, 0x3735b22d, 5 | BRF_GRA }, // 12 Background Tiles + { "mad-01", 0x080000, 0x7bb13e1c, 5 | BRF_GRA }, // 13 + + { "mad-03", 0x080000, 0xc0bff892, 6 | BRF_GRA }, // 14 Sprites + { "mad-05", 0x080000, 0x3f2ccf95, 6 | BRF_GRA }, // 15 + { "mad-04", 0x080000, 0x464f3eb9, 6 | BRF_GRA }, // 16 + { "mad-06", 0x080000, 0x60871f77, 6 | BRF_GRA }, // 17 + { "mad-07", 0x080000, 0xac03466e, 6 | BRF_GRA }, // 18 + { "mad-08", 0x080000, 0x1b420ec8, 6 | BRF_GRA }, // 19 + { "mad-10", 0x080000, 0x42da8ef0, 6 | BRF_GRA }, // 20 + { "mad-11", 0x080000, 0x03c1f982, 6 | BRF_GRA }, // 21 + { "mad-09", 0x080000, 0x930f4900, 6 | BRF_GRA }, // 22 + { "mad-12", 0x080000, 0xa0bd62b6, 6 | BRF_GRA }, // 23 + + { "ge-08.j13", 0x020000, 0xdfe28c7b, 7 | BRF_SND }, // 24 OKI M6295 Samples 0 + + { "mad-13", 0x080000, 0x6ab28eba, 8 | BRF_SND }, // 25 OKI M6295 Samples 1 + + { "ge-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 26 Unused PROMs +}; + +STD_ROM_PICK(edrandy) +STD_ROM_FN(edrandy) + +struct BurnDriver BurnDrvEdrandy = { + "edrandy", NULL, NULL, NULL, "1990", + "The Cliffhanger - Edward Randy (World ver 3)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, + NULL, edrandyRomInfo, edrandyRomName, NULL, NULL, DrvInputInfo, EdrandyDIPInfo, + EdrandyInit, DrvExit, CninjaFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + + +// The Cliffhanger - Edward Randy (World ver 2) + +static struct BurnRomInfo edrandy2RomDesc[] = { + { "gg00-1.k1", 0x020000, 0xa029cc4a, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "gg04-1.k3", 0x020000, 0x8b7928a4, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gg01-1.j1", 0x020000, 0x84360123, 1 | BRF_PRG | BRF_ESS }, // 2 + { "gg05-1.j3", 0x020000, 0x0bf85d9d, 1 | BRF_PRG | BRF_ESS }, // 3 + { "ge-02.h1", 0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, // 4 + { "ge-06.h3", 0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, // 5 + { "ge-03.f1", 0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, // 6 + { "ge-07.f3", 0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "ge-09.k13", 0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code + + { "gg-10.y6", 0x010000, 0xb96c6cbe, 3 | BRF_GRA }, // 9 Characters + { "gg-11.z6", 0x010000, 0xee567448, 3 | BRF_GRA }, // 10 + + { "mad-02", 0x080000, 0x6c76face, 4 | BRF_GRA }, // 11 Foreground Tiles + + { "mad-00", 0x080000, 0x3735b22d, 5 | BRF_GRA }, // 12 Background Tiles + { "mad-01", 0x080000, 0x7bb13e1c, 5 | BRF_GRA }, // 13 + + { "mad-03", 0x080000, 0xc0bff892, 6 | BRF_GRA }, // 14 Sprites + { "mad-05", 0x080000, 0x3f2ccf95, 6 | BRF_GRA }, // 15 + { "mad-04", 0x080000, 0x464f3eb9, 6 | BRF_GRA }, // 16 + { "mad-06", 0x080000, 0x60871f77, 6 | BRF_GRA }, // 17 + { "mad-07", 0x080000, 0xac03466e, 6 | BRF_GRA }, // 18 + { "mad-08", 0x080000, 0x1b420ec8, 6 | BRF_GRA }, // 19 + { "mad-10", 0x080000, 0x42da8ef0, 6 | BRF_GRA }, // 20 + { "mad-11", 0x080000, 0x03c1f982, 6 | BRF_GRA }, // 21 + { "mad-09", 0x080000, 0x930f4900, 6 | BRF_GRA }, // 22 + { "mad-12", 0x080000, 0xa0bd62b6, 6 | BRF_GRA }, // 23 + + { "ge-08.j13", 0x020000, 0xdfe28c7b, 7 | BRF_SND }, // 24 OKI M6295 Samples 0 + + { "mad-13", 0x080000, 0x6ab28eba, 8 | BRF_SND }, // 25 OKI M6295 Samples 1 + + { "ge-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 26 Unused PROMs +}; + +STD_ROM_PICK(edrandy2) +STD_ROM_FN(edrandy2) + +struct BurnDriver BurnDrvEdrandy2 = { + "edrandy2", "edrandy", NULL, NULL, "1990", + "The Cliffhanger - Edward Randy (World ver 2)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, + NULL, edrandy2RomInfo, edrandy2RomName, NULL, NULL, DrvInputInfo, EdrandcDIPInfo, + EdrandyInit, DrvExit, CninjaFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + + +// The Cliffhanger - Edward Randy (World ver 1) + +static struct BurnRomInfo edrandy1RomDesc[] = { + { "1.k1", 0x020000, 0xf184cdaa, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "5.k3", 0x020000, 0x7e3a4b81, 1 | BRF_PRG | BRF_ESS }, // 1 + { "2.j1", 0x020000, 0x212cd593, 1 | BRF_PRG | BRF_ESS }, // 2 + { "6.j3", 0x020000, 0x4a96fb07, 1 | BRF_PRG | BRF_ESS }, // 3 + { "ge-02.h1", 0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, // 4 + { "ge-06.h3", 0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, // 5 + { "ge-03.f1", 0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, // 6 + { "ge-07.f3", 0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "ge-09.k13", 0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code + + { "ge-10.y6", 0x010000, 0x2528d795, 3 | BRF_GRA }, // 9 Characters + { "ge-11.z6", 0x010000, 0xe34a931e, 3 | BRF_GRA }, // 10 + + { "mad-02", 0x080000, 0x6c76face, 4 | BRF_GRA }, // 11 Foreground Tiles + + { "mad-00", 0x080000, 0x3735b22d, 5 | BRF_GRA }, // 12 Background Tiles + { "mad-01", 0x080000, 0x7bb13e1c, 5 | BRF_GRA }, // 13 + + { "mad-03", 0x080000, 0xc0bff892, 6 | BRF_GRA }, // 14 Sprites + { "mad-05", 0x080000, 0x3f2ccf95, 6 | BRF_GRA }, // 15 + { "mad-04", 0x080000, 0x464f3eb9, 6 | BRF_GRA }, // 16 + { "mad-06", 0x080000, 0x60871f77, 6 | BRF_GRA }, // 17 + { "mad-07", 0x080000, 0xac03466e, 6 | BRF_GRA }, // 18 + { "mad-08", 0x080000, 0x1b420ec8, 6 | BRF_GRA }, // 19 + { "mad-10", 0x080000, 0x42da8ef0, 6 | BRF_GRA }, // 20 + { "mad-11", 0x080000, 0x03c1f982, 6 | BRF_GRA }, // 21 + { "mad-09", 0x080000, 0x930f4900, 6 | BRF_GRA }, // 22 + { "mad-12", 0x080000, 0xa0bd62b6, 6 | BRF_GRA }, // 23 + + { "ge-08.j13", 0x020000, 0xdfe28c7b, 7 | BRF_SND }, // 24 OKI M6295 Samples 0 + + { "mad-13", 0x080000, 0x6ab28eba, 8 | BRF_SND }, // 25 OKI M6295 Samples 1 + + { "ge-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 26 Unused PROMs +}; + +STD_ROM_PICK(edrandy1) +STD_ROM_FN(edrandy1) + +struct BurnDriver BurnDrvEdrandy1 = { + "edrandy1", "edrandy", NULL, NULL, "1990", + "The Cliffhanger - Edward Randy (World ver 1)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, + NULL, edrandy1RomInfo, edrandy1RomName, NULL, NULL, DrvInputInfo, EdrandcDIPInfo, + EdrandyInit, DrvExit, CninjaFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + + +// The Cliffhanger - Edward Randy (Japan ver 3) + +static struct BurnRomInfo edrandyjRomDesc[] = { + { "ge-00-2.k1", 0x020000, 0xb3d2403c, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ge-04-2.k3", 0x020000, 0x8a9624d6, 1 | BRF_PRG | BRF_ESS }, // 1 + { "ge-01-2.j1", 0x020000, 0x84360123, 1 | BRF_PRG | BRF_ESS }, // 2 + { "ge-05-2.j3", 0x020000, 0x0bf85d9d, 1 | BRF_PRG | BRF_ESS }, // 3 + { "ge-02.h1", 0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, // 4 + { "ge-06.h3", 0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, // 5 + { "ge-03.f1", 0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, // 6 + { "ge-07.f3", 0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "ge-09.k13", 0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code + + { "ge-10.y6", 0x010000, 0x2528d795, 3 | BRF_GRA }, // 9 Characters + { "ge-11.z6", 0x010000, 0xe34a931e, 3 | BRF_GRA }, // 10 + + { "mad-02", 0x080000, 0x6c76face, 4 | BRF_GRA }, // 11 Foreground Tiles + + { "mad-00", 0x080000, 0x3735b22d, 5 | BRF_GRA }, // 12 Background Tiles + { "mad-01", 0x080000, 0x7bb13e1c, 5 | BRF_GRA }, // 13 + + { "mad-03", 0x080000, 0xc0bff892, 6 | BRF_GRA }, // 14 Sprites + { "mad-05", 0x080000, 0x3f2ccf95, 6 | BRF_GRA }, // 15 + { "mad-04", 0x080000, 0x464f3eb9, 6 | BRF_GRA }, // 16 + { "mad-06", 0x080000, 0x60871f77, 6 | BRF_GRA }, // 17 + { "mad-07", 0x080000, 0xac03466e, 6 | BRF_GRA }, // 18 + { "mad-08", 0x080000, 0x1b420ec8, 6 | BRF_GRA }, // 19 + { "mad-10", 0x080000, 0x42da8ef0, 6 | BRF_GRA }, // 20 + { "mad-11", 0x080000, 0x03c1f982, 6 | BRF_GRA }, // 21 + { "mad-09", 0x080000, 0x930f4900, 6 | BRF_GRA }, // 22 + { "mad-12", 0x080000, 0xa0bd62b6, 6 | BRF_GRA }, // 23 + + { "ge-08.j13", 0x020000, 0xdfe28c7b, 7 | BRF_SND }, // 24 OKI M6295 Samples 0 + + { "mad-13", 0x080000, 0x6ab28eba, 8 | BRF_SND }, // 25 OKI M6295 Samples 1 + + { "ge-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 26 Unused PROMs +}; + +STD_ROM_PICK(edrandyj) +STD_ROM_FN(edrandyj) + +struct BurnDriver BurnDrvEdrandyj = { + "edrandyj", "edrandy", NULL, NULL, "1990", + "The Cliffhanger - Edward Randy (Japan ver 3)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, + NULL, edrandyjRomInfo, edrandyjRomName, NULL, NULL, DrvInputInfo, EdrandcDIPInfo, + EdrandyInit, DrvExit, CninjaFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800, + 256, 240, 4, 3 +}; + + +// Robocop 2 (Euro/Asia v0.10) + +static struct BurnRomInfo robocop2RomDesc[] = { + { "gq-03.k1", 0x020000, 0xa7e90c28, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "gq-07.k3", 0x020000, 0xd2287ec1, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gq-02.j1", 0x020000, 0x6777b8a0, 1 | BRF_PRG | BRF_ESS }, // 2 + { "gq-06.j3", 0x020000, 0xe11e27b5, 1 | BRF_PRG | BRF_ESS }, // 3 + { "go-01-1.h1", 0x020000, 0xab5356c0, 1 | BRF_PRG | BRF_ESS }, // 4 + { "go-05-1.h3", 0x020000, 0xce21bda5, 1 | BRF_PRG | BRF_ESS }, // 5 + { "go-00.f1", 0x020000, 0xa93369ea, 1 | BRF_PRG | BRF_ESS }, // 6 + { "go-04.f3", 0x020000, 0xee2f6ad9, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "gp-09.k13", 0x010000, 0x4a4e0f8d, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code + + { "gp10-1.y6", 0x010000, 0xd25d719c, 3 | BRF_GRA }, // 9 Characters + { "gp11-1.z6", 0x010000, 0x030ded47, 3 | BRF_GRA }, // 10 + + { "mah-04.z4", 0x080000, 0x9b6ca18c, 4 | BRF_GRA }, // 11 Foreground Tiles + { "mah-03.y4", 0x080000, 0x37894ddc, 4 | BRF_GRA }, // 12 + + { "mah-01.z1", 0x080000, 0x26e0dfff, 5 | BRF_GRA }, // 13 Background Tiles + { "mah-00.y1", 0x080000, 0x7bd69e41, 5 | BRF_GRA }, // 14 + { "mah-02.a1", 0x080000, 0x328a247d, 5 | BRF_GRA }, // 15 + + { "mah-05.y9", 0x080000, 0x6773e613, 6 | BRF_GRA }, // 16 Sprites + { "mah-08.y12", 0x080000, 0x88d310a5, 6 | BRF_GRA }, // 17 + { "mah-06.z9", 0x080000, 0x27a8808a, 6 | BRF_GRA }, // 18 + { "mah-09.z12", 0x080000, 0xa58c43a7, 6 | BRF_GRA }, // 19 + { "mah-07.a9", 0x080000, 0x526f4190, 6 | BRF_GRA }, // 20 + { "mah-10.a12", 0x080000, 0x14b770da, 6 | BRF_GRA }, // 21 + + { "gp-08.j13", 0x020000, 0x365183b1, 7 | BRF_SND }, // 22 OKI M6295 Samples 0 + + { "mah-11.f13", 0x080000, 0x642bc692, 8 | BRF_SND }, // 23 OKI M6295 Samples 1 + + { "go-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 24 Unused PROMs +}; + +STD_ROM_PICK(robocop2) +STD_ROM_FN(robocop2) + +struct BurnDriver BurnDrvRobocop2 = { + "robocop2", NULL, NULL, NULL, "1991", + "Robocop 2 (Euro/Asia v0.10)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, + NULL, robocop2RomInfo, robocop2RomName, NULL, NULL, Robocop2InputInfo, Robocop2DIPInfo, + Robocop2Init, DrvExit, CninjaFrame, Robocop2Draw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; + + +// Robocop 2 (US v0.05) + +static struct BurnRomInfo robocop2uRomDesc[] = { + { "robo03.k1", 0x020000, 0xf4c96cc9, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "robo07.k3", 0x020000, 0x11e53a7c, 1 | BRF_PRG | BRF_ESS }, // 1 + { "robo02.j1", 0x020000, 0xfa086a0d, 1 | BRF_PRG | BRF_ESS }, // 2 + { "robo06.j3", 0x020000, 0x703b49d0, 1 | BRF_PRG | BRF_ESS }, // 3 + { "go-01-1.h1", 0x020000, 0xab5356c0, 1 | BRF_PRG | BRF_ESS }, // 4 + { "go-05-1.h3", 0x020000, 0xce21bda5, 1 | BRF_PRG | BRF_ESS }, // 5 + { "go-00.f1", 0x020000, 0xa93369ea, 1 | BRF_PRG | BRF_ESS }, // 6 + { "go-04.f3", 0x020000, 0xee2f6ad9, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "gp-09.k13", 0x010000, 0x4a4e0f8d, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code + + { "gp10-1.y6", 0x010000, 0xd25d719c, 3 | BRF_GRA }, // 9 Characters + { "gp11-1.z6", 0x010000, 0x030ded47, 3 | BRF_GRA }, // 10 + + { "mah-04.z4", 0x080000, 0x9b6ca18c, 4 | BRF_GRA }, // 11 Foreground Tiles + { "mah-03.y4", 0x080000, 0x37894ddc, 4 | BRF_GRA }, // 12 + + { "mah-01.z1", 0x080000, 0x26e0dfff, 5 | BRF_GRA }, // 13 Background Tiles + { "mah-00.y1", 0x080000, 0x7bd69e41, 5 | BRF_GRA }, // 14 + { "mah-02.a1", 0x080000, 0x328a247d, 5 | BRF_GRA }, // 15 + + { "mah-05.y9", 0x080000, 0x6773e613, 6 | BRF_GRA }, // 16 Sprites + { "mah-08.y12", 0x080000, 0x88d310a5, 6 | BRF_GRA }, // 17 + { "mah-06.z9", 0x080000, 0x27a8808a, 6 | BRF_GRA }, // 18 + { "mah-09.z12", 0x080000, 0xa58c43a7, 6 | BRF_GRA }, // 19 + { "mah-07.a9", 0x080000, 0x526f4190, 6 | BRF_GRA }, // 20 + { "mah-10.a12", 0x080000, 0x14b770da, 6 | BRF_GRA }, // 21 + + { "gp-08.j13", 0x020000, 0x365183b1, 7 | BRF_SND }, // 22 OKI M6295 Samples 0 + + { "mah-11.f13", 0x080000, 0x642bc692, 8 | BRF_SND }, // 23 OKI M6295 Samples 1 + + { "go-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 24 Unused PROMs +}; + +STD_ROM_PICK(robocop2u) +STD_ROM_FN(robocop2u) + +struct BurnDriver BurnDrvRobocop2u = { + "robocop2u", "robocop2", NULL, NULL, "1991", + "Robocop 2 (US v0.05)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, + NULL, robocop2uRomInfo, robocop2uRomName, NULL, NULL, Robocop2InputInfo, Robocop2DIPInfo, + Robocop2Init, DrvExit, CninjaFrame, Robocop2Draw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; + + +// Robocop 2 (Japan v0.11) + +static struct BurnRomInfo robocop2jRomDesc[] = { + { "go-03-1.k1", 0x020000, 0x52506608, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "go-07-1.k3", 0x020000, 0x739cda17, 1 | BRF_PRG | BRF_ESS }, // 1 + { "go-02-1.j1", 0x020000, 0x48c0ace9, 1 | BRF_PRG | BRF_ESS }, // 2 + { "go-06-1.j3", 0x020000, 0x41abec87, 1 | BRF_PRG | BRF_ESS }, // 3 + { "go-01-1.h1", 0x020000, 0xab5356c0, 1 | BRF_PRG | BRF_ESS }, // 4 + { "go-05-1.h3", 0x020000, 0xce21bda5, 1 | BRF_PRG | BRF_ESS }, // 5 + { "go-00.f1", 0x020000, 0xa93369ea, 1 | BRF_PRG | BRF_ESS }, // 6 + { "go-04.f3", 0x020000, 0xee2f6ad9, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "gp-09.k13", 0x010000, 0x4a4e0f8d, 2 | BRF_PRG | BRF_ESS }, // 8 Huc6280 Code + + { "gp10-1.y6", 0x010000, 0xd25d719c, 3 | BRF_GRA }, // 9 Characters + { "gp11-1.z6", 0x010000, 0x030ded47, 3 | BRF_GRA }, // 10 + + { "mah-04.z4", 0x080000, 0x9b6ca18c, 4 | BRF_GRA }, // 11 Foreground Tiles + { "mah-03.y4", 0x080000, 0x37894ddc, 4 | BRF_GRA }, // 12 + + { "mah-01.z1", 0x080000, 0x26e0dfff, 5 | BRF_GRA }, // 13 Background Tiles + { "mah-00.y1", 0x080000, 0x7bd69e41, 5 | BRF_GRA }, // 14 + { "mah-02.a1", 0x080000, 0x328a247d, 5 | BRF_GRA }, // 15 + + { "mah-05.y9", 0x080000, 0x6773e613, 6 | BRF_GRA }, // 16 Sprites + { "mah-08.y12", 0x080000, 0x88d310a5, 6 | BRF_GRA }, // 17 + { "mah-06.z9", 0x080000, 0x27a8808a, 6 | BRF_GRA }, // 18 + { "mah-09.z12", 0x080000, 0xa58c43a7, 6 | BRF_GRA }, // 19 + { "mah-07.a9", 0x080000, 0x526f4190, 6 | BRF_GRA }, // 20 + { "mah-10.a12", 0x080000, 0x14b770da, 6 | BRF_GRA }, // 21 + + { "gp-08.j13", 0x020000, 0x365183b1, 7 | BRF_SND }, // 22 OKI M6295 Samples 0 + + { "mah-11.f13", 0x080000, 0x642bc692, 8 | BRF_SND }, // 23 OKI M6295 Samples 1 + + { "go-12.v7", 0x000400, 0x278f674f, 0 | BRF_OPT }, // 24 Unused PROMs +}; + +STD_ROM_PICK(robocop2j) +STD_ROM_FN(robocop2j) + +struct BurnDriver BurnDrvRobocop2j = { + "robocop2j", "robocop2", NULL, NULL, "1991", + "Robocop 2 (Japan v0.11)\0", NULL, "Data East Corporation", "DECO IC16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0, + NULL, robocop2jRomInfo, robocop2jRomName, NULL, NULL, Robocop2InputInfo, Robocop2DIPInfo, + Robocop2Init, DrvExit, CninjaFrame, Robocop2Draw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/galaxian/d_galaxian.cpp b/src/burn/drv/galaxian/d_galaxian.cpp index 2148cabae..bb024e374 100644 --- a/src/burn/drv/galaxian/d_galaxian.cpp +++ b/src/burn/drv/galaxian/d_galaxian.cpp @@ -1,21351 +1,21343 @@ -#include "gal.h" - -static INT32 ScrambleInit(); - -// Input definitions (alphabetical) -#define A(a, b, c, d) {a, b, (UINT8*)(c), d} -static struct BurnInputInfo Ad2083InputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort1 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort1 + 2, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 0, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort1 + 4, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, -}; - -STDINPUTINFO(Ad2083) - -static struct BurnInputInfo AmidarInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, -}; - -STDINPUTINFO(Amidar) - -static struct BurnInputInfo AnteaterInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort2 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 6, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Anteater) - -static struct BurnInputInfo AnteatergInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort2 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort2 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort2 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort2 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort2 + 3, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Anteaterg) - -static struct BurnInputInfo AnteaterukInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Anteateruk) - -static struct BurnInputInfo AtlantisInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Atlantis) - -static struct BurnInputInfo AzurianInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 1, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 0, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 3, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 2, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 5, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , &GalFakeDip , "dip" }, -}; - -STDINPUTINFO(Azurian) - -static struct BurnInputInfo BagmanmcInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort0 + 2, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 0, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 5, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 3, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 6, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Bagmanmc) - -static struct BurnInputInfo Batman2InputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 7, "p1 fire 2" }, - - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Batman2) - -static struct BurnInputInfo BlkholeInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Blkhole) - -static struct BurnInputInfo BongoInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 5, "p1 up" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 up" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, -}; - -STDINPUTINFO(Bongo) - -static struct BurnInputInfo CalipsoInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - - {"P1 Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , GalInputPort2 + 0, "p1 fire 1" }, - - {"P2 Up" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , GalInputPort0 + 0, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Calipso) - -static struct BurnInputInfo CheckmanjInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort2 + 1, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort2 + 0, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Checkmanj) - -static struct BurnInputInfo CheckmanInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, - {"Start 1/P1 Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 0, "p2 coin" }, - {"Start 2/P1 Fire 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 4, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Checkman) - -static struct BurnInputInfo CkonggInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 6, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Ckongg) - -static struct BurnInputInfo CkongsInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Ckongs) - -static struct BurnInputInfo DambustrInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 0, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort0 + 2, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort1 + 5, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort1 + 4, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort1 + 3, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort1 + 2, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort1 + 1, "p1 fire 2" }, - {"Fire 3" , BIT_DIGITAL , GalInputPort0 + 7, "p1 fire 3" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Dambustr) - -static struct BurnInputInfo DarkplntInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - - {"Left" , BIT_DIGITAL , GalInputPort3 + 0, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort3 + 1, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 2, "p1 fire 2" }, - {"Fire 3" , BIT_DIGITAL , GalInputPort0 + 0, "p1 fire 3" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Darkplnt) - -static struct BurnInputInfo DevilfsgInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Devilfsg) - -static struct BurnInputInfo DevilfshInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Devilfsh) - -static struct BurnInputInfo DingoInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort2 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 5, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Dingo) - -static struct BurnInputInfo DkongjrmInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 5, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Dkongjrm) - -static struct BurnInputInfo DrivfrcgInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort1 + 1, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, -}; - -STDINPUTINFO(Drivfrcg) - -static struct BurnInputInfo ExplorerInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 0, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, -}; - -STDINPUTINFO(Explorer) - -static struct BurnInputInfo FantastcInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Fantastc) - -static struct BurnInputInfo Fourin1InputList[] = { - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"GM Dip 1" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, - {"SC Dip 2" , BIT_DIPSWITCH , GalDip + 4 , "dip" }, - {"GX Dip 3" , BIT_DIPSWITCH , GalDip + 5 , "dip" }, - {"GC Dip 4" , BIT_DIPSWITCH , GalDip + 6 , "dip" }, -}; - -STDINPUTINFO(Fourin1) - -static struct BurnInputInfo FroggInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 7, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Frogg) - -static struct BurnInputInfo FroggerInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Frogger) - -static struct BurnInputInfo FroggermcInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 7, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Froggermc) - -static struct BurnInputInfo GalaxianInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 7, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Galaxian) - -static struct BurnInputInfo GmgalaxInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"GM Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"GM Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"GM Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"GX Dip 1" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, - {"GX Dip 2" , BIT_DIPSWITCH , GalDip + 4 , "dip" }, - {"GX Dip 3" , BIT_DIPSWITCH , GalDip + 5 , "dip" }, - {"Game Select Switch", BIT_DIPSWITCH , &GalFakeDip , "dip" }, -}; - -STDINPUTINFO(Gmgalax) - -static struct BurnInputInfo HotshockInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort1 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort1 + 4, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 0, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort1 + 5, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, -}; - -STDINPUTINFO(Hotshock) - -static struct BurnInputInfo HunchbkgInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, - - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Hunchbkg) - -static struct BurnInputInfo HunchbksInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Hunchbks) - -static struct BurnInputInfo HustlerInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 1, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Hustler) - -static struct BurnInputInfo JumpbugInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort1 + 5, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Jumpbug) - -static struct BurnInputInfo KingballInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 7, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Fake Dip" , BIT_DIPSWITCH , &GalFakeDip , "dip" }, -}; - -STDINPUTINFO(Kingball) - -static struct BurnInputInfo CkongmcInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 1, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Ckongmc) - -static struct BurnInputInfo KongInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort1 + 5, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Kong) - -static struct BurnInputInfo LadybuggInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort2 + 5, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Ladybugg) - -static struct BurnInputInfo LeversInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort1 + 5, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - - {"P2 Up" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , GalInputPort1 + 7, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Levers) - -static struct BurnInputInfo LosttombInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort0 + 0, "p2 start" }, - - {"Left Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, - {"Left Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, - {"left Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Left Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 6, "p1 fire 1" }, - - {"Right Up" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, - {"Right Down" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, - {"Right Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right Right" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Losttomb) - -static struct BurnInputInfo LuctodayInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 7, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Luctoday) - -static struct BurnInputInfo MarsInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"P1 Left Stick Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"P1 Left Stick Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"P1 Left Stick Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"P1 Left Stick Right", BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"P1 Rght Stick Up" , BIT_DIGITAL , GalInputPort2 + 7, "p3 up" }, - {"P1 Rght Stick Down" , BIT_DIGITAL , GalInputPort2 + 5, "p3 down" }, - {"P1 Rght Stick Left" , BIT_DIGITAL , GalInputPort0 + 3, "p3 left" }, - {"P1 Rght Stick Right", BIT_DIGITAL , GalInputPort0 + 2, "p3 right" }, - - {"P2 Left Stick Up" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"P2 Left Stick Down" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"P2 Left Stick Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"P2 Left Stick Right", BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"P2 Rght Stick Up" , BIT_DIGITAL , GalInputPort3 + 7, "p4 up" }, - {"P2 Rght Stick Down" , BIT_DIGITAL , GalInputPort3 + 5, "p4 down" }, - {"P2 Rght Stick Left" , BIT_DIGITAL , GalInputPort1 + 3, "p4 left" }, - {"P2 Rght Stick Right", BIT_DIGITAL , GalInputPort1 + 2, "p4 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 1, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , &GalFakeDip , "dip" }, -}; - -STDINPUTINFO(Mars) - -static struct BurnInputInfo MoonwarInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 2, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 3, "p2 start" }, - - {"Hyper Flip / Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 2" }, - - A("Dial" , BIT_ANALOG_REL, &GalAnalogPort0 , "p1 z-axis" ), - {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort1 + 6, "p1 fire 2" }, - {"Fire 3" , BIT_DIGITAL , GalInputPort1 + 5, "p1 fire 3" }, - - A("Dial (Cocktail)" , BIT_ANALOG_REL, &GalAnalogPort1 , "p2 z-axis" ), - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 fire 1" }, - {"Fire 3 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 5, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Moonwar) - -static struct BurnInputInfo MrkougarInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Mrkougar) - -static struct BurnInputInfo MshuttleInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 5, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Mshuttle) - -static struct BurnInputInfo OmegaInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Omega) - -static struct BurnInputInfo OrbitronInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Orbitron) - -static struct BurnInputInfo Ozon1InputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - - {"P2 Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Ozon1) - -static struct BurnInputInfo PacmanblInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Pacmanbl) - -static struct BurnInputInfo Phoenxp2InputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Phoenxp2) - -static struct BurnInputInfo PicsesInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 0, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Picses) - -static struct BurnInputInfo PorterInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 1, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Porter) - -static struct BurnInputInfo RacknrolInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 5, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Racknrol) - -static struct BurnInputInfo RescueInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort2 + 6, "p2 start" }, - - {"P1 Left Stick Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, - {"P1 Left Stick Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, - {"P1 Left Stick Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"P1 Left Stick Right", BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"P1 Rght Stick Up" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, - {"P1 Rght Stick Down" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, - {"P1 Rght Stick Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"P1 Rght Stick Right", BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 0, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , &GalFakeDip , "dip" }, -}; - -STDINPUTINFO(Rescue) - -static struct BurnInputInfo RockclimInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"P1 Left Stick Up" , BIT_DIGITAL , GalInputPort1 + 4, "p1 up" }, - {"P1 Left Stick Down" , BIT_DIGITAL , GalInputPort1 + 5, "p1 down" }, - {"P1 Left Stick Left" , BIT_DIGITAL , GalInputPort1 + 2, "p1 left" }, - {"P1 Left Stick Right", BIT_DIGITAL , GalInputPort1 + 3, "p1 right" }, - {"P1 Rght Stick Up" , BIT_DIGITAL , GalInputPort0 + 4, "p2 up" }, - {"P1 Rght Stick Down" , BIT_DIGITAL , GalInputPort0 + 5, "p2 down" }, - {"P1 Rght Stick Left" , BIT_DIGITAL , GalInputPort0 + 2, "p2 left" }, - {"P1 Rght Stick Right", BIT_DIGITAL , GalInputPort0 + 3, "p2 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , &GalFakeDip , "dip" }, -}; - -STDINPUTINFO(Rockclim) - -static struct BurnInputInfo ScorpionmcInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, - {"Start 1 / Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2 / Fire 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 5, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 0, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, -}; - -STDINPUTINFO(Scorpionmc) - -static struct BurnInputInfo AracnisInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort1 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 6, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 0, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, -}; - -STDINPUTINFO(Aracnis) - -static struct BurnInputInfo Scramb2InputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 2, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Scramb2) - -static struct BurnInputInfo ScramblbInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 5, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Scramblb) - -static struct BurnInputInfo ScrambleInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Scramble) - -static struct BurnInputInfo SfxInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Sfx) - -static struct BurnInputInfo SkybaseInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort2 + 6, "p1 fire 2" }, - - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 7, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Skybase) - -static struct BurnInputInfo SmooncrsInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Smooncrs) - -static struct BurnInputInfo SpdcoinInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort0 + 3, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Spdcoin) - -static struct BurnInputInfo StratgyxInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Stratgyx) - -static struct BurnInputInfo StreakngInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Streakng) - -static struct BurnInputInfo SuperbonInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort0 + 0, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 3, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort1 + 6, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Superbon) - -static struct BurnInputInfo TazmaniaInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort2 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 0, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 6, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Tazmania) - -static struct BurnInputInfo TazzmangInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1 / Fire 2" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 6, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Tazzmang) - -static struct BurnInputInfo TdpgalInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 7, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Tdpgal) - -static struct BurnInputInfo TheendInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, - - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Theend) - -static struct BurnInputInfo ThepitmInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 5, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Thepitm) - -static struct BurnInputInfo TurtlesInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Turtles) - -static struct BurnInputInfo WarofbugInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Warofbug) - -static struct BurnInputInfo ZigzagInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , GalInputPort0 + 5, "p1 up" }, - {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, - {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 7, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, -}; - -STDINPUTINFO(Zigzag) - -#undef A - -// Dip Switch defintions (alphabetical) -static struct BurnDIPInfo Ad2083DIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x10, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x0d, 0x01, 0x0f, 0x08, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x0f, 0x09, "2 Coins 2 Plays" }, - {0x0d, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0x0f, 0x0a, "2 Coins 3 Plays" }, - {0x0d, 0x01, 0x0f, 0x0b, "2 Coins 4 Plays" }, - {0x0d, 0x01, 0x0f, 0x01, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0x0f, 0x0c, "2 Coins 5 Plays" }, - {0x0d, 0x01, 0x0f, 0x0d, "2 Coins 6 Plays" }, - {0x0d, 0x01, 0x0f, 0x02, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0x0f, 0x0e, "2 Coins 7 Plays" }, - {0x0d, 0x01, 0x0f, 0x0f, "2 Coins 8 Plays" }, - {0x0d, 0x01, 0x0f, 0x03, "1 Coin 4 Plays" }, - {0x0d, 0x01, 0x0f, 0x04, "1 Coin 5 Plays" }, - {0x0d, 0x01, 0x0f, 0x05, "1 Coin 6 Plays" }, - {0x0d, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, - {0x0d, 0x01, 0x0f, 0x07, "1 Coin 8 Plays" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x0d, 0x01, 0xf0, 0x80, "2 Coins 1 Play" }, - {0x0d, 0x01, 0xf0, 0x90, "2 Coins 2 Plays" }, - {0x0d, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0xf0, 0xa0, "2 Coins 3 Plays" }, - {0x0d, 0x01, 0xf0, 0xb0, "2 Coins 4 Plays" }, - {0x0d, 0x01, 0xf0, 0x10, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0xf0, 0xc0, "2 Coins 5 Plays" }, - {0x0d, 0x01, 0xf0, 0xd0, "2 Coins 6 Plays" }, - {0x0d, 0x01, 0xf0, 0x20, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0xf0, 0xe0, "2 Coins 7 Plays" }, - {0x0d, 0x01, 0xf0, 0xf0, "2 Coins 8 Plays" }, - {0x0d, 0x01, 0xf0, 0x30, "1 Coin 4 Plays" }, - {0x0d, 0x01, 0xf0, 0x40, "1 Coin 5 Plays" }, - {0x0d, 0x01, 0xf0, 0x50, "1 Coin 6 Plays" }, - {0x0d, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, - {0x0d, 0x01, 0xf0, 0x70, "1 Coin 8 Plays" }, - - // Dip 4 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x03, 0x03, "2" }, - {0x0e, 0x01, 0x03, 0x02, "3" }, - {0x0e, 0x01, 0x03, 0x01, "4" }, - {0x0e, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x0c, 0x0c, "None" }, - {0x0e, 0x01, 0x0c, 0x08, "100000" }, - {0x0e, 0x01, 0x0c, 0x04, "150000" }, - {0x0e, 0x01, 0x0c, 0x00, "200000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x10, 0x10, "Upright" }, - {0x0e, 0x01, 0x10, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0e, 0x01, 0x20, 0x20, "Off" }, - {0x0e, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0e, 0x01, 0x80, 0x80, "Off" }, - {0x0e, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Ad2083) - -static struct BurnDIPInfo AmidarDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x06, NULL }, - {0x13, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x00, "3" }, - {0x11, 0x01, 0x03, 0x01, "4" }, - {0x11, 0x01, 0x03, 0x02, "5" }, - {0x11, 0x01, 0x03, 0x03, "255" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x12, 0x01, 0x04, 0x04, "30000 50000" }, - {0x12, 0x01, 0x04, 0x00, "50000 50000" }, - - // Dip 4 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x13, 0x01, 0x0f, 0x0b, "4 Coins 1 Play" }, - {0x13, 0x01, 0x0f, 0x05, "3 Coins 1 Play" }, - {0x13, 0x01, 0x0f, 0x0e, "2 Coins 1 Play" }, - {0x13, 0x01, 0x0f, 0x0d, "3 Coins 2 Plays" }, - {0x13, 0x01, 0x0f, 0x07, "4 Coins 3 Plays" }, - {0x13, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, - {0x13, 0x01, 0x0f, 0x03, "3 Coins 4 Plays" }, - {0x13, 0x01, 0x0f, 0x01, "2 Coins 3 Plays" }, - {0x13, 0x01, 0x0f, 0x08, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x0f, 0x09, "2 Coins 5 Plays" }, - {0x13, 0x01, 0x0f, 0x04, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x0f, 0x02, "1 Coin 5 Plays" }, - {0x13, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, - {0x13, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, - {0x13, 0x01, 0x0f, 0x0f, "Free Play" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x13, 0x01, 0xf0, 0xb0, "4 Coins 1 Play" }, - {0x13, 0x01, 0xf0, 0x50, "3 Coins 1 Play" }, - {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Play" }, - {0x13, 0x01, 0xf0, 0xd0, "3 Coins 2 Plays" }, - {0x13, 0x01, 0xf0, 0x70, "4 Coins 3 Plays" }, - {0x13, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, - {0x13, 0x01, 0xf0, 0x30, "3 Coins 4 Plays" }, - {0x13, 0x01, 0xf0, 0x10, "2 Coins 3 Plays" }, - {0x13, 0x01, 0xf0, 0x80, "1 Coin 2 Plays" }, - {0x13, 0x01, 0xf0, 0x90, "2 Coins 5 Plays" }, - {0x13, 0x01, 0xf0, 0x40, "1 Coin 3 Plays" }, - {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, - {0x13, 0x01, 0xf0, 0x20, "1 Coin 5 Plays" }, - {0x13, 0x01, 0xf0, 0xa0, "1 Coin 6 Plays" }, - {0x13, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, - {0x13, 0x01, 0xf0, 0xf0, "Disable All Coins" }, -}; - -STDDIPINFO(Amidar) - -static struct BurnDIPInfo AmidaroDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x02, NULL }, - {0x12, 0xff, 0xff, 0x06, NULL }, - {0x13, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x00, "1" }, - {0x11, 0x01, 0x03, 0x01, "2" }, - {0x11, 0x01, 0x03, 0x02, "3" }, - {0x11, 0x01, 0x03, 0x03, "4" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Level Progression" }, - {0x12, 0x01, 0x02, 0x02, "Slow" }, - {0x12, 0x01, 0x02, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x12, 0x01, 0x04, 0x04, "30000 70000" }, - {0x12, 0x01, 0x04, 0x00, "50000 80000" }, - - // Dip 4 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x13, 0x01, 0x0f, 0x0b, "4 Coins 1 Play" }, - {0x13, 0x01, 0x0f, 0x05, "3 Coins 1 Play" }, - {0x13, 0x01, 0x0f, 0x0e, "2 Coins 1 Play" }, - {0x13, 0x01, 0x0f, 0x0d, "3 Coins 2 Plays" }, - {0x13, 0x01, 0x0f, 0x07, "4 Coins 3 Plays" }, - {0x13, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, - {0x13, 0x01, 0x0f, 0x03, "3 Coins 4 Plays" }, - {0x13, 0x01, 0x0f, 0x01, "2 Coins 3 Plays" }, - {0x13, 0x01, 0x0f, 0x08, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x0f, 0x09, "2 Coins 5 Plays" }, - {0x13, 0x01, 0x0f, 0x04, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x0f, 0x02, "1 Coin 5 Plays" }, - {0x13, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, - {0x13, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, - {0x13, 0x01, 0x0f, 0x0f, "Free Play" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x13, 0x01, 0xf0, 0xb0, "4 Coins 1 Play" }, - {0x13, 0x01, 0xf0, 0x50, "3 Coins 1 Play" }, - {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Play" }, - {0x13, 0x01, 0xf0, 0xd0, "3 Coins 2 Plays" }, - {0x13, 0x01, 0xf0, 0x70, "4 Coins 3 Plays" }, - {0x13, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, - {0x13, 0x01, 0xf0, 0x30, "3 Coins 4 Plays" }, - {0x13, 0x01, 0xf0, 0x10, "2 Coins 3 Plays" }, - {0x13, 0x01, 0xf0, 0x80, "1 Coin 2 Plays" }, - {0x13, 0x01, 0xf0, 0x90, "2 Coins 5 Plays" }, - {0x13, 0x01, 0xf0, 0x40, "1 Coin 3 Plays" }, - {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, - {0x13, 0x01, 0xf0, 0x20, "1 Coin 5 Plays" }, - {0x13, 0x01, 0xf0, 0xa0, "1 Coin 6 Plays" }, - {0x13, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, - {0x13, 0x01, 0xf0, 0xf0, "Disable All Coins" }, -}; - -STDDIPINFO(Amidaro) - -static struct BurnDIPInfo AmidarsDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x01, NULL }, - {0x12, 0xff, 0xff, 0x0a, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x00, "2" }, - {0x11, 0x01, 0x03, 0x01, "3" }, - {0x11, 0x01, 0x03, 0x02, "4" }, - {0x11, 0x01, 0x03, 0x03, "256" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x12, 0x01, 0x02, 0x02, "A 1C/1P B 1C/6P" }, - {0x12, 0x01, 0x02, 0x00, "A 2C/1P B 1C/3P" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x08, 0x08, "Upright" }, - {0x12, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Amidars) - -static struct BurnDIPInfo AmidaruDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x06, NULL }, - {0x13, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x00, "3" }, - {0x11, 0x01, 0x03, 0x01, "4" }, - {0x11, 0x01, 0x03, 0x02, "5" }, - {0x11, 0x01, 0x03, 0x03, "255" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x12, 0x01, 0x04, 0x04, "30000 70000" }, - {0x12, 0x01, 0x04, 0x00, "50000 80000" }, - - // Dip 4 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x13, 0x01, 0x0f, 0x0b, "4 Coins 1 Play" }, - {0x13, 0x01, 0x0f, 0x05, "3 Coins 1 Play" }, - {0x13, 0x01, 0x0f, 0x0e, "2 Coins 1 Play" }, - {0x13, 0x01, 0x0f, 0x0d, "3 Coins 2 Plays" }, - {0x13, 0x01, 0x0f, 0x07, "4 Coins 3 Plays" }, - {0x13, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, - {0x13, 0x01, 0x0f, 0x03, "3 Coins 4 Plays" }, - {0x13, 0x01, 0x0f, 0x01, "2 Coins 3 Plays" }, - {0x13, 0x01, 0x0f, 0x08, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x0f, 0x09, "2 Coins 5 Plays" }, - {0x13, 0x01, 0x0f, 0x04, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x0f, 0x02, "1 Coin 5 Plays" }, - {0x13, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, - {0x13, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, - {0x13, 0x01, 0x0f, 0x0f, "Free Play" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x13, 0x01, 0xf0, 0xb0, "4 Coins 1 Play" }, - {0x13, 0x01, 0xf0, 0x50, "3 Coins 1 Play" }, - {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Play" }, - {0x13, 0x01, 0xf0, 0xd0, "3 Coins 2 Plays" }, - {0x13, 0x01, 0xf0, 0x70, "4 Coins 3 Plays" }, - {0x13, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, - {0x13, 0x01, 0xf0, 0x30, "3 Coins 4 Plays" }, - {0x13, 0x01, 0xf0, 0x10, "2 Coins 3 Plays" }, - {0x13, 0x01, 0xf0, 0x80, "1 Coin 2 Plays" }, - {0x13, 0x01, 0xf0, 0x90, "2 Coins 5 Plays" }, - {0x13, 0x01, 0xf0, 0x40, "1 Coin 3 Plays" }, - {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, - {0x13, 0x01, 0xf0, 0x20, "1 Coin 5 Plays" }, - {0x13, 0x01, 0xf0, 0xa0, "1 Coin 6 Plays" }, - {0x13, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, - {0x13, 0x01, 0xf0, 0xf0, "Disable All Coins" }, -}; - -STDDIPINFO(Amidaru) - -static struct BurnDIPInfo AnteaterDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x02, NULL }, - {0x11, 0xff, 0xff, 0x04, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x10, 0x01, 0x01, 0x00, "3" }, - {0x10, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x10, 0x01, 0x02, 0x00, "Off" }, - {0x10, 0x01, 0x02, 0x02, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x11, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, - {0x11, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, - {0x11, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, - {0x11, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x08, 0x00, "Upright" }, - {0x11, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Anteater) - -static struct BurnDIPInfo AnteatergDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x02, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0f, 0x01, 0x02, 0x00, "A 1C/1P B 1C/5P" }, - {0x0f, 0x01, 0x02, 0x02, "A 2C/1P B 1C/3P" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x0c, 0x00, "3" }, - {0x0f, 0x01, 0x0c, 0x04, "4" }, - {0x0f, 0x01, 0x0c, 0x08, "5" }, - {0x0f, 0x01, 0x0c, 0x0c, "6" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x01, 0x00, "Upright" }, - {0x10, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x10, 0x01, 0x02, 0x00, "Off" }, - {0x10, 0x01, 0x02, 0x02, "On" }, - - // Dip 3 -}; - -STDDIPINFO(Anteaterg) - -static struct BurnDIPInfo AnteaterukDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x02, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x01, 0x00, "Upright" }, - {0x10, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x10, 0x01, 0x02, 0x00, "Off" }, - {0x10, 0x01, 0x02, 0x02, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x11, 0x01, 0x02, 0x00, "A 1C/1P B 1C/5P" }, - {0x11, 0x01, 0x02, 0x02, "A 2C/1P B 1C/3P" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x0c, 0x00, "3" }, - {0x11, 0x01, 0x0c, 0x04, "4" }, - {0x11, 0x01, 0x0c, 0x08, "5" }, - {0x11, 0x01, 0x0c, 0x0c, "6" }, -}; - -STDDIPINFO(Anteateruk) - -static struct BurnDIPInfo ArmorcarDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x02, NULL }, - {0x13, 0xff, 0xff, 0x04, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x12, 0x01, 0x01, 0x00, "3" }, - {0x12, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x13, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, - {0x13, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, - {0x13, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, - {0x13, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x08, 0x00, "Upright" }, - {0x13, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Armorcar) - -static struct BurnDIPInfo AtlantisDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x01, NULL }, - {0x13, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x01, 0x01, "Upright" }, - {0x12, 0x01, 0x01, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x12, 0x01, 0x02, 0x00, "3" }, - {0x12, 0x01, 0x02, 0x02, "5" }, - - // Dip 3 - {0 , 0xfe, 0 , 3 , "Coinage" }, - {0x13, 0x01, 0x0e, 0x0c, "A 1C/3P B 2C/1P" }, - {0x13, 0x01, 0x0e, 0x0e, "A 1C/6P B 1C/1P" }, - {0x13, 0x01, 0x0e, 0x0a, "A 1C/99P B 1C/99P" }, -}; - -STDDIPINFO(Atlantis) - -static struct BurnDIPInfo AtlantisbDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x80, NULL }, - {0x11, 0xff, 0xff, 0x0c, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x10, 0x01, 0x40, 0x40, "2 Coins 1 Play" }, - {0x10, 0x01, 0x40, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x10, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x10, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x11, 0x01, 0x02, 0x00, "Easy" }, - {0x11, 0x01, 0x02, 0x02, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x04, 0x04, "3" }, - {0x11, 0x01, 0x04, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x08, 0x08, "Upright" }, - {0x11, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Atlantisb) - -static struct BurnDIPInfo AzurianDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0f, 0x01, 0x80, 0x00, "3" }, - {0x0f, 0x01, 0x80, 0x80, "5" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x10, 0x01, 0x01, 0x01, "2 Coins 1 Play" }, - {0x10, 0x01, 0x01, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x02, 0x00, "5000" }, - {0x10, 0x01, 0x02, 0x02, "7000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x08, 0x00, "Upright" }, - {0x10, 0x01, 0x08, 0x08, "Cocktail" }, - - // Fake Dip - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x03, 0x03, "Easy" }, - {0x11, 0x01, 0x03, 0x01, "Normal" }, - {0x11, 0x01, 0x03, 0x02, "Hard" }, - {0x11, 0x01, 0x03, 0x00, "Very Hard" }, -}; - -STDDIPINFO(Azurian) - -static struct BurnDIPInfo BagmanmcDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x80, NULL }, - {0x11, 0xff, 0xff, 0x7e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x80, "Upright" }, - {0x10, 0x01, 0x80, 0x00, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x03, "2" }, - {0x11, 0x01, 0x03, 0x02, "3" }, - {0x11, 0x01, 0x03, 0x01, "4" }, - {0x11, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x11, 0x01, 0x04, 0x00, "A 2C/1P B 1C/1P" }, - {0x11, 0x01, 0x04, 0x04, "A 1C/1P B 1C/2P" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x18, 0x18, "Easy" }, - {0x11, 0x01, 0x18, 0x10, "Medium" }, - {0x11, 0x01, 0x18, 0x08, "Hard" }, - {0x11, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x11, 0x01, 0x20, 0x20, "English" }, - {0x11, 0x01, 0x20, 0x00, "French" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x11, 0x01, 0x40, 0x40, "30000" }, - {0x11, 0x01, 0x40, 0x00, "40000" }, -}; - -STDDIPINFO(Bagmanmc) - -static struct BurnDIPInfo Batman2DIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0xc0, NULL }, - {0x0f, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x0e, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - {0x0e, 0x01, 0x40, 0x00, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x0e, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x0e, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0f, 0x01, 0x01, 0x00, "30000" }, - {0x0f, 0x01, 0x01, 0x01, "50000" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0f, 0x01, 0x04, 0x00, "3" }, - {0x0f, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x08, 0x00, "Upright" }, - {0x0f, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Batman2) - -static struct BurnDIPInfo BlkholeDIPList[]= -{ - // Default Values - {0x0a, 0xff, 0xff, 0x00, NULL }, - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x02, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0b, 0x01, 0xc0, 0xc0, "2 Coins 1 Play" }, - {0x0b, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x0b, 0x01, 0xc0, 0x40, "1 Coin 2 Plays" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 3 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0c, 0x01, 0x01, 0x00, "5000" }, - {0x0c, 0x01, 0x01, 0x01, "10000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x02, 0x02, "Upright" }, - {0x0c, 0x01, 0x02, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Blkhole) - -static struct BurnDIPInfo BongoDIPList[]= -{ - // Default Values - {0x0a, 0xff, 0xff, 0x00, NULL }, - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x40, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - - // Dip 4 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0d, 0x01, 0x06, 0x00, "2" }, - {0x0d, 0x01, 0x06, 0x02, "3" }, - {0x0d, 0x01, 0x06, 0x04, "4" }, - {0x0d, 0x01, 0x06, 0x06, "5" }, - - {0 , 0xfe, 0 , 2 , "Infinite Lives" }, - {0x0d, 0x01, 0x08, 0x00, "Off" }, - {0x0d, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0d, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x80, 0x00, "Upright" }, - {0x0d, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(Bongo) - -static struct BurnDIPInfo CalipsoDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x02, NULL }, - {0x0f, 0xff, 0xff, 0x04, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x01, 0x00, "3" }, - {0x0e, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0e, 0x01, 0x02, 0x00, "Off" }, - {0x0e, 0x01, 0x02, 0x02, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0f, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, - {0x0f, 0x01, 0x06, 0x06, "1 Coin 2 Plays" }, - {0x0f, 0x01, 0x06, 0x02, "1 Coin 3 Plays" }, - {0x0f, 0x01, 0x06, 0x00, "1 Coin 4 Plays" }, -}; - -STDDIPINFO(Calipso) - -static struct BurnDIPInfo CatacombDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x40, NULL }, - {0x0d, 0xff, 0xff, 0x04, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x0c, 0x01, 0x80, 0x00, "1 Coin 3 Plays" }, - {0x0c, 0x01, 0x80, 0x80, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0d, 0x01, 0x04, 0x04, "3" }, - {0x0d, 0x01, 0x04, 0x00, "5" }, -}; - -STDDIPINFO(Catacomb) - -static struct BurnDIPInfo CavelonDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x02, NULL }, - {0x13, 0xff, 0xff, 0x0c, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x01, 0x00, "Upright" }, - {0x12, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x12, 0x01, 0x02, 0x02, "A 1C/1P B 1C/6P" }, - {0x12, 0x01, 0x02, 0x00, "A 2C/1P B 1C/3P" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x06, 0x00, "2" }, - {0x13, 0x01, 0x06, 0x04, "3" }, - {0x13, 0x01, 0x06, 0x02, "4" }, - {0x13, 0x01, 0x06, 0x06, "5" }, -}; - -STDDIPINFO(Cavelon) - -static struct BurnDIPInfo CheckmanjDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x12, 0x01, 0x40, 0x40, "A 2C/1P B 1C/3P" }, - {0x12, 0x01, 0x40, 0x00, "A 1C/1P B 1C/6P" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x80, 0x00, "Upright" }, - {0x12, 0x01, 0x80, 0x80, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x00, "3" }, - {0x13, 0x01, 0x03, 0x01, "4" }, - {0x13, 0x01, 0x03, 0x02, "5" }, - {0x13, 0x01, 0x03, 0x03, "6" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x13, 0x01, 0x04, 0x00, "100000" }, - {0x13, 0x01, 0x04, 0x04, "200000" }, - - {0 , 0xfe, 0 , 2 , "Difficulty increases at level"}, - {0x13, 0x01, 0x08, 0x08, "3" }, - {0x13, 0x01, 0x08, 0x00, "5" }, -}; - -STDDIPINFO(Checkmanj) - -static struct BurnDIPInfo CheckmanDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x10, 0x01, 0x40, 0x40, "A 2C/1P B 1C/3P" }, - {0x10, 0x01, 0x40, 0x00, "A 1C/1P B 1C/6P" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x00, "Upright" }, - {0x10, 0x01, 0x80, 0x80, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x00, "3" }, - {0x11, 0x01, 0x03, 0x01, "4" }, - {0x11, 0x01, 0x03, 0x02, "5" }, - {0x11, 0x01, 0x03, 0x03, "6" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x11, 0x01, 0x04, 0x00, "100000" }, - {0x11, 0x01, 0x04, 0x04, "200000" }, - - {0 , 0xfe, 0 , 2 , "Difficulty increases at level"}, - {0x11, 0x01, 0x08, 0x08, "3" }, - {0x11, 0x01, 0x08, 0x00, "5" }, -}; - -STDDIPINFO(Checkman) - -static struct BurnDIPInfo CkonggDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x80, NULL }, - {0x11, 0xff, 0xff, 0x0a, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x10, 0x01, 0x40, 0x00, "1 Coin 2 Plays" }, - {0x10, 0x01, 0x40, 0x40, "1 Coin 4 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x00, "1" }, - {0x11, 0x01, 0x03, 0x01, "2" }, - {0x11, 0x01, 0x03, 0x02, "3" }, - {0x11, 0x01, 0x03, 0x03, "4" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x11, 0x01, 0x08, 0x08, "500000" }, - {0x11, 0x01, 0x08, 0x00, "750000" }, -}; - -STDDIPINFO(Ckongg) - -static struct BurnDIPInfo CkongsDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x02, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x02, 0x02, "Upright" }, - {0x11, 0x01, 0x02, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x04, 0x00, "3" }, - {0x11, 0x01, 0x04, 0x04, "4" }, -}; - -STDDIPINFO(Ckongs) - -static struct BurnDIPInfo DambustrDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Clear Swear Words" }, - {0x0c, 0x01, 0x20, 0x00, "Off" }, - {0x0c, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Second Coin Counter" }, - {0x0d, 0x01, 0x40, 0x00, "Off" }, - {0x0d, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0d, 0x01, 0x80, 0x80, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x80, 0x00, "1 Coin 1 Play" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x03, 0x00, "3" }, - {0x0e, 0x01, 0x03, 0x01, "4" }, - {0x0e, 0x01, 0x03, 0x02, "5" }, - {0x0e, 0x01, 0x03, 0x03, "6" }, - - {0 , 0xfe, 0 , 2 , "Game Test Mode" }, - {0x0e, 0x01, 0x04, 0x00, "Off" }, - {0x0e, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Union Jack" }, - {0x0e, 0x01, 0x08, 0x08, "Off" }, - {0x0e, 0x01, 0x08, 0x00, "On" }, -}; - -STDDIPINFO(Dambustr) - -static struct BurnDIPInfo DarkplntDIPList[]= -{ - // Default Values - {0x08, 0xff, 0xff, 0x00, NULL }, - {0x09, 0xff, 0xff, 0x02, NULL }, - {0x0a, 0xff, 0xff, 0x0c, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Bonus Occurrence" }, - {0x09, 0x01, 0x01, 0x00, "Once" }, - {0x09, 0x01, 0x01, 0x01, "Everytime" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x09, 0x01, 0x02, 0x02, "1" }, - {0x09, 0x01, 0x02, 0x00, "2" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0a, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, - {0x0a, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, - {0x0a, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, - {0x0a, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0a, 0x01, 0x08, 0x08, "100000" }, - {0x0a, 0x01, 0x08, 0x00, "200000" }, -}; - -STDDIPINFO(Darkplnt) - -static struct BurnDIPInfo DevilfsgDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0xc0, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x10, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x10, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x10, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x10, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x11, 0x01, 0x01, 0x00, "10000" }, - {0x11, 0x01, 0x01, 0x01, "15000" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x04, 0x00, "4" }, - {0x11, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x08, 0x00, "Upright" }, - {0x11, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Devilfsg) - -static struct BurnDIPInfo DevilfshDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x03, NULL }, - {0x11, 0xff, 0xff, 0x02, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x01, 0x01, "10000" }, - {0x10, 0x01, 0x01, 0x00, "15000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x02, 0x02, "Upright" }, - {0x10, 0x01, 0x02, 0x00, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x02, 0x02, "4" }, - {0x11, 0x01, 0x02, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x11, 0x01, 0x04, 0x04, "2 Coins 1 Play" }, - {0x11, 0x01, 0x04, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x11, 0x01, 0x08, 0x00, "1 Coin 3 Plays" }, - {0x11, 0x01, 0x08, 0x08, "1 Coin 5 Plays" }, -}; - -STDDIPINFO(Devilfsh) - -static struct BurnDIPInfo DingoDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x80, NULL }, - {0x11, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x40, 0x00, "Upright" }, - {0x10, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x10, 0x01, 0x80, 0x40, "A 2C/1P B 1C/3P" }, - {0x10, 0x01, 0x80, 0x80, "A 1C/1P B 1C/5P" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x03, 0x00, "Easy" }, - {0x11, 0x01, 0x03, 0x01, "Medium" }, - {0x11, 0x01, 0x03, 0x02, "Hard" }, - {0x11, 0x01, 0x03, 0x03, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x04, 0x00, "3" }, - {0x11, 0x01, 0x04, 0x04, "4" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x11, 0x01, 0x08, 0x00, "20000" }, - {0x11, 0x01, 0x08, 0x08, "40000" }, -}; - -STDDIPINFO(Dingo) - -static struct BurnDIPInfo DkongjrmDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x08, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0f, 0x01, 0xc0, 0xc0, "3 Coins 1 Play" }, - {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x0f, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Coin Multiplier" }, - {0x10, 0x01, 0x01, 0x00, "x1" }, - {0x10, 0x01, 0x01, 0x01, "x2" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x06, 0x00, "3" }, - {0x10, 0x01, 0x06, 0x02, "4" }, - {0x10, 0x01, 0x06, 0x04, "5" }, - {0x10, 0x01, 0x06, 0x06, "6" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x08, 0x08, "Upright" }, - {0x10, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Dkongjrm) - -static struct BurnDIPInfo DrivfrcgDIPList[]= -{ - // Default Values - {0x07, 0xff, 0xff, 0x00, NULL }, - {0x08, 0xff, 0xff, 0x00, NULL }, - {0x09, 0xff, 0xff, 0x00, NULL }, - {0x0a, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x08, 0x01, 0x40, 0x40, "A 2C/1P B 1C/3P" }, - {0x08, 0x01, 0x40, 0x00, "A 1C/1P B 1C/5P" }, - - // Dip 3 - - // Dip 4 -}; - -STDDIPINFO(Drivfrcg) - -static struct BurnDIPInfo Eagle2DIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x80, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x20, 0x00, "Upright" }, - {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0c, 0x01, 0x40, 0x00, "30000" }, - {0x0c, 0x01, 0x40, 0x40, "50000" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x0c, 0x01, 0x80, 0x80, "English" }, - {0x0c, 0x01, 0x80, 0x00, "Japanese" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x0d, 0x01, 0x0c, 0x00, "Off" }, - {0x0d, 0x01, 0x0c, 0x0c, "On" }, -}; - -STDDIPINFO(Eagle2) - -static struct BurnDIPInfo ExodusDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0xc0, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x40, 0x00, "Off" }, - {0x0b, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x0c, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x0c, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0d, 0x01, 0x01, 0x00, "7000" }, - {0x0d, 0x01, 0x01, 0x01, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0d, 0x01, 0x04, 0x00, "3" }, - {0x0d, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x08, 0x00, "Upright" }, - {0x0d, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Exodus) - -static struct BurnDIPInfo ExplorerDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x0d, 0x01, 0x0f, 0x08, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x0f, 0x09, "2 Coins 2 Plays" }, - {0x0d, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0x0f, 0x0a, "2 Coins 3 Plays" }, - {0x0d, 0x01, 0x0f, 0x0b, "2 Coins 4 Plays" }, - {0x0d, 0x01, 0x0f, 0x01, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0x0f, 0x0c, "2 Coins 5 Plays" }, - {0x0d, 0x01, 0x0f, 0x0d, "2 Coins 6 Plays" }, - {0x0d, 0x01, 0x0f, 0x02, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0x0f, 0x0e, "2 Coins 7 Plays" }, - {0x0d, 0x01, 0x0f, 0x0f, "2 Coins 8 Plays" }, - {0x0d, 0x01, 0x0f, 0x03, "1 Coin 4 Plays" }, - {0x0d, 0x01, 0x0f, 0x04, "1 Coin 5 Plays" }, - {0x0d, 0x01, 0x0f, 0x05, "1 Coin 6 Plays" }, - {0x0d, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, - {0x0d, 0x01, 0x0f, 0x07, "1 Coin 8 Plays" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x0d, 0x01, 0xf0, 0x80, "2 Coins 1 Play" }, - {0x0d, 0x01, 0xf0, 0x90, "2 Coins 2 Plays" }, - {0x0d, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0xf0, 0xa0, "2 Coins 3 Plays" }, - {0x0d, 0x01, 0xf0, 0xb0, "2 Coins 4 Plays" }, - {0x0d, 0x01, 0xf0, 0x10, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0xf0, 0xc0, "2 Coins 5 Plays" }, - {0x0d, 0x01, 0xf0, 0xd0, "2 Coins 6 Plays" }, - {0x0d, 0x01, 0xf0, 0x20, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0xf0, 0xe0, "2 Coins 7 Plays" }, - {0x0d, 0x01, 0xf0, 0xf0, "2 Coins 8 Plays" }, - {0x0d, 0x01, 0xf0, 0x30, "1 Coin 4 Plays" }, - {0x0d, 0x01, 0xf0, 0x40, "1 Coin 5 Plays" }, - {0x0d, 0x01, 0xf0, 0x50, "1 Coin 6 Plays" }, - {0x0d, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, - {0x0d, 0x01, 0xf0, 0x70, "1 Coin 8 Plays" }, - - // Dip 4 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x03, 0x00, "2" }, - {0x0e, 0x01, 0x03, 0x01, "3" }, - {0x0e, 0x01, 0x03, 0x02, "4" }, - {0x0e, 0x01, 0x03, 0x03, "5" }, - - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x0e, 0x01, 0x1c, 0x04, "10000" }, - {0x0e, 0x01, 0x1c, 0x0c, "15000" }, - {0x0e, 0x01, 0x1c, 0x14, "20000" }, - {0x0e, 0x01, 0x1c, 0x1c, "25000" }, - {0x0e, 0x01, 0x1c, 0x00, "30000" }, - {0x0e, 0x01, 0x1c, 0x08, "50000" }, - {0x0e, 0x01, 0x1c, 0x10, "70000" }, - {0x0e, 0x01, 0x1c, 0x18, "80000" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0e, 0x01, 0x80, 0x00, "Off" }, - {0x0e, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Explorer) - -static struct BurnDIPInfo FantastcDIPList[]= -{ - // Default Values - {0x07, 0xff, 0xff, 0x40, NULL }, - {0x08, 0xff, 0xff, 0x00, NULL }, - {0x09, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x07, 0x01, 0x20, 0x00, "Off" }, - {0x07, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Extended Bonus Life" }, - {0x07, 0x01, 0x40, 0x00, "Off" }, - {0x07, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x08, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x08, 0x01, 0xc0, 0x80, "2 Coins 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x08, 0x01, 0x80, 0x00, "3" }, - {0x08, 0x01, 0x80, 0x80, "5" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x09, 0x01, 0x03, 0x00, "Easy" }, - {0x09, 0x01, 0x03, 0x01, "Medium" }, - {0x09, 0x01, 0x03, 0x02, "Hard" }, - {0x09, 0x01, 0x03, 0x03, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x09, 0x01, 0x0c, 0x00, "20000 80000" }, - {0x09, 0x01, 0x0c, 0x04, "30000 80000" }, - {0x09, 0x01, 0x0c, 0x08, "20000 120000" }, - {0x09, 0x01, 0x0c, 0x0c, "30000 120000" }, -}; - -STDDIPINFO(Fantastc) - -static struct BurnDIPInfo FantaziaDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x20, 0x00, "Upright" }, - {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0c, 0x01, 0x40, 0x00, "30000" }, - {0x0c, 0x01, 0x40, 0x40, "50000" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0d, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0d, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0x0c, 0x0c, "Freeplay" }, -}; - -STDDIPINFO(Fantazia) - -static struct BurnDIPInfo Fourin1DIPList[]= -{ - // Defaults - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x00, NULL }, - {0x14, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x20, 0x00, "Upright" }, - {0x0e, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x10, 0x01, 0x04, 0x00, "3" }, - {0x10, 0x01, 0x04, 0x04, "5" }, - - // Ghost Muncher Pt 3 - {0 , 0xfe, 0 , 4 , "Bonus Life (Ghost Muncher)"}, - {0x11, 0x01, 0x03, 0x01, "10000" }, - {0x11, 0x01, 0x03, 0x02, "15000" }, - {0x11, 0x01, 0x03, 0x03, "20000" }, - {0x11, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Coinage (Ghost Muncher)"}, - {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0x00, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - {0x11, 0x01, 0xc0, 0xc0, "Free Play" }, - - // Scramble Pt 2 - {0 , 0xfe, 0 , 2 , "Allow Continue (Scramble)"}, - {0x12, 0x01, 0x08, 0x08, "No" }, - {0x12, 0x01, 0x08, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4 , "Coinage (Scramble)" }, - {0x12, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xc0, 0x00, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xc0, 0xc0, "Free Play" }, - - // Galaxian Pt 5 - {0 , 0xfe, 0 , 4 , "Bonus Life (Galaxian)" }, - {0x13, 0x01, 0x03, 0x01, "4000" }, - {0x13, 0x01, 0x03, 0x02, "5000" }, - {0x13, 0x01, 0x03, 0x03, "7000" }, - {0x13, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 3 , "Coinage (Galaxian)" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "Free Play" }, - - // Galactic Convoy - {0 , 0xfe, 0 , 2 , "Bonus Life (Galactic Convoy)"}, - {0x14, 0x01, 0x01, 0x00, "50000" }, - {0x14, 0x01, 0x01, 0x01, "80000" }, - - {0 , 0xfe, 0 , 3 , "Coinage (Galactic Convoy)"}, - {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x14, 0x01, 0xc0, 0x00, "1 Coin 1 Credit" }, - {0x14, 0x01, 0xc0, 0xc0, "Free Play" }, -}; - -STDDIPINFO(Fourin1) - -static struct BurnDIPInfo FroggDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0xc0, NULL }, - {0x10, 0xff, 0xff, 0x05, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0xc0, 0xc0, "3" }, - {0x0f, 0x01, 0xc0, 0x80, "5" }, - {0x0f, 0x01, 0xc0, 0x40, "7" }, - {0x0f, 0x01, 0xc0, 0x00, "256" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x01, 0x01, "Upright" }, - {0x10, 0x01, 0x01, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x10, 0x01, 0x04, 0x00, "2 Coins 1 Credit" }, - {0x10, 0x01, 0x04, 0x04, "1 Coin 1 Credit" }, -}; - -STDDIPINFO(Frogg) - -static struct BurnDIPInfo FroggerDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x03, NULL }, - {0x10, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x03, 0x03, "3" }, - {0x0f, 0x01, 0x03, 0x02, "5" }, - {0x0f, 0x01, 0x03, 0x01, "7" }, - {0x0f, 0x01, 0x03, 0x00, "256" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x10, 0x01, 0x06, 0x04, "A 2C/1P B 2C/1P C 2C/1P"}, - {0x10, 0x01, 0x06, 0x02, "A 2C/1P B 1C/3P C 2C/1P"}, - {0x10, 0x01, 0x06, 0x06, "A 1C/1P B 1C/1P C 1C/1P"}, - {0x10, 0x01, 0x06, 0x00, "A 1C/1P B 1C/6P C 1C/1P"}, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x08, 0x08, "Upright" }, - {0x10, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Frogger) - -static struct BurnDIPInfo FroggermcDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0xc0, NULL }, - {0x10, 0xff, 0xff, 0x07, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0xc0, 0xc0, "3" }, - {0x0f, 0x01, 0xc0, 0x80, "5" }, - {0x0f, 0x01, 0xc0, 0x40, "7" }, - {0x0f, 0x01, 0xc0, 0x00, "256" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x01, 0x01, "Upright" }, - {0x10, 0x01, 0x01, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x10, 0x01, 0x06, 0x02, "A 2C/1P B 2C/1P C 2C/1P"}, - {0x10, 0x01, 0x06, 0x04, "A 2C/1P B 1C/3P C 2C/1P"}, - {0x10, 0x01, 0x06, 0x06, "A 1C/1P B 1C/1P C 1C/1P"}, - {0x10, 0x01, 0x06, 0x00, "A 1C/1P B 1C/6P C 1C/1P"}, -}; - -STDDIPINFO(Froggermc) - -static struct BurnDIPInfo GalaxianDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x04, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x20, 0x00, "Upright" }, - {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x0d, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x03, 0x00, "7000" }, - {0x0e, 0x01, 0x03, 0x01, "10000" }, - {0x0e, 0x01, 0x03, 0x02, "12000" }, - {0x0e, 0x01, 0x03, 0x03, "20000" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x04, 0x00, "2" }, - {0x0e, 0x01, 0x04, 0x04, "3" }, -}; - -STDDIPINFO(Galaxian) - -static struct BurnDIPInfo GmgalaxDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x40, NULL }, - {0x10, 0xff, 0xff, 0x06, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x01, NULL }, - {0x14, 0xff, 0xff, 0x00, NULL }, - - // Ghost Muncher Dip 1 - {0 , 0xfe, 0 , 2 , "GM - Cabinet" }, - {0x0e, 0x01, 0x20, 0x00, "Upright" }, - {0x0e, 0x01, 0x20, 0x20, "Cocktail" }, - - // Ghost Muncher Dip 2 - {0 , 0xfe, 0 , 4 , "GM - Bonus Life" }, - {0x0f, 0x01, 0xc0, 0x40, "10000" }, - {0x0f, 0x01, 0xc0, 0x80, "15000" }, - {0x0f, 0x01, 0xc0, 0xc0, "20000" }, - {0x0f, 0x01, 0xc0, 0x00, "None" }, - - // Ghost Muncher Dip 3 - {0 , 0xfe, 0 , 4 , "GM - Coinage" }, - {0x10, 0x01, 0x03, 0x00, "2 Coins 1 Play" }, - {0x10, 0x01, 0x03, 0x02, "1 Coin 1 Play" }, - {0x10, 0x01, 0x03, 0x01, "1 Coin 2 Plays" }, - {0x10, 0x01, 0x03, 0x03, "Freeplay" }, - - {0 , 0xfe, 0 , 4 , "GM - Lives" }, - {0x10, 0x01, 0x0c, 0x0c, "1" }, - {0x10, 0x01, 0x0c, 0x08, "2" }, - {0x10, 0x01, 0x0c, 0x04, "3" }, - {0x10, 0x01, 0x0c, 0x00, "4" }, - - // Galaxian Dip 1 - {0 , 0xfe, 0 , 2 , "GX - Cabinet" }, - {0x11, 0x01, 0x20, 0x00, "Upright" }, - {0x11, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "GX - Service Mode" }, - {0x11, 0x01, 0x40, 0x00, "Off" }, - {0x11, 0x01, 0x40, 0x40, "On" }, - - // Galaxian Dip 2 - {0 , 0xfe, 0 , 4 , "GX - Coinage" }, - {0x12, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x12, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x12, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - {0x12, 0x01, 0xc0, 0xc0, "Freeplay" }, - - // Galaxian Dip 3 - {0 , 0xfe, 0 , 4 , "GX - Bonus Life" }, - {0x13, 0x01, 0x03, 0x01, "4000" }, - {0x13, 0x01, 0x03, 0x02, "5000" }, - {0x13, 0x01, 0x03, 0x03, "7000" }, - {0x13, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "GX - Lives" }, - {0x13, 0x01, 0x04, 0x00, "3" }, - {0x13, 0x01, 0x04, 0x04, "5" }, - - // Select switch - {0 , 0xfe, 0 , 2 , "Game Select" }, - {0x14, 0x01, 0x01, 0x00, "Ghost Muncher" }, - {0x14, 0x01, 0x01, 0x01, "Galaxian" }, -}; - -STDDIPINFO(Gmgalax) - -static struct BurnDIPInfo GteikokbDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0xc0, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x0c, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x0c, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0d, 0x01, 0x01, 0x00, "7000" }, - {0x0d, 0x01, 0x01, 0x01, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0d, 0x01, 0x04, 0x00, "3" }, - {0x0d, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x08, 0x00, "Upright" }, - {0x0d, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Gteikokb) - -static struct BurnDIPInfo Gteikob2DIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0xc0, NULL }, - {0x0d, 0xff, 0xff, 0x08, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x0c, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x0c, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0d, 0x01, 0x01, 0x00, "7000" }, - {0x0d, 0x01, 0x01, 0x01, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0d, 0x01, 0x04, 0x00, "3" }, - {0x0d, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x08, 0x08, "Upright" }, - {0x0d, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Gteikob2) - -static struct BurnDIPInfo HotshockDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x05, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x0d, 0x01, 0xf0, 0x80, "2 Coins 1 Play" }, - {0x0d, 0x01, 0xf0, 0x90, "2 Coins 2 Plays" }, - {0x0d, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0xf0, 0xa0, "2 Coins 3 Plays" }, - {0x0d, 0x01, 0xf0, 0xb0, "2 Coins 4 Plays" }, - {0x0d, 0x01, 0xf0, 0x10, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0xf0, 0xc0, "2 Coins 5 Plays" }, - {0x0d, 0x01, 0xf0, 0xd0, "2 Coins 6 Plays" }, - {0x0d, 0x01, 0xf0, 0x20, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0xf0, 0xe0, "2 Coins 7 Plays" }, - {0x0d, 0x01, 0xf0, 0xf0, "2 Coins 8 Plays" }, - {0x0d, 0x01, 0xf0, 0x30, "1 Coin 4 Plays" }, - {0x0d, 0x01, 0xf0, 0x40, "1 Coin 5 Plays" }, - {0x0d, 0x01, 0xf0, 0x50, "1 Coin 6 Plays" }, - {0x0d, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, - {0x0d, 0x01, 0xf0, 0x70, "1 Coin 8 Plays" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x0d, 0x01, 0x0f, 0x08, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x0f, 0x09, "2 Coins 2 Plays" }, - {0x0d, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0x0f, 0x0a, "2 Coins 3 Plays" }, - {0x0d, 0x01, 0x0f, 0x0b, "2 Coins 4 Plays" }, - {0x0d, 0x01, 0x0f, 0x01, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0x0f, 0x0c, "2 Coins 5 Plays" }, - {0x0d, 0x01, 0x0f, 0x0d, "2 Coins 6 Plays" }, - {0x0d, 0x01, 0x0f, 0x02, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0x0f, 0x0e, "2 Coins 7 Plays" }, - {0x0d, 0x01, 0x0f, 0x0f, "2 Coins 8 Plays" }, - {0x0d, 0x01, 0x0f, 0x03, "1 Coin 4 Plays" }, - {0x0d, 0x01, 0x0f, 0x04, "1 Coin 5 Plays" }, - {0x0d, 0x01, 0x0f, 0x05, "1 Coin 6 Plays" }, - {0x0d, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, - {0x0d, 0x01, 0x0f, 0x07, "1 Coin 8 Plays" }, - - // Dip 4 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x03, 0x00, "2" }, - {0x0e, 0x01, 0x03, 0x01, "3" }, - {0x0e, 0x01, 0x03, 0x02, "4" }, - {0x0e, 0x01, 0x03, 0x03, "5" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x0e, 0x01, 0x04, 0x04, "English" }, - {0x0e, 0x01, 0x04, 0x00, "Italian" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x18, 0x00, "75000" }, - {0x0e, 0x01, 0x18, 0x08, "150000" }, - {0x0e, 0x01, 0x18, 0x10, "200000" }, - {0x0e, 0x01, 0x18, 0x18, "None" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x80, 0x00, "Upright" }, - {0x0e, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(Hotshock) - -static struct BurnDIPInfo HunchbkgDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x01, 0x00, "Upright" }, - {0x0e, 0x01, 0x01, 0x01, "Cocktail" }, -}; - -STDDIPINFO(Hunchbkg) - -static struct BurnDIPInfo HunchbksDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x02, NULL }, - {0x13, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x12, 0x01, 0x01, 0x00, "3" }, - {0x12, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x12, 0x01, 0x02, 0x00, "A 2C/1P B 1C/3P" }, - {0x12, 0x01, 0x02, 0x02, "A 1C/1P B 1C/5P" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x06, 0x06, "10000" }, - {0x13, 0x01, 0x06, 0x04, "20000" }, - {0x13, 0x01, 0x06, 0x02, "40000" }, - {0x13, 0x01, 0x06, 0x00, "80000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x08, 0x08, "Upright" }, - {0x14, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Hunchbks) - -static struct BurnDIPInfo HustlerDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x02, NULL }, - {0x12, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x01, 0x01, "1" }, - {0x11, 0x01, 0x01, 0x00, "2" }, - - {0 , 0xfe, 0 , 2 , "Infinite Lives" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x12, 0x01, 0x06, 0x02, "3 Coins 1 Play" }, - {0x12, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, - {0x12, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, - {0x12, 0x01, 0x06, 0x00, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x08, 0x08, "Upright" }, - {0x12, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Hustler) - -static struct BurnDIPInfo JumpbugDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x20, 0x00, "Upright" }, - {0x0f, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x10, 0x01, 0x40, 0x40, "Easy" }, - {0x10, 0x01, 0x40, 0x00, "Hard" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x01, "3" }, - {0x11, 0x01, 0x03, 0x02, "4" }, - {0x11, 0x01, 0x03, 0x03, "5" }, - {0x11, 0x01, 0x03, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x11, 0x01, 0x0c, 0x04, "A 2C/1P B 2C/1P" }, - {0x11, 0x01, 0x0c, 0x08, "A 2C/1P B 1C/3P" }, - {0x11, 0x01, 0x0c, 0x00, "A 1C/1P B 1C/1P" }, - {0x11, 0x01, 0x0c, 0x0c, "A 1C/1P B 1C/6P" }, -}; - -STDDIPINFO(Jumpbug) - -static struct BurnDIPInfo KingballDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x40, NULL }, - {0x0e, 0xff, 0xff, 0x04, NULL }, - {0x0f, 0xff, 0xff, 0x02, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x20, 0x00, "Upright" }, - {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0xc0, 0xc0, "2 Coins 1 Play" }, - {0x0d, 0x01, 0xc0, 0x40, "1 Coin 1 Play" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0xc0, 0x00, "Freeplay" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x03, 0x00, "10000" }, - {0x0e, 0x01, 0x03, 0x01, "12000" }, - {0x0e, 0x01, 0x03, 0x02, "15000" }, - {0x0e, 0x01, 0x03, 0x03, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x04, 0x00, "2" }, - {0x0e, 0x01, 0x04, 0x04, "3" }, - - // Fake dip - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0f, 0x01, 0x01, 0x00, "Off" }, - {0x0f, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Speech" }, - {0x0f, 0x01, 0x02, 0x00, "Off" }, - {0x0f, 0x01, 0x02, 0x02, "On" }, -}; - -STDDIPINFO(Kingball) - -static struct BurnDIPInfo CkongmcDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x0a, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x03, 0x00, "1" }, - {0x0e, 0x01, 0x03, 0x01, "2" }, - {0x0e, 0x01, 0x03, 0x02, "3" }, - {0x0e, 0x01, 0x03, 0x03, "4" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0e, 0x01, 0x08, 0x08, "500000" }, - {0x0e, 0x01, 0x08, 0x00, "750000" }, -}; - -STDDIPINFO(Ckongmc) - -static struct BurnDIPInfo KongDIPList[]= -{ - // Default Values - {0x08, 0xff, 0xff, 0x00, NULL }, - {0x09, 0xff, 0xff, 0x00, NULL }, - {0x0a, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x08, 0x01, 0x20, 0x00, "Off" }, - {0x08, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "99 Men/Max Timer" }, - {0x08, 0x01, 0x40, 0x00, "Off" }, - {0x08, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x09, 0x01, 0x40, 0x00, "3" }, - {0x09, 0x01, 0x40, 0x40, "5" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x09, 0x01, 0x80, 0x00, "1 Coin 1 Credit" }, - {0x09, 0x01, 0x80, 0x80, "2 Coins 1 Credit" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0a, 0x01, 0x03, 0x00, "10000" }, - {0x0a, 0x01, 0x03, 0x01, "20000" }, - {0x0a, 0x01, 0x03, 0x02, "30000" }, - {0x0a, 0x01, 0x03, 0x03, "None" }, - - {0 , 0xfe, 0 , 2 , "Mode" }, - {0x0a, 0x01, 0x04, 0x04, "Tournament (Harder)" }, - {0x0a, 0x01, 0x04, 0x00, "Normal" }, -}; - -STDDIPINFO(Kong) - -static struct BurnDIPInfo LadybuggDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x40, 0x00, "Upright" }, - {0x10, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x10, 0x01, 0x80, 0x00, "A 1C/1P B 1C/5P" }, - {0x10, 0x01, 0x80, 0x80, "A 2C/1P B 1C/3P" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x03, 0x00, "Easiest" }, - {0x11, 0x01, 0x03, 0x01, "Easy" }, - {0x11, 0x01, 0x03, 0x02, "Hard" }, - {0x11, 0x01, 0x03, 0x03, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x04, 0x00, "3" }, - {0x11, 0x01, 0x04, 0x04, "4" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x11, 0x01, 0x08, 0x00, "20000" }, - {0x11, 0x01, 0x08, 0x08, "40000" }, -}; - -STDDIPINFO(Ladybugg) - -static struct BurnDIPInfo LeversDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x0f, 0x01, 0x08, 0x00, "Off" }, - {0x0f, 0x01, 0x08, 0x08, "On" }, -}; - -STDDIPINFO(Levers) - -static struct BurnDIPInfo LosttombDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x02, NULL }, - {0x10, 0xff, 0xff, 0x04, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x03, 0x02, "3" }, - {0x0f, 0x01, 0x03, 0x01, "5" }, - {0x0f, 0x01, 0x03, 0x00, "Free Play" }, - {0x0f, 0x01, 0x03, 0x03, "Invulnerability" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x10, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, - {0x10, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, - {0x10, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, - {0x10, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, -}; - -STDDIPINFO(Losttomb) - -static struct BurnDIPInfo LuctodayDIPList[]= -{ - // Default Values - {0x07, 0xff, 0xff, 0x00, NULL }, - {0x08, 0xff, 0xff, 0x00, NULL }, - {0x09, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 -}; - -STDDIPINFO(Luctoday) - -static struct BurnDIPInfo MarsDIPList[]= -{ - // Default Values - {0x16, 0xff, 0xff, 0x00, NULL }, - {0x17, 0xff, 0xff, 0x03, NULL }, - {0x18, 0xff, 0xff, 0x0e, NULL }, - {0x19, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x17, 0x01, 0x02, 0x00, "2 Coins 1 Play" }, - {0x17, 0x01, 0x02, 0x02, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x17, 0x01, 0x01, 0x01, "1 Coin 3 Plays" }, - {0x17, 0x01, 0x01, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x18, 0x01, 0x02, 0x02, "Upright" }, - {0x18, 0x01, 0x02, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x18, 0x01, 0x08, 0x08, "3" }, - {0x18, 0x01, 0x08, 0x00, "255" }, -}; - -STDDIPINFO(Mars) - -static struct BurnDIPInfo MimonkeyDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x03, NULL }, - {0x13, 0xff, 0xff, 0xae, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "6" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x13, 0x01, 0x06, 0x00, "3 Coins 1 Play" }, - {0x13, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, - {0x13, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, - {0x13, 0x01, 0x06, 0x02, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x08, 0x08, "Upright" }, - {0x13, 0x01, 0x08, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Infinite Lives" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, -}; - -STDDIPINFO(Mimonkey) - -static struct BurnDIPInfo MimonscoDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x01, NULL }, - {0x13, 0xff, 0xff, 0xae, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "1" }, - {0x12, 0x01, 0x03, 0x02, "2" }, - {0x12, 0x01, 0x03, 0x01, "3" }, - {0x12, 0x01, 0x03, 0x00, "4" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x13, 0x01, 0x06, 0x00, "3 Coins 1 Play" }, - {0x13, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, - {0x13, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, - {0x13, 0x01, 0x06, 0x02, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x08, 0x08, "Upright" }, - {0x13, 0x01, 0x08, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Infinite Lives" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, -}; - -STDDIPINFO(Mimonsco) - -static struct BurnDIPInfo MinefldDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x02, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Starting Level" }, - {0x0e, 0x01, 0x02, 0x00, "1" }, - {0x0e, 0x01, 0x02, 0x02, "3" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0f, 0x01, 0x01, 0x00, "3" }, - {0x0f, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x02, 0x00, "Off" }, - {0x0f, 0x01, 0x02, 0x02, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x10, 0x01, 0x02, 0x00, "1 Coin 1 Play" }, - {0x10, 0x01, 0x02, 0x02, "A 1C/2P B 2C/1P" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x10, 0x01, 0x0c, 0x00, "Easy" }, - {0x10, 0x01, 0x0c, 0x04, "Medium" }, - {0x10, 0x01, 0x0c, 0x08, "Hard" }, - {0x10, 0x01, 0x0c, 0x0c, "Hardest" }, -}; - -STDDIPINFO(Minefld) - -static struct BurnDIPInfo Moonal2DIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x20, 0x00, "Upright" }, - {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x0d, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x03, 0x01, "4000" }, - {0x0e, 0x01, 0x03, 0x02, "5000" }, - {0x0e, 0x01, 0x03, 0x03, "7000" }, - {0x0e, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x04, 0x00, "3" }, - {0x0e, 0x01, 0x04, 0x04, "5" }, -}; - -STDDIPINFO(Moonal2) - -static struct BurnDIPInfo MooncrgxDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0xc0, NULL }, - {0x0d, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x0c, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x0c, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0d, 0x01, 0x01, 0x01, "30000" }, - {0x0d, 0x01, 0x01, 0x00, "50000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x08, 0x00, "Upright" }, - {0x0d, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Mooncrgx) - -static struct BurnDIPInfo MooncrsaDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x80, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x20, 0x00, "Upright" }, - {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0c, 0x01, 0x40, 0x00, "30000" }, - {0x0c, 0x01, 0x40, 0x40, "50000" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x0c, 0x01, 0x80, 0x80, "English" }, - {0x0c, 0x01, 0x80, 0x00, "Japanese" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0x0c, 0x0c, "Freeplay" }, -}; - -STDDIPINFO(Mooncrsa) - -static struct BurnDIPInfo MooncrsgDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x20, 0x00, "Upright" }, - {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0c, 0x01, 0x40, 0x00, "30000" }, - {0x0c, 0x01, 0x40, 0x40, "50000" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0d, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0d, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0x0c, 0x0c, "Freeplay" }, -}; - -STDDIPINFO(Mooncrsg) - -static struct BurnDIPInfo MooncrstDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x80, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x20, 0x00, "Upright" }, - {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0c, 0x01, 0x40, 0x00, "30000" }, - {0x0c, 0x01, 0x40, 0x40, "50000" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x0c, 0x01, 0x80, 0x80, "English" }, - {0x0c, 0x01, 0x80, 0x00, "Japanese" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0d, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0d, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0x0c, 0x0c, "Freeplay" }, -}; - -STDDIPINFO(Mooncrst) - -static struct BurnDIPInfo MoonqsrDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x20, 0x00, "Upright" }, - {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0xc0, 0x00, "Easy" }, - {0x0c, 0x01, 0xc0, 0x40, "Medium" }, - {0x0c, 0x01, 0xc0, 0x80, "Hard" }, - {0x0c, 0x01, 0xc0, 0xc0, "Hardest" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0d, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0d, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0x0c, 0x0c, "Freeplay" }, -}; - -STDDIPINFO(Moonqsr) - -static struct BurnDIPInfo MoonwarDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x03, NULL }, - {0x0f, 0xff, 0xff, 0x0c, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x03, 0x03, "3" }, - {0x0e, 0x01, 0x03, 0x02, "4" }, - {0x0e, 0x01, 0x03, 0x01, "5" }, - {0x0e, 0x01, 0x03, 0x00, "Free Play" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0f, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, - {0x0f, 0x01, 0x06, 0x06, "1 Coin 2 Plays" }, - {0x0f, 0x01, 0x06, 0x02, "1 Coin 3 Plays" }, - {0x0f, 0x01, 0x06, 0x00, "1 Coin 4 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x08, 0x08, "Upright" }, - {0x0f, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Moonwar) - -static struct BurnDIPInfo MoonwaraDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x03, NULL }, - {0x0f, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x03, 0x03, "3" }, - {0x0e, 0x01, 0x03, 0x02, "4" }, - {0x0e, 0x01, 0x03, 0x01, "5" }, - {0x0e, 0x01, 0x03, 0x00, "Free Play" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0f, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, - {0x0f, 0x01, 0x06, 0x04, "1 Coin 2 Plays" }, - {0x0f, 0x01, 0x06, 0x02, "1 Coin 3 Plays" }, - {0x0f, 0x01, 0x06, 0x00, "1 Coin 4 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x08, 0x08, "Upright" }, - {0x0f, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Moonwara) - -static struct BurnDIPInfo MrkougarDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x03, NULL }, - {0x0e, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x0d, 0x01, 0x02, 0x00, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x02, 0x02, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x0d, 0x01, 0x01, 0x01, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0x01, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x02, 0x02, "Upright" }, - {0x0e, 0x01, 0x02, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x04, 0x04, "3" }, - {0x0e, 0x01, 0x04, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0e, 0x01, 0x08, 0x00, "Easy" }, - {0x0e, 0x01, 0x08, 0x08, "Hard" }, -}; - -STDDIPINFO(Mrkougar) - -static struct BurnDIPInfo MshuttleDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x80, NULL }, - {0x0f, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0e, 0x01, 0x40, 0x00, "Off" }, - {0x0e, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x80, 0x80, "Upright" }, - {0x0e, 0x01, 0x80, 0x00, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x03, 0x00, "3" }, - {0x0f, 0x01, 0x03, 0x01, "4" }, - {0x0f, 0x01, 0x03, 0x02, "5" }, - {0x0f, 0x01, 0x03, 0x03, "6" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0f, 0x01, 0x04, 0x00, "20000" }, - {0x0f, 0x01, 0x04, 0x04, "30000" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0e, 0x01, 0x18, 0x18, "3 Coins 1 Play" }, - {0x0e, 0x01, 0x18, 0x10, "3 Coins 1 Play" }, - {0x0e, 0x01, 0x18, 0x08, "2 Coins 1 Play" }, - {0x0e, 0x01, 0x18, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0e, 0x01, 0x60, 0x00, "1 Coin 1 Play" }, - {0x0e, 0x01, 0x60, 0x20, "1 Coin 2 Plays" }, - {0x0e, 0x01, 0x60, 0x40, "1 Coin 3 Plays" }, - {0x0e, 0x01, 0x60, 0x60, "1 Coin 4 Plays" }, -}; - -STDDIPINFO(Mshuttle) - -static struct BurnDIPInfo Newsin7DIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x0c, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x10, 0x01, 0x03, 0x00, "A 1C/1P B 2C/1P" }, - {0x10, 0x01, 0x03, 0x02, "A 1C/3P B 3C/1P" }, - {0x10, 0x01, 0x03, 0x01, "A 1C/2P B 1C/1P" }, - {0x10, 0x01, 0x03, 0x03, "A 1C/4P B 4C/1P" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x02, 0x00, "Upright" }, - {0x11, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x08, 0x08, "3" }, - {0x11, 0x01, 0x08, 0x00, "5" }, -}; - -STDDIPINFO(Newsin7) - -static struct BurnDIPInfo OmegaDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0xc0, NULL }, - {0x0d, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x0c, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x0c, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0d, 0x01, 0x01, 0x00, "10000" }, - {0x0d, 0x01, 0x01, 0x01, "20000" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0d, 0x01, 0x04, 0x00, "3" }, - {0x0d, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x08, 0x00, "Upright" }, - {0x0d, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Omega) - -static struct BurnDIPInfo OrbitronDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x40, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x10, 0x01, 0x60, 0x00, "A 2C/1P B 1C/3P" }, - {0x10, 0x01, 0x60, 0x40, "A 1C/1P B 1C/6P" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x04, 0x04, "2" }, - {0x11, 0x01, 0x04, 0x00, "3" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x08, 0x00, "Upright" }, - {0x11, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Orbitron) - -static struct BurnDIPInfo Ozon1DIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x02, NULL }, - {0x0d, 0xff, 0xff, 0x06, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0c, 0x01, 0x03, 0x03, "3" }, - {0x0c, 0x01, 0x03, 0x02, "4" }, - {0x0c, 0x01, 0x03, 0x01, "5" }, - {0x0c, 0x01, 0x03, 0x00, "6" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0x06, 0x06, "A 1C/1P B 2C/1P" }, - {0x0d, 0x01, 0x06, 0x04, "A 1C/2P B 1C/1P" }, - {0x0d, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, - {0x0d, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, -}; - -STDDIPINFO(Ozon1) - -static struct BurnDIPInfo PacmanblDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0xc0, NULL }, - {0x0f, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x0e, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x0e, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x0e, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x0e, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0f, 0x01, 0x01, 0x00, "15000" }, - {0x0f, 0x01, 0x01, 0x01, "20000" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0f, 0x01, 0x02, 0x00, "Easy" }, - {0x0f, 0x01, 0x02, 0x02, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0f, 0x01, 0x04, 0x00, "3" }, - {0x0f, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x08, 0x00, "Upright" }, - {0x0f, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Pacmanbl) - -static struct BurnDIPInfo Phoenxp2DIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0xc0, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x10, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x10, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x10, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x10, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x11, 0x01, 0x02, 0x00, "Easy" }, - {0x11, 0x01, 0x02, 0x02, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x04, 0x00, "3" }, - {0x11, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x08, 0x00, "Upright" }, - {0x11, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Phoenxp2) - -static struct BurnDIPInfo PiscesDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0c, 0x01, 0x40, 0x00, "3" }, - {0x0c, 0x01, 0x40, 0x40, "4" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x80, 0x00, "Upright" }, - {0x0c, 0x01, 0x80, 0x80, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0d, 0x01, 0x01, 0x00, "10000" }, - {0x0d, 0x01, 0x01, 0x01, "20000" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0x02, 0x02, "A 2C/1P B 1C/3P" }, - {0x0d, 0x01, 0x02, 0x00, "A 1C/1P B 1C/6P" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0d, 0x01, 0x04, 0x00, "Easy" }, - {0x0d, 0x01, 0x04, 0x04, "Hard" }, -}; - -STDDIPINFO(Pisces) - -static struct BurnDIPInfo PiscesbDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0c, 0x01, 0x40, 0x00, "3" }, - {0x0c, 0x01, 0x40, 0x40, "4" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x80, 0x00, "Upright" }, - {0x0c, 0x01, 0x80, 0x80, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0d, 0x01, 0x01, 0x00, "10000" }, - {0x0d, 0x01, 0x01, 0x01, "20000" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0x02, 0x02, "A 2C/1P B 1C/2P 2C/5P" }, - {0x0d, 0x01, 0x02, 0x00, "A 1C/1P B 1C/5P" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0d, 0x01, 0x04, 0x00, "Easy" }, - {0x0d, 0x01, 0x04, 0x04, "Hard" }, -}; - -STDDIPINFO(Piscesb) - -static struct BurnDIPInfo PorterDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 -}; - -STDDIPINFO(Porter) - -static struct BurnDIPInfo RacknrolDIPList[]= -{ - // Default Values - {0x0a, 0xff, 0xff, 0x00, NULL }, - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 -}; - -STDDIPINFO(Racknrol) - -static struct BurnDIPInfo RedufoDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0xc0, NULL }, - {0x0e, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Coin A" }, - {0x0d, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Coin B" }, - {0x0d, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, - {0x0d, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0e, 0x01, 0x01, 0x00, "7000" }, - {0x0e, 0x01, 0x01, 0x01, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x04, 0x00, "3" }, - {0x0e, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x08, 0x00, "Upright" }, - {0x0e, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Redufo) - -static struct BurnDIPInfo RedufobDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x20, 0x00, "Upright" }, - {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0xc0, 0x40, "A 2C/1P B 1C/3P" }, - {0x0d, 0x01, 0xc0, 0x00, "A 1C/1P B 1C/6P" }, - {0x0d, 0x01, 0xc0, 0x80, "A 1C/2P B 1C/12P" }, - {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x03, 0x01, "4000" }, - {0x0e, 0x01, 0x03, 0x02, "5000" }, - {0x0e, 0x01, 0x03, 0x03, "7000" }, - {0x0e, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x04, 0x00, "3" }, - {0x0e, 0x01, 0x04, 0x04, "5" }, -}; - -STDDIPINFO(Redufob) - -static struct BurnDIPInfo RescueDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x02, NULL }, - {0x10, 0xff, 0xff, 0x0c, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Starting Level" }, - {0x0e, 0x01, 0x02, 0x00, "1" }, - {0x0e, 0x01, 0x02, 0x02, "3" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0f, 0x01, 0x01, 0x00, "3" }, - {0x0f, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x02, 0x00, "Off" }, - {0x0f, 0x01, 0x02, 0x02, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x10, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, - {0x10, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, - {0x10, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, - {0x10, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x10, 0x01, 0x08, 0x08, "Easy" }, - {0x10, 0x01, 0x08, 0x00, "Hard" }, -}; - -STDDIPINFO(Rescue) - -static struct BurnDIPInfo RockclimDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0x40, NULL }, - {0x0e, 0xff, 0xff, 0xc0, NULL }, - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0e, 0x01, 0x40, 0x00, "30000" }, - {0x0e, 0x01, 0x40, 0x40, "50000" }, - - {0 , 0xfe, 0 , 2 , "Coin Slots" }, - {0x0e, 0x01, 0x80, 0x80, "1" }, - {0x0e, 0x01, 0x80, 0x00, "2" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x03, 0x00, "3" }, - {0x0f, 0x01, 0x03, 0x01, "4" }, - {0x0f, 0x01, 0x03, 0x02, "5" }, - {0x0f, 0x01, 0x03, 0x03, "6" }, - - // Dip 4 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x10, 0x01, 0x0f, 0x00, "9 Coins 1 Play" }, - {0x10, 0x01, 0x0f, 0x01, "8 Coins 1 Play" }, - {0x10, 0x01, 0x0f, 0x02, "7 Coins 1 Play" }, - {0x10, 0x01, 0x0f, 0x03, "6 Coins 1 Play" }, - {0x10, 0x01, 0x0f, 0x04, "5 Coins 1 Play" }, - {0x10, 0x01, 0x0f, 0x05, "4 Coins 1 Play" }, - {0x10, 0x01, 0x0f, 0x06, "3 Coins 1 Play" }, - {0x10, 0x01, 0x0f, 0x07, "2 Coins 1 Play" }, - {0x10, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, - {0x10, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, - {0x10, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, - {0x10, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - {0x10, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, - {0x10, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, - {0x10, 0x01, 0x0f, 0x09, "1 Coin 7 Plays" }, - {0x10, 0x01, 0x0f, 0x08, "1 Coin 8 Plays" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x10, 0x01, 0xf0, 0x00, "9 Coins 1 Play" }, - {0x10, 0x01, 0xf0, 0x10, "8 Coins 1 Play" }, - {0x10, 0x01, 0xf0, 0x20, "7 Coins 1 Play" }, - {0x10, 0x01, 0xf0, 0x30, "6 Coins 1 Play" }, - {0x10, 0x01, 0xf0, 0x40, "5 Coins 1 Play" }, - {0x10, 0x01, 0xf0, 0x50, "4 Coins 1 Play" }, - {0x10, 0x01, 0xf0, 0x60, "3 Coins 1 Play" }, - {0x10, 0x01, 0xf0, 0x70, "2 Coins 1 Play" }, - {0x10, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, - {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Plays" }, - {0x10, 0x01, 0xf0, 0xd0, "1 Coin 3 Plays" }, - {0x10, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, - {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Plays" }, - {0x10, 0x01, 0xf0, 0xa0, "1 Coin 6 Plays" }, - {0x10, 0x01, 0xf0, 0x90, "1 Coin 7 Plays" }, - {0x10, 0x01, 0xf0, 0x80, "1 Coin 8 Plays" }, -}; - -STDDIPINFO(Rockclim) - -static struct BurnDIPInfo ScobraDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x03, NULL }, - {0x14, 0xff, 0xff, 0x0c, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x13, 0x01, 0x02, 0x02, "3" }, - {0x13, 0x01, 0x02, 0x00, "4" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x14, 0x01, 0x06, 0x02, "2 Coins 1 Play" }, - {0x14, 0x01, 0x06, 0x00, "4 Coins 3 Plays" }, - {0x14, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, - {0x14, 0x01, 0x06, 0x06, "1 Coin 99 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x08, 0x08, "Upright" }, - {0x14, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Scobra) - -static struct BurnDIPInfo ScobrasDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x03, NULL }, - {0x14, 0xff, 0xff, 0x0c, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x13, 0x01, 0x02, 0x02, "3" }, - {0x13, 0x01, 0x02, 0x00, "5" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x14, 0x01, 0x06, 0x02, "2 Coins 1 Play" }, - {0x14, 0x01, 0x06, 0x00, "4 Coins 3 Plays" }, - {0x14, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, - {0x14, 0x01, 0x06, 0x06, "1 Coin 99 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x08, 0x08, "Upright" }, - {0x14, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Scobras) - -static struct BurnDIPInfo ScorpionDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x04, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x04, 0x00, "3" }, - {0x12, 0x01, 0x04, 0x01, "4" }, - {0x12, 0x01, 0x04, 0x02, "5" }, - {0x12, 0x01, 0x04, 0x03, "255" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x04, 0x04, "Upright" }, - {0x13, 0x01, 0x04, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x13, 0x01, 0x08, 0x00, "A 1C/1P B 1C/1P" }, - {0x13, 0x01, 0x08, 0x08, "A 1C/1P B 1C/3P" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0xa0, 0x00, "Normal" }, - {0x13, 0x01, 0xa0, 0x20, "Medium" }, - {0x13, 0x01, 0xa0, 0x80, "Hard" }, - {0x13, 0x01, 0xa0, 0xa0, "Very Hard" }, -}; - -STDDIPINFO(Scorpion) - -static struct BurnDIPInfo ScorpionmcDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x40, NULL }, - {0x11, 0xff, 0xff, 0x04, NULL }, - {0x12, 0xff, 0xff, 0x02, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x10, 0x01, 0xc0, 0x00, "Easy" }, - {0x10, 0x01, 0xc0, 0x40, "Normal" }, - {0x10, 0x01, 0xc0, 0x80, "Hard" }, - {0x10, 0x01, 0xc0, 0xc0, "Hardest" }, - - // Dip 3 - {0 , 0xfe, 0 , 3 , "Lives" }, - {0x11, 0x01, 0x0c, 0x00, "2" }, - {0x11, 0x01, 0x0c, 0x04, "3" }, - {0x11, 0x01, 0x0c, 0x08, "4" }, - - // Dip 4 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x01, 0x00, "Upright" }, - {0x12, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x12, 0x01, 0x06, 0x00, "2 Coins 1 Play" }, - {0x12, 0x01, 0x06, 0x02, "1 Coin 1 Play" }, - {0x12, 0x01, 0x06, 0x04, "1 Coin 2 Plays" }, - {0x12, 0x01, 0x06, 0x06, "1 Coin 3 Plays" }, -}; - -STDDIPINFO(Scorpionmc) - -static struct BurnDIPInfo AracnisDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x20, NULL }, - {0x0c, 0xff, 0xff, 0xf8, NULL }, - {0x0d, 0xff, 0xff, 0xfd, NULL }, - {0x0e, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0x03, 0x00, "2 Coins 1 Play" }, - {0x0d, 0x01, 0x03, 0x01, "1 Coin 1 Play" }, - {0x0d, 0x01, 0x03, 0x02, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0x03, 0x03, "1 Coin 3 Plays" }, - - // Dip 4 -}; - -STDDIPINFO(Aracnis) - -static struct BurnDIPInfo Scramb2DIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x03, NULL }, - {0x13, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "255" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x13, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, - {0x13, 0x01, 0x06, 0x04, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x06, 0x02, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x06, 0x00, "1 Coin 4 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x08, 0x08, "Upright" }, - {0x13, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Scramb2) - -static struct BurnDIPInfo ScramblbDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x40, 0x00, "Upright" }, - {0x11, 0x01, 0x40, 0x40, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x12, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, - {0x12, 0x01, 0x03, 0x01, "1 Coin 2 Plays" }, - {0x12, 0x01, 0x03, 0x02, "1 Coin 3 Plays" }, - {0x12, 0x01, 0x03, 0x03, "1 Coin 4 Plays" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x0c, 0x00, "3" }, - {0x12, 0x01, 0x0c, 0x04, "4" }, - {0x12, 0x01, 0x0c, 0x08, "5" }, - {0x12, 0x01, 0x0c, 0x0c, "255" }, -}; - -STDDIPINFO(Scramblb) - -static struct BurnDIPInfo ScrambleDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x03, NULL }, - {0x14, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "255" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x14, 0x01, 0x06, 0x06, "A 1C/1P B 2C/1P C 1C/1P"}, - {0x14, 0x01, 0x06, 0x04, "A 1C/2P B 1C/1P C 1C/2P"}, - {0x14, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P C 1C/3P"}, - {0x14, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P C 1C/4P"}, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x08, 0x08, "Upright" }, - {0x14, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Scramble) - -static struct BurnDIPInfo SfxDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x01, NULL }, - {0x14, 0xff, 0xff, 0x08, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x01, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - {0x13, 0x01, 0x03, 0x03, "5" }, - {0x13, 0x01, 0x03, 0x00, "Invulerability" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x14, 0x01, 0x06, 0x06, "3 Coins 1 Play" }, - {0x14, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, - {0x14, 0x01, 0x06, 0x00, "1 Coin 1 Play" }, - {0x14, 0x01, 0x06, 0x02, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x08, 0x08, "Upright" }, - {0x14, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Sfx) - -static struct BurnDIPInfo SkybaseDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x20, 0x00, "Upright" }, - {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 1 Play (2 to start)"}, - {0x0d, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0xc0, 0x40, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x03, 0x00, "3" }, - {0x0e, 0x01, 0x03, 0x01, "4" }, - {0x0e, 0x01, 0x03, 0x02, "5" }, - {0x0e, 0x01, 0x03, 0x03, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x0c, 0x00, "10000" }, - {0x0e, 0x01, 0x0c, 0x40, "15000" }, - {0x0e, 0x01, 0x0c, 0x40, "20000" }, - {0x0e, 0x01, 0x0c, 0x40, "None" }, -}; - -STDDIPINFO(Skybase) - -static struct BurnDIPInfo SmooncrsDIPList[]= -{ - // Default Values - {0x08, 0xff, 0xff, 0x00, NULL }, - {0x09, 0xff, 0xff, 0xc0, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x08, 0x01, 0x20, 0x00, "Upright" }, - {0x08, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x09, 0x01, 0x40, 0x40, "Easy" }, - {0x09, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Players Bullet Speed" }, - {0x09, 0x01, 0x80, 0x00, "Slow" }, - {0x09, 0x01, 0x80, 0x80, "Fast" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x10, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, - {0x10, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, - {0x10, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, - {0x10, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x10, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, - {0x10, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, - {0x10, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, - {0x10, 0x01, 0x0c, 0x0c, "Freeplay" }, -}; - -STDDIPINFO(Smooncrs) - -static struct BurnDIPInfo SpacbattDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x20, 0x00, "Upright" }, - {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0xc0, 0x40, "A 2C/1P B 1C/3P" }, - {0x0d, 0x01, 0xc0, 0x00, "A 1C/1P B 1C/6P" }, - {0x0d, 0x01, 0xc0, 0x80, "A 1C/2P B 1C/6P" }, - {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x03, 0x01, "4000" }, - {0x0e, 0x01, 0x03, 0x02, "5000" }, - {0x0e, 0x01, 0x03, 0x03, "7000" }, - {0x0e, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x04, 0x00, "3" }, - {0x0e, 0x01, 0x04, 0x04, "5" }, -}; - -STDDIPINFO(Spacbatt) - -static struct BurnDIPInfo SpdcoinDIPList[]= -{ - // Default Values - {0x07, 0xff, 0xff, 0x00, NULL }, - {0x08, 0xff, 0xff, 0x03, NULL }, - {0x09, 0xff, 0xff, 0x06, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x08, 0x01, 0x01, 0x01, "Off" }, - {0x08, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x08, 0x01, 0x02, 0x02, "Off" }, - {0x08, 0x01, 0x02, 0x00, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x09, 0x01, 0x04, 0x04, "Easy" }, - {0x09, 0x01, 0x04, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x09, 0x01, 0x08, 0x00, "3" }, - {0x09, 0x01, 0x08, 0x08, "5" }, -}; - -STDDIPINFO(Spdcoin) - -static struct BurnDIPInfo StratgyxDIPList[] = -{ - // Default Values - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x03, NULL }, - {0x14, 0xff, 0xff, 0x08, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "255" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x08, 0x08, "Upright" }, - {0x14, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Stratgyx) - -static struct BurnDIPInfo StreakngDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x40, NULL }, - {0x0e, 0xff, 0xff, 0x06, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x20, 0x00, "Upright" }, - {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0d, 0x01, 0xc0, 0x40, "10000" }, - {0x0d, 0x01, 0xc0, 0x81, "15000" }, - {0x0d, 0x01, 0xc0, 0xc0, "20000" }, - {0x0d, 0x01, 0xc0, 0x00, "None" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0e, 0x01, 0x03, 0x00, "2 Coins 1 Play" }, - {0x0e, 0x01, 0x03, 0x02, "1 Coin 1 Play" }, - {0x0e, 0x01, 0x03, 0x01, "1 Coin 2 Plays" }, - {0x0e, 0x01, 0x03, 0x03, "Freeplay" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x0c, 0x0c, "1" }, - {0x0e, 0x01, 0x0c, 0x08, "2" }, - {0x0e, 0x01, 0x0c, 0x04, "3" }, - {0x0e, 0x01, 0x0c, 0x00, "5" }, -}; - -STDDIPINFO(Streakng) - -static struct BurnDIPInfo StrfbombDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x03, NULL }, - {0x14, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "255" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x14, 0x01, 0x06, 0x06, "A 1C/2P B 4C/1P C 1C/2P"}, - {0x14, 0x01, 0x06, 0x04, "A 1C/3P B 2C/1P C 1C/3P"}, - {0x14, 0x01, 0x06, 0x02, "A 1C/4P B 3C/1P C 1C/4P"}, - {0x14, 0x01, 0x06, 0x00, "A 1C/5P B 1C/1P C 1C/5P"}, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x08, 0x08, "Upright" }, - {0x14, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Strfbomb) - -static struct BurnDIPInfo SuperbonDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0x00, NULL }, - {0x0c, 0xff, 0xff, 0x02, NULL }, - {0x0d, 0xff, 0xff, 0x04, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0c, 0x01, 0x03, 0x02, "3" }, - {0x0c, 0x01, 0x03, 0x01, "5" }, - {0x0c, 0x01, 0x03, 0x00, "Free Play" }, - {0x0c, 0x01, 0x03, 0x03, "Invulnerability" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, - {0x0d, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, - {0x0d, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, - {0x0d, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, -}; - -STDDIPINFO(Superbon) - -static struct BurnDIPInfo SupergDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x20, 0x00, "Upright" }, - {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x0d, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x03, 0x01, "4000" }, - {0x0e, 0x01, 0x03, 0x02, "5000" }, - {0x0e, 0x01, 0x03, 0x03, "7000" }, - {0x0e, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x04, 0x00, "3" }, - {0x0e, 0x01, 0x04, 0x04, "5" }, -}; - -STDDIPINFO(Superg) - -static struct BurnDIPInfo SwarmDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x00, NULL }, - {0x0e, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x20, 0x00, "Upright" }, - {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x0d, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x03, 0x01, "10000" }, - {0x0e, 0x01, 0x03, 0x02, "20000" }, - {0x0e, 0x01, 0x03, 0x03, "40000" }, - {0x0e, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x04, 0x00, "3" }, - {0x0e, 0x01, 0x04, 0x04, "4" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0e, 0x01, 0x08, 0x00, "Easy" }, - {0x0e, 0x01, 0x08, 0x08, "Hard" }, -}; - -STDDIPINFO(Swarm) - -static struct BurnDIPInfo TazzmangDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x04, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x01, 0x00, "Upright" }, - {0x11, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x11, 0x01, 0x06, 0x00, "A 4C/1P B 1C/4P" }, - {0x11, 0x01, 0x06, 0x02, "A 3C/1P B 1C/3P" }, - {0x11, 0x01, 0x06, 0x06, "A 2C/1P B 1C/2P" }, - {0x11, 0x01, 0x06, 0x04, "A 1C/1P B 1C/1P" }, -}; - -STDDIPINFO(Tazzmang) - -static struct BurnDIPInfo TheendDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x03, NULL }, - {0x10, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x03, 0x03, "3" }, - {0x0f, 0x01, 0x03, 0x02, "4" }, - {0x0f, 0x01, 0x03, 0x01, "5" }, - {0x0f, 0x01, 0x03, 0x00, "256" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x10, 0x01, 0x06, 0x02, "3 Coins 1 Play" }, - {0x10, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, - {0x10, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, - {0x10, 0x01, 0x06, 0x00, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x08, 0x08, "Upright" }, - {0x10, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Theend) - -static struct BurnDIPInfo ThepitmDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0c, 0x01, 0x04, 0x00, "Off" }, - {0x0c, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x08, 0x00, "Upright" }, - {0x11, 0x01, 0x08, 0x08, "Cocktail" }, -}; - -STDDIPINFO(Thepitm) - -static struct BurnDIPInfo TriplepDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x03, NULL }, - {0x12, 0xff, 0xff, 0xae, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x03, "3" }, - {0x11, 0x01, 0x03, 0x02, "4" }, - {0x11, 0x01, 0x03, 0x01, "5" }, - {0x11, 0x01, 0x03, 0x00, "256" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x12, 0x01, 0x06, 0x04, "A 1C/2P B 1C/1P C 1C/2C"}, - {0x12, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P C 1C/3C"}, - {0x12, 0x01, 0x06, 0x06, "A 1C/1P B 2C/1P C 1C/1C"}, - {0x12, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P C 1C/4C"}, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x08, 0x08, "Upright" }, - {0x12, 0x01, 0x08, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Rack Test" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Triplep) - -static struct BurnDIPInfo TurpinDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x03, NULL }, - {0x12, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x03, "3" }, - {0x11, 0x01, 0x03, 0x02, "5" }, - {0x11, 0x01, 0x03, 0x01, "7" }, - {0x11, 0x01, 0x03, 0x00, "126" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x12, 0x01, 0x06, 0x00, "4 Coins 1 Play" }, - {0x12, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, - {0x12, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, - {0x12, 0x01, 0x06, 0x02, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x08, 0x08, "Upright" }, - {0x12, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Turpin) - -static struct BurnDIPInfo TurtlesDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x03, NULL }, - {0x12, 0xff, 0xff, 0x0e, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x03, "3" }, - {0x11, 0x01, 0x03, 0x02, "4" }, - {0x11, 0x01, 0x03, 0x01, "5" }, - {0x11, 0x01, 0x03, 0x00, "126" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x12, 0x01, 0x06, 0x06, "A 1C/1P B 2C/1P C 1C/1P"}, - {0x12, 0x01, 0x06, 0x04, "A 1C/2P B 1C/1P C 1C/2P"}, - {0x12, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P C 1C/3P"}, - {0x12, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P C 1C/4P"}, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x08, 0x08, "Upright" }, - {0x12, 0x01, 0x08, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Turtles) - -static struct BurnDIPInfo VpoolDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x20, NULL }, - {0x0d, 0xff, 0xff, 0xe0, NULL }, - {0x0e, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - - // Dip 3 -}; - -STDDIPINFO(Vpool) - -static struct BurnDIPInfo WarofbugDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x0a, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x20, 0x00, "Upright" }, - {0x0f, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 2 - {0 , 0xfe, 0 , 3 , "Coinage" }, - {0x10, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x10, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x10, 0x01, 0xc0, 0xc0, "Freeplay" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x00, "1" }, - {0x11, 0x01, 0x03, 0x01, "2" }, - {0x11, 0x01, 0x03, 0x02, "3" }, - {0x11, 0x01, 0x03, 0x03, "4" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x11, 0x01, 0x08, 0x08, "500000" }, - {0x11, 0x01, 0x08, 0x00, "700000" }, -}; - -STDDIPINFO(Warofbug) - -static struct BurnDIPInfo ZerotimeDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x00, NULL }, - {0x0d, 0xff, 0xff, 0x40, NULL }, - {0x0e, 0xff, 0xff, 0x03, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x20, 0x00, "Upright" }, - {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0xc0, 0x40, "A 1C/1P 2C/3P B 1C/2P" }, - {0x0d, 0x01, 0xc0, 0xc0, "A 1C/1P 2C/3P B 1C/3P" }, - {0x0d, 0x01, 0xc0, 0x00, "A 1C/2P 2C/4P B 1C/4P" }, - {0x0d, 0x01, 0xc0, 0x80, "A 1C/2P 2C/5P B 1C/5P" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x03, 0x03, "6000" }, - {0x0e, 0x01, 0x03, 0x02, "7000" }, - {0x0e, 0x01, 0x03, 0x01, "9000" }, - {0x0e, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0e, 0x01, 0x04, 0x00, "3" }, - {0x0e, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0e, 0x01, 0x08, 0x00, "Easy" }, - {0x0e, 0x01, 0x08, 0x08, "Hard" }, -}; - -STDDIPINFO(Zerotime) - -static struct BurnDIPInfo ZigzagDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0x00, NULL }, - {0x10, 0xff, 0xff, 0x02, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x0f, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - {0x0f, 0x01, 0xc0, 0xc0, "Freeplay" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x10, 0x01, 0x01, 0x00, "3" }, - {0x10, 0x01, 0x01, 0x01, "4" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x02, 0x02, "Upright" }, - {0x10, 0x01, 0x02, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x10, 0x01, 0x0c, 0x00, "10000 60000" }, - {0x10, 0x01, 0x0c, 0x04, "20000 60000" }, - {0x10, 0x01, 0x0c, 0x08, "30000 60000" }, - {0x10, 0x01, 0x0c, 0x0c, "40000 60000" }, -}; - -STDDIPINFO(Zigzag) - -// Drivers -// Basic Galaxian Hardware -static struct BurnRomInfo GalaxianRomDesc[] = { - { "galmidw.u", 0x00800, 0x745e2d61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galmidw.v", 0x00800, 0x9c999a40, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galmidw.w", 0x00800, 0xb5894925, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galmidw.y", 0x00800, 0x6b3ca10b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7l", 0x00800, 0x1b933207, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "1h.bin", 0x00800, 0x39fb43a4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "1k.bin", 0x00800, 0x7e3f56a2, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galaxian) -STD_ROM_FN(Galaxian) - -static struct BurnRomInfo GalaxianaRomDesc[] = { - { "7f.bin", 0x01000, 0x4335b1de, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7j.bin", 0x01000, 0x4e6f66a1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7l.bin", 0x00800, 0x5341d75a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "1h.bin", 0x00800, 0x39fb43a4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "1k.bin", 0x00800, 0x7e3f56a2, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galaxiana) -STD_ROM_FN(Galaxiana) - -static struct BurnRomInfo GalaxianmRomDesc[] = { - { "galmidw.u", 0x00800, 0x745e2d61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galmidw.v", 0x00800, 0x9c999a40, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galmidw.w", 0x00800, 0xb5894925, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galmidw.y", 0x00800, 0x6b3ca10b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galmidw.z", 0x00800, 0xcb24f797, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "galaxian.j1", 0x00800, 0x84decf98, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "galaxian.l1", 0x00800, 0xc31ada9e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galaxianm) -STD_ROM_FN(Galaxianm) - -static struct BurnRomInfo GalaxianmoRomDesc[] = { - { "galaxian.u", 0x00800, 0xfac42d34, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galaxian.v", 0x00800, 0xf58283e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galaxian.w", 0x00800, 0x4c7031c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galaxian.y", 0x00800, 0x96a7ac94, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7l.bin", 0x00800, 0x5341d75a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "galaxian.j1", 0x00800, 0x84decf98, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "galaxian.l1", 0x00800, 0xc31ada9e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galaxianmo) -STD_ROM_FN(Galaxianmo) - -static struct BurnRomInfo GalaxiantRomDesc[] = { - { "gl-03.8g", 0x00800, 0xe8f3aa67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "gl-04.8f", 0x00800, 0xf58283e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "gl-05.8e", 0x00800, 0x4c7031c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "gl-06.8d", 0x00800, 0x097d92a2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "gl-07.8c", 0x00800, 0x5341d75a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "gl-01.1j", 0x00800, 0x968b6016, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "gl-02.1k", 0x00800, 0xd14f7510, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galaxiant) -STD_ROM_FN(Galaxiant) - -struct BurnDriver BurnDrvGalaxian = { - "galaxian", NULL, NULL, NULL, "1979", - "Galaxian (Namco set 1)\0", NULL, "Namco", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GalaxianRomInfo, GalaxianRomName, NULL, NULL, GalaxianInputInfo, GalaxianDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGalaxiana = { - "galaxiana", "galaxian", NULL, NULL, "1979", - "Galaxian (Namco set 2)\0", NULL, "Namco", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GalaxianaRomInfo, GalaxianaRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGalaxianm = { - "galaxianm", "galaxian", NULL, NULL, "1979", - "Galaxian (Midway set 1)\0", NULL, "Namco (Midway license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GalaxianmRomInfo, GalaxianmRomName, NULL, NULL, GalaxianInputInfo, GalaxianDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGalaxianmo = { - "galaxianmo", "galaxian", NULL, NULL, "1979", - "Galaxian (Midway set 2)\0", NULL, "Namco (Midway license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GalaxianmoRomInfo, GalaxianmoRomName, NULL, NULL, GalaxianInputInfo, GalaxianDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGalaxiant = { - "galaxiant", "galaxian", NULL, NULL, "1979", - "Galaxian (Taito)\0", NULL, "Namco (Taito license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GalaxiantRomInfo, GalaxiantRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Galaxian Rip-Offs on basic Galaxian Hardware -static struct BurnRomInfo MoonalnRomDesc[] = { - { "galx.u", 0x00800, 0x79e4007d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "prg2.bin", 0x00800, 0x59580b30, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "prg3.bin", 0x00800, 0xb64e9d12, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "superg.y", 0x00800, 0x9463f753, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "prg5.bin", 0x00800, 0x8bb78987, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ca1.bin", 0x00800, 0x074271dd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ca2.bin", 0x00800, 0x84d90397, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Moonaln) -STD_ROM_FN(Moonaln) - -static struct BurnRomInfo SupergRomDesc[] = { - { "7f.bin", 0x01000, 0x4335b1de, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "superg.w", 0x00800, 0xddeabdae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "superg.y", 0x00800, 0x9463f753, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "superg.z", 0x00800, 0xe6312e35, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "galmidw.1j", 0x00800, 0x84decf98, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "galmidw.1k", 0x00800, 0xc31ada9e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Superg) -STD_ROM_FN(Superg) - -static struct BurnRomInfo GalturboRomDesc[] = { - { "galturbo.u", 0x00800, 0xe8f3aa67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galx.v", 0x00800, 0xbc16064e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "superg.w", 0x00800, 0xddeabdae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galturbo.y", 0x00800, 0xa44f450f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galturbo.z", 0x00800, 0x3247f3d4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "galturbo.1h", 0x00800, 0xa713fd1a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "galturbo.1k", 0x00800, 0x28511790, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galturbo) -STD_ROM_FN(Galturbo) - -static struct BurnRomInfo GalapxRomDesc[] = { - { "galx.u", 0x00800, 0x79e4007d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galx.v", 0x00800, 0xbc16064e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galx.w", 0x00800, 0x72d2d3ee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galx.y", 0x00800, 0xafe397f3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galx.z", 0x00800, 0x778c0d3c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "galx.1h", 0x00800, 0xe8810654, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "galx.1k", 0x00800, 0xcbe84a76, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galapx) -STD_ROM_FN(Galapx) - -static struct BurnRomInfo Galap1RomDesc[] = { - { "7f.bin", 0x01000, 0x4335b1de, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galaxian.w", 0x00800, 0x4c7031c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galx_1_4.rom", 0x00800, 0xe71e1d9e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galx_1_5.rom", 0x00800, 0x6e65a3b2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "galmidw.1j", 0x00800, 0x84decf98, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "galmidw.1k", 0x00800, 0xc31ada9e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galap1) -STD_ROM_FN(Galap1) - -static struct BurnRomInfo Galap4RomDesc[] = { - { "galnamco.u", 0x00800, 0xacfde501, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galnamco.v", 0x00800, 0x65cf3c77, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galnamco.w", 0x00800, 0x9eef9ae6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galnamco.y", 0x00800, 0x56a5ddd1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galnamco.z", 0x00800, 0xf4bc7262, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "galx_4c1.rom", 0x00800, 0xd5e88ab4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "galx_4c2.rom", 0x00800, 0xa57b83e4, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galap4) -STD_ROM_FN(Galap4) - -static struct BurnRomInfo SwarmRomDesc[] = { - { "swarm1.bin", 0x00800, 0x21eba3d0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "swarm2.bin", 0x00800, 0xf3a436cd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "swarm3.bin", 0x00800, 0x2915e38b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "swarm4.bin", 0x00800, 0x8bbbf486, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "swarm5.bin", 0x00800, 0xf1b1987e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "swarma.bin", 0x00800, 0xef8657bb, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "swarmb.bin", 0x00800, 0x60c4bd31, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Swarm) -STD_ROM_FN(Swarm) - -static struct BurnRomInfo ZerotimeRomDesc[] = { - { "zt-p01c.016", 0x00800, 0x90a2bc61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "zt-2.016", 0x00800, 0xa433067e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "zt-3.016", 0x00800, 0xaaf038d4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "zt-4.016", 0x00800, 0x786d690a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "zt-5.016", 0x00800, 0xaf9260d7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ztc-2.016", 0x00800, 0x1b13ca05, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ztc-1.016", 0x00800, 0x5cd7df03, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Zerotime) -STD_ROM_FN(Zerotime) - -static struct BurnRomInfo StarfghtRomDesc[] = { - { "ja.1", 0x00400, 0xc6ab558b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb.2", 0x00400, 0x34b99fed, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jc.3", 0x00400, 0x30e28016, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jd.4", 0x00400, 0xde7e7770, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "je.5", 0x00400, 0xa916c919, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jf.6", 0x00400, 0x9175882b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jg.7", 0x00400, 0x707c0f02, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jh.8", 0x00400, 0x5dd26461, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ji.9", 0x00400, 0x6651fe93, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jj.10", 0x00400, 0x12c721b9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "k1.7a", 0x00800, 0x977e37cf, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k2.9a", 0x00800, 0x15e387ce, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.7f", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Starfght) -STD_ROM_FN(Starfght) - -static struct BurnRomInfo GalaxbsfRomDesc[] = { - { "1.bn", 0x00400, 0xcc37b774, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2.bn", 0x00400, 0xc6d21f03, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3.bn", 0x00400, 0x30e28016, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4.bn", 0x00400, 0xde7e7770, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5.bn", 0x00400, 0xa916c919, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6.bn", 0x00400, 0x9175882b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7.bn", 0x00400, 0x1237b9da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8.bn", 0x00400, 0x78c53607, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "9.bn", 0x00400, 0x901894cc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "10.bn", 0x00400, 0x5876f695, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "11.bn", 0x00800, 0x39fb43a4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "12.bn", 0x00800, 0x7e3f56a2, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galaxbsf) -STD_ROM_FN(Galaxbsf) - -static struct BurnRomInfo Kamakazi3RomDesc[] = { - { "f_r_a.bin", 0x00800, 0xe8f3aa67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f_a.bin", 0x00800, 0xf58283e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f_b.bin", 0x00800, 0xddeabdae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f_r_c.bin", 0x00800, 0xc8530a88, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f_r_d.bin", 0x00800, 0xda2d77e0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "r_b.bin", 0x00800, 0x977e37cf, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "r_a.bin", 0x00800, 0xd0ba22c9, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Kamakazi3) -STD_ROM_FN(Kamakazi3) - -static struct BurnRomInfo SupergxRomDesc[] = { - { "sg1", 0x00800, 0xb83f4578, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sg2", 0x00800, 0xd12ca054, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sg3", 0x00800, 0x53714cb1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sg4", 0x00800, 0x2f36fc69, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sg5", 0x00800, 0x1e0ed4fd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sg6", 0x00800, 0x4f3d97a8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "sgg1", 0x00800, 0xa1287bf6, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "sgg2", 0x00800, 0x528f1481, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "supergx.prm", 0x00020, 0x00000000, BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(Supergx) -STD_ROM_FN(Supergx) - -static struct BurnRomInfo TstgalxRomDesc[] = { - { "test.u", 0x00800, 0x0614cd7f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galmidw.v", 0x00800, 0x9c999a40, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galmidw.w", 0x00800, 0xb5894925, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "galmidw.y", 0x00800, 0x6b3ca10b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7l", 0x00800, 0x1b933207, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "1h.bin", 0x00800, 0x39fb43a4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "1k.bin", 0x00800, 0x7e3f56a2, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Tstgalx) -STD_ROM_FN(Tstgalx) - -static INT32 SupergxInit() -{ - INT32 nRet; - - GalTilesSharedRomSize = 0x1000; - GalPromRomSize = 0x20; - - nRet = GalInit(); - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x1800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - - HardCodeGalaxianPROM(); - - return nRet; -} - -struct BurnDriver BurnDrvMoonaln = { - "moonaln", "galaxian", NULL, NULL, "1979", - "Moon Alien\0", NULL, "Nichibutsu (Karateco license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MoonalnRomInfo, MoonalnRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSuperg = { - "superg", "galaxian", NULL, NULL, "1979", - "Super Galaxians (galaxiaj hack)\0", NULL, "hack", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SupergRomInfo, SupergRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGalturbo = { - "galturbo", "galaxian", NULL, NULL, "1979", - "Galaxian Turbo (superg hack)\0", NULL, "hack", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GalturboRomInfo, GalturboRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGalapx = { - "galapx", "galaxian", NULL, NULL, "1979", - "Galaxian Part X (moonaln hack)\0", NULL, "hack", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GalapxRomInfo, GalapxRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGalap1 = { - "galap1", "galaxian", NULL, NULL, "1979", - "Space Invaders Galactica (galaxiaj hack)\0", NULL, "hack", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Galap1RomInfo, Galap1RomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGalap4 = { - "galap4", "galaxian", NULL, NULL, "1979", - "Galaxian Part 4 (hack)\0", NULL, "G.G.I", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Galap4RomInfo, Galap4RomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSwarm = { - "swarm", "galaxian", NULL, NULL, "1979", - "Swarm (bootleg?)\0", NULL, "Sebelectro", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SwarmRomInfo, SwarmRomName, NULL, NULL, GalaxianInputInfo, SwarmDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvZerotime = { - "zerotime", "galaxian", NULL, NULL, "1979", - "Zero Time\0", NULL, "Petaco S.A", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, ZerotimeRomInfo, ZerotimeRomName, NULL, NULL, GalaxianInputInfo, ZerotimeDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvStarfght = { - "starfght", "galaxian", NULL, NULL, "1979", - "Star Fighter\0", NULL, "Juetel", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, StarfghtRomInfo, StarfghtRomName, NULL, NULL, GalaxianInputInfo, SwarmDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGalaxbsf = { - "galaxbsf", "galaxian", NULL, NULL, "1979", - "Galaxian (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GalaxbsfRomInfo, GalaxbsfRomName, NULL, NULL, GalaxianInputInfo, GalaxianDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvKamakazi3 = { - "kamakazi3", "galaxian", NULL, NULL, "1979", - "Kamakazi III (superg hack)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Kamakazi3RomInfo, Kamakazi3RomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriverD BurnDrvSupergx = { - "supergx", "galaxian", NULL, NULL, "1980", - "Super GX\0", "Bad Dump", "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SupergxRomInfo, SupergxRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - SupergxInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTstgalx = { - "tst_galx", "galaxian", NULL, NULL, "1979", - "Galaxian Test ROM\0", NULL, "Test ROM", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_PROTOTYPE, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, TstgalxRomInfo, TstgalxRomName, NULL, NULL, GalaxianInputInfo, GalaxianDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Other games on basic Galaxian hardware -static struct BurnRomInfo BlkholeRomDesc[] = { - { "bh1", 0x00800, 0x64998819, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bh2", 0x00800, 0x26f26ce4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bh3", 0x00800, 0x3418bc45, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bh4", 0x00800, 0x735ff481, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bh5", 0x00800, 0x3f657be9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bh6", 0x00800, 0xa057ab35, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "bh7", 0x00800, 0x975ba821, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "bh8", 0x00800, 0x03d11020, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Blkhole) -STD_ROM_FN(Blkhole) - -static struct BurnRomInfo OrbitronRomDesc[] = { - { "orbitron.3", 0x00800, 0x419f9c9b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "orbitron.4", 0x00800, 0x44ad56ac, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "orbitron.1", 0x00800, 0xda3f5168, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "orbitron.2", 0x00800, 0xa3b813fc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "orbitron.5", 0x00800, 0x20cd8bb8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "orbitron.6", 0x00800, 0x2c91b83f, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "orbitron.7", 0x00800, 0x46f4cca4, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Orbitron) -STD_ROM_FN(Orbitron) - -static struct BurnRomInfo LuctodayRomDesc[] = { - { "ltprog1.bin", 0x00800, 0x59c389b9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ltprog2.bin", 0x00800, 0xac3893b1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ltchar2.bin", 0x00800, 0x8cd73bdc, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ltchar1.bin", 0x00800, 0xb5ba9946, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "74s288.ch", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Luctoday) -STD_ROM_FN(Luctoday) - -static struct BurnRomInfo ChewingRomDesc[] = { - { "1.bin", 0x01000, 0x7470b347, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7l.bin", 0x00800, 0x78ebed36, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "2.bin", 0x00800, 0x88c605f3, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "3.bin", 0x00800, 0x77ac016a, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "74s288.ch", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Chewing) -STD_ROM_FN(Chewing) - -static struct BurnRomInfo CatacombRomDesc[] = { - { "catacomb.u", 0x00800, 0x35cc28d2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "catacomb.v", 0x00800, 0x1d1ce133, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "catacomb.w", 0x00800, 0x479bbde7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "catacomb.y", 0x00800, 0x5e3da534, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "cat-gfx1", 0x00800, 0xe871e65c, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "cat-gfx2", 0x00800, 0xb14dafaa, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Catacomb) -STD_ROM_FN(Catacomb) - -static struct BurnRomInfo OmegaRomDesc[] = { - { "omega1.bin", 0x00800, 0xfc2a096b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "omega2.bin", 0x00800, 0xad100357, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "omega3.bin", 0x00800, 0xd7e3be79, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "omega4.bin", 0x00800, 0x42068171, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "omega5.bin", 0x00800, 0xd8a93383, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "omega6.bin", 0x00800, 0x32a42f44, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "omega1h.bin", 0x00800, 0x527fd384, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "omega1k.bin", 0x00800, 0x36de42c6, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331-1j.86", 0x00020, 0x6a0c7d87, BRF_OPT | BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Omega) -STD_ROM_FN(Omega) - -static struct BurnRomInfo WarofbugRomDesc[] = { - { "warofbug.u", 0x00800, 0xb8dfb7e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "warofbug.v", 0x00800, 0xfd8854e0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "warofbug.w", 0x00800, 0x4495aa14, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "warofbug.y", 0x00800, 0xc14a541f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "warofbug.z", 0x00800, 0xc167fe55, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "warofbug.1k", 0x00800, 0x8100fa85, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "warofbug.1j", 0x00800, 0xd1220ae9, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "warofbug.clr", 0x00020, 0x8688e64b, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Warofbug) -STD_ROM_FN(Warofbug) - -static struct BurnRomInfo WarofbuggRomDesc[] = { - { "wotbg-u-1.bin", 0x00800, 0xf43ff0a8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "wotbg-v-2.bin", 0x00800, 0xeb7a028b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "wotbg-w-3.bin", 0x00800, 0x693e0e50, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "wotbg-y-4.bin", 0x00800, 0x885d4982, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "wotbg-z-5.bin", 0x00800, 0x60041ef2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "warofbug.1k", 0x00800, 0x8100fa85, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "warofbug.1j", 0x00800, 0xd1220ae9, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "warofbug.clr", 0x00020, 0x8688e64b, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Warofbugg) -STD_ROM_FN(Warofbugg) - -static struct BurnRomInfo WarofbuguRomDesc[] = { - { "wb-prog-1.7d", 0x00800, 0xb8dfb7e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "wb-prog-2.7e", 0x00800, 0xfd8854e0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "wb-prog-3.7j", 0x00800, 0x4495aa14, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "wb-prog-4.7n", 0x00800, 0xe4bd257c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "wb-prog-5.7p", 0x00800, 0x71257bb4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "warofbug.1k", 0x00800, 0x8100fa85, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "warofbug.1j", 0x00800, 0xd1220ae9, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "warofbug.clr", 0x00020, 0x8688e64b, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Warofbugu) -STD_ROM_FN(Warofbugu) - -static struct BurnRomInfo RedufoRomDesc[] = { - { "redufo.1", 0x00800, 0x6a3b873c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "redufo.2", 0x00800, 0x202eda3b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "redufo.3", 0x00800, 0xbf7030e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "redufo.4", 0x00800, 0x8c1c2ef9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "redufo.5", 0x00800, 0xef965b24, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "redufo.6", 0x00800, 0x58b3e39b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "redufo.7", 0x00800, 0xfd07d811, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "redufo.8", 0x00800, 0xb34c7cb4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "redufo.9", 0x00800, 0x50a2d447, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "tbp18s030n.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Redufo) -STD_ROM_FN(Redufo) - -static struct BurnRomInfo RedufobRomDesc[] = { - { "ru1a", 0x00800, 0x5a8e4f37, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ru2a", 0x00800, 0xc624f52d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ru3a", 0x00800, 0xe1030d1c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ru4a", 0x00800, 0x7692069e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ru5a", 0x00800, 0xcb648ff3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ru6a", 0x00800, 0xe1a9f58e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ruhja", 0x00800, 0x8a422b0d, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rukla", 0x00800, 0x1eb84cb1, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Redufob) -STD_ROM_FN(Redufob) - -static struct BurnRomInfo ExodusRomDesc[] = { - { "exodus1.bin", 0x00800, 0x5dfe65e1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "exodus2.bin", 0x00800, 0x6559222f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "exodus3.bin", 0x00800, 0xbf7030e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "exodus4.bin", 0x00800, 0x3607909e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "exodus9.bin", 0x00800, 0x994a90c4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "exodus10.bin", 0x00800, 0xfbd11187, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "exodus11.bin", 0x00800, 0xfd07d811, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "exodus5.bin", 0x00800, 0xb34c7cb4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "exodus6.bin", 0x00800, 0x50a2d447, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Exodus) -STD_ROM_FN(Exodus) - -static struct BurnRomInfo TdpgalRomDesc[] = { - { "1.bin", 0x00800, 0x7be819fe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2.bin", 0x00800, 0x70c83a5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3.bin", 0x00800, 0x475eb5a0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4.bin", 0x00800, 0x20a71943, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5.bin", 0x00800, 0x72c4f2dc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6.bin", 0x00800, 0xfa4e2be4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "8.bin", 0x00800, 0xd701b1d4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "7.bin", 0x00800, 0x3113bcfd, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "bprom.bin", 0x00020, 0x2b4cf53f, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Tdpgal) -STD_ROM_FN(Tdpgal) - -static struct BurnRomInfo AzurianRomDesc[] = { - { "pgm.1", 0x01000, 0x17a0fca7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "pgm.2", 0x01000, 0x14659848, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "pgm.3", 0x01000, 0x8f60fb97, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "gfx.1", 0x00800, 0xf5afb803, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "gfx.2", 0x00800, 0xae96e5d1, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Azurian) -STD_ROM_FN(Azurian) - -static struct BurnRomInfo TazzmangRomDesc[] = { - { "tazzm1.4k", 0x01000, 0xa14480a1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tazzm2.5j", 0x01000, 0x5609f5db, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tazzm3.6f", 0x01000, 0xfe7f7002, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tazzm4.7e", 0x01000, 0xc9ca1d0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tazzm5.7l", 0x01000, 0xf50cd8a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tazzm6.7l", 0x01000, 0x5cf2e7d2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "tazm8.1lk", 0x00800, 0x2c5b612b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "tazzm7.1jh", 0x00800, 0x3f5ff3ac, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Tazzmang) -STD_ROM_FN(Tazzmang) - -static struct BurnRomInfo ScramblbRomDesc[] = { - { "scramble.1k", 0x00800, 0x9e025c4a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scramble.2k", 0x00800, 0x306f783e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scramble.3k", 0x00800, 0x0500b701, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scramble.4k", 0x00800, 0xdd380a22, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scramble.5k", 0x00800, 0xdf0b9648, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scramble.1j", 0x00800, 0xb8c07b3c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scramble.2j", 0x00800, 0x88ac07a0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scramble.3j", 0x00800, 0xc67d57ca, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "5f.k", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h.k", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Scramblb) -STD_ROM_FN(Scramblb) - -static struct BurnRomInfo Scramb2RomDesc[] = { - { "r1.7f1", 0x00800, 0x4a43148c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "r1.7f2", 0x00800, 0x215a3b86, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "r2.7h1", 0x00800, 0x28779444, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "r2.7h2", 0x00800, 0x5b4b300b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "r3.7k1", 0x00800, 0xb478aa53, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "r3.7k2", 0x00800, 0xc33f072e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "r4.7l1", 0x00800, 0x88ac07a0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "r4.7l2", 0x00800, 0x321fd003, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "r6.1j", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "r5.1l", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Scramb2) -STD_ROM_FN(Scramb2) - -UINT8 __fastcall AzurianZ80Read(UINT16 a) -{ - switch (a) { - case 0x6000: { - return GalInput[0] | GalDip[0]; - } - - case 0x6800: { - return ((GalInput[1] | GalDip[1]) & ~0x40) | ((GalFakeDip & 0x01) << 6); - } - - case 0x7000: { - return ((GalInput[2] | GalDip[2]) & ~0x04) | ((GalFakeDip & 0x02) << 1); - } - - case 0x7800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -UINT8 __fastcall TazzmangZ80Read(UINT16 a) -{ - switch (a) { - case 0x9800: - case 0xb800: { - // watchdog read - return 0xff; - } - - case 0xa000: - case 0xa7ff: { - return GalInput[0] | GalDip[0]; - } - - case 0xa800: { - return GalInput[1] | GalDip[1]; - } - - case 0x7000: - case 0xb000: { - return GalInput[2] | GalDip[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall TazzmangZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x8800 && a <= 0x88ff) { - INT32 Offset = a - 0x8800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa800: - case 0xa801: - case 0xa802: - case 0xa803: - case 0xa804: - case 0xa805: - case 0xa806: - case 0xa807: { - GalaxianSoundWrite(a - 0xa800, d); - return; - } - - case 0xb001: { - GalIrqFire = d & 1; - return; - } - - case 0xb004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall ScramblbZ80Read(UINT16 a) -{ - switch (a) { - case 0x6000: { - return GalInput[0] | GalDip[0]; - } - - case 0x6800: { - return GalInput[1] | GalDip[1]; - } - - case 0x7000: { - return GalInput[2] | GalDip[2]; - } - - case 0x7800: { - // watchdog read - return 0xff; - } - - case 0x8102: { - switch (ZetPc(-1)) { - case 0x1da: return 0x80; - case 0x1e4: return 0x00; - } - return 0xff; - } - - case 0x8202: { - switch (ZetPc(-1)) { - case 0x1ca: return 0x90; - } - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall ScramblbZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6000: - case 0x6001: { - // start_lamp_w - return; - } - - case 0x6002: { - // coin_lock_w - return; - } - - case 0x6004: - case 0x6005: - case 0x6006: - case 0x6007: { - GalaxianLfoFreqWrite(a - 0x6004, d); - return; - } - - case 0x6800: - case 0x6801: - case 0x6802: - case 0x6803: - case 0x6804: - case 0x6805: - case 0x6806: - case 0x6807: { - GalaxianSoundWrite(a - 0x6800, d); - return; - } - - case 0x7001: { - GalIrqFire = d & 1; - return; - } - - case 0x7002: { - // coin_count_0_w - return; - } - - case 0x7003: { - GalBackgroundEnable = d & 1; - return; - } - - case 0x7004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x7006: { - GalFlipScreenX = d & 1; - return; - } - - case 0x7007: { - GalFlipScreenY = d & 1; - return; - } - - case 0x7800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Scramb2Z80Read(UINT16 a) -{ - if (a >= 0x5800 && a <= 0x5fff) return 0x25; - - switch (a) { - case 0x6000: - case 0x6001: - case 0x6002: - case 0x6003: - case 0x6004: - case 0x6005: - case 0x6006: - case 0x6007: { - int Offset = a - 0x6000; - return ((0xff - GalInput[0] - GalDip[0]) >> Offset) & 0x01; - } - - case 0x6800: - case 0x6801: - case 0x6802: - case 0x6803: - case 0x6804: - case 0x6805: - case 0x6806: - case 0x6807: { - int Offset = a - 0x6800; - return ((0xff - GalInput[1] - GalDip[1]) >> Offset) & 0x01; - } - - case 0x7000: { - // watchdog read - return 0xff; - } - - case 0x7800: - case 0x7801: - case 0x7802: - case 0x7803: - case 0x7804: - case 0x7805: - case 0x7806: - case 0x7807: { - INT32 Offset = a - 0x7800; - return ((0xff - GalInput[2] - GalDip[2]) >> Offset) & 0x01; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall Scramb2Z80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6000: - case 0x6001: - case 0x6002: - case 0x6003: - case 0x6004: - case 0x6005: - case 0x6006: - case 0x6007: - case 0x7000: - case 0x7001: - case 0x7002: - case 0x7003: - case 0x7004: - case 0x7005: - case 0x7006: - case 0x7007: { - // Probably PPI writes that the bootleggers didn't use - return; - } - - case 0x6801: { - GalIrqFire = d & 1; - return; - } - - case 0x6802: { - // coin_count_0_w - return; - } - - case 0x6803: { - GalBackgroundEnable = d & 1; - return; - } - - case 0x6804: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x6806: { - GalFlipScreenX = d & 1; - return; - } - - case 0x6807: { - GalFlipScreenY = d & 1; - return; - } - - case 0x7800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static void OrbitronRearrangeRom() -{ - GalTempRom = (UINT8*)BurnMalloc(0x2000); - - memcpy(GalTempRom, GalZ80Rom1, 0x2000); - memcpy(GalZ80Rom1 + 0x0600, GalTempRom + 0x0000, 0x200); - memcpy(GalZ80Rom1 + 0x0400, GalTempRom + 0x0200, 0x200); - memcpy(GalZ80Rom1 + 0x0200, GalTempRom + 0x0400, 0x200); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0600, 0x200); - memcpy(GalZ80Rom1 + 0x0e00, GalTempRom + 0x0800, 0x200); - memcpy(GalZ80Rom1 + 0x0c00, GalTempRom + 0x0a00, 0x200); - memcpy(GalZ80Rom1 + 0x0a00, GalTempRom + 0x0c00, 0x200); - memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x0e00, 0x200); - memcpy(GalZ80Rom1 + 0x1600, GalTempRom + 0x1000, 0x200); - memcpy(GalZ80Rom1 + 0x1400, GalTempRom + 0x1200, 0x200); - memcpy(GalZ80Rom1 + 0x1200, GalTempRom + 0x1400, 0x200); - memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x1600, 0x200); - memcpy(GalZ80Rom1 + 0x1e00, GalTempRom + 0x1800, 0x200); - memcpy(GalZ80Rom1 + 0x1c00, GalTempRom + 0x1a00, 0x200); - memcpy(GalZ80Rom1 + 0x1a00, GalTempRom + 0x1c00, 0x200); - memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x1e00, 0x200); - BurnFree(GalTempRom); -} - -static INT32 OrbitronInit() -{ - GalPostLoadCallbackFunction = OrbitronRearrangeRom; - - return GalInit(); -} - -static void LuctodayRearrangeRom() -{ - memcpy(GalZ80Rom1 + 0x2000, GalZ80Rom1 + 0x0800, 0x800); - memset(GalZ80Rom1 + 0x0800, 0, 0x800); -} - -static INT32 LuctodayInit() -{ - GalZ80Rom1Size = 0x1800; - GalPostLoadCallbackFunction = LuctodayRearrangeRom; - - return GalInit(); -} - -static void ChewingRearrangeRom() -{ - memcpy(GalZ80Rom1 + 0x2000, GalZ80Rom1 + 0x1000, 0x800); - memset(GalZ80Rom1 + 0x1000, 0, 0x800); -} - -static INT32 ChewingInit() -{ - GalZ80Rom1Size = 0x1000; - GalPostLoadCallbackFunction = ChewingRearrangeRom; - - return GalInit(); -} - -static void CatacombRearrangeRom() -{ - memcpy(GalZ80Rom1 + 0x2000, GalZ80Rom1 + 0x1800, 0x800); - memset(GalZ80Rom1 + 0x1800, 0, 0x800); -} - -static INT32 CatacombInit() -{ - GalZ80Rom1Size = 0x800; - GalPostLoadCallbackFunction = CatacombRearrangeRom; - - return GalInit(); -} - -static void TdpgalPostLoad() -{ - ZetOpen(0); - ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); - ZetClose(); -} - -static INT32 TdpgalInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = TdpgalPostLoad; - - nRet = GalInit(); - - return nRet; -} - -static void AzurianPostLoad() -{ - ZetOpen(0); - ZetSetReadHandler(AzurianZ80Read); - ZetClose(); -} - -static INT32 AzurianInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = AzurianPostLoad; - - nRet = GalInit(); - - GalDrawBulletsFunction = ScrambleDrawBullets; - - return nRet; -} - -static void TazzmangPostLoad() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(TazzmangZ80Read); - ZetSetWriteHandler(TazzmangZ80Write); - ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetMapArea(0x8800, 0x88ff, 0, GalSpriteRam); - ZetMapArea(0x8800, 0x88ff, 2, GalSpriteRam); - ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); - ZetClose(); -} - -static INT32 TazzmangInit() -{ - GalPostLoadCallbackFunction = TazzmangPostLoad; - - return GalInit(); -} - -static void MapScramblb() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(ScramblbZ80Read); - ZetSetWriteHandler(ScramblbZ80Write); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); - ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 0, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 1, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 2, GalVideoRam); - ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); - ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); - ZetClose(); -} - -static INT32 ScramblbInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapScramblb; - - nRet = GalInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - return nRet; -} - -static void Scramb2PostLoad() -{ - MapScramblb(); - - ZetOpen(0); - ZetSetReadHandler(Scramb2Z80Read); - ZetSetWriteHandler(Scramb2Z80Write); - ZetClose(); -} - -static INT32 Scramb2Init() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = Scramb2PostLoad; - - nRet = GalInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - return nRet; -} - -struct BurnDriver BurnDrvBlkhole = { - "blkhole", NULL, NULL, NULL, "1981", - "Black Hole\0", NULL, "TDS", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, BlkholeRomInfo, BlkholeRomName, NULL, NULL, BlkholeInputInfo, BlkholeDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvOrbitron = { - "orbitron", NULL, NULL, NULL, "19??", - "Orbitron\0", NULL, "Signatron USA", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SHOOT, 0, - NULL, OrbitronRomInfo, OrbitronRomName, NULL, NULL, OrbitronInputInfo, OrbitronDIPInfo, - OrbitronInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvLuctoday = { - "luctoday", NULL, NULL, NULL, "1980", - "Lucky Today\0", "Bad colours", "Sigma", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_GALAXIAN, GBF_CASINO, 0, - NULL, LuctodayRomInfo, LuctodayRomName, NULL, NULL, LuctodayInputInfo, LuctodayDIPInfo, - LuctodayInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvChewing = { - "chewing", "luctoday", NULL, NULL, "1980", - "Chewing Gum\0", NULL, "unknown", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_CASINO, 0, - NULL, ChewingRomInfo, ChewingRomName, NULL, NULL, LuctodayInputInfo, LuctodayDIPInfo, - ChewingInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvCatacomb = { - "catacomb", NULL, NULL, NULL, "1982", - "Catacomb\0", "Bad Colours", "MTM Games", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, CatacombRomInfo, CatacombRomName, NULL, NULL, OmegaInputInfo, CatacombDIPInfo, - CatacombInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvOmega = { - "omega", "theend", NULL, NULL, "19??", - "Omega\0", NULL, "bootleg?", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, OmegaRomInfo, OmegaRomName, NULL, NULL, OmegaInputInfo, OmegaDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvWarofbug = { - "warofbug", NULL, NULL, NULL, "1981", - "War of the Bugs or Monsterous Manouvers in a Mushroom Maze\0", NULL, "Armenia", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, WarofbugRomInfo, WarofbugRomName, NULL, NULL, WarofbugInputInfo, WarofbugDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriverD BurnDrvWarofbugg = { - "warofbugg", "warofbug", NULL, NULL, "1981", - "War of the Bugs or Monsterous Manouvers in a Mushroom Maze (German)\0", NULL, "Armenia", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, WarofbuggRomInfo, WarofbuggRomName, NULL, NULL, WarofbugInputInfo, WarofbugDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvWarofbugu = { - "warofbugu", "warofbug", NULL, NULL, "1981", - "War of the Bugs or Monsterous Manouvers in a Mushroom Maze (US)\0", NULL, "Armenia", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, WarofbuguRomInfo, WarofbuguRomName, NULL, NULL, WarofbugInputInfo, WarofbugDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvRedufo = { - "redufo", NULL, NULL, NULL, "1981", - "Defend the Terra Attack on the Red UFO\0", NULL, "Artic", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, RedufoRomInfo, RedufoRomName, NULL, NULL, GalaxianInputInfo, RedufoDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvRedufob = { - "redufob", "redufo", NULL, NULL, "1981", - "Defend the Terra Attack on the Red UFO (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, RedufobRomInfo, RedufobRomName, NULL, NULL, GalaxianInputInfo, RedufobDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvExodus = { - "exodus", "redufo", NULL, NULL, "19??", - "Exodus (bootleg?)\0", NULL, "Subelectro", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, ExodusRomInfo, ExodusRomName, NULL, NULL, OmegaInputInfo, ExodusDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTdpgal = { - "tdpgal", NULL, NULL, NULL, "1983", - "Triple Draw Poker\0", NULL, "Design Labs / Thomas Automatics", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_CASINO, 0, - NULL, TdpgalRomInfo, TdpgalRomName, NULL, NULL, TdpgalInputInfo, NULL, - TdpgalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAzurian = { - "azurian", NULL, NULL, NULL, "1982", - "Azurian Attack\0", NULL, "Rait Electronics Ltd", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SHOOT, 0, - NULL, AzurianRomInfo, AzurianRomName, NULL, NULL, AzurianInputInfo, AzurianDIPInfo, - AzurianInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTazzmang = { - "tazzmang", "tazmania", NULL, NULL, "1982", - "Tazz-Mania (Galaxian hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, TazzmangRomInfo, TazzmangRomName, NULL, NULL, TazzmangInputInfo, TazzmangDIPInfo, - TazzmangInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScramblb = { - "scramblb", "scramble", NULL, NULL, "1981", - "Scramble (bootleg on Galaxian hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScramblbRomInfo, ScramblbRomName, NULL, NULL, ScramblbInputInfo, ScramblbDIPInfo, - ScramblbInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScramb2 = { - "scramb2", "scramble", NULL, NULL, "1981", - "Scramble (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, Scramb2RomInfo, Scramb2RomName, NULL, NULL, Scramb2InputInfo, Scramb2DIPInfo, - Scramb2Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Extra chars controlled via bank at 0x6002 -static struct BurnRomInfo PiscesRomDesc[] = { - { "p1.bin", 0x00800, 0x40c5b0e4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p2.bin", 0x00800, 0x055f9762, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p3.bin", 0x00800, 0x3073dd04, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p4.bin", 0x00800, 0x44aaf525, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p5.bin", 0x00800, 0xfade512b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p6.bin", 0x00800, 0x5ab2822f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "g09.bin", 0x00800, 0x9503a23a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g11.bin", 0x00800, 0x0adfc3fe, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g10.bin", 0x00800, 0x3e61f849, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g12.bin", 0x00800, 0x7130e9eb, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "colour.bin", 0x00020, 0x57a45057, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Pisces) -STD_ROM_FN(Pisces) - -static struct BurnRomInfo PiscesbRomDesc[] = { - { "pisces.a1", 0x00800, 0x856b8e1f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p2.bin", 0x00800, 0x055f9762, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "pisces.b2", 0x00800, 0x5540f2e4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p4.bin", 0x00800, 0x44aaf525, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p5.bin", 0x00800, 0xfade512b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p6.bin", 0x00800, 0x5ab2822f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "g09.bin", 0x00800, 0x9503a23a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g11.bin", 0x00800, 0x0adfc3fe, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g10.bin", 0x00800, 0x3e61f849, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g12.bin", 0x00800, 0x7130e9eb, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "colour.bin", 0x00020, 0x57a45057, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Piscesb) -STD_ROM_FN(Piscesb) - -static struct BurnRomInfo OmniRomDesc[] = { - { "omni1.7f", 0x01000, 0xa9b7acc6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "omni2.7j", 0x01000, 0x6ade29b7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "omni3.7f", 0x01000, 0x9e37bb24, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "omni5b.l1", 0x00800, 0x9503a23a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "omni6c.j22", 0x00800, 0x0adfc3fe, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "omni4a.j1", 0x00800, 0x3e61f849, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "omni7d.l2", 0x00800, 0x7130e9eb, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "colour.bin", 0x00020, 0x57a45057, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Omni) -STD_ROM_FN(Omni) - -static struct BurnRomInfo UniwarsRomDesc[] = { - { "f07_1a.bin", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "h07_2a.bin", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "k07_3a.bin", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m07_4a.bin", 0x00800, 0xddc80bc5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "d08p_5a.bin", 0x00800, 0x62354351, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "gg6", 0x00800, 0x270a3f4d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m08p_7a.bin", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "n08p_8a.bin", 0x00800, 0x797d45c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "egg10", 0x00800, 0x012941e0, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "h01_2.bin", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "egg9", 0x00800, 0xfc8b58fd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "uniwars.clr", 0x00020, 0x25c79518, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Uniwars) -STD_ROM_FN(Uniwars) - -static struct BurnRomInfo GteikokuRomDesc[] = { - { "f07_1a.bin", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "h07_2a.bin", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "k07_3a.bin", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m07_4a.bin", 0x00800, 0xddc80bc5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "d08p_5a.bin", 0x00800, 0x62354351, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e08p_6a.bin", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m08p_7a.bin", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "n08p_8a.bin", 0x00800, 0x797d45c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "h01_1.bin", 0x00800, 0x8313c959, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "h01_2.bin", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k01_1.bin", 0x00800, 0xc9d4537e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Gteikoku) -STD_ROM_FN(Gteikoku) - -static struct BurnRomInfo GteikokbRomDesc[] = { - { "1.bin", 0x00800, 0xbf00252f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2.bin", 0x00800, 0xf712b7d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "k07_3a.bin", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4.bin", 0x00800, 0x808a39a8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5.bin", 0x00800, 0x36fe6e67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6.bin", 0x00800, 0xc5ea67e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m08p_7a.bin", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8.bin", 0x00800, 0x28df3229, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "h01_1.bin", 0x00800, 0x8313c959, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "h01_2.bin", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k01_1.bin", 0x00800, 0xc9d4537e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Gteikokb) -STD_ROM_FN(Gteikokb) - -static struct BurnRomInfo Gteikob2RomDesc[] = { - { "94gnog.bin", 0x00800, 0x67ec3235, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "92gnog.bin", 0x00800, 0x813c41f2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "k07_3a.bin", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "1gnog.bin", 0x00800, 0x49ff9658, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5.bin", 0x00800, 0x36fe6e67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e08p_6a.bin", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m08p_7a.bin", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "98gnog.bin", 0x00800, 0xe9d4ad3c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "h01_1.bin", 0x00800, 0x8313c959, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "h01_2.bin", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k01_1.bin", 0x00800, 0xc9d4537e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Gteikob2) -STD_ROM_FN(Gteikob2) - -static struct BurnRomInfo SpacbattRomDesc[] = { - { "sb1", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb2", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb3", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb4", 0x00800, 0x8229835c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb5", 0x00800, 0xf51ef930, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb6", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb7", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb8", 0x00800, 0xe59ff1ae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "sb12", 0x00800, 0x8313c959, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "sb14", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "sb11", 0x00800, 0xc9d4537e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "sb13", 0x00800, 0x92454380, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Spacbatt) -STD_ROM_FN(Spacbatt) - -static struct BurnRomInfo Spacbat2RomDesc[] = { - { "sb1", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb2", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb.3", 0x00800, 0xc25ce4c1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb4", 0x00800, 0x8229835c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb5", 0x00800, 0xf51ef930, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb6", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb7", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sb8", 0x00800, 0xe59ff1ae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "sb12", 0x00800, 0x8313c959, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "sb14", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "sb11", 0x00800, 0xc9d4537e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Spacbat2) -STD_ROM_FN(Spacbat2) - -static struct BurnRomInfo SpacemprRomDesc[] = { - { "uw01", 0x00800, 0x7c64fb92, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "uw02", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "uw03", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "uw04", 0x00800, 0x84885060, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "uw05", 0x00800, 0xe342371d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "uw06", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "uw07", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "uw08", 0x00800, 0xa237c394, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "uw10", 0x00800, 0xaf069cba, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "uw12", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "uw09", 0x00800, 0xff2c20d5, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "uw11", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Spacempr) -STD_ROM_FN(Spacempr) - -static struct BurnRomInfo SkyraidrRomDesc[] = { - { "f07_1a.bin", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "h07_2a.bin", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "k07_3a.bin", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sr.04", 0x00800, 0x9f61d1f8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sr.05", 0x00800, 0x4352af0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sr.06", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m08p_7a.bin", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "n08p_8a.bin", 0x00800, 0x797d45c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "sr.10", 0x00800, 0xaf069cba, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "h01_2.bin", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "sr.09", 0x00800, 0xff2c20d5, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "uniwars.clr", 0x00020, 0x25c79518, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Skyraidr) -STD_ROM_FN(Skyraidr) - -static struct BurnRomInfo GalempRomDesc[] = { - { "1", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4", 0x00800, 0xdf7a13ea, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5", 0x00800, 0xff6128a2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8", 0x00800, 0x797d45c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "10", 0x00800, 0x30177b93, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "12", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "9", 0x00800, 0x7e8dcc13, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "11", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Galemp) -STD_ROM_FN(Galemp) - -void __fastcall PiscesZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5800 && a <= 0x58ff) { - INT32 Offset = a - 0x5800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6000: - case 0x6001: { - // start_lamp_w - return; - } - - case 0x6002: { - GalGfxBank[0] = d; - return; - } - - case 0x6003: { - // coin_count_0_w - return; - } - - case 0x6004: - case 0x6005: - case 0x6006: - case 0x6007: { - GalaxianLfoFreqWrite(a - 0x6004, d); - return; - } - - case 0x6800: - case 0x6801: - case 0x6802: - case 0x6803: - case 0x6804: - case 0x6805: - case 0x6806: - case 0x6807: { - GalaxianSoundWrite(a - 0x6800, d); - return; - } - - case 0x7001: { - GalIrqFire = d & 1; - return; - } - - case 0x7004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x7006: { - GalFlipScreenX = d & 1; - return; - } - - case 0x7007: { - GalFlipScreenY = d & 1; - return; - } - - case 0x7800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static void PiscesInstallGfxBankHandler() -{ - ZetOpen(0); - ZetSetWriteHandler(PiscesZ80Write); - ZetClose(); -} - -static INT32 PiscesInit() -{ - GalPostLoadCallbackFunction = PiscesInstallGfxBankHandler; - GalExtendTileInfoFunction = PiscesExtendTileInfo; - GalExtendSpriteInfoFunction = PiscesExtendSpriteInfo; - - return GalInit(); -} - -struct BurnDriver BurnDrvPisces = { - "pisces", NULL, NULL, NULL, "19??", - "Pisces\0", NULL, "Subelectro", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, PiscesRomInfo, PiscesRomName, NULL, NULL, PicsesInputInfo, PiscesDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvPiscesb = { - "piscesb", "pisces", NULL, NULL, "19??", - "Pisces (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, PiscesbRomInfo, PiscesbRomName, NULL, NULL, PicsesInputInfo, PiscesbDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvOmni = { - "omni", "pisces", NULL, NULL, "19??", - "Omni\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, OmniRomInfo, OmniRomName, NULL, NULL, OmegaInputInfo, PiscesbDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvUniwars = { - "uniwars", NULL, NULL, NULL, "1980", - "UniWar S\0", NULL, "Irem", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, UniwarsRomInfo, UniwarsRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGteikoku = { - "gteikoku", "uniwars", NULL, NULL, "1980", - "Gingateikoku No Gyakushu\0", NULL, "Irem", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GteikokuRomInfo, GteikokuRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGteikokb = { - "gteikokb", "uniwars", NULL, NULL, "1980", - "Gingateikoku No Gyakushu (bootleg set 1)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GteikokbRomInfo, GteikokbRomName, NULL, NULL, OmegaInputInfo, GteikokbDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGteikob2 = { - "gteikob2", "uniwars", NULL, NULL, "1980", - "Gingateikoku No Gyakushu (bootleg set 2)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Gteikob2RomInfo, Gteikob2RomName, NULL, NULL, OmegaInputInfo, Gteikob2DIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSpacbatt = { - "spacbatt", "uniwars", NULL, NULL, "1980", - "Space Battle (bootleg set 1)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SpacbattRomInfo, SpacbattRomName, NULL, NULL, GalaxianInputInfo, SpacbattDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSpacbat2 = { - "spacbat2", "uniwars", NULL, NULL, "1980", - "Space Battle (bootleg set 2)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Spacbat2RomInfo, Spacbat2RomName, NULL, NULL, GalaxianInputInfo, SpacbattDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSpacempr = { - "spacempr", "uniwars", NULL, NULL, "1980", - "Space Empire (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SpacemprRomInfo, SpacemprRomName, NULL, NULL, GalaxianInputInfo, SpacbattDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSkyraidr = { - "skyraidr", "uniwars", NULL, NULL, "1980", - "Sky Raiders\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SkyraidrRomInfo, SkyraidrRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGalemp = { - "galemp", "uniwars", NULL, NULL, "1980", - "Galaxy Empire (bootleg?)\0", NULL, "bootleg (Taito do Brasil)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, GalempRomInfo, GalempRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, - PiscesInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Extra chars contolled via different banking at 0x6002 -static struct BurnRomInfo Batman2RomDesc[] = { - { "01.bin", 0x00800, 0x150fbca5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "02.bin", 0x00800, 0xb1624fd0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "03.bin", 0x00800, 0x93774188, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "04.bin", 0x00800, 0x8a94ec6c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "05.bin", 0x00800, 0xa3669461, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "06.bin", 0x00800, 0xfa1efbfe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "07.bin", 0x00800, 0x9b77debd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "08.bin", 0x00800, 0x6466177e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "09.bin", 0x00800, 0x1a657b1f, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "11.bin", 0x00800, 0x7a2b48e5, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "10.bin", 0x00800, 0x9b570016, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "12.bin", 0x00800, 0x73956244, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Batman2) -STD_ROM_FN(Batman2) - -static struct BurnRomInfo LadybuggRomDesc[] = { - { "lbuggx.1", 0x00800, 0xe67e241d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lbuggx.2", 0x00800, 0x3cb1fb9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lbuggx.3", 0x00800, 0x0937009e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lbuggx.4", 0x00800, 0x3e773f62, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lbuggx.5", 0x00800, 0x2b0d42e5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lbuggx.6", 0x00800, 0x159f9433, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lbuggx.7", 0x00800, 0xf2be06d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lbuggx.8", 0x00800, 0x646fe79f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "lbuggx.a", 0x01000, 0x7efb9dc5, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "lbuggx.b", 0x01000, 0x351d4ddc, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "lbuggx.clr", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Ladybugg) -STD_ROM_FN(Ladybugg) - -static INT32 Batman2Init() -{ - GalPostLoadCallbackFunction = PiscesInstallGfxBankHandler; - GalExtendTileInfoFunction = Batman2ExtendTileInfo; - GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; - - return GalInit(); -} - -static INT32 LadybuggInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = PiscesInstallGfxBankHandler; - GalExtendTileInfoFunction = Batman2ExtendTileInfo; - GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; - - nRet = GalInit(); - - UINT8 *TempRom = (UINT8*)BurnMalloc(0x1000); - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); - memcpy(GalTempRom + 0x0800, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x0000, TempRom + 0x0800, 0x800); - BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); - memcpy(GalTempRom + 0x1800, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x1000, TempRom + 0x0800, 0x800); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - BurnFree(TempRom); - - return nRet; -} - -struct BurnDriver BurnDrvBatman2 = { - "batman2", "phoenix", NULL, NULL, "1981", - "Batman Part 2\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Batman2RomInfo, Batman2RomName, NULL, NULL, Batman2InputInfo, Batman2DIPInfo, - Batman2Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvLadybugg = { - "ladybugg", "ladybug", NULL, NULL, "1983", - "Lady Bug (bootleg on Galaxian hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, LadybuggRomInfo, LadybuggRomName, NULL, NULL, LadybuggInputInfo, LadybuggDIPInfo, - LadybuggInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Seperate sprite/tile roms -static struct BurnRomInfo StreakngRomDesc[] = { - { "sk1", 0x01000, 0xc8866ccb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sk2", 0x01000, 0x7caea29b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sk3", 0x01000, 0x7b4bfa76, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "sk4", 0x01000, 0x056fc921, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "sk5", 0x01000, 0xd27f1e0c, BRF_GRA | GAL_ROM_TILES_CHARS }, - - { "sk6", 0x01000, 0xa7089588, BRF_GRA | GAL_ROM_TILES_SPRITES }, - - { "sk.bpr", 0x00020, 0xbce79607, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Streakng) -STD_ROM_FN(Streakng) - -static struct BurnRomInfo StreakngaRomDesc[] = { - { "st1.bin", 0x00800, 0xc827e124, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "st2.bin", 0x00800, 0xb01d4f8f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "st3.bin", 0x00800, 0xc7a9c493, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "st4.bin", 0x00800, 0x12487c75, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5st.bin", 0x00800, 0xf9f9e2be, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6st.bin", 0x00800, 0xc22fe6c2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7st.bin", 0x00800, 0x9cd7869a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8st.bin", 0x00800, 0x5e750ad3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "11.bin", 0x00800, 0xcddd8924, BRF_GRA | GAL_ROM_TILES_CHARS }, - { "12.bin", 0x00800, 0x10cda095, BRF_GRA | GAL_ROM_TILES_CHARS }, - - { "9.bin", 0x00800, 0x6a2a8a0f, BRF_GRA | GAL_ROM_TILES_SPRITES }, - { "10.bin", 0x00800, 0x3563dfbe, BRF_GRA | GAL_ROM_TILES_SPRITES }, - - { "sk.bpr", 0x00020, 0xbce79607, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Streaknga) -STD_ROM_FN(Streaknga) - -static struct BurnRomInfo PacmanblRomDesc[] = { - { "1", 0x00800, 0x6718df42, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2", 0x00800, 0x33be3648, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3", 0x00800, 0xf98c0ceb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4", 0x00800, 0xa9cd0082, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5", 0x00800, 0x6d475afc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6", 0x00800, 0xcbe863d3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7", 0x00800, 0x7daef758, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "12", 0x00800, 0xb2ed320b, BRF_GRA | GAL_ROM_TILES_CHARS }, - { "11", 0x00800, 0xab88b2c4, BRF_GRA | GAL_ROM_TILES_CHARS }, - - { "10", 0x00800, 0x44a45b72, BRF_GRA | GAL_ROM_TILES_SPRITES }, - { "9", 0x00800, 0xfa84659f, BRF_GRA | GAL_ROM_TILES_SPRITES }, - - { "sn74s288n.6l", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Pacmanbl) -STD_ROM_FN(Pacmanbl) - -static struct BurnRomInfo PacmanblaRomDesc[] = { - { "rom1.bin", 0x01000, 0x75e4f967, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom2.bin", 0x01000, 0x5b2e4293, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom3.bin", 0x01000, 0xc06e30a4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom4.bin", 0x01000, 0x592b4ba8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "rom5.bin", 0x01000, 0xf2d8c01e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom6.bin", 0x01000, 0x346a1720, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "sn74s288n.6l", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Pacmanbla) -STD_ROM_FN(Pacmanbla) - -static struct BurnRomInfo Phoenxp2RomDesc[] = { - { "1", 0x00800, 0xf6dcfd51, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2", 0x00800, 0xde951936, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3", 0x00800, 0x7a3af2da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4", 0x00800, 0xc820ad32, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5", 0x00800, 0x08e83233, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6", 0x00800, 0xf31fb9d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7", 0x00800, 0xd3a480c1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8", 0x00800, 0xedf9779e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "10", 0x00800, 0x9b570016, BRF_GRA | GAL_ROM_TILES_CHARS }, - { "09", 0x00800, 0x1a657b1f, BRF_GRA | GAL_ROM_TILES_CHARS }, - - { "12", 0x00800, 0x73956244, BRF_GRA | GAL_ROM_TILES_SPRITES }, - { "11", 0x00800, 0x7a2b48e5, BRF_GRA | GAL_ROM_TILES_SPRITES }, - - { "sn74s288n.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Phoenxp2) -STD_ROM_FN(Phoenxp2) - -static struct BurnRomInfo AtlantisbRomDesc[] = { - { "1", 0x00800, 0x2b612351, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2", 0x00800, 0xb1c970e9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3", 0x00800, 0x63c3783e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4", 0x00800, 0x45f7cf34, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5", 0x00800, 0xf335b96b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6", 0x00800, 0xa50bf8d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "8", 0x00800, 0x55cd5acd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "7", 0x00800, 0x72e773b8, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "sn74s288n.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Atlantisb) -STD_ROM_FN(Atlantisb) - -static INT32 PacmanblInit() -{ - INT32 nRet = GalInit(); - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - return nRet; -} - -static void PacmanblaRearrangeRom() -{ - GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); - memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x800); - memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0800, 0x800); - memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1000, 0x800); - memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1800, 0x800); - memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x800); - memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2800, 0x800); - memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3000, 0x800); - memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3800, 0x800); - BurnFree(GalTempRom); -} - -static INT32 PacmanblaInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = PacmanblaRearrangeRom; - - nRet = PacmanblInit(); - - GalNumChars = 0x100; - GalNumSprites = 0x40; - CharPlaneOffsets[1] = 0x4000; - SpritePlaneOffsets[1] = 0x4000; - - UINT8 *TempRom = (UINT8*)BurnMalloc(0x2000); - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); - BurnLoadRom(TempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); - memcpy(GalTempRom + 0x0000, TempRom + 0x0800, 0x800); - memcpy(GalTempRom + 0x0800, TempRom + 0x1800, 0x800); - memcpy(GalTempRom + 0x1000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x1800, TempRom + 0x1000, 0x800); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom + 0x1000, GalSprites); - BurnFree(GalTempRom); - BurnFree(TempRom); - - return nRet; -} - -static void AtlantisbRearrangeRom() -{ - GalTempRom = (UINT8*)BurnMalloc(0x3000); - - memcpy(GalTempRom, GalZ80Rom1, 0x3000); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x1000); - memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x1000, 0x2000); - BurnFree(GalTempRom); -} - -static INT32 AtlantisbInit() -{ - GalZ80Rom1Size = 0x1000; - - GalPostLoadCallbackFunction = AtlantisbRearrangeRom; - - return GalInit(); -} - -struct BurnDriver BurnDrvStreakng = { - "streakng", NULL, NULL, NULL, "1981", - "Streaking (set 1)\0", "Bad Colours", "Shoei", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, StreakngRomInfo, StreakngRomName, NULL, NULL, StreakngInputInfo, StreakngDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvStreaknga = { - "streaknga", "streakng", NULL, NULL, "1981", - "Streaking (set 2)\0", "Bad Colours", "Shoei", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, StreakngaRomInfo, StreakngaRomName, NULL, NULL, StreakngInputInfo, StreakngDIPInfo, - GalInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvPacmanbl = { - "pacmanbl", "puckman", NULL, NULL, "1981", - "Pac-Man (Galaxian hardware, set 1)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, PacmanblRomInfo, PacmanblRomName, NULL, NULL, PacmanblInputInfo, PacmanblDIPInfo, - PacmanblInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvPacmanbla = { - "pacmanbla", "puckman", NULL, NULL, "1981", - "Pac-Man (Galaxian hardware, set 2)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, PacmanblaRomInfo, PacmanblaRomName, NULL, NULL, PacmanblInputInfo, PacmanblDIPInfo, - PacmanblaInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvPhoenxp2 = { - "phoenxp2", "phoenix", NULL, NULL, "1981", - "Phoenix Part 2\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Phoenxp2RomInfo, Phoenxp2RomName, NULL, NULL, Phoenxp2InputInfo, Phoenxp2DIPInfo, - PacmanblInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAtlantisb = { - "atlantisb", "atlantis", NULL, NULL, "1981", - "Battle of Atlantis (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, AtlantisbRomInfo, AtlantisbRomName, NULL, NULL, Phoenxp2InputInfo, AtlantisbDIPInfo, - AtlantisbInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Seperate sprite/tile roms with IRQ0 instead of NMI -static struct BurnRomInfo DevilfsgRomDesc[] = { - { "dfish1.7f", 0x01000, 0x2ab19698, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "dfish2.7h", 0x01000, 0x4e77f097, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "dfish3.7k", 0x01000, 0x3f16a4c6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "dfish4.7m", 0x01000, 0x11fc7e59, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "dfish5.1h", 0x01000, 0xace6e31f, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "dfish6.1k", 0x01000, 0xd7a6c4c4, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Devilfsg) -STD_ROM_FN(Devilfsg) - -static void DevilfsgRearrangeRom() -{ - GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); - memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); - memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0000, 0x800); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0800, 0x800); - memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1000, 0x800); - memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1800, 0x800); - memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2000, 0x800); - memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2800, 0x800); - memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3000, 0x800); - memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3800, 0x800); - BurnFree(GalTempRom); -} - -static INT32 DevilfsgInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = DevilfsgRearrangeRom; - - nRet = GalInit(); - - GalNumChars = 0x100; - GalNumSprites = 0x40; - CharPlaneOffsets[1] = 0x4000; - SpritePlaneOffsets[1] = 0x4000; - - UINT8 *TempRom = (UINT8*)BurnMalloc(0x2000); - GalTempRom = (UINT8*)BurnMalloc(0x1000); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - nRet = BurnLoadRom(TempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x0000, TempRom + 0x0800, 0x800); - memcpy(GalTempRom + 0x0800, TempRom + 0x1800, 0x800); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - memcpy(GalTempRom + 0x0000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x0800, TempRom + 0x1000, 0x800); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - BurnFree(TempRom); - - GalIrqType = GAL_IRQ_TYPE_IRQ0; - - return nRet; -} - -struct BurnDriver BurnDrvDevilfsg = { - "devilfsg", "devilfsh", NULL, NULL, "1984", - "Devil Fish (Galaxian hardware, bootleg?)\0", NULL, "Vision / Artic", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, DevilfsgRomInfo, DevilfsgRomName, NULL, NULL, DevilfsgInputInfo, DevilfsgDIPInfo, - DevilfsgInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Sound hardware replaced with AY8910 -static struct BurnRomInfo ZigzagRomDesc[] = { - { "zz_d1.7l", 0x01000, 0x8cc08d81, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "zz_d2.7k", 0x01000, 0x326d8d45, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "zz_d4.7f", 0x01000, 0xa94ed92a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "zz_d3.7h", 0x01000, 0xce5e7a00, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "zz_6.1h", 0x01000, 0x780c162a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "zz_5.1k", 0x01000, 0xf3cdfec5, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "zzbpr_e9.bin", 0x00020, 0xaa486dd0, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Zigzag) -STD_ROM_FN(Zigzag) - -static struct BurnRomInfo Zigzag2RomDesc[] = { - { "z1.7l", 0x01000, 0x4c28349a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "zz_d2.7k", 0x01000, 0x326d8d45, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "zz_d4.7f", 0x01000, 0xa94ed92a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "zz_d3.7h", 0x01000, 0xce5e7a00, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "zz_6.1h", 0x01000, 0x780c162a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "zz_5.1k", 0x01000, 0xf3cdfec5, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "zzbpr_e9.bin", 0x00020, 0xaa486dd0, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Zigzag2) -STD_ROM_FN(Zigzag2) - -static struct BurnRomInfo Ozon1RomDesc[] = { - { "rom1.bin", 0x01000, 0x54899e8b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom2.bin", 0x01000, 0x3c90fbfc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom3.bin", 0x01000, 0x79fe313b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "rom7.bin", 0x00800, 0x464285e8, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom8.bin", 0x00800, 0x92056dcc, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "ozon1.clr", 0x00020, 0x605ea6e9, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Ozon1) -STD_ROM_FN(Ozon1) - -void __fastcall ZigzagZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x4800 && a <= 0x4fff) { - INT32 Offset = a - 0x4800; - - switch (Offset & 0x300) { - case 0x000: { - if ((Offset & 1) != 0) { - if ((Offset & 2) == 0) { - AY8910Write(0, 1, ZigzagAYLatch); - } else { - AY8910Write(0, 0, ZigzagAYLatch); - } - } - break; - } - - case 0x100: { - ZigzagAYLatch = Offset & 0xff; - break; - } - } - return; - } - - if (a >= 0x5800 && a <= 0x58ff) { - INT32 Offset = a - 0x5800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6000: - case 0x6001: { - // start_lamp_w - return; - } - - case 0x6002: { - // coin_lock_w - return; - } - - case 0x6003: { - // coin_count_0_w - return; - } - - case 0x7001: { - GalIrqFire = d & 1; - return; - } - - case 0x7002: { - ZetMapArea(0x2000, 0x2fff, 0, GalZ80Rom1 + 0x2000 + (0x1000 * (d & 1))); - ZetMapArea(0x2000, 0x2fff, 2, GalZ80Rom1 + 0x2000 + (0x1000 * (d & 1))); - ZetMapArea(0x3000, 0x3fff, 0, GalZ80Rom1 + 0x2000 + (0x1000 * (~d & 1))); - ZetMapArea(0x3000, 0x3fff, 2, GalZ80Rom1 + 0x2000 + (0x1000 * (~d & 1))); - return; - } - - case 0x7004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x7006: { - GalFlipScreenX = d & 1; - return; - } - - case 0x7007: { - GalFlipScreenY = d & 1; - return; - } - - case 0x7800: { - // watchdog write - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Ozon1Z80Read(UINT16 a) -{ - switch (a) { - case 0x8100: { - return 0xff - (GalInput[0] | GalDip[0]); - } - - case 0x8101: { - return 0xff - (GalInput[1] | GalDip[1]); - } - - case 0x8102: { - return 0xff - (GalInput[2] | GalDip[2]); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall Ozon1Z80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6801: { - // ??? - GalIrqFire = d & 1; - return; - } - - case 0x6802: { - // coin_counter_0_w - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall Ozon1Z80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - AY8910Write(0, 1, d); - return; - } - - case 0x01: { - AY8910Write(0, 0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -static void ZigzagInstallHandler() -{ - ZetOpen(0); - ZetSetWriteHandler(ZigzagZ80Write); - ZetClose(); -} - -static INT32 ZigzagInit() -{ - INT32 nRet; - - GalSoundType = GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910; - GalPostLoadCallbackFunction = ZigzagInstallHandler; - - nRet = GalInit(); - - GalNumChars = 0x100; - GalNumSprites = 0x40; - CharPlaneOffsets[1] = 0x4000; - SpritePlaneOffsets[1] = 0x4000; - - UINT8 *TempRom = (UINT8*)BurnMalloc(0x2000); - GalTempRom = (UINT8*)BurnMalloc(0x1000); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - nRet = BurnLoadRom(TempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x0000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x0800, TempRom + 0x1000, 0x800); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - memcpy(GalTempRom + 0x0000, TempRom + 0x0800, 0x800); - memcpy(GalTempRom + 0x0800, TempRom + 0x1800, 0x800); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - BurnFree(TempRom); - - GalDrawBulletsFunction = NULL; - - AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -static void Ozon1PostLoad() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(Ozon1Z80Read); - ZetSetWriteHandler(Ozon1Z80Write); - ZetSetOutHandler(Ozon1Z80PortWrite); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x4000, 0x43ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x43ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x43ff, 2, GalZ80Ram1); - ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 0, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 1, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 2, GalVideoRam); - ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); - ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); - ZetMemEnd(); - ZetClose(); -} - -static INT32 Ozon1Init() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = Ozon1PostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910; - - nRet = GalInit(); - - GalDrawBulletsFunction = NULL; - GalRenderBackgroundFunction = NULL; - - return nRet; -} - -struct BurnDriver BurnDrvZigzag = { - "zigzag", NULL, NULL, NULL, "1982", - "Zig Zag (Galaxian hardware, set 1)\0", NULL, "LAX", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, ZigzagRomInfo, ZigzagRomName, NULL, NULL, ZigzagInputInfo, ZigzagDIPInfo, - ZigzagInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvZigzag2 = { - "zigzag2", "zigzag", NULL, NULL, "1982", - "Zig Zag (Galaxian hardware, set 2)\0", NULL, "LAX", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, Zigzag2RomInfo, Zigzag2RomName, NULL, NULL, ZigzagInputInfo, ZigzagDIPInfo, - ZigzagInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvOzon1 = { - "ozon1", NULL, NULL, NULL, "1983", - "Ozon I\0", NULL, "Proma", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Ozon1RomInfo, Ozon1RomName, NULL, NULL, Ozon1InputInfo, Ozon1DIPInfo, - Ozon1Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Multi-game select via external switch -static struct BurnRomInfo GmgalaxRomDesc[] = { - { "pcb1_pm1.bin", 0x01000, 0x19338c70, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "pcb1_pm2.bin", 0x01000, 0x18db074d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "pcb1_pm3.bin", 0x01000, 0xabb98b1d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "pcb1_pm4.bin", 0x01000, 0x2403c78e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "pcb1_gx1.bin", 0x01000, 0x2faa9f53, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "pcb1_gx2.bin", 0x01000, 0x121c5f16, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "pcb1_gx3.bin", 0x01000, 0x02d81a21, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "pcb2gfx1.bin", 0x01000, 0x7021bbc0, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "pcb2gfx3.bin", 0x01000, 0x089c922b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "pcb2gfx2.bin", 0x01000, 0x51bf58ee, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "pcb2gfx4.bin", 0x01000, 0x908fd0dc, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "gmgalax2.clr", 0x00020, 0x499f4440, BRF_GRA | GAL_ROM_PROM }, - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Gmgalax) -STD_ROM_FN(Gmgalax) - -UINT8 __fastcall GmgalaxZ80Read(UINT16 a) -{ - switch (a) { - case 0x6000: { - return GalInput[0] | ((GmgalaxSelectedGame) ? GalDip[3] : GalDip[0]); - } - - case 0x6800: { - return GalInput[1] | ((GmgalaxSelectedGame) ? GalDip[4] : GalDip[1]); - } - - case 0x7000: { - return GalInput[2] | ((GmgalaxSelectedGame) ? GalDip[5] : GalDip[2]); - } - - case 0x7800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0x00; -} - -static void GmgalaxPostLoad() -{ - ZetOpen(0); - ZetSetReadHandler(GmgalaxZ80Read); - ZetClose(); -} - -static INT32 GmgalaxInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = GmgalaxPostLoad; - GalZ80Rom1Size = 0x1000; - - nRet = GalInit(); - - UINT8 *TempRom = (UINT8*)BurnMalloc(0x1000); - GalTempRom = (UINT8*)BurnMalloc(0x4000); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x0000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x1000, TempRom + 0x0800, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x0800, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x1800, TempRom + 0x0800, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x2000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x3000, TempRom + 0x0800, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x2800, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x3800, TempRom + 0x0800, 0x800); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - BurnFree(TempRom); - - GalExtendTileInfoFunction = GmgalaxExtendTileInfo; - GalExtendSpriteInfoFunction = GmgalaxExtendSpriteInfo; - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - GameIsGmgalax = 1; - - return nRet; -} - -struct BurnDriver BurnDrvGmgalax = { - "gmgalax", NULL, NULL, NULL, "1981", - "Ghostmuncher Galaxian (bootleg)\0", NULL, "LAX", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, GmgalaxRomInfo, GmgalaxRomName, NULL, NULL, GmgalaxInputInfo, GmgalaxDIPInfo, - GmgalaxInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Multi-game select via menu, with different graphic and sprite roms -static struct BurnRomInfo Fourin1RomDesc[] = { - { "rom1a", 0x01000, 0xce1af4d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom1b", 0x01000, 0x18484f9b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom1c", 0x01000, 0x83248a8b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom1d", 0x01000, 0x053f6da0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom1e", 0x01000, 0x43c546f3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom1f", 0x01000, 0x3a086b46, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom1g", 0x01000, 0xac0e2050, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom1h", 0x01000, 0xdc11a513, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom1i", 0x01000, 0xa5fb6be4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom1j", 0x01000, 0x9054cfbe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom2c", 0x01000, 0x7cd98e11, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom2d", 0x01000, 0x9402f32e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom2e", 0x01000, 0x468e81df, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom2g", 0x01000, 0xb1ce3976, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom2h", 0x01000, 0x7eab5670, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom2i", 0x01000, 0x44565ac5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "rom4b", 0x01000, 0x7e6495af, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom3b", 0x01000, 0x7475f72f, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom4c", 0x00800, 0x3355d46d, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom3c", 0x00800, 0xac755a25, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom4d", 0x01000, 0xbbdddb65, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom3d", 0x01000, 0x91a00204, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom4e", 0x01000, 0x0cb9e297, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom3e", 0x01000, 0xa1fe77f9, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Fourin1) -STD_ROM_FN(Fourin1) - -UINT8 __fastcall Fourin1Z80Read(UINT16 a) -{ - switch (a) { - case 0x6000: { - return GalInput[0] | GalDip[0]; - } - - case 0x6800: { - return ((GalInput[1] | GalDip[1]) & ~0xc0) | (GalDip[3 + Fourin1Bank] & 0xc0); - } - - case 0x7000: { - return ((GalInput[2] | GalDip[2]) & 0x04) | (GalDip[3 + Fourin1Bank] & ~0xc4); - } - - case 0x7800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall Fourin1Z80Write(UINT16 a, UINT8 d) -{ - if (a < 0x4000) return; - - if (a >= 0x5800 && a <= 0x58ff) { - INT32 Offset = a - 0x5800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6000: - case 0x6001: { - // start_lamp_w - return; - } - - case 0x6002: { - // coin_lock_w - return; - } - - case 0x6003: { - // coin_count_0_w - return; - } - - case 0x6004: - case 0x6005: - case 0x6006: - case 0x6007: { - GalaxianLfoFreqWrite(a - 0x6004, d); - return; - } - - case 0x6800: - case 0x6801: - case 0x6802: - case 0x6803: - case 0x6804: - case 0x6805: - case 0x6806: - case 0x6807: { - GalaxianSoundWrite(a - 0x6800, d); - return; - } - - case 0x7001: { - GalIrqFire = d & 1; - return; - } - - case 0x7004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x7006: { - GalFlipScreenX = d & 1; - return; - } - - case 0x7007: { - GalFlipScreenY = d & 1; - return; - } - - case 0x7800: { - GalPitch = d; - return; - } - - case 0x8000: { - Fourin1Bank = d & 0x03; - ZetMapArea(0x0000, 0x3fff, 0, GalZ80Rom1 + 0x2000 + (Fourin1Bank * 0x4000)); - ZetMapArea(0x0000, 0x3fff, 2, GalZ80Rom1 + 0x2000 + (Fourin1Bank * 0x4000)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static void Fourin1PostLoad() -{ - GalTempRom = (UINT8*)BurnMalloc(0x3000); - memcpy(GalTempRom, GalZ80Rom1 + 0xd000, 0x3000); - memset(GalZ80Rom1 + 0xd000, 0x00, 0x1000); - memcpy(GalZ80Rom1 + 0xe000, GalTempRom, 0x3000); - memset(GalZ80Rom1 + 0x11000, 0x00, 0x1000); - BurnFree(GalTempRom); - - for (UINT32 i = 0; i < GalZ80Rom1Size; i++) { - GalZ80Rom1[i] = GalZ80Rom1[i] ^ (i & 0xff); - } - - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(Fourin1Z80Read); - ZetSetWriteHandler(Fourin1Z80Write); - ZetMapArea(0x0000, 0x3fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x3fff, 2, GalZ80Rom1); - ZetMapArea(0x4000, 0x43ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x43ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x43ff, 2, GalZ80Ram1); - ZetMapArea(0x5000, 0x53ff, 0, GalVideoRam); - ZetMapArea(0x5000, 0x53ff, 1, GalVideoRam); - ZetMapArea(0x5000, 0x53ff, 2, GalVideoRam); - ZetMapArea(0x5800, 0x58ff, 0, GalSpriteRam); - ZetMapArea(0x5800, 0x58ff, 2, GalSpriteRam); - ZetMapArea(0xc000, 0xdfff, 0, GalZ80Rom1); - ZetMapArea(0xc000, 0xdfff, 2, GalZ80Rom1); - ZetClose(); -} - -static INT32 Fourin1Init() -{ - INT32 nRet; - - Fourin1Bank = 0; - GalPostLoadCallbackFunction = Fourin1PostLoad; - GalZ80Rom1Size = 0x2000; - GalTilesSharedRomSize = 0x1000; - - nRet = GalInit(); - - GalNumChars = 1024; - GalNumSprites = 256; - CharPlaneOffsets[1] = GalNumChars * 8 * 8; - SpritePlaneOffsets[1] = GalNumSprites * 16 * 16; - - UINT8 *TempRom = (UINT8*)BurnMalloc(0x1000); - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x4000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x0000, TempRom + 0x0800, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x6000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x2000, TempRom + 0x0800, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x4800, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x0800, TempRom + 0x0000, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x6800, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x2800, TempRom + 0x0000, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 4, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x5000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x1000, TempRom + 0x0800, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 5, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x7000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x3000, TempRom + 0x0800, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 6, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x5800, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x1800, TempRom + 0x0800, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 7, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x7800, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x3800, TempRom + 0x0800, 0x800); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom + 0x4000, GalSprites); - BurnFree(GalTempRom); - BurnFree(TempRom); - - GalExtendTileInfoFunction = Fourin1ExtendTileInfo; - GalExtendSpriteInfoFunction = Fourin1ExtendSpriteInfo; - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - return nRet; -} - -struct BurnDriver BurnDrvFourin1 = { - "4in1", NULL, NULL, NULL, "1981", - "4 Fun in 1\0", NULL, "Armenia / Food and Fun", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, Fourin1RomInfo, Fourin1RomName, NULL, NULL, Fourin1InputInfo, Fourin1DIPInfo, - Fourin1Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Moon Cresta on Galaxian hardware with different memory map -static struct BurnRomInfo MooncrstRomDesc[] = { - { "mc1", 0x00800, 0x7d954a7a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc2", 0x00800, 0x44bb7cfa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc3", 0x00800, 0x9c412104, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc4", 0x00800, 0x7e9b1ab5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc5.7r", 0x00800, 0x16c759af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc6.8d", 0x00800, 0x69bcafdb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc7.8e", 0x00800, 0xb50dbc46, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc8", 0x00800, 0x18ca312b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mcs_b", 0x00800, 0xfb0f1f81, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_a", 0x00800, 0x631ebb5a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncrst) -STD_ROM_FN(Mooncrst) - -static struct BurnRomInfo MooncrstukRomDesc[] = { - { "mc1", 0x00800, 0x7d954a7a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc2", 0x00800, 0x44bb7cfa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc3", 0x00800, 0x9c412104, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc4", 0x00800, 0x7e9b1ab5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc5.7r", 0x00800, 0x16c759af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc6.8d", 0x00800, 0x69bcafdb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc7.8e", 0x00800, 0xb50dbc46, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8_uk.bin", 0x00800, 0xce727ad4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mcs_b", 0x00800, 0xfb0f1f81, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_a", 0x00800, 0x631ebb5a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncrstuk) -STD_ROM_FN(Mooncrstuk) - -static struct BurnRomInfo MooncrstukuRomDesc[] = { - { "smc1f", 0x00800, 0x389ca0d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc2f", 0x00800, 0x410ab430, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc3f", 0x00800, 0xa6b4144b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc4f", 0x00800, 0x4cc046fe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc5f", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc6f", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc7f", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc8f_uk", 0x00800, 0xb968b2ff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mcs_b", 0x00800, 0xfb0f1f81, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_a", 0x00800, 0x631ebb5a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncrstuku) -STD_ROM_FN(Mooncrstuku) - -static struct BurnRomInfo MooncrstuRomDesc[] = { - { "smc1f", 0x00800, 0x389ca0d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc2f", 0x00800, 0x410ab430, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc3f", 0x00800, 0xa6b4144b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc4f", 0x00800, 0x4cc046fe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bepr199", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "smc8f", 0x00800, 0xf42164c5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mcs_b", 0x00800, 0xfb0f1f81, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_a", 0x00800, 0x631ebb5a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncrstu) -STD_ROM_FN(Mooncrstu) - -static struct BurnRomInfo MooncrstoRomDesc[] = { - { "mc1.7d", 0x00800, 0x92a86aac, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc2.7e", 0x00800, 0x438c2b4b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc3.7j", 0x00800, 0x67e3d21d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc4.7p", 0x00800, 0xf4db39f6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc5.7r", 0x00800, 0x16c759af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc6.8d", 0x00800, 0x69bcafdb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc7.8e", 0x00800, 0xb50dbc46, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mc8.8h", 0x00800, 0x7e2b1928, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mcs_b", 0x00800, 0xfb0f1f81, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_a", 0x00800, 0x631ebb5a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncrsto) -STD_ROM_FN(Mooncrsto) - -static struct BurnRomInfo MooncrstgRomDesc[] = { - { "epr194", 0x00800, 0x0e5582b1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr195", 0x00800, 0x12cb201b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr196", 0x00800, 0x18255614, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr197", 0x00800, 0x05ac1466, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr198", 0x00800, 0xc28a2e8f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr199", 0x00800, 0x5a4571de, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr200", 0x00800, 0xb7c85bf1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr201", 0x00800, 0x2caba07f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "epr203", 0x00800, 0xbe26b561, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr202", 0x00800, 0x26c7e800, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncrstg) -STD_ROM_FN(Mooncrstg) - -static void MooncrstEncryptedPostLoad() -{ - for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { - UINT8 Data = GalZ80Rom1[Offset]; - UINT8 Res = Data; - if (BIT(Data, 1)) Res ^= 0x40; - if (BIT(Data, 5)) Res ^= 0x04; - if ((Offset & 1) == 0) Res = BITSWAP08(Res, 7, 2, 5, 4, 3, 6, 1, 0); - GalZ80Rom1[Offset] = Res; - } - - MapMooncrst(); -} - -static INT32 MooncrstEncryptedInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MooncrstEncryptedPostLoad; - - nRet = GalInit(); - - GalExtendTileInfoFunction = MooncrstExtendTileInfo; - GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; - - return nRet; -} - -static INT32 MooncrstInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapMooncrst; - - nRet = GalInit(); - - GalExtendTileInfoFunction = MooncrstExtendTileInfo; - GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; - - return nRet; -} - -struct BurnDriver BurnDrvMooncrst = { - "mooncrst", NULL, NULL, NULL, "1980", - "Moon Cresta (Nichibutsu)\0", NULL, "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MooncrstRomInfo, MooncrstRomName, NULL, NULL, OmegaInputInfo, MooncrstDIPInfo, - MooncrstEncryptedInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMooncrstuk = { - "mooncrstuk", "mooncrst", NULL, NULL, "1980", - "Moon Cresta (Nichibutsu UK)\0", NULL, "Nichibutsu UK", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MooncrstukRomInfo, MooncrstukRomName, NULL, NULL, OmegaInputInfo, MooncrstDIPInfo, - MooncrstEncryptedInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMooncrstuku = { - "mooncrstuku", "mooncrst", NULL, NULL, "1980", - "Moon Cresta (Nichibutsu UK, unencrypted)\0", NULL, "Nichibutsu UK", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MooncrstukuRomInfo, MooncrstukuRomName, NULL, NULL, OmegaInputInfo, MooncrstDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMooncrstu = { - "mooncrstu", "mooncrst", NULL, NULL, "1980", - "Moon Cresta (Nichibutsu USA, unencrypted)\0", NULL, "Nichibutsu USA", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MooncrstuRomInfo, MooncrstuRomName, NULL, NULL, OmegaInputInfo, MooncrstDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMooncrsto = { - "mooncrsto", "mooncrst", NULL, NULL, "1980", - "Moon Cresta (Nichibutsu, old rev)\0", NULL, "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MooncrstoRomInfo, MooncrstoRomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, - MooncrstEncryptedInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMooncrstg = { - "mooncrstg", "mooncrst", NULL, NULL, "1980", - "Moon Cresta (Gremlin)\0", NULL, "Gremlin", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MooncrstgRomInfo, MooncrstgRomName, NULL, NULL, OmegaInputInfo, MooncrsgDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Straight Moon Cresta Rip-Offs on basic Moon Cresta hardware -static struct BurnRomInfo MooncrsbRomDesc[] = { - { "bepr194", 0x00800, 0x6a23ec6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bepr195", 0x00800, 0xee262ff2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bepr199", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bepr201", 0x00800, 0x66da55d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "epr203", 0x00800, 0xbe26b561, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr202", 0x00800, 0x26c7e800, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncrsb) -STD_ROM_FN(Mooncrsb) - -static struct BurnRomInfo Mooncrs2RomDesc[] = { - { "f8.bin", 0x00800, 0xd36003e5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bepr195", 0x00800, 0xee262ff2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bepr199", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m7.bin", 0x00800, 0x957ee078, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "1h_1_10.bin", 0x00800, 0x528da705, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "12.chr", 0x00800, 0x5a4b17ea, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "1k_1_11.bin", 0x00800, 0x4e79ff6b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "11.chr", 0x00800, 0xe0edccbd, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncrs2) -STD_ROM_FN(Mooncrs2) - -static struct BurnRomInfo Mooncrs3RomDesc[] = { - { "b1.7f", 0x01000, 0x0b28cd8a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b2.7h", 0x01000, 0x74a6f0ca, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b3.7j", 0x01000, 0xeeb34cc9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b4.7k", 0x01000, 0x714330e5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "o.1h", 0x00800, 0x528da705, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "q.1h", 0x00800, 0x5a4b17ea, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "p.1k", 0x00800, 0x4e79ff6b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "r.1k", 0x00800, 0xe0edccbd, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncrs3) -STD_ROM_FN(Mooncrs3) - -static struct BurnRomInfo FantaziaRomDesc[] = { - { "f01.bin", 0x00800, 0xd3e23863, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f02.bin", 0x00800, 0x63fa4149, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f09.bin", 0x00800, 0x75fd5ca1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f10.bin", 0x00800, 0xe4da2dd4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f11.bin", 0x00800, 0x42869646, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f12.bin", 0x00800, 0xa48d7fb0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "1h_1_10.bin", 0x00800, 0x528da705, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "1k_1_11.bin", 0x00800, 0x4e79ff6b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "fantazia.clr", 0x00020, 0xa84ff0af, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Fantazia) -STD_ROM_FN(Fantazia) - -static struct BurnRomInfo EagleRomDesc[] = { - { "e1", 0x00800, 0x224c9526, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e2", 0x00800, 0xcc538ebd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e6", 0x00800, 0x0dea20d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e8", 0x00800, 0xc437a876, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "e10", 0x00800, 0x40ce58bf, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "e12", 0x00800, 0x628fdeed, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "e9", 0x00800, 0xba664099, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "e11", 0x00800, 0xee4ec5fd, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Eagle) -STD_ROM_FN(Eagle) - -static struct BurnRomInfo Eagle2RomDesc[] = { - { "e1.7f", 0x00800, 0x45aab7a3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e2", 0x00800, 0xcc538ebd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e6.6", 0x00800, 0x9f09f8c6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e8", 0x00800, 0xc437a876, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "e10.2", 0x00800, 0x25b38ebd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "e12", 0x00800, 0x628fdeed, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "e9", 0x00800, 0xba664099, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "e11", 0x00800, 0xee4ec5fd, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Eagle2) -STD_ROM_FN(Eagle2) - -static struct BurnRomInfo Eagle3RomDesc[] = { - { "e1", 0x00800, 0x224c9526, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e2", 0x00800, 0xcc538ebd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e6", 0x00800, 0x0dea20d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e8", 0x00800, 0xc437a876, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "e10a", 0x00800, 0xe3c63d4c, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "e12", 0x00800, 0x628fdeed, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "e9a", 0x00800, 0x59429e47, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "e11", 0x00800, 0xee4ec5fd, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Eagle3) -STD_ROM_FN(Eagle3) - -static struct BurnRomInfo SpctbirdRomDesc[] = { - { "tssa-7f", 0x00800, 0x45aab7a3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tssa-7h", 0x00800, 0x8b328f48, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tssa-7k", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tssa-7m", 0x00800, 0x99c9166d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tssa-5", 0x00800, 0x797b6261, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tssa-6", 0x00800, 0x4825692c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tssa-7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tssa-8", 0x00800, 0xc9b77b85, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "tssb-2", 0x00800, 0x7d23e1f2, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "tssb-4", 0x00800, 0xe4977833, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "tssb-1", 0x00800, 0x9b9267c3, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "tssb-3", 0x00800, 0x5ca5e233, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Spctbird) -STD_ROM_FN(Spctbird) - -static struct BurnRomInfo SmooncrsRomDesc[] = { - { "927", 0x00800, 0x55c5b994, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "928a", 0x00800, 0x77ae26d3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "929", 0x00800, 0x716eaa10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "930", 0x00800, 0xcea864f2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "931", 0x00800, 0x702c5f51, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "932a", 0x00800, 0xe6a2039f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "933", 0x00800, 0x73783cee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "934", 0x00800, 0xc1a14aa2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "epr203", 0x00800, 0xbe26b561, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr202", 0x00800, 0x26c7e800, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Smooncrs) -STD_ROM_FN(Smooncrs) - -static struct BurnRomInfo SstarcrsRomDesc[] = { - { "ss1", 0x00800, 0x2ff72897, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ss2", 0x00800, 0x565e7880, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ss3", 0x00800, 0xa1939def, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ss4", 0x00800, 0xa332e012, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ss5", 0x00800, 0xb9e58453, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ss6", 0x00800, 0x7cbb5bc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ss7", 0x00800, 0x57713b91, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ss8", 0x00800, 0xc857e898, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ss10", 0x00800, 0x2a95b8ea, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ss12", 0x00800, 0xb92c4c30, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ss9", 0x00800, 0x3661e084, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ss11", 0x00800, 0x95613048, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Sstarcrs) -STD_ROM_FN(Sstarcrs) - -static struct BurnRomInfo MooncmwRomDesc[] = { - { "60.1x", 0x00800, 0x322859e6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "61.2x", 0x00800, 0xc249902d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "62.3x", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "63.4x", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "64.5x", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "65.6x", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "66.7x", 0x00800, 0xf23cd8ce, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "67.8x", 0x00800, 0x66da55d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "68.1h", 0x01000, 0x78663d86, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "69.1k", 0x01000, 0x162c50d3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom-sn74s288n-71.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncmw) -STD_ROM_FN(Mooncmw) - -static struct BurnRomInfo SpcdragRomDesc[] = { - { "a.bin", 0x00800, 0x38cc9839, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b.bin", 0x00800, 0x419fa8d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "c.bin", 0x00800, 0xa1939def, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "d.bin", 0x00800, 0xcbcf17c5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "em.bin", 0x00800, 0xeb81c19c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "fm.bin", 0x00800, 0x757b7672, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "g.bin", 0x00800, 0x57713b91, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "h.bin", 0x00800, 0x159ad847, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "203.bin", 0x00800, 0xa2e82527, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "172.bin", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "202.bin", 0x00800, 0x80c3ad74, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "171.bin", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Spcdrag) -STD_ROM_FN(Spcdrag) - -static struct BurnRomInfo SpcdragaRomDesc[] = { - { "1.7g", 0x00800, 0x38cc9839, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2.7g", 0x00800, 0x29e00ae4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3.7g", 0x00800, 0xa1939def, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4.7g", 0x00800, 0x068f8830, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5.10g", 0x00800, 0x32cd9adc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6.10g", 0x00800, 0x50db67c5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7.10g", 0x00800, 0x22415271, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8.10g", 0x00800, 0x159ad847, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "a2.7a", 0x00800, 0x38b042dd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "a4.7a", 0x00800, 0x5a4b17ea, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "a1.9a", 0x00800, 0x24441ab3, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "a3.9a", 0x00800, 0xe0edccbd, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom_6331.10f", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Spcdraga) -STD_ROM_FN(Spcdraga) - -static struct BurnRomInfo SteraRomDesc[] = { - { "stera.1", 0x00800, 0xcd04fea8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "stera.2", 0x00800, 0xccd1878e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "stera.3", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "stera.4", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "stera.5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "stera.6", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "stera.7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "stera.8", 0x00800, 0x37f19956, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "stera.10", 0x00800, 0x528da705, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "stera.12", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "stera.11", 0x00800, 0x4e79ff6b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "stera.9", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "stera.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Stera) -STD_ROM_FN(Stera) - -static struct BurnRomInfo MooncrgxRomDesc[] = { - { "1", 0x00800, 0x84cf420b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2", 0x00800, 0x4c2a61a1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3", 0x00800, 0x1962523a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4", 0x00800, 0x75dca896, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5", 0x00800, 0x32483039, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6", 0x00800, 0x43f2ab89, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7", 0x00800, 0x1e9c168c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8", 0x00800, 0x5e09da94, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "1h_1_10.bin", 0x00800, 0x528da705, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "12.chr", 0x00800, 0x5a4b17ea, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "9.chr", 0x00800, 0x70df525c, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "11.chr", 0x00800, 0xe0edccbd, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mooncrgx) -STD_ROM_FN(Mooncrgx) - -static struct BurnRomInfo MoonqsrRomDesc[] = { - { "mq1", 0x00800, 0x132c13ec, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mq2", 0x00800, 0xc8eb74f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mq3", 0x00800, 0x33965a89, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mq4", 0x00800, 0xa3861d17, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mq5", 0x00800, 0x8bcf9c67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mq6", 0x00800, 0x5750cda9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mq7", 0x00800, 0x78d7fe5b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mq8", 0x00800, 0x4919eed5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mqb", 0x00800, 0xb55ec806, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mqd", 0x00800, 0x9e7d0e13, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mqa", 0x00800, 0x66eee0db, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mqc", 0x00800, 0xa6db5b0d, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "vid_e6.bin", 0x00020, 0x0b878b54, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Moonqsr) -STD_ROM_FN(Moonqsr) - -static struct BurnRomInfo Moonal2RomDesc[] = { - { "ali1", 0x00400, 0x0dcecab4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali2", 0x00400, 0xc6ee75a7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali3", 0x00400, 0xcd1be7e9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali4", 0x00400, 0x83b03f08, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali5", 0x00400, 0x6f3cf61d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali6", 0x00400, 0xe169d432, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali7", 0x00400, 0x41f64b73, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali8", 0x00400, 0xf72ee876, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali9", 0x00400, 0xb7fb763c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali10", 0x00400, 0xb1059179, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali11", 0x00400, 0x9e79a1c6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ali13.1h", 0x00800, 0xa1287bf6, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ali12.1k", 0x00800, 0x528f1481, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Moonal2) -STD_ROM_FN(Moonal2) - -static struct BurnRomInfo Moonal2bRomDesc[] = { - { "ali1", 0x00400, 0x0dcecab4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali2", 0x00400, 0xc6ee75a7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "md-2", 0x00800, 0x8318b187, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali5", 0x00400, 0x6f3cf61d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali6", 0x00400, 0xe169d432, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali7", 0x00400, 0x41f64b73, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali8", 0x00400, 0xf72ee876, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali9", 0x00400, 0xb7fb763c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali10", 0x00400, 0xb1059179, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "md-6", 0x00800, 0x9cc973e0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ali13.1h", 0x00800, 0xa1287bf6, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ali12.1k", 0x00800, 0x528f1481, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Moonal2b) -STD_ROM_FN(Moonal2b) - -static struct BurnRomInfo ThepitmRomDesc[] = { - { "1.bin", 0x00800, 0x0f78d6ea, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2.bin", 0x00800, 0xebacc6eb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3.bin", 0x00800, 0x14fd0706, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4.bin", 0x00800, 0x613e920f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5.bin", 0x00800, 0x5a791f3f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6.bin", 0x00800, 0x0bb37f51, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7.bin", 0x00800, 0x4dfdec6f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8.bin", 0x00800, 0xa39a9189, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "9.bin", 0x00800, 0x2eb90e07, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "1h.bin", 0x00800, 0x00dce65f, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "1k.bin", 0x00800, 0x3ec0056e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6l.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Thepitm) -STD_ROM_FN(Thepitm) - -void __fastcall MooncrgxZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5800 && a <= 0x58ff) { - INT32 Offset = a - 0x5800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6000: - case 0x6001: - case 0x6002: { - GalGfxBank[a - 0x6000] = d; - return; - } - - case 0x6003: { - // coin_count_0_w - return; - } - - case 0x6004: - case 0x6005: - case 0x6006: - case 0x6007: { - GalaxianLfoFreqWrite(a - 0x6004, d); - return; - } - - case 0x6800: - case 0x6801: - case 0x6802: - case 0x6803: - case 0x6804: - case 0x6805: - case 0x6806: - case 0x6807: { - GalaxianSoundWrite(a - 0x6800, d); - return; - } - - case 0x7001: { - GalIrqFire = d & 1; - return; - } - - case 0x7004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x7006: { - GalFlipScreenX = d & 1; - return; - } - - case 0x7007: { - GalFlipScreenY = d & 1; - return; - } - - case 0x7800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall MoonqsrZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa000: - case 0xa001: - case 0xa002: { - GalGfxBank[a - 0xa000] = d; - return; - } - - case 0xa003: { - // coin_count_0_w - return; - } - - case 0xa004: - case 0xa005: - case 0xa006: - case 0xa007: { - GalaxianLfoFreqWrite(a - 0xa004, d); - return; - } - - case 0xa800: - case 0xa801: - case 0xa802: - case 0xa803: - case 0xa804: - case 0xa805: - case 0xa806: - case 0xa807: { - GalaxianSoundWrite(a - 0xa800, d); - return; - } - - case 0xb000: { - GalIrqFire = d & 1; - return; - } - - case 0xb004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - GalPitch = d; - return; - } - } - - bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); -} - -void __fastcall ThepitmZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa000: - case 0xa001: - case 0xa002: { - GalGfxBank[a - 0xa000] = d; - return; - } - - case 0xa003: { - // coin_count_0_w - return; - } - - case 0xa004: - case 0xa005: - case 0xa006: - case 0xa007: { - GalaxianLfoFreqWrite(a - 0xa004, d); - return; - } - - case 0xa800: - case 0xa801: - case 0xa802: - case 0xa803: - case 0xa804: - case 0xa805: - case 0xa806: - case 0xa807: { - GalaxianSoundWrite(a - 0xa800, d); - return; - } - - case 0xb001: { - GalIrqFire = d & 1; - return; - } - - case 0xb004: { - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static void Mooncrs2RearrangeGfx() -{ - UINT8* TempRom = (UINT8*)BurnMalloc(0x800); - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); - BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); - BurnLoadRom(TempRom, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); - memcpy(GalTempRom + 0x0800, TempRom + 0x0000, 0x200); - memcpy(GalTempRom + 0x0c00, TempRom + 0x0200, 0x200); - memcpy(GalTempRom + 0x0a00, TempRom + 0x0400, 0x200); - memcpy(GalTempRom + 0x0e00, TempRom + 0x0600, 0x200); - BurnLoadRom(TempRom, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); - memcpy(GalTempRom + 0x1800, TempRom + 0x0000, 0x200); - memcpy(GalTempRom + 0x1c00, TempRom + 0x0200, 0x200); - memcpy(GalTempRom + 0x1a00, TempRom + 0x0400, 0x200); - memcpy(GalTempRom + 0x1e00, TempRom + 0x0600, 0x200); - BurnFree(TempRom); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); -} - -static INT32 Mooncrs2Init() -{ - GalPostLoadCallbackFunction = MapMooncrst; - - INT32 nRet = GalInit(); - - Mooncrs2RearrangeGfx(); - - GalExtendTileInfoFunction = MooncrstExtendTileInfo; - GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; - - return nRet; -} - -static void Mooncrs3PostLoad() -{ - GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); - memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x800); - memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0800, 0x800); - memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1000, 0x800); - memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1800, 0x800); - memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x800); - memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2800, 0x800); - memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3000, 0x800); - memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3800, 0x800); - BurnFree(GalTempRom); - - MapMooncrst(); -} - -static INT32 Mooncrs3Init() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = Mooncrs3PostLoad; - - nRet = GalInit(); - - Mooncrs2RearrangeGfx(); - - GalExtendTileInfoFunction = MooncrstExtendTileInfo; - GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; - - return nRet; -} - -static void MooncrgxInstallHandler() -{ - ZetOpen(0); - ZetSetWriteHandler(MooncrgxZ80Write); - ZetClose(); -} - -static INT32 MooncrgxInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MooncrgxInstallHandler; - - nRet = GalInit(); - - GalExtendTileInfoFunction = MooncrstExtendTileInfo; - GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; - - return nRet; -} - -static void MoonqsrDecrypt() -{ - for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { - UINT8 Data = GalZ80Rom1[Offset]; - UINT8 Res = Data; - if (BIT(Data, 1)) Res ^= 0x40; - if (BIT(Data, 5)) Res ^= 0x04; - if ((Offset & 1) == 0) Res = BITSWAP08(Res, 7, 2, 5, 4, 3, 6, 1, 0); - GalZ80Rom1Op[Offset] = Res; - } - - MapMooncrst(); - - ZetOpen(0); - ZetSetWriteHandler(MoonqsrZ80Write); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1Op, GalZ80Rom1); - ZetClose(); -} - -static INT32 MoonqsrInit() -{ - INT32 nRet; - - GalZ80Rom1Op = (UINT8*)BurnMalloc(0x4000); - - GalPostLoadCallbackFunction = MoonqsrDecrypt; - - nRet = GalInit(); - - GalExtendTileInfoFunction = MoonqsrExtendTileInfo; - GalExtendSpriteInfoFunction = MoonqsrExtendSpriteInfo; - - return nRet; -} - -static INT32 Moonal2Init() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapMooncrst; - - nRet = GalInit(); - - return nRet; -} - -static void ThepitmPostLoad() -{ - MapMooncrst(); - - ZetOpen(0); - ZetMapArea(0x0000, 0x47ff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x47ff, 2, GalZ80Rom1); - ZetSetWriteHandler(ThepitmZ80Write); - ZetClose(); -} - -static INT32 ThepitmInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = ThepitmPostLoad; - - nRet = GalInit(); - - GalExtendTileInfoFunction = MooncrstExtendTileInfo; - GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; - - return nRet; -} - -struct BurnDriver BurnDrvMooncrsb = { - "mooncrsb", "mooncrst", NULL, NULL, "1980", - "Moon Cresta (bootleg set 1)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MooncrsbRomInfo, MooncrsbRomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMooncrs2 = { - "mooncrs2", "mooncrst", NULL, NULL, "1980", - "Moon Cresta (bootleg set 2)\0", NULL, "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Mooncrs2RomInfo, Mooncrs2RomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, - Mooncrs2Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMooncrs3 = { - "mooncrs3", "mooncrst", NULL, NULL, "1980", - "Moon Cresta (bootleg set 3)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Mooncrs3RomInfo, Mooncrs3RomName, NULL, NULL, OmegaInputInfo, MooncrstDIPInfo, - Mooncrs3Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvFantazia = { - "fantazia", "mooncrst", NULL, NULL, "1980", - "Fantazia (bootleg?)\0", NULL, "SubElectro", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, FantaziaRomInfo, FantaziaRomName, NULL, NULL, OmegaInputInfo, FantaziaDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvEagle = { - "eagle", "mooncrst", NULL, NULL, "1980", - "Eagle (set 1)\0", NULL, "Centuri", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, EagleRomInfo, EagleRomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, - Mooncrs2Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvEagle2 = { - "eagle2", "mooncrst", NULL, NULL, "1980", - "Eagle (set 2)\0", NULL, "Centuri", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Eagle2RomInfo, Eagle2RomName, NULL, NULL, OmegaInputInfo, Eagle2DIPInfo, - Mooncrs2Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvEagle3 = { - "eagle3", "mooncrst", NULL, NULL, "1980", - "Eagle (set 3)\0", NULL, "Centuri", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Eagle3RomInfo, Eagle3RomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, - Mooncrs2Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSpctbird = { - "spctbird", "mooncrst", NULL, NULL, "1981?", - "Space Thunderbird\0", NULL, "Fortrek", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SpctbirdRomInfo, SpctbirdRomName, NULL, NULL, OmegaInputInfo, Eagle2DIPInfo, - Mooncrs2Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSmooncrs = { - "smooncrs", "mooncrst", NULL, NULL, "1981?", - "Super Moon Cresta\0", NULL, "Gremlin", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SmooncrsRomInfo, SmooncrsRomName, NULL, NULL, SmooncrsInputInfo, SmooncrsDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSstarcrs = { - "sstarcrs", "mooncrst", NULL, NULL, "1980?", - "Super Star Crest\0", NULL, "Nichibutsu (Taito do Brasil license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SstarcrsRomInfo, SstarcrsRomName, NULL, NULL, OmegaInputInfo, MooncrsgDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMooncmw = { - "mooncmw", "mooncrst", NULL, NULL, "198?", - "Moon War (Moon Cresta bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MooncmwRomInfo, MooncmwRomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSpcdrag = { - "spcdrag", "mooncrst", NULL, NULL, "1980", - "Space Dragon (Moon Cresta bootleg, set 1)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SpcdragRomInfo, SpcdragRomName, NULL, NULL, SmooncrsInputInfo, SmooncrsDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSpcdraga = { - "spcdraga", "mooncrst", NULL, NULL, "1980", - "Space Dragon (Moon Cresta bootleg, set 2)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SpcdragaRomInfo, SpcdragaRomName, NULL, NULL, SmooncrsInputInfo, SmooncrsDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvStera = { - "stera", "mooncrst", NULL, NULL, "1980", - "Steraranger (Moon Cresta bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SteraRomInfo, SteraRomName, NULL, NULL, SmooncrsInputInfo, SmooncrsDIPInfo, - MooncrstInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMooncrgx = { - "mooncrgx", "mooncrst", NULL, NULL, "1980", - "Moon Cresta (Galaxian hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MooncrgxRomInfo, MooncrgxRomName, NULL, NULL, OmegaInputInfo, MooncrgxDIPInfo, - MooncrgxInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMoonqsr = { - "moonqsr", NULL, NULL, NULL, "1980", - "Moon Quasar\0", NULL, "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MoonqsrRomInfo, MoonqsrRomName, NULL, NULL, OmegaInputInfo, MoonqsrDIPInfo, - MoonqsrInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMoonal2 = { - "moonal2", "galaxian", NULL, NULL, "1980", - "Moon Alien Part 2\0", NULL, "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Moonal2RomInfo, Moonal2RomName, NULL, NULL, GalaxianInputInfo, Moonal2DIPInfo, - Moonal2Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMoonal2b = { - "moonal2b", "galaxian", NULL, NULL, "1980", - "Moon Alien Part 2 (older version)\0", NULL, "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Moonal2bRomInfo, Moonal2bRomName, NULL, NULL, GalaxianInputInfo, Moonal2DIPInfo, - Moonal2Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvThepitm = { - "thepitm", "thepit", NULL, NULL, "198?", - "The Pit (bootleg on Moon Quasar hardware)\0", NULL, "bootleg (KZH)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, ThepitmRomInfo, ThepitmRomName, NULL, NULL, ThepitmInputInfo, ThepitmDIPInfo, - ThepitmInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Other games on basic Moon Cresta hardware -static struct BurnRomInfo SkybaseRomDesc[] = { - { "skybase.9a", 0x01000, 0x845b87a5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "skybase.8a", 0x01000, 0x096785c2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "skybase.7a", 0x01000, 0xd50c715b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "skybase.6a", 0x01000, 0xf57edb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "skybase.5a", 0x01000, 0x50365d95, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "skybase.4a", 0x01000, 0xcbd6647f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "skybase.7t", 0x01000, 0x9b471686, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "skybase.8t", 0x01000, 0x1cf723da, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "skybase.10t", 0x01000, 0xfe02e72c, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "skybase.9t", 0x01000, 0x0871291f, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.bpr", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Skybase) -STD_ROM_FN(Skybase) - -static struct BurnRomInfo BagmanmcRomDesc[] = { - { "b1.bin", 0x01000, 0xb74c75ee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b2.bin", 0x01000, 0xa7d99916, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b3.bin", 0x01000, 0xc78f5360, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b4.bin", 0x01000, 0xeebd3bd1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b5.bin", 0x01000, 0x0fe24b8c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b6.bin", 0x01000, 0xf50390e7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "g1-u.bin", 0x01000, 0xb63cfae4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g2-u.bin", 0x01000, 0xa2790089, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g1-l.bin", 0x00800, 0x2ae6b5ab, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g2-l.bin", 0x00800, 0x98b37397, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "bagmanmc.clr", 0x00020, 0x00000000, BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(Bagmanmc) -STD_ROM_FN(Bagmanmc) - -static struct BurnRomInfo DkongjrmRomDesc[] = { - { "a1", 0x01000, 0x299486e9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "a2", 0x01000, 0xa74a193b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b2", 0x01000, 0x7bc4f236, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "c1", 0x01000, 0x0f594c21, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "d1", 0x01000, 0xcf7d7296, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "e2", 0x01000, 0xf7528a52, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f1", 0x01000, 0x9b1d4cc5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "v_3pa.bin", 0x01000, 0x4974ffef, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "a2.gfx", 0x01000, 0x51845eaf, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "v_3na.bin", 0x01000, 0xa95c4c63, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "b2.gfx", 0x01000, 0x7b39c3d0, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "hustler.clr", 0x00020, 0xaa1f7f5e, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Dkongjrm) -STD_ROM_FN(Dkongjrm) - -static struct BurnRomInfo VpoolRomDesc[] = { - { "vidpool1.bin", 0x01000, 0x333f4732, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vidpool2.bin", 0x01000, 0xeea6c0f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vidpool3.bin", 0x01000, 0x309972a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vidpool4.bin", 0x01000, 0xc4f71c1d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "hustler.5f", 0x00800, 0x0bdfad0e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "hustler.5h", 0x00800, 0x8e062177, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "hustler.clr", 0x00020, 0xaa1f7f5e, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Vpool) -STD_ROM_FN(Vpool) - -static struct BurnRomInfo CkonggRomDesc[] = { - { "g_ck1.bin", 0x01000, 0xa4323b94, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ck2.bin", 0x01000, 0x1e532996, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "g_ck3.bin", 0x01000, 0x65157cde, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "g_ck4.bin", 0x01000, 0x43827bc6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "g_ck5.bin", 0x01000, 0xa74ed96e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "g_ck7.bin", 0x00800, 0x2c4d8129, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ckvid10.bin", 0x01000, 0x7866d2cb, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ckvid7.bin", 0x01000, 0x7311a101, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "ck_cp.bin", 0x00020, 0x7e0b79cb, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Ckongg) -STD_ROM_FN(Ckongg) - -static struct BurnRomInfo CkongmcRomDesc[] = { - { "kc1.bin", 0x01000, 0xa87fc828, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "kc2.bin", 0x01000, 0x94a13dec, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "kc3.bin", 0x01000, 0x5efc6705, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "kc4.bin", 0x01000, 0xac917d66, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "kc5.bin", 0x00800, 0x5a9ee1ed, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "kc6.bin", 0x00800, 0xf787431e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "kc7.bin", 0x00800, 0x7a185e31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "kc8carat.bin", 0x01000, 0x7866d2cb, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "kc9carat.bin", 0x01000, 0x7311a101, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "ck_cp.bin", 0x00020, 0x7e0b79cb, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Ckongmc) -STD_ROM_FN(Ckongmc) - -static struct BurnRomInfo PorterRomDesc[] = { - { "port1.bin", 0x01000, 0xbabaf7fe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "port2.bin", 0x01000, 0x8f7eb0e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "port3.bin", 0x01000, 0x683939b5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "port4.bin", 0x01000, 0x6a65d58d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "port5.bin", 0x00800, 0x2978a9aa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "port6.bin", 0x00800, 0x7ecdffb5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "port7.bin", 0x01000, 0x603294f9, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "port8.bin", 0x01000, 0xb66a763d, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Porter) -STD_ROM_FN(Porter) - -static struct BurnRomInfo KongRomDesc[] = { - { "1", 0x01000, 0xa206beb5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2", 0x01000, 0xd75597b6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3", 0x01000, 0x54e0b87b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4", 0x01000, 0x356c4ca2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5", 0x01000, 0x2d295976, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6", 0x01000, 0x77131cca, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7", 0x01000, 0x3d5ec3f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8", 0x01000, 0x015fe5e5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "9", 0x00800, 0xfe42a052, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "11", 0x00800, 0xad2b2cdd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "10", 0x00800, 0x91fa187e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "12", 0x00800, 0xb74724df, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom", 0x00020, 0x00000000, BRF_OPT | BRF_NODUMP }, - - { "13", 0x01000, 0x7d33ca0a, BRF_OPT }, // unknown -}; - -STD_ROM_PICK(Kong) -STD_ROM_FN(Kong) - -static struct BurnRomInfo FantastcRomDesc[] = { - { "f1", 0x01000, 0x8019f0b7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f2", 0x01000, 0x988a9bc6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f3", 0x01000, 0xa3c0cc0b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f4", 0x01000, 0xc1361be8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f5", 0x01000, 0x6787e93f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f6", 0x01000, 0x597029ae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f7", 0x01000, 0x8de08d9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "f8", 0x01000, 0x489e2fb7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "37", 0x01000, 0x3a54f749, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "38", 0x01000, 0x88b71264, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom-74g138", 0x00020, 0x800f5718, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Fantastc) -STD_ROM_FN(Fantastc) - -UINT8 __fastcall BagmanmcZ80Read(UINT16 a) -{ - switch (a) { - case 0xa000: { - return GalInput[0] | GalDip[0]; - } - - case 0xa800: { - return GalInput[1] | GalDip[1]; - } - - case 0xb000: { - return GalInput[2] | GalDip[2]; - } - - case 0xb800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall BagmanmcZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa000: - case 0xa001: - case 0xa002: { - GalGfxBank[a - 0xa000] = d; - return; - } - - case 0xa003: { - // coin_count_0_w - return; - } - - case 0xa004: - case 0xa005: - case 0xa006: - case 0xa007: { - GalaxianLfoFreqWrite(a - 0xa004, d); - return; - } - - case 0xa800: - case 0xa801: - case 0xa802: - case 0xa803: - case 0xa804: - case 0xa805: - case 0xa806: - case 0xa807: { - GalaxianSoundWrite(a - 0xa800, d); - return; - } - - case 0xb001: { - GalIrqFire = d & 1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall DkongjrmZ80Read(UINT16 a) -{ - if (a >= 0xa000 && a <= 0xa0ff) { - return GalInput[0] | GalDip[0]; - } - - if (a >= 0xa800 && a <= 0xa8ff) { - return GalInput[1] | GalDip[1]; - } - - if (a >= 0xb000 && a <= 0xb0ff) { - return GalInput[2] | GalDip[2]; - } - - switch (a) { - case 0xb800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall DkongjrmZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa003: { - // coin_count_0_w - return; - } - - case 0xa004: - case 0xa005: - case 0xa006: - case 0xa007: { - GalaxianLfoFreqWrite(a - 0xa004, d); - return; - } - - case 0xa800: - case 0xa801: - case 0xa802: - case 0xa803: - case 0xa804: -// case 0xa805: - case 0xa806: - case 0xa807: { - GalaxianSoundWrite(a - 0xa800, d); - return; - } - - case 0xb000: { - GalGfxBank[0] = d; - return; - } - - case 0xb001: { - GalIrqFire = d & 1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall CkonggZ80Read(UINT16 a) -{ - switch (a) { - case 0xc000: { - return GalInput[0] | GalDip[0]; - } - - case 0xc400: { - return GalInput[1] | GalDip[1]; - } - - case 0xc800: { - return GalInput[2] | GalDip[2]; - } - - case 0xcc00: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall CkonggZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xc400: - case 0xc401: - case 0xc402: - case 0xc403: - case 0xc404: - case 0xc405: - case 0xc406: - case 0xc407: { - GalaxianSoundWrite(a - 0xc400, d); - return; - } - - case 0xc801: { - GalIrqFire = d & 1; - return; - } - - case 0xc804: { - // link apparently cut - return; - } - - case 0xc806: { - GalFlipScreenX = d & 1; - return; - } - - case 0xc807: { - GalFlipScreenY = d & 1; - return; - } - - case 0xcc00: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall CkongmcZ80Read(UINT16 a) -{ - switch (a) { - case 0xa000: { - return GalInput[0] | GalDip[0]; - } - - case 0xa800: { - return GalInput[1] | GalDip[1]; - } - - case 0xb000: { - return GalInput[2] | GalDip[2]; - } - - case 0xb800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall CkongmcZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa800: - case 0xa801: - case 0xa802: - case 0xa803: - case 0xa804: - case 0xa805: - case 0xa806: - case 0xa807: { - GalaxianSoundWrite(a - 0xa800, d); - return; - } - - case 0xb001: { - GalIrqFire = d & 1; - return; - } - - case 0xc806: { - GalFlipScreenX = d & 1; - return; - } - - case 0xc807: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall FantastcZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0x9900 && a <= 0xafff) { - // ??? - return; - } - - if (a >= 0xb001 && a <= 0xd7ff) { - // ??? - return; - } - - switch (a) { - case 0x8803: { - AY8910Write(0, 0, d); - return; - } - - case 0x880b: { - AY8910Write(0, 1, d); - return; - } - - case 0x880c: { - AY8910Write(1, 0, d); - return; - } - - case 0x880e: { - AY8910Write(1, 1, d); - return; - } - - case 0xb000: { - GalIrqFire = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static void SkybaseAlterZ80() -{ - MapMooncrst(); - - ZetOpen(0); - ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetClose(); -} - -static INT32 SkybaseInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = SkybaseAlterZ80; - - nRet = GalInit(); - - GalExtendTileInfoFunction = SkybaseExtendTileInfo; - GalExtendSpriteInfoFunction = SkybaseExtendSpriteInfo; - - return nRet; -} - -static void BagmanmcPostLoad() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(BagmanmcZ80Read); - ZetSetWriteHandler(BagmanmcZ80Write); - ZetMapArea(0x0000, GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x6000, 0x67ff, 0, GalZ80Ram1); - ZetMapArea(0x6000, 0x67ff, 1, GalZ80Ram1); - ZetMapArea(0x6000, 0x67ff, 2, GalZ80Ram1); - ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); - ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); - ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); - ZetClose(); -} - -static INT32 BagmanmcInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = BagmanmcPostLoad; - GalPromRomSize = 0x20; - - nRet = GalInit(); - - GalNumChars = 512; - GalNumSprites = 64; - CharPlaneOffsets[1] = GalNumChars * 8 * 8; - SpritePlaneOffsets[1] = GalNumSprites * 16 * 16; - - UINT8 *TempRom = (UINT8*)BurnMalloc(0x1000); - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x0000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x2000, TempRom + 0x0800, 0x800); - nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x1000, TempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x2800, TempRom + 0x0800, 0x800); - nRet = BurnLoadRom(GalTempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x1800, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); if (nRet) return 1; - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom + 0x2000, GalSprites); - BurnFree(GalTempRom); - BurnFree(TempRom); - - HardCodeMooncrstPROM(); - - GalIrqType = GAL_IRQ_TYPE_IRQ0; - GalExtendTileInfoFunction = PiscesExtendTileInfo; - - return nRet; -} - -static void DkongjrmPostLoad() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(DkongjrmZ80Read); - ZetSetWriteHandler(DkongjrmZ80Write); - ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); - ZetMapArea(0x6000, 0x6fff, 0, GalZ80Ram1); - ZetMapArea(0x6000, 0x6fff, 1, GalZ80Ram1); - ZetMapArea(0x6000, 0x6fff, 2, GalZ80Ram1); - ZetMapArea(0x7000, 0x7fff, 0, GalZ80Rom1 + 0x6000); - ZetMapArea(0x7000, 0x7fff, 2, GalZ80Rom1 + 0x6000); - ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); - ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); - ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); - ZetClose(); -} - -static INT32 DkongjrmInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = DkongjrmPostLoad; - - nRet = GalInit(); - - GalRenderBackgroundFunction = NULL; - GalDrawBulletsFunction = NULL; - GalExtendTileInfoFunction = PiscesExtendTileInfo; - GalExtendSpriteInfoFunction = DkongjrmExtendSpriteInfo; - - GalRenderFrameFunction = DkongjrmRenderFrame; - - return nRet; -} - -static void VpoolPostLoad() -{ - MapMooncrst(); - - GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); - memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x800); - memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0800, 0x800); - memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1000, 0x800); - memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1800, 0x800); - memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x800); - memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2800, 0x800); - memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3000, 0x800); - memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3800, 0x800); - BurnFree(GalTempRom); - - ZetOpen(0); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetClose(); -} - -static INT32 VpoolInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = VpoolPostLoad; - - nRet = GalInit(); - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - return nRet; -} - -static void CkonggMapZ80() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(CkonggZ80Read); - ZetSetWriteHandler(CkonggZ80Write); - ZetMapArea(0x0000, 0x57ff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x57ff, 2, GalZ80Rom1); - ZetMapArea(0x6000, 0x6fff, 0, GalZ80Ram1); - ZetMapArea(0x6000, 0x6fff, 1, GalZ80Ram1); - ZetMapArea(0x6000, 0x6fff, 2, GalZ80Ram1); - ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); - ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); - ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); - ZetClose(); -} - -static void CkonggPostLoad() -{ - GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); - memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); - memcpy(GalZ80Rom1 + 0x2400, GalTempRom + 0x0000, 0x400); - memcpy(GalZ80Rom1 + 0x1c00, GalTempRom + 0x0400, 0x400); - memcpy(GalZ80Rom1 + 0x4800, GalTempRom + 0x0800, 0x400); - memcpy(GalZ80Rom1 + 0x0c00, GalTempRom + 0x0c00, 0x400); - memcpy(GalZ80Rom1 + 0x4400, GalTempRom + 0x1000, 0x400); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x1400, 0x400); - memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x1800, 0x400); - memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1c00, 0x400); - memcpy(GalZ80Rom1 + 0x3400, GalTempRom + 0x2000, 0x400); - memcpy(GalZ80Rom1 + 0x4c00, GalTempRom + 0x2400, 0x400); - memcpy(GalZ80Rom1 + 0x5000, GalTempRom + 0x2800, 0x400); - memcpy(GalZ80Rom1 + 0x0400, GalTempRom + 0x2c00, 0x400); - memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x3000, 0x400); - memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3400, 0x400); - memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x3800, 0x400); - memcpy(GalZ80Rom1 + 0x4000, GalTempRom + 0x3c00, 0x400); - memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x4000, 0x400); - memcpy(GalZ80Rom1 + 0x5400, GalTempRom + 0x4400, 0x400); - memcpy(GalZ80Rom1 + 0x2c00, GalTempRom + 0x4800, 0x400); - memcpy(GalZ80Rom1 + 0x1400, GalTempRom + 0x4c00, 0x400); - memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x5000, 0x400); - memcpy(GalZ80Rom1 + 0x3c00, GalTempRom + 0x5400, 0x400); - BurnFree(GalTempRom); - - CkonggMapZ80(); -} - -static INT32 CkonggInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = CkonggPostLoad; - - nRet = GalInit(); - - GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - return nRet; -} - -static void CkongmcPostLoad() -{ - GalTempRom = (UINT8*)BurnMalloc(0x4000); - memcpy(GalTempRom, GalZ80Rom1, 0x4000); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x800); - memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0800, 0x800); - memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1000, 0x800); - memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1800, 0x800); - memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x800); - memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2800, 0x800); - memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3000, 0x800); - memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3800, 0x800); - BurnFree(GalTempRom); - - CkonggMapZ80(); - - ZetOpen(0); - ZetSetReadHandler(CkongmcZ80Read); - ZetSetWriteHandler(CkongmcZ80Write); - ZetClose(); -} - -static INT32 CkongmcInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = CkongmcPostLoad; - - nRet = GalInit(); - - GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - return nRet; -} - -static void PorterPostLoad() -{ - GalTempRom = (UINT8*)BurnMalloc(0x4000); - memcpy(GalTempRom, GalZ80Rom1, 0x4000); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x800); - memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0800, 0x800); - memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1000, 0x800); - memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1800, 0x800); - memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x800); - memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2800, 0x800); - memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3000, 0x800); - memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3800, 0x800); - BurnFree(GalTempRom); - - MapMooncrst(); - - ZetOpen(0); - ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetClose(); -} - -static INT32 PorterInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = PorterPostLoad; - - nRet = GalInit(); - - GalExtendTileInfoFunction = MooncrstExtendTileInfo; - GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; - - return nRet; -} - -static void KongAlterZ80() -{ - MapMooncrst(); - - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x7fff, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetClose(); -} - -static INT32 KongInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = KongAlterZ80; - - GalPromRomSize = 0x20; - - nRet = GalInit(); - - GalRenderBackgroundFunction = NULL; - GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; - - HardCodeMooncrstPROM(); - - return nRet; -} - -static void FantastcPostLoad() -{ - MapMooncrst(); - - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x7fff, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetSetWriteHandler(FantastcZ80Write); - ZetClose(); - - static const UINT16 lut_am_unscramble[32] = { - 0, 2, 4, 6, // ok! - 7, 3, 5, 1, // ok! - 6, 0, 2, 4, // ok! - 1, 5, 3, 0, // ok! - 2, 4, 6, 3, // good, good?, guess, guess - 5, 6, 0, 2, // good, good?, good?, guess - 4, 1, 1, 5, // good, good, guess, good - 3, 7, 7, 7 // ok! - }; - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x8000); - memcpy(pTemp, GalZ80Rom1, 0x8000); - - for (INT32 i = 0; i < 32; i++) { - memcpy(GalZ80Rom1 + i * 0x400, pTemp + lut_am_unscramble[i] * 0x1000 + (i & 3) * 0x400, 0x400); - } - - BurnFree(pTemp); -} - -static INT32 FantastcInit() -{ - INT32 nRet; - - GalSoundType = GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910; - - GalPostLoadCallbackFunction = FantastcPostLoad; - GalNumSprites = 0x40; - - nRet = GalInit(); - - GalRenderFrameFunction = FantastcRenderFrame; - GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; - - return nRet; -} - -struct BurnDriver BurnDrvSkybase = { - "skybase", NULL, NULL, NULL, "1982", - "Sky Base\0", NULL, "Omori Electric Co. Ltd", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, SkybaseRomInfo, SkybaseRomName, NULL, NULL, SkybaseInputInfo, SkybaseDIPInfo, - SkybaseInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriverD BurnDrvBagmanmc = { - "bagmanmc", "bagman", NULL, NULL, "1982", - "Bagman (Moon Cresta hardware)\0", "Bad Colours", "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, BagmanmcRomInfo, BagmanmcRomName, NULL, NULL, BagmanmcInputInfo, BagmanmcDIPInfo, - BagmanmcInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvDkongjrm = { - "dkongjrm", "dkongjr", NULL, NULL, "1982", - "Donkey Kong Jr. (Moon Cresta hardware)\0", "Bad Colours", "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, DkongjrmRomInfo, DkongjrmRomName, NULL, NULL, DkongjrmInputInfo, DkongjrmDIPInfo, - DkongjrmInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvVpool = { - "vpool", "hustler", NULL, NULL, "1980", - "Video Pool (bootleg on Moon Cresta hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, - NULL, VpoolRomInfo, VpoolRomName, NULL, NULL, GalaxianInputInfo, VpoolDIPInfo, - VpoolInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvCkongg = { - "ckongg", "ckong", NULL, NULL, "1981", - "Crazy Kong (bootleg on Galaxian hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, CkonggRomInfo, CkonggRomName, NULL, NULL, CkonggInputInfo, CkonggDIPInfo, - CkonggInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvCkongmc = { - "ckongmc", "ckong", NULL, NULL, "1981", - "Crazy Kong (bootleg on Moon Cresta hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, CkongmcRomInfo, CkongmcRomName, NULL, NULL, CkongmcInputInfo, CkongmcDIPInfo, - CkongmcInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvPorter = { - "porter", "dockman", NULL, NULL, "19??", - "Port Man (bootleg on Moon Cresta hardware)\0", NULL, "Nova Games Ltd", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, PorterRomInfo, PorterRomName, NULL, NULL, PorterInputInfo, PorterDIPInfo, - PorterInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvKong = { - "kong", NULL, NULL, NULL, "198?", - "Kong (Brazil)\0", "Bad Colours", "Taito do Brasil", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, KongRomInfo, KongRomName, NULL, NULL, KongInputInfo, KongDIPInfo, - KongInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvFantastc = { - "fantastc", NULL, NULL, NULL, "198?", - "Fantastic\0", NULL, "Taito do Brasil", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, FantastcRomInfo, FantastcRomName, NULL, NULL, FantastcInputInfo, FantastcDIPInfo, - FantastcInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Custom background -static struct BurnRomInfo RockclimRomDesc[] = { - { "lc01.a1", 0x01000, 0x8601ae8d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lc02.a2", 0x01000, 0x2dde9d4c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lc03.a3", 0x01000, 0x82c48a67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lc04.a4", 0x01000, 0x7cd3a04a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lc05.a5", 0x01000, 0x5e542149, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lc06.a6", 0x01000, 0xb2bdca64, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "lc08.a9", 0x00800, 0x7f18e1ef, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "lc07.a7", 0x00800, 0xf18b50ac, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "lc10.c9", 0x00800, 0xdec5781b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "lc09.c7", 0x00800, 0x06c0b5de, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "lc11.f4", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, - { "lc12.e9", 0x00020, 0xf6e76547, BRF_GRA | GAL_ROM_PROM }, - - { "lc13.g5", 0x01000, 0x19475f2b, BRF_GRA }, - { "lc14.g7", 0x01000, 0xcc96d1db, BRF_GRA }, -}; - -STD_ROM_PICK(Rockclim) -STD_ROM_FN(Rockclim) - -UINT8 __fastcall RockclimZ80Read(UINT16 a) -{ - switch (a) { - case 0x8800: { - return GalInput[3] | GalDip[3]; - } - - case 0xa000: { - return GalInput[0] | GalDip[0]; - } - - case 0xa800: { - return GalInput[1] | GalDip[1]; - } - - case 0xb000: { - return GalInput[2] | GalDip[2]; - } - - case 0xb800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall RockclimZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x4800: { - RockclimScrollX = (RockclimScrollX & 0xff00) | d; - return; - } - - case 0x4801: { - RockclimScrollX = (RockclimScrollX & 0xff) | (d << 8); - return; - } - - case 0x4802: { - RockclimScrollY = (RockclimScrollY & 0xff00) | d; - return; - } - - case 0x4803: { - RockclimScrollY = (RockclimScrollY & 0xff) | (d << 8); - return; - } - - case 0xa000: - case 0xa001: - case 0xa002: { - GalGfxBank[a - 0xa000] = d; - return; - } - - case 0xa003: { - // coin_count_0_w - return; - } - - case 0xa004: - case 0xa005: - case 0xa006: - case 0xa007: { - GalaxianLfoFreqWrite(a - 0xa004, d); - return; - } - - case 0xa800: - case 0xa801: - case 0xa802: - case 0xa803: - case 0xa804: - case 0xa805: - case 0xa806: - case 0xa807: { - GalaxianSoundWrite(a - 0xa800, d); - return; - } - - case 0xb000: { - GalIrqFire = d & 1; - return; - } - - case 0xb004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static void RockclimPostLoad() -{ - MapMooncrst(); - - GalVideoRam2 = (UINT8*)BurnMalloc(0x800); - - ZetOpen(0); - ZetSetReadHandler(RockclimZ80Read); - ZetSetWriteHandler(RockclimZ80Write); - ZetMapArea(0x4000, 0x47ff, 0, GalVideoRam2); - ZetMapArea(0x4000, 0x47ff, 1, GalVideoRam2); - ZetMapArea(0x4000, 0x47ff, 2, GalVideoRam2); - ZetMapArea(0x5000, 0x53ff, 0, GalZ80Ram1 + 0x400); - ZetMapArea(0x5000, 0x53ff, 1, GalZ80Ram1 + 0x400); - ZetMapArea(0x5000, 0x53ff, 2, GalZ80Ram1 + 0x400); - ZetMapArea(0x6000, 0x7fff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0x6000, 0x7fff, 2, GalZ80Rom1 + 0x4000); - ZetClose(); -} - -static INT32 RockclimInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = RockclimPostLoad; - RockclimTiles = (UINT8*)BurnMalloc(0x100 * 8 * 8); - - nRet = GalInit(); - - INT32 RockclimPlaneOffsets[4] = {4, 0, 0x8004, 0x8000}; - INT32 RockclimCharXOffsets[8] = {3, 2, 1, 0, 11, 10, 9, 8}; - INT32 RockclimCharYOffsets[8] = {0, 16, 32, 48, 64, 80, 96, 112}; - - GalTempRom = (UINT8*)BurnMalloc(0x2000); - nRet = BurnLoadRom(GalTempRom + 0x0000, 12, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x1000, 13, 1); if (nRet) return 1; - GfxDecode(256, 4, 8, 8, RockclimPlaneOffsets, RockclimCharXOffsets, RockclimCharYOffsets, 0x80, GalTempRom, RockclimTiles); - BurnFree(GalTempRom); - - GalCalcPaletteFunction = RockclimCalcPalette; - GalRenderBackgroundFunction = RockclimDrawBackground; - GalExtendTileInfoFunction = MooncrstExtendTileInfo; - GalExtendSpriteInfoFunction = RockclimExtendSpriteInfo; - - return nRet; -} - -struct BurnDriver BurnDrvRockclim = { - "rockclim", NULL, NULL, NULL, "1981", - "Rock Climber\0", NULL, "Taito", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, - NULL, RockclimRomInfo, RockclimRomName, NULL, NULL, RockclimInputInfo, RockclimDIPInfo, - RockclimInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -// Extra roms and sound hardware replaced with AY8910 -static struct BurnRomInfo JumpbugRomDesc[] = { - { "jb1", 0x01000, 0x415aa1b7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb2", 0x01000, 0xb1c27510, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb3", 0x01000, 0x97c24be2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb4", 0x01000, 0x66751d12, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb5", 0x01000, 0xe2d66faf, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb6", 0x01000, 0x49e0bdfd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb7", 0x00800, 0x83d71302, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "jbl", 0x00800, 0x9a091b0a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "jbm", 0x00800, 0x8a0fc082, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "jbn", 0x00800, 0x155186e0, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "jbi", 0x00800, 0x7749b111, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "jbj", 0x00800, 0x06e8d7df, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "jbk", 0x00800, 0xb8dbddf3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Jumpbug) -STD_ROM_FN(Jumpbug) - -static struct BurnRomInfo JumpbugbRomDesc[] = { - { "jb1", 0x01000, 0x415aa1b7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb2", 0x01000, 0xb1c27510, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb3b", 0x01000, 0xcb8b8a0f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb4", 0x01000, 0x66751d12, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb5b", 0x01000, 0x7553b5e2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb6b", 0x01000, 0x47be9843, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "jb7b", 0x00800, 0x460aed61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "jbl", 0x00800, 0x9a091b0a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "jbm", 0x00800, 0x8a0fc082, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "jbn", 0x00800, 0x155186e0, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "jbi", 0x00800, 0x7749b111, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "jbj", 0x00800, 0x06e8d7df, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "jbk", 0x00800, 0xb8dbddf3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Jumpbugb) -STD_ROM_FN(Jumpbugb) - -static struct BurnRomInfo LeversRomDesc[] = { - { "g96059.a8", 0x01000, 0x9550627a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "g96060.d8", 0x01000, 0x5ac64646, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "g96061.e8", 0x01000, 0x9db8e520, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "g96062.h8", 0x01000, 0x7c8e8b3a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "g96063.j8", 0x01000, 0xfa61e793, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "g96064.l8", 0x01000, 0xf797f389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "g95948.n1", 0x00800, 0xd8a0c692, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g95949.s1", 0x00800, 0x3660a552, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g95946.j1", 0x00800, 0x73b61b2d, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g95947.m1", 0x00800, 0x72ff67e2, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "g960lev.clr", 0x00020, 0x01febbbe, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Levers) -STD_ROM_FN(Levers) - -static struct BurnRomInfo BongoRomDesc[] = { - { "bg1.bin", 0x01000, 0xde9a8ec6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bg2.bin", 0x01000, 0xa19da662, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bg3.bin", 0x01000, 0x9f6f2150, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bg4.bin", 0x01000, 0xf80372d2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bg5.bin", 0x01000, 0xfc92eade, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "bg6.bin", 0x01000, 0x561d9e5d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "b-h.bin", 0x01000, 0xfc79d103, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "b-k.bin", 0x01000, 0x94d17bf3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "b-clr.bin", 0x00020, 0xc4761ada, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Bongo) -STD_ROM_FN(Bongo) - -void __fastcall BongoZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xb001: { - GalIrqFire = d & 1; - return; - } - - case 0xb004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - // watchdog write? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall BongoZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x02: { - return AY8910Read(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall BongoZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - AY8910Write(0, 0, d); - return; - } - - case 0x01: { - AY8910Write(0, 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -static INT32 JumpbugInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapJumpbug; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910; - - nRet = GalInit(); - - GalRenderBackgroundFunction = JumpbugDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = JumpbugExtendTileInfo; - GalExtendSpriteInfoFunction = JumpbugExtendSpriteInfo; - - AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -static void LeversPostLoad() -{ - GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); - memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); - memset(GalZ80Rom1, 0, GalZ80Rom1Size); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x1000); - memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x1000, GalZ80Rom1Size - 0x2000); - BurnFree(GalTempRom); - - MapJumpbug(); -} - -static INT32 LeversInit() -{ - INT32 nRet; - - GalZ80Rom1Size = 0x1000; - GalTilesSharedRomSize = 0x1000; - - GalPostLoadCallbackFunction = LeversPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910; - - nRet = GalInit(); - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x1800, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x2800, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); if (nRet) return 1; - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - - GalRenderBackgroundFunction = JumpbugDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = JumpbugExtendTileInfo; - GalExtendSpriteInfoFunction = JumpbugExtendSpriteInfo; - - AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -static void BongoPostLoad() -{ - MapMooncrst(); - - ZetOpen(0); - ZetSetWriteHandler(BongoZ80Write); - ZetSetInHandler(BongoZ80PortRead); - ZetSetOutHandler(BongoZ80PortWrite); - ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); - ZetMapArea(0x8400, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8400, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8400, 0x87ff, 2, GalZ80Ram1); - ZetMapArea(0x9400, 0x97ff, 0, GalVideoRam); - ZetMapArea(0x9400, 0x97ff, 1, GalVideoRam); - ZetMapArea(0x9400, 0x97ff, 2, GalVideoRam); - ZetClose(); -} - -static INT32 BongoInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = BongoPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_BONGOAY8910; - - nRet = GalInit(); - - GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; - - return nRet; -} - -struct BurnDriver BurnDrvJumpbug = { - "jumpbug", NULL, NULL, NULL, "1981", - "Jump Bug\0", NULL, "Rock-ola", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, JumpbugRomInfo, JumpbugRomName, NULL, NULL, JumpbugInputInfo, JumpbugDIPInfo, - JumpbugInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvJumpbugb = { - "jumpbugb", "jumpbug", NULL, NULL, "1981", - "Jump Bug (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, JumpbugbRomInfo, JumpbugbRomName, NULL, NULL, JumpbugInputInfo, JumpbugDIPInfo, - JumpbugInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvLevers = { - "levers", NULL, NULL, NULL, "1983", - "Levers\0", NULL, "Rock-ola", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, - NULL, LeversRomInfo, LeversRomName, NULL, NULL, LeversInputInfo, LeversDIPInfo, - LeversInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvBongo = { - "bongo", NULL, NULL, NULL, "1983", - "Bongo\0", NULL, "Jetsoft", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, BongoRomInfo, BongoRomName, NULL, NULL, BongoInputInfo, BongoDIPInfo, - BongoInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Second Z80 driving AY8910 -static struct BurnRomInfo CheckmanRomDesc[] = { - { "cm1", 0x00800, 0xe8cbdd28, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "cm2", 0x00800, 0xb8432d4d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "cm3", 0x00800, 0x15a97f61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "cm4", 0x00800, 0x8c12ecc0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "cm5", 0x00800, 0x2352cfd6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "cm13", 0x00800, 0x0b09a3e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "cm14", 0x00800, 0x47f043be, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "cm11", 0x00800, 0x8d1bcca0, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "cm9", 0x00800, 0x3cd5c751, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "checkman.clr", 0x00020, 0x57a45057, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Checkman) -STD_ROM_FN(Checkman) - -static struct BurnRomInfo CheckmanjRomDesc[] = { - { "cm_1.bin", 0x01000, 0x456a118f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "cm_2.bin", 0x01000, 0x146b2c44, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "cm_3.bin", 0x00800, 0x73e1c945, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "cm_4.bin", 0x01000, 0x923cffa1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "cm_6.bin", 0x00800, 0x476a7cc3, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "cm_5.bin", 0x00800, 0xb3df2b5f, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "checkman.clr", 0x00020, 0x57a45057, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Checkmanj) -STD_ROM_FN(Checkmanj) - -static struct BurnRomInfo DingoRomDesc[] = { - { "003.e7", 0x01000, 0xd088550f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "004.h7", 0x01000, 0xa228446a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "005.j7", 0x00800, 0x14d680bb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "6.7l", 0x01000, 0x047092e0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "001.h1", 0x00800, 0x1ab1dd4d, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "002.k1", 0x00800, 0x4be375ee, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "18s030.l6", 0x00020, 0x3061d0f9, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Dingo) -STD_ROM_FN(Dingo) - -static struct BurnRomInfo DingoeRomDesc[] = { - { "unk.2b", 0x01000, 0x0df7ac6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "unk.2d", 0x01000, 0x0881e204, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "unk.3b", 0x01000, 0x0b6aeab5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "unk.1c", 0x00800, 0x8e354c38, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "unk.1d", 0x00800, 0x092878d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "unk.4d", 0x00800, 0x76a00a56, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "unk.4b", 0x00800, 0x5acf57aa, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123n.001", 0x00020, 0x02b11865, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Dingoe) -STD_ROM_FN(Dingoe) - -void __fastcall CheckmanZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - GalSoundLatch = d; - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - return; - } - } - - bprintf(PRINT_NORMAL, _T("IO Write %x, %x\n"), a, d); -} - -void __fastcall CheckmanZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa000: - case 0xa001: - case 0xa002: { - GalGfxBank[a - 0xa000] = d; - return; - } - - case 0xa003: { - // coin_count_0_w - return; - } - - case 0xb001: { - GalIrqFire = d & 1; - return; - } - - case 0xb004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - } - - bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); -} - -UINT8 __fastcall CheckmanSoundZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x03: { - return GalSoundLatch; - } - - case 0x06: { - return AY8910Read(0); - } - } - - bprintf(PRINT_NORMAL, _T("Sound IO Read %x\n"), a); - return 0xff; -} - -void __fastcall CheckmanSoundZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x04: { - AY8910Write(0, 0, d); - return; - } - - case 0x05: { - AY8910Write(0, 1, d); - return; - } - } - - bprintf(PRINT_NORMAL, _T("Sound IO Write %x, %x\n"), a, d); -} - -UINT8 __fastcall CheckmanjZ80Read(UINT16 a) -{ - switch (a) { - case 0x3800: { - switch (ZetPc(-1)) { - case 0x0f15: return 0xf5; - case 0x0f8f: return 0x7c; - case 0x10b3: return 0x7c; - case 0x10e0: return 0x00; - case 0x10f1: return 0xaa; - case 0x1402: return 0xaa; - } - return 0xff; - } - - case 0x6000: { - return GalInput[0] | GalDip[0]; - } - - case 0x6800: { - return GalInput[1] | GalDip[1]; - } - - case 0x7000: { - return GalInput[2] | GalDip[2]; - } - - case 0x7800: { - // watchdog read - return 0xff; - } - } - - bprintf(PRINT_NORMAL, _T("Prog Read %x\n"), a); - return 0xff; -} - -void __fastcall CheckmanjZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5800 && a <= 0x58ff) { - INT32 Offset = a - 0x5800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6000: - case 0x6001: { - // start_lamp_w - return; - } - - case 0x6002: { - // coin_lock_w - return; - } - - case 0x6003: { - // coin_count_0_w - return; - } - - case 0x7001: { - GalIrqFire = d & 1; - return; - } - - case 0x7004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x7006: { - GalFlipScreenX = d & 1; - return; - } - - case 0x7007: { - GalFlipScreenY = d & 1; - return; - } - - case 0x7800: { - GalSoundLatch = d; - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - return; - } - } - - bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); -} - -UINT8 __fastcall CheckmanjSoundZ80Read(UINT16 a) -{ - switch (a) { - case 0xa002: { - return AY8910Read(0); - } - } - - bprintf(PRINT_NORMAL, _T("Sound Prog Read %x\n"), a); - return 0xff; -} - -void __fastcall CheckmanjSoundZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xa000: { - AY8910Write(0, 0, d); - return; - } - - case 0xa001: { - AY8910Write(0, 1, d); - return; - } - } - - bprintf(PRINT_NORMAL, _T("Sound Prog Write %x, %x\n"), a, d); -} - -UINT8 __fastcall DingoZ80Read(UINT16 a) -{ - switch (a) { - case 0x3000: { - return 0xaa; - } - - case 0x3035: { - return 0x8c; - } - - case 0x6000: { - return GalInput[0] | GalDip[0]; - } - - case 0x6800: { - return GalInput[1] | GalDip[1]; - } - - case 0x7000: { - return GalInput[2] | GalDip[2]; - } - - case 0x7800: { - // watchdog read - return 0xff; - } - } - - bprintf(PRINT_NORMAL, _T("Prog Read %x\n"), a); - return 0xff; -} - -static void CheckmanInitSoundCPU() -{ - ZetOpen(1); - ZetMapArea(0x0000, GalZ80Rom2Size - 1, 0, GalZ80Rom2); - ZetMapArea(0x0000, GalZ80Rom2Size - 1, 2, GalZ80Rom2); - ZetMapArea(0x2000, 0x23ff, 0, GalZ80Ram2); - ZetMapArea(0x2000, 0x23ff, 1, GalZ80Ram2); - ZetMapArea(0x2000, 0x23ff, 2, GalZ80Ram2); - ZetMemEnd(); - ZetSetInHandler(CheckmanSoundZ80PortRead); - ZetSetOutHandler(CheckmanSoundZ80PortWrite); - ZetClose(); - - nGalCyclesTotal[1] = 1620000 / 60; -} - -static void CheckmanPostLoad() -{ - static const UINT8 XORTable[8][4] = { - { 6, 0, 6, 0 }, - { 5, 1, 5, 1 }, - { 4, 2, 6, 1 }, - { 2, 4, 5, 0 }, - { 4, 6, 1, 5 }, - { 0, 6, 2, 5 }, - { 0, 2, 0, 2 }, - { 1, 4, 1, 4 } - }; - - for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { - UINT8 Data = GalZ80Rom1[Offset]; - UINT32 Line = Offset & 0x07; - - Data ^= (BIT(Data, XORTable[Line][0]) << XORTable[Line][1]) | (BIT(Data, XORTable[Line][2]) << XORTable[Line][3]); - GalZ80Rom1[Offset] = Data; - } - - MapMooncrst(); - ZetOpen(0); - ZetSetWriteHandler(CheckmanZ80Write); - ZetSetOutHandler(CheckmanZ80PortWrite); - ZetClose(); - - CheckmanInitSoundCPU(); -} - -static INT32 CheckmanInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = CheckmanPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910; - GalTilesSharedRomSize = 0x1000; - - nRet = GalInit(); - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); - BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); - memcpy(GalTempRom + 0x0800, GalTempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x1800, GalTempRom + 0x1000, 0x800); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - - GalExtendTileInfoFunction = MooncrstExtendTileInfo; - GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; - - AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -static void CheckmanjInitSoundCPU() -{ - ZetOpen(1); - ZetMapArea(0x0000, GalZ80Rom2Size - 1, 0, GalZ80Rom2); - ZetMapArea(0x0000, GalZ80Rom2Size - 1, 2, GalZ80Rom2); - ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram2); - ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram2); - ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram2); - ZetMemEnd(); - ZetSetReadHandler(CheckmanjSoundZ80Read); - ZetSetWriteHandler(CheckmanjSoundZ80Write); - ZetClose(); - - nGalCyclesTotal[1] = 1620000 / 60; -} - -static void CheckmanjPostLoad() -{ - ZetOpen(0); - ZetSetReadHandler(CheckmanjZ80Read); - ZetSetWriteHandler(CheckmanjZ80Write); - ZetClose(); - - CheckmanjInitSoundCPU(); -} - -static INT32 CheckmanjInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = CheckmanjPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910; - - nRet = GalInit(); - - AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -static void DingoPostLoad() -{ - ZetOpen(0); - ZetSetReadHandler(DingoZ80Read); - ZetSetWriteHandler(CheckmanjZ80Write); - ZetMapArea(0x5400, 0x57ff, 0, GalVideoRam); - ZetMapArea(0x5400, 0x57ff, 1, GalVideoRam); - ZetMapArea(0x5400, 0x57ff, 2, GalVideoRam); - ZetClose(); - - CheckmanjInitSoundCPU(); -} - -static INT32 DingoInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = DingoPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910; - - nRet = GalInit(); - - AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -static void DingoePostLoad() -{ - for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { - UINT8 Data = GalZ80Rom1[Offset]; - - Data ^= BIT(Data, 2) << 4; - Data ^= BIT(Data, 5) << 0; - Data ^= 0x02; - - if (Offset & 0x02) Data = BITSWAP08(Data, 7, 6, 5, 0, 3, 2, 1, 4); - GalZ80Rom1[Offset] = Data; - } - - MapMooncrst(); - ZetOpen(0); - ZetSetWriteHandler(CheckmanZ80Write); - ZetSetOutHandler(CheckmanZ80PortWrite); - ZetClose(); - - CheckmanInitSoundCPU(); -} - -static INT32 DingoeInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = DingoePostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910; - - nRet = GalInit(); - - AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -struct BurnDriver BurnDrvCheckman = { - "checkman", NULL, NULL, NULL, "1982", - "Check Man\0", NULL, "Zilex-Zenitone", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, CheckmanRomInfo, CheckmanRomName, NULL, NULL, CheckmanInputInfo, CheckmanDIPInfo, - CheckmanInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvCheckmanj = { - "checkmanj", "checkman", NULL, NULL, "1982", - "Check Man (Japan)\0", NULL, "Jaleco", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, CheckmanjRomInfo, CheckmanjRomName, NULL, NULL, CheckmanjInputInfo, CheckmanjDIPInfo, - CheckmanjInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvDingo = { - "dingo", NULL, NULL, NULL, "1983", - "Dingo\0", NULL, "Ashby Computers and Graphics LTD. (Jaleco license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, DingoRomInfo, DingoRomName, NULL, NULL, DingoInputInfo, DingoDIPInfo, - DingoInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriverD BurnDrvDingoe = { - "dingoe", "dingo", NULL, NULL, "1983", - "Dingo (encrypted)\0", "Encrypted", "Ashby Computers and Graphics LTD. (Jaleco license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, DingoeRomInfo, DingoeRomName, NULL, NULL, DingoInputInfo, DingoDIPInfo, - DingoeInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Crazy climber sound plus AY8910, and INT instead of NMI -static struct BurnRomInfo MshuttleRomDesc[] = { - { "my05", 0x01000, 0x83574af1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "my04", 0x01000, 0x1cfae2c8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "my03", 0x01000, 0xc8b8a368, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "my02", 0x01000, 0xb6aeee6e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "my01", 0x01000, 0xdef82adc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "my09", 0x01000, 0x3601b380, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my11", 0x00800, 0xb659e932, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my08", 0x01000, 0x992b06cd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my10", 0x00800, 0xd860e6ce, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mscprom1.bin", 0x00020, 0xea0d1af0, BRF_GRA | GAL_ROM_PROM }, - - { "my07", 0x01000, 0x522a2920, BRF_SND | BRF_OPT }, // Samples - { "my06(__eng)", 0x01000, 0x466415f2, BRF_SND | BRF_OPT }, -}; - -STD_ROM_PICK(Mshuttle) -STD_ROM_FN(Mshuttle) - -static struct BurnRomInfo Mshuttle2RomDesc[] = { - { "my05", 0x01000, 0x83574af1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "my04", 0x01000, 0x1cfae2c8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "my03", 0x01000, 0xc8b8a368, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "my02(__mshuttle2)", 0x01000, 0x9804061c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "my01(__mshuttle2)", 0x01000, 0xca746a61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "my09", 0x01000, 0x3601b380, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my11(__mshuttle2)", 0x00800, 0xd860e6ce, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my08", 0x01000, 0x992b06cd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my10", 0x00800, 0xd860e6ce, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mscprom1.bin", 0x00020, 0xea0d1af0, BRF_GRA | GAL_ROM_PROM }, - - { "my07", 0x01000, 0x522a2920, BRF_SND | BRF_OPT }, // Samples - { "my06", 0x01000, 0x6d2dd711, BRF_SND | BRF_OPT }, -}; - -STD_ROM_PICK(Mshuttle2) -STD_ROM_FN(Mshuttle2) - -static struct BurnRomInfo MshuttlejRomDesc[] = { - { "mcs.5", 0x01000, 0xa5a292b4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mcs.4", 0x01000, 0xacdc0f9e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mcs.3", 0x01000, 0xc1e3f5d8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mcs.2", 0x01000, 0x14577703, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mcs.1", 0x01000, 0x27d46772, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "my09", 0x01000, 0x3601b380, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my11", 0x00800, 0xb659e932, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my08", 0x01000, 0x992b06cd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my10", 0x00800, 0xd860e6ce, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mscprom1.bin", 0x00020, 0xea0d1af0, BRF_GRA | GAL_ROM_PROM }, - - { "my07", 0x01000, 0x522a2920, BRF_SND | BRF_OPT }, // Samples - { "my06", 0x01000, 0x6d2dd711, BRF_SND | BRF_OPT }, -}; - -STD_ROM_PICK(Mshuttlej) -STD_ROM_FN(Mshuttlej) - -static struct BurnRomInfo Mshuttlej2RomDesc[] = { - { "ali5.bin", 0x01000, 0x320fe630, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mcs.4", 0x01000, 0xacdc0f9e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mcs.3", 0x01000, 0xc1e3f5d8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali2.bin", 0x01000, 0x9ed169e1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ali1.bin", 0x01000, 0x7f8a52d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "my09", 0x01000, 0x3601b380, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my11", 0x00800, 0xb659e932, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my08", 0x01000, 0x992b06cd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "my10", 0x00800, 0xd860e6ce, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mscprom1.bin", 0x00020, 0xea0d1af0, BRF_GRA | GAL_ROM_PROM }, - - { "my07", 0x01000, 0x522a2920, BRF_SND | BRF_OPT }, // Samples - { "my06.4r", 0x01000, 0x4162be4d, BRF_SND | BRF_OPT }, -}; - -STD_ROM_PICK(Mshuttlej2) -STD_ROM_FN(Mshuttlej2) - -UINT8 __fastcall MshuttleZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x0c: { - if (!MshuttleAY8910CS) return AY8910Read(0); - return 0xff; - } - } - - bprintf(PRINT_NORMAL, _T("IO Read %x\n"), a); - return 0xff; -} - -void __fastcall MshuttleZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x08: { - if (!MshuttleAY8910CS) AY8910Write(0, 0, d); - return; - } - - case 0x09: { - if (!MshuttleAY8910CS) AY8910Write(0, 1, d); - return; - } - } - - bprintf(PRINT_NORMAL, _T("IO Write %x, %x\n"), a, d); -} - -void __fastcall MshuttleZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa000: { - GalIrqFire = d & 1; - return; - } - - case 0xa001: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xa002: { - GalFlipScreenX = d & 1; - GalFlipScreenY = d & 1; - return; - } - - case 0xa004: { - // cclimber_sample_trigger_w - return; - } - - case 0xa007: { - MshuttleAY8910CS = d & 1; - return; - } - - case 0xa800: { - // cclimber_sample_rate_w - return; - } - - case 0xb000: { - // cclimber_sample_volume_w - return; - } - } - bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); -} - -static void MapMshuttle() -{ - MapMooncrst(); - ZetOpen(0); - ZetMapArea(0x0000, 0x4fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x4fff, 2, GalZ80Rom1Op, GalZ80Rom1); - ZetSetWriteHandler(MshuttleZ80Write); - ZetSetInHandler(MshuttleZ80PortRead); - ZetSetOutHandler(MshuttleZ80PortWrite); - ZetClose(); -} - -static void MshuttleDecrypt() -{ - GalZ80Rom1Op = (UINT8*)BurnMalloc(GalZ80Rom1Size); - - static const UINT8 ConvTable[8][16] = { - { 0x40, 0x41, 0x44, 0x15, 0x05, 0x51, 0x54, 0x55, 0x50, 0x00, 0x01, 0x04, (UINT8)-1, 0x10, 0x11, 0x14 }, - { 0x45, 0x51, 0x55, 0x44, 0x40, 0x11, 0x05, 0x41, 0x10, 0x14, 0x54, 0x50, 0x15, 0x04, 0x00, 0x01 }, - { 0x11, 0x14, 0x10, 0x00, 0x44, 0x05, (UINT8)-1, 0x04, 0x45, 0x15, 0x55, 0x50, (UINT8)-1, 0x01, 0x54, 0x51 }, - { 0x14, 0x01, 0x11, 0x10, 0x50, 0x15, 0x00, 0x40, 0x04, 0x51, 0x45, 0x05, 0x55, 0x54, (UINT8)-1, 0x44 }, - { 0x04, 0x10, (UINT8)-1, 0x40, 0x15, 0x41, 0x50, 0x50, 0x11, (UINT8)-1, 0x14, 0x00, 0x51, 0x45, 0x55, 0x01 }, - { 0x44, 0x45, 0x00, 0x51, (UINT8)-1, (UINT8)-1, 0x15, 0x11, 0x01, 0x10, 0x04, 0x55, 0x05, 0x40, 0x50, 0x41 }, - { 0x51, 0x00, 0x01, 0x05, 0x04, 0x55, 0x54, 0x50, 0x41, (UINT8)-1, 0x11, 0x15, 0x14, 0x10, 0x44, 0x40 }, - { 0x05, 0x04, 0x51, 0x01, (UINT8)-1, (UINT8)-1, 0x55, (UINT8)-1, 0x00, 0x50, 0x15, 0x14, 0x44, 0x41, 0x40, 0x54 }, - }; - - for (UINT32 Offset = 0x0000; Offset < GalZ80Rom1Size; Offset++) { - INT32 i, j; - UINT8 Src; - - Src = GalZ80Rom1[Offset]; - i = (Offset & 1) | (Src & 0x02) | ((Src & 0x80) >> 5); - j = (Src & 0x01) | ((Src & 0x04) >> 1) | ((Src & 0x10) >> 2) | ((Src & 0x40) >> 3); - - GalZ80Rom1Op[Offset] = (Src & 0xaa) | ConvTable[i][j]; - } - - MapMshuttle(); -} - -static void MShuttleCommonInit() -{ - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); - BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); - BurnLoadRom(GalTempRom + 0x2000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); - BurnLoadRom(GalTempRom + 0x3000, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - - GalDrawBulletsFunction = MshuttleDrawBullets; - GalExtendTileInfoFunction = MshuttleExtendTileInfo; - GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; - - GalIrqType = GAL_IRQ_TYPE_IRQ0; -} - -static INT32 MshuttleInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MshuttleDecrypt; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910; - GalTilesSharedRomSize = 0x1000; - - nRet = GalInit(); - - MShuttleCommonInit(); - - return nRet; -} - -static void MshuttlejDecrypt() -{ - GalZ80Rom1Op = (UINT8*)BurnMalloc(GalZ80Rom1Size); - - static const UINT8 ConvTable[8][16] = { - { 0x41, 0x54, 0x51, 0x14, 0x05, 0x10, 0x01, 0x55, 0x44, 0x11, 0x00, 0x50, 0x15, 0x40, 0x04, 0x45 }, - { 0x50, 0x11, 0x40, 0x55, 0x51, 0x14, 0x45, 0x04, 0x54, 0x15, 0x10, 0x05, 0x44, 0x01, 0x00, 0x41 }, - { 0x44, 0x11, 0x00, 0x50, 0x41, 0x54, 0x04, 0x14, 0x15, 0x40, 0x51, 0x55, 0x05, 0x10, 0x01, 0x45 }, - { 0x10, 0x50, 0x54, 0x55, 0x01, 0x44, 0x40, 0x04, 0x14, 0x11, 0x00, 0x41, 0x45, 0x15, 0x51, 0x05 }, - { 0x14, 0x41, 0x01, 0x44, 0x04, 0x50, 0x51, 0x45, 0x11, 0x40, 0x54, 0x15, 0x10, 0x00, 0x55, 0x05 }, - { 0x01, 0x05, 0x41, 0x45, 0x54, 0x50, 0x55, 0x10, 0x11, 0x15, 0x51, 0x14, 0x44, 0x40, 0x04, 0x00 }, - { 0x05, 0x55, 0x00, 0x50, 0x11, 0x40, 0x54, 0x14, 0x45, 0x51, 0x10, 0x04, 0x44, 0x01, 0x41, 0x15 }, - { 0x55, 0x50, 0x15, 0x10, 0x01, 0x04, 0x41, 0x44, 0x45, 0x40, 0x05, 0x00, 0x11, 0x14, 0x51, 0x54 }, - }; - - for (UINT32 Offset = 0x0000; Offset < GalZ80Rom1Size; Offset++) { - INT32 i, j; - UINT8 Src; - - Src = GalZ80Rom1[Offset]; - i = (Offset & 1) | (Src & 0x02) | ((Src & 0x80) >> 5); - j = (Src & 0x01) | ((Src & 0x04) >> 1) | ((Src & 0x10) >> 2) | ((Src & 0x40) >> 3); - - GalZ80Rom1Op[Offset] = (Src & 0xaa) | ConvTable[i][j]; - } - - MapMshuttle(); -} - -static INT32 MshuttlejInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MshuttlejDecrypt; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910; - GalTilesSharedRomSize = 0x1000; - - nRet = GalInit(); - - MShuttleCommonInit(); - - return nRet; -} - -struct BurnDriver BurnDrvMshuttle = { - "mshuttle", NULL, NULL, NULL, "1981", - "Moon Shuttle (US?)\0", "Incomplete Sound", "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MshuttleRomInfo, MshuttleRomName, NULL, NULL, MshuttleInputInfo, MshuttleDIPInfo, - MshuttleInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMshuttle2 = { - "mshuttle2", "mshuttle", NULL, NULL, "1981", - "Moon Shuttle (US? set 2)\0", "Incomplete Sound", "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Mshuttle2RomInfo, Mshuttle2RomName, NULL, NULL, MshuttleInputInfo, MshuttleDIPInfo, - MshuttleInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMshuttlej = { - "mshuttlej", "mshuttle", NULL, NULL, "1981", - "Moon Shuttle (Japan)\0", "Incomplete Sound", "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, MshuttlejRomInfo, MshuttlejRomName, NULL, NULL, MshuttleInputInfo, MshuttleDIPInfo, - MshuttlejInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMshuttlej2 = { - "mshuttlej2", "mshuttle", NULL, NULL, "1981", - "Moon Shuttle (Japan set 2)\0", "Incomplete Sound", "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, Mshuttlej2RomInfo, Mshuttlej2RomName, NULL, NULL, MshuttleInputInfo, MshuttleDIPInfo, - MshuttlejInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -// Second Z80 driving DAC -static struct BurnRomInfo KingballRomDesc[] = { - { "prg1.7f", 0x01000, 0x6cb49046, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "prg2.7j", 0x01000, 0xc223b416, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "prg3.7l", 0x00800, 0x453634c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "kbe1.ic4", 0x00800, 0x5be2c80a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "kbe2.ic5", 0x00800, 0xbb59e965, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "kbe3.ic6", 0x00800, 0x1c94dd31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "kbe2.ic7", 0x00800, 0xbb59e965, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "chg1.1h", 0x00800, 0x9cd550e7, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "chg2.1k", 0x00800, 0xa206757d, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "kb2-1", 0x00020, 0x15dd5b16, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Kingball) -STD_ROM_FN(Kingball) - -static struct BurnRomInfo KingballjRomDesc[] = { - { "prg1.7f", 0x01000, 0x6cb49046, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "prg2.7j", 0x01000, 0xc223b416, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "prg3.7l", 0x00800, 0x453634c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "kbj1.ic4", 0x00800, 0xba16beb7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "kbj2.ic5", 0x00800, 0x56686a63, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "kbj3.ic6", 0x00800, 0xfbc570a5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "kbj2.ic7", 0x00800, 0x56686a63, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "chg1.1h", 0x00800, 0x9cd550e7, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "chg2.1k", 0x00800, 0xa206757d, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "kb2-1", 0x00020, 0x15dd5b16, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Kingballj) -STD_ROM_FN(Kingballj) - -UINT8 __fastcall KingballZ80Read(UINT16 a) -{ - switch (a) { - case 0xa000: { - if (KingballSpeechDip) { - return GalInput[0] | GalDip[0] | ((GalFakeDip & 0x02) ? 0x40 : 0x00); - } else { - return GalInput[0] | GalDip[0] | ((GalFakeDip & 0x01) ? 0x40 : 0x00); - } - } - - case 0xa800: { - return ((GalInput[1] | GalDip[1]) & ~0x20) | (rand() & 0x20); - } - - case 0xb000: { - return GalInput[2] | GalDip[2]; - } - - case 0xb800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall KingballZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa000: - case 0xa001: - case 0xa002: { - GalGfxBank[a - 0xa000] = d; - return; - } - - case 0xa003: { - // coin_count_0_w - return; - } - - case 0xa004: - case 0xa005: - case 0xa006: - case 0xa007: { - GalaxianLfoFreqWrite(a - 0xa004, d); - return; - } - - case 0xa800: - case 0xa801: - case 0xa802: - case 0xa803: - case 0xa804: - case 0xa805: - case 0xa806: - case 0xa807: { - GalaxianSoundWrite(a - 0xa800, d); - return; - } - - case 0xb000: { - KingballSound = (KingballSound & ~0x01) | d; - return; - } - - case 0xb001: { - GalIrqFire = d & 1; - return; - } - - case 0xb002: { - KingballSound = (KingballSound & ~0x02) | (d << 1); - GalSoundLatch = KingballSound | 0xf0; - return; - } - - case 0xb003: { - KingballSpeechDip = d; - return; - } - - case 0xb004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall KingballSoundZ80Read(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall KingballSoundZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall KingballSoundZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return GalSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall KingballSoundZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - DACWrite(0, d ^ 0xff); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); - } - } -} - -static void KingballPostLoad() -{ - MapMooncrst(); - - ZetOpen(0); - ZetSetReadHandler(KingballZ80Read); - ZetSetWriteHandler(KingballZ80Write); - ZetClose(); - - ZetOpen(1); - ZetSetReadHandler(KingballSoundZ80Read); - ZetSetWriteHandler(KingballSoundZ80Write); - ZetSetInHandler(KingballSoundZ80PortRead); - ZetSetOutHandler(KingballSoundZ80PortWrite); - ZetMapArea(0x0000, 0x1fff, 0, GalZ80Rom2); - ZetMapArea(0x0000, 0x1fff, 2, GalZ80Rom2); - ZetMemEnd(); - ZetClose(); - - nGalCyclesTotal[1] = (5000000 / 2) / 60; -} - -static INT32 KingballInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = KingballPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC; - GalTilesSharedRomSize = 0x1000; - - nRet = GalInit(); - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); - BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); - memcpy(GalTempRom + 0x0800, GalTempRom + 0x0000, 0x800); - memcpy(GalTempRom + 0x1800, GalTempRom + 0x1000, 0x800); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - - return nRet; -} - -struct BurnDriver BurnDrvKingball = { - "kingball", NULL, NULL, NULL, "1980", - "King & Balloon (US)\0", NULL, "Namco", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, KingballRomInfo, KingballRomName, NULL, NULL, KingballInputInfo, KingballDIPInfo, - KingballInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvKingballj = { - "kingballj", "kingball", NULL, NULL, "1980", - "King & Balloon (Japan)\0", NULL, "Namco", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, KingballjRomInfo, KingballjRomName, NULL, NULL, KingballInputInfo, KingballDIPInfo, - KingballInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Frogger based hardware -static struct BurnRomInfo FroggerRomDesc[] = { - { "frogger.26", 0x01000, 0x597696d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "frogger.27", 0x01000, 0xb6e6fcc3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "frsm3.7", 0x01000, 0xaca22ae0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "frogger.608", 0x00800, 0xe8ab0256, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "frogger.609", 0x00800, 0x7380a48f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "frogger.610", 0x00800, 0x31d7eb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "frogger.607", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "frogger.606", 0x00800, 0xf524ee30, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Frogger) -STD_ROM_FN(Frogger) - -static struct BurnRomInfo Froggers1RomDesc[] = { - { "frogger.26", 0x01000, 0x597696d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "frogger.27", 0x01000, 0xb6e6fcc3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "frogger.34", 0x01000, 0xed866bab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "epr-608.ic32", 0x00800, 0xe8ab0256, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr-609.ic33", 0x00800, 0x7380a48f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr-610.ic34", 0x00800, 0x31d7eb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "epr-607.ic101", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr-606.ic102", 0x00800, 0xf524ee30, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Froggers1) -STD_ROM_FN(Froggers1) - -static struct BurnRomInfo Froggers2RomDesc[] = { - { "epr-1012.ic5", 0x01000, 0xefab0c79, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr-1013a.ic6", 0x01000, 0xaeca9c13, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr-1014.ic7", 0x01000, 0xdd251066, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr-1015.ic8", 0x01000, 0xbf293a02, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "epr-608.ic32", 0x00800, 0xe8ab0256, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr-609.ic33", 0x00800, 0x7380a48f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr-610.ic34", 0x00800, 0x31d7eb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "epr-607.ic101", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr-606.ic102", 0x00800, 0xf524ee30, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Froggers2) -STD_ROM_FN(Froggers2) - -static struct BurnRomInfo FroggermcRomDesc[] = { - { "epr-1031.15", 0x01000, 0x4b7c8d11, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr-1032.16", 0x01000, 0xac00b9d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr-1033.33", 0x01000, 0xbc1d6fbc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr-1034.34", 0x01000, 0x9efe7399, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "epr-1082.42", 0x01000, 0x802843c2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr-1035.43", 0x00800, 0x14e74148, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "epr-1037.1h", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr-1036.1k", 0x00800, 0x658745f8, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Froggermc) -STD_ROM_FN(Froggermc) - -static struct BurnRomInfo FroggersRomDesc[] = { - { "vid_d2.bin", 0x00800, 0xc103066e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_e2.bin", 0x00800, 0xf08bc094, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_f2.bin", 0x00800, 0x637a2ff8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_h2.bin", 0x00800, 0x04c027a5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_j2.bin", 0x00800, 0xfbdfbe74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_l2.bin", 0x00800, 0x8a4389e1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "frogger.608", 0x00800, 0xe8ab0256, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "frogger.609", 0x00800, 0x7380a48f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "frogger.610", 0x00800, 0x31d7eb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "frogger.607", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr-1036.1k", 0x00800, 0x658745f8, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Froggers) -STD_ROM_FN(Froggers) - -static struct BurnRomInfo FrogfRomDesc[] = { - { "6.bin", 0x01000, 0x8ff0a973, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7.bin", 0x01000, 0x3087bb4b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8.bin", 0x01000, 0xc3869d12, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "frogger.608", 0x00800, 0xe8ab0256, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "frogger.609", 0x00800, 0x7380a48f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "frogger.610", 0x00800, 0x31d7eb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "frogger.607", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr-1036.1k", 0x00800, 0x658745f8, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Frogf) -STD_ROM_FN(Frogf) - -static struct BurnRomInfo FroggRomDesc[] = { - { "p1.bin", 0x00800, 0x1762b266, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p2.bin", 0x00800, 0x322f3916, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p3.bin", 0x00800, 0x28bd6151, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p4.bin", 0x00800, 0x5a69ab18, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p5.bin", 0x00800, 0xb4f17745, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p6.bin", 0x00800, 0x34be71b5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p7.bin", 0x00800, 0xde3edc8c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "k.bin", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "h.bin", 0x00800, 0x658745f8, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Frogg) -STD_ROM_FN(Frogg) - -void __fastcall FroggermcZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa000: - case 0xa001: - case 0xa002: { - GalGfxBank[a - 0xa000] = d; - return; - } - - case 0xa003: { - // coin_count_0_w - return; - } - - case 0xa800: { - GalSoundLatch = d; - return; - } - - case 0xb000: { - GalIrqFire = d & 1; - return; - } - - case 0xb001: { - if (!(d & 1)) { - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(0); - } - return; - } - - case 0xb004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall FrogfZ80Read(UINT16 a) -{ - if (a >= 0xc000) { - UINT32 Offset = a - 0xc000; - UINT8 Result = 0xff; - if (Offset & 0x1000) Result &= ppi8255_r(0, (Offset >> 3) & 3); - if (Offset & 0x2000) Result &= ppi8255_r(1, (Offset >> 3) & 3); - return Result; - } - - switch (a) { - case 0xb800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall FrogfZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9000 && a <= 0x90ff) { - INT32 Offset = a - 0x9000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0xc000) { - INT32 Offset = a - 0xc000; - if (Offset & 0x1000) ppi8255_w(0, (Offset >> 3) & 3, d); - if (Offset & 0x2000) ppi8255_w(1, (Offset >> 3) & 3, d); - return; - } - - switch (a) { - case 0xa802: { - GalFlipScreenX = d & 1; - return; - } - - case 0xa804: { - GalIrqFire = d & 1; - return; - } - - case 0xa806: { - GalFlipScreenY = d & 1; - return; - } - - case 0xa809: { - // coin_count_1_w - return; - } - - case 0xa80e: { - // coin_count_0_w - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static void FroggerEncGfxPostLoad() -{ - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); - BurnLoadRom(GalTempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); - for (UINT32 Offset = 0x0800; Offset < 0x1000; Offset++) GalTempRom[Offset] = BITSWAP08(GalTempRom[Offset], 7, 6, 5, 4, 3, 2, 0, 1); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - - MapFrogger(); -} - -static INT32 FroggerEncGfxInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = FroggerEncGfxPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; - - nRet = GalInit(); - FroggerSoundInit(); - - FroggerAdjust = 1; - - GalRenderBackgroundFunction = FroggerDrawBackground; - GalDrawBulletsFunction = NULL; - GalExtendTileInfoFunction = FroggerExtendTileInfo; - GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; - - KonamiPPIInit(); - - return nRet; -} - -static void FroggermcPostLoad() -{ - MapMooncrst(); - - ZetOpen(0); - ZetSetWriteHandler(FroggermcZ80Write); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetClose(); -} - -static INT32 FroggermcInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = FroggermcPostLoad; -// GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; - - nRet = GalInit(); - FroggerSoundInit(); - - GalRenderBackgroundFunction = FroggerDrawBackground; - GalDrawBulletsFunction = NULL; - GalExtendTileInfoFunction = FroggerExtendTileInfo; - GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; - - return nRet; -} - -static INT32 FroggersInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapTheend; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; - - nRet = GalInit(); - FroggerSoundInit(); - - KonamiPPIInit(); - - GalRenderBackgroundFunction = FroggerDrawBackground; - GalDrawBulletsFunction = NULL; - GalExtendTileInfoFunction = FroggerExtendTileInfo; - GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; - - return nRet; -} - -static void FrogfPostLoad() -{ - MapFrogger(); - - ZetOpen(0); - ZetSetReadHandler(FrogfZ80Read); - ZetSetWriteHandler(FrogfZ80Write); - ZetMemCallback(0x8800, 0xffff, 0); - ZetMemCallback(0x8800, 0xffff, 1); - ZetMemCallback(0x8800, 0xffff, 2); - ZetMapArea(0x8800, 0x8bff, 0, GalVideoRam); - ZetMapArea(0x8800, 0x8bff, 1, GalVideoRam); - ZetMapArea(0x8800, 0x8bff, 2, GalVideoRam); - ZetMapArea(0x9000, 0x90ff, 0, GalSpriteRam); - ZetMapArea(0x9000, 0x90ff, 2, GalSpriteRam); - ZetClose(); -} - -static INT32 FrogfInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = FrogfPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; - - nRet = GalInit(); - FroggerSoundInit(); - - KonamiPPIInit(); - - GalRenderBackgroundFunction = FroggerDrawBackground; - GalDrawBulletsFunction = NULL; - GalExtendTileInfoFunction = FroggerExtendTileInfo; - GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; - - return nRet; -} - -static void FroggPostLoad() -{ - ZetOpen(0); - ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); - ZetClose(); -} - -static INT32 FroggInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = FroggPostLoad; - - nRet = GalInit(); - - GalRenderBackgroundFunction = FroggerDrawBackground; - GalExtendTileInfoFunction = FroggerExtendTileInfo; - GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; - - return nRet; -} - -struct BurnDriver BurnDrvFrogger = { - "frogger", NULL, NULL, NULL, "1981", - "Frogger\0", NULL, "Konami", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, - NULL, FroggerRomInfo, FroggerRomName, NULL, NULL, FroggerInputInfo, FroggerDIPInfo, - FroggerEncGfxInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvFroggers1 = { - "froggers1", "frogger", NULL, NULL, "1981", - "Frogger (Sega set 1)\0", NULL, "Konami (Sega license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, - NULL, Froggers1RomInfo, Froggers1RomName, NULL, NULL, FroggerInputInfo, FroggerDIPInfo, - FroggerEncGfxInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvFroggers2 = { - "froggers2", "frogger", NULL, NULL, "1981", - "Frogger (Sega set 2)\0", NULL, "Konami (Sega license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, - NULL, Froggers2RomInfo, Froggers2RomName, NULL, NULL, FroggerInputInfo, FroggerDIPInfo, - FroggerEncGfxInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvFroggermc = { - "froggermc", "frogger", NULL, NULL, "1981", - "Frogger (Moon Cresta hardware)\0", "No Sound", "Konami (Sega license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, - NULL, FroggermcRomInfo, FroggermcRomName, NULL, NULL, FroggermcInputInfo, FroggermcDIPInfo, - FroggermcInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvFroggers = { - "froggers", "frogger", NULL, NULL, "1981", - "Frog\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, - NULL, FroggersRomInfo, FroggersRomName, NULL, NULL, FroggerInputInfo, FroggerDIPInfo, - FroggersInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvFrogf = { - "frogf", "frogger", NULL, NULL, "1981", - "Frog (Falcon bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, - NULL, FrogfRomInfo, FrogfRomName, NULL, NULL, FroggerInputInfo, FroggerDIPInfo, - FrogfInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvFrogg = { - "frogg", "frogger", NULL, NULL, "1981", - "Frog (Galaxian hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, - NULL, FroggRomInfo, FroggRomName, NULL, NULL, FroggInputInfo, FroggDIPInfo, - FroggInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Turtles based hardware -static struct BurnRomInfo TurtlesRomDesc[] = { - { "turt_vid.2c", 0x01000, 0xec5e61fb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "turt_vid.2e", 0x01000, 0xfd10821e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "turt_vid.2f", 0x01000, 0xddcfc5fa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "turt_vid.2h", 0x01000, 0x9e71696c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "turt_vid.2j", 0x01000, 0xfcd49fef, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "turt_snd.5c", 0x01000, 0xf0c30f9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "turt_snd.5d", 0x01000, 0xaf5fc43c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "turt_vid.5h", 0x00800, 0xe5999d52, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "turt_vid.5f", 0x00800, 0xc3ffd655, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "turtles.clr", 0x00020, 0xf3ef02dd, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Turtles) -STD_ROM_FN(Turtles) - -static struct BurnRomInfo TurpinRomDesc[] = { - { "m1", 0x01000, 0x89177473, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m2", 0x01000, 0x4c6ca5c6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m3", 0x01000, 0x62291652, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "turt_vid.2h", 0x01000, 0x9e71696c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "m5", 0x01000, 0x7d2600f2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "turt_snd.5c", 0x01000, 0xf0c30f9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "turt_snd.5d", 0x01000, 0xaf5fc43c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "turt_vid.5h", 0x00800, 0xe5999d52, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "turt_vid.5f", 0x00800, 0xc3ffd655, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "turtles.clr", 0x00020, 0xf3ef02dd, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Turpin) -STD_ROM_FN(Turpin) - -static struct BurnRomInfo SixhundredRomDesc[] = { - { "600_vid.2c", 0x01000, 0x8ee090ae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "600_vid.2e", 0x01000, 0x45bfaff2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "600_vid.2f", 0x01000, 0x9f4c8ed7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "600_vid.2h", 0x01000, 0xa92ef056, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "600_vid.2j", 0x01000, 0x6dadd72d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "600_snd.5c", 0x01000, 0x1773c68e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "600_snd.5d", 0x01000, 0xa311b998, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "600_vid.5h", 0x00800, 0x006c3d56, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "600_vid.5f", 0x00800, 0x7dbc0426, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "turtles.clr", 0x00020, 0xf3ef02dd, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Sixhundred) -STD_ROM_FN(Sixhundred) - -static struct BurnRomInfo TurpinsRomDesc[] = { - { "t1.bin", 0x01000, 0x89dd50cc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "t3.bin", 0x01000, 0x9562dc29, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "t4.bin", 0x01000, 0x62291652, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "t5.bin", 0x01000, 0x804118e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "t2.bin", 0x01000, 0x8024f678, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "8tur.bin", 0x01000, 0xc97ed8ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "5tur.bin", 0x01000, 0xaf5fc43c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "tur.4f", 0x00800, 0xe5999d52, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "tur.5f", 0x00800, 0xc3ffd655, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "turtles.clr", 0x00020, 0xf3ef02dd, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Turpins) -STD_ROM_FN(Turpins) - -static struct BurnRomInfo AmidarRomDesc[] = { - { "1.2c", 0x01000, 0x621b74de, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2.2e", 0x01000, 0x38538b98, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3.2f", 0x01000, 0x099ecb24, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4.2h", 0x01000, 0xba149a93, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5.2j", 0x01000, 0xeecc1abf, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "s1.5c", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "s2.5d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "c2.5f", 0x00800, 0x2cfe5ede, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "c2.5d", 0x00800, 0x57c4fd0d, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Amidar) -STD_ROM_FN(Amidar) - -static struct BurnRomInfo Amidar1RomDesc[] = { - { "amidar.2c", 0x01000, 0xc294bf27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "amidar.2e", 0x01000, 0xe6e96826, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "amidar.2f", 0x01000, 0x3656be6f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "amidar.2h", 0x01000, 0x1be170bd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "amidar.5c", 0x01000, 0xc4b66ae4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "amidar.5d", 0x01000, 0x806785af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "amidar.5f", 0x00800, 0x5e51e84d, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "amidar.5h", 0x00800, 0x2f7f1c30, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Amidar1) -STD_ROM_FN(Amidar1) - -static struct BurnRomInfo AmidaruRomDesc[] = { - { "amidarus.2c", 0x01000, 0x951e0792, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "amidarus.2e", 0x01000, 0xa1a3a136, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "amidarus.2f", 0x01000, 0xa5121bf5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "amidarus.2h", 0x01000, 0x051d1c7f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "amidarus.2j", 0x01000, 0x351f00d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "amidarus.5c", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "amidarus.5d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "amidarus.5f", 0x00800, 0x2cfe5ede, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "amidarus.5h", 0x00800, 0x57c4fd0d, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Amidaru) -STD_ROM_FN(Amidaru) - -static struct BurnRomInfo AmidaroRomDesc[] = { - { "107.2cd", 0x01000, 0xc52536be, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "108.2fg", 0x01000, 0x38538b98, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "109.2fg", 0x01000, 0x69907f0f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "110.2h", 0x01000, 0xba149a93, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "111.2j", 0x01000, 0x20d01c2e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "amidarus.5c", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "amidarus.5d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "amidarus.5f", 0x00800, 0x2cfe5ede, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "113.5h", 0x00800, 0xbcdce168, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Amidaro) -STD_ROM_FN(Amidaro) - -static struct BurnRomInfo AmidarbRomDesc[] = { - { "ami2gor.2c", 0x01000, 0x9ad2dcd2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2.2f", 0x01000, 0x66282ff5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3.2j", 0x01000, 0xb0860e31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4.2m", 0x01000, 0x4a4086c9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "8.11d", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "9.9d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5.5f", 0x00800, 0x2082ad0a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "6.5h", 0x00800, 0x3029f94f, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "n82s123n.6e", 0x00020, 0x01004d3f, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Amidarb) -STD_ROM_FN(Amidarb) - -static struct BurnRomInfo AmigoRomDesc[] = { - { "2732.a1", 0x01000, 0x930dc856, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2732.a2", 0x01000, 0x66282ff5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2732.a3", 0x01000, 0xe9d3dc76, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2732.a4", 0x01000, 0x4a4086c9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "amidarus.5c", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "amidarus.5d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "2716.a6", 0x00800, 0x2082ad0a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "2716.a5", 0x00800, 0x3029f94f, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Amigo) -STD_ROM_FN(Amigo) - -static struct BurnRomInfo AmidarsRomDesc[] = { - { "am2d", 0x00800, 0x24b79547, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "am2e", 0x00800, 0x4c64161e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "am2f", 0x00800, 0xb3987a72, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "am2h", 0x00800, 0x29873461, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "am2j", 0x00800, 0x0fdd54d8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "am2l", 0x00800, 0x5382f7ed, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "am2m", 0x00800, 0x1d7109e9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "am2p", 0x00800, 0xc9163ac6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "amidarus.5c", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "amidarus.5d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "2716.a6", 0x00800, 0x2082ad0a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "2716.a5", 0x00800, 0x3029f94f, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Amidars) -STD_ROM_FN(Amidars) - -UINT8 __fastcall TurpinsZ80Read(UINT16 a) -{ - switch (a) { - case 0xa000: { - return 0xff - GalInput[0] - GalDip[0]; - } - - case 0xa001: { - return 0xff - GalInput[1] - GalDip[1]; - } - - case 0xa002: { - return 0xff - GalInput[2] - GalDip[2]; - } - - case 0xb800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall TurpinsZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa000: { - GalBackgroundRed = d & 1; - return; - } - - case 0xa020: { - GalBackgroundGreen = d & 1; - return; - } - - case 0xa028: { - GalBackgroundBlue = d & 1; - return; - } - - - case 0xa030: { - // coin_count_0_w - return; - } - - case 0xa038: { - // coin_count_1_w - return; - } - - - case 0xa801: { - GalIrqFire = d & 1; - return; - } - - case 0xa806: { - GalFlipScreenX = d & 1; - return; - } - - case 0xa807: { - GalFlipScreenY = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 TurtlesInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapTurtles; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = TurtlesDrawBackground; - GalDrawBulletsFunction = NULL; - - KonamiPPIInit(); - - return nRet; -} - -static void TurpinsPostLoad() -{ - MapTurtles(); - - ZetOpen(0); - ZetSetReadHandler(TurpinsZ80Read); - ZetSetWriteHandler(TurpinsZ80Write); - ZetClose(); -} - -static INT32 TurpinsInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = TurpinsPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = TurtlesDrawBackground; - GalDrawBulletsFunction = NULL; - - return nRet; -} - -struct BurnDriver BurnDrvTurtles = { - "turtles", NULL, NULL, NULL, "1981", - "Turtles\0", NULL, "Konami (Stern license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, TurtlesRomInfo, TurtlesRomName, NULL, NULL, TurtlesInputInfo, TurtlesDIPInfo, - TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTurpin = { - "turpin", "turtles", NULL, NULL, "1981", - "Turpin\0", NULL, "Konami (Sega license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, TurpinRomInfo, TurpinRomName, NULL, NULL, TurtlesInputInfo, TurpinDIPInfo, - TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSixhundred = { - "600", "turtles", NULL, NULL, "1981", - "600\0", NULL, "Konami", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, SixhundredRomInfo, SixhundredRomName, NULL, NULL, TurtlesInputInfo, TurtlesDIPInfo, - TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTurpins = { - "turpins", "turtles", NULL, NULL, "1981", - "Turpin (bootleg on Scramble hardware)\0", "No Sound", "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, TurpinsRomInfo, TurpinsRomName, NULL, NULL, TurtlesInputInfo, TurtlesDIPInfo, - TurpinsInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAmidar = { - "amidar", NULL, NULL, NULL, "1981", - "Amidar\0", NULL, "Konami", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, AmidarRomInfo, AmidarRomName, NULL, NULL, AmidarInputInfo, AmidaruDIPInfo, - TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAmidar1 = { - "amidar1", "amidar", NULL, NULL, "1981", - "Amidar (older)\0", NULL, "Konami", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, Amidar1RomInfo, Amidar1RomName, NULL, NULL, AmidarInputInfo, AmidarDIPInfo, - TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAmidaru = { - "amidaru", "amidar", NULL, NULL, "1982", - "Amidar (Stern)\0", NULL, "Konami (Stern license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, AmidaruRomInfo, AmidaruRomName, NULL, NULL, AmidarInputInfo, AmidaruDIPInfo, - TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAmidaro = { - "amidaro", "amidar", NULL, NULL, "1982", - "Amidar (Olympia)\0", NULL, "Konami (Olympia license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, AmidaroRomInfo, AmidaroRomName, NULL, NULL, AmidarInputInfo, AmidaroDIPInfo, - TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAmidarb = { - "amidarb", "amidar", NULL, NULL, "1982", - "Amidar (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, AmidarbRomInfo, AmidarbRomName, NULL, NULL, AmidarInputInfo, AmidaruDIPInfo, - TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAmigo = { - "amigo", "amidar", NULL, NULL, "1982", - "Amigo\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, AmigoRomInfo, AmigoRomName, NULL, NULL, AmidarInputInfo, AmidaruDIPInfo, - TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAmidars = { - "amidars", "amidar", NULL, NULL, "1982", - "Amidar (Scramble hardware)\0", NULL, "Konami", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, AmidarsRomInfo, AmidarsRomName, NULL, NULL, AmidarInputInfo, AmidarsDIPInfo, - ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// The End / Scramble based hardware -static struct BurnRomInfo TheendRomDesc[] = { - { "ic13_1t.bin", 0x00800, 0x93e555ba, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic14_2t.bin", 0x00800, 0x2de7ad27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic15_3t.bin", 0x00800, 0x035f750b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic16_4t.bin", 0x00800, 0x61286b5c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic17_5t.bin", 0x00800, 0x434a8f68, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic18_6t.bin", 0x00800, 0xdc4cc786, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ic56_1.bin", 0x00800, 0x7a141f29, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ic55_2.bin", 0x00800, 0x218497c1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "ic30_2c.bin", 0x00800, 0x68ccf7bf, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ic31_1c.bin", 0x00800, 0x4a48c999, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6331-1j.86", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Theend) -STD_ROM_FN(Theend) - -static struct BurnRomInfo TheendsRomDesc[] = { - { "ic13", 0x00800, 0x90e5ab14, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic14", 0x00800, 0x950f0a07, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic15", 0x00800, 0x6786bcf5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic16", 0x00800, 0x380a0017, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic17", 0x00800, 0xaf067b7f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic18", 0x00800, 0xa0411b93, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ic56", 0x00800, 0x3b2c2f70, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ic55", 0x00800, 0xe0429e50, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "ic30", 0x00800, 0x527fd384, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ic31", 0x00800, 0xaf6d09b6, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6331-1j.86", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Theends) -STD_ROM_FN(Theends) - -static struct BurnRomInfo ScrambleRomDesc[] = { - { "s1.2d", 0x00800, 0xea35ccaa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "s2.2e", 0x00800, 0xe7bba1b3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "s3.2f", 0x00800, 0x12d7fc3e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "s4.2h", 0x00800, 0xb59360eb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "s5.2j", 0x00800, 0x4919a91c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "s6.2l", 0x00800, 0x26a4547b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "s7.2m", 0x00800, 0x0bb49470, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "s8.2p", 0x00800, 0x6a5740e5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "c2.5f", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "c1.5h", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Scramble) -STD_ROM_FN(Scramble) - -static struct BurnRomInfo ScramblesRomDesc[] = { - { "2d", 0x00800, 0xb89207a1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e", 0x00800, 0xe9b4b9eb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2f", 0x00800, 0xa1f14f4c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h", 0x00800, 0x591bc0d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j", 0x00800, 0x22f11b6b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2l", 0x00800, 0x705ffe49, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2m", 0x00800, 0xea26c35c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2p", 0x00800, 0x94d8f5e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5f", 0x00800, 0x5f30311a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h", 0x00800, 0x516e029e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Scrambles) -STD_ROM_FN(Scrambles) - -static struct BurnRomInfo ScramblebfRomDesc[] = { - { "scf1.2d", 0x00800, 0xb126aa1f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scf2.2e", 0x00800, 0xce25fb77, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scns3.2f", 0x00800, 0xeec265ee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scns4.2h", 0x00800, 0xdd380a22, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scns5.2j", 0x00800, 0x92980e72, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scns6.2l", 0x00800, 0x9fd96374, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scns7.2m", 0x00800, 0x88ac07a0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scns8.2p", 0x00800, 0x75232e09, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ot1ns.5c", 0x00800, 0xbe037cf6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "c2.5f", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "c1.5h", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Scramblebf) -STD_ROM_FN(Scramblebf) - -static struct BurnRomInfo ScramblebbRomDesc[] = { - { "1", 0x00800, 0x8ba174c4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2", 0x00800, 0x43cb40a4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3", 0x00800, 0xeec265ee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4", 0x00800, 0xdd380a22, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5", 0x00800, 0x92980e72, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6", 0x00800, 0x9fd96374, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7", 0x00800, 0x88ac07a0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8", 0x00800, 0x75232e09, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "9", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "10", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Scramblebb) -STD_ROM_FN(Scramblebb) - -static struct BurnRomInfo StrfbombRomDesc[] = { - { "1.2c", 0x00800, 0xb102aaa0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2.2e", 0x00800, 0xd4155703, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3.2f", 0x00800, 0xa9568c89, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4.2h", 0x00800, 0x663b6c35, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5.2j", 0x00800, 0x4919a91c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6.2l", 0x00800, 0x4ec66ae3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7.2m", 0x00800, 0x0feb0192, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8.2p", 0x00800, 0x280a6142, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "9.5f", 0x00800, 0x3abeff25, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "10.5h", 0x00800, 0x79ecacbe, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Strfbomb) -STD_ROM_FN(Strfbomb) - -static struct BurnRomInfo ExplorerRomDesc[] = { - { "10l.bin", 0x01000, 0xd5adf626, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "9l.bin", 0x01000, 0x48e32788, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "8l.bin", 0x01000, 0xc0dbdbde, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "7l.bin", 0x01000, 0x9b30d227, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "3f.bin", 0x01000, 0x9faf18cf, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "4b.bin", 0x00800, 0xe910b5c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "c2.5f", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "c1.5h", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Explorer) -STD_ROM_FN(Explorer) - -static struct BurnRomInfo AtlantisRomDesc[] = { - { "2c", 0x00800, 0x0e485b9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e", 0x00800, 0xc1640513, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2f", 0x00800, 0xeec265ee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h", 0x00800, 0xa5d2e442, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j", 0x00800, 0x45f7cf34, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2l", 0x00800, 0xf335b96b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5f", 0x00800, 0x57f9c6b9, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h", 0x00800, 0xe989f325, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Atlantis) -STD_ROM_FN(Atlantis) - -static struct BurnRomInfo Atlantis2RomDesc[] = { - { "rom1", 0x00800, 0xad348089, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom2", 0x00800, 0xcaa705d1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom3", 0x00800, 0xe420641d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom4", 0x00800, 0x04792d90, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j", 0x00800, 0x45f7cf34, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom6", 0x00800, 0xb297bd4b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom7", 0x00800, 0xa50bf8d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rom8", 0x00800, 0xd2c5c984, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "rom9", 0x00800, 0x55cd5acd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom10", 0x00800, 0x72e773b8, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Atlantis2) -STD_ROM_FN(Atlantis2) - -static struct BurnRomInfo CkongsRomDesc[] = { - { "vid_2c.bin", 0x01000, 0x49a8c234, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_2e.bin", 0x01000, 0xf1b667f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_2f.bin", 0x01000, 0xb194b75d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_2h.bin", 0x01000, 0x2052ba8a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_2j.bin", 0x01000, 0xb377afd0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_2l.bin", 0x01000, 0xfe65e691, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "turt_snd.5c", 0x01000, 0xf0c30f9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "snd_5d.bin", 0x01000, 0x892c9547, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "vid_5f.bin", 0x01000, 0x7866d2cb, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "vid_5h.bin", 0x01000, 0x7311a101, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "vid_6e.bin", 0x00020, 0x5039af97, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Ckongs) -STD_ROM_FN(Ckongs) - -static struct BurnRomInfo MarsRomDesc[] = { - { "u26.3", 0x00800, 0x2f88892c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u56.4", 0x00800, 0x9e6bcbf7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u69.5", 0x00800, 0xdf496e6e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u98.6", 0x00800, 0x75f274bb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u114.7", 0x00800, 0x497fd8d0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u133.8", 0x00800, 0x3d4cd59f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "u39.9", 0x00800, 0xbb5968b9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "u51.10", 0x00800, 0x75fd7720, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "u78.11", 0x00800, 0x72a492da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "u72.1", 0x00800, 0x279789d0, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "u101.2", 0x00800, 0xc5dc627f, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mars) -STD_ROM_FN(Mars) - -static struct BurnRomInfo DevilfshRomDesc[] = { - { "u26.1", 0x00800, 0xec047d71, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u56.2", 0x00800, 0x0138ade9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u69.3", 0x00800, 0x5dd0b3fc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u98.4", 0x00800, 0xded0b745, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u114.5", 0x00800, 0x5fd40176, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u133.6", 0x00800, 0x03538336, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u143.7", 0x00800, 0x64676081, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "u163.8", 0x00800, 0xbc3d6770, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "u39.9", 0x00800, 0x09987e2e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "u51.10", 0x00800, 0x1e2b1471, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "u78.11", 0x00800, 0x45279aaa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "u72.12", 0x01000, 0x5406508e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "u101.13", 0x01000, 0x8c4018b6, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Devilfsh) -STD_ROM_FN(Devilfsh) - -static struct BurnRomInfo Newsin7RomDesc[] = { - { "newsin.1", 0x01000, 0xe6c23fe0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "newsin.2", 0x01000, 0x3d477b5f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "newsin.3", 0x01000, 0x7dfa9af0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "newsin.4", 0x01000, 0xd1b0ba19, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "newsin.5", 0x01000, 0x06275d59, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "newsin.13", 0x00800, 0xd88489a2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "newsin.12", 0x00800, 0xb154a7af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "newsin.11", 0x00800, 0x7ade709b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "newsin.9", 0x01000, 0x6b87adff, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "newsin.8", 0x01000, 0x0c5b895a, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "newsin.7", 0x01000, 0x6bc5d64f, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "newsin.6", 0x00020, 0x5cf2cd8d, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Newsin7) -STD_ROM_FN(Newsin7) - -static struct BurnRomInfo MrkougarRomDesc[] = { - { "2732-7.bin", 0x01000, 0xfd060ffb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2732-6.bin", 0x01000, 0x9e05d868, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2732-5.bin", 0x01000, 0xcbc7c536, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "atw-6w-2.bin", 0x01000, 0xaf42a371, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "atw-6y-3.bin", 0x01000, 0x862b8902, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "atw-6z-4.bin", 0x01000, 0xa0396cc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "2732-1.bin", 0x01000, 0x60ef1d43, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mrkougar) -STD_ROM_FN(Mrkougar) - -static struct BurnRomInfo Mrkougar2RomDesc[] = { - { "atw-7l-7.bin", 0x01000, 0x7b34b198, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "atw-7k-6.bin", 0x01000, 0xfbca23c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "atw-7h-5.bin", 0x01000, 0x05b257a2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "atw-6w-2.bin", 0x01000, 0xaf42a371, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "atw-6y-3.bin", 0x01000, 0x862b8902, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "atw-6z-4.bin", 0x01000, 0xa0396cc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "atw-1h-1.bin", 0x01000, 0x38fdfb63, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "atw-prom.bin", 0x00020, 0xc65db188, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mrkougar2) -STD_ROM_FN(Mrkougar2) - -static struct BurnRomInfo MrkougbRomDesc[] = { - { "p01.bin", 0x00800, 0xdea0cde1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p02.bin", 0x00800, 0xc8017751, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p03.bin", 0x00800, 0xb8921984, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p04.bin", 0x00800, 0xb3c9754c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p05.bin", 0x00800, 0x8d94adbc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p06.bin", 0x00800, 0xacc921ff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "atw-6w-2.bin", 0x01000, 0xaf42a371, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "atw-6y-3.bin", 0x01000, 0x862b8902, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "atw-6z-4.bin", 0x01000, 0xa0396cc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "g07.bin", 0x00800, 0x0ecfd116, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g08.bin", 0x00800, 0x00bfa3c6, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "atw-prom.bin", 0x00020, 0xc65db188, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mrkougb) -STD_ROM_FN(Mrkougb) - -static struct BurnRomInfo Mrkougb2RomDesc[] = { - { "mrk1.bin", 0x00800, 0xfc93acb9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p02.bin", 0x00800, 0xc8017751, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p03.bin", 0x00800, 0xb8921984, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p04.bin", 0x00800, 0xb3c9754c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p05.bin", 0x00800, 0x8d94adbc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p06.bin", 0x00800, 0xacc921ff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "atw-6w-2.bin", 0x01000, 0xaf42a371, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "atw-6y-3.bin", 0x01000, 0x862b8902, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "atw-6z-4.bin", 0x01000, 0xa0396cc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "g07.bin", 0x00800, 0x0ecfd116, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "g08.bin", 0x00800, 0x00bfa3c6, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "atw-prom.bin", 0x00020, 0xc65db188, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mrkougb2) -STD_ROM_FN(Mrkougb2) - -static struct BurnRomInfo HotshockRomDesc[] = { - { "0d.l10", 0x01000, 0x3e8aeaeb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "1d.l9", 0x01000, 0x0eab3246, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2d.l8", 0x01000, 0xe646bde3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3d.l7", 0x01000, 0x5bde9312, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "6d.b3", 0x01000, 0xc5e02651, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "7d.b4", 0x01000, 0x49dc113d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "4d.h3", 0x01000, 0x751c850e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5d.h5", 0x01000, 0xfc74282e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "18s030.1k", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Hotshock) -STD_ROM_FN(Hotshock) - -static struct BurnRomInfo HotshockbRomDesc[] = { - { "hotshock.l10", 0x01000, 0x401078f7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "hotshock.l9", 0x01000, 0xaf76c237, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "hotshock.l8", 0x01000, 0x30486031, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "hotshock.l7", 0x01000, 0x5bde9312, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "hotshock.b3", 0x01000, 0x0092f0e2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "hotshock.b4", 0x01000, 0xc2135a44, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "hotshock.h4", 0x01000, 0x60bdaea9, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "hotshock.h5", 0x01000, 0x4ef17453, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Hotshockb) -STD_ROM_FN(Hotshockb) - -static struct BurnRomInfo ConquerRomDesc[] = { - { "conquer3.l10", 0x01000, 0xa33a824f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "conquer2.l9", 0x01000, 0x3ffa8285, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "conquer1.l8", 0x01000, 0x9ded2dff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "conquer6.b3", 0x01000, 0xd363b2ea, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "conquer7.b4", 0x01000, 0xe6a63d71, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "conquer4.h3", 0x01000, 0xac533893, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "conquer5.h5", 0x01000, 0xd884fd49, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Conquer) -STD_ROM_FN(Conquer) - -static struct BurnRomInfo CavelonRomDesc[] = { - { "2.bin", 0x02000, 0xa3b353ac, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "1.bin", 0x02000, 0x3f62efd6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3.bin", 0x02000, 0x39d74e4e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "1c_snd.bin", 0x00800, 0xf58dcf55, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "h.bin", 0x01000, 0xd44fcd6f, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k.bin", 0x01000, 0x59bc7f9e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "cavelon.clr", 0x00020, 0xd133356b, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Cavelon) -STD_ROM_FN(Cavelon) - -static struct BurnRomInfo MimonscrRomDesc[] = { - { "mm1", 0x01000, 0x0399a0c4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm2", 0x01000, 0x2c5e971e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm3", 0x01000, 0x24ce1ce3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm4", 0x01000, 0xc83fb639, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm5", 0x01000, 0xa9f12dfc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm6", 0x01000, 0xe492a40c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm7", 0x01000, 0x5339928d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm8", 0x01000, 0xeee7a12e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mmsound1", 0x01000, 0x2d14c527, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "mmsnd2a", 0x01000, 0x35ed0f96, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "mmgfx1", 0x02000, 0x4af47337, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mmgfx2", 0x02000, 0xdef47da8, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mimonscr) -STD_ROM_FN(Mimonscr) - -UINT8 __fastcall ExplorerZ80Read(UINT16 a) -{ - switch (a) { - case 0x7000: { - // watchdog read - return 0xff; - } - - case 0x8000: { - return GalInput[0] | GalDip[0]; - } - - case 0x8001: { - return GalInput[1] | GalDip[1]; - } - - case 0x8002: { - return GalInput[2] | GalDip[2]; - } - - case 0x8003: { - return GalInput[3] | GalDip[3]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall ExplorerZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0x5100 && a <= 0x51ff) { - INT32 Offset = a - 0x5100; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6801: { - GalIrqFire = d & 1; - return; - } - - case 0x6802: { - // coin_count_0_w - return; - } - - case 0x6803: { - GalBackgroundEnable = d & 1; - return; - } - - case 0x6804: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x6806: { - GalFlipScreenX = d & 1; - return; - } - - case 0x6807: { - GalFlipScreenY = d & 1; - return; - } - - case 0x7000: { - // watchdog write - return; - } - - case 0x8000: { - GalSoundLatch = d; - return; - } - - case 0x9000: { - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(0); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall CkongsZ80Read(UINT16 a) -{ - switch (a) { - case 0x7000: - case 0x7001: - case 0x7002: - case 0x7003: { - return ppi8255_r(0, a - 0x7000); - } - - case 0x7800: - case 0x7801: - case 0x7802: - case 0x7803: { - return ppi8255_r(1, a - 0x7800); - } - - case 0xb000: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall CkongsZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x7000: - case 0x7001: - case 0x7002: - case 0x7003: { - ppi8255_w(0, a - 0x7000, d); - return; - } - - case 0x7800: - case 0x7801: - case 0x7802: - case 0x7803: { - ppi8255_w(1, a - 0x7800, d); - return; - } - - case 0xa801: { - GalIrqFire = d & 1; - return; - } - - case 0xa806: { - GalFlipScreenX = d & 1; - return; - } - - case 0xa807: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb000: { - // watchdog write - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall MarsZ80Read(UINT16 a) -{ - if (a >= 0x8100 && a <= 0x810f) { - INT32 Offset = a - 0x8100; - return ppi8255_r(0, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01)); - } - - if (a >= 0x8200 && a <= 0x820f) { - INT32 Offset = a - 0x8200; - return ppi8255_r(1, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01)); - } - - switch (a) { - case 0x7000: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall MarsZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0x8100 && a <= 0x810f) { - INT32 Offset = a - 0x8100; - ppi8255_w(0, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); - return; - } - - if (a >= 0x8200 && a <= 0x820f) { - INT32 Offset = a - 0x8200; - ppi8255_w(1, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); - return; - } - - switch (a) { - case 0x6800: { - // coin_count_1_w - return; - } - - case 0x6801: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x6802: { - GalIrqFire = d & 1; - return; - } - - case 0x6808: { - // coin_count_0_w - return; - } - - case 0x6809: { - GalFlipScreenX = d & 1; - return; - } - - case 0x680b: { - GalFlipScreenY = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Newsin7Z80Read(UINT16 a) -{ - if (a >= 0x8200 && a <= 0x820f) { - INT32 Offset = a - 0x8200; - return ppi8255_r(1, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01)); - } - - if (a >= 0xc100 && a <= 0xc10f) { - INT32 Offset = a - 0xc100; - return ppi8255_r(0, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01)); - } - - switch (a) { - case 0x7000: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall Newsin7Z80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0x8200 && a <= 0x820f) { - INT32 Offset = a - 0x8200; - ppi8255_w(1, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); - return; - } - - if (a >= 0xc100 && a <= 0xc10f) { - INT32 Offset = a - 0xc100; - ppi8255_w(0, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); - return; - } - - switch (a) { - case 0x6800: { - // coin_count_1_w - return; - } - - case 0x6801: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x6802: { - GalIrqFire = d & 1; - return; - } - - case 0x6808: { - // coin_count_0_w - return; - } - - case 0x6809: { - GalFlipScreenX = d & 1; - return; - } - - case 0x680b: { - GalFlipScreenY = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall MrkougarZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0x8100 && a <= 0x810f) { - INT32 Offset = a - 0x8100; - ppi8255_w(0, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); - return; - } - - if (a >= 0x8200 && a <= 0x820f) { - INT32 Offset = a - 0x8200; - ppi8255_w(1, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); - return; - } - - switch (a) { - case 0x6800: { - // coin_count_1_w - return; - } - - case 0x6801: { - GalIrqFire = d & 1; - return; - } - - case 0x6808: { - // coin_count_0_w - return; - } - - case 0x6809: { - GalFlipScreenX = d & 1; - return; - } - - case 0x680b: { - GalFlipScreenY = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall HotshockZ80Read(UINT16 a) -{ - switch (a) { - case 0x8000: { - return GalInput[0] | GalDip[0]; - } - - case 0x8001: { - return GalInput[1] | GalDip[1]; - } - - case 0x8002: { - return GalInput[2] | GalDip[2]; - } - - case 0x8003: { - return GalInput[3] | GalDip[3]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall HotshockZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6000: { - // coin_count_2_w - return; - } - - case 0x6002: { - // coin_count_1_w - return; - } - - case 0x6004: { - GalFlipScreenX = d & 1; - GalFlipScreenY = d & 1; - return; - } - - case 0x6005: { - // coin_count_0_w - return; - } - - case 0x6006: { - GalGfxBank[0] = d & 1; - return; - } - - case 0x6801: { - GalIrqFire = d & 1; - return; - } - - case 0x7000: { - // watchdog write - return; - } - - case 0x8000: { - GalSoundLatch = d; - return; - } - - case 0x9000: { - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(0); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall HotshockSoundZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x20: { - return AY8910Read(0); - } - - case 0x40: { - return AY8910Read(1); - } - } - - bprintf(PRINT_NORMAL, _T("Sound Port Read %x\n"), a); - - return 0; -} - -void __fastcall HotshockSoundZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x10: { - AY8910Write(0, 0, d); - return; - } - - case 0x20: { - AY8910Write(0, 1, d); - return; - } - - case 0x40: { - AY8910Write(1, 1, d); - return; - } - - case 0x80: { - AY8910Write(1, 0, d); - return; - } - } - - bprintf(PRINT_NORMAL, _T("Sound Port Write %x, %x\n"), a, d); -} - -static void CavelonDoBankSwitch() -{ - CavelonBankSwitch = !CavelonBankSwitch; - ZetMapArea(0x0000, 0x1fff, 0, GalZ80Rom1 + ((CavelonBankSwitch) ? 0x4000 : 0x0000)); - ZetMapArea(0x0000, 0x1fff, 2, GalZ80Rom1 + ((CavelonBankSwitch) ? 0x4000 : 0x0000)); -} - -UINT8 __fastcall CavelonZ80Read(UINT16 a) -{ - if (a >= 0x8000) { - CavelonDoBankSwitch(); - UINT32 Offset = a - 0x8000; - UINT8 Result = 0xff; - if (Offset & 0x0100) Result &= ppi8255_r(0, Offset & 3); - if (Offset & 0x0200) Result &= ppi8255_r(1, Offset & 3); - return Result; - } - - switch (a) { - case 0x7000: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall CavelonZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0x8000) { - CavelonDoBankSwitch(); - INT32 Offset = a - 0x8000; - if (Offset & 0x0100) ppi8255_w(0, Offset & 3, d); - if (Offset & 0x0200) ppi8255_w(1, Offset & 3, d); - return; - } - - switch (a) { - case 0x2000: - case 0x3800: - case 0x3801: { - // write in rom area - return; - } - - case 0x6801: { - GalIrqFire = d & 1; - return; - } - - case 0x6802: { - // coin_count_0_w - return; - } - - case 0x6803: { - GalBackgroundEnable = d & 1; - return; - } - - case 0x6804: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x6806: { - GalFlipScreenX = d & 1; - return; - } - - case 0x6807: { - GalFlipScreenY = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall MimonscrZ80Read(UINT16 a) -{ - switch (a) { - case 0x7000: { - // watchdog read - return 0xff; - } - - case 0x8100: - case 0x8101: - case 0x8102: - case 0x8103: { - return ppi8255_r(0, a - 0x8100); - } - - case 0x8200: - case 0x8201: - case 0x8202: - case 0x8203: { - return ppi8255_r(1, a - 0x8200); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall MimonscrZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6800: { - GalGfxBank[0] = d & 1; - return; - } - - case 0x6801: { - GalIrqFire = d & 1; - return; - } - - case 0x6802: { - GalGfxBank[1] = d & 1; - return; - } - - case 0x6803: { - // ??? - return; - } - - case 0x6804: { - GalBackgroundEnable = d & 1; - return; - } - - case 0x6805: { - // ??? - return; - } - - case 0x6806: { - GalFlipScreenX = d & 1; - return; - } - - case 0x6807: { - GalFlipScreenY = d & 1; - return; - } - - case 0x8100: - case 0x8101: - case 0x8102: - case 0x8103: { - ppi8255_w(0, a - 0x8100, d); - return; - } - - case 0x8200: - case 0x8201: - case 0x8202: - case 0x8203: { - ppi8255_w(1, a - 0x8200, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 TheendInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapTheend; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = GalaxianDrawBackground; - GalDrawBulletsFunction = TheendDrawBullets; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.02); - filter_rc_set_src_gain(1, 0.02); - filter_rc_set_src_gain(2, 0.02); - filter_rc_set_src_gain(3, 0.02); - filter_rc_set_src_gain(4, 0.02); - filter_rc_set_src_gain(5, 0.02); - - return nRet; -} - -static UINT8 ScramblePPIReadIN2() -{ - UINT8 Val = (ScrambleProtectionResult >> 7) & 1; - - if (Val) { - return 0x5f - GalInput[2] - GalDip[2]; - } else { - return 0xff - GalInput[2] - GalDip[2]; - } -} - -static UINT8 ScrambleProtectionRead() -{ - return ScrambleProtectionResult; -} - -static void ScrambleProtectionWrite(UINT8 d) -{ - ScrambleProtectionState = (ScrambleProtectionState << 4) | (d & 0x0f); - - switch (ScrambleProtectionState & 0xfff) { - case 0xf09: ScrambleProtectionResult = 0xff; return; - case 0xa49: ScrambleProtectionResult = 0xbf; return; - case 0x319: ScrambleProtectionResult = 0x4f; return; - case 0x5c9: ScrambleProtectionResult = 0x6f; return; - - // scrambles - case 0x246: ScrambleProtectionResult ^= 0x80; return; - case 0xb5f: ScrambleProtectionResult = 0x6f; return; - } -} - -static INT32 ScrambleInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapTheend; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - PPI0PortReadC = ScramblePPIReadIN2; - PPI1PortReadC = ScrambleProtectionRead; - PPI1PortWriteC = ScrambleProtectionWrite; - - return nRet; -} - -static void ExplorerPostLoad() -{ - MapTheend(); - - ZetOpen(0); - ZetSetReadHandler(ExplorerZ80Read); - ZetSetWriteHandler(ExplorerZ80Write); - ZetMapArea(0x5100, 0x51ff, 0, GalSpriteRam); - ZetMapArea(0x5100, 0x51ff, 2, GalSpriteRam); - ZetClose(); -} - -static INT32 ExplorerInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = ExplorerPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - return nRet; -} - -static INT32 AtlantisInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapTheend; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.25); - filter_rc_set_src_gain(1, 0.25); - filter_rc_set_src_gain(2, 0.25); - filter_rc_set_src_gain(3, 0.25); - filter_rc_set_src_gain(4, 0.25); - filter_rc_set_src_gain(5, 0.25); - - return nRet; -} - -static void CkongsPostLoad() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(CkongsZ80Read); - ZetSetWriteHandler(CkongsZ80Write); - ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); - ZetMapArea(0x6000, 0x6fff, 0, GalZ80Ram1); - ZetMapArea(0x6000, 0x6fff, 1, GalZ80Ram1); - ZetMapArea(0x6000, 0x6fff, 2, GalZ80Ram1); - ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); - ZetMapArea(0x9400, 0x97ff, 0, GalVideoRam); - ZetMapArea(0x9400, 0x97ff, 1, GalVideoRam); - ZetMapArea(0x9400, 0x97ff, 2, GalVideoRam); - ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); - ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); - ZetClose(); -} - -static INT32 CkongsInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = CkongsPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - KonamiPPIInit(); - - GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - return nRet; -} - -static void MarsDecrypt() -{ - for (UINT32 i = 0; i < GalZ80Rom1Size; i += 16) { - UINT8 SwapBuffer[16]; - - for (UINT32 j = 0; j < 16; j++) { - INT32 NewOffset = BITSWAP08(j, 7, 6, 5, 4, 2, 0, 3, 1); - SwapBuffer[j] = GalZ80Rom1[i + NewOffset]; - } - memcpy(GalZ80Rom1 + i, SwapBuffer, 16); - } -} - -static void MarsPostLoad() -{ - MarsDecrypt(); - - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(MarsZ80Read); - ZetSetWriteHandler(MarsZ80Write); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); - ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); - ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); - ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); - ZetClose(); -} - -static INT32 MarsInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MarsPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - return nRet; -} - -static INT32 DevilfshInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MarsPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalNumChars = 0x100; - GalNumSprites = 0x40; - CharPlaneOffsets[1] = 0x8000; - SpritePlaneOffsets[1] = 0x8000; - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom + 0x800, GalSprites); - BurnFree(GalTempRom); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.75); - filter_rc_set_src_gain(1, 0.75); - filter_rc_set_src_gain(2, 0.75); - filter_rc_set_src_gain(3, 0.75); - filter_rc_set_src_gain(4, 0.75); - filter_rc_set_src_gain(5, 0.75); - - return nRet; -} - -static void Newsin7PostLoad() -{ - MarsDecrypt(); - - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(Newsin7Z80Read); - ZetSetWriteHandler(Newsin7Z80Write); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); - ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); - ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); - ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); - ZetMapArea(0xa000, 0xafff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0xa000, 0xafff, 2, GalZ80Rom1 + 0x4000); - ZetClose(); -} - -static INT32 Newsin7Init() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = Newsin7PostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalNumChars = 0x100; - GalNumSprites = 0x40; - - INT32 Newsin7PlaneOffsets[3] = {0x10000, 0, 0x8000}; - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x2000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; - GfxDecode(GalNumChars, 3, 8, 8, Newsin7PlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 3, 16, 16, Newsin7PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom + 0x800, GalSprites); - BurnFree(GalTempRom); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalColourDepth = 3; - GalSpriteClipStart = 0; - GalSpriteClipEnd = 246; - - KonamiPPIInit(); - - return nRet; -} - -static void MapMrkougar() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(MarsZ80Read); - ZetSetWriteHandler(MrkougarZ80Write); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); - ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 0, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 1, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 2, GalVideoRam); - ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); - ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); - ZetClose(); -} - -static void MrkougarPostLoad() -{ - MarsDecrypt(); - - MapMrkougar(); -} - -static INT32 MrkougarInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MrkougarPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - INT32 MrkougarPlaneOffsets[2] = {0, 4}; - INT32 MrkougarCharXOffsets[8] = {64, 65, 66, 67, 0, 1, 2, 3}; - INT32 MrkougarCharYOffsets[8] = {0, 8, 16, 24, 32, 40, 48, 56}; - INT32 MrkougarSpriteXOffsets[16] = {64, 65, 66, 67, 0, 1, 2, 3, 192, 193, 194, 195, 128, 129, 130, 131}; - INT32 MrkougarSpriteYOffsets[16] = {0, 8, 16, 24, 32, 40, 48, 56, 256, 264, 272, 280, 288, 296, 304, 312}; - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - GfxDecode(GalNumChars, 2, 8, 8, MrkougarPlaneOffsets, MrkougarCharXOffsets, MrkougarCharYOffsets, 0x80, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, MrkougarPlaneOffsets, MrkougarSpriteXOffsets, MrkougarSpriteYOffsets, 0x200, GalTempRom, GalSprites); - BurnFree(GalTempRom); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - return nRet; -} - -static INT32 MrkougbInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapMrkougar; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - return nRet; -} - -static void HotshockPostLoad() -{ - MapMrkougar(); - - ZetOpen(0); - ZetSetReadHandler(HotshockZ80Read); - ZetSetWriteHandler(HotshockZ80Write); - ZetClose(); - - GalZ80Rom1[0x2ef9] = 0xc9; -} - -static INT32 HotshockInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = HotshockPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - ZetOpen(1); - ZetSetInHandler(HotshockSoundZ80PortRead); - ZetSetOutHandler(HotshockSoundZ80PortWrite); - ZetClose(); - - GalExtendTileInfoFunction = PiscesExtendTileInfo; - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - return nRet; -} - -static void ConquerPostLoad() -{ - MapMrkougar(); - - ZetOpen(0); - ZetSetReadHandler(HotshockZ80Read); - ZetSetWriteHandler(HotshockZ80Write); - ZetClose(); -} - -static INT32 ConquerInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = ConquerPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - ZetOpen(1); - ZetSetInHandler(HotshockSoundZ80PortRead); - ZetSetOutHandler(HotshockSoundZ80PortWrite); - ZetClose(); - - GalExtendTileInfoFunction = PiscesExtendTileInfo; - - return nRet; -} - -static void CavelonPostLoad() -{ - MapTheend(); - - ZetOpen(0); - ZetSetReadHandler(CavelonZ80Read); - ZetSetWriteHandler(CavelonZ80Write); - ZetClose(); -} - -static INT32 CavelonInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = CavelonPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static void MimonscrPostLoad() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(MimonscrZ80Read); - ZetSetWriteHandler(MimonscrZ80Write); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x4000, 0x43ff, 0, GalVideoRam); - ZetMapArea(0x4000, 0x43ff, 1, GalVideoRam); - ZetMapArea(0x4000, 0x43ff, 2, GalVideoRam); - ZetMapArea(0x4400, 0x47ff, 0, GalZ80Ram1); - ZetMapArea(0x4400, 0x47ff, 1, GalZ80Ram1); - ZetMapArea(0x4400, 0x47ff, 2, GalZ80Ram1); - ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); - ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); - ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); - ZetMapArea(0xc000, 0xffff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0xc000, 0xffff, 2, GalZ80Rom1 + 0x4000); - ZetClose(); -} - -static INT32 MimonscrInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MimonscrPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = MimonkeyExtendTileInfo; - GalExtendSpriteInfoFunction = MimonkeyExtendSpriteInfo; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -struct BurnDriver BurnDrvTheend = { - "theend", NULL, NULL, NULL, "1980", - "The End\0", NULL, "Konami", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, TheendRomInfo, TheendRomName, NULL, NULL, TheendInputInfo, TheendDIPInfo, - TheendInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTheends = { - "theends", "theend", NULL, NULL, "1980", - "The End (Stern)\0", NULL, "Konami (Stern license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, TheendsRomInfo, TheendsRomName, NULL, NULL, TheendInputInfo, TheendDIPInfo, - TheendInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScramble = { - "scramble", NULL, NULL, NULL, "1981", - "Scramble\0", NULL, "Konami", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScrambleRomInfo, ScrambleRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, - ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScrambles = { - "scrambles", "scramble", NULL, NULL, "1981", - "Scramble (Stern)\0", NULL, "Konami (Stern license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScramblesRomInfo, ScramblesRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, - ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScramblebf = { - "scramblebf", "scramble", NULL, NULL, "1981", - "Scramble (Karateko, French bootleg)\0", NULL, "Karateko (bootleg)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScramblebfRomInfo, ScramblebfRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, - ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScramblebb = { - "scramblebb", "scramble", NULL, NULL, "1981", - "Scramble (bootleg?)\0", NULL, "bootleg?", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScramblebbRomInfo, ScramblebbRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, - ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvStrfbomb = { - "strfbomb", "scramble", NULL, NULL, "1981", - "Strafe Bomb\0", NULL, "Omni", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, StrfbombRomInfo, StrfbombRomName, NULL, NULL, ScrambleInputInfo, StrfbombDIPInfo, - ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvExplorer = { - "explorer", "scramble", NULL, NULL, "1981", - "Explorer\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ExplorerRomInfo, ExplorerRomName, NULL, NULL, ExplorerInputInfo, ExplorerDIPInfo, - ExplorerInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAtlantis = { - "atlantis", NULL, NULL, NULL, "1981", - "Battle of Atlantis (set 1)\0", NULL, "Comsoft", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, AtlantisRomInfo, AtlantisRomName, NULL, NULL, AtlantisInputInfo, AtlantisDIPInfo, - AtlantisInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAtlantis2 = { - "atlantis2", "atlantis", NULL, NULL, "1981", - "Battle of Atlantis (set 2)\0", NULL, "Comsoft", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, Atlantis2RomInfo, Atlantis2RomName, NULL, NULL, AtlantisInputInfo, AtlantisDIPInfo, - AtlantisInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvCkongs = { - "ckongs", "ckong", NULL, NULL, "1981", - "Crazy Kong (Scramble hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, CkongsRomInfo, CkongsRomName, NULL, NULL, CkongsInputInfo, CkongsDIPInfo, - CkongsInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMars = { - "mars", NULL, NULL, NULL, "1981", - "Mars\0", NULL, "Artic", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, MarsRomInfo, MarsRomName, NULL, NULL, MarsInputInfo, MarsDIPInfo, - MarsInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvDevilfsh = { - "devilfsh", NULL, NULL, NULL, "1982", - "Devil Fish\0", NULL, "Artic", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, DevilfshRomInfo, DevilfshRomName, NULL, NULL, DevilfshInputInfo, DevilfshDIPInfo, - DevilfshInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNewsin7 = { - "newsin7", NULL, NULL, NULL, "1983", - "New Sinbad 7\0", NULL, "ATW USA, Inc.", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, Newsin7RomInfo, Newsin7RomName, NULL, NULL, DevilfshInputInfo, Newsin7DIPInfo, - Newsin7Init, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMrkougar = { - "mrkougar", NULL, NULL, NULL, "1984", - "Mr. Kougar\0", NULL, "ATW", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, MrkougarRomInfo, MrkougarRomName, NULL, NULL, MrkougarInputInfo, MrkougarDIPInfo, - MrkougarInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMrkougar2 = { - "mrkougar2", "mrkougar", NULL, NULL, "1983", - "Mr. Kougar (earlier)\0", NULL, "ATW", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, Mrkougar2RomInfo, Mrkougar2RomName, NULL, NULL, MrkougarInputInfo, MrkougarDIPInfo, - MrkougarInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMrkougb = { - "mrkougb", "mrkougar", NULL, NULL, "1983", - "Mr. Kougar (bootleg set 1)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, MrkougbRomInfo, MrkougbRomName, NULL, NULL, MrkougarInputInfo, MrkougarDIPInfo, - MrkougbInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMrkougb2 = { - "mrkougb2", "mrkougar", NULL, NULL, "1983", - "Mr. Kougar (bootleg set 2)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, Mrkougb2RomInfo, Mrkougb2RomName, NULL, NULL, MrkougarInputInfo, MrkougarDIPInfo, - MrkougbInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHotshock = { - "hotshock", NULL, NULL, NULL, "1982", - "Hot Shocker\0", NULL, "E.G. Felaco (Domino license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, HotshockRomInfo, HotshockRomName, NULL, NULL, HotshockInputInfo, HotshockDIPInfo, - HotshockInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHotshockb = { - "hotshockb", "hotshock", NULL, NULL, "1982", - "Hot Shocker (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, HotshockbRomInfo, HotshockbRomName, NULL, NULL, HotshockInputInfo, HotshockDIPInfo, - HotshockInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriverD BurnDrvConquer = { - "conquer", NULL, NULL, NULL, "1982", - "Conquer\0", "Bad dump", "unknown", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, ConquerRomInfo, ConquerRomName, NULL, NULL, HotshockInputInfo, HotshockDIPInfo, - ConquerInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvCavelon = { - "cavelon", NULL, NULL, NULL, "1983", - "Cavelon\0", NULL, "Jetsoft", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, CavelonRomInfo, CavelonRomName, NULL, NULL, AtlantisInputInfo, CavelonDIPInfo, - CavelonInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMimonscr = { - "mimonscr", "mimonkey", NULL, NULL, "198?", - "Mighty Monkey (bootleg on Scramble hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, MimonscrRomInfo, MimonscrRomName, NULL, NULL, AtlantisInputInfo, MimonkeyDIPInfo, - MimonscrInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Scramble based hardware with one CPU and one AY8910 -static struct BurnRomInfo TriplepRomDesc[] = { - { "triplep.2g", 0x01000, 0xc583a93d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "triplep.2h", 0x01000, 0xc03ddc49, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "triplep.2k", 0x01000, 0xe83ca6b5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "triplep.2l", 0x01000, 0x982cc3b9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "triplep.5f", 0x00800, 0xd51cbd6f, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "triplep.5h", 0x00800, 0xf21c0059, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "tripprom.6e", 0x00020, 0x624f75df, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Triplep) -STD_ROM_FN(Triplep) - -static struct BurnRomInfo KnockoutRomDesc[] = { - { "knockout.2h", 0x01000, 0xeaaa848e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "knockout.2k", 0x01000, 0xbc26d2c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "knockout.2l", 0x01000, 0x02025c10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "knockout.2m", 0x01000, 0xe9abc42b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "triplep.5f", 0x00800, 0xd51cbd6f, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "triplep.5h", 0x00800, 0xf21c0059, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "tripprom.6e", 0x00020, 0x624f75df, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Knockout) -STD_ROM_FN(Knockout) - -static struct BurnRomInfo MarinerRomDesc[] = { - { "tp1.2h", 0x01000, 0xdac1dfd0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tm2.2k", 0x01000, 0xefe7ca28, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tm3.2l", 0x01000, 0x027881a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tm4.2m", 0x01000, 0xa0fde7dc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tm5.2p", 0x01000, 0xd7ebcb8e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "tm8.5f", 0x01000, 0x70ae611f, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "tm9.5h", 0x01000, 0x8e4e999e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "t4.6e", 0x00020, 0xca42b6dd, BRF_GRA | GAL_ROM_PROM }, - { "t6.6p", 0x00100, 0xad208ccc, BRF_GRA | GAL_ROM_PROM }, // Background colour - { "t5.7p", 0x00020, 0x1bd88cff, BRF_GRA | GAL_ROM_PROM }, // Char banking and star placement -}; - -STD_ROM_PICK(Mariner) -STD_ROM_FN(Mariner) - -static struct BurnRomInfo EighthundredfathRomDesc[] = { - { "tu1.2h", 0x01000, 0x5dd3d42f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tm2.2k", 0x01000, 0xefe7ca28, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tm3.2l", 0x01000, 0x027881a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tm4.2m", 0x01000, 0xa0fde7dc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "tu5.2p", 0x01000, 0xf864a8a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "tm8.5f", 0x01000, 0x70ae611f, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "tm9.5h", 0x01000, 0x8e4e999e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "t4.6e", 0x00020, 0xca42b6dd, BRF_GRA | GAL_ROM_PROM }, - { "t6.6p", 0x00100, 0xad208ccc, BRF_GRA | GAL_ROM_PROM }, // Background colour - { "t5.7p", 0x00020, 0x1bd88cff, BRF_GRA | GAL_ROM_PROM }, // Char banking and star placement -}; - -STD_ROM_PICK(Eighthundredfath) -STD_ROM_FN(Eighthundredfath) - -UINT8 __fastcall TriplepZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - // ??? - return 0; - } - - case 0x01: { - return AY8910Read(0); - } - - case 0x02: { - if (ZetPc(-1) == 0x015a) return 0xff; - if (ZetPc(-1) == 0x0886) return 0x05; - return 0; - } - - case 0x03: { - if (ZetPc(-1) == 0x015d) return 0x04; - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall TriplepZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - AY8910Write(0, 1, d); - return; - } - - case 0x01: { - AY8910Write(0, 0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall MarinerZ80Read(UINT16 a) -{ - if (a >= 0x8000) { - if (a == 0xb401) return 0x07; - if (a == 0x9008) return 0x03; - - UINT32 Offset = a - 0x8000; - UINT8 Result = 0xff; - if (Offset & 0x0100) Result &= ppi8255_r(0, Offset & 3); - if (Offset & 0x0200) Result &= ppi8255_r(1, Offset & 3); - return Result; - } - - switch (a) { - case 0x7000: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -static void TriplepPostLoad() -{ - MapTheend(); - - ZetOpen(0); - ZetSetInHandler(TriplepZ80PortRead); - ZetSetOutHandler(TriplepZ80PortWrite); - ZetClose(); -} - -static INT32 TriplepInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = TriplepPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910; - - nRet = GalInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - PPI1PortWriteA = NULL; - PPI1PortWriteB = NULL; - - return nRet; -} - -static void MarinerPostLoad() -{ - GalTempRom = (UINT8*)BurnMalloc(0x1000); - memcpy(GalTempRom, GalZ80Rom1 + 0x4000, 0x1000); - memcpy(GalZ80Rom1 + 0x4800, GalTempRom + 0x0000, 0x800); - memcpy(GalZ80Rom1 + 0x4000, GalTempRom + 0x0800, 0x800); - BurnFree(GalTempRom); - - MapTheend(); - - ZetOpen(0); - ZetSetReadHandler(MarinerZ80Read); - ZetSetInHandler(TriplepZ80PortRead); - ZetSetOutHandler(TriplepZ80PortWrite); - ZetMapArea(0x5800, 0x67ff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0x5800, 0x67ff, 2, GalZ80Rom1 + 0x4000); - ZetClose(); -} - -static INT32 MarinerInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MarinerPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910; - - nRet = GalInit(); - - GalCalcPaletteFunction = MarinerCalcPalette; - GalRenderBackgroundFunction = MarinerDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = MarinerExtendTileInfo; - - KonamiPPIInit(); - PPI1PortWriteA = NULL; - PPI1PortWriteB = NULL; - - return nRet; -} - -struct BurnDriver BurnDrvTriplep = { - "triplep", NULL, NULL, NULL, "1982", - "Triple Punch\0", NULL, "KKI", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, TriplepRomInfo, TriplepRomName, NULL, NULL, AmidarInputInfo, TriplepDIPInfo, - TriplepInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvKnockout = { - "knockout", "triplep", NULL, NULL, "1982", - "Knock Out!!\0", NULL, "KKK", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, KnockoutRomInfo, KnockoutRomName, NULL, NULL, AmidarInputInfo, TriplepDIPInfo, - TriplepInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMariner = { - "mariner", NULL, NULL, NULL, "1981", - "Mariner\0", NULL, "Armenip", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, MarinerRomInfo, MarinerRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, - MarinerInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvEighthundredfath = { - "800fath", "mariner", NULL, NULL, "1981", - "800 Fathoms\0", NULL, "Amenip (US Billiards Inc. license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE |BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, EighthundredfathRomInfo, EighthundredfathRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, - MarinerInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Scorpion hardware - based on Scramble but with a third AY8910 and a speech chip -static struct BurnRomInfo ScorpionRomDesc[] = { - { "1.2d", 0x01000, 0xba1219b4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2.2f", 0x01000, 0xc3909ab6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "3.2g", 0x01000, 0x43261352, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "4.2h", 0x01000, 0xaba2276a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5.2k", 0x01000, 0x952f78f2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "32_a4.7c", 0x01000, 0x361b8a36, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "32_a5.7d", 0x01000, 0xaddecdd4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "32_f5.5f", 0x01000, 0x1e5da9d6, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "32_h5.5h", 0x01000, 0xa57adb0a, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, - - { "32_a3.6e", 0x01000, 0x279ae6f9, BRF_OPT | BRF_SND }, // Speech samples? - { "32_a2.6d", 0x01000, 0x90352dd4, BRF_OPT | BRF_SND }, - { "32_a1.6c", 0x01000, 0x3bf2452d, BRF_OPT | BRF_SND }, -}; - -STD_ROM_PICK(Scorpion) -STD_ROM_FN(Scorpion) - -static struct BurnRomInfo ScorpionaRomDesc[] = { - { "scor_d2.bin", 0x01000, 0xc5b9daeb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scor_e2.bin", 0x01000, 0x82308d05, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scor_g2.bin", 0x01000, 0x756b09cd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scor_h2.bin", 0x01000, 0xa0457b93, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scor_l2.bin", 0x00800, 0x6623da33, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scor_k2.bin", 0x00800, 0x42ec34d8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "32_a4.7c", 0x01000, 0x361b8a36, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "32_a5.7d", 0x01000, 0xaddecdd4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "scor_f5.bin", 0x01000, 0x60180a38, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "32_h5.5h", 0x01000, 0xa57adb0a, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, - - { "scor_a3.bin", 0x01000, 0x04abf178, BRF_OPT | BRF_SND }, // Speech samples? - { "scor_a2.bin", 0x01000, 0x452d6354, BRF_OPT | BRF_SND }, - { "32_a1.6c", 0x01000, 0x3bf2452d, BRF_OPT | BRF_SND }, -}; - -STD_ROM_PICK(Scorpiona) -STD_ROM_FN(Scorpiona) - -static struct BurnRomInfo ScorpionbRomDesc[] = { - { "ic109.2d", 0x01000, 0xf54688c9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic110.2e", 0x01000, 0x91aaaa12, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic111.2g", 0x01000, 0x4c3720da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic112.2h", 0x01000, 0x53e2a983, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ic113.2k", 0x01000, 0xe4ad299a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "32_a4.7c", 0x01000, 0x361b8a36, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ic13.7d", 0x01000, 0xaddecdd4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "ic72.5f", 0x01000, 0x1e5da9d6, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ic73.5h", 0x01000, 0xa57adb0a, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, - - { "ic25.6e", 0x01000, 0x04abf178, BRF_OPT | BRF_SND }, // Speech samples? - { "ic24.6d", 0x01000, 0x90352dd4, BRF_OPT | BRF_SND }, - { "ic23.6c", 0x01000, 0x3bf2452d, BRF_OPT | BRF_SND }, -}; - -STD_ROM_PICK(Scorpionb) -STD_ROM_FN(Scorpionb) - -static struct BurnRomInfo ScorpionmcRomDesc[] = { - { "p1.bin", 0x00800, 0x58818d88, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p2.bin", 0x00800, 0x8bec5f9f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p3.bin", 0x00800, 0x24b7fdff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p4.bin", 0x00800, 0x9082e2f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p5.bin", 0x00800, 0x20387fc0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p6.bin", 0x00800, 0xf66c48e1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p7.bin", 0x00800, 0x931e34c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p8.bin", 0x00800, 0xab5ab61d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p9.bin", 0x01000, 0xb551b974, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "p10.bin", 0x00800, 0xa7bd8d20, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "h.bin", 0x01000, 0x1e5da9d6, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "k.bin", 0x01000, 0xa57adb0a, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331.bpr", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Scorpionmc) -STD_ROM_FN(Scorpionmc) - -static struct BurnRomInfo AracnisRomDesc[] = { - { "00sc.bin", 0x01000, 0xc7e0d6b9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "01sc.bin", 0x01000, 0x03eb27dc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "02sc.bin", 0x01000, 0xf3d49d4f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "03sc.bin", 0x01000, 0x0e741984, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "05sc.bin", 0x01000, 0xf27ee3e4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "06sc.bin", 0x00800, 0xfdfc2c82, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "08sc.1h", 0x01000, 0x1e5da9d6, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "07sc.1k", 0x01000, 0xa57adb0a, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mmi6331-1.6l", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Aracnis) -STD_ROM_FN(Aracnis) - -UINT8 __fastcall ScorpionmcZ80Read(UINT16 a) -{ - switch (a) { - case 0xa000: { - return GalInput[0] | GalDip[0]; - } - - case 0xa800: { - return GalInput[1] | GalDip[1]; - } - - case 0xb001: { - return GalInput[2] | GalDip[2]; - } - - case 0xb002: { - return GalInput[3] | GalDip[3]; - } - - case 0xb800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall ScorpionmcZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa000: - case 0xa001: - case 0xa002: { - GalGfxBank[a - 0xa000] = d; - return; - } - - case 0xa003: { - // coin_count_0_w - return; - } - - case 0xa004: - case 0xa005: - case 0xa006: - case 0xa007: { - GalaxianLfoFreqWrite(a - 0xa004, d); - return; - } - - case 0xa800: - case 0xa801: - case 0xa802: - case 0xa803: - case 0xa804: - case 0xa805: - case 0xa806: - case 0xa807: { - GalaxianSoundWrite(a - 0xa800, d); - return; - } - - case 0xb001: { - GalIrqFire = d & 1; - return; - } - - case 0xb004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall ScorpionSoundZ80Read(UINT16 a) -{ - switch (a) { - case 0x3000: { - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0xff; -} - -UINT8 __fastcall ScorpionSoundZ80PortRead(UINT16 a) -{ - a &= 0xff; - - UINT8 Result = 0xff; - if (a & 0x08) Result &= AY8910Read(2); - if (a & 0x20) Result &= AY8910Read(0); - if (a & 0x80) Result &= AY8910Read(1); - return Result; -} - -void __fastcall ScorpionSoundZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - if (a & 0x04) AY8910Write(2, 0, d); - if (a & 0x08) AY8910Write(2, 1, d); - if (a & 0x10) AY8910Write(0, 0, d); - if (a & 0x20) AY8910Write(0, 1, d); - if (a & 0x40) AY8910Write(1, 0, d); - if (a & 0x80) AY8910Write(1, 1, d); -} - -static UINT8 ScorpionProtectionRead() -{ - UINT16 ParityBits; - UINT8 Parity = 0; - - for (ParityBits = ScrambleProtectionState & 0xce29; ParityBits != 0; ParityBits >>= 1) { - if (ParityBits & 1) Parity++; - } - - return Parity; -} - -static void ScorpionProtectionWrite(UINT8 d) -{ - if (!(d & 0x20)) ScrambleProtectionState = 0x0000; - if (!(d & 0x10)) ScrambleProtectionState = (ScrambleProtectionState << 1) | (~ScorpionProtectionRead() & 1); -} - -static void ScorpionPostLoad() -{ - GalTempRom = (UINT8*)BurnMalloc(0x1000); - memcpy(GalTempRom, GalZ80Rom1 + 0x4000, 0x1000); - memcpy(GalZ80Rom1 + 0x4800, GalTempRom + 0x0000, 0x800); - memcpy(GalZ80Rom1 + 0x4000, GalTempRom + 0x0800, 0x800); - BurnFree(GalTempRom); - - MapTheend(); - - ZetOpen(0); - ZetMapArea(0x5800, 0x67ff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0x5800, 0x67ff, 2, GalZ80Rom1 + 0x4000); - ZetClose(); -} - -static INT32 ScorpionInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = ScorpionPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - ZetOpen(1); - ZetSetReadHandler(ScorpionSoundZ80Read); - ZetSetInHandler(ScorpionSoundZ80PortRead); - ZetSetOutHandler(ScorpionSoundZ80PortWrite); - ZetClose(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = Batman2ExtendTileInfo; - GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; - - KonamiPPIInit(); - PPI1PortReadC = ScorpionProtectionRead; - PPI1PortWriteC = ScorpionProtectionWrite; - - return nRet; -} - -static void ScorpionmcPostLoad() -{ - MapMooncrst(); - - ZetOpen(0); - ZetSetReadHandler(ScorpionmcZ80Read); - ZetSetWriteHandler(ScorpionmcZ80Write); - ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); - ZetMapArea(0x5000, 0x67ff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0x5000, 0x67ff, 2, GalZ80Rom1 + 0x4000); - ZetMapArea(0x9400, 0x97ff, 0, GalVideoRam); - ZetMapArea(0x9400, 0x97ff, 1, GalVideoRam); - ZetMapArea(0x9400, 0x97ff, 2, GalVideoRam); - ZetClose(); -} - -static INT32 ScorpionmcInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = ScorpionmcPostLoad; - - nRet = GalInit(); - - GalExtendTileInfoFunction = Batman2ExtendTileInfo; - GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; - - return nRet; -} - -struct BurnDriver BurnDrvScorpion = { - "scorpion", NULL, NULL, NULL, "1982", - "Scorpion (set 1)\0", "Incomplete Sound", "Zaccaria", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScorpionRomInfo, ScorpionRomName, NULL, NULL, AtlantisInputInfo, ScorpionDIPInfo, - ScorpionInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScorpiona = { - "scorpiona", "scorpion", NULL, NULL, "1982", - "Scorpion (set 2)\0", "Incomplete Sound", "Zaccaria", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScorpionaRomInfo, ScorpionaRomName, NULL, NULL, AtlantisInputInfo, ScorpionDIPInfo, - ScorpionInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScorpionb = { - "scorpionb", "scorpion", NULL, NULL, "1982", - "Scorpion (set 3)\0", "Incomplete Sound", "Zaccaria", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScorpionbRomInfo, ScorpionbRomName, NULL, NULL, AtlantisInputInfo, ScorpionDIPInfo, - ScorpionInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScorpionmc = { - "scorpionmc", "scorpion", NULL, NULL, "19??", - "Scorpion (Moon Cresta hardware)\0", NULL, "Dorneer", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScorpionmcRomInfo, ScorpionmcRomName, NULL, NULL, ScorpionmcInputInfo, ScorpionmcDIPInfo, - ScorpionmcInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAracnis = { - "aracnis", "scorpion", NULL, NULL, "19??", - "Aracnis (bootleg of Scorpion on Moon Cresta hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, AracnisRomInfo, AracnisRomName, NULL, NULL, AracnisInputInfo, AracnisDIPInfo, - ScorpionmcInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// A.D. 2083 hardware - based on Scramble with TMS5100A for speech -static struct BurnRomInfo Ad2083RomDesc[] = { - { "ad0.10o", 0x02000, 0x4d34325a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ad1.9o", 0x02000, 0x0f37134b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ad2.8o", 0x02000, 0xbcfa655f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ad3.7o", 0x02000, 0x60655225, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ad1s.3d", 0x02000, 0x80f39b0f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ad2s.4d", 0x01000, 0x5177fe2b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "ad4.5k", 0x02000, 0x388cdd21, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ad5.3k", 0x02000, 0xf53f3449, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom-am27s19dc.1m", 0x00020, 0x2759aebd, BRF_GRA | GAL_ROM_PROM }, - - { "ad1v.9a", 0x01000, 0x4cb93fff, BRF_OPT | BRF_SND }, // TMS5110A data - { "ad2v.10a", 0x01000, 0x4b530ea7, BRF_OPT | BRF_SND }, // TMS5110A data - { "prom-sn74s188.8a", 0x00020, 0xc58a4f6a, BRF_OPT | BRF_SND }, // TMS5110A data -}; - -STD_ROM_PICK(Ad2083) -STD_ROM_FN(Ad2083) - -UINT8 __fastcall Ad2083Z80Read(UINT16 a) -{ - switch (a) { - case 0x7000: { - // watchdog read - return 0xff; - } - - case 0x8000: { - return GalInput[0] | GalDip[0]; - } - - case 0x8001: { - return GalInput[1] | GalDip[1]; - } - - case 0x8002: { - return GalInput[2] | GalDip[2]; - } - - case 0x8003: { - return GalInput[3] | GalDip[3]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall Ad2083Z80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6004: { - GalFlipScreenX = d & 1; - GalFlipScreenY = d & 1; - return; - } - - case 0x6800: { - // coin_counter_2_w - return; - } - - case 0x6801: { - GalIrqFire = d & 1; - return; - } - - case 0x6802: { - // coin_counter_0_w - return; - } - - case 0x6803: { - GalBackgroundBlue = d & 1; - return; - } - - case 0x6805: { - // coin_counter_1_w - return; - } - - case 0x6806: { - GalBackgroundRed = d & 1; - return; - } - - case 0x6807: { - GalBackgroundGreen = d & 1; - return; - } - - case 0x8000: { - GalSoundLatch = d; - return; - } - - case 0x9000: { - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(0); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static void Ad2083PostLoad() -{ - UINT8 c; - - for (UINT32 i = 0; i < GalZ80Rom1Size; i++) { - c = GalZ80Rom1[i] ^ 0x35; - c = BITSWAP08(c, 6, 2, 5, 1, 7, 3, 4, 0); - GalZ80Rom1[i] = c; - } - - MapTheend(); - - ZetOpen(0); - ZetSetReadHandler(Ad2083Z80Read); - ZetSetWriteHandler(Ad2083Z80Write); - ZetMapArea(0xa000, 0xdfff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0xa000, 0xdfff, 2, GalZ80Rom1 + 0x4000); - ZetMapArea(0xe800, 0xebff, 0, GalZ80Ram1 + 0x800); - ZetMapArea(0xe800, 0xebff, 1, GalZ80Ram1 + 0x800); - ZetMapArea(0xe800, 0xebff, 2, GalZ80Ram1 + 0x800); - ZetClose(); -} - -static INT32 Ad2083Init() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = Ad2083PostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_AD2083AY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - ZetOpen(1); - ZetSetInHandler(HotshockSoundZ80PortRead); - ZetSetOutHandler(HotshockSoundZ80PortWrite); - ZetClose(); - - GalRenderBackgroundFunction = TurtlesDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = Ad2083ExtendTileInfo; - GalExtendSpriteInfoFunction = Ad2083ExtendSpriteInfo; - - return nRet; -} - -struct BurnDriver BurnDrvAd2083 = { - "ad2083", NULL, NULL, NULL, "1983", - "A.D. 2083\0", "Incomplete Sound", "Midcoin", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, Ad2083RomInfo, Ad2083RomName, NULL, NULL, Ad2083InputInfo, Ad2083DIPInfo, - Ad2083Init, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// SF-X hardware - based on Scramble with extra Z80 and 8255 driving a DAC based sample player -static struct BurnRomInfo SfxRomDesc[] = { - { "sfx_b-0.1j", 0x02000, 0xe5bc6952, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "1.1c", 0x01000, 0x1b3c48e7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "22.1d", 0x01000, 0xed44950d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "23.1e", 0x01000, 0xf44a3ca0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "27.1a", 0x01000, 0xed86839f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "24.1g", 0x01000, 0xe6d7dc74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "5.1h", 0x01000, 0xd1e8d390, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "5.5j", 0x01000, 0x59028fb6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "6.6j", 0x01000, 0x5427670f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "1.1j", 0x01000, 0x2f172c58, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "2.2j", 0x01000, 0xa6ad2f6b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "3.3j", 0x01000, 0xfa1274fa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "4.4j", 0x01000, 0x1cd33f3a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "10.3h", 0x01000, 0xb833a15b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "11.4h", 0x01000, 0xcbd76ec2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - - { "28.5a", 0x01000, 0xd73a8252, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "29.5c", 0x01000, 0x1401ccf2, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6331.9g", 0x00020, 0xca1d9ccd, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Sfx) -STD_ROM_FN(Sfx) - -static struct BurnRomInfo SkelagonRomDesc[] = { - { "31.bin", 0x01000, 0xae6f8647, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "32.bin", 0x01000, 0xa28c5838, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "33.bin", 0x01000, 0x32f7e99c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "37.bin", 0x01000, 0x47f68a31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "24.bin", 0x01000, 0xe6d7dc74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "35.bin", 0x01000, 0x5b2a0158, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "36.bin", 0x01000, 0xf53ead29, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "5.5j", 0x01000, 0x59028fb6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "6.6j", 0x01000, 0x5427670f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "1.1j", 0x01000, 0x2f172c58, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "2.2j", 0x01000, 0xa6ad2f6b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "3.3j", 0x01000, 0xfa1274fa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "4.4j", 0x01000, 0x1cd33f3a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "10.bin", 0x01000, 0x2c719de2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "8.bin", 0x01000, 0x350379dd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - - { "38.bin", 0x01000, 0x2fffa8b1, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "39.bin", 0x01000, 0xa854b5de, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6331.9g", 0x00020, 0xca1d9ccd, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Skelagon) -STD_ROM_FN(Skelagon) - -static struct BurnRomInfo MonsterzRomDesc[] = { - { "b-1e.a1", 0x01000, 0x97886542, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b-2e.c1", 0x01000, 0x184ffcb4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b-3e.d1", 0x01000, 0xb7b10ac7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b-4e.e1", 0x01000, 0xfb02c736, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b-5e.g1", 0x01000, 0xb2788ab9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b-6e.h1", 0x01000, 0x77d7aa8d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "a-1e.k1", 0x01000, 0xb88ba44e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "a-2.k2", 0x01000, 0x8913c94e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "a-3e.k3", 0x01000, 0xa8fa5095, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "a-4.k4", 0x01000, 0x93f81317, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "a-5e.k5", 0x01000, 0xb5bcdb4e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "a-6.k6", 0x01000, 0x24832b2e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "a-7e.k7", 0x01000, 0x20ebea81, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "a-8.k8", 0x01000, 0xb833a15b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - { "a-9.k9", 0x01000, 0xcbd76ec2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, - - { "b-7e.a5", 0x01000, 0xddd4158d, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "b-8e.c5", 0x01000, 0xb1331b4c, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom.g9", 0x00020, 0xb7ea00d7, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Monsterz) -STD_ROM_FN(Monsterz) - -void __fastcall SfxZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0x8000) { - INT32 Offset = a - 0x8000; - if (Offset & 0x0100) ppi8255_w(0, Offset & 3, d); - if (Offset & 0x0200) ppi8255_w(1, Offset & 3, d); - return; - } - - switch (a) { - case 0x6801: { - GalIrqFire = d & 1; - return; - } - - case 0x6802: { - // coin_count_0_w - return; - } - - case 0x6800: { - GalBackgroundRed = d & 1; - return; - } - - case 0x6803: { - GalBackgroundBlue = d & 1; - return; - } - - case 0x6804: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x6805: { - GalBackgroundGreen = d & 1; - return; - } - - case 0x6806: { - GalFlipScreenX = d & 1; - return; - } - - case 0x6807: { - GalFlipScreenY = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall SfxSampleZ80Read(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #3 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall SfxSampleZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #3 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall SfxSampleZ80PortRead(UINT16 a) -{ - a &= 0xff; - - UINT8 Result = 0xff; - if (a & 0x04) Result &= ppi8255_r(2, a & 3); - return Result; -} - -void __fastcall SfxSampleZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - if (a & 0x04) ppi8255_w(2, a & 3, d); - if (a & 0x10) DACSignedWrite(0, d); -} - -static UINT8 SfxSoundLatch2Read() -{ - return GalSoundLatch2; -} - -static void SfxPostLoad() -{ - MapTheend(); - - ZetOpen(0); - ZetSetWriteHandler(SfxZ80Write); - ZetMapArea(0x7000, 0x7fff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0x7000, 0x7fff, 2, GalZ80Rom1 + 0x4000); - ZetMapArea(0xc000, 0xefff, 0, GalZ80Rom1 + 0x5000); - ZetMapArea(0xc000, 0xefff, 2, GalZ80Rom1 + 0x5000); - ZetClose(); - - GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); - memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); - memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x1000); - memcpy(GalZ80Rom1 + 0x7000, GalTempRom + 0x1000, 0x1000); - memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x6000); - BurnFree(GalTempRom); - - ZetOpen(2); - ZetSetReadHandler(SfxSampleZ80Read); - ZetSetWriteHandler(SfxSampleZ80Write); - ZetSetInHandler(SfxSampleZ80PortRead); - ZetSetOutHandler(SfxSampleZ80PortWrite); - ZetMapArea(0x0000, GalZ80Rom3Size - 1, 0, GalZ80Rom3); - ZetMapArea(0x0000, GalZ80Rom3Size - 1, 2, GalZ80Rom3); - ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram3); - ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram3); - ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram3); - ZetClose(); - - nGalCyclesTotal[2] = (14318000 / 8) / 60; -} - -static INT32 SfxInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = SfxPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = UpperExtendTileInfo; - - ppi8255_init(3); - PPI0PortReadA = KonamiPPIReadIN0; - PPI0PortReadB = KonamiPPIReadIN1; - PPI0PortReadC = KonamiPPIReadIN2; - PPI1PortReadC = KonamiPPIReadIN3; - PPI1PortWriteA = KonamiSoundLatchWrite; - PPI1PortWriteB = KonamiSoundControlWrite; - PPI2PortReadA = SfxSoundLatch2Read; - - SfxTilemap = 1; - GalOrientationFlipX = 1; - - return nRet; -} - -static void SkelagonPostLoad() -{ - MapTheend(); - - ZetOpen(0); - ZetSetWriteHandler(SfxZ80Write); - ZetMapArea(0x7000, 0x7fff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0x7000, 0x7fff, 2, GalZ80Rom1 + 0x4000); - ZetMapArea(0xc000, 0xefff, 0, GalZ80Rom1 + 0x5000); - ZetMapArea(0xc000, 0xefff, 2, GalZ80Rom1 + 0x5000); - ZetClose(); - - GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); - memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); - memset(GalZ80Rom1, 0xff, 0x1000); - memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x0000, 0x7000); - BurnFree(GalTempRom); - - ZetOpen(2); - ZetSetReadHandler(SfxSampleZ80Read); - ZetSetWriteHandler(SfxSampleZ80Write); - ZetSetInHandler(SfxSampleZ80PortRead); - ZetSetOutHandler(SfxSampleZ80PortWrite); - ZetMapArea(0x0000, GalZ80Rom3Size - 1, 0, GalZ80Rom3); - ZetMapArea(0x0000, GalZ80Rom3Size - 1, 2, GalZ80Rom3); - ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram3); - ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram3); - ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram3); - ZetClose(); - - nGalCyclesTotal[2] = (14318000 / 8) / 60; -} - -static INT32 SkelagonInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = SkelagonPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC; - GalZ80Rom1Size = 0x1000; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = UpperExtendTileInfo; - - ppi8255_init(3); - PPI0PortReadA = KonamiPPIReadIN0; - PPI0PortReadB = KonamiPPIReadIN1; - PPI0PortReadC = KonamiPPIReadIN2; - PPI1PortReadC = KonamiPPIReadIN3; - PPI1PortWriteA = KonamiSoundLatchWrite; - PPI1PortWriteB = KonamiSoundControlWrite; - PPI2PortReadA = SfxSoundLatch2Read; - - SfxTilemap = 1; - GalOrientationFlipX = 1; - - return nRet; -} - -static void MonsterzPostLoad() -{ - MapTheend(); - - ZetOpen(0); - ZetSetWriteHandler(SfxZ80Write); - ZetMapArea(0xc000, 0xdfff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0xc000, 0xdfff, 2, GalZ80Rom1 + 0x4000); - ZetClose(); - - ZetOpen(2); - ZetSetReadHandler(SfxSampleZ80Read); - ZetSetWriteHandler(SfxSampleZ80Write); - ZetSetInHandler(SfxSampleZ80PortRead); - ZetSetOutHandler(SfxSampleZ80PortWrite); - ZetMapArea(0x0000, GalZ80Rom3Size - 1, 0, GalZ80Rom3); - ZetMapArea(0x0000, GalZ80Rom3Size - 1, 2, GalZ80Rom3); - ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram3); - ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram3); - ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram3); - ZetClose(); - - GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom3Size); - memcpy(GalTempRom, GalZ80Rom3, GalZ80Rom3Size); - memcpy(GalZ80Rom3 + 0x0000, GalTempRom + 0x0000, 0x3000); - memset(GalZ80Rom3 + 0x3000, 0xff, 0x1000); - memcpy(GalZ80Rom3 + 0x4000, GalTempRom + 0x3000, 0x2000); - BurnFree(GalTempRom); - - nGalCyclesTotal[2] = (14318000 / 8) / 60; -} - -static INT32 MonsterzInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MonsterzPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC; - GalZ80Rom3Size = 0x1000; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = UpperExtendTileInfo; - - ppi8255_init(3); - PPI0PortReadA = KonamiPPIReadIN0; - PPI0PortReadB = KonamiPPIReadIN1; - PPI0PortReadC = KonamiPPIReadIN2; - PPI1PortReadC = KonamiPPIReadIN3; - PPI1PortWriteA = KonamiSoundLatchWrite; - PPI1PortWriteB = KonamiSoundControlWrite; - PPI2PortReadA = SfxSoundLatch2Read; - - SfxTilemap = 1; - GalOrientationFlipX = 1; - - return nRet; -} - -struct BurnDriver BurnDrvSfx = { - "sfx", NULL, NULL, NULL, "1983", - "SF-X\0", "Incomplete Sound", "Nichibutsu", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, SfxRomInfo, SfxRomName, NULL, NULL, SfxInputInfo, SfxDIPInfo, - SfxInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -struct BurnDriverD BurnDrvSkelagon = { - "skelagon", "sfx", NULL, NULL, "1983", - "Skelagon\0", "Bad Dump", "Nichibutsu USA", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_CLONE, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, SkelagonRomInfo, SkelagonRomName, NULL, NULL, SfxInputInfo, SfxDIPInfo, - SkelagonInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -struct BurnDriverD BurnDrvMonsterz = { - "monsterz", NULL, NULL, NULL, "19??", - "Monster Zero\0", "Protected", "Nihon", "Galaxian", - NULL, NULL, NULL, NULL, - 0, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, MonsterzRomInfo, MonsterzRomName, NULL, NULL, SfxInputInfo, SfxDIPInfo, - MonsterzInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -// Super Cobra based hardware -static struct BurnRomInfo ScobraRomDesc[] = { - { "epr1265.2c", 0x01000, 0xa0744b3f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e", 0x01000, 0x8e7245cd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr1267.2f", 0x01000, 0x47a4e6fb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h", 0x01000, 0x7244f21c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr1269.2j", 0x01000, 0xe1f8a801, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2l", 0x01000, 0xd52affde, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "5c", 0x00800, 0xd4346959, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "5d", 0x00800, 0xcc025d95, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "5e", 0x00800, 0x1628c53f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "epr1274.5h", 0x00800, 0x64d113b4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr1273.5f", 0x00800, 0xa96316d3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM },}; - -STD_ROM_PICK(Scobra) -STD_ROM_FN(Scobra) - -static struct BurnRomInfo ScobrasRomDesc[] = { - { "scobra2c.bin", 0x01000, 0xe15ade38, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2e.bin", 0x01000, 0xa270e44d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2f.bin", 0x01000, 0xbdd70346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2h.bin", 0x01000, 0xdca5ec31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2j.bin", 0x01000, 0x0d8f6b6e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2l.bin", 0x01000, 0x6f80f3a9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "epr1275.5c", 0x00800, 0xdeeb0dd3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr1276.5d", 0x00800, 0x872c1a74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr1277.5e", 0x00800, 0xccd7a110, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "epr1274.5h", 0x00800, 0x64d113b4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr1273.5f", 0x00800, 0xa96316d3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Scobras) -STD_ROM_FN(Scobras) - -static struct BurnRomInfo ScobraseRomDesc[] = { - { "epr1265.2c", 0x01000, 0xa0744b3f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr1266.2e", 0x01000, 0x65306279, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr1267.2f", 0x01000, 0x47a4e6fb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr1268.2h", 0x01000, 0x53eecaf2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr1269.2j", 0x01000, 0xe1f8a801, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "epr1270.2l", 0x01000, 0xf7709710, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "epr1275.5c", 0x00800, 0xdeeb0dd3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr1276.5d", 0x00800, 0x872c1a74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr1277.5e", 0x00800, 0xccd7a110, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "epr1274.5h", 0x00800, 0x64d113b4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr1273.5f", 0x00800, 0xa96316d3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "pr1278.6e", 0x00020, 0xfd35c561, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Scobrase) -STD_ROM_FN(Scobrase) - -static struct BurnRomInfo ScobrabRomDesc[] = { - { "vid_2c.bin", 0x00800, 0xaeddf391, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "vid_2e.bin", 0x00800, 0x72b57eb7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2e.bin", 0x01000, 0xa270e44d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2f.bin", 0x01000, 0xbdd70346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2h.bin", 0x01000, 0xdca5ec31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2j.bin", 0x01000, 0x0d8f6b6e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2l.bin", 0x01000, 0x6f80f3a9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "epr1275.5c", 0x00800, 0xdeeb0dd3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr1276.5d", 0x00800, 0x872c1a74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr1277.5e", 0x00800, 0xccd7a110, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "epr1274.5h", 0x00800, 0x64d113b4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr1273.5f", 0x00800, 0xa96316d3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Scobrab) -STD_ROM_FN(Scobrab) - -static struct BurnRomInfo SuprheliRomDesc[] = { - { "1.2c", 0x01000, 0xb25141d8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2e.bin", 0x01000, 0xa270e44d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2f.bin", 0x01000, 0xbdd70346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2h.bin", 0x01000, 0xdca5ec31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "scobra2j.bin", 0x01000, 0x0d8f6b6e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "6.2l", 0x01000, 0x10a474d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "epr1275.5c", 0x00800, 0xdeeb0dd3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "epr1276.5d", 0x00800, 0x872c1a74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "9.9d", 0x00800, 0x2b69b8f3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "epr1274.5h", 0x00800, 0x64d113b4, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "epr1273.5f", 0x00800, 0xa96316d3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "k.6e", 0x00020, 0xfd35c561, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Suprheli) -STD_ROM_FN(Suprheli) - -static struct BurnRomInfo LosttombRomDesc[] = { - { "2c", 0x01000, 0xd6176d2c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e", 0x01000, 0xa5f55f4a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2f", 0x01000, 0x0169fa3c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h-easy", 0x01000, 0x054481b6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j", 0x01000, 0x249ee040, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2l", 0x01000, 0xc7d2e608, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2m", 0x01000, 0xbc4bc5b1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "5c", 0x00800, 0xb899be2a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "5d", 0x00800, 0x6907af31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5f", 0x00800, 0x61f137e7, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h", 0x00800, 0x5581de5f, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "ltprom", 0x00020, 0x1108b816, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Losttomb) -STD_ROM_FN(Losttomb) - -static struct BurnRomInfo LosttombhRomDesc[] = { - { "2c", 0x01000, 0xd6176d2c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e", 0x01000, 0xa5f55f4a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2f", 0x01000, 0x0169fa3c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "lthard", 0x01000, 0xe32cbf0e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j", 0x01000, 0x249ee040, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2l", 0x01000, 0xc7d2e608, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2m", 0x01000, 0xbc4bc5b1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "5c", 0x00800, 0xb899be2a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "5d", 0x00800, 0x6907af31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5f", 0x00800, 0x61f137e7, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h", 0x00800, 0x5581de5f, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "ltprom", 0x00020, 0x1108b816, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Losttombh) -STD_ROM_FN(Losttombh) - -static struct BurnRomInfo ArmorcarRomDesc[] = { - { "cpu.2c", 0x01000, 0x0d7bfdfb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "cpu.2e", 0x01000, 0x76463213, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "cpu.2f", 0x01000, 0x2cc6d5f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "cpu.2h", 0x01000, 0x61278dbb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "cpu.2j", 0x01000, 0xfb158d8c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "sound.5c", 0x00800, 0x54ee7753, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "sound.5d", 0x00800, 0x5218fec0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "cpu.5f", 0x00800, 0x8a3da4d1, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "cpu.5h", 0x00800, 0x85bdb113, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Armorcar) -STD_ROM_FN(Armorcar) - -static struct BurnRomInfo Armorcar2RomDesc[] = { - { "2c", 0x01000, 0xe393bd2f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e", 0x01000, 0xb7d443af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2g", 0x01000, 0xe67380a4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h", 0x01000, 0x72af7b37, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j", 0x01000, 0xe6b0dd7f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "sound.5c", 0x00800, 0x54ee7753, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "sound.5d", 0x00800, 0x5218fec0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "cpu.5f", 0x00800, 0x8a3da4d1, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "cpu.5h", 0x00800, 0x85bdb113, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Armorcar2) -STD_ROM_FN(Armorcar2) - -static struct BurnRomInfo TazmaniaRomDesc[] = { - { "2c.cpu", 0x01000, 0x932c5a06, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e.cpu", 0x01000, 0xef17ce65, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2f.cpu", 0x01000, 0x43c7c39d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h.cpu", 0x01000, 0xbe829694, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j.cpu", 0x01000, 0x6e197271, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2k.cpu", 0x01000, 0xa1eb453b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "rom0.snd", 0x00800, 0xb8d741f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5f.cpu", 0x00800, 0x2c5b612b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h.cpu", 0x00800, 0x3f5ff3ac, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "colr6f.cpu", 0x00020, 0xfce333c7, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Tazmania) -STD_ROM_FN(Tazmania) - -static struct BurnRomInfo Tazmani2RomDesc[] = { - { "2ck.cpu", 0x01000, 0xbf0492bf, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2ek.cpu", 0x01000, 0x6636c4d0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2fk.cpu", 0x01000, 0xce59a57b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2hk.cpu", 0x01000, 0x8bda3380, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2jk.cpu", 0x01000, 0xa4095e35, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2kk.cpu", 0x01000, 0xf308ca36, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "rom0.snd", 0x00800, 0xb8d741f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5f.cpu", 0x00800, 0x2c5b612b, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h.cpu", 0x00800, 0x3f5ff3ac, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "colr6f.cpu", 0x00020, 0xfce333c7, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Tazmani2) -STD_ROM_FN(Tazmani2) - -static struct BurnRomInfo AnteaterRomDesc[] = { - { "ra1-2c", 0x01000, 0x58bc9393, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ra1-2e", 0x01000, 0x574fc6f6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ra1-2f", 0x01000, 0x2f7c1fe5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ra1-2h", 0x01000, 0xae8a5da3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ra4-5c", 0x00800, 0x87300b4f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ra4-5d", 0x00800, 0xaf4e5ffe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "ra6-5f", 0x00800, 0x4c3f8a08, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ra6-5h", 0x00800, 0xb30c7c9f, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "colr6f.cpu", 0x00020, 0xfce333c7, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Anteater) -STD_ROM_FN(Anteater) - -static struct BurnRomInfo AnteatergRomDesc[] = { - { "prg_2.bin", 0x02000, 0x2ba793a8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "prg_1.bin", 0x02000, 0x7a798af5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ra4-5c", 0x00800, 0x87300b4f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ra4-5d", 0x00800, 0xaf4e5ffe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "gfx_1.bin", 0x00800, 0x1e2824b1, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "gfx_2.bin", 0x00800, 0x784319b3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "colr6f.cpu", 0x00020, 0xfce333c7, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Anteaterg) -STD_ROM_FN(Anteaterg) - -static struct BurnRomInfo AnteaterukRomDesc[] = { - { "ant1.bin", 0x02000, 0x69debc90, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ant2.bin", 0x02000, 0xab352805, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ra4-5c", 0x00800, 0x87300b4f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ra4-5d", 0x00800, 0xaf4e5ffe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "gfx_1.bin", 0x00800, 0x1e2824b1, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "gfx_2.bin", 0x00800, 0x784319b3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "colr6f.cpu", 0x00020, 0xfce333c7, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Anteateruk) -STD_ROM_FN(Anteateruk) - -static struct BurnRomInfo SpdcoinRomDesc[] = { - { "spdcoin.2c", 0x01000, 0x65cf1e49, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "spdcoin.2e", 0x01000, 0x1ee59232, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "spdcoin.5c", 0x00800, 0xb4cf64b7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "spdcoin.5d", 0x00800, 0x92304df0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "spdcoin.5f", 0x00800, 0xdd5f1dbc, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "spdcoin.5h", 0x00800, 0xab1fe81b, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "spdcoin.clr", 0x00020, 0x1a2ccc56, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Spdcoin) -STD_ROM_FN(Spdcoin) - -static struct BurnRomInfo SuperbonRomDesc[] = { - { "2d.cpu", 0x01000, 0x60c0ba18, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e.cpu", 0x01000, 0xddcf44bf, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2f.cpu", 0x01000, 0xbb66c2d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h.cpu", 0x01000, 0x74f4f04d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j.cpu", 0x01000, 0x78effb08, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2l.cpu", 0x01000, 0xe9dcecbd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2m.cpu", 0x01000, 0x3ed0337e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "5c", 0x00800, 0xb899be2a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "5d.snd", 0x00800, 0x80640a04, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5f.cpu", 0x00800, 0x5b9d4686, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h.cpu", 0x00800, 0x58c29927, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Superbon) -STD_ROM_FN(Superbon) - -static struct BurnRomInfo CalipsoRomDesc[] = { - { "calipso.2c", 0x01000, 0x0fcb703c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "calipso.2e", 0x01000, 0xc6622f14, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "calipso.2f", 0x01000, 0x7bacbaba, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "calipso.2h", 0x01000, 0xa3a8111b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "calipso.2j", 0x01000, 0xfcbd7b9e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "calipso.2l", 0x01000, 0xf7630cab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "calipso.5c", 0x00800, 0x9cbc65ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "calipso.5d", 0x00800, 0xa225ee3b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "calipso.5f", 0x02000, 0xfd4252e9, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "calipso.5h", 0x02000, 0x1663a73a, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "calipso.clr", 0x00020, 0x01165832, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Calipso) -STD_ROM_FN(Calipso) - -static struct BurnRomInfo MoonwarRomDesc[] = { - { "mw2.2c", 0x01000, 0x7c11b4d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mw2.2e", 0x01000, 0x1b6362be, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mw2.2f", 0x01000, 0x4fd8ba4b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mw2.2h", 0x01000, 0x56879f0d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mw2.5c", 0x00800, 0xc26231eb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "mw2.5d", 0x00800, 0xbb48a646, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "mw2.5f", 0x00800, 0xc5fa1aa0, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mw2.5h", 0x00800, 0xa6ccc652, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mw2.clr", 0x00020, 0x99614c6c, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Moonwar) -STD_ROM_FN(Moonwar) - -static struct BurnRomInfo MoonwaraRomDesc[] = { - { "2c", 0x01000, 0xbc20b734, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e", 0x01000, 0xdb6ffec2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2f", 0x01000, 0x378931b8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h", 0x01000, 0x031dbc2c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mw2.5c", 0x00800, 0xc26231eb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "mw2.5d", 0x00800, 0xbb48a646, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "mw2.5f", 0x00800, 0xc5fa1aa0, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mw2.5h", 0x00800, 0xa6ccc652, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "moonwara.clr", 0x00020, 0xf58d4f58, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Moonwara) -STD_ROM_FN(Moonwara) - -static struct BurnRomInfo StratgyxRomDesc[] = { - { "2c_1.bin", 0x01000, 0xeec01237, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e_2.bin", 0x01000, 0x926cb2d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2f_3.bin", 0x01000, 0x849e2504, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h_4.bin", 0x01000, 0x8a64069b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j_5.bin", 0x01000, 0x78b9b898, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2l_6.bin", 0x01000, 0x20bae414, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "s1.bin", 0x01000, 0x713a5db8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "s2.bin", 0x01000, 0x46079411, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5f_c2.bin", 0x00800, 0x7121b679, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h_c1.bin", 0x00800, 0xd105ad91, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "strategy.6e", 0x00020, 0x51a629e1, BRF_GRA | GAL_ROM_PROM }, - { "strategy.10k", 0x00020, 0xd95c0318, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Stratgyx) -STD_ROM_FN(Stratgyx) - -static struct BurnRomInfo StratgysRomDesc[] = { - { "2c.cpu", 0x01000, 0xf2aaaf2b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2e.cpu", 0x01000, 0x5873fdc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2f.cpu", 0x01000, 0x532d604f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h.cpu", 0x01000, 0x82b1d95e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j.cpu", 0x01000, 0x66e84cde, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2l.cpu", 0x01000, 0x62b032d0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "s1.bin", 0x01000, 0x713a5db8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "s2.bin", 0x01000, 0x46079411, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5f.cpu", 0x00800, 0xf4aa5ddd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h.cpu", 0x00800, 0x548e4635, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "strategy.6e", 0x00020, 0x51a629e1, BRF_GRA | GAL_ROM_PROM }, - { "strategy.10k", 0x00020, 0xd95c0318, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Stratgys) -STD_ROM_FN(Stratgys) - -static struct BurnRomInfo StrongxRomDesc[] = { - { "strongx.2d", 0x01000, 0xc2f7268c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "strongx.2e", 0x01000, 0x91059422, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2f_3.bin", 0x01000, 0x849e2504, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2h_4.bin", 0x01000, 0x8a64069b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2j_5.bin", 0x01000, 0x78b9b898, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "2l_6.bin", 0x01000, 0x20bae414, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "s1.bin", 0x01000, 0x713a5db8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "s2.bin", 0x01000, 0x46079411, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "5f_c2.bin", 0x00800, 0x7121b679, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h_c1.bin", 0x00800, 0xd105ad91, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "strategy.6e", 0x00020, 0x51a629e1, BRF_GRA | GAL_ROM_PROM }, - { "strategy.10k", 0x00020, 0xd95c0318, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Strongx) -STD_ROM_FN(Strongx) - -static struct BurnRomInfo DarkplntRomDesc[] = { - { "drkplt2c.dat", 0x01000, 0x5a0ca559, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "drkplt2e.dat", 0x01000, 0x52e2117d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "drkplt2g.dat", 0x01000, 0x4093219c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "drkplt2j.dat", 0x01000, 0xb974c78d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "drkplt2k.dat", 0x01000, 0x71a37385, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "drkplt2l.dat", 0x01000, 0x5ad25154, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "drkplt2m.dat", 0x01000, 0x8d2f0122, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "drkplt2p.dat", 0x01000, 0x2d66253b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "5c.snd", 0x01000, 0x672b9454, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "drkplt5f.dat", 0x00800, 0x2af0ee66, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "drkplt5h.dat", 0x00800, 0x66ef3225, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6e.cpu", 0x00020, 0x86b6e124, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Darkplnt) -STD_ROM_FN(Darkplnt) - -static struct BurnRomInfo RescueRomDesc[] = { - { "rb15acpu.bin", 0x01000, 0xd7e654ba, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rb15bcpu.bin", 0x01000, 0xa93ea158, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rb15ccpu.bin", 0x01000, 0x058cd3d0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rb15dcpu.bin", 0x01000, 0xd6505742, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rb15ecpu.bin", 0x01000, 0x604df3a4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "rb15csnd.bin", 0x00800, 0x8b24bf17, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "rb15dsnd.bin", 0x00800, 0xd96e4fb3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "rb15fcpu.bin", 0x00800, 0x4489d20c, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rb15hcpu.bin", 0x00800, 0x5512c547, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "rescue.clr", 0x00020, 0x40c6bcbd, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Rescue) -STD_ROM_FN(Rescue) - -static struct BurnRomInfo AponowRomDesc[] = { - { "aponow01.rom", 0x01000, 0x33011579, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "aponow02.rom", 0x01000, 0xd477573e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "aponow03.rom", 0x01000, 0x46c41898, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rb15dcpu.bin", 0x01000, 0xd6505742, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "rb15ecpu.bin", 0x01000, 0x604df3a4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "rb15csnd.bin", 0x00800, 0x8b24bf17, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "rb15dsnd.bin", 0x00800, 0xd96e4fb3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "rb15fcpu.bin", 0x00800, 0x4489d20c, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rb15hcpu.bin", 0x00800, 0x5512c547, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "rescue.clr", 0x00020, 0x40c6bcbd, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Aponow) -STD_ROM_FN(Aponow) - -static struct BurnRomInfo MinefldRomDesc[] = { - { "ma22c", 0x01000, 0x1367a035, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ma22e", 0x01000, 0x68946d21, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ma22f", 0x01000, 0x7663aee5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ma22h", 0x01000, 0x9787475d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ma22j", 0x01000, 0x2ceceb54, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "ma22l", 0x01000, 0x85138fc9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "ma15c", 0x00800, 0x8bef736b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "ma15d", 0x00800, 0xf67b3f97, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "ma15f", 0x00800, 0x9f703006, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "ma15h", 0x00800, 0xed0dccb1, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "minefld.clr", 0x00020, 0x1877368e, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Minefld) -STD_ROM_FN(Minefld) - -static struct BurnRomInfo HustlerRomDesc[] = { - { "hustler.1", 0x01000, 0x94479a3e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "hustler.2", 0x01000, 0x3cc67bcc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "hustler.3", 0x01000, 0x9422226a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "hustler.6", 0x00800, 0x7a946544, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "hustler.7", 0x00800, 0x3db57351, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "hustler.5f", 0x00800, 0x0bdfad0e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "hustler.5h", 0x00800, 0x8e062177, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "hustler.clr", 0x00020, 0xaa1f7f5e, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Hustler) -STD_ROM_FN(Hustler) - -static struct BurnRomInfo BilliardRomDesc[] = { - { "a", 0x01000, 0xb7eb50c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "b", 0x01000, 0x988fe1c5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "c", 0x01000, 0x7b8de793, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "hustler.6", 0x00800, 0x7a946544, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "hustler.7", 0x00800, 0x3db57351, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "hustler.5f", 0x00800, 0x0bdfad0e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "hustler.5h", 0x00800, 0x8e062177, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "hustler.clr", 0x00020, 0xaa1f7f5e, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Billiard) -STD_ROM_FN(Billiard) - -static struct BurnRomInfo HustlerbRomDesc[] = { - { "hustler.2c", 0x01000, 0x3a1ac6a9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "hustler.2f", 0x01000, 0xdc6752ec, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "hustler.2j", 0x01000, 0x27c1e0f8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "hustler.11d", 0x00800, 0xb559bfde, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "hustler.10d", 0x00800, 0x6ef96cfb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "hustler.5f", 0x00800, 0x0bdfad0e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "hustler.5h", 0x00800, 0x8e062177, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "hustler.clr", 0x00020, 0xaa1f7f5e, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Hustlerb) -STD_ROM_FN(Hustlerb) - -static struct BurnRomInfo MimonkeyRomDesc[] = { - { "mm1.2e", 0x01000, 0x9019f1b1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm2.2e", 0x01000, 0x043e97d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm3.2f", 0x01000, 0x1052726a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm4.2h", 0x01000, 0x7b3f35ff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm5.2j", 0x01000, 0xb4e5c32d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm6.2l", 0x01000, 0x409036c4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm7.2m", 0x01000, 0x119c08fa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "mm8.2p", 0x01000, 0xf7989f04, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mm13.11d", 0x01000, 0x2d14c527, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "mm14.10d", 0x01000, 0x35ed0f96, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "mm12.5h", 0x01000, 0xf73a8412, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mm10.5h", 0x01000, 0x3828c9db, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mm11.5f", 0x01000, 0x9e0e9289, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mm9.5f", 0x01000, 0x92085b0c, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mimonkey) -STD_ROM_FN(Mimonkey) - -static struct BurnRomInfo MimonscoRomDesc[] = { - { "fra_1a", 0x01000, 0x8e7a7379, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "fra_1b", 0x01000, 0xab08cbfe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "fra_2a", 0x01000, 0x2d4da24d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "fra_2b", 0x01000, 0x8d88fc7c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "fra_3a", 0x01000, 0xb4e5c32d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "fra_3b", 0x01000, 0x409036c4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "fra_4a", 0x01000, 0x119c08fa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "fra_4b", 0x01000, 0xd700fd03, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "mmsound1", 0x01000, 0x2d14c527, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - { "mmsnd2a", 0x01000, 0x35ed0f96, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, - - { "mmgfx1", 0x02000, 0x4af47337, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "mmgfx2", 0x02000, 0xdef47da8, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, -}; - -STD_ROM_PICK(Mimonsco) -STD_ROM_FN(Mimonsco) - -UINT8 __fastcall Tazmani2Z80Read(UINT16 a) -{ - if (a >= 0xa000 && a <= 0xa00f) { - return ppi8255_r(0, (a - 0xa000) >> 2); - } - - if (a >= 0xa800 && a <= 0xa80f) { - return ppi8255_r(1, (a - 0xa800) >> 2); - } - - switch (a) { - case 0x9800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall Tazmani2Z80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x8800 && a <= 0x88ff) { - INT32 Offset = a - 0x8800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0xa000 && a <= 0xa00f) { - ppi8255_w(0, (a - 0xa000) >> 2, d); - return; - } - - if (a >= 0xa800 && a <= 0xa80f) { - ppi8255_w(1, (a - 0xa800) >> 2, d); - return; - } - - switch (a) { - case 0xb000: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb002: { - GalBackgroundEnable = d & 1; - return; - } - - case 0xb004: { - GalIrqFire = d & 1; - return; - } - - case 0xb006: { - // coin_count_0_w - return; - } - - case 0xb00c: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb00e: { - GalFlipScreenX = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall AnteatergZ80Read(UINT16 a) -{ - switch (a) { - case 0xf521: { - // watchdog read - return 0xff; - } - - case 0xf612: { - return ppi8255_r(0, 0); - } - - case 0xf631: { - return ppi8255_r(0, 1); - } - - case 0xf710: { - return ppi8255_r(0, 2); - } - - case 0xf753: { - return ppi8255_r(0, 3); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall AnteatergZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x2000 && a <= 0x20ff) { - INT32 Offset = a - 0x2000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x2423: { - ppi8255_w(1, 3, d); - return; - } - - case 0x2450: { - ppi8255_w(1, 0, d); - return; - } - - case 0x2511: { - ppi8255_w(1, 1, d); - return; - } - - case 0x2621: { - GalIrqFire = d & 1; - return; - } - - case 0x2624: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x2647: { - GalFlipScreenY = d & 1; - return; - } - - case 0x2653: { - GalBackgroundEnable = d & 1; - return; - } - - case 0x2702: { - // coin_count_0_w - return; - } - - case 0x2736: { - GalFlipScreenX = d & 1; - return; - } - - case 0xf612: { - ppi8255_w(0, 0, d); - return; - } - - case 0xf631: { - ppi8255_w(0, 1, d); - return; - } - - case 0xf710: { - ppi8255_w(0, 2, d); - return; - } - - case 0xf753: { - ppi8255_w(0, 3, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall AnteatgbZ80Read(UINT16 a) -{ - switch (a) { - case 0x145b: { - // watchdog read - return 0xff; - } - - case 0xf300: - case 0xf301: - case 0xf302: - case 0xf303: { - return ppi8255_r(0, a - 0xf300); - } - - case 0xfe00: - case 0xfe01: - case 0xfe02: - case 0xfe03: { - return ppi8255_r(1, a - 0xfe00); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall AnteatgbZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x1200 && a <= 0x12ff) { - INT32 Offset = a - 0x1200; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x1171: { - GalIrqFire = d & 1; - return; - } - - case 0x1172: { - // coin_count_0_w - return; - } - - case 0x1173: { - GalBackgroundEnable = d & 1; - return; - } - - case 0x1174: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x1176: { - GalFlipScreenX = d & 1; - return; - } - - case 0x1177: { - GalFlipScreenY = d & 1; - return; - } - - case 0xf300: - case 0xf301: - case 0xf302: - case 0xf303: { - ppi8255_w(0, a - 0xf300, d); - return; - } - - case 0xfe00: - case 0xfe01: - case 0xfe02: - case 0xfe03: { - ppi8255_w(1, a - 0xfe00, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall StratgyxZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x8800 && a <= 0x88ff) { - INT32 Offset = a - 0x8800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0xa000 && a <= 0xa00f) { - ppi8255_w(0, (a - 0xa000) >> 2, d); - return; - } - - if (a >= 0xa800 && a <= 0xa80f) { - ppi8255_w(1, (a - 0xa800) >> 2, d); - return; - } - - switch (a) { - case 0xb000: { - GalBackgroundGreen = d & 1; - return; - } - - case 0xb002: { - GalBackgroundBlue = d & 1; - return; - } - - case 0xb004: { - GalIrqFire = d & 1; - return; - } - - case 0xb006: { - // coin_count_0_w - return; - } - - case 0xb00a: { - GalBackgroundRed = d & 1; - return; - } - - case 0xb00c: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb00e: { - GalFlipScreenX = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall DarkplntZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x8800 && a <= 0x88ff) { - INT32 Offset = a - 0x8800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0xa000 && a <= 0xa00f) { - ppi8255_w(0, (a - 0xa000) >> 2, d); - return; - } - - if (a >= 0xa800 && a <= 0xa80f) { - ppi8255_w(1, (a - 0xa800) >> 2, d); - return; - } - - switch (a) { - case 0xb000: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb002: { - GalBackgroundEnable = d & 1; - return; - } - - case 0xb004: { - GalIrqFire = d & 1; - return; - } - - case 0xb006: { - // coin_count_0_w - return; - } - - case 0xb00a: { - DarkplntBulletColour = d & 1; - return; - } - - case 0xb00c: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb00e: { - GalFlipScreenX = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall HustlerZ80Read(UINT16 a) -{ - if (a >= 0xd000 && a <= 0xd01f) { - return ppi8255_r(0, (a - 0xd000) >> 3); - } - - if (a >= 0xe000 && a <= 0xe01f) { - return ppi8255_r(1, (a - 0xe000) >> 3); - } - - switch (a) { - case 0xb800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall HustlerZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9000 && a <= 0x90ff) { - INT32 Offset = a - 0x9000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0xd000 && a <= 0xd01f) { - ppi8255_w(0, (a - 0xd000) >> 3, d); - return; - } - - if (a >= 0xe000 && a <= 0xe01f) { - ppi8255_w(1, (a - 0xe000) >> 3, d); - return; - } - - switch (a) { - case 0xa802: { - GalFlipScreenX = d & 1; - return; - } - - case 0xa804: { - GalIrqFire = d & 1; - return; - } - - case 0xa806: { - GalFlipScreenY = d & 1; - return; - } - - case 0xa80e: { - // coin_count_0_w - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall HustlerbZ80Read(UINT16 a) -{ - switch (a) { - case 0xb000: { - // watchdog read - return 0xff; - } - - case 0xc100: - case 0xc101: - case 0xc102: - case 0xc103: { - return ppi8255_r(0, a - 0xc100); - } - - case 0xc200: - case 0xc201: - case 0xc202: - case 0xc203: { - return ppi8255_r(1, a - 0xc200); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall HustlerbZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9000 && a <= 0x90ff) { - INT32 Offset = a - 0x9000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa801: { - GalIrqFire = d & 1; - return; - } - - case 0xa802: { - // coin_count_0_w - return; - } - - case 0xa806: { - GalFlipScreenY = d & 1; - return; - } - - case 0xa807: { - GalFlipScreenX = d & 1; - return; - } - - case 0xc100: - case 0xc101: - case 0xc102: - case 0xc103: { - ppi8255_w(0, a - 0xc100, d); - return; - } - - case 0xc200: - case 0xc201: - case 0xc202: - case 0xc203: { - ppi8255_w(1, a - 0xc200, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall HustlerbSoundZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x80: { - return AY8910Read(0); - } - } - - return 0xff; -} - -void __fastcall HustlerbSoundZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x40: { - AY8910Write(0, 0, d); - return; - } - - case 0x80: { - AY8910Write(0, 1, d); - return; - } - } -} - -void __fastcall MimonkeyZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9000 && a <= 0x90ff) { - INT32 Offset = a - 0x9000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x9800: - case 0x9801: - case 0x9802: - case 0x9803: { - ppi8255_w(0, a - 0x9800, d); - return; - } - - case 0xa000: - case 0xa001: - case 0xa002: - case 0xa003: { - ppi8255_w(1, a - 0xa000, d); - return; - } - - case 0xa800: { - GalGfxBank[0] = d & 1; - return; - } - - case 0xa801: { - GalIrqFire = d & 1; - return; - } - - case 0xa802: { - GalGfxBank[1] = d & 1; - return; - } - - case 0xa803: { - // ??? - return; - } - - case 0xa804: { - GalBackgroundEnable = d & 1; - return; - } - - case 0xa805: { - // ??? - return; - } - - case 0xa806: { - GalFlipScreenX = d & 1; - return; - } - - case 0xa807: { - GalFlipScreenY = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 ScobraInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapScobra; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - return nRet; -} - -static INT32 LosttombInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapScobra; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - UINT8 *TempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); - BurnLoadRom(TempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); - for (UINT32 Offset = 0; Offset < GalTilesSharedRomSize; Offset++) { - UINT32 SrcOffset = Offset & 0xa7f; - SrcOffset |= ((BIT(Offset, 1) & BIT(Offset, 8)) | ((1 ^ BIT(Offset, 1)) & (BIT(Offset, 10)))) << 7; - SrcOffset |= (BIT(Offset, 7) ^ (BIT(Offset, 1) & (BIT(Offset, 7) ^ BIT(Offset, 10)))) << 8; - SrcOffset |= ((BIT(Offset, 1) & BIT(Offset, 7)) | ((1 ^ BIT(Offset, 1)) & (BIT(Offset, 8)))) << 10; - GalTempRom[Offset] = TempRom[SrcOffset]; - } - BurnFree(TempRom); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static void MapTazmani2() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(Tazmani2Z80Read); - ZetSetWriteHandler(Tazmani2Z80Write); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetMapArea(0x8800, 0x88ff, 0, GalSpriteRam); - ZetMapArea(0x8800, 0x88ff, 2, GalSpriteRam); - ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); - ZetMemEnd(); - ZetClose(); -} - -static INT32 Tazmani2Init() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapTazmani2; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - return nRet; -} - -static INT32 AnteaterInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapScobra; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - UINT8 *TempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); - BurnLoadRom(TempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); - for (UINT32 Offset = 0; Offset < GalTilesSharedRomSize; Offset++) { - UINT32 SrcOffset = Offset & 0x9bf; - SrcOffset |= (BIT(Offset, 4) ^ BIT(Offset, 9) ^ (BIT(Offset, 2) & BIT(Offset, 10))) << 6; - SrcOffset |= (BIT(Offset, 2) ^ BIT(Offset, 10)) << 9; - SrcOffset |= (BIT(Offset, 0) ^ BIT(Offset, 6) ^ 1) << 10; - GalTempRom[Offset] = TempRom[SrcOffset]; - } - BurnFree(TempRom); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - - GalRenderBackgroundFunction = AnteaterDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static void AnteatergPostLoad() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(AnteatergZ80Read); - ZetSetWriteHandler(AnteatergZ80Write); - ZetMapArea(0x0000, 0x03ff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x03ff, 2, GalZ80Rom1); - ZetMapArea(0x0400, 0x0bff, 0, GalZ80Ram1); - ZetMapArea(0x0400, 0x0bff, 1, GalZ80Ram1); - ZetMapArea(0x0400, 0x0bff, 2, GalZ80Ram1); - ZetMapArea(0x0c00, 0x0fff, 0, GalVideoRam); - ZetMapArea(0x0c00, 0x0fff, 1, GalVideoRam); - ZetMapArea(0x0c00, 0x0fff, 2, GalVideoRam); - ZetMapArea(0x2000, 0x20ff, 0, GalSpriteRam); - ZetMapArea(0x2000, 0x20ff, 2, GalSpriteRam); - ZetMapArea(0x4600, 0x4fff, 0, GalZ80Rom1 + 0x0400); - ZetMapArea(0x4600, 0x4fff, 2, GalZ80Rom1 + 0x0400); - ZetMapArea(0x6400, 0x7aff, 0, GalZ80Rom1 + 0x0e00); - ZetMapArea(0x6400, 0x7aff, 2, GalZ80Rom1 + 0x0e00); - ZetMapArea(0x7c00, 0x7fff, 0, GalVideoRam); - ZetMapArea(0x7c00, 0x7fff, 1, GalVideoRam); - ZetMapArea(0x7c00, 0x7fff, 2, GalVideoRam); - ZetMapArea(0x8300, 0x98ff, 0, GalZ80Rom1 + 0x2500); - ZetMapArea(0x8300, 0x98ff, 2, GalZ80Rom1 + 0x2500); - ZetMapArea(0xa300, 0xa7ff, 0, GalZ80Rom1 + 0x3b00); - ZetMapArea(0xa300, 0xa7ff, 2, GalZ80Rom1 + 0x3b00); - ZetMemEnd(); - ZetClose(); -} - -static INT32 AnteatergInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = AnteatergPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = AnteaterDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static void AnteaterukPostLoad() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(AnteatgbZ80Read); - ZetSetWriteHandler(AnteatgbZ80Write); - ZetMapArea(0x0000, 0x03ff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x03ff, 2, GalZ80Rom1); - ZetMapArea(0x0400, 0x0bff, 0, GalZ80Ram1); - ZetMapArea(0x0400, 0x0bff, 1, GalZ80Ram1); - ZetMapArea(0x0400, 0x0bff, 2, GalZ80Ram1); - ZetMapArea(0x0c00, 0x0fff, 0, GalVideoRam); - ZetMapArea(0x0c00, 0x0fff, 1, GalVideoRam); - ZetMapArea(0x0c00, 0x0fff, 2, GalVideoRam); - ZetMapArea(0x1200, 0x12ff, 0, GalSpriteRam); - ZetMapArea(0x1200, 0x12ff, 2, GalSpriteRam); - ZetMapArea(0x4600, 0x4fff, 0, GalZ80Rom1 + 0x0400); - ZetMapArea(0x4600, 0x4fff, 2, GalZ80Rom1 + 0x0400); - ZetMapArea(0x6400, 0x7aff, 0, GalZ80Rom1 + 0x0e00); - ZetMapArea(0x6400, 0x7aff, 2, GalZ80Rom1 + 0x0e00); - ZetMapArea(0x8300, 0x98ff, 0, GalZ80Rom1 + 0x2500); - ZetMapArea(0x8300, 0x98ff, 2, GalZ80Rom1 + 0x2500); - ZetMapArea(0xa300, 0xa7ff, 0, GalZ80Rom1 + 0x3b00); - ZetMapArea(0xa300, 0xa7ff, 2, GalZ80Rom1 + 0x3b00); - ZetMemEnd(); - ZetClose(); -} - -static INT32 AnteaterukInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = AnteaterukPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static void SuperbonPostLoad() -{ - MapScobra(); - - for (UINT32 Offset = 0; Offset < 0x1000; Offset++) { - switch (Offset & 0x280) { - case 0x000: GalZ80Rom1[Offset] ^= 0x92; break; - case 0x080: GalZ80Rom1[Offset] ^= 0x82; break; - case 0x200: GalZ80Rom1[Offset] ^= 0x12; break; - case 0x280: GalZ80Rom1[Offset] ^= 0x10; break; - } - } -} - -static INT32 SuperbonInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = SuperbonPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static INT32 CalipsoInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapScobra; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendSpriteInfoFunction = CalipsoExtendSpriteInfo; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static UINT8 MoonwarPPIReadIN0() -{ - UINT8 Dial1 = (GalAnalogPort0 >> 8) & 0xff; - UINT8 Dial2 = (GalAnalogPort1 >> 8) & 0xff; - UINT8 Input0 = 0xff - GalInput[0] - GalDip[0]; - UINT8 Sign; - UINT8 Delta; - - if (Dial1 >= 0xfc || (Dial1 >= 0x01 && Dial1 <= 0x04)) Dial1 = 0; - if (Dial1 >= 0xf8) Dial1 = 0xfd; - if (Dial1 >= 0x01 && Dial1 <= 0x07) Dial1 = 0x02; - - if (Dial2 >= 0xfc || (Dial2 >= 0x01 && Dial2 <= 0x04)) Dial2 = 0; - if (Dial2 >= 0xf8) Dial2 = 0xfd; - if (Dial2 >= 0x01 && Dial2 <= 0x07) Dial2 = 0x02; - - Delta = (MoonwarPortSelect ? Dial1 : Dial2); - Sign = (Delta & 0x80) >> 3; - Delta &= 0x0f; - - return (Input0 & 0xe0) | Delta | Sign; -} - -static void MoonwarPortSelectWrite(UINT8 d) -{ - MoonwarPortSelect = d & 0x10; -} - -static INT32 MoonwarInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapScobra; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = MoonwarDrawBullets; - - KonamiPPIInit(); - - PPI0PortReadA = MoonwarPPIReadIN0; - PPI0PortWriteC = MoonwarPortSelectWrite; - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static void StratgyxPostLoad() -{ - MapTazmani2(); - - ZetOpen(0); - ZetSetWriteHandler(StratgyxZ80Write); - ZetClose(); -} - -static INT32 StratgyxInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = StratgyxPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalCalcPaletteFunction = StratgyxCalcPalette; - GalRenderBackgroundFunction = StratgyxDrawBackground; - - KonamiPPIInit(); - - return nRet; -} - -static void DarkplntPostLoad() -{ - MapTazmani2(); - - ZetOpen(0); - ZetSetWriteHandler(DarkplntZ80Write); - ZetClose(); -} - -static INT16 DarkplntDial = 0; -static UINT32 DarkplntDialFrameNumberRead = 0; - -static UINT8 DarkplntPPIReadIN1() -{ - UINT32 CurrentFrame = GetCurrentFrame(); - - if (DarkplntDialFrameNumberRead != CurrentFrame) { - if (GalInputPort3[0]) DarkplntDial -= 0x01; - if (GalInputPort3[1]) DarkplntDial += 0x01; - if (DarkplntDial > 0xfc) DarkplntDial = 0x00; - if (DarkplntDial < 0) DarkplntDial = 0xfc; - DarkplntDialFrameNumberRead = CurrentFrame; - } - - static const UINT8 remap[] = {0x03, 0x02, 0x00, 0x01, 0x21, 0x20, 0x22, 0x23, 0x33, 0x32, 0x30, 0x31, 0x11, 0x10, 0x12, 0x13, 0x17, 0x16, 0x14, 0x15, 0x35, 0x34, 0x36, 0x37, 0x3f, 0x3e, 0x3c, 0x3d, 0x1d, 0x1c, 0x1e, 0x1f, 0x1b, 0x1a, 0x18, 0x19, 0x39, 0x38, 0x3a, 0x3b, 0x2b, 0x2a, 0x28, 0x29, 0x09, 0x08, 0x0a, 0x0b, 0x0f, 0x0e, 0x0c, 0x0d, 0x2d, 0x2c, 0x2e, 0x2f, 0x27, 0x26, 0x24, 0x25, 0x05, 0x04, 0x06, 0x07 }; - - return 0xff - GalInput[1] - GalDip[1] - remap[DarkplntDial >> 2]; -} - -static INT32 DarkplntInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = DarkplntPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalCalcPaletteFunction = DarkplntCalcPalette; - GalDrawBulletsFunction = DarkplntDrawBullets; - - KonamiPPIInit(); - PPI0PortReadB = DarkplntPPIReadIN1; - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static INT32 RescueInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapScobra; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - UINT8* TempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - memcpy(TempRom, GalTempRom, GalTilesSharedRomSize); - for (UINT32 Offset = 0; Offset < GalTilesSharedRomSize; Offset++) { - UINT32 j = Offset & 0xa7f; - j |= (BIT(Offset, 3) ^ BIT(Offset, 10)) << 7; - j |= (BIT(Offset, 1) ^ BIT(Offset, 7)) << 8; - j |= (BIT(Offset, 0) ^ BIT(Offset, 8)) << 10; - GalTempRom[Offset] = TempRom[j]; - } - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(TempRom); - BurnFree(GalTempRom); - - GalCalcPaletteFunction = RescueCalcPalette; - GalRenderBackgroundFunction = RescueDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static INT32 MinefldInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapScobra; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - UINT8* TempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - memcpy(TempRom, GalTempRom, GalTilesSharedRomSize); - for (UINT32 Offset = 0; Offset < GalTilesSharedRomSize; Offset++) { - UINT32 j = Offset & 0xd5f; - j |= (BIT(Offset, 3) ^ BIT(Offset, 7)) << 5; - j |= (BIT(Offset, 2) ^ BIT(Offset, 9) ^ (BIT(Offset, 0) & BIT(Offset, 5)) ^ (BIT(Offset, 3) & BIT(Offset, 7) & (BIT(Offset, 0) ^ BIT(Offset, 5)))) << 7; - j |= (BIT(Offset, 0) ^ BIT(Offset, 5) ^ (BIT(Offset, 3) & BIT(Offset, 7))) << 9; - GalTempRom[Offset] = TempRom[j]; - } - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(TempRom); - BurnFree(GalTempRom); - - GalCalcPaletteFunction = MinefldCalcPalette; - GalRenderBackgroundFunction = MinefldDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static void HustlerPostLoad() -{ - MapScobra(); - - ZetOpen(0); - ZetSetReadHandler(HustlerZ80Read); - ZetSetWriteHandler(HustlerZ80Write); - ZetClose(); - - for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { - UINT8 XorMask; - INT32 Bits[8]; - - for (UINT32 i = 0; i < 8; i++) Bits[i] = (Offset >> i) & 1; - - XorMask = 0xff; - if (Bits[0] ^ Bits[1]) XorMask ^= 0x01; - if (Bits[3] ^ Bits[6]) XorMask ^= 0x02; - if (Bits[4] ^ Bits[5]) XorMask ^= 0x04; - if (Bits[0] ^ Bits[2]) XorMask ^= 0x08; - if (Bits[2] ^ Bits[3]) XorMask ^= 0x10; - if (Bits[1] ^ Bits[5]) XorMask ^= 0x20; - if (Bits[0] ^ Bits[7]) XorMask ^= 0x40; - if (Bits[4] ^ Bits[6]) XorMask ^= 0x80; - - GalZ80Rom1[Offset] ^= XorMask; - } -} - -static INT32 HustlerInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = HustlerPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; - - nRet = GalInit(); - FroggerSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - return nRet; -} - -static void BilliardPostLoad() -{ - MapScobra(); - - ZetOpen(0); - ZetSetReadHandler(HustlerZ80Read); - ZetSetWriteHandler(HustlerZ80Write); - ZetClose(); - - for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { - UINT8 XorMask; - INT32 Bits[8]; - - for (UINT32 i = 0; i < 8; i++) Bits[i] = (Offset >> i) & 1; - - XorMask = 0x55; - if (Bits[2] ^ ( Bits[3] & Bits[6])) XorMask ^= 0x01; - if (Bits[4] ^ ( Bits[5] & Bits[7])) XorMask ^= 0x02; - if (Bits[0] ^ ( Bits[7] & !Bits[3])) XorMask ^= 0x04; - if (Bits[3] ^ (!Bits[0] & Bits[2])) XorMask ^= 0x08; - if (Bits[5] ^ (!Bits[4] & Bits[1])) XorMask ^= 0x10; - if (Bits[6] ^ (!Bits[2] & !Bits[5])) XorMask ^= 0x20; - if (Bits[1] ^ (!Bits[6] & !Bits[4])) XorMask ^= 0x40; - if (Bits[7] ^ (!Bits[1] & Bits[0])) XorMask ^= 0x80; - - GalZ80Rom1[Offset] ^= XorMask; - GalZ80Rom1[Offset] = BITSWAP08(GalZ80Rom1[Offset], 6, 1, 2, 5, 4, 3, 0, 7); - } -} - -static INT32 BilliardInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = BilliardPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; - - nRet = GalInit(); - FroggerSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - return nRet; -} - -static void HustlerbPostLoad() -{ - MapScobra(); - - ZetOpen(0); - ZetSetReadHandler(HustlerbZ80Read); - ZetSetWriteHandler(HustlerbZ80Write); - ZetClose(); - - FroggerSoundNoEncryptionInit(); - ZetOpen(1); - ZetSetInHandler(HustlerbSoundZ80PortRead); - ZetSetOutHandler(HustlerbSoundZ80PortWrite); - ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram2); - ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram2); - ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram2); - ZetClose(); -} - -static INT32 HustlerbInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = HustlerbPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; - - nRet = GalInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - - GalSpriteClipStart = 7; - GalSpriteClipEnd = 246; - - return nRet; -} - -static void MapMimonkey() -{ - MapScobra(); - - ZetOpen(0); - ZetSetWriteHandler(MimonkeyZ80Write); - ZetMemCallback(0x4000, 0x7fff, 0); - ZetMemCallback(0x4000, 0x7fff, 2); - ZetMapArea(0xc000, 0xffff, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0xc000, 0xffff, 2, GalZ80Rom1 + 0x4000); - ZetClose(); -} - -static void MimonkeyPostLoad() -{ - static const UINT8 XorTable[16][16] = { - { 0x03, 0x03, 0x05, 0x07, 0x85, 0x00, 0x85, 0x85, 0x80, 0x80, 0x06, 0x03, 0x03, 0x00, 0x00, 0x81 }, - { 0x83, 0x87, 0x03, 0x87, 0x06, 0x00, 0x06, 0x04, 0x02, 0x00, 0x84, 0x84, 0x04, 0x00, 0x01, 0x83 }, - { 0x82, 0x82, 0x84, 0x02, 0x04, 0x00, 0x00, 0x03, 0x82, 0x00, 0x06, 0x80, 0x03, 0x00, 0x81, 0x07 }, - { 0x06, 0x06, 0x82, 0x81, 0x85, 0x00, 0x04, 0x07, 0x81, 0x05, 0x04, 0x00, 0x03, 0x00, 0x82, 0x84 }, - { 0x07, 0x07, 0x80, 0x07, 0x07, 0x00, 0x85, 0x86, 0x00, 0x07, 0x06, 0x04, 0x85, 0x00, 0x86, 0x85 }, - { 0x81, 0x83, 0x02, 0x02, 0x87, 0x00, 0x86, 0x03, 0x04, 0x06, 0x80, 0x05, 0x87, 0x00, 0x81, 0x81 }, - { 0x01, 0x01, 0x00, 0x07, 0x07, 0x00, 0x01, 0x01, 0x07, 0x07, 0x06, 0x00, 0x06, 0x00, 0x07, 0x07 }, - { 0x80, 0x87, 0x81, 0x87, 0x83, 0x00, 0x84, 0x01, 0x01, 0x86, 0x86, 0x80, 0x86, 0x00, 0x86, 0x86 }, - { 0x03, 0x03, 0x05, 0x07, 0x85, 0x00, 0x85, 0x85, 0x80, 0x80, 0x06, 0x03, 0x03, 0x00, 0x00, 0x81 }, - { 0x83, 0x87, 0x03, 0x87, 0x06, 0x00, 0x06, 0x04, 0x02, 0x00, 0x84, 0x84, 0x04, 0x00, 0x01, 0x83 }, - { 0x82, 0x82, 0x84, 0x02, 0x04, 0x00, 0x00, 0x03, 0x82, 0x00, 0x06, 0x80, 0x03, 0x00, 0x81, 0x07 }, - { 0x06, 0x06, 0x82, 0x81, 0x85, 0x00, 0x04, 0x07, 0x81, 0x05, 0x04, 0x00, 0x03, 0x00, 0x82, 0x84 }, - { 0x07, 0x07, 0x80, 0x07, 0x07, 0x00, 0x85, 0x86, 0x00, 0x07, 0x06, 0x04, 0x85, 0x00, 0x86, 0x85 }, - { 0x81, 0x83, 0x02, 0x02, 0x87, 0x00, 0x86, 0x03, 0x04, 0x06, 0x80, 0x05, 0x87, 0x00, 0x81, 0x81 }, - { 0x01, 0x01, 0x00, 0x07, 0x07, 0x00, 0x01, 0x01, 0x07, 0x07, 0x06, 0x00, 0x06, 0x00, 0x07, 0x07 }, - { 0x80, 0x87, 0x81, 0x87, 0x83, 0x00, 0x84, 0x01, 0x01, 0x86, 0x86, 0x80, 0x86, 0x00, 0x86, 0x86 } - }; - - INT32 Ctr = 0, Line, Col; - - for (INT32 Offset = 0; Offset < 0x4000; Offset++) { - Line = (Ctr & 0x07) | ((Ctr & 0x200) >> 6); - Col = ((GalZ80Rom1[Offset] & 0x80) >> 4) | (GalZ80Rom1[Offset] & 0x07); - GalZ80Rom1[Offset] = GalZ80Rom1[Offset] ^ XorTable[Line][Col]; - Ctr++; - } - - MapMimonkey(); -} - -static INT32 MimonkeyInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MimonkeyPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = MimonkeyExtendTileInfo; - GalExtendSpriteInfoFunction = MimonkeyExtendSpriteInfo; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -static INT32 MimonscoInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = MapMimonkey; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; - - nRet = GalInit(); - KonamiSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = MimonkeyExtendTileInfo; - GalExtendSpriteInfoFunction = MimonkeyExtendSpriteInfo; - - KonamiPPIInit(); - - filter_rc_set_src_gain(0, 0.20); - filter_rc_set_src_gain(1, 0.20); - filter_rc_set_src_gain(2, 0.20); - filter_rc_set_src_gain(3, 0.20); - filter_rc_set_src_gain(4, 0.20); - filter_rc_set_src_gain(5, 0.20); - - return nRet; -} - -struct BurnDriver BurnDrvScobra = { - "scobra", NULL, NULL, NULL, "1981", - "Super Cobra\0", NULL, "Konami", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScobraRomInfo, ScobraRomName, NULL, NULL, SfxInputInfo, ScobraDIPInfo, - ScobraInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScobras = { - "scobras", "scobra", NULL, NULL, "1981", - "Super Cobra (Stern)\0", NULL, "Konami (Stern license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScobrasRomInfo, ScobrasRomName, NULL, NULL, SfxInputInfo, ScobrasDIPInfo, - ScobraInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScobrase = { - "scobrase", "scobra", NULL, NULL, "1981", - "Super Cobra (Sega)\0", NULL, "Konami (Sega license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScobraseRomInfo, ScobraseRomName, NULL, NULL, SfxInputInfo, ScobrasDIPInfo, - ScobraInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvScobrab = { - "scobrab", "scobra", NULL, NULL, "1981", - "Super Cobra (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, ScobrabRomInfo, ScobrabRomName, NULL, NULL, SfxInputInfo, ScobrasDIPInfo, - ScobraInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSuprheli = { - "suprheli", "scobra", NULL, NULL, "1981", - "Super Heli (Super Cobra bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, SuprheliRomInfo, SuprheliRomName, NULL, NULL, SfxInputInfo, ScobrasDIPInfo, - ScobraInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvLosttomb = { - "losttomb", NULL, NULL, NULL, "1982", - "Lost Tomb (Easy)\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, LosttombRomInfo, LosttombRomName, NULL, NULL, LosttombInputInfo, LosttombDIPInfo, - LosttombInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvLosttombh = { - "losttombh", "losttomb", NULL, NULL, "1982", - "Lost Tomb (Hard)\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, LosttombhRomInfo, LosttombhRomName, NULL, NULL, LosttombInputInfo, LosttombDIPInfo, - LosttombInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvArmorcar = { - "armorcar", NULL, NULL, NULL, "1981", - "Armored Car (set 1)\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, ArmorcarRomInfo, ArmorcarRomName, NULL, NULL, AtlantisInputInfo, ArmorcarDIPInfo, - ScobraInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvArmorcar2 = { - "armorcar2", "armorcar", NULL, NULL, "1981", - "Armored Car (set 2)\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, Armorcar2RomInfo, Armorcar2RomName, NULL, NULL, AtlantisInputInfo, ArmorcarDIPInfo, - ScobraInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTazmania = { - "tazmania", NULL, NULL, NULL, "1982", - "Tazz-Mania (set 1)\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, TazmaniaRomInfo, TazmaniaRomName, NULL, NULL, TazmaniaInputInfo, ArmorcarDIPInfo, - ScobraInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTazmani2 = { - "tazmani2", "tazmania", NULL, NULL, "1982", - "Tazz-Mania (set 2)\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, Tazmani2RomInfo, Tazmani2RomName, NULL, NULL, TazmaniaInputInfo, ArmorcarDIPInfo, - Tazmani2Init, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAnteater = { - "anteater", NULL, NULL, NULL, "1982", - "Anteater\0", NULL, "Stern (Tago license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, AnteaterRomInfo, AnteaterRomName, NULL, NULL, AnteaterInputInfo, AnteaterDIPInfo, - AnteaterInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAnteaterg = { - "anteaterg", "anteater", NULL, NULL, "1983", - "Ameisenbaer (German)\0", NULL, "TV-Tuning (F.E.G. license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, AnteatergRomInfo, AnteatergRomName, NULL, NULL, AnteatergInputInfo, AnteatergDIPInfo, - AnteatergInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAnteateruk = { - "anteateruk", "anteater", NULL, NULL, "1983", - "The Anteater (UK)\0", NULL, "Free Enterprise Games", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, AnteaterukRomInfo, AnteaterukRomName, NULL, NULL, AnteaterukInputInfo, AnteaterukDIPInfo, - AnteaterukInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSpdcoin = { - "spdcoin", NULL, NULL, NULL, "1984", - "Speed Coin (prototype)\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_PROTOTYPE, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, - NULL, SpdcoinRomInfo, SpdcoinRomName, NULL, NULL, SpdcoinInputInfo, SpdcoinDIPInfo, - ScobraInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSuperbon = { - "superbon", NULL, NULL, NULL, "1985", - "Agent Super Bond (scobra hardware)\0", "Bad Colours", "Signaton USA", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, SuperbonRomInfo, SuperbonRomName, NULL, NULL, SuperbonInputInfo, SuperbonDIPInfo, - SuperbonInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvCalipso = { - "calipso", NULL, NULL, NULL, "1982", - "Calipso\0", NULL, "Stern (Tago license)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, - NULL, CalipsoRomInfo, CalipsoRomName, NULL, NULL, CalipsoInputInfo, CalipsoDIPInfo, - CalipsoInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMoonwar = { - "moonwar", NULL, NULL, NULL, "1981", - "Moonwar\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SHOOT, 0, - NULL, MoonwarRomInfo, MoonwarRomName, NULL, NULL, MoonwarInputInfo, MoonwarDIPInfo, - MoonwarInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMoonwara = { - "moonwara", "moonwar", NULL, NULL, "1981", - "Moonwar (older)\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SHOOT, 0, - NULL, MoonwaraRomInfo, MoonwaraRomName, NULL, NULL, MoonwarInputInfo, MoonwaraDIPInfo, - MoonwarInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvStratgyx = { - "stratgyx", NULL, NULL, NULL, "1981", - "Strategy X\0", NULL, "Konami", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, StratgyxRomInfo, StratgyxRomName, NULL, NULL, StratgyxInputInfo, StratgyxDIPInfo, - StratgyxInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvStratgys = { - "stratgys", "stratgyx", NULL, NULL, "1981", - "Strategy X (Stern)\0", NULL, "Konami (Stern License)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, StratgysRomInfo, StratgysRomName, NULL, NULL, StratgyxInputInfo, StratgyxDIPInfo, - StratgyxInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvStrongx = { - "strongx", "stratgyx", NULL, NULL, "1982", - "Strong X\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, - NULL, StrongxRomInfo, StrongxRomName, NULL, NULL, StratgyxInputInfo, StratgyxDIPInfo, - StratgyxInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDarkplnt = { - "darkplnt", NULL, NULL, NULL, "1982", - "Dark Planet\0", "Dial doesn't work very well", "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SHOOT, 0, - NULL, DarkplntRomInfo, DarkplntRomName, NULL, NULL, DarkplntInputInfo, DarkplntDIPInfo, - DarkplntInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvRescue = { - "rescue", NULL, NULL, NULL, "1982", - "Rescue\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, RescueRomInfo, RescueRomName, NULL, NULL, RescueInputInfo, RescueDIPInfo, - RescueInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAponow = { - "aponow", "rescue", NULL, NULL, "1982", - "Apocaljpse Now\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, AponowRomInfo, AponowRomName, NULL, NULL, RescueInputInfo, RescueDIPInfo, - RescueInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMinefld = { - "minefld", NULL, NULL, NULL, "1983", - "Minefield\0", NULL, "Stern", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, MinefldRomInfo, MinefldRomName, NULL, NULL, RescueInputInfo, MinefldDIPInfo, - MinefldInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHustler = { - "hustler", NULL, NULL, NULL, "1981", - "Video Hustler\0", NULL, "Konami", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, - NULL, HustlerRomInfo, HustlerRomName, NULL, NULL, HustlerInputInfo, HustlerDIPInfo, - HustlerInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvBilliard = { - "billiard", "hustler", NULL, NULL, "1981", - "The Billiards\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, - NULL, BilliardRomInfo, BilliardRomName, NULL, NULL, HustlerInputInfo, HustlerDIPInfo, - BilliardInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHustlerb = { - "hustlerb", "hustler", NULL, NULL, "1981", - "Video Hustler (bootleg)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, - NULL, HustlerbRomInfo, HustlerbRomName, NULL, NULL, HustlerInputInfo, HustlerDIPInfo, - HustlerbInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMimonkey = { - "mimonkey", NULL, NULL, NULL, "198?", - "Mighty Monkey\0", NULL, "Universal Video Games", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, MimonkeyRomInfo, MimonkeyRomName, NULL, NULL, AtlantisInputInfo, MimonkeyDIPInfo, - MimonkeyInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvMimonsco = { - "mimonsco", "mimonkey", NULL, NULL, "198?", - "Mighty Monkey (bootleg on Super Cobra hardware)\0", NULL, "bootleg", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, MimonscoRomInfo, MimonscoRomName, NULL, NULL, AtlantisInputInfo, MimonscoDIPInfo, - MimonscoInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// Dambusters based hardware - background can take priority over all graphics except high colour chars -static struct BurnRomInfo DambustrRomDesc[] = { - { "db11a.pr11", 0x01000, 0x427bd3fb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db9a.pr9", 0x01000, 0x57164563, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db10a.pr10", 0x01000, 0x075b9c5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db12a.pr12", 0x01000, 0xed01a68b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db8a.pr8", 0x01000, 0xfd041ff4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db6a.pr6", 0x01000, 0x448db54b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db7a.pr7", 0x01000, 0x675b1f5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db5a.pr5", 0x01000, 0x75659ecc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "db3a.pr3", 0x01000, 0x9e9a9710, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "db1a.pr1", 0x01000, 0x4cb964cd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "db4a.pr3", 0x01000, 0xd9d2df33, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "db2a.pr2", 0x01000, 0x0a0a6af5, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mi-7603-5.ic4", 0x00020, 0xf131f92f, BRF_GRA | GAL_ROM_PROM }, - - { "mi-7603-5.ic3", 0x00020, 0xe2a54c47, BRF_OPT }, // timing? -}; - -STD_ROM_PICK(Dambustr) -STD_ROM_FN(Dambustr) - -static struct BurnRomInfo DambustraRomDesc[] = { - { "db11.pr11", 0x01000, 0x427bd3fb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db9a.pr9", 0x01000, 0x57164563, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db10a.pr10", 0x01000, 0x075b9c5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db12a.pr12", 0x01000, 0xed01a68b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db8a.pr8", 0x01000, 0xfd041ff4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db6.pr6", 0x01000, 0x56d301a9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db7a.pr7", 0x01000, 0x675b1f5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db5a.pr5", 0x01000, 0x75659ecc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "db3a.rom", 0x01000, 0x2347e26e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "db1a.pr1", 0x01000, 0x4cb964cd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "db4a.pr3", 0x01000, 0xd9d2df33, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "db2a.pr2", 0x01000, 0x0a0a6af5, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mi-7603-5.ic4", 0x00020, 0xf131f92f, BRF_GRA | GAL_ROM_PROM }, - - { "mi-7603-5.ic3", 0x00020, 0xe2a54c47, BRF_OPT }, // timing? -}; - -STD_ROM_PICK(Dambustra) -STD_ROM_FN(Dambustra) - -static struct BurnRomInfo DambustrukRomDesc[] = { - { "db11.bin", 0x01000, 0x9e6b34fe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db9.pr9", 0x01000, 0x57164563, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db10p.bin", 0x01000, 0xc129c57b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db12.bin", 0x01000, 0xea4c65f5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db8.pr8", 0x01000, 0xfd041ff4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db6p.bin", 0x01000, 0x35dcee01, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db7.pr7", 0x01000, 0x675b1f5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - { "db5.pr5", 0x01000, 0x75659ecc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "db3.pr3", 0x01000, 0x9e9a9710, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "db1ap.pr1", 0x01000, 0x4cb964cd, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "db4.pr3", 0x01000, 0xd9d2df33, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "db2.pr2", 0x01000, 0x0a0a6af5, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "mi-7603-5.ic4", 0x00020, 0xf131f92f, BRF_GRA | GAL_ROM_PROM }, - - { "mi-7603-5.ic3", 0x00020, 0xe2a54c47, BRF_OPT }, // timing? -}; - -STD_ROM_PICK(Dambustruk) -STD_ROM_FN(Dambustruk) - -UINT8 __fastcall DambustrZ80Read(UINT16 a) -{ - if (a >= 0xd900 && a <= 0xdbff) { - // ??? - return 0xff; - } - - switch (a) { - case 0xe000: { - return GalInput[0] | GalDip[0]; - } - - case 0xe800: { - return GalInput[1] | GalDip[1]; - } - - case 0xf000: { - return GalInput[2] | GalDip[2]; - } - - case 0xf800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall DambustrZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0xd800 && a <= 0xd8ff) { - INT32 Offset = a - 0xd800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0xd900 && a <= 0xdbff) { - // ??? - return; - } - - switch (a) { - case 0x8000: { - DambustrBgColour1 = (BIT(d, 2) << 2) | (BIT(d, 1) << 1) | BIT(d, 0); - DambustrBgColour2 = (BIT(d, 6) << 2) | (BIT(d, 5) << 1) | BIT(d, 4); - DambustrBgPriority = BIT(d, 3); - GalGfxBank[0] = BIT(d, 7); - return; - } - - case 0x8001: { - DambustrBgSplitLine = d; - return; - } - - case 0xe002: - case 0xe003: { - // coin_count_0_w - return; - } - - case 0xe004: - case 0xe005: - case 0xe006: - case 0xe007: { - GalaxianLfoFreqWrite(a - 0xe004, d); - return; - } - - case 0xe800: - case 0xe801: - case 0xe802: - case 0xe803: - case 0xe804: - case 0xe805: - case 0xe806: - case 0xe807: { - GalaxianSoundWrite(a - 0xe800, d); - return; - } - - case 0xf001: { - GalIrqFire = d & 1; - return; - } - - case 0xf004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xf006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xf007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xf800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall DambustrZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall DambustrZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -static void DambustrPostLoad() -{ - UINT8 Temp; - - GalTempRom = (UINT8*)BurnMalloc(0x4000); - memcpy(GalTempRom, GalZ80Rom1, 0x4000); - for (INT32 i = 0; i < 0x4000; i++) { - GalZ80Rom1[i] = GalTempRom[BITSWAP16(i, 15, 14, 13, 12, 4, 10, 9, 8, 7, 6, 5, 3, 11, 2, 1, 0)]; - } - BurnFree(GalTempRom); - - for (INT32 i = 0; i < 0x1000; i++) { - Temp = GalZ80Rom1[0x5000 + i]; - GalZ80Rom1[0x5000 + i] = GalZ80Rom1[0x6000 + i]; - GalZ80Rom1[0x6000 + i] = GalZ80Rom1[0x1000 + i]; - GalZ80Rom1[0x1000 + i] = Temp; - } - - for (INT32 i = 0; i < 0x1000; i++) { - GalZ80Rom1[0x1000 + i] = BITSWAP08(GalZ80Rom1[0x1000 + i], 7, 6, 5, 1, 3, 2, 4, 0); - GalZ80Rom1[0x4000 + i] = BITSWAP08(GalZ80Rom1[0x4000 + i], 7, 6, 5, 1, 3, 2, 4, 0); - GalZ80Rom1[0x5000 + i] = BITSWAP08(GalZ80Rom1[0x5000 + i], 7, 6, 5, 1, 3, 2, 4, 0); - } - - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(DambustrZ80Read); - ZetSetWriteHandler(DambustrZ80Write); - ZetSetInHandler(DambustrZ80PortRead); - ZetSetOutHandler(DambustrZ80PortWrite); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0xc000, 0xc7ff, 0, GalZ80Ram1); - ZetMapArea(0xc000, 0xc7ff, 1, GalZ80Ram1); - ZetMapArea(0xc000, 0xc7ff, 2, GalZ80Ram1); - ZetMapArea(0xd000, 0xd3ff, 0, GalVideoRam); - ZetMapArea(0xd000, 0xd3ff, 1, GalVideoRam); - ZetMapArea(0xd000, 0xd3ff, 2, GalVideoRam); - ZetMapArea(0xd400, 0xd7ff, 0, GalVideoRam); - ZetMapArea(0xd400, 0xd7ff, 1, GalVideoRam); - ZetMapArea(0xd400, 0xd7ff, 2, GalVideoRam); - ZetMapArea(0xd800, 0xd8ff, 0, GalSpriteRam); - ZetMapArea(0xd800, 0xd8ff, 2, GalSpriteRam); - ZetMemEnd(); - ZetClose(); -} - -static INT32 DambustrInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = DambustrPostLoad; - - nRet = GalInit(); - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - UINT8 Temp[16]; - nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x2000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; - nRet = BurnLoadRom(GalTempRom + 0x3000, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); if (nRet) return 1; - for (UINT32 i = 0; i < GalTilesSharedRomSize; i += 16) { - UINT32 j; - - for (j = 0; j < 16; j++) { - Temp[j] = GalTempRom[i + j]; - } - - for (j = 0; j < 8; j++) { - GalTempRom[i + j + 0] = Temp[(j * 2) + 0]; - GalTempRom[i + j + 8] = Temp[(j * 2) + 1]; - } - } - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - - GalCalcPaletteFunction = DambustrCalcPalette; - GalRenderBackgroundFunction = DambustrDrawBackground; - GalDrawBulletsFunction = DambustrDrawBullets; - GalExtendTileInfoFunction = DambustrExtendTileInfo; - GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; - GalRenderFrameFunction = DambustrRenderFrame; - - GalSpriteClipStart = 0; - GalSpriteClipEnd = 255; - - GalVideoRam2 = (UINT8*)BurnMalloc(0x400); - - return nRet; -} - -struct BurnDriver BurnDrvDambustr = { - "dambustr", NULL, NULL, NULL, "1981", - "Dambusters (US, set 1)\0", NULL, "South West Research", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, DambustrRomInfo, DambustrRomName, NULL, NULL, DambustrInputInfo, DambustrDIPInfo, - DambustrInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvDambustra = { - "dambustra", "dambustr", NULL, NULL, "1981", - "Dambusters (US, set 2)\0", NULL, "South West Research", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, DambustraRomInfo, DambustraRomName, NULL, NULL, DambustrInputInfo, DambustrDIPInfo, - DambustrInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvDambustruk = { - "dambustruk", "dambustr", NULL, NULL, "1981", - "Dambusters (UK)\0", NULL, "South West Research", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, - NULL, DambustrukRomInfo, DambustrukRomName, NULL, NULL, DambustrInputInfo, DambustrDIPInfo, - DambustrInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -// S2650 Based Games -static struct BurnRomInfo HunchbkgRomDesc[] = { - { "gal_hb_kl", 0x00800, 0x3977650e, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "gal_hb_hj", 0x00800, 0xdb489c3d, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "gal_hb_cp", 0x00020, 0xcbff6762, BRF_GRA | GAL_ROM_PROM }, - - { "gal_hb_1", 0x00800, 0x46590e9b, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "gal_hb_2", 0x00800, 0x4e6e671c, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "gal_hb_3", 0x00800, 0xd29dc242, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "gal_hb_4", 0x00800, 0xd409d292, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "gal_hb_5", 0x00800, 0x29d3a8c4, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "gal_hb_6", 0x00800, 0xb016fd15, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "gal_hb_7", 0x00800, 0xd2731d27, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "gal_hb_8", 0x00800, 0xe4b1a666, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, -}; - -STD_ROM_PICK(Hunchbkg) -STD_ROM_FN(Hunchbkg) - -static struct BurnRomInfo DrivfrcgRomDesc[] = { - { "dfgj2.bin", 0x01000, 0x8e19f1e7, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "dfgj1.bin", 0x01000, 0x86b60ca8, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "dfgl2.bin", 0x01000, 0xea5e9959, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "dfgl1.bin", 0x01000, 0xb7ed195c, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "top.clr", 0x00020, 0x3110ddae, BRF_GRA | GAL_ROM_PROM }, - { "bot.clr", 0x00020, 0x0f0782af, BRF_GRA | GAL_ROM_PROM }, - - { "dfgp1.bin", 0x01000, 0x52d5e77d, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "dfgp2.bin", 0x01000, 0x9cf4dbce, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "dfgp3.bin", 0x01000, 0x79763f62, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "dfgp4.bin", 0x01000, 0xdd95338b, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, -}; - -STD_ROM_PICK(Drivfrcg) -STD_ROM_FN(Drivfrcg) - -static struct BurnRomInfo DrivfrctRomDesc[] = { - { "01.bin", 0x02000, 0x300a6750, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "02.bin", 0x02000, 0xf04e14c4, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "tbp18s030.02", 0x00020, 0x3110ddae, BRF_GRA | GAL_ROM_PROM }, - { "tbp18s030.01", 0x00020, 0x0f0782af, BRF_GRA | GAL_ROM_PROM }, - - { "03.bin", 0x04000, 0x9ab604cb, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - - { "tbp24s10.bin", 0x00100, 0x8c0d886d, BRF_OPT }, - { "tbp28s42.bin", 0x00200, 0x9b8f310a, BRF_OPT }, -}; - -STD_ROM_PICK(Drivfrct) -STD_ROM_FN(Drivfrct) - -static struct BurnRomInfo DrivfrcbRomDesc[] = { - { "df1.bin", 0x02000, 0x8adc3de0, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "df2.bin", 0x02000, 0x6d95ec35, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "top.clr", 0x00020, 0x3110ddae, BRF_GRA | GAL_ROM_PROM }, - { "bot.clr", 0x00020, 0x0f0782af, BRF_GRA | GAL_ROM_PROM }, - - { "dfp.bin", 0x04000, 0xb5b2981d, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, -}; - -STD_ROM_PICK(Drivfrcb) -STD_ROM_FN(Drivfrcb) - -static struct BurnRomInfo RacknrolRomDesc[] = { - { "horz_g.bin", 0x04000, 0x97069ad5, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "horz_r.bin", 0x04000, 0xff64e84b, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.bin", 0x00020, 0x737802bf, BRF_GRA | GAL_ROM_PROM }, - - { "horz_p.bin", 0x04000, 0x32ca5b43, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - - { "82s147.bin", 0x00200, 0xaace7fa5, BRF_OPT }, // unknown -}; - -STD_ROM_PICK(Racknrol) -STD_ROM_FN(Racknrol) - -static struct BurnRomInfo HexpoolRomDesc[] = { - { "vert_g.bin", 0x04000, 0x7e257e80, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "vert_r.bin", 0x04000, 0xc5f0851e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.bin", 0x00020, 0x737802bf, BRF_GRA | GAL_ROM_PROM }, - - { "vert_p.bin", 0x04000, 0xbdb078fc, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - - { "82s147.bin", 0x00200, 0xaace7fa5, BRF_OPT }, // unknown -}; - -STD_ROM_PICK(Hexpool) -STD_ROM_FN(Hexpool) - -static struct BurnRomInfo HexpoolaRomDesc[] = { - { "rom.1m", 0x04000, 0x7e257e80, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "rom.1l", 0x04000, 0xc5f0851e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "82s123.11r", 0x00020, 0xdeb2fcf4, BRF_GRA | GAL_ROM_PROM }, - - { "rom.4l", 0x04000, 0x2ca8018d, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - - { "82s147.5pr", 0x00200, 0xcf496b1e, BRF_OPT }, // unknown - - { "82s153.6pr.bin",0x000eb, 0xbc07939a, BRF_OPT }, // PLD -}; - -STD_ROM_PICK(Hexpoola) -STD_ROM_FN(Hexpoola) - -static struct BurnRomInfo HunchbksRomDesc[] = { - { "11d_snd.bin", 0x00800, 0x88226086, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "5f_hb09.bin", 0x00800, 0xdb489c3d, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "5h_hb10.bin", 0x00800, 0x3977650e, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "6e_prom.bin", 0x00020, 0x01004d3f, BRF_GRA | GAL_ROM_PROM }, - - { "2c_hb01.bin", 0x00800, 0x8bebd834, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "2e_hb02.bin", 0x00800, 0x07de4229, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "2f_hb03.bin", 0x00800, 0xb75a0dfc, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "2h_hb04.bin", 0x00800, 0xf3206264, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "2j_hb05.bin", 0x00800, 0x1bb78728, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "2l_hb06.bin", 0x00800, 0xf25ed680, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "2m_hb07.bin", 0x00800, 0xc72e0e17, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "2p_hb08.bin", 0x00800, 0x412087b0, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, -}; - -STD_ROM_PICK(Hunchbks) -STD_ROM_FN(Hunchbks) - -static struct BurnRomInfo HncholmsRomDesc[] = { - { "hncholym.5c", 0x00800, 0xe7758775, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, - - { "hncholym.5f", 0x01000, 0x75ad3542, BRF_GRA | GAL_ROM_TILES_SHARED }, - { "hncholym.5h", 0x01000, 0x6fec9dd3, BRF_GRA | GAL_ROM_TILES_SHARED }, - - { "prom.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, - - { "hncholym.2d", 0x00800, 0xfb453f9c, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "hncholym.2e", 0x00800, 0xb1429420, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "hncholym.2f", 0x00800, 0xafc98e28, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "hncholym.2h", 0x00800, 0x6785bf17, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "hncholym.2j", 0x00800, 0x0e1e4133, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "hncholym.2l", 0x00800, 0x6e982609, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "hncholym.2m", 0x00800, 0xb9141914, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - { "hncholym.2p", 0x00800, 0xca37b55b, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, - - { "82s147.1a", 0x00200, 0xd461a48b, BRF_OPT }, -}; - -STD_ROM_PICK(Hncholms) -STD_ROM_FN(Hncholms) - -UINT8 HunchbkgS2650Read(UINT16 Address) -{ - switch (Address) { - case 0x1500: - case 0x3500: - case 0x5500: - case 0x7500: { - return GalInput[0] | GalDip[0]; - } - - case 0x1580: - case 0x3580: - case 0x5580: - case 0x7580: { - return GalInput[1] | GalDip[1]; - } - - case 0x1600: - case 0x3600: - case 0x5600: - case 0x7600: { - return GalInput[2] | GalDip[2]; - } - - case 0x1680: - case 0x3680: - case 0x5680: - case 0x7680: { - // ??? - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Read %04x\n"), Address); - } - } - - return 0; -} - -void HunchbkgS2650Write(UINT16 Address, UINT8 Data) -{ - if ((Address >= 0x1480 && Address <= 0x14ff) || (Address >= 0x3480 && Address <= 0x34ff) || (Address >= 0x5480 && Address <= 0x54ff) || (Address >= 0x7480 && Address <= 0x74ff)) { - INT32 Offset = Address & 0x7f; - - GalSpriteRam[Offset] = Data; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = Data; - } - } - - return; - } - - switch (Address) { - case 0x1503: - case 0x3503: - case 0x5503: - case 0x7503: { - // coin_count_0_w - return; - } - - case 0x1580: - case 0x1581: - case 0x1582:{ - GalaxianSoundWrite(Address - 0x1580, Data); - return; - } - - case 0x3580: - case 0x3581: - case 0x3582:{ - GalaxianSoundWrite(Address - 0x3580, Data); - return; - } - - case 0x5580: - case 0x5581: - case 0x5582:{ - GalaxianSoundWrite(Address - 0x5580, Data); - return; - } - - case 0x7580: - case 0x7581: - case 0x7582:{ - GalaxianSoundWrite(Address - 0x7580, Data); - return; - } - - case 0x1583: - case 0x3583: - case 0x5583: - case 0x7583: { - // nop - return; - } - - case 0x1584: - case 0x1585: - case 0x1586: - case 0x1587: { - GalaxianLfoFreqWrite(Address - 0x1584, Data); - return; - } - - case 0x3584: - case 0x3585: - case 0x3586: - case 0x3587: { - GalaxianLfoFreqWrite(Address - 0x3584, Data); - return; - } - - case 0x5584: - case 0x5585: - case 0x5586: - case 0x5587: { - GalaxianLfoFreqWrite(Address - 0x5584, Data); - return; - } - - case 0x7584: - case 0x7585: - case 0x7586: - case 0x7587: { - GalaxianLfoFreqWrite(Address - 0x7584, Data); - return; - } - - case 0x1600: - case 0x3600: - case 0x5600: - case 0x7600: { - // nop - return; - } - - case 0x1601: - case 0x3601: - case 0x5601: - case 0x7601: { - // nop - return; - } - - case 0x1604: - case 0x3604: - case 0x5604: - case 0x7604: { - // nop - return; - } - - case 0x1606: - case 0x3606: - case 0x5606: - case 0x7606: { - GalFlipScreenX = Data & 1; - return; - } - - case 0x1607: - case 0x3607: - case 0x5607: - case 0x7607: { - GalFlipScreenY = Data & 1; - return; - } - - case 0x1680: - case 0x3680: - case 0x5680: - case 0x7680: { - GalPitch = Data; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Write %04x, %02x\n"), Address, Data); - } - } -} - -UINT8 HunchbkgS2650PortRead(UINT16 Port) -{ - switch (Port) { - case S2650_DATA_PORT: { - // nop - return 0; - } - - case S2650_SENSE_PORT: { - return GalVBlank ? 0x80 : 0x00; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); - } - } - - return 0; -} - -void HunchbkgS2650PortWrite(UINT16 Port, UINT8 Data) -{ - switch (Port) { - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Write %04x, %02x\n"), Port, Data); - } - } -} - -UINT8 DrivfrcgS2650Read(UINT16 Address) -{ - switch (Address) { - case 0x1500: - case 0x3500: - case 0x5500: - case 0x7500: { - return GalInput[0] | GalDip[0]; - } - - case 0x1580: - case 0x3580: - case 0x5580: - case 0x7580: { - return GalInput[1] | GalDip[1]; - } - - case 0x1600: - case 0x3600: - case 0x5600: - case 0x7600: { - return GalInput[2] | GalDip[2]; - } - - case 0x1700: - case 0x3700: - case 0x5700: - case 0x7700: { - return GalInput[3] | GalDip[3]; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Read %04x\n"), Address); - } - } - - return 0; -} - -void DrivfrcgS2650Write(UINT16 Address, UINT8 Data) -{ - if ((Address >= 0x1480 && Address <= 0x14ff) || (Address >= 0x3480 && Address <= 0x34ff) || (Address >= 0x5480 && Address <= 0x54ff) || (Address >= 0x7480 && Address <= 0x74ff)) { - INT32 Offset = Address & 0x7f; - - GalSpriteRam[Offset] = Data; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = Data; - } - } - - return; - } - - switch (Address) { - case 0x1503: - case 0x3503: - case 0x5503: - case 0x7503: { - // coin_count_0_w - return; - } - - case 0x1580: - case 0x1581: - case 0x1582:{ - GalaxianSoundWrite(Address - 0x1580, Data); - return; - } - - case 0x3580: - case 0x3581: - case 0x3582:{ - GalaxianSoundWrite(Address - 0x3580, Data); - return; - } - - case 0x5580: - case 0x5581: - case 0x5582:{ - GalaxianSoundWrite(Address - 0x5580, Data); - return; - } - - case 0x7580: - case 0x7581: - case 0x7582:{ - GalaxianSoundWrite(Address - 0x7580, Data); - return; - } - - case 0x1583: - case 0x3583: - case 0x5583: - case 0x7583: { - // nop - return; - } - - case 0x1585: - case 0x3585: - case 0x5585: - case 0x7585: { - // nop - return; - } - - case 0x1586: - case 0x1587: { - GalaxianLfoFreqWrite(Address - 0x1586, Data); - return; - } - - case 0x3586: - case 0x3587: { - GalaxianLfoFreqWrite(Address - 0x3586, Data); - return; - } - - case 0x5586: - case 0x5587: { - GalaxianLfoFreqWrite(Address - 0x5586, Data); - return; - } - - case 0x7586: - case 0x7587: { - GalaxianLfoFreqWrite(Address - 0x7586, Data); - return; - } - - case 0x1600: - case 0x3600: - case 0x5600: - case 0x7600: { - GalPitch = Data; - return; - } - - case 0x1700: - case 0x1701: { - // nop - return; - } - - case 0x1704: - case 0x1705: - case 0x1706: - case 0x1707: - case 0x3704: - case 0x3705: - case 0x3706: - case 0x3707: - case 0x5704: - case 0x5705: - case 0x5706: - case 0x5707: - case 0x7704: - case 0x7705: - case 0x7706: - case 0x7707: { - INT32 Offset = Address & 0x03; - GalVol = (GalVol & ~(1 << Offset)) | ((Data & 1) << Offset); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Write %04x, %02x\n"), Address, Data); - } - } -} - -UINT8 DrivfrcgS2650PortRead(UINT16 Port) -{ - switch (Port) { - case 0x00: { - switch (s2650GetPc()) { - case 0x02e: - case 0x297: { - return 0x01; - } - } - bprintf(PRINT_NORMAL, _T("%x\n"), s2650GetPc()); - return 0x00; - } - - case S2650_SENSE_PORT: { - return GalVBlank ? 0x80 : 0x00; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); - } - } - - return 0; -} - -void DrivfrcgS2650PortWrite(UINT16 Port, UINT8 Data) -{ - switch (Port) { - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Write %04x, %02x\n"), Port, Data); - } - } -} - -UINT8 RacknrolS2650Read(UINT16 Address) -{ - switch (Address) { - case 0x1500: - case 0x3500: - case 0x5500: - case 0x7500: { - return GalInput[0] | GalDip[0]; - } - - case 0x1580: - case 0x3580: - case 0x5580: - case 0x7580: { - return GalInput[1] | GalDip[1]; - } - - case 0x1600: - case 0x3600: - case 0x5600: - case 0x7600: { - return GalInput[2] | GalDip[2]; - } - - case 0x1680: - case 0x3680: - case 0x5680: - case 0x7680: { - // ??? - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Read %04x\n"), Address); - } - } - - return 0; -} - -void RacknrolS2650Write(UINT16 Address, UINT8 Data) -{ - if ((Address >= 0x1400 && Address <= 0x14ff) || (Address >= 0x3400 && Address <= 0x34ff) || (Address >= 0x5400 && Address <= 0x54ff) || (Address >= 0x7400 && Address <= 0x74ff)) { - INT32 Offset = Address & 0xff; - - GalSpriteRam[Offset] = Data; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = Data; - } - } - - return; - } - - switch (Address) { - case 0x1601: - case 0x3601: - case 0x5601: - case 0x7601: { - // nop - return; - } - - case 0x1606: - case 0x3606: - case 0x5606: - case 0x7606: { - GalFlipScreenX = Data & 1; - return; - } - - case 0x1607: - case 0x3607: - case 0x5607: - case 0x7607: { - GalFlipScreenY = Data & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Write %04x, %02x\n"), Address, Data); - } - } -} - -UINT8 RacknrolS2650PortRead(UINT16 Port) -{ - switch (Port) { - case S2650_SENSE_PORT: { - return GalVBlank ? 0x80 : 0x00; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); - } - } - - return 0; -} - -void RacknrolS2650PortWrite(UINT16 Port, UINT8 Data) -{ - if (Port >= 0x0020 && Port <= 0x003f) { - GalGfxBank[Port - 0x0020] = Data; - return; - } - - switch (Port) { - case 0x001d: { - SN76496Write(0, Data); - return; - } - - case 0x001e: { - SN76496Write(1, Data); - return; - } - - case 0x001f: { - SN76496Write(2, Data); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Write %04x, %02x\n"), Port, Data); - } - } -} - -UINT8 HexpoolaS2650PortRead(UINT16 Port) -{ - switch (Port) { - case 0x0000: { - // nop - return 0; - } - - case S2650_DATA_PORT: { - switch (s2650GetPc()) { - case 0x22: return 0x00; - case 0x31: return 0x01; - } - return 0; - } - - case S2650_SENSE_PORT: { - return GalVBlank ? 0x80 : 0x00; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); - } - } - - return 0; -} - -void HexpoolaS2650PortWrite(UINT16 Port, UINT8 Data) -{ - if (Port >= 0x0020 && Port <= 0x003f) { - GalGfxBank[Port - 0x0020] = Data; - return; - } - - switch (Port) { - case S2650_DATA_PORT: { - SN76496Write(0, Data); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Write %04x, %02x\n"), Port, Data); - } - } -} - -UINT8 HunchbksS2650Read(UINT16 Address) -{ - switch (Address) { - case 0x1210: - case 0x1211: - case 0x1212: - case 0x1213: - case 0x3210: - case 0x3211: - case 0x3212: - case 0x3213: - case 0x5210: - case 0x5211: - case 0x5212: - case 0x5213: - case 0x7210: - case 0x7211: - case 0x7212: - case 0x7213: { - return ppi8255_r(0, Address & 0x03); - } - - case 0x1500: - case 0x1501: - case 0x1502: - case 0x1503: - case 0x3500: - case 0x3501: - case 0x3502: - case 0x3503: - case 0x5500: - case 0x5501: - case 0x5502: - case 0x5503: - case 0x7500: - case 0x7501: - case 0x7502: - case 0x7503: { - return ppi8255_r(0, Address & 0x03); - } - - case 0x1680: - case 0x3680: - case 0x5680: - case 0x7680: { - // watchdog read - return 0; - } - - case 0x1780: - case 0x3780: - case 0x5780: - case 0x7780: { - // watchdog read - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Read %04x\n"), Address); - } - } - - return 0; -} - -void HunchbksS2650Write(UINT16 Address, UINT8 Data) -{ - if ((Address >= 0x1400 && Address <= 0x14ff) || (Address >= 0x3400 && Address <= 0x34ff) || (Address >= 0x5400 && Address <= 0x54ff) || (Address >= 0x7400 && Address <= 0x74ff)) { - INT32 Offset = Address & 0xff; - - GalSpriteRam[Offset] = Data; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = Data; - } - } - - return; - } - - switch (Address) { - case 0x1210: - case 0x1211: - case 0x1212: - case 0x1213: - case 0x3210: - case 0x3211: - case 0x3212: - case 0x3213: - case 0x5210: - case 0x5211: - case 0x5212: - case 0x5213: - case 0x7210: - case 0x7211: - case 0x7212: - case 0x7213: { - ppi8255_w(1, Address & 0x03, Data); - return; - } - - case 0x1500: - case 0x1501: - case 0x1502: - case 0x1503: - case 0x3500: - case 0x3501: - case 0x3502: - case 0x3503: - case 0x5500: - case 0x5501: - case 0x5502: - case 0x5503: - case 0x7500: - case 0x7501: - case 0x7502: - case 0x7503: { - ppi8255_w(0, Address & 0x03, Data); - return; - } - - case 0x1600: - case 0x3600: - case 0x5600: - case 0x7600: { - // nop - return; - } - - case 0x1601: - case 0x3601: - case 0x5601: - case 0x7601: { - // nop - return; - } - - case 0x1606: - case 0x3606: - case 0x5606: - case 0x7606: { - GalFlipScreenX = Data & 1; - return; - } - - case 0x1607: - case 0x3607: - case 0x5607: - case 0x7607: { - GalFlipScreenY = Data & 1; - return; - } - - case 0x1700: - case 0x1701: { - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Write %04x, %02x\n"), Address, Data); - } - } -} - -UINT8 HunchbksS2650PortRead(UINT16 Port) -{ - switch (Port) { - case S2650_DATA_PORT: { - // nop - return 0; - } - - case S2650_SENSE_PORT: { - return GalVBlank ? 0x80 : 0x00; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); - } - } - - return 0; -} - -void HunchbksS2650PortWrite(UINT16 Port, UINT8 Data) -{ - switch (Port) { - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Write %04x, %02x\n"), Port, Data); - } - } -} - -UINT8 HncholmsS2650PortRead(UINT16 Port) -{ - switch (Port) { - case 0x0000: { - switch (s2650GetPc()) { - case 0x02b: return 1; - case 0xa27: return 1; - } - return 0; - } - - case S2650_DATA_PORT: { - // nop - return 0; - } - - case S2650_SENSE_PORT: { - return GalVBlank ? 0x80 : 0x00; - } - - default: { - bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); - } - } - - return 0; -} - -static INT32 GalS2650ReturnVector(INT32) -{ - return 0x03; -} - -static void S2650PostLoad() -{ - s2650Init(1); - s2650Open(0); - s2650MapMemory(GalS2650Rom1 + 0x0000, 0x0000, 0x0fff, S2650_ROM); - s2650MapMemory(GalSpriteRam, 0x1480, 0x14ff, S2650_READ); - s2650MapMemory(GalVideoRam, 0x1800, 0x1bff, S2650_RAM); - s2650MapMemory(GalZ80Ram1, 0x1c00, 0x1fff, S2650_RAM); - s2650MapMemory(GalS2650Rom1 + 0x1000, 0x2000, 0x2fff, S2650_ROM); - s2650MapMemory(GalSpriteRam, 0x3480, 0x34ff, S2650_READ); - s2650MapMemory(GalVideoRam, 0x3800, 0x3bff, S2650_RAM); - s2650MapMemory(GalZ80Ram1, 0x3c00, 0x3fff, S2650_RAM); - s2650MapMemory(GalS2650Rom1 + 0x2000, 0x4000, 0x4fff, S2650_ROM); - s2650MapMemory(GalSpriteRam, 0x5480, 0x54ff, S2650_READ); - s2650MapMemory(GalVideoRam, 0x5800, 0x5bff, S2650_RAM); - s2650MapMemory(GalZ80Ram1, 0x5c00, 0x5fff, S2650_RAM); - s2650MapMemory(GalS2650Rom1 + 0x3000, 0x6000, 0x6fff, S2650_ROM); - s2650MapMemory(GalSpriteRam, 0x7480, 0x74ff, S2650_READ); - s2650MapMemory(GalVideoRam, 0x7800, 0x7bff, S2650_RAM); - s2650MapMemory(GalZ80Ram1, 0x7c00, 0x7fff, S2650_RAM); - s2650SetReadHandler(HunchbkgS2650Read); - s2650SetWriteHandler(HunchbkgS2650Write); - s2650SetInHandler(HunchbkgS2650PortRead); - s2650SetOutHandler(HunchbkgS2650PortWrite); - s2650SetIrqCallback(GalS2650ReturnVector); - s2650Close(); -} - -static INT32 HunchbkgInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = S2650PostLoad; - - nRet = GalInit(); - - return nRet; -} - -static void DrivfrcgPostLoad() -{ - GalTempRom = (UINT8*)BurnMalloc(GalS2650Rom1Size); - memcpy(GalTempRom, GalS2650Rom1, GalS2650Rom1Size); - memcpy(GalS2650Rom1 + 0x1800, GalTempRom + 0x0000, 0x400); - memcpy(GalS2650Rom1 + 0x1c00, GalTempRom + 0x0400, 0x400); - memcpy(GalS2650Rom1 + 0x0000, GalTempRom + 0x0800, 0x400); - memcpy(GalS2650Rom1 + 0x0400, GalTempRom + 0x0c00, 0x400); - memcpy(GalS2650Rom1 + 0x0800, GalTempRom + 0x1000, 0x400); - memcpy(GalS2650Rom1 + 0x0c00, GalTempRom + 0x1400, 0x400); - memcpy(GalS2650Rom1 + 0x1000, GalTempRom + 0x1800, 0x400); - memcpy(GalS2650Rom1 + 0x1400, GalTempRom + 0x1c00, 0x400); - memcpy(GalS2650Rom1 + 0x3800, GalTempRom + 0x2000, 0x400); - memcpy(GalS2650Rom1 + 0x3c00, GalTempRom + 0x2400, 0x400); - memcpy(GalS2650Rom1 + 0x2000, GalTempRom + 0x2800, 0x400); - memcpy(GalS2650Rom1 + 0x2400, GalTempRom + 0x2c00, 0x400); - memcpy(GalS2650Rom1 + 0x2800, GalTempRom + 0x3000, 0x400); - memcpy(GalS2650Rom1 + 0x2c00, GalTempRom + 0x3400, 0x400); - memcpy(GalS2650Rom1 + 0x3000, GalTempRom + 0x3800, 0x400); - memcpy(GalS2650Rom1 + 0x3400, GalTempRom + 0x3c00, 0x400); - BurnFree(GalTempRom); - - S2650PostLoad(); - s2650Open(0); - s2650SetReadHandler(DrivfrcgS2650Read); - s2650SetWriteHandler(DrivfrcgS2650Write); - s2650SetInHandler(DrivfrcgS2650PortRead); - s2650SetOutHandler(DrivfrcgS2650PortWrite); - s2650Close(); -} - -static INT32 DrivfrcgInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = DrivfrcgPostLoad; - - nRet = GalInit(); - - GalCalcPaletteFunction = RockclimCalcPalette; - GalExtendTileInfoFunction = Ad2083ExtendTileInfo; - GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; - - return nRet; -} - -static INT32 DrivfrcbInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = DrivfrcgPostLoad; - - nRet = GalInit(); - - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - UINT8 *TempRom = (UINT8*)BurnMalloc(0x2000); - nRet = BurnLoadRom(TempRom, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x1000, TempRom + 0x0000, 0x1000); - memcpy(GalTempRom + 0x0000, TempRom + 0x1000, 0x1000); - nRet = BurnLoadRom(TempRom, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; - memcpy(GalTempRom + 0x3000, TempRom + 0x0000, 0x1000); - memcpy(GalTempRom + 0x2000, TempRom + 0x1000, 0x1000); - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - BurnFree(TempRom); - - GalCalcPaletteFunction = RockclimCalcPalette; - GalExtendTileInfoFunction = Ad2083ExtendTileInfo; - GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; - - return nRet; -} - -static void RacknrolPostLoad() -{ - s2650Init(1); - s2650Open(0); - s2650MapMemory(GalS2650Rom1 + 0x0000, 0x0000, 0x0fff, S2650_ROM); - s2650MapMemory(GalSpriteRam, 0x1400, 0x14ff, S2650_READ); - s2650MapMemory(GalVideoRam, 0x1800, 0x1bff, S2650_RAM); - s2650MapMemory(GalZ80Ram1, 0x1c00, 0x1fff, S2650_RAM); - s2650MapMemory(GalS2650Rom1 + 0x1000, 0x2000, 0x2fff, S2650_ROM); - s2650MapMemory(GalSpriteRam, 0x3400, 0x34ff, S2650_READ); - s2650MapMemory(GalVideoRam, 0x3800, 0x3bff, S2650_RAM); - s2650MapMemory(GalZ80Ram1, 0x3c00, 0x3fff, S2650_RAM); - s2650MapMemory(GalS2650Rom1 + 0x2000, 0x4000, 0x4fff, S2650_ROM); - s2650MapMemory(GalSpriteRam, 0x5400, 0x54ff, S2650_READ); - s2650MapMemory(GalVideoRam, 0x5800, 0x5bff, S2650_RAM); - s2650MapMemory(GalZ80Ram1, 0x5c00, 0x5fff, S2650_RAM); - s2650MapMemory(GalS2650Rom1 + 0x3000, 0x6000, 0x6fff, S2650_ROM); - s2650MapMemory(GalSpriteRam, 0x7400, 0x74ff, S2650_READ); - s2650MapMemory(GalVideoRam, 0x7800, 0x7bff, S2650_RAM); - s2650MapMemory(GalZ80Ram1, 0x7c00, 0x7fff, S2650_RAM); - s2650SetReadHandler(RacknrolS2650Read); - s2650SetWriteHandler(RacknrolS2650Write); - s2650SetInHandler(RacknrolS2650PortRead); - s2650SetOutHandler(RacknrolS2650PortWrite); - s2650SetIrqCallback(GalS2650ReturnVector); - s2650Close(); -} - -static INT32 RacknrolInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = RacknrolPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496; - - nRet = GalInit(); - - GalExtendTileInfoFunction = RacknrolExtendTileInfo; - - return nRet; -} - -static void HexpoolaPostLoad() -{ - RacknrolPostLoad(); - - s2650Open(0); - s2650SetInHandler(HexpoolaS2650PortRead); - s2650SetOutHandler(HexpoolaS2650PortWrite); - s2650Close(); -} - -static INT32 HexpoolaInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = HexpoolaPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_HEXPOOLASN76496; - - nRet = GalInit(); - - GalExtendTileInfoFunction = RacknrolExtendTileInfo; - - return nRet; -} - -static void HunchbksPostLoad() -{ - RacknrolPostLoad(); - s2650Open(0); - s2650SetReadHandler(HunchbksS2650Read); - s2650SetWriteHandler(HunchbksS2650Write); - s2650SetInHandler(HunchbksS2650PortRead); - s2650SetOutHandler(HunchbksS2650PortWrite); - s2650Close(); - - ZetInit(0); -} - -static INT32 HunchbksInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = HunchbksPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910; - - nRet = GalInit(); - HunchbksSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - - KonamiPPIInit(); - PPI1PortWriteB = HunchbksSoundControlWrite; - - return nRet; -} - -static void HncholmsPostLoad() -{ - RacknrolPostLoad(); - s2650Open(0); - s2650SetReadHandler(HunchbksS2650Read); - s2650SetWriteHandler(HunchbksS2650Write); - s2650SetInHandler(HncholmsS2650PortRead); - s2650SetOutHandler(HunchbksS2650PortWrite); - s2650Close(); - - ZetInit(0); -} - -static INT32 HncholmsInit() -{ - INT32 nRet; - - GalPostLoadCallbackFunction = HncholmsPostLoad; - GalSoundType = GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910; - - nRet = GalInit(); - HunchbksSoundInit(); - - GalRenderBackgroundFunction = ScrambleDrawBackground; - GalDrawBulletsFunction = ScrambleDrawBullets; - GalExtendTileInfoFunction = Batman2ExtendTileInfo; - GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; - - nGalCyclesTotal[0] = (18432000 / 6 / 2 / 2) / 60; - - KonamiPPIInit(); - PPI1PortWriteB = HunchbksSoundControlWrite; - - return nRet; -} - -struct BurnDriver BurnDrvHunchbkg = { - "hunchbkg", "hunchbak", NULL, NULL, "1981", - "Hunchback (Galaxian hardware)\0", NULL, "Century Electronics", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, HunchbkgRomInfo, HunchbkgRomName, NULL, NULL, HunchbkgInputInfo, HunchbkgDIPInfo, - HunchbkgInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvDrivfrcg = { - "drivfrcg", "drivfrcp", NULL, NULL, "1984", - "Driving Force (Galaxian conversion)\0", NULL, "Shinkai Inc. (Magic Eletronics USA licence)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_RACING, 0, - NULL, DrivfrcgRomInfo, DrivfrcgRomName, NULL, NULL, DrivfrcgInputInfo, DrivfrcgDIPInfo, - DrivfrcgInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvDrivfrct = { - "drivfrct", "drivfrcp", NULL, NULL, "1985", - "Top Racer (bootleg of Driving Force)\0", NULL, "bootleg (EMT Germany)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_RACING, 0, - NULL, DrivfrctRomInfo, DrivfrctRomName, NULL, NULL, DrivfrcgInputInfo, DrivfrcgDIPInfo, - DrivfrcbInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvDrivfrcb = { - "drivfrcb", "drivfrcp", NULL, NULL, "1985", - "Driving Force (Galaxian conversion bootleg)\0", NULL, "bootleg (Elsys Software)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_RACING, 0, - NULL, DrivfrcbRomInfo, DrivfrcbRomName, NULL, NULL, DrivfrcgInputInfo, DrivfrcgDIPInfo, - DrivfrcbInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvRacknrol = { - "racknrol", NULL, NULL, NULL, "1986", - "Rack + Roll\0", NULL, "Status (Shinkai License)", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, - NULL, RacknrolRomInfo, RacknrolRomName, NULL, NULL, RacknrolInputInfo, RacknrolDIPInfo, - RacknrolInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvHexpool = { - "hexpool", "racknrol", NULL, NULL, "1986", - "Hex Pool (Shinkai)\0", NULL, "Shinkai", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, - NULL, HexpoolRomInfo, HexpoolRomName, NULL, NULL, RacknrolInputInfo, RacknrolDIPInfo, - RacknrolInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHexpoola = { - "hexpoola", "racknrol", NULL, NULL, "1985", - "Hex Pool (Senko)\0", NULL, "Senko", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, - NULL, HexpoolaRomInfo, HexpoolaRomName, NULL, NULL, RacknrolInputInfo, RacknrolDIPInfo, - HexpoolaInit, GalExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHunchbks = { - "hunchbks", "hunchbak", NULL, NULL, "1983", - "Hunchback (Scramble hardware)\0", NULL, "Century Electronics", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, - NULL, HunchbksRomInfo, HunchbksRomName, NULL, NULL, HunchbksInputInfo, HunchbksDIPInfo, - HunchbksInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHncholms = { - "hncholms", "huncholy", NULL, NULL, "1984", - "Hunchback Olympic (Scramble hardware)\0", "Imperfect Sound", "Century Electronics", "Galaxian", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, - NULL, HncholmsRomInfo, HncholmsRomName, NULL, NULL, HunchbksInputInfo, HunchbksDIPInfo, - HncholmsInit, KonamiExit, GalFrame, NULL, GalScan, - NULL, 392, 224, 256, 3, 4 -}; +#include "gal.h" + +static INT32 ScrambleInit(); + +// Input definitions (alphabetical) +#define A(a, b, c, d) {a, b, (UINT8*)(c), d} +static struct BurnInputInfo Ad2083InputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort1 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort1 + 2, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 0, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort1 + 4, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, +}; + +STDINPUTINFO(Ad2083) + +static struct BurnInputInfo AmidarInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, +}; + +STDINPUTINFO(Amidar) + +static struct BurnInputInfo AnteaterInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort2 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 6, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Anteater) + +static struct BurnInputInfo AnteatergInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort2 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort2 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort2 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort2 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort2 + 3, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Anteaterg) + +static struct BurnInputInfo AnteaterukInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Anteateruk) + +static struct BurnInputInfo AtlantisInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Atlantis) + +static struct BurnInputInfo AzurianInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 1, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 0, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 3, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 2, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 5, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , &GalFakeDip , "dip" }, +}; + +STDINPUTINFO(Azurian) + +static struct BurnInputInfo BagmanmcInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort0 + 2, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 0, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 5, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 3, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 6, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Bagmanmc) + +static struct BurnInputInfo Batman2InputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 7, "p1 fire 2" }, + + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Batman2) + +static struct BurnInputInfo BlkholeInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Blkhole) + +static struct BurnInputInfo BongoInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 5, "p1 up" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 up" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, +}; + +STDINPUTINFO(Bongo) + +static struct BurnInputInfo CalipsoInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + + {"P1 Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , GalInputPort2 + 0, "p1 fire 1" }, + + {"P2 Up" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , GalInputPort0 + 0, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Calipso) + +static struct BurnInputInfo CheckmanjInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort2 + 1, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort2 + 0, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Checkmanj) + +static struct BurnInputInfo CheckmanInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, + {"Start 1/P1 Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 0, "p2 coin" }, + {"Start 2/P1 Fire 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 4, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Checkman) + +static struct BurnInputInfo CkonggInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 6, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Ckongg) + +static struct BurnInputInfo CkongsInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Ckongs) + +static struct BurnInputInfo DambustrInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 0, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort0 + 2, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort1 + 5, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort1 + 4, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort1 + 3, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort1 + 2, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort1 + 1, "p1 fire 2" }, + {"Fire 3" , BIT_DIGITAL , GalInputPort0 + 7, "p1 fire 3" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Dambustr) + +static struct BurnInputInfo DarkplntInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + + {"Left" , BIT_DIGITAL , GalInputPort3 + 0, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort3 + 1, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 2, "p1 fire 2" }, + {"Fire 3" , BIT_DIGITAL , GalInputPort0 + 0, "p1 fire 3" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Darkplnt) + +static struct BurnInputInfo DevilfsgInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Devilfsg) + +static struct BurnInputInfo DevilfshInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Devilfsh) + +static struct BurnInputInfo DingoInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort2 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 5, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Dingo) + +static struct BurnInputInfo DkongjrmInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 5, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Dkongjrm) + +static struct BurnInputInfo DrivfrcgInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort1 + 1, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, +}; + +STDINPUTINFO(Drivfrcg) + +static struct BurnInputInfo ExplorerInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 0, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, +}; + +STDINPUTINFO(Explorer) + +static struct BurnInputInfo FantastcInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Fantastc) + +static struct BurnInputInfo Fourin1InputList[] = { + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"GM Dip 1" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, + {"SC Dip 2" , BIT_DIPSWITCH , GalDip + 4 , "dip" }, + {"GX Dip 3" , BIT_DIPSWITCH , GalDip + 5 , "dip" }, + {"GC Dip 4" , BIT_DIPSWITCH , GalDip + 6 , "dip" }, +}; + +STDINPUTINFO(Fourin1) + +static struct BurnInputInfo FroggInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 7, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Frogg) + +static struct BurnInputInfo FroggerInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Frogger) + +static struct BurnInputInfo FroggermcInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 7, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Froggermc) + +static struct BurnInputInfo GalaxianInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 7, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Galaxian) + +static struct BurnInputInfo GmgalaxInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"GM Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"GM Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"GM Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"GX Dip 1" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, + {"GX Dip 2" , BIT_DIPSWITCH , GalDip + 4 , "dip" }, + {"GX Dip 3" , BIT_DIPSWITCH , GalDip + 5 , "dip" }, + {"Game Select Switch", BIT_DIPSWITCH , &GalFakeDip , "dip" }, +}; + +STDINPUTINFO(Gmgalax) + +static struct BurnInputInfo HotshockInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort1 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort1 + 4, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 0, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort1 + 5, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, +}; + +STDINPUTINFO(Hotshock) + +static struct BurnInputInfo HunchbkgInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, + + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Hunchbkg) + +static struct BurnInputInfo HunchbksInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Hunchbks) + +static struct BurnInputInfo HustlerInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 1, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Hustler) + +static struct BurnInputInfo JumpbugInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort1 + 5, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Jumpbug) + +static struct BurnInputInfo KingballInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 7, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Fake Dip" , BIT_DIPSWITCH , &GalFakeDip , "dip" }, +}; + +STDINPUTINFO(Kingball) + +static struct BurnInputInfo CkongmcInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 1, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Ckongmc) + +static struct BurnInputInfo KongInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort1 + 5, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Kong) + +static struct BurnInputInfo LadybuggInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort2 + 5, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Ladybugg) + +static struct BurnInputInfo LeversInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort1 + 5, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + + {"P2 Up" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , GalInputPort1 + 7, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Levers) + +static struct BurnInputInfo LosttombInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort0 + 0, "p2 start" }, + + {"Left Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, + {"Left Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, + {"left Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Left Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 6, "p1 fire 1" }, + + {"Right Up" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, + {"Right Down" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, + {"Right Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right Right" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Losttomb) + +static struct BurnInputInfo LuctodayInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 7, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Luctoday) + +static struct BurnInputInfo MarsInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"P1 Left Stick Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"P1 Left Stick Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"P1 Left Stick Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"P1 Left Stick Right", BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"P1 Rght Stick Up" , BIT_DIGITAL , GalInputPort2 + 7, "p3 up" }, + {"P1 Rght Stick Down" , BIT_DIGITAL , GalInputPort2 + 5, "p3 down" }, + {"P1 Rght Stick Left" , BIT_DIGITAL , GalInputPort0 + 3, "p3 left" }, + {"P1 Rght Stick Right", BIT_DIGITAL , GalInputPort0 + 2, "p3 right" }, + + {"P2 Left Stick Up" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"P2 Left Stick Down" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"P2 Left Stick Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"P2 Left Stick Right", BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"P2 Rght Stick Up" , BIT_DIGITAL , GalInputPort3 + 7, "p4 up" }, + {"P2 Rght Stick Down" , BIT_DIGITAL , GalInputPort3 + 5, "p4 down" }, + {"P2 Rght Stick Left" , BIT_DIGITAL , GalInputPort1 + 3, "p4 left" }, + {"P2 Rght Stick Right", BIT_DIGITAL , GalInputPort1 + 2, "p4 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 1, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , &GalFakeDip , "dip" }, +}; + +STDINPUTINFO(Mars) + +static struct BurnInputInfo MoonwarInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 2, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 3, "p2 start" }, + + {"Hyper Flip / Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 2" }, + + A("Dial" , BIT_ANALOG_REL, &GalAnalogPort0 , "p1 z-axis" ), + {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort1 + 6, "p1 fire 2" }, + {"Fire 3" , BIT_DIGITAL , GalInputPort1 + 5, "p1 fire 3" }, + + A("Dial (Cocktail)" , BIT_ANALOG_REL, &GalAnalogPort1 , "p2 z-axis" ), + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 fire 1" }, + {"Fire 3 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 5, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Moonwar) + +static struct BurnInputInfo MrkougarInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Mrkougar) + +static struct BurnInputInfo MshuttleInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 5, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Mshuttle) + +static struct BurnInputInfo OmegaInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Omega) + +static struct BurnInputInfo OrbitronInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Orbitron) + +static struct BurnInputInfo Ozon1InputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + + {"P2 Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Ozon1) + +static struct BurnInputInfo PacmanblInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Pacmanbl) + +static struct BurnInputInfo Phoenxp2InputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Phoenxp2) + +static struct BurnInputInfo PicsesInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 0, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Picses) + +static struct BurnInputInfo PorterInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 1, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Porter) + +static struct BurnInputInfo RacknrolInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 5, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Racknrol) + +static struct BurnInputInfo RescueInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort2 + 6, "p2 start" }, + + {"P1 Left Stick Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, + {"P1 Left Stick Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, + {"P1 Left Stick Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"P1 Left Stick Right", BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"P1 Rght Stick Up" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, + {"P1 Rght Stick Down" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, + {"P1 Rght Stick Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"P1 Rght Stick Right", BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 0, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , &GalFakeDip , "dip" }, +}; + +STDINPUTINFO(Rescue) + +static struct BurnInputInfo RockclimInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"P1 Left Stick Up" , BIT_DIGITAL , GalInputPort1 + 4, "p1 up" }, + {"P1 Left Stick Down" , BIT_DIGITAL , GalInputPort1 + 5, "p1 down" }, + {"P1 Left Stick Left" , BIT_DIGITAL , GalInputPort1 + 2, "p1 left" }, + {"P1 Left Stick Right", BIT_DIGITAL , GalInputPort1 + 3, "p1 right" }, + {"P1 Rght Stick Up" , BIT_DIGITAL , GalInputPort0 + 4, "p2 up" }, + {"P1 Rght Stick Down" , BIT_DIGITAL , GalInputPort0 + 5, "p2 down" }, + {"P1 Rght Stick Left" , BIT_DIGITAL , GalInputPort0 + 2, "p2 left" }, + {"P1 Rght Stick Right", BIT_DIGITAL , GalInputPort0 + 3, "p2 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , &GalFakeDip , "dip" }, +}; + +STDINPUTINFO(Rockclim) + +static struct BurnInputInfo ScorpionmcInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, + {"Start 1 / Fire 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2 / Fire 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 5, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 0, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, +}; + +STDINPUTINFO(Scorpionmc) + +static struct BurnInputInfo AracnisInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort1 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 6, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 0, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH , GalDip + 3 , "dip" }, +}; + +STDINPUTINFO(Aracnis) + +static struct BurnInputInfo Scramb2InputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 2, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Scramb2) + +static struct BurnInputInfo ScramblbInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 5, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Scramblb) + +static struct BurnInputInfo ScrambleInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Scramble) + +static struct BurnInputInfo SfxInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Sfx) + +static struct BurnInputInfo SkybaseInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort2 + 6, "p1 fire 2" }, + + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 7, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Skybase) + +static struct BurnInputInfo SmooncrsInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Smooncrs) + +static struct BurnInputInfo SpdcoinInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort0 + 3, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Spdcoin) + +static struct BurnInputInfo StratgyxInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Stratgyx) + +static struct BurnInputInfo StreakngInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Streakng) + +static struct BurnInputInfo SuperbonInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort0 + 0, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort1 + 3, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort1 + 6, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Superbon) + +static struct BurnInputInfo TazmaniaInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort2 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 2, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 3, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 0, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 6, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Tazmania) + +static struct BurnInputInfo TazzmangInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1 / Fire 2" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 7, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 6, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Tazzmang) + +static struct BurnInputInfo TdpgalInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 5, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 7, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Tdpgal) + +static struct BurnInputInfo TheendInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , GalInputPort0 + 1, "p1 fire 2" }, + + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Theend) + +static struct BurnInputInfo ThepitmInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 7, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 5, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 6, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Thepitm) + +static struct BurnInputInfo TurtlesInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort2 + 4, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort2 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 3, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 0, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort2 + 0, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Service" , BIT_DIGITAL , GalInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Turtles) + +static struct BurnInputInfo WarofbugInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , GalInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 1, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Warofbug) + +static struct BurnInputInfo ZigzagInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , GalInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , GalInputPort1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , GalInputPort1 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , GalInputPort0 + 5, "p1 up" }, + {"Down" , BIT_DIGITAL , GalInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , GalInputPort0 + 2, "p1 left" }, + {"Right" , BIT_DIGITAL , GalInputPort0 + 3, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , GalInputPort0 + 4, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 5, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , GalInputPort0 + 7, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 2, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 3, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , GalInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &GalReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , GalDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , GalDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , GalDip + 2 , "dip" }, +}; + +STDINPUTINFO(Zigzag) + +#undef A + +// Dip Switch defintions (alphabetical) +static struct BurnDIPInfo Ad2083DIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x10, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x0d, 0x01, 0x0f, 0x08, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x0f, 0x09, "2 Coins 2 Plays" }, + {0x0d, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0x0f, 0x0a, "2 Coins 3 Plays" }, + {0x0d, 0x01, 0x0f, 0x0b, "2 Coins 4 Plays" }, + {0x0d, 0x01, 0x0f, 0x01, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0x0f, 0x0c, "2 Coins 5 Plays" }, + {0x0d, 0x01, 0x0f, 0x0d, "2 Coins 6 Plays" }, + {0x0d, 0x01, 0x0f, 0x02, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0x0f, 0x0e, "2 Coins 7 Plays" }, + {0x0d, 0x01, 0x0f, 0x0f, "2 Coins 8 Plays" }, + {0x0d, 0x01, 0x0f, 0x03, "1 Coin 4 Plays" }, + {0x0d, 0x01, 0x0f, 0x04, "1 Coin 5 Plays" }, + {0x0d, 0x01, 0x0f, 0x05, "1 Coin 6 Plays" }, + {0x0d, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, + {0x0d, 0x01, 0x0f, 0x07, "1 Coin 8 Plays" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x0d, 0x01, 0xf0, 0x80, "2 Coins 1 Play" }, + {0x0d, 0x01, 0xf0, 0x90, "2 Coins 2 Plays" }, + {0x0d, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0xf0, 0xa0, "2 Coins 3 Plays" }, + {0x0d, 0x01, 0xf0, 0xb0, "2 Coins 4 Plays" }, + {0x0d, 0x01, 0xf0, 0x10, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0xf0, 0xc0, "2 Coins 5 Plays" }, + {0x0d, 0x01, 0xf0, 0xd0, "2 Coins 6 Plays" }, + {0x0d, 0x01, 0xf0, 0x20, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0xf0, 0xe0, "2 Coins 7 Plays" }, + {0x0d, 0x01, 0xf0, 0xf0, "2 Coins 8 Plays" }, + {0x0d, 0x01, 0xf0, 0x30, "1 Coin 4 Plays" }, + {0x0d, 0x01, 0xf0, 0x40, "1 Coin 5 Plays" }, + {0x0d, 0x01, 0xf0, 0x50, "1 Coin 6 Plays" }, + {0x0d, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, + {0x0d, 0x01, 0xf0, 0x70, "1 Coin 8 Plays" }, + + // Dip 4 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x03, 0x03, "2" }, + {0x0e, 0x01, 0x03, 0x02, "3" }, + {0x0e, 0x01, 0x03, 0x01, "4" }, + {0x0e, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x0c, 0x0c, "None" }, + {0x0e, 0x01, 0x0c, 0x08, "100000" }, + {0x0e, 0x01, 0x0c, 0x04, "150000" }, + {0x0e, 0x01, 0x0c, 0x00, "200000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x10, 0x10, "Upright" }, + {0x0e, 0x01, 0x10, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0e, 0x01, 0x20, 0x20, "Off" }, + {0x0e, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0e, 0x01, 0x80, 0x80, "Off" }, + {0x0e, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Ad2083) + +static struct BurnDIPInfo AmidarDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x06, NULL }, + {0x13, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x00, "3" }, + {0x11, 0x01, 0x03, 0x01, "4" }, + {0x11, 0x01, 0x03, 0x02, "5" }, + {0x11, 0x01, 0x03, 0x03, "255" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x12, 0x01, 0x04, 0x04, "30000 50000" }, + {0x12, 0x01, 0x04, 0x00, "50000 50000" }, + + // Dip 4 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x13, 0x01, 0x0f, 0x0b, "4 Coins 1 Play" }, + {0x13, 0x01, 0x0f, 0x05, "3 Coins 1 Play" }, + {0x13, 0x01, 0x0f, 0x0e, "2 Coins 1 Play" }, + {0x13, 0x01, 0x0f, 0x0d, "3 Coins 2 Plays" }, + {0x13, 0x01, 0x0f, 0x07, "4 Coins 3 Plays" }, + {0x13, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, + {0x13, 0x01, 0x0f, 0x03, "3 Coins 4 Plays" }, + {0x13, 0x01, 0x0f, 0x01, "2 Coins 3 Plays" }, + {0x13, 0x01, 0x0f, 0x08, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x0f, 0x09, "2 Coins 5 Plays" }, + {0x13, 0x01, 0x0f, 0x04, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x0f, 0x02, "1 Coin 5 Plays" }, + {0x13, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, + {0x13, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, + {0x13, 0x01, 0x0f, 0x0f, "Free Play" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x13, 0x01, 0xf0, 0xb0, "4 Coins 1 Play" }, + {0x13, 0x01, 0xf0, 0x50, "3 Coins 1 Play" }, + {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Play" }, + {0x13, 0x01, 0xf0, 0xd0, "3 Coins 2 Plays" }, + {0x13, 0x01, 0xf0, 0x70, "4 Coins 3 Plays" }, + {0x13, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, + {0x13, 0x01, 0xf0, 0x30, "3 Coins 4 Plays" }, + {0x13, 0x01, 0xf0, 0x10, "2 Coins 3 Plays" }, + {0x13, 0x01, 0xf0, 0x80, "1 Coin 2 Plays" }, + {0x13, 0x01, 0xf0, 0x90, "2 Coins 5 Plays" }, + {0x13, 0x01, 0xf0, 0x40, "1 Coin 3 Plays" }, + {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, + {0x13, 0x01, 0xf0, 0x20, "1 Coin 5 Plays" }, + {0x13, 0x01, 0xf0, 0xa0, "1 Coin 6 Plays" }, + {0x13, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, + {0x13, 0x01, 0xf0, 0xf0, "Disable All Coins" }, +}; + +STDDIPINFO(Amidar) + +static struct BurnDIPInfo AmidaroDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x02, NULL }, + {0x12, 0xff, 0xff, 0x06, NULL }, + {0x13, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x00, "1" }, + {0x11, 0x01, 0x03, 0x01, "2" }, + {0x11, 0x01, 0x03, 0x02, "3" }, + {0x11, 0x01, 0x03, 0x03, "4" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Level Progression" }, + {0x12, 0x01, 0x02, 0x02, "Slow" }, + {0x12, 0x01, 0x02, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x12, 0x01, 0x04, 0x04, "30000 70000" }, + {0x12, 0x01, 0x04, 0x00, "50000 80000" }, + + // Dip 4 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x13, 0x01, 0x0f, 0x0b, "4 Coins 1 Play" }, + {0x13, 0x01, 0x0f, 0x05, "3 Coins 1 Play" }, + {0x13, 0x01, 0x0f, 0x0e, "2 Coins 1 Play" }, + {0x13, 0x01, 0x0f, 0x0d, "3 Coins 2 Plays" }, + {0x13, 0x01, 0x0f, 0x07, "4 Coins 3 Plays" }, + {0x13, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, + {0x13, 0x01, 0x0f, 0x03, "3 Coins 4 Plays" }, + {0x13, 0x01, 0x0f, 0x01, "2 Coins 3 Plays" }, + {0x13, 0x01, 0x0f, 0x08, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x0f, 0x09, "2 Coins 5 Plays" }, + {0x13, 0x01, 0x0f, 0x04, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x0f, 0x02, "1 Coin 5 Plays" }, + {0x13, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, + {0x13, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, + {0x13, 0x01, 0x0f, 0x0f, "Free Play" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x13, 0x01, 0xf0, 0xb0, "4 Coins 1 Play" }, + {0x13, 0x01, 0xf0, 0x50, "3 Coins 1 Play" }, + {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Play" }, + {0x13, 0x01, 0xf0, 0xd0, "3 Coins 2 Plays" }, + {0x13, 0x01, 0xf0, 0x70, "4 Coins 3 Plays" }, + {0x13, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, + {0x13, 0x01, 0xf0, 0x30, "3 Coins 4 Plays" }, + {0x13, 0x01, 0xf0, 0x10, "2 Coins 3 Plays" }, + {0x13, 0x01, 0xf0, 0x80, "1 Coin 2 Plays" }, + {0x13, 0x01, 0xf0, 0x90, "2 Coins 5 Plays" }, + {0x13, 0x01, 0xf0, 0x40, "1 Coin 3 Plays" }, + {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, + {0x13, 0x01, 0xf0, 0x20, "1 Coin 5 Plays" }, + {0x13, 0x01, 0xf0, 0xa0, "1 Coin 6 Plays" }, + {0x13, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, + {0x13, 0x01, 0xf0, 0xf0, "Disable All Coins" }, +}; + +STDDIPINFO(Amidaro) + +static struct BurnDIPInfo AmidarsDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x01, NULL }, + {0x12, 0xff, 0xff, 0x0a, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x00, "2" }, + {0x11, 0x01, 0x03, 0x01, "3" }, + {0x11, 0x01, 0x03, 0x02, "4" }, + {0x11, 0x01, 0x03, 0x03, "256" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x12, 0x01, 0x02, 0x02, "A 1C/1P B 1C/6P" }, + {0x12, 0x01, 0x02, 0x00, "A 2C/1P B 1C/3P" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x08, 0x08, "Upright" }, + {0x12, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Amidars) + +static struct BurnDIPInfo AmidaruDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x06, NULL }, + {0x13, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x00, "3" }, + {0x11, 0x01, 0x03, 0x01, "4" }, + {0x11, 0x01, 0x03, 0x02, "5" }, + {0x11, 0x01, 0x03, 0x03, "255" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x12, 0x01, 0x04, 0x04, "30000 70000" }, + {0x12, 0x01, 0x04, 0x00, "50000 80000" }, + + // Dip 4 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x13, 0x01, 0x0f, 0x0b, "4 Coins 1 Play" }, + {0x13, 0x01, 0x0f, 0x05, "3 Coins 1 Play" }, + {0x13, 0x01, 0x0f, 0x0e, "2 Coins 1 Play" }, + {0x13, 0x01, 0x0f, 0x0d, "3 Coins 2 Plays" }, + {0x13, 0x01, 0x0f, 0x07, "4 Coins 3 Plays" }, + {0x13, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, + {0x13, 0x01, 0x0f, 0x03, "3 Coins 4 Plays" }, + {0x13, 0x01, 0x0f, 0x01, "2 Coins 3 Plays" }, + {0x13, 0x01, 0x0f, 0x08, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x0f, 0x09, "2 Coins 5 Plays" }, + {0x13, 0x01, 0x0f, 0x04, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x0f, 0x02, "1 Coin 5 Plays" }, + {0x13, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, + {0x13, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, + {0x13, 0x01, 0x0f, 0x0f, "Free Play" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x13, 0x01, 0xf0, 0xb0, "4 Coins 1 Play" }, + {0x13, 0x01, 0xf0, 0x50, "3 Coins 1 Play" }, + {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Play" }, + {0x13, 0x01, 0xf0, 0xd0, "3 Coins 2 Plays" }, + {0x13, 0x01, 0xf0, 0x70, "4 Coins 3 Plays" }, + {0x13, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, + {0x13, 0x01, 0xf0, 0x30, "3 Coins 4 Plays" }, + {0x13, 0x01, 0xf0, 0x10, "2 Coins 3 Plays" }, + {0x13, 0x01, 0xf0, 0x80, "1 Coin 2 Plays" }, + {0x13, 0x01, 0xf0, 0x90, "2 Coins 5 Plays" }, + {0x13, 0x01, 0xf0, 0x40, "1 Coin 3 Plays" }, + {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, + {0x13, 0x01, 0xf0, 0x20, "1 Coin 5 Plays" }, + {0x13, 0x01, 0xf0, 0xa0, "1 Coin 6 Plays" }, + {0x13, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, + {0x13, 0x01, 0xf0, 0xf0, "Disable All Coins" }, +}; + +STDDIPINFO(Amidaru) + +static struct BurnDIPInfo AnteaterDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x02, NULL }, + {0x11, 0xff, 0xff, 0x04, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x10, 0x01, 0x01, 0x00, "3" }, + {0x10, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x10, 0x01, 0x02, 0x00, "Off" }, + {0x10, 0x01, 0x02, 0x02, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x11, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, + {0x11, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, + {0x11, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, + {0x11, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x08, 0x00, "Upright" }, + {0x11, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Anteater) + +static struct BurnDIPInfo AnteatergDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x02, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0f, 0x01, 0x02, 0x00, "A 1C/1P B 1C/5P" }, + {0x0f, 0x01, 0x02, 0x02, "A 2C/1P B 1C/3P" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x0c, 0x00, "3" }, + {0x0f, 0x01, 0x0c, 0x04, "4" }, + {0x0f, 0x01, 0x0c, 0x08, "5" }, + {0x0f, 0x01, 0x0c, 0x0c, "6" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x01, 0x00, "Upright" }, + {0x10, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x10, 0x01, 0x02, 0x00, "Off" }, + {0x10, 0x01, 0x02, 0x02, "On" }, + + // Dip 3 +}; + +STDDIPINFO(Anteaterg) + +static struct BurnDIPInfo AnteaterukDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x02, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x01, 0x00, "Upright" }, + {0x10, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x10, 0x01, 0x02, 0x00, "Off" }, + {0x10, 0x01, 0x02, 0x02, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x11, 0x01, 0x02, 0x00, "A 1C/1P B 1C/5P" }, + {0x11, 0x01, 0x02, 0x02, "A 2C/1P B 1C/3P" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x0c, 0x00, "3" }, + {0x11, 0x01, 0x0c, 0x04, "4" }, + {0x11, 0x01, 0x0c, 0x08, "5" }, + {0x11, 0x01, 0x0c, 0x0c, "6" }, +}; + +STDDIPINFO(Anteateruk) + +static struct BurnDIPInfo ArmorcarDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x02, NULL }, + {0x13, 0xff, 0xff, 0x04, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x12, 0x01, 0x01, 0x00, "3" }, + {0x12, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x13, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, + {0x13, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, + {0x13, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, + {0x13, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x08, 0x00, "Upright" }, + {0x13, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Armorcar) + +static struct BurnDIPInfo AtlantisDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x01, NULL }, + {0x13, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x01, 0x01, "Upright" }, + {0x12, 0x01, 0x01, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x12, 0x01, 0x02, 0x00, "3" }, + {0x12, 0x01, 0x02, 0x02, "5" }, + + // Dip 3 + {0 , 0xfe, 0 , 3 , "Coinage" }, + {0x13, 0x01, 0x0e, 0x0c, "A 1C/3P B 2C/1P" }, + {0x13, 0x01, 0x0e, 0x0e, "A 1C/6P B 1C/1P" }, + {0x13, 0x01, 0x0e, 0x0a, "A 1C/99P B 1C/99P" }, +}; + +STDDIPINFO(Atlantis) + +static struct BurnDIPInfo AtlantisbDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x80, NULL }, + {0x11, 0xff, 0xff, 0x0c, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x10, 0x01, 0x40, 0x40, "2 Coins 1 Play" }, + {0x10, 0x01, 0x40, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x10, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x10, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x11, 0x01, 0x02, 0x00, "Easy" }, + {0x11, 0x01, 0x02, 0x02, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x04, 0x04, "3" }, + {0x11, 0x01, 0x04, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x08, 0x08, "Upright" }, + {0x11, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Atlantisb) + +static struct BurnDIPInfo AzurianDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0f, 0x01, 0x80, 0x00, "3" }, + {0x0f, 0x01, 0x80, 0x80, "5" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x10, 0x01, 0x01, 0x01, "2 Coins 1 Play" }, + {0x10, 0x01, 0x01, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x02, 0x00, "5000" }, + {0x10, 0x01, 0x02, 0x02, "7000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x08, 0x00, "Upright" }, + {0x10, 0x01, 0x08, 0x08, "Cocktail" }, + + // Fake Dip + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x03, 0x03, "Easy" }, + {0x11, 0x01, 0x03, 0x01, "Normal" }, + {0x11, 0x01, 0x03, 0x02, "Hard" }, + {0x11, 0x01, 0x03, 0x00, "Very Hard" }, +}; + +STDDIPINFO(Azurian) + +static struct BurnDIPInfo BagmanmcDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x80, NULL }, + {0x11, 0xff, 0xff, 0x7e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x80, "Upright" }, + {0x10, 0x01, 0x80, 0x00, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x03, "2" }, + {0x11, 0x01, 0x03, 0x02, "3" }, + {0x11, 0x01, 0x03, 0x01, "4" }, + {0x11, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x11, 0x01, 0x04, 0x00, "A 2C/1P B 1C/1P" }, + {0x11, 0x01, 0x04, 0x04, "A 1C/1P B 1C/2P" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x18, 0x18, "Easy" }, + {0x11, 0x01, 0x18, 0x10, "Medium" }, + {0x11, 0x01, 0x18, 0x08, "Hard" }, + {0x11, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x11, 0x01, 0x20, 0x20, "English" }, + {0x11, 0x01, 0x20, 0x00, "French" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x11, 0x01, 0x40, 0x40, "30000" }, + {0x11, 0x01, 0x40, 0x00, "40000" }, +}; + +STDDIPINFO(Bagmanmc) + +static struct BurnDIPInfo Batman2DIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0xc0, NULL }, + {0x0f, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x0e, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + {0x0e, 0x01, 0x40, 0x00, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x0e, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x0e, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0f, 0x01, 0x01, 0x00, "30000" }, + {0x0f, 0x01, 0x01, 0x01, "50000" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0f, 0x01, 0x04, 0x00, "3" }, + {0x0f, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x08, 0x00, "Upright" }, + {0x0f, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Batman2) + +static struct BurnDIPInfo BlkholeDIPList[]= +{ + // Default Values + {0x0a, 0xff, 0xff, 0x00, NULL }, + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x02, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0b, 0x01, 0xc0, 0xc0, "2 Coins 1 Play" }, + {0x0b, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x0b, 0x01, 0xc0, 0x40, "1 Coin 2 Plays" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 3 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0c, 0x01, 0x01, 0x00, "5000" }, + {0x0c, 0x01, 0x01, 0x01, "10000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x02, 0x02, "Upright" }, + {0x0c, 0x01, 0x02, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Blkhole) + +static struct BurnDIPInfo BongoDIPList[]= +{ + // Default Values + {0x0a, 0xff, 0xff, 0x00, NULL }, + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x40, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + + // Dip 4 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0d, 0x01, 0x06, 0x00, "2" }, + {0x0d, 0x01, 0x06, 0x02, "3" }, + {0x0d, 0x01, 0x06, 0x04, "4" }, + {0x0d, 0x01, 0x06, 0x06, "5" }, + + {0 , 0xfe, 0 , 2 , "Infinite Lives" }, + {0x0d, 0x01, 0x08, 0x00, "Off" }, + {0x0d, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0d, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x80, 0x00, "Upright" }, + {0x0d, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(Bongo) + +static struct BurnDIPInfo CalipsoDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x02, NULL }, + {0x0f, 0xff, 0xff, 0x04, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x01, 0x00, "3" }, + {0x0e, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0e, 0x01, 0x02, 0x00, "Off" }, + {0x0e, 0x01, 0x02, 0x02, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0f, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, + {0x0f, 0x01, 0x06, 0x06, "1 Coin 2 Plays" }, + {0x0f, 0x01, 0x06, 0x02, "1 Coin 3 Plays" }, + {0x0f, 0x01, 0x06, 0x00, "1 Coin 4 Plays" }, +}; + +STDDIPINFO(Calipso) + +static struct BurnDIPInfo CatacombDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x40, NULL }, + {0x0d, 0xff, 0xff, 0x04, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x0c, 0x01, 0x80, 0x00, "1 Coin 3 Plays" }, + {0x0c, 0x01, 0x80, 0x80, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0d, 0x01, 0x04, 0x04, "3" }, + {0x0d, 0x01, 0x04, 0x00, "5" }, +}; + +STDDIPINFO(Catacomb) + +static struct BurnDIPInfo CavelonDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x02, NULL }, + {0x13, 0xff, 0xff, 0x0c, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x01, 0x00, "Upright" }, + {0x12, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x12, 0x01, 0x02, 0x02, "A 1C/1P B 1C/6P" }, + {0x12, 0x01, 0x02, 0x00, "A 2C/1P B 1C/3P" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x06, 0x00, "2" }, + {0x13, 0x01, 0x06, 0x04, "3" }, + {0x13, 0x01, 0x06, 0x02, "4" }, + {0x13, 0x01, 0x06, 0x06, "5" }, +}; + +STDDIPINFO(Cavelon) + +static struct BurnDIPInfo CheckmanjDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x12, 0x01, 0x40, 0x40, "A 2C/1P B 1C/3P" }, + {0x12, 0x01, 0x40, 0x00, "A 1C/1P B 1C/6P" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x80, 0x00, "Upright" }, + {0x12, 0x01, 0x80, 0x80, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x00, "3" }, + {0x13, 0x01, 0x03, 0x01, "4" }, + {0x13, 0x01, 0x03, 0x02, "5" }, + {0x13, 0x01, 0x03, 0x03, "6" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x13, 0x01, 0x04, 0x00, "100000" }, + {0x13, 0x01, 0x04, 0x04, "200000" }, + + {0 , 0xfe, 0 , 2 , "Difficulty increases at level"}, + {0x13, 0x01, 0x08, 0x08, "3" }, + {0x13, 0x01, 0x08, 0x00, "5" }, +}; + +STDDIPINFO(Checkmanj) + +static struct BurnDIPInfo CheckmanDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x10, 0x01, 0x40, 0x40, "A 2C/1P B 1C/3P" }, + {0x10, 0x01, 0x40, 0x00, "A 1C/1P B 1C/6P" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x00, "Upright" }, + {0x10, 0x01, 0x80, 0x80, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x00, "3" }, + {0x11, 0x01, 0x03, 0x01, "4" }, + {0x11, 0x01, 0x03, 0x02, "5" }, + {0x11, 0x01, 0x03, 0x03, "6" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x11, 0x01, 0x04, 0x00, "100000" }, + {0x11, 0x01, 0x04, 0x04, "200000" }, + + {0 , 0xfe, 0 , 2 , "Difficulty increases at level"}, + {0x11, 0x01, 0x08, 0x08, "3" }, + {0x11, 0x01, 0x08, 0x00, "5" }, +}; + +STDDIPINFO(Checkman) + +static struct BurnDIPInfo CkonggDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x80, NULL }, + {0x11, 0xff, 0xff, 0x0a, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x10, 0x01, 0x40, 0x00, "1 Coin 2 Plays" }, + {0x10, 0x01, 0x40, 0x40, "1 Coin 4 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x00, "1" }, + {0x11, 0x01, 0x03, 0x01, "2" }, + {0x11, 0x01, 0x03, 0x02, "3" }, + {0x11, 0x01, 0x03, 0x03, "4" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x11, 0x01, 0x08, 0x08, "500000" }, + {0x11, 0x01, 0x08, 0x00, "750000" }, +}; + +STDDIPINFO(Ckongg) + +static struct BurnDIPInfo CkongsDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x02, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x02, 0x02, "Upright" }, + {0x11, 0x01, 0x02, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x04, 0x00, "3" }, + {0x11, 0x01, 0x04, 0x04, "4" }, +}; + +STDDIPINFO(Ckongs) + +static struct BurnDIPInfo DambustrDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Clear Swear Words" }, + {0x0c, 0x01, 0x20, 0x00, "Off" }, + {0x0c, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Second Coin Counter" }, + {0x0d, 0x01, 0x40, 0x00, "Off" }, + {0x0d, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0d, 0x01, 0x80, 0x80, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x80, 0x00, "1 Coin 1 Play" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x03, 0x00, "3" }, + {0x0e, 0x01, 0x03, 0x01, "4" }, + {0x0e, 0x01, 0x03, 0x02, "5" }, + {0x0e, 0x01, 0x03, 0x03, "6" }, + + {0 , 0xfe, 0 , 2 , "Game Test Mode" }, + {0x0e, 0x01, 0x04, 0x00, "Off" }, + {0x0e, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Union Jack" }, + {0x0e, 0x01, 0x08, 0x08, "Off" }, + {0x0e, 0x01, 0x08, 0x00, "On" }, +}; + +STDDIPINFO(Dambustr) + +static struct BurnDIPInfo DarkplntDIPList[]= +{ + // Default Values + {0x08, 0xff, 0xff, 0x00, NULL }, + {0x09, 0xff, 0xff, 0x02, NULL }, + {0x0a, 0xff, 0xff, 0x0c, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Bonus Occurrence" }, + {0x09, 0x01, 0x01, 0x00, "Once" }, + {0x09, 0x01, 0x01, 0x01, "Everytime" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x09, 0x01, 0x02, 0x02, "1" }, + {0x09, 0x01, 0x02, 0x00, "2" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0a, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, + {0x0a, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, + {0x0a, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, + {0x0a, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0a, 0x01, 0x08, 0x08, "100000" }, + {0x0a, 0x01, 0x08, 0x00, "200000" }, +}; + +STDDIPINFO(Darkplnt) + +static struct BurnDIPInfo DevilfsgDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0xc0, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x10, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x10, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x10, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x10, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x11, 0x01, 0x01, 0x00, "10000" }, + {0x11, 0x01, 0x01, 0x01, "15000" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x04, 0x00, "4" }, + {0x11, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x08, 0x00, "Upright" }, + {0x11, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Devilfsg) + +static struct BurnDIPInfo DevilfshDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x03, NULL }, + {0x11, 0xff, 0xff, 0x02, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x01, 0x01, "10000" }, + {0x10, 0x01, 0x01, 0x00, "15000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x02, 0x02, "Upright" }, + {0x10, 0x01, 0x02, 0x00, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x02, 0x02, "4" }, + {0x11, 0x01, 0x02, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x11, 0x01, 0x04, 0x04, "2 Coins 1 Play" }, + {0x11, 0x01, 0x04, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x11, 0x01, 0x08, 0x00, "1 Coin 3 Plays" }, + {0x11, 0x01, 0x08, 0x08, "1 Coin 5 Plays" }, +}; + +STDDIPINFO(Devilfsh) + +static struct BurnDIPInfo DingoDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x80, NULL }, + {0x11, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x40, 0x00, "Upright" }, + {0x10, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x10, 0x01, 0x80, 0x40, "A 2C/1P B 1C/3P" }, + {0x10, 0x01, 0x80, 0x80, "A 1C/1P B 1C/5P" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x03, 0x00, "Easy" }, + {0x11, 0x01, 0x03, 0x01, "Medium" }, + {0x11, 0x01, 0x03, 0x02, "Hard" }, + {0x11, 0x01, 0x03, 0x03, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x04, 0x00, "3" }, + {0x11, 0x01, 0x04, 0x04, "4" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x11, 0x01, 0x08, 0x00, "20000" }, + {0x11, 0x01, 0x08, 0x08, "40000" }, +}; + +STDDIPINFO(Dingo) + +static struct BurnDIPInfo DkongjrmDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x08, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0f, 0x01, 0xc0, 0xc0, "3 Coins 1 Play" }, + {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x0f, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Coin Multiplier" }, + {0x10, 0x01, 0x01, 0x00, "x1" }, + {0x10, 0x01, 0x01, 0x01, "x2" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x06, 0x00, "3" }, + {0x10, 0x01, 0x06, 0x02, "4" }, + {0x10, 0x01, 0x06, 0x04, "5" }, + {0x10, 0x01, 0x06, 0x06, "6" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x08, 0x08, "Upright" }, + {0x10, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Dkongjrm) + +static struct BurnDIPInfo DrivfrcgDIPList[]= +{ + // Default Values + {0x07, 0xff, 0xff, 0x00, NULL }, + {0x08, 0xff, 0xff, 0x00, NULL }, + {0x09, 0xff, 0xff, 0x00, NULL }, + {0x0a, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x08, 0x01, 0x40, 0x40, "A 2C/1P B 1C/3P" }, + {0x08, 0x01, 0x40, 0x00, "A 1C/1P B 1C/5P" }, + + // Dip 3 + + // Dip 4 +}; + +STDDIPINFO(Drivfrcg) + +static struct BurnDIPInfo Eagle2DIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x80, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x20, 0x00, "Upright" }, + {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0c, 0x01, 0x40, 0x00, "30000" }, + {0x0c, 0x01, 0x40, 0x40, "50000" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x0c, 0x01, 0x80, 0x80, "English" }, + {0x0c, 0x01, 0x80, 0x00, "Japanese" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x0d, 0x01, 0x0c, 0x00, "Off" }, + {0x0d, 0x01, 0x0c, 0x0c, "On" }, +}; + +STDDIPINFO(Eagle2) + +static struct BurnDIPInfo ExodusDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0xc0, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x40, 0x00, "Off" }, + {0x0b, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x0c, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x0c, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0d, 0x01, 0x01, 0x00, "7000" }, + {0x0d, 0x01, 0x01, 0x01, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0d, 0x01, 0x04, 0x00, "3" }, + {0x0d, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x08, 0x00, "Upright" }, + {0x0d, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Exodus) + +static struct BurnDIPInfo ExplorerDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x0d, 0x01, 0x0f, 0x08, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x0f, 0x09, "2 Coins 2 Plays" }, + {0x0d, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0x0f, 0x0a, "2 Coins 3 Plays" }, + {0x0d, 0x01, 0x0f, 0x0b, "2 Coins 4 Plays" }, + {0x0d, 0x01, 0x0f, 0x01, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0x0f, 0x0c, "2 Coins 5 Plays" }, + {0x0d, 0x01, 0x0f, 0x0d, "2 Coins 6 Plays" }, + {0x0d, 0x01, 0x0f, 0x02, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0x0f, 0x0e, "2 Coins 7 Plays" }, + {0x0d, 0x01, 0x0f, 0x0f, "2 Coins 8 Plays" }, + {0x0d, 0x01, 0x0f, 0x03, "1 Coin 4 Plays" }, + {0x0d, 0x01, 0x0f, 0x04, "1 Coin 5 Plays" }, + {0x0d, 0x01, 0x0f, 0x05, "1 Coin 6 Plays" }, + {0x0d, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, + {0x0d, 0x01, 0x0f, 0x07, "1 Coin 8 Plays" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x0d, 0x01, 0xf0, 0x80, "2 Coins 1 Play" }, + {0x0d, 0x01, 0xf0, 0x90, "2 Coins 2 Plays" }, + {0x0d, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0xf0, 0xa0, "2 Coins 3 Plays" }, + {0x0d, 0x01, 0xf0, 0xb0, "2 Coins 4 Plays" }, + {0x0d, 0x01, 0xf0, 0x10, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0xf0, 0xc0, "2 Coins 5 Plays" }, + {0x0d, 0x01, 0xf0, 0xd0, "2 Coins 6 Plays" }, + {0x0d, 0x01, 0xf0, 0x20, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0xf0, 0xe0, "2 Coins 7 Plays" }, + {0x0d, 0x01, 0xf0, 0xf0, "2 Coins 8 Plays" }, + {0x0d, 0x01, 0xf0, 0x30, "1 Coin 4 Plays" }, + {0x0d, 0x01, 0xf0, 0x40, "1 Coin 5 Plays" }, + {0x0d, 0x01, 0xf0, 0x50, "1 Coin 6 Plays" }, + {0x0d, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, + {0x0d, 0x01, 0xf0, 0x70, "1 Coin 8 Plays" }, + + // Dip 4 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x03, 0x00, "2" }, + {0x0e, 0x01, 0x03, 0x01, "3" }, + {0x0e, 0x01, 0x03, 0x02, "4" }, + {0x0e, 0x01, 0x03, 0x03, "5" }, + + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x0e, 0x01, 0x1c, 0x04, "10000" }, + {0x0e, 0x01, 0x1c, 0x0c, "15000" }, + {0x0e, 0x01, 0x1c, 0x14, "20000" }, + {0x0e, 0x01, 0x1c, 0x1c, "25000" }, + {0x0e, 0x01, 0x1c, 0x00, "30000" }, + {0x0e, 0x01, 0x1c, 0x08, "50000" }, + {0x0e, 0x01, 0x1c, 0x10, "70000" }, + {0x0e, 0x01, 0x1c, 0x18, "80000" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0e, 0x01, 0x80, 0x00, "Off" }, + {0x0e, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Explorer) + +static struct BurnDIPInfo FantastcDIPList[]= +{ + // Default Values + {0x07, 0xff, 0xff, 0x40, NULL }, + {0x08, 0xff, 0xff, 0x00, NULL }, + {0x09, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x07, 0x01, 0x20, 0x00, "Off" }, + {0x07, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Extended Bonus Life" }, + {0x07, 0x01, 0x40, 0x00, "Off" }, + {0x07, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x08, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x08, 0x01, 0xc0, 0x80, "2 Coins 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x08, 0x01, 0x80, 0x00, "3" }, + {0x08, 0x01, 0x80, 0x80, "5" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x09, 0x01, 0x03, 0x00, "Easy" }, + {0x09, 0x01, 0x03, 0x01, "Medium" }, + {0x09, 0x01, 0x03, 0x02, "Hard" }, + {0x09, 0x01, 0x03, 0x03, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x09, 0x01, 0x0c, 0x00, "20000 80000" }, + {0x09, 0x01, 0x0c, 0x04, "30000 80000" }, + {0x09, 0x01, 0x0c, 0x08, "20000 120000" }, + {0x09, 0x01, 0x0c, 0x0c, "30000 120000" }, +}; + +STDDIPINFO(Fantastc) + +static struct BurnDIPInfo FantaziaDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x20, 0x00, "Upright" }, + {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0c, 0x01, 0x40, 0x00, "30000" }, + {0x0c, 0x01, 0x40, 0x40, "50000" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0d, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0d, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0x0c, 0x0c, "Freeplay" }, +}; + +STDDIPINFO(Fantazia) + +static struct BurnDIPInfo Fourin1DIPList[]= +{ + // Defaults + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x00, NULL }, + {0x14, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x20, 0x00, "Upright" }, + {0x0e, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x10, 0x01, 0x04, 0x00, "3" }, + {0x10, 0x01, 0x04, 0x04, "5" }, + + // Ghost Muncher Pt 3 + {0 , 0xfe, 0 , 4 , "Bonus Life (Ghost Muncher)"}, + {0x11, 0x01, 0x03, 0x01, "10000" }, + {0x11, 0x01, 0x03, 0x02, "15000" }, + {0x11, 0x01, 0x03, 0x03, "20000" }, + {0x11, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Coinage (Ghost Muncher)"}, + {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0x00, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + {0x11, 0x01, 0xc0, 0xc0, "Free Play" }, + + // Scramble Pt 2 + {0 , 0xfe, 0 , 2 , "Allow Continue (Scramble)"}, + {0x12, 0x01, 0x08, 0x08, "No" }, + {0x12, 0x01, 0x08, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4 , "Coinage (Scramble)" }, + {0x12, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xc0, 0x00, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xc0, 0xc0, "Free Play" }, + + // Galaxian Pt 5 + {0 , 0xfe, 0 , 4 , "Bonus Life (Galaxian)" }, + {0x13, 0x01, 0x03, 0x01, "4000" }, + {0x13, 0x01, 0x03, 0x02, "5000" }, + {0x13, 0x01, 0x03, 0x03, "7000" }, + {0x13, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 3 , "Coinage (Galaxian)" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "Free Play" }, + + // Galactic Convoy + {0 , 0xfe, 0 , 2 , "Bonus Life (Galactic Convoy)"}, + {0x14, 0x01, 0x01, 0x00, "50000" }, + {0x14, 0x01, 0x01, 0x01, "80000" }, + + {0 , 0xfe, 0 , 3 , "Coinage (Galactic Convoy)"}, + {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x14, 0x01, 0xc0, 0x00, "1 Coin 1 Credit" }, + {0x14, 0x01, 0xc0, 0xc0, "Free Play" }, +}; + +STDDIPINFO(Fourin1) + +static struct BurnDIPInfo FroggDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0xc0, NULL }, + {0x10, 0xff, 0xff, 0x05, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0xc0, 0xc0, "3" }, + {0x0f, 0x01, 0xc0, 0x80, "5" }, + {0x0f, 0x01, 0xc0, 0x40, "7" }, + {0x0f, 0x01, 0xc0, 0x00, "256" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x01, 0x01, "Upright" }, + {0x10, 0x01, 0x01, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x10, 0x01, 0x04, 0x00, "2 Coins 1 Credit" }, + {0x10, 0x01, 0x04, 0x04, "1 Coin 1 Credit" }, +}; + +STDDIPINFO(Frogg) + +static struct BurnDIPInfo FroggerDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x03, NULL }, + {0x10, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x03, 0x03, "3" }, + {0x0f, 0x01, 0x03, 0x02, "5" }, + {0x0f, 0x01, 0x03, 0x01, "7" }, + {0x0f, 0x01, 0x03, 0x00, "256" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x10, 0x01, 0x06, 0x04, "A 2C/1P B 2C/1P C 2C/1P"}, + {0x10, 0x01, 0x06, 0x02, "A 2C/1P B 1C/3P C 2C/1P"}, + {0x10, 0x01, 0x06, 0x06, "A 1C/1P B 1C/1P C 1C/1P"}, + {0x10, 0x01, 0x06, 0x00, "A 1C/1P B 1C/6P C 1C/1P"}, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x08, 0x08, "Upright" }, + {0x10, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Frogger) + +static struct BurnDIPInfo FroggermcDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0xc0, NULL }, + {0x10, 0xff, 0xff, 0x07, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0xc0, 0xc0, "3" }, + {0x0f, 0x01, 0xc0, 0x80, "5" }, + {0x0f, 0x01, 0xc0, 0x40, "7" }, + {0x0f, 0x01, 0xc0, 0x00, "256" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x01, 0x01, "Upright" }, + {0x10, 0x01, 0x01, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x10, 0x01, 0x06, 0x02, "A 2C/1P B 2C/1P C 2C/1P"}, + {0x10, 0x01, 0x06, 0x04, "A 2C/1P B 1C/3P C 2C/1P"}, + {0x10, 0x01, 0x06, 0x06, "A 1C/1P B 1C/1P C 1C/1P"}, + {0x10, 0x01, 0x06, 0x00, "A 1C/1P B 1C/6P C 1C/1P"}, +}; + +STDDIPINFO(Froggermc) + +static struct BurnDIPInfo GalaxianDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x04, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x20, 0x00, "Upright" }, + {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x0d, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x03, 0x00, "7000" }, + {0x0e, 0x01, 0x03, 0x01, "10000" }, + {0x0e, 0x01, 0x03, 0x02, "12000" }, + {0x0e, 0x01, 0x03, 0x03, "20000" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x04, 0x00, "2" }, + {0x0e, 0x01, 0x04, 0x04, "3" }, +}; + +STDDIPINFO(Galaxian) + +static struct BurnDIPInfo GmgalaxDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x40, NULL }, + {0x10, 0xff, 0xff, 0x06, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x01, NULL }, + {0x14, 0xff, 0xff, 0x00, NULL }, + + // Ghost Muncher Dip 1 + {0 , 0xfe, 0 , 2 , "GM - Cabinet" }, + {0x0e, 0x01, 0x20, 0x00, "Upright" }, + {0x0e, 0x01, 0x20, 0x20, "Cocktail" }, + + // Ghost Muncher Dip 2 + {0 , 0xfe, 0 , 4 , "GM - Bonus Life" }, + {0x0f, 0x01, 0xc0, 0x40, "10000" }, + {0x0f, 0x01, 0xc0, 0x80, "15000" }, + {0x0f, 0x01, 0xc0, 0xc0, "20000" }, + {0x0f, 0x01, 0xc0, 0x00, "None" }, + + // Ghost Muncher Dip 3 + {0 , 0xfe, 0 , 4 , "GM - Coinage" }, + {0x10, 0x01, 0x03, 0x00, "2 Coins 1 Play" }, + {0x10, 0x01, 0x03, 0x02, "1 Coin 1 Play" }, + {0x10, 0x01, 0x03, 0x01, "1 Coin 2 Plays" }, + {0x10, 0x01, 0x03, 0x03, "Freeplay" }, + + {0 , 0xfe, 0 , 4 , "GM - Lives" }, + {0x10, 0x01, 0x0c, 0x0c, "1" }, + {0x10, 0x01, 0x0c, 0x08, "2" }, + {0x10, 0x01, 0x0c, 0x04, "3" }, + {0x10, 0x01, 0x0c, 0x00, "4" }, + + // Galaxian Dip 1 + {0 , 0xfe, 0 , 2 , "GX - Cabinet" }, + {0x11, 0x01, 0x20, 0x00, "Upright" }, + {0x11, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "GX - Service Mode" }, + {0x11, 0x01, 0x40, 0x00, "Off" }, + {0x11, 0x01, 0x40, 0x40, "On" }, + + // Galaxian Dip 2 + {0 , 0xfe, 0 , 4 , "GX - Coinage" }, + {0x12, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x12, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x12, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + {0x12, 0x01, 0xc0, 0xc0, "Freeplay" }, + + // Galaxian Dip 3 + {0 , 0xfe, 0 , 4 , "GX - Bonus Life" }, + {0x13, 0x01, 0x03, 0x01, "4000" }, + {0x13, 0x01, 0x03, 0x02, "5000" }, + {0x13, 0x01, 0x03, 0x03, "7000" }, + {0x13, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "GX - Lives" }, + {0x13, 0x01, 0x04, 0x00, "3" }, + {0x13, 0x01, 0x04, 0x04, "5" }, + + // Select switch + {0 , 0xfe, 0 , 2 , "Game Select" }, + {0x14, 0x01, 0x01, 0x00, "Ghost Muncher" }, + {0x14, 0x01, 0x01, 0x01, "Galaxian" }, +}; + +STDDIPINFO(Gmgalax) + +static struct BurnDIPInfo GteikokbDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0xc0, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x0c, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x0c, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0d, 0x01, 0x01, 0x00, "7000" }, + {0x0d, 0x01, 0x01, 0x01, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0d, 0x01, 0x04, 0x00, "3" }, + {0x0d, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x08, 0x00, "Upright" }, + {0x0d, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Gteikokb) + +static struct BurnDIPInfo Gteikob2DIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0xc0, NULL }, + {0x0d, 0xff, 0xff, 0x08, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x0c, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x0c, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0d, 0x01, 0x01, 0x00, "7000" }, + {0x0d, 0x01, 0x01, 0x01, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0d, 0x01, 0x04, 0x00, "3" }, + {0x0d, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x08, 0x08, "Upright" }, + {0x0d, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Gteikob2) + +static struct BurnDIPInfo HotshockDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x05, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x0d, 0x01, 0xf0, 0x80, "2 Coins 1 Play" }, + {0x0d, 0x01, 0xf0, 0x90, "2 Coins 2 Plays" }, + {0x0d, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0xf0, 0xa0, "2 Coins 3 Plays" }, + {0x0d, 0x01, 0xf0, 0xb0, "2 Coins 4 Plays" }, + {0x0d, 0x01, 0xf0, 0x10, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0xf0, 0xc0, "2 Coins 5 Plays" }, + {0x0d, 0x01, 0xf0, 0xd0, "2 Coins 6 Plays" }, + {0x0d, 0x01, 0xf0, 0x20, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0xf0, 0xe0, "2 Coins 7 Plays" }, + {0x0d, 0x01, 0xf0, 0xf0, "2 Coins 8 Plays" }, + {0x0d, 0x01, 0xf0, 0x30, "1 Coin 4 Plays" }, + {0x0d, 0x01, 0xf0, 0x40, "1 Coin 5 Plays" }, + {0x0d, 0x01, 0xf0, 0x50, "1 Coin 6 Plays" }, + {0x0d, 0x01, 0xf0, 0x60, "1 Coin 7 Plays" }, + {0x0d, 0x01, 0xf0, 0x70, "1 Coin 8 Plays" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x0d, 0x01, 0x0f, 0x08, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x0f, 0x09, "2 Coins 2 Plays" }, + {0x0d, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0x0f, 0x0a, "2 Coins 3 Plays" }, + {0x0d, 0x01, 0x0f, 0x0b, "2 Coins 4 Plays" }, + {0x0d, 0x01, 0x0f, 0x01, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0x0f, 0x0c, "2 Coins 5 Plays" }, + {0x0d, 0x01, 0x0f, 0x0d, "2 Coins 6 Plays" }, + {0x0d, 0x01, 0x0f, 0x02, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0x0f, 0x0e, "2 Coins 7 Plays" }, + {0x0d, 0x01, 0x0f, 0x0f, "2 Coins 8 Plays" }, + {0x0d, 0x01, 0x0f, 0x03, "1 Coin 4 Plays" }, + {0x0d, 0x01, 0x0f, 0x04, "1 Coin 5 Plays" }, + {0x0d, 0x01, 0x0f, 0x05, "1 Coin 6 Plays" }, + {0x0d, 0x01, 0x0f, 0x06, "1 Coin 7 Plays" }, + {0x0d, 0x01, 0x0f, 0x07, "1 Coin 8 Plays" }, + + // Dip 4 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x03, 0x00, "2" }, + {0x0e, 0x01, 0x03, 0x01, "3" }, + {0x0e, 0x01, 0x03, 0x02, "4" }, + {0x0e, 0x01, 0x03, 0x03, "5" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x0e, 0x01, 0x04, 0x04, "English" }, + {0x0e, 0x01, 0x04, 0x00, "Italian" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x18, 0x00, "75000" }, + {0x0e, 0x01, 0x18, 0x08, "150000" }, + {0x0e, 0x01, 0x18, 0x10, "200000" }, + {0x0e, 0x01, 0x18, 0x18, "None" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x80, 0x00, "Upright" }, + {0x0e, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(Hotshock) + +static struct BurnDIPInfo HunchbkgDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x01, 0x00, "Upright" }, + {0x0e, 0x01, 0x01, 0x01, "Cocktail" }, +}; + +STDDIPINFO(Hunchbkg) + +static struct BurnDIPInfo HunchbksDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x02, NULL }, + {0x13, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x12, 0x01, 0x01, 0x00, "3" }, + {0x12, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x12, 0x01, 0x02, 0x00, "A 2C/1P B 1C/3P" }, + {0x12, 0x01, 0x02, 0x02, "A 1C/1P B 1C/5P" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x06, 0x06, "10000" }, + {0x13, 0x01, 0x06, 0x04, "20000" }, + {0x13, 0x01, 0x06, 0x02, "40000" }, + {0x13, 0x01, 0x06, 0x00, "80000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x08, 0x08, "Upright" }, + {0x14, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Hunchbks) + +static struct BurnDIPInfo HustlerDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x02, NULL }, + {0x12, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x01, 0x01, "1" }, + {0x11, 0x01, 0x01, 0x00, "2" }, + + {0 , 0xfe, 0 , 2 , "Infinite Lives" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x12, 0x01, 0x06, 0x02, "3 Coins 1 Play" }, + {0x12, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, + {0x12, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, + {0x12, 0x01, 0x06, 0x00, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x08, 0x08, "Upright" }, + {0x12, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Hustler) + +static struct BurnDIPInfo JumpbugDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x20, 0x00, "Upright" }, + {0x0f, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x10, 0x01, 0x40, 0x40, "Easy" }, + {0x10, 0x01, 0x40, 0x00, "Hard" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x01, "3" }, + {0x11, 0x01, 0x03, 0x02, "4" }, + {0x11, 0x01, 0x03, 0x03, "5" }, + {0x11, 0x01, 0x03, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x11, 0x01, 0x0c, 0x04, "A 2C/1P B 2C/1P" }, + {0x11, 0x01, 0x0c, 0x08, "A 2C/1P B 1C/3P" }, + {0x11, 0x01, 0x0c, 0x00, "A 1C/1P B 1C/1P" }, + {0x11, 0x01, 0x0c, 0x0c, "A 1C/1P B 1C/6P" }, +}; + +STDDIPINFO(Jumpbug) + +static struct BurnDIPInfo KingballDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x40, NULL }, + {0x0e, 0xff, 0xff, 0x04, NULL }, + {0x0f, 0xff, 0xff, 0x02, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x20, 0x00, "Upright" }, + {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0xc0, 0xc0, "2 Coins 1 Play" }, + {0x0d, 0x01, 0xc0, 0x40, "1 Coin 1 Play" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0xc0, 0x00, "Freeplay" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x03, 0x00, "10000" }, + {0x0e, 0x01, 0x03, 0x01, "12000" }, + {0x0e, 0x01, 0x03, 0x02, "15000" }, + {0x0e, 0x01, 0x03, 0x03, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x04, 0x00, "2" }, + {0x0e, 0x01, 0x04, 0x04, "3" }, + + // Fake dip + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0f, 0x01, 0x01, 0x00, "Off" }, + {0x0f, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Speech" }, + {0x0f, 0x01, 0x02, 0x00, "Off" }, + {0x0f, 0x01, 0x02, 0x02, "On" }, +}; + +STDDIPINFO(Kingball) + +static struct BurnDIPInfo CkongmcDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x0a, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x03, 0x00, "1" }, + {0x0e, 0x01, 0x03, 0x01, "2" }, + {0x0e, 0x01, 0x03, 0x02, "3" }, + {0x0e, 0x01, 0x03, 0x03, "4" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0e, 0x01, 0x08, 0x08, "500000" }, + {0x0e, 0x01, 0x08, 0x00, "750000" }, +}; + +STDDIPINFO(Ckongmc) + +static struct BurnDIPInfo KongDIPList[]= +{ + // Default Values + {0x08, 0xff, 0xff, 0x00, NULL }, + {0x09, 0xff, 0xff, 0x00, NULL }, + {0x0a, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x08, 0x01, 0x20, 0x00, "Off" }, + {0x08, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "99 Men/Max Timer" }, + {0x08, 0x01, 0x40, 0x00, "Off" }, + {0x08, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x09, 0x01, 0x40, 0x00, "3" }, + {0x09, 0x01, 0x40, 0x40, "5" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x09, 0x01, 0x80, 0x00, "1 Coin 1 Credit" }, + {0x09, 0x01, 0x80, 0x80, "2 Coins 1 Credit" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0a, 0x01, 0x03, 0x00, "10000" }, + {0x0a, 0x01, 0x03, 0x01, "20000" }, + {0x0a, 0x01, 0x03, 0x02, "30000" }, + {0x0a, 0x01, 0x03, 0x03, "None" }, + + {0 , 0xfe, 0 , 2 , "Mode" }, + {0x0a, 0x01, 0x04, 0x04, "Tournament (Harder)" }, + {0x0a, 0x01, 0x04, 0x00, "Normal" }, +}; + +STDDIPINFO(Kong) + +static struct BurnDIPInfo LadybuggDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x40, 0x00, "Upright" }, + {0x10, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x10, 0x01, 0x80, 0x00, "A 1C/1P B 1C/5P" }, + {0x10, 0x01, 0x80, 0x80, "A 2C/1P B 1C/3P" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x03, 0x00, "Easiest" }, + {0x11, 0x01, 0x03, 0x01, "Easy" }, + {0x11, 0x01, 0x03, 0x02, "Hard" }, + {0x11, 0x01, 0x03, 0x03, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x04, 0x00, "3" }, + {0x11, 0x01, 0x04, 0x04, "4" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x11, 0x01, 0x08, 0x00, "20000" }, + {0x11, 0x01, 0x08, 0x08, "40000" }, +}; + +STDDIPINFO(Ladybugg) + +static struct BurnDIPInfo LeversDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x0f, 0x01, 0x08, 0x00, "Off" }, + {0x0f, 0x01, 0x08, 0x08, "On" }, +}; + +STDDIPINFO(Levers) + +static struct BurnDIPInfo LosttombDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x02, NULL }, + {0x10, 0xff, 0xff, 0x04, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x03, 0x02, "3" }, + {0x0f, 0x01, 0x03, 0x01, "5" }, + {0x0f, 0x01, 0x03, 0x00, "Free Play" }, + {0x0f, 0x01, 0x03, 0x03, "Invulnerability" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x10, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, + {0x10, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, + {0x10, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, + {0x10, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, +}; + +STDDIPINFO(Losttomb) + +static struct BurnDIPInfo LuctodayDIPList[]= +{ + // Default Values + {0x07, 0xff, 0xff, 0x00, NULL }, + {0x08, 0xff, 0xff, 0x00, NULL }, + {0x09, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 +}; + +STDDIPINFO(Luctoday) + +static struct BurnDIPInfo MarsDIPList[]= +{ + // Default Values + {0x16, 0xff, 0xff, 0x00, NULL }, + {0x17, 0xff, 0xff, 0x03, NULL }, + {0x18, 0xff, 0xff, 0x0e, NULL }, + {0x19, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x17, 0x01, 0x02, 0x00, "2 Coins 1 Play" }, + {0x17, 0x01, 0x02, 0x02, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x17, 0x01, 0x01, 0x01, "1 Coin 3 Plays" }, + {0x17, 0x01, 0x01, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x18, 0x01, 0x02, 0x02, "Upright" }, + {0x18, 0x01, 0x02, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x18, 0x01, 0x08, 0x08, "3" }, + {0x18, 0x01, 0x08, 0x00, "255" }, +}; + +STDDIPINFO(Mars) + +static struct BurnDIPInfo MimonkeyDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x03, NULL }, + {0x13, 0xff, 0xff, 0xae, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "6" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x13, 0x01, 0x06, 0x00, "3 Coins 1 Play" }, + {0x13, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, + {0x13, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, + {0x13, 0x01, 0x06, 0x02, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x08, 0x08, "Upright" }, + {0x13, 0x01, 0x08, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Infinite Lives" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, +}; + +STDDIPINFO(Mimonkey) + +static struct BurnDIPInfo MimonscoDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x01, NULL }, + {0x13, 0xff, 0xff, 0xae, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "1" }, + {0x12, 0x01, 0x03, 0x02, "2" }, + {0x12, 0x01, 0x03, 0x01, "3" }, + {0x12, 0x01, 0x03, 0x00, "4" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x13, 0x01, 0x06, 0x00, "3 Coins 1 Play" }, + {0x13, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, + {0x13, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, + {0x13, 0x01, 0x06, 0x02, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x08, 0x08, "Upright" }, + {0x13, 0x01, 0x08, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Infinite Lives" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, +}; + +STDDIPINFO(Mimonsco) + +static struct BurnDIPInfo MinefldDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x02, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Starting Level" }, + {0x0e, 0x01, 0x02, 0x00, "1" }, + {0x0e, 0x01, 0x02, 0x02, "3" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0f, 0x01, 0x01, 0x00, "3" }, + {0x0f, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x02, 0x00, "Off" }, + {0x0f, 0x01, 0x02, 0x02, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x10, 0x01, 0x02, 0x00, "1 Coin 1 Play" }, + {0x10, 0x01, 0x02, 0x02, "A 1C/2P B 2C/1P" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x10, 0x01, 0x0c, 0x00, "Easy" }, + {0x10, 0x01, 0x0c, 0x04, "Medium" }, + {0x10, 0x01, 0x0c, 0x08, "Hard" }, + {0x10, 0x01, 0x0c, 0x0c, "Hardest" }, +}; + +STDDIPINFO(Minefld) + +static struct BurnDIPInfo Moonal2DIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x20, 0x00, "Upright" }, + {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x0d, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x03, 0x01, "4000" }, + {0x0e, 0x01, 0x03, 0x02, "5000" }, + {0x0e, 0x01, 0x03, 0x03, "7000" }, + {0x0e, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x04, 0x00, "3" }, + {0x0e, 0x01, 0x04, 0x04, "5" }, +}; + +STDDIPINFO(Moonal2) + +static struct BurnDIPInfo MooncrgxDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0xc0, NULL }, + {0x0d, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x0c, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x0c, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0d, 0x01, 0x01, 0x01, "30000" }, + {0x0d, 0x01, 0x01, 0x00, "50000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x08, 0x00, "Upright" }, + {0x0d, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Mooncrgx) + +static struct BurnDIPInfo MooncrsaDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x80, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x20, 0x00, "Upright" }, + {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0c, 0x01, 0x40, 0x00, "30000" }, + {0x0c, 0x01, 0x40, 0x40, "50000" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x0c, 0x01, 0x80, 0x80, "English" }, + {0x0c, 0x01, 0x80, 0x00, "Japanese" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0x0c, 0x0c, "Freeplay" }, +}; + +STDDIPINFO(Mooncrsa) + +static struct BurnDIPInfo MooncrsgDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x20, 0x00, "Upright" }, + {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0c, 0x01, 0x40, 0x00, "30000" }, + {0x0c, 0x01, 0x40, 0x40, "50000" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0d, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0d, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0x0c, 0x0c, "Freeplay" }, +}; + +STDDIPINFO(Mooncrsg) + +static struct BurnDIPInfo MooncrstDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x80, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x20, 0x00, "Upright" }, + {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0c, 0x01, 0x40, 0x00, "30000" }, + {0x0c, 0x01, 0x40, 0x40, "50000" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x0c, 0x01, 0x80, 0x80, "English" }, + {0x0c, 0x01, 0x80, 0x00, "Japanese" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0d, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0d, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0x0c, 0x0c, "Freeplay" }, +}; + +STDDIPINFO(Mooncrst) + +static struct BurnDIPInfo MoonqsrDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x20, 0x00, "Upright" }, + {0x0b, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0xc0, 0x00, "Easy" }, + {0x0c, 0x01, 0xc0, 0x40, "Medium" }, + {0x0c, 0x01, 0xc0, 0x80, "Hard" }, + {0x0c, 0x01, 0xc0, 0xc0, "Hardest" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0d, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0d, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0x0c, 0x0c, "Freeplay" }, +}; + +STDDIPINFO(Moonqsr) + +static struct BurnDIPInfo MoonwarDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x03, NULL }, + {0x0f, 0xff, 0xff, 0x0c, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x03, 0x03, "3" }, + {0x0e, 0x01, 0x03, 0x02, "4" }, + {0x0e, 0x01, 0x03, 0x01, "5" }, + {0x0e, 0x01, 0x03, 0x00, "Free Play" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0f, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, + {0x0f, 0x01, 0x06, 0x06, "1 Coin 2 Plays" }, + {0x0f, 0x01, 0x06, 0x02, "1 Coin 3 Plays" }, + {0x0f, 0x01, 0x06, 0x00, "1 Coin 4 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x08, 0x08, "Upright" }, + {0x0f, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Moonwar) + +static struct BurnDIPInfo MoonwaraDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x03, NULL }, + {0x0f, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x03, 0x03, "3" }, + {0x0e, 0x01, 0x03, 0x02, "4" }, + {0x0e, 0x01, 0x03, 0x01, "5" }, + {0x0e, 0x01, 0x03, 0x00, "Free Play" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0f, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, + {0x0f, 0x01, 0x06, 0x04, "1 Coin 2 Plays" }, + {0x0f, 0x01, 0x06, 0x02, "1 Coin 3 Plays" }, + {0x0f, 0x01, 0x06, 0x00, "1 Coin 4 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x08, 0x08, "Upright" }, + {0x0f, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Moonwara) + +static struct BurnDIPInfo MrkougarDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x03, NULL }, + {0x0e, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x0d, 0x01, 0x02, 0x00, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x02, 0x02, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x0d, 0x01, 0x01, 0x01, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0x01, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x02, 0x02, "Upright" }, + {0x0e, 0x01, 0x02, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x04, 0x04, "3" }, + {0x0e, 0x01, 0x04, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0e, 0x01, 0x08, 0x00, "Easy" }, + {0x0e, 0x01, 0x08, 0x08, "Hard" }, +}; + +STDDIPINFO(Mrkougar) + +static struct BurnDIPInfo MshuttleDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x80, NULL }, + {0x0f, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0e, 0x01, 0x40, 0x00, "Off" }, + {0x0e, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x80, 0x80, "Upright" }, + {0x0e, 0x01, 0x80, 0x00, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x03, 0x00, "3" }, + {0x0f, 0x01, 0x03, 0x01, "4" }, + {0x0f, 0x01, 0x03, 0x02, "5" }, + {0x0f, 0x01, 0x03, 0x03, "6" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0f, 0x01, 0x04, 0x00, "20000" }, + {0x0f, 0x01, 0x04, 0x04, "30000" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0e, 0x01, 0x18, 0x18, "3 Coins 1 Play" }, + {0x0e, 0x01, 0x18, 0x10, "3 Coins 1 Play" }, + {0x0e, 0x01, 0x18, 0x08, "2 Coins 1 Play" }, + {0x0e, 0x01, 0x18, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0e, 0x01, 0x60, 0x00, "1 Coin 1 Play" }, + {0x0e, 0x01, 0x60, 0x20, "1 Coin 2 Plays" }, + {0x0e, 0x01, 0x60, 0x40, "1 Coin 3 Plays" }, + {0x0e, 0x01, 0x60, 0x60, "1 Coin 4 Plays" }, +}; + +STDDIPINFO(Mshuttle) + +static struct BurnDIPInfo Newsin7DIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x0c, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x10, 0x01, 0x03, 0x00, "A 1C/1P B 2C/1P" }, + {0x10, 0x01, 0x03, 0x02, "A 1C/3P B 3C/1P" }, + {0x10, 0x01, 0x03, 0x01, "A 1C/2P B 1C/1P" }, + {0x10, 0x01, 0x03, 0x03, "A 1C/4P B 4C/1P" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x02, 0x00, "Upright" }, + {0x11, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x08, 0x08, "3" }, + {0x11, 0x01, 0x08, 0x00, "5" }, +}; + +STDDIPINFO(Newsin7) + +static struct BurnDIPInfo OmegaDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0xc0, NULL }, + {0x0d, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x0c, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x0c, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x0c, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x0c, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0d, 0x01, 0x01, 0x00, "10000" }, + {0x0d, 0x01, 0x01, 0x01, "20000" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0d, 0x01, 0x04, 0x00, "3" }, + {0x0d, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x08, 0x00, "Upright" }, + {0x0d, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Omega) + +static struct BurnDIPInfo OrbitronDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x40, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x10, 0x01, 0x60, 0x00, "A 2C/1P B 1C/3P" }, + {0x10, 0x01, 0x60, 0x40, "A 1C/1P B 1C/6P" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x04, 0x04, "2" }, + {0x11, 0x01, 0x04, 0x00, "3" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x08, 0x00, "Upright" }, + {0x11, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Orbitron) + +static struct BurnDIPInfo Ozon1DIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x02, NULL }, + {0x0d, 0xff, 0xff, 0x06, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0c, 0x01, 0x03, 0x03, "3" }, + {0x0c, 0x01, 0x03, 0x02, "4" }, + {0x0c, 0x01, 0x03, 0x01, "5" }, + {0x0c, 0x01, 0x03, 0x00, "6" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0x06, 0x06, "A 1C/1P B 2C/1P" }, + {0x0d, 0x01, 0x06, 0x04, "A 1C/2P B 1C/1P" }, + {0x0d, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, + {0x0d, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, +}; + +STDDIPINFO(Ozon1) + +static struct BurnDIPInfo PacmanblDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0xc0, NULL }, + {0x0f, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x0e, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x0e, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x0e, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x0e, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0f, 0x01, 0x01, 0x00, "15000" }, + {0x0f, 0x01, 0x01, 0x01, "20000" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0f, 0x01, 0x02, 0x00, "Easy" }, + {0x0f, 0x01, 0x02, 0x02, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0f, 0x01, 0x04, 0x00, "3" }, + {0x0f, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x08, 0x00, "Upright" }, + {0x0f, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Pacmanbl) + +static struct BurnDIPInfo Phoenxp2DIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0xc0, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x10, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x10, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x10, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x10, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x11, 0x01, 0x02, 0x00, "Easy" }, + {0x11, 0x01, 0x02, 0x02, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x04, 0x00, "3" }, + {0x11, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x08, 0x00, "Upright" }, + {0x11, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Phoenxp2) + +static struct BurnDIPInfo PiscesDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0c, 0x01, 0x40, 0x00, "3" }, + {0x0c, 0x01, 0x40, 0x40, "4" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x80, 0x00, "Upright" }, + {0x0c, 0x01, 0x80, 0x80, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0d, 0x01, 0x01, 0x00, "10000" }, + {0x0d, 0x01, 0x01, 0x01, "20000" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0x02, 0x02, "A 2C/1P B 1C/3P" }, + {0x0d, 0x01, 0x02, 0x00, "A 1C/1P B 1C/6P" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0d, 0x01, 0x04, 0x00, "Easy" }, + {0x0d, 0x01, 0x04, 0x04, "Hard" }, +}; + +STDDIPINFO(Pisces) + +static struct BurnDIPInfo PiscesbDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0c, 0x01, 0x40, 0x00, "3" }, + {0x0c, 0x01, 0x40, 0x40, "4" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x80, 0x00, "Upright" }, + {0x0c, 0x01, 0x80, 0x80, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0d, 0x01, 0x01, 0x00, "10000" }, + {0x0d, 0x01, 0x01, 0x01, "20000" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0x02, 0x02, "A 2C/1P B 1C/2P 2C/5P" }, + {0x0d, 0x01, 0x02, 0x00, "A 1C/1P B 1C/5P" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0d, 0x01, 0x04, 0x00, "Easy" }, + {0x0d, 0x01, 0x04, 0x04, "Hard" }, +}; + +STDDIPINFO(Piscesb) + +static struct BurnDIPInfo PorterDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 +}; + +STDDIPINFO(Porter) + +static struct BurnDIPInfo RacknrolDIPList[]= +{ + // Default Values + {0x0a, 0xff, 0xff, 0x00, NULL }, + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 +}; + +STDDIPINFO(Racknrol) + +static struct BurnDIPInfo RedufoDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0xc0, NULL }, + {0x0e, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Coin A" }, + {0x0d, 0x01, 0x40, 0x00, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x40, 0x40, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Coin B" }, + {0x0d, 0x01, 0x80, 0x80, "1 Coin 3 Plays" }, + {0x0d, 0x01, 0x80, 0x00, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0e, 0x01, 0x01, 0x00, "7000" }, + {0x0e, 0x01, 0x01, 0x01, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x04, 0x00, "3" }, + {0x0e, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x08, 0x00, "Upright" }, + {0x0e, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Redufo) + +static struct BurnDIPInfo RedufobDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x20, 0x00, "Upright" }, + {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0xc0, 0x40, "A 2C/1P B 1C/3P" }, + {0x0d, 0x01, 0xc0, 0x00, "A 1C/1P B 1C/6P" }, + {0x0d, 0x01, 0xc0, 0x80, "A 1C/2P B 1C/12P" }, + {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x03, 0x01, "4000" }, + {0x0e, 0x01, 0x03, 0x02, "5000" }, + {0x0e, 0x01, 0x03, 0x03, "7000" }, + {0x0e, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x04, 0x00, "3" }, + {0x0e, 0x01, 0x04, 0x04, "5" }, +}; + +STDDIPINFO(Redufob) + +static struct BurnDIPInfo RescueDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x02, NULL }, + {0x10, 0xff, 0xff, 0x0c, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Starting Level" }, + {0x0e, 0x01, 0x02, 0x00, "1" }, + {0x0e, 0x01, 0x02, 0x02, "3" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0f, 0x01, 0x01, 0x00, "3" }, + {0x0f, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x02, 0x00, "Off" }, + {0x0f, 0x01, 0x02, 0x02, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x10, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, + {0x10, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, + {0x10, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, + {0x10, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x10, 0x01, 0x08, 0x08, "Easy" }, + {0x10, 0x01, 0x08, 0x00, "Hard" }, +}; + +STDDIPINFO(Rescue) + +static struct BurnDIPInfo RockclimDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0x40, NULL }, + {0x0e, 0xff, 0xff, 0xc0, NULL }, + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0e, 0x01, 0x40, 0x00, "30000" }, + {0x0e, 0x01, 0x40, 0x40, "50000" }, + + {0 , 0xfe, 0 , 2 , "Coin Slots" }, + {0x0e, 0x01, 0x80, 0x80, "1" }, + {0x0e, 0x01, 0x80, 0x00, "2" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x03, 0x00, "3" }, + {0x0f, 0x01, 0x03, 0x01, "4" }, + {0x0f, 0x01, 0x03, 0x02, "5" }, + {0x0f, 0x01, 0x03, 0x03, "6" }, + + // Dip 4 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x10, 0x01, 0x0f, 0x00, "9 Coins 1 Play" }, + {0x10, 0x01, 0x0f, 0x01, "8 Coins 1 Play" }, + {0x10, 0x01, 0x0f, 0x02, "7 Coins 1 Play" }, + {0x10, 0x01, 0x0f, 0x03, "6 Coins 1 Play" }, + {0x10, 0x01, 0x0f, 0x04, "5 Coins 1 Play" }, + {0x10, 0x01, 0x0f, 0x05, "4 Coins 1 Play" }, + {0x10, 0x01, 0x0f, 0x06, "3 Coins 1 Play" }, + {0x10, 0x01, 0x0f, 0x07, "2 Coins 1 Play" }, + {0x10, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, + {0x10, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, + {0x10, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, + {0x10, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + {0x10, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, + {0x10, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, + {0x10, 0x01, 0x0f, 0x09, "1 Coin 7 Plays" }, + {0x10, 0x01, 0x0f, 0x08, "1 Coin 8 Plays" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x10, 0x01, 0xf0, 0x00, "9 Coins 1 Play" }, + {0x10, 0x01, 0xf0, 0x10, "8 Coins 1 Play" }, + {0x10, 0x01, 0xf0, 0x20, "7 Coins 1 Play" }, + {0x10, 0x01, 0xf0, 0x30, "6 Coins 1 Play" }, + {0x10, 0x01, 0xf0, 0x40, "5 Coins 1 Play" }, + {0x10, 0x01, 0xf0, 0x50, "4 Coins 1 Play" }, + {0x10, 0x01, 0xf0, 0x60, "3 Coins 1 Play" }, + {0x10, 0x01, 0xf0, 0x70, "2 Coins 1 Play" }, + {0x10, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, + {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Plays" }, + {0x10, 0x01, 0xf0, 0xd0, "1 Coin 3 Plays" }, + {0x10, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, + {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Plays" }, + {0x10, 0x01, 0xf0, 0xa0, "1 Coin 6 Plays" }, + {0x10, 0x01, 0xf0, 0x90, "1 Coin 7 Plays" }, + {0x10, 0x01, 0xf0, 0x80, "1 Coin 8 Plays" }, +}; + +STDDIPINFO(Rockclim) + +static struct BurnDIPInfo ScobraDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x03, NULL }, + {0x14, 0xff, 0xff, 0x0c, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x13, 0x01, 0x02, 0x02, "3" }, + {0x13, 0x01, 0x02, 0x00, "4" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x14, 0x01, 0x06, 0x02, "2 Coins 1 Play" }, + {0x14, 0x01, 0x06, 0x00, "4 Coins 3 Plays" }, + {0x14, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, + {0x14, 0x01, 0x06, 0x06, "1 Coin 99 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x08, 0x08, "Upright" }, + {0x14, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Scobra) + +static struct BurnDIPInfo ScobrasDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x03, NULL }, + {0x14, 0xff, 0xff, 0x0c, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x13, 0x01, 0x02, 0x02, "3" }, + {0x13, 0x01, 0x02, 0x00, "5" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x14, 0x01, 0x06, 0x02, "2 Coins 1 Play" }, + {0x14, 0x01, 0x06, 0x00, "4 Coins 3 Plays" }, + {0x14, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, + {0x14, 0x01, 0x06, 0x06, "1 Coin 99 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x08, 0x08, "Upright" }, + {0x14, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Scobras) + +static struct BurnDIPInfo ScorpionDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x04, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x04, 0x00, "3" }, + {0x12, 0x01, 0x04, 0x01, "4" }, + {0x12, 0x01, 0x04, 0x02, "5" }, + {0x12, 0x01, 0x04, 0x03, "255" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x04, 0x04, "Upright" }, + {0x13, 0x01, 0x04, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x13, 0x01, 0x08, 0x00, "A 1C/1P B 1C/1P" }, + {0x13, 0x01, 0x08, 0x08, "A 1C/1P B 1C/3P" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0xa0, 0x00, "Normal" }, + {0x13, 0x01, 0xa0, 0x20, "Medium" }, + {0x13, 0x01, 0xa0, 0x80, "Hard" }, + {0x13, 0x01, 0xa0, 0xa0, "Very Hard" }, +}; + +STDDIPINFO(Scorpion) + +static struct BurnDIPInfo ScorpionmcDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x40, NULL }, + {0x11, 0xff, 0xff, 0x04, NULL }, + {0x12, 0xff, 0xff, 0x02, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x10, 0x01, 0xc0, 0x00, "Easy" }, + {0x10, 0x01, 0xc0, 0x40, "Normal" }, + {0x10, 0x01, 0xc0, 0x80, "Hard" }, + {0x10, 0x01, 0xc0, 0xc0, "Hardest" }, + + // Dip 3 + {0 , 0xfe, 0 , 3 , "Lives" }, + {0x11, 0x01, 0x0c, 0x00, "2" }, + {0x11, 0x01, 0x0c, 0x04, "3" }, + {0x11, 0x01, 0x0c, 0x08, "4" }, + + // Dip 4 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x01, 0x00, "Upright" }, + {0x12, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x12, 0x01, 0x06, 0x00, "2 Coins 1 Play" }, + {0x12, 0x01, 0x06, 0x02, "1 Coin 1 Play" }, + {0x12, 0x01, 0x06, 0x04, "1 Coin 2 Plays" }, + {0x12, 0x01, 0x06, 0x06, "1 Coin 3 Plays" }, +}; + +STDDIPINFO(Scorpionmc) + +static struct BurnDIPInfo AracnisDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x20, NULL }, + {0x0c, 0xff, 0xff, 0xf8, NULL }, + {0x0d, 0xff, 0xff, 0xfd, NULL }, + {0x0e, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0x03, 0x00, "2 Coins 1 Play" }, + {0x0d, 0x01, 0x03, 0x01, "1 Coin 1 Play" }, + {0x0d, 0x01, 0x03, 0x02, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0x03, 0x03, "1 Coin 3 Plays" }, + + // Dip 4 +}; + +STDDIPINFO(Aracnis) + +static struct BurnDIPInfo Scramb2DIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x03, NULL }, + {0x13, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "255" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x13, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, + {0x13, 0x01, 0x06, 0x04, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x06, 0x02, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x06, 0x00, "1 Coin 4 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x08, 0x08, "Upright" }, + {0x13, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Scramb2) + +static struct BurnDIPInfo ScramblbDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x40, 0x00, "Upright" }, + {0x11, 0x01, 0x40, 0x40, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x12, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, + {0x12, 0x01, 0x03, 0x01, "1 Coin 2 Plays" }, + {0x12, 0x01, 0x03, 0x02, "1 Coin 3 Plays" }, + {0x12, 0x01, 0x03, 0x03, "1 Coin 4 Plays" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x0c, 0x00, "3" }, + {0x12, 0x01, 0x0c, 0x04, "4" }, + {0x12, 0x01, 0x0c, 0x08, "5" }, + {0x12, 0x01, 0x0c, 0x0c, "255" }, +}; + +STDDIPINFO(Scramblb) + +static struct BurnDIPInfo ScrambleDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x03, NULL }, + {0x14, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "255" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x14, 0x01, 0x06, 0x06, "A 1C/1P B 2C/1P C 1C/1P"}, + {0x14, 0x01, 0x06, 0x04, "A 1C/2P B 1C/1P C 1C/2P"}, + {0x14, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P C 1C/3P"}, + {0x14, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P C 1C/4P"}, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x08, 0x08, "Upright" }, + {0x14, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Scramble) + +static struct BurnDIPInfo SfxDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x01, NULL }, + {0x14, 0xff, 0xff, 0x08, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x01, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + {0x13, 0x01, 0x03, 0x03, "5" }, + {0x13, 0x01, 0x03, 0x00, "Invulerability" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x14, 0x01, 0x06, 0x06, "3 Coins 1 Play" }, + {0x14, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, + {0x14, 0x01, 0x06, 0x00, "1 Coin 1 Play" }, + {0x14, 0x01, 0x06, 0x02, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x08, 0x08, "Upright" }, + {0x14, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Sfx) + +static struct BurnDIPInfo SkybaseDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x20, 0x00, "Upright" }, + {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 1 Play (2 to start)"}, + {0x0d, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0xc0, 0x40, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x03, 0x00, "3" }, + {0x0e, 0x01, 0x03, 0x01, "4" }, + {0x0e, 0x01, 0x03, 0x02, "5" }, + {0x0e, 0x01, 0x03, 0x03, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x0c, 0x00, "10000" }, + {0x0e, 0x01, 0x0c, 0x40, "15000" }, + {0x0e, 0x01, 0x0c, 0x40, "20000" }, + {0x0e, 0x01, 0x0c, 0x40, "None" }, +}; + +STDDIPINFO(Skybase) + +static struct BurnDIPInfo SmooncrsDIPList[]= +{ + // Default Values + {0x08, 0xff, 0xff, 0x00, NULL }, + {0x09, 0xff, 0xff, 0xc0, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x08, 0x01, 0x20, 0x00, "Upright" }, + {0x08, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x09, 0x01, 0x40, 0x40, "Easy" }, + {0x09, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Players Bullet Speed" }, + {0x09, 0x01, 0x80, 0x00, "Slow" }, + {0x09, 0x01, 0x80, 0x80, "Fast" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x10, 0x01, 0x03, 0x03, "4 Coins 1 Play" }, + {0x10, 0x01, 0x03, 0x02, "3 Coins 1 Play" }, + {0x10, 0x01, 0x03, 0x01, "2 Coins 1 Play" }, + {0x10, 0x01, 0x03, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x10, 0x01, 0x0c, 0x00, "1 Coin 1 Play" }, + {0x10, 0x01, 0x0c, 0x04, "1 Coin 2 Plays" }, + {0x10, 0x01, 0x0c, 0x08, "1 Coin 3 Plays" }, + {0x10, 0x01, 0x0c, 0x0c, "Freeplay" }, +}; + +STDDIPINFO(Smooncrs) + +static struct BurnDIPInfo SpacbattDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x20, 0x00, "Upright" }, + {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0xc0, 0x40, "A 2C/1P B 1C/3P" }, + {0x0d, 0x01, 0xc0, 0x00, "A 1C/1P B 1C/6P" }, + {0x0d, 0x01, 0xc0, 0x80, "A 1C/2P B 1C/6P" }, + {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x03, 0x01, "4000" }, + {0x0e, 0x01, 0x03, 0x02, "5000" }, + {0x0e, 0x01, 0x03, 0x03, "7000" }, + {0x0e, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x04, 0x00, "3" }, + {0x0e, 0x01, 0x04, 0x04, "5" }, +}; + +STDDIPINFO(Spacbatt) + +static struct BurnDIPInfo SpdcoinDIPList[]= +{ + // Default Values + {0x07, 0xff, 0xff, 0x00, NULL }, + {0x08, 0xff, 0xff, 0x03, NULL }, + {0x09, 0xff, 0xff, 0x06, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x08, 0x01, 0x01, 0x01, "Off" }, + {0x08, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x08, 0x01, 0x02, 0x02, "Off" }, + {0x08, 0x01, 0x02, 0x00, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x09, 0x01, 0x04, 0x04, "Easy" }, + {0x09, 0x01, 0x04, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x09, 0x01, 0x08, 0x00, "3" }, + {0x09, 0x01, 0x08, 0x08, "5" }, +}; + +STDDIPINFO(Spdcoin) + +static struct BurnDIPInfo StratgyxDIPList[] = +{ + // Default Values + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x03, NULL }, + {0x14, 0xff, 0xff, 0x08, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "255" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x08, 0x08, "Upright" }, + {0x14, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Stratgyx) + +static struct BurnDIPInfo StreakngDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x40, NULL }, + {0x0e, 0xff, 0xff, 0x06, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x20, 0x00, "Upright" }, + {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0d, 0x01, 0xc0, 0x40, "10000" }, + {0x0d, 0x01, 0xc0, 0x81, "15000" }, + {0x0d, 0x01, 0xc0, 0xc0, "20000" }, + {0x0d, 0x01, 0xc0, 0x00, "None" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0e, 0x01, 0x03, 0x00, "2 Coins 1 Play" }, + {0x0e, 0x01, 0x03, 0x02, "1 Coin 1 Play" }, + {0x0e, 0x01, 0x03, 0x01, "1 Coin 2 Plays" }, + {0x0e, 0x01, 0x03, 0x03, "Freeplay" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x0c, 0x0c, "1" }, + {0x0e, 0x01, 0x0c, 0x08, "2" }, + {0x0e, 0x01, 0x0c, 0x04, "3" }, + {0x0e, 0x01, 0x0c, 0x00, "5" }, +}; + +STDDIPINFO(Streakng) + +static struct BurnDIPInfo StrfbombDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x03, NULL }, + {0x14, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "255" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x14, 0x01, 0x06, 0x06, "A 1C/2P B 4C/1P C 1C/2P"}, + {0x14, 0x01, 0x06, 0x04, "A 1C/3P B 2C/1P C 1C/3P"}, + {0x14, 0x01, 0x06, 0x02, "A 1C/4P B 3C/1P C 1C/4P"}, + {0x14, 0x01, 0x06, 0x00, "A 1C/5P B 1C/1P C 1C/5P"}, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x08, 0x08, "Upright" }, + {0x14, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Strfbomb) + +static struct BurnDIPInfo SuperbonDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0x00, NULL }, + {0x0c, 0xff, 0xff, 0x02, NULL }, + {0x0d, 0xff, 0xff, 0x04, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0c, 0x01, 0x03, 0x02, "3" }, + {0x0c, 0x01, 0x03, 0x01, "5" }, + {0x0c, 0x01, 0x03, 0x00, "Free Play" }, + {0x0c, 0x01, 0x03, 0x03, "Invulnerability" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0x06, 0x04, "1 Coin 1 Play" }, + {0x0d, 0x01, 0x06, 0x06, "A 1C/2P B 2C/1P" }, + {0x0d, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P" }, + {0x0d, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P" }, +}; + +STDDIPINFO(Superbon) + +static struct BurnDIPInfo SupergDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x20, 0x00, "Upright" }, + {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x0d, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x03, 0x01, "4000" }, + {0x0e, 0x01, 0x03, 0x02, "5000" }, + {0x0e, 0x01, 0x03, 0x03, "7000" }, + {0x0e, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x04, 0x00, "3" }, + {0x0e, 0x01, 0x04, 0x04, "5" }, +}; + +STDDIPINFO(Superg) + +static struct BurnDIPInfo SwarmDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x00, NULL }, + {0x0e, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x20, 0x00, "Upright" }, + {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x0d, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + {0x0d, 0x01, 0xc0, 0xc0, "Freeplay" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x03, 0x01, "10000" }, + {0x0e, 0x01, 0x03, 0x02, "20000" }, + {0x0e, 0x01, 0x03, 0x03, "40000" }, + {0x0e, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x04, 0x00, "3" }, + {0x0e, 0x01, 0x04, 0x04, "4" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0e, 0x01, 0x08, 0x00, "Easy" }, + {0x0e, 0x01, 0x08, 0x08, "Hard" }, +}; + +STDDIPINFO(Swarm) + +static struct BurnDIPInfo TazzmangDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x04, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x01, 0x00, "Upright" }, + {0x11, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x11, 0x01, 0x06, 0x00, "A 4C/1P B 1C/4P" }, + {0x11, 0x01, 0x06, 0x02, "A 3C/1P B 1C/3P" }, + {0x11, 0x01, 0x06, 0x06, "A 2C/1P B 1C/2P" }, + {0x11, 0x01, 0x06, 0x04, "A 1C/1P B 1C/1P" }, +}; + +STDDIPINFO(Tazzmang) + +static struct BurnDIPInfo TheendDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x03, NULL }, + {0x10, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x03, 0x03, "3" }, + {0x0f, 0x01, 0x03, 0x02, "4" }, + {0x0f, 0x01, 0x03, 0x01, "5" }, + {0x0f, 0x01, 0x03, 0x00, "256" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x10, 0x01, 0x06, 0x02, "3 Coins 1 Play" }, + {0x10, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, + {0x10, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, + {0x10, 0x01, 0x06, 0x00, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x08, 0x08, "Upright" }, + {0x10, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Theend) + +static struct BurnDIPInfo ThepitmDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0c, 0x01, 0x04, 0x00, "Off" }, + {0x0c, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x08, 0x00, "Upright" }, + {0x11, 0x01, 0x08, 0x08, "Cocktail" }, +}; + +STDDIPINFO(Thepitm) + +static struct BurnDIPInfo TriplepDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x03, NULL }, + {0x12, 0xff, 0xff, 0xae, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x03, "3" }, + {0x11, 0x01, 0x03, 0x02, "4" }, + {0x11, 0x01, 0x03, 0x01, "5" }, + {0x11, 0x01, 0x03, 0x00, "256" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x12, 0x01, 0x06, 0x04, "A 1C/2P B 1C/1P C 1C/2C"}, + {0x12, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P C 1C/3C"}, + {0x12, 0x01, 0x06, 0x06, "A 1C/1P B 2C/1P C 1C/1C"}, + {0x12, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P C 1C/4C"}, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x08, 0x08, "Upright" }, + {0x12, 0x01, 0x08, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Rack Test" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Triplep) + +static struct BurnDIPInfo TurpinDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x03, NULL }, + {0x12, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x03, "3" }, + {0x11, 0x01, 0x03, 0x02, "5" }, + {0x11, 0x01, 0x03, 0x01, "7" }, + {0x11, 0x01, 0x03, 0x00, "126" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x12, 0x01, 0x06, 0x00, "4 Coins 1 Play" }, + {0x12, 0x01, 0x06, 0x04, "2 Coins 1 Play" }, + {0x12, 0x01, 0x06, 0x06, "1 Coin 1 Play" }, + {0x12, 0x01, 0x06, 0x02, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x08, 0x08, "Upright" }, + {0x12, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Turpin) + +static struct BurnDIPInfo TurtlesDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x03, NULL }, + {0x12, 0xff, 0xff, 0x0e, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x03, "3" }, + {0x11, 0x01, 0x03, 0x02, "4" }, + {0x11, 0x01, 0x03, 0x01, "5" }, + {0x11, 0x01, 0x03, 0x00, "126" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x12, 0x01, 0x06, 0x06, "A 1C/1P B 2C/1P C 1C/1P"}, + {0x12, 0x01, 0x06, 0x04, "A 1C/2P B 1C/1P C 1C/2P"}, + {0x12, 0x01, 0x06, 0x02, "A 1C/3P B 3C/1P C 1C/3P"}, + {0x12, 0x01, 0x06, 0x00, "A 1C/4P B 4C/1P C 1C/4P"}, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x08, 0x08, "Upright" }, + {0x12, 0x01, 0x08, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Turtles) + +static struct BurnDIPInfo VpoolDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x20, NULL }, + {0x0d, 0xff, 0xff, 0xe0, NULL }, + {0x0e, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + + // Dip 3 +}; + +STDDIPINFO(Vpool) + +static struct BurnDIPInfo WarofbugDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x0a, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x20, 0x00, "Upright" }, + {0x0f, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 2 + {0 , 0xfe, 0 , 3 , "Coinage" }, + {0x10, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x10, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x10, 0x01, 0xc0, 0xc0, "Freeplay" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x00, "1" }, + {0x11, 0x01, 0x03, 0x01, "2" }, + {0x11, 0x01, 0x03, 0x02, "3" }, + {0x11, 0x01, 0x03, 0x03, "4" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x11, 0x01, 0x08, 0x08, "500000" }, + {0x11, 0x01, 0x08, 0x00, "700000" }, +}; + +STDDIPINFO(Warofbug) + +static struct BurnDIPInfo ZerotimeDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x00, NULL }, + {0x0d, 0xff, 0xff, 0x40, NULL }, + {0x0e, 0xff, 0xff, 0x03, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x20, 0x00, "Upright" }, + {0x0c, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0xc0, 0x40, "A 1C/1P 2C/3P B 1C/2P" }, + {0x0d, 0x01, 0xc0, 0xc0, "A 1C/1P 2C/3P B 1C/3P" }, + {0x0d, 0x01, 0xc0, 0x00, "A 1C/2P 2C/4P B 1C/4P" }, + {0x0d, 0x01, 0xc0, 0x80, "A 1C/2P 2C/5P B 1C/5P" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x03, 0x03, "6000" }, + {0x0e, 0x01, 0x03, 0x02, "7000" }, + {0x0e, 0x01, 0x03, 0x01, "9000" }, + {0x0e, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0e, 0x01, 0x04, 0x00, "3" }, + {0x0e, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0e, 0x01, 0x08, 0x00, "Easy" }, + {0x0e, 0x01, 0x08, 0x08, "Hard" }, +}; + +STDDIPINFO(Zerotime) + +static struct BurnDIPInfo ZigzagDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0x00, NULL }, + {0x10, 0xff, 0xff, 0x02, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x0f, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + {0x0f, 0x01, 0xc0, 0xc0, "Freeplay" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x10, 0x01, 0x01, 0x00, "3" }, + {0x10, 0x01, 0x01, 0x01, "4" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x02, 0x02, "Upright" }, + {0x10, 0x01, 0x02, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x10, 0x01, 0x0c, 0x00, "10000 60000" }, + {0x10, 0x01, 0x0c, 0x04, "20000 60000" }, + {0x10, 0x01, 0x0c, 0x08, "30000 60000" }, + {0x10, 0x01, 0x0c, 0x0c, "40000 60000" }, +}; + +STDDIPINFO(Zigzag) + +// Drivers +// Basic Galaxian Hardware +static struct BurnRomInfo GalaxianRomDesc[] = { + { "galmidw.u", 0x00800, 0x745e2d61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galmidw.v", 0x00800, 0x9c999a40, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galmidw.w", 0x00800, 0xb5894925, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galmidw.y", 0x00800, 0x6b3ca10b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7l", 0x00800, 0x1b933207, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "1h.bin", 0x00800, 0x39fb43a4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "1k.bin", 0x00800, 0x7e3f56a2, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galaxian) +STD_ROM_FN(Galaxian) + +static struct BurnRomInfo GalaxianaRomDesc[] = { + { "7f.bin", 0x01000, 0x4335b1de, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7j.bin", 0x01000, 0x4e6f66a1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7l.bin", 0x00800, 0x5341d75a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "1h.bin", 0x00800, 0x39fb43a4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "1k.bin", 0x00800, 0x7e3f56a2, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galaxiana) +STD_ROM_FN(Galaxiana) + +static struct BurnRomInfo GalaxianmRomDesc[] = { + { "galmidw.u", 0x00800, 0x745e2d61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galmidw.v", 0x00800, 0x9c999a40, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galmidw.w", 0x00800, 0xb5894925, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galmidw.y", 0x00800, 0x6b3ca10b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galmidw.z", 0x00800, 0xcb24f797, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "galaxian.j1", 0x00800, 0x84decf98, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "galaxian.l1", 0x00800, 0xc31ada9e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galaxianm) +STD_ROM_FN(Galaxianm) + +static struct BurnRomInfo GalaxianmoRomDesc[] = { + { "galaxian.u", 0x00800, 0xfac42d34, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galaxian.v", 0x00800, 0xf58283e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galaxian.w", 0x00800, 0x4c7031c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galaxian.y", 0x00800, 0x96a7ac94, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7l.bin", 0x00800, 0x5341d75a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "galaxian.j1", 0x00800, 0x84decf98, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "galaxian.l1", 0x00800, 0xc31ada9e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galaxianmo) +STD_ROM_FN(Galaxianmo) + +static struct BurnRomInfo GalaxiantRomDesc[] = { + { "gl-03.8g", 0x00800, 0xe8f3aa67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "gl-04.8f", 0x00800, 0xf58283e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "gl-05.8e", 0x00800, 0x4c7031c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "gl-06.8d", 0x00800, 0x097d92a2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "gl-07.8c", 0x00800, 0x5341d75a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "gl-01.1j", 0x00800, 0x968b6016, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "gl-02.1k", 0x00800, 0xd14f7510, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galaxiant) +STD_ROM_FN(Galaxiant) + +struct BurnDriver BurnDrvGalaxian = { + "galaxian", NULL, NULL, NULL, "1979", + "Galaxian (Namco set 1)\0", NULL, "Namco", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GalaxianRomInfo, GalaxianRomName, NULL, NULL, GalaxianInputInfo, GalaxianDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGalaxiana = { + "galaxiana", "galaxian", NULL, NULL, "1979", + "Galaxian (Namco set 2)\0", NULL, "Namco", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GalaxianaRomInfo, GalaxianaRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGalaxianm = { + "galaxianm", "galaxian", NULL, NULL, "1979", + "Galaxian (Midway set 1)\0", NULL, "Namco (Midway license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GalaxianmRomInfo, GalaxianmRomName, NULL, NULL, GalaxianInputInfo, GalaxianDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGalaxianmo = { + "galaxianmo", "galaxian", NULL, NULL, "1979", + "Galaxian (Midway set 2)\0", NULL, "Namco (Midway license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GalaxianmoRomInfo, GalaxianmoRomName, NULL, NULL, GalaxianInputInfo, GalaxianDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGalaxiant = { + "galaxiant", "galaxian", NULL, NULL, "1979", + "Galaxian (Taito)\0", NULL, "Namco (Taito license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GalaxiantRomInfo, GalaxiantRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Galaxian Rip-Offs on basic Galaxian Hardware +static struct BurnRomInfo MoonalnRomDesc[] = { + { "galx.u", 0x00800, 0x79e4007d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "prg2.bin", 0x00800, 0x59580b30, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "prg3.bin", 0x00800, 0xb64e9d12, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "superg.y", 0x00800, 0x9463f753, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "prg5.bin", 0x00800, 0x8bb78987, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ca1.bin", 0x00800, 0x074271dd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ca2.bin", 0x00800, 0x84d90397, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Moonaln) +STD_ROM_FN(Moonaln) + +static struct BurnRomInfo SupergRomDesc[] = { + { "7f.bin", 0x01000, 0x4335b1de, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "superg.w", 0x00800, 0xddeabdae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "superg.y", 0x00800, 0x9463f753, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "superg.z", 0x00800, 0xe6312e35, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "galmidw.1j", 0x00800, 0x84decf98, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "galmidw.1k", 0x00800, 0xc31ada9e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Superg) +STD_ROM_FN(Superg) + +static struct BurnRomInfo GalturboRomDesc[] = { + { "galturbo.u", 0x00800, 0xe8f3aa67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galx.v", 0x00800, 0xbc16064e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "superg.w", 0x00800, 0xddeabdae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galturbo.y", 0x00800, 0xa44f450f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galturbo.z", 0x00800, 0x3247f3d4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "galturbo.1h", 0x00800, 0xa713fd1a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "galturbo.1k", 0x00800, 0x28511790, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galturbo) +STD_ROM_FN(Galturbo) + +static struct BurnRomInfo GalapxRomDesc[] = { + { "galx.u", 0x00800, 0x79e4007d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galx.v", 0x00800, 0xbc16064e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galx.w", 0x00800, 0x72d2d3ee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galx.y", 0x00800, 0xafe397f3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galx.z", 0x00800, 0x778c0d3c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "galx.1h", 0x00800, 0xe8810654, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "galx.1k", 0x00800, 0xcbe84a76, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galapx) +STD_ROM_FN(Galapx) + +static struct BurnRomInfo Galap1RomDesc[] = { + { "7f.bin", 0x01000, 0x4335b1de, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galaxian.w", 0x00800, 0x4c7031c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galx_1_4.rom", 0x00800, 0xe71e1d9e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galx_1_5.rom", 0x00800, 0x6e65a3b2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "galmidw.1j", 0x00800, 0x84decf98, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "galmidw.1k", 0x00800, 0xc31ada9e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galap1) +STD_ROM_FN(Galap1) + +static struct BurnRomInfo Galap4RomDesc[] = { + { "galnamco.u", 0x00800, 0xacfde501, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galnamco.v", 0x00800, 0x65cf3c77, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galnamco.w", 0x00800, 0x9eef9ae6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galnamco.y", 0x00800, 0x56a5ddd1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galnamco.z", 0x00800, 0xf4bc7262, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "galx_4c1.rom", 0x00800, 0xd5e88ab4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "galx_4c2.rom", 0x00800, 0xa57b83e4, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galap4) +STD_ROM_FN(Galap4) + +static struct BurnRomInfo SwarmRomDesc[] = { + { "swarm1.bin", 0x00800, 0x21eba3d0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "swarm2.bin", 0x00800, 0xf3a436cd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "swarm3.bin", 0x00800, 0x2915e38b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "swarm4.bin", 0x00800, 0x8bbbf486, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "swarm5.bin", 0x00800, 0xf1b1987e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "swarma.bin", 0x00800, 0xef8657bb, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "swarmb.bin", 0x00800, 0x60c4bd31, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Swarm) +STD_ROM_FN(Swarm) + +static struct BurnRomInfo ZerotimeRomDesc[] = { + { "zt-p01c.016", 0x00800, 0x90a2bc61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "zt-2.016", 0x00800, 0xa433067e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "zt-3.016", 0x00800, 0xaaf038d4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "zt-4.016", 0x00800, 0x786d690a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "zt-5.016", 0x00800, 0xaf9260d7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ztc-2.016", 0x00800, 0x1b13ca05, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ztc-1.016", 0x00800, 0x5cd7df03, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Zerotime) +STD_ROM_FN(Zerotime) + +static struct BurnRomInfo StarfghtRomDesc[] = { + { "ja.1", 0x00400, 0xc6ab558b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb.2", 0x00400, 0x34b99fed, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jc.3", 0x00400, 0x30e28016, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jd.4", 0x00400, 0xde7e7770, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "je.5", 0x00400, 0xa916c919, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jf.6", 0x00400, 0x9175882b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jg.7", 0x00400, 0x707c0f02, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jh.8", 0x00400, 0x5dd26461, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ji.9", 0x00400, 0x6651fe93, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jj.10", 0x00400, 0x12c721b9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "k1.7a", 0x00800, 0x977e37cf, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k2.9a", 0x00800, 0x15e387ce, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.7f", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Starfght) +STD_ROM_FN(Starfght) + +static struct BurnRomInfo GalaxbsfRomDesc[] = { + { "1.bn", 0x00400, 0xcc37b774, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2.bn", 0x00400, 0xc6d21f03, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3.bn", 0x00400, 0x30e28016, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4.bn", 0x00400, 0xde7e7770, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5.bn", 0x00400, 0xa916c919, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6.bn", 0x00400, 0x9175882b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7.bn", 0x00400, 0x1237b9da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8.bn", 0x00400, 0x78c53607, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "9.bn", 0x00400, 0x901894cc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "10.bn", 0x00400, 0x5876f695, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "11.bn", 0x00800, 0x39fb43a4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "12.bn", 0x00800, 0x7e3f56a2, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galaxbsf) +STD_ROM_FN(Galaxbsf) + +static struct BurnRomInfo Kamakazi3RomDesc[] = { + { "f_r_a.bin", 0x00800, 0xe8f3aa67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f_a.bin", 0x00800, 0xf58283e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f_b.bin", 0x00800, 0xddeabdae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f_r_c.bin", 0x00800, 0xc8530a88, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f_r_d.bin", 0x00800, 0xda2d77e0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "r_b.bin", 0x00800, 0x977e37cf, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "r_a.bin", 0x00800, 0xd0ba22c9, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Kamakazi3) +STD_ROM_FN(Kamakazi3) + +static struct BurnRomInfo SupergxRomDesc[] = { + { "sg1", 0x00800, 0xb83f4578, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sg2", 0x00800, 0xd12ca054, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sg3", 0x00800, 0x53714cb1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sg4", 0x00800, 0x2f36fc69, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sg5", 0x00800, 0x1e0ed4fd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sg6", 0x00800, 0x4f3d97a8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "sgg1", 0x00800, 0xa1287bf6, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "sgg2", 0x00800, 0x528f1481, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "supergx.prm", 0x00020, 0x00000000, BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(Supergx) +STD_ROM_FN(Supergx) + +static struct BurnRomInfo TstgalxRomDesc[] = { + { "test.u", 0x00800, 0x0614cd7f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galmidw.v", 0x00800, 0x9c999a40, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galmidw.w", 0x00800, 0xb5894925, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "galmidw.y", 0x00800, 0x6b3ca10b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7l", 0x00800, 0x1b933207, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "1h.bin", 0x00800, 0x39fb43a4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "1k.bin", 0x00800, 0x7e3f56a2, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Tstgalx) +STD_ROM_FN(Tstgalx) + +static INT32 SupergxInit() +{ + INT32 nRet; + + GalTilesSharedRomSize = 0x1000; + GalPromRomSize = 0x20; + + nRet = GalInit(); + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x1800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + + HardCodeGalaxianPROM(); + + return nRet; +} + +struct BurnDriver BurnDrvMoonaln = { + "moonaln", "galaxian", NULL, NULL, "1979", + "Moon Alien\0", NULL, "Nichibutsu (Karateco license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MoonalnRomInfo, MoonalnRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSuperg = { + "superg", "galaxian", NULL, NULL, "1979", + "Super Galaxians (galaxiaj hack)\0", NULL, "hack", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SupergRomInfo, SupergRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGalturbo = { + "galturbo", "galaxian", NULL, NULL, "1979", + "Galaxian Turbo (superg hack)\0", NULL, "hack", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GalturboRomInfo, GalturboRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGalapx = { + "galapx", "galaxian", NULL, NULL, "1979", + "Galaxian Part X (moonaln hack)\0", NULL, "hack", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GalapxRomInfo, GalapxRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGalap1 = { + "galap1", "galaxian", NULL, NULL, "1979", + "Space Invaders Galactica (galaxiaj hack)\0", NULL, "hack", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Galap1RomInfo, Galap1RomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGalap4 = { + "galap4", "galaxian", NULL, NULL, "1979", + "Galaxian Part 4 (hack)\0", NULL, "G.G.I", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Galap4RomInfo, Galap4RomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSwarm = { + "swarm", "galaxian", NULL, NULL, "1979", + "Swarm (bootleg?)\0", NULL, "Sebelectro", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SwarmRomInfo, SwarmRomName, NULL, NULL, GalaxianInputInfo, SwarmDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvZerotime = { + "zerotime", "galaxian", NULL, NULL, "1979", + "Zero Time\0", NULL, "Petaco S.A", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, ZerotimeRomInfo, ZerotimeRomName, NULL, NULL, GalaxianInputInfo, ZerotimeDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvStarfght = { + "starfght", "galaxian", NULL, NULL, "1979", + "Star Fighter\0", NULL, "Juetel", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, StarfghtRomInfo, StarfghtRomName, NULL, NULL, GalaxianInputInfo, SwarmDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGalaxbsf = { + "galaxbsf", "galaxian", NULL, NULL, "1979", + "Galaxian (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GalaxbsfRomInfo, GalaxbsfRomName, NULL, NULL, GalaxianInputInfo, GalaxianDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvKamakazi3 = { + "kamakazi3", "galaxian", NULL, NULL, "1979", + "Kamakazi III (superg hack)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Kamakazi3RomInfo, Kamakazi3RomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriverD BurnDrvSupergx = { + "supergx", "galaxian", NULL, NULL, "1980", + "Super GX\0", "Bad Dump", "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SupergxRomInfo, SupergxRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + SupergxInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTstgalx = { + "tst_galx", "galaxian", NULL, NULL, "1979", + "Galaxian Test ROM\0", NULL, "Test ROM", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_PROTOTYPE, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, TstgalxRomInfo, TstgalxRomName, NULL, NULL, GalaxianInputInfo, GalaxianDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Other games on basic Galaxian hardware +static struct BurnRomInfo BlkholeRomDesc[] = { + { "bh1", 0x00800, 0x64998819, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bh2", 0x00800, 0x26f26ce4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bh3", 0x00800, 0x3418bc45, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bh4", 0x00800, 0x735ff481, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bh5", 0x00800, 0x3f657be9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bh6", 0x00800, 0xa057ab35, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "bh7", 0x00800, 0x975ba821, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "bh8", 0x00800, 0x03d11020, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Blkhole) +STD_ROM_FN(Blkhole) + +static struct BurnRomInfo OrbitronRomDesc[] = { + { "orbitron.3", 0x00800, 0x419f9c9b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "orbitron.4", 0x00800, 0x44ad56ac, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "orbitron.1", 0x00800, 0xda3f5168, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "orbitron.2", 0x00800, 0xa3b813fc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "orbitron.5", 0x00800, 0x20cd8bb8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "orbitron.6", 0x00800, 0x2c91b83f, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "orbitron.7", 0x00800, 0x46f4cca4, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Orbitron) +STD_ROM_FN(Orbitron) + +static struct BurnRomInfo LuctodayRomDesc[] = { + { "ltprog1.bin", 0x00800, 0x59c389b9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ltprog2.bin", 0x00800, 0xac3893b1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ltchar2.bin", 0x00800, 0x8cd73bdc, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ltchar1.bin", 0x00800, 0xb5ba9946, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "74s288.ch", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Luctoday) +STD_ROM_FN(Luctoday) + +static struct BurnRomInfo ChewingRomDesc[] = { + { "1.bin", 0x01000, 0x7470b347, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7l.bin", 0x00800, 0x78ebed36, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "2.bin", 0x00800, 0x88c605f3, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "3.bin", 0x00800, 0x77ac016a, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "74s288.ch", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Chewing) +STD_ROM_FN(Chewing) + +static struct BurnRomInfo CatacombRomDesc[] = { + { "catacomb.u", 0x00800, 0x35cc28d2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "catacomb.v", 0x00800, 0x1d1ce133, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "catacomb.w", 0x00800, 0x479bbde7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "catacomb.y", 0x00800, 0x5e3da534, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "cat-gfx1", 0x00800, 0xe871e65c, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "cat-gfx2", 0x00800, 0xb14dafaa, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Catacomb) +STD_ROM_FN(Catacomb) + +static struct BurnRomInfo OmegaRomDesc[] = { + { "omega1.bin", 0x00800, 0xfc2a096b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "omega2.bin", 0x00800, 0xad100357, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "omega3.bin", 0x00800, 0xd7e3be79, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "omega4.bin", 0x00800, 0x42068171, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "omega5.bin", 0x00800, 0xd8a93383, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "omega6.bin", 0x00800, 0x32a42f44, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "omega1h.bin", 0x00800, 0x527fd384, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "omega1k.bin", 0x00800, 0x36de42c6, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331-1j.86", 0x00020, 0x6a0c7d87, BRF_OPT | BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Omega) +STD_ROM_FN(Omega) + +static struct BurnRomInfo WarofbugRomDesc[] = { + { "warofbug.u", 0x00800, 0xb8dfb7e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "warofbug.v", 0x00800, 0xfd8854e0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "warofbug.w", 0x00800, 0x4495aa14, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "warofbug.y", 0x00800, 0xc14a541f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "warofbug.z", 0x00800, 0xc167fe55, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "warofbug.1k", 0x00800, 0x8100fa85, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "warofbug.1j", 0x00800, 0xd1220ae9, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "warofbug.clr", 0x00020, 0x8688e64b, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Warofbug) +STD_ROM_FN(Warofbug) + +static struct BurnRomInfo WarofbuggRomDesc[] = { + { "wotbg-u-1.bin", 0x00800, 0xf43ff0a8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "wotbg-v-2.bin", 0x00800, 0xeb7a028b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "wotbg-w-3.bin", 0x00800, 0x693e0e50, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "wotbg-y-4.bin", 0x00800, 0x885d4982, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "wotbg-z-5.bin", 0x00800, 0x60041ef2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "warofbug.1k", 0x00800, 0x8100fa85, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "warofbug.1j", 0x00800, 0xd1220ae9, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "warofbug.clr", 0x00020, 0x8688e64b, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Warofbugg) +STD_ROM_FN(Warofbugg) + +static struct BurnRomInfo WarofbuguRomDesc[] = { + { "wb-prog-1.7d", 0x00800, 0xb8dfb7e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "wb-prog-2.7e", 0x00800, 0xfd8854e0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "wb-prog-3.7j", 0x00800, 0x4495aa14, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "wb-prog-4.7n", 0x00800, 0xe4bd257c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "wb-prog-5.7p", 0x00800, 0x71257bb4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "warofbug.1k", 0x00800, 0x8100fa85, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "warofbug.1j", 0x00800, 0xd1220ae9, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "warofbug.clr", 0x00020, 0x8688e64b, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Warofbugu) +STD_ROM_FN(Warofbugu) + +static struct BurnRomInfo RedufoRomDesc[] = { + { "redufo.1", 0x00800, 0x6a3b873c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "redufo.2", 0x00800, 0x202eda3b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "redufo.3", 0x00800, 0xbf7030e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "redufo.4", 0x00800, 0x8c1c2ef9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "redufo.5", 0x00800, 0xef965b24, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "redufo.6", 0x00800, 0x58b3e39b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "redufo.7", 0x00800, 0xfd07d811, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "redufo.8", 0x00800, 0xb34c7cb4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "redufo.9", 0x00800, 0x50a2d447, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "tbp18s030n.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Redufo) +STD_ROM_FN(Redufo) + +static struct BurnRomInfo RedufobRomDesc[] = { + { "ru1a", 0x00800, 0x5a8e4f37, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ru2a", 0x00800, 0xc624f52d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ru3a", 0x00800, 0xe1030d1c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ru4a", 0x00800, 0x7692069e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ru5a", 0x00800, 0xcb648ff3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ru6a", 0x00800, 0xe1a9f58e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ruhja", 0x00800, 0x8a422b0d, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rukla", 0x00800, 0x1eb84cb1, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Redufob) +STD_ROM_FN(Redufob) + +static struct BurnRomInfo ExodusRomDesc[] = { + { "exodus1.bin", 0x00800, 0x5dfe65e1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "exodus2.bin", 0x00800, 0x6559222f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "exodus3.bin", 0x00800, 0xbf7030e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "exodus4.bin", 0x00800, 0x3607909e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "exodus9.bin", 0x00800, 0x994a90c4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "exodus10.bin", 0x00800, 0xfbd11187, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "exodus11.bin", 0x00800, 0xfd07d811, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "exodus5.bin", 0x00800, 0xb34c7cb4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "exodus6.bin", 0x00800, 0x50a2d447, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Exodus) +STD_ROM_FN(Exodus) + +static struct BurnRomInfo TdpgalRomDesc[] = { + { "1.bin", 0x00800, 0x7be819fe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2.bin", 0x00800, 0x70c83a5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3.bin", 0x00800, 0x475eb5a0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4.bin", 0x00800, 0x20a71943, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5.bin", 0x00800, 0x72c4f2dc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6.bin", 0x00800, 0xfa4e2be4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "8.bin", 0x00800, 0xd701b1d4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "7.bin", 0x00800, 0x3113bcfd, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "bprom.bin", 0x00020, 0x2b4cf53f, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Tdpgal) +STD_ROM_FN(Tdpgal) + +static struct BurnRomInfo AzurianRomDesc[] = { + { "pgm.1", 0x01000, 0x17a0fca7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "pgm.2", 0x01000, 0x14659848, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "pgm.3", 0x01000, 0x8f60fb97, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "gfx.1", 0x00800, 0xf5afb803, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "gfx.2", 0x00800, 0xae96e5d1, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Azurian) +STD_ROM_FN(Azurian) + +static struct BurnRomInfo TazzmangRomDesc[] = { + { "tazzm1.4k", 0x01000, 0xa14480a1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tazzm2.5j", 0x01000, 0x5609f5db, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tazzm3.6f", 0x01000, 0xfe7f7002, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tazzm4.7e", 0x01000, 0xc9ca1d0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tazzm5.7l", 0x01000, 0xf50cd8a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tazzm6.7l", 0x01000, 0x5cf2e7d2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "tazm8.1lk", 0x00800, 0x2c5b612b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "tazzm7.1jh", 0x00800, 0x3f5ff3ac, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Tazzmang) +STD_ROM_FN(Tazzmang) + +static struct BurnRomInfo ScramblbRomDesc[] = { + { "scramble.1k", 0x00800, 0x9e025c4a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scramble.2k", 0x00800, 0x306f783e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scramble.3k", 0x00800, 0x0500b701, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scramble.4k", 0x00800, 0xdd380a22, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scramble.5k", 0x00800, 0xdf0b9648, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scramble.1j", 0x00800, 0xb8c07b3c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scramble.2j", 0x00800, 0x88ac07a0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scramble.3j", 0x00800, 0xc67d57ca, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "5f.k", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h.k", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Scramblb) +STD_ROM_FN(Scramblb) + +static struct BurnRomInfo Scramb2RomDesc[] = { + { "r1.7f1", 0x00800, 0x4a43148c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "r1.7f2", 0x00800, 0x215a3b86, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "r2.7h1", 0x00800, 0x28779444, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "r2.7h2", 0x00800, 0x5b4b300b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "r3.7k1", 0x00800, 0xb478aa53, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "r3.7k2", 0x00800, 0xc33f072e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "r4.7l1", 0x00800, 0x88ac07a0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "r4.7l2", 0x00800, 0x321fd003, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "r6.1j", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "r5.1l", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Scramb2) +STD_ROM_FN(Scramb2) + +UINT8 __fastcall AzurianZ80Read(UINT16 a) +{ + switch (a) { + case 0x6000: { + return GalInput[0] | GalDip[0]; + } + + case 0x6800: { + return ((GalInput[1] | GalDip[1]) & ~0x40) | ((GalFakeDip & 0x01) << 6); + } + + case 0x7000: { + return ((GalInput[2] | GalDip[2]) & ~0x04) | ((GalFakeDip & 0x02) << 1); + } + + case 0x7800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +UINT8 __fastcall TazzmangZ80Read(UINT16 a) +{ + switch (a) { + case 0x9800: + case 0xb800: { + // watchdog read + return 0xff; + } + + case 0xa000: + case 0xa7ff: { + return GalInput[0] | GalDip[0]; + } + + case 0xa800: { + return GalInput[1] | GalDip[1]; + } + + case 0x7000: + case 0xb000: { + return GalInput[2] | GalDip[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall TazzmangZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x8800 && a <= 0x88ff) { + INT32 Offset = a - 0x8800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa800: + case 0xa801: + case 0xa802: + case 0xa803: + case 0xa804: + case 0xa805: + case 0xa806: + case 0xa807: { + GalaxianSoundWrite(a - 0xa800, d); + return; + } + + case 0xb001: { + GalIrqFire = d & 1; + return; + } + + case 0xb004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall ScramblbZ80Read(UINT16 a) +{ + switch (a) { + case 0x6000: { + return GalInput[0] | GalDip[0]; + } + + case 0x6800: { + return GalInput[1] | GalDip[1]; + } + + case 0x7000: { + return GalInput[2] | GalDip[2]; + } + + case 0x7800: { + // watchdog read + return 0xff; + } + + case 0x8102: { + switch (ZetPc(-1)) { + case 0x1da: return 0x80; + case 0x1e4: return 0x00; + } + return 0xff; + } + + case 0x8202: { + switch (ZetPc(-1)) { + case 0x1ca: return 0x90; + } + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall ScramblbZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6000: + case 0x6001: { + // start_lamp_w + return; + } + + case 0x6002: { + // coin_lock_w + return; + } + + case 0x6004: + case 0x6005: + case 0x6006: + case 0x6007: { + GalaxianLfoFreqWrite(a - 0x6004, d); + return; + } + + case 0x6800: + case 0x6801: + case 0x6802: + case 0x6803: + case 0x6804: + case 0x6805: + case 0x6806: + case 0x6807: { + GalaxianSoundWrite(a - 0x6800, d); + return; + } + + case 0x7001: { + GalIrqFire = d & 1; + return; + } + + case 0x7002: { + // coin_count_0_w + return; + } + + case 0x7003: { + GalBackgroundEnable = d & 1; + return; + } + + case 0x7004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x7006: { + GalFlipScreenX = d & 1; + return; + } + + case 0x7007: { + GalFlipScreenY = d & 1; + return; + } + + case 0x7800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Scramb2Z80Read(UINT16 a) +{ + if (a >= 0x5800 && a <= 0x5fff) return 0x25; + + switch (a) { + case 0x6000: + case 0x6001: + case 0x6002: + case 0x6003: + case 0x6004: + case 0x6005: + case 0x6006: + case 0x6007: { + int Offset = a - 0x6000; + return ((0xff - GalInput[0] - GalDip[0]) >> Offset) & 0x01; + } + + case 0x6800: + case 0x6801: + case 0x6802: + case 0x6803: + case 0x6804: + case 0x6805: + case 0x6806: + case 0x6807: { + int Offset = a - 0x6800; + return ((0xff - GalInput[1] - GalDip[1]) >> Offset) & 0x01; + } + + case 0x7000: { + // watchdog read + return 0xff; + } + + case 0x7800: + case 0x7801: + case 0x7802: + case 0x7803: + case 0x7804: + case 0x7805: + case 0x7806: + case 0x7807: { + INT32 Offset = a - 0x7800; + return ((0xff - GalInput[2] - GalDip[2]) >> Offset) & 0x01; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall Scramb2Z80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6000: + case 0x6001: + case 0x6002: + case 0x6003: + case 0x6004: + case 0x6005: + case 0x6006: + case 0x6007: + case 0x7000: + case 0x7001: + case 0x7002: + case 0x7003: + case 0x7004: + case 0x7005: + case 0x7006: + case 0x7007: { + // Probably PPI writes that the bootleggers didn't use + return; + } + + case 0x6801: { + GalIrqFire = d & 1; + return; + } + + case 0x6802: { + // coin_count_0_w + return; + } + + case 0x6803: { + GalBackgroundEnable = d & 1; + return; + } + + case 0x6804: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x6806: { + GalFlipScreenX = d & 1; + return; + } + + case 0x6807: { + GalFlipScreenY = d & 1; + return; + } + + case 0x7800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static void OrbitronRearrangeRom() +{ + GalTempRom = (UINT8*)BurnMalloc(0x2000); + + memcpy(GalTempRom, GalZ80Rom1, 0x2000); + memcpy(GalZ80Rom1 + 0x0600, GalTempRom + 0x0000, 0x200); + memcpy(GalZ80Rom1 + 0x0400, GalTempRom + 0x0200, 0x200); + memcpy(GalZ80Rom1 + 0x0200, GalTempRom + 0x0400, 0x200); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0600, 0x200); + memcpy(GalZ80Rom1 + 0x0e00, GalTempRom + 0x0800, 0x200); + memcpy(GalZ80Rom1 + 0x0c00, GalTempRom + 0x0a00, 0x200); + memcpy(GalZ80Rom1 + 0x0a00, GalTempRom + 0x0c00, 0x200); + memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x0e00, 0x200); + memcpy(GalZ80Rom1 + 0x1600, GalTempRom + 0x1000, 0x200); + memcpy(GalZ80Rom1 + 0x1400, GalTempRom + 0x1200, 0x200); + memcpy(GalZ80Rom1 + 0x1200, GalTempRom + 0x1400, 0x200); + memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x1600, 0x200); + memcpy(GalZ80Rom1 + 0x1e00, GalTempRom + 0x1800, 0x200); + memcpy(GalZ80Rom1 + 0x1c00, GalTempRom + 0x1a00, 0x200); + memcpy(GalZ80Rom1 + 0x1a00, GalTempRom + 0x1c00, 0x200); + memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x1e00, 0x200); + BurnFree(GalTempRom); +} + +static INT32 OrbitronInit() +{ + GalPostLoadCallbackFunction = OrbitronRearrangeRom; + + return GalInit(); +} + +static void LuctodayRearrangeRom() +{ + memcpy(GalZ80Rom1 + 0x2000, GalZ80Rom1 + 0x0800, 0x800); + memset(GalZ80Rom1 + 0x0800, 0, 0x800); +} + +static INT32 LuctodayInit() +{ + GalZ80Rom1Size = 0x1800; + GalPostLoadCallbackFunction = LuctodayRearrangeRom; + + return GalInit(); +} + +static void ChewingRearrangeRom() +{ + memcpy(GalZ80Rom1 + 0x2000, GalZ80Rom1 + 0x1000, 0x800); + memset(GalZ80Rom1 + 0x1000, 0, 0x800); +} + +static INT32 ChewingInit() +{ + GalZ80Rom1Size = 0x1000; + GalPostLoadCallbackFunction = ChewingRearrangeRom; + + return GalInit(); +} + +static void CatacombRearrangeRom() +{ + memcpy(GalZ80Rom1 + 0x2000, GalZ80Rom1 + 0x1800, 0x800); + memset(GalZ80Rom1 + 0x1800, 0, 0x800); +} + +static INT32 CatacombInit() +{ + GalZ80Rom1Size = 0x800; + GalPostLoadCallbackFunction = CatacombRearrangeRom; + + return GalInit(); +} + +static void TdpgalPostLoad() +{ + ZetOpen(0); + ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); + ZetClose(); +} + +static INT32 TdpgalInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = TdpgalPostLoad; + + nRet = GalInit(); + + return nRet; +} + +static void AzurianPostLoad() +{ + ZetOpen(0); + ZetSetReadHandler(AzurianZ80Read); + ZetClose(); +} + +static INT32 AzurianInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = AzurianPostLoad; + + nRet = GalInit(); + + GalDrawBulletsFunction = ScrambleDrawBullets; + + return nRet; +} + +static void TazzmangPostLoad() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(TazzmangZ80Read); + ZetSetWriteHandler(TazzmangZ80Write); + ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetMapArea(0x8800, 0x88ff, 0, GalSpriteRam); + ZetMapArea(0x8800, 0x88ff, 2, GalSpriteRam); + ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); + ZetClose(); +} + +static INT32 TazzmangInit() +{ + GalPostLoadCallbackFunction = TazzmangPostLoad; + + return GalInit(); +} + +static void MapScramblb() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(ScramblbZ80Read); + ZetSetWriteHandler(ScramblbZ80Write); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); + ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 0, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 1, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 2, GalVideoRam); + ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); + ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); + ZetClose(); +} + +static INT32 ScramblbInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapScramblb; + + nRet = GalInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + return nRet; +} + +static void Scramb2PostLoad() +{ + MapScramblb(); + + ZetOpen(0); + ZetSetReadHandler(Scramb2Z80Read); + ZetSetWriteHandler(Scramb2Z80Write); + ZetClose(); +} + +static INT32 Scramb2Init() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = Scramb2PostLoad; + + nRet = GalInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + return nRet; +} + +struct BurnDriver BurnDrvBlkhole = { + "blkhole", NULL, NULL, NULL, "1981", + "Black Hole\0", NULL, "TDS", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, BlkholeRomInfo, BlkholeRomName, NULL, NULL, BlkholeInputInfo, BlkholeDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvOrbitron = { + "orbitron", NULL, NULL, NULL, "19??", + "Orbitron\0", NULL, "Signatron USA", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SHOOT, 0, + NULL, OrbitronRomInfo, OrbitronRomName, NULL, NULL, OrbitronInputInfo, OrbitronDIPInfo, + OrbitronInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvLuctoday = { + "luctoday", NULL, NULL, NULL, "1980", + "Lucky Today\0", "Bad colours", "Sigma", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_GALAXIAN, GBF_CASINO, 0, + NULL, LuctodayRomInfo, LuctodayRomName, NULL, NULL, LuctodayInputInfo, LuctodayDIPInfo, + LuctodayInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvChewing = { + "chewing", "luctoday", NULL, NULL, "1980", + "Chewing Gum\0", NULL, "unknown", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_CASINO, 0, + NULL, ChewingRomInfo, ChewingRomName, NULL, NULL, LuctodayInputInfo, LuctodayDIPInfo, + ChewingInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvCatacomb = { + "catacomb", NULL, NULL, NULL, "1982", + "Catacomb\0", "Bad Colours", "MTM Games", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, CatacombRomInfo, CatacombRomName, NULL, NULL, OmegaInputInfo, CatacombDIPInfo, + CatacombInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvOmega = { + "omega", "theend", NULL, NULL, "19??", + "Omega\0", NULL, "bootleg?", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, OmegaRomInfo, OmegaRomName, NULL, NULL, OmegaInputInfo, OmegaDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvWarofbug = { + "warofbug", NULL, NULL, NULL, "1981", + "War of the Bugs or Monsterous Manouvers in a Mushroom Maze\0", NULL, "Armenia", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, WarofbugRomInfo, WarofbugRomName, NULL, NULL, WarofbugInputInfo, WarofbugDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriverD BurnDrvWarofbugg = { + "warofbugg", "warofbug", NULL, NULL, "1981", + "War of the Bugs or Monsterous Manouvers in a Mushroom Maze (German)\0", NULL, "Armenia", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, WarofbuggRomInfo, WarofbuggRomName, NULL, NULL, WarofbugInputInfo, WarofbugDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvWarofbugu = { + "warofbugu", "warofbug", NULL, NULL, "1981", + "War of the Bugs or Monsterous Manouvers in a Mushroom Maze (US)\0", NULL, "Armenia", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, WarofbuguRomInfo, WarofbuguRomName, NULL, NULL, WarofbugInputInfo, WarofbugDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvRedufo = { + "redufo", NULL, NULL, NULL, "1981", + "Defend the Terra Attack on the Red UFO\0", NULL, "Artic", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, RedufoRomInfo, RedufoRomName, NULL, NULL, GalaxianInputInfo, RedufoDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvRedufob = { + "redufob", "redufo", NULL, NULL, "1981", + "Defend the Terra Attack on the Red UFO (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, RedufobRomInfo, RedufobRomName, NULL, NULL, GalaxianInputInfo, RedufobDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvExodus = { + "exodus", "redufo", NULL, NULL, "19??", + "Exodus (bootleg?)\0", NULL, "Subelectro", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, ExodusRomInfo, ExodusRomName, NULL, NULL, OmegaInputInfo, ExodusDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTdpgal = { + "tdpgal", NULL, NULL, NULL, "1983", + "Triple Draw Poker\0", NULL, "Design Labs / Thomas Automatics", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_CASINO, 0, + NULL, TdpgalRomInfo, TdpgalRomName, NULL, NULL, TdpgalInputInfo, NULL, + TdpgalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAzurian = { + "azurian", NULL, NULL, NULL, "1982", + "Azurian Attack\0", NULL, "Rait Electronics Ltd", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SHOOT, 0, + NULL, AzurianRomInfo, AzurianRomName, NULL, NULL, AzurianInputInfo, AzurianDIPInfo, + AzurianInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTazzmang = { + "tazzmang", "tazmania", NULL, NULL, "1982", + "Tazz-Mania (Galaxian hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, TazzmangRomInfo, TazzmangRomName, NULL, NULL, TazzmangInputInfo, TazzmangDIPInfo, + TazzmangInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScramblb = { + "scramblb", "scramble", NULL, NULL, "1981", + "Scramble (bootleg on Galaxian hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScramblbRomInfo, ScramblbRomName, NULL, NULL, ScramblbInputInfo, ScramblbDIPInfo, + ScramblbInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScramb2 = { + "scramb2", "scramble", NULL, NULL, "1981", + "Scramble (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, Scramb2RomInfo, Scramb2RomName, NULL, NULL, Scramb2InputInfo, Scramb2DIPInfo, + Scramb2Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Extra chars controlled via bank at 0x6002 +static struct BurnRomInfo PiscesRomDesc[] = { + { "p1.bin", 0x00800, 0x40c5b0e4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p2.bin", 0x00800, 0x055f9762, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p3.bin", 0x00800, 0x3073dd04, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p4.bin", 0x00800, 0x44aaf525, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p5.bin", 0x00800, 0xfade512b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p6.bin", 0x00800, 0x5ab2822f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "g09.bin", 0x00800, 0x9503a23a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g11.bin", 0x00800, 0x0adfc3fe, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g10.bin", 0x00800, 0x3e61f849, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g12.bin", 0x00800, 0x7130e9eb, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "colour.bin", 0x00020, 0x57a45057, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Pisces) +STD_ROM_FN(Pisces) + +static struct BurnRomInfo PiscesbRomDesc[] = { + { "pisces.a1", 0x00800, 0x856b8e1f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p2.bin", 0x00800, 0x055f9762, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "pisces.b2", 0x00800, 0x5540f2e4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p4.bin", 0x00800, 0x44aaf525, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p5.bin", 0x00800, 0xfade512b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p6.bin", 0x00800, 0x5ab2822f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "g09.bin", 0x00800, 0x9503a23a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g11.bin", 0x00800, 0x0adfc3fe, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g10.bin", 0x00800, 0x3e61f849, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g12.bin", 0x00800, 0x7130e9eb, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "colour.bin", 0x00020, 0x57a45057, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Piscesb) +STD_ROM_FN(Piscesb) + +static struct BurnRomInfo OmniRomDesc[] = { + { "omni1.7f", 0x01000, 0xa9b7acc6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "omni2.7j", 0x01000, 0x6ade29b7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "omni3.7f", 0x01000, 0x9e37bb24, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "omni5b.l1", 0x00800, 0x9503a23a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "omni6c.j22", 0x00800, 0x0adfc3fe, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "omni4a.j1", 0x00800, 0x3e61f849, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "omni7d.l2", 0x00800, 0x7130e9eb, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "colour.bin", 0x00020, 0x57a45057, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Omni) +STD_ROM_FN(Omni) + +static struct BurnRomInfo UniwarsRomDesc[] = { + { "f07_1a.bin", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "h07_2a.bin", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "k07_3a.bin", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m07_4a.bin", 0x00800, 0xddc80bc5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "d08p_5a.bin", 0x00800, 0x62354351, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "gg6", 0x00800, 0x270a3f4d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m08p_7a.bin", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "n08p_8a.bin", 0x00800, 0x797d45c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "egg10", 0x00800, 0x012941e0, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "h01_2.bin", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "egg9", 0x00800, 0xfc8b58fd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "uniwars.clr", 0x00020, 0x25c79518, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Uniwars) +STD_ROM_FN(Uniwars) + +static struct BurnRomInfo GteikokuRomDesc[] = { + { "f07_1a.bin", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "h07_2a.bin", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "k07_3a.bin", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m07_4a.bin", 0x00800, 0xddc80bc5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "d08p_5a.bin", 0x00800, 0x62354351, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e08p_6a.bin", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m08p_7a.bin", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "n08p_8a.bin", 0x00800, 0x797d45c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "h01_1.bin", 0x00800, 0x8313c959, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "h01_2.bin", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k01_1.bin", 0x00800, 0xc9d4537e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Gteikoku) +STD_ROM_FN(Gteikoku) + +static struct BurnRomInfo GteikokbRomDesc[] = { + { "1.bin", 0x00800, 0xbf00252f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2.bin", 0x00800, 0xf712b7d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "k07_3a.bin", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4.bin", 0x00800, 0x808a39a8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5.bin", 0x00800, 0x36fe6e67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6.bin", 0x00800, 0xc5ea67e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m08p_7a.bin", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8.bin", 0x00800, 0x28df3229, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "h01_1.bin", 0x00800, 0x8313c959, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "h01_2.bin", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k01_1.bin", 0x00800, 0xc9d4537e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Gteikokb) +STD_ROM_FN(Gteikokb) + +static struct BurnRomInfo Gteikob2RomDesc[] = { + { "94gnog.bin", 0x00800, 0x67ec3235, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "92gnog.bin", 0x00800, 0x813c41f2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "k07_3a.bin", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "1gnog.bin", 0x00800, 0x49ff9658, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5.bin", 0x00800, 0x36fe6e67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e08p_6a.bin", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m08p_7a.bin", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "98gnog.bin", 0x00800, 0xe9d4ad3c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "h01_1.bin", 0x00800, 0x8313c959, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "h01_2.bin", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k01_1.bin", 0x00800, 0xc9d4537e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Gteikob2) +STD_ROM_FN(Gteikob2) + +static struct BurnRomInfo SpacbattRomDesc[] = { + { "sb1", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb2", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb3", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb4", 0x00800, 0x8229835c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb5", 0x00800, 0xf51ef930, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb6", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb7", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb8", 0x00800, 0xe59ff1ae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "sb12", 0x00800, 0x8313c959, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "sb14", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "sb11", 0x00800, 0xc9d4537e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "sb13", 0x00800, 0x92454380, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Spacbatt) +STD_ROM_FN(Spacbatt) + +static struct BurnRomInfo Spacbat2RomDesc[] = { + { "sb1", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb2", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb.3", 0x00800, 0xc25ce4c1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb4", 0x00800, 0x8229835c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb5", 0x00800, 0xf51ef930, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb6", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb7", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sb8", 0x00800, 0xe59ff1ae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "sb12", 0x00800, 0x8313c959, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "sb14", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "sb11", 0x00800, 0xc9d4537e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Spacbat2) +STD_ROM_FN(Spacbat2) + +static struct BurnRomInfo SpacemprRomDesc[] = { + { "uw01", 0x00800, 0x7c64fb92, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "uw02", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "uw03", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "uw04", 0x00800, 0x84885060, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "uw05", 0x00800, 0xe342371d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "uw06", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "uw07", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "uw08", 0x00800, 0xa237c394, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "uw10", 0x00800, 0xaf069cba, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "uw12", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "uw09", 0x00800, 0xff2c20d5, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "uw11", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Spacempr) +STD_ROM_FN(Spacempr) + +static struct BurnRomInfo SkyraidrRomDesc[] = { + { "f07_1a.bin", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "h07_2a.bin", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "k07_3a.bin", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sr.04", 0x00800, 0x9f61d1f8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sr.05", 0x00800, 0x4352af0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sr.06", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m08p_7a.bin", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "n08p_8a.bin", 0x00800, 0x797d45c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "sr.10", 0x00800, 0xaf069cba, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "h01_2.bin", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "sr.09", 0x00800, 0xff2c20d5, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k01_2.bin", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "uniwars.clr", 0x00020, 0x25c79518, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Skyraidr) +STD_ROM_FN(Skyraidr) + +static struct BurnRomInfo GalempRomDesc[] = { + { "1", 0x00800, 0xd975af10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2", 0x00800, 0xb2ed14c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3", 0x00800, 0x945f4160, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4", 0x00800, 0xdf7a13ea, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5", 0x00800, 0xff6128a2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6", 0x00800, 0xd915a389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7", 0x00800, 0xc9245346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8", 0x00800, 0x797d45c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "10", 0x00800, 0x30177b93, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "12", 0x00800, 0xc26132af, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "9", 0x00800, 0x7e8dcc13, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "11", 0x00800, 0xdcc2b33b, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Galemp) +STD_ROM_FN(Galemp) + +void __fastcall PiscesZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5800 && a <= 0x58ff) { + INT32 Offset = a - 0x5800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6000: + case 0x6001: { + // start_lamp_w + return; + } + + case 0x6002: { + GalGfxBank[0] = d; + return; + } + + case 0x6003: { + // coin_count_0_w + return; + } + + case 0x6004: + case 0x6005: + case 0x6006: + case 0x6007: { + GalaxianLfoFreqWrite(a - 0x6004, d); + return; + } + + case 0x6800: + case 0x6801: + case 0x6802: + case 0x6803: + case 0x6804: + case 0x6805: + case 0x6806: + case 0x6807: { + GalaxianSoundWrite(a - 0x6800, d); + return; + } + + case 0x7001: { + GalIrqFire = d & 1; + return; + } + + case 0x7004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x7006: { + GalFlipScreenX = d & 1; + return; + } + + case 0x7007: { + GalFlipScreenY = d & 1; + return; + } + + case 0x7800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static void PiscesInstallGfxBankHandler() +{ + ZetOpen(0); + ZetSetWriteHandler(PiscesZ80Write); + ZetClose(); +} + +static INT32 PiscesInit() +{ + GalPostLoadCallbackFunction = PiscesInstallGfxBankHandler; + GalExtendTileInfoFunction = PiscesExtendTileInfo; + GalExtendSpriteInfoFunction = PiscesExtendSpriteInfo; + + return GalInit(); +} + +struct BurnDriver BurnDrvPisces = { + "pisces", NULL, NULL, NULL, "19??", + "Pisces\0", NULL, "Subelectro", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, PiscesRomInfo, PiscesRomName, NULL, NULL, PicsesInputInfo, PiscesDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvPiscesb = { + "piscesb", "pisces", NULL, NULL, "19??", + "Pisces (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, PiscesbRomInfo, PiscesbRomName, NULL, NULL, PicsesInputInfo, PiscesbDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvOmni = { + "omni", "pisces", NULL, NULL, "19??", + "Omni\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, OmniRomInfo, OmniRomName, NULL, NULL, OmegaInputInfo, PiscesbDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvUniwars = { + "uniwars", NULL, NULL, NULL, "1980", + "UniWar S\0", NULL, "Irem", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, UniwarsRomInfo, UniwarsRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGteikoku = { + "gteikoku", "uniwars", NULL, NULL, "1980", + "Gingateikoku No Gyakushu\0", NULL, "Irem", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GteikokuRomInfo, GteikokuRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGteikokb = { + "gteikokb", "uniwars", NULL, NULL, "1980", + "Gingateikoku No Gyakushu (bootleg set 1)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GteikokbRomInfo, GteikokbRomName, NULL, NULL, OmegaInputInfo, GteikokbDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGteikob2 = { + "gteikob2", "uniwars", NULL, NULL, "1980", + "Gingateikoku No Gyakushu (bootleg set 2)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Gteikob2RomInfo, Gteikob2RomName, NULL, NULL, OmegaInputInfo, Gteikob2DIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSpacbatt = { + "spacbatt", "uniwars", NULL, NULL, "1980", + "Space Battle (bootleg set 1)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SpacbattRomInfo, SpacbattRomName, NULL, NULL, GalaxianInputInfo, SpacbattDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSpacbat2 = { + "spacbat2", "uniwars", NULL, NULL, "1980", + "Space Battle (bootleg set 2)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Spacbat2RomInfo, Spacbat2RomName, NULL, NULL, GalaxianInputInfo, SpacbattDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSpacempr = { + "spacempr", "uniwars", NULL, NULL, "1980", + "Space Empire (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SpacemprRomInfo, SpacemprRomName, NULL, NULL, GalaxianInputInfo, SpacbattDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSkyraidr = { + "skyraidr", "uniwars", NULL, NULL, "1980", + "Sky Raiders\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SkyraidrRomInfo, SkyraidrRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGalemp = { + "galemp", "uniwars", NULL, NULL, "1980", + "Galaxy Empire (bootleg?)\0", NULL, "bootleg (Taito do Brasil)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, GalempRomInfo, GalempRomName, NULL, NULL, GalaxianInputInfo, SupergDIPInfo, + PiscesInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Extra chars contolled via different banking at 0x6002 +static struct BurnRomInfo Batman2RomDesc[] = { + { "01.bin", 0x00800, 0x150fbca5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "02.bin", 0x00800, 0xb1624fd0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "03.bin", 0x00800, 0x93774188, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "04.bin", 0x00800, 0x8a94ec6c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "05.bin", 0x00800, 0xa3669461, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "06.bin", 0x00800, 0xfa1efbfe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "07.bin", 0x00800, 0x9b77debd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "08.bin", 0x00800, 0x6466177e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "09.bin", 0x00800, 0x1a657b1f, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "11.bin", 0x00800, 0x7a2b48e5, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "10.bin", 0x00800, 0x9b570016, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "12.bin", 0x00800, 0x73956244, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Batman2) +STD_ROM_FN(Batman2) + +static struct BurnRomInfo LadybuggRomDesc[] = { + { "lbuggx.1", 0x00800, 0xe67e241d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lbuggx.2", 0x00800, 0x3cb1fb9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lbuggx.3", 0x00800, 0x0937009e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lbuggx.4", 0x00800, 0x3e773f62, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lbuggx.5", 0x00800, 0x2b0d42e5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lbuggx.6", 0x00800, 0x159f9433, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lbuggx.7", 0x00800, 0xf2be06d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lbuggx.8", 0x00800, 0x646fe79f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "lbuggx.a", 0x01000, 0x7efb9dc5, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "lbuggx.b", 0x01000, 0x351d4ddc, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "lbuggx.clr", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Ladybugg) +STD_ROM_FN(Ladybugg) + +static INT32 Batman2Init() +{ + GalPostLoadCallbackFunction = PiscesInstallGfxBankHandler; + GalExtendTileInfoFunction = Batman2ExtendTileInfo; + GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; + + return GalInit(); +} + +static INT32 LadybuggInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = PiscesInstallGfxBankHandler; + GalExtendTileInfoFunction = Batman2ExtendTileInfo; + GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; + + nRet = GalInit(); + + UINT8 *TempRom = (UINT8*)BurnMalloc(0x1000); + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); + memcpy(GalTempRom + 0x0800, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x0000, TempRom + 0x0800, 0x800); + BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); + memcpy(GalTempRom + 0x1800, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x1000, TempRom + 0x0800, 0x800); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + BurnFree(TempRom); + + return nRet; +} + +struct BurnDriver BurnDrvBatman2 = { + "batman2", "phoenix", NULL, NULL, "1981", + "Batman Part 2\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Batman2RomInfo, Batman2RomName, NULL, NULL, Batman2InputInfo, Batman2DIPInfo, + Batman2Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvLadybugg = { + "ladybugg", "ladybug", NULL, NULL, "1983", + "Lady Bug (bootleg on Galaxian hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, LadybuggRomInfo, LadybuggRomName, NULL, NULL, LadybuggInputInfo, LadybuggDIPInfo, + LadybuggInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Seperate sprite/tile roms +static struct BurnRomInfo StreakngRomDesc[] = { + { "sk1", 0x01000, 0xc8866ccb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sk2", 0x01000, 0x7caea29b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sk3", 0x01000, 0x7b4bfa76, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "sk4", 0x01000, 0x056fc921, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "sk5", 0x01000, 0xd27f1e0c, BRF_GRA | GAL_ROM_TILES_CHARS }, + + { "sk6", 0x01000, 0xa7089588, BRF_GRA | GAL_ROM_TILES_SPRITES }, + + { "sk.bpr", 0x00020, 0xbce79607, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Streakng) +STD_ROM_FN(Streakng) + +static struct BurnRomInfo StreakngaRomDesc[] = { + { "st1.bin", 0x00800, 0xc827e124, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "st2.bin", 0x00800, 0xb01d4f8f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "st3.bin", 0x00800, 0xc7a9c493, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "st4.bin", 0x00800, 0x12487c75, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5st.bin", 0x00800, 0xf9f9e2be, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6st.bin", 0x00800, 0xc22fe6c2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7st.bin", 0x00800, 0x9cd7869a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8st.bin", 0x00800, 0x5e750ad3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "11.bin", 0x00800, 0xcddd8924, BRF_GRA | GAL_ROM_TILES_CHARS }, + { "12.bin", 0x00800, 0x10cda095, BRF_GRA | GAL_ROM_TILES_CHARS }, + + { "9.bin", 0x00800, 0x6a2a8a0f, BRF_GRA | GAL_ROM_TILES_SPRITES }, + { "10.bin", 0x00800, 0x3563dfbe, BRF_GRA | GAL_ROM_TILES_SPRITES }, + + { "sk.bpr", 0x00020, 0xbce79607, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Streaknga) +STD_ROM_FN(Streaknga) + +static struct BurnRomInfo PacmanblRomDesc[] = { + { "1", 0x00800, 0x6718df42, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2", 0x00800, 0x33be3648, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3", 0x00800, 0xf98c0ceb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4", 0x00800, 0xa9cd0082, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5", 0x00800, 0x6d475afc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6", 0x00800, 0xcbe863d3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7", 0x00800, 0x7daef758, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "12", 0x00800, 0xb2ed320b, BRF_GRA | GAL_ROM_TILES_CHARS }, + { "11", 0x00800, 0xab88b2c4, BRF_GRA | GAL_ROM_TILES_CHARS }, + + { "10", 0x00800, 0x44a45b72, BRF_GRA | GAL_ROM_TILES_SPRITES }, + { "9", 0x00800, 0xfa84659f, BRF_GRA | GAL_ROM_TILES_SPRITES }, + + { "sn74s288n.6l", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Pacmanbl) +STD_ROM_FN(Pacmanbl) + +static struct BurnRomInfo PacmanblaRomDesc[] = { + { "rom1.bin", 0x01000, 0x75e4f967, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom2.bin", 0x01000, 0x5b2e4293, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom3.bin", 0x01000, 0xc06e30a4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom4.bin", 0x01000, 0x592b4ba8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "rom5.bin", 0x01000, 0xf2d8c01e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom6.bin", 0x01000, 0x346a1720, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "sn74s288n.6l", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Pacmanbla) +STD_ROM_FN(Pacmanbla) + +static struct BurnRomInfo Phoenxp2RomDesc[] = { + { "1", 0x00800, 0xf6dcfd51, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2", 0x00800, 0xde951936, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3", 0x00800, 0x7a3af2da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4", 0x00800, 0xc820ad32, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5", 0x00800, 0x08e83233, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6", 0x00800, 0xf31fb9d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7", 0x00800, 0xd3a480c1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8", 0x00800, 0xedf9779e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "10", 0x00800, 0x9b570016, BRF_GRA | GAL_ROM_TILES_CHARS }, + { "09", 0x00800, 0x1a657b1f, BRF_GRA | GAL_ROM_TILES_CHARS }, + + { "12", 0x00800, 0x73956244, BRF_GRA | GAL_ROM_TILES_SPRITES }, + { "11", 0x00800, 0x7a2b48e5, BRF_GRA | GAL_ROM_TILES_SPRITES }, + + { "sn74s288n.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Phoenxp2) +STD_ROM_FN(Phoenxp2) + +static struct BurnRomInfo AtlantisbRomDesc[] = { + { "1", 0x00800, 0x2b612351, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2", 0x00800, 0xb1c970e9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3", 0x00800, 0x63c3783e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4", 0x00800, 0x45f7cf34, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5", 0x00800, 0xf335b96b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6", 0x00800, 0xa50bf8d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "8", 0x00800, 0x55cd5acd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "7", 0x00800, 0x72e773b8, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "sn74s288n.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Atlantisb) +STD_ROM_FN(Atlantisb) + +static INT32 PacmanblInit() +{ + INT32 nRet = GalInit(); + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + return nRet; +} + +static void PacmanblaRearrangeRom() +{ + GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); + memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x800); + memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0800, 0x800); + memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1000, 0x800); + memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1800, 0x800); + memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x800); + memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2800, 0x800); + memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3000, 0x800); + memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3800, 0x800); + BurnFree(GalTempRom); +} + +static INT32 PacmanblaInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = PacmanblaRearrangeRom; + + nRet = PacmanblInit(); + + GalNumChars = 0x100; + GalNumSprites = 0x40; + CharPlaneOffsets[1] = 0x4000; + SpritePlaneOffsets[1] = 0x4000; + + UINT8 *TempRom = (UINT8*)BurnMalloc(0x2000); + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); + BurnLoadRom(TempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); + memcpy(GalTempRom + 0x0000, TempRom + 0x0800, 0x800); + memcpy(GalTempRom + 0x0800, TempRom + 0x1800, 0x800); + memcpy(GalTempRom + 0x1000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x1800, TempRom + 0x1000, 0x800); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom + 0x1000, GalSprites); + BurnFree(GalTempRom); + BurnFree(TempRom); + + return nRet; +} + +static void AtlantisbRearrangeRom() +{ + GalTempRom = (UINT8*)BurnMalloc(0x3000); + + memcpy(GalTempRom, GalZ80Rom1, 0x3000); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x1000); + memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x1000, 0x2000); + BurnFree(GalTempRom); +} + +static INT32 AtlantisbInit() +{ + GalZ80Rom1Size = 0x1000; + + GalPostLoadCallbackFunction = AtlantisbRearrangeRom; + + return GalInit(); +} + +struct BurnDriver BurnDrvStreakng = { + "streakng", NULL, NULL, NULL, "1981", + "Streaking (set 1)\0", "Bad Colours", "Shoei", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, StreakngRomInfo, StreakngRomName, NULL, NULL, StreakngInputInfo, StreakngDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvStreaknga = { + "streaknga", "streakng", NULL, NULL, "1981", + "Streaking (set 2)\0", "Bad Colours", "Shoei", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, StreakngaRomInfo, StreakngaRomName, NULL, NULL, StreakngInputInfo, StreakngDIPInfo, + GalInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvPacmanbl = { + "pacmanbl", "puckman", NULL, NULL, "1981", + "Pac-Man (Galaxian hardware, set 1)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, PacmanblRomInfo, PacmanblRomName, NULL, NULL, PacmanblInputInfo, PacmanblDIPInfo, + PacmanblInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvPacmanbla = { + "pacmanbla", "puckman", NULL, NULL, "1981", + "Pac-Man (Galaxian hardware, set 2)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, PacmanblaRomInfo, PacmanblaRomName, NULL, NULL, PacmanblInputInfo, PacmanblDIPInfo, + PacmanblaInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvPhoenxp2 = { + "phoenxp2", "phoenix", NULL, NULL, "1981", + "Phoenix Part 2\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Phoenxp2RomInfo, Phoenxp2RomName, NULL, NULL, Phoenxp2InputInfo, Phoenxp2DIPInfo, + PacmanblInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAtlantisb = { + "atlantisb", "atlantis", NULL, NULL, "1981", + "Battle of Atlantis (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, AtlantisbRomInfo, AtlantisbRomName, NULL, NULL, Phoenxp2InputInfo, AtlantisbDIPInfo, + AtlantisbInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Seperate sprite/tile roms with IRQ0 instead of NMI +static struct BurnRomInfo DevilfsgRomDesc[] = { + { "dfish1.7f", 0x01000, 0x2ab19698, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "dfish2.7h", 0x01000, 0x4e77f097, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "dfish3.7k", 0x01000, 0x3f16a4c6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "dfish4.7m", 0x01000, 0x11fc7e59, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "dfish5.1h", 0x01000, 0xace6e31f, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "dfish6.1k", 0x01000, 0xd7a6c4c4, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Devilfsg) +STD_ROM_FN(Devilfsg) + +static void DevilfsgRearrangeRom() +{ + GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); + memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); + memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0000, 0x800); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0800, 0x800); + memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1000, 0x800); + memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1800, 0x800); + memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2000, 0x800); + memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2800, 0x800); + memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3000, 0x800); + memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3800, 0x800); + BurnFree(GalTempRom); +} + +static INT32 DevilfsgInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = DevilfsgRearrangeRom; + + nRet = GalInit(); + + GalNumChars = 0x100; + GalNumSprites = 0x40; + CharPlaneOffsets[1] = 0x4000; + SpritePlaneOffsets[1] = 0x4000; + + UINT8 *TempRom = (UINT8*)BurnMalloc(0x2000); + GalTempRom = (UINT8*)BurnMalloc(0x1000); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + nRet = BurnLoadRom(TempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x0000, TempRom + 0x0800, 0x800); + memcpy(GalTempRom + 0x0800, TempRom + 0x1800, 0x800); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + memcpy(GalTempRom + 0x0000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x0800, TempRom + 0x1000, 0x800); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + BurnFree(TempRom); + + GalIrqType = GAL_IRQ_TYPE_IRQ0; + + return nRet; +} + +struct BurnDriver BurnDrvDevilfsg = { + "devilfsg", "devilfsh", NULL, NULL, "1984", + "Devil Fish (Galaxian hardware, bootleg?)\0", NULL, "Vision / Artic", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, DevilfsgRomInfo, DevilfsgRomName, NULL, NULL, DevilfsgInputInfo, DevilfsgDIPInfo, + DevilfsgInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Sound hardware replaced with AY8910 +static struct BurnRomInfo ZigzagRomDesc[] = { + { "zz_d1.7l", 0x01000, 0x8cc08d81, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "zz_d2.7k", 0x01000, 0x326d8d45, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "zz_d4.7f", 0x01000, 0xa94ed92a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "zz_d3.7h", 0x01000, 0xce5e7a00, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "zz_6.1h", 0x01000, 0x780c162a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "zz_5.1k", 0x01000, 0xf3cdfec5, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "zzbpr_e9.bin", 0x00020, 0xaa486dd0, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Zigzag) +STD_ROM_FN(Zigzag) + +static struct BurnRomInfo Zigzag2RomDesc[] = { + { "z1.7l", 0x01000, 0x4c28349a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "zz_d2.7k", 0x01000, 0x326d8d45, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "zz_d4.7f", 0x01000, 0xa94ed92a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "zz_d3.7h", 0x01000, 0xce5e7a00, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "zz_6.1h", 0x01000, 0x780c162a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "zz_5.1k", 0x01000, 0xf3cdfec5, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "zzbpr_e9.bin", 0x00020, 0xaa486dd0, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Zigzag2) +STD_ROM_FN(Zigzag2) + +static struct BurnRomInfo Ozon1RomDesc[] = { + { "rom1.bin", 0x01000, 0x54899e8b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom2.bin", 0x01000, 0x3c90fbfc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom3.bin", 0x01000, 0x79fe313b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "rom7.bin", 0x00800, 0x464285e8, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom8.bin", 0x00800, 0x92056dcc, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "ozon1.clr", 0x00020, 0x605ea6e9, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Ozon1) +STD_ROM_FN(Ozon1) + +void __fastcall ZigzagZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x4800 && a <= 0x4fff) { + INT32 Offset = a - 0x4800; + + switch (Offset & 0x300) { + case 0x000: { + if ((Offset & 1) != 0) { + if ((Offset & 2) == 0) { + AY8910Write(0, 1, ZigzagAYLatch); + } else { + AY8910Write(0, 0, ZigzagAYLatch); + } + } + break; + } + + case 0x100: { + ZigzagAYLatch = Offset & 0xff; + break; + } + } + return; + } + + if (a >= 0x5800 && a <= 0x58ff) { + INT32 Offset = a - 0x5800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6000: + case 0x6001: { + // start_lamp_w + return; + } + + case 0x6002: { + // coin_lock_w + return; + } + + case 0x6003: { + // coin_count_0_w + return; + } + + case 0x7001: { + GalIrqFire = d & 1; + return; + } + + case 0x7002: { + ZetMapArea(0x2000, 0x2fff, 0, GalZ80Rom1 + 0x2000 + (0x1000 * (d & 1))); + ZetMapArea(0x2000, 0x2fff, 2, GalZ80Rom1 + 0x2000 + (0x1000 * (d & 1))); + ZetMapArea(0x3000, 0x3fff, 0, GalZ80Rom1 + 0x2000 + (0x1000 * (~d & 1))); + ZetMapArea(0x3000, 0x3fff, 2, GalZ80Rom1 + 0x2000 + (0x1000 * (~d & 1))); + return; + } + + case 0x7004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x7006: { + GalFlipScreenX = d & 1; + return; + } + + case 0x7007: { + GalFlipScreenY = d & 1; + return; + } + + case 0x7800: { + // watchdog write + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Ozon1Z80Read(UINT16 a) +{ + switch (a) { + case 0x8100: { + return 0xff - (GalInput[0] | GalDip[0]); + } + + case 0x8101: { + return 0xff - (GalInput[1] | GalDip[1]); + } + + case 0x8102: { + return 0xff - (GalInput[2] | GalDip[2]); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall Ozon1Z80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6801: { + // ??? + GalIrqFire = d & 1; + return; + } + + case 0x6802: { + // coin_counter_0_w + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall Ozon1Z80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + AY8910Write(0, 1, d); + return; + } + + case 0x01: { + AY8910Write(0, 0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +static void ZigzagInstallHandler() +{ + ZetOpen(0); + ZetSetWriteHandler(ZigzagZ80Write); + ZetClose(); +} + +static INT32 ZigzagInit() +{ + INT32 nRet; + + GalSoundType = GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910; + GalPostLoadCallbackFunction = ZigzagInstallHandler; + + nRet = GalInit(); + + GalNumChars = 0x100; + GalNumSprites = 0x40; + CharPlaneOffsets[1] = 0x4000; + SpritePlaneOffsets[1] = 0x4000; + + UINT8 *TempRom = (UINT8*)BurnMalloc(0x2000); + GalTempRom = (UINT8*)BurnMalloc(0x1000); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + nRet = BurnLoadRom(TempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x0000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x0800, TempRom + 0x1000, 0x800); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + memcpy(GalTempRom + 0x0000, TempRom + 0x0800, 0x800); + memcpy(GalTempRom + 0x0800, TempRom + 0x1800, 0x800); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + BurnFree(TempRom); + + GalDrawBulletsFunction = NULL; + + AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +static void Ozon1PostLoad() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(Ozon1Z80Read); + ZetSetWriteHandler(Ozon1Z80Write); + ZetSetOutHandler(Ozon1Z80PortWrite); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x4000, 0x43ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x43ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x43ff, 2, GalZ80Ram1); + ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 0, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 1, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 2, GalVideoRam); + ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); + ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); + ZetClose(); +} + +static INT32 Ozon1Init() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = Ozon1PostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910; + + nRet = GalInit(); + + GalDrawBulletsFunction = NULL; + GalRenderBackgroundFunction = NULL; + + return nRet; +} + +struct BurnDriver BurnDrvZigzag = { + "zigzag", NULL, NULL, NULL, "1982", + "Zig Zag (Galaxian hardware, set 1)\0", NULL, "LAX", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, ZigzagRomInfo, ZigzagRomName, NULL, NULL, ZigzagInputInfo, ZigzagDIPInfo, + ZigzagInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvZigzag2 = { + "zigzag2", "zigzag", NULL, NULL, "1982", + "Zig Zag (Galaxian hardware, set 2)\0", NULL, "LAX", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, Zigzag2RomInfo, Zigzag2RomName, NULL, NULL, ZigzagInputInfo, ZigzagDIPInfo, + ZigzagInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvOzon1 = { + "ozon1", NULL, NULL, NULL, "1983", + "Ozon I\0", NULL, "Proma", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Ozon1RomInfo, Ozon1RomName, NULL, NULL, Ozon1InputInfo, Ozon1DIPInfo, + Ozon1Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Multi-game select via external switch +static struct BurnRomInfo GmgalaxRomDesc[] = { + { "pcb1_pm1.bin", 0x01000, 0x19338c70, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "pcb1_pm2.bin", 0x01000, 0x18db074d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "pcb1_pm3.bin", 0x01000, 0xabb98b1d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "pcb1_pm4.bin", 0x01000, 0x2403c78e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "pcb1_gx1.bin", 0x01000, 0x2faa9f53, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "pcb1_gx2.bin", 0x01000, 0x121c5f16, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "pcb1_gx3.bin", 0x01000, 0x02d81a21, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "pcb2gfx1.bin", 0x01000, 0x7021bbc0, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "pcb2gfx3.bin", 0x01000, 0x089c922b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "pcb2gfx2.bin", 0x01000, 0x51bf58ee, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "pcb2gfx4.bin", 0x01000, 0x908fd0dc, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "gmgalax2.clr", 0x00020, 0x499f4440, BRF_GRA | GAL_ROM_PROM }, + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Gmgalax) +STD_ROM_FN(Gmgalax) + +UINT8 __fastcall GmgalaxZ80Read(UINT16 a) +{ + switch (a) { + case 0x6000: { + return GalInput[0] | ((GmgalaxSelectedGame) ? GalDip[3] : GalDip[0]); + } + + case 0x6800: { + return GalInput[1] | ((GmgalaxSelectedGame) ? GalDip[4] : GalDip[1]); + } + + case 0x7000: { + return GalInput[2] | ((GmgalaxSelectedGame) ? GalDip[5] : GalDip[2]); + } + + case 0x7800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0x00; +} + +static void GmgalaxPostLoad() +{ + ZetOpen(0); + ZetSetReadHandler(GmgalaxZ80Read); + ZetClose(); +} + +static INT32 GmgalaxInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = GmgalaxPostLoad; + GalZ80Rom1Size = 0x1000; + + nRet = GalInit(); + + UINT8 *TempRom = (UINT8*)BurnMalloc(0x1000); + GalTempRom = (UINT8*)BurnMalloc(0x4000); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x0000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x1000, TempRom + 0x0800, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x0800, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x1800, TempRom + 0x0800, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x2000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x3000, TempRom + 0x0800, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x2800, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x3800, TempRom + 0x0800, 0x800); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + BurnFree(TempRom); + + GalExtendTileInfoFunction = GmgalaxExtendTileInfo; + GalExtendSpriteInfoFunction = GmgalaxExtendSpriteInfo; + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + GameIsGmgalax = 1; + + return nRet; +} + +struct BurnDriver BurnDrvGmgalax = { + "gmgalax", NULL, NULL, NULL, "1981", + "Ghostmuncher Galaxian (bootleg)\0", NULL, "LAX", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, GmgalaxRomInfo, GmgalaxRomName, NULL, NULL, GmgalaxInputInfo, GmgalaxDIPInfo, + GmgalaxInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Multi-game select via menu, with different graphic and sprite roms +static struct BurnRomInfo Fourin1RomDesc[] = { + { "rom1a", 0x01000, 0xce1af4d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom1b", 0x01000, 0x18484f9b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom1c", 0x01000, 0x83248a8b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom1d", 0x01000, 0x053f6da0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom1e", 0x01000, 0x43c546f3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom1f", 0x01000, 0x3a086b46, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom1g", 0x01000, 0xac0e2050, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom1h", 0x01000, 0xdc11a513, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom1i", 0x01000, 0xa5fb6be4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom1j", 0x01000, 0x9054cfbe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom2c", 0x01000, 0x7cd98e11, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom2d", 0x01000, 0x9402f32e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom2e", 0x01000, 0x468e81df, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom2g", 0x01000, 0xb1ce3976, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom2h", 0x01000, 0x7eab5670, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom2i", 0x01000, 0x44565ac5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "rom4b", 0x01000, 0x7e6495af, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom3b", 0x01000, 0x7475f72f, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom4c", 0x00800, 0x3355d46d, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom3c", 0x00800, 0xac755a25, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom4d", 0x01000, 0xbbdddb65, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom3d", 0x01000, 0x91a00204, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom4e", 0x01000, 0x0cb9e297, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom3e", 0x01000, 0xa1fe77f9, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Fourin1) +STD_ROM_FN(Fourin1) + +UINT8 __fastcall Fourin1Z80Read(UINT16 a) +{ + switch (a) { + case 0x6000: { + return GalInput[0] | GalDip[0]; + } + + case 0x6800: { + return ((GalInput[1] | GalDip[1]) & ~0xc0) | (GalDip[3 + Fourin1Bank] & 0xc0); + } + + case 0x7000: { + return ((GalInput[2] | GalDip[2]) & 0x04) | (GalDip[3 + Fourin1Bank] & ~0xc4); + } + + case 0x7800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall Fourin1Z80Write(UINT16 a, UINT8 d) +{ + if (a < 0x4000) return; + + if (a >= 0x5800 && a <= 0x58ff) { + INT32 Offset = a - 0x5800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6000: + case 0x6001: { + // start_lamp_w + return; + } + + case 0x6002: { + // coin_lock_w + return; + } + + case 0x6003: { + // coin_count_0_w + return; + } + + case 0x6004: + case 0x6005: + case 0x6006: + case 0x6007: { + GalaxianLfoFreqWrite(a - 0x6004, d); + return; + } + + case 0x6800: + case 0x6801: + case 0x6802: + case 0x6803: + case 0x6804: + case 0x6805: + case 0x6806: + case 0x6807: { + GalaxianSoundWrite(a - 0x6800, d); + return; + } + + case 0x7001: { + GalIrqFire = d & 1; + return; + } + + case 0x7004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x7006: { + GalFlipScreenX = d & 1; + return; + } + + case 0x7007: { + GalFlipScreenY = d & 1; + return; + } + + case 0x7800: { + GalPitch = d; + return; + } + + case 0x8000: { + Fourin1Bank = d & 0x03; + ZetMapArea(0x0000, 0x3fff, 0, GalZ80Rom1 + 0x2000 + (Fourin1Bank * 0x4000)); + ZetMapArea(0x0000, 0x3fff, 2, GalZ80Rom1 + 0x2000 + (Fourin1Bank * 0x4000)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static void Fourin1PostLoad() +{ + GalTempRom = (UINT8*)BurnMalloc(0x3000); + memcpy(GalTempRom, GalZ80Rom1 + 0xd000, 0x3000); + memset(GalZ80Rom1 + 0xd000, 0x00, 0x1000); + memcpy(GalZ80Rom1 + 0xe000, GalTempRom, 0x3000); + memset(GalZ80Rom1 + 0x11000, 0x00, 0x1000); + BurnFree(GalTempRom); + + for (UINT32 i = 0; i < GalZ80Rom1Size; i++) { + GalZ80Rom1[i] = GalZ80Rom1[i] ^ (i & 0xff); + } + + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(Fourin1Z80Read); + ZetSetWriteHandler(Fourin1Z80Write); + ZetMapArea(0x0000, 0x3fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x3fff, 2, GalZ80Rom1); + ZetMapArea(0x4000, 0x43ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x43ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x43ff, 2, GalZ80Ram1); + ZetMapArea(0x5000, 0x53ff, 0, GalVideoRam); + ZetMapArea(0x5000, 0x53ff, 1, GalVideoRam); + ZetMapArea(0x5000, 0x53ff, 2, GalVideoRam); + ZetMapArea(0x5800, 0x58ff, 0, GalSpriteRam); + ZetMapArea(0x5800, 0x58ff, 2, GalSpriteRam); + ZetMapArea(0xc000, 0xdfff, 0, GalZ80Rom1); + ZetMapArea(0xc000, 0xdfff, 2, GalZ80Rom1); + ZetClose(); +} + +static INT32 Fourin1Init() +{ + INT32 nRet; + + Fourin1Bank = 0; + GalPostLoadCallbackFunction = Fourin1PostLoad; + GalZ80Rom1Size = 0x2000; + GalTilesSharedRomSize = 0x1000; + + nRet = GalInit(); + + GalNumChars = 1024; + GalNumSprites = 256; + CharPlaneOffsets[1] = GalNumChars * 8 * 8; + SpritePlaneOffsets[1] = GalNumSprites * 16 * 16; + + UINT8 *TempRom = (UINT8*)BurnMalloc(0x1000); + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x4000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x0000, TempRom + 0x0800, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x6000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x2000, TempRom + 0x0800, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x4800, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x0800, TempRom + 0x0000, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x6800, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x2800, TempRom + 0x0000, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 4, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x5000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x1000, TempRom + 0x0800, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 5, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x7000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x3000, TempRom + 0x0800, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 6, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x5800, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x1800, TempRom + 0x0800, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 7, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x7800, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x3800, TempRom + 0x0800, 0x800); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom + 0x4000, GalSprites); + BurnFree(GalTempRom); + BurnFree(TempRom); + + GalExtendTileInfoFunction = Fourin1ExtendTileInfo; + GalExtendSpriteInfoFunction = Fourin1ExtendSpriteInfo; + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + return nRet; +} + +struct BurnDriver BurnDrvFourin1 = { + "4in1", NULL, NULL, NULL, "1981", + "4 Fun in 1\0", NULL, "Armenia / Food and Fun", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, Fourin1RomInfo, Fourin1RomName, NULL, NULL, Fourin1InputInfo, Fourin1DIPInfo, + Fourin1Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Moon Cresta on Galaxian hardware with different memory map +static struct BurnRomInfo MooncrstRomDesc[] = { + { "mc1", 0x00800, 0x7d954a7a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc2", 0x00800, 0x44bb7cfa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc3", 0x00800, 0x9c412104, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc4", 0x00800, 0x7e9b1ab5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc5.7r", 0x00800, 0x16c759af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc6.8d", 0x00800, 0x69bcafdb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc7.8e", 0x00800, 0xb50dbc46, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc8", 0x00800, 0x18ca312b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mcs_b", 0x00800, 0xfb0f1f81, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_a", 0x00800, 0x631ebb5a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncrst) +STD_ROM_FN(Mooncrst) + +static struct BurnRomInfo MooncrstukRomDesc[] = { + { "mc1", 0x00800, 0x7d954a7a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc2", 0x00800, 0x44bb7cfa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc3", 0x00800, 0x9c412104, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc4", 0x00800, 0x7e9b1ab5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc5.7r", 0x00800, 0x16c759af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc6.8d", 0x00800, 0x69bcafdb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc7.8e", 0x00800, 0xb50dbc46, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8_uk.bin", 0x00800, 0xce727ad4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mcs_b", 0x00800, 0xfb0f1f81, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_a", 0x00800, 0x631ebb5a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncrstuk) +STD_ROM_FN(Mooncrstuk) + +static struct BurnRomInfo MooncrstukuRomDesc[] = { + { "smc1f", 0x00800, 0x389ca0d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc2f", 0x00800, 0x410ab430, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc3f", 0x00800, 0xa6b4144b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc4f", 0x00800, 0x4cc046fe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc5f", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc6f", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc7f", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc8f_uk", 0x00800, 0xb968b2ff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mcs_b", 0x00800, 0xfb0f1f81, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_a", 0x00800, 0x631ebb5a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncrstuku) +STD_ROM_FN(Mooncrstuku) + +static struct BurnRomInfo MooncrstuRomDesc[] = { + { "smc1f", 0x00800, 0x389ca0d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc2f", 0x00800, 0x410ab430, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc3f", 0x00800, 0xa6b4144b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc4f", 0x00800, 0x4cc046fe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bepr199", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "smc8f", 0x00800, 0xf42164c5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mcs_b", 0x00800, 0xfb0f1f81, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_a", 0x00800, 0x631ebb5a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncrstu) +STD_ROM_FN(Mooncrstu) + +static struct BurnRomInfo MooncrstoRomDesc[] = { + { "mc1.7d", 0x00800, 0x92a86aac, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc2.7e", 0x00800, 0x438c2b4b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc3.7j", 0x00800, 0x67e3d21d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc4.7p", 0x00800, 0xf4db39f6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc5.7r", 0x00800, 0x16c759af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc6.8d", 0x00800, 0x69bcafdb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc7.8e", 0x00800, 0xb50dbc46, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mc8.8h", 0x00800, 0x7e2b1928, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mcs_b", 0x00800, 0xfb0f1f81, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_a", 0x00800, 0x631ebb5a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncrsto) +STD_ROM_FN(Mooncrsto) + +static struct BurnRomInfo MooncrstgRomDesc[] = { + { "epr194", 0x00800, 0x0e5582b1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr195", 0x00800, 0x12cb201b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr196", 0x00800, 0x18255614, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr197", 0x00800, 0x05ac1466, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr198", 0x00800, 0xc28a2e8f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr199", 0x00800, 0x5a4571de, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr200", 0x00800, 0xb7c85bf1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr201", 0x00800, 0x2caba07f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "epr203", 0x00800, 0xbe26b561, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr202", 0x00800, 0x26c7e800, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncrstg) +STD_ROM_FN(Mooncrstg) + +static void MooncrstEncryptedPostLoad() +{ + for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { + UINT8 Data = GalZ80Rom1[Offset]; + UINT8 Res = Data; + if (BIT(Data, 1)) Res ^= 0x40; + if (BIT(Data, 5)) Res ^= 0x04; + if ((Offset & 1) == 0) Res = BITSWAP08(Res, 7, 2, 5, 4, 3, 6, 1, 0); + GalZ80Rom1[Offset] = Res; + } + + MapMooncrst(); +} + +static INT32 MooncrstEncryptedInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MooncrstEncryptedPostLoad; + + nRet = GalInit(); + + GalExtendTileInfoFunction = MooncrstExtendTileInfo; + GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; + + return nRet; +} + +static INT32 MooncrstInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapMooncrst; + + nRet = GalInit(); + + GalExtendTileInfoFunction = MooncrstExtendTileInfo; + GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; + + return nRet; +} + +struct BurnDriver BurnDrvMooncrst = { + "mooncrst", NULL, NULL, NULL, "1980", + "Moon Cresta (Nichibutsu)\0", NULL, "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MooncrstRomInfo, MooncrstRomName, NULL, NULL, OmegaInputInfo, MooncrstDIPInfo, + MooncrstEncryptedInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMooncrstuk = { + "mooncrstuk", "mooncrst", NULL, NULL, "1980", + "Moon Cresta (Nichibutsu UK)\0", NULL, "Nichibutsu UK", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MooncrstukRomInfo, MooncrstukRomName, NULL, NULL, OmegaInputInfo, MooncrstDIPInfo, + MooncrstEncryptedInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMooncrstuku = { + "mooncrstuku", "mooncrst", NULL, NULL, "1980", + "Moon Cresta (Nichibutsu UK, unencrypted)\0", NULL, "Nichibutsu UK", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MooncrstukuRomInfo, MooncrstukuRomName, NULL, NULL, OmegaInputInfo, MooncrstDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMooncrstu = { + "mooncrstu", "mooncrst", NULL, NULL, "1980", + "Moon Cresta (Nichibutsu USA, unencrypted)\0", NULL, "Nichibutsu USA", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MooncrstuRomInfo, MooncrstuRomName, NULL, NULL, OmegaInputInfo, MooncrstDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMooncrsto = { + "mooncrsto", "mooncrst", NULL, NULL, "1980", + "Moon Cresta (Nichibutsu, old rev)\0", NULL, "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MooncrstoRomInfo, MooncrstoRomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, + MooncrstEncryptedInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMooncrstg = { + "mooncrstg", "mooncrst", NULL, NULL, "1980", + "Moon Cresta (Gremlin)\0", NULL, "Gremlin", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MooncrstgRomInfo, MooncrstgRomName, NULL, NULL, OmegaInputInfo, MooncrsgDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Straight Moon Cresta Rip-Offs on basic Moon Cresta hardware +static struct BurnRomInfo MooncrsbRomDesc[] = { + { "bepr194", 0x00800, 0x6a23ec6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bepr195", 0x00800, 0xee262ff2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bepr199", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bepr201", 0x00800, 0x66da55d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "epr203", 0x00800, 0xbe26b561, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr202", 0x00800, 0x26c7e800, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncrsb) +STD_ROM_FN(Mooncrsb) + +static struct BurnRomInfo Mooncrs2RomDesc[] = { + { "f8.bin", 0x00800, 0xd36003e5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bepr195", 0x00800, 0xee262ff2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bepr199", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m7.bin", 0x00800, 0x957ee078, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "1h_1_10.bin", 0x00800, 0x528da705, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "12.chr", 0x00800, 0x5a4b17ea, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "1k_1_11.bin", 0x00800, 0x4e79ff6b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "11.chr", 0x00800, 0xe0edccbd, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncrs2) +STD_ROM_FN(Mooncrs2) + +static struct BurnRomInfo Mooncrs3RomDesc[] = { + { "b1.7f", 0x01000, 0x0b28cd8a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b2.7h", 0x01000, 0x74a6f0ca, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b3.7j", 0x01000, 0xeeb34cc9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b4.7k", 0x01000, 0x714330e5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "o.1h", 0x00800, 0x528da705, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "q.1h", 0x00800, 0x5a4b17ea, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "p.1k", 0x00800, 0x4e79ff6b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "r.1k", 0x00800, 0xe0edccbd, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncrs3) +STD_ROM_FN(Mooncrs3) + +static struct BurnRomInfo FantaziaRomDesc[] = { + { "f01.bin", 0x00800, 0xd3e23863, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f02.bin", 0x00800, 0x63fa4149, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f09.bin", 0x00800, 0x75fd5ca1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f10.bin", 0x00800, 0xe4da2dd4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f11.bin", 0x00800, 0x42869646, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f12.bin", 0x00800, 0xa48d7fb0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "1h_1_10.bin", 0x00800, 0x528da705, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "1k_1_11.bin", 0x00800, 0x4e79ff6b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "fantazia.clr", 0x00020, 0xa84ff0af, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Fantazia) +STD_ROM_FN(Fantazia) + +static struct BurnRomInfo EagleRomDesc[] = { + { "e1", 0x00800, 0x224c9526, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e2", 0x00800, 0xcc538ebd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e6", 0x00800, 0x0dea20d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e8", 0x00800, 0xc437a876, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "e10", 0x00800, 0x40ce58bf, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "e12", 0x00800, 0x628fdeed, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "e9", 0x00800, 0xba664099, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "e11", 0x00800, 0xee4ec5fd, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Eagle) +STD_ROM_FN(Eagle) + +static struct BurnRomInfo Eagle2RomDesc[] = { + { "e1.7f", 0x00800, 0x45aab7a3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e2", 0x00800, 0xcc538ebd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e6.6", 0x00800, 0x9f09f8c6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e8", 0x00800, 0xc437a876, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "e10.2", 0x00800, 0x25b38ebd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "e12", 0x00800, 0x628fdeed, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "e9", 0x00800, 0xba664099, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "e11", 0x00800, 0xee4ec5fd, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Eagle2) +STD_ROM_FN(Eagle2) + +static struct BurnRomInfo Eagle3RomDesc[] = { + { "e1", 0x00800, 0x224c9526, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e2", 0x00800, 0xcc538ebd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f03.bin", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f04.bin", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e6", 0x00800, 0x0dea20d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e8", 0x00800, 0xc437a876, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "e10a", 0x00800, 0xe3c63d4c, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "e12", 0x00800, 0x628fdeed, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "e9a", 0x00800, 0x59429e47, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "e11", 0x00800, 0xee4ec5fd, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Eagle3) +STD_ROM_FN(Eagle3) + +static struct BurnRomInfo SpctbirdRomDesc[] = { + { "tssa-7f", 0x00800, 0x45aab7a3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tssa-7h", 0x00800, 0x8b328f48, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tssa-7k", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tssa-7m", 0x00800, 0x99c9166d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tssa-5", 0x00800, 0x797b6261, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tssa-6", 0x00800, 0x4825692c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tssa-7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tssa-8", 0x00800, 0xc9b77b85, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "tssb-2", 0x00800, 0x7d23e1f2, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "tssb-4", 0x00800, 0xe4977833, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "tssb-1", 0x00800, 0x9b9267c3, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "tssb-3", 0x00800, 0x5ca5e233, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Spctbird) +STD_ROM_FN(Spctbird) + +static struct BurnRomInfo SmooncrsRomDesc[] = { + { "927", 0x00800, 0x55c5b994, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "928a", 0x00800, 0x77ae26d3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "929", 0x00800, 0x716eaa10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "930", 0x00800, 0xcea864f2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "931", 0x00800, 0x702c5f51, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "932a", 0x00800, 0xe6a2039f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "933", 0x00800, 0x73783cee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "934", 0x00800, 0xc1a14aa2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "epr203", 0x00800, 0xbe26b561, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_d", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr202", 0x00800, 0x26c7e800, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mcs_c", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Smooncrs) +STD_ROM_FN(Smooncrs) + +static struct BurnRomInfo SstarcrsRomDesc[] = { + { "ss1", 0x00800, 0x2ff72897, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ss2", 0x00800, 0x565e7880, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ss3", 0x00800, 0xa1939def, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ss4", 0x00800, 0xa332e012, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ss5", 0x00800, 0xb9e58453, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ss6", 0x00800, 0x7cbb5bc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ss7", 0x00800, 0x57713b91, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ss8", 0x00800, 0xc857e898, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ss10", 0x00800, 0x2a95b8ea, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ss12", 0x00800, 0xb92c4c30, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ss9", 0x00800, 0x3661e084, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ss11", 0x00800, 0x95613048, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Sstarcrs) +STD_ROM_FN(Sstarcrs) + +static struct BurnRomInfo MooncmwRomDesc[] = { + { "60.1x", 0x00800, 0x322859e6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "61.2x", 0x00800, 0xc249902d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "62.3x", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "63.4x", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "64.5x", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "65.6x", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "66.7x", 0x00800, 0xf23cd8ce, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "67.8x", 0x00800, 0x66da55d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "68.1h", 0x01000, 0x78663d86, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "69.1k", 0x01000, 0x162c50d3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom-sn74s288n-71.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncmw) +STD_ROM_FN(Mooncmw) + +static struct BurnRomInfo SpcdragRomDesc[] = { + { "a.bin", 0x00800, 0x38cc9839, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b.bin", 0x00800, 0x419fa8d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "c.bin", 0x00800, 0xa1939def, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "d.bin", 0x00800, 0xcbcf17c5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "em.bin", 0x00800, 0xeb81c19c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "fm.bin", 0x00800, 0x757b7672, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "g.bin", 0x00800, 0x57713b91, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "h.bin", 0x00800, 0x159ad847, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "203.bin", 0x00800, 0xa2e82527, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "172.bin", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "202.bin", 0x00800, 0x80c3ad74, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "171.bin", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Spcdrag) +STD_ROM_FN(Spcdrag) + +static struct BurnRomInfo SpcdragaRomDesc[] = { + { "1.7g", 0x00800, 0x38cc9839, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2.7g", 0x00800, 0x29e00ae4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3.7g", 0x00800, 0xa1939def, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4.7g", 0x00800, 0x068f8830, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5.10g", 0x00800, 0x32cd9adc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6.10g", 0x00800, 0x50db67c5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7.10g", 0x00800, 0x22415271, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8.10g", 0x00800, 0x159ad847, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "a2.7a", 0x00800, 0x38b042dd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "a4.7a", 0x00800, 0x5a4b17ea, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "a1.9a", 0x00800, 0x24441ab3, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "a3.9a", 0x00800, 0xe0edccbd, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom_6331.10f", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Spcdraga) +STD_ROM_FN(Spcdraga) + +static struct BurnRomInfo SteraRomDesc[] = { + { "stera.1", 0x00800, 0xcd04fea8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "stera.2", 0x00800, 0xccd1878e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "stera.3", 0x00800, 0x29a2b0ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "stera.4", 0x00800, 0x4c6a5a6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "stera.5", 0x00800, 0x06d378a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "stera.6", 0x00800, 0x6e84a927, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "stera.7", 0x00800, 0xb45af1e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "stera.8", 0x00800, 0x37f19956, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "stera.10", 0x00800, 0x528da705, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "stera.12", 0x00800, 0x13932a15, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "stera.11", 0x00800, 0x4e79ff6b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "stera.9", 0x00800, 0x24cfd145, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "stera.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Stera) +STD_ROM_FN(Stera) + +static struct BurnRomInfo MooncrgxRomDesc[] = { + { "1", 0x00800, 0x84cf420b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2", 0x00800, 0x4c2a61a1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3", 0x00800, 0x1962523a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4", 0x00800, 0x75dca896, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5", 0x00800, 0x32483039, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6", 0x00800, 0x43f2ab89, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7", 0x00800, 0x1e9c168c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8", 0x00800, 0x5e09da94, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "1h_1_10.bin", 0x00800, 0x528da705, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "12.chr", 0x00800, 0x5a4b17ea, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "9.chr", 0x00800, 0x70df525c, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "11.chr", 0x00800, 0xe0edccbd, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mooncrgx) +STD_ROM_FN(Mooncrgx) + +static struct BurnRomInfo MoonqsrRomDesc[] = { + { "mq1", 0x00800, 0x132c13ec, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mq2", 0x00800, 0xc8eb74f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mq3", 0x00800, 0x33965a89, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mq4", 0x00800, 0xa3861d17, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mq5", 0x00800, 0x8bcf9c67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mq6", 0x00800, 0x5750cda9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mq7", 0x00800, 0x78d7fe5b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mq8", 0x00800, 0x4919eed5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mqb", 0x00800, 0xb55ec806, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mqd", 0x00800, 0x9e7d0e13, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mqa", 0x00800, 0x66eee0db, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mqc", 0x00800, 0xa6db5b0d, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "vid_e6.bin", 0x00020, 0x0b878b54, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Moonqsr) +STD_ROM_FN(Moonqsr) + +static struct BurnRomInfo Moonal2RomDesc[] = { + { "ali1", 0x00400, 0x0dcecab4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali2", 0x00400, 0xc6ee75a7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali3", 0x00400, 0xcd1be7e9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali4", 0x00400, 0x83b03f08, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali5", 0x00400, 0x6f3cf61d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali6", 0x00400, 0xe169d432, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali7", 0x00400, 0x41f64b73, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali8", 0x00400, 0xf72ee876, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali9", 0x00400, 0xb7fb763c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali10", 0x00400, 0xb1059179, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali11", 0x00400, 0x9e79a1c6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ali13.1h", 0x00800, 0xa1287bf6, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ali12.1k", 0x00800, 0x528f1481, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Moonal2) +STD_ROM_FN(Moonal2) + +static struct BurnRomInfo Moonal2bRomDesc[] = { + { "ali1", 0x00400, 0x0dcecab4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali2", 0x00400, 0xc6ee75a7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "md-2", 0x00800, 0x8318b187, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali5", 0x00400, 0x6f3cf61d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali6", 0x00400, 0xe169d432, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali7", 0x00400, 0x41f64b73, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali8", 0x00400, 0xf72ee876, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali9", 0x00400, 0xb7fb763c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali10", 0x00400, 0xb1059179, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "md-6", 0x00800, 0x9cc973e0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ali13.1h", 0x00800, 0xa1287bf6, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ali12.1k", 0x00800, 0x528f1481, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bpr", 0x00020, 0xc3ac9467, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Moonal2b) +STD_ROM_FN(Moonal2b) + +static struct BurnRomInfo ThepitmRomDesc[] = { + { "1.bin", 0x00800, 0x0f78d6ea, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2.bin", 0x00800, 0xebacc6eb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3.bin", 0x00800, 0x14fd0706, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4.bin", 0x00800, 0x613e920f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5.bin", 0x00800, 0x5a791f3f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6.bin", 0x00800, 0x0bb37f51, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7.bin", 0x00800, 0x4dfdec6f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8.bin", 0x00800, 0xa39a9189, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "9.bin", 0x00800, 0x2eb90e07, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "1h.bin", 0x00800, 0x00dce65f, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "1k.bin", 0x00800, 0x3ec0056e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6l.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Thepitm) +STD_ROM_FN(Thepitm) + +void __fastcall MooncrgxZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5800 && a <= 0x58ff) { + INT32 Offset = a - 0x5800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6000: + case 0x6001: + case 0x6002: { + GalGfxBank[a - 0x6000] = d; + return; + } + + case 0x6003: { + // coin_count_0_w + return; + } + + case 0x6004: + case 0x6005: + case 0x6006: + case 0x6007: { + GalaxianLfoFreqWrite(a - 0x6004, d); + return; + } + + case 0x6800: + case 0x6801: + case 0x6802: + case 0x6803: + case 0x6804: + case 0x6805: + case 0x6806: + case 0x6807: { + GalaxianSoundWrite(a - 0x6800, d); + return; + } + + case 0x7001: { + GalIrqFire = d & 1; + return; + } + + case 0x7004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x7006: { + GalFlipScreenX = d & 1; + return; + } + + case 0x7007: { + GalFlipScreenY = d & 1; + return; + } + + case 0x7800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall MoonqsrZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa000: + case 0xa001: + case 0xa002: { + GalGfxBank[a - 0xa000] = d; + return; + } + + case 0xa003: { + // coin_count_0_w + return; + } + + case 0xa004: + case 0xa005: + case 0xa006: + case 0xa007: { + GalaxianLfoFreqWrite(a - 0xa004, d); + return; + } + + case 0xa800: + case 0xa801: + case 0xa802: + case 0xa803: + case 0xa804: + case 0xa805: + case 0xa806: + case 0xa807: { + GalaxianSoundWrite(a - 0xa800, d); + return; + } + + case 0xb000: { + GalIrqFire = d & 1; + return; + } + + case 0xb004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + GalPitch = d; + return; + } + } + + bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); +} + +void __fastcall ThepitmZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa000: + case 0xa001: + case 0xa002: { + GalGfxBank[a - 0xa000] = d; + return; + } + + case 0xa003: { + // coin_count_0_w + return; + } + + case 0xa004: + case 0xa005: + case 0xa006: + case 0xa007: { + GalaxianLfoFreqWrite(a - 0xa004, d); + return; + } + + case 0xa800: + case 0xa801: + case 0xa802: + case 0xa803: + case 0xa804: + case 0xa805: + case 0xa806: + case 0xa807: { + GalaxianSoundWrite(a - 0xa800, d); + return; + } + + case 0xb001: { + GalIrqFire = d & 1; + return; + } + + case 0xb004: { + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static void Mooncrs2RearrangeGfx() +{ + UINT8* TempRom = (UINT8*)BurnMalloc(0x800); + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); + BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); + BurnLoadRom(TempRom, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); + memcpy(GalTempRom + 0x0800, TempRom + 0x0000, 0x200); + memcpy(GalTempRom + 0x0c00, TempRom + 0x0200, 0x200); + memcpy(GalTempRom + 0x0a00, TempRom + 0x0400, 0x200); + memcpy(GalTempRom + 0x0e00, TempRom + 0x0600, 0x200); + BurnLoadRom(TempRom, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); + memcpy(GalTempRom + 0x1800, TempRom + 0x0000, 0x200); + memcpy(GalTempRom + 0x1c00, TempRom + 0x0200, 0x200); + memcpy(GalTempRom + 0x1a00, TempRom + 0x0400, 0x200); + memcpy(GalTempRom + 0x1e00, TempRom + 0x0600, 0x200); + BurnFree(TempRom); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); +} + +static INT32 Mooncrs2Init() +{ + GalPostLoadCallbackFunction = MapMooncrst; + + INT32 nRet = GalInit(); + + Mooncrs2RearrangeGfx(); + + GalExtendTileInfoFunction = MooncrstExtendTileInfo; + GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; + + return nRet; +} + +static void Mooncrs3PostLoad() +{ + GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); + memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x800); + memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0800, 0x800); + memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1000, 0x800); + memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1800, 0x800); + memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x800); + memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2800, 0x800); + memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3000, 0x800); + memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3800, 0x800); + BurnFree(GalTempRom); + + MapMooncrst(); +} + +static INT32 Mooncrs3Init() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = Mooncrs3PostLoad; + + nRet = GalInit(); + + Mooncrs2RearrangeGfx(); + + GalExtendTileInfoFunction = MooncrstExtendTileInfo; + GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; + + return nRet; +} + +static void MooncrgxInstallHandler() +{ + ZetOpen(0); + ZetSetWriteHandler(MooncrgxZ80Write); + ZetClose(); +} + +static INT32 MooncrgxInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MooncrgxInstallHandler; + + nRet = GalInit(); + + GalExtendTileInfoFunction = MooncrstExtendTileInfo; + GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; + + return nRet; +} + +static void MoonqsrDecrypt() +{ + for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { + UINT8 Data = GalZ80Rom1[Offset]; + UINT8 Res = Data; + if (BIT(Data, 1)) Res ^= 0x40; + if (BIT(Data, 5)) Res ^= 0x04; + if ((Offset & 1) == 0) Res = BITSWAP08(Res, 7, 2, 5, 4, 3, 6, 1, 0); + GalZ80Rom1Op[Offset] = Res; + } + + MapMooncrst(); + + ZetOpen(0); + ZetSetWriteHandler(MoonqsrZ80Write); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1Op, GalZ80Rom1); + ZetClose(); +} + +static INT32 MoonqsrInit() +{ + INT32 nRet; + + GalZ80Rom1Op = (UINT8*)BurnMalloc(0x4000); + + GalPostLoadCallbackFunction = MoonqsrDecrypt; + + nRet = GalInit(); + + GalExtendTileInfoFunction = MoonqsrExtendTileInfo; + GalExtendSpriteInfoFunction = MoonqsrExtendSpriteInfo; + + return nRet; +} + +static INT32 Moonal2Init() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapMooncrst; + + nRet = GalInit(); + + return nRet; +} + +static void ThepitmPostLoad() +{ + MapMooncrst(); + + ZetOpen(0); + ZetMapArea(0x0000, 0x47ff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x47ff, 2, GalZ80Rom1); + ZetSetWriteHandler(ThepitmZ80Write); + ZetClose(); +} + +static INT32 ThepitmInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = ThepitmPostLoad; + + nRet = GalInit(); + + GalExtendTileInfoFunction = MooncrstExtendTileInfo; + GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; + + return nRet; +} + +struct BurnDriver BurnDrvMooncrsb = { + "mooncrsb", "mooncrst", NULL, NULL, "1980", + "Moon Cresta (bootleg set 1)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MooncrsbRomInfo, MooncrsbRomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMooncrs2 = { + "mooncrs2", "mooncrst", NULL, NULL, "1980", + "Moon Cresta (bootleg set 2)\0", NULL, "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Mooncrs2RomInfo, Mooncrs2RomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, + Mooncrs2Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMooncrs3 = { + "mooncrs3", "mooncrst", NULL, NULL, "1980", + "Moon Cresta (bootleg set 3)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Mooncrs3RomInfo, Mooncrs3RomName, NULL, NULL, OmegaInputInfo, MooncrstDIPInfo, + Mooncrs3Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvFantazia = { + "fantazia", "mooncrst", NULL, NULL, "1980", + "Fantazia (bootleg?)\0", NULL, "SubElectro", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, FantaziaRomInfo, FantaziaRomName, NULL, NULL, OmegaInputInfo, FantaziaDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvEagle = { + "eagle", "mooncrst", NULL, NULL, "1980", + "Eagle (set 1)\0", NULL, "Centuri", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, EagleRomInfo, EagleRomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, + Mooncrs2Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvEagle2 = { + "eagle2", "mooncrst", NULL, NULL, "1980", + "Eagle (set 2)\0", NULL, "Centuri", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Eagle2RomInfo, Eagle2RomName, NULL, NULL, OmegaInputInfo, Eagle2DIPInfo, + Mooncrs2Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvEagle3 = { + "eagle3", "mooncrst", NULL, NULL, "1980", + "Eagle (set 3)\0", NULL, "Centuri", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Eagle3RomInfo, Eagle3RomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, + Mooncrs2Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSpctbird = { + "spctbird", "mooncrst", NULL, NULL, "1981?", + "Space Thunderbird\0", NULL, "Fortrek", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SpctbirdRomInfo, SpctbirdRomName, NULL, NULL, OmegaInputInfo, Eagle2DIPInfo, + Mooncrs2Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSmooncrs = { + "smooncrs", "mooncrst", NULL, NULL, "1981?", + "Super Moon Cresta\0", NULL, "Gremlin", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SmooncrsRomInfo, SmooncrsRomName, NULL, NULL, SmooncrsInputInfo, SmooncrsDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSstarcrs = { + "sstarcrs", "mooncrst", NULL, NULL, "1980?", + "Super Star Crest\0", NULL, "Nichibutsu (Taito do Brasil license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SstarcrsRomInfo, SstarcrsRomName, NULL, NULL, OmegaInputInfo, MooncrsgDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMooncmw = { + "mooncmw", "mooncrst", NULL, NULL, "198?", + "Moon War (Moon Cresta bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MooncmwRomInfo, MooncmwRomName, NULL, NULL, OmegaInputInfo, MooncrsaDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSpcdrag = { + "spcdrag", "mooncrst", NULL, NULL, "1980", + "Space Dragon (Moon Cresta bootleg, set 1)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SpcdragRomInfo, SpcdragRomName, NULL, NULL, SmooncrsInputInfo, SmooncrsDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSpcdraga = { + "spcdraga", "mooncrst", NULL, NULL, "1980", + "Space Dragon (Moon Cresta bootleg, set 2)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SpcdragaRomInfo, SpcdragaRomName, NULL, NULL, SmooncrsInputInfo, SmooncrsDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvStera = { + "stera", "mooncrst", NULL, NULL, "1980", + "Steraranger (Moon Cresta bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SteraRomInfo, SteraRomName, NULL, NULL, SmooncrsInputInfo, SmooncrsDIPInfo, + MooncrstInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMooncrgx = { + "mooncrgx", "mooncrst", NULL, NULL, "1980", + "Moon Cresta (Galaxian hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MooncrgxRomInfo, MooncrgxRomName, NULL, NULL, OmegaInputInfo, MooncrgxDIPInfo, + MooncrgxInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMoonqsr = { + "moonqsr", NULL, NULL, NULL, "1980", + "Moon Quasar\0", NULL, "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MoonqsrRomInfo, MoonqsrRomName, NULL, NULL, OmegaInputInfo, MoonqsrDIPInfo, + MoonqsrInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMoonal2 = { + "moonal2", "galaxian", NULL, NULL, "1980", + "Moon Alien Part 2\0", NULL, "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Moonal2RomInfo, Moonal2RomName, NULL, NULL, GalaxianInputInfo, Moonal2DIPInfo, + Moonal2Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMoonal2b = { + "moonal2b", "galaxian", NULL, NULL, "1980", + "Moon Alien Part 2 (older version)\0", NULL, "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Moonal2bRomInfo, Moonal2bRomName, NULL, NULL, GalaxianInputInfo, Moonal2DIPInfo, + Moonal2Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvThepitm = { + "thepitm", "thepit", NULL, NULL, "198?", + "The Pit (bootleg on Moon Quasar hardware)\0", NULL, "bootleg (KZH)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, ThepitmRomInfo, ThepitmRomName, NULL, NULL, ThepitmInputInfo, ThepitmDIPInfo, + ThepitmInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Other games on basic Moon Cresta hardware +static struct BurnRomInfo SkybaseRomDesc[] = { + { "skybase.9a", 0x01000, 0x845b87a5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "skybase.8a", 0x01000, 0x096785c2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "skybase.7a", 0x01000, 0xd50c715b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "skybase.6a", 0x01000, 0xf57edb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "skybase.5a", 0x01000, 0x50365d95, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "skybase.4a", 0x01000, 0xcbd6647f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "skybase.7t", 0x01000, 0x9b471686, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "skybase.8t", 0x01000, 0x1cf723da, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "skybase.10t", 0x01000, 0xfe02e72c, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "skybase.9t", 0x01000, 0x0871291f, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.bpr", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Skybase) +STD_ROM_FN(Skybase) + +static struct BurnRomInfo BagmanmcRomDesc[] = { + { "b1.bin", 0x01000, 0xb74c75ee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b2.bin", 0x01000, 0xa7d99916, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b3.bin", 0x01000, 0xc78f5360, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b4.bin", 0x01000, 0xeebd3bd1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b5.bin", 0x01000, 0x0fe24b8c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b6.bin", 0x01000, 0xf50390e7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "g1-u.bin", 0x01000, 0xb63cfae4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g2-u.bin", 0x01000, 0xa2790089, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g1-l.bin", 0x00800, 0x2ae6b5ab, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g2-l.bin", 0x00800, 0x98b37397, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "bagmanmc.clr", 0x00020, 0x00000000, BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(Bagmanmc) +STD_ROM_FN(Bagmanmc) + +static struct BurnRomInfo DkongjrmRomDesc[] = { + { "a1", 0x01000, 0x299486e9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "a2", 0x01000, 0xa74a193b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b2", 0x01000, 0x7bc4f236, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "c1", 0x01000, 0x0f594c21, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "d1", 0x01000, 0xcf7d7296, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "e2", 0x01000, 0xf7528a52, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f1", 0x01000, 0x9b1d4cc5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "v_3pa.bin", 0x01000, 0x4974ffef, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "a2.gfx", 0x01000, 0x51845eaf, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "v_3na.bin", 0x01000, 0xa95c4c63, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "b2.gfx", 0x01000, 0x7b39c3d0, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "hustler.clr", 0x00020, 0xaa1f7f5e, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Dkongjrm) +STD_ROM_FN(Dkongjrm) + +static struct BurnRomInfo VpoolRomDesc[] = { + { "vidpool1.bin", 0x01000, 0x333f4732, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vidpool2.bin", 0x01000, 0xeea6c0f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vidpool3.bin", 0x01000, 0x309972a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vidpool4.bin", 0x01000, 0xc4f71c1d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "hustler.5f", 0x00800, 0x0bdfad0e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "hustler.5h", 0x00800, 0x8e062177, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "hustler.clr", 0x00020, 0xaa1f7f5e, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Vpool) +STD_ROM_FN(Vpool) + +static struct BurnRomInfo CkonggRomDesc[] = { + { "g_ck1.bin", 0x01000, 0xa4323b94, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ck2.bin", 0x01000, 0x1e532996, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "g_ck3.bin", 0x01000, 0x65157cde, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "g_ck4.bin", 0x01000, 0x43827bc6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "g_ck5.bin", 0x01000, 0xa74ed96e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "g_ck7.bin", 0x00800, 0x2c4d8129, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ckvid10.bin", 0x01000, 0x7866d2cb, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ckvid7.bin", 0x01000, 0x7311a101, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "ck_cp.bin", 0x00020, 0x7e0b79cb, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Ckongg) +STD_ROM_FN(Ckongg) + +static struct BurnRomInfo CkongmcRomDesc[] = { + { "kc1.bin", 0x01000, 0xa87fc828, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "kc2.bin", 0x01000, 0x94a13dec, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "kc3.bin", 0x01000, 0x5efc6705, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "kc4.bin", 0x01000, 0xac917d66, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "kc5.bin", 0x00800, 0x5a9ee1ed, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "kc6.bin", 0x00800, 0xf787431e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "kc7.bin", 0x00800, 0x7a185e31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "kc8carat.bin", 0x01000, 0x7866d2cb, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "kc9carat.bin", 0x01000, 0x7311a101, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "ck_cp.bin", 0x00020, 0x7e0b79cb, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Ckongmc) +STD_ROM_FN(Ckongmc) + +static struct BurnRomInfo PorterRomDesc[] = { + { "port1.bin", 0x01000, 0xbabaf7fe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "port2.bin", 0x01000, 0x8f7eb0e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "port3.bin", 0x01000, 0x683939b5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "port4.bin", 0x01000, 0x6a65d58d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "port5.bin", 0x00800, 0x2978a9aa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "port6.bin", 0x00800, 0x7ecdffb5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "port7.bin", 0x01000, 0x603294f9, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "port8.bin", 0x01000, 0xb66a763d, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.6l", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Porter) +STD_ROM_FN(Porter) + +static struct BurnRomInfo KongRomDesc[] = { + { "1", 0x01000, 0xa206beb5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2", 0x01000, 0xd75597b6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3", 0x01000, 0x54e0b87b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4", 0x01000, 0x356c4ca2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5", 0x01000, 0x2d295976, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6", 0x01000, 0x77131cca, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7", 0x01000, 0x3d5ec3f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8", 0x01000, 0x015fe5e5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "9", 0x00800, 0xfe42a052, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "11", 0x00800, 0xad2b2cdd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "10", 0x00800, 0x91fa187e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "12", 0x00800, 0xb74724df, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom", 0x00020, 0x00000000, BRF_OPT | BRF_NODUMP }, + + { "13", 0x01000, 0x7d33ca0a, BRF_OPT }, // unknown +}; + +STD_ROM_PICK(Kong) +STD_ROM_FN(Kong) + +static struct BurnRomInfo FantastcRomDesc[] = { + { "f1", 0x01000, 0x8019f0b7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f2", 0x01000, 0x988a9bc6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f3", 0x01000, 0xa3c0cc0b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f4", 0x01000, 0xc1361be8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f5", 0x01000, 0x6787e93f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f6", 0x01000, 0x597029ae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f7", 0x01000, 0x8de08d9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "f8", 0x01000, 0x489e2fb7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "37", 0x01000, 0x3a54f749, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "38", 0x01000, 0x88b71264, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom-74g138", 0x00020, 0x800f5718, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Fantastc) +STD_ROM_FN(Fantastc) + +UINT8 __fastcall BagmanmcZ80Read(UINT16 a) +{ + switch (a) { + case 0xa000: { + return GalInput[0] | GalDip[0]; + } + + case 0xa800: { + return GalInput[1] | GalDip[1]; + } + + case 0xb000: { + return GalInput[2] | GalDip[2]; + } + + case 0xb800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall BagmanmcZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa000: + case 0xa001: + case 0xa002: { + GalGfxBank[a - 0xa000] = d; + return; + } + + case 0xa003: { + // coin_count_0_w + return; + } + + case 0xa004: + case 0xa005: + case 0xa006: + case 0xa007: { + GalaxianLfoFreqWrite(a - 0xa004, d); + return; + } + + case 0xa800: + case 0xa801: + case 0xa802: + case 0xa803: + case 0xa804: + case 0xa805: + case 0xa806: + case 0xa807: { + GalaxianSoundWrite(a - 0xa800, d); + return; + } + + case 0xb001: { + GalIrqFire = d & 1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall DkongjrmZ80Read(UINT16 a) +{ + if (a >= 0xa000 && a <= 0xa0ff) { + return GalInput[0] | GalDip[0]; + } + + if (a >= 0xa800 && a <= 0xa8ff) { + return GalInput[1] | GalDip[1]; + } + + if (a >= 0xb000 && a <= 0xb0ff) { + return GalInput[2] | GalDip[2]; + } + + switch (a) { + case 0xb800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall DkongjrmZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa003: { + // coin_count_0_w + return; + } + + case 0xa004: + case 0xa005: + case 0xa006: + case 0xa007: { + GalaxianLfoFreqWrite(a - 0xa004, d); + return; + } + + case 0xa800: + case 0xa801: + case 0xa802: + case 0xa803: + case 0xa804: +// case 0xa805: + case 0xa806: + case 0xa807: { + GalaxianSoundWrite(a - 0xa800, d); + return; + } + + case 0xb000: { + GalGfxBank[0] = d; + return; + } + + case 0xb001: { + GalIrqFire = d & 1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall CkonggZ80Read(UINT16 a) +{ + switch (a) { + case 0xc000: { + return GalInput[0] | GalDip[0]; + } + + case 0xc400: { + return GalInput[1] | GalDip[1]; + } + + case 0xc800: { + return GalInput[2] | GalDip[2]; + } + + case 0xcc00: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall CkonggZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xc400: + case 0xc401: + case 0xc402: + case 0xc403: + case 0xc404: + case 0xc405: + case 0xc406: + case 0xc407: { + GalaxianSoundWrite(a - 0xc400, d); + return; + } + + case 0xc801: { + GalIrqFire = d & 1; + return; + } + + case 0xc804: { + // link apparently cut + return; + } + + case 0xc806: { + GalFlipScreenX = d & 1; + return; + } + + case 0xc807: { + GalFlipScreenY = d & 1; + return; + } + + case 0xcc00: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall CkongmcZ80Read(UINT16 a) +{ + switch (a) { + case 0xa000: { + return GalInput[0] | GalDip[0]; + } + + case 0xa800: { + return GalInput[1] | GalDip[1]; + } + + case 0xb000: { + return GalInput[2] | GalDip[2]; + } + + case 0xb800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall CkongmcZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa800: + case 0xa801: + case 0xa802: + case 0xa803: + case 0xa804: + case 0xa805: + case 0xa806: + case 0xa807: { + GalaxianSoundWrite(a - 0xa800, d); + return; + } + + case 0xb001: { + GalIrqFire = d & 1; + return; + } + + case 0xc806: { + GalFlipScreenX = d & 1; + return; + } + + case 0xc807: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall FantastcZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0x9900 && a <= 0xafff) { + // ??? + return; + } + + if (a >= 0xb001 && a <= 0xd7ff) { + // ??? + return; + } + + switch (a) { + case 0x8803: { + AY8910Write(0, 0, d); + return; + } + + case 0x880b: { + AY8910Write(0, 1, d); + return; + } + + case 0x880c: { + AY8910Write(1, 0, d); + return; + } + + case 0x880e: { + AY8910Write(1, 1, d); + return; + } + + case 0xb000: { + GalIrqFire = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static void SkybaseAlterZ80() +{ + MapMooncrst(); + + ZetOpen(0); + ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetClose(); +} + +static INT32 SkybaseInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = SkybaseAlterZ80; + + nRet = GalInit(); + + GalExtendTileInfoFunction = SkybaseExtendTileInfo; + GalExtendSpriteInfoFunction = SkybaseExtendSpriteInfo; + + return nRet; +} + +static void BagmanmcPostLoad() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(BagmanmcZ80Read); + ZetSetWriteHandler(BagmanmcZ80Write); + ZetMapArea(0x0000, GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x6000, 0x67ff, 0, GalZ80Ram1); + ZetMapArea(0x6000, 0x67ff, 1, GalZ80Ram1); + ZetMapArea(0x6000, 0x67ff, 2, GalZ80Ram1); + ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); + ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); + ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); + ZetClose(); +} + +static INT32 BagmanmcInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = BagmanmcPostLoad; + GalPromRomSize = 0x20; + + nRet = GalInit(); + + GalNumChars = 512; + GalNumSprites = 64; + CharPlaneOffsets[1] = GalNumChars * 8 * 8; + SpritePlaneOffsets[1] = GalNumSprites * 16 * 16; + + UINT8 *TempRom = (UINT8*)BurnMalloc(0x1000); + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x0000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x2000, TempRom + 0x0800, 0x800); + nRet = BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x1000, TempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x2800, TempRom + 0x0800, 0x800); + nRet = BurnLoadRom(GalTempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x1800, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); if (nRet) return 1; + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom + 0x2000, GalSprites); + BurnFree(GalTempRom); + BurnFree(TempRom); + + HardCodeMooncrstPROM(); + + GalIrqType = GAL_IRQ_TYPE_IRQ0; + GalExtendTileInfoFunction = PiscesExtendTileInfo; + + return nRet; +} + +static void DkongjrmPostLoad() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(DkongjrmZ80Read); + ZetSetWriteHandler(DkongjrmZ80Write); + ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); + ZetMapArea(0x6000, 0x6fff, 0, GalZ80Ram1); + ZetMapArea(0x6000, 0x6fff, 1, GalZ80Ram1); + ZetMapArea(0x6000, 0x6fff, 2, GalZ80Ram1); + ZetMapArea(0x7000, 0x7fff, 0, GalZ80Rom1 + 0x6000); + ZetMapArea(0x7000, 0x7fff, 2, GalZ80Rom1 + 0x6000); + ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); + ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); + ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); + ZetClose(); +} + +static INT32 DkongjrmInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = DkongjrmPostLoad; + + nRet = GalInit(); + + GalRenderBackgroundFunction = NULL; + GalDrawBulletsFunction = NULL; + GalExtendTileInfoFunction = PiscesExtendTileInfo; + GalExtendSpriteInfoFunction = DkongjrmExtendSpriteInfo; + + GalRenderFrameFunction = DkongjrmRenderFrame; + + return nRet; +} + +static void VpoolPostLoad() +{ + MapMooncrst(); + + GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); + memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x800); + memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0800, 0x800); + memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1000, 0x800); + memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1800, 0x800); + memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x800); + memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2800, 0x800); + memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3000, 0x800); + memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3800, 0x800); + BurnFree(GalTempRom); + + ZetOpen(0); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetClose(); +} + +static INT32 VpoolInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = VpoolPostLoad; + + nRet = GalInit(); + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + return nRet; +} + +static void CkonggMapZ80() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(CkonggZ80Read); + ZetSetWriteHandler(CkonggZ80Write); + ZetMapArea(0x0000, 0x57ff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x57ff, 2, GalZ80Rom1); + ZetMapArea(0x6000, 0x6fff, 0, GalZ80Ram1); + ZetMapArea(0x6000, 0x6fff, 1, GalZ80Ram1); + ZetMapArea(0x6000, 0x6fff, 2, GalZ80Ram1); + ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); + ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); + ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); + ZetClose(); +} + +static void CkonggPostLoad() +{ + GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); + memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); + memcpy(GalZ80Rom1 + 0x2400, GalTempRom + 0x0000, 0x400); + memcpy(GalZ80Rom1 + 0x1c00, GalTempRom + 0x0400, 0x400); + memcpy(GalZ80Rom1 + 0x4800, GalTempRom + 0x0800, 0x400); + memcpy(GalZ80Rom1 + 0x0c00, GalTempRom + 0x0c00, 0x400); + memcpy(GalZ80Rom1 + 0x4400, GalTempRom + 0x1000, 0x400); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x1400, 0x400); + memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x1800, 0x400); + memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1c00, 0x400); + memcpy(GalZ80Rom1 + 0x3400, GalTempRom + 0x2000, 0x400); + memcpy(GalZ80Rom1 + 0x4c00, GalTempRom + 0x2400, 0x400); + memcpy(GalZ80Rom1 + 0x5000, GalTempRom + 0x2800, 0x400); + memcpy(GalZ80Rom1 + 0x0400, GalTempRom + 0x2c00, 0x400); + memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x3000, 0x400); + memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3400, 0x400); + memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x3800, 0x400); + memcpy(GalZ80Rom1 + 0x4000, GalTempRom + 0x3c00, 0x400); + memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x4000, 0x400); + memcpy(GalZ80Rom1 + 0x5400, GalTempRom + 0x4400, 0x400); + memcpy(GalZ80Rom1 + 0x2c00, GalTempRom + 0x4800, 0x400); + memcpy(GalZ80Rom1 + 0x1400, GalTempRom + 0x4c00, 0x400); + memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x5000, 0x400); + memcpy(GalZ80Rom1 + 0x3c00, GalTempRom + 0x5400, 0x400); + BurnFree(GalTempRom); + + CkonggMapZ80(); +} + +static INT32 CkonggInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = CkonggPostLoad; + + nRet = GalInit(); + + GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + return nRet; +} + +static void CkongmcPostLoad() +{ + GalTempRom = (UINT8*)BurnMalloc(0x4000); + memcpy(GalTempRom, GalZ80Rom1, 0x4000); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x800); + memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0800, 0x800); + memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1000, 0x800); + memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1800, 0x800); + memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x800); + memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2800, 0x800); + memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3000, 0x800); + memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3800, 0x800); + BurnFree(GalTempRom); + + CkonggMapZ80(); + + ZetOpen(0); + ZetSetReadHandler(CkongmcZ80Read); + ZetSetWriteHandler(CkongmcZ80Write); + ZetClose(); +} + +static INT32 CkongmcInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = CkongmcPostLoad; + + nRet = GalInit(); + + GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + return nRet; +} + +static void PorterPostLoad() +{ + GalTempRom = (UINT8*)BurnMalloc(0x4000); + memcpy(GalTempRom, GalZ80Rom1, 0x4000); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x800); + memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x0800, 0x800); + memcpy(GalZ80Rom1 + 0x0800, GalTempRom + 0x1000, 0x800); + memcpy(GalZ80Rom1 + 0x2800, GalTempRom + 0x1800, 0x800); + memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x800); + memcpy(GalZ80Rom1 + 0x3000, GalTempRom + 0x2800, 0x800); + memcpy(GalZ80Rom1 + 0x1800, GalTempRom + 0x3000, 0x800); + memcpy(GalZ80Rom1 + 0x3800, GalTempRom + 0x3800, 0x800); + BurnFree(GalTempRom); + + MapMooncrst(); + + ZetOpen(0); + ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetClose(); +} + +static INT32 PorterInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = PorterPostLoad; + + nRet = GalInit(); + + GalExtendTileInfoFunction = MooncrstExtendTileInfo; + GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; + + return nRet; +} + +static void KongAlterZ80() +{ + MapMooncrst(); + + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x7fff, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetClose(); +} + +static INT32 KongInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = KongAlterZ80; + + GalPromRomSize = 0x20; + + nRet = GalInit(); + + GalRenderBackgroundFunction = NULL; + GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; + + HardCodeMooncrstPROM(); + + return nRet; +} + +static void FantastcPostLoad() +{ + MapMooncrst(); + + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x7fff, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetSetWriteHandler(FantastcZ80Write); + ZetClose(); + + static const UINT16 lut_am_unscramble[32] = { + 0, 2, 4, 6, // ok! + 7, 3, 5, 1, // ok! + 6, 0, 2, 4, // ok! + 1, 5, 3, 0, // ok! + 2, 4, 6, 3, // good, good?, guess, guess + 5, 6, 0, 2, // good, good?, good?, guess + 4, 1, 1, 5, // good, good, guess, good + 3, 7, 7, 7 // ok! + }; + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x8000); + memcpy(pTemp, GalZ80Rom1, 0x8000); + + for (INT32 i = 0; i < 32; i++) { + memcpy(GalZ80Rom1 + i * 0x400, pTemp + lut_am_unscramble[i] * 0x1000 + (i & 3) * 0x400, 0x400); + } + + BurnFree(pTemp); +} + +static INT32 FantastcInit() +{ + INT32 nRet; + + GalSoundType = GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910; + + GalPostLoadCallbackFunction = FantastcPostLoad; + GalNumSprites = 0x40; + + nRet = GalInit(); + + GalRenderFrameFunction = FantastcRenderFrame; + GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; + + return nRet; +} + +struct BurnDriver BurnDrvSkybase = { + "skybase", NULL, NULL, NULL, "1982", + "Sky Base\0", NULL, "Omori Electric Co. Ltd", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, SkybaseRomInfo, SkybaseRomName, NULL, NULL, SkybaseInputInfo, SkybaseDIPInfo, + SkybaseInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriverD BurnDrvBagmanmc = { + "bagmanmc", "bagman", NULL, NULL, "1982", + "Bagman (Moon Cresta hardware)\0", "Bad Colours", "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, BagmanmcRomInfo, BagmanmcRomName, NULL, NULL, BagmanmcInputInfo, BagmanmcDIPInfo, + BagmanmcInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvDkongjrm = { + "dkongjrm", "dkongjr", NULL, NULL, "1982", + "Donkey Kong Jr. (Moon Cresta hardware)\0", "Bad Colours", "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, DkongjrmRomInfo, DkongjrmRomName, NULL, NULL, DkongjrmInputInfo, DkongjrmDIPInfo, + DkongjrmInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvVpool = { + "vpool", "hustler", NULL, NULL, "1980", + "Video Pool (bootleg on Moon Cresta hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, + NULL, VpoolRomInfo, VpoolRomName, NULL, NULL, GalaxianInputInfo, VpoolDIPInfo, + VpoolInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvCkongg = { + "ckongg", "ckong", NULL, NULL, "1981", + "Crazy Kong (bootleg on Galaxian hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, CkonggRomInfo, CkonggRomName, NULL, NULL, CkonggInputInfo, CkonggDIPInfo, + CkonggInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvCkongmc = { + "ckongmc", "ckong", NULL, NULL, "1981", + "Crazy Kong (bootleg on Moon Cresta hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, CkongmcRomInfo, CkongmcRomName, NULL, NULL, CkongmcInputInfo, CkongmcDIPInfo, + CkongmcInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvPorter = { + "porter", "dockman", NULL, NULL, "19??", + "Port Man (bootleg on Moon Cresta hardware)\0", NULL, "Nova Games Ltd", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, PorterRomInfo, PorterRomName, NULL, NULL, PorterInputInfo, PorterDIPInfo, + PorterInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvKong = { + "kong", NULL, NULL, NULL, "198?", + "Kong (Brazil)\0", "Bad Colours", "Taito do Brasil", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, KongRomInfo, KongRomName, NULL, NULL, KongInputInfo, KongDIPInfo, + KongInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvFantastc = { + "fantastc", NULL, NULL, NULL, "198?", + "Fantastic\0", NULL, "Taito do Brasil", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, FantastcRomInfo, FantastcRomName, NULL, NULL, FantastcInputInfo, FantastcDIPInfo, + FantastcInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Custom background +static struct BurnRomInfo RockclimRomDesc[] = { + { "lc01.a1", 0x01000, 0x8601ae8d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lc02.a2", 0x01000, 0x2dde9d4c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lc03.a3", 0x01000, 0x82c48a67, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lc04.a4", 0x01000, 0x7cd3a04a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lc05.a5", 0x01000, 0x5e542149, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lc06.a6", 0x01000, 0xb2bdca64, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "lc08.a9", 0x00800, 0x7f18e1ef, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "lc07.a7", 0x00800, 0xf18b50ac, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "lc10.c9", 0x00800, 0xdec5781b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "lc09.c7", 0x00800, 0x06c0b5de, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "lc11.f4", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, + { "lc12.e9", 0x00020, 0xf6e76547, BRF_GRA | GAL_ROM_PROM }, + + { "lc13.g5", 0x01000, 0x19475f2b, BRF_GRA }, + { "lc14.g7", 0x01000, 0xcc96d1db, BRF_GRA }, +}; + +STD_ROM_PICK(Rockclim) +STD_ROM_FN(Rockclim) + +UINT8 __fastcall RockclimZ80Read(UINT16 a) +{ + switch (a) { + case 0x8800: { + return GalInput[3] | GalDip[3]; + } + + case 0xa000: { + return GalInput[0] | GalDip[0]; + } + + case 0xa800: { + return GalInput[1] | GalDip[1]; + } + + case 0xb000: { + return GalInput[2] | GalDip[2]; + } + + case 0xb800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall RockclimZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x4800: { + RockclimScrollX = (RockclimScrollX & 0xff00) | d; + return; + } + + case 0x4801: { + RockclimScrollX = (RockclimScrollX & 0xff) | (d << 8); + return; + } + + case 0x4802: { + RockclimScrollY = (RockclimScrollY & 0xff00) | d; + return; + } + + case 0x4803: { + RockclimScrollY = (RockclimScrollY & 0xff) | (d << 8); + return; + } + + case 0xa000: + case 0xa001: + case 0xa002: { + GalGfxBank[a - 0xa000] = d; + return; + } + + case 0xa003: { + // coin_count_0_w + return; + } + + case 0xa004: + case 0xa005: + case 0xa006: + case 0xa007: { + GalaxianLfoFreqWrite(a - 0xa004, d); + return; + } + + case 0xa800: + case 0xa801: + case 0xa802: + case 0xa803: + case 0xa804: + case 0xa805: + case 0xa806: + case 0xa807: { + GalaxianSoundWrite(a - 0xa800, d); + return; + } + + case 0xb000: { + GalIrqFire = d & 1; + return; + } + + case 0xb004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static void RockclimPostLoad() +{ + MapMooncrst(); + + GalVideoRam2 = (UINT8*)BurnMalloc(0x800); + + ZetOpen(0); + ZetSetReadHandler(RockclimZ80Read); + ZetSetWriteHandler(RockclimZ80Write); + ZetMapArea(0x4000, 0x47ff, 0, GalVideoRam2); + ZetMapArea(0x4000, 0x47ff, 1, GalVideoRam2); + ZetMapArea(0x4000, 0x47ff, 2, GalVideoRam2); + ZetMapArea(0x5000, 0x53ff, 0, GalZ80Ram1 + 0x400); + ZetMapArea(0x5000, 0x53ff, 1, GalZ80Ram1 + 0x400); + ZetMapArea(0x5000, 0x53ff, 2, GalZ80Ram1 + 0x400); + ZetMapArea(0x6000, 0x7fff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0x6000, 0x7fff, 2, GalZ80Rom1 + 0x4000); + ZetClose(); +} + +static INT32 RockclimInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = RockclimPostLoad; + RockclimTiles = (UINT8*)BurnMalloc(0x100 * 8 * 8); + + nRet = GalInit(); + + INT32 RockclimPlaneOffsets[4] = {4, 0, 0x8004, 0x8000}; + INT32 RockclimCharXOffsets[8] = {3, 2, 1, 0, 11, 10, 9, 8}; + INT32 RockclimCharYOffsets[8] = {0, 16, 32, 48, 64, 80, 96, 112}; + + GalTempRom = (UINT8*)BurnMalloc(0x2000); + nRet = BurnLoadRom(GalTempRom + 0x0000, 12, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x1000, 13, 1); if (nRet) return 1; + GfxDecode(256, 4, 8, 8, RockclimPlaneOffsets, RockclimCharXOffsets, RockclimCharYOffsets, 0x80, GalTempRom, RockclimTiles); + BurnFree(GalTempRom); + + GalCalcPaletteFunction = RockclimCalcPalette; + GalRenderBackgroundFunction = RockclimDrawBackground; + GalExtendTileInfoFunction = MooncrstExtendTileInfo; + GalExtendSpriteInfoFunction = RockclimExtendSpriteInfo; + + return nRet; +} + +struct BurnDriver BurnDrvRockclim = { + "rockclim", NULL, NULL, NULL, "1981", + "Rock Climber\0", NULL, "Taito", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, + NULL, RockclimRomInfo, RockclimRomName, NULL, NULL, RockclimInputInfo, RockclimDIPInfo, + RockclimInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +// Extra roms and sound hardware replaced with AY8910 +static struct BurnRomInfo JumpbugRomDesc[] = { + { "jb1", 0x01000, 0x415aa1b7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb2", 0x01000, 0xb1c27510, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb3", 0x01000, 0x97c24be2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb4", 0x01000, 0x66751d12, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb5", 0x01000, 0xe2d66faf, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb6", 0x01000, 0x49e0bdfd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb7", 0x00800, 0x83d71302, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "jbl", 0x00800, 0x9a091b0a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "jbm", 0x00800, 0x8a0fc082, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "jbn", 0x00800, 0x155186e0, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "jbi", 0x00800, 0x7749b111, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "jbj", 0x00800, 0x06e8d7df, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "jbk", 0x00800, 0xb8dbddf3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Jumpbug) +STD_ROM_FN(Jumpbug) + +static struct BurnRomInfo JumpbugbRomDesc[] = { + { "jb1", 0x01000, 0x415aa1b7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb2", 0x01000, 0xb1c27510, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb3b", 0x01000, 0xcb8b8a0f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb4", 0x01000, 0x66751d12, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb5b", 0x01000, 0x7553b5e2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb6b", 0x01000, 0x47be9843, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "jb7b", 0x00800, 0x460aed61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "jbl", 0x00800, 0x9a091b0a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "jbm", 0x00800, 0x8a0fc082, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "jbn", 0x00800, 0x155186e0, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "jbi", 0x00800, 0x7749b111, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "jbj", 0x00800, 0x06e8d7df, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "jbk", 0x00800, 0xb8dbddf3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "l06_prom.bin", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Jumpbugb) +STD_ROM_FN(Jumpbugb) + +static struct BurnRomInfo LeversRomDesc[] = { + { "g96059.a8", 0x01000, 0x9550627a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "g96060.d8", 0x01000, 0x5ac64646, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "g96061.e8", 0x01000, 0x9db8e520, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "g96062.h8", 0x01000, 0x7c8e8b3a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "g96063.j8", 0x01000, 0xfa61e793, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "g96064.l8", 0x01000, 0xf797f389, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "g95948.n1", 0x00800, 0xd8a0c692, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g95949.s1", 0x00800, 0x3660a552, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g95946.j1", 0x00800, 0x73b61b2d, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g95947.m1", 0x00800, 0x72ff67e2, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "g960lev.clr", 0x00020, 0x01febbbe, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Levers) +STD_ROM_FN(Levers) + +static struct BurnRomInfo BongoRomDesc[] = { + { "bg1.bin", 0x01000, 0xde9a8ec6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bg2.bin", 0x01000, 0xa19da662, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bg3.bin", 0x01000, 0x9f6f2150, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bg4.bin", 0x01000, 0xf80372d2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bg5.bin", 0x01000, 0xfc92eade, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "bg6.bin", 0x01000, 0x561d9e5d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "b-h.bin", 0x01000, 0xfc79d103, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "b-k.bin", 0x01000, 0x94d17bf3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "b-clr.bin", 0x00020, 0xc4761ada, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Bongo) +STD_ROM_FN(Bongo) + +void __fastcall BongoZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xb001: { + GalIrqFire = d & 1; + return; + } + + case 0xb004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + // watchdog write? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall BongoZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x02: { + return AY8910Read(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall BongoZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + AY8910Write(0, 0, d); + return; + } + + case 0x01: { + AY8910Write(0, 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +static INT32 JumpbugInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapJumpbug; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910; + + nRet = GalInit(); + + GalRenderBackgroundFunction = JumpbugDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = JumpbugExtendTileInfo; + GalExtendSpriteInfoFunction = JumpbugExtendSpriteInfo; + + AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +static void LeversPostLoad() +{ + GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); + memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); + memset(GalZ80Rom1, 0, GalZ80Rom1Size); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x1000); + memcpy(GalZ80Rom1 + 0x2000, GalTempRom + 0x1000, GalZ80Rom1Size - 0x2000); + BurnFree(GalTempRom); + + MapJumpbug(); +} + +static INT32 LeversInit() +{ + INT32 nRet; + + GalZ80Rom1Size = 0x1000; + GalTilesSharedRomSize = 0x1000; + + GalPostLoadCallbackFunction = LeversPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910; + + nRet = GalInit(); + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x1800, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x2800, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); if (nRet) return 1; + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + + GalRenderBackgroundFunction = JumpbugDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = JumpbugExtendTileInfo; + GalExtendSpriteInfoFunction = JumpbugExtendSpriteInfo; + + AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +static void BongoPostLoad() +{ + MapMooncrst(); + + ZetOpen(0); + ZetSetWriteHandler(BongoZ80Write); + ZetSetInHandler(BongoZ80PortRead); + ZetSetOutHandler(BongoZ80PortWrite); + ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); + ZetMapArea(0x8400, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8400, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8400, 0x87ff, 2, GalZ80Ram1); + ZetMapArea(0x9400, 0x97ff, 0, GalVideoRam); + ZetMapArea(0x9400, 0x97ff, 1, GalVideoRam); + ZetMapArea(0x9400, 0x97ff, 2, GalVideoRam); + ZetClose(); +} + +static INT32 BongoInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = BongoPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_BONGOAY8910; + + nRet = GalInit(); + + GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; + + return nRet; +} + +struct BurnDriver BurnDrvJumpbug = { + "jumpbug", NULL, NULL, NULL, "1981", + "Jump Bug\0", NULL, "Rock-ola", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, JumpbugRomInfo, JumpbugRomName, NULL, NULL, JumpbugInputInfo, JumpbugDIPInfo, + JumpbugInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvJumpbugb = { + "jumpbugb", "jumpbug", NULL, NULL, "1981", + "Jump Bug (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, JumpbugbRomInfo, JumpbugbRomName, NULL, NULL, JumpbugInputInfo, JumpbugDIPInfo, + JumpbugInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvLevers = { + "levers", NULL, NULL, NULL, "1983", + "Levers\0", NULL, "Rock-ola", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, + NULL, LeversRomInfo, LeversRomName, NULL, NULL, LeversInputInfo, LeversDIPInfo, + LeversInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvBongo = { + "bongo", NULL, NULL, NULL, "1983", + "Bongo\0", NULL, "Jetsoft", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, BongoRomInfo, BongoRomName, NULL, NULL, BongoInputInfo, BongoDIPInfo, + BongoInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Second Z80 driving AY8910 +static struct BurnRomInfo CheckmanRomDesc[] = { + { "cm1", 0x00800, 0xe8cbdd28, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "cm2", 0x00800, 0xb8432d4d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "cm3", 0x00800, 0x15a97f61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "cm4", 0x00800, 0x8c12ecc0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "cm5", 0x00800, 0x2352cfd6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "cm13", 0x00800, 0x0b09a3e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "cm14", 0x00800, 0x47f043be, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "cm11", 0x00800, 0x8d1bcca0, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "cm9", 0x00800, 0x3cd5c751, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "checkman.clr", 0x00020, 0x57a45057, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Checkman) +STD_ROM_FN(Checkman) + +static struct BurnRomInfo CheckmanjRomDesc[] = { + { "cm_1.bin", 0x01000, 0x456a118f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "cm_2.bin", 0x01000, 0x146b2c44, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "cm_3.bin", 0x00800, 0x73e1c945, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "cm_4.bin", 0x01000, 0x923cffa1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "cm_6.bin", 0x00800, 0x476a7cc3, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "cm_5.bin", 0x00800, 0xb3df2b5f, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "checkman.clr", 0x00020, 0x57a45057, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Checkmanj) +STD_ROM_FN(Checkmanj) + +static struct BurnRomInfo DingoRomDesc[] = { + { "003.e7", 0x01000, 0xd088550f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "004.h7", 0x01000, 0xa228446a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "005.j7", 0x00800, 0x14d680bb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "6.7l", 0x01000, 0x047092e0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "001.h1", 0x00800, 0x1ab1dd4d, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "002.k1", 0x00800, 0x4be375ee, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "18s030.l6", 0x00020, 0x3061d0f9, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Dingo) +STD_ROM_FN(Dingo) + +static struct BurnRomInfo DingoeRomDesc[] = { + { "unk.2b", 0x01000, 0x0df7ac6d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "unk.2d", 0x01000, 0x0881e204, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "unk.3b", 0x01000, 0x0b6aeab5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "unk.1c", 0x00800, 0x8e354c38, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "unk.1d", 0x00800, 0x092878d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "unk.4d", 0x00800, 0x76a00a56, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "unk.4b", 0x00800, 0x5acf57aa, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123n.001", 0x00020, 0x02b11865, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Dingoe) +STD_ROM_FN(Dingoe) + +void __fastcall CheckmanZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + GalSoundLatch = d; + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + return; + } + } + + bprintf(PRINT_NORMAL, _T("IO Write %x, %x\n"), a, d); +} + +void __fastcall CheckmanZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa000: + case 0xa001: + case 0xa002: { + GalGfxBank[a - 0xa000] = d; + return; + } + + case 0xa003: { + // coin_count_0_w + return; + } + + case 0xb001: { + GalIrqFire = d & 1; + return; + } + + case 0xb004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + } + + bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); +} + +UINT8 __fastcall CheckmanSoundZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x03: { + return GalSoundLatch; + } + + case 0x06: { + return AY8910Read(0); + } + } + + bprintf(PRINT_NORMAL, _T("Sound IO Read %x\n"), a); + return 0xff; +} + +void __fastcall CheckmanSoundZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x04: { + AY8910Write(0, 0, d); + return; + } + + case 0x05: { + AY8910Write(0, 1, d); + return; + } + } + + bprintf(PRINT_NORMAL, _T("Sound IO Write %x, %x\n"), a, d); +} + +UINT8 __fastcall CheckmanjZ80Read(UINT16 a) +{ + switch (a) { + case 0x3800: { + switch (ZetPc(-1)) { + case 0x0f15: return 0xf5; + case 0x0f8f: return 0x7c; + case 0x10b3: return 0x7c; + case 0x10e0: return 0x00; + case 0x10f1: return 0xaa; + case 0x1402: return 0xaa; + } + return 0xff; + } + + case 0x6000: { + return GalInput[0] | GalDip[0]; + } + + case 0x6800: { + return GalInput[1] | GalDip[1]; + } + + case 0x7000: { + return GalInput[2] | GalDip[2]; + } + + case 0x7800: { + // watchdog read + return 0xff; + } + } + + bprintf(PRINT_NORMAL, _T("Prog Read %x\n"), a); + return 0xff; +} + +void __fastcall CheckmanjZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5800 && a <= 0x58ff) { + INT32 Offset = a - 0x5800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6000: + case 0x6001: { + // start_lamp_w + return; + } + + case 0x6002: { + // coin_lock_w + return; + } + + case 0x6003: { + // coin_count_0_w + return; + } + + case 0x7001: { + GalIrqFire = d & 1; + return; + } + + case 0x7004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x7006: { + GalFlipScreenX = d & 1; + return; + } + + case 0x7007: { + GalFlipScreenY = d & 1; + return; + } + + case 0x7800: { + GalSoundLatch = d; + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + return; + } + } + + bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); +} + +UINT8 __fastcall CheckmanjSoundZ80Read(UINT16 a) +{ + switch (a) { + case 0xa002: { + return AY8910Read(0); + } + } + + bprintf(PRINT_NORMAL, _T("Sound Prog Read %x\n"), a); + return 0xff; +} + +void __fastcall CheckmanjSoundZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xa000: { + AY8910Write(0, 0, d); + return; + } + + case 0xa001: { + AY8910Write(0, 1, d); + return; + } + } + + bprintf(PRINT_NORMAL, _T("Sound Prog Write %x, %x\n"), a, d); +} + +UINT8 __fastcall DingoZ80Read(UINT16 a) +{ + switch (a) { + case 0x3000: { + return 0xaa; + } + + case 0x3035: { + return 0x8c; + } + + case 0x6000: { + return GalInput[0] | GalDip[0]; + } + + case 0x6800: { + return GalInput[1] | GalDip[1]; + } + + case 0x7000: { + return GalInput[2] | GalDip[2]; + } + + case 0x7800: { + // watchdog read + return 0xff; + } + } + + bprintf(PRINT_NORMAL, _T("Prog Read %x\n"), a); + return 0xff; +} + +static void CheckmanInitSoundCPU() +{ + ZetOpen(1); + ZetMapArea(0x0000, GalZ80Rom2Size - 1, 0, GalZ80Rom2); + ZetMapArea(0x0000, GalZ80Rom2Size - 1, 2, GalZ80Rom2); + ZetMapArea(0x2000, 0x23ff, 0, GalZ80Ram2); + ZetMapArea(0x2000, 0x23ff, 1, GalZ80Ram2); + ZetMapArea(0x2000, 0x23ff, 2, GalZ80Ram2); + ZetSetInHandler(CheckmanSoundZ80PortRead); + ZetSetOutHandler(CheckmanSoundZ80PortWrite); + ZetClose(); + + nGalCyclesTotal[1] = 1620000 / 60; +} + +static void CheckmanPostLoad() +{ + static const UINT8 XORTable[8][4] = { + { 6, 0, 6, 0 }, + { 5, 1, 5, 1 }, + { 4, 2, 6, 1 }, + { 2, 4, 5, 0 }, + { 4, 6, 1, 5 }, + { 0, 6, 2, 5 }, + { 0, 2, 0, 2 }, + { 1, 4, 1, 4 } + }; + + for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { + UINT8 Data = GalZ80Rom1[Offset]; + UINT32 Line = Offset & 0x07; + + Data ^= (BIT(Data, XORTable[Line][0]) << XORTable[Line][1]) | (BIT(Data, XORTable[Line][2]) << XORTable[Line][3]); + GalZ80Rom1[Offset] = Data; + } + + MapMooncrst(); + ZetOpen(0); + ZetSetWriteHandler(CheckmanZ80Write); + ZetSetOutHandler(CheckmanZ80PortWrite); + ZetClose(); + + CheckmanInitSoundCPU(); +} + +static INT32 CheckmanInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = CheckmanPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910; + GalTilesSharedRomSize = 0x1000; + + nRet = GalInit(); + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); + BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); + memcpy(GalTempRom + 0x0800, GalTempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x1800, GalTempRom + 0x1000, 0x800); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + + GalExtendTileInfoFunction = MooncrstExtendTileInfo; + GalExtendSpriteInfoFunction = MooncrstExtendSpriteInfo; + + AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +static void CheckmanjInitSoundCPU() +{ + ZetOpen(1); + ZetMapArea(0x0000, GalZ80Rom2Size - 1, 0, GalZ80Rom2); + ZetMapArea(0x0000, GalZ80Rom2Size - 1, 2, GalZ80Rom2); + ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram2); + ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram2); + ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram2); + ZetSetReadHandler(CheckmanjSoundZ80Read); + ZetSetWriteHandler(CheckmanjSoundZ80Write); + ZetClose(); + + nGalCyclesTotal[1] = 1620000 / 60; +} + +static void CheckmanjPostLoad() +{ + ZetOpen(0); + ZetSetReadHandler(CheckmanjZ80Read); + ZetSetWriteHandler(CheckmanjZ80Write); + ZetClose(); + + CheckmanjInitSoundCPU(); +} + +static INT32 CheckmanjInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = CheckmanjPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910; + + nRet = GalInit(); + + AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +static void DingoPostLoad() +{ + ZetOpen(0); + ZetSetReadHandler(DingoZ80Read); + ZetSetWriteHandler(CheckmanjZ80Write); + ZetMapArea(0x5400, 0x57ff, 0, GalVideoRam); + ZetMapArea(0x5400, 0x57ff, 1, GalVideoRam); + ZetMapArea(0x5400, 0x57ff, 2, GalVideoRam); + ZetClose(); + + CheckmanjInitSoundCPU(); +} + +static INT32 DingoInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = DingoPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910; + + nRet = GalInit(); + + AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +static void DingoePostLoad() +{ + for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { + UINT8 Data = GalZ80Rom1[Offset]; + + Data ^= BIT(Data, 2) << 4; + Data ^= BIT(Data, 5) << 0; + Data ^= 0x02; + + if (Offset & 0x02) Data = BITSWAP08(Data, 7, 6, 5, 0, 3, 2, 1, 4); + GalZ80Rom1[Offset] = Data; + } + + MapMooncrst(); + ZetOpen(0); + ZetSetWriteHandler(CheckmanZ80Write); + ZetSetOutHandler(CheckmanZ80PortWrite); + ZetClose(); + + CheckmanInitSoundCPU(); +} + +static INT32 DingoeInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = DingoePostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910; + + nRet = GalInit(); + + AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +struct BurnDriver BurnDrvCheckman = { + "checkman", NULL, NULL, NULL, "1982", + "Check Man\0", NULL, "Zilex-Zenitone", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, CheckmanRomInfo, CheckmanRomName, NULL, NULL, CheckmanInputInfo, CheckmanDIPInfo, + CheckmanInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvCheckmanj = { + "checkmanj", "checkman", NULL, NULL, "1982", + "Check Man (Japan)\0", NULL, "Jaleco", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, CheckmanjRomInfo, CheckmanjRomName, NULL, NULL, CheckmanjInputInfo, CheckmanjDIPInfo, + CheckmanjInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvDingo = { + "dingo", NULL, NULL, NULL, "1983", + "Dingo\0", NULL, "Ashby Computers and Graphics LTD. (Jaleco license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, DingoRomInfo, DingoRomName, NULL, NULL, DingoInputInfo, DingoDIPInfo, + DingoInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriverD BurnDrvDingoe = { + "dingoe", "dingo", NULL, NULL, "1983", + "Dingo (encrypted)\0", "Encrypted", "Ashby Computers and Graphics LTD. (Jaleco license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, DingoeRomInfo, DingoeRomName, NULL, NULL, DingoInputInfo, DingoDIPInfo, + DingoeInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Crazy climber sound plus AY8910, and INT instead of NMI +static struct BurnRomInfo MshuttleRomDesc[] = { + { "my05", 0x01000, 0x83574af1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "my04", 0x01000, 0x1cfae2c8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "my03", 0x01000, 0xc8b8a368, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "my02", 0x01000, 0xb6aeee6e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "my01", 0x01000, 0xdef82adc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "my09", 0x01000, 0x3601b380, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my11", 0x00800, 0xb659e932, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my08", 0x01000, 0x992b06cd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my10", 0x00800, 0xd860e6ce, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mscprom1.bin", 0x00020, 0xea0d1af0, BRF_GRA | GAL_ROM_PROM }, + + { "my07", 0x01000, 0x522a2920, BRF_SND | BRF_OPT }, // Samples + { "my06(__eng)", 0x01000, 0x466415f2, BRF_SND | BRF_OPT }, +}; + +STD_ROM_PICK(Mshuttle) +STD_ROM_FN(Mshuttle) + +static struct BurnRomInfo Mshuttle2RomDesc[] = { + { "my05", 0x01000, 0x83574af1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "my04", 0x01000, 0x1cfae2c8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "my03", 0x01000, 0xc8b8a368, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "my02(__mshuttle2)", 0x01000, 0x9804061c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "my01(__mshuttle2)", 0x01000, 0xca746a61, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "my09", 0x01000, 0x3601b380, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my11(__mshuttle2)", 0x00800, 0xd860e6ce, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my08", 0x01000, 0x992b06cd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my10", 0x00800, 0xd860e6ce, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mscprom1.bin", 0x00020, 0xea0d1af0, BRF_GRA | GAL_ROM_PROM }, + + { "my07", 0x01000, 0x522a2920, BRF_SND | BRF_OPT }, // Samples + { "my06", 0x01000, 0x6d2dd711, BRF_SND | BRF_OPT }, +}; + +STD_ROM_PICK(Mshuttle2) +STD_ROM_FN(Mshuttle2) + +static struct BurnRomInfo MshuttlejRomDesc[] = { + { "mcs.5", 0x01000, 0xa5a292b4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mcs.4", 0x01000, 0xacdc0f9e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mcs.3", 0x01000, 0xc1e3f5d8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mcs.2", 0x01000, 0x14577703, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mcs.1", 0x01000, 0x27d46772, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "my09", 0x01000, 0x3601b380, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my11", 0x00800, 0xb659e932, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my08", 0x01000, 0x992b06cd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my10", 0x00800, 0xd860e6ce, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mscprom1.bin", 0x00020, 0xea0d1af0, BRF_GRA | GAL_ROM_PROM }, + + { "my07", 0x01000, 0x522a2920, BRF_SND | BRF_OPT }, // Samples + { "my06", 0x01000, 0x6d2dd711, BRF_SND | BRF_OPT }, +}; + +STD_ROM_PICK(Mshuttlej) +STD_ROM_FN(Mshuttlej) + +static struct BurnRomInfo Mshuttlej2RomDesc[] = { + { "ali5.bin", 0x01000, 0x320fe630, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mcs.4", 0x01000, 0xacdc0f9e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mcs.3", 0x01000, 0xc1e3f5d8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali2.bin", 0x01000, 0x9ed169e1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ali1.bin", 0x01000, 0x7f8a52d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "my09", 0x01000, 0x3601b380, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my11", 0x00800, 0xb659e932, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my08", 0x01000, 0x992b06cd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "my10", 0x00800, 0xd860e6ce, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mscprom1.bin", 0x00020, 0xea0d1af0, BRF_GRA | GAL_ROM_PROM }, + + { "my07", 0x01000, 0x522a2920, BRF_SND | BRF_OPT }, // Samples + { "my06.4r", 0x01000, 0x4162be4d, BRF_SND | BRF_OPT }, +}; + +STD_ROM_PICK(Mshuttlej2) +STD_ROM_FN(Mshuttlej2) + +UINT8 __fastcall MshuttleZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x0c: { + if (!MshuttleAY8910CS) return AY8910Read(0); + return 0xff; + } + } + + bprintf(PRINT_NORMAL, _T("IO Read %x\n"), a); + return 0xff; +} + +void __fastcall MshuttleZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x08: { + if (!MshuttleAY8910CS) AY8910Write(0, 0, d); + return; + } + + case 0x09: { + if (!MshuttleAY8910CS) AY8910Write(0, 1, d); + return; + } + } + + bprintf(PRINT_NORMAL, _T("IO Write %x, %x\n"), a, d); +} + +void __fastcall MshuttleZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa000: { + GalIrqFire = d & 1; + return; + } + + case 0xa001: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xa002: { + GalFlipScreenX = d & 1; + GalFlipScreenY = d & 1; + return; + } + + case 0xa004: { + // cclimber_sample_trigger_w + return; + } + + case 0xa007: { + MshuttleAY8910CS = d & 1; + return; + } + + case 0xa800: { + // cclimber_sample_rate_w + return; + } + + case 0xb000: { + // cclimber_sample_volume_w + return; + } + } + bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); +} + +static void MapMshuttle() +{ + MapMooncrst(); + ZetOpen(0); + ZetMapArea(0x0000, 0x4fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x4fff, 2, GalZ80Rom1Op, GalZ80Rom1); + ZetSetWriteHandler(MshuttleZ80Write); + ZetSetInHandler(MshuttleZ80PortRead); + ZetSetOutHandler(MshuttleZ80PortWrite); + ZetClose(); +} + +static void MshuttleDecrypt() +{ + GalZ80Rom1Op = (UINT8*)BurnMalloc(GalZ80Rom1Size); + + static const UINT8 ConvTable[8][16] = { + { 0x40, 0x41, 0x44, 0x15, 0x05, 0x51, 0x54, 0x55, 0x50, 0x00, 0x01, 0x04, (UINT8)-1, 0x10, 0x11, 0x14 }, + { 0x45, 0x51, 0x55, 0x44, 0x40, 0x11, 0x05, 0x41, 0x10, 0x14, 0x54, 0x50, 0x15, 0x04, 0x00, 0x01 }, + { 0x11, 0x14, 0x10, 0x00, 0x44, 0x05, (UINT8)-1, 0x04, 0x45, 0x15, 0x55, 0x50, (UINT8)-1, 0x01, 0x54, 0x51 }, + { 0x14, 0x01, 0x11, 0x10, 0x50, 0x15, 0x00, 0x40, 0x04, 0x51, 0x45, 0x05, 0x55, 0x54, (UINT8)-1, 0x44 }, + { 0x04, 0x10, (UINT8)-1, 0x40, 0x15, 0x41, 0x50, 0x50, 0x11, (UINT8)-1, 0x14, 0x00, 0x51, 0x45, 0x55, 0x01 }, + { 0x44, 0x45, 0x00, 0x51, (UINT8)-1, (UINT8)-1, 0x15, 0x11, 0x01, 0x10, 0x04, 0x55, 0x05, 0x40, 0x50, 0x41 }, + { 0x51, 0x00, 0x01, 0x05, 0x04, 0x55, 0x54, 0x50, 0x41, (UINT8)-1, 0x11, 0x15, 0x14, 0x10, 0x44, 0x40 }, + { 0x05, 0x04, 0x51, 0x01, (UINT8)-1, (UINT8)-1, 0x55, (UINT8)-1, 0x00, 0x50, 0x15, 0x14, 0x44, 0x41, 0x40, 0x54 }, + }; + + for (UINT32 Offset = 0x0000; Offset < GalZ80Rom1Size; Offset++) { + INT32 i, j; + UINT8 Src; + + Src = GalZ80Rom1[Offset]; + i = (Offset & 1) | (Src & 0x02) | ((Src & 0x80) >> 5); + j = (Src & 0x01) | ((Src & 0x04) >> 1) | ((Src & 0x10) >> 2) | ((Src & 0x40) >> 3); + + GalZ80Rom1Op[Offset] = (Src & 0xaa) | ConvTable[i][j]; + } + + MapMshuttle(); +} + +static void MShuttleCommonInit() +{ + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); + BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); + BurnLoadRom(GalTempRom + 0x2000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); + BurnLoadRom(GalTempRom + 0x3000, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + + GalDrawBulletsFunction = MshuttleDrawBullets; + GalExtendTileInfoFunction = MshuttleExtendTileInfo; + GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; + + GalIrqType = GAL_IRQ_TYPE_IRQ0; +} + +static INT32 MshuttleInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MshuttleDecrypt; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910; + GalTilesSharedRomSize = 0x1000; + + nRet = GalInit(); + + MShuttleCommonInit(); + + return nRet; +} + +static void MshuttlejDecrypt() +{ + GalZ80Rom1Op = (UINT8*)BurnMalloc(GalZ80Rom1Size); + + static const UINT8 ConvTable[8][16] = { + { 0x41, 0x54, 0x51, 0x14, 0x05, 0x10, 0x01, 0x55, 0x44, 0x11, 0x00, 0x50, 0x15, 0x40, 0x04, 0x45 }, + { 0x50, 0x11, 0x40, 0x55, 0x51, 0x14, 0x45, 0x04, 0x54, 0x15, 0x10, 0x05, 0x44, 0x01, 0x00, 0x41 }, + { 0x44, 0x11, 0x00, 0x50, 0x41, 0x54, 0x04, 0x14, 0x15, 0x40, 0x51, 0x55, 0x05, 0x10, 0x01, 0x45 }, + { 0x10, 0x50, 0x54, 0x55, 0x01, 0x44, 0x40, 0x04, 0x14, 0x11, 0x00, 0x41, 0x45, 0x15, 0x51, 0x05 }, + { 0x14, 0x41, 0x01, 0x44, 0x04, 0x50, 0x51, 0x45, 0x11, 0x40, 0x54, 0x15, 0x10, 0x00, 0x55, 0x05 }, + { 0x01, 0x05, 0x41, 0x45, 0x54, 0x50, 0x55, 0x10, 0x11, 0x15, 0x51, 0x14, 0x44, 0x40, 0x04, 0x00 }, + { 0x05, 0x55, 0x00, 0x50, 0x11, 0x40, 0x54, 0x14, 0x45, 0x51, 0x10, 0x04, 0x44, 0x01, 0x41, 0x15 }, + { 0x55, 0x50, 0x15, 0x10, 0x01, 0x04, 0x41, 0x44, 0x45, 0x40, 0x05, 0x00, 0x11, 0x14, 0x51, 0x54 }, + }; + + for (UINT32 Offset = 0x0000; Offset < GalZ80Rom1Size; Offset++) { + INT32 i, j; + UINT8 Src; + + Src = GalZ80Rom1[Offset]; + i = (Offset & 1) | (Src & 0x02) | ((Src & 0x80) >> 5); + j = (Src & 0x01) | ((Src & 0x04) >> 1) | ((Src & 0x10) >> 2) | ((Src & 0x40) >> 3); + + GalZ80Rom1Op[Offset] = (Src & 0xaa) | ConvTable[i][j]; + } + + MapMshuttle(); +} + +static INT32 MshuttlejInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MshuttlejDecrypt; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910; + GalTilesSharedRomSize = 0x1000; + + nRet = GalInit(); + + MShuttleCommonInit(); + + return nRet; +} + +struct BurnDriver BurnDrvMshuttle = { + "mshuttle", NULL, NULL, NULL, "1981", + "Moon Shuttle (US?)\0", "Incomplete Sound", "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MshuttleRomInfo, MshuttleRomName, NULL, NULL, MshuttleInputInfo, MshuttleDIPInfo, + MshuttleInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMshuttle2 = { + "mshuttle2", "mshuttle", NULL, NULL, "1981", + "Moon Shuttle (US? set 2)\0", "Incomplete Sound", "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Mshuttle2RomInfo, Mshuttle2RomName, NULL, NULL, MshuttleInputInfo, MshuttleDIPInfo, + MshuttleInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMshuttlej = { + "mshuttlej", "mshuttle", NULL, NULL, "1981", + "Moon Shuttle (Japan)\0", "Incomplete Sound", "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, MshuttlejRomInfo, MshuttlejRomName, NULL, NULL, MshuttleInputInfo, MshuttleDIPInfo, + MshuttlejInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMshuttlej2 = { + "mshuttlej2", "mshuttle", NULL, NULL, "1981", + "Moon Shuttle (Japan set 2)\0", "Incomplete Sound", "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, Mshuttlej2RomInfo, Mshuttlej2RomName, NULL, NULL, MshuttleInputInfo, MshuttleDIPInfo, + MshuttlejInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +// Second Z80 driving DAC +static struct BurnRomInfo KingballRomDesc[] = { + { "prg1.7f", 0x01000, 0x6cb49046, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "prg2.7j", 0x01000, 0xc223b416, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "prg3.7l", 0x00800, 0x453634c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "kbe1.ic4", 0x00800, 0x5be2c80a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "kbe2.ic5", 0x00800, 0xbb59e965, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "kbe3.ic6", 0x00800, 0x1c94dd31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "kbe2.ic7", 0x00800, 0xbb59e965, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "chg1.1h", 0x00800, 0x9cd550e7, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "chg2.1k", 0x00800, 0xa206757d, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "kb2-1", 0x00020, 0x15dd5b16, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Kingball) +STD_ROM_FN(Kingball) + +static struct BurnRomInfo KingballjRomDesc[] = { + { "prg1.7f", 0x01000, 0x6cb49046, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "prg2.7j", 0x01000, 0xc223b416, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "prg3.7l", 0x00800, 0x453634c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "kbj1.ic4", 0x00800, 0xba16beb7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "kbj2.ic5", 0x00800, 0x56686a63, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "kbj3.ic6", 0x00800, 0xfbc570a5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "kbj2.ic7", 0x00800, 0x56686a63, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "chg1.1h", 0x00800, 0x9cd550e7, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "chg2.1k", 0x00800, 0xa206757d, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "kb2-1", 0x00020, 0x15dd5b16, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Kingballj) +STD_ROM_FN(Kingballj) + +UINT8 __fastcall KingballZ80Read(UINT16 a) +{ + switch (a) { + case 0xa000: { + if (KingballSpeechDip) { + return GalInput[0] | GalDip[0] | ((GalFakeDip & 0x02) ? 0x40 : 0x00); + } else { + return GalInput[0] | GalDip[0] | ((GalFakeDip & 0x01) ? 0x40 : 0x00); + } + } + + case 0xa800: { + return ((GalInput[1] | GalDip[1]) & ~0x20) | (rand() & 0x20); + } + + case 0xb000: { + return GalInput[2] | GalDip[2]; + } + + case 0xb800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall KingballZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa000: + case 0xa001: + case 0xa002: { + GalGfxBank[a - 0xa000] = d; + return; + } + + case 0xa003: { + // coin_count_0_w + return; + } + + case 0xa004: + case 0xa005: + case 0xa006: + case 0xa007: { + GalaxianLfoFreqWrite(a - 0xa004, d); + return; + } + + case 0xa800: + case 0xa801: + case 0xa802: + case 0xa803: + case 0xa804: + case 0xa805: + case 0xa806: + case 0xa807: { + GalaxianSoundWrite(a - 0xa800, d); + return; + } + + case 0xb000: { + KingballSound = (KingballSound & ~0x01) | d; + return; + } + + case 0xb001: { + GalIrqFire = d & 1; + return; + } + + case 0xb002: { + KingballSound = (KingballSound & ~0x02) | (d << 1); + GalSoundLatch = KingballSound | 0xf0; + return; + } + + case 0xb003: { + KingballSpeechDip = d; + return; + } + + case 0xb004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall KingballSoundZ80Read(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall KingballSoundZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall KingballSoundZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return GalSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall KingballSoundZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + DACWrite(0, d ^ 0xff); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); + } + } +} + +static void KingballPostLoad() +{ + MapMooncrst(); + + ZetOpen(0); + ZetSetReadHandler(KingballZ80Read); + ZetSetWriteHandler(KingballZ80Write); + ZetClose(); + + ZetOpen(1); + ZetSetReadHandler(KingballSoundZ80Read); + ZetSetWriteHandler(KingballSoundZ80Write); + ZetSetInHandler(KingballSoundZ80PortRead); + ZetSetOutHandler(KingballSoundZ80PortWrite); + ZetMapArea(0x0000, 0x1fff, 0, GalZ80Rom2); + ZetMapArea(0x0000, 0x1fff, 2, GalZ80Rom2); + ZetClose(); + + nGalCyclesTotal[1] = (5000000 / 2) / 60; +} + +static INT32 KingballInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = KingballPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC; + GalTilesSharedRomSize = 0x1000; + + nRet = GalInit(); + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); + BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); + memcpy(GalTempRom + 0x0800, GalTempRom + 0x0000, 0x800); + memcpy(GalTempRom + 0x1800, GalTempRom + 0x1000, 0x800); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + + return nRet; +} + +struct BurnDriver BurnDrvKingball = { + "kingball", NULL, NULL, NULL, "1980", + "King & Balloon (US)\0", NULL, "Namco", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, KingballRomInfo, KingballRomName, NULL, NULL, KingballInputInfo, KingballDIPInfo, + KingballInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvKingballj = { + "kingballj", "kingball", NULL, NULL, "1980", + "King & Balloon (Japan)\0", NULL, "Namco", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, KingballjRomInfo, KingballjRomName, NULL, NULL, KingballInputInfo, KingballDIPInfo, + KingballInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Frogger based hardware +static struct BurnRomInfo FroggerRomDesc[] = { + { "frogger.26", 0x01000, 0x597696d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "frogger.27", 0x01000, 0xb6e6fcc3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "frsm3.7", 0x01000, 0xaca22ae0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "frogger.608", 0x00800, 0xe8ab0256, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "frogger.609", 0x00800, 0x7380a48f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "frogger.610", 0x00800, 0x31d7eb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "frogger.607", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "frogger.606", 0x00800, 0xf524ee30, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Frogger) +STD_ROM_FN(Frogger) + +static struct BurnRomInfo Froggers1RomDesc[] = { + { "frogger.26", 0x01000, 0x597696d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "frogger.27", 0x01000, 0xb6e6fcc3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "frogger.34", 0x01000, 0xed866bab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "epr-608.ic32", 0x00800, 0xe8ab0256, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr-609.ic33", 0x00800, 0x7380a48f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr-610.ic34", 0x00800, 0x31d7eb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "epr-607.ic101", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr-606.ic102", 0x00800, 0xf524ee30, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Froggers1) +STD_ROM_FN(Froggers1) + +static struct BurnRomInfo Froggers2RomDesc[] = { + { "epr-1012.ic5", 0x01000, 0xefab0c79, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr-1013a.ic6", 0x01000, 0xaeca9c13, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr-1014.ic7", 0x01000, 0xdd251066, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr-1015.ic8", 0x01000, 0xbf293a02, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "epr-608.ic32", 0x00800, 0xe8ab0256, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr-609.ic33", 0x00800, 0x7380a48f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr-610.ic34", 0x00800, 0x31d7eb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "epr-607.ic101", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr-606.ic102", 0x00800, 0xf524ee30, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Froggers2) +STD_ROM_FN(Froggers2) + +static struct BurnRomInfo FroggermcRomDesc[] = { + { "epr-1031.15", 0x01000, 0x4b7c8d11, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr-1032.16", 0x01000, 0xac00b9d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr-1033.33", 0x01000, 0xbc1d6fbc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr-1034.34", 0x01000, 0x9efe7399, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "epr-1082.42", 0x01000, 0x802843c2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr-1035.43", 0x00800, 0x14e74148, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "epr-1037.1h", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr-1036.1k", 0x00800, 0x658745f8, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Froggermc) +STD_ROM_FN(Froggermc) + +static struct BurnRomInfo FroggersRomDesc[] = { + { "vid_d2.bin", 0x00800, 0xc103066e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_e2.bin", 0x00800, 0xf08bc094, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_f2.bin", 0x00800, 0x637a2ff8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_h2.bin", 0x00800, 0x04c027a5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_j2.bin", 0x00800, 0xfbdfbe74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_l2.bin", 0x00800, 0x8a4389e1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "frogger.608", 0x00800, 0xe8ab0256, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "frogger.609", 0x00800, 0x7380a48f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "frogger.610", 0x00800, 0x31d7eb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "frogger.607", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr-1036.1k", 0x00800, 0x658745f8, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Froggers) +STD_ROM_FN(Froggers) + +static struct BurnRomInfo FrogfRomDesc[] = { + { "6.bin", 0x01000, 0x8ff0a973, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7.bin", 0x01000, 0x3087bb4b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8.bin", 0x01000, 0xc3869d12, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "frogger.608", 0x00800, 0xe8ab0256, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "frogger.609", 0x00800, 0x7380a48f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "frogger.610", 0x00800, 0x31d7eb27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "frogger.607", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr-1036.1k", 0x00800, 0x658745f8, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Frogf) +STD_ROM_FN(Frogf) + +static struct BurnRomInfo FroggRomDesc[] = { + { "p1.bin", 0x00800, 0x1762b266, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p2.bin", 0x00800, 0x322f3916, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p3.bin", 0x00800, 0x28bd6151, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p4.bin", 0x00800, 0x5a69ab18, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p5.bin", 0x00800, 0xb4f17745, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p6.bin", 0x00800, 0x34be71b5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p7.bin", 0x00800, 0xde3edc8c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "k.bin", 0x00800, 0x05f7d883, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "h.bin", 0x00800, 0x658745f8, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "pr-91.6l", 0x00020, 0x413703bf, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Frogg) +STD_ROM_FN(Frogg) + +void __fastcall FroggermcZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa000: + case 0xa001: + case 0xa002: { + GalGfxBank[a - 0xa000] = d; + return; + } + + case 0xa003: { + // coin_count_0_w + return; + } + + case 0xa800: { + GalSoundLatch = d; + return; + } + + case 0xb000: { + GalIrqFire = d & 1; + return; + } + + case 0xb001: { + if (!(d & 1)) { + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(0); + } + return; + } + + case 0xb004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall FrogfZ80Read(UINT16 a) +{ + if (a >= 0xc000) { + UINT32 Offset = a - 0xc000; + UINT8 Result = 0xff; + if (Offset & 0x1000) Result &= ppi8255_r(0, (Offset >> 3) & 3); + if (Offset & 0x2000) Result &= ppi8255_r(1, (Offset >> 3) & 3); + return Result; + } + + switch (a) { + case 0xb800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall FrogfZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9000 && a <= 0x90ff) { + INT32 Offset = a - 0x9000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0xc000) { + INT32 Offset = a - 0xc000; + if (Offset & 0x1000) ppi8255_w(0, (Offset >> 3) & 3, d); + if (Offset & 0x2000) ppi8255_w(1, (Offset >> 3) & 3, d); + return; + } + + switch (a) { + case 0xa802: { + GalFlipScreenX = d & 1; + return; + } + + case 0xa804: { + GalIrqFire = d & 1; + return; + } + + case 0xa806: { + GalFlipScreenY = d & 1; + return; + } + + case 0xa809: { + // coin_count_1_w + return; + } + + case 0xa80e: { + // coin_count_0_w + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static void FroggerEncGfxPostLoad() +{ + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); + BurnLoadRom(GalTempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); + for (UINT32 Offset = 0x0800; Offset < 0x1000; Offset++) GalTempRom[Offset] = BITSWAP08(GalTempRom[Offset], 7, 6, 5, 4, 3, 2, 0, 1); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + + MapFrogger(); +} + +static INT32 FroggerEncGfxInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = FroggerEncGfxPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; + + nRet = GalInit(); + FroggerSoundInit(); + + FroggerAdjust = 1; + + GalRenderBackgroundFunction = FroggerDrawBackground; + GalDrawBulletsFunction = NULL; + GalExtendTileInfoFunction = FroggerExtendTileInfo; + GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; + + KonamiPPIInit(); + + return nRet; +} + +static void FroggermcPostLoad() +{ + MapMooncrst(); + + ZetOpen(0); + ZetSetWriteHandler(FroggermcZ80Write); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetClose(); +} + +static INT32 FroggermcInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = FroggermcPostLoad; +// GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; + + nRet = GalInit(); + FroggerSoundInit(); + + GalRenderBackgroundFunction = FroggerDrawBackground; + GalDrawBulletsFunction = NULL; + GalExtendTileInfoFunction = FroggerExtendTileInfo; + GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; + + return nRet; +} + +static INT32 FroggersInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapTheend; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; + + nRet = GalInit(); + FroggerSoundInit(); + + KonamiPPIInit(); + + GalRenderBackgroundFunction = FroggerDrawBackground; + GalDrawBulletsFunction = NULL; + GalExtendTileInfoFunction = FroggerExtendTileInfo; + GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; + + return nRet; +} + +static void FrogfPostLoad() +{ + MapFrogger(); + + ZetOpen(0); + ZetSetReadHandler(FrogfZ80Read); + ZetSetWriteHandler(FrogfZ80Write); + ZetMemCallback(0x8800, 0xffff, 0); + ZetMemCallback(0x8800, 0xffff, 1); + ZetMemCallback(0x8800, 0xffff, 2); + ZetMapArea(0x8800, 0x8bff, 0, GalVideoRam); + ZetMapArea(0x8800, 0x8bff, 1, GalVideoRam); + ZetMapArea(0x8800, 0x8bff, 2, GalVideoRam); + ZetMapArea(0x9000, 0x90ff, 0, GalSpriteRam); + ZetMapArea(0x9000, 0x90ff, 2, GalSpriteRam); + ZetClose(); +} + +static INT32 FrogfInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = FrogfPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; + + nRet = GalInit(); + FroggerSoundInit(); + + KonamiPPIInit(); + + GalRenderBackgroundFunction = FroggerDrawBackground; + GalDrawBulletsFunction = NULL; + GalExtendTileInfoFunction = FroggerExtendTileInfo; + GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; + + return nRet; +} + +static void FroggPostLoad() +{ + ZetOpen(0); + ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); + ZetClose(); +} + +static INT32 FroggInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = FroggPostLoad; + + nRet = GalInit(); + + GalRenderBackgroundFunction = FroggerDrawBackground; + GalExtendTileInfoFunction = FroggerExtendTileInfo; + GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; + + return nRet; +} + +struct BurnDriver BurnDrvFrogger = { + "frogger", NULL, NULL, NULL, "1981", + "Frogger\0", NULL, "Konami", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, + NULL, FroggerRomInfo, FroggerRomName, NULL, NULL, FroggerInputInfo, FroggerDIPInfo, + FroggerEncGfxInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvFroggers1 = { + "froggers1", "frogger", NULL, NULL, "1981", + "Frogger (Sega set 1)\0", NULL, "Konami (Sega license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, + NULL, Froggers1RomInfo, Froggers1RomName, NULL, NULL, FroggerInputInfo, FroggerDIPInfo, + FroggerEncGfxInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvFroggers2 = { + "froggers2", "frogger", NULL, NULL, "1981", + "Frogger (Sega set 2)\0", NULL, "Konami (Sega license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, + NULL, Froggers2RomInfo, Froggers2RomName, NULL, NULL, FroggerInputInfo, FroggerDIPInfo, + FroggerEncGfxInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvFroggermc = { + "froggermc", "frogger", NULL, NULL, "1981", + "Frogger (Moon Cresta hardware)\0", "No Sound", "Konami (Sega license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, + NULL, FroggermcRomInfo, FroggermcRomName, NULL, NULL, FroggermcInputInfo, FroggermcDIPInfo, + FroggermcInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvFroggers = { + "froggers", "frogger", NULL, NULL, "1981", + "Frog\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, + NULL, FroggersRomInfo, FroggersRomName, NULL, NULL, FroggerInputInfo, FroggerDIPInfo, + FroggersInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvFrogf = { + "frogf", "frogger", NULL, NULL, "1981", + "Frog (Falcon bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, + NULL, FrogfRomInfo, FrogfRomName, NULL, NULL, FroggerInputInfo, FroggerDIPInfo, + FrogfInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvFrogg = { + "frogg", "frogger", NULL, NULL, "1981", + "Frog (Galaxian hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, + NULL, FroggRomInfo, FroggRomName, NULL, NULL, FroggInputInfo, FroggDIPInfo, + FroggInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Turtles based hardware +static struct BurnRomInfo TurtlesRomDesc[] = { + { "turt_vid.2c", 0x01000, 0xec5e61fb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "turt_vid.2e", 0x01000, 0xfd10821e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "turt_vid.2f", 0x01000, 0xddcfc5fa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "turt_vid.2h", 0x01000, 0x9e71696c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "turt_vid.2j", 0x01000, 0xfcd49fef, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "turt_snd.5c", 0x01000, 0xf0c30f9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "turt_snd.5d", 0x01000, 0xaf5fc43c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "turt_vid.5h", 0x00800, 0xe5999d52, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "turt_vid.5f", 0x00800, 0xc3ffd655, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "turtles.clr", 0x00020, 0xf3ef02dd, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Turtles) +STD_ROM_FN(Turtles) + +static struct BurnRomInfo TurpinRomDesc[] = { + { "m1", 0x01000, 0x89177473, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m2", 0x01000, 0x4c6ca5c6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m3", 0x01000, 0x62291652, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "turt_vid.2h", 0x01000, 0x9e71696c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "m5", 0x01000, 0x7d2600f2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "turt_snd.5c", 0x01000, 0xf0c30f9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "turt_snd.5d", 0x01000, 0xaf5fc43c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "turt_vid.5h", 0x00800, 0xe5999d52, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "turt_vid.5f", 0x00800, 0xc3ffd655, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "turtles.clr", 0x00020, 0xf3ef02dd, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Turpin) +STD_ROM_FN(Turpin) + +static struct BurnRomInfo SixhundredRomDesc[] = { + { "600_vid.2c", 0x01000, 0x8ee090ae, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "600_vid.2e", 0x01000, 0x45bfaff2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "600_vid.2f", 0x01000, 0x9f4c8ed7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "600_vid.2h", 0x01000, 0xa92ef056, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "600_vid.2j", 0x01000, 0x6dadd72d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "600_snd.5c", 0x01000, 0x1773c68e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "600_snd.5d", 0x01000, 0xa311b998, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "600_vid.5h", 0x00800, 0x006c3d56, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "600_vid.5f", 0x00800, 0x7dbc0426, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "turtles.clr", 0x00020, 0xf3ef02dd, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Sixhundred) +STD_ROM_FN(Sixhundred) + +static struct BurnRomInfo TurpinsRomDesc[] = { + { "t1.bin", 0x01000, 0x89dd50cc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "t3.bin", 0x01000, 0x9562dc29, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "t4.bin", 0x01000, 0x62291652, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "t5.bin", 0x01000, 0x804118e8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "t2.bin", 0x01000, 0x8024f678, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "8tur.bin", 0x01000, 0xc97ed8ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "5tur.bin", 0x01000, 0xaf5fc43c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "tur.4f", 0x00800, 0xe5999d52, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "tur.5f", 0x00800, 0xc3ffd655, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "turtles.clr", 0x00020, 0xf3ef02dd, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Turpins) +STD_ROM_FN(Turpins) + +static struct BurnRomInfo AmidarRomDesc[] = { + { "1.2c", 0x01000, 0x621b74de, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2.2e", 0x01000, 0x38538b98, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3.2f", 0x01000, 0x099ecb24, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4.2h", 0x01000, 0xba149a93, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5.2j", 0x01000, 0xeecc1abf, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "s1.5c", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "s2.5d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "c2.5f", 0x00800, 0x2cfe5ede, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "c2.5d", 0x00800, 0x57c4fd0d, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Amidar) +STD_ROM_FN(Amidar) + +static struct BurnRomInfo Amidar1RomDesc[] = { + { "amidar.2c", 0x01000, 0xc294bf27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "amidar.2e", 0x01000, 0xe6e96826, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "amidar.2f", 0x01000, 0x3656be6f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "amidar.2h", 0x01000, 0x1be170bd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "amidar.5c", 0x01000, 0xc4b66ae4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "amidar.5d", 0x01000, 0x806785af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "amidar.5f", 0x00800, 0x5e51e84d, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "amidar.5h", 0x00800, 0x2f7f1c30, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Amidar1) +STD_ROM_FN(Amidar1) + +static struct BurnRomInfo AmidaruRomDesc[] = { + { "amidarus.2c", 0x01000, 0x951e0792, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "amidarus.2e", 0x01000, 0xa1a3a136, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "amidarus.2f", 0x01000, 0xa5121bf5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "amidarus.2h", 0x01000, 0x051d1c7f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "amidarus.2j", 0x01000, 0x351f00d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "amidarus.5c", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "amidarus.5d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "amidarus.5f", 0x00800, 0x2cfe5ede, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "amidarus.5h", 0x00800, 0x57c4fd0d, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Amidaru) +STD_ROM_FN(Amidaru) + +static struct BurnRomInfo AmidaroRomDesc[] = { + { "107.2cd", 0x01000, 0xc52536be, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "108.2fg", 0x01000, 0x38538b98, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "109.2fg", 0x01000, 0x69907f0f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "110.2h", 0x01000, 0xba149a93, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "111.2j", 0x01000, 0x20d01c2e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "amidarus.5c", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "amidarus.5d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "amidarus.5f", 0x00800, 0x2cfe5ede, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "113.5h", 0x00800, 0xbcdce168, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Amidaro) +STD_ROM_FN(Amidaro) + +static struct BurnRomInfo AmidarbRomDesc[] = { + { "ami2gor.2c", 0x01000, 0x9ad2dcd2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2.2f", 0x01000, 0x66282ff5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3.2j", 0x01000, 0xb0860e31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4.2m", 0x01000, 0x4a4086c9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "8.11d", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "9.9d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5.5f", 0x00800, 0x2082ad0a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "6.5h", 0x00800, 0x3029f94f, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "n82s123n.6e", 0x00020, 0x01004d3f, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Amidarb) +STD_ROM_FN(Amidarb) + +static struct BurnRomInfo AmigoRomDesc[] = { + { "2732.a1", 0x01000, 0x930dc856, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2732.a2", 0x01000, 0x66282ff5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2732.a3", 0x01000, 0xe9d3dc76, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2732.a4", 0x01000, 0x4a4086c9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "amidarus.5c", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "amidarus.5d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "2716.a6", 0x00800, 0x2082ad0a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "2716.a5", 0x00800, 0x3029f94f, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Amigo) +STD_ROM_FN(Amigo) + +static struct BurnRomInfo AmidarsRomDesc[] = { + { "am2d", 0x00800, 0x24b79547, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "am2e", 0x00800, 0x4c64161e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "am2f", 0x00800, 0xb3987a72, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "am2h", 0x00800, 0x29873461, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "am2j", 0x00800, 0x0fdd54d8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "am2l", 0x00800, 0x5382f7ed, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "am2m", 0x00800, 0x1d7109e9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "am2p", 0x00800, 0xc9163ac6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "amidarus.5c", 0x01000, 0x8ca7b750, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "amidarus.5d", 0x01000, 0x9b5bdc0a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "2716.a6", 0x00800, 0x2082ad0a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "2716.a5", 0x00800, 0x3029f94f, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "amidar.clr", 0x00020, 0xf940dcc3, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Amidars) +STD_ROM_FN(Amidars) + +UINT8 __fastcall TurpinsZ80Read(UINT16 a) +{ + switch (a) { + case 0xa000: { + return 0xff - GalInput[0] - GalDip[0]; + } + + case 0xa001: { + return 0xff - GalInput[1] - GalDip[1]; + } + + case 0xa002: { + return 0xff - GalInput[2] - GalDip[2]; + } + + case 0xb800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall TurpinsZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa000: { + GalBackgroundRed = d & 1; + return; + } + + case 0xa020: { + GalBackgroundGreen = d & 1; + return; + } + + case 0xa028: { + GalBackgroundBlue = d & 1; + return; + } + + + case 0xa030: { + // coin_count_0_w + return; + } + + case 0xa038: { + // coin_count_1_w + return; + } + + + case 0xa801: { + GalIrqFire = d & 1; + return; + } + + case 0xa806: { + GalFlipScreenX = d & 1; + return; + } + + case 0xa807: { + GalFlipScreenY = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 TurtlesInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapTurtles; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = TurtlesDrawBackground; + GalDrawBulletsFunction = NULL; + + KonamiPPIInit(); + + return nRet; +} + +static void TurpinsPostLoad() +{ + MapTurtles(); + + ZetOpen(0); + ZetSetReadHandler(TurpinsZ80Read); + ZetSetWriteHandler(TurpinsZ80Write); + ZetClose(); +} + +static INT32 TurpinsInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = TurpinsPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = TurtlesDrawBackground; + GalDrawBulletsFunction = NULL; + + return nRet; +} + +struct BurnDriver BurnDrvTurtles = { + "turtles", NULL, NULL, NULL, "1981", + "Turtles\0", NULL, "Konami (Stern license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, TurtlesRomInfo, TurtlesRomName, NULL, NULL, TurtlesInputInfo, TurtlesDIPInfo, + TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTurpin = { + "turpin", "turtles", NULL, NULL, "1981", + "Turpin\0", NULL, "Konami (Sega license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, TurpinRomInfo, TurpinRomName, NULL, NULL, TurtlesInputInfo, TurpinDIPInfo, + TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSixhundred = { + "600", "turtles", NULL, NULL, "1981", + "600\0", NULL, "Konami", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, SixhundredRomInfo, SixhundredRomName, NULL, NULL, TurtlesInputInfo, TurtlesDIPInfo, + TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTurpins = { + "turpins", "turtles", NULL, NULL, "1981", + "Turpin (bootleg on Scramble hardware)\0", "No Sound", "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, TurpinsRomInfo, TurpinsRomName, NULL, NULL, TurtlesInputInfo, TurtlesDIPInfo, + TurpinsInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAmidar = { + "amidar", NULL, NULL, NULL, "1981", + "Amidar\0", NULL, "Konami", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, AmidarRomInfo, AmidarRomName, NULL, NULL, AmidarInputInfo, AmidaruDIPInfo, + TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAmidar1 = { + "amidar1", "amidar", NULL, NULL, "1981", + "Amidar (older)\0", NULL, "Konami", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, Amidar1RomInfo, Amidar1RomName, NULL, NULL, AmidarInputInfo, AmidarDIPInfo, + TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAmidaru = { + "amidaru", "amidar", NULL, NULL, "1982", + "Amidar (Stern)\0", NULL, "Konami (Stern license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, AmidaruRomInfo, AmidaruRomName, NULL, NULL, AmidarInputInfo, AmidaruDIPInfo, + TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAmidaro = { + "amidaro", "amidar", NULL, NULL, "1982", + "Amidar (Olympia)\0", NULL, "Konami (Olympia license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, AmidaroRomInfo, AmidaroRomName, NULL, NULL, AmidarInputInfo, AmidaroDIPInfo, + TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAmidarb = { + "amidarb", "amidar", NULL, NULL, "1982", + "Amidar (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, AmidarbRomInfo, AmidarbRomName, NULL, NULL, AmidarInputInfo, AmidaruDIPInfo, + TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAmigo = { + "amigo", "amidar", NULL, NULL, "1982", + "Amigo\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, AmigoRomInfo, AmigoRomName, NULL, NULL, AmidarInputInfo, AmidaruDIPInfo, + TurtlesInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAmidars = { + "amidars", "amidar", NULL, NULL, "1982", + "Amidar (Scramble hardware)\0", NULL, "Konami", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, AmidarsRomInfo, AmidarsRomName, NULL, NULL, AmidarInputInfo, AmidarsDIPInfo, + ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// The End / Scramble based hardware +static struct BurnRomInfo TheendRomDesc[] = { + { "ic13_1t.bin", 0x00800, 0x93e555ba, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic14_2t.bin", 0x00800, 0x2de7ad27, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic15_3t.bin", 0x00800, 0x035f750b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic16_4t.bin", 0x00800, 0x61286b5c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic17_5t.bin", 0x00800, 0x434a8f68, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic18_6t.bin", 0x00800, 0xdc4cc786, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ic56_1.bin", 0x00800, 0x7a141f29, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ic55_2.bin", 0x00800, 0x218497c1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "ic30_2c.bin", 0x00800, 0x68ccf7bf, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ic31_1c.bin", 0x00800, 0x4a48c999, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6331-1j.86", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Theend) +STD_ROM_FN(Theend) + +static struct BurnRomInfo TheendsRomDesc[] = { + { "ic13", 0x00800, 0x90e5ab14, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic14", 0x00800, 0x950f0a07, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic15", 0x00800, 0x6786bcf5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic16", 0x00800, 0x380a0017, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic17", 0x00800, 0xaf067b7f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic18", 0x00800, 0xa0411b93, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ic56", 0x00800, 0x3b2c2f70, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ic55", 0x00800, 0xe0429e50, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "ic30", 0x00800, 0x527fd384, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ic31", 0x00800, 0xaf6d09b6, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6331-1j.86", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Theends) +STD_ROM_FN(Theends) + +static struct BurnRomInfo ScrambleRomDesc[] = { + { "s1.2d", 0x00800, 0xea35ccaa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "s2.2e", 0x00800, 0xe7bba1b3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "s3.2f", 0x00800, 0x12d7fc3e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "s4.2h", 0x00800, 0xb59360eb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "s5.2j", 0x00800, 0x4919a91c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "s6.2l", 0x00800, 0x26a4547b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "s7.2m", 0x00800, 0x0bb49470, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "s8.2p", 0x00800, 0x6a5740e5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "c2.5f", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "c1.5h", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Scramble) +STD_ROM_FN(Scramble) + +static struct BurnRomInfo ScramblesRomDesc[] = { + { "2d", 0x00800, 0xb89207a1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e", 0x00800, 0xe9b4b9eb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2f", 0x00800, 0xa1f14f4c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h", 0x00800, 0x591bc0d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j", 0x00800, 0x22f11b6b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2l", 0x00800, 0x705ffe49, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2m", 0x00800, 0xea26c35c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2p", 0x00800, 0x94d8f5e3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5f", 0x00800, 0x5f30311a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h", 0x00800, 0x516e029e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Scrambles) +STD_ROM_FN(Scrambles) + +static struct BurnRomInfo ScramblebfRomDesc[] = { + { "scf1.2d", 0x00800, 0xb126aa1f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scf2.2e", 0x00800, 0xce25fb77, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scns3.2f", 0x00800, 0xeec265ee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scns4.2h", 0x00800, 0xdd380a22, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scns5.2j", 0x00800, 0x92980e72, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scns6.2l", 0x00800, 0x9fd96374, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scns7.2m", 0x00800, 0x88ac07a0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scns8.2p", 0x00800, 0x75232e09, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ot1ns.5c", 0x00800, 0xbe037cf6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "c2.5f", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "c1.5h", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Scramblebf) +STD_ROM_FN(Scramblebf) + +static struct BurnRomInfo ScramblebbRomDesc[] = { + { "1", 0x00800, 0x8ba174c4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2", 0x00800, 0x43cb40a4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3", 0x00800, 0xeec265ee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4", 0x00800, 0xdd380a22, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5", 0x00800, 0x92980e72, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6", 0x00800, 0x9fd96374, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7", 0x00800, 0x88ac07a0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8", 0x00800, 0x75232e09, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "9", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "10", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Scramblebb) +STD_ROM_FN(Scramblebb) + +static struct BurnRomInfo StrfbombRomDesc[] = { + { "1.2c", 0x00800, 0xb102aaa0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2.2e", 0x00800, 0xd4155703, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3.2f", 0x00800, 0xa9568c89, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4.2h", 0x00800, 0x663b6c35, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5.2j", 0x00800, 0x4919a91c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6.2l", 0x00800, 0x4ec66ae3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7.2m", 0x00800, 0x0feb0192, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8.2p", 0x00800, 0x280a6142, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "9.5f", 0x00800, 0x3abeff25, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "10.5h", 0x00800, 0x79ecacbe, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Strfbomb) +STD_ROM_FN(Strfbomb) + +static struct BurnRomInfo ExplorerRomDesc[] = { + { "10l.bin", 0x01000, 0xd5adf626, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "9l.bin", 0x01000, 0x48e32788, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "8l.bin", 0x01000, 0xc0dbdbde, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "7l.bin", 0x01000, 0x9b30d227, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "3f.bin", 0x01000, 0x9faf18cf, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "4b.bin", 0x00800, 0xe910b5c3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "c2.5f", 0x00800, 0x4708845b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "c1.5h", 0x00800, 0x11fd2887, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Explorer) +STD_ROM_FN(Explorer) + +static struct BurnRomInfo AtlantisRomDesc[] = { + { "2c", 0x00800, 0x0e485b9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e", 0x00800, 0xc1640513, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2f", 0x00800, 0xeec265ee, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h", 0x00800, 0xa5d2e442, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j", 0x00800, 0x45f7cf34, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2l", 0x00800, 0xf335b96b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5f", 0x00800, 0x57f9c6b9, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h", 0x00800, 0xe989f325, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Atlantis) +STD_ROM_FN(Atlantis) + +static struct BurnRomInfo Atlantis2RomDesc[] = { + { "rom1", 0x00800, 0xad348089, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom2", 0x00800, 0xcaa705d1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom3", 0x00800, 0xe420641d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom4", 0x00800, 0x04792d90, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j", 0x00800, 0x45f7cf34, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom6", 0x00800, 0xb297bd4b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom7", 0x00800, 0xa50bf8d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rom8", 0x00800, 0xd2c5c984, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ot1.5c", 0x00800, 0xbcd297f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot2.5d", 0x00800, 0xde7912da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ot3.5e", 0x00800, 0xba2fa933, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "rom9", 0x00800, 0x55cd5acd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom10", 0x00800, 0x72e773b8, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Atlantis2) +STD_ROM_FN(Atlantis2) + +static struct BurnRomInfo CkongsRomDesc[] = { + { "vid_2c.bin", 0x01000, 0x49a8c234, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_2e.bin", 0x01000, 0xf1b667f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_2f.bin", 0x01000, 0xb194b75d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_2h.bin", 0x01000, 0x2052ba8a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_2j.bin", 0x01000, 0xb377afd0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_2l.bin", 0x01000, 0xfe65e691, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "turt_snd.5c", 0x01000, 0xf0c30f9a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "snd_5d.bin", 0x01000, 0x892c9547, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "vid_5f.bin", 0x01000, 0x7866d2cb, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "vid_5h.bin", 0x01000, 0x7311a101, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "vid_6e.bin", 0x00020, 0x5039af97, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Ckongs) +STD_ROM_FN(Ckongs) + +static struct BurnRomInfo MarsRomDesc[] = { + { "u26.3", 0x00800, 0x2f88892c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u56.4", 0x00800, 0x9e6bcbf7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u69.5", 0x00800, 0xdf496e6e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u98.6", 0x00800, 0x75f274bb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u114.7", 0x00800, 0x497fd8d0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u133.8", 0x00800, 0x3d4cd59f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "u39.9", 0x00800, 0xbb5968b9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "u51.10", 0x00800, 0x75fd7720, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "u78.11", 0x00800, 0x72a492da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "u72.1", 0x00800, 0x279789d0, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "u101.2", 0x00800, 0xc5dc627f, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mars) +STD_ROM_FN(Mars) + +static struct BurnRomInfo DevilfshRomDesc[] = { + { "u26.1", 0x00800, 0xec047d71, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u56.2", 0x00800, 0x0138ade9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u69.3", 0x00800, 0x5dd0b3fc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u98.4", 0x00800, 0xded0b745, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u114.5", 0x00800, 0x5fd40176, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u133.6", 0x00800, 0x03538336, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u143.7", 0x00800, 0x64676081, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "u163.8", 0x00800, 0xbc3d6770, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "u39.9", 0x00800, 0x09987e2e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "u51.10", 0x00800, 0x1e2b1471, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "u78.11", 0x00800, 0x45279aaa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "u72.12", 0x01000, 0x5406508e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "u101.13", 0x01000, 0x8c4018b6, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Devilfsh) +STD_ROM_FN(Devilfsh) + +static struct BurnRomInfo Newsin7RomDesc[] = { + { "newsin.1", 0x01000, 0xe6c23fe0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "newsin.2", 0x01000, 0x3d477b5f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "newsin.3", 0x01000, 0x7dfa9af0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "newsin.4", 0x01000, 0xd1b0ba19, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "newsin.5", 0x01000, 0x06275d59, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "newsin.13", 0x00800, 0xd88489a2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "newsin.12", 0x00800, 0xb154a7af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "newsin.11", 0x00800, 0x7ade709b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "newsin.9", 0x01000, 0x6b87adff, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "newsin.8", 0x01000, 0x0c5b895a, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "newsin.7", 0x01000, 0x6bc5d64f, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "newsin.6", 0x00020, 0x5cf2cd8d, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Newsin7) +STD_ROM_FN(Newsin7) + +static struct BurnRomInfo MrkougarRomDesc[] = { + { "2732-7.bin", 0x01000, 0xfd060ffb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2732-6.bin", 0x01000, 0x9e05d868, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2732-5.bin", 0x01000, 0xcbc7c536, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "atw-6w-2.bin", 0x01000, 0xaf42a371, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "atw-6y-3.bin", 0x01000, 0x862b8902, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "atw-6z-4.bin", 0x01000, 0xa0396cc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "2732-1.bin", 0x01000, 0x60ef1d43, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mrkougar) +STD_ROM_FN(Mrkougar) + +static struct BurnRomInfo Mrkougar2RomDesc[] = { + { "atw-7l-7.bin", 0x01000, 0x7b34b198, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "atw-7k-6.bin", 0x01000, 0xfbca23c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "atw-7h-5.bin", 0x01000, 0x05b257a2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "atw-6w-2.bin", 0x01000, 0xaf42a371, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "atw-6y-3.bin", 0x01000, 0x862b8902, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "atw-6z-4.bin", 0x01000, 0xa0396cc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "atw-1h-1.bin", 0x01000, 0x38fdfb63, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "atw-prom.bin", 0x00020, 0xc65db188, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mrkougar2) +STD_ROM_FN(Mrkougar2) + +static struct BurnRomInfo MrkougbRomDesc[] = { + { "p01.bin", 0x00800, 0xdea0cde1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p02.bin", 0x00800, 0xc8017751, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p03.bin", 0x00800, 0xb8921984, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p04.bin", 0x00800, 0xb3c9754c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p05.bin", 0x00800, 0x8d94adbc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p06.bin", 0x00800, 0xacc921ff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "atw-6w-2.bin", 0x01000, 0xaf42a371, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "atw-6y-3.bin", 0x01000, 0x862b8902, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "atw-6z-4.bin", 0x01000, 0xa0396cc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "g07.bin", 0x00800, 0x0ecfd116, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g08.bin", 0x00800, 0x00bfa3c6, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "atw-prom.bin", 0x00020, 0xc65db188, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mrkougb) +STD_ROM_FN(Mrkougb) + +static struct BurnRomInfo Mrkougb2RomDesc[] = { + { "mrk1.bin", 0x00800, 0xfc93acb9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p02.bin", 0x00800, 0xc8017751, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p03.bin", 0x00800, 0xb8921984, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p04.bin", 0x00800, 0xb3c9754c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p05.bin", 0x00800, 0x8d94adbc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p06.bin", 0x00800, 0xacc921ff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "atw-6w-2.bin", 0x01000, 0xaf42a371, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "atw-6y-3.bin", 0x01000, 0x862b8902, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "atw-6z-4.bin", 0x01000, 0xa0396cc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "g07.bin", 0x00800, 0x0ecfd116, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "g08.bin", 0x00800, 0x00bfa3c6, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "atw-prom.bin", 0x00020, 0xc65db188, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mrkougb2) +STD_ROM_FN(Mrkougb2) + +static struct BurnRomInfo HotshockRomDesc[] = { + { "0d.l10", 0x01000, 0x3e8aeaeb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "1d.l9", 0x01000, 0x0eab3246, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2d.l8", 0x01000, 0xe646bde3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3d.l7", 0x01000, 0x5bde9312, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "6d.b3", 0x01000, 0xc5e02651, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "7d.b4", 0x01000, 0x49dc113d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "4d.h3", 0x01000, 0x751c850e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5d.h5", 0x01000, 0xfc74282e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "18s030.1k", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Hotshock) +STD_ROM_FN(Hotshock) + +static struct BurnRomInfo HotshockbRomDesc[] = { + { "hotshock.l10", 0x01000, 0x401078f7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "hotshock.l9", 0x01000, 0xaf76c237, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "hotshock.l8", 0x01000, 0x30486031, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "hotshock.l7", 0x01000, 0x5bde9312, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "hotshock.b3", 0x01000, 0x0092f0e2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "hotshock.b4", 0x01000, 0xc2135a44, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "hotshock.h4", 0x01000, 0x60bdaea9, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "hotshock.h5", 0x01000, 0x4ef17453, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Hotshockb) +STD_ROM_FN(Hotshockb) + +static struct BurnRomInfo ConquerRomDesc[] = { + { "conquer3.l10", 0x01000, 0xa33a824f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "conquer2.l9", 0x01000, 0x3ffa8285, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "conquer1.l8", 0x01000, 0x9ded2dff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "conquer6.b3", 0x01000, 0xd363b2ea, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "conquer7.b4", 0x01000, 0xe6a63d71, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "conquer4.h3", 0x01000, 0xac533893, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "conquer5.h5", 0x01000, 0xd884fd49, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Conquer) +STD_ROM_FN(Conquer) + +static struct BurnRomInfo CavelonRomDesc[] = { + { "2.bin", 0x02000, 0xa3b353ac, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "1.bin", 0x02000, 0x3f62efd6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3.bin", 0x02000, 0x39d74e4e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "1c_snd.bin", 0x00800, 0xf58dcf55, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "h.bin", 0x01000, 0xd44fcd6f, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k.bin", 0x01000, 0x59bc7f9e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "cavelon.clr", 0x00020, 0xd133356b, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Cavelon) +STD_ROM_FN(Cavelon) + +static struct BurnRomInfo MimonscrRomDesc[] = { + { "mm1", 0x01000, 0x0399a0c4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm2", 0x01000, 0x2c5e971e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm3", 0x01000, 0x24ce1ce3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm4", 0x01000, 0xc83fb639, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm5", 0x01000, 0xa9f12dfc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm6", 0x01000, 0xe492a40c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm7", 0x01000, 0x5339928d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm8", 0x01000, 0xeee7a12e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mmsound1", 0x01000, 0x2d14c527, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "mmsnd2a", 0x01000, 0x35ed0f96, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "mmgfx1", 0x02000, 0x4af47337, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mmgfx2", 0x02000, 0xdef47da8, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "c01s.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mimonscr) +STD_ROM_FN(Mimonscr) + +UINT8 __fastcall ExplorerZ80Read(UINT16 a) +{ + switch (a) { + case 0x7000: { + // watchdog read + return 0xff; + } + + case 0x8000: { + return GalInput[0] | GalDip[0]; + } + + case 0x8001: { + return GalInput[1] | GalDip[1]; + } + + case 0x8002: { + return GalInput[2] | GalDip[2]; + } + + case 0x8003: { + return GalInput[3] | GalDip[3]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall ExplorerZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0x5100 && a <= 0x51ff) { + INT32 Offset = a - 0x5100; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6801: { + GalIrqFire = d & 1; + return; + } + + case 0x6802: { + // coin_count_0_w + return; + } + + case 0x6803: { + GalBackgroundEnable = d & 1; + return; + } + + case 0x6804: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x6806: { + GalFlipScreenX = d & 1; + return; + } + + case 0x6807: { + GalFlipScreenY = d & 1; + return; + } + + case 0x7000: { + // watchdog write + return; + } + + case 0x8000: { + GalSoundLatch = d; + return; + } + + case 0x9000: { + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(0); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall CkongsZ80Read(UINT16 a) +{ + switch (a) { + case 0x7000: + case 0x7001: + case 0x7002: + case 0x7003: { + return ppi8255_r(0, a - 0x7000); + } + + case 0x7800: + case 0x7801: + case 0x7802: + case 0x7803: { + return ppi8255_r(1, a - 0x7800); + } + + case 0xb000: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall CkongsZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x7000: + case 0x7001: + case 0x7002: + case 0x7003: { + ppi8255_w(0, a - 0x7000, d); + return; + } + + case 0x7800: + case 0x7801: + case 0x7802: + case 0x7803: { + ppi8255_w(1, a - 0x7800, d); + return; + } + + case 0xa801: { + GalIrqFire = d & 1; + return; + } + + case 0xa806: { + GalFlipScreenX = d & 1; + return; + } + + case 0xa807: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb000: { + // watchdog write + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall MarsZ80Read(UINT16 a) +{ + if (a >= 0x8100 && a <= 0x810f) { + INT32 Offset = a - 0x8100; + return ppi8255_r(0, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01)); + } + + if (a >= 0x8200 && a <= 0x820f) { + INT32 Offset = a - 0x8200; + return ppi8255_r(1, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01)); + } + + switch (a) { + case 0x7000: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall MarsZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0x8100 && a <= 0x810f) { + INT32 Offset = a - 0x8100; + ppi8255_w(0, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); + return; + } + + if (a >= 0x8200 && a <= 0x820f) { + INT32 Offset = a - 0x8200; + ppi8255_w(1, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); + return; + } + + switch (a) { + case 0x6800: { + // coin_count_1_w + return; + } + + case 0x6801: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x6802: { + GalIrqFire = d & 1; + return; + } + + case 0x6808: { + // coin_count_0_w + return; + } + + case 0x6809: { + GalFlipScreenX = d & 1; + return; + } + + case 0x680b: { + GalFlipScreenY = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Newsin7Z80Read(UINT16 a) +{ + if (a >= 0x8200 && a <= 0x820f) { + INT32 Offset = a - 0x8200; + return ppi8255_r(1, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01)); + } + + if (a >= 0xc100 && a <= 0xc10f) { + INT32 Offset = a - 0xc100; + return ppi8255_r(0, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01)); + } + + switch (a) { + case 0x7000: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall Newsin7Z80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0x8200 && a <= 0x820f) { + INT32 Offset = a - 0x8200; + ppi8255_w(1, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); + return; + } + + if (a >= 0xc100 && a <= 0xc10f) { + INT32 Offset = a - 0xc100; + ppi8255_w(0, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); + return; + } + + switch (a) { + case 0x6800: { + // coin_count_1_w + return; + } + + case 0x6801: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x6802: { + GalIrqFire = d & 1; + return; + } + + case 0x6808: { + // coin_count_0_w + return; + } + + case 0x6809: { + GalFlipScreenX = d & 1; + return; + } + + case 0x680b: { + GalFlipScreenY = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall MrkougarZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0x8100 && a <= 0x810f) { + INT32 Offset = a - 0x8100; + ppi8255_w(0, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); + return; + } + + if (a >= 0x8200 && a <= 0x820f) { + INT32 Offset = a - 0x8200; + ppi8255_w(1, ((Offset >> 2) & 0x02) | ((Offset >> 1) & 0x01), d); + return; + } + + switch (a) { + case 0x6800: { + // coin_count_1_w + return; + } + + case 0x6801: { + GalIrqFire = d & 1; + return; + } + + case 0x6808: { + // coin_count_0_w + return; + } + + case 0x6809: { + GalFlipScreenX = d & 1; + return; + } + + case 0x680b: { + GalFlipScreenY = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall HotshockZ80Read(UINT16 a) +{ + switch (a) { + case 0x8000: { + return GalInput[0] | GalDip[0]; + } + + case 0x8001: { + return GalInput[1] | GalDip[1]; + } + + case 0x8002: { + return GalInput[2] | GalDip[2]; + } + + case 0x8003: { + return GalInput[3] | GalDip[3]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall HotshockZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6000: { + // coin_count_2_w + return; + } + + case 0x6002: { + // coin_count_1_w + return; + } + + case 0x6004: { + GalFlipScreenX = d & 1; + GalFlipScreenY = d & 1; + return; + } + + case 0x6005: { + // coin_count_0_w + return; + } + + case 0x6006: { + GalGfxBank[0] = d & 1; + return; + } + + case 0x6801: { + GalIrqFire = d & 1; + return; + } + + case 0x7000: { + // watchdog write + return; + } + + case 0x8000: { + GalSoundLatch = d; + return; + } + + case 0x9000: { + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(0); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall HotshockSoundZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x20: { + return AY8910Read(0); + } + + case 0x40: { + return AY8910Read(1); + } + } + + bprintf(PRINT_NORMAL, _T("Sound Port Read %x\n"), a); + + return 0; +} + +void __fastcall HotshockSoundZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x10: { + AY8910Write(0, 0, d); + return; + } + + case 0x20: { + AY8910Write(0, 1, d); + return; + } + + case 0x40: { + AY8910Write(1, 1, d); + return; + } + + case 0x80: { + AY8910Write(1, 0, d); + return; + } + } + + bprintf(PRINT_NORMAL, _T("Sound Port Write %x, %x\n"), a, d); +} + +static void CavelonDoBankSwitch() +{ + CavelonBankSwitch = !CavelonBankSwitch; + ZetMapArea(0x0000, 0x1fff, 0, GalZ80Rom1 + ((CavelonBankSwitch) ? 0x4000 : 0x0000)); + ZetMapArea(0x0000, 0x1fff, 2, GalZ80Rom1 + ((CavelonBankSwitch) ? 0x4000 : 0x0000)); +} + +UINT8 __fastcall CavelonZ80Read(UINT16 a) +{ + if (a >= 0x8000) { + CavelonDoBankSwitch(); + UINT32 Offset = a - 0x8000; + UINT8 Result = 0xff; + if (Offset & 0x0100) Result &= ppi8255_r(0, Offset & 3); + if (Offset & 0x0200) Result &= ppi8255_r(1, Offset & 3); + return Result; + } + + switch (a) { + case 0x7000: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall CavelonZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0x8000) { + CavelonDoBankSwitch(); + INT32 Offset = a - 0x8000; + if (Offset & 0x0100) ppi8255_w(0, Offset & 3, d); + if (Offset & 0x0200) ppi8255_w(1, Offset & 3, d); + return; + } + + switch (a) { + case 0x2000: + case 0x3800: + case 0x3801: { + // write in rom area + return; + } + + case 0x6801: { + GalIrqFire = d & 1; + return; + } + + case 0x6802: { + // coin_count_0_w + return; + } + + case 0x6803: { + GalBackgroundEnable = d & 1; + return; + } + + case 0x6804: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x6806: { + GalFlipScreenX = d & 1; + return; + } + + case 0x6807: { + GalFlipScreenY = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall MimonscrZ80Read(UINT16 a) +{ + switch (a) { + case 0x7000: { + // watchdog read + return 0xff; + } + + case 0x8100: + case 0x8101: + case 0x8102: + case 0x8103: { + return ppi8255_r(0, a - 0x8100); + } + + case 0x8200: + case 0x8201: + case 0x8202: + case 0x8203: { + return ppi8255_r(1, a - 0x8200); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall MimonscrZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6800: { + GalGfxBank[0] = d & 1; + return; + } + + case 0x6801: { + GalIrqFire = d & 1; + return; + } + + case 0x6802: { + GalGfxBank[1] = d & 1; + return; + } + + case 0x6803: { + // ??? + return; + } + + case 0x6804: { + GalBackgroundEnable = d & 1; + return; + } + + case 0x6805: { + // ??? + return; + } + + case 0x6806: { + GalFlipScreenX = d & 1; + return; + } + + case 0x6807: { + GalFlipScreenY = d & 1; + return; + } + + case 0x8100: + case 0x8101: + case 0x8102: + case 0x8103: { + ppi8255_w(0, a - 0x8100, d); + return; + } + + case 0x8200: + case 0x8201: + case 0x8202: + case 0x8203: { + ppi8255_w(1, a - 0x8200, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 TheendInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapTheend; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = GalaxianDrawBackground; + GalDrawBulletsFunction = TheendDrawBullets; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.02); + filter_rc_set_src_gain(1, 0.02); + filter_rc_set_src_gain(2, 0.02); + filter_rc_set_src_gain(3, 0.02); + filter_rc_set_src_gain(4, 0.02); + filter_rc_set_src_gain(5, 0.02); + + return nRet; +} + +static UINT8 ScramblePPIReadIN2() +{ + UINT8 Val = (ScrambleProtectionResult >> 7) & 1; + + if (Val) { + return 0x5f - GalInput[2] - GalDip[2]; + } else { + return 0xff - GalInput[2] - GalDip[2]; + } +} + +static UINT8 ScrambleProtectionRead() +{ + return ScrambleProtectionResult; +} + +static void ScrambleProtectionWrite(UINT8 d) +{ + ScrambleProtectionState = (ScrambleProtectionState << 4) | (d & 0x0f); + + switch (ScrambleProtectionState & 0xfff) { + case 0xf09: ScrambleProtectionResult = 0xff; return; + case 0xa49: ScrambleProtectionResult = 0xbf; return; + case 0x319: ScrambleProtectionResult = 0x4f; return; + case 0x5c9: ScrambleProtectionResult = 0x6f; return; + + // scrambles + case 0x246: ScrambleProtectionResult ^= 0x80; return; + case 0xb5f: ScrambleProtectionResult = 0x6f; return; + } +} + +static INT32 ScrambleInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapTheend; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + PPI0PortReadC = ScramblePPIReadIN2; + PPI1PortReadC = ScrambleProtectionRead; + PPI1PortWriteC = ScrambleProtectionWrite; + + return nRet; +} + +static void ExplorerPostLoad() +{ + MapTheend(); + + ZetOpen(0); + ZetSetReadHandler(ExplorerZ80Read); + ZetSetWriteHandler(ExplorerZ80Write); + ZetMapArea(0x5100, 0x51ff, 0, GalSpriteRam); + ZetMapArea(0x5100, 0x51ff, 2, GalSpriteRam); + ZetClose(); +} + +static INT32 ExplorerInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = ExplorerPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + return nRet; +} + +static INT32 AtlantisInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapTheend; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.25); + filter_rc_set_src_gain(1, 0.25); + filter_rc_set_src_gain(2, 0.25); + filter_rc_set_src_gain(3, 0.25); + filter_rc_set_src_gain(4, 0.25); + filter_rc_set_src_gain(5, 0.25); + + return nRet; +} + +static void CkongsPostLoad() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(CkongsZ80Read); + ZetSetWriteHandler(CkongsZ80Write); + ZetMapArea(0x0000, 0x5fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x5fff, 2, GalZ80Rom1); + ZetMapArea(0x6000, 0x6fff, 0, GalZ80Ram1); + ZetMapArea(0x6000, 0x6fff, 1, GalZ80Ram1); + ZetMapArea(0x6000, 0x6fff, 2, GalZ80Ram1); + ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); + ZetMapArea(0x9400, 0x97ff, 0, GalVideoRam); + ZetMapArea(0x9400, 0x97ff, 1, GalVideoRam); + ZetMapArea(0x9400, 0x97ff, 2, GalVideoRam); + ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); + ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); + ZetClose(); +} + +static INT32 CkongsInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = CkongsPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + KonamiPPIInit(); + + GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + return nRet; +} + +static void MarsDecrypt() +{ + for (UINT32 i = 0; i < GalZ80Rom1Size; i += 16) { + UINT8 SwapBuffer[16]; + + for (UINT32 j = 0; j < 16; j++) { + INT32 NewOffset = BITSWAP08(j, 7, 6, 5, 4, 2, 0, 3, 1); + SwapBuffer[j] = GalZ80Rom1[i + NewOffset]; + } + memcpy(GalZ80Rom1 + i, SwapBuffer, 16); + } +} + +static void MarsPostLoad() +{ + MarsDecrypt(); + + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(MarsZ80Read); + ZetSetWriteHandler(MarsZ80Write); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); + ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); + ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); + ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); + ZetClose(); +} + +static INT32 MarsInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MarsPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + return nRet; +} + +static INT32 DevilfshInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MarsPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalNumChars = 0x100; + GalNumSprites = 0x40; + CharPlaneOffsets[1] = 0x8000; + SpritePlaneOffsets[1] = 0x8000; + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom + 0x800, GalSprites); + BurnFree(GalTempRom); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.75); + filter_rc_set_src_gain(1, 0.75); + filter_rc_set_src_gain(2, 0.75); + filter_rc_set_src_gain(3, 0.75); + filter_rc_set_src_gain(4, 0.75); + filter_rc_set_src_gain(5, 0.75); + + return nRet; +} + +static void Newsin7PostLoad() +{ + MarsDecrypt(); + + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(Newsin7Z80Read); + ZetSetWriteHandler(Newsin7Z80Write); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); + ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); + ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); + ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); + ZetMapArea(0xa000, 0xafff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0xa000, 0xafff, 2, GalZ80Rom1 + 0x4000); + ZetClose(); +} + +static INT32 Newsin7Init() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = Newsin7PostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalNumChars = 0x100; + GalNumSprites = 0x40; + + INT32 Newsin7PlaneOffsets[3] = {0x10000, 0, 0x8000}; + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x2000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; + GfxDecode(GalNumChars, 3, 8, 8, Newsin7PlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 3, 16, 16, Newsin7PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom + 0x800, GalSprites); + BurnFree(GalTempRom); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalColourDepth = 3; + GalSpriteClipStart = 0; + GalSpriteClipEnd = 246; + + KonamiPPIInit(); + + return nRet; +} + +static void MapMrkougar() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(MarsZ80Read); + ZetSetWriteHandler(MrkougarZ80Write); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); + ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 0, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 1, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 2, GalVideoRam); + ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); + ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); + ZetClose(); +} + +static void MrkougarPostLoad() +{ + MarsDecrypt(); + + MapMrkougar(); +} + +static INT32 MrkougarInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MrkougarPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + INT32 MrkougarPlaneOffsets[2] = {0, 4}; + INT32 MrkougarCharXOffsets[8] = {64, 65, 66, 67, 0, 1, 2, 3}; + INT32 MrkougarCharYOffsets[8] = {0, 8, 16, 24, 32, 40, 48, 56}; + INT32 MrkougarSpriteXOffsets[16] = {64, 65, 66, 67, 0, 1, 2, 3, 192, 193, 194, 195, 128, 129, 130, 131}; + INT32 MrkougarSpriteYOffsets[16] = {0, 8, 16, 24, 32, 40, 48, 56, 256, 264, 272, 280, 288, 296, 304, 312}; + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + GfxDecode(GalNumChars, 2, 8, 8, MrkougarPlaneOffsets, MrkougarCharXOffsets, MrkougarCharYOffsets, 0x80, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, MrkougarPlaneOffsets, MrkougarSpriteXOffsets, MrkougarSpriteYOffsets, 0x200, GalTempRom, GalSprites); + BurnFree(GalTempRom); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + return nRet; +} + +static INT32 MrkougbInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapMrkougar; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + return nRet; +} + +static void HotshockPostLoad() +{ + MapMrkougar(); + + ZetOpen(0); + ZetSetReadHandler(HotshockZ80Read); + ZetSetWriteHandler(HotshockZ80Write); + ZetClose(); + + GalZ80Rom1[0x2ef9] = 0xc9; +} + +static INT32 HotshockInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = HotshockPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + ZetOpen(1); + ZetSetInHandler(HotshockSoundZ80PortRead); + ZetSetOutHandler(HotshockSoundZ80PortWrite); + ZetClose(); + + GalExtendTileInfoFunction = PiscesExtendTileInfo; + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + return nRet; +} + +static void ConquerPostLoad() +{ + MapMrkougar(); + + ZetOpen(0); + ZetSetReadHandler(HotshockZ80Read); + ZetSetWriteHandler(HotshockZ80Write); + ZetClose(); +} + +static INT32 ConquerInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = ConquerPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + ZetOpen(1); + ZetSetInHandler(HotshockSoundZ80PortRead); + ZetSetOutHandler(HotshockSoundZ80PortWrite); + ZetClose(); + + GalExtendTileInfoFunction = PiscesExtendTileInfo; + + return nRet; +} + +static void CavelonPostLoad() +{ + MapTheend(); + + ZetOpen(0); + ZetSetReadHandler(CavelonZ80Read); + ZetSetWriteHandler(CavelonZ80Write); + ZetClose(); +} + +static INT32 CavelonInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = CavelonPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static void MimonscrPostLoad() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(MimonscrZ80Read); + ZetSetWriteHandler(MimonscrZ80Write); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x4000, 0x43ff, 0, GalVideoRam); + ZetMapArea(0x4000, 0x43ff, 1, GalVideoRam); + ZetMapArea(0x4000, 0x43ff, 2, GalVideoRam); + ZetMapArea(0x4400, 0x47ff, 0, GalZ80Ram1); + ZetMapArea(0x4400, 0x47ff, 1, GalZ80Ram1); + ZetMapArea(0x4400, 0x47ff, 2, GalZ80Ram1); + ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); + ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); + ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); + ZetMapArea(0xc000, 0xffff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0xc000, 0xffff, 2, GalZ80Rom1 + 0x4000); + ZetClose(); +} + +static INT32 MimonscrInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MimonscrPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = MimonkeyExtendTileInfo; + GalExtendSpriteInfoFunction = MimonkeyExtendSpriteInfo; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +struct BurnDriver BurnDrvTheend = { + "theend", NULL, NULL, NULL, "1980", + "The End\0", NULL, "Konami", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, TheendRomInfo, TheendRomName, NULL, NULL, TheendInputInfo, TheendDIPInfo, + TheendInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTheends = { + "theends", "theend", NULL, NULL, "1980", + "The End (Stern)\0", NULL, "Konami (Stern license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, TheendsRomInfo, TheendsRomName, NULL, NULL, TheendInputInfo, TheendDIPInfo, + TheendInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScramble = { + "scramble", NULL, NULL, NULL, "1981", + "Scramble\0", NULL, "Konami", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScrambleRomInfo, ScrambleRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, + ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScrambles = { + "scrambles", "scramble", NULL, NULL, "1981", + "Scramble (Stern)\0", NULL, "Konami (Stern license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScramblesRomInfo, ScramblesRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, + ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScramblebf = { + "scramblebf", "scramble", NULL, NULL, "1981", + "Scramble (Karateko, French bootleg)\0", NULL, "Karateko (bootleg)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScramblebfRomInfo, ScramblebfRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, + ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScramblebb = { + "scramblebb", "scramble", NULL, NULL, "1981", + "Scramble (bootleg?)\0", NULL, "bootleg?", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScramblebbRomInfo, ScramblebbRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, + ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvStrfbomb = { + "strfbomb", "scramble", NULL, NULL, "1981", + "Strafe Bomb\0", NULL, "Omni", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, StrfbombRomInfo, StrfbombRomName, NULL, NULL, ScrambleInputInfo, StrfbombDIPInfo, + ScrambleInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvExplorer = { + "explorer", "scramble", NULL, NULL, "1981", + "Explorer\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ExplorerRomInfo, ExplorerRomName, NULL, NULL, ExplorerInputInfo, ExplorerDIPInfo, + ExplorerInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAtlantis = { + "atlantis", NULL, NULL, NULL, "1981", + "Battle of Atlantis (set 1)\0", NULL, "Comsoft", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, AtlantisRomInfo, AtlantisRomName, NULL, NULL, AtlantisInputInfo, AtlantisDIPInfo, + AtlantisInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAtlantis2 = { + "atlantis2", "atlantis", NULL, NULL, "1981", + "Battle of Atlantis (set 2)\0", NULL, "Comsoft", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, Atlantis2RomInfo, Atlantis2RomName, NULL, NULL, AtlantisInputInfo, AtlantisDIPInfo, + AtlantisInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvCkongs = { + "ckongs", "ckong", NULL, NULL, "1981", + "Crazy Kong (Scramble hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, CkongsRomInfo, CkongsRomName, NULL, NULL, CkongsInputInfo, CkongsDIPInfo, + CkongsInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMars = { + "mars", NULL, NULL, NULL, "1981", + "Mars\0", NULL, "Artic", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, MarsRomInfo, MarsRomName, NULL, NULL, MarsInputInfo, MarsDIPInfo, + MarsInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvDevilfsh = { + "devilfsh", NULL, NULL, NULL, "1982", + "Devil Fish\0", NULL, "Artic", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, DevilfshRomInfo, DevilfshRomName, NULL, NULL, DevilfshInputInfo, DevilfshDIPInfo, + DevilfshInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNewsin7 = { + "newsin7", NULL, NULL, NULL, "1983", + "New Sinbad 7\0", NULL, "ATW USA, Inc.", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, Newsin7RomInfo, Newsin7RomName, NULL, NULL, DevilfshInputInfo, Newsin7DIPInfo, + Newsin7Init, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMrkougar = { + "mrkougar", NULL, NULL, NULL, "1984", + "Mr. Kougar\0", NULL, "ATW", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, MrkougarRomInfo, MrkougarRomName, NULL, NULL, MrkougarInputInfo, MrkougarDIPInfo, + MrkougarInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMrkougar2 = { + "mrkougar2", "mrkougar", NULL, NULL, "1983", + "Mr. Kougar (earlier)\0", NULL, "ATW", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, Mrkougar2RomInfo, Mrkougar2RomName, NULL, NULL, MrkougarInputInfo, MrkougarDIPInfo, + MrkougarInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMrkougb = { + "mrkougb", "mrkougar", NULL, NULL, "1983", + "Mr. Kougar (bootleg set 1)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, MrkougbRomInfo, MrkougbRomName, NULL, NULL, MrkougarInputInfo, MrkougarDIPInfo, + MrkougbInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMrkougb2 = { + "mrkougb2", "mrkougar", NULL, NULL, "1983", + "Mr. Kougar (bootleg set 2)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, Mrkougb2RomInfo, Mrkougb2RomName, NULL, NULL, MrkougarInputInfo, MrkougarDIPInfo, + MrkougbInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHotshock = { + "hotshock", NULL, NULL, NULL, "1982", + "Hot Shocker\0", NULL, "E.G. Felaco (Domino license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, HotshockRomInfo, HotshockRomName, NULL, NULL, HotshockInputInfo, HotshockDIPInfo, + HotshockInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHotshockb = { + "hotshockb", "hotshock", NULL, NULL, "1982", + "Hot Shocker (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, HotshockbRomInfo, HotshockbRomName, NULL, NULL, HotshockInputInfo, HotshockDIPInfo, + HotshockInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriverD BurnDrvConquer = { + "conquer", NULL, NULL, NULL, "1982", + "Conquer\0", "Bad dump", "unknown", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, ConquerRomInfo, ConquerRomName, NULL, NULL, HotshockInputInfo, HotshockDIPInfo, + ConquerInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvCavelon = { + "cavelon", NULL, NULL, NULL, "1983", + "Cavelon\0", NULL, "Jetsoft", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, CavelonRomInfo, CavelonRomName, NULL, NULL, AtlantisInputInfo, CavelonDIPInfo, + CavelonInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMimonscr = { + "mimonscr", "mimonkey", NULL, NULL, "198?", + "Mighty Monkey (bootleg on Scramble hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, MimonscrRomInfo, MimonscrRomName, NULL, NULL, AtlantisInputInfo, MimonkeyDIPInfo, + MimonscrInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Scramble based hardware with one CPU and one AY8910 +static struct BurnRomInfo TriplepRomDesc[] = { + { "triplep.2g", 0x01000, 0xc583a93d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "triplep.2h", 0x01000, 0xc03ddc49, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "triplep.2k", 0x01000, 0xe83ca6b5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "triplep.2l", 0x01000, 0x982cc3b9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "triplep.5f", 0x00800, 0xd51cbd6f, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "triplep.5h", 0x00800, 0xf21c0059, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "tripprom.6e", 0x00020, 0x624f75df, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Triplep) +STD_ROM_FN(Triplep) + +static struct BurnRomInfo KnockoutRomDesc[] = { + { "knockout.2h", 0x01000, 0xeaaa848e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "knockout.2k", 0x01000, 0xbc26d2c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "knockout.2l", 0x01000, 0x02025c10, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "knockout.2m", 0x01000, 0xe9abc42b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "triplep.5f", 0x00800, 0xd51cbd6f, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "triplep.5h", 0x00800, 0xf21c0059, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "tripprom.6e", 0x00020, 0x624f75df, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Knockout) +STD_ROM_FN(Knockout) + +static struct BurnRomInfo MarinerRomDesc[] = { + { "tp1.2h", 0x01000, 0xdac1dfd0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tm2.2k", 0x01000, 0xefe7ca28, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tm3.2l", 0x01000, 0x027881a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tm4.2m", 0x01000, 0xa0fde7dc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tm5.2p", 0x01000, 0xd7ebcb8e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "tm8.5f", 0x01000, 0x70ae611f, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "tm9.5h", 0x01000, 0x8e4e999e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "t4.6e", 0x00020, 0xca42b6dd, BRF_GRA | GAL_ROM_PROM }, + { "t6.6p", 0x00100, 0xad208ccc, BRF_GRA | GAL_ROM_PROM }, // Background colour + { "t5.7p", 0x00020, 0x1bd88cff, BRF_GRA | GAL_ROM_PROM }, // Char banking and star placement +}; + +STD_ROM_PICK(Mariner) +STD_ROM_FN(Mariner) + +static struct BurnRomInfo EighthundredfathRomDesc[] = { + { "tu1.2h", 0x01000, 0x5dd3d42f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tm2.2k", 0x01000, 0xefe7ca28, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tm3.2l", 0x01000, 0x027881a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tm4.2m", 0x01000, 0xa0fde7dc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "tu5.2p", 0x01000, 0xf864a8a6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "tm8.5f", 0x01000, 0x70ae611f, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "tm9.5h", 0x01000, 0x8e4e999e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "t4.6e", 0x00020, 0xca42b6dd, BRF_GRA | GAL_ROM_PROM }, + { "t6.6p", 0x00100, 0xad208ccc, BRF_GRA | GAL_ROM_PROM }, // Background colour + { "t5.7p", 0x00020, 0x1bd88cff, BRF_GRA | GAL_ROM_PROM }, // Char banking and star placement +}; + +STD_ROM_PICK(Eighthundredfath) +STD_ROM_FN(Eighthundredfath) + +UINT8 __fastcall TriplepZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + // ??? + return 0; + } + + case 0x01: { + return AY8910Read(0); + } + + case 0x02: { + if (ZetPc(-1) == 0x015a) return 0xff; + if (ZetPc(-1) == 0x0886) return 0x05; + return 0; + } + + case 0x03: { + if (ZetPc(-1) == 0x015d) return 0x04; + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall TriplepZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + AY8910Write(0, 1, d); + return; + } + + case 0x01: { + AY8910Write(0, 0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall MarinerZ80Read(UINT16 a) +{ + if (a >= 0x8000) { + if (a == 0xb401) return 0x07; + if (a == 0x9008) return 0x03; + + UINT32 Offset = a - 0x8000; + UINT8 Result = 0xff; + if (Offset & 0x0100) Result &= ppi8255_r(0, Offset & 3); + if (Offset & 0x0200) Result &= ppi8255_r(1, Offset & 3); + return Result; + } + + switch (a) { + case 0x7000: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +static void TriplepPostLoad() +{ + MapTheend(); + + ZetOpen(0); + ZetSetInHandler(TriplepZ80PortRead); + ZetSetOutHandler(TriplepZ80PortWrite); + ZetClose(); +} + +static INT32 TriplepInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = TriplepPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910; + + nRet = GalInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + PPI1PortWriteA = NULL; + PPI1PortWriteB = NULL; + + return nRet; +} + +static void MarinerPostLoad() +{ + GalTempRom = (UINT8*)BurnMalloc(0x1000); + memcpy(GalTempRom, GalZ80Rom1 + 0x4000, 0x1000); + memcpy(GalZ80Rom1 + 0x4800, GalTempRom + 0x0000, 0x800); + memcpy(GalZ80Rom1 + 0x4000, GalTempRom + 0x0800, 0x800); + BurnFree(GalTempRom); + + MapTheend(); + + ZetOpen(0); + ZetSetReadHandler(MarinerZ80Read); + ZetSetInHandler(TriplepZ80PortRead); + ZetSetOutHandler(TriplepZ80PortWrite); + ZetMapArea(0x5800, 0x67ff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0x5800, 0x67ff, 2, GalZ80Rom1 + 0x4000); + ZetClose(); +} + +static INT32 MarinerInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MarinerPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910; + + nRet = GalInit(); + + GalCalcPaletteFunction = MarinerCalcPalette; + GalRenderBackgroundFunction = MarinerDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = MarinerExtendTileInfo; + + KonamiPPIInit(); + PPI1PortWriteA = NULL; + PPI1PortWriteB = NULL; + + return nRet; +} + +struct BurnDriver BurnDrvTriplep = { + "triplep", NULL, NULL, NULL, "1982", + "Triple Punch\0", NULL, "KKI", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, TriplepRomInfo, TriplepRomName, NULL, NULL, AmidarInputInfo, TriplepDIPInfo, + TriplepInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvKnockout = { + "knockout", "triplep", NULL, NULL, "1982", + "Knock Out!!\0", NULL, "KKK", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, KnockoutRomInfo, KnockoutRomName, NULL, NULL, AmidarInputInfo, TriplepDIPInfo, + TriplepInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMariner = { + "mariner", NULL, NULL, NULL, "1981", + "Mariner\0", NULL, "Armenip", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, MarinerRomInfo, MarinerRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, + MarinerInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvEighthundredfath = { + "800fath", "mariner", NULL, NULL, "1981", + "800 Fathoms\0", NULL, "Amenip (US Billiards Inc. license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE |BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, EighthundredfathRomInfo, EighthundredfathRomName, NULL, NULL, ScrambleInputInfo, ScrambleDIPInfo, + MarinerInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Scorpion hardware - based on Scramble but with a third AY8910 and a speech chip +static struct BurnRomInfo ScorpionRomDesc[] = { + { "1.2d", 0x01000, 0xba1219b4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2.2f", 0x01000, 0xc3909ab6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "3.2g", 0x01000, 0x43261352, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "4.2h", 0x01000, 0xaba2276a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5.2k", 0x01000, 0x952f78f2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "32_a4.7c", 0x01000, 0x361b8a36, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "32_a5.7d", 0x01000, 0xaddecdd4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "32_f5.5f", 0x01000, 0x1e5da9d6, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "32_h5.5h", 0x01000, 0xa57adb0a, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, + + { "32_a3.6e", 0x01000, 0x279ae6f9, BRF_OPT | BRF_SND }, // Speech samples? + { "32_a2.6d", 0x01000, 0x90352dd4, BRF_OPT | BRF_SND }, + { "32_a1.6c", 0x01000, 0x3bf2452d, BRF_OPT | BRF_SND }, +}; + +STD_ROM_PICK(Scorpion) +STD_ROM_FN(Scorpion) + +static struct BurnRomInfo ScorpionaRomDesc[] = { + { "scor_d2.bin", 0x01000, 0xc5b9daeb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scor_e2.bin", 0x01000, 0x82308d05, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scor_g2.bin", 0x01000, 0x756b09cd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scor_h2.bin", 0x01000, 0xa0457b93, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scor_l2.bin", 0x00800, 0x6623da33, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scor_k2.bin", 0x00800, 0x42ec34d8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "32_a4.7c", 0x01000, 0x361b8a36, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "32_a5.7d", 0x01000, 0xaddecdd4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "scor_f5.bin", 0x01000, 0x60180a38, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "32_h5.5h", 0x01000, 0xa57adb0a, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, + + { "scor_a3.bin", 0x01000, 0x04abf178, BRF_OPT | BRF_SND }, // Speech samples? + { "scor_a2.bin", 0x01000, 0x452d6354, BRF_OPT | BRF_SND }, + { "32_a1.6c", 0x01000, 0x3bf2452d, BRF_OPT | BRF_SND }, +}; + +STD_ROM_PICK(Scorpiona) +STD_ROM_FN(Scorpiona) + +static struct BurnRomInfo ScorpionbRomDesc[] = { + { "ic109.2d", 0x01000, 0xf54688c9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic110.2e", 0x01000, 0x91aaaa12, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic111.2g", 0x01000, 0x4c3720da, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic112.2h", 0x01000, 0x53e2a983, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ic113.2k", 0x01000, 0xe4ad299a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "32_a4.7c", 0x01000, 0x361b8a36, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ic13.7d", 0x01000, 0xaddecdd4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "ic72.5f", 0x01000, 0x1e5da9d6, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ic73.5h", 0x01000, 0xa57adb0a, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, + + { "ic25.6e", 0x01000, 0x04abf178, BRF_OPT | BRF_SND }, // Speech samples? + { "ic24.6d", 0x01000, 0x90352dd4, BRF_OPT | BRF_SND }, + { "ic23.6c", 0x01000, 0x3bf2452d, BRF_OPT | BRF_SND }, +}; + +STD_ROM_PICK(Scorpionb) +STD_ROM_FN(Scorpionb) + +static struct BurnRomInfo ScorpionmcRomDesc[] = { + { "p1.bin", 0x00800, 0x58818d88, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p2.bin", 0x00800, 0x8bec5f9f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p3.bin", 0x00800, 0x24b7fdff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p4.bin", 0x00800, 0x9082e2f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p5.bin", 0x00800, 0x20387fc0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p6.bin", 0x00800, 0xf66c48e1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p7.bin", 0x00800, 0x931e34c7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p8.bin", 0x00800, 0xab5ab61d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p9.bin", 0x01000, 0xb551b974, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "p10.bin", 0x00800, 0xa7bd8d20, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "h.bin", 0x01000, 0x1e5da9d6, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "k.bin", 0x01000, 0xa57adb0a, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331.bpr", 0x00020, 0x6a0c7d87, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Scorpionmc) +STD_ROM_FN(Scorpionmc) + +static struct BurnRomInfo AracnisRomDesc[] = { + { "00sc.bin", 0x01000, 0xc7e0d6b9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "01sc.bin", 0x01000, 0x03eb27dc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "02sc.bin", 0x01000, 0xf3d49d4f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "03sc.bin", 0x01000, 0x0e741984, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "05sc.bin", 0x01000, 0xf27ee3e4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "06sc.bin", 0x00800, 0xfdfc2c82, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "08sc.1h", 0x01000, 0x1e5da9d6, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "07sc.1k", 0x01000, 0xa57adb0a, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mmi6331-1.6l", 0x00020, 0x24652bc4, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Aracnis) +STD_ROM_FN(Aracnis) + +UINT8 __fastcall ScorpionmcZ80Read(UINT16 a) +{ + switch (a) { + case 0xa000: { + return GalInput[0] | GalDip[0]; + } + + case 0xa800: { + return GalInput[1] | GalDip[1]; + } + + case 0xb001: { + return GalInput[2] | GalDip[2]; + } + + case 0xb002: { + return GalInput[3] | GalDip[3]; + } + + case 0xb800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall ScorpionmcZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa000: + case 0xa001: + case 0xa002: { + GalGfxBank[a - 0xa000] = d; + return; + } + + case 0xa003: { + // coin_count_0_w + return; + } + + case 0xa004: + case 0xa005: + case 0xa006: + case 0xa007: { + GalaxianLfoFreqWrite(a - 0xa004, d); + return; + } + + case 0xa800: + case 0xa801: + case 0xa802: + case 0xa803: + case 0xa804: + case 0xa805: + case 0xa806: + case 0xa807: { + GalaxianSoundWrite(a - 0xa800, d); + return; + } + + case 0xb001: { + GalIrqFire = d & 1; + return; + } + + case 0xb004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall ScorpionSoundZ80Read(UINT16 a) +{ + switch (a) { + case 0x3000: { + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0xff; +} + +UINT8 __fastcall ScorpionSoundZ80PortRead(UINT16 a) +{ + a &= 0xff; + + UINT8 Result = 0xff; + if (a & 0x08) Result &= AY8910Read(2); + if (a & 0x20) Result &= AY8910Read(0); + if (a & 0x80) Result &= AY8910Read(1); + return Result; +} + +void __fastcall ScorpionSoundZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + if (a & 0x04) AY8910Write(2, 0, d); + if (a & 0x08) AY8910Write(2, 1, d); + if (a & 0x10) AY8910Write(0, 0, d); + if (a & 0x20) AY8910Write(0, 1, d); + if (a & 0x40) AY8910Write(1, 0, d); + if (a & 0x80) AY8910Write(1, 1, d); +} + +static UINT8 ScorpionProtectionRead() +{ + UINT16 ParityBits; + UINT8 Parity = 0; + + for (ParityBits = ScrambleProtectionState & 0xce29; ParityBits != 0; ParityBits >>= 1) { + if (ParityBits & 1) Parity++; + } + + return Parity; +} + +static void ScorpionProtectionWrite(UINT8 d) +{ + if (!(d & 0x20)) ScrambleProtectionState = 0x0000; + if (!(d & 0x10)) ScrambleProtectionState = (ScrambleProtectionState << 1) | (~ScorpionProtectionRead() & 1); +} + +static void ScorpionPostLoad() +{ + GalTempRom = (UINT8*)BurnMalloc(0x1000); + memcpy(GalTempRom, GalZ80Rom1 + 0x4000, 0x1000); + memcpy(GalZ80Rom1 + 0x4800, GalTempRom + 0x0000, 0x800); + memcpy(GalZ80Rom1 + 0x4000, GalTempRom + 0x0800, 0x800); + BurnFree(GalTempRom); + + MapTheend(); + + ZetOpen(0); + ZetMapArea(0x5800, 0x67ff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0x5800, 0x67ff, 2, GalZ80Rom1 + 0x4000); + ZetClose(); +} + +static INT32 ScorpionInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = ScorpionPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + ZetOpen(1); + ZetSetReadHandler(ScorpionSoundZ80Read); + ZetSetInHandler(ScorpionSoundZ80PortRead); + ZetSetOutHandler(ScorpionSoundZ80PortWrite); + ZetClose(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = Batman2ExtendTileInfo; + GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; + + KonamiPPIInit(); + PPI1PortReadC = ScorpionProtectionRead; + PPI1PortWriteC = ScorpionProtectionWrite; + + return nRet; +} + +static void ScorpionmcPostLoad() +{ + MapMooncrst(); + + ZetOpen(0); + ZetSetReadHandler(ScorpionmcZ80Read); + ZetSetWriteHandler(ScorpionmcZ80Write); + ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); + ZetMapArea(0x5000, 0x67ff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0x5000, 0x67ff, 2, GalZ80Rom1 + 0x4000); + ZetMapArea(0x9400, 0x97ff, 0, GalVideoRam); + ZetMapArea(0x9400, 0x97ff, 1, GalVideoRam); + ZetMapArea(0x9400, 0x97ff, 2, GalVideoRam); + ZetClose(); +} + +static INT32 ScorpionmcInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = ScorpionmcPostLoad; + + nRet = GalInit(); + + GalExtendTileInfoFunction = Batman2ExtendTileInfo; + GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; + + return nRet; +} + +struct BurnDriver BurnDrvScorpion = { + "scorpion", NULL, NULL, NULL, "1982", + "Scorpion (set 1)\0", "Incomplete Sound", "Zaccaria", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScorpionRomInfo, ScorpionRomName, NULL, NULL, AtlantisInputInfo, ScorpionDIPInfo, + ScorpionInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScorpiona = { + "scorpiona", "scorpion", NULL, NULL, "1982", + "Scorpion (set 2)\0", "Incomplete Sound", "Zaccaria", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScorpionaRomInfo, ScorpionaRomName, NULL, NULL, AtlantisInputInfo, ScorpionDIPInfo, + ScorpionInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScorpionb = { + "scorpionb", "scorpion", NULL, NULL, "1982", + "Scorpion (set 3)\0", "Incomplete Sound", "Zaccaria", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScorpionbRomInfo, ScorpionbRomName, NULL, NULL, AtlantisInputInfo, ScorpionDIPInfo, + ScorpionInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScorpionmc = { + "scorpionmc", "scorpion", NULL, NULL, "19??", + "Scorpion (Moon Cresta hardware)\0", NULL, "Dorneer", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScorpionmcRomInfo, ScorpionmcRomName, NULL, NULL, ScorpionmcInputInfo, ScorpionmcDIPInfo, + ScorpionmcInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAracnis = { + "aracnis", "scorpion", NULL, NULL, "19??", + "Aracnis (bootleg of Scorpion on Moon Cresta hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, AracnisRomInfo, AracnisRomName, NULL, NULL, AracnisInputInfo, AracnisDIPInfo, + ScorpionmcInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// A.D. 2083 hardware - based on Scramble with TMS5100A for speech +static struct BurnRomInfo Ad2083RomDesc[] = { + { "ad0.10o", 0x02000, 0x4d34325a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ad1.9o", 0x02000, 0x0f37134b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ad2.8o", 0x02000, 0xbcfa655f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ad3.7o", 0x02000, 0x60655225, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ad1s.3d", 0x02000, 0x80f39b0f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ad2s.4d", 0x01000, 0x5177fe2b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "ad4.5k", 0x02000, 0x388cdd21, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ad5.3k", 0x02000, 0xf53f3449, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom-am27s19dc.1m", 0x00020, 0x2759aebd, BRF_GRA | GAL_ROM_PROM }, + + { "ad1v.9a", 0x01000, 0x4cb93fff, BRF_OPT | BRF_SND }, // TMS5110A data + { "ad2v.10a", 0x01000, 0x4b530ea7, BRF_OPT | BRF_SND }, // TMS5110A data + { "prom-sn74s188.8a", 0x00020, 0xc58a4f6a, BRF_OPT | BRF_SND }, // TMS5110A data +}; + +STD_ROM_PICK(Ad2083) +STD_ROM_FN(Ad2083) + +UINT8 __fastcall Ad2083Z80Read(UINT16 a) +{ + switch (a) { + case 0x7000: { + // watchdog read + return 0xff; + } + + case 0x8000: { + return GalInput[0] | GalDip[0]; + } + + case 0x8001: { + return GalInput[1] | GalDip[1]; + } + + case 0x8002: { + return GalInput[2] | GalDip[2]; + } + + case 0x8003: { + return GalInput[3] | GalDip[3]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall Ad2083Z80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6004: { + GalFlipScreenX = d & 1; + GalFlipScreenY = d & 1; + return; + } + + case 0x6800: { + // coin_counter_2_w + return; + } + + case 0x6801: { + GalIrqFire = d & 1; + return; + } + + case 0x6802: { + // coin_counter_0_w + return; + } + + case 0x6803: { + GalBackgroundBlue = d & 1; + return; + } + + case 0x6805: { + // coin_counter_1_w + return; + } + + case 0x6806: { + GalBackgroundRed = d & 1; + return; + } + + case 0x6807: { + GalBackgroundGreen = d & 1; + return; + } + + case 0x8000: { + GalSoundLatch = d; + return; + } + + case 0x9000: { + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(0); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static void Ad2083PostLoad() +{ + UINT8 c; + + for (UINT32 i = 0; i < GalZ80Rom1Size; i++) { + c = GalZ80Rom1[i] ^ 0x35; + c = BITSWAP08(c, 6, 2, 5, 1, 7, 3, 4, 0); + GalZ80Rom1[i] = c; + } + + MapTheend(); + + ZetOpen(0); + ZetSetReadHandler(Ad2083Z80Read); + ZetSetWriteHandler(Ad2083Z80Write); + ZetMapArea(0xa000, 0xdfff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0xa000, 0xdfff, 2, GalZ80Rom1 + 0x4000); + ZetMapArea(0xe800, 0xebff, 0, GalZ80Ram1 + 0x800); + ZetMapArea(0xe800, 0xebff, 1, GalZ80Ram1 + 0x800); + ZetMapArea(0xe800, 0xebff, 2, GalZ80Ram1 + 0x800); + ZetClose(); +} + +static INT32 Ad2083Init() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = Ad2083PostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_AD2083AY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + ZetOpen(1); + ZetSetInHandler(HotshockSoundZ80PortRead); + ZetSetOutHandler(HotshockSoundZ80PortWrite); + ZetClose(); + + GalRenderBackgroundFunction = TurtlesDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = Ad2083ExtendTileInfo; + GalExtendSpriteInfoFunction = Ad2083ExtendSpriteInfo; + + return nRet; +} + +struct BurnDriver BurnDrvAd2083 = { + "ad2083", NULL, NULL, NULL, "1983", + "A.D. 2083\0", "Incomplete Sound", "Midcoin", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, Ad2083RomInfo, Ad2083RomName, NULL, NULL, Ad2083InputInfo, Ad2083DIPInfo, + Ad2083Init, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// SF-X hardware - based on Scramble with extra Z80 and 8255 driving a DAC based sample player +static struct BurnRomInfo SfxRomDesc[] = { + { "sfx_b-0.1j", 0x02000, 0xe5bc6952, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "1.1c", 0x01000, 0x1b3c48e7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "22.1d", 0x01000, 0xed44950d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "23.1e", 0x01000, 0xf44a3ca0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "27.1a", 0x01000, 0xed86839f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "24.1g", 0x01000, 0xe6d7dc74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "5.1h", 0x01000, 0xd1e8d390, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "5.5j", 0x01000, 0x59028fb6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "6.6j", 0x01000, 0x5427670f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "1.1j", 0x01000, 0x2f172c58, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "2.2j", 0x01000, 0xa6ad2f6b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "3.3j", 0x01000, 0xfa1274fa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "4.4j", 0x01000, 0x1cd33f3a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "10.3h", 0x01000, 0xb833a15b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "11.4h", 0x01000, 0xcbd76ec2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + + { "28.5a", 0x01000, 0xd73a8252, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "29.5c", 0x01000, 0x1401ccf2, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6331.9g", 0x00020, 0xca1d9ccd, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Sfx) +STD_ROM_FN(Sfx) + +static struct BurnRomInfo SkelagonRomDesc[] = { + { "31.bin", 0x01000, 0xae6f8647, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "32.bin", 0x01000, 0xa28c5838, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "33.bin", 0x01000, 0x32f7e99c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "37.bin", 0x01000, 0x47f68a31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "24.bin", 0x01000, 0xe6d7dc74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "35.bin", 0x01000, 0x5b2a0158, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "36.bin", 0x01000, 0xf53ead29, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "5.5j", 0x01000, 0x59028fb6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "6.6j", 0x01000, 0x5427670f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "1.1j", 0x01000, 0x2f172c58, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "2.2j", 0x01000, 0xa6ad2f6b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "3.3j", 0x01000, 0xfa1274fa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "4.4j", 0x01000, 0x1cd33f3a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "10.bin", 0x01000, 0x2c719de2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "8.bin", 0x01000, 0x350379dd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + + { "38.bin", 0x01000, 0x2fffa8b1, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "39.bin", 0x01000, 0xa854b5de, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6331.9g", 0x00020, 0xca1d9ccd, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Skelagon) +STD_ROM_FN(Skelagon) + +static struct BurnRomInfo MonsterzRomDesc[] = { + { "b-1e.a1", 0x01000, 0x97886542, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b-2e.c1", 0x01000, 0x184ffcb4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b-3e.d1", 0x01000, 0xb7b10ac7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b-4e.e1", 0x01000, 0xfb02c736, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b-5e.g1", 0x01000, 0xb2788ab9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b-6e.h1", 0x01000, 0x77d7aa8d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "a-1e.k1", 0x01000, 0xb88ba44e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "a-2.k2", 0x01000, 0x8913c94e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "a-3e.k3", 0x01000, 0xa8fa5095, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "a-4.k4", 0x01000, 0x93f81317, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "a-5e.k5", 0x01000, 0xb5bcdb4e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "a-6.k6", 0x01000, 0x24832b2e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "a-7e.k7", 0x01000, 0x20ebea81, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "a-8.k8", 0x01000, 0xb833a15b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + { "a-9.k9", 0x01000, 0xcbd76ec2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG3 }, + + { "b-7e.a5", 0x01000, 0xddd4158d, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "b-8e.c5", 0x01000, 0xb1331b4c, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom.g9", 0x00020, 0xb7ea00d7, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Monsterz) +STD_ROM_FN(Monsterz) + +void __fastcall SfxZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0x8000) { + INT32 Offset = a - 0x8000; + if (Offset & 0x0100) ppi8255_w(0, Offset & 3, d); + if (Offset & 0x0200) ppi8255_w(1, Offset & 3, d); + return; + } + + switch (a) { + case 0x6801: { + GalIrqFire = d & 1; + return; + } + + case 0x6802: { + // coin_count_0_w + return; + } + + case 0x6800: { + GalBackgroundRed = d & 1; + return; + } + + case 0x6803: { + GalBackgroundBlue = d & 1; + return; + } + + case 0x6804: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x6805: { + GalBackgroundGreen = d & 1; + return; + } + + case 0x6806: { + GalFlipScreenX = d & 1; + return; + } + + case 0x6807: { + GalFlipScreenY = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall SfxSampleZ80Read(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #3 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall SfxSampleZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #3 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall SfxSampleZ80PortRead(UINT16 a) +{ + a &= 0xff; + + UINT8 Result = 0xff; + if (a & 0x04) Result &= ppi8255_r(2, a & 3); + return Result; +} + +void __fastcall SfxSampleZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + if (a & 0x04) ppi8255_w(2, a & 3, d); + if (a & 0x10) DACSignedWrite(0, d); +} + +static UINT8 SfxSoundLatch2Read() +{ + return GalSoundLatch2; +} + +static void SfxPostLoad() +{ + MapTheend(); + + ZetOpen(0); + ZetSetWriteHandler(SfxZ80Write); + ZetMapArea(0x7000, 0x7fff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0x7000, 0x7fff, 2, GalZ80Rom1 + 0x4000); + ZetMapArea(0xc000, 0xefff, 0, GalZ80Rom1 + 0x5000); + ZetMapArea(0xc000, 0xefff, 2, GalZ80Rom1 + 0x5000); + ZetClose(); + + GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); + memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); + memcpy(GalZ80Rom1 + 0x0000, GalTempRom + 0x0000, 0x1000); + memcpy(GalZ80Rom1 + 0x7000, GalTempRom + 0x1000, 0x1000); + memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x2000, 0x6000); + BurnFree(GalTempRom); + + ZetOpen(2); + ZetSetReadHandler(SfxSampleZ80Read); + ZetSetWriteHandler(SfxSampleZ80Write); + ZetSetInHandler(SfxSampleZ80PortRead); + ZetSetOutHandler(SfxSampleZ80PortWrite); + ZetMapArea(0x0000, GalZ80Rom3Size - 1, 0, GalZ80Rom3); + ZetMapArea(0x0000, GalZ80Rom3Size - 1, 2, GalZ80Rom3); + ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram3); + ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram3); + ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram3); + ZetClose(); + + nGalCyclesTotal[2] = (14318000 / 8) / 60; +} + +static INT32 SfxInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = SfxPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = UpperExtendTileInfo; + + ppi8255_init(3); + PPI0PortReadA = KonamiPPIReadIN0; + PPI0PortReadB = KonamiPPIReadIN1; + PPI0PortReadC = KonamiPPIReadIN2; + PPI1PortReadC = KonamiPPIReadIN3; + PPI1PortWriteA = KonamiSoundLatchWrite; + PPI1PortWriteB = KonamiSoundControlWrite; + PPI2PortReadA = SfxSoundLatch2Read; + + SfxTilemap = 1; + GalOrientationFlipX = 1; + + return nRet; +} + +static void SkelagonPostLoad() +{ + MapTheend(); + + ZetOpen(0); + ZetSetWriteHandler(SfxZ80Write); + ZetMapArea(0x7000, 0x7fff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0x7000, 0x7fff, 2, GalZ80Rom1 + 0x4000); + ZetMapArea(0xc000, 0xefff, 0, GalZ80Rom1 + 0x5000); + ZetMapArea(0xc000, 0xefff, 2, GalZ80Rom1 + 0x5000); + ZetClose(); + + GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom1Size); + memcpy(GalTempRom, GalZ80Rom1, GalZ80Rom1Size); + memset(GalZ80Rom1, 0xff, 0x1000); + memcpy(GalZ80Rom1 + 0x1000, GalTempRom + 0x0000, 0x7000); + BurnFree(GalTempRom); + + ZetOpen(2); + ZetSetReadHandler(SfxSampleZ80Read); + ZetSetWriteHandler(SfxSampleZ80Write); + ZetSetInHandler(SfxSampleZ80PortRead); + ZetSetOutHandler(SfxSampleZ80PortWrite); + ZetMapArea(0x0000, GalZ80Rom3Size - 1, 0, GalZ80Rom3); + ZetMapArea(0x0000, GalZ80Rom3Size - 1, 2, GalZ80Rom3); + ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram3); + ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram3); + ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram3); + ZetClose(); + + nGalCyclesTotal[2] = (14318000 / 8) / 60; +} + +static INT32 SkelagonInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = SkelagonPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC; + GalZ80Rom1Size = 0x1000; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = UpperExtendTileInfo; + + ppi8255_init(3); + PPI0PortReadA = KonamiPPIReadIN0; + PPI0PortReadB = KonamiPPIReadIN1; + PPI0PortReadC = KonamiPPIReadIN2; + PPI1PortReadC = KonamiPPIReadIN3; + PPI1PortWriteA = KonamiSoundLatchWrite; + PPI1PortWriteB = KonamiSoundControlWrite; + PPI2PortReadA = SfxSoundLatch2Read; + + SfxTilemap = 1; + GalOrientationFlipX = 1; + + return nRet; +} + +static void MonsterzPostLoad() +{ + MapTheend(); + + ZetOpen(0); + ZetSetWriteHandler(SfxZ80Write); + ZetMapArea(0xc000, 0xdfff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0xc000, 0xdfff, 2, GalZ80Rom1 + 0x4000); + ZetClose(); + + ZetOpen(2); + ZetSetReadHandler(SfxSampleZ80Read); + ZetSetWriteHandler(SfxSampleZ80Write); + ZetSetInHandler(SfxSampleZ80PortRead); + ZetSetOutHandler(SfxSampleZ80PortWrite); + ZetMapArea(0x0000, GalZ80Rom3Size - 1, 0, GalZ80Rom3); + ZetMapArea(0x0000, GalZ80Rom3Size - 1, 2, GalZ80Rom3); + ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram3); + ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram3); + ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram3); + ZetClose(); + + GalTempRom = (UINT8*)BurnMalloc(GalZ80Rom3Size); + memcpy(GalTempRom, GalZ80Rom3, GalZ80Rom3Size); + memcpy(GalZ80Rom3 + 0x0000, GalTempRom + 0x0000, 0x3000); + memset(GalZ80Rom3 + 0x3000, 0xff, 0x1000); + memcpy(GalZ80Rom3 + 0x4000, GalTempRom + 0x3000, 0x2000); + BurnFree(GalTempRom); + + nGalCyclesTotal[2] = (14318000 / 8) / 60; +} + +static INT32 MonsterzInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MonsterzPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC; + GalZ80Rom3Size = 0x1000; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = UpperExtendTileInfo; + + ppi8255_init(3); + PPI0PortReadA = KonamiPPIReadIN0; + PPI0PortReadB = KonamiPPIReadIN1; + PPI0PortReadC = KonamiPPIReadIN2; + PPI1PortReadC = KonamiPPIReadIN3; + PPI1PortWriteA = KonamiSoundLatchWrite; + PPI1PortWriteB = KonamiSoundControlWrite; + PPI2PortReadA = SfxSoundLatch2Read; + + SfxTilemap = 1; + GalOrientationFlipX = 1; + + return nRet; +} + +struct BurnDriver BurnDrvSfx = { + "sfx", NULL, NULL, NULL, "1983", + "SF-X\0", "Incomplete Sound", "Nichibutsu", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, SfxRomInfo, SfxRomName, NULL, NULL, SfxInputInfo, SfxDIPInfo, + SfxInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +struct BurnDriverD BurnDrvSkelagon = { + "skelagon", "sfx", NULL, NULL, "1983", + "Skelagon\0", "Bad Dump", "Nichibutsu USA", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_CLONE, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, SkelagonRomInfo, SkelagonRomName, NULL, NULL, SfxInputInfo, SfxDIPInfo, + SkelagonInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +struct BurnDriverD BurnDrvMonsterz = { + "monsterz", NULL, NULL, NULL, "19??", + "Monster Zero\0", "Protected", "Nihon", "Galaxian", + NULL, NULL, NULL, NULL, + 0, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, MonsterzRomInfo, MonsterzRomName, NULL, NULL, SfxInputInfo, SfxDIPInfo, + MonsterzInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +// Super Cobra based hardware +static struct BurnRomInfo ScobraRomDesc[] = { + { "epr1265.2c", 0x01000, 0xa0744b3f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e", 0x01000, 0x8e7245cd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr1267.2f", 0x01000, 0x47a4e6fb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h", 0x01000, 0x7244f21c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr1269.2j", 0x01000, 0xe1f8a801, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2l", 0x01000, 0xd52affde, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "5c", 0x00800, 0xd4346959, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "5d", 0x00800, 0xcc025d95, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "5e", 0x00800, 0x1628c53f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "epr1274.5h", 0x00800, 0x64d113b4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr1273.5f", 0x00800, 0xa96316d3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM },}; + +STD_ROM_PICK(Scobra) +STD_ROM_FN(Scobra) + +static struct BurnRomInfo ScobrasRomDesc[] = { + { "scobra2c.bin", 0x01000, 0xe15ade38, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2e.bin", 0x01000, 0xa270e44d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2f.bin", 0x01000, 0xbdd70346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2h.bin", 0x01000, 0xdca5ec31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2j.bin", 0x01000, 0x0d8f6b6e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2l.bin", 0x01000, 0x6f80f3a9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "epr1275.5c", 0x00800, 0xdeeb0dd3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr1276.5d", 0x00800, 0x872c1a74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr1277.5e", 0x00800, 0xccd7a110, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "epr1274.5h", 0x00800, 0x64d113b4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr1273.5f", 0x00800, 0xa96316d3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Scobras) +STD_ROM_FN(Scobras) + +static struct BurnRomInfo ScobraseRomDesc[] = { + { "epr1265.2c", 0x01000, 0xa0744b3f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr1266.2e", 0x01000, 0x65306279, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr1267.2f", 0x01000, 0x47a4e6fb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr1268.2h", 0x01000, 0x53eecaf2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr1269.2j", 0x01000, 0xe1f8a801, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "epr1270.2l", 0x01000, 0xf7709710, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "epr1275.5c", 0x00800, 0xdeeb0dd3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr1276.5d", 0x00800, 0x872c1a74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr1277.5e", 0x00800, 0xccd7a110, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "epr1274.5h", 0x00800, 0x64d113b4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr1273.5f", 0x00800, 0xa96316d3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "pr1278.6e", 0x00020, 0xfd35c561, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Scobrase) +STD_ROM_FN(Scobrase) + +static struct BurnRomInfo ScobrabRomDesc[] = { + { "vid_2c.bin", 0x00800, 0xaeddf391, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "vid_2e.bin", 0x00800, 0x72b57eb7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2e.bin", 0x01000, 0xa270e44d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2f.bin", 0x01000, 0xbdd70346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2h.bin", 0x01000, 0xdca5ec31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2j.bin", 0x01000, 0x0d8f6b6e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2l.bin", 0x01000, 0x6f80f3a9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "epr1275.5c", 0x00800, 0xdeeb0dd3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr1276.5d", 0x00800, 0x872c1a74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr1277.5e", 0x00800, 0xccd7a110, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "epr1274.5h", 0x00800, 0x64d113b4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr1273.5f", 0x00800, 0xa96316d3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Scobrab) +STD_ROM_FN(Scobrab) + +static struct BurnRomInfo SuprheliRomDesc[] = { + { "1.2c", 0x01000, 0xb25141d8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2e.bin", 0x01000, 0xa270e44d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2f.bin", 0x01000, 0xbdd70346, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2h.bin", 0x01000, 0xdca5ec31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "scobra2j.bin", 0x01000, 0x0d8f6b6e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "6.2l", 0x01000, 0x10a474d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "epr1275.5c", 0x00800, 0xdeeb0dd3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "epr1276.5d", 0x00800, 0x872c1a74, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "9.9d", 0x00800, 0x2b69b8f3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "epr1274.5h", 0x00800, 0x64d113b4, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "epr1273.5f", 0x00800, 0xa96316d3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "k.6e", 0x00020, 0xfd35c561, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Suprheli) +STD_ROM_FN(Suprheli) + +static struct BurnRomInfo LosttombRomDesc[] = { + { "2c", 0x01000, 0xd6176d2c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e", 0x01000, 0xa5f55f4a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2f", 0x01000, 0x0169fa3c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h-easy", 0x01000, 0x054481b6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j", 0x01000, 0x249ee040, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2l", 0x01000, 0xc7d2e608, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2m", 0x01000, 0xbc4bc5b1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "5c", 0x00800, 0xb899be2a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "5d", 0x00800, 0x6907af31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5f", 0x00800, 0x61f137e7, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h", 0x00800, 0x5581de5f, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "ltprom", 0x00020, 0x1108b816, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Losttomb) +STD_ROM_FN(Losttomb) + +static struct BurnRomInfo LosttombhRomDesc[] = { + { "2c", 0x01000, 0xd6176d2c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e", 0x01000, 0xa5f55f4a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2f", 0x01000, 0x0169fa3c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "lthard", 0x01000, 0xe32cbf0e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j", 0x01000, 0x249ee040, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2l", 0x01000, 0xc7d2e608, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2m", 0x01000, 0xbc4bc5b1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "5c", 0x00800, 0xb899be2a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "5d", 0x00800, 0x6907af31, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5f", 0x00800, 0x61f137e7, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h", 0x00800, 0x5581de5f, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "ltprom", 0x00020, 0x1108b816, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Losttombh) +STD_ROM_FN(Losttombh) + +static struct BurnRomInfo ArmorcarRomDesc[] = { + { "cpu.2c", 0x01000, 0x0d7bfdfb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "cpu.2e", 0x01000, 0x76463213, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "cpu.2f", 0x01000, 0x2cc6d5f0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "cpu.2h", 0x01000, 0x61278dbb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "cpu.2j", 0x01000, 0xfb158d8c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "sound.5c", 0x00800, 0x54ee7753, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "sound.5d", 0x00800, 0x5218fec0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "cpu.5f", 0x00800, 0x8a3da4d1, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "cpu.5h", 0x00800, 0x85bdb113, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Armorcar) +STD_ROM_FN(Armorcar) + +static struct BurnRomInfo Armorcar2RomDesc[] = { + { "2c", 0x01000, 0xe393bd2f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e", 0x01000, 0xb7d443af, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2g", 0x01000, 0xe67380a4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h", 0x01000, 0x72af7b37, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j", 0x01000, 0xe6b0dd7f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "sound.5c", 0x00800, 0x54ee7753, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "sound.5d", 0x00800, 0x5218fec0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "cpu.5f", 0x00800, 0x8a3da4d1, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "cpu.5h", 0x00800, 0x85bdb113, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Armorcar2) +STD_ROM_FN(Armorcar2) + +static struct BurnRomInfo TazmaniaRomDesc[] = { + { "2c.cpu", 0x01000, 0x932c5a06, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e.cpu", 0x01000, 0xef17ce65, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2f.cpu", 0x01000, 0x43c7c39d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h.cpu", 0x01000, 0xbe829694, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j.cpu", 0x01000, 0x6e197271, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2k.cpu", 0x01000, 0xa1eb453b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "rom0.snd", 0x00800, 0xb8d741f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5f.cpu", 0x00800, 0x2c5b612b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h.cpu", 0x00800, 0x3f5ff3ac, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "colr6f.cpu", 0x00020, 0xfce333c7, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Tazmania) +STD_ROM_FN(Tazmania) + +static struct BurnRomInfo Tazmani2RomDesc[] = { + { "2ck.cpu", 0x01000, 0xbf0492bf, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2ek.cpu", 0x01000, 0x6636c4d0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2fk.cpu", 0x01000, 0xce59a57b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2hk.cpu", 0x01000, 0x8bda3380, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2jk.cpu", 0x01000, 0xa4095e35, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2kk.cpu", 0x01000, 0xf308ca36, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "rom0.snd", 0x00800, 0xb8d741f1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5f.cpu", 0x00800, 0x2c5b612b, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h.cpu", 0x00800, 0x3f5ff3ac, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "colr6f.cpu", 0x00020, 0xfce333c7, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Tazmani2) +STD_ROM_FN(Tazmani2) + +static struct BurnRomInfo AnteaterRomDesc[] = { + { "ra1-2c", 0x01000, 0x58bc9393, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ra1-2e", 0x01000, 0x574fc6f6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ra1-2f", 0x01000, 0x2f7c1fe5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ra1-2h", 0x01000, 0xae8a5da3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ra4-5c", 0x00800, 0x87300b4f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ra4-5d", 0x00800, 0xaf4e5ffe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "ra6-5f", 0x00800, 0x4c3f8a08, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ra6-5h", 0x00800, 0xb30c7c9f, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "colr6f.cpu", 0x00020, 0xfce333c7, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Anteater) +STD_ROM_FN(Anteater) + +static struct BurnRomInfo AnteatergRomDesc[] = { + { "prg_2.bin", 0x02000, 0x2ba793a8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "prg_1.bin", 0x02000, 0x7a798af5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ra4-5c", 0x00800, 0x87300b4f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ra4-5d", 0x00800, 0xaf4e5ffe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "gfx_1.bin", 0x00800, 0x1e2824b1, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "gfx_2.bin", 0x00800, 0x784319b3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "colr6f.cpu", 0x00020, 0xfce333c7, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Anteaterg) +STD_ROM_FN(Anteaterg) + +static struct BurnRomInfo AnteaterukRomDesc[] = { + { "ant1.bin", 0x02000, 0x69debc90, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ant2.bin", 0x02000, 0xab352805, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ra4-5c", 0x00800, 0x87300b4f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ra4-5d", 0x00800, 0xaf4e5ffe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "gfx_1.bin", 0x00800, 0x1e2824b1, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "gfx_2.bin", 0x00800, 0x784319b3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "colr6f.cpu", 0x00020, 0xfce333c7, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Anteateruk) +STD_ROM_FN(Anteateruk) + +static struct BurnRomInfo SpdcoinRomDesc[] = { + { "spdcoin.2c", 0x01000, 0x65cf1e49, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "spdcoin.2e", 0x01000, 0x1ee59232, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "spdcoin.5c", 0x00800, 0xb4cf64b7, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "spdcoin.5d", 0x00800, 0x92304df0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "spdcoin.5f", 0x00800, 0xdd5f1dbc, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "spdcoin.5h", 0x00800, 0xab1fe81b, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "spdcoin.clr", 0x00020, 0x1a2ccc56, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Spdcoin) +STD_ROM_FN(Spdcoin) + +static struct BurnRomInfo SuperbonRomDesc[] = { + { "2d.cpu", 0x01000, 0x60c0ba18, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e.cpu", 0x01000, 0xddcf44bf, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2f.cpu", 0x01000, 0xbb66c2d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h.cpu", 0x01000, 0x74f4f04d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j.cpu", 0x01000, 0x78effb08, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2l.cpu", 0x01000, 0xe9dcecbd, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2m.cpu", 0x01000, 0x3ed0337e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "5c", 0x00800, 0xb899be2a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "5d.snd", 0x00800, 0x80640a04, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5f.cpu", 0x00800, 0x5b9d4686, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h.cpu", 0x00800, 0x58c29927, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x9b87f90d, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Superbon) +STD_ROM_FN(Superbon) + +static struct BurnRomInfo CalipsoRomDesc[] = { + { "calipso.2c", 0x01000, 0x0fcb703c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "calipso.2e", 0x01000, 0xc6622f14, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "calipso.2f", 0x01000, 0x7bacbaba, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "calipso.2h", 0x01000, 0xa3a8111b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "calipso.2j", 0x01000, 0xfcbd7b9e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "calipso.2l", 0x01000, 0xf7630cab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "calipso.5c", 0x00800, 0x9cbc65ab, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "calipso.5d", 0x00800, 0xa225ee3b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "calipso.5f", 0x02000, 0xfd4252e9, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "calipso.5h", 0x02000, 0x1663a73a, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "calipso.clr", 0x00020, 0x01165832, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Calipso) +STD_ROM_FN(Calipso) + +static struct BurnRomInfo MoonwarRomDesc[] = { + { "mw2.2c", 0x01000, 0x7c11b4d9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mw2.2e", 0x01000, 0x1b6362be, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mw2.2f", 0x01000, 0x4fd8ba4b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mw2.2h", 0x01000, 0x56879f0d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mw2.5c", 0x00800, 0xc26231eb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "mw2.5d", 0x00800, 0xbb48a646, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "mw2.5f", 0x00800, 0xc5fa1aa0, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mw2.5h", 0x00800, 0xa6ccc652, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mw2.clr", 0x00020, 0x99614c6c, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Moonwar) +STD_ROM_FN(Moonwar) + +static struct BurnRomInfo MoonwaraRomDesc[] = { + { "2c", 0x01000, 0xbc20b734, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e", 0x01000, 0xdb6ffec2, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2f", 0x01000, 0x378931b8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h", 0x01000, 0x031dbc2c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mw2.5c", 0x00800, 0xc26231eb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "mw2.5d", 0x00800, 0xbb48a646, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "mw2.5f", 0x00800, 0xc5fa1aa0, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mw2.5h", 0x00800, 0xa6ccc652, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "moonwara.clr", 0x00020, 0xf58d4f58, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Moonwara) +STD_ROM_FN(Moonwara) + +static struct BurnRomInfo StratgyxRomDesc[] = { + { "2c_1.bin", 0x01000, 0xeec01237, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e_2.bin", 0x01000, 0x926cb2d5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2f_3.bin", 0x01000, 0x849e2504, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h_4.bin", 0x01000, 0x8a64069b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j_5.bin", 0x01000, 0x78b9b898, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2l_6.bin", 0x01000, 0x20bae414, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "s1.bin", 0x01000, 0x713a5db8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "s2.bin", 0x01000, 0x46079411, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5f_c2.bin", 0x00800, 0x7121b679, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h_c1.bin", 0x00800, 0xd105ad91, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "strategy.6e", 0x00020, 0x51a629e1, BRF_GRA | GAL_ROM_PROM }, + { "strategy.10k", 0x00020, 0xd95c0318, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Stratgyx) +STD_ROM_FN(Stratgyx) + +static struct BurnRomInfo StratgysRomDesc[] = { + { "2c.cpu", 0x01000, 0xf2aaaf2b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2e.cpu", 0x01000, 0x5873fdc8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2f.cpu", 0x01000, 0x532d604f, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h.cpu", 0x01000, 0x82b1d95e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j.cpu", 0x01000, 0x66e84cde, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2l.cpu", 0x01000, 0x62b032d0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "s1.bin", 0x01000, 0x713a5db8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "s2.bin", 0x01000, 0x46079411, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5f.cpu", 0x00800, 0xf4aa5ddd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h.cpu", 0x00800, 0x548e4635, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "strategy.6e", 0x00020, 0x51a629e1, BRF_GRA | GAL_ROM_PROM }, + { "strategy.10k", 0x00020, 0xd95c0318, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Stratgys) +STD_ROM_FN(Stratgys) + +static struct BurnRomInfo StrongxRomDesc[] = { + { "strongx.2d", 0x01000, 0xc2f7268c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "strongx.2e", 0x01000, 0x91059422, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2f_3.bin", 0x01000, 0x849e2504, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2h_4.bin", 0x01000, 0x8a64069b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2j_5.bin", 0x01000, 0x78b9b898, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "2l_6.bin", 0x01000, 0x20bae414, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "s1.bin", 0x01000, 0x713a5db8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "s2.bin", 0x01000, 0x46079411, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "5f_c2.bin", 0x00800, 0x7121b679, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h_c1.bin", 0x00800, 0xd105ad91, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "strategy.6e", 0x00020, 0x51a629e1, BRF_GRA | GAL_ROM_PROM }, + { "strategy.10k", 0x00020, 0xd95c0318, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Strongx) +STD_ROM_FN(Strongx) + +static struct BurnRomInfo DarkplntRomDesc[] = { + { "drkplt2c.dat", 0x01000, 0x5a0ca559, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "drkplt2e.dat", 0x01000, 0x52e2117d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "drkplt2g.dat", 0x01000, 0x4093219c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "drkplt2j.dat", 0x01000, 0xb974c78d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "drkplt2k.dat", 0x01000, 0x71a37385, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "drkplt2l.dat", 0x01000, 0x5ad25154, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "drkplt2m.dat", 0x01000, 0x8d2f0122, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "drkplt2p.dat", 0x01000, 0x2d66253b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "5c.snd", 0x01000, 0x672b9454, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "drkplt5f.dat", 0x00800, 0x2af0ee66, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "drkplt5h.dat", 0x00800, 0x66ef3225, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6e.cpu", 0x00020, 0x86b6e124, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Darkplnt) +STD_ROM_FN(Darkplnt) + +static struct BurnRomInfo RescueRomDesc[] = { + { "rb15acpu.bin", 0x01000, 0xd7e654ba, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rb15bcpu.bin", 0x01000, 0xa93ea158, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rb15ccpu.bin", 0x01000, 0x058cd3d0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rb15dcpu.bin", 0x01000, 0xd6505742, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rb15ecpu.bin", 0x01000, 0x604df3a4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "rb15csnd.bin", 0x00800, 0x8b24bf17, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "rb15dsnd.bin", 0x00800, 0xd96e4fb3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "rb15fcpu.bin", 0x00800, 0x4489d20c, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rb15hcpu.bin", 0x00800, 0x5512c547, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "rescue.clr", 0x00020, 0x40c6bcbd, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Rescue) +STD_ROM_FN(Rescue) + +static struct BurnRomInfo AponowRomDesc[] = { + { "aponow01.rom", 0x01000, 0x33011579, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "aponow02.rom", 0x01000, 0xd477573e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "aponow03.rom", 0x01000, 0x46c41898, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rb15dcpu.bin", 0x01000, 0xd6505742, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "rb15ecpu.bin", 0x01000, 0x604df3a4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "rb15csnd.bin", 0x00800, 0x8b24bf17, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "rb15dsnd.bin", 0x00800, 0xd96e4fb3, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "rb15fcpu.bin", 0x00800, 0x4489d20c, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rb15hcpu.bin", 0x00800, 0x5512c547, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "rescue.clr", 0x00020, 0x40c6bcbd, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Aponow) +STD_ROM_FN(Aponow) + +static struct BurnRomInfo MinefldRomDesc[] = { + { "ma22c", 0x01000, 0x1367a035, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ma22e", 0x01000, 0x68946d21, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ma22f", 0x01000, 0x7663aee5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ma22h", 0x01000, 0x9787475d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ma22j", 0x01000, 0x2ceceb54, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "ma22l", 0x01000, 0x85138fc9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "ma15c", 0x00800, 0x8bef736b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "ma15d", 0x00800, 0xf67b3f97, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "ma15f", 0x00800, 0x9f703006, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "ma15h", 0x00800, 0xed0dccb1, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "minefld.clr", 0x00020, 0x1877368e, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Minefld) +STD_ROM_FN(Minefld) + +static struct BurnRomInfo HustlerRomDesc[] = { + { "hustler.1", 0x01000, 0x94479a3e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "hustler.2", 0x01000, 0x3cc67bcc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "hustler.3", 0x01000, 0x9422226a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "hustler.6", 0x00800, 0x7a946544, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "hustler.7", 0x00800, 0x3db57351, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "hustler.5f", 0x00800, 0x0bdfad0e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "hustler.5h", 0x00800, 0x8e062177, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "hustler.clr", 0x00020, 0xaa1f7f5e, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Hustler) +STD_ROM_FN(Hustler) + +static struct BurnRomInfo BilliardRomDesc[] = { + { "a", 0x01000, 0xb7eb50c0, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "b", 0x01000, 0x988fe1c5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "c", 0x01000, 0x7b8de793, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "hustler.6", 0x00800, 0x7a946544, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "hustler.7", 0x00800, 0x3db57351, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "hustler.5f", 0x00800, 0x0bdfad0e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "hustler.5h", 0x00800, 0x8e062177, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "hustler.clr", 0x00020, 0xaa1f7f5e, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Billiard) +STD_ROM_FN(Billiard) + +static struct BurnRomInfo HustlerbRomDesc[] = { + { "hustler.2c", 0x01000, 0x3a1ac6a9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "hustler.2f", 0x01000, 0xdc6752ec, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "hustler.2j", 0x01000, 0x27c1e0f8, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "hustler.11d", 0x00800, 0xb559bfde, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "hustler.10d", 0x00800, 0x6ef96cfb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "hustler.5f", 0x00800, 0x0bdfad0e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "hustler.5h", 0x00800, 0x8e062177, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "hustler.clr", 0x00020, 0xaa1f7f5e, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Hustlerb) +STD_ROM_FN(Hustlerb) + +static struct BurnRomInfo MimonkeyRomDesc[] = { + { "mm1.2e", 0x01000, 0x9019f1b1, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm2.2e", 0x01000, 0x043e97d6, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm3.2f", 0x01000, 0x1052726a, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm4.2h", 0x01000, 0x7b3f35ff, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm5.2j", 0x01000, 0xb4e5c32d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm6.2l", 0x01000, 0x409036c4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm7.2m", 0x01000, 0x119c08fa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "mm8.2p", 0x01000, 0xf7989f04, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mm13.11d", 0x01000, 0x2d14c527, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "mm14.10d", 0x01000, 0x35ed0f96, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "mm12.5h", 0x01000, 0xf73a8412, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mm10.5h", 0x01000, 0x3828c9db, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mm11.5f", 0x01000, 0x9e0e9289, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mm9.5f", 0x01000, 0x92085b0c, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mimonkey) +STD_ROM_FN(Mimonkey) + +static struct BurnRomInfo MimonscoRomDesc[] = { + { "fra_1a", 0x01000, 0x8e7a7379, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "fra_1b", 0x01000, 0xab08cbfe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "fra_2a", 0x01000, 0x2d4da24d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "fra_2b", 0x01000, 0x8d88fc7c, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "fra_3a", 0x01000, 0xb4e5c32d, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "fra_3b", 0x01000, 0x409036c4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "fra_4a", 0x01000, 0x119c08fa, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "fra_4b", 0x01000, 0xd700fd03, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "mmsound1", 0x01000, 0x2d14c527, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + { "mmsnd2a", 0x01000, 0x35ed0f96, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG2 }, + + { "mmgfx1", 0x02000, 0x4af47337, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "mmgfx2", 0x02000, 0xdef47da8, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, +}; + +STD_ROM_PICK(Mimonsco) +STD_ROM_FN(Mimonsco) + +UINT8 __fastcall Tazmani2Z80Read(UINT16 a) +{ + if (a >= 0xa000 && a <= 0xa00f) { + return ppi8255_r(0, (a - 0xa000) >> 2); + } + + if (a >= 0xa800 && a <= 0xa80f) { + return ppi8255_r(1, (a - 0xa800) >> 2); + } + + switch (a) { + case 0x9800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall Tazmani2Z80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x8800 && a <= 0x88ff) { + INT32 Offset = a - 0x8800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0xa000 && a <= 0xa00f) { + ppi8255_w(0, (a - 0xa000) >> 2, d); + return; + } + + if (a >= 0xa800 && a <= 0xa80f) { + ppi8255_w(1, (a - 0xa800) >> 2, d); + return; + } + + switch (a) { + case 0xb000: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb002: { + GalBackgroundEnable = d & 1; + return; + } + + case 0xb004: { + GalIrqFire = d & 1; + return; + } + + case 0xb006: { + // coin_count_0_w + return; + } + + case 0xb00c: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb00e: { + GalFlipScreenX = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall AnteatergZ80Read(UINT16 a) +{ + switch (a) { + case 0xf521: { + // watchdog read + return 0xff; + } + + case 0xf612: { + return ppi8255_r(0, 0); + } + + case 0xf631: { + return ppi8255_r(0, 1); + } + + case 0xf710: { + return ppi8255_r(0, 2); + } + + case 0xf753: { + return ppi8255_r(0, 3); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall AnteatergZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x2000 && a <= 0x20ff) { + INT32 Offset = a - 0x2000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x2423: { + ppi8255_w(1, 3, d); + return; + } + + case 0x2450: { + ppi8255_w(1, 0, d); + return; + } + + case 0x2511: { + ppi8255_w(1, 1, d); + return; + } + + case 0x2621: { + GalIrqFire = d & 1; + return; + } + + case 0x2624: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x2647: { + GalFlipScreenY = d & 1; + return; + } + + case 0x2653: { + GalBackgroundEnable = d & 1; + return; + } + + case 0x2702: { + // coin_count_0_w + return; + } + + case 0x2736: { + GalFlipScreenX = d & 1; + return; + } + + case 0xf612: { + ppi8255_w(0, 0, d); + return; + } + + case 0xf631: { + ppi8255_w(0, 1, d); + return; + } + + case 0xf710: { + ppi8255_w(0, 2, d); + return; + } + + case 0xf753: { + ppi8255_w(0, 3, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall AnteatgbZ80Read(UINT16 a) +{ + switch (a) { + case 0x145b: { + // watchdog read + return 0xff; + } + + case 0xf300: + case 0xf301: + case 0xf302: + case 0xf303: { + return ppi8255_r(0, a - 0xf300); + } + + case 0xfe00: + case 0xfe01: + case 0xfe02: + case 0xfe03: { + return ppi8255_r(1, a - 0xfe00); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall AnteatgbZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x1200 && a <= 0x12ff) { + INT32 Offset = a - 0x1200; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x1171: { + GalIrqFire = d & 1; + return; + } + + case 0x1172: { + // coin_count_0_w + return; + } + + case 0x1173: { + GalBackgroundEnable = d & 1; + return; + } + + case 0x1174: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x1176: { + GalFlipScreenX = d & 1; + return; + } + + case 0x1177: { + GalFlipScreenY = d & 1; + return; + } + + case 0xf300: + case 0xf301: + case 0xf302: + case 0xf303: { + ppi8255_w(0, a - 0xf300, d); + return; + } + + case 0xfe00: + case 0xfe01: + case 0xfe02: + case 0xfe03: { + ppi8255_w(1, a - 0xfe00, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall StratgyxZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x8800 && a <= 0x88ff) { + INT32 Offset = a - 0x8800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0xa000 && a <= 0xa00f) { + ppi8255_w(0, (a - 0xa000) >> 2, d); + return; + } + + if (a >= 0xa800 && a <= 0xa80f) { + ppi8255_w(1, (a - 0xa800) >> 2, d); + return; + } + + switch (a) { + case 0xb000: { + GalBackgroundGreen = d & 1; + return; + } + + case 0xb002: { + GalBackgroundBlue = d & 1; + return; + } + + case 0xb004: { + GalIrqFire = d & 1; + return; + } + + case 0xb006: { + // coin_count_0_w + return; + } + + case 0xb00a: { + GalBackgroundRed = d & 1; + return; + } + + case 0xb00c: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb00e: { + GalFlipScreenX = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall DarkplntZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x8800 && a <= 0x88ff) { + INT32 Offset = a - 0x8800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0xa000 && a <= 0xa00f) { + ppi8255_w(0, (a - 0xa000) >> 2, d); + return; + } + + if (a >= 0xa800 && a <= 0xa80f) { + ppi8255_w(1, (a - 0xa800) >> 2, d); + return; + } + + switch (a) { + case 0xb000: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb002: { + GalBackgroundEnable = d & 1; + return; + } + + case 0xb004: { + GalIrqFire = d & 1; + return; + } + + case 0xb006: { + // coin_count_0_w + return; + } + + case 0xb00a: { + DarkplntBulletColour = d & 1; + return; + } + + case 0xb00c: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb00e: { + GalFlipScreenX = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall HustlerZ80Read(UINT16 a) +{ + if (a >= 0xd000 && a <= 0xd01f) { + return ppi8255_r(0, (a - 0xd000) >> 3); + } + + if (a >= 0xe000 && a <= 0xe01f) { + return ppi8255_r(1, (a - 0xe000) >> 3); + } + + switch (a) { + case 0xb800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall HustlerZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9000 && a <= 0x90ff) { + INT32 Offset = a - 0x9000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0xd000 && a <= 0xd01f) { + ppi8255_w(0, (a - 0xd000) >> 3, d); + return; + } + + if (a >= 0xe000 && a <= 0xe01f) { + ppi8255_w(1, (a - 0xe000) >> 3, d); + return; + } + + switch (a) { + case 0xa802: { + GalFlipScreenX = d & 1; + return; + } + + case 0xa804: { + GalIrqFire = d & 1; + return; + } + + case 0xa806: { + GalFlipScreenY = d & 1; + return; + } + + case 0xa80e: { + // coin_count_0_w + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall HustlerbZ80Read(UINT16 a) +{ + switch (a) { + case 0xb000: { + // watchdog read + return 0xff; + } + + case 0xc100: + case 0xc101: + case 0xc102: + case 0xc103: { + return ppi8255_r(0, a - 0xc100); + } + + case 0xc200: + case 0xc201: + case 0xc202: + case 0xc203: { + return ppi8255_r(1, a - 0xc200); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall HustlerbZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9000 && a <= 0x90ff) { + INT32 Offset = a - 0x9000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa801: { + GalIrqFire = d & 1; + return; + } + + case 0xa802: { + // coin_count_0_w + return; + } + + case 0xa806: { + GalFlipScreenY = d & 1; + return; + } + + case 0xa807: { + GalFlipScreenX = d & 1; + return; + } + + case 0xc100: + case 0xc101: + case 0xc102: + case 0xc103: { + ppi8255_w(0, a - 0xc100, d); + return; + } + + case 0xc200: + case 0xc201: + case 0xc202: + case 0xc203: { + ppi8255_w(1, a - 0xc200, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall HustlerbSoundZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x80: { + return AY8910Read(0); + } + } + + return 0xff; +} + +void __fastcall HustlerbSoundZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x40: { + AY8910Write(0, 0, d); + return; + } + + case 0x80: { + AY8910Write(0, 1, d); + return; + } + } +} + +void __fastcall MimonkeyZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9000 && a <= 0x90ff) { + INT32 Offset = a - 0x9000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x9800: + case 0x9801: + case 0x9802: + case 0x9803: { + ppi8255_w(0, a - 0x9800, d); + return; + } + + case 0xa000: + case 0xa001: + case 0xa002: + case 0xa003: { + ppi8255_w(1, a - 0xa000, d); + return; + } + + case 0xa800: { + GalGfxBank[0] = d & 1; + return; + } + + case 0xa801: { + GalIrqFire = d & 1; + return; + } + + case 0xa802: { + GalGfxBank[1] = d & 1; + return; + } + + case 0xa803: { + // ??? + return; + } + + case 0xa804: { + GalBackgroundEnable = d & 1; + return; + } + + case 0xa805: { + // ??? + return; + } + + case 0xa806: { + GalFlipScreenX = d & 1; + return; + } + + case 0xa807: { + GalFlipScreenY = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 ScobraInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapScobra; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + return nRet; +} + +static INT32 LosttombInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapScobra; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + UINT8 *TempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); + BurnLoadRom(TempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); + for (UINT32 Offset = 0; Offset < GalTilesSharedRomSize; Offset++) { + UINT32 SrcOffset = Offset & 0xa7f; + SrcOffset |= ((BIT(Offset, 1) & BIT(Offset, 8)) | ((1 ^ BIT(Offset, 1)) & (BIT(Offset, 10)))) << 7; + SrcOffset |= (BIT(Offset, 7) ^ (BIT(Offset, 1) & (BIT(Offset, 7) ^ BIT(Offset, 10)))) << 8; + SrcOffset |= ((BIT(Offset, 1) & BIT(Offset, 7)) | ((1 ^ BIT(Offset, 1)) & (BIT(Offset, 8)))) << 10; + GalTempRom[Offset] = TempRom[SrcOffset]; + } + BurnFree(TempRom); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static void MapTazmani2() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(Tazmani2Z80Read); + ZetSetWriteHandler(Tazmani2Z80Write); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetMapArea(0x8800, 0x88ff, 0, GalSpriteRam); + ZetMapArea(0x8800, 0x88ff, 2, GalSpriteRam); + ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); + ZetClose(); +} + +static INT32 Tazmani2Init() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapTazmani2; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + return nRet; +} + +static INT32 AnteaterInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapScobra; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + UINT8 *TempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); + BurnLoadRom(TempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); + for (UINT32 Offset = 0; Offset < GalTilesSharedRomSize; Offset++) { + UINT32 SrcOffset = Offset & 0x9bf; + SrcOffset |= (BIT(Offset, 4) ^ BIT(Offset, 9) ^ (BIT(Offset, 2) & BIT(Offset, 10))) << 6; + SrcOffset |= (BIT(Offset, 2) ^ BIT(Offset, 10)) << 9; + SrcOffset |= (BIT(Offset, 0) ^ BIT(Offset, 6) ^ 1) << 10; + GalTempRom[Offset] = TempRom[SrcOffset]; + } + BurnFree(TempRom); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + + GalRenderBackgroundFunction = AnteaterDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static void AnteatergPostLoad() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(AnteatergZ80Read); + ZetSetWriteHandler(AnteatergZ80Write); + ZetMapArea(0x0000, 0x03ff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x03ff, 2, GalZ80Rom1); + ZetMapArea(0x0400, 0x0bff, 0, GalZ80Ram1); + ZetMapArea(0x0400, 0x0bff, 1, GalZ80Ram1); + ZetMapArea(0x0400, 0x0bff, 2, GalZ80Ram1); + ZetMapArea(0x0c00, 0x0fff, 0, GalVideoRam); + ZetMapArea(0x0c00, 0x0fff, 1, GalVideoRam); + ZetMapArea(0x0c00, 0x0fff, 2, GalVideoRam); + ZetMapArea(0x2000, 0x20ff, 0, GalSpriteRam); + ZetMapArea(0x2000, 0x20ff, 2, GalSpriteRam); + ZetMapArea(0x4600, 0x4fff, 0, GalZ80Rom1 + 0x0400); + ZetMapArea(0x4600, 0x4fff, 2, GalZ80Rom1 + 0x0400); + ZetMapArea(0x6400, 0x7aff, 0, GalZ80Rom1 + 0x0e00); + ZetMapArea(0x6400, 0x7aff, 2, GalZ80Rom1 + 0x0e00); + ZetMapArea(0x7c00, 0x7fff, 0, GalVideoRam); + ZetMapArea(0x7c00, 0x7fff, 1, GalVideoRam); + ZetMapArea(0x7c00, 0x7fff, 2, GalVideoRam); + ZetMapArea(0x8300, 0x98ff, 0, GalZ80Rom1 + 0x2500); + ZetMapArea(0x8300, 0x98ff, 2, GalZ80Rom1 + 0x2500); + ZetMapArea(0xa300, 0xa7ff, 0, GalZ80Rom1 + 0x3b00); + ZetMapArea(0xa300, 0xa7ff, 2, GalZ80Rom1 + 0x3b00); + ZetClose(); +} + +static INT32 AnteatergInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = AnteatergPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = AnteaterDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static void AnteaterukPostLoad() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(AnteatgbZ80Read); + ZetSetWriteHandler(AnteatgbZ80Write); + ZetMapArea(0x0000, 0x03ff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x03ff, 2, GalZ80Rom1); + ZetMapArea(0x0400, 0x0bff, 0, GalZ80Ram1); + ZetMapArea(0x0400, 0x0bff, 1, GalZ80Ram1); + ZetMapArea(0x0400, 0x0bff, 2, GalZ80Ram1); + ZetMapArea(0x0c00, 0x0fff, 0, GalVideoRam); + ZetMapArea(0x0c00, 0x0fff, 1, GalVideoRam); + ZetMapArea(0x0c00, 0x0fff, 2, GalVideoRam); + ZetMapArea(0x1200, 0x12ff, 0, GalSpriteRam); + ZetMapArea(0x1200, 0x12ff, 2, GalSpriteRam); + ZetMapArea(0x4600, 0x4fff, 0, GalZ80Rom1 + 0x0400); + ZetMapArea(0x4600, 0x4fff, 2, GalZ80Rom1 + 0x0400); + ZetMapArea(0x6400, 0x7aff, 0, GalZ80Rom1 + 0x0e00); + ZetMapArea(0x6400, 0x7aff, 2, GalZ80Rom1 + 0x0e00); + ZetMapArea(0x8300, 0x98ff, 0, GalZ80Rom1 + 0x2500); + ZetMapArea(0x8300, 0x98ff, 2, GalZ80Rom1 + 0x2500); + ZetMapArea(0xa300, 0xa7ff, 0, GalZ80Rom1 + 0x3b00); + ZetMapArea(0xa300, 0xa7ff, 2, GalZ80Rom1 + 0x3b00); + ZetClose(); +} + +static INT32 AnteaterukInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = AnteaterukPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static void SuperbonPostLoad() +{ + MapScobra(); + + for (UINT32 Offset = 0; Offset < 0x1000; Offset++) { + switch (Offset & 0x280) { + case 0x000: GalZ80Rom1[Offset] ^= 0x92; break; + case 0x080: GalZ80Rom1[Offset] ^= 0x82; break; + case 0x200: GalZ80Rom1[Offset] ^= 0x12; break; + case 0x280: GalZ80Rom1[Offset] ^= 0x10; break; + } + } +} + +static INT32 SuperbonInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = SuperbonPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static INT32 CalipsoInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapScobra; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendSpriteInfoFunction = CalipsoExtendSpriteInfo; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static UINT8 MoonwarPPIReadIN0() +{ + UINT8 Dial1 = (GalAnalogPort0 >> 8) & 0xff; + UINT8 Dial2 = (GalAnalogPort1 >> 8) & 0xff; + UINT8 Input0 = 0xff - GalInput[0] - GalDip[0]; + UINT8 Sign; + UINT8 Delta; + + if (Dial1 >= 0xfc || (Dial1 >= 0x01 && Dial1 <= 0x04)) Dial1 = 0; + if (Dial1 >= 0xf8) Dial1 = 0xfd; + if (Dial1 >= 0x01 && Dial1 <= 0x07) Dial1 = 0x02; + + if (Dial2 >= 0xfc || (Dial2 >= 0x01 && Dial2 <= 0x04)) Dial2 = 0; + if (Dial2 >= 0xf8) Dial2 = 0xfd; + if (Dial2 >= 0x01 && Dial2 <= 0x07) Dial2 = 0x02; + + Delta = (MoonwarPortSelect ? Dial1 : Dial2); + Sign = (Delta & 0x80) >> 3; + Delta &= 0x0f; + + return (Input0 & 0xe0) | Delta | Sign; +} + +static void MoonwarPortSelectWrite(UINT8 d) +{ + MoonwarPortSelect = d & 0x10; +} + +static INT32 MoonwarInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapScobra; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = MoonwarDrawBullets; + + KonamiPPIInit(); + + PPI0PortReadA = MoonwarPPIReadIN0; + PPI0PortWriteC = MoonwarPortSelectWrite; + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static void StratgyxPostLoad() +{ + MapTazmani2(); + + ZetOpen(0); + ZetSetWriteHandler(StratgyxZ80Write); + ZetClose(); +} + +static INT32 StratgyxInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = StratgyxPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalCalcPaletteFunction = StratgyxCalcPalette; + GalRenderBackgroundFunction = StratgyxDrawBackground; + + KonamiPPIInit(); + + return nRet; +} + +static void DarkplntPostLoad() +{ + MapTazmani2(); + + ZetOpen(0); + ZetSetWriteHandler(DarkplntZ80Write); + ZetClose(); +} + +static INT16 DarkplntDial = 0; +static UINT32 DarkplntDialFrameNumberRead = 0; + +static UINT8 DarkplntPPIReadIN1() +{ + UINT32 CurrentFrame = GetCurrentFrame(); + + if (DarkplntDialFrameNumberRead != CurrentFrame) { + if (GalInputPort3[0]) DarkplntDial -= 0x01; + if (GalInputPort3[1]) DarkplntDial += 0x01; + if (DarkplntDial > 0xfc) DarkplntDial = 0x00; + if (DarkplntDial < 0) DarkplntDial = 0xfc; + DarkplntDialFrameNumberRead = CurrentFrame; + } + + static const UINT8 remap[] = {0x03, 0x02, 0x00, 0x01, 0x21, 0x20, 0x22, 0x23, 0x33, 0x32, 0x30, 0x31, 0x11, 0x10, 0x12, 0x13, 0x17, 0x16, 0x14, 0x15, 0x35, 0x34, 0x36, 0x37, 0x3f, 0x3e, 0x3c, 0x3d, 0x1d, 0x1c, 0x1e, 0x1f, 0x1b, 0x1a, 0x18, 0x19, 0x39, 0x38, 0x3a, 0x3b, 0x2b, 0x2a, 0x28, 0x29, 0x09, 0x08, 0x0a, 0x0b, 0x0f, 0x0e, 0x0c, 0x0d, 0x2d, 0x2c, 0x2e, 0x2f, 0x27, 0x26, 0x24, 0x25, 0x05, 0x04, 0x06, 0x07 }; + + return 0xff - GalInput[1] - GalDip[1] - remap[DarkplntDial >> 2]; +} + +static INT32 DarkplntInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = DarkplntPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalCalcPaletteFunction = DarkplntCalcPalette; + GalDrawBulletsFunction = DarkplntDrawBullets; + + KonamiPPIInit(); + PPI0PortReadB = DarkplntPPIReadIN1; + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static INT32 RescueInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapScobra; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + UINT8* TempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + memcpy(TempRom, GalTempRom, GalTilesSharedRomSize); + for (UINT32 Offset = 0; Offset < GalTilesSharedRomSize; Offset++) { + UINT32 j = Offset & 0xa7f; + j |= (BIT(Offset, 3) ^ BIT(Offset, 10)) << 7; + j |= (BIT(Offset, 1) ^ BIT(Offset, 7)) << 8; + j |= (BIT(Offset, 0) ^ BIT(Offset, 8)) << 10; + GalTempRom[Offset] = TempRom[j]; + } + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(TempRom); + BurnFree(GalTempRom); + + GalCalcPaletteFunction = RescueCalcPalette; + GalRenderBackgroundFunction = RescueDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static INT32 MinefldInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapScobra; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + UINT8* TempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x0800, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + memcpy(TempRom, GalTempRom, GalTilesSharedRomSize); + for (UINT32 Offset = 0; Offset < GalTilesSharedRomSize; Offset++) { + UINT32 j = Offset & 0xd5f; + j |= (BIT(Offset, 3) ^ BIT(Offset, 7)) << 5; + j |= (BIT(Offset, 2) ^ BIT(Offset, 9) ^ (BIT(Offset, 0) & BIT(Offset, 5)) ^ (BIT(Offset, 3) & BIT(Offset, 7) & (BIT(Offset, 0) ^ BIT(Offset, 5)))) << 7; + j |= (BIT(Offset, 0) ^ BIT(Offset, 5) ^ (BIT(Offset, 3) & BIT(Offset, 7))) << 9; + GalTempRom[Offset] = TempRom[j]; + } + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(TempRom); + BurnFree(GalTempRom); + + GalCalcPaletteFunction = MinefldCalcPalette; + GalRenderBackgroundFunction = MinefldDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static void HustlerPostLoad() +{ + MapScobra(); + + ZetOpen(0); + ZetSetReadHandler(HustlerZ80Read); + ZetSetWriteHandler(HustlerZ80Write); + ZetClose(); + + for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { + UINT8 XorMask; + INT32 Bits[8]; + + for (UINT32 i = 0; i < 8; i++) Bits[i] = (Offset >> i) & 1; + + XorMask = 0xff; + if (Bits[0] ^ Bits[1]) XorMask ^= 0x01; + if (Bits[3] ^ Bits[6]) XorMask ^= 0x02; + if (Bits[4] ^ Bits[5]) XorMask ^= 0x04; + if (Bits[0] ^ Bits[2]) XorMask ^= 0x08; + if (Bits[2] ^ Bits[3]) XorMask ^= 0x10; + if (Bits[1] ^ Bits[5]) XorMask ^= 0x20; + if (Bits[0] ^ Bits[7]) XorMask ^= 0x40; + if (Bits[4] ^ Bits[6]) XorMask ^= 0x80; + + GalZ80Rom1[Offset] ^= XorMask; + } +} + +static INT32 HustlerInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = HustlerPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; + + nRet = GalInit(); + FroggerSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + return nRet; +} + +static void BilliardPostLoad() +{ + MapScobra(); + + ZetOpen(0); + ZetSetReadHandler(HustlerZ80Read); + ZetSetWriteHandler(HustlerZ80Write); + ZetClose(); + + for (UINT32 Offset = 0; Offset < GalZ80Rom1Size; Offset++) { + UINT8 XorMask; + INT32 Bits[8]; + + for (UINT32 i = 0; i < 8; i++) Bits[i] = (Offset >> i) & 1; + + XorMask = 0x55; + if (Bits[2] ^ ( Bits[3] & Bits[6])) XorMask ^= 0x01; + if (Bits[4] ^ ( Bits[5] & Bits[7])) XorMask ^= 0x02; + if (Bits[0] ^ ( Bits[7] & !Bits[3])) XorMask ^= 0x04; + if (Bits[3] ^ (!Bits[0] & Bits[2])) XorMask ^= 0x08; + if (Bits[5] ^ (!Bits[4] & Bits[1])) XorMask ^= 0x10; + if (Bits[6] ^ (!Bits[2] & !Bits[5])) XorMask ^= 0x20; + if (Bits[1] ^ (!Bits[6] & !Bits[4])) XorMask ^= 0x40; + if (Bits[7] ^ (!Bits[1] & Bits[0])) XorMask ^= 0x80; + + GalZ80Rom1[Offset] ^= XorMask; + GalZ80Rom1[Offset] = BITSWAP08(GalZ80Rom1[Offset], 6, 1, 2, 5, 4, 3, 0, 7); + } +} + +static INT32 BilliardInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = BilliardPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; + + nRet = GalInit(); + FroggerSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + return nRet; +} + +static void HustlerbPostLoad() +{ + MapScobra(); + + ZetOpen(0); + ZetSetReadHandler(HustlerbZ80Read); + ZetSetWriteHandler(HustlerbZ80Write); + ZetClose(); + + FroggerSoundNoEncryptionInit(); + ZetOpen(1); + ZetSetInHandler(HustlerbSoundZ80PortRead); + ZetSetOutHandler(HustlerbSoundZ80PortWrite); + ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram2); + ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram2); + ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram2); + ZetClose(); +} + +static INT32 HustlerbInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = HustlerbPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910; + + nRet = GalInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + + GalSpriteClipStart = 7; + GalSpriteClipEnd = 246; + + return nRet; +} + +static void MapMimonkey() +{ + MapScobra(); + + ZetOpen(0); + ZetSetWriteHandler(MimonkeyZ80Write); + ZetMemCallback(0x4000, 0x7fff, 0); + ZetMemCallback(0x4000, 0x7fff, 2); + ZetMapArea(0xc000, 0xffff, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0xc000, 0xffff, 2, GalZ80Rom1 + 0x4000); + ZetClose(); +} + +static void MimonkeyPostLoad() +{ + static const UINT8 XorTable[16][16] = { + { 0x03, 0x03, 0x05, 0x07, 0x85, 0x00, 0x85, 0x85, 0x80, 0x80, 0x06, 0x03, 0x03, 0x00, 0x00, 0x81 }, + { 0x83, 0x87, 0x03, 0x87, 0x06, 0x00, 0x06, 0x04, 0x02, 0x00, 0x84, 0x84, 0x04, 0x00, 0x01, 0x83 }, + { 0x82, 0x82, 0x84, 0x02, 0x04, 0x00, 0x00, 0x03, 0x82, 0x00, 0x06, 0x80, 0x03, 0x00, 0x81, 0x07 }, + { 0x06, 0x06, 0x82, 0x81, 0x85, 0x00, 0x04, 0x07, 0x81, 0x05, 0x04, 0x00, 0x03, 0x00, 0x82, 0x84 }, + { 0x07, 0x07, 0x80, 0x07, 0x07, 0x00, 0x85, 0x86, 0x00, 0x07, 0x06, 0x04, 0x85, 0x00, 0x86, 0x85 }, + { 0x81, 0x83, 0x02, 0x02, 0x87, 0x00, 0x86, 0x03, 0x04, 0x06, 0x80, 0x05, 0x87, 0x00, 0x81, 0x81 }, + { 0x01, 0x01, 0x00, 0x07, 0x07, 0x00, 0x01, 0x01, 0x07, 0x07, 0x06, 0x00, 0x06, 0x00, 0x07, 0x07 }, + { 0x80, 0x87, 0x81, 0x87, 0x83, 0x00, 0x84, 0x01, 0x01, 0x86, 0x86, 0x80, 0x86, 0x00, 0x86, 0x86 }, + { 0x03, 0x03, 0x05, 0x07, 0x85, 0x00, 0x85, 0x85, 0x80, 0x80, 0x06, 0x03, 0x03, 0x00, 0x00, 0x81 }, + { 0x83, 0x87, 0x03, 0x87, 0x06, 0x00, 0x06, 0x04, 0x02, 0x00, 0x84, 0x84, 0x04, 0x00, 0x01, 0x83 }, + { 0x82, 0x82, 0x84, 0x02, 0x04, 0x00, 0x00, 0x03, 0x82, 0x00, 0x06, 0x80, 0x03, 0x00, 0x81, 0x07 }, + { 0x06, 0x06, 0x82, 0x81, 0x85, 0x00, 0x04, 0x07, 0x81, 0x05, 0x04, 0x00, 0x03, 0x00, 0x82, 0x84 }, + { 0x07, 0x07, 0x80, 0x07, 0x07, 0x00, 0x85, 0x86, 0x00, 0x07, 0x06, 0x04, 0x85, 0x00, 0x86, 0x85 }, + { 0x81, 0x83, 0x02, 0x02, 0x87, 0x00, 0x86, 0x03, 0x04, 0x06, 0x80, 0x05, 0x87, 0x00, 0x81, 0x81 }, + { 0x01, 0x01, 0x00, 0x07, 0x07, 0x00, 0x01, 0x01, 0x07, 0x07, 0x06, 0x00, 0x06, 0x00, 0x07, 0x07 }, + { 0x80, 0x87, 0x81, 0x87, 0x83, 0x00, 0x84, 0x01, 0x01, 0x86, 0x86, 0x80, 0x86, 0x00, 0x86, 0x86 } + }; + + INT32 Ctr = 0, Line, Col; + + for (INT32 Offset = 0; Offset < 0x4000; Offset++) { + Line = (Ctr & 0x07) | ((Ctr & 0x200) >> 6); + Col = ((GalZ80Rom1[Offset] & 0x80) >> 4) | (GalZ80Rom1[Offset] & 0x07); + GalZ80Rom1[Offset] = GalZ80Rom1[Offset] ^ XorTable[Line][Col]; + Ctr++; + } + + MapMimonkey(); +} + +static INT32 MimonkeyInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MimonkeyPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = MimonkeyExtendTileInfo; + GalExtendSpriteInfoFunction = MimonkeyExtendSpriteInfo; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +static INT32 MimonscoInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = MapMimonkey; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910; + + nRet = GalInit(); + KonamiSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = MimonkeyExtendTileInfo; + GalExtendSpriteInfoFunction = MimonkeyExtendSpriteInfo; + + KonamiPPIInit(); + + filter_rc_set_src_gain(0, 0.20); + filter_rc_set_src_gain(1, 0.20); + filter_rc_set_src_gain(2, 0.20); + filter_rc_set_src_gain(3, 0.20); + filter_rc_set_src_gain(4, 0.20); + filter_rc_set_src_gain(5, 0.20); + + return nRet; +} + +struct BurnDriver BurnDrvScobra = { + "scobra", NULL, NULL, NULL, "1981", + "Super Cobra\0", NULL, "Konami", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScobraRomInfo, ScobraRomName, NULL, NULL, SfxInputInfo, ScobraDIPInfo, + ScobraInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScobras = { + "scobras", "scobra", NULL, NULL, "1981", + "Super Cobra (Stern)\0", NULL, "Konami (Stern license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScobrasRomInfo, ScobrasRomName, NULL, NULL, SfxInputInfo, ScobrasDIPInfo, + ScobraInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScobrase = { + "scobrase", "scobra", NULL, NULL, "1981", + "Super Cobra (Sega)\0", NULL, "Konami (Sega license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScobraseRomInfo, ScobraseRomName, NULL, NULL, SfxInputInfo, ScobrasDIPInfo, + ScobraInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvScobrab = { + "scobrab", "scobra", NULL, NULL, "1981", + "Super Cobra (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, ScobrabRomInfo, ScobrabRomName, NULL, NULL, SfxInputInfo, ScobrasDIPInfo, + ScobraInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSuprheli = { + "suprheli", "scobra", NULL, NULL, "1981", + "Super Heli (Super Cobra bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, SuprheliRomInfo, SuprheliRomName, NULL, NULL, SfxInputInfo, ScobrasDIPInfo, + ScobraInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvLosttomb = { + "losttomb", NULL, NULL, NULL, "1982", + "Lost Tomb (Easy)\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, LosttombRomInfo, LosttombRomName, NULL, NULL, LosttombInputInfo, LosttombDIPInfo, + LosttombInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvLosttombh = { + "losttombh", "losttomb", NULL, NULL, "1982", + "Lost Tomb (Hard)\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, LosttombhRomInfo, LosttombhRomName, NULL, NULL, LosttombInputInfo, LosttombDIPInfo, + LosttombInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvArmorcar = { + "armorcar", NULL, NULL, NULL, "1981", + "Armored Car (set 1)\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, ArmorcarRomInfo, ArmorcarRomName, NULL, NULL, AtlantisInputInfo, ArmorcarDIPInfo, + ScobraInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvArmorcar2 = { + "armorcar2", "armorcar", NULL, NULL, "1981", + "Armored Car (set 2)\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, Armorcar2RomInfo, Armorcar2RomName, NULL, NULL, AtlantisInputInfo, ArmorcarDIPInfo, + ScobraInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTazmania = { + "tazmania", NULL, NULL, NULL, "1982", + "Tazz-Mania (set 1)\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, TazmaniaRomInfo, TazmaniaRomName, NULL, NULL, TazmaniaInputInfo, ArmorcarDIPInfo, + ScobraInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTazmani2 = { + "tazmani2", "tazmania", NULL, NULL, "1982", + "Tazz-Mania (set 2)\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, Tazmani2RomInfo, Tazmani2RomName, NULL, NULL, TazmaniaInputInfo, ArmorcarDIPInfo, + Tazmani2Init, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAnteater = { + "anteater", NULL, NULL, NULL, "1982", + "Anteater\0", NULL, "Stern (Tago license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, AnteaterRomInfo, AnteaterRomName, NULL, NULL, AnteaterInputInfo, AnteaterDIPInfo, + AnteaterInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAnteaterg = { + "anteaterg", "anteater", NULL, NULL, "1983", + "Ameisenbaer (German)\0", NULL, "TV-Tuning (F.E.G. license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, AnteatergRomInfo, AnteatergRomName, NULL, NULL, AnteatergInputInfo, AnteatergDIPInfo, + AnteatergInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAnteateruk = { + "anteateruk", "anteater", NULL, NULL, "1983", + "The Anteater (UK)\0", NULL, "Free Enterprise Games", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, AnteaterukRomInfo, AnteaterukRomName, NULL, NULL, AnteaterukInputInfo, AnteaterukDIPInfo, + AnteaterukInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSpdcoin = { + "spdcoin", NULL, NULL, NULL, "1984", + "Speed Coin (prototype)\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_PROTOTYPE, 2, HARDWARE_GALAXIAN, GBF_MISC, 0, + NULL, SpdcoinRomInfo, SpdcoinRomName, NULL, NULL, SpdcoinInputInfo, SpdcoinDIPInfo, + ScobraInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSuperbon = { + "superbon", NULL, NULL, NULL, "1985", + "Agent Super Bond (scobra hardware)\0", "Bad Colours", "Signaton USA", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, SuperbonRomInfo, SuperbonRomName, NULL, NULL, SuperbonInputInfo, SuperbonDIPInfo, + SuperbonInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvCalipso = { + "calipso", NULL, NULL, NULL, "1982", + "Calipso\0", NULL, "Stern (Tago license)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_MAZE, 0, + NULL, CalipsoRomInfo, CalipsoRomName, NULL, NULL, CalipsoInputInfo, CalipsoDIPInfo, + CalipsoInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMoonwar = { + "moonwar", NULL, NULL, NULL, "1981", + "Moonwar\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SHOOT, 0, + NULL, MoonwarRomInfo, MoonwarRomName, NULL, NULL, MoonwarInputInfo, MoonwarDIPInfo, + MoonwarInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMoonwara = { + "moonwara", "moonwar", NULL, NULL, "1981", + "Moonwar (older)\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SHOOT, 0, + NULL, MoonwaraRomInfo, MoonwaraRomName, NULL, NULL, MoonwarInputInfo, MoonwaraDIPInfo, + MoonwarInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvStratgyx = { + "stratgyx", NULL, NULL, NULL, "1981", + "Strategy X\0", NULL, "Konami", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, StratgyxRomInfo, StratgyxRomName, NULL, NULL, StratgyxInputInfo, StratgyxDIPInfo, + StratgyxInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvStratgys = { + "stratgys", "stratgyx", NULL, NULL, "1981", + "Strategy X (Stern)\0", NULL, "Konami (Stern License)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, StratgysRomInfo, StratgysRomName, NULL, NULL, StratgyxInputInfo, StratgyxDIPInfo, + StratgyxInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvStrongx = { + "strongx", "stratgyx", NULL, NULL, "1982", + "Strong X\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_VERSHOOT, 0, + NULL, StrongxRomInfo, StrongxRomName, NULL, NULL, StratgyxInputInfo, StratgyxDIPInfo, + StratgyxInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDarkplnt = { + "darkplnt", NULL, NULL, NULL, "1982", + "Dark Planet\0", "Dial doesn't work very well", "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SHOOT, 0, + NULL, DarkplntRomInfo, DarkplntRomName, NULL, NULL, DarkplntInputInfo, DarkplntDIPInfo, + DarkplntInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvRescue = { + "rescue", NULL, NULL, NULL, "1982", + "Rescue\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, RescueRomInfo, RescueRomName, NULL, NULL, RescueInputInfo, RescueDIPInfo, + RescueInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAponow = { + "aponow", "rescue", NULL, NULL, "1982", + "Apocaljpse Now\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, AponowRomInfo, AponowRomName, NULL, NULL, RescueInputInfo, RescueDIPInfo, + RescueInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMinefld = { + "minefld", NULL, NULL, NULL, "1983", + "Minefield\0", NULL, "Stern", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, MinefldRomInfo, MinefldRomName, NULL, NULL, RescueInputInfo, MinefldDIPInfo, + MinefldInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHustler = { + "hustler", NULL, NULL, NULL, "1981", + "Video Hustler\0", NULL, "Konami", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, + NULL, HustlerRomInfo, HustlerRomName, NULL, NULL, HustlerInputInfo, HustlerDIPInfo, + HustlerInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvBilliard = { + "billiard", "hustler", NULL, NULL, "1981", + "The Billiards\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, + NULL, BilliardRomInfo, BilliardRomName, NULL, NULL, HustlerInputInfo, HustlerDIPInfo, + BilliardInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHustlerb = { + "hustlerb", "hustler", NULL, NULL, "1981", + "Video Hustler (bootleg)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, + NULL, HustlerbRomInfo, HustlerbRomName, NULL, NULL, HustlerInputInfo, HustlerDIPInfo, + HustlerbInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMimonkey = { + "mimonkey", NULL, NULL, NULL, "198?", + "Mighty Monkey\0", NULL, "Universal Video Games", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, MimonkeyRomInfo, MimonkeyRomName, NULL, NULL, AtlantisInputInfo, MimonkeyDIPInfo, + MimonkeyInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvMimonsco = { + "mimonsco", "mimonkey", NULL, NULL, "198?", + "Mighty Monkey (bootleg on Super Cobra hardware)\0", NULL, "bootleg", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, MimonscoRomInfo, MimonscoRomName, NULL, NULL, AtlantisInputInfo, MimonscoDIPInfo, + MimonscoInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// Dambusters based hardware - background can take priority over all graphics except high colour chars +static struct BurnRomInfo DambustrRomDesc[] = { + { "db11a.pr11", 0x01000, 0x427bd3fb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db9a.pr9", 0x01000, 0x57164563, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db10a.pr10", 0x01000, 0x075b9c5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db12a.pr12", 0x01000, 0xed01a68b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db8a.pr8", 0x01000, 0xfd041ff4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db6a.pr6", 0x01000, 0x448db54b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db7a.pr7", 0x01000, 0x675b1f5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db5a.pr5", 0x01000, 0x75659ecc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "db3a.pr3", 0x01000, 0x9e9a9710, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "db1a.pr1", 0x01000, 0x4cb964cd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "db4a.pr3", 0x01000, 0xd9d2df33, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "db2a.pr2", 0x01000, 0x0a0a6af5, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mi-7603-5.ic4", 0x00020, 0xf131f92f, BRF_GRA | GAL_ROM_PROM }, + + { "mi-7603-5.ic3", 0x00020, 0xe2a54c47, BRF_OPT }, // timing? +}; + +STD_ROM_PICK(Dambustr) +STD_ROM_FN(Dambustr) + +static struct BurnRomInfo DambustraRomDesc[] = { + { "db11.pr11", 0x01000, 0x427bd3fb, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db9a.pr9", 0x01000, 0x57164563, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db10a.pr10", 0x01000, 0x075b9c5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db12a.pr12", 0x01000, 0xed01a68b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db8a.pr8", 0x01000, 0xfd041ff4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db6.pr6", 0x01000, 0x56d301a9, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db7a.pr7", 0x01000, 0x675b1f5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db5a.pr5", 0x01000, 0x75659ecc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "db3a.rom", 0x01000, 0x2347e26e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "db1a.pr1", 0x01000, 0x4cb964cd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "db4a.pr3", 0x01000, 0xd9d2df33, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "db2a.pr2", 0x01000, 0x0a0a6af5, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mi-7603-5.ic4", 0x00020, 0xf131f92f, BRF_GRA | GAL_ROM_PROM }, + + { "mi-7603-5.ic3", 0x00020, 0xe2a54c47, BRF_OPT }, // timing? +}; + +STD_ROM_PICK(Dambustra) +STD_ROM_FN(Dambustra) + +static struct BurnRomInfo DambustrukRomDesc[] = { + { "db11.bin", 0x01000, 0x9e6b34fe, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db9.pr9", 0x01000, 0x57164563, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db10p.bin", 0x01000, 0xc129c57b, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db12.bin", 0x01000, 0xea4c65f5, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db8.pr8", 0x01000, 0xfd041ff4, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db6p.bin", 0x01000, 0x35dcee01, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db7.pr7", 0x01000, 0x675b1f5e, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + { "db5.pr5", 0x01000, 0x75659ecc, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "db3.pr3", 0x01000, 0x9e9a9710, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "db1ap.pr1", 0x01000, 0x4cb964cd, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "db4.pr3", 0x01000, 0xd9d2df33, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "db2.pr2", 0x01000, 0x0a0a6af5, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "mi-7603-5.ic4", 0x00020, 0xf131f92f, BRF_GRA | GAL_ROM_PROM }, + + { "mi-7603-5.ic3", 0x00020, 0xe2a54c47, BRF_OPT }, // timing? +}; + +STD_ROM_PICK(Dambustruk) +STD_ROM_FN(Dambustruk) + +UINT8 __fastcall DambustrZ80Read(UINT16 a) +{ + if (a >= 0xd900 && a <= 0xdbff) { + // ??? + return 0xff; + } + + switch (a) { + case 0xe000: { + return GalInput[0] | GalDip[0]; + } + + case 0xe800: { + return GalInput[1] | GalDip[1]; + } + + case 0xf000: { + return GalInput[2] | GalDip[2]; + } + + case 0xf800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall DambustrZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0xd800 && a <= 0xd8ff) { + INT32 Offset = a - 0xd800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0xd900 && a <= 0xdbff) { + // ??? + return; + } + + switch (a) { + case 0x8000: { + DambustrBgColour1 = (BIT(d, 2) << 2) | (BIT(d, 1) << 1) | BIT(d, 0); + DambustrBgColour2 = (BIT(d, 6) << 2) | (BIT(d, 5) << 1) | BIT(d, 4); + DambustrBgPriority = BIT(d, 3); + GalGfxBank[0] = BIT(d, 7); + return; + } + + case 0x8001: { + DambustrBgSplitLine = d; + return; + } + + case 0xe002: + case 0xe003: { + // coin_count_0_w + return; + } + + case 0xe004: + case 0xe005: + case 0xe006: + case 0xe007: { + GalaxianLfoFreqWrite(a - 0xe004, d); + return; + } + + case 0xe800: + case 0xe801: + case 0xe802: + case 0xe803: + case 0xe804: + case 0xe805: + case 0xe806: + case 0xe807: { + GalaxianSoundWrite(a - 0xe800, d); + return; + } + + case 0xf001: { + GalIrqFire = d & 1; + return; + } + + case 0xf004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xf006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xf007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xf800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall DambustrZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall DambustrZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +static void DambustrPostLoad() +{ + UINT8 Temp; + + GalTempRom = (UINT8*)BurnMalloc(0x4000); + memcpy(GalTempRom, GalZ80Rom1, 0x4000); + for (INT32 i = 0; i < 0x4000; i++) { + GalZ80Rom1[i] = GalTempRom[BITSWAP16(i, 15, 14, 13, 12, 4, 10, 9, 8, 7, 6, 5, 3, 11, 2, 1, 0)]; + } + BurnFree(GalTempRom); + + for (INT32 i = 0; i < 0x1000; i++) { + Temp = GalZ80Rom1[0x5000 + i]; + GalZ80Rom1[0x5000 + i] = GalZ80Rom1[0x6000 + i]; + GalZ80Rom1[0x6000 + i] = GalZ80Rom1[0x1000 + i]; + GalZ80Rom1[0x1000 + i] = Temp; + } + + for (INT32 i = 0; i < 0x1000; i++) { + GalZ80Rom1[0x1000 + i] = BITSWAP08(GalZ80Rom1[0x1000 + i], 7, 6, 5, 1, 3, 2, 4, 0); + GalZ80Rom1[0x4000 + i] = BITSWAP08(GalZ80Rom1[0x4000 + i], 7, 6, 5, 1, 3, 2, 4, 0); + GalZ80Rom1[0x5000 + i] = BITSWAP08(GalZ80Rom1[0x5000 + i], 7, 6, 5, 1, 3, 2, 4, 0); + } + + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(DambustrZ80Read); + ZetSetWriteHandler(DambustrZ80Write); + ZetSetInHandler(DambustrZ80PortRead); + ZetSetOutHandler(DambustrZ80PortWrite); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0xc000, 0xc7ff, 0, GalZ80Ram1); + ZetMapArea(0xc000, 0xc7ff, 1, GalZ80Ram1); + ZetMapArea(0xc000, 0xc7ff, 2, GalZ80Ram1); + ZetMapArea(0xd000, 0xd3ff, 0, GalVideoRam); + ZetMapArea(0xd000, 0xd3ff, 1, GalVideoRam); + ZetMapArea(0xd000, 0xd3ff, 2, GalVideoRam); + ZetMapArea(0xd400, 0xd7ff, 0, GalVideoRam); + ZetMapArea(0xd400, 0xd7ff, 1, GalVideoRam); + ZetMapArea(0xd400, 0xd7ff, 2, GalVideoRam); + ZetMapArea(0xd800, 0xd8ff, 0, GalSpriteRam); + ZetMapArea(0xd800, 0xd8ff, 2, GalSpriteRam); + ZetClose(); +} + +static INT32 DambustrInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = DambustrPostLoad; + + nRet = GalInit(); + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + UINT8 Temp[16]; + nRet = BurnLoadRom(GalTempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x1000, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x2000, GAL_ROM_OFFSET_TILES_SHARED + 2, 1); if (nRet) return 1; + nRet = BurnLoadRom(GalTempRom + 0x3000, GAL_ROM_OFFSET_TILES_SHARED + 3, 1); if (nRet) return 1; + for (UINT32 i = 0; i < GalTilesSharedRomSize; i += 16) { + UINT32 j; + + for (j = 0; j < 16; j++) { + Temp[j] = GalTempRom[i + j]; + } + + for (j = 0; j < 8; j++) { + GalTempRom[i + j + 0] = Temp[(j * 2) + 0]; + GalTempRom[i + j + 8] = Temp[(j * 2) + 1]; + } + } + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + + GalCalcPaletteFunction = DambustrCalcPalette; + GalRenderBackgroundFunction = DambustrDrawBackground; + GalDrawBulletsFunction = DambustrDrawBullets; + GalExtendTileInfoFunction = DambustrExtendTileInfo; + GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; + GalRenderFrameFunction = DambustrRenderFrame; + + GalSpriteClipStart = 0; + GalSpriteClipEnd = 255; + + GalVideoRam2 = (UINT8*)BurnMalloc(0x400); + + return nRet; +} + +struct BurnDriver BurnDrvDambustr = { + "dambustr", NULL, NULL, NULL, "1981", + "Dambusters (US, set 1)\0", NULL, "South West Research", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, DambustrRomInfo, DambustrRomName, NULL, NULL, DambustrInputInfo, DambustrDIPInfo, + DambustrInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvDambustra = { + "dambustra", "dambustr", NULL, NULL, "1981", + "Dambusters (US, set 2)\0", NULL, "South West Research", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, DambustraRomInfo, DambustraRomName, NULL, NULL, DambustrInputInfo, DambustrDIPInfo, + DambustrInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvDambustruk = { + "dambustruk", "dambustr", NULL, NULL, "1981", + "Dambusters (UK)\0", NULL, "South West Research", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_GALAXIAN, GBF_HORSHOOT, 0, + NULL, DambustrukRomInfo, DambustrukRomName, NULL, NULL, DambustrInputInfo, DambustrDIPInfo, + DambustrInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +// S2650 Based Games +static struct BurnRomInfo HunchbkgRomDesc[] = { + { "gal_hb_kl", 0x00800, 0x3977650e, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "gal_hb_hj", 0x00800, 0xdb489c3d, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "gal_hb_cp", 0x00020, 0xcbff6762, BRF_GRA | GAL_ROM_PROM }, + + { "gal_hb_1", 0x00800, 0x46590e9b, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "gal_hb_2", 0x00800, 0x4e6e671c, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "gal_hb_3", 0x00800, 0xd29dc242, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "gal_hb_4", 0x00800, 0xd409d292, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "gal_hb_5", 0x00800, 0x29d3a8c4, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "gal_hb_6", 0x00800, 0xb016fd15, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "gal_hb_7", 0x00800, 0xd2731d27, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "gal_hb_8", 0x00800, 0xe4b1a666, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, +}; + +STD_ROM_PICK(Hunchbkg) +STD_ROM_FN(Hunchbkg) + +static struct BurnRomInfo DrivfrcgRomDesc[] = { + { "dfgj2.bin", 0x01000, 0x8e19f1e7, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "dfgj1.bin", 0x01000, 0x86b60ca8, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "dfgl2.bin", 0x01000, 0xea5e9959, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "dfgl1.bin", 0x01000, 0xb7ed195c, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "top.clr", 0x00020, 0x3110ddae, BRF_GRA | GAL_ROM_PROM }, + { "bot.clr", 0x00020, 0x0f0782af, BRF_GRA | GAL_ROM_PROM }, + + { "dfgp1.bin", 0x01000, 0x52d5e77d, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "dfgp2.bin", 0x01000, 0x9cf4dbce, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "dfgp3.bin", 0x01000, 0x79763f62, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "dfgp4.bin", 0x01000, 0xdd95338b, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, +}; + +STD_ROM_PICK(Drivfrcg) +STD_ROM_FN(Drivfrcg) + +static struct BurnRomInfo DrivfrctRomDesc[] = { + { "01.bin", 0x02000, 0x300a6750, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "02.bin", 0x02000, 0xf04e14c4, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "tbp18s030.02", 0x00020, 0x3110ddae, BRF_GRA | GAL_ROM_PROM }, + { "tbp18s030.01", 0x00020, 0x0f0782af, BRF_GRA | GAL_ROM_PROM }, + + { "03.bin", 0x04000, 0x9ab604cb, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + + { "tbp24s10.bin", 0x00100, 0x8c0d886d, BRF_OPT }, + { "tbp28s42.bin", 0x00200, 0x9b8f310a, BRF_OPT }, +}; + +STD_ROM_PICK(Drivfrct) +STD_ROM_FN(Drivfrct) + +static struct BurnRomInfo DrivfrcbRomDesc[] = { + { "df1.bin", 0x02000, 0x8adc3de0, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "df2.bin", 0x02000, 0x6d95ec35, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "top.clr", 0x00020, 0x3110ddae, BRF_GRA | GAL_ROM_PROM }, + { "bot.clr", 0x00020, 0x0f0782af, BRF_GRA | GAL_ROM_PROM }, + + { "dfp.bin", 0x04000, 0xb5b2981d, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, +}; + +STD_ROM_PICK(Drivfrcb) +STD_ROM_FN(Drivfrcb) + +static struct BurnRomInfo RacknrolRomDesc[] = { + { "horz_g.bin", 0x04000, 0x97069ad5, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "horz_r.bin", 0x04000, 0xff64e84b, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.bin", 0x00020, 0x737802bf, BRF_GRA | GAL_ROM_PROM }, + + { "horz_p.bin", 0x04000, 0x32ca5b43, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + + { "82s147.bin", 0x00200, 0xaace7fa5, BRF_OPT }, // unknown +}; + +STD_ROM_PICK(Racknrol) +STD_ROM_FN(Racknrol) + +static struct BurnRomInfo HexpoolRomDesc[] = { + { "vert_g.bin", 0x04000, 0x7e257e80, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "vert_r.bin", 0x04000, 0xc5f0851e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.bin", 0x00020, 0x737802bf, BRF_GRA | GAL_ROM_PROM }, + + { "vert_p.bin", 0x04000, 0xbdb078fc, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + + { "82s147.bin", 0x00200, 0xaace7fa5, BRF_OPT }, // unknown +}; + +STD_ROM_PICK(Hexpool) +STD_ROM_FN(Hexpool) + +static struct BurnRomInfo HexpoolaRomDesc[] = { + { "rom.1m", 0x04000, 0x7e257e80, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "rom.1l", 0x04000, 0xc5f0851e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "82s123.11r", 0x00020, 0xdeb2fcf4, BRF_GRA | GAL_ROM_PROM }, + + { "rom.4l", 0x04000, 0x2ca8018d, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + + { "82s147.5pr", 0x00200, 0xcf496b1e, BRF_OPT }, // unknown + + { "82s153.6pr.bin",0x000eb, 0xbc07939a, BRF_OPT }, // PLD +}; + +STD_ROM_PICK(Hexpoola) +STD_ROM_FN(Hexpoola) + +static struct BurnRomInfo HunchbksRomDesc[] = { + { "11d_snd.bin", 0x00800, 0x88226086, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "5f_hb09.bin", 0x00800, 0xdb489c3d, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "5h_hb10.bin", 0x00800, 0x3977650e, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "6e_prom.bin", 0x00020, 0x01004d3f, BRF_GRA | GAL_ROM_PROM }, + + { "2c_hb01.bin", 0x00800, 0x8bebd834, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "2e_hb02.bin", 0x00800, 0x07de4229, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "2f_hb03.bin", 0x00800, 0xb75a0dfc, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "2h_hb04.bin", 0x00800, 0xf3206264, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "2j_hb05.bin", 0x00800, 0x1bb78728, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "2l_hb06.bin", 0x00800, 0xf25ed680, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "2m_hb07.bin", 0x00800, 0xc72e0e17, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "2p_hb08.bin", 0x00800, 0x412087b0, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, +}; + +STD_ROM_PICK(Hunchbks) +STD_ROM_FN(Hunchbks) + +static struct BurnRomInfo HncholmsRomDesc[] = { + { "hncholym.5c", 0x00800, 0xe7758775, BRF_ESS | BRF_PRG | GAL_ROM_Z80_PROG1 }, + + { "hncholym.5f", 0x01000, 0x75ad3542, BRF_GRA | GAL_ROM_TILES_SHARED }, + { "hncholym.5h", 0x01000, 0x6fec9dd3, BRF_GRA | GAL_ROM_TILES_SHARED }, + + { "prom.6e", 0x00020, 0x4e3caeab, BRF_GRA | GAL_ROM_PROM }, + + { "hncholym.2d", 0x00800, 0xfb453f9c, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "hncholym.2e", 0x00800, 0xb1429420, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "hncholym.2f", 0x00800, 0xafc98e28, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "hncholym.2h", 0x00800, 0x6785bf17, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "hncholym.2j", 0x00800, 0x0e1e4133, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "hncholym.2l", 0x00800, 0x6e982609, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "hncholym.2m", 0x00800, 0xb9141914, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + { "hncholym.2p", 0x00800, 0xca37b55b, BRF_ESS | BRF_PRG | GAL_ROM_S2650_PROG1 }, + + { "82s147.1a", 0x00200, 0xd461a48b, BRF_OPT }, +}; + +STD_ROM_PICK(Hncholms) +STD_ROM_FN(Hncholms) + +UINT8 HunchbkgS2650Read(UINT16 Address) +{ + switch (Address) { + case 0x1500: + case 0x3500: + case 0x5500: + case 0x7500: { + return GalInput[0] | GalDip[0]; + } + + case 0x1580: + case 0x3580: + case 0x5580: + case 0x7580: { + return GalInput[1] | GalDip[1]; + } + + case 0x1600: + case 0x3600: + case 0x5600: + case 0x7600: { + return GalInput[2] | GalDip[2]; + } + + case 0x1680: + case 0x3680: + case 0x5680: + case 0x7680: { + // ??? + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Read %04x\n"), Address); + } + } + + return 0; +} + +void HunchbkgS2650Write(UINT16 Address, UINT8 Data) +{ + if ((Address >= 0x1480 && Address <= 0x14ff) || (Address >= 0x3480 && Address <= 0x34ff) || (Address >= 0x5480 && Address <= 0x54ff) || (Address >= 0x7480 && Address <= 0x74ff)) { + INT32 Offset = Address & 0x7f; + + GalSpriteRam[Offset] = Data; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = Data; + } + } + + return; + } + + switch (Address) { + case 0x1503: + case 0x3503: + case 0x5503: + case 0x7503: { + // coin_count_0_w + return; + } + + case 0x1580: + case 0x1581: + case 0x1582:{ + GalaxianSoundWrite(Address - 0x1580, Data); + return; + } + + case 0x3580: + case 0x3581: + case 0x3582:{ + GalaxianSoundWrite(Address - 0x3580, Data); + return; + } + + case 0x5580: + case 0x5581: + case 0x5582:{ + GalaxianSoundWrite(Address - 0x5580, Data); + return; + } + + case 0x7580: + case 0x7581: + case 0x7582:{ + GalaxianSoundWrite(Address - 0x7580, Data); + return; + } + + case 0x1583: + case 0x3583: + case 0x5583: + case 0x7583: { + // nop + return; + } + + case 0x1584: + case 0x1585: + case 0x1586: + case 0x1587: { + GalaxianLfoFreqWrite(Address - 0x1584, Data); + return; + } + + case 0x3584: + case 0x3585: + case 0x3586: + case 0x3587: { + GalaxianLfoFreqWrite(Address - 0x3584, Data); + return; + } + + case 0x5584: + case 0x5585: + case 0x5586: + case 0x5587: { + GalaxianLfoFreqWrite(Address - 0x5584, Data); + return; + } + + case 0x7584: + case 0x7585: + case 0x7586: + case 0x7587: { + GalaxianLfoFreqWrite(Address - 0x7584, Data); + return; + } + + case 0x1600: + case 0x3600: + case 0x5600: + case 0x7600: { + // nop + return; + } + + case 0x1601: + case 0x3601: + case 0x5601: + case 0x7601: { + // nop + return; + } + + case 0x1604: + case 0x3604: + case 0x5604: + case 0x7604: { + // nop + return; + } + + case 0x1606: + case 0x3606: + case 0x5606: + case 0x7606: { + GalFlipScreenX = Data & 1; + return; + } + + case 0x1607: + case 0x3607: + case 0x5607: + case 0x7607: { + GalFlipScreenY = Data & 1; + return; + } + + case 0x1680: + case 0x3680: + case 0x5680: + case 0x7680: { + GalPitch = Data; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Write %04x, %02x\n"), Address, Data); + } + } +} + +UINT8 HunchbkgS2650PortRead(UINT16 Port) +{ + switch (Port) { + case S2650_DATA_PORT: { + // nop + return 0; + } + + case S2650_SENSE_PORT: { + return GalVBlank ? 0x80 : 0x00; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); + } + } + + return 0; +} + +void HunchbkgS2650PortWrite(UINT16 Port, UINT8 Data) +{ + switch (Port) { + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Write %04x, %02x\n"), Port, Data); + } + } +} + +UINT8 DrivfrcgS2650Read(UINT16 Address) +{ + switch (Address) { + case 0x1500: + case 0x3500: + case 0x5500: + case 0x7500: { + return GalInput[0] | GalDip[0]; + } + + case 0x1580: + case 0x3580: + case 0x5580: + case 0x7580: { + return GalInput[1] | GalDip[1]; + } + + case 0x1600: + case 0x3600: + case 0x5600: + case 0x7600: { + return GalInput[2] | GalDip[2]; + } + + case 0x1700: + case 0x3700: + case 0x5700: + case 0x7700: { + return GalInput[3] | GalDip[3]; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Read %04x\n"), Address); + } + } + + return 0; +} + +void DrivfrcgS2650Write(UINT16 Address, UINT8 Data) +{ + if ((Address >= 0x1480 && Address <= 0x14ff) || (Address >= 0x3480 && Address <= 0x34ff) || (Address >= 0x5480 && Address <= 0x54ff) || (Address >= 0x7480 && Address <= 0x74ff)) { + INT32 Offset = Address & 0x7f; + + GalSpriteRam[Offset] = Data; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = Data; + } + } + + return; + } + + switch (Address) { + case 0x1503: + case 0x3503: + case 0x5503: + case 0x7503: { + // coin_count_0_w + return; + } + + case 0x1580: + case 0x1581: + case 0x1582:{ + GalaxianSoundWrite(Address - 0x1580, Data); + return; + } + + case 0x3580: + case 0x3581: + case 0x3582:{ + GalaxianSoundWrite(Address - 0x3580, Data); + return; + } + + case 0x5580: + case 0x5581: + case 0x5582:{ + GalaxianSoundWrite(Address - 0x5580, Data); + return; + } + + case 0x7580: + case 0x7581: + case 0x7582:{ + GalaxianSoundWrite(Address - 0x7580, Data); + return; + } + + case 0x1583: + case 0x3583: + case 0x5583: + case 0x7583: { + // nop + return; + } + + case 0x1585: + case 0x3585: + case 0x5585: + case 0x7585: { + // nop + return; + } + + case 0x1586: + case 0x1587: { + GalaxianLfoFreqWrite(Address - 0x1586, Data); + return; + } + + case 0x3586: + case 0x3587: { + GalaxianLfoFreqWrite(Address - 0x3586, Data); + return; + } + + case 0x5586: + case 0x5587: { + GalaxianLfoFreqWrite(Address - 0x5586, Data); + return; + } + + case 0x7586: + case 0x7587: { + GalaxianLfoFreqWrite(Address - 0x7586, Data); + return; + } + + case 0x1600: + case 0x3600: + case 0x5600: + case 0x7600: { + GalPitch = Data; + return; + } + + case 0x1700: + case 0x1701: { + // nop + return; + } + + case 0x1704: + case 0x1705: + case 0x1706: + case 0x1707: + case 0x3704: + case 0x3705: + case 0x3706: + case 0x3707: + case 0x5704: + case 0x5705: + case 0x5706: + case 0x5707: + case 0x7704: + case 0x7705: + case 0x7706: + case 0x7707: { + INT32 Offset = Address & 0x03; + GalVol = (GalVol & ~(1 << Offset)) | ((Data & 1) << Offset); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Write %04x, %02x\n"), Address, Data); + } + } +} + +UINT8 DrivfrcgS2650PortRead(UINT16 Port) +{ + switch (Port) { + case 0x00: { + switch (s2650GetPc()) { + case 0x02e: + case 0x297: { + return 0x01; + } + } + bprintf(PRINT_NORMAL, _T("%x\n"), s2650GetPc()); + return 0x00; + } + + case S2650_SENSE_PORT: { + return GalVBlank ? 0x80 : 0x00; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); + } + } + + return 0; +} + +void DrivfrcgS2650PortWrite(UINT16 Port, UINT8 Data) +{ + switch (Port) { + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Write %04x, %02x\n"), Port, Data); + } + } +} + +UINT8 RacknrolS2650Read(UINT16 Address) +{ + switch (Address) { + case 0x1500: + case 0x3500: + case 0x5500: + case 0x7500: { + return GalInput[0] | GalDip[0]; + } + + case 0x1580: + case 0x3580: + case 0x5580: + case 0x7580: { + return GalInput[1] | GalDip[1]; + } + + case 0x1600: + case 0x3600: + case 0x5600: + case 0x7600: { + return GalInput[2] | GalDip[2]; + } + + case 0x1680: + case 0x3680: + case 0x5680: + case 0x7680: { + // ??? + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Read %04x\n"), Address); + } + } + + return 0; +} + +void RacknrolS2650Write(UINT16 Address, UINT8 Data) +{ + if ((Address >= 0x1400 && Address <= 0x14ff) || (Address >= 0x3400 && Address <= 0x34ff) || (Address >= 0x5400 && Address <= 0x54ff) || (Address >= 0x7400 && Address <= 0x74ff)) { + INT32 Offset = Address & 0xff; + + GalSpriteRam[Offset] = Data; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = Data; + } + } + + return; + } + + switch (Address) { + case 0x1601: + case 0x3601: + case 0x5601: + case 0x7601: { + // nop + return; + } + + case 0x1606: + case 0x3606: + case 0x5606: + case 0x7606: { + GalFlipScreenX = Data & 1; + return; + } + + case 0x1607: + case 0x3607: + case 0x5607: + case 0x7607: { + GalFlipScreenY = Data & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Write %04x, %02x\n"), Address, Data); + } + } +} + +UINT8 RacknrolS2650PortRead(UINT16 Port) +{ + switch (Port) { + case S2650_SENSE_PORT: { + return GalVBlank ? 0x80 : 0x00; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); + } + } + + return 0; +} + +void RacknrolS2650PortWrite(UINT16 Port, UINT8 Data) +{ + if (Port >= 0x0020 && Port <= 0x003f) { + GalGfxBank[Port - 0x0020] = Data; + return; + } + + switch (Port) { + case 0x001d: { + SN76496Write(0, Data); + return; + } + + case 0x001e: { + SN76496Write(1, Data); + return; + } + + case 0x001f: { + SN76496Write(2, Data); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Write %04x, %02x\n"), Port, Data); + } + } +} + +UINT8 HexpoolaS2650PortRead(UINT16 Port) +{ + switch (Port) { + case 0x0000: { + // nop + return 0; + } + + case S2650_DATA_PORT: { + switch (s2650GetPc()) { + case 0x22: return 0x00; + case 0x31: return 0x01; + } + return 0; + } + + case S2650_SENSE_PORT: { + return GalVBlank ? 0x80 : 0x00; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); + } + } + + return 0; +} + +void HexpoolaS2650PortWrite(UINT16 Port, UINT8 Data) +{ + if (Port >= 0x0020 && Port <= 0x003f) { + GalGfxBank[Port - 0x0020] = Data; + return; + } + + switch (Port) { + case S2650_DATA_PORT: { + SN76496Write(0, Data); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Write %04x, %02x\n"), Port, Data); + } + } +} + +UINT8 HunchbksS2650Read(UINT16 Address) +{ + switch (Address) { + case 0x1210: + case 0x1211: + case 0x1212: + case 0x1213: + case 0x3210: + case 0x3211: + case 0x3212: + case 0x3213: + case 0x5210: + case 0x5211: + case 0x5212: + case 0x5213: + case 0x7210: + case 0x7211: + case 0x7212: + case 0x7213: { + return ppi8255_r(0, Address & 0x03); + } + + case 0x1500: + case 0x1501: + case 0x1502: + case 0x1503: + case 0x3500: + case 0x3501: + case 0x3502: + case 0x3503: + case 0x5500: + case 0x5501: + case 0x5502: + case 0x5503: + case 0x7500: + case 0x7501: + case 0x7502: + case 0x7503: { + return ppi8255_r(0, Address & 0x03); + } + + case 0x1680: + case 0x3680: + case 0x5680: + case 0x7680: { + // watchdog read + return 0; + } + + case 0x1780: + case 0x3780: + case 0x5780: + case 0x7780: { + // watchdog read + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Read %04x\n"), Address); + } + } + + return 0; +} + +void HunchbksS2650Write(UINT16 Address, UINT8 Data) +{ + if ((Address >= 0x1400 && Address <= 0x14ff) || (Address >= 0x3400 && Address <= 0x34ff) || (Address >= 0x5400 && Address <= 0x54ff) || (Address >= 0x7400 && Address <= 0x74ff)) { + INT32 Offset = Address & 0xff; + + GalSpriteRam[Offset] = Data; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = Data; + } + } + + return; + } + + switch (Address) { + case 0x1210: + case 0x1211: + case 0x1212: + case 0x1213: + case 0x3210: + case 0x3211: + case 0x3212: + case 0x3213: + case 0x5210: + case 0x5211: + case 0x5212: + case 0x5213: + case 0x7210: + case 0x7211: + case 0x7212: + case 0x7213: { + ppi8255_w(1, Address & 0x03, Data); + return; + } + + case 0x1500: + case 0x1501: + case 0x1502: + case 0x1503: + case 0x3500: + case 0x3501: + case 0x3502: + case 0x3503: + case 0x5500: + case 0x5501: + case 0x5502: + case 0x5503: + case 0x7500: + case 0x7501: + case 0x7502: + case 0x7503: { + ppi8255_w(0, Address & 0x03, Data); + return; + } + + case 0x1600: + case 0x3600: + case 0x5600: + case 0x7600: { + // nop + return; + } + + case 0x1601: + case 0x3601: + case 0x5601: + case 0x7601: { + // nop + return; + } + + case 0x1606: + case 0x3606: + case 0x5606: + case 0x7606: { + GalFlipScreenX = Data & 1; + return; + } + + case 0x1607: + case 0x3607: + case 0x5607: + case 0x7607: { + GalFlipScreenY = Data & 1; + return; + } + + case 0x1700: + case 0x1701: { + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Write %04x, %02x\n"), Address, Data); + } + } +} + +UINT8 HunchbksS2650PortRead(UINT16 Port) +{ + switch (Port) { + case S2650_DATA_PORT: { + // nop + return 0; + } + + case S2650_SENSE_PORT: { + return GalVBlank ? 0x80 : 0x00; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); + } + } + + return 0; +} + +void HunchbksS2650PortWrite(UINT16 Port, UINT8 Data) +{ + switch (Port) { + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Write %04x, %02x\n"), Port, Data); + } + } +} + +UINT8 HncholmsS2650PortRead(UINT16 Port) +{ + switch (Port) { + case 0x0000: { + switch (s2650GetPc()) { + case 0x02b: return 1; + case 0xa27: return 1; + } + return 0; + } + + case S2650_DATA_PORT: { + // nop + return 0; + } + + case S2650_SENSE_PORT: { + return GalVBlank ? 0x80 : 0x00; + } + + default: { + bprintf(PRINT_NORMAL, _T("S2650 #1 Port Read %04x\n"), Port); + } + } + + return 0; +} + +static INT32 GalS2650ReturnVector(INT32) +{ + return 0x03; +} + +static void S2650PostLoad() +{ + s2650Init(1); + s2650Open(0); + s2650MapMemory(GalS2650Rom1 + 0x0000, 0x0000, 0x0fff, S2650_ROM); + s2650MapMemory(GalSpriteRam, 0x1480, 0x14ff, S2650_READ); + s2650MapMemory(GalVideoRam, 0x1800, 0x1bff, S2650_RAM); + s2650MapMemory(GalZ80Ram1, 0x1c00, 0x1fff, S2650_RAM); + s2650MapMemory(GalS2650Rom1 + 0x1000, 0x2000, 0x2fff, S2650_ROM); + s2650MapMemory(GalSpriteRam, 0x3480, 0x34ff, S2650_READ); + s2650MapMemory(GalVideoRam, 0x3800, 0x3bff, S2650_RAM); + s2650MapMemory(GalZ80Ram1, 0x3c00, 0x3fff, S2650_RAM); + s2650MapMemory(GalS2650Rom1 + 0x2000, 0x4000, 0x4fff, S2650_ROM); + s2650MapMemory(GalSpriteRam, 0x5480, 0x54ff, S2650_READ); + s2650MapMemory(GalVideoRam, 0x5800, 0x5bff, S2650_RAM); + s2650MapMemory(GalZ80Ram1, 0x5c00, 0x5fff, S2650_RAM); + s2650MapMemory(GalS2650Rom1 + 0x3000, 0x6000, 0x6fff, S2650_ROM); + s2650MapMemory(GalSpriteRam, 0x7480, 0x74ff, S2650_READ); + s2650MapMemory(GalVideoRam, 0x7800, 0x7bff, S2650_RAM); + s2650MapMemory(GalZ80Ram1, 0x7c00, 0x7fff, S2650_RAM); + s2650SetReadHandler(HunchbkgS2650Read); + s2650SetWriteHandler(HunchbkgS2650Write); + s2650SetInHandler(HunchbkgS2650PortRead); + s2650SetOutHandler(HunchbkgS2650PortWrite); + s2650SetIrqCallback(GalS2650ReturnVector); + s2650Close(); +} + +static INT32 HunchbkgInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = S2650PostLoad; + + nRet = GalInit(); + + return nRet; +} + +static void DrivfrcgPostLoad() +{ + GalTempRom = (UINT8*)BurnMalloc(GalS2650Rom1Size); + memcpy(GalTempRom, GalS2650Rom1, GalS2650Rom1Size); + memcpy(GalS2650Rom1 + 0x1800, GalTempRom + 0x0000, 0x400); + memcpy(GalS2650Rom1 + 0x1c00, GalTempRom + 0x0400, 0x400); + memcpy(GalS2650Rom1 + 0x0000, GalTempRom + 0x0800, 0x400); + memcpy(GalS2650Rom1 + 0x0400, GalTempRom + 0x0c00, 0x400); + memcpy(GalS2650Rom1 + 0x0800, GalTempRom + 0x1000, 0x400); + memcpy(GalS2650Rom1 + 0x0c00, GalTempRom + 0x1400, 0x400); + memcpy(GalS2650Rom1 + 0x1000, GalTempRom + 0x1800, 0x400); + memcpy(GalS2650Rom1 + 0x1400, GalTempRom + 0x1c00, 0x400); + memcpy(GalS2650Rom1 + 0x3800, GalTempRom + 0x2000, 0x400); + memcpy(GalS2650Rom1 + 0x3c00, GalTempRom + 0x2400, 0x400); + memcpy(GalS2650Rom1 + 0x2000, GalTempRom + 0x2800, 0x400); + memcpy(GalS2650Rom1 + 0x2400, GalTempRom + 0x2c00, 0x400); + memcpy(GalS2650Rom1 + 0x2800, GalTempRom + 0x3000, 0x400); + memcpy(GalS2650Rom1 + 0x2c00, GalTempRom + 0x3400, 0x400); + memcpy(GalS2650Rom1 + 0x3000, GalTempRom + 0x3800, 0x400); + memcpy(GalS2650Rom1 + 0x3400, GalTempRom + 0x3c00, 0x400); + BurnFree(GalTempRom); + + S2650PostLoad(); + s2650Open(0); + s2650SetReadHandler(DrivfrcgS2650Read); + s2650SetWriteHandler(DrivfrcgS2650Write); + s2650SetInHandler(DrivfrcgS2650PortRead); + s2650SetOutHandler(DrivfrcgS2650PortWrite); + s2650Close(); +} + +static INT32 DrivfrcgInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = DrivfrcgPostLoad; + + nRet = GalInit(); + + GalCalcPaletteFunction = RockclimCalcPalette; + GalExtendTileInfoFunction = Ad2083ExtendTileInfo; + GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; + + return nRet; +} + +static INT32 DrivfrcbInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = DrivfrcgPostLoad; + + nRet = GalInit(); + + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + UINT8 *TempRom = (UINT8*)BurnMalloc(0x2000); + nRet = BurnLoadRom(TempRom, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x1000, TempRom + 0x0000, 0x1000); + memcpy(GalTempRom + 0x0000, TempRom + 0x1000, 0x1000); + nRet = BurnLoadRom(TempRom, GAL_ROM_OFFSET_TILES_SHARED + 1, 1); if (nRet) return 1; + memcpy(GalTempRom + 0x3000, TempRom + 0x0000, 0x1000); + memcpy(GalTempRom + 0x2000, TempRom + 0x1000, 0x1000); + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + BurnFree(TempRom); + + GalCalcPaletteFunction = RockclimCalcPalette; + GalExtendTileInfoFunction = Ad2083ExtendTileInfo; + GalExtendSpriteInfoFunction = MshuttleExtendSpriteInfo; + + return nRet; +} + +static void RacknrolPostLoad() +{ + s2650Init(1); + s2650Open(0); + s2650MapMemory(GalS2650Rom1 + 0x0000, 0x0000, 0x0fff, S2650_ROM); + s2650MapMemory(GalSpriteRam, 0x1400, 0x14ff, S2650_READ); + s2650MapMemory(GalVideoRam, 0x1800, 0x1bff, S2650_RAM); + s2650MapMemory(GalZ80Ram1, 0x1c00, 0x1fff, S2650_RAM); + s2650MapMemory(GalS2650Rom1 + 0x1000, 0x2000, 0x2fff, S2650_ROM); + s2650MapMemory(GalSpriteRam, 0x3400, 0x34ff, S2650_READ); + s2650MapMemory(GalVideoRam, 0x3800, 0x3bff, S2650_RAM); + s2650MapMemory(GalZ80Ram1, 0x3c00, 0x3fff, S2650_RAM); + s2650MapMemory(GalS2650Rom1 + 0x2000, 0x4000, 0x4fff, S2650_ROM); + s2650MapMemory(GalSpriteRam, 0x5400, 0x54ff, S2650_READ); + s2650MapMemory(GalVideoRam, 0x5800, 0x5bff, S2650_RAM); + s2650MapMemory(GalZ80Ram1, 0x5c00, 0x5fff, S2650_RAM); + s2650MapMemory(GalS2650Rom1 + 0x3000, 0x6000, 0x6fff, S2650_ROM); + s2650MapMemory(GalSpriteRam, 0x7400, 0x74ff, S2650_READ); + s2650MapMemory(GalVideoRam, 0x7800, 0x7bff, S2650_RAM); + s2650MapMemory(GalZ80Ram1, 0x7c00, 0x7fff, S2650_RAM); + s2650SetReadHandler(RacknrolS2650Read); + s2650SetWriteHandler(RacknrolS2650Write); + s2650SetInHandler(RacknrolS2650PortRead); + s2650SetOutHandler(RacknrolS2650PortWrite); + s2650SetIrqCallback(GalS2650ReturnVector); + s2650Close(); +} + +static INT32 RacknrolInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = RacknrolPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496; + + nRet = GalInit(); + + GalExtendTileInfoFunction = RacknrolExtendTileInfo; + + return nRet; +} + +static void HexpoolaPostLoad() +{ + RacknrolPostLoad(); + + s2650Open(0); + s2650SetInHandler(HexpoolaS2650PortRead); + s2650SetOutHandler(HexpoolaS2650PortWrite); + s2650Close(); +} + +static INT32 HexpoolaInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = HexpoolaPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_HEXPOOLASN76496; + + nRet = GalInit(); + + GalExtendTileInfoFunction = RacknrolExtendTileInfo; + + return nRet; +} + +static void HunchbksPostLoad() +{ + RacknrolPostLoad(); + s2650Open(0); + s2650SetReadHandler(HunchbksS2650Read); + s2650SetWriteHandler(HunchbksS2650Write); + s2650SetInHandler(HunchbksS2650PortRead); + s2650SetOutHandler(HunchbksS2650PortWrite); + s2650Close(); + + ZetInit(0); +} + +static INT32 HunchbksInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = HunchbksPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910; + + nRet = GalInit(); + HunchbksSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + + KonamiPPIInit(); + PPI1PortWriteB = HunchbksSoundControlWrite; + + return nRet; +} + +static void HncholmsPostLoad() +{ + RacknrolPostLoad(); + s2650Open(0); + s2650SetReadHandler(HunchbksS2650Read); + s2650SetWriteHandler(HunchbksS2650Write); + s2650SetInHandler(HncholmsS2650PortRead); + s2650SetOutHandler(HunchbksS2650PortWrite); + s2650Close(); + + ZetInit(0); +} + +static INT32 HncholmsInit() +{ + INT32 nRet; + + GalPostLoadCallbackFunction = HncholmsPostLoad; + GalSoundType = GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910; + + nRet = GalInit(); + HunchbksSoundInit(); + + GalRenderBackgroundFunction = ScrambleDrawBackground; + GalDrawBulletsFunction = ScrambleDrawBullets; + GalExtendTileInfoFunction = Batman2ExtendTileInfo; + GalExtendSpriteInfoFunction = UpperExtendSpriteInfo; + + nGalCyclesTotal[0] = (18432000 / 6 / 2 / 2) / 60; + + KonamiPPIInit(); + PPI1PortWriteB = HunchbksSoundControlWrite; + + return nRet; +} + +struct BurnDriver BurnDrvHunchbkg = { + "hunchbkg", "hunchbak", NULL, NULL, "1981", + "Hunchback (Galaxian hardware)\0", NULL, "Century Electronics", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, HunchbkgRomInfo, HunchbkgRomName, NULL, NULL, HunchbkgInputInfo, HunchbkgDIPInfo, + HunchbkgInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvDrivfrcg = { + "drivfrcg", "drivfrcp", NULL, NULL, "1984", + "Driving Force (Galaxian conversion)\0", NULL, "Shinkai Inc. (Magic Eletronics USA licence)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_RACING, 0, + NULL, DrivfrcgRomInfo, DrivfrcgRomName, NULL, NULL, DrivfrcgInputInfo, DrivfrcgDIPInfo, + DrivfrcgInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvDrivfrct = { + "drivfrct", "drivfrcp", NULL, NULL, "1985", + "Top Racer (bootleg of Driving Force)\0", NULL, "bootleg (EMT Germany)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_RACING, 0, + NULL, DrivfrctRomInfo, DrivfrctRomName, NULL, NULL, DrivfrcgInputInfo, DrivfrcgDIPInfo, + DrivfrcbInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvDrivfrcb = { + "drivfrcb", "drivfrcp", NULL, NULL, "1985", + "Driving Force (Galaxian conversion bootleg)\0", NULL, "bootleg (Elsys Software)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_RACING, 0, + NULL, DrivfrcbRomInfo, DrivfrcbRomName, NULL, NULL, DrivfrcgInputInfo, DrivfrcgDIPInfo, + DrivfrcbInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvRacknrol = { + "racknrol", NULL, NULL, NULL, "1986", + "Rack + Roll\0", NULL, "Status (Shinkai License)", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, + NULL, RacknrolRomInfo, RacknrolRomName, NULL, NULL, RacknrolInputInfo, RacknrolDIPInfo, + RacknrolInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvHexpool = { + "hexpool", "racknrol", NULL, NULL, "1986", + "Hex Pool (Shinkai)\0", NULL, "Shinkai", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, + NULL, HexpoolRomInfo, HexpoolRomName, NULL, NULL, RacknrolInputInfo, RacknrolDIPInfo, + RacknrolInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHexpoola = { + "hexpoola", "racknrol", NULL, NULL, "1985", + "Hex Pool (Senko)\0", NULL, "Senko", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, + NULL, HexpoolaRomInfo, HexpoolaRomName, NULL, NULL, RacknrolInputInfo, RacknrolDIPInfo, + HexpoolaInit, GalExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHunchbks = { + "hunchbks", "hunchbak", NULL, NULL, "1983", + "Hunchback (Scramble hardware)\0", NULL, "Century Electronics", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_PLATFORM, 0, + NULL, HunchbksRomInfo, HunchbksRomName, NULL, NULL, HunchbksInputInfo, HunchbksDIPInfo, + HunchbksInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHncholms = { + "hncholms", "huncholy", NULL, NULL, "1984", + "Hunchback Olympic (Scramble hardware)\0", "Imperfect Sound", "Century Electronics", "Galaxian", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_GALAXIAN, GBF_SPORTSMISC, 0, + NULL, HncholmsRomInfo, HncholmsRomName, NULL, NULL, HunchbksInputInfo, HunchbksDIPInfo, + HncholmsInit, KonamiExit, GalFrame, NULL, GalScan, + NULL, 392, 224, 256, 3, 4 +}; diff --git a/src/burn/drv/galaxian/gal_run.cpp b/src/burn/drv/galaxian/gal_run.cpp index f082bc3f8..8fd8a0484 100644 --- a/src/burn/drv/galaxian/gal_run.cpp +++ b/src/burn/drv/galaxian/gal_run.cpp @@ -1,1932 +1,1925 @@ -#include "gal.h" - -UINT8 GalInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 GalInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 GalInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 GalInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 GalDip[7] = {0, 0, 0, 0, 0, 0, 0}; -UINT8 GalInput[4] = {0x00, 0x00, 0x00, 0x00}; -UINT8 GalReset = 0; -UINT8 GalFakeDip = 0; -INT32 GalAnalogPort0 = 0; -INT32 GalAnalogPort1 = 0; - -UINT8 *GalMem = NULL; -UINT8 *GalMemEnd = NULL; -UINT8 *GalRamStart = NULL; -UINT8 *GalRamEnd = NULL; -UINT8 *GalZ80Rom1 = NULL; -UINT8 *GalZ80Rom1Op = NULL; -UINT8 *GalZ80Rom2 = NULL; -UINT8 *GalZ80Rom3 = NULL; -UINT8 *GalS2650Rom1 = NULL; -UINT8 *GalZ80Ram1 = NULL; -UINT8 *GalZ80Ram2 = NULL; -UINT8 *GalZ80Ram3 = NULL; -UINT8 *GalVideoRam = NULL; -UINT8 *GalVideoRam2 = NULL; -UINT8 *GalSpriteRam = NULL; -UINT8 *GalScrollVals = NULL; -UINT8 *GalProm = NULL; -UINT8 *GalChars = NULL; -UINT8 *GalSprites = NULL; -UINT8 *GalTempRom = NULL; -UINT32 *GalPalette = NULL; - -UINT32 GalZ80Rom1Size = 0; -UINT32 GalZ80Rom1Num = 0; -UINT32 GalZ80Rom2Size = 0; -UINT32 GalZ80Rom2Num = 0; -UINT32 GalZ80Rom3Size = 0; -UINT32 GalZ80Rom3Num = 0; -UINT32 GalS2650Rom1Size = 0; -UINT32 GalS2650Rom1Num = 0; -UINT32 GalTilesSharedRomSize = 0; -UINT32 GalTilesSharedRomNum = 0; -UINT32 GalTilesCharRomSize = 0; -UINT32 GalTilesCharRomNum = 0; -UINT32 GalNumChars = 0; -UINT32 GalTilesSpriteRomSize = 0; -UINT32 GalTilesSpriteRomNum = 0; -UINT32 GalNumSprites = 0; -UINT32 GalPromRomSize = 0; -UINT32 GalPromRomNum = 0; - -GalPostLoadCallback GalPostLoadCallbackFunction; - -// CPU Control -UINT8 GalIrqType; -UINT8 GalIrqFire; -INT32 nGalCyclesDone[3], nGalCyclesTotal[3]; -static INT32 nGalCyclesSegment; - -// Misc variables -UINT8 ZigzagAYLatch; -UINT8 GalSoundLatch; -UINT8 GalSoundLatch2; -UINT8 KingballSound; -UINT8 KingballSpeechDip; -UINT8 KonamiSoundControl; -UINT8 SfxSampleControl; -UINT16 ScrambleProtectionState; -UINT8 ScrambleProtectionResult; -UINT8 MoonwarPortSelect; -UINT8 MshuttleAY8910CS; -UINT8 GmgalaxSelectedGame; -UINT8 Fourin1Bank; -UINT8 GameIsGmgalax; -UINT8 CavelonBankSwitch; -UINT8 GalVBlank; - -static inline void GalMakeInputs() -{ - // Reset Inputs - GalInput[0] = GalInput[1] = GalInput[2] = GalInput[3] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - GalInput[0] |= (GalInputPort0[i] & 1) << i; - GalInput[1] |= (GalInputPort1[i] & 1) << i; - GalInput[2] |= (GalInputPort2[i] & 1) << i; - GalInput[3] |= (GalInputPort3[i] & 1) << i; - } -} - -static INT32 GalMemIndex() -{ - UINT8 *Next; Next = GalMem; - - GalZ80Rom1 = Next; Next += GalZ80Rom1Size; - GalZ80Rom2 = Next; Next += GalZ80Rom2Size; - GalZ80Rom3 = Next; Next += GalZ80Rom3Size; - GalS2650Rom1 = Next; Next += GalS2650Rom1Size; - GalProm = Next; Next += GalPromRomSize; - - GalRamStart = Next; - - GalZ80Ram1 = Next; Next += 0x01000; - GalVideoRam = Next; Next += 0x00400; - GalSpriteRam = Next; Next += 0x00100; - GalScrollVals = Next; Next += 0x00020; - GalGfxBank = Next; Next += 0x0001f; - - if (GalZ80Rom2Size) { - GalZ80Ram2 = Next; Next += 0x00400; - } - - if (GalZ80Rom3Size) { - GalZ80Ram3 = Next; Next += 0x00400; - } - - GalRamEnd = Next; - - GalChars = Next; Next += GalNumChars * 8 * 8; - GalSprites = Next; Next += GalNumSprites * 16 * 16; - GalPalette = (UINT32*)Next; Next += (GAL_PALETTE_NUM_COLOURS_PROM + GAL_PALETTE_NUM_COLOURS_STARS + GAL_PALETTE_NUM_COLOURS_BULLETS + GAL_PALETTE_NUM_COLOURS_BACKGROUND) * sizeof(UINT32); - - GalMemEnd = Next; - - return 0; -} - -static INT32 GalDoReset() -{ - if (GalS2650Rom1Size) { - s2650Open(0); - s2650Reset(); - s2650Close(); - } - - if (GalZ80Rom1Size) { - ZetOpen(0); - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "4in1")) { - ZetMapArea(0x0000, 0x3fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x3fff, 2, GalZ80Rom1); - } - ZetReset(); - ZetClose(); - } - - if (GalZ80Rom2Size) { - ZetOpen(1); - ZetReset(); - ZetClose(); - } - - if (GalZ80Rom3Size) { - ZetOpen(2); - ZetReset(); - ZetClose(); - } - - GalSoundReset(); - HiscoreReset(); - - GalIrqFire = 0; - GalFlipScreenX = 0; - GalFlipScreenY = 0; - ZigzagAYLatch = 0; - GalSoundLatch = 0; - GalSoundLatch2 = 0; - KingballSpeechDip = 0; - KingballSound = 0; - GalStarsEnable = 0; - GalStarsScrollPos = 0; - GalBackgroundRed = 0; - GalBackgroundGreen = 0; - GalBackgroundBlue = 0; - GalBackgroundEnable = 0; - ScrambleProtectionState = 0; - ScrambleProtectionResult = 0; - MoonwarPortSelect = 0; - MshuttleAY8910CS = 0; - Fourin1Bank = 0; - CavelonBankSwitch = 0; - GalVBlank = 0; - - return 0; -} - -static INT32 GalLoadRoms(bool bLoad) -{ - struct BurnRomInfo ri; - ri.nType = 0; - ri.nLen = 0; - INT32 nOffset = -1; - UINT32 i; - INT32 nRet = 0; - - if (!bLoad) { - do { - ri.nLen = 0; - ri.nType = 0; - BurnDrvGetRomInfo(&ri, ++nOffset); - if ((ri.nType & 0xff) == GAL_ROM_Z80_PROG1) { - GalZ80Rom1Size += ri.nLen; - GalZ80Rom1Num++; - } - if ((ri.nType & 0xff) == GAL_ROM_Z80_PROG2) { - GalZ80Rom2Size += ri.nLen; - GalZ80Rom2Num++; - } - if ((ri.nType & 0xff) == GAL_ROM_Z80_PROG3) { - GalZ80Rom3Size += ri.nLen; - GalZ80Rom3Num++; - } - if ((ri.nType & 0xff) == GAL_ROM_TILES_SHARED) { - GalTilesSharedRomSize += ri.nLen; - GalTilesSharedRomNum++; - } - if ((ri.nType & 0xff) == GAL_ROM_TILES_CHARS) { - GalTilesCharRomSize += ri.nLen; - GalTilesCharRomNum++; - } - if ((ri.nType & 0xff) == GAL_ROM_TILES_SPRITES) { - GalTilesSpriteRomSize += ri.nLen; - GalTilesSpriteRomNum++; - } - if ((ri.nType & 0xff) == GAL_ROM_PROM) { - GalPromRomSize += ri.nLen; - GalPromRomNum++; - } - if ((ri.nType & 0xff) == GAL_ROM_S2650_PROG1) { - GalS2650Rom1Size += ri.nLen; - GalS2650Rom1Num++; - } - } while (ri.nLen); - - if (GalTilesSharedRomSize) { - GalNumChars = GalTilesSharedRomSize / 16; - GalNumSprites = GalTilesSharedRomSize / 64; - CharPlaneOffsets[1] = GalTilesSharedRomSize * 4; - SpritePlaneOffsets[1] = GalTilesSharedRomSize * 4; - } - - if (GalTilesCharRomSize) { - GalNumChars = GalTilesCharRomSize / 16; - CharPlaneOffsets[1] = GalTilesCharRomSize * 4; - } - - if (GalTilesSpriteRomSize) { - GalNumSprites = GalTilesSpriteRomSize / 64; - SpritePlaneOffsets[1] = GalTilesSpriteRomSize * 4; - } - -#if 1 && defined FBA_DEBUG - if (GalZ80Rom1Size) bprintf(PRINT_NORMAL, _T("Z80 #1 Rom Size: 0x%X (%i roms)\n"), GalZ80Rom1Size, GalZ80Rom1Num); - if (GalZ80Rom2Size) bprintf(PRINT_NORMAL, _T("Z80 #2 Rom Size: 0x%X (%i roms)\n"), GalZ80Rom2Size, GalZ80Rom2Num); - if (GalZ80Rom3Size) bprintf(PRINT_NORMAL, _T("Z80 #3 Rom Size: 0x%X (%i roms)\n"), GalZ80Rom3Size, GalZ80Rom3Num); - if (GalS2650Rom1Size) bprintf(PRINT_NORMAL, _T("S2650 #1 Rom Size: 0x%X (%i roms)\n"), GalS2650Rom1Size, GalS2650Rom1Num); - if (GalTilesSharedRomSize) bprintf(PRINT_NORMAL, _T("Shared Tile Rom Size: 0x%X (%i roms, 0x%X Chars, 0x%X Sprites)\n"), GalTilesSharedRomSize, GalTilesSharedRomNum, GalNumChars, GalNumSprites); - if (GalTilesCharRomSize) bprintf(PRINT_NORMAL, _T("Char Rom Size: 0x%X (%i roms, 0x%X Chars)\n"), GalTilesCharRomSize, GalTilesCharRomNum, GalNumChars); - if (GalTilesSpriteRomSize) bprintf(PRINT_NORMAL, _T("Sprite Rom Size: 0x%X (%i roms, 0x%X Sprites)\n"), GalTilesSpriteRomSize, GalTilesSpriteRomNum, GalNumSprites); - if (GalPromRomSize) bprintf(PRINT_NORMAL, _T("PROM Rom Size: 0x%X (%i roms)\n"), GalPromRomSize, GalPromRomNum); -#endif - } - - if (bLoad) { - INT32 Offset; - - // Z80 #1 Program Roms - Offset = 0; - for (i = 0; i < GalZ80Rom1Num; i++) { - nRet = BurnLoadRom(GalZ80Rom1 + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - - // Z80 #2 Program Roms - if (GalZ80Rom2Size) { - Offset = 0; - for (i = GAL_ROM_OFFSET_Z80_PROG2; i < GAL_ROM_OFFSET_Z80_PROG2 + GalZ80Rom2Num; i++) { - nRet = BurnLoadRom(GalZ80Rom2 + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // Z80 #3 Program Roms - if (GalZ80Rom3Size) { - Offset = 0; - for (i = GAL_ROM_OFFSET_Z80_PROG3; i < GAL_ROM_OFFSET_Z80_PROG3 + GalZ80Rom3Num; i++) { - nRet = BurnLoadRom(GalZ80Rom3 + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // Shared Tile Roms - if (GalTilesSharedRomSize) { - Offset = 0; - GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); - for (i = GAL_ROM_OFFSET_TILES_SHARED; i < GAL_ROM_OFFSET_TILES_SHARED + GalTilesSharedRomNum; i++) { - nRet = BurnLoadRom(GalTempRom + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - } - - // Char Tile Roms - if (GalTilesCharRomSize) { - Offset = 0; - GalTempRom = (UINT8*)BurnMalloc(GalTilesCharRomSize); - for (i = GAL_ROM_OFFSET_TILES_CHARS; i < GAL_ROM_OFFSET_TILES_CHARS + GalTilesCharRomNum; i++) { - nRet = BurnLoadRom(GalTempRom + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); - BurnFree(GalTempRom); - } - - // Sprite Tile Roms - if (GalTilesSpriteRomSize) { - Offset = 0; - GalTempRom = (UINT8*)BurnMalloc(GalTilesSpriteRomSize); - for (i = GAL_ROM_OFFSET_TILES_SPRITES; i < GAL_ROM_OFFSET_TILES_SPRITES + GalTilesSpriteRomNum; i++) { - nRet = BurnLoadRom(GalTempRom + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); - BurnFree(GalTempRom); - } - - // Prom - if (GalPromRomSize) { - Offset = 0; - for (i = GAL_ROM_OFFSET_PROM; i < GAL_ROM_OFFSET_PROM + GalPromRomNum; i++) { - nRet = BurnLoadRom(GalProm + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // S2650 #1 Program Roms - if (GalS2650Rom1Size) { - Offset = 0; - for (i = GAL_ROM_OFFSET_S2650_PROG1; i < GAL_ROM_OFFSET_S2650_PROG1 + GalS2650Rom1Num; i++) { - nRet = BurnLoadRom(GalS2650Rom1 + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - } - - return nRet; -} - -// Konami PPI Handlers -UINT8 KonamiPPIReadIN0() -{ - return 0xff - GalInput[0] - GalDip[0]; -} - -UINT8 KonamiPPIReadIN1() -{ - return 0xff - GalInput[1] - GalDip[1]; -} - -UINT8 KonamiPPIReadIN2() -{ - return 0xff - GalInput[2] - GalDip[2]; -} - -UINT8 KonamiPPIReadIN3() -{ - return 0xff - GalInput[3] - GalDip[3]; -} - -void KonamiPPIInit() -{ - ppi8255_init(2); - PPI0PortReadA = KonamiPPIReadIN0; - PPI0PortReadB = KonamiPPIReadIN1; - PPI0PortReadC = KonamiPPIReadIN2; - PPI1PortReadC = KonamiPPIReadIN3; - PPI1PortWriteA = KonamiSoundLatchWrite; - PPI1PortWriteB = KonamiSoundControlWrite; -} - -// Galaxian Memory Map -UINT8 __fastcall GalaxianZ80Read(UINT16 a) -{ - switch (a) { - case 0x6000: { - return GalInput[0] | GalDip[0]; - } - - case 0x6800: { - return GalInput[1] | GalDip[1]; - } - - case 0x7000: { - return GalInput[2] | GalDip[2]; - } - - case 0x7800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall GalaxianZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5800 && a <= 0x58ff) { - int Offset = a - 0x5800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x6000: - case 0x6001: { - // start_lamp_w - return; - } - - case 0x6002: { - // coin_lock_w - return; - } - - case 0x6003: { - // coin_count_0_w - return; - } - - case 0x6004: - case 0x6005: - case 0x6006: - case 0x6007: { - GalaxianLfoFreqWrite(a - 0x6004, d); - return; - } - - case 0x6800: - case 0x6801: - case 0x6802: - case 0x6803: - case 0x6804: - case 0x6805: - case 0x6806: - case 0x6807: { - GalaxianSoundWrite(a - 0x6800, d); - return; - } - - case 0x7001: { - GalIrqFire = d & 1; - return; - } - - case 0x7004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x7006: { - GalFlipScreenX = d & 1; - return; - } - - case 0x7007: { - GalFlipScreenY = d & 1; - return; - } - - case 0x7800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall GalaxianZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall GalaxianZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -INT32 GalInit() -{ - INT32 nLen; - - GalLoadRoms(0); - - if (!GalSoundType) GalSoundType = GAL_SOUND_HARDWARE_TYPE_GALAXIAN; - - // Allocate and Blank all required memory - GalMem = NULL; - GalMemIndex(); - nLen = GalMemEnd - (UINT8 *)0; - if ((GalMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(GalMem, 0, nLen); - GalMemIndex(); - - if (GalLoadRoms(1)) return 1; - - // Setup the Z80 emulation - if (GalSoundType != GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) { - if (GalZ80Rom3Size) { - ZetInit(0); - ZetInit(1); - ZetInit(2); - } else { - if (GalZ80Rom2Size) { - ZetInit(0); - ZetInit(1); - } else { - if (GalZ80Rom1Size) { - ZetInit(0); - } - } - } - if (GalZ80Rom1Size) { - ZetOpen(0); - ZetSetReadHandler(GalaxianZ80Read); - ZetSetWriteHandler(GalaxianZ80Write); - ZetSetInHandler(GalaxianZ80PortRead); - ZetSetOutHandler(GalaxianZ80PortWrite); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x4000, 0x43ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x43ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x43ff, 2, GalZ80Ram1); - ZetMapArea(0x4400, 0x47ff, 0, GalZ80Ram1); - ZetMapArea(0x4400, 0x47ff, 1, GalZ80Ram1); - ZetMapArea(0x4400, 0x47ff, 2, GalZ80Ram1); - ZetMapArea(0x5000, 0x53ff, 0, GalVideoRam); - ZetMapArea(0x5000, 0x53ff, 1, GalVideoRam); - ZetMapArea(0x5000, 0x53ff, 2, GalVideoRam); - ZetMapArea(0x5800, 0x58ff, 0, GalSpriteRam); - ZetMapArea(0x5800, 0x58ff, 2, GalSpriteRam); - ZetMemEnd(); - ZetClose(); - } - } - - nGalCyclesTotal[0] = (18432000 / 3 / 2) / 60; - - if (GalPostLoadCallbackFunction) GalPostLoadCallbackFunction(); - - GalCalcPaletteFunction = GalaxianCalcPalette; - GalRenderBackgroundFunction = GalaxianDrawBackground; - GalDrawBulletsFunction = GalaxianDrawBullets; - - GalIrqType = GAL_IRQ_TYPE_NMI; - - GalSpriteClipStart = 16; - GalSpriteClipEnd = 255; - - GalSoundInit(); - - GalInitStars(); - - GenericTilesInit(); - - GalColourDepth = 2; - - // Reset the driver - GalDoReset(); - - return 0; -} - -// Moon Cresta Memory Map -UINT8 __fastcall MooncrstZ80Read(UINT16 a) -{ - switch (a) { - case 0xa000: { - return GalInput[0] | GalDip[0]; - } - - case 0xa800: { - return GalInput[1] | GalDip[1]; - } - - case 0xb000: { - return GalInput[2] | GalDip[2]; - } - - case 0xb800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall MooncrstZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - int Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0xa000: - case 0xa001: - case 0xa002: { - GalGfxBank[a - 0xa000] = d; - return; - } - - case 0xa003: { - // coin_count_0_w - return; - } - - case 0xa004: - case 0xa005: - case 0xa006: - case 0xa007: { - GalaxianLfoFreqWrite(a - 0xa004, d); - return; - } - - case 0xa800: - case 0xa801: - case 0xa802: - case 0xa803: - case 0xa804: - case 0xa805: - case 0xa806: - case 0xa807: { - GalaxianSoundWrite(a - 0xa800, d); - return; - } - - case 0xb000: { - GalIrqFire = d & 1; - return; - } - - case 0xb004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xb006: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb007: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb800: { - GalPitch = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall MooncrstZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall MooncrstZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void MapMooncrst() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(MooncrstZ80Read); - ZetSetWriteHandler(MooncrstZ80Write); - ZetSetInHandler(MooncrstZ80PortRead); - ZetSetOutHandler(MooncrstZ80PortWrite); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram1); - ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); - ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); - ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); - ZetMemEnd(); - ZetClose(); -} - -// Jumpbug Memory Map -UINT8 __fastcall JumpbugZ80Read(UINT16 a) -{ - if (a >= 0xb000 && a <= 0xbfff) { - INT32 Offset = a - 0xb000; - - switch (Offset) { - case 0x114: return 0x4f; - case 0x118: return 0xd3; - case 0x214: return 0xcf; - case 0x235: return 0x02; - case 0x311: return 0xff; - } - } - - switch (a) { - case 0x6000: { - return GalInput[0] | GalDip[0]; - } - - case 0x6800: { - return GalInput[1] | GalDip[1]; - } - - case 0x7000: { - return GalInput[2] | GalDip[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall JumpbugZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x5800: { - AY8910Write(0, 1, d); - return; - } - - case 0x5900: { - AY8910Write(0, 0, d); - return; - } - - case 0x6002: - case 0x6003: - case 0x6004: - case 0x6005: - case 0x6006: { - GalGfxBank[a - 0x6002] = d; - return; - } - - case 0x7001: { - GalIrqFire = d & 1; - return; - } - - case 0x7002: { - // coin_count_0_w - return; - } - - case 0x7004: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x7006: { - GalFlipScreenX = d & 1; - return; - } - - case 0x7007: { - GalFlipScreenY = d & 1; - return; - } - - case 0x7800: { - // watchdog write - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall JumpbugZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall JumpbugZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void MapJumpbug() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(JumpbugZ80Read); - ZetSetWriteHandler(JumpbugZ80Write); - ZetSetInHandler(JumpbugZ80PortRead); - ZetSetOutHandler(JumpbugZ80PortWrite); - ZetMapArea(0x0000, 0x3fff, 0, GalZ80Rom1); - ZetMapArea(0x0000, 0x3fff, 2, GalZ80Rom1); - ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); - ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 0, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 1, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 2, GalVideoRam); - ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); - ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); - ZetMapArea(0x8000, GalZ80Rom1Size + 0x4000 - 1, 0, GalZ80Rom1 + 0x4000); - ZetMapArea(0x8000, GalZ80Rom1Size + 0x4000 - 1, 2, GalZ80Rom1 + 0x4000); - ZetMemEnd(); - ZetClose(); -} - -// Frogger Memory Map -UINT8 __fastcall FroggerZ80Read(UINT16 a) -{ - if (a >= 0xc000) { - UINT32 Offset = a - 0xc000; - UINT8 Result = 0xff; - if (Offset & 0x1000) Result &= ppi8255_r(1, (Offset >> 1) & 3); - if (Offset & 0x2000) Result &= ppi8255_r(0, (Offset >> 1) & 3); - return Result; - } - - switch (a) { - case 0x8800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall FroggerZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0xb000 && a <= 0xb0ff) { - INT32 Offset = a - 0xb000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - d = (d >> 4) | (d << 4); - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0xc000) { - INT32 Offset = a - 0xc000; - if (Offset & 0x1000) ppi8255_w(1, (Offset >> 1) & 3, d); - if (Offset & 0x2000) ppi8255_w(0, (Offset >> 1) & 3, d); - return; - } - - switch (a) { - case 0xb808: { - GalIrqFire = d & 1; - return; - } - - case 0xb80c: { - GalFlipScreenY = d & 1; - return; - } - - case 0xb810: { - GalFlipScreenX = d & 1; - return; - } - - case 0xb818: { - // coin_count_0_w - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall FroggerZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall FroggerZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void MapFrogger() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(FroggerZ80Read); - ZetSetWriteHandler(FroggerZ80Write); - ZetSetInHandler(FroggerZ80PortRead); - ZetSetOutHandler(FroggerZ80PortWrite); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetMapArea(0xa800, 0xabff, 0, GalVideoRam); - ZetMapArea(0xa800, 0xabff, 1, GalVideoRam); - ZetMapArea(0xa800, 0xabff, 2, GalVideoRam); - ZetMapArea(0xb000, 0xb0ff, 0, GalSpriteRam); - ZetMapArea(0xb000, 0xb0ff, 2, GalSpriteRam); - ZetMemEnd(); - ZetClose(); -} - -// The End Memory Map -UINT8 __fastcall TheendZ80Read(UINT16 a) -{ - if (a >= 0x8000) { - UINT32 Offset = a - 0x8000; - UINT8 Result = 0xff; - if (Offset & 0x0100) Result &= ppi8255_r(0, Offset & 3); - if (Offset & 0x0200) Result &= ppi8255_r(1, Offset & 3); - return Result; - } - - switch (a) { - case 0x7000: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall TheendZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x5000 && a <= 0x50ff) { - INT32 Offset = a - 0x5000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0x8000) { - INT32 Offset = a - 0x8000; - if (Offset & 0x0100) ppi8255_w(0, Offset & 3, d); - if (Offset & 0x0200) ppi8255_w(1, Offset & 3, d); - return; - } - - switch (a) { - case 0x6801: { - GalIrqFire = d & 1; - return; - } - - case 0x6802: { - // coin_count_0_w - return; - } - - case 0x6803: { - GalBackgroundEnable = d & 1; - return; - } - - case 0x6804: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0x6806: { - GalFlipScreenX = d & 1; - return; - } - - case 0x6807: { - GalFlipScreenY = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall TheendZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall TheendZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void MapTheend() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(TheendZ80Read); - ZetSetWriteHandler(TheendZ80Write); - ZetSetInHandler(TheendZ80PortRead); - ZetSetOutHandler(TheendZ80PortWrite); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); - ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); - ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); - ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 0, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 1, GalVideoRam); - ZetMapArea(0x4c00, 0x4fff, 2, GalVideoRam); - ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); - ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); - ZetMemEnd(); - ZetClose(); -} - -// Turtles Memory Map -UINT8 __fastcall TurtlesZ80Read(UINT16 a) -{ - if (a >= 0xb000 && a <= 0xb03f) { - UINT32 Offset = a - 0xb000; - return ppi8255_r(0, (Offset >> 4) & 3); - } - - if (a >= 0xb800 && a <= 0xb83f) { - UINT32 Offset = a - 0xb800; - return ppi8255_r(1, (Offset >> 4) & 3); - } - - switch (a) { - case 0xa800: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall TurtlesZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9800 && a <= 0x98ff) { - INT32 Offset = a - 0x9800; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - if (a >= 0xb000 && a <= 0xb03f) { - UINT32 Offset = a - 0xb000; - ppi8255_w(0, (Offset >> 4) & 3, d); - return; - } - - if (a >= 0xb800 && a <= 0xb83f) { - UINT32 Offset = a - 0xb800; - ppi8255_w(1, (Offset >> 4) & 3, d); - return; - } - - switch (a) { - case 0xa000: { - GalBackgroundRed = d & 1; - return; - } - - case 0xa008: { - GalIrqFire = d & 1; - return; - } - - case 0xa010: { - GalFlipScreenY = d & 1; - return; - } - - case 0xa018: { - GalFlipScreenX = d & 1; - return; - } - - case 0xa020: { - GalBackgroundGreen = d & 1; - return; - } - - case 0xa028: { - GalBackgroundBlue = d & 1; - return; - } - - case 0xa030: { - // coin_count_0_w - return; - } - - case 0xa038: { - // coin_count_1_w - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall TurtlesZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall TurtlesZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void MapTurtles() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(TurtlesZ80Read); - ZetSetWriteHandler(TurtlesZ80Write); - ZetSetInHandler(TurtlesZ80PortRead); - ZetSetOutHandler(TurtlesZ80PortWrite); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); - ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); - ZetMapArea(0x9400, 0x97ff, 0, GalVideoRam); - ZetMapArea(0x9400, 0x97ff, 1, GalVideoRam); - ZetMapArea(0x9400, 0x97ff, 2, GalVideoRam); - ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); - ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); - ZetMemEnd(); - ZetClose(); -} - -// Super Cobra Memory Map -UINT8 __fastcall ScobraZ80Read(UINT16 a) -{ - switch (a) { - case 0x9800: - case 0x9801: - case 0x9802: - case 0x9803: { - return ppi8255_r(0, a - 0x9800); - } - - case 0xa000: - case 0xa001: - case 0xa002: - case 0xa003: { - return ppi8255_r(1, a - 0xa000); - } - - case 0xb000: { - // watchdog read - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall ScobraZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9000 && a <= 0x90ff) { - INT32 Offset = a - 0x9000; - - GalSpriteRam[Offset] = d; - - if (Offset < 0x40) { - if ((Offset & 0x01) == 0) { - GalScrollVals[Offset >> 1] = d; - } - } - - return; - } - - switch (a) { - case 0x9800: - case 0x9801: - case 0x9802: - case 0x9803: { - return ppi8255_w(0, a - 0x9800, d); - } - - case 0xa000: - case 0xa001: - case 0xa002: - case 0xa003: { - return ppi8255_w(1, a - 0xa000, d); - } - - case 0xa801: { - GalIrqFire = d & 1; - return; - } - - case 0xa802: { - // coin_count_0_w - return; - } - - case 0xa803: { - GalBackgroundEnable = d & 1; - return; - } - - case 0xa804: { - GalStarsEnable = d & 0x01; - if (!GalStarsEnable) GalStarsScrollPos = -1; - return; - } - - case 0xa806: { - GalFlipScreenX = d & 1; - return; - } - - case 0xa807: { - GalFlipScreenY = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall ScobraZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0xff; -} - -void __fastcall ScobraZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void MapScobra() -{ - ZetOpen(0); - ZetMemCallback(0x0000, 0xffff, 0); - ZetMemCallback(0x0000, 0xffff, 1); - ZetMemCallback(0x0000, 0xffff, 2); - ZetSetReadHandler(ScobraZ80Read); - ZetSetWriteHandler(ScobraZ80Write); - ZetSetInHandler(ScobraZ80PortRead); - ZetSetOutHandler(ScobraZ80PortWrite); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); - ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); - ZetMapArea(0x8800, 0x8bff, 0, GalVideoRam); - ZetMapArea(0x8800, 0x8bff, 1, GalVideoRam); - ZetMapArea(0x8800, 0x8bff, 2, GalVideoRam); - ZetMapArea(0x8c00, 0x8fff, 0, GalVideoRam); - ZetMapArea(0x8c00, 0x8fff, 1, GalVideoRam); - ZetMapArea(0x8c00, 0x8fff, 2, GalVideoRam); - ZetMapArea(0x9000, 0x90ff, 0, GalSpriteRam); - ZetMapArea(0x9000, 0x90ff, 2, GalSpriteRam); - ZetMemEnd(); - ZetClose(); -} - -INT32 GalExit() -{ - if (GalZ80Rom1Size) ZetExit(); - if (GalS2650Rom1Size) s2650Exit(); - - GenericTilesExit(); - - BurnFree(GalMem); - BurnFree(GalZ80Rom1Op); - BurnFree(GalVideoRam2); - BurnFree(RockclimTiles); - - GalSoundExit(); - - GalIrqFire = 0; - GalIrqType = 0; - GalSoundType = 0; - GalFlipScreenX = 0; - GalFlipScreenY = 0; - ZigzagAYLatch = 0; - GalSoundLatch = 0; - GalSoundLatch2 = 0; - KingballSpeechDip = 0; - KingballSound = 0; - KonamiSoundControl = 0; - SfxSampleControl = 0; - GmgalaxSelectedGame = 0; - GalPaletteBank = 0; - GalSpriteClipStart = 0; - GalSpriteClipEnd = 0; - FroggerAdjust = 0; - GalBackgroundRed = 0; - GalBackgroundGreen = 0; - GalBackgroundBlue = 0; - GalBackgroundEnable = 0; - ScrambleProtectionState = 0; - ScrambleProtectionResult = 0; - - GalZ80Rom1Size = 0; - GalZ80Rom1Num = 0; - GalZ80Rom2Size = 0; - GalZ80Rom2Num = 0; - GalZ80Rom3Size = 0; - GalZ80Rom3Num = 0; - GalS2650Rom1Size = 0; - GalS2650Rom1Num = 0; - GalTilesSharedRomSize = 0; - GalTilesSharedRomNum = 0; - GalTilesCharRomSize = 0; - GalTilesCharRomNum = 0; - GalNumChars = 0; - GalTilesSpriteRomSize = 0; - GalTilesSpriteRomNum = 0; - GalNumSprites = 0; - GalPromRomSize = 0; - GalPromRomNum = 0; - - GalPostLoadCallbackFunction = NULL; - GalRenderBackgroundFunction = NULL; - GalCalcPaletteFunction = NULL; - GalDrawBulletsFunction = NULL; - GalExtendTileInfoFunction = NULL; - GalExtendSpriteInfoFunction = NULL; - GalRenderFrameFunction = NULL; - - SfxTilemap = 0; - GalOrientationFlipX = 0; - MoonwarPortSelect = 0; - MshuttleAY8910CS = 0; - Fourin1Bank = 0; - GameIsGmgalax = 0; - CavelonBankSwitch = 0; - DarkplntBulletColour = 0; - DambustrBgColour1 = 0; - DambustrBgColour2 = 0; - DambustrBgPriority = 0; - DambustrBgSplitLine = 0; - RockclimScrollX = 0; - RockclimScrollY = 0; - GalVBlank = 0; - - GalColourDepth = 0; - - return 0; -} - -INT32 KonamiExit() -{ - ppi8255_exit(); - - return GalExit(); -} - -INT32 GalFrame() -{ - INT32 nInterleave = 8; - INT32 nSoundBufferPos = 0; - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { - nInterleave = nBurnSoundLen; - GalaxianSoundUpdateTimers(); - } - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) nInterleave = nBurnSoundLen / 4; - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) nInterleave = 32; - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910) nInterleave = 32; - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) nInterleave = 32; - - INT32 nIrqInterleaveFire = nInterleave / 4; - - if (GalReset) GalDoReset(); - - if (GameIsGmgalax && (GmgalaxSelectedGame != GalFakeDip)) { - GmgalaxSelectedGame = GalFakeDip; - INT32 nAddress = 0x0000; - if (GmgalaxSelectedGame == 1) nAddress = 0x4000; - ZetOpen(0); - ZetMapArea(0x0000, 0x3fff, 0, GalZ80Rom1 + nAddress); - ZetMapArea(0x0000, 0x3fff, 2 ,GalZ80Rom1 + nAddress); - ZetClose(); - - GalGfxBank[0] = 0; - if (GmgalaxSelectedGame == 1) GalGfxBank[0] = 1; - GalPaletteBank = 0; - if (GmgalaxSelectedGame == 1) GalPaletteBank = 1; - - GalDoReset(); - } - - GalMakeInputs(); - GalVBlank = 0; - - if (GalZ80Rom1Size) ZetNewFrame(); - - nGalCyclesDone[0] = nGalCyclesDone[1] = nGalCyclesDone[2] = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - if (GalZ80Rom1Size && GalSoundType != GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) { - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; - nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; - nGalCyclesDone[nCurrentCPU] += ZetRun(nGalCyclesSegment); - if (i == nIrqInterleaveFire && GalIrqFire) { - if (GalIrqType == GAL_IRQ_TYPE_NMI) ZetNmi(); - if (GalIrqType == GAL_IRQ_TYPE_IRQ0) ZetRaiseIrq(0); - GalIrqFire = 0; - } - ZetClose(); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910) { - // Run Z80 #2 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; - nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; - nGalCyclesDone[nCurrentCPU] += ZetRun(nGalCyclesSegment); - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910) ZetRaiseIrq(0); - ZetClose(); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910) { - // Run Z80 #2 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; - nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; - nGalCyclesSegment = ZetRun(nGalCyclesSegment); - nGalCyclesDone[nCurrentCPU] += nGalCyclesSegment; - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nGalCyclesDone[nCurrentCPU] += ZetRun(300); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - nGalCyclesDone[nCurrentCPU] += ZetRun(300); - ZetClose(); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { - // Run Z80 #3 - nCurrentCPU = 2; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; - nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; - nGalCyclesDone[nCurrentCPU] += ZetRun(nGalCyclesSegment); - ZetClose(); - } - - // Run S2650 #1 - if (GalS2650Rom1Size) { - nCurrentCPU = 0; - s2650Open(nCurrentCPU); - nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; - nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; - nGalCyclesDone[nCurrentCPU] += s2650Run(nGalCyclesSegment); - if (i == nIrqInterleaveFire) { - GalVBlank = 1; - s2650_set_irq_line(0, 1); - s2650Run(0); - s2650_set_irq_line(0, 0); - s2650Run(0); - } - s2650Close(); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) { - // Run Z80 #1 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; - nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; - nGalCyclesDone[nCurrentCPU] += ZetRun(nGalCyclesSegment); - if (HunchbksSoundIrqFire) ZetRaiseIrq(0); - ZetClose(); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN) { - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - GalRenderSoundSamples(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910) { - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - AY8910Update(0, &pAY8910Buffer[0], nSegmentLength); - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910) { - AY8910Update(1, &pAY8910Buffer[3], nSegmentLength); - } - - filter_rc_update(0, pAY8910Buffer[0], pSoundBuf, nSegmentLength); - filter_rc_update(1, pAY8910Buffer[1], pSoundBuf, nSegmentLength); - filter_rc_update(2, pAY8910Buffer[2], pSoundBuf, nSegmentLength); - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910) { - filter_rc_update(3, pAY8910Buffer[3], pSoundBuf, nSegmentLength); - filter_rc_update(4, pAY8910Buffer[4], pSoundBuf, nSegmentLength); - filter_rc_update(5, pAY8910Buffer[5], pSoundBuf, nSegmentLength); - } - - nSoundBufferPos += nSegmentLength; - } - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - GalRenderSoundSamples(pSoundBuf, nSegmentLength); - DACUpdate(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HEXPOOLASN76496) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - SN76496Update(0, pSoundBuf, nSegmentLength); - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496) { - SN76496Update(1, pSoundBuf, nSegmentLength); - SN76496Update(2, pSoundBuf, nSegmentLength); - } - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN) { - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - GalRenderSoundSamples(pSoundBuf, nSegmentLength); - } - } - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910) { - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Update(0, &pAY8910Buffer[0], nSegmentLength); - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910) { - AY8910Update(1, &pAY8910Buffer[3], nSegmentLength); - } - - filter_rc_update(0, pAY8910Buffer[0], pSoundBuf, nSegmentLength); - filter_rc_update(1, pAY8910Buffer[1], pSoundBuf, nSegmentLength); - filter_rc_update(2, pAY8910Buffer[2], pSoundBuf, nSegmentLength); - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910) { - filter_rc_update(3, pAY8910Buffer[3], pSoundBuf, nSegmentLength); - filter_rc_update(4, pAY8910Buffer[4], pSoundBuf, nSegmentLength); - filter_rc_update(5, pAY8910Buffer[5], pSoundBuf, nSegmentLength); - } - } - } - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - GalRenderSoundSamples(pSoundBuf, nSegmentLength); - DACUpdate(pSoundBuf, nSegmentLength); - } - } - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { - if (pBurnSoundOut) DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HEXPOOLASN76496) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - SN76496Update(0, pSoundBuf, nSegmentLength); - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496) { - SN76496Update(1, pSoundBuf, nSegmentLength); - SN76496Update(2, pSoundBuf, nSegmentLength); - } - } - } - - if (pBurnDraw) GalDraw(); - - return 0; -} - -INT32 GalScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029703; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = GalRamStart; - ba.nLen = GalRamEnd - GalRamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - if (GalZ80Rom1Size) ZetScan(nAction); - ppi8255_scan(); - if (GalS2650Rom1Size) s2650Scan(nAction, pnMin); - - GalSoundScan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(GalInput); - SCAN_VAR(GalAnalogPort0); - SCAN_VAR(GalAnalogPort1); - SCAN_VAR(GalIrqFire); - SCAN_VAR(nGalCyclesDone); - SCAN_VAR(nGalCyclesSegment); - SCAN_VAR(ZigzagAYLatch); - SCAN_VAR(GalSoundLatch); - SCAN_VAR(GalSoundLatch2); - SCAN_VAR(KingballSound); - SCAN_VAR(KingballSpeechDip); - SCAN_VAR(KonamiSoundControl); - SCAN_VAR(SfxSampleControl); - SCAN_VAR(ScrambleProtectionResult); - SCAN_VAR(MoonwarPortSelect); - SCAN_VAR(MshuttleAY8910CS); - SCAN_VAR(GmgalaxSelectedGame); - SCAN_VAR(Fourin1Bank); - SCAN_VAR(CavelonBankSwitch); - SCAN_VAR(GalFlipScreenX); - SCAN_VAR(GalFlipScreenY); - SCAN_VAR(GalPaletteBank); - SCAN_VAR(GalBackgroundRed); - SCAN_VAR(GalBackgroundGreen); - SCAN_VAR(GalBackgroundBlue); - SCAN_VAR(GalBackgroundEnable); - SCAN_VAR(DarkplntBulletColour); - SCAN_VAR(DambustrBgColour1); - SCAN_VAR(DambustrBgColour2); - SCAN_VAR(DambustrBgPriority); - SCAN_VAR(DambustrBgSplitLine); - SCAN_VAR(RockclimScrollX); - SCAN_VAR(RockclimScrollY); - SCAN_VAR(GalStarsEnable); - SCAN_VAR(GalStarsScrollPos); - SCAN_VAR(GalStarsBlinkState); - SCAN_VAR(GalVBlank); - } - - return 0; -} +#include "gal.h" + +UINT8 GalInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 GalInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 GalInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 GalInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 GalDip[7] = {0, 0, 0, 0, 0, 0, 0}; +UINT8 GalInput[4] = {0x00, 0x00, 0x00, 0x00}; +UINT8 GalReset = 0; +UINT8 GalFakeDip = 0; +INT32 GalAnalogPort0 = 0; +INT32 GalAnalogPort1 = 0; + +UINT8 *GalMem = NULL; +UINT8 *GalMemEnd = NULL; +UINT8 *GalRamStart = NULL; +UINT8 *GalRamEnd = NULL; +UINT8 *GalZ80Rom1 = NULL; +UINT8 *GalZ80Rom1Op = NULL; +UINT8 *GalZ80Rom2 = NULL; +UINT8 *GalZ80Rom3 = NULL; +UINT8 *GalS2650Rom1 = NULL; +UINT8 *GalZ80Ram1 = NULL; +UINT8 *GalZ80Ram2 = NULL; +UINT8 *GalZ80Ram3 = NULL; +UINT8 *GalVideoRam = NULL; +UINT8 *GalVideoRam2 = NULL; +UINT8 *GalSpriteRam = NULL; +UINT8 *GalScrollVals = NULL; +UINT8 *GalProm = NULL; +UINT8 *GalChars = NULL; +UINT8 *GalSprites = NULL; +UINT8 *GalTempRom = NULL; +UINT32 *GalPalette = NULL; + +UINT32 GalZ80Rom1Size = 0; +UINT32 GalZ80Rom1Num = 0; +UINT32 GalZ80Rom2Size = 0; +UINT32 GalZ80Rom2Num = 0; +UINT32 GalZ80Rom3Size = 0; +UINT32 GalZ80Rom3Num = 0; +UINT32 GalS2650Rom1Size = 0; +UINT32 GalS2650Rom1Num = 0; +UINT32 GalTilesSharedRomSize = 0; +UINT32 GalTilesSharedRomNum = 0; +UINT32 GalTilesCharRomSize = 0; +UINT32 GalTilesCharRomNum = 0; +UINT32 GalNumChars = 0; +UINT32 GalTilesSpriteRomSize = 0; +UINT32 GalTilesSpriteRomNum = 0; +UINT32 GalNumSprites = 0; +UINT32 GalPromRomSize = 0; +UINT32 GalPromRomNum = 0; + +GalPostLoadCallback GalPostLoadCallbackFunction; + +// CPU Control +UINT8 GalIrqType; +UINT8 GalIrqFire; +INT32 nGalCyclesDone[3], nGalCyclesTotal[3]; +static INT32 nGalCyclesSegment; + +// Misc variables +UINT8 ZigzagAYLatch; +UINT8 GalSoundLatch; +UINT8 GalSoundLatch2; +UINT8 KingballSound; +UINT8 KingballSpeechDip; +UINT8 KonamiSoundControl; +UINT8 SfxSampleControl; +UINT16 ScrambleProtectionState; +UINT8 ScrambleProtectionResult; +UINT8 MoonwarPortSelect; +UINT8 MshuttleAY8910CS; +UINT8 GmgalaxSelectedGame; +UINT8 Fourin1Bank; +UINT8 GameIsGmgalax; +UINT8 CavelonBankSwitch; +UINT8 GalVBlank; + +static inline void GalMakeInputs() +{ + // Reset Inputs + GalInput[0] = GalInput[1] = GalInput[2] = GalInput[3] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + GalInput[0] |= (GalInputPort0[i] & 1) << i; + GalInput[1] |= (GalInputPort1[i] & 1) << i; + GalInput[2] |= (GalInputPort2[i] & 1) << i; + GalInput[3] |= (GalInputPort3[i] & 1) << i; + } +} + +static INT32 GalMemIndex() +{ + UINT8 *Next; Next = GalMem; + + GalZ80Rom1 = Next; Next += GalZ80Rom1Size; + GalZ80Rom2 = Next; Next += GalZ80Rom2Size; + GalZ80Rom3 = Next; Next += GalZ80Rom3Size; + GalS2650Rom1 = Next; Next += GalS2650Rom1Size; + GalProm = Next; Next += GalPromRomSize; + + GalRamStart = Next; + + GalZ80Ram1 = Next; Next += 0x01000; + GalVideoRam = Next; Next += 0x00400; + GalSpriteRam = Next; Next += 0x00100; + GalScrollVals = Next; Next += 0x00020; + GalGfxBank = Next; Next += 0x0001f; + + if (GalZ80Rom2Size) { + GalZ80Ram2 = Next; Next += 0x00400; + } + + if (GalZ80Rom3Size) { + GalZ80Ram3 = Next; Next += 0x00400; + } + + GalRamEnd = Next; + + GalChars = Next; Next += GalNumChars * 8 * 8; + GalSprites = Next; Next += GalNumSprites * 16 * 16; + GalPalette = (UINT32*)Next; Next += (GAL_PALETTE_NUM_COLOURS_PROM + GAL_PALETTE_NUM_COLOURS_STARS + GAL_PALETTE_NUM_COLOURS_BULLETS + GAL_PALETTE_NUM_COLOURS_BACKGROUND) * sizeof(UINT32); + + GalMemEnd = Next; + + return 0; +} + +static INT32 GalDoReset() +{ + if (GalS2650Rom1Size) { + s2650Open(0); + s2650Reset(); + s2650Close(); + } + + if (GalZ80Rom1Size) { + ZetOpen(0); + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "4in1")) { + ZetMapArea(0x0000, 0x3fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x3fff, 2, GalZ80Rom1); + } + ZetReset(); + ZetClose(); + } + + if (GalZ80Rom2Size) { + ZetOpen(1); + ZetReset(); + ZetClose(); + } + + if (GalZ80Rom3Size) { + ZetOpen(2); + ZetReset(); + ZetClose(); + } + + GalSoundReset(); + HiscoreReset(); + + GalIrqFire = 0; + GalFlipScreenX = 0; + GalFlipScreenY = 0; + ZigzagAYLatch = 0; + GalSoundLatch = 0; + GalSoundLatch2 = 0; + KingballSpeechDip = 0; + KingballSound = 0; + GalStarsEnable = 0; + GalStarsScrollPos = 0; + GalBackgroundRed = 0; + GalBackgroundGreen = 0; + GalBackgroundBlue = 0; + GalBackgroundEnable = 0; + ScrambleProtectionState = 0; + ScrambleProtectionResult = 0; + MoonwarPortSelect = 0; + MshuttleAY8910CS = 0; + Fourin1Bank = 0; + CavelonBankSwitch = 0; + GalVBlank = 0; + + return 0; +} + +static INT32 GalLoadRoms(bool bLoad) +{ + struct BurnRomInfo ri; + ri.nType = 0; + ri.nLen = 0; + INT32 nOffset = -1; + UINT32 i; + INT32 nRet = 0; + + if (!bLoad) { + do { + ri.nLen = 0; + ri.nType = 0; + BurnDrvGetRomInfo(&ri, ++nOffset); + if ((ri.nType & 0xff) == GAL_ROM_Z80_PROG1) { + GalZ80Rom1Size += ri.nLen; + GalZ80Rom1Num++; + } + if ((ri.nType & 0xff) == GAL_ROM_Z80_PROG2) { + GalZ80Rom2Size += ri.nLen; + GalZ80Rom2Num++; + } + if ((ri.nType & 0xff) == GAL_ROM_Z80_PROG3) { + GalZ80Rom3Size += ri.nLen; + GalZ80Rom3Num++; + } + if ((ri.nType & 0xff) == GAL_ROM_TILES_SHARED) { + GalTilesSharedRomSize += ri.nLen; + GalTilesSharedRomNum++; + } + if ((ri.nType & 0xff) == GAL_ROM_TILES_CHARS) { + GalTilesCharRomSize += ri.nLen; + GalTilesCharRomNum++; + } + if ((ri.nType & 0xff) == GAL_ROM_TILES_SPRITES) { + GalTilesSpriteRomSize += ri.nLen; + GalTilesSpriteRomNum++; + } + if ((ri.nType & 0xff) == GAL_ROM_PROM) { + GalPromRomSize += ri.nLen; + GalPromRomNum++; + } + if ((ri.nType & 0xff) == GAL_ROM_S2650_PROG1) { + GalS2650Rom1Size += ri.nLen; + GalS2650Rom1Num++; + } + } while (ri.nLen); + + if (GalTilesSharedRomSize) { + GalNumChars = GalTilesSharedRomSize / 16; + GalNumSprites = GalTilesSharedRomSize / 64; + CharPlaneOffsets[1] = GalTilesSharedRomSize * 4; + SpritePlaneOffsets[1] = GalTilesSharedRomSize * 4; + } + + if (GalTilesCharRomSize) { + GalNumChars = GalTilesCharRomSize / 16; + CharPlaneOffsets[1] = GalTilesCharRomSize * 4; + } + + if (GalTilesSpriteRomSize) { + GalNumSprites = GalTilesSpriteRomSize / 64; + SpritePlaneOffsets[1] = GalTilesSpriteRomSize * 4; + } + +#if 1 && defined FBA_DEBUG + if (GalZ80Rom1Size) bprintf(PRINT_NORMAL, _T("Z80 #1 Rom Size: 0x%X (%i roms)\n"), GalZ80Rom1Size, GalZ80Rom1Num); + if (GalZ80Rom2Size) bprintf(PRINT_NORMAL, _T("Z80 #2 Rom Size: 0x%X (%i roms)\n"), GalZ80Rom2Size, GalZ80Rom2Num); + if (GalZ80Rom3Size) bprintf(PRINT_NORMAL, _T("Z80 #3 Rom Size: 0x%X (%i roms)\n"), GalZ80Rom3Size, GalZ80Rom3Num); + if (GalS2650Rom1Size) bprintf(PRINT_NORMAL, _T("S2650 #1 Rom Size: 0x%X (%i roms)\n"), GalS2650Rom1Size, GalS2650Rom1Num); + if (GalTilesSharedRomSize) bprintf(PRINT_NORMAL, _T("Shared Tile Rom Size: 0x%X (%i roms, 0x%X Chars, 0x%X Sprites)\n"), GalTilesSharedRomSize, GalTilesSharedRomNum, GalNumChars, GalNumSprites); + if (GalTilesCharRomSize) bprintf(PRINT_NORMAL, _T("Char Rom Size: 0x%X (%i roms, 0x%X Chars)\n"), GalTilesCharRomSize, GalTilesCharRomNum, GalNumChars); + if (GalTilesSpriteRomSize) bprintf(PRINT_NORMAL, _T("Sprite Rom Size: 0x%X (%i roms, 0x%X Sprites)\n"), GalTilesSpriteRomSize, GalTilesSpriteRomNum, GalNumSprites); + if (GalPromRomSize) bprintf(PRINT_NORMAL, _T("PROM Rom Size: 0x%X (%i roms)\n"), GalPromRomSize, GalPromRomNum); +#endif + } + + if (bLoad) { + INT32 Offset; + + // Z80 #1 Program Roms + Offset = 0; + for (i = 0; i < GalZ80Rom1Num; i++) { + nRet = BurnLoadRom(GalZ80Rom1 + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + + // Z80 #2 Program Roms + if (GalZ80Rom2Size) { + Offset = 0; + for (i = GAL_ROM_OFFSET_Z80_PROG2; i < GAL_ROM_OFFSET_Z80_PROG2 + GalZ80Rom2Num; i++) { + nRet = BurnLoadRom(GalZ80Rom2 + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // Z80 #3 Program Roms + if (GalZ80Rom3Size) { + Offset = 0; + for (i = GAL_ROM_OFFSET_Z80_PROG3; i < GAL_ROM_OFFSET_Z80_PROG3 + GalZ80Rom3Num; i++) { + nRet = BurnLoadRom(GalZ80Rom3 + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // Shared Tile Roms + if (GalTilesSharedRomSize) { + Offset = 0; + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); + for (i = GAL_ROM_OFFSET_TILES_SHARED; i < GAL_ROM_OFFSET_TILES_SHARED + GalTilesSharedRomNum; i++) { + nRet = BurnLoadRom(GalTempRom + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + } + + // Char Tile Roms + if (GalTilesCharRomSize) { + Offset = 0; + GalTempRom = (UINT8*)BurnMalloc(GalTilesCharRomSize); + for (i = GAL_ROM_OFFSET_TILES_CHARS; i < GAL_ROM_OFFSET_TILES_CHARS + GalTilesCharRomNum; i++) { + nRet = BurnLoadRom(GalTempRom + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + GfxDecode(GalNumChars, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, GalTempRom, GalChars); + BurnFree(GalTempRom); + } + + // Sprite Tile Roms + if (GalTilesSpriteRomSize) { + Offset = 0; + GalTempRom = (UINT8*)BurnMalloc(GalTilesSpriteRomSize); + for (i = GAL_ROM_OFFSET_TILES_SPRITES; i < GAL_ROM_OFFSET_TILES_SPRITES + GalTilesSpriteRomNum; i++) { + nRet = BurnLoadRom(GalTempRom + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + GfxDecode(GalNumSprites, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, GalTempRom, GalSprites); + BurnFree(GalTempRom); + } + + // Prom + if (GalPromRomSize) { + Offset = 0; + for (i = GAL_ROM_OFFSET_PROM; i < GAL_ROM_OFFSET_PROM + GalPromRomNum; i++) { + nRet = BurnLoadRom(GalProm + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // S2650 #1 Program Roms + if (GalS2650Rom1Size) { + Offset = 0; + for (i = GAL_ROM_OFFSET_S2650_PROG1; i < GAL_ROM_OFFSET_S2650_PROG1 + GalS2650Rom1Num; i++) { + nRet = BurnLoadRom(GalS2650Rom1 + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + } + + return nRet; +} + +// Konami PPI Handlers +UINT8 KonamiPPIReadIN0() +{ + return 0xff - GalInput[0] - GalDip[0]; +} + +UINT8 KonamiPPIReadIN1() +{ + return 0xff - GalInput[1] - GalDip[1]; +} + +UINT8 KonamiPPIReadIN2() +{ + return 0xff - GalInput[2] - GalDip[2]; +} + +UINT8 KonamiPPIReadIN3() +{ + return 0xff - GalInput[3] - GalDip[3]; +} + +void KonamiPPIInit() +{ + ppi8255_init(2); + PPI0PortReadA = KonamiPPIReadIN0; + PPI0PortReadB = KonamiPPIReadIN1; + PPI0PortReadC = KonamiPPIReadIN2; + PPI1PortReadC = KonamiPPIReadIN3; + PPI1PortWriteA = KonamiSoundLatchWrite; + PPI1PortWriteB = KonamiSoundControlWrite; +} + +// Galaxian Memory Map +UINT8 __fastcall GalaxianZ80Read(UINT16 a) +{ + switch (a) { + case 0x6000: { + return GalInput[0] | GalDip[0]; + } + + case 0x6800: { + return GalInput[1] | GalDip[1]; + } + + case 0x7000: { + return GalInput[2] | GalDip[2]; + } + + case 0x7800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall GalaxianZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5800 && a <= 0x58ff) { + int Offset = a - 0x5800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x6000: + case 0x6001: { + // start_lamp_w + return; + } + + case 0x6002: { + // coin_lock_w + return; + } + + case 0x6003: { + // coin_count_0_w + return; + } + + case 0x6004: + case 0x6005: + case 0x6006: + case 0x6007: { + GalaxianLfoFreqWrite(a - 0x6004, d); + return; + } + + case 0x6800: + case 0x6801: + case 0x6802: + case 0x6803: + case 0x6804: + case 0x6805: + case 0x6806: + case 0x6807: { + GalaxianSoundWrite(a - 0x6800, d); + return; + } + + case 0x7001: { + GalIrqFire = d & 1; + return; + } + + case 0x7004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x7006: { + GalFlipScreenX = d & 1; + return; + } + + case 0x7007: { + GalFlipScreenY = d & 1; + return; + } + + case 0x7800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall GalaxianZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall GalaxianZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +INT32 GalInit() +{ + INT32 nLen; + + GalLoadRoms(0); + + if (!GalSoundType) GalSoundType = GAL_SOUND_HARDWARE_TYPE_GALAXIAN; + + // Allocate and Blank all required memory + GalMem = NULL; + GalMemIndex(); + nLen = GalMemEnd - (UINT8 *)0; + if ((GalMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(GalMem, 0, nLen); + GalMemIndex(); + + if (GalLoadRoms(1)) return 1; + + // Setup the Z80 emulation + if (GalSoundType != GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) { + if (GalZ80Rom3Size) { + ZetInit(0); + ZetInit(1); + ZetInit(2); + } else { + if (GalZ80Rom2Size) { + ZetInit(0); + ZetInit(1); + } else { + if (GalZ80Rom1Size) { + ZetInit(0); + } + } + } + if (GalZ80Rom1Size) { + ZetOpen(0); + ZetSetReadHandler(GalaxianZ80Read); + ZetSetWriteHandler(GalaxianZ80Write); + ZetSetInHandler(GalaxianZ80PortRead); + ZetSetOutHandler(GalaxianZ80PortWrite); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x4000, 0x43ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x43ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x43ff, 2, GalZ80Ram1); + ZetMapArea(0x4400, 0x47ff, 0, GalZ80Ram1); + ZetMapArea(0x4400, 0x47ff, 1, GalZ80Ram1); + ZetMapArea(0x4400, 0x47ff, 2, GalZ80Ram1); + ZetMapArea(0x5000, 0x53ff, 0, GalVideoRam); + ZetMapArea(0x5000, 0x53ff, 1, GalVideoRam); + ZetMapArea(0x5000, 0x53ff, 2, GalVideoRam); + ZetMapArea(0x5800, 0x58ff, 0, GalSpriteRam); + ZetMapArea(0x5800, 0x58ff, 2, GalSpriteRam); + ZetClose(); + } + } + + nGalCyclesTotal[0] = (18432000 / 3 / 2) / 60; + + if (GalPostLoadCallbackFunction) GalPostLoadCallbackFunction(); + + GalCalcPaletteFunction = GalaxianCalcPalette; + GalRenderBackgroundFunction = GalaxianDrawBackground; + GalDrawBulletsFunction = GalaxianDrawBullets; + + GalIrqType = GAL_IRQ_TYPE_NMI; + + GalSpriteClipStart = 16; + GalSpriteClipEnd = 255; + + GalSoundInit(); + + GalInitStars(); + + GenericTilesInit(); + + GalColourDepth = 2; + + // Reset the driver + GalDoReset(); + + return 0; +} + +// Moon Cresta Memory Map +UINT8 __fastcall MooncrstZ80Read(UINT16 a) +{ + switch (a) { + case 0xa000: { + return GalInput[0] | GalDip[0]; + } + + case 0xa800: { + return GalInput[1] | GalDip[1]; + } + + case 0xb000: { + return GalInput[2] | GalDip[2]; + } + + case 0xb800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall MooncrstZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + int Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0xa000: + case 0xa001: + case 0xa002: { + GalGfxBank[a - 0xa000] = d; + return; + } + + case 0xa003: { + // coin_count_0_w + return; + } + + case 0xa004: + case 0xa005: + case 0xa006: + case 0xa007: { + GalaxianLfoFreqWrite(a - 0xa004, d); + return; + } + + case 0xa800: + case 0xa801: + case 0xa802: + case 0xa803: + case 0xa804: + case 0xa805: + case 0xa806: + case 0xa807: { + GalaxianSoundWrite(a - 0xa800, d); + return; + } + + case 0xb000: { + GalIrqFire = d & 1; + return; + } + + case 0xb004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xb006: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb007: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb800: { + GalPitch = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall MooncrstZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall MooncrstZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void MapMooncrst() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(MooncrstZ80Read); + ZetSetWriteHandler(MooncrstZ80Write); + ZetSetInHandler(MooncrstZ80PortRead); + ZetSetOutHandler(MooncrstZ80PortWrite); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size >= 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram1); + ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); + ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); + ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); + ZetClose(); +} + +// Jumpbug Memory Map +UINT8 __fastcall JumpbugZ80Read(UINT16 a) +{ + if (a >= 0xb000 && a <= 0xbfff) { + INT32 Offset = a - 0xb000; + + switch (Offset) { + case 0x114: return 0x4f; + case 0x118: return 0xd3; + case 0x214: return 0xcf; + case 0x235: return 0x02; + case 0x311: return 0xff; + } + } + + switch (a) { + case 0x6000: { + return GalInput[0] | GalDip[0]; + } + + case 0x6800: { + return GalInput[1] | GalDip[1]; + } + + case 0x7000: { + return GalInput[2] | GalDip[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall JumpbugZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x5800: { + AY8910Write(0, 1, d); + return; + } + + case 0x5900: { + AY8910Write(0, 0, d); + return; + } + + case 0x6002: + case 0x6003: + case 0x6004: + case 0x6005: + case 0x6006: { + GalGfxBank[a - 0x6002] = d; + return; + } + + case 0x7001: { + GalIrqFire = d & 1; + return; + } + + case 0x7002: { + // coin_count_0_w + return; + } + + case 0x7004: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x7006: { + GalFlipScreenX = d & 1; + return; + } + + case 0x7007: { + GalFlipScreenY = d & 1; + return; + } + + case 0x7800: { + // watchdog write + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall JumpbugZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall JumpbugZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void MapJumpbug() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(JumpbugZ80Read); + ZetSetWriteHandler(JumpbugZ80Write); + ZetSetInHandler(JumpbugZ80PortRead); + ZetSetOutHandler(JumpbugZ80PortWrite); + ZetMapArea(0x0000, 0x3fff, 0, GalZ80Rom1); + ZetMapArea(0x0000, 0x3fff, 2, GalZ80Rom1); + ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); + ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 0, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 1, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 2, GalVideoRam); + ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); + ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); + ZetMapArea(0x8000, GalZ80Rom1Size + 0x4000 - 1, 0, GalZ80Rom1 + 0x4000); + ZetMapArea(0x8000, GalZ80Rom1Size + 0x4000 - 1, 2, GalZ80Rom1 + 0x4000); + ZetClose(); +} + +// Frogger Memory Map +UINT8 __fastcall FroggerZ80Read(UINT16 a) +{ + if (a >= 0xc000) { + UINT32 Offset = a - 0xc000; + UINT8 Result = 0xff; + if (Offset & 0x1000) Result &= ppi8255_r(1, (Offset >> 1) & 3); + if (Offset & 0x2000) Result &= ppi8255_r(0, (Offset >> 1) & 3); + return Result; + } + + switch (a) { + case 0x8800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall FroggerZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0xb000 && a <= 0xb0ff) { + INT32 Offset = a - 0xb000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + d = (d >> 4) | (d << 4); + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0xc000) { + INT32 Offset = a - 0xc000; + if (Offset & 0x1000) ppi8255_w(1, (Offset >> 1) & 3, d); + if (Offset & 0x2000) ppi8255_w(0, (Offset >> 1) & 3, d); + return; + } + + switch (a) { + case 0xb808: { + GalIrqFire = d & 1; + return; + } + + case 0xb80c: { + GalFlipScreenY = d & 1; + return; + } + + case 0xb810: { + GalFlipScreenX = d & 1; + return; + } + + case 0xb818: { + // coin_count_0_w + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall FroggerZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall FroggerZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void MapFrogger() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(FroggerZ80Read); + ZetSetWriteHandler(FroggerZ80Write); + ZetSetInHandler(FroggerZ80PortRead); + ZetSetOutHandler(FroggerZ80PortWrite); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetMapArea(0xa800, 0xabff, 0, GalVideoRam); + ZetMapArea(0xa800, 0xabff, 1, GalVideoRam); + ZetMapArea(0xa800, 0xabff, 2, GalVideoRam); + ZetMapArea(0xb000, 0xb0ff, 0, GalSpriteRam); + ZetMapArea(0xb000, 0xb0ff, 2, GalSpriteRam); + ZetClose(); +} + +// The End Memory Map +UINT8 __fastcall TheendZ80Read(UINT16 a) +{ + if (a >= 0x8000) { + UINT32 Offset = a - 0x8000; + UINT8 Result = 0xff; + if (Offset & 0x0100) Result &= ppi8255_r(0, Offset & 3); + if (Offset & 0x0200) Result &= ppi8255_r(1, Offset & 3); + return Result; + } + + switch (a) { + case 0x7000: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall TheendZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x5000 && a <= 0x50ff) { + INT32 Offset = a - 0x5000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0x8000) { + INT32 Offset = a - 0x8000; + if (Offset & 0x0100) ppi8255_w(0, Offset & 3, d); + if (Offset & 0x0200) ppi8255_w(1, Offset & 3, d); + return; + } + + switch (a) { + case 0x6801: { + GalIrqFire = d & 1; + return; + } + + case 0x6802: { + // coin_count_0_w + return; + } + + case 0x6803: { + GalBackgroundEnable = d & 1; + return; + } + + case 0x6804: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0x6806: { + GalFlipScreenX = d & 1; + return; + } + + case 0x6807: { + GalFlipScreenY = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall TheendZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall TheendZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void MapTheend() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(TheendZ80Read); + ZetSetWriteHandler(TheendZ80Write); + ZetSetInHandler(TheendZ80PortRead); + ZetSetOutHandler(TheendZ80PortWrite); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x4000) ? 0x3fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x4000, 0x47ff, 0, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 1, GalZ80Ram1); + ZetMapArea(0x4000, 0x47ff, 2, GalZ80Ram1); + ZetMapArea(0x4800, 0x4bff, 0, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 1, GalVideoRam); + ZetMapArea(0x4800, 0x4bff, 2, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 0, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 1, GalVideoRam); + ZetMapArea(0x4c00, 0x4fff, 2, GalVideoRam); + ZetMapArea(0x5000, 0x50ff, 0, GalSpriteRam); + ZetMapArea(0x5000, 0x50ff, 2, GalSpriteRam); + ZetClose(); +} + +// Turtles Memory Map +UINT8 __fastcall TurtlesZ80Read(UINT16 a) +{ + if (a >= 0xb000 && a <= 0xb03f) { + UINT32 Offset = a - 0xb000; + return ppi8255_r(0, (Offset >> 4) & 3); + } + + if (a >= 0xb800 && a <= 0xb83f) { + UINT32 Offset = a - 0xb800; + return ppi8255_r(1, (Offset >> 4) & 3); + } + + switch (a) { + case 0xa800: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall TurtlesZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9800 && a <= 0x98ff) { + INT32 Offset = a - 0x9800; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + if (a >= 0xb000 && a <= 0xb03f) { + UINT32 Offset = a - 0xb000; + ppi8255_w(0, (Offset >> 4) & 3, d); + return; + } + + if (a >= 0xb800 && a <= 0xb83f) { + UINT32 Offset = a - 0xb800; + ppi8255_w(1, (Offset >> 4) & 3, d); + return; + } + + switch (a) { + case 0xa000: { + GalBackgroundRed = d & 1; + return; + } + + case 0xa008: { + GalIrqFire = d & 1; + return; + } + + case 0xa010: { + GalFlipScreenY = d & 1; + return; + } + + case 0xa018: { + GalFlipScreenX = d & 1; + return; + } + + case 0xa020: { + GalBackgroundGreen = d & 1; + return; + } + + case 0xa028: { + GalBackgroundBlue = d & 1; + return; + } + + case 0xa030: { + // coin_count_0_w + return; + } + + case 0xa038: { + // coin_count_1_w + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall TurtlesZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall TurtlesZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void MapTurtles() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(TurtlesZ80Read); + ZetSetWriteHandler(TurtlesZ80Write); + ZetSetInHandler(TurtlesZ80PortRead); + ZetSetOutHandler(TurtlesZ80PortWrite); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetMapArea(0x9000, 0x93ff, 0, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 1, GalVideoRam); + ZetMapArea(0x9000, 0x93ff, 2, GalVideoRam); + ZetMapArea(0x9400, 0x97ff, 0, GalVideoRam); + ZetMapArea(0x9400, 0x97ff, 1, GalVideoRam); + ZetMapArea(0x9400, 0x97ff, 2, GalVideoRam); + ZetMapArea(0x9800, 0x98ff, 0, GalSpriteRam); + ZetMapArea(0x9800, 0x98ff, 2, GalSpriteRam); + ZetClose(); +} + +// Super Cobra Memory Map +UINT8 __fastcall ScobraZ80Read(UINT16 a) +{ + switch (a) { + case 0x9800: + case 0x9801: + case 0x9802: + case 0x9803: { + return ppi8255_r(0, a - 0x9800); + } + + case 0xa000: + case 0xa001: + case 0xa002: + case 0xa003: { + return ppi8255_r(1, a - 0xa000); + } + + case 0xb000: { + // watchdog read + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall ScobraZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9000 && a <= 0x90ff) { + INT32 Offset = a - 0x9000; + + GalSpriteRam[Offset] = d; + + if (Offset < 0x40) { + if ((Offset & 0x01) == 0) { + GalScrollVals[Offset >> 1] = d; + } + } + + return; + } + + switch (a) { + case 0x9800: + case 0x9801: + case 0x9802: + case 0x9803: { + return ppi8255_w(0, a - 0x9800, d); + } + + case 0xa000: + case 0xa001: + case 0xa002: + case 0xa003: { + return ppi8255_w(1, a - 0xa000, d); + } + + case 0xa801: { + GalIrqFire = d & 1; + return; + } + + case 0xa802: { + // coin_count_0_w + return; + } + + case 0xa803: { + GalBackgroundEnable = d & 1; + return; + } + + case 0xa804: { + GalStarsEnable = d & 0x01; + if (!GalStarsEnable) GalStarsScrollPos = -1; + return; + } + + case 0xa806: { + GalFlipScreenX = d & 1; + return; + } + + case 0xa807: { + GalFlipScreenY = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall ScobraZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0xff; +} + +void __fastcall ScobraZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void MapScobra() +{ + ZetOpen(0); + ZetMemCallback(0x0000, 0xffff, 0); + ZetMemCallback(0x0000, 0xffff, 1); + ZetMemCallback(0x0000, 0xffff, 2); + ZetSetReadHandler(ScobraZ80Read); + ZetSetWriteHandler(ScobraZ80Write); + ZetSetInHandler(ScobraZ80PortRead); + ZetSetOutHandler(ScobraZ80PortWrite); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, (GalZ80Rom1Size > 0x8000) ? 0x7fff : GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x87ff, 0, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 1, GalZ80Ram1); + ZetMapArea(0x8000, 0x87ff, 2, GalZ80Ram1); + ZetMapArea(0x8800, 0x8bff, 0, GalVideoRam); + ZetMapArea(0x8800, 0x8bff, 1, GalVideoRam); + ZetMapArea(0x8800, 0x8bff, 2, GalVideoRam); + ZetMapArea(0x8c00, 0x8fff, 0, GalVideoRam); + ZetMapArea(0x8c00, 0x8fff, 1, GalVideoRam); + ZetMapArea(0x8c00, 0x8fff, 2, GalVideoRam); + ZetMapArea(0x9000, 0x90ff, 0, GalSpriteRam); + ZetMapArea(0x9000, 0x90ff, 2, GalSpriteRam); + ZetClose(); +} + +INT32 GalExit() +{ + if (GalZ80Rom1Size) ZetExit(); + if (GalS2650Rom1Size) s2650Exit(); + + GenericTilesExit(); + + BurnFree(GalMem); + BurnFree(GalZ80Rom1Op); + BurnFree(GalVideoRam2); + BurnFree(RockclimTiles); + + GalSoundExit(); + + GalIrqFire = 0; + GalIrqType = 0; + GalSoundType = 0; + GalFlipScreenX = 0; + GalFlipScreenY = 0; + ZigzagAYLatch = 0; + GalSoundLatch = 0; + GalSoundLatch2 = 0; + KingballSpeechDip = 0; + KingballSound = 0; + KonamiSoundControl = 0; + SfxSampleControl = 0; + GmgalaxSelectedGame = 0; + GalPaletteBank = 0; + GalSpriteClipStart = 0; + GalSpriteClipEnd = 0; + FroggerAdjust = 0; + GalBackgroundRed = 0; + GalBackgroundGreen = 0; + GalBackgroundBlue = 0; + GalBackgroundEnable = 0; + ScrambleProtectionState = 0; + ScrambleProtectionResult = 0; + + GalZ80Rom1Size = 0; + GalZ80Rom1Num = 0; + GalZ80Rom2Size = 0; + GalZ80Rom2Num = 0; + GalZ80Rom3Size = 0; + GalZ80Rom3Num = 0; + GalS2650Rom1Size = 0; + GalS2650Rom1Num = 0; + GalTilesSharedRomSize = 0; + GalTilesSharedRomNum = 0; + GalTilesCharRomSize = 0; + GalTilesCharRomNum = 0; + GalNumChars = 0; + GalTilesSpriteRomSize = 0; + GalTilesSpriteRomNum = 0; + GalNumSprites = 0; + GalPromRomSize = 0; + GalPromRomNum = 0; + + GalPostLoadCallbackFunction = NULL; + GalRenderBackgroundFunction = NULL; + GalCalcPaletteFunction = NULL; + GalDrawBulletsFunction = NULL; + GalExtendTileInfoFunction = NULL; + GalExtendSpriteInfoFunction = NULL; + GalRenderFrameFunction = NULL; + + SfxTilemap = 0; + GalOrientationFlipX = 0; + MoonwarPortSelect = 0; + MshuttleAY8910CS = 0; + Fourin1Bank = 0; + GameIsGmgalax = 0; + CavelonBankSwitch = 0; + DarkplntBulletColour = 0; + DambustrBgColour1 = 0; + DambustrBgColour2 = 0; + DambustrBgPriority = 0; + DambustrBgSplitLine = 0; + RockclimScrollX = 0; + RockclimScrollY = 0; + GalVBlank = 0; + + GalColourDepth = 0; + + return 0; +} + +INT32 KonamiExit() +{ + ppi8255_exit(); + + return GalExit(); +} + +INT32 GalFrame() +{ + INT32 nInterleave = 8; + INT32 nSoundBufferPos = 0; + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { + nInterleave = nBurnSoundLen; + GalaxianSoundUpdateTimers(); + } + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) nInterleave = nBurnSoundLen / 4; + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) nInterleave = 32; + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910) nInterleave = 32; + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) nInterleave = 32; + + INT32 nIrqInterleaveFire = nInterleave / 4; + + if (GalReset) GalDoReset(); + + if (GameIsGmgalax && (GmgalaxSelectedGame != GalFakeDip)) { + GmgalaxSelectedGame = GalFakeDip; + INT32 nAddress = 0x0000; + if (GmgalaxSelectedGame == 1) nAddress = 0x4000; + ZetOpen(0); + ZetMapArea(0x0000, 0x3fff, 0, GalZ80Rom1 + nAddress); + ZetMapArea(0x0000, 0x3fff, 2 ,GalZ80Rom1 + nAddress); + ZetClose(); + + GalGfxBank[0] = 0; + if (GmgalaxSelectedGame == 1) GalGfxBank[0] = 1; + GalPaletteBank = 0; + if (GmgalaxSelectedGame == 1) GalPaletteBank = 1; + + GalDoReset(); + } + + GalMakeInputs(); + GalVBlank = 0; + + if (GalZ80Rom1Size) ZetNewFrame(); + + nGalCyclesDone[0] = nGalCyclesDone[1] = nGalCyclesDone[2] = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + if (GalZ80Rom1Size && GalSoundType != GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) { + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; + nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; + nGalCyclesDone[nCurrentCPU] += ZetRun(nGalCyclesSegment); + if (i == nIrqInterleaveFire && GalIrqFire) { + if (GalIrqType == GAL_IRQ_TYPE_NMI) ZetNmi(); + if (GalIrqType == GAL_IRQ_TYPE_IRQ0) ZetRaiseIrq(0); + GalIrqFire = 0; + } + ZetClose(); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910) { + // Run Z80 #2 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; + nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; + nGalCyclesDone[nCurrentCPU] += ZetRun(nGalCyclesSegment); + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910) ZetRaiseIrq(0); + ZetClose(); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910) { + // Run Z80 #2 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; + nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; + nGalCyclesSegment = ZetRun(nGalCyclesSegment); + nGalCyclesDone[nCurrentCPU] += nGalCyclesSegment; + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nGalCyclesDone[nCurrentCPU] += ZetRun(300); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + nGalCyclesDone[nCurrentCPU] += ZetRun(300); + ZetClose(); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { + // Run Z80 #3 + nCurrentCPU = 2; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; + nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; + nGalCyclesDone[nCurrentCPU] += ZetRun(nGalCyclesSegment); + ZetClose(); + } + + // Run S2650 #1 + if (GalS2650Rom1Size) { + nCurrentCPU = 0; + s2650Open(nCurrentCPU); + nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; + nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; + nGalCyclesDone[nCurrentCPU] += s2650Run(nGalCyclesSegment); + if (i == nIrqInterleaveFire) { + GalVBlank = 1; + s2650_set_irq_line(0, 1); + s2650Run(0); + s2650_set_irq_line(0, 0); + s2650Run(0); + } + s2650Close(); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) { + // Run Z80 #1 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nGalCyclesTotal[nCurrentCPU] / nInterleave; + nGalCyclesSegment = nNext - nGalCyclesDone[nCurrentCPU]; + nGalCyclesDone[nCurrentCPU] += ZetRun(nGalCyclesSegment); + if (HunchbksSoundIrqFire) ZetRaiseIrq(0); + ZetClose(); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN) { + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + GalRenderSoundSamples(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910) { + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + AY8910Update(0, &pAY8910Buffer[0], nSegmentLength); + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910) { + AY8910Update(1, &pAY8910Buffer[3], nSegmentLength); + } + + filter_rc_update(0, pAY8910Buffer[0], pSoundBuf, nSegmentLength); + filter_rc_update(1, pAY8910Buffer[1], pSoundBuf, nSegmentLength); + filter_rc_update(2, pAY8910Buffer[2], pSoundBuf, nSegmentLength); + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910) { + filter_rc_update(3, pAY8910Buffer[3], pSoundBuf, nSegmentLength); + filter_rc_update(4, pAY8910Buffer[4], pSoundBuf, nSegmentLength); + filter_rc_update(5, pAY8910Buffer[5], pSoundBuf, nSegmentLength); + } + + nSoundBufferPos += nSegmentLength; + } + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + GalRenderSoundSamples(pSoundBuf, nSegmentLength); + DACUpdate(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HEXPOOLASN76496) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + SN76496Update(0, pSoundBuf, nSegmentLength); + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496) { + SN76496Update(1, pSoundBuf, nSegmentLength); + SN76496Update(2, pSoundBuf, nSegmentLength); + } + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN) { + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + GalRenderSoundSamples(pSoundBuf, nSegmentLength); + } + } + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910) { + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Update(0, &pAY8910Buffer[0], nSegmentLength); + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910) { + AY8910Update(1, &pAY8910Buffer[3], nSegmentLength); + } + + filter_rc_update(0, pAY8910Buffer[0], pSoundBuf, nSegmentLength); + filter_rc_update(1, pAY8910Buffer[1], pSoundBuf, nSegmentLength); + filter_rc_update(2, pAY8910Buffer[2], pSoundBuf, nSegmentLength); + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910) { + filter_rc_update(3, pAY8910Buffer[3], pSoundBuf, nSegmentLength); + filter_rc_update(4, pAY8910Buffer[4], pSoundBuf, nSegmentLength); + filter_rc_update(5, pAY8910Buffer[5], pSoundBuf, nSegmentLength); + } + } + } + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + GalRenderSoundSamples(pSoundBuf, nSegmentLength); + DACUpdate(pSoundBuf, nSegmentLength); + } + } + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { + if (pBurnSoundOut) DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HEXPOOLASN76496) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + SN76496Update(0, pSoundBuf, nSegmentLength); + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496) { + SN76496Update(1, pSoundBuf, nSegmentLength); + SN76496Update(2, pSoundBuf, nSegmentLength); + } + } + } + + if (pBurnDraw) GalDraw(); + + return 0; +} + +INT32 GalScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029703; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = GalRamStart; + ba.nLen = GalRamEnd - GalRamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + if (GalZ80Rom1Size) ZetScan(nAction); + ppi8255_scan(); + if (GalS2650Rom1Size) s2650Scan(nAction, pnMin); + + GalSoundScan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(GalInput); + SCAN_VAR(GalAnalogPort0); + SCAN_VAR(GalAnalogPort1); + SCAN_VAR(GalIrqFire); + SCAN_VAR(nGalCyclesDone); + SCAN_VAR(nGalCyclesSegment); + SCAN_VAR(ZigzagAYLatch); + SCAN_VAR(GalSoundLatch); + SCAN_VAR(GalSoundLatch2); + SCAN_VAR(KingballSound); + SCAN_VAR(KingballSpeechDip); + SCAN_VAR(KonamiSoundControl); + SCAN_VAR(SfxSampleControl); + SCAN_VAR(ScrambleProtectionResult); + SCAN_VAR(MoonwarPortSelect); + SCAN_VAR(MshuttleAY8910CS); + SCAN_VAR(GmgalaxSelectedGame); + SCAN_VAR(Fourin1Bank); + SCAN_VAR(CavelonBankSwitch); + SCAN_VAR(GalFlipScreenX); + SCAN_VAR(GalFlipScreenY); + SCAN_VAR(GalPaletteBank); + SCAN_VAR(GalBackgroundRed); + SCAN_VAR(GalBackgroundGreen); + SCAN_VAR(GalBackgroundBlue); + SCAN_VAR(GalBackgroundEnable); + SCAN_VAR(DarkplntBulletColour); + SCAN_VAR(DambustrBgColour1); + SCAN_VAR(DambustrBgColour2); + SCAN_VAR(DambustrBgPriority); + SCAN_VAR(DambustrBgSplitLine); + SCAN_VAR(RockclimScrollX); + SCAN_VAR(RockclimScrollY); + SCAN_VAR(GalStarsEnable); + SCAN_VAR(GalStarsScrollPos); + SCAN_VAR(GalStarsBlinkState); + SCAN_VAR(GalVBlank); + } + + return 0; +} diff --git a/src/burn/drv/galaxian/gal_sound.cpp b/src/burn/drv/galaxian/gal_sound.cpp index 9880a74ed..3f53e7b79 100644 --- a/src/burn/drv/galaxian/gal_sound.cpp +++ b/src/burn/drv/galaxian/gal_sound.cpp @@ -1,1091 +1,1088 @@ -#include "gal.h" - -INT16* pFMBuffer; -INT16* pAY8910Buffer[9]; - -UINT8 GalSoundType; -UINT8 HunchbksSoundIrqFire; - -#define XTAL 18432000 -#define RNG_RATE (XTAL / 3) -#define NOISE_RATE (XTAL / 3 / 192 / 2 / 2) -#define NOISE_LENGTH (NOISE_RATE * 4) -#define NOISE_AMPLITUDE (70 * 256) -#define SHOOT_VOLUME 0.50f -#define SHOOT_SEC 2 -#define R41__ 100000 -#define R44__ 10000 -#define R45__ 22000 -#define R46__ 10000 -#define R47__ 2200 -#define R48__ 2200 -#define C25__ 0.000001 -#define C27__ 0.00000001 -#define C28__ 0.000047 -#define C29__ 0.00000001 -#define IC8L3_L 0.2 -#define IC8L3_H 4.5 -#define NOISE_L 0.2 -#define NOISE_H 4.5 -#define SHOOT_KEYON_TIME 0.1 -#define NE555_FM_ADJUST_RATE 0.80 -#define TOOTHSAW_LENGTH 16 -#define TOOTHSAW_VOLUME 0.36f -#define TOOTHSAW_AMPLITUDE (64*256) -#define V(r0,r1) 2 * TOOTHSAW_AMPLITUDE * (r0) / (r0 + r1) - TOOTHSAW_AMPLITUDE -#define STEPS 16 -#define LFO_VOLUME 0.06f -#define MINFREQ (139 - 139 / 3) -#define MAXFREQ (139 + 139 / 3) - -static INT16 *GalNoiseWave; -static INT16 *GalShootWave; -static UINT32 GalShootLength; -static UINT32 GalShootRate; -UINT8 GalLastPort2 = 0; -UINT8 GalShootEnable; -UINT8 GalNoiseEnable; -INT32 GalNoiseVolume; -double GalShootWavePos; -double GalNoiseWavePos; -double GalLfoWavePos[3]; -INT32 GalPitch; -INT32 GalVol; -static double GalCounter; -static INT32 GalCountDown; -INT32 GalLfoVolume[3]; -double GalLfoFreq; -double GalLfoFreqFrameVar; -INT32 GalLfoBit[4]; -static double GalGain; -static INT32 GalOutputDir; - -static INT16 GalToneWave[4][TOOTHSAW_LENGTH]; - -static const INT16 GalBackgroundWave[32] = -{ - 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, - 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, - -0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000, - -0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000, -}; - -void GalaxianSoundSetRoute(double nVolume, INT32 nRouteDir) -{ - GalGain = nVolume; - GalOutputDir = nRouteDir; -} - -void GalSoundReset() -{ - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910) { - AY8910Reset(0); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { - AY8910Reset(0); - AY8910Reset(1); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910) { - AY8910Reset(0); - AY8910Reset(1); - AY8910Reset(2); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { - DACReset(); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { - GalLastPort2 = 0; - GalShootEnable = 0; - GalNoiseEnable = 0; - GalNoiseVolume = 0; - GalShootWavePos = 0; - GalNoiseWavePos = 0; - GalLfoWavePos[0] = GalLfoWavePos[1] = GalLfoWavePos[2] = 0; - GalPitch = 0xff; - GalVol = 0; - GalCounter = 0; - GalCountDown = 0; - GalLfoVolume[0] = GalLfoVolume[1] = GalLfoVolume[2] = 0; - GalLfoFreq = MAXFREQ; - GalLfoFreqFrameVar = 0; - GalLfoBit[0] = GalLfoBit[1] = GalLfoBit[2] = GalLfoBit[3] = 0; - } -} - -void GalSoundInit() -{ - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910) { - pFMBuffer = (INT16*)BurnMalloc(nBurnSoundLen * 3 * sizeof(INT16)); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { - pFMBuffer = (INT16*)BurnMalloc(nBurnSoundLen * 6 * sizeof(INT16)); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910) { - pFMBuffer = (INT16*)BurnMalloc(nBurnSoundLen * 9 * sizeof(INT16)); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910) { - pAY8910Buffer[6] = pFMBuffer + nBurnSoundLen * 6; - pAY8910Buffer[7] = pFMBuffer + nBurnSoundLen * 7; - pAY8910Buffer[8] = pFMBuffer + nBurnSoundLen * 8; - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910) { - AY8910Init(0, 1789750, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910) { - AY8910Init(0, 1789750, nBurnSoundRate, &BongoDipSwitchRead, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910) { - AY8910Init(0, 1620000, nBurnSoundRate, &CheckmajPortARead, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910) { - // Port A Write - cclimber_sample_select_w - AY8910Init(0, 18432000 / 3 / 4, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910) { - AY8910Init(0, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, &FroggerSoundTimerRead, NULL, NULL); - - filter_rc_init(0, FLT_RC_LOWPASS, 1, 1, 1, 0, 0); - filter_rc_init(1, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); - filter_rc_init(2, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); - - filter_rc_set_src_gain(0, 0.75); - filter_rc_set_src_gain(1, 0.75); - filter_rc_set_src_gain(2, 0.75); - - filter_rc_set_route(0, 1.00, BURN_SND_ROUTE_BOTH); - filter_rc_set_route(1, 1.00, BURN_SND_ROUTE_BOTH); - filter_rc_set_route(2, 1.00, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910) { - AY8910Init(0, 14318000 / 8, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, &KonamiSoundTimerRead, NULL, NULL); - - filter_rc_init(0, FLT_RC_LOWPASS, 1, 1, 1, 0, 0); - filter_rc_init(1, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); - filter_rc_init(2, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); - filter_rc_init(3, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); - filter_rc_init(4, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); - filter_rc_init(5, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); - - filter_rc_set_src_gain(0, 0.50); - filter_rc_set_src_gain(1, 0.50); - filter_rc_set_src_gain(2, 0.50); - filter_rc_set_src_gain(3, 0.50); - filter_rc_set_src_gain(4, 0.50); - filter_rc_set_src_gain(5, 0.50); - - filter_rc_set_route(0, 1.00, BURN_SND_ROUTE_BOTH); - filter_rc_set_route(1, 1.00, BURN_SND_ROUTE_BOTH); - filter_rc_set_route(2, 1.00, BURN_SND_ROUTE_BOTH); - filter_rc_set_route(3, 1.00, BURN_SND_ROUTE_BOTH); - filter_rc_set_route(4, 1.00, BURN_SND_ROUTE_BOTH); - filter_rc_set_route(5, 1.00, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910) { - AY8910Init(0, 14318000 / 8, nBurnSoundRate, &KonamiSoundTimerRead, NULL, NULL, NULL); - AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910) { - AY8910Init(0, 14318000 / 8, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, &KonamiSoundTimerRead, NULL, NULL); - AY8910Init(2, 14318000 / 8, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(2, 0.25, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910) { - AY8910Init(0, 14318000 / 8, nBurnSoundRate, &KonamiSoundTimerRead, NULL, NULL, NULL); - AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.50, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { - AY8910Init(0, 1789750, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 1789750, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { - AY8910Init(0, 14318000 / 8, nBurnSoundRate, NULL, NULL, &SfxSoundLatch2Write, &SfxSampleControlWrite); - AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, &KonamiSoundTimerRead, NULL, NULL); - AY8910SetAllRoutes(0, 0.10, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.10, BURN_SND_ROUTE_BOTH); - - DACInit(0, 0, 1, SfxSyncDAC); - DACSetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { - DACInit(0, 0, 1, KingballSyncDAC); - DACSetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_HEXPOOLASN76496) { - SN76496Init(0, 18432000 / 3 / 2, 0); - SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496) { - SN76496Init(0, 18432000 / 3 / 2, 0); - SN76496Init(1, 18432000 / 3 / 2, 1); - SN76496Init(2, 18432000 / 3 / 2, 1); - SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(2, 1.00, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) { - AY8910Init(0, 14318000 / 8, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, &HunchbksSoundTimerRead, NULL, NULL); - - AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.20, BURN_SND_ROUTE_BOTH); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { - GalShootEnable = 0; - GalShootWavePos = 0; - INT32 CountDown, Generator, Bit1, Bit2; - - GalNoiseWave = (INT16*)BurnMalloc(NOISE_LENGTH * sizeof(INT16)); - - GalShootRate = 22050; - GalShootLength = SHOOT_SEC * GalShootRate; - GalShootWave = (INT16*)BurnMalloc(GalShootLength * sizeof(INT16)); - - Generator = 0; - CountDown = NOISE_RATE / 2; - for (INT32 i = 0; i < NOISE_LENGTH; i++) { - CountDown -= RNG_RATE; - while (CountDown < 0) { - Generator <<= 1; - Bit1 = (~Generator >> 17) & 1; - Bit2 = (Generator >> 5) & 1; - if (Bit1 ^ Bit2) Generator |= 1; - CountDown += NOISE_RATE; - } - GalNoiseWave[i] = ((Generator >> 17) & 1) ? NOISE_AMPLITUDE : -NOISE_AMPLITUDE; - } - - double v = 5.0; - double vK = (GalShootRate) ? exp(-1 / (R41__ * C25__) / GalShootRate) : 0; - double IC8L3 = IC8L3_L; - INT32 IC8Lcnt = (INT32)(SHOOT_KEYON_TIME * GalShootRate); - double c28v = IC8L3_H - (IC8L3_H - (NOISE_H + NOISE_L) / 2) / (R46__ + R47__ + R48__) * R47__; - double c28K = (GalShootRate) ? exp(-1 / (22000 * 0.000047 ) / GalShootRate) : 0; - double c29v = IC8L3_H - (IC8L3_H - (NOISE_H + NOISE_L) / 2) / (R46__ + R47__ + R48__) * (R47__ + R48__); - double c29K1 = (GalShootRate) ? exp(-1 / (22000 * 0.00000001 ) / GalShootRate) : 0; - double c29K2 = (GalShootRate) ? exp(-1 / (100000 * 0.00000001 ) / GalShootRate) : 0; - double ne555cnt = 0; - double ne555step = (GalShootRate) ? ((1.44 / ((R44__ + R45__ * 2) * C27__)) / GalShootRate) : 0; - double ne555duty = (double)(R44__ + R45__) / (R44__ + R45__ * 2); - double ne555sr; - double ncnt = 0.0; - double nstep = (GalShootRate) ? ((double)NOISE_RATE / GalShootRate) : 0; - double noise_sh2; - - for (UINT32 i = 0; i < GalShootLength; i++) { - noise_sh2 = GalNoiseWave[(INT32)ncnt % NOISE_LENGTH] == NOISE_AMPLITUDE ? NOISE_H : NOISE_L; - ncnt += nstep; - ne555sr = c29v * NE555_FM_ADJUST_RATE / (5.0 * 2 / 3); - ne555cnt += ne555step; - if (ne555cnt >= ne555sr) ne555cnt -= ne555sr; - if (ne555cnt < ne555sr * ne555duty) { - GalShootWave[i] = (INT16)(v / 5 * 0x7fff); - if(IC8L3 == IC8L3_H) v *= vK; - } else { - GalShootWave[i] = 0; - } - c28v += (IC8L3 - c28v) - (IC8L3 - c28v) * c28K; - c28v += (c29v - c28v) - (c29v - c28v) * c28K; - c29v += (c28v - c29v) - (c28v - c29v) * c29K1; - c29v += (noise_sh2 - c29v) - (noise_sh2 - c29v) * c29K2; - if(IC8L3 == IC8L3_L && --IC8Lcnt == 0) IC8L3 = IC8L3_H; - } - - memset(GalToneWave, 0, sizeof(GalToneWave)); - - for (UINT32 i = 0; i < TOOTHSAW_LENGTH; i++ ) { - double r0a = 1.0 / 1e12, r1a = 1.0 / 1e12; - double r0b = 1.0 / 1e12, r1b = 1.0 / 1e12; - - if (i & 1) { - r1a += 1.0 / 33000; - r1b += 1.0 / 33000; - } else { - r0a += 1.0 / 33000; - r0b += 1.0 / 33000; - } - if (i & 4) { - r1a += 1.0 / 22000; - r1b += 1.0 / 22000; - } else { - r0a += 1.0 / 22000; - r0b += 1.0 / 22000; - } - GalToneWave[0][i] = (INT16)(V(1.0 / r0a, 1.0 / r1a)); - - if (i & 4) { - r1a += 1.0 / 10000; - } else { - r0a += 1.0 / 10000; - } - GalToneWave[1][i] = (INT16)(V(1.0 / r0a, 1.0 / r1a)); - - if (i & 8) { - r1b += 1.0 / 15000; - } else { - r0b += 1.0 / 15000; - } - GalToneWave[2][i] = (INT16)(V(1.0 / r0b, 1.0 / r1b)); - - if (i & 4) { - r0b += 1.0 / 10000; - } else { - r1b += 1.0 / 10000; - } - GalToneWave[3][i] = (INT16)(V(1.0 / r0b, 1.0 / r1b)); - } - - GalPitch = 0xff; - GalVol = 0; - - GalLfoFreq = MAXFREQ; - GalLfoFreqFrameVar = 0; - - GalGain = 1.00; - GalOutputDir = BURN_SND_ROUTE_BOTH; - } -} - -void GalSoundExit() -{ - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910) { - AY8910Exit(0); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { - AY8910Exit(0); - AY8910Exit(1); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910) { - AY8910Exit(0); - AY8910Exit(1); - AY8910Exit(2); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { - DACExit(); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HEXPOOLASN76496) { - SN76496Exit(); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910) { - filter_rc_exit(); - } - - BurnFree(pFMBuffer); - for (INT32 i = 0; i < 9; i++) pAY8910Buffer[i] = NULL; - - BurnFree(GalNoiseWave); - BurnFree(GalShootWave); - - HunchbksSoundIrqFire = 0; - GalShootLength = 0; - GalShootRate = 0; - GalLastPort2 = 0; - GalShootEnable = 0; - GalNoiseEnable = 0; - GalNoiseVolume = 0; - GalShootWavePos = 0; - GalNoiseWavePos = 0; - GalLfoWavePos[0] = GalLfoWavePos[1] = GalLfoWavePos[2] = 0; - GalPitch = 0; - GalVol = 0; - GalCounter = 0; - GalCountDown = 0; - GalLfoVolume[0] = GalLfoVolume[1] = GalLfoVolume[2] = 0; - GalLfoFreq = 0; - GalLfoFreqFrameVar = 0; - GalLfoBit[0] = GalLfoBit[1] = GalLfoBit[2] = GalLfoBit[3] = 0; - memset(GalToneWave, 0, sizeof(GalToneWave)); -} - -void GalSoundScan(INT32 nAction, INT32 *pnMin) -{ - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { - SCAN_VAR(GalLastPort2); - SCAN_VAR(GalShootEnable); - SCAN_VAR(GalNoiseEnable); - SCAN_VAR(GalNoiseVolume); - SCAN_VAR(GalShootWavePos); - SCAN_VAR(GalNoiseWavePos); - SCAN_VAR(GalLfoWavePos); - SCAN_VAR(GalPitch); - SCAN_VAR(GalVol); - SCAN_VAR(GalCounter); - SCAN_VAR(GalCountDown); - SCAN_VAR(GalLfoVolume); - SCAN_VAR(GalLfoFreq); - SCAN_VAR(GalLfoFreqFrameVar); - SCAN_VAR(GalLfoBit); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { - AY8910Scan(nAction, pnMin); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { - DACScan(nAction, pnMin); - } - - if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496) { - SN76496Scan(nAction, pnMin); - } -} - -// AY8910 Port Handlers -UINT8 CheckmajPortARead(UINT32) -{ - return GalSoundLatch; -} - -UINT8 BongoDipSwitchRead(UINT32) -{ - return GalInput[3] | GalDip[3]; -} - -UINT8 KonamiSoundLatchRead(UINT32) -{ - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return GalSoundLatch; -} - -UINT8 KonamiSoundTimerRead(UINT32) -{ - INT32 nActiveCPU = ZetGetActive(); - UINT32 Cycles; - - if (nActiveCPU == 1) { - Cycles = (ZetTotalCycles() * 8) % (UINT64)(16 * 16 * 2 * 8 * 5 * 2); - } else { - ZetClose(); - ZetOpen(1); - Cycles = (ZetTotalCycles() * 8) % (UINT64)(16 * 16 * 2 * 8 * 5 * 2); - ZetClose(); - ZetOpen(nActiveCPU); - } - - UINT8 HiBit = 0; - - if (Cycles >= 16 * 16 * 2 * 8 * 5) { - HiBit = 1; - Cycles -= 16 * 16 * 2 * 8 * 5; - } - - return (HiBit << 7) | (BIT(Cycles, 14) << 6) | (BIT(Cycles, 13) << 5) | (BIT(Cycles, 11) << 4) | 0x0e; -} - -UINT8 FroggerSoundTimerRead(UINT32) -{ - UINT8 KonamiValue = KonamiSoundTimerRead(0); - return BITSWAP08(KonamiValue, 7, 6, 3, 4, 5, 2, 1, 0); -} - -UINT8 HunchbksSoundTimerRead(UINT32) -{ - INT32 nActiveCPU = ZetGetActive(); - UINT32 Cycles; - - if (nActiveCPU == 0) { - Cycles = (ZetTotalCycles() * 8) % (UINT64)(16 * 16 * 2 * 8 * 5 * 2); - } else { - ZetOpen(0); - Cycles = (ZetTotalCycles() * 8) % (UINT64)(16 * 16 * 2 * 8 * 5 * 2); - ZetClose(); - } - - UINT8 HiBit = 0; - - if (Cycles >= 16 * 16 * 2 * 8 * 5) { - HiBit = 1; - Cycles -= 16 * 16 * 2 * 8 * 5; - } - - return (HiBit << 7) | (BIT(Cycles, 14) << 6) | (BIT(Cycles, 13) << 5) | (BIT(Cycles, 11) << 4) | 0x0e; -} - -void KonamiSoundLatchWrite(UINT8 d) -{ - GalSoundLatch = d; -} - -void KonamiSoundControlWrite(UINT8 d) -{ - UINT8 Old = KonamiSoundControl; - KonamiSoundControl = d; - - if ((Old & 0x08) && !(d & 0x08)) { - INT32 nActiveCPU = ZetGetActive(); - - if (nActiveCPU == 1) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } else { - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(nActiveCPU); - } - } - - /* bit 4 is sound disable */ -// sound_global_enable(~data & 0x10); -} - -void HunchbksSoundControlWrite(UINT8 d) -{ - UINT8 Old = KonamiSoundControl; - KonamiSoundControl = d; - - HunchbksSoundIrqFire = 0; - - if ((Old & 0x08) && !(d & 0x08)) { - HunchbksSoundIrqFire = 1; - } - - /* bit 4 is sound disable */ -// sound_global_enable(~data & 0x10); -} - -void SfxSoundLatch2Write(UINT32, UINT32 d) -{ - GalSoundLatch2 = d & 0xff; -} - -void SfxSampleControlWrite(UINT32, UINT32 d) -{ - UINT8 Old = SfxSampleControl; - - d &= 0xff; - SfxSampleControl = d; - - if ((Old & 0x01) && !(d & 0x01)) { - INT32 nActiveCPU = ZetGetActive(); - - if (nActiveCPU == 2) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nGalCyclesDone[2] += ZetRun(100); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - - } else { - ZetClose(); - ZetOpen(2); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nGalCyclesDone[2] += ZetRun(100); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - ZetOpen(nActiveCPU); - } - } -} - -// Frogger Sound CPU Memory Map -static void filter_w(INT32 num, UINT8 d) -{ - INT32 C; - - C = 0; - if (d & 1) C += 220000; /* 220000pF = 0.220uF */ - if (d & 2) C += 47000; /* 47000pF = 0.047uF */ - filter_rc_set_RC(num, FLT_RC_LOWPASS, 1000, 5100, 0, CAP_P(C)); -} - -UINT8 __fastcall FroggerSoundZ80Read(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall FroggerSoundZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x6000 && a <= 0x6fff) { - INT32 Offset = a & 0xfff; - filter_w(0, (Offset >> 6) & 3); - filter_w(1, (Offset >> 8) & 3); - filter_w(2, (Offset >> 10) & 3); - return; - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall FroggerSoundZ80PortRead(UINT16 a) -{ - a &= 0xff; - - UINT8 Result = 0xff; - if (a & 0x40) Result &= AY8910Read(0); - return Result; -} - -void __fastcall FroggerSoundZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - if (a & 0x40) { - AY8910Write(0, 1, d); - } else { - if (a & 0x80) { - AY8910Write(0, 0, d); - } - } -} - -void FroggerSoundNoEncryptionInit() -{ - ZetOpen(1); - ZetSetReadHandler(FroggerSoundZ80Read); - ZetSetWriteHandler(FroggerSoundZ80Write); - ZetSetInHandler(FroggerSoundZ80PortRead); - ZetSetOutHandler(FroggerSoundZ80PortWrite); - ZetMapArea(0x0000, GalZ80Rom2Size - 1, 0, GalZ80Rom2); - ZetMapArea(0x0000, GalZ80Rom2Size - 1, 2, GalZ80Rom2); - ZetMapArea(0x4000, 0x43ff, 0, GalZ80Ram2); - ZetMapArea(0x4000, 0x43ff, 1, GalZ80Ram2); - ZetMapArea(0x4000, 0x43ff, 2, GalZ80Ram2); - ZetMemEnd(); - ZetClose(); - - nGalCyclesTotal[1] = (14318000 / 8) / 60; -} - -void FroggerSoundInit() -{ - FroggerSoundNoEncryptionInit(); - - for (UINT32 Offset = 0; Offset < 0x0800; Offset++) GalZ80Rom2[Offset] = BITSWAP08(GalZ80Rom2[Offset], 7, 6, 5, 4, 3, 2, 0, 1); -} - -// Konami Sound CPU Memory Map -UINT8 __fastcall KonamiSoundZ80Read(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0xff; -} - -void __fastcall KonamiSoundZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0x9000 && a <= 0x9fff) { - INT32 Offset = a & 0xfff; - filter_w(0, (Offset >> 0) & 3); - filter_w(1, (Offset >> 2) & 3); - filter_w(2, (Offset >> 4) & 3); - filter_w(3, (Offset >> 6) & 3); - filter_w(4, (Offset >> 8) & 3); - filter_w(5, (Offset >> 10) & 3); - return; - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall KonamiSoundZ80PortRead(UINT16 a) -{ - a &= 0xff; - - UINT8 Result = 0xff; - if (a & 0x20) Result &= AY8910Read(0); - if (a & 0x80) Result &= AY8910Read(1); - return Result; -} - -void __fastcall KonamiSoundZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - if (a & 0x10) { - AY8910Write(0, 0, d); - } else { - if (a & 0x20) { - AY8910Write(0, 1, d); - } - } - - if (a & 0x40) { - AY8910Write(1, 0, d); - } else { - if (a & 0x80) { - AY8910Write(1, 1, d); - } - } -} - -void KonamiSoundInit() -{ - ZetOpen(1); - ZetSetReadHandler(KonamiSoundZ80Read); - ZetSetWriteHandler(KonamiSoundZ80Write); - ZetSetInHandler(KonamiSoundZ80PortRead); - ZetSetOutHandler(KonamiSoundZ80PortWrite); - ZetMapArea(0x0000, GalZ80Rom2Size - 1, 0, GalZ80Rom2); - ZetMapArea(0x0000, GalZ80Rom2Size - 1, 2, GalZ80Rom2); - ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram2); - ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram2); - ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram2); - ZetMemEnd(); - ZetClose(); - - nGalCyclesTotal[1] = (14318000 / 8) / 60; -} - -void HunchbksSoundInit() -{ - ZetOpen(0); - ZetSetReadHandler(KonamiSoundZ80Read); - ZetSetWriteHandler(KonamiSoundZ80Write); - ZetSetInHandler(KonamiSoundZ80PortRead); - ZetSetOutHandler(KonamiSoundZ80PortWrite); - ZetMapArea(0x0000, GalZ80Rom1Size - 1, 0, GalZ80Rom1); - ZetMapArea(0x0000, GalZ80Rom1Size - 1, 2, GalZ80Rom1); - ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram1 + 0x400); - ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram1 + 0x400); - ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram1 + 0x400); - ZetMapArea(0x8400, 0x87ff, 0, GalZ80Ram1 + 0x400); - ZetMapArea(0x8400, 0x87ff, 1, GalZ80Ram1 + 0x400); - ZetMapArea(0x8400, 0x87ff, 2, GalZ80Ram1 + 0x400); - ZetMapArea(0x8800, 0x8bff, 0, GalZ80Ram1 + 0x400); - ZetMapArea(0x8800, 0x8bff, 1, GalZ80Ram1 + 0x400); - ZetMapArea(0x8800, 0x8bff, 2, GalZ80Ram1 + 0x400); - ZetMapArea(0x8c00, 0x8fff, 0, GalZ80Ram1 + 0x400); - ZetMapArea(0x8c00, 0x8fff, 1, GalZ80Ram1 + 0x400); - ZetMapArea(0x8c00, 0x8fff, 2, GalZ80Ram1 + 0x400); - ZetMemEnd(); - ZetClose(); - - nGalCyclesTotal[1] = (14318000 / 8) / 60; -} - -// DAC handlers -INT32 KingballSyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / ((nGalCyclesTotal[1] * 60.0000) / (nBurnFPS / 100.0000)))); -} - -INT32 SfxSyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / ((nGalCyclesTotal[2] * 60.0000) / (nBurnFPS / 100.0000)))); -} - -// Galaxian samples -static void GalRenderShootSample(INT16 *pSoundBuf, INT32 nLength) -{ - double Addr = GalShootWavePos; - double Step = (double)GalShootRate / nBurnSoundRate; - - for (INT32 i = 0; i < nLength; i += 2) { - INT16 Sample = (INT16)(GalShootWave[(INT32)Addr] * SHOOT_VOLUME); - Sample >>= 4; - - INT32 nLeftSample = 0, nRightSample = 0; - - if ((GalOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { - nLeftSample += (INT32)(Sample * GalGain); - } - if ((GalOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { - nRightSample += (INT32)(Sample * GalGain); - } - - nLeftSample = BURN_SND_CLIP(nLeftSample); - nRightSample = BURN_SND_CLIP(nRightSample); - - pSoundBuf[i + 0] += nLeftSample; - pSoundBuf[i + 1] += nRightSample; - - Addr += Step; - } - - GalShootWavePos = Addr; - if (GalShootWavePos > GalShootLength) { - GalShootWavePos = 0; - GalShootEnable = 0; - } -} - -static void GalRenderNoiseSample(INT16 *pSoundBuf, INT32 nLength) -{ - double Addr = GalNoiseWavePos; - double Step = (double)NOISE_RATE / nBurnSoundRate; - - for (INT32 i = 0; i < nLength; i += 2) { - INT16 Sample = (INT16)(GalNoiseWave[(INT32)Addr] * (GalNoiseVolume / 100)); - Sample >>= 4; - - INT32 nLeftSample = 0, nRightSample = 0; - - if ((GalOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { - nLeftSample += (INT32)(Sample * GalGain); - } - if ((GalOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { - nRightSample += (INT32)(Sample * GalGain); - } - - nLeftSample = BURN_SND_CLIP(nLeftSample); - nRightSample = BURN_SND_CLIP(nRightSample); - - pSoundBuf[i + 0] += nLeftSample; - pSoundBuf[i + 1] += nRightSample; - - Addr += Step; - } - - GalNoiseWavePos = Addr; - if (GalNoiseWavePos > NOISE_LENGTH) { - GalNoiseWavePos = 0; - } -} - -static void GalRenderToneWave(INT16 *pSoundBuf, INT32 nLength) -{ - INT32 i,j; - INT16 *w = GalToneWave[GalVol]; - - if (GalPitch != 0xff) { - for (i = 0; i < nLength; i += 2) { - INT32 mix = 0; - - for (j = 0; j < STEPS; j++) { - if (GalCountDown >= 256) { - GalCounter = GalCounter + ((double)96000 / nBurnSoundRate); - if (GalCounter > TOOTHSAW_LENGTH) GalCounter = 0; - GalCountDown = GalPitch; - } - GalCountDown++; - - mix += w[(INT32)GalCounter]; - } - - INT16 Sample = mix / STEPS; - Sample >>= 4; - - INT32 nLeftSample = 0, nRightSample = 0; - - if ((GalOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { - nLeftSample += (INT32)(Sample * GalGain); - } - if ((GalOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { - nRightSample += (INT32)(Sample * GalGain); - } - - nLeftSample = BURN_SND_CLIP(nLeftSample); - nRightSample = BURN_SND_CLIP(nRightSample); - - pSoundBuf[i + 0] = nLeftSample; - pSoundBuf[i + 1] = nRightSample; - } - } -} - -static void GalRenderLfoWaveSample(INT32 nLfoWave, INT16 *pSoundBuf, INT32 nLength) -{ - double Addr = GalLfoWavePos[nLfoWave]; - double Step = (double)(sizeof(GalBackgroundWave) * GalLfoFreq * (100 + 2 * 470) / (100 + 2 * 470)) / nBurnSoundRate; - - for (INT32 i = 0; i < nLength; i += 2) { - INT16 Sample = (INT16)(GalBackgroundWave[(INT32)Addr] * (GalLfoVolume[nLfoWave] ? LFO_VOLUME : 0)); - Sample >>= 4; - - INT32 nLeftSample = 0, nRightSample = 0; - - if ((GalOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { - nLeftSample += (INT32)(Sample * GalGain); - } - if ((GalOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { - nRightSample += (INT32)(Sample * GalGain); - } - - nLeftSample = BURN_SND_CLIP(nLeftSample); - nRightSample = BURN_SND_CLIP(nRightSample); - - pSoundBuf[i + 0] += nLeftSample; - pSoundBuf[i + 1] += nRightSample; - - Addr += Step; - } - - GalLfoWavePos[nLfoWave] = Addr; - if (GalLfoWavePos[nLfoWave] > 32) { - GalLfoWavePos[nLfoWave] = 0; - } -} - -void GalRenderSoundSamples(INT16 *pSoundBuf, INT32 nLength) -{ - memset(pSoundBuf, 0, nLength * 2 * sizeof(INT16)); - - GalRenderToneWave(pSoundBuf, nLength); - GalRenderNoiseSample(pSoundBuf, nLength); - if (GalShootEnable) GalRenderShootSample(pSoundBuf, nLength); - GalRenderLfoWaveSample(0, pSoundBuf, nLength); - GalRenderLfoWaveSample(1, pSoundBuf, nLength); - GalRenderLfoWaveSample(2, pSoundBuf, nLength); -} - -void GalaxianSoundWrite(UINT32 Offset, UINT8 d) -{ - d &= 0x01; - - switch (Offset & 0x07) { - case 0x00: - case 0x01: - case 0x02: { - GalLfoVolume[Offset] = d; - return; - } - - case 0x03: { - GalNoiseEnable = d & 1; - if (GalNoiseEnable) { - GalNoiseVolume = 100; - GalNoiseWavePos = 0; - } - return; - } - - case 0x04: { - return; - } - - case 0x05: { - if (d & 1 && !(GalLastPort2 & 1) ) { - GalShootEnable = 1; - GalShootWavePos = 0; - } - GalLastPort2 = d; - return; - } - - case 0x06: - case 0x07: { - GalVol = (GalVol & ~(1 << (Offset & 0x01))) | ((d & 1) << (Offset & 0x01)); - return; - } - } -} - -void GalaxianLfoFreqWrite(UINT32 Offset, UINT8 d) -{ - double r0, r1, rx = 100000.0; - - if ((d & 0x01) == GalLfoBit[Offset]) return; - - GalLfoBit[Offset] = d & 0x01; - - r0 = 1.0 / 330000; - r1 = 1.0 / 1e12; - - if (GalLfoBit[0]) { - r1 += 1.0 / 1000000; - } else { - r0 += 1.0 / 1000000; - } - - if (GalLfoBit[1]) { - r1 += 1.0 / 470000; - } else { - r0 += 1.0 / 470000; - } - - if (GalLfoBit[2]) { - r1 += 1.0 / 220000; - } else { - r0 += 1.0 / 220000; - } - - if (GalLfoBit[3]) { - r1 += 1.0 / 100000; - } else { - r0 += 1.0 / 100000; - } - - r0 = 1.0 / r0; - r1 = 1.0 / r1; - - rx = rx + 2000000.0 * r0 / (r0 + r1); - - GalLfoFreqFrameVar = (1000000000 / ((MAXFREQ - MINFREQ) * 639 * rx)) * 100; - - bprintf(PRINT_NORMAL, _T("Offset %x, rx %f, %f\n"), Offset, (MAXFREQ - MINFREQ) * 639 * rx, GalLfoFreqFrameVar); -} - -void GalaxianSoundUpdateTimers() -{ - if (GetCurrentFrame() % 3) { - if (!GalNoiseEnable && GalNoiseVolume > 0) { - GalNoiseVolume -= (GalNoiseVolume / 10) + 1; - } - } - - if (GalLfoFreq > MINFREQ) { - GalLfoFreq -= GalLfoFreqFrameVar; - } else { - GalLfoFreq = MAXFREQ; - } -} +#include "gal.h" + +INT16* pFMBuffer; +INT16* pAY8910Buffer[9]; + +UINT8 GalSoundType; +UINT8 HunchbksSoundIrqFire; + +#define XTAL 18432000 +#define RNG_RATE (XTAL / 3) +#define NOISE_RATE (XTAL / 3 / 192 / 2 / 2) +#define NOISE_LENGTH (NOISE_RATE * 4) +#define NOISE_AMPLITUDE (70 * 256) +#define SHOOT_VOLUME 0.50f +#define SHOOT_SEC 2 +#define R41__ 100000 +#define R44__ 10000 +#define R45__ 22000 +#define R46__ 10000 +#define R47__ 2200 +#define R48__ 2200 +#define C25__ 0.000001 +#define C27__ 0.00000001 +#define C28__ 0.000047 +#define C29__ 0.00000001 +#define IC8L3_L 0.2 +#define IC8L3_H 4.5 +#define NOISE_L 0.2 +#define NOISE_H 4.5 +#define SHOOT_KEYON_TIME 0.1 +#define NE555_FM_ADJUST_RATE 0.80 +#define TOOTHSAW_LENGTH 16 +#define TOOTHSAW_VOLUME 0.36f +#define TOOTHSAW_AMPLITUDE (64*256) +#define V(r0,r1) 2 * TOOTHSAW_AMPLITUDE * (r0) / (r0 + r1) - TOOTHSAW_AMPLITUDE +#define STEPS 16 +#define LFO_VOLUME 0.06f +#define MINFREQ (139 - 139 / 3) +#define MAXFREQ (139 + 139 / 3) + +static INT16 *GalNoiseWave; +static INT16 *GalShootWave; +static UINT32 GalShootLength; +static UINT32 GalShootRate; +UINT8 GalLastPort2 = 0; +UINT8 GalShootEnable; +UINT8 GalNoiseEnable; +INT32 GalNoiseVolume; +double GalShootWavePos; +double GalNoiseWavePos; +double GalLfoWavePos[3]; +INT32 GalPitch; +INT32 GalVol; +static double GalCounter; +static INT32 GalCountDown; +INT32 GalLfoVolume[3]; +double GalLfoFreq; +double GalLfoFreqFrameVar; +INT32 GalLfoBit[4]; +static double GalGain; +static INT32 GalOutputDir; + +static INT16 GalToneWave[4][TOOTHSAW_LENGTH]; + +static const INT16 GalBackgroundWave[32] = +{ + 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, + 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, + -0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000, + -0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000,-0x4000, +}; + +void GalaxianSoundSetRoute(double nVolume, INT32 nRouteDir) +{ + GalGain = nVolume; + GalOutputDir = nRouteDir; +} + +void GalSoundReset() +{ + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910) { + AY8910Reset(0); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { + AY8910Reset(0); + AY8910Reset(1); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910) { + AY8910Reset(0); + AY8910Reset(1); + AY8910Reset(2); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { + DACReset(); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { + GalLastPort2 = 0; + GalShootEnable = 0; + GalNoiseEnable = 0; + GalNoiseVolume = 0; + GalShootWavePos = 0; + GalNoiseWavePos = 0; + GalLfoWavePos[0] = GalLfoWavePos[1] = GalLfoWavePos[2] = 0; + GalPitch = 0xff; + GalVol = 0; + GalCounter = 0; + GalCountDown = 0; + GalLfoVolume[0] = GalLfoVolume[1] = GalLfoVolume[2] = 0; + GalLfoFreq = MAXFREQ; + GalLfoFreqFrameVar = 0; + GalLfoBit[0] = GalLfoBit[1] = GalLfoBit[2] = GalLfoBit[3] = 0; + } +} + +void GalSoundInit() +{ + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910) { + pFMBuffer = (INT16*)BurnMalloc(nBurnSoundLen * 3 * sizeof(INT16)); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { + pFMBuffer = (INT16*)BurnMalloc(nBurnSoundLen * 6 * sizeof(INT16)); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910) { + pFMBuffer = (INT16*)BurnMalloc(nBurnSoundLen * 9 * sizeof(INT16)); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910) { + pAY8910Buffer[6] = pFMBuffer + nBurnSoundLen * 6; + pAY8910Buffer[7] = pFMBuffer + nBurnSoundLen * 7; + pAY8910Buffer[8] = pFMBuffer + nBurnSoundLen * 8; + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910) { + AY8910Init(0, 1789750, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910) { + AY8910Init(0, 1789750, nBurnSoundRate, &BongoDipSwitchRead, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910) { + AY8910Init(0, 1620000, nBurnSoundRate, &CheckmajPortARead, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910) { + // Port A Write - cclimber_sample_select_w + AY8910Init(0, 18432000 / 3 / 4, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910) { + AY8910Init(0, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, &FroggerSoundTimerRead, NULL, NULL); + + filter_rc_init(0, FLT_RC_LOWPASS, 1, 1, 1, 0, 0); + filter_rc_init(1, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); + filter_rc_init(2, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); + + filter_rc_set_src_gain(0, 0.75); + filter_rc_set_src_gain(1, 0.75); + filter_rc_set_src_gain(2, 0.75); + + filter_rc_set_route(0, 1.00, BURN_SND_ROUTE_BOTH); + filter_rc_set_route(1, 1.00, BURN_SND_ROUTE_BOTH); + filter_rc_set_route(2, 1.00, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910) { + AY8910Init(0, 14318000 / 8, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, &KonamiSoundTimerRead, NULL, NULL); + + filter_rc_init(0, FLT_RC_LOWPASS, 1, 1, 1, 0, 0); + filter_rc_init(1, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); + filter_rc_init(2, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); + filter_rc_init(3, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); + filter_rc_init(4, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); + filter_rc_init(5, FLT_RC_LOWPASS, 1, 1, 1, 0, 1); + + filter_rc_set_src_gain(0, 0.50); + filter_rc_set_src_gain(1, 0.50); + filter_rc_set_src_gain(2, 0.50); + filter_rc_set_src_gain(3, 0.50); + filter_rc_set_src_gain(4, 0.50); + filter_rc_set_src_gain(5, 0.50); + + filter_rc_set_route(0, 1.00, BURN_SND_ROUTE_BOTH); + filter_rc_set_route(1, 1.00, BURN_SND_ROUTE_BOTH); + filter_rc_set_route(2, 1.00, BURN_SND_ROUTE_BOTH); + filter_rc_set_route(3, 1.00, BURN_SND_ROUTE_BOTH); + filter_rc_set_route(4, 1.00, BURN_SND_ROUTE_BOTH); + filter_rc_set_route(5, 1.00, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910) { + AY8910Init(0, 14318000 / 8, nBurnSoundRate, &KonamiSoundTimerRead, NULL, NULL, NULL); + AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910) { + AY8910Init(0, 14318000 / 8, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, &KonamiSoundTimerRead, NULL, NULL); + AY8910Init(2, 14318000 / 8, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(2, 0.25, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910) { + AY8910Init(0, 14318000 / 8, nBurnSoundRate, &KonamiSoundTimerRead, NULL, NULL, NULL); + AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.50, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { + AY8910Init(0, 1789750, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 1789750, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { + AY8910Init(0, 14318000 / 8, nBurnSoundRate, NULL, NULL, &SfxSoundLatch2Write, &SfxSampleControlWrite); + AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, &KonamiSoundTimerRead, NULL, NULL); + AY8910SetAllRoutes(0, 0.10, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.10, BURN_SND_ROUTE_BOTH); + + DACInit(0, 0, 1, SfxSyncDAC); + DACSetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { + DACInit(0, 0, 1, KingballSyncDAC); + DACSetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_HEXPOOLASN76496) { + SN76496Init(0, 18432000 / 3 / 2, 0); + SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496) { + SN76496Init(0, 18432000 / 3 / 2, 0); + SN76496Init(1, 18432000 / 3 / 2, 1); + SN76496Init(2, 18432000 / 3 / 2, 1); + SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(2, 1.00, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) { + AY8910Init(0, 14318000 / 8, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 14318000 / 8, nBurnSoundRate, &KonamiSoundLatchRead, &HunchbksSoundTimerRead, NULL, NULL); + + AY8910SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.20, BURN_SND_ROUTE_BOTH); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { + GalShootEnable = 0; + GalShootWavePos = 0; + INT32 CountDown, Generator, Bit1, Bit2; + + GalNoiseWave = (INT16*)BurnMalloc(NOISE_LENGTH * sizeof(INT16)); + + GalShootRate = 22050; + GalShootLength = SHOOT_SEC * GalShootRate; + GalShootWave = (INT16*)BurnMalloc(GalShootLength * sizeof(INT16)); + + Generator = 0; + CountDown = NOISE_RATE / 2; + for (INT32 i = 0; i < NOISE_LENGTH; i++) { + CountDown -= RNG_RATE; + while (CountDown < 0) { + Generator <<= 1; + Bit1 = (~Generator >> 17) & 1; + Bit2 = (Generator >> 5) & 1; + if (Bit1 ^ Bit2) Generator |= 1; + CountDown += NOISE_RATE; + } + GalNoiseWave[i] = ((Generator >> 17) & 1) ? NOISE_AMPLITUDE : -NOISE_AMPLITUDE; + } + + double v = 5.0; + double vK = (GalShootRate) ? exp(-1 / (R41__ * C25__) / GalShootRate) : 0; + double IC8L3 = IC8L3_L; + INT32 IC8Lcnt = (INT32)(SHOOT_KEYON_TIME * GalShootRate); + double c28v = IC8L3_H - (IC8L3_H - (NOISE_H + NOISE_L) / 2) / (R46__ + R47__ + R48__) * R47__; + double c28K = (GalShootRate) ? exp(-1 / (22000 * 0.000047 ) / GalShootRate) : 0; + double c29v = IC8L3_H - (IC8L3_H - (NOISE_H + NOISE_L) / 2) / (R46__ + R47__ + R48__) * (R47__ + R48__); + double c29K1 = (GalShootRate) ? exp(-1 / (22000 * 0.00000001 ) / GalShootRate) : 0; + double c29K2 = (GalShootRate) ? exp(-1 / (100000 * 0.00000001 ) / GalShootRate) : 0; + double ne555cnt = 0; + double ne555step = (GalShootRate) ? ((1.44 / ((R44__ + R45__ * 2) * C27__)) / GalShootRate) : 0; + double ne555duty = (double)(R44__ + R45__) / (R44__ + R45__ * 2); + double ne555sr; + double ncnt = 0.0; + double nstep = (GalShootRate) ? ((double)NOISE_RATE / GalShootRate) : 0; + double noise_sh2; + + for (UINT32 i = 0; i < GalShootLength; i++) { + noise_sh2 = GalNoiseWave[(INT32)ncnt % NOISE_LENGTH] == NOISE_AMPLITUDE ? NOISE_H : NOISE_L; + ncnt += nstep; + ne555sr = c29v * NE555_FM_ADJUST_RATE / (5.0 * 2 / 3); + ne555cnt += ne555step; + if (ne555cnt >= ne555sr) ne555cnt -= ne555sr; + if (ne555cnt < ne555sr * ne555duty) { + GalShootWave[i] = (INT16)(v / 5 * 0x7fff); + if(IC8L3 == IC8L3_H) v *= vK; + } else { + GalShootWave[i] = 0; + } + c28v += (IC8L3 - c28v) - (IC8L3 - c28v) * c28K; + c28v += (c29v - c28v) - (c29v - c28v) * c28K; + c29v += (c28v - c29v) - (c28v - c29v) * c29K1; + c29v += (noise_sh2 - c29v) - (noise_sh2 - c29v) * c29K2; + if(IC8L3 == IC8L3_L && --IC8Lcnt == 0) IC8L3 = IC8L3_H; + } + + memset(GalToneWave, 0, sizeof(GalToneWave)); + + for (UINT32 i = 0; i < TOOTHSAW_LENGTH; i++ ) { + double r0a = 1.0 / 1e12, r1a = 1.0 / 1e12; + double r0b = 1.0 / 1e12, r1b = 1.0 / 1e12; + + if (i & 1) { + r1a += 1.0 / 33000; + r1b += 1.0 / 33000; + } else { + r0a += 1.0 / 33000; + r0b += 1.0 / 33000; + } + if (i & 4) { + r1a += 1.0 / 22000; + r1b += 1.0 / 22000; + } else { + r0a += 1.0 / 22000; + r0b += 1.0 / 22000; + } + GalToneWave[0][i] = (INT16)(V(1.0 / r0a, 1.0 / r1a)); + + if (i & 4) { + r1a += 1.0 / 10000; + } else { + r0a += 1.0 / 10000; + } + GalToneWave[1][i] = (INT16)(V(1.0 / r0a, 1.0 / r1a)); + + if (i & 8) { + r1b += 1.0 / 15000; + } else { + r0b += 1.0 / 15000; + } + GalToneWave[2][i] = (INT16)(V(1.0 / r0b, 1.0 / r1b)); + + if (i & 4) { + r0b += 1.0 / 10000; + } else { + r1b += 1.0 / 10000; + } + GalToneWave[3][i] = (INT16)(V(1.0 / r0b, 1.0 / r1b)); + } + + GalPitch = 0xff; + GalVol = 0; + + GalLfoFreq = MAXFREQ; + GalLfoFreqFrameVar = 0; + + GalGain = 1.00; + GalOutputDir = BURN_SND_ROUTE_BOTH; + } +} + +void GalSoundExit() +{ + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_MSHUTTLEAY8910) { + AY8910Exit(0); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { + AY8910Exit(0); + AY8910Exit(1); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910) { + AY8910Exit(0); + AY8910Exit(1); + AY8910Exit(2); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { + DACExit(); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HEXPOOLASN76496) { + SN76496Exit(); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910) { + filter_rc_exit(); + } + + BurnFree(pFMBuffer); + for (INT32 i = 0; i < 9; i++) pAY8910Buffer[i] = NULL; + + BurnFree(GalNoiseWave); + BurnFree(GalShootWave); + + HunchbksSoundIrqFire = 0; + GalShootLength = 0; + GalShootRate = 0; + GalLastPort2 = 0; + GalShootEnable = 0; + GalNoiseEnable = 0; + GalNoiseVolume = 0; + GalShootWavePos = 0; + GalNoiseWavePos = 0; + GalLfoWavePos[0] = GalLfoWavePos[1] = GalLfoWavePos[2] = 0; + GalPitch = 0; + GalVol = 0; + GalCounter = 0; + GalCountDown = 0; + GalLfoVolume[0] = GalLfoVolume[1] = GalLfoVolume[2] = 0; + GalLfoFreq = 0; + GalLfoFreqFrameVar = 0; + GalLfoBit[0] = GalLfoBit[1] = GalLfoBit[2] = GalLfoBit[3] = 0; + memset(GalToneWave, 0, sizeof(GalToneWave)); +} + +void GalSoundScan(INT32 nAction, INT32 *pnMin) +{ + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_GALAXIAN || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC) { + SCAN_VAR(GalLastPort2); + SCAN_VAR(GalShootEnable); + SCAN_VAR(GalNoiseEnable); + SCAN_VAR(GalNoiseVolume); + SCAN_VAR(GalShootWavePos); + SCAN_VAR(GalNoiseWavePos); + SCAN_VAR(GalLfoWavePos); + SCAN_VAR(GalPitch); + SCAN_VAR(GalVol); + SCAN_VAR(GalCounter); + SCAN_VAR(GalCountDown); + SCAN_VAR(GalLfoVolume); + SCAN_VAR(GalLfoFreq); + SCAN_VAR(GalLfoFreqFrameVar); + SCAN_VAR(GalLfoBit); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_ZIGZAGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_JUMPBUGAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMANAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_CHECKMAJAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FROGGERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_BONGOAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_KONAMIAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_EXPLORERAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_AD2083AY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SCORPIONAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910 || GalSoundType == GAL_SOUND_HARDWARE_TYPE_FANTASTCAY8910) { + AY8910Scan(nAction, pnMin); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_KINGBALLDAC || GalSoundType == GAL_SOUND_HARDWARE_TYPE_SFXAY8910DAC) { + DACScan(nAction, pnMin); + } + + if (GalSoundType == GAL_SOUND_HARDWARE_TYPE_RACKNROLSN76496) { + SN76496Scan(nAction, pnMin); + } +} + +// AY8910 Port Handlers +UINT8 CheckmajPortARead(UINT32) +{ + return GalSoundLatch; +} + +UINT8 BongoDipSwitchRead(UINT32) +{ + return GalInput[3] | GalDip[3]; +} + +UINT8 KonamiSoundLatchRead(UINT32) +{ + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return GalSoundLatch; +} + +UINT8 KonamiSoundTimerRead(UINT32) +{ + INT32 nActiveCPU = ZetGetActive(); + UINT32 Cycles; + + if (nActiveCPU == 1) { + Cycles = (ZetTotalCycles() * 8) % (UINT64)(16 * 16 * 2 * 8 * 5 * 2); + } else { + ZetClose(); + ZetOpen(1); + Cycles = (ZetTotalCycles() * 8) % (UINT64)(16 * 16 * 2 * 8 * 5 * 2); + ZetClose(); + ZetOpen(nActiveCPU); + } + + UINT8 HiBit = 0; + + if (Cycles >= 16 * 16 * 2 * 8 * 5) { + HiBit = 1; + Cycles -= 16 * 16 * 2 * 8 * 5; + } + + return (HiBit << 7) | (BIT(Cycles, 14) << 6) | (BIT(Cycles, 13) << 5) | (BIT(Cycles, 11) << 4) | 0x0e; +} + +UINT8 FroggerSoundTimerRead(UINT32) +{ + UINT8 KonamiValue = KonamiSoundTimerRead(0); + return BITSWAP08(KonamiValue, 7, 6, 3, 4, 5, 2, 1, 0); +} + +UINT8 HunchbksSoundTimerRead(UINT32) +{ + INT32 nActiveCPU = ZetGetActive(); + UINT32 Cycles; + + if (nActiveCPU == 0) { + Cycles = (ZetTotalCycles() * 8) % (UINT64)(16 * 16 * 2 * 8 * 5 * 2); + } else { + ZetOpen(0); + Cycles = (ZetTotalCycles() * 8) % (UINT64)(16 * 16 * 2 * 8 * 5 * 2); + ZetClose(); + } + + UINT8 HiBit = 0; + + if (Cycles >= 16 * 16 * 2 * 8 * 5) { + HiBit = 1; + Cycles -= 16 * 16 * 2 * 8 * 5; + } + + return (HiBit << 7) | (BIT(Cycles, 14) << 6) | (BIT(Cycles, 13) << 5) | (BIT(Cycles, 11) << 4) | 0x0e; +} + +void KonamiSoundLatchWrite(UINT8 d) +{ + GalSoundLatch = d; +} + +void KonamiSoundControlWrite(UINT8 d) +{ + UINT8 Old = KonamiSoundControl; + KonamiSoundControl = d; + + if ((Old & 0x08) && !(d & 0x08)) { + INT32 nActiveCPU = ZetGetActive(); + + if (nActiveCPU == 1) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } else { + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(nActiveCPU); + } + } + + /* bit 4 is sound disable */ +// sound_global_enable(~data & 0x10); +} + +void HunchbksSoundControlWrite(UINT8 d) +{ + UINT8 Old = KonamiSoundControl; + KonamiSoundControl = d; + + HunchbksSoundIrqFire = 0; + + if ((Old & 0x08) && !(d & 0x08)) { + HunchbksSoundIrqFire = 1; + } + + /* bit 4 is sound disable */ +// sound_global_enable(~data & 0x10); +} + +void SfxSoundLatch2Write(UINT32, UINT32 d) +{ + GalSoundLatch2 = d & 0xff; +} + +void SfxSampleControlWrite(UINT32, UINT32 d) +{ + UINT8 Old = SfxSampleControl; + + d &= 0xff; + SfxSampleControl = d; + + if ((Old & 0x01) && !(d & 0x01)) { + INT32 nActiveCPU = ZetGetActive(); + + if (nActiveCPU == 2) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nGalCyclesDone[2] += ZetRun(100); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + + } else { + ZetClose(); + ZetOpen(2); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nGalCyclesDone[2] += ZetRun(100); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + ZetOpen(nActiveCPU); + } + } +} + +// Frogger Sound CPU Memory Map +static void filter_w(INT32 num, UINT8 d) +{ + INT32 C; + + C = 0; + if (d & 1) C += 220000; /* 220000pF = 0.220uF */ + if (d & 2) C += 47000; /* 47000pF = 0.047uF */ + filter_rc_set_RC(num, FLT_RC_LOWPASS, 1000, 5100, 0, CAP_P(C)); +} + +UINT8 __fastcall FroggerSoundZ80Read(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall FroggerSoundZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x6000 && a <= 0x6fff) { + INT32 Offset = a & 0xfff; + filter_w(0, (Offset >> 6) & 3); + filter_w(1, (Offset >> 8) & 3); + filter_w(2, (Offset >> 10) & 3); + return; + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall FroggerSoundZ80PortRead(UINT16 a) +{ + a &= 0xff; + + UINT8 Result = 0xff; + if (a & 0x40) Result &= AY8910Read(0); + return Result; +} + +void __fastcall FroggerSoundZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + if (a & 0x40) { + AY8910Write(0, 1, d); + } else { + if (a & 0x80) { + AY8910Write(0, 0, d); + } + } +} + +void FroggerSoundNoEncryptionInit() +{ + ZetOpen(1); + ZetSetReadHandler(FroggerSoundZ80Read); + ZetSetWriteHandler(FroggerSoundZ80Write); + ZetSetInHandler(FroggerSoundZ80PortRead); + ZetSetOutHandler(FroggerSoundZ80PortWrite); + ZetMapArea(0x0000, GalZ80Rom2Size - 1, 0, GalZ80Rom2); + ZetMapArea(0x0000, GalZ80Rom2Size - 1, 2, GalZ80Rom2); + ZetMapArea(0x4000, 0x43ff, 0, GalZ80Ram2); + ZetMapArea(0x4000, 0x43ff, 1, GalZ80Ram2); + ZetMapArea(0x4000, 0x43ff, 2, GalZ80Ram2); + ZetClose(); + + nGalCyclesTotal[1] = (14318000 / 8) / 60; +} + +void FroggerSoundInit() +{ + FroggerSoundNoEncryptionInit(); + + for (UINT32 Offset = 0; Offset < 0x0800; Offset++) GalZ80Rom2[Offset] = BITSWAP08(GalZ80Rom2[Offset], 7, 6, 5, 4, 3, 2, 0, 1); +} + +// Konami Sound CPU Memory Map +UINT8 __fastcall KonamiSoundZ80Read(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0xff; +} + +void __fastcall KonamiSoundZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0x9000 && a <= 0x9fff) { + INT32 Offset = a & 0xfff; + filter_w(0, (Offset >> 0) & 3); + filter_w(1, (Offset >> 2) & 3); + filter_w(2, (Offset >> 4) & 3); + filter_w(3, (Offset >> 6) & 3); + filter_w(4, (Offset >> 8) & 3); + filter_w(5, (Offset >> 10) & 3); + return; + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall KonamiSoundZ80PortRead(UINT16 a) +{ + a &= 0xff; + + UINT8 Result = 0xff; + if (a & 0x20) Result &= AY8910Read(0); + if (a & 0x80) Result &= AY8910Read(1); + return Result; +} + +void __fastcall KonamiSoundZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + if (a & 0x10) { + AY8910Write(0, 0, d); + } else { + if (a & 0x20) { + AY8910Write(0, 1, d); + } + } + + if (a & 0x40) { + AY8910Write(1, 0, d); + } else { + if (a & 0x80) { + AY8910Write(1, 1, d); + } + } +} + +void KonamiSoundInit() +{ + ZetOpen(1); + ZetSetReadHandler(KonamiSoundZ80Read); + ZetSetWriteHandler(KonamiSoundZ80Write); + ZetSetInHandler(KonamiSoundZ80PortRead); + ZetSetOutHandler(KonamiSoundZ80PortWrite); + ZetMapArea(0x0000, GalZ80Rom2Size - 1, 0, GalZ80Rom2); + ZetMapArea(0x0000, GalZ80Rom2Size - 1, 2, GalZ80Rom2); + ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram2); + ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram2); + ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram2); + ZetClose(); + + nGalCyclesTotal[1] = (14318000 / 8) / 60; +} + +void HunchbksSoundInit() +{ + ZetOpen(0); + ZetSetReadHandler(KonamiSoundZ80Read); + ZetSetWriteHandler(KonamiSoundZ80Write); + ZetSetInHandler(KonamiSoundZ80PortRead); + ZetSetOutHandler(KonamiSoundZ80PortWrite); + ZetMapArea(0x0000, GalZ80Rom1Size - 1, 0, GalZ80Rom1); + ZetMapArea(0x0000, GalZ80Rom1Size - 1, 2, GalZ80Rom1); + ZetMapArea(0x8000, 0x83ff, 0, GalZ80Ram1 + 0x400); + ZetMapArea(0x8000, 0x83ff, 1, GalZ80Ram1 + 0x400); + ZetMapArea(0x8000, 0x83ff, 2, GalZ80Ram1 + 0x400); + ZetMapArea(0x8400, 0x87ff, 0, GalZ80Ram1 + 0x400); + ZetMapArea(0x8400, 0x87ff, 1, GalZ80Ram1 + 0x400); + ZetMapArea(0x8400, 0x87ff, 2, GalZ80Ram1 + 0x400); + ZetMapArea(0x8800, 0x8bff, 0, GalZ80Ram1 + 0x400); + ZetMapArea(0x8800, 0x8bff, 1, GalZ80Ram1 + 0x400); + ZetMapArea(0x8800, 0x8bff, 2, GalZ80Ram1 + 0x400); + ZetMapArea(0x8c00, 0x8fff, 0, GalZ80Ram1 + 0x400); + ZetMapArea(0x8c00, 0x8fff, 1, GalZ80Ram1 + 0x400); + ZetMapArea(0x8c00, 0x8fff, 2, GalZ80Ram1 + 0x400); + ZetClose(); + + nGalCyclesTotal[1] = (14318000 / 8) / 60; +} + +// DAC handlers +INT32 KingballSyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / ((nGalCyclesTotal[1] * 60.0000) / (nBurnFPS / 100.0000)))); +} + +INT32 SfxSyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / ((nGalCyclesTotal[2] * 60.0000) / (nBurnFPS / 100.0000)))); +} + +// Galaxian samples +static void GalRenderShootSample(INT16 *pSoundBuf, INT32 nLength) +{ + double Addr = GalShootWavePos; + double Step = (double)GalShootRate / nBurnSoundRate; + + for (INT32 i = 0; i < nLength; i += 2) { + INT16 Sample = (INT16)(GalShootWave[(INT32)Addr] * SHOOT_VOLUME); + Sample >>= 4; + + INT32 nLeftSample = 0, nRightSample = 0; + + if ((GalOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { + nLeftSample += (INT32)(Sample * GalGain); + } + if ((GalOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { + nRightSample += (INT32)(Sample * GalGain); + } + + nLeftSample = BURN_SND_CLIP(nLeftSample); + nRightSample = BURN_SND_CLIP(nRightSample); + + pSoundBuf[i + 0] += nLeftSample; + pSoundBuf[i + 1] += nRightSample; + + Addr += Step; + } + + GalShootWavePos = Addr; + if (GalShootWavePos > GalShootLength) { + GalShootWavePos = 0; + GalShootEnable = 0; + } +} + +static void GalRenderNoiseSample(INT16 *pSoundBuf, INT32 nLength) +{ + double Addr = GalNoiseWavePos; + double Step = (double)NOISE_RATE / nBurnSoundRate; + + for (INT32 i = 0; i < nLength; i += 2) { + INT16 Sample = (INT16)(GalNoiseWave[(INT32)Addr] * (GalNoiseVolume / 100)); + Sample >>= 4; + + INT32 nLeftSample = 0, nRightSample = 0; + + if ((GalOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { + nLeftSample += (INT32)(Sample * GalGain); + } + if ((GalOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { + nRightSample += (INT32)(Sample * GalGain); + } + + nLeftSample = BURN_SND_CLIP(nLeftSample); + nRightSample = BURN_SND_CLIP(nRightSample); + + pSoundBuf[i + 0] += nLeftSample; + pSoundBuf[i + 1] += nRightSample; + + Addr += Step; + } + + GalNoiseWavePos = Addr; + if (GalNoiseWavePos > NOISE_LENGTH) { + GalNoiseWavePos = 0; + } +} + +static void GalRenderToneWave(INT16 *pSoundBuf, INT32 nLength) +{ + INT32 i,j; + INT16 *w = GalToneWave[GalVol]; + + if (GalPitch != 0xff) { + for (i = 0; i < nLength; i += 2) { + INT32 mix = 0; + + for (j = 0; j < STEPS; j++) { + if (GalCountDown >= 256) { + GalCounter = GalCounter + ((double)96000 / nBurnSoundRate); + if (GalCounter > TOOTHSAW_LENGTH) GalCounter = 0; + GalCountDown = GalPitch; + } + GalCountDown++; + + mix += w[(INT32)GalCounter]; + } + + INT16 Sample = mix / STEPS; + Sample >>= 4; + + INT32 nLeftSample = 0, nRightSample = 0; + + if ((GalOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { + nLeftSample += (INT32)(Sample * GalGain); + } + if ((GalOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { + nRightSample += (INT32)(Sample * GalGain); + } + + nLeftSample = BURN_SND_CLIP(nLeftSample); + nRightSample = BURN_SND_CLIP(nRightSample); + + pSoundBuf[i + 0] = nLeftSample; + pSoundBuf[i + 1] = nRightSample; + } + } +} + +static void GalRenderLfoWaveSample(INT32 nLfoWave, INT16 *pSoundBuf, INT32 nLength) +{ + double Addr = GalLfoWavePos[nLfoWave]; + double Step = (double)(sizeof(GalBackgroundWave) * GalLfoFreq * (100 + 2 * 470) / (100 + 2 * 470)) / nBurnSoundRate; + + for (INT32 i = 0; i < nLength; i += 2) { + INT16 Sample = (INT16)(GalBackgroundWave[(INT32)Addr] * (GalLfoVolume[nLfoWave] ? LFO_VOLUME : 0)); + Sample >>= 4; + + INT32 nLeftSample = 0, nRightSample = 0; + + if ((GalOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { + nLeftSample += (INT32)(Sample * GalGain); + } + if ((GalOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { + nRightSample += (INT32)(Sample * GalGain); + } + + nLeftSample = BURN_SND_CLIP(nLeftSample); + nRightSample = BURN_SND_CLIP(nRightSample); + + pSoundBuf[i + 0] += nLeftSample; + pSoundBuf[i + 1] += nRightSample; + + Addr += Step; + } + + GalLfoWavePos[nLfoWave] = Addr; + if (GalLfoWavePos[nLfoWave] > 32) { + GalLfoWavePos[nLfoWave] = 0; + } +} + +void GalRenderSoundSamples(INT16 *pSoundBuf, INT32 nLength) +{ + memset(pSoundBuf, 0, nLength * 2 * sizeof(INT16)); + + GalRenderToneWave(pSoundBuf, nLength); + GalRenderNoiseSample(pSoundBuf, nLength); + if (GalShootEnable) GalRenderShootSample(pSoundBuf, nLength); + GalRenderLfoWaveSample(0, pSoundBuf, nLength); + GalRenderLfoWaveSample(1, pSoundBuf, nLength); + GalRenderLfoWaveSample(2, pSoundBuf, nLength); +} + +void GalaxianSoundWrite(UINT32 Offset, UINT8 d) +{ + d &= 0x01; + + switch (Offset & 0x07) { + case 0x00: + case 0x01: + case 0x02: { + GalLfoVolume[Offset] = d; + return; + } + + case 0x03: { + GalNoiseEnable = d & 1; + if (GalNoiseEnable) { + GalNoiseVolume = 100; + GalNoiseWavePos = 0; + } + return; + } + + case 0x04: { + return; + } + + case 0x05: { + if (d & 1 && !(GalLastPort2 & 1) ) { + GalShootEnable = 1; + GalShootWavePos = 0; + } + GalLastPort2 = d; + return; + } + + case 0x06: + case 0x07: { + GalVol = (GalVol & ~(1 << (Offset & 0x01))) | ((d & 1) << (Offset & 0x01)); + return; + } + } +} + +void GalaxianLfoFreqWrite(UINT32 Offset, UINT8 d) +{ + double r0, r1, rx = 100000.0; + + if ((d & 0x01) == GalLfoBit[Offset]) return; + + GalLfoBit[Offset] = d & 0x01; + + r0 = 1.0 / 330000; + r1 = 1.0 / 1e12; + + if (GalLfoBit[0]) { + r1 += 1.0 / 1000000; + } else { + r0 += 1.0 / 1000000; + } + + if (GalLfoBit[1]) { + r1 += 1.0 / 470000; + } else { + r0 += 1.0 / 470000; + } + + if (GalLfoBit[2]) { + r1 += 1.0 / 220000; + } else { + r0 += 1.0 / 220000; + } + + if (GalLfoBit[3]) { + r1 += 1.0 / 100000; + } else { + r0 += 1.0 / 100000; + } + + r0 = 1.0 / r0; + r1 = 1.0 / r1; + + rx = rx + 2000000.0 * r0 / (r0 + r1); + + GalLfoFreqFrameVar = (1000000000 / ((MAXFREQ - MINFREQ) * 639 * rx)) * 100; + + bprintf(PRINT_NORMAL, _T("Offset %x, rx %f, %f\n"), Offset, (MAXFREQ - MINFREQ) * 639 * rx, GalLfoFreqFrameVar); +} + +void GalaxianSoundUpdateTimers() +{ + if (GetCurrentFrame() % 3) { + if (!GalNoiseEnable && GalNoiseVolume > 0) { + GalNoiseVolume -= (GalNoiseVolume / 10) + 1; + } + } + + if (GalLfoFreq > MINFREQ) { + GalLfoFreq -= GalLfoFreqFrameVar; + } else { + GalLfoFreq = MAXFREQ; + } +} diff --git a/src/burn/drv/irem/d_m62.cpp b/src/burn/drv/irem/d_m62.cpp index 49350b148..81ccedb33 100644 --- a/src/burn/drv/irem/d_m62.cpp +++ b/src/burn/drv/irem/d_m62.cpp @@ -1,5038 +1,5026 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "m6800_intf.h" -#include "msm5205.h" - -#include "driver.h" -extern "C" { - #include "ay8910.h" -} - -static UINT8 M62InputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 M62InputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 M62InputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 M62Dip[2] = {0, 0}; -static UINT8 M62Input[3] = {0x00, 0x00, 0x00}; -static UINT8 M62Reset = 0; - -static UINT32 M62Z80RomSize = 0; -static UINT32 M62PromSize = 0; -static UINT32 M62NumTiles = 0; -static UINT32 M62NumSprites = 0; -static UINT32 M62NumChars = 0; -static UINT32 M62SpriteRamSize = 0; -static UINT32 M62CharRamSize = 0; -static UINT32 M62ScrollRamSize = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *M62Z80Rom = NULL; -static UINT8 *M62M6803Rom = NULL; -static UINT8 *M62TileRam = NULL; -static UINT8 *M62SpriteRam = NULL; -static UINT8 *M62CharRam = NULL; -static UINT8 *M62ScrollRam = NULL; -static UINT8 *M62Z80Ram = NULL; -static UINT8 *M62M6803Ram = NULL; -static UINT8 *M62Tiles = NULL; -static UINT8 *M62Sprites = NULL; -static UINT8 *M62Chars = NULL; -static UINT8 *M62PromData = NULL; -static UINT8 *M62TempRom = NULL; -static UINT32 *M62Palette = NULL; -static INT16* pFMBuffer; -static INT16* pAY8910Buffer[6]; - -static INT32 M62BackgroundHScroll; -static INT32 M62BackgroundVScroll; -static INT32 M62CharHScroll; -static INT32 M62CharVScroll; -static INT32 M62FlipScreen; -static INT32 M62SpriteHeightPromOffset; -static UINT8 M62SoundLatch; -static UINT8 M62Port1; -static UINT8 M62Port2; -static UINT8 M62SlaveMSM5205VClckReset; -static UINT32 M62PaletteEntries; -static UINT32 M62Z80Clock; -static UINT32 M62M6803Clock; -static UINT8 M62BankControl[2]; -static UINT8 Ldrun2BankSwap; -static UINT8 Ldrun3TopBottomMask; -static UINT8 KidnikiBackgroundBank; -static UINT8 SpelunkrPaletteBank; -static INT32 M62BgxTileDim = 0; -static INT32 M62BgyTileDim = 0; -static INT32 M62CharxTileDim = 0; -static INT32 M62CharyTileDim = 0; - -typedef void (*M62Render)(); -static M62Render M62RenderFunction; -static void KungfumDraw(); -static void BattroadDraw(); -static void LdrunDraw(); -static void Ldrun3Draw(); -static void Ldrun4Draw(); -static void LotlotDraw(); -static void KidnikiDraw(); -static void SpelunkrDraw(); -static void Spelunk2Draw(); -static void YoujyudnDraw(); -static void HorizonDraw(); - -typedef void (*M62ExtendTileInfo)(INT32*, INT32*, INT32*, INT32*); -static M62ExtendTileInfo M62ExtendTileInfoFunction; -static void BattroadExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip); -static void LdrunExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip); -static void Ldrun2ExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip); -static void Ldrun4ExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*); -static void LotlotExtendTile(INT32* Code, INT32* Colour, INT32*, INT32* xFlip); -static void KidnikiExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*); -static void SpelunkrExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*); -static void Spelunk2ExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*); -static void YoujyudnExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*); -static void HorizonExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*); - -typedef void (*M62ExtendCharInfo)(INT32*, INT32*, INT32*, INT32*); -static M62ExtendCharInfo M62ExtendCharInfoFunction; -static void BattroadExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*); -static void LotlotExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*); -static void SpelunkrExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*); -static void YoujyudnExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*); - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo M62InputList[] = -{ - {"Coin 1" , BIT_DIGITAL , M62InputPort0 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , M62InputPort0 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , M62InputPort2 + 4, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , M62InputPort0 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , M62InputPort1 + 3, "p1 up" }, - {"Down" , BIT_DIGITAL , M62InputPort1 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , M62InputPort1 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , M62InputPort1 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , M62InputPort1 + 7, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , M62InputPort1 + 5, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 3, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 2, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 1, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 0, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 7, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &M62Reset , "reset" }, - {"Service" , BIT_DIGITAL , M62InputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH, M62Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, M62Dip + 1 , "dip" }, -}; - -STDINPUTINFO(M62) - -static inline void M62ClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void M62MakeInputs() -{ - M62Input[0] = M62Input[1] = M62Input[2] = 0x00; - - for (INT32 i = 0; i < 8; i++) { - M62Input[0] |= (M62InputPort0[i] & 1) << i; - M62Input[1] |= (M62InputPort1[i] & 1) << i; - M62Input[2] |= (M62InputPort2[i] & 1) << i; - } - - M62ClearOpposites(&M62Input[0]); - M62ClearOpposites(&M62Input[1]); -} - -#define IREM_Z80_COINAGE_TYPE3 \ - {0 , 0xfe, 0 , 15 , "Coinage" }, \ - {0x12, 0x02, 0xf0, 0x90, "7 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xa0, "6 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xb0, "5 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xc0, "4 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xd0, "3 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xe0, "2 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xf0, "1 Coin 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x70, "1 Coin 2 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x60, "1 Coin 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x50, "1 Coin 4 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x40, "1 Coin 5 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x30, "1 Coin 6 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x20, "1 Coin 7 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x10, "1 Coin 8 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x00, "Freeplay" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - \ - {0 , 0xfe, 0 , 4 , "Coin A" }, \ - {0x12, 0x82, 0x30, 0x10, "3 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0x30, 0x20, "2 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0x30, 0x30, "1 Coin 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0x30, 0x00, "Free Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0 , 0xfe, 0 , 4 , "Coin B" }, \ - {0x12, 0x82, 0xc0, 0xc0, "1 Coin 2 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0xc0, 0x80, "1 Coin 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0xc0, 0x40, "1 Coin 5 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0xc0, 0x00, "1 Coin 6 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - -#define IREM_Z80_COINAGE_TYPE4 \ - {0 , 0xfe, 0 , 16 , "Coinage" }, \ - {0x12, 0x02, 0xf0, 0xa0, "6 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xb0, "5 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xc0, "4 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xd0, "3 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x10, "8 Coins 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xe0, "2 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x20, "5 Coins 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x30, "3 Coins 2 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xf0, "1 Coin 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x40, "2 Coins 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x90, "1 Coin 2 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x80, "1 Coin 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x70, "1 Coin 4 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x60, "1 Coin 5 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x50, "1 Coin 6 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x00, "Freeplay" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - \ - {0 , 0xfe, 0 , 4 , "Coin A" }, \ - {0x12, 0x82, 0x30, 0x00, "5 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0x30, 0x10, "3 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0x30, 0x20, "2 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0x30, 0x30, "1 Coin 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0 , 0xfe, 0 , 4 , "Coin B" }, \ - {0x12, 0x82, 0xc0, 0xc0, "1 Coin 2 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0xc0, 0x80, "1 Coin 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0xc0, 0x40, "1 Coin 5 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0xc0, 0x00, "1 Coin 6 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - -#define IREM_Z80_COINAGE_TYPE5 \ - {0 , 0xfe, 0 , 16 , "Coinage" }, \ - {0x12, 0x02, 0xf0, 0x00, "8 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xa0, "6 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xb0, "5 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xc0, "4 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xd0, "3 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xe0, "2 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x10, "5 Coins 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x20, "3 Coins 5 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x30, "3 Coins 2 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0xf0, "1 Coin 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x40, "2 Coins 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x90, "1 Coin 2 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x80, "1 Coin 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x70, "1 Coin 4 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x60, "1 Coin 5 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x02, 0xf0, 0x50, "1 Coin 6 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - \ - {0 , 0xfe, 0 , 4 , "Coin A" }, \ - {0x12, 0x82, 0x30, 0x00, "5 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0x30, 0x10, "3 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0x30, 0x20, "2 Coins 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0x30, 0x30, "1 Coin 1 Play" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0 , 0xfe, 0 , 4 , "Coin B" }, \ - {0x12, 0x82, 0xc0, 0xc0, "1 Coin 2 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0xc0, 0x80, "1 Coin 3 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0xc0, 0x40, "1 Coin 5 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - {0x12, 0x82, 0xc0, 0x00, "1 Coin 6 Plays" }, \ - {0x13, 0x00, 0x04, 0x04, NULL }, \ - -static struct BurnDIPInfo KungfumDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x12, 0x01, 0x01, 0x01, "Easy" }, - {0x12, 0x01, 0x01, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Energy Loss" }, - {0x12, 0x01, 0x02, 0x02, "Slow" }, - {0x12, 0x01, 0x02, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x0c, 0x08, "2" }, - {0x12, 0x01, 0x0c, 0x0c, "3" }, - {0x12, 0x01, 0x0c, 0x04, "4" }, - {0x12, 0x01, 0x0c, 0x00, "5" }, - - IREM_Z80_COINAGE_TYPE3 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Slow Motion Mode" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Level Selection Mode" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Kungfum) - -static struct BurnDIPInfo BattroadDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Fuel Decrease" }, - {0x12, 0x01, 0x03, 0x03, "Slow" }, - {0x12, 0x01, 0x03, 0x02, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Fast" }, - {0x12, 0x01, 0x03, 0x00, "Fastest" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x12, 0x01, 0x04, 0x04, "Easy" }, - {0x12, 0x01, 0x04, 0x00, "Hard" }, - - IREM_Z80_COINAGE_TYPE3 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Battroad) - -static struct BurnDIPInfo LdrunDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Timer" }, - {0x12, 0x01, 0x03, 0x03, "Slow" }, - {0x12, 0x01, 0x03, 0x02, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Fast" }, - {0x12, 0x01, 0x03, 0x00, "Fastest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x0c, 0x08, "2" }, - {0x12, 0x01, 0x0c, 0x0c, "3" }, - {0x12, 0x01, 0x0c, 0x04, "4" }, - {0x12, 0x01, 0x0c, 0x00, "5" }, - - IREM_Z80_COINAGE_TYPE3 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Level Selection Mode" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Ldrun) - -static struct BurnDIPInfo Ldrun2DIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Timer" }, - {0x12, 0x01, 0x01, 0x01, "Slow" }, - {0x12, 0x01, 0x01, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Game Speed" }, - {0x12, 0x01, 0x02, 0x00, "Low" }, - {0x12, 0x01, 0x02, 0x02, "High" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x0c, 0x08, "2" }, - {0x12, 0x01, 0x0c, 0x0c, "3" }, - {0x12, 0x01, 0x0c, 0x04, "4" }, - {0x12, 0x01, 0x0c, 0x00, "5" }, - - IREM_Z80_COINAGE_TYPE3 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Level Selection Mode" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Ldrun2) - -static struct BurnDIPInfo Ldrun4DIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Timer" }, - {0x12, 0x01, 0x01, 0x01, "Slow" }, - {0x12, 0x01, 0x01, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "2 Players Game" }, - {0x12, 0x01, 0x02, 0x00, "1 Credit" }, - {0x12, 0x01, 0x02, 0x02, "2 Credits" }, - - {0 , 0xfe, 0 , 4 , "1 Player Lives" }, - {0x12, 0x01, 0x0c, 0x08, "2" }, - {0x12, 0x01, 0x0c, 0x0c, "3" }, - {0x12, 0x01, 0x0c, 0x04, "4" }, - {0x12, 0x01, 0x0c, 0x00, "5" }, - - IREM_Z80_COINAGE_TYPE3 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "2 Players Lives" }, - {0x13, 0x01, 0x02, 0x02, "5" }, - {0x13, 0x01, 0x02, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Allow 2 Player Game" }, - {0x13, 0x01, 0x10, 0x00, "Off" }, - {0x13, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Level Selection Mode" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Ldrun4) - -static struct BurnDIPInfo LotlotDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xf5, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Speed" }, - {0x12, 0x01, 0x03, 0x03, "Very Slow" }, - {0x12, 0x01, 0x03, 0x02, "Slow" }, - {0x12, 0x01, 0x03, 0x01, "Fast" }, - {0x12, 0x01, 0x03, 0x00, "Very Fast" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x0c, 0x08, "1" }, - {0x12, 0x01, 0x0c, 0x0c, "2" }, - {0x12, 0x01, 0x0c, 0x04, "3" }, - {0x12, 0x01, 0x0c, 0x00, "4" }, - - IREM_Z80_COINAGE_TYPE4 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Lotlot) - -static struct BurnDIPInfo KidnikiDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x02, "2" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x01, "4" }, - {0x12, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x12, 0x01, 0x04, 0x04, "Normal" }, - {0x12, 0x01, 0x04, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x12, 0x01, 0x08, 0x08, "50000" }, - {0x12, 0x01, 0x08, 0x00, "80000" }, - - IREM_Z80_COINAGE_TYPE4 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Game Repeats" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x10, 0x00, "Off" }, - {0x13, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Kidniki) - -static struct BurnDIPInfo SpelunkrDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xf5, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Energy Decrease" }, - {0x12, 0x01, 0x03, 0x03, "Slow" }, - {0x12, 0x01, 0x03, 0x02, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Fast" }, - {0x12, 0x01, 0x03, 0x00, "Fastest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x0c, 0x08, "2" }, - {0x12, 0x01, 0x0c, 0x0c, "3" }, - {0x12, 0x01, 0x0c, 0x04, "4" }, - {0x12, 0x01, 0x0c, 0x00, "5" }, - - IREM_Z80_COINAGE_TYPE4 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Teleport" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Spelunkr) - -static struct BurnDIPInfo Spelunk2DIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Energy Decrease" }, - {0x12, 0x01, 0x03, 0x03, "Slow" }, - {0x12, 0x01, 0x03, 0x02, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Fast" }, - {0x12, 0x01, 0x03, 0x00, "Fastest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x0c, 0x08, "2" }, - {0x12, 0x01, 0x0c, 0x0c, "3" }, - {0x12, 0x01, 0x0c, 0x04, "4" }, - {0x12, 0x01, 0x0c, 0x00, "5" }, - - IREM_Z80_COINAGE_TYPE4 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x10, 0x00, "Off" }, - {0x13, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Spelunk2) - -static struct BurnDIPInfo YoujyudnDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x02, "2" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x01, "4" }, - {0x12, 0x01, 0x03, 0x00, "5" }, - - IREM_Z80_COINAGE_TYPE4 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x13, 0x01, 0x08, 0x08, "20000 60000" }, - {0x13, 0x01, 0x08, 0x00, "40000 80000" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x10, 0x00, "Off" }, - {0x13, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Level Selection Mode" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Youjyudn) - -static struct BurnDIPInfo HorizonDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x00, "2" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x01, "4" }, - {0x12, 0x01, 0x03, 0x02, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x12, 0x01, 0x0c, 0x00, "100 and 80k" }, - {0x12, 0x01, 0x0c, 0x0c, "40k and every 80k" }, - {0x12, 0x01, 0x0c, 0x08, "60k and every 100k" }, - {0x12, 0x01, 0x0c, 0x04, "80k and every 120k" }, - - IREM_Z80_COINAGE_TYPE5 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Frame Advance" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Horizon) - -static struct BurnRomInfo KungfumRomDesc[] = { - { "a-4e-c.bin", 0x04000, 0xb6e2d083, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "a-4d-c.bin", 0x04000, 0x7532918e, BRF_ESS | BRF_PRG }, // 1 - - { "a-3e-.bin", 0x02000, 0x58e87ab0, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code - { "a-3f-.bin", 0x02000, 0xc81e31ea, BRF_ESS | BRF_PRG }, // 3 - { "a-3h-.bin", 0x02000, 0xd99fb995, BRF_ESS | BRF_PRG }, // 4 - - { "g-4c-a.bin", 0x02000, 0x6b2cc9c8, BRF_GRA }, // 5 Characters - { "g-4d-a.bin", 0x02000, 0xc648f558, BRF_GRA }, // 6 - { "g-4e-a.bin", 0x02000, 0xfbe9276e, BRF_GRA }, // 7 - - { "b-4k-.bin", 0x02000, 0x16fb5150, BRF_GRA }, // 8 Sprites - { "b-4f-.bin", 0x02000, 0x67745a33, BRF_GRA }, // 9 - { "b-4l-.bin", 0x02000, 0xbd1c2261, BRF_GRA }, // 10 - { "b-4h-.bin", 0x02000, 0x8ac5ed3a, BRF_GRA }, // 11 - { "b-3n-.bin", 0x02000, 0x28a213aa, BRF_GRA }, // 12 - { "b-4n-.bin", 0x02000, 0xd5228df3, BRF_GRA }, // 13 - { "b-4m-.bin", 0x02000, 0xb16de4f2, BRF_GRA }, // 14 - { "b-3m-.bin", 0x02000, 0xeba0d66b, BRF_GRA }, // 15 - { "b-4c-.bin", 0x02000, 0x01298885, BRF_GRA }, // 16 - { "b-4e-.bin", 0x02000, 0xc77b87d4, BRF_GRA }, // 17 - { "b-4d-.bin", 0x02000, 0x6a70615f, BRF_GRA }, // 18 - { "b-4a-.bin", 0x02000, 0x6189d626, BRF_GRA }, // 19 - - { "g-1j-.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 20 PROM (Tile Palette Red Component) - { "b-1m-.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) - { "g-1f-.bin", 0x00100, 0x964b6495, BRF_GRA }, // 22 PROM (Tile Palette Green Component) - { "b-1n-.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) - { "g-1h-.bin", 0x00100, 0x550563e1, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) - { "b-1l-.bin", 0x00100, 0x35e45021, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) - { "b-5f-.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 26 PROM (Sprite Height) - { "b-6f-.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 27 PROM (Video Timing) -}; - -STD_ROM_PICK(Kungfum) -STD_ROM_FN(Kungfum) - -static struct BurnRomInfo KungfumdRomDesc[] = { - { "snx_a-4e-d", 0x04000, 0xfc330a46, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "snx_a-4d-d", 0x04000, 0x1b2fd32f, BRF_ESS | BRF_PRG }, // 1 - - { "snx_a-3d-b", 0x04000, 0x85ca7956, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code - { "snx_a-3f-b", 0x04000, 0x3ef1100a, BRF_ESS | BRF_PRG }, // 3 - - { "g-4c-a.bin", 0x02000, 0x6b2cc9c8, BRF_GRA }, // 4 Characters - { "g-4d-a.bin", 0x02000, 0xc648f558, BRF_GRA }, // 5 - { "g-4e-a.bin", 0x02000, 0xfbe9276e, BRF_GRA }, // 6 - - { "snx_b-4k-b", 0x04000, 0x85591db2, BRF_GRA }, // 7 Sprites - { "snx_b-4f-b", 0x04000, 0xed719d7b, BRF_GRA }, // 8 - { "snx_b-3n-b", 0x04000, 0x05fcce8b, BRF_GRA }, // 9 - { "snx_b-4n-b", 0x04000, 0xdc675003, BRF_GRA }, // 10 - { "snx_b-4c-b", 0x04000, 0x1df11d81, BRF_GRA }, // 11 - { "snx_b-4e-b", 0x04000, 0x2d3b69dd, BRF_GRA }, // 12 - - { "g-1j-.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 13 PROM (Tile Palette Red Component) - { "b-1m-.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 14 PROM (Sprite Palette Red Component) - { "g-1f-.bin", 0x00100, 0x964b6495, BRF_GRA }, // 15 PROM (Tile Palette Green Component) - { "b-1n-.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 16 PROM (Sprite Palette Green Component) - { "g-1h-.bin", 0x00100, 0x550563e1, BRF_GRA }, // 17 PROM (Tile Palette Blue Component) - { "b-1l-.bin", 0x00100, 0x35e45021, BRF_GRA }, // 18 PROM (Sprite Palette Blue Component) - { "b-5f-.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 19 PROM (Sprite Height) - { "b-6f-.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 20 PROM (Video Timing) -}; - -STD_ROM_PICK(Kungfumd) -STD_ROM_FN(Kungfumd) - -static struct BurnRomInfo SpartanxRomDesc[] = { - { "a-4e-c-j.bin", 0x04000, 0x32a0a9a6, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "a-4d-c-j.bin", 0x04000, 0x3173ea78, BRF_ESS | BRF_PRG }, // 1 - - { "a-3e-.bin", 0x02000, 0x58e87ab0, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code - { "a-3f-.bin", 0x02000, 0xc81e31ea, BRF_ESS | BRF_PRG }, // 3 - { "a-3h-.bin", 0x02000, 0xd99fb995, BRF_ESS | BRF_PRG }, // 4 - - { "g-4c-a-j.bin", 0x02000, 0x8af9c5a6, BRF_GRA }, // 5 Characters - { "g-4d-a-j.bin", 0x02000, 0xb8300c72, BRF_GRA }, // 6 - { "g-4e-a-j.bin", 0x02000, 0xb50429cd, BRF_GRA }, // 7 - - { "b-4k-.bin", 0x02000, 0x16fb5150, BRF_GRA }, // 8 Sprites - { "b-4f-.bin", 0x02000, 0x67745a33, BRF_GRA }, // 9 - { "b-4l-.bin", 0x02000, 0xbd1c2261, BRF_GRA }, // 10 - { "b-4h-.bin", 0x02000, 0x8ac5ed3a, BRF_GRA }, // 11 - { "b-3n-.bin", 0x02000, 0x28a213aa, BRF_GRA }, // 12 - { "b-4n-.bin", 0x02000, 0xd5228df3, BRF_GRA }, // 13 - { "b-4m-.bin", 0x02000, 0xb16de4f2, BRF_GRA }, // 14 - { "b-3m-.bin", 0x02000, 0xeba0d66b, BRF_GRA }, // 15 - { "b-4c-.bin", 0x02000, 0x01298885, BRF_GRA }, // 16 - { "b-4e-.bin", 0x02000, 0xc77b87d4, BRF_GRA }, // 17 - { "b-4d-.bin", 0x02000, 0x6a70615f, BRF_GRA }, // 18 - { "b-4a-.bin", 0x02000, 0x6189d626, BRF_GRA }, // 19 - - { "g-1j-.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 20 PROM (Tile Palette Red Component) - { "b-1m-.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) - { "g-1f-.bin", 0x00100, 0x964b6495, BRF_GRA }, // 22 PROM (Tile Palette Green Component) - { "b-1n-.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) - { "g-1h-.bin", 0x00100, 0x550563e1, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) - { "b-1l-.bin", 0x00100, 0x35e45021, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) - { "b-5f-.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 26 PROM (Sprite Height) - { "b-6f-.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 27 PROM (Video Timing) -}; - -STD_ROM_PICK(Spartanx) -STD_ROM_FN(Spartanx) - -static struct BurnRomInfo KungfubRomDesc[] = { - { "c5.5h", 0x04000, 0x5d8e791d, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "c4.5k", 0x04000, 0x4000e2b8, BRF_ESS | BRF_PRG }, // 1 - - { "a-3e-.bin", 0x02000, 0x58e87ab0, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code - { "a-3f-.bin", 0x02000, 0xc81e31ea, BRF_ESS | BRF_PRG }, // 3 - { "a-3h-.bin", 0x02000, 0xd99fb995, BRF_ESS | BRF_PRG }, // 4 - - { "g-4c-a.bin", 0x02000, 0x6b2cc9c8, BRF_GRA }, // 5 Characters - { "g-4d-a.bin", 0x02000, 0xc648f558, BRF_GRA }, // 6 - { "g-4e-a.bin", 0x02000, 0xfbe9276e, BRF_GRA }, // 7 - - { "b-4k-.bin", 0x02000, 0x16fb5150, BRF_GRA }, // 8 Sprites - { "b-4f-.bin", 0x02000, 0x67745a33, BRF_GRA }, // 9 - { "b-4l-.bin", 0x02000, 0xbd1c2261, BRF_GRA }, // 10 - { "b-4h-.bin", 0x02000, 0x8ac5ed3a, BRF_GRA }, // 11 - { "b-3n-.bin", 0x02000, 0x28a213aa, BRF_GRA }, // 12 - { "b-4n-.bin", 0x02000, 0xd5228df3, BRF_GRA }, // 13 - { "b-4m-.bin", 0x02000, 0xb16de4f2, BRF_GRA }, // 14 - { "b-3m-.bin", 0x02000, 0xeba0d66b, BRF_GRA }, // 15 - { "b-4c-.bin", 0x02000, 0x01298885, BRF_GRA }, // 16 - { "b-4e-.bin", 0x02000, 0xc77b87d4, BRF_GRA }, // 17 - { "b-4d-.bin", 0x02000, 0x6a70615f, BRF_GRA }, // 18 - { "b-4a-.bin", 0x02000, 0x6189d626, BRF_GRA }, // 19 - - { "tbp24s10-main-1c.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 20 PROM (Tile Palette Red Component) - { "tbp24s10-gfx-1r.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) - { "tbp24s10-main-1a.bin", 0x00100, 0x964b6495, BRF_GRA }, // 22 PROM (Tile Palette Green Component) - { "tbp24s10-gfx-1s.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) - { "tbp24s10-main-1b.bin", 0x00100, 0x550563e1, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) - { "tbp24s10-gfx-1p.bin", 0x00100, 0x35e45021, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) - { "18s030-gfx-8t.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 26 PROM (Sprite Height) - { "tbp24s10-gfx-9k.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 27 PROM (Video Timing) - { "18s030-gfx-10a.bin", 0x00020, 0x3858acd0, BRF_OPT }, // 27 - { "18s030-gfx-5d.bin", 0x00020, 0x51304fcd, BRF_OPT }, // 28 - { "18s030-gfx-5e.bin", 0x00020, 0x51304fcd, BRF_OPT }, // 29 - { "18s030-gfx-6l.bin", 0x00020, 0x3858acd0, BRF_OPT }, // 30 - { "tbp24s10-gfx-3b.bin", 0x00100, 0xe6506ef4, BRF_OPT }, // 31 - { "tbp24s10-gfx-4a.bin", 0x00100, 0xe0aa8869, BRF_OPT }, // 32 - { "tbp24s10-gfx-4c.bin", 0x00100, 0xb43d094f, BRF_OPT }, // 33 - { "tbp24s10-gfx-6d.bin", 0x00100, 0x48bb39c9, BRF_OPT }, // 34 - { "tbp24s10-gfx-6e.bin", 0x00100, 0x48bb39c9, BRF_OPT }, // 35 - { "tbp24s10-gfx-6m.bin", 0x00100, 0x9f7a1a4d, BRF_OPT }, // 36 - { "tbp24s10-gfx-6n.bin", 0x00100, 0x35e5b39e, BRF_OPT }, // 37 - { "tbp24s10-gfx-8a.bin", 0x00100, 0x35e5b39e, BRF_OPT }, // 38 - { "tbp24s10-gfx-9a.bin", 0x00100, 0x9f7a1a4d, BRF_OPT }, // 39 - { "tbp24s10-gfx-9k.bin", 0x00100, 0x82c20d12, BRF_OPT }, // 40 - { "tbp24s10-main-8b.bin", 0x00100, 0x180fbc57, BRF_OPT }, // 41 - { "tbp24s10-main-8c.bin", 0x00100, 0x3bb32e5a, BRF_OPT }, // 42 - { "tbp24s10-main-8d.bin", 0x00100, 0x599c319f, BRF_OPT }, // 43 -}; - -STD_ROM_PICK(Kungfub) -STD_ROM_FN(Kungfub) - -static struct BurnRomInfo Kungfub2RomDesc[] = { - { "kf4", 0x04000, 0x3f65313f, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "kf5", 0x04000, 0x9ea325f3, BRF_ESS | BRF_PRG }, // 1 - - { "a-3e-.bin", 0x02000, 0x58e87ab0, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code - { "a-3f-.bin", 0x02000, 0xc81e31ea, BRF_ESS | BRF_PRG }, // 3 - { "a-3h-.bin", 0x02000, 0xd99fb995, BRF_ESS | BRF_PRG }, // 4 - - { "g-4c-a.bin", 0x02000, 0x6b2cc9c8, BRF_GRA }, // 5 Characters - { "g-4d-a.bin", 0x02000, 0xc648f558, BRF_GRA }, // 6 - { "g-4e-a.bin", 0x02000, 0xfbe9276e, BRF_GRA }, // 7 - - { "b-4k-.bin", 0x02000, 0x16fb5150, BRF_GRA }, // 8 Sprites - { "b-4f-.bin", 0x02000, 0x67745a33, BRF_GRA }, // 9 - { "b-4l-.bin", 0x02000, 0xbd1c2261, BRF_GRA }, // 10 - { "b-4h-.bin", 0x02000, 0x8ac5ed3a, BRF_GRA }, // 11 - { "b-3n-.bin", 0x02000, 0x28a213aa, BRF_GRA }, // 12 - { "b-4n-.bin", 0x02000, 0xd5228df3, BRF_GRA }, // 13 - { "b-4m-.bin", 0x02000, 0xb16de4f2, BRF_GRA }, // 14 - { "b-3m-.bin", 0x02000, 0xeba0d66b, BRF_GRA }, // 15 - { "b-4c-.bin", 0x02000, 0x01298885, BRF_GRA }, // 16 - { "b-4e-.bin", 0x02000, 0xc77b87d4, BRF_GRA }, // 17 - { "b-4d-.bin", 0x02000, 0x6a70615f, BRF_GRA }, // 18 - { "b-4a-.bin", 0x02000, 0x6189d626, BRF_GRA }, // 19 - - { "g-1j-.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 20 PROM (Tile Palette Red Component) - { "b-1m-.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) - { "g-1f-.bin", 0x00100, 0x964b6495, BRF_GRA }, // 22 PROM (Tile Palette Green Component) - { "b-1n-.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) - { "g-1h-.bin", 0x00100, 0x550563e1, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) - { "b-1l-.bin", 0x00100, 0x35e45021, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) - { "b-5f-.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 26 PROM (Sprite Height) - { "b-6f-.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 27 PROM (Video Timing) -}; - -STD_ROM_PICK(Kungfub2) -STD_ROM_FN(Kungfub2) - -static struct BurnRomInfo Kungfub3RomDesc[] = { - { "5.bin", 0x04000, 0x5d8e791d, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "4.bin", 0x04000, 0x4000e2b8, BRF_ESS | BRF_PRG }, // 1 - - { "1.bin", 0x02000, 0x58e87ab0, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code - { "2.bin", 0x02000, 0xc81e31ea, BRF_ESS | BRF_PRG }, // 3 - { "3.bin", 0x02000, 0xd99fb995, BRF_ESS | BRF_PRG }, // 4 - - { "6.bin", 0x02000, 0x6b2cc9c8, BRF_GRA }, // 4 Characters - { "7.bin", 0x02000, 0xc648f558, BRF_GRA }, // 5 - { "8.bin", 0x02000, 0xfbe9276e, BRF_GRA }, // 6 - - { "14.bin", 0x04000, 0x85591db2, BRF_GRA }, // 7 Sprites - { "13.bin", 0x04000, 0xed719d7b, BRF_GRA }, // 8 - { "16.bin", 0x04000, 0x05fcce8b, BRF_GRA }, // 9 - { "15.bin", 0x04000, 0xdc675003, BRF_GRA }, // 10 - { "11.bin", 0x04000, 0x1df11d81, BRF_GRA }, // 11 - { "12.bin", 0x04000, 0x2d3b69dd, BRF_GRA }, // 12 - - { "g-1j-.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 13 PROM (Tile Palette Red Component) - { "b-1m-.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 14 PROM (Sprite Palette Red Component) - { "g-1f-.bin", 0x00100, 0x964b6495, BRF_GRA }, // 15 PROM (Tile Palette Green Component) - { "b-1n-.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 16 PROM (Sprite Palette Green Component) - { "g-1h-.bin", 0x00100, 0x550563e1, BRF_GRA }, // 17 PROM (Tile Palette Blue Component) - { "b-1l-.bin", 0x00100, 0x35e45021, BRF_GRA }, // 18 PROM (Sprite Palette Blue Component) - { "b-5f-.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 19 PROM (Sprite Height) - { "b-6f-.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 20 PROM (Video Timing) -}; - -STD_ROM_PICK(Kungfub3) -STD_ROM_FN(Kungfub3) - -static struct BurnRomInfo BattroadRomDesc[] = { - { "br-a-4e.b", 0x02000, 0x9bf14768, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "br-a-4d.b", 0x02000, 0x39ca1627, BRF_ESS | BRF_PRG }, // 1 - { "br-a-4b.b", 0x02000, 0x1865bb22, BRF_ESS | BRF_PRG }, // 2 - { "br-a-4a", 0x02000, 0x65b61c21, BRF_ESS | BRF_PRG }, // 3 - { "br-c-7c", 0x02000, 0x2e1eca52, BRF_ESS | BRF_PRG }, // 4 - { "br-c-7l", 0x02000, 0xf2178578, BRF_ESS | BRF_PRG }, // 5 - { "br-c-7d", 0x02000, 0x3aa9fa30, BRF_ESS | BRF_PRG }, // 6 - { "br-c-7b", 0x02000, 0x0b31b90b, BRF_ESS | BRF_PRG }, // 7 - { "br-c-7a", 0x02000, 0xec3b0080, BRF_ESS | BRF_PRG }, // 8 - { "br-c-7k", 0x02000, 0xedc75f7f, BRF_ESS | BRF_PRG }, // 9 - - { "br-a-3e", 0x02000, 0xa7140871, BRF_ESS | BRF_PRG }, // 10 M6803 Program Code - { "br-a-3f", 0x02000, 0x1bb51b30, BRF_ESS | BRF_PRG }, // 11 - { "br-a-3h", 0x02000, 0xafb3e083, BRF_ESS | BRF_PRG }, // 12 - - { "br-c-6h", 0x02000, 0xca50841c, BRF_GRA }, // 13 Tiles - { "br-c-6n", 0x02000, 0x7d53163a, BRF_GRA }, // 14 - { "br-c-6k", 0x02000, 0x5951e12a, BRF_GRA }, // 15 - - { "br-b-4k.a", 0x02000, 0xd3c5e85b, BRF_GRA }, // 16 Sprites - { "br-b-4f.a", 0x02000, 0x4354232a, BRF_GRA }, // 17 - { "br-b-3n.a", 0x02000, 0x2668dbef, BRF_GRA }, // 18 - { "br-b-4n.a", 0x02000, 0xc719a324, BRF_GRA }, // 19 - { "br-b-4c.a", 0x02000, 0x0b3193bf, BRF_GRA }, // 20 - { "br-b-4e.a", 0x02000, 0x3662e8fb, BRF_GRA }, // 21 - - { "br-c-1b", 0x02000, 0x8088911e, BRF_GRA }, // 22 Chars - { "br-c-1c", 0x02000, 0x3d78b653, BRF_GRA }, // 23 - - { "br-c-3j", 0x00100, 0xaceaed79, BRF_GRA }, // 24 PROM (Tile Palette Red Component) - { "br-b-1m", 0x00100, 0x3bd30c7d, BRF_GRA }, // 25 PROM (Sprite Palette Red Component) - { "br-c-3l", 0x00100, 0x7cf6f380, BRF_GRA }, // 26 PROM (Tile Palette Green Component) - { "br-b-1n", 0x00100, 0xb7f3dc3b, BRF_GRA }, // 27 PROM (Sprite Palette Green Component) - { "br-c-3k", 0x00100, 0xd90e4a54, BRF_GRA }, // 28 PROM (Tile Palette Blue Component) - { "br-b-1l", 0x00100, 0x5271c7d8, BRF_GRA }, // 29 PROM (Sprite Palette Blue Component) - { "br-b-5p", 0x00020, 0xce746937, BRF_GRA }, // 30 PROM (Sprite Height) - { "br-b-6f", 0x00100, 0x82c20d12, BRF_GRA }, // 31 PROM (Video Timing) - { "br-c-1j", 0x00020, 0x78eb5d77, BRF_GRA }, // 32 PROM (Char Palette) -}; - -STD_ROM_PICK(Battroad) -STD_ROM_FN(Battroad) - -static struct BurnRomInfo LdrunRomDesc[] = { - { "lr-a-4e", 0x02000, 0x5d7e2a4d, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "lr-a-4d", 0x02000, 0x96f20473, BRF_ESS | BRF_PRG }, // 1 - { "lr-a-4b", 0x02000, 0xb041c4a9, BRF_ESS | BRF_PRG }, // 2 - { "lr-a-4a", 0x02000, 0x645e42aa, BRF_ESS | BRF_PRG }, // 3 - - { "lr-a-3f", 0x02000, 0x7a96accd, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code - { "lr-a-3h", 0x02000, 0x3f7f3939, BRF_ESS | BRF_PRG }, // 5 - - { "lr-e-2d", 0x02000, 0x24f9b58d, BRF_GRA }, // 6 Characters - { "lr-e-2j", 0x02000, 0x43175e08, BRF_GRA }, // 7 - { "lr-e-2f", 0x02000, 0xe0317124, BRF_GRA }, // 8 - - { "lr-b-4k", 0x02000, 0x8141403e, BRF_GRA }, // 9 Sprites - { "lr-b-3n", 0x02000, 0x55154154, BRF_GRA }, // 10 - { "lr-b-4c", 0x02000, 0x924e34d0, BRF_GRA }, // 11 - - { "lr-e-3m", 0x00100, 0x53040416, BRF_GRA }, // 20 PROM (Tile Palette Red Component) - { "lr-b-1m", 0x00100, 0x4bae1c25, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) - { "lr-e-3l", 0x00100, 0x67786037, BRF_GRA }, // 22 PROM (Tile Palette Green Component) - { "lr-b-1n", 0x00100, 0x9cd3db94, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) - { "lr-e-3n", 0x00100, 0x5b716837, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) - { "lr-b-1l", 0x00100, 0x08d8cf9a, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) - { "lr-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 26 PROM (Sprite Height) - { "lr-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 27 PROM (Video Timing) -}; - -STD_ROM_PICK(Ldrun) -STD_ROM_FN(Ldrun) - -static struct BurnRomInfo LdrunaRomDesc[] = { - { "roma4c", 0x02000, 0x279421e1, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "lr-a-4d", 0x02000, 0x96f20473, BRF_ESS | BRF_PRG }, // 1 - { "roma4b", 0x02000, 0x3c464bad, BRF_ESS | BRF_PRG }, // 2 - { "roma4a", 0x02000, 0x899df8e0, BRF_ESS | BRF_PRG }, // 3 - - { "lr-a-3f", 0x02000, 0x7a96accd, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code - { "lr-a-3h", 0x02000, 0x3f7f3939, BRF_ESS | BRF_PRG }, // 5 - - { "lr-e-2d", 0x02000, 0x24f9b58d, BRF_GRA }, // 6 Characters - { "lr-e-2j", 0x02000, 0x43175e08, BRF_GRA }, // 7 - { "lr-e-2f", 0x02000, 0xe0317124, BRF_GRA }, // 8 - - { "lr-b-4k", 0x02000, 0x8141403e, BRF_GRA }, // 9 Sprites - { "lr-b-3n", 0x02000, 0x55154154, BRF_GRA }, // 10 - { "lr-b-4c", 0x02000, 0x924e34d0, BRF_GRA }, // 11 - - { "lr-e-3m", 0x00100, 0x53040416, BRF_GRA }, // 20 PROM (Tile Palette Red Component) - { "lr-b-1m", 0x00100, 0x4bae1c25, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) - { "lr-e-3l", 0x00100, 0x67786037, BRF_GRA }, // 22 PROM (Tile Palette Green Component) - { "lr-b-1n", 0x00100, 0x9cd3db94, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) - { "lr-e-3n", 0x00100, 0x5b716837, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) - { "lr-b-1l", 0x00100, 0x08d8cf9a, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) - { "lr-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 26 PROM (Sprite Height) - { "lr-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 27 PROM (Video Timing) -}; - -STD_ROM_PICK(Ldruna) -STD_ROM_FN(Ldruna) - -static struct BurnRomInfo Ldrun2RomDesc[] = { - { "lr2-a-4e.a", 0x02000, 0x22313327, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "lr2-a-4d", 0x02000, 0xef645179, BRF_ESS | BRF_PRG }, // 1 - { "lr2-a-4a.a", 0x02000, 0xb11ddf59, BRF_ESS | BRF_PRG }, // 2 - { "lr2-a-4a", 0x02000, 0x470cc8a1, BRF_ESS | BRF_PRG }, // 3 - { "lr2-h-1c.a", 0x02000, 0x7ebcadbc, BRF_ESS | BRF_PRG }, // 4 - { "lr2-h-1d.a", 0x02000, 0x64cbb7f9, BRF_ESS | BRF_PRG }, // 5 - - { "lr2-a-3e", 0x02000, 0x853f3898, BRF_ESS | BRF_PRG }, // 6 M6803 Program Code - { "lr2-a-3f", 0x02000, 0x7a96accd, BRF_ESS | BRF_PRG }, // 7 - { "lr2-a-3h", 0x02000, 0x2a0e83ca, BRF_ESS | BRF_PRG }, // 8 - - { "lr2-h-1e", 0x02000, 0x9d63a8ff, BRF_GRA }, // 9 Characters - { "lr2-h-1j", 0x02000, 0x40332bbd, BRF_GRA }, // 10 - { "lr2-h-1h", 0x02000, 0x9404727d, BRF_GRA }, // 11 - - { "lr2-b-4k", 0x02000, 0x79909871, BRF_GRA }, // 12 Sprites - { "lr2-b-4f", 0x02000, 0x06ba1ef4, BRF_GRA }, // 13 - { "lr2-b-3n", 0x02000, 0x3cc5893f, BRF_GRA }, // 14 - { "lr2-b-4n", 0x02000, 0x49c12f42, BRF_GRA }, // 15 - { "lr2-b-4c", 0x02000, 0xfbe6d24c, BRF_GRA }, // 16 - { "lr2-b-4e", 0x02000, 0x75172d1f, BRF_GRA }, // 17 - - { "lr2-h-3m", 0x00100, 0x2c5d834b, BRF_GRA }, // 18 PROM (Tile Palette Red Component) - { "lr2-b-1m", 0x00100, 0x4ec9bb3d, BRF_GRA }, // 19 PROM (Sprite Palette Red Component) - { "lr2-h-3l", 0x00100, 0x3ae69aca, BRF_GRA }, // 20 PROM (Tile Palette Green Component) - { "lr2-b-1n", 0x00100, 0x1daf1fa4, BRF_GRA }, // 21 PROM (Sprite Palette Green Component) - { "lr2-h-3n", 0x00100, 0x2b28aec5, BRF_GRA }, // 22 PROM (Tile Palette Blue Component) - { "lr2-b-1l", 0x00100, 0xc8fb708a, BRF_GRA }, // 23 PROM (Sprite Palette Blue Component) - { "lr2-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 24 PROM (Sprite Height) - { "lr2-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 25 PROM (Video Timing) -}; - -STD_ROM_PICK(Ldrun2) -STD_ROM_FN(Ldrun2) - -static struct BurnRomInfo Ldrun3RomDesc[] = { - { "lr3a4eb.bin", 0x04000, 0x09affc47, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "lr3a4db.bin", 0x04000, 0x23a02178, BRF_ESS | BRF_PRG }, // 1 - { "lr3a4bb.bin", 0x04000, 0x3d501a1a, BRF_ESS | BRF_PRG }, // 2 - - { "lr3-a-3d", 0x04000, 0x28be68cd, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code - { "lr3-a-3f", 0x04000, 0xcb7186b7, BRF_ESS | BRF_PRG }, // 4 - - { "lr3-n-2a", 0x04000, 0xf9b74dee, BRF_GRA }, // 5 Characters - { "lr3-n-2c", 0x04000, 0xfef707ba, BRF_GRA }, // 6 - { "lr3-n-2b", 0x04000, 0xaf3d27b9, BRF_GRA }, // 7 - - { "lr3b4kb.bin", 0x04000, 0x21ecd8c5, BRF_GRA }, // 8 Sprites - { "snxb4fb.bin", 0x04000, 0xed719d7b, BRF_GRA }, // 9 - { "lr3b3nb.bin", 0x04000, 0xda8cffab, BRF_GRA }, // 10 - { "snxb4nb.bin", 0x04000, 0xdc675003, BRF_GRA }, // 11 - { "snxb4cb.bin", 0x04000, 0x585aa244, BRF_GRA }, // 12 - { "snxb4eb.bin", 0x04000, 0x2d3b69dd, BRF_GRA }, // 13 - - { "lr3-n-2l", 0x00100, 0xe880b86b, BRF_GRA }, // 14 PROM (Tile Palette Red Component) - { "lr3-b-1m", 0x00100, 0xf02d7167, BRF_GRA }, // 15 PROM (Sprite Palette Red Component) - { "lr3-n-2k", 0x00100, 0x047ee051, BRF_GRA }, // 16 PROM (Tile Palette Green Component) - { "lr3-b-1n", 0x00100, 0x9e37f181, BRF_GRA }, // 17 PROM (Sprite Palette Green Component) - { "lr3-n-2m", 0x00100, 0x69ad8678, BRF_GRA }, // 18 PROM (Tile Palette Blue Component) - { "lr3-b-1l", 0x00100, 0x5b11c41d, BRF_GRA }, // 19 PROM (Sprite Palette Blue Component) - { "lr3-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 20 PROM (Sprite Height) - { "lr3-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 21 PROM (Video Timing) - { "lr3-n-4f", 0x00100, 0xdf674be9, BRF_OPT }, // 22 PROM (Unknown) -}; - -STD_ROM_PICK(Ldrun3) -STD_ROM_FN(Ldrun3) - -static struct BurnRomInfo Ldrun3jRomDesc[] = { - { "lr3-a-4e", 0x04000, 0x5b334e8e, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "lr3-a-4d.a", 0x04000, 0xa84bc931, BRF_ESS | BRF_PRG }, // 1 - { "lr3-a-4b.a", 0x04000, 0xbe09031d, BRF_ESS | BRF_PRG }, // 2 - - { "lr3-a-3d", 0x04000, 0x28be68cd, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code - { "lr3-a-3f", 0x04000, 0xcb7186b7, BRF_ESS | BRF_PRG }, // 4 - - { "lr3-n-2a", 0x04000, 0xf9b74dee, BRF_GRA }, // 5 Characters - { "lr3-n-2c", 0x04000, 0xfef707ba, BRF_GRA }, // 6 - { "lr3-n-2b", 0x04000, 0xaf3d27b9, BRF_GRA }, // 7 - - { "lr3-b-4k", 0x04000, 0x63f070c7, BRF_GRA }, // 8 Sprites - { "lr3-b-3n", 0x04000, 0xeab7ad91, BRF_GRA }, // 9 - { "lr3-b-4c", 0x04000, 0x1a460a46, BRF_GRA }, // 10 - - { "lr3-n-2l", 0x00100, 0xe880b86b, BRF_GRA }, // 11 PROM (Tile Palette Red Component) - { "lr3-b-1m", 0x00100, 0xf02d7167, BRF_GRA }, // 12 PROM (Sprite Palette Red Component) - { "lr3-n-2k", 0x00100, 0x047ee051, BRF_GRA }, // 13 PROM (Tile Palette Green Component) - { "lr3-b-1n", 0x00100, 0x9e37f181, BRF_GRA }, // 14 PROM (Sprite Palette Green Component) - { "lr3-n-2m", 0x00100, 0x69ad8678, BRF_GRA }, // 15 PROM (Tile Palette Blue Component) - { "lr3-b-1l", 0x00100, 0x5b11c41d, BRF_GRA }, // 16 PROM (Sprite Palette Blue Component) - { "lr3-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 17 PROM (Sprite Height) - { "lr3-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 18 PROM (Video Timing) - { "lr3-n-4f", 0x00100, 0xdf674be9, BRF_OPT }, // 19 PROM (Unknown) -}; - -STD_ROM_PICK(Ldrun3j) -STD_ROM_FN(Ldrun3j) - -static struct BurnRomInfo Ldrun4RomDesc[] = { - { "lr4-a-4e", 0x04000, 0x5383e9bf, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "lr4-a-4d.c", 0x04000, 0x298afa36, BRF_ESS | BRF_PRG }, // 1 - { "lr4-v-4k", 0x08000, 0x8b248abd, BRF_ESS | BRF_PRG }, // 2 - - { "lr4-a-3d", 0x04000, 0x86c6d445, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code - { "lr4-a-3f", 0x04000, 0x097c6c0a, BRF_ESS | BRF_PRG }, // 4 - - { "lr4-v-2b", 0x04000, 0x4118e60a, BRF_GRA }, // 5 Characters - { "lr4-v-2d", 0x04000, 0x542bb5b5, BRF_GRA }, // 6 - { "lr4-v-2c", 0x04000, 0xc765266c, BRF_GRA }, // 7 - - { "lr4-b-4k", 0x04000, 0xe7fe620c, BRF_GRA }, // 8 Sprites - { "lr4-b-4f", 0x04000, 0x6f0403db, BRF_GRA }, // 9 - { "lr4-b-3n", 0x04000, 0xad1fba1b, BRF_GRA }, // 10 - { "lr4-b-4n", 0x04000, 0x0e568fab, BRF_GRA }, // 11 - { "lr4-b-4c", 0x04000, 0x82c53669, BRF_GRA }, // 12 - { "lr4-b-4e", 0x04000, 0x767a1352, BRF_GRA }, // 13 - - { "lr4-v-1m", 0x00100, 0xfe51bf1d, BRF_GRA }, // 14 PROM (Tile Palette Red Component) - { "lr4-b-1m", 0x00100, 0x5d8d17d0, BRF_GRA }, // 15 PROM (Sprite Palette Red Component) - { "lr4-v-1n", 0x00100, 0xda0658e5, BRF_GRA }, // 16 PROM (Tile Palette Green Component) - { "lr4-b-1n", 0x00100, 0xda1129d2, BRF_GRA }, // 17 PROM (Sprite Palette Green Component) - { "lr4-v-1p", 0x00100, 0x0df23ebe, BRF_GRA }, // 18 PROM (Tile Palette Blue Component) - { "lr4-b-1l", 0x00100, 0x0d89b692, BRF_GRA }, // 19 PROM (Sprite Palette Blue Component) - { "lr4-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 20 PROM (Sprite Height) - { "lr4-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 21 PROM (Video Timing) - { "lr4-v-4h", 0x00100, 0xdf674be9, BRF_OPT }, // 22 PROM (Unknown) -}; - -STD_ROM_PICK(Ldrun4) -STD_ROM_FN(Ldrun4) - -static struct BurnRomInfo LotlotRomDesc[] = { - { "lot-a-4e", 0x04000, 0x2913d08f, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "lot-a-4d", 0x04000, 0x0443095f, BRF_ESS | BRF_PRG }, // 1 - - { "lot-a-3h", 0x02000, 0x0781cee7, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code - - { "lot-k-4a", 0x02000, 0x1b3695f4, BRF_GRA }, // 3 Tiles - { "lot-k-4c", 0x02000, 0xbd2b0730, BRF_GRA }, // 4 - { "lot-k-4b", 0x02000, 0x930ddd55, BRF_GRA }, // 5 - - { "lot-b-4k", 0x02000, 0xfd27cb90, BRF_GRA }, // 6 Sprites - { "lot-b-3n", 0x02000, 0xbd486fff, BRF_GRA }, // 7 - { "lot-b-4c", 0x02000, 0x3026ee6c, BRF_GRA }, // 8 - - { "lot-k-4p", 0x02000, 0x3b7d95ba, BRF_GRA }, // 9 Characters - { "lot-k-4l", 0x02000, 0xf98dca1f, BRF_GRA }, // 10 - { "lot-k-4n", 0x02000, 0xf0cd76a5, BRF_GRA }, // 11 - - { "lot-k-2f", 0x00100, 0xb820a05e, BRF_GRA }, // 12 PROM (Tile Palette Red Component) - { "lot-b-1m", 0x00100, 0xc146461d, BRF_GRA }, // 13 PROM (Sprite Palette Red Component) - { "lot-k-2l", 0x00100, 0xac3e230d, BRF_GRA }, // 14 PROM (Char Palette Red Component) - { "lot-k-2e", 0x00100, 0x9b1fa005, BRF_GRA }, // 15 PROM (Tile Palette Green Component) - { "lot-b-1n", 0x00100, 0x01e07db6, BRF_GRA }, // 16 PROM (Sprite Palette Green Component) - { "lot-k-2k", 0x00100, 0x1811ad2b, BRF_GRA }, // 17 PROM (Char Palette Green Component) - { "lot-k-2d", 0x00100, 0x315ed9a8, BRF_GRA }, // 18 PROM (Tile Palette Blue Component) - { "lot-b-1l", 0x00100, 0x8b6fcde3, BRF_GRA }, // 19 PROM (Sprite Palette Blue Component) - { "lot-k-2j", 0x00100, 0xe791ef2a, BRF_GRA }, // 20 PROM (Char Palette Blue Component) - { "lot-b-5p", 0x00020, 0x110b21fd, BRF_GRA }, // 21 PROM (Sprite Height) - { "lot-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 22 PROM (Video Timing) - { "lot-k-7e", 0x00200, 0x6cef0fbd, BRF_GRA }, // 23 PROM (Unknown) - { "lot-k-7h", 0x00200, 0x04442bee, BRF_GRA }, // 24 PROM (Unknown) -}; - -STD_ROM_PICK(Lotlot) -STD_ROM_FN(Lotlot) - -static struct BurnRomInfo KidnikiRomDesc[] = { - { "ky_a-4e-g.bin", 0x04000, 0x2edcbcd7, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "dr03.4cd", 0x04000, 0xdba20934, BRF_ESS | BRF_PRG }, // 1 - { "ky_t-8k-g.bin", 0x08000, 0xdbc42f31, BRF_ESS | BRF_PRG }, // 2 - { "dr12.8l", 0x10000, 0xc0b255fd, BRF_ESS | BRF_PRG }, // 3 - - { "dr00.3a", 0x04000, 0x458309f7, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code - { "dr01.3cd", 0x04000, 0xe66897bd, BRF_ESS | BRF_PRG }, // 5 - { "dr02.3f", 0x04000, 0xf9e31e26, BRF_ESS | BRF_PRG }, // 6 - - { "dr06.2b", 0x08000, 0x4d9a970f, BRF_GRA }, // 7 Tiles - { "dr07.2dc", 0x08000, 0xab59a4c4, BRF_GRA }, // 8 - { "dr05.2a", 0x08000, 0x2e6dad0c, BRF_GRA }, // 9 - - { "dr21.4k", 0x04000, 0xa06cea9a, BRF_GRA }, // 10 Sprites - { "dr19.4f", 0x04000, 0xb34605ad, BRF_GRA }, // 11 - { "dr22.4l", 0x04000, 0x41303de8, BRF_GRA }, // 12 - { "dr20.4jh", 0x04000, 0x5fbe6f61, BRF_GRA }, // 13 - { "dr14.3p", 0x04000, 0x76cfbcbc, BRF_GRA }, // 14 - { "dr24.4p", 0x04000, 0xd51c8db5, BRF_GRA }, // 15 - { "dr23.4nm", 0x04000, 0x03469df8, BRF_GRA }, // 16 - { "dr13.3nm", 0x04000, 0xd5c3dfe0, BRF_GRA }, // 17 - { "dr16.4cb", 0x04000, 0xf1d1bb93, BRF_GRA }, // 18 - { "dr18.4e", 0x04000, 0xedb7f25b, BRF_GRA }, // 19 - { "dr17.4dc", 0x04000, 0x4fb87868, BRF_GRA }, // 20 - { "dr15.4a", 0x04000, 0xe0b88de5, BRF_GRA }, // 21 - - { "dr08.4l", 0x04000, 0x32d50643, BRF_GRA }, // 22 Characters - { "dr09.4m", 0x04000, 0x17df6f95, BRF_GRA }, // 23 - { "dr10.4n", 0x04000, 0x820ce252, BRF_GRA }, // 24 - - { "dr25.3f", 0x00100, 0x8e91430b, BRF_GRA }, // 25 PROM (Tile Palette Red Component) - { "dr30.1m", 0x00100, 0x28c73263, BRF_GRA }, // 26 PROM (Sprite Palette Red Component) - { "dr26.3h", 0x00100, 0xb563b93f, BRF_GRA }, // 27 PROM (Tile Palette Green Component) - { "dr31.1n", 0x00100, 0x3529210e, BRF_GRA }, // 28 PROM (Sprite Palette Green Component) - { "dr27.3j", 0x00100, 0x70d668ef, BRF_GRA }, // 29 PROM (Tile Palette Blue Component) - { "dr29.1l", 0x00100, 0x1173a754, BRF_GRA }, // 30 PROM (Sprite Palette Blue Component) - { "dr32.5p", 0x00020, 0x11cd1f2e, BRF_GRA }, // 31 PROM (Sprite Height) - { "dr33.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 32 PROM (Video Timing) - { "dr28.8f", 0x00200, 0x6cef0fbd, BRF_OPT }, // 33 PROM (Unknown) -}; - -STD_ROM_PICK(Kidniki) -STD_ROM_FN(Kidniki) - -static struct BurnRomInfo KidnikiuRomDesc[] = { - { "dr04.4e", 0x04000, 0x80431858, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "dr03.4cd", 0x04000, 0xdba20934, BRF_ESS | BRF_PRG }, // 1 - { "dr11.8k", 0x08000, 0x04d82d93, BRF_ESS | BRF_PRG }, // 2 - { "dr12.8l", 0x10000, 0xc0b255fd, BRF_ESS | BRF_PRG }, // 3 - - { "dr00.3a", 0x04000, 0x458309f7, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code - { "dr01.3cd", 0x04000, 0xe66897bd, BRF_ESS | BRF_PRG }, // 5 - { "dr02.3f", 0x04000, 0xf9e31e26, BRF_ESS | BRF_PRG }, // 6 - - { "dr06.2b", 0x08000, 0x4d9a970f, BRF_GRA }, // 7 Tiles - { "dr07.2dc", 0x08000, 0xab59a4c4, BRF_GRA }, // 8 - { "dr05.2a", 0x08000, 0x2e6dad0c, BRF_GRA }, // 9 - - { "dr21.4k", 0x04000, 0xa06cea9a, BRF_GRA }, // 10 Sprites - { "dr19.4f", 0x04000, 0xb34605ad, BRF_GRA }, // 11 - { "dr22.4l", 0x04000, 0x41303de8, BRF_GRA }, // 12 - { "dr20.4jh", 0x04000, 0x5fbe6f61, BRF_GRA }, // 13 - { "dr14.3p", 0x04000, 0x76cfbcbc, BRF_GRA }, // 14 - { "dr24.4p", 0x04000, 0xd51c8db5, BRF_GRA }, // 15 - { "dr23.4nm", 0x04000, 0x03469df8, BRF_GRA }, // 16 - { "dr13.3nm", 0x04000, 0xd5c3dfe0, BRF_GRA }, // 17 - { "dr16.4cb", 0x04000, 0xf1d1bb93, BRF_GRA }, // 18 - { "dr18.4e", 0x04000, 0xedb7f25b, BRF_GRA }, // 19 - { "dr17.4dc", 0x04000, 0x4fb87868, BRF_GRA }, // 20 - { "dr15.4a", 0x04000, 0xe0b88de5, BRF_GRA }, // 21 - - { "dr08.4l", 0x04000, 0x32d50643, BRF_GRA }, // 22 Characters - { "dr09.4m", 0x04000, 0x17df6f95, BRF_GRA }, // 23 - { "dr10.4n", 0x04000, 0x820ce252, BRF_GRA }, // 24 - - { "dr25.3f", 0x00100, 0x8e91430b, BRF_GRA }, // 25 PROM (Tile Palette Red Component) - { "dr30.1m", 0x00100, 0x28c73263, BRF_GRA }, // 26 PROM (Sprite Palette Red Component) - { "dr26.3h", 0x00100, 0xb563b93f, BRF_GRA }, // 27 PROM (Tile Palette Green Component) - { "dr31.1n", 0x00100, 0x3529210e, BRF_GRA }, // 28 PROM (Sprite Palette Green Component) - { "dr27.3j", 0x00100, 0x70d668ef, BRF_GRA }, // 29 PROM (Tile Palette Blue Component) - { "dr29.1l", 0x00100, 0x1173a754, BRF_GRA }, // 30 PROM (Sprite Palette Blue Component) - { "dr32.5p", 0x00020, 0x11cd1f2e, BRF_GRA }, // 31 PROM (Sprite Height) - { "dr33.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 32 PROM (Video Timing) - { "dr28.8f", 0x00200, 0x6cef0fbd, BRF_OPT }, // 33 PROM (Unknown) -}; - -STD_ROM_PICK(Kidnikiu) -STD_ROM_FN(Kidnikiu) - -static struct BurnRomInfo YanchamrRomDesc[] = { - { "ky_a-4e-.bin", 0x04000, 0xc73ad2d6, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "ky_a-4d-.bin", 0x04000, 0x401af828, BRF_ESS | BRF_PRG }, // 1 - { "ky_t-8k-.bin", 0x08000, 0xe967de88, BRF_ESS | BRF_PRG }, // 2 - { "ky_t-8l-.bin", 0x08000, 0xa929110b, BRF_ESS | BRF_PRG }, // 3 - - { "ky_a-3a-.bin", 0x04000, 0xcb365f3b, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code - { "dr01.3cd", 0x04000, 0xe66897bd, BRF_ESS | BRF_PRG }, // 5 - { "dr02.3f", 0x04000, 0xf9e31e26, BRF_ESS | BRF_PRG }, // 6 - - { "ky_t-2c-.bin", 0x08000, 0xcb9761fc, BRF_GRA }, // 7 Tiles - { "ky_t-2d-.bin", 0x08000, 0x59732741, BRF_GRA }, // 8 - { "ky_t-2a-.bin", 0x08000, 0x0370fd82, BRF_GRA }, // 9 - - { "ky_b-4k-.bin", 0x04000, 0x263a9d10, BRF_GRA }, // 10 Sprites - { "ky_b-4f-.bin", 0x04000, 0x86e3d4a8, BRF_GRA }, // 11 - { "ky_b-4l-.bin", 0x04000, 0x19fa7558, BRF_GRA }, // 12 - { "ky_b-4h-.bin", 0x04000, 0x93e6665c, BRF_GRA }, // 13 - { "ky_b-3n-.bin", 0x04000, 0x0287c525, BRF_GRA }, // 14 - { "ky_b-4n-.bin", 0x04000, 0x764946e0, BRF_GRA }, // 15 - { "ky_b-4m-.bin", 0x04000, 0xeced5db9, BRF_GRA }, // 16 - { "ky_b-3m-.bin", 0x04000, 0xbe6cee44, BRF_GRA }, // 17 - { "ky_b-4c-.bin", 0x04000, 0x84d6b65d, BRF_GRA }, // 18 - { "ky_b-4e-.bin", 0x04000, 0xf91f9273, BRF_GRA }, // 19 - { "ky_b-4d-.bin", 0x04000, 0xa2fc15f0, BRF_GRA }, // 20 - { "ky_b-4a-.bin", 0x04000, 0xff2b9c8a, BRF_GRA }, // 21 - - { "ky_t-4l-.bin", 0x04000, 0x1d0a9253, BRF_GRA }, // 22 Characters - { "ky_t-4m-.bin", 0x04000, 0x4075c396, BRF_GRA }, // 23 - { "ky_t-4n-.bin", 0x04000, 0x7564f2ff, BRF_GRA }, // 24 - - { "dr25.3f", 0x00100, 0x8e91430b, BRF_GRA }, // 25 PROM (Tile Palette Red Component) - { "dr30.1m", 0x00100, 0x28c73263, BRF_GRA }, // 26 PROM (Sprite Palette Red Component) - { "dr26.3h", 0x00100, 0xb563b93f, BRF_GRA }, // 27 PROM (Tile Palette Green Component) - { "dr31.1n", 0x00100, 0x3529210e, BRF_GRA }, // 28 PROM (Sprite Palette Green Component) - { "dr27.3j", 0x00100, 0x70d668ef, BRF_GRA }, // 29 PROM (Tile Palette Blue Component) - { "dr29.1l", 0x00100, 0x1173a754, BRF_GRA }, // 30 PROM (Sprite Palette Blue Component) - { "dr32.5p", 0x00020, 0x11cd1f2e, BRF_GRA }, // 31 PROM (Sprite Height) - { "dr33.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 32 PROM (Video Timing) - { "dr28.8f", 0x00200, 0x6cef0fbd, BRF_OPT }, // 33 PROM (Unknown) -}; - -STD_ROM_PICK(Yanchamr) -STD_ROM_FN(Yanchamr) - -static struct BurnRomInfo LitheroRomDesc[] = { - { "4.bin", 0x08000, 0x80903766, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "11.bin", 0x08000, 0x7a1ef8cb, BRF_ESS | BRF_PRG }, // 1 - { "12.bin", 0x08000, 0xa929110b, BRF_ESS | BRF_PRG }, // 2 - - { "ky_a-3a-.bin", 0x04000, 0xcb365f3b, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code - { "dr01.3cd", 0x04000, 0xe66897bd, BRF_ESS | BRF_PRG }, // 4 - { "dr02.3f", 0x04000, 0xf9e31e26, BRF_ESS | BRF_PRG }, // 5 - - { "7.bin", 0x08000, 0xb55e8d19, BRF_GRA }, // 6 Tiles - { "6.bin", 0x08000, 0x7bbbb209, BRF_GRA }, // 7 - { "5.bin", 0x08000, 0x0370fd82, BRF_GRA }, // 8 - - { "16.bin", 0x08000, 0x5045a507, BRF_GRA }, // 9 Sprites - { "15.bin", 0x08000, 0x946b16a0, BRF_GRA }, // 10 - { "18.bin", 0x08000, 0x901b69ff, BRF_GRA }, // 11 - { "17.bin", 0x08000, 0x504eed93, BRF_GRA }, // 12 - { "14.bin", 0x08000, 0x429d760b, BRF_GRA }, // 13 - { "13.bin", 0x08000, 0x1700cd64, BRF_GRA }, // 14 - - { "8.bin", 0x04000, 0x4f388d63, BRF_GRA }, // 15 Characters - { "9.bin", 0x04000, 0xdaafa2c1, BRF_GRA }, // 16 - { "10.bin", 0x04000, 0x60649d19, BRF_GRA }, // 17 - - { "dr25.3f", 0x00100, 0x8e91430b, BRF_GRA }, // 18 PROM (Tile Palette Red Component) - { "dr30.1m", 0x00100, 0x28c73263, BRF_GRA }, // 19 PROM (Sprite Palette Red Component) - { "dr26.3h", 0x00100, 0xb563b93f, BRF_GRA }, // 20 PROM (Tile Palette Green Component) - { "dr31.1n", 0x00100, 0x3529210e, BRF_GRA }, // 21 PROM (Sprite Palette Green Component) - { "dr27.3j", 0x00100, 0x70d668ef, BRF_GRA }, // 22 PROM (Tile Palette Blue Component) - { "dr29.1l", 0x00100, 0x1173a754, BRF_GRA }, // 23 PROM (Sprite Palette Blue Component) - { "dr32.5p", 0x00020, 0x11cd1f2e, BRF_GRA }, // 24 PROM (Sprite Height) - { "dr33.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 25 PROM (Video Timing) - { "dr28.8f", 0x00200, 0x6cef0fbd, BRF_OPT }, // 26 PROM (Unknown) -}; - -STD_ROM_PICK(Lithero) -STD_ROM_FN(Lithero) - -static struct BurnRomInfo SpelunkrRomDesc[] = { - { "spra.4e", 0x04000, 0xcf811201, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "spra.4d", 0x04000, 0xbb4faa4f, BRF_ESS | BRF_PRG }, // 1 - { "sprm.7c", 0x04000, 0xfb6197e2, BRF_ESS | BRF_PRG }, // 2 - { "sprm.7b", 0x04000, 0x26bb25a4, BRF_ESS | BRF_PRG }, // 3 - - { "spra.3d", 0x04000, 0x4110363c, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code - { "spra.3f", 0x04000, 0x67a9d2e6, BRF_ESS | BRF_PRG }, // 5 - - { "sprm.1d", 0x04000, 0x4ef7ae89, BRF_GRA }, // 6 Tiles - { "sprm.1e", 0x04000, 0xa3755180, BRF_GRA }, // 7 - { "sprm.3c", 0x04000, 0xb4008e6a, BRF_GRA }, // 8 - { "sprm.3b", 0x04000, 0xf61cf012, BRF_GRA }, // 9 - { "sprm.1c", 0x04000, 0x58b21c76, BRF_GRA }, // 10 - { "sprm.1b", 0x04000, 0xa95cb3e5, BRF_GRA }, // 11 - - { "sprb.4k", 0x04000, 0xe7f0e861, BRF_GRA }, // 12 Sprites - { "sprb.4f", 0x04000, 0x32663097, BRF_GRA }, // 13 - { "sprb.3p", 0x04000, 0x8fbaf373, BRF_GRA }, // 14 - { "sprb.4p", 0x04000, 0x37069b76, BRF_GRA }, // 15 - { "sprb.4c", 0x04000, 0xcfe46a88, BRF_GRA }, // 16 - { "sprb.4e", 0x04000, 0x11c48979, BRF_GRA }, // 17 - - { "sprm.4p", 0x04000, 0x4dfe2e63, BRF_GRA }, // 18 Characters - { "sprm.4l", 0x04000, 0x239f2cd4, BRF_GRA }, // 19 - { "sprm.4m", 0x04000, 0xd6d07d70, BRF_GRA }, // 20 - - { "sprm.2k", 0x00100, 0xfd8fa991, BRF_GRA }, // 21 PROM (Tile Palette Red Component) - { "sprb.1m", 0x00100, 0x8d8cccad, BRF_GRA }, // 22 PROM (Sprite Palette Red Component) - { "sprm.2j", 0x00100, 0x0e3890b4, BRF_GRA }, // 23 PROM (Tile Palette Green Component) - { "sprb.1n", 0x00100, 0xc40e1cb2, BRF_GRA }, // 24 PROM (Sprite Palette Green Component) - { "sprm.2h", 0x00100, 0x0478082b, BRF_GRA }, // 25 PROM (Tile Palette Blue Component) - { "sprb.1l", 0x00100, 0x3ec46248, BRF_GRA }, // 26 PROM (Sprite Palette Blue Component) - { "sprb.5p", 0x00020, 0x746c6238, BRF_GRA }, // 27 PROM (Sprite Height) - { "sprb.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 28 PROM (Video Timing) - { "sprm.8h", 0x00200, 0x875cc442, BRF_OPT }, // 29 PROM (Unknown) -}; - -STD_ROM_PICK(Spelunkr) -STD_ROM_FN(Spelunkr) - -static struct BurnRomInfo SpelunkrjRomDesc[] = { - { "spr_a4ec.bin", 0x04000, 0x4e94a80c, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "spr_a4dd.bin", 0x04000, 0xe7c0cbce, BRF_ESS | BRF_PRG }, // 1 - { "spr_m7cc.bin", 0x04000, 0x57598a36, BRF_ESS | BRF_PRG }, // 2 - { "spr_m7bd.bin", 0x04000, 0xecf5137f, BRF_ESS | BRF_PRG }, // 3 - - { "spra.3d", 0x04000, 0x4110363c, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code - { "spra.3f", 0x04000, 0x67a9d2e6, BRF_ESS | BRF_PRG }, // 5 - - { "sprm.1d", 0x04000, 0x4ef7ae89, BRF_GRA }, // 6 Tiles - { "sprm.1e", 0x04000, 0xa3755180, BRF_GRA }, // 7 - { "sprm.3c", 0x04000, 0xb4008e6a, BRF_GRA }, // 8 - { "sprm.3b", 0x04000, 0xf61cf012, BRF_GRA }, // 9 - { "sprm.1c", 0x04000, 0x58b21c76, BRF_GRA }, // 10 - { "sprm.1b", 0x04000, 0xa95cb3e5, BRF_GRA }, // 11 - - { "sprb.4k", 0x04000, 0xe7f0e861, BRF_GRA }, // 12 Sprites - { "sprb.4f", 0x04000, 0x32663097, BRF_GRA }, // 13 - { "sprb.3p", 0x04000, 0x8fbaf373, BRF_GRA }, // 14 - { "sprb.4p", 0x04000, 0x37069b76, BRF_GRA }, // 15 - { "sprb.4c", 0x04000, 0xcfe46a88, BRF_GRA }, // 16 - { "sprb.4e", 0x04000, 0x11c48979, BRF_GRA }, // 17 - - { "sprm.4p", 0x04000, 0x4dfe2e63, BRF_GRA }, // 18 Characters - { "sprm.4l", 0x04000, 0x239f2cd4, BRF_GRA }, // 19 - { "sprm.4m", 0x04000, 0xd6d07d70, BRF_GRA }, // 20 - - { "sprm.2k", 0x00100, 0xfd8fa991, BRF_GRA }, // 21 PROM (Tile Palette Red Component) - { "sprb.1m", 0x00100, 0x8d8cccad, BRF_GRA }, // 22 PROM (Sprite Palette Red Component) - { "sprm.2j", 0x00100, 0x0e3890b4, BRF_GRA }, // 23 PROM (Tile Palette Green Component) - { "sprb.1n", 0x00100, 0xc40e1cb2, BRF_GRA }, // 24 PROM (Sprite Palette Green Component) - { "sprm.2h", 0x00100, 0x0478082b, BRF_GRA }, // 25 PROM (Tile Palette Blue Component) - { "sprb.1l", 0x00100, 0x3ec46248, BRF_GRA }, // 26 PROM (Sprite Palette Blue Component) - { "sprb.5p", 0x00020, 0x746c6238, BRF_GRA }, // 27 PROM (Sprite Height) - { "sprb.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 28 PROM (Video Timing) - { "sprm.8h", 0x00200, 0x875cc442, BRF_OPT }, // 29 PROM (Unknown) -}; - -STD_ROM_PICK(Spelunkrj) -STD_ROM_FN(Spelunkrj) - -static struct BurnRomInfo Spelunk2RomDesc[] = { - { "sp2-a.4e", 0x04000, 0x96c04bbb, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "sp2-a.4d", 0x04000, 0xcb38c2ff, BRF_ESS | BRF_PRG }, // 1 - { "sp2-r.7d", 0x08000, 0x558837ea, BRF_ESS | BRF_PRG }, // 2 - { "sp2-r.7c", 0x08000, 0x4b380162, BRF_ESS | BRF_PRG }, // 3 - { "sp2-r.7b", 0x04000, 0x7709a1fe, BRF_ESS | BRF_PRG }, // 4 - - { "sp2-a.3d", 0x04000, 0x839ec7e2, BRF_ESS | BRF_PRG }, // 5 M6803 Program Code - { "sp2-a.3f", 0x04000, 0xad3ce898, BRF_ESS | BRF_PRG }, // 6 - - { "sp2-r.1d", 0x08000, 0xc19fa4c9, BRF_GRA }, // 7 Tiles - { "sp2-r.3b", 0x08000, 0x366604af, BRF_GRA }, // 8 - { "sp2-r.1b", 0x08000, 0x3a0c4d47, BRF_GRA }, // 9 - - { "sp2-b.4k", 0x04000, 0x6cb67a17, BRF_GRA }, // 10 Sprites - { "sp2-b.4f", 0x04000, 0xe4a1166f, BRF_GRA }, // 11 - { "sp2-b.3n", 0x04000, 0xf59e8b76, BRF_GRA }, // 12 - { "sp2-b.4n", 0x04000, 0xfa65bac9, BRF_GRA }, // 13 - { "sp2-b.4c", 0x04000, 0x1caf7013, BRF_GRA }, // 14 - { "sp2-b.4e", 0x04000, 0x780a463b, BRF_GRA }, // 15 - - { "sp2-r.4l", 0x04000, 0x6a4b2d8b, BRF_GRA }, // 16 Characters - { "sp2-r.4m", 0x04000, 0xe1368b61, BRF_GRA }, // 17 - { "sp2-r.4p", 0x04000, 0xfc138e13, BRF_GRA }, // 18 - - { "sp2-r.1k", 0x00200, 0x31c1bcdc, BRF_GRA }, // 19 PROM (Char Palette Red and Green Component) - { "sp2-r.2k", 0x00100, 0x1cf5987e, BRF_GRA }, // 20 PROM (Char Palette Blue Component) - { "sp2-r.2j", 0x00100, 0x1acbe2a5, BRF_GRA }, // 21 PROM (Char Palette Blue Component) - { "sp2-b.1m", 0x00100, 0x906104c7, BRF_GRA }, // 22 PROM (Sprite Palette Red Component) - { "sp2-b.1n", 0x00100, 0x5a564c06, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) - { "sp2-b.1l", 0x00100, 0x8f4a2e3c, BRF_GRA }, // 24 PROM (Sprite Palette Blue Component) - { "sp2-b.5p", 0x00020, 0xcd126f6a, BRF_GRA }, // 25 PROM (Sprite Height) - { "sp2-b.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 26 PROM (Video Timing) - { "sp2-r.8j", 0x00200, 0x875cc442, BRF_OPT }, // 27 PROM (Unknown) - - { "ampal16r4a-sp2-r-3h.bin", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, // 28 PAL -}; - -STD_ROM_PICK(Spelunk2) -STD_ROM_FN(Spelunk2) - -static struct BurnRomInfo YoujyudnRomDesc[] = { - { "yju_a4eb.bin", 0x04000, 0x0d356bdc, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "yju_a4db.bin", 0x04000, 0xc169be13, BRF_ESS | BRF_PRG }, // 1 - { "yju_p4cb.0", 0x04000, 0x60baf3b1, BRF_ESS | BRF_PRG }, // 2 - { "yju_p4eb.1", 0x04000, 0x8d0521f8, BRF_ESS | BRF_PRG }, // 3 - - { "yju_a3fb.bin", 0x04000, 0xe15c8030, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code - - { "yju_p3bb.0", 0x08000, 0xc017913c, BRF_GRA }, // 5 Tiles - { "yju_p1bb.1", 0x08000, 0x94627523, BRF_GRA }, // 6 - { "yju_p1cb.2", 0x08000, 0x6a378c56, BRF_GRA }, // 7 - - { "yju_b4ka.00", 0x04000, 0x1bbb864a, BRF_GRA }, // 8 Sprites - { "yju_b4fa.01", 0x04000, 0x14b4dd24, BRF_GRA }, // 9 - { "yju_b3na.10", 0x04000, 0x68879321, BRF_GRA }, // 10 - { "yju_b4na.11", 0x04000, 0x2860a68b, BRF_GRA }, // 11 - { "yju_b4ca.20", 0x04000, 0xab365829, BRF_GRA }, // 12 - { "yju_b4ea.21", 0x04000, 0xb36c31e4, BRF_GRA }, // 13 - - { "yju_p4lb.2", 0x04000, 0x87878d9b, BRF_GRA }, // 14 Characters - { "yju_p4mb.1", 0x04000, 0x1e1a0d09, BRF_GRA }, // 15 - { "yju_p4pb.0", 0x04000, 0xb4ab520b, BRF_GRA }, // 16 - - { "yju_p2jb.bpr", 0x00100, 0xa4483631, BRF_GRA }, // 17 PROM (Tile Palette Red Component) - { "yju_b1ma.r", 0x00100, 0xa8340e13, BRF_GRA }, // 18 PROM (Sprite Palette Red Component) - { "yju_p2kb.bpr", 0x00100, 0x85481103, BRF_GRA }, // 19 PROM (Tile Palette Green Component) - { "yju_b1na.g", 0x00100, 0xf5b4bc41, BRF_GRA }, // 20 PROM (Sprite Palette Green Component) - { "yju_p2hb.bpr", 0x00100, 0xa6fd355c, BRF_GRA }, // 21 PROM (Tile Palette Blue Component) - { "yju_b1la.b", 0x00100, 0x45e10491, BRF_GRA }, // 22 PROM (Sprite Palette Blue Component) - { "yju_b-5p.bpr", 0x00020, 0x2095e6a3, BRF_GRA }, // 23 PROM (Sprite Height) - { "yju_b-6f.bpr", 0x00100, 0x82c20d12, BRF_GRA }, // 24 PROM (Video Timing) - { "yju_p-8d.bpr", 0x00200, 0x6cef0fbd, BRF_OPT }, // 25 PROM (Unknown) - - { "yju_b-pal16r4a-8m.pal", 0x00104, 0x3ece8e61, BRF_OPT }, // 26 PAL -}; - -STD_ROM_PICK(Youjyudn) -STD_ROM_FN(Youjyudn) - -static struct BurnRomInfo HorizonRomDesc[] = { - { "hrza-4e", 0x04000, 0x98b96ba2, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "hrza-4d", 0x04000, 0x06b06ac7, BRF_ESS | BRF_PRG }, // 1 - { "hrza-4b", 0x04000, 0x39c0bd02, BRF_ESS | BRF_PRG }, // 2 - - { "hrza-3f", 0x04000, 0x7412c99f, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code - - { "hrzd-4d", 0x02000, 0xb93ed581, BRF_GRA }, // 4 Tiles - { "hrzd-4c", 0x02000, 0x1cf73b53, BRF_GRA }, // 5 - { "hrzd-4a", 0x02000, 0xeace8d53, BRF_GRA }, // 6 - - { "hrzb-4k.00", 0x04000, 0x11d2f3a1, BRF_GRA }, // 7 Sprites - { "hrzb-4f.01", 0x04000, 0x356902ea, BRF_GRA }, // 8 - { "hrzb-3n.10", 0x04000, 0x87078a02, BRF_GRA }, // 9 - { "hrzb-4n.11", 0x04000, 0x5019cb1f, BRF_GRA }, // 10 - { "hrzb-4c.20", 0x04000, 0x90b385e7, BRF_GRA }, // 11 - { "hrzb-4e.21", 0x04000, 0xd05d77a2, BRF_GRA }, // 12 - - { "hrzd-1d", 0x00100, 0xb33b08f9, BRF_GRA }, // 13 PROM (Tile Palette Red Component) - { "hrzb-1m.r", 0x00100, 0x0871690a, BRF_GRA }, // 14 PROM (Sprite Palette Red Component) - { "hrzd-1c", 0x00100, 0x6e696f3a, BRF_GRA }, // 15 PROM (Tile Palette Green Component) - { "hrzb-1n.g", 0x00100, 0xf247d0a9, BRF_GRA }, // 16 PROM (Sprite Palette Green Component) - { "hrzd-1e", 0x00100, 0x1fa60379, BRF_GRA }, // 17 PROM (Tile Palette Blue Component) - { "hrzb-1l.b", 0x00100, 0x9ad0a0c8, BRF_GRA }, // 18 PROM (Sprite Palette Blue Component) - { "hrzb-5p", 0x00020, 0x208b49e9, BRF_GRA }, // 19 PROM (Sprite Height) - { "hrzb-6f", 0x00100, 0x82c20d12, BRF_GRA }, // 20 PROM (Video Timing) -}; - -STD_ROM_PICK(Horizon) -STD_ROM_FN(Horizon) - -static INT32 M62MemIndex() -{ - UINT8 *Next; Next = Mem; - - if (!M62BgxTileDim) M62BgxTileDim = 8; - if (!M62BgyTileDim) M62BgyTileDim = 8; - if (!M62CharxTileDim) M62CharxTileDim = 8; - if (!M62CharyTileDim) M62CharyTileDim = 8; - if (!M62SpriteRamSize) M62SpriteRamSize = 0x100; - - M62Z80Rom = Next; Next += M62Z80RomSize; - M62M6803Rom = Next; Next += 0x0c000; - - RamStart = Next; - - M62SpriteRam = Next; Next += M62SpriteRamSize; - M62TileRam = Next; Next += 0x02000; - if (M62CharRamSize) M62CharRam = Next; Next += M62CharRamSize; - if (M62ScrollRamSize) M62ScrollRam = Next; Next += M62ScrollRamSize; - M62Z80Ram = Next; Next += 0x01000; - M62M6803Ram = Next; Next += 0x00080; - - RamEnd = Next; - - M62Tiles = Next; Next += M62NumTiles * M62BgxTileDim * M62BgyTileDim; - M62Sprites = Next; Next += M62NumSprites * 16 * 16; - if (M62NumChars) M62Chars = Next; Next += M62NumChars * M62CharxTileDim * M62CharyTileDim; - M62Palette = (UINT32*)Next; Next += M62PaletteEntries * sizeof(UINT32); - M62PromData = Next; Next += M62PromSize; - pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static INT32 M62DoReset() -{ - ZetOpen(0); - ZetReset(); - ZetClose(); - - M6803Reset(); - - AY8910Reset(0); - AY8910Reset(1); - - MSM5205Reset(); - - M62BackgroundHScroll = 0; - M62BackgroundVScroll = 0; - M62CharHScroll = 0; - M62CharVScroll = 0; - M62FlipScreen = 0; - M62SoundLatch = 0; - M62Port1 = 0; - M62Port2 = 0; - M62SlaveMSM5205VClckReset = 0; - M62BankControl[0] = M62BankControl[1] = 0; - Ldrun2BankSwap = 0; - Ldrun3TopBottomMask = 0; - KidnikiBackgroundBank = 0; - SpelunkrPaletteBank = 0; - - return 0; -} - -UINT8 __fastcall M62Z80Read(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall M62Z80Write(UINT16 a, UINT8 d) -{ - if (a <= 0xbfff) return; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall KungfumZ80Read(UINT16 a) -{ - switch (a) { - case 0xf000: - case 0xf001: - case 0xf002: - case 0xf003: { - // ??? - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall KungfumZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xa000: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; - return; - } - - case 0xb000: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Ldrun3Z80Read(UINT16 a) -{ - switch (a) { - case 0xc800: { - return 0x05; - } - - case 0xcc00: { - return 0x07; - } - - case 0xcfff: { - return 0x07; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall Ldrun4Z80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xc800: { - INT32 BankAddress = 0x8000 + ((d & 0x01) * 0x4000); - ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + BankAddress); - ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + BankAddress); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall SpelunkrZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xd000: { - M62BackgroundVScroll = (M62BackgroundVScroll & 0xff00) | d; - return; - } - - case 0xd001: { - M62BackgroundVScroll = (M62BackgroundVScroll & 0x00ff) | (d << 8); - return; - } - - case 0xd002: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; - return; - } - - case 0xd003: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); - return; - } - - case 0xd004: { - INT32 BankAddress = 0x8000 + ((d & 0x03) * 0x2000); - ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + BankAddress); - ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + BankAddress); - return; - } - - case 0xd005: { - SpelunkrPaletteBank = d & 0x01; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall Spelunk2Z80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xd000: { - M62BackgroundVScroll = (M62BackgroundVScroll & 0xff00) | d; - return; - } - - case 0xd001: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; - return; - } - - case 0xd002: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (((d & 0x02) >> 1) << 8); - M62BackgroundVScroll = (M62BackgroundVScroll & 0x00ff) | ((d & 0x01) << 8); - SpelunkrPaletteBank = (d & 0x0c) >> 2; - return; - } - - case 0xd003: { - INT32 BankAddress1 = 0x18000 + (((d & 0xc0) >> 6) * 0x1000); - INT32 BankAddress2 = 0x08000 + (((d & 0x3c) >> 2) * 0x1000); - ZetMapArea(0x8000, 0x8fff, 0, M62Z80Rom + BankAddress1); - ZetMapArea(0x8000, 0x8fff, 2, M62Z80Rom + BankAddress1); - ZetMapArea(0x9000, 0x9fff, 0, M62Z80Rom + BankAddress2); - ZetMapArea(0x9000, 0x9fff, 2, M62Z80Rom + BankAddress2); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall M62Z80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return 0xff - M62Input[0]; - } - - case 0x01: { - return 0xff - M62Input[1]; - } - - case 0x02: { - return 0xff - M62Input[2]; - } - - case 0x03: { - return M62Dip[0]; - } - - case 0x04: { - return M62Dip[1]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall M62Z80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - if ((d & 0x80) == 0) { - M62SoundLatch = d & 0x7f; - } else { - M6803SetIRQLine(M6803_IRQ_LINE, M6803_IRQSTATUS_ACK); - } - return; - } - - case 0x01: { - d ^= ~M62Dip[1] & 0x01; - M62FlipScreen = d & 0x01; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall BattroadZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - if (a <= 0x01) { - M62Z80PortWrite(a, d); - return; - } - - switch (a) { - case 0x80: { - M62BackgroundVScroll = (M62BackgroundVScroll & 0xff00) | d; - return; - } - - case 0x81: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); - return; - } - - case 0x82: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; - return; - } - - case 0x83: { - INT32 BankAddress = 0x8000 + ((d & 0x0f) * 0x2000); - ZetMapArea(0xa000, 0xbfff, 0, M62Z80Rom + BankAddress); - ZetMapArea(0xa000, 0xbfff, 2, M62Z80Rom + BankAddress); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Ldrun2Z80PortRead(UINT16 a) -{ - a &= 0xff; - - if (a <= 0x04) return M62Z80PortRead(a); - - switch (a) { - case 0x80: { - if (Ldrun2BankSwap) { - Ldrun2BankSwap--; - if (Ldrun2BankSwap == 0) { - ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + 0xa000); - ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + 0xa000); - } - } - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall Ldrun2Z80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - if (a <= 0x01) { - M62Z80PortWrite(a, d); - return; - } - - switch (a) { - case 0x80: - case 0x81: { - static const INT32 Banks[30] = { 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 }; - INT32 Offset = a - 0x80; - - M62BankControl[Offset] = d; - - if (Offset == 0x00) { - if (d >= 1 && d <= 30) { - INT32 BankAddress = 0x8000 + (Banks[d - 1] * 0x2000); - ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + BankAddress); - ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + BankAddress); - } - } else { - if (M62BankControl[0] == 0x01 && d == 0x0d) { - Ldrun2BankSwap = 2; - } else { - Ldrun2BankSwap = 0; - } - } - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall Ldrun3Z80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - if (a <= 0x01) { - M62Z80PortWrite(a, d); - return; - } - - switch (a) { - case 0x80: { - M62BackgroundVScroll = (M62BackgroundVScroll & 0xff00) | d; - return; - } - - case 0x81: { - Ldrun3TopBottomMask = d & 0x01; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall Ldrun4Z80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - if (a <= 0x01) { - M62Z80PortWrite(a, d); - return; - } - - switch (a) { - case 0x80: { - // ??? - return; - } - - case 0x81: { - // ??? - return; - } - - case 0x82: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); - return; - } - - case 0x83: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall KidnikiZ80PortRead(UINT16 a) -{ - a &= 0xff; - - if (a <= 0x04) return M62Z80PortRead(a); - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall KidnikiZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - if (a <= 0x01) { - M62Z80PortWrite(a, d); - return; - } - - switch (a) { - case 0x80: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; - return; - } - - case 0x81: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); - return; - } - - case 0x82: { - M62CharVScroll = (M62CharVScroll & 0xff00) | d; - return; - } - - case 0x83: { - M62CharVScroll = (M62CharVScroll & 0x00ff) | (d << 8); - return; - } - - case 0x84: { - KidnikiBackgroundBank = d & 0x01; - return; - } - - case 0x85: { - INT32 BankAddress = 0x8000 + ((d & 0x0f) * 0x2000); - ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + BankAddress); - ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + BankAddress); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall YoujyudnZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - if (a <= 0x01) { - M62Z80PortWrite(a, d); - return; - } - - switch (a) { - case 0x80: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); - return; - } - - case 0x81: { - M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; - return; - } - - case 0x83: { - INT32 BankAddress = 0x8000 + ((d & 0x01) * 0x4000); - ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + BankAddress); - ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + BankAddress); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 M62M6803ReadByte(UINT16 a) -{ - if (a <= 0x001f) { - return m6803_internal_registers_r(a); - } - - if (a >= 0x0080 && a <= 0x00ff) { - return M62M6803Ram[a - 0x0080]; - } - - bprintf(PRINT_NORMAL, _T("M6803 Read Byte -> %04X\n"), a); - - return 0; -} - -void M62M6803WriteByte(UINT16 a, UINT8 d) -{ - if (a <= 0x001f) { - m6803_internal_registers_w(a, d); - return; - } - - if (a >= 0x0080 && a <= 0x00ff) { - M62M6803Ram[a - 0x0080] = d; - return; - } - - switch (a) { - case 0x0800: { - M6803SetIRQLine(M6803_IRQ_LINE, M6803_IRQSTATUS_NONE); - return; - } - - case 0x0801: { - MSM5205DataWrite(0, d); - return; - } - - case 0x0802: { - MSM5205DataWrite(1, d); - return; - } - } - - bprintf(PRINT_NORMAL, _T("M6803 Write Byte -> %04X, %02X\n"), a, d); -} - -UINT8 M62M6803ReadPort(UINT16 a) -{ - switch (a) { - case M6803_PORT1: { - if (M62Port2 & 0x08) return AY8910Read(0); - if (M62Port2 & 0x10) return AY8910Read(1); - return 0xff; - } - - case M6803_PORT2: { - return 0; - } - } - - bprintf(PRINT_NORMAL, _T("M6803 Read Port -> %04X\n"), a); - - return 0; -} - -void M62M6803WritePort(UINT16 a, UINT8 d) -{ - switch (a) { - case M6803_PORT1: { - M62Port1 = d; - return; - } - - case M6803_PORT2: { - if ((M62Port2 & 0x01) && !(d & 0x01)) { - if (M62Port2 & 0x04) { - if (M62Port2 & 0x08) { - AY8910Write(0, 0, M62Port1); - } - if (M62Port2 & 0x10) { - AY8910Write(1, 0, M62Port1); - } - } else { - if (M62Port2 & 0x08) { - AY8910Write(0, 1, M62Port1); - } - if (M62Port2 & 0x10) { - AY8910Write(1, 1, M62Port1); - } - } - } - - M62Port2 = d; - return; - } - } - - bprintf(PRINT_NORMAL, _T("M6803 Write Port -> %04X, %02X\n"), a, d); -} - -static INT32 Tile1024PlaneOffsets[3] = { 0x20000, 0x10000, 0 }; -static INT32 Tile2048PlaneOffsets[3] = { 0x40000, 0x20000, 0 }; -static INT32 Tile4096PlaneOffsets[3] = { 0x80000, 0x40000, 0 }; -static INT32 TileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 TileYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 KungfumSpritePlaneOffsets[3] = { 0x80000, 0x40000, 0 }; -static INT32 BattroadSpritePlaneOffsets[3] = { 0x40000, 0x20000, 0 }; -static INT32 LdrunSpritePlaneOffsets[3] = { 0x20000, 0x10000, 0 }; -static INT32 KidnikiSpritePlaneOffsets[3] = { 0x100000, 0x80000, 0 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; -static INT32 BattroadCharPlaneOffsets[2] = { 0, 0x10000 }; -static INT32 LotlotPlaneOffsets[3] = { 0, 0x10000, 0x20000 }; -static INT32 LotlotXOffsets[12] = { 0, 1, 2, 3, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 LotlotYOffsets[10] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72 }; -static INT32 KidnikiPlaneOffsets[3] = { 0, 0x20000, 0x40000 }; -static INT32 KidnikiXOffsets[12] = { 0, 1, 2, 3, 64, 65, 66, 67, 68, 69, 70, 71 }; -static INT32 KidnikiYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 Spelunk2PlaneOffsets[3] = { 0, 0x20000, 0x40000 }; -static INT32 Spelunk2XOffsets[12] = { 0, 1, 2, 3, 0x10000, 0x10001, 0x10002, 0x10003, 0x10004, 0x10005, 0x10006, 0x10007 }; -static INT32 Spelunk2YOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 YoujyudnTilePlaneOffsets[3] = { 0x40000, 0x20000, 0 }; -static INT32 YoujyudnTileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 YoujyudnTileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; - -UINT8 M62SoundLatchRead(UINT32) -{ - return M62SoundLatch; -} - -static void AY8910_0PortBWrite(UINT32, UINT32 d) -{ - MSM5205PlaymodeWrite(0, (d >> 2) & 0x07); - MSM5205PlaymodeWrite(1, ((d >> 2) & 0x04) | 0x03); - - MSM5205ResetWrite(0, d & 0x01); - MSM5205ResetWrite(1, d & 0x02); -} - -inline static INT32 M62SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)((double)ZetTotalCycles() * nSoundRate / M62Z80Clock); -} - -static void M62MSM5205Vck0() -{ - M6803SetIRQLine(M6803_INPUT_LINE_NMI, M6803_IRQSTATUS_AUTO); - M62SlaveMSM5205VClckReset = 1; -} - -static INT32 M62MemInit() -{ - INT32 nLen; - - M62PaletteEntries = BurnDrvGetPaletteEntries(); - - Mem = NULL; - M62MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - M62MemIndex(); - - return 0; -} - -static INT32 KungfumLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x06000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 7, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x06000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0a000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0c000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0e000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x12000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x14000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x16000, 19, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 27, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 KungfumdLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x04000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 3, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 6, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0c000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x14000, 12, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 20, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 Kungfub3LoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x06000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 7, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0c000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x14000, 13, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 21, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 BattroadLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x0c000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x02000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x06000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x08000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x0a000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x0c000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x0e000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x10000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x14000, 9, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x06000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 12, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x0c000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 15, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x0c000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x06000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0a000, 21, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, BattroadSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load and decode the chars - memset(M62TempRom, 0, 0x0c000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 23, 1); if (nRet != 0) return 1; - GfxDecode(M62NumChars, 2, M62CharxTileDim, M62CharyTileDim, BattroadCharPlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Chars); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 27, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 28, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 29, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 30, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 31, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00720, 32, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 LdrunLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x06000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x02000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x06000, 3, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 5, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x06000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 8, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x06000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 11, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, LdrunSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 19, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 Ldrun2LoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x0c000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x02000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x06000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x08000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x0a000, 5, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x06000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 8, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x0c000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 11, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x0c000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x06000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0a000, 17, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, BattroadSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 25, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 Ldrun3LoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x04000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 7, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile2048PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0c000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x14000, 13, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 21, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 Ldrun3jLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x0c000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x04000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x0c000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 7, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile2048PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x0c000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 10, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, BattroadSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 18, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 LotlotLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x06000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 2, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x06000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 5, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, LotlotPlaneOffsets, LotlotXOffsets, LotlotYOffsets, 0x100, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x06000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 8, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, LdrunSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load and decode the chars - memset(M62TempRom, 0, 0x06000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 11, 1); if (nRet != 0) return 1; - GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, LotlotPlaneOffsets, LotlotXOffsets, LotlotYOffsets, 0x100, M62TempRom, M62Chars); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00700, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00800, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00900, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00920, 22, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 KidnikiLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x30000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x10000, 3, 1); if (nRet != 0) return 1; - memcpy(M62Z80Rom + 0x20000, M62Z80Rom + 0x18000, 0x8000); - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x00000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x04000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 6, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x30000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 9, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile4096PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x30000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0c000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x14000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x18000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x1c000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x20000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x24000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x28000, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x2c000, 21, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, KidnikiSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load and decode the chars - memset(M62TempRom, 0, 0x30000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 24, 1); if (nRet != 0) return 1; - GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, KidnikiPlaneOffsets, KidnikiXOffsets, KidnikiYOffsets, 0x80, M62TempRom, M62Chars); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 27, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 28, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 29, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 30, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 31, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 32, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 LitheroLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x30000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x08000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x10000, 2, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x04000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 5, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x30000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 8, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile4096PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x30000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x18000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x20000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x28000, 14, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, KidnikiSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load and decode the chars - memset(M62TempRom, 0, 0x30000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 17, 1); if (nRet != 0) return 1; - GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, KidnikiPlaneOffsets, KidnikiXOffsets, KidnikiYOffsets, 0x80, M62TempRom, M62Chars); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 25, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 SpelunkrLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x0c000, 3, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x04000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 5, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0c000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x14000, 11, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile4096PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0c000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x14000, 17, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load and decode the chars - memset(M62TempRom, 0, 0x18000); - UINT8 *pTemp = (UINT8*)BurnMalloc(0x18000); - nRet = BurnLoadRom(pTemp + 0x00000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(pTemp + 0x04000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(pTemp + 0x08000, 20, 1); if (nRet != 0) return 1; - memcpy(M62TempRom + 0x0000, pTemp + 0x0000, 0x800); - memcpy(M62TempRom + 0x2000, pTemp + 0x0800, 0x800); - memcpy(M62TempRom + 0x0800, pTemp + 0x1000, 0x800); - memcpy(M62TempRom + 0x2800, pTemp + 0x1800, 0x800); - memcpy(M62TempRom + 0x1000, pTemp + 0x2000, 0x800); - memcpy(M62TempRom + 0x3000, pTemp + 0x2800, 0x800); - memcpy(M62TempRom + 0x0800, pTemp + 0x3000, 0x800); - memcpy(M62TempRom + 0x3800, pTemp + 0x3800, 0x800); - memcpy(M62TempRom + 0x4000, pTemp + 0x4000, 0x800); - memcpy(M62TempRom + 0x6000, pTemp + 0x4800, 0x800); - memcpy(M62TempRom + 0x4800, pTemp + 0x5000, 0x800); - memcpy(M62TempRom + 0x6800, pTemp + 0x5800, 0x800); - memcpy(M62TempRom + 0x5000, pTemp + 0x6000, 0x800); - memcpy(M62TempRom + 0x7000, pTemp + 0x6800, 0x800); - memcpy(M62TempRom + 0x5800, pTemp + 0x7000, 0x800); - memcpy(M62TempRom + 0x7800, pTemp + 0x7800, 0x800); - memcpy(M62TempRom + 0x8000, pTemp + 0x8000, 0x800); - memcpy(M62TempRom + 0xa000, pTemp + 0x8800, 0x800); - memcpy(M62TempRom + 0x8800, pTemp + 0x9000, 0x800); - memcpy(M62TempRom + 0xa800, pTemp + 0x9800, 0x800); - memcpy(M62TempRom + 0x9000, pTemp + 0xa000, 0x800); - memcpy(M62TempRom + 0xb000, pTemp + 0xa800, 0x800); - memcpy(M62TempRom + 0x9800, pTemp + 0xb000, 0x800); - memcpy(M62TempRom + 0xb800, pTemp + 0xb800, 0x800); - BurnFree(pTemp); - GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, Spelunk2PlaneOffsets, Spelunk2XOffsets, Spelunk2YOffsets, 0x40, M62TempRom, M62Chars); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 27, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 28, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 Spelunk2LoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x10000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x18000, 4, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x04000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 6, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 9, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile4096PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0c000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x14000, 15, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load and decode the chars - memset(M62TempRom, 0, 0x18000); - UINT8 *pTemp = (UINT8*)BurnMalloc(0x18000); - nRet = BurnLoadRom(pTemp + 0x00000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(pTemp + 0x04000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(pTemp + 0x08000, 18, 1); if (nRet != 0) return 1; - memcpy(M62TempRom + 0x0000, pTemp + 0x0000, 0x800); - memcpy(M62TempRom + 0x2000, pTemp + 0x0800, 0x800); - memcpy(M62TempRom + 0x0800, pTemp + 0x1000, 0x800); - memcpy(M62TempRom + 0x2800, pTemp + 0x1800, 0x800); - memcpy(M62TempRom + 0x1000, pTemp + 0x2000, 0x800); - memcpy(M62TempRom + 0x3000, pTemp + 0x2800, 0x800); - memcpy(M62TempRom + 0x0800, pTemp + 0x3000, 0x800); - memcpy(M62TempRom + 0x3800, pTemp + 0x3800, 0x800); - memcpy(M62TempRom + 0x4000, pTemp + 0x4000, 0x800); - memcpy(M62TempRom + 0x6000, pTemp + 0x4800, 0x800); - memcpy(M62TempRom + 0x4800, pTemp + 0x5000, 0x800); - memcpy(M62TempRom + 0x6800, pTemp + 0x5800, 0x800); - memcpy(M62TempRom + 0x5000, pTemp + 0x6000, 0x800); - memcpy(M62TempRom + 0x7000, pTemp + 0x6800, 0x800); - memcpy(M62TempRom + 0x5800, pTemp + 0x7000, 0x800); - memcpy(M62TempRom + 0x7800, pTemp + 0x7800, 0x800); - memcpy(M62TempRom + 0x8000, pTemp + 0x8000, 0x800); - memcpy(M62TempRom + 0xa000, pTemp + 0x8800, 0x800); - memcpy(M62TempRom + 0x8800, pTemp + 0x9000, 0x800); - memcpy(M62TempRom + 0xa800, pTemp + 0x9800, 0x800); - memcpy(M62TempRom + 0x9000, pTemp + 0xa000, 0x800); - memcpy(M62TempRom + 0xb000, pTemp + 0xa800, 0x800); - memcpy(M62TempRom + 0x9800, pTemp + 0xb000, 0x800); - memcpy(M62TempRom + 0xb800, pTemp + 0xb800, 0x800); - BurnFree(pTemp); - GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, Spelunk2PlaneOffsets, Spelunk2XOffsets, Spelunk2YOffsets, 0x40, M62TempRom, M62Chars); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00700, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00720, 26, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 YoujyudnLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x0c000, 3, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x18000); - UINT8 *pTemp = (UINT8*)BurnMalloc(0x18000); - nRet = BurnLoadRom(pTemp + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(pTemp + 0x08000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(pTemp + 0x10000, 7, 1); if (nRet != 0) return 1; - memcpy(M62TempRom + 0x0000, pTemp + 0x04000, 0x4000); - memcpy(M62TempRom + 0x4000, pTemp + 0x0c000, 0x4000); - memcpy(M62TempRom + 0x8000, pTemp + 0x14000, 0x4000); - BurnFree(pTemp); - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, YoujyudnTilePlaneOffsets, YoujyudnTileXOffsets, YoujyudnTileYOffsets, 0x80, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0c000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x14000, 13, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load and decode the chars - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 16, 1); if (nRet != 0) return 1; - GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, KidnikiPlaneOffsets, KidnikiXOffsets, KidnikiYOffsets, 0x80, M62TempRom, M62Chars); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 24, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static INT32 HorizonLoadRoms() -{ - INT32 nRet = 0; - - M62TempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(M62M6803Rom + 0x08000, 3, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x02000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 6, 1); if (nRet != 0) return 1; - GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); - - // Load and decode the sprites - memset(M62TempRom, 0, 0x18000); - nRet = BurnLoadRom(M62TempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x04000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x08000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x0c000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x10000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62TempRom + 0x14000, 12, 1); if (nRet != 0) return 1; - GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); - - // Load the Proms - nRet = BurnLoadRom(M62PromData + 0x00000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00100, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00200, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00300, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00400, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00500, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00600, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(M62PromData + 0x00620, 20, 1); if (nRet != 0) return 1; - - BurnFree(M62TempRom); - - return 0; -} - -static void M62MachineInit() -{ -// BurnSetRefreshRate(55.0); - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(M62Z80Read); - ZetSetWriteHandler(M62Z80Write); - ZetSetInHandler(M62Z80PortRead); - ZetSetOutHandler(M62Z80PortWrite); - ZetMapArea(0x0000, 0x7fff, 0, M62Z80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, M62Z80Rom ); - ZetMapArea(0xc000, 0xc0ff, 0, M62SpriteRam); - ZetMapArea(0xc000, 0xc0ff, 1, M62SpriteRam); - ZetMapArea(0xc000, 0xc0ff, 2, M62SpriteRam); - ZetMapArea(0xd000, 0xdfff, 0, M62TileRam ); - ZetMapArea(0xd000, 0xdfff, 1, M62TileRam ); - ZetMapArea(0xd000, 0xdfff, 2, M62TileRam ); - ZetMapArea(0xe000, 0xefff, 0, M62Z80Ram ); - ZetMapArea(0xe000, 0xefff, 1, M62Z80Ram ); - ZetMapArea(0xe000, 0xefff, 2, M62Z80Ram ); - ZetMemEnd(); - ZetClose(); - - M6803Init(1); - M6803MapMemory(M62M6803Rom, 0x4000, 0xffff, M6803_ROM); - M6803SetReadHandler(M62M6803ReadByte); - M6803SetWriteHandler(M62M6803WriteByte); - M6803SetReadPortHandler(M62M6803ReadPort); - M6803SetWritePortHandler(M62M6803WritePort); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - - MSM5205Init(0, M62SynchroniseStream, 384000, M62MSM5205Vck0, MSM5205_S96_4B, 1); - MSM5205Init(1, M62SynchroniseStream, 384000, NULL, MSM5205_SEX_4B, 1); - MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - MSM5205SetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); - - AY8910Init(0, 894886, nBurnSoundRate, &M62SoundLatchRead, NULL, NULL, &AY8910_0PortBWrite); - AY8910Init(1, 894886, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - M62Z80Clock = 4000000; - M62M6803Clock = 894886; - - M62SpriteHeightPromOffset = (M62PaletteEntries & 0xf00) * 3; -} - -static INT32 KungfumMachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetSetReadHandler(KungfumZ80Read); - ZetSetWriteHandler(KungfumZ80Write); - ZetMemEnd(); - ZetClose(); - - M62Z80Clock = 3072000; - M62RenderFunction = KungfumDraw; - - M62DoReset(); - - return 0; -} - -static INT32 BattroadMachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetSetOutHandler(BattroadZ80PortWrite); - ZetMapArea(0xa000, 0xbfff, 0, M62Z80Rom + 0x8000); - ZetMapArea(0xa000, 0xbfff, 2, M62Z80Rom + 0x8000); - ZetMapArea(0xc800, 0xcfff, 0, M62CharRam ); - ZetMapArea(0xc800, 0xcfff, 1, M62CharRam ); - ZetMapArea(0xc800, 0xcfff, 2, M62CharRam ); - ZetMemEnd(); - ZetClose(); - - M62Z80Clock = 3072000; - - M62RenderFunction = BattroadDraw; - M62ExtendTileInfoFunction = BattroadExtendTile; - M62ExtendCharInfoFunction = BattroadExtendChar; - - M62DoReset(); - - return 0; -} - -static INT32 LdrunMachineInit() -{ - M62MachineInit(); - - M62RenderFunction = LdrunDraw; - M62ExtendTileInfoFunction = LdrunExtendTile; - - M62DoReset(); - - return 0; -} - -static INT32 Ldrun2MachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetSetInHandler(Ldrun2Z80PortRead); - ZetSetOutHandler(Ldrun2Z80PortWrite); - ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + 0x8000); - ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + 0x8000); - ZetMemEnd(); - ZetClose(); - - M62RenderFunction = LdrunDraw; - M62ExtendTileInfoFunction = Ldrun2ExtendTile; - - M62DoReset(); - - return 0; -} - -static INT32 Ldrun3MachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetSetReadHandler(Ldrun3Z80Read); - ZetSetOutHandler(Ldrun3Z80PortWrite); - ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + 0x8000); - ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + 0x8000); - ZetMemEnd(); - ZetClose(); - - M62RenderFunction = Ldrun3Draw; - M62ExtendTileInfoFunction = Ldrun2ExtendTile; - - M62DoReset(); - - return 0; -} - -static INT32 Ldrun4MachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetSetWriteHandler(Ldrun4Z80Write); - ZetSetOutHandler(Ldrun4Z80PortWrite); - ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + 0x8000); - ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + 0x8000); - ZetMemEnd(); - ZetClose(); - - M62RenderFunction = Ldrun4Draw; - M62ExtendTileInfoFunction = Ldrun4ExtendTile; - - M62DoReset(); - - return 0; -} - -static INT32 LotlotMachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetMapArea(0xa000, 0xafff, 0, M62CharRam); - ZetMapArea(0xa000, 0xafff, 1, M62CharRam); - ZetMapArea(0xa000, 0xafff, 2, M62CharRam); - ZetMemEnd(); - ZetClose(); - - M62RenderFunction = LotlotDraw; - M62ExtendTileInfoFunction = LotlotExtendTile; - M62ExtendCharInfoFunction = LotlotExtendChar; - - M62DoReset(); - - return 0; -} - -static INT32 KidnikiMachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetSetInHandler(KidnikiZ80PortRead); - ZetSetOutHandler(KidnikiZ80PortWrite); - ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + 0x8000); - ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + 0x8000); - ZetMapArea(0xa000, 0xafff, 0, M62TileRam ); - ZetMapArea(0xa000, 0xafff, 1, M62TileRam ); - ZetMapArea(0xa000, 0xafff, 2, M62TileRam ); - ZetMapArea(0xd000, 0xdfff, 0, M62CharRam ); - ZetMapArea(0xd000, 0xdfff, 1, M62CharRam ); - ZetMapArea(0xd000, 0xdfff, 2, M62CharRam ); - ZetMemEnd(); - ZetClose(); - - M62RenderFunction = KidnikiDraw; - M62ExtendTileInfoFunction = KidnikiExtendTile; - M62ExtendCharInfoFunction = LotlotExtendChar; - - M62DoReset(); - - return 0; -} - -static INT32 SpelunkrMachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetSetWriteHandler(SpelunkrZ80Write); - ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + 0x8000); - ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + 0x8000); - ZetMapArea(0xa000, 0xbfff, 0, M62TileRam ); - ZetMapArea(0xa000, 0xbfff, 1, M62TileRam ); - ZetMapArea(0xa000, 0xbfff, 2, M62TileRam ); - ZetMapArea(0xc800, 0xcfff, 0, M62CharRam ); - ZetMapArea(0xc800, 0xcfff, 1, M62CharRam ); - ZetMapArea(0xc800, 0xcfff, 2, M62CharRam ); - ZetMemCallback(0xd000, 0xdfff, 0); - ZetMemCallback(0xd000, 0xdfff, 1); - ZetMemCallback(0xd000, 0xdfff, 2); - ZetMemEnd(); - ZetClose(); - - M62RenderFunction = SpelunkrDraw; - M62ExtendTileInfoFunction = SpelunkrExtendTile; - M62ExtendCharInfoFunction = SpelunkrExtendChar; - - M62DoReset(); - - return 0; -} - -static INT32 Spelunk2MachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetSetWriteHandler(Spelunk2Z80Write); - ZetMapArea(0x8000, 0x8fff, 0, M62Z80Rom + 0x18000); - ZetMapArea(0x8000, 0x8fff, 2, M62Z80Rom + 0x18000); - ZetMapArea(0x9000, 0x9fff, 0, M62Z80Rom + 0x08000); - ZetMapArea(0x9000, 0x9fff, 2, M62Z80Rom + 0x08000); - ZetMapArea(0xa000, 0xbfff, 0, M62TileRam ); - ZetMapArea(0xa000, 0xbfff, 1, M62TileRam ); - ZetMapArea(0xa000, 0xbfff, 2, M62TileRam ); - ZetMapArea(0xc800, 0xcfff, 0, M62CharRam ); - ZetMapArea(0xc800, 0xcfff, 1, M62CharRam ); - ZetMapArea(0xc800, 0xcfff, 2, M62CharRam ); - ZetMemCallback(0xd000, 0xdfff, 0); - ZetMemCallback(0xd000, 0xdfff, 1); - ZetMemCallback(0xd000, 0xdfff, 2); - ZetMemEnd(); - ZetClose(); - - M62RenderFunction = Spelunk2Draw; - M62ExtendTileInfoFunction = Spelunk2ExtendTile; - M62ExtendCharInfoFunction = SpelunkrExtendChar; - - M62SpriteHeightPromOffset = 0x700; - - M62DoReset(); - - return 0; -} - -static INT32 YoujyudnMachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetSetOutHandler(YoujyudnZ80PortWrite); - ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + 0x8000); - ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + 0x8000); - ZetMapArea(0xc800, 0xcfff, 0, M62CharRam ); - ZetMapArea(0xc800, 0xcfff, 1, M62CharRam ); - ZetMapArea(0xc800, 0xcfff, 2, M62CharRam ); - ZetMemCallback(0xd800, 0xdfff, 0); - ZetMemCallback(0xd800, 0xdfff, 1); - ZetMemCallback(0xd800, 0xdfff, 2); - ZetMemEnd(); - ZetClose(); - - M62RenderFunction = YoujyudnDraw; - M62ExtendTileInfoFunction = YoujyudnExtendTile; - M62ExtendCharInfoFunction = YoujyudnExtendChar; - - M62Z80Clock = 3072000; - - M62DoReset(); - - return 0; -} - -static INT32 HorizonMachineInit() -{ - M62MachineInit(); - - ZetOpen(0); - ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + 0x8000); - ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + 0x8000); - ZetMapArea(0xc000, 0xc1ff, 0, M62SpriteRam ); - ZetMapArea(0xc000, 0xc1ff, 1, M62SpriteRam ); - ZetMapArea(0xc000, 0xc1ff, 2, M62SpriteRam ); - ZetMapArea(0xc800, 0xc83f, 0, M62ScrollRam ); - ZetMapArea(0xc800, 0xc83f, 1, M62ScrollRam ); - ZetMapArea(0xc800, 0xc83f, 2, M62ScrollRam ); - ZetMemEnd(); - ZetClose(); - - M62RenderFunction = HorizonDraw; - M62ExtendTileInfoFunction = HorizonExtendTile; - - M62DoReset(); - - return 0; -} - -static INT32 KungfumInit() -{ - M62Z80RomSize = 0x8000; - M62PromSize = 0x720; - M62NumTiles = 0x400; - M62NumSprites = 0x400; - - if (M62MemInit()) return 1; - if (KungfumLoadRoms()) return 1; - if (KungfumMachineInit()) return 1; - - return 0; -} - -static INT32 KungfumdInit() -{ - M62Z80RomSize = 0x8000; - M62PromSize = 0x720; - M62NumTiles = 0x400; - M62NumSprites = 0x400; - - if (M62MemInit()) return 1; - if (KungfumdLoadRoms()) return 1; - if (KungfumMachineInit()) return 1; - - return 0; -} - -static INT32 Kungfub3Init() -{ - M62Z80RomSize = 0x8000; - M62PromSize = 0x720; - M62NumTiles = 0x400; - M62NumSprites = 0x400; - - if (M62MemInit()) return 1; - if (Kungfub3LoadRoms()) return 1; - if (KungfumMachineInit()) return 1; - - return 0; -} - -static INT32 BattroadInit() -{ - M62Z80RomSize = 0x16000; - M62PromSize = 0x740; - M62NumTiles = 0x400; - M62NumSprites = 0x200; - M62NumChars = 0x400; - M62CharRamSize = 0x800; - - if (M62MemInit()) return 1; - if (BattroadLoadRoms()) return 1; - if (BattroadMachineInit()) return 1; - - return 0; -} - -static INT32 LdrunInit() -{ - M62Z80RomSize = 0x8000; - M62PromSize = 0x720; - M62NumTiles = 0x400; - M62NumSprites = 0x100; - - if (M62MemInit()) return 1; - if (LdrunLoadRoms()) return 1; - if (LdrunMachineInit()) return 1; - - return 0; -} - -static INT32 Ldrun2Init() -{ - M62Z80RomSize = 0xc000; - M62PromSize = 0x720; - M62NumTiles = 0x400; - M62NumSprites = 0x200; - - if (M62MemInit()) return 1; - if (Ldrun2LoadRoms()) return 1; - if (Ldrun2MachineInit()) return 1; - - return 0; -} - -static INT32 Ldrun3Init() -{ - M62Z80RomSize = 0xc000; - M62PromSize = 0x720; - M62NumTiles = 0x800; - M62NumSprites = 0x400; - - if (M62MemInit()) return 1; - if (Ldrun3LoadRoms()) return 1; - if (Ldrun3MachineInit()) return 1; - - return 0; -} - -static INT32 Ldrun3jInit() -{ - M62Z80RomSize = 0xc000; - M62PromSize = 0x720; - M62NumTiles = 0x800; - M62NumSprites = 0x200; - - if (M62MemInit()) return 1; - if (Ldrun3jLoadRoms()) return 1; - if (Ldrun3MachineInit()) return 1; - - return 0; -} - -static INT32 Ldrun4Init() -{ - M62Z80RomSize = 0x10000; - M62PromSize = 0x720; - M62NumTiles = 0x800; - M62NumSprites = 0x400; - - if (M62MemInit()) return 1; - if (Ldrun3LoadRoms()) return 1; - if (Ldrun4MachineInit()) return 1; - - return 0; -} - -static INT32 LotlotInit() -{ - M62Z80RomSize = 0x8000; - M62PromSize = 0xa20; - M62NumTiles = 0x100; - M62NumSprites = 0x100; - M62NumChars = 0x100; - M62CharRamSize = 0x1000; - M62BgxTileDim = 12; - M62BgyTileDim = 10; - M62CharxTileDim = 12; - M62CharyTileDim = 10; - - if (M62MemInit()) return 1; - if (LotlotLoadRoms()) return 1; - if (LotlotMachineInit()) return 1; - - return 0; -} - -static INT32 KidnikiInit() -{ - M62Z80RomSize = 0x28000; - M62PromSize = 0x720; - M62NumTiles = 0x1000; - M62NumSprites = 0x800; - M62NumChars = 0x400; - M62CharRamSize = 0x1000; - M62BgxTileDim = 8; - M62BgyTileDim = 8; - M62CharxTileDim = 12; - M62CharyTileDim = 8; - - if (M62MemInit()) return 1; - if (KidnikiLoadRoms()) return 1; - if (KidnikiMachineInit()) return 1; - - return 0; -} - -static INT32 LitheroInit() -{ - M62Z80RomSize = 0x28000; - M62PromSize = 0x720; - M62NumTiles = 0x1000; - M62NumSprites = 0x800; - M62NumChars = 0x400; - M62CharRamSize = 0x1000; - M62BgxTileDim = 8; - M62BgyTileDim = 8; - M62CharxTileDim = 12; - M62CharyTileDim = 8; - - if (M62MemInit()) return 1; - if (LitheroLoadRoms()) return 1; - if (KidnikiMachineInit()) return 1; - - return 0; -} - -static INT32 SpelunkrInit() -{ - M62Z80RomSize = 0x10000; - M62PromSize = 0x720; - M62NumTiles = 0x1000; - M62NumSprites = 0x400; - M62NumChars = 0x200; - M62CharRamSize = 0x800; - M62BgxTileDim = 8; - M62BgyTileDim = 8; - M62CharxTileDim = 12; - M62CharyTileDim = 8; - - if (M62MemInit()) return 1; - if (SpelunkrLoadRoms()) return 1; - if (SpelunkrMachineInit()) return 1; - - return 0; -} - -static INT32 Spelunk2Init() -{ - M62Z80RomSize = 0x1c000; - M62PromSize = 0x820; - M62NumTiles = 0x1000; - M62NumSprites = 0x400; - M62NumChars = 0x200; - M62CharRamSize = 0x800; - M62BgxTileDim = 8; - M62BgyTileDim = 8; - M62CharxTileDim = 12; - M62CharyTileDim = 8; - - if (M62MemInit()) return 1; - if (Spelunk2LoadRoms()) return 1; - if (Spelunk2MachineInit()) return 1; - - return 0; -} - -static INT32 YoujyudnInit() -{ - M62Z80RomSize = 0x10000; - M62PromSize = 0x720; - M62NumTiles = 0x400; - M62NumSprites = 0x400; - M62NumChars = 0x400; - M62CharRamSize = 0x800; - M62BgxTileDim = 8; - M62BgyTileDim = 16; - M62CharxTileDim = 12; - M62CharyTileDim = 8; - - if (M62MemInit()) return 1; - if (YoujyudnLoadRoms()) return 1; - if (YoujyudnMachineInit()) return 1; - - return 0; -} - -static INT32 HorizonInit() -{ - M62Z80RomSize = 0xc000; - M62PromSize = 0x720; - M62NumTiles = 0x400; - M62NumSprites = 0x400; - M62SpriteRamSize = 0x200; - M62ScrollRamSize = 0x40; - - if (M62MemInit()) return 1; - if (HorizonLoadRoms()) return 1; - if (HorizonMachineInit()) return 1; - - return 0; -} - -static INT32 M62Exit() -{ - ZetExit(); - M6800Exit(); - AY8910Exit(0); - AY8910Exit(1); - MSM5205Exit(); - - GenericTilesExit(); - - BurnFree(Mem); - - M62Z80RomSize = 0; - M62PromSize = 0; - M62NumTiles = 0; - M62NumSprites = 0; - M62NumChars = 0; - M62SpriteRamSize = 0; - M62CharRamSize = 0; - M62ScrollRamSize = 0; - - M62BackgroundHScroll = 0; - M62BackgroundVScroll = 0; - M62CharHScroll = 0; - M62CharVScroll = 0; - M62FlipScreen = 0; - M62SoundLatch = 0; - M62Port1 = 0; - M62Port2 = 0; - M62SlaveMSM5205VClckReset = 0; - M62PaletteEntries = 0; - M62Z80Clock = 0; - M62M6803Clock = 0; - M62RenderFunction = NULL; - M62ExtendTileInfoFunction = NULL; - M62ExtendCharInfoFunction = NULL; - M62BankControl[0] = M62BankControl[1] = 0; - Ldrun2BankSwap = 0; - Ldrun3TopBottomMask = 0; - KidnikiBackgroundBank = 0; - SpelunkrPaletteBank = 0; - M62BgxTileDim = 0; - M62BgyTileDim = 0; - M62CharxTileDim = 0; - M62CharyTileDim = 0; - M62SpriteHeightPromOffset = 0; - - return 0; -} - -static void M62CalcPalette() -{ - UINT8 *ColourProm = (UINT8*)M62PromData; - - for (UINT32 i = 0; i < M62PaletteEntries; i++) { - INT32 Bit0, Bit1, Bit2, Bit3, r, g, b; - - Bit0 = (ColourProm[M62PaletteEntries * 0] >> 0) & 0x01; - Bit1 = (ColourProm[M62PaletteEntries * 0] >> 1) & 0x01; - Bit2 = (ColourProm[M62PaletteEntries * 0] >> 2) & 0x01; - Bit3 = (ColourProm[M62PaletteEntries * 0] >> 3) & 0x01; - r = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - Bit0 = (ColourProm[M62PaletteEntries * 1] >> 0) & 0x01; - Bit1 = (ColourProm[M62PaletteEntries * 1] >> 1) & 0x01; - Bit2 = (ColourProm[M62PaletteEntries * 1] >> 2) & 0x01; - Bit3 = (ColourProm[M62PaletteEntries * 1] >> 3) & 0x01; - g = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - Bit0 = (ColourProm[M62PaletteEntries * 2] >> 0) & 0x01; - Bit1 = (ColourProm[M62PaletteEntries * 2] >> 1) & 0x01; - Bit2 = (ColourProm[M62PaletteEntries * 2] >> 2) & 0x01; - Bit3 = (ColourProm[M62PaletteEntries * 2] >> 3) & 0x01; - b = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - M62Palette[i] = BurnHighCol(r, g, b, 0); - - ColourProm++; - } -} - -static void BattroadCalcPalette() -{ - UINT8 *ColourProm = (UINT8*)M62PromData; - - for (UINT32 i = 0; i < 0x200; i++) { - INT32 Bit0, Bit1, Bit2, Bit3, r, g, b; - - Bit0 = (ColourProm[0x000] >> 0) & 0x01; - Bit1 = (ColourProm[0x000] >> 1) & 0x01; - Bit2 = (ColourProm[0x000] >> 2) & 0x01; - Bit3 = (ColourProm[0x000] >> 3) & 0x01; - r = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - Bit0 = (ColourProm[0x200] >> 0) & 0x01; - Bit1 = (ColourProm[0x200] >> 1) & 0x01; - Bit2 = (ColourProm[0x200] >> 2) & 0x01; - Bit3 = (ColourProm[0x200] >> 3) & 0x01; - g = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - Bit0 = (ColourProm[0x400] >> 0) & 0x01; - Bit1 = (ColourProm[0x400] >> 1) & 0x01; - Bit2 = (ColourProm[0x400] >> 2) & 0x01; - Bit3 = (ColourProm[0x400] >> 3) & 0x01; - b = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - M62Palette[i] = BurnHighCol(r, g, b, 0); - - ColourProm++; - } - - ColourProm = (UINT8*)M62PromData + 0x720; - - for (UINT32 i = 0; i < 0x20; i++) { - INT32 Bit0, Bit1, Bit2, r, g, b; - - Bit0 = (ColourProm[i] >> 0) & 0x01; - Bit1 = (ColourProm[i] >> 1) & 0x01; - Bit2 = (ColourProm[i] >> 2) & 0x01; - r = 0x21 * Bit0 + 0x47 * Bit1 + 0x97 * Bit2; - - Bit0 = (ColourProm[i] >> 3) & 0x01; - Bit1 = (ColourProm[i] >> 4) & 0x01; - Bit2 = (ColourProm[i] >> 5) & 0x01; - g = 0x21 * Bit0 + 0x47 * Bit1 + 0x97 * Bit2; - - Bit0 = 0; - Bit1 = (ColourProm[i] >> 6) & 0x01; - Bit2 = (ColourProm[i] >> 7) & 0x01; - b = 0x21 * Bit0 + 0x47 * Bit1 + 0x97 * Bit2; - - M62Palette[i + 0x200] = BurnHighCol(r, g, b, 0); - } -} - -static void Spelunk2CalcPalette() -{ - UINT8 *ColourProm = (UINT8*)M62PromData; - - for (UINT32 i = 0; i < 0x200; i++) { - INT32 Bit0, Bit1, Bit2, Bit3, r, g, b; - - Bit0 = (ColourProm[0x000] >> 0) & 0x01; - Bit1 = (ColourProm[0x000] >> 1) & 0x01; - Bit2 = (ColourProm[0x000] >> 2) & 0x01; - Bit3 = (ColourProm[0x000] >> 3) & 0x01; - r = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - Bit0 = (ColourProm[0x000] >> 4) & 0x01; - Bit1 = (ColourProm[0x000] >> 5) & 0x01; - Bit2 = (ColourProm[0x000] >> 6) & 0x01; - Bit3 = (ColourProm[0x000] >> 7) & 0x01; - g = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - Bit0 = (ColourProm[0x200] >> 0) & 0x01; - Bit1 = (ColourProm[0x200] >> 1) & 0x01; - Bit2 = (ColourProm[0x200] >> 2) & 0x01; - Bit3 = (ColourProm[0x200] >> 3) & 0x01; - b = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - M62Palette[i] = BurnHighCol(r, g, b, 0); - - ColourProm++; - } - - ColourProm += 0x200; - - for (UINT32 i = 0; i < 0x100; i++) { - INT32 Bit0, Bit1, Bit2, Bit3, r, g, b; - - Bit0 = (ColourProm[0x000] >> 0) & 0x01; - Bit1 = (ColourProm[0x000] >> 1) & 0x01; - Bit2 = (ColourProm[0x000] >> 2) & 0x01; - Bit3 = (ColourProm[0x000] >> 3) & 0x01; - r = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - Bit0 = (ColourProm[0x100] >> 0) & 0x01; - Bit1 = (ColourProm[0x100] >> 1) & 0x01; - Bit2 = (ColourProm[0x100] >> 2) & 0x01; - Bit3 = (ColourProm[0x100] >> 3) & 0x01; - g = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - Bit0 = (ColourProm[0x200] >> 0) & 0x01; - Bit1 = (ColourProm[0x200] >> 1) & 0x01; - Bit2 = (ColourProm[0x200] >> 2) & 0x01; - Bit3 = (ColourProm[0x200] >> 3) & 0x01; - b = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; - - M62Palette[i + 0x200] = BurnHighCol(r, g, b, 0); - - ColourProm++; - } -} - -static void BattroadExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip) -{ - *Code |= ((*Colour & 0x40) << 3) | ((*Colour & 0x10) << 4); - - *xFlip = *Colour & 0x20; - - if (((*Colour & 0x1f) >> 1) >= 0x04) { - *Priority = 1; - } else { - *Priority = 0; - } - - *Colour &= 0x0f; -} - -static void LdrunExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip) -{ - *Code |= (*Colour & 0xc0) << 2; - - *xFlip = *Colour & 0x20; - - if (((*Colour & 0x1f) >> 1) >= 0x0c) { - *Priority = 1; - } else { - *Priority = 0; - } - - *Colour &= 0x1f; -} - -static void Ldrun2ExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip) -{ - *Code |= (*Colour & 0xc0) << 2; - - *xFlip = *Colour & 0x20; - - if (((*Colour & 0x1f) >> 1) >= 0x04) { - *Priority = 1; - } else { - *Priority = 0; - } - - *Colour &= 0x1f; -} - -static void Ldrun4ExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*) -{ - *Code |= ((*Colour & 0xc0) << 2) | ((*Colour & 0x20) << 5); - *Colour &= 0x1f; -} - -static void LotlotExtendTile(INT32* Code, INT32* Colour, INT32*, INT32* xFlip) -{ - *Code |= (*Colour & 0xc0) << 2; - *xFlip = *Colour & 0x20; - *Colour &= 0x1f; -} - -static void KidnikiExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*) -{ - *Code |= ((*Colour & 0xe0) << 3) | (KidnikiBackgroundBank << 11); - *Priority = ((*Colour & 0xe0) == 0xe0) ? 1 : 0; - *Colour &= 0x1f; -} - -static void SpelunkrExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*) -{ - *Code |= ((*Colour & 0x10) << 4) | ((*Colour & 0x20) << 6) | ((*Colour & 0xc0) << 3); - *Colour &= 0x0f | (SpelunkrPaletteBank << 4); -} - -static void Spelunk2ExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*) -{ - *Code |= ((*Colour & 0xf0) << 4); - *Colour &= 0x0f | (SpelunkrPaletteBank << 4); -} - -static void YoujyudnExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*) -{ - *Code |= (*Colour & 0x60) << 3; - if (((*Colour & 0x1f) >> 1) >= 0x08) { - *Priority = 1; - } else { - *Priority = 0; - } - *Colour &= 0x1f; -} - -static void HorizonExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*) -{ - *Code |= ((*Colour & 0xc0) << 2) | ((*Colour & 0x20) << 5); - if (((*Colour & 0x1f) >> 1) >= 0x08) { - *Priority = 1; - } else { - *Priority = 0; - } - *Colour &= 0x1f; -} - -static void M62RenderBgLayer(INT32 PriorityToRender, INT32 xOffset, INT32 yOffset, INT32 Cols, INT32 Rows, INT32 Transparent) -{ - INT32 Code, mx, my, Colour, x, y, TileIndex = 0, Priority, xFlip, yFlip; - - for (my = 0; my < Rows; my++) { - for (mx = 0; mx < Cols; mx++) { - Code = M62TileRam[TileIndex << 1]; - Colour = M62TileRam[(TileIndex << 1) | 0x01]; - Priority = 0; - xFlip = 0; - yFlip = 0; - - if (M62ExtendTileInfoFunction) M62ExtendTileInfoFunction(&Code, &Colour, &Priority, &xFlip); - Code &= (M62NumTiles - 1); - - x = M62BgxTileDim * mx; - y = M62BgyTileDim * my; - - if (M62FlipScreen) { - xFlip = !xFlip; - yFlip = !yFlip; - - y = (Rows * M62BgyTileDim) - M62BgyTileDim - y; - x = (Cols * M62BgxTileDim) - M62BgxTileDim - x; - } - - x -= xOffset; - y -= yOffset; - - if (M62FlipScreen) { - x += M62BackgroundHScroll & (Cols * M62BgxTileDim - 1); - } else { - x -= M62BackgroundHScroll & (Cols * M62BgxTileDim - 1); - } - - y -= M62BackgroundVScroll & (Rows * M62BgyTileDim - 1); - - INT32 px, py; - - UINT32 nPalette = Colour << 3; - - if (Priority == PriorityToRender) { - for (py = 0; py < M62BgyTileDim; py++) { - for (px = 0; px < M62BgxTileDim; px++) { - UINT8 c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + (py * M62BgxTileDim) + px]; - if (xFlip) c = M62Tiles[(Code *M62BgxTileDim * M62BgyTileDim) + (py * M62BgxTileDim) + (M62BgxTileDim - 1 - px)]; - if (yFlip) c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + ((M62BgyTileDim - 1 - py) * M62BgxTileDim) + px]; - if (xFlip && yFlip) c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + ((M62BgyTileDim - 1 - py) * M62BgxTileDim) + (M62BgxTileDim - 1 - px)]; - - if (Transparent && c == 0x00) continue; - - INT32 xPos = x + px; - INT32 yPos = y + py; - - if (M62ScrollRamSize) { -// tilemap_set_scrollx(state->bg_tilemap, i, state->scrollram[i << 1] | (state->scrollram[(i << 1) | 1] << 8)); - - xPos -= (M62ScrollRam[my << 1] | (M62ScrollRam[(my << 1) | 0x01] << 8)) & (Cols * M62BgxTileDim - 1); - } - - if (xPos < 0) xPos += Cols * M62BgxTileDim; - if (xPos > (Cols * M62BgxTileDim - 1)) xPos -= Cols * M62BgxTileDim; - - if (yPos < 0) yPos += Rows * M62BgyTileDim; - if (yPos > (Rows * M62BgyTileDim - 1)) yPos -= Rows * M62BgyTileDim; - - if (yPos >= 0 && yPos < nScreenHeight) { - UINT16* pPixel = pTransDraw + (yPos * nScreenWidth); - - if (xPos >= 0 && xPos < nScreenWidth) { - pPixel[xPos] = c | nPalette; - } - } - } - } - } - - TileIndex++; - } - } -} - -static void KungfumRenderBgLayer(INT32 PriorityToRender, INT32 Cols, INT32 Rows, INT32 Transparent) -{ - INT32 Code, mx, my, Colour, x, y, TileIndex = 0, Priority, xFlip, yFlip; - - for (my = 0; my < Rows; my++) { - for (mx = 0; mx < Cols; mx++) { - Code = M62TileRam[TileIndex]; - Colour = M62TileRam[TileIndex + 0x800]; - xFlip = Colour & 0x20; - yFlip = 0; - - Code |= (Colour & 0xc0) << 2; - Code &= (M62NumTiles - 1); - - if ((TileIndex / 64) << 6 || ((Colour & 0x1f) >> 1) > 0x0c) { - Priority = 1; - } else { - Priority = 0; - } - - x = M62BgxTileDim * mx; - y = M62BgyTileDim * my; - - if (M62FlipScreen) { - xFlip = !xFlip; - yFlip = !yFlip; - - y = (Rows * M62BgyTileDim - 1) - M62BgyTileDim - y; - x = (Cols * M62BgxTileDim - 1) - M62BgxTileDim - x; - } - - x -= 128; - - INT32 px, py; - - UINT32 nPalette = (Colour & 0x1f) << 3; - - if (Priority == PriorityToRender) { - for (py = 0; py < M62BgyTileDim; py++) { - for (px = 0; px < M62BgxTileDim; px++) { - UINT8 c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + (py * M62BgxTileDim) + px]; - if (xFlip) c = M62Tiles[(Code *M62BgxTileDim * M62BgyTileDim) + (py * M62BgxTileDim) + (M62BgxTileDim - 1 - px)]; - if (yFlip) c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + ((M62BgyTileDim - 1 - py) * M62BgxTileDim) + px]; - if (xFlip && yFlip) c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + ((M62BgyTileDim - 1 - py) * M62BgxTileDim) + (M62BgxTileDim - 1 - px)]; - - if (Transparent && c == 0x00) continue; - - INT32 xPos = x + px; - INT32 yPos = y + py; - - if (my >= 6) { - if (M62FlipScreen) { - xPos += M62BackgroundHScroll & (Cols * M62BgxTileDim - 1); - } else { - xPos -= M62BackgroundHScroll & (Cols * M62BgxTileDim - 1); - } - } - - if (xPos < 0) xPos += Cols * M62BgxTileDim; - if (xPos > (Cols * M62BgxTileDim - 1)) xPos -= Cols * M62BgxTileDim; - - if (yPos < 0) yPos += Rows * M62BgyTileDim; - if (yPos > (Rows * M62BgyTileDim - 1)) yPos -= Rows * M62BgyTileDim; - - if (yPos >= 0 && yPos < nScreenHeight) { - UINT16* pPixel = pTransDraw + (yPos * nScreenWidth); - - if (xPos >= 0 && xPos < nScreenWidth) { - pPixel[xPos] = c | nPalette; - } - } - } - } - } - - TileIndex++; - } - } -} - -static void M62RenderSprites(INT32 ColourMask, INT32 PriorityMask, INT32 Priority, INT32 VisibleOffset, INT32 PaletteOffset) -{ - for (UINT32 Offset = 0; Offset < M62SpriteRamSize; Offset += 8) { - INT32 i, Incr, Code, Colour, xFlip, yFlip, sx, sy; - - if ((M62SpriteRam[Offset] & PriorityMask) == Priority) { - Code = M62SpriteRam[Offset + 4] + ((M62SpriteRam[Offset + 5] & 0x07) << 8); - Colour = M62SpriteRam[Offset + 0] & ColourMask; - sx = 256 * (M62SpriteRam[Offset + 7] & 1) + M62SpriteRam[Offset + 6], - sy = 256 + 128 - 15 - (256 * (M62SpriteRam[Offset + 3] & 1) + M62SpriteRam[Offset + 2]), - xFlip = M62SpriteRam[Offset + 5] & 0x40; - yFlip = M62SpriteRam[Offset + 5] & 0x80; - - i = M62PromData[M62SpriteHeightPromOffset + ((Code >> 5) & 0x1f)]; - if (i == 1) { - // double height - Code &= ~1; - sy -= 16; - } else if (i == 2) { - // quadruple height - i = 3; - Code &= ~3; - sy -= 3*16; - } - - if (M62FlipScreen) { - sx = 496 - sx; - sy = 242 - (i * 16) - sy; - xFlip = !xFlip; - yFlip = !yFlip; - } - - if (yFlip) { - Incr = -1; - Code += i; - } else { - Incr = 1; - } - - sx -= VisibleOffset; - - do { - INT32 DrawCode = Code + (i * Incr); - INT32 DrawY = sy + (i * 16); - DrawCode &= (M62NumSprites - 1); - - if (sx > 15 && sx < (nScreenWidth - 16) && DrawY > 15 && DrawY < (nScreenHeight - 16)) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); - } else { - Render16x16Tile_Mask(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); - } - } - } - - i--; - } while (i >= 0); - } - } -} - -static void BattroadExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*) -{ - *Code |= ((*Colour & 0x40) << 3) | ((*Colour & 0x10) << 4); - *Colour &= 0x0f; -} - -static void LotlotExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*) -{ - *Code |= (*Colour & 0xc0) << 2; - *Colour &= 0x1f; -} - -static void SpelunkrExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*) -{ - *Code |= (*Colour & 0x10) << 4; - *Colour &= 0x0f | (SpelunkrPaletteBank << 4); -} - -static void YoujyudnExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*) -{ - *Code |= (*Colour & 0xc0) << 2; - *Colour &= 0x0f; -} - -static void M62RenderCharLayer(INT32 Cols, INT32 Rows, INT32 ColourDepth, INT32 xOffset, INT32 yOffset, INT32 PaletteOffset) -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0, xFlip, yFlip; - - for (my = 0; my < Rows; my++) { - for (mx = 0; mx < Cols; mx++) { - Code = M62CharRam[TileIndex << 1]; - Colour = M62CharRam[(TileIndex << 1) | 0x01]; - xFlip = 0; - yFlip = 0; - - if (M62ExtendCharInfoFunction) M62ExtendCharInfoFunction(&Code, &Colour, 0, 0); - Code &= (M62NumChars - 1); - - x = M62CharxTileDim * mx; - y = M62CharyTileDim * my; - - x -= xOffset; - y -= yOffset; - - if (M62FlipScreen) { - x += M62CharHScroll & (Cols * M62CharxTileDim - 1); - } else { - x -= M62CharHScroll & (Cols * M62CharxTileDim - 1); - } - - y -= M62CharVScroll & (Rows * M62CharyTileDim - 1); - - INT32 px, py; - - UINT32 nPalette = Colour << ColourDepth; - - for (py = 0; py < M62CharyTileDim; py++) { - for (px = 0; px < M62CharxTileDim; px++) { - UINT8 c = M62Chars[(Code * M62CharxTileDim * M62CharyTileDim) + (py * M62CharxTileDim) + px]; - if (xFlip) c = M62Chars[(Code *M62CharxTileDim * M62CharyTileDim) + (py * M62CharxTileDim) + (M62CharxTileDim - 1 - px)]; - if (yFlip) c = M62Chars[(Code * M62CharxTileDim * M62CharyTileDim) + ((M62CharyTileDim - 1 - py) * M62CharxTileDim) + px]; - if (xFlip && yFlip) c = M62Chars[(Code * M62CharxTileDim * M62CharyTileDim) + ((M62CharyTileDim - 1 - py) * M62CharxTileDim) + (M62CharxTileDim - 1 - px)]; - - if (c != 0) { - INT32 xPos = x + px; - INT32 yPos = y + py; - - if (xPos < 0) xPos += Cols * M62CharxTileDim; - if (xPos > (Cols * M62CharxTileDim - 1)) xPos -= Cols * M62CharxTileDim; - - if (yPos < 0) yPos += Rows * M62CharyTileDim; - if (yPos > (Rows * M62CharyTileDim - 1)) yPos -= Rows * M62CharyTileDim; - - if (yPos >= 0 && yPos < nScreenHeight) { - UINT16* pPixel = pTransDraw + (yPos * nScreenWidth); - - if (xPos >= 0 && xPos < nScreenWidth) { - pPixel[xPos] = c | nPalette | PaletteOffset; - } - } - } - } - } - - TileIndex++; - } - } -} - -static void KungfumDraw() -{ - BurnTransferClear(); - M62CalcPalette(); - KungfumRenderBgLayer(0, 64, 32, 0); - KungfumRenderBgLayer(1, 64, 32, 0); - M62RenderSprites(0x1f, 0, 0, 128, 256); - KungfumRenderBgLayer(0, 64, 32, 1); - BurnTransferCopy(M62Palette); -} - -static void BattroadDraw() -{ - BurnTransferClear(); - BattroadCalcPalette(); - M62RenderBgLayer(0, 128, 0, 64, 32, 0); - M62RenderBgLayer(1, 128, 0, 64, 32, 0); - M62RenderSprites(0x0f, 0x10, 0x00, 128, 256); - M62RenderBgLayer(1, 128, 0, 64, 32, 1); - M62RenderSprites(0x0f, 0x10, 0x10, 128, 256); - M62RenderCharLayer(32, 32, 2, 0, 0, 512); - BurnTransferCopy(M62Palette); -} - -static void LdrunDraw() -{ - BurnTransferClear(); - M62CalcPalette(); - M62RenderBgLayer(0, 64, 0, 64, 32, 0); - M62RenderBgLayer(1, 64, 0, 64, 32, 0); - M62RenderSprites(0x0f, 0x10, 0x00, 64, 256); - M62RenderBgLayer(1, 64, 0, 64, 32, 1); - M62RenderSprites(0x0f, 0x10, 0x10, 64, 256); - BurnTransferCopy(M62Palette); -} - -static void Ldrun3Draw() -{ - BurnTransferClear(); - M62CalcPalette(); - M62RenderBgLayer(0, 64, 0, 64, 32, 0); - M62RenderBgLayer(1, 64, 0, 64, 32, 0); - M62RenderSprites(0x0f, 0x10, 0x00, 64, 256); - M62RenderBgLayer(1, 64, 0, 64, 32, 1); - M62RenderSprites(0x0f, 0x10, 0x10, 64, 256); - - if (Ldrun3TopBottomMask) { - INT32 x, y; - - for (x = 0; x < nScreenWidth; x++) { - for (y = 0; y < 8; y++) { - pTransDraw[(y * nScreenWidth) + x] = BurnHighCol(0, 0, 0, 0); - pTransDraw[((y + 248) * nScreenWidth) + x] = BurnHighCol(0, 0, 0, 0); - } - } - } - - BurnTransferCopy(M62Palette); -} - -static void Ldrun4Draw() -{ - BurnTransferClear(); - M62CalcPalette(); - M62RenderBgLayer(0, 64 - 2, 0, 64, 32, 0); - M62RenderSprites(0x0f, 0x00, 0x00, 64, 256); - BurnTransferCopy(M62Palette); -} - -static void LotlotDraw() -{ - M62BackgroundVScroll = 32; - M62BackgroundHScroll = -64; - - BurnTransferClear(); - M62CalcPalette(); - M62RenderBgLayer(0, 64, 0, 32, 64, 0); - M62RenderCharLayer(32, 64, 3, -64 + 64, 32, 512); - M62RenderSprites(0x1f, 0x00, 0x00, 64, 256); - BurnTransferCopy(M62Palette); -} - -static void KidnikiDraw() -{ - BurnTransferClear(); - M62CalcPalette(); - M62RenderBgLayer(0, 64, 0, 64, 32, 0); - M62RenderBgLayer(1, 64, 0, 64, 32, 0); - M62RenderSprites(0x1f, 0x00, 0x00, 64, 256); - M62RenderBgLayer(1, 64, 0, 64, 32, 1); - M62RenderCharLayer(32, 64, 3, 0, 128, 0); - BurnTransferCopy(M62Palette); -} - -static void SpelunkrDraw() -{ - BurnTransferClear(); - M62CalcPalette(); - M62RenderBgLayer(0, 64, 128, 64, 64, 0); - M62RenderSprites(0x1f, 0x00, 0x00, 64, 256); - M62RenderCharLayer(32, 32, 3, 0, 0, 0); - BurnTransferCopy(M62Palette); -} - -static void Spelunk2Draw() -{ - BurnTransferClear(); - Spelunk2CalcPalette(); - M62RenderBgLayer(0, 64 - 1, 128, 64, 64, 0); - M62RenderSprites(0x1f, 0x00, 0x00, 64, 512); - M62RenderCharLayer(32, 32, 3, 64 - 65, 0, 0); - BurnTransferCopy(M62Palette); -} - -static void YoujyudnDraw() -{ - BurnTransferClear(); - M62CalcPalette(); - M62RenderBgLayer(0, 128, 0, 64, 16, 0); - M62RenderBgLayer(1, 128, 0, 64, 16, 0); - M62RenderSprites(0x1f, 0x00, 0x00, 128, 256); - M62RenderBgLayer(1, 128, 0, 64, 16, 1); - M62RenderCharLayer(32, 32, 3, 64, 0, 128); - BurnTransferCopy(M62Palette); -} - -static void HorizonDraw() -{ - BurnTransferClear(); - M62CalcPalette(); - M62RenderBgLayer(0, 128, 0, 64, 32, 0); - M62RenderBgLayer(1, 128, 0, 64, 32, 0); - M62RenderSprites(0x1f, 0x00, 0x00, 128, 256); - M62RenderBgLayer(1, 128, 0, 64, 32, 1); - BurnTransferCopy(M62Palette); -} - -static INT32 M62Frame() -{ - INT32 nInterleave = MSM5205CalcInterleave(0, M62Z80Clock); - INT32 nSoundBufferPos = 0; - - if (M62Reset) M62DoReset(); - - M62MakeInputs(); - -// nCyclesTotal[0] = M62Z80Clock / 55; -// nCyclesTotal[1] = M62M6803Clock / 55; - nCyclesTotal[0] = M62Z80Clock / 60; - nCyclesTotal[1] = M62M6803Clock / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetNewFrame(); - M6803NewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = M6803Run(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - - ZetOpen(0); - MSM5205Update(); - if (M62SlaveMSM5205VClckReset) { - MSM5205VCLKWrite(1, 1); - MSM5205VCLKWrite(1, 0); - M62SlaveMSM5205VClckReset = 0; - } - ZetClose(); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - - ZetOpen(0); - MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - MSM5205Render(1, pBurnSoundOut, nBurnSoundLen); - ZetClose(); - } - - if (pBurnDraw) { - if (M62RenderFunction) M62RenderFunction(); - } - - return 0; -} - -static INT32 M62Scan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029709; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - - } - - return 0; -} - -struct BurnDriver BurnDrvKungfum = { - "kungfum", NULL, NULL, NULL, "1984", - "Kung-Fu Master\0", NULL, "Irem", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, - NULL, KungfumRomInfo, KungfumRomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, - KungfumInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvKungfumd = { - "kungfumd", "kungfum", NULL, NULL, "1984", - "Kung-Fu Master (Data East)\0", NULL, "Irem (Data East License)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, - NULL, KungfumdRomInfo, KungfumdRomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, - KungfumdInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvSpartanx = { - "spartanx", "kungfum", NULL, NULL, "1984", - "Spartan X (Japan)\0", NULL, "Irem", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, - NULL, SpartanxRomInfo, SpartanxRomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, - KungfumInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvKungfub = { - "kungfub", "kungfum", NULL, NULL, "1984", - "Kung-Fu Master (bootleg set 1)\0", NULL, "bootleg", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, - NULL, KungfubRomInfo, KungfubRomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, - KungfumInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvKungfub2 = { - "kungfub2", "kungfum", NULL, NULL, "1984", - "Kung-Fu Master (bootleg set 2)\0", NULL, "bootleg", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, - NULL, Kungfub2RomInfo, Kungfub2RomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, - KungfumInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvKungfub3 = { - "kungfub3", "kungfum", NULL, NULL, "1984", - "Kung-Fu Master (bootleg set 3)\0", NULL, "bootleg", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, - NULL, Kungfub3RomInfo, Kungfub3RomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, - Kungfub3Init, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvBattroad = { - "battroad", NULL, NULL, NULL, "1984", - "The Battle-Road\0", NULL, "Irem", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, - NULL, BattroadRomInfo, BattroadRomName, NULL, NULL, M62InputInfo, BattroadDIPInfo, - BattroadInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x220, 256, 256, 3, 4 -}; - -struct BurnDriver BurnDrvLdrun = { - "ldrun", NULL, NULL, NULL, "1984", - "Lode Runner (set 1)\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, LdrunRomInfo, LdrunRomName, NULL, NULL, M62InputInfo, LdrunDIPInfo, - LdrunInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvLdruna = { - "ldruna", "ldrun", NULL, NULL, "1984", - "Lode Runner (set 2)\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, LdrunaRomInfo, LdrunaRomName, NULL, NULL, M62InputInfo, LdrunDIPInfo, - LdrunInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvLdrun2 = { - "ldrun2", NULL, NULL, NULL, "1984", - "Lode Runner II - The Bungeling Strikes Back\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, Ldrun2RomInfo, Ldrun2RomName, NULL, NULL, M62InputInfo, Ldrun2DIPInfo, - Ldrun2Init, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvLdrun3 = { - "ldrun3", NULL, NULL, NULL, "1985", - "Lode Runner III - The Golden Labyrinth\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, Ldrun3RomInfo, Ldrun3RomName, NULL, NULL, M62InputInfo, Ldrun2DIPInfo, - Ldrun3Init, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvLdrun3j = { - "ldrun3j", "ldrun3", NULL, NULL, "1985", - "Lode Runner III - Majin No Fukkatsu\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, Ldrun3jRomInfo, Ldrun3jRomName, NULL, NULL, M62InputInfo, Ldrun2DIPInfo, - Ldrun3jInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvLdrun4 = { - "ldrun4", NULL, NULL, NULL, "1986", - "Lode Runner IV - Teikoku Karano Dasshutsu\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, Ldrun4RomInfo, Ldrun4RomName, NULL, NULL, M62InputInfo, Ldrun4DIPInfo, - Ldrun4Init, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvLotlot = { - "lotlot", NULL, NULL, NULL, "1985", - "Lot Lot\0", NULL, "Irem (licensed from Tokuma Shoten)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PUZZLE, 0, - NULL, LotlotRomInfo, LotlotRomName, NULL, NULL, M62InputInfo, LotlotDIPInfo, - LotlotInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x300, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvKidniki = { - "kidniki", NULL, NULL, NULL, "1986", - "Kid Niki - Radical Ninja (World)\0", NULL, "Irem", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, KidnikiRomInfo, KidnikiRomName, NULL, NULL, M62InputInfo, KidnikiDIPInfo, - KidnikiInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvKidnikiu = { - "kidnikiu", "kidniki", NULL, NULL, "1986", - "Kid Niki - Radical Ninja (US)\0", NULL, "Irem (Data East USA license)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, KidnikiuRomInfo, KidnikiuRomName, NULL, NULL, M62InputInfo, KidnikiDIPInfo, - KidnikiInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvYanchamr = { - "yanchamr", "kidniki", NULL, NULL, "1986", - "Kaiketsu Yanchamaru (Japan)\0", NULL, "Irem", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, YanchamrRomInfo, YanchamrRomName, NULL, NULL, M62InputInfo, KidnikiDIPInfo, - KidnikiInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvLithero = { - "lithero", "kidniki", NULL, NULL, "1987", - "Little Hero\0", NULL, "bootleg", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, LitheroRomInfo, LitheroRomName, NULL, NULL, M62InputInfo, KidnikiDIPInfo, - LitheroInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvSpelunkr = { - "spelunkr", NULL, NULL, NULL, "1985", - "Spelunker\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, SpelunkrRomInfo, SpelunkrRomName, NULL, NULL, M62InputInfo, SpelunkrDIPInfo, - SpelunkrInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvSpelunkrj = { - "spelunkrj", "spelunkr", NULL, NULL, "1985", - "Spelunker (Japan)\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, SpelunkrjRomInfo, SpelunkrjRomName, NULL, NULL, M62InputInfo, SpelunkrDIPInfo, - SpelunkrInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvSpelunk2 = { - "spelunk2", NULL, NULL, NULL, "1986", - "Spelunker II\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, - NULL, Spelunk2RomInfo, Spelunk2RomName, NULL, NULL, M62InputInfo, Spelunk2DIPInfo, - Spelunk2Init, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x300, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvYoujyudn = { - "youjyudn", NULL, NULL, NULL, "1986", - "Youjyuden (Japan)\0", NULL, "Irem", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M62, GBF_VERSHOOT, 0, - NULL, YoujyudnRomInfo, YoujyudnRomName, NULL, NULL, M62InputInfo, YoujyudnDIPInfo, - YoujyudnInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 256, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHorizon = { - "horizon", NULL, NULL, NULL, "1985", - "Horizon\0", NULL, "Irem", "Irem M62", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_HORSHOOT, 0, - NULL, HorizonRomInfo, HorizonRomName, NULL, NULL, M62InputInfo, HorizonDIPInfo, - HorizonInit, M62Exit, M62Frame, NULL, M62Scan, - NULL, 0x200, 256, 256, 4, 3 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "m6800_intf.h" +#include "msm5205.h" + +#include "driver.h" +extern "C" { + #include "ay8910.h" +} + +static UINT8 M62InputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 M62InputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 M62InputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 M62Dip[2] = {0, 0}; +static UINT8 M62Input[3] = {0x00, 0x00, 0x00}; +static UINT8 M62Reset = 0; + +static UINT32 M62Z80RomSize = 0; +static UINT32 M62PromSize = 0; +static UINT32 M62NumTiles = 0; +static UINT32 M62NumSprites = 0; +static UINT32 M62NumChars = 0; +static UINT32 M62SpriteRamSize = 0; +static UINT32 M62CharRamSize = 0; +static UINT32 M62ScrollRamSize = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *M62Z80Rom = NULL; +static UINT8 *M62M6803Rom = NULL; +static UINT8 *M62TileRam = NULL; +static UINT8 *M62SpriteRam = NULL; +static UINT8 *M62CharRam = NULL; +static UINT8 *M62ScrollRam = NULL; +static UINT8 *M62Z80Ram = NULL; +static UINT8 *M62M6803Ram = NULL; +static UINT8 *M62Tiles = NULL; +static UINT8 *M62Sprites = NULL; +static UINT8 *M62Chars = NULL; +static UINT8 *M62PromData = NULL; +static UINT8 *M62TempRom = NULL; +static UINT32 *M62Palette = NULL; +static INT16* pFMBuffer; +static INT16* pAY8910Buffer[6]; + +static INT32 M62BackgroundHScroll; +static INT32 M62BackgroundVScroll; +static INT32 M62CharHScroll; +static INT32 M62CharVScroll; +static INT32 M62FlipScreen; +static INT32 M62SpriteHeightPromOffset; +static UINT8 M62SoundLatch; +static UINT8 M62Port1; +static UINT8 M62Port2; +static UINT8 M62SlaveMSM5205VClckReset; +static UINT32 M62PaletteEntries; +static UINT32 M62Z80Clock; +static UINT32 M62M6803Clock; +static UINT8 M62BankControl[2]; +static UINT8 Ldrun2BankSwap; +static UINT8 Ldrun3TopBottomMask; +static UINT8 KidnikiBackgroundBank; +static UINT8 SpelunkrPaletteBank; +static INT32 M62BgxTileDim = 0; +static INT32 M62BgyTileDim = 0; +static INT32 M62CharxTileDim = 0; +static INT32 M62CharyTileDim = 0; + +typedef void (*M62Render)(); +static M62Render M62RenderFunction; +static void KungfumDraw(); +static void BattroadDraw(); +static void LdrunDraw(); +static void Ldrun3Draw(); +static void Ldrun4Draw(); +static void LotlotDraw(); +static void KidnikiDraw(); +static void SpelunkrDraw(); +static void Spelunk2Draw(); +static void YoujyudnDraw(); +static void HorizonDraw(); + +typedef void (*M62ExtendTileInfo)(INT32*, INT32*, INT32*, INT32*); +static M62ExtendTileInfo M62ExtendTileInfoFunction; +static void BattroadExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip); +static void LdrunExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip); +static void Ldrun2ExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip); +static void Ldrun4ExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*); +static void LotlotExtendTile(INT32* Code, INT32* Colour, INT32*, INT32* xFlip); +static void KidnikiExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*); +static void SpelunkrExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*); +static void Spelunk2ExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*); +static void YoujyudnExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*); +static void HorizonExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*); + +typedef void (*M62ExtendCharInfo)(INT32*, INT32*, INT32*, INT32*); +static M62ExtendCharInfo M62ExtendCharInfoFunction; +static void BattroadExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*); +static void LotlotExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*); +static void SpelunkrExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*); +static void YoujyudnExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*); + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo M62InputList[] = +{ + {"Coin 1" , BIT_DIGITAL , M62InputPort0 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , M62InputPort0 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , M62InputPort2 + 4, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , M62InputPort0 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , M62InputPort1 + 3, "p1 up" }, + {"Down" , BIT_DIGITAL , M62InputPort1 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , M62InputPort1 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , M62InputPort1 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , M62InputPort1 + 7, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , M62InputPort1 + 5, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 3, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 2, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 1, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 0, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 7, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , M62InputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &M62Reset , "reset" }, + {"Service" , BIT_DIGITAL , M62InputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH, M62Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, M62Dip + 1 , "dip" }, +}; + +STDINPUTINFO(M62) + +static inline void M62ClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void M62MakeInputs() +{ + M62Input[0] = M62Input[1] = M62Input[2] = 0x00; + + for (INT32 i = 0; i < 8; i++) { + M62Input[0] |= (M62InputPort0[i] & 1) << i; + M62Input[1] |= (M62InputPort1[i] & 1) << i; + M62Input[2] |= (M62InputPort2[i] & 1) << i; + } + + M62ClearOpposites(&M62Input[0]); + M62ClearOpposites(&M62Input[1]); +} + +#define IREM_Z80_COINAGE_TYPE3 \ + {0 , 0xfe, 0 , 15 , "Coinage" }, \ + {0x12, 0x02, 0xf0, 0x90, "7 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xa0, "6 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xb0, "5 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xc0, "4 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xd0, "3 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xe0, "2 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xf0, "1 Coin 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x70, "1 Coin 2 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x60, "1 Coin 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x50, "1 Coin 4 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x40, "1 Coin 5 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x30, "1 Coin 6 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x20, "1 Coin 7 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x10, "1 Coin 8 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x00, "Freeplay" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + \ + {0 , 0xfe, 0 , 4 , "Coin A" }, \ + {0x12, 0x82, 0x30, 0x10, "3 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0x30, 0x20, "2 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0x30, 0x30, "1 Coin 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0x30, 0x00, "Free Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0 , 0xfe, 0 , 4 , "Coin B" }, \ + {0x12, 0x82, 0xc0, 0xc0, "1 Coin 2 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0xc0, 0x80, "1 Coin 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0xc0, 0x40, "1 Coin 5 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0xc0, 0x00, "1 Coin 6 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + +#define IREM_Z80_COINAGE_TYPE4 \ + {0 , 0xfe, 0 , 16 , "Coinage" }, \ + {0x12, 0x02, 0xf0, 0xa0, "6 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xb0, "5 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xc0, "4 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xd0, "3 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x10, "8 Coins 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xe0, "2 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x20, "5 Coins 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x30, "3 Coins 2 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xf0, "1 Coin 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x40, "2 Coins 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x90, "1 Coin 2 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x80, "1 Coin 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x70, "1 Coin 4 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x60, "1 Coin 5 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x50, "1 Coin 6 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x00, "Freeplay" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + \ + {0 , 0xfe, 0 , 4 , "Coin A" }, \ + {0x12, 0x82, 0x30, 0x00, "5 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0x30, 0x10, "3 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0x30, 0x20, "2 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0x30, 0x30, "1 Coin 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0 , 0xfe, 0 , 4 , "Coin B" }, \ + {0x12, 0x82, 0xc0, 0xc0, "1 Coin 2 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0xc0, 0x80, "1 Coin 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0xc0, 0x40, "1 Coin 5 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0xc0, 0x00, "1 Coin 6 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + +#define IREM_Z80_COINAGE_TYPE5 \ + {0 , 0xfe, 0 , 16 , "Coinage" }, \ + {0x12, 0x02, 0xf0, 0x00, "8 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xa0, "6 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xb0, "5 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xc0, "4 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xd0, "3 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xe0, "2 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x10, "5 Coins 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x20, "3 Coins 5 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x30, "3 Coins 2 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0xf0, "1 Coin 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x40, "2 Coins 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x90, "1 Coin 2 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x80, "1 Coin 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x70, "1 Coin 4 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x60, "1 Coin 5 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x02, 0xf0, 0x50, "1 Coin 6 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + \ + {0 , 0xfe, 0 , 4 , "Coin A" }, \ + {0x12, 0x82, 0x30, 0x00, "5 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0x30, 0x10, "3 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0x30, 0x20, "2 Coins 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0x30, 0x30, "1 Coin 1 Play" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0 , 0xfe, 0 , 4 , "Coin B" }, \ + {0x12, 0x82, 0xc0, 0xc0, "1 Coin 2 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0xc0, 0x80, "1 Coin 3 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0xc0, 0x40, "1 Coin 5 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + {0x12, 0x82, 0xc0, 0x00, "1 Coin 6 Plays" }, \ + {0x13, 0x00, 0x04, 0x04, NULL }, \ + +static struct BurnDIPInfo KungfumDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x12, 0x01, 0x01, 0x01, "Easy" }, + {0x12, 0x01, 0x01, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Energy Loss" }, + {0x12, 0x01, 0x02, 0x02, "Slow" }, + {0x12, 0x01, 0x02, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x0c, 0x08, "2" }, + {0x12, 0x01, 0x0c, 0x0c, "3" }, + {0x12, 0x01, 0x0c, 0x04, "4" }, + {0x12, 0x01, 0x0c, 0x00, "5" }, + + IREM_Z80_COINAGE_TYPE3 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Slow Motion Mode" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Level Selection Mode" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Kungfum) + +static struct BurnDIPInfo BattroadDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Fuel Decrease" }, + {0x12, 0x01, 0x03, 0x03, "Slow" }, + {0x12, 0x01, 0x03, 0x02, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Fast" }, + {0x12, 0x01, 0x03, 0x00, "Fastest" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x12, 0x01, 0x04, 0x04, "Easy" }, + {0x12, 0x01, 0x04, 0x00, "Hard" }, + + IREM_Z80_COINAGE_TYPE3 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Battroad) + +static struct BurnDIPInfo LdrunDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Timer" }, + {0x12, 0x01, 0x03, 0x03, "Slow" }, + {0x12, 0x01, 0x03, 0x02, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Fast" }, + {0x12, 0x01, 0x03, 0x00, "Fastest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x0c, 0x08, "2" }, + {0x12, 0x01, 0x0c, 0x0c, "3" }, + {0x12, 0x01, 0x0c, 0x04, "4" }, + {0x12, 0x01, 0x0c, 0x00, "5" }, + + IREM_Z80_COINAGE_TYPE3 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Level Selection Mode" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Ldrun) + +static struct BurnDIPInfo Ldrun2DIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Timer" }, + {0x12, 0x01, 0x01, 0x01, "Slow" }, + {0x12, 0x01, 0x01, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Game Speed" }, + {0x12, 0x01, 0x02, 0x00, "Low" }, + {0x12, 0x01, 0x02, 0x02, "High" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x0c, 0x08, "2" }, + {0x12, 0x01, 0x0c, 0x0c, "3" }, + {0x12, 0x01, 0x0c, 0x04, "4" }, + {0x12, 0x01, 0x0c, 0x00, "5" }, + + IREM_Z80_COINAGE_TYPE3 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Level Selection Mode" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Ldrun2) + +static struct BurnDIPInfo Ldrun4DIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Timer" }, + {0x12, 0x01, 0x01, 0x01, "Slow" }, + {0x12, 0x01, 0x01, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "2 Players Game" }, + {0x12, 0x01, 0x02, 0x00, "1 Credit" }, + {0x12, 0x01, 0x02, 0x02, "2 Credits" }, + + {0 , 0xfe, 0 , 4 , "1 Player Lives" }, + {0x12, 0x01, 0x0c, 0x08, "2" }, + {0x12, 0x01, 0x0c, 0x0c, "3" }, + {0x12, 0x01, 0x0c, 0x04, "4" }, + {0x12, 0x01, 0x0c, 0x00, "5" }, + + IREM_Z80_COINAGE_TYPE3 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "2 Players Lives" }, + {0x13, 0x01, 0x02, 0x02, "5" }, + {0x13, 0x01, 0x02, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Allow 2 Player Game" }, + {0x13, 0x01, 0x10, 0x00, "Off" }, + {0x13, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Level Selection Mode" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Ldrun4) + +static struct BurnDIPInfo LotlotDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xf5, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Speed" }, + {0x12, 0x01, 0x03, 0x03, "Very Slow" }, + {0x12, 0x01, 0x03, 0x02, "Slow" }, + {0x12, 0x01, 0x03, 0x01, "Fast" }, + {0x12, 0x01, 0x03, 0x00, "Very Fast" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x0c, 0x08, "1" }, + {0x12, 0x01, 0x0c, 0x0c, "2" }, + {0x12, 0x01, 0x0c, 0x04, "3" }, + {0x12, 0x01, 0x0c, 0x00, "4" }, + + IREM_Z80_COINAGE_TYPE4 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Lotlot) + +static struct BurnDIPInfo KidnikiDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x02, "2" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x01, "4" }, + {0x12, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x12, 0x01, 0x04, 0x04, "Normal" }, + {0x12, 0x01, 0x04, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x12, 0x01, 0x08, 0x08, "50000" }, + {0x12, 0x01, 0x08, 0x00, "80000" }, + + IREM_Z80_COINAGE_TYPE4 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Game Repeats" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x10, 0x00, "Off" }, + {0x13, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Kidniki) + +static struct BurnDIPInfo SpelunkrDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xf5, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Energy Decrease" }, + {0x12, 0x01, 0x03, 0x03, "Slow" }, + {0x12, 0x01, 0x03, 0x02, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Fast" }, + {0x12, 0x01, 0x03, 0x00, "Fastest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x0c, 0x08, "2" }, + {0x12, 0x01, 0x0c, 0x0c, "3" }, + {0x12, 0x01, 0x0c, 0x04, "4" }, + {0x12, 0x01, 0x0c, 0x00, "5" }, + + IREM_Z80_COINAGE_TYPE4 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Teleport" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Spelunkr) + +static struct BurnDIPInfo Spelunk2DIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Energy Decrease" }, + {0x12, 0x01, 0x03, 0x03, "Slow" }, + {0x12, 0x01, 0x03, 0x02, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Fast" }, + {0x12, 0x01, 0x03, 0x00, "Fastest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x0c, 0x08, "2" }, + {0x12, 0x01, 0x0c, 0x0c, "3" }, + {0x12, 0x01, 0x0c, 0x04, "4" }, + {0x12, 0x01, 0x0c, 0x00, "5" }, + + IREM_Z80_COINAGE_TYPE4 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x10, 0x00, "Off" }, + {0x13, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Spelunk2) + +static struct BurnDIPInfo YoujyudnDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x02, "2" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x01, "4" }, + {0x12, 0x01, 0x03, 0x00, "5" }, + + IREM_Z80_COINAGE_TYPE4 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x13, 0x01, 0x08, 0x08, "20000 60000" }, + {0x13, 0x01, 0x08, 0x00, "40000 80000" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x10, 0x00, "Off" }, + {0x13, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Level Selection Mode" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Youjyudn) + +static struct BurnDIPInfo HorizonDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x00, "2" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x01, "4" }, + {0x12, 0x01, 0x03, 0x02, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x12, 0x01, 0x0c, 0x00, "100 and 80k" }, + {0x12, 0x01, 0x0c, 0x0c, "40k and every 80k" }, + {0x12, 0x01, 0x0c, 0x08, "60k and every 100k" }, + {0x12, 0x01, 0x0c, 0x04, "80k and every 120k" }, + + IREM_Z80_COINAGE_TYPE5 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Frame Advance" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Horizon) + +static struct BurnRomInfo KungfumRomDesc[] = { + { "a-4e-c.bin", 0x04000, 0xb6e2d083, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "a-4d-c.bin", 0x04000, 0x7532918e, BRF_ESS | BRF_PRG }, // 1 + + { "a-3e-.bin", 0x02000, 0x58e87ab0, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code + { "a-3f-.bin", 0x02000, 0xc81e31ea, BRF_ESS | BRF_PRG }, // 3 + { "a-3h-.bin", 0x02000, 0xd99fb995, BRF_ESS | BRF_PRG }, // 4 + + { "g-4c-a.bin", 0x02000, 0x6b2cc9c8, BRF_GRA }, // 5 Characters + { "g-4d-a.bin", 0x02000, 0xc648f558, BRF_GRA }, // 6 + { "g-4e-a.bin", 0x02000, 0xfbe9276e, BRF_GRA }, // 7 + + { "b-4k-.bin", 0x02000, 0x16fb5150, BRF_GRA }, // 8 Sprites + { "b-4f-.bin", 0x02000, 0x67745a33, BRF_GRA }, // 9 + { "b-4l-.bin", 0x02000, 0xbd1c2261, BRF_GRA }, // 10 + { "b-4h-.bin", 0x02000, 0x8ac5ed3a, BRF_GRA }, // 11 + { "b-3n-.bin", 0x02000, 0x28a213aa, BRF_GRA }, // 12 + { "b-4n-.bin", 0x02000, 0xd5228df3, BRF_GRA }, // 13 + { "b-4m-.bin", 0x02000, 0xb16de4f2, BRF_GRA }, // 14 + { "b-3m-.bin", 0x02000, 0xeba0d66b, BRF_GRA }, // 15 + { "b-4c-.bin", 0x02000, 0x01298885, BRF_GRA }, // 16 + { "b-4e-.bin", 0x02000, 0xc77b87d4, BRF_GRA }, // 17 + { "b-4d-.bin", 0x02000, 0x6a70615f, BRF_GRA }, // 18 + { "b-4a-.bin", 0x02000, 0x6189d626, BRF_GRA }, // 19 + + { "g-1j-.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 20 PROM (Tile Palette Red Component) + { "b-1m-.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) + { "g-1f-.bin", 0x00100, 0x964b6495, BRF_GRA }, // 22 PROM (Tile Palette Green Component) + { "b-1n-.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) + { "g-1h-.bin", 0x00100, 0x550563e1, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) + { "b-1l-.bin", 0x00100, 0x35e45021, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) + { "b-5f-.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 26 PROM (Sprite Height) + { "b-6f-.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 27 PROM (Video Timing) +}; + +STD_ROM_PICK(Kungfum) +STD_ROM_FN(Kungfum) + +static struct BurnRomInfo KungfumdRomDesc[] = { + { "snx_a-4e-d", 0x04000, 0xfc330a46, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "snx_a-4d-d", 0x04000, 0x1b2fd32f, BRF_ESS | BRF_PRG }, // 1 + + { "snx_a-3d-b", 0x04000, 0x85ca7956, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code + { "snx_a-3f-b", 0x04000, 0x3ef1100a, BRF_ESS | BRF_PRG }, // 3 + + { "g-4c-a.bin", 0x02000, 0x6b2cc9c8, BRF_GRA }, // 4 Characters + { "g-4d-a.bin", 0x02000, 0xc648f558, BRF_GRA }, // 5 + { "g-4e-a.bin", 0x02000, 0xfbe9276e, BRF_GRA }, // 6 + + { "snx_b-4k-b", 0x04000, 0x85591db2, BRF_GRA }, // 7 Sprites + { "snx_b-4f-b", 0x04000, 0xed719d7b, BRF_GRA }, // 8 + { "snx_b-3n-b", 0x04000, 0x05fcce8b, BRF_GRA }, // 9 + { "snx_b-4n-b", 0x04000, 0xdc675003, BRF_GRA }, // 10 + { "snx_b-4c-b", 0x04000, 0x1df11d81, BRF_GRA }, // 11 + { "snx_b-4e-b", 0x04000, 0x2d3b69dd, BRF_GRA }, // 12 + + { "g-1j-.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 13 PROM (Tile Palette Red Component) + { "b-1m-.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 14 PROM (Sprite Palette Red Component) + { "g-1f-.bin", 0x00100, 0x964b6495, BRF_GRA }, // 15 PROM (Tile Palette Green Component) + { "b-1n-.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 16 PROM (Sprite Palette Green Component) + { "g-1h-.bin", 0x00100, 0x550563e1, BRF_GRA }, // 17 PROM (Tile Palette Blue Component) + { "b-1l-.bin", 0x00100, 0x35e45021, BRF_GRA }, // 18 PROM (Sprite Palette Blue Component) + { "b-5f-.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 19 PROM (Sprite Height) + { "b-6f-.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 20 PROM (Video Timing) +}; + +STD_ROM_PICK(Kungfumd) +STD_ROM_FN(Kungfumd) + +static struct BurnRomInfo SpartanxRomDesc[] = { + { "a-4e-c-j.bin", 0x04000, 0x32a0a9a6, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "a-4d-c-j.bin", 0x04000, 0x3173ea78, BRF_ESS | BRF_PRG }, // 1 + + { "a-3e-.bin", 0x02000, 0x58e87ab0, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code + { "a-3f-.bin", 0x02000, 0xc81e31ea, BRF_ESS | BRF_PRG }, // 3 + { "a-3h-.bin", 0x02000, 0xd99fb995, BRF_ESS | BRF_PRG }, // 4 + + { "g-4c-a-j.bin", 0x02000, 0x8af9c5a6, BRF_GRA }, // 5 Characters + { "g-4d-a-j.bin", 0x02000, 0xb8300c72, BRF_GRA }, // 6 + { "g-4e-a-j.bin", 0x02000, 0xb50429cd, BRF_GRA }, // 7 + + { "b-4k-.bin", 0x02000, 0x16fb5150, BRF_GRA }, // 8 Sprites + { "b-4f-.bin", 0x02000, 0x67745a33, BRF_GRA }, // 9 + { "b-4l-.bin", 0x02000, 0xbd1c2261, BRF_GRA }, // 10 + { "b-4h-.bin", 0x02000, 0x8ac5ed3a, BRF_GRA }, // 11 + { "b-3n-.bin", 0x02000, 0x28a213aa, BRF_GRA }, // 12 + { "b-4n-.bin", 0x02000, 0xd5228df3, BRF_GRA }, // 13 + { "b-4m-.bin", 0x02000, 0xb16de4f2, BRF_GRA }, // 14 + { "b-3m-.bin", 0x02000, 0xeba0d66b, BRF_GRA }, // 15 + { "b-4c-.bin", 0x02000, 0x01298885, BRF_GRA }, // 16 + { "b-4e-.bin", 0x02000, 0xc77b87d4, BRF_GRA }, // 17 + { "b-4d-.bin", 0x02000, 0x6a70615f, BRF_GRA }, // 18 + { "b-4a-.bin", 0x02000, 0x6189d626, BRF_GRA }, // 19 + + { "g-1j-.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 20 PROM (Tile Palette Red Component) + { "b-1m-.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) + { "g-1f-.bin", 0x00100, 0x964b6495, BRF_GRA }, // 22 PROM (Tile Palette Green Component) + { "b-1n-.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) + { "g-1h-.bin", 0x00100, 0x550563e1, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) + { "b-1l-.bin", 0x00100, 0x35e45021, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) + { "b-5f-.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 26 PROM (Sprite Height) + { "b-6f-.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 27 PROM (Video Timing) +}; + +STD_ROM_PICK(Spartanx) +STD_ROM_FN(Spartanx) + +static struct BurnRomInfo KungfubRomDesc[] = { + { "c5.5h", 0x04000, 0x5d8e791d, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "c4.5k", 0x04000, 0x4000e2b8, BRF_ESS | BRF_PRG }, // 1 + + { "a-3e-.bin", 0x02000, 0x58e87ab0, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code + { "a-3f-.bin", 0x02000, 0xc81e31ea, BRF_ESS | BRF_PRG }, // 3 + { "a-3h-.bin", 0x02000, 0xd99fb995, BRF_ESS | BRF_PRG }, // 4 + + { "g-4c-a.bin", 0x02000, 0x6b2cc9c8, BRF_GRA }, // 5 Characters + { "g-4d-a.bin", 0x02000, 0xc648f558, BRF_GRA }, // 6 + { "g-4e-a.bin", 0x02000, 0xfbe9276e, BRF_GRA }, // 7 + + { "b-4k-.bin", 0x02000, 0x16fb5150, BRF_GRA }, // 8 Sprites + { "b-4f-.bin", 0x02000, 0x67745a33, BRF_GRA }, // 9 + { "b-4l-.bin", 0x02000, 0xbd1c2261, BRF_GRA }, // 10 + { "b-4h-.bin", 0x02000, 0x8ac5ed3a, BRF_GRA }, // 11 + { "b-3n-.bin", 0x02000, 0x28a213aa, BRF_GRA }, // 12 + { "b-4n-.bin", 0x02000, 0xd5228df3, BRF_GRA }, // 13 + { "b-4m-.bin", 0x02000, 0xb16de4f2, BRF_GRA }, // 14 + { "b-3m-.bin", 0x02000, 0xeba0d66b, BRF_GRA }, // 15 + { "b-4c-.bin", 0x02000, 0x01298885, BRF_GRA }, // 16 + { "b-4e-.bin", 0x02000, 0xc77b87d4, BRF_GRA }, // 17 + { "b-4d-.bin", 0x02000, 0x6a70615f, BRF_GRA }, // 18 + { "b-4a-.bin", 0x02000, 0x6189d626, BRF_GRA }, // 19 + + { "tbp24s10-main-1c.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 20 PROM (Tile Palette Red Component) + { "tbp24s10-gfx-1r.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) + { "tbp24s10-main-1a.bin", 0x00100, 0x964b6495, BRF_GRA }, // 22 PROM (Tile Palette Green Component) + { "tbp24s10-gfx-1s.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) + { "tbp24s10-main-1b.bin", 0x00100, 0x550563e1, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) + { "tbp24s10-gfx-1p.bin", 0x00100, 0x35e45021, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) + { "18s030-gfx-8t.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 26 PROM (Sprite Height) + { "tbp24s10-gfx-9k.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 27 PROM (Video Timing) + { "18s030-gfx-10a.bin", 0x00020, 0x3858acd0, BRF_OPT }, // 27 + { "18s030-gfx-5d.bin", 0x00020, 0x51304fcd, BRF_OPT }, // 28 + { "18s030-gfx-5e.bin", 0x00020, 0x51304fcd, BRF_OPT }, // 29 + { "18s030-gfx-6l.bin", 0x00020, 0x3858acd0, BRF_OPT }, // 30 + { "tbp24s10-gfx-3b.bin", 0x00100, 0xe6506ef4, BRF_OPT }, // 31 + { "tbp24s10-gfx-4a.bin", 0x00100, 0xe0aa8869, BRF_OPT }, // 32 + { "tbp24s10-gfx-4c.bin", 0x00100, 0xb43d094f, BRF_OPT }, // 33 + { "tbp24s10-gfx-6d.bin", 0x00100, 0x48bb39c9, BRF_OPT }, // 34 + { "tbp24s10-gfx-6e.bin", 0x00100, 0x48bb39c9, BRF_OPT }, // 35 + { "tbp24s10-gfx-6m.bin", 0x00100, 0x9f7a1a4d, BRF_OPT }, // 36 + { "tbp24s10-gfx-6n.bin", 0x00100, 0x35e5b39e, BRF_OPT }, // 37 + { "tbp24s10-gfx-8a.bin", 0x00100, 0x35e5b39e, BRF_OPT }, // 38 + { "tbp24s10-gfx-9a.bin", 0x00100, 0x9f7a1a4d, BRF_OPT }, // 39 + { "tbp24s10-gfx-9k.bin", 0x00100, 0x82c20d12, BRF_OPT }, // 40 + { "tbp24s10-main-8b.bin", 0x00100, 0x180fbc57, BRF_OPT }, // 41 + { "tbp24s10-main-8c.bin", 0x00100, 0x3bb32e5a, BRF_OPT }, // 42 + { "tbp24s10-main-8d.bin", 0x00100, 0x599c319f, BRF_OPT }, // 43 +}; + +STD_ROM_PICK(Kungfub) +STD_ROM_FN(Kungfub) + +static struct BurnRomInfo Kungfub2RomDesc[] = { + { "kf4", 0x04000, 0x3f65313f, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "kf5", 0x04000, 0x9ea325f3, BRF_ESS | BRF_PRG }, // 1 + + { "a-3e-.bin", 0x02000, 0x58e87ab0, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code + { "a-3f-.bin", 0x02000, 0xc81e31ea, BRF_ESS | BRF_PRG }, // 3 + { "a-3h-.bin", 0x02000, 0xd99fb995, BRF_ESS | BRF_PRG }, // 4 + + { "g-4c-a.bin", 0x02000, 0x6b2cc9c8, BRF_GRA }, // 5 Characters + { "g-4d-a.bin", 0x02000, 0xc648f558, BRF_GRA }, // 6 + { "g-4e-a.bin", 0x02000, 0xfbe9276e, BRF_GRA }, // 7 + + { "b-4k-.bin", 0x02000, 0x16fb5150, BRF_GRA }, // 8 Sprites + { "b-4f-.bin", 0x02000, 0x67745a33, BRF_GRA }, // 9 + { "b-4l-.bin", 0x02000, 0xbd1c2261, BRF_GRA }, // 10 + { "b-4h-.bin", 0x02000, 0x8ac5ed3a, BRF_GRA }, // 11 + { "b-3n-.bin", 0x02000, 0x28a213aa, BRF_GRA }, // 12 + { "b-4n-.bin", 0x02000, 0xd5228df3, BRF_GRA }, // 13 + { "b-4m-.bin", 0x02000, 0xb16de4f2, BRF_GRA }, // 14 + { "b-3m-.bin", 0x02000, 0xeba0d66b, BRF_GRA }, // 15 + { "b-4c-.bin", 0x02000, 0x01298885, BRF_GRA }, // 16 + { "b-4e-.bin", 0x02000, 0xc77b87d4, BRF_GRA }, // 17 + { "b-4d-.bin", 0x02000, 0x6a70615f, BRF_GRA }, // 18 + { "b-4a-.bin", 0x02000, 0x6189d626, BRF_GRA }, // 19 + + { "g-1j-.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 20 PROM (Tile Palette Red Component) + { "b-1m-.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) + { "g-1f-.bin", 0x00100, 0x964b6495, BRF_GRA }, // 22 PROM (Tile Palette Green Component) + { "b-1n-.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) + { "g-1h-.bin", 0x00100, 0x550563e1, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) + { "b-1l-.bin", 0x00100, 0x35e45021, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) + { "b-5f-.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 26 PROM (Sprite Height) + { "b-6f-.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 27 PROM (Video Timing) +}; + +STD_ROM_PICK(Kungfub2) +STD_ROM_FN(Kungfub2) + +static struct BurnRomInfo Kungfub3RomDesc[] = { + { "5.bin", 0x04000, 0x5d8e791d, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "4.bin", 0x04000, 0x4000e2b8, BRF_ESS | BRF_PRG }, // 1 + + { "1.bin", 0x02000, 0x58e87ab0, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code + { "2.bin", 0x02000, 0xc81e31ea, BRF_ESS | BRF_PRG }, // 3 + { "3.bin", 0x02000, 0xd99fb995, BRF_ESS | BRF_PRG }, // 4 + + { "6.bin", 0x02000, 0x6b2cc9c8, BRF_GRA }, // 4 Characters + { "7.bin", 0x02000, 0xc648f558, BRF_GRA }, // 5 + { "8.bin", 0x02000, 0xfbe9276e, BRF_GRA }, // 6 + + { "14.bin", 0x04000, 0x85591db2, BRF_GRA }, // 7 Sprites + { "13.bin", 0x04000, 0xed719d7b, BRF_GRA }, // 8 + { "16.bin", 0x04000, 0x05fcce8b, BRF_GRA }, // 9 + { "15.bin", 0x04000, 0xdc675003, BRF_GRA }, // 10 + { "11.bin", 0x04000, 0x1df11d81, BRF_GRA }, // 11 + { "12.bin", 0x04000, 0x2d3b69dd, BRF_GRA }, // 12 + + { "g-1j-.bin", 0x00100, 0x668e6bca, BRF_GRA }, // 13 PROM (Tile Palette Red Component) + { "b-1m-.bin", 0x00100, 0x76c05a9c, BRF_GRA }, // 14 PROM (Sprite Palette Red Component) + { "g-1f-.bin", 0x00100, 0x964b6495, BRF_GRA }, // 15 PROM (Tile Palette Green Component) + { "b-1n-.bin", 0x00100, 0x23f06b99, BRF_GRA }, // 16 PROM (Sprite Palette Green Component) + { "g-1h-.bin", 0x00100, 0x550563e1, BRF_GRA }, // 17 PROM (Tile Palette Blue Component) + { "b-1l-.bin", 0x00100, 0x35e45021, BRF_GRA }, // 18 PROM (Sprite Palette Blue Component) + { "b-5f-.bin", 0x00020, 0x7a601c3d, BRF_GRA }, // 19 PROM (Sprite Height) + { "b-6f-.bin", 0x00100, 0x82c20d12, BRF_GRA }, // 20 PROM (Video Timing) +}; + +STD_ROM_PICK(Kungfub3) +STD_ROM_FN(Kungfub3) + +static struct BurnRomInfo BattroadRomDesc[] = { + { "br-a-4e.b", 0x02000, 0x9bf14768, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "br-a-4d.b", 0x02000, 0x39ca1627, BRF_ESS | BRF_PRG }, // 1 + { "br-a-4b.b", 0x02000, 0x1865bb22, BRF_ESS | BRF_PRG }, // 2 + { "br-a-4a", 0x02000, 0x65b61c21, BRF_ESS | BRF_PRG }, // 3 + { "br-c-7c", 0x02000, 0x2e1eca52, BRF_ESS | BRF_PRG }, // 4 + { "br-c-7l", 0x02000, 0xf2178578, BRF_ESS | BRF_PRG }, // 5 + { "br-c-7d", 0x02000, 0x3aa9fa30, BRF_ESS | BRF_PRG }, // 6 + { "br-c-7b", 0x02000, 0x0b31b90b, BRF_ESS | BRF_PRG }, // 7 + { "br-c-7a", 0x02000, 0xec3b0080, BRF_ESS | BRF_PRG }, // 8 + { "br-c-7k", 0x02000, 0xedc75f7f, BRF_ESS | BRF_PRG }, // 9 + + { "br-a-3e", 0x02000, 0xa7140871, BRF_ESS | BRF_PRG }, // 10 M6803 Program Code + { "br-a-3f", 0x02000, 0x1bb51b30, BRF_ESS | BRF_PRG }, // 11 + { "br-a-3h", 0x02000, 0xafb3e083, BRF_ESS | BRF_PRG }, // 12 + + { "br-c-6h", 0x02000, 0xca50841c, BRF_GRA }, // 13 Tiles + { "br-c-6n", 0x02000, 0x7d53163a, BRF_GRA }, // 14 + { "br-c-6k", 0x02000, 0x5951e12a, BRF_GRA }, // 15 + + { "br-b-4k.a", 0x02000, 0xd3c5e85b, BRF_GRA }, // 16 Sprites + { "br-b-4f.a", 0x02000, 0x4354232a, BRF_GRA }, // 17 + { "br-b-3n.a", 0x02000, 0x2668dbef, BRF_GRA }, // 18 + { "br-b-4n.a", 0x02000, 0xc719a324, BRF_GRA }, // 19 + { "br-b-4c.a", 0x02000, 0x0b3193bf, BRF_GRA }, // 20 + { "br-b-4e.a", 0x02000, 0x3662e8fb, BRF_GRA }, // 21 + + { "br-c-1b", 0x02000, 0x8088911e, BRF_GRA }, // 22 Chars + { "br-c-1c", 0x02000, 0x3d78b653, BRF_GRA }, // 23 + + { "br-c-3j", 0x00100, 0xaceaed79, BRF_GRA }, // 24 PROM (Tile Palette Red Component) + { "br-b-1m", 0x00100, 0x3bd30c7d, BRF_GRA }, // 25 PROM (Sprite Palette Red Component) + { "br-c-3l", 0x00100, 0x7cf6f380, BRF_GRA }, // 26 PROM (Tile Palette Green Component) + { "br-b-1n", 0x00100, 0xb7f3dc3b, BRF_GRA }, // 27 PROM (Sprite Palette Green Component) + { "br-c-3k", 0x00100, 0xd90e4a54, BRF_GRA }, // 28 PROM (Tile Palette Blue Component) + { "br-b-1l", 0x00100, 0x5271c7d8, BRF_GRA }, // 29 PROM (Sprite Palette Blue Component) + { "br-b-5p", 0x00020, 0xce746937, BRF_GRA }, // 30 PROM (Sprite Height) + { "br-b-6f", 0x00100, 0x82c20d12, BRF_GRA }, // 31 PROM (Video Timing) + { "br-c-1j", 0x00020, 0x78eb5d77, BRF_GRA }, // 32 PROM (Char Palette) +}; + +STD_ROM_PICK(Battroad) +STD_ROM_FN(Battroad) + +static struct BurnRomInfo LdrunRomDesc[] = { + { "lr-a-4e", 0x02000, 0x5d7e2a4d, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "lr-a-4d", 0x02000, 0x96f20473, BRF_ESS | BRF_PRG }, // 1 + { "lr-a-4b", 0x02000, 0xb041c4a9, BRF_ESS | BRF_PRG }, // 2 + { "lr-a-4a", 0x02000, 0x645e42aa, BRF_ESS | BRF_PRG }, // 3 + + { "lr-a-3f", 0x02000, 0x7a96accd, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code + { "lr-a-3h", 0x02000, 0x3f7f3939, BRF_ESS | BRF_PRG }, // 5 + + { "lr-e-2d", 0x02000, 0x24f9b58d, BRF_GRA }, // 6 Characters + { "lr-e-2j", 0x02000, 0x43175e08, BRF_GRA }, // 7 + { "lr-e-2f", 0x02000, 0xe0317124, BRF_GRA }, // 8 + + { "lr-b-4k", 0x02000, 0x8141403e, BRF_GRA }, // 9 Sprites + { "lr-b-3n", 0x02000, 0x55154154, BRF_GRA }, // 10 + { "lr-b-4c", 0x02000, 0x924e34d0, BRF_GRA }, // 11 + + { "lr-e-3m", 0x00100, 0x53040416, BRF_GRA }, // 20 PROM (Tile Palette Red Component) + { "lr-b-1m", 0x00100, 0x4bae1c25, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) + { "lr-e-3l", 0x00100, 0x67786037, BRF_GRA }, // 22 PROM (Tile Palette Green Component) + { "lr-b-1n", 0x00100, 0x9cd3db94, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) + { "lr-e-3n", 0x00100, 0x5b716837, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) + { "lr-b-1l", 0x00100, 0x08d8cf9a, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) + { "lr-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 26 PROM (Sprite Height) + { "lr-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 27 PROM (Video Timing) +}; + +STD_ROM_PICK(Ldrun) +STD_ROM_FN(Ldrun) + +static struct BurnRomInfo LdrunaRomDesc[] = { + { "roma4c", 0x02000, 0x279421e1, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "lr-a-4d", 0x02000, 0x96f20473, BRF_ESS | BRF_PRG }, // 1 + { "roma4b", 0x02000, 0x3c464bad, BRF_ESS | BRF_PRG }, // 2 + { "roma4a", 0x02000, 0x899df8e0, BRF_ESS | BRF_PRG }, // 3 + + { "lr-a-3f", 0x02000, 0x7a96accd, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code + { "lr-a-3h", 0x02000, 0x3f7f3939, BRF_ESS | BRF_PRG }, // 5 + + { "lr-e-2d", 0x02000, 0x24f9b58d, BRF_GRA }, // 6 Characters + { "lr-e-2j", 0x02000, 0x43175e08, BRF_GRA }, // 7 + { "lr-e-2f", 0x02000, 0xe0317124, BRF_GRA }, // 8 + + { "lr-b-4k", 0x02000, 0x8141403e, BRF_GRA }, // 9 Sprites + { "lr-b-3n", 0x02000, 0x55154154, BRF_GRA }, // 10 + { "lr-b-4c", 0x02000, 0x924e34d0, BRF_GRA }, // 11 + + { "lr-e-3m", 0x00100, 0x53040416, BRF_GRA }, // 20 PROM (Tile Palette Red Component) + { "lr-b-1m", 0x00100, 0x4bae1c25, BRF_GRA }, // 21 PROM (Sprite Palette Red Component) + { "lr-e-3l", 0x00100, 0x67786037, BRF_GRA }, // 22 PROM (Tile Palette Green Component) + { "lr-b-1n", 0x00100, 0x9cd3db94, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) + { "lr-e-3n", 0x00100, 0x5b716837, BRF_GRA }, // 24 PROM (Tile Palette Blue Component) + { "lr-b-1l", 0x00100, 0x08d8cf9a, BRF_GRA }, // 25 PROM (Sprite Palette Blue Component) + { "lr-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 26 PROM (Sprite Height) + { "lr-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 27 PROM (Video Timing) +}; + +STD_ROM_PICK(Ldruna) +STD_ROM_FN(Ldruna) + +static struct BurnRomInfo Ldrun2RomDesc[] = { + { "lr2-a-4e.a", 0x02000, 0x22313327, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "lr2-a-4d", 0x02000, 0xef645179, BRF_ESS | BRF_PRG }, // 1 + { "lr2-a-4a.a", 0x02000, 0xb11ddf59, BRF_ESS | BRF_PRG }, // 2 + { "lr2-a-4a", 0x02000, 0x470cc8a1, BRF_ESS | BRF_PRG }, // 3 + { "lr2-h-1c.a", 0x02000, 0x7ebcadbc, BRF_ESS | BRF_PRG }, // 4 + { "lr2-h-1d.a", 0x02000, 0x64cbb7f9, BRF_ESS | BRF_PRG }, // 5 + + { "lr2-a-3e", 0x02000, 0x853f3898, BRF_ESS | BRF_PRG }, // 6 M6803 Program Code + { "lr2-a-3f", 0x02000, 0x7a96accd, BRF_ESS | BRF_PRG }, // 7 + { "lr2-a-3h", 0x02000, 0x2a0e83ca, BRF_ESS | BRF_PRG }, // 8 + + { "lr2-h-1e", 0x02000, 0x9d63a8ff, BRF_GRA }, // 9 Characters + { "lr2-h-1j", 0x02000, 0x40332bbd, BRF_GRA }, // 10 + { "lr2-h-1h", 0x02000, 0x9404727d, BRF_GRA }, // 11 + + { "lr2-b-4k", 0x02000, 0x79909871, BRF_GRA }, // 12 Sprites + { "lr2-b-4f", 0x02000, 0x06ba1ef4, BRF_GRA }, // 13 + { "lr2-b-3n", 0x02000, 0x3cc5893f, BRF_GRA }, // 14 + { "lr2-b-4n", 0x02000, 0x49c12f42, BRF_GRA }, // 15 + { "lr2-b-4c", 0x02000, 0xfbe6d24c, BRF_GRA }, // 16 + { "lr2-b-4e", 0x02000, 0x75172d1f, BRF_GRA }, // 17 + + { "lr2-h-3m", 0x00100, 0x2c5d834b, BRF_GRA }, // 18 PROM (Tile Palette Red Component) + { "lr2-b-1m", 0x00100, 0x4ec9bb3d, BRF_GRA }, // 19 PROM (Sprite Palette Red Component) + { "lr2-h-3l", 0x00100, 0x3ae69aca, BRF_GRA }, // 20 PROM (Tile Palette Green Component) + { "lr2-b-1n", 0x00100, 0x1daf1fa4, BRF_GRA }, // 21 PROM (Sprite Palette Green Component) + { "lr2-h-3n", 0x00100, 0x2b28aec5, BRF_GRA }, // 22 PROM (Tile Palette Blue Component) + { "lr2-b-1l", 0x00100, 0xc8fb708a, BRF_GRA }, // 23 PROM (Sprite Palette Blue Component) + { "lr2-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 24 PROM (Sprite Height) + { "lr2-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 25 PROM (Video Timing) +}; + +STD_ROM_PICK(Ldrun2) +STD_ROM_FN(Ldrun2) + +static struct BurnRomInfo Ldrun3RomDesc[] = { + { "lr3a4eb.bin", 0x04000, 0x09affc47, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "lr3a4db.bin", 0x04000, 0x23a02178, BRF_ESS | BRF_PRG }, // 1 + { "lr3a4bb.bin", 0x04000, 0x3d501a1a, BRF_ESS | BRF_PRG }, // 2 + + { "lr3-a-3d", 0x04000, 0x28be68cd, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code + { "lr3-a-3f", 0x04000, 0xcb7186b7, BRF_ESS | BRF_PRG }, // 4 + + { "lr3-n-2a", 0x04000, 0xf9b74dee, BRF_GRA }, // 5 Characters + { "lr3-n-2c", 0x04000, 0xfef707ba, BRF_GRA }, // 6 + { "lr3-n-2b", 0x04000, 0xaf3d27b9, BRF_GRA }, // 7 + + { "lr3b4kb.bin", 0x04000, 0x21ecd8c5, BRF_GRA }, // 8 Sprites + { "snxb4fb.bin", 0x04000, 0xed719d7b, BRF_GRA }, // 9 + { "lr3b3nb.bin", 0x04000, 0xda8cffab, BRF_GRA }, // 10 + { "snxb4nb.bin", 0x04000, 0xdc675003, BRF_GRA }, // 11 + { "snxb4cb.bin", 0x04000, 0x585aa244, BRF_GRA }, // 12 + { "snxb4eb.bin", 0x04000, 0x2d3b69dd, BRF_GRA }, // 13 + + { "lr3-n-2l", 0x00100, 0xe880b86b, BRF_GRA }, // 14 PROM (Tile Palette Red Component) + { "lr3-b-1m", 0x00100, 0xf02d7167, BRF_GRA }, // 15 PROM (Sprite Palette Red Component) + { "lr3-n-2k", 0x00100, 0x047ee051, BRF_GRA }, // 16 PROM (Tile Palette Green Component) + { "lr3-b-1n", 0x00100, 0x9e37f181, BRF_GRA }, // 17 PROM (Sprite Palette Green Component) + { "lr3-n-2m", 0x00100, 0x69ad8678, BRF_GRA }, // 18 PROM (Tile Palette Blue Component) + { "lr3-b-1l", 0x00100, 0x5b11c41d, BRF_GRA }, // 19 PROM (Sprite Palette Blue Component) + { "lr3-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 20 PROM (Sprite Height) + { "lr3-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 21 PROM (Video Timing) + { "lr3-n-4f", 0x00100, 0xdf674be9, BRF_OPT }, // 22 PROM (Unknown) +}; + +STD_ROM_PICK(Ldrun3) +STD_ROM_FN(Ldrun3) + +static struct BurnRomInfo Ldrun3jRomDesc[] = { + { "lr3-a-4e", 0x04000, 0x5b334e8e, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "lr3-a-4d.a", 0x04000, 0xa84bc931, BRF_ESS | BRF_PRG }, // 1 + { "lr3-a-4b.a", 0x04000, 0xbe09031d, BRF_ESS | BRF_PRG }, // 2 + + { "lr3-a-3d", 0x04000, 0x28be68cd, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code + { "lr3-a-3f", 0x04000, 0xcb7186b7, BRF_ESS | BRF_PRG }, // 4 + + { "lr3-n-2a", 0x04000, 0xf9b74dee, BRF_GRA }, // 5 Characters + { "lr3-n-2c", 0x04000, 0xfef707ba, BRF_GRA }, // 6 + { "lr3-n-2b", 0x04000, 0xaf3d27b9, BRF_GRA }, // 7 + + { "lr3-b-4k", 0x04000, 0x63f070c7, BRF_GRA }, // 8 Sprites + { "lr3-b-3n", 0x04000, 0xeab7ad91, BRF_GRA }, // 9 + { "lr3-b-4c", 0x04000, 0x1a460a46, BRF_GRA }, // 10 + + { "lr3-n-2l", 0x00100, 0xe880b86b, BRF_GRA }, // 11 PROM (Tile Palette Red Component) + { "lr3-b-1m", 0x00100, 0xf02d7167, BRF_GRA }, // 12 PROM (Sprite Palette Red Component) + { "lr3-n-2k", 0x00100, 0x047ee051, BRF_GRA }, // 13 PROM (Tile Palette Green Component) + { "lr3-b-1n", 0x00100, 0x9e37f181, BRF_GRA }, // 14 PROM (Sprite Palette Green Component) + { "lr3-n-2m", 0x00100, 0x69ad8678, BRF_GRA }, // 15 PROM (Tile Palette Blue Component) + { "lr3-b-1l", 0x00100, 0x5b11c41d, BRF_GRA }, // 16 PROM (Sprite Palette Blue Component) + { "lr3-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 17 PROM (Sprite Height) + { "lr3-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 18 PROM (Video Timing) + { "lr3-n-4f", 0x00100, 0xdf674be9, BRF_OPT }, // 19 PROM (Unknown) +}; + +STD_ROM_PICK(Ldrun3j) +STD_ROM_FN(Ldrun3j) + +static struct BurnRomInfo Ldrun4RomDesc[] = { + { "lr4-a-4e", 0x04000, 0x5383e9bf, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "lr4-a-4d.c", 0x04000, 0x298afa36, BRF_ESS | BRF_PRG }, // 1 + { "lr4-v-4k", 0x08000, 0x8b248abd, BRF_ESS | BRF_PRG }, // 2 + + { "lr4-a-3d", 0x04000, 0x86c6d445, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code + { "lr4-a-3f", 0x04000, 0x097c6c0a, BRF_ESS | BRF_PRG }, // 4 + + { "lr4-v-2b", 0x04000, 0x4118e60a, BRF_GRA }, // 5 Characters + { "lr4-v-2d", 0x04000, 0x542bb5b5, BRF_GRA }, // 6 + { "lr4-v-2c", 0x04000, 0xc765266c, BRF_GRA }, // 7 + + { "lr4-b-4k", 0x04000, 0xe7fe620c, BRF_GRA }, // 8 Sprites + { "lr4-b-4f", 0x04000, 0x6f0403db, BRF_GRA }, // 9 + { "lr4-b-3n", 0x04000, 0xad1fba1b, BRF_GRA }, // 10 + { "lr4-b-4n", 0x04000, 0x0e568fab, BRF_GRA }, // 11 + { "lr4-b-4c", 0x04000, 0x82c53669, BRF_GRA }, // 12 + { "lr4-b-4e", 0x04000, 0x767a1352, BRF_GRA }, // 13 + + { "lr4-v-1m", 0x00100, 0xfe51bf1d, BRF_GRA }, // 14 PROM (Tile Palette Red Component) + { "lr4-b-1m", 0x00100, 0x5d8d17d0, BRF_GRA }, // 15 PROM (Sprite Palette Red Component) + { "lr4-v-1n", 0x00100, 0xda0658e5, BRF_GRA }, // 16 PROM (Tile Palette Green Component) + { "lr4-b-1n", 0x00100, 0xda1129d2, BRF_GRA }, // 17 PROM (Sprite Palette Green Component) + { "lr4-v-1p", 0x00100, 0x0df23ebe, BRF_GRA }, // 18 PROM (Tile Palette Blue Component) + { "lr4-b-1l", 0x00100, 0x0d89b692, BRF_GRA }, // 19 PROM (Sprite Palette Blue Component) + { "lr4-b-5p", 0x00020, 0xe01f69e2, BRF_GRA }, // 20 PROM (Sprite Height) + { "lr4-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 21 PROM (Video Timing) + { "lr4-v-4h", 0x00100, 0xdf674be9, BRF_OPT }, // 22 PROM (Unknown) +}; + +STD_ROM_PICK(Ldrun4) +STD_ROM_FN(Ldrun4) + +static struct BurnRomInfo LotlotRomDesc[] = { + { "lot-a-4e", 0x04000, 0x2913d08f, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "lot-a-4d", 0x04000, 0x0443095f, BRF_ESS | BRF_PRG }, // 1 + + { "lot-a-3h", 0x02000, 0x0781cee7, BRF_ESS | BRF_PRG }, // 2 M6803 Program Code + + { "lot-k-4a", 0x02000, 0x1b3695f4, BRF_GRA }, // 3 Tiles + { "lot-k-4c", 0x02000, 0xbd2b0730, BRF_GRA }, // 4 + { "lot-k-4b", 0x02000, 0x930ddd55, BRF_GRA }, // 5 + + { "lot-b-4k", 0x02000, 0xfd27cb90, BRF_GRA }, // 6 Sprites + { "lot-b-3n", 0x02000, 0xbd486fff, BRF_GRA }, // 7 + { "lot-b-4c", 0x02000, 0x3026ee6c, BRF_GRA }, // 8 + + { "lot-k-4p", 0x02000, 0x3b7d95ba, BRF_GRA }, // 9 Characters + { "lot-k-4l", 0x02000, 0xf98dca1f, BRF_GRA }, // 10 + { "lot-k-4n", 0x02000, 0xf0cd76a5, BRF_GRA }, // 11 + + { "lot-k-2f", 0x00100, 0xb820a05e, BRF_GRA }, // 12 PROM (Tile Palette Red Component) + { "lot-b-1m", 0x00100, 0xc146461d, BRF_GRA }, // 13 PROM (Sprite Palette Red Component) + { "lot-k-2l", 0x00100, 0xac3e230d, BRF_GRA }, // 14 PROM (Char Palette Red Component) + { "lot-k-2e", 0x00100, 0x9b1fa005, BRF_GRA }, // 15 PROM (Tile Palette Green Component) + { "lot-b-1n", 0x00100, 0x01e07db6, BRF_GRA }, // 16 PROM (Sprite Palette Green Component) + { "lot-k-2k", 0x00100, 0x1811ad2b, BRF_GRA }, // 17 PROM (Char Palette Green Component) + { "lot-k-2d", 0x00100, 0x315ed9a8, BRF_GRA }, // 18 PROM (Tile Palette Blue Component) + { "lot-b-1l", 0x00100, 0x8b6fcde3, BRF_GRA }, // 19 PROM (Sprite Palette Blue Component) + { "lot-k-2j", 0x00100, 0xe791ef2a, BRF_GRA }, // 20 PROM (Char Palette Blue Component) + { "lot-b-5p", 0x00020, 0x110b21fd, BRF_GRA }, // 21 PROM (Sprite Height) + { "lot-b-6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 22 PROM (Video Timing) + { "lot-k-7e", 0x00200, 0x6cef0fbd, BRF_GRA }, // 23 PROM (Unknown) + { "lot-k-7h", 0x00200, 0x04442bee, BRF_GRA }, // 24 PROM (Unknown) +}; + +STD_ROM_PICK(Lotlot) +STD_ROM_FN(Lotlot) + +static struct BurnRomInfo KidnikiRomDesc[] = { + { "ky_a-4e-g.bin", 0x04000, 0x2edcbcd7, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "dr03.4cd", 0x04000, 0xdba20934, BRF_ESS | BRF_PRG }, // 1 + { "ky_t-8k-g.bin", 0x08000, 0xdbc42f31, BRF_ESS | BRF_PRG }, // 2 + { "dr12.8l", 0x10000, 0xc0b255fd, BRF_ESS | BRF_PRG }, // 3 + + { "dr00.3a", 0x04000, 0x458309f7, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code + { "dr01.3cd", 0x04000, 0xe66897bd, BRF_ESS | BRF_PRG }, // 5 + { "dr02.3f", 0x04000, 0xf9e31e26, BRF_ESS | BRF_PRG }, // 6 + + { "dr06.2b", 0x08000, 0x4d9a970f, BRF_GRA }, // 7 Tiles + { "dr07.2dc", 0x08000, 0xab59a4c4, BRF_GRA }, // 8 + { "dr05.2a", 0x08000, 0x2e6dad0c, BRF_GRA }, // 9 + + { "dr21.4k", 0x04000, 0xa06cea9a, BRF_GRA }, // 10 Sprites + { "dr19.4f", 0x04000, 0xb34605ad, BRF_GRA }, // 11 + { "dr22.4l", 0x04000, 0x41303de8, BRF_GRA }, // 12 + { "dr20.4jh", 0x04000, 0x5fbe6f61, BRF_GRA }, // 13 + { "dr14.3p", 0x04000, 0x76cfbcbc, BRF_GRA }, // 14 + { "dr24.4p", 0x04000, 0xd51c8db5, BRF_GRA }, // 15 + { "dr23.4nm", 0x04000, 0x03469df8, BRF_GRA }, // 16 + { "dr13.3nm", 0x04000, 0xd5c3dfe0, BRF_GRA }, // 17 + { "dr16.4cb", 0x04000, 0xf1d1bb93, BRF_GRA }, // 18 + { "dr18.4e", 0x04000, 0xedb7f25b, BRF_GRA }, // 19 + { "dr17.4dc", 0x04000, 0x4fb87868, BRF_GRA }, // 20 + { "dr15.4a", 0x04000, 0xe0b88de5, BRF_GRA }, // 21 + + { "dr08.4l", 0x04000, 0x32d50643, BRF_GRA }, // 22 Characters + { "dr09.4m", 0x04000, 0x17df6f95, BRF_GRA }, // 23 + { "dr10.4n", 0x04000, 0x820ce252, BRF_GRA }, // 24 + + { "dr25.3f", 0x00100, 0x8e91430b, BRF_GRA }, // 25 PROM (Tile Palette Red Component) + { "dr30.1m", 0x00100, 0x28c73263, BRF_GRA }, // 26 PROM (Sprite Palette Red Component) + { "dr26.3h", 0x00100, 0xb563b93f, BRF_GRA }, // 27 PROM (Tile Palette Green Component) + { "dr31.1n", 0x00100, 0x3529210e, BRF_GRA }, // 28 PROM (Sprite Palette Green Component) + { "dr27.3j", 0x00100, 0x70d668ef, BRF_GRA }, // 29 PROM (Tile Palette Blue Component) + { "dr29.1l", 0x00100, 0x1173a754, BRF_GRA }, // 30 PROM (Sprite Palette Blue Component) + { "dr32.5p", 0x00020, 0x11cd1f2e, BRF_GRA }, // 31 PROM (Sprite Height) + { "dr33.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 32 PROM (Video Timing) + { "dr28.8f", 0x00200, 0x6cef0fbd, BRF_OPT }, // 33 PROM (Unknown) +}; + +STD_ROM_PICK(Kidniki) +STD_ROM_FN(Kidniki) + +static struct BurnRomInfo KidnikiuRomDesc[] = { + { "dr04.4e", 0x04000, 0x80431858, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "dr03.4cd", 0x04000, 0xdba20934, BRF_ESS | BRF_PRG }, // 1 + { "dr11.8k", 0x08000, 0x04d82d93, BRF_ESS | BRF_PRG }, // 2 + { "dr12.8l", 0x10000, 0xc0b255fd, BRF_ESS | BRF_PRG }, // 3 + + { "dr00.3a", 0x04000, 0x458309f7, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code + { "dr01.3cd", 0x04000, 0xe66897bd, BRF_ESS | BRF_PRG }, // 5 + { "dr02.3f", 0x04000, 0xf9e31e26, BRF_ESS | BRF_PRG }, // 6 + + { "dr06.2b", 0x08000, 0x4d9a970f, BRF_GRA }, // 7 Tiles + { "dr07.2dc", 0x08000, 0xab59a4c4, BRF_GRA }, // 8 + { "dr05.2a", 0x08000, 0x2e6dad0c, BRF_GRA }, // 9 + + { "dr21.4k", 0x04000, 0xa06cea9a, BRF_GRA }, // 10 Sprites + { "dr19.4f", 0x04000, 0xb34605ad, BRF_GRA }, // 11 + { "dr22.4l", 0x04000, 0x41303de8, BRF_GRA }, // 12 + { "dr20.4jh", 0x04000, 0x5fbe6f61, BRF_GRA }, // 13 + { "dr14.3p", 0x04000, 0x76cfbcbc, BRF_GRA }, // 14 + { "dr24.4p", 0x04000, 0xd51c8db5, BRF_GRA }, // 15 + { "dr23.4nm", 0x04000, 0x03469df8, BRF_GRA }, // 16 + { "dr13.3nm", 0x04000, 0xd5c3dfe0, BRF_GRA }, // 17 + { "dr16.4cb", 0x04000, 0xf1d1bb93, BRF_GRA }, // 18 + { "dr18.4e", 0x04000, 0xedb7f25b, BRF_GRA }, // 19 + { "dr17.4dc", 0x04000, 0x4fb87868, BRF_GRA }, // 20 + { "dr15.4a", 0x04000, 0xe0b88de5, BRF_GRA }, // 21 + + { "dr08.4l", 0x04000, 0x32d50643, BRF_GRA }, // 22 Characters + { "dr09.4m", 0x04000, 0x17df6f95, BRF_GRA }, // 23 + { "dr10.4n", 0x04000, 0x820ce252, BRF_GRA }, // 24 + + { "dr25.3f", 0x00100, 0x8e91430b, BRF_GRA }, // 25 PROM (Tile Palette Red Component) + { "dr30.1m", 0x00100, 0x28c73263, BRF_GRA }, // 26 PROM (Sprite Palette Red Component) + { "dr26.3h", 0x00100, 0xb563b93f, BRF_GRA }, // 27 PROM (Tile Palette Green Component) + { "dr31.1n", 0x00100, 0x3529210e, BRF_GRA }, // 28 PROM (Sprite Palette Green Component) + { "dr27.3j", 0x00100, 0x70d668ef, BRF_GRA }, // 29 PROM (Tile Palette Blue Component) + { "dr29.1l", 0x00100, 0x1173a754, BRF_GRA }, // 30 PROM (Sprite Palette Blue Component) + { "dr32.5p", 0x00020, 0x11cd1f2e, BRF_GRA }, // 31 PROM (Sprite Height) + { "dr33.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 32 PROM (Video Timing) + { "dr28.8f", 0x00200, 0x6cef0fbd, BRF_OPT }, // 33 PROM (Unknown) +}; + +STD_ROM_PICK(Kidnikiu) +STD_ROM_FN(Kidnikiu) + +static struct BurnRomInfo YanchamrRomDesc[] = { + { "ky_a-4e-.bin", 0x04000, 0xc73ad2d6, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "ky_a-4d-.bin", 0x04000, 0x401af828, BRF_ESS | BRF_PRG }, // 1 + { "ky_t-8k-.bin", 0x08000, 0xe967de88, BRF_ESS | BRF_PRG }, // 2 + { "ky_t-8l-.bin", 0x08000, 0xa929110b, BRF_ESS | BRF_PRG }, // 3 + + { "ky_a-3a-.bin", 0x04000, 0xcb365f3b, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code + { "dr01.3cd", 0x04000, 0xe66897bd, BRF_ESS | BRF_PRG }, // 5 + { "dr02.3f", 0x04000, 0xf9e31e26, BRF_ESS | BRF_PRG }, // 6 + + { "ky_t-2c-.bin", 0x08000, 0xcb9761fc, BRF_GRA }, // 7 Tiles + { "ky_t-2d-.bin", 0x08000, 0x59732741, BRF_GRA }, // 8 + { "ky_t-2a-.bin", 0x08000, 0x0370fd82, BRF_GRA }, // 9 + + { "ky_b-4k-.bin", 0x04000, 0x263a9d10, BRF_GRA }, // 10 Sprites + { "ky_b-4f-.bin", 0x04000, 0x86e3d4a8, BRF_GRA }, // 11 + { "ky_b-4l-.bin", 0x04000, 0x19fa7558, BRF_GRA }, // 12 + { "ky_b-4h-.bin", 0x04000, 0x93e6665c, BRF_GRA }, // 13 + { "ky_b-3n-.bin", 0x04000, 0x0287c525, BRF_GRA }, // 14 + { "ky_b-4n-.bin", 0x04000, 0x764946e0, BRF_GRA }, // 15 + { "ky_b-4m-.bin", 0x04000, 0xeced5db9, BRF_GRA }, // 16 + { "ky_b-3m-.bin", 0x04000, 0xbe6cee44, BRF_GRA }, // 17 + { "ky_b-4c-.bin", 0x04000, 0x84d6b65d, BRF_GRA }, // 18 + { "ky_b-4e-.bin", 0x04000, 0xf91f9273, BRF_GRA }, // 19 + { "ky_b-4d-.bin", 0x04000, 0xa2fc15f0, BRF_GRA }, // 20 + { "ky_b-4a-.bin", 0x04000, 0xff2b9c8a, BRF_GRA }, // 21 + + { "ky_t-4l-.bin", 0x04000, 0x1d0a9253, BRF_GRA }, // 22 Characters + { "ky_t-4m-.bin", 0x04000, 0x4075c396, BRF_GRA }, // 23 + { "ky_t-4n-.bin", 0x04000, 0x7564f2ff, BRF_GRA }, // 24 + + { "dr25.3f", 0x00100, 0x8e91430b, BRF_GRA }, // 25 PROM (Tile Palette Red Component) + { "dr30.1m", 0x00100, 0x28c73263, BRF_GRA }, // 26 PROM (Sprite Palette Red Component) + { "dr26.3h", 0x00100, 0xb563b93f, BRF_GRA }, // 27 PROM (Tile Palette Green Component) + { "dr31.1n", 0x00100, 0x3529210e, BRF_GRA }, // 28 PROM (Sprite Palette Green Component) + { "dr27.3j", 0x00100, 0x70d668ef, BRF_GRA }, // 29 PROM (Tile Palette Blue Component) + { "dr29.1l", 0x00100, 0x1173a754, BRF_GRA }, // 30 PROM (Sprite Palette Blue Component) + { "dr32.5p", 0x00020, 0x11cd1f2e, BRF_GRA }, // 31 PROM (Sprite Height) + { "dr33.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 32 PROM (Video Timing) + { "dr28.8f", 0x00200, 0x6cef0fbd, BRF_OPT }, // 33 PROM (Unknown) +}; + +STD_ROM_PICK(Yanchamr) +STD_ROM_FN(Yanchamr) + +static struct BurnRomInfo LitheroRomDesc[] = { + { "4.bin", 0x08000, 0x80903766, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "11.bin", 0x08000, 0x7a1ef8cb, BRF_ESS | BRF_PRG }, // 1 + { "12.bin", 0x08000, 0xa929110b, BRF_ESS | BRF_PRG }, // 2 + + { "ky_a-3a-.bin", 0x04000, 0xcb365f3b, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code + { "dr01.3cd", 0x04000, 0xe66897bd, BRF_ESS | BRF_PRG }, // 4 + { "dr02.3f", 0x04000, 0xf9e31e26, BRF_ESS | BRF_PRG }, // 5 + + { "7.bin", 0x08000, 0xb55e8d19, BRF_GRA }, // 6 Tiles + { "6.bin", 0x08000, 0x7bbbb209, BRF_GRA }, // 7 + { "5.bin", 0x08000, 0x0370fd82, BRF_GRA }, // 8 + + { "16.bin", 0x08000, 0x5045a507, BRF_GRA }, // 9 Sprites + { "15.bin", 0x08000, 0x946b16a0, BRF_GRA }, // 10 + { "18.bin", 0x08000, 0x901b69ff, BRF_GRA }, // 11 + { "17.bin", 0x08000, 0x504eed93, BRF_GRA }, // 12 + { "14.bin", 0x08000, 0x429d760b, BRF_GRA }, // 13 + { "13.bin", 0x08000, 0x1700cd64, BRF_GRA }, // 14 + + { "8.bin", 0x04000, 0x4f388d63, BRF_GRA }, // 15 Characters + { "9.bin", 0x04000, 0xdaafa2c1, BRF_GRA }, // 16 + { "10.bin", 0x04000, 0x60649d19, BRF_GRA }, // 17 + + { "dr25.3f", 0x00100, 0x8e91430b, BRF_GRA }, // 18 PROM (Tile Palette Red Component) + { "dr30.1m", 0x00100, 0x28c73263, BRF_GRA }, // 19 PROM (Sprite Palette Red Component) + { "dr26.3h", 0x00100, 0xb563b93f, BRF_GRA }, // 20 PROM (Tile Palette Green Component) + { "dr31.1n", 0x00100, 0x3529210e, BRF_GRA }, // 21 PROM (Sprite Palette Green Component) + { "dr27.3j", 0x00100, 0x70d668ef, BRF_GRA }, // 22 PROM (Tile Palette Blue Component) + { "dr29.1l", 0x00100, 0x1173a754, BRF_GRA }, // 23 PROM (Sprite Palette Blue Component) + { "dr32.5p", 0x00020, 0x11cd1f2e, BRF_GRA }, // 24 PROM (Sprite Height) + { "dr33.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 25 PROM (Video Timing) + { "dr28.8f", 0x00200, 0x6cef0fbd, BRF_OPT }, // 26 PROM (Unknown) +}; + +STD_ROM_PICK(Lithero) +STD_ROM_FN(Lithero) + +static struct BurnRomInfo SpelunkrRomDesc[] = { + { "spra.4e", 0x04000, 0xcf811201, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "spra.4d", 0x04000, 0xbb4faa4f, BRF_ESS | BRF_PRG }, // 1 + { "sprm.7c", 0x04000, 0xfb6197e2, BRF_ESS | BRF_PRG }, // 2 + { "sprm.7b", 0x04000, 0x26bb25a4, BRF_ESS | BRF_PRG }, // 3 + + { "spra.3d", 0x04000, 0x4110363c, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code + { "spra.3f", 0x04000, 0x67a9d2e6, BRF_ESS | BRF_PRG }, // 5 + + { "sprm.1d", 0x04000, 0x4ef7ae89, BRF_GRA }, // 6 Tiles + { "sprm.1e", 0x04000, 0xa3755180, BRF_GRA }, // 7 + { "sprm.3c", 0x04000, 0xb4008e6a, BRF_GRA }, // 8 + { "sprm.3b", 0x04000, 0xf61cf012, BRF_GRA }, // 9 + { "sprm.1c", 0x04000, 0x58b21c76, BRF_GRA }, // 10 + { "sprm.1b", 0x04000, 0xa95cb3e5, BRF_GRA }, // 11 + + { "sprb.4k", 0x04000, 0xe7f0e861, BRF_GRA }, // 12 Sprites + { "sprb.4f", 0x04000, 0x32663097, BRF_GRA }, // 13 + { "sprb.3p", 0x04000, 0x8fbaf373, BRF_GRA }, // 14 + { "sprb.4p", 0x04000, 0x37069b76, BRF_GRA }, // 15 + { "sprb.4c", 0x04000, 0xcfe46a88, BRF_GRA }, // 16 + { "sprb.4e", 0x04000, 0x11c48979, BRF_GRA }, // 17 + + { "sprm.4p", 0x04000, 0x4dfe2e63, BRF_GRA }, // 18 Characters + { "sprm.4l", 0x04000, 0x239f2cd4, BRF_GRA }, // 19 + { "sprm.4m", 0x04000, 0xd6d07d70, BRF_GRA }, // 20 + + { "sprm.2k", 0x00100, 0xfd8fa991, BRF_GRA }, // 21 PROM (Tile Palette Red Component) + { "sprb.1m", 0x00100, 0x8d8cccad, BRF_GRA }, // 22 PROM (Sprite Palette Red Component) + { "sprm.2j", 0x00100, 0x0e3890b4, BRF_GRA }, // 23 PROM (Tile Palette Green Component) + { "sprb.1n", 0x00100, 0xc40e1cb2, BRF_GRA }, // 24 PROM (Sprite Palette Green Component) + { "sprm.2h", 0x00100, 0x0478082b, BRF_GRA }, // 25 PROM (Tile Palette Blue Component) + { "sprb.1l", 0x00100, 0x3ec46248, BRF_GRA }, // 26 PROM (Sprite Palette Blue Component) + { "sprb.5p", 0x00020, 0x746c6238, BRF_GRA }, // 27 PROM (Sprite Height) + { "sprb.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 28 PROM (Video Timing) + { "sprm.8h", 0x00200, 0x875cc442, BRF_OPT }, // 29 PROM (Unknown) +}; + +STD_ROM_PICK(Spelunkr) +STD_ROM_FN(Spelunkr) + +static struct BurnRomInfo SpelunkrjRomDesc[] = { + { "spr_a4ec.bin", 0x04000, 0x4e94a80c, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "spr_a4dd.bin", 0x04000, 0xe7c0cbce, BRF_ESS | BRF_PRG }, // 1 + { "spr_m7cc.bin", 0x04000, 0x57598a36, BRF_ESS | BRF_PRG }, // 2 + { "spr_m7bd.bin", 0x04000, 0xecf5137f, BRF_ESS | BRF_PRG }, // 3 + + { "spra.3d", 0x04000, 0x4110363c, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code + { "spra.3f", 0x04000, 0x67a9d2e6, BRF_ESS | BRF_PRG }, // 5 + + { "sprm.1d", 0x04000, 0x4ef7ae89, BRF_GRA }, // 6 Tiles + { "sprm.1e", 0x04000, 0xa3755180, BRF_GRA }, // 7 + { "sprm.3c", 0x04000, 0xb4008e6a, BRF_GRA }, // 8 + { "sprm.3b", 0x04000, 0xf61cf012, BRF_GRA }, // 9 + { "sprm.1c", 0x04000, 0x58b21c76, BRF_GRA }, // 10 + { "sprm.1b", 0x04000, 0xa95cb3e5, BRF_GRA }, // 11 + + { "sprb.4k", 0x04000, 0xe7f0e861, BRF_GRA }, // 12 Sprites + { "sprb.4f", 0x04000, 0x32663097, BRF_GRA }, // 13 + { "sprb.3p", 0x04000, 0x8fbaf373, BRF_GRA }, // 14 + { "sprb.4p", 0x04000, 0x37069b76, BRF_GRA }, // 15 + { "sprb.4c", 0x04000, 0xcfe46a88, BRF_GRA }, // 16 + { "sprb.4e", 0x04000, 0x11c48979, BRF_GRA }, // 17 + + { "sprm.4p", 0x04000, 0x4dfe2e63, BRF_GRA }, // 18 Characters + { "sprm.4l", 0x04000, 0x239f2cd4, BRF_GRA }, // 19 + { "sprm.4m", 0x04000, 0xd6d07d70, BRF_GRA }, // 20 + + { "sprm.2k", 0x00100, 0xfd8fa991, BRF_GRA }, // 21 PROM (Tile Palette Red Component) + { "sprb.1m", 0x00100, 0x8d8cccad, BRF_GRA }, // 22 PROM (Sprite Palette Red Component) + { "sprm.2j", 0x00100, 0x0e3890b4, BRF_GRA }, // 23 PROM (Tile Palette Green Component) + { "sprb.1n", 0x00100, 0xc40e1cb2, BRF_GRA }, // 24 PROM (Sprite Palette Green Component) + { "sprm.2h", 0x00100, 0x0478082b, BRF_GRA }, // 25 PROM (Tile Palette Blue Component) + { "sprb.1l", 0x00100, 0x3ec46248, BRF_GRA }, // 26 PROM (Sprite Palette Blue Component) + { "sprb.5p", 0x00020, 0x746c6238, BRF_GRA }, // 27 PROM (Sprite Height) + { "sprb.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 28 PROM (Video Timing) + { "sprm.8h", 0x00200, 0x875cc442, BRF_OPT }, // 29 PROM (Unknown) +}; + +STD_ROM_PICK(Spelunkrj) +STD_ROM_FN(Spelunkrj) + +static struct BurnRomInfo Spelunk2RomDesc[] = { + { "sp2-a.4e", 0x04000, 0x96c04bbb, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "sp2-a.4d", 0x04000, 0xcb38c2ff, BRF_ESS | BRF_PRG }, // 1 + { "sp2-r.7d", 0x08000, 0x558837ea, BRF_ESS | BRF_PRG }, // 2 + { "sp2-r.7c", 0x08000, 0x4b380162, BRF_ESS | BRF_PRG }, // 3 + { "sp2-r.7b", 0x04000, 0x7709a1fe, BRF_ESS | BRF_PRG }, // 4 + + { "sp2-a.3d", 0x04000, 0x839ec7e2, BRF_ESS | BRF_PRG }, // 5 M6803 Program Code + { "sp2-a.3f", 0x04000, 0xad3ce898, BRF_ESS | BRF_PRG }, // 6 + + { "sp2-r.1d", 0x08000, 0xc19fa4c9, BRF_GRA }, // 7 Tiles + { "sp2-r.3b", 0x08000, 0x366604af, BRF_GRA }, // 8 + { "sp2-r.1b", 0x08000, 0x3a0c4d47, BRF_GRA }, // 9 + + { "sp2-b.4k", 0x04000, 0x6cb67a17, BRF_GRA }, // 10 Sprites + { "sp2-b.4f", 0x04000, 0xe4a1166f, BRF_GRA }, // 11 + { "sp2-b.3n", 0x04000, 0xf59e8b76, BRF_GRA }, // 12 + { "sp2-b.4n", 0x04000, 0xfa65bac9, BRF_GRA }, // 13 + { "sp2-b.4c", 0x04000, 0x1caf7013, BRF_GRA }, // 14 + { "sp2-b.4e", 0x04000, 0x780a463b, BRF_GRA }, // 15 + + { "sp2-r.4l", 0x04000, 0x6a4b2d8b, BRF_GRA }, // 16 Characters + { "sp2-r.4m", 0x04000, 0xe1368b61, BRF_GRA }, // 17 + { "sp2-r.4p", 0x04000, 0xfc138e13, BRF_GRA }, // 18 + + { "sp2-r.1k", 0x00200, 0x31c1bcdc, BRF_GRA }, // 19 PROM (Char Palette Red and Green Component) + { "sp2-r.2k", 0x00100, 0x1cf5987e, BRF_GRA }, // 20 PROM (Char Palette Blue Component) + { "sp2-r.2j", 0x00100, 0x1acbe2a5, BRF_GRA }, // 21 PROM (Char Palette Blue Component) + { "sp2-b.1m", 0x00100, 0x906104c7, BRF_GRA }, // 22 PROM (Sprite Palette Red Component) + { "sp2-b.1n", 0x00100, 0x5a564c06, BRF_GRA }, // 23 PROM (Sprite Palette Green Component) + { "sp2-b.1l", 0x00100, 0x8f4a2e3c, BRF_GRA }, // 24 PROM (Sprite Palette Blue Component) + { "sp2-b.5p", 0x00020, 0xcd126f6a, BRF_GRA }, // 25 PROM (Sprite Height) + { "sp2-b.6f", 0x00100, 0x34d88d3c, BRF_GRA }, // 26 PROM (Video Timing) + { "sp2-r.8j", 0x00200, 0x875cc442, BRF_OPT }, // 27 PROM (Unknown) + + { "ampal16r4a-sp2-r-3h.bin", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, // 28 PAL +}; + +STD_ROM_PICK(Spelunk2) +STD_ROM_FN(Spelunk2) + +static struct BurnRomInfo YoujyudnRomDesc[] = { + { "yju_a4eb.bin", 0x04000, 0x0d356bdc, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "yju_a4db.bin", 0x04000, 0xc169be13, BRF_ESS | BRF_PRG }, // 1 + { "yju_p4cb.0", 0x04000, 0x60baf3b1, BRF_ESS | BRF_PRG }, // 2 + { "yju_p4eb.1", 0x04000, 0x8d0521f8, BRF_ESS | BRF_PRG }, // 3 + + { "yju_a3fb.bin", 0x04000, 0xe15c8030, BRF_ESS | BRF_PRG }, // 4 M6803 Program Code + + { "yju_p3bb.0", 0x08000, 0xc017913c, BRF_GRA }, // 5 Tiles + { "yju_p1bb.1", 0x08000, 0x94627523, BRF_GRA }, // 6 + { "yju_p1cb.2", 0x08000, 0x6a378c56, BRF_GRA }, // 7 + + { "yju_b4ka.00", 0x04000, 0x1bbb864a, BRF_GRA }, // 8 Sprites + { "yju_b4fa.01", 0x04000, 0x14b4dd24, BRF_GRA }, // 9 + { "yju_b3na.10", 0x04000, 0x68879321, BRF_GRA }, // 10 + { "yju_b4na.11", 0x04000, 0x2860a68b, BRF_GRA }, // 11 + { "yju_b4ca.20", 0x04000, 0xab365829, BRF_GRA }, // 12 + { "yju_b4ea.21", 0x04000, 0xb36c31e4, BRF_GRA }, // 13 + + { "yju_p4lb.2", 0x04000, 0x87878d9b, BRF_GRA }, // 14 Characters + { "yju_p4mb.1", 0x04000, 0x1e1a0d09, BRF_GRA }, // 15 + { "yju_p4pb.0", 0x04000, 0xb4ab520b, BRF_GRA }, // 16 + + { "yju_p2jb.bpr", 0x00100, 0xa4483631, BRF_GRA }, // 17 PROM (Tile Palette Red Component) + { "yju_b1ma.r", 0x00100, 0xa8340e13, BRF_GRA }, // 18 PROM (Sprite Palette Red Component) + { "yju_p2kb.bpr", 0x00100, 0x85481103, BRF_GRA }, // 19 PROM (Tile Palette Green Component) + { "yju_b1na.g", 0x00100, 0xf5b4bc41, BRF_GRA }, // 20 PROM (Sprite Palette Green Component) + { "yju_p2hb.bpr", 0x00100, 0xa6fd355c, BRF_GRA }, // 21 PROM (Tile Palette Blue Component) + { "yju_b1la.b", 0x00100, 0x45e10491, BRF_GRA }, // 22 PROM (Sprite Palette Blue Component) + { "yju_b-5p.bpr", 0x00020, 0x2095e6a3, BRF_GRA }, // 23 PROM (Sprite Height) + { "yju_b-6f.bpr", 0x00100, 0x82c20d12, BRF_GRA }, // 24 PROM (Video Timing) + { "yju_p-8d.bpr", 0x00200, 0x6cef0fbd, BRF_OPT }, // 25 PROM (Unknown) + + { "yju_b-pal16r4a-8m.pal", 0x00104, 0x3ece8e61, BRF_OPT }, // 26 PAL +}; + +STD_ROM_PICK(Youjyudn) +STD_ROM_FN(Youjyudn) + +static struct BurnRomInfo HorizonRomDesc[] = { + { "hrza-4e", 0x04000, 0x98b96ba2, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "hrza-4d", 0x04000, 0x06b06ac7, BRF_ESS | BRF_PRG }, // 1 + { "hrza-4b", 0x04000, 0x39c0bd02, BRF_ESS | BRF_PRG }, // 2 + + { "hrza-3f", 0x04000, 0x7412c99f, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code + + { "hrzd-4d", 0x02000, 0xb93ed581, BRF_GRA }, // 4 Tiles + { "hrzd-4c", 0x02000, 0x1cf73b53, BRF_GRA }, // 5 + { "hrzd-4a", 0x02000, 0xeace8d53, BRF_GRA }, // 6 + + { "hrzb-4k.00", 0x04000, 0x11d2f3a1, BRF_GRA }, // 7 Sprites + { "hrzb-4f.01", 0x04000, 0x356902ea, BRF_GRA }, // 8 + { "hrzb-3n.10", 0x04000, 0x87078a02, BRF_GRA }, // 9 + { "hrzb-4n.11", 0x04000, 0x5019cb1f, BRF_GRA }, // 10 + { "hrzb-4c.20", 0x04000, 0x90b385e7, BRF_GRA }, // 11 + { "hrzb-4e.21", 0x04000, 0xd05d77a2, BRF_GRA }, // 12 + + { "hrzd-1d", 0x00100, 0xb33b08f9, BRF_GRA }, // 13 PROM (Tile Palette Red Component) + { "hrzb-1m.r", 0x00100, 0x0871690a, BRF_GRA }, // 14 PROM (Sprite Palette Red Component) + { "hrzd-1c", 0x00100, 0x6e696f3a, BRF_GRA }, // 15 PROM (Tile Palette Green Component) + { "hrzb-1n.g", 0x00100, 0xf247d0a9, BRF_GRA }, // 16 PROM (Sprite Palette Green Component) + { "hrzd-1e", 0x00100, 0x1fa60379, BRF_GRA }, // 17 PROM (Tile Palette Blue Component) + { "hrzb-1l.b", 0x00100, 0x9ad0a0c8, BRF_GRA }, // 18 PROM (Sprite Palette Blue Component) + { "hrzb-5p", 0x00020, 0x208b49e9, BRF_GRA }, // 19 PROM (Sprite Height) + { "hrzb-6f", 0x00100, 0x82c20d12, BRF_GRA }, // 20 PROM (Video Timing) +}; + +STD_ROM_PICK(Horizon) +STD_ROM_FN(Horizon) + +static INT32 M62MemIndex() +{ + UINT8 *Next; Next = Mem; + + if (!M62BgxTileDim) M62BgxTileDim = 8; + if (!M62BgyTileDim) M62BgyTileDim = 8; + if (!M62CharxTileDim) M62CharxTileDim = 8; + if (!M62CharyTileDim) M62CharyTileDim = 8; + if (!M62SpriteRamSize) M62SpriteRamSize = 0x100; + + M62Z80Rom = Next; Next += M62Z80RomSize; + M62M6803Rom = Next; Next += 0x0c000; + + RamStart = Next; + + M62SpriteRam = Next; Next += M62SpriteRamSize; + M62TileRam = Next; Next += 0x02000; + if (M62CharRamSize) M62CharRam = Next; Next += M62CharRamSize; + if (M62ScrollRamSize) M62ScrollRam = Next; Next += M62ScrollRamSize; + M62Z80Ram = Next; Next += 0x01000; + M62M6803Ram = Next; Next += 0x00080; + + RamEnd = Next; + + M62Tiles = Next; Next += M62NumTiles * M62BgxTileDim * M62BgyTileDim; + M62Sprites = Next; Next += M62NumSprites * 16 * 16; + if (M62NumChars) M62Chars = Next; Next += M62NumChars * M62CharxTileDim * M62CharyTileDim; + M62Palette = (UINT32*)Next; Next += M62PaletteEntries * sizeof(UINT32); + M62PromData = Next; Next += M62PromSize; + pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static INT32 M62DoReset() +{ + ZetOpen(0); + ZetReset(); + ZetClose(); + + M6803Reset(); + + AY8910Reset(0); + AY8910Reset(1); + + MSM5205Reset(); + + M62BackgroundHScroll = 0; + M62BackgroundVScroll = 0; + M62CharHScroll = 0; + M62CharVScroll = 0; + M62FlipScreen = 0; + M62SoundLatch = 0; + M62Port1 = 0; + M62Port2 = 0; + M62SlaveMSM5205VClckReset = 0; + M62BankControl[0] = M62BankControl[1] = 0; + Ldrun2BankSwap = 0; + Ldrun3TopBottomMask = 0; + KidnikiBackgroundBank = 0; + SpelunkrPaletteBank = 0; + + return 0; +} + +UINT8 __fastcall M62Z80Read(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall M62Z80Write(UINT16 a, UINT8 d) +{ + if (a <= 0xbfff) return; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall KungfumZ80Read(UINT16 a) +{ + switch (a) { + case 0xf000: + case 0xf001: + case 0xf002: + case 0xf003: { + // ??? + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall KungfumZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xa000: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; + return; + } + + case 0xb000: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Ldrun3Z80Read(UINT16 a) +{ + switch (a) { + case 0xc800: { + return 0x05; + } + + case 0xcc00: { + return 0x07; + } + + case 0xcfff: { + return 0x07; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall Ldrun4Z80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xc800: { + INT32 BankAddress = 0x8000 + ((d & 0x01) * 0x4000); + ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + BankAddress); + ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + BankAddress); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall SpelunkrZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xd000: { + M62BackgroundVScroll = (M62BackgroundVScroll & 0xff00) | d; + return; + } + + case 0xd001: { + M62BackgroundVScroll = (M62BackgroundVScroll & 0x00ff) | (d << 8); + return; + } + + case 0xd002: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; + return; + } + + case 0xd003: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); + return; + } + + case 0xd004: { + INT32 BankAddress = 0x8000 + ((d & 0x03) * 0x2000); + ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + BankAddress); + ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + BankAddress); + return; + } + + case 0xd005: { + SpelunkrPaletteBank = d & 0x01; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall Spelunk2Z80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xd000: { + M62BackgroundVScroll = (M62BackgroundVScroll & 0xff00) | d; + return; + } + + case 0xd001: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; + return; + } + + case 0xd002: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (((d & 0x02) >> 1) << 8); + M62BackgroundVScroll = (M62BackgroundVScroll & 0x00ff) | ((d & 0x01) << 8); + SpelunkrPaletteBank = (d & 0x0c) >> 2; + return; + } + + case 0xd003: { + INT32 BankAddress1 = 0x18000 + (((d & 0xc0) >> 6) * 0x1000); + INT32 BankAddress2 = 0x08000 + (((d & 0x3c) >> 2) * 0x1000); + ZetMapArea(0x8000, 0x8fff, 0, M62Z80Rom + BankAddress1); + ZetMapArea(0x8000, 0x8fff, 2, M62Z80Rom + BankAddress1); + ZetMapArea(0x9000, 0x9fff, 0, M62Z80Rom + BankAddress2); + ZetMapArea(0x9000, 0x9fff, 2, M62Z80Rom + BankAddress2); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall M62Z80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return 0xff - M62Input[0]; + } + + case 0x01: { + return 0xff - M62Input[1]; + } + + case 0x02: { + return 0xff - M62Input[2]; + } + + case 0x03: { + return M62Dip[0]; + } + + case 0x04: { + return M62Dip[1]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall M62Z80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + if ((d & 0x80) == 0) { + M62SoundLatch = d & 0x7f; + } else { + M6803SetIRQLine(M6803_IRQ_LINE, M6803_IRQSTATUS_ACK); + } + return; + } + + case 0x01: { + d ^= ~M62Dip[1] & 0x01; + M62FlipScreen = d & 0x01; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall BattroadZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + if (a <= 0x01) { + M62Z80PortWrite(a, d); + return; + } + + switch (a) { + case 0x80: { + M62BackgroundVScroll = (M62BackgroundVScroll & 0xff00) | d; + return; + } + + case 0x81: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); + return; + } + + case 0x82: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; + return; + } + + case 0x83: { + INT32 BankAddress = 0x8000 + ((d & 0x0f) * 0x2000); + ZetMapArea(0xa000, 0xbfff, 0, M62Z80Rom + BankAddress); + ZetMapArea(0xa000, 0xbfff, 2, M62Z80Rom + BankAddress); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Ldrun2Z80PortRead(UINT16 a) +{ + a &= 0xff; + + if (a <= 0x04) return M62Z80PortRead(a); + + switch (a) { + case 0x80: { + if (Ldrun2BankSwap) { + Ldrun2BankSwap--; + if (Ldrun2BankSwap == 0) { + ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + 0xa000); + ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + 0xa000); + } + } + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall Ldrun2Z80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + if (a <= 0x01) { + M62Z80PortWrite(a, d); + return; + } + + switch (a) { + case 0x80: + case 0x81: { + static const INT32 Banks[30] = { 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 }; + INT32 Offset = a - 0x80; + + M62BankControl[Offset] = d; + + if (Offset == 0x00) { + if (d >= 1 && d <= 30) { + INT32 BankAddress = 0x8000 + (Banks[d - 1] * 0x2000); + ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + BankAddress); + ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + BankAddress); + } + } else { + if (M62BankControl[0] == 0x01 && d == 0x0d) { + Ldrun2BankSwap = 2; + } else { + Ldrun2BankSwap = 0; + } + } + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall Ldrun3Z80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + if (a <= 0x01) { + M62Z80PortWrite(a, d); + return; + } + + switch (a) { + case 0x80: { + M62BackgroundVScroll = (M62BackgroundVScroll & 0xff00) | d; + return; + } + + case 0x81: { + Ldrun3TopBottomMask = d & 0x01; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall Ldrun4Z80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + if (a <= 0x01) { + M62Z80PortWrite(a, d); + return; + } + + switch (a) { + case 0x80: { + // ??? + return; + } + + case 0x81: { + // ??? + return; + } + + case 0x82: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); + return; + } + + case 0x83: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall KidnikiZ80PortRead(UINT16 a) +{ + a &= 0xff; + + if (a <= 0x04) return M62Z80PortRead(a); + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall KidnikiZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + if (a <= 0x01) { + M62Z80PortWrite(a, d); + return; + } + + switch (a) { + case 0x80: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; + return; + } + + case 0x81: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); + return; + } + + case 0x82: { + M62CharVScroll = (M62CharVScroll & 0xff00) | d; + return; + } + + case 0x83: { + M62CharVScroll = (M62CharVScroll & 0x00ff) | (d << 8); + return; + } + + case 0x84: { + KidnikiBackgroundBank = d & 0x01; + return; + } + + case 0x85: { + INT32 BankAddress = 0x8000 + ((d & 0x0f) * 0x2000); + ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + BankAddress); + ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + BankAddress); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall YoujyudnZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + if (a <= 0x01) { + M62Z80PortWrite(a, d); + return; + } + + switch (a) { + case 0x80: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0x00ff) | (d << 8); + return; + } + + case 0x81: { + M62BackgroundHScroll = (M62BackgroundHScroll & 0xff00) | d; + return; + } + + case 0x83: { + INT32 BankAddress = 0x8000 + ((d & 0x01) * 0x4000); + ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + BankAddress); + ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + BankAddress); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 M62M6803ReadByte(UINT16 a) +{ + if (a <= 0x001f) { + return m6803_internal_registers_r(a); + } + + if (a >= 0x0080 && a <= 0x00ff) { + return M62M6803Ram[a - 0x0080]; + } + + bprintf(PRINT_NORMAL, _T("M6803 Read Byte -> %04X\n"), a); + + return 0; +} + +void M62M6803WriteByte(UINT16 a, UINT8 d) +{ + if (a <= 0x001f) { + m6803_internal_registers_w(a, d); + return; + } + + if (a >= 0x0080 && a <= 0x00ff) { + M62M6803Ram[a - 0x0080] = d; + return; + } + + switch (a) { + case 0x0800: { + M6803SetIRQLine(M6803_IRQ_LINE, M6803_IRQSTATUS_NONE); + return; + } + + case 0x0801: { + MSM5205DataWrite(0, d); + return; + } + + case 0x0802: { + MSM5205DataWrite(1, d); + return; + } + } + + bprintf(PRINT_NORMAL, _T("M6803 Write Byte -> %04X, %02X\n"), a, d); +} + +UINT8 M62M6803ReadPort(UINT16 a) +{ + switch (a) { + case M6803_PORT1: { + if (M62Port2 & 0x08) return AY8910Read(0); + if (M62Port2 & 0x10) return AY8910Read(1); + return 0xff; + } + + case M6803_PORT2: { + return 0; + } + } + + bprintf(PRINT_NORMAL, _T("M6803 Read Port -> %04X\n"), a); + + return 0; +} + +void M62M6803WritePort(UINT16 a, UINT8 d) +{ + switch (a) { + case M6803_PORT1: { + M62Port1 = d; + return; + } + + case M6803_PORT2: { + if ((M62Port2 & 0x01) && !(d & 0x01)) { + if (M62Port2 & 0x04) { + if (M62Port2 & 0x08) { + AY8910Write(0, 0, M62Port1); + } + if (M62Port2 & 0x10) { + AY8910Write(1, 0, M62Port1); + } + } else { + if (M62Port2 & 0x08) { + AY8910Write(0, 1, M62Port1); + } + if (M62Port2 & 0x10) { + AY8910Write(1, 1, M62Port1); + } + } + } + + M62Port2 = d; + return; + } + } + + bprintf(PRINT_NORMAL, _T("M6803 Write Port -> %04X, %02X\n"), a, d); +} + +static INT32 Tile1024PlaneOffsets[3] = { 0x20000, 0x10000, 0 }; +static INT32 Tile2048PlaneOffsets[3] = { 0x40000, 0x20000, 0 }; +static INT32 Tile4096PlaneOffsets[3] = { 0x80000, 0x40000, 0 }; +static INT32 TileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 TileYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 KungfumSpritePlaneOffsets[3] = { 0x80000, 0x40000, 0 }; +static INT32 BattroadSpritePlaneOffsets[3] = { 0x40000, 0x20000, 0 }; +static INT32 LdrunSpritePlaneOffsets[3] = { 0x20000, 0x10000, 0 }; +static INT32 KidnikiSpritePlaneOffsets[3] = { 0x100000, 0x80000, 0 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; +static INT32 BattroadCharPlaneOffsets[2] = { 0, 0x10000 }; +static INT32 LotlotPlaneOffsets[3] = { 0, 0x10000, 0x20000 }; +static INT32 LotlotXOffsets[12] = { 0, 1, 2, 3, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 LotlotYOffsets[10] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72 }; +static INT32 KidnikiPlaneOffsets[3] = { 0, 0x20000, 0x40000 }; +static INT32 KidnikiXOffsets[12] = { 0, 1, 2, 3, 64, 65, 66, 67, 68, 69, 70, 71 }; +static INT32 KidnikiYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 Spelunk2PlaneOffsets[3] = { 0, 0x20000, 0x40000 }; +static INT32 Spelunk2XOffsets[12] = { 0, 1, 2, 3, 0x10000, 0x10001, 0x10002, 0x10003, 0x10004, 0x10005, 0x10006, 0x10007 }; +static INT32 Spelunk2YOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 YoujyudnTilePlaneOffsets[3] = { 0x40000, 0x20000, 0 }; +static INT32 YoujyudnTileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 YoujyudnTileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; + +UINT8 M62SoundLatchRead(UINT32) +{ + return M62SoundLatch; +} + +static void AY8910_0PortBWrite(UINT32, UINT32 d) +{ + MSM5205PlaymodeWrite(0, (d >> 2) & 0x07); + MSM5205PlaymodeWrite(1, ((d >> 2) & 0x04) | 0x03); + + MSM5205ResetWrite(0, d & 0x01); + MSM5205ResetWrite(1, d & 0x02); +} + +inline static INT32 M62SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)((double)ZetTotalCycles() * nSoundRate / M62Z80Clock); +} + +static void M62MSM5205Vck0() +{ + M6803SetIRQLine(M6803_INPUT_LINE_NMI, M6803_IRQSTATUS_AUTO); + M62SlaveMSM5205VClckReset = 1; +} + +static INT32 M62MemInit() +{ + INT32 nLen; + + M62PaletteEntries = BurnDrvGetPaletteEntries(); + + Mem = NULL; + M62MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + M62MemIndex(); + + return 0; +} + +static INT32 KungfumLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x06000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 7, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x06000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0a000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0c000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0e000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x12000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x14000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x16000, 19, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 27, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 KungfumdLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x04000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 3, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 6, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0c000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x14000, 12, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 20, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 Kungfub3LoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x06000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 7, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0c000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x14000, 13, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 21, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 BattroadLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x0c000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x02000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x06000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x08000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x0a000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x0c000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x0e000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x10000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x14000, 9, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x06000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 12, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x0c000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 15, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x0c000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x06000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0a000, 21, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, BattroadSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load and decode the chars + memset(M62TempRom, 0, 0x0c000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 23, 1); if (nRet != 0) return 1; + GfxDecode(M62NumChars, 2, M62CharxTileDim, M62CharyTileDim, BattroadCharPlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Chars); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 27, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 28, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 29, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 30, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 31, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00720, 32, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 LdrunLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x06000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x02000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x06000, 3, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 5, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x06000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 8, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x06000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 11, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, LdrunSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 19, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 Ldrun2LoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x0c000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x02000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x06000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x08000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x0a000, 5, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x06000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 8, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x0c000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 11, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x0c000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x06000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0a000, 17, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, BattroadSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 25, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 Ldrun3LoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x04000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 7, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile2048PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0c000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x14000, 13, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 21, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 Ldrun3jLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x0c000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x04000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x0c000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 7, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile2048PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x0c000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 10, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, BattroadSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 18, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 LotlotLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x06000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x0a000, 2, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x06000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 5, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, LotlotPlaneOffsets, LotlotXOffsets, LotlotYOffsets, 0x100, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x06000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 8, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, LdrunSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load and decode the chars + memset(M62TempRom, 0, 0x06000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 11, 1); if (nRet != 0) return 1; + GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, LotlotPlaneOffsets, LotlotXOffsets, LotlotYOffsets, 0x100, M62TempRom, M62Chars); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00700, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00800, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00900, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00920, 22, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 KidnikiLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x30000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x10000, 3, 1); if (nRet != 0) return 1; + memcpy(M62Z80Rom + 0x20000, M62Z80Rom + 0x18000, 0x8000); + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x00000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x04000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 6, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x30000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 9, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile4096PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x30000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0c000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x14000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x18000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x1c000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x20000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x24000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x28000, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x2c000, 21, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, KidnikiSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load and decode the chars + memset(M62TempRom, 0, 0x30000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 24, 1); if (nRet != 0) return 1; + GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, KidnikiPlaneOffsets, KidnikiXOffsets, KidnikiYOffsets, 0x80, M62TempRom, M62Chars); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 27, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 28, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 29, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 30, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 31, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 32, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 LitheroLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x30000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x08000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x10000, 2, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x04000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 5, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x30000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 8, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile4096PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x30000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x18000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x20000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x28000, 14, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, KidnikiSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load and decode the chars + memset(M62TempRom, 0, 0x30000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 17, 1); if (nRet != 0) return 1; + GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, KidnikiPlaneOffsets, KidnikiXOffsets, KidnikiYOffsets, 0x80, M62TempRom, M62Chars); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 25, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 SpelunkrLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x0c000, 3, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x04000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 5, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0c000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x14000, 11, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile4096PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0c000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x14000, 17, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load and decode the chars + memset(M62TempRom, 0, 0x18000); + UINT8 *pTemp = (UINT8*)BurnMalloc(0x18000); + nRet = BurnLoadRom(pTemp + 0x00000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(pTemp + 0x04000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(pTemp + 0x08000, 20, 1); if (nRet != 0) return 1; + memcpy(M62TempRom + 0x0000, pTemp + 0x0000, 0x800); + memcpy(M62TempRom + 0x2000, pTemp + 0x0800, 0x800); + memcpy(M62TempRom + 0x0800, pTemp + 0x1000, 0x800); + memcpy(M62TempRom + 0x2800, pTemp + 0x1800, 0x800); + memcpy(M62TempRom + 0x1000, pTemp + 0x2000, 0x800); + memcpy(M62TempRom + 0x3000, pTemp + 0x2800, 0x800); + memcpy(M62TempRom + 0x0800, pTemp + 0x3000, 0x800); + memcpy(M62TempRom + 0x3800, pTemp + 0x3800, 0x800); + memcpy(M62TempRom + 0x4000, pTemp + 0x4000, 0x800); + memcpy(M62TempRom + 0x6000, pTemp + 0x4800, 0x800); + memcpy(M62TempRom + 0x4800, pTemp + 0x5000, 0x800); + memcpy(M62TempRom + 0x6800, pTemp + 0x5800, 0x800); + memcpy(M62TempRom + 0x5000, pTemp + 0x6000, 0x800); + memcpy(M62TempRom + 0x7000, pTemp + 0x6800, 0x800); + memcpy(M62TempRom + 0x5800, pTemp + 0x7000, 0x800); + memcpy(M62TempRom + 0x7800, pTemp + 0x7800, 0x800); + memcpy(M62TempRom + 0x8000, pTemp + 0x8000, 0x800); + memcpy(M62TempRom + 0xa000, pTemp + 0x8800, 0x800); + memcpy(M62TempRom + 0x8800, pTemp + 0x9000, 0x800); + memcpy(M62TempRom + 0xa800, pTemp + 0x9800, 0x800); + memcpy(M62TempRom + 0x9000, pTemp + 0xa000, 0x800); + memcpy(M62TempRom + 0xb000, pTemp + 0xa800, 0x800); + memcpy(M62TempRom + 0x9800, pTemp + 0xb000, 0x800); + memcpy(M62TempRom + 0xb800, pTemp + 0xb800, 0x800); + BurnFree(pTemp); + GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, Spelunk2PlaneOffsets, Spelunk2XOffsets, Spelunk2YOffsets, 0x40, M62TempRom, M62Chars); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 27, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 28, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 Spelunk2LoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x10000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x18000, 4, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x04000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 6, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 9, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile4096PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0c000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x14000, 15, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load and decode the chars + memset(M62TempRom, 0, 0x18000); + UINT8 *pTemp = (UINT8*)BurnMalloc(0x18000); + nRet = BurnLoadRom(pTemp + 0x00000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(pTemp + 0x04000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(pTemp + 0x08000, 18, 1); if (nRet != 0) return 1; + memcpy(M62TempRom + 0x0000, pTemp + 0x0000, 0x800); + memcpy(M62TempRom + 0x2000, pTemp + 0x0800, 0x800); + memcpy(M62TempRom + 0x0800, pTemp + 0x1000, 0x800); + memcpy(M62TempRom + 0x2800, pTemp + 0x1800, 0x800); + memcpy(M62TempRom + 0x1000, pTemp + 0x2000, 0x800); + memcpy(M62TempRom + 0x3000, pTemp + 0x2800, 0x800); + memcpy(M62TempRom + 0x0800, pTemp + 0x3000, 0x800); + memcpy(M62TempRom + 0x3800, pTemp + 0x3800, 0x800); + memcpy(M62TempRom + 0x4000, pTemp + 0x4000, 0x800); + memcpy(M62TempRom + 0x6000, pTemp + 0x4800, 0x800); + memcpy(M62TempRom + 0x4800, pTemp + 0x5000, 0x800); + memcpy(M62TempRom + 0x6800, pTemp + 0x5800, 0x800); + memcpy(M62TempRom + 0x5000, pTemp + 0x6000, 0x800); + memcpy(M62TempRom + 0x7000, pTemp + 0x6800, 0x800); + memcpy(M62TempRom + 0x5800, pTemp + 0x7000, 0x800); + memcpy(M62TempRom + 0x7800, pTemp + 0x7800, 0x800); + memcpy(M62TempRom + 0x8000, pTemp + 0x8000, 0x800); + memcpy(M62TempRom + 0xa000, pTemp + 0x8800, 0x800); + memcpy(M62TempRom + 0x8800, pTemp + 0x9000, 0x800); + memcpy(M62TempRom + 0xa800, pTemp + 0x9800, 0x800); + memcpy(M62TempRom + 0x9000, pTemp + 0xa000, 0x800); + memcpy(M62TempRom + 0xb000, pTemp + 0xa800, 0x800); + memcpy(M62TempRom + 0x9800, pTemp + 0xb000, 0x800); + memcpy(M62TempRom + 0xb800, pTemp + 0xb800, 0x800); + BurnFree(pTemp); + GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, Spelunk2PlaneOffsets, Spelunk2XOffsets, Spelunk2YOffsets, 0x40, M62TempRom, M62Chars); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00700, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00720, 26, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 YoujyudnLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x0c000, 3, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x18000); + UINT8 *pTemp = (UINT8*)BurnMalloc(0x18000); + nRet = BurnLoadRom(pTemp + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(pTemp + 0x08000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(pTemp + 0x10000, 7, 1); if (nRet != 0) return 1; + memcpy(M62TempRom + 0x0000, pTemp + 0x04000, 0x4000); + memcpy(M62TempRom + 0x4000, pTemp + 0x0c000, 0x4000); + memcpy(M62TempRom + 0x8000, pTemp + 0x14000, 0x4000); + BurnFree(pTemp); + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, YoujyudnTilePlaneOffsets, YoujyudnTileXOffsets, YoujyudnTileYOffsets, 0x80, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0c000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x14000, 13, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load and decode the chars + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 16, 1); if (nRet != 0) return 1; + GfxDecode(M62NumChars, 3, M62CharxTileDim, M62CharyTileDim, KidnikiPlaneOffsets, KidnikiXOffsets, KidnikiYOffsets, 0x80, M62TempRom, M62Chars); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 24, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static INT32 HorizonLoadRoms() +{ + INT32 nRet = 0; + + M62TempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(M62Z80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62Z80Rom + 0x08000, 2, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(M62M6803Rom + 0x08000, 3, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x02000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 6, 1); if (nRet != 0) return 1; + GfxDecode(M62NumTiles, 3, M62BgxTileDim, M62BgyTileDim, Tile1024PlaneOffsets, TileXOffsets, TileYOffsets, 0x40, M62TempRom, M62Tiles); + + // Load and decode the sprites + memset(M62TempRom, 0, 0x18000); + nRet = BurnLoadRom(M62TempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x04000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x08000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x0c000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x10000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62TempRom + 0x14000, 12, 1); if (nRet != 0) return 1; + GfxDecode(M62NumSprites, 3, 16, 16, KungfumSpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, M62TempRom, M62Sprites); + + // Load the Proms + nRet = BurnLoadRom(M62PromData + 0x00000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00100, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00200, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00300, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00400, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00500, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00600, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(M62PromData + 0x00620, 20, 1); if (nRet != 0) return 1; + + BurnFree(M62TempRom); + + return 0; +} + +static void M62MachineInit() +{ +// BurnSetRefreshRate(55.0); + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(M62Z80Read); + ZetSetWriteHandler(M62Z80Write); + ZetSetInHandler(M62Z80PortRead); + ZetSetOutHandler(M62Z80PortWrite); + ZetMapArea(0x0000, 0x7fff, 0, M62Z80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, M62Z80Rom ); + ZetMapArea(0xc000, 0xc0ff, 0, M62SpriteRam); + ZetMapArea(0xc000, 0xc0ff, 1, M62SpriteRam); + ZetMapArea(0xc000, 0xc0ff, 2, M62SpriteRam); + ZetMapArea(0xd000, 0xdfff, 0, M62TileRam ); + ZetMapArea(0xd000, 0xdfff, 1, M62TileRam ); + ZetMapArea(0xd000, 0xdfff, 2, M62TileRam ); + ZetMapArea(0xe000, 0xefff, 0, M62Z80Ram ); + ZetMapArea(0xe000, 0xefff, 1, M62Z80Ram ); + ZetMapArea(0xe000, 0xefff, 2, M62Z80Ram ); + ZetClose(); + + M6803Init(1); + M6803MapMemory(M62M6803Rom, 0x4000, 0xffff, M6803_ROM); + M6803SetReadHandler(M62M6803ReadByte); + M6803SetWriteHandler(M62M6803WriteByte); + M6803SetReadPortHandler(M62M6803ReadPort); + M6803SetWritePortHandler(M62M6803WritePort); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + + MSM5205Init(0, M62SynchroniseStream, 384000, M62MSM5205Vck0, MSM5205_S96_4B, 1); + MSM5205Init(1, M62SynchroniseStream, 384000, NULL, MSM5205_SEX_4B, 1); + MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + MSM5205SetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); + + AY8910Init(0, 894886, nBurnSoundRate, &M62SoundLatchRead, NULL, NULL, &AY8910_0PortBWrite); + AY8910Init(1, 894886, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + M62Z80Clock = 4000000; + M62M6803Clock = 894886; + + M62SpriteHeightPromOffset = (M62PaletteEntries & 0xf00) * 3; +} + +static INT32 KungfumMachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetSetReadHandler(KungfumZ80Read); + ZetSetWriteHandler(KungfumZ80Write); + ZetClose(); + + M62Z80Clock = 3072000; + M62RenderFunction = KungfumDraw; + + M62DoReset(); + + return 0; +} + +static INT32 BattroadMachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetSetOutHandler(BattroadZ80PortWrite); + ZetMapArea(0xa000, 0xbfff, 0, M62Z80Rom + 0x8000); + ZetMapArea(0xa000, 0xbfff, 2, M62Z80Rom + 0x8000); + ZetMapArea(0xc800, 0xcfff, 0, M62CharRam ); + ZetMapArea(0xc800, 0xcfff, 1, M62CharRam ); + ZetMapArea(0xc800, 0xcfff, 2, M62CharRam ); + ZetClose(); + + M62Z80Clock = 3072000; + + M62RenderFunction = BattroadDraw; + M62ExtendTileInfoFunction = BattroadExtendTile; + M62ExtendCharInfoFunction = BattroadExtendChar; + + M62DoReset(); + + return 0; +} + +static INT32 LdrunMachineInit() +{ + M62MachineInit(); + + M62RenderFunction = LdrunDraw; + M62ExtendTileInfoFunction = LdrunExtendTile; + + M62DoReset(); + + return 0; +} + +static INT32 Ldrun2MachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetSetInHandler(Ldrun2Z80PortRead); + ZetSetOutHandler(Ldrun2Z80PortWrite); + ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + 0x8000); + ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + 0x8000); + ZetClose(); + + M62RenderFunction = LdrunDraw; + M62ExtendTileInfoFunction = Ldrun2ExtendTile; + + M62DoReset(); + + return 0; +} + +static INT32 Ldrun3MachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetSetReadHandler(Ldrun3Z80Read); + ZetSetOutHandler(Ldrun3Z80PortWrite); + ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + 0x8000); + ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + 0x8000); + ZetClose(); + + M62RenderFunction = Ldrun3Draw; + M62ExtendTileInfoFunction = Ldrun2ExtendTile; + + M62DoReset(); + + return 0; +} + +static INT32 Ldrun4MachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetSetWriteHandler(Ldrun4Z80Write); + ZetSetOutHandler(Ldrun4Z80PortWrite); + ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + 0x8000); + ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + 0x8000); + ZetClose(); + + M62RenderFunction = Ldrun4Draw; + M62ExtendTileInfoFunction = Ldrun4ExtendTile; + + M62DoReset(); + + return 0; +} + +static INT32 LotlotMachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetMapArea(0xa000, 0xafff, 0, M62CharRam); + ZetMapArea(0xa000, 0xafff, 1, M62CharRam); + ZetMapArea(0xa000, 0xafff, 2, M62CharRam); + ZetClose(); + + M62RenderFunction = LotlotDraw; + M62ExtendTileInfoFunction = LotlotExtendTile; + M62ExtendCharInfoFunction = LotlotExtendChar; + + M62DoReset(); + + return 0; +} + +static INT32 KidnikiMachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetSetInHandler(KidnikiZ80PortRead); + ZetSetOutHandler(KidnikiZ80PortWrite); + ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + 0x8000); + ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + 0x8000); + ZetMapArea(0xa000, 0xafff, 0, M62TileRam ); + ZetMapArea(0xa000, 0xafff, 1, M62TileRam ); + ZetMapArea(0xa000, 0xafff, 2, M62TileRam ); + ZetMapArea(0xd000, 0xdfff, 0, M62CharRam ); + ZetMapArea(0xd000, 0xdfff, 1, M62CharRam ); + ZetMapArea(0xd000, 0xdfff, 2, M62CharRam ); + ZetClose(); + + M62RenderFunction = KidnikiDraw; + M62ExtendTileInfoFunction = KidnikiExtendTile; + M62ExtendCharInfoFunction = LotlotExtendChar; + + M62DoReset(); + + return 0; +} + +static INT32 SpelunkrMachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetSetWriteHandler(SpelunkrZ80Write); + ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + 0x8000); + ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + 0x8000); + ZetMapArea(0xa000, 0xbfff, 0, M62TileRam ); + ZetMapArea(0xa000, 0xbfff, 1, M62TileRam ); + ZetMapArea(0xa000, 0xbfff, 2, M62TileRam ); + ZetMapArea(0xc800, 0xcfff, 0, M62CharRam ); + ZetMapArea(0xc800, 0xcfff, 1, M62CharRam ); + ZetMapArea(0xc800, 0xcfff, 2, M62CharRam ); + ZetMemCallback(0xd000, 0xdfff, 0); + ZetMemCallback(0xd000, 0xdfff, 1); + ZetMemCallback(0xd000, 0xdfff, 2); + ZetClose(); + + M62RenderFunction = SpelunkrDraw; + M62ExtendTileInfoFunction = SpelunkrExtendTile; + M62ExtendCharInfoFunction = SpelunkrExtendChar; + + M62DoReset(); + + return 0; +} + +static INT32 Spelunk2MachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetSetWriteHandler(Spelunk2Z80Write); + ZetMapArea(0x8000, 0x8fff, 0, M62Z80Rom + 0x18000); + ZetMapArea(0x8000, 0x8fff, 2, M62Z80Rom + 0x18000); + ZetMapArea(0x9000, 0x9fff, 0, M62Z80Rom + 0x08000); + ZetMapArea(0x9000, 0x9fff, 2, M62Z80Rom + 0x08000); + ZetMapArea(0xa000, 0xbfff, 0, M62TileRam ); + ZetMapArea(0xa000, 0xbfff, 1, M62TileRam ); + ZetMapArea(0xa000, 0xbfff, 2, M62TileRam ); + ZetMapArea(0xc800, 0xcfff, 0, M62CharRam ); + ZetMapArea(0xc800, 0xcfff, 1, M62CharRam ); + ZetMapArea(0xc800, 0xcfff, 2, M62CharRam ); + ZetMemCallback(0xd000, 0xdfff, 0); + ZetMemCallback(0xd000, 0xdfff, 1); + ZetMemCallback(0xd000, 0xdfff, 2); + ZetClose(); + + M62RenderFunction = Spelunk2Draw; + M62ExtendTileInfoFunction = Spelunk2ExtendTile; + M62ExtendCharInfoFunction = SpelunkrExtendChar; + + M62SpriteHeightPromOffset = 0x700; + + M62DoReset(); + + return 0; +} + +static INT32 YoujyudnMachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetSetOutHandler(YoujyudnZ80PortWrite); + ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + 0x8000); + ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + 0x8000); + ZetMapArea(0xc800, 0xcfff, 0, M62CharRam ); + ZetMapArea(0xc800, 0xcfff, 1, M62CharRam ); + ZetMapArea(0xc800, 0xcfff, 2, M62CharRam ); + ZetMemCallback(0xd800, 0xdfff, 0); + ZetMemCallback(0xd800, 0xdfff, 1); + ZetMemCallback(0xd800, 0xdfff, 2); + ZetClose(); + + M62RenderFunction = YoujyudnDraw; + M62ExtendTileInfoFunction = YoujyudnExtendTile; + M62ExtendCharInfoFunction = YoujyudnExtendChar; + + M62Z80Clock = 3072000; + + M62DoReset(); + + return 0; +} + +static INT32 HorizonMachineInit() +{ + M62MachineInit(); + + ZetOpen(0); + ZetMapArea(0x8000, 0xbfff, 0, M62Z80Rom + 0x8000); + ZetMapArea(0x8000, 0xbfff, 2, M62Z80Rom + 0x8000); + ZetMapArea(0xc000, 0xc1ff, 0, M62SpriteRam ); + ZetMapArea(0xc000, 0xc1ff, 1, M62SpriteRam ); + ZetMapArea(0xc000, 0xc1ff, 2, M62SpriteRam ); + ZetMapArea(0xc800, 0xc83f, 0, M62ScrollRam ); + ZetMapArea(0xc800, 0xc83f, 1, M62ScrollRam ); + ZetMapArea(0xc800, 0xc83f, 2, M62ScrollRam ); + ZetClose(); + + M62RenderFunction = HorizonDraw; + M62ExtendTileInfoFunction = HorizonExtendTile; + + M62DoReset(); + + return 0; +} + +static INT32 KungfumInit() +{ + M62Z80RomSize = 0x8000; + M62PromSize = 0x720; + M62NumTiles = 0x400; + M62NumSprites = 0x400; + + if (M62MemInit()) return 1; + if (KungfumLoadRoms()) return 1; + if (KungfumMachineInit()) return 1; + + return 0; +} + +static INT32 KungfumdInit() +{ + M62Z80RomSize = 0x8000; + M62PromSize = 0x720; + M62NumTiles = 0x400; + M62NumSprites = 0x400; + + if (M62MemInit()) return 1; + if (KungfumdLoadRoms()) return 1; + if (KungfumMachineInit()) return 1; + + return 0; +} + +static INT32 Kungfub3Init() +{ + M62Z80RomSize = 0x8000; + M62PromSize = 0x720; + M62NumTiles = 0x400; + M62NumSprites = 0x400; + + if (M62MemInit()) return 1; + if (Kungfub3LoadRoms()) return 1; + if (KungfumMachineInit()) return 1; + + return 0; +} + +static INT32 BattroadInit() +{ + M62Z80RomSize = 0x16000; + M62PromSize = 0x740; + M62NumTiles = 0x400; + M62NumSprites = 0x200; + M62NumChars = 0x400; + M62CharRamSize = 0x800; + + if (M62MemInit()) return 1; + if (BattroadLoadRoms()) return 1; + if (BattroadMachineInit()) return 1; + + return 0; +} + +static INT32 LdrunInit() +{ + M62Z80RomSize = 0x8000; + M62PromSize = 0x720; + M62NumTiles = 0x400; + M62NumSprites = 0x100; + + if (M62MemInit()) return 1; + if (LdrunLoadRoms()) return 1; + if (LdrunMachineInit()) return 1; + + return 0; +} + +static INT32 Ldrun2Init() +{ + M62Z80RomSize = 0xc000; + M62PromSize = 0x720; + M62NumTiles = 0x400; + M62NumSprites = 0x200; + + if (M62MemInit()) return 1; + if (Ldrun2LoadRoms()) return 1; + if (Ldrun2MachineInit()) return 1; + + return 0; +} + +static INT32 Ldrun3Init() +{ + M62Z80RomSize = 0xc000; + M62PromSize = 0x720; + M62NumTiles = 0x800; + M62NumSprites = 0x400; + + if (M62MemInit()) return 1; + if (Ldrun3LoadRoms()) return 1; + if (Ldrun3MachineInit()) return 1; + + return 0; +} + +static INT32 Ldrun3jInit() +{ + M62Z80RomSize = 0xc000; + M62PromSize = 0x720; + M62NumTiles = 0x800; + M62NumSprites = 0x200; + + if (M62MemInit()) return 1; + if (Ldrun3jLoadRoms()) return 1; + if (Ldrun3MachineInit()) return 1; + + return 0; +} + +static INT32 Ldrun4Init() +{ + M62Z80RomSize = 0x10000; + M62PromSize = 0x720; + M62NumTiles = 0x800; + M62NumSprites = 0x400; + + if (M62MemInit()) return 1; + if (Ldrun3LoadRoms()) return 1; + if (Ldrun4MachineInit()) return 1; + + return 0; +} + +static INT32 LotlotInit() +{ + M62Z80RomSize = 0x8000; + M62PromSize = 0xa20; + M62NumTiles = 0x100; + M62NumSprites = 0x100; + M62NumChars = 0x100; + M62CharRamSize = 0x1000; + M62BgxTileDim = 12; + M62BgyTileDim = 10; + M62CharxTileDim = 12; + M62CharyTileDim = 10; + + if (M62MemInit()) return 1; + if (LotlotLoadRoms()) return 1; + if (LotlotMachineInit()) return 1; + + return 0; +} + +static INT32 KidnikiInit() +{ + M62Z80RomSize = 0x28000; + M62PromSize = 0x720; + M62NumTiles = 0x1000; + M62NumSprites = 0x800; + M62NumChars = 0x400; + M62CharRamSize = 0x1000; + M62BgxTileDim = 8; + M62BgyTileDim = 8; + M62CharxTileDim = 12; + M62CharyTileDim = 8; + + if (M62MemInit()) return 1; + if (KidnikiLoadRoms()) return 1; + if (KidnikiMachineInit()) return 1; + + return 0; +} + +static INT32 LitheroInit() +{ + M62Z80RomSize = 0x28000; + M62PromSize = 0x720; + M62NumTiles = 0x1000; + M62NumSprites = 0x800; + M62NumChars = 0x400; + M62CharRamSize = 0x1000; + M62BgxTileDim = 8; + M62BgyTileDim = 8; + M62CharxTileDim = 12; + M62CharyTileDim = 8; + + if (M62MemInit()) return 1; + if (LitheroLoadRoms()) return 1; + if (KidnikiMachineInit()) return 1; + + return 0; +} + +static INT32 SpelunkrInit() +{ + M62Z80RomSize = 0x10000; + M62PromSize = 0x720; + M62NumTiles = 0x1000; + M62NumSprites = 0x400; + M62NumChars = 0x200; + M62CharRamSize = 0x800; + M62BgxTileDim = 8; + M62BgyTileDim = 8; + M62CharxTileDim = 12; + M62CharyTileDim = 8; + + if (M62MemInit()) return 1; + if (SpelunkrLoadRoms()) return 1; + if (SpelunkrMachineInit()) return 1; + + return 0; +} + +static INT32 Spelunk2Init() +{ + M62Z80RomSize = 0x1c000; + M62PromSize = 0x820; + M62NumTiles = 0x1000; + M62NumSprites = 0x400; + M62NumChars = 0x200; + M62CharRamSize = 0x800; + M62BgxTileDim = 8; + M62BgyTileDim = 8; + M62CharxTileDim = 12; + M62CharyTileDim = 8; + + if (M62MemInit()) return 1; + if (Spelunk2LoadRoms()) return 1; + if (Spelunk2MachineInit()) return 1; + + return 0; +} + +static INT32 YoujyudnInit() +{ + M62Z80RomSize = 0x10000; + M62PromSize = 0x720; + M62NumTiles = 0x400; + M62NumSprites = 0x400; + M62NumChars = 0x400; + M62CharRamSize = 0x800; + M62BgxTileDim = 8; + M62BgyTileDim = 16; + M62CharxTileDim = 12; + M62CharyTileDim = 8; + + if (M62MemInit()) return 1; + if (YoujyudnLoadRoms()) return 1; + if (YoujyudnMachineInit()) return 1; + + return 0; +} + +static INT32 HorizonInit() +{ + M62Z80RomSize = 0xc000; + M62PromSize = 0x720; + M62NumTiles = 0x400; + M62NumSprites = 0x400; + M62SpriteRamSize = 0x200; + M62ScrollRamSize = 0x40; + + if (M62MemInit()) return 1; + if (HorizonLoadRoms()) return 1; + if (HorizonMachineInit()) return 1; + + return 0; +} + +static INT32 M62Exit() +{ + ZetExit(); + M6800Exit(); + AY8910Exit(0); + AY8910Exit(1); + MSM5205Exit(); + + GenericTilesExit(); + + BurnFree(Mem); + + M62Z80RomSize = 0; + M62PromSize = 0; + M62NumTiles = 0; + M62NumSprites = 0; + M62NumChars = 0; + M62SpriteRamSize = 0; + M62CharRamSize = 0; + M62ScrollRamSize = 0; + + M62BackgroundHScroll = 0; + M62BackgroundVScroll = 0; + M62CharHScroll = 0; + M62CharVScroll = 0; + M62FlipScreen = 0; + M62SoundLatch = 0; + M62Port1 = 0; + M62Port2 = 0; + M62SlaveMSM5205VClckReset = 0; + M62PaletteEntries = 0; + M62Z80Clock = 0; + M62M6803Clock = 0; + M62RenderFunction = NULL; + M62ExtendTileInfoFunction = NULL; + M62ExtendCharInfoFunction = NULL; + M62BankControl[0] = M62BankControl[1] = 0; + Ldrun2BankSwap = 0; + Ldrun3TopBottomMask = 0; + KidnikiBackgroundBank = 0; + SpelunkrPaletteBank = 0; + M62BgxTileDim = 0; + M62BgyTileDim = 0; + M62CharxTileDim = 0; + M62CharyTileDim = 0; + M62SpriteHeightPromOffset = 0; + + return 0; +} + +static void M62CalcPalette() +{ + UINT8 *ColourProm = (UINT8*)M62PromData; + + for (UINT32 i = 0; i < M62PaletteEntries; i++) { + INT32 Bit0, Bit1, Bit2, Bit3, r, g, b; + + Bit0 = (ColourProm[M62PaletteEntries * 0] >> 0) & 0x01; + Bit1 = (ColourProm[M62PaletteEntries * 0] >> 1) & 0x01; + Bit2 = (ColourProm[M62PaletteEntries * 0] >> 2) & 0x01; + Bit3 = (ColourProm[M62PaletteEntries * 0] >> 3) & 0x01; + r = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + Bit0 = (ColourProm[M62PaletteEntries * 1] >> 0) & 0x01; + Bit1 = (ColourProm[M62PaletteEntries * 1] >> 1) & 0x01; + Bit2 = (ColourProm[M62PaletteEntries * 1] >> 2) & 0x01; + Bit3 = (ColourProm[M62PaletteEntries * 1] >> 3) & 0x01; + g = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + Bit0 = (ColourProm[M62PaletteEntries * 2] >> 0) & 0x01; + Bit1 = (ColourProm[M62PaletteEntries * 2] >> 1) & 0x01; + Bit2 = (ColourProm[M62PaletteEntries * 2] >> 2) & 0x01; + Bit3 = (ColourProm[M62PaletteEntries * 2] >> 3) & 0x01; + b = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + M62Palette[i] = BurnHighCol(r, g, b, 0); + + ColourProm++; + } +} + +static void BattroadCalcPalette() +{ + UINT8 *ColourProm = (UINT8*)M62PromData; + + for (UINT32 i = 0; i < 0x200; i++) { + INT32 Bit0, Bit1, Bit2, Bit3, r, g, b; + + Bit0 = (ColourProm[0x000] >> 0) & 0x01; + Bit1 = (ColourProm[0x000] >> 1) & 0x01; + Bit2 = (ColourProm[0x000] >> 2) & 0x01; + Bit3 = (ColourProm[0x000] >> 3) & 0x01; + r = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + Bit0 = (ColourProm[0x200] >> 0) & 0x01; + Bit1 = (ColourProm[0x200] >> 1) & 0x01; + Bit2 = (ColourProm[0x200] >> 2) & 0x01; + Bit3 = (ColourProm[0x200] >> 3) & 0x01; + g = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + Bit0 = (ColourProm[0x400] >> 0) & 0x01; + Bit1 = (ColourProm[0x400] >> 1) & 0x01; + Bit2 = (ColourProm[0x400] >> 2) & 0x01; + Bit3 = (ColourProm[0x400] >> 3) & 0x01; + b = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + M62Palette[i] = BurnHighCol(r, g, b, 0); + + ColourProm++; + } + + ColourProm = (UINT8*)M62PromData + 0x720; + + for (UINT32 i = 0; i < 0x20; i++) { + INT32 Bit0, Bit1, Bit2, r, g, b; + + Bit0 = (ColourProm[i] >> 0) & 0x01; + Bit1 = (ColourProm[i] >> 1) & 0x01; + Bit2 = (ColourProm[i] >> 2) & 0x01; + r = 0x21 * Bit0 + 0x47 * Bit1 + 0x97 * Bit2; + + Bit0 = (ColourProm[i] >> 3) & 0x01; + Bit1 = (ColourProm[i] >> 4) & 0x01; + Bit2 = (ColourProm[i] >> 5) & 0x01; + g = 0x21 * Bit0 + 0x47 * Bit1 + 0x97 * Bit2; + + Bit0 = 0; + Bit1 = (ColourProm[i] >> 6) & 0x01; + Bit2 = (ColourProm[i] >> 7) & 0x01; + b = 0x21 * Bit0 + 0x47 * Bit1 + 0x97 * Bit2; + + M62Palette[i + 0x200] = BurnHighCol(r, g, b, 0); + } +} + +static void Spelunk2CalcPalette() +{ + UINT8 *ColourProm = (UINT8*)M62PromData; + + for (UINT32 i = 0; i < 0x200; i++) { + INT32 Bit0, Bit1, Bit2, Bit3, r, g, b; + + Bit0 = (ColourProm[0x000] >> 0) & 0x01; + Bit1 = (ColourProm[0x000] >> 1) & 0x01; + Bit2 = (ColourProm[0x000] >> 2) & 0x01; + Bit3 = (ColourProm[0x000] >> 3) & 0x01; + r = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + Bit0 = (ColourProm[0x000] >> 4) & 0x01; + Bit1 = (ColourProm[0x000] >> 5) & 0x01; + Bit2 = (ColourProm[0x000] >> 6) & 0x01; + Bit3 = (ColourProm[0x000] >> 7) & 0x01; + g = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + Bit0 = (ColourProm[0x200] >> 0) & 0x01; + Bit1 = (ColourProm[0x200] >> 1) & 0x01; + Bit2 = (ColourProm[0x200] >> 2) & 0x01; + Bit3 = (ColourProm[0x200] >> 3) & 0x01; + b = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + M62Palette[i] = BurnHighCol(r, g, b, 0); + + ColourProm++; + } + + ColourProm += 0x200; + + for (UINT32 i = 0; i < 0x100; i++) { + INT32 Bit0, Bit1, Bit2, Bit3, r, g, b; + + Bit0 = (ColourProm[0x000] >> 0) & 0x01; + Bit1 = (ColourProm[0x000] >> 1) & 0x01; + Bit2 = (ColourProm[0x000] >> 2) & 0x01; + Bit3 = (ColourProm[0x000] >> 3) & 0x01; + r = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + Bit0 = (ColourProm[0x100] >> 0) & 0x01; + Bit1 = (ColourProm[0x100] >> 1) & 0x01; + Bit2 = (ColourProm[0x100] >> 2) & 0x01; + Bit3 = (ColourProm[0x100] >> 3) & 0x01; + g = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + Bit0 = (ColourProm[0x200] >> 0) & 0x01; + Bit1 = (ColourProm[0x200] >> 1) & 0x01; + Bit2 = (ColourProm[0x200] >> 2) & 0x01; + Bit3 = (ColourProm[0x200] >> 3) & 0x01; + b = 0x0e * Bit0 + 0x1f * Bit1 + 0x43 * Bit2 + 0x8f * Bit3; + + M62Palette[i + 0x200] = BurnHighCol(r, g, b, 0); + + ColourProm++; + } +} + +static void BattroadExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip) +{ + *Code |= ((*Colour & 0x40) << 3) | ((*Colour & 0x10) << 4); + + *xFlip = *Colour & 0x20; + + if (((*Colour & 0x1f) >> 1) >= 0x04) { + *Priority = 1; + } else { + *Priority = 0; + } + + *Colour &= 0x0f; +} + +static void LdrunExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip) +{ + *Code |= (*Colour & 0xc0) << 2; + + *xFlip = *Colour & 0x20; + + if (((*Colour & 0x1f) >> 1) >= 0x0c) { + *Priority = 1; + } else { + *Priority = 0; + } + + *Colour &= 0x1f; +} + +static void Ldrun2ExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32* xFlip) +{ + *Code |= (*Colour & 0xc0) << 2; + + *xFlip = *Colour & 0x20; + + if (((*Colour & 0x1f) >> 1) >= 0x04) { + *Priority = 1; + } else { + *Priority = 0; + } + + *Colour &= 0x1f; +} + +static void Ldrun4ExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*) +{ + *Code |= ((*Colour & 0xc0) << 2) | ((*Colour & 0x20) << 5); + *Colour &= 0x1f; +} + +static void LotlotExtendTile(INT32* Code, INT32* Colour, INT32*, INT32* xFlip) +{ + *Code |= (*Colour & 0xc0) << 2; + *xFlip = *Colour & 0x20; + *Colour &= 0x1f; +} + +static void KidnikiExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*) +{ + *Code |= ((*Colour & 0xe0) << 3) | (KidnikiBackgroundBank << 11); + *Priority = ((*Colour & 0xe0) == 0xe0) ? 1 : 0; + *Colour &= 0x1f; +} + +static void SpelunkrExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*) +{ + *Code |= ((*Colour & 0x10) << 4) | ((*Colour & 0x20) << 6) | ((*Colour & 0xc0) << 3); + *Colour &= 0x0f | (SpelunkrPaletteBank << 4); +} + +static void Spelunk2ExtendTile(INT32* Code, INT32* Colour, INT32*, INT32*) +{ + *Code |= ((*Colour & 0xf0) << 4); + *Colour &= 0x0f | (SpelunkrPaletteBank << 4); +} + +static void YoujyudnExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*) +{ + *Code |= (*Colour & 0x60) << 3; + if (((*Colour & 0x1f) >> 1) >= 0x08) { + *Priority = 1; + } else { + *Priority = 0; + } + *Colour &= 0x1f; +} + +static void HorizonExtendTile(INT32* Code, INT32* Colour, INT32* Priority, INT32*) +{ + *Code |= ((*Colour & 0xc0) << 2) | ((*Colour & 0x20) << 5); + if (((*Colour & 0x1f) >> 1) >= 0x08) { + *Priority = 1; + } else { + *Priority = 0; + } + *Colour &= 0x1f; +} + +static void M62RenderBgLayer(INT32 PriorityToRender, INT32 xOffset, INT32 yOffset, INT32 Cols, INT32 Rows, INT32 Transparent) +{ + INT32 Code, mx, my, Colour, x, y, TileIndex = 0, Priority, xFlip, yFlip; + + for (my = 0; my < Rows; my++) { + for (mx = 0; mx < Cols; mx++) { + Code = M62TileRam[TileIndex << 1]; + Colour = M62TileRam[(TileIndex << 1) | 0x01]; + Priority = 0; + xFlip = 0; + yFlip = 0; + + if (M62ExtendTileInfoFunction) M62ExtendTileInfoFunction(&Code, &Colour, &Priority, &xFlip); + Code &= (M62NumTiles - 1); + + x = M62BgxTileDim * mx; + y = M62BgyTileDim * my; + + if (M62FlipScreen) { + xFlip = !xFlip; + yFlip = !yFlip; + + y = (Rows * M62BgyTileDim) - M62BgyTileDim - y; + x = (Cols * M62BgxTileDim) - M62BgxTileDim - x; + } + + x -= xOffset; + y -= yOffset; + + if (M62FlipScreen) { + x += M62BackgroundHScroll & (Cols * M62BgxTileDim - 1); + } else { + x -= M62BackgroundHScroll & (Cols * M62BgxTileDim - 1); + } + + y -= M62BackgroundVScroll & (Rows * M62BgyTileDim - 1); + + INT32 px, py; + + UINT32 nPalette = Colour << 3; + + if (Priority == PriorityToRender) { + for (py = 0; py < M62BgyTileDim; py++) { + for (px = 0; px < M62BgxTileDim; px++) { + UINT8 c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + (py * M62BgxTileDim) + px]; + if (xFlip) c = M62Tiles[(Code *M62BgxTileDim * M62BgyTileDim) + (py * M62BgxTileDim) + (M62BgxTileDim - 1 - px)]; + if (yFlip) c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + ((M62BgyTileDim - 1 - py) * M62BgxTileDim) + px]; + if (xFlip && yFlip) c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + ((M62BgyTileDim - 1 - py) * M62BgxTileDim) + (M62BgxTileDim - 1 - px)]; + + if (Transparent && c == 0x00) continue; + + INT32 xPos = x + px; + INT32 yPos = y + py; + + if (M62ScrollRamSize) { +// tilemap_set_scrollx(state->bg_tilemap, i, state->scrollram[i << 1] | (state->scrollram[(i << 1) | 1] << 8)); + + xPos -= (M62ScrollRam[my << 1] | (M62ScrollRam[(my << 1) | 0x01] << 8)) & (Cols * M62BgxTileDim - 1); + } + + if (xPos < 0) xPos += Cols * M62BgxTileDim; + if (xPos > (Cols * M62BgxTileDim - 1)) xPos -= Cols * M62BgxTileDim; + + if (yPos < 0) yPos += Rows * M62BgyTileDim; + if (yPos > (Rows * M62BgyTileDim - 1)) yPos -= Rows * M62BgyTileDim; + + if (yPos >= 0 && yPos < nScreenHeight) { + UINT16* pPixel = pTransDraw + (yPos * nScreenWidth); + + if (xPos >= 0 && xPos < nScreenWidth) { + pPixel[xPos] = c | nPalette; + } + } + } + } + } + + TileIndex++; + } + } +} + +static void KungfumRenderBgLayer(INT32 PriorityToRender, INT32 Cols, INT32 Rows, INT32 Transparent) +{ + INT32 Code, mx, my, Colour, x, y, TileIndex = 0, Priority, xFlip, yFlip; + + for (my = 0; my < Rows; my++) { + for (mx = 0; mx < Cols; mx++) { + Code = M62TileRam[TileIndex]; + Colour = M62TileRam[TileIndex + 0x800]; + xFlip = Colour & 0x20; + yFlip = 0; + + Code |= (Colour & 0xc0) << 2; + Code &= (M62NumTiles - 1); + + if ((TileIndex / 64) << 6 || ((Colour & 0x1f) >> 1) > 0x0c) { + Priority = 1; + } else { + Priority = 0; + } + + x = M62BgxTileDim * mx; + y = M62BgyTileDim * my; + + if (M62FlipScreen) { + xFlip = !xFlip; + yFlip = !yFlip; + + y = (Rows * M62BgyTileDim - 1) - M62BgyTileDim - y; + x = (Cols * M62BgxTileDim - 1) - M62BgxTileDim - x; + } + + x -= 128; + + INT32 px, py; + + UINT32 nPalette = (Colour & 0x1f) << 3; + + if (Priority == PriorityToRender) { + for (py = 0; py < M62BgyTileDim; py++) { + for (px = 0; px < M62BgxTileDim; px++) { + UINT8 c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + (py * M62BgxTileDim) + px]; + if (xFlip) c = M62Tiles[(Code *M62BgxTileDim * M62BgyTileDim) + (py * M62BgxTileDim) + (M62BgxTileDim - 1 - px)]; + if (yFlip) c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + ((M62BgyTileDim - 1 - py) * M62BgxTileDim) + px]; + if (xFlip && yFlip) c = M62Tiles[(Code * M62BgxTileDim * M62BgyTileDim) + ((M62BgyTileDim - 1 - py) * M62BgxTileDim) + (M62BgxTileDim - 1 - px)]; + + if (Transparent && c == 0x00) continue; + + INT32 xPos = x + px; + INT32 yPos = y + py; + + if (my >= 6) { + if (M62FlipScreen) { + xPos += M62BackgroundHScroll & (Cols * M62BgxTileDim - 1); + } else { + xPos -= M62BackgroundHScroll & (Cols * M62BgxTileDim - 1); + } + } + + if (xPos < 0) xPos += Cols * M62BgxTileDim; + if (xPos > (Cols * M62BgxTileDim - 1)) xPos -= Cols * M62BgxTileDim; + + if (yPos < 0) yPos += Rows * M62BgyTileDim; + if (yPos > (Rows * M62BgyTileDim - 1)) yPos -= Rows * M62BgyTileDim; + + if (yPos >= 0 && yPos < nScreenHeight) { + UINT16* pPixel = pTransDraw + (yPos * nScreenWidth); + + if (xPos >= 0 && xPos < nScreenWidth) { + pPixel[xPos] = c | nPalette; + } + } + } + } + } + + TileIndex++; + } + } +} + +static void M62RenderSprites(INT32 ColourMask, INT32 PriorityMask, INT32 Priority, INT32 VisibleOffset, INT32 PaletteOffset) +{ + for (UINT32 Offset = 0; Offset < M62SpriteRamSize; Offset += 8) { + INT32 i, Incr, Code, Colour, xFlip, yFlip, sx, sy; + + if ((M62SpriteRam[Offset] & PriorityMask) == Priority) { + Code = M62SpriteRam[Offset + 4] + ((M62SpriteRam[Offset + 5] & 0x07) << 8); + Colour = M62SpriteRam[Offset + 0] & ColourMask; + sx = 256 * (M62SpriteRam[Offset + 7] & 1) + M62SpriteRam[Offset + 6], + sy = 256 + 128 - 15 - (256 * (M62SpriteRam[Offset + 3] & 1) + M62SpriteRam[Offset + 2]), + xFlip = M62SpriteRam[Offset + 5] & 0x40; + yFlip = M62SpriteRam[Offset + 5] & 0x80; + + i = M62PromData[M62SpriteHeightPromOffset + ((Code >> 5) & 0x1f)]; + if (i == 1) { + // double height + Code &= ~1; + sy -= 16; + } else if (i == 2) { + // quadruple height + i = 3; + Code &= ~3; + sy -= 3*16; + } + + if (M62FlipScreen) { + sx = 496 - sx; + sy = 242 - (i * 16) - sy; + xFlip = !xFlip; + yFlip = !yFlip; + } + + if (yFlip) { + Incr = -1; + Code += i; + } else { + Incr = 1; + } + + sx -= VisibleOffset; + + do { + INT32 DrawCode = Code + (i * Incr); + INT32 DrawY = sy + (i * 16); + DrawCode &= (M62NumSprites - 1); + + if (sx > 15 && sx < (nScreenWidth - 16) && DrawY > 15 && DrawY < (nScreenHeight - 16)) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); + } else { + Render16x16Tile_Mask(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, DrawCode, sx, DrawY, Colour, 3, 0, PaletteOffset, M62Sprites); + } + } + } + + i--; + } while (i >= 0); + } + } +} + +static void BattroadExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*) +{ + *Code |= ((*Colour & 0x40) << 3) | ((*Colour & 0x10) << 4); + *Colour &= 0x0f; +} + +static void LotlotExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*) +{ + *Code |= (*Colour & 0xc0) << 2; + *Colour &= 0x1f; +} + +static void SpelunkrExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*) +{ + *Code |= (*Colour & 0x10) << 4; + *Colour &= 0x0f | (SpelunkrPaletteBank << 4); +} + +static void YoujyudnExtendChar(INT32* Code, INT32* Colour, INT32*, INT32*) +{ + *Code |= (*Colour & 0xc0) << 2; + *Colour &= 0x0f; +} + +static void M62RenderCharLayer(INT32 Cols, INT32 Rows, INT32 ColourDepth, INT32 xOffset, INT32 yOffset, INT32 PaletteOffset) +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0, xFlip, yFlip; + + for (my = 0; my < Rows; my++) { + for (mx = 0; mx < Cols; mx++) { + Code = M62CharRam[TileIndex << 1]; + Colour = M62CharRam[(TileIndex << 1) | 0x01]; + xFlip = 0; + yFlip = 0; + + if (M62ExtendCharInfoFunction) M62ExtendCharInfoFunction(&Code, &Colour, 0, 0); + Code &= (M62NumChars - 1); + + x = M62CharxTileDim * mx; + y = M62CharyTileDim * my; + + x -= xOffset; + y -= yOffset; + + if (M62FlipScreen) { + x += M62CharHScroll & (Cols * M62CharxTileDim - 1); + } else { + x -= M62CharHScroll & (Cols * M62CharxTileDim - 1); + } + + y -= M62CharVScroll & (Rows * M62CharyTileDim - 1); + + INT32 px, py; + + UINT32 nPalette = Colour << ColourDepth; + + for (py = 0; py < M62CharyTileDim; py++) { + for (px = 0; px < M62CharxTileDim; px++) { + UINT8 c = M62Chars[(Code * M62CharxTileDim * M62CharyTileDim) + (py * M62CharxTileDim) + px]; + if (xFlip) c = M62Chars[(Code *M62CharxTileDim * M62CharyTileDim) + (py * M62CharxTileDim) + (M62CharxTileDim - 1 - px)]; + if (yFlip) c = M62Chars[(Code * M62CharxTileDim * M62CharyTileDim) + ((M62CharyTileDim - 1 - py) * M62CharxTileDim) + px]; + if (xFlip && yFlip) c = M62Chars[(Code * M62CharxTileDim * M62CharyTileDim) + ((M62CharyTileDim - 1 - py) * M62CharxTileDim) + (M62CharxTileDim - 1 - px)]; + + if (c != 0) { + INT32 xPos = x + px; + INT32 yPos = y + py; + + if (xPos < 0) xPos += Cols * M62CharxTileDim; + if (xPos > (Cols * M62CharxTileDim - 1)) xPos -= Cols * M62CharxTileDim; + + if (yPos < 0) yPos += Rows * M62CharyTileDim; + if (yPos > (Rows * M62CharyTileDim - 1)) yPos -= Rows * M62CharyTileDim; + + if (yPos >= 0 && yPos < nScreenHeight) { + UINT16* pPixel = pTransDraw + (yPos * nScreenWidth); + + if (xPos >= 0 && xPos < nScreenWidth) { + pPixel[xPos] = c | nPalette | PaletteOffset; + } + } + } + } + } + + TileIndex++; + } + } +} + +static void KungfumDraw() +{ + BurnTransferClear(); + M62CalcPalette(); + KungfumRenderBgLayer(0, 64, 32, 0); + KungfumRenderBgLayer(1, 64, 32, 0); + M62RenderSprites(0x1f, 0, 0, 128, 256); + KungfumRenderBgLayer(0, 64, 32, 1); + BurnTransferCopy(M62Palette); +} + +static void BattroadDraw() +{ + BurnTransferClear(); + BattroadCalcPalette(); + M62RenderBgLayer(0, 128, 0, 64, 32, 0); + M62RenderBgLayer(1, 128, 0, 64, 32, 0); + M62RenderSprites(0x0f, 0x10, 0x00, 128, 256); + M62RenderBgLayer(1, 128, 0, 64, 32, 1); + M62RenderSprites(0x0f, 0x10, 0x10, 128, 256); + M62RenderCharLayer(32, 32, 2, 0, 0, 512); + BurnTransferCopy(M62Palette); +} + +static void LdrunDraw() +{ + BurnTransferClear(); + M62CalcPalette(); + M62RenderBgLayer(0, 64, 0, 64, 32, 0); + M62RenderBgLayer(1, 64, 0, 64, 32, 0); + M62RenderSprites(0x0f, 0x10, 0x00, 64, 256); + M62RenderBgLayer(1, 64, 0, 64, 32, 1); + M62RenderSprites(0x0f, 0x10, 0x10, 64, 256); + BurnTransferCopy(M62Palette); +} + +static void Ldrun3Draw() +{ + BurnTransferClear(); + M62CalcPalette(); + M62RenderBgLayer(0, 64, 0, 64, 32, 0); + M62RenderBgLayer(1, 64, 0, 64, 32, 0); + M62RenderSprites(0x0f, 0x10, 0x00, 64, 256); + M62RenderBgLayer(1, 64, 0, 64, 32, 1); + M62RenderSprites(0x0f, 0x10, 0x10, 64, 256); + + if (Ldrun3TopBottomMask) { + INT32 x, y; + + for (x = 0; x < nScreenWidth; x++) { + for (y = 0; y < 8; y++) { + pTransDraw[(y * nScreenWidth) + x] = BurnHighCol(0, 0, 0, 0); + pTransDraw[((y + 248) * nScreenWidth) + x] = BurnHighCol(0, 0, 0, 0); + } + } + } + + BurnTransferCopy(M62Palette); +} + +static void Ldrun4Draw() +{ + BurnTransferClear(); + M62CalcPalette(); + M62RenderBgLayer(0, 64 - 2, 0, 64, 32, 0); + M62RenderSprites(0x0f, 0x00, 0x00, 64, 256); + BurnTransferCopy(M62Palette); +} + +static void LotlotDraw() +{ + M62BackgroundVScroll = 32; + M62BackgroundHScroll = -64; + + BurnTransferClear(); + M62CalcPalette(); + M62RenderBgLayer(0, 64, 0, 32, 64, 0); + M62RenderCharLayer(32, 64, 3, -64 + 64, 32, 512); + M62RenderSprites(0x1f, 0x00, 0x00, 64, 256); + BurnTransferCopy(M62Palette); +} + +static void KidnikiDraw() +{ + BurnTransferClear(); + M62CalcPalette(); + M62RenderBgLayer(0, 64, 0, 64, 32, 0); + M62RenderBgLayer(1, 64, 0, 64, 32, 0); + M62RenderSprites(0x1f, 0x00, 0x00, 64, 256); + M62RenderBgLayer(1, 64, 0, 64, 32, 1); + M62RenderCharLayer(32, 64, 3, 0, 128, 0); + BurnTransferCopy(M62Palette); +} + +static void SpelunkrDraw() +{ + BurnTransferClear(); + M62CalcPalette(); + M62RenderBgLayer(0, 64, 128, 64, 64, 0); + M62RenderSprites(0x1f, 0x00, 0x00, 64, 256); + M62RenderCharLayer(32, 32, 3, 0, 0, 0); + BurnTransferCopy(M62Palette); +} + +static void Spelunk2Draw() +{ + BurnTransferClear(); + Spelunk2CalcPalette(); + M62RenderBgLayer(0, 64 - 1, 128, 64, 64, 0); + M62RenderSprites(0x1f, 0x00, 0x00, 64, 512); + M62RenderCharLayer(32, 32, 3, 64 - 65, 0, 0); + BurnTransferCopy(M62Palette); +} + +static void YoujyudnDraw() +{ + BurnTransferClear(); + M62CalcPalette(); + M62RenderBgLayer(0, 128, 0, 64, 16, 0); + M62RenderBgLayer(1, 128, 0, 64, 16, 0); + M62RenderSprites(0x1f, 0x00, 0x00, 128, 256); + M62RenderBgLayer(1, 128, 0, 64, 16, 1); + M62RenderCharLayer(32, 32, 3, 64, 0, 128); + BurnTransferCopy(M62Palette); +} + +static void HorizonDraw() +{ + BurnTransferClear(); + M62CalcPalette(); + M62RenderBgLayer(0, 128, 0, 64, 32, 0); + M62RenderBgLayer(1, 128, 0, 64, 32, 0); + M62RenderSprites(0x1f, 0x00, 0x00, 128, 256); + M62RenderBgLayer(1, 128, 0, 64, 32, 1); + BurnTransferCopy(M62Palette); +} + +static INT32 M62Frame() +{ + INT32 nInterleave = MSM5205CalcInterleave(0, M62Z80Clock); + INT32 nSoundBufferPos = 0; + + if (M62Reset) M62DoReset(); + + M62MakeInputs(); + +// nCyclesTotal[0] = M62Z80Clock / 55; +// nCyclesTotal[1] = M62M6803Clock / 55; + nCyclesTotal[0] = M62Z80Clock / 60; + nCyclesTotal[1] = M62M6803Clock / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetNewFrame(); + M6803NewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = M6803Run(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + + ZetOpen(0); + MSM5205Update(); + if (M62SlaveMSM5205VClckReset) { + MSM5205VCLKWrite(1, 1); + MSM5205VCLKWrite(1, 0); + M62SlaveMSM5205VClckReset = 0; + } + ZetClose(); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + + ZetOpen(0); + MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + MSM5205Render(1, pBurnSoundOut, nBurnSoundLen); + ZetClose(); + } + + if (pBurnDraw) { + if (M62RenderFunction) M62RenderFunction(); + } + + return 0; +} + +static INT32 M62Scan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029709; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + + } + + return 0; +} + +struct BurnDriver BurnDrvKungfum = { + "kungfum", NULL, NULL, NULL, "1984", + "Kung-Fu Master\0", NULL, "Irem", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, + NULL, KungfumRomInfo, KungfumRomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, + KungfumInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvKungfumd = { + "kungfumd", "kungfum", NULL, NULL, "1984", + "Kung-Fu Master (Data East)\0", NULL, "Irem (Data East License)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, + NULL, KungfumdRomInfo, KungfumdRomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, + KungfumdInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvSpartanx = { + "spartanx", "kungfum", NULL, NULL, "1984", + "Spartan X (Japan)\0", NULL, "Irem", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, + NULL, SpartanxRomInfo, SpartanxRomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, + KungfumInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvKungfub = { + "kungfub", "kungfum", NULL, NULL, "1984", + "Kung-Fu Master (bootleg set 1)\0", NULL, "bootleg", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, + NULL, KungfubRomInfo, KungfubRomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, + KungfumInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvKungfub2 = { + "kungfub2", "kungfum", NULL, NULL, "1984", + "Kung-Fu Master (bootleg set 2)\0", NULL, "bootleg", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, + NULL, Kungfub2RomInfo, Kungfub2RomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, + KungfumInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvKungfub3 = { + "kungfub3", "kungfum", NULL, NULL, "1984", + "Kung-Fu Master (bootleg set 3)\0", NULL, "bootleg", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, + NULL, Kungfub3RomInfo, Kungfub3RomName, NULL, NULL, M62InputInfo, KungfumDIPInfo, + Kungfub3Init, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvBattroad = { + "battroad", NULL, NULL, NULL, "1984", + "The Battle-Road\0", NULL, "Irem", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_IREM_M62, GBF_SCRFIGHT, 0, + NULL, BattroadRomInfo, BattroadRomName, NULL, NULL, M62InputInfo, BattroadDIPInfo, + BattroadInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x220, 256, 256, 3, 4 +}; + +struct BurnDriver BurnDrvLdrun = { + "ldrun", NULL, NULL, NULL, "1984", + "Lode Runner (set 1)\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, LdrunRomInfo, LdrunRomName, NULL, NULL, M62InputInfo, LdrunDIPInfo, + LdrunInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvLdruna = { + "ldruna", "ldrun", NULL, NULL, "1984", + "Lode Runner (set 2)\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, LdrunaRomInfo, LdrunaRomName, NULL, NULL, M62InputInfo, LdrunDIPInfo, + LdrunInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvLdrun2 = { + "ldrun2", NULL, NULL, NULL, "1984", + "Lode Runner II - The Bungeling Strikes Back\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, Ldrun2RomInfo, Ldrun2RomName, NULL, NULL, M62InputInfo, Ldrun2DIPInfo, + Ldrun2Init, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvLdrun3 = { + "ldrun3", NULL, NULL, NULL, "1985", + "Lode Runner III - The Golden Labyrinth\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, Ldrun3RomInfo, Ldrun3RomName, NULL, NULL, M62InputInfo, Ldrun2DIPInfo, + Ldrun3Init, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvLdrun3j = { + "ldrun3j", "ldrun3", NULL, NULL, "1985", + "Lode Runner III - Majin No Fukkatsu\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, Ldrun3jRomInfo, Ldrun3jRomName, NULL, NULL, M62InputInfo, Ldrun2DIPInfo, + Ldrun3jInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvLdrun4 = { + "ldrun4", NULL, NULL, NULL, "1986", + "Lode Runner IV - Teikoku Karano Dasshutsu\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, Ldrun4RomInfo, Ldrun4RomName, NULL, NULL, M62InputInfo, Ldrun4DIPInfo, + Ldrun4Init, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvLotlot = { + "lotlot", NULL, NULL, NULL, "1985", + "Lot Lot\0", NULL, "Irem (licensed from Tokuma Shoten)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PUZZLE, 0, + NULL, LotlotRomInfo, LotlotRomName, NULL, NULL, M62InputInfo, LotlotDIPInfo, + LotlotInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x300, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvKidniki = { + "kidniki", NULL, NULL, NULL, "1986", + "Kid Niki - Radical Ninja (World)\0", NULL, "Irem", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, KidnikiRomInfo, KidnikiRomName, NULL, NULL, M62InputInfo, KidnikiDIPInfo, + KidnikiInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvKidnikiu = { + "kidnikiu", "kidniki", NULL, NULL, "1986", + "Kid Niki - Radical Ninja (US)\0", NULL, "Irem (Data East USA license)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, KidnikiuRomInfo, KidnikiuRomName, NULL, NULL, M62InputInfo, KidnikiDIPInfo, + KidnikiInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvYanchamr = { + "yanchamr", "kidniki", NULL, NULL, "1986", + "Kaiketsu Yanchamaru (Japan)\0", NULL, "Irem", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, YanchamrRomInfo, YanchamrRomName, NULL, NULL, M62InputInfo, KidnikiDIPInfo, + KidnikiInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvLithero = { + "lithero", "kidniki", NULL, NULL, "1987", + "Little Hero\0", NULL, "bootleg", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, LitheroRomInfo, LitheroRomName, NULL, NULL, M62InputInfo, KidnikiDIPInfo, + LitheroInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvSpelunkr = { + "spelunkr", NULL, NULL, NULL, "1985", + "Spelunker\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, SpelunkrRomInfo, SpelunkrRomName, NULL, NULL, M62InputInfo, SpelunkrDIPInfo, + SpelunkrInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvSpelunkrj = { + "spelunkrj", "spelunkr", NULL, NULL, "1985", + "Spelunker (Japan)\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, SpelunkrjRomInfo, SpelunkrjRomName, NULL, NULL, M62InputInfo, SpelunkrDIPInfo, + SpelunkrInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvSpelunk2 = { + "spelunk2", NULL, NULL, NULL, "1986", + "Spelunker II\0", NULL, "Irem (licensed from Broderbund)", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_PLATFORM, 0, + NULL, Spelunk2RomInfo, Spelunk2RomName, NULL, NULL, M62InputInfo, Spelunk2DIPInfo, + Spelunk2Init, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x300, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvYoujyudn = { + "youjyudn", NULL, NULL, NULL, "1986", + "Youjyuden (Japan)\0", NULL, "Irem", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M62, GBF_VERSHOOT, 0, + NULL, YoujyudnRomInfo, YoujyudnRomName, NULL, NULL, M62InputInfo, YoujyudnDIPInfo, + YoujyudnInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 256, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHorizon = { + "horizon", NULL, NULL, NULL, "1985", + "Horizon\0", NULL, "Irem", "Irem M62", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M62, GBF_HORSHOOT, 0, + NULL, HorizonRomInfo, HorizonRomName, NULL, NULL, M62InputInfo, HorizonDIPInfo, + HorizonInit, M62Exit, M62Frame, NULL, M62Scan, + NULL, 0x200, 256, 256, 4, 3 +}; diff --git a/src/burn/drv/irem/d_m63.cpp b/src/burn/drv/irem/d_m63.cpp index 131bb9da4..48a4f30a2 100644 --- a/src/burn/drv/irem/d_m63.cpp +++ b/src/burn/drv/irem/d_m63.cpp @@ -1,1130 +1,1128 @@ -// FB Alpha Irem M63 driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "i8039.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvI8039ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvSndROM; -static UINT8 *DrvSampleROM; -static UINT8 *DrvColPROM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvVidRAM0; -static UINT8 *DrvVidRAM1; -static UINT8 *DrvColRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvScrRAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *interrupt_enable; -static UINT8 *flipscreen; -static UINT8 *palette_bank; -static UINT8 *sound_status; - -static INT16 *pAY8910Buffer[6]; - -static UINT8 m63_sound_p1; -static UINT8 m63_sound_p2; -static UINT8 sound_irq = 0; -static INT32 sample_pos = 0; -static INT32 sample_sel = -1; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[2]; -static UINT8 DrvReset; - -static INT32 sy_offset; -static INT32 char_color_offset; -static INT32 sound_interrupt_count; - -static struct BurnInputInfo WilytowrInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 6, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 4, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 5, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 6, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Wilytowr) - -static struct BurnInputInfo FghtbsktInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 1, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 0, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 6, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 1, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 0, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Fghtbskt) - -static struct BurnDIPInfo WilytowrDIPList[]= -{ - {0x10, 0xff, 0xff, 0x01, NULL }, - {0x11, 0xff, 0xff, 0x02, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x10, 0x01, 0x03, 0x00, "2" }, - {0x10, 0x01, 0x03, 0x01, "3" }, - {0x10, 0x01, 0x03, 0x02, "4" }, - {0x10, 0x01, 0x03, 0x03, "5" }, - - {0 , 0xfe, 0 , 4, "Bonus Points Rate" }, - {0x10, 0x01, 0x0c, 0x00, "Normal" }, - {0x10, 0x01, 0x0c, 0x04, "x1.2" }, - {0x10, 0x01, 0x0c, 0x08, "x1.4" }, - {0x10, 0x01, 0x0c, 0x0c, "x1.6" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x10, 0x01, 0x30, 0x20, "3 Coins 1 Credits" }, - {0x10, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x10, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, - {0x10, 0x01, 0x30, 0x30, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x10, 0x01, 0xc0, 0x00, "1 Coin 2 Credits" }, - {0x10, 0x01, 0xc0, 0x40, "1 Coin 3 Credits" }, - {0x10, 0x01, 0xc0, 0x80, "1 Coin 5 Credits" }, - {0x10, 0x01, 0xc0, 0xc0, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x10, 0x01, 0xf0, 0x60, "7 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x50, "6 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x40, "5 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x30, "4 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x20, "3 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x10, "2 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, - {0x10, 0x01, 0xf0, 0x80, "1 Coin 2 Credits" }, - {0x10, 0x01, 0xf0, 0x90, "1 Coin 3 Credits" }, - {0x10, 0x01, 0xf0, 0xa0, "1 Coin 4 Credits" }, - {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x10, 0x01, 0xf0, 0xc0, "1 Coin 6 Credits" }, - {0x10, 0x01, 0xf0, 0xd0, "1 Coin 7 Credits" }, - {0x10, 0x01, 0xf0, 0xe0, "1 Coin 8 Credits" }, - {0x10, 0x01, 0xf0, 0x70, "1 Coin 9 Credits" }, - {0x10, 0x01, 0xf0, 0xf0, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x11, 0x01, 0x01, 0x00, "Off" }, - {0x11, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x11, 0x01, 0x02, 0x02, "Upright" }, - {0x11, 0x01, 0x02, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x11, 0x01, 0x04, 0x00, "Mode 1" }, - {0x11, 0x01, 0x04, 0x04, "Mode 2" }, - - {0 , 0xfe, 0 , 0, "Stop Mode (Cheat)" }, - {0x11, 0x01, 0x10, 0x00, "Off" }, - {0x11, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)" }, - {0x11, 0x01, 0x40, 0x00, "Off" }, - {0x11, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 0, "Service Mode" }, - {0x11, 0x01, 0x80, 0x00, "Off" }, - {0x11, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Wilytowr) - -static struct BurnDIPInfo FghtbsktDIPList[]= -{ - {0x0f, 0xff, 0xff, 0xc4, NULL }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x0f, 0x01, 0x03, 0x03, "3 Coins 1 Credits" }, - {0x0f, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, - {0x0f, 0x01, 0x03, 0x00, "1 Coin 1 Credits" }, - {0x0f, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x0f, 0x01, 0x0c, 0x04, "1 Coin 1 Credits" }, - {0x0f, 0x01, 0x0c, 0x00, "1 Coin 2 Credits" }, - {0x0f, 0x01, 0x0c, 0x08, "1 Coin 4 Credits" }, - {0x0f, 0x01, 0x0c, 0x0c, "99 Credits / Sound Test" }, - - {0 , 0xfe, 0 , 2, "Time Count Down" }, - {0x0f, 0x01, 0x20, 0x00, "Slow" }, - {0x0f, 0x01, 0x20, 0x20, "Too Fast" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x0f, 0x01, 0x40, 0x40, "Upright" }, - {0x0f, 0x01, 0x40, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0f, 0x01, 0x80, 0x00, "Off" }, - {0x0f, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Fghtbskt) - -void __fastcall m63_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf000: - *interrupt_enable = data ? 1 : 0; - return; - - case 0xf002: - *flipscreen = ~data & 0x01; - return; - - case 0xf003: - *palette_bank = data & 0x01; - return; - - case 0xf006: - case 0xf007: - // coin counters (offset) - return; - - case 0xf800: - *soundlatch = data; - return; - - case 0xf801: - return; // nop - - case 0xf803: - I8039SetIrqState(1); - return; - } -} - -UINT8 __fastcall m63_main_read(UINT16 address) -{ - switch (address) - { - case 0xf000: // fghtbskt - return *sound_status; - - case 0xf800: - case 0xf001: // fghtbskt - return DrvInputs[0]; - - case 0xf801: - case 0xf002: // fghtbskt - return DrvInputs[1]; - - case 0xf802: - case 0xf003: // fghtbskt - return DrvDips[0]; - - case 0xf806: - return DrvDips[1]; - } - - return 0; -} - -void __fastcall fghtbskt_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf000: - I8039SetIrqState(1); - return; - - case 0xf002: - *soundlatch = data; - return; - - case 0xf801: - *interrupt_enable = data ? 1 : 0; - return; - - case 0xf802: - *flipscreen = data ? 1 : 0; - // if (flipscreen) ? tile_flipx : 0 - return; - - case 0xf807: - if (data & 0x01) { - sample_sel = ((data & 0xf0) << 8); - sample_pos = 0; - } - return; - - case 0xf001: - case 0xf800: - case 0xf803: - case 0xf804: - case 0xf805: - case 0xf806: - return; // nop - } -} - -UINT8 __fastcall m63_sound_read(UINT32 address) -{ - return DrvI8039ROM[address & 0x0fff]; -} - -void __fastcall m63_sound_write_port(UINT32 port, UINT8 data) -{ - if ((port & 0xff00) == 0x0000) { - if ((m63_sound_p2 & 0xf0) == 0xe0) - { - AY8910Write(0, 0, port & 0xff); - } - else if ((m63_sound_p2 & 0xf0) == 0xa0) - { - AY8910Write(0, 1, port & 0xff); - } - else if ((m63_sound_p1 & 0xe0) == 0x60 && sy_offset != 240) - { - AY8910Write(1, 0, port & 0xff); - } - else if ((m63_sound_p1 & 0xe0) == 0x40 && sy_offset != 240) - { - AY8910Write(1, 1, port & 0xff); - } - else if ((m63_sound_p2 & 0xf0) == 0x70) - { - *sound_status = port & 0xff; - } - - return; - } - - switch (port) - { - case 0x101: - m63_sound_p1 = data; - return; - - case 0x102: - m63_sound_p2 = data; - if ((data & 0xf0) == 0x50) I8039SetIrqState(0); - return; - } -} - -UINT8 __fastcall m63_sound_read_port(UINT32 port) -{ - if ((port & 0xff00) == 0x0000) { - if ((m63_sound_p2 & 0xf0) == 0x60) { - return *soundlatch; - } - else if ((m63_sound_p2 & 0xf0) == 0x70) - { - return DrvSndROM[((m63_sound_p1 & 0x1f) << 8) | (port & 0xff)]; - } - - return 0xff; - } - - switch (port) - { - case 0x111: - if (sound_irq) { - sound_irq = 0; - return 1; - } - return 0; - } - - return 0; -} - -static void m63PaletteRecalc() -{ - for (INT32 i = 0; i < 256; i++) - { - INT32 bit0 = (DrvColPROM[i] >> 0) & 0x01; - INT32 bit1 = (DrvColPROM[i] >> 1) & 0x01; - INT32 bit2 = (DrvColPROM[i] >> 2) & 0x01; - INT32 bit3 = (DrvColPROM[i] >> 3) & 0x01; - INT32 r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvColPROM[i + 256] >> 0) & 0x01; - bit1 = (DrvColPROM[i + 256] >> 1) & 0x01; - bit2 = (DrvColPROM[i + 256] >> 2) & 0x01; - bit3 = (DrvColPROM[i + 256] >> 3) & 0x01; - INT32 g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvColPROM[i + 2*256] >> 0) & 0x01; - bit1 = (DrvColPROM[i + 2*256] >> 1) & 0x01; - bit2 = (DrvColPROM[i + 2*256] >> 2) & 0x01; - bit3 = (DrvColPROM[i + 2*256] >> 3) & 0x01; - INT32 b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - DrvPalette[i] = BurnHighCol(r,g,b,0); - } - - for (INT32 i = 0; i < 4; i++) - { - INT32 bit0 = (DrvColPROM[0x300+i] >> 0) & 0x01; - INT32 bit1 = (DrvColPROM[0x300+i] >> 1) & 0x01; - INT32 bit2 = (DrvColPROM[0x300+i] >> 2) & 0x01; - INT32 r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (DrvColPROM[0x300+i] >> 3) & 0x01; - bit1 = (DrvColPROM[0x300+i] >> 4) & 0x01; - bit2 = (DrvColPROM[0x300+i] >> 5) & 0x01; - INT32 g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (DrvColPROM[0x300+i] >> 6) & 0x01; - bit1 = (DrvColPROM[0x300+i] >> 7) & 0x01; - INT32 b = 0x4f * bit0 + 0xa8 * bit1; - - DrvPalette[0x100+i] = BurnHighCol(r,g,b,0); - } -} - -static void m63_main_map() -{ - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); - ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM0); - ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM0); - ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe1ff, 0, DrvZ80RAM1); - ZetMapArea(0xe000, 0xe1ff, 1, DrvZ80RAM1); - ZetMapArea(0xe000, 0xe1ff, 2, DrvZ80RAM1); - ZetMapArea(0xe200, 0xe2ff, 0, DrvSprRAM); - ZetMapArea(0xe200, 0xe2ff, 1, DrvSprRAM); - ZetMapArea(0xe200, 0xe2ff, 2, DrvSprRAM); - ZetMapArea(0xe300, 0xe3ff, 0, DrvScrRAM); - ZetMapArea(0xe300, 0xe3ff, 1, DrvScrRAM); - ZetMapArea(0xe300, 0xe3ff, 2, DrvScrRAM); - ZetMapArea(0xe400, 0xe7ff, 0, DrvVidRAM1); - ZetMapArea(0xe400, 0xe7ff, 1, DrvVidRAM1); - ZetMapArea(0xe400, 0xe7ff, 2, DrvVidRAM1); - ZetMapArea(0xe800, 0xebff, 0, DrvVidRAM0); - ZetMapArea(0xe800, 0xebff, 1, DrvVidRAM0); - ZetMapArea(0xe800, 0xebff, 2, DrvVidRAM0); - ZetMapArea(0xec00, 0xefff, 0, DrvColRAM); - ZetMapArea(0xec00, 0xefff, 1, DrvColRAM); - ZetMapArea(0xec00, 0xefff, 2, DrvColRAM); - ZetSetWriteHandler(m63_main_write); - ZetSetReadHandler(m63_main_read); - ZetMemEnd(); - ZetClose(); -} - -static void fghtbskt_main_map() -{ - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM0); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM0); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM0); - ZetMapArea(0xd000, 0xd1ff, 0, DrvZ80RAM1); - ZetMapArea(0xd000, 0xd1ff, 1, DrvZ80RAM1); - ZetMapArea(0xd000, 0xd1ff, 2, DrvZ80RAM1); - ZetMapArea(0xd200, 0xd2ff, 0, DrvSprRAM); - ZetMapArea(0xd200, 0xd2ff, 1, DrvSprRAM); - ZetMapArea(0xd200, 0xd2ff, 2, DrvSprRAM); - ZetMapArea(0xd300, 0xd3ff, 0, DrvScrRAM); - ZetMapArea(0xd300, 0xd3ff, 1, DrvScrRAM); - ZetMapArea(0xd300, 0xd3ff, 2, DrvScrRAM); - ZetMapArea(0xd400, 0xd7ff, 0, DrvVidRAM1); - ZetMapArea(0xd400, 0xd7ff, 1, DrvVidRAM1); - ZetMapArea(0xd400, 0xd7ff, 2, DrvVidRAM1); - ZetMapArea(0xd800, 0xdbff, 0, DrvVidRAM0); - ZetMapArea(0xd800, 0xdbff, 1, DrvVidRAM0); - ZetMapArea(0xd800, 0xdbff, 2, DrvVidRAM0); - ZetMapArea(0xdc00, 0xdfff, 0, DrvColRAM); - ZetMapArea(0xdc00, 0xdfff, 1, DrvColRAM); - ZetMapArea(0xdc00, 0xdfff, 2, DrvColRAM); - ZetSetWriteHandler(fghtbskt_main_write); - ZetSetReadHandler(m63_main_read); - ZetMemEnd(); - ZetClose(); -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - I8039Reset(); - - AY8910Reset(0); - AY8910Reset(1); - - m63_sound_p1 = 0; - m63_sound_p2 = 0; - sound_irq = 0; - sample_pos = 0; - sample_sel = -1; - - DrvRecalc = 1; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[2] = { 0x8000, 0x0000 }; - INT32 Plane1[3] = { (0x2000*8)*2, (0x2000*8)*1, (0x2000*8)*0 }; - INT32 Plane2[3] = { (0x4000*8)*2, (0x4000*8)*1, (0x4000*8)*0 }; - INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, (0x2000*8)+0, (0x2000*8)+1, (0x2000*8)+2, (0x2000*8)+3, (0x2000*8)+4, (0x2000*8)+5, (0x2000*8)+6, (0x2000*8)+7 }; - INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0xc000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x2000); - - GfxDecode(0x0100, 2, 8, 8, Plane0, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x6000); - - GfxDecode(0x0400, 3, 8, 8, Plane1, XOffs, YOffs, 0x040, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0xc000); - - GfxDecode(0x0200, 3, 16, 16, Plane2, XOffs, YOffs, 0x080, tmp, DrvGfxROM2); - - BurnFree (tmp); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x010000; - DrvI8039ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x008000; - DrvGfxROM1 = Next; Next += 0x010000; - DrvGfxROM2 = Next; Next += 0x020000; - - DrvSampleROM = Next; Next += 0x010000; - - DrvSndROM = Next; Next += 0x002000; - - DrvColPROM = Next; Next += 0x000400; - - DrvPalette = (UINT32*)Next; Next += 0x0104 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x001000; - DrvZ80RAM1 = Next; Next += 0x000200; - DrvVidRAM0 = Next; Next += 0x000400; - DrvVidRAM1 = Next; Next += 0x000400; - DrvColRAM = Next; Next += 0x000400; - DrvSprRAM = Next; Next += 0x000100; - DrvScrRAM = Next; Next += 0x000100; - - soundlatch = Next; Next += 0x000001; - interrupt_enable = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - palette_bank = Next; Next += 0x000001; - sound_status = Next; Next += 0x000001; - - RamEnd = Next; - - for (INT32 i = 0; i < 6; i++) { - pAY8910Buffer[i] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - } - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit(void (*pMapMainCPU)(), INT32 (*pRomLoadCallback)(), INT32 syoffset, INT32 charcoloroff, INT32 sndirqcount) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (pRomLoadCallback()) return 1; - - DrvGfxDecode(); - - pMapMainCPU(); - - I8039Init(NULL); - I8039SetProgramReadHandler(m63_sound_read); - I8039SetCPUOpReadHandler(m63_sound_read); - I8039SetCPUOpReadArgHandler(m63_sound_read); - I8039SetIOReadHandler(m63_sound_read_port); - I8039SetIOWriteHandler(m63_sound_write_port); - - AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 1.00, BURN_SND_ROUTE_BOTH); - - sy_offset = syoffset; - char_color_offset = charcoloroff; - sound_interrupt_count = sndirqcount; - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - I8039Exit(); - - AY8910Exit(0); - AY8910Exit(1); - - BurnFree (AllMem); - - return 0; -} - -static INT32 wilytowerLoadRoms() -{ - if (BurnLoadRom(DrvZ80ROM + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x02000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x04000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x06000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x08000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x0a000, 5, 1)) return 1; - - if (BurnLoadRom(DrvI8039ROM, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x01000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x02000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x04000, 11, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x02000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x04000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x06000, 15, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x08000, 16, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x0a000, 17, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x00000, 18, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00000, 19, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00100, 20, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00200, 21, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00300, 22, 1)) return 1; - - return 0; -} - -static INT32 fghtbsktLoadRoms() -{ - if (BurnLoadRom(DrvZ80ROM + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x02000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x04000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x08000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x0a000, 4, 1)) return 1; - - if (BurnLoadRom(DrvI8039ROM, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; - memcpy (DrvGfxROM0 + 0x1000, DrvGfxROM0 + 0x0800, 0x0800); - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x02000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x04000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x02000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x04000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x06000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x08000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x0a000, 15, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x00000, 16, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00000, 17, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00100, 18, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00200, 19, 1)) return 1; - - if (BurnLoadRom(DrvSampleROM + 0x00000, 20, 1)) return 1; - if (BurnLoadRom(DrvSampleROM + 0x02000, 21, 1)) return 1; - if (BurnLoadRom(DrvSampleROM + 0x04000, 22, 1)) return 1; - if (BurnLoadRom(DrvSampleROM + 0x06000, 23, 1)) return 1; - if (BurnLoadRom(DrvSampleROM + 0x08000, 24, 1)) return 1; - - return 0; -} - -static INT32 wilytowrInit() -{ - return DrvInit(m63_main_map, wilytowerLoadRoms, 238, 0x100, 60); -} - -static INT32 atomboyInit() -{ - return DrvInit(m63_main_map, wilytowerLoadRoms, 238, 0x100, 60/2); -} - -static INT32 fghtbsktInit() -{ - INT32 nRet = DrvInit(fghtbskt_main_map, fghtbsktLoadRoms, 240, 0x010, 60/2); - - AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -static void draw_bg_layer() -{ - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - sy -= DrvScrRAM[(offs & 0x1f) * 8] + 16; - if (sy < -7) sy += 256; - if (sy >= nScreenHeight) continue; - - INT32 attr = DrvColRAM[offs]; - INT32 code = DrvVidRAM0[offs] | ((attr & 0x30) << 4); - INT32 color = (attr & 0x0f) | (*palette_bank << 4); - - if (*flipscreen) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, 248 - sx, 216 - sy, color, 3, 0, DrvGfxROM1); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM1); - } - } -} - -static void draw_fg_layer() -{ - for (INT32 offs = (256/8)*(16/8); offs < (32 * 32) - ((256/8)*(16/8)); offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = ((offs >> 5) << 3) - 16; - - if (*flipscreen) { - Render8x8Tile_Mask_FlipXY(pTransDraw, DrvVidRAM1[offs], 248 - sx, 216 - sy, 0, 2, 0, char_color_offset, DrvGfxROM0); - } else { - Render8x8Tile_Mask(pTransDraw, DrvVidRAM1[offs], sx, sy, 0, 2, 0, char_color_offset, DrvGfxROM0); - } - } -} - -static void draw_sprite_tile(INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy) -{ - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2); - } - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0; offs < 0x100; offs += 4) - { - INT32 sx = DrvSprRAM[offs + 3]; - INT32 attr = DrvSprRAM[offs + 2]; - INT32 code = (DrvSprRAM[offs + 1]) | ((attr & 0x10) << 4); - INT32 sy = (sy_offset - DrvSprRAM[offs]) - 16; - - INT32 color = (attr & 0x0f) | (*palette_bank << 4); - INT32 flipx = (attr & 0x20); - INT32 flipy = 0; - - if (*flipscreen) - { - sx = 240 - sx; - sy = sy_offset - sy; - flipx = !flipx; - flipy = !flipy; - } - - draw_sprite_tile(code, color, sx, sy, flipx, flipy); - - if (sx > 0xf0) { - draw_sprite_tile(code, color, sx, sy, flipx, flipy); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - m63PaletteRecalc(); - DrvRecalc = 0; - } - - draw_bg_layer(); - draw_sprites(); - draw_fg_layer(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static void sample_render(short *pSoundBuf, INT32 nLength) -{ - if (sample_sel == -1) return; - - double Addr = sample_pos + sample_sel; - double Step = (double)8000 / nBurnSoundRate; - - for (INT32 i = 0; i < nLength && Addr < 0xa000; i += 2, Addr += Step) { - short Sample = (short)((DrvSampleROM[(int)Addr]^0x80) << 8); - - pSoundBuf[i ] += Sample; - pSoundBuf[i + 1] += Sample; - } - - sample_pos = (int)Addr; - if (Addr >= 0xa000) sample_sel = -1; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0, 2); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - INT32 nCyclesTotal[2] = { 3000000 / 60, 3000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - INT32 nInterleave = 100; - - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += ZetRun(nCyclesTotal[0] / nInterleave); - nCyclesDone[1] += I8039Run(nCyclesTotal[1] / nInterleave); - } - - if (sound_interrupt_count == 30) { - if (nCurrentFrame & 1) sound_irq = 1; - } else { - sound_irq = 1; - } - - if (*interrupt_enable) ZetNmi(); - - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - - sample_render(pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - I8039Scan(nAction, pnMin); - - AY8910Scan(nAction, pnMin); - - SCAN_VAR(m63_sound_p1); - SCAN_VAR(m63_sound_p2); - SCAN_VAR(sound_irq); - SCAN_VAR(sample_pos); - SCAN_VAR(sample_sel); - } - - return 0; -} - - -// Wily Tower - -static struct BurnRomInfo wilytowrRomDesc[] = { - { "wt4e.bin", 0x2000, 0xa38e4b8a, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 code - { "wt4h.bin", 0x2000, 0xc1405ceb, 1 | BRF_PRG | BRF_ESS }, // 1 - { "wt4j.bin", 0x2000, 0x379fb1c3, 1 | BRF_PRG | BRF_ESS }, // 2 - { "wt4k.bin", 0x2000, 0x2dd6f9c7, 1 | BRF_PRG | BRF_ESS }, // 3 - { "wt_a-4m.bin", 0x2000, 0xc1f8a7d5, 1 | BRF_PRG | BRF_ESS }, // 4 - { "wt_a-4n.bin", 0x2000, 0xb212f7d2, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "wt4d.bin", 0x1000, 0x25a171bf, 2 | BRF_PRG | BRF_ESS }, // 6 I8039 code - - { "wt_b-5e.bin", 0x1000, 0xfe45df43, 3 | BRF_GRA }, // 7 Characters - { "wt_b-5f.bin", 0x1000, 0x87a17eff, 3 | BRF_GRA }, // 8 - - { "wtb5a.bin", 0x2000, 0xefc1cbfa, 4 | BRF_GRA }, // 9 Tiles - { "wtb5b.bin", 0x2000, 0xab4bfd07, 4 | BRF_GRA }, // 10 - { "wtb5d.bin", 0x2000, 0x40f23e1d, 4 | BRF_GRA }, // 11 - - { "wt2j.bin", 0x1000, 0xd1bf0670, 5 | BRF_GRA }, // 12 Sprites - { "wt3k.bin", 0x1000, 0x83c39a0e, 5 | BRF_GRA }, // 13 - { "wt_a-3m.bin", 0x1000, 0xe7e468ae, 5 | BRF_GRA }, // 14 - { "wt_a-3n.bin", 0x1000, 0x0741d1a9, 5 | BRF_GRA }, // 15 - { "wt_a-3p.bin", 0x1000, 0x7299f362, 5 | BRF_GRA }, // 16 - { "wt_a-3s.bin", 0x1000, 0x9b37d50d, 5 | BRF_GRA }, // 17 - - { "wt_a-6d.bin", 0x1000, 0xa5dde29b, 6 | BRF_SND }, // 18 Sound data - - { "wt_a-5s-.bpr", 0x0100, 0x041950e7, 7 | BRF_GRA }, // 19 Color PROMs - { "wt_a-5r-.bpr", 0x0100, 0xbc04bf25, 7 | BRF_GRA }, // 20 - { "wt_a-5p-.bpr", 0x0100, 0xed819a19, 7 | BRF_GRA }, // 21 - { "wt_b-9l-.bpr", 0x0020, 0xd2728744, 7 | BRF_GRA }, // 22 -}; - -STD_ROM_PICK(wilytowr) -STD_ROM_FN(wilytowr) - -struct BurnDriver BurnDrvWilytowr = { - "wilytowr", NULL, NULL, NULL, "1984", - "Wily Tower\0", NULL, "Irem", "M63", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_IREM_M63, GBF_PLATFORM, 0, - NULL, wilytowrRomInfo, wilytowrRomName, NULL, NULL, WilytowrInputInfo, WilytowrDIPInfo, - wilytowrInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x104, - 256, 224, 4, 3 -}; - - -// Atomic Boy (revision B) - -static struct BurnRomInfo atomboyRomDesc[] = { - { "wt_a-4e.bin", 0x2000, 0xf7978185, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 code - { "wt_a-4h.bin", 0x2000, 0x0ca9950b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "wt_a-4j.bin", 0x2000, 0x1badbc65, 1 | BRF_PRG | BRF_ESS }, // 2 - { "wt_a-4k.bin", 0x2000, 0x5a341f75, 1 | BRF_PRG | BRF_ESS }, // 3 - { "wt_a-4m.bin", 0x2000, 0xc1f8a7d5, 1 | BRF_PRG | BRF_ESS }, // 4 - { "wt_a-4n.bin", 0x2000, 0xb212f7d2, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "wt_a-4d-b.bin", 0x2000, 0x793ea53f, 2 | BRF_PRG | BRF_ESS }, // 6 I8039 code - - { "wt_b-5e.bin", 0x1000, 0xfe45df43, 3 | BRF_GRA }, // 7 Characters - { "wt_b-5f.bin", 0x1000, 0x87a17eff, 3 | BRF_GRA }, // 8 - - { "wt_b-5a.bin", 0x2000, 0xda22c452, 4 | BRF_GRA }, // 9 Tiles - { "wt_b-5b.bin", 0x2000, 0x4fb25a1f, 4 | BRF_GRA }, // 10 - { "wt_b-5d.bin", 0x2000, 0x75be2604, 4 | BRF_GRA }, // 11 - - { "wt_a-3j-b.bin", 0x2000, 0x996470f1, 5 | BRF_GRA }, // 12 Sprites - { "wt_a-3k-b.bin", 0x2000, 0x8f4ec45c, 5 | BRF_GRA }, // 13 - { "wt_a-3m-b.bin", 0x2000, 0x4ac40358, 5 | BRF_GRA }, // 14 - { "wt_a-3n-b.bin", 0x2000, 0x709eef5b, 5 | BRF_GRA }, // 15 - { "wt_a-3p-b.bin", 0x2000, 0x3018b840, 5 | BRF_GRA }, // 16 - { "wt_a-3s-b.bin", 0x2000, 0x05a251d4, 5 | BRF_GRA }, // 17 - - { "wt_a-6d.bin", 0x1000, 0xa5dde29b, 6 | BRF_SND }, // 18 Sound data - - { "wt_a-5s-b.bpr", 0x0100, 0x991e2a04, 7 | BRF_GRA }, // 19 Color PROMs - { "wt_a-5r-b.bpr", 0x0100, 0xfb3822b7, 7 | BRF_GRA }, // 20 - { "wt_a-5p-b.bpr", 0x0100, 0x95849f7d, 7 | BRF_GRA }, // 21 - { "wt_b-9l-.bpr", 0x0020, 0xd2728744, 7 | BRF_GRA }, // 22 -}; - -STD_ROM_PICK(atomboy) -STD_ROM_FN(atomboy) - -struct BurnDriver BurnDrvAtomboy = { - "atomboy", "wilytowr", NULL, NULL, "1985", - "Atomic Boy (revision B)\0", NULL, "Irem (Memetron license)", "M63", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_IREM_M63, GBF_PLATFORM, 0, - NULL, atomboyRomInfo, atomboyRomName, NULL, NULL, WilytowrInputInfo, WilytowrDIPInfo, - atomboyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x104, - 256, 224, 4, 3 -}; - - -// Atomic Boy (revision A) - -static struct BurnRomInfo atomboyaRomDesc[] = { - { "wt_a-4e.bin", 0x2000, 0xf7978185, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 code - { "wt_a-4h.bin", 0x2000, 0x0ca9950b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "wt_a-4j.bin", 0x2000, 0x1badbc65, 1 | BRF_PRG | BRF_ESS }, // 2 - { "wt_a-4k.bin", 0x2000, 0x5a341f75, 1 | BRF_PRG | BRF_ESS }, // 3 - { "wt_a-4m.bin", 0x2000, 0xc1f8a7d5, 1 | BRF_PRG | BRF_ESS }, // 4 - { "wt_a-4n.bin", 0x2000, 0xb212f7d2, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "wt_a-4d.bin", 0x1000, 0x3d43361e, 2 | BRF_PRG | BRF_ESS }, // 6 I8039 code - - { "wt_b-5e.bin", 0x1000, 0xfe45df43, 3 | BRF_GRA }, // 7 Characters - { "wt_b-5f.bin", 0x1000, 0x87a17eff, 3 | BRF_GRA }, // 8 - - { "wt_b-5a.bin", 0x2000, 0xda22c452, 4 | BRF_GRA }, // 9 Tiles - { "wt_b-5b.bin", 0x2000, 0x4fb25a1f, 4 | BRF_GRA }, // 10 - { "wt_b-5d.bin", 0x2000, 0x75be2604, 4 | BRF_GRA }, // 11 - - { "wt_a-3j.bin", 0x1000, 0xb30ca38f, 5 | BRF_GRA }, // 12 Sprites - { "wt_a-3k.bin", 0x1000, 0x9a77eb73, 5 | BRF_GRA }, // 13 - { "wt_a-3m.bin", 0x1000, 0xe7e468ae, 5 | BRF_GRA }, // 14 - { "wt_a-3n.bin", 0x1000, 0x0741d1a9, 5 | BRF_GRA }, // 15 - { "wt_a-3p.bin", 0x1000, 0x7299f362, 5 | BRF_GRA }, // 16 - { "wt_a-3s.bin", 0x1000, 0x9b37d50d, 5 | BRF_GRA }, // 17 - - { "wt_a-6d.bin", 0x1000, 0xa5dde29b, 6 | BRF_SND }, // 18 Sound data - - { "wt_a-5s-.bpr", 0x0100, 0x041950e7, 7 | BRF_GRA }, // 19 Color PROMs - { "wt_a-5r-.bpr", 0x0100, 0xbc04bf25, 7 | BRF_GRA }, // 20 - { "wt_a-5p-.bpr", 0x0100, 0xed819a19, 7 | BRF_GRA }, // 21 - { "wt_b-9l-.bpr", 0x0020, 0xd2728744, 7 | BRF_GRA }, // 22 -}; - -STD_ROM_PICK(atomboya) -STD_ROM_FN(atomboya) - -struct BurnDriver BurnDrvAtomboya = { - "atomboya", "wilytowr", NULL, NULL, "1985", - "Atomic Boy (revision A)\0", NULL, "Irem (Memetron license)", "M63", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_IREM_M63, GBF_PLATFORM, 0, - NULL, atomboyaRomInfo, atomboyaRomName, NULL, NULL, WilytowrInputInfo, WilytowrDIPInfo, - atomboyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x104, - 256, 224, 4, 3 -}; - - -// Fighting Basketball - -static struct BurnRomInfo fghtbsktRomDesc[] = { - { "fb14.0f", 0x2000, 0x82032853, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 code - { "fb13.2f", 0x2000, 0x5306df0f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "fb12.3f", 0x2000, 0xee9210d4, 1 | BRF_PRG | BRF_ESS }, // 2 - { "fb10.6f", 0x2000, 0x6b47efba, 1 | BRF_PRG | BRF_ESS }, // 3 - { "fb09.7f", 0x2000, 0xbe69e087, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "fb07.0b", 0x1000, 0x50432dbd, 2 | BRF_PRG | BRF_ESS }, // 5 I8039 code - - { "fb08.12f", 0x1000, 0x271cd7b8, 3 | BRF_GRA }, // 6 Characters - - { "fb21.25e", 0x2000, 0x02843591, 4 | BRF_GRA }, // 7 Tiles - { "fb22.23e", 0x2000, 0xcd51d8e7, 4 | BRF_GRA }, // 8 - { "fb23.22e", 0x2000, 0x62bcac87, 4 | BRF_GRA }, // 9 - - { "fb16.35a", 0x2000, 0xa5df1652, 5 | BRF_GRA }, // 10 Sprites - { "fb15.37a", 0x2000, 0x59c4de06, 5 | BRF_GRA }, // 11 - { "fb18.32a", 0x2000, 0xc23ddcd7, 5 | BRF_GRA }, // 12 - { "fb17.34a", 0x2000, 0x7db28013, 5 | BRF_GRA }, // 13 - { "fb20.29a", 0x2000, 0x1a1b48f8, 5 | BRF_GRA }, // 14 - { "fb19.31a", 0x2000, 0x7ff7e321, 5 | BRF_GRA }, // 15 - - { "fb06.12a", 0x2000, 0xbea3df99, 6 | BRF_SND }, // 16 Sound data - - { "fb_r.9e", 0x0100, 0xc5cdc8ba, 7 | BRF_GRA }, // 17 Color PROMs - { "fb_g.10e", 0x0100, 0x1460c936, 7 | BRF_GRA }, // 18 - { "fb_b.11e", 0x0100, 0xfca5bf0e, 7 | BRF_GRA }, // 19 - - { "fb01.42a", 0x2000, 0x1200b220, 8 | BRF_SND }, // 20 Samples - { "fb02.41a", 0x2000, 0x0b67aa82, 8 | BRF_SND }, // 21 - { "fb03.40a", 0x2000, 0xc71269ed, 8 | BRF_SND }, // 22 - { "fb04.39a", 0x2000, 0x02ddc42d, 8 | BRF_SND }, // 23 - { "fb05.38a", 0x2000, 0x72ea6b49, 8 | BRF_SND }, // 24 -}; - -STD_ROM_PICK(fghtbskt) -STD_ROM_FN(fghtbskt) - -struct BurnDriver BurnDrvFghtbskt = { - "fghtbskt", NULL, NULL, NULL, "1984", - "Fighting Basketball\0", NULL, "Paradise Co. Ltd.", "M63", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M63, GBF_SPORTSMISC, 0, - NULL, fghtbsktRomInfo, fghtbsktRomName, NULL, NULL, FghtbsktInputInfo, FghtbsktDIPInfo, - fghtbsktInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 256, 224, 4, 3 -}; +// FB Alpha Irem M63 driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "i8039.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvI8039ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvSndROM; +static UINT8 *DrvSampleROM; +static UINT8 *DrvColPROM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvVidRAM0; +static UINT8 *DrvVidRAM1; +static UINT8 *DrvColRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvScrRAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *interrupt_enable; +static UINT8 *flipscreen; +static UINT8 *palette_bank; +static UINT8 *sound_status; + +static INT16 *pAY8910Buffer[6]; + +static UINT8 m63_sound_p1; +static UINT8 m63_sound_p2; +static UINT8 sound_irq = 0; +static INT32 sample_pos = 0; +static INT32 sample_sel = -1; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[2]; +static UINT8 DrvReset; + +static INT32 sy_offset; +static INT32 char_color_offset; +static INT32 sound_interrupt_count; + +static struct BurnInputInfo WilytowrInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 6, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 4, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 5, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 6, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Wilytowr) + +static struct BurnInputInfo FghtbsktInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 1, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 0, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 6, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 1, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 0, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Fghtbskt) + +static struct BurnDIPInfo WilytowrDIPList[]= +{ + {0x10, 0xff, 0xff, 0x01, NULL }, + {0x11, 0xff, 0xff, 0x02, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x10, 0x01, 0x03, 0x00, "2" }, + {0x10, 0x01, 0x03, 0x01, "3" }, + {0x10, 0x01, 0x03, 0x02, "4" }, + {0x10, 0x01, 0x03, 0x03, "5" }, + + {0 , 0xfe, 0 , 4, "Bonus Points Rate" }, + {0x10, 0x01, 0x0c, 0x00, "Normal" }, + {0x10, 0x01, 0x0c, 0x04, "x1.2" }, + {0x10, 0x01, 0x0c, 0x08, "x1.4" }, + {0x10, 0x01, 0x0c, 0x0c, "x1.6" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x10, 0x01, 0x30, 0x20, "3 Coins 1 Credits" }, + {0x10, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x10, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, + {0x10, 0x01, 0x30, 0x30, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x10, 0x01, 0xc0, 0x00, "1 Coin 2 Credits" }, + {0x10, 0x01, 0xc0, 0x40, "1 Coin 3 Credits" }, + {0x10, 0x01, 0xc0, 0x80, "1 Coin 5 Credits" }, + {0x10, 0x01, 0xc0, 0xc0, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x10, 0x01, 0xf0, 0x60, "7 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x50, "6 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x40, "5 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x30, "4 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x20, "3 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x10, "2 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, + {0x10, 0x01, 0xf0, 0x80, "1 Coin 2 Credits" }, + {0x10, 0x01, 0xf0, 0x90, "1 Coin 3 Credits" }, + {0x10, 0x01, 0xf0, 0xa0, "1 Coin 4 Credits" }, + {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x10, 0x01, 0xf0, 0xc0, "1 Coin 6 Credits" }, + {0x10, 0x01, 0xf0, 0xd0, "1 Coin 7 Credits" }, + {0x10, 0x01, 0xf0, 0xe0, "1 Coin 8 Credits" }, + {0x10, 0x01, 0xf0, 0x70, "1 Coin 9 Credits" }, + {0x10, 0x01, 0xf0, 0xf0, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x11, 0x01, 0x01, 0x00, "Off" }, + {0x11, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x11, 0x01, 0x02, 0x02, "Upright" }, + {0x11, 0x01, 0x02, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x11, 0x01, 0x04, 0x00, "Mode 1" }, + {0x11, 0x01, 0x04, 0x04, "Mode 2" }, + + {0 , 0xfe, 0 , 0, "Stop Mode (Cheat)" }, + {0x11, 0x01, 0x10, 0x00, "Off" }, + {0x11, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)" }, + {0x11, 0x01, 0x40, 0x00, "Off" }, + {0x11, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 0, "Service Mode" }, + {0x11, 0x01, 0x80, 0x00, "Off" }, + {0x11, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Wilytowr) + +static struct BurnDIPInfo FghtbsktDIPList[]= +{ + {0x0f, 0xff, 0xff, 0xc4, NULL }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x0f, 0x01, 0x03, 0x03, "3 Coins 1 Credits" }, + {0x0f, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, + {0x0f, 0x01, 0x03, 0x00, "1 Coin 1 Credits" }, + {0x0f, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x0f, 0x01, 0x0c, 0x04, "1 Coin 1 Credits" }, + {0x0f, 0x01, 0x0c, 0x00, "1 Coin 2 Credits" }, + {0x0f, 0x01, 0x0c, 0x08, "1 Coin 4 Credits" }, + {0x0f, 0x01, 0x0c, 0x0c, "99 Credits / Sound Test" }, + + {0 , 0xfe, 0 , 2, "Time Count Down" }, + {0x0f, 0x01, 0x20, 0x00, "Slow" }, + {0x0f, 0x01, 0x20, 0x20, "Too Fast" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x0f, 0x01, 0x40, 0x40, "Upright" }, + {0x0f, 0x01, 0x40, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0f, 0x01, 0x80, 0x00, "Off" }, + {0x0f, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Fghtbskt) + +void __fastcall m63_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf000: + *interrupt_enable = data ? 1 : 0; + return; + + case 0xf002: + *flipscreen = ~data & 0x01; + return; + + case 0xf003: + *palette_bank = data & 0x01; + return; + + case 0xf006: + case 0xf007: + // coin counters (offset) + return; + + case 0xf800: + *soundlatch = data; + return; + + case 0xf801: + return; // nop + + case 0xf803: + I8039SetIrqState(1); + return; + } +} + +UINT8 __fastcall m63_main_read(UINT16 address) +{ + switch (address) + { + case 0xf000: // fghtbskt + return *sound_status; + + case 0xf800: + case 0xf001: // fghtbskt + return DrvInputs[0]; + + case 0xf801: + case 0xf002: // fghtbskt + return DrvInputs[1]; + + case 0xf802: + case 0xf003: // fghtbskt + return DrvDips[0]; + + case 0xf806: + return DrvDips[1]; + } + + return 0; +} + +void __fastcall fghtbskt_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf000: + I8039SetIrqState(1); + return; + + case 0xf002: + *soundlatch = data; + return; + + case 0xf801: + *interrupt_enable = data ? 1 : 0; + return; + + case 0xf802: + *flipscreen = data ? 1 : 0; + // if (flipscreen) ? tile_flipx : 0 + return; + + case 0xf807: + if (data & 0x01) { + sample_sel = ((data & 0xf0) << 8); + sample_pos = 0; + } + return; + + case 0xf001: + case 0xf800: + case 0xf803: + case 0xf804: + case 0xf805: + case 0xf806: + return; // nop + } +} + +UINT8 __fastcall m63_sound_read(UINT32 address) +{ + return DrvI8039ROM[address & 0x0fff]; +} + +void __fastcall m63_sound_write_port(UINT32 port, UINT8 data) +{ + if ((port & 0xff00) == 0x0000) { + if ((m63_sound_p2 & 0xf0) == 0xe0) + { + AY8910Write(0, 0, port & 0xff); + } + else if ((m63_sound_p2 & 0xf0) == 0xa0) + { + AY8910Write(0, 1, port & 0xff); + } + else if ((m63_sound_p1 & 0xe0) == 0x60 && sy_offset != 240) + { + AY8910Write(1, 0, port & 0xff); + } + else if ((m63_sound_p1 & 0xe0) == 0x40 && sy_offset != 240) + { + AY8910Write(1, 1, port & 0xff); + } + else if ((m63_sound_p2 & 0xf0) == 0x70) + { + *sound_status = port & 0xff; + } + + return; + } + + switch (port) + { + case 0x101: + m63_sound_p1 = data; + return; + + case 0x102: + m63_sound_p2 = data; + if ((data & 0xf0) == 0x50) I8039SetIrqState(0); + return; + } +} + +UINT8 __fastcall m63_sound_read_port(UINT32 port) +{ + if ((port & 0xff00) == 0x0000) { + if ((m63_sound_p2 & 0xf0) == 0x60) { + return *soundlatch; + } + else if ((m63_sound_p2 & 0xf0) == 0x70) + { + return DrvSndROM[((m63_sound_p1 & 0x1f) << 8) | (port & 0xff)]; + } + + return 0xff; + } + + switch (port) + { + case 0x111: + if (sound_irq) { + sound_irq = 0; + return 1; + } + return 0; + } + + return 0; +} + +static void m63PaletteRecalc() +{ + for (INT32 i = 0; i < 256; i++) + { + INT32 bit0 = (DrvColPROM[i] >> 0) & 0x01; + INT32 bit1 = (DrvColPROM[i] >> 1) & 0x01; + INT32 bit2 = (DrvColPROM[i] >> 2) & 0x01; + INT32 bit3 = (DrvColPROM[i] >> 3) & 0x01; + INT32 r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvColPROM[i + 256] >> 0) & 0x01; + bit1 = (DrvColPROM[i + 256] >> 1) & 0x01; + bit2 = (DrvColPROM[i + 256] >> 2) & 0x01; + bit3 = (DrvColPROM[i + 256] >> 3) & 0x01; + INT32 g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvColPROM[i + 2*256] >> 0) & 0x01; + bit1 = (DrvColPROM[i + 2*256] >> 1) & 0x01; + bit2 = (DrvColPROM[i + 2*256] >> 2) & 0x01; + bit3 = (DrvColPROM[i + 2*256] >> 3) & 0x01; + INT32 b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + DrvPalette[i] = BurnHighCol(r,g,b,0); + } + + for (INT32 i = 0; i < 4; i++) + { + INT32 bit0 = (DrvColPROM[0x300+i] >> 0) & 0x01; + INT32 bit1 = (DrvColPROM[0x300+i] >> 1) & 0x01; + INT32 bit2 = (DrvColPROM[0x300+i] >> 2) & 0x01; + INT32 r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (DrvColPROM[0x300+i] >> 3) & 0x01; + bit1 = (DrvColPROM[0x300+i] >> 4) & 0x01; + bit2 = (DrvColPROM[0x300+i] >> 5) & 0x01; + INT32 g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (DrvColPROM[0x300+i] >> 6) & 0x01; + bit1 = (DrvColPROM[0x300+i] >> 7) & 0x01; + INT32 b = 0x4f * bit0 + 0xa8 * bit1; + + DrvPalette[0x100+i] = BurnHighCol(r,g,b,0); + } +} + +static void m63_main_map() +{ + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); + ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM0); + ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM0); + ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe1ff, 0, DrvZ80RAM1); + ZetMapArea(0xe000, 0xe1ff, 1, DrvZ80RAM1); + ZetMapArea(0xe000, 0xe1ff, 2, DrvZ80RAM1); + ZetMapArea(0xe200, 0xe2ff, 0, DrvSprRAM); + ZetMapArea(0xe200, 0xe2ff, 1, DrvSprRAM); + ZetMapArea(0xe200, 0xe2ff, 2, DrvSprRAM); + ZetMapArea(0xe300, 0xe3ff, 0, DrvScrRAM); + ZetMapArea(0xe300, 0xe3ff, 1, DrvScrRAM); + ZetMapArea(0xe300, 0xe3ff, 2, DrvScrRAM); + ZetMapArea(0xe400, 0xe7ff, 0, DrvVidRAM1); + ZetMapArea(0xe400, 0xe7ff, 1, DrvVidRAM1); + ZetMapArea(0xe400, 0xe7ff, 2, DrvVidRAM1); + ZetMapArea(0xe800, 0xebff, 0, DrvVidRAM0); + ZetMapArea(0xe800, 0xebff, 1, DrvVidRAM0); + ZetMapArea(0xe800, 0xebff, 2, DrvVidRAM0); + ZetMapArea(0xec00, 0xefff, 0, DrvColRAM); + ZetMapArea(0xec00, 0xefff, 1, DrvColRAM); + ZetMapArea(0xec00, 0xefff, 2, DrvColRAM); + ZetSetWriteHandler(m63_main_write); + ZetSetReadHandler(m63_main_read); + ZetClose(); +} + +static void fghtbskt_main_map() +{ + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM0); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM0); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM0); + ZetMapArea(0xd000, 0xd1ff, 0, DrvZ80RAM1); + ZetMapArea(0xd000, 0xd1ff, 1, DrvZ80RAM1); + ZetMapArea(0xd000, 0xd1ff, 2, DrvZ80RAM1); + ZetMapArea(0xd200, 0xd2ff, 0, DrvSprRAM); + ZetMapArea(0xd200, 0xd2ff, 1, DrvSprRAM); + ZetMapArea(0xd200, 0xd2ff, 2, DrvSprRAM); + ZetMapArea(0xd300, 0xd3ff, 0, DrvScrRAM); + ZetMapArea(0xd300, 0xd3ff, 1, DrvScrRAM); + ZetMapArea(0xd300, 0xd3ff, 2, DrvScrRAM); + ZetMapArea(0xd400, 0xd7ff, 0, DrvVidRAM1); + ZetMapArea(0xd400, 0xd7ff, 1, DrvVidRAM1); + ZetMapArea(0xd400, 0xd7ff, 2, DrvVidRAM1); + ZetMapArea(0xd800, 0xdbff, 0, DrvVidRAM0); + ZetMapArea(0xd800, 0xdbff, 1, DrvVidRAM0); + ZetMapArea(0xd800, 0xdbff, 2, DrvVidRAM0); + ZetMapArea(0xdc00, 0xdfff, 0, DrvColRAM); + ZetMapArea(0xdc00, 0xdfff, 1, DrvColRAM); + ZetMapArea(0xdc00, 0xdfff, 2, DrvColRAM); + ZetSetWriteHandler(fghtbskt_main_write); + ZetSetReadHandler(m63_main_read); + ZetClose(); +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + I8039Reset(); + + AY8910Reset(0); + AY8910Reset(1); + + m63_sound_p1 = 0; + m63_sound_p2 = 0; + sound_irq = 0; + sample_pos = 0; + sample_sel = -1; + + DrvRecalc = 1; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[2] = { 0x8000, 0x0000 }; + INT32 Plane1[3] = { (0x2000*8)*2, (0x2000*8)*1, (0x2000*8)*0 }; + INT32 Plane2[3] = { (0x4000*8)*2, (0x4000*8)*1, (0x4000*8)*0 }; + INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, (0x2000*8)+0, (0x2000*8)+1, (0x2000*8)+2, (0x2000*8)+3, (0x2000*8)+4, (0x2000*8)+5, (0x2000*8)+6, (0x2000*8)+7 }; + INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0xc000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x2000); + + GfxDecode(0x0100, 2, 8, 8, Plane0, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x6000); + + GfxDecode(0x0400, 3, 8, 8, Plane1, XOffs, YOffs, 0x040, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0xc000); + + GfxDecode(0x0200, 3, 16, 16, Plane2, XOffs, YOffs, 0x080, tmp, DrvGfxROM2); + + BurnFree (tmp); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x010000; + DrvI8039ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x008000; + DrvGfxROM1 = Next; Next += 0x010000; + DrvGfxROM2 = Next; Next += 0x020000; + + DrvSampleROM = Next; Next += 0x010000; + + DrvSndROM = Next; Next += 0x002000; + + DrvColPROM = Next; Next += 0x000400; + + DrvPalette = (UINT32*)Next; Next += 0x0104 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x001000; + DrvZ80RAM1 = Next; Next += 0x000200; + DrvVidRAM0 = Next; Next += 0x000400; + DrvVidRAM1 = Next; Next += 0x000400; + DrvColRAM = Next; Next += 0x000400; + DrvSprRAM = Next; Next += 0x000100; + DrvScrRAM = Next; Next += 0x000100; + + soundlatch = Next; Next += 0x000001; + interrupt_enable = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + palette_bank = Next; Next += 0x000001; + sound_status = Next; Next += 0x000001; + + RamEnd = Next; + + for (INT32 i = 0; i < 6; i++) { + pAY8910Buffer[i] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + } + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit(void (*pMapMainCPU)(), INT32 (*pRomLoadCallback)(), INT32 syoffset, INT32 charcoloroff, INT32 sndirqcount) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (pRomLoadCallback()) return 1; + + DrvGfxDecode(); + + pMapMainCPU(); + + I8039Init(NULL); + I8039SetProgramReadHandler(m63_sound_read); + I8039SetCPUOpReadHandler(m63_sound_read); + I8039SetCPUOpReadArgHandler(m63_sound_read); + I8039SetIOReadHandler(m63_sound_read_port); + I8039SetIOWriteHandler(m63_sound_write_port); + + AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 1.00, BURN_SND_ROUTE_BOTH); + + sy_offset = syoffset; + char_color_offset = charcoloroff; + sound_interrupt_count = sndirqcount; + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + I8039Exit(); + + AY8910Exit(0); + AY8910Exit(1); + + BurnFree (AllMem); + + return 0; +} + +static INT32 wilytowerLoadRoms() +{ + if (BurnLoadRom(DrvZ80ROM + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x02000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x04000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x06000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x08000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x0a000, 5, 1)) return 1; + + if (BurnLoadRom(DrvI8039ROM, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x01000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x02000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x04000, 11, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x02000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x04000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x06000, 15, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x08000, 16, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x0a000, 17, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x00000, 18, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00000, 19, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00100, 20, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00200, 21, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00300, 22, 1)) return 1; + + return 0; +} + +static INT32 fghtbsktLoadRoms() +{ + if (BurnLoadRom(DrvZ80ROM + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x02000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x04000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x08000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x0a000, 4, 1)) return 1; + + if (BurnLoadRom(DrvI8039ROM, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; + memcpy (DrvGfxROM0 + 0x1000, DrvGfxROM0 + 0x0800, 0x0800); + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x02000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x04000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x02000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x04000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x06000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x08000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x0a000, 15, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x00000, 16, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00000, 17, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00100, 18, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00200, 19, 1)) return 1; + + if (BurnLoadRom(DrvSampleROM + 0x00000, 20, 1)) return 1; + if (BurnLoadRom(DrvSampleROM + 0x02000, 21, 1)) return 1; + if (BurnLoadRom(DrvSampleROM + 0x04000, 22, 1)) return 1; + if (BurnLoadRom(DrvSampleROM + 0x06000, 23, 1)) return 1; + if (BurnLoadRom(DrvSampleROM + 0x08000, 24, 1)) return 1; + + return 0; +} + +static INT32 wilytowrInit() +{ + return DrvInit(m63_main_map, wilytowerLoadRoms, 238, 0x100, 60); +} + +static INT32 atomboyInit() +{ + return DrvInit(m63_main_map, wilytowerLoadRoms, 238, 0x100, 60/2); +} + +static INT32 fghtbsktInit() +{ + INT32 nRet = DrvInit(fghtbskt_main_map, fghtbsktLoadRoms, 240, 0x010, 60/2); + + AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +static void draw_bg_layer() +{ + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + sy -= DrvScrRAM[(offs & 0x1f) * 8] + 16; + if (sy < -7) sy += 256; + if (sy >= nScreenHeight) continue; + + INT32 attr = DrvColRAM[offs]; + INT32 code = DrvVidRAM0[offs] | ((attr & 0x30) << 4); + INT32 color = (attr & 0x0f) | (*palette_bank << 4); + + if (*flipscreen) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, 248 - sx, 216 - sy, color, 3, 0, DrvGfxROM1); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM1); + } + } +} + +static void draw_fg_layer() +{ + for (INT32 offs = (256/8)*(16/8); offs < (32 * 32) - ((256/8)*(16/8)); offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = ((offs >> 5) << 3) - 16; + + if (*flipscreen) { + Render8x8Tile_Mask_FlipXY(pTransDraw, DrvVidRAM1[offs], 248 - sx, 216 - sy, 0, 2, 0, char_color_offset, DrvGfxROM0); + } else { + Render8x8Tile_Mask(pTransDraw, DrvVidRAM1[offs], sx, sy, 0, 2, 0, char_color_offset, DrvGfxROM0); + } + } +} + +static void draw_sprite_tile(INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy) +{ + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2); + } + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0; offs < 0x100; offs += 4) + { + INT32 sx = DrvSprRAM[offs + 3]; + INT32 attr = DrvSprRAM[offs + 2]; + INT32 code = (DrvSprRAM[offs + 1]) | ((attr & 0x10) << 4); + INT32 sy = (sy_offset - DrvSprRAM[offs]) - 16; + + INT32 color = (attr & 0x0f) | (*palette_bank << 4); + INT32 flipx = (attr & 0x20); + INT32 flipy = 0; + + if (*flipscreen) + { + sx = 240 - sx; + sy = sy_offset - sy; + flipx = !flipx; + flipy = !flipy; + } + + draw_sprite_tile(code, color, sx, sy, flipx, flipy); + + if (sx > 0xf0) { + draw_sprite_tile(code, color, sx, sy, flipx, flipy); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + m63PaletteRecalc(); + DrvRecalc = 0; + } + + draw_bg_layer(); + draw_sprites(); + draw_fg_layer(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static void sample_render(short *pSoundBuf, INT32 nLength) +{ + if (sample_sel == -1) return; + + double Addr = sample_pos + sample_sel; + double Step = (double)8000 / nBurnSoundRate; + + for (INT32 i = 0; i < nLength && Addr < 0xa000; i += 2, Addr += Step) { + short Sample = (short)((DrvSampleROM[(int)Addr]^0x80) << 8); + + pSoundBuf[i ] += Sample; + pSoundBuf[i + 1] += Sample; + } + + sample_pos = (int)Addr; + if (Addr >= 0xa000) sample_sel = -1; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0, 2); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + INT32 nCyclesTotal[2] = { 3000000 / 60, 3000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + INT32 nInterleave = 100; + + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += ZetRun(nCyclesTotal[0] / nInterleave); + nCyclesDone[1] += I8039Run(nCyclesTotal[1] / nInterleave); + } + + if (sound_interrupt_count == 30) { + if (nCurrentFrame & 1) sound_irq = 1; + } else { + sound_irq = 1; + } + + if (*interrupt_enable) ZetNmi(); + + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + + sample_render(pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + I8039Scan(nAction, pnMin); + + AY8910Scan(nAction, pnMin); + + SCAN_VAR(m63_sound_p1); + SCAN_VAR(m63_sound_p2); + SCAN_VAR(sound_irq); + SCAN_VAR(sample_pos); + SCAN_VAR(sample_sel); + } + + return 0; +} + + +// Wily Tower + +static struct BurnRomInfo wilytowrRomDesc[] = { + { "wt4e.bin", 0x2000, 0xa38e4b8a, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 code + { "wt4h.bin", 0x2000, 0xc1405ceb, 1 | BRF_PRG | BRF_ESS }, // 1 + { "wt4j.bin", 0x2000, 0x379fb1c3, 1 | BRF_PRG | BRF_ESS }, // 2 + { "wt4k.bin", 0x2000, 0x2dd6f9c7, 1 | BRF_PRG | BRF_ESS }, // 3 + { "wt_a-4m.bin", 0x2000, 0xc1f8a7d5, 1 | BRF_PRG | BRF_ESS }, // 4 + { "wt_a-4n.bin", 0x2000, 0xb212f7d2, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "wt4d.bin", 0x1000, 0x25a171bf, 2 | BRF_PRG | BRF_ESS }, // 6 I8039 code + + { "wt_b-5e.bin", 0x1000, 0xfe45df43, 3 | BRF_GRA }, // 7 Characters + { "wt_b-5f.bin", 0x1000, 0x87a17eff, 3 | BRF_GRA }, // 8 + + { "wtb5a.bin", 0x2000, 0xefc1cbfa, 4 | BRF_GRA }, // 9 Tiles + { "wtb5b.bin", 0x2000, 0xab4bfd07, 4 | BRF_GRA }, // 10 + { "wtb5d.bin", 0x2000, 0x40f23e1d, 4 | BRF_GRA }, // 11 + + { "wt2j.bin", 0x1000, 0xd1bf0670, 5 | BRF_GRA }, // 12 Sprites + { "wt3k.bin", 0x1000, 0x83c39a0e, 5 | BRF_GRA }, // 13 + { "wt_a-3m.bin", 0x1000, 0xe7e468ae, 5 | BRF_GRA }, // 14 + { "wt_a-3n.bin", 0x1000, 0x0741d1a9, 5 | BRF_GRA }, // 15 + { "wt_a-3p.bin", 0x1000, 0x7299f362, 5 | BRF_GRA }, // 16 + { "wt_a-3s.bin", 0x1000, 0x9b37d50d, 5 | BRF_GRA }, // 17 + + { "wt_a-6d.bin", 0x1000, 0xa5dde29b, 6 | BRF_SND }, // 18 Sound data + + { "wt_a-5s-.bpr", 0x0100, 0x041950e7, 7 | BRF_GRA }, // 19 Color PROMs + { "wt_a-5r-.bpr", 0x0100, 0xbc04bf25, 7 | BRF_GRA }, // 20 + { "wt_a-5p-.bpr", 0x0100, 0xed819a19, 7 | BRF_GRA }, // 21 + { "wt_b-9l-.bpr", 0x0020, 0xd2728744, 7 | BRF_GRA }, // 22 +}; + +STD_ROM_PICK(wilytowr) +STD_ROM_FN(wilytowr) + +struct BurnDriver BurnDrvWilytowr = { + "wilytowr", NULL, NULL, NULL, "1984", + "Wily Tower\0", NULL, "Irem", "M63", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_IREM_M63, GBF_PLATFORM, 0, + NULL, wilytowrRomInfo, wilytowrRomName, NULL, NULL, WilytowrInputInfo, WilytowrDIPInfo, + wilytowrInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x104, + 256, 224, 4, 3 +}; + + +// Atomic Boy (revision B) + +static struct BurnRomInfo atomboyRomDesc[] = { + { "wt_a-4e.bin", 0x2000, 0xf7978185, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 code + { "wt_a-4h.bin", 0x2000, 0x0ca9950b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "wt_a-4j.bin", 0x2000, 0x1badbc65, 1 | BRF_PRG | BRF_ESS }, // 2 + { "wt_a-4k.bin", 0x2000, 0x5a341f75, 1 | BRF_PRG | BRF_ESS }, // 3 + { "wt_a-4m.bin", 0x2000, 0xc1f8a7d5, 1 | BRF_PRG | BRF_ESS }, // 4 + { "wt_a-4n.bin", 0x2000, 0xb212f7d2, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "wt_a-4d-b.bin", 0x2000, 0x793ea53f, 2 | BRF_PRG | BRF_ESS }, // 6 I8039 code + + { "wt_b-5e.bin", 0x1000, 0xfe45df43, 3 | BRF_GRA }, // 7 Characters + { "wt_b-5f.bin", 0x1000, 0x87a17eff, 3 | BRF_GRA }, // 8 + + { "wt_b-5a.bin", 0x2000, 0xda22c452, 4 | BRF_GRA }, // 9 Tiles + { "wt_b-5b.bin", 0x2000, 0x4fb25a1f, 4 | BRF_GRA }, // 10 + { "wt_b-5d.bin", 0x2000, 0x75be2604, 4 | BRF_GRA }, // 11 + + { "wt_a-3j-b.bin", 0x2000, 0x996470f1, 5 | BRF_GRA }, // 12 Sprites + { "wt_a-3k-b.bin", 0x2000, 0x8f4ec45c, 5 | BRF_GRA }, // 13 + { "wt_a-3m-b.bin", 0x2000, 0x4ac40358, 5 | BRF_GRA }, // 14 + { "wt_a-3n-b.bin", 0x2000, 0x709eef5b, 5 | BRF_GRA }, // 15 + { "wt_a-3p-b.bin", 0x2000, 0x3018b840, 5 | BRF_GRA }, // 16 + { "wt_a-3s-b.bin", 0x2000, 0x05a251d4, 5 | BRF_GRA }, // 17 + + { "wt_a-6d.bin", 0x1000, 0xa5dde29b, 6 | BRF_SND }, // 18 Sound data + + { "wt_a-5s-b.bpr", 0x0100, 0x991e2a04, 7 | BRF_GRA }, // 19 Color PROMs + { "wt_a-5r-b.bpr", 0x0100, 0xfb3822b7, 7 | BRF_GRA }, // 20 + { "wt_a-5p-b.bpr", 0x0100, 0x95849f7d, 7 | BRF_GRA }, // 21 + { "wt_b-9l-.bpr", 0x0020, 0xd2728744, 7 | BRF_GRA }, // 22 +}; + +STD_ROM_PICK(atomboy) +STD_ROM_FN(atomboy) + +struct BurnDriver BurnDrvAtomboy = { + "atomboy", "wilytowr", NULL, NULL, "1985", + "Atomic Boy (revision B)\0", NULL, "Irem (Memetron license)", "M63", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_IREM_M63, GBF_PLATFORM, 0, + NULL, atomboyRomInfo, atomboyRomName, NULL, NULL, WilytowrInputInfo, WilytowrDIPInfo, + atomboyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x104, + 256, 224, 4, 3 +}; + + +// Atomic Boy (revision A) + +static struct BurnRomInfo atomboyaRomDesc[] = { + { "wt_a-4e.bin", 0x2000, 0xf7978185, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 code + { "wt_a-4h.bin", 0x2000, 0x0ca9950b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "wt_a-4j.bin", 0x2000, 0x1badbc65, 1 | BRF_PRG | BRF_ESS }, // 2 + { "wt_a-4k.bin", 0x2000, 0x5a341f75, 1 | BRF_PRG | BRF_ESS }, // 3 + { "wt_a-4m.bin", 0x2000, 0xc1f8a7d5, 1 | BRF_PRG | BRF_ESS }, // 4 + { "wt_a-4n.bin", 0x2000, 0xb212f7d2, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "wt_a-4d.bin", 0x1000, 0x3d43361e, 2 | BRF_PRG | BRF_ESS }, // 6 I8039 code + + { "wt_b-5e.bin", 0x1000, 0xfe45df43, 3 | BRF_GRA }, // 7 Characters + { "wt_b-5f.bin", 0x1000, 0x87a17eff, 3 | BRF_GRA }, // 8 + + { "wt_b-5a.bin", 0x2000, 0xda22c452, 4 | BRF_GRA }, // 9 Tiles + { "wt_b-5b.bin", 0x2000, 0x4fb25a1f, 4 | BRF_GRA }, // 10 + { "wt_b-5d.bin", 0x2000, 0x75be2604, 4 | BRF_GRA }, // 11 + + { "wt_a-3j.bin", 0x1000, 0xb30ca38f, 5 | BRF_GRA }, // 12 Sprites + { "wt_a-3k.bin", 0x1000, 0x9a77eb73, 5 | BRF_GRA }, // 13 + { "wt_a-3m.bin", 0x1000, 0xe7e468ae, 5 | BRF_GRA }, // 14 + { "wt_a-3n.bin", 0x1000, 0x0741d1a9, 5 | BRF_GRA }, // 15 + { "wt_a-3p.bin", 0x1000, 0x7299f362, 5 | BRF_GRA }, // 16 + { "wt_a-3s.bin", 0x1000, 0x9b37d50d, 5 | BRF_GRA }, // 17 + + { "wt_a-6d.bin", 0x1000, 0xa5dde29b, 6 | BRF_SND }, // 18 Sound data + + { "wt_a-5s-.bpr", 0x0100, 0x041950e7, 7 | BRF_GRA }, // 19 Color PROMs + { "wt_a-5r-.bpr", 0x0100, 0xbc04bf25, 7 | BRF_GRA }, // 20 + { "wt_a-5p-.bpr", 0x0100, 0xed819a19, 7 | BRF_GRA }, // 21 + { "wt_b-9l-.bpr", 0x0020, 0xd2728744, 7 | BRF_GRA }, // 22 +}; + +STD_ROM_PICK(atomboya) +STD_ROM_FN(atomboya) + +struct BurnDriver BurnDrvAtomboya = { + "atomboya", "wilytowr", NULL, NULL, "1985", + "Atomic Boy (revision A)\0", NULL, "Irem (Memetron license)", "M63", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_IREM_M63, GBF_PLATFORM, 0, + NULL, atomboyaRomInfo, atomboyaRomName, NULL, NULL, WilytowrInputInfo, WilytowrDIPInfo, + atomboyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x104, + 256, 224, 4, 3 +}; + + +// Fighting Basketball + +static struct BurnRomInfo fghtbsktRomDesc[] = { + { "fb14.0f", 0x2000, 0x82032853, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 code + { "fb13.2f", 0x2000, 0x5306df0f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "fb12.3f", 0x2000, 0xee9210d4, 1 | BRF_PRG | BRF_ESS }, // 2 + { "fb10.6f", 0x2000, 0x6b47efba, 1 | BRF_PRG | BRF_ESS }, // 3 + { "fb09.7f", 0x2000, 0xbe69e087, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "fb07.0b", 0x1000, 0x50432dbd, 2 | BRF_PRG | BRF_ESS }, // 5 I8039 code + + { "fb08.12f", 0x1000, 0x271cd7b8, 3 | BRF_GRA }, // 6 Characters + + { "fb21.25e", 0x2000, 0x02843591, 4 | BRF_GRA }, // 7 Tiles + { "fb22.23e", 0x2000, 0xcd51d8e7, 4 | BRF_GRA }, // 8 + { "fb23.22e", 0x2000, 0x62bcac87, 4 | BRF_GRA }, // 9 + + { "fb16.35a", 0x2000, 0xa5df1652, 5 | BRF_GRA }, // 10 Sprites + { "fb15.37a", 0x2000, 0x59c4de06, 5 | BRF_GRA }, // 11 + { "fb18.32a", 0x2000, 0xc23ddcd7, 5 | BRF_GRA }, // 12 + { "fb17.34a", 0x2000, 0x7db28013, 5 | BRF_GRA }, // 13 + { "fb20.29a", 0x2000, 0x1a1b48f8, 5 | BRF_GRA }, // 14 + { "fb19.31a", 0x2000, 0x7ff7e321, 5 | BRF_GRA }, // 15 + + { "fb06.12a", 0x2000, 0xbea3df99, 6 | BRF_SND }, // 16 Sound data + + { "fb_r.9e", 0x0100, 0xc5cdc8ba, 7 | BRF_GRA }, // 17 Color PROMs + { "fb_g.10e", 0x0100, 0x1460c936, 7 | BRF_GRA }, // 18 + { "fb_b.11e", 0x0100, 0xfca5bf0e, 7 | BRF_GRA }, // 19 + + { "fb01.42a", 0x2000, 0x1200b220, 8 | BRF_SND }, // 20 Samples + { "fb02.41a", 0x2000, 0x0b67aa82, 8 | BRF_SND }, // 21 + { "fb03.40a", 0x2000, 0xc71269ed, 8 | BRF_SND }, // 22 + { "fb04.39a", 0x2000, 0x02ddc42d, 8 | BRF_SND }, // 23 + { "fb05.38a", 0x2000, 0x72ea6b49, 8 | BRF_SND }, // 24 +}; + +STD_ROM_PICK(fghtbskt) +STD_ROM_FN(fghtbskt) + +struct BurnDriver BurnDrvFghtbskt = { + "fghtbskt", NULL, NULL, NULL, "1984", + "Fighting Basketball\0", NULL, "Paradise Co. Ltd.", "M63", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M63, GBF_SPORTSMISC, 0, + NULL, fghtbsktRomInfo, fghtbsktRomName, NULL, NULL, FghtbsktInputInfo, FghtbsktDIPInfo, + fghtbsktInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 256, 224, 4, 3 +}; diff --git a/src/burn/drv/irem/d_m72.cpp b/src/burn/drv/irem/d_m72.cpp index f5b7059fe..071cc703e 100644 --- a/src/burn/drv/irem/d_m72.cpp +++ b/src/burn/drv/irem/d_m72.cpp @@ -1,3877 +1,3875 @@ -// FB Alpha Irem M72 driver module -// Based on MAME driver by Nicola Salmoria and Nao - -/* - to do: - clean - fix/improve sound - poundfor inputs -*/ - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "nec_intf.h" -#include "irem_cpu.h" -#include "dac.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvV30ROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvSndROM; -static UINT8 *DrvVidRAM0; -static UINT8 *DrvVidRAM1; -static UINT8 *DrvV30RAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf; -static UINT8 *DrvPalRAM; -static UINT8 *DrvProtRAM; -static UINT8 *DrvRowScroll; -static UINT8 *DrvSprRAM2; - -static UINT8 *scroll; - -static UINT8 *RamPrioBitmap; - -static UINT8 *soundlatch; -static UINT8 *video_enable; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; -static INT32 ym2151_previous = 0; -static UINT8 irqvector; -static INT32 sample_address; -static INT32 irq_raster_position; -static INT32 z80_reset = 0; -static INT32 majtitle_rowscroll_enable = 0; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[5]; -static UINT8 DrvReset; - -const static INT32 nInterleave = 284; -static INT32 nCurrentCycles; -static INT32 nCyclesDone[2]; -static INT32 nCyclesTotal[2]; - -static INT32 m72_video_type = 0; -static INT32 z80_nmi_enable = 0; -static INT32 enable_z80_reset = 0; // only if z80 is not rom-based! -static INT32 m72_irq_base = 0x80; -static INT32 code_mask[4]; -static INT32 graphics_length[4]; -static INT32 video_offsets[2] = { 0, 0 }; - -enum { Z80_NO_NMI=0, Z80_REAL_NMI, Z80_FAKE_NMI }; -enum { VECTOR_INIT, YM2151_ASSERT, YM2151_CLEAR, Z80_ASSERT, Z80_CLEAR }; - - -static struct BurnInputInfo CommonInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 4" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 4" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Common) - -static struct BurnInputInfo PoundforInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 2, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 0, "p1 start"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - - // save space for analog inputs - {"P2 Button 3", BIT_DIGITAL, DrvJoy5 + 6, "p2 fire 3"}, - {"P2 Button 4", BIT_DIGITAL, DrvJoy5 + 6, "p2 fire 4"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 3, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 1, "p2 start"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy4 + 6, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p2 fire 2"}, - - // save space for analog inputs... - {"P2 Button 5", BIT_DIGITAL, DrvJoy5 + 6, "p2 fire 5"}, - {"P2 Button 6", BIT_DIGITAL, DrvJoy5 + 6, "p2 fire 6"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service", BIT_DIGITAL, DrvJoy2 + 4, "service"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(Poundfor) - -static struct BurnDIPInfo Dip2CoinDIPList[]= -{ - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x40, 0x40, "Off" }, - {0x16, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x17, 0x01, 0x01, 0x01, "Off" }, - {0x17, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x17, 0x01, 0x08, 0x08, "Mode 1" }, - {0x17, 0x01, 0x08, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x17, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x17, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x17, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x17, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x17, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x17, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Cont." }, - {0x17, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x17, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x17, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x17, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x17, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x17, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x17, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x17, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x17, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x17, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -static struct BurnDIPInfo Dip1CoinDIPList[]= -{ - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x16, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, - {0x16, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, - {0x16, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x16, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x16, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x16, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x16, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x16, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x16, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x16, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x16, 0x01, 0xf0, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x17, 0x01, 0x01, 0x01, "Off" }, - {0x17, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x17, 0x01, 0x04, 0x04, "Mode 1" }, - {0x17, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2, "Stop Mode" }, - {0x17, 0x01, 0x20, 0x20, "Off" }, - {0x17, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x17, 0x01, 0x80, 0x80, "Off" }, - {0x17, 0x01, 0x80, 0x00, "On" }, -}; - -static struct BurnDIPInfo RtypeDIPList[]= -{ - {0x16, 0xff, 0xff, 0xfb, NULL }, - {0x17, 0xff, 0xff, 0xfd, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x16, 0x01, 0x08, 0x00, "50K 150K 250K 400K 600K" }, - {0x16, 0x01, 0x08, 0x08, "100K 200K 350K 500K 700K" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x17, 0x01, 0x02, 0x00, "Upright" }, - {0x17, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x17, 0x01, 0x08, 0x08, "Normal" }, - {0x17, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x17, 0x01, 0x10, 0x00, "No" }, - {0x17, 0x01, 0x10, 0x10, "Yes" }, - - {0 , 0xfe, 0 , 2, "Invulnerability" }, - {0x17, 0x01, 0x40, 0x40, "Off" }, - {0x17, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFOEXT(Rtype, Dip1Coin, Rtype ) - -static struct BurnDIPInfo RtypepDIPList[]= -{ - {0x16, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x04, 0x04, "On" }, - {0x16, 0x01, 0x04, 0x00, "Off" }, -}; - -STDDIPINFOEXT(Rtypep, Rtype, Rtypep ) - -static struct BurnDIPInfo XmultiplDIPList[]= -{ - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xfd, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Very Easy" }, - {0x16, 0x01, 0x03, 0x01, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Normal" }, - {0x16, 0x01, 0x03, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x0c, 0x08, "1" }, - {0x16, 0x01, 0x0c, 0x04, "2" }, - {0x16, 0x01, 0x0c, 0x0c, "3" }, - {0x16, 0x01, 0x0c, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Cabinet" }, - {0x17, 0x01, 0x02, 0x00, "Upright (single)" }, - {0x17, 0x01, 0x02, 0x02, "Cocktail" }, - {0x17, 0x01, 0x02, 0x00, "Upright (double) On" }, - {0x17, 0x01, 0x02, 0x02, "Upright (double) Off" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x17, 0x01, 0x08, 0x00, "Off" }, - {0x17, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Upright (double) Mode" }, - {0x17, 0x01, 0x10, 0x10, "Off" }, - {0x17, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x17, 0x01, 0x20, 0x00, "No" }, - {0x17, 0x01, 0x20, 0x20, "Yes" }, -}; - -STDDIPINFOEXT(Xmultipl, Dip1Coin, Xmultipl ) - -static struct BurnDIPInfo DbreedDIPList[]= -{ - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xf5, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x0c, 0x00, "Very Easy" }, - {0x16, 0x01, 0x0c, 0x08, "Easy" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Hard" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x17, 0x01, 0x02, 0x00, "Upright" }, - {0x17, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x17, 0x01, 0x08, 0x08, "Off" }, - {0x17, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x17, 0x01, 0x10, 0x00, "No" }, - {0x17, 0x01, 0x10, 0x10, "Yes" }, -}; - -STDDIPINFOEXT(Dbreed, Dip1Coin, Dbreed ) - -static struct BurnDIPInfo BchopperDIPList[]= -{ - {0x16, 0xff, 0xff, 0xfb, NULL }, - {0x17, 0xff, 0xff, 0xfd, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x00, "1" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x16, 0x01, 0x08, 0x08, "80K 200K 350K" }, - {0x16, 0x01, 0x08, 0x00, "100K 250K 400K" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x17, 0x01, 0x02, 0x00, "Upright" }, - {0x17, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x17, 0x01, 0x08, 0x08, "Normal" }, - {0x17, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x17, 0x01, 0x10, 0x00, "No" }, - {0x17, 0x01, 0x10, 0x10, "Yes" }, - - {0 , 0xfe, 0 , 2, "Invulnerability" }, - {0x17, 0x01, 0x40, 0x40, "Off" }, - {0x17, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFOEXT(Bchopper, Dip1Coin, Bchopper ) - -static struct BurnDIPInfo NspiritDIPList[]= -{ - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xf5, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x0c, 0x08, "Easy" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Hard" }, - {0x16, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x17, 0x01, 0x02, 0x00, "Upright" }, - {0x17, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x17, 0x01, 0x08, 0x08, "Off" }, - {0x17, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x17, 0x01, 0x10, 0x00, "No" }, - {0x17, 0x01, 0x10, 0x10, "Yes" }, - - {0 , 0xfe, 0 , 2, "Invulnerability" }, - {0x17, 0x01, 0x40, 0x40, "Off" }, - {0x17, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFOEXT(Nspirit, Dip1Coin, Nspirit ) - -static struct BurnDIPInfo ImgfightDIPList[]= -{ - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xe5, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x08, "Hard" }, - {0x16, 0x01, 0x0c, 0x04, "Hardest" }, - {0x16, 0x01, 0x0c, 0x00, "Debug Mode 2 lap" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x17, 0x01, 0x02, 0x00, "Upright" }, - {0x17, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x17, 0x01, 0x08, 0x08, "Off" }, - {0x17, 0x01, 0x08, 0x00, "On" }, -}; - -STDDIPINFOEXT(Imgfight, Dip1Coin, Imgfight ) - -static struct BurnDIPInfo Rtype2DIPList[]= -{ - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xf7, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x0c, 0x08, "Easy" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Hard" }, - {0x16, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x17, 0x01, 0x02, 0x00, "Off" }, - {0x17, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 3, "Cabinet" }, - {0x17, 0x01, 0x18, 0x10, "Upright" }, - {0x17, 0x01, 0x18, 0x00, "Upright (2P)" }, - {0x17, 0x01, 0x18, 0x18, "Cocktail" }, -}; - -STDDIPINFOEXT(Rtype2, Dip1Coin, Rtype2 ) - -static struct BurnDIPInfo LohtDIPList[]= -{ - {0x16, 0xff, 0xff, 0xfb, NULL }, - {0x17, 0xff, 0xff, 0xfd, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x00, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x02, "4" }, - {0x16, 0x01, 0x03, 0x01, "5" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x17, 0x01, 0x02, 0x00, "Upright" }, - {0x17, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x17, 0x01, 0x18, 0x00, "Easy" }, - {0x17, 0x01, 0x18, 0x18, "Normal" }, - {0x17, 0x01, 0x18, 0x10, "Hard" }, - {0x17, 0x01, 0x18, 0x08, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Invulnerability" }, - {0x17, 0x01, 0x40, 0x40, "Off" }, - {0x17, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFOEXT(Loht, Dip1Coin, Loht ) - -static struct BurnDIPInfo AirduelDIPList[]= -{ - {0x16, 0xff, 0xff, 0xbf, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x0c, 0x00, "Very Easy" }, - {0x16, 0x01, 0x0c, 0x08, "Easy" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Hard" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x17, 0x01, 0x01, 0x01, "Off" }, - {0x17, 0x01, 0x01, 0x00, "On" }, -}; - -STDDIPINFOEXT(Airduel, Dip2Coin, Airduel ) - -static struct BurnDIPInfo GallopDIPList[]= -{ - {0x16, 0xff, 0xff, 0xbf, NULL }, - {0x17, 0xff, 0xff, 0xf9, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x0c, 0x00, "Very Easy" }, - {0x16, 0x01, 0x0c, 0x08, "Easy" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Hard" }, - - {0 , 0xfe, 0 , 0, "Allow Continue" }, - {0x16, 0x01, 0x20, 0x00, "No" }, - {0x16, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x17, 0x01, 0x01, 0x01, "Off" }, - {0x17, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x17, 0x01, 0x06, 0x00, "Upright" }, - {0x17, 0x01, 0x06, 0x02, "Upright (2P)" }, - {0x17, 0x01, 0x06, 0x06, "Cocktail" }, -}; - -STDDIPINFOEXT(Gallop, Dip2Coin, Gallop ) - -static struct BurnDIPInfo KengoDIPList[]= -{ - {0x16, 0xff, 0xff, 0xbf, NULL }, - {0x17, 0xff, 0xff, 0xf9, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x0c, 0x00, "Very Easy" }, - {0x16, 0x01, 0x0c, 0x08, "Easy" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Hard" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x16, 0x01, 0x20, 0x00, "No" }, - {0x16, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x17, 0x01, 0x01, 0x01, "Off" }, - {0x17, 0x01, 0x01, 0x00, "On" }, -}; - -STDDIPINFOEXT(Kengo, Dip2Coin, Kengo ) - -static struct BurnDIPInfo HharryDIPList[]= -{ - {0x16, 0xff, 0xff, 0xbf, NULL }, - {0x17, 0xff, 0xff, 0xfd, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x0c, 0x00, "Very Easy" }, - {0x16, 0x01, 0x0c, 0x08, "Easy" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Hard" }, - - {0 , 0xfe, 0 , 2, "Continue Limit" }, - {0x16, 0x01, 0x10, 0x00, "No" }, - {0x16, 0x01, 0x10, 0x10, "Yes" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x16, 0x01, 0x20, 0x00, "No" }, - {0x16, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 3, "Cabinet" }, - {0x17, 0x01, 0x06, 0x04, "Upright" }, - {0x17, 0x01, 0x06, 0x00, "Upright (2P)" }, - {0x17, 0x01, 0x06, 0x06, "Cocktail" }, -}; - -STDDIPINFOEXT(Hharry, Dip2Coin, Hharry ) - -static struct BurnDIPInfo PoundforDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xbf, NULL }, - {0x0f, 0xff, 0xff, 0xfd, NULL }, - - {0 , 0xfe, 0 , 4, "Round Time" }, - {0x0e, 0x01, 0x03, 0x02, "60" }, - {0x0e, 0x01, 0x03, 0x03, "90" }, - {0x0e, 0x01, 0x03, 0x01, "120" }, - {0x0e, 0x01, 0x03, 0x00, "150" }, - - {0 , 0xfe, 0 , 2, "Matches/Credit (2P)" }, - {0x0e, 0x01, 0x04, 0x04, "1" }, - {0x0e, 0x01, 0x04, 0x00, "2" }, - - {0 , 0xfe, 0 , 2, "Rounds/Match" }, - {0x0e, 0x01, 0x08, 0x08, "2" }, - {0x0e, 0x01, 0x08, 0x00, "3" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x0e, 0x01, 0x10, 0x10, "Normal" }, - {0x0e, 0x01, 0x10, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2, "Trackball Size" }, - {0x0e, 0x01, 0x20, 0x20, "Small" }, - {0x0e, 0x01, 0x20, 0x00, "Large" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0e, 0x01, 0x40, 0x40, "Off" }, - {0x0e, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0e, 0x01, 0x80, 0x80, "Off" }, - {0x0e, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x0f, 0x01, 0x01, 0x01, "Off" }, - {0x0f, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 3, "Cabinet" }, - {0x0f, 0x01, 0x06, 0x04, "Upright" }, - {0x0f, 0x01, 0x06, 0x02, "Upright (2P)" }, - {0x0f, 0x01, 0x06, 0x06, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x0f, 0x01, 0x08, 0x08, "Mode 1" }, - {0x0f, 0x01, 0x08, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x0f, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x0f, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x0f, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x0f, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x0f, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x0f, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x0f, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x0f, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x0f, 0x01, 0xf0, 0x10, "1 Coin/1 Credit, 1 Coin/Cont."}, - {0x0f, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x0f, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x0f, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x0f, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x0f, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x0f, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x0f, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Poundfor) - -//-------------------------------------------------------------------------------------------------------------------------------------------------- -// Protection handlers - -static const UINT8 *protection_code = NULL; -static const UINT8 *protection_crc = NULL; -static const INT32 *protection_sample_offsets = NULL; - -static UINT8 protection_read(INT32 address) -{ - if (address == 0xb0ffb) { - if (protection_code != NULL) { - memcpy (DrvProtRAM, protection_code, 96); - } - } - - return DrvProtRAM[address & 0xfff]; -} - -static void protection_write(INT32 address, UINT8 data) -{ - DrvProtRAM[address & 0xfff] = data ^ 0xff; - - if (address == 0xb0fff && data == 0) { - if (protection_crc != NULL) { - memcpy (DrvProtRAM + 0xfe0, protection_crc, 18); - } - } -} - -static void protection_sample_offset_write(UINT8 data) -{ - if (protection_sample_offsets != NULL) { - if (data < protection_sample_offsets[0]) { - sample_address = protection_sample_offsets[data+1]; - } - } -} - -static void m72_install_protection(const UINT8 *code, const UINT8 *crc, const INT32 *offs) -{ - protection_code = code; - protection_crc = crc; - protection_sample_offsets = offs; -} - -#define install_protection(name) m72_install_protection(name##_code, name##_crc, name##_sample_offsets) - -/* Battle Chopper / Mr. Heli */ -static const INT32 bchopper_sample_offsets[7] = { 6, 0x0000, 0x0010, 0x2510, 0x6510, 0x8510, 0x9310 }; - -static const UINT8 bchopper_code[96] = -{ - 0x68,0x00,0xa0, // push 0a000h - 0x1f, // pop ds - 0xc6,0x06,0x38,0x38,0x53, // mov [3838h], byte 053h - 0xc6,0x06,0x3a,0x38,0x41, // mov [383ah], byte 041h - 0xc6,0x06,0x3c,0x38,0x4d, // mov [383ch], byte 04dh - 0xc6,0x06,0x3e,0x38,0x4f, // mov [383eh], byte 04fh - 0xc6,0x06,0x40,0x38,0x54, // mov [3840h], byte 054h - 0xc6,0x06,0x42,0x38,0x4f, // mov [3842h], byte 04fh - 0x68,0x00,0xb0, // push 0b000h - 0x1f, // pop ds - 0xc6,0x06,0x00,0x09,0x49^0xff, // mov [0900h], byte 049h - 0xc6,0x06,0x00,0x0a,0x49^0xff, // mov [0a00h], byte 049h - 0xc6,0x06,0x00,0x0b,0x49^0xff, // mov [0b00h], byte 049h - 0xc6,0x06,0x00,0x00,0xcb^0xff, // mov [0000h], byte 0cbh ; retf : bypass protection check during the game - 0x68,0x00,0xd0, // push 0d000h - 0x1f, // pop ds - // the following is for mrheli only, the game checks for - // "This game can only be played in Japan..." message in the video text buffer - // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu - 0xc6,0x06,0x70,0x16,0x77, // mov [1670h], byte 077h - 0xea,0x68,0x01,0x40,0x00 // jmp 0040:$0168 -}; - -static const UINT8 bchopper_crc[18] = { - 0x1a,0x12,0x5c,0x08,0x84,0xb6,0x73,0xd1,0x54,0x91,0x94,0xeb,0x00,0x00 -}; - -static const UINT8 mrheli_crc[18] = { - 0x24,0x21,0x1f,0x14,0xf9,0x28,0xfb,0x47,0x4c,0x77,0x9e,0xc2,0x00,0x00 -}; - -/* X Multiply */ -static const INT32 xmultiplm72_sample_offsets[4] = { 3, 0x0000, 0x0020, 0x1a40 }; - -static const UINT8 xmultiplm72_code[96] = { - 0xea,0x30,0x02,0x00,0x0e // jmp 0e00:$0230 -}; - -static const UINT8 xmultiplm72_crc[18] = { - 0x73,0x82,0x4e,0x3f, 0xfc,0x56,0x59,0x06,0x05,0x48,0xa8,0xf4,0x00,0x00 -}; - -/* Dragon Breed */ -static const INT32 dbreedm72_sample_offsets[10] = { 9, 0x00000, 0x00020, 0x02c40, 0x08160, 0x0c8c0, 0x0ffe0, 0x13000, 0x15820, 0x15f40 }; - -static const UINT8 dbreedm72_code[96] = { - 0xea,0x6c,0x00,0x00,0x00 // jmp 0000:$006c -}; - -static const UINT8 dbreedm72_crc[18] ={ - 0xa4,0x96,0x5f,0xc0, 0xab,0x49,0x9f,0x19,0x84,0xe6,0xd6,0xca,0x00,0x00 -}; - -/* Ninja Spirit */ -static const INT32 nspirit_sample_offsets[10] = { 9, 0x0000, 0x0020, 0x2020, 0, 0x5720, 0, 0x7b60, 0x9b60, 0xc360 }; - -static const UINT8 nspirit_code[96] = -{ - 0x68,0x00,0xa0, // push 0a000h - 0x1f, // pop ds - 0xc6,0x06,0x38,0x38,0x4e, // mov [3838h], byte 04eh - 0xc6,0x06,0x3a,0x38,0x49, // mov [383ah], byte 049h - 0xc6,0x06,0x3c,0x38,0x4e, // mov [383ch], byte 04eh - 0xc6,0x06,0x3e,0x38,0x44, // mov [383eh], byte 044h - 0xc6,0x06,0x40,0x38,0x4f, // mov [3840h], byte 04fh - 0xc6,0x06,0x42,0x38,0x55, // mov [3842h], byte 055h - 0x68,0x00,0xb0, // push 0b000h - 0x1f, // pop ds - 0xc6,0x06,0x00,0x09,0x49^0xff, // mov [0900h], byte 049h - 0xc6,0x06,0x00,0x0a,0x49^0xff, // mov [0a00h], byte 049h - 0xc6,0x06,0x00,0x0b,0x49^0xff, // mov [0b00h], byte 049h - 0x68,0x00,0xd0, // push 0d000h - 0x1f, // pop ds - // the following is for nspiritj only, the game checks for - // "This game can only be played in Japan..." message in the video text buffer - // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu - 0xc6,0x06,0x70,0x16,0x57, // mov [1670h], byte 057h - 0xc6,0x06,0x71,0x16,0x00, // mov [1671h], byte 000h - 0xea,0x00,0x00,0x40,0x00 // jmp 0040:$0000 -}; - -static const UINT8 nspirit_crc[18] = { - 0xfe,0x94,0x6e,0x4e, 0xc8,0x33,0xa7,0x2d,0xf2,0xa3,0xf9,0xe1, 0xa9,0x6c,0x02,0x95, 0x00,0x00 -}; - -static const UINT8 nspiritj_crc[18] = { - 0x26,0xa3,0xa5,0xe9, 0xc8,0x33,0xa7,0x2d,0xf2,0xa3,0xf9,0xe1, 0xbc,0x6c,0x01,0x95, 0x00,0x00 -}; - -/* Image Fight */ -static const INT32 imgfight_sample_offsets[8] = { 7, 0x0000, 0x0020, 0x44e0, 0x98a0, 0xc820, 0xf7a0, 0x108c0 }; - -static const UINT8 imgfight_code[96] = -{ - 0x68,0x00,0xa0, // push 0a000h - 0x1f, // pop ds - 0xc6,0x06,0x38,0x38,0x50, // mov [3838h], byte 050h - 0xc6,0x06,0x3a,0x38,0x49, // mov [383ah], byte 049h - 0xc6,0x06,0x3c,0x38,0x43, // mov [383ch], byte 043h - 0xc6,0x06,0x3e,0x38,0x4b, // mov [383eh], byte 04bh - 0xc6,0x06,0x40,0x38,0x45, // mov [3840h], byte 045h - 0xc6,0x06,0x42,0x38,0x54, // mov [3842h], byte 054h - 0x68,0x00,0xb0, // push 0b000h - 0x1f, // pop ds - 0xc6,0x06,0x00,0x09,0x49^0xff, // mov [0900h], byte 049h - 0xc6,0x06,0x00,0x0a,0x49^0xff, // mov [0a00h], byte 049h - 0xc6,0x06,0x00,0x0b,0x49^0xff, // mov [0b00h], byte 049h - 0xc6,0x06,0x20,0x09,0x49^0xff, // mov [0920h], byte 049h - 0xc6,0x06,0x21,0x09,0x4d^0xff, // mov [0921h], byte 04dh - 0xc6,0x06,0x22,0x09,0x41^0xff, // mov [0922h], byte 041h - 0xc6,0x06,0x23,0x09,0x47^0xff, // mov [0923h], byte 047h - 0x68,0x00,0xd0, // push 0d000h - 0x1f, // pop ds - // the game checks for - // "This game can only be played in Japan..." message in the video text buffer - // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu - 0xc6,0x06,0xb0,0x1c,0x57, // mov [1cb0h], byte 057h - 0xea,0x00,0x00,0x40,0x00 // jmp 0040:$0000 -}; - -static const UINT8 imgfight_crc[18] = { - 0x7e,0xcc,0xec,0x03, 0x04,0x33,0xb6,0xc5, 0xbf,0x37,0x92,0x94, 0x00,0x00 -}; - -/* Air Duel */ -static const INT32 airduel_sample_offsets[17] = { - 16, - 0x00000, 0x00020, 0x03ec0, 0x05640, 0x06dc0, 0x083a0, 0x0c000, 0x0eb60, - 0x112e0, 0x13dc0, 0x16520, 0x16d60, 0x18ae0, 0x1a5a0, 0x1bf00, 0x1c340 }; - -static const UINT8 airduel_code[96] = -{ - 0x68,0x00,0xd0, // push 0d000h - 0x1f, // pop ds - // the game checks for - // "This game can only be played in Japan..." message in the video text buffer - // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu - 0xc6,0x06,0xc0,0x1c,0x57, // mov [1cc0h], byte 057h - 0xea,0x69,0x0b,0x00,0x00 // jmp 0000:$0b69 -}; - -static const UINT8 airduel_crc[18] = { - 0x72,0x9c,0xca,0x85, 0xc9,0x12,0xcc,0xea, 0x00,0x00 -}; - -/* Daiku no Gensan */ -static const INT32 dkgenm72_sample_offsets[29] = { - 28, - 0x00000, 0x00020, 0x01800, 0x02da0, 0x03be0, 0x05ae0, 0x06100, 0x06de0, - 0x07260, 0x07a60, 0x08720, 0x0a5c0, 0x0c3c0, 0x0c7a0, 0x0e140, 0x0fb00, - 0x10fa0, 0x10fc0, 0x10fe0, 0x11f40, 0x12b20, 0x130a0, 0x13c60, 0x14740, - 0x153c0, 0x197e0, 0x1af40, 0x1c080 }; - -static const UINT8 dkgenm72_code[96] = { - 0xea,0x3d,0x00,0x00,0x10 // jmp 1000:$003d -}; - -static const UINT8 dkgenm72_crc[18] = { - 0xc8,0xb4,0xdc,0xf8, 0xd3,0xba,0x48,0xed,0x79,0x08,0x1c,0xb3, 0x00,0x00 -}; - -/* Legend of Hero Tonma */ -static const INT32 loht_sample_offsets[8] = { 7, 0x0000, 0x0020, 0, 0x2c40, 0x4320, 0x7120, 0xb200 }; - -static const UINT8 loht_code[96] = -{ - 0x68,0x00,0xa0, // push 0a000h - 0x1f, // pop ds - 0xc6,0x06,0x3c,0x38,0x47, // mov [383ch], byte 047h - 0xc6,0x06,0x3d,0x38,0x47, // mov [383dh], byte 047h - 0xc6,0x06,0x42,0x38,0x44, // mov [3842h], byte 044h - 0xc6,0x06,0x43,0x38,0x44, // mov [3843h], byte 044h - 0x68,0x00,0xb0, // push 0b000h - 0x1f, // pop ds - 0xc6,0x06,0x00,0x09,0x49^0xff, // mov [0900h], byte 049h - 0xc6,0x06,0x00,0x0a,0x49^0xff, // mov [0a00h], byte 049h - 0xc6,0x06,0x00,0x0b,0x49^0xff, // mov [0b00h], byte 049h - - 0x68,0x00,0xd0, // push 0d000h // Japan set only - 0x1f, // pop ds // Japan set only - 0xc6,0x06,0x70,0x16,0x57, // mov [1670h], byte 057h // Japan set only - checks this (W) of WARNING - - 0xea,0x5d,0x01,0x40,0x00 // jmp 0040:$015d -}; - -static const UINT8 loht_crc[18] = { - 0x39,0x00,0x82,0xae, 0x2c,0x9d,0x4b,0x73,0xfb,0xac,0xd4,0x6d, 0x6d,0x5b,0x77,0xc0, 0x00,0x00 -}; - -/* Gallop - Armed police Unit */ -static const INT32 gallop_sample_offsets[32] = { - 31, - 0x00000, 0x00020, 0x00040, 0x01360, 0x02580, 0x04f20, 0x06240, 0x076e0, - 0x08660, 0x092a0, 0x09ba0, 0x0a560, 0x0cee0, 0x0de20, 0x0e620, 0x0f1c0, - 0x10200, 0x10220, 0x10240, 0x11380, 0x12760, 0x12780, 0x127a0, 0x13c40, - 0x140a0, 0x16760, 0x17e40, 0x18ee0, 0x19f60, 0x1bbc0, 0x1cee0 }; - -//-------------------------------------------------------------------------------------------------------------------------------------------------- - - -static void setvector_callback(INT32 param) -{ - switch (param) - { - case VECTOR_INIT: irqvector = 0xff; break; - case YM2151_ASSERT: irqvector &= 0xef; break; - case YM2151_CLEAR: irqvector |= 0x10; break; - case Z80_ASSERT: irqvector &= 0xdf; break; - case Z80_CLEAR: irqvector |= 0x20; break; - } - - if (irqvector == 0xff) { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } else { - ZetSetVector(irqvector); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nCyclesDone[1] += ZetRun(1000); - } -} - -static void palette_write(INT32 offset, INT32 offset2) -{ - if (offset & 1) return; - - UINT16 *pal = (UINT16*)DrvPalRAM; - offset = (offset / 2) & 0x00ff; - - INT32 offset3 = offset; - if (offset2) { - offset3 |= 0x0100; - pal += 0x1000 / 2; - } - - INT32 r = BURN_ENDIAN_SWAP_INT16(pal[offset + 0x000]) & 0x1f; - INT32 g = BURN_ENDIAN_SWAP_INT16(pal[offset + 0x200]) & 0x1f; - INT32 b = BURN_ENDIAN_SWAP_INT16(pal[offset + 0x400]) & 0x1f; - - DrvPalette[offset3] = BurnHighCol((r << 3) | (r >> 2), (g << 3) | (g >> 2), (b << 3) | (b >> 2), 0); -} - -UINT8 __fastcall m72_main_read(UINT32 address) -{ - if ((address & 0xff000) == 0xb0000) { - return protection_read(address); - } - - return 0; -} - -void __fastcall m72_main_write(UINT32 address, UINT8 data) -{ - if ((address & 0xff000) == 0xb0000) { - protection_write(address, data); - return; - } - - if ((address & 0xff000) == 0xc8000) { - if (address & 1) data = 0xff; - DrvPalRAM[(address & 0xdff) | 0x0000] = DrvPalRAM[(address & 0xdff) | 0x0200] = data | 0xe0; - palette_write(address, 0); - return; - } - - if ((address & 0xff000) == 0xcc000) { - if (address & 1) data = 0xff; - DrvPalRAM[(address & 0xdff) | 0x1000] = DrvPalRAM[(address & 0xdff) | 0x1200] = data | 0xe0; - palette_write(address, 1); - return; - } -} - -void __fastcall rtype2_main_write(UINT32 address, UINT8 data) -{ - if ((address & 0xff000) == 0xc8000 || (address & 0xff000) == 0xa0000 || (address & 0xff000) == 0xcc000) { - if (address & 1) data = 0xff; - DrvPalRAM[(address & 0xdff) | 0x0000] = DrvPalRAM[(address & 0xdff) | 0x0200] = data | 0xe0; - palette_write(address, 0); - return; - } - - if ((address & 0xff000) == 0xd8000 || (address & 0xff000) == 0xa8000 || (address & 0xff000) == 0xa4000) { - if (address & 1) data = 0xff; - DrvPalRAM[(address & 0xdff) | 0x1000] = DrvPalRAM[(address & 0xdff) | 0x1200] = data | 0xe0; - palette_write(address, 1); - return; - } - - switch (address) - { - case 0xb0000: - case 0xe0000: // majtitle - irq_raster_position = (irq_raster_position & 0xff00) | (data << 0); - return; - - case 0xb0001: - case 0xe0001: // majtitle - irq_raster_position = (irq_raster_position & 0x00ff) | (data << 8); - return; - - case 0xbc000: - // case 0xbc001: - case 0xec000: // majtitle - // case 0xec001: - memcpy (DrvSprBuf, DrvSprRAM, 0x0400); - return; - } -} - -void __fastcall m72_main_write_port(UINT32 port, UINT8 data) -{ -// bprintf (0, _T("%2.2x, %2.2x wp\n"), port, data); - - switch (port) - { - case 0x00: - bprintf (0, _T("%2.2x, %2.2x mwp\n"), port, data); - // sync_cpus(); - *soundlatch = data; - setvector_callback(Z80_ASSERT); - return; - - case 0x01: - return; - - case 0x02: -// case 0x03: - { - // coin counter = data & 3 (&1 = 0, &2 = 1) - // flipscreen = ((data & 0x04) >> 2) ^ ((~input_port_read(space->machine, "DSW") >> 8) & 1); - - video_enable[0] = data & 0x08; - - // bprintf (0, _T("%x\n"), data & 0x10); - if (enable_z80_reset) { - if (data & 0x10) { - z80_reset = 0; - } else { - ZetReset(); - setvector_callback(VECTOR_INIT); - z80_reset = 1; - } - } - } - return; - - case 0x04: - case 0x05: - memcpy (DrvSprBuf, DrvSprRAM, 0x0400); - return; - - case 0x06: - irq_raster_position = (irq_raster_position & 0xff00) | (data << 0); - return; - - case 0x07: - irq_raster_position = (irq_raster_position & 0x00ff) | (data << 8); - return; - - case 0x40: - case 0x41: - case 0x42: - case 0x43: // nop - bprintf (0, _T("%2.2x, %2.2x\n"), port, data); - return; - - case 0x80: - case 0x81:// scrolly1 - case 0x82: - case 0x83:// scrollx1 - case 0x84: - case 0x85:// scrolly2 - case 0x86: - case 0x87:// scrollx2 - scroll[port & 0x07] = data; - return; - - // case 0x8e: - case 0x8f: - majtitle_rowscroll_enable = data ? 1 : 0; - return; - - case 0xc0: - protection_sample_offset_write(data); - return; - } -} - -static UINT16 __fastcall poundfor_trackball_r(INT32 offset) -{ - static INT32 prev[4],diff[4]; -// static const char *const axisnames[] = { "TRACK0_X", "TRACK0_Y", "TRACK1_X", "TRACK1_Y" }; - -#if 0 - if (offset == 0) - { - INT32 i,curr; - - for (i = 0;i < 4;i++) - { - curr = input_port_read(space->machine, axisnames[i]); - diff[i] = (curr - prev[i]); - prev[i] = curr; - } - } -#endif - prev[0] = 0; - diff[0] = diff[1] = diff[2] = diff[3] = ~0; - INT32 input = DrvInputs[0] | (DrvInputs[3] << 8); - - switch (offset) - { - default: - case 0: - return (diff[0] & 0xff) | ((diff[2] & 0xff) << 8); - case 1: - return ((diff[0] >> 8) & 0x1f) | (diff[2] & 0x1f00) | (~input & 0xe0e0); - case 2: - return (diff[1] & 0xff) | ((diff[3] & 0xff) << 8); - case 3: - return ((diff[1] >> 8) & 0x1f) | (diff[3] & 0x1f00); - } - - return 0; -} - -UINT8 __fastcall m72_main_read_port(UINT32 port) -{ - switch (port) - { - case 0x00: return DrvInputs[0]; - case 0x01: return DrvInputs[1]; - case 0x02: return DrvInputs[2]; - case 0x03: return 0xff; - case 0x04: return DrvDips[0]; - case 0x05: return DrvDips[1]; - } - - if ((port & 0xf8) == 0x08) { - INT32 ret = poundfor_trackball_r((port / 2) & 0x03); - if (port & 1) return ret >> 8; - else return ret; - } - - return 0; -} - -void __fastcall m72_sound_write_port(UINT16 port, UINT8 data) -{ -// bprintf (0, _T("%2.2x, %2.2x wp\n"), port & 0xff, data); - - switch (port & 0xff) - { - case 0x00: - case 0x40: // poundfor - BurnYM2151SelectRegister(data); - return; - - case 0x01: - case 0x41: // poundfor - BurnYM2151WriteRegister(data); - return; - - case 0x06: - case 0x42: // poundfor - case 0x83: // rtype2 - setvector_callback(Z80_CLEAR); - return; - - case 0x10: // poundfor - case 0x11: - sample_address >>= 4; - sample_address = (sample_address & 0xff00) | (data << 0); - sample_address <<= 4; - return; - - case 0x12: - case 0x13: // poundfor - sample_address >>= 4; - sample_address = (sample_address & 0x00ff) | (data << 8); - sample_address <<= 4; - return; - - case 0x80: // rtype2 - sample_address >>= 5; - sample_address = (sample_address & 0xff00) | (data << 0); - sample_address <<= 5; - return; - - case 0x81: // rtype2 - sample_address >>= 5; - sample_address = (sample_address & 0x00ff) | (data << 8); - sample_address <<= 5; - return; - - case 0x82: - DACSignedWrite(0, data); - sample_address = (sample_address + 1) & 0x3ffff; - return; - } -} - -UINT8 __fastcall m72_sound_read_port(UINT16 port) -{ -// if ((port & 0xff) != 0x84 && (port & 0xfe) != 0x00) bprintf (0, _T("%2.2x, rp\n"), port & 0xff); - - switch (port & 0xff) - { - case 0x00: - case 0x01: - case 0x40: // poundfor - case 0x41: // poundfor - return BurnYM2151ReadStatus(); - - case 0x80: // rtype2 - case 0x42: // poundfor - case 0x02: - return *soundlatch; - - case 0x84: - return DrvSndROM[sample_address & 0x3ffff]; - } - - return 0; -} - -static void m72YM2151IRQHandler(INT32 nStatus) -{ - setvector_callback(nStatus ? YM2151_ASSERT : YM2151_CLEAR); -} - -static INT32 m72SyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (3579545.000 / (nBurnFPS / 100.000)))); -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - VezOpen(0); - VezReset(); - VezClose(); - - ZetOpen(0); - ZetReset(); - setvector_callback(VECTOR_INIT); - if (enable_z80_reset) { - z80_reset = 1; - } - ZetClose(); - - BurnYM2151Reset(); - DACReset(); - - ym2151_previous = 0; - sample_address = 0; - irq_raster_position = -1; - - return 0; -} - -static void common_main_cpu_map(INT32 romaddr, INT32 ramaddr) -{ - VezInit(0, V30_TYPE); - - VezOpen(0); - VezMapArea(0x00000, (romaddr-1), 0, DrvV30ROM + 0x000000); - VezMapArea(0x00000, (romaddr-1), 2, DrvV30ROM + 0x000000); - VezMapArea(0x00000+ramaddr, 0x03fff+ramaddr, 0, DrvV30RAM); - VezMapArea(0x00000+ramaddr, 0x03fff+ramaddr, 1, DrvV30RAM); - VezMapArea(0x00000+ramaddr, 0x03fff+ramaddr, 2, DrvV30RAM); -// VezMapArea(0xb0000, 0xb0fff, 2, DrvProtRAM); - VezMapArea(0xc0000, 0xc0fff, 0, DrvSprRAM); - VezMapArea(0xc0000, 0xc0fff, 1, DrvSprRAM); - VezMapArea(0xc0000, 0xc0fff, 2, DrvSprRAM); - VezMapArea(0xc8000, 0xc8fff, 0, DrvPalRAM); -// VezMapArea(0xc8000, 0xc8fff, 1, DrvPalRAM); - VezMapArea(0xc8000, 0xc8fff, 2, DrvPalRAM); - VezMapArea(0xcc000, 0xccfff, 0, DrvPalRAM + 0x1000); -// VezMapArea(0xcc000, 0xccfff, 1, DrvPalRAM + 0x1000); - VezMapArea(0xcc000, 0xccfff, 2, DrvPalRAM + 0x1000); - VezMapArea(0xd0000, 0xd3fff, 0, DrvVidRAM0); - VezMapArea(0xd0000, 0xd3fff, 1, DrvVidRAM0); - VezMapArea(0xd0000, 0xd3fff, 2, DrvVidRAM0); - VezMapArea(0xd8000, 0xdbfff, 0, DrvVidRAM1); - VezMapArea(0xd8000, 0xdbfff, 1, DrvVidRAM1); - VezMapArea(0xd8000, 0xdbfff, 2, DrvVidRAM1); - VezMapArea(0xe0000, 0xeffff, 0, DrvZ80RAM); - VezMapArea(0xe0000, 0xeffff, 1, DrvZ80RAM); - VezMapArea(0xe0000, 0xeffff, 2, DrvZ80RAM); - VezMapArea(0xff800, 0xfffff, 0, DrvV30ROM + 0x0ff800); - VezMapArea(0xff800, 0xfffff, 2, DrvV30ROM + 0x0ff800); - VezSetReadHandler(m72_main_read); - VezSetWriteHandler(m72_main_write); - VezSetReadPort(m72_main_read_port); - VezSetWritePort(m72_main_write_port); - VezClose(); -} - -static void common_040000_040000() { common_main_cpu_map(0x40000, 0x40000); } -static void common_080000_080000() { common_main_cpu_map(0x80000, 0x80000); } -static void common_080000_088000() { common_main_cpu_map(0x80000, 0x88000); } -static void common_080000_090000() { common_main_cpu_map(0x80000, 0x90000); } -static void common_080000_09c000() { common_main_cpu_map(0x80000, 0x9c000); } -static void common_080000_0a0000() { common_main_cpu_map(0x80000, 0xa0000); } - -static void rtype2_main_cpu_map() -{ - VezInit(0, V30_TYPE); - - VezOpen(0); - VezMapArea(0x00000, 0x7ffff, 0, DrvV30ROM + 0x000000); - VezMapArea(0x00000, 0x7ffff, 2, DrvV30ROM + 0x000000); - VezMapArea(0xc0000, 0xc0fff, 0, DrvSprRAM); - VezMapArea(0xc0000, 0xc0fff, 1, DrvSprRAM); - VezMapArea(0xc0000, 0xc0fff, 2, DrvSprRAM); - VezMapArea(0xc8000, 0xc8fff, 0, DrvPalRAM); -// VezMapArea(0xc8000, 0xc8fff, 1, DrvPalRAM); - VezMapArea(0xc8000, 0xc8fff, 2, DrvPalRAM); - VezMapArea(0xd0000, 0xd3fff, 0, DrvVidRAM0); - VezMapArea(0xd0000, 0xd3fff, 1, DrvVidRAM0); - VezMapArea(0xd0000, 0xd3fff, 2, DrvVidRAM0); - VezMapArea(0xd4000, 0xd7fff, 0, DrvVidRAM1); - VezMapArea(0xd4000, 0xd7fff, 1, DrvVidRAM1); - VezMapArea(0xd4000, 0xd7fff, 2, DrvVidRAM1); - VezMapArea(0xd8000, 0xd8fff, 0, DrvPalRAM + 0x1000); -// VezMapArea(0xd8000, 0xd8fff, 1, DrvPalRAM + 0x1000); - VezMapArea(0xd8000, 0xd8fff, 2, DrvPalRAM + 0x1000); - VezMapArea(0xe0000, 0xe3fff, 0, DrvV30RAM); - VezMapArea(0xe0000, 0xe3fff, 1, DrvV30RAM); - VezMapArea(0xe0000, 0xe3fff, 2, DrvV30RAM); - VezMapArea(0xff800, 0xfffff, 0, DrvV30ROM + 0x0ff800); - VezMapArea(0xff800, 0xfffff, 2, DrvV30ROM + 0x0ff800); - VezSetReadHandler(m72_main_read); - VezSetWriteHandler(rtype2_main_write); - VezSetReadPort(m72_main_read_port); - VezSetWritePort(m72_main_write_port); - VezClose(); -} - -static void hharryu_main_cpu_map() -{ - VezInit(0, V30_TYPE); - - VezOpen(0); - VezMapArea(0x00000, 0x7ffff, 0, DrvV30ROM + 0x000000); - VezMapArea(0x00000, 0x7ffff, 2, DrvV30ROM + 0x000000); - VezMapArea(0x80000, 0x83fff, 0, DrvVidRAM0); // kengo - VezMapArea(0x80000, 0x83fff, 1, DrvVidRAM0); - VezMapArea(0x80000, 0x83fff, 2, DrvVidRAM0); - VezMapArea(0x84000, 0x87fff, 0, DrvVidRAM1); // kengo - VezMapArea(0x84000, 0x87fff, 1, DrvVidRAM1); - VezMapArea(0x84000, 0x87fff, 2, DrvVidRAM1); - VezMapArea(0xa0000, 0xa0fff, 0, DrvPalRAM); -// VezMapArea(0xa0000, 0xa0fff, 1, DrvPalRAM); - VezMapArea(0xa0000, 0xa0fff, 2, DrvPalRAM); - VezMapArea(0xa8000, 0xa8fff, 0, DrvPalRAM + 0x1000); -// VezMapArea(0xa8000, 0xa8fff, 1, DrvPalRAM + 0x1000); - VezMapArea(0xa8000, 0xa8fff, 2, DrvPalRAM + 0x1000); - VezMapArea(0xc0000, 0xc0fff, 0, DrvSprRAM); - VezMapArea(0xc0000, 0xc0fff, 1, DrvSprRAM); - VezMapArea(0xc0000, 0xc0fff, 2, DrvSprRAM); - VezMapArea(0xd0000, 0xd3fff, 0, DrvVidRAM0); - VezMapArea(0xd0000, 0xd3fff, 1, DrvVidRAM0); - VezMapArea(0xd0000, 0xd3fff, 2, DrvVidRAM0); - VezMapArea(0xd4000, 0xd7fff, 0, DrvVidRAM1); - VezMapArea(0xd4000, 0xd7fff, 1, DrvVidRAM1); - VezMapArea(0xd4000, 0xd7fff, 2, DrvVidRAM1); - VezMapArea(0xe0000, 0xe3fff, 0, DrvV30RAM); - VezMapArea(0xe0000, 0xe3fff, 1, DrvV30RAM); - VezMapArea(0xe0000, 0xe3fff, 2, DrvV30RAM); - VezMapArea(0xff800, 0xfffff, 0, DrvV30ROM + 0x0ff800); - VezMapArea(0xff800, 0xfffff, 2, DrvV30ROM + 0x0ff800); - VezSetReadHandler(m72_main_read); - VezSetWriteHandler(rtype2_main_write); - VezSetReadPort(m72_main_read_port); - VezSetWritePort(m72_main_write_port); - VezClose(); -} - -static void majtitle_main_cpu_map() -{ - VezInit(0, V30_TYPE); - - VezOpen(0); - VezMapArea(0x00000, 0x7ffff, 0, DrvV30ROM + 0x000000); - VezMapArea(0x00000, 0x7ffff, 2, DrvV30ROM + 0x000000); - VezMapArea(0xa0000, 0xa07ff, 0, DrvRowScroll); - VezMapArea(0xa0000, 0xa07ff, 1, DrvRowScroll); - VezMapArea(0xa0000, 0xa07ff, 2, DrvRowScroll); - VezMapArea(0xa4000, 0xa4fff, 0, DrvPalRAM + 0x1000); -// VezMapArea(0xa4000, 0xa4fff, 1, DrvPalRAM + 0x1000); - VezMapArea(0xa4000, 0xa4fff, 2, DrvPalRAM + 0x1000); - VezMapArea(0xac000, 0xaffff, 0, DrvVidRAM0); - VezMapArea(0xac000, 0xaffff, 1, DrvVidRAM0); - VezMapArea(0xac000, 0xaffff, 2, DrvVidRAM0); - VezMapArea(0xb0000, 0xbffff, 0, DrvVidRAM1); - VezMapArea(0xb0000, 0xbffff, 1, DrvVidRAM1); - VezMapArea(0xb0000, 0xbffff, 2, DrvVidRAM1); - VezMapArea(0xc0000, 0xc07ff, 0, DrvSprRAM); - VezMapArea(0xc0000, 0xc07ff, 1, DrvSprRAM); - VezMapArea(0xc0000, 0xc07ff, 2, DrvSprRAM); - VezMapArea(0xc8000, 0xc87ff, 0, DrvSprRAM2); - VezMapArea(0xc8000, 0xc87ff, 1, DrvSprRAM2); - VezMapArea(0xc8000, 0xc87ff, 2, DrvSprRAM2); - VezMapArea(0xcc000, 0xccfff, 0, DrvPalRAM); -// VezMapArea(0xcc000, 0xccfff, 1, DrvPalRAM); - VezMapArea(0xcc000, 0xccfff, 2, DrvPalRAM); - VezMapArea(0xd0000, 0xd3fff, 0, DrvV30RAM); - VezMapArea(0xd0000, 0xd3fff, 1, DrvV30RAM); - VezMapArea(0xd0000, 0xd3fff, 2, DrvV30RAM); - VezMapArea(0xff800, 0xfffff, 0, DrvV30ROM + 0x0ff800); - VezMapArea(0xff800, 0xfffff, 2, DrvV30ROM + 0x0ff800); - VezSetReadHandler(m72_main_read); - VezSetWriteHandler(rtype2_main_write); - VezSetReadPort(m72_main_read_port); - VezSetWritePort(m72_main_write_port); - VezClose(); -} - -static void sound_ram_map() -{ - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xffff, 0, DrvZ80RAM); - ZetMapArea(0x0000, 0xffff, 1, DrvZ80RAM); - ZetMapArea(0x0000, 0xffff, 2, DrvZ80RAM); - ZetSetOutHandler(m72_sound_write_port); - ZetSetInHandler(m72_sound_read_port); - ZetMemEnd(); - ZetClose(); - - enable_z80_reset = 1; -} - -static void sound_rom_map() -{ - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); - ZetMapArea(0xf000, 0xffff, 0, DrvZ80RAM); - ZetMapArea(0xf000, 0xffff, 1, DrvZ80RAM); - ZetMapArea(0xf000, 0xffff, 2, DrvZ80RAM); - ZetSetOutHandler(m72_sound_write_port); - ZetSetInHandler(m72_sound_read_port); - ZetMemEnd(); - ZetClose(); - - enable_z80_reset = 0; -} - -static INT32 DrvGfxDecode(UINT8 *gfx, INT32 len, INT32 type) -{ - INT32 Planes[4] = { ((len / 4) * 8) * 3, ((len / 4) * 8) * 2, ((len / 4) * 8) * 1, ((len / 4) * 8) * 0 }; - INT32 XOffs[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87 }; - INT32 YOffs[16] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(len); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, gfx, len); - - if (type) { - GfxDecode((len * 2) / ( 8 * 8), 4, 8, 8, Planes, XOffs, YOffs, 0x040, tmp, gfx); - } else { - GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Planes, XOffs, YOffs, 0x100, tmp, gfx); - } - - BurnFree (tmp); - - return 0; -} - -static INT32 GetRoms(INT32 bLoad) -{ - char* pRomName; - struct BurnRomInfo ri; - UINT8 *V30ROM = DrvV30ROM; - UINT8 *Z80ROM = DrvZ80ROM; - UINT8 *GFXROM0 = DrvGfxROM0; - UINT8 *GFXROM1 = DrvGfxROM1; - UINT8 *GFXROM2 = DrvGfxROM2; - UINT8 *GFXROM3 = DrvGfxROM3; - UINT8 *SNDROM = DrvSndROM; - INT32 pglen = 0; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & 15) == 1) { - if (bLoad) { - if (BurnLoadRom(V30ROM + 1, i + 0, 2)) return 1; - if (BurnLoadRom(V30ROM + 0, i + 1, 2)) return 1; - } - V30ROM += ri.nLen * 2; - i++; - continue; - } - - if ((ri.nType & 15) == 6) { - if (bLoad) if (BurnLoadRom(Z80ROM , i, 1)) return 1; - Z80ROM += ri.nLen; - continue; - } - - if ((ri.nType & 15) == 2) { - if (bLoad) if (BurnLoadRom(GFXROM0, i, 1)) return 1; - GFXROM0 += ri.nLen; - - if (pglen == 0x10000 && ri.nLen == 0x8000) { // rtype fix - if (bLoad) if (BurnLoadRom(GFXROM0, i, 1)) return 1; - GFXROM0 += ri.nLen; - } - pglen = ri.nLen; - continue; - } - - if ((ri.nType & 15) == 3) { - if (bLoad) if (BurnLoadRom(GFXROM1, i, 1)) return 1; - GFXROM1 += ri.nLen; - continue; - } - - if ((ri.nType & 15) == 4) { - if (bLoad) if (BurnLoadRom(GFXROM2, i, 1)) return 1; - GFXROM2 += ri.nLen; - continue; - } - - if ((ri.nType & 15) == 14) { - if (bLoad) if (BurnLoadRom(GFXROM3, i, 1)) return 1; - GFXROM3 += ri.nLen; - continue; - } - - if ((ri.nType & 15) == 5) { - if (bLoad) if (BurnLoadRom(SNDROM , i, 1)) return 1; - SNDROM += ri.nLen; - continue; - } - } - - if (bLoad) { - // copy irq vectors - memcpy (DrvV30ROM + 0xffff0, V30ROM - 0x10, 0x010); - - // mirror sound rom - INT32 sndlen = SNDROM - DrvSndROM; - if (sndlen < 0x40000 && sndlen) { - for (INT32 i = 0; i < 0x40000; i++) { - DrvSndROM[i] = DrvSndROM[i % sndlen]; - } - } - - DrvGfxDecode(DrvGfxROM0, graphics_length[0], 0); - DrvGfxDecode(DrvGfxROM1, graphics_length[1], 1); - - if (graphics_length[2] > 2) { - DrvGfxDecode(DrvGfxROM2, graphics_length[2], 1); - } else { - DrvGfxROM2 = DrvGfxROM1; - code_mask[2] = code_mask[1]; - } - - if (graphics_length[3] > 2) { - DrvGfxDecode(DrvGfxROM3, graphics_length[3], 0); - } else { - code_mask[3] = 0; - } - } else { - graphics_length[0] = GFXROM0 - DrvGfxROM0; - graphics_length[1] = GFXROM1 - DrvGfxROM1; - graphics_length[2] = GFXROM2 - DrvGfxROM2; - graphics_length[3] = GFXROM3 - DrvGfxROM3; - - for (INT32 i = 1, j = 0; j < 4; graphics_length[j] = i, j++, i = 1) { - while (i < graphics_length[j]) i <<= 1; - } - - code_mask[0] = ((graphics_length[0] * 2) - 1) / (16 * 16); - code_mask[1] = ((graphics_length[1] * 2) - 1) / (8 * 8); - code_mask[2] = ((graphics_length[2] * 2) - 1) / (8 * 8); - code_mask[3] = ((graphics_length[3] * 2) - 1) / (16 * 16); - } - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvV30ROM = Next; Next += 0x200000; - DrvZ80ROM = Next; Next += 0x010000; - DrvGfxROM0 = Next; Next += graphics_length[0] * 2; - DrvGfxROM1 = Next; Next += graphics_length[1] * 2; - DrvGfxROM2 = Next; Next += graphics_length[2] * 2; - DrvGfxROM3 = Next; Next += graphics_length[3] * 2; - DrvSndROM = Next; Next += 0x040000; - - RamPrioBitmap = Next; Next += nScreenWidth * nScreenHeight; - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x010000; - DrvSprRAM = Next; Next += 0x001000; - DrvSprRAM2 = Next; Next += 0x000800; - DrvSprBuf = Next; Next += 0x001000; - DrvVidRAM0 = Next; Next += 0x004000; - DrvVidRAM1 = Next; Next += 0x010000; - DrvV30RAM = Next; Next += 0x004000; - DrvPalRAM = Next; Next += 0x002000; - DrvProtRAM = Next; Next += 0x001000; - DrvRowScroll = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - video_enable = Next; Next += 0x000001; - - scroll = Next; Next += 0x000008; - - RamEnd = Next; - - DrvPalette = (UINT32 *) Next; Next += 0x200 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - - -static INT32 DrvInit(void (*pCPUMapCallback)(), void (*pSNDMapCallback)(), INT32 (*pRomLoadCallback)(), INT32 irqbase, INT32 z80_nmi, INT32 video_type) -{ - BurnSetRefreshRate(55.00); - - GenericTilesInit(); - - GetRoms(0); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (GetRoms(1)) return 1; - - if (pCPUMapCallback) { - pCPUMapCallback(); - } - - if (pSNDMapCallback) { - pSNDMapCallback(); - } - - if (pRomLoadCallback) { - if (pRomLoadCallback()) return 1; - } - - m72_irq_base = irqbase; - z80_nmi_enable = z80_nmi; - m72_video_type = video_type; - - switch (video_type) - { - case 0: // m72 - video_offsets[0] = video_offsets[1] = 0; - break; - - case 1: // rtype - case 3: // majtitle - video_offsets[0] = video_offsets[1] = -4; - break; - - case 2: // hharry - video_offsets[0] = -4; - video_offsets[1] = -6; - break; - - case 4: // poundfor - video_offsets[0] = video_offsets[1] = -6; - m72_video_type = 1; // rtype - break; - } - - BurnYM2151Init(3579545); - YM2151SetIrqHandler(0, &m72YM2151IRQHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - DACInit(0, 0, 1, m72SyncDAC); - DACSetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM2151Exit(); - DACExit(); - - ZetExit(); - VezExit(); - - BurnFree(AllMem); - - m72_video_type = 0; - enable_z80_reset = 0; - z80_nmi_enable = 0; - - m72_install_protection(NULL,NULL,NULL); - - video_offsets[0] = video_offsets[1] = 0; - - return 0; -} - -static void draw_layer(INT32 layer, INT32 forcelayer, INT32 type, INT32 start, INT32 finish) // bg = layer 1, fg = layer 0 -{ - INT32 codeand = code_mask[1+layer]; - UINT16 *vram = (UINT16*)(layer ? DrvVidRAM1 : DrvVidRAM0); - UINT8 *gfx = (layer) ? DrvGfxROM2 : DrvGfxROM1; - - // layer, prio, forcelayer - const UINT16 transmask[2][3][2] = { - { { 0xffff, 0x0001 }, { 0x00ff, 0xff01 }, { 0x0001, 0xffff } }, - { { 0xffff, 0x0000 }, { 0x00ff, 0xff00 }, { (type == 0) ? 0x0007 : 0x0001, (type == 0) ? 0xfff8 : 0xfffe } } - }; - - INT32 scrolly = scroll[layer * 4 + 0] | (scroll[layer * 4 + 1] << 8); - INT32 scrollx = scroll[layer * 4 + 2] | (scroll[layer * 4 + 3] << 8); - - scrolly = (scrolly + 128) & 0x1ff; - scrollx = (scrollx + 64 + video_offsets[layer]) & 0x1ff; - - UINT16 *xscroll = (UINT16*)DrvRowScroll; - - for (INT32 sy = start; sy < finish; sy++) - { - UINT16 *dest = pTransDraw + (sy * nScreenWidth); - UINT8 *pri = RamPrioBitmap + (sy * nScreenWidth); - - INT32 scrolly1 = (scrolly + sy) & 0x1ff; - INT32 romoff1 = (scrolly1 & 0x07) << 3; - - for (INT32 sx = 0; sx < nScreenWidth + 8; sx+=8) - { - INT32 flipy, flipx, prio, scrollx1, offs; - - if (majtitle_rowscroll_enable && type == 3 && layer == 1) { - scrollx1 = 256 + BURN_ENDIAN_SWAP_INT16(xscroll[scrolly1]) + sx + 64 + video_offsets[1]; - } else { - scrollx1 = scrollx + sx; - if (type == 3 && layer == 1) scrollx1 += 256; - } - - if (type == 3 && layer == 1) { - scrollx1 &= 0x3ff; - offs = ((scrolly1 >> 3) << 8) | (scrollx1 >> 3); - } else { - scrollx1 &= 0x1ff; - offs = ((scrolly1 >> 3) << 6) | (scrollx1 >> 3); - } - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]); - INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]); - - if (type == 1||type==3) { - flipy = color & 0x0040; - flipx = color & 0x0020; - prio = (color & 0x0100) ? 2 : (color & 0x80) ? 1 : 0; - } else { - flipy = code & 0x8000; - flipx = code & 0x4000; - prio = (color & 0x80) ? 2 : ((color & 0x40) ? 1 : 0); - } - - INT32 mask = transmask[layer][prio][forcelayer]; - - code &= codeand; - color = ((color & 0x000f) << 4) | 0x100; - prio = 1 << prio; - - { - INT32 scrollx0 = scrollx1 & 0x07; - INT32 x_xor = 0; - INT32 romoff = romoff1; - if (flipy) romoff ^= 0x38; - if (flipx) x_xor = 7; - - UINT8 *rom = gfx + (code * 0x40) + romoff; - - INT32 xx = sx - scrollx0; - - for (INT32 x = 0; x < 8; x++, xx++) { - if (xx < 0 || xx >= nScreenWidth) continue; - - INT32 pxl = rom[x ^ x_xor]; - if (mask & (1 << pxl)) continue; - - dest[xx] = pxl | color; - pri[xx] = prio; - } - } - } - } -} - -INT32 start_screen = 0; - -static void draw_sprites() -{ - UINT16 *sprram = (UINT16*)DrvSprBuf; - - for (INT32 offs = 0; offs < 0x400/2;) - { - INT32 sx = -256+(BURN_ENDIAN_SWAP_INT16(sprram[offs+3]) & 0x3ff); - INT32 attr = BURN_ENDIAN_SWAP_INT16(sprram[offs+2]); - INT32 code = BURN_ENDIAN_SWAP_INT16(sprram[offs+1]); - INT32 sy = 384-(BURN_ENDIAN_SWAP_INT16(sprram[offs+0]) & 0x1ff); - - INT32 color = attr & 0x0f; - INT32 flipx = attr & 0x0800; - INT32 flipy = attr & 0x0400; - - INT32 w = 1 << ((attr & 0xc000) >> 14); - INT32 h = 1 << ((attr & 0x3000) >> 12); - sy -= 16 * h; - - sy -= start_screen; - sx -= 64; // ? -#if 0 - if (*flipscreen) - { - sx = 512 - 16*w - sx; - sy = 284 - 16*h - sy; - flipx = !flipx; - flipy = !flipy; - } -#endif - - for (INT32 x = 0;x < w;x++) - { - for (INT32 y = 0;y < h;y++) - { - INT32 c = code; - - if (flipx) c += 8*(w-1-x); - else c += 8*x; - if (flipy) c += h-1-y; - else c += y; - - c &= code_mask[0]; - - INT32 xx = sx + 16 * x; - INT32 yy = sy + 16 * y; - - if (xx < -15 || yy < -15 || xx >= nScreenWidth || yy >= nScreenHeight) continue; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM0); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM0); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM0); - } - } - } - } - - offs += w*4; - } -} - -static void majtitle_draw_sprites() -{ - UINT16 *spriteram16_2 = (UINT16*)DrvSprRAM2; - - for (INT32 offs = 0; offs < 0x400; offs += 4) - { - INT32 code,color,sx,sy,flipx,flipy,w,h,x,y; - - code = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+1]); - color = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x0f; - sx = -256+(BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+3]) & 0x3ff); - sy = 384-(BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+0]) & 0x1ff); - flipx = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x0800; - flipy = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x0400; - - w = 1;// << ((spriteram16_2[offs+2] & 0xc000) >> 14); - h = 1 << ((BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x3000) >> 12); - sy -= 16 * h; - - sy -= start_screen; - sx -= 64; // ? -#if 0 - if (flip_screen_get(machine)) - { - sx = 512 - 16*w - sx; - sy = 256 - 16*h - sy; - flipx = !flipx; - flipy = !flipy; - } -#endif - - for (x = 0;x < w;x++) - { - for (y = 0;y < h;y++) - { - INT32 c = code; - - if (flipx) c += 8*(w-1-x); - else c += 8*x; - if (flipy) c += h-1-y; - else c += y; - - c &= code_mask[3]; - - INT32 xx = sx + 16 * x; - INT32 yy = sy + 16 * y; - - if (xx < -15 || yy < -15 || xx >= nScreenWidth || yy >= nScreenHeight) continue; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM3); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM3); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM3); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM3); - } - } - } - } - } -} - -static void dodrawline(INT32 start, INT32 finish) -{ - if (*video_enable) return; - - draw_layer(1, 1, m72_video_type, start, finish); - draw_layer(0, 1, m72_video_type, start, finish); - - // hacky hack for drawing sprites in scanline... slow. - start_screen = start; - UINT16 *ptr = pTransDraw; - INT32 scrn = nScreenHeight; - pTransDraw += start * nScreenWidth; - nScreenHeight = finish - start; - if (m72_video_type == 3) majtitle_draw_sprites(); - draw_sprites(); - pTransDraw = ptr; - nScreenHeight = scrn; - - draw_layer(1, 0, m72_video_type, start, finish); - draw_layer(0, 0, m72_video_type, start, finish); -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x200; i++) { - palette_write((i & 0xff) * 2, i >> 8); - } - DrvRecalc = 0; - } - -// if (*video_enable) { -// BurnTransferClear(); -// BurnTransferCopy(DrvPalette); -// return 0; -// } - -// draw_layer(1, 1, 0, nScreenHeight); -// draw_layer(0, 1, 0, nScreenHeight); -// draw_sprites(); -// draw_layer(1, 0, 0, nScreenHeight); -// draw_layer(0, 0, 0, nScreenHeight); - - BurnTransferCopy(DrvPalette); - - BurnTransferClear(); - - return 0; -} - -static void compile_inputs() -{ - memset (DrvInputs, 0xff, 5); - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - } -} - -static INT32 nPreviousLine = 0; - -static void scanline_interrupts(INT32 scanline) -{ - if (scanline == (irq_raster_position - 128) && scanline < 256) { - if (nPreviousLine <= scanline && scanline < nScreenHeight) { - dodrawline(nPreviousLine, scanline+1); - nPreviousLine = scanline + 1; - } - - VezSetIRQLineAndVector(0, (m72_irq_base + 8)/4, VEZ_IRQSTATUS_AUTO); - } - else if (scanline == 256) // vblank - { - if (nPreviousLine < nScreenHeight) { - dodrawline(nPreviousLine, nScreenHeight); - nPreviousLine = 0; - } - - VezSetIRQLineAndVector(0, (m72_irq_base + 0)/4, VEZ_IRQSTATUS_AUTO); - } - - if (nPreviousLine >= nScreenHeight) nPreviousLine = 0; -} - -static INT32 DrvFrame() -{ - INT32 nSoundBufferPos = 0; - - if (DrvReset) { - DrvDoReset(); - } - - VezNewFrame(); - ZetNewFrame(); - - compile_inputs(); - - // overclocking... - nCyclesTotal[0] = (INT32)((INT64)(8000000 / 55) * nBurnCPUSpeedAdjust / 0x0100); - nCyclesTotal[1] = (INT32)((INT64)(3579545 / 55) * nBurnCPUSpeedAdjust / 0x0100); - nCyclesDone[0] = nCyclesDone[1] = 0; - - VezOpen(0); - ZetOpen(0); - -// memset (pBurnSoundOut, 0, nBurnSoundLen * 2 * sizeof(INT16)); - - for (INT32 i = 0; i < nInterleave; i++) - { - nCurrentCycles = ((nCyclesTotal[0] / nInterleave) * 1) / 8; // scanline is 87.5% of scanline time - - for (INT32 j = 0; j < 7; j++) { // increase cpu sync - nCyclesDone[0] += VezRun(nCurrentCycles); - } - - scanline_interrupts(i); // run at hblank? - - nCurrentCycles = ((nCyclesTotal[0] / nInterleave) * 1) / 8; // horizontal blank is 12.5% of scanline - - nCyclesDone[0] += VezRun(nCurrentCycles); - // vertical lines are ~90% of video time, vblank is ~10% - - if (z80_reset == 0) { - nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave); - - if (i & 1) { - if (z80_nmi_enable == Z80_FAKE_NMI) { - if (DrvSndROM[sample_address]) { - DACSignedWrite(0, DrvSndROM[sample_address]); - sample_address = (sample_address + 1) & 0x3ffff; - } - } else if (z80_nmi_enable == Z80_REAL_NMI) { - ZetNmi(); - } - } - } else { - ZetIdle(nCyclesTotal[1] / nInterleave); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - VezClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - - - -// R-Type (World) - -static struct BurnRomInfo rtypeRomDesc[] = { - { "rt_r-h0-b.1b", 0x10000, 0x591c7754, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "rt_r-l0-b.3b", 0x10000, 0xa1928df0, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "rt_r-h1-b.1c", 0x10000, 0xa9d71eca, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "rt_r-l1-b.3c", 0x10000, 0x0df3573d, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "rt_r-00.1h", 0x10000, 0xdad53bc0, 0x02 | BRF_GRA }, // 4 Sprites - { "rt_r-01.1j", 0x08000, 0x5e441e7f, 0x02 | BRF_GRA }, // 5 - { "rt_r-10.1k", 0x10000, 0xd6a66298, 0x02 | BRF_GRA }, // 6 - { "rt_r-11.1l", 0x08000, 0x791df4f8, 0x02 | BRF_GRA }, // 7 - { "rt_r-20.3h", 0x10000, 0xfc247c8a, 0x02 | BRF_GRA }, // 8 - { "rt_r-21.3j", 0x08000, 0xed793841, 0x02 | BRF_GRA }, // 9 - { "rt_r-30.3k", 0x10000, 0xeb02a1cb, 0x02 | BRF_GRA }, // 10 - { "rt_r-31.3l", 0x08000, 0x8558355d, 0x02 | BRF_GRA }, // 11 - - { "rt_b-a0.3c", 0x08000, 0x4e212fb0, 0x03 | BRF_GRA }, // 12 Foreground Tiles - { "rt_b-a1.3d", 0x08000, 0x8a65bdff, 0x03 | BRF_GRA }, // 13 - { "rt_b-a2.3a", 0x08000, 0x5a4ae5b9, 0x03 | BRF_GRA }, // 14 - { "rt_b-a3.3e", 0x08000, 0x73327606, 0x03 | BRF_GRA }, // 15 - - { "rt_b-b0.3j", 0x08000, 0xa7b17491, 0x04 | BRF_GRA }, // 16 Background Tiles - { "rt_b-b1.3k", 0x08000, 0xb9709686, 0x04 | BRF_GRA }, // 17 - { "rt_b-b2.3h", 0x08000, 0x433b229a, 0x04 | BRF_GRA }, // 18 - { "rt_b-b3.3f", 0x08000, 0xad89b072, 0x04 | BRF_GRA }, // 19 -}; - -STD_ROM_PICK(rtype) -STD_ROM_FN(rtype) - -static INT32 rtypeInit() -{ - return DrvInit(common_040000_040000, sound_ram_map, NULL, 0x80, Z80_NO_NMI, 0); -} - -struct BurnDriver BurnDrvRtype = { - "rtype", NULL, NULL, NULL, "1987", - "R-Type (World)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, rtypeRomInfo, rtypeRomName, NULL, NULL, CommonInputInfo, RtypeDIPInfo, - rtypeInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// R-Type (Japan) - -static struct BurnRomInfo rtypejRomDesc[] = { - { "rt_r-h0-.1b", 0x10000, 0xc2940df2, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "rt_r-l0-.3b", 0x10000, 0x858cc0f6, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "rt_r-h1-.1c", 0x10000, 0x5bcededa, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "rt_r-l1-.3c", 0x10000, 0x4821141c, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "rt_r-00.1h", 0x10000, 0xdad53bc0, 0x02 | BRF_GRA }, // 4 Sprites - { "rt_r-01.1j", 0x08000, 0x5e441e7f, 0x02 | BRF_GRA }, // 5 - { "rt_r-10.1k", 0x10000, 0xd6a66298, 0x02 | BRF_GRA }, // 6 - { "rt_r-11.1l", 0x08000, 0x791df4f8, 0x02 | BRF_GRA }, // 7 - { "rt_r-20.3h", 0x10000, 0xfc247c8a, 0x02 | BRF_GRA }, // 8 - { "rt_r-21.3j", 0x08000, 0xed793841, 0x02 | BRF_GRA }, // 9 - { "rt_r-30.3k", 0x10000, 0xeb02a1cb, 0x02 | BRF_GRA }, // 10 - { "rt_r-31.3l", 0x08000, 0x8558355d, 0x02 | BRF_GRA }, // 11 - - { "rt_b-a0.3c", 0x08000, 0x4e212fb0, 0x03 | BRF_GRA }, // 12 Foreground Tiles - { "rt_b-a1.3d", 0x08000, 0x8a65bdff, 0x03 | BRF_GRA }, // 13 - { "rt_b-a2.3a", 0x08000, 0x5a4ae5b9, 0x03 | BRF_GRA }, // 14 - { "rt_b-a3.3e", 0x08000, 0x73327606, 0x03 | BRF_GRA }, // 15 - - { "rt_b-b0.3j", 0x08000, 0xa7b17491, 0x04 | BRF_GRA }, // 16 Background Tiles - { "rt_b-b1.3k", 0x08000, 0xb9709686, 0x04 | BRF_GRA }, // 17 - { "rt_b-b2.3h", 0x08000, 0x433b229a, 0x04 | BRF_GRA }, // 18 - { "rt_b-b3.3f", 0x08000, 0xad89b072, 0x04 | BRF_GRA }, // 19 -}; - -STD_ROM_PICK(rtypej) -STD_ROM_FN(rtypej) - -struct BurnDriver BurnDrvRtypej = { - "rtypej", "rtype", NULL, NULL, "1987", - "R-Type (Japan)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, rtypejRomInfo, rtypejRomName, NULL, NULL, CommonInputInfo, RtypeDIPInfo, - rtypeInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// R-Type (Japan prototype) - -static struct BurnRomInfo rtypejpRomDesc[] = { - { "db_b1.bin", 0x10000, 0xc1865141, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "db_a1.bin", 0x10000, 0x5ad2bd90, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "db_b2.bin", 0x10000, 0xb4f6407e, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "db_a2.bin", 0x10000, 0x6098d86f, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "rt_r-00.1h", 0x10000, 0xdad53bc0, 0x02 | BRF_GRA }, // 4 Sprites - { "rt_r-01.1j", 0x08000, 0x5e441e7f, 0x02 | BRF_GRA }, // 5 - { "rt_r-10.1k", 0x10000, 0xd6a66298, 0x02 | BRF_GRA }, // 6 - { "rt_r-11.1l", 0x08000, 0x791df4f8, 0x02 | BRF_GRA }, // 7 - { "rt_r-20.3h", 0x10000, 0xfc247c8a, 0x02 | BRF_GRA }, // 8 - { "rt_r-21.3j", 0x08000, 0xed793841, 0x02 | BRF_GRA }, // 9 - { "rt_r-30.3k", 0x10000, 0xeb02a1cb, 0x02 | BRF_GRA }, // 10 - { "rt_r-31.3l", 0x08000, 0x8558355d, 0x02 | BRF_GRA }, // 11 - - { "rt_b-a0.3c", 0x08000, 0x4e212fb0, 0x03 | BRF_GRA }, // 12 Foreground Tiles - { "rt_b-a1.3d", 0x08000, 0x8a65bdff, 0x03 | BRF_GRA }, // 13 - { "rt_b-a2.3a", 0x08000, 0x5a4ae5b9, 0x03 | BRF_GRA }, // 14 - { "rt_b-a3.3e", 0x08000, 0x73327606, 0x03 | BRF_GRA }, // 15 - - { "rt_b-b0.3j", 0x08000, 0xa7b17491, 0x04 | BRF_GRA }, // 16 Background Tiles - { "rt_b-b1.3k", 0x08000, 0xb9709686, 0x04 | BRF_GRA }, // 17 - { "rt_b-b2.3h", 0x08000, 0x433b229a, 0x04 | BRF_GRA }, // 18 - { "rt_b-b3.3f", 0x08000, 0xad89b072, 0x04 | BRF_GRA }, // 19 -}; - -STD_ROM_PICK(rtypejp) -STD_ROM_FN(rtypejp) - -struct BurnDriver BurnDrvRtypejp = { - "rtypejp", "rtype", NULL, NULL, "1987", - "R-Type (Japan prototype)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, rtypejpRomInfo, rtypejpRomName, NULL, NULL, CommonInputInfo, RtypepDIPInfo, - rtypeInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// R-Type (US) - -static struct BurnRomInfo rtypeuRomDesc[] = { - { "rt_r-h0-a.1b", 0x10000, 0x36008a4e, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "rt_r-l0-a.3b", 0x10000, 0x4aaa668e, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "rt_r-h1-a.1c", 0x10000, 0x7ebb2a53, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "rt_r-l1-a.3c", 0x10000, 0xc28b103b, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "rt_r-00.1h", 0x10000, 0xdad53bc0, 0x02 | BRF_GRA }, // 4 Sprites - { "rt_r-01.1j", 0x08000, 0x5e441e7f, 0x02 | BRF_GRA }, // 5 - { "rt_r-10.1k", 0x10000, 0xd6a66298, 0x02 | BRF_GRA }, // 6 - { "rt_r-11.1l", 0x08000, 0x791df4f8, 0x02 | BRF_GRA }, // 7 - { "rt_r-20.3h", 0x10000, 0xfc247c8a, 0x02 | BRF_GRA }, // 8 - { "rt_r-21.3j", 0x08000, 0xed793841, 0x02 | BRF_GRA }, // 9 - { "rt_r-30.3k", 0x10000, 0xeb02a1cb, 0x02 | BRF_GRA }, // 10 - { "rt_r-31.3l", 0x08000, 0x8558355d, 0x02 | BRF_GRA }, // 11 - - { "rt_b-a0.3c", 0x08000, 0x4e212fb0, 0x03 | BRF_GRA }, // 12 Foreground Tiles - { "rt_b-a1.3d", 0x08000, 0x8a65bdff, 0x03 | BRF_GRA }, // 13 - { "rt_b-a2.3a", 0x08000, 0x5a4ae5b9, 0x03 | BRF_GRA }, // 14 - { "rt_b-a3.3e", 0x08000, 0x73327606, 0x03 | BRF_GRA }, // 15 - - { "rt_b-b0.3j", 0x08000, 0xa7b17491, 0x04 | BRF_GRA }, // 16 Background Tiles - { "rt_b-b1.3k", 0x08000, 0xb9709686, 0x04 | BRF_GRA }, // 17 - { "rt_b-b2.3h", 0x08000, 0x433b229a, 0x04 | BRF_GRA }, // 18 - { "rt_b-b3.3f", 0x08000, 0xad89b072, 0x04 | BRF_GRA }, // 19 - - { "m72_a-8l-.ic66", 0x00100, 0xb460c438, 0x00 | BRF_OPT }, // 20 Proms - { "m72_a-9l-.ic75", 0x00100, 0xa4f2c4bc, 0x00 | BRF_OPT }, // 21 - - { "m72_r-3a-.bin", 0x00001, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 22 PLDs - { "m72_a-3d-.bin", 0x00001, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 23 - { "m72_a-4d-.bin", 0x00001, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 24 -}; - -STD_ROM_PICK(rtypeu) -STD_ROM_FN(rtypeu) - -struct BurnDriver BurnDrvRtypeu = { - "rtypeu", "rtype", NULL, NULL, "1987", - "R-Type (US)\0", NULL, "Irem (Nintendo of America license)", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, rtypeuRomInfo, rtypeuRomName, NULL, NULL, CommonInputInfo, RtypeDIPInfo, - rtypeInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// R-Type (World bootleg) - -static struct BurnRomInfo rtypebRomDesc[] = { - { "7.512", 0x10000, 0xeacc8024, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "1.512", 0x10000, 0x2e5fe27b, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "8.512", 0x10000, 0x22cc4950, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "2.512", 0x10000, 0xada7b90e, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "rt_r-00.1h", 0x10000, 0xdad53bc0, 0x02 | BRF_GRA }, // 4 Sprites - { "rt_r-01.1j", 0x08000, 0x5e441e7f, 0x02 | BRF_GRA }, // 5 - { "rt_r-10.1k", 0x10000, 0xd6a66298, 0x02 | BRF_GRA }, // 6 - { "rt_r-11.1l", 0x08000, 0x791df4f8, 0x02 | BRF_GRA }, // 7 - { "rt_r-20.3h", 0x10000, 0xfc247c8a, 0x02 | BRF_GRA }, // 8 - { "rt_r-21.3j", 0x08000, 0xed793841, 0x02 | BRF_GRA }, // 9 - { "rt_r-30.3k", 0x10000, 0xeb02a1cb, 0x02 | BRF_GRA }, // 10 - { "rt_r-31.3l", 0x08000, 0x8558355d, 0x02 | BRF_GRA }, // 11 - - { "rt_b-a0.3c", 0x08000, 0x4e212fb0, 0x03 | BRF_GRA }, // 12 Foreground Tiles - { "rt_b-a1.3d", 0x08000, 0x8a65bdff, 0x03 | BRF_GRA }, // 13 - { "rt_b-a2.3a", 0x08000, 0x5a4ae5b9, 0x03 | BRF_GRA }, // 14 - { "rt_b-a3.3e", 0x08000, 0x73327606, 0x03 | BRF_GRA }, // 15 - - { "rt_b-b0.3j", 0x08000, 0xa7b17491, 0x04 | BRF_GRA }, // 16 Background Tiles - { "rt_b-b1.3k", 0x08000, 0xb9709686, 0x04 | BRF_GRA }, // 17 - { "rt_b-b2.3h", 0x08000, 0x433b229a, 0x04 | BRF_GRA }, // 18 - { "rt_b-b3.3f", 0x08000, 0xad89b072, 0x04 | BRF_GRA }, // 19 -}; - -STD_ROM_PICK(rtypeb) -STD_ROM_FN(rtypeb) - -struct BurnDriver BurnDrvRtypeb = { - "rtypeb", "rtype", NULL, NULL, "1987", - "R-Type (World bootleg)\0", NULL, "bootleg", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, rtypebRomInfo, rtypebRomName, NULL, NULL, CommonInputInfo, RtypeDIPInfo, - rtypeInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// X Multiply (World, M81) - -static struct BurnRomInfo xmultiplRomDesc[] = { - { "xm-a-h1-.ic58", 0x20000, 0x449048cf, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "xm-a-l1-.ic67", 0x20000, 0x26ce39b0, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "xm-a-h0-.ic59", 0x10000, 0x509bc970, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "xm-a-l0-.ic68", 0x10000, 0x490a9ebc, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "xm-a-sp-.ic14", 0x10000, 0x006eef56, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "t44.00", 0x20000, 0xdb45186e, 0x02 | BRF_GRA }, // 5 Sprites - { "t45.01", 0x20000, 0x4d0764d4, 0x02 | BRF_GRA }, // 6 - { "t46.10", 0x20000, 0xf0c465a4, 0x02 | BRF_GRA }, // 7 - { "t47.11", 0x20000, 0x1263b24b, 0x02 | BRF_GRA }, // 8 - { "t48.20", 0x20000, 0x4129944f, 0x02 | BRF_GRA }, // 9 - { "t49.21", 0x20000, 0x2346e6f9, 0x02 | BRF_GRA }, // 10 - { "t50.30", 0x20000, 0xe322543e, 0x02 | BRF_GRA }, // 11 - { "t51.31", 0x20000, 0x229bf7b1, 0x02 | BRF_GRA }, // 12 - - { "t53.a0", 0x20000, 0x1a082494, 0x03 | BRF_GRA }, // 13 Foreground Tiles - { "t54.a1", 0x20000, 0x076c16c5, 0x03 | BRF_GRA }, // 14 - { "t55.a2", 0x20000, 0x25d877a5, 0x03 | BRF_GRA }, // 15 - { "t56.a3", 0x20000, 0x5b1213f5, 0x03 | BRF_GRA }, // 16 - - { "t57.b0", 0x20000, 0x0a84e0c7, 0x04 | BRF_GRA }, // 17 Background Tiles - { "t58.b1", 0x20000, 0xa874121d, 0x04 | BRF_GRA }, // 18 - { "t59.b2", 0x20000, 0x69deb990, 0x04 | BRF_GRA }, // 19 - { "t60.b3", 0x20000, 0x14c69f99, 0x04 | BRF_GRA }, // 20 - - { "t52.v0", 0x20000, 0x2db1bd80, 0x05 | BRF_SND }, // 21 DAC Samples - - { "m81_a-9l-.ic72", 0x00100, 0xb460c438, 0x00 | BRF_OPT }, // 22 Proms - { "m81_a-9p-.ic74", 0x00100, 0xa4f2c4bc, 0x00 | BRF_OPT }, // 23 -}; - -STD_ROM_PICK(xmultipl) -STD_ROM_FN(xmultipl) - -static INT32 xmultiplInit() -{ - return DrvInit(common_080000_09c000, sound_rom_map, NULL, 0x20, Z80_REAL_NMI, 0); -} - -struct BurnDriver BurnDrvXmultipl = { - "xmultipl", NULL, NULL, NULL, "1989", - "X Multiply (World, M81)\0", NULL, "Irem", "M81", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, xmultiplRomInfo, xmultiplRomName, NULL, NULL, CommonInputInfo, XmultiplDIPInfo, - xmultiplInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// X Multiply (Japan, M72) - -static struct BurnRomInfo xmultiplm72RomDesc[] = { - { "ch3.h3", 0x20000, 0x20685021, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "cl3.l3", 0x20000, 0x93fdd200, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ch0.h0", 0x10000, 0x9438dd8a, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "cl0.l0", 0x10000, 0x06a9e213, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "t44.00", 0x20000, 0xdb45186e, 0x02 | BRF_GRA }, // 4 Sprites - { "t45.01", 0x20000, 0x4d0764d4, 0x02 | BRF_GRA }, // 5 - { "t46.10", 0x20000, 0xf0c465a4, 0x02 | BRF_GRA }, // 6 - { "t47.11", 0x20000, 0x1263b24b, 0x02 | BRF_GRA }, // 7 - { "t48.20", 0x20000, 0x4129944f, 0x02 | BRF_GRA }, // 8 - { "t49.21", 0x20000, 0x2346e6f9, 0x02 | BRF_GRA }, // 9 - { "t50.30", 0x20000, 0xe322543e, 0x02 | BRF_GRA }, // 10 - { "t51.31", 0x20000, 0x229bf7b1, 0x02 | BRF_GRA }, // 11 - - { "t53.a0", 0x20000, 0x1a082494, 0x03 | BRF_GRA }, // 12 Foreground Tiles - { "t54.a1", 0x20000, 0x076c16c5, 0x03 | BRF_GRA }, // 13 - { "t55.a2", 0x20000, 0x25d877a5, 0x03 | BRF_GRA }, // 14 - { "t56.a3", 0x20000, 0x5b1213f5, 0x03 | BRF_GRA }, // 15 - - { "t57.b0", 0x20000, 0x0a84e0c7, 0x04 | BRF_GRA }, // 16 Background Tiles - { "t58.b1", 0x20000, 0xa874121d, 0x04 | BRF_GRA }, // 17 - { "t59.b2", 0x20000, 0x69deb990, 0x04 | BRF_GRA }, // 18 - { "t60.b3", 0x20000, 0x14c69f99, 0x04 | BRF_GRA }, // 19 - - { "t52.v0", 0x20000, 0x2db1bd80, 0x05 | BRF_SND }, // 20 DAC Samples - - { "xmultipl_i8751h.bin",0x01000, 0xc8ceb3cd, 0x00 | BRF_OPT }, // 21 i8751 Code -}; - -STD_ROM_PICK(xmultiplm72) -STD_ROM_FN(xmultiplm72) - -static INT32 xmultiplm72Init() -{ - install_protection(xmultiplm72); - - return DrvInit(common_080000_080000, sound_ram_map, NULL, 0x20, Z80_REAL_NMI, 0); -} - -struct BurnDriver BurnDrvXmultiplm72 = { - "xmultiplm72", "xmultipl", NULL, NULL, "1989", - "X Multiply (Japan, M72)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, xmultiplm72RomInfo, xmultiplm72RomName, NULL, NULL, CommonInputInfo, XmultiplDIPInfo, - xmultiplm72Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Dragon Breed (M81 PCB version) - -static struct BurnRomInfo dbreedRomDesc[] = { - { "db-a-h0-.59", 0x20000, 0xe1177267, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "db-a-l0-.68", 0x20000, 0xd82b167e, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "db-a-sp-.14", 0x10000, 0x54a61560, 0x06 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "db_k800m.00", 0x20000, 0xc027a8cf, 0x02 | BRF_GRA }, // 3 Sprites - { "db_k801m.10", 0x20000, 0x093faf33, 0x02 | BRF_GRA }, // 4 - { "db_k802m.20", 0x20000, 0x055b4c59, 0x02 | BRF_GRA }, // 5 - { "db_k803m.30", 0x20000, 0x8ed63922, 0x02 | BRF_GRA }, // 6 - - { "db_k804m.a0", 0x20000, 0x4c83e92e, 0x03 | BRF_GRA }, // 7 Foreground & Background Tiles - { "db_k805m.a1", 0x20000, 0x835ef268, 0x03 | BRF_GRA }, // 8 - { "db_k806m.a2", 0x20000, 0x5117f114, 0x03 | BRF_GRA }, // 9 - { "db_k807m.a3", 0x20000, 0x8eb0c978, 0x03 | BRF_GRA }, // 10 - - { "db_a-v0.rom", 0x20000, 0x312f7282, 0x05 | BRF_SND }, // 11 DAC Samples -}; - -STD_ROM_PICK(dbreed) -STD_ROM_FN(dbreed) - -static INT32 dbreedRomLoadCallback() -{ - memcpy (DrvV30ROM + 0x60000, DrvV30ROM + 0x20000, 0x20000); - - return 0; -} - -static INT32 dbreedInit() -{ - return DrvInit(common_080000_088000, sound_rom_map, dbreedRomLoadCallback, 0x20, Z80_REAL_NMI, 2); -} - -struct BurnDriver BurnDrvDbreed = { - "dbreed", NULL, NULL, NULL, "1989", - "Dragon Breed (M81 PCB version)\0", NULL, "Irem", "M81", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, dbreedRomInfo, dbreedRomName, NULL, NULL, CommonInputInfo, DbreedDIPInfo, - dbreedInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Dragon Breed (M72 PCB version) - -static struct BurnRomInfo dbreedm72RomDesc[] = { - { "db_c-h3.rom", 0x20000, 0x4bf3063c, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "db_c-l3.rom", 0x20000, 0xe4b89b79, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "db_c-h0.rom", 0x10000, 0x5aa79fb2, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "db_c-l0.rom", 0x10000, 0xed0f5e06, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "db_k800m.00", 0x20000, 0xc027a8cf, 0x02 | BRF_GRA }, // 4 Sprites - { "db_k801m.10", 0x20000, 0x093faf33, 0x02 | BRF_GRA }, // 5 - { "db_k802m.20", 0x20000, 0x055b4c59, 0x02 | BRF_GRA }, // 6 - { "db_k803m.30", 0x20000, 0x8ed63922, 0x02 | BRF_GRA }, // 7 - - { "db_k804m.a0", 0x20000, 0x4c83e92e, 0x03 | BRF_GRA }, // 8 Foreground Tiles - { "db_k805m.a1", 0x20000, 0x835ef268, 0x03 | BRF_GRA }, // 9 - { "db_k806m.a2", 0x20000, 0x5117f114, 0x03 | BRF_GRA }, // 10 - { "db_k807m.a3", 0x20000, 0x8eb0c978, 0x03 | BRF_GRA }, // 11 - - { "db_k804m.b0", 0x20000, 0x4c83e92e, 0x04 | BRF_GRA }, // 12 Background Tiles - { "db_k805m.b1", 0x20000, 0x835ef268, 0x04 | BRF_GRA }, // 13 - { "db_k806m.b2", 0x20000, 0x5117f114, 0x04 | BRF_GRA }, // 14 - { "db_k807m.b3", 0x20000, 0x8eb0c978, 0x04 | BRF_GRA }, // 15 - - { "db_c-v0.rom", 0x20000, 0x312f7282, 0x05 | BRF_SND }, // 16 DAC Samples - - { "dbreedm72_i8751.mcu",0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 17 i8751 Code -}; - -STD_ROM_PICK(dbreedm72) -STD_ROM_FN(dbreedm72) - -static INT32 dbreedm72RomLoadCallback() -{ - memcpy (DrvV30ROM + 0x60000, DrvV30ROM + 0x40000, 0x20000); - - return 0; -} - -static INT32 dbreedm72Init() -{ - install_protection(dbreedm72); - - return DrvInit(common_080000_090000, sound_ram_map, dbreedm72RomLoadCallback, 0x20, Z80_REAL_NMI, 0); -} - -struct BurnDriver BurnDrvDbreedm72 = { - "dbreedm72", "dbreed", NULL, NULL, "1989", - "Dragon Breed (M72 PCB version)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, dbreedm72RomInfo, dbreedm72RomName, NULL, NULL, CommonInputInfo, DbreedDIPInfo, - dbreedm72Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Battle Chopper - -static struct BurnRomInfo bchopperRomDesc[] = { - { "c-h0-b.rom", 0x10000, 0xf2feab16, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "c-l0-b.rom", 0x10000, 0x9f887096, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "c-h1-b.rom", 0x10000, 0xa995d64f, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "c-l1-b.rom", 0x10000, 0x41dda999, 0x01 | BRF_PRG | BRF_ESS }, // 3 - { "c-h3-b.rom", 0x10000, 0xab9451ca, 0x01 | BRF_PRG | BRF_ESS }, // 4 - { "c-l3-b.rom", 0x10000, 0x11562221, 0x01 | BRF_PRG | BRF_ESS }, // 5 - - { "c-00-a.rom", 0x10000, 0xf6e6e660, 0x02 | BRF_GRA }, // 6 Sprites - { "c-01-b.rom", 0x10000, 0x708cdd37, 0x02 | BRF_GRA }, // 7 - { "c-10-a.rom", 0x10000, 0x292c8520, 0x02 | BRF_GRA }, // 8 - { "c-11-b.rom", 0x10000, 0x20904cf3, 0x02 | BRF_GRA }, // 9 - { "c-20-a.rom", 0x10000, 0x1ab50c23, 0x02 | BRF_GRA }, // 10 - { "c-21-b.rom", 0x10000, 0xc823d34c, 0x02 | BRF_GRA }, // 11 - { "c-30-a.rom", 0x10000, 0x11f6c56b, 0x02 | BRF_GRA }, // 12 - { "c-31-b.rom", 0x10000, 0x23134ec5, 0x02 | BRF_GRA }, // 13 - - { "b-a0-b.rom", 0x10000, 0xe46ed7bf, 0x03 | BRF_GRA }, // 14 Foreground Tiles - { "b-a1-b.rom", 0x10000, 0x590605ff, 0x03 | BRF_GRA }, // 15 - { "b-a2-b.rom", 0x10000, 0xf8158226, 0x03 | BRF_GRA }, // 16 - { "b-a3-b.rom", 0x10000, 0x0f07b9b7, 0x03 | BRF_GRA }, // 17 - - { "b-b0-.rom", 0x10000, 0xb5b95776, 0x04 | BRF_GRA }, // 18 Background Tiles - { "b-b1-.rom", 0x10000, 0x74ca16ee, 0x04 | BRF_GRA }, // 19 - { "b-b2-.rom", 0x10000, 0xb82cca04, 0x04 | BRF_GRA }, // 20 - { "b-b3-.rom", 0x10000, 0xa7afc920, 0x04 | BRF_GRA }, // 21 - - { "c-v0-b.rom", 0x10000, 0xd0c27e58, 0x05 | BRF_SND }, // 22 DAC Samples - - { "bchopper_i8751.mcu", 0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 23 i8751 Code -}; - -STD_ROM_PICK(bchopper) -STD_ROM_FN(bchopper) - -static INT32 bchopperInit() -{ - install_protection(bchopper); - - return DrvInit(common_080000_0a0000, sound_ram_map, dbreedm72RomLoadCallback, 0x80, Z80_FAKE_NMI, 0); -} - -struct BurnDriver BurnDrvBchopper = { - "bchopper", NULL, NULL, NULL, "1987", - "Battle Chopper\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, bchopperRomInfo, bchopperRomName, NULL, NULL, CommonInputInfo, BchopperDIPInfo, - bchopperInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Mr. HELI no Dai-Bouken - -static struct BurnRomInfo mrheliRomDesc[] = { - { "mh-c-h0.bin", 0x10000, 0xe2ca5646, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "mh-c-l0.bin", 0x10000, 0x643e23cd, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "mh-c-h1.bin", 0x10000, 0x8974e84d, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "mh-c-l1.bin", 0x10000, 0x5f8bda69, 0x01 | BRF_PRG | BRF_ESS }, // 3 - { "mh-c-h3.bin", 0x10000, 0x143f596e, 0x01 | BRF_PRG | BRF_ESS }, // 4 - { "mh-c-l3.bin", 0x10000, 0xc0982536, 0x01 | BRF_PRG | BRF_ESS }, // 5 - - { "mh-c-00.bin", 0x20000, 0xdec4e121, 0x02 | BRF_GRA }, // 6 Sprites - { "mh-c-10.bin", 0x20000, 0x7aaa151e, 0x02 | BRF_GRA }, // 7 - { "mh-c-20.bin", 0x20000, 0xeae0de74, 0x02 | BRF_GRA }, // 8 - { "mh-c-30.bin", 0x20000, 0x01d5052f, 0x02 | BRF_GRA }, // 9 - - { "mh-b-a0.bin", 0x10000, 0x6a0db256, 0x03 | BRF_GRA }, // 10 Foreground Tiles - { "mh-b-a1.bin", 0x10000, 0x14ec9795, 0x03 | BRF_GRA }, // 11 - { "mh-b-a2.bin", 0x10000, 0xdfcb510e, 0x03 | BRF_GRA }, // 12 - { "mh-b-a3.bin", 0x10000, 0x957e329b, 0x03 | BRF_GRA }, // 13 - - { "b-b0-.rom", 0x10000, 0xb5b95776, 0x04 | BRF_GRA }, // 14 Background Tiles - { "b-b1-.rom", 0x10000, 0x74ca16ee, 0x04 | BRF_GRA }, // 15 - { "b-b2-.rom", 0x10000, 0xb82cca04, 0x04 | BRF_GRA }, // 16 - { "b-b3-.rom", 0x10000, 0xa7afc920, 0x04 | BRF_GRA }, // 17 - - { "c-v0-b.rom", 0x10000, 0xd0c27e58, 0x05 | BRF_SND }, // 18 DAC Samples - - { "mrheli_i8751.mcu", 0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 19 i8751 Code -}; - -STD_ROM_PICK(mrheli) -STD_ROM_FN(mrheli) - -static INT32 mrheliInit() -{ - m72_install_protection(bchopper_code, mrheli_crc, bchopper_sample_offsets); - - return DrvInit(common_080000_0a0000, sound_ram_map, dbreedm72RomLoadCallback, 0x80, Z80_FAKE_NMI, 0); -} - -struct BurnDriver BurnDrvMrheli = { - "mrheli", "bchopper", NULL, NULL, "1987", - "Mr. HELI no Dai-Bouken\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, mrheliRomInfo, mrheliRomName, NULL, NULL, CommonInputInfo, BchopperDIPInfo, - mrheliInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Ninja Spirit - -static struct BurnRomInfo nspiritRomDesc[] = { - { "nin-c-h0.rom", 0x10000, 0x035692fa, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "nin-c-l0.rom", 0x10000, 0x9a405898, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "nin-c-h1.rom", 0x10000, 0xcbc10586, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "nin-c-l1.rom", 0x10000, 0xb75c9a4d, 0x01 | BRF_PRG | BRF_ESS }, // 3 - { "nin-c-h2.rom", 0x10000, 0x8ad818fa, 0x01 | BRF_PRG | BRF_ESS }, // 4 - { "nin-c-l2.rom", 0x10000, 0xc52ca78c, 0x01 | BRF_PRG | BRF_ESS }, // 5 - { "nin-c-h3.rom", 0x10000, 0x501104ef, 0x01 | BRF_PRG | BRF_ESS }, // 6 - { "nin-c-l3.rom", 0x10000, 0xfd7408b8, 0x01 | BRF_PRG | BRF_ESS }, // 7 - - { "nin-r00.rom", 0x20000, 0x5f61d30b, 0x02 | BRF_GRA }, // 8 Sprites - { "nin-r10.rom", 0x20000, 0x0caad107, 0x02 | BRF_GRA }, // 9 - { "nin-r20.rom", 0x20000, 0xef3617d3, 0x02 | BRF_GRA }, // 10 - { "nin-r30.rom", 0x20000, 0x175d2a24, 0x02 | BRF_GRA }, // 11 - - { "nin-b-a0.rom", 0x10000, 0x63f8f658, 0x03 | BRF_GRA }, // 12 Foreground Tiles - { "nin-b-a1.rom", 0x10000, 0x75eb8306, 0x03 | BRF_GRA }, // 13 - { "nin-b-a2.rom", 0x10000, 0xdf532172, 0x03 | BRF_GRA }, // 14 - { "nin-b-a3.rom", 0x10000, 0x4dedd64c, 0x03 | BRF_GRA }, // 15 - - { "nin-b0.rom", 0x10000, 0x1b0e08a6, 0x04 | BRF_GRA }, // 16 Background Tiles - { "nin-b1.rom", 0x10000, 0x728727f0, 0x04 | BRF_GRA }, // 17 - { "nin-b2.rom", 0x10000, 0xf87efd75, 0x04 | BRF_GRA }, // 18 - { "nin-b3.rom", 0x10000, 0x98856cb4, 0x04 | BRF_GRA }, // 19 - - { "nin-v0.rom", 0x10000, 0xa32e8caf, 0x05 | BRF_SND }, // 20 DAC Samples - - { "nspirit_i8751.mcu", 0x01000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 21 i8751 Code -}; - -STD_ROM_PICK(nspirit) -STD_ROM_FN(nspirit) - -static INT32 nspiritInit() -{ - install_protection(nspirit); - - return DrvInit(common_080000_0a0000, sound_ram_map, NULL, 0x80, Z80_FAKE_NMI, 0); -} - -struct BurnDriver BurnDrvNspirit = { - "nspirit", NULL, NULL, NULL, "1988", - "Ninja Spirit\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, - NULL, nspiritRomInfo, nspiritRomName, NULL, NULL, CommonInputInfo, NspiritDIPInfo, - nspiritInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Saigo no Nindou (Japan) - -static struct BurnRomInfo nspiritjRomDesc[] = { - { "c-h0", 0x10000, 0x8603fab2, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "c-l0", 0x10000, 0xe520fa35, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "nin-c-h1.rom", 0x10000, 0xcbc10586, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "nin-c-l1.rom", 0x10000, 0xb75c9a4d, 0x01 | BRF_PRG | BRF_ESS }, // 3 - { "nin-c-h2.rom", 0x10000, 0x8ad818fa, 0x01 | BRF_PRG | BRF_ESS }, // 4 - { "nin-c-l2.rom", 0x10000, 0xc52ca78c, 0x01 | BRF_PRG | BRF_ESS }, // 5 - { "c-h3", 0x10000, 0x95b63a61, 0x01 | BRF_PRG | BRF_ESS }, // 6 - { "c-l3", 0x10000, 0xe754a87a, 0x01 | BRF_PRG | BRF_ESS }, // 7 - - { "nin-r00.rom", 0x20000, 0x5f61d30b, 0x02 | BRF_GRA }, // 8 Sprites - { "nin-r10.rom", 0x20000, 0x0caad107, 0x02 | BRF_GRA }, // 9 - { "nin-r20.rom", 0x20000, 0xef3617d3, 0x02 | BRF_GRA }, // 10 - { "nin-r30.rom", 0x20000, 0x175d2a24, 0x02 | BRF_GRA }, // 11 - - { "nin-b-a0.rom", 0x10000, 0x63f8f658, 0x03 | BRF_GRA }, // 12 Foreground Tiles - { "nin-b-a1.rom", 0x10000, 0x75eb8306, 0x03 | BRF_GRA }, // 13 - { "nin-b-a2.rom", 0x10000, 0xdf532172, 0x03 | BRF_GRA }, // 14 - { "nin-b-a3.rom", 0x10000, 0x4dedd64c, 0x03 | BRF_GRA }, // 15 - - { "nin-b0.rom", 0x10000, 0x1b0e08a6, 0x04 | BRF_GRA }, // 16 Background Tiles - { "nin-b1.rom", 0x10000, 0x728727f0, 0x04 | BRF_GRA }, // 17 - { "nin-b2.rom", 0x10000, 0xf87efd75, 0x04 | BRF_GRA }, // 18 - { "nin-b3.rom", 0x10000, 0x98856cb4, 0x04 | BRF_GRA }, // 19 - - { "nin-v0.rom", 0x10000, 0xa32e8caf, 0x05 | BRF_SND }, // 20 DAC Samples - - { "nin_c-pr.bin", 0x01000, 0x802d440a, 0x00 | BRF_OPT }, // 21 i8751 Code -}; - -STD_ROM_PICK(nspiritj) -STD_ROM_FN(nspiritj) - -static INT32 nspiritjInit() -{ - m72_install_protection(nspirit_code, nspiritj_crc, nspirit_sample_offsets); - - return DrvInit(common_080000_0a0000, sound_ram_map, NULL, 0x80, Z80_FAKE_NMI, 0); -} - -struct BurnDriver BurnDrvNspiritj = { - "nspiritj", "nspirit", NULL, NULL, "1988", - "Saigo no Nindou (Japan)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, - NULL, nspiritjRomInfo, nspiritjRomName, NULL, NULL, CommonInputInfo, NspiritDIPInfo, - nspiritjInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Image Fight (Japan, revision A) - -static struct BurnRomInfo imgfightRomDesc[] = { - { "if-c-h0-a.bin", 0x10000, 0xf5c94464, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "if-c-l0-a.bin", 0x10000, 0x87c534fe, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "if-c-h3.bin", 0x20000, 0xea030541, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "if-c-l3.bin", 0x20000, 0xc66ae348, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "if-c-00.bin", 0x20000, 0x745e6638, 0x02 | BRF_GRA }, // 4 Sprites - { "if-c-10.bin", 0x20000, 0xb7108449, 0x02 | BRF_GRA }, // 5 - { "if-c-20.bin", 0x20000, 0xaef33cba, 0x02 | BRF_GRA }, // 6 - { "if-c-30.bin", 0x20000, 0x1f98e695, 0x02 | BRF_GRA }, // 7 - - { "if-a-a0.bin", 0x10000, 0x34ee2d77, 0x03 | BRF_GRA }, // 8 Foreground Tiles - { "if-a-a1.bin", 0x10000, 0x6bd2845b, 0x03 | BRF_GRA }, // 9 - { "if-a-a2.bin", 0x10000, 0x090d50e5, 0x03 | BRF_GRA }, // 10 - { "if-a-a3.bin", 0x10000, 0x3a8e3083, 0x03 | BRF_GRA }, // 11 - - { "if-a-b0.bin", 0x10000, 0xb425c829, 0x04 | BRF_GRA }, // 12 Background Tiles - { "if-a-b1.bin", 0x10000, 0xe9bfe23e, 0x04 | BRF_GRA }, // 13 - { "if-a-b2.bin", 0x10000, 0x256e50f2, 0x04 | BRF_GRA }, // 14 - { "if-a-b3.bin", 0x10000, 0x4c682785, 0x04 | BRF_GRA }, // 15 - - { "if-c-v0.bin", 0x10000, 0xcb64a194, 0x05 | BRF_SND }, // 16 DAC Samples - { "if-c-v1.bin", 0x10000, 0x45b68bf5, 0x05 | BRF_SND }, // 17 - - { "imgfight_i8751h.bin",0x01000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 18 i8751 Code -}; - -STD_ROM_PICK(imgfight) -STD_ROM_FN(imgfight) - -static INT32 imgfightRomLoadCallback() -{ - memcpy (DrvV30ROM + 0x40000, DrvV30ROM + 0x20000, 0x40000); - - return 0; -} - -static INT32 imgfightInit() -{ - install_protection(imgfight); - - return DrvInit(common_080000_0a0000, sound_ram_map, imgfightRomLoadCallback, 0x80, Z80_FAKE_NMI, 0); -} - -struct BurnDriver BurnDrvImgfight = { - "imgfight", NULL, NULL, NULL, "1988", - "Image Fight (Japan, revision A)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_VERSHOOT, 0, - NULL, imgfightRomInfo, imgfightRomName, NULL, NULL, CommonInputInfo, ImgfightDIPInfo, - imgfightInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 256, 384, 3, 4 -}; - - -// Image Fight (Japan) - -static struct BurnRomInfo imgfightjRomDesc[] = { - { "if-c-h0.bin", 0x10000, 0x592d2d80, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "if-c-l0.bin", 0x10000, 0x61f89056, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "if-c-h3.bin", 0x20000, 0xea030541, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "if-c-l3.bin", 0x20000, 0xc66ae348, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "if-c-00.bin", 0x20000, 0x745e6638, 0x02 | BRF_GRA }, // 4 Sprites - { "if-c-10.bin", 0x20000, 0xb7108449, 0x02 | BRF_GRA }, // 5 - { "if-c-20.bin", 0x20000, 0xaef33cba, 0x02 | BRF_GRA }, // 6 - { "if-c-30.bin", 0x20000, 0x1f98e695, 0x02 | BRF_GRA }, // 7 - - { "if-a-a0.bin", 0x10000, 0x34ee2d77, 0x03 | BRF_GRA }, // 8 Foreground Tiles - { "if-a-a1.bin", 0x10000, 0x6bd2845b, 0x03 | BRF_GRA }, // 9 - { "if-a-a2.bin", 0x10000, 0x090d50e5, 0x03 | BRF_GRA }, // 10 - { "if-a-a3.bin", 0x10000, 0x3a8e3083, 0x03 | BRF_GRA }, // 11 - - { "if-a-b0.bin", 0x10000, 0xb425c829, 0x04 | BRF_GRA }, // 12 Background Tiles - { "if-a-b1.bin", 0x10000, 0xe9bfe23e, 0x04 | BRF_GRA }, // 13 - { "if-a-b2.bin", 0x10000, 0x256e50f2, 0x04 | BRF_GRA }, // 14 - { "if-a-b3.bin", 0x10000, 0x4c682785, 0x04 | BRF_GRA }, // 15 - - { "if-c-v0.bin", 0x10000, 0xcb64a194, 0x05 | BRF_SND }, // 16 DAC Samples - { "if-c-v1.bin", 0x10000, 0x45b68bf5, 0x05 | BRF_SND }, // 17 - - { "imgfightj_i8751h.bin",0x01000, 0xef0d5098, 0x00 | BRF_OPT }, // 18 i8751 Code -}; - -STD_ROM_PICK(imgfightj) -STD_ROM_FN(imgfightj) - -struct BurnDriver BurnDrvImgfightj = { - "imgfightj", "imgfight", NULL, NULL, "1988", - "Image Fight (Japan)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_VERSHOOT, 0, - NULL, imgfightjRomInfo, imgfightjRomName, NULL, NULL, CommonInputInfo, ImgfightDIPInfo, - imgfightInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 256, 384, 3, 4 -}; - - -// Air Duel (Japan) - -static struct BurnRomInfo airduelRomDesc[] = { - { "ad-c-h0.bin", 0x20000, 0x12140276, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "ad-c-l0.bin", 0x20000, 0x4ac0b91d, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ad-c-h3.bin", 0x20000, 0x9f7cfca3, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ad-c-l3.bin", 0x20000, 0x9dd343f7, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ad-00.bin", 0x20000, 0x2f0d599b, 0x02 | BRF_GRA }, // 4 Sprites - { "ad-10.bin", 0x20000, 0x9865856b, 0x02 | BRF_GRA }, // 5 - { "ad-20.bin", 0x20000, 0xd392aef2, 0x02 | BRF_GRA }, // 6 - { "ad-30.bin", 0x20000, 0x923240c3, 0x02 | BRF_GRA }, // 7 - - { "ad-a0.bin", 0x20000, 0xce134b47, 0x03 | BRF_GRA }, // 8 Foreground Tiles - { "ad-a1.bin", 0x20000, 0x097fd853, 0x03 | BRF_GRA }, // 9 - { "ad-a2.bin", 0x20000, 0x6a94c1b9, 0x03 | BRF_GRA }, // 10 - { "ad-a3.bin", 0x20000, 0x6637c349, 0x03 | BRF_GRA }, // 11 - - { "ad-b0.bin", 0x20000, 0xce134b47, 0x04 | BRF_GRA }, // 12 Background Tiles - { "ad-b1.bin", 0x20000, 0x097fd853, 0x04 | BRF_GRA }, // 13 - { "ad-b2.bin", 0x20000, 0x6a94c1b9, 0x04 | BRF_GRA }, // 14 - { "ad-b3.bin", 0x20000, 0x6637c349, 0x04 | BRF_GRA }, // 15 - - { "ad-v0.bin", 0x20000, 0x339f474d, 0x05 | BRF_SND }, // 16 DAC Samples - - { "airduel_i8751.mcu", 0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 17 i8751 Code -}; - -STD_ROM_PICK(airduel) -STD_ROM_FN(airduel) - -static INT32 airduelInit() -{ - install_protection(airduel); - - return DrvInit(common_080000_0a0000, sound_ram_map, NULL, 0x80, Z80_FAKE_NMI, 0); -} - -struct BurnDriver BurnDrvAirduel = { - "airduel", NULL, NULL, NULL, "1990", - "Air Duel (Japan)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_VERSHOOT, 0, - NULL, airduelRomInfo, airduelRomName, NULL, NULL, CommonInputInfo, AirduelDIPInfo, - airduelInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 256, 384, 3, 4 -}; - - -// R-Type II - -static struct BurnRomInfo rtype2RomDesc[] = { - { "rt2-a-h0-d.54", 0x20000, 0xd8ece6f4, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "rt2-a-l0-d.60", 0x20000, 0x32cfb2e4, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "rt2-a-h1-d.53", 0x20000, 0x4f6e9b15, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "rt2-a-l1-d.59", 0x20000, 0x0fd123bf, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ic17.4f", 0x10000, 0x73ffecb4, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "ic31.6l", 0x20000, 0x2cd8f913, 0x02 | BRF_GRA }, // 5 Sprites - { "ic21.4l", 0x20000, 0x5033066d, 0x02 | BRF_GRA }, // 6 - { "ic32.6m", 0x20000, 0xec3a0450, 0x02 | BRF_GRA }, // 7 - { "ic22.4m", 0x20000, 0xdb6176fc, 0x02 | BRF_GRA }, // 8 - - { "ic50.7s", 0x20000, 0xf3f8736e, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "ic51.7u", 0x20000, 0xb4c543af, 0x03 | BRF_GRA }, // 10 - { "ic56.8s", 0x20000, 0x4cb80d66, 0x03 | BRF_GRA }, // 11 - { "ic57.8u", 0x20000, 0xbee128e0, 0x03 | BRF_GRA }, // 12 - { "ic65.9r", 0x20000, 0x2dc9c71a, 0x03 | BRF_GRA }, // 13 - { "ic66.9u", 0x20000, 0x7533c428, 0x03 | BRF_GRA }, // 14 - { "ic63.9m", 0x20000, 0xa6ad67f2, 0x03 | BRF_GRA }, // 15 - { "ic64.9p", 0x20000, 0x3686d555, 0x03 | BRF_GRA }, // 16 - - { "ic14.4c", 0x20000, 0x637172d5, 0x05 | BRF_SND }, // 17 DAC Samples -}; - -STD_ROM_PICK(rtype2) -STD_ROM_FN(rtype2) - -static INT32 rtype2Init() -{ - return DrvInit(rtype2_main_cpu_map, sound_rom_map, NULL, 0x80, Z80_REAL_NMI, 1); -} - -struct BurnDriver BurnDrvRtype2 = { - "rtype2", NULL, NULL, NULL, "1989", - "R-Type II\0", NULL, "Irem", "M82", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, rtype2RomInfo, rtype2RomName, NULL, NULL, CommonInputInfo, Rtype2DIPInfo, - rtype2Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// R-Type II (Japan) - -static struct BurnRomInfo rtype2jRomDesc[] = { - { "rt2-a-h0.54", 0x20000, 0x7857ccf6, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "rt2-a-l0.60", 0x20000, 0xcb22cd6e, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "rt2-a-h1.53", 0x20000, 0x49e75d28, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "rt2-a-l1.59", 0x20000, 0x12ec1676, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ic17.4f", 0x10000, 0x73ffecb4, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "ic31.6l", 0x20000, 0x2cd8f913, 0x02 | BRF_GRA }, // 5 Sprites - { "ic21.4l", 0x20000, 0x5033066d, 0x02 | BRF_GRA }, // 6 - { "ic32.6m", 0x20000, 0xec3a0450, 0x02 | BRF_GRA }, // 7 - { "ic22.4m", 0x20000, 0xdb6176fc, 0x02 | BRF_GRA }, // 8 - - { "ic50.7s", 0x20000, 0xf3f8736e, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "ic51.7u", 0x20000, 0xb4c543af, 0x03 | BRF_GRA }, // 10 - { "ic56.8s", 0x20000, 0x4cb80d66, 0x03 | BRF_GRA }, // 11 - { "ic57.8u", 0x20000, 0xbee128e0, 0x03 | BRF_GRA }, // 12 - { "ic65.9r", 0x20000, 0x2dc9c71a, 0x03 | BRF_GRA }, // 13 - { "ic66.9u", 0x20000, 0x7533c428, 0x03 | BRF_GRA }, // 14 - { "ic63.9m", 0x20000, 0xa6ad67f2, 0x03 | BRF_GRA }, // 15 - { "ic64.9p", 0x20000, 0x3686d555, 0x03 | BRF_GRA }, // 16 - - { "ic14.4c", 0x20000, 0x637172d5, 0x05 | BRF_SND }, // 17 DAC Samples -}; - -STD_ROM_PICK(rtype2j) -STD_ROM_FN(rtype2j) - -struct BurnDriver BurnDrvRtype2j = { - "rtype2j", "rtype2", NULL, NULL, "1989", - "R-Type II (Japan)\0", NULL, "Irem", "M82", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, rtype2jRomInfo, rtype2jRomName, NULL, NULL, CommonInputInfo, Rtype2DIPInfo, - rtype2Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// R-Type II (Japan, revision C) - -static struct BurnRomInfo rtype2jcRomDesc[] = { - { "rt2-a-h0-c.54", 0x20000, 0xef9a9990, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "rt2-a-l0-c.60", 0x20000, 0xd8b9da64, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "rt2-a-h1-c.53", 0x20000, 0x1b1870f4, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "rt2-a-l1-c.59", 0x20000, 0x60fdff35, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ic17.4f", 0x10000, 0x73ffecb4, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "ic31.6l", 0x20000, 0x2cd8f913, 0x02 | BRF_GRA }, // 5 Sprites - { "ic21.4l", 0x20000, 0x5033066d, 0x02 | BRF_GRA }, // 6 - { "ic32.6m", 0x20000, 0xec3a0450, 0x02 | BRF_GRA }, // 7 - { "ic22.4m", 0x20000, 0xdb6176fc, 0x02 | BRF_GRA }, // 8 - - { "ic50.7s", 0x20000, 0xf3f8736e, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "ic51.7u", 0x20000, 0xb4c543af, 0x03 | BRF_GRA }, // 10 - { "ic56.8s", 0x20000, 0x4cb80d66, 0x03 | BRF_GRA }, // 11 - { "ic57.8u", 0x20000, 0xbee128e0, 0x03 | BRF_GRA }, // 12 - { "ic65.9r", 0x20000, 0x2dc9c71a, 0x03 | BRF_GRA }, // 13 - { "ic66.9u", 0x20000, 0x7533c428, 0x03 | BRF_GRA }, // 14 - { "ic63.9m", 0x20000, 0xa6ad67f2, 0x03 | BRF_GRA }, // 15 - { "ic64.9p", 0x20000, 0x3686d555, 0x03 | BRF_GRA }, // 16 - - { "ic14.4c", 0x20000, 0x637172d5, 0x05 | BRF_SND }, // 17 DAC Samples -}; - -STD_ROM_PICK(rtype2jc) -STD_ROM_FN(rtype2jc) - -struct BurnDriver BurnDrvRtype2jc = { - "rtype2jc", "rtype2", NULL, NULL, "1989", - "R-Type II (Japan, revision C)\0", NULL, "Irem", "M82", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, rtype2jcRomInfo, rtype2jcRomName, NULL, NULL, CommonInputInfo, Rtype2DIPInfo, - rtype2Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Hammerin' Harry (World) - -static struct BurnRomInfo hharryRomDesc[] = { - { "a-h0-v.rom", 0x20000, 0xc52802a5, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "a-l0-v.rom", 0x20000, 0xf463074c, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "a-h1-0.rom", 0x10000, 0x3ae21335, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "a-l1-0.rom", 0x10000, 0xbc6ac5f9, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "a-sp-0.rom", 0x10000, 0x80e210e7, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "hh_00.rom", 0x20000, 0xec5127ef, 0x02 | BRF_GRA }, // 5 Sprites - { "hh_10.rom", 0x20000, 0xdef65294, 0x02 | BRF_GRA }, // 6 - { "hh_20.rom", 0x20000, 0xbb0d6ad4, 0x02 | BRF_GRA }, // 7 - { "hh_30.rom", 0x20000, 0x4351044e, 0x02 | BRF_GRA }, // 8 - - { "hh_a0.rom", 0x20000, 0xc577ba5f, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "hh_a1.rom", 0x20000, 0x429d12ab, 0x03 | BRF_GRA }, // 10 - { "hh_a2.rom", 0x20000, 0xb5b163b0, 0x03 | BRF_GRA }, // 11 - { "hh_a3.rom", 0x20000, 0x8ef566a1, 0x03 | BRF_GRA }, // 12 - - { "a-v0-0.rom", 0x20000, 0xfaaacaff, 0x05 | BRF_SND }, // 13 DAC Samples -}; - -STD_ROM_PICK(hharry) -STD_ROM_FN(hharry) - -static INT32 hharryInit() -{ - return DrvInit(common_080000_0a0000, sound_rom_map, dbreedm72RomLoadCallback, 0x20, Z80_REAL_NMI, 2); -} - -struct BurnDriver BurnDrvHharry = { - "hharry", NULL, NULL, NULL, "1990", - "Hammerin' Harry (World)\0", NULL, "Irem", "M82", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT | GBF_PLATFORM, 0, - NULL, hharryRomInfo, hharryRomName, NULL, NULL, CommonInputInfo, HharryDIPInfo, - hharryInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Hammerin' Harry (US) - -static struct BurnRomInfo hharryuRomDesc[] = { - { "a-ho-u.8d", 0x20000, 0xede7f755, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "a-lo-u.9d", 0x20000, 0xdf0726ae, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "a-h1-f.8b", 0x10000, 0x31b741c5, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "a-l1-f.9b", 0x10000, 0xb23e966c, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "a-sp-0.rom", 0x10000, 0x80e210e7, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "hh_00.rom", 0x20000, 0xec5127ef, 0x02 | BRF_GRA }, // 5 Sprites - { "hh_10.rom", 0x20000, 0xdef65294, 0x02 | BRF_GRA }, // 6 - { "hh_20.rom", 0x20000, 0xbb0d6ad4, 0x02 | BRF_GRA }, // 7 - { "hh_30.rom", 0x20000, 0x4351044e, 0x02 | BRF_GRA }, // 8 - - { "hh_a0.rom", 0x20000, 0xc577ba5f, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "hh_a1.rom", 0x20000, 0x429d12ab, 0x03 | BRF_GRA }, // 10 - { "hh_a2.rom", 0x20000, 0xb5b163b0, 0x03 | BRF_GRA }, // 11 - { "hh_a3.rom", 0x20000, 0x8ef566a1, 0x03 | BRF_GRA }, // 12 - - { "a-v0-0.rom", 0x20000, 0xfaaacaff, 0x05 | BRF_SND }, // 13 DAC Samples -}; - -STD_ROM_PICK(hharryu) -STD_ROM_FN(hharryu) - -static INT32 hharryuInit() -{ - return DrvInit(hharryu_main_cpu_map, sound_rom_map, dbreedm72RomLoadCallback, 0x20, Z80_REAL_NMI, 1); -} - -struct BurnDriver BurnDrvHharryu = { - "hharryu", "hharry", NULL, NULL, "1990", - "Hammerin' Harry (US)\0", NULL, "Irem America", "M82", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT | GBF_PLATFORM, 0, - NULL, hharryuRomInfo, hharryuRomName, NULL, NULL, CommonInputInfo, HharryDIPInfo, - hharryuInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Daiku no Gensan (Japan, M82) - -static struct BurnRomInfo dkgensanRomDesc[] = { - { "gen-a-h0.bin", 0x20000, 0x07a45f6d, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "gen-a-l0.bin", 0x20000, 0x46478fea, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "gen-a-h1.bin", 0x10000, 0x54e5b73c, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "gen-a-l1.bin", 0x10000, 0x894f8a9f, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "gen-a-sp.bin", 0x10000, 0xe83cfc2c, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "hh_00.rom", 0x20000, 0xec5127ef, 0x02 | BRF_GRA }, // 5 Sprites - { "hh_10.rom", 0x20000, 0xdef65294, 0x02 | BRF_GRA }, // 6 - { "hh_20.rom", 0x20000, 0xbb0d6ad4, 0x02 | BRF_GRA }, // 7 - { "hh_30.rom", 0x20000, 0x4351044e, 0x02 | BRF_GRA }, // 8 - - { "hh_a0.rom", 0x20000, 0xc577ba5f, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "hh_a1.rom", 0x20000, 0x429d12ab, 0x03 | BRF_GRA }, // 10 - { "hh_a2.rom", 0x20000, 0xb5b163b0, 0x03 | BRF_GRA }, // 11 - { "hh_a3.rom", 0x20000, 0x8ef566a1, 0x03 | BRF_GRA }, // 12 - - { "gen-vo.bin", 0x20000, 0xd8595c66, 0x05 | BRF_SND }, // 13 DAC Samples -}; - -STD_ROM_PICK(dkgensan) -STD_ROM_FN(dkgensan) - -struct BurnDriver BurnDrvDkgensan = { - "dkgensan", "hharry", NULL, NULL, "1990", - "Daiku no Gensan (Japan, M82)\0", NULL, "Irem", "M82", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT | GBF_PLATFORM, 0, - NULL, dkgensanRomInfo, dkgensanRomName, NULL, NULL, CommonInputInfo, HharryDIPInfo, - hharryuInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Daiku no Gensan (Japan, M72) - -static struct BurnRomInfo dkgensanm72RomDesc[] = { - { "ge72-h0.bin", 0x20000, 0xa0ad992c, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "ge72-l0.bin", 0x20000, 0x996396f0, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ge72-h3.bin", 0x10000, 0xd8b86005, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ge72-l3.bin", 0x10000, 0x23d303a5, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "hh_00.rom", 0x20000, 0xec5127ef, 0x02 | BRF_GRA }, // 4 Sprites - { "hh_10.rom", 0x20000, 0xdef65294, 0x02 | BRF_GRA }, // 5 - { "hh_20.rom", 0x20000, 0xbb0d6ad4, 0x02 | BRF_GRA }, // 6 - { "hh_30.rom", 0x20000, 0x4351044e, 0x02 | BRF_GRA }, // 7 - - { "ge72b-a0.bin", 0x10000, 0xf5f56b2a, 0x03 | BRF_GRA }, // 8 Foreground Tiles - { "ge72-a1.bin", 0x10000, 0xd194ea08, 0x03 | BRF_GRA }, // 9 - { "ge72-a2.bin", 0x10000, 0x2b06bcc3, 0x03 | BRF_GRA }, // 10 - { "ge72-a3.bin", 0x10000, 0x94b96bfa, 0x03 | BRF_GRA }, // 11 - - { "ge72-b0.bin", 0x10000, 0x208796b3, 0x04 | BRF_GRA }, // 12 Background Tiles - { "ge72-b1.bin", 0x10000, 0xb4a7f490, 0x04 | BRF_GRA }, // 13 - { "ge72b-b2.bin", 0x10000, 0x34fe8f7f, 0x04 | BRF_GRA }, // 14 - { "ge72b-b3.bin", 0x10000, 0x4b0e92f4, 0x04 | BRF_GRA }, // 15 - - { "gen-vo.bin", 0x20000, 0xd8595c66, 0x05 | BRF_SND }, // 16 DAC Samples - - { "dkgenm72_i8751.mcu", 0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 17 i8751 Code -}; - -STD_ROM_PICK(dkgensanm72) -STD_ROM_FN(dkgensanm72) - -static INT32 dkgensanm72Init() -{ - install_protection(dkgenm72); - - return DrvInit(common_080000_0a0000, sound_ram_map, dbreedm72RomLoadCallback, 0x20, Z80_FAKE_NMI, 0); -} - -struct BurnDriver BurnDrvDkgensanm72 = { - "dkgensanm72", "hharry", NULL, NULL, "1990", - "Daiku no Gensan (Japan, M72)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT | GBF_PLATFORM, 0, - NULL, dkgensanm72RomInfo, dkgensanm72RomName, NULL, NULL, CommonInputInfo, HharryDIPInfo, - dkgensanm72Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Ken-Go - -static struct BurnRomInfo kengoRomDesc[] = { - { "ken_d-h0.rom", 0x20000, 0xf4ddeea5, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "ken_d-l0.rom", 0x20000, 0x04dc0f81, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "ken_d-sp.rom", 0x10000, 0x233ca1cf, 0x06 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "ken_m31.rom", 0x20000, 0xe00b95a6, 0x02 | BRF_GRA }, // 3 Sprites - { "ken_m21.rom", 0x20000, 0xd7722f87, 0x02 | BRF_GRA }, // 4 - { "ken_m32.rom", 0x20000, 0x30a844c4, 0x02 | BRF_GRA }, // 5 - { "ken_m22.rom", 0x20000, 0xa00dac85, 0x02 | BRF_GRA }, // 6 - - { "ken_m51.rom", 0x20000, 0x1646cf4f, 0x03 | BRF_GRA }, // 7 Foreground & Background Tiles - { "ken_m57.rom", 0x20000, 0xa9f88d90, 0x03 | BRF_GRA }, // 8 - { "ken_m66.rom", 0x20000, 0xe9d17645, 0x03 | BRF_GRA }, // 9 - { "ken_m64.rom", 0x20000, 0xdf46709b, 0x03 | BRF_GRA }, // 10 - - { "ken_m14.rom", 0x20000, 0x6651e9b7, 0x05 | BRF_SND }, // 11 DAC Samples -}; - -STD_ROM_PICK(kengo) -STD_ROM_FN(kengo) - -static INT32 kengoInit() -{ - INT32 nRet = DrvInit(hharryu_main_cpu_map, sound_rom_map, NULL, 0x60, Z80_REAL_NMI, 1); - - if (nRet == 0) { - VezOpen(0); - VezSetDecode((UINT8*)gunforce_decryption_table); - VezClose(); - } - - return nRet; -} - -struct BurnDriverD BurnDrvKengo = { - "kengo", NULL, NULL, NULL, "1991", - "Ken-Go\0", NULL, "Irem", "M84?", - NULL, NULL, NULL, NULL, - 0, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, - NULL, kengoRomInfo, kengoRomName, NULL, NULL, CommonInputInfo, KengoDIPInfo, - kengoInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Cosmic Cop (World) - -static struct BurnRomInfo cosmccopRomDesc[] = { - { "cc-d-h0b.bin", 0x40000, 0x38958b01, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "cc-d-l0b.bin", 0x40000, 0xeff87f70, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "cc-d-sp.bin", 0x10000, 0x3e3ace60, 0x06 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "cc-c-00.bin", 0x20000, 0x9d99deaa, 0x02 | BRF_GRA }, // 3 Sprites - { "cc-c-10.bin", 0x20000, 0x7eb083ed, 0x02 | BRF_GRA }, // 4 - { "cc-c-20.bin", 0x20000, 0x9421489e, 0x02 | BRF_GRA }, // 5 - { "cc-c-30.bin", 0x20000, 0x920ec735, 0x02 | BRF_GRA }, // 6 - - { "cc-d-g00.bin", 0x20000, 0xe7f3d772, 0x03 | BRF_GRA }, // 7 Foreground & Background Tiles - { "cc-d-g10.bin", 0x20000, 0x418b4e4c, 0x03 | BRF_GRA }, // 8 - { "cc-d-g20.bin", 0x20000, 0xa4b558eb, 0x03 | BRF_GRA }, // 9 - { "cc-d-g30.bin", 0x20000, 0xf64a3166, 0x03 | BRF_GRA }, // 10 - - { "cc-c-v0.bin", 0x20000, 0x6247bade, 0x05 | BRF_SND }, // 11 DAC Samples -}; - -STD_ROM_PICK(cosmccop) -STD_ROM_FN(cosmccop) - -static INT32 cosmccopInit() -{ - return DrvInit(hharryu_main_cpu_map, sound_rom_map, NULL, 0x60, Z80_REAL_NMI, 1); -} - -struct BurnDriver BurnDrvCosmccop = { - "cosmccop", NULL, NULL, NULL, "1991", - "Cosmic Cop (World)\0", NULL, "Irem", "M84", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, cosmccopRomInfo, cosmccopRomName, NULL, NULL, CommonInputInfo, GallopDIPInfo, - cosmccopInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Gallop - Armed police Unit (Japan) - -static struct BurnRomInfo gallopRomDesc[] = { - { "cc-c-h0.bin", 0x20000, 0x2217dcd0, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "cc-c-l0.bin", 0x20000, 0xff39d7fb, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "cc-c-h3.bin", 0x20000, 0x9b2bbab9, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "cc-c-l3.bin", 0x20000, 0xacd3278e, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "cc-c-00.bin", 0x20000, 0x9d99deaa, 0x02 | BRF_GRA }, // 4 Sprites - { "cc-c-10.bin", 0x20000, 0x7eb083ed, 0x02 | BRF_GRA }, // 5 - { "cc-c-20.bin", 0x20000, 0x9421489e, 0x02 | BRF_GRA }, // 6 - { "cc-c-30.bin", 0x20000, 0x920ec735, 0x02 | BRF_GRA }, // 7 - - { "cc-b-a0.bin", 0x10000, 0xa33472bd, 0x03 | BRF_GRA }, // 8 Foreground Tiles - { "cc-b-a1.bin", 0x10000, 0x118b1f2d, 0x03 | BRF_GRA }, // 9 - { "cc-b-a2.bin", 0x10000, 0x83cebf48, 0x03 | BRF_GRA }, // 10 - { "cc-b-a3.bin", 0x10000, 0x572903fc, 0x03 | BRF_GRA }, // 11 - - { "cc-b-b0.bin", 0x10000, 0x0df5b439, 0x04 | BRF_GRA }, // 12 Background Tiles - { "cc-b-b1.bin", 0x10000, 0x010b778f, 0x04 | BRF_GRA }, // 13 - { "cc-b-b2.bin", 0x10000, 0xbda9f6fb, 0x04 | BRF_GRA }, // 14 - { "cc-b-b3.bin", 0x10000, 0xd361ba3f, 0x04 | BRF_GRA }, // 15 - - { "cc-c-v0.bin", 0x20000, 0x6247bade, 0x05 | BRF_SND }, // 16 DAC Samples -}; - -STD_ROM_PICK(gallop) -STD_ROM_FN(gallop) - -static INT32 gallopInit() -{ - protection_sample_offsets = gallop_sample_offsets; - - return DrvInit(common_080000_0a0000, sound_ram_map, NULL, 0x80, Z80_FAKE_NMI, 0); -} - -struct BurnDriver BurnDrvGallop = { - "gallop", "cosmccop", NULL, NULL, "1991", - "Gallop - Armed police Unit (Japan)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, - NULL, gallopRomInfo, gallopRomName, NULL, NULL, CommonInputInfo, GallopDIPInfo, - gallopInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - - -// Legend of Hero Tonma - -static struct BurnRomInfo lohtRomDesc[] = { - { "tom_c-h0.rom", 0x20000, 0xa63204b6, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "tom_c-l0.rom", 0x20000, 0xe788002f, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "tom_c-h3-", 0x20000, 0x714778b5, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "tom_c-l3-", 0x20000, 0x2f049b03, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "tom_m53.rom", 0x20000, 0x0b83265f, 0x02 | BRF_GRA }, // 4 Sprites - { "tom_m51.rom", 0x20000, 0x8ec5f6f3, 0x02 | BRF_GRA }, // 5 - { "tom_m49.rom", 0x20000, 0xa41d3bfd, 0x02 | BRF_GRA }, // 6 - { "tom_m47.rom", 0x20000, 0x9d81a25b, 0x02 | BRF_GRA }, // 7 - - { "tom_m21.rom", 0x10000, 0x3ca3e771, 0x03 | BRF_GRA }, // 8 Foreground Tiles - { "tom_m22.rom", 0x10000, 0x7a05ee2f, 0x03 | BRF_GRA }, // 9 - { "tom_m20.rom", 0x10000, 0x79aa2335, 0x03 | BRF_GRA }, // 10 - { "tom_m23.rom", 0x10000, 0x789e8b24, 0x03 | BRF_GRA }, // 11 - - { "tom_m26.rom", 0x10000, 0x44626bf6, 0x04 | BRF_GRA }, // 12 Background Tiles - { "tom_m27.rom", 0x10000, 0x464952cf, 0x04 | BRF_GRA }, // 13 - { "tom_m25.rom", 0x10000, 0x3db9b2c7, 0x04 | BRF_GRA }, // 14 - { "tom_m24.rom", 0x10000, 0xf01fe899, 0x04 | BRF_GRA }, // 15 - - { "tom_m44.rom", 0x10000, 0x3ed51d1f, 0x05 | BRF_SND }, // 16 DAC Samples - - { "loht_i8751.mcu", 0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 17 i8751 Code -}; - -STD_ROM_PICK(loht) -STD_ROM_FN(loht) - -static INT32 lohtInit() -{ - install_protection(loht); - - return DrvInit(common_080000_0a0000, sound_ram_map, NULL, 0x80, Z80_FAKE_NMI, 0); -} - -struct BurnDriver BurnDrvLoht = { - "loht", NULL, NULL, NULL, "1989", - "Legend of Hero Tonma\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, - NULL, lohtRomInfo, lohtRomName, NULL, NULL, CommonInputInfo, LohtDIPInfo, - lohtInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Legend of Hero Tonma (Japan) - -static struct BurnRomInfo lohtjRomDesc[] = { - { "tom_c-h0-", 0x20000, 0x2a752998, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "tom_c-l0-", 0x20000, 0xa224d928, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "tom_c-h3-", 0x20000, 0x714778b5, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "tom_c-l3-", 0x20000, 0x2f049b03, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "r200", 0x20000, 0x0b83265f, 0x02 | BRF_GRA }, // 4 Sprites - { "r210", 0x20000, 0x8ec5f6f3, 0x02 | BRF_GRA }, // 5 - { "r220", 0x20000, 0xa41d3bfd, 0x02 | BRF_GRA }, // 6 - { "r230", 0x20000, 0x9d81a25b, 0x02 | BRF_GRA }, // 7 - - { "r2a0.a0", 0x10000, 0x3ca3e771, 0x03 | BRF_GRA }, // 8 Foreground Tiles - { "r2a1.a1", 0x10000, 0x7a05ee2f, 0x03 | BRF_GRA }, // 9 - { "r2a2.a2", 0x10000, 0x79aa2335, 0x03 | BRF_GRA }, // 10 - { "r2a3.a3", 0x10000, 0x789e8b24, 0x03 | BRF_GRA }, // 11 - - { "078.b0", 0x10000, 0x44626bf6, 0x04 | BRF_GRA }, // 12 Background Tiles - { "079.b1", 0x10000, 0x464952cf, 0x04 | BRF_GRA }, // 13 - { "080.b2", 0x10000, 0x3db9b2c7, 0x04 | BRF_GRA }, // 14 - { "081.b3", 0x10000, 0xf01fe899, 0x04 | BRF_GRA }, // 15 - - { "082", 0x10000, 0x3ed51d1f, 0x05 | BRF_SND }, // 16 DAC Samples - - { "tom_c-pr.bin", 0x01000, 0x9fa9b496, 0x00 | BRF_OPT }, // 17 i8751 Code -}; - -STD_ROM_PICK(lohtj) -STD_ROM_FN(lohtj) - -struct BurnDriver BurnDrvLohtj = { - "lohtj", "loht", NULL, NULL, "1989", - "Legend of Hero Tonma (Japan)\0", NULL, "Irem", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, - NULL, lohtjRomInfo, lohtjRomName, NULL, NULL, CommonInputInfo, LohtDIPInfo, - lohtInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - -static INT32 lohtbRomLoadCallback() -{ - // Hack the program rom to work for now - UINT8 _0x400[216] = { - 0xFA, 0xB9, 0xFF, 0xFF, 0xE2, 0xFE, 0xB8, 0x17, 0x00, 0xE7, 0x40, 0xB8, 0x20, 0x00, 0xE7, 0x42, - 0xB8, 0x0F, 0x00, 0xE7, 0x42, 0xB8, 0x00, 0xA0, 0x8E, 0xD0, 0x8E, 0xD8, 0xBE, 0x00, 0x3F, 0xB0, - 0x00, 0x88, 0x04, 0x3A, 0x04, 0x75, 0x08, 0x46, 0xFE, 0xC0, 0x75, 0xF5, 0xE9, 0x18, 0x00, 0x33, - 0xF6, 0xE9, 0x03, 0x00, 0xBE, 0x40, 0x00, 0xB8, 0x00, 0xB0, 0x8E, 0xD8, 0xC7, 0x06, 0xFE, 0x0F, - 0x00, 0x00, 0xEA, 0x62, 0x11, 0x00, 0x00, 0xE5, 0x04, 0x0F, 0x19, 0xC0, 0x0F, 0x74, 0xE0, 0xBC, - 0x00, 0x40, 0x33, 0xDB, 0xB9, 0x00, 0x10, 0xB8, 0x00, 0xB0, 0x8E, 0xD8, 0x8A, 0xC3, 0x02, 0xC7, - 0x88, 0x07, 0x43, 0xE2, 0xF7, 0x33, 0xC9, 0xFE, 0xC9, 0x75, 0xFC, 0xFE, 0xCD, 0x75, 0xF8, 0x33, - 0xDB, 0xB9, 0x00, 0x10, 0x8A, 0xC3, 0x02, 0xC7, 0x34, 0xFF, 0x3A, 0x07, 0x75, 0xB6, 0x43, 0xE2, - 0xF3, 0x33, 0xDB, 0xB9, 0xFC, 0x0F, 0xFE, 0x07, 0x43, 0xE2, 0xFB, 0x90, 0x90, 0x90, 0x9A, 0x00, - 0x00, 0x00, 0xB0, 0x73, 0xF6, 0x90, 0x90, 0x90, 0xB8, 0x00, 0xB0, 0x8E, 0xC0, 0x33, 0xD2, 0x42, - 0x81, 0xE2, 0x01, 0x00, 0xBF, 0xB2, 0x04, 0xE8, 0x7B, 0x00, 0xE8, 0x3E, 0x00, 0xEB, 0xF0, 0x90, - 0x90, 0x90, 0x0B, 0x38, 0x29, 0x43, 0x4F, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x31, - 0x39, 0x38, 0x39, 0x20, 0x49, 0x52, 0x45, 0x4D, 0x20, 0x43, 0x4F, 0x52, 0x50, 0x4F, 0x52, 0x41, - 0x54, 0x49, 0x4F, 0x4E, 0x0B, 0x50, 0x2B, 0x41 - }; - - memcpy (DrvV30ROM + 0x00400, _0x400, 216); - - DrvV30ROM[0x3FC] = 0x88; - DrvV30ROM[0x3FD] = 0x05; - DrvV30ROM[0xB42] = 0x1E; - DrvV30ROM[0xB43] = 0x06; - DrvV30ROM[0xB44] = 0xB8; - DrvV30ROM[0x405B] = 0x05; - DrvV30ROM[0x4066] = 0x05; - DrvV30ROM[0x103DA] = 0xB0; - DrvV30ROM[0x103DD] = 0xFE; - DrvV30ROM[0x103DE] = 0x06; - DrvV30ROM[0x103DF] = 0xFE; - DrvV30ROM[0x103E0] = 0x0F; - DrvV30ROM[0x103E1] = 0xE5; - DrvV30ROM[0x103E2] = 0x02; - DrvV30ROM[0x103E3] = 0xA9; - DrvV30ROM[0x103E4] = 0x20; - DrvV30ROM[0x103E5] = 0x00; - DrvV30ROM[0x103E6] = 0x75; - DrvV30ROM[0x103E7] = 0x05; - DrvV30ROM[0x103E8] = 0xEA; - DrvV30ROM[0x103E9] = 0x2F; - DrvV30ROM[0x103EA] = 0x04; - DrvV30ROM[0x103EB] = 0x00; - DrvV30ROM[0x103EC] = 0x00; - DrvV30ROM[0x103ED] = 0xB8; - DrvV30ROM[0x10459] = 0xE7; - DrvV30ROM[0x1045A] = 0x04; - DrvV30ROM[0x1045B] = 0xE5; - DrvV30ROM[0x1045C] = 0x02; - DrvV30ROM[0x1045D] = 0x25; - DrvV30ROM[0x1045E] = 0x80; - DrvV30ROM[0x1045F] = 0x00; - DrvV30ROM[0x10460] = 0x74; - DrvV30ROM[0x10461] = 0xF9; - DrvV30ROM[0x10462] = 0x36; - DrvV30ROM[0x10463] = 0xA1; - DrvV30ROM[0x10464] = 0xB2; - DrvV30ROM[0x10465] = 0x23; - DrvV30ROM[0x10466] = 0xE7; - DrvV30ROM[0x10467] = 0x82; - DrvV30ROM[0x10468] = 0x36; - DrvV30ROM[0x10469] = 0xA1; - DrvV30ROM[0x1046A] = 0xB6; - DrvV30ROM[0x1046B] = 0x23; - DrvV30ROM[0x1046C] = 0xE7; - DrvV30ROM[0x104B4] = 0x32; - DrvV30ROM[0x104B5] = 0xE4; - DrvV30ROM[0x104B6] = 0x3C; - DrvV30ROM[0x104B7] = 0x7F; - DrvV30ROM[0x104B8] = 0x72; - DrvV30ROM[0x10577] = 0x47; - DrvV30ROM[0x10578] = 0xDC; - DrvV30ROM[0x10585] = 0x61; - DrvV30ROM[0x10586] = 0x07; - DrvV30ROM[0x10587] = 0x1F; - DrvV30ROM[0x10599] = 0x00; - DrvV30ROM[0x10793] = 0xE7; - DrvV30ROM[0x10794] = 0x02; - DrvV30ROM[0x1E1C0] = 0xBA; - DrvV30ROM[0x1EA29] = 0xE7; - DrvV30ROM[0x1EA2A] = 0x02; - - // invert graphics roms - for (INT32 i = 0; i < 0x80000; i++) { - DrvGfxROM1[i] ^= 0x0f; - DrvGfxROM2[i] ^= 0x0f; - } - - return 0; -} - -// Legend of Hero Tonma (bootleg, set 1) - -static struct BurnRomInfo lohtbRomDesc[] = { - { "lohtb03.b", 0x20000, 0x8b845a70, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "lohtb05.d", 0x20000, 0xe90f7623, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "lohtb02.a", 0x20000, 0x714778b5, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "lohtb04.c", 0x20000, 0x2f049b03, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "lohtb01.02", 0x10000, 0xe4bd8f03, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "lohtb14.11", 0x10000, 0xdf5ac5ee, 0x02 | BRF_GRA }, // 5 Sprites - { "lohtb18.15", 0x10000, 0xd7ecf849, 0x02 | BRF_GRA }, // 6 - { "lohtb15.12", 0x10000, 0x45220b01, 0x02 | BRF_GRA }, // 7 - { "lohtb19.16", 0x10000, 0x35d1a808, 0x02 | BRF_GRA }, // 8 - { "lohtb16.13", 0x10000, 0x25b85cfc, 0x02 | BRF_GRA }, // 9 - { "lohtb20.17", 0x10000, 0x464d8579, 0x02 | BRF_GRA }, // 10 - { "lohtb17.14", 0x10000, 0x763fa4ec, 0x02 | BRF_GRA }, // 11 - { "lohtb21.18", 0x10000, 0xa73568c7, 0x02 | BRF_GRA }, // 12 - - { "lohtb13.10", 0x10000, 0x359f17d4, 0x03 | BRF_GRA }, // 13 Foreground Tiles - { "lohtb11.08", 0x10000, 0x73391e8a, 0x03 | BRF_GRA }, // 14 - { "lohtb09.06", 0x10000, 0x7096d390, 0x03 | BRF_GRA }, // 15 - { "lohtb07.04", 0x10000, 0x71a27b81, 0x03 | BRF_GRA }, // 16 - - { "lohtb12.09", 0x10000, 0x4d5e9b53, 0x04 | BRF_GRA }, // 17 Background Tiles - { "lohtb10.07", 0x10000, 0x4f75a26a, 0x04 | BRF_GRA }, // 18 - { "lohtb08.05", 0x10000, 0x34854262, 0x04 | BRF_GRA }, // 19 - { "lohtb06.03", 0x10000, 0xf923183c, 0x04 | BRF_GRA }, // 20 -}; - -STD_ROM_PICK(lohtb) -STD_ROM_FN(lohtb) - -static INT32 lohtbInit() -{ - install_protection(loht); - - return DrvInit(common_080000_0a0000, sound_ram_map, lohtbRomLoadCallback, 0x80, Z80_FAKE_NMI, 0); -} - -struct BurnDriver BurnDrvLohtb = { - "lohtb", "loht", NULL, NULL, "1989", - "Legend of Hero Tonma (bootleg, set 1)\0", NULL, "bootleg", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, - NULL, lohtbRomInfo, lohtbRomName, NULL, NULL, CommonInputInfo, LohtDIPInfo, - lohtbInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Legend of Hero Tonma (bootleg, set 2) - -static struct BurnRomInfo lohtb2RomDesc[] = { - { "loht-a2.bin", 0x10000, 0xccc90e54, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "loht-a10.bin", 0x10000, 0x3aa06730, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "loht-a3.bin", 0x10000, 0xff8a98de, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "loht-a11.bin", 0x10000, 0xeab1d7bc, 0x01 | BRF_PRG | BRF_ESS }, // 3 - { "loht-a5.bin", 0x10000, 0x79e007ec, 0x01 | BRF_PRG | BRF_ESS }, // 4 - { "loht-a13.bin", 0x10000, 0xb951346e, 0x01 | BRF_PRG | BRF_ESS }, // 5 - { "loht-a4.bin", 0x10000, 0x254ea4d5, 0x01 | BRF_PRG | BRF_ESS }, // 6 - { "loht-a12.bin", 0x10000, 0xcfb0390d, 0x01 | BRF_PRG | BRF_ESS }, // 7 - - { "loht-a16.bin", 0x10000, 0xdf5ac5ee, 0x02 | BRF_GRA }, // 8 Sprites - { "loht-a17.bin", 0x10000, 0xd7ecf849, 0x02 | BRF_GRA }, // 9 - { "loht-a8.bin", 0x10000, 0x45220b01, 0x02 | BRF_GRA }, // 10 - { "loht-a9.bin", 0x10000, 0x4af9bb3c, 0x02 | BRF_GRA }, // 11 - { "loht-a14.bin", 0x10000, 0x25b85cfc, 0x02 | BRF_GRA }, // 12 - { "loht-a15.bin", 0x10000, 0x464d8579, 0x02 | BRF_GRA }, // 13 - { "loht-a6.bin", 0x10000, 0x763fa4ec, 0x02 | BRF_GRA }, // 14 - { "loht-a7.bin", 0x10000, 0xa73568c7, 0x02 | BRF_GRA }, // 15 - - { "loht-a19.bin", 0x10000, 0x3ca3e771, 0x03 | BRF_GRA }, // 16 Foreground Tiles - { "loht-a20.bin", 0x10000, 0x7a05ee2f, 0x03 | BRF_GRA }, // 17 - { "loht-a18.bin", 0x10000, 0x79aa2335, 0x03 | BRF_GRA }, // 18 - { "loht-a21.bin", 0x10000, 0x789e8b24, 0x03 | BRF_GRA }, // 19 - - { "loht-a24.bin", 0x10000, 0x44626bf6, 0x04 | BRF_GRA }, // 20 Background Tiles - { "loht-a25.bin", 0x10000, 0x464952cf, 0x04 | BRF_GRA }, // 21 - { "loht-a23.bin", 0x10000, 0x3db9b2c7, 0x04 | BRF_GRA }, // 22 - { "loht-a22.bin", 0x10000, 0xf01fe899, 0x04 | BRF_GRA }, // 23 - - { "loht-a1.bin", 0x10000, 0x3ed51d1f, 0x05 | BRF_SND }, // 24 DAC Samples - - { "loht-a26.bin", 0x02000, 0xac901e17, 0x00 | BRF_OPT }, // 25 i8751 Code -}; - -STD_ROM_PICK(lohtb2) -STD_ROM_FN(lohtb2) - -struct BurnDriver BurnDrvLohtb2 = { - "lohtb2", "loht", NULL, NULL, "1989", - "Legend of Hero Tonma (bootleg, set 2)\0", NULL, "bootleg", "M72", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, - NULL, lohtb2RomInfo, lohtb2RomName, NULL, NULL, CommonInputInfo, LohtDIPInfo, - lohtInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Pound for Pound (World) - -static struct BurnRomInfo poundforRomDesc[] = { - { "ppa-h0-b.9e", 0x20000, 0x50d4a2d8, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "ppa-l0-b.9d", 0x20000, 0xbd997942, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ppa-h1.9f", 0x20000, 0xf6c82f48, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ppa-l1.9c", 0x20000, 0x5b07b087, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ppa-sp.4j", 0x10000, 0x3f458a5b, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "ppb-n0.bin", 0x40000, 0x951a41f8, 0x02 | BRF_GRA }, // 5 Sprites - { "ppb-n1.bin", 0x40000, 0xc609b7f2, 0x02 | BRF_GRA }, // 6 - { "ppb-n2.bin", 0x40000, 0x318c0b5f, 0x02 | BRF_GRA }, // 7 - { "ppb-n3.bin", 0x40000, 0x93dc9490, 0x02 | BRF_GRA }, // 8 - - { "ppa-g00.bin", 0x20000, 0x8a88a174, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "ppa-g10.bin", 0x20000, 0xe48a66ac, 0x03 | BRF_GRA }, // 10 - { "ppa-g20.bin", 0x20000, 0x12b93e79, 0x03 | BRF_GRA }, // 11 - { "ppa-g30.bin", 0x20000, 0xfaa39aee, 0x03 | BRF_GRA }, // 12 - - { "ppa-v0.bin", 0x40000, 0x03321664, 0x05 | BRF_SND }, // 13 DAC Samples -}; - -STD_ROM_PICK(poundfor) -STD_ROM_FN(poundfor) - -static INT32 poundforInit() -{ - return DrvInit(rtype2_main_cpu_map, sound_rom_map, NULL, 0x80, Z80_FAKE_NMI, 4); -} - -struct BurnDriverD BurnDrvPoundfor = { - "poundfor", NULL, NULL, NULL, "1990", - "Pound for Pound (World)\0", NULL, "Irem", "M85", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_SPORTSMISC, 0, - NULL, poundforRomInfo, poundforRomName, NULL, NULL, PoundforInputInfo, PoundforDIPInfo, - poundforInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 256, 384, 3, 4 -}; - - -// Pound for Pound (Japan) - -static struct BurnRomInfo poundforjRomDesc[] = { - { "ppa-h0-.9e", 0x20000, 0xf0165e3b, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "ppa-l0-.9d", 0x20000, 0xf954f99f, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ppa-h1.9f", 0x20000, 0xf6c82f48, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ppa-l1.9c", 0x20000, 0x5b07b087, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ppa-sp.4j", 0x10000, 0x3f458a5b, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "ppb-n0.bin", 0x40000, 0x951a41f8, 0x02 | BRF_GRA }, // 5 Sprites - { "ppb-n1.bin", 0x40000, 0xc609b7f2, 0x02 | BRF_GRA }, // 6 - { "ppb-n2.bin", 0x40000, 0x318c0b5f, 0x02 | BRF_GRA }, // 7 - { "ppb-n3.bin", 0x40000, 0x93dc9490, 0x02 | BRF_GRA }, // 8 - - { "ppa-g00.bin", 0x20000, 0x8a88a174, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "ppa-g10.bin", 0x20000, 0xe48a66ac, 0x03 | BRF_GRA }, // 10 - { "ppa-g20.bin", 0x20000, 0x12b93e79, 0x03 | BRF_GRA }, // 11 - { "ppa-g30.bin", 0x20000, 0xfaa39aee, 0x03 | BRF_GRA }, // 12 - - { "ppa-v0.bin", 0x40000, 0x03321664, 0x05 | BRF_SND }, // 13 DAC Samples -}; - -STD_ROM_PICK(poundforj) -STD_ROM_FN(poundforj) - -struct BurnDriverD BurnDrvPoundforj = { - "poundforj", "poundfor", NULL, NULL, "1990", - "Pound for Pound (Japan)\0", NULL, "Irem", "M85", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_SPORTSMISC, 0, - NULL, poundforjRomInfo, poundforjRomName, NULL, NULL, PoundforInputInfo, PoundforDIPInfo, - poundforInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 256, 384, 3, 4 -}; - - -// Pound for Pound (US) - -static struct BurnRomInfo poundforuRomDesc[] = { - { "ppa-ho-a.9e", 0x20000, 0xff4c83a4, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "ppa-lo-a.9d", 0x20000, 0x3374ce8f, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ppa-h1.9f", 0x20000, 0xf6c82f48, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ppa-l1.9c", 0x20000, 0x5b07b087, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ppa-sp.4j", 0x10000, 0x3f458a5b, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "ppb-n0.bin", 0x40000, 0x951a41f8, 0x02 | BRF_GRA }, // 5 Sprites - { "ppb-n1.bin", 0x40000, 0xc609b7f2, 0x02 | BRF_GRA }, // 6 - { "ppb-n2.bin", 0x40000, 0x318c0b5f, 0x02 | BRF_GRA }, // 7 - { "ppb-n3.bin", 0x40000, 0x93dc9490, 0x02 | BRF_GRA }, // 8 - - { "ppa-g00.bin", 0x20000, 0x8a88a174, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "ppa-g10.bin", 0x20000, 0xe48a66ac, 0x03 | BRF_GRA }, // 10 - { "ppa-g20.bin", 0x20000, 0x12b93e79, 0x03 | BRF_GRA }, // 11 - { "ppa-g30.bin", 0x20000, 0xfaa39aee, 0x03 | BRF_GRA }, // 12 - - { "ppa-v0.bin", 0x40000, 0x03321664, 0x05 | BRF_SND }, // 13 DAC Samples -}; - -STD_ROM_PICK(poundforu) -STD_ROM_FN(poundforu) - -struct BurnDriverD BurnDrvPoundforu = { - "poundforu", "poundfor", NULL, NULL, "1990", - "Pound for Pound (US)\0", NULL, "Irem America", "M85", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_SPORTSMISC, 0, - NULL, poundforuRomInfo, poundforuRomName, NULL, NULL, PoundforInputInfo, PoundforDIPInfo, - poundforInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 256, 384, 3, 4 -}; - - -// Major Title (World) - -static struct BurnRomInfo majtitleRomDesc[] = { - { "mt_h0-a.bin", 0x20000, 0x36aadb67, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "mt_l0-a.bin", 0x20000, 0x2e1b6242, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "mt_h1-a.bin", 0x20000, 0xe1402a22, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "mt_l1-a.bin", 0x20000, 0x0efa409a, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "mt_sp.bin", 0x10000, 0xe44260a9, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "mt_n0.bin", 0x40000, 0x5618cddc, 0x02 | BRF_GRA }, // 5 Sprites - { "mt_n1.bin", 0x40000, 0x483b873b, 0x02 | BRF_GRA }, // 6 - { "mt_n2.bin", 0x40000, 0x4f5d665b, 0x02 | BRF_GRA }, // 7 - { "mt_n3.bin", 0x40000, 0x83571549, 0x02 | BRF_GRA }, // 8 - - { "mt_c0.bin", 0x20000, 0x780e7a02, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "mt_c1.bin", 0x20000, 0x45ad1381, 0x03 | BRF_GRA }, // 10 - { "mt_c2.bin", 0x20000, 0x5df5856d, 0x03 | BRF_GRA }, // 11 - { "mt_c3.bin", 0x20000, 0xf5316cc8, 0x03 | BRF_GRA }, // 12 - - { "mt_f0.bin", 0x20000, 0x2d5e05d5, 0x0e | BRF_GRA }, // 13 Sprites - { "mt_f1.bin", 0x20000, 0xc68cd65f, 0x0e | BRF_GRA }, // 14 - { "mt_f2.bin", 0x20000, 0xa71feb2d, 0x0e | BRF_GRA }, // 15 - { "mt_f3.bin", 0x20000, 0x179f7562, 0x0e | BRF_GRA }, // 16 - - { "mt_vo.bin", 0x20000, 0xeb24bb2c, 0x05 | BRF_SND }, // 17 DAC Samples -}; - -STD_ROM_PICK(majtitle) -STD_ROM_FN(majtitle) - -static INT32 majtitleInit() -{ - return DrvInit(majtitle_main_cpu_map, sound_rom_map, NULL, 0x80, Z80_REAL_NMI, 3); -} - -struct BurnDriver BurnDrvMajtitle = { - "majtitle", NULL, NULL, NULL, "1990", - "Major Title (World)\0", NULL, "Irem", "M84", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_SPORTSMISC, 0, - NULL, majtitleRomInfo, majtitleRomName, NULL, NULL, CommonInputInfo, Rtype2DIPInfo, - majtitleInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; - - -// Major Title (Japan) - -static struct BurnRomInfo majtitlejRomDesc[] = { - { "mt_h0.bin", 0x20000, 0xb9682c70, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "mt_l0.bin", 0x20000, 0x702c9fd6, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "mt_h1.bin", 0x20000, 0xd9e97c30, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "mt_l1.bin", 0x20000, 0x8dbd91b5, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "mt_sp.bin", 0x10000, 0xe44260a9, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "mt_n0.bin", 0x40000, 0x5618cddc, 0x02 | BRF_GRA }, // 5 Sprites - { "mt_n1.bin", 0x40000, 0x483b873b, 0x02 | BRF_GRA }, // 6 - { "mt_n2.bin", 0x40000, 0x4f5d665b, 0x02 | BRF_GRA }, // 7 - { "mt_n3.bin", 0x40000, 0x83571549, 0x02 | BRF_GRA }, // 8 - - { "mt_c0.bin", 0x20000, 0x780e7a02, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles - { "mt_c1.bin", 0x20000, 0x45ad1381, 0x03 | BRF_GRA }, // 10 - { "mt_c2.bin", 0x20000, 0x5df5856d, 0x03 | BRF_GRA }, // 11 - { "mt_c3.bin", 0x20000, 0xf5316cc8, 0x03 | BRF_GRA }, // 12 - - { "mt_f0.bin", 0x20000, 0x2d5e05d5, 0x0e | BRF_GRA }, // 13 Sprites - { "mt_f1.bin", 0x20000, 0xc68cd65f, 0x0e | BRF_GRA }, // 14 - { "mt_f2.bin", 0x20000, 0xa71feb2d, 0x0e | BRF_GRA }, // 15 - { "mt_f3.bin", 0x20000, 0x179f7562, 0x0e | BRF_GRA }, // 16 - - { "mt_vo.bin", 0x20000, 0xeb24bb2c, 0x05 | BRF_SND }, // 17 DAC Samples -}; - -STD_ROM_PICK(majtitlej) -STD_ROM_FN(majtitlej) - -struct BurnDriver BurnDrvMajtitlej = { - "majtitlej", "majtitle", NULL, NULL, "1990", - "Major Title (Japan)\0", NULL, "Irem", "M84", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SPORTSMISC, 0, - NULL, majtitlejRomInfo, majtitlejRomName, NULL, NULL, CommonInputInfo, Rtype2DIPInfo, - majtitleInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 256, 4, 3 -}; +// FB Alpha Irem M72 driver module +// Based on MAME driver by Nicola Salmoria and Nao + +/* + to do: + clean + fix/improve sound + poundfor inputs +*/ + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "nec_intf.h" +#include "irem_cpu.h" +#include "dac.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvV30ROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvSndROM; +static UINT8 *DrvVidRAM0; +static UINT8 *DrvVidRAM1; +static UINT8 *DrvV30RAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf; +static UINT8 *DrvPalRAM; +static UINT8 *DrvProtRAM; +static UINT8 *DrvRowScroll; +static UINT8 *DrvSprRAM2; + +static UINT8 *scroll; + +static UINT8 *RamPrioBitmap; + +static UINT8 *soundlatch; +static UINT8 *video_enable; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; +static INT32 ym2151_previous = 0; +static UINT8 irqvector; +static INT32 sample_address; +static INT32 irq_raster_position; +static INT32 z80_reset = 0; +static INT32 majtitle_rowscroll_enable = 0; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[5]; +static UINT8 DrvReset; + +const static INT32 nInterleave = 284; +static INT32 nCurrentCycles; +static INT32 nCyclesDone[2]; +static INT32 nCyclesTotal[2]; + +static INT32 m72_video_type = 0; +static INT32 z80_nmi_enable = 0; +static INT32 enable_z80_reset = 0; // only if z80 is not rom-based! +static INT32 m72_irq_base = 0x80; +static INT32 code_mask[4]; +static INT32 graphics_length[4]; +static INT32 video_offsets[2] = { 0, 0 }; + +enum { Z80_NO_NMI=0, Z80_REAL_NMI, Z80_FAKE_NMI }; +enum { VECTOR_INIT, YM2151_ASSERT, YM2151_CLEAR, Z80_ASSERT, Z80_CLEAR }; + + +static struct BurnInputInfo CommonInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 4" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 4" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Common) + +static struct BurnInputInfo PoundforInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 2, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 0, "p1 start"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + + // save space for analog inputs + {"P2 Button 3", BIT_DIGITAL, DrvJoy5 + 6, "p2 fire 3"}, + {"P2 Button 4", BIT_DIGITAL, DrvJoy5 + 6, "p2 fire 4"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 3, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 1, "p2 start"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy4 + 6, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p2 fire 2"}, + + // save space for analog inputs... + {"P2 Button 5", BIT_DIGITAL, DrvJoy5 + 6, "p2 fire 5"}, + {"P2 Button 6", BIT_DIGITAL, DrvJoy5 + 6, "p2 fire 6"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service", BIT_DIGITAL, DrvJoy2 + 4, "service"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(Poundfor) + +static struct BurnDIPInfo Dip2CoinDIPList[]= +{ + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x40, 0x40, "Off" }, + {0x16, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x17, 0x01, 0x01, 0x01, "Off" }, + {0x17, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x17, 0x01, 0x08, 0x08, "Mode 1" }, + {0x17, 0x01, 0x08, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x17, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x17, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x17, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x17, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x17, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x17, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Cont." }, + {0x17, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x17, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x17, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x17, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x17, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x17, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x17, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x17, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x17, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x17, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +static struct BurnDIPInfo Dip1CoinDIPList[]= +{ + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x16, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, + {0x16, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, + {0x16, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x16, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x16, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x16, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x16, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x16, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x16, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x16, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x16, 0x01, 0xf0, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x17, 0x01, 0x01, 0x01, "Off" }, + {0x17, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x17, 0x01, 0x04, 0x04, "Mode 1" }, + {0x17, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2, "Stop Mode" }, + {0x17, 0x01, 0x20, 0x20, "Off" }, + {0x17, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x17, 0x01, 0x80, 0x80, "Off" }, + {0x17, 0x01, 0x80, 0x00, "On" }, +}; + +static struct BurnDIPInfo RtypeDIPList[]= +{ + {0x16, 0xff, 0xff, 0xfb, NULL }, + {0x17, 0xff, 0xff, 0xfd, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x16, 0x01, 0x08, 0x00, "50K 150K 250K 400K 600K" }, + {0x16, 0x01, 0x08, 0x08, "100K 200K 350K 500K 700K" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x17, 0x01, 0x02, 0x00, "Upright" }, + {0x17, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x17, 0x01, 0x08, 0x08, "Normal" }, + {0x17, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x17, 0x01, 0x10, 0x00, "No" }, + {0x17, 0x01, 0x10, 0x10, "Yes" }, + + {0 , 0xfe, 0 , 2, "Invulnerability" }, + {0x17, 0x01, 0x40, 0x40, "Off" }, + {0x17, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFOEXT(Rtype, Dip1Coin, Rtype ) + +static struct BurnDIPInfo RtypepDIPList[]= +{ + {0x16, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x04, 0x04, "On" }, + {0x16, 0x01, 0x04, 0x00, "Off" }, +}; + +STDDIPINFOEXT(Rtypep, Rtype, Rtypep ) + +static struct BurnDIPInfo XmultiplDIPList[]= +{ + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xfd, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Very Easy" }, + {0x16, 0x01, 0x03, 0x01, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Normal" }, + {0x16, 0x01, 0x03, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x0c, 0x08, "1" }, + {0x16, 0x01, 0x0c, 0x04, "2" }, + {0x16, 0x01, 0x0c, 0x0c, "3" }, + {0x16, 0x01, 0x0c, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Cabinet" }, + {0x17, 0x01, 0x02, 0x00, "Upright (single)" }, + {0x17, 0x01, 0x02, 0x02, "Cocktail" }, + {0x17, 0x01, 0x02, 0x00, "Upright (double) On" }, + {0x17, 0x01, 0x02, 0x02, "Upright (double) Off" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x17, 0x01, 0x08, 0x00, "Off" }, + {0x17, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Upright (double) Mode" }, + {0x17, 0x01, 0x10, 0x10, "Off" }, + {0x17, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x17, 0x01, 0x20, 0x00, "No" }, + {0x17, 0x01, 0x20, 0x20, "Yes" }, +}; + +STDDIPINFOEXT(Xmultipl, Dip1Coin, Xmultipl ) + +static struct BurnDIPInfo DbreedDIPList[]= +{ + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xf5, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x0c, 0x00, "Very Easy" }, + {0x16, 0x01, 0x0c, 0x08, "Easy" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Hard" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x17, 0x01, 0x02, 0x00, "Upright" }, + {0x17, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x17, 0x01, 0x08, 0x08, "Off" }, + {0x17, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x17, 0x01, 0x10, 0x00, "No" }, + {0x17, 0x01, 0x10, 0x10, "Yes" }, +}; + +STDDIPINFOEXT(Dbreed, Dip1Coin, Dbreed ) + +static struct BurnDIPInfo BchopperDIPList[]= +{ + {0x16, 0xff, 0xff, 0xfb, NULL }, + {0x17, 0xff, 0xff, 0xfd, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x00, "1" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x16, 0x01, 0x08, 0x08, "80K 200K 350K" }, + {0x16, 0x01, 0x08, 0x00, "100K 250K 400K" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x17, 0x01, 0x02, 0x00, "Upright" }, + {0x17, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x17, 0x01, 0x08, 0x08, "Normal" }, + {0x17, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x17, 0x01, 0x10, 0x00, "No" }, + {0x17, 0x01, 0x10, 0x10, "Yes" }, + + {0 , 0xfe, 0 , 2, "Invulnerability" }, + {0x17, 0x01, 0x40, 0x40, "Off" }, + {0x17, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFOEXT(Bchopper, Dip1Coin, Bchopper ) + +static struct BurnDIPInfo NspiritDIPList[]= +{ + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xf5, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x0c, 0x08, "Easy" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Hard" }, + {0x16, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x17, 0x01, 0x02, 0x00, "Upright" }, + {0x17, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x17, 0x01, 0x08, 0x08, "Off" }, + {0x17, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x17, 0x01, 0x10, 0x00, "No" }, + {0x17, 0x01, 0x10, 0x10, "Yes" }, + + {0 , 0xfe, 0 , 2, "Invulnerability" }, + {0x17, 0x01, 0x40, 0x40, "Off" }, + {0x17, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFOEXT(Nspirit, Dip1Coin, Nspirit ) + +static struct BurnDIPInfo ImgfightDIPList[]= +{ + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xe5, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x08, "Hard" }, + {0x16, 0x01, 0x0c, 0x04, "Hardest" }, + {0x16, 0x01, 0x0c, 0x00, "Debug Mode 2 lap" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x17, 0x01, 0x02, 0x00, "Upright" }, + {0x17, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x17, 0x01, 0x08, 0x08, "Off" }, + {0x17, 0x01, 0x08, 0x00, "On" }, +}; + +STDDIPINFOEXT(Imgfight, Dip1Coin, Imgfight ) + +static struct BurnDIPInfo Rtype2DIPList[]= +{ + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xf7, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x0c, 0x08, "Easy" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Hard" }, + {0x16, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x17, 0x01, 0x02, 0x00, "Off" }, + {0x17, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 3, "Cabinet" }, + {0x17, 0x01, 0x18, 0x10, "Upright" }, + {0x17, 0x01, 0x18, 0x00, "Upright (2P)" }, + {0x17, 0x01, 0x18, 0x18, "Cocktail" }, +}; + +STDDIPINFOEXT(Rtype2, Dip1Coin, Rtype2 ) + +static struct BurnDIPInfo LohtDIPList[]= +{ + {0x16, 0xff, 0xff, 0xfb, NULL }, + {0x17, 0xff, 0xff, 0xfd, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x00, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x02, "4" }, + {0x16, 0x01, 0x03, 0x01, "5" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x17, 0x01, 0x02, 0x00, "Upright" }, + {0x17, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x17, 0x01, 0x18, 0x00, "Easy" }, + {0x17, 0x01, 0x18, 0x18, "Normal" }, + {0x17, 0x01, 0x18, 0x10, "Hard" }, + {0x17, 0x01, 0x18, 0x08, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Invulnerability" }, + {0x17, 0x01, 0x40, 0x40, "Off" }, + {0x17, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFOEXT(Loht, Dip1Coin, Loht ) + +static struct BurnDIPInfo AirduelDIPList[]= +{ + {0x16, 0xff, 0xff, 0xbf, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x0c, 0x00, "Very Easy" }, + {0x16, 0x01, 0x0c, 0x08, "Easy" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Hard" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x17, 0x01, 0x01, 0x01, "Off" }, + {0x17, 0x01, 0x01, 0x00, "On" }, +}; + +STDDIPINFOEXT(Airduel, Dip2Coin, Airduel ) + +static struct BurnDIPInfo GallopDIPList[]= +{ + {0x16, 0xff, 0xff, 0xbf, NULL }, + {0x17, 0xff, 0xff, 0xf9, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x0c, 0x00, "Very Easy" }, + {0x16, 0x01, 0x0c, 0x08, "Easy" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Hard" }, + + {0 , 0xfe, 0 , 0, "Allow Continue" }, + {0x16, 0x01, 0x20, 0x00, "No" }, + {0x16, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x17, 0x01, 0x01, 0x01, "Off" }, + {0x17, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x17, 0x01, 0x06, 0x00, "Upright" }, + {0x17, 0x01, 0x06, 0x02, "Upright (2P)" }, + {0x17, 0x01, 0x06, 0x06, "Cocktail" }, +}; + +STDDIPINFOEXT(Gallop, Dip2Coin, Gallop ) + +static struct BurnDIPInfo KengoDIPList[]= +{ + {0x16, 0xff, 0xff, 0xbf, NULL }, + {0x17, 0xff, 0xff, 0xf9, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x0c, 0x00, "Very Easy" }, + {0x16, 0x01, 0x0c, 0x08, "Easy" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Hard" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x16, 0x01, 0x20, 0x00, "No" }, + {0x16, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x17, 0x01, 0x01, 0x01, "Off" }, + {0x17, 0x01, 0x01, 0x00, "On" }, +}; + +STDDIPINFOEXT(Kengo, Dip2Coin, Kengo ) + +static struct BurnDIPInfo HharryDIPList[]= +{ + {0x16, 0xff, 0xff, 0xbf, NULL }, + {0x17, 0xff, 0xff, 0xfd, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x0c, 0x00, "Very Easy" }, + {0x16, 0x01, 0x0c, 0x08, "Easy" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Hard" }, + + {0 , 0xfe, 0 , 2, "Continue Limit" }, + {0x16, 0x01, 0x10, 0x00, "No" }, + {0x16, 0x01, 0x10, 0x10, "Yes" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x16, 0x01, 0x20, 0x00, "No" }, + {0x16, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 3, "Cabinet" }, + {0x17, 0x01, 0x06, 0x04, "Upright" }, + {0x17, 0x01, 0x06, 0x00, "Upright (2P)" }, + {0x17, 0x01, 0x06, 0x06, "Cocktail" }, +}; + +STDDIPINFOEXT(Hharry, Dip2Coin, Hharry ) + +static struct BurnDIPInfo PoundforDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xbf, NULL }, + {0x0f, 0xff, 0xff, 0xfd, NULL }, + + {0 , 0xfe, 0 , 4, "Round Time" }, + {0x0e, 0x01, 0x03, 0x02, "60" }, + {0x0e, 0x01, 0x03, 0x03, "90" }, + {0x0e, 0x01, 0x03, 0x01, "120" }, + {0x0e, 0x01, 0x03, 0x00, "150" }, + + {0 , 0xfe, 0 , 2, "Matches/Credit (2P)" }, + {0x0e, 0x01, 0x04, 0x04, "1" }, + {0x0e, 0x01, 0x04, 0x00, "2" }, + + {0 , 0xfe, 0 , 2, "Rounds/Match" }, + {0x0e, 0x01, 0x08, 0x08, "2" }, + {0x0e, 0x01, 0x08, 0x00, "3" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x0e, 0x01, 0x10, 0x10, "Normal" }, + {0x0e, 0x01, 0x10, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2, "Trackball Size" }, + {0x0e, 0x01, 0x20, 0x20, "Small" }, + {0x0e, 0x01, 0x20, 0x00, "Large" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0e, 0x01, 0x40, 0x40, "Off" }, + {0x0e, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0e, 0x01, 0x80, 0x80, "Off" }, + {0x0e, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x0f, 0x01, 0x01, 0x01, "Off" }, + {0x0f, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 3, "Cabinet" }, + {0x0f, 0x01, 0x06, 0x04, "Upright" }, + {0x0f, 0x01, 0x06, 0x02, "Upright (2P)" }, + {0x0f, 0x01, 0x06, 0x06, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x0f, 0x01, 0x08, 0x08, "Mode 1" }, + {0x0f, 0x01, 0x08, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x0f, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x0f, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x0f, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x0f, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x0f, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x0f, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x0f, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x0f, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x0f, 0x01, 0xf0, 0x10, "1 Coin/1 Credit, 1 Coin/Cont."}, + {0x0f, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x0f, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x0f, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x0f, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x0f, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x0f, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x0f, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Poundfor) + +//-------------------------------------------------------------------------------------------------------------------------------------------------- +// Protection handlers + +static const UINT8 *protection_code = NULL; +static const UINT8 *protection_crc = NULL; +static const INT32 *protection_sample_offsets = NULL; + +static UINT8 protection_read(INT32 address) +{ + if (address == 0xb0ffb) { + if (protection_code != NULL) { + memcpy (DrvProtRAM, protection_code, 96); + } + } + + return DrvProtRAM[address & 0xfff]; +} + +static void protection_write(INT32 address, UINT8 data) +{ + DrvProtRAM[address & 0xfff] = data ^ 0xff; + + if (address == 0xb0fff && data == 0) { + if (protection_crc != NULL) { + memcpy (DrvProtRAM + 0xfe0, protection_crc, 18); + } + } +} + +static void protection_sample_offset_write(UINT8 data) +{ + if (protection_sample_offsets != NULL) { + if (data < protection_sample_offsets[0]) { + sample_address = protection_sample_offsets[data+1]; + } + } +} + +static void m72_install_protection(const UINT8 *code, const UINT8 *crc, const INT32 *offs) +{ + protection_code = code; + protection_crc = crc; + protection_sample_offsets = offs; +} + +#define install_protection(name) m72_install_protection(name##_code, name##_crc, name##_sample_offsets) + +/* Battle Chopper / Mr. Heli */ +static const INT32 bchopper_sample_offsets[7] = { 6, 0x0000, 0x0010, 0x2510, 0x6510, 0x8510, 0x9310 }; + +static const UINT8 bchopper_code[96] = +{ + 0x68,0x00,0xa0, // push 0a000h + 0x1f, // pop ds + 0xc6,0x06,0x38,0x38,0x53, // mov [3838h], byte 053h + 0xc6,0x06,0x3a,0x38,0x41, // mov [383ah], byte 041h + 0xc6,0x06,0x3c,0x38,0x4d, // mov [383ch], byte 04dh + 0xc6,0x06,0x3e,0x38,0x4f, // mov [383eh], byte 04fh + 0xc6,0x06,0x40,0x38,0x54, // mov [3840h], byte 054h + 0xc6,0x06,0x42,0x38,0x4f, // mov [3842h], byte 04fh + 0x68,0x00,0xb0, // push 0b000h + 0x1f, // pop ds + 0xc6,0x06,0x00,0x09,0x49^0xff, // mov [0900h], byte 049h + 0xc6,0x06,0x00,0x0a,0x49^0xff, // mov [0a00h], byte 049h + 0xc6,0x06,0x00,0x0b,0x49^0xff, // mov [0b00h], byte 049h + 0xc6,0x06,0x00,0x00,0xcb^0xff, // mov [0000h], byte 0cbh ; retf : bypass protection check during the game + 0x68,0x00,0xd0, // push 0d000h + 0x1f, // pop ds + // the following is for mrheli only, the game checks for + // "This game can only be played in Japan..." message in the video text buffer + // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu + 0xc6,0x06,0x70,0x16,0x77, // mov [1670h], byte 077h + 0xea,0x68,0x01,0x40,0x00 // jmp 0040:$0168 +}; + +static const UINT8 bchopper_crc[18] = { + 0x1a,0x12,0x5c,0x08,0x84,0xb6,0x73,0xd1,0x54,0x91,0x94,0xeb,0x00,0x00 +}; + +static const UINT8 mrheli_crc[18] = { + 0x24,0x21,0x1f,0x14,0xf9,0x28,0xfb,0x47,0x4c,0x77,0x9e,0xc2,0x00,0x00 +}; + +/* X Multiply */ +static const INT32 xmultiplm72_sample_offsets[4] = { 3, 0x0000, 0x0020, 0x1a40 }; + +static const UINT8 xmultiplm72_code[96] = { + 0xea,0x30,0x02,0x00,0x0e // jmp 0e00:$0230 +}; + +static const UINT8 xmultiplm72_crc[18] = { + 0x73,0x82,0x4e,0x3f, 0xfc,0x56,0x59,0x06,0x05,0x48,0xa8,0xf4,0x00,0x00 +}; + +/* Dragon Breed */ +static const INT32 dbreedm72_sample_offsets[10] = { 9, 0x00000, 0x00020, 0x02c40, 0x08160, 0x0c8c0, 0x0ffe0, 0x13000, 0x15820, 0x15f40 }; + +static const UINT8 dbreedm72_code[96] = { + 0xea,0x6c,0x00,0x00,0x00 // jmp 0000:$006c +}; + +static const UINT8 dbreedm72_crc[18] ={ + 0xa4,0x96,0x5f,0xc0, 0xab,0x49,0x9f,0x19,0x84,0xe6,0xd6,0xca,0x00,0x00 +}; + +/* Ninja Spirit */ +static const INT32 nspirit_sample_offsets[10] = { 9, 0x0000, 0x0020, 0x2020, 0, 0x5720, 0, 0x7b60, 0x9b60, 0xc360 }; + +static const UINT8 nspirit_code[96] = +{ + 0x68,0x00,0xa0, // push 0a000h + 0x1f, // pop ds + 0xc6,0x06,0x38,0x38,0x4e, // mov [3838h], byte 04eh + 0xc6,0x06,0x3a,0x38,0x49, // mov [383ah], byte 049h + 0xc6,0x06,0x3c,0x38,0x4e, // mov [383ch], byte 04eh + 0xc6,0x06,0x3e,0x38,0x44, // mov [383eh], byte 044h + 0xc6,0x06,0x40,0x38,0x4f, // mov [3840h], byte 04fh + 0xc6,0x06,0x42,0x38,0x55, // mov [3842h], byte 055h + 0x68,0x00,0xb0, // push 0b000h + 0x1f, // pop ds + 0xc6,0x06,0x00,0x09,0x49^0xff, // mov [0900h], byte 049h + 0xc6,0x06,0x00,0x0a,0x49^0xff, // mov [0a00h], byte 049h + 0xc6,0x06,0x00,0x0b,0x49^0xff, // mov [0b00h], byte 049h + 0x68,0x00,0xd0, // push 0d000h + 0x1f, // pop ds + // the following is for nspiritj only, the game checks for + // "This game can only be played in Japan..." message in the video text buffer + // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu + 0xc6,0x06,0x70,0x16,0x57, // mov [1670h], byte 057h + 0xc6,0x06,0x71,0x16,0x00, // mov [1671h], byte 000h + 0xea,0x00,0x00,0x40,0x00 // jmp 0040:$0000 +}; + +static const UINT8 nspirit_crc[18] = { + 0xfe,0x94,0x6e,0x4e, 0xc8,0x33,0xa7,0x2d,0xf2,0xa3,0xf9,0xe1, 0xa9,0x6c,0x02,0x95, 0x00,0x00 +}; + +static const UINT8 nspiritj_crc[18] = { + 0x26,0xa3,0xa5,0xe9, 0xc8,0x33,0xa7,0x2d,0xf2,0xa3,0xf9,0xe1, 0xbc,0x6c,0x01,0x95, 0x00,0x00 +}; + +/* Image Fight */ +static const INT32 imgfight_sample_offsets[8] = { 7, 0x0000, 0x0020, 0x44e0, 0x98a0, 0xc820, 0xf7a0, 0x108c0 }; + +static const UINT8 imgfight_code[96] = +{ + 0x68,0x00,0xa0, // push 0a000h + 0x1f, // pop ds + 0xc6,0x06,0x38,0x38,0x50, // mov [3838h], byte 050h + 0xc6,0x06,0x3a,0x38,0x49, // mov [383ah], byte 049h + 0xc6,0x06,0x3c,0x38,0x43, // mov [383ch], byte 043h + 0xc6,0x06,0x3e,0x38,0x4b, // mov [383eh], byte 04bh + 0xc6,0x06,0x40,0x38,0x45, // mov [3840h], byte 045h + 0xc6,0x06,0x42,0x38,0x54, // mov [3842h], byte 054h + 0x68,0x00,0xb0, // push 0b000h + 0x1f, // pop ds + 0xc6,0x06,0x00,0x09,0x49^0xff, // mov [0900h], byte 049h + 0xc6,0x06,0x00,0x0a,0x49^0xff, // mov [0a00h], byte 049h + 0xc6,0x06,0x00,0x0b,0x49^0xff, // mov [0b00h], byte 049h + 0xc6,0x06,0x20,0x09,0x49^0xff, // mov [0920h], byte 049h + 0xc6,0x06,0x21,0x09,0x4d^0xff, // mov [0921h], byte 04dh + 0xc6,0x06,0x22,0x09,0x41^0xff, // mov [0922h], byte 041h + 0xc6,0x06,0x23,0x09,0x47^0xff, // mov [0923h], byte 047h + 0x68,0x00,0xd0, // push 0d000h + 0x1f, // pop ds + // the game checks for + // "This game can only be played in Japan..." message in the video text buffer + // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu + 0xc6,0x06,0xb0,0x1c,0x57, // mov [1cb0h], byte 057h + 0xea,0x00,0x00,0x40,0x00 // jmp 0040:$0000 +}; + +static const UINT8 imgfight_crc[18] = { + 0x7e,0xcc,0xec,0x03, 0x04,0x33,0xb6,0xc5, 0xbf,0x37,0x92,0x94, 0x00,0x00 +}; + +/* Air Duel */ +static const INT32 airduel_sample_offsets[17] = { + 16, + 0x00000, 0x00020, 0x03ec0, 0x05640, 0x06dc0, 0x083a0, 0x0c000, 0x0eb60, + 0x112e0, 0x13dc0, 0x16520, 0x16d60, 0x18ae0, 0x1a5a0, 0x1bf00, 0x1c340 }; + +static const UINT8 airduel_code[96] = +{ + 0x68,0x00,0xd0, // push 0d000h + 0x1f, // pop ds + // the game checks for + // "This game can only be played in Japan..." message in the video text buffer + // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu + 0xc6,0x06,0xc0,0x1c,0x57, // mov [1cc0h], byte 057h + 0xea,0x69,0x0b,0x00,0x00 // jmp 0000:$0b69 +}; + +static const UINT8 airduel_crc[18] = { + 0x72,0x9c,0xca,0x85, 0xc9,0x12,0xcc,0xea, 0x00,0x00 +}; + +/* Daiku no Gensan */ +static const INT32 dkgenm72_sample_offsets[29] = { + 28, + 0x00000, 0x00020, 0x01800, 0x02da0, 0x03be0, 0x05ae0, 0x06100, 0x06de0, + 0x07260, 0x07a60, 0x08720, 0x0a5c0, 0x0c3c0, 0x0c7a0, 0x0e140, 0x0fb00, + 0x10fa0, 0x10fc0, 0x10fe0, 0x11f40, 0x12b20, 0x130a0, 0x13c60, 0x14740, + 0x153c0, 0x197e0, 0x1af40, 0x1c080 }; + +static const UINT8 dkgenm72_code[96] = { + 0xea,0x3d,0x00,0x00,0x10 // jmp 1000:$003d +}; + +static const UINT8 dkgenm72_crc[18] = { + 0xc8,0xb4,0xdc,0xf8, 0xd3,0xba,0x48,0xed,0x79,0x08,0x1c,0xb3, 0x00,0x00 +}; + +/* Legend of Hero Tonma */ +static const INT32 loht_sample_offsets[8] = { 7, 0x0000, 0x0020, 0, 0x2c40, 0x4320, 0x7120, 0xb200 }; + +static const UINT8 loht_code[96] = +{ + 0x68,0x00,0xa0, // push 0a000h + 0x1f, // pop ds + 0xc6,0x06,0x3c,0x38,0x47, // mov [383ch], byte 047h + 0xc6,0x06,0x3d,0x38,0x47, // mov [383dh], byte 047h + 0xc6,0x06,0x42,0x38,0x44, // mov [3842h], byte 044h + 0xc6,0x06,0x43,0x38,0x44, // mov [3843h], byte 044h + 0x68,0x00,0xb0, // push 0b000h + 0x1f, // pop ds + 0xc6,0x06,0x00,0x09,0x49^0xff, // mov [0900h], byte 049h + 0xc6,0x06,0x00,0x0a,0x49^0xff, // mov [0a00h], byte 049h + 0xc6,0x06,0x00,0x0b,0x49^0xff, // mov [0b00h], byte 049h + + 0x68,0x00,0xd0, // push 0d000h // Japan set only + 0x1f, // pop ds // Japan set only + 0xc6,0x06,0x70,0x16,0x57, // mov [1670h], byte 057h // Japan set only - checks this (W) of WARNING + + 0xea,0x5d,0x01,0x40,0x00 // jmp 0040:$015d +}; + +static const UINT8 loht_crc[18] = { + 0x39,0x00,0x82,0xae, 0x2c,0x9d,0x4b,0x73,0xfb,0xac,0xd4,0x6d, 0x6d,0x5b,0x77,0xc0, 0x00,0x00 +}; + +/* Gallop - Armed police Unit */ +static const INT32 gallop_sample_offsets[32] = { + 31, + 0x00000, 0x00020, 0x00040, 0x01360, 0x02580, 0x04f20, 0x06240, 0x076e0, + 0x08660, 0x092a0, 0x09ba0, 0x0a560, 0x0cee0, 0x0de20, 0x0e620, 0x0f1c0, + 0x10200, 0x10220, 0x10240, 0x11380, 0x12760, 0x12780, 0x127a0, 0x13c40, + 0x140a0, 0x16760, 0x17e40, 0x18ee0, 0x19f60, 0x1bbc0, 0x1cee0 }; + +//-------------------------------------------------------------------------------------------------------------------------------------------------- + + +static void setvector_callback(INT32 param) +{ + switch (param) + { + case VECTOR_INIT: irqvector = 0xff; break; + case YM2151_ASSERT: irqvector &= 0xef; break; + case YM2151_CLEAR: irqvector |= 0x10; break; + case Z80_ASSERT: irqvector &= 0xdf; break; + case Z80_CLEAR: irqvector |= 0x20; break; + } + + if (irqvector == 0xff) { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } else { + ZetSetVector(irqvector); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nCyclesDone[1] += ZetRun(1000); + } +} + +static void palette_write(INT32 offset, INT32 offset2) +{ + if (offset & 1) return; + + UINT16 *pal = (UINT16*)DrvPalRAM; + offset = (offset / 2) & 0x00ff; + + INT32 offset3 = offset; + if (offset2) { + offset3 |= 0x0100; + pal += 0x1000 / 2; + } + + INT32 r = BURN_ENDIAN_SWAP_INT16(pal[offset + 0x000]) & 0x1f; + INT32 g = BURN_ENDIAN_SWAP_INT16(pal[offset + 0x200]) & 0x1f; + INT32 b = BURN_ENDIAN_SWAP_INT16(pal[offset + 0x400]) & 0x1f; + + DrvPalette[offset3] = BurnHighCol((r << 3) | (r >> 2), (g << 3) | (g >> 2), (b << 3) | (b >> 2), 0); +} + +UINT8 __fastcall m72_main_read(UINT32 address) +{ + if ((address & 0xff000) == 0xb0000) { + return protection_read(address); + } + + return 0; +} + +void __fastcall m72_main_write(UINT32 address, UINT8 data) +{ + if ((address & 0xff000) == 0xb0000) { + protection_write(address, data); + return; + } + + if ((address & 0xff000) == 0xc8000) { + if (address & 1) data = 0xff; + DrvPalRAM[(address & 0xdff) | 0x0000] = DrvPalRAM[(address & 0xdff) | 0x0200] = data | 0xe0; + palette_write(address, 0); + return; + } + + if ((address & 0xff000) == 0xcc000) { + if (address & 1) data = 0xff; + DrvPalRAM[(address & 0xdff) | 0x1000] = DrvPalRAM[(address & 0xdff) | 0x1200] = data | 0xe0; + palette_write(address, 1); + return; + } +} + +void __fastcall rtype2_main_write(UINT32 address, UINT8 data) +{ + if ((address & 0xff000) == 0xc8000 || (address & 0xff000) == 0xa0000 || (address & 0xff000) == 0xcc000) { + if (address & 1) data = 0xff; + DrvPalRAM[(address & 0xdff) | 0x0000] = DrvPalRAM[(address & 0xdff) | 0x0200] = data | 0xe0; + palette_write(address, 0); + return; + } + + if ((address & 0xff000) == 0xd8000 || (address & 0xff000) == 0xa8000 || (address & 0xff000) == 0xa4000) { + if (address & 1) data = 0xff; + DrvPalRAM[(address & 0xdff) | 0x1000] = DrvPalRAM[(address & 0xdff) | 0x1200] = data | 0xe0; + palette_write(address, 1); + return; + } + + switch (address) + { + case 0xb0000: + case 0xe0000: // majtitle + irq_raster_position = (irq_raster_position & 0xff00) | (data << 0); + return; + + case 0xb0001: + case 0xe0001: // majtitle + irq_raster_position = (irq_raster_position & 0x00ff) | (data << 8); + return; + + case 0xbc000: + // case 0xbc001: + case 0xec000: // majtitle + // case 0xec001: + memcpy (DrvSprBuf, DrvSprRAM, 0x0400); + return; + } +} + +void __fastcall m72_main_write_port(UINT32 port, UINT8 data) +{ +// bprintf (0, _T("%2.2x, %2.2x wp\n"), port, data); + + switch (port) + { + case 0x00: + bprintf (0, _T("%2.2x, %2.2x mwp\n"), port, data); + // sync_cpus(); + *soundlatch = data; + setvector_callback(Z80_ASSERT); + return; + + case 0x01: + return; + + case 0x02: +// case 0x03: + { + // coin counter = data & 3 (&1 = 0, &2 = 1) + // flipscreen = ((data & 0x04) >> 2) ^ ((~input_port_read(space->machine, "DSW") >> 8) & 1); + + video_enable[0] = data & 0x08; + + // bprintf (0, _T("%x\n"), data & 0x10); + if (enable_z80_reset) { + if (data & 0x10) { + z80_reset = 0; + } else { + ZetReset(); + setvector_callback(VECTOR_INIT); + z80_reset = 1; + } + } + } + return; + + case 0x04: + case 0x05: + memcpy (DrvSprBuf, DrvSprRAM, 0x0400); + return; + + case 0x06: + irq_raster_position = (irq_raster_position & 0xff00) | (data << 0); + return; + + case 0x07: + irq_raster_position = (irq_raster_position & 0x00ff) | (data << 8); + return; + + case 0x40: + case 0x41: + case 0x42: + case 0x43: // nop + bprintf (0, _T("%2.2x, %2.2x\n"), port, data); + return; + + case 0x80: + case 0x81:// scrolly1 + case 0x82: + case 0x83:// scrollx1 + case 0x84: + case 0x85:// scrolly2 + case 0x86: + case 0x87:// scrollx2 + scroll[port & 0x07] = data; + return; + + // case 0x8e: + case 0x8f: + majtitle_rowscroll_enable = data ? 1 : 0; + return; + + case 0xc0: + protection_sample_offset_write(data); + return; + } +} + +static UINT16 __fastcall poundfor_trackball_r(INT32 offset) +{ + static INT32 prev[4],diff[4]; +// static const char *const axisnames[] = { "TRACK0_X", "TRACK0_Y", "TRACK1_X", "TRACK1_Y" }; + +#if 0 + if (offset == 0) + { + INT32 i,curr; + + for (i = 0;i < 4;i++) + { + curr = input_port_read(space->machine, axisnames[i]); + diff[i] = (curr - prev[i]); + prev[i] = curr; + } + } +#endif + prev[0] = 0; + diff[0] = diff[1] = diff[2] = diff[3] = ~0; + INT32 input = DrvInputs[0] | (DrvInputs[3] << 8); + + switch (offset) + { + default: + case 0: + return (diff[0] & 0xff) | ((diff[2] & 0xff) << 8); + case 1: + return ((diff[0] >> 8) & 0x1f) | (diff[2] & 0x1f00) | (~input & 0xe0e0); + case 2: + return (diff[1] & 0xff) | ((diff[3] & 0xff) << 8); + case 3: + return ((diff[1] >> 8) & 0x1f) | (diff[3] & 0x1f00); + } + + return 0; +} + +UINT8 __fastcall m72_main_read_port(UINT32 port) +{ + switch (port) + { + case 0x00: return DrvInputs[0]; + case 0x01: return DrvInputs[1]; + case 0x02: return DrvInputs[2]; + case 0x03: return 0xff; + case 0x04: return DrvDips[0]; + case 0x05: return DrvDips[1]; + } + + if ((port & 0xf8) == 0x08) { + INT32 ret = poundfor_trackball_r((port / 2) & 0x03); + if (port & 1) return ret >> 8; + else return ret; + } + + return 0; +} + +void __fastcall m72_sound_write_port(UINT16 port, UINT8 data) +{ +// bprintf (0, _T("%2.2x, %2.2x wp\n"), port & 0xff, data); + + switch (port & 0xff) + { + case 0x00: + case 0x40: // poundfor + BurnYM2151SelectRegister(data); + return; + + case 0x01: + case 0x41: // poundfor + BurnYM2151WriteRegister(data); + return; + + case 0x06: + case 0x42: // poundfor + case 0x83: // rtype2 + setvector_callback(Z80_CLEAR); + return; + + case 0x10: // poundfor + case 0x11: + sample_address >>= 4; + sample_address = (sample_address & 0xff00) | (data << 0); + sample_address <<= 4; + return; + + case 0x12: + case 0x13: // poundfor + sample_address >>= 4; + sample_address = (sample_address & 0x00ff) | (data << 8); + sample_address <<= 4; + return; + + case 0x80: // rtype2 + sample_address >>= 5; + sample_address = (sample_address & 0xff00) | (data << 0); + sample_address <<= 5; + return; + + case 0x81: // rtype2 + sample_address >>= 5; + sample_address = (sample_address & 0x00ff) | (data << 8); + sample_address <<= 5; + return; + + case 0x82: + DACSignedWrite(0, data); + sample_address = (sample_address + 1) & 0x3ffff; + return; + } +} + +UINT8 __fastcall m72_sound_read_port(UINT16 port) +{ +// if ((port & 0xff) != 0x84 && (port & 0xfe) != 0x00) bprintf (0, _T("%2.2x, rp\n"), port & 0xff); + + switch (port & 0xff) + { + case 0x00: + case 0x01: + case 0x40: // poundfor + case 0x41: // poundfor + return BurnYM2151ReadStatus(); + + case 0x80: // rtype2 + case 0x42: // poundfor + case 0x02: + return *soundlatch; + + case 0x84: + return DrvSndROM[sample_address & 0x3ffff]; + } + + return 0; +} + +static void m72YM2151IRQHandler(INT32 nStatus) +{ + setvector_callback(nStatus ? YM2151_ASSERT : YM2151_CLEAR); +} + +static INT32 m72SyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (3579545.000 / (nBurnFPS / 100.000)))); +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + VezOpen(0); + VezReset(); + VezClose(); + + ZetOpen(0); + ZetReset(); + setvector_callback(VECTOR_INIT); + if (enable_z80_reset) { + z80_reset = 1; + } + ZetClose(); + + BurnYM2151Reset(); + DACReset(); + + ym2151_previous = 0; + sample_address = 0; + irq_raster_position = -1; + + return 0; +} + +static void common_main_cpu_map(INT32 romaddr, INT32 ramaddr) +{ + VezInit(0, V30_TYPE); + + VezOpen(0); + VezMapArea(0x00000, (romaddr-1), 0, DrvV30ROM + 0x000000); + VezMapArea(0x00000, (romaddr-1), 2, DrvV30ROM + 0x000000); + VezMapArea(0x00000+ramaddr, 0x03fff+ramaddr, 0, DrvV30RAM); + VezMapArea(0x00000+ramaddr, 0x03fff+ramaddr, 1, DrvV30RAM); + VezMapArea(0x00000+ramaddr, 0x03fff+ramaddr, 2, DrvV30RAM); +// VezMapArea(0xb0000, 0xb0fff, 2, DrvProtRAM); + VezMapArea(0xc0000, 0xc0fff, 0, DrvSprRAM); + VezMapArea(0xc0000, 0xc0fff, 1, DrvSprRAM); + VezMapArea(0xc0000, 0xc0fff, 2, DrvSprRAM); + VezMapArea(0xc8000, 0xc8fff, 0, DrvPalRAM); +// VezMapArea(0xc8000, 0xc8fff, 1, DrvPalRAM); + VezMapArea(0xc8000, 0xc8fff, 2, DrvPalRAM); + VezMapArea(0xcc000, 0xccfff, 0, DrvPalRAM + 0x1000); +// VezMapArea(0xcc000, 0xccfff, 1, DrvPalRAM + 0x1000); + VezMapArea(0xcc000, 0xccfff, 2, DrvPalRAM + 0x1000); + VezMapArea(0xd0000, 0xd3fff, 0, DrvVidRAM0); + VezMapArea(0xd0000, 0xd3fff, 1, DrvVidRAM0); + VezMapArea(0xd0000, 0xd3fff, 2, DrvVidRAM0); + VezMapArea(0xd8000, 0xdbfff, 0, DrvVidRAM1); + VezMapArea(0xd8000, 0xdbfff, 1, DrvVidRAM1); + VezMapArea(0xd8000, 0xdbfff, 2, DrvVidRAM1); + VezMapArea(0xe0000, 0xeffff, 0, DrvZ80RAM); + VezMapArea(0xe0000, 0xeffff, 1, DrvZ80RAM); + VezMapArea(0xe0000, 0xeffff, 2, DrvZ80RAM); + VezMapArea(0xff800, 0xfffff, 0, DrvV30ROM + 0x0ff800); + VezMapArea(0xff800, 0xfffff, 2, DrvV30ROM + 0x0ff800); + VezSetReadHandler(m72_main_read); + VezSetWriteHandler(m72_main_write); + VezSetReadPort(m72_main_read_port); + VezSetWritePort(m72_main_write_port); + VezClose(); +} + +static void common_040000_040000() { common_main_cpu_map(0x40000, 0x40000); } +static void common_080000_080000() { common_main_cpu_map(0x80000, 0x80000); } +static void common_080000_088000() { common_main_cpu_map(0x80000, 0x88000); } +static void common_080000_090000() { common_main_cpu_map(0x80000, 0x90000); } +static void common_080000_09c000() { common_main_cpu_map(0x80000, 0x9c000); } +static void common_080000_0a0000() { common_main_cpu_map(0x80000, 0xa0000); } + +static void rtype2_main_cpu_map() +{ + VezInit(0, V30_TYPE); + + VezOpen(0); + VezMapArea(0x00000, 0x7ffff, 0, DrvV30ROM + 0x000000); + VezMapArea(0x00000, 0x7ffff, 2, DrvV30ROM + 0x000000); + VezMapArea(0xc0000, 0xc0fff, 0, DrvSprRAM); + VezMapArea(0xc0000, 0xc0fff, 1, DrvSprRAM); + VezMapArea(0xc0000, 0xc0fff, 2, DrvSprRAM); + VezMapArea(0xc8000, 0xc8fff, 0, DrvPalRAM); +// VezMapArea(0xc8000, 0xc8fff, 1, DrvPalRAM); + VezMapArea(0xc8000, 0xc8fff, 2, DrvPalRAM); + VezMapArea(0xd0000, 0xd3fff, 0, DrvVidRAM0); + VezMapArea(0xd0000, 0xd3fff, 1, DrvVidRAM0); + VezMapArea(0xd0000, 0xd3fff, 2, DrvVidRAM0); + VezMapArea(0xd4000, 0xd7fff, 0, DrvVidRAM1); + VezMapArea(0xd4000, 0xd7fff, 1, DrvVidRAM1); + VezMapArea(0xd4000, 0xd7fff, 2, DrvVidRAM1); + VezMapArea(0xd8000, 0xd8fff, 0, DrvPalRAM + 0x1000); +// VezMapArea(0xd8000, 0xd8fff, 1, DrvPalRAM + 0x1000); + VezMapArea(0xd8000, 0xd8fff, 2, DrvPalRAM + 0x1000); + VezMapArea(0xe0000, 0xe3fff, 0, DrvV30RAM); + VezMapArea(0xe0000, 0xe3fff, 1, DrvV30RAM); + VezMapArea(0xe0000, 0xe3fff, 2, DrvV30RAM); + VezMapArea(0xff800, 0xfffff, 0, DrvV30ROM + 0x0ff800); + VezMapArea(0xff800, 0xfffff, 2, DrvV30ROM + 0x0ff800); + VezSetReadHandler(m72_main_read); + VezSetWriteHandler(rtype2_main_write); + VezSetReadPort(m72_main_read_port); + VezSetWritePort(m72_main_write_port); + VezClose(); +} + +static void hharryu_main_cpu_map() +{ + VezInit(0, V30_TYPE); + + VezOpen(0); + VezMapArea(0x00000, 0x7ffff, 0, DrvV30ROM + 0x000000); + VezMapArea(0x00000, 0x7ffff, 2, DrvV30ROM + 0x000000); + VezMapArea(0x80000, 0x83fff, 0, DrvVidRAM0); // kengo + VezMapArea(0x80000, 0x83fff, 1, DrvVidRAM0); + VezMapArea(0x80000, 0x83fff, 2, DrvVidRAM0); + VezMapArea(0x84000, 0x87fff, 0, DrvVidRAM1); // kengo + VezMapArea(0x84000, 0x87fff, 1, DrvVidRAM1); + VezMapArea(0x84000, 0x87fff, 2, DrvVidRAM1); + VezMapArea(0xa0000, 0xa0fff, 0, DrvPalRAM); +// VezMapArea(0xa0000, 0xa0fff, 1, DrvPalRAM); + VezMapArea(0xa0000, 0xa0fff, 2, DrvPalRAM); + VezMapArea(0xa8000, 0xa8fff, 0, DrvPalRAM + 0x1000); +// VezMapArea(0xa8000, 0xa8fff, 1, DrvPalRAM + 0x1000); + VezMapArea(0xa8000, 0xa8fff, 2, DrvPalRAM + 0x1000); + VezMapArea(0xc0000, 0xc0fff, 0, DrvSprRAM); + VezMapArea(0xc0000, 0xc0fff, 1, DrvSprRAM); + VezMapArea(0xc0000, 0xc0fff, 2, DrvSprRAM); + VezMapArea(0xd0000, 0xd3fff, 0, DrvVidRAM0); + VezMapArea(0xd0000, 0xd3fff, 1, DrvVidRAM0); + VezMapArea(0xd0000, 0xd3fff, 2, DrvVidRAM0); + VezMapArea(0xd4000, 0xd7fff, 0, DrvVidRAM1); + VezMapArea(0xd4000, 0xd7fff, 1, DrvVidRAM1); + VezMapArea(0xd4000, 0xd7fff, 2, DrvVidRAM1); + VezMapArea(0xe0000, 0xe3fff, 0, DrvV30RAM); + VezMapArea(0xe0000, 0xe3fff, 1, DrvV30RAM); + VezMapArea(0xe0000, 0xe3fff, 2, DrvV30RAM); + VezMapArea(0xff800, 0xfffff, 0, DrvV30ROM + 0x0ff800); + VezMapArea(0xff800, 0xfffff, 2, DrvV30ROM + 0x0ff800); + VezSetReadHandler(m72_main_read); + VezSetWriteHandler(rtype2_main_write); + VezSetReadPort(m72_main_read_port); + VezSetWritePort(m72_main_write_port); + VezClose(); +} + +static void majtitle_main_cpu_map() +{ + VezInit(0, V30_TYPE); + + VezOpen(0); + VezMapArea(0x00000, 0x7ffff, 0, DrvV30ROM + 0x000000); + VezMapArea(0x00000, 0x7ffff, 2, DrvV30ROM + 0x000000); + VezMapArea(0xa0000, 0xa07ff, 0, DrvRowScroll); + VezMapArea(0xa0000, 0xa07ff, 1, DrvRowScroll); + VezMapArea(0xa0000, 0xa07ff, 2, DrvRowScroll); + VezMapArea(0xa4000, 0xa4fff, 0, DrvPalRAM + 0x1000); +// VezMapArea(0xa4000, 0xa4fff, 1, DrvPalRAM + 0x1000); + VezMapArea(0xa4000, 0xa4fff, 2, DrvPalRAM + 0x1000); + VezMapArea(0xac000, 0xaffff, 0, DrvVidRAM0); + VezMapArea(0xac000, 0xaffff, 1, DrvVidRAM0); + VezMapArea(0xac000, 0xaffff, 2, DrvVidRAM0); + VezMapArea(0xb0000, 0xbffff, 0, DrvVidRAM1); + VezMapArea(0xb0000, 0xbffff, 1, DrvVidRAM1); + VezMapArea(0xb0000, 0xbffff, 2, DrvVidRAM1); + VezMapArea(0xc0000, 0xc07ff, 0, DrvSprRAM); + VezMapArea(0xc0000, 0xc07ff, 1, DrvSprRAM); + VezMapArea(0xc0000, 0xc07ff, 2, DrvSprRAM); + VezMapArea(0xc8000, 0xc87ff, 0, DrvSprRAM2); + VezMapArea(0xc8000, 0xc87ff, 1, DrvSprRAM2); + VezMapArea(0xc8000, 0xc87ff, 2, DrvSprRAM2); + VezMapArea(0xcc000, 0xccfff, 0, DrvPalRAM); +// VezMapArea(0xcc000, 0xccfff, 1, DrvPalRAM); + VezMapArea(0xcc000, 0xccfff, 2, DrvPalRAM); + VezMapArea(0xd0000, 0xd3fff, 0, DrvV30RAM); + VezMapArea(0xd0000, 0xd3fff, 1, DrvV30RAM); + VezMapArea(0xd0000, 0xd3fff, 2, DrvV30RAM); + VezMapArea(0xff800, 0xfffff, 0, DrvV30ROM + 0x0ff800); + VezMapArea(0xff800, 0xfffff, 2, DrvV30ROM + 0x0ff800); + VezSetReadHandler(m72_main_read); + VezSetWriteHandler(rtype2_main_write); + VezSetReadPort(m72_main_read_port); + VezSetWritePort(m72_main_write_port); + VezClose(); +} + +static void sound_ram_map() +{ + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xffff, 0, DrvZ80RAM); + ZetMapArea(0x0000, 0xffff, 1, DrvZ80RAM); + ZetMapArea(0x0000, 0xffff, 2, DrvZ80RAM); + ZetSetOutHandler(m72_sound_write_port); + ZetSetInHandler(m72_sound_read_port); + ZetClose(); + + enable_z80_reset = 1; +} + +static void sound_rom_map() +{ + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); + ZetMapArea(0xf000, 0xffff, 0, DrvZ80RAM); + ZetMapArea(0xf000, 0xffff, 1, DrvZ80RAM); + ZetMapArea(0xf000, 0xffff, 2, DrvZ80RAM); + ZetSetOutHandler(m72_sound_write_port); + ZetSetInHandler(m72_sound_read_port); + ZetClose(); + + enable_z80_reset = 0; +} + +static INT32 DrvGfxDecode(UINT8 *gfx, INT32 len, INT32 type) +{ + INT32 Planes[4] = { ((len / 4) * 8) * 3, ((len / 4) * 8) * 2, ((len / 4) * 8) * 1, ((len / 4) * 8) * 0 }; + INT32 XOffs[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87 }; + INT32 YOffs[16] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(len); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, gfx, len); + + if (type) { + GfxDecode((len * 2) / ( 8 * 8), 4, 8, 8, Planes, XOffs, YOffs, 0x040, tmp, gfx); + } else { + GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Planes, XOffs, YOffs, 0x100, tmp, gfx); + } + + BurnFree (tmp); + + return 0; +} + +static INT32 GetRoms(INT32 bLoad) +{ + char* pRomName; + struct BurnRomInfo ri; + UINT8 *V30ROM = DrvV30ROM; + UINT8 *Z80ROM = DrvZ80ROM; + UINT8 *GFXROM0 = DrvGfxROM0; + UINT8 *GFXROM1 = DrvGfxROM1; + UINT8 *GFXROM2 = DrvGfxROM2; + UINT8 *GFXROM3 = DrvGfxROM3; + UINT8 *SNDROM = DrvSndROM; + INT32 pglen = 0; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & 15) == 1) { + if (bLoad) { + if (BurnLoadRom(V30ROM + 1, i + 0, 2)) return 1; + if (BurnLoadRom(V30ROM + 0, i + 1, 2)) return 1; + } + V30ROM += ri.nLen * 2; + i++; + continue; + } + + if ((ri.nType & 15) == 6) { + if (bLoad) if (BurnLoadRom(Z80ROM , i, 1)) return 1; + Z80ROM += ri.nLen; + continue; + } + + if ((ri.nType & 15) == 2) { + if (bLoad) if (BurnLoadRom(GFXROM0, i, 1)) return 1; + GFXROM0 += ri.nLen; + + if (pglen == 0x10000 && ri.nLen == 0x8000) { // rtype fix + if (bLoad) if (BurnLoadRom(GFXROM0, i, 1)) return 1; + GFXROM0 += ri.nLen; + } + pglen = ri.nLen; + continue; + } + + if ((ri.nType & 15) == 3) { + if (bLoad) if (BurnLoadRom(GFXROM1, i, 1)) return 1; + GFXROM1 += ri.nLen; + continue; + } + + if ((ri.nType & 15) == 4) { + if (bLoad) if (BurnLoadRom(GFXROM2, i, 1)) return 1; + GFXROM2 += ri.nLen; + continue; + } + + if ((ri.nType & 15) == 14) { + if (bLoad) if (BurnLoadRom(GFXROM3, i, 1)) return 1; + GFXROM3 += ri.nLen; + continue; + } + + if ((ri.nType & 15) == 5) { + if (bLoad) if (BurnLoadRom(SNDROM , i, 1)) return 1; + SNDROM += ri.nLen; + continue; + } + } + + if (bLoad) { + // copy irq vectors + memcpy (DrvV30ROM + 0xffff0, V30ROM - 0x10, 0x010); + + // mirror sound rom + INT32 sndlen = SNDROM - DrvSndROM; + if (sndlen < 0x40000 && sndlen) { + for (INT32 i = 0; i < 0x40000; i++) { + DrvSndROM[i] = DrvSndROM[i % sndlen]; + } + } + + DrvGfxDecode(DrvGfxROM0, graphics_length[0], 0); + DrvGfxDecode(DrvGfxROM1, graphics_length[1], 1); + + if (graphics_length[2] > 2) { + DrvGfxDecode(DrvGfxROM2, graphics_length[2], 1); + } else { + DrvGfxROM2 = DrvGfxROM1; + code_mask[2] = code_mask[1]; + } + + if (graphics_length[3] > 2) { + DrvGfxDecode(DrvGfxROM3, graphics_length[3], 0); + } else { + code_mask[3] = 0; + } + } else { + graphics_length[0] = GFXROM0 - DrvGfxROM0; + graphics_length[1] = GFXROM1 - DrvGfxROM1; + graphics_length[2] = GFXROM2 - DrvGfxROM2; + graphics_length[3] = GFXROM3 - DrvGfxROM3; + + for (INT32 i = 1, j = 0; j < 4; graphics_length[j] = i, j++, i = 1) { + while (i < graphics_length[j]) i <<= 1; + } + + code_mask[0] = ((graphics_length[0] * 2) - 1) / (16 * 16); + code_mask[1] = ((graphics_length[1] * 2) - 1) / (8 * 8); + code_mask[2] = ((graphics_length[2] * 2) - 1) / (8 * 8); + code_mask[3] = ((graphics_length[3] * 2) - 1) / (16 * 16); + } + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvV30ROM = Next; Next += 0x200000; + DrvZ80ROM = Next; Next += 0x010000; + DrvGfxROM0 = Next; Next += graphics_length[0] * 2; + DrvGfxROM1 = Next; Next += graphics_length[1] * 2; + DrvGfxROM2 = Next; Next += graphics_length[2] * 2; + DrvGfxROM3 = Next; Next += graphics_length[3] * 2; + DrvSndROM = Next; Next += 0x040000; + + RamPrioBitmap = Next; Next += nScreenWidth * nScreenHeight; + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x010000; + DrvSprRAM = Next; Next += 0x001000; + DrvSprRAM2 = Next; Next += 0x000800; + DrvSprBuf = Next; Next += 0x001000; + DrvVidRAM0 = Next; Next += 0x004000; + DrvVidRAM1 = Next; Next += 0x010000; + DrvV30RAM = Next; Next += 0x004000; + DrvPalRAM = Next; Next += 0x002000; + DrvProtRAM = Next; Next += 0x001000; + DrvRowScroll = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + video_enable = Next; Next += 0x000001; + + scroll = Next; Next += 0x000008; + + RamEnd = Next; + + DrvPalette = (UINT32 *) Next; Next += 0x200 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + + +static INT32 DrvInit(void (*pCPUMapCallback)(), void (*pSNDMapCallback)(), INT32 (*pRomLoadCallback)(), INT32 irqbase, INT32 z80_nmi, INT32 video_type) +{ + BurnSetRefreshRate(55.00); + + GenericTilesInit(); + + GetRoms(0); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (GetRoms(1)) return 1; + + if (pCPUMapCallback) { + pCPUMapCallback(); + } + + if (pSNDMapCallback) { + pSNDMapCallback(); + } + + if (pRomLoadCallback) { + if (pRomLoadCallback()) return 1; + } + + m72_irq_base = irqbase; + z80_nmi_enable = z80_nmi; + m72_video_type = video_type; + + switch (video_type) + { + case 0: // m72 + video_offsets[0] = video_offsets[1] = 0; + break; + + case 1: // rtype + case 3: // majtitle + video_offsets[0] = video_offsets[1] = -4; + break; + + case 2: // hharry + video_offsets[0] = -4; + video_offsets[1] = -6; + break; + + case 4: // poundfor + video_offsets[0] = video_offsets[1] = -6; + m72_video_type = 1; // rtype + break; + } + + BurnYM2151Init(3579545); + YM2151SetIrqHandler(0, &m72YM2151IRQHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + DACInit(0, 0, 1, m72SyncDAC); + DACSetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM2151Exit(); + DACExit(); + + ZetExit(); + VezExit(); + + BurnFree(AllMem); + + m72_video_type = 0; + enable_z80_reset = 0; + z80_nmi_enable = 0; + + m72_install_protection(NULL,NULL,NULL); + + video_offsets[0] = video_offsets[1] = 0; + + return 0; +} + +static void draw_layer(INT32 layer, INT32 forcelayer, INT32 type, INT32 start, INT32 finish) // bg = layer 1, fg = layer 0 +{ + INT32 codeand = code_mask[1+layer]; + UINT16 *vram = (UINT16*)(layer ? DrvVidRAM1 : DrvVidRAM0); + UINT8 *gfx = (layer) ? DrvGfxROM2 : DrvGfxROM1; + + // layer, prio, forcelayer + const UINT16 transmask[2][3][2] = { + { { 0xffff, 0x0001 }, { 0x00ff, 0xff01 }, { 0x0001, 0xffff } }, + { { 0xffff, 0x0000 }, { 0x00ff, 0xff00 }, { (type == 0) ? 0x0007 : 0x0001, (type == 0) ? 0xfff8 : 0xfffe } } + }; + + INT32 scrolly = scroll[layer * 4 + 0] | (scroll[layer * 4 + 1] << 8); + INT32 scrollx = scroll[layer * 4 + 2] | (scroll[layer * 4 + 3] << 8); + + scrolly = (scrolly + 128) & 0x1ff; + scrollx = (scrollx + 64 + video_offsets[layer]) & 0x1ff; + + UINT16 *xscroll = (UINT16*)DrvRowScroll; + + for (INT32 sy = start; sy < finish; sy++) + { + UINT16 *dest = pTransDraw + (sy * nScreenWidth); + UINT8 *pri = RamPrioBitmap + (sy * nScreenWidth); + + INT32 scrolly1 = (scrolly + sy) & 0x1ff; + INT32 romoff1 = (scrolly1 & 0x07) << 3; + + for (INT32 sx = 0; sx < nScreenWidth + 8; sx+=8) + { + INT32 flipy, flipx, prio, scrollx1, offs; + + if (majtitle_rowscroll_enable && type == 3 && layer == 1) { + scrollx1 = 256 + BURN_ENDIAN_SWAP_INT16(xscroll[scrolly1]) + sx + 64 + video_offsets[1]; + } else { + scrollx1 = scrollx + sx; + if (type == 3 && layer == 1) scrollx1 += 256; + } + + if (type == 3 && layer == 1) { + scrollx1 &= 0x3ff; + offs = ((scrolly1 >> 3) << 8) | (scrollx1 >> 3); + } else { + scrollx1 &= 0x1ff; + offs = ((scrolly1 >> 3) << 6) | (scrollx1 >> 3); + } + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]); + INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]); + + if (type == 1||type==3) { + flipy = color & 0x0040; + flipx = color & 0x0020; + prio = (color & 0x0100) ? 2 : (color & 0x80) ? 1 : 0; + } else { + flipy = code & 0x8000; + flipx = code & 0x4000; + prio = (color & 0x80) ? 2 : ((color & 0x40) ? 1 : 0); + } + + INT32 mask = transmask[layer][prio][forcelayer]; + + code &= codeand; + color = ((color & 0x000f) << 4) | 0x100; + prio = 1 << prio; + + { + INT32 scrollx0 = scrollx1 & 0x07; + INT32 x_xor = 0; + INT32 romoff = romoff1; + if (flipy) romoff ^= 0x38; + if (flipx) x_xor = 7; + + UINT8 *rom = gfx + (code * 0x40) + romoff; + + INT32 xx = sx - scrollx0; + + for (INT32 x = 0; x < 8; x++, xx++) { + if (xx < 0 || xx >= nScreenWidth) continue; + + INT32 pxl = rom[x ^ x_xor]; + if (mask & (1 << pxl)) continue; + + dest[xx] = pxl | color; + pri[xx] = prio; + } + } + } + } +} + +INT32 start_screen = 0; + +static void draw_sprites() +{ + UINT16 *sprram = (UINT16*)DrvSprBuf; + + for (INT32 offs = 0; offs < 0x400/2;) + { + INT32 sx = -256+(BURN_ENDIAN_SWAP_INT16(sprram[offs+3]) & 0x3ff); + INT32 attr = BURN_ENDIAN_SWAP_INT16(sprram[offs+2]); + INT32 code = BURN_ENDIAN_SWAP_INT16(sprram[offs+1]); + INT32 sy = 384-(BURN_ENDIAN_SWAP_INT16(sprram[offs+0]) & 0x1ff); + + INT32 color = attr & 0x0f; + INT32 flipx = attr & 0x0800; + INT32 flipy = attr & 0x0400; + + INT32 w = 1 << ((attr & 0xc000) >> 14); + INT32 h = 1 << ((attr & 0x3000) >> 12); + sy -= 16 * h; + + sy -= start_screen; + sx -= 64; // ? +#if 0 + if (*flipscreen) + { + sx = 512 - 16*w - sx; + sy = 284 - 16*h - sy; + flipx = !flipx; + flipy = !flipy; + } +#endif + + for (INT32 x = 0;x < w;x++) + { + for (INT32 y = 0;y < h;y++) + { + INT32 c = code; + + if (flipx) c += 8*(w-1-x); + else c += 8*x; + if (flipy) c += h-1-y; + else c += y; + + c &= code_mask[0]; + + INT32 xx = sx + 16 * x; + INT32 yy = sy + 16 * y; + + if (xx < -15 || yy < -15 || xx >= nScreenWidth || yy >= nScreenHeight) continue; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM0); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM0); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM0); + } + } + } + } + + offs += w*4; + } +} + +static void majtitle_draw_sprites() +{ + UINT16 *spriteram16_2 = (UINT16*)DrvSprRAM2; + + for (INT32 offs = 0; offs < 0x400; offs += 4) + { + INT32 code,color,sx,sy,flipx,flipy,w,h,x,y; + + code = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+1]); + color = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x0f; + sx = -256+(BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+3]) & 0x3ff); + sy = 384-(BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+0]) & 0x1ff); + flipx = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x0800; + flipy = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x0400; + + w = 1;// << ((spriteram16_2[offs+2] & 0xc000) >> 14); + h = 1 << ((BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x3000) >> 12); + sy -= 16 * h; + + sy -= start_screen; + sx -= 64; // ? +#if 0 + if (flip_screen_get(machine)) + { + sx = 512 - 16*w - sx; + sy = 256 - 16*h - sy; + flipx = !flipx; + flipy = !flipy; + } +#endif + + for (x = 0;x < w;x++) + { + for (y = 0;y < h;y++) + { + INT32 c = code; + + if (flipx) c += 8*(w-1-x); + else c += 8*x; + if (flipy) c += h-1-y; + else c += y; + + c &= code_mask[3]; + + INT32 xx = sx + 16 * x; + INT32 yy = sy + 16 * y; + + if (xx < -15 || yy < -15 || xx >= nScreenWidth || yy >= nScreenHeight) continue; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM3); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM3); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM3); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, c, xx, yy, color, 4, 0, 0, DrvGfxROM3); + } + } + } + } + } +} + +static void dodrawline(INT32 start, INT32 finish) +{ + if (*video_enable) return; + + draw_layer(1, 1, m72_video_type, start, finish); + draw_layer(0, 1, m72_video_type, start, finish); + + // hacky hack for drawing sprites in scanline... slow. + start_screen = start; + UINT16 *ptr = pTransDraw; + INT32 scrn = nScreenHeight; + pTransDraw += start * nScreenWidth; + nScreenHeight = finish - start; + if (m72_video_type == 3) majtitle_draw_sprites(); + draw_sprites(); + pTransDraw = ptr; + nScreenHeight = scrn; + + draw_layer(1, 0, m72_video_type, start, finish); + draw_layer(0, 0, m72_video_type, start, finish); +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x200; i++) { + palette_write((i & 0xff) * 2, i >> 8); + } + DrvRecalc = 0; + } + +// if (*video_enable) { +// BurnTransferClear(); +// BurnTransferCopy(DrvPalette); +// return 0; +// } + +// draw_layer(1, 1, 0, nScreenHeight); +// draw_layer(0, 1, 0, nScreenHeight); +// draw_sprites(); +// draw_layer(1, 0, 0, nScreenHeight); +// draw_layer(0, 0, 0, nScreenHeight); + + BurnTransferCopy(DrvPalette); + + BurnTransferClear(); + + return 0; +} + +static void compile_inputs() +{ + memset (DrvInputs, 0xff, 5); + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + } +} + +static INT32 nPreviousLine = 0; + +static void scanline_interrupts(INT32 scanline) +{ + if (scanline == (irq_raster_position - 128) && scanline < 256) { + if (nPreviousLine <= scanline && scanline < nScreenHeight) { + dodrawline(nPreviousLine, scanline+1); + nPreviousLine = scanline + 1; + } + + VezSetIRQLineAndVector(0, (m72_irq_base + 8)/4, VEZ_IRQSTATUS_AUTO); + } + else if (scanline == 256) // vblank + { + if (nPreviousLine < nScreenHeight) { + dodrawline(nPreviousLine, nScreenHeight); + nPreviousLine = 0; + } + + VezSetIRQLineAndVector(0, (m72_irq_base + 0)/4, VEZ_IRQSTATUS_AUTO); + } + + if (nPreviousLine >= nScreenHeight) nPreviousLine = 0; +} + +static INT32 DrvFrame() +{ + INT32 nSoundBufferPos = 0; + + if (DrvReset) { + DrvDoReset(); + } + + VezNewFrame(); + ZetNewFrame(); + + compile_inputs(); + + // overclocking... + nCyclesTotal[0] = (INT32)((INT64)(8000000 / 55) * nBurnCPUSpeedAdjust / 0x0100); + nCyclesTotal[1] = (INT32)((INT64)(3579545 / 55) * nBurnCPUSpeedAdjust / 0x0100); + nCyclesDone[0] = nCyclesDone[1] = 0; + + VezOpen(0); + ZetOpen(0); + +// memset (pBurnSoundOut, 0, nBurnSoundLen * 2 * sizeof(INT16)); + + for (INT32 i = 0; i < nInterleave; i++) + { + nCurrentCycles = ((nCyclesTotal[0] / nInterleave) * 1) / 8; // scanline is 87.5% of scanline time + + for (INT32 j = 0; j < 7; j++) { // increase cpu sync + nCyclesDone[0] += VezRun(nCurrentCycles); + } + + scanline_interrupts(i); // run at hblank? + + nCurrentCycles = ((nCyclesTotal[0] / nInterleave) * 1) / 8; // horizontal blank is 12.5% of scanline + + nCyclesDone[0] += VezRun(nCurrentCycles); + // vertical lines are ~90% of video time, vblank is ~10% + + if (z80_reset == 0) { + nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave); + + if (i & 1) { + if (z80_nmi_enable == Z80_FAKE_NMI) { + if (DrvSndROM[sample_address]) { + DACSignedWrite(0, DrvSndROM[sample_address]); + sample_address = (sample_address + 1) & 0x3ffff; + } + } else if (z80_nmi_enable == Z80_REAL_NMI) { + ZetNmi(); + } + } + } else { + ZetIdle(nCyclesTotal[1] / nInterleave); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + VezClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + + + +// R-Type (World) + +static struct BurnRomInfo rtypeRomDesc[] = { + { "rt_r-h0-b.1b", 0x10000, 0x591c7754, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "rt_r-l0-b.3b", 0x10000, 0xa1928df0, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "rt_r-h1-b.1c", 0x10000, 0xa9d71eca, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "rt_r-l1-b.3c", 0x10000, 0x0df3573d, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "rt_r-00.1h", 0x10000, 0xdad53bc0, 0x02 | BRF_GRA }, // 4 Sprites + { "rt_r-01.1j", 0x08000, 0x5e441e7f, 0x02 | BRF_GRA }, // 5 + { "rt_r-10.1k", 0x10000, 0xd6a66298, 0x02 | BRF_GRA }, // 6 + { "rt_r-11.1l", 0x08000, 0x791df4f8, 0x02 | BRF_GRA }, // 7 + { "rt_r-20.3h", 0x10000, 0xfc247c8a, 0x02 | BRF_GRA }, // 8 + { "rt_r-21.3j", 0x08000, 0xed793841, 0x02 | BRF_GRA }, // 9 + { "rt_r-30.3k", 0x10000, 0xeb02a1cb, 0x02 | BRF_GRA }, // 10 + { "rt_r-31.3l", 0x08000, 0x8558355d, 0x02 | BRF_GRA }, // 11 + + { "rt_b-a0.3c", 0x08000, 0x4e212fb0, 0x03 | BRF_GRA }, // 12 Foreground Tiles + { "rt_b-a1.3d", 0x08000, 0x8a65bdff, 0x03 | BRF_GRA }, // 13 + { "rt_b-a2.3a", 0x08000, 0x5a4ae5b9, 0x03 | BRF_GRA }, // 14 + { "rt_b-a3.3e", 0x08000, 0x73327606, 0x03 | BRF_GRA }, // 15 + + { "rt_b-b0.3j", 0x08000, 0xa7b17491, 0x04 | BRF_GRA }, // 16 Background Tiles + { "rt_b-b1.3k", 0x08000, 0xb9709686, 0x04 | BRF_GRA }, // 17 + { "rt_b-b2.3h", 0x08000, 0x433b229a, 0x04 | BRF_GRA }, // 18 + { "rt_b-b3.3f", 0x08000, 0xad89b072, 0x04 | BRF_GRA }, // 19 +}; + +STD_ROM_PICK(rtype) +STD_ROM_FN(rtype) + +static INT32 rtypeInit() +{ + return DrvInit(common_040000_040000, sound_ram_map, NULL, 0x80, Z80_NO_NMI, 0); +} + +struct BurnDriver BurnDrvRtype = { + "rtype", NULL, NULL, NULL, "1987", + "R-Type (World)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, rtypeRomInfo, rtypeRomName, NULL, NULL, CommonInputInfo, RtypeDIPInfo, + rtypeInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// R-Type (Japan) + +static struct BurnRomInfo rtypejRomDesc[] = { + { "rt_r-h0-.1b", 0x10000, 0xc2940df2, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "rt_r-l0-.3b", 0x10000, 0x858cc0f6, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "rt_r-h1-.1c", 0x10000, 0x5bcededa, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "rt_r-l1-.3c", 0x10000, 0x4821141c, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "rt_r-00.1h", 0x10000, 0xdad53bc0, 0x02 | BRF_GRA }, // 4 Sprites + { "rt_r-01.1j", 0x08000, 0x5e441e7f, 0x02 | BRF_GRA }, // 5 + { "rt_r-10.1k", 0x10000, 0xd6a66298, 0x02 | BRF_GRA }, // 6 + { "rt_r-11.1l", 0x08000, 0x791df4f8, 0x02 | BRF_GRA }, // 7 + { "rt_r-20.3h", 0x10000, 0xfc247c8a, 0x02 | BRF_GRA }, // 8 + { "rt_r-21.3j", 0x08000, 0xed793841, 0x02 | BRF_GRA }, // 9 + { "rt_r-30.3k", 0x10000, 0xeb02a1cb, 0x02 | BRF_GRA }, // 10 + { "rt_r-31.3l", 0x08000, 0x8558355d, 0x02 | BRF_GRA }, // 11 + + { "rt_b-a0.3c", 0x08000, 0x4e212fb0, 0x03 | BRF_GRA }, // 12 Foreground Tiles + { "rt_b-a1.3d", 0x08000, 0x8a65bdff, 0x03 | BRF_GRA }, // 13 + { "rt_b-a2.3a", 0x08000, 0x5a4ae5b9, 0x03 | BRF_GRA }, // 14 + { "rt_b-a3.3e", 0x08000, 0x73327606, 0x03 | BRF_GRA }, // 15 + + { "rt_b-b0.3j", 0x08000, 0xa7b17491, 0x04 | BRF_GRA }, // 16 Background Tiles + { "rt_b-b1.3k", 0x08000, 0xb9709686, 0x04 | BRF_GRA }, // 17 + { "rt_b-b2.3h", 0x08000, 0x433b229a, 0x04 | BRF_GRA }, // 18 + { "rt_b-b3.3f", 0x08000, 0xad89b072, 0x04 | BRF_GRA }, // 19 +}; + +STD_ROM_PICK(rtypej) +STD_ROM_FN(rtypej) + +struct BurnDriver BurnDrvRtypej = { + "rtypej", "rtype", NULL, NULL, "1987", + "R-Type (Japan)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, rtypejRomInfo, rtypejRomName, NULL, NULL, CommonInputInfo, RtypeDIPInfo, + rtypeInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// R-Type (Japan prototype) + +static struct BurnRomInfo rtypejpRomDesc[] = { + { "db_b1.bin", 0x10000, 0xc1865141, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "db_a1.bin", 0x10000, 0x5ad2bd90, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "db_b2.bin", 0x10000, 0xb4f6407e, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "db_a2.bin", 0x10000, 0x6098d86f, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "rt_r-00.1h", 0x10000, 0xdad53bc0, 0x02 | BRF_GRA }, // 4 Sprites + { "rt_r-01.1j", 0x08000, 0x5e441e7f, 0x02 | BRF_GRA }, // 5 + { "rt_r-10.1k", 0x10000, 0xd6a66298, 0x02 | BRF_GRA }, // 6 + { "rt_r-11.1l", 0x08000, 0x791df4f8, 0x02 | BRF_GRA }, // 7 + { "rt_r-20.3h", 0x10000, 0xfc247c8a, 0x02 | BRF_GRA }, // 8 + { "rt_r-21.3j", 0x08000, 0xed793841, 0x02 | BRF_GRA }, // 9 + { "rt_r-30.3k", 0x10000, 0xeb02a1cb, 0x02 | BRF_GRA }, // 10 + { "rt_r-31.3l", 0x08000, 0x8558355d, 0x02 | BRF_GRA }, // 11 + + { "rt_b-a0.3c", 0x08000, 0x4e212fb0, 0x03 | BRF_GRA }, // 12 Foreground Tiles + { "rt_b-a1.3d", 0x08000, 0x8a65bdff, 0x03 | BRF_GRA }, // 13 + { "rt_b-a2.3a", 0x08000, 0x5a4ae5b9, 0x03 | BRF_GRA }, // 14 + { "rt_b-a3.3e", 0x08000, 0x73327606, 0x03 | BRF_GRA }, // 15 + + { "rt_b-b0.3j", 0x08000, 0xa7b17491, 0x04 | BRF_GRA }, // 16 Background Tiles + { "rt_b-b1.3k", 0x08000, 0xb9709686, 0x04 | BRF_GRA }, // 17 + { "rt_b-b2.3h", 0x08000, 0x433b229a, 0x04 | BRF_GRA }, // 18 + { "rt_b-b3.3f", 0x08000, 0xad89b072, 0x04 | BRF_GRA }, // 19 +}; + +STD_ROM_PICK(rtypejp) +STD_ROM_FN(rtypejp) + +struct BurnDriver BurnDrvRtypejp = { + "rtypejp", "rtype", NULL, NULL, "1987", + "R-Type (Japan prototype)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, rtypejpRomInfo, rtypejpRomName, NULL, NULL, CommonInputInfo, RtypepDIPInfo, + rtypeInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// R-Type (US) + +static struct BurnRomInfo rtypeuRomDesc[] = { + { "rt_r-h0-a.1b", 0x10000, 0x36008a4e, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "rt_r-l0-a.3b", 0x10000, 0x4aaa668e, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "rt_r-h1-a.1c", 0x10000, 0x7ebb2a53, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "rt_r-l1-a.3c", 0x10000, 0xc28b103b, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "rt_r-00.1h", 0x10000, 0xdad53bc0, 0x02 | BRF_GRA }, // 4 Sprites + { "rt_r-01.1j", 0x08000, 0x5e441e7f, 0x02 | BRF_GRA }, // 5 + { "rt_r-10.1k", 0x10000, 0xd6a66298, 0x02 | BRF_GRA }, // 6 + { "rt_r-11.1l", 0x08000, 0x791df4f8, 0x02 | BRF_GRA }, // 7 + { "rt_r-20.3h", 0x10000, 0xfc247c8a, 0x02 | BRF_GRA }, // 8 + { "rt_r-21.3j", 0x08000, 0xed793841, 0x02 | BRF_GRA }, // 9 + { "rt_r-30.3k", 0x10000, 0xeb02a1cb, 0x02 | BRF_GRA }, // 10 + { "rt_r-31.3l", 0x08000, 0x8558355d, 0x02 | BRF_GRA }, // 11 + + { "rt_b-a0.3c", 0x08000, 0x4e212fb0, 0x03 | BRF_GRA }, // 12 Foreground Tiles + { "rt_b-a1.3d", 0x08000, 0x8a65bdff, 0x03 | BRF_GRA }, // 13 + { "rt_b-a2.3a", 0x08000, 0x5a4ae5b9, 0x03 | BRF_GRA }, // 14 + { "rt_b-a3.3e", 0x08000, 0x73327606, 0x03 | BRF_GRA }, // 15 + + { "rt_b-b0.3j", 0x08000, 0xa7b17491, 0x04 | BRF_GRA }, // 16 Background Tiles + { "rt_b-b1.3k", 0x08000, 0xb9709686, 0x04 | BRF_GRA }, // 17 + { "rt_b-b2.3h", 0x08000, 0x433b229a, 0x04 | BRF_GRA }, // 18 + { "rt_b-b3.3f", 0x08000, 0xad89b072, 0x04 | BRF_GRA }, // 19 + + { "m72_a-8l-.ic66", 0x00100, 0xb460c438, 0x00 | BRF_OPT }, // 20 Proms + { "m72_a-9l-.ic75", 0x00100, 0xa4f2c4bc, 0x00 | BRF_OPT }, // 21 + + { "m72_r-3a-.bin", 0x00001, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 22 PLDs + { "m72_a-3d-.bin", 0x00001, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 23 + { "m72_a-4d-.bin", 0x00001, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 24 +}; + +STD_ROM_PICK(rtypeu) +STD_ROM_FN(rtypeu) + +struct BurnDriver BurnDrvRtypeu = { + "rtypeu", "rtype", NULL, NULL, "1987", + "R-Type (US)\0", NULL, "Irem (Nintendo of America license)", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, rtypeuRomInfo, rtypeuRomName, NULL, NULL, CommonInputInfo, RtypeDIPInfo, + rtypeInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// R-Type (World bootleg) + +static struct BurnRomInfo rtypebRomDesc[] = { + { "7.512", 0x10000, 0xeacc8024, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "1.512", 0x10000, 0x2e5fe27b, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "8.512", 0x10000, 0x22cc4950, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "2.512", 0x10000, 0xada7b90e, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "rt_r-00.1h", 0x10000, 0xdad53bc0, 0x02 | BRF_GRA }, // 4 Sprites + { "rt_r-01.1j", 0x08000, 0x5e441e7f, 0x02 | BRF_GRA }, // 5 + { "rt_r-10.1k", 0x10000, 0xd6a66298, 0x02 | BRF_GRA }, // 6 + { "rt_r-11.1l", 0x08000, 0x791df4f8, 0x02 | BRF_GRA }, // 7 + { "rt_r-20.3h", 0x10000, 0xfc247c8a, 0x02 | BRF_GRA }, // 8 + { "rt_r-21.3j", 0x08000, 0xed793841, 0x02 | BRF_GRA }, // 9 + { "rt_r-30.3k", 0x10000, 0xeb02a1cb, 0x02 | BRF_GRA }, // 10 + { "rt_r-31.3l", 0x08000, 0x8558355d, 0x02 | BRF_GRA }, // 11 + + { "rt_b-a0.3c", 0x08000, 0x4e212fb0, 0x03 | BRF_GRA }, // 12 Foreground Tiles + { "rt_b-a1.3d", 0x08000, 0x8a65bdff, 0x03 | BRF_GRA }, // 13 + { "rt_b-a2.3a", 0x08000, 0x5a4ae5b9, 0x03 | BRF_GRA }, // 14 + { "rt_b-a3.3e", 0x08000, 0x73327606, 0x03 | BRF_GRA }, // 15 + + { "rt_b-b0.3j", 0x08000, 0xa7b17491, 0x04 | BRF_GRA }, // 16 Background Tiles + { "rt_b-b1.3k", 0x08000, 0xb9709686, 0x04 | BRF_GRA }, // 17 + { "rt_b-b2.3h", 0x08000, 0x433b229a, 0x04 | BRF_GRA }, // 18 + { "rt_b-b3.3f", 0x08000, 0xad89b072, 0x04 | BRF_GRA }, // 19 +}; + +STD_ROM_PICK(rtypeb) +STD_ROM_FN(rtypeb) + +struct BurnDriver BurnDrvRtypeb = { + "rtypeb", "rtype", NULL, NULL, "1987", + "R-Type (World bootleg)\0", NULL, "bootleg", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, rtypebRomInfo, rtypebRomName, NULL, NULL, CommonInputInfo, RtypeDIPInfo, + rtypeInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// X Multiply (World, M81) + +static struct BurnRomInfo xmultiplRomDesc[] = { + { "xm-a-h1-.ic58", 0x20000, 0x449048cf, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "xm-a-l1-.ic67", 0x20000, 0x26ce39b0, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "xm-a-h0-.ic59", 0x10000, 0x509bc970, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "xm-a-l0-.ic68", 0x10000, 0x490a9ebc, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "xm-a-sp-.ic14", 0x10000, 0x006eef56, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "t44.00", 0x20000, 0xdb45186e, 0x02 | BRF_GRA }, // 5 Sprites + { "t45.01", 0x20000, 0x4d0764d4, 0x02 | BRF_GRA }, // 6 + { "t46.10", 0x20000, 0xf0c465a4, 0x02 | BRF_GRA }, // 7 + { "t47.11", 0x20000, 0x1263b24b, 0x02 | BRF_GRA }, // 8 + { "t48.20", 0x20000, 0x4129944f, 0x02 | BRF_GRA }, // 9 + { "t49.21", 0x20000, 0x2346e6f9, 0x02 | BRF_GRA }, // 10 + { "t50.30", 0x20000, 0xe322543e, 0x02 | BRF_GRA }, // 11 + { "t51.31", 0x20000, 0x229bf7b1, 0x02 | BRF_GRA }, // 12 + + { "t53.a0", 0x20000, 0x1a082494, 0x03 | BRF_GRA }, // 13 Foreground Tiles + { "t54.a1", 0x20000, 0x076c16c5, 0x03 | BRF_GRA }, // 14 + { "t55.a2", 0x20000, 0x25d877a5, 0x03 | BRF_GRA }, // 15 + { "t56.a3", 0x20000, 0x5b1213f5, 0x03 | BRF_GRA }, // 16 + + { "t57.b0", 0x20000, 0x0a84e0c7, 0x04 | BRF_GRA }, // 17 Background Tiles + { "t58.b1", 0x20000, 0xa874121d, 0x04 | BRF_GRA }, // 18 + { "t59.b2", 0x20000, 0x69deb990, 0x04 | BRF_GRA }, // 19 + { "t60.b3", 0x20000, 0x14c69f99, 0x04 | BRF_GRA }, // 20 + + { "t52.v0", 0x20000, 0x2db1bd80, 0x05 | BRF_SND }, // 21 DAC Samples + + { "m81_a-9l-.ic72", 0x00100, 0xb460c438, 0x00 | BRF_OPT }, // 22 Proms + { "m81_a-9p-.ic74", 0x00100, 0xa4f2c4bc, 0x00 | BRF_OPT }, // 23 +}; + +STD_ROM_PICK(xmultipl) +STD_ROM_FN(xmultipl) + +static INT32 xmultiplInit() +{ + return DrvInit(common_080000_09c000, sound_rom_map, NULL, 0x20, Z80_REAL_NMI, 0); +} + +struct BurnDriver BurnDrvXmultipl = { + "xmultipl", NULL, NULL, NULL, "1989", + "X Multiply (World, M81)\0", NULL, "Irem", "M81", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, xmultiplRomInfo, xmultiplRomName, NULL, NULL, CommonInputInfo, XmultiplDIPInfo, + xmultiplInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// X Multiply (Japan, M72) + +static struct BurnRomInfo xmultiplm72RomDesc[] = { + { "ch3.h3", 0x20000, 0x20685021, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "cl3.l3", 0x20000, 0x93fdd200, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ch0.h0", 0x10000, 0x9438dd8a, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "cl0.l0", 0x10000, 0x06a9e213, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "t44.00", 0x20000, 0xdb45186e, 0x02 | BRF_GRA }, // 4 Sprites + { "t45.01", 0x20000, 0x4d0764d4, 0x02 | BRF_GRA }, // 5 + { "t46.10", 0x20000, 0xf0c465a4, 0x02 | BRF_GRA }, // 6 + { "t47.11", 0x20000, 0x1263b24b, 0x02 | BRF_GRA }, // 7 + { "t48.20", 0x20000, 0x4129944f, 0x02 | BRF_GRA }, // 8 + { "t49.21", 0x20000, 0x2346e6f9, 0x02 | BRF_GRA }, // 9 + { "t50.30", 0x20000, 0xe322543e, 0x02 | BRF_GRA }, // 10 + { "t51.31", 0x20000, 0x229bf7b1, 0x02 | BRF_GRA }, // 11 + + { "t53.a0", 0x20000, 0x1a082494, 0x03 | BRF_GRA }, // 12 Foreground Tiles + { "t54.a1", 0x20000, 0x076c16c5, 0x03 | BRF_GRA }, // 13 + { "t55.a2", 0x20000, 0x25d877a5, 0x03 | BRF_GRA }, // 14 + { "t56.a3", 0x20000, 0x5b1213f5, 0x03 | BRF_GRA }, // 15 + + { "t57.b0", 0x20000, 0x0a84e0c7, 0x04 | BRF_GRA }, // 16 Background Tiles + { "t58.b1", 0x20000, 0xa874121d, 0x04 | BRF_GRA }, // 17 + { "t59.b2", 0x20000, 0x69deb990, 0x04 | BRF_GRA }, // 18 + { "t60.b3", 0x20000, 0x14c69f99, 0x04 | BRF_GRA }, // 19 + + { "t52.v0", 0x20000, 0x2db1bd80, 0x05 | BRF_SND }, // 20 DAC Samples + + { "xmultipl_i8751h.bin",0x01000, 0xc8ceb3cd, 0x00 | BRF_OPT }, // 21 i8751 Code +}; + +STD_ROM_PICK(xmultiplm72) +STD_ROM_FN(xmultiplm72) + +static INT32 xmultiplm72Init() +{ + install_protection(xmultiplm72); + + return DrvInit(common_080000_080000, sound_ram_map, NULL, 0x20, Z80_REAL_NMI, 0); +} + +struct BurnDriver BurnDrvXmultiplm72 = { + "xmultiplm72", "xmultipl", NULL, NULL, "1989", + "X Multiply (Japan, M72)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, xmultiplm72RomInfo, xmultiplm72RomName, NULL, NULL, CommonInputInfo, XmultiplDIPInfo, + xmultiplm72Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Dragon Breed (M81 PCB version) + +static struct BurnRomInfo dbreedRomDesc[] = { + { "db-a-h0-.59", 0x20000, 0xe1177267, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "db-a-l0-.68", 0x20000, 0xd82b167e, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "db-a-sp-.14", 0x10000, 0x54a61560, 0x06 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "db_k800m.00", 0x20000, 0xc027a8cf, 0x02 | BRF_GRA }, // 3 Sprites + { "db_k801m.10", 0x20000, 0x093faf33, 0x02 | BRF_GRA }, // 4 + { "db_k802m.20", 0x20000, 0x055b4c59, 0x02 | BRF_GRA }, // 5 + { "db_k803m.30", 0x20000, 0x8ed63922, 0x02 | BRF_GRA }, // 6 + + { "db_k804m.a0", 0x20000, 0x4c83e92e, 0x03 | BRF_GRA }, // 7 Foreground & Background Tiles + { "db_k805m.a1", 0x20000, 0x835ef268, 0x03 | BRF_GRA }, // 8 + { "db_k806m.a2", 0x20000, 0x5117f114, 0x03 | BRF_GRA }, // 9 + { "db_k807m.a3", 0x20000, 0x8eb0c978, 0x03 | BRF_GRA }, // 10 + + { "db_a-v0.rom", 0x20000, 0x312f7282, 0x05 | BRF_SND }, // 11 DAC Samples +}; + +STD_ROM_PICK(dbreed) +STD_ROM_FN(dbreed) + +static INT32 dbreedRomLoadCallback() +{ + memcpy (DrvV30ROM + 0x60000, DrvV30ROM + 0x20000, 0x20000); + + return 0; +} + +static INT32 dbreedInit() +{ + return DrvInit(common_080000_088000, sound_rom_map, dbreedRomLoadCallback, 0x20, Z80_REAL_NMI, 2); +} + +struct BurnDriver BurnDrvDbreed = { + "dbreed", NULL, NULL, NULL, "1989", + "Dragon Breed (M81 PCB version)\0", NULL, "Irem", "M81", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, dbreedRomInfo, dbreedRomName, NULL, NULL, CommonInputInfo, DbreedDIPInfo, + dbreedInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Dragon Breed (M72 PCB version) + +static struct BurnRomInfo dbreedm72RomDesc[] = { + { "db_c-h3.rom", 0x20000, 0x4bf3063c, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "db_c-l3.rom", 0x20000, 0xe4b89b79, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "db_c-h0.rom", 0x10000, 0x5aa79fb2, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "db_c-l0.rom", 0x10000, 0xed0f5e06, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "db_k800m.00", 0x20000, 0xc027a8cf, 0x02 | BRF_GRA }, // 4 Sprites + { "db_k801m.10", 0x20000, 0x093faf33, 0x02 | BRF_GRA }, // 5 + { "db_k802m.20", 0x20000, 0x055b4c59, 0x02 | BRF_GRA }, // 6 + { "db_k803m.30", 0x20000, 0x8ed63922, 0x02 | BRF_GRA }, // 7 + + { "db_k804m.a0", 0x20000, 0x4c83e92e, 0x03 | BRF_GRA }, // 8 Foreground Tiles + { "db_k805m.a1", 0x20000, 0x835ef268, 0x03 | BRF_GRA }, // 9 + { "db_k806m.a2", 0x20000, 0x5117f114, 0x03 | BRF_GRA }, // 10 + { "db_k807m.a3", 0x20000, 0x8eb0c978, 0x03 | BRF_GRA }, // 11 + + { "db_k804m.b0", 0x20000, 0x4c83e92e, 0x04 | BRF_GRA }, // 12 Background Tiles + { "db_k805m.b1", 0x20000, 0x835ef268, 0x04 | BRF_GRA }, // 13 + { "db_k806m.b2", 0x20000, 0x5117f114, 0x04 | BRF_GRA }, // 14 + { "db_k807m.b3", 0x20000, 0x8eb0c978, 0x04 | BRF_GRA }, // 15 + + { "db_c-v0.rom", 0x20000, 0x312f7282, 0x05 | BRF_SND }, // 16 DAC Samples + + { "dbreedm72_i8751.mcu",0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 17 i8751 Code +}; + +STD_ROM_PICK(dbreedm72) +STD_ROM_FN(dbreedm72) + +static INT32 dbreedm72RomLoadCallback() +{ + memcpy (DrvV30ROM + 0x60000, DrvV30ROM + 0x40000, 0x20000); + + return 0; +} + +static INT32 dbreedm72Init() +{ + install_protection(dbreedm72); + + return DrvInit(common_080000_090000, sound_ram_map, dbreedm72RomLoadCallback, 0x20, Z80_REAL_NMI, 0); +} + +struct BurnDriver BurnDrvDbreedm72 = { + "dbreedm72", "dbreed", NULL, NULL, "1989", + "Dragon Breed (M72 PCB version)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, dbreedm72RomInfo, dbreedm72RomName, NULL, NULL, CommonInputInfo, DbreedDIPInfo, + dbreedm72Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Battle Chopper + +static struct BurnRomInfo bchopperRomDesc[] = { + { "c-h0-b.rom", 0x10000, 0xf2feab16, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "c-l0-b.rom", 0x10000, 0x9f887096, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "c-h1-b.rom", 0x10000, 0xa995d64f, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "c-l1-b.rom", 0x10000, 0x41dda999, 0x01 | BRF_PRG | BRF_ESS }, // 3 + { "c-h3-b.rom", 0x10000, 0xab9451ca, 0x01 | BRF_PRG | BRF_ESS }, // 4 + { "c-l3-b.rom", 0x10000, 0x11562221, 0x01 | BRF_PRG | BRF_ESS }, // 5 + + { "c-00-a.rom", 0x10000, 0xf6e6e660, 0x02 | BRF_GRA }, // 6 Sprites + { "c-01-b.rom", 0x10000, 0x708cdd37, 0x02 | BRF_GRA }, // 7 + { "c-10-a.rom", 0x10000, 0x292c8520, 0x02 | BRF_GRA }, // 8 + { "c-11-b.rom", 0x10000, 0x20904cf3, 0x02 | BRF_GRA }, // 9 + { "c-20-a.rom", 0x10000, 0x1ab50c23, 0x02 | BRF_GRA }, // 10 + { "c-21-b.rom", 0x10000, 0xc823d34c, 0x02 | BRF_GRA }, // 11 + { "c-30-a.rom", 0x10000, 0x11f6c56b, 0x02 | BRF_GRA }, // 12 + { "c-31-b.rom", 0x10000, 0x23134ec5, 0x02 | BRF_GRA }, // 13 + + { "b-a0-b.rom", 0x10000, 0xe46ed7bf, 0x03 | BRF_GRA }, // 14 Foreground Tiles + { "b-a1-b.rom", 0x10000, 0x590605ff, 0x03 | BRF_GRA }, // 15 + { "b-a2-b.rom", 0x10000, 0xf8158226, 0x03 | BRF_GRA }, // 16 + { "b-a3-b.rom", 0x10000, 0x0f07b9b7, 0x03 | BRF_GRA }, // 17 + + { "b-b0-.rom", 0x10000, 0xb5b95776, 0x04 | BRF_GRA }, // 18 Background Tiles + { "b-b1-.rom", 0x10000, 0x74ca16ee, 0x04 | BRF_GRA }, // 19 + { "b-b2-.rom", 0x10000, 0xb82cca04, 0x04 | BRF_GRA }, // 20 + { "b-b3-.rom", 0x10000, 0xa7afc920, 0x04 | BRF_GRA }, // 21 + + { "c-v0-b.rom", 0x10000, 0xd0c27e58, 0x05 | BRF_SND }, // 22 DAC Samples + + { "bchopper_i8751.mcu", 0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 23 i8751 Code +}; + +STD_ROM_PICK(bchopper) +STD_ROM_FN(bchopper) + +static INT32 bchopperInit() +{ + install_protection(bchopper); + + return DrvInit(common_080000_0a0000, sound_ram_map, dbreedm72RomLoadCallback, 0x80, Z80_FAKE_NMI, 0); +} + +struct BurnDriver BurnDrvBchopper = { + "bchopper", NULL, NULL, NULL, "1987", + "Battle Chopper\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, bchopperRomInfo, bchopperRomName, NULL, NULL, CommonInputInfo, BchopperDIPInfo, + bchopperInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Mr. HELI no Dai-Bouken + +static struct BurnRomInfo mrheliRomDesc[] = { + { "mh-c-h0.bin", 0x10000, 0xe2ca5646, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "mh-c-l0.bin", 0x10000, 0x643e23cd, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "mh-c-h1.bin", 0x10000, 0x8974e84d, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "mh-c-l1.bin", 0x10000, 0x5f8bda69, 0x01 | BRF_PRG | BRF_ESS }, // 3 + { "mh-c-h3.bin", 0x10000, 0x143f596e, 0x01 | BRF_PRG | BRF_ESS }, // 4 + { "mh-c-l3.bin", 0x10000, 0xc0982536, 0x01 | BRF_PRG | BRF_ESS }, // 5 + + { "mh-c-00.bin", 0x20000, 0xdec4e121, 0x02 | BRF_GRA }, // 6 Sprites + { "mh-c-10.bin", 0x20000, 0x7aaa151e, 0x02 | BRF_GRA }, // 7 + { "mh-c-20.bin", 0x20000, 0xeae0de74, 0x02 | BRF_GRA }, // 8 + { "mh-c-30.bin", 0x20000, 0x01d5052f, 0x02 | BRF_GRA }, // 9 + + { "mh-b-a0.bin", 0x10000, 0x6a0db256, 0x03 | BRF_GRA }, // 10 Foreground Tiles + { "mh-b-a1.bin", 0x10000, 0x14ec9795, 0x03 | BRF_GRA }, // 11 + { "mh-b-a2.bin", 0x10000, 0xdfcb510e, 0x03 | BRF_GRA }, // 12 + { "mh-b-a3.bin", 0x10000, 0x957e329b, 0x03 | BRF_GRA }, // 13 + + { "b-b0-.rom", 0x10000, 0xb5b95776, 0x04 | BRF_GRA }, // 14 Background Tiles + { "b-b1-.rom", 0x10000, 0x74ca16ee, 0x04 | BRF_GRA }, // 15 + { "b-b2-.rom", 0x10000, 0xb82cca04, 0x04 | BRF_GRA }, // 16 + { "b-b3-.rom", 0x10000, 0xa7afc920, 0x04 | BRF_GRA }, // 17 + + { "c-v0-b.rom", 0x10000, 0xd0c27e58, 0x05 | BRF_SND }, // 18 DAC Samples + + { "mrheli_i8751.mcu", 0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 19 i8751 Code +}; + +STD_ROM_PICK(mrheli) +STD_ROM_FN(mrheli) + +static INT32 mrheliInit() +{ + m72_install_protection(bchopper_code, mrheli_crc, bchopper_sample_offsets); + + return DrvInit(common_080000_0a0000, sound_ram_map, dbreedm72RomLoadCallback, 0x80, Z80_FAKE_NMI, 0); +} + +struct BurnDriver BurnDrvMrheli = { + "mrheli", "bchopper", NULL, NULL, "1987", + "Mr. HELI no Dai-Bouken\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, mrheliRomInfo, mrheliRomName, NULL, NULL, CommonInputInfo, BchopperDIPInfo, + mrheliInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Ninja Spirit + +static struct BurnRomInfo nspiritRomDesc[] = { + { "nin-c-h0.rom", 0x10000, 0x035692fa, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "nin-c-l0.rom", 0x10000, 0x9a405898, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "nin-c-h1.rom", 0x10000, 0xcbc10586, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "nin-c-l1.rom", 0x10000, 0xb75c9a4d, 0x01 | BRF_PRG | BRF_ESS }, // 3 + { "nin-c-h2.rom", 0x10000, 0x8ad818fa, 0x01 | BRF_PRG | BRF_ESS }, // 4 + { "nin-c-l2.rom", 0x10000, 0xc52ca78c, 0x01 | BRF_PRG | BRF_ESS }, // 5 + { "nin-c-h3.rom", 0x10000, 0x501104ef, 0x01 | BRF_PRG | BRF_ESS }, // 6 + { "nin-c-l3.rom", 0x10000, 0xfd7408b8, 0x01 | BRF_PRG | BRF_ESS }, // 7 + + { "nin-r00.rom", 0x20000, 0x5f61d30b, 0x02 | BRF_GRA }, // 8 Sprites + { "nin-r10.rom", 0x20000, 0x0caad107, 0x02 | BRF_GRA }, // 9 + { "nin-r20.rom", 0x20000, 0xef3617d3, 0x02 | BRF_GRA }, // 10 + { "nin-r30.rom", 0x20000, 0x175d2a24, 0x02 | BRF_GRA }, // 11 + + { "nin-b-a0.rom", 0x10000, 0x63f8f658, 0x03 | BRF_GRA }, // 12 Foreground Tiles + { "nin-b-a1.rom", 0x10000, 0x75eb8306, 0x03 | BRF_GRA }, // 13 + { "nin-b-a2.rom", 0x10000, 0xdf532172, 0x03 | BRF_GRA }, // 14 + { "nin-b-a3.rom", 0x10000, 0x4dedd64c, 0x03 | BRF_GRA }, // 15 + + { "nin-b0.rom", 0x10000, 0x1b0e08a6, 0x04 | BRF_GRA }, // 16 Background Tiles + { "nin-b1.rom", 0x10000, 0x728727f0, 0x04 | BRF_GRA }, // 17 + { "nin-b2.rom", 0x10000, 0xf87efd75, 0x04 | BRF_GRA }, // 18 + { "nin-b3.rom", 0x10000, 0x98856cb4, 0x04 | BRF_GRA }, // 19 + + { "nin-v0.rom", 0x10000, 0xa32e8caf, 0x05 | BRF_SND }, // 20 DAC Samples + + { "nspirit_i8751.mcu", 0x01000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 21 i8751 Code +}; + +STD_ROM_PICK(nspirit) +STD_ROM_FN(nspirit) + +static INT32 nspiritInit() +{ + install_protection(nspirit); + + return DrvInit(common_080000_0a0000, sound_ram_map, NULL, 0x80, Z80_FAKE_NMI, 0); +} + +struct BurnDriver BurnDrvNspirit = { + "nspirit", NULL, NULL, NULL, "1988", + "Ninja Spirit\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, + NULL, nspiritRomInfo, nspiritRomName, NULL, NULL, CommonInputInfo, NspiritDIPInfo, + nspiritInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Saigo no Nindou (Japan) + +static struct BurnRomInfo nspiritjRomDesc[] = { + { "c-h0", 0x10000, 0x8603fab2, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "c-l0", 0x10000, 0xe520fa35, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "nin-c-h1.rom", 0x10000, 0xcbc10586, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "nin-c-l1.rom", 0x10000, 0xb75c9a4d, 0x01 | BRF_PRG | BRF_ESS }, // 3 + { "nin-c-h2.rom", 0x10000, 0x8ad818fa, 0x01 | BRF_PRG | BRF_ESS }, // 4 + { "nin-c-l2.rom", 0x10000, 0xc52ca78c, 0x01 | BRF_PRG | BRF_ESS }, // 5 + { "c-h3", 0x10000, 0x95b63a61, 0x01 | BRF_PRG | BRF_ESS }, // 6 + { "c-l3", 0x10000, 0xe754a87a, 0x01 | BRF_PRG | BRF_ESS }, // 7 + + { "nin-r00.rom", 0x20000, 0x5f61d30b, 0x02 | BRF_GRA }, // 8 Sprites + { "nin-r10.rom", 0x20000, 0x0caad107, 0x02 | BRF_GRA }, // 9 + { "nin-r20.rom", 0x20000, 0xef3617d3, 0x02 | BRF_GRA }, // 10 + { "nin-r30.rom", 0x20000, 0x175d2a24, 0x02 | BRF_GRA }, // 11 + + { "nin-b-a0.rom", 0x10000, 0x63f8f658, 0x03 | BRF_GRA }, // 12 Foreground Tiles + { "nin-b-a1.rom", 0x10000, 0x75eb8306, 0x03 | BRF_GRA }, // 13 + { "nin-b-a2.rom", 0x10000, 0xdf532172, 0x03 | BRF_GRA }, // 14 + { "nin-b-a3.rom", 0x10000, 0x4dedd64c, 0x03 | BRF_GRA }, // 15 + + { "nin-b0.rom", 0x10000, 0x1b0e08a6, 0x04 | BRF_GRA }, // 16 Background Tiles + { "nin-b1.rom", 0x10000, 0x728727f0, 0x04 | BRF_GRA }, // 17 + { "nin-b2.rom", 0x10000, 0xf87efd75, 0x04 | BRF_GRA }, // 18 + { "nin-b3.rom", 0x10000, 0x98856cb4, 0x04 | BRF_GRA }, // 19 + + { "nin-v0.rom", 0x10000, 0xa32e8caf, 0x05 | BRF_SND }, // 20 DAC Samples + + { "nin_c-pr.bin", 0x01000, 0x802d440a, 0x00 | BRF_OPT }, // 21 i8751 Code +}; + +STD_ROM_PICK(nspiritj) +STD_ROM_FN(nspiritj) + +static INT32 nspiritjInit() +{ + m72_install_protection(nspirit_code, nspiritj_crc, nspirit_sample_offsets); + + return DrvInit(common_080000_0a0000, sound_ram_map, NULL, 0x80, Z80_FAKE_NMI, 0); +} + +struct BurnDriver BurnDrvNspiritj = { + "nspiritj", "nspirit", NULL, NULL, "1988", + "Saigo no Nindou (Japan)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, + NULL, nspiritjRomInfo, nspiritjRomName, NULL, NULL, CommonInputInfo, NspiritDIPInfo, + nspiritjInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Image Fight (Japan, revision A) + +static struct BurnRomInfo imgfightRomDesc[] = { + { "if-c-h0-a.bin", 0x10000, 0xf5c94464, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "if-c-l0-a.bin", 0x10000, 0x87c534fe, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "if-c-h3.bin", 0x20000, 0xea030541, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "if-c-l3.bin", 0x20000, 0xc66ae348, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "if-c-00.bin", 0x20000, 0x745e6638, 0x02 | BRF_GRA }, // 4 Sprites + { "if-c-10.bin", 0x20000, 0xb7108449, 0x02 | BRF_GRA }, // 5 + { "if-c-20.bin", 0x20000, 0xaef33cba, 0x02 | BRF_GRA }, // 6 + { "if-c-30.bin", 0x20000, 0x1f98e695, 0x02 | BRF_GRA }, // 7 + + { "if-a-a0.bin", 0x10000, 0x34ee2d77, 0x03 | BRF_GRA }, // 8 Foreground Tiles + { "if-a-a1.bin", 0x10000, 0x6bd2845b, 0x03 | BRF_GRA }, // 9 + { "if-a-a2.bin", 0x10000, 0x090d50e5, 0x03 | BRF_GRA }, // 10 + { "if-a-a3.bin", 0x10000, 0x3a8e3083, 0x03 | BRF_GRA }, // 11 + + { "if-a-b0.bin", 0x10000, 0xb425c829, 0x04 | BRF_GRA }, // 12 Background Tiles + { "if-a-b1.bin", 0x10000, 0xe9bfe23e, 0x04 | BRF_GRA }, // 13 + { "if-a-b2.bin", 0x10000, 0x256e50f2, 0x04 | BRF_GRA }, // 14 + { "if-a-b3.bin", 0x10000, 0x4c682785, 0x04 | BRF_GRA }, // 15 + + { "if-c-v0.bin", 0x10000, 0xcb64a194, 0x05 | BRF_SND }, // 16 DAC Samples + { "if-c-v1.bin", 0x10000, 0x45b68bf5, 0x05 | BRF_SND }, // 17 + + { "imgfight_i8751h.bin",0x01000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 18 i8751 Code +}; + +STD_ROM_PICK(imgfight) +STD_ROM_FN(imgfight) + +static INT32 imgfightRomLoadCallback() +{ + memcpy (DrvV30ROM + 0x40000, DrvV30ROM + 0x20000, 0x40000); + + return 0; +} + +static INT32 imgfightInit() +{ + install_protection(imgfight); + + return DrvInit(common_080000_0a0000, sound_ram_map, imgfightRomLoadCallback, 0x80, Z80_FAKE_NMI, 0); +} + +struct BurnDriver BurnDrvImgfight = { + "imgfight", NULL, NULL, NULL, "1988", + "Image Fight (Japan, revision A)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_VERSHOOT, 0, + NULL, imgfightRomInfo, imgfightRomName, NULL, NULL, CommonInputInfo, ImgfightDIPInfo, + imgfightInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 256, 384, 3, 4 +}; + + +// Image Fight (Japan) + +static struct BurnRomInfo imgfightjRomDesc[] = { + { "if-c-h0.bin", 0x10000, 0x592d2d80, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "if-c-l0.bin", 0x10000, 0x61f89056, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "if-c-h3.bin", 0x20000, 0xea030541, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "if-c-l3.bin", 0x20000, 0xc66ae348, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "if-c-00.bin", 0x20000, 0x745e6638, 0x02 | BRF_GRA }, // 4 Sprites + { "if-c-10.bin", 0x20000, 0xb7108449, 0x02 | BRF_GRA }, // 5 + { "if-c-20.bin", 0x20000, 0xaef33cba, 0x02 | BRF_GRA }, // 6 + { "if-c-30.bin", 0x20000, 0x1f98e695, 0x02 | BRF_GRA }, // 7 + + { "if-a-a0.bin", 0x10000, 0x34ee2d77, 0x03 | BRF_GRA }, // 8 Foreground Tiles + { "if-a-a1.bin", 0x10000, 0x6bd2845b, 0x03 | BRF_GRA }, // 9 + { "if-a-a2.bin", 0x10000, 0x090d50e5, 0x03 | BRF_GRA }, // 10 + { "if-a-a3.bin", 0x10000, 0x3a8e3083, 0x03 | BRF_GRA }, // 11 + + { "if-a-b0.bin", 0x10000, 0xb425c829, 0x04 | BRF_GRA }, // 12 Background Tiles + { "if-a-b1.bin", 0x10000, 0xe9bfe23e, 0x04 | BRF_GRA }, // 13 + { "if-a-b2.bin", 0x10000, 0x256e50f2, 0x04 | BRF_GRA }, // 14 + { "if-a-b3.bin", 0x10000, 0x4c682785, 0x04 | BRF_GRA }, // 15 + + { "if-c-v0.bin", 0x10000, 0xcb64a194, 0x05 | BRF_SND }, // 16 DAC Samples + { "if-c-v1.bin", 0x10000, 0x45b68bf5, 0x05 | BRF_SND }, // 17 + + { "imgfightj_i8751h.bin",0x01000, 0xef0d5098, 0x00 | BRF_OPT }, // 18 i8751 Code +}; + +STD_ROM_PICK(imgfightj) +STD_ROM_FN(imgfightj) + +struct BurnDriver BurnDrvImgfightj = { + "imgfightj", "imgfight", NULL, NULL, "1988", + "Image Fight (Japan)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_VERSHOOT, 0, + NULL, imgfightjRomInfo, imgfightjRomName, NULL, NULL, CommonInputInfo, ImgfightDIPInfo, + imgfightInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 256, 384, 3, 4 +}; + + +// Air Duel (Japan) + +static struct BurnRomInfo airduelRomDesc[] = { + { "ad-c-h0.bin", 0x20000, 0x12140276, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "ad-c-l0.bin", 0x20000, 0x4ac0b91d, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ad-c-h3.bin", 0x20000, 0x9f7cfca3, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ad-c-l3.bin", 0x20000, 0x9dd343f7, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ad-00.bin", 0x20000, 0x2f0d599b, 0x02 | BRF_GRA }, // 4 Sprites + { "ad-10.bin", 0x20000, 0x9865856b, 0x02 | BRF_GRA }, // 5 + { "ad-20.bin", 0x20000, 0xd392aef2, 0x02 | BRF_GRA }, // 6 + { "ad-30.bin", 0x20000, 0x923240c3, 0x02 | BRF_GRA }, // 7 + + { "ad-a0.bin", 0x20000, 0xce134b47, 0x03 | BRF_GRA }, // 8 Foreground Tiles + { "ad-a1.bin", 0x20000, 0x097fd853, 0x03 | BRF_GRA }, // 9 + { "ad-a2.bin", 0x20000, 0x6a94c1b9, 0x03 | BRF_GRA }, // 10 + { "ad-a3.bin", 0x20000, 0x6637c349, 0x03 | BRF_GRA }, // 11 + + { "ad-b0.bin", 0x20000, 0xce134b47, 0x04 | BRF_GRA }, // 12 Background Tiles + { "ad-b1.bin", 0x20000, 0x097fd853, 0x04 | BRF_GRA }, // 13 + { "ad-b2.bin", 0x20000, 0x6a94c1b9, 0x04 | BRF_GRA }, // 14 + { "ad-b3.bin", 0x20000, 0x6637c349, 0x04 | BRF_GRA }, // 15 + + { "ad-v0.bin", 0x20000, 0x339f474d, 0x05 | BRF_SND }, // 16 DAC Samples + + { "airduel_i8751.mcu", 0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 17 i8751 Code +}; + +STD_ROM_PICK(airduel) +STD_ROM_FN(airduel) + +static INT32 airduelInit() +{ + install_protection(airduel); + + return DrvInit(common_080000_0a0000, sound_ram_map, NULL, 0x80, Z80_FAKE_NMI, 0); +} + +struct BurnDriver BurnDrvAirduel = { + "airduel", NULL, NULL, NULL, "1990", + "Air Duel (Japan)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_VERSHOOT, 0, + NULL, airduelRomInfo, airduelRomName, NULL, NULL, CommonInputInfo, AirduelDIPInfo, + airduelInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 256, 384, 3, 4 +}; + + +// R-Type II + +static struct BurnRomInfo rtype2RomDesc[] = { + { "rt2-a-h0-d.54", 0x20000, 0xd8ece6f4, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "rt2-a-l0-d.60", 0x20000, 0x32cfb2e4, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "rt2-a-h1-d.53", 0x20000, 0x4f6e9b15, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "rt2-a-l1-d.59", 0x20000, 0x0fd123bf, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ic17.4f", 0x10000, 0x73ffecb4, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "ic31.6l", 0x20000, 0x2cd8f913, 0x02 | BRF_GRA }, // 5 Sprites + { "ic21.4l", 0x20000, 0x5033066d, 0x02 | BRF_GRA }, // 6 + { "ic32.6m", 0x20000, 0xec3a0450, 0x02 | BRF_GRA }, // 7 + { "ic22.4m", 0x20000, 0xdb6176fc, 0x02 | BRF_GRA }, // 8 + + { "ic50.7s", 0x20000, 0xf3f8736e, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "ic51.7u", 0x20000, 0xb4c543af, 0x03 | BRF_GRA }, // 10 + { "ic56.8s", 0x20000, 0x4cb80d66, 0x03 | BRF_GRA }, // 11 + { "ic57.8u", 0x20000, 0xbee128e0, 0x03 | BRF_GRA }, // 12 + { "ic65.9r", 0x20000, 0x2dc9c71a, 0x03 | BRF_GRA }, // 13 + { "ic66.9u", 0x20000, 0x7533c428, 0x03 | BRF_GRA }, // 14 + { "ic63.9m", 0x20000, 0xa6ad67f2, 0x03 | BRF_GRA }, // 15 + { "ic64.9p", 0x20000, 0x3686d555, 0x03 | BRF_GRA }, // 16 + + { "ic14.4c", 0x20000, 0x637172d5, 0x05 | BRF_SND }, // 17 DAC Samples +}; + +STD_ROM_PICK(rtype2) +STD_ROM_FN(rtype2) + +static INT32 rtype2Init() +{ + return DrvInit(rtype2_main_cpu_map, sound_rom_map, NULL, 0x80, Z80_REAL_NMI, 1); +} + +struct BurnDriver BurnDrvRtype2 = { + "rtype2", NULL, NULL, NULL, "1989", + "R-Type II\0", NULL, "Irem", "M82", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, rtype2RomInfo, rtype2RomName, NULL, NULL, CommonInputInfo, Rtype2DIPInfo, + rtype2Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// R-Type II (Japan) + +static struct BurnRomInfo rtype2jRomDesc[] = { + { "rt2-a-h0.54", 0x20000, 0x7857ccf6, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "rt2-a-l0.60", 0x20000, 0xcb22cd6e, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "rt2-a-h1.53", 0x20000, 0x49e75d28, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "rt2-a-l1.59", 0x20000, 0x12ec1676, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ic17.4f", 0x10000, 0x73ffecb4, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "ic31.6l", 0x20000, 0x2cd8f913, 0x02 | BRF_GRA }, // 5 Sprites + { "ic21.4l", 0x20000, 0x5033066d, 0x02 | BRF_GRA }, // 6 + { "ic32.6m", 0x20000, 0xec3a0450, 0x02 | BRF_GRA }, // 7 + { "ic22.4m", 0x20000, 0xdb6176fc, 0x02 | BRF_GRA }, // 8 + + { "ic50.7s", 0x20000, 0xf3f8736e, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "ic51.7u", 0x20000, 0xb4c543af, 0x03 | BRF_GRA }, // 10 + { "ic56.8s", 0x20000, 0x4cb80d66, 0x03 | BRF_GRA }, // 11 + { "ic57.8u", 0x20000, 0xbee128e0, 0x03 | BRF_GRA }, // 12 + { "ic65.9r", 0x20000, 0x2dc9c71a, 0x03 | BRF_GRA }, // 13 + { "ic66.9u", 0x20000, 0x7533c428, 0x03 | BRF_GRA }, // 14 + { "ic63.9m", 0x20000, 0xa6ad67f2, 0x03 | BRF_GRA }, // 15 + { "ic64.9p", 0x20000, 0x3686d555, 0x03 | BRF_GRA }, // 16 + + { "ic14.4c", 0x20000, 0x637172d5, 0x05 | BRF_SND }, // 17 DAC Samples +}; + +STD_ROM_PICK(rtype2j) +STD_ROM_FN(rtype2j) + +struct BurnDriver BurnDrvRtype2j = { + "rtype2j", "rtype2", NULL, NULL, "1989", + "R-Type II (Japan)\0", NULL, "Irem", "M82", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, rtype2jRomInfo, rtype2jRomName, NULL, NULL, CommonInputInfo, Rtype2DIPInfo, + rtype2Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// R-Type II (Japan, revision C) + +static struct BurnRomInfo rtype2jcRomDesc[] = { + { "rt2-a-h0-c.54", 0x20000, 0xef9a9990, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "rt2-a-l0-c.60", 0x20000, 0xd8b9da64, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "rt2-a-h1-c.53", 0x20000, 0x1b1870f4, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "rt2-a-l1-c.59", 0x20000, 0x60fdff35, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ic17.4f", 0x10000, 0x73ffecb4, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "ic31.6l", 0x20000, 0x2cd8f913, 0x02 | BRF_GRA }, // 5 Sprites + { "ic21.4l", 0x20000, 0x5033066d, 0x02 | BRF_GRA }, // 6 + { "ic32.6m", 0x20000, 0xec3a0450, 0x02 | BRF_GRA }, // 7 + { "ic22.4m", 0x20000, 0xdb6176fc, 0x02 | BRF_GRA }, // 8 + + { "ic50.7s", 0x20000, 0xf3f8736e, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "ic51.7u", 0x20000, 0xb4c543af, 0x03 | BRF_GRA }, // 10 + { "ic56.8s", 0x20000, 0x4cb80d66, 0x03 | BRF_GRA }, // 11 + { "ic57.8u", 0x20000, 0xbee128e0, 0x03 | BRF_GRA }, // 12 + { "ic65.9r", 0x20000, 0x2dc9c71a, 0x03 | BRF_GRA }, // 13 + { "ic66.9u", 0x20000, 0x7533c428, 0x03 | BRF_GRA }, // 14 + { "ic63.9m", 0x20000, 0xa6ad67f2, 0x03 | BRF_GRA }, // 15 + { "ic64.9p", 0x20000, 0x3686d555, 0x03 | BRF_GRA }, // 16 + + { "ic14.4c", 0x20000, 0x637172d5, 0x05 | BRF_SND }, // 17 DAC Samples +}; + +STD_ROM_PICK(rtype2jc) +STD_ROM_FN(rtype2jc) + +struct BurnDriver BurnDrvRtype2jc = { + "rtype2jc", "rtype2", NULL, NULL, "1989", + "R-Type II (Japan, revision C)\0", NULL, "Irem", "M82", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, rtype2jcRomInfo, rtype2jcRomName, NULL, NULL, CommonInputInfo, Rtype2DIPInfo, + rtype2Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Hammerin' Harry (World) + +static struct BurnRomInfo hharryRomDesc[] = { + { "a-h0-v.rom", 0x20000, 0xc52802a5, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "a-l0-v.rom", 0x20000, 0xf463074c, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "a-h1-0.rom", 0x10000, 0x3ae21335, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "a-l1-0.rom", 0x10000, 0xbc6ac5f9, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "a-sp-0.rom", 0x10000, 0x80e210e7, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "hh_00.rom", 0x20000, 0xec5127ef, 0x02 | BRF_GRA }, // 5 Sprites + { "hh_10.rom", 0x20000, 0xdef65294, 0x02 | BRF_GRA }, // 6 + { "hh_20.rom", 0x20000, 0xbb0d6ad4, 0x02 | BRF_GRA }, // 7 + { "hh_30.rom", 0x20000, 0x4351044e, 0x02 | BRF_GRA }, // 8 + + { "hh_a0.rom", 0x20000, 0xc577ba5f, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "hh_a1.rom", 0x20000, 0x429d12ab, 0x03 | BRF_GRA }, // 10 + { "hh_a2.rom", 0x20000, 0xb5b163b0, 0x03 | BRF_GRA }, // 11 + { "hh_a3.rom", 0x20000, 0x8ef566a1, 0x03 | BRF_GRA }, // 12 + + { "a-v0-0.rom", 0x20000, 0xfaaacaff, 0x05 | BRF_SND }, // 13 DAC Samples +}; + +STD_ROM_PICK(hharry) +STD_ROM_FN(hharry) + +static INT32 hharryInit() +{ + return DrvInit(common_080000_0a0000, sound_rom_map, dbreedm72RomLoadCallback, 0x20, Z80_REAL_NMI, 2); +} + +struct BurnDriver BurnDrvHharry = { + "hharry", NULL, NULL, NULL, "1990", + "Hammerin' Harry (World)\0", NULL, "Irem", "M82", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT | GBF_PLATFORM, 0, + NULL, hharryRomInfo, hharryRomName, NULL, NULL, CommonInputInfo, HharryDIPInfo, + hharryInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Hammerin' Harry (US) + +static struct BurnRomInfo hharryuRomDesc[] = { + { "a-ho-u.8d", 0x20000, 0xede7f755, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "a-lo-u.9d", 0x20000, 0xdf0726ae, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "a-h1-f.8b", 0x10000, 0x31b741c5, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "a-l1-f.9b", 0x10000, 0xb23e966c, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "a-sp-0.rom", 0x10000, 0x80e210e7, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "hh_00.rom", 0x20000, 0xec5127ef, 0x02 | BRF_GRA }, // 5 Sprites + { "hh_10.rom", 0x20000, 0xdef65294, 0x02 | BRF_GRA }, // 6 + { "hh_20.rom", 0x20000, 0xbb0d6ad4, 0x02 | BRF_GRA }, // 7 + { "hh_30.rom", 0x20000, 0x4351044e, 0x02 | BRF_GRA }, // 8 + + { "hh_a0.rom", 0x20000, 0xc577ba5f, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "hh_a1.rom", 0x20000, 0x429d12ab, 0x03 | BRF_GRA }, // 10 + { "hh_a2.rom", 0x20000, 0xb5b163b0, 0x03 | BRF_GRA }, // 11 + { "hh_a3.rom", 0x20000, 0x8ef566a1, 0x03 | BRF_GRA }, // 12 + + { "a-v0-0.rom", 0x20000, 0xfaaacaff, 0x05 | BRF_SND }, // 13 DAC Samples +}; + +STD_ROM_PICK(hharryu) +STD_ROM_FN(hharryu) + +static INT32 hharryuInit() +{ + return DrvInit(hharryu_main_cpu_map, sound_rom_map, dbreedm72RomLoadCallback, 0x20, Z80_REAL_NMI, 1); +} + +struct BurnDriver BurnDrvHharryu = { + "hharryu", "hharry", NULL, NULL, "1990", + "Hammerin' Harry (US)\0", NULL, "Irem America", "M82", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT | GBF_PLATFORM, 0, + NULL, hharryuRomInfo, hharryuRomName, NULL, NULL, CommonInputInfo, HharryDIPInfo, + hharryuInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Daiku no Gensan (Japan, M82) + +static struct BurnRomInfo dkgensanRomDesc[] = { + { "gen-a-h0.bin", 0x20000, 0x07a45f6d, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "gen-a-l0.bin", 0x20000, 0x46478fea, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "gen-a-h1.bin", 0x10000, 0x54e5b73c, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "gen-a-l1.bin", 0x10000, 0x894f8a9f, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "gen-a-sp.bin", 0x10000, 0xe83cfc2c, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "hh_00.rom", 0x20000, 0xec5127ef, 0x02 | BRF_GRA }, // 5 Sprites + { "hh_10.rom", 0x20000, 0xdef65294, 0x02 | BRF_GRA }, // 6 + { "hh_20.rom", 0x20000, 0xbb0d6ad4, 0x02 | BRF_GRA }, // 7 + { "hh_30.rom", 0x20000, 0x4351044e, 0x02 | BRF_GRA }, // 8 + + { "hh_a0.rom", 0x20000, 0xc577ba5f, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "hh_a1.rom", 0x20000, 0x429d12ab, 0x03 | BRF_GRA }, // 10 + { "hh_a2.rom", 0x20000, 0xb5b163b0, 0x03 | BRF_GRA }, // 11 + { "hh_a3.rom", 0x20000, 0x8ef566a1, 0x03 | BRF_GRA }, // 12 + + { "gen-vo.bin", 0x20000, 0xd8595c66, 0x05 | BRF_SND }, // 13 DAC Samples +}; + +STD_ROM_PICK(dkgensan) +STD_ROM_FN(dkgensan) + +struct BurnDriver BurnDrvDkgensan = { + "dkgensan", "hharry", NULL, NULL, "1990", + "Daiku no Gensan (Japan, M82)\0", NULL, "Irem", "M82", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT | GBF_PLATFORM, 0, + NULL, dkgensanRomInfo, dkgensanRomName, NULL, NULL, CommonInputInfo, HharryDIPInfo, + hharryuInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Daiku no Gensan (Japan, M72) + +static struct BurnRomInfo dkgensanm72RomDesc[] = { + { "ge72-h0.bin", 0x20000, 0xa0ad992c, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "ge72-l0.bin", 0x20000, 0x996396f0, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ge72-h3.bin", 0x10000, 0xd8b86005, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ge72-l3.bin", 0x10000, 0x23d303a5, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "hh_00.rom", 0x20000, 0xec5127ef, 0x02 | BRF_GRA }, // 4 Sprites + { "hh_10.rom", 0x20000, 0xdef65294, 0x02 | BRF_GRA }, // 5 + { "hh_20.rom", 0x20000, 0xbb0d6ad4, 0x02 | BRF_GRA }, // 6 + { "hh_30.rom", 0x20000, 0x4351044e, 0x02 | BRF_GRA }, // 7 + + { "ge72b-a0.bin", 0x10000, 0xf5f56b2a, 0x03 | BRF_GRA }, // 8 Foreground Tiles + { "ge72-a1.bin", 0x10000, 0xd194ea08, 0x03 | BRF_GRA }, // 9 + { "ge72-a2.bin", 0x10000, 0x2b06bcc3, 0x03 | BRF_GRA }, // 10 + { "ge72-a3.bin", 0x10000, 0x94b96bfa, 0x03 | BRF_GRA }, // 11 + + { "ge72-b0.bin", 0x10000, 0x208796b3, 0x04 | BRF_GRA }, // 12 Background Tiles + { "ge72-b1.bin", 0x10000, 0xb4a7f490, 0x04 | BRF_GRA }, // 13 + { "ge72b-b2.bin", 0x10000, 0x34fe8f7f, 0x04 | BRF_GRA }, // 14 + { "ge72b-b3.bin", 0x10000, 0x4b0e92f4, 0x04 | BRF_GRA }, // 15 + + { "gen-vo.bin", 0x20000, 0xd8595c66, 0x05 | BRF_SND }, // 16 DAC Samples + + { "dkgenm72_i8751.mcu", 0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 17 i8751 Code +}; + +STD_ROM_PICK(dkgensanm72) +STD_ROM_FN(dkgensanm72) + +static INT32 dkgensanm72Init() +{ + install_protection(dkgenm72); + + return DrvInit(common_080000_0a0000, sound_ram_map, dbreedm72RomLoadCallback, 0x20, Z80_FAKE_NMI, 0); +} + +struct BurnDriver BurnDrvDkgensanm72 = { + "dkgensanm72", "hharry", NULL, NULL, "1990", + "Daiku no Gensan (Japan, M72)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT | GBF_PLATFORM, 0, + NULL, dkgensanm72RomInfo, dkgensanm72RomName, NULL, NULL, CommonInputInfo, HharryDIPInfo, + dkgensanm72Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Ken-Go + +static struct BurnRomInfo kengoRomDesc[] = { + { "ken_d-h0.rom", 0x20000, 0xf4ddeea5, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "ken_d-l0.rom", 0x20000, 0x04dc0f81, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "ken_d-sp.rom", 0x10000, 0x233ca1cf, 0x06 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "ken_m31.rom", 0x20000, 0xe00b95a6, 0x02 | BRF_GRA }, // 3 Sprites + { "ken_m21.rom", 0x20000, 0xd7722f87, 0x02 | BRF_GRA }, // 4 + { "ken_m32.rom", 0x20000, 0x30a844c4, 0x02 | BRF_GRA }, // 5 + { "ken_m22.rom", 0x20000, 0xa00dac85, 0x02 | BRF_GRA }, // 6 + + { "ken_m51.rom", 0x20000, 0x1646cf4f, 0x03 | BRF_GRA }, // 7 Foreground & Background Tiles + { "ken_m57.rom", 0x20000, 0xa9f88d90, 0x03 | BRF_GRA }, // 8 + { "ken_m66.rom", 0x20000, 0xe9d17645, 0x03 | BRF_GRA }, // 9 + { "ken_m64.rom", 0x20000, 0xdf46709b, 0x03 | BRF_GRA }, // 10 + + { "ken_m14.rom", 0x20000, 0x6651e9b7, 0x05 | BRF_SND }, // 11 DAC Samples +}; + +STD_ROM_PICK(kengo) +STD_ROM_FN(kengo) + +static INT32 kengoInit() +{ + INT32 nRet = DrvInit(hharryu_main_cpu_map, sound_rom_map, NULL, 0x60, Z80_REAL_NMI, 1); + + if (nRet == 0) { + VezOpen(0); + VezSetDecode((UINT8*)gunforce_decryption_table); + VezClose(); + } + + return nRet; +} + +struct BurnDriverD BurnDrvKengo = { + "kengo", NULL, NULL, NULL, "1991", + "Ken-Go\0", NULL, "Irem", "M84?", + NULL, NULL, NULL, NULL, + 0, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, + NULL, kengoRomInfo, kengoRomName, NULL, NULL, CommonInputInfo, KengoDIPInfo, + kengoInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Cosmic Cop (World) + +static struct BurnRomInfo cosmccopRomDesc[] = { + { "cc-d-h0b.bin", 0x40000, 0x38958b01, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "cc-d-l0b.bin", 0x40000, 0xeff87f70, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "cc-d-sp.bin", 0x10000, 0x3e3ace60, 0x06 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "cc-c-00.bin", 0x20000, 0x9d99deaa, 0x02 | BRF_GRA }, // 3 Sprites + { "cc-c-10.bin", 0x20000, 0x7eb083ed, 0x02 | BRF_GRA }, // 4 + { "cc-c-20.bin", 0x20000, 0x9421489e, 0x02 | BRF_GRA }, // 5 + { "cc-c-30.bin", 0x20000, 0x920ec735, 0x02 | BRF_GRA }, // 6 + + { "cc-d-g00.bin", 0x20000, 0xe7f3d772, 0x03 | BRF_GRA }, // 7 Foreground & Background Tiles + { "cc-d-g10.bin", 0x20000, 0x418b4e4c, 0x03 | BRF_GRA }, // 8 + { "cc-d-g20.bin", 0x20000, 0xa4b558eb, 0x03 | BRF_GRA }, // 9 + { "cc-d-g30.bin", 0x20000, 0xf64a3166, 0x03 | BRF_GRA }, // 10 + + { "cc-c-v0.bin", 0x20000, 0x6247bade, 0x05 | BRF_SND }, // 11 DAC Samples +}; + +STD_ROM_PICK(cosmccop) +STD_ROM_FN(cosmccop) + +static INT32 cosmccopInit() +{ + return DrvInit(hharryu_main_cpu_map, sound_rom_map, NULL, 0x60, Z80_REAL_NMI, 1); +} + +struct BurnDriver BurnDrvCosmccop = { + "cosmccop", NULL, NULL, NULL, "1991", + "Cosmic Cop (World)\0", NULL, "Irem", "M84", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, cosmccopRomInfo, cosmccopRomName, NULL, NULL, CommonInputInfo, GallopDIPInfo, + cosmccopInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Gallop - Armed police Unit (Japan) + +static struct BurnRomInfo gallopRomDesc[] = { + { "cc-c-h0.bin", 0x20000, 0x2217dcd0, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "cc-c-l0.bin", 0x20000, 0xff39d7fb, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "cc-c-h3.bin", 0x20000, 0x9b2bbab9, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "cc-c-l3.bin", 0x20000, 0xacd3278e, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "cc-c-00.bin", 0x20000, 0x9d99deaa, 0x02 | BRF_GRA }, // 4 Sprites + { "cc-c-10.bin", 0x20000, 0x7eb083ed, 0x02 | BRF_GRA }, // 5 + { "cc-c-20.bin", 0x20000, 0x9421489e, 0x02 | BRF_GRA }, // 6 + { "cc-c-30.bin", 0x20000, 0x920ec735, 0x02 | BRF_GRA }, // 7 + + { "cc-b-a0.bin", 0x10000, 0xa33472bd, 0x03 | BRF_GRA }, // 8 Foreground Tiles + { "cc-b-a1.bin", 0x10000, 0x118b1f2d, 0x03 | BRF_GRA }, // 9 + { "cc-b-a2.bin", 0x10000, 0x83cebf48, 0x03 | BRF_GRA }, // 10 + { "cc-b-a3.bin", 0x10000, 0x572903fc, 0x03 | BRF_GRA }, // 11 + + { "cc-b-b0.bin", 0x10000, 0x0df5b439, 0x04 | BRF_GRA }, // 12 Background Tiles + { "cc-b-b1.bin", 0x10000, 0x010b778f, 0x04 | BRF_GRA }, // 13 + { "cc-b-b2.bin", 0x10000, 0xbda9f6fb, 0x04 | BRF_GRA }, // 14 + { "cc-b-b3.bin", 0x10000, 0xd361ba3f, 0x04 | BRF_GRA }, // 15 + + { "cc-c-v0.bin", 0x20000, 0x6247bade, 0x05 | BRF_SND }, // 16 DAC Samples +}; + +STD_ROM_PICK(gallop) +STD_ROM_FN(gallop) + +static INT32 gallopInit() +{ + protection_sample_offsets = gallop_sample_offsets; + + return DrvInit(common_080000_0a0000, sound_ram_map, NULL, 0x80, Z80_FAKE_NMI, 0); +} + +struct BurnDriver BurnDrvGallop = { + "gallop", "cosmccop", NULL, NULL, "1991", + "Gallop - Armed police Unit (Japan)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_HORSHOOT, 0, + NULL, gallopRomInfo, gallopRomName, NULL, NULL, CommonInputInfo, GallopDIPInfo, + gallopInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + + +// Legend of Hero Tonma + +static struct BurnRomInfo lohtRomDesc[] = { + { "tom_c-h0.rom", 0x20000, 0xa63204b6, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "tom_c-l0.rom", 0x20000, 0xe788002f, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "tom_c-h3-", 0x20000, 0x714778b5, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "tom_c-l3-", 0x20000, 0x2f049b03, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "tom_m53.rom", 0x20000, 0x0b83265f, 0x02 | BRF_GRA }, // 4 Sprites + { "tom_m51.rom", 0x20000, 0x8ec5f6f3, 0x02 | BRF_GRA }, // 5 + { "tom_m49.rom", 0x20000, 0xa41d3bfd, 0x02 | BRF_GRA }, // 6 + { "tom_m47.rom", 0x20000, 0x9d81a25b, 0x02 | BRF_GRA }, // 7 + + { "tom_m21.rom", 0x10000, 0x3ca3e771, 0x03 | BRF_GRA }, // 8 Foreground Tiles + { "tom_m22.rom", 0x10000, 0x7a05ee2f, 0x03 | BRF_GRA }, // 9 + { "tom_m20.rom", 0x10000, 0x79aa2335, 0x03 | BRF_GRA }, // 10 + { "tom_m23.rom", 0x10000, 0x789e8b24, 0x03 | BRF_GRA }, // 11 + + { "tom_m26.rom", 0x10000, 0x44626bf6, 0x04 | BRF_GRA }, // 12 Background Tiles + { "tom_m27.rom", 0x10000, 0x464952cf, 0x04 | BRF_GRA }, // 13 + { "tom_m25.rom", 0x10000, 0x3db9b2c7, 0x04 | BRF_GRA }, // 14 + { "tom_m24.rom", 0x10000, 0xf01fe899, 0x04 | BRF_GRA }, // 15 + + { "tom_m44.rom", 0x10000, 0x3ed51d1f, 0x05 | BRF_SND }, // 16 DAC Samples + + { "loht_i8751.mcu", 0x10000, 0x00000000, 0x00 | BRF_OPT | BRF_NODUMP }, // 17 i8751 Code +}; + +STD_ROM_PICK(loht) +STD_ROM_FN(loht) + +static INT32 lohtInit() +{ + install_protection(loht); + + return DrvInit(common_080000_0a0000, sound_ram_map, NULL, 0x80, Z80_FAKE_NMI, 0); +} + +struct BurnDriver BurnDrvLoht = { + "loht", NULL, NULL, NULL, "1989", + "Legend of Hero Tonma\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, + NULL, lohtRomInfo, lohtRomName, NULL, NULL, CommonInputInfo, LohtDIPInfo, + lohtInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Legend of Hero Tonma (Japan) + +static struct BurnRomInfo lohtjRomDesc[] = { + { "tom_c-h0-", 0x20000, 0x2a752998, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "tom_c-l0-", 0x20000, 0xa224d928, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "tom_c-h3-", 0x20000, 0x714778b5, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "tom_c-l3-", 0x20000, 0x2f049b03, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "r200", 0x20000, 0x0b83265f, 0x02 | BRF_GRA }, // 4 Sprites + { "r210", 0x20000, 0x8ec5f6f3, 0x02 | BRF_GRA }, // 5 + { "r220", 0x20000, 0xa41d3bfd, 0x02 | BRF_GRA }, // 6 + { "r230", 0x20000, 0x9d81a25b, 0x02 | BRF_GRA }, // 7 + + { "r2a0.a0", 0x10000, 0x3ca3e771, 0x03 | BRF_GRA }, // 8 Foreground Tiles + { "r2a1.a1", 0x10000, 0x7a05ee2f, 0x03 | BRF_GRA }, // 9 + { "r2a2.a2", 0x10000, 0x79aa2335, 0x03 | BRF_GRA }, // 10 + { "r2a3.a3", 0x10000, 0x789e8b24, 0x03 | BRF_GRA }, // 11 + + { "078.b0", 0x10000, 0x44626bf6, 0x04 | BRF_GRA }, // 12 Background Tiles + { "079.b1", 0x10000, 0x464952cf, 0x04 | BRF_GRA }, // 13 + { "080.b2", 0x10000, 0x3db9b2c7, 0x04 | BRF_GRA }, // 14 + { "081.b3", 0x10000, 0xf01fe899, 0x04 | BRF_GRA }, // 15 + + { "082", 0x10000, 0x3ed51d1f, 0x05 | BRF_SND }, // 16 DAC Samples + + { "tom_c-pr.bin", 0x01000, 0x9fa9b496, 0x00 | BRF_OPT }, // 17 i8751 Code +}; + +STD_ROM_PICK(lohtj) +STD_ROM_FN(lohtj) + +struct BurnDriver BurnDrvLohtj = { + "lohtj", "loht", NULL, NULL, "1989", + "Legend of Hero Tonma (Japan)\0", NULL, "Irem", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, + NULL, lohtjRomInfo, lohtjRomName, NULL, NULL, CommonInputInfo, LohtDIPInfo, + lohtInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + +static INT32 lohtbRomLoadCallback() +{ + // Hack the program rom to work for now + UINT8 _0x400[216] = { + 0xFA, 0xB9, 0xFF, 0xFF, 0xE2, 0xFE, 0xB8, 0x17, 0x00, 0xE7, 0x40, 0xB8, 0x20, 0x00, 0xE7, 0x42, + 0xB8, 0x0F, 0x00, 0xE7, 0x42, 0xB8, 0x00, 0xA0, 0x8E, 0xD0, 0x8E, 0xD8, 0xBE, 0x00, 0x3F, 0xB0, + 0x00, 0x88, 0x04, 0x3A, 0x04, 0x75, 0x08, 0x46, 0xFE, 0xC0, 0x75, 0xF5, 0xE9, 0x18, 0x00, 0x33, + 0xF6, 0xE9, 0x03, 0x00, 0xBE, 0x40, 0x00, 0xB8, 0x00, 0xB0, 0x8E, 0xD8, 0xC7, 0x06, 0xFE, 0x0F, + 0x00, 0x00, 0xEA, 0x62, 0x11, 0x00, 0x00, 0xE5, 0x04, 0x0F, 0x19, 0xC0, 0x0F, 0x74, 0xE0, 0xBC, + 0x00, 0x40, 0x33, 0xDB, 0xB9, 0x00, 0x10, 0xB8, 0x00, 0xB0, 0x8E, 0xD8, 0x8A, 0xC3, 0x02, 0xC7, + 0x88, 0x07, 0x43, 0xE2, 0xF7, 0x33, 0xC9, 0xFE, 0xC9, 0x75, 0xFC, 0xFE, 0xCD, 0x75, 0xF8, 0x33, + 0xDB, 0xB9, 0x00, 0x10, 0x8A, 0xC3, 0x02, 0xC7, 0x34, 0xFF, 0x3A, 0x07, 0x75, 0xB6, 0x43, 0xE2, + 0xF3, 0x33, 0xDB, 0xB9, 0xFC, 0x0F, 0xFE, 0x07, 0x43, 0xE2, 0xFB, 0x90, 0x90, 0x90, 0x9A, 0x00, + 0x00, 0x00, 0xB0, 0x73, 0xF6, 0x90, 0x90, 0x90, 0xB8, 0x00, 0xB0, 0x8E, 0xC0, 0x33, 0xD2, 0x42, + 0x81, 0xE2, 0x01, 0x00, 0xBF, 0xB2, 0x04, 0xE8, 0x7B, 0x00, 0xE8, 0x3E, 0x00, 0xEB, 0xF0, 0x90, + 0x90, 0x90, 0x0B, 0x38, 0x29, 0x43, 0x4F, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x31, + 0x39, 0x38, 0x39, 0x20, 0x49, 0x52, 0x45, 0x4D, 0x20, 0x43, 0x4F, 0x52, 0x50, 0x4F, 0x52, 0x41, + 0x54, 0x49, 0x4F, 0x4E, 0x0B, 0x50, 0x2B, 0x41 + }; + + memcpy (DrvV30ROM + 0x00400, _0x400, 216); + + DrvV30ROM[0x3FC] = 0x88; + DrvV30ROM[0x3FD] = 0x05; + DrvV30ROM[0xB42] = 0x1E; + DrvV30ROM[0xB43] = 0x06; + DrvV30ROM[0xB44] = 0xB8; + DrvV30ROM[0x405B] = 0x05; + DrvV30ROM[0x4066] = 0x05; + DrvV30ROM[0x103DA] = 0xB0; + DrvV30ROM[0x103DD] = 0xFE; + DrvV30ROM[0x103DE] = 0x06; + DrvV30ROM[0x103DF] = 0xFE; + DrvV30ROM[0x103E0] = 0x0F; + DrvV30ROM[0x103E1] = 0xE5; + DrvV30ROM[0x103E2] = 0x02; + DrvV30ROM[0x103E3] = 0xA9; + DrvV30ROM[0x103E4] = 0x20; + DrvV30ROM[0x103E5] = 0x00; + DrvV30ROM[0x103E6] = 0x75; + DrvV30ROM[0x103E7] = 0x05; + DrvV30ROM[0x103E8] = 0xEA; + DrvV30ROM[0x103E9] = 0x2F; + DrvV30ROM[0x103EA] = 0x04; + DrvV30ROM[0x103EB] = 0x00; + DrvV30ROM[0x103EC] = 0x00; + DrvV30ROM[0x103ED] = 0xB8; + DrvV30ROM[0x10459] = 0xE7; + DrvV30ROM[0x1045A] = 0x04; + DrvV30ROM[0x1045B] = 0xE5; + DrvV30ROM[0x1045C] = 0x02; + DrvV30ROM[0x1045D] = 0x25; + DrvV30ROM[0x1045E] = 0x80; + DrvV30ROM[0x1045F] = 0x00; + DrvV30ROM[0x10460] = 0x74; + DrvV30ROM[0x10461] = 0xF9; + DrvV30ROM[0x10462] = 0x36; + DrvV30ROM[0x10463] = 0xA1; + DrvV30ROM[0x10464] = 0xB2; + DrvV30ROM[0x10465] = 0x23; + DrvV30ROM[0x10466] = 0xE7; + DrvV30ROM[0x10467] = 0x82; + DrvV30ROM[0x10468] = 0x36; + DrvV30ROM[0x10469] = 0xA1; + DrvV30ROM[0x1046A] = 0xB6; + DrvV30ROM[0x1046B] = 0x23; + DrvV30ROM[0x1046C] = 0xE7; + DrvV30ROM[0x104B4] = 0x32; + DrvV30ROM[0x104B5] = 0xE4; + DrvV30ROM[0x104B6] = 0x3C; + DrvV30ROM[0x104B7] = 0x7F; + DrvV30ROM[0x104B8] = 0x72; + DrvV30ROM[0x10577] = 0x47; + DrvV30ROM[0x10578] = 0xDC; + DrvV30ROM[0x10585] = 0x61; + DrvV30ROM[0x10586] = 0x07; + DrvV30ROM[0x10587] = 0x1F; + DrvV30ROM[0x10599] = 0x00; + DrvV30ROM[0x10793] = 0xE7; + DrvV30ROM[0x10794] = 0x02; + DrvV30ROM[0x1E1C0] = 0xBA; + DrvV30ROM[0x1EA29] = 0xE7; + DrvV30ROM[0x1EA2A] = 0x02; + + // invert graphics roms + for (INT32 i = 0; i < 0x80000; i++) { + DrvGfxROM1[i] ^= 0x0f; + DrvGfxROM2[i] ^= 0x0f; + } + + return 0; +} + +// Legend of Hero Tonma (bootleg, set 1) + +static struct BurnRomInfo lohtbRomDesc[] = { + { "lohtb03.b", 0x20000, 0x8b845a70, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "lohtb05.d", 0x20000, 0xe90f7623, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "lohtb02.a", 0x20000, 0x714778b5, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "lohtb04.c", 0x20000, 0x2f049b03, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "lohtb01.02", 0x10000, 0xe4bd8f03, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "lohtb14.11", 0x10000, 0xdf5ac5ee, 0x02 | BRF_GRA }, // 5 Sprites + { "lohtb18.15", 0x10000, 0xd7ecf849, 0x02 | BRF_GRA }, // 6 + { "lohtb15.12", 0x10000, 0x45220b01, 0x02 | BRF_GRA }, // 7 + { "lohtb19.16", 0x10000, 0x35d1a808, 0x02 | BRF_GRA }, // 8 + { "lohtb16.13", 0x10000, 0x25b85cfc, 0x02 | BRF_GRA }, // 9 + { "lohtb20.17", 0x10000, 0x464d8579, 0x02 | BRF_GRA }, // 10 + { "lohtb17.14", 0x10000, 0x763fa4ec, 0x02 | BRF_GRA }, // 11 + { "lohtb21.18", 0x10000, 0xa73568c7, 0x02 | BRF_GRA }, // 12 + + { "lohtb13.10", 0x10000, 0x359f17d4, 0x03 | BRF_GRA }, // 13 Foreground Tiles + { "lohtb11.08", 0x10000, 0x73391e8a, 0x03 | BRF_GRA }, // 14 + { "lohtb09.06", 0x10000, 0x7096d390, 0x03 | BRF_GRA }, // 15 + { "lohtb07.04", 0x10000, 0x71a27b81, 0x03 | BRF_GRA }, // 16 + + { "lohtb12.09", 0x10000, 0x4d5e9b53, 0x04 | BRF_GRA }, // 17 Background Tiles + { "lohtb10.07", 0x10000, 0x4f75a26a, 0x04 | BRF_GRA }, // 18 + { "lohtb08.05", 0x10000, 0x34854262, 0x04 | BRF_GRA }, // 19 + { "lohtb06.03", 0x10000, 0xf923183c, 0x04 | BRF_GRA }, // 20 +}; + +STD_ROM_PICK(lohtb) +STD_ROM_FN(lohtb) + +static INT32 lohtbInit() +{ + install_protection(loht); + + return DrvInit(common_080000_0a0000, sound_ram_map, lohtbRomLoadCallback, 0x80, Z80_FAKE_NMI, 0); +} + +struct BurnDriver BurnDrvLohtb = { + "lohtb", "loht", NULL, NULL, "1989", + "Legend of Hero Tonma (bootleg, set 1)\0", NULL, "bootleg", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, + NULL, lohtbRomInfo, lohtbRomName, NULL, NULL, CommonInputInfo, LohtDIPInfo, + lohtbInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Legend of Hero Tonma (bootleg, set 2) + +static struct BurnRomInfo lohtb2RomDesc[] = { + { "loht-a2.bin", 0x10000, 0xccc90e54, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "loht-a10.bin", 0x10000, 0x3aa06730, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "loht-a3.bin", 0x10000, 0xff8a98de, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "loht-a11.bin", 0x10000, 0xeab1d7bc, 0x01 | BRF_PRG | BRF_ESS }, // 3 + { "loht-a5.bin", 0x10000, 0x79e007ec, 0x01 | BRF_PRG | BRF_ESS }, // 4 + { "loht-a13.bin", 0x10000, 0xb951346e, 0x01 | BRF_PRG | BRF_ESS }, // 5 + { "loht-a4.bin", 0x10000, 0x254ea4d5, 0x01 | BRF_PRG | BRF_ESS }, // 6 + { "loht-a12.bin", 0x10000, 0xcfb0390d, 0x01 | BRF_PRG | BRF_ESS }, // 7 + + { "loht-a16.bin", 0x10000, 0xdf5ac5ee, 0x02 | BRF_GRA }, // 8 Sprites + { "loht-a17.bin", 0x10000, 0xd7ecf849, 0x02 | BRF_GRA }, // 9 + { "loht-a8.bin", 0x10000, 0x45220b01, 0x02 | BRF_GRA }, // 10 + { "loht-a9.bin", 0x10000, 0x4af9bb3c, 0x02 | BRF_GRA }, // 11 + { "loht-a14.bin", 0x10000, 0x25b85cfc, 0x02 | BRF_GRA }, // 12 + { "loht-a15.bin", 0x10000, 0x464d8579, 0x02 | BRF_GRA }, // 13 + { "loht-a6.bin", 0x10000, 0x763fa4ec, 0x02 | BRF_GRA }, // 14 + { "loht-a7.bin", 0x10000, 0xa73568c7, 0x02 | BRF_GRA }, // 15 + + { "loht-a19.bin", 0x10000, 0x3ca3e771, 0x03 | BRF_GRA }, // 16 Foreground Tiles + { "loht-a20.bin", 0x10000, 0x7a05ee2f, 0x03 | BRF_GRA }, // 17 + { "loht-a18.bin", 0x10000, 0x79aa2335, 0x03 | BRF_GRA }, // 18 + { "loht-a21.bin", 0x10000, 0x789e8b24, 0x03 | BRF_GRA }, // 19 + + { "loht-a24.bin", 0x10000, 0x44626bf6, 0x04 | BRF_GRA }, // 20 Background Tiles + { "loht-a25.bin", 0x10000, 0x464952cf, 0x04 | BRF_GRA }, // 21 + { "loht-a23.bin", 0x10000, 0x3db9b2c7, 0x04 | BRF_GRA }, // 22 + { "loht-a22.bin", 0x10000, 0xf01fe899, 0x04 | BRF_GRA }, // 23 + + { "loht-a1.bin", 0x10000, 0x3ed51d1f, 0x05 | BRF_SND }, // 24 DAC Samples + + { "loht-a26.bin", 0x02000, 0xac901e17, 0x00 | BRF_OPT }, // 25 i8751 Code +}; + +STD_ROM_PICK(lohtb2) +STD_ROM_FN(lohtb2) + +struct BurnDriver BurnDrvLohtb2 = { + "lohtb2", "loht", NULL, NULL, "1989", + "Legend of Hero Tonma (bootleg, set 2)\0", NULL, "bootleg", "M72", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_M72, GBF_SCRFIGHT, 0, + NULL, lohtb2RomInfo, lohtb2RomName, NULL, NULL, CommonInputInfo, LohtDIPInfo, + lohtInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Pound for Pound (World) + +static struct BurnRomInfo poundforRomDesc[] = { + { "ppa-h0-b.9e", 0x20000, 0x50d4a2d8, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "ppa-l0-b.9d", 0x20000, 0xbd997942, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ppa-h1.9f", 0x20000, 0xf6c82f48, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ppa-l1.9c", 0x20000, 0x5b07b087, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ppa-sp.4j", 0x10000, 0x3f458a5b, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "ppb-n0.bin", 0x40000, 0x951a41f8, 0x02 | BRF_GRA }, // 5 Sprites + { "ppb-n1.bin", 0x40000, 0xc609b7f2, 0x02 | BRF_GRA }, // 6 + { "ppb-n2.bin", 0x40000, 0x318c0b5f, 0x02 | BRF_GRA }, // 7 + { "ppb-n3.bin", 0x40000, 0x93dc9490, 0x02 | BRF_GRA }, // 8 + + { "ppa-g00.bin", 0x20000, 0x8a88a174, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "ppa-g10.bin", 0x20000, 0xe48a66ac, 0x03 | BRF_GRA }, // 10 + { "ppa-g20.bin", 0x20000, 0x12b93e79, 0x03 | BRF_GRA }, // 11 + { "ppa-g30.bin", 0x20000, 0xfaa39aee, 0x03 | BRF_GRA }, // 12 + + { "ppa-v0.bin", 0x40000, 0x03321664, 0x05 | BRF_SND }, // 13 DAC Samples +}; + +STD_ROM_PICK(poundfor) +STD_ROM_FN(poundfor) + +static INT32 poundforInit() +{ + return DrvInit(rtype2_main_cpu_map, sound_rom_map, NULL, 0x80, Z80_FAKE_NMI, 4); +} + +struct BurnDriverD BurnDrvPoundfor = { + "poundfor", NULL, NULL, NULL, "1990", + "Pound for Pound (World)\0", NULL, "Irem", "M85", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_SPORTSMISC, 0, + NULL, poundforRomInfo, poundforRomName, NULL, NULL, PoundforInputInfo, PoundforDIPInfo, + poundforInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 256, 384, 3, 4 +}; + + +// Pound for Pound (Japan) + +static struct BurnRomInfo poundforjRomDesc[] = { + { "ppa-h0-.9e", 0x20000, 0xf0165e3b, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "ppa-l0-.9d", 0x20000, 0xf954f99f, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ppa-h1.9f", 0x20000, 0xf6c82f48, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ppa-l1.9c", 0x20000, 0x5b07b087, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ppa-sp.4j", 0x10000, 0x3f458a5b, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "ppb-n0.bin", 0x40000, 0x951a41f8, 0x02 | BRF_GRA }, // 5 Sprites + { "ppb-n1.bin", 0x40000, 0xc609b7f2, 0x02 | BRF_GRA }, // 6 + { "ppb-n2.bin", 0x40000, 0x318c0b5f, 0x02 | BRF_GRA }, // 7 + { "ppb-n3.bin", 0x40000, 0x93dc9490, 0x02 | BRF_GRA }, // 8 + + { "ppa-g00.bin", 0x20000, 0x8a88a174, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "ppa-g10.bin", 0x20000, 0xe48a66ac, 0x03 | BRF_GRA }, // 10 + { "ppa-g20.bin", 0x20000, 0x12b93e79, 0x03 | BRF_GRA }, // 11 + { "ppa-g30.bin", 0x20000, 0xfaa39aee, 0x03 | BRF_GRA }, // 12 + + { "ppa-v0.bin", 0x40000, 0x03321664, 0x05 | BRF_SND }, // 13 DAC Samples +}; + +STD_ROM_PICK(poundforj) +STD_ROM_FN(poundforj) + +struct BurnDriverD BurnDrvPoundforj = { + "poundforj", "poundfor", NULL, NULL, "1990", + "Pound for Pound (Japan)\0", NULL, "Irem", "M85", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_SPORTSMISC, 0, + NULL, poundforjRomInfo, poundforjRomName, NULL, NULL, PoundforInputInfo, PoundforDIPInfo, + poundforInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 256, 384, 3, 4 +}; + + +// Pound for Pound (US) + +static struct BurnRomInfo poundforuRomDesc[] = { + { "ppa-ho-a.9e", 0x20000, 0xff4c83a4, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "ppa-lo-a.9d", 0x20000, 0x3374ce8f, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ppa-h1.9f", 0x20000, 0xf6c82f48, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ppa-l1.9c", 0x20000, 0x5b07b087, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ppa-sp.4j", 0x10000, 0x3f458a5b, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "ppb-n0.bin", 0x40000, 0x951a41f8, 0x02 | BRF_GRA }, // 5 Sprites + { "ppb-n1.bin", 0x40000, 0xc609b7f2, 0x02 | BRF_GRA }, // 6 + { "ppb-n2.bin", 0x40000, 0x318c0b5f, 0x02 | BRF_GRA }, // 7 + { "ppb-n3.bin", 0x40000, 0x93dc9490, 0x02 | BRF_GRA }, // 8 + + { "ppa-g00.bin", 0x20000, 0x8a88a174, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "ppa-g10.bin", 0x20000, 0xe48a66ac, 0x03 | BRF_GRA }, // 10 + { "ppa-g20.bin", 0x20000, 0x12b93e79, 0x03 | BRF_GRA }, // 11 + { "ppa-g30.bin", 0x20000, 0xfaa39aee, 0x03 | BRF_GRA }, // 12 + + { "ppa-v0.bin", 0x40000, 0x03321664, 0x05 | BRF_SND }, // 13 DAC Samples +}; + +STD_ROM_PICK(poundforu) +STD_ROM_FN(poundforu) + +struct BurnDriverD BurnDrvPoundforu = { + "poundforu", "poundfor", NULL, NULL, "1990", + "Pound for Pound (US)\0", NULL, "Irem America", "M85", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_IREM_M72, GBF_SPORTSMISC, 0, + NULL, poundforuRomInfo, poundforuRomName, NULL, NULL, PoundforInputInfo, PoundforDIPInfo, + poundforInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 256, 384, 3, 4 +}; + + +// Major Title (World) + +static struct BurnRomInfo majtitleRomDesc[] = { + { "mt_h0-a.bin", 0x20000, 0x36aadb67, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "mt_l0-a.bin", 0x20000, 0x2e1b6242, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "mt_h1-a.bin", 0x20000, 0xe1402a22, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "mt_l1-a.bin", 0x20000, 0x0efa409a, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "mt_sp.bin", 0x10000, 0xe44260a9, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "mt_n0.bin", 0x40000, 0x5618cddc, 0x02 | BRF_GRA }, // 5 Sprites + { "mt_n1.bin", 0x40000, 0x483b873b, 0x02 | BRF_GRA }, // 6 + { "mt_n2.bin", 0x40000, 0x4f5d665b, 0x02 | BRF_GRA }, // 7 + { "mt_n3.bin", 0x40000, 0x83571549, 0x02 | BRF_GRA }, // 8 + + { "mt_c0.bin", 0x20000, 0x780e7a02, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "mt_c1.bin", 0x20000, 0x45ad1381, 0x03 | BRF_GRA }, // 10 + { "mt_c2.bin", 0x20000, 0x5df5856d, 0x03 | BRF_GRA }, // 11 + { "mt_c3.bin", 0x20000, 0xf5316cc8, 0x03 | BRF_GRA }, // 12 + + { "mt_f0.bin", 0x20000, 0x2d5e05d5, 0x0e | BRF_GRA }, // 13 Sprites + { "mt_f1.bin", 0x20000, 0xc68cd65f, 0x0e | BRF_GRA }, // 14 + { "mt_f2.bin", 0x20000, 0xa71feb2d, 0x0e | BRF_GRA }, // 15 + { "mt_f3.bin", 0x20000, 0x179f7562, 0x0e | BRF_GRA }, // 16 + + { "mt_vo.bin", 0x20000, 0xeb24bb2c, 0x05 | BRF_SND }, // 17 DAC Samples +}; + +STD_ROM_PICK(majtitle) +STD_ROM_FN(majtitle) + +static INT32 majtitleInit() +{ + return DrvInit(majtitle_main_cpu_map, sound_rom_map, NULL, 0x80, Z80_REAL_NMI, 3); +} + +struct BurnDriver BurnDrvMajtitle = { + "majtitle", NULL, NULL, NULL, "1990", + "Major Title (World)\0", NULL, "Irem", "M84", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M72, GBF_SPORTSMISC, 0, + NULL, majtitleRomInfo, majtitleRomName, NULL, NULL, CommonInputInfo, Rtype2DIPInfo, + majtitleInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; + + +// Major Title (Japan) + +static struct BurnRomInfo majtitlejRomDesc[] = { + { "mt_h0.bin", 0x20000, 0xb9682c70, 0x01 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "mt_l0.bin", 0x20000, 0x702c9fd6, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "mt_h1.bin", 0x20000, 0xd9e97c30, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "mt_l1.bin", 0x20000, 0x8dbd91b5, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "mt_sp.bin", 0x10000, 0xe44260a9, 0x06 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "mt_n0.bin", 0x40000, 0x5618cddc, 0x02 | BRF_GRA }, // 5 Sprites + { "mt_n1.bin", 0x40000, 0x483b873b, 0x02 | BRF_GRA }, // 6 + { "mt_n2.bin", 0x40000, 0x4f5d665b, 0x02 | BRF_GRA }, // 7 + { "mt_n3.bin", 0x40000, 0x83571549, 0x02 | BRF_GRA }, // 8 + + { "mt_c0.bin", 0x20000, 0x780e7a02, 0x03 | BRF_GRA }, // 9 Foreground & Background Tiles + { "mt_c1.bin", 0x20000, 0x45ad1381, 0x03 | BRF_GRA }, // 10 + { "mt_c2.bin", 0x20000, 0x5df5856d, 0x03 | BRF_GRA }, // 11 + { "mt_c3.bin", 0x20000, 0xf5316cc8, 0x03 | BRF_GRA }, // 12 + + { "mt_f0.bin", 0x20000, 0x2d5e05d5, 0x0e | BRF_GRA }, // 13 Sprites + { "mt_f1.bin", 0x20000, 0xc68cd65f, 0x0e | BRF_GRA }, // 14 + { "mt_f2.bin", 0x20000, 0xa71feb2d, 0x0e | BRF_GRA }, // 15 + { "mt_f3.bin", 0x20000, 0x179f7562, 0x0e | BRF_GRA }, // 16 + + { "mt_vo.bin", 0x20000, 0xeb24bb2c, 0x05 | BRF_SND }, // 17 DAC Samples +}; + +STD_ROM_PICK(majtitlej) +STD_ROM_FN(majtitlej) + +struct BurnDriver BurnDrvMajtitlej = { + "majtitlej", "majtitle", NULL, NULL, "1990", + "Major Title (Japan)\0", NULL, "Irem", "M84", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M72, GBF_SPORTSMISC, 0, + NULL, majtitlejRomInfo, majtitlejRomName, NULL, NULL, CommonInputInfo, Rtype2DIPInfo, + majtitleInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 256, 4, 3 +}; diff --git a/src/burn/drv/irem/d_m90.cpp b/src/burn/drv/irem/d_m90.cpp index 99c592923..82b7decb5 100644 --- a/src/burn/drv/irem/d_m90.cpp +++ b/src/burn/drv/irem/d_m90.cpp @@ -1,1819 +1,1818 @@ -// FB Alpha Irem M90 driver module -// Based on MAME driver by Bryan McPhail - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "nec_intf.h" -#include "irem_cpu.h" -#include "dac.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvV30ROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvSndROM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvV30RAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvPalRAM; - -static UINT8 *m90_video_control; - -static UINT8 *RamPrioBitmap; - -static UINT8 *soundlatch; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 irqvector; -static INT32 sample_address; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[5]; -static UINT8 DrvReset; - -static INT32 vblank; -static INT32 code_mask[2]; -static INT32 video_offsets[2] = { 0, 0 }; - -enum { VECTOR_INIT, YM2151_ASSERT, YM2151_CLEAR, Z80_ASSERT, Z80_CLEAR }; - -static struct BurnInputInfo p4commonInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, - - {"P3 Coin", BIT_DIGITAL, DrvJoy4 + 5, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, DrvJoy4 + 4, "p3 start" }, - {"P3 Up", BIT_DIGITAL, DrvJoy4 + 3, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy4 + 2, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy4 + 1, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy4 + 0, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 7, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 6, "p3 fire 2" }, - - {"P4 Coin", BIT_DIGITAL, DrvJoy5 + 5, "p4 coin" }, - {"P4 Start", BIT_DIGITAL, DrvJoy5 + 4, "p4 start" }, - {"P4 Up", BIT_DIGITAL, DrvJoy5 + 3, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvJoy5 + 2, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvJoy5 + 1, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvJoy5 + 0, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy5 + 7, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy5 + 6, "p4 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(p4common) - -static struct BurnInputInfo p2commonInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(p2common) - -static struct BurnInputInfo Quizf1InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 4" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 4" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Quizf1) - -static struct BurnInputInfo Matchit2InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Matchit2) - -static struct BurnDIPInfo DynablstDIPList[]= -{ - {0x22, 0xff, 0xff, 0xbf, NULL }, - {0x23, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x22, 0x01, 0x03, 0x02, "2" }, - {0x22, 0x01, 0x03, 0x03, "3" }, - {0x22, 0x01, 0x03, 0x01, "4" }, - {0x22, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x22, 0x01, 0x0c, 0x08, "Easy" }, - {0x22, 0x01, 0x0c, 0x0c, "Medium" }, - {0x22, 0x01, 0x0c, 0x04, "Hard" }, - {0x22, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Game Title" }, - {0x22, 0x01, 0x10, 0x10, "Dynablaster" }, - {0x22, 0x01, 0x10, 0x00, "Bomber Man" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x22, 0x01, 0x20, 0x00, "No" }, - {0x22, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x22, 0x01, 0x40, 0x40, "Off" }, - {0x22, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x22, 0x01, 0x80, 0x80, "Off" }, - {0x22, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x23, 0x01, 0x01, 0x01, "Off" }, - {0x23, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Cabinet" }, - {0x23, 0x01, 0x06, 0x04, "2 Player Upright" }, - {0x23, 0x01, 0x06, 0x06, "4 Player Upright A" }, - {0x23, 0x01, 0x06, 0x02, "4 Player Upright B" }, - {0x23, 0x01, 0x06, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x23, 0x01, 0x08, 0x08, "1" }, - {0x23, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x23, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, - {0x23, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x23, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x23, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x23, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x23, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x23, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x23, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x23, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x23, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x23, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Dynablst) - -static struct BurnDIPInfo AtompunkDIPList[]= -{ - {0x22, 0xff, 0xff, 0xbf, NULL }, - {0x23, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x22, 0x01, 0x03, 0x02, "2" }, - {0x22, 0x01, 0x03, 0x03, "3" }, - {0x22, 0x01, 0x03, 0x01, "4" }, - {0x22, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x22, 0x01, 0x0c, 0x08, "Easy" }, - {0x22, 0x01, 0x0c, 0x0c, "Medium" }, - {0x22, 0x01, 0x0c, 0x04, "Hard" }, - {0x22, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Unknown" }, - {0x22, 0x01, 0x10, 0x10, "Off" }, - {0x22, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x22, 0x01, 0x20, 0x00, "No" }, - {0x22, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x22, 0x01, 0x40, 0x40, "Off" }, - {0x22, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x22, 0x01, 0x80, 0x80, "Off" }, - {0x22, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x23, 0x01, 0x01, 0x01, "Off" }, - {0x23, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Cabinet" }, - {0x23, 0x01, 0x06, 0x04, "2 Player Upright" }, - {0x23, 0x01, 0x06, 0x06, "4 Player Upright A" }, - {0x23, 0x01, 0x06, 0x02, "4 Player Upright B" }, - {0x23, 0x01, 0x06, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x23, 0x01, 0x08, 0x08, "1" }, - {0x23, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x23, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, - {0x23, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x23, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x23, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x23, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x23, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x23, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x23, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x23, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x23, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x23, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Atompunk) - -static struct BurnDIPInfo BombrmanDIPList[]= -{ - {0x12, 0xff, 0xff, 0xaf, NULL }, - {0x13, 0xff, 0xff, 0xf9, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x03, 0x02, "2" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x01, "4" }, - {0x12, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Medium" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x12, 0x01, 0x20, 0x00, "No" }, - {0x12, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x13, 0x01, 0x08, 0x08, "1" }, - {0x13, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x13, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, - {0x13, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x13, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Bombrman) - -static struct BurnDIPInfo HasamuDIPList[]= -{ - {0x12, 0xff, 0xff, 0xbf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x12, 0x01, 0x20, 0x00, "No" }, - {0x12, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Unknown" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x13, 0x01, 0x08, 0x08, "1" }, - {0x13, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x13, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, - {0x13, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x13, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Hasamu) - -static struct BurnDIPInfo RiskchalDIPList[]= -{ - {0x12, 0xff, 0xff, 0xbf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x03, 0x02, "2" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x01, "4" }, - {0x12, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Medium" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Slots" }, - {0x13, 0x01, 0x04, 0x04, "Common" }, - {0x13, 0x01, 0x04, 0x00, "Separate" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x13, 0x01, 0x08, 0x08, "1" }, - {0x13, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x13, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, - {0x13, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x13, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Riskchal) - -static struct BurnDIPInfo BbmanwDIPList[]= -{ - {0x22, 0xff, 0xff, 0xbf, NULL }, - {0x23, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x22, 0x01, 0x03, 0x02, "2" }, - {0x22, 0x01, 0x03, 0x03, "3" }, - {0x22, 0x01, 0x03, 0x01, "4" }, - {0x22, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x22, 0x01, 0x0c, 0x08, "Easy" }, - {0x22, 0x01, 0x0c, 0x0c, "Medium" }, - {0x22, 0x01, 0x0c, 0x04, "Hard" }, - {0x22, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Game Title" }, - {0x22, 0x01, 0x10, 0x10, "Bomber Man World" }, - {0x22, 0x01, 0x10, 0x00, "New Dyna Blaster Global Quest" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x22, 0x01, 0x20, 0x00, "No" }, - {0x22, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x22, 0x01, 0x40, 0x40, "Off" }, - {0x22, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x22, 0x01, 0x80, 0x80, "Off" }, - {0x22, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x23, 0x01, 0x01, 0x01, "Off" }, - {0x23, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Cabinet" }, - {0x23, 0x01, 0x06, 0x04, "2 Player" }, - {0x23, 0x01, 0x06, 0x06, "4 Player Seprate Coins" }, - {0x23, 0x01, 0x06, 0x02, "4 Player Shared Coins" }, - {0x23, 0x01, 0x06, 0x00, "4 Player 1&2 3&4 Share Coins" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x23, 0x01, 0x08, 0x08, "1" }, - {0x23, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x23, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, - {0x23, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x23, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x23, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x23, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x23, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x23, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x23, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x23, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x23, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x23, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Bbmanw) - -static struct BurnDIPInfo BbmanwjDIPList[]= -{ - {0x22, 0xff, 0xff, 0xbf, NULL }, - {0x23, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x22, 0x01, 0x03, 0x02, "2" }, - {0x22, 0x01, 0x03, 0x03, "3" }, - {0x22, 0x01, 0x03, 0x01, "4" }, - {0x22, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x22, 0x01, 0x0c, 0x08, "Easy" }, - {0x22, 0x01, 0x0c, 0x0c, "Medium" }, - {0x22, 0x01, 0x0c, 0x04, "Hard" }, - {0x22, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x22, 0x01, 0x20, 0x00, "No" }, - {0x22, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x22, 0x01, 0x40, 0x40, "Off" }, - {0x22, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x22, 0x01, 0x80, 0x80, "Off" }, - {0x22, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x23, 0x01, 0x01, 0x01, "Off" }, - {0x23, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Cabinet" }, - {0x23, 0x01, 0x06, 0x04, "2 Player" }, - {0x23, 0x01, 0x06, 0x06, "4 Player Seprate Coins" }, - {0x23, 0x01, 0x06, 0x02, "4 Player Shared Coins" }, - {0x23, 0x01, 0x06, 0x00, "4 Player 1&2 3&4 Share Coins" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x23, 0x01, 0x08, 0x08, "1" }, - {0x23, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x23, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x23, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, - {0x23, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x23, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x23, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x23, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x23, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x23, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x23, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x23, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x23, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x23, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Bbmanwj) - -static struct BurnDIPInfo Quizf1DIPList[]= -{ - {0x16, 0xff, 0xff, 0x9f, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Input Device" }, - {0x16, 0x01, 0x20, 0x20, "Joystick" }, - {0x16, 0x01, 0x20, 0x00, "Buttons" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x40, 0x40, "Off" }, - {0x16, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x17, 0x01, 0x01, 0x01, "Off" }, - {0x17, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x17, 0x01, 0x08, 0x08, "1" }, - {0x17, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x17, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x17, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x17, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x17, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x17, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x17, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, - {0x17, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x17, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x17, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x17, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x17, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x17, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x17, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x17, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x17, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x17, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Quizf1) - -static struct BurnDIPInfo Matchit2DIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Girls Mode" }, - {0x14, 0x01, 0x01, 0x00, "Off" }, - {0x14, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2, "China Tiles" }, - {0x14, 0x01, 0x02, 0x02, "Mahjong" }, - {0x14, 0x01, 0x02, 0x00, "Alpha-Numeric" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x0c, 0x00, "Very Hard" }, - {0x14, 0x01, 0x0c, 0x04, "Hard" }, - {0x14, 0x01, 0x0c, 0x0c, "Normal" }, - {0x14, 0x01, 0x0c, 0x08, "Easy" }, - - {0 , 0xfe, 0 , 4, "Timer Speed" }, - {0x14, 0x01, 0x30, 0x00, "Very Hard" }, - {0x14, 0x01, 0x30, 0x10, "Hard" }, - {0x14, 0x01, 0x30, 0x30, "Normal" }, - {0x14, 0x01, 0x30, 0x20, "Easy" }, - - {0 , 0xfe, 0 , 2, "Title Screen" }, - {0x14, 0x01, 0x40, 0x40, "Match It II" }, - {0x14, 0x01, 0x40, 0x00, "Shisensho II" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 3, "Language" }, - {0x15, 0x01, 0x06, 0x06, "English" }, - {0x15, 0x01, 0x06, 0x04, "German" }, - {0x15, 0x01, 0x06, 0x02, "Korean" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x15, 0x01, 0x08, 0x08, "1" }, - {0x15, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x15, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, - {0x15, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x15, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x15, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x15, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x15, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Matchit2) - -static struct BurnDIPInfo Shisen2DIPList[]= -{ - {0x14, 0xff, 0xff, 0xbf, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Girls Mode" }, - {0x14, 0x01, 0x01, 0x00, "Off" }, - {0x14, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x0c, 0x00, "Very Hard" }, - {0x14, 0x01, 0x0c, 0x04, "Hard" }, - {0x14, 0x01, 0x0c, 0x0c, "Normal" }, - {0x14, 0x01, 0x0c, 0x08, "Easy" }, - - {0 , 0xfe, 0 , 4, "Timer Speed" }, - {0x14, 0x01, 0x30, 0x00, "Very Hard" }, - {0x14, 0x01, 0x30, 0x10, "Hard" }, - {0x14, 0x01, 0x30, 0x30, "Normal" }, - {0x14, 0x01, 0x30, 0x20, "Easy" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x15, 0x01, 0x08, 0x08, "1" }, - {0x15, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x15, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, - {0x15, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x15, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x15, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x15, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x15, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Shisen2) - -static void setvector_callback(INT32 param) -{ - switch (param) - { - case VECTOR_INIT: irqvector = 0xff; break; - case YM2151_ASSERT: irqvector &= 0xef; break; - case YM2151_CLEAR: irqvector |= 0x10; break; - case Z80_ASSERT: irqvector &= 0xdf; break; - case Z80_CLEAR: irqvector |= 0x20; break; - } - - ZetSetVector(irqvector); - ZetSetIRQLine(0, (irqvector == 0xff) ? ZET_IRQSTATUS_NONE : ZET_IRQSTATUS_ACK); -} - -static inline void update_palette_entry(INT32 entry) -{ - UINT16 d = *((UINT16*)(DrvPalRAM + entry)); - -#ifndef LSB_FIRST - d = BURN_ENDIAN_SWAP_INT16(d); -#endif - - UINT8 r = (d >> 0) & 0x1f; - UINT8 g = (d >> 5) & 0x1f; - UINT8 b = (d >> 10) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[entry / 2] = BurnHighCol(r, g, b, 0); -} - -void __fastcall m90_main_write(UINT32 address, UINT8 data) -{ - if ((address & 0xffc00) == 0xe0000) { - DrvPalRAM[address & 0x3ff] = data; - update_palette_entry(address & 0x3fe); - return; - } -} - -UINT8 __fastcall m90_main_read(UINT32 /*address*/) -{ - return 0; -} - -void __fastcall m90_main_write_port(UINT32 port, UINT8 data) -{ - if ((port & ~0x0f) == 0x80) { - m90_video_control[port & 0x0f] = data; - return; - } - - switch (port) - { - case 0x00: - // case 0x01: - *soundlatch = data; - setvector_callback(Z80_ASSERT); - return; - - case 0x02: - // case 0x03: - // coin counter - return; - - case 0x04: - //case 0x05: - { - INT32 bankaddress = 0x100000 + 0x10000 * (data & 0x0f); - VezMapArea(0x80000, 0x8ffff, 0, DrvV30ROM + bankaddress); - VezMapArea(0x80000, 0x8ffff, 2, DrvV30ROM + bankaddress); - } - return; - - case 0x90: - // case 0x91: // nop dynablsb - return; - - //default: - // bprintf (0, _T("Writing %2.2x to port %2.2x wp\n"), data, port); - // break; - } -} - -UINT8 __fastcall m90_main_read_port(UINT32 port) -{ - switch (port) - { - case 0x00: return DrvInputs[0]; - case 0x01: return DrvInputs[1]; - case 0x02: return (DrvInputs[2] & 0x7f) | vblank; // system - // case 0x03: return 0xff; // ? - case 0x04: return DrvDips[0]; - case 0x05: return DrvDips[1]; - case 0x06: return DrvInputs[3]; - case 0x07: return DrvInputs[4]; - - //default: - // bprintf (0, _T("Reading port: %2.2x\n"), port); - // break; - } - - return 0; -} - -void __fastcall m90_sound_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - case 0x40: // bbmanw - BurnYM2151SelectRegister(data); - return; - - case 0x01: - case 0x41: // bbmanw - BurnYM2151WriteRegister(data); - return; - - case 0x80: - sample_address >>= 5; - sample_address = (sample_address & 0x00ff) | (data << 8); - sample_address <<= 5; - return; - - case 0x81: - sample_address >>= 5; - sample_address = (sample_address & 0xff00) | (data << 0); - sample_address <<= 5; - return; - - case 0x82: - DACSignedWrite(0, data); - sample_address = (sample_address + 1) & 0x3ffff; - return; - - case 0x42: // bbmanw - case 0x83: - setvector_callback(Z80_CLEAR); - return; - } -} - -UINT8 __fastcall m90_sound_read_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - case 0x40: // bbmanw - case 0x41: - return BurnYM2151ReadStatus(); - - case 0x42: // bbmanw - case 0x80: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0x84: - return DrvSndROM[sample_address & 0x3fff]; - } - - return 0; -} - -static void m72YM2151IRQHandler(INT32 nStatus) -{ - setvector_callback(nStatus ? YM2151_ASSERT : YM2151_CLEAR); -} - -static INT32 m90SyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (3579545.000 / (nBurnFPS / 100.000)))); -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - VezOpen(0); - VezReset(); - VezClose(); - - ZetOpen(0); - ZetReset(); - setvector_callback(VECTOR_INIT); - ZetClose(); - - BurnYM2151Reset(); - DACReset(); - - sample_address = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvV30ROM = Next; Next += 0x200000; - DrvZ80ROM = Next; Next += 0x010000; - DrvGfxROM0 = Next; Next += 0x400000; - DrvGfxROM1 = Next; Next += 0x400000; - DrvSndROM = Next; Next += 0x180000; - - RamPrioBitmap = Next; Next += nScreenWidth * nScreenHeight; - - AllRam = Next; - - DrvSprRAM = Next; Next += 0x000800; - DrvVidRAM = Next; Next += 0x010000; - DrvV30RAM = Next; Next += 0x004000; - DrvPalRAM = Next; Next += 0x000800; - DrvZ80RAM = Next; Next += 0x001000; - - soundlatch = Next; Next += 0x000001; - - m90_video_control = Next; Next += 0x000010; - - RamEnd = Next; - - DrvPalette = (UINT32 *) Next; Next += 0x0200 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvLoadRoms(INT32 codesize, INT32 samples, INT32 bank) -{ - if (BurnLoadRom(DrvV30ROM + 1, 0, 2)) return 1; - if (BurnLoadRom(DrvV30ROM + 0, 1, 2)) return 1; - - if (codesize == 0x40000) { - memcpy (DrvV30ROM + 0x7fff0, DrvV30ROM + 0x3fff0, 0x10); - } - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 6, 1)) return 1; - - if (samples) { - if (BurnLoadRom(DrvSndROM, 7, 1)) return 1; - - if (samples < 0x40000) { - memcpy (DrvSndROM + 0x20000, DrvSndROM + 0x00000, 0x20000); - } - } - - if (bank) { - if (BurnLoadRom(DrvV30ROM + 0x100001, 8, 2)) return 1; - if (BurnLoadRom(DrvV30ROM + 0x100000, 9, 2)) return 1; - } - - return 0; -} - -static void map_main_cpu(UINT8 *decrypt_table, INT32 codesize, INT32 spriteram) -{ - VezInit(0, V35_TYPE, 32000000/2); - - VezOpen(0); - if (decrypt_table != NULL) { - VezSetDecode(decrypt_table); - } - - VezMapArea(0x00000, (codesize-1), 0, DrvV30ROM + 0x000000); - VezMapArea(0x00000, (codesize-1), 2, DrvV30ROM + 0x000000); - VezMapArea(0x80000, 0x8ffff, 0, DrvV30ROM + 0x100000); - VezMapArea(0x80000, 0x8ffff, 2, DrvV30ROM + 0x100000); - VezMapArea(0xa0000, 0xa3fff, 0, DrvV30RAM); - VezMapArea(0xa0000, 0xa3fff, 1, DrvV30RAM); - VezMapArea(0xa0000, 0xa3fff, 2, DrvV30RAM); - VezMapArea(0xd0000, 0xdffff, 0, DrvVidRAM); - VezMapArea(0xd0000, 0xdffff, 1, DrvVidRAM); - VezMapArea(0xd0000, 0xdffff, 2, DrvVidRAM); - VezMapArea(0xe0000, 0xe07ff, 0, DrvPalRAM); -// VezMapArea(0xe0000, 0xe07ff, 1, DrvPalRAM); - VezMapArea(0xe0000, 0xe07ff, 2, DrvPalRAM); - VezMapArea(0xff800, 0xfffff, 0, DrvV30ROM + 0x07f800); - VezMapArea(0xff800, 0xfffff, 2, DrvV30ROM + 0x07f800); - - if (spriteram) { - VezMapArea(0x00000 + spriteram, 0x00fff + spriteram, 0, DrvSprRAM); // 00e - fff // ?? - VezMapArea(0x00000 + spriteram, 0x00fff + spriteram, 1, DrvSprRAM); - VezMapArea(0x00000 + spriteram, 0x00fff + spriteram, 2, DrvSprRAM); - } - - VezSetReadHandler(m90_main_read); - VezSetWriteHandler(m90_main_write); - VezSetReadPort(m90_main_read_port); - VezSetWritePort(m90_main_write_port); - VezClose(); -} - -static void DrvGfxDecode() -{ - INT32 Plane[4] = { 0x180000 * 8, 0x100000 * 8, 0x080000 * 8, 0x000000 * 8 }; - INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 }; - INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x200000); - if (tmp == NULL) { - return; - } - - memcpy (tmp, DrvGfxROM1, 0x200000); - - GfxDecode(0x10000, 4, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); - GfxDecode(0x04000, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); - - BurnFree (tmp); -} - -static INT32 DrvInit(INT32 codesize, INT32 gfxlen, INT32 samples, INT32 bank, INT32 spriteram, const UINT8 *decrypt_table) -{ - GenericTilesInit(); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (DrvLoadRoms(codesize, samples, bank)) return 1; - - DrvGfxDecode(); - - map_main_cpu((UINT8*)decrypt_table, codesize, spriteram); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); - ZetMapArea(0xf000, 0xffff, 0, DrvZ80RAM); - ZetMapArea(0xf000, 0xffff, 1, DrvZ80RAM); - ZetMapArea(0xf000, 0xffff, 2, DrvZ80RAM); - ZetSetOutHandler(m90_sound_write_port); - ZetSetInHandler(m90_sound_read_port); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - YM2151SetIrqHandler(0, &m72YM2151IRQHandler); - BurnYM2151SetAllRoutes(0.15, BURN_SND_ROUTE_BOTH); - - DACInit(0, 0, 1, m90SyncDAC); - DACSetRoute(0, 0.10, BURN_SND_ROUTE_BOTH); - - code_mask[0] = ((gfxlen * 2) - 1) / (8 * 8); - code_mask[1] = ((gfxlen * 2) - 1) / (16 * 16); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM2151Exit(); - DACExit(); - - ZetExit(); - VezExit(); - - BurnFree(AllMem); - - video_offsets[0] = video_offsets[1] = 0; - - return 0; -} - -static void RenderTilePrio(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 width, INT32 height, UINT8 *pri, INT32 prio) -{ - if (sx <= (0-width) || sx >= nScreenWidth || sy <= (0-height) || sy >= nScreenHeight) return; - - INT32 flip = 0; - if (flipy) flip |= (height - 1) * width; - if (flipx) flip |= width - 1; - - gfx += code * width * height; - - for (INT32 y = 0; y < height; y++, sy++) { - if (sy < 0 || sy >= nScreenHeight) continue; - - for (INT32 x = 0; x < width; x++, sx++) { - if (sx < 0 || sx >= nScreenWidth) continue; - - INT32 pxl = gfx[((y * width) + x) ^ flip]; - - if (pxl == 0) continue; - - if ((prio & (1 << pri[sy * nScreenWidth + sx])) == 0) { - dest[sy * nScreenWidth + sx] = pxl | color; - pri[sy * nScreenWidth + sx] = 7; - } - } - - sx -= width; - } -} - -static void draw_sprites() -{ - INT32 pri_ctrl = m90_video_control[14] & 0x03; - UINT16 *sram = (UINT16*)(DrvVidRAM + 0xee00); - - for (INT32 offs = 0x1f2/2; offs >= 0; offs -= 3) - { - INT32 sy = BURN_ENDIAN_SWAP_INT16(sram[offs + 0]); - INT32 code = BURN_ENDIAN_SWAP_INT16(sram[offs + 1]); - INT32 sx = BURN_ENDIAN_SWAP_INT16(sram[offs + 2]); - - INT32 flipy = sy & 0x8000; - INT32 flipx = sx & 0x0200; - INT32 multi = 1 << ((sy & 0x6000) >> 13); - INT32 color = (sy >> 9) & 0x0f; - - sx = ((sx - video_offsets[0]) & 0x1ff) - 16; - sy = (512 - ((sy + video_offsets[1]) & 0x1ff)) - (16 * multi); - - INT32 prio = 0x82; - if (pri_ctrl & 0x01) { - if ((color & 0x08) == 0x08) prio = 0x80; - } else if (pri_ctrl & 0x02) { - if ((color & 0x0c) == 0x0c) prio = 0x80; - } - - for (INT32 i = 0; i < multi; i++) { - RenderTilePrio(pTransDraw, DrvGfxROM1, (code + (flipy ? multi-1 - i : i)) & code_mask[1], (color << 4)|0x100, sx, sy+i*16, flipx, flipy, 16, 16, RamPrioBitmap, prio); - } - } -} - -static void draw_layer(INT32 layer) -{ - INT32 control = m90_video_control[10 + (layer * 2)]; - - if (control & 0x10) return; // disable layer - - INT32 enable_rowscroll = control & 0x20; - INT32 enable_colscroll = control & 0x40; - - INT32 wide = (control & 0x04) ? 128 : 64; - - INT32 trans = layer ? 0xff : 0; - - INT32 pmask = (wide == 128) ? 2 : 3; - UINT16 *vram = (UINT16*)(DrvVidRAM + (control & pmask) * 0x4000); - - UINT16 scrollx = ((m90_video_control[(layer*4)+2] << 0) | (m90_video_control[(layer*4)+3] << 8)) + video_offsets[0]; - UINT16 scrolly = ((m90_video_control[(layer*4)+0] << 0) | (m90_video_control[(layer*4)+1] << 8)) + video_offsets[1]; - - scrollx += layer ? -2 : 2; - scrollx += ((wide & 0x80) * 2); - - UINT16 *xscroll = (UINT16*)(DrvVidRAM + 0xf000 + (layer * 0x400)); - UINT16 *yscroll = (UINT16*)(DrvVidRAM + 0xf800 + (layer * 0x400)); - - for (INT32 sy = 0; sy < nScreenHeight; sy++) - { - INT32 scrollx_1 = scrollx; - INT32 scrolly_1 = 0; - UINT16 *dest = pTransDraw + (sy * nScreenWidth); - UINT8 *pri = RamPrioBitmap + (sy * nScreenWidth); - - if (enable_rowscroll) scrollx_1 += BURN_ENDIAN_SWAP_INT16(xscroll[sy]); - - if (enable_colscroll) { - scrolly_1 += (scrolly + sy + BURN_ENDIAN_SWAP_INT16(yscroll[sy]) + 128) & 0x1ff; - } else { - scrolly_1 += (scrolly + sy) & 0x1ff; - } - - INT32 romoff_1 = (scrolly_1 & 0x07) << 3; - - for (INT32 sx = 0; sx < nScreenWidth + 8; sx+=8) - { - INT32 scrollx_2 = (scrollx_1 + sx) & ((wide * 8) - 1); - - INT32 offs = ((scrolly_1 / 8) * wide) | (scrollx_2 / 8); - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]) & code_mask[0]; - INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]); - - INT32 flipy = color & 0x80; - INT32 flipx = color & 0x40; - INT32 group =(color & 0x30) ? 0 : 1; - color &= 0x0f; - - { - color <<= 4; - INT32 x_xor = 0; - INT32 romoff = romoff_1; - if (flipy) romoff ^= 0x38; - if (flipx) x_xor = 7; - - UINT8 *rom = DrvGfxROM0 + (code * 0x40) + romoff; - - INT32 xx = sx - (scrollx_2&0x7); - - for (INT32 x = 0; x < 8; x++, xx++) { - if (xx < 0 || xx >= nScreenWidth) continue; - - INT32 pxl = rom[x ^ x_xor]; - if (pxl == trans) continue; - - dest[xx] = pxl | color; - pri[xx] = 1 << group; - } - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i+=2) { - update_palette_entry(i); - } - DrvRecalc = 0; - } - - if ((m90_video_control[14] & 0x04) == 0) { - if (m90_video_control[12] & 0x10) { - memset (RamPrioBitmap, 0, nScreenWidth * nScreenHeight); - BurnTransferClear(); - } else { - if (nBurnLayer & 1) draw_layer(1); - } - - if (nBurnLayer & 2) draw_layer(0); - - if (nBurnLayer & 4) draw_sprites(); - } else { - BurnTransferClear(); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static void compile_inputs() -{ - memset (DrvInputs, 0xff, 5); - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - } -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - compile_inputs(); - - INT32 nInterleave = 128; // nmi pulses for sound cpu - INT32 nCyclesTotal[2]; - INT32 nCyclesDone[2]; - - // overclocking... - nCyclesTotal[0] = (INT32)((INT64)(8000000 / 60) * nBurnCPUSpeedAdjust / 0x0100); - nCyclesTotal[1] = (INT32)((INT64)(3579545 / 60) * nBurnCPUSpeedAdjust / 0x0100); - nCyclesDone[0] = nCyclesDone[1] = 0; - - VezNewFrame(); - ZetNewFrame(); - - VezOpen(0); - ZetOpen(0); - - vblank = 0; - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += VezRun(nCyclesTotal[0] / nInterleave); - - if (i == (nInterleave - 1)) - { - VezSetIRQLineAndVector(NEC_INPUT_LINE_INTP0, 0xff, VEZ_IRQSTATUS_ACK); - VezRun(0); - VezSetIRQLineAndVector(NEC_INPUT_LINE_INTP0, 0xff, VEZ_IRQSTATUS_NONE); - } - - nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave); - ZetNmi(); - - if (i == 124) vblank = 0x80; - } - - if (pBurnSoundOut) { - BurnYM2151Render(pBurnSoundOut, nBurnSoundLen); - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - VezClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - - -// Hasamu (Japan) - -static struct BurnRomInfo hasamuRomDesc[] = { - { "hasc-p1.bin", 0x20000, 0x53df9834, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "hasc-p0.bin", 0x20000, 0xdff0ba6e, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "hasc-sp.bin", 0x10000, 0x259b1687, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "hasc-c0.bin", 0x20000, 0xdd5a2174, 3 | BRF_GRA }, // 3 Tiles and sprites - { "hasc-c1.bin", 0x20000, 0x76b8217c, 3 | BRF_GRA }, // 4 - { "hasc-c2.bin", 0x20000, 0xd90f9a68, 3 | BRF_GRA }, // 5 - { "hasc-c3.bin", 0x20000, 0x6cfe0d39, 3 | BRF_GRA }, // 6 -}; - -STD_ROM_PICK(hasamu) -STD_ROM_FN(hasamu) - -static INT32 hasamuInit() -{ - video_offsets[0] = 48; - video_offsets[1] = 136; - return DrvInit(0x40000, 0x80000, 0x00000, 0, 0, gunforce_decryption_table); -} - -struct BurnDriver BurnDrvHasamu = { - "hasamu", NULL, NULL, NULL, "1991", - "Hasamu (Japan)\0", NULL, "Irem", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, hasamuRomInfo, hasamuRomName, NULL, NULL, p2commonInputInfo, HasamuDIPInfo, - hasamuInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; - - -// Dynablaster / Bomber Man - -static struct BurnRomInfo dynablstRomDesc[] = { - { "bbm-cp1e.62", 0x20000, 0x27667681, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "bbm-cp0e.65", 0x20000, 0x95db7a67, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bbm-sp.23", 0x10000, 0x251090cd, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "bbm-c0.66", 0x40000, 0x695d2019, 3 | BRF_GRA }, // 3 Tiles and sprites - { "bbm-c1.67", 0x40000, 0x4c7c8bbc, 3 | BRF_GRA }, // 4 - { "bbm-c2.68", 0x40000, 0x0700d406, 3 | BRF_GRA }, // 5 - { "bbm-c3.69", 0x40000, 0x3c3613af, 3 | BRF_GRA }, // 6 - - { "bbm-v0.20", 0x20000, 0x0fa803fe, 4 | BRF_SND }, // 7 Samples -}; - -STD_ROM_PICK(dynablst) -STD_ROM_FN(dynablst) - -static INT32 dynablstInit() -{ - video_offsets[0] = 80; - video_offsets[1] = 136; - return DrvInit(0x40000, 0x100000, 0x20000, 0, 0, bomberman_decryption_table); -} - -struct BurnDriver BurnDrvDynablst = { - "dynablst", NULL, NULL, NULL, "1991", - "Dynablaster / Bomber Man\0", NULL, "Irem (licensed from Hudson Soft)", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, dynablstRomInfo, dynablstRomName, NULL, NULL, p4commonInputInfo, DynablstDIPInfo, - dynablstInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 320, 240, 4, 3 -}; - - -// Bomber Man (Japan) - -static struct BurnRomInfo bombrmanRomDesc[] = { - { "bbm-p1.62", 0x20000, 0x982bd166, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "bbm-p0.65", 0x20000, 0x0a20afcc, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bbm-sp.23", 0x10000, 0x251090cd, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "bbm-c0.66", 0x40000, 0x695d2019, 3 | BRF_GRA }, // 3 Tiles and sprites - { "bbm-c1.67", 0x40000, 0x4c7c8bbc, 3 | BRF_GRA }, // 4 - { "bbm-c2.68", 0x40000, 0x0700d406, 3 | BRF_GRA }, // 5 - { "bbm-c3.69", 0x40000, 0x3c3613af, 3 | BRF_GRA }, // 6 - - { "bbm-v0.20", 0x20000, 0x0fa803fe, 4 | BRF_SND }, // 7 Samples -}; - -STD_ROM_PICK(bombrman) -STD_ROM_FN(bombrman) - -struct BurnDriver BurnDrvBombrman = { - "bombrman", "dynablst", NULL, NULL, "1991", - "Bomber Man (Japan)\0", NULL, "Irem (licensed from Hudson Soft)", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, bombrmanRomInfo, bombrmanRomName, NULL, NULL, p2commonInputInfo, BombrmanDIPInfo, - dynablstInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 320, 240, 4, 3 -}; - - -// Atomic Punk (US) - -static struct BurnRomInfo atompunkRomDesc[] = { - { "bbm-cp0d.65", 0x20000, 0x860c0479, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "bbm-cp1d.62", 0x20000, 0xbe57bf74, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bbm-sp.23", 0x10000, 0x251090cd, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "bbm-c0.66", 0x40000, 0x695d2019, 3 | BRF_GRA }, // 3 Tiles and sprites - { "bbm-c1.67", 0x40000, 0x4c7c8bbc, 3 | BRF_GRA }, // 4 - { "bbm-c2.68", 0x40000, 0x0700d406, 3 | BRF_GRA }, // 5 - { "bbm-c3.69", 0x40000, 0x3c3613af, 3 | BRF_GRA }, // 6 - - { "bbm-v0.20", 0x20000, 0x0fa803fe, 4 | BRF_SND }, // 7 Samples -}; - -STD_ROM_PICK(atompunk) -STD_ROM_FN(atompunk) - -struct BurnDriver BurnDrvAtompunk = { - "atompunk", "dynablst", NULL, NULL, "1991", - "Atomic Punk (US)\0", NULL, "Irem America (licensed from Hudson Soft)", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, atompunkRomInfo, atompunkRomName, NULL, NULL, p4commonInputInfo, AtompunkDIPInfo, - dynablstInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 320, 240, 4, 3 -}; - - -// Bomber Man World / New Dyna Blaster - Global Quest - -static struct BurnRomInfo bbmanwRomDesc[] = { - { "bbm2-h0-b.77", 0x40000, 0x567d3709, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "bbm2-l0-b.79", 0x40000, 0xe762c22b, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bbm2-sp.33", 0x10000, 0x6bc1689e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "bbm2-c0.81", 0x40000, 0xe7ce058a, 3 | BRF_GRA }, // 3 Tiles and sprites - { "bbm2-c1.82", 0x40000, 0x636a78a9, 3 | BRF_GRA }, // 4 - { "bbm2-c2.83", 0x40000, 0x9ac2142f, 3 | BRF_GRA }, // 5 - { "bbm2-c3.84", 0x40000, 0x47af1750, 3 | BRF_GRA }, // 6 - - { "bbm2-v0.30", 0x20000, 0x4ad889ed, 4 | BRF_SND }, // 7 Samples -}; - -STD_ROM_PICK(bbmanw) -STD_ROM_FN(bbmanw) - -static INT32 bbmanwInit() -{ - video_offsets[0] = 80; - video_offsets[1] = 136; - return DrvInit(0x80000, 0x100000, 0x20000, 0, 0, dynablaster_decryption_table); -} - -struct BurnDriver BurnDrvBbmanw = { - "bbmanw", NULL, NULL, NULL, "1992", - "Bomber Man World / New Dyna Blaster - Global Quest\0", NULL, "Irem", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, bbmanwRomInfo, bbmanwRomName, NULL, NULL, p4commonInputInfo, BbmanwDIPInfo, - bbmanwInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 320, 240, 4, 3 -}; - - -// Bomber Man World (Japan) - -static struct BurnRomInfo bbmanwjRomDesc[] = { - { "bbm2-h0.77", 0x40000, 0xe1407b91, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "bbm2-l0.79", 0x40000, 0x20873b49, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bbm2-sp-b.bin", 0x10000, 0xb8d8108c, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "bbm2-c0.81", 0x40000, 0xe7ce058a, 3 | BRF_GRA }, // 3 Tiles and sprites - { "bbm2-c1.82", 0x40000, 0x636a78a9, 3 | BRF_GRA }, // 4 - { "bbm2-c2.83", 0x40000, 0x9ac2142f, 3 | BRF_GRA }, // 5 - { "bbm2-c3.84", 0x40000, 0x47af1750, 3 | BRF_GRA }, // 6 - - { "bbm2-v0-b.30", 0x20000, 0x0ae655ff, 4 | BRF_SND }, // 7 Samples -}; - -STD_ROM_PICK(bbmanwj) -STD_ROM_FN(bbmanwj) - -struct BurnDriver BurnDrvBbmanwj = { - "bbmanwj", "bbmanw", NULL, NULL, "1992", - "Bomber Man World (Japan)\0", NULL, "Irem", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, bbmanwjRomInfo, bbmanwjRomName, NULL, NULL, p4commonInputInfo, BbmanwjDIPInfo, - bbmanwInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 320, 240, 4, 3 -}; - - -// New Atomic Punk - Global Quest (US) - -static struct BurnRomInfo newapunkRomDesc[] = { - { "bbm2-h0-a.77", 0x40000, 0x7d858682, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "bbm2-l0-a.79", 0x40000, 0xc7568031, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bbm2-sp.33", 0x10000, 0x6bc1689e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "bbm2-c0.81", 0x40000, 0xe7ce058a, 3 | BRF_GRA }, // 3 Tiles and sprites - { "bbm2-c1.82", 0x40000, 0x636a78a9, 3 | BRF_GRA }, // 4 - { "bbm2-c2.83", 0x40000, 0x9ac2142f, 3 | BRF_GRA }, // 5 - { "bbm2-c3.84", 0x40000, 0x47af1750, 3 | BRF_GRA }, // 6 - - { "bbm2-v0.30", 0x20000, 0x4ad889ed, 4 | BRF_SND }, // 7 Samples -}; - -STD_ROM_PICK(newapunk) -STD_ROM_FN(newapunk) - -struct BurnDriver BurnDrvNewapunk = { - "newapunk", "bbmanw", NULL, NULL, "1992", - "New Atomic Punk - Global Quest (US)\0", NULL, "Irem America", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, newapunkRomInfo, newapunkRomName, NULL, NULL, p4commonInputInfo, BbmanwjDIPInfo, - bbmanwInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 320, 240, 4, 3 -}; - - -// Quiz F1 1-2 Finish (Japan) - -static struct BurnRomInfo quizf1RomDesc[] = { - { "qf1-h0-.77", 0x40000, 0x280e3049, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "qf1-l0-.79", 0x40000, 0x94588a6f, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "qf1-sp-.33", 0x10000, 0x0664fa9f, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "qf1-c0-.81", 0x80000, 0xc26b521e, 3 | BRF_GRA }, // 3 Tiles and sprites - { "qf1-c1-.82", 0x80000, 0xdb9d7394, 3 | BRF_GRA }, // 4 - { "qf1-c2-.83", 0x80000, 0x0b1460ae, 3 | BRF_GRA }, // 5 - { "qf1-c3-.84", 0x80000, 0x2d32ff37, 3 | BRF_GRA }, // 6 - - { "qf1-v0-.30", 0x40000, 0xb8d16e7c, 4 | BRF_SND }, // 7 Samples - - { "qf1-h1-.78", 0x80000, 0xc6c2eb2b, 5 | BRF_PRG | BRF_ESS }, // 8 V30 banked code - { "qf1-l1-.80", 0x80000, 0x3132c144, 5 | BRF_PRG | BRF_ESS }, // 9 -}; - -STD_ROM_PICK(quizf1) -STD_ROM_FN(quizf1) - -static INT32 quizf1Init() -{ - video_offsets[0] = 48; - video_offsets[1] = 128; - return DrvInit(0x80000, 0x200000, 0x40000, 0x100000, 0, lethalth_decryption_table); -} - -struct BurnDriver BurnDrvQuizf1 = { - "quizf1", NULL, NULL, NULL, "1992", - "Quiz F1 1-2 Finish (Japan)\0", NULL, "Irem", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, quizf1RomInfo, quizf1RomName, NULL, NULL, Quizf1InputInfo, Quizf1DIPInfo, - quizf1Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; - - -// Risky Challenge - -static struct BurnRomInfo riskchalRomDesc[] = { - { "rc_h0.ic77", 0x40000, 0x4c9b5344, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "rc_l0.ic79", 0x40000, 0x0455895a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "l4_a-sp.ic33", 0x10000, 0xbb80094e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "rc_c0.rom", 0x80000, 0x84d0b907, 3 | BRF_GRA }, // 3 Tiles and sprites - { "rc_c1.rom", 0x80000, 0xcb3784ef, 3 | BRF_GRA }, // 4 - { "rc_c2.rom", 0x80000, 0x687164d7, 3 | BRF_GRA }, // 5 - { "rc_c3.rom", 0x80000, 0xc86be6af, 3 | BRF_GRA }, // 6 - - { "rc_v0.rom", 0x40000, 0xcddac360, 4 | BRF_SND }, // 7 Samples -}; - -STD_ROM_PICK(riskchal) -STD_ROM_FN(riskchal) - -static INT32 riskchalInit() -{ - video_offsets[0] = 80; - video_offsets[1] = 136; - return DrvInit(0x80000, 0x200000, 0x40000, 0, 0, gussun_decryption_table); -} - -struct BurnDriver BurnDrvRiskchal = { - "riskchal", NULL, NULL, NULL, "1993", - "Risky Challenge\0", "Unemulated CPU functions", "Irem", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, riskchalRomInfo, riskchalRomName, NULL, NULL, p2commonInputInfo, RiskchalDIPInfo, - riskchalInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 320, 240, 4, 3 -}; - - -// Gussun Oyoyo (Japan) - -static struct BurnRomInfo gussunRomDesc[] = { - { "l4_a-h0.ic77", 0x40000, 0x9d585e61, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "l4_a-l0.ic79", 0x40000, 0xc7b4c519, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "l4_a-sp.ic33", 0x10000, 0xbb80094e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "rc_c0.rom", 0x80000, 0x84d0b907, 3 | BRF_GRA }, // 3 Tiles and sprites - { "rc_c1.rom", 0x80000, 0xcb3784ef, 3 | BRF_GRA }, // 4 - { "rc_c2.rom", 0x80000, 0x687164d7, 3 | BRF_GRA }, // 5 - { "rc_c3.rom", 0x80000, 0xc86be6af, 3 | BRF_GRA }, // 6 - - { "rc_v0.rom", 0x40000, 0xcddac360, 4 | BRF_SND }, // 7 Samples -}; - -STD_ROM_PICK(gussun) -STD_ROM_FN(gussun) - -struct BurnDriver BurnDrvGussun = { - "gussun", "riskchal", NULL, NULL, "1993", - "Gussun Oyoyo (Japan)\0", "Unemulated CPU functions", "Irem", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, gussunRomInfo, gussunRomName, NULL, NULL, p2commonInputInfo, RiskchalDIPInfo, - riskchalInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 320, 240, 4, 3 -}; - - -// Match It II - -static struct BurnRomInfo matchit2RomDesc[] = { - { "sis2-h0-b.bin", 0x40000, 0x9a2556ac, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "sis2-l0-b.bin", 0x40000, 0xd35d948a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "sis2-sp-.rom", 0x10000, 0x6fc0ff3a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "ic81.rom", 0x80000, 0x5a7cb88f, 3 | BRF_GRA }, // 3 Tiles and sprites - { "ic82.rom", 0x80000, 0x54a7852c, 3 | BRF_GRA }, // 4 - { "ic83.rom", 0x80000, 0x2bd65dc6, 3 | BRF_GRA }, // 5 - { "ic84.rom", 0x80000, 0x876d5fdb, 3 | BRF_GRA }, // 6 -}; - -STD_ROM_PICK(matchit2) -STD_ROM_FN(matchit2) - -static INT32 matchit2Init() -{ - video_offsets[0] = 48; - video_offsets[1] = 128; - return DrvInit(0x80000, 0x200000, 0, 0, 0, matchit2_decryption_table); -} - -struct BurnDriver BurnDrvMatchit2 = { - "matchit2", NULL, NULL, NULL, "1993", - "Match It II\0", NULL, "Tamtex", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, matchit2RomInfo, matchit2RomName, NULL, NULL, Matchit2InputInfo, Matchit2DIPInfo, - matchit2Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; - - -// Shisensho II - -static struct BurnRomInfo shisen2RomDesc[] = { - { "sis2-h0-.rom", 0x40000, 0x6fae0aea, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code - { "sis2-l0-.rom", 0x40000, 0x2af25182, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "sis2-sp-.rom", 0x10000, 0x6fc0ff3a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "ic81.rom", 0x80000, 0x5a7cb88f, 3 | BRF_GRA }, // 3 Tiles and sprites - { "ic82.rom", 0x80000, 0x54a7852c, 3 | BRF_GRA }, // 4 - { "ic83.rom", 0x80000, 0x2bd65dc6, 3 | BRF_GRA }, // 5 - { "ic84.rom", 0x80000, 0x876d5fdb, 3 | BRF_GRA }, // 6 -}; - -STD_ROM_PICK(shisen2) -STD_ROM_FN(shisen2) - -struct BurnDriver BurnDrvShisen2 = { - "shisen2", "matchit2", NULL, NULL, "1993", - "Shisensho II\0", NULL, "Tamtex", "M90", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M90, GBF_MISC, 0, - NULL, shisen2RomInfo, shisen2RomName, NULL, NULL, Matchit2InputInfo, Shisen2DIPInfo, - matchit2Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; +// FB Alpha Irem M90 driver module +// Based on MAME driver by Bryan McPhail + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "nec_intf.h" +#include "irem_cpu.h" +#include "dac.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvV30ROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvSndROM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvV30RAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvPalRAM; + +static UINT8 *m90_video_control; + +static UINT8 *RamPrioBitmap; + +static UINT8 *soundlatch; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 irqvector; +static INT32 sample_address; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[5]; +static UINT8 DrvReset; + +static INT32 vblank; +static INT32 code_mask[2]; +static INT32 video_offsets[2] = { 0, 0 }; + +enum { VECTOR_INIT, YM2151_ASSERT, YM2151_CLEAR, Z80_ASSERT, Z80_CLEAR }; + +static struct BurnInputInfo p4commonInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, + + {"P3 Coin", BIT_DIGITAL, DrvJoy4 + 5, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, DrvJoy4 + 4, "p3 start" }, + {"P3 Up", BIT_DIGITAL, DrvJoy4 + 3, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy4 + 2, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy4 + 1, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy4 + 0, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 7, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 6, "p3 fire 2" }, + + {"P4 Coin", BIT_DIGITAL, DrvJoy5 + 5, "p4 coin" }, + {"P4 Start", BIT_DIGITAL, DrvJoy5 + 4, "p4 start" }, + {"P4 Up", BIT_DIGITAL, DrvJoy5 + 3, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvJoy5 + 2, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvJoy5 + 1, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvJoy5 + 0, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy5 + 7, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy5 + 6, "p4 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(p4common) + +static struct BurnInputInfo p2commonInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(p2common) + +static struct BurnInputInfo Quizf1InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 4" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 4" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Quizf1) + +static struct BurnInputInfo Matchit2InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Matchit2) + +static struct BurnDIPInfo DynablstDIPList[]= +{ + {0x22, 0xff, 0xff, 0xbf, NULL }, + {0x23, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x22, 0x01, 0x03, 0x02, "2" }, + {0x22, 0x01, 0x03, 0x03, "3" }, + {0x22, 0x01, 0x03, 0x01, "4" }, + {0x22, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x22, 0x01, 0x0c, 0x08, "Easy" }, + {0x22, 0x01, 0x0c, 0x0c, "Medium" }, + {0x22, 0x01, 0x0c, 0x04, "Hard" }, + {0x22, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Game Title" }, + {0x22, 0x01, 0x10, 0x10, "Dynablaster" }, + {0x22, 0x01, 0x10, 0x00, "Bomber Man" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x22, 0x01, 0x20, 0x00, "No" }, + {0x22, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x22, 0x01, 0x40, 0x40, "Off" }, + {0x22, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x22, 0x01, 0x80, 0x80, "Off" }, + {0x22, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x23, 0x01, 0x01, 0x01, "Off" }, + {0x23, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Cabinet" }, + {0x23, 0x01, 0x06, 0x04, "2 Player Upright" }, + {0x23, 0x01, 0x06, 0x06, "4 Player Upright A" }, + {0x23, 0x01, 0x06, 0x02, "4 Player Upright B" }, + {0x23, 0x01, 0x06, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x23, 0x01, 0x08, 0x08, "1" }, + {0x23, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x23, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, + {0x23, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x23, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x23, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x23, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x23, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x23, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x23, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x23, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x23, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x23, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Dynablst) + +static struct BurnDIPInfo AtompunkDIPList[]= +{ + {0x22, 0xff, 0xff, 0xbf, NULL }, + {0x23, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x22, 0x01, 0x03, 0x02, "2" }, + {0x22, 0x01, 0x03, 0x03, "3" }, + {0x22, 0x01, 0x03, 0x01, "4" }, + {0x22, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x22, 0x01, 0x0c, 0x08, "Easy" }, + {0x22, 0x01, 0x0c, 0x0c, "Medium" }, + {0x22, 0x01, 0x0c, 0x04, "Hard" }, + {0x22, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Unknown" }, + {0x22, 0x01, 0x10, 0x10, "Off" }, + {0x22, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x22, 0x01, 0x20, 0x00, "No" }, + {0x22, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x22, 0x01, 0x40, 0x40, "Off" }, + {0x22, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x22, 0x01, 0x80, 0x80, "Off" }, + {0x22, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x23, 0x01, 0x01, 0x01, "Off" }, + {0x23, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Cabinet" }, + {0x23, 0x01, 0x06, 0x04, "2 Player Upright" }, + {0x23, 0x01, 0x06, 0x06, "4 Player Upright A" }, + {0x23, 0x01, 0x06, 0x02, "4 Player Upright B" }, + {0x23, 0x01, 0x06, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x23, 0x01, 0x08, 0x08, "1" }, + {0x23, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x23, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, + {0x23, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x23, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x23, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x23, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x23, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x23, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x23, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x23, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x23, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x23, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Atompunk) + +static struct BurnDIPInfo BombrmanDIPList[]= +{ + {0x12, 0xff, 0xff, 0xaf, NULL }, + {0x13, 0xff, 0xff, 0xf9, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x03, 0x02, "2" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x01, "4" }, + {0x12, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Medium" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x12, 0x01, 0x20, 0x00, "No" }, + {0x12, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x13, 0x01, 0x08, 0x08, "1" }, + {0x13, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x13, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, + {0x13, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x13, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Bombrman) + +static struct BurnDIPInfo HasamuDIPList[]= +{ + {0x12, 0xff, 0xff, 0xbf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x12, 0x01, 0x20, 0x00, "No" }, + {0x12, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Unknown" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x13, 0x01, 0x08, 0x08, "1" }, + {0x13, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x13, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, + {0x13, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x13, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Hasamu) + +static struct BurnDIPInfo RiskchalDIPList[]= +{ + {0x12, 0xff, 0xff, 0xbf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x03, 0x02, "2" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x01, "4" }, + {0x12, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Medium" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Slots" }, + {0x13, 0x01, 0x04, 0x04, "Common" }, + {0x13, 0x01, 0x04, 0x00, "Separate" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x13, 0x01, 0x08, 0x08, "1" }, + {0x13, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x13, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, + {0x13, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x13, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Riskchal) + +static struct BurnDIPInfo BbmanwDIPList[]= +{ + {0x22, 0xff, 0xff, 0xbf, NULL }, + {0x23, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x22, 0x01, 0x03, 0x02, "2" }, + {0x22, 0x01, 0x03, 0x03, "3" }, + {0x22, 0x01, 0x03, 0x01, "4" }, + {0x22, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x22, 0x01, 0x0c, 0x08, "Easy" }, + {0x22, 0x01, 0x0c, 0x0c, "Medium" }, + {0x22, 0x01, 0x0c, 0x04, "Hard" }, + {0x22, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Game Title" }, + {0x22, 0x01, 0x10, 0x10, "Bomber Man World" }, + {0x22, 0x01, 0x10, 0x00, "New Dyna Blaster Global Quest" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x22, 0x01, 0x20, 0x00, "No" }, + {0x22, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x22, 0x01, 0x40, 0x40, "Off" }, + {0x22, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x22, 0x01, 0x80, 0x80, "Off" }, + {0x22, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x23, 0x01, 0x01, 0x01, "Off" }, + {0x23, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Cabinet" }, + {0x23, 0x01, 0x06, 0x04, "2 Player" }, + {0x23, 0x01, 0x06, 0x06, "4 Player Seprate Coins" }, + {0x23, 0x01, 0x06, 0x02, "4 Player Shared Coins" }, + {0x23, 0x01, 0x06, 0x00, "4 Player 1&2 3&4 Share Coins" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x23, 0x01, 0x08, 0x08, "1" }, + {0x23, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x23, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, + {0x23, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x23, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x23, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x23, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x23, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x23, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x23, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x23, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x23, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x23, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Bbmanw) + +static struct BurnDIPInfo BbmanwjDIPList[]= +{ + {0x22, 0xff, 0xff, 0xbf, NULL }, + {0x23, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x22, 0x01, 0x03, 0x02, "2" }, + {0x22, 0x01, 0x03, 0x03, "3" }, + {0x22, 0x01, 0x03, 0x01, "4" }, + {0x22, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x22, 0x01, 0x0c, 0x08, "Easy" }, + {0x22, 0x01, 0x0c, 0x0c, "Medium" }, + {0x22, 0x01, 0x0c, 0x04, "Hard" }, + {0x22, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x22, 0x01, 0x20, 0x00, "No" }, + {0x22, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x22, 0x01, 0x40, 0x40, "Off" }, + {0x22, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x22, 0x01, 0x80, 0x80, "Off" }, + {0x22, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x23, 0x01, 0x01, 0x01, "Off" }, + {0x23, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Cabinet" }, + {0x23, 0x01, 0x06, 0x04, "2 Player" }, + {0x23, 0x01, 0x06, 0x06, "4 Player Seprate Coins" }, + {0x23, 0x01, 0x06, 0x02, "4 Player Shared Coins" }, + {0x23, 0x01, 0x06, 0x00, "4 Player 1&2 3&4 Share Coins" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x23, 0x01, 0x08, 0x08, "1" }, + {0x23, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x23, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x23, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, + {0x23, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x23, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x23, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x23, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x23, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x23, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x23, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x23, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x23, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x23, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Bbmanwj) + +static struct BurnDIPInfo Quizf1DIPList[]= +{ + {0x16, 0xff, 0xff, 0x9f, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Input Device" }, + {0x16, 0x01, 0x20, 0x20, "Joystick" }, + {0x16, 0x01, 0x20, 0x00, "Buttons" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x40, 0x40, "Off" }, + {0x16, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x17, 0x01, 0x01, 0x01, "Off" }, + {0x17, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x17, 0x01, 0x08, 0x08, "1" }, + {0x17, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x17, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x17, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x17, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x17, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x17, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x17, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, + {0x17, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x17, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x17, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x17, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x17, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x17, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x17, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x17, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x17, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x17, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Quizf1) + +static struct BurnDIPInfo Matchit2DIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Girls Mode" }, + {0x14, 0x01, 0x01, 0x00, "Off" }, + {0x14, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2, "China Tiles" }, + {0x14, 0x01, 0x02, 0x02, "Mahjong" }, + {0x14, 0x01, 0x02, 0x00, "Alpha-Numeric" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x0c, 0x00, "Very Hard" }, + {0x14, 0x01, 0x0c, 0x04, "Hard" }, + {0x14, 0x01, 0x0c, 0x0c, "Normal" }, + {0x14, 0x01, 0x0c, 0x08, "Easy" }, + + {0 , 0xfe, 0 , 4, "Timer Speed" }, + {0x14, 0x01, 0x30, 0x00, "Very Hard" }, + {0x14, 0x01, 0x30, 0x10, "Hard" }, + {0x14, 0x01, 0x30, 0x30, "Normal" }, + {0x14, 0x01, 0x30, 0x20, "Easy" }, + + {0 , 0xfe, 0 , 2, "Title Screen" }, + {0x14, 0x01, 0x40, 0x40, "Match It II" }, + {0x14, 0x01, 0x40, 0x00, "Shisensho II" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 3, "Language" }, + {0x15, 0x01, 0x06, 0x06, "English" }, + {0x15, 0x01, 0x06, 0x04, "German" }, + {0x15, 0x01, 0x06, 0x02, "Korean" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x15, 0x01, 0x08, 0x08, "1" }, + {0x15, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x15, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, + {0x15, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x15, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x15, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x15, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x15, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Matchit2) + +static struct BurnDIPInfo Shisen2DIPList[]= +{ + {0x14, 0xff, 0xff, 0xbf, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Girls Mode" }, + {0x14, 0x01, 0x01, 0x00, "Off" }, + {0x14, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x0c, 0x00, "Very Hard" }, + {0x14, 0x01, 0x0c, 0x04, "Hard" }, + {0x14, 0x01, 0x0c, 0x0c, "Normal" }, + {0x14, 0x01, 0x0c, 0x08, "Easy" }, + + {0 , 0xfe, 0 , 4, "Timer Speed" }, + {0x14, 0x01, 0x30, 0x00, "Very Hard" }, + {0x14, 0x01, 0x30, 0x10, "Hard" }, + {0x14, 0x01, 0x30, 0x30, "Normal" }, + {0x14, 0x01, 0x30, 0x20, "Easy" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x15, 0x01, 0x08, 0x08, "1" }, + {0x15, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x15, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0x10, "2 Coins to Start/1 to Continue" }, + {0x15, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x15, 0x01, 0xf0, 0x20, "4 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x15, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x15, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x15, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Shisen2) + +static void setvector_callback(INT32 param) +{ + switch (param) + { + case VECTOR_INIT: irqvector = 0xff; break; + case YM2151_ASSERT: irqvector &= 0xef; break; + case YM2151_CLEAR: irqvector |= 0x10; break; + case Z80_ASSERT: irqvector &= 0xdf; break; + case Z80_CLEAR: irqvector |= 0x20; break; + } + + ZetSetVector(irqvector); + ZetSetIRQLine(0, (irqvector == 0xff) ? ZET_IRQSTATUS_NONE : ZET_IRQSTATUS_ACK); +} + +static inline void update_palette_entry(INT32 entry) +{ + UINT16 d = *((UINT16*)(DrvPalRAM + entry)); + +#ifndef LSB_FIRST + d = BURN_ENDIAN_SWAP_INT16(d); +#endif + + UINT8 r = (d >> 0) & 0x1f; + UINT8 g = (d >> 5) & 0x1f; + UINT8 b = (d >> 10) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[entry / 2] = BurnHighCol(r, g, b, 0); +} + +void __fastcall m90_main_write(UINT32 address, UINT8 data) +{ + if ((address & 0xffc00) == 0xe0000) { + DrvPalRAM[address & 0x3ff] = data; + update_palette_entry(address & 0x3fe); + return; + } +} + +UINT8 __fastcall m90_main_read(UINT32 /*address*/) +{ + return 0; +} + +void __fastcall m90_main_write_port(UINT32 port, UINT8 data) +{ + if ((port & ~0x0f) == 0x80) { + m90_video_control[port & 0x0f] = data; + return; + } + + switch (port) + { + case 0x00: + // case 0x01: + *soundlatch = data; + setvector_callback(Z80_ASSERT); + return; + + case 0x02: + // case 0x03: + // coin counter + return; + + case 0x04: + //case 0x05: + { + INT32 bankaddress = 0x100000 + 0x10000 * (data & 0x0f); + VezMapArea(0x80000, 0x8ffff, 0, DrvV30ROM + bankaddress); + VezMapArea(0x80000, 0x8ffff, 2, DrvV30ROM + bankaddress); + } + return; + + case 0x90: + // case 0x91: // nop dynablsb + return; + + //default: + // bprintf (0, _T("Writing %2.2x to port %2.2x wp\n"), data, port); + // break; + } +} + +UINT8 __fastcall m90_main_read_port(UINT32 port) +{ + switch (port) + { + case 0x00: return DrvInputs[0]; + case 0x01: return DrvInputs[1]; + case 0x02: return (DrvInputs[2] & 0x7f) | vblank; // system + // case 0x03: return 0xff; // ? + case 0x04: return DrvDips[0]; + case 0x05: return DrvDips[1]; + case 0x06: return DrvInputs[3]; + case 0x07: return DrvInputs[4]; + + //default: + // bprintf (0, _T("Reading port: %2.2x\n"), port); + // break; + } + + return 0; +} + +void __fastcall m90_sound_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + case 0x40: // bbmanw + BurnYM2151SelectRegister(data); + return; + + case 0x01: + case 0x41: // bbmanw + BurnYM2151WriteRegister(data); + return; + + case 0x80: + sample_address >>= 5; + sample_address = (sample_address & 0x00ff) | (data << 8); + sample_address <<= 5; + return; + + case 0x81: + sample_address >>= 5; + sample_address = (sample_address & 0xff00) | (data << 0); + sample_address <<= 5; + return; + + case 0x82: + DACSignedWrite(0, data); + sample_address = (sample_address + 1) & 0x3ffff; + return; + + case 0x42: // bbmanw + case 0x83: + setvector_callback(Z80_CLEAR); + return; + } +} + +UINT8 __fastcall m90_sound_read_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + case 0x40: // bbmanw + case 0x41: + return BurnYM2151ReadStatus(); + + case 0x42: // bbmanw + case 0x80: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0x84: + return DrvSndROM[sample_address & 0x3fff]; + } + + return 0; +} + +static void m72YM2151IRQHandler(INT32 nStatus) +{ + setvector_callback(nStatus ? YM2151_ASSERT : YM2151_CLEAR); +} + +static INT32 m90SyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (3579545.000 / (nBurnFPS / 100.000)))); +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + VezOpen(0); + VezReset(); + VezClose(); + + ZetOpen(0); + ZetReset(); + setvector_callback(VECTOR_INIT); + ZetClose(); + + BurnYM2151Reset(); + DACReset(); + + sample_address = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvV30ROM = Next; Next += 0x200000; + DrvZ80ROM = Next; Next += 0x010000; + DrvGfxROM0 = Next; Next += 0x400000; + DrvGfxROM1 = Next; Next += 0x400000; + DrvSndROM = Next; Next += 0x180000; + + RamPrioBitmap = Next; Next += nScreenWidth * nScreenHeight; + + AllRam = Next; + + DrvSprRAM = Next; Next += 0x000800; + DrvVidRAM = Next; Next += 0x010000; + DrvV30RAM = Next; Next += 0x004000; + DrvPalRAM = Next; Next += 0x000800; + DrvZ80RAM = Next; Next += 0x001000; + + soundlatch = Next; Next += 0x000001; + + m90_video_control = Next; Next += 0x000010; + + RamEnd = Next; + + DrvPalette = (UINT32 *) Next; Next += 0x0200 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvLoadRoms(INT32 codesize, INT32 samples, INT32 bank) +{ + if (BurnLoadRom(DrvV30ROM + 1, 0, 2)) return 1; + if (BurnLoadRom(DrvV30ROM + 0, 1, 2)) return 1; + + if (codesize == 0x40000) { + memcpy (DrvV30ROM + 0x7fff0, DrvV30ROM + 0x3fff0, 0x10); + } + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 6, 1)) return 1; + + if (samples) { + if (BurnLoadRom(DrvSndROM, 7, 1)) return 1; + + if (samples < 0x40000) { + memcpy (DrvSndROM + 0x20000, DrvSndROM + 0x00000, 0x20000); + } + } + + if (bank) { + if (BurnLoadRom(DrvV30ROM + 0x100001, 8, 2)) return 1; + if (BurnLoadRom(DrvV30ROM + 0x100000, 9, 2)) return 1; + } + + return 0; +} + +static void map_main_cpu(UINT8 *decrypt_table, INT32 codesize, INT32 spriteram) +{ + VezInit(0, V35_TYPE, 32000000/2); + + VezOpen(0); + if (decrypt_table != NULL) { + VezSetDecode(decrypt_table); + } + + VezMapArea(0x00000, (codesize-1), 0, DrvV30ROM + 0x000000); + VezMapArea(0x00000, (codesize-1), 2, DrvV30ROM + 0x000000); + VezMapArea(0x80000, 0x8ffff, 0, DrvV30ROM + 0x100000); + VezMapArea(0x80000, 0x8ffff, 2, DrvV30ROM + 0x100000); + VezMapArea(0xa0000, 0xa3fff, 0, DrvV30RAM); + VezMapArea(0xa0000, 0xa3fff, 1, DrvV30RAM); + VezMapArea(0xa0000, 0xa3fff, 2, DrvV30RAM); + VezMapArea(0xd0000, 0xdffff, 0, DrvVidRAM); + VezMapArea(0xd0000, 0xdffff, 1, DrvVidRAM); + VezMapArea(0xd0000, 0xdffff, 2, DrvVidRAM); + VezMapArea(0xe0000, 0xe07ff, 0, DrvPalRAM); +// VezMapArea(0xe0000, 0xe07ff, 1, DrvPalRAM); + VezMapArea(0xe0000, 0xe07ff, 2, DrvPalRAM); + VezMapArea(0xff800, 0xfffff, 0, DrvV30ROM + 0x07f800); + VezMapArea(0xff800, 0xfffff, 2, DrvV30ROM + 0x07f800); + + if (spriteram) { + VezMapArea(0x00000 + spriteram, 0x00fff + spriteram, 0, DrvSprRAM); // 00e - fff // ?? + VezMapArea(0x00000 + spriteram, 0x00fff + spriteram, 1, DrvSprRAM); + VezMapArea(0x00000 + spriteram, 0x00fff + spriteram, 2, DrvSprRAM); + } + + VezSetReadHandler(m90_main_read); + VezSetWriteHandler(m90_main_write); + VezSetReadPort(m90_main_read_port); + VezSetWritePort(m90_main_write_port); + VezClose(); +} + +static void DrvGfxDecode() +{ + INT32 Plane[4] = { 0x180000 * 8, 0x100000 * 8, 0x080000 * 8, 0x000000 * 8 }; + INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 }; + INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x200000); + if (tmp == NULL) { + return; + } + + memcpy (tmp, DrvGfxROM1, 0x200000); + + GfxDecode(0x10000, 4, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); + GfxDecode(0x04000, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); + + BurnFree (tmp); +} + +static INT32 DrvInit(INT32 codesize, INT32 gfxlen, INT32 samples, INT32 bank, INT32 spriteram, const UINT8 *decrypt_table) +{ + GenericTilesInit(); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (DrvLoadRoms(codesize, samples, bank)) return 1; + + DrvGfxDecode(); + + map_main_cpu((UINT8*)decrypt_table, codesize, spriteram); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); + ZetMapArea(0xf000, 0xffff, 0, DrvZ80RAM); + ZetMapArea(0xf000, 0xffff, 1, DrvZ80RAM); + ZetMapArea(0xf000, 0xffff, 2, DrvZ80RAM); + ZetSetOutHandler(m90_sound_write_port); + ZetSetInHandler(m90_sound_read_port); + ZetClose(); + + BurnYM2151Init(3579545); + YM2151SetIrqHandler(0, &m72YM2151IRQHandler); + BurnYM2151SetAllRoutes(0.15, BURN_SND_ROUTE_BOTH); + + DACInit(0, 0, 1, m90SyncDAC); + DACSetRoute(0, 0.10, BURN_SND_ROUTE_BOTH); + + code_mask[0] = ((gfxlen * 2) - 1) / (8 * 8); + code_mask[1] = ((gfxlen * 2) - 1) / (16 * 16); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM2151Exit(); + DACExit(); + + ZetExit(); + VezExit(); + + BurnFree(AllMem); + + video_offsets[0] = video_offsets[1] = 0; + + return 0; +} + +static void RenderTilePrio(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 width, INT32 height, UINT8 *pri, INT32 prio) +{ + if (sx <= (0-width) || sx >= nScreenWidth || sy <= (0-height) || sy >= nScreenHeight) return; + + INT32 flip = 0; + if (flipy) flip |= (height - 1) * width; + if (flipx) flip |= width - 1; + + gfx += code * width * height; + + for (INT32 y = 0; y < height; y++, sy++) { + if (sy < 0 || sy >= nScreenHeight) continue; + + for (INT32 x = 0; x < width; x++, sx++) { + if (sx < 0 || sx >= nScreenWidth) continue; + + INT32 pxl = gfx[((y * width) + x) ^ flip]; + + if (pxl == 0) continue; + + if ((prio & (1 << pri[sy * nScreenWidth + sx])) == 0) { + dest[sy * nScreenWidth + sx] = pxl | color; + pri[sy * nScreenWidth + sx] = 7; + } + } + + sx -= width; + } +} + +static void draw_sprites() +{ + INT32 pri_ctrl = m90_video_control[14] & 0x03; + UINT16 *sram = (UINT16*)(DrvVidRAM + 0xee00); + + for (INT32 offs = 0x1f2/2; offs >= 0; offs -= 3) + { + INT32 sy = BURN_ENDIAN_SWAP_INT16(sram[offs + 0]); + INT32 code = BURN_ENDIAN_SWAP_INT16(sram[offs + 1]); + INT32 sx = BURN_ENDIAN_SWAP_INT16(sram[offs + 2]); + + INT32 flipy = sy & 0x8000; + INT32 flipx = sx & 0x0200; + INT32 multi = 1 << ((sy & 0x6000) >> 13); + INT32 color = (sy >> 9) & 0x0f; + + sx = ((sx - video_offsets[0]) & 0x1ff) - 16; + sy = (512 - ((sy + video_offsets[1]) & 0x1ff)) - (16 * multi); + + INT32 prio = 0x82; + if (pri_ctrl & 0x01) { + if ((color & 0x08) == 0x08) prio = 0x80; + } else if (pri_ctrl & 0x02) { + if ((color & 0x0c) == 0x0c) prio = 0x80; + } + + for (INT32 i = 0; i < multi; i++) { + RenderTilePrio(pTransDraw, DrvGfxROM1, (code + (flipy ? multi-1 - i : i)) & code_mask[1], (color << 4)|0x100, sx, sy+i*16, flipx, flipy, 16, 16, RamPrioBitmap, prio); + } + } +} + +static void draw_layer(INT32 layer) +{ + INT32 control = m90_video_control[10 + (layer * 2)]; + + if (control & 0x10) return; // disable layer + + INT32 enable_rowscroll = control & 0x20; + INT32 enable_colscroll = control & 0x40; + + INT32 wide = (control & 0x04) ? 128 : 64; + + INT32 trans = layer ? 0xff : 0; + + INT32 pmask = (wide == 128) ? 2 : 3; + UINT16 *vram = (UINT16*)(DrvVidRAM + (control & pmask) * 0x4000); + + UINT16 scrollx = ((m90_video_control[(layer*4)+2] << 0) | (m90_video_control[(layer*4)+3] << 8)) + video_offsets[0]; + UINT16 scrolly = ((m90_video_control[(layer*4)+0] << 0) | (m90_video_control[(layer*4)+1] << 8)) + video_offsets[1]; + + scrollx += layer ? -2 : 2; + scrollx += ((wide & 0x80) * 2); + + UINT16 *xscroll = (UINT16*)(DrvVidRAM + 0xf000 + (layer * 0x400)); + UINT16 *yscroll = (UINT16*)(DrvVidRAM + 0xf800 + (layer * 0x400)); + + for (INT32 sy = 0; sy < nScreenHeight; sy++) + { + INT32 scrollx_1 = scrollx; + INT32 scrolly_1 = 0; + UINT16 *dest = pTransDraw + (sy * nScreenWidth); + UINT8 *pri = RamPrioBitmap + (sy * nScreenWidth); + + if (enable_rowscroll) scrollx_1 += BURN_ENDIAN_SWAP_INT16(xscroll[sy]); + + if (enable_colscroll) { + scrolly_1 += (scrolly + sy + BURN_ENDIAN_SWAP_INT16(yscroll[sy]) + 128) & 0x1ff; + } else { + scrolly_1 += (scrolly + sy) & 0x1ff; + } + + INT32 romoff_1 = (scrolly_1 & 0x07) << 3; + + for (INT32 sx = 0; sx < nScreenWidth + 8; sx+=8) + { + INT32 scrollx_2 = (scrollx_1 + sx) & ((wide * 8) - 1); + + INT32 offs = ((scrolly_1 / 8) * wide) | (scrollx_2 / 8); + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]) & code_mask[0]; + INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]); + + INT32 flipy = color & 0x80; + INT32 flipx = color & 0x40; + INT32 group =(color & 0x30) ? 0 : 1; + color &= 0x0f; + + { + color <<= 4; + INT32 x_xor = 0; + INT32 romoff = romoff_1; + if (flipy) romoff ^= 0x38; + if (flipx) x_xor = 7; + + UINT8 *rom = DrvGfxROM0 + (code * 0x40) + romoff; + + INT32 xx = sx - (scrollx_2&0x7); + + for (INT32 x = 0; x < 8; x++, xx++) { + if (xx < 0 || xx >= nScreenWidth) continue; + + INT32 pxl = rom[x ^ x_xor]; + if (pxl == trans) continue; + + dest[xx] = pxl | color; + pri[xx] = 1 << group; + } + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i+=2) { + update_palette_entry(i); + } + DrvRecalc = 0; + } + + if ((m90_video_control[14] & 0x04) == 0) { + if (m90_video_control[12] & 0x10) { + memset (RamPrioBitmap, 0, nScreenWidth * nScreenHeight); + BurnTransferClear(); + } else { + if (nBurnLayer & 1) draw_layer(1); + } + + if (nBurnLayer & 2) draw_layer(0); + + if (nBurnLayer & 4) draw_sprites(); + } else { + BurnTransferClear(); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static void compile_inputs() +{ + memset (DrvInputs, 0xff, 5); + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + } +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + compile_inputs(); + + INT32 nInterleave = 128; // nmi pulses for sound cpu + INT32 nCyclesTotal[2]; + INT32 nCyclesDone[2]; + + // overclocking... + nCyclesTotal[0] = (INT32)((INT64)(8000000 / 60) * nBurnCPUSpeedAdjust / 0x0100); + nCyclesTotal[1] = (INT32)((INT64)(3579545 / 60) * nBurnCPUSpeedAdjust / 0x0100); + nCyclesDone[0] = nCyclesDone[1] = 0; + + VezNewFrame(); + ZetNewFrame(); + + VezOpen(0); + ZetOpen(0); + + vblank = 0; + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += VezRun(nCyclesTotal[0] / nInterleave); + + if (i == (nInterleave - 1)) + { + VezSetIRQLineAndVector(NEC_INPUT_LINE_INTP0, 0xff, VEZ_IRQSTATUS_ACK); + VezRun(0); + VezSetIRQLineAndVector(NEC_INPUT_LINE_INTP0, 0xff, VEZ_IRQSTATUS_NONE); + } + + nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave); + ZetNmi(); + + if (i == 124) vblank = 0x80; + } + + if (pBurnSoundOut) { + BurnYM2151Render(pBurnSoundOut, nBurnSoundLen); + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + VezClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + + +// Hasamu (Japan) + +static struct BurnRomInfo hasamuRomDesc[] = { + { "hasc-p1.bin", 0x20000, 0x53df9834, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "hasc-p0.bin", 0x20000, 0xdff0ba6e, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "hasc-sp.bin", 0x10000, 0x259b1687, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "hasc-c0.bin", 0x20000, 0xdd5a2174, 3 | BRF_GRA }, // 3 Tiles and sprites + { "hasc-c1.bin", 0x20000, 0x76b8217c, 3 | BRF_GRA }, // 4 + { "hasc-c2.bin", 0x20000, 0xd90f9a68, 3 | BRF_GRA }, // 5 + { "hasc-c3.bin", 0x20000, 0x6cfe0d39, 3 | BRF_GRA }, // 6 +}; + +STD_ROM_PICK(hasamu) +STD_ROM_FN(hasamu) + +static INT32 hasamuInit() +{ + video_offsets[0] = 48; + video_offsets[1] = 136; + return DrvInit(0x40000, 0x80000, 0x00000, 0, 0, gunforce_decryption_table); +} + +struct BurnDriver BurnDrvHasamu = { + "hasamu", NULL, NULL, NULL, "1991", + "Hasamu (Japan)\0", NULL, "Irem", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, hasamuRomInfo, hasamuRomName, NULL, NULL, p2commonInputInfo, HasamuDIPInfo, + hasamuInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; + + +// Dynablaster / Bomber Man + +static struct BurnRomInfo dynablstRomDesc[] = { + { "bbm-cp1e.62", 0x20000, 0x27667681, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "bbm-cp0e.65", 0x20000, 0x95db7a67, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bbm-sp.23", 0x10000, 0x251090cd, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "bbm-c0.66", 0x40000, 0x695d2019, 3 | BRF_GRA }, // 3 Tiles and sprites + { "bbm-c1.67", 0x40000, 0x4c7c8bbc, 3 | BRF_GRA }, // 4 + { "bbm-c2.68", 0x40000, 0x0700d406, 3 | BRF_GRA }, // 5 + { "bbm-c3.69", 0x40000, 0x3c3613af, 3 | BRF_GRA }, // 6 + + { "bbm-v0.20", 0x20000, 0x0fa803fe, 4 | BRF_SND }, // 7 Samples +}; + +STD_ROM_PICK(dynablst) +STD_ROM_FN(dynablst) + +static INT32 dynablstInit() +{ + video_offsets[0] = 80; + video_offsets[1] = 136; + return DrvInit(0x40000, 0x100000, 0x20000, 0, 0, bomberman_decryption_table); +} + +struct BurnDriver BurnDrvDynablst = { + "dynablst", NULL, NULL, NULL, "1991", + "Dynablaster / Bomber Man\0", NULL, "Irem (licensed from Hudson Soft)", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, dynablstRomInfo, dynablstRomName, NULL, NULL, p4commonInputInfo, DynablstDIPInfo, + dynablstInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 320, 240, 4, 3 +}; + + +// Bomber Man (Japan) + +static struct BurnRomInfo bombrmanRomDesc[] = { + { "bbm-p1.62", 0x20000, 0x982bd166, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "bbm-p0.65", 0x20000, 0x0a20afcc, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bbm-sp.23", 0x10000, 0x251090cd, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "bbm-c0.66", 0x40000, 0x695d2019, 3 | BRF_GRA }, // 3 Tiles and sprites + { "bbm-c1.67", 0x40000, 0x4c7c8bbc, 3 | BRF_GRA }, // 4 + { "bbm-c2.68", 0x40000, 0x0700d406, 3 | BRF_GRA }, // 5 + { "bbm-c3.69", 0x40000, 0x3c3613af, 3 | BRF_GRA }, // 6 + + { "bbm-v0.20", 0x20000, 0x0fa803fe, 4 | BRF_SND }, // 7 Samples +}; + +STD_ROM_PICK(bombrman) +STD_ROM_FN(bombrman) + +struct BurnDriver BurnDrvBombrman = { + "bombrman", "dynablst", NULL, NULL, "1991", + "Bomber Man (Japan)\0", NULL, "Irem (licensed from Hudson Soft)", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, bombrmanRomInfo, bombrmanRomName, NULL, NULL, p2commonInputInfo, BombrmanDIPInfo, + dynablstInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 320, 240, 4, 3 +}; + + +// Atomic Punk (US) + +static struct BurnRomInfo atompunkRomDesc[] = { + { "bbm-cp0d.65", 0x20000, 0x860c0479, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "bbm-cp1d.62", 0x20000, 0xbe57bf74, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bbm-sp.23", 0x10000, 0x251090cd, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "bbm-c0.66", 0x40000, 0x695d2019, 3 | BRF_GRA }, // 3 Tiles and sprites + { "bbm-c1.67", 0x40000, 0x4c7c8bbc, 3 | BRF_GRA }, // 4 + { "bbm-c2.68", 0x40000, 0x0700d406, 3 | BRF_GRA }, // 5 + { "bbm-c3.69", 0x40000, 0x3c3613af, 3 | BRF_GRA }, // 6 + + { "bbm-v0.20", 0x20000, 0x0fa803fe, 4 | BRF_SND }, // 7 Samples +}; + +STD_ROM_PICK(atompunk) +STD_ROM_FN(atompunk) + +struct BurnDriver BurnDrvAtompunk = { + "atompunk", "dynablst", NULL, NULL, "1991", + "Atomic Punk (US)\0", NULL, "Irem America (licensed from Hudson Soft)", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, atompunkRomInfo, atompunkRomName, NULL, NULL, p4commonInputInfo, AtompunkDIPInfo, + dynablstInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 320, 240, 4, 3 +}; + + +// Bomber Man World / New Dyna Blaster - Global Quest + +static struct BurnRomInfo bbmanwRomDesc[] = { + { "bbm2-h0-b.77", 0x40000, 0x567d3709, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "bbm2-l0-b.79", 0x40000, 0xe762c22b, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bbm2-sp.33", 0x10000, 0x6bc1689e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "bbm2-c0.81", 0x40000, 0xe7ce058a, 3 | BRF_GRA }, // 3 Tiles and sprites + { "bbm2-c1.82", 0x40000, 0x636a78a9, 3 | BRF_GRA }, // 4 + { "bbm2-c2.83", 0x40000, 0x9ac2142f, 3 | BRF_GRA }, // 5 + { "bbm2-c3.84", 0x40000, 0x47af1750, 3 | BRF_GRA }, // 6 + + { "bbm2-v0.30", 0x20000, 0x4ad889ed, 4 | BRF_SND }, // 7 Samples +}; + +STD_ROM_PICK(bbmanw) +STD_ROM_FN(bbmanw) + +static INT32 bbmanwInit() +{ + video_offsets[0] = 80; + video_offsets[1] = 136; + return DrvInit(0x80000, 0x100000, 0x20000, 0, 0, dynablaster_decryption_table); +} + +struct BurnDriver BurnDrvBbmanw = { + "bbmanw", NULL, NULL, NULL, "1992", + "Bomber Man World / New Dyna Blaster - Global Quest\0", NULL, "Irem", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, bbmanwRomInfo, bbmanwRomName, NULL, NULL, p4commonInputInfo, BbmanwDIPInfo, + bbmanwInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 320, 240, 4, 3 +}; + + +// Bomber Man World (Japan) + +static struct BurnRomInfo bbmanwjRomDesc[] = { + { "bbm2-h0.77", 0x40000, 0xe1407b91, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "bbm2-l0.79", 0x40000, 0x20873b49, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bbm2-sp-b.bin", 0x10000, 0xb8d8108c, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "bbm2-c0.81", 0x40000, 0xe7ce058a, 3 | BRF_GRA }, // 3 Tiles and sprites + { "bbm2-c1.82", 0x40000, 0x636a78a9, 3 | BRF_GRA }, // 4 + { "bbm2-c2.83", 0x40000, 0x9ac2142f, 3 | BRF_GRA }, // 5 + { "bbm2-c3.84", 0x40000, 0x47af1750, 3 | BRF_GRA }, // 6 + + { "bbm2-v0-b.30", 0x20000, 0x0ae655ff, 4 | BRF_SND }, // 7 Samples +}; + +STD_ROM_PICK(bbmanwj) +STD_ROM_FN(bbmanwj) + +struct BurnDriver BurnDrvBbmanwj = { + "bbmanwj", "bbmanw", NULL, NULL, "1992", + "Bomber Man World (Japan)\0", NULL, "Irem", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, bbmanwjRomInfo, bbmanwjRomName, NULL, NULL, p4commonInputInfo, BbmanwjDIPInfo, + bbmanwInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 320, 240, 4, 3 +}; + + +// New Atomic Punk - Global Quest (US) + +static struct BurnRomInfo newapunkRomDesc[] = { + { "bbm2-h0-a.77", 0x40000, 0x7d858682, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "bbm2-l0-a.79", 0x40000, 0xc7568031, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bbm2-sp.33", 0x10000, 0x6bc1689e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "bbm2-c0.81", 0x40000, 0xe7ce058a, 3 | BRF_GRA }, // 3 Tiles and sprites + { "bbm2-c1.82", 0x40000, 0x636a78a9, 3 | BRF_GRA }, // 4 + { "bbm2-c2.83", 0x40000, 0x9ac2142f, 3 | BRF_GRA }, // 5 + { "bbm2-c3.84", 0x40000, 0x47af1750, 3 | BRF_GRA }, // 6 + + { "bbm2-v0.30", 0x20000, 0x4ad889ed, 4 | BRF_SND }, // 7 Samples +}; + +STD_ROM_PICK(newapunk) +STD_ROM_FN(newapunk) + +struct BurnDriver BurnDrvNewapunk = { + "newapunk", "bbmanw", NULL, NULL, "1992", + "New Atomic Punk - Global Quest (US)\0", NULL, "Irem America", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, newapunkRomInfo, newapunkRomName, NULL, NULL, p4commonInputInfo, BbmanwjDIPInfo, + bbmanwInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 320, 240, 4, 3 +}; + + +// Quiz F1 1-2 Finish (Japan) + +static struct BurnRomInfo quizf1RomDesc[] = { + { "qf1-h0-.77", 0x40000, 0x280e3049, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "qf1-l0-.79", 0x40000, 0x94588a6f, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "qf1-sp-.33", 0x10000, 0x0664fa9f, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "qf1-c0-.81", 0x80000, 0xc26b521e, 3 | BRF_GRA }, // 3 Tiles and sprites + { "qf1-c1-.82", 0x80000, 0xdb9d7394, 3 | BRF_GRA }, // 4 + { "qf1-c2-.83", 0x80000, 0x0b1460ae, 3 | BRF_GRA }, // 5 + { "qf1-c3-.84", 0x80000, 0x2d32ff37, 3 | BRF_GRA }, // 6 + + { "qf1-v0-.30", 0x40000, 0xb8d16e7c, 4 | BRF_SND }, // 7 Samples + + { "qf1-h1-.78", 0x80000, 0xc6c2eb2b, 5 | BRF_PRG | BRF_ESS }, // 8 V30 banked code + { "qf1-l1-.80", 0x80000, 0x3132c144, 5 | BRF_PRG | BRF_ESS }, // 9 +}; + +STD_ROM_PICK(quizf1) +STD_ROM_FN(quizf1) + +static INT32 quizf1Init() +{ + video_offsets[0] = 48; + video_offsets[1] = 128; + return DrvInit(0x80000, 0x200000, 0x40000, 0x100000, 0, lethalth_decryption_table); +} + +struct BurnDriver BurnDrvQuizf1 = { + "quizf1", NULL, NULL, NULL, "1992", + "Quiz F1 1-2 Finish (Japan)\0", NULL, "Irem", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, quizf1RomInfo, quizf1RomName, NULL, NULL, Quizf1InputInfo, Quizf1DIPInfo, + quizf1Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; + + +// Risky Challenge + +static struct BurnRomInfo riskchalRomDesc[] = { + { "rc_h0.ic77", 0x40000, 0x4c9b5344, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "rc_l0.ic79", 0x40000, 0x0455895a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "l4_a-sp.ic33", 0x10000, 0xbb80094e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "rc_c0.rom", 0x80000, 0x84d0b907, 3 | BRF_GRA }, // 3 Tiles and sprites + { "rc_c1.rom", 0x80000, 0xcb3784ef, 3 | BRF_GRA }, // 4 + { "rc_c2.rom", 0x80000, 0x687164d7, 3 | BRF_GRA }, // 5 + { "rc_c3.rom", 0x80000, 0xc86be6af, 3 | BRF_GRA }, // 6 + + { "rc_v0.rom", 0x40000, 0xcddac360, 4 | BRF_SND }, // 7 Samples +}; + +STD_ROM_PICK(riskchal) +STD_ROM_FN(riskchal) + +static INT32 riskchalInit() +{ + video_offsets[0] = 80; + video_offsets[1] = 136; + return DrvInit(0x80000, 0x200000, 0x40000, 0, 0, gussun_decryption_table); +} + +struct BurnDriver BurnDrvRiskchal = { + "riskchal", NULL, NULL, NULL, "1993", + "Risky Challenge\0", "Unemulated CPU functions", "Irem", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, riskchalRomInfo, riskchalRomName, NULL, NULL, p2commonInputInfo, RiskchalDIPInfo, + riskchalInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 320, 240, 4, 3 +}; + + +// Gussun Oyoyo (Japan) + +static struct BurnRomInfo gussunRomDesc[] = { + { "l4_a-h0.ic77", 0x40000, 0x9d585e61, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "l4_a-l0.ic79", 0x40000, 0xc7b4c519, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "l4_a-sp.ic33", 0x10000, 0xbb80094e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "rc_c0.rom", 0x80000, 0x84d0b907, 3 | BRF_GRA }, // 3 Tiles and sprites + { "rc_c1.rom", 0x80000, 0xcb3784ef, 3 | BRF_GRA }, // 4 + { "rc_c2.rom", 0x80000, 0x687164d7, 3 | BRF_GRA }, // 5 + { "rc_c3.rom", 0x80000, 0xc86be6af, 3 | BRF_GRA }, // 6 + + { "rc_v0.rom", 0x40000, 0xcddac360, 4 | BRF_SND }, // 7 Samples +}; + +STD_ROM_PICK(gussun) +STD_ROM_FN(gussun) + +struct BurnDriver BurnDrvGussun = { + "gussun", "riskchal", NULL, NULL, "1993", + "Gussun Oyoyo (Japan)\0", "Unemulated CPU functions", "Irem", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, gussunRomInfo, gussunRomName, NULL, NULL, p2commonInputInfo, RiskchalDIPInfo, + riskchalInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 320, 240, 4, 3 +}; + + +// Match It II + +static struct BurnRomInfo matchit2RomDesc[] = { + { "sis2-h0-b.bin", 0x40000, 0x9a2556ac, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "sis2-l0-b.bin", 0x40000, 0xd35d948a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "sis2-sp-.rom", 0x10000, 0x6fc0ff3a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "ic81.rom", 0x80000, 0x5a7cb88f, 3 | BRF_GRA }, // 3 Tiles and sprites + { "ic82.rom", 0x80000, 0x54a7852c, 3 | BRF_GRA }, // 4 + { "ic83.rom", 0x80000, 0x2bd65dc6, 3 | BRF_GRA }, // 5 + { "ic84.rom", 0x80000, 0x876d5fdb, 3 | BRF_GRA }, // 6 +}; + +STD_ROM_PICK(matchit2) +STD_ROM_FN(matchit2) + +static INT32 matchit2Init() +{ + video_offsets[0] = 48; + video_offsets[1] = 128; + return DrvInit(0x80000, 0x200000, 0, 0, 0, matchit2_decryption_table); +} + +struct BurnDriver BurnDrvMatchit2 = { + "matchit2", NULL, NULL, NULL, "1993", + "Match It II\0", NULL, "Tamtex", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, matchit2RomInfo, matchit2RomName, NULL, NULL, Matchit2InputInfo, Matchit2DIPInfo, + matchit2Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; + + +// Shisensho II + +static struct BurnRomInfo shisen2RomDesc[] = { + { "sis2-h0-.rom", 0x40000, 0x6fae0aea, 1 | BRF_PRG | BRF_ESS }, // 0 V30 Code + { "sis2-l0-.rom", 0x40000, 0x2af25182, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "sis2-sp-.rom", 0x10000, 0x6fc0ff3a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "ic81.rom", 0x80000, 0x5a7cb88f, 3 | BRF_GRA }, // 3 Tiles and sprites + { "ic82.rom", 0x80000, 0x54a7852c, 3 | BRF_GRA }, // 4 + { "ic83.rom", 0x80000, 0x2bd65dc6, 3 | BRF_GRA }, // 5 + { "ic84.rom", 0x80000, 0x876d5fdb, 3 | BRF_GRA }, // 6 +}; + +STD_ROM_PICK(shisen2) +STD_ROM_FN(shisen2) + +struct BurnDriver BurnDrvShisen2 = { + "shisen2", "matchit2", NULL, NULL, "1993", + "Shisensho II\0", NULL, "Tamtex", "M90", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_M90, GBF_MISC, 0, + NULL, shisen2RomInfo, shisen2RomName, NULL, NULL, Matchit2InputInfo, Shisen2DIPInfo, + matchit2Init, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; diff --git a/src/burn/drv/irem/d_vigilant.cpp b/src/burn/drv/irem/d_vigilant.cpp index 62cff3462..1cc990657 100644 --- a/src/burn/drv/irem/d_vigilant.cpp +++ b/src/burn/drv/irem/d_vigilant.cpp @@ -1,2189 +1,2183 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "burn_ym2203.h" -#include "dac.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[3] = {0, 0, 0}; -static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *DrvZ80Rom1 = NULL; -static UINT8 *DrvZ80Rom2 = NULL; -static UINT8 *DrvZ80Ram1 = NULL; -static UINT8 *DrvZ80Ram2 = NULL; -static UINT8 *DrvVideoRam = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvPaletteRam = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvBackTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvSamples = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT8 DrvRomBank; -static UINT8 DrvSoundLatch; -static UINT8 DrvIrqVector; - -static INT32 DrvRearColour; -static INT32 DrvRearDisable; -static INT32 DrvHorizScrollLo; -static INT32 DrvHorizScrollHi; -static INT32 DrvRearHorizScrollLo; -static INT32 DrvRearHorizScrollHi; -static INT32 DrvSampleAddress; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static UINT8 DrvHasYM2203 = 0; -static UINT8 DrvKikcubicDraw = 0; - -#define VECTOR_INIT 0 -#define YM2151_ASSERT 1 -#define YM2151_CLEAR 2 -#define Z80_ASSERT 3 -#define Z80_CLEAR 4 - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, - {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo BuccanrsInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 6, "p2 start" }, - - {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, - {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Buccanrs) - -static struct BurnInputInfo BuccanrsaInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, - {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Buccanrsa) - -static struct BurnInputInfo KikcubicInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, - {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Kikcubic) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - } - - // Clear Opposites - DrvClearOpposites(&DrvInput[1]); - DrvClearOpposites(&DrvInput[2]); -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x02, "2" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x01, "4" }, - {0x12, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x12, 0x01, 0x04, 0x04, "Normal" }, - {0x12, 0x01, 0x04, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Energy Decrease Rate" }, - {0x12, 0x01, 0x08, 0x08, "Slow" }, - {0x12, 0x01, 0x08, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 16 , "Coinage" }, - {0x12, 0x01, 0xf0, 0xa0, "6 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0xb0, "5 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0xc0, "4 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0xd0, "3 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x10, "8 Coins 3 Plays" }, - {0x12, 0x01, 0xf0, 0xe0, "2 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x20, "5 Coins 3 Plays" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 2 Plays" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, - {0x12, 0x01, 0xf0, 0x40, "2 Coins 3 Plays" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 2 Plays" }, - {0x12, 0x01, 0xf0, 0x80, "1 Coin 3 Plays" }, - {0x12, 0x01, 0xf0, 0x70, "1 Coin 4 Plays" }, - {0x12, 0x01, 0xf0, 0x60, "1 Coin 5 Plays" }, - {0x12, 0x01, 0xf0, 0x50, "1 Coin 6 Plays" }, - {0x12, 0x01, 0xf0, 0x00, "Freeplay" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x02, 0x00, "Upright" }, - {0x13, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x13, 0x01, 0x04, 0x04, "Mode 1" }, - {0x13, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x10, 0x00, "Off" }, - {0x13, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Stop Mode" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(Drv) - -static struct BurnDIPInfo BuccanrsDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x2f, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 12 , "Coin A" }, - {0x12, 0x01, 0x0f, 0x04, "4 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x07, "3 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x00, "5 Coins 2 Plays" }, - {0x12, 0x01, 0x0f, 0x0a, "2 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x06, "3 Coins 2 Plays" }, - {0x12, 0x01, 0x0f, 0x03, "4 Coins 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 5 Plays" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, - - {0 , 0xfe, 0 , 12 , "Coin B" }, - {0x12, 0x01, 0xf0, 0x40, "4 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x70, "3 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x00, "5 Coins 2 Plays" }, - {0x12, 0x01, 0xf0, 0xa0, "2 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x60, "3 Coins 2 Plays" }, - {0x12, 0x01, 0xf0, 0x30, "4 Coins 3 Plays" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 5 Plays" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Plays" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Plays" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x06, 0x06, "2" }, - {0x13, 0x01, 0x06, 0x04, "3" }, - {0x13, 0x01, 0x06, 0x02, "4" }, - {0x13, 0x01, 0x06, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x18, 0x18, "Normal" }, - {0x13, 0x01, 0x18, 0x08, "Medium" }, - {0x13, 0x01, 0x18, 0x10, "Hard" }, - {0x13, 0x01, 0x18, 0x00, "Invincibilty" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x20, 0x20, "Upright" }, - {0x13, 0x01, 0x20, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Buccanrs) - -static struct BurnDIPInfo BuccanrsaDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xf4, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0xf4, 0xf4, "Off" }, - {0x11, 0x01, 0xf4, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 12 , "Coin A" }, - {0x12, 0x01, 0x0f, 0x04, "4 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x07, "3 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x00, "5 Coins 2 Plays" }, - {0x12, 0x01, 0x0f, 0x0a, "2 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x06, "3 Coins 2 Plays" }, - {0x12, 0x01, 0x0f, 0x03, "4 Coins 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 5 Plays" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, - - {0 , 0xfe, 0 , 12 , "Coin B" }, - {0x12, 0x01, 0xf0, 0x40, "4 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x70, "3 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x00, "5 Coins 2 Plays" }, - {0x12, 0x01, 0xf0, 0xa0, "2 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x60, "3 Coins 2 Plays" }, - {0x12, 0x01, 0xf0, 0x30, "4 Coins 3 Plays" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 5 Plays" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Plays" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Plays" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Plays" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x06, 0x06, "2" }, - {0x13, 0x01, 0x06, 0x04, "3" }, - {0x13, 0x01, 0x06, 0x02, "4" }, - {0x13, 0x01, 0x06, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x18, 0x18, "Normal" }, - {0x13, 0x01, 0x18, 0x08, "Medium" }, - {0x13, 0x01, 0x18, 0x10, "Hard" }, - {0x13, 0x01, 0x18, 0x00, "Invincibilty" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x20, 0x20, "Upright" }, - {0x13, 0x01, 0x20, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Buccanrsa) - -static struct BurnDIPInfo KikcubicDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xd5, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x03, 0x02, "Easy" }, - {0x11, 0x01, 0x03, 0x03, "Medium" }, - {0x11, 0x01, 0x03, 0x01, "Hard" }, - {0x11, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x0c, 0x08, "1" }, - {0x11, 0x01, 0x0c, 0x04, "2" }, - {0x11, 0x01, 0x0c, 0x0c, "3" }, - {0x11, 0x01, 0x0c, 0x00, "4" }, - - {0 , 0xfe, 0 , 12 , "Coinage" }, - {0x11, 0x01, 0xf0, 0xa0, "6 Coins 1 Play" }, - {0x11, 0x01, 0xf0, 0xb0, "5 Coins 1 Play" }, - {0x11, 0x01, 0xf0, 0xc0, "4 Coins 1 Play" }, - {0x11, 0x01, 0xf0, 0xd0, "3 Coins 1 Play" }, - {0x11, 0x01, 0xf0, 0xe0, "2 Coins 1 Play" }, - {0x11, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, - {0x11, 0x01, 0xf0, 0x70, "1 Coin 2 Plays" }, - {0x11, 0x01, 0xf0, 0x60, "1 Coin 3 Plays" }, - {0x11, 0x01, 0xf0, 0x50, "1 Coin 4 Plays" }, - {0x11, 0x01, 0xf0, 0x40, "1 Coin 5 Plays" }, - {0x11, 0x01, 0xf0, 0x30, "1 Coin 6 Plays" }, - {0x11, 0x01, 0xf0, 0x00, "Freeplay" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x02, 0x00, "Upright" }, - {0x12, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Coin Mode" }, - {0x12, 0x01, 0x04, 0x04, "Mode 1" }, - {0x12, 0x01, 0x04, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Level Select" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Player Adding" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Kikcubic) - -static struct BurnRomInfo DrvRomDesc[] = { - { "g07_c03.bin", 0x08000, 0x9dcca081, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "j07_c04.bin", 0x10000, 0xe0159105, BRF_ESS | BRF_PRG }, // 1 - - { "g05_c02.bin", 0x10000, 0x10582b2d, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "f05_c08.bin", 0x10000, 0x01579d20, BRF_GRA }, // 3 Characters - { "h05_c09.bin", 0x10000, 0x4f5872f0, BRF_GRA }, // 4 - - { "n07_c12.bin", 0x10000, 0x10af8eb2, BRF_GRA }, // 5 Sprites - { "k07_c10.bin", 0x10000, 0x9576f304, BRF_GRA }, // 6 - { "o07_c13.bin", 0x10000, 0xb1d9d4dc, BRF_GRA }, // 7 - { "l07_c11.bin", 0x10000, 0x4598be4a, BRF_GRA }, // 8 - { "t07_c16.bin", 0x10000, 0xf5425e42, BRF_GRA }, // 9 - { "p07_c14.bin", 0x10000, 0xcb50a17c, BRF_GRA }, // 10 - { "v07_c17.bin", 0x10000, 0x959ba3c7, BRF_GRA }, // 11 - { "s07_c15.bin", 0x10000, 0x7f2e91c5, BRF_GRA }, // 12 - - { "d01_c05.bin", 0x10000, 0x81b1ee5c, BRF_GRA }, // 13 Background - { "e01_c06.bin", 0x10000, 0xd0d33673, BRF_GRA }, // 14 - { "f01_c07.bin", 0x10000, 0xaae81695, BRF_GRA }, // 15 - - { "d04_c01.bin", 0x10000, 0x9b85101d, BRF_SND }, // 16 Samples - - { "vg_b-8r.ic90", 0x00117, 0xdf368a7a, BRF_GRA }, // 17 PALs - { "vg_b-4m.ic38", 0x00117, 0xdbca4204, BRF_GRA }, // 18 - { "vg_b-1b.ic1", 0x00117, 0x922e5167, BRF_GRA }, // 19 -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo Drv1RomDesc[] = { - { "vg_a-8h-c.rom", 0x08000, 0xd72682e8, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "vg_a-8l-a.rom", 0x10000, 0x690d812f, BRF_ESS | BRF_PRG }, // 1 - - { "g05_c02.bin", 0x10000, 0x10582b2d, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "f05_c08.bin", 0x10000, 0x01579d20, BRF_GRA }, // 3 Characters - { "h05_c09.bin", 0x10000, 0x4f5872f0, BRF_GRA }, // 4 - - { "n07_c12.bin", 0x10000, 0x10af8eb2, BRF_GRA }, // 5 Sprites - { "k07_c10.bin", 0x10000, 0x9576f304, BRF_GRA }, // 6 - { "o07_c13.bin", 0x10000, 0xb1d9d4dc, BRF_GRA }, // 7 - { "l07_c11.bin", 0x10000, 0x4598be4a, BRF_GRA }, // 8 - { "t07_c16.bin", 0x10000, 0xf5425e42, BRF_GRA }, // 9 - { "p07_c14.bin", 0x10000, 0xcb50a17c, BRF_GRA }, // 10 - { "v07_c17.bin", 0x10000, 0x959ba3c7, BRF_GRA }, // 11 - { "s07_c15.bin", 0x10000, 0x7f2e91c5, BRF_GRA }, // 12 - - { "d01_c05.bin", 0x10000, 0x81b1ee5c, BRF_GRA }, // 13 Background - { "e01_c06.bin", 0x10000, 0xd0d33673, BRF_GRA }, // 14 - { "f01_c07.bin", 0x10000, 0xaae81695, BRF_GRA }, // 15 - - { "d04_c01.bin", 0x10000, 0x9b85101d, BRF_SND }, // 16 Samples - - { "vg_b-8r.ic90", 0x00117, 0xdf368a7a, BRF_GRA }, // 17 PALs - { "vg_b-4m.ic38", 0x00117, 0xdbca4204, BRF_GRA }, // 18 - { "vg_b-1b.ic1", 0x00117, 0x922e5167, BRF_GRA }, // 19 -}; - -STD_ROM_PICK(Drv1) -STD_ROM_FN(Drv1) - -static struct BurnRomInfo DrvuRomDesc[] = { - { "a-8h", 0x08000, 0x8d15109e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a-8l", 0x10000, 0x7f95799b, BRF_ESS | BRF_PRG }, // 1 - - { "g05_c02.bin", 0x10000, 0x10582b2d, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "f05_c08.bin", 0x10000, 0x01579d20, BRF_GRA }, // 3 Characters - { "h05_c09.bin", 0x10000, 0x4f5872f0, BRF_GRA }, // 4 - - { "n07_c12.bin", 0x10000, 0x10af8eb2, BRF_GRA }, // 5 Sprites - { "k07_c10.bin", 0x10000, 0x9576f304, BRF_GRA }, // 6 - { "o07_c13.bin", 0x10000, 0xb1d9d4dc, BRF_GRA }, // 7 - { "l07_c11.bin", 0x10000, 0x4598be4a, BRF_GRA }, // 8 - { "t07_c16.bin", 0x10000, 0xf5425e42, BRF_GRA }, // 9 - { "p07_c14.bin", 0x10000, 0xcb50a17c, BRF_GRA }, // 10 - { "v07_c17.bin", 0x10000, 0x959ba3c7, BRF_GRA }, // 11 - { "s07_c15.bin", 0x10000, 0x7f2e91c5, BRF_GRA }, // 12 - - { "d01_c05.bin", 0x10000, 0x81b1ee5c, BRF_GRA }, // 13 Background - { "e01_c06.bin", 0x10000, 0xd0d33673, BRF_GRA }, // 14 - { "f01_c07.bin", 0x10000, 0xaae81695, BRF_GRA }, // 15 - - { "d04_c01.bin", 0x10000, 0x9b85101d, BRF_SND }, // 16 Samples - - { "vg_b-8r.ic90", 0x00117, 0xdf368a7a, BRF_GRA }, // 17 PALs - { "vg_b-4m.ic38", 0x00117, 0xdbca4204, BRF_GRA }, // 18 - { "vg_b-1b.ic1", 0x00117, 0x922e5167, BRF_GRA }, // 19 -}; - -STD_ROM_PICK(Drvu) -STD_ROM_FN(Drvu) - -static struct BurnRomInfo Drvu2RomDesc[] = { - { "vg-a-8h-g.bin", 0x08000, 0x9444c04e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a-8l", 0x10000, 0x7f95799b, BRF_ESS | BRF_PRG }, // 1 - - { "g05_c02.bin", 0x10000, 0x10582b2d, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "f05_c08.bin", 0x10000, 0x01579d20, BRF_GRA }, // 3 Characters - { "h05_c09.bin", 0x10000, 0x4f5872f0, BRF_GRA }, // 4 - - { "n07_c12.bin", 0x10000, 0x10af8eb2, BRF_GRA }, // 5 Sprites - { "k07_c10.bin", 0x10000, 0x9576f304, BRF_GRA }, // 6 - { "o07_c13.bin", 0x10000, 0xb1d9d4dc, BRF_GRA }, // 7 - { "l07_c11.bin", 0x10000, 0x4598be4a, BRF_GRA }, // 8 - { "t07_c16.bin", 0x10000, 0xf5425e42, BRF_GRA }, // 9 - { "p07_c14.bin", 0x10000, 0xcb50a17c, BRF_GRA }, // 10 - { "v07_c17.bin", 0x10000, 0x959ba3c7, BRF_GRA }, // 11 - { "s07_c15.bin", 0x10000, 0x7f2e91c5, BRF_GRA }, // 12 - - { "d01_c05.bin", 0x10000, 0x81b1ee5c, BRF_GRA }, // 13 Background - { "e01_c06.bin", 0x10000, 0xd0d33673, BRF_GRA }, // 14 - { "f01_c07.bin", 0x10000, 0xaae81695, BRF_GRA }, // 15 - - { "d04_c01.bin", 0x10000, 0x9b85101d, BRF_SND }, // 16 Samples - - { "vg_b-8r.ic90", 0x00117, 0xdf368a7a, BRF_GRA }, // 17 PALs - { "vg_b-4m.ic38", 0x00117, 0xdbca4204, BRF_GRA }, // 18 - { "vg_b-1b.ic1", 0x00117, 0x922e5167, BRF_GRA }, // 19 -}; - -STD_ROM_PICK(Drvu2) -STD_ROM_FN(Drvu2) - -static struct BurnRomInfo DrvjRomDesc[] = { - { "vg_a-8h.rom", 0x08000, 0xba848713, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "vg_a-8l.rom", 0x10000, 0x3b12b1d8, BRF_ESS | BRF_PRG }, // 1 - - { "g05_c02.bin", 0x10000, 0x10582b2d, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "f05_c08.bin", 0x10000, 0x01579d20, BRF_GRA }, // 3 Characters - { "h05_c09.bin", 0x10000, 0x4f5872f0, BRF_GRA }, // 4 - - { "n07_c12.bin", 0x10000, 0x10af8eb2, BRF_GRA }, // 5 Sprites - { "k07_c10.bin", 0x10000, 0x9576f304, BRF_GRA }, // 6 - { "o07_c13.bin", 0x10000, 0xb1d9d4dc, BRF_GRA }, // 7 - { "l07_c11.bin", 0x10000, 0x4598be4a, BRF_GRA }, // 8 - { "t07_c16.bin", 0x10000, 0xf5425e42, BRF_GRA }, // 9 - { "p07_c14.bin", 0x10000, 0xcb50a17c, BRF_GRA }, // 10 - { "v07_c17.bin", 0x10000, 0x959ba3c7, BRF_GRA }, // 11 - { "s07_c15.bin", 0x10000, 0x7f2e91c5, BRF_GRA }, // 12 - - { "d01_c05.bin", 0x10000, 0x81b1ee5c, BRF_GRA }, // 13 Background - { "e01_c06.bin", 0x10000, 0xd0d33673, BRF_GRA }, // 14 - { "f01_c07.bin", 0x10000, 0xaae81695, BRF_GRA }, // 15 - - { "d04_c01.bin", 0x10000, 0x9b85101d, BRF_SND }, // 16 Samples - - { "vg_b-8r.ic90", 0x00117, 0xdf368a7a, BRF_GRA }, // 17 PALs - { "vg_b-4m.ic38", 0x00117, 0xdbca4204, BRF_GRA }, // 18 - { "vg_b-1b.ic1", 0x00117, 0x922e5167, BRF_GRA }, // 19 -}; - -STD_ROM_PICK(Drvj) -STD_ROM_FN(Drvj) - -static struct BurnRomInfo BuccanrsRomDesc[] = { - { "11.u58", 0x10000, 0xbf1d7e6f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "12.u25", 0x10000, 0x87303ba8, BRF_ESS | BRF_PRG }, // 1 - - { "1.u128", 0x10000, 0xeb65f8c3, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "7.u212", 0x10000, 0x95e3c517, BRF_GRA }, // 3 Characters - { "8.u189", 0x10000, 0xfe2377ab, BRF_GRA }, // 4 - - { "3.u100", 0x20000, 0x16dc435f, BRF_GRA }, // 5 Sprites - { "4.u80", 0x10000, 0x4fe3bf97, BRF_GRA }, // 6 - { "6.u52", 0x20000, 0x078aef7f, BRF_GRA }, // 7 - { "5.u70", 0x10000, 0xf650fa90, BRF_GRA }, // 8 - - { "9.u49", 0x20000, 0x0c6188fb, BRF_GRA }, // 9 Background - { "10.u27", 0x20000, 0x2d383ff8, BRF_GRA }, // 10 - - { "2.u74", 0x10000, 0x36ee1dac, BRF_SND }, // 11 Samples - - { "prom1.u54", 0x00100, 0xc324835e, BRF_GRA }, // 12 PROMs - { "prom4.u79", 0x00100, 0xe6506ef4, BRF_GRA }, // 13 - { "prom3.u88", 0x00100, 0xb43d094f, BRF_GRA }, // 14 - { "prom2.u99", 0x00100, 0xe0aa8869, BRF_GRA }, // 15 - - { "pal16l8.u103", 0x00104, 0x00000000, BRF_GRA | BRF_NODUMP }, // 16 PALs - { "pal16l8.u156", 0x00104, 0x00000000, BRF_GRA | BRF_NODUMP }, // 17 - { "pal16l8.u42", 0x00104, 0x00000000, BRF_GRA | BRF_NODUMP }, // 18 -}; - -STD_ROM_PICK(Buccanrs) -STD_ROM_FN(Buccanrs) - -static struct BurnRomInfo BuccanrsaRomDesc[] = { - { "bc-011", 0x08000, 0x6b657ef1, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "12.u25", 0x10000, 0x87303ba8, BRF_ESS | BRF_PRG }, // 1 - - { "1.u128", 0x10000, 0xeb65f8c3, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "7.u212", 0x10000, 0x95e3c517, BRF_GRA }, // 3 Characters - { "8.u189", 0x10000, 0xfe2377ab, BRF_GRA }, // 4 - - { "3.u100", 0x20000, 0x16dc435f, BRF_GRA }, // 5 Sprites - { "4.u80", 0x10000, 0x4fe3bf97, BRF_GRA }, // 6 - { "6.u52", 0x20000, 0x078aef7f, BRF_GRA }, // 7 - { "5.u70", 0x10000, 0xf650fa90, BRF_GRA }, // 8 - - { "9.u49", 0x20000, 0x0c6188fb, BRF_GRA }, // 9 Background - { "10.u27", 0x20000, 0x2d383ff8, BRF_GRA }, // 10 - - { "2.u74", 0x10000, 0x36ee1dac, BRF_SND }, // 11 Samples - - { "prom1.u54", 0x00100, 0xc324835e, BRF_GRA }, // 12 PROMs - { "prom4.u79", 0x00100, 0xe6506ef4, BRF_GRA }, // 13 - { "prom3.u88", 0x00100, 0xb43d094f, BRF_GRA }, // 14 - { "prom2.u99", 0x00100, 0xe0aa8869, BRF_GRA }, // 15 -}; - -STD_ROM_PICK(Buccanrsa) -STD_ROM_FN(Buccanrsa) - -static struct BurnRomInfo KikcubicRomDesc[] = { - { "mqj-p0", 0x08000, 0x9cef394a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "mqj-b0", 0x10000, 0xd9bcf4cd, BRF_ESS | BRF_PRG }, // 1 - { "mqj-b1", 0x10000, 0x54a0abe1, BRF_ESS | BRF_PRG }, // 2 - - { "mqj-sp", 0x10000, 0xbbcf3582, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "mqj-c0", 0x10000, 0x975585c5, BRF_GRA }, // 4 Characters - { "mqj-c1", 0x10000, 0x49d9936d, BRF_GRA }, // 5 - - { "mqj-00", 0x40000, 0x7fb0c58f, BRF_GRA }, // 6 Sprites - { "mqj-10", 0x40000, 0x3a189205, BRF_GRA }, // 7 - - { "mqj-v0", 0x10000, 0x54762956, BRF_SND }, // 8 Samples - - { "8d", 0x00100, 0x7379bb12, BRF_GRA }, // 9 PROMs - { "6h", 0x00020, 0xface0cbb, BRF_GRA }, // 10 - { "7s", 0x00020, 0xface0cbb, BRF_GRA }, // 11 -}; - -STD_ROM_PICK(Kikcubic) -STD_ROM_FN(Kikcubic) - -static struct BurnRomInfo KikcubicbRomDesc[] = { - { "1.bin", 0x08000, 0xd3a589ba, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "4.bin", 0x10000, 0x9ae1e1a6, BRF_ESS | BRF_PRG }, // 1 - { "5.bin", 0x08000, 0xa5a6bffd, BRF_ESS | BRF_PRG }, // 2 - - { "mqj-sp", 0x10000, 0xbbcf3582, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "7.bin", 0x10000, 0x1788d51a, BRF_GRA }, // 4 Characters - { "mqj-c1", 0x10000, 0x49d9936d, BRF_GRA }, // 5 - - { "11.bin", 0x10000, 0x0f0cac92, BRF_GRA }, // 6 Sprites - { "10.bin", 0x10000, 0x7d3822a8, BRF_GRA }, // 7 - { "9.bin", 0x10000, 0x56fb4fa3, BRF_GRA }, // 8 - { "8.bin", 0x10000, 0x947dbd4e, BRF_GRA }, // 9 - - { "mqj-v0", 0x10000, 0x54762956, BRF_SND }, // 10 Samples - - { "8d", 0x00100, 0x7379bb12, BRF_GRA }, // 11 PROMs - { "6h", 0x00020, 0xface0cbb, BRF_GRA }, // 12 - { "7s", 0x00020, 0xface0cbb, BRF_GRA }, // 13 -}; - -STD_ROM_PICK(Kikcubicb) -STD_ROM_FN(Kikcubicb) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom1 = Next; Next += 0x28000; - DrvZ80Rom2 = Next; Next += 0x10000; - DrvSamples = Next; Next += 0x10000; - - RamStart = Next; - - DrvZ80Ram1 = Next; Next += 0x02000; - DrvZ80Ram2 = Next; Next += 0x01000; - DrvSpriteRam = Next; Next += 0x00100; - DrvPaletteRam = Next; Next += 0x00800; - DrvVideoRam = Next; Next += 0x01000; - DrvPalette = (UINT32*)Next; Next += (512 + 32) * sizeof(UINT32); - - RamEnd = Next; - - DrvChars = Next; Next += 0x1000 * 8 * 8; - DrvSprites = Next; Next += 0x1000 * 16 * 16; - DrvBackTiles = Next; Next += 0x4000 * 32; - - MemEnd = Next; - - return 0; -} - -static void DrvSetVector(INT32 Status) -{ - switch (Status) { - case VECTOR_INIT: { - DrvIrqVector = 0xff; - break; - } - - case YM2151_ASSERT: { - DrvIrqVector &= 0xef; - break; - } - - case YM2151_CLEAR: { - DrvIrqVector |= 0x10; - break; - } - - case Z80_ASSERT: { - DrvIrqVector &= 0xdf; - break; - } - - case Z80_CLEAR: { - DrvIrqVector |= 0x20; - break; - } - } - - if (DrvIrqVector == 0xff) { -// ZetSetVector(DrvIrqVector); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } else { - ZetSetVector(DrvIrqVector); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nCyclesDone[1] += ZetRun(1000); - } -} - -static INT32 DrvDoReset() -{ - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - if (i == 1) DrvSetVector(VECTOR_INIT); - ZetClose(); - } - - if (DrvHasYM2203) { - BurnYM2203Reset(); - } else { - BurnYM2151Reset(); - } - - DACReset(); - - DrvRomBank = 0; - DrvSoundLatch = 0; - DrvRearColour = 0; - DrvRearDisable = 0; - DrvHorizScrollLo = 0; - DrvHorizScrollHi = 0; - DrvRearHorizScrollLo = 0; - DrvRearHorizScrollHi = 0; - DrvSampleAddress = 0; - - return 0; -} - -UINT8 __fastcall VigilanteZ80Read1(UINT16 a) -{ - switch (a) { - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall VigilanteZ80Write1(UINT16 a, UINT8 d) -{ - if (a >= 0xc020 && a <= 0xc0df) { - DrvSpriteRam[a - 0xc020] = d; - return; - } - - if (a >= 0xc800 && a <= 0xcfff) { - INT32 Offset = a & 0x7ff; - INT32 Bank = Offset & 0x400; - INT32 r, g, b; - - DrvPaletteRam[Offset] = d; - - Offset &= 0xff; - r = (DrvPaletteRam[Bank + Offset + 0x000] << 3) & 0xff; - g = (DrvPaletteRam[Bank + Offset + 0x100] << 3) & 0xff; - b = (DrvPaletteRam[Bank + Offset + 0x200] << 3) & 0xff; - - DrvPalette[(Bank >> 2) + Offset] = BurnHighCol(r, g, b, 0); - return; - } - - switch (a) { - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall VigilanteZ80PortRead1(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return 0xff - DrvInput[0]; - } - - case 0x01: { - return 0xff - DrvInput[1]; - } - - case 0x02: { - return 0xff - DrvInput[2]; - } - - case 0x03: { - return DrvDip[0]; - } - - case 0x04: { - return DrvDip[1]; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall BuccanrsZ80PortRead1(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return (0xd0 - DrvInput[0]) | DrvDip[0]; - } - - case 0x01: { - return 0xff - DrvInput[1]; - } - - case 0x02: { - return 0xff - DrvInput[2]; - } - - case 0x03: { - return DrvDip[1]; - } - - case 0x04: { - return DrvDip[2]; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall BuccanrsaZ80PortRead1(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return (0x0b - DrvInput[0]) | DrvDip[0]; - } - - case 0x01: { - return 0xff - DrvInput[1]; - } - - case 0x02: { - return 0xff - DrvInput[2]; - } - - case 0x03: { - return DrvDip[1]; - } - - case 0x04: { - return DrvDip[2]; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall VigilanteZ80PortWrite1(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - DrvSoundLatch = d; - ZetClose(); - ZetOpen(1); - DrvSetVector(Z80_ASSERT); - ZetClose(); - ZetOpen(0); - return; - } - - case 0x01: { - // output port? - return; - } - - case 0x04: { - DrvRomBank = d & 0x07; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - return; - } - - case 0x80: { - DrvHorizScrollLo = d; - return; - } - - case 0x81: { - DrvHorizScrollHi = (d & 0x01) << 8; - return; - } - - case 0x82: { - DrvRearHorizScrollLo = d; - return; - } - - case 0x83: { - DrvRearHorizScrollHi = (d & 0x07) << 8; - return; - } - - case 0x84: { - DrvRearColour = d & 0x0d; - DrvRearDisable = d & 0x40; - return; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall KikcubicZ80Read1(UINT16 a) -{ - switch (a) { - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall KikcubicZ80Write1(UINT16 a, UINT8 d) -{ - if (a >= 0xc800 && a <= 0xcaff) { - INT32 Offset = a & 0x3ff; - INT32 Bank = Offset & 0x400; - INT32 r, g, b; - - DrvPaletteRam[Offset] = d; - - Offset &= 0xff; - r = (DrvPaletteRam[Bank + Offset + 0x000] << 3) & 0xff; - g = (DrvPaletteRam[Bank + Offset + 0x100] << 3) & 0xff; - b = (DrvPaletteRam[Bank + Offset + 0x200] << 3) & 0xff; - - DrvPalette[(Bank >> 2) + Offset] = BurnHighCol(r, g, b, 0); - return; - } - - switch (a) { - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall KikcubicZ80PortRead1(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return DrvDip[0]; - } - - case 0x01: { - return DrvDip[1]; - } - - case 0x02: { - return 0xff - DrvInput[1]; - } - - case 0x03: { - return 0xff - DrvInput[0]; - } - - case 0x04: { - return 0xff - DrvInput[2]; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall KikcubicZ80PortWrite1(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - // coin write - return; - } - - case 0x04: { - DrvRomBank = d & 0x07; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - return; - } - - case 0x06: { - if (d == 0x20) return; // ??? - DrvSoundLatch = d; - ZetClose(); - ZetOpen(1); - DrvSetVector(Z80_ASSERT); - ZetClose(); - ZetOpen(0); - return; - } - - case 0x07: { - // nop??? - return; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall VigilanteZ80Read2(UINT16 a) -{ - switch (a) { - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall VigilanteZ80Write2(UINT16 a, UINT8 /*d*/) -{ - switch (a) { - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall VigilanteZ80PortRead2(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x01: { - return BurnYM2151ReadStatus(); - } - - case 0x80: { - return DrvSoundLatch; - } - - case 0x84: { - return DrvSamples[DrvSampleAddress]; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall VigilanteZ80PortWrite2(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x01: { - BurnYM2151WriteRegister(d); - return; - } - - case 0x80: { - DrvSampleAddress = (DrvSampleAddress & 0xff00) | ((d << 0) & 0x00ff); - return; - } - - case 0x81: { - DrvSampleAddress = (DrvSampleAddress & 0x00ff) | ((d << 8) & 0xff00); - return; - } - - case 0x82: { - DACSignedWrite(0, d); - DrvSampleAddress = (DrvSampleAddress + 1) & 0xffff; - return; - } - - case 0x83: { - DrvSetVector(Z80_CLEAR); - return; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall BuccanrsZ80PortRead2(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return YM2203Read(0, 0); - } - - case 0x02: { - return YM2203Read(1, 0); - } - - case 0x80: { - return DrvSoundLatch; - } - - case 0x84: { - return DrvSamples[DrvSampleAddress]; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall BuccanrsZ80PortWrite2(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0x01: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0x02: { - BurnYM2203Write(1, 0, d); - return; - } - - case 0x03: { - BurnYM2203Write(1, 1, d); - return; - } - - case 0x80: { - DrvSampleAddress = (DrvSampleAddress & 0xff00) | ((d << 0) & 0x00ff); - return; - } - - case 0x81: { - DrvSampleAddress = (DrvSampleAddress & 0x00ff) | ((d << 8) & 0xff00); - return; - } - - case 0x82: { - DACSignedWrite(0, d); - DrvSampleAddress = (DrvSampleAddress + 1) & 0xffff; - return; - } - - case 0x83: { - DrvSetVector(Z80_CLEAR); - return; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); - } - } -} - -static void VigilantYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - DrvSetVector(YM2151_ASSERT); - } else { - DrvSetVector(YM2151_CLEAR); - } -} - -inline static void BuccanrsYM2203IRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - DrvSetVector(YM2151_ASSERT); - } else { - DrvSetVector(YM2151_CLEAR); - } -} - -inline static INT32 BuccanrsSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / (18432000 / 6); -} - -inline static double BuccanrsGetTime() -{ - return (double)ZetTotalCycles() / (18432000 / 6); -} - -static INT32 VigilantSyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / ((nCyclesTotal[1] * 55.0000) / (nBurnFPS / 100.0000)))); -} - -static INT32 CharPlaneOffsets[4] = { 0x80000, 0x80004, 0, 4 }; -static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 64, 65, 66, 67 }; -static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 SpritePlaneOffsets[4] = { 0x200000, 0x200004, 0, 4 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 128, 129, 130, 131, 256, 257, 258, 259, 384, 385, 386, 387 }; -static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; -static INT32 BackTilePlaneOffsets[4] = { 0, 2, 4, 6 }; -static INT32 BackTileXOffsets[32] = { 1, 0, 9, 8, 17, 16, 25, 24, 33, 32, 41, 40, 49, 48, 57, 56, 65, 64, 73, 72, 81, 80, 89, 88, 97, 96, 105, 104, 113, 112, 121, 120 }; -static INT32 BackTileYOffsets[1] = { 0 }; -static INT32 BuccSpriteXOffsets[16] = { 3, 2, 1, 0, 131, 130, 129, 128, 259, 258, 257, 256, 387, 386, 385, 384 }; -static INT32 BuccBackTilePlaneOffsets[4] = { 6, 4, 2, 0 }; - -static INT32 DrvInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 4, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x70000, 12, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the bg tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 15, 1); if (nRet != 0) return 1; - GfxDecode(0x4000, 4, 32, 1, BackTilePlaneOffsets, BackTileXOffsets, BackTileYOffsets, 0x80, DrvTempRom, DrvBackTiles); - - BurnFree(DrvTempRom); - - // Load sample Roms - nRet = BurnLoadRom(DrvSamples + 0x00000, 16, 1); if (nRet != 0) return 1; - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(VigilanteZ80Read1); - ZetSetWriteHandler(VigilanteZ80Write1); - ZetSetInHandler(VigilanteZ80PortRead1); - ZetSetOutHandler(VigilanteZ80PortWrite1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0xc800, 0xcfff, 0, DrvPaletteRam ); - ZetMapArea(0xc800, 0xcfff, 2, DrvPaletteRam ); - ZetMapArea(0xd000, 0xdfff, 0, DrvVideoRam ); - ZetMapArea(0xd000, 0xdfff, 1, DrvVideoRam ); - ZetMapArea(0xd000, 0xdfff, 2, DrvVideoRam ); - ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(VigilanteZ80Read2); - ZetSetWriteHandler(VigilanteZ80Write2); - ZetSetInHandler(VigilanteZ80PortRead2); - ZetSetOutHandler(VigilanteZ80PortWrite2); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom2 ); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom2 ); - ZetMapArea(0xf000, 0xffff, 0, DrvZ80Ram2 ); - ZetMapArea(0xf000, 0xffff, 1, DrvZ80Ram2 ); - ZetMapArea(0xf000, 0xffff, 2, DrvZ80Ram2 ); - ZetMemEnd(); - ZetClose(); - - BurnSetRefreshRate(55.0); - nCyclesTotal[0] = 3579645 / 55; - nCyclesTotal[1] = 3579645 / 55; - - GenericTilesInit(); - BurnYM2151Init(3579645); - BurnYM2151SetIrqHandler(&VigilantYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.55, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.55, BURN_SND_ROUTE_RIGHT); - DACInit(0, 0, 1, VigilantSyncDAC); - DACSetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static INT32 BuccanrsInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 4, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - memcpy(DrvTempRom + 0x20000, DrvTempRom + 0x10000, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x10000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 7, 1); if (nRet != 0) return 1; - memcpy(DrvTempRom + 0x60000, DrvTempRom + 0x50000, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x50000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, BuccSpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the bg tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x4000, 4, 32, 1, BuccBackTilePlaneOffsets, BackTileXOffsets, BackTileYOffsets, 0x80, DrvTempRom, DrvBackTiles); - - BurnFree(DrvTempRom); - - // Load sample Roms - nRet = BurnLoadRom(DrvSamples + 0x00000, 11, 1); if (nRet != 0) return 1; - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(VigilanteZ80Read1); - ZetSetWriteHandler(VigilanteZ80Write1); - ZetSetInHandler(BuccanrsZ80PortRead1); - ZetSetOutHandler(VigilanteZ80PortWrite1); - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "buccanrsa")) ZetSetInHandler(BuccanrsaZ80PortRead1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0xc800, 0xcfff, 0, DrvPaletteRam ); - ZetMapArea(0xc800, 0xcfff, 2, DrvPaletteRam ); - ZetMapArea(0xd000, 0xdfff, 0, DrvVideoRam ); - ZetMapArea(0xd000, 0xdfff, 1, DrvVideoRam ); - ZetMapArea(0xd000, 0xdfff, 2, DrvVideoRam ); - ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(VigilanteZ80Read2); - ZetSetWriteHandler(VigilanteZ80Write2); - ZetSetInHandler(BuccanrsZ80PortRead2); - ZetSetOutHandler(BuccanrsZ80PortWrite2); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom2 ); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom2 ); - ZetMapArea(0xf000, 0xffff, 0, DrvZ80Ram2 ); - ZetMapArea(0xf000, 0xffff, 1, DrvZ80Ram2 ); - ZetMapArea(0xf000, 0xffff, 2, DrvZ80Ram2 ); - ZetMemEnd(); - ZetClose(); - - BurnSetRefreshRate(55.0); - nCyclesTotal[0] = 5688800 / 55; - nCyclesTotal[1] = (18432000 / 6) / 55; - - GenericTilesInit(); - - DrvHasYM2203 = 1; - BurnYM2203Init(2, 18432000 / 6, &BuccanrsYM2203IRQHandler, BuccanrsSynchroniseStream, BuccanrsGetTime, 0); - BurnTimerAttachZet(18432000 / 6); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.35, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.35, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.35, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.35, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.35, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.35, BURN_SND_ROUTE_BOTH); - - DACInit(0, 0, 1, VigilantSyncDAC); - DACSetRoute(0, 0.35, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static INT32 KikcubicInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "kikcubicb")) { - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x28000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom + 0x00000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x70000, 9, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load sample Roms - nRet = BurnLoadRom(DrvSamples + 0x00000, 10, 1); if (nRet != 0) return 1; - } else { - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom + 0x00000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load sample Roms - nRet = BurnLoadRom(DrvSamples + 0x00000, 8, 1); if (nRet != 0) return 1; - } - - BurnFree(DrvTempRom); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(KikcubicZ80Read1); - ZetSetWriteHandler(KikcubicZ80Write1); - ZetSetInHandler(KikcubicZ80PortRead1); - ZetSetOutHandler(KikcubicZ80PortWrite1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0xc000, 0xc0ff, 0, DrvSpriteRam ); - ZetMapArea(0xc000, 0xc0ff, 1, DrvSpriteRam ); - ZetMapArea(0xc000, 0xc0ff, 2, DrvSpriteRam ); - ZetMapArea(0xc800, 0xcaff, 0, DrvPaletteRam ); - ZetMapArea(0xc800, 0xcaff, 2, DrvPaletteRam ); - ZetMapArea(0xd000, 0xdfff, 0, DrvVideoRam ); - ZetMapArea(0xd000, 0xdfff, 1, DrvVideoRam ); - ZetMapArea(0xd000, 0xdfff, 2, DrvVideoRam ); - ZetMapArea(0xe000, 0xffff, 0, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xffff, 1, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xffff, 2, DrvZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(VigilanteZ80Read2); - ZetSetWriteHandler(VigilanteZ80Write2); - ZetSetInHandler(VigilanteZ80PortRead2); - ZetSetOutHandler(VigilanteZ80PortWrite2); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom2 ); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom2 ); - ZetMapArea(0xf000, 0xffff, 0, DrvZ80Ram2 ); - ZetMapArea(0xf000, 0xffff, 1, DrvZ80Ram2 ); - ZetMapArea(0xf000, 0xffff, 2, DrvZ80Ram2 ); - ZetMemEnd(); - ZetClose(); - - BurnSetRefreshRate(55.0); - nCyclesTotal[0] = 3579645 / 55; - nCyclesTotal[1] = 3579645 / 55; - - GenericTilesInit(); - BurnYM2151Init(3579645); - BurnYM2151SetIrqHandler(&VigilantYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.55, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.55, BURN_SND_ROUTE_RIGHT); - DACInit(0, 0, 1, VigilantSyncDAC); - DACSetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - DrvKikcubicDraw = 1; - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - if (DrvHasYM2203) { - BurnYM2203Exit(); - } else { - BurnYM2151Exit(); - } - DACExit(); - - GenericTilesExit(); - - BurnFree(Mem); - - DrvRomBank = 0; - DrvSoundLatch = 0; - DrvIrqVector = 0; - DrvRearColour = 0; - DrvRearDisable = 0; - DrvHorizScrollLo = 0; - DrvHorizScrollHi = 0; - DrvRearHorizScrollLo = 0; - DrvRearHorizScrollHi = 0; - DrvSampleAddress = 0; - - DrvHasYM2203 = 0; - DrvKikcubicDraw = 0; - - return 0; -} - -static void DrvRenderBackground() -{ - INT32 CharCode = 0; - INT32 Scroll = 0x17a - (DrvRearHorizScrollLo + DrvRearHorizScrollHi); - if (Scroll > 0) Scroll -= 2048; - - for (INT32 i = 0; i < 16; i++) { - INT32 r, g, b; - - r = (DrvPaletteRam[0x400 + 16 * DrvRearColour + i] << 3) & 0xff; - g = (DrvPaletteRam[0x500 + 16 * DrvRearColour + i] << 3) & 0xff; - b = (DrvPaletteRam[0x600 + 16 * DrvRearColour + i] << 3) & 0xff; - - DrvPalette[512 + i] = BurnHighCol(r, g, b, 0); - - r = (DrvPaletteRam[0x400 + 16 * DrvRearColour + 32 + i] << 3) & 0xff; - g = (DrvPaletteRam[0x500 + 16 * DrvRearColour + 32 + i] << 3) & 0xff; - b = (DrvPaletteRam[0x600 + 16 * DrvRearColour + 32 + i] << 3) & 0xff; - - DrvPalette[512 + 16 + i] = BurnHighCol(r, g, b, 0); - } - - for (INT32 Page = 0; Page < 4; Page++) { - for (INT32 Row = 0; Row < 256; Row++) { - for (INT32 Col = 0; Col < 512; Col += 32) { - INT32 Colour = (Row < 128) ? 0 : 1; - UINT32 nPalette = 512 | (Colour << 4); - - for (INT32 px = 0; px < 32; px++) { - UINT8 c = DrvBackTiles[(CharCode * 32) + px]; - INT32 xPos = (512 * Page) + Col + px + Scroll; - - if (Row >= 0 && Row < nScreenHeight) { - UINT16* pPixel = pTransDraw + (Row * nScreenWidth); - - if (xPos >= 0 && xPos < nScreenWidth) { - pPixel[xPos] = c | nPalette; - } - } - } - - CharCode++; - } - } - } -} - -static void DrvDrawForeground(INT32 Priority, INT32 Opaque) -{ - INT32 Scroll = -(DrvHorizScrollLo + DrvHorizScrollHi); - - for (INT32 Offset = 0; Offset < 0x1000; Offset += 2) { - INT32 sy = 8 * ((Offset / 2) / 64); - INT32 sx = 8 * ((Offset / 2) % 64); - INT32 Attr = DrvVideoRam[Offset + 1]; - INT32 Colour = Attr & 0x0f; - INT32 Tile = DrvVideoRam[Offset + 0] | ((Attr & 0xf0) << 4); - - if (Priority) { - // Sprite masking - if ((Colour & 0x0c) == 0x0c) { - if (sy >= 48) { - sx = (sx + Scroll) & 0x1ff; - - sx -= 128; - - INT32 px, py; - UINT32 nPalette = 256 | (Colour << 4); - - for (py = 0; py < 8; py++) { - for (px = 0; px < 8; px++) { - UINT8 c = DrvChars[(Tile * 64) + (py * 8) + px]; - - if (((0xff >> c) & 0x01) == 0) { - INT32 xPos = sx + px; - INT32 yPos = sy + py; - - if (yPos >= 0 && yPos < nScreenHeight) { - UINT16* pPixel = pTransDraw + (yPos * nScreenWidth); - - if (xPos >= 0 && xPos < nScreenWidth) { - pPixel[xPos] = c | nPalette; - } - } - } - } - } - } - } - } else { - if (sy >= 48) sx = (sx + Scroll) & 0x1ff; - - sx -= 128; - - if (sx >= 0 && sx < (nScreenWidth - 8) && sy >= 0 && sy < (nScreenHeight - 8)) { - if (Opaque || Colour >= 4) { - Render8x8Tile(pTransDraw, Tile, sx, sy, Colour, 4, 256, DrvChars); - } else { - Render8x8Tile_Mask(pTransDraw, Tile, sx, sy, Colour, 4, 0, 256, DrvChars); - } - } else { - if (Opaque || Colour >= 4) { - Render8x8Tile_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 256, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 0, 256, DrvChars); - } - } - } - } -} - -static void DrvDrawSprites() -{ - INT32 DrvSpriteRamSize = 0xc0; - if (DrvKikcubicDraw) DrvSpriteRamSize = 0x100; - - for (INT32 Offset = 0; Offset < DrvSpriteRamSize; Offset += 8) { - INT32 Code, Colour, sx, sy, xFlip, yFlip, h; - - Code = DrvSpriteRam[Offset + 4] | ((DrvSpriteRam[Offset + 5] & 0x0f) << 8); - Colour = DrvSpriteRam[Offset + 0] & 0x0f; - sx = (DrvSpriteRam[Offset + 6] | ((DrvSpriteRam[Offset + 7] & 0x01) << 8)); - sy = 256 + 128 - (DrvSpriteRam[Offset + 2] | ((DrvSpriteRam[Offset + 3] & 0x01) << 8)); - xFlip = DrvSpriteRam[Offset + 5] & 0x40; - yFlip = DrvSpriteRam[Offset + 5] & 0x80; - h = 1 << ((DrvSpriteRam[Offset + 5] & 0x30) >> 4); - sy -= 16 * h; - - Code &= ~(h - 1); - - if (DrvKikcubicDraw) { - sx -= 64; - } else { - sx -= 128; - } - - for (INT32 y = 0; y < h; y++) { - INT32 c = Code; - - if (yFlip) { - c += h - 1 - y; - } else { - c += y; - } - - if (sx > 16 && sx < (nScreenWidth - 16) && (sy + (16 * y)) > 16 && (sy + (16 * y)) < (nScreenHeight - 16)) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); - } - } - } - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - - if (DrvRearDisable) { - DrvDrawForeground(0, 1); - DrvDrawSprites(); - DrvDrawForeground(1, 0); - } else { - DrvRenderBackground(); - DrvDrawForeground(0, 0); - DrvDrawSprites(); - DrvDrawForeground(1, 0); - } - - BurnTransferCopy(DrvPalette); -} - -static void KikcubicDraw() -{ - BurnTransferClear(); - - for (INT32 Offset = 0; Offset < 0x1000; Offset += 2) { - INT32 sy = 8 * ((Offset / 2) / 64); - INT32 sx = 8 * ((Offset / 2) % 64); - INT32 Attr = DrvVideoRam[Offset + 1]; - INT32 Colour = (Attr & 0xf0) >> 4; - INT32 Code = DrvVideoRam[Offset] | ((Attr & 0x0f) << 8); - - sx -= 64; - if (sx >= 0 && sx < (nScreenWidth - 8) && sy >= 0 && sy < (nScreenHeight - 8)) { - Render8x8Tile(pTransDraw, Code, sx, sy, Colour, 4, 0, DrvChars); - } else { - Render8x8Tile_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, DrvChars); - } - } - - DrvDrawSprites(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 256; // dac needs 128 NMIs - INT32 nSoundBufferPos = 0; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == (nInterleave - 1)) ZetRaiseIrq(0); - ZetClose(); - - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - if (!DrvHasYM2203) { - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - } else { - BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - } - if (i & 1) { - ZetNmi(); - } - ZetClose(); - - if (pBurnSoundOut && !DrvHasYM2203) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - ZetOpen(1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - nSoundBufferPos += nSegmentLength; - } - } - - if (DrvHasYM2203) { - ZetOpen(1); - BurnTimerEndFrame(nCyclesTotal[1]); - ZetClose(); - } - - if (pBurnSoundOut && !DrvHasYM2203) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - ZetOpen(1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - } - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - if (DrvHasYM2203 && pBurnSoundOut) { - ZetOpen(1); - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) { - if (DrvKikcubicDraw) { - KikcubicDraw(); - } else { - DrvDraw(); - } - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029705; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - if (DrvHasYM2203) { - BurnYM2203Scan(nAction, pnMin); - } else { - BurnYM2151Scan(nAction); - } - DACScan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(DrvRomBank); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(DrvDip); - SCAN_VAR(DrvInput); - SCAN_VAR(DrvIrqVector); - SCAN_VAR(DrvRearColour); - SCAN_VAR(DrvRearDisable); - SCAN_VAR(DrvHorizScrollLo); - SCAN_VAR(DrvHorizScrollHi); - SCAN_VAR(DrvRearHorizScrollLo); - SCAN_VAR(DrvRearHorizScrollHi); - SCAN_VAR(DrvSampleAddress); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - ZetClose(); - } - - return 0; -} - -#undef VECTOR_INIT -#undef YM2151_ASSERT -#undef YM2151_CLEAR -#undef Z80_ASSERT -#undef Z80_CLEAR - -struct BurnDriver BurnDrvVigilant = { - "vigilant", NULL, NULL, NULL, "1988", - "Vigilante (World, set 1)\0", NULL, "Irem", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, - NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 544, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvVigilant1 = { - "vigilant1", "vigilant", NULL, NULL, "1988", - "Vigilante (World, set 2)\0", NULL, "Irem", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, - NULL, Drv1RomInfo, Drv1RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 544, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvVigilantu = { - "vigilantu", "vigilant", NULL, NULL, "1988", - "Vigilante (US)\0", NULL, "Irem (Data East USA License)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, - NULL, DrvuRomInfo, DrvuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 544, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvVigilantu2 = { - "vigilantu2", "vigilant", NULL, NULL, "1988", - "Vigilante (US, rev G)\0", NULL, "Irem (Data East USA License)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, - NULL, Drvu2RomInfo, Drvu2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 544, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvVigilantj = { - "vigilantj", "vigilant", NULL, NULL, "1988", - "Vigilante (Japan)\0", NULL, "Irem", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, - NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 544, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvKikcubic = { - "kikcubic", NULL, NULL, NULL, "1988", - "Meikyu Jima (Japan)\0", NULL, "Irem", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_MISC, GBF_MAZE, 0, - NULL, KikcubicRomInfo, KikcubicRomName, NULL, NULL, KikcubicInputInfo, KikcubicDIPInfo, - KikcubicInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 544, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvKikcubicb = { - "kikcubicb", "kikcubic", NULL, NULL, "1988", - "Kickle Cubele\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_MISC, GBF_MAZE, 0, - NULL, KikcubicbRomInfo, KikcubicbRomName, NULL, NULL, KikcubicInputInfo, KikcubicDIPInfo, - KikcubicInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 544, 384, 256, 4, 3 -}; - -struct BurnDriver BurnDrvBuccanrs = { - "buccanrs", NULL, NULL, NULL, "1989", - "Buccaneers (set 1)\0", NULL, "Duintronic", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, - NULL, BuccanrsRomInfo, BuccanrsRomName, NULL, NULL, BuccanrsInputInfo, BuccanrsDIPInfo, - BuccanrsInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 544, 256, 256, 4, 3 -}; - -struct BurnDriver BurnDrvBuccanrsa = { - "buccanrsa", "buccanrs", NULL, NULL, "1989", - "Buccaneers (set 2)\0", NULL, "Duintronic", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, - NULL, BuccanrsaRomInfo, BuccanrsaRomName, NULL, NULL, BuccanrsaInputInfo, BuccanrsaDIPInfo, - BuccanrsInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 544, 256, 256, 4, 3 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "burn_ym2203.h" +#include "dac.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[3] = {0, 0, 0}; +static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *DrvZ80Rom1 = NULL; +static UINT8 *DrvZ80Rom2 = NULL; +static UINT8 *DrvZ80Ram1 = NULL; +static UINT8 *DrvZ80Ram2 = NULL; +static UINT8 *DrvVideoRam = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvPaletteRam = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvBackTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvSamples = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT8 DrvRomBank; +static UINT8 DrvSoundLatch; +static UINT8 DrvIrqVector; + +static INT32 DrvRearColour; +static INT32 DrvRearDisable; +static INT32 DrvHorizScrollLo; +static INT32 DrvHorizScrollHi; +static INT32 DrvRearHorizScrollLo; +static INT32 DrvRearHorizScrollHi; +static INT32 DrvSampleAddress; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static UINT8 DrvHasYM2203 = 0; +static UINT8 DrvKikcubicDraw = 0; + +#define VECTOR_INIT 0 +#define YM2151_ASSERT 1 +#define YM2151_CLEAR 2 +#define Z80_ASSERT 3 +#define Z80_CLEAR 4 + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, + {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo BuccanrsInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 6, "p2 start" }, + + {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, + {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Buccanrs) + +static struct BurnInputInfo BuccanrsaInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, + {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Buccanrsa) + +static struct BurnInputInfo KikcubicInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, + {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Kikcubic) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + } + + // Clear Opposites + DrvClearOpposites(&DrvInput[1]); + DrvClearOpposites(&DrvInput[2]); +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x02, "2" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x01, "4" }, + {0x12, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x12, 0x01, 0x04, 0x04, "Normal" }, + {0x12, 0x01, 0x04, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Energy Decrease Rate" }, + {0x12, 0x01, 0x08, 0x08, "Slow" }, + {0x12, 0x01, 0x08, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 16 , "Coinage" }, + {0x12, 0x01, 0xf0, 0xa0, "6 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0xb0, "5 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0xc0, "4 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0xd0, "3 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x10, "8 Coins 3 Plays" }, + {0x12, 0x01, 0xf0, 0xe0, "2 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x20, "5 Coins 3 Plays" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 2 Plays" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, + {0x12, 0x01, 0xf0, 0x40, "2 Coins 3 Plays" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 2 Plays" }, + {0x12, 0x01, 0xf0, 0x80, "1 Coin 3 Plays" }, + {0x12, 0x01, 0xf0, 0x70, "1 Coin 4 Plays" }, + {0x12, 0x01, 0xf0, 0x60, "1 Coin 5 Plays" }, + {0x12, 0x01, 0xf0, 0x50, "1 Coin 6 Plays" }, + {0x12, 0x01, 0xf0, 0x00, "Freeplay" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x02, 0x00, "Upright" }, + {0x13, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x13, 0x01, 0x04, 0x04, "Mode 1" }, + {0x13, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x10, 0x00, "Off" }, + {0x13, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Stop Mode" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(Drv) + +static struct BurnDIPInfo BuccanrsDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x2f, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 12 , "Coin A" }, + {0x12, 0x01, 0x0f, 0x04, "4 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x07, "3 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x00, "5 Coins 2 Plays" }, + {0x12, 0x01, 0x0f, 0x0a, "2 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x06, "3 Coins 2 Plays" }, + {0x12, 0x01, 0x0f, 0x03, "4 Coins 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 5 Plays" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, + + {0 , 0xfe, 0 , 12 , "Coin B" }, + {0x12, 0x01, 0xf0, 0x40, "4 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x70, "3 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x00, "5 Coins 2 Plays" }, + {0x12, 0x01, 0xf0, 0xa0, "2 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x60, "3 Coins 2 Plays" }, + {0x12, 0x01, 0xf0, 0x30, "4 Coins 3 Plays" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 5 Plays" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Plays" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Plays" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x06, 0x06, "2" }, + {0x13, 0x01, 0x06, 0x04, "3" }, + {0x13, 0x01, 0x06, 0x02, "4" }, + {0x13, 0x01, 0x06, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x18, 0x18, "Normal" }, + {0x13, 0x01, 0x18, 0x08, "Medium" }, + {0x13, 0x01, 0x18, 0x10, "Hard" }, + {0x13, 0x01, 0x18, 0x00, "Invincibilty" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x20, 0x20, "Upright" }, + {0x13, 0x01, 0x20, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Buccanrs) + +static struct BurnDIPInfo BuccanrsaDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xf4, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0xf4, 0xf4, "Off" }, + {0x11, 0x01, 0xf4, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 12 , "Coin A" }, + {0x12, 0x01, 0x0f, 0x04, "4 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x07, "3 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x00, "5 Coins 2 Plays" }, + {0x12, 0x01, 0x0f, 0x0a, "2 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x06, "3 Coins 2 Plays" }, + {0x12, 0x01, 0x0f, 0x03, "4 Coins 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 5 Plays" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, + + {0 , 0xfe, 0 , 12 , "Coin B" }, + {0x12, 0x01, 0xf0, 0x40, "4 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x70, "3 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x00, "5 Coins 2 Plays" }, + {0x12, 0x01, 0xf0, 0xa0, "2 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x60, "3 Coins 2 Plays" }, + {0x12, 0x01, 0xf0, 0x30, "4 Coins 3 Plays" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 5 Plays" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Plays" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Plays" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Plays" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x06, 0x06, "2" }, + {0x13, 0x01, 0x06, 0x04, "3" }, + {0x13, 0x01, 0x06, 0x02, "4" }, + {0x13, 0x01, 0x06, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x18, 0x18, "Normal" }, + {0x13, 0x01, 0x18, 0x08, "Medium" }, + {0x13, 0x01, 0x18, 0x10, "Hard" }, + {0x13, 0x01, 0x18, 0x00, "Invincibilty" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x20, 0x20, "Upright" }, + {0x13, 0x01, 0x20, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Buccanrsa) + +static struct BurnDIPInfo KikcubicDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xd5, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x03, 0x02, "Easy" }, + {0x11, 0x01, 0x03, 0x03, "Medium" }, + {0x11, 0x01, 0x03, 0x01, "Hard" }, + {0x11, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x0c, 0x08, "1" }, + {0x11, 0x01, 0x0c, 0x04, "2" }, + {0x11, 0x01, 0x0c, 0x0c, "3" }, + {0x11, 0x01, 0x0c, 0x00, "4" }, + + {0 , 0xfe, 0 , 12 , "Coinage" }, + {0x11, 0x01, 0xf0, 0xa0, "6 Coins 1 Play" }, + {0x11, 0x01, 0xf0, 0xb0, "5 Coins 1 Play" }, + {0x11, 0x01, 0xf0, 0xc0, "4 Coins 1 Play" }, + {0x11, 0x01, 0xf0, 0xd0, "3 Coins 1 Play" }, + {0x11, 0x01, 0xf0, 0xe0, "2 Coins 1 Play" }, + {0x11, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, + {0x11, 0x01, 0xf0, 0x70, "1 Coin 2 Plays" }, + {0x11, 0x01, 0xf0, 0x60, "1 Coin 3 Plays" }, + {0x11, 0x01, 0xf0, 0x50, "1 Coin 4 Plays" }, + {0x11, 0x01, 0xf0, 0x40, "1 Coin 5 Plays" }, + {0x11, 0x01, 0xf0, 0x30, "1 Coin 6 Plays" }, + {0x11, 0x01, 0xf0, 0x00, "Freeplay" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x02, 0x00, "Upright" }, + {0x12, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Coin Mode" }, + {0x12, 0x01, 0x04, 0x04, "Mode 1" }, + {0x12, 0x01, 0x04, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Level Select" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Player Adding" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Kikcubic) + +static struct BurnRomInfo DrvRomDesc[] = { + { "g07_c03.bin", 0x08000, 0x9dcca081, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "j07_c04.bin", 0x10000, 0xe0159105, BRF_ESS | BRF_PRG }, // 1 + + { "g05_c02.bin", 0x10000, 0x10582b2d, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "f05_c08.bin", 0x10000, 0x01579d20, BRF_GRA }, // 3 Characters + { "h05_c09.bin", 0x10000, 0x4f5872f0, BRF_GRA }, // 4 + + { "n07_c12.bin", 0x10000, 0x10af8eb2, BRF_GRA }, // 5 Sprites + { "k07_c10.bin", 0x10000, 0x9576f304, BRF_GRA }, // 6 + { "o07_c13.bin", 0x10000, 0xb1d9d4dc, BRF_GRA }, // 7 + { "l07_c11.bin", 0x10000, 0x4598be4a, BRF_GRA }, // 8 + { "t07_c16.bin", 0x10000, 0xf5425e42, BRF_GRA }, // 9 + { "p07_c14.bin", 0x10000, 0xcb50a17c, BRF_GRA }, // 10 + { "v07_c17.bin", 0x10000, 0x959ba3c7, BRF_GRA }, // 11 + { "s07_c15.bin", 0x10000, 0x7f2e91c5, BRF_GRA }, // 12 + + { "d01_c05.bin", 0x10000, 0x81b1ee5c, BRF_GRA }, // 13 Background + { "e01_c06.bin", 0x10000, 0xd0d33673, BRF_GRA }, // 14 + { "f01_c07.bin", 0x10000, 0xaae81695, BRF_GRA }, // 15 + + { "d04_c01.bin", 0x10000, 0x9b85101d, BRF_SND }, // 16 Samples + + { "vg_b-8r.ic90", 0x00117, 0xdf368a7a, BRF_GRA }, // 17 PALs + { "vg_b-4m.ic38", 0x00117, 0xdbca4204, BRF_GRA }, // 18 + { "vg_b-1b.ic1", 0x00117, 0x922e5167, BRF_GRA }, // 19 +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo Drv1RomDesc[] = { + { "vg_a-8h-c.rom", 0x08000, 0xd72682e8, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "vg_a-8l-a.rom", 0x10000, 0x690d812f, BRF_ESS | BRF_PRG }, // 1 + + { "g05_c02.bin", 0x10000, 0x10582b2d, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "f05_c08.bin", 0x10000, 0x01579d20, BRF_GRA }, // 3 Characters + { "h05_c09.bin", 0x10000, 0x4f5872f0, BRF_GRA }, // 4 + + { "n07_c12.bin", 0x10000, 0x10af8eb2, BRF_GRA }, // 5 Sprites + { "k07_c10.bin", 0x10000, 0x9576f304, BRF_GRA }, // 6 + { "o07_c13.bin", 0x10000, 0xb1d9d4dc, BRF_GRA }, // 7 + { "l07_c11.bin", 0x10000, 0x4598be4a, BRF_GRA }, // 8 + { "t07_c16.bin", 0x10000, 0xf5425e42, BRF_GRA }, // 9 + { "p07_c14.bin", 0x10000, 0xcb50a17c, BRF_GRA }, // 10 + { "v07_c17.bin", 0x10000, 0x959ba3c7, BRF_GRA }, // 11 + { "s07_c15.bin", 0x10000, 0x7f2e91c5, BRF_GRA }, // 12 + + { "d01_c05.bin", 0x10000, 0x81b1ee5c, BRF_GRA }, // 13 Background + { "e01_c06.bin", 0x10000, 0xd0d33673, BRF_GRA }, // 14 + { "f01_c07.bin", 0x10000, 0xaae81695, BRF_GRA }, // 15 + + { "d04_c01.bin", 0x10000, 0x9b85101d, BRF_SND }, // 16 Samples + + { "vg_b-8r.ic90", 0x00117, 0xdf368a7a, BRF_GRA }, // 17 PALs + { "vg_b-4m.ic38", 0x00117, 0xdbca4204, BRF_GRA }, // 18 + { "vg_b-1b.ic1", 0x00117, 0x922e5167, BRF_GRA }, // 19 +}; + +STD_ROM_PICK(Drv1) +STD_ROM_FN(Drv1) + +static struct BurnRomInfo DrvuRomDesc[] = { + { "a-8h", 0x08000, 0x8d15109e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a-8l", 0x10000, 0x7f95799b, BRF_ESS | BRF_PRG }, // 1 + + { "g05_c02.bin", 0x10000, 0x10582b2d, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "f05_c08.bin", 0x10000, 0x01579d20, BRF_GRA }, // 3 Characters + { "h05_c09.bin", 0x10000, 0x4f5872f0, BRF_GRA }, // 4 + + { "n07_c12.bin", 0x10000, 0x10af8eb2, BRF_GRA }, // 5 Sprites + { "k07_c10.bin", 0x10000, 0x9576f304, BRF_GRA }, // 6 + { "o07_c13.bin", 0x10000, 0xb1d9d4dc, BRF_GRA }, // 7 + { "l07_c11.bin", 0x10000, 0x4598be4a, BRF_GRA }, // 8 + { "t07_c16.bin", 0x10000, 0xf5425e42, BRF_GRA }, // 9 + { "p07_c14.bin", 0x10000, 0xcb50a17c, BRF_GRA }, // 10 + { "v07_c17.bin", 0x10000, 0x959ba3c7, BRF_GRA }, // 11 + { "s07_c15.bin", 0x10000, 0x7f2e91c5, BRF_GRA }, // 12 + + { "d01_c05.bin", 0x10000, 0x81b1ee5c, BRF_GRA }, // 13 Background + { "e01_c06.bin", 0x10000, 0xd0d33673, BRF_GRA }, // 14 + { "f01_c07.bin", 0x10000, 0xaae81695, BRF_GRA }, // 15 + + { "d04_c01.bin", 0x10000, 0x9b85101d, BRF_SND }, // 16 Samples + + { "vg_b-8r.ic90", 0x00117, 0xdf368a7a, BRF_GRA }, // 17 PALs + { "vg_b-4m.ic38", 0x00117, 0xdbca4204, BRF_GRA }, // 18 + { "vg_b-1b.ic1", 0x00117, 0x922e5167, BRF_GRA }, // 19 +}; + +STD_ROM_PICK(Drvu) +STD_ROM_FN(Drvu) + +static struct BurnRomInfo Drvu2RomDesc[] = { + { "vg-a-8h-g.bin", 0x08000, 0x9444c04e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a-8l", 0x10000, 0x7f95799b, BRF_ESS | BRF_PRG }, // 1 + + { "g05_c02.bin", 0x10000, 0x10582b2d, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "f05_c08.bin", 0x10000, 0x01579d20, BRF_GRA }, // 3 Characters + { "h05_c09.bin", 0x10000, 0x4f5872f0, BRF_GRA }, // 4 + + { "n07_c12.bin", 0x10000, 0x10af8eb2, BRF_GRA }, // 5 Sprites + { "k07_c10.bin", 0x10000, 0x9576f304, BRF_GRA }, // 6 + { "o07_c13.bin", 0x10000, 0xb1d9d4dc, BRF_GRA }, // 7 + { "l07_c11.bin", 0x10000, 0x4598be4a, BRF_GRA }, // 8 + { "t07_c16.bin", 0x10000, 0xf5425e42, BRF_GRA }, // 9 + { "p07_c14.bin", 0x10000, 0xcb50a17c, BRF_GRA }, // 10 + { "v07_c17.bin", 0x10000, 0x959ba3c7, BRF_GRA }, // 11 + { "s07_c15.bin", 0x10000, 0x7f2e91c5, BRF_GRA }, // 12 + + { "d01_c05.bin", 0x10000, 0x81b1ee5c, BRF_GRA }, // 13 Background + { "e01_c06.bin", 0x10000, 0xd0d33673, BRF_GRA }, // 14 + { "f01_c07.bin", 0x10000, 0xaae81695, BRF_GRA }, // 15 + + { "d04_c01.bin", 0x10000, 0x9b85101d, BRF_SND }, // 16 Samples + + { "vg_b-8r.ic90", 0x00117, 0xdf368a7a, BRF_GRA }, // 17 PALs + { "vg_b-4m.ic38", 0x00117, 0xdbca4204, BRF_GRA }, // 18 + { "vg_b-1b.ic1", 0x00117, 0x922e5167, BRF_GRA }, // 19 +}; + +STD_ROM_PICK(Drvu2) +STD_ROM_FN(Drvu2) + +static struct BurnRomInfo DrvjRomDesc[] = { + { "vg_a-8h.rom", 0x08000, 0xba848713, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "vg_a-8l.rom", 0x10000, 0x3b12b1d8, BRF_ESS | BRF_PRG }, // 1 + + { "g05_c02.bin", 0x10000, 0x10582b2d, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "f05_c08.bin", 0x10000, 0x01579d20, BRF_GRA }, // 3 Characters + { "h05_c09.bin", 0x10000, 0x4f5872f0, BRF_GRA }, // 4 + + { "n07_c12.bin", 0x10000, 0x10af8eb2, BRF_GRA }, // 5 Sprites + { "k07_c10.bin", 0x10000, 0x9576f304, BRF_GRA }, // 6 + { "o07_c13.bin", 0x10000, 0xb1d9d4dc, BRF_GRA }, // 7 + { "l07_c11.bin", 0x10000, 0x4598be4a, BRF_GRA }, // 8 + { "t07_c16.bin", 0x10000, 0xf5425e42, BRF_GRA }, // 9 + { "p07_c14.bin", 0x10000, 0xcb50a17c, BRF_GRA }, // 10 + { "v07_c17.bin", 0x10000, 0x959ba3c7, BRF_GRA }, // 11 + { "s07_c15.bin", 0x10000, 0x7f2e91c5, BRF_GRA }, // 12 + + { "d01_c05.bin", 0x10000, 0x81b1ee5c, BRF_GRA }, // 13 Background + { "e01_c06.bin", 0x10000, 0xd0d33673, BRF_GRA }, // 14 + { "f01_c07.bin", 0x10000, 0xaae81695, BRF_GRA }, // 15 + + { "d04_c01.bin", 0x10000, 0x9b85101d, BRF_SND }, // 16 Samples + + { "vg_b-8r.ic90", 0x00117, 0xdf368a7a, BRF_GRA }, // 17 PALs + { "vg_b-4m.ic38", 0x00117, 0xdbca4204, BRF_GRA }, // 18 + { "vg_b-1b.ic1", 0x00117, 0x922e5167, BRF_GRA }, // 19 +}; + +STD_ROM_PICK(Drvj) +STD_ROM_FN(Drvj) + +static struct BurnRomInfo BuccanrsRomDesc[] = { + { "11.u58", 0x10000, 0xbf1d7e6f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "12.u25", 0x10000, 0x87303ba8, BRF_ESS | BRF_PRG }, // 1 + + { "1.u128", 0x10000, 0xeb65f8c3, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "7.u212", 0x10000, 0x95e3c517, BRF_GRA }, // 3 Characters + { "8.u189", 0x10000, 0xfe2377ab, BRF_GRA }, // 4 + + { "3.u100", 0x20000, 0x16dc435f, BRF_GRA }, // 5 Sprites + { "4.u80", 0x10000, 0x4fe3bf97, BRF_GRA }, // 6 + { "6.u52", 0x20000, 0x078aef7f, BRF_GRA }, // 7 + { "5.u70", 0x10000, 0xf650fa90, BRF_GRA }, // 8 + + { "9.u49", 0x20000, 0x0c6188fb, BRF_GRA }, // 9 Background + { "10.u27", 0x20000, 0x2d383ff8, BRF_GRA }, // 10 + + { "2.u74", 0x10000, 0x36ee1dac, BRF_SND }, // 11 Samples + + { "prom1.u54", 0x00100, 0xc324835e, BRF_GRA }, // 12 PROMs + { "prom4.u79", 0x00100, 0xe6506ef4, BRF_GRA }, // 13 + { "prom3.u88", 0x00100, 0xb43d094f, BRF_GRA }, // 14 + { "prom2.u99", 0x00100, 0xe0aa8869, BRF_GRA }, // 15 + + { "pal16l8.u103", 0x00104, 0x00000000, BRF_GRA | BRF_NODUMP }, // 16 PALs + { "pal16l8.u156", 0x00104, 0x00000000, BRF_GRA | BRF_NODUMP }, // 17 + { "pal16l8.u42", 0x00104, 0x00000000, BRF_GRA | BRF_NODUMP }, // 18 +}; + +STD_ROM_PICK(Buccanrs) +STD_ROM_FN(Buccanrs) + +static struct BurnRomInfo BuccanrsaRomDesc[] = { + { "bc-011", 0x08000, 0x6b657ef1, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "12.u25", 0x10000, 0x87303ba8, BRF_ESS | BRF_PRG }, // 1 + + { "1.u128", 0x10000, 0xeb65f8c3, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "7.u212", 0x10000, 0x95e3c517, BRF_GRA }, // 3 Characters + { "8.u189", 0x10000, 0xfe2377ab, BRF_GRA }, // 4 + + { "3.u100", 0x20000, 0x16dc435f, BRF_GRA }, // 5 Sprites + { "4.u80", 0x10000, 0x4fe3bf97, BRF_GRA }, // 6 + { "6.u52", 0x20000, 0x078aef7f, BRF_GRA }, // 7 + { "5.u70", 0x10000, 0xf650fa90, BRF_GRA }, // 8 + + { "9.u49", 0x20000, 0x0c6188fb, BRF_GRA }, // 9 Background + { "10.u27", 0x20000, 0x2d383ff8, BRF_GRA }, // 10 + + { "2.u74", 0x10000, 0x36ee1dac, BRF_SND }, // 11 Samples + + { "prom1.u54", 0x00100, 0xc324835e, BRF_GRA }, // 12 PROMs + { "prom4.u79", 0x00100, 0xe6506ef4, BRF_GRA }, // 13 + { "prom3.u88", 0x00100, 0xb43d094f, BRF_GRA }, // 14 + { "prom2.u99", 0x00100, 0xe0aa8869, BRF_GRA }, // 15 +}; + +STD_ROM_PICK(Buccanrsa) +STD_ROM_FN(Buccanrsa) + +static struct BurnRomInfo KikcubicRomDesc[] = { + { "mqj-p0", 0x08000, 0x9cef394a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "mqj-b0", 0x10000, 0xd9bcf4cd, BRF_ESS | BRF_PRG }, // 1 + { "mqj-b1", 0x10000, 0x54a0abe1, BRF_ESS | BRF_PRG }, // 2 + + { "mqj-sp", 0x10000, 0xbbcf3582, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "mqj-c0", 0x10000, 0x975585c5, BRF_GRA }, // 4 Characters + { "mqj-c1", 0x10000, 0x49d9936d, BRF_GRA }, // 5 + + { "mqj-00", 0x40000, 0x7fb0c58f, BRF_GRA }, // 6 Sprites + { "mqj-10", 0x40000, 0x3a189205, BRF_GRA }, // 7 + + { "mqj-v0", 0x10000, 0x54762956, BRF_SND }, // 8 Samples + + { "8d", 0x00100, 0x7379bb12, BRF_GRA }, // 9 PROMs + { "6h", 0x00020, 0xface0cbb, BRF_GRA }, // 10 + { "7s", 0x00020, 0xface0cbb, BRF_GRA }, // 11 +}; + +STD_ROM_PICK(Kikcubic) +STD_ROM_FN(Kikcubic) + +static struct BurnRomInfo KikcubicbRomDesc[] = { + { "1.bin", 0x08000, 0xd3a589ba, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "4.bin", 0x10000, 0x9ae1e1a6, BRF_ESS | BRF_PRG }, // 1 + { "5.bin", 0x08000, 0xa5a6bffd, BRF_ESS | BRF_PRG }, // 2 + + { "mqj-sp", 0x10000, 0xbbcf3582, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "7.bin", 0x10000, 0x1788d51a, BRF_GRA }, // 4 Characters + { "mqj-c1", 0x10000, 0x49d9936d, BRF_GRA }, // 5 + + { "11.bin", 0x10000, 0x0f0cac92, BRF_GRA }, // 6 Sprites + { "10.bin", 0x10000, 0x7d3822a8, BRF_GRA }, // 7 + { "9.bin", 0x10000, 0x56fb4fa3, BRF_GRA }, // 8 + { "8.bin", 0x10000, 0x947dbd4e, BRF_GRA }, // 9 + + { "mqj-v0", 0x10000, 0x54762956, BRF_SND }, // 10 Samples + + { "8d", 0x00100, 0x7379bb12, BRF_GRA }, // 11 PROMs + { "6h", 0x00020, 0xface0cbb, BRF_GRA }, // 12 + { "7s", 0x00020, 0xface0cbb, BRF_GRA }, // 13 +}; + +STD_ROM_PICK(Kikcubicb) +STD_ROM_FN(Kikcubicb) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom1 = Next; Next += 0x28000; + DrvZ80Rom2 = Next; Next += 0x10000; + DrvSamples = Next; Next += 0x10000; + + RamStart = Next; + + DrvZ80Ram1 = Next; Next += 0x02000; + DrvZ80Ram2 = Next; Next += 0x01000; + DrvSpriteRam = Next; Next += 0x00100; + DrvPaletteRam = Next; Next += 0x00800; + DrvVideoRam = Next; Next += 0x01000; + DrvPalette = (UINT32*)Next; Next += (512 + 32) * sizeof(UINT32); + + RamEnd = Next; + + DrvChars = Next; Next += 0x1000 * 8 * 8; + DrvSprites = Next; Next += 0x1000 * 16 * 16; + DrvBackTiles = Next; Next += 0x4000 * 32; + + MemEnd = Next; + + return 0; +} + +static void DrvSetVector(INT32 Status) +{ + switch (Status) { + case VECTOR_INIT: { + DrvIrqVector = 0xff; + break; + } + + case YM2151_ASSERT: { + DrvIrqVector &= 0xef; + break; + } + + case YM2151_CLEAR: { + DrvIrqVector |= 0x10; + break; + } + + case Z80_ASSERT: { + DrvIrqVector &= 0xdf; + break; + } + + case Z80_CLEAR: { + DrvIrqVector |= 0x20; + break; + } + } + + if (DrvIrqVector == 0xff) { +// ZetSetVector(DrvIrqVector); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } else { + ZetSetVector(DrvIrqVector); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nCyclesDone[1] += ZetRun(1000); + } +} + +static INT32 DrvDoReset() +{ + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + if (i == 1) DrvSetVector(VECTOR_INIT); + ZetClose(); + } + + if (DrvHasYM2203) { + BurnYM2203Reset(); + } else { + BurnYM2151Reset(); + } + + DACReset(); + + DrvRomBank = 0; + DrvSoundLatch = 0; + DrvRearColour = 0; + DrvRearDisable = 0; + DrvHorizScrollLo = 0; + DrvHorizScrollHi = 0; + DrvRearHorizScrollLo = 0; + DrvRearHorizScrollHi = 0; + DrvSampleAddress = 0; + + return 0; +} + +UINT8 __fastcall VigilanteZ80Read1(UINT16 a) +{ + switch (a) { + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall VigilanteZ80Write1(UINT16 a, UINT8 d) +{ + if (a >= 0xc020 && a <= 0xc0df) { + DrvSpriteRam[a - 0xc020] = d; + return; + } + + if (a >= 0xc800 && a <= 0xcfff) { + INT32 Offset = a & 0x7ff; + INT32 Bank = Offset & 0x400; + INT32 r, g, b; + + DrvPaletteRam[Offset] = d; + + Offset &= 0xff; + r = (DrvPaletteRam[Bank + Offset + 0x000] << 3) & 0xff; + g = (DrvPaletteRam[Bank + Offset + 0x100] << 3) & 0xff; + b = (DrvPaletteRam[Bank + Offset + 0x200] << 3) & 0xff; + + DrvPalette[(Bank >> 2) + Offset] = BurnHighCol(r, g, b, 0); + return; + } + + switch (a) { + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall VigilanteZ80PortRead1(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return 0xff - DrvInput[0]; + } + + case 0x01: { + return 0xff - DrvInput[1]; + } + + case 0x02: { + return 0xff - DrvInput[2]; + } + + case 0x03: { + return DrvDip[0]; + } + + case 0x04: { + return DrvDip[1]; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall BuccanrsZ80PortRead1(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return (0xd0 - DrvInput[0]) | DrvDip[0]; + } + + case 0x01: { + return 0xff - DrvInput[1]; + } + + case 0x02: { + return 0xff - DrvInput[2]; + } + + case 0x03: { + return DrvDip[1]; + } + + case 0x04: { + return DrvDip[2]; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall BuccanrsaZ80PortRead1(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return (0x0b - DrvInput[0]) | DrvDip[0]; + } + + case 0x01: { + return 0xff - DrvInput[1]; + } + + case 0x02: { + return 0xff - DrvInput[2]; + } + + case 0x03: { + return DrvDip[1]; + } + + case 0x04: { + return DrvDip[2]; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall VigilanteZ80PortWrite1(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + DrvSoundLatch = d; + ZetClose(); + ZetOpen(1); + DrvSetVector(Z80_ASSERT); + ZetClose(); + ZetOpen(0); + return; + } + + case 0x01: { + // output port? + return; + } + + case 0x04: { + DrvRomBank = d & 0x07; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + return; + } + + case 0x80: { + DrvHorizScrollLo = d; + return; + } + + case 0x81: { + DrvHorizScrollHi = (d & 0x01) << 8; + return; + } + + case 0x82: { + DrvRearHorizScrollLo = d; + return; + } + + case 0x83: { + DrvRearHorizScrollHi = (d & 0x07) << 8; + return; + } + + case 0x84: { + DrvRearColour = d & 0x0d; + DrvRearDisable = d & 0x40; + return; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall KikcubicZ80Read1(UINT16 a) +{ + switch (a) { + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall KikcubicZ80Write1(UINT16 a, UINT8 d) +{ + if (a >= 0xc800 && a <= 0xcaff) { + INT32 Offset = a & 0x3ff; + INT32 Bank = Offset & 0x400; + INT32 r, g, b; + + DrvPaletteRam[Offset] = d; + + Offset &= 0xff; + r = (DrvPaletteRam[Bank + Offset + 0x000] << 3) & 0xff; + g = (DrvPaletteRam[Bank + Offset + 0x100] << 3) & 0xff; + b = (DrvPaletteRam[Bank + Offset + 0x200] << 3) & 0xff; + + DrvPalette[(Bank >> 2) + Offset] = BurnHighCol(r, g, b, 0); + return; + } + + switch (a) { + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall KikcubicZ80PortRead1(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return DrvDip[0]; + } + + case 0x01: { + return DrvDip[1]; + } + + case 0x02: { + return 0xff - DrvInput[1]; + } + + case 0x03: { + return 0xff - DrvInput[0]; + } + + case 0x04: { + return 0xff - DrvInput[2]; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall KikcubicZ80PortWrite1(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + // coin write + return; + } + + case 0x04: { + DrvRomBank = d & 0x07; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + return; + } + + case 0x06: { + if (d == 0x20) return; // ??? + DrvSoundLatch = d; + ZetClose(); + ZetOpen(1); + DrvSetVector(Z80_ASSERT); + ZetClose(); + ZetOpen(0); + return; + } + + case 0x07: { + // nop??? + return; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall VigilanteZ80Read2(UINT16 a) +{ + switch (a) { + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall VigilanteZ80Write2(UINT16 a, UINT8 /*d*/) +{ + switch (a) { + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall VigilanteZ80PortRead2(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x01: { + return BurnYM2151ReadStatus(); + } + + case 0x80: { + return DrvSoundLatch; + } + + case 0x84: { + return DrvSamples[DrvSampleAddress]; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall VigilanteZ80PortWrite2(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x01: { + BurnYM2151WriteRegister(d); + return; + } + + case 0x80: { + DrvSampleAddress = (DrvSampleAddress & 0xff00) | ((d << 0) & 0x00ff); + return; + } + + case 0x81: { + DrvSampleAddress = (DrvSampleAddress & 0x00ff) | ((d << 8) & 0xff00); + return; + } + + case 0x82: { + DACSignedWrite(0, d); + DrvSampleAddress = (DrvSampleAddress + 1) & 0xffff; + return; + } + + case 0x83: { + DrvSetVector(Z80_CLEAR); + return; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall BuccanrsZ80PortRead2(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return YM2203Read(0, 0); + } + + case 0x02: { + return YM2203Read(1, 0); + } + + case 0x80: { + return DrvSoundLatch; + } + + case 0x84: { + return DrvSamples[DrvSampleAddress]; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall BuccanrsZ80PortWrite2(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0x01: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0x02: { + BurnYM2203Write(1, 0, d); + return; + } + + case 0x03: { + BurnYM2203Write(1, 1, d); + return; + } + + case 0x80: { + DrvSampleAddress = (DrvSampleAddress & 0xff00) | ((d << 0) & 0x00ff); + return; + } + + case 0x81: { + DrvSampleAddress = (DrvSampleAddress & 0x00ff) | ((d << 8) & 0xff00); + return; + } + + case 0x82: { + DACSignedWrite(0, d); + DrvSampleAddress = (DrvSampleAddress + 1) & 0xffff; + return; + } + + case 0x83: { + DrvSetVector(Z80_CLEAR); + return; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); + } + } +} + +static void VigilantYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + DrvSetVector(YM2151_ASSERT); + } else { + DrvSetVector(YM2151_CLEAR); + } +} + +inline static void BuccanrsYM2203IRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + DrvSetVector(YM2151_ASSERT); + } else { + DrvSetVector(YM2151_CLEAR); + } +} + +inline static INT32 BuccanrsSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / (18432000 / 6); +} + +inline static double BuccanrsGetTime() +{ + return (double)ZetTotalCycles() / (18432000 / 6); +} + +static INT32 VigilantSyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / ((nCyclesTotal[1] * 55.0000) / (nBurnFPS / 100.0000)))); +} + +static INT32 CharPlaneOffsets[4] = { 0x80000, 0x80004, 0, 4 }; +static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 64, 65, 66, 67 }; +static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 SpritePlaneOffsets[4] = { 0x200000, 0x200004, 0, 4 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 128, 129, 130, 131, 256, 257, 258, 259, 384, 385, 386, 387 }; +static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; +static INT32 BackTilePlaneOffsets[4] = { 0, 2, 4, 6 }; +static INT32 BackTileXOffsets[32] = { 1, 0, 9, 8, 17, 16, 25, 24, 33, 32, 41, 40, 49, 48, 57, 56, 65, 64, 73, 72, 81, 80, 89, 88, 97, 96, 105, 104, 113, 112, 121, 120 }; +static INT32 BackTileYOffsets[1] = { 0 }; +static INT32 BuccSpriteXOffsets[16] = { 3, 2, 1, 0, 131, 130, 129, 128, 259, 258, 257, 256, 387, 386, 385, 384 }; +static INT32 BuccBackTilePlaneOffsets[4] = { 6, 4, 2, 0 }; + +static INT32 DrvInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 4, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x70000, 12, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the bg tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 15, 1); if (nRet != 0) return 1; + GfxDecode(0x4000, 4, 32, 1, BackTilePlaneOffsets, BackTileXOffsets, BackTileYOffsets, 0x80, DrvTempRom, DrvBackTiles); + + BurnFree(DrvTempRom); + + // Load sample Roms + nRet = BurnLoadRom(DrvSamples + 0x00000, 16, 1); if (nRet != 0) return 1; + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(VigilanteZ80Read1); + ZetSetWriteHandler(VigilanteZ80Write1); + ZetSetInHandler(VigilanteZ80PortRead1); + ZetSetOutHandler(VigilanteZ80PortWrite1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0xc800, 0xcfff, 0, DrvPaletteRam ); + ZetMapArea(0xc800, 0xcfff, 2, DrvPaletteRam ); + ZetMapArea(0xd000, 0xdfff, 0, DrvVideoRam ); + ZetMapArea(0xd000, 0xdfff, 1, DrvVideoRam ); + ZetMapArea(0xd000, 0xdfff, 2, DrvVideoRam ); + ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(VigilanteZ80Read2); + ZetSetWriteHandler(VigilanteZ80Write2); + ZetSetInHandler(VigilanteZ80PortRead2); + ZetSetOutHandler(VigilanteZ80PortWrite2); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom2 ); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom2 ); + ZetMapArea(0xf000, 0xffff, 0, DrvZ80Ram2 ); + ZetMapArea(0xf000, 0xffff, 1, DrvZ80Ram2 ); + ZetMapArea(0xf000, 0xffff, 2, DrvZ80Ram2 ); + ZetClose(); + + BurnSetRefreshRate(55.0); + nCyclesTotal[0] = 3579645 / 55; + nCyclesTotal[1] = 3579645 / 55; + + GenericTilesInit(); + BurnYM2151Init(3579645); + BurnYM2151SetIrqHandler(&VigilantYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.55, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.55, BURN_SND_ROUTE_RIGHT); + DACInit(0, 0, 1, VigilantSyncDAC); + DACSetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static INT32 BuccanrsInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 4, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + memcpy(DrvTempRom + 0x20000, DrvTempRom + 0x10000, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x10000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 7, 1); if (nRet != 0) return 1; + memcpy(DrvTempRom + 0x60000, DrvTempRom + 0x50000, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x50000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, BuccSpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the bg tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x4000, 4, 32, 1, BuccBackTilePlaneOffsets, BackTileXOffsets, BackTileYOffsets, 0x80, DrvTempRom, DrvBackTiles); + + BurnFree(DrvTempRom); + + // Load sample Roms + nRet = BurnLoadRom(DrvSamples + 0x00000, 11, 1); if (nRet != 0) return 1; + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(VigilanteZ80Read1); + ZetSetWriteHandler(VigilanteZ80Write1); + ZetSetInHandler(BuccanrsZ80PortRead1); + ZetSetOutHandler(VigilanteZ80PortWrite1); + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "buccanrsa")) ZetSetInHandler(BuccanrsaZ80PortRead1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0xc800, 0xcfff, 0, DrvPaletteRam ); + ZetMapArea(0xc800, 0xcfff, 2, DrvPaletteRam ); + ZetMapArea(0xd000, 0xdfff, 0, DrvVideoRam ); + ZetMapArea(0xd000, 0xdfff, 1, DrvVideoRam ); + ZetMapArea(0xd000, 0xdfff, 2, DrvVideoRam ); + ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(VigilanteZ80Read2); + ZetSetWriteHandler(VigilanteZ80Write2); + ZetSetInHandler(BuccanrsZ80PortRead2); + ZetSetOutHandler(BuccanrsZ80PortWrite2); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom2 ); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom2 ); + ZetMapArea(0xf000, 0xffff, 0, DrvZ80Ram2 ); + ZetMapArea(0xf000, 0xffff, 1, DrvZ80Ram2 ); + ZetMapArea(0xf000, 0xffff, 2, DrvZ80Ram2 ); + ZetClose(); + + BurnSetRefreshRate(55.0); + nCyclesTotal[0] = 5688800 / 55; + nCyclesTotal[1] = (18432000 / 6) / 55; + + GenericTilesInit(); + + DrvHasYM2203 = 1; + BurnYM2203Init(2, 18432000 / 6, &BuccanrsYM2203IRQHandler, BuccanrsSynchroniseStream, BuccanrsGetTime, 0); + BurnTimerAttachZet(18432000 / 6); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.35, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.35, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.35, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.35, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.35, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.35, BURN_SND_ROUTE_BOTH); + + DACInit(0, 0, 1, VigilantSyncDAC); + DACSetRoute(0, 0.35, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static INT32 KikcubicInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "kikcubicb")) { + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x28000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom + 0x00000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x70000, 9, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load sample Roms + nRet = BurnLoadRom(DrvSamples + 0x00000, 10, 1); if (nRet != 0) return 1; + } else { + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom + 0x00000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load sample Roms + nRet = BurnLoadRom(DrvSamples + 0x00000, 8, 1); if (nRet != 0) return 1; + } + + BurnFree(DrvTempRom); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(KikcubicZ80Read1); + ZetSetWriteHandler(KikcubicZ80Write1); + ZetSetInHandler(KikcubicZ80PortRead1); + ZetSetOutHandler(KikcubicZ80PortWrite1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0xc000, 0xc0ff, 0, DrvSpriteRam ); + ZetMapArea(0xc000, 0xc0ff, 1, DrvSpriteRam ); + ZetMapArea(0xc000, 0xc0ff, 2, DrvSpriteRam ); + ZetMapArea(0xc800, 0xcaff, 0, DrvPaletteRam ); + ZetMapArea(0xc800, 0xcaff, 2, DrvPaletteRam ); + ZetMapArea(0xd000, 0xdfff, 0, DrvVideoRam ); + ZetMapArea(0xd000, 0xdfff, 1, DrvVideoRam ); + ZetMapArea(0xd000, 0xdfff, 2, DrvVideoRam ); + ZetMapArea(0xe000, 0xffff, 0, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xffff, 1, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xffff, 2, DrvZ80Ram1 ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(VigilanteZ80Read2); + ZetSetWriteHandler(VigilanteZ80Write2); + ZetSetInHandler(VigilanteZ80PortRead2); + ZetSetOutHandler(VigilanteZ80PortWrite2); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom2 ); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom2 ); + ZetMapArea(0xf000, 0xffff, 0, DrvZ80Ram2 ); + ZetMapArea(0xf000, 0xffff, 1, DrvZ80Ram2 ); + ZetMapArea(0xf000, 0xffff, 2, DrvZ80Ram2 ); + ZetClose(); + + BurnSetRefreshRate(55.0); + nCyclesTotal[0] = 3579645 / 55; + nCyclesTotal[1] = 3579645 / 55; + + GenericTilesInit(); + BurnYM2151Init(3579645); + BurnYM2151SetIrqHandler(&VigilantYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.55, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.55, BURN_SND_ROUTE_RIGHT); + DACInit(0, 0, 1, VigilantSyncDAC); + DACSetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + DrvKikcubicDraw = 1; + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + if (DrvHasYM2203) { + BurnYM2203Exit(); + } else { + BurnYM2151Exit(); + } + DACExit(); + + GenericTilesExit(); + + BurnFree(Mem); + + DrvRomBank = 0; + DrvSoundLatch = 0; + DrvIrqVector = 0; + DrvRearColour = 0; + DrvRearDisable = 0; + DrvHorizScrollLo = 0; + DrvHorizScrollHi = 0; + DrvRearHorizScrollLo = 0; + DrvRearHorizScrollHi = 0; + DrvSampleAddress = 0; + + DrvHasYM2203 = 0; + DrvKikcubicDraw = 0; + + return 0; +} + +static void DrvRenderBackground() +{ + INT32 CharCode = 0; + INT32 Scroll = 0x17a - (DrvRearHorizScrollLo + DrvRearHorizScrollHi); + if (Scroll > 0) Scroll -= 2048; + + for (INT32 i = 0; i < 16; i++) { + INT32 r, g, b; + + r = (DrvPaletteRam[0x400 + 16 * DrvRearColour + i] << 3) & 0xff; + g = (DrvPaletteRam[0x500 + 16 * DrvRearColour + i] << 3) & 0xff; + b = (DrvPaletteRam[0x600 + 16 * DrvRearColour + i] << 3) & 0xff; + + DrvPalette[512 + i] = BurnHighCol(r, g, b, 0); + + r = (DrvPaletteRam[0x400 + 16 * DrvRearColour + 32 + i] << 3) & 0xff; + g = (DrvPaletteRam[0x500 + 16 * DrvRearColour + 32 + i] << 3) & 0xff; + b = (DrvPaletteRam[0x600 + 16 * DrvRearColour + 32 + i] << 3) & 0xff; + + DrvPalette[512 + 16 + i] = BurnHighCol(r, g, b, 0); + } + + for (INT32 Page = 0; Page < 4; Page++) { + for (INT32 Row = 0; Row < 256; Row++) { + for (INT32 Col = 0; Col < 512; Col += 32) { + INT32 Colour = (Row < 128) ? 0 : 1; + UINT32 nPalette = 512 | (Colour << 4); + + for (INT32 px = 0; px < 32; px++) { + UINT8 c = DrvBackTiles[(CharCode * 32) + px]; + INT32 xPos = (512 * Page) + Col + px + Scroll; + + if (Row >= 0 && Row < nScreenHeight) { + UINT16* pPixel = pTransDraw + (Row * nScreenWidth); + + if (xPos >= 0 && xPos < nScreenWidth) { + pPixel[xPos] = c | nPalette; + } + } + } + + CharCode++; + } + } + } +} + +static void DrvDrawForeground(INT32 Priority, INT32 Opaque) +{ + INT32 Scroll = -(DrvHorizScrollLo + DrvHorizScrollHi); + + for (INT32 Offset = 0; Offset < 0x1000; Offset += 2) { + INT32 sy = 8 * ((Offset / 2) / 64); + INT32 sx = 8 * ((Offset / 2) % 64); + INT32 Attr = DrvVideoRam[Offset + 1]; + INT32 Colour = Attr & 0x0f; + INT32 Tile = DrvVideoRam[Offset + 0] | ((Attr & 0xf0) << 4); + + if (Priority) { + // Sprite masking + if ((Colour & 0x0c) == 0x0c) { + if (sy >= 48) { + sx = (sx + Scroll) & 0x1ff; + + sx -= 128; + + INT32 px, py; + UINT32 nPalette = 256 | (Colour << 4); + + for (py = 0; py < 8; py++) { + for (px = 0; px < 8; px++) { + UINT8 c = DrvChars[(Tile * 64) + (py * 8) + px]; + + if (((0xff >> c) & 0x01) == 0) { + INT32 xPos = sx + px; + INT32 yPos = sy + py; + + if (yPos >= 0 && yPos < nScreenHeight) { + UINT16* pPixel = pTransDraw + (yPos * nScreenWidth); + + if (xPos >= 0 && xPos < nScreenWidth) { + pPixel[xPos] = c | nPalette; + } + } + } + } + } + } + } + } else { + if (sy >= 48) sx = (sx + Scroll) & 0x1ff; + + sx -= 128; + + if (sx >= 0 && sx < (nScreenWidth - 8) && sy >= 0 && sy < (nScreenHeight - 8)) { + if (Opaque || Colour >= 4) { + Render8x8Tile(pTransDraw, Tile, sx, sy, Colour, 4, 256, DrvChars); + } else { + Render8x8Tile_Mask(pTransDraw, Tile, sx, sy, Colour, 4, 0, 256, DrvChars); + } + } else { + if (Opaque || Colour >= 4) { + Render8x8Tile_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 256, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 0, 256, DrvChars); + } + } + } + } +} + +static void DrvDrawSprites() +{ + INT32 DrvSpriteRamSize = 0xc0; + if (DrvKikcubicDraw) DrvSpriteRamSize = 0x100; + + for (INT32 Offset = 0; Offset < DrvSpriteRamSize; Offset += 8) { + INT32 Code, Colour, sx, sy, xFlip, yFlip, h; + + Code = DrvSpriteRam[Offset + 4] | ((DrvSpriteRam[Offset + 5] & 0x0f) << 8); + Colour = DrvSpriteRam[Offset + 0] & 0x0f; + sx = (DrvSpriteRam[Offset + 6] | ((DrvSpriteRam[Offset + 7] & 0x01) << 8)); + sy = 256 + 128 - (DrvSpriteRam[Offset + 2] | ((DrvSpriteRam[Offset + 3] & 0x01) << 8)); + xFlip = DrvSpriteRam[Offset + 5] & 0x40; + yFlip = DrvSpriteRam[Offset + 5] & 0x80; + h = 1 << ((DrvSpriteRam[Offset + 5] & 0x30) >> 4); + sy -= 16 * h; + + Code &= ~(h - 1); + + if (DrvKikcubicDraw) { + sx -= 64; + } else { + sx -= 128; + } + + for (INT32 y = 0; y < h; y++) { + INT32 c = Code; + + if (yFlip) { + c += h - 1 - y; + } else { + c += y; + } + + if (sx > 16 && sx < (nScreenWidth - 16) && (sy + (16 * y)) > 16 && (sy + (16 * y)) < (nScreenHeight - 16)) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, c, sx, sy + (16 * y), Colour, 4, 0, 0, DrvSprites); + } + } + } + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + + if (DrvRearDisable) { + DrvDrawForeground(0, 1); + DrvDrawSprites(); + DrvDrawForeground(1, 0); + } else { + DrvRenderBackground(); + DrvDrawForeground(0, 0); + DrvDrawSprites(); + DrvDrawForeground(1, 0); + } + + BurnTransferCopy(DrvPalette); +} + +static void KikcubicDraw() +{ + BurnTransferClear(); + + for (INT32 Offset = 0; Offset < 0x1000; Offset += 2) { + INT32 sy = 8 * ((Offset / 2) / 64); + INT32 sx = 8 * ((Offset / 2) % 64); + INT32 Attr = DrvVideoRam[Offset + 1]; + INT32 Colour = (Attr & 0xf0) >> 4; + INT32 Code = DrvVideoRam[Offset] | ((Attr & 0x0f) << 8); + + sx -= 64; + if (sx >= 0 && sx < (nScreenWidth - 8) && sy >= 0 && sy < (nScreenHeight - 8)) { + Render8x8Tile(pTransDraw, Code, sx, sy, Colour, 4, 0, DrvChars); + } else { + Render8x8Tile_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, DrvChars); + } + } + + DrvDrawSprites(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 256; // dac needs 128 NMIs + INT32 nSoundBufferPos = 0; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == (nInterleave - 1)) ZetRaiseIrq(0); + ZetClose(); + + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + if (!DrvHasYM2203) { + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + } else { + BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + } + if (i & 1) { + ZetNmi(); + } + ZetClose(); + + if (pBurnSoundOut && !DrvHasYM2203) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + ZetOpen(1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + nSoundBufferPos += nSegmentLength; + } + } + + if (DrvHasYM2203) { + ZetOpen(1); + BurnTimerEndFrame(nCyclesTotal[1]); + ZetClose(); + } + + if (pBurnSoundOut && !DrvHasYM2203) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + ZetOpen(1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + } + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + if (DrvHasYM2203 && pBurnSoundOut) { + ZetOpen(1); + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) { + if (DrvKikcubicDraw) { + KikcubicDraw(); + } else { + DrvDraw(); + } + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029705; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + if (DrvHasYM2203) { + BurnYM2203Scan(nAction, pnMin); + } else { + BurnYM2151Scan(nAction); + } + DACScan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(DrvRomBank); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(DrvDip); + SCAN_VAR(DrvInput); + SCAN_VAR(DrvIrqVector); + SCAN_VAR(DrvRearColour); + SCAN_VAR(DrvRearDisable); + SCAN_VAR(DrvHorizScrollLo); + SCAN_VAR(DrvHorizScrollHi); + SCAN_VAR(DrvRearHorizScrollLo); + SCAN_VAR(DrvRearHorizScrollHi); + SCAN_VAR(DrvSampleAddress); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + ZetClose(); + } + + return 0; +} + +#undef VECTOR_INIT +#undef YM2151_ASSERT +#undef YM2151_CLEAR +#undef Z80_ASSERT +#undef Z80_CLEAR + +struct BurnDriver BurnDrvVigilant = { + "vigilant", NULL, NULL, NULL, "1988", + "Vigilante (World, set 1)\0", NULL, "Irem", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, + NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 544, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvVigilant1 = { + "vigilant1", "vigilant", NULL, NULL, "1988", + "Vigilante (World, set 2)\0", NULL, "Irem", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, + NULL, Drv1RomInfo, Drv1RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 544, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvVigilantu = { + "vigilantu", "vigilant", NULL, NULL, "1988", + "Vigilante (US)\0", NULL, "Irem (Data East USA License)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, + NULL, DrvuRomInfo, DrvuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 544, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvVigilantu2 = { + "vigilantu2", "vigilant", NULL, NULL, "1988", + "Vigilante (US, rev G)\0", NULL, "Irem (Data East USA License)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, + NULL, Drvu2RomInfo, Drvu2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 544, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvVigilantj = { + "vigilantj", "vigilant", NULL, NULL, "1988", + "Vigilante (Japan)\0", NULL, "Irem", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, + NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 544, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvKikcubic = { + "kikcubic", NULL, NULL, NULL, "1988", + "Meikyu Jima (Japan)\0", NULL, "Irem", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_MISC, GBF_MAZE, 0, + NULL, KikcubicRomInfo, KikcubicRomName, NULL, NULL, KikcubicInputInfo, KikcubicDIPInfo, + KikcubicInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 544, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvKikcubicb = { + "kikcubicb", "kikcubic", NULL, NULL, "1988", + "Kickle Cubele\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_IREM_MISC, GBF_MAZE, 0, + NULL, KikcubicbRomInfo, KikcubicbRomName, NULL, NULL, KikcubicInputInfo, KikcubicDIPInfo, + KikcubicInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 544, 384, 256, 4, 3 +}; + +struct BurnDriver BurnDrvBuccanrs = { + "buccanrs", NULL, NULL, NULL, "1989", + "Buccaneers (set 1)\0", NULL, "Duintronic", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, + NULL, BuccanrsRomInfo, BuccanrsRomName, NULL, NULL, BuccanrsInputInfo, BuccanrsDIPInfo, + BuccanrsInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 544, 256, 256, 4, 3 +}; + +struct BurnDriver BurnDrvBuccanrsa = { + "buccanrsa", "buccanrs", NULL, NULL, "1989", + "Buccaneers (set 2)\0", NULL, "Duintronic", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_IREM_MISC, GBF_SCRFIGHT, 0, + NULL, BuccanrsaRomInfo, BuccanrsaRomName, NULL, NULL, BuccanrsaInputInfo, BuccanrsaDIPInfo, + BuccanrsInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 544, 256, 256, 4, 3 +}; diff --git a/src/burn/drv/konami/d_88games.cpp b/src/burn/drv/konami/d_88games.cpp index c7c35e086..70237cba5 100644 --- a/src/burn/drv/konami/d_88games.cpp +++ b/src/burn/drv/konami/d_88games.cpp @@ -1,847 +1,846 @@ -// FB Alpha '88 Games driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" -#include "upd7759.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvGfxROMExp2; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *DrvBankRAM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvNVRAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *nDrvBank; - -static INT32 videobank; -static INT32 zoomreadroms; -static INT32 k88games_priority; -static INT32 UPD7759Device; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo games88InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 3, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"P3 Start", BIT_DIGITAL, DrvJoy3 + 3, "p3 start" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, DrvJoy3 + 2, "p3 fire 3" }, - - {"P4 Start", BIT_DIGITAL, DrvJoy3 + 7, "p4 start" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p4 fire 2" }, - {"P4 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p4 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(games88) - -static struct BurnDIPInfo games88DIPList[]= -{ - {0x14, 0xff, 0xff, 0xf0, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0x7b, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x10, 0x10, "Off" }, -// {0x14, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "World Records" }, - {0x14, 0x01, 0x20, 0x20, "Don't Erase" }, - {0x14, 0x01, 0x20, 0x00, "Erase on Reset" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x15, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x15, 0x01, 0xf0, 0x00, "No Coin B" }, - -// {0 , 0xfe, 0 , 4, "Cabinet" }, -// {0x16, 0x01, 0x06, 0x06, "Cocktail" }, -// {0x16, 0x01, 0x06, 0x04, "Cocktail (A)" }, -// {0x16, 0x01, 0x06, 0x02, "Upright" }, -// {0x16, 0x01, 0x06, 0x00, "Upright (D)" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x60, 0x60, "Easy" }, - {0x16, 0x01, 0x60, 0x40, "Normal" }, - {0x16, 0x01, 0x60, 0x20, "Hard" }, - {0x16, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(games88) - -void games88_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x5f84: - zoomreadroms = data & 0x04; - return; - - case 0x5f88: - // watchdog - return; - - case 0x5f8c: - *soundlatch = data; - return; - - case 0x5f90: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - } - - if ((address & 0xf800) == 0x3800) - { - if (videobank) - DrvBankRAM[address & 0x7ff] = data; - else - K051316Write(0, address & 0x7ff, data); - - return; - } - - if ((address & 0xfff0) == 0x5fc0) { - K051316WriteCtrl(0, address & 0x0f, data); - return; - } - - if ((address & 0xc000) == 0x4000) { - K052109_051960_w(address & 0x3fff, data); - return; - } -} - -UINT8 games88_main_read(UINT16 address) -{ - switch (address) - { - case 0x5f94: - return (DrvInputs[0] & 0x0f) | (DrvDips[0] & 0xf0); - - case 0x5f95: - return DrvInputs[1]; - - case 0x5f96: - return DrvInputs[2]; - - case 0x5f97: - return DrvDips[1]; - - case 0x5f9b: - return DrvDips[2]; - } - - if ((address & 0xf800) == 0x3800) - { - if (videobank) { - return DrvBankRAM[address & 0x7ff]; - } else { - if (zoomreadroms) { - return K051316ReadRom(0, address & 0x7ff); // k051316_rom_0 - } else { - return K051316Read(0, address & 0x7ff); // k051316_0 - } - } - } - - if ((address & 0xc000) == 0x4000) { - return K052109_051960_r(address & 0x3fff); - } - - return 0; -} - -void __fastcall games88_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x9000: - UPD7759PortWrite(UPD7759Device, data); - return; - - case 0xc000: - BurnYM2151SelectRegister(data); - return; - - case 0xc001: - BurnYM2151WriteRegister(data); - return; - - case 0xe000: - UPD7759Device = (data & 4) >> 2; - UPD7759ResetWrite(UPD7759Device, data & 2); - UPD7759StartWrite(UPD7759Device, data & 1); - return; - } -} - -UINT8 __fastcall games88_sound_read(UINT16 address) -{ - switch (address) - { - case 0xa000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0xc000: - case 0xc001: - return BurnYM2151ReadStatus(); - } - - return 0; -} - -static void games88_set_lines(INT32 lines) -{ - nDrvBank[0] = lines; - - INT32 nBank = 0x10000 + (lines & 0x07) * 0x2000; - - konamiMapMemory(DrvKonROM + nBank, 0x0000, 0x0fff, KON_ROM); - - if (lines & 8) { - konamiMapMemory(DrvPalRAM, 0x1000, 0x1fff, KON_RAM); - } else { - konamiMapMemory(DrvKonROM + nBank + 0x1000, 0x1000, 0x1fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x0000, 0x1000, 0x1fff, KON_WRITE); // unmap writes - } - - videobank = lines & 0x10; - K052109RMRDLine = lines & 0x20; - k88games_priority = lines & 0x80; -} - -static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - INT32 layer_colorbase[3] = { 64, 0, 16 }; - - *code |= ((*color & 0x0f) << 8) | (bank << 12); - *color = layer_colorbase[layer] + ((*color & 0xf0) >> 4); -} - -static void K051960Callback(INT32 *, INT32 *color, INT32 *priority, INT32 *) -{ - *priority = (*color & 0x20) >> 5; - *color = 32 + (*color & 0x0f); -} - -static void K051316Callback(INT32 *code,INT32 *color,INT32 *flags) -{ - *flags = *color & 0x40; - *code |= ((*color & 0x07) << 8); - *color = 48 + ((*color & 0x38) >> 3) + ((*color & 0x80) >> 4); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - UPD7759Reset(); - - videobank = 0; - zoomreadroms = 0; - k88games_priority = 0; - UPD7759Device = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x020000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x080000; - DrvGfxROM1 = Next; Next += 0x100000; - DrvGfxROM2 = Next; Next += 0x040000; - DrvGfxROMExp0 = Next; Next += 0x100000; - DrvGfxROMExp1 = Next; Next += 0x200000; - DrvGfxROMExp2 = Next; Next += 0x080000; - - DrvSndROM0 = Next; Next += 0x020000; - DrvSndROM1 = Next; Next += 0x020000; - - DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - - AllRam = Next; - - DrvBankRAM = Next; Next += 0x000800; - DrvKonRAM = Next; Next += 0x001000; - DrvPalRAM = Next; Next += 0x001000; - DrvNVRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - nDrvBank = Next; Next += 0x000002; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs0[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x080000); - konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); - - GfxDecode(0x04000, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x100, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x02000, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvKonROM + 0x008000, 0, 1)) return 1; - if (BurnLoadRom(DrvKonROM + 0x010000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x020000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x020001, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040001, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060000, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060001, 10, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 11, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020001, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 15, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040001, 16, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060000, 17, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060001, 18, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 19, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080001, 20, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0a0000, 21, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0a0001, 22, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 23, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 24, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0e0000, 25, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0e0001, 26, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 27, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x010000, 28, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x020000, 29, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x030000, 30, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 31, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x010000, 32, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x000000, 33, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x010000, 34, 1)) return 1; - - DrvGfxDecode(); - } - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvPalRAM + 0x0000, 0x1000, 0x1fff, KON_RAM); - konamiMapMemory(DrvKonRAM, 0x2000, 0x2fff, KON_RAM); - konamiMapMemory(DrvNVRAM, 0x3000, 0x37ff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x8000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(games88_main_write); - konamiSetReadHandler(games88_main_read); - konamiSetlinesCallback(games88_set_lines); - konamiClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(games88_sound_write); - ZetSetReadHandler(games88_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetAllRoutes(0.75, BURN_SND_ROUTE_BOTH); - - UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvSndROM0); - UPD7759Init(1, UPD7759_STANDARD_CLOCK, DrvSndROM1); - UPD7759SetRoute(0, 0.30, BURN_SND_ROUTE_BOTH); - UPD7759SetRoute(1, 0.30, BURN_SND_ROUTE_BOTH); - - K052109Init(DrvGfxROM0, 0x7ffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(0, 0); - - K051960Init(DrvGfxROM1, 0xfffff); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(0, 0); - - K051316Init(0, DrvGfxROM2, DrvGfxROMExp2, 0x3ffff, K051316Callback, 4, 0); - K051316SetOffset(0, -104, -16); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - konamiExit(); - ZetExit(); - - BurnYM2151Exit(); - UPD7759Exit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000); - } - - K052109UpdateScroll(); - - if (k88games_priority) - { - K052109RenderLayer(0, 1, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 1); - K052109RenderLayer(2, 0, DrvGfxROMExp0); - K052109RenderLayer(1, 0, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 0); - K051316_zoom_draw(0, 4); - } - else - { - K052109RenderLayer(2, 1, DrvGfxROMExp0); - K051316_zoom_draw(0, 4); - K051960SpritesRender(DrvGfxROMExp1, 0); - K052109RenderLayer(1, 0, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 1); - K052109RenderLayer(0, 0, DrvGfxROMExp0); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - konamiNewFrame(); - ZetNewFrame(); - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 100; - INT32 nCyclesTotal[2] = { (((3000000 / 60) * 133) / 100) /* 33% overclock */, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetOpen(0); - konamiOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - - nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); - - nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); - - nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - UPD7759Update(0, pSoundBuf, nSegmentLength); - UPD7759Update(1, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K052109_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - UPD7759Update(0, pSoundBuf, nSegmentLength); - UPD7759Update(1, pSoundBuf, nSegmentLength); - } - } - - konamiClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - UPD7759Scan(0, nAction, pnMin); - UPD7759Scan(0, nAction, pnMin); - - KonamiICScan(nAction); - - SCAN_VAR(videobank); - SCAN_VAR(zoomreadroms); - SCAN_VAR(k88games_priority); - SCAN_VAR(UPD7759Device); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - games88_set_lines(nDrvBank[0]); - konamiClose(); - } - - return 0; -} - - -// '88 Games - -static struct BurnRomInfo games88RomDesc[] = { - { "861m01.k18", 0x08000, 0x4a4e2959, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Cpu - { "861m02.k16", 0x10000, 0xe19f15f6, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "861d01.d9", 0x08000, 0x0ff1dec0, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "861a08.a", 0x10000, 0x77a00dd6, 3 | BRF_GRA }, // 3 K052109 Tiles - { "861a08.c", 0x10000, 0xb422edfc, 3 | BRF_GRA }, // 4 - { "861a08.b", 0x10000, 0x28a8304f, 3 | BRF_GRA }, // 5 - { "861a08.d", 0x10000, 0xe01a3802, 3 | BRF_GRA }, // 6 - { "861a09.a", 0x10000, 0xdf8917b6, 3 | BRF_GRA }, // 7 - { "861a09.c", 0x10000, 0xf577b88f, 3 | BRF_GRA }, // 8 - { "861a09.b", 0x10000, 0x4917158d, 3 | BRF_GRA }, // 9 - { "861a09.d", 0x10000, 0x2bb3282c, 3 | BRF_GRA }, // 10 - - { "861a05.a", 0x10000, 0xcedc19d0, 4 | BRF_GRA }, // 11 K051960 Tiles - { "861a05.e", 0x10000, 0x725af3fc, 4 | BRF_GRA }, // 12 - { "861a05.b", 0x10000, 0xdb2a8808, 4 | BRF_GRA }, // 13 - { "861a05.f", 0x10000, 0x32d830ca, 4 | BRF_GRA }, // 14 - { "861a05.c", 0x10000, 0xcf03c449, 4 | BRF_GRA }, // 15 - { "861a05.g", 0x10000, 0xfd51c4ea, 4 | BRF_GRA }, // 16 - { "861a05.d", 0x10000, 0x97d78c77, 4 | BRF_GRA }, // 17 - { "861a05.h", 0x10000, 0x60d0c8a5, 4 | BRF_GRA }, // 18 - { "861a06.a", 0x10000, 0x85e2e30e, 4 | BRF_GRA }, // 19 - { "861a06.e", 0x10000, 0x6f96651c, 4 | BRF_GRA }, // 20 - { "861a06.b", 0x10000, 0xce17eaf0, 4 | BRF_GRA }, // 21 - { "861a06.f", 0x10000, 0x88310bf3, 4 | BRF_GRA }, // 22 - { "861a06.c", 0x10000, 0xa568b34e, 4 | BRF_GRA }, // 23 - { "861a06.g", 0x10000, 0x4a55beb3, 4 | BRF_GRA }, // 24 - { "861a06.d", 0x10000, 0xbc70ab39, 4 | BRF_GRA }, // 25 - { "861a06.h", 0x10000, 0xd906b79b, 4 | BRF_GRA }, // 26 - - { "861a04.a", 0x10000, 0x092a8b15, 5 | BRF_GRA }, // 27 K051316 Tiles - { "861a04.b", 0x10000, 0x75744b56, 5 | BRF_GRA }, // 28 - { "861a04.c", 0x10000, 0xa00021c5, 5 | BRF_GRA }, // 29 - { "861a04.d", 0x10000, 0xd208304c, 5 | BRF_GRA }, // 30 - - { "861a07.a", 0x10000, 0x5d035d69, 6 | BRF_SND }, // 31 UPD7759 #0 Samples - { "861a07.b", 0x10000, 0x6337dd91, 6 | BRF_SND }, // 32 - - { "861a07.c", 0x10000, 0x5067a38b, 7 | BRF_SND }, // 33 UPD7759 #1 Samples - { "861a07.d", 0x10000, 0x86731451, 7 | BRF_SND }, // 34 - - { "861.g3", 0x00100, 0x429785db, 0 | BRF_OPT }, // 31 Priority Prom -}; - -STD_ROM_PICK(games88) -STD_ROM_FN(games88) - -struct BurnDriver BurnDrvgames88 = { - "88games", NULL, NULL, NULL, "1988", - "'88 Games\0", NULL, "Konami", "GX861", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, games88RomInfo, games88RomName, NULL, NULL, games88InputInfo, games88DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 304, 224, 4, 3 -}; - - -// Konami '88 - -static struct BurnRomInfo konami88RomDesc[] = { - { "861.e03", 0x08000, 0x55979bd9, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Cpu - { "861.e02", 0x10000, 0x5b7e98a6, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "861d01.d9", 0x08000, 0x0ff1dec0, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "861a08.a", 0x10000, 0x77a00dd6, 3 | BRF_GRA }, // 3 K052109 Tiles - { "861a08.c", 0x10000, 0xb422edfc, 3 | BRF_GRA }, // 4 - { "861a08.b", 0x10000, 0x28a8304f, 3 | BRF_GRA }, // 5 - { "861a08.d", 0x10000, 0xe01a3802, 3 | BRF_GRA }, // 6 - { "861a09.a", 0x10000, 0xdf8917b6, 3 | BRF_GRA }, // 7 - { "861a09.c", 0x10000, 0xf577b88f, 3 | BRF_GRA }, // 8 - { "861a09.b", 0x10000, 0x4917158d, 3 | BRF_GRA }, // 9 - { "861a09.d", 0x10000, 0x2bb3282c, 3 | BRF_GRA }, // 10 - - { "861a05.a", 0x10000, 0xcedc19d0, 4 | BRF_GRA }, // 11 K051960 Tiles - { "861a05.e", 0x10000, 0x725af3fc, 4 | BRF_GRA }, // 12 - { "861a05.b", 0x10000, 0xdb2a8808, 4 | BRF_GRA }, // 13 - { "861a05.f", 0x10000, 0x32d830ca, 4 | BRF_GRA }, // 14 - { "861a05.c", 0x10000, 0xcf03c449, 4 | BRF_GRA }, // 15 - { "861a05.g", 0x10000, 0xfd51c4ea, 4 | BRF_GRA }, // 16 - { "861a05.d", 0x10000, 0x97d78c77, 4 | BRF_GRA }, // 17 - { "861a05.h", 0x10000, 0x60d0c8a5, 4 | BRF_GRA }, // 18 - { "861a06.a", 0x10000, 0x85e2e30e, 4 | BRF_GRA }, // 19 - { "861a06.e", 0x10000, 0x6f96651c, 4 | BRF_GRA }, // 20 - { "861a06.b", 0x10000, 0xce17eaf0, 4 | BRF_GRA }, // 21 - { "861a06.f", 0x10000, 0x88310bf3, 4 | BRF_GRA }, // 22 - { "861a06.c", 0x10000, 0xa568b34e, 4 | BRF_GRA }, // 23 - { "861a06.g", 0x10000, 0x4a55beb3, 4 | BRF_GRA }, // 24 - { "861a06.d", 0x10000, 0xbc70ab39, 4 | BRF_GRA }, // 25 - { "861a06.h", 0x10000, 0xd906b79b, 4 | BRF_GRA }, // 26 - - { "861a04.a", 0x10000, 0x092a8b15, 5 | BRF_GRA }, // 27 K051316 Tiles - { "861a04.b", 0x10000, 0x75744b56, 5 | BRF_GRA }, // 28 - { "861a04.c", 0x10000, 0xa00021c5, 5 | BRF_GRA }, // 29 - { "861a04.d", 0x10000, 0xd208304c, 5 | BRF_GRA }, // 30 - - { "861a07.a", 0x10000, 0x5d035d69, 6 | BRF_SND }, // 31 UPD7759 #0 Samples - { "861a07.b", 0x10000, 0x6337dd91, 6 | BRF_SND }, // 32 - - { "861a07.c", 0x10000, 0x5067a38b, 7 | BRF_SND }, // 33 UPD7759 #1 Samples - { "861a07.d", 0x10000, 0x86731451, 7 | BRF_SND }, // 34 - - { "861.g3", 0x00100, 0x429785db, 0 | BRF_OPT }, // 31 Priority Prom -}; - -STD_ROM_PICK(konami88) -STD_ROM_FN(konami88) - -struct BurnDriver BurnDrvKonami88 = { - "konami88", "88games", NULL, NULL, "1988", - "Konami '88\0", NULL, "Konami", "GX861", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, konami88RomInfo, konami88RomName, NULL, NULL, games88InputInfo, games88DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 304, 224, 4, 3 -}; - - -// Hyper Sports Special (Japan) - -static struct BurnRomInfo hypsptspRomDesc[] = { - { "861f03.k18", 0x08000, 0x8c61aebd, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Cpu - { "861f02.k16", 0x10000, 0xd2460c28, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "861d01.d9", 0x08000, 0x0ff1dec0, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "861a08.a", 0x10000, 0x77a00dd6, 3 | BRF_GRA }, // 3 K052109 Tiles - { "861a08.c", 0x10000, 0xb422edfc, 3 | BRF_GRA }, // 4 - { "861a08.b", 0x10000, 0x28a8304f, 3 | BRF_GRA }, // 5 - { "861a08.d", 0x10000, 0xe01a3802, 3 | BRF_GRA }, // 6 - { "861a09.a", 0x10000, 0xdf8917b6, 3 | BRF_GRA }, // 7 - { "861a09.c", 0x10000, 0xf577b88f, 3 | BRF_GRA }, // 8 - { "861a09.b", 0x10000, 0x4917158d, 3 | BRF_GRA }, // 9 - { "861a09.d", 0x10000, 0x2bb3282c, 3 | BRF_GRA }, // 10 - - { "861a05.a", 0x10000, 0xcedc19d0, 4 | BRF_GRA }, // 11 K051960 Tiles - { "861a05.e", 0x10000, 0x725af3fc, 4 | BRF_GRA }, // 12 - { "861a05.b", 0x10000, 0xdb2a8808, 4 | BRF_GRA }, // 13 - { "861a05.f", 0x10000, 0x32d830ca, 4 | BRF_GRA }, // 14 - { "861a05.c", 0x10000, 0xcf03c449, 4 | BRF_GRA }, // 15 - { "861a05.g", 0x10000, 0xfd51c4ea, 4 | BRF_GRA }, // 16 - { "861a05.d", 0x10000, 0x97d78c77, 4 | BRF_GRA }, // 17 - { "861a05.h", 0x10000, 0x60d0c8a5, 4 | BRF_GRA }, // 18 - { "861a06.a", 0x10000, 0x85e2e30e, 4 | BRF_GRA }, // 19 - { "861a06.e", 0x10000, 0x6f96651c, 4 | BRF_GRA }, // 20 - { "861a06.b", 0x10000, 0xce17eaf0, 4 | BRF_GRA }, // 21 - { "861a06.f", 0x10000, 0x88310bf3, 4 | BRF_GRA }, // 22 - { "861a06.c", 0x10000, 0xa568b34e, 4 | BRF_GRA }, // 23 - { "861a06.g", 0x10000, 0x4a55beb3, 4 | BRF_GRA }, // 24 - { "861a06.d", 0x10000, 0xbc70ab39, 4 | BRF_GRA }, // 25 - { "861a06.h", 0x10000, 0xd906b79b, 4 | BRF_GRA }, // 26 - - { "861a04.a", 0x10000, 0x092a8b15, 5 | BRF_GRA }, // 27 K051316 Tiles - { "861a04.b", 0x10000, 0x75744b56, 5 | BRF_GRA }, // 28 - { "861a04.c", 0x10000, 0xa00021c5, 5 | BRF_GRA }, // 29 - { "861a04.d", 0x10000, 0xd208304c, 5 | BRF_GRA }, // 30 - - { "861a07.a", 0x10000, 0x5d035d69, 6 | BRF_SND }, // 31 UPD7759 #0 Samples - { "861a07.b", 0x10000, 0x6337dd91, 6 | BRF_SND }, // 32 - - { "861a07.c", 0x10000, 0x5067a38b, 7 | BRF_SND }, // 33 UPD7759 #1 Samples - { "861a07.d", 0x10000, 0x86731451, 7 | BRF_SND }, // 34 - - { "861.g3", 0x00100, 0x429785db, 8 | BRF_OPT }, // 31 Priority Prom -}; - -STD_ROM_PICK(hypsptsp) -STD_ROM_FN(hypsptsp) - -struct BurnDriver BurnDrvHypsptsp = { - "hypsptsp", "88games", NULL, NULL, "1988", - "Hyper Sports Special (Japan)\0", NULL, "Konami", "GX861", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, hypsptspRomInfo, hypsptspRomName, NULL, NULL, games88InputInfo, games88DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 304, 224, 4, 3 -}; +// FB Alpha '88 Games driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" +#include "upd7759.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvGfxROMExp2; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *DrvBankRAM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvNVRAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *nDrvBank; + +static INT32 videobank; +static INT32 zoomreadroms; +static INT32 k88games_priority; +static INT32 UPD7759Device; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo games88InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 3, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"P3 Start", BIT_DIGITAL, DrvJoy3 + 3, "p3 start" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, DrvJoy3 + 2, "p3 fire 3" }, + + {"P4 Start", BIT_DIGITAL, DrvJoy3 + 7, "p4 start" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p4 fire 2" }, + {"P4 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p4 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(games88) + +static struct BurnDIPInfo games88DIPList[]= +{ + {0x14, 0xff, 0xff, 0xf0, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0x7b, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x10, 0x10, "Off" }, +// {0x14, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "World Records" }, + {0x14, 0x01, 0x20, 0x20, "Don't Erase" }, + {0x14, 0x01, 0x20, 0x00, "Erase on Reset" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x15, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x15, 0x01, 0xf0, 0x00, "No Coin B" }, + +// {0 , 0xfe, 0 , 4, "Cabinet" }, +// {0x16, 0x01, 0x06, 0x06, "Cocktail" }, +// {0x16, 0x01, 0x06, 0x04, "Cocktail (A)" }, +// {0x16, 0x01, 0x06, 0x02, "Upright" }, +// {0x16, 0x01, 0x06, 0x00, "Upright (D)" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x60, 0x60, "Easy" }, + {0x16, 0x01, 0x60, 0x40, "Normal" }, + {0x16, 0x01, 0x60, 0x20, "Hard" }, + {0x16, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(games88) + +void games88_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x5f84: + zoomreadroms = data & 0x04; + return; + + case 0x5f88: + // watchdog + return; + + case 0x5f8c: + *soundlatch = data; + return; + + case 0x5f90: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + } + + if ((address & 0xf800) == 0x3800) + { + if (videobank) + DrvBankRAM[address & 0x7ff] = data; + else + K051316Write(0, address & 0x7ff, data); + + return; + } + + if ((address & 0xfff0) == 0x5fc0) { + K051316WriteCtrl(0, address & 0x0f, data); + return; + } + + if ((address & 0xc000) == 0x4000) { + K052109_051960_w(address & 0x3fff, data); + return; + } +} + +UINT8 games88_main_read(UINT16 address) +{ + switch (address) + { + case 0x5f94: + return (DrvInputs[0] & 0x0f) | (DrvDips[0] & 0xf0); + + case 0x5f95: + return DrvInputs[1]; + + case 0x5f96: + return DrvInputs[2]; + + case 0x5f97: + return DrvDips[1]; + + case 0x5f9b: + return DrvDips[2]; + } + + if ((address & 0xf800) == 0x3800) + { + if (videobank) { + return DrvBankRAM[address & 0x7ff]; + } else { + if (zoomreadroms) { + return K051316ReadRom(0, address & 0x7ff); // k051316_rom_0 + } else { + return K051316Read(0, address & 0x7ff); // k051316_0 + } + } + } + + if ((address & 0xc000) == 0x4000) { + return K052109_051960_r(address & 0x3fff); + } + + return 0; +} + +void __fastcall games88_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x9000: + UPD7759PortWrite(UPD7759Device, data); + return; + + case 0xc000: + BurnYM2151SelectRegister(data); + return; + + case 0xc001: + BurnYM2151WriteRegister(data); + return; + + case 0xe000: + UPD7759Device = (data & 4) >> 2; + UPD7759ResetWrite(UPD7759Device, data & 2); + UPD7759StartWrite(UPD7759Device, data & 1); + return; + } +} + +UINT8 __fastcall games88_sound_read(UINT16 address) +{ + switch (address) + { + case 0xa000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0xc000: + case 0xc001: + return BurnYM2151ReadStatus(); + } + + return 0; +} + +static void games88_set_lines(INT32 lines) +{ + nDrvBank[0] = lines; + + INT32 nBank = 0x10000 + (lines & 0x07) * 0x2000; + + konamiMapMemory(DrvKonROM + nBank, 0x0000, 0x0fff, KON_ROM); + + if (lines & 8) { + konamiMapMemory(DrvPalRAM, 0x1000, 0x1fff, KON_RAM); + } else { + konamiMapMemory(DrvKonROM + nBank + 0x1000, 0x1000, 0x1fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x0000, 0x1000, 0x1fff, KON_WRITE); // unmap writes + } + + videobank = lines & 0x10; + K052109RMRDLine = lines & 0x20; + k88games_priority = lines & 0x80; +} + +static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + INT32 layer_colorbase[3] = { 64, 0, 16 }; + + *code |= ((*color & 0x0f) << 8) | (bank << 12); + *color = layer_colorbase[layer] + ((*color & 0xf0) >> 4); +} + +static void K051960Callback(INT32 *, INT32 *color, INT32 *priority, INT32 *) +{ + *priority = (*color & 0x20) >> 5; + *color = 32 + (*color & 0x0f); +} + +static void K051316Callback(INT32 *code,INT32 *color,INT32 *flags) +{ + *flags = *color & 0x40; + *code |= ((*color & 0x07) << 8); + *color = 48 + ((*color & 0x38) >> 3) + ((*color & 0x80) >> 4); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + UPD7759Reset(); + + videobank = 0; + zoomreadroms = 0; + k88games_priority = 0; + UPD7759Device = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x020000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x080000; + DrvGfxROM1 = Next; Next += 0x100000; + DrvGfxROM2 = Next; Next += 0x040000; + DrvGfxROMExp0 = Next; Next += 0x100000; + DrvGfxROMExp1 = Next; Next += 0x200000; + DrvGfxROMExp2 = Next; Next += 0x080000; + + DrvSndROM0 = Next; Next += 0x020000; + DrvSndROM1 = Next; Next += 0x020000; + + DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + + AllRam = Next; + + DrvBankRAM = Next; Next += 0x000800; + DrvKonRAM = Next; Next += 0x001000; + DrvPalRAM = Next; Next += 0x001000; + DrvNVRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + nDrvBank = Next; Next += 0x000002; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs0[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x080000); + konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); + + GfxDecode(0x04000, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x100, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x02000, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvKonROM + 0x008000, 0, 1)) return 1; + if (BurnLoadRom(DrvKonROM + 0x010000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x020000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x020001, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040001, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060000, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060001, 10, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 11, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020001, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 15, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040001, 16, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060000, 17, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060001, 18, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 19, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080001, 20, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0a0000, 21, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0a0001, 22, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 23, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 24, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0e0000, 25, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0e0001, 26, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 27, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x010000, 28, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x020000, 29, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x030000, 30, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 31, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x010000, 32, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x000000, 33, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x010000, 34, 1)) return 1; + + DrvGfxDecode(); + } + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvPalRAM + 0x0000, 0x1000, 0x1fff, KON_RAM); + konamiMapMemory(DrvKonRAM, 0x2000, 0x2fff, KON_RAM); + konamiMapMemory(DrvNVRAM, 0x3000, 0x37ff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x8000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(games88_main_write); + konamiSetReadHandler(games88_main_read); + konamiSetlinesCallback(games88_set_lines); + konamiClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(games88_sound_write); + ZetSetReadHandler(games88_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetAllRoutes(0.75, BURN_SND_ROUTE_BOTH); + + UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvSndROM0); + UPD7759Init(1, UPD7759_STANDARD_CLOCK, DrvSndROM1); + UPD7759SetRoute(0, 0.30, BURN_SND_ROUTE_BOTH); + UPD7759SetRoute(1, 0.30, BURN_SND_ROUTE_BOTH); + + K052109Init(DrvGfxROM0, 0x7ffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(0, 0); + + K051960Init(DrvGfxROM1, 0xfffff); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(0, 0); + + K051316Init(0, DrvGfxROM2, DrvGfxROMExp2, 0x3ffff, K051316Callback, 4, 0); + K051316SetOffset(0, -104, -16); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + konamiExit(); + ZetExit(); + + BurnYM2151Exit(); + UPD7759Exit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000); + } + + K052109UpdateScroll(); + + if (k88games_priority) + { + K052109RenderLayer(0, 1, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 1); + K052109RenderLayer(2, 0, DrvGfxROMExp0); + K052109RenderLayer(1, 0, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 0); + K051316_zoom_draw(0, 4); + } + else + { + K052109RenderLayer(2, 1, DrvGfxROMExp0); + K051316_zoom_draw(0, 4); + K051960SpritesRender(DrvGfxROMExp1, 0); + K052109RenderLayer(1, 0, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 1); + K052109RenderLayer(0, 0, DrvGfxROMExp0); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + konamiNewFrame(); + ZetNewFrame(); + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 100; + INT32 nCyclesTotal[2] = { (((3000000 / 60) * 133) / 100) /* 33% overclock */, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetOpen(0); + konamiOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + + nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); + + nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); + + nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + UPD7759Update(0, pSoundBuf, nSegmentLength); + UPD7759Update(1, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K052109_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + UPD7759Update(0, pSoundBuf, nSegmentLength); + UPD7759Update(1, pSoundBuf, nSegmentLength); + } + } + + konamiClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + UPD7759Scan(0, nAction, pnMin); + UPD7759Scan(0, nAction, pnMin); + + KonamiICScan(nAction); + + SCAN_VAR(videobank); + SCAN_VAR(zoomreadroms); + SCAN_VAR(k88games_priority); + SCAN_VAR(UPD7759Device); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + games88_set_lines(nDrvBank[0]); + konamiClose(); + } + + return 0; +} + + +// '88 Games + +static struct BurnRomInfo games88RomDesc[] = { + { "861m01.k18", 0x08000, 0x4a4e2959, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Cpu + { "861m02.k16", 0x10000, 0xe19f15f6, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "861d01.d9", 0x08000, 0x0ff1dec0, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "861a08.a", 0x10000, 0x77a00dd6, 3 | BRF_GRA }, // 3 K052109 Tiles + { "861a08.c", 0x10000, 0xb422edfc, 3 | BRF_GRA }, // 4 + { "861a08.b", 0x10000, 0x28a8304f, 3 | BRF_GRA }, // 5 + { "861a08.d", 0x10000, 0xe01a3802, 3 | BRF_GRA }, // 6 + { "861a09.a", 0x10000, 0xdf8917b6, 3 | BRF_GRA }, // 7 + { "861a09.c", 0x10000, 0xf577b88f, 3 | BRF_GRA }, // 8 + { "861a09.b", 0x10000, 0x4917158d, 3 | BRF_GRA }, // 9 + { "861a09.d", 0x10000, 0x2bb3282c, 3 | BRF_GRA }, // 10 + + { "861a05.a", 0x10000, 0xcedc19d0, 4 | BRF_GRA }, // 11 K051960 Tiles + { "861a05.e", 0x10000, 0x725af3fc, 4 | BRF_GRA }, // 12 + { "861a05.b", 0x10000, 0xdb2a8808, 4 | BRF_GRA }, // 13 + { "861a05.f", 0x10000, 0x32d830ca, 4 | BRF_GRA }, // 14 + { "861a05.c", 0x10000, 0xcf03c449, 4 | BRF_GRA }, // 15 + { "861a05.g", 0x10000, 0xfd51c4ea, 4 | BRF_GRA }, // 16 + { "861a05.d", 0x10000, 0x97d78c77, 4 | BRF_GRA }, // 17 + { "861a05.h", 0x10000, 0x60d0c8a5, 4 | BRF_GRA }, // 18 + { "861a06.a", 0x10000, 0x85e2e30e, 4 | BRF_GRA }, // 19 + { "861a06.e", 0x10000, 0x6f96651c, 4 | BRF_GRA }, // 20 + { "861a06.b", 0x10000, 0xce17eaf0, 4 | BRF_GRA }, // 21 + { "861a06.f", 0x10000, 0x88310bf3, 4 | BRF_GRA }, // 22 + { "861a06.c", 0x10000, 0xa568b34e, 4 | BRF_GRA }, // 23 + { "861a06.g", 0x10000, 0x4a55beb3, 4 | BRF_GRA }, // 24 + { "861a06.d", 0x10000, 0xbc70ab39, 4 | BRF_GRA }, // 25 + { "861a06.h", 0x10000, 0xd906b79b, 4 | BRF_GRA }, // 26 + + { "861a04.a", 0x10000, 0x092a8b15, 5 | BRF_GRA }, // 27 K051316 Tiles + { "861a04.b", 0x10000, 0x75744b56, 5 | BRF_GRA }, // 28 + { "861a04.c", 0x10000, 0xa00021c5, 5 | BRF_GRA }, // 29 + { "861a04.d", 0x10000, 0xd208304c, 5 | BRF_GRA }, // 30 + + { "861a07.a", 0x10000, 0x5d035d69, 6 | BRF_SND }, // 31 UPD7759 #0 Samples + { "861a07.b", 0x10000, 0x6337dd91, 6 | BRF_SND }, // 32 + + { "861a07.c", 0x10000, 0x5067a38b, 7 | BRF_SND }, // 33 UPD7759 #1 Samples + { "861a07.d", 0x10000, 0x86731451, 7 | BRF_SND }, // 34 + + { "861.g3", 0x00100, 0x429785db, 0 | BRF_OPT }, // 31 Priority Prom +}; + +STD_ROM_PICK(games88) +STD_ROM_FN(games88) + +struct BurnDriver BurnDrvgames88 = { + "88games", NULL, NULL, NULL, "1988", + "'88 Games\0", NULL, "Konami", "GX861", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, games88RomInfo, games88RomName, NULL, NULL, games88InputInfo, games88DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 304, 224, 4, 3 +}; + + +// Konami '88 + +static struct BurnRomInfo konami88RomDesc[] = { + { "861.e03", 0x08000, 0x55979bd9, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Cpu + { "861.e02", 0x10000, 0x5b7e98a6, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "861d01.d9", 0x08000, 0x0ff1dec0, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "861a08.a", 0x10000, 0x77a00dd6, 3 | BRF_GRA }, // 3 K052109 Tiles + { "861a08.c", 0x10000, 0xb422edfc, 3 | BRF_GRA }, // 4 + { "861a08.b", 0x10000, 0x28a8304f, 3 | BRF_GRA }, // 5 + { "861a08.d", 0x10000, 0xe01a3802, 3 | BRF_GRA }, // 6 + { "861a09.a", 0x10000, 0xdf8917b6, 3 | BRF_GRA }, // 7 + { "861a09.c", 0x10000, 0xf577b88f, 3 | BRF_GRA }, // 8 + { "861a09.b", 0x10000, 0x4917158d, 3 | BRF_GRA }, // 9 + { "861a09.d", 0x10000, 0x2bb3282c, 3 | BRF_GRA }, // 10 + + { "861a05.a", 0x10000, 0xcedc19d0, 4 | BRF_GRA }, // 11 K051960 Tiles + { "861a05.e", 0x10000, 0x725af3fc, 4 | BRF_GRA }, // 12 + { "861a05.b", 0x10000, 0xdb2a8808, 4 | BRF_GRA }, // 13 + { "861a05.f", 0x10000, 0x32d830ca, 4 | BRF_GRA }, // 14 + { "861a05.c", 0x10000, 0xcf03c449, 4 | BRF_GRA }, // 15 + { "861a05.g", 0x10000, 0xfd51c4ea, 4 | BRF_GRA }, // 16 + { "861a05.d", 0x10000, 0x97d78c77, 4 | BRF_GRA }, // 17 + { "861a05.h", 0x10000, 0x60d0c8a5, 4 | BRF_GRA }, // 18 + { "861a06.a", 0x10000, 0x85e2e30e, 4 | BRF_GRA }, // 19 + { "861a06.e", 0x10000, 0x6f96651c, 4 | BRF_GRA }, // 20 + { "861a06.b", 0x10000, 0xce17eaf0, 4 | BRF_GRA }, // 21 + { "861a06.f", 0x10000, 0x88310bf3, 4 | BRF_GRA }, // 22 + { "861a06.c", 0x10000, 0xa568b34e, 4 | BRF_GRA }, // 23 + { "861a06.g", 0x10000, 0x4a55beb3, 4 | BRF_GRA }, // 24 + { "861a06.d", 0x10000, 0xbc70ab39, 4 | BRF_GRA }, // 25 + { "861a06.h", 0x10000, 0xd906b79b, 4 | BRF_GRA }, // 26 + + { "861a04.a", 0x10000, 0x092a8b15, 5 | BRF_GRA }, // 27 K051316 Tiles + { "861a04.b", 0x10000, 0x75744b56, 5 | BRF_GRA }, // 28 + { "861a04.c", 0x10000, 0xa00021c5, 5 | BRF_GRA }, // 29 + { "861a04.d", 0x10000, 0xd208304c, 5 | BRF_GRA }, // 30 + + { "861a07.a", 0x10000, 0x5d035d69, 6 | BRF_SND }, // 31 UPD7759 #0 Samples + { "861a07.b", 0x10000, 0x6337dd91, 6 | BRF_SND }, // 32 + + { "861a07.c", 0x10000, 0x5067a38b, 7 | BRF_SND }, // 33 UPD7759 #1 Samples + { "861a07.d", 0x10000, 0x86731451, 7 | BRF_SND }, // 34 + + { "861.g3", 0x00100, 0x429785db, 0 | BRF_OPT }, // 31 Priority Prom +}; + +STD_ROM_PICK(konami88) +STD_ROM_FN(konami88) + +struct BurnDriver BurnDrvKonami88 = { + "konami88", "88games", NULL, NULL, "1988", + "Konami '88\0", NULL, "Konami", "GX861", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, konami88RomInfo, konami88RomName, NULL, NULL, games88InputInfo, games88DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 304, 224, 4, 3 +}; + + +// Hyper Sports Special (Japan) + +static struct BurnRomInfo hypsptspRomDesc[] = { + { "861f03.k18", 0x08000, 0x8c61aebd, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Cpu + { "861f02.k16", 0x10000, 0xd2460c28, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "861d01.d9", 0x08000, 0x0ff1dec0, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "861a08.a", 0x10000, 0x77a00dd6, 3 | BRF_GRA }, // 3 K052109 Tiles + { "861a08.c", 0x10000, 0xb422edfc, 3 | BRF_GRA }, // 4 + { "861a08.b", 0x10000, 0x28a8304f, 3 | BRF_GRA }, // 5 + { "861a08.d", 0x10000, 0xe01a3802, 3 | BRF_GRA }, // 6 + { "861a09.a", 0x10000, 0xdf8917b6, 3 | BRF_GRA }, // 7 + { "861a09.c", 0x10000, 0xf577b88f, 3 | BRF_GRA }, // 8 + { "861a09.b", 0x10000, 0x4917158d, 3 | BRF_GRA }, // 9 + { "861a09.d", 0x10000, 0x2bb3282c, 3 | BRF_GRA }, // 10 + + { "861a05.a", 0x10000, 0xcedc19d0, 4 | BRF_GRA }, // 11 K051960 Tiles + { "861a05.e", 0x10000, 0x725af3fc, 4 | BRF_GRA }, // 12 + { "861a05.b", 0x10000, 0xdb2a8808, 4 | BRF_GRA }, // 13 + { "861a05.f", 0x10000, 0x32d830ca, 4 | BRF_GRA }, // 14 + { "861a05.c", 0x10000, 0xcf03c449, 4 | BRF_GRA }, // 15 + { "861a05.g", 0x10000, 0xfd51c4ea, 4 | BRF_GRA }, // 16 + { "861a05.d", 0x10000, 0x97d78c77, 4 | BRF_GRA }, // 17 + { "861a05.h", 0x10000, 0x60d0c8a5, 4 | BRF_GRA }, // 18 + { "861a06.a", 0x10000, 0x85e2e30e, 4 | BRF_GRA }, // 19 + { "861a06.e", 0x10000, 0x6f96651c, 4 | BRF_GRA }, // 20 + { "861a06.b", 0x10000, 0xce17eaf0, 4 | BRF_GRA }, // 21 + { "861a06.f", 0x10000, 0x88310bf3, 4 | BRF_GRA }, // 22 + { "861a06.c", 0x10000, 0xa568b34e, 4 | BRF_GRA }, // 23 + { "861a06.g", 0x10000, 0x4a55beb3, 4 | BRF_GRA }, // 24 + { "861a06.d", 0x10000, 0xbc70ab39, 4 | BRF_GRA }, // 25 + { "861a06.h", 0x10000, 0xd906b79b, 4 | BRF_GRA }, // 26 + + { "861a04.a", 0x10000, 0x092a8b15, 5 | BRF_GRA }, // 27 K051316 Tiles + { "861a04.b", 0x10000, 0x75744b56, 5 | BRF_GRA }, // 28 + { "861a04.c", 0x10000, 0xa00021c5, 5 | BRF_GRA }, // 29 + { "861a04.d", 0x10000, 0xd208304c, 5 | BRF_GRA }, // 30 + + { "861a07.a", 0x10000, 0x5d035d69, 6 | BRF_SND }, // 31 UPD7759 #0 Samples + { "861a07.b", 0x10000, 0x6337dd91, 6 | BRF_SND }, // 32 + + { "861a07.c", 0x10000, 0x5067a38b, 7 | BRF_SND }, // 33 UPD7759 #1 Samples + { "861a07.d", 0x10000, 0x86731451, 7 | BRF_SND }, // 34 + + { "861.g3", 0x00100, 0x429785db, 8 | BRF_OPT }, // 31 Priority Prom +}; + +STD_ROM_PICK(hypsptsp) +STD_ROM_FN(hypsptsp) + +struct BurnDriver BurnDrvHypsptsp = { + "hypsptsp", "88games", NULL, NULL, "1988", + "Hyper Sports Special (Japan)\0", NULL, "Konami", "GX861", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, hypsptspRomInfo, hypsptspRomName, NULL, NULL, games88InputInfo, games88DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 304, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_ajax.cpp b/src/burn/drv/konami/d_ajax.cpp index 81f0e2116..6cf977f30 100644 --- a/src/burn/drv/konami/d_ajax.cpp +++ b/src/burn/drv/konami/d_ajax.cpp @@ -1,943 +1,942 @@ -// FB Alpha Ajax driver module -// Based on MAME driver by Manuel Abadia - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" -#include "k007232.h" -#include "m6809_intf.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvM6809ROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *DrvShareRAM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *nDrvBankRom; - -static UINT8 DrvInputs[3]; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvReset; - -static INT32 firq_enable; -static INT32 ajax_priority; - -static struct BurnInputInfo AjaxInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Ajax) - -static struct BurnDIPInfo AjaxDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x52, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x14, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15, "Coin B" }, - {0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x14, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x14, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x14, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x03, "2" }, - {0x15, 0x01, 0x03, 0x02, "3" }, - {0x15, 0x01, 0x03, 0x01, "5" }, - {0x15, 0x01, 0x03, 0x00, "7" }, - -// {0 , 0xfe, 0 , 2, "Cabinet" }, -// {0x15, 0x01, 0x04, 0x00, "Upright" }, -// {0x15, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x15, 0x01, 0x18, 0x18, "30000 150000" }, - {0x15, 0x01, 0x18, 0x10, "50000 200000" }, - {0x15, 0x01, 0x18, 0x08, "30000" }, - {0x15, 0x01, 0x18, 0x00, "50000" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Normal" }, - {0x15, 0x01, 0x60, 0x20, "Difficult" }, - {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x16, 0x01, 0x01, 0x01, "Off" }, -// {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Upright Controls" }, - {0x16, 0x01, 0x02, 0x02, "Single" }, - {0x16, 0x01, 0x02, 0x00, "Dual" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Control in 3D Stages" }, - {0x16, 0x01, 0x08, 0x08, "Normal" }, - {0x16, 0x01, 0x08, 0x00, "Inverted" }, -}; - -STDDIPINFO(Ajax) - -static void ajax_main_bankswitch(INT32 data) -{ - nDrvBankRom[0] = data; - - INT32 nBank = 0x10000 + ((data & 0x80) << 9) + ((data & 7) << 13); - - ajax_priority = data & 0x08; - - konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); -} - -void ajax_main_write(UINT16 address, UINT8 data) -{ - if (address <= 0x1c0) - { - switch ((address & 0x01c0) >> 6) - { - case 0x0000: - if (address == 0 && firq_enable) { - M6809SetIRQLine(1, M6809_IRQSTATUS_AUTO); - } - break; - - case 0x0001: - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - break; - - case 0x0002: - *soundlatch = data; - break; - - case 0x0003: - ajax_main_bankswitch(data); - break; - } - } - - if ((address & 0xfff8) == 0x0800) { - K051937Write(address & 7, data); - return; - } - - if ((address & 0xfc00) == 0x0c00) { - K051960Write(address & 0x3ff, data); - return; - } -} - -UINT8 ajax_main_read(UINT16 address) -{ - if (address <= 0x01c0) { - switch ((address & 0x1c0) >> 6) - { - case 0x0000: - return konamiTotalCycles() & 0xff; // rand - - case 0x0004: - return DrvInputs[2]; - - case 0x0006: - switch (address & 3) { - case 0: - return DrvInputs[0]; - - case 1: - return DrvInputs[1]; - - case 2: - return DrvDips[0]; - - case 3: - return DrvDips[1]; - } - return 0; - - case 0x0007: - return DrvDips[2]; - } - } - - if ((address & 0xfff8) == 0x0800) { - return K051937Read(address & 7); - } - - if ((address & 0xfc00) == 0x0c00) { - return K051960Read(address & 0x3ff); - } - - return 0; -} - -static void ajax_sub_bankswitch(UINT8 data) -{ - nDrvBankRom[1] = data; - - K052109RMRDLine = data & 0x40; - - K051316WrapEnable(0, data & 0x20); - - firq_enable = data & 0x10; - - INT32 nBank = ((data & 0x0f) << 13) + 0x10000; - M6809MapMemory(DrvM6809ROM + nBank, 0x8000, 0x9fff, M6809_ROM); -} - -void ajax_sub_write(UINT16 address, UINT8 data) -{ - if ((address & 0xf800) == 0x0000) { - K051316Write(0, address & 0x7ff, data); - return; - } - - if ((address & 0xfff0) == 0x0800) { - K051316WriteCtrl(0, address & 0x0f, data); - return; - } - - if (address == 0x1800) { - ajax_sub_bankswitch(data); - return; - } - - if ((address & 0xc000) == 0x4000) { - K052109Write(address & 0x3fff, data); - return; - } -} - -UINT8 ajax_sub_read(UINT16 address) -{ - if ((address & 0xf800) == 0x0000) { - return K051316Read(0, address & 0x7ff); - } - - if ((address & 0xf800) == 0x1000) { - return K051316ReadRom(0, address & 0x7ff); - } - - if ((address & 0xc000) == 0x4000) { - return K052109Read(address & 0x3fff); - } - - return 0; -} - -void __fastcall ajax_sound_write(UINT16 address, UINT8 data) -{ - if ((address & 0xfff0) == 0xa000) { - K007232WriteReg(0, address & 0x0f, data); - return; - } - - if ((address & 0xfff0) == 0xb000) { - K007232WriteReg(1, address & 0x0f, data); - return; - } - - switch (address) - { - case 0x9000: - k007232_set_bank(0, (data >> 1) & 1, (data >> 0) & 1 ); - k007232_set_bank(1, (data >> 4) & 3, (data >> 2) & 3 ); - return; - - case 0xb80c: - K007232SetVolume(1, 0, (data & 0x0f) * 0x11/2, (data & 0x0f) * 0x11/2); - return; - - case 0xc000: - BurnYM2151SelectRegister(data); - return; - - case 0xc001: - BurnYM2151WriteRegister(data); - return; - } -} - -UINT8 __fastcall ajax_sound_read(UINT16 address) -{ - if ((address & 0xfff0) == 0xa000) { - return K007232ReadReg(0, address & 0x0f); - } - - if ((address & 0xfff0) == 0xb000) { - return K007232ReadReg(1, address & 0x0f); - } - - switch (address) - { - case 0xc000: - case 0xc001: - return BurnYM2151ReadStatus(); - - case 0xe000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - INT32 layer_colorbase[3] = { 64, 0, 32 }; - - *code |= ((*color & 0x0f) << 8) | (bank << 12); - *code &= 0x3fff; - *color = layer_colorbase[layer] + ((*color & 0xf0) >> 4); -} - -static void K051960Callback(INT32 *code, INT32 *color,INT32 *priority, INT32 *) -{ - *priority = 0; - if ( *color & 0x10) *priority = 1; - if (~*color & 0x40) *priority = 2; - if ( *color & 0x20) *priority = 3; - *color = 16 + (*color & 0x0f); - *code &= 0x1fff; -} - -static void K051316Callback(INT32 *code,INT32 *color,INT32 *) -{ - *code |= ((*color & 0x07) << 8); - *code &= 0x7ff; - *color = 6 + ((*color & 0x08) >> 3); -} - -static void DrvK007232VolCallback0(INT32 v) -{ - K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); - K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); -} - -static void DrvK007232VolCallback1(INT32 v) -{ - K007232SetVolume(1, 0, (v & 0x0f) * 0x11/2, (v & 0x0f) * 0x11/2); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - M6809Open(0); - M6809Reset(); - M6809Close(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - firq_enable = 0; - ajax_priority = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x030000; - DrvM6809ROM = Next; Next += 0x030000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x080000; - DrvGfxROM1 = Next; Next += 0x100000; - DrvGfxROM2 = Next; Next += 0x080000; - DrvGfxROMExp0 = Next; Next += 0x100000; - DrvGfxROMExp1 = Next; Next += 0x200000; - - DrvSndROM0 = Next; Next += 0x040000; - DrvSndROM1 = Next; Next += 0x080000; - - DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - - AllRam = Next; - - DrvShareRAM = Next; Next += 0x002000; - DrvKonRAM = Next; Next += 0x002000; - DrvPalRAM = Next; Next += 0x001000 + 0x1000; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - nDrvBankRom = Next; Next += 0x000002; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs0[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x080000); - konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); - - GfxDecode(0x04000, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x100, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x02000, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvKonROM + 0x020000, 0, 1)) return 1; - if (BurnLoadRom(DrvKonROM + 0x010000, 1, 1)) return 1; - memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x28000, 0x8000); - - if (BurnLoadRom(DrvM6809ROM + 0x20000, 2, 1)) return 1; - memcpy (DrvM6809ROM + 0xa000, DrvM6809ROM + 0x22000, 0x6000); - if (BurnLoadRom(DrvM6809ROM + 0x10000, 3, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1; - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "ajax") == 0) { - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x020000, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x020001, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040001, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060000, 11, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060001, 12, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 15, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020001, 16, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 17, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040001, 18, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060000, 19, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060001, 20, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 21, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080001, 22, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0a0000, 23, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0a0001, 24, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 25, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 26, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0e0000, 27, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0e0001, 28, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 29, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x040000, 30, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 31, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x010000, 32, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x020000, 33, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x030000, 34, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x000000, 35, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x010000, 36, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x020000, 37, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x030000, 38, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x040000, 39, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x050000, 40, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x060000, 41, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x070000, 42, 1)) return 1; - } else { - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x040000, 10, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 11, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x000000, 12, 1)) return 1; - } - - DrvGfxDecode(); - } - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvPalRAM, 0x1000, 0x1fff, KON_RAM); - konamiMapMemory(DrvShareRAM, 0x2000, 0x3fff, KON_RAM); - konamiMapMemory(DrvKonRAM, 0x4000, 0x5fff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(ajax_main_write); - konamiSetReadHandler(ajax_main_read); - konamiClose(); - - M6809Init(1); - M6809Open(0); - M6809MapMemory(DrvShareRAM, 0x2000, 0x3fff, M6809_RAM); - M6809MapMemory(DrvM6809ROM + 0x10000, 0x8000, 0x9fff, M6809_ROM); - M6809MapMemory(DrvM6809ROM + 0x0a000, 0xa000, 0xffff, M6809_ROM); - M6809SetWriteHandler(ajax_sub_write); - M6809SetReadHandler(ajax_sub_read); - M6809Close(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(ajax_sound_write); - ZetSetReadHandler(ajax_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - K007232Init(0, 3579545, DrvSndROM0, 0x40000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback0); - K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - K007232Init(1, 3579545, DrvSndROM1, 0x80000); - K007232SetPortWriteHandler(1, DrvK007232VolCallback1); - K007232SetRoute(1, BURN_SND_K007232_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - K007232SetRoute(1, BURN_SND_K007232_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - - K052109Init(DrvGfxROM0, 0x7ffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(8, 0); - - K051960Init(DrvGfxROM1, 0xfffff); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(8, 0); - - K051316Init(0, DrvGfxROM2, DrvGfxROM2, 0x7ffff, K051316Callback, 7, 0); - K051316SetOffset(0, -112, -16); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - M6809Exit(); - konamiExit(); - ZetExit(); - - K007232Exit(); - BurnYM2151Exit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000); - } - - K052109UpdateScroll(); - - BurnTransferClear(); - - if (nBurnLayer & 1) K052109RenderLayer(2, 0, DrvGfxROMExp0); - - if (ajax_priority) - { - if (nBurnLayer & 2) K051316_zoom_draw(0, 4); - if (nBurnLayer & 4) K052109RenderLayer(1, 0, DrvGfxROMExp0); - } - else - { - if (nBurnLayer & 4) K052109RenderLayer(1, 0, DrvGfxROMExp0); - if (nBurnLayer & 2) K051316_zoom_draw(0, 4); - } - -// needs work... - if (nSpriteEnable & 1) K051960SpritesRender(DrvGfxROMExp1, 3); - if (nSpriteEnable & 2) K051960SpritesRender(DrvGfxROMExp1, 2); - if (nSpriteEnable & 4) K051960SpritesRender(DrvGfxROMExp1, 1); - if (nSpriteEnable & 8) K051960SpritesRender(DrvGfxROMExp1, 0); - - if (nBurnLayer & 8) K052109RenderLayer(0, 0, DrvGfxROMExp0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; - if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; - } - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 100; - INT32 nCyclesTotal[3] = { (((3000000 / 60) * 133) / 100) /* 33% overclock */, 3000000 / 60, 3579545 / 60 }; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - - ZetOpen(0); - M6809Open(0); - konamiOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); - - nCyclesDone[1] += M6809Run(nSegment - nCyclesDone[1]); - nSegment = (nCyclesTotal[2] / nInterleave) * (i + 1); - - nCyclesDone[2] += ZetRun(nSegment - nCyclesDone[2]); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - K007232Update(1, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K051960_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - K007232Update(1, pSoundBuf, nSegmentLength); - } - } - - konamiClose(); - M6809Close(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - M6809Scan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - K007232Scan(nAction, pnMin); - - KonamiICScan(nAction); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - ajax_main_bankswitch(nDrvBankRom[0]); - konamiClose(); - - M6809Open(0); - ajax_sub_bankswitch(nDrvBankRom[1]); - M6809Close(); - } - - return 0; -} - - -// Ajax - -static struct BurnRomInfo ajaxRomDesc[] = { - { "770_m01.n11", 0x10000, 0x4a64e53a, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "770_l02.n12", 0x10000, 0xad7d592b, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "770_l05.i16", 0x08000, 0xed64fbb2, 2 | BRF_PRG | BRF_ESS }, // 2 M6809 Code - { "770_f04.g16", 0x10000, 0xe0e4ec9c, 2 | BRF_PRG | BRF_ESS }, // 3 - - { "770_h03.f16", 0x08000, 0x2ffd2afc, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "770c13-a.f3", 0x10000, 0x4ef6fff2, 4 | BRF_GRA }, // 5 K052109 Tiles - { "770c13-c.f4", 0x10000, 0x97ffbab6, 4 | BRF_GRA }, // 6 - { "770c13-b.e3", 0x10000, 0x86fdd706, 4 | BRF_GRA }, // 7 - { "770c13-d.e4", 0x10000, 0x7d7acb2d, 4 | BRF_GRA }, // 8 - { "770c12-a.f5", 0x10000, 0x6c0ade68, 4 | BRF_GRA }, // 9 - { "770c12-c.f6", 0x10000, 0x61fc39cc, 4 | BRF_GRA }, // 10 - { "770c12-b.e5", 0x10000, 0x5f221cc6, 4 | BRF_GRA }, // 11 - { "770c12-d.e6", 0x10000, 0xf1edb2f4, 4 | BRF_GRA }, // 12 - - { "770c09-a.f8", 0x10000, 0x76690fb8, 5 | BRF_GRA }, // 13 K051960 Tiles - { "770c09-e.f9", 0x10000, 0x17b482c9, 5 | BRF_GRA }, // 14 - { "770c09-b.e8", 0x10000, 0xcd1709d1, 5 | BRF_GRA }, // 15 - { "770c09-f.e9", 0x10000, 0xcba4b47e, 5 | BRF_GRA }, // 16 - { "770c09-c.d8", 0x10000, 0xbfd080b8, 5 | BRF_GRA }, // 17 - { "770c09-g.d9", 0x10000, 0x77d58ea0, 5 | BRF_GRA }, // 18 - { "770c09-d.c8", 0x10000, 0x6f955600, 5 | BRF_GRA }, // 19 - { "770c09-h.c9", 0x10000, 0x494a9090, 5 | BRF_GRA }, // 20 - { "770c08-a.f10", 0x10000, 0xefd29a56, 5 | BRF_GRA }, // 21 - { "770c08-e.f11", 0x10000, 0x6d43afde, 5 | BRF_GRA }, // 22 - { "770c08-b.e10", 0x10000, 0xf3374014, 5 | BRF_GRA }, // 23 - { "770c08-f.e11", 0x10000, 0xf5ba59aa, 5 | BRF_GRA }, // 24 - { "770c08-c.d10", 0x10000, 0x28e7088f, 5 | BRF_GRA }, // 25 - { "770c08-g.d11", 0x10000, 0x17da8f6d, 5 | BRF_GRA }, // 26 - { "770c08-d.c10", 0x10000, 0x91591777, 5 | BRF_GRA }, // 27 - { "770c08-h.c11", 0x10000, 0xd97d4b15, 5 | BRF_GRA }, // 28 - - { "770c06", 0x40000, 0xd0c592ee, 6 | BRF_GRA }, // 29 K051960 Tiles - { "770c07", 0x40000, 0x0b399fb1, 6 | BRF_GRA }, // 30 - - { "770c10-a.a7", 0x10000, 0xe45ec094, 7 | BRF_SND }, // 31 K007232 #0 Samples - { "770c10-b.a6", 0x10000, 0x349db7d3, 7 | BRF_SND }, // 32 - { "770c10-c.a5", 0x10000, 0x71cb1f05, 7 | BRF_SND }, // 33 - { "770c10-d.a4", 0x10000, 0xe8ab1844, 7 | BRF_SND }, // 34 - - { "770c11-a.c6", 0x10000, 0x8cccd9e0, 8 | BRF_SND }, // 35 K007232 #1 Samples - { "770c11-b.c5", 0x10000, 0x0af2fedd, 8 | BRF_SND }, // 36 - { "770c11-c.c4", 0x10000, 0x7471f24a, 8 | BRF_SND }, // 37 - { "770c11-d.c3", 0x10000, 0xa58be323, 8 | BRF_SND }, // 38 - { "770c11-e.b7", 0x10000, 0xdd553541, 8 | BRF_SND }, // 39 - { "770c11-f.b6", 0x10000, 0x3f78bd0f, 8 | BRF_SND }, // 40 - { "770c11-g.b5", 0x10000, 0x078c51b2, 8 | BRF_SND }, // 41 - { "770c11-h.b4", 0x10000, 0x7300c2e1, 8 | BRF_SND }, // 42 - - { "63s241.j11", 0x00200, 0x9bdd719f, 9 | BRF_OPT }, // 43 Timing Prom (unused) -}; - -STD_ROM_PICK(ajax) -STD_ROM_FN(ajax) - -struct BurnDriver BurnDrvAjax = { - "ajax", NULL, NULL, NULL, "1987", - "Ajax\0", NULL, "Konami", "GX770", - L"Ajax\0\u30A8\u30FC\u30B8\u30E3\u30C3\u30AF\u30B9\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_VERSHOOT, 0, - NULL, ajaxRomInfo, ajaxRomName, NULL, NULL, AjaxInputInfo, AjaxDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 224, 288, 3, 4 -}; - - -// Typhoon - -static struct BurnRomInfo typhoonRomDesc[] = { - { "770_k01.n11", 0x10000, 0x5ba74a22, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "770_k02.n12", 0x10000, 0x3bcf782a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "770_k05.i16", 0x08000, 0x0f1bebbb, 2 | BRF_PRG | BRF_ESS }, // 2 M6809 Code - { "770_f04.g16", 0x10000, 0xe0e4ec9c, 2 | BRF_PRG | BRF_ESS }, // 3 - - { "770_h03.f16", 0x08000, 0x2ffd2afc, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "770c13", 0x40000, 0xb859ca4e, 4 | BRF_GRA }, // 5 K052109 Tiles - { "770c12", 0x40000, 0x50d14b72, 4 | BRF_GRA }, // 6 - - { "770c09", 0x80000, 0x1ab4a7ff, 5 | BRF_GRA }, // 7 K051960 Tiles - { "770c08", 0x80000, 0xa8e80586, 5 | BRF_GRA }, // 8 - - { "770c06", 0x40000, 0xd0c592ee, 6 | BRF_GRA }, // 9 K051960 Tiles - { "770c07", 0x40000, 0x0b399fb1, 6 | BRF_GRA }, // 10 - - { "770c10", 0x40000, 0x7fac825f, 7 | BRF_SND }, // 11 K007232 #0 Samples - - { "770c11", 0x80000, 0x299a615a, 8 | BRF_SND }, // 12 K007232 #1 Samples - - { "63s241.j11", 0x00200, 0x9bdd719f, 9 | BRF_OPT }, // 13 Timing Prom (unused) -}; - -STD_ROM_PICK(typhoon) -STD_ROM_FN(typhoon) - -struct BurnDriver BurnDrvTyphoon = { - "typhoon", "ajax", NULL, NULL, "1987", - "Typhoon\0", NULL, "Konami", "GX770", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_VERSHOOT, 0, - NULL, typhoonRomInfo, typhoonRomName, NULL, NULL, AjaxInputInfo, AjaxDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 224, 288, 3, 4 -}; - - -// Ajax (Japan) - -static struct BurnRomInfo ajaxjRomDesc[] = { - { "770_l01.n11", 0x10000, 0x7cea5274, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "770_l02.n12", 0x10000, 0xad7d592b, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "770_l05.i16", 0x08000, 0xed64fbb2, 2 | BRF_PRG | BRF_ESS }, // 2 M6809 code - { "770_f04.g16", 0x10000, 0xe0e4ec9c, 2 | BRF_PRG | BRF_ESS }, // 3 - - { "770_f03.f16", 0x08000, 0x3fe914fd, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "770c13", 0x40000, 0xb859ca4e, 4 | BRF_GRA }, // 5 K052109 Tiles - { "770c12", 0x40000, 0x50d14b72, 4 | BRF_GRA }, // 6 - - { "770c09", 0x80000, 0x1ab4a7ff, 5 | BRF_GRA }, // 7 K051960 Tiles - { "770c08", 0x80000, 0xa8e80586, 5 | BRF_GRA }, // 8 - - { "770c06", 0x40000, 0xd0c592ee, 6 | BRF_GRA }, // 9 K051960 Tiles - { "770c07", 0x40000, 0x0b399fb1, 6 | BRF_GRA }, // 10 - - { "770c10", 0x40000, 0x7fac825f, 7 | BRF_SND }, // 11 K007232 #0 Samples - - { "770c11", 0x80000, 0x299a615a, 8 | BRF_SND }, // 12 K007232 #1 Samples - - { "63s241.j11", 0x00200, 0x9bdd719f, 9 | BRF_OPT }, // 13 Timing Prom (unused) -}; - -STD_ROM_PICK(ajaxj) -STD_ROM_FN(ajaxj) - -struct BurnDriver BurnDrvAjaxj = { - "ajaxj", "ajax", NULL, NULL, "1987", - "Ajax (Japan)\0", NULL, "Konami", "GX770", - L"Ajax\0\u30A8\u30FC\u30B8\u30E3\u30C3\u30AF\u30B9 (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_VERSHOOT, 0, - NULL, ajaxjRomInfo, ajaxjRomName, NULL, NULL, AjaxInputInfo, AjaxDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 224, 288, 3, 4 -}; +// FB Alpha Ajax driver module +// Based on MAME driver by Manuel Abadia + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" +#include "k007232.h" +#include "m6809_intf.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvM6809ROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *DrvShareRAM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *nDrvBankRom; + +static UINT8 DrvInputs[3]; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvReset; + +static INT32 firq_enable; +static INT32 ajax_priority; + +static struct BurnInputInfo AjaxInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Ajax) + +static struct BurnDIPInfo AjaxDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x52, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x14, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15, "Coin B" }, + {0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x14, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x14, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x14, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x03, "2" }, + {0x15, 0x01, 0x03, 0x02, "3" }, + {0x15, 0x01, 0x03, 0x01, "5" }, + {0x15, 0x01, 0x03, 0x00, "7" }, + +// {0 , 0xfe, 0 , 2, "Cabinet" }, +// {0x15, 0x01, 0x04, 0x00, "Upright" }, +// {0x15, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x15, 0x01, 0x18, 0x18, "30000 150000" }, + {0x15, 0x01, 0x18, 0x10, "50000 200000" }, + {0x15, 0x01, 0x18, 0x08, "30000" }, + {0x15, 0x01, 0x18, 0x00, "50000" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Normal" }, + {0x15, 0x01, 0x60, 0x20, "Difficult" }, + {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x16, 0x01, 0x01, 0x01, "Off" }, +// {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Upright Controls" }, + {0x16, 0x01, 0x02, 0x02, "Single" }, + {0x16, 0x01, 0x02, 0x00, "Dual" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Control in 3D Stages" }, + {0x16, 0x01, 0x08, 0x08, "Normal" }, + {0x16, 0x01, 0x08, 0x00, "Inverted" }, +}; + +STDDIPINFO(Ajax) + +static void ajax_main_bankswitch(INT32 data) +{ + nDrvBankRom[0] = data; + + INT32 nBank = 0x10000 + ((data & 0x80) << 9) + ((data & 7) << 13); + + ajax_priority = data & 0x08; + + konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); +} + +void ajax_main_write(UINT16 address, UINT8 data) +{ + if (address <= 0x1c0) + { + switch ((address & 0x01c0) >> 6) + { + case 0x0000: + if (address == 0 && firq_enable) { + M6809SetIRQLine(1, M6809_IRQSTATUS_AUTO); + } + break; + + case 0x0001: + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + break; + + case 0x0002: + *soundlatch = data; + break; + + case 0x0003: + ajax_main_bankswitch(data); + break; + } + } + + if ((address & 0xfff8) == 0x0800) { + K051937Write(address & 7, data); + return; + } + + if ((address & 0xfc00) == 0x0c00) { + K051960Write(address & 0x3ff, data); + return; + } +} + +UINT8 ajax_main_read(UINT16 address) +{ + if (address <= 0x01c0) { + switch ((address & 0x1c0) >> 6) + { + case 0x0000: + return konamiTotalCycles() & 0xff; // rand + + case 0x0004: + return DrvInputs[2]; + + case 0x0006: + switch (address & 3) { + case 0: + return DrvInputs[0]; + + case 1: + return DrvInputs[1]; + + case 2: + return DrvDips[0]; + + case 3: + return DrvDips[1]; + } + return 0; + + case 0x0007: + return DrvDips[2]; + } + } + + if ((address & 0xfff8) == 0x0800) { + return K051937Read(address & 7); + } + + if ((address & 0xfc00) == 0x0c00) { + return K051960Read(address & 0x3ff); + } + + return 0; +} + +static void ajax_sub_bankswitch(UINT8 data) +{ + nDrvBankRom[1] = data; + + K052109RMRDLine = data & 0x40; + + K051316WrapEnable(0, data & 0x20); + + firq_enable = data & 0x10; + + INT32 nBank = ((data & 0x0f) << 13) + 0x10000; + M6809MapMemory(DrvM6809ROM + nBank, 0x8000, 0x9fff, M6809_ROM); +} + +void ajax_sub_write(UINT16 address, UINT8 data) +{ + if ((address & 0xf800) == 0x0000) { + K051316Write(0, address & 0x7ff, data); + return; + } + + if ((address & 0xfff0) == 0x0800) { + K051316WriteCtrl(0, address & 0x0f, data); + return; + } + + if (address == 0x1800) { + ajax_sub_bankswitch(data); + return; + } + + if ((address & 0xc000) == 0x4000) { + K052109Write(address & 0x3fff, data); + return; + } +} + +UINT8 ajax_sub_read(UINT16 address) +{ + if ((address & 0xf800) == 0x0000) { + return K051316Read(0, address & 0x7ff); + } + + if ((address & 0xf800) == 0x1000) { + return K051316ReadRom(0, address & 0x7ff); + } + + if ((address & 0xc000) == 0x4000) { + return K052109Read(address & 0x3fff); + } + + return 0; +} + +void __fastcall ajax_sound_write(UINT16 address, UINT8 data) +{ + if ((address & 0xfff0) == 0xa000) { + K007232WriteReg(0, address & 0x0f, data); + return; + } + + if ((address & 0xfff0) == 0xb000) { + K007232WriteReg(1, address & 0x0f, data); + return; + } + + switch (address) + { + case 0x9000: + k007232_set_bank(0, (data >> 1) & 1, (data >> 0) & 1 ); + k007232_set_bank(1, (data >> 4) & 3, (data >> 2) & 3 ); + return; + + case 0xb80c: + K007232SetVolume(1, 0, (data & 0x0f) * 0x11/2, (data & 0x0f) * 0x11/2); + return; + + case 0xc000: + BurnYM2151SelectRegister(data); + return; + + case 0xc001: + BurnYM2151WriteRegister(data); + return; + } +} + +UINT8 __fastcall ajax_sound_read(UINT16 address) +{ + if ((address & 0xfff0) == 0xa000) { + return K007232ReadReg(0, address & 0x0f); + } + + if ((address & 0xfff0) == 0xb000) { + return K007232ReadReg(1, address & 0x0f); + } + + switch (address) + { + case 0xc000: + case 0xc001: + return BurnYM2151ReadStatus(); + + case 0xe000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + INT32 layer_colorbase[3] = { 64, 0, 32 }; + + *code |= ((*color & 0x0f) << 8) | (bank << 12); + *code &= 0x3fff; + *color = layer_colorbase[layer] + ((*color & 0xf0) >> 4); +} + +static void K051960Callback(INT32 *code, INT32 *color,INT32 *priority, INT32 *) +{ + *priority = 0; + if ( *color & 0x10) *priority = 1; + if (~*color & 0x40) *priority = 2; + if ( *color & 0x20) *priority = 3; + *color = 16 + (*color & 0x0f); + *code &= 0x1fff; +} + +static void K051316Callback(INT32 *code,INT32 *color,INT32 *) +{ + *code |= ((*color & 0x07) << 8); + *code &= 0x7ff; + *color = 6 + ((*color & 0x08) >> 3); +} + +static void DrvK007232VolCallback0(INT32 v) +{ + K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); + K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); +} + +static void DrvK007232VolCallback1(INT32 v) +{ + K007232SetVolume(1, 0, (v & 0x0f) * 0x11/2, (v & 0x0f) * 0x11/2); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + M6809Open(0); + M6809Reset(); + M6809Close(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + firq_enable = 0; + ajax_priority = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x030000; + DrvM6809ROM = Next; Next += 0x030000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x080000; + DrvGfxROM1 = Next; Next += 0x100000; + DrvGfxROM2 = Next; Next += 0x080000; + DrvGfxROMExp0 = Next; Next += 0x100000; + DrvGfxROMExp1 = Next; Next += 0x200000; + + DrvSndROM0 = Next; Next += 0x040000; + DrvSndROM1 = Next; Next += 0x080000; + + DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + + AllRam = Next; + + DrvShareRAM = Next; Next += 0x002000; + DrvKonRAM = Next; Next += 0x002000; + DrvPalRAM = Next; Next += 0x001000 + 0x1000; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + nDrvBankRom = Next; Next += 0x000002; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs0[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x080000); + konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); + + GfxDecode(0x04000, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x100, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x02000, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvKonROM + 0x020000, 0, 1)) return 1; + if (BurnLoadRom(DrvKonROM + 0x010000, 1, 1)) return 1; + memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x28000, 0x8000); + + if (BurnLoadRom(DrvM6809ROM + 0x20000, 2, 1)) return 1; + memcpy (DrvM6809ROM + 0xa000, DrvM6809ROM + 0x22000, 0x6000); + if (BurnLoadRom(DrvM6809ROM + 0x10000, 3, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1; + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "ajax") == 0) { + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x020000, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x020001, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040001, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060000, 11, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060001, 12, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 15, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020001, 16, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 17, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040001, 18, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060000, 19, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060001, 20, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 21, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080001, 22, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0a0000, 23, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0a0001, 24, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 25, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 26, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0e0000, 27, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0e0001, 28, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 29, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x040000, 30, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 31, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x010000, 32, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x020000, 33, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x030000, 34, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x000000, 35, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x010000, 36, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x020000, 37, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x030000, 38, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x040000, 39, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x050000, 40, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x060000, 41, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x070000, 42, 1)) return 1; + } else { + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x040000, 10, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 11, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x000000, 12, 1)) return 1; + } + + DrvGfxDecode(); + } + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvPalRAM, 0x1000, 0x1fff, KON_RAM); + konamiMapMemory(DrvShareRAM, 0x2000, 0x3fff, KON_RAM); + konamiMapMemory(DrvKonRAM, 0x4000, 0x5fff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(ajax_main_write); + konamiSetReadHandler(ajax_main_read); + konamiClose(); + + M6809Init(1); + M6809Open(0); + M6809MapMemory(DrvShareRAM, 0x2000, 0x3fff, M6809_RAM); + M6809MapMemory(DrvM6809ROM + 0x10000, 0x8000, 0x9fff, M6809_ROM); + M6809MapMemory(DrvM6809ROM + 0x0a000, 0xa000, 0xffff, M6809_ROM); + M6809SetWriteHandler(ajax_sub_write); + M6809SetReadHandler(ajax_sub_read); + M6809Close(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(ajax_sound_write); + ZetSetReadHandler(ajax_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + K007232Init(0, 3579545, DrvSndROM0, 0x40000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback0); + K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + K007232Init(1, 3579545, DrvSndROM1, 0x80000); + K007232SetPortWriteHandler(1, DrvK007232VolCallback1); + K007232SetRoute(1, BURN_SND_K007232_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + K007232SetRoute(1, BURN_SND_K007232_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + + K052109Init(DrvGfxROM0, 0x7ffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(8, 0); + + K051960Init(DrvGfxROM1, 0xfffff); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(8, 0); + + K051316Init(0, DrvGfxROM2, DrvGfxROM2, 0x7ffff, K051316Callback, 7, 0); + K051316SetOffset(0, -112, -16); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + M6809Exit(); + konamiExit(); + ZetExit(); + + K007232Exit(); + BurnYM2151Exit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x1000); + } + + K052109UpdateScroll(); + + BurnTransferClear(); + + if (nBurnLayer & 1) K052109RenderLayer(2, 0, DrvGfxROMExp0); + + if (ajax_priority) + { + if (nBurnLayer & 2) K051316_zoom_draw(0, 4); + if (nBurnLayer & 4) K052109RenderLayer(1, 0, DrvGfxROMExp0); + } + else + { + if (nBurnLayer & 4) K052109RenderLayer(1, 0, DrvGfxROMExp0); + if (nBurnLayer & 2) K051316_zoom_draw(0, 4); + } + +// needs work... + if (nSpriteEnable & 1) K051960SpritesRender(DrvGfxROMExp1, 3); + if (nSpriteEnable & 2) K051960SpritesRender(DrvGfxROMExp1, 2); + if (nSpriteEnable & 4) K051960SpritesRender(DrvGfxROMExp1, 1); + if (nSpriteEnable & 8) K051960SpritesRender(DrvGfxROMExp1, 0); + + if (nBurnLayer & 8) K052109RenderLayer(0, 0, DrvGfxROMExp0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; + if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; + } + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 100; + INT32 nCyclesTotal[3] = { (((3000000 / 60) * 133) / 100) /* 33% overclock */, 3000000 / 60, 3579545 / 60 }; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + + ZetOpen(0); + M6809Open(0); + konamiOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); + + nCyclesDone[1] += M6809Run(nSegment - nCyclesDone[1]); + nSegment = (nCyclesTotal[2] / nInterleave) * (i + 1); + + nCyclesDone[2] += ZetRun(nSegment - nCyclesDone[2]); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + K007232Update(1, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K051960_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + K007232Update(1, pSoundBuf, nSegmentLength); + } + } + + konamiClose(); + M6809Close(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + M6809Scan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + K007232Scan(nAction, pnMin); + + KonamiICScan(nAction); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + ajax_main_bankswitch(nDrvBankRom[0]); + konamiClose(); + + M6809Open(0); + ajax_sub_bankswitch(nDrvBankRom[1]); + M6809Close(); + } + + return 0; +} + + +// Ajax + +static struct BurnRomInfo ajaxRomDesc[] = { + { "770_m01.n11", 0x10000, 0x4a64e53a, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "770_l02.n12", 0x10000, 0xad7d592b, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "770_l05.i16", 0x08000, 0xed64fbb2, 2 | BRF_PRG | BRF_ESS }, // 2 M6809 Code + { "770_f04.g16", 0x10000, 0xe0e4ec9c, 2 | BRF_PRG | BRF_ESS }, // 3 + + { "770_h03.f16", 0x08000, 0x2ffd2afc, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "770c13-a.f3", 0x10000, 0x4ef6fff2, 4 | BRF_GRA }, // 5 K052109 Tiles + { "770c13-c.f4", 0x10000, 0x97ffbab6, 4 | BRF_GRA }, // 6 + { "770c13-b.e3", 0x10000, 0x86fdd706, 4 | BRF_GRA }, // 7 + { "770c13-d.e4", 0x10000, 0x7d7acb2d, 4 | BRF_GRA }, // 8 + { "770c12-a.f5", 0x10000, 0x6c0ade68, 4 | BRF_GRA }, // 9 + { "770c12-c.f6", 0x10000, 0x61fc39cc, 4 | BRF_GRA }, // 10 + { "770c12-b.e5", 0x10000, 0x5f221cc6, 4 | BRF_GRA }, // 11 + { "770c12-d.e6", 0x10000, 0xf1edb2f4, 4 | BRF_GRA }, // 12 + + { "770c09-a.f8", 0x10000, 0x76690fb8, 5 | BRF_GRA }, // 13 K051960 Tiles + { "770c09-e.f9", 0x10000, 0x17b482c9, 5 | BRF_GRA }, // 14 + { "770c09-b.e8", 0x10000, 0xcd1709d1, 5 | BRF_GRA }, // 15 + { "770c09-f.e9", 0x10000, 0xcba4b47e, 5 | BRF_GRA }, // 16 + { "770c09-c.d8", 0x10000, 0xbfd080b8, 5 | BRF_GRA }, // 17 + { "770c09-g.d9", 0x10000, 0x77d58ea0, 5 | BRF_GRA }, // 18 + { "770c09-d.c8", 0x10000, 0x6f955600, 5 | BRF_GRA }, // 19 + { "770c09-h.c9", 0x10000, 0x494a9090, 5 | BRF_GRA }, // 20 + { "770c08-a.f10", 0x10000, 0xefd29a56, 5 | BRF_GRA }, // 21 + { "770c08-e.f11", 0x10000, 0x6d43afde, 5 | BRF_GRA }, // 22 + { "770c08-b.e10", 0x10000, 0xf3374014, 5 | BRF_GRA }, // 23 + { "770c08-f.e11", 0x10000, 0xf5ba59aa, 5 | BRF_GRA }, // 24 + { "770c08-c.d10", 0x10000, 0x28e7088f, 5 | BRF_GRA }, // 25 + { "770c08-g.d11", 0x10000, 0x17da8f6d, 5 | BRF_GRA }, // 26 + { "770c08-d.c10", 0x10000, 0x91591777, 5 | BRF_GRA }, // 27 + { "770c08-h.c11", 0x10000, 0xd97d4b15, 5 | BRF_GRA }, // 28 + + { "770c06", 0x40000, 0xd0c592ee, 6 | BRF_GRA }, // 29 K051960 Tiles + { "770c07", 0x40000, 0x0b399fb1, 6 | BRF_GRA }, // 30 + + { "770c10-a.a7", 0x10000, 0xe45ec094, 7 | BRF_SND }, // 31 K007232 #0 Samples + { "770c10-b.a6", 0x10000, 0x349db7d3, 7 | BRF_SND }, // 32 + { "770c10-c.a5", 0x10000, 0x71cb1f05, 7 | BRF_SND }, // 33 + { "770c10-d.a4", 0x10000, 0xe8ab1844, 7 | BRF_SND }, // 34 + + { "770c11-a.c6", 0x10000, 0x8cccd9e0, 8 | BRF_SND }, // 35 K007232 #1 Samples + { "770c11-b.c5", 0x10000, 0x0af2fedd, 8 | BRF_SND }, // 36 + { "770c11-c.c4", 0x10000, 0x7471f24a, 8 | BRF_SND }, // 37 + { "770c11-d.c3", 0x10000, 0xa58be323, 8 | BRF_SND }, // 38 + { "770c11-e.b7", 0x10000, 0xdd553541, 8 | BRF_SND }, // 39 + { "770c11-f.b6", 0x10000, 0x3f78bd0f, 8 | BRF_SND }, // 40 + { "770c11-g.b5", 0x10000, 0x078c51b2, 8 | BRF_SND }, // 41 + { "770c11-h.b4", 0x10000, 0x7300c2e1, 8 | BRF_SND }, // 42 + + { "63s241.j11", 0x00200, 0x9bdd719f, 9 | BRF_OPT }, // 43 Timing Prom (unused) +}; + +STD_ROM_PICK(ajax) +STD_ROM_FN(ajax) + +struct BurnDriver BurnDrvAjax = { + "ajax", NULL, NULL, NULL, "1987", + "Ajax\0", NULL, "Konami", "GX770", + L"Ajax\0\u30A8\u30FC\u30B8\u30E3\u30C3\u30AF\u30B9\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_VERSHOOT, 0, + NULL, ajaxRomInfo, ajaxRomName, NULL, NULL, AjaxInputInfo, AjaxDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 224, 288, 3, 4 +}; + + +// Typhoon + +static struct BurnRomInfo typhoonRomDesc[] = { + { "770_k01.n11", 0x10000, 0x5ba74a22, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "770_k02.n12", 0x10000, 0x3bcf782a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "770_k05.i16", 0x08000, 0x0f1bebbb, 2 | BRF_PRG | BRF_ESS }, // 2 M6809 Code + { "770_f04.g16", 0x10000, 0xe0e4ec9c, 2 | BRF_PRG | BRF_ESS }, // 3 + + { "770_h03.f16", 0x08000, 0x2ffd2afc, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "770c13", 0x40000, 0xb859ca4e, 4 | BRF_GRA }, // 5 K052109 Tiles + { "770c12", 0x40000, 0x50d14b72, 4 | BRF_GRA }, // 6 + + { "770c09", 0x80000, 0x1ab4a7ff, 5 | BRF_GRA }, // 7 K051960 Tiles + { "770c08", 0x80000, 0xa8e80586, 5 | BRF_GRA }, // 8 + + { "770c06", 0x40000, 0xd0c592ee, 6 | BRF_GRA }, // 9 K051960 Tiles + { "770c07", 0x40000, 0x0b399fb1, 6 | BRF_GRA }, // 10 + + { "770c10", 0x40000, 0x7fac825f, 7 | BRF_SND }, // 11 K007232 #0 Samples + + { "770c11", 0x80000, 0x299a615a, 8 | BRF_SND }, // 12 K007232 #1 Samples + + { "63s241.j11", 0x00200, 0x9bdd719f, 9 | BRF_OPT }, // 13 Timing Prom (unused) +}; + +STD_ROM_PICK(typhoon) +STD_ROM_FN(typhoon) + +struct BurnDriver BurnDrvTyphoon = { + "typhoon", "ajax", NULL, NULL, "1987", + "Typhoon\0", NULL, "Konami", "GX770", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_VERSHOOT, 0, + NULL, typhoonRomInfo, typhoonRomName, NULL, NULL, AjaxInputInfo, AjaxDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 224, 288, 3, 4 +}; + + +// Ajax (Japan) + +static struct BurnRomInfo ajaxjRomDesc[] = { + { "770_l01.n11", 0x10000, 0x7cea5274, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "770_l02.n12", 0x10000, 0xad7d592b, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "770_l05.i16", 0x08000, 0xed64fbb2, 2 | BRF_PRG | BRF_ESS }, // 2 M6809 code + { "770_f04.g16", 0x10000, 0xe0e4ec9c, 2 | BRF_PRG | BRF_ESS }, // 3 + + { "770_f03.f16", 0x08000, 0x3fe914fd, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "770c13", 0x40000, 0xb859ca4e, 4 | BRF_GRA }, // 5 K052109 Tiles + { "770c12", 0x40000, 0x50d14b72, 4 | BRF_GRA }, // 6 + + { "770c09", 0x80000, 0x1ab4a7ff, 5 | BRF_GRA }, // 7 K051960 Tiles + { "770c08", 0x80000, 0xa8e80586, 5 | BRF_GRA }, // 8 + + { "770c06", 0x40000, 0xd0c592ee, 6 | BRF_GRA }, // 9 K051960 Tiles + { "770c07", 0x40000, 0x0b399fb1, 6 | BRF_GRA }, // 10 + + { "770c10", 0x40000, 0x7fac825f, 7 | BRF_SND }, // 11 K007232 #0 Samples + + { "770c11", 0x80000, 0x299a615a, 8 | BRF_SND }, // 12 K007232 #1 Samples + + { "63s241.j11", 0x00200, 0x9bdd719f, 9 | BRF_OPT }, // 13 Timing Prom (unused) +}; + +STD_ROM_PICK(ajaxj) +STD_ROM_FN(ajaxj) + +struct BurnDriver BurnDrvAjaxj = { + "ajaxj", "ajax", NULL, NULL, "1987", + "Ajax (Japan)\0", NULL, "Konami", "GX770", + L"Ajax\0\u30A8\u30FC\u30B8\u30E3\u30C3\u30AF\u30B9 (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_VERSHOOT, 0, + NULL, ajaxjRomInfo, ajaxjRomName, NULL, NULL, AjaxInputInfo, AjaxDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 224, 288, 3, 4 +}; diff --git a/src/burn/drv/konami/d_aliens.cpp b/src/burn/drv/konami/d_aliens.cpp index 1ef0ffe47..d6aa5c134 100644 --- a/src/burn/drv/konami/d_aliens.cpp +++ b/src/burn/drv/konami/d_aliens.cpp @@ -1,854 +1,853 @@ -// FB Alpha Aliens driver module -// Based on MAME driver by Manuel Abadia - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" -#include "k007232.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM; -static UINT8 *DrvBankRAM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *nDrvRamBank; -static UINT8 *nDrvKonamiBank; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[2]; -static UINT8 DrvReset; - -static struct BurnInputInfo AliensInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 6, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Aliens) - -static struct BurnDIPInfo AliensDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x5e, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x12, 0x01, 0xf0, 0x00, "No Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x03, "1" }, - {0x13, 0x01, 0x03, 0x02, "2" }, - {0x13, 0x01, 0x03, 0x01, "3" }, - {0x13, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Hard" }, - {0x13, 0x01, 0x60, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x01, 0x01, "Off" }, -// {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Aliens) - -static void set_ram_bank(INT32 data) -{ - nDrvRamBank[0] = data; - - if (data & 0x20) { - konamiMapMemory(DrvPalRAM, 0x0000, 0x03ff, KON_RAM); - } else { - konamiMapMemory(DrvBankRAM, 0x0000, 0x03ff, KON_RAM); - } -} - -void aliens_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x5f88: - set_ram_bank(data & 0x20); - K052109RMRDLine = data & 0x40; - return; - - case 0x5f8c: - *soundlatch = data; - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - - //ZetRaiseIrq(0xff); - return; - } - - if ((address & 0xc000) == 0x4000) { - K052109_051960_w(address & 0x3fff, data); - return; - } -} - -UINT8 aliens_main_read(UINT16 address) -{ - switch (address) - { - case 0x5f80: - return DrvDips[2]; - - case 0x5f81: - return DrvInputs[0]; - - case 0x5f82: - return DrvInputs[1]; - - case 0x5f83: - return DrvDips[1]; - - case 0x5f84: - return DrvDips[0]; - - case 0x5f88: - // watchdog reset - return 0; - } - - if ((address & 0xc000) == 0x4000) { - return K052109_051960_r(address & 0x3fff); - } - - return 0; -} - -void __fastcall aliens_sound_write(UINT16 address, UINT8 data) -{ - if ((address & 0xfff0) == 0xe000) { - K007232WriteReg(0, address & 0x0f, data); - return; - } - - switch (address) - { - case 0xa000: - BurnYM2151SelectRegister(data); - return; - - case 0xa001: - BurnYM2151WriteRegister(data); - return; - } -} - -UINT8 __fastcall aliens_sound_read(UINT16 address) -{ - if ((address & 0xfff0) == 0xe000) { - return K007232ReadReg(0, address & 0x0f); - } - - switch (address) - { - case 0xa000: - case 0xa001: - return BurnYM2151ReadStatus(); - - case 0xc000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -static void DrvYM2151WritePort(UINT32, UINT32 data) -{ - INT32 bank_A = ((data >> 1) & 0x01); - INT32 bank_B = ((data) & 0x01); - - k007232_set_bank(0, bank_A, bank_B ); -} - -static void DrvK007232VolCallback(INT32 v) -{ - K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); - K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); -} - -static void aliens_set_lines(INT32 lines) -{ - nDrvKonamiBank[0] = lines; - - INT32 nBank = (lines & 0x1f) * 0x2000; - - konamiMapMemory(DrvKonROM + 0x10000 + nBank, 0x2000, 0x3fff, KON_ROM); -} - -static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - *code |= ((*color & 0x3f) << 8) | (bank << 14); - *code &= 0xffff; - *color = (layer << 2) + ((*color & 0xc0) >> 6); -} - -static void K051960Callback(INT32 *code, INT32 *color,INT32 *priority, INT32 *shadow) -{ - switch (*color & 0x70) - { - case 0x10: *priority = 0x00; break; - case 0x00: *priority = 0x01; break; - case 0x40: *priority = 0x02; break; - - case 0x20: - case 0x60: *priority = 0x03; break; - - // when are these used? - case 0x50: *priority = 0x04; break; - case 0x30: - case 0x70: *priority = 0x05; break; - } - *code |= (*color & 0x80) << 6; - *code &= 0x3fff; - *color = 16 + (*color & 0x0f); - *shadow = 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x200000; - DrvGfxROMExp0 = Next; Next += 0x400000; - DrvGfxROMExp1 = Next; Next += 0x400000; - - DrvSndROM = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x200 * sizeof(UINT32); - - AllRam = Next; - - DrvBankRAM = Next; Next += 0x000400; - DrvKonRAM = Next; Next += 0x001c00; - DrvPalRAM = Next; Next += 0x000400; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - nDrvRamBank = Next; Next += 0x000001; - nDrvKonamiBank = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x200000); - konami_rom_deinterleave_2(DrvGfxROM1, 0x200000); - - GfxDecode(0x10000, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x04000, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvKonROM + 0x030000, 0, 1)) return 1; - if (BurnLoadRom(DrvKonROM + 0x010000, 1, 1)) return 1; - memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x38000, 0x8000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x180000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 10, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 11, 1)) return 1; - - DrvGfxDecode(); - } - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvBankRAM, 0x0000, 0x03ff, KON_RAM); - konamiMapMemory(DrvKonRAM, 0x0400, 0x1fff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x10000, 0x2000, 0x3fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(aliens_main_write); - konamiSetReadHandler(aliens_main_read); - konamiSetlinesCallback(aliens_set_lines); - konamiClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(aliens_sound_write); - ZetSetReadHandler(aliens_sound_read); - ZetMemEnd(); - ZetClose(); - - K052109Init(DrvGfxROM0, 0x1fffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(8, 0); - - K051960Init(DrvGfxROM1, 0x1fffff); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(8, 0); - - BurnYM2151Init(3579545); - BurnYM2151SetPortHandler(&DrvYM2151WritePort); - BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); - - K007232Init(0, 3579545, DrvSndROM, 0x40000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback); - K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - konamiExit(); - ZetExit(); - - K007232Exit(); - BurnYM2151Exit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x400); - } - - K052109UpdateScroll(); - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x0040; - } - - K051960SpritesRender(DrvGfxROMExp1, 3); - K052109RenderLayer(1, 0, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 2); - K052109RenderLayer(2, 0, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 1); - K052109RenderLayer(0, 0, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 0); - - K051960SpritesRender(DrvGfxROMExp1, 4); - K051960SpritesRender(DrvGfxROMExp1, 5); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvDips[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; - if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - } - - konamiNewFrame(); - ZetNewFrame(); - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = nBurnSoundLen; - INT32 nCyclesTotal[2] = { 6000000 / 60, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetOpen(0); - konamiOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - - nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); - - nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); - - nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K051960_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - } - } - - konamiClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029704; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - K007232Scan(nAction, pnMin); - - KonamiICScan(nAction); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - set_ram_bank(nDrvRamBank[0]); - aliens_set_lines(nDrvKonamiBank[0]); - konamiClose(); - } - - return 0; -} - - -// Aliens (World set 1) - -static struct BurnRomInfo aliensRomDesc[] = { - { "875_j02.e24", 0x10000, 0x56c20971, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code - { "875_j01.c24", 0x20000, 0x6a529cd6, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "875_b03.g04", 0x08000, 0x1ac4d283, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles - { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 - { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 - { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 - - { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites - { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 - { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 - { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 - - { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples - - { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms -}; - -STD_ROM_PICK(aliens) -STD_ROM_FN(aliens) - -struct BurnDriver BurnDrvAliens = { - "aliens", NULL, NULL, NULL, "1990", - "Aliens (World set 1)\0", NULL, "Konami", "GX875", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, - NULL, aliensRomInfo, aliensRomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 288, 224, 4, 3 -}; - - -// Aliens (World set 2) - -static struct BurnRomInfo aliens2RomDesc[] = { - { "875_p02.e24", 0x10000, 0x4edd707d, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code - { "875_n01.c24", 0x20000, 0x106cf59c, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "875_b03.g04", 0x08000, 0x1ac4d283, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles - { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 - { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 - { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 - - { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites - { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 - { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 - { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 - - { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples - - { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms -}; - -STD_ROM_PICK(aliens2) -STD_ROM_FN(aliens2) - -struct BurnDriver BurnDrvAliens2 = { - "aliens2", "aliens", NULL, NULL, "1990", - "Aliens (World set 2)\0", NULL, "Konami", "GX875", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, - NULL, aliens2RomInfo, aliens2RomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 288, 224, 4, 3 -}; - - -// Aliens (World set 3) - -static struct BurnRomInfo aliens3RomDesc[] = { - { "875_w3_2.e24", 0x10000, 0xf917f7b5, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code - { "875_w3_1.c24", 0x20000, 0x3c0006fb, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "875_b03.g04", 0x08000, 0x1ac4d283, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles - { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 - { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 - { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 - - { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites - { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 - { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 - { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 - - { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples - - { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms -}; - -STD_ROM_PICK(aliens3) -STD_ROM_FN(aliens3) - -struct BurnDriver BurnDrvAliens3 = { - "aliens3", "aliens", NULL, NULL, "1990", - "Aliens (World set 3)\0", NULL, "Konami", "GX875", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, - NULL, aliens3RomInfo, aliens3RomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 288, 224, 4, 3 -}; - - -// Aliens (US) - -static struct BurnRomInfo aliensuRomDesc[] = { - { "875_n02.e24", 0x10000, 0x24dd612e, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code - { "875_n01.c24", 0x20000, 0x106cf59c, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "875_b03.g04", 0x08000, 0x1ac4d283, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles - { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 - { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 - { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 - - { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites - { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 - { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 - { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 - - { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples - - { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms -}; - -STD_ROM_PICK(aliensu) -STD_ROM_FN(aliensu) - -struct BurnDriver BurnDrvAliensu = { - "aliensu", "aliens", NULL, NULL, "1990", - "Aliens (US)\0", NULL, "Konami", "GX875", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, - NULL, aliensuRomInfo, aliensuRomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 288, 224, 4, 3 -}; - - -// Aliens (Japan set 1) - -static struct BurnRomInfo aliensjRomDesc[] = { - { "875_m02.e24", 0x10000, 0x54a774e5, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code - { "875_m01.c24", 0x20000, 0x1663d3dc, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "875_k03.g04", 0x08000, 0xbd86264d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles - { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 - { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 - { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 - - { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites - { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 - { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 - { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 - - { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples - - { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms -}; - -STD_ROM_PICK(aliensj) -STD_ROM_FN(aliensj) - -struct BurnDriver BurnDrvAliensj = { - "aliensj", "aliens", NULL, NULL, "1990", - "Aliens (Japan set 1)\0", NULL, "Konami", "GX875", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, - NULL, aliensjRomInfo, aliensjRomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 288, 224, 4, 3 -}; - - -// Aliens (Japan set 2) - -static struct BurnRomInfo aliensj2RomDesc[] = { - { "875_j2_2.e24", 0x10000, 0x4bb84952, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code - { "875_m01.c24", 0x20000, 0x1663d3dc, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "875_k03.g04", 0x08000, 0xbd86264d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles - { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 - { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 - { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 - - { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites - { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 - { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 - { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 - - { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples - - { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms -}; - -STD_ROM_PICK(aliensj2) -STD_ROM_FN(aliensj2) - -struct BurnDriver BurnDrvAliensj2 = { - "aliensj2", "aliens", NULL, NULL, "1990", - "Aliens (Japan set 2)\0", NULL, "Konami", "GX875", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, - NULL, aliensj2RomInfo, aliensj2RomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 288, 224, 4, 3 -}; - - -// Aliens (Asia) - -static struct BurnRomInfo aliensaRomDesc[] = { - { "875_r02.e24", 0x10000, 0x973e4f11, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code - { "875_m01.c24", 0x20000, 0x1663d3dc, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "875_k03.g04", 0x08000, 0xbd86264d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles - { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 - { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 - { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 - - { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites - { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 - { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 - { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 - - { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples - - { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms -}; - -STD_ROM_PICK(aliensa) -STD_ROM_FN(aliensa) - -struct BurnDriver BurnDrvAliensa = { - "aliensa", "aliens", NULL, NULL, "1990", - "Aliens (Asia)\0", NULL, "Konami", "GX875", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, - NULL, aliensaRomInfo, aliensaRomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 288, 224, 4, 3 -}; +// FB Alpha Aliens driver module +// Based on MAME driver by Manuel Abadia + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" +#include "k007232.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM; +static UINT8 *DrvBankRAM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *nDrvRamBank; +static UINT8 *nDrvKonamiBank; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[2]; +static UINT8 DrvReset; + +static struct BurnInputInfo AliensInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 6, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Aliens) + +static struct BurnDIPInfo AliensDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x5e, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x12, 0x01, 0xf0, 0x00, "No Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x03, "1" }, + {0x13, 0x01, 0x03, 0x02, "2" }, + {0x13, 0x01, 0x03, 0x01, "3" }, + {0x13, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Hard" }, + {0x13, 0x01, 0x60, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x01, 0x01, "Off" }, +// {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Aliens) + +static void set_ram_bank(INT32 data) +{ + nDrvRamBank[0] = data; + + if (data & 0x20) { + konamiMapMemory(DrvPalRAM, 0x0000, 0x03ff, KON_RAM); + } else { + konamiMapMemory(DrvBankRAM, 0x0000, 0x03ff, KON_RAM); + } +} + +void aliens_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x5f88: + set_ram_bank(data & 0x20); + K052109RMRDLine = data & 0x40; + return; + + case 0x5f8c: + *soundlatch = data; + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + + //ZetRaiseIrq(0xff); + return; + } + + if ((address & 0xc000) == 0x4000) { + K052109_051960_w(address & 0x3fff, data); + return; + } +} + +UINT8 aliens_main_read(UINT16 address) +{ + switch (address) + { + case 0x5f80: + return DrvDips[2]; + + case 0x5f81: + return DrvInputs[0]; + + case 0x5f82: + return DrvInputs[1]; + + case 0x5f83: + return DrvDips[1]; + + case 0x5f84: + return DrvDips[0]; + + case 0x5f88: + // watchdog reset + return 0; + } + + if ((address & 0xc000) == 0x4000) { + return K052109_051960_r(address & 0x3fff); + } + + return 0; +} + +void __fastcall aliens_sound_write(UINT16 address, UINT8 data) +{ + if ((address & 0xfff0) == 0xe000) { + K007232WriteReg(0, address & 0x0f, data); + return; + } + + switch (address) + { + case 0xa000: + BurnYM2151SelectRegister(data); + return; + + case 0xa001: + BurnYM2151WriteRegister(data); + return; + } +} + +UINT8 __fastcall aliens_sound_read(UINT16 address) +{ + if ((address & 0xfff0) == 0xe000) { + return K007232ReadReg(0, address & 0x0f); + } + + switch (address) + { + case 0xa000: + case 0xa001: + return BurnYM2151ReadStatus(); + + case 0xc000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +static void DrvYM2151WritePort(UINT32, UINT32 data) +{ + INT32 bank_A = ((data >> 1) & 0x01); + INT32 bank_B = ((data) & 0x01); + + k007232_set_bank(0, bank_A, bank_B ); +} + +static void DrvK007232VolCallback(INT32 v) +{ + K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); + K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); +} + +static void aliens_set_lines(INT32 lines) +{ + nDrvKonamiBank[0] = lines; + + INT32 nBank = (lines & 0x1f) * 0x2000; + + konamiMapMemory(DrvKonROM + 0x10000 + nBank, 0x2000, 0x3fff, KON_ROM); +} + +static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + *code |= ((*color & 0x3f) << 8) | (bank << 14); + *code &= 0xffff; + *color = (layer << 2) + ((*color & 0xc0) >> 6); +} + +static void K051960Callback(INT32 *code, INT32 *color,INT32 *priority, INT32 *shadow) +{ + switch (*color & 0x70) + { + case 0x10: *priority = 0x00; break; + case 0x00: *priority = 0x01; break; + case 0x40: *priority = 0x02; break; + + case 0x20: + case 0x60: *priority = 0x03; break; + + // when are these used? + case 0x50: *priority = 0x04; break; + case 0x30: + case 0x70: *priority = 0x05; break; + } + *code |= (*color & 0x80) << 6; + *code &= 0x3fff; + *color = 16 + (*color & 0x0f); + *shadow = 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x200000; + DrvGfxROMExp0 = Next; Next += 0x400000; + DrvGfxROMExp1 = Next; Next += 0x400000; + + DrvSndROM = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x200 * sizeof(UINT32); + + AllRam = Next; + + DrvBankRAM = Next; Next += 0x000400; + DrvKonRAM = Next; Next += 0x001c00; + DrvPalRAM = Next; Next += 0x000400; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + nDrvRamBank = Next; Next += 0x000001; + nDrvKonamiBank = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x200000); + konami_rom_deinterleave_2(DrvGfxROM1, 0x200000); + + GfxDecode(0x10000, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x04000, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvKonROM + 0x030000, 0, 1)) return 1; + if (BurnLoadRom(DrvKonROM + 0x010000, 1, 1)) return 1; + memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x38000, 0x8000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x180000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 10, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 11, 1)) return 1; + + DrvGfxDecode(); + } + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvBankRAM, 0x0000, 0x03ff, KON_RAM); + konamiMapMemory(DrvKonRAM, 0x0400, 0x1fff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x10000, 0x2000, 0x3fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(aliens_main_write); + konamiSetReadHandler(aliens_main_read); + konamiSetlinesCallback(aliens_set_lines); + konamiClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(aliens_sound_write); + ZetSetReadHandler(aliens_sound_read); + ZetClose(); + + K052109Init(DrvGfxROM0, 0x1fffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(8, 0); + + K051960Init(DrvGfxROM1, 0x1fffff); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(8, 0); + + BurnYM2151Init(3579545); + BurnYM2151SetPortHandler(&DrvYM2151WritePort); + BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); + + K007232Init(0, 3579545, DrvSndROM, 0x40000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback); + K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + konamiExit(); + ZetExit(); + + K007232Exit(); + BurnYM2151Exit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x400); + } + + K052109UpdateScroll(); + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x0040; + } + + K051960SpritesRender(DrvGfxROMExp1, 3); + K052109RenderLayer(1, 0, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 2); + K052109RenderLayer(2, 0, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 1); + K052109RenderLayer(0, 0, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 0); + + K051960SpritesRender(DrvGfxROMExp1, 4); + K051960SpritesRender(DrvGfxROMExp1, 5); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvDips[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; + if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + } + + konamiNewFrame(); + ZetNewFrame(); + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = nBurnSoundLen; + INT32 nCyclesTotal[2] = { 6000000 / 60, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetOpen(0); + konamiOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + + nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); + + nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); + + nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K051960_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + } + } + + konamiClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029704; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + K007232Scan(nAction, pnMin); + + KonamiICScan(nAction); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + set_ram_bank(nDrvRamBank[0]); + aliens_set_lines(nDrvKonamiBank[0]); + konamiClose(); + } + + return 0; +} + + +// Aliens (World set 1) + +static struct BurnRomInfo aliensRomDesc[] = { + { "875_j02.e24", 0x10000, 0x56c20971, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code + { "875_j01.c24", 0x20000, 0x6a529cd6, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "875_b03.g04", 0x08000, 0x1ac4d283, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles + { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 + { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 + { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 + + { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites + { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 + { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 + { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 + + { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples + + { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms +}; + +STD_ROM_PICK(aliens) +STD_ROM_FN(aliens) + +struct BurnDriver BurnDrvAliens = { + "aliens", NULL, NULL, NULL, "1990", + "Aliens (World set 1)\0", NULL, "Konami", "GX875", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, + NULL, aliensRomInfo, aliensRomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 288, 224, 4, 3 +}; + + +// Aliens (World set 2) + +static struct BurnRomInfo aliens2RomDesc[] = { + { "875_p02.e24", 0x10000, 0x4edd707d, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code + { "875_n01.c24", 0x20000, 0x106cf59c, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "875_b03.g04", 0x08000, 0x1ac4d283, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles + { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 + { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 + { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 + + { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites + { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 + { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 + { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 + + { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples + + { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms +}; + +STD_ROM_PICK(aliens2) +STD_ROM_FN(aliens2) + +struct BurnDriver BurnDrvAliens2 = { + "aliens2", "aliens", NULL, NULL, "1990", + "Aliens (World set 2)\0", NULL, "Konami", "GX875", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, + NULL, aliens2RomInfo, aliens2RomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 288, 224, 4, 3 +}; + + +// Aliens (World set 3) + +static struct BurnRomInfo aliens3RomDesc[] = { + { "875_w3_2.e24", 0x10000, 0xf917f7b5, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code + { "875_w3_1.c24", 0x20000, 0x3c0006fb, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "875_b03.g04", 0x08000, 0x1ac4d283, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles + { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 + { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 + { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 + + { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites + { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 + { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 + { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 + + { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples + + { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms +}; + +STD_ROM_PICK(aliens3) +STD_ROM_FN(aliens3) + +struct BurnDriver BurnDrvAliens3 = { + "aliens3", "aliens", NULL, NULL, "1990", + "Aliens (World set 3)\0", NULL, "Konami", "GX875", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, + NULL, aliens3RomInfo, aliens3RomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 288, 224, 4, 3 +}; + + +// Aliens (US) + +static struct BurnRomInfo aliensuRomDesc[] = { + { "875_n02.e24", 0x10000, 0x24dd612e, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code + { "875_n01.c24", 0x20000, 0x106cf59c, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "875_b03.g04", 0x08000, 0x1ac4d283, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles + { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 + { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 + { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 + + { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites + { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 + { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 + { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 + + { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples + + { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms +}; + +STD_ROM_PICK(aliensu) +STD_ROM_FN(aliensu) + +struct BurnDriver BurnDrvAliensu = { + "aliensu", "aliens", NULL, NULL, "1990", + "Aliens (US)\0", NULL, "Konami", "GX875", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, + NULL, aliensuRomInfo, aliensuRomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 288, 224, 4, 3 +}; + + +// Aliens (Japan set 1) + +static struct BurnRomInfo aliensjRomDesc[] = { + { "875_m02.e24", 0x10000, 0x54a774e5, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code + { "875_m01.c24", 0x20000, 0x1663d3dc, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "875_k03.g04", 0x08000, 0xbd86264d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles + { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 + { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 + { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 + + { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites + { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 + { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 + { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 + + { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples + + { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms +}; + +STD_ROM_PICK(aliensj) +STD_ROM_FN(aliensj) + +struct BurnDriver BurnDrvAliensj = { + "aliensj", "aliens", NULL, NULL, "1990", + "Aliens (Japan set 1)\0", NULL, "Konami", "GX875", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, + NULL, aliensjRomInfo, aliensjRomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 288, 224, 4, 3 +}; + + +// Aliens (Japan set 2) + +static struct BurnRomInfo aliensj2RomDesc[] = { + { "875_j2_2.e24", 0x10000, 0x4bb84952, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code + { "875_m01.c24", 0x20000, 0x1663d3dc, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "875_k03.g04", 0x08000, 0xbd86264d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles + { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 + { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 + { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 + + { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites + { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 + { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 + { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 + + { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples + + { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms +}; + +STD_ROM_PICK(aliensj2) +STD_ROM_FN(aliensj2) + +struct BurnDriver BurnDrvAliensj2 = { + "aliensj2", "aliens", NULL, NULL, "1990", + "Aliens (Japan set 2)\0", NULL, "Konami", "GX875", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, + NULL, aliensj2RomInfo, aliensj2RomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 288, 224, 4, 3 +}; + + +// Aliens (Asia) + +static struct BurnRomInfo aliensaRomDesc[] = { + { "875_r02.e24", 0x10000, 0x973e4f11, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code + { "875_m01.c24", 0x20000, 0x1663d3dc, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "875_k03.g04", 0x08000, 0xbd86264d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "875b11.k13", 0x80000, 0x89c5c885, 3 | BRF_GRA }, // 3 Background Tiles + { "875b07.j13", 0x40000, 0xe9c56d66, 3 | BRF_GRA }, // 4 + { "875b12.k19", 0x80000, 0xea6bdc17, 3 | BRF_GRA }, // 5 + { "875b08.j19", 0x40000, 0xf9387966, 3 | BRF_GRA }, // 6 + + { "875b10.k08", 0x80000, 0x0b1035b1, 4 | BRF_GRA }, // 7 Sprites + { "875b06.j08", 0x40000, 0x081a0566, 4 | BRF_GRA }, // 8 + { "875b09.k02", 0x80000, 0xe76b3c19, 4 | BRF_GRA }, // 9 + { "875b05.j02", 0x40000, 0x19a261f2, 4 | BRF_GRA }, // 10 + + { "875b04.e05", 0x40000, 0x4e209ac8, 5 | BRF_SND }, // 11 K007232 Samples + + { "821a08.h14", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 12 Timing Proms +}; + +STD_ROM_PICK(aliensa) +STD_ROM_FN(aliensa) + +struct BurnDriver BurnDrvAliensa = { + "aliensa", "aliens", NULL, NULL, "1990", + "Aliens (Asia)\0", NULL, "Konami", "GX875", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM | GBF_HORSHOOT, 0, + NULL, aliensaRomInfo, aliensaRomName, NULL, NULL, AliensInputInfo, AliensDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 288, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_blockhl.cpp b/src/burn/drv/konami/d_blockhl.cpp index 42b0f97d0..975830037 100644 --- a/src/burn/drv/konami/d_blockhl.cpp +++ b/src/burn/drv/konami/d_blockhl.cpp @@ -1,588 +1,587 @@ -// FB Alpha Block Hole driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvBankRAM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *nDrvKonamiBank; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo BlockhlInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Blockhl) - -static struct BurnDIPInfo BlockhlDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x5f, NULL }, - {0x16, 0xff, 0xff, 0xf0, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x14, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15, "Coin B" }, - {0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x14, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x14, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x14, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x15, 0x01, 0x01, 0x01, "1" }, - {0x15, 0x01, 0x01, 0x00, "2" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Normal" }, - {0x15, 0x01, 0x60, 0x20, "Difficult" }, - {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x16, 0x01, 0x10, 0x10, "Off" }, -// {0x16, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x40, 0x40, "Off" }, - {0x16, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(Blockhl) - -void blockhl_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x1f84: - *soundlatch = data; - return; - - case 0x1f88: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - - case 0x1f8c: - // watchdog - return; - } - - if ((address & 0xc000) == 0x0000) { - K052109_051960_w(address & 0x3fff, data); - return; - } -} - -UINT8 blockhl_main_read(UINT16 address) -{ - switch (address) - { - case 0x1f94: - return DrvDips[2] | (DrvInputs[2] & 0x0f); - - case 0x1f95: - return DrvInputs[0]; - - case 0x1f96: - return DrvInputs[1]; - - case 0x1f97: - return DrvDips[0]; - - case 0x1f98: - return DrvDips[1]; - } - - if ((address & 0xc000) == 0x0000) { - return K052109_051960_r(address & 0x3fff); - } - - return 0; -} - -void __fastcall blockhl_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc000: - BurnYM2151SelectRegister(data); - return; - - case 0xc001: - BurnYM2151WriteRegister(data); - return; - } -} - -UINT8 __fastcall blockhl_sound_read(UINT16 address) -{ - switch (address) - { - case 0xa000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0xc001: - return BurnYM2151ReadStatus(); - } - - return 0; -} - -static void blockhl_set_lines(INT32 lines) -{ - INT32 nBank = (lines & 0x03) * 0x2000; - - konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); - - if (~lines & 0x20) { - konamiMapMemory(DrvPalRAM, 0x5800, 0x5fff, KON_RAM); - } else { - konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); - } - - K052109RMRDLine = lines & 0x40; - - nDrvKonamiBank[0] = lines; -} - -static void K052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - *code |= ((*color & 0x0f) << 8); - *code &= 0xfff; - *color = (layer << 4) + ((*color & 0xe0) >> 5); -} - -static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) -{ - *priority = (*color & 0x10) >> 4; - - *code &= 0x3ff; - *color = 0x30 + (*color & 0x0f); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x010000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x020000; - DrvGfxROM1 = Next; Next += 0x020000; - DrvGfxROMExp0 = Next; Next += 0x040000; - DrvGfxROMExp1 = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); - - AllRam = Next; - - DrvBankRAM = Next; Next += 0x000800; - DrvKonRAM = Next; Next += 0x001800; - DrvPalRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - nDrvKonamiBank = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x20000); - konami_rom_deinterleave_2(DrvGfxROM1, 0x20000); - - GfxDecode(0x01000, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x00400, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvKonROM + 0x000000, 0, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 3, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x010000, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x010001, 5, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x010000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x010001, 9, 2)) return 1; - - DrvGfxDecode(); - } - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvKonRAM, 0x4000, 0x57ff, KON_RAM); - konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x00000, 0x6000, 0x7fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(blockhl_main_write); - konamiSetReadHandler(blockhl_main_read); - konamiSetlinesCallback(blockhl_set_lines); - konamiClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(blockhl_sound_write); - ZetSetReadHandler(blockhl_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); - - K052109Init(DrvGfxROM0, 0x1ffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(8, 0); - - K051960Init(DrvGfxROM1, 0x1ffff); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(8, 0); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - konamiExit(); - ZetExit(); - - BurnYM2151Exit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800); - } - - K052109UpdateScroll(); - - K052109RenderLayer(2, 1, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 0); - K052109RenderLayer(1, 0, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 1); - K052109RenderLayer(0, 0, DrvGfxROMExp0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; - if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - } - - konamiNewFrame(); - ZetNewFrame(); - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 100; - INT32 nCyclesTotal[2] = { (((3000000 / 60) * 133) / 100) /* 33% overclock */, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetOpen(0); - konamiOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - - nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); - - nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); - - nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K052109_irq_enabled && (nDrvKonamiBank[0] & 0x03) == 0) - konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - } - - konamiClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - KonamiICScan(nAction); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - blockhl_set_lines(nDrvKonamiBank[0]); - konamiClose(); - } - - return 0; -} - - -// Block Hole - -static struct BurnRomInfo blockhlRomDesc[] = { - { "973l02.e21", 0x10000, 0xe14f849a, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "973d01.g6", 0x08000, 0xeeee9d92, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "973f07.k15", 0x08000, 0x1a8cd9b4, 3 | BRF_GRA }, // 2 Background Tiles - { "973f08.k18", 0x08000, 0x952b51a6, 3 | BRF_GRA }, // 3 - { "973f09.k20", 0x08000, 0x77841594, 3 | BRF_GRA }, // 4 - { "973f10.k23", 0x08000, 0x09039fab, 3 | BRF_GRA }, // 5 - - { "973f06.k12", 0x08000, 0x51acfdb6, 4 | BRF_GRA }, // 6 Sprites - { "973f05.k9", 0x08000, 0x4cfea298, 4 | BRF_GRA }, // 7 - { "973f04.k7", 0x08000, 0x69ca41bd, 4 | BRF_GRA }, // 8 - { "973f03.k4", 0x08000, 0x21e98472, 4 | BRF_GRA }, // 9 - - { "973a11.h10", 0x00100, 0x46d28fe9, 5 | BRF_OPT }, // 10 Proms -}; - -STD_ROM_PICK(blockhl) -STD_ROM_FN(blockhl) - -struct BurnDriver BurnDrvBlockhl = { - "blockhl", NULL, NULL, NULL, "1989", - "Block Hole\0", NULL, "Konami", "GX973", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_PUZZLE, 0, - NULL, blockhlRomInfo, blockhlRomName, NULL, NULL, BlockhlInputInfo, BlockhlDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; - - -// Quarth (Japan) - -static struct BurnRomInfo quarthRomDesc[] = { - { "973j02.e21", 0x10000, 0x27a90118, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "973d01.g6", 0x08000, 0xeeee9d92, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "973e07.k15", 0x08000, 0x0bd6b0f8, 3 | BRF_GRA }, // 2 Background Tiles - { "973e08.k18", 0x08000, 0x104d0d5f, 3 | BRF_GRA }, // 3 - { "973e09.k20", 0x08000, 0xbd3a6f24, 3 | BRF_GRA }, // 4 - { "973e10.k23", 0x08000, 0xcf5e4b86, 3 | BRF_GRA }, // 5 - - { "973e06.k12", 0x08000, 0x0d58af85, 4 | BRF_GRA }, // 6 Sprites - { "973e05.k9", 0x08000, 0x15d822cb, 4 | BRF_GRA }, // 7 - { "973e04.k7", 0x08000, 0xd70f4a2c, 4 | BRF_GRA }, // 8 - { "973e03.k4", 0x08000, 0x2c5a4b4b, 4 | BRF_GRA }, // 9 - - { "973a11.h10", 0x00100, 0x46d28fe9, 5 | BRF_OPT }, // 10 Proms -}; - -STD_ROM_PICK(quarth) -STD_ROM_FN(quarth) - -struct BurnDriver BurnDrvQuarth = { - "quarth", "blockhl", NULL, NULL, "1989", - "Quarth (Japan)\0", NULL, "Konami", "GX973", - L"Quarth\0\u30AF\u30A9\u30FC\u30B9 (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PUZZLE, 0, - NULL, quarthRomInfo, quarthRomName, NULL, NULL, BlockhlInputInfo, BlockhlDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; +// FB Alpha Block Hole driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvBankRAM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *nDrvKonamiBank; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo BlockhlInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Blockhl) + +static struct BurnDIPInfo BlockhlDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x5f, NULL }, + {0x16, 0xff, 0xff, 0xf0, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x14, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15, "Coin B" }, + {0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x14, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x14, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x14, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x15, 0x01, 0x01, 0x01, "1" }, + {0x15, 0x01, 0x01, 0x00, "2" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Normal" }, + {0x15, 0x01, 0x60, 0x20, "Difficult" }, + {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x16, 0x01, 0x10, 0x10, "Off" }, +// {0x16, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x40, 0x40, "Off" }, + {0x16, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(Blockhl) + +void blockhl_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x1f84: + *soundlatch = data; + return; + + case 0x1f88: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + + case 0x1f8c: + // watchdog + return; + } + + if ((address & 0xc000) == 0x0000) { + K052109_051960_w(address & 0x3fff, data); + return; + } +} + +UINT8 blockhl_main_read(UINT16 address) +{ + switch (address) + { + case 0x1f94: + return DrvDips[2] | (DrvInputs[2] & 0x0f); + + case 0x1f95: + return DrvInputs[0]; + + case 0x1f96: + return DrvInputs[1]; + + case 0x1f97: + return DrvDips[0]; + + case 0x1f98: + return DrvDips[1]; + } + + if ((address & 0xc000) == 0x0000) { + return K052109_051960_r(address & 0x3fff); + } + + return 0; +} + +void __fastcall blockhl_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc000: + BurnYM2151SelectRegister(data); + return; + + case 0xc001: + BurnYM2151WriteRegister(data); + return; + } +} + +UINT8 __fastcall blockhl_sound_read(UINT16 address) +{ + switch (address) + { + case 0xa000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0xc001: + return BurnYM2151ReadStatus(); + } + + return 0; +} + +static void blockhl_set_lines(INT32 lines) +{ + INT32 nBank = (lines & 0x03) * 0x2000; + + konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); + + if (~lines & 0x20) { + konamiMapMemory(DrvPalRAM, 0x5800, 0x5fff, KON_RAM); + } else { + konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); + } + + K052109RMRDLine = lines & 0x40; + + nDrvKonamiBank[0] = lines; +} + +static void K052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + *code |= ((*color & 0x0f) << 8); + *code &= 0xfff; + *color = (layer << 4) + ((*color & 0xe0) >> 5); +} + +static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) +{ + *priority = (*color & 0x10) >> 4; + + *code &= 0x3ff; + *color = 0x30 + (*color & 0x0f); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x010000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x020000; + DrvGfxROM1 = Next; Next += 0x020000; + DrvGfxROMExp0 = Next; Next += 0x040000; + DrvGfxROMExp1 = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); + + AllRam = Next; + + DrvBankRAM = Next; Next += 0x000800; + DrvKonRAM = Next; Next += 0x001800; + DrvPalRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + nDrvKonamiBank = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x20000); + konami_rom_deinterleave_2(DrvGfxROM1, 0x20000); + + GfxDecode(0x01000, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x00400, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvKonROM + 0x000000, 0, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 3, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x010000, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x010001, 5, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x010000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x010001, 9, 2)) return 1; + + DrvGfxDecode(); + } + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvKonRAM, 0x4000, 0x57ff, KON_RAM); + konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x00000, 0x6000, 0x7fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(blockhl_main_write); + konamiSetReadHandler(blockhl_main_read); + konamiSetlinesCallback(blockhl_set_lines); + konamiClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(blockhl_sound_write); + ZetSetReadHandler(blockhl_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); + + K052109Init(DrvGfxROM0, 0x1ffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(8, 0); + + K051960Init(DrvGfxROM1, 0x1ffff); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(8, 0); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + konamiExit(); + ZetExit(); + + BurnYM2151Exit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800); + } + + K052109UpdateScroll(); + + K052109RenderLayer(2, 1, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 0); + K052109RenderLayer(1, 0, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 1); + K052109RenderLayer(0, 0, DrvGfxROMExp0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; + if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + } + + konamiNewFrame(); + ZetNewFrame(); + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 100; + INT32 nCyclesTotal[2] = { (((3000000 / 60) * 133) / 100) /* 33% overclock */, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetOpen(0); + konamiOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + + nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); + + nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); + + nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K052109_irq_enabled && (nDrvKonamiBank[0] & 0x03) == 0) + konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + } + + konamiClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + KonamiICScan(nAction); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + blockhl_set_lines(nDrvKonamiBank[0]); + konamiClose(); + } + + return 0; +} + + +// Block Hole + +static struct BurnRomInfo blockhlRomDesc[] = { + { "973l02.e21", 0x10000, 0xe14f849a, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "973d01.g6", 0x08000, 0xeeee9d92, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "973f07.k15", 0x08000, 0x1a8cd9b4, 3 | BRF_GRA }, // 2 Background Tiles + { "973f08.k18", 0x08000, 0x952b51a6, 3 | BRF_GRA }, // 3 + { "973f09.k20", 0x08000, 0x77841594, 3 | BRF_GRA }, // 4 + { "973f10.k23", 0x08000, 0x09039fab, 3 | BRF_GRA }, // 5 + + { "973f06.k12", 0x08000, 0x51acfdb6, 4 | BRF_GRA }, // 6 Sprites + { "973f05.k9", 0x08000, 0x4cfea298, 4 | BRF_GRA }, // 7 + { "973f04.k7", 0x08000, 0x69ca41bd, 4 | BRF_GRA }, // 8 + { "973f03.k4", 0x08000, 0x21e98472, 4 | BRF_GRA }, // 9 + + { "973a11.h10", 0x00100, 0x46d28fe9, 5 | BRF_OPT }, // 10 Proms +}; + +STD_ROM_PICK(blockhl) +STD_ROM_FN(blockhl) + +struct BurnDriver BurnDrvBlockhl = { + "blockhl", NULL, NULL, NULL, "1989", + "Block Hole\0", NULL, "Konami", "GX973", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_PUZZLE, 0, + NULL, blockhlRomInfo, blockhlRomName, NULL, NULL, BlockhlInputInfo, BlockhlDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; + + +// Quarth (Japan) + +static struct BurnRomInfo quarthRomDesc[] = { + { "973j02.e21", 0x10000, 0x27a90118, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "973d01.g6", 0x08000, 0xeeee9d92, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "973e07.k15", 0x08000, 0x0bd6b0f8, 3 | BRF_GRA }, // 2 Background Tiles + { "973e08.k18", 0x08000, 0x104d0d5f, 3 | BRF_GRA }, // 3 + { "973e09.k20", 0x08000, 0xbd3a6f24, 3 | BRF_GRA }, // 4 + { "973e10.k23", 0x08000, 0xcf5e4b86, 3 | BRF_GRA }, // 5 + + { "973e06.k12", 0x08000, 0x0d58af85, 4 | BRF_GRA }, // 6 Sprites + { "973e05.k9", 0x08000, 0x15d822cb, 4 | BRF_GRA }, // 7 + { "973e04.k7", 0x08000, 0xd70f4a2c, 4 | BRF_GRA }, // 8 + { "973e03.k4", 0x08000, 0x2c5a4b4b, 4 | BRF_GRA }, // 9 + + { "973a11.h10", 0x00100, 0x46d28fe9, 5 | BRF_OPT }, // 10 Proms +}; + +STD_ROM_PICK(quarth) +STD_ROM_FN(quarth) + +struct BurnDriver BurnDrvQuarth = { + "quarth", "blockhl", NULL, NULL, "1989", + "Quarth (Japan)\0", NULL, "Konami", "GX973", + L"Quarth\0\u30AF\u30A9\u30FC\u30B9 (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PUZZLE, 0, + NULL, quarthRomInfo, quarthRomName, NULL, NULL, BlockhlInputInfo, BlockhlDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_bottom9.cpp b/src/burn/drv/konami/d_bottom9.cpp index 3e091d983..3ba0e5f4f 100644 --- a/src/burn/drv/konami/d_bottom9.cpp +++ b/src/burn/drv/konami/d_bottom9.cpp @@ -1,929 +1,928 @@ -// FB Alpha Bottom of the Nineth driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "konamiic.h" -#include "k007232.h" -#include "m6809_intf.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvM6809ROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvGfxROMExp2; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *DrvM6809RAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *nmi_enable; -static UINT8 *nDrvBank; - -static INT32 bottom9_video_enable; -static INT32 zoomreadroms; -static INT32 K052109_selected; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvReset; -static UINT8 DrvInputs[3]; - -static struct BurnInputInfo Bottom9InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 1, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 4, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 1, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 4, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Bottom9) - -static struct BurnDIPInfo Bottom9DIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x4c, NULL }, - {0x14, 0xff, 0xff, 0xf0, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x00, "4 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x00, "4 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 8, "Play Time" }, - {0x13, 0x01, 0x07, 0x07, "1'00" }, - {0x13, 0x01, 0x07, 0x06, "1'10" }, - {0x13, 0x01, 0x07, 0x05, "1'20" }, - {0x13, 0x01, 0x07, 0x04, "1'30" }, - {0x13, 0x01, 0x07, 0x03, "1'40" }, - {0x13, 0x01, 0x07, 0x02, "1'50" }, - {0x13, 0x01, 0x07, 0x01, "2'00" }, - {0x13, 0x01, 0x07, 0x00, "2'10" }, - - {0 , 0xfe, 0 , 4, "Bonus Time" }, - {0x13, 0x01, 0x18, 0x18, "00" }, - {0x13, 0x01, 0x18, 0x10, "20" }, - {0x13, 0x01, 0x18, 0x08, "30" }, - {0x13, 0x01, 0x18, 0x00, "40" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x10, 0x10, "Off" }, -// {0x14, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Fielder Control" }, - {0x14, 0x01, 0x80, 0x80, "Normal" }, - {0x14, 0x01, 0x80, 0x00, "Auto" }, -}; - -STDDIPINFO(Bottom9) - -static struct BurnDIPInfo MstadiumDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x49, NULL }, - {0x14, 0xff, 0xff, 0xf0, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x00, "4 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x00, "4 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Play Inning" }, - {0x13, 0x01, 0x03, 0x03, "1 Inning" }, - {0x13, 0x01, 0x03, 0x02, "2 Inning" }, - {0x13, 0x01, 0x03, 0x01, "3 Inning" }, - {0x13, 0x01, 0x03, 0x00, "4 Inning" }, - - {0 , 0xfe, 0 , 4, "Play Inning Time" }, - {0x13, 0x01, 0x0c, 0x0c, "06 Min" }, - {0x13, 0x01, 0x0c, 0x08, "08 Min" }, - {0x13, 0x01, 0x0c, 0x04, "10 Min" }, - {0x13, 0x01, 0x0c, 0x00, "12 Min" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x10, 0x10, "Off" }, -// {0x14, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Fielder Control" }, - {0x14, 0x01, 0x80, 0x80, "Normal" }, - {0x14, 0x01, 0x80, 0x00, "Auto" }, -}; - -STDDIPINFO(Mstadium) - -static void bankswitch(INT32 data) -{ - nDrvBank[0] = data; - - INT32 offs = 0x10000 + (data & 0x1e) * 0x1000; - - M6809MapMemory(DrvM6809ROM + offs, 0x6000, 0x7fff, M6809_ROM); -} - -void bottom9_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x1f80: - bankswitch(data); - return; - - case 0x1f90: - { - K052109RMRDLine = data & 0x04; - bottom9_video_enable = ~data & 0x08; - zoomreadroms = data & 0x10; - K052109_selected = data & 0x20; - } - return; - - case 0x1fa0: - // watchdog - return; - - case 0x1fb0: - *soundlatch = data; - return; - - case 0x1fc0: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - } - - if ((address & 0xfff0) == 0x1ff0) { - K051316WriteCtrl(0, address & 0x0f, data); - return; - } - - if (K052109_selected == 0) { - if ((address & 0xf800) == 0x0000) { - K051316Write(0, address & 0x7ff, data); - return; - } - - if ((address & 0xf800) == 0x2000) { - DrvPalRAM[address & 0x7ff] = data; - return; - } - } - - if ((address & 0xc000) == 0x0000) { - K052109_051960_w(address & 0x3fff, data); - return; - } -} - -UINT8 bottom9_main_read(UINT16 address) -{ - switch (address) - { - case 0x1fd0: - return (DrvInputs[2] & 0x0f) | (DrvDips[2] & 0xf0); - - case 0x1fd1: - return DrvInputs[0]; - - case 0x1fd2: - return DrvInputs[1]; - - case 0x1fd3: - return DrvDips[0]; - - case 0x1fe0: - return DrvDips[1]; - } - - - if (K052109_selected == 0) { - if ((address & 0xf800) == 0x0000) { - if (zoomreadroms) - return K051316ReadRom(0, address & 0x7ff); - else - return K051316Read(0, address & 0x7ff); - } - - if ((address & 0xf800) == 0x2000) { - return DrvPalRAM[address & 0x7ff]; - } - } - - if ((address & 0xc000) == 0x0000) { - return K052109_051960_r(address & 0x3fff); - } - - return 0; -} - -static void sound_bank_w(INT32 data) -{ - k007232_set_bank(0, (data >> 0) & 0x03, (data >> 2) & 0x03); - k007232_set_bank(1, (data >> 4) & 0x03, (data >> 6) & 0x03); -} - -void __fastcall bottom9_sound_write(UINT16 address, UINT8 data) -{ - if ((address & 0xfff0) == 0xa000) { - K007232WriteReg(0, address & 0x0f, data); - return; - } - - if ((address & 0xfff0) == 0xb000) { - K007232WriteReg(1, address & 0x0f, data); - return; - } - - switch (address) - { - case 0x9000: - sound_bank_w(data); - return; - - case 0xf000: - *nmi_enable = data; - return; - } -} - -UINT8 __fastcall bottom9_sound_read(UINT16 address) -{ - if ((address & 0xfff0) == 0xa000) { - return K007232ReadReg(0, address & 0x0f); - } - - if ((address & 0xfff0) == 0xb000) { - return K007232ReadReg(1, address & 0x0f); - } - - switch (address) - { - case 0xd000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -static void K052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - *code |= (*color & 0x3f) << 8; - *color = ((layer & 2) << 3) | ((*color & 0xc0) >> 6); -} - -static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) -{ - *priority = (*color & 0x30) >> 4; - *color = 0x20 + (*color & 0x0f); - *code &= 0x1fff; -} - -static void K051316Callback(INT32 *code,INT32 *color,INT32 *flags) -{ - *flags = (*color & 0x40) >> 6; - *code |= ((*color & 0x03) << 8); - *color = 0x30 | ((*color & 0x3c) >> 2); -} - -static void DrvK007232VolCallback0(int v) -{ - K007232SetVolume(0,0,(v >> 4) * 0x11,0); - K007232SetVolume(0,1,0,(v & 0x0f) * 0x11); -} - -static void DrvK007232VolCallback1(INT32 v) -{ - K007232SetVolume(1,0,(v >> 4) * 0x11,0); - K007232SetVolume(1,1,0,(v & 0x0f) * 0x11); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - M6809Open(0); - M6809Reset(); - M6809Close(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - KonamiICReset(); - - bottom9_video_enable = 0; - zoomreadroms = 0; - K052109_selected = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvM6809ROM = Next; Next += 0x030000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x080000; - DrvGfxROM1 = Next; Next += 0x100000; - DrvGfxROM2 = Next; Next += 0x020000; - DrvGfxROMExp0 = Next; Next += 0x100000; - DrvGfxROMExp1 = Next; Next += 0x200000; - DrvGfxROMExp2 = Next; Next += 0x040000; - - DrvSndROM0 = Next; Next += 0x040000; - DrvSndROM1 = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); - - AllRam = Next; - - DrvM6809RAM = Next; Next += 0x002000; - DrvPalRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - nmi_enable = Next; Next += 0x000001; - nDrvBank = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs0[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x080000); - konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); - - GfxDecode(0x04000, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x100, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x02000, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvM6809ROM + 0x010000, 0, 1)) return 1; - if (BurnLoadRom(DrvM6809ROM + 0x000000, 1, 1)) return 1; - memcpy (DrvM6809ROM + 0x20000, DrvM6809ROM + 0x00000, 0x8000); - memcpy (DrvM6809ROM + 0x28000, DrvM6809ROM + 0x00000, 0x8000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x020000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x020001, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040001, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060000, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060001, 10, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 11, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020001, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 15, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040001, 16, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060000, 17, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060001, 18, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 19, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080001, 20, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0a0000, 21, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0a0001, 22, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 23, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 24, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0e0000, 25, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0e0001, 26, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 27, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x010000, 28, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 29, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x010000, 30, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x020000, 31, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x030000, 32, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x000000, 33, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x010000, 34, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x020000, 35, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x030000, 36, 1)) return 1; - - DrvGfxDecode(); - } - - M6809Init(1); - M6809Open(0); - M6809MapMemory(DrvM6809RAM, 0x4000, 0x5fff, M6809_RAM); - M6809MapMemory(DrvM6809ROM + 0x10000, 0x6000, 0x7fff, M6809_ROM); - M6809MapMemory(DrvM6809ROM + 0x08000, 0x8000, 0xffff, M6809_ROM); - M6809SetWriteHandler(bottom9_main_write); - M6809SetReadHandler(bottom9_main_read); - M6809Close(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(bottom9_sound_write); - ZetSetReadHandler(bottom9_sound_read); - ZetMemEnd(); - ZetClose(); - - K007232Init(0, 3579545, DrvSndROM0, 0x40000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback0); - K007232PCMSetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); - - K007232Init(1, 3579545, DrvSndROM1, 0x40000); - K007232SetPortWriteHandler(1, DrvK007232VolCallback1); - K007232PCMSetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); - - K052109Init(DrvGfxROM0, 0x7ffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(8, 0); - - K051960Init(DrvGfxROM1, 0xfffff); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(8, 0); - - K051316Init(0, DrvGfxROM2, DrvGfxROMExp2, 0x1ffff, K051316Callback, 4, 0); - K051316SetOffset(0, -112, -16); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - M6809Exit(); - ZetExit(); - - K007232Exit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800); - } - - K052109UpdateScroll(); - - BurnTransferClear(); - - K051960SpritesRender(DrvGfxROMExp1, 1); - K051316_zoom_draw(0, 0); - K051960SpritesRender(DrvGfxROMExp1, 0); - K052109RenderLayer(2, 0, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 2); - K051960SpritesRender(DrvGfxROMExp1, 3); - K052109RenderLayer(1, 0, DrvGfxROMExp0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[0] & 0x06) == 0) DrvInputs[0] |= 0x06; - if ((DrvInputs[0] & 0x18) == 0) DrvInputs[0] |= 0x18; - if ((DrvInputs[1] & 0x06) == 0) DrvInputs[1] |= 0x06; - if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18; - } - - INT32 nInterleave = 8; - INT32 nCyclesTotal[2] = { 2000000 / 60, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetOpen(0); - M6809Open(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - - nCyclesDone[0] += M6809Run(nSegment - nCyclesDone[0]); - - nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); - - nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); - if (*nmi_enable) ZetNmi(); - } - - if (K052109_irq_enabled) M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - memset(pBurnSoundOut, 0, nBurnSoundLen * sizeof(INT16) * 2); - K007232Update(0, pBurnSoundOut, nBurnSoundLen); - K007232Update(1, pBurnSoundOut, nBurnSoundLen); - } - - M6809Close(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - M6809Scan(nAction); - ZetScan(nAction); - - K007232Scan(nAction, pnMin); - - KonamiICScan(nAction); - - SCAN_VAR(bottom9_video_enable); - SCAN_VAR(zoomreadroms); - SCAN_VAR(K052109_selected); - } - - if (nAction & ACB_WRITE) { - M6809Open(0); - bankswitch(nDrvBank[0]); - M6809Close(); - } - - return 0; -} - - -// Bottom of the Ninth (ver. T) - -static struct BurnRomInfo bottom9RomDesc[] = { - { "891n03.k17", 0x10000, 0x8b083ff3, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code - { "891-t02.k15", 0x10000, 0x2c10ced2, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "891j01.g8", 0x08000, 0x31b0a0a8, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "891e10c", 0x10000, 0x209b0431, 3 | BRF_GRA }, // 3 K052109 Tiles - { "891e10a", 0x10000, 0x8020a9e8, 3 | BRF_GRA }, // 4 - { "891e10d", 0x10000, 0x16d5fd7a, 3 | BRF_GRA }, // 5 - { "891e10b", 0x10000, 0x30121cc0, 3 | BRF_GRA }, // 6 - { "891e09c", 0x10000, 0x9dcaefbf, 3 | BRF_GRA }, // 7 - { "891e09a", 0x10000, 0x56b0ead9, 3 | BRF_GRA }, // 8 - { "891e09d", 0x10000, 0x4e1335e6, 3 | BRF_GRA }, // 9 - { "891e09b", 0x10000, 0xb6f914fb, 3 | BRF_GRA }, // 10 - - { "891e06e", 0x10000, 0x0b04db1c, 4 | BRF_GRA }, // 11 K051960 Tiles - { "891e06a", 0x10000, 0x5ee37327, 4 | BRF_GRA }, // 12 - { "891e06f", 0x10000, 0xf9ada524, 4 | BRF_GRA }, // 13 - { "891e06b", 0x10000, 0x2295dfaa, 4 | BRF_GRA }, // 14 - { "891e06g", 0x10000, 0x04abf78f, 4 | BRF_GRA }, // 15 - { "891e06c", 0x10000, 0xdbdb0d55, 4 | BRF_GRA }, // 16 - { "891e06h", 0x10000, 0x5d5ded8c, 4 | BRF_GRA }, // 17 - { "891e06d", 0x10000, 0xf9ecbd71, 4 | BRF_GRA }, // 18 - { "891e05e", 0x10000, 0xb356e729, 4 | BRF_GRA }, // 19 - { "891e05a", 0x10000, 0xbfd5487e, 4 | BRF_GRA }, // 20 - { "891e05f", 0x10000, 0xecdd11c5, 4 | BRF_GRA }, // 21 - { "891e05b", 0x10000, 0xaba18d24, 4 | BRF_GRA }, // 22 - { "891e05g", 0x10000, 0xc315f9ae, 4 | BRF_GRA }, // 23 - { "891e05c", 0x10000, 0x21fcbc6f, 4 | BRF_GRA }, // 24 - { "891e05h", 0x10000, 0xb0aba53b, 4 | BRF_GRA }, // 25 - { "891e05d", 0x10000, 0xf6d3f886, 4 | BRF_GRA }, // 26 - - { "891e07a", 0x10000, 0xb8d8b939, 5 | BRF_GRA }, // 27 K051316 Tiles - { "891e07b", 0x10000, 0x83b2f92d, 5 | BRF_GRA }, // 28 - - { "891e08a", 0x10000, 0xcef667bf, 6 | BRF_GRA }, // 29 K007232 #0 Samples - { "891e08b", 0x10000, 0xf7c14a7a, 6 | BRF_GRA }, // 30 - { "891e08c", 0x10000, 0x756b7f3c, 6 | BRF_GRA }, // 31 - { "891e08d", 0x10000, 0xcd0d7305, 6 | BRF_GRA }, // 32 - - { "891e04a", 0x10000, 0xdaebbc74, 7 | BRF_GRA }, // 33 K007232 #1 Samples - { "891e04b", 0x10000, 0x5ffb9ad1, 7 | BRF_GRA }, // 34 - { "891e04c", 0x10000, 0x2dbbf16b, 7 | BRF_GRA }, // 35 - { "891e04d", 0x10000, 0x8b0cd2cc, 7 | BRF_GRA }, // 36 - - { "891b11.f23", 0x00100, 0xecb854aa, 8 | BRF_OPT }, // 37 Priority Proms -}; - -STD_ROM_PICK(bottom9) -STD_ROM_FN(bottom9) - -struct BurnDriver BurnDrvBottom9 = { - "bottom9", NULL, NULL, NULL, "1989", - "Bottom of the Ninth (ver. T)\0", NULL, "Konami", "GX891", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, bottom9RomInfo, bottom9RomName, NULL, NULL, Bottom9InputInfo, Bottom9DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; - - -// Bottom of the Ninth (ver. N) - -static struct BurnRomInfo bottom9nRomDesc[] = { - { "891n03.k17", 0x10000, 0x8b083ff3, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code - { "891n02.k15", 0x10000, 0xd44d9ed4, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "891j01.g8", 0x08000, 0x31b0a0a8, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "891e10c", 0x10000, 0x209b0431, 3 | BRF_GRA }, // 3 K052109 Tiles - { "891e10a", 0x10000, 0x8020a9e8, 3 | BRF_GRA }, // 4 - { "891e10d", 0x10000, 0x16d5fd7a, 3 | BRF_GRA }, // 5 - { "891e10b", 0x10000, 0x30121cc0, 3 | BRF_GRA }, // 6 - { "891e09c", 0x10000, 0x9dcaefbf, 3 | BRF_GRA }, // 7 - { "891e09a", 0x10000, 0x56b0ead9, 3 | BRF_GRA }, // 8 - { "891e09d", 0x10000, 0x4e1335e6, 3 | BRF_GRA }, // 9 - { "891e09b", 0x10000, 0xb6f914fb, 3 | BRF_GRA }, // 10 - - { "891e06e", 0x10000, 0x0b04db1c, 4 | BRF_GRA }, // 11 K051960 Tiles - { "891e06a", 0x10000, 0x5ee37327, 4 | BRF_GRA }, // 12 - { "891e06f", 0x10000, 0xf9ada524, 4 | BRF_GRA }, // 13 - { "891e06b", 0x10000, 0x2295dfaa, 4 | BRF_GRA }, // 14 - { "891e06g", 0x10000, 0x04abf78f, 4 | BRF_GRA }, // 15 - { "891e06c", 0x10000, 0xdbdb0d55, 4 | BRF_GRA }, // 16 - { "891e06h", 0x10000, 0x5d5ded8c, 4 | BRF_GRA }, // 17 - { "891e06d", 0x10000, 0xf9ecbd71, 4 | BRF_GRA }, // 18 - { "891e05e", 0x10000, 0xb356e729, 4 | BRF_GRA }, // 19 - { "891e05a", 0x10000, 0xbfd5487e, 4 | BRF_GRA }, // 20 - { "891e05f", 0x10000, 0xecdd11c5, 4 | BRF_GRA }, // 21 - { "891e05b", 0x10000, 0xaba18d24, 4 | BRF_GRA }, // 22 - { "891e05g", 0x10000, 0xc315f9ae, 4 | BRF_GRA }, // 23 - { "891e05c", 0x10000, 0x21fcbc6f, 4 | BRF_GRA }, // 24 - { "891e05h", 0x10000, 0xb0aba53b, 4 | BRF_GRA }, // 25 - { "891e05d", 0x10000, 0xf6d3f886, 4 | BRF_GRA }, // 26 - - { "891e07a", 0x10000, 0xb8d8b939, 5 | BRF_GRA }, // 27 K051316 Tiles - { "891e07b", 0x10000, 0x83b2f92d, 5 | BRF_GRA }, // 28 - - { "891e08a", 0x10000, 0xcef667bf, 6 | BRF_GRA }, // 29 K007232 #0 Samples - { "891e08b", 0x10000, 0xf7c14a7a, 6 | BRF_GRA }, // 30 - { "891e08c", 0x10000, 0x756b7f3c, 6 | BRF_GRA }, // 31 - { "891e08d", 0x10000, 0xcd0d7305, 6 | BRF_GRA }, // 32 - - { "891e04a", 0x10000, 0xdaebbc74, 7 | BRF_GRA }, // 33 K007232 #1 Samples - { "891e04b", 0x10000, 0x5ffb9ad1, 7 | BRF_GRA }, // 34 - { "891e04c", 0x10000, 0x2dbbf16b, 7 | BRF_GRA }, // 35 - { "891e04d", 0x10000, 0x8b0cd2cc, 7 | BRF_GRA }, // 36 - - { "891b11.f23", 0x00100, 0xecb854aa, 8 | BRF_OPT }, // 37 Priority Proms -}; - -STD_ROM_PICK(bottom9n) -STD_ROM_FN(bottom9n) - -struct BurnDriver BurnDrvBottom9n = { - "bottom9n", "bottom9", NULL, NULL, "1989", - "Bottom of the Ninth (ver. N)\0", NULL, "Konami", "GX891", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, bottom9nRomInfo, bottom9nRomName, NULL, NULL, Bottom9InputInfo, Bottom9DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; - - -// Main Stadium (Japan ver. 4) - -static struct BurnRomInfo mstadiumRomDesc[] = { - { "891-403.k17", 0x10000, 0x1c00c4e8, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code - { "891-402.k15", 0x10000, 0xb850bbce, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "891w01.g8", 0x08000, 0xedec565a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "891e10c", 0x10000, 0x209b0431, 3 | BRF_GRA }, // 3 K052109 Tiles - { "891e10a", 0x10000, 0x8020a9e8, 3 | BRF_GRA }, // 4 - { "891e10d", 0x10000, 0x16d5fd7a, 3 | BRF_GRA }, // 5 - { "891e10b", 0x10000, 0x30121cc0, 3 | BRF_GRA }, // 6 - { "891e09c", 0x10000, 0x9dcaefbf, 3 | BRF_GRA }, // 7 - { "891e09a", 0x10000, 0x56b0ead9, 3 | BRF_GRA }, // 8 - { "891e09d", 0x10000, 0x4e1335e6, 3 | BRF_GRA }, // 9 - { "891e09b", 0x10000, 0xb6f914fb, 3 | BRF_GRA }, // 10 - - { "891e06e", 0x10000, 0x0b04db1c, 4 | BRF_GRA }, // 11 K051960 Tiles - { "891e06a", 0x10000, 0x5ee37327, 4 | BRF_GRA }, // 12 - { "891e06f", 0x10000, 0xf9ada524, 4 | BRF_GRA }, // 13 - { "891e06b", 0x10000, 0x2295dfaa, 4 | BRF_GRA }, // 14 - { "891e06g", 0x10000, 0x04abf78f, 4 | BRF_GRA }, // 15 - { "891e06c", 0x10000, 0xdbdb0d55, 4 | BRF_GRA }, // 16 - { "891e06h", 0x10000, 0x5d5ded8c, 4 | BRF_GRA }, // 17 - { "891e06d", 0x10000, 0xf9ecbd71, 4 | BRF_GRA }, // 18 - { "891e05e", 0x10000, 0xb356e729, 4 | BRF_GRA }, // 19 - { "891e05a", 0x10000, 0xbfd5487e, 4 | BRF_GRA }, // 20 - { "891e05f", 0x10000, 0xecdd11c5, 4 | BRF_GRA }, // 21 - { "891e05b", 0x10000, 0xaba18d24, 4 | BRF_GRA }, // 22 - { "891e05g", 0x10000, 0xc315f9ae, 4 | BRF_GRA }, // 23 - { "891e05c", 0x10000, 0x21fcbc6f, 4 | BRF_GRA }, // 24 - { "891e05h", 0x10000, 0xb0aba53b, 4 | BRF_GRA }, // 25 - { "891e05d", 0x10000, 0xf6d3f886, 4 | BRF_GRA }, // 26 - - { "891e07a", 0x10000, 0xb8d8b939, 5 | BRF_GRA }, // 27 K051316 Tiles - { "891e07b", 0x10000, 0x83b2f92d, 5 | BRF_GRA }, // 28 - - { "891e08a", 0x10000, 0xcef667bf, 6 | BRF_GRA }, // 29 K007232 #0 Samples - { "891e08b", 0x10000, 0xf7c14a7a, 6 | BRF_GRA }, // 30 - { "891e08c", 0x10000, 0x756b7f3c, 6 | BRF_GRA }, // 31 - { "891e08d", 0x10000, 0xcd0d7305, 6 | BRF_GRA }, // 32 - - { "891e04a", 0x10000, 0xdaebbc74, 7 | BRF_GRA }, // 33 K007232 #1 Samples - { "891e04b", 0x10000, 0x5ffb9ad1, 7 | BRF_GRA }, // 34 - { "891e04c", 0x10000, 0x2dbbf16b, 7 | BRF_GRA }, // 35 - { "891e04d", 0x10000, 0x8b0cd2cc, 7 | BRF_GRA }, // 36 - - { "891b11.f23", 0x00100, 0xecb854aa, 8 | BRF_OPT }, // 37 Priority Proms -}; - -STD_ROM_PICK(mstadium) -STD_ROM_FN(mstadium) - -struct BurnDriver BurnDrvMstadium = { - "mstadium", "bottom9", NULL, NULL, "1989", - "Main Stadium (Japan ver. 4)\0", NULL, "Konami", "GX891", - L"Main Stadium\0\u30E1\u30A4\u30F3\u30B9\u30BF\u30B8\u30A2\u30E0 (Japan ver. 4)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, mstadiumRomInfo, mstadiumRomName, NULL, NULL, Bottom9InputInfo, MstadiumDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; +// FB Alpha Bottom of the Nineth driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "konamiic.h" +#include "k007232.h" +#include "m6809_intf.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvM6809ROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvGfxROMExp2; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *DrvM6809RAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *nmi_enable; +static UINT8 *nDrvBank; + +static INT32 bottom9_video_enable; +static INT32 zoomreadroms; +static INT32 K052109_selected; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvReset; +static UINT8 DrvInputs[3]; + +static struct BurnInputInfo Bottom9InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 1, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 4, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 1, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 4, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Bottom9) + +static struct BurnDIPInfo Bottom9DIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x4c, NULL }, + {0x14, 0xff, 0xff, 0xf0, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x00, "4 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x00, "4 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 8, "Play Time" }, + {0x13, 0x01, 0x07, 0x07, "1'00" }, + {0x13, 0x01, 0x07, 0x06, "1'10" }, + {0x13, 0x01, 0x07, 0x05, "1'20" }, + {0x13, 0x01, 0x07, 0x04, "1'30" }, + {0x13, 0x01, 0x07, 0x03, "1'40" }, + {0x13, 0x01, 0x07, 0x02, "1'50" }, + {0x13, 0x01, 0x07, 0x01, "2'00" }, + {0x13, 0x01, 0x07, 0x00, "2'10" }, + + {0 , 0xfe, 0 , 4, "Bonus Time" }, + {0x13, 0x01, 0x18, 0x18, "00" }, + {0x13, 0x01, 0x18, 0x10, "20" }, + {0x13, 0x01, 0x18, 0x08, "30" }, + {0x13, 0x01, 0x18, 0x00, "40" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x10, 0x10, "Off" }, +// {0x14, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Fielder Control" }, + {0x14, 0x01, 0x80, 0x80, "Normal" }, + {0x14, 0x01, 0x80, 0x00, "Auto" }, +}; + +STDDIPINFO(Bottom9) + +static struct BurnDIPInfo MstadiumDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x49, NULL }, + {0x14, 0xff, 0xff, 0xf0, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x00, "4 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x00, "4 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Play Inning" }, + {0x13, 0x01, 0x03, 0x03, "1 Inning" }, + {0x13, 0x01, 0x03, 0x02, "2 Inning" }, + {0x13, 0x01, 0x03, 0x01, "3 Inning" }, + {0x13, 0x01, 0x03, 0x00, "4 Inning" }, + + {0 , 0xfe, 0 , 4, "Play Inning Time" }, + {0x13, 0x01, 0x0c, 0x0c, "06 Min" }, + {0x13, 0x01, 0x0c, 0x08, "08 Min" }, + {0x13, 0x01, 0x0c, 0x04, "10 Min" }, + {0x13, 0x01, 0x0c, 0x00, "12 Min" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x10, 0x10, "Off" }, +// {0x14, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Fielder Control" }, + {0x14, 0x01, 0x80, 0x80, "Normal" }, + {0x14, 0x01, 0x80, 0x00, "Auto" }, +}; + +STDDIPINFO(Mstadium) + +static void bankswitch(INT32 data) +{ + nDrvBank[0] = data; + + INT32 offs = 0x10000 + (data & 0x1e) * 0x1000; + + M6809MapMemory(DrvM6809ROM + offs, 0x6000, 0x7fff, M6809_ROM); +} + +void bottom9_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x1f80: + bankswitch(data); + return; + + case 0x1f90: + { + K052109RMRDLine = data & 0x04; + bottom9_video_enable = ~data & 0x08; + zoomreadroms = data & 0x10; + K052109_selected = data & 0x20; + } + return; + + case 0x1fa0: + // watchdog + return; + + case 0x1fb0: + *soundlatch = data; + return; + + case 0x1fc0: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + } + + if ((address & 0xfff0) == 0x1ff0) { + K051316WriteCtrl(0, address & 0x0f, data); + return; + } + + if (K052109_selected == 0) { + if ((address & 0xf800) == 0x0000) { + K051316Write(0, address & 0x7ff, data); + return; + } + + if ((address & 0xf800) == 0x2000) { + DrvPalRAM[address & 0x7ff] = data; + return; + } + } + + if ((address & 0xc000) == 0x0000) { + K052109_051960_w(address & 0x3fff, data); + return; + } +} + +UINT8 bottom9_main_read(UINT16 address) +{ + switch (address) + { + case 0x1fd0: + return (DrvInputs[2] & 0x0f) | (DrvDips[2] & 0xf0); + + case 0x1fd1: + return DrvInputs[0]; + + case 0x1fd2: + return DrvInputs[1]; + + case 0x1fd3: + return DrvDips[0]; + + case 0x1fe0: + return DrvDips[1]; + } + + + if (K052109_selected == 0) { + if ((address & 0xf800) == 0x0000) { + if (zoomreadroms) + return K051316ReadRom(0, address & 0x7ff); + else + return K051316Read(0, address & 0x7ff); + } + + if ((address & 0xf800) == 0x2000) { + return DrvPalRAM[address & 0x7ff]; + } + } + + if ((address & 0xc000) == 0x0000) { + return K052109_051960_r(address & 0x3fff); + } + + return 0; +} + +static void sound_bank_w(INT32 data) +{ + k007232_set_bank(0, (data >> 0) & 0x03, (data >> 2) & 0x03); + k007232_set_bank(1, (data >> 4) & 0x03, (data >> 6) & 0x03); +} + +void __fastcall bottom9_sound_write(UINT16 address, UINT8 data) +{ + if ((address & 0xfff0) == 0xa000) { + K007232WriteReg(0, address & 0x0f, data); + return; + } + + if ((address & 0xfff0) == 0xb000) { + K007232WriteReg(1, address & 0x0f, data); + return; + } + + switch (address) + { + case 0x9000: + sound_bank_w(data); + return; + + case 0xf000: + *nmi_enable = data; + return; + } +} + +UINT8 __fastcall bottom9_sound_read(UINT16 address) +{ + if ((address & 0xfff0) == 0xa000) { + return K007232ReadReg(0, address & 0x0f); + } + + if ((address & 0xfff0) == 0xb000) { + return K007232ReadReg(1, address & 0x0f); + } + + switch (address) + { + case 0xd000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +static void K052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + *code |= (*color & 0x3f) << 8; + *color = ((layer & 2) << 3) | ((*color & 0xc0) >> 6); +} + +static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) +{ + *priority = (*color & 0x30) >> 4; + *color = 0x20 + (*color & 0x0f); + *code &= 0x1fff; +} + +static void K051316Callback(INT32 *code,INT32 *color,INT32 *flags) +{ + *flags = (*color & 0x40) >> 6; + *code |= ((*color & 0x03) << 8); + *color = 0x30 | ((*color & 0x3c) >> 2); +} + +static void DrvK007232VolCallback0(int v) +{ + K007232SetVolume(0,0,(v >> 4) * 0x11,0); + K007232SetVolume(0,1,0,(v & 0x0f) * 0x11); +} + +static void DrvK007232VolCallback1(INT32 v) +{ + K007232SetVolume(1,0,(v >> 4) * 0x11,0); + K007232SetVolume(1,1,0,(v & 0x0f) * 0x11); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + M6809Open(0); + M6809Reset(); + M6809Close(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + KonamiICReset(); + + bottom9_video_enable = 0; + zoomreadroms = 0; + K052109_selected = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvM6809ROM = Next; Next += 0x030000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x080000; + DrvGfxROM1 = Next; Next += 0x100000; + DrvGfxROM2 = Next; Next += 0x020000; + DrvGfxROMExp0 = Next; Next += 0x100000; + DrvGfxROMExp1 = Next; Next += 0x200000; + DrvGfxROMExp2 = Next; Next += 0x040000; + + DrvSndROM0 = Next; Next += 0x040000; + DrvSndROM1 = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); + + AllRam = Next; + + DrvM6809RAM = Next; Next += 0x002000; + DrvPalRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + nmi_enable = Next; Next += 0x000001; + nDrvBank = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs0[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x080000); + konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); + + GfxDecode(0x04000, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x100, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x02000, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvM6809ROM + 0x010000, 0, 1)) return 1; + if (BurnLoadRom(DrvM6809ROM + 0x000000, 1, 1)) return 1; + memcpy (DrvM6809ROM + 0x20000, DrvM6809ROM + 0x00000, 0x8000); + memcpy (DrvM6809ROM + 0x28000, DrvM6809ROM + 0x00000, 0x8000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x020000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x020001, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040001, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060000, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060001, 10, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 11, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020001, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 15, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040001, 16, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060000, 17, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060001, 18, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 19, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080001, 20, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0a0000, 21, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0a0001, 22, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 23, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 24, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0e0000, 25, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0e0001, 26, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 27, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x010000, 28, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 29, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x010000, 30, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x020000, 31, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x030000, 32, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x000000, 33, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x010000, 34, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x020000, 35, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x030000, 36, 1)) return 1; + + DrvGfxDecode(); + } + + M6809Init(1); + M6809Open(0); + M6809MapMemory(DrvM6809RAM, 0x4000, 0x5fff, M6809_RAM); + M6809MapMemory(DrvM6809ROM + 0x10000, 0x6000, 0x7fff, M6809_ROM); + M6809MapMemory(DrvM6809ROM + 0x08000, 0x8000, 0xffff, M6809_ROM); + M6809SetWriteHandler(bottom9_main_write); + M6809SetReadHandler(bottom9_main_read); + M6809Close(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(bottom9_sound_write); + ZetSetReadHandler(bottom9_sound_read); + ZetClose(); + + K007232Init(0, 3579545, DrvSndROM0, 0x40000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback0); + K007232PCMSetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); + + K007232Init(1, 3579545, DrvSndROM1, 0x40000); + K007232SetPortWriteHandler(1, DrvK007232VolCallback1); + K007232PCMSetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); + + K052109Init(DrvGfxROM0, 0x7ffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(8, 0); + + K051960Init(DrvGfxROM1, 0xfffff); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(8, 0); + + K051316Init(0, DrvGfxROM2, DrvGfxROMExp2, 0x1ffff, K051316Callback, 4, 0); + K051316SetOffset(0, -112, -16); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + M6809Exit(); + ZetExit(); + + K007232Exit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800); + } + + K052109UpdateScroll(); + + BurnTransferClear(); + + K051960SpritesRender(DrvGfxROMExp1, 1); + K051316_zoom_draw(0, 0); + K051960SpritesRender(DrvGfxROMExp1, 0); + K052109RenderLayer(2, 0, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 2); + K051960SpritesRender(DrvGfxROMExp1, 3); + K052109RenderLayer(1, 0, DrvGfxROMExp0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[0] & 0x06) == 0) DrvInputs[0] |= 0x06; + if ((DrvInputs[0] & 0x18) == 0) DrvInputs[0] |= 0x18; + if ((DrvInputs[1] & 0x06) == 0) DrvInputs[1] |= 0x06; + if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18; + } + + INT32 nInterleave = 8; + INT32 nCyclesTotal[2] = { 2000000 / 60, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetOpen(0); + M6809Open(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + + nCyclesDone[0] += M6809Run(nSegment - nCyclesDone[0]); + + nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); + + nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); + if (*nmi_enable) ZetNmi(); + } + + if (K052109_irq_enabled) M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + memset(pBurnSoundOut, 0, nBurnSoundLen * sizeof(INT16) * 2); + K007232Update(0, pBurnSoundOut, nBurnSoundLen); + K007232Update(1, pBurnSoundOut, nBurnSoundLen); + } + + M6809Close(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + M6809Scan(nAction); + ZetScan(nAction); + + K007232Scan(nAction, pnMin); + + KonamiICScan(nAction); + + SCAN_VAR(bottom9_video_enable); + SCAN_VAR(zoomreadroms); + SCAN_VAR(K052109_selected); + } + + if (nAction & ACB_WRITE) { + M6809Open(0); + bankswitch(nDrvBank[0]); + M6809Close(); + } + + return 0; +} + + +// Bottom of the Ninth (ver. T) + +static struct BurnRomInfo bottom9RomDesc[] = { + { "891n03.k17", 0x10000, 0x8b083ff3, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code + { "891-t02.k15", 0x10000, 0x2c10ced2, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "891j01.g8", 0x08000, 0x31b0a0a8, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "891e10c", 0x10000, 0x209b0431, 3 | BRF_GRA }, // 3 K052109 Tiles + { "891e10a", 0x10000, 0x8020a9e8, 3 | BRF_GRA }, // 4 + { "891e10d", 0x10000, 0x16d5fd7a, 3 | BRF_GRA }, // 5 + { "891e10b", 0x10000, 0x30121cc0, 3 | BRF_GRA }, // 6 + { "891e09c", 0x10000, 0x9dcaefbf, 3 | BRF_GRA }, // 7 + { "891e09a", 0x10000, 0x56b0ead9, 3 | BRF_GRA }, // 8 + { "891e09d", 0x10000, 0x4e1335e6, 3 | BRF_GRA }, // 9 + { "891e09b", 0x10000, 0xb6f914fb, 3 | BRF_GRA }, // 10 + + { "891e06e", 0x10000, 0x0b04db1c, 4 | BRF_GRA }, // 11 K051960 Tiles + { "891e06a", 0x10000, 0x5ee37327, 4 | BRF_GRA }, // 12 + { "891e06f", 0x10000, 0xf9ada524, 4 | BRF_GRA }, // 13 + { "891e06b", 0x10000, 0x2295dfaa, 4 | BRF_GRA }, // 14 + { "891e06g", 0x10000, 0x04abf78f, 4 | BRF_GRA }, // 15 + { "891e06c", 0x10000, 0xdbdb0d55, 4 | BRF_GRA }, // 16 + { "891e06h", 0x10000, 0x5d5ded8c, 4 | BRF_GRA }, // 17 + { "891e06d", 0x10000, 0xf9ecbd71, 4 | BRF_GRA }, // 18 + { "891e05e", 0x10000, 0xb356e729, 4 | BRF_GRA }, // 19 + { "891e05a", 0x10000, 0xbfd5487e, 4 | BRF_GRA }, // 20 + { "891e05f", 0x10000, 0xecdd11c5, 4 | BRF_GRA }, // 21 + { "891e05b", 0x10000, 0xaba18d24, 4 | BRF_GRA }, // 22 + { "891e05g", 0x10000, 0xc315f9ae, 4 | BRF_GRA }, // 23 + { "891e05c", 0x10000, 0x21fcbc6f, 4 | BRF_GRA }, // 24 + { "891e05h", 0x10000, 0xb0aba53b, 4 | BRF_GRA }, // 25 + { "891e05d", 0x10000, 0xf6d3f886, 4 | BRF_GRA }, // 26 + + { "891e07a", 0x10000, 0xb8d8b939, 5 | BRF_GRA }, // 27 K051316 Tiles + { "891e07b", 0x10000, 0x83b2f92d, 5 | BRF_GRA }, // 28 + + { "891e08a", 0x10000, 0xcef667bf, 6 | BRF_GRA }, // 29 K007232 #0 Samples + { "891e08b", 0x10000, 0xf7c14a7a, 6 | BRF_GRA }, // 30 + { "891e08c", 0x10000, 0x756b7f3c, 6 | BRF_GRA }, // 31 + { "891e08d", 0x10000, 0xcd0d7305, 6 | BRF_GRA }, // 32 + + { "891e04a", 0x10000, 0xdaebbc74, 7 | BRF_GRA }, // 33 K007232 #1 Samples + { "891e04b", 0x10000, 0x5ffb9ad1, 7 | BRF_GRA }, // 34 + { "891e04c", 0x10000, 0x2dbbf16b, 7 | BRF_GRA }, // 35 + { "891e04d", 0x10000, 0x8b0cd2cc, 7 | BRF_GRA }, // 36 + + { "891b11.f23", 0x00100, 0xecb854aa, 8 | BRF_OPT }, // 37 Priority Proms +}; + +STD_ROM_PICK(bottom9) +STD_ROM_FN(bottom9) + +struct BurnDriver BurnDrvBottom9 = { + "bottom9", NULL, NULL, NULL, "1989", + "Bottom of the Ninth (ver. T)\0", NULL, "Konami", "GX891", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, bottom9RomInfo, bottom9RomName, NULL, NULL, Bottom9InputInfo, Bottom9DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; + + +// Bottom of the Ninth (ver. N) + +static struct BurnRomInfo bottom9nRomDesc[] = { + { "891n03.k17", 0x10000, 0x8b083ff3, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code + { "891n02.k15", 0x10000, 0xd44d9ed4, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "891j01.g8", 0x08000, 0x31b0a0a8, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "891e10c", 0x10000, 0x209b0431, 3 | BRF_GRA }, // 3 K052109 Tiles + { "891e10a", 0x10000, 0x8020a9e8, 3 | BRF_GRA }, // 4 + { "891e10d", 0x10000, 0x16d5fd7a, 3 | BRF_GRA }, // 5 + { "891e10b", 0x10000, 0x30121cc0, 3 | BRF_GRA }, // 6 + { "891e09c", 0x10000, 0x9dcaefbf, 3 | BRF_GRA }, // 7 + { "891e09a", 0x10000, 0x56b0ead9, 3 | BRF_GRA }, // 8 + { "891e09d", 0x10000, 0x4e1335e6, 3 | BRF_GRA }, // 9 + { "891e09b", 0x10000, 0xb6f914fb, 3 | BRF_GRA }, // 10 + + { "891e06e", 0x10000, 0x0b04db1c, 4 | BRF_GRA }, // 11 K051960 Tiles + { "891e06a", 0x10000, 0x5ee37327, 4 | BRF_GRA }, // 12 + { "891e06f", 0x10000, 0xf9ada524, 4 | BRF_GRA }, // 13 + { "891e06b", 0x10000, 0x2295dfaa, 4 | BRF_GRA }, // 14 + { "891e06g", 0x10000, 0x04abf78f, 4 | BRF_GRA }, // 15 + { "891e06c", 0x10000, 0xdbdb0d55, 4 | BRF_GRA }, // 16 + { "891e06h", 0x10000, 0x5d5ded8c, 4 | BRF_GRA }, // 17 + { "891e06d", 0x10000, 0xf9ecbd71, 4 | BRF_GRA }, // 18 + { "891e05e", 0x10000, 0xb356e729, 4 | BRF_GRA }, // 19 + { "891e05a", 0x10000, 0xbfd5487e, 4 | BRF_GRA }, // 20 + { "891e05f", 0x10000, 0xecdd11c5, 4 | BRF_GRA }, // 21 + { "891e05b", 0x10000, 0xaba18d24, 4 | BRF_GRA }, // 22 + { "891e05g", 0x10000, 0xc315f9ae, 4 | BRF_GRA }, // 23 + { "891e05c", 0x10000, 0x21fcbc6f, 4 | BRF_GRA }, // 24 + { "891e05h", 0x10000, 0xb0aba53b, 4 | BRF_GRA }, // 25 + { "891e05d", 0x10000, 0xf6d3f886, 4 | BRF_GRA }, // 26 + + { "891e07a", 0x10000, 0xb8d8b939, 5 | BRF_GRA }, // 27 K051316 Tiles + { "891e07b", 0x10000, 0x83b2f92d, 5 | BRF_GRA }, // 28 + + { "891e08a", 0x10000, 0xcef667bf, 6 | BRF_GRA }, // 29 K007232 #0 Samples + { "891e08b", 0x10000, 0xf7c14a7a, 6 | BRF_GRA }, // 30 + { "891e08c", 0x10000, 0x756b7f3c, 6 | BRF_GRA }, // 31 + { "891e08d", 0x10000, 0xcd0d7305, 6 | BRF_GRA }, // 32 + + { "891e04a", 0x10000, 0xdaebbc74, 7 | BRF_GRA }, // 33 K007232 #1 Samples + { "891e04b", 0x10000, 0x5ffb9ad1, 7 | BRF_GRA }, // 34 + { "891e04c", 0x10000, 0x2dbbf16b, 7 | BRF_GRA }, // 35 + { "891e04d", 0x10000, 0x8b0cd2cc, 7 | BRF_GRA }, // 36 + + { "891b11.f23", 0x00100, 0xecb854aa, 8 | BRF_OPT }, // 37 Priority Proms +}; + +STD_ROM_PICK(bottom9n) +STD_ROM_FN(bottom9n) + +struct BurnDriver BurnDrvBottom9n = { + "bottom9n", "bottom9", NULL, NULL, "1989", + "Bottom of the Ninth (ver. N)\0", NULL, "Konami", "GX891", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, bottom9nRomInfo, bottom9nRomName, NULL, NULL, Bottom9InputInfo, Bottom9DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; + + +// Main Stadium (Japan ver. 4) + +static struct BurnRomInfo mstadiumRomDesc[] = { + { "891-403.k17", 0x10000, 0x1c00c4e8, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code + { "891-402.k15", 0x10000, 0xb850bbce, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "891w01.g8", 0x08000, 0xedec565a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "891e10c", 0x10000, 0x209b0431, 3 | BRF_GRA }, // 3 K052109 Tiles + { "891e10a", 0x10000, 0x8020a9e8, 3 | BRF_GRA }, // 4 + { "891e10d", 0x10000, 0x16d5fd7a, 3 | BRF_GRA }, // 5 + { "891e10b", 0x10000, 0x30121cc0, 3 | BRF_GRA }, // 6 + { "891e09c", 0x10000, 0x9dcaefbf, 3 | BRF_GRA }, // 7 + { "891e09a", 0x10000, 0x56b0ead9, 3 | BRF_GRA }, // 8 + { "891e09d", 0x10000, 0x4e1335e6, 3 | BRF_GRA }, // 9 + { "891e09b", 0x10000, 0xb6f914fb, 3 | BRF_GRA }, // 10 + + { "891e06e", 0x10000, 0x0b04db1c, 4 | BRF_GRA }, // 11 K051960 Tiles + { "891e06a", 0x10000, 0x5ee37327, 4 | BRF_GRA }, // 12 + { "891e06f", 0x10000, 0xf9ada524, 4 | BRF_GRA }, // 13 + { "891e06b", 0x10000, 0x2295dfaa, 4 | BRF_GRA }, // 14 + { "891e06g", 0x10000, 0x04abf78f, 4 | BRF_GRA }, // 15 + { "891e06c", 0x10000, 0xdbdb0d55, 4 | BRF_GRA }, // 16 + { "891e06h", 0x10000, 0x5d5ded8c, 4 | BRF_GRA }, // 17 + { "891e06d", 0x10000, 0xf9ecbd71, 4 | BRF_GRA }, // 18 + { "891e05e", 0x10000, 0xb356e729, 4 | BRF_GRA }, // 19 + { "891e05a", 0x10000, 0xbfd5487e, 4 | BRF_GRA }, // 20 + { "891e05f", 0x10000, 0xecdd11c5, 4 | BRF_GRA }, // 21 + { "891e05b", 0x10000, 0xaba18d24, 4 | BRF_GRA }, // 22 + { "891e05g", 0x10000, 0xc315f9ae, 4 | BRF_GRA }, // 23 + { "891e05c", 0x10000, 0x21fcbc6f, 4 | BRF_GRA }, // 24 + { "891e05h", 0x10000, 0xb0aba53b, 4 | BRF_GRA }, // 25 + { "891e05d", 0x10000, 0xf6d3f886, 4 | BRF_GRA }, // 26 + + { "891e07a", 0x10000, 0xb8d8b939, 5 | BRF_GRA }, // 27 K051316 Tiles + { "891e07b", 0x10000, 0x83b2f92d, 5 | BRF_GRA }, // 28 + + { "891e08a", 0x10000, 0xcef667bf, 6 | BRF_GRA }, // 29 K007232 #0 Samples + { "891e08b", 0x10000, 0xf7c14a7a, 6 | BRF_GRA }, // 30 + { "891e08c", 0x10000, 0x756b7f3c, 6 | BRF_GRA }, // 31 + { "891e08d", 0x10000, 0xcd0d7305, 6 | BRF_GRA }, // 32 + + { "891e04a", 0x10000, 0xdaebbc74, 7 | BRF_GRA }, // 33 K007232 #1 Samples + { "891e04b", 0x10000, 0x5ffb9ad1, 7 | BRF_GRA }, // 34 + { "891e04c", 0x10000, 0x2dbbf16b, 7 | BRF_GRA }, // 35 + { "891e04d", 0x10000, 0x8b0cd2cc, 7 | BRF_GRA }, // 36 + + { "891b11.f23", 0x00100, 0xecb854aa, 8 | BRF_OPT }, // 37 Priority Proms +}; + +STD_ROM_PICK(mstadium) +STD_ROM_FN(mstadium) + +struct BurnDriver BurnDrvMstadium = { + "mstadium", "bottom9", NULL, NULL, "1989", + "Main Stadium (Japan ver. 4)\0", NULL, "Konami", "GX891", + L"Main Stadium\0\u30E1\u30A4\u30F3\u30B9\u30BF\u30B8\u30A2\u30E0 (Japan ver. 4)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, mstadiumRomInfo, mstadiumRomName, NULL, NULL, Bottom9InputInfo, MstadiumDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_crimfght.cpp b/src/burn/drv/konami/d_crimfght.cpp index 0af787412..b33d33ee2 100644 --- a/src/burn/drv/konami/d_crimfght.cpp +++ b/src/burn/drv/konami/d_crimfght.cpp @@ -1,799 +1,798 @@ -// FB Alpha Crime Fighters driver module -// Based on MAME driver by Manuel Abadia - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" -#include "k007232.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM; -static UINT8 *DrvBankRAM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *nDrvRamBank; -static UINT8 *nDrvKonamiBank; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[5]; -static UINT8 DrvReset; - -static struct BurnInputInfo CrimfghtInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy5 + 0, "p1 coin" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy5 + 1, "p2 coin" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"P3 Coin", BIT_DIGITAL, DrvJoy5 + 2, "p3 coin" }, - {"P3 Up", BIT_DIGITAL, DrvJoy3 + 2, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy3 + 3, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy3 + 0, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy3 + 1, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2" }, - - {"P4 Coin", BIT_DIGITAL, DrvJoy5 + 3, "p4 coin" }, - {"P4 Up", BIT_DIGITAL, DrvJoy4 + 2, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvJoy4 + 3, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvJoy4 + 0, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvJoy4 + 1, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p4 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service 1", BIT_DIGITAL, DrvJoy5 + 4, "service" }, - {"Service 2", BIT_DIGITAL, DrvJoy5 + 5, "service2"}, - {"Service 3", BIT_DIGITAL, DrvJoy5 + 6, "service3"}, - {"Service 4", BIT_DIGITAL, DrvJoy5 + 7, "service4"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Crimfght) - -static struct BurnInputInfo CrimfgtjInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy5 + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy5 + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service 1", BIT_DIGITAL, DrvJoy5 + 4, "service"}, - {"Service 2", BIT_DIGITAL, DrvJoy5 + 5, "service2"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip"}, -}; - -STDINPUTINFO(Crimfgtj) - -static struct BurnDIPInfo CrimfghtDIPList[]= -{ - {0x21, 0xff, 0xff, 0xff, NULL }, - {0x22, 0xff, 0xff, 0x5f, NULL }, - {0x23, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x21, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x21, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x21, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x21, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x21, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x21, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x21, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x21, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x21, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x21, 0x01, 0x0f, 0x00, "1 Coin 99 Credits" }, - -/* {0 , 0xfe, 0 , 16, "Coin B" }, - {0x21, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x21, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x21, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x21, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x21, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x21, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x21, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x21, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x21, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x21, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x21, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x21, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x21, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x21, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x21, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x21, 0x01, 0xf0, 0x00, "No Coin B" },*/ - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x22, 0x01, 0x60, 0x60, "Easy" }, - {0x22, 0x01, 0x60, 0x40, "Normal" }, - {0x22, 0x01, 0x60, 0x20, "Difficult" }, - {0x22, 0x01, 0x60, 0x00, "Very difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x22, 0x01, 0x80, 0x80, "Off" }, - {0x22, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x23, 0x01, 0x01, 0x01, "Off" }, -// {0x23, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x23, 0x01, 0x04, 0x00, "Off" }, - {0x23, 0x01, 0x04, 0x04, "On" }, -}; - -STDDIPINFO(Crimfght) - -static struct BurnDIPInfo CrimfgtjDIPList[]= -{ - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0x5f, NULL }, - {0x17, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x15, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x15, 0x01, 0xf0, 0x00, "Not Use" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x03, "1" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x01, "3" }, - {0x16, 0x01, 0x03, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x60, 0x60, "Easy" }, - {0x16, 0x01, 0x60, 0x40, "Normal" }, - {0x16, 0x01, 0x60, 0x20, "Difficult" }, - {0x16, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x17, 0x01, 0x01, 0x01, "Off" }, -// {0x17, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x17, 0x01, 0x04, 0x00, "Off" }, - {0x17, 0x01, 0x04, 0x04, "On" }, -}; - -STDDIPINFO(Crimfgtj) - -static void set_ram_bank(INT32 data) -{ - nDrvRamBank[0] = data; - - if (data & 0x20) { - konamiMapMemory(DrvPalRAM, 0x0000, 0x03ff, KON_RAM); - } else { - konamiMapMemory(DrvBankRAM, 0x0000, 0x03ff, KON_RAM); - } -} - -void crimfght_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x3f8c: - *soundlatch = data; - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - break; - } - - if (address >= 0x2000 && address <= 0x5fff) { - K052109_051960_w(address - 0x2000, data); - return; - } -} - -UINT8 crimfght_main_read(UINT16 address) -{ - switch (address) - { - case 0x3f80: - return DrvInputs[4]; - - case 0x3f81: - return DrvInputs[0]; - - case 0x3f82: - return DrvInputs[1]; - - case 0x3f83: - return DrvDips[1]; - - case 0x3f84: - return DrvDips[2]; - - case 0x3f85: - return DrvInputs[2]; - - case 0x3f86: - return DrvInputs[3]; - - case 0x3f87: - return DrvDips[0]; - - case 0x3f88: - // watchdog reset - return 0; - } - - if (address >= 0x2000 && address <= 0x5fff) { - return K052109_051960_r(address - 0x2000); - } - - return 0; -} - -void __fastcall crimfght_sound_write(UINT16 address, UINT8 data) -{ - if ((address & 0xfff0) == 0xe000) { - K007232WriteReg(0, address & 0x0f, data); - return; - } - - switch (address) - { - case 0xa000: - BurnYM2151SelectRegister(data); - return; - - case 0xa001: - BurnYM2151WriteRegister(data); - return; - } -} - -UINT8 __fastcall crimfght_sound_read(UINT16 address) -{ - if ((address & 0xfff0) == 0xe000) { - return K007232ReadReg(0, address & 0x0f); - } - - switch (address) - { - case 0xa000: - case 0xa001: - return BurnYM2151ReadStatus(); - - case 0xc000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -static void DrvK007232VolCallback(INT32 v) -{ - K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); - K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); -} - -static void DrvYM2151WritePort(UINT32, UINT32 data) -{ - INT32 bank_A = ((data >> 1) & 0x01); - INT32 bank_B = ((data) & 0x01); - - k007232_set_bank(0, bank_A, bank_B); -} - -static void crimfght_set_lines(INT32 lines) -{ - nDrvKonamiBank[0] = lines; - - set_ram_bank(lines & 0x20); - K052109RMRDLine = lines & 0x40; - - INT32 nBank = 0x10000 + ((lines & 0x0f) * 0x2000); - - konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); -} - -static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *flipx, INT32 *) -{ - *flipx = *color & 0x20; - *code |= ((*color & 0x1f) << 8) | (bank << 13); - *code &= 0x3fff; - *color = (layer << 2) + ((*color & 0xc0) >> 6); -} - -static void K051960Callback(INT32 *code, INT32 *color,INT32 *priority, INT32 *shadow) -{ - switch (*color & 0x70) - { - case 0x10: *priority = 0; break; - case 0x00: *priority = 1; break; - case 0x40: *priority = 2; break; - case 0x20: *priority = 3; break; - } - - *code |= (*color & 0x80) << 6; - *code &= 0x1fff; - *color = 16 + (*color & 0x0f); - *shadow = 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x080000; - DrvGfxROM1 = Next; Next += 0x100000; - DrvGfxROMExp0 = Next; Next += 0x100000; - DrvGfxROMExp1 = Next; Next += 0x200000; - - DrvSndROM = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x200 * sizeof(UINT32); - - AllRam = Next; - - DrvBankRAM = Next; Next += 0x000400; - DrvKonRAM = Next; Next += 0x001c00; - DrvPalRAM = Next; Next += 0x000400; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - nDrvRamBank = Next; Next += 0x000001; - nDrvKonamiBank = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x080000); - konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); - - GfxDecode(0x4000, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x2000, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; - memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x28000, 0x8000); - memset (DrvKonROM + 0x28000, 0, 0x8000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 5, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 6, 1)) return 1; - - DrvGfxDecode(); - } - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvBankRAM, 0x0000, 0x03ff, KON_RAM); - konamiMapMemory(DrvKonRAM, 0x0400, 0x1fff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(crimfght_main_write); - konamiSetReadHandler(crimfght_main_read); - konamiSetlinesCallback(crimfght_set_lines); - konamiClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(crimfght_sound_write); - ZetSetReadHandler(crimfght_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetPortHandler(&DrvYM2151WritePort); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - K007232Init(0, 3579545, DrvSndROM, 0x40000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback); - K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - K052109Init(DrvGfxROM0, 0x7ffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(-2, 0); - - K051960Init(DrvGfxROM1, 0xfffff); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(-2, 0); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - konamiExit(); - ZetExit(); - - K007232Exit(); - BurnYM2151Exit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x400); - } - - K052109UpdateScroll(); - - K052109RenderLayer(1, 1, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 2); - K052109RenderLayer(2, 0, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 1); - K052109RenderLayer(0, 0, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 5); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - } - - // Clear Opposites - if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; - if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; - if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; - if ((DrvInputs[3] & 0x0c) == 0) DrvInputs[3] |= 0x0c; - if ((DrvInputs[3] & 0x03) == 0) DrvInputs[3] |= 0x03; - } - - konamiNewFrame(); - ZetNewFrame(); - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 100; - INT32 nCyclesTotal[2] = { (((3000000 / 60) * 133) / 100) /* 33% overclock */, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetOpen(0); - konamiOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - - nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); - - nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); - - nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - } - } - - konamiClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029704; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - K007232Scan(nAction, pnMin); - - KonamiICScan(nAction); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - set_ram_bank(nDrvRamBank[0]); - crimfght_set_lines(nDrvKonamiBank[0]); - konamiClose(); - } - - return 0; -} - - -// Crime Fighters (US 4 players) - -static struct BurnRomInfo crimfghtRomDesc[] = { - { "821l02.f24", 0x20000, 0x588e7da6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code - - { "821l01.h4", 0x08000, 0x0faca89e, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "821k06.k13", 0x40000, 0xa1eadb24, 3 | BRF_GRA }, // 2 Background Tiles - { "821k07.k19", 0x40000, 0x060019fa, 3 | BRF_GRA }, // 3 - - { "821k04.k2", 0x80000, 0x00e0291b, 4 | BRF_GRA }, // 4 Sprites - { "821k05.k8", 0x80000, 0xe09ea05d, 4 | BRF_GRA }, // 5 - - { "821k03.e5", 0x40000, 0xfef8505a, 5 | BRF_SND }, // 6 K007232 Samples - - { "821a08.i15", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 7 Proms -}; - -STD_ROM_PICK(crimfght) -STD_ROM_FN(crimfght) - -struct BurnDriver BurnDrvCrimfght = { - "crimfght", NULL, NULL, NULL, "1989", - "Crime Fighters (US 4 players)\0", NULL, "Konami", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, crimfghtRomInfo, crimfghtRomName, NULL, NULL, CrimfghtInputInfo, CrimfghtDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 320, 224, 4, 3 -}; - - -// Crime Fighters (Japan 2 Players) - -static struct BurnRomInfo crimfgtjRomDesc[] = { - { "821p02.f24", 0x20000, 0xf33fa2e1, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code - - { "821l01.h4", 0x08000, 0x0faca89e, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "821k06.k13", 0x40000, 0xa1eadb24, 3 | BRF_GRA }, // 2 Background Tiles - { "821k07.k19", 0x40000, 0x060019fa, 3 | BRF_GRA }, // 3 - - { "821k04.k2", 0x80000, 0x00e0291b, 4 | BRF_GRA }, // 4 Sprites - { "821k05.k8", 0x80000, 0xe09ea05d, 4 | BRF_GRA }, // 5 - - { "821k03.e5", 0x40000, 0xfef8505a, 5 | BRF_SND }, // 6 K007232 Samples - - { "821a08.i15", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 7 Proms -}; - -STD_ROM_PICK(crimfgtj) -STD_ROM_FN(crimfgtj) - -struct BurnDriver BurnDrvCrimfgtj = { - "crimfghtj", "crimfght", NULL, NULL, "1989", - "Crime Fighters (Japan 2 Players)\0", NULL, "Konami", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, crimfgtjRomInfo, crimfgtjRomName, NULL, NULL, CrimfgtjInputInfo, CrimfgtjDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 320, 224, 4, 3 -}; - - -// Crime Fighters (World 2 Players) - -static struct BurnRomInfo crimfgt2RomDesc[] = { - { "821r02.f24", 0x20000, 0x4ecdd923, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code - - { "821l01.h4", 0x08000, 0x0faca89e, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "821k06.k13", 0x40000, 0xa1eadb24, 3 | BRF_GRA }, // 2 Background Tiles - { "821k07.k19", 0x40000, 0x060019fa, 3 | BRF_GRA }, // 3 - - { "821k04.k2", 0x80000, 0x00e0291b, 4 | BRF_GRA }, // 4 Sprites - { "821k05.k8", 0x80000, 0xe09ea05d, 4 | BRF_GRA }, // 5 - - { "821k03.e5", 0x40000, 0xfef8505a, 5 | BRF_SND }, // 6 K007232 Samples - - { "821a08.i15", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 7 Proms -}; - -STD_ROM_PICK(crimfgt2) -STD_ROM_FN(crimfgt2) - -struct BurnDriver BurnDrvCrimfgt2 = { - "crimfght2", "crimfght", NULL, NULL, "1989", - "Crime Fighters (World 2 Players)\0", NULL, "Konami", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, crimfgt2RomInfo, crimfgt2RomName, NULL, NULL, CrimfgtjInputInfo, CrimfgtjDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 320, 224, 4, 3 -}; +// FB Alpha Crime Fighters driver module +// Based on MAME driver by Manuel Abadia + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" +#include "k007232.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM; +static UINT8 *DrvBankRAM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *nDrvRamBank; +static UINT8 *nDrvKonamiBank; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[5]; +static UINT8 DrvReset; + +static struct BurnInputInfo CrimfghtInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy5 + 0, "p1 coin" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy5 + 1, "p2 coin" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"P3 Coin", BIT_DIGITAL, DrvJoy5 + 2, "p3 coin" }, + {"P3 Up", BIT_DIGITAL, DrvJoy3 + 2, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy3 + 3, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy3 + 0, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy3 + 1, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2" }, + + {"P4 Coin", BIT_DIGITAL, DrvJoy5 + 3, "p4 coin" }, + {"P4 Up", BIT_DIGITAL, DrvJoy4 + 2, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvJoy4 + 3, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvJoy4 + 0, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvJoy4 + 1, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p4 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service 1", BIT_DIGITAL, DrvJoy5 + 4, "service" }, + {"Service 2", BIT_DIGITAL, DrvJoy5 + 5, "service2"}, + {"Service 3", BIT_DIGITAL, DrvJoy5 + 6, "service3"}, + {"Service 4", BIT_DIGITAL, DrvJoy5 + 7, "service4"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Crimfght) + +static struct BurnInputInfo CrimfgtjInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy5 + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy5 + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service 1", BIT_DIGITAL, DrvJoy5 + 4, "service"}, + {"Service 2", BIT_DIGITAL, DrvJoy5 + 5, "service2"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip"}, +}; + +STDINPUTINFO(Crimfgtj) + +static struct BurnDIPInfo CrimfghtDIPList[]= +{ + {0x21, 0xff, 0xff, 0xff, NULL }, + {0x22, 0xff, 0xff, 0x5f, NULL }, + {0x23, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x21, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x21, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x21, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x21, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x21, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x21, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x21, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x21, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x21, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x21, 0x01, 0x0f, 0x00, "1 Coin 99 Credits" }, + +/* {0 , 0xfe, 0 , 16, "Coin B" }, + {0x21, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x21, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x21, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x21, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x21, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x21, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x21, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x21, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x21, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x21, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x21, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x21, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x21, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x21, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x21, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x21, 0x01, 0xf0, 0x00, "No Coin B" },*/ + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x22, 0x01, 0x60, 0x60, "Easy" }, + {0x22, 0x01, 0x60, 0x40, "Normal" }, + {0x22, 0x01, 0x60, 0x20, "Difficult" }, + {0x22, 0x01, 0x60, 0x00, "Very difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x22, 0x01, 0x80, 0x80, "Off" }, + {0x22, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x23, 0x01, 0x01, 0x01, "Off" }, +// {0x23, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x23, 0x01, 0x04, 0x00, "Off" }, + {0x23, 0x01, 0x04, 0x04, "On" }, +}; + +STDDIPINFO(Crimfght) + +static struct BurnDIPInfo CrimfgtjDIPList[]= +{ + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0x5f, NULL }, + {0x17, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x15, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x15, 0x01, 0xf0, 0x00, "Not Use" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x03, "1" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x01, "3" }, + {0x16, 0x01, 0x03, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x60, 0x60, "Easy" }, + {0x16, 0x01, 0x60, 0x40, "Normal" }, + {0x16, 0x01, 0x60, 0x20, "Difficult" }, + {0x16, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x17, 0x01, 0x01, 0x01, "Off" }, +// {0x17, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x17, 0x01, 0x04, 0x00, "Off" }, + {0x17, 0x01, 0x04, 0x04, "On" }, +}; + +STDDIPINFO(Crimfgtj) + +static void set_ram_bank(INT32 data) +{ + nDrvRamBank[0] = data; + + if (data & 0x20) { + konamiMapMemory(DrvPalRAM, 0x0000, 0x03ff, KON_RAM); + } else { + konamiMapMemory(DrvBankRAM, 0x0000, 0x03ff, KON_RAM); + } +} + +void crimfght_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x3f8c: + *soundlatch = data; + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + break; + } + + if (address >= 0x2000 && address <= 0x5fff) { + K052109_051960_w(address - 0x2000, data); + return; + } +} + +UINT8 crimfght_main_read(UINT16 address) +{ + switch (address) + { + case 0x3f80: + return DrvInputs[4]; + + case 0x3f81: + return DrvInputs[0]; + + case 0x3f82: + return DrvInputs[1]; + + case 0x3f83: + return DrvDips[1]; + + case 0x3f84: + return DrvDips[2]; + + case 0x3f85: + return DrvInputs[2]; + + case 0x3f86: + return DrvInputs[3]; + + case 0x3f87: + return DrvDips[0]; + + case 0x3f88: + // watchdog reset + return 0; + } + + if (address >= 0x2000 && address <= 0x5fff) { + return K052109_051960_r(address - 0x2000); + } + + return 0; +} + +void __fastcall crimfght_sound_write(UINT16 address, UINT8 data) +{ + if ((address & 0xfff0) == 0xe000) { + K007232WriteReg(0, address & 0x0f, data); + return; + } + + switch (address) + { + case 0xa000: + BurnYM2151SelectRegister(data); + return; + + case 0xa001: + BurnYM2151WriteRegister(data); + return; + } +} + +UINT8 __fastcall crimfght_sound_read(UINT16 address) +{ + if ((address & 0xfff0) == 0xe000) { + return K007232ReadReg(0, address & 0x0f); + } + + switch (address) + { + case 0xa000: + case 0xa001: + return BurnYM2151ReadStatus(); + + case 0xc000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +static void DrvK007232VolCallback(INT32 v) +{ + K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); + K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); +} + +static void DrvYM2151WritePort(UINT32, UINT32 data) +{ + INT32 bank_A = ((data >> 1) & 0x01); + INT32 bank_B = ((data) & 0x01); + + k007232_set_bank(0, bank_A, bank_B); +} + +static void crimfght_set_lines(INT32 lines) +{ + nDrvKonamiBank[0] = lines; + + set_ram_bank(lines & 0x20); + K052109RMRDLine = lines & 0x40; + + INT32 nBank = 0x10000 + ((lines & 0x0f) * 0x2000); + + konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); +} + +static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *flipx, INT32 *) +{ + *flipx = *color & 0x20; + *code |= ((*color & 0x1f) << 8) | (bank << 13); + *code &= 0x3fff; + *color = (layer << 2) + ((*color & 0xc0) >> 6); +} + +static void K051960Callback(INT32 *code, INT32 *color,INT32 *priority, INT32 *shadow) +{ + switch (*color & 0x70) + { + case 0x10: *priority = 0; break; + case 0x00: *priority = 1; break; + case 0x40: *priority = 2; break; + case 0x20: *priority = 3; break; + } + + *code |= (*color & 0x80) << 6; + *code &= 0x1fff; + *color = 16 + (*color & 0x0f); + *shadow = 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x080000; + DrvGfxROM1 = Next; Next += 0x100000; + DrvGfxROMExp0 = Next; Next += 0x100000; + DrvGfxROMExp1 = Next; Next += 0x200000; + + DrvSndROM = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x200 * sizeof(UINT32); + + AllRam = Next; + + DrvBankRAM = Next; Next += 0x000400; + DrvKonRAM = Next; Next += 0x001c00; + DrvPalRAM = Next; Next += 0x000400; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + nDrvRamBank = Next; Next += 0x000001; + nDrvKonamiBank = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x080000); + konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); + + GfxDecode(0x4000, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x2000, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; + memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x28000, 0x8000); + memset (DrvKonROM + 0x28000, 0, 0x8000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 5, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 6, 1)) return 1; + + DrvGfxDecode(); + } + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvBankRAM, 0x0000, 0x03ff, KON_RAM); + konamiMapMemory(DrvKonRAM, 0x0400, 0x1fff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(crimfght_main_write); + konamiSetReadHandler(crimfght_main_read); + konamiSetlinesCallback(crimfght_set_lines); + konamiClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(crimfght_sound_write); + ZetSetReadHandler(crimfght_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetPortHandler(&DrvYM2151WritePort); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + K007232Init(0, 3579545, DrvSndROM, 0x40000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback); + K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + K052109Init(DrvGfxROM0, 0x7ffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(-2, 0); + + K051960Init(DrvGfxROM1, 0xfffff); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(-2, 0); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + konamiExit(); + ZetExit(); + + K007232Exit(); + BurnYM2151Exit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x400); + } + + K052109UpdateScroll(); + + K052109RenderLayer(1, 1, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 2); + K052109RenderLayer(2, 0, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 1); + K052109RenderLayer(0, 0, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 5); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + } + + // Clear Opposites + if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; + if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; + if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; + if ((DrvInputs[3] & 0x0c) == 0) DrvInputs[3] |= 0x0c; + if ((DrvInputs[3] & 0x03) == 0) DrvInputs[3] |= 0x03; + } + + konamiNewFrame(); + ZetNewFrame(); + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 100; + INT32 nCyclesTotal[2] = { (((3000000 / 60) * 133) / 100) /* 33% overclock */, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetOpen(0); + konamiOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + + nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); + + nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); + + nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + } + } + + konamiClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029704; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + K007232Scan(nAction, pnMin); + + KonamiICScan(nAction); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + set_ram_bank(nDrvRamBank[0]); + crimfght_set_lines(nDrvKonamiBank[0]); + konamiClose(); + } + + return 0; +} + + +// Crime Fighters (US 4 players) + +static struct BurnRomInfo crimfghtRomDesc[] = { + { "821l02.f24", 0x20000, 0x588e7da6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code + + { "821l01.h4", 0x08000, 0x0faca89e, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "821k06.k13", 0x40000, 0xa1eadb24, 3 | BRF_GRA }, // 2 Background Tiles + { "821k07.k19", 0x40000, 0x060019fa, 3 | BRF_GRA }, // 3 + + { "821k04.k2", 0x80000, 0x00e0291b, 4 | BRF_GRA }, // 4 Sprites + { "821k05.k8", 0x80000, 0xe09ea05d, 4 | BRF_GRA }, // 5 + + { "821k03.e5", 0x40000, 0xfef8505a, 5 | BRF_SND }, // 6 K007232 Samples + + { "821a08.i15", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 7 Proms +}; + +STD_ROM_PICK(crimfght) +STD_ROM_FN(crimfght) + +struct BurnDriver BurnDrvCrimfght = { + "crimfght", NULL, NULL, NULL, "1989", + "Crime Fighters (US 4 players)\0", NULL, "Konami", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, crimfghtRomInfo, crimfghtRomName, NULL, NULL, CrimfghtInputInfo, CrimfghtDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 320, 224, 4, 3 +}; + + +// Crime Fighters (Japan 2 Players) + +static struct BurnRomInfo crimfgtjRomDesc[] = { + { "821p02.f24", 0x20000, 0xf33fa2e1, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code + + { "821l01.h4", 0x08000, 0x0faca89e, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "821k06.k13", 0x40000, 0xa1eadb24, 3 | BRF_GRA }, // 2 Background Tiles + { "821k07.k19", 0x40000, 0x060019fa, 3 | BRF_GRA }, // 3 + + { "821k04.k2", 0x80000, 0x00e0291b, 4 | BRF_GRA }, // 4 Sprites + { "821k05.k8", 0x80000, 0xe09ea05d, 4 | BRF_GRA }, // 5 + + { "821k03.e5", 0x40000, 0xfef8505a, 5 | BRF_SND }, // 6 K007232 Samples + + { "821a08.i15", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 7 Proms +}; + +STD_ROM_PICK(crimfgtj) +STD_ROM_FN(crimfgtj) + +struct BurnDriver BurnDrvCrimfgtj = { + "crimfghtj", "crimfght", NULL, NULL, "1989", + "Crime Fighters (Japan 2 Players)\0", NULL, "Konami", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, crimfgtjRomInfo, crimfgtjRomName, NULL, NULL, CrimfgtjInputInfo, CrimfgtjDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 320, 224, 4, 3 +}; + + +// Crime Fighters (World 2 Players) + +static struct BurnRomInfo crimfgt2RomDesc[] = { + { "821r02.f24", 0x20000, 0x4ecdd923, 1 | BRF_PRG | BRF_ESS }, // 0 Konami CPU Code + + { "821l01.h4", 0x08000, 0x0faca89e, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "821k06.k13", 0x40000, 0xa1eadb24, 3 | BRF_GRA }, // 2 Background Tiles + { "821k07.k19", 0x40000, 0x060019fa, 3 | BRF_GRA }, // 3 + + { "821k04.k2", 0x80000, 0x00e0291b, 4 | BRF_GRA }, // 4 Sprites + { "821k05.k8", 0x80000, 0xe09ea05d, 4 | BRF_GRA }, // 5 + + { "821k03.e5", 0x40000, 0xfef8505a, 5 | BRF_SND }, // 6 K007232 Samples + + { "821a08.i15", 0x00100, 0x7da55800, 6 | BRF_OPT }, // 7 Proms +}; + +STD_ROM_PICK(crimfgt2) +STD_ROM_FN(crimfgt2) + +struct BurnDriver BurnDrvCrimfgt2 = { + "crimfght2", "crimfght", NULL, NULL, "1989", + "Crime Fighters (World 2 Players)\0", NULL, "Konami", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, crimfgt2RomInfo, crimfgt2RomName, NULL, NULL, CrimfgtjInputInfo, CrimfgtjDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_gberet.cpp b/src/burn/drv/konami/d_gberet.cpp index a12f33198..16bf40e4d 100644 --- a/src/burn/drv/konami/d_gberet.cpp +++ b/src/burn/drv/konami/d_gberet.cpp @@ -1,1112 +1,1111 @@ -// FB Alpha Green Beret driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "sn76496.h" - -static UINT8 *Mem, *MemEnd, *Rom, *Gfx0, *Gfx1, *Prom; -static UINT32 *Palette, *DrvPalette; -static UINT8 DrvRecalcPal; - -static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvDips[4], DrvReset; - -static UINT8 nmi_enable, irq_enable; -static UINT16 gberetb_scroll; -static UINT8 flipscreen; -static UINT8 gberet_spritebank; -static INT32 mrgoemon_bank; - -static INT32 game_type = 0; // 0 gberet / rushatck, 1 gberetb, 2 mrgoemon - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy3 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy3 + 1, "p2 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 3, "p1 start" }, - {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 4, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 3, "p1 down" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p2 right" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 3, "p2 down" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2" }, - - {"Service" , BIT_DIGITAL , DrvJoy3 + 2, "service" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDips + 2, "dip" }, - -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo gberetbInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy3 + 7, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy3 + 6, "p2 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 5, "p1 start" }, - {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 4, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 3, "p1 down" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDips + 3, "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(gberetb) - -static struct BurnDIPInfo gberetDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15 , "Coin B" }, - {0x12, 0x82, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - - {0x13, 0xff, 0xff, 0x4a, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x03, "2" }, - {0x13, 0x01, 0x03, 0x02, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x04, 0x00, "Upright" }, - {0x13, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "30K 70K 70K+" }, - {0x13, 0x01, 0x18, 0x10, "40K 80K 80K+" }, - {0x13, 0x01, 0x18, 0x08, "50K 100K 100K+" }, - {0x13, 0x01, 0x18, 0x00, "50K 200K 200K+" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0x14, 0xff, 0xff, 0x0f, NULL }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x14, 0x01, 0x02, 0x02, "Single" }, - {0x14, 0x01, 0x02, 0x00, "Dual" }, -}; - -STDDIPINFO(gberet) - -static struct BurnDIPInfo gberetbDIPList[]= -{ - {0x0b, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x0b, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x0b, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x0b, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x0b, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x0b, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x0b, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x0b, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x0b, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x0b, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x0b, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x0b, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x0b, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x0b, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15 , "Coin B" }, - {0x0b, 0x82, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - {0x0b, 0x82, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x0b, 0x00, 0x0f, 0x00, NULL }, - - {0x0c, 0xff, 0xff, 0x4a, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0c, 0x01, 0x03, 0x03, "2" }, - {0x0c, 0x01, 0x03, 0x02, "3" }, - {0x0c, 0x01, 0x03, 0x01, "5" }, - {0x0c, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x04, 0x00, "Upright" }, - {0x0c, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0c, 0x01, 0x18, 0x18, "30K 70K 70K+" }, - {0x0c, 0x01, 0x18, 0x10, "40K 80K 80K+" }, - {0x0c, 0x01, 0x18, 0x08, "50K 100K 100K+" }, - {0x0c, 0x01, 0x18, 0x00, "50K 200K 200K+" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x60, 0x60, "Easy" }, - {0x0c, 0x01, 0x60, 0x40, "Normal" }, - {0x0c, 0x01, 0x60, 0x20, "Difficult" }, - {0x0c, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0c, 0x01, 0x80, 0x80, "Off" }, - {0x0c, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(gberetb) - -static struct BurnDIPInfo mrgoemonDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15 , "Coin B" }, - {0x12, 0x82, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - {0x12, 0x82, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x12, 0x00, 0x0f, 0x00, NULL }, - - {0x13, 0xff, 0xff, 0x4a, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x03, "2" }, - {0x13, 0x01, 0x03, 0x02, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x04, 0x00, "Upright" }, - {0x13, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "20K 60K+" }, - {0x13, 0x01, 0x18, 0x10, "30K 70K+" }, - {0x13, 0x01, 0x18, 0x08, "40K 80K+" }, - {0x13, 0x01, 0x18, 0x00, "50K 90K+" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0x14, 0xff, 0xff, 0x0f, NULL }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x14, 0x01, 0x02, 0x02, "Single" }, - {0x14, 0x01, 0x02, 0x00, "Dual" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(mrgoemon) - -static void mrgoemon_bankswitch(INT32 nBank) -{ - mrgoemon_bank = nBank; - ZetMapArea(0xf800, 0xffff, 0, Rom + 0x10000 + mrgoemon_bank); - ZetMapArea(0xf800, 0xffff, 2, Rom + 0x10000 + mrgoemon_bank); -} - -void __fastcall gberet_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe040: - case 0xe041: - case 0xe042: - return; - - case 0xe043: - gberet_spritebank = data; - return; - - case 0xe044: - { - nmi_enable = data & 0x01; - irq_enable = data & ((game_type & 2) ? 0x02 : 0x04); - - flipscreen = data & 0x08; - } - return; - - case 0xf000: - { - // Coin counters - - if (game_type == 2) { - mrgoemon_bankswitch((data >> 5) << 11); - } - } - return; - - case 0xf400: - SN76496Write(0, data); - return; - - case 0xf600: // watchdog - return; - - case 0xf900: - case 0xf901: - gberetb_scroll = (((address & 1) << 8) | data) + 0x38; - return; - } - - if (address >= 0xe000 && address <= 0xe03f) { - Rom[address] = data; - return; - } - - if (game_type != 1) return; - - if (address >= 0xe900 && address <= 0xe9ff) { - Rom[address] = data; - return; - } -} - -UINT8 __fastcall gberet_read(UINT16 address) -{ - UINT8 nRet = 0xff; - - switch (address) - { - case 0xf200: - return DrvDips[1]; - - case 0xf400: - return DrvDips[2]; - - case 0xf600: - return DrvDips[0]; - - case 0xf601: - { - if (game_type & 1) return DrvDips[3]; - - for (INT32 i = 0; i < 8; i++) nRet ^= DrvJoy2[i] << i; - - return nRet; - } - - - case 0xf602: - { - for (INT32 i = 0; i < 8; i++) nRet ^= DrvJoy1[i] << i; - - return nRet; - } - - - case 0xf603: - { - for (INT32 i = 0; i < 8; i++) nRet ^= DrvJoy3[i] << i; - - return nRet; - } - } - - if (address >= 0xe000 && address <= 0xe03f) { - return Rom[address]; - } - - if (game_type != 1) return 0; - - if (address >= 0xe900 && address <= 0xe9ff) { - return Rom[address]; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - flipscreen = 0; - nmi_enable = 0; - irq_enable = 0; - mrgoemon_bank = 0; - gberetb_scroll = 0; - gberet_spritebank = 0; - - ZetOpen(0); - ZetReset(); - - if (game_type & 2) { - mrgoemon_bankswitch(0); - } - - ZetClose(); - - return 0; -} - - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Rom = Next; Next += 0x14000; - - Gfx0 = Next; Next += 0x08000; - Gfx1 = Next; Next += 0x20000; - - Prom = Next; Next += 0x00220; - - Palette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static void DrvCreatePalette() -{ - UINT32 tmp[0x20]; - - for (INT32 i = 0; i < 0x20; i++) - { - INT32 bit0, bit1, bit2; - INT32 r, g, b; - - bit0 = (Prom[i] >> 0) & 0x01; - bit1 = (Prom[i] >> 1) & 0x01; - bit2 = (Prom[i] >> 2) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (Prom[i] >> 3) & 0x01; - bit1 = (Prom[i] >> 4) & 0x01; - bit2 = (Prom[i] >> 5) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = 0; - bit1 = (Prom[i] >> 6) & 0x01; - bit2 = (Prom[i] >> 7) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - tmp[i] = (r << 16) | (g << 8) | b; - } - - Prom += 0x20; - - for (INT32 i = 0; i < 0x100; i++) - { - UINT8 ctabentry; - - ctabentry = (Prom[0x000 + i] & 0x0f) | 0x10; - Palette[0x000 + i] = tmp[ctabentry]; - - ctabentry = (Prom[0x100 + i] & 0x0f); - Palette[0x100 + i] = tmp[ctabentry]; - } -} - -static void Graphics_Decode(INT32 *CharPlanes, INT32 *CharXOffs, INT32 *CharYOffs, INT32 *SprPlanes, INT32 *SprXOffs, INT32 *SprYOffs, INT32 SprMod) -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); - if (tmp == NULL) { - return; - } - - memcpy (tmp, Gfx0, 0x4000); - - GfxDecode(0x200, 4, 8, 8, CharPlanes, CharXOffs, CharYOffs, 0x100, tmp, Gfx0); - - memcpy (tmp, Gfx1, 0x10000); - - GfxDecode(0x200, 4, 16, 16, SprPlanes, SprXOffs, SprYOffs, SprMod, tmp, Gfx1); - - BurnFree (tmp); -} - -static void DrvGfxDecode() -{ - static INT32 Planes[4] = { 0, 1, 2, 3 }; - static INT32 XOffs[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; - static INT32 YOffs[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; - - Graphics_Decode(Planes, XOffs, YOffs, Planes, XOffs, YOffs, 0x400); -} - -static void BootGfxDecode() -{ - static INT32 CharPlanes[4] = { 0, 1, 2, 3 }; - static INT32 CharXOffs[8] = { 24, 28, 0, 4, 8, 12, 16, 20 }; - static INT32 CharYOffs[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; - static INT32 SpriPlanes[4] = { 0, 0x20000, 0x40000, 0x60000 }; - static INT32 SpriXOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; - static INT32 SpriYOffs[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; - - Graphics_Decode(CharPlanes, CharXOffs, CharYOffs, SpriPlanes, SpriXOffs, SpriYOffs, 0x100); -} - -static INT32 GetRoms() -{ - char* pRomName; - struct BurnRomInfo ri; - UINT8 *Load0 = Rom; - UINT8 *Load1 = Gfx0; - UINT8 *Load2 = Gfx1; - UINT8 *Load3 = Prom; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & 7) == 1) { - if (BurnLoadRom(Load0, i, 1)) return 1; - Load0 += ri.nLen; - - continue; - } - - if ((ri.nType & 7) == 2) { - if (BurnLoadRom(Load1, i, 1)) return 1; - Load1 += ri.nLen; - - continue; - } - - if ((ri.nType & 7) == 3) { - if (BurnLoadRom(Load2, i, 1)) return 1; - Load2 += ri.nLen; - - continue; - } - - if ((ri.nType & 7) == 4) { - if (BurnLoadRom(Load3, i, 1)) return 1; - Load3 += ri.nLen; - - continue; - } - } - - if (game_type == 2) { - memcpy (Rom + 0x10000, Rom + 0x0c000, 0x04000); - memset (Rom + 0x0c000, 0, 0x04000); - } - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - if (GetRoms()) return 1; - - if (game_type == 1) { - BootGfxDecode(); - } else { - DrvGfxDecode(); - } - DrvCreatePalette(); - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(gberet_read); - ZetSetWriteHandler(gberet_write); - ZetMapArea(0x0000, 0xbfff, 0, Rom + 0x0000); - ZetMapArea(0x0000, 0xbfff, 2, Rom + 0x0000); - ZetMapArea(0xc000, 0xcfff, 0, Rom + 0xc000); - ZetMapArea(0xc000, 0xcfff, 1, Rom + 0xc000); - ZetMapArea(0xd000, 0xd0ff, 0, Rom + 0xd000); - ZetMapArea(0xd000, 0xd0ff, 1, Rom + 0xd000); - ZetMapArea(0xd100, 0xd1ff, 0, Rom + 0xd100); - ZetMapArea(0xd100, 0xd1ff, 1, Rom + 0xd100); - ZetMapArea(0xd200, 0xdfff, 0, Rom + 0xd200); - ZetMapArea(0xd200, 0xdfff, 1, Rom + 0xd200); - ZetMapArea(0xd200, 0xdfff, 2, Rom + 0xd200); - if (game_type == 2) { - ZetMapArea(0xe800, 0xe8ff, 0, Rom + 0xe800); - ZetMapArea(0xe800, 0xe8ff, 1, Rom + 0xe800); - ZetMapArea(0xe800, 0xe8ff, 2, Rom + 0xe800); - } - ZetMemEnd(); - ZetClose(); - - SN76489AInit(0, 18432000 / 12, 0); - SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - if (game_type == 0) { - BurnSetRefreshRate(30.0); - } - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - SN76496Exit(); - - BurnFree (Rom); - - game_type = 0; - - - return 0; -} - -static inline void put_pixel(INT32 x, INT32 y, INT32 src, INT32 color) -{ - INT32 pxl = color | src; - - if (y < 0 || x < 0 || x >= nScreenWidth || y >= nScreenHeight || !Prom[pxl]) return; - - pTransDraw[(y * nScreenWidth) + x] = pxl; -} - -static void gberet_draw_16x16(INT32 num, INT32 sx, INT32 sy, INT32 color, INT32 flipx, INT32 flipy) -{ - color |= 0x100; - UINT8 *src = Gfx1 + (num << 8); - - if (flipy) { - if (flipx) { - for (INT32 y = sy + 15; y >= sy; y--) { - for (INT32 x = sx + 15; x >= sx; x--, src++) { - put_pixel(x, y, *src, color); - } - } - } else { - for (INT32 y = sy + 15; y >= sy; y--) { - for (INT32 x = sx; x < sx + 16; x++, src++) { - put_pixel(x, y, *src, color); - } - } - } - } else { - if (flipx) { - for (INT32 y = sy; y < sy + 16; y++) { - for (INT32 x = sx + 15; x >= sx; x--, src++) { - put_pixel(x, y, *src, color); - } - } - } else { - for (INT32 y = sy; y < sy + 16; y++) { - for (INT32 x = sx; x < sx + 16; x++, src++) { - put_pixel(x, y, *src, color); - } - } - } - } -} - -static void gberet_draw_sprites() -{ - UINT8 *sr = Rom + 0xd000 + ((~gberet_spritebank & 8) << 5); - - for (INT32 offs = 0; offs < 0xc0; offs += 4) - { - if (sr[offs + 3]) - { - INT32 attr = sr[offs + 1]; - INT32 code = sr[offs + 0] + ((attr & 0x40) << 2); - INT32 sx = sr[offs + 2] - 2 * (attr & 0x80); - INT32 sy = sr[offs + 3]; - INT32 color = (attr & 0x0f) << 4; - INT32 flipx = attr & 0x10; - INT32 flipy = attr & 0x20; - - if (flipscreen) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - sy -= 16; - sx -= 8; - - gberet_draw_16x16(code, sx, sy, color, flipx, flipy); - } - } -} - -static void gberetb_draw_sprites() -{ - for (INT32 offs = 0x100 - 4; offs >= 0; offs -= 4) - { - if (Rom[0xe901 + offs]) - { - INT32 attr = Rom[0xe903 + offs]; - INT32 code = Rom[0xe900 + offs] + ((attr & 0x40) << 2); - INT32 sx = Rom[0xe902 + offs] - 2 * (attr & 0x80); - INT32 sy = 240 - Rom[0xe901 + offs]; - INT32 color = (attr & 0x0f) << 4; - INT32 flipx = attr & 0x10; - INT32 flipy = attr & 0x20; - - if (flipscreen) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - sy -= 16; - sx -= 8; - - gberet_draw_16x16(code, sx, sy, color, flipx, flipy); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalcPal) { - for (INT32 i = 0; i < 0x200; i++) { - DrvPalette[i] = BurnHighCol(Palette[i] >> 16, Palette[i] >> 8, Palette[i], 0); - } - } - - for (INT32 offs = 0x40; offs < 0x7c0; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 3) & 0xf8; - INT32 attr = Rom[0xc000 + offs]; - INT32 code = Rom[0xc800 + offs] + ((attr & 0x40) << 2); - INT32 color = attr & 0x0f; - INT32 flipy = attr & 0x20; - INT32 flipx = attr & 0x10; - - INT32 scroll = 0; - - if (game_type & 1) { - if (sy > 0x2f && sy < 0xe8) { - scroll = gberetb_scroll; - } - } else { - scroll = Rom[0xe000 | (sy >> 3)] | (Rom[0xe020 | (sy >> 3)] << 8); - } - - sx -= scroll; - sx += (sx >> 21) & 0x200; - - if (flipscreen) { - sx = 248 - sx; - sy = 248 - sy; - flipx = !flipx; - flipy = !flipy; - } - - sy -= 16; - sx -= 8; - - if (sx < -7 || sx >= 0x100 || sy < 0 || sy > 223) continue; - - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } else { - Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } - } else { - if (flipx) { - Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - - } - } - } - - if (game_type & 1) { - gberetb_draw_sprites(); - } else { - gberet_draw_sprites(); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = game_type ? 16 : 32; - - if (DrvReset) { - DrvDoReset(); - } - - ZetOpen(0); - - INT32 nCyclesDone, nCyclesTotal; - - nCyclesDone = 0; - nCyclesTotal = 3072000 / (nBurnFPS / 256); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nCyclesSegment = (nCyclesTotal - nCyclesDone) / (nInterleave - i); - - nCyclesDone = ZetRun(nCyclesSegment); - - if (irq_enable && i == (nInterleave - 1)) { - ZetRaiseIrq(0); - } - - if (nmi_enable && (i & 1)) { - ZetNmi(); - } - } - - ZetClose(); - - if (pBurnSoundOut) { - SN76496Update(0, pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029675; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = Rom + 0xc000; - ba.nLen = 0x4000; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - SCAN_VAR(nmi_enable); - SCAN_VAR(irq_enable); - SCAN_VAR(flipscreen); - SCAN_VAR(mrgoemon_bank); - SCAN_VAR(gberetb_scroll); - SCAN_VAR(gberet_spritebank); - - ZetOpen(0); - mrgoemon_bankswitch(mrgoemon_bank); - ZetClose(); - } - - return 0; -} - - -// Green Beret - -static struct BurnRomInfo gberetRomDesc[] = { - { "577l03.10c", 0x4000, 0xae29e4ff, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "577l02.8c", 0x4000, 0x240836a5, 1 | BRF_PRG | BRF_ESS }, // 1 - { "577l01.7c", 0x4000, 0x41fa3e1f, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "577l07.3f", 0x4000, 0x4da7bd1b, 2 | BRF_GRA }, // 3 Characters - - { "577l06.5e", 0x4000, 0x0f1cb0ca, 3 | BRF_GRA }, // 4 Sprites - { "577l05.4e", 0x4000, 0x523a8b66, 3 | BRF_GRA }, // 5 - { "577l08.4f", 0x4000, 0x883933a4, 3 | BRF_GRA }, // 6 - { "577l04.3e", 0x4000, 0xccecda4c, 3 | BRF_GRA }, // 7 - - { "577h09.2f", 0x0020, 0xc15e7c80, 4 | BRF_GRA }, // 8 Color Proms - { "577h11.6f", 0x0100, 0x2a1a992b, 4 | BRF_GRA }, // 9 - { "577h10.5f", 0x0100, 0xe9de1e53, 4 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(gberet) -STD_ROM_FN(gberet) - -struct BurnDriver BurnDrvGberet = { - "gberet", NULL, NULL, NULL, "1985", - "Green Beret\0", NULL, "Konami", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM, 0, - NULL, gberetRomInfo, gberetRomName, NULL, NULL, DrvInputInfo, gberetDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPal, 0x200, - 240, 224, 4, 3 -}; - - -// Rush'n Attack (US) - -static struct BurnRomInfo rushatckRomDesc[] = { - { "577h03.10c", 0x4000, 0x4d276b52, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "577h02.8c", 0x4000, 0xb5802806, 1 | BRF_PRG | BRF_ESS }, // 1 - { "577h01.7c", 0x4000, 0xda7c8f3d, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "577h07.3f", 0x4000, 0x03f9815f, 2 | BRF_GRA }, // 3 Characters - - { "577l06.5e", 0x4000, 0x0f1cb0ca, 3 | BRF_GRA }, // 4 Sprites - { "577h05.4e", 0x4000, 0x9d028e8f, 3 | BRF_GRA }, // 5 - { "577l08.4f", 0x4000, 0x883933a4, 3 | BRF_GRA }, // 6 - { "577l04.3e", 0x4000, 0xccecda4c, 3 | BRF_GRA }, // 7 - - { "577h09.2f", 0x0020, 0xc15e7c80, 4 | BRF_GRA }, // 8 Color Proms - { "577h11.6f", 0x0100, 0x2a1a992b, 4 | BRF_GRA }, // 9 - { "577h10.5f", 0x0100, 0xe9de1e53, 4 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(rushatck) -STD_ROM_FN(rushatck) - -struct BurnDriver BurnDrvRushatck = { - "rushatck", "gberet", NULL, NULL, "1985", - "Rush'n Attack (US)\0", NULL, "Konami", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM, 0, - NULL, rushatckRomInfo, rushatckRomName, NULL, NULL, DrvInputInfo, gberetDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPal, 0x200, - 240, 224, 4, 3 -}; - - -// Green Beret (bootleg) - -static struct BurnRomInfo gberetbRomDesc[] = { - { "2-ic82.10g", 0x8000, 0x6d6fb494, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "3-ic81.10f", 0x4000, 0xf1520a0a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "1-ic92.12c", 0x4000, 0xb0189c87, 2 | BRF_GRA }, // 2 Characters - - { "7-1c8.2b", 0x4000, 0x86334522, 3 | BRF_GRA }, // 3 Sprites - { "6-ic9.2c", 0x4000, 0xbda50d3e, 3 | BRF_GRA }, // 4 - { "5-ic10.2d", 0x4000, 0x6a7b3881, 3 | BRF_GRA }, // 5 - { "4-ic11.2e", 0x4000, 0x3fb186c9, 3 | BRF_GRA }, // 6 - - { "577h09", 0x0020, 0xc15e7c80, 4 | BRF_GRA }, // 7 Color Proms - { "577h11.6f", 0x0100, 0x2a1a992b, 4 | BRF_GRA }, // 8 - { "577h10.5f", 0x0100, 0xe9de1e53, 4 | BRF_GRA }, // 9 - - { "ic35.5h.bin", 0x0001, 0x00000000, BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(gberetb) -STD_ROM_FN(gberetb) - -static INT32 gberetbInit() -{ - game_type = 1; - - return DrvInit(); -} - -struct BurnDriver BurnDrvGberetb = { - "gberetb", "gberet", NULL, NULL, "1985", - "Green Beret (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM, 0, - NULL, gberetbRomInfo, gberetbRomName, NULL, NULL, gberetbInputInfo, gberetbDIPInfo, - gberetbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPal, 0x200, - 240, 224, 4, 3 -}; - - -// Mr. Goemon (Japan) - -static struct BurnRomInfo mrgoemonRomDesc[] = { - { "621d01.10c", 0x8000, 0xb2219c56, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "621d02.12c", 0x8000, 0xc3337a97, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "621a05.6d", 0x4000, 0xf0a6dfc5, 2 | BRF_GRA }, // 2 Characters - - { "621d03.4d", 0x8000, 0x66f2b973, 3 | BRF_GRA }, // 3 Sprites - { "621d04.5d", 0x8000, 0x47df6301, 3 | BRF_GRA }, // 4 - - { "621a06.5f", 0x0020, 0x7c90de5f, 4 | BRF_GRA }, // 5 Color Proms - { "621a08.7f", 0x0100, 0x2fb244dd, 4 | BRF_GRA }, // 6 - { "621a07.6f", 0x0100, 0x3980acdc, 4 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(mrgoemon) -STD_ROM_FN(mrgoemon) - -static INT32 mrgoemonInit() -{ - game_type = 2; - - return DrvInit(); -} - -struct BurnDriver BurnDrvMrgoemon = { - "mrgoemon", NULL, NULL, NULL, "1986", - "Mr. Goemon (Japan)\0", NULL, "Konami", "Miscellaneous", - L"Mr. Goemon \u4E94\u53F3\u885B\u9580 (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM, 0, - NULL, mrgoemonRomInfo, mrgoemonRomName, NULL, NULL, DrvInputInfo, mrgoemonDIPInfo, - mrgoemonInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPal, 0x200, - 240, 224, 4, 3 -}; - +// FB Alpha Green Beret driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "sn76496.h" + +static UINT8 *Mem, *MemEnd, *Rom, *Gfx0, *Gfx1, *Prom; +static UINT32 *Palette, *DrvPalette; +static UINT8 DrvRecalcPal; + +static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvDips[4], DrvReset; + +static UINT8 nmi_enable, irq_enable; +static UINT16 gberetb_scroll; +static UINT8 flipscreen; +static UINT8 gberet_spritebank; +static INT32 mrgoemon_bank; + +static INT32 game_type = 0; // 0 gberet / rushatck, 1 gberetb, 2 mrgoemon + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy3 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy3 + 1, "p2 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 3, "p1 start" }, + {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 4, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 3, "p1 down" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p2 right" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 3, "p2 down" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2" }, + + {"Service" , BIT_DIGITAL , DrvJoy3 + 2, "service" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDips + 2, "dip" }, + +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo gberetbInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy3 + 7, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy3 + 6, "p2 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 5, "p1 start" }, + {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 4, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 3, "p1 down" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDips + 3, "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(gberetb) + +static struct BurnDIPInfo gberetDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15 , "Coin B" }, + {0x12, 0x82, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + + {0x13, 0xff, 0xff, 0x4a, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x03, "2" }, + {0x13, 0x01, 0x03, 0x02, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x04, 0x00, "Upright" }, + {0x13, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "30K 70K 70K+" }, + {0x13, 0x01, 0x18, 0x10, "40K 80K 80K+" }, + {0x13, 0x01, 0x18, 0x08, "50K 100K 100K+" }, + {0x13, 0x01, 0x18, 0x00, "50K 200K 200K+" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0x14, 0xff, 0xff, 0x0f, NULL }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x14, 0x01, 0x02, 0x02, "Single" }, + {0x14, 0x01, 0x02, 0x00, "Dual" }, +}; + +STDDIPINFO(gberet) + +static struct BurnDIPInfo gberetbDIPList[]= +{ + {0x0b, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x0b, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x0b, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x0b, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x0b, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x0b, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x0b, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x0b, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x0b, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x0b, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x0b, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x0b, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x0b, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x0b, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15 , "Coin B" }, + {0x0b, 0x82, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + {0x0b, 0x82, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x0b, 0x00, 0x0f, 0x00, NULL }, + + {0x0c, 0xff, 0xff, 0x4a, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0c, 0x01, 0x03, 0x03, "2" }, + {0x0c, 0x01, 0x03, 0x02, "3" }, + {0x0c, 0x01, 0x03, 0x01, "5" }, + {0x0c, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x04, 0x00, "Upright" }, + {0x0c, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0c, 0x01, 0x18, 0x18, "30K 70K 70K+" }, + {0x0c, 0x01, 0x18, 0x10, "40K 80K 80K+" }, + {0x0c, 0x01, 0x18, 0x08, "50K 100K 100K+" }, + {0x0c, 0x01, 0x18, 0x00, "50K 200K 200K+" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x60, 0x60, "Easy" }, + {0x0c, 0x01, 0x60, 0x40, "Normal" }, + {0x0c, 0x01, 0x60, 0x20, "Difficult" }, + {0x0c, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0c, 0x01, 0x80, 0x80, "Off" }, + {0x0c, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(gberetb) + +static struct BurnDIPInfo mrgoemonDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15 , "Coin B" }, + {0x12, 0x82, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + {0x12, 0x82, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x12, 0x00, 0x0f, 0x00, NULL }, + + {0x13, 0xff, 0xff, 0x4a, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x03, "2" }, + {0x13, 0x01, 0x03, 0x02, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x04, 0x00, "Upright" }, + {0x13, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "20K 60K+" }, + {0x13, 0x01, 0x18, 0x10, "30K 70K+" }, + {0x13, 0x01, 0x18, 0x08, "40K 80K+" }, + {0x13, 0x01, 0x18, 0x00, "50K 90K+" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0x14, 0xff, 0xff, 0x0f, NULL }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x14, 0x01, 0x02, 0x02, "Single" }, + {0x14, 0x01, 0x02, 0x00, "Dual" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(mrgoemon) + +static void mrgoemon_bankswitch(INT32 nBank) +{ + mrgoemon_bank = nBank; + ZetMapArea(0xf800, 0xffff, 0, Rom + 0x10000 + mrgoemon_bank); + ZetMapArea(0xf800, 0xffff, 2, Rom + 0x10000 + mrgoemon_bank); +} + +void __fastcall gberet_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe040: + case 0xe041: + case 0xe042: + return; + + case 0xe043: + gberet_spritebank = data; + return; + + case 0xe044: + { + nmi_enable = data & 0x01; + irq_enable = data & ((game_type & 2) ? 0x02 : 0x04); + + flipscreen = data & 0x08; + } + return; + + case 0xf000: + { + // Coin counters + + if (game_type == 2) { + mrgoemon_bankswitch((data >> 5) << 11); + } + } + return; + + case 0xf400: + SN76496Write(0, data); + return; + + case 0xf600: // watchdog + return; + + case 0xf900: + case 0xf901: + gberetb_scroll = (((address & 1) << 8) | data) + 0x38; + return; + } + + if (address >= 0xe000 && address <= 0xe03f) { + Rom[address] = data; + return; + } + + if (game_type != 1) return; + + if (address >= 0xe900 && address <= 0xe9ff) { + Rom[address] = data; + return; + } +} + +UINT8 __fastcall gberet_read(UINT16 address) +{ + UINT8 nRet = 0xff; + + switch (address) + { + case 0xf200: + return DrvDips[1]; + + case 0xf400: + return DrvDips[2]; + + case 0xf600: + return DrvDips[0]; + + case 0xf601: + { + if (game_type & 1) return DrvDips[3]; + + for (INT32 i = 0; i < 8; i++) nRet ^= DrvJoy2[i] << i; + + return nRet; + } + + + case 0xf602: + { + for (INT32 i = 0; i < 8; i++) nRet ^= DrvJoy1[i] << i; + + return nRet; + } + + + case 0xf603: + { + for (INT32 i = 0; i < 8; i++) nRet ^= DrvJoy3[i] << i; + + return nRet; + } + } + + if (address >= 0xe000 && address <= 0xe03f) { + return Rom[address]; + } + + if (game_type != 1) return 0; + + if (address >= 0xe900 && address <= 0xe9ff) { + return Rom[address]; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + flipscreen = 0; + nmi_enable = 0; + irq_enable = 0; + mrgoemon_bank = 0; + gberetb_scroll = 0; + gberet_spritebank = 0; + + ZetOpen(0); + ZetReset(); + + if (game_type & 2) { + mrgoemon_bankswitch(0); + } + + ZetClose(); + + return 0; +} + + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Rom = Next; Next += 0x14000; + + Gfx0 = Next; Next += 0x08000; + Gfx1 = Next; Next += 0x20000; + + Prom = Next; Next += 0x00220; + + Palette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static void DrvCreatePalette() +{ + UINT32 tmp[0x20]; + + for (INT32 i = 0; i < 0x20; i++) + { + INT32 bit0, bit1, bit2; + INT32 r, g, b; + + bit0 = (Prom[i] >> 0) & 0x01; + bit1 = (Prom[i] >> 1) & 0x01; + bit2 = (Prom[i] >> 2) & 0x01; + r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (Prom[i] >> 3) & 0x01; + bit1 = (Prom[i] >> 4) & 0x01; + bit2 = (Prom[i] >> 5) & 0x01; + g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = 0; + bit1 = (Prom[i] >> 6) & 0x01; + bit2 = (Prom[i] >> 7) & 0x01; + b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + tmp[i] = (r << 16) | (g << 8) | b; + } + + Prom += 0x20; + + for (INT32 i = 0; i < 0x100; i++) + { + UINT8 ctabentry; + + ctabentry = (Prom[0x000 + i] & 0x0f) | 0x10; + Palette[0x000 + i] = tmp[ctabentry]; + + ctabentry = (Prom[0x100 + i] & 0x0f); + Palette[0x100 + i] = tmp[ctabentry]; + } +} + +static void Graphics_Decode(INT32 *CharPlanes, INT32 *CharXOffs, INT32 *CharYOffs, INT32 *SprPlanes, INT32 *SprXOffs, INT32 *SprYOffs, INT32 SprMod) +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); + if (tmp == NULL) { + return; + } + + memcpy (tmp, Gfx0, 0x4000); + + GfxDecode(0x200, 4, 8, 8, CharPlanes, CharXOffs, CharYOffs, 0x100, tmp, Gfx0); + + memcpy (tmp, Gfx1, 0x10000); + + GfxDecode(0x200, 4, 16, 16, SprPlanes, SprXOffs, SprYOffs, SprMod, tmp, Gfx1); + + BurnFree (tmp); +} + +static void DrvGfxDecode() +{ + static INT32 Planes[4] = { 0, 1, 2, 3 }; + static INT32 XOffs[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; + static INT32 YOffs[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; + + Graphics_Decode(Planes, XOffs, YOffs, Planes, XOffs, YOffs, 0x400); +} + +static void BootGfxDecode() +{ + static INT32 CharPlanes[4] = { 0, 1, 2, 3 }; + static INT32 CharXOffs[8] = { 24, 28, 0, 4, 8, 12, 16, 20 }; + static INT32 CharYOffs[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; + static INT32 SpriPlanes[4] = { 0, 0x20000, 0x40000, 0x60000 }; + static INT32 SpriXOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; + static INT32 SpriYOffs[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; + + Graphics_Decode(CharPlanes, CharXOffs, CharYOffs, SpriPlanes, SpriXOffs, SpriYOffs, 0x100); +} + +static INT32 GetRoms() +{ + char* pRomName; + struct BurnRomInfo ri; + UINT8 *Load0 = Rom; + UINT8 *Load1 = Gfx0; + UINT8 *Load2 = Gfx1; + UINT8 *Load3 = Prom; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & 7) == 1) { + if (BurnLoadRom(Load0, i, 1)) return 1; + Load0 += ri.nLen; + + continue; + } + + if ((ri.nType & 7) == 2) { + if (BurnLoadRom(Load1, i, 1)) return 1; + Load1 += ri.nLen; + + continue; + } + + if ((ri.nType & 7) == 3) { + if (BurnLoadRom(Load2, i, 1)) return 1; + Load2 += ri.nLen; + + continue; + } + + if ((ri.nType & 7) == 4) { + if (BurnLoadRom(Load3, i, 1)) return 1; + Load3 += ri.nLen; + + continue; + } + } + + if (game_type == 2) { + memcpy (Rom + 0x10000, Rom + 0x0c000, 0x04000); + memset (Rom + 0x0c000, 0, 0x04000); + } + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + if (GetRoms()) return 1; + + if (game_type == 1) { + BootGfxDecode(); + } else { + DrvGfxDecode(); + } + DrvCreatePalette(); + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(gberet_read); + ZetSetWriteHandler(gberet_write); + ZetMapArea(0x0000, 0xbfff, 0, Rom + 0x0000); + ZetMapArea(0x0000, 0xbfff, 2, Rom + 0x0000); + ZetMapArea(0xc000, 0xcfff, 0, Rom + 0xc000); + ZetMapArea(0xc000, 0xcfff, 1, Rom + 0xc000); + ZetMapArea(0xd000, 0xd0ff, 0, Rom + 0xd000); + ZetMapArea(0xd000, 0xd0ff, 1, Rom + 0xd000); + ZetMapArea(0xd100, 0xd1ff, 0, Rom + 0xd100); + ZetMapArea(0xd100, 0xd1ff, 1, Rom + 0xd100); + ZetMapArea(0xd200, 0xdfff, 0, Rom + 0xd200); + ZetMapArea(0xd200, 0xdfff, 1, Rom + 0xd200); + ZetMapArea(0xd200, 0xdfff, 2, Rom + 0xd200); + if (game_type == 2) { + ZetMapArea(0xe800, 0xe8ff, 0, Rom + 0xe800); + ZetMapArea(0xe800, 0xe8ff, 1, Rom + 0xe800); + ZetMapArea(0xe800, 0xe8ff, 2, Rom + 0xe800); + } + ZetClose(); + + SN76489AInit(0, 18432000 / 12, 0); + SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + if (game_type == 0) { + BurnSetRefreshRate(30.0); + } + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + SN76496Exit(); + + BurnFree (Rom); + + game_type = 0; + + + return 0; +} + +static inline void put_pixel(INT32 x, INT32 y, INT32 src, INT32 color) +{ + INT32 pxl = color | src; + + if (y < 0 || x < 0 || x >= nScreenWidth || y >= nScreenHeight || !Prom[pxl]) return; + + pTransDraw[(y * nScreenWidth) + x] = pxl; +} + +static void gberet_draw_16x16(INT32 num, INT32 sx, INT32 sy, INT32 color, INT32 flipx, INT32 flipy) +{ + color |= 0x100; + UINT8 *src = Gfx1 + (num << 8); + + if (flipy) { + if (flipx) { + for (INT32 y = sy + 15; y >= sy; y--) { + for (INT32 x = sx + 15; x >= sx; x--, src++) { + put_pixel(x, y, *src, color); + } + } + } else { + for (INT32 y = sy + 15; y >= sy; y--) { + for (INT32 x = sx; x < sx + 16; x++, src++) { + put_pixel(x, y, *src, color); + } + } + } + } else { + if (flipx) { + for (INT32 y = sy; y < sy + 16; y++) { + for (INT32 x = sx + 15; x >= sx; x--, src++) { + put_pixel(x, y, *src, color); + } + } + } else { + for (INT32 y = sy; y < sy + 16; y++) { + for (INT32 x = sx; x < sx + 16; x++, src++) { + put_pixel(x, y, *src, color); + } + } + } + } +} + +static void gberet_draw_sprites() +{ + UINT8 *sr = Rom + 0xd000 + ((~gberet_spritebank & 8) << 5); + + for (INT32 offs = 0; offs < 0xc0; offs += 4) + { + if (sr[offs + 3]) + { + INT32 attr = sr[offs + 1]; + INT32 code = sr[offs + 0] + ((attr & 0x40) << 2); + INT32 sx = sr[offs + 2] - 2 * (attr & 0x80); + INT32 sy = sr[offs + 3]; + INT32 color = (attr & 0x0f) << 4; + INT32 flipx = attr & 0x10; + INT32 flipy = attr & 0x20; + + if (flipscreen) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + sy -= 16; + sx -= 8; + + gberet_draw_16x16(code, sx, sy, color, flipx, flipy); + } + } +} + +static void gberetb_draw_sprites() +{ + for (INT32 offs = 0x100 - 4; offs >= 0; offs -= 4) + { + if (Rom[0xe901 + offs]) + { + INT32 attr = Rom[0xe903 + offs]; + INT32 code = Rom[0xe900 + offs] + ((attr & 0x40) << 2); + INT32 sx = Rom[0xe902 + offs] - 2 * (attr & 0x80); + INT32 sy = 240 - Rom[0xe901 + offs]; + INT32 color = (attr & 0x0f) << 4; + INT32 flipx = attr & 0x10; + INT32 flipy = attr & 0x20; + + if (flipscreen) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + sy -= 16; + sx -= 8; + + gberet_draw_16x16(code, sx, sy, color, flipx, flipy); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalcPal) { + for (INT32 i = 0; i < 0x200; i++) { + DrvPalette[i] = BurnHighCol(Palette[i] >> 16, Palette[i] >> 8, Palette[i], 0); + } + } + + for (INT32 offs = 0x40; offs < 0x7c0; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 3) & 0xf8; + INT32 attr = Rom[0xc000 + offs]; + INT32 code = Rom[0xc800 + offs] + ((attr & 0x40) << 2); + INT32 color = attr & 0x0f; + INT32 flipy = attr & 0x20; + INT32 flipx = attr & 0x10; + + INT32 scroll = 0; + + if (game_type & 1) { + if (sy > 0x2f && sy < 0xe8) { + scroll = gberetb_scroll; + } + } else { + scroll = Rom[0xe000 | (sy >> 3)] | (Rom[0xe020 | (sy >> 3)] << 8); + } + + sx -= scroll; + sx += (sx >> 21) & 0x200; + + if (flipscreen) { + sx = 248 - sx; + sy = 248 - sy; + flipx = !flipx; + flipy = !flipy; + } + + sy -= 16; + sx -= 8; + + if (sx < -7 || sx >= 0x100 || sy < 0 || sy > 223) continue; + + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } else { + Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } + } else { + if (flipx) { + Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + + } + } + } + + if (game_type & 1) { + gberetb_draw_sprites(); + } else { + gberet_draw_sprites(); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = game_type ? 16 : 32; + + if (DrvReset) { + DrvDoReset(); + } + + ZetOpen(0); + + INT32 nCyclesDone, nCyclesTotal; + + nCyclesDone = 0; + nCyclesTotal = 3072000 / (nBurnFPS / 256); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nCyclesSegment = (nCyclesTotal - nCyclesDone) / (nInterleave - i); + + nCyclesDone = ZetRun(nCyclesSegment); + + if (irq_enable && i == (nInterleave - 1)) { + ZetRaiseIrq(0); + } + + if (nmi_enable && (i & 1)) { + ZetNmi(); + } + } + + ZetClose(); + + if (pBurnSoundOut) { + SN76496Update(0, pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029675; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = Rom + 0xc000; + ba.nLen = 0x4000; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + SCAN_VAR(nmi_enable); + SCAN_VAR(irq_enable); + SCAN_VAR(flipscreen); + SCAN_VAR(mrgoemon_bank); + SCAN_VAR(gberetb_scroll); + SCAN_VAR(gberet_spritebank); + + ZetOpen(0); + mrgoemon_bankswitch(mrgoemon_bank); + ZetClose(); + } + + return 0; +} + + +// Green Beret + +static struct BurnRomInfo gberetRomDesc[] = { + { "577l03.10c", 0x4000, 0xae29e4ff, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "577l02.8c", 0x4000, 0x240836a5, 1 | BRF_PRG | BRF_ESS }, // 1 + { "577l01.7c", 0x4000, 0x41fa3e1f, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "577l07.3f", 0x4000, 0x4da7bd1b, 2 | BRF_GRA }, // 3 Characters + + { "577l06.5e", 0x4000, 0x0f1cb0ca, 3 | BRF_GRA }, // 4 Sprites + { "577l05.4e", 0x4000, 0x523a8b66, 3 | BRF_GRA }, // 5 + { "577l08.4f", 0x4000, 0x883933a4, 3 | BRF_GRA }, // 6 + { "577l04.3e", 0x4000, 0xccecda4c, 3 | BRF_GRA }, // 7 + + { "577h09.2f", 0x0020, 0xc15e7c80, 4 | BRF_GRA }, // 8 Color Proms + { "577h11.6f", 0x0100, 0x2a1a992b, 4 | BRF_GRA }, // 9 + { "577h10.5f", 0x0100, 0xe9de1e53, 4 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(gberet) +STD_ROM_FN(gberet) + +struct BurnDriver BurnDrvGberet = { + "gberet", NULL, NULL, NULL, "1985", + "Green Beret\0", NULL, "Konami", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM, 0, + NULL, gberetRomInfo, gberetRomName, NULL, NULL, DrvInputInfo, gberetDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPal, 0x200, + 240, 224, 4, 3 +}; + + +// Rush'n Attack (US) + +static struct BurnRomInfo rushatckRomDesc[] = { + { "577h03.10c", 0x4000, 0x4d276b52, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "577h02.8c", 0x4000, 0xb5802806, 1 | BRF_PRG | BRF_ESS }, // 1 + { "577h01.7c", 0x4000, 0xda7c8f3d, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "577h07.3f", 0x4000, 0x03f9815f, 2 | BRF_GRA }, // 3 Characters + + { "577l06.5e", 0x4000, 0x0f1cb0ca, 3 | BRF_GRA }, // 4 Sprites + { "577h05.4e", 0x4000, 0x9d028e8f, 3 | BRF_GRA }, // 5 + { "577l08.4f", 0x4000, 0x883933a4, 3 | BRF_GRA }, // 6 + { "577l04.3e", 0x4000, 0xccecda4c, 3 | BRF_GRA }, // 7 + + { "577h09.2f", 0x0020, 0xc15e7c80, 4 | BRF_GRA }, // 8 Color Proms + { "577h11.6f", 0x0100, 0x2a1a992b, 4 | BRF_GRA }, // 9 + { "577h10.5f", 0x0100, 0xe9de1e53, 4 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(rushatck) +STD_ROM_FN(rushatck) + +struct BurnDriver BurnDrvRushatck = { + "rushatck", "gberet", NULL, NULL, "1985", + "Rush'n Attack (US)\0", NULL, "Konami", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM, 0, + NULL, rushatckRomInfo, rushatckRomName, NULL, NULL, DrvInputInfo, gberetDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPal, 0x200, + 240, 224, 4, 3 +}; + + +// Green Beret (bootleg) + +static struct BurnRomInfo gberetbRomDesc[] = { + { "2-ic82.10g", 0x8000, 0x6d6fb494, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "3-ic81.10f", 0x4000, 0xf1520a0a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "1-ic92.12c", 0x4000, 0xb0189c87, 2 | BRF_GRA }, // 2 Characters + + { "7-1c8.2b", 0x4000, 0x86334522, 3 | BRF_GRA }, // 3 Sprites + { "6-ic9.2c", 0x4000, 0xbda50d3e, 3 | BRF_GRA }, // 4 + { "5-ic10.2d", 0x4000, 0x6a7b3881, 3 | BRF_GRA }, // 5 + { "4-ic11.2e", 0x4000, 0x3fb186c9, 3 | BRF_GRA }, // 6 + + { "577h09", 0x0020, 0xc15e7c80, 4 | BRF_GRA }, // 7 Color Proms + { "577h11.6f", 0x0100, 0x2a1a992b, 4 | BRF_GRA }, // 8 + { "577h10.5f", 0x0100, 0xe9de1e53, 4 | BRF_GRA }, // 9 + + { "ic35.5h.bin", 0x0001, 0x00000000, BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(gberetb) +STD_ROM_FN(gberetb) + +static INT32 gberetbInit() +{ + game_type = 1; + + return DrvInit(); +} + +struct BurnDriver BurnDrvGberetb = { + "gberetb", "gberet", NULL, NULL, "1985", + "Green Beret (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM, 0, + NULL, gberetbRomInfo, gberetbRomName, NULL, NULL, gberetbInputInfo, gberetbDIPInfo, + gberetbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPal, 0x200, + 240, 224, 4, 3 +}; + + +// Mr. Goemon (Japan) + +static struct BurnRomInfo mrgoemonRomDesc[] = { + { "621d01.10c", 0x8000, 0xb2219c56, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "621d02.12c", 0x8000, 0xc3337a97, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "621a05.6d", 0x4000, 0xf0a6dfc5, 2 | BRF_GRA }, // 2 Characters + + { "621d03.4d", 0x8000, 0x66f2b973, 3 | BRF_GRA }, // 3 Sprites + { "621d04.5d", 0x8000, 0x47df6301, 3 | BRF_GRA }, // 4 + + { "621a06.5f", 0x0020, 0x7c90de5f, 4 | BRF_GRA }, // 5 Color Proms + { "621a08.7f", 0x0100, 0x2fb244dd, 4 | BRF_GRA }, // 6 + { "621a07.6f", 0x0100, 0x3980acdc, 4 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(mrgoemon) +STD_ROM_FN(mrgoemon) + +static INT32 mrgoemonInit() +{ + game_type = 2; + + return DrvInit(); +} + +struct BurnDriver BurnDrvMrgoemon = { + "mrgoemon", NULL, NULL, NULL, "1986", + "Mr. Goemon (Japan)\0", NULL, "Konami", "Miscellaneous", + L"Mr. Goemon \u4E94\u53F3\u885B\u9580 (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM, 0, + NULL, mrgoemonRomInfo, mrgoemonRomName, NULL, NULL, DrvInputInfo, mrgoemonDIPInfo, + mrgoemonInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPal, 0x200, + 240, 224, 4, 3 +}; + diff --git a/src/burn/drv/konami/d_gbusters.cpp b/src/burn/drv/konami/d_gbusters.cpp index 404e626be..28f243de1 100644 --- a/src/burn/drv/konami/d_gbusters.cpp +++ b/src/burn/drv/konami/d_gbusters.cpp @@ -1,698 +1,697 @@ -// FB Alpha Gang Busters driver module -// Based on MAME by Manuel Abadia - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" -#include "k007232.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM; -static UINT8 *DrvBankRAM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *nDrvRamBank; -static UINT8 *nDrvKonamiBank; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo GbustersInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Gbusters) - -static struct BurnDIPInfo GbustersDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x56, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x03, "2" }, - {0x13, 0x01, 0x03, 0x02, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Bullets" }, - {0x13, 0x01, 0x04, 0x04, "50" }, - {0x13, 0x01, 0x04, 0x00, "60" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "50k, 200k & 400k" }, - {0x13, 0x01, 0x18, 0x10, "70k, 250k & 500k" }, - {0x13, 0x01, 0x18, 0x08, "50k" }, - {0x13, 0x01, 0x18, 0x00, "70k" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x01, 0x01, "Off" }, -// {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Gbusters) - -static void set_ram_bank(INT32 data) -{ - nDrvRamBank[0] = data; - - if (~data & 0x01) { - konamiMapMemory(DrvPalRAM, 0x5800, 0x5fff, KON_RAM); - } else { - konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); - } -} - -void gbusters_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x1f80: - set_ram_bank(data); - return; - - case 0x1f84: - *soundlatch = data; - return; - - case 0x1f88: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - - return; - - case 0x1f8c: - // watchdog - return; - - case 0x1f98: - K052109RMRDLine = data & 0x01; - return; - } - - if ((address & 0xc000) == 0x0000) { - K052109_051960_w(address & 0x3fff, data); - return; - } -} - -UINT8 gbusters_main_read(UINT16 address) -{ - switch (address) - { - case 0x1f90: - return DrvInputs[0]; - - case 0x1f91: - return DrvInputs[1]; - - case 0x1f92: - return DrvInputs[2]; - - case 0x1f93: - return DrvDips[2]; - - case 0x1f94: - return DrvDips[0]; - - case 0x1f95: - return DrvDips[1]; - } - - if ((address & 0xc000) == 0x0000) { - return K052109_051960_r(address & 0x3fff); - } - - return 0; -} - -static void gbusters_snd_bankswitch_w(INT32 data) -{ - INT32 bank_B = ((data >> 2) & 0x01); - INT32 bank_A = ((data) & 0x01); - k007232_set_bank(0, bank_A, bank_B ); -} - -void __fastcall gbusters_sound_write(UINT16 address, UINT8 data) -{ - if ((address & 0xfff0) == 0xb000) { - K007232WriteReg(0, address & 0x0f, data); - return; - } - - switch (address) - { - case 0xc000: - BurnYM2151SelectRegister(data); - return; - - case 0xc001: - BurnYM2151WriteRegister(data); - return; - - case 0xf000: - gbusters_snd_bankswitch_w(data); - return; - } -} - -UINT8 __fastcall gbusters_sound_read(UINT16 address) -{ - if ((address & 0xfff0) == 0xb000) { - return K007232ReadReg(0, address & 0x0f); - } - - switch (address) - { - case 0xa000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0xc001: - return BurnYM2151ReadStatus(); - } - - return 0; -} - -static void gbusters_set_lines(INT32 lines) -{ - INT32 nBank = 0x10000 + (lines & 0x0f) * 0x2000; - - nDrvKonamiBank[1] = lines; - - konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); -} - -static void DrvK007232VolCallback(INT32 v) -{ - K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); - K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); -} - -static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - INT32 layer_colorbase[3] = { 0x30, 0x00, 0x10 }; - - *code |= ((*color & 0x0d) << 8) | ((*color & 0x10) << 5) | (bank << 12); - *code &= 0x3fff; - *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); -} - -static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) -{ - *priority = (*color & 0x30) >> 4; - *color = 0x20 + (*color & 0x0f); - *code &= 0x0fff; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x030000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x080000; - DrvGfxROM1 = Next; Next += 0x080000; - DrvGfxROMExp0 = Next; Next += 0x100000; - DrvGfxROMExp1 = Next; Next += 0x100000; - - DrvSndROM = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); - - AllRam = Next; - - DrvBankRAM = Next; Next += 0x000800; - DrvKonRAM = Next; Next += 0x001800; - DrvPalRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - nDrvRamBank = Next; Next += 0x000001; - nDrvKonamiBank = Next; Next += 0x000002; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x80000); - konami_rom_deinterleave_2(DrvGfxROM1, 0x80000); - - GfxDecode(0x04000, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x01000, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvKonROM + 0x000000, 0, 1)) return 1; - if (BurnLoadRom(DrvKonROM + 0x020000, 1, 1)) return 1; - memcpy (DrvKonROM + 0x10000, DrvKonROM + 0x00000, 0x08000); - memcpy (DrvKonROM + 0x18000, DrvKonROM + 0x00000, 0x08000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 6, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 7, 1)) return 1; - - DrvGfxDecode(); - } - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvKonRAM, 0x4000, 0x57ff, KON_RAM); - konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(gbusters_main_write); - konamiSetReadHandler(gbusters_main_read); - konamiSetlinesCallback(gbusters_set_lines); - konamiClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(gbusters_sound_write); - ZetSetReadHandler(gbusters_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); - - K007232Init(0, 3579545, DrvSndROM, 0x40000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback); - K007232PCMSetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); - - K052109Init(DrvGfxROM0, 0x7ffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(8, 0); - - K051960Init(DrvGfxROM1, 0x7ffff); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(8, 0); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - konamiExit(); - ZetExit(); - - K007232Exit(); - BurnYM2151Exit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800); - } - - K052109UpdateScroll(); - - if (nDrvRamBank[0] & 0x08) - { - - if (nBurnLayer & 1) K052109RenderLayer(2, 1, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 2); - if (nBurnLayer & 2) K052109RenderLayer(1, 0, DrvGfxROMExp0); - } - else - { - if (nBurnLayer & 4) K052109RenderLayer(1, 1, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 2); - if (nBurnLayer & 8) K052109RenderLayer(2, 0, DrvGfxROMExp0); - } - - K051960SpritesRender(DrvGfxROMExp1, 1); - K052109RenderLayer(0, 0, DrvGfxROMExp0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; - if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; - } - - konamiNewFrame(); - ZetNewFrame(); - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = nBurnSoundLen; - INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetOpen(0); - konamiOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - - nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); - - nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); - - nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K052109_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - } - } - - konamiClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029704; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - K007232Scan(nAction, pnMin); - - KonamiICScan(nAction); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - set_ram_bank(nDrvRamBank[0]); - gbusters_set_lines(nDrvKonamiBank[1]); - konamiClose(); - } - - return 0; -} - - -// Gang Busters (set 1) - -static struct BurnRomInfo gbustersRomDesc[] = { - { "878n02.k13", 0x10000, 0x51697aaa, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "878j03.k15", 0x10000, 0x3943a065, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "878h01.f8", 0x08000, 0x96feafaa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "878c07.h27", 0x40000, 0xeeed912c, 3 | BRF_GRA }, // 3 Background Tiles - { "878c08.k27", 0x40000, 0x4d14626d, 3 | BRF_GRA }, // 4 - - { "878c05.h5", 0x40000, 0x01f4aea5, 4 | BRF_GRA }, // 5 Sprites - { "878c06.k5", 0x40000, 0xedfaaaaf, 4 | BRF_GRA }, // 6 - - { "878c04.d5", 0x40000, 0x9e982d1c, 5 | BRF_SND }, // 7 K007232 Samples - - { "878a09.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 8 Proms -}; - -STD_ROM_PICK(gbusters) -STD_ROM_FN(gbusters) - -struct BurnDriver BurnDrvGbusters = { - "gbusters", NULL, NULL, NULL, "1988", - "Gang Busters (set 1)\0", NULL, "Konami", "GX878", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, gbustersRomInfo, gbustersRomName, NULL, NULL, GbustersInputInfo, GbustersDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 224, 288, 3, 4 -}; - - -// Gang Busters (set 2) - -static struct BurnRomInfo gbusteraRomDesc[] = { - { "878_02.k13", 0x10000, 0x57178414, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "878_03.k15", 0x10000, 0x6c59e660, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "878h01.f8", 0x08000, 0x96feafaa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "878c07.h27", 0x40000, 0xeeed912c, 3 | BRF_GRA }, // 3 Background Tiles - { "878c08.k27", 0x40000, 0x4d14626d, 3 | BRF_GRA }, // 4 - - { "878c05.h5", 0x40000, 0x01f4aea5, 4 | BRF_GRA }, // 5 Sprites - { "878c06.k5", 0x40000, 0xedfaaaaf, 4 | BRF_GRA }, // 6 - - { "878c04.d5", 0x40000, 0x9e982d1c, 5 | BRF_SND }, // 7 K007232 Samples - - { "878a09.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 8 Proms -}; - -STD_ROM_PICK(gbustera) -STD_ROM_FN(gbustera) - -struct BurnDriver BurnDrvGbustera = { - "gbustersa", "gbusters", NULL, NULL, "1988", - "Gang Busters (set 2)\0", NULL, "Konami", "GX878", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, gbusteraRomInfo, gbusteraRomName, NULL, NULL, GbustersInputInfo, GbustersDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 224, 288, 3, 4 -}; - - -// Crazy Cop (Japan) - -static struct BurnRomInfo crazycopRomDesc[] = { - { "878m02.k13", 0x10000, 0x9c1c9f52, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "878j03.k15", 0x10000, 0x3943a065, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "878h01.f8", 0x08000, 0x96feafaa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "878c07.h27", 0x40000, 0xeeed912c, 3 | BRF_GRA }, // 3 Background Tiles - { "878c08.k27", 0x40000, 0x4d14626d, 3 | BRF_GRA }, // 4 - - { "878c05.h5", 0x40000, 0x01f4aea5, 4 | BRF_GRA }, // 5 Sprites - { "878c06.k5", 0x40000, 0xedfaaaaf, 4 | BRF_GRA }, // 6 - - { "878c04.d5", 0x40000, 0x9e982d1c, 5 | BRF_SND }, // 7 K007232 Samples - - { "878a09.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 8 Proms -}; - -STD_ROM_PICK(crazycop) -STD_ROM_FN(crazycop) - -struct BurnDriver BurnDrvCrazycop = { - "crazycop", "gbusters", NULL, NULL, "1988", - "Crazy Cop (Japan)\0", NULL, "Konami", "GX878", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, crazycopRomInfo, crazycopRomName, NULL, NULL, GbustersInputInfo, GbustersDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 224, 288, 3, 4 -}; +// FB Alpha Gang Busters driver module +// Based on MAME by Manuel Abadia + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" +#include "k007232.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM; +static UINT8 *DrvBankRAM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *nDrvRamBank; +static UINT8 *nDrvKonamiBank; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo GbustersInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Gbusters) + +static struct BurnDIPInfo GbustersDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x56, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x03, "2" }, + {0x13, 0x01, 0x03, 0x02, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Bullets" }, + {0x13, 0x01, 0x04, 0x04, "50" }, + {0x13, 0x01, 0x04, 0x00, "60" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "50k, 200k & 400k" }, + {0x13, 0x01, 0x18, 0x10, "70k, 250k & 500k" }, + {0x13, 0x01, 0x18, 0x08, "50k" }, + {0x13, 0x01, 0x18, 0x00, "70k" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x01, 0x01, "Off" }, +// {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Gbusters) + +static void set_ram_bank(INT32 data) +{ + nDrvRamBank[0] = data; + + if (~data & 0x01) { + konamiMapMemory(DrvPalRAM, 0x5800, 0x5fff, KON_RAM); + } else { + konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); + } +} + +void gbusters_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x1f80: + set_ram_bank(data); + return; + + case 0x1f84: + *soundlatch = data; + return; + + case 0x1f88: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + + return; + + case 0x1f8c: + // watchdog + return; + + case 0x1f98: + K052109RMRDLine = data & 0x01; + return; + } + + if ((address & 0xc000) == 0x0000) { + K052109_051960_w(address & 0x3fff, data); + return; + } +} + +UINT8 gbusters_main_read(UINT16 address) +{ + switch (address) + { + case 0x1f90: + return DrvInputs[0]; + + case 0x1f91: + return DrvInputs[1]; + + case 0x1f92: + return DrvInputs[2]; + + case 0x1f93: + return DrvDips[2]; + + case 0x1f94: + return DrvDips[0]; + + case 0x1f95: + return DrvDips[1]; + } + + if ((address & 0xc000) == 0x0000) { + return K052109_051960_r(address & 0x3fff); + } + + return 0; +} + +static void gbusters_snd_bankswitch_w(INT32 data) +{ + INT32 bank_B = ((data >> 2) & 0x01); + INT32 bank_A = ((data) & 0x01); + k007232_set_bank(0, bank_A, bank_B ); +} + +void __fastcall gbusters_sound_write(UINT16 address, UINT8 data) +{ + if ((address & 0xfff0) == 0xb000) { + K007232WriteReg(0, address & 0x0f, data); + return; + } + + switch (address) + { + case 0xc000: + BurnYM2151SelectRegister(data); + return; + + case 0xc001: + BurnYM2151WriteRegister(data); + return; + + case 0xf000: + gbusters_snd_bankswitch_w(data); + return; + } +} + +UINT8 __fastcall gbusters_sound_read(UINT16 address) +{ + if ((address & 0xfff0) == 0xb000) { + return K007232ReadReg(0, address & 0x0f); + } + + switch (address) + { + case 0xa000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0xc001: + return BurnYM2151ReadStatus(); + } + + return 0; +} + +static void gbusters_set_lines(INT32 lines) +{ + INT32 nBank = 0x10000 + (lines & 0x0f) * 0x2000; + + nDrvKonamiBank[1] = lines; + + konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); +} + +static void DrvK007232VolCallback(INT32 v) +{ + K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); + K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); +} + +static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + INT32 layer_colorbase[3] = { 0x30, 0x00, 0x10 }; + + *code |= ((*color & 0x0d) << 8) | ((*color & 0x10) << 5) | (bank << 12); + *code &= 0x3fff; + *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); +} + +static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) +{ + *priority = (*color & 0x30) >> 4; + *color = 0x20 + (*color & 0x0f); + *code &= 0x0fff; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x030000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x080000; + DrvGfxROM1 = Next; Next += 0x080000; + DrvGfxROMExp0 = Next; Next += 0x100000; + DrvGfxROMExp1 = Next; Next += 0x100000; + + DrvSndROM = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); + + AllRam = Next; + + DrvBankRAM = Next; Next += 0x000800; + DrvKonRAM = Next; Next += 0x001800; + DrvPalRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + nDrvRamBank = Next; Next += 0x000001; + nDrvKonamiBank = Next; Next += 0x000002; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x80000); + konami_rom_deinterleave_2(DrvGfxROM1, 0x80000); + + GfxDecode(0x04000, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x01000, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvKonROM + 0x000000, 0, 1)) return 1; + if (BurnLoadRom(DrvKonROM + 0x020000, 1, 1)) return 1; + memcpy (DrvKonROM + 0x10000, DrvKonROM + 0x00000, 0x08000); + memcpy (DrvKonROM + 0x18000, DrvKonROM + 0x00000, 0x08000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 6, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 7, 1)) return 1; + + DrvGfxDecode(); + } + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvKonRAM, 0x4000, 0x57ff, KON_RAM); + konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(gbusters_main_write); + konamiSetReadHandler(gbusters_main_read); + konamiSetlinesCallback(gbusters_set_lines); + konamiClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(gbusters_sound_write); + ZetSetReadHandler(gbusters_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); + + K007232Init(0, 3579545, DrvSndROM, 0x40000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback); + K007232PCMSetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); + + K052109Init(DrvGfxROM0, 0x7ffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(8, 0); + + K051960Init(DrvGfxROM1, 0x7ffff); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(8, 0); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + konamiExit(); + ZetExit(); + + K007232Exit(); + BurnYM2151Exit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800); + } + + K052109UpdateScroll(); + + if (nDrvRamBank[0] & 0x08) + { + + if (nBurnLayer & 1) K052109RenderLayer(2, 1, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 2); + if (nBurnLayer & 2) K052109RenderLayer(1, 0, DrvGfxROMExp0); + } + else + { + if (nBurnLayer & 4) K052109RenderLayer(1, 1, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 2); + if (nBurnLayer & 8) K052109RenderLayer(2, 0, DrvGfxROMExp0); + } + + K051960SpritesRender(DrvGfxROMExp1, 1); + K052109RenderLayer(0, 0, DrvGfxROMExp0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; + if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; + } + + konamiNewFrame(); + ZetNewFrame(); + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = nBurnSoundLen; + INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetOpen(0); + konamiOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + + nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); + + nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); + + nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K052109_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + } + } + + konamiClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029704; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + K007232Scan(nAction, pnMin); + + KonamiICScan(nAction); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + set_ram_bank(nDrvRamBank[0]); + gbusters_set_lines(nDrvKonamiBank[1]); + konamiClose(); + } + + return 0; +} + + +// Gang Busters (set 1) + +static struct BurnRomInfo gbustersRomDesc[] = { + { "878n02.k13", 0x10000, 0x51697aaa, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "878j03.k15", 0x10000, 0x3943a065, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "878h01.f8", 0x08000, 0x96feafaa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "878c07.h27", 0x40000, 0xeeed912c, 3 | BRF_GRA }, // 3 Background Tiles + { "878c08.k27", 0x40000, 0x4d14626d, 3 | BRF_GRA }, // 4 + + { "878c05.h5", 0x40000, 0x01f4aea5, 4 | BRF_GRA }, // 5 Sprites + { "878c06.k5", 0x40000, 0xedfaaaaf, 4 | BRF_GRA }, // 6 + + { "878c04.d5", 0x40000, 0x9e982d1c, 5 | BRF_SND }, // 7 K007232 Samples + + { "878a09.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 8 Proms +}; + +STD_ROM_PICK(gbusters) +STD_ROM_FN(gbusters) + +struct BurnDriver BurnDrvGbusters = { + "gbusters", NULL, NULL, NULL, "1988", + "Gang Busters (set 1)\0", NULL, "Konami", "GX878", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, gbustersRomInfo, gbustersRomName, NULL, NULL, GbustersInputInfo, GbustersDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 224, 288, 3, 4 +}; + + +// Gang Busters (set 2) + +static struct BurnRomInfo gbusteraRomDesc[] = { + { "878_02.k13", 0x10000, 0x57178414, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "878_03.k15", 0x10000, 0x6c59e660, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "878h01.f8", 0x08000, 0x96feafaa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "878c07.h27", 0x40000, 0xeeed912c, 3 | BRF_GRA }, // 3 Background Tiles + { "878c08.k27", 0x40000, 0x4d14626d, 3 | BRF_GRA }, // 4 + + { "878c05.h5", 0x40000, 0x01f4aea5, 4 | BRF_GRA }, // 5 Sprites + { "878c06.k5", 0x40000, 0xedfaaaaf, 4 | BRF_GRA }, // 6 + + { "878c04.d5", 0x40000, 0x9e982d1c, 5 | BRF_SND }, // 7 K007232 Samples + + { "878a09.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 8 Proms +}; + +STD_ROM_PICK(gbustera) +STD_ROM_FN(gbustera) + +struct BurnDriver BurnDrvGbustera = { + "gbustersa", "gbusters", NULL, NULL, "1988", + "Gang Busters (set 2)\0", NULL, "Konami", "GX878", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, gbusteraRomInfo, gbusteraRomName, NULL, NULL, GbustersInputInfo, GbustersDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 224, 288, 3, 4 +}; + + +// Crazy Cop (Japan) + +static struct BurnRomInfo crazycopRomDesc[] = { + { "878m02.k13", 0x10000, 0x9c1c9f52, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "878j03.k15", 0x10000, 0x3943a065, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "878h01.f8", 0x08000, 0x96feafaa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "878c07.h27", 0x40000, 0xeeed912c, 3 | BRF_GRA }, // 3 Background Tiles + { "878c08.k27", 0x40000, 0x4d14626d, 3 | BRF_GRA }, // 4 + + { "878c05.h5", 0x40000, 0x01f4aea5, 4 | BRF_GRA }, // 5 Sprites + { "878c06.k5", 0x40000, 0xedfaaaaf, 4 | BRF_GRA }, // 6 + + { "878c04.d5", 0x40000, 0x9e982d1c, 5 | BRF_SND }, // 7 K007232 Samples + + { "878a09.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 8 Proms +}; + +STD_ROM_PICK(crazycop) +STD_ROM_FN(crazycop) + +struct BurnDriver BurnDrvCrazycop = { + "crazycop", "gbusters", NULL, NULL, "1988", + "Crazy Cop (Japan)\0", NULL, "Konami", "GX878", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, crazycopRomInfo, crazycopRomName, NULL, NULL, GbustersInputInfo, GbustersDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 224, 288, 3, 4 +}; diff --git a/src/burn/drv/konami/d_gradius3.cpp b/src/burn/drv/konami/d_gradius3.cpp index fc95b9b4d..f2ff8e37a 100644 --- a/src/burn/drv/konami/d_gradius3.cpp +++ b/src/burn/drv/konami/d_gradius3.cpp @@ -1,975 +1,974 @@ -// FB Alpha Gradius 3 driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" -#include "k007232.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM0; -static UINT8 *Drv68KROM1; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM0; -static UINT8 *Drv68KRAM1; -static UINT8 *DrvShareRAM; -static UINT8 *DrvShareRAM2; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; - -static INT32 gradius3_priority; -static INT32 gradius3_cpub_enable; -static INT32 irqA_enable; -static INT32 irqB_mask; - -static INT32 interrupt_triggered = 0; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT16 DrvInputs[3]; -static UINT8 DrvDips[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo Gradius3InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Gradius3) - -static struct BurnDIPInfo Gradius3DIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x5a, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x14, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15, "Coin B" }, - {0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x14, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x14, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x14, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x03, "2" }, - {0x15, 0x01, 0x03, 0x02, "3" }, - {0x15, 0x01, 0x03, 0x01, "5" }, - {0x15, 0x01, 0x03, 0x00, "7" }, - -// {0 , 0xfe, 0 , 2, "Cabinet" }, -// {0x15, 0x01, 0x04, 0x00, "Upright" }, -// {0x15, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x15, 0x01, 0x18, 0x18, "20000 and every 70000" }, - {0x15, 0x01, 0x18, 0x10, "100000 and every 100000" }, - {0x15, 0x01, 0x18, 0x08, "50000" }, - {0x15, 0x01, 0x18, 0x00, "100000" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Normal" }, - {0x15, 0x01, 0x60, 0x20, "Hard" }, - {0x15, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x16, 0x01, 0x01, 0x01, "Off" }, -// {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Upright Controls" }, - {0x16, 0x01, 0x02, 0x02, "Single" }, - {0x16, 0x01, 0x02, 0x00, "Dual" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Gradius3) - -void __fastcall gradius3_main_write_word(UINT32 address, UINT16 data) -{ - if (address >= 0x14c000 && address <= 0x153fff) { - address -= 0x14c000; - K052109Write(address / 2, data); - return; - } -} - -void __fastcall gradius3_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x0c0000: - case 0x0c0001: - { - // if enabling CPU B, burn off some cycles to keep things sync'd. - if (gradius3_cpub_enable & 8 && ~data & 8) { - INT32 cycles_to_burn = SekTotalCycles(); - SekClose(); - SekOpen(1); - SekIdle(cycles_to_burn - SekTotalCycles()); - SekClose(); - SekOpen(0); - } - - gradius3_priority = data & 0x04; - gradius3_cpub_enable = data & 0x08; - irqA_enable = data & 0x20; - } - return; - - case 0x0d8000: - case 0x0d8001: - interrupt_triggered = irqB_mask & 0x04; - return; - - case 0x0e0000: - case 0x0e0001: - // watchdog - return; - - case 0x0e8000: - *soundlatch = data; - return; - - case 0x0f0000: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - - return; - } - - if (address >= 0x14c000 && address <= 0x153fff) { - address -= 0x14c000; - K052109Write(address / 2, data); - return; - } -} - -UINT16 __fastcall gradius3_main_read_word(UINT32 address) -{ - if (address >= 0x14c000 && address <= 0x153fff) { - address -= 0x14c000; - return K052109Read(address / 2); - } - - return 0; -} - -UINT8 __fastcall gradius3_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x0c8000: - case 0x0c8001: - return DrvInputs[0]; - - case 0x0c8002: - case 0x0c8003: - return DrvInputs[1]; - - case 0x0c8004: - case 0x0c8005: - return DrvInputs[2]; - - case 0x0c8006: - case 0x0c8007: - return DrvDips[2]; - - case 0x0d0000: - case 0x0d0001: - return DrvDips[0]; - - case 0x0d0002: - case 0x0d0003: - return DrvDips[1]; - } - - if (address >= 0x14c000 && address <= 0x153fff) { - address -= 0x14c000; - return K052109Read(address / 2); - } - - return 0; -} - -void __fastcall gradius3_sub_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfffffe) == 0x140000) { - irqB_mask = (data >> 8) & 0x07; - return; - } - - if (address >= 0x24c000 && address <= 0x253fff) { - address -= 0x24c000; - K052109Write(address / 2, data); - return; - } - - if ((address & 0xffffff0) == 0x2c0000) { - address -= 0x2c0000; - K051937Write(address / 2, data); - return; - } - - if ((address & 0xffff800) == 0x2c0800) { - address -= 0x2c0800; - K051960Write(address /2, data); - return; - } -} - -void __fastcall gradius3_sub_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfffffe) == 0x140000) { - irqB_mask = data & 0x07; - return; - } - - if (address >= 0x24c000 && address <= 0x253fff) { - address -= 0x24c000; - K052109Write(address / 2, data); - return; - } - - if ((address & 0xffffff0) == 0x2c0000) { - address -= 0x2c0000; - K051937Write(address / 2, data); - return; - } - - if ((address & 0xffff800) == 0x2c0800) { - address -= 0x2c0800; - K051960Write(address /2, data); - return; - } -} - -UINT16 __fastcall gradius3_sub_read_word(UINT32 address) -{ - if (address >= 0x24c000 && address <= 0x253fff) { - address -= 0x24c000; - return K052109Read(address / 2); - } - - if ((address & 0xffffff0) == 0x2c0000) { - address -= 0x2c0000; - return K051937Read(address / 2); - } - - if ((address & 0xffff800) == 0x2c0800) { - address -= 0x2c0800; - return K051960Read(address / 2); - } - - return 0; -} - -UINT8 __fastcall gradius3_sub_read_byte(UINT32 address) -{ - if (address >= 0x24c000 && address <= 0x253fff) { - address -= 0x24c000; - return K052109Read(address / 2); - } - - if ((address & 0xffffff0) == 0x2c0000) { - address -= 0x2c0000; - return K051937Read(address / 2); - } - - if ((address & 0xffff800) == 0x2c0800) { - address -= 0x2c0800; - return K051960Read(address / 2); - } - - return 0; -} - -static void k007232_bank(INT32 , INT32 data) -{ - INT32 bank_A = (data >> 0) & 0x03; - INT32 bank_B = (data >> 2) & 0x03; - - k007232_set_bank(0, bank_A, bank_B); -} - -void __fastcall gradius3_sound_write(UINT16 address, UINT8 data) -{ - if ((address & 0xfff0) == 0xf020) { - K007232WriteReg(0, address & 0x0f, data); - return; - } - - switch (address) - { - case 0xf000: - k007232_bank(0, data); - return; - - case 0xf030: - BurnYM2151SelectRegister(data); - return; - - case 0xf031: - BurnYM2151WriteRegister(data); - return; - } -} - -UINT8 __fastcall gradius3_sound_read(UINT16 address) -{ - if ((address & 0xfff0) == 0xf020) { - return K007232ReadReg(0, address & 0x0f); - } - - switch (address) - { - case 0xf010: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0xf031: - return BurnYM2151ReadStatus(); - } - - return 0; -} - -static void DrvK007232VolCallback(INT32 v) -{ - K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); - K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); -} - -static void K052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - INT32 layer_colorbase[3] = { 0, 32, 48 }; - - *code |= ((*color & 0x01) << 8) | ((*color & 0x1c) << 7); - *code &= 0xfff; - *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); -} - -static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) -{ - *priority = (*color & 0x60) >> 5; - - *code |= (*color & 0x01) << 13; - *code &= 0x3fff; - *color = 0x10 + ((*color & 0x1e) >> 1); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - SekOpen(1); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - gradius3_priority = 0; - gradius3_cpub_enable = 0; - irqA_enable = 0; - irqB_mask = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM0 = Next; Next += 0x100000; - Drv68KROM1 = Next; Next += 0x100000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM1 = Next; Next += 0x200000; - DrvGfxROMExp0 = Next; Next += 0x040000; - DrvGfxROMExp1 = Next; Next += 0x400000; - - DrvSndROM = Next; Next += 0x080000; - - DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - Drv68KRAM0 = Next; Next += 0x004000; - Drv68KRAM1 = Next; Next += 0x004000; - DrvShareRAM = Next; Next += 0x004000; - DrvShareRAM2 = Next; Next += 0x020000; - DrvPalRAM = Next; Next += 0x001000; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x000, 0x01, 0x002, 0x003 }; - INT32 XOffs[16] = { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4, - 32*8+2*4, 32*8+3*4, 32*8+0*4, 32*8+1*4, 32*8+6*4, 32*8+7*4, 32*8+4*4, 32*8+5*4 }; - INT32 YOffs[16] = { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, - 64*8+0*32, 64*8+1*32, 64*8+2*32, 64*8+3*32, 64*8+4*32, 64*8+5*32, 64*8+6*32, 64*8+7*32 }; - - konami_rom_deinterleave_2(DrvGfxROM1, 0x200000); - - GfxDecode(0x04000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM0 + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(Drv68KROM1 + 0x000001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM1 + 0x000000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM1 + 0x040001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM1 + 0x040000, 5, 2)) return 1; - if (BurnLoadRom(Drv68KROM1 + 0x080001, 6, 2)) return 1; - if (BurnLoadRom(Drv68KROM1 + 0x080000, 7, 2)) return 1; - if (BurnLoadRom(Drv68KROM1 + 0x0c0001, 8, 2)) return 1; - if (BurnLoadRom(Drv68KROM1 + 0x0c0000, 9, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 10, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080001, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 15, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 16, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 17, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180001, 18, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x1c0000, 19, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x1c0001, 20, 2)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 21, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x040000, 22, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x060000, 23, 1)) return 1; - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM0, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRAM0, 0x040000, 0x043fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x080000, 0x080fff, SM_RAM); - SekMapMemory(DrvShareRAM, 0x100000, 0x103fff, SM_RAM); - SekMapMemory(DrvShareRAM2, 0x180000, 0x19ffff, SM_RAM); - SekSetWriteWordHandler(0, gradius3_main_write_word); - SekSetWriteByteHandler(0, gradius3_main_write_byte); - SekSetReadWordHandler(0, gradius3_main_read_word); - SekSetReadByteHandler(0, gradius3_main_read_byte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Drv68KROM1, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRAM1, 0x100000, 0x103fff, SM_RAM); - SekMapMemory(DrvShareRAM, 0x200000, 0x203fff, SM_RAM); - SekMapMemory(DrvShareRAM2, 0x280000, 0x29ffff, SM_RAM); - SekMapMemory(DrvGfxROM1, 0x400000, 0x5fffff, SM_ROM); - SekSetWriteWordHandler(0, gradius3_sub_write_word); - SekSetWriteByteHandler(0, gradius3_sub_write_byte); - SekSetReadWordHandler(0, gradius3_sub_read_word); - SekSetReadByteHandler(0, gradius3_sub_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); - ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM); - ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM); - ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); - ZetSetWriteHandler(gradius3_sound_write); - ZetSetReadHandler(gradius3_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - K007232Init(0, 3579545, DrvSndROM, 0x80000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback); - K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - K052109Init(DrvShareRAM2, 0x1ffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(-8, 0); - - K051960Init(DrvGfxROM1, 0x1fffff); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(-8, 0); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - SekExit(); - ZetExit(); - - K007232Exit(); - BurnYM2151Exit(); - - BurnFree (AllMem); - - return 0; -} - -static inline void character_ram_decode() -{ - for (INT32 i = 0; i < 0x20000; i++) - { - INT32 t = DrvShareRAM2[i ^ 1]; - - DrvGfxROMExp0[i * 2 + 0] = t >> 4; - DrvGfxROMExp0[i * 2 + 1] = t & 0x0f; - } -} - -static inline void DrvRecalcPalette() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x1000 / 2; i++) { - r = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 10) & 0x1f; - g = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 5) & 0x1f; - b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvRecalcPalette(); - } - - K052109Write(0x1d80,0x10); - K052109Write(0x1f00,0x32); - - K052109UpdateScroll(); - - character_ram_decode(); - - if (gradius3_priority == 0) - { - if (nSpriteEnable & 1) K052109RenderLayer(1, 1, DrvGfxROMExp0); - - if (nBurnLayer & 4) K051960SpritesRender(DrvGfxROMExp1, 3); - - if (nBurnLayer & 2) K051960SpritesRender(DrvGfxROMExp1, 1); - - if (nBurnLayer & 8) K051960SpritesRender(DrvGfxROMExp1, 0); - - if (nSpriteEnable & 2) K052109RenderLayer(2, 0, DrvGfxROMExp0); - - if (nSpriteEnable & 4) K052109RenderLayer(0, 0, DrvGfxROMExp0); - - if (nBurnLayer & 1) K051960SpritesRender(DrvGfxROMExp1, 2); - } - else - { - - if (nSpriteEnable & 1) K052109RenderLayer(0, 1, DrvGfxROMExp0); - if (nSpriteEnable & 2) K052109RenderLayer(1, 0, DrvGfxROMExp0); - if (nSpriteEnable & 4) K052109RenderLayer(2, 0, DrvGfxROMExp0); -#if 1 - if (nBurnLayer & 1) K051960SpritesRender(DrvGfxROMExp1, 2); - if (nBurnLayer & 2) K051960SpritesRender(DrvGfxROMExp1, 1); - if (nBurnLayer & 4) K051960SpritesRender(DrvGfxROMExp1, 3); - if (nBurnLayer & 8) K051960SpritesRender(DrvGfxROMExp1, 0); -#endif - } - - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3 * sizeof(INT16)); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; - if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; - } - - SekNewFrame(); - - INT32 nCycleSegment; - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 100; - INT32 nCyclesTotal[3] = { 10000000 / 60, 10000000 / 60, 3579545 / 60 }; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - SekOpen(0); - nCycleSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - nCyclesDone[0] += SekRun(nCycleSegment - nCyclesDone[0]); - if (i == nInterleave - 1 && irqA_enable) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - SekClose(); - - if (gradius3_cpub_enable) { - SekOpen(1); - nCycleSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); - nCyclesDone[1] += SekRun(nCycleSegment - SekTotalCycles()); - if (interrupt_triggered) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - if (i == (nInterleave - 1) && (irqB_mask & 1)) - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - if (i == ((nInterleave / 2) - 1) && (irqB_mask & 2)) - SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - SekClose(); - } - - nCycleSegment = (nCyclesTotal[2] / nInterleave) * (i + 1); - nCyclesDone[2] += ZetRun(nCycleSegment - nCyclesDone[2]); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - - interrupt_triggered = 0; - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029704; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - K007232Scan(nAction, pnMin); - - KonamiICScan(nAction); - - SCAN_VAR(gradius3_priority); - SCAN_VAR(gradius3_cpub_enable); - SCAN_VAR(irqA_enable); - SCAN_VAR(irqB_mask); - } - - if (nAction & ACB_WRITE) { - character_ram_decode(); - } - - return 0; -} - - -// Gradius III (Japan) - -static struct BurnRomInfo gradius3RomDesc[] = { - { "945_s13.f15", 0x20000, 0x70c240a2, 1 | BRF_PRG | BRF_ESS }, // 0 68k #0 Code - { "945_s12.e15", 0x20000, 0xbbc300d4, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "945_m09.r17", 0x20000, 0xb4a6df25, 2 | BRF_PRG | BRF_ESS }, // 2 68k #1 Code - { "945_m08.n17", 0x20000, 0x74e981d2, 2 | BRF_PRG | BRF_ESS }, // 3 - { "945_l06b.r11", 0x20000, 0x83772304, 2 | BRF_PRG | BRF_ESS }, // 4 - { "945_l06a.n11", 0x20000, 0xe1fd75b6, 2 | BRF_PRG | BRF_ESS }, // 5 - { "945_l07c.r15", 0x20000, 0xc1e399b6, 2 | BRF_PRG | BRF_ESS }, // 6 - { "945_l07a.n15", 0x20000, 0x96222d04, 2 | BRF_PRG | BRF_ESS }, // 7 - { "945_l07d.r13", 0x20000, 0x4c16d4bd, 2 | BRF_PRG | BRF_ESS }, // 8 - { "945_l07b.n13", 0x20000, 0x5e209d01, 2 | BRF_PRG | BRF_ESS }, // 9 - - { "945_m05.d9", 0x10000, 0xc8c45365, 3 | BRF_PRG | BRF_ESS }, // 10 Z80 Code - - { "945_a02.l3", 0x80000, 0x4dfffd74, 4 | BRF_GRA }, // 11 Sprites - { "945_l04a.k6", 0x20000, 0x884e21ee, 4 | BRF_GRA }, // 12 - { "945_l04c.m6", 0x20000, 0x45bcd921, 4 | BRF_GRA }, // 13 - { "945_l04b.k8", 0x20000, 0x843bc67d, 4 | BRF_GRA }, // 14 - { "945_l04d.m8", 0x20000, 0x0a98d08e, 4 | BRF_GRA }, // 15 - { "945_a01.h3", 0x80000, 0x339d6dd2, 4 | BRF_GRA }, // 16 - { "945_l03a.e6", 0x20000, 0xa67ef087, 4 | BRF_GRA }, // 17 - { "945_l03c.h6", 0x20000, 0xa56be17a, 4 | BRF_GRA }, // 18 - { "945_l03b.e8", 0x20000, 0x933e68b9, 4 | BRF_GRA }, // 19 - { "945_l03d.h8", 0x20000, 0xf375e87b, 4 | BRF_GRA }, // 20 - - { "945_a10.b15", 0x40000, 0x1d083e10, 5 | BRF_SND }, // 21 K007232 - { "945_l11a.c18", 0x20000, 0x6043f4eb, 5 | BRF_SND }, // 22 - { "945_l11b.c20", 0x20000, 0x89ea3baf, 5 | BRF_SND }, // 23 - - { "945l14.j28", 0x00100, 0xc778c189, 6 | BRF_OPT }, // 24 Prom -}; - -STD_ROM_PICK(gradius3) -STD_ROM_FN(gradius3) - -struct BurnDriver BurnDrvGradius3 = { - "gradius3", NULL, NULL, NULL, "1989", - "Gradius III (Japan)\0", NULL, "Konami", "GX945", - L"Gradius III \u4F1D\u8AAC\u304B\u3089\u795E\u8A71\u3078 (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, gradius3RomInfo, gradius3RomName, NULL, NULL, Gradius3InputInfo, Gradius3DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 224, 4, 3 -}; - - -// Gradius III (Asia) - -static struct BurnRomInfo grdius3aRomDesc[] = { - { "945_13.f15", 0x20000, 0x9974fe6b, 1 | BRF_PRG | BRF_ESS }, // 0 68k #0 Code - { "945_12.e15", 0x20000, 0xe9771b91, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "945_m09.r17", 0x20000, 0xb4a6df25, 2 | BRF_PRG | BRF_ESS }, // 2 68k #1 Code - { "945_m08.n17", 0x20000, 0x74e981d2, 2 | BRF_PRG | BRF_ESS }, // 3 - { "945_l06b.r11", 0x20000, 0x83772304, 2 | BRF_PRG | BRF_ESS }, // 4 - { "945_l06a.n11", 0x20000, 0xe1fd75b6, 2 | BRF_PRG | BRF_ESS }, // 5 - { "945_l07c.r15", 0x20000, 0xc1e399b6, 2 | BRF_PRG | BRF_ESS }, // 6 - { "945_l07a.n15", 0x20000, 0x96222d04, 2 | BRF_PRG | BRF_ESS }, // 7 - { "945_l07d.r13", 0x20000, 0x4c16d4bd, 2 | BRF_PRG | BRF_ESS }, // 8 - { "945_l07b.n13", 0x20000, 0x5e209d01, 2 | BRF_PRG | BRF_ESS }, // 9 - - { "945_m05.d9", 0x10000, 0xc8c45365, 3 | BRF_PRG | BRF_ESS }, // 10 Z80 Code - - { "945_a02.l3", 0x80000, 0x4dfffd74, 4 | BRF_GRA }, // 11 Sprites - { "945_l04a.k6", 0x20000, 0x884e21ee, 4 | BRF_GRA }, // 12 - { "945_l04c.m6", 0x20000, 0x45bcd921, 4 | BRF_GRA }, // 13 - { "945_l04b.k8", 0x20000, 0x843bc67d, 4 | BRF_GRA }, // 14 - { "945_l04d.m8", 0x20000, 0x0a98d08e, 4 | BRF_GRA }, // 15 - { "945_a01.h3", 0x80000, 0x339d6dd2, 4 | BRF_GRA }, // 16 - { "945_l03a.e6", 0x20000, 0xa67ef087, 4 | BRF_GRA }, // 17 - { "945_l03c.h6", 0x20000, 0xa56be17a, 4 | BRF_GRA }, // 18 - { "945_l03b.e8", 0x20000, 0x933e68b9, 4 | BRF_GRA }, // 19 - { "945_l03d.h8", 0x20000, 0xf375e87b, 4 | BRF_GRA }, // 20 - - { "945_a10.b15", 0x40000, 0x1d083e10, 5 | BRF_SND }, // 21 K007232 - { "945_l11a.c18", 0x20000, 0x6043f4eb, 5 | BRF_SND }, // 22 - { "945_l11b.c20", 0x20000, 0x89ea3baf, 5 | BRF_SND }, // 23 - - { "945l14.j28", 0x00100, 0xc778c189, 6 | BRF_OPT }, // 24 Prom -}; - -STD_ROM_PICK(grdius3a) -STD_ROM_FN(grdius3a) - -struct BurnDriver BurnDrvGrdius3a = { - "gradius3a", "gradius3", NULL, NULL, "1989", - "Gradius III (Asia)\0", NULL, "Konami", "GX945", - L"Gradius III \u4F1D\u8AAC\u304B\u3089\u795E\u8A71\u3078 (Asia)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, grdius3aRomInfo, grdius3aRomName, NULL, NULL, Gradius3InputInfo, Gradius3DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 224, 4, 3 -}; - - -// Gradius III (World ?) - -static struct BurnRomInfo grdius3eRomDesc[] = { - { "945_r13.f15", 0x20000, 0xcffd103f, 1 | BRF_PRG | BRF_ESS }, // 0 68k #0 Code - { "945_r12.e15", 0x20000, 0x0b968ef6, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "945_m09.r17", 0x20000, 0xb4a6df25, 2 | BRF_PRG | BRF_ESS }, // 2 68k #1 Code - { "945_m08.n17", 0x20000, 0x74e981d2, 2 | BRF_PRG | BRF_ESS }, // 3 - { "945_l06b.r11", 0x20000, 0x83772304, 2 | BRF_PRG | BRF_ESS }, // 4 - { "945_l06a.n11", 0x20000, 0xe1fd75b6, 2 | BRF_PRG | BRF_ESS }, // 5 - { "945_l07c.r15", 0x20000, 0xc1e399b6, 2 | BRF_PRG | BRF_ESS }, // 6 - { "945_l07a.n15", 0x20000, 0x96222d04, 2 | BRF_PRG | BRF_ESS }, // 7 - { "945_l07d.r13", 0x20000, 0x4c16d4bd, 2 | BRF_PRG | BRF_ESS }, // 8 - { "945_l07b.n13", 0x20000, 0x5e209d01, 2 | BRF_PRG | BRF_ESS }, // 9 - - { "945_m05.d9", 0x10000, 0xc8c45365, 3 | BRF_PRG | BRF_ESS }, // 10 Z80 Code - - { "945_a02.l3", 0x80000, 0x4dfffd74, 4 | BRF_GRA }, // 11 Sprites - { "945_l04a.k6", 0x20000, 0x884e21ee, 4 | BRF_GRA }, // 12 - { "945_l04c.m6", 0x20000, 0x45bcd921, 4 | BRF_GRA }, // 13 - { "945_l04b.k8", 0x20000, 0x843bc67d, 4 | BRF_GRA }, // 14 - { "945_l04d.m8", 0x20000, 0x0a98d08e, 4 | BRF_GRA }, // 15 - { "945_a01.h3", 0x80000, 0x339d6dd2, 4 | BRF_GRA }, // 16 - { "945_l03a.e6", 0x20000, 0xa67ef087, 4 | BRF_GRA }, // 17 - { "945_l03c.h6", 0x20000, 0xa56be17a, 4 | BRF_GRA }, // 18 - { "945_l03b.e8", 0x20000, 0x933e68b9, 4 | BRF_GRA }, // 19 - { "945_l03d.h8", 0x20000, 0xf375e87b, 4 | BRF_GRA }, // 20 - - { "945_a10.b15", 0x40000, 0x1d083e10, 5 | BRF_SND }, // 21 K007232 - { "945_l11a.c18", 0x20000, 0x6043f4eb, 5 | BRF_SND }, // 22 - { "945_l11b.c20", 0x20000, 0x89ea3baf, 5 | BRF_SND }, // 23 - - { "945l14.j28", 0x00100, 0xc778c189, 6 | BRF_OPT }, // 24 Prom -}; - -STD_ROM_PICK(grdius3e) -STD_ROM_FN(grdius3e) - -struct BurnDriver BurnDrvGrdius3e = { - "gradius3e", "gradius3", NULL, NULL, "1989", - "Gradius III (World)\0", NULL, "Konami", "GX945", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, grdius3eRomInfo, grdius3eRomName, NULL, NULL, Gradius3InputInfo, Gradius3DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 224, 4, 3 -}; +// FB Alpha Gradius 3 driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" +#include "k007232.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM0; +static UINT8 *Drv68KROM1; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM0; +static UINT8 *Drv68KRAM1; +static UINT8 *DrvShareRAM; +static UINT8 *DrvShareRAM2; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; + +static INT32 gradius3_priority; +static INT32 gradius3_cpub_enable; +static INT32 irqA_enable; +static INT32 irqB_mask; + +static INT32 interrupt_triggered = 0; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT16 DrvInputs[3]; +static UINT8 DrvDips[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo Gradius3InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Gradius3) + +static struct BurnDIPInfo Gradius3DIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x5a, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x14, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15, "Coin B" }, + {0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x14, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x14, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x14, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x03, "2" }, + {0x15, 0x01, 0x03, 0x02, "3" }, + {0x15, 0x01, 0x03, 0x01, "5" }, + {0x15, 0x01, 0x03, 0x00, "7" }, + +// {0 , 0xfe, 0 , 2, "Cabinet" }, +// {0x15, 0x01, 0x04, 0x00, "Upright" }, +// {0x15, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x15, 0x01, 0x18, 0x18, "20000 and every 70000" }, + {0x15, 0x01, 0x18, 0x10, "100000 and every 100000" }, + {0x15, 0x01, 0x18, 0x08, "50000" }, + {0x15, 0x01, 0x18, 0x00, "100000" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Normal" }, + {0x15, 0x01, 0x60, 0x20, "Hard" }, + {0x15, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x16, 0x01, 0x01, 0x01, "Off" }, +// {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Upright Controls" }, + {0x16, 0x01, 0x02, 0x02, "Single" }, + {0x16, 0x01, 0x02, 0x00, "Dual" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Gradius3) + +void __fastcall gradius3_main_write_word(UINT32 address, UINT16 data) +{ + if (address >= 0x14c000 && address <= 0x153fff) { + address -= 0x14c000; + K052109Write(address / 2, data); + return; + } +} + +void __fastcall gradius3_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x0c0000: + case 0x0c0001: + { + // if enabling CPU B, burn off some cycles to keep things sync'd. + if (gradius3_cpub_enable & 8 && ~data & 8) { + INT32 cycles_to_burn = SekTotalCycles(); + SekClose(); + SekOpen(1); + SekIdle(cycles_to_burn - SekTotalCycles()); + SekClose(); + SekOpen(0); + } + + gradius3_priority = data & 0x04; + gradius3_cpub_enable = data & 0x08; + irqA_enable = data & 0x20; + } + return; + + case 0x0d8000: + case 0x0d8001: + interrupt_triggered = irqB_mask & 0x04; + return; + + case 0x0e0000: + case 0x0e0001: + // watchdog + return; + + case 0x0e8000: + *soundlatch = data; + return; + + case 0x0f0000: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + + return; + } + + if (address >= 0x14c000 && address <= 0x153fff) { + address -= 0x14c000; + K052109Write(address / 2, data); + return; + } +} + +UINT16 __fastcall gradius3_main_read_word(UINT32 address) +{ + if (address >= 0x14c000 && address <= 0x153fff) { + address -= 0x14c000; + return K052109Read(address / 2); + } + + return 0; +} + +UINT8 __fastcall gradius3_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x0c8000: + case 0x0c8001: + return DrvInputs[0]; + + case 0x0c8002: + case 0x0c8003: + return DrvInputs[1]; + + case 0x0c8004: + case 0x0c8005: + return DrvInputs[2]; + + case 0x0c8006: + case 0x0c8007: + return DrvDips[2]; + + case 0x0d0000: + case 0x0d0001: + return DrvDips[0]; + + case 0x0d0002: + case 0x0d0003: + return DrvDips[1]; + } + + if (address >= 0x14c000 && address <= 0x153fff) { + address -= 0x14c000; + return K052109Read(address / 2); + } + + return 0; +} + +void __fastcall gradius3_sub_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfffffe) == 0x140000) { + irqB_mask = (data >> 8) & 0x07; + return; + } + + if (address >= 0x24c000 && address <= 0x253fff) { + address -= 0x24c000; + K052109Write(address / 2, data); + return; + } + + if ((address & 0xffffff0) == 0x2c0000) { + address -= 0x2c0000; + K051937Write(address / 2, data); + return; + } + + if ((address & 0xffff800) == 0x2c0800) { + address -= 0x2c0800; + K051960Write(address /2, data); + return; + } +} + +void __fastcall gradius3_sub_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfffffe) == 0x140000) { + irqB_mask = data & 0x07; + return; + } + + if (address >= 0x24c000 && address <= 0x253fff) { + address -= 0x24c000; + K052109Write(address / 2, data); + return; + } + + if ((address & 0xffffff0) == 0x2c0000) { + address -= 0x2c0000; + K051937Write(address / 2, data); + return; + } + + if ((address & 0xffff800) == 0x2c0800) { + address -= 0x2c0800; + K051960Write(address /2, data); + return; + } +} + +UINT16 __fastcall gradius3_sub_read_word(UINT32 address) +{ + if (address >= 0x24c000 && address <= 0x253fff) { + address -= 0x24c000; + return K052109Read(address / 2); + } + + if ((address & 0xffffff0) == 0x2c0000) { + address -= 0x2c0000; + return K051937Read(address / 2); + } + + if ((address & 0xffff800) == 0x2c0800) { + address -= 0x2c0800; + return K051960Read(address / 2); + } + + return 0; +} + +UINT8 __fastcall gradius3_sub_read_byte(UINT32 address) +{ + if (address >= 0x24c000 && address <= 0x253fff) { + address -= 0x24c000; + return K052109Read(address / 2); + } + + if ((address & 0xffffff0) == 0x2c0000) { + address -= 0x2c0000; + return K051937Read(address / 2); + } + + if ((address & 0xffff800) == 0x2c0800) { + address -= 0x2c0800; + return K051960Read(address / 2); + } + + return 0; +} + +static void k007232_bank(INT32 , INT32 data) +{ + INT32 bank_A = (data >> 0) & 0x03; + INT32 bank_B = (data >> 2) & 0x03; + + k007232_set_bank(0, bank_A, bank_B); +} + +void __fastcall gradius3_sound_write(UINT16 address, UINT8 data) +{ + if ((address & 0xfff0) == 0xf020) { + K007232WriteReg(0, address & 0x0f, data); + return; + } + + switch (address) + { + case 0xf000: + k007232_bank(0, data); + return; + + case 0xf030: + BurnYM2151SelectRegister(data); + return; + + case 0xf031: + BurnYM2151WriteRegister(data); + return; + } +} + +UINT8 __fastcall gradius3_sound_read(UINT16 address) +{ + if ((address & 0xfff0) == 0xf020) { + return K007232ReadReg(0, address & 0x0f); + } + + switch (address) + { + case 0xf010: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0xf031: + return BurnYM2151ReadStatus(); + } + + return 0; +} + +static void DrvK007232VolCallback(INT32 v) +{ + K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); + K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); +} + +static void K052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + INT32 layer_colorbase[3] = { 0, 32, 48 }; + + *code |= ((*color & 0x01) << 8) | ((*color & 0x1c) << 7); + *code &= 0xfff; + *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); +} + +static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) +{ + *priority = (*color & 0x60) >> 5; + + *code |= (*color & 0x01) << 13; + *code &= 0x3fff; + *color = 0x10 + ((*color & 0x1e) >> 1); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + SekOpen(1); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + gradius3_priority = 0; + gradius3_cpub_enable = 0; + irqA_enable = 0; + irqB_mask = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM0 = Next; Next += 0x100000; + Drv68KROM1 = Next; Next += 0x100000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM1 = Next; Next += 0x200000; + DrvGfxROMExp0 = Next; Next += 0x040000; + DrvGfxROMExp1 = Next; Next += 0x400000; + + DrvSndROM = Next; Next += 0x080000; + + DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + Drv68KRAM0 = Next; Next += 0x004000; + Drv68KRAM1 = Next; Next += 0x004000; + DrvShareRAM = Next; Next += 0x004000; + DrvShareRAM2 = Next; Next += 0x020000; + DrvPalRAM = Next; Next += 0x001000; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x000, 0x01, 0x002, 0x003 }; + INT32 XOffs[16] = { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4, + 32*8+2*4, 32*8+3*4, 32*8+0*4, 32*8+1*4, 32*8+6*4, 32*8+7*4, 32*8+4*4, 32*8+5*4 }; + INT32 YOffs[16] = { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, + 64*8+0*32, 64*8+1*32, 64*8+2*32, 64*8+3*32, 64*8+4*32, 64*8+5*32, 64*8+6*32, 64*8+7*32 }; + + konami_rom_deinterleave_2(DrvGfxROM1, 0x200000); + + GfxDecode(0x04000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM0 + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(Drv68KROM1 + 0x000001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM1 + 0x000000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM1 + 0x040001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM1 + 0x040000, 5, 2)) return 1; + if (BurnLoadRom(Drv68KROM1 + 0x080001, 6, 2)) return 1; + if (BurnLoadRom(Drv68KROM1 + 0x080000, 7, 2)) return 1; + if (BurnLoadRom(Drv68KROM1 + 0x0c0001, 8, 2)) return 1; + if (BurnLoadRom(Drv68KROM1 + 0x0c0000, 9, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 10, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080001, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 15, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 16, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 17, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180001, 18, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x1c0000, 19, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x1c0001, 20, 2)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 21, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x040000, 22, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x060000, 23, 1)) return 1; + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM0, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRAM0, 0x040000, 0x043fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x080000, 0x080fff, SM_RAM); + SekMapMemory(DrvShareRAM, 0x100000, 0x103fff, SM_RAM); + SekMapMemory(DrvShareRAM2, 0x180000, 0x19ffff, SM_RAM); + SekSetWriteWordHandler(0, gradius3_main_write_word); + SekSetWriteByteHandler(0, gradius3_main_write_byte); + SekSetReadWordHandler(0, gradius3_main_read_word); + SekSetReadByteHandler(0, gradius3_main_read_byte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Drv68KROM1, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRAM1, 0x100000, 0x103fff, SM_RAM); + SekMapMemory(DrvShareRAM, 0x200000, 0x203fff, SM_RAM); + SekMapMemory(DrvShareRAM2, 0x280000, 0x29ffff, SM_RAM); + SekMapMemory(DrvGfxROM1, 0x400000, 0x5fffff, SM_ROM); + SekSetWriteWordHandler(0, gradius3_sub_write_word); + SekSetWriteByteHandler(0, gradius3_sub_write_byte); + SekSetReadWordHandler(0, gradius3_sub_read_word); + SekSetReadByteHandler(0, gradius3_sub_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); + ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM); + ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM); + ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); + ZetSetWriteHandler(gradius3_sound_write); + ZetSetReadHandler(gradius3_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + K007232Init(0, 3579545, DrvSndROM, 0x80000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback); + K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + K052109Init(DrvShareRAM2, 0x1ffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(-8, 0); + + K051960Init(DrvGfxROM1, 0x1fffff); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(-8, 0); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + SekExit(); + ZetExit(); + + K007232Exit(); + BurnYM2151Exit(); + + BurnFree (AllMem); + + return 0; +} + +static inline void character_ram_decode() +{ + for (INT32 i = 0; i < 0x20000; i++) + { + INT32 t = DrvShareRAM2[i ^ 1]; + + DrvGfxROMExp0[i * 2 + 0] = t >> 4; + DrvGfxROMExp0[i * 2 + 1] = t & 0x0f; + } +} + +static inline void DrvRecalcPalette() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x1000 / 2; i++) { + r = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 10) & 0x1f; + g = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 5) & 0x1f; + b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvRecalcPalette(); + } + + K052109Write(0x1d80,0x10); + K052109Write(0x1f00,0x32); + + K052109UpdateScroll(); + + character_ram_decode(); + + if (gradius3_priority == 0) + { + if (nSpriteEnable & 1) K052109RenderLayer(1, 1, DrvGfxROMExp0); + + if (nBurnLayer & 4) K051960SpritesRender(DrvGfxROMExp1, 3); + + if (nBurnLayer & 2) K051960SpritesRender(DrvGfxROMExp1, 1); + + if (nBurnLayer & 8) K051960SpritesRender(DrvGfxROMExp1, 0); + + if (nSpriteEnable & 2) K052109RenderLayer(2, 0, DrvGfxROMExp0); + + if (nSpriteEnable & 4) K052109RenderLayer(0, 0, DrvGfxROMExp0); + + if (nBurnLayer & 1) K051960SpritesRender(DrvGfxROMExp1, 2); + } + else + { + + if (nSpriteEnable & 1) K052109RenderLayer(0, 1, DrvGfxROMExp0); + if (nSpriteEnable & 2) K052109RenderLayer(1, 0, DrvGfxROMExp0); + if (nSpriteEnable & 4) K052109RenderLayer(2, 0, DrvGfxROMExp0); +#if 1 + if (nBurnLayer & 1) K051960SpritesRender(DrvGfxROMExp1, 2); + if (nBurnLayer & 2) K051960SpritesRender(DrvGfxROMExp1, 1); + if (nBurnLayer & 4) K051960SpritesRender(DrvGfxROMExp1, 3); + if (nBurnLayer & 8) K051960SpritesRender(DrvGfxROMExp1, 0); +#endif + } + + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3 * sizeof(INT16)); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; + if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; + } + + SekNewFrame(); + + INT32 nCycleSegment; + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 100; + INT32 nCyclesTotal[3] = { 10000000 / 60, 10000000 / 60, 3579545 / 60 }; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + SekOpen(0); + nCycleSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + nCyclesDone[0] += SekRun(nCycleSegment - nCyclesDone[0]); + if (i == nInterleave - 1 && irqA_enable) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + SekClose(); + + if (gradius3_cpub_enable) { + SekOpen(1); + nCycleSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); + nCyclesDone[1] += SekRun(nCycleSegment - SekTotalCycles()); + if (interrupt_triggered) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + if (i == (nInterleave - 1) && (irqB_mask & 1)) + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + if (i == ((nInterleave / 2) - 1) && (irqB_mask & 2)) + SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + SekClose(); + } + + nCycleSegment = (nCyclesTotal[2] / nInterleave) * (i + 1); + nCyclesDone[2] += ZetRun(nCycleSegment - nCyclesDone[2]); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + + interrupt_triggered = 0; + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029704; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + K007232Scan(nAction, pnMin); + + KonamiICScan(nAction); + + SCAN_VAR(gradius3_priority); + SCAN_VAR(gradius3_cpub_enable); + SCAN_VAR(irqA_enable); + SCAN_VAR(irqB_mask); + } + + if (nAction & ACB_WRITE) { + character_ram_decode(); + } + + return 0; +} + + +// Gradius III (Japan) + +static struct BurnRomInfo gradius3RomDesc[] = { + { "945_s13.f15", 0x20000, 0x70c240a2, 1 | BRF_PRG | BRF_ESS }, // 0 68k #0 Code + { "945_s12.e15", 0x20000, 0xbbc300d4, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "945_m09.r17", 0x20000, 0xb4a6df25, 2 | BRF_PRG | BRF_ESS }, // 2 68k #1 Code + { "945_m08.n17", 0x20000, 0x74e981d2, 2 | BRF_PRG | BRF_ESS }, // 3 + { "945_l06b.r11", 0x20000, 0x83772304, 2 | BRF_PRG | BRF_ESS }, // 4 + { "945_l06a.n11", 0x20000, 0xe1fd75b6, 2 | BRF_PRG | BRF_ESS }, // 5 + { "945_l07c.r15", 0x20000, 0xc1e399b6, 2 | BRF_PRG | BRF_ESS }, // 6 + { "945_l07a.n15", 0x20000, 0x96222d04, 2 | BRF_PRG | BRF_ESS }, // 7 + { "945_l07d.r13", 0x20000, 0x4c16d4bd, 2 | BRF_PRG | BRF_ESS }, // 8 + { "945_l07b.n13", 0x20000, 0x5e209d01, 2 | BRF_PRG | BRF_ESS }, // 9 + + { "945_m05.d9", 0x10000, 0xc8c45365, 3 | BRF_PRG | BRF_ESS }, // 10 Z80 Code + + { "945_a02.l3", 0x80000, 0x4dfffd74, 4 | BRF_GRA }, // 11 Sprites + { "945_l04a.k6", 0x20000, 0x884e21ee, 4 | BRF_GRA }, // 12 + { "945_l04c.m6", 0x20000, 0x45bcd921, 4 | BRF_GRA }, // 13 + { "945_l04b.k8", 0x20000, 0x843bc67d, 4 | BRF_GRA }, // 14 + { "945_l04d.m8", 0x20000, 0x0a98d08e, 4 | BRF_GRA }, // 15 + { "945_a01.h3", 0x80000, 0x339d6dd2, 4 | BRF_GRA }, // 16 + { "945_l03a.e6", 0x20000, 0xa67ef087, 4 | BRF_GRA }, // 17 + { "945_l03c.h6", 0x20000, 0xa56be17a, 4 | BRF_GRA }, // 18 + { "945_l03b.e8", 0x20000, 0x933e68b9, 4 | BRF_GRA }, // 19 + { "945_l03d.h8", 0x20000, 0xf375e87b, 4 | BRF_GRA }, // 20 + + { "945_a10.b15", 0x40000, 0x1d083e10, 5 | BRF_SND }, // 21 K007232 + { "945_l11a.c18", 0x20000, 0x6043f4eb, 5 | BRF_SND }, // 22 + { "945_l11b.c20", 0x20000, 0x89ea3baf, 5 | BRF_SND }, // 23 + + { "945l14.j28", 0x00100, 0xc778c189, 6 | BRF_OPT }, // 24 Prom +}; + +STD_ROM_PICK(gradius3) +STD_ROM_FN(gradius3) + +struct BurnDriver BurnDrvGradius3 = { + "gradius3", NULL, NULL, NULL, "1989", + "Gradius III (Japan)\0", NULL, "Konami", "GX945", + L"Gradius III \u4F1D\u8AAC\u304B\u3089\u795E\u8A71\u3078 (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, gradius3RomInfo, gradius3RomName, NULL, NULL, Gradius3InputInfo, Gradius3DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 224, 4, 3 +}; + + +// Gradius III (Asia) + +static struct BurnRomInfo grdius3aRomDesc[] = { + { "945_13.f15", 0x20000, 0x9974fe6b, 1 | BRF_PRG | BRF_ESS }, // 0 68k #0 Code + { "945_12.e15", 0x20000, 0xe9771b91, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "945_m09.r17", 0x20000, 0xb4a6df25, 2 | BRF_PRG | BRF_ESS }, // 2 68k #1 Code + { "945_m08.n17", 0x20000, 0x74e981d2, 2 | BRF_PRG | BRF_ESS }, // 3 + { "945_l06b.r11", 0x20000, 0x83772304, 2 | BRF_PRG | BRF_ESS }, // 4 + { "945_l06a.n11", 0x20000, 0xe1fd75b6, 2 | BRF_PRG | BRF_ESS }, // 5 + { "945_l07c.r15", 0x20000, 0xc1e399b6, 2 | BRF_PRG | BRF_ESS }, // 6 + { "945_l07a.n15", 0x20000, 0x96222d04, 2 | BRF_PRG | BRF_ESS }, // 7 + { "945_l07d.r13", 0x20000, 0x4c16d4bd, 2 | BRF_PRG | BRF_ESS }, // 8 + { "945_l07b.n13", 0x20000, 0x5e209d01, 2 | BRF_PRG | BRF_ESS }, // 9 + + { "945_m05.d9", 0x10000, 0xc8c45365, 3 | BRF_PRG | BRF_ESS }, // 10 Z80 Code + + { "945_a02.l3", 0x80000, 0x4dfffd74, 4 | BRF_GRA }, // 11 Sprites + { "945_l04a.k6", 0x20000, 0x884e21ee, 4 | BRF_GRA }, // 12 + { "945_l04c.m6", 0x20000, 0x45bcd921, 4 | BRF_GRA }, // 13 + { "945_l04b.k8", 0x20000, 0x843bc67d, 4 | BRF_GRA }, // 14 + { "945_l04d.m8", 0x20000, 0x0a98d08e, 4 | BRF_GRA }, // 15 + { "945_a01.h3", 0x80000, 0x339d6dd2, 4 | BRF_GRA }, // 16 + { "945_l03a.e6", 0x20000, 0xa67ef087, 4 | BRF_GRA }, // 17 + { "945_l03c.h6", 0x20000, 0xa56be17a, 4 | BRF_GRA }, // 18 + { "945_l03b.e8", 0x20000, 0x933e68b9, 4 | BRF_GRA }, // 19 + { "945_l03d.h8", 0x20000, 0xf375e87b, 4 | BRF_GRA }, // 20 + + { "945_a10.b15", 0x40000, 0x1d083e10, 5 | BRF_SND }, // 21 K007232 + { "945_l11a.c18", 0x20000, 0x6043f4eb, 5 | BRF_SND }, // 22 + { "945_l11b.c20", 0x20000, 0x89ea3baf, 5 | BRF_SND }, // 23 + + { "945l14.j28", 0x00100, 0xc778c189, 6 | BRF_OPT }, // 24 Prom +}; + +STD_ROM_PICK(grdius3a) +STD_ROM_FN(grdius3a) + +struct BurnDriver BurnDrvGrdius3a = { + "gradius3a", "gradius3", NULL, NULL, "1989", + "Gradius III (Asia)\0", NULL, "Konami", "GX945", + L"Gradius III \u4F1D\u8AAC\u304B\u3089\u795E\u8A71\u3078 (Asia)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, grdius3aRomInfo, grdius3aRomName, NULL, NULL, Gradius3InputInfo, Gradius3DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 224, 4, 3 +}; + + +// Gradius III (World ?) + +static struct BurnRomInfo grdius3eRomDesc[] = { + { "945_r13.f15", 0x20000, 0xcffd103f, 1 | BRF_PRG | BRF_ESS }, // 0 68k #0 Code + { "945_r12.e15", 0x20000, 0x0b968ef6, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "945_m09.r17", 0x20000, 0xb4a6df25, 2 | BRF_PRG | BRF_ESS }, // 2 68k #1 Code + { "945_m08.n17", 0x20000, 0x74e981d2, 2 | BRF_PRG | BRF_ESS }, // 3 + { "945_l06b.r11", 0x20000, 0x83772304, 2 | BRF_PRG | BRF_ESS }, // 4 + { "945_l06a.n11", 0x20000, 0xe1fd75b6, 2 | BRF_PRG | BRF_ESS }, // 5 + { "945_l07c.r15", 0x20000, 0xc1e399b6, 2 | BRF_PRG | BRF_ESS }, // 6 + { "945_l07a.n15", 0x20000, 0x96222d04, 2 | BRF_PRG | BRF_ESS }, // 7 + { "945_l07d.r13", 0x20000, 0x4c16d4bd, 2 | BRF_PRG | BRF_ESS }, // 8 + { "945_l07b.n13", 0x20000, 0x5e209d01, 2 | BRF_PRG | BRF_ESS }, // 9 + + { "945_m05.d9", 0x10000, 0xc8c45365, 3 | BRF_PRG | BRF_ESS }, // 10 Z80 Code + + { "945_a02.l3", 0x80000, 0x4dfffd74, 4 | BRF_GRA }, // 11 Sprites + { "945_l04a.k6", 0x20000, 0x884e21ee, 4 | BRF_GRA }, // 12 + { "945_l04c.m6", 0x20000, 0x45bcd921, 4 | BRF_GRA }, // 13 + { "945_l04b.k8", 0x20000, 0x843bc67d, 4 | BRF_GRA }, // 14 + { "945_l04d.m8", 0x20000, 0x0a98d08e, 4 | BRF_GRA }, // 15 + { "945_a01.h3", 0x80000, 0x339d6dd2, 4 | BRF_GRA }, // 16 + { "945_l03a.e6", 0x20000, 0xa67ef087, 4 | BRF_GRA }, // 17 + { "945_l03c.h6", 0x20000, 0xa56be17a, 4 | BRF_GRA }, // 18 + { "945_l03b.e8", 0x20000, 0x933e68b9, 4 | BRF_GRA }, // 19 + { "945_l03d.h8", 0x20000, 0xf375e87b, 4 | BRF_GRA }, // 20 + + { "945_a10.b15", 0x40000, 0x1d083e10, 5 | BRF_SND }, // 21 K007232 + { "945_l11a.c18", 0x20000, 0x6043f4eb, 5 | BRF_SND }, // 22 + { "945_l11b.c20", 0x20000, 0x89ea3baf, 5 | BRF_SND }, // 23 + + { "945l14.j28", 0x00100, 0xc778c189, 6 | BRF_OPT }, // 24 Prom +}; + +STD_ROM_PICK(grdius3e) +STD_ROM_FN(grdius3e) + +struct BurnDriver BurnDrvGrdius3e = { + "gradius3e", "gradius3", NULL, NULL, "1989", + "Gradius III (World)\0", NULL, "Konami", "GX945", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, grdius3eRomInfo, grdius3eRomName, NULL, NULL, Gradius3InputInfo, Gradius3DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_gyruss.cpp b/src/burn/drv/konami/d_gyruss.cpp index 43c021bb4..84f5ff3f7 100644 --- a/src/burn/drv/konami/d_gyruss.cpp +++ b/src/burn/drv/konami/d_gyruss.cpp @@ -1,1061 +1,1059 @@ -// FB Alpha Gyruss driver module -// Based on MAME driver by Mirko Buffoni, Michael Cuddy, and Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "m6809_intf.h" -#include "i8039.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvM6809ROM; -static UINT8 *DrvM6809DecROM; -static UINT8 *DrvI8039ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvColPROM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvColRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvShareRAM; -static UINT8 *DrvM6809RAM; -static UINT32 *DrvPalette; -static UINT32 *Palette; -static UINT8 DrvRecalc; - -static INT16 *pAY8910Buffer[15]; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static UINT8 *soundlatch; -static UINT8 *soundlatch2; -static UINT8 *flipscreen; -static UINT8 *interrupt_enable0; -static UINT8 *interrupt_enable1; - -static INT32 scanline; -static UINT16 *pTemp; - -static struct BurnInputInfo GyrussInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Gyruss) - -static struct BurnDIPInfo GyrussDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0x3b, NULL }, - {0x12, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x10, 0x01, 0x0f, 0x02, "4 Coins 1 Credits " }, - {0x10, 0x01, 0x0f, 0x05, "3 Coins 1 Credits " }, - {0x10, 0x01, 0x0f, 0x08, "2 Coins 1 Credits " }, - {0x10, 0x01, 0x0f, 0x04, "3 Coins 2 Credits " }, - {0x10, 0x01, 0x0f, 0x01, "4 Coins 3 Credits " }, - {0x10, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits " }, - {0x10, 0x01, 0x0f, 0x03, "3 Coins 4 Credits " }, - {0x10, 0x01, 0x0f, 0x07, "2 Coins 3 Credits " }, - {0x10, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits " }, - {0x10, 0x01, 0x0f, 0x06, "2 Coins 5 Credits " }, - {0x10, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits " }, - {0x10, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits " }, - {0x10, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits " }, - {0x10, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits " }, - {0x10, 0x01, 0x0f, 0x09, "1 Coin 7 Credits " }, - {0x10, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x10, 0x01, 0xf0, 0x20, "4 Coins 1 Credits " }, - {0x10, 0x01, 0xf0, 0x50, "3 Coins 1 Credits " }, - {0x10, 0x01, 0xf0, 0x80, "2 Coins 1 Credits " }, - {0x10, 0x01, 0xf0, 0x40, "3 Coins 2 Credits " }, - {0x10, 0x01, 0xf0, 0x10, "4 Coins 3 Credits " }, - {0x10, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits " }, - {0x10, 0x01, 0xf0, 0x30, "3 Coins 4 Credits " }, - {0x10, 0x01, 0xf0, 0x70, "2 Coins 3 Credits " }, - {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits " }, - {0x10, 0x01, 0xf0, 0x60, "2 Coins 5 Credits " }, - {0x10, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits " }, - {0x10, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits " }, - {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits " }, - {0x10, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits " }, - {0x10, 0x01, 0xf0, 0x90, "1 Coin 7 Credits " }, - {0x10, 0x01, 0xf0, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x11, 0x01, 0x03, 0x03, "3" }, - {0x11, 0x01, 0x03, 0x02, "4" }, - {0x11, 0x01, 0x03, 0x01, "5" }, - {0x11, 0x01, 0x03, 0x00, "255 (Cheat)" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x11, 0x01, 0x04, 0x00, "Upright" }, - {0x11, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x11, 0x01, 0x08, 0x08, "30k 90k 60k+" }, - {0x11, 0x01, 0x08, 0x00, "40k 110k 70k+" }, - - {0 , 0xfe, 0 , 8, "Difficulty" }, - {0x11, 0x01, 0x70, 0x70, "1 (Easiest)" }, - {0x11, 0x01, 0x70, 0x60, "2" }, - {0x11, 0x01, 0x70, 0x50, "3" }, - {0x11, 0x01, 0x70, 0x40, "4" }, - {0x11, 0x01, 0x70, 0x30, "5 (Average)" }, - {0x11, 0x01, 0x70, 0x20, "6" }, - {0x11, 0x01, 0x70, 0x10, "7" }, - {0x11, 0x01, 0x70, 0x00, "8 (Hardest)" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Music" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, -}; - -STDDIPINFO(Gyruss) - -static struct BurnDIPInfo GyrussceDIPList[]= -{ - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0x3b, NULL }, - {0x12, 0xff, 0xff, 0x20, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x10, 0x01, 0x0f, 0x02, "4 Coins 1 Credits " }, - {0x10, 0x01, 0x0f, 0x05, "3 Coins 1 Credits " }, - {0x10, 0x01, 0x0f, 0x08, "2 Coins 1 Credits " }, - {0x10, 0x01, 0x0f, 0x04, "3 Coins 2 Credits " }, - {0x10, 0x01, 0x0f, 0x01, "4 Coins 3 Credits " }, - {0x10, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits " }, - {0x10, 0x01, 0x0f, 0x03, "3 Coins 4 Credits " }, - {0x10, 0x01, 0x0f, 0x07, "2 Coins 3 Credits " }, - {0x10, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits " }, - {0x10, 0x01, 0x0f, 0x06, "2 Coins 5 Credits " }, - {0x10, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits " }, - {0x10, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits " }, - {0x10, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits " }, - {0x10, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits " }, - {0x10, 0x01, 0x0f, 0x09, "1 Coin 7 Credits " }, - {0x10, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x10, 0x01, 0xf0, 0x20, "4 Coins 1 Credits " }, - {0x10, 0x01, 0xf0, 0x50, "3 Coins 1 Credits " }, - {0x10, 0x01, 0xf0, 0x80, "2 Coins 1 Credits " }, - {0x10, 0x01, 0xf0, 0x40, "3 Coins 2 Credits " }, - {0x10, 0x01, 0xf0, 0x10, "4 Coins 3 Credits " }, - {0x10, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits " }, - {0x10, 0x01, 0xf0, 0x30, "3 Coins 4 Credits " }, - {0x10, 0x01, 0xf0, 0x70, "2 Coins 3 Credits " }, - {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits " }, - {0x10, 0x01, 0xf0, 0x60, "2 Coins 5 Credits " }, - {0x10, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits " }, - {0x10, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits " }, - {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits " }, - {0x10, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits " }, - {0x10, 0x01, 0xf0, 0x90, "1 Coin 7 Credits " }, - {0x10, 0x01, 0xf0, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x11, 0x01, 0x03, 0x03, "3" }, - {0x11, 0x01, 0x03, 0x02, "4" }, - {0x11, 0x01, 0x03, 0x01, "5" }, - {0x11, 0x01, 0x03, 0x00, "255 (Cheat)" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x11, 0x01, 0x04, 0x00, "Upright" }, - {0x11, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 0, "Bonus Life" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x11, 0x01, 0x08, 0x08, "50k 120k 70k+" }, - {0x11, 0x01, 0x08, 0x00, "60k 140k 80k+" }, - - {0 , 0xfe, 0 , 8, "Difficulty" }, - {0x11, 0x01, 0x70, 0x70, "1 (Easiest)" }, - {0x11, 0x01, 0x70, 0x60, "2" }, - {0x11, 0x01, 0x70, 0x50, "3" }, - {0x11, 0x01, 0x70, 0x40, "4" }, - {0x11, 0x01, 0x70, 0x30, "5 (Average)" }, - {0x11, 0x01, 0x70, 0x20, "6" }, - {0x11, 0x01, 0x70, 0x10, "7" }, - {0x11, 0x01, 0x70, 0x00, "8 (Hardest)" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Music" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, -}; - -STDDIPINFO(Gyrussce) - -void __fastcall gyruss_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc000: // watchdog - return; - - case 0xc080: - ZetClose(); - ZetOpen(1); - ZetRaiseIrq(0xff); - ZetClose(); - ZetOpen(0); - return; - - case 0xc100: - *soundlatch = data; - return; - - case 0xc180: - *interrupt_enable0 = data; - return; - - case 0xc185: - *flipscreen = data & 1; - return; - } -} - -UINT8 __fastcall gyruss_main_read(UINT16 address) -{ - switch (address) - { - case 0xc000: - return DrvDips[1]; - - case 0xc080: - return DrvInputs[0]; - - case 0xc0a0: - return DrvInputs[1]; - - case 0xc0c0: - return DrvInputs[2]; - - case 0xc0e0: - return DrvDips[0]; - - case 0xc100: - return DrvDips[2]; - } - - return 0; -} - -void gyruss_sub_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x2000: - *interrupt_enable1 = data; - return; - } -} - -UINT8 gyruss_sub_read(UINT16 address) -{ - switch (address) - { - case 0x0000: - return (scanline & 0x7f); - } - - return 0; -} - -UINT8 __fastcall gyruss_sound0_read(UINT16 address) -{ - switch (address) - { - case 0x8000: - return *soundlatch; - } - - return 0; -} - -UINT8 __fastcall gyruss_sound0_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x01: - return AY8910Read(0); - - case 0x05: - return AY8910Read(1); - - case 0x09: - return AY8910Read(2); - - case 0x0d: - return AY8910Read(3); - - case 0x11: - return AY8910Read(4); - } - - return 0; -} - -void __fastcall gyruss_sound0_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - AY8910Write(0, 0, data); - return; - - case 0x02: - AY8910Write(0, 1, data); - return; - - case 0x04: - AY8910Write(1, 0, data); - return; - - case 0x06: - AY8910Write(1, 1, data); - return; - - case 0x08: - AY8910Write(2, 0, data); - return; - - case 0x0a: - AY8910Write(2, 1, data); - return; - - case 0x0c: - AY8910Write(3, 0, data); - return; - - case 0x0e: - AY8910Write(3, 1, data); - return; - - case 0x10: - AY8910Write(4, 0, data); - return; - - case 0x12: - AY8910Write(4, 1, data); - return; - - case 0x14: // clear i8039 irq - return; - - case 0x18: - *soundlatch2 = data; - return; - } -} - -UINT8 AY8910_3_portA(UINT32) -{ - static const INT32 gyruss_timer[10] = - { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x0a, 0x0d - }; - - return gyruss_timer[((ZetTotalCycles() * 60) >> 10) % 10]; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x010000; - DrvZ80ROM1 = Next; Next += 0x010000; - - DrvM6809ROM = Next; Next += 0x010000; - DrvM6809DecROM = Next; Next += 0x010000; - - DrvI8039ROM = Next; Next += 0x001000; - - DrvGfxROM0 = Next; Next += 0x010000; - DrvGfxROM1 = Next; Next += 0x010000; - DrvGfxROM2 = Next; Next += 0x008000; - - DrvColPROM = Next; Next += 0x000300; - - Palette = (UINT32*)Next; Next += 0x0140 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x0140 * sizeof(UINT32); - - pAY8910Buffer[ 0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[ 1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[ 2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[ 3] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[ 4] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[ 5] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[ 6] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[ 7] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[ 8] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[ 9] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[10] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[11] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[12] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[13] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[14] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - pTemp = (UINT16*)Next; Next += 0x10000 * 2; - - AllRam = Next; - - flipscreen = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - soundlatch2 = Next; Next += 0x000001; - - interrupt_enable0 = Next; Next += 0x000001; - interrupt_enable1 = Next; Next += 0x000001; - - DrvShareRAM = Next; Next += 0x000800; - DrvColRAM = Next; Next += 0x000400; - DrvVidRAM = Next; Next += 0x000400; - DrvZ80RAM0 = Next; Next += 0x001000; - DrvZ80RAM1 = Next; Next += 0x000400; - - DrvM6809RAM = Next; Next += 0x000800; - - DrvSprRAM = DrvM6809RAM + 0x000040; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x20004, 0x20000, 4, 0 }; - INT32 XOffs[8] = { 0, 1, 2, 3, 64, 65, 66, 67 }; - INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x8000); - - GfxDecode(0x0200, 4, 8, 16, Plane , XOffs, YOffs, 0x200, tmp , DrvGfxROM0); - GfxDecode(0x0200, 4, 8, 16, Plane , XOffs, YOffs, 0x200, tmp + 0x10, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x2000); - - GfxDecode(0x0200, 2, 8, 8, Plane + 2, XOffs, YOffs, 0x080, tmp , DrvGfxROM2); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvPaletteInit() -{ - UINT8 *color_prom = DrvColPROM; - UINT32 *tmp = (UINT32*)BurnMalloc(32 * sizeof(UINT32)); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x20; i++) - { - INT32 bit0, bit1, bit2; - UINT8 r, g, b; - - bit0 = (color_prom[i] >> 0) & 0x01; - bit1 = (color_prom[i] >> 1) & 0x01; - bit2 = (color_prom[i] >> 2) & 0x01; - r = (INT32)(double((bit0 * 33 + bit1 * 70 + bit2 * 151)+0.5)); - - bit0 = (color_prom[i] >> 3) & 0x01; - bit1 = (color_prom[i] >> 4) & 0x01; - bit2 = (color_prom[i] >> 5) & 0x01; - g = (INT32)(double((bit0 * 33 + bit1 * 70 + bit2 * 151)+0.5)); - - bit0 = (color_prom[i] >> 6) & 0x01; - bit1 = (color_prom[i] >> 7) & 0x01; - b = (INT32)(double((bit0 * 78 + bit1 * 151)+0.5)); - - tmp[i] = (r << 16) | (g << 8) | b; - } - - color_prom += 32; - - for (INT32 i = 0; i < 0x140; i++) { - UINT8 ctabentry = color_prom[i] & 0x0f; - Palette[i] = tmp[ctabentry | ((i >> 4) & 0x10)]; - } - - BurnFree (tmp); - return 0; -} - -static void gyrussDecode() -{ - for (INT32 i = 0xe000; i < 0x10000; i++) - { - UINT8 xor1 = 0; - - if ( i & 0x02) xor1 |= 0x80; - else xor1 |= 0x20; - if ( i & 0x08) xor1 |= 0x08; - else xor1 |= 0x02; - - DrvM6809DecROM[i] = DrvM6809ROM[i] ^ xor1; - } -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - M6809Open(0); - M6809Reset(); - M6809Close(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - AY8910Reset(1); - AY8910Reset(2); - AY8910Reset(3); - AY8910Reset(4); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x2000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x4000, 2, 1)) return 1; - - if (BurnLoadRom(DrvM6809ROM + 0xe000, 3, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x0000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x2000, 5, 1)) return 1; - - if (BurnLoadRom(DrvI8039ROM + 0x0000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x0000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x2000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x4000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x6000, 10, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x0000, 11, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x0000, 12, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x0020, 13, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x0120, 14, 1)) return 1; - - gyrussDecode(); - DrvGfxDecode(); - DrvPaletteInit(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0x8000, 0x83ff, 0, DrvColRAM); - ZetMapArea(0x8000, 0x83ff, 1, DrvColRAM); - ZetMapArea(0x8000, 0x83ff, 2, DrvColRAM); - ZetMapArea(0x8400, 0x87ff, 0, DrvVidRAM); - ZetMapArea(0x8400, 0x87ff, 1, DrvVidRAM); - ZetMapArea(0x8400, 0x87ff, 2, DrvVidRAM); - ZetMapArea(0x9000, 0x9fff, 0, DrvZ80RAM0); - ZetMapArea(0x9000, 0x9fff, 1, DrvZ80RAM0); - ZetMapArea(0x9000, 0x9fff, 2, DrvZ80RAM0); - ZetMapArea(0xa000, 0xa7ff, 0, DrvShareRAM); - ZetMapArea(0xa000, 0xa7ff, 1, DrvShareRAM); - ZetMapArea(0xa000, 0xa7ff, 2, DrvShareRAM); - ZetSetReadHandler(gyruss_main_read); - ZetSetWriteHandler(gyruss_main_write); - ZetMemEnd(); - ZetClose(); - - M6809Init(1); - M6809Open(0); - M6809MapMemory(DrvM6809RAM, 0x4000, 0x47ff, M6809_RAM); - M6809MapMemory(DrvShareRAM, 0x6000, 0x67ff, M6809_RAM); - M6809MapMemory(DrvM6809ROM + 0xe000, 0xe000, 0xffff, M6809_READ); - M6809MapMemory(DrvM6809DecROM + 0xe000, 0xe000, 0xffff, M6809_FETCH); - M6809SetReadHandler(gyruss_sub_read); - M6809SetWriteHandler(gyruss_sub_write); - M6809Close(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM1); - ZetMapArea(0x6000, 0x63ff, 0, DrvZ80RAM1); - ZetMapArea(0x6000, 0x63ff, 1, DrvZ80RAM1); - ZetMapArea(0x6000, 0x63ff, 2, DrvZ80RAM1); - ZetSetReadHandler(gyruss_sound0_read); - ZetSetOutHandler(gyruss_sound0_out); - ZetSetInHandler(gyruss_sound0_in); - ZetMemEnd(); - ZetClose(); - - // don't bother with i8039 right now, descrete sounds not emulated - - AY8910Init(0, 1789773, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 1789773, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(2, 1789773, nBurnSoundRate, AY8910_3_portA, NULL, NULL, NULL); - AY8910Init(3, 1789773, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(4, 1789773, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(2, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(3, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(4, 0.25, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - ZetExit(); - M6809Exit(); - - AY8910Exit(0); - AY8910Exit(1); - AY8910Exit(2); - AY8910Exit(3); - AY8910Exit(4); - - BurnFree (AllMem); - - return 0; -} - -static void draw_background(INT32 transp) -{ - for (INT32 offs = 0x40; offs < 0x3c0; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - INT32 attr = DrvColRAM[offs]; - INT32 code = ((attr & 0x20) << 3) | DrvVidRAM[offs]; - INT32 color = attr & 0x0f; - INT32 flipx = (attr >> 6) & 1; - INT32 flipy = attr >> 7; - - INT32 group = ((~DrvColRAM[offs] >> 4) & 1); - if (transp && group == 0) continue; - - if (*flipscreen) { - flipx ^= 1; - flipy ^= 1; - sx ^= 0xf8; - sy ^= 0xf8; - } - - sy -= 16; - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 2, transp, 0x100, DrvGfxROM2); - } else { - Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 2, transp, 0x100, DrvGfxROM2); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 2, transp, 0x100, DrvGfxROM2); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 2, transp, 0x100, DrvGfxROM2); - } - } - } -} - -static void draw_8x16_tile_line(INT32 sx, INT32 sy, INT32 color, UINT8 *gfx_base, INT32 code, INT32 flipx, INT32 flipy, INT32 line) -{ - line -= 16; - - if (line < 0 || line >= nScreenHeight) return; - - INT32 y = line - sy; // right? - if (y < 0 || y >= 16) return; - - if (flipy) flipy = 0x78; - - UINT8 *src = gfx_base + (code * 0x80) + ((y << 3) ^ flipy); - color <<= 4; - - if (flipx) flipx = 0x07; - - for (INT32 x = 0; x < 8; x++, sx++) - { - INT32 pxl = src[x ^ flipx]; - - if (sx < 0 || sx >= nScreenWidth || !pxl) continue; - - pTransDraw[(line * nScreenWidth) + sx] = pxl | color; - } -} - -static void draw_sprites(INT32 line) -{ - for (INT32 offs = 0xbc; offs >= 0; offs -= 4) - { - INT32 sx = DrvSprRAM[offs]; - INT32 sy = (241 - DrvSprRAM[offs + 3]); - - if (sy <= (line-16) || sy >= (line+16)) continue; - - INT32 bank = DrvSprRAM[offs + 1] & 0x01; - INT32 code = ((DrvSprRAM[offs + 2] & 0x20) << 2) | (DrvSprRAM[offs + 1] >> 1); - INT32 color = DrvSprRAM[offs + 2] & 0x0f; - INT32 flipx = ~DrvSprRAM[offs + 2] & 0x40; - INT32 flipy = DrvSprRAM[offs + 2] & 0x80; - - UINT8 *gfx_base = bank ? DrvGfxROM1 : DrvGfxROM0; - - draw_8x16_tile_line(sx, sy-16, color, gfx_base, code, flipx, flipy, line); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x140; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - BurnTransferClear(); - - draw_background(0); - -// draw_background(0x0f); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 5; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - ZetNewFrame(); - - INT32 nCyclesSegment; - INT32 nInterleave = 256; - INT32 nCyclesTotal[4] = { 3072000 / 60, 2000000 / 60, 3579545 / 60, 8000000 / 60 }; - INT32 nCyclesDone[4] = { 0, 0, 0, 0 }; - - DrvDraw(); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nNext; - scanline = i; - - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[0]; - nCyclesDone[0] += ZetRun(nCyclesSegment); - if (i == (nInterleave - 1) && *interrupt_enable0) { - ZetNmi(); - } - - M6809Open(0); - nNext = (i + 1) * nCyclesTotal[1] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[1]; - nCyclesDone[1] += M6809Run(nCyclesSegment); - if (i == (nInterleave - 1) && *interrupt_enable1) { - M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); - } - M6809Close(); - ZetClose(); - - ZetOpen(1); - nNext = (i + 1) * nCyclesTotal[2] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[2]; - nCyclesDone[2] += ZetRun(nCyclesSegment); - ZetClose(); - - draw_sprites(scanline); - } - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - BurnTransferCopy(DrvPalette); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029704; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - M6809Scan(nAction); - - AY8910Scan(nAction, pnMin); - } - - return 0; -} - - -// Gyruss (Konami) - -static struct BurnRomInfo gyrussRomDesc[] = { - { "gyrussk.1", 0x2000, 0xc673b43d, 1 | BRF_PRG | BRF_ESS }, // 0 Main Z80 Code - { "gyrussk.2", 0x2000, 0xa4ec03e4, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gyrussk.3", 0x2000, 0x27454a98, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "gyrussk.9", 0x2000, 0x822bf27e, 2 | BRF_PRG | BRF_ESS }, // 3 Sub M6809 Code - - { "gyrussk.1a", 0x2000, 0xf4ae1c17, 3 | BRF_PRG | BRF_ESS }, // 4 Audio Z80 Code - { "gyrussk.2a", 0x2000, 0xba498115, 3 | BRF_PRG | BRF_ESS }, // 5 - - { "gyrussk.3a", 0x1000, 0x3f9b5dea, 4 | BRF_PRG | BRF_ESS }, // 6 Audio i8039 - - { "gyrussk.6", 0x2000, 0xc949db10, 5 | BRF_GRA }, // 7 Sprites - { "gyrussk.5", 0x2000, 0x4f22411a, 5 | BRF_GRA }, // 8 - { "gyrussk.8", 0x2000, 0x47cd1fbc, 5 | BRF_GRA }, // 9 - { "gyrussk.7", 0x2000, 0x8e8d388c, 5 | BRF_GRA }, // 10 - - { "gyrussk.4", 0x2000, 0x27d8329b, 6 | BRF_GRA }, // 11 Background Tiles - - { "gyrussk.pr3", 0x0020, 0x98782db3, 7 | BRF_GRA }, // 12 Color Proms - { "gyrussk.pr1", 0x0100, 0x7ed057de, 7 | BRF_GRA }, // 13 - { "gyrussk.pr2", 0x0100, 0xde823a81, 7 | BRF_GRA }, // 14 -}; - -STD_ROM_PICK(gyruss) -STD_ROM_FN(gyruss) - -struct BurnDriver BurnDrvGyruss = { - "gyruss", NULL, NULL, NULL, "1983", - "Gyruss (Konami)\0", NULL, "Konami", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, gyrussRomInfo, gyrussRomName, NULL, NULL, GyrussInputInfo, GyrussDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x140, - 224, 256, 3, 4 -}; - - -// Gyruss (Centuri) - -static struct BurnRomInfo gyrussceRomDesc[] = { - { "gya-1.bin", 0x2000, 0x85f8b7c2, 1 | BRF_PRG | BRF_ESS }, // 0 Main Z80 Code - { "gya-2.bin", 0x2000, 0x1e1a970f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gya-3.bin", 0x2000, 0xf6dbb33b, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "gyrussk.9", 0x2000, 0x822bf27e, 2 | BRF_PRG | BRF_ESS }, // 3 Sub M6809 Code - - { "gyrussk.1a", 0x2000, 0xf4ae1c17, 3 | BRF_PRG | BRF_ESS }, // 4 Audio Z80 Code - { "gyrussk.2a", 0x2000, 0xba498115, 3 | BRF_PRG | BRF_ESS }, // 5 - - { "gyrussk.3a", 0x1000, 0x3f9b5dea, 4 | BRF_PRG | BRF_ESS }, // 6 Audio i8039 - - { "gyrussk.6", 0x2000, 0xc949db10, 5 | BRF_GRA }, // 7 Sprites - { "gyrussk.5", 0x2000, 0x4f22411a, 5 | BRF_GRA }, // 8 - { "gyrussk.8", 0x2000, 0x47cd1fbc, 5 | BRF_GRA }, // 9 - { "gyrussk.7", 0x2000, 0x8e8d388c, 5 | BRF_GRA }, // 10 - - { "gyrussk.4", 0x2000, 0x27d8329b, 6 | BRF_GRA }, // 11 Background Tiles - - { "gyrussk.pr3", 0x0020, 0x98782db3, 7 | BRF_GRA }, // 12 Color Proms - { "gyrussk.pr1", 0x0100, 0x7ed057de, 7 | BRF_GRA }, // 13 - { "gyrussk.pr2", 0x0100, 0xde823a81, 7 | BRF_GRA }, // 14 -}; - -STD_ROM_PICK(gyrussce) -STD_ROM_FN(gyrussce) - -struct BurnDriver BurnDrvGyrussce = { - "gyrussce", "gyruss", NULL, NULL, "1983", - "Gyruss (Centuri)\0", NULL, "Konami (Centuri license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, gyrussceRomInfo, gyrussceRomName, NULL, NULL, GyrussInputInfo, GyrussceDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x140, - 224, 256, 3, 4 -}; - - -// Gyruss (bootleg) - -static struct BurnRomInfo gyrussbRomDesc[] = { - { "1.bin", 0x2000, 0x6bc21c10, 1 | BRF_PRG | BRF_ESS }, // 0 Main Z80 Code - { "gyrussk.2", 0x2000, 0xa4ec03e4, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gyrussk.3", 0x2000, 0x27454a98, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "gyrussk.9", 0x2000, 0x822bf27e, 2 | BRF_PRG | BRF_ESS }, // 3 Sub M6809 Code - - { "gyrussk.1a", 0x2000, 0xf4ae1c17, 3 | BRF_PRG | BRF_ESS }, // 4 Audio Z80 Code - { "gyrussk.2a", 0x2000, 0xba498115, 3 | BRF_PRG | BRF_ESS }, // 5 - - { "gyrussk.3a", 0x1000, 0x3f9b5dea, 4 | BRF_PRG | BRF_ESS }, // 6 Audio i8039 - - { "gyrussk.6", 0x2000, 0xc949db10, 5 | BRF_GRA }, // 7 Sprites - { "gyrussk.5", 0x2000, 0x4f22411a, 5 | BRF_GRA }, // 8 - { "gyrussk.8", 0x2000, 0x47cd1fbc, 5 | BRF_GRA }, // 9 - { "gyrussk.7", 0x2000, 0x8e8d388c, 5 | BRF_GRA }, // 10 - - { "gyrussk.4", 0x2000, 0x27d8329b, 6 | BRF_GRA }, // 11 Background Tiles - - { "gyrussk.pr3", 0x0020, 0x98782db3, 7 | BRF_GRA }, // 12 Color Proms - { "gyrussk.pr1", 0x0100, 0x7ed057de, 7 | BRF_GRA }, // 13 - { "gyrussk.pr2", 0x0100, 0xde823a81, 7 | BRF_GRA }, // 14 -}; - -STD_ROM_PICK(gyrussb) -STD_ROM_FN(gyrussb) - -struct BurnDriver BurnDrvGyrussb = { - "gyrussb", "gyruss", NULL, NULL, "1983", - "Gyruss (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, gyrussbRomInfo, gyrussbRomName, NULL, NULL, GyrussInputInfo, GyrussDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x140, - 224, 256, 3, 4 -}; - - -// Venus - -static struct BurnRomInfo venusRomDesc[] = { - { "r1", 0x2000, 0xd030abb1, 1 | BRF_PRG | BRF_ESS }, // 0 Main Z80 Code - { "r2", 0x2000, 0xdbf65d4d, 1 | BRF_PRG | BRF_ESS }, // 1 - { "r3", 0x2000, 0xdb246fcd, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "gyrussk.9", 0x2000, 0x822bf27e, 2 | BRF_PRG | BRF_ESS }, // 3 Sub M6809 Code - - { "gyrussk.1a", 0x2000, 0xf4ae1c17, 3 | BRF_PRG | BRF_ESS }, // 4 Audio Z80 Code - { "gyrussk.2a", 0x2000, 0xba498115, 3 | BRF_PRG | BRF_ESS }, // 5 - - { "gyrussk.3a", 0x1000, 0x3f9b5dea, 4 | BRF_PRG | BRF_ESS }, // 6 Audio i8039 - - { "gyrussk.6", 0x2000, 0xc949db10, 5 | BRF_GRA }, // 7 Sprites - { "gyrussk.5", 0x2000, 0x4f22411a, 5 | BRF_GRA }, // 8 - { "gyrussk.8", 0x2000, 0x47cd1fbc, 5 | BRF_GRA }, // 9 - { "gyrussk.7", 0x2000, 0x8e8d388c, 5 | BRF_GRA }, // 10 - - { "gyrussk.4", 0x2000, 0x27d8329b, 6 | BRF_GRA }, // 11 Background Tiles - - { "gyrussk.pr3", 0x0020, 0x98782db3, 7 | BRF_GRA }, // 12 Color Proms - { "gyrussk.pr1", 0x0100, 0x7ed057de, 7 | BRF_GRA }, // 13 - { "gyrussk.pr2", 0x0100, 0xde823a81, 7 | BRF_GRA }, // 14 -}; - -STD_ROM_PICK(venus) -STD_ROM_FN(venus) - -struct BurnDriver BurnDrvVenus = { - "venus", "gyruss", NULL, NULL, "1983", - "Venus\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, venusRomInfo, venusRomName, NULL, NULL, GyrussInputInfo, GyrussDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x140, - 224, 256, 3, 4 -}; - +// FB Alpha Gyruss driver module +// Based on MAME driver by Mirko Buffoni, Michael Cuddy, and Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "m6809_intf.h" +#include "i8039.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvM6809ROM; +static UINT8 *DrvM6809DecROM; +static UINT8 *DrvI8039ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvColPROM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvColRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvShareRAM; +static UINT8 *DrvM6809RAM; +static UINT32 *DrvPalette; +static UINT32 *Palette; +static UINT8 DrvRecalc; + +static INT16 *pAY8910Buffer[15]; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static UINT8 *soundlatch; +static UINT8 *soundlatch2; +static UINT8 *flipscreen; +static UINT8 *interrupt_enable0; +static UINT8 *interrupt_enable1; + +static INT32 scanline; +static UINT16 *pTemp; + +static struct BurnInputInfo GyrussInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Gyruss) + +static struct BurnDIPInfo GyrussDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0x3b, NULL }, + {0x12, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x10, 0x01, 0x0f, 0x02, "4 Coins 1 Credits " }, + {0x10, 0x01, 0x0f, 0x05, "3 Coins 1 Credits " }, + {0x10, 0x01, 0x0f, 0x08, "2 Coins 1 Credits " }, + {0x10, 0x01, 0x0f, 0x04, "3 Coins 2 Credits " }, + {0x10, 0x01, 0x0f, 0x01, "4 Coins 3 Credits " }, + {0x10, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits " }, + {0x10, 0x01, 0x0f, 0x03, "3 Coins 4 Credits " }, + {0x10, 0x01, 0x0f, 0x07, "2 Coins 3 Credits " }, + {0x10, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits " }, + {0x10, 0x01, 0x0f, 0x06, "2 Coins 5 Credits " }, + {0x10, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits " }, + {0x10, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits " }, + {0x10, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits " }, + {0x10, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits " }, + {0x10, 0x01, 0x0f, 0x09, "1 Coin 7 Credits " }, + {0x10, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x10, 0x01, 0xf0, 0x20, "4 Coins 1 Credits " }, + {0x10, 0x01, 0xf0, 0x50, "3 Coins 1 Credits " }, + {0x10, 0x01, 0xf0, 0x80, "2 Coins 1 Credits " }, + {0x10, 0x01, 0xf0, 0x40, "3 Coins 2 Credits " }, + {0x10, 0x01, 0xf0, 0x10, "4 Coins 3 Credits " }, + {0x10, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits " }, + {0x10, 0x01, 0xf0, 0x30, "3 Coins 4 Credits " }, + {0x10, 0x01, 0xf0, 0x70, "2 Coins 3 Credits " }, + {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits " }, + {0x10, 0x01, 0xf0, 0x60, "2 Coins 5 Credits " }, + {0x10, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits " }, + {0x10, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits " }, + {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits " }, + {0x10, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits " }, + {0x10, 0x01, 0xf0, 0x90, "1 Coin 7 Credits " }, + {0x10, 0x01, 0xf0, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x11, 0x01, 0x03, 0x03, "3" }, + {0x11, 0x01, 0x03, 0x02, "4" }, + {0x11, 0x01, 0x03, 0x01, "5" }, + {0x11, 0x01, 0x03, 0x00, "255 (Cheat)" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x11, 0x01, 0x04, 0x00, "Upright" }, + {0x11, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x11, 0x01, 0x08, 0x08, "30k 90k 60k+" }, + {0x11, 0x01, 0x08, 0x00, "40k 110k 70k+" }, + + {0 , 0xfe, 0 , 8, "Difficulty" }, + {0x11, 0x01, 0x70, 0x70, "1 (Easiest)" }, + {0x11, 0x01, 0x70, 0x60, "2" }, + {0x11, 0x01, 0x70, 0x50, "3" }, + {0x11, 0x01, 0x70, 0x40, "4" }, + {0x11, 0x01, 0x70, 0x30, "5 (Average)" }, + {0x11, 0x01, 0x70, 0x20, "6" }, + {0x11, 0x01, 0x70, 0x10, "7" }, + {0x11, 0x01, 0x70, 0x00, "8 (Hardest)" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Music" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, +}; + +STDDIPINFO(Gyruss) + +static struct BurnDIPInfo GyrussceDIPList[]= +{ + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0x3b, NULL }, + {0x12, 0xff, 0xff, 0x20, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x10, 0x01, 0x0f, 0x02, "4 Coins 1 Credits " }, + {0x10, 0x01, 0x0f, 0x05, "3 Coins 1 Credits " }, + {0x10, 0x01, 0x0f, 0x08, "2 Coins 1 Credits " }, + {0x10, 0x01, 0x0f, 0x04, "3 Coins 2 Credits " }, + {0x10, 0x01, 0x0f, 0x01, "4 Coins 3 Credits " }, + {0x10, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits " }, + {0x10, 0x01, 0x0f, 0x03, "3 Coins 4 Credits " }, + {0x10, 0x01, 0x0f, 0x07, "2 Coins 3 Credits " }, + {0x10, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits " }, + {0x10, 0x01, 0x0f, 0x06, "2 Coins 5 Credits " }, + {0x10, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits " }, + {0x10, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits " }, + {0x10, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits " }, + {0x10, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits " }, + {0x10, 0x01, 0x0f, 0x09, "1 Coin 7 Credits " }, + {0x10, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x10, 0x01, 0xf0, 0x20, "4 Coins 1 Credits " }, + {0x10, 0x01, 0xf0, 0x50, "3 Coins 1 Credits " }, + {0x10, 0x01, 0xf0, 0x80, "2 Coins 1 Credits " }, + {0x10, 0x01, 0xf0, 0x40, "3 Coins 2 Credits " }, + {0x10, 0x01, 0xf0, 0x10, "4 Coins 3 Credits " }, + {0x10, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits " }, + {0x10, 0x01, 0xf0, 0x30, "3 Coins 4 Credits " }, + {0x10, 0x01, 0xf0, 0x70, "2 Coins 3 Credits " }, + {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits " }, + {0x10, 0x01, 0xf0, 0x60, "2 Coins 5 Credits " }, + {0x10, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits " }, + {0x10, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits " }, + {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits " }, + {0x10, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits " }, + {0x10, 0x01, 0xf0, 0x90, "1 Coin 7 Credits " }, + {0x10, 0x01, 0xf0, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x11, 0x01, 0x03, 0x03, "3" }, + {0x11, 0x01, 0x03, 0x02, "4" }, + {0x11, 0x01, 0x03, 0x01, "5" }, + {0x11, 0x01, 0x03, 0x00, "255 (Cheat)" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x11, 0x01, 0x04, 0x00, "Upright" }, + {0x11, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 0, "Bonus Life" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x11, 0x01, 0x08, 0x08, "50k 120k 70k+" }, + {0x11, 0x01, 0x08, 0x00, "60k 140k 80k+" }, + + {0 , 0xfe, 0 , 8, "Difficulty" }, + {0x11, 0x01, 0x70, 0x70, "1 (Easiest)" }, + {0x11, 0x01, 0x70, 0x60, "2" }, + {0x11, 0x01, 0x70, 0x50, "3" }, + {0x11, 0x01, 0x70, 0x40, "4" }, + {0x11, 0x01, 0x70, 0x30, "5 (Average)" }, + {0x11, 0x01, 0x70, 0x20, "6" }, + {0x11, 0x01, 0x70, 0x10, "7" }, + {0x11, 0x01, 0x70, 0x00, "8 (Hardest)" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Music" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, +}; + +STDDIPINFO(Gyrussce) + +void __fastcall gyruss_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc000: // watchdog + return; + + case 0xc080: + ZetClose(); + ZetOpen(1); + ZetRaiseIrq(0xff); + ZetClose(); + ZetOpen(0); + return; + + case 0xc100: + *soundlatch = data; + return; + + case 0xc180: + *interrupt_enable0 = data; + return; + + case 0xc185: + *flipscreen = data & 1; + return; + } +} + +UINT8 __fastcall gyruss_main_read(UINT16 address) +{ + switch (address) + { + case 0xc000: + return DrvDips[1]; + + case 0xc080: + return DrvInputs[0]; + + case 0xc0a0: + return DrvInputs[1]; + + case 0xc0c0: + return DrvInputs[2]; + + case 0xc0e0: + return DrvDips[0]; + + case 0xc100: + return DrvDips[2]; + } + + return 0; +} + +void gyruss_sub_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x2000: + *interrupt_enable1 = data; + return; + } +} + +UINT8 gyruss_sub_read(UINT16 address) +{ + switch (address) + { + case 0x0000: + return (scanline & 0x7f); + } + + return 0; +} + +UINT8 __fastcall gyruss_sound0_read(UINT16 address) +{ + switch (address) + { + case 0x8000: + return *soundlatch; + } + + return 0; +} + +UINT8 __fastcall gyruss_sound0_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x01: + return AY8910Read(0); + + case 0x05: + return AY8910Read(1); + + case 0x09: + return AY8910Read(2); + + case 0x0d: + return AY8910Read(3); + + case 0x11: + return AY8910Read(4); + } + + return 0; +} + +void __fastcall gyruss_sound0_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + AY8910Write(0, 0, data); + return; + + case 0x02: + AY8910Write(0, 1, data); + return; + + case 0x04: + AY8910Write(1, 0, data); + return; + + case 0x06: + AY8910Write(1, 1, data); + return; + + case 0x08: + AY8910Write(2, 0, data); + return; + + case 0x0a: + AY8910Write(2, 1, data); + return; + + case 0x0c: + AY8910Write(3, 0, data); + return; + + case 0x0e: + AY8910Write(3, 1, data); + return; + + case 0x10: + AY8910Write(4, 0, data); + return; + + case 0x12: + AY8910Write(4, 1, data); + return; + + case 0x14: // clear i8039 irq + return; + + case 0x18: + *soundlatch2 = data; + return; + } +} + +UINT8 AY8910_3_portA(UINT32) +{ + static const INT32 gyruss_timer[10] = + { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x0a, 0x0d + }; + + return gyruss_timer[((ZetTotalCycles() * 60) >> 10) % 10]; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x010000; + DrvZ80ROM1 = Next; Next += 0x010000; + + DrvM6809ROM = Next; Next += 0x010000; + DrvM6809DecROM = Next; Next += 0x010000; + + DrvI8039ROM = Next; Next += 0x001000; + + DrvGfxROM0 = Next; Next += 0x010000; + DrvGfxROM1 = Next; Next += 0x010000; + DrvGfxROM2 = Next; Next += 0x008000; + + DrvColPROM = Next; Next += 0x000300; + + Palette = (UINT32*)Next; Next += 0x0140 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x0140 * sizeof(UINT32); + + pAY8910Buffer[ 0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[ 1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[ 2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[ 3] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[ 4] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[ 5] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[ 6] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[ 7] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[ 8] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[ 9] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[10] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[11] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[12] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[13] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[14] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + pTemp = (UINT16*)Next; Next += 0x10000 * 2; + + AllRam = Next; + + flipscreen = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + soundlatch2 = Next; Next += 0x000001; + + interrupt_enable0 = Next; Next += 0x000001; + interrupt_enable1 = Next; Next += 0x000001; + + DrvShareRAM = Next; Next += 0x000800; + DrvColRAM = Next; Next += 0x000400; + DrvVidRAM = Next; Next += 0x000400; + DrvZ80RAM0 = Next; Next += 0x001000; + DrvZ80RAM1 = Next; Next += 0x000400; + + DrvM6809RAM = Next; Next += 0x000800; + + DrvSprRAM = DrvM6809RAM + 0x000040; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x20004, 0x20000, 4, 0 }; + INT32 XOffs[8] = { 0, 1, 2, 3, 64, 65, 66, 67 }; + INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, + 32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x8000); + + GfxDecode(0x0200, 4, 8, 16, Plane , XOffs, YOffs, 0x200, tmp , DrvGfxROM0); + GfxDecode(0x0200, 4, 8, 16, Plane , XOffs, YOffs, 0x200, tmp + 0x10, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x2000); + + GfxDecode(0x0200, 2, 8, 8, Plane + 2, XOffs, YOffs, 0x080, tmp , DrvGfxROM2); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvPaletteInit() +{ + UINT8 *color_prom = DrvColPROM; + UINT32 *tmp = (UINT32*)BurnMalloc(32 * sizeof(UINT32)); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x20; i++) + { + INT32 bit0, bit1, bit2; + UINT8 r, g, b; + + bit0 = (color_prom[i] >> 0) & 0x01; + bit1 = (color_prom[i] >> 1) & 0x01; + bit2 = (color_prom[i] >> 2) & 0x01; + r = (INT32)(double((bit0 * 33 + bit1 * 70 + bit2 * 151)+0.5)); + + bit0 = (color_prom[i] >> 3) & 0x01; + bit1 = (color_prom[i] >> 4) & 0x01; + bit2 = (color_prom[i] >> 5) & 0x01; + g = (INT32)(double((bit0 * 33 + bit1 * 70 + bit2 * 151)+0.5)); + + bit0 = (color_prom[i] >> 6) & 0x01; + bit1 = (color_prom[i] >> 7) & 0x01; + b = (INT32)(double((bit0 * 78 + bit1 * 151)+0.5)); + + tmp[i] = (r << 16) | (g << 8) | b; + } + + color_prom += 32; + + for (INT32 i = 0; i < 0x140; i++) { + UINT8 ctabentry = color_prom[i] & 0x0f; + Palette[i] = tmp[ctabentry | ((i >> 4) & 0x10)]; + } + + BurnFree (tmp); + return 0; +} + +static void gyrussDecode() +{ + for (INT32 i = 0xe000; i < 0x10000; i++) + { + UINT8 xor1 = 0; + + if ( i & 0x02) xor1 |= 0x80; + else xor1 |= 0x20; + if ( i & 0x08) xor1 |= 0x08; + else xor1 |= 0x02; + + DrvM6809DecROM[i] = DrvM6809ROM[i] ^ xor1; + } +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + M6809Open(0); + M6809Reset(); + M6809Close(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + AY8910Reset(1); + AY8910Reset(2); + AY8910Reset(3); + AY8910Reset(4); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x2000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x4000, 2, 1)) return 1; + + if (BurnLoadRom(DrvM6809ROM + 0xe000, 3, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x0000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x2000, 5, 1)) return 1; + + if (BurnLoadRom(DrvI8039ROM + 0x0000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x0000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x2000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x4000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x6000, 10, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x0000, 11, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x0000, 12, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x0020, 13, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x0120, 14, 1)) return 1; + + gyrussDecode(); + DrvGfxDecode(); + DrvPaletteInit(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0x8000, 0x83ff, 0, DrvColRAM); + ZetMapArea(0x8000, 0x83ff, 1, DrvColRAM); + ZetMapArea(0x8000, 0x83ff, 2, DrvColRAM); + ZetMapArea(0x8400, 0x87ff, 0, DrvVidRAM); + ZetMapArea(0x8400, 0x87ff, 1, DrvVidRAM); + ZetMapArea(0x8400, 0x87ff, 2, DrvVidRAM); + ZetMapArea(0x9000, 0x9fff, 0, DrvZ80RAM0); + ZetMapArea(0x9000, 0x9fff, 1, DrvZ80RAM0); + ZetMapArea(0x9000, 0x9fff, 2, DrvZ80RAM0); + ZetMapArea(0xa000, 0xa7ff, 0, DrvShareRAM); + ZetMapArea(0xa000, 0xa7ff, 1, DrvShareRAM); + ZetMapArea(0xa000, 0xa7ff, 2, DrvShareRAM); + ZetSetReadHandler(gyruss_main_read); + ZetSetWriteHandler(gyruss_main_write); + ZetClose(); + + M6809Init(1); + M6809Open(0); + M6809MapMemory(DrvM6809RAM, 0x4000, 0x47ff, M6809_RAM); + M6809MapMemory(DrvShareRAM, 0x6000, 0x67ff, M6809_RAM); + M6809MapMemory(DrvM6809ROM + 0xe000, 0xe000, 0xffff, M6809_READ); + M6809MapMemory(DrvM6809DecROM + 0xe000, 0xe000, 0xffff, M6809_FETCH); + M6809SetReadHandler(gyruss_sub_read); + M6809SetWriteHandler(gyruss_sub_write); + M6809Close(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM1); + ZetMapArea(0x6000, 0x63ff, 0, DrvZ80RAM1); + ZetMapArea(0x6000, 0x63ff, 1, DrvZ80RAM1); + ZetMapArea(0x6000, 0x63ff, 2, DrvZ80RAM1); + ZetSetReadHandler(gyruss_sound0_read); + ZetSetOutHandler(gyruss_sound0_out); + ZetSetInHandler(gyruss_sound0_in); + ZetClose(); + + // don't bother with i8039 right now, descrete sounds not emulated + + AY8910Init(0, 1789773, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 1789773, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(2, 1789773, nBurnSoundRate, AY8910_3_portA, NULL, NULL, NULL); + AY8910Init(3, 1789773, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(4, 1789773, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(2, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(3, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(4, 0.25, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + ZetExit(); + M6809Exit(); + + AY8910Exit(0); + AY8910Exit(1); + AY8910Exit(2); + AY8910Exit(3); + AY8910Exit(4); + + BurnFree (AllMem); + + return 0; +} + +static void draw_background(INT32 transp) +{ + for (INT32 offs = 0x40; offs < 0x3c0; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + INT32 attr = DrvColRAM[offs]; + INT32 code = ((attr & 0x20) << 3) | DrvVidRAM[offs]; + INT32 color = attr & 0x0f; + INT32 flipx = (attr >> 6) & 1; + INT32 flipy = attr >> 7; + + INT32 group = ((~DrvColRAM[offs] >> 4) & 1); + if (transp && group == 0) continue; + + if (*flipscreen) { + flipx ^= 1; + flipy ^= 1; + sx ^= 0xf8; + sy ^= 0xf8; + } + + sy -= 16; + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 2, transp, 0x100, DrvGfxROM2); + } else { + Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 2, transp, 0x100, DrvGfxROM2); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 2, transp, 0x100, DrvGfxROM2); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 2, transp, 0x100, DrvGfxROM2); + } + } + } +} + +static void draw_8x16_tile_line(INT32 sx, INT32 sy, INT32 color, UINT8 *gfx_base, INT32 code, INT32 flipx, INT32 flipy, INT32 line) +{ + line -= 16; + + if (line < 0 || line >= nScreenHeight) return; + + INT32 y = line - sy; // right? + if (y < 0 || y >= 16) return; + + if (flipy) flipy = 0x78; + + UINT8 *src = gfx_base + (code * 0x80) + ((y << 3) ^ flipy); + color <<= 4; + + if (flipx) flipx = 0x07; + + for (INT32 x = 0; x < 8; x++, sx++) + { + INT32 pxl = src[x ^ flipx]; + + if (sx < 0 || sx >= nScreenWidth || !pxl) continue; + + pTransDraw[(line * nScreenWidth) + sx] = pxl | color; + } +} + +static void draw_sprites(INT32 line) +{ + for (INT32 offs = 0xbc; offs >= 0; offs -= 4) + { + INT32 sx = DrvSprRAM[offs]; + INT32 sy = (241 - DrvSprRAM[offs + 3]); + + if (sy <= (line-16) || sy >= (line+16)) continue; + + INT32 bank = DrvSprRAM[offs + 1] & 0x01; + INT32 code = ((DrvSprRAM[offs + 2] & 0x20) << 2) | (DrvSprRAM[offs + 1] >> 1); + INT32 color = DrvSprRAM[offs + 2] & 0x0f; + INT32 flipx = ~DrvSprRAM[offs + 2] & 0x40; + INT32 flipy = DrvSprRAM[offs + 2] & 0x80; + + UINT8 *gfx_base = bank ? DrvGfxROM1 : DrvGfxROM0; + + draw_8x16_tile_line(sx, sy-16, color, gfx_base, code, flipx, flipy, line); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x140; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + BurnTransferClear(); + + draw_background(0); + +// draw_background(0x0f); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 5; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + ZetNewFrame(); + + INT32 nCyclesSegment; + INT32 nInterleave = 256; + INT32 nCyclesTotal[4] = { 3072000 / 60, 2000000 / 60, 3579545 / 60, 8000000 / 60 }; + INT32 nCyclesDone[4] = { 0, 0, 0, 0 }; + + DrvDraw(); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nNext; + scanline = i; + + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[0]; + nCyclesDone[0] += ZetRun(nCyclesSegment); + if (i == (nInterleave - 1) && *interrupt_enable0) { + ZetNmi(); + } + + M6809Open(0); + nNext = (i + 1) * nCyclesTotal[1] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[1]; + nCyclesDone[1] += M6809Run(nCyclesSegment); + if (i == (nInterleave - 1) && *interrupt_enable1) { + M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); + } + M6809Close(); + ZetClose(); + + ZetOpen(1); + nNext = (i + 1) * nCyclesTotal[2] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[2]; + nCyclesDone[2] += ZetRun(nCyclesSegment); + ZetClose(); + + draw_sprites(scanline); + } + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + BurnTransferCopy(DrvPalette); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029704; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + M6809Scan(nAction); + + AY8910Scan(nAction, pnMin); + } + + return 0; +} + + +// Gyruss (Konami) + +static struct BurnRomInfo gyrussRomDesc[] = { + { "gyrussk.1", 0x2000, 0xc673b43d, 1 | BRF_PRG | BRF_ESS }, // 0 Main Z80 Code + { "gyrussk.2", 0x2000, 0xa4ec03e4, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gyrussk.3", 0x2000, 0x27454a98, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "gyrussk.9", 0x2000, 0x822bf27e, 2 | BRF_PRG | BRF_ESS }, // 3 Sub M6809 Code + + { "gyrussk.1a", 0x2000, 0xf4ae1c17, 3 | BRF_PRG | BRF_ESS }, // 4 Audio Z80 Code + { "gyrussk.2a", 0x2000, 0xba498115, 3 | BRF_PRG | BRF_ESS }, // 5 + + { "gyrussk.3a", 0x1000, 0x3f9b5dea, 4 | BRF_PRG | BRF_ESS }, // 6 Audio i8039 + + { "gyrussk.6", 0x2000, 0xc949db10, 5 | BRF_GRA }, // 7 Sprites + { "gyrussk.5", 0x2000, 0x4f22411a, 5 | BRF_GRA }, // 8 + { "gyrussk.8", 0x2000, 0x47cd1fbc, 5 | BRF_GRA }, // 9 + { "gyrussk.7", 0x2000, 0x8e8d388c, 5 | BRF_GRA }, // 10 + + { "gyrussk.4", 0x2000, 0x27d8329b, 6 | BRF_GRA }, // 11 Background Tiles + + { "gyrussk.pr3", 0x0020, 0x98782db3, 7 | BRF_GRA }, // 12 Color Proms + { "gyrussk.pr1", 0x0100, 0x7ed057de, 7 | BRF_GRA }, // 13 + { "gyrussk.pr2", 0x0100, 0xde823a81, 7 | BRF_GRA }, // 14 +}; + +STD_ROM_PICK(gyruss) +STD_ROM_FN(gyruss) + +struct BurnDriver BurnDrvGyruss = { + "gyruss", NULL, NULL, NULL, "1983", + "Gyruss (Konami)\0", NULL, "Konami", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, gyrussRomInfo, gyrussRomName, NULL, NULL, GyrussInputInfo, GyrussDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x140, + 224, 256, 3, 4 +}; + + +// Gyruss (Centuri) + +static struct BurnRomInfo gyrussceRomDesc[] = { + { "gya-1.bin", 0x2000, 0x85f8b7c2, 1 | BRF_PRG | BRF_ESS }, // 0 Main Z80 Code + { "gya-2.bin", 0x2000, 0x1e1a970f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gya-3.bin", 0x2000, 0xf6dbb33b, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "gyrussk.9", 0x2000, 0x822bf27e, 2 | BRF_PRG | BRF_ESS }, // 3 Sub M6809 Code + + { "gyrussk.1a", 0x2000, 0xf4ae1c17, 3 | BRF_PRG | BRF_ESS }, // 4 Audio Z80 Code + { "gyrussk.2a", 0x2000, 0xba498115, 3 | BRF_PRG | BRF_ESS }, // 5 + + { "gyrussk.3a", 0x1000, 0x3f9b5dea, 4 | BRF_PRG | BRF_ESS }, // 6 Audio i8039 + + { "gyrussk.6", 0x2000, 0xc949db10, 5 | BRF_GRA }, // 7 Sprites + { "gyrussk.5", 0x2000, 0x4f22411a, 5 | BRF_GRA }, // 8 + { "gyrussk.8", 0x2000, 0x47cd1fbc, 5 | BRF_GRA }, // 9 + { "gyrussk.7", 0x2000, 0x8e8d388c, 5 | BRF_GRA }, // 10 + + { "gyrussk.4", 0x2000, 0x27d8329b, 6 | BRF_GRA }, // 11 Background Tiles + + { "gyrussk.pr3", 0x0020, 0x98782db3, 7 | BRF_GRA }, // 12 Color Proms + { "gyrussk.pr1", 0x0100, 0x7ed057de, 7 | BRF_GRA }, // 13 + { "gyrussk.pr2", 0x0100, 0xde823a81, 7 | BRF_GRA }, // 14 +}; + +STD_ROM_PICK(gyrussce) +STD_ROM_FN(gyrussce) + +struct BurnDriver BurnDrvGyrussce = { + "gyrussce", "gyruss", NULL, NULL, "1983", + "Gyruss (Centuri)\0", NULL, "Konami (Centuri license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, gyrussceRomInfo, gyrussceRomName, NULL, NULL, GyrussInputInfo, GyrussceDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x140, + 224, 256, 3, 4 +}; + + +// Gyruss (bootleg) + +static struct BurnRomInfo gyrussbRomDesc[] = { + { "1.bin", 0x2000, 0x6bc21c10, 1 | BRF_PRG | BRF_ESS }, // 0 Main Z80 Code + { "gyrussk.2", 0x2000, 0xa4ec03e4, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gyrussk.3", 0x2000, 0x27454a98, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "gyrussk.9", 0x2000, 0x822bf27e, 2 | BRF_PRG | BRF_ESS }, // 3 Sub M6809 Code + + { "gyrussk.1a", 0x2000, 0xf4ae1c17, 3 | BRF_PRG | BRF_ESS }, // 4 Audio Z80 Code + { "gyrussk.2a", 0x2000, 0xba498115, 3 | BRF_PRG | BRF_ESS }, // 5 + + { "gyrussk.3a", 0x1000, 0x3f9b5dea, 4 | BRF_PRG | BRF_ESS }, // 6 Audio i8039 + + { "gyrussk.6", 0x2000, 0xc949db10, 5 | BRF_GRA }, // 7 Sprites + { "gyrussk.5", 0x2000, 0x4f22411a, 5 | BRF_GRA }, // 8 + { "gyrussk.8", 0x2000, 0x47cd1fbc, 5 | BRF_GRA }, // 9 + { "gyrussk.7", 0x2000, 0x8e8d388c, 5 | BRF_GRA }, // 10 + + { "gyrussk.4", 0x2000, 0x27d8329b, 6 | BRF_GRA }, // 11 Background Tiles + + { "gyrussk.pr3", 0x0020, 0x98782db3, 7 | BRF_GRA }, // 12 Color Proms + { "gyrussk.pr1", 0x0100, 0x7ed057de, 7 | BRF_GRA }, // 13 + { "gyrussk.pr2", 0x0100, 0xde823a81, 7 | BRF_GRA }, // 14 +}; + +STD_ROM_PICK(gyrussb) +STD_ROM_FN(gyrussb) + +struct BurnDriver BurnDrvGyrussb = { + "gyrussb", "gyruss", NULL, NULL, "1983", + "Gyruss (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, gyrussbRomInfo, gyrussbRomName, NULL, NULL, GyrussInputInfo, GyrussDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x140, + 224, 256, 3, 4 +}; + + +// Venus + +static struct BurnRomInfo venusRomDesc[] = { + { "r1", 0x2000, 0xd030abb1, 1 | BRF_PRG | BRF_ESS }, // 0 Main Z80 Code + { "r2", 0x2000, 0xdbf65d4d, 1 | BRF_PRG | BRF_ESS }, // 1 + { "r3", 0x2000, 0xdb246fcd, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "gyrussk.9", 0x2000, 0x822bf27e, 2 | BRF_PRG | BRF_ESS }, // 3 Sub M6809 Code + + { "gyrussk.1a", 0x2000, 0xf4ae1c17, 3 | BRF_PRG | BRF_ESS }, // 4 Audio Z80 Code + { "gyrussk.2a", 0x2000, 0xba498115, 3 | BRF_PRG | BRF_ESS }, // 5 + + { "gyrussk.3a", 0x1000, 0x3f9b5dea, 4 | BRF_PRG | BRF_ESS }, // 6 Audio i8039 + + { "gyrussk.6", 0x2000, 0xc949db10, 5 | BRF_GRA }, // 7 Sprites + { "gyrussk.5", 0x2000, 0x4f22411a, 5 | BRF_GRA }, // 8 + { "gyrussk.8", 0x2000, 0x47cd1fbc, 5 | BRF_GRA }, // 9 + { "gyrussk.7", 0x2000, 0x8e8d388c, 5 | BRF_GRA }, // 10 + + { "gyrussk.4", 0x2000, 0x27d8329b, 6 | BRF_GRA }, // 11 Background Tiles + + { "gyrussk.pr3", 0x0020, 0x98782db3, 7 | BRF_GRA }, // 12 Color Proms + { "gyrussk.pr1", 0x0100, 0x7ed057de, 7 | BRF_GRA }, // 13 + { "gyrussk.pr2", 0x0100, 0xde823a81, 7 | BRF_GRA }, // 14 +}; + +STD_ROM_PICK(venus) +STD_ROM_FN(venus) + +struct BurnDriver BurnDrvVenus = { + "venus", "gyruss", NULL, NULL, "1983", + "Venus\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, venusRomInfo, venusRomName, NULL, NULL, GyrussInputInfo, GyrussDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x140, + 224, 256, 3, 4 +}; + diff --git a/src/burn/drv/konami/d_hexion.cpp b/src/burn/drv/konami/d_hexion.cpp index 46a463a88..f56c3ba00 100644 --- a/src/burn/drv/konami/d_hexion.cpp +++ b/src/burn/drv/konami/d_hexion.cpp @@ -1,618 +1,617 @@ -// FB Alpha Hexion driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "k051649.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *AllRam; -static UINT8 *MemEnd; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM; -static UINT8 *DrvGfxROMExp; -static UINT8 *DrvSndROM; -static UINT8 *DrvColPROM; -static UINT8 *DrvUnkRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *flipscreen; - -static UINT32 *DrvPalette; -static UINT32 *Palette; -static UINT8 DrvRecalc; - -static INT32 cpubank; -static INT32 bankctrl; -static INT32 rambank; -static INT32 pmcbank; -static INT32 gfxrom_select; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo HexionInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Hexion) - -static struct BurnDIPInfo HexionDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x4f, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x12, 0x01, 0xf0, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Difficulty" }, - {0x13, 0x01, 0x70, 0x70, "Easiest" }, - {0x13, 0x01, 0x70, 0x60, "Very Easy" }, - {0x13, 0x01, 0x70, 0x50, "Easy" }, - {0x13, 0x01, 0x70, 0x40, "Medium" }, - {0x13, 0x01, 0x70, 0x30, "Medium Hard" }, - {0x13, 0x01, 0x70, 0x20, "Hard" }, - {0x13, 0x01, 0x70, 0x10, "Very Hard" }, - {0x13, 0x01, 0x70, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Hexion) - -static void bankswitch(INT32 data) -{ - cpubank = data & 0x0f; - - ZetMapArea(0x8000, 0x9fff, 0, DrvZ80ROM + (cpubank << 13)); - ZetMapArea(0x8000, 0x9fff, 2, DrvZ80ROM + (cpubank << 13)); -} - -void __fastcall hexion_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xdfff: - bankctrl = data; - return; - - case 0xf200: - MSM6295Command(0, data); - return; - - case 0xf480: - { - if (data & 0x40) { - memset (DrvVidRAM + ((DrvUnkRAM[0] & 1) << 13), DrvUnkRAM[1], 0x2000); - } - - pmcbank = data & 0x80; - - bankswitch(data); - } - return; - - case 0xf4c0: - *flipscreen = data & 0x20; - return; - - case 0xf500: - gfxrom_select = data; - return; - } - - if ((address & 0xe000) == 0xc000) { - if (bankctrl == 3 && address == 0xc000 && (data & 0xfe) == 0) { - rambank = data & 1; - return; - } - if (pmcbank) { - if (bankctrl == 0) { - DrvVidRAM[(rambank << 13) + (address & 0x1fff)] = data; - return; - } - if (bankctrl == 2 && address < 0xc800) { - DrvUnkRAM[address & 0x7ff] = data; - return; - } - } - return; - } - - if ((address & 0xff80) == 0xe800) { - K051649WaveformWrite(address & 0x7f, data); - return; - } - - if ((address & 0xfff0) == 0xe880) { - if (address <= 0xe889) { - K051649FrequencyWrite(address & 0x0f, data); - return; - } - - if (address == 0xe88f) { - K051649KeyonoffWrite(data); - return; - } - - if (address >= 0xe88a) { - K051649VolumeWrite(address - 0xe88a, data); - return; - } - - return; - } -} - -UINT8 __fastcall hexion_read(UINT16 address) -{ - switch (address) - { - case 0xf400: - return DrvDips[0]; - - case 0xf401: - return DrvDips[1]; - - case 0xf402: - return DrvInputs[0]; - - case 0xf403: - return DrvInputs[1]; - - case 0xf440: - return DrvDips[2]; - - case 0xf441: - return DrvInputs[2] & 0xf7; - - case 0xf540: - return 0; // watchdog - } - - if ((address & 0xe000) == 0xc000) { - if (gfxrom_select && address < 0xd000) - return DrvGfxROM[((gfxrom_select & 0x7f) << 12) + (address & 0xfff)]; - - if (bankctrl == 0) - return DrvVidRAM[(rambank << 13) + (address & 0x1fff)]; - - if (bankctrl == 2 && address < 0xd800) - return DrvUnkRAM[address & 0x7ff]; - - return 0; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - bankswitch(4); - ZetClose(); - - K051649Reset(); - - cpubank = 0; - bankctrl = 0; - rambank = 0; - pmcbank = 0; - gfxrom_select = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x020000; - - DrvGfxROM = Next; Next += 0x080000; - DrvGfxROMExp = Next; Next += 0x100000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x040000; - - DrvColPROM = Next; Next += 0x000300; - - DrvPalette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); - Palette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); - - AllRam = Next; - - DrvUnkRAM = Next; Next += 0x000800; - DrvVidRAM = Next; Next += 0x006000; - DrvZ80RAM = Next; Next += 0x002000; - - flipscreen = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x000000, 0x000001, 0x000002, 0x000003 }; - INT32 XOffs[8] = { 0x200000, 0x200004, 0x000000, 0x000004, 0x200008, 0x20000c, 0x000008, 0x00000c }; - INT32 YOffs[8] = { 0x000000, 0x000010, 0x000020, 0x000030, 0x000040, 0x000050, 0x000060, 0x000070 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x80000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM, 0x80000); - - GfxDecode(0x4000, 4, 8, 8, Plane, XOffs, YOffs, 0x080, tmp, DrvGfxROMExp); - - BurnFree (tmp); - - return 0; -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0; i < 0x100; i++) - { - INT32 bit0,bit1,bit2,bit3,r,g,b; - - bit0 = (DrvColPROM[i + 0x000] >> 0) & 0x01; - bit1 = (DrvColPROM[i + 0x000] >> 1) & 0x01; - bit2 = (DrvColPROM[i + 0x000] >> 2) & 0x01; - bit3 = (DrvColPROM[i + 0x000] >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvColPROM[i + 0x100] >> 0) & 0x01; - bit1 = (DrvColPROM[i + 0x100] >> 1) & 0x01; - bit2 = (DrvColPROM[i + 0x100] >> 2) & 0x01; - bit3 = (DrvColPROM[i + 0x100] >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvColPROM[i + 0x200] >> 0) & 0x01; - bit1 = (DrvColPROM[i + 0x200] >> 1) & 0x01; - bit2 = (DrvColPROM[i + 0x200] >> 2) & 0x01; - bit3 = (DrvColPROM[i + 0x200] >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - Palette[i] = (r << 16) | (g << 8) | b; - } -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM, 0, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM, 1, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x40000, 2, 1)) return 1; - - if (BurnLoadRom(DrvSndROM, 3, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x000, 4, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x100, 5, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x200, 6, 1)) return 1; - - DrvGfxDecode(); - DrvPaletteInit(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xa000, 0xbfff, 0, DrvZ80RAM); - ZetMapArea(0xa000, 0xbfff, 1, DrvZ80RAM); - ZetMapArea(0xa000, 0xbfff, 2, DrvZ80RAM); - ZetSetWriteHandler(hexion_write); - ZetSetReadHandler(hexion_read); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 1056000 / 132, 0); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - K051649Init(1500000); - K051649SetRoute(0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - MSM6295Exit(0); - K051649Exit(); - - ZetExit(); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - return 0; -} - -static void draw_layer(INT32 offset, INT32 transparent, INT32 pos) -{ - UINT8 *vram = DrvVidRAM + offset; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - INT32 code = vram[0] | ((vram[1] & 0x3f) << 8); - INT32 color = vram[2] & 0x0f; - vram += 4; - - if (*flipscreen) { - sx ^= 0x1f8; - sy ^= 0x0f8; - - if (transparent) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx-pos, sy+pos, color, 4, 0, 0, DrvGfxROMExp); - } else { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx-pos, sy+pos, color, 4, 0, DrvGfxROMExp); - } - - // wrap - if (pos == 0) continue; - if (sx == 0) Render8x8Tile_Clip(pTransDraw, code, sx + 508, sy, color, 4, 0, DrvGfxROMExp); - if (sy == 252) Render8x8Tile_Clip(pTransDraw, code, sx, sy - 256, color, 4, 0, DrvGfxROMExp); - } else { - if (transparent) { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx+pos, sy-pos, color, 4, 0, 0, DrvGfxROMExp); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx+pos, sy-pos, color, 4, 0, DrvGfxROMExp); - } - - // wrap - if (pos == 0) continue; - if (sy == 0) Render8x8Tile_Clip(pTransDraw, code, sx, sy + 252, color, 4, 0, DrvGfxROMExp); - if (sx == 504) Render8x8Tile_Clip(pTransDraw, code, sx - 508, sy, color, 4, 0, DrvGfxROMExp); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x100; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - draw_layer(0x2000, 0, 4); - draw_layer(0x0000, 1, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = nBurnSoundLen; - INT32 nSoundBufferPos = 0; - - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; - if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - } - - ZetNewFrame(); - - INT32 nCyclesTotal[1] = { 6000000 / 60 }; - INT32 nCyclesDone[1] = { 0 }; - - ZetOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext, nCyclesSegment; - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[0]; - nCyclesSegment = ZetRun(nCyclesSegment); - if (i == (nInterleave / 3)) ZetNmi(); - if (i == ((nInterleave / 3) * 2)) ZetNmi(); - if (i == nInterleave - 1) ZetRaiseIrq(0); - nCyclesDone[0] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - MSM6295Render(0, pSoundBuf, nSegmentLength); - K051649Update(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - MSM6295Render(0, pSoundBuf, nSegmentLength); - K051649Update(pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029705; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - - MSM6295Scan(0, nAction); - K051649Scan(nAction, pnMin); - - SCAN_VAR(cpubank); - SCAN_VAR(bankctrl); - SCAN_VAR(rambank); - SCAN_VAR(pmcbank); - SCAN_VAR(gfxrom_select); - } - - ZetOpen(0); - bankswitch(cpubank); - ZetClose(); - - return 0; -} - - -// Hexion (Japan ver. JAB) - -static struct BurnRomInfo hexionRomDesc[] = { - { "122jab01.bin", 0x20000, 0xeabc6dd1, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - - { "122a07.bin", 0x40000, 0x22ae55e3, 2 | BRF_GRA }, // 1 Tiles - { "122a06.bin", 0x40000, 0x438f4388, 2 | BRF_GRA }, // 2 - - { "122a05.bin", 0x40000, 0xbcc831bf, 3 | BRF_SND }, // 3 M6296 Samples - - { "122a04.10b", 0x00100, 0x506eb8c6, 4 | BRF_GRA }, // 4 Color PROMs - { "122a03.11b", 0x00100, 0x590c4f64, 4 | BRF_GRA }, // 5 - { "122a02.13b", 0x00100, 0x5734305c, 4 | BRF_GRA }, // 6 -}; - -STD_ROM_PICK(hexion) -STD_ROM_FN(hexion) - -struct BurnDriver BurnDrvHexion = { - "hexion", NULL, NULL, NULL, "1992", - "Hexion (Japan ver. JAB)\0", NULL, "Konami", "GX122", - L"Hexion\0\u30D8\u30AF\u30B7\u30AA\u30F3 (Japan ver. JAB)\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_PUZZLE, 0, - NULL, hexionRomInfo, hexionRomName, NULL, NULL, HexionInputInfo, HexionDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 512, 256, 4, 3 -}; +// FB Alpha Hexion driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "k051649.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *AllRam; +static UINT8 *MemEnd; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM; +static UINT8 *DrvGfxROMExp; +static UINT8 *DrvSndROM; +static UINT8 *DrvColPROM; +static UINT8 *DrvUnkRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *flipscreen; + +static UINT32 *DrvPalette; +static UINT32 *Palette; +static UINT8 DrvRecalc; + +static INT32 cpubank; +static INT32 bankctrl; +static INT32 rambank; +static INT32 pmcbank; +static INT32 gfxrom_select; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo HexionInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Hexion) + +static struct BurnDIPInfo HexionDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x4f, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x12, 0x01, 0xf0, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Difficulty" }, + {0x13, 0x01, 0x70, 0x70, "Easiest" }, + {0x13, 0x01, 0x70, 0x60, "Very Easy" }, + {0x13, 0x01, 0x70, 0x50, "Easy" }, + {0x13, 0x01, 0x70, 0x40, "Medium" }, + {0x13, 0x01, 0x70, 0x30, "Medium Hard" }, + {0x13, 0x01, 0x70, 0x20, "Hard" }, + {0x13, 0x01, 0x70, 0x10, "Very Hard" }, + {0x13, 0x01, 0x70, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Hexion) + +static void bankswitch(INT32 data) +{ + cpubank = data & 0x0f; + + ZetMapArea(0x8000, 0x9fff, 0, DrvZ80ROM + (cpubank << 13)); + ZetMapArea(0x8000, 0x9fff, 2, DrvZ80ROM + (cpubank << 13)); +} + +void __fastcall hexion_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xdfff: + bankctrl = data; + return; + + case 0xf200: + MSM6295Command(0, data); + return; + + case 0xf480: + { + if (data & 0x40) { + memset (DrvVidRAM + ((DrvUnkRAM[0] & 1) << 13), DrvUnkRAM[1], 0x2000); + } + + pmcbank = data & 0x80; + + bankswitch(data); + } + return; + + case 0xf4c0: + *flipscreen = data & 0x20; + return; + + case 0xf500: + gfxrom_select = data; + return; + } + + if ((address & 0xe000) == 0xc000) { + if (bankctrl == 3 && address == 0xc000 && (data & 0xfe) == 0) { + rambank = data & 1; + return; + } + if (pmcbank) { + if (bankctrl == 0) { + DrvVidRAM[(rambank << 13) + (address & 0x1fff)] = data; + return; + } + if (bankctrl == 2 && address < 0xc800) { + DrvUnkRAM[address & 0x7ff] = data; + return; + } + } + return; + } + + if ((address & 0xff80) == 0xe800) { + K051649WaveformWrite(address & 0x7f, data); + return; + } + + if ((address & 0xfff0) == 0xe880) { + if (address <= 0xe889) { + K051649FrequencyWrite(address & 0x0f, data); + return; + } + + if (address == 0xe88f) { + K051649KeyonoffWrite(data); + return; + } + + if (address >= 0xe88a) { + K051649VolumeWrite(address - 0xe88a, data); + return; + } + + return; + } +} + +UINT8 __fastcall hexion_read(UINT16 address) +{ + switch (address) + { + case 0xf400: + return DrvDips[0]; + + case 0xf401: + return DrvDips[1]; + + case 0xf402: + return DrvInputs[0]; + + case 0xf403: + return DrvInputs[1]; + + case 0xf440: + return DrvDips[2]; + + case 0xf441: + return DrvInputs[2] & 0xf7; + + case 0xf540: + return 0; // watchdog + } + + if ((address & 0xe000) == 0xc000) { + if (gfxrom_select && address < 0xd000) + return DrvGfxROM[((gfxrom_select & 0x7f) << 12) + (address & 0xfff)]; + + if (bankctrl == 0) + return DrvVidRAM[(rambank << 13) + (address & 0x1fff)]; + + if (bankctrl == 2 && address < 0xd800) + return DrvUnkRAM[address & 0x7ff]; + + return 0; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + bankswitch(4); + ZetClose(); + + K051649Reset(); + + cpubank = 0; + bankctrl = 0; + rambank = 0; + pmcbank = 0; + gfxrom_select = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x020000; + + DrvGfxROM = Next; Next += 0x080000; + DrvGfxROMExp = Next; Next += 0x100000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x040000; + + DrvColPROM = Next; Next += 0x000300; + + DrvPalette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); + Palette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); + + AllRam = Next; + + DrvUnkRAM = Next; Next += 0x000800; + DrvVidRAM = Next; Next += 0x006000; + DrvZ80RAM = Next; Next += 0x002000; + + flipscreen = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x000000, 0x000001, 0x000002, 0x000003 }; + INT32 XOffs[8] = { 0x200000, 0x200004, 0x000000, 0x000004, 0x200008, 0x20000c, 0x000008, 0x00000c }; + INT32 YOffs[8] = { 0x000000, 0x000010, 0x000020, 0x000030, 0x000040, 0x000050, 0x000060, 0x000070 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x80000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM, 0x80000); + + GfxDecode(0x4000, 4, 8, 8, Plane, XOffs, YOffs, 0x080, tmp, DrvGfxROMExp); + + BurnFree (tmp); + + return 0; +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0; i < 0x100; i++) + { + INT32 bit0,bit1,bit2,bit3,r,g,b; + + bit0 = (DrvColPROM[i + 0x000] >> 0) & 0x01; + bit1 = (DrvColPROM[i + 0x000] >> 1) & 0x01; + bit2 = (DrvColPROM[i + 0x000] >> 2) & 0x01; + bit3 = (DrvColPROM[i + 0x000] >> 3) & 0x01; + r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvColPROM[i + 0x100] >> 0) & 0x01; + bit1 = (DrvColPROM[i + 0x100] >> 1) & 0x01; + bit2 = (DrvColPROM[i + 0x100] >> 2) & 0x01; + bit3 = (DrvColPROM[i + 0x100] >> 3) & 0x01; + g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvColPROM[i + 0x200] >> 0) & 0x01; + bit1 = (DrvColPROM[i + 0x200] >> 1) & 0x01; + bit2 = (DrvColPROM[i + 0x200] >> 2) & 0x01; + bit3 = (DrvColPROM[i + 0x200] >> 3) & 0x01; + b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + Palette[i] = (r << 16) | (g << 8) | b; + } +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM, 0, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM, 1, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x40000, 2, 1)) return 1; + + if (BurnLoadRom(DrvSndROM, 3, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x000, 4, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x100, 5, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x200, 6, 1)) return 1; + + DrvGfxDecode(); + DrvPaletteInit(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xa000, 0xbfff, 0, DrvZ80RAM); + ZetMapArea(0xa000, 0xbfff, 1, DrvZ80RAM); + ZetMapArea(0xa000, 0xbfff, 2, DrvZ80RAM); + ZetSetWriteHandler(hexion_write); + ZetSetReadHandler(hexion_read); + ZetClose(); + + MSM6295Init(0, 1056000 / 132, 0); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + K051649Init(1500000); + K051649SetRoute(0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + MSM6295Exit(0); + K051649Exit(); + + ZetExit(); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + return 0; +} + +static void draw_layer(INT32 offset, INT32 transparent, INT32 pos) +{ + UINT8 *vram = DrvVidRAM + offset; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + INT32 code = vram[0] | ((vram[1] & 0x3f) << 8); + INT32 color = vram[2] & 0x0f; + vram += 4; + + if (*flipscreen) { + sx ^= 0x1f8; + sy ^= 0x0f8; + + if (transparent) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx-pos, sy+pos, color, 4, 0, 0, DrvGfxROMExp); + } else { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx-pos, sy+pos, color, 4, 0, DrvGfxROMExp); + } + + // wrap + if (pos == 0) continue; + if (sx == 0) Render8x8Tile_Clip(pTransDraw, code, sx + 508, sy, color, 4, 0, DrvGfxROMExp); + if (sy == 252) Render8x8Tile_Clip(pTransDraw, code, sx, sy - 256, color, 4, 0, DrvGfxROMExp); + } else { + if (transparent) { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx+pos, sy-pos, color, 4, 0, 0, DrvGfxROMExp); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx+pos, sy-pos, color, 4, 0, DrvGfxROMExp); + } + + // wrap + if (pos == 0) continue; + if (sy == 0) Render8x8Tile_Clip(pTransDraw, code, sx, sy + 252, color, 4, 0, DrvGfxROMExp); + if (sx == 504) Render8x8Tile_Clip(pTransDraw, code, sx - 508, sy, color, 4, 0, DrvGfxROMExp); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x100; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + draw_layer(0x2000, 0, 4); + draw_layer(0x0000, 1, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = nBurnSoundLen; + INT32 nSoundBufferPos = 0; + + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; + if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + } + + ZetNewFrame(); + + INT32 nCyclesTotal[1] = { 6000000 / 60 }; + INT32 nCyclesDone[1] = { 0 }; + + ZetOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext, nCyclesSegment; + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[0]; + nCyclesSegment = ZetRun(nCyclesSegment); + if (i == (nInterleave / 3)) ZetNmi(); + if (i == ((nInterleave / 3) * 2)) ZetNmi(); + if (i == nInterleave - 1) ZetRaiseIrq(0); + nCyclesDone[0] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + MSM6295Render(0, pSoundBuf, nSegmentLength); + K051649Update(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + MSM6295Render(0, pSoundBuf, nSegmentLength); + K051649Update(pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029705; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + + MSM6295Scan(0, nAction); + K051649Scan(nAction, pnMin); + + SCAN_VAR(cpubank); + SCAN_VAR(bankctrl); + SCAN_VAR(rambank); + SCAN_VAR(pmcbank); + SCAN_VAR(gfxrom_select); + } + + ZetOpen(0); + bankswitch(cpubank); + ZetClose(); + + return 0; +} + + +// Hexion (Japan ver. JAB) + +static struct BurnRomInfo hexionRomDesc[] = { + { "122jab01.bin", 0x20000, 0xeabc6dd1, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + + { "122a07.bin", 0x40000, 0x22ae55e3, 2 | BRF_GRA }, // 1 Tiles + { "122a06.bin", 0x40000, 0x438f4388, 2 | BRF_GRA }, // 2 + + { "122a05.bin", 0x40000, 0xbcc831bf, 3 | BRF_SND }, // 3 M6296 Samples + + { "122a04.10b", 0x00100, 0x506eb8c6, 4 | BRF_GRA }, // 4 Color PROMs + { "122a03.11b", 0x00100, 0x590c4f64, 4 | BRF_GRA }, // 5 + { "122a02.13b", 0x00100, 0x5734305c, 4 | BRF_GRA }, // 6 +}; + +STD_ROM_PICK(hexion) +STD_ROM_FN(hexion) + +struct BurnDriver BurnDrvHexion = { + "hexion", NULL, NULL, NULL, "1992", + "Hexion (Japan ver. JAB)\0", NULL, "Konami", "GX122", + L"Hexion\0\u30D8\u30AF\u30B7\u30AA\u30F3 (Japan ver. JAB)\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_PUZZLE, 0, + NULL, hexionRomInfo, hexionRomName, NULL, NULL, HexionInputInfo, HexionDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 512, 256, 4, 3 +}; diff --git a/src/burn/drv/konami/d_kontest.cpp b/src/burn/drv/konami/d_kontest.cpp index a976130ac..d24deb77f 100644 --- a/src/burn/drv/konami/d_kontest.cpp +++ b/src/burn/drv/konami/d_kontest.cpp @@ -212,7 +212,6 @@ static INT32 DrvInit() ZetSetWriteHandler(kontest_write); ZetSetOutHandler(kontest_write_port); ZetSetInHandler(kontest_read_port); - ZetMemEnd(); ZetClose(); SN76489AInit(0, 1500000, 0); diff --git a/src/burn/drv/konami/d_mainevt.cpp b/src/burn/drv/konami/d_mainevt.cpp index d555d0f15..be8c986b9 100644 --- a/src/burn/drv/konami/d_mainevt.cpp +++ b/src/burn/drv/konami/d_mainevt.cpp @@ -1,1252 +1,1251 @@ -// FB Alpha The Main Event / Devastators driver module -// Based on MAME driver by Bryan McPhail - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "hd6309_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" -#include "upd7759.h" -#include "k007232.h" - -static UINT8 *AllMem; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *DrvHD6309ROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *DrvHD6309RAM; -static UINT8 *DrvZ80RAM; -static UINT8 *soundlatch; -static UINT8 *irq_enable; -static UINT8 *nmi_enable; - -static UINT8 *nDrvBank; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[5]; -static UINT8 DrvReset; - -static INT32 nGame; - -static struct BurnInputInfo MainevtInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 2" }, - - {"P3 Coin", BIT_DIGITAL, DrvJoy1 + 2, "p3 coin" }, - {"P3 Up", BIT_DIGITAL, DrvJoy4 + 2, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy4 + 3, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy4 + 0, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy4 + 1, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 5, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 4, "p3 fire 2" }, - - {"P4 Coin", BIT_DIGITAL, DrvJoy1 + 3, "p4 coin" }, - {"P4 Up", BIT_DIGITAL, DrvJoy5 + 2, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvJoy5 + 3, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvJoy5 + 0, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvJoy5 + 1, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy5 + 5, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy5 + 4, "p4 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service 1", BIT_DIGITAL, DrvJoy1 + 4, "service" }, - {"Service 2", BIT_DIGITAL, DrvJoy1 + 5, "service2" }, - {"Service 3", BIT_DIGITAL, DrvJoy1 + 6, "service3" }, - {"Service 4", BIT_DIGITAL, DrvJoy1 + 7, "service4" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Mainevt) - -static struct BurnInputInfo Mainevt2pInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service 1", BIT_DIGITAL, DrvJoy1 + 4, "service" }, - {"Service 2", BIT_DIGITAL, DrvJoy1 + 5, "service2" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Mainevt2p) - -static struct BurnInputInfo DevstorsInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 4, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Devstors) - -static struct BurnDIPInfo MainevtDIPList[]= -{ - {0x21, 0xff, 0xff, 0xff, NULL }, - {0x22, 0xff, 0xff, 0x57, NULL }, - {0x23, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x21, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x21, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x21, 0x01, 0x0f, 0x00, "4 Coins 5 Credits" }, - {0x21, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x21, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x21, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x21, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x21, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x21, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x21, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Bonus Energy" }, - {0x22, 0x01, 0x18, 0x00, "60" }, - {0x22, 0x01, 0x18, 0x08, "70" }, - {0x22, 0x01, 0x18, 0x10, "80" }, - {0x22, 0x01, 0x18, 0x18, "90" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x22, 0x01, 0x60, 0x60, "Easy" }, - {0x22, 0x01, 0x60, 0x40, "Normal" }, - {0x22, 0x01, 0x60, 0x20, "Hard" }, - {0x22, 0x01, 0x60, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x22, 0x01, 0x80, 0x80, "Off" }, - {0x22, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x23, 0x01, 0x01, 0x01, "Off" }, - {0x23, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x23, 0x01, 0x04, 0x04, "Off" }, - {0x23, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Mainevt) - -static struct BurnDIPInfo Mainevt2pDIPList[]= -{ - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0x57, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0f, 0x00, "4 Coins 5 Credits" }, - {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xf0, 0x00, "4 Coins 5 Credits" }, - {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Bonus Energy" }, - {0x16, 0x01, 0x18, 0x00, "60" }, - {0x16, 0x01, 0x18, 0x08, "70" }, - {0x16, 0x01, 0x18, 0x10, "80" }, - {0x16, 0x01, 0x18, 0x18, "90" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x60, 0x60, "Easy" }, - {0x16, 0x01, 0x60, 0x40, "Normal" }, - {0x16, 0x01, 0x60, 0x20, "Hard" }, - {0x16, 0x01, 0x60, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x17, 0x01, 0x01, 0x01, "Off" }, - {0x17, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x17, 0x01, 0x04, 0x04, "Off" }, - {0x17, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Mainevt2p) - -static struct BurnDIPInfo DevstorsDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x5e, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x03, "2" }, - {0x13, 0x01, 0x03, 0x02, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "150 and every 200" }, - {0x13, 0x01, 0x18, 0x10, "150 and every 250" }, - {0x13, 0x01, 0x18, 0x08, "150 Only" }, - {0x13, 0x01, 0x18, 0x00, "200 Only" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Hard" }, - {0x13, 0x01, 0x60, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Devstors) - -static struct BurnDIPInfo Devstors2DIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x52, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x03, "2" }, - {0x13, 0x01, 0x03, 0x02, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x04, 0x00, "Upright" }, - {0x13, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "150 and every 200" }, - {0x13, 0x01, 0x18, 0x10, "150 and every 250" }, - {0x13, 0x01, 0x18, 0x08, "150 Only" }, - {0x13, 0x01, 0x18, 0x00, "200 Only" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Hard" }, - {0x13, 0x01, 0x60, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Devstors2) - -static void bankswitch(INT32 data) -{ - nDrvBank[0] = data & 3; - - INT32 nBank = 0x10000 + nDrvBank[0] * 0x2000; - - HD6309MapMemory(DrvHD6309ROM + nBank, 0x6000, 0x7fff, HD6309_ROM); - - K052109RMRDLine = data & 0x40; -} - -UINT8 mainevt_main_read(UINT16 address) -{ - switch (address) - { - case 0x1f94: - return DrvInputs[0]; - - case 0x1f95: - return DrvInputs[1]; - - case 0x1f96: - return DrvInputs[2]; - - case 0x1f97: - return DrvDips[0]; - - case 0x1f98: - return DrvDips[2]; - - case 0x1f99: - return DrvInputs[3]; - - case 0x1f9a: - return DrvInputs[4]; - - case 0x1f9b: - return DrvDips[1]; - } - - if ((address & 0xffe0) == 0x1fa0 && nGame) { - return K051733Read(address); - } - - if ((address & 0xc000) == 0x0000) { - return K052109_051960_r(address & 0x3fff); - } - - return 0; -} - -void mainevt_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x1f80: - bankswitch(data); - return; - - case 0x1f84: - *soundlatch = data; - return; - - case 0x1f88: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - - case 0x1f90: - return; - - case 0x1fb2: - *nmi_enable = data; - return; - } - - if ((address & 0xffe0) == 0x1fa0 && nGame) { - K051733Write(address, data); - return; - } - - if ((address & 0xc000) == 0x0000) { - K052109_051960_w(address & 0x3fff, data); - return; - } -} - -static void soundbankswitch(INT32 data) -{ - INT32 bank_A,bank_B,bank_C; - - nDrvBank[1] = data; - - bank_A = data & 3; - bank_B = (data >> 2) & 3; - bank_C = 0x20000 + ((data >> 4) & 0x03) * 0x20000; - - k007232_set_bank(0, bank_A, bank_B ); - - memcpy (DrvSndROM1, DrvSndROM1 + bank_C, 0x20000); -} - -void __fastcall mainevt_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x9000: - UPD7759PortWrite(0, data); - return; - - case 0xc000: - BurnYM2151SelectRegister(data); - return; - - case 0xc001: - BurnYM2151WriteRegister(data); - return; - - case 0xe000: - UPD7759ResetWrite(0, data & 2); - UPD7759StartWrite(0, data & 1); - - *irq_enable = data & 4; - return; - - case 0xf000: - soundbankswitch(data); - return; - } - - if ((address & 0xfff0) == 0xb000) { - K007232WriteReg(0, address & 0x0f, data); - return; - } -} - -UINT8 __fastcall mainevt_sound_read(UINT16 address) -{ - switch (address) - { - case 0xa000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0xc000: - case 0xc001: - return BurnYM2151ReadStatus(); - - case 0xd000: - return UPD7759BusyRead(0); - - } - - if ((address & 0xfff0) == 0xb000) { - return K007232ReadReg(0, address & 0x0f); - } - - return 0; -} - -static void K052109Callback(INT32 layer, INT32 , INT32 *code, INT32 *color, INT32 *flipx, INT32 *priority) -{ - *flipx = *color & 0x02; - - if (layer == 2) *priority = (*color >> 5) & 1; - - *code |= ((*color & 0x01) << 8) | ((*color & 0x1c) << 7); - *color = ((layer & 2) << 1) + ((layer & 1) << 2) + ((*color & 0xc0) >> 6); -} - -static void DvK052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - *code |= ((*color & 0x01) << 8) | ((*color & 0x3c) << 7); - *color = ((layer & 2) << 1) + ((*color & 0xc0) >> 6); -} - -static void K051960Callback(INT32 *, INT32 *color, INT32 *priority, INT32 *) -{ - if (*color & 0x20) *priority = 0; - else if (*color & 0x40) *priority = 1; - else *priority = 2; - - *color = 0x0c + (*color & 0x03); -} - -static void DvK051960Callback(INT32 *, INT32 *color, INT32 *, INT32 *) -{ - *color = 0x08 + (*color & 0x07); -} - -static void DrvK007232VolCallback(INT32 v) -{ - K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); - K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - HD6309Open(0); - HD6309Reset(); - HD6309Close(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - UPD7759Reset(); - - KonamiICReset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvHD6309ROM = Next; Next += 0x020000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x040000; - DrvGfxROM1 = Next; Next += 0x100000; - DrvGfxROMExp0 = Next; Next += 0x080000; - DrvGfxROMExp1 = Next; Next += 0x200000; - - DrvSndROM0 = Next; Next += 0x080000; - DrvSndROM1 = Next; Next += 0x0a0000; - - DrvPalette = (UINT32*)Next; Next += 0x100 * sizeof(UINT32); - - AllRam = Next; - - DrvHD6309RAM = Next; Next += 0x002000; - DrvZ80RAM = Next; Next += 0x000400; - - soundlatch = Next; Next += 0x000001; - - irq_enable = Next; Next += 0x000001; - nmi_enable = Next; Next += 0x000001; - - nDrvBank = Next; Next += 0x000002; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode(INT32 gfxlen0) -{ - INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, gfxlen0); - konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); - - GfxDecode(gfxlen0/0x20, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x02000, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit(INT32 type) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - nGame = type; - - INT32 gfx0_offset = 0x10000 << nGame; - - { - if (BurnLoadRom(DrvHD6309ROM + 0x010000, 0, 1)) return 1; - memcpy (DrvHD6309ROM + 0x08000, DrvHD6309ROM + 0x18000, 0x8000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 3, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + gfx0_offset + 0, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + gfx0_offset + 1, 5, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 7, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 8, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x020000, 9, 1)) return 1; - memcpy (DrvSndROM1, DrvSndROM1 + 0x20000, 0x20000); - - DrvGfxDecode(gfx0_offset * 2); - } - - HD6309Init(1); - HD6309Open(0); - HD6309MapMemory(DrvHD6309RAM, 0x4000, 0x5fff, HD6309_RAM); - HD6309MapMemory(DrvHD6309ROM + 0x10000, 0x6000, 0x7fff, HD6309_ROM); - HD6309MapMemory(DrvHD6309ROM + 0x08000, 0x8000, 0xffff, HD6309_ROM); - HD6309SetWriteHandler(mainevt_main_write); - HD6309SetReadHandler(mainevt_main_read); - HD6309Close(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x83ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x83ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x83ff, 2, DrvZ80RAM); - ZetSetWriteHandler(mainevt_sound_write); - ZetSetReadHandler(mainevt_sound_read); - ZetMemEnd(); - ZetClose(); - - K052109Init(DrvGfxROM0, (gfx0_offset * 2) - 1); - K052109SetCallback(nGame ? DvK052109Callback : K052109Callback); - K052109AdjustScroll(nGame ? 0 : 8, 0); - - K051960Init(DrvGfxROM1, 0xfffff); - K051960SetCallback(nGame ? DvK051960Callback : K051960Callback); - K051960SetSpriteOffset(nGame ? 0 : 8, 0); - - K007232Init(0, 3579545, DrvSndROM0, 0x80000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback); - K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - BurnYM2151Init(3579545); - BurnYM2151SetAllRoutes(0.30, BURN_SND_ROUTE_BOTH); - - UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvSndROM1); - UPD7759SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - HD6309Exit(); - ZetExit(); - - K007232Exit(); - UPD7759Exit(); - BurnYM2151Exit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - KonamiRecalcPal(DrvHD6309RAM + 0x1e00, DrvPalette, 0x200); - } - - K052109UpdateScroll(); - - if (nGame) - { - K052109RenderLayer(1, 1, DrvGfxROMExp0); - K052109RenderLayer(2, 0, DrvGfxROMExp0); - - K051960SpritesRender(DrvGfxROMExp1, 0); - - K052109RenderLayer(0, 0, DrvGfxROMExp0); - } - else - { - if (nBurnLayer & 1) K052109RenderLayer(1, 1, DrvGfxROMExp0); - - if (nBurnLayer & 2) K052109RenderLayer(2 | 0x10, 0, DrvGfxROMExp0); - - if (nSpriteEnable & 2) K051960SpritesRender(DrvGfxROMExp1, 1); - - if (nBurnLayer & 4) K052109RenderLayer(2 | 0x00, 0, DrvGfxROMExp0); - - if (nSpriteEnable & 4) K051960SpritesRender(DrvGfxROMExp1, 0); // makes sense... - - if (nSpriteEnable & 1) K051960SpritesRender(DrvGfxROMExp1, 2); - - if (nBurnLayer & 8) K052109RenderLayer(0, 0, DrvGfxROMExp0); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 5); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - } - - // Clear Opposites - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; - if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; - if ((DrvInputs[3] & 0x0c) == 0) DrvInputs[3] |= 0x0c; - if ((DrvInputs[3] & 0x03) == 0) DrvInputs[3] |= 0x03; - if ((DrvInputs[4] & 0x0c) == 0) DrvInputs[4] |= 0x0c; - if ((DrvInputs[4] & 0x03) == 0) DrvInputs[4] |= 0x03; - } - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = nBurnSoundLen; - INT32 nCyclesTotal[2] = { 12000000 / 60, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetOpen(0); - HD6309Open(0); - - INT32 nCyclesSoundIrq = nInterleave / (8 >> nGame); - INT32 nCyclesSoundIrqTrigger = nCyclesSoundIrq; - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - - nCyclesDone[0] += HD6309Run(nSegment - nCyclesDone[0]); - - nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); - - nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); - - if (i == nCyclesSoundIrqTrigger-1) { - nCyclesSoundIrqTrigger+=nCyclesSoundIrq; - if (*irq_enable) { - if (nGame) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - else ZetNmi(); - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - UPD7759Update(0, pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (nGame) { - if (nmi_enable[0]) HD6309SetIRQLine(0x20, HD6309_IRQSTATUS_AUTO); // nmi - } else { - if (K052109_irq_enabled) HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_AUTO); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - UPD7759Update(0, pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - } - } - - HD6309Close(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - return 1; // hd6309 isn't hooked up... - - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029704; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - HD6309Scan(nAction); - ZetScan(nAction); - - UPD7759Scan(0, nAction, pnMin); - BurnYM2151Scan(nAction); - K007232Scan(nAction, pnMin); - - KonamiICScan(nAction); - } - - if (nAction & ACB_WRITE) { - HD6309Open(0); - bankswitch(nDrvBank[0]); - HD6309Close(); - - soundbankswitch(nDrvBank[1]); - } - - return 0; -} - - -// The Main Event (4 Players ver. Y) - -static struct BurnRomInfo mainevtRomDesc[] = { - { "799c02.k11", 0x10000, 0xe2e7dbd5, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code - - { "799c01.f7", 0x08000, 0x447c4c5c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "799c06.f22", 0x08000, 0xf839cb58, 3 | BRF_GRA }, // 2 K052109 Tiles - { "799c07.h22", 0x08000, 0x176df538, 3 | BRF_GRA }, // 3 - { "799c08.j22", 0x08000, 0xd01e0078, 3 | BRF_GRA }, // 4 - { "799c09.k22", 0x08000, 0x9baec75e, 3 | BRF_GRA }, // 5 - - { "799b04.h4", 0x80000, 0x323e0c2b, 4 | BRF_GRA }, // 6 K051960 Tiles - { "799b05.k4", 0x80000, 0x571c5831, 4 | BRF_GRA }, // 7 - - { "799b03.d4", 0x80000, 0xf1cfd342, 5 | BRF_SND }, // 8 K007232 Samples - - { "799b06.c22", 0x80000, 0x2c8c47d7, 6 | BRF_GRA }, // 9 UPD7759 - - { "63s141n.k14", 0x00100, 0x61f6c8d1, 7 | BRF_OPT }, // 10 Priority Prom -}; - -STD_ROM_PICK(mainevt) -STD_ROM_FN(mainevt) - -static INT32 mainevtInit() -{ - return DrvInit(0); -} - - -struct BurnDriver BurnDrvMainevt = { - "mainevt", NULL, NULL, NULL, "1988", - "The Main Event (4 Players ver. Y)\0", NULL, "Konami", "GX799", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, mainevtRomInfo, mainevtRomName, NULL, NULL, MainevtInputInfo, MainevtDIPInfo, - mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 288, 224, 4, 3 -}; - - -// The Main Event (4 Players ver. F) - -static struct BurnRomInfo mainevtoRomDesc[] = { - { "799_02.k11", 0x10000, 0xc143596b, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code - - { "799c01.f7", 0x08000, 0x447c4c5c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "799c06.f22", 0x08000, 0xf839cb58, 3 | BRF_GRA }, // 2 K052109 Tiles - { "799c07.h22", 0x08000, 0x176df538, 3 | BRF_GRA }, // 3 - { "799c08.j22", 0x08000, 0xd01e0078, 3 | BRF_GRA }, // 4 - { "799c09.k22", 0x08000, 0x9baec75e, 3 | BRF_GRA }, // 5 - - { "799b04.h4", 0x80000, 0x323e0c2b, 4 | BRF_GRA }, // 6 K051960 Tiles - { "799b05.k4", 0x80000, 0x571c5831, 4 | BRF_GRA }, // 7 - - { "799b03.d4", 0x80000, 0xf1cfd342, 5 | BRF_SND }, // 8 K007232 Samples - - { "799b06.c22", 0x80000, 0x2c8c47d7, 6 | BRF_GRA }, // 9 UPD7759 - - { "63s141n.k14", 0x00100, 0x61f6c8d1, 7 | BRF_OPT }, // 10 Priority Prom -}; - -STD_ROM_PICK(mainevto) -STD_ROM_FN(mainevto) - -struct BurnDriver BurnDrvMainevto = { - "mainevto", "mainevt", NULL, NULL, "1988", - "The Main Event (4 Players ver. F)\0", NULL, "Konami", "GX799", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, mainevtoRomInfo, mainevtoRomName, NULL, NULL, MainevtInputInfo, MainevtDIPInfo, - mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 288, 224, 4, 3 -}; - - -// The Main Event (2 Players ver. X) - -static struct BurnRomInfo mainevt2pRomDesc[] = { - { "799x02.k11", 0x10000, 0x42cfc650, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code - - { "799c01.f7", 0x08000, 0x447c4c5c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "799c06.f22", 0x08000, 0xf839cb58, 3 | BRF_GRA }, // 2 K052109 Tiles - { "799c07.h22", 0x08000, 0x176df538, 3 | BRF_GRA }, // 3 - { "799c08.j22", 0x08000, 0xd01e0078, 3 | BRF_GRA }, // 4 - { "799c09.k22", 0x08000, 0x9baec75e, 3 | BRF_GRA }, // 5 - - { "799b04.h4", 0x80000, 0x323e0c2b, 4 | BRF_GRA }, // 6 K051960 Tiles - { "799b05.k4", 0x80000, 0x571c5831, 4 | BRF_GRA }, // 7 - - { "799b03.d4", 0x80000, 0xf1cfd342, 5 | BRF_SND }, // 8 K007232 Samples - - { "799b06.c22", 0x80000, 0x2c8c47d7, 6 | BRF_GRA }, // 9 UPD7759 - - { "63s141n.k14", 0x00100, 0x61f6c8d1, 7 | BRF_OPT }, // 10 Priority Prom -}; - -STD_ROM_PICK(mainevt2p) -STD_ROM_FN(mainevt2p) - -struct BurnDriver BurnDrvMainevt2p = { - "mainevt2p", "mainevt", NULL, NULL, "1988", - "The Main Event (2 Players ver. X)\0", NULL, "Konami", "GX799", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, mainevt2pRomInfo, mainevt2pRomName, NULL, NULL, Mainevt2pInputInfo, Mainevt2pDIPInfo, - mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 288, 224, 4, 3 -}; - - -// Ring no Ohja (Japan 2 Players ver. N) - -static struct BurnRomInfo ringohjaRomDesc[] = { - { "799n02.k11", 0x10000, 0xf9305dd0, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code - - { "799c01.f7", 0x08000, 0x447c4c5c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "799c06.f22", 0x08000, 0xf839cb58, 3 | BRF_GRA }, // 2 K052109 Tiles - { "799c07.h22", 0x08000, 0x176df538, 3 | BRF_GRA }, // 3 - { "799c08.j22", 0x08000, 0xd01e0078, 3 | BRF_GRA }, // 4 - { "799c09.k22", 0x08000, 0x9baec75e, 3 | BRF_GRA }, // 5 - - { "799b04.h4", 0x80000, 0x323e0c2b, 4 | BRF_GRA }, // 6 K051960 Tiles - { "799b05.k4", 0x80000, 0x571c5831, 4 | BRF_GRA }, // 7 - - { "799b03.d4", 0x80000, 0xf1cfd342, 5 | BRF_SND }, // 8 K007232 Samples - - { "799b06.c22", 0x80000, 0x2c8c47d7, 6 | BRF_GRA }, // 9 UPD7759 - - { "63s141n.k14", 0x00100, 0x61f6c8d1, 7 | BRF_OPT }, // 10 Priority Prom -}; - -STD_ROM_PICK(ringohja) -STD_ROM_FN(ringohja) - -struct BurnDriver BurnDrvRingohja = { - "ringohja", "mainevt", NULL, NULL, "1988", - "Ring no Ohja (Japan 2 Players ver. N)\0", NULL, "Konami", "GX799", - L"\u30EA\u30F3\u30B0\u306E \u738B\u8005 (Japan 2 Players ver. N)\0Ring no Ohja\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, ringohjaRomInfo, ringohjaRomName, NULL, NULL, Mainevt2pInputInfo, Mainevt2pDIPInfo, - mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 288, 224, 4, 3 -}; - - -// Devastators (ver. Z) - -static struct BurnRomInfo devstorsRomDesc[] = { - { "890z02.k11", 0x10000, 0xebeb306f, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code - - { "890k01.f7", 0x08000, 0xd44b3eb0, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "890f06.f22", 0x10000, 0x26592155, 3 | BRF_GRA }, // 2 K052109 Tiles - { "890f07.h22", 0x10000, 0x6c74fa2e, 3 | BRF_GRA }, // 3 - { "890f08.j22", 0x10000, 0x29e12e80, 3 | BRF_GRA }, // 4 - { "890f09.k22", 0x10000, 0x67ca40d5, 3 | BRF_GRA }, // 5 - - { "890f04.h4", 0x80000, 0xf16cd1fa, 4 | BRF_GRA }, // 6 K051960 Tiles - { "890f05.k4", 0x80000, 0xda37db05, 4 | BRF_GRA }, // 7 - - { "890f03.d4", 0x80000, 0x19065031, 6 | BRF_GRA }, // 8 K007232 Samples - - { "63s141n.k14", 0x00100, 0xd3620106, 5 | BRF_OPT }, // 9 Priority Prom -}; - -STD_ROM_PICK(devstors) -STD_ROM_FN(devstors) - -static INT32 devstorsInit() -{ - return DrvInit(1); -} - -struct BurnDriver BurnDrvDevstors = { - "devstors", NULL, NULL, NULL, "1988", - "Devastators (ver. Z)\0", NULL, "Konami", "GX890", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, devstorsRomInfo, devstorsRomName, NULL, NULL, DevstorsInputInfo, DevstorsDIPInfo, - devstorsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 224, 304, 3, 4 -}; - - -// Devastators (ver. X) - -static struct BurnRomInfo devstors2RomDesc[] = { - { "890x02.k11", 0x10000, 0xe58ebb35, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code - - { "890k01.f7", 0x08000, 0xd44b3eb0, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "890f06.f22", 0x10000, 0x26592155, 3 | BRF_GRA }, // 2 K052109 Tiles - { "890f07.h22", 0x10000, 0x6c74fa2e, 3 | BRF_GRA }, // 3 - { "890f08.j22", 0x10000, 0x29e12e80, 3 | BRF_GRA }, // 4 - { "890f09.k22", 0x10000, 0x67ca40d5, 3 | BRF_GRA }, // 5 - - { "890f04.h4", 0x80000, 0xf16cd1fa, 4 | BRF_GRA }, // 6 K051960 Tiles - { "890f05.k4", 0x80000, 0xda37db05, 4 | BRF_GRA }, // 7 - - { "890f03.d4", 0x80000, 0x19065031, 6 | BRF_GRA }, // 8 K007232 Samples - - { "63s141n.k14", 0x00100, 0xd3620106, 5 | BRF_OPT }, // 9 Priority Prom -}; - -STD_ROM_PICK(devstors2) -STD_ROM_FN(devstors2) - -struct BurnDriver BurnDrvDevstors2 = { - "devstors2", "devstors", NULL, NULL, "1988", - "Devastators (ver. X)\0", NULL, "Konami", "GX890", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, devstors2RomInfo, devstors2RomName, NULL, NULL, DevstorsInputInfo, Devstors2DIPInfo, - devstorsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 224, 304, 3, 4 -}; - - -// Devastators (ver. V) - -static struct BurnRomInfo devstors3RomDesc[] = { - { "890k02.k11", 0x10000, 0x52f4ccdd, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code - - { "890k01.f7", 0x08000, 0xd44b3eb0, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "890f06.f22", 0x10000, 0x26592155, 3 | BRF_GRA }, // 2 K052109 Tiles - { "890f07.h22", 0x10000, 0x6c74fa2e, 3 | BRF_GRA }, // 3 - { "890f08.j22", 0x10000, 0x29e12e80, 3 | BRF_GRA }, // 4 - { "890f09.k22", 0x10000, 0x67ca40d5, 3 | BRF_GRA }, // 5 - - { "890f04.h4", 0x80000, 0xf16cd1fa, 4 | BRF_GRA }, // 6 K051960 Tiles - { "890f05.k4", 0x80000, 0xda37db05, 4 | BRF_GRA }, // 7 - - { "890f03.d4", 0x80000, 0x19065031, 6 | BRF_GRA }, // 8 K007232 Samples - - { "63s141n.k14", 0x00100, 0xd3620106, 5 | BRF_OPT }, // 9 Priority Prom -}; - -STD_ROM_PICK(devstors3) -STD_ROM_FN(devstors3) - -struct BurnDriver BurnDrvDevstors3 = { - "devstors3", "devstors", NULL, NULL, "1988", - "Devastators (ver. V)\0", NULL, "Konami", "GX890", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, devstors3RomInfo, devstors3RomName, NULL, NULL, DevstorsInputInfo, DevstorsDIPInfo, - devstorsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 224, 304, 3, 4 -}; - - -// Garuka (Japan ver. W) - -static struct BurnRomInfo garukaRomDesc[] = { - { "890w02.k11", 0x10000, 0xb2f6f538, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code - - { "890k01.f7", 0x08000, 0xd44b3eb0, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "890f06.f22", 0x10000, 0x26592155, 3 | BRF_GRA }, // 2 K052109 Tiles - { "890f07.h22", 0x10000, 0x6c74fa2e, 3 | BRF_GRA }, // 3 - { "890f08.j22", 0x10000, 0x29e12e80, 3 | BRF_GRA }, // 4 - { "890f09.k22", 0x10000, 0x67ca40d5, 3 | BRF_GRA }, // 5 - - { "890f04.h4", 0x80000, 0xf16cd1fa, 4 | BRF_GRA }, // 6 K051960 Tiles - { "890f05.k4", 0x80000, 0xda37db05, 4 | BRF_GRA }, // 7 - - { "890f03.d4", 0x80000, 0x19065031, 6 | BRF_GRA }, // 8 K007232 Samples - - { "63s141n.k14", 0x00100, 0xd3620106, 5 | BRF_OPT }, // 9 Priority Prom -}; - -STD_ROM_PICK(garuka) -STD_ROM_FN(garuka) - -struct BurnDriver BurnDrvGaruka = { - "garuka", "devstors", NULL, NULL, "1988", - "Garuka (Japan ver. W)\0", NULL, "Konami", "GX890", - L"\u9913\u6D41\u798D (Japan ver. W)\0Garuka\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, garukaRomInfo, garukaRomName, NULL, NULL, DevstorsInputInfo, Devstors2DIPInfo, - devstorsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 224, 304, 3, 4 -}; +// FB Alpha The Main Event / Devastators driver module +// Based on MAME driver by Bryan McPhail + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "hd6309_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" +#include "upd7759.h" +#include "k007232.h" + +static UINT8 *AllMem; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *DrvHD6309ROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *DrvHD6309RAM; +static UINT8 *DrvZ80RAM; +static UINT8 *soundlatch; +static UINT8 *irq_enable; +static UINT8 *nmi_enable; + +static UINT8 *nDrvBank; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[5]; +static UINT8 DrvReset; + +static INT32 nGame; + +static struct BurnInputInfo MainevtInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 2" }, + + {"P3 Coin", BIT_DIGITAL, DrvJoy1 + 2, "p3 coin" }, + {"P3 Up", BIT_DIGITAL, DrvJoy4 + 2, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy4 + 3, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy4 + 0, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy4 + 1, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 5, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 4, "p3 fire 2" }, + + {"P4 Coin", BIT_DIGITAL, DrvJoy1 + 3, "p4 coin" }, + {"P4 Up", BIT_DIGITAL, DrvJoy5 + 2, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvJoy5 + 3, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvJoy5 + 0, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvJoy5 + 1, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy5 + 5, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy5 + 4, "p4 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service 1", BIT_DIGITAL, DrvJoy1 + 4, "service" }, + {"Service 2", BIT_DIGITAL, DrvJoy1 + 5, "service2" }, + {"Service 3", BIT_DIGITAL, DrvJoy1 + 6, "service3" }, + {"Service 4", BIT_DIGITAL, DrvJoy1 + 7, "service4" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Mainevt) + +static struct BurnInputInfo Mainevt2pInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service 1", BIT_DIGITAL, DrvJoy1 + 4, "service" }, + {"Service 2", BIT_DIGITAL, DrvJoy1 + 5, "service2" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Mainevt2p) + +static struct BurnInputInfo DevstorsInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 4, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Devstors) + +static struct BurnDIPInfo MainevtDIPList[]= +{ + {0x21, 0xff, 0xff, 0xff, NULL }, + {0x22, 0xff, 0xff, 0x57, NULL }, + {0x23, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x21, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x21, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x21, 0x01, 0x0f, 0x00, "4 Coins 5 Credits" }, + {0x21, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x21, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x21, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x21, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x21, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x21, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x21, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Bonus Energy" }, + {0x22, 0x01, 0x18, 0x00, "60" }, + {0x22, 0x01, 0x18, 0x08, "70" }, + {0x22, 0x01, 0x18, 0x10, "80" }, + {0x22, 0x01, 0x18, 0x18, "90" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x22, 0x01, 0x60, 0x60, "Easy" }, + {0x22, 0x01, 0x60, 0x40, "Normal" }, + {0x22, 0x01, 0x60, 0x20, "Hard" }, + {0x22, 0x01, 0x60, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x22, 0x01, 0x80, 0x80, "Off" }, + {0x22, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x23, 0x01, 0x01, 0x01, "Off" }, + {0x23, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x23, 0x01, 0x04, 0x04, "Off" }, + {0x23, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Mainevt) + +static struct BurnDIPInfo Mainevt2pDIPList[]= +{ + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0x57, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0f, 0x00, "4 Coins 5 Credits" }, + {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xf0, 0x00, "4 Coins 5 Credits" }, + {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Bonus Energy" }, + {0x16, 0x01, 0x18, 0x00, "60" }, + {0x16, 0x01, 0x18, 0x08, "70" }, + {0x16, 0x01, 0x18, 0x10, "80" }, + {0x16, 0x01, 0x18, 0x18, "90" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x60, 0x60, "Easy" }, + {0x16, 0x01, 0x60, 0x40, "Normal" }, + {0x16, 0x01, 0x60, 0x20, "Hard" }, + {0x16, 0x01, 0x60, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x17, 0x01, 0x01, 0x01, "Off" }, + {0x17, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x17, 0x01, 0x04, 0x04, "Off" }, + {0x17, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Mainevt2p) + +static struct BurnDIPInfo DevstorsDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x5e, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x03, "2" }, + {0x13, 0x01, 0x03, 0x02, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "150 and every 200" }, + {0x13, 0x01, 0x18, 0x10, "150 and every 250" }, + {0x13, 0x01, 0x18, 0x08, "150 Only" }, + {0x13, 0x01, 0x18, 0x00, "200 Only" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Hard" }, + {0x13, 0x01, 0x60, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Devstors) + +static struct BurnDIPInfo Devstors2DIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x52, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x03, "2" }, + {0x13, 0x01, 0x03, 0x02, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x04, 0x00, "Upright" }, + {0x13, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "150 and every 200" }, + {0x13, 0x01, 0x18, 0x10, "150 and every 250" }, + {0x13, 0x01, 0x18, 0x08, "150 Only" }, + {0x13, 0x01, 0x18, 0x00, "200 Only" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Hard" }, + {0x13, 0x01, 0x60, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Devstors2) + +static void bankswitch(INT32 data) +{ + nDrvBank[0] = data & 3; + + INT32 nBank = 0x10000 + nDrvBank[0] * 0x2000; + + HD6309MapMemory(DrvHD6309ROM + nBank, 0x6000, 0x7fff, HD6309_ROM); + + K052109RMRDLine = data & 0x40; +} + +UINT8 mainevt_main_read(UINT16 address) +{ + switch (address) + { + case 0x1f94: + return DrvInputs[0]; + + case 0x1f95: + return DrvInputs[1]; + + case 0x1f96: + return DrvInputs[2]; + + case 0x1f97: + return DrvDips[0]; + + case 0x1f98: + return DrvDips[2]; + + case 0x1f99: + return DrvInputs[3]; + + case 0x1f9a: + return DrvInputs[4]; + + case 0x1f9b: + return DrvDips[1]; + } + + if ((address & 0xffe0) == 0x1fa0 && nGame) { + return K051733Read(address); + } + + if ((address & 0xc000) == 0x0000) { + return K052109_051960_r(address & 0x3fff); + } + + return 0; +} + +void mainevt_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x1f80: + bankswitch(data); + return; + + case 0x1f84: + *soundlatch = data; + return; + + case 0x1f88: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + + case 0x1f90: + return; + + case 0x1fb2: + *nmi_enable = data; + return; + } + + if ((address & 0xffe0) == 0x1fa0 && nGame) { + K051733Write(address, data); + return; + } + + if ((address & 0xc000) == 0x0000) { + K052109_051960_w(address & 0x3fff, data); + return; + } +} + +static void soundbankswitch(INT32 data) +{ + INT32 bank_A,bank_B,bank_C; + + nDrvBank[1] = data; + + bank_A = data & 3; + bank_B = (data >> 2) & 3; + bank_C = 0x20000 + ((data >> 4) & 0x03) * 0x20000; + + k007232_set_bank(0, bank_A, bank_B ); + + memcpy (DrvSndROM1, DrvSndROM1 + bank_C, 0x20000); +} + +void __fastcall mainevt_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x9000: + UPD7759PortWrite(0, data); + return; + + case 0xc000: + BurnYM2151SelectRegister(data); + return; + + case 0xc001: + BurnYM2151WriteRegister(data); + return; + + case 0xe000: + UPD7759ResetWrite(0, data & 2); + UPD7759StartWrite(0, data & 1); + + *irq_enable = data & 4; + return; + + case 0xf000: + soundbankswitch(data); + return; + } + + if ((address & 0xfff0) == 0xb000) { + K007232WriteReg(0, address & 0x0f, data); + return; + } +} + +UINT8 __fastcall mainevt_sound_read(UINT16 address) +{ + switch (address) + { + case 0xa000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0xc000: + case 0xc001: + return BurnYM2151ReadStatus(); + + case 0xd000: + return UPD7759BusyRead(0); + + } + + if ((address & 0xfff0) == 0xb000) { + return K007232ReadReg(0, address & 0x0f); + } + + return 0; +} + +static void K052109Callback(INT32 layer, INT32 , INT32 *code, INT32 *color, INT32 *flipx, INT32 *priority) +{ + *flipx = *color & 0x02; + + if (layer == 2) *priority = (*color >> 5) & 1; + + *code |= ((*color & 0x01) << 8) | ((*color & 0x1c) << 7); + *color = ((layer & 2) << 1) + ((layer & 1) << 2) + ((*color & 0xc0) >> 6); +} + +static void DvK052109Callback(INT32 layer, INT32, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + *code |= ((*color & 0x01) << 8) | ((*color & 0x3c) << 7); + *color = ((layer & 2) << 1) + ((*color & 0xc0) >> 6); +} + +static void K051960Callback(INT32 *, INT32 *color, INT32 *priority, INT32 *) +{ + if (*color & 0x20) *priority = 0; + else if (*color & 0x40) *priority = 1; + else *priority = 2; + + *color = 0x0c + (*color & 0x03); +} + +static void DvK051960Callback(INT32 *, INT32 *color, INT32 *, INT32 *) +{ + *color = 0x08 + (*color & 0x07); +} + +static void DrvK007232VolCallback(INT32 v) +{ + K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); + K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + HD6309Open(0); + HD6309Reset(); + HD6309Close(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + UPD7759Reset(); + + KonamiICReset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvHD6309ROM = Next; Next += 0x020000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x040000; + DrvGfxROM1 = Next; Next += 0x100000; + DrvGfxROMExp0 = Next; Next += 0x080000; + DrvGfxROMExp1 = Next; Next += 0x200000; + + DrvSndROM0 = Next; Next += 0x080000; + DrvSndROM1 = Next; Next += 0x0a0000; + + DrvPalette = (UINT32*)Next; Next += 0x100 * sizeof(UINT32); + + AllRam = Next; + + DrvHD6309RAM = Next; Next += 0x002000; + DrvZ80RAM = Next; Next += 0x000400; + + soundlatch = Next; Next += 0x000001; + + irq_enable = Next; Next += 0x000001; + nmi_enable = Next; Next += 0x000001; + + nDrvBank = Next; Next += 0x000002; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode(INT32 gfxlen0) +{ + INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, gfxlen0); + konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); + + GfxDecode(gfxlen0/0x20, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x02000, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit(INT32 type) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + nGame = type; + + INT32 gfx0_offset = 0x10000 << nGame; + + { + if (BurnLoadRom(DrvHD6309ROM + 0x010000, 0, 1)) return 1; + memcpy (DrvHD6309ROM + 0x08000, DrvHD6309ROM + 0x18000, 0x8000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 3, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + gfx0_offset + 0, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + gfx0_offset + 1, 5, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 7, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 8, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x020000, 9, 1)) return 1; + memcpy (DrvSndROM1, DrvSndROM1 + 0x20000, 0x20000); + + DrvGfxDecode(gfx0_offset * 2); + } + + HD6309Init(1); + HD6309Open(0); + HD6309MapMemory(DrvHD6309RAM, 0x4000, 0x5fff, HD6309_RAM); + HD6309MapMemory(DrvHD6309ROM + 0x10000, 0x6000, 0x7fff, HD6309_ROM); + HD6309MapMemory(DrvHD6309ROM + 0x08000, 0x8000, 0xffff, HD6309_ROM); + HD6309SetWriteHandler(mainevt_main_write); + HD6309SetReadHandler(mainevt_main_read); + HD6309Close(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x83ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x83ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x83ff, 2, DrvZ80RAM); + ZetSetWriteHandler(mainevt_sound_write); + ZetSetReadHandler(mainevt_sound_read); + ZetClose(); + + K052109Init(DrvGfxROM0, (gfx0_offset * 2) - 1); + K052109SetCallback(nGame ? DvK052109Callback : K052109Callback); + K052109AdjustScroll(nGame ? 0 : 8, 0); + + K051960Init(DrvGfxROM1, 0xfffff); + K051960SetCallback(nGame ? DvK051960Callback : K051960Callback); + K051960SetSpriteOffset(nGame ? 0 : 8, 0); + + K007232Init(0, 3579545, DrvSndROM0, 0x80000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback); + K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + BurnYM2151Init(3579545); + BurnYM2151SetAllRoutes(0.30, BURN_SND_ROUTE_BOTH); + + UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvSndROM1); + UPD7759SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + HD6309Exit(); + ZetExit(); + + K007232Exit(); + UPD7759Exit(); + BurnYM2151Exit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + KonamiRecalcPal(DrvHD6309RAM + 0x1e00, DrvPalette, 0x200); + } + + K052109UpdateScroll(); + + if (nGame) + { + K052109RenderLayer(1, 1, DrvGfxROMExp0); + K052109RenderLayer(2, 0, DrvGfxROMExp0); + + K051960SpritesRender(DrvGfxROMExp1, 0); + + K052109RenderLayer(0, 0, DrvGfxROMExp0); + } + else + { + if (nBurnLayer & 1) K052109RenderLayer(1, 1, DrvGfxROMExp0); + + if (nBurnLayer & 2) K052109RenderLayer(2 | 0x10, 0, DrvGfxROMExp0); + + if (nSpriteEnable & 2) K051960SpritesRender(DrvGfxROMExp1, 1); + + if (nBurnLayer & 4) K052109RenderLayer(2 | 0x00, 0, DrvGfxROMExp0); + + if (nSpriteEnable & 4) K051960SpritesRender(DrvGfxROMExp1, 0); // makes sense... + + if (nSpriteEnable & 1) K051960SpritesRender(DrvGfxROMExp1, 2); + + if (nBurnLayer & 8) K052109RenderLayer(0, 0, DrvGfxROMExp0); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 5); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + } + + // Clear Opposites + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; + if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; + if ((DrvInputs[3] & 0x0c) == 0) DrvInputs[3] |= 0x0c; + if ((DrvInputs[3] & 0x03) == 0) DrvInputs[3] |= 0x03; + if ((DrvInputs[4] & 0x0c) == 0) DrvInputs[4] |= 0x0c; + if ((DrvInputs[4] & 0x03) == 0) DrvInputs[4] |= 0x03; + } + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = nBurnSoundLen; + INT32 nCyclesTotal[2] = { 12000000 / 60, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetOpen(0); + HD6309Open(0); + + INT32 nCyclesSoundIrq = nInterleave / (8 >> nGame); + INT32 nCyclesSoundIrqTrigger = nCyclesSoundIrq; + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + + nCyclesDone[0] += HD6309Run(nSegment - nCyclesDone[0]); + + nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); + + nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); + + if (i == nCyclesSoundIrqTrigger-1) { + nCyclesSoundIrqTrigger+=nCyclesSoundIrq; + if (*irq_enable) { + if (nGame) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + else ZetNmi(); + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + UPD7759Update(0, pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (nGame) { + if (nmi_enable[0]) HD6309SetIRQLine(0x20, HD6309_IRQSTATUS_AUTO); // nmi + } else { + if (K052109_irq_enabled) HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_AUTO); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + UPD7759Update(0, pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + } + } + + HD6309Close(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + return 1; // hd6309 isn't hooked up... + + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029704; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + HD6309Scan(nAction); + ZetScan(nAction); + + UPD7759Scan(0, nAction, pnMin); + BurnYM2151Scan(nAction); + K007232Scan(nAction, pnMin); + + KonamiICScan(nAction); + } + + if (nAction & ACB_WRITE) { + HD6309Open(0); + bankswitch(nDrvBank[0]); + HD6309Close(); + + soundbankswitch(nDrvBank[1]); + } + + return 0; +} + + +// The Main Event (4 Players ver. Y) + +static struct BurnRomInfo mainevtRomDesc[] = { + { "799c02.k11", 0x10000, 0xe2e7dbd5, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code + + { "799c01.f7", 0x08000, 0x447c4c5c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "799c06.f22", 0x08000, 0xf839cb58, 3 | BRF_GRA }, // 2 K052109 Tiles + { "799c07.h22", 0x08000, 0x176df538, 3 | BRF_GRA }, // 3 + { "799c08.j22", 0x08000, 0xd01e0078, 3 | BRF_GRA }, // 4 + { "799c09.k22", 0x08000, 0x9baec75e, 3 | BRF_GRA }, // 5 + + { "799b04.h4", 0x80000, 0x323e0c2b, 4 | BRF_GRA }, // 6 K051960 Tiles + { "799b05.k4", 0x80000, 0x571c5831, 4 | BRF_GRA }, // 7 + + { "799b03.d4", 0x80000, 0xf1cfd342, 5 | BRF_SND }, // 8 K007232 Samples + + { "799b06.c22", 0x80000, 0x2c8c47d7, 6 | BRF_GRA }, // 9 UPD7759 + + { "63s141n.k14", 0x00100, 0x61f6c8d1, 7 | BRF_OPT }, // 10 Priority Prom +}; + +STD_ROM_PICK(mainevt) +STD_ROM_FN(mainevt) + +static INT32 mainevtInit() +{ + return DrvInit(0); +} + + +struct BurnDriver BurnDrvMainevt = { + "mainevt", NULL, NULL, NULL, "1988", + "The Main Event (4 Players ver. Y)\0", NULL, "Konami", "GX799", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, mainevtRomInfo, mainevtRomName, NULL, NULL, MainevtInputInfo, MainevtDIPInfo, + mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 288, 224, 4, 3 +}; + + +// The Main Event (4 Players ver. F) + +static struct BurnRomInfo mainevtoRomDesc[] = { + { "799_02.k11", 0x10000, 0xc143596b, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code + + { "799c01.f7", 0x08000, 0x447c4c5c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "799c06.f22", 0x08000, 0xf839cb58, 3 | BRF_GRA }, // 2 K052109 Tiles + { "799c07.h22", 0x08000, 0x176df538, 3 | BRF_GRA }, // 3 + { "799c08.j22", 0x08000, 0xd01e0078, 3 | BRF_GRA }, // 4 + { "799c09.k22", 0x08000, 0x9baec75e, 3 | BRF_GRA }, // 5 + + { "799b04.h4", 0x80000, 0x323e0c2b, 4 | BRF_GRA }, // 6 K051960 Tiles + { "799b05.k4", 0x80000, 0x571c5831, 4 | BRF_GRA }, // 7 + + { "799b03.d4", 0x80000, 0xf1cfd342, 5 | BRF_SND }, // 8 K007232 Samples + + { "799b06.c22", 0x80000, 0x2c8c47d7, 6 | BRF_GRA }, // 9 UPD7759 + + { "63s141n.k14", 0x00100, 0x61f6c8d1, 7 | BRF_OPT }, // 10 Priority Prom +}; + +STD_ROM_PICK(mainevto) +STD_ROM_FN(mainevto) + +struct BurnDriver BurnDrvMainevto = { + "mainevto", "mainevt", NULL, NULL, "1988", + "The Main Event (4 Players ver. F)\0", NULL, "Konami", "GX799", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, mainevtoRomInfo, mainevtoRomName, NULL, NULL, MainevtInputInfo, MainevtDIPInfo, + mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 288, 224, 4, 3 +}; + + +// The Main Event (2 Players ver. X) + +static struct BurnRomInfo mainevt2pRomDesc[] = { + { "799x02.k11", 0x10000, 0x42cfc650, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code + + { "799c01.f7", 0x08000, 0x447c4c5c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "799c06.f22", 0x08000, 0xf839cb58, 3 | BRF_GRA }, // 2 K052109 Tiles + { "799c07.h22", 0x08000, 0x176df538, 3 | BRF_GRA }, // 3 + { "799c08.j22", 0x08000, 0xd01e0078, 3 | BRF_GRA }, // 4 + { "799c09.k22", 0x08000, 0x9baec75e, 3 | BRF_GRA }, // 5 + + { "799b04.h4", 0x80000, 0x323e0c2b, 4 | BRF_GRA }, // 6 K051960 Tiles + { "799b05.k4", 0x80000, 0x571c5831, 4 | BRF_GRA }, // 7 + + { "799b03.d4", 0x80000, 0xf1cfd342, 5 | BRF_SND }, // 8 K007232 Samples + + { "799b06.c22", 0x80000, 0x2c8c47d7, 6 | BRF_GRA }, // 9 UPD7759 + + { "63s141n.k14", 0x00100, 0x61f6c8d1, 7 | BRF_OPT }, // 10 Priority Prom +}; + +STD_ROM_PICK(mainevt2p) +STD_ROM_FN(mainevt2p) + +struct BurnDriver BurnDrvMainevt2p = { + "mainevt2p", "mainevt", NULL, NULL, "1988", + "The Main Event (2 Players ver. X)\0", NULL, "Konami", "GX799", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, mainevt2pRomInfo, mainevt2pRomName, NULL, NULL, Mainevt2pInputInfo, Mainevt2pDIPInfo, + mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 288, 224, 4, 3 +}; + + +// Ring no Ohja (Japan 2 Players ver. N) + +static struct BurnRomInfo ringohjaRomDesc[] = { + { "799n02.k11", 0x10000, 0xf9305dd0, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code + + { "799c01.f7", 0x08000, 0x447c4c5c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "799c06.f22", 0x08000, 0xf839cb58, 3 | BRF_GRA }, // 2 K052109 Tiles + { "799c07.h22", 0x08000, 0x176df538, 3 | BRF_GRA }, // 3 + { "799c08.j22", 0x08000, 0xd01e0078, 3 | BRF_GRA }, // 4 + { "799c09.k22", 0x08000, 0x9baec75e, 3 | BRF_GRA }, // 5 + + { "799b04.h4", 0x80000, 0x323e0c2b, 4 | BRF_GRA }, // 6 K051960 Tiles + { "799b05.k4", 0x80000, 0x571c5831, 4 | BRF_GRA }, // 7 + + { "799b03.d4", 0x80000, 0xf1cfd342, 5 | BRF_SND }, // 8 K007232 Samples + + { "799b06.c22", 0x80000, 0x2c8c47d7, 6 | BRF_GRA }, // 9 UPD7759 + + { "63s141n.k14", 0x00100, 0x61f6c8d1, 7 | BRF_OPT }, // 10 Priority Prom +}; + +STD_ROM_PICK(ringohja) +STD_ROM_FN(ringohja) + +struct BurnDriver BurnDrvRingohja = { + "ringohja", "mainevt", NULL, NULL, "1988", + "Ring no Ohja (Japan 2 Players ver. N)\0", NULL, "Konami", "GX799", + L"\u30EA\u30F3\u30B0\u306E \u738B\u8005 (Japan 2 Players ver. N)\0Ring no Ohja\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, ringohjaRomInfo, ringohjaRomName, NULL, NULL, Mainevt2pInputInfo, Mainevt2pDIPInfo, + mainevtInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 288, 224, 4, 3 +}; + + +// Devastators (ver. Z) + +static struct BurnRomInfo devstorsRomDesc[] = { + { "890z02.k11", 0x10000, 0xebeb306f, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code + + { "890k01.f7", 0x08000, 0xd44b3eb0, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "890f06.f22", 0x10000, 0x26592155, 3 | BRF_GRA }, // 2 K052109 Tiles + { "890f07.h22", 0x10000, 0x6c74fa2e, 3 | BRF_GRA }, // 3 + { "890f08.j22", 0x10000, 0x29e12e80, 3 | BRF_GRA }, // 4 + { "890f09.k22", 0x10000, 0x67ca40d5, 3 | BRF_GRA }, // 5 + + { "890f04.h4", 0x80000, 0xf16cd1fa, 4 | BRF_GRA }, // 6 K051960 Tiles + { "890f05.k4", 0x80000, 0xda37db05, 4 | BRF_GRA }, // 7 + + { "890f03.d4", 0x80000, 0x19065031, 6 | BRF_GRA }, // 8 K007232 Samples + + { "63s141n.k14", 0x00100, 0xd3620106, 5 | BRF_OPT }, // 9 Priority Prom +}; + +STD_ROM_PICK(devstors) +STD_ROM_FN(devstors) + +static INT32 devstorsInit() +{ + return DrvInit(1); +} + +struct BurnDriver BurnDrvDevstors = { + "devstors", NULL, NULL, NULL, "1988", + "Devastators (ver. Z)\0", NULL, "Konami", "GX890", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, devstorsRomInfo, devstorsRomName, NULL, NULL, DevstorsInputInfo, DevstorsDIPInfo, + devstorsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 224, 304, 3, 4 +}; + + +// Devastators (ver. X) + +static struct BurnRomInfo devstors2RomDesc[] = { + { "890x02.k11", 0x10000, 0xe58ebb35, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code + + { "890k01.f7", 0x08000, 0xd44b3eb0, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "890f06.f22", 0x10000, 0x26592155, 3 | BRF_GRA }, // 2 K052109 Tiles + { "890f07.h22", 0x10000, 0x6c74fa2e, 3 | BRF_GRA }, // 3 + { "890f08.j22", 0x10000, 0x29e12e80, 3 | BRF_GRA }, // 4 + { "890f09.k22", 0x10000, 0x67ca40d5, 3 | BRF_GRA }, // 5 + + { "890f04.h4", 0x80000, 0xf16cd1fa, 4 | BRF_GRA }, // 6 K051960 Tiles + { "890f05.k4", 0x80000, 0xda37db05, 4 | BRF_GRA }, // 7 + + { "890f03.d4", 0x80000, 0x19065031, 6 | BRF_GRA }, // 8 K007232 Samples + + { "63s141n.k14", 0x00100, 0xd3620106, 5 | BRF_OPT }, // 9 Priority Prom +}; + +STD_ROM_PICK(devstors2) +STD_ROM_FN(devstors2) + +struct BurnDriver BurnDrvDevstors2 = { + "devstors2", "devstors", NULL, NULL, "1988", + "Devastators (ver. X)\0", NULL, "Konami", "GX890", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, devstors2RomInfo, devstors2RomName, NULL, NULL, DevstorsInputInfo, Devstors2DIPInfo, + devstorsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 224, 304, 3, 4 +}; + + +// Devastators (ver. V) + +static struct BurnRomInfo devstors3RomDesc[] = { + { "890k02.k11", 0x10000, 0x52f4ccdd, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code + + { "890k01.f7", 0x08000, 0xd44b3eb0, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "890f06.f22", 0x10000, 0x26592155, 3 | BRF_GRA }, // 2 K052109 Tiles + { "890f07.h22", 0x10000, 0x6c74fa2e, 3 | BRF_GRA }, // 3 + { "890f08.j22", 0x10000, 0x29e12e80, 3 | BRF_GRA }, // 4 + { "890f09.k22", 0x10000, 0x67ca40d5, 3 | BRF_GRA }, // 5 + + { "890f04.h4", 0x80000, 0xf16cd1fa, 4 | BRF_GRA }, // 6 K051960 Tiles + { "890f05.k4", 0x80000, 0xda37db05, 4 | BRF_GRA }, // 7 + + { "890f03.d4", 0x80000, 0x19065031, 6 | BRF_GRA }, // 8 K007232 Samples + + { "63s141n.k14", 0x00100, 0xd3620106, 5 | BRF_OPT }, // 9 Priority Prom +}; + +STD_ROM_PICK(devstors3) +STD_ROM_FN(devstors3) + +struct BurnDriver BurnDrvDevstors3 = { + "devstors3", "devstors", NULL, NULL, "1988", + "Devastators (ver. V)\0", NULL, "Konami", "GX890", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, devstors3RomInfo, devstors3RomName, NULL, NULL, DevstorsInputInfo, DevstorsDIPInfo, + devstorsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 224, 304, 3, 4 +}; + + +// Garuka (Japan ver. W) + +static struct BurnRomInfo garukaRomDesc[] = { + { "890w02.k11", 0x10000, 0xb2f6f538, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code + + { "890k01.f7", 0x08000, 0xd44b3eb0, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "890f06.f22", 0x10000, 0x26592155, 3 | BRF_GRA }, // 2 K052109 Tiles + { "890f07.h22", 0x10000, 0x6c74fa2e, 3 | BRF_GRA }, // 3 + { "890f08.j22", 0x10000, 0x29e12e80, 3 | BRF_GRA }, // 4 + { "890f09.k22", 0x10000, 0x67ca40d5, 3 | BRF_GRA }, // 5 + + { "890f04.h4", 0x80000, 0xf16cd1fa, 4 | BRF_GRA }, // 6 K051960 Tiles + { "890f05.k4", 0x80000, 0xda37db05, 4 | BRF_GRA }, // 7 + + { "890f03.d4", 0x80000, 0x19065031, 6 | BRF_GRA }, // 8 K007232 Samples + + { "63s141n.k14", 0x00100, 0xd3620106, 5 | BRF_OPT }, // 9 Priority Prom +}; + +STD_ROM_PICK(garuka) +STD_ROM_FN(garuka) + +struct BurnDriver BurnDrvGaruka = { + "garuka", "devstors", NULL, NULL, "1988", + "Garuka (Japan ver. W)\0", NULL, "Konami", "GX890", + L"\u9913\u6D41\u798D (Japan ver. W)\0Garuka\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, garukaRomInfo, garukaRomName, NULL, NULL, DevstorsInputInfo, Devstors2DIPInfo, + devstorsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 224, 304, 3, 4 +}; diff --git a/src/burn/drv/konami/d_mogura.cpp b/src/burn/drv/konami/d_mogura.cpp index 4e8088f4e..6c1fdc0a5 100644 --- a/src/burn/drv/konami/d_mogura.cpp +++ b/src/burn/drv/konami/d_mogura.cpp @@ -1,399 +1,398 @@ -// FB Alpha Mogura Desse driver module -// Based on MAME driver by David Haywood - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "dac.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvColPROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvGfxRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvGfxROM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[8] = {0, }; -static UINT8 DrvJoy2[8] = {0, }; -static UINT8 DrvJoy3[8] = {0, }; -static UINT8 DrvJoy4[8] = {0, }; -static UINT8 DrvJoy5[8] = {0, }; -static UINT8 DrvDiag[1] = { 0 }; -static UINT8 DrvReset; -static UINT8 DrvInputs[6] = {0, }; - -static struct BurnInputInfo MoguraInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, - - {"P3 Coin", BIT_DIGITAL, DrvJoy1 + 2, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, DrvJoy4 + 7, "p3 start" }, - {"P3 Up", BIT_DIGITAL, DrvJoy4 + 2, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy4 + 3, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy4 + 0, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy4 + 1, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, DrvJoy4 + 6, "p3 fire 3" }, - - {"P4 Coin", BIT_DIGITAL, DrvJoy1 + 3, "p4 coin" }, - {"P4 Start", BIT_DIGITAL, DrvJoy5 + 7, "p4 start" }, - {"P4 Up", BIT_DIGITAL, DrvJoy5 + 2, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvJoy5 + 3, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvJoy5 + 0, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvJoy5 + 1, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy5 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy5 + 5, "p4 fire 2" }, - {"P4 Button 3", BIT_DIGITAL, DrvJoy5 + 6, "p4 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Diagnostics", BIT_DIGITAL, DrvDiag + 0, "diag" }, - {"Service 1", BIT_DIGITAL, DrvJoy1 + 4, "service" }, - {"Service 2", BIT_DIGITAL, DrvJoy1 + 5, "service2" }, - {"Service 3", BIT_DIGITAL, DrvJoy1 + 6, "service3" }, - {"Service 4", BIT_DIGITAL, DrvJoy1 + 7, "service4" }, -}; - -STDINPUTINFO(Mogura) - -inline void MoguraClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvTileDecode(INT32 offset, INT32 data) -{ - UINT8 *tile = DrvGfxROM + (offset << 2); - - tile[0] = (data >> 6) & 3; - tile[1] = (data >> 4) & 3; - tile[2] = (data >> 2) & 3; - tile[3] = (data >> 0) & 3; -} - -void __fastcall mogura_write(UINT16 address, UINT8 data) -{ - if ((address & 0xf000) == 0xe000) { - DrvGfxRAM[address & 0xfff] = data; - DrvTileDecode(address & 0xfff, data); - return; - } -} - -void __fastcall mogura_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x14: - DACWrite(0, (data & 0xf0)); - DACWrite(1, (data & 0x0f) << 4); - return; - } -} - -UINT8 __fastcall mogura_read_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x08: - return DrvInputs[0]; - - case 0x0c: - return ~DrvInputs[1]; - - case 0x0d: - return ~DrvInputs[2]; - - case 0x0e: - return ~DrvInputs[3]; - - case 0x0f: - return ~DrvInputs[4]; - - case 0x10: - return ~DrvInputs[5]; - } - - return 0; -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0; i < 0x20; i++) - { - INT32 bit0,bit1,bit2,r,g,b; - - bit0 = (DrvColPROM[i] >> 0) & 0x01; - bit1 = (DrvColPROM[i] >> 1) & 0x01; - bit2 = (DrvColPROM[i] >> 2) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (DrvColPROM[i] >> 3) & 0x01; - bit1 = (DrvColPROM[i] >> 4) & 0x01; - bit2 = (DrvColPROM[i] >> 5) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = 0; - bit1 = (DrvColPROM[i] >> 6) & 0x01; - bit2 = (DrvColPROM[i] >> 7) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - DrvPalette[((i & 7) << 2) | ((i >> 3) & 3)] = BurnHighCol(r, g, b, 0); - } -} - -static INT32 moguraDACSync() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (3000000.0000 / (nBurnFPS / 100.0000)))); -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - DACReset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x008000; - DrvColPROM = Next; Next += 0x000020; - - DrvPalette = (UINT32*)Next; Next += 0x0020 * sizeof(UINT32); - - AllRam = Next; - - DrvGfxROM = Next; Next += 0x004000; - DrvGfxRAM = Next; Next += 0x001000; - - DrvVidRAM = Next; Next += 0x001000; - - DrvZ80RAM = Next; Next += 0x002000; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM, 0, 1)) return 1; - - if (BurnLoadRom(DrvColPROM, 1, 1)) return 1; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM); - ZetMapArea(0xe000, 0xefff, 0, DrvGfxRAM); -// ZetMapArea(0xe000, 0xefff, 1, DrvGfxRAM); - ZetMapArea(0xe000, 0xefff, 2, DrvGfxRAM); - ZetMapArea(0xf000, 0xffff, 0, DrvVidRAM); - ZetMapArea(0xf000, 0xffff, 1, DrvVidRAM); - ZetMapArea(0xf000, 0xffff, 2, DrvVidRAM); - ZetSetWriteHandler(mogura_write); - ZetSetOutHandler(mogura_write_port); - ZetSetInHandler(mogura_read_port); - ZetMemEnd(); - ZetClose(); - - DACInit(0, 0, 0, moguraDACSync); - DACInit(1, 0, 0, moguraDACSync); - DACSetRoute(0, 0.50, BURN_SND_ROUTE_LEFT); - DACSetRoute(1, 0.50, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - DACExit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_background() -{ - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = ((offs ^ 0x20) & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - if (sx >= 256) sx ^= 128; - if (sx >= 320) continue; - - INT32 code = DrvVidRAM[offs]; - INT32 color = (DrvVidRAM[offs + 0x800] >> 1) & 7; - - Render8x8Tile(pTransDraw, code, sx, sy, color, 2, 0, DrvGfxROM); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvPaletteInit(); - DrvRecalc = 0; - } - - draw_background(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - DrvInputs[0] = 0xff; - DrvInputs[1] = 0x00; - DrvInputs[2] = 0x00; - DrvInputs[3] = 0x00; - DrvInputs[4] = 0x00; - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] |= (DrvJoy2[i] & 1) << i; - DrvInputs[2] |= (DrvJoy3[i] & 1) << i; - DrvInputs[3] |= (DrvJoy4[i] & 1) << i; - DrvInputs[4] |= (DrvJoy5[i] & 1) << i; - } - - DrvInputs[5] = DrvDiag[0] & 1; - } - - // Clear Opposites - MoguraClearOpposites(&DrvInputs[1]); - MoguraClearOpposites(&DrvInputs[2]); - MoguraClearOpposites(&DrvInputs[3]); - MoguraClearOpposites(&DrvInputs[4]); - - ZetOpen(0); - ZetRun(3000000 / 60); - ZetRaiseIrq(0); - - if (pBurnSoundOut) { - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029698; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - - DACScan(nAction, pnMin); - } - - return 0; -} - - -// Mogura Desse - -static struct BurnRomInfo moguraRomDesc[] = { - { "gx141.5n", 0x8000, 0x98e6120d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - - { "gx141.7j", 0x0020, 0xb21c5d5f, 2 | BRF_GRA }, // 1 Color Prom -}; - -STD_ROM_PICK(mogura) -STD_ROM_FN(mogura) - -struct BurnDriver BurnDrvMogura = { - "mogura", NULL, NULL, NULL, "1991", - "Mogura Desse\0", "Konami test board", "Konami", "Miscellaneous", - L"\u30E2\u30B0\u30E9\u30C7\u30C3\u30BB\0Mogura Desse\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, - NULL, moguraRomInfo, moguraRomName, NULL, NULL, MoguraInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 320, 256, 4, 3 -}; +// FB Alpha Mogura Desse driver module +// Based on MAME driver by David Haywood + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "dac.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvColPROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvGfxRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvGfxROM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[8] = {0, }; +static UINT8 DrvJoy2[8] = {0, }; +static UINT8 DrvJoy3[8] = {0, }; +static UINT8 DrvJoy4[8] = {0, }; +static UINT8 DrvJoy5[8] = {0, }; +static UINT8 DrvDiag[1] = { 0 }; +static UINT8 DrvReset; +static UINT8 DrvInputs[6] = {0, }; + +static struct BurnInputInfo MoguraInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, + + {"P3 Coin", BIT_DIGITAL, DrvJoy1 + 2, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, DrvJoy4 + 7, "p3 start" }, + {"P3 Up", BIT_DIGITAL, DrvJoy4 + 2, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy4 + 3, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy4 + 0, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy4 + 1, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, DrvJoy4 + 6, "p3 fire 3" }, + + {"P4 Coin", BIT_DIGITAL, DrvJoy1 + 3, "p4 coin" }, + {"P4 Start", BIT_DIGITAL, DrvJoy5 + 7, "p4 start" }, + {"P4 Up", BIT_DIGITAL, DrvJoy5 + 2, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvJoy5 + 3, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvJoy5 + 0, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvJoy5 + 1, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy5 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy5 + 5, "p4 fire 2" }, + {"P4 Button 3", BIT_DIGITAL, DrvJoy5 + 6, "p4 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Diagnostics", BIT_DIGITAL, DrvDiag + 0, "diag" }, + {"Service 1", BIT_DIGITAL, DrvJoy1 + 4, "service" }, + {"Service 2", BIT_DIGITAL, DrvJoy1 + 5, "service2" }, + {"Service 3", BIT_DIGITAL, DrvJoy1 + 6, "service3" }, + {"Service 4", BIT_DIGITAL, DrvJoy1 + 7, "service4" }, +}; + +STDINPUTINFO(Mogura) + +inline void MoguraClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvTileDecode(INT32 offset, INT32 data) +{ + UINT8 *tile = DrvGfxROM + (offset << 2); + + tile[0] = (data >> 6) & 3; + tile[1] = (data >> 4) & 3; + tile[2] = (data >> 2) & 3; + tile[3] = (data >> 0) & 3; +} + +void __fastcall mogura_write(UINT16 address, UINT8 data) +{ + if ((address & 0xf000) == 0xe000) { + DrvGfxRAM[address & 0xfff] = data; + DrvTileDecode(address & 0xfff, data); + return; + } +} + +void __fastcall mogura_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x14: + DACWrite(0, (data & 0xf0)); + DACWrite(1, (data & 0x0f) << 4); + return; + } +} + +UINT8 __fastcall mogura_read_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x08: + return DrvInputs[0]; + + case 0x0c: + return ~DrvInputs[1]; + + case 0x0d: + return ~DrvInputs[2]; + + case 0x0e: + return ~DrvInputs[3]; + + case 0x0f: + return ~DrvInputs[4]; + + case 0x10: + return ~DrvInputs[5]; + } + + return 0; +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0; i < 0x20; i++) + { + INT32 bit0,bit1,bit2,r,g,b; + + bit0 = (DrvColPROM[i] >> 0) & 0x01; + bit1 = (DrvColPROM[i] >> 1) & 0x01; + bit2 = (DrvColPROM[i] >> 2) & 0x01; + r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (DrvColPROM[i] >> 3) & 0x01; + bit1 = (DrvColPROM[i] >> 4) & 0x01; + bit2 = (DrvColPROM[i] >> 5) & 0x01; + g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = 0; + bit1 = (DrvColPROM[i] >> 6) & 0x01; + bit2 = (DrvColPROM[i] >> 7) & 0x01; + b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + DrvPalette[((i & 7) << 2) | ((i >> 3) & 3)] = BurnHighCol(r, g, b, 0); + } +} + +static INT32 moguraDACSync() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (3000000.0000 / (nBurnFPS / 100.0000)))); +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + DACReset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x008000; + DrvColPROM = Next; Next += 0x000020; + + DrvPalette = (UINT32*)Next; Next += 0x0020 * sizeof(UINT32); + + AllRam = Next; + + DrvGfxROM = Next; Next += 0x004000; + DrvGfxRAM = Next; Next += 0x001000; + + DrvVidRAM = Next; Next += 0x001000; + + DrvZ80RAM = Next; Next += 0x002000; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM, 0, 1)) return 1; + + if (BurnLoadRom(DrvColPROM, 1, 1)) return 1; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM); + ZetMapArea(0xe000, 0xefff, 0, DrvGfxRAM); +// ZetMapArea(0xe000, 0xefff, 1, DrvGfxRAM); + ZetMapArea(0xe000, 0xefff, 2, DrvGfxRAM); + ZetMapArea(0xf000, 0xffff, 0, DrvVidRAM); + ZetMapArea(0xf000, 0xffff, 1, DrvVidRAM); + ZetMapArea(0xf000, 0xffff, 2, DrvVidRAM); + ZetSetWriteHandler(mogura_write); + ZetSetOutHandler(mogura_write_port); + ZetSetInHandler(mogura_read_port); + ZetClose(); + + DACInit(0, 0, 0, moguraDACSync); + DACInit(1, 0, 0, moguraDACSync); + DACSetRoute(0, 0.50, BURN_SND_ROUTE_LEFT); + DACSetRoute(1, 0.50, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + DACExit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_background() +{ + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = ((offs ^ 0x20) & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + if (sx >= 256) sx ^= 128; + if (sx >= 320) continue; + + INT32 code = DrvVidRAM[offs]; + INT32 color = (DrvVidRAM[offs + 0x800] >> 1) & 7; + + Render8x8Tile(pTransDraw, code, sx, sy, color, 2, 0, DrvGfxROM); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvPaletteInit(); + DrvRecalc = 0; + } + + draw_background(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + DrvInputs[0] = 0xff; + DrvInputs[1] = 0x00; + DrvInputs[2] = 0x00; + DrvInputs[3] = 0x00; + DrvInputs[4] = 0x00; + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] |= (DrvJoy2[i] & 1) << i; + DrvInputs[2] |= (DrvJoy3[i] & 1) << i; + DrvInputs[3] |= (DrvJoy4[i] & 1) << i; + DrvInputs[4] |= (DrvJoy5[i] & 1) << i; + } + + DrvInputs[5] = DrvDiag[0] & 1; + } + + // Clear Opposites + MoguraClearOpposites(&DrvInputs[1]); + MoguraClearOpposites(&DrvInputs[2]); + MoguraClearOpposites(&DrvInputs[3]); + MoguraClearOpposites(&DrvInputs[4]); + + ZetOpen(0); + ZetRun(3000000 / 60); + ZetRaiseIrq(0); + + if (pBurnSoundOut) { + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029698; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + + DACScan(nAction, pnMin); + } + + return 0; +} + + +// Mogura Desse + +static struct BurnRomInfo moguraRomDesc[] = { + { "gx141.5n", 0x8000, 0x98e6120d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + + { "gx141.7j", 0x0020, 0xb21c5d5f, 2 | BRF_GRA }, // 1 Color Prom +}; + +STD_ROM_PICK(mogura) +STD_ROM_FN(mogura) + +struct BurnDriver BurnDrvMogura = { + "mogura", NULL, NULL, NULL, "1991", + "Mogura Desse\0", "Konami test board", "Konami", "Miscellaneous", + L"\u30E2\u30B0\u30E9\u30C7\u30C3\u30BB\0Mogura Desse\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, + NULL, moguraRomInfo, moguraRomName, NULL, NULL, MoguraInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 320, 256, 4, 3 +}; diff --git a/src/burn/drv/konami/d_parodius.cpp b/src/burn/drv/konami/d_parodius.cpp index fe308a3fa..1edb882f5 100644 --- a/src/burn/drv/konami/d_parodius.cpp +++ b/src/burn/drv/konami/d_parodius.cpp @@ -1,801 +1,800 @@ -// FB Alpha Parodius Da! driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "k053260.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM; -static UINT8 *DrvBankRAM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *nDrvRomBank; - -static INT32 layer_colorbase[3]; -static INT32 sprite_colorbase; -static INT32 layerpri[3]; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvReset; -static UINT8 DrvInputs[3]; - -static INT32 nCyclesDone[2]; - -static struct BurnInputInfo ParodiusInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 1, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 4, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 1, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 4, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Diagnostics", BIT_DIGITAL, DrvJoy3 + 1, "diag" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Parodius) - -static struct BurnDIPInfo ParodiusDIPList[]= -{ - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0x5a, NULL }, - {0x17, 0xff, 0xff, 0xf0, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x15, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15, "Coin B" }, - {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x03, "2" }, - {0x16, 0x01, 0x03, 0x02, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "7" }, - -// {0 , 0xfe, 0 , 2, "Cabinet" }, -// {0x16, 0x01, 0x04, 0x00, "Upright" }, -// {0x16, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x16, 0x01, 0x18, 0x18, "20000 80000" }, - {0x16, 0x01, 0x18, 0x10, "30000 100000" }, - {0x16, 0x01, 0x18, 0x08, "20000" }, - {0x16, 0x01, 0x18, 0x00, "70000" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x60, 0x60, "Easy" }, - {0x16, 0x01, 0x60, 0x40, "Normal" }, - {0x16, 0x01, 0x60, 0x20, "Difficult" }, - {0x16, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x17, 0x01, 0x10, 0x10, "Off" }, -// {0x17, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Upright Controls" }, - {0x17, 0x01, 0x20, 0x20, "Single" }, - {0x17, 0x01, 0x20, 0x00, "Dual" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x17, 0x01, 0x40, 0x40, "Off" }, - {0x17, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(Parodius) - -void parodius_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x3fc0: - K052109RMRDLine = data & 0x08; - return; - - case 0x3fc4: - nDrvRomBank[1] = data; - return; - - case 0x3fc8: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - - case 0x3fcc: - case 0x3fcd: - K053260Write(0, address & 1, data); - return; - } - - if ((address & 0xf800) == 0x0000) { - if (nDrvRomBank[1] & 1) { - DrvPalRAM[((nDrvRomBank[1] & 0x04) << 9) + address] = data; - } else { - DrvBankRAM[address] = data; - } - return; - } - - if ((address & 0xfff0) == 0x3fa0) { - K053244Write(0, address & 0x0f, data); - return; - } - - if ((address & 0xfff0) == 0x3fb0) { - K053251Write(address & 0x0f, data); - return; - } - - if ((address & 0xf800) == 0x2000) { - if (nDrvRomBank[1] & 0x02) { - K053245Write(0, address & 0x7ff, data); - return; - } - } - - if (address >= 0x2000 && address <= 0x5fff) { - K052109Write(address - 0x2000, data); - } -} - -UINT8 parodius_main_read(UINT16 address) -{ - switch (address) - { - case 0x3f8c: - return DrvInputs[0]; - - case 0x3f8d: - return DrvInputs[1]; - - case 0x3f8e: - return (DrvDips[2] & 0xf0) | (DrvInputs[2] & 0x0f); - - case 0x3f8f: - return DrvDips[0]; - - case 0x3f90: - return DrvDips[1]; - - case 0x3fc0: // watchdog - return 0; - - case 0x3fcc: - case 0x3fcd: - return K053260Read(0, (address & 1)+2); - } - - if ((address & 0xf800) == 0x0000) { - if (nDrvRomBank[1] & 1) { - return DrvPalRAM[((nDrvRomBank[1] & 0x04) << 9) + address]; - } else { - return DrvBankRAM[address]; - } - } - - if ((address & 0xfff0) == 0x3fa0) { - return K053244Read(0, address & 0x0f); - } - - if ((address & 0xf800) == 0x2000) { - if (nDrvRomBank[1] & 0x02) { - return K053245Read(0, address & 0x7ff); - } - } - - if (address >= 0x2000 && address <= 0x5fff) { - return K052109Read(address - 0x2000); - } - - return 0; -} - -void __fastcall parodius_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf800: - BurnYM2151SelectRegister(data); - return; - - case 0xf801: - BurnYM2151WriteRegister(data); - return; - - case 0xfa00: - nCyclesDone[1] += ZetRun(100); - ZetNmi(); - return; - } - - if (address >= 0xfc00 && address <= 0xfc2f) { - K053260Write(0, address & 0x3f, data); - } -} - -UINT8 __fastcall parodius_sound_read(UINT16 address) -{ - switch (address) - { - case 0xf800: - return 0xff; - case 0xf801: - return BurnYM2151ReadStatus(); - } - - if (address >= 0xfc00 && address <= 0xfc2f) { - if ((address & 0x3e) == 0x00) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - - return K053260Read(0, address & 0x3f); - } - - return 0; -} - -static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *flags, INT32 *) -{ - *flags = (*color & 0x80) >> 7; - *code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13); - *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); -} - -static void K053245Callback(INT32 *code, INT32 *color, INT32 *priority) -{ - INT32 pri = 0x20 | ((*color & 0x60) >> 2); - if (pri <= layerpri[2]) *priority = 0; - else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 1; - else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 2; - else *priority = 3; - - *code &= 0x1fff; - *color = sprite_colorbase + (*color & 0x1f); -} - -static void parodius_set_lines(INT32 lines) -{ - nDrvRomBank[0] = lines; - - konamiMapMemory(DrvKonROM + 0x10000 + ((~lines & 0x0f) * 0x4000), 0x6000, 0x9fff, KON_ROM); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - K053260Reset(0); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x050000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x100000; - DrvGfxROMExp0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x100000; - DrvGfxROMExp1 = Next; Next += 0x200000; - - DrvSndROM = Next; Next += 0x080000; - - Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - - AllRam = Next; - - DrvBankRAM = Next; Next += 0x000800; - DrvKonRAM = Next; Next += 0x001800; - DrvPalRAM = Next; Next += 0x001000; - - DrvZ80RAM = Next; Next += 0x000800; - - nDrvRomBank = Next; Next += 0x000002; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 XOffs[8] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; - INT32 YOffs[8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x100000); - konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); - - GfxDecode(0x8000, 4, 8, 8, Plane, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - - K053245GfxDecode(DrvGfxROM1, DrvGfxROMExp1, 0x100000); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; - if (BurnLoadRom(DrvKonROM + 0x030000, 1, 1)) return 1; - memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x48000, 0x8000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 6, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 7, 1)) return 1; - - DrvGfxDecode(); - } - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvKonRAM, 0x0800, 0x1fff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x9fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x0a000, 0xa000, 0xffff, KON_ROM); - konamiSetWriteHandler(parodius_main_write); - konamiSetReadHandler(parodius_main_read); - konamiSetlinesCallback(parodius_set_lines); - konamiClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(parodius_sound_write); - ZetSetReadHandler(parodius_sound_read); - ZetMemEnd(); - ZetClose(); - - K052109Init(DrvGfxROM0, 0xfffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(8, 0); - - K053245Init(0, DrvGfxROM1, 0xfffff, K053245Callback); - K053245SetSpriteOffset(0, -112, -16); - - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - K053260Init(0, 3579545, DrvSndROM, 0x80000); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - konamiExit(); - ZetExit(); - - BurnYM2151Exit(); - K053260Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void sortlayers(INT32 *layer,INT32 *pri) -{ -#define SWAP(a,b) \ - if (pri[a] < pri[b]) \ - { \ - INT32 t; \ - t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ - t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ - } - - SWAP(0,1) - SWAP(0,2) - SWAP(1,2) -} - -static void DrvRecalcPal() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x1000 / 2; i++) { - UINT16 d = (BURN_ENDIAN_SWAP_INT16(p[i]) << 8) | (BURN_ENDIAN_SWAP_INT16(p[i]) >> 8); - - b = (d >> 10) & 0x1f; - g = (d >> 5) & 0x1f; - r = (d >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - Palette[i] = (r << 16) | (g << 8) | b; - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvRecalcPal(); - } - - K052109UpdateScroll(); - - INT32 bg_colorbase, layer[3]; - - bg_colorbase = K053251GetPaletteIndex(0); - sprite_colorbase = K053251GetPaletteIndex(1); - layer_colorbase[0] = K053251GetPaletteIndex(2); - layer_colorbase[1] = K053251GetPaletteIndex(4); - layer_colorbase[2] = K053251GetPaletteIndex(3); - - layerpri[0] = K053251GetPriority(2); - layerpri[1] = K053251GetPriority(4); - layerpri[2] = K053251GetPriority(3); - layer[0] = 0; - layer[1] = 1; - layer[2] = 2; - - sortlayers(layer,layerpri); - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 16 * bg_colorbase; - } - - if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, DrvGfxROMExp0); - if (nSpriteEnable & 4) K053245SpritesRender(0, DrvGfxROMExp1, 2); // right? - if (nSpriteEnable & 8) K053245SpritesRender(0, DrvGfxROMExp1, 3); - if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0); - if (nSpriteEnable & 2) K053245SpritesRender(0, DrvGfxROMExp1, 1); - if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0); - - if (nSpriteEnable & 1) K053245SpritesRender(0, DrvGfxROMExp1, 0); // used (back)? - - KonamiBlendCopy(Palette, DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - konamiNewFrame(); - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[0] & 0x06) == 0) DrvInputs[0] |= 0x06; - if ((DrvInputs[0] & 0x18) == 0) DrvInputs[0] |= 0x18; - if ((DrvInputs[1] & 0x06) == 0) DrvInputs[1] |= 0x06; - if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18; - } - - INT32 nInterleave = nBurnSoundLen; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 }; - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetOpen(0); - konamiOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext, nCyclesSegment; - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[0]; - nCyclesSegment = konamiRun(nCyclesSegment); - nCyclesDone[0] += nCyclesSegment; - - nNext = (i + 1) * nCyclesTotal[1] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[1]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[1] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K052109_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - } - } - - konamiClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - - KonamiICScan(nAction); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - parodius_set_lines(nDrvRomBank[0]); - konamiClose(); - } - - return 0; -} - - -// Parodius DA! (World, set 1) - -static struct BurnRomInfo parodiusRomDesc[] = { - { "955l01.f5", 0x20000, 0x49a658eb, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "955l02.h5", 0x20000, 0x161d7322, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "955e03.d14", 0x10000, 0x940aa356, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "955d07.k19", 0x80000, 0x89473fec, 3 | BRF_GRA }, // 3 Background Tiles - { "955d08.k24", 0x80000, 0x43d5cda1, 3 | BRF_GRA }, // 4 - - { "955d05.k13", 0x80000, 0x7a1e55e0, 4 | BRF_GRA }, // 5 Sprites - { "955d06.k8", 0x80000, 0xf4252875, 4 | BRF_GRA }, // 6 - - { "955d04.c5", 0x80000, 0xe671491a, 5 | BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(parodius) -STD_ROM_FN(parodius) - -struct BurnDriver BurnDrvParodius = { - "parodius", NULL, NULL, NULL, "1990", - "Parodius DA! (World, set 1)\0", NULL, "Konami", "GX955", - L"Parodius \u30D1\u30ED\u30C7\u30A3\u30A6\u30B9\u3060\uFF01 \uFF0D\u795E\u8A71\u304B\u3089\u304A\u7B11\u3044\u3078\uFF0D (World, set 1)\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, parodiusRomInfo, parodiusRomName, NULL, NULL, ParodiusInputInfo, ParodiusDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// Parodius DA! (World, set 2) - -static struct BurnRomInfo parodiuseRomDesc[] = { - { "2.f5", 0x20000, 0x26a6410b, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "3.h5", 0x20000, 0x9410dbf2, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "955e03.d14", 0x10000, 0x940aa356, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "955d07.k19", 0x80000, 0x89473fec, 3 | BRF_GRA }, // 3 Background Tiles - { "955d08.k24", 0x80000, 0x43d5cda1, 3 | BRF_GRA }, // 4 - - { "955d05.k13", 0x80000, 0x7a1e55e0, 4 | BRF_GRA }, // 5 Sprites - { "955d06.k8", 0x80000, 0xf4252875, 4 | BRF_GRA }, // 6 - - { "955d04.c5", 0x80000, 0xe671491a, 5 | BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(parodiuse) -STD_ROM_FN(parodiuse) - -struct BurnDriver BurnDrvParodiuse = { - "parodiuse", "parodius", NULL, NULL, "1990", - "Parodius DA! (World, set 2)\0", NULL, "Konami", "GX955", - L"Parodius \u30D1\u30ED\u30C7\u30A3\u30A6\u30B9\u3060\uFF01 \uFF0D\u795E\u8A71\u304B\u3089\u304A\u7B11\u3044\u3078\uFF0D (World, set 2)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, parodiuseRomInfo, parodiuseRomName, NULL, NULL, ParodiusInputInfo, ParodiusDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// Parodius DA! (Japan) - -static struct BurnRomInfo parodiusjRomDesc[] = { - { "955e01.f5", 0x20000, 0x49baa334, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "955e02.h5", 0x20000, 0x14010d6f, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "955e03.d14", 0x10000, 0x940aa356, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "955d07.k19", 0x80000, 0x89473fec, 3 | BRF_GRA }, // 3 Background Tiles - { "955d08.k24", 0x80000, 0x43d5cda1, 3 | BRF_GRA }, // 4 - - { "955d05.k13", 0x80000, 0x7a1e55e0, 4 | BRF_GRA }, // 5 Sprites - { "955d06.k8", 0x80000, 0xf4252875, 4 | BRF_GRA }, // 6 - - { "955d04.c5", 0x80000, 0xe671491a, 5 | BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(parodiusj) -STD_ROM_FN(parodiusj) - -struct BurnDriver BurnDrvParodiusj = { - "parodiusj", "parodius", NULL, NULL, "1990", - "Parodius DA! (Japan)\0", NULL, "Konami", "GX955", - L"Parodius \u30D1\u30ED\u30C7\u30A3\u30A6\u30B9\u3060\uFF01 \uFF0D\u795E\u8A71\u304B\u3089\u304A\u7B11\u3044\u3078\uFF0D (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, parodiusjRomInfo, parodiusjRomName, NULL, NULL, ParodiusInputInfo, ParodiusDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// Parodius DA! (Asia) - -static struct BurnRomInfo parodiusaRomDesc[] = { - { "b-18.f5", 0x20000, 0x006356cd, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "b-19.h5", 0x20000, 0xe5a16417, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "955e03.d14", 0x10000, 0x940aa356, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "955d07.k19", 0x80000, 0x89473fec, 3 | BRF_GRA }, // 3 Background Tiles - { "955d08.k24", 0x80000, 0x43d5cda1, 3 | BRF_GRA }, // 4 - - { "955d05.k13", 0x80000, 0x7a1e55e0, 4 | BRF_GRA }, // 5 Sprites - { "955d06.k8", 0x80000, 0xf4252875, 4 | BRF_GRA }, // 6 - - { "955d04.c5", 0x80000, 0xe671491a, 5 | BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(parodiusa) -STD_ROM_FN(parodiusa) - -struct BurnDriver BurnDrvParodiusa = { - "parodiusa", "parodius", NULL, NULL, "1990", - "Parodius DA! (Asia)\0", NULL, "Konami", "GX955", - L"Parodius \u30D1\u30ED\u30C7\u30A3\u30A6\u30B9\u3060\uFF01 \uFF0D\u795E\u8A71\u304B\u3089\u304A\u7B11\u3044\u3078\uFF0D (Asia)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, parodiusaRomInfo, parodiusaRomName, NULL, NULL, ParodiusInputInfo, ParodiusDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; +// FB Alpha Parodius Da! driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "k053260.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM; +static UINT8 *DrvBankRAM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *nDrvRomBank; + +static INT32 layer_colorbase[3]; +static INT32 sprite_colorbase; +static INT32 layerpri[3]; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvReset; +static UINT8 DrvInputs[3]; + +static INT32 nCyclesDone[2]; + +static struct BurnInputInfo ParodiusInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 1, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 4, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 1, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 4, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Diagnostics", BIT_DIGITAL, DrvJoy3 + 1, "diag" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Parodius) + +static struct BurnDIPInfo ParodiusDIPList[]= +{ + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0x5a, NULL }, + {0x17, 0xff, 0xff, 0xf0, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x15, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15, "Coin B" }, + {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x03, "2" }, + {0x16, 0x01, 0x03, 0x02, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "7" }, + +// {0 , 0xfe, 0 , 2, "Cabinet" }, +// {0x16, 0x01, 0x04, 0x00, "Upright" }, +// {0x16, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x16, 0x01, 0x18, 0x18, "20000 80000" }, + {0x16, 0x01, 0x18, 0x10, "30000 100000" }, + {0x16, 0x01, 0x18, 0x08, "20000" }, + {0x16, 0x01, 0x18, 0x00, "70000" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x60, 0x60, "Easy" }, + {0x16, 0x01, 0x60, 0x40, "Normal" }, + {0x16, 0x01, 0x60, 0x20, "Difficult" }, + {0x16, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x17, 0x01, 0x10, 0x10, "Off" }, +// {0x17, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Upright Controls" }, + {0x17, 0x01, 0x20, 0x20, "Single" }, + {0x17, 0x01, 0x20, 0x00, "Dual" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x17, 0x01, 0x40, 0x40, "Off" }, + {0x17, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(Parodius) + +void parodius_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x3fc0: + K052109RMRDLine = data & 0x08; + return; + + case 0x3fc4: + nDrvRomBank[1] = data; + return; + + case 0x3fc8: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + + case 0x3fcc: + case 0x3fcd: + K053260Write(0, address & 1, data); + return; + } + + if ((address & 0xf800) == 0x0000) { + if (nDrvRomBank[1] & 1) { + DrvPalRAM[((nDrvRomBank[1] & 0x04) << 9) + address] = data; + } else { + DrvBankRAM[address] = data; + } + return; + } + + if ((address & 0xfff0) == 0x3fa0) { + K053244Write(0, address & 0x0f, data); + return; + } + + if ((address & 0xfff0) == 0x3fb0) { + K053251Write(address & 0x0f, data); + return; + } + + if ((address & 0xf800) == 0x2000) { + if (nDrvRomBank[1] & 0x02) { + K053245Write(0, address & 0x7ff, data); + return; + } + } + + if (address >= 0x2000 && address <= 0x5fff) { + K052109Write(address - 0x2000, data); + } +} + +UINT8 parodius_main_read(UINT16 address) +{ + switch (address) + { + case 0x3f8c: + return DrvInputs[0]; + + case 0x3f8d: + return DrvInputs[1]; + + case 0x3f8e: + return (DrvDips[2] & 0xf0) | (DrvInputs[2] & 0x0f); + + case 0x3f8f: + return DrvDips[0]; + + case 0x3f90: + return DrvDips[1]; + + case 0x3fc0: // watchdog + return 0; + + case 0x3fcc: + case 0x3fcd: + return K053260Read(0, (address & 1)+2); + } + + if ((address & 0xf800) == 0x0000) { + if (nDrvRomBank[1] & 1) { + return DrvPalRAM[((nDrvRomBank[1] & 0x04) << 9) + address]; + } else { + return DrvBankRAM[address]; + } + } + + if ((address & 0xfff0) == 0x3fa0) { + return K053244Read(0, address & 0x0f); + } + + if ((address & 0xf800) == 0x2000) { + if (nDrvRomBank[1] & 0x02) { + return K053245Read(0, address & 0x7ff); + } + } + + if (address >= 0x2000 && address <= 0x5fff) { + return K052109Read(address - 0x2000); + } + + return 0; +} + +void __fastcall parodius_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf800: + BurnYM2151SelectRegister(data); + return; + + case 0xf801: + BurnYM2151WriteRegister(data); + return; + + case 0xfa00: + nCyclesDone[1] += ZetRun(100); + ZetNmi(); + return; + } + + if (address >= 0xfc00 && address <= 0xfc2f) { + K053260Write(0, address & 0x3f, data); + } +} + +UINT8 __fastcall parodius_sound_read(UINT16 address) +{ + switch (address) + { + case 0xf800: + return 0xff; + case 0xf801: + return BurnYM2151ReadStatus(); + } + + if (address >= 0xfc00 && address <= 0xfc2f) { + if ((address & 0x3e) == 0x00) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + + return K053260Read(0, address & 0x3f); + } + + return 0; +} + +static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *flags, INT32 *) +{ + *flags = (*color & 0x80) >> 7; + *code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13); + *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); +} + +static void K053245Callback(INT32 *code, INT32 *color, INT32 *priority) +{ + INT32 pri = 0x20 | ((*color & 0x60) >> 2); + if (pri <= layerpri[2]) *priority = 0; + else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 1; + else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 2; + else *priority = 3; + + *code &= 0x1fff; + *color = sprite_colorbase + (*color & 0x1f); +} + +static void parodius_set_lines(INT32 lines) +{ + nDrvRomBank[0] = lines; + + konamiMapMemory(DrvKonROM + 0x10000 + ((~lines & 0x0f) * 0x4000), 0x6000, 0x9fff, KON_ROM); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + K053260Reset(0); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x050000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x100000; + DrvGfxROMExp0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x100000; + DrvGfxROMExp1 = Next; Next += 0x200000; + + DrvSndROM = Next; Next += 0x080000; + + Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + + AllRam = Next; + + DrvBankRAM = Next; Next += 0x000800; + DrvKonRAM = Next; Next += 0x001800; + DrvPalRAM = Next; Next += 0x001000; + + DrvZ80RAM = Next; Next += 0x000800; + + nDrvRomBank = Next; Next += 0x000002; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 XOffs[8] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; + INT32 YOffs[8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x100000); + konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); + + GfxDecode(0x8000, 4, 8, 8, Plane, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + + K053245GfxDecode(DrvGfxROM1, DrvGfxROMExp1, 0x100000); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; + if (BurnLoadRom(DrvKonROM + 0x030000, 1, 1)) return 1; + memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x48000, 0x8000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 6, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 7, 1)) return 1; + + DrvGfxDecode(); + } + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvKonRAM, 0x0800, 0x1fff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x9fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x0a000, 0xa000, 0xffff, KON_ROM); + konamiSetWriteHandler(parodius_main_write); + konamiSetReadHandler(parodius_main_read); + konamiSetlinesCallback(parodius_set_lines); + konamiClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(parodius_sound_write); + ZetSetReadHandler(parodius_sound_read); + ZetClose(); + + K052109Init(DrvGfxROM0, 0xfffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(8, 0); + + K053245Init(0, DrvGfxROM1, 0xfffff, K053245Callback); + K053245SetSpriteOffset(0, -112, -16); + + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + K053260Init(0, 3579545, DrvSndROM, 0x80000); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + konamiExit(); + ZetExit(); + + BurnYM2151Exit(); + K053260Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void sortlayers(INT32 *layer,INT32 *pri) +{ +#define SWAP(a,b) \ + if (pri[a] < pri[b]) \ + { \ + INT32 t; \ + t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ + t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ + } + + SWAP(0,1) + SWAP(0,2) + SWAP(1,2) +} + +static void DrvRecalcPal() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x1000 / 2; i++) { + UINT16 d = (BURN_ENDIAN_SWAP_INT16(p[i]) << 8) | (BURN_ENDIAN_SWAP_INT16(p[i]) >> 8); + + b = (d >> 10) & 0x1f; + g = (d >> 5) & 0x1f; + r = (d >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + Palette[i] = (r << 16) | (g << 8) | b; + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvRecalcPal(); + } + + K052109UpdateScroll(); + + INT32 bg_colorbase, layer[3]; + + bg_colorbase = K053251GetPaletteIndex(0); + sprite_colorbase = K053251GetPaletteIndex(1); + layer_colorbase[0] = K053251GetPaletteIndex(2); + layer_colorbase[1] = K053251GetPaletteIndex(4); + layer_colorbase[2] = K053251GetPaletteIndex(3); + + layerpri[0] = K053251GetPriority(2); + layerpri[1] = K053251GetPriority(4); + layerpri[2] = K053251GetPriority(3); + layer[0] = 0; + layer[1] = 1; + layer[2] = 2; + + sortlayers(layer,layerpri); + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 16 * bg_colorbase; + } + + if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, DrvGfxROMExp0); + if (nSpriteEnable & 4) K053245SpritesRender(0, DrvGfxROMExp1, 2); // right? + if (nSpriteEnable & 8) K053245SpritesRender(0, DrvGfxROMExp1, 3); + if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0); + if (nSpriteEnable & 2) K053245SpritesRender(0, DrvGfxROMExp1, 1); + if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0); + + if (nSpriteEnable & 1) K053245SpritesRender(0, DrvGfxROMExp1, 0); // used (back)? + + KonamiBlendCopy(Palette, DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + konamiNewFrame(); + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[0] & 0x06) == 0) DrvInputs[0] |= 0x06; + if ((DrvInputs[0] & 0x18) == 0) DrvInputs[0] |= 0x18; + if ((DrvInputs[1] & 0x06) == 0) DrvInputs[1] |= 0x06; + if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18; + } + + INT32 nInterleave = nBurnSoundLen; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 }; + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetOpen(0); + konamiOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext, nCyclesSegment; + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[0]; + nCyclesSegment = konamiRun(nCyclesSegment); + nCyclesDone[0] += nCyclesSegment; + + nNext = (i + 1) * nCyclesTotal[1] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[1]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[1] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K052109_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + } + } + + konamiClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + + KonamiICScan(nAction); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + parodius_set_lines(nDrvRomBank[0]); + konamiClose(); + } + + return 0; +} + + +// Parodius DA! (World, set 1) + +static struct BurnRomInfo parodiusRomDesc[] = { + { "955l01.f5", 0x20000, 0x49a658eb, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "955l02.h5", 0x20000, 0x161d7322, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "955e03.d14", 0x10000, 0x940aa356, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "955d07.k19", 0x80000, 0x89473fec, 3 | BRF_GRA }, // 3 Background Tiles + { "955d08.k24", 0x80000, 0x43d5cda1, 3 | BRF_GRA }, // 4 + + { "955d05.k13", 0x80000, 0x7a1e55e0, 4 | BRF_GRA }, // 5 Sprites + { "955d06.k8", 0x80000, 0xf4252875, 4 | BRF_GRA }, // 6 + + { "955d04.c5", 0x80000, 0xe671491a, 5 | BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(parodius) +STD_ROM_FN(parodius) + +struct BurnDriver BurnDrvParodius = { + "parodius", NULL, NULL, NULL, "1990", + "Parodius DA! (World, set 1)\0", NULL, "Konami", "GX955", + L"Parodius \u30D1\u30ED\u30C7\u30A3\u30A6\u30B9\u3060\uFF01 \uFF0D\u795E\u8A71\u304B\u3089\u304A\u7B11\u3044\u3078\uFF0D (World, set 1)\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, parodiusRomInfo, parodiusRomName, NULL, NULL, ParodiusInputInfo, ParodiusDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// Parodius DA! (World, set 2) + +static struct BurnRomInfo parodiuseRomDesc[] = { + { "2.f5", 0x20000, 0x26a6410b, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "3.h5", 0x20000, 0x9410dbf2, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "955e03.d14", 0x10000, 0x940aa356, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "955d07.k19", 0x80000, 0x89473fec, 3 | BRF_GRA }, // 3 Background Tiles + { "955d08.k24", 0x80000, 0x43d5cda1, 3 | BRF_GRA }, // 4 + + { "955d05.k13", 0x80000, 0x7a1e55e0, 4 | BRF_GRA }, // 5 Sprites + { "955d06.k8", 0x80000, 0xf4252875, 4 | BRF_GRA }, // 6 + + { "955d04.c5", 0x80000, 0xe671491a, 5 | BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(parodiuse) +STD_ROM_FN(parodiuse) + +struct BurnDriver BurnDrvParodiuse = { + "parodiuse", "parodius", NULL, NULL, "1990", + "Parodius DA! (World, set 2)\0", NULL, "Konami", "GX955", + L"Parodius \u30D1\u30ED\u30C7\u30A3\u30A6\u30B9\u3060\uFF01 \uFF0D\u795E\u8A71\u304B\u3089\u304A\u7B11\u3044\u3078\uFF0D (World, set 2)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, parodiuseRomInfo, parodiuseRomName, NULL, NULL, ParodiusInputInfo, ParodiusDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// Parodius DA! (Japan) + +static struct BurnRomInfo parodiusjRomDesc[] = { + { "955e01.f5", 0x20000, 0x49baa334, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "955e02.h5", 0x20000, 0x14010d6f, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "955e03.d14", 0x10000, 0x940aa356, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "955d07.k19", 0x80000, 0x89473fec, 3 | BRF_GRA }, // 3 Background Tiles + { "955d08.k24", 0x80000, 0x43d5cda1, 3 | BRF_GRA }, // 4 + + { "955d05.k13", 0x80000, 0x7a1e55e0, 4 | BRF_GRA }, // 5 Sprites + { "955d06.k8", 0x80000, 0xf4252875, 4 | BRF_GRA }, // 6 + + { "955d04.c5", 0x80000, 0xe671491a, 5 | BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(parodiusj) +STD_ROM_FN(parodiusj) + +struct BurnDriver BurnDrvParodiusj = { + "parodiusj", "parodius", NULL, NULL, "1990", + "Parodius DA! (Japan)\0", NULL, "Konami", "GX955", + L"Parodius \u30D1\u30ED\u30C7\u30A3\u30A6\u30B9\u3060\uFF01 \uFF0D\u795E\u8A71\u304B\u3089\u304A\u7B11\u3044\u3078\uFF0D (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, parodiusjRomInfo, parodiusjRomName, NULL, NULL, ParodiusInputInfo, ParodiusDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// Parodius DA! (Asia) + +static struct BurnRomInfo parodiusaRomDesc[] = { + { "b-18.f5", 0x20000, 0x006356cd, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "b-19.h5", 0x20000, 0xe5a16417, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "955e03.d14", 0x10000, 0x940aa356, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "955d07.k19", 0x80000, 0x89473fec, 3 | BRF_GRA }, // 3 Background Tiles + { "955d08.k24", 0x80000, 0x43d5cda1, 3 | BRF_GRA }, // 4 + + { "955d05.k13", 0x80000, 0x7a1e55e0, 4 | BRF_GRA }, // 5 Sprites + { "955d06.k8", 0x80000, 0xf4252875, 4 | BRF_GRA }, // 6 + + { "955d04.c5", 0x80000, 0xe671491a, 5 | BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(parodiusa) +STD_ROM_FN(parodiusa) + +struct BurnDriver BurnDrvParodiusa = { + "parodiusa", "parodius", NULL, NULL, "1990", + "Parodius DA! (Asia)\0", NULL, "Konami", "GX955", + L"Parodius \u30D1\u30ED\u30C7\u30A3\u30A6\u30B9\u3060\uFF01 \uFF0D\u795E\u8A71\u304B\u3089\u304A\u7B11\u3044\u3078\uFF0D (Asia)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, parodiusaRomInfo, parodiusaRomName, NULL, NULL, ParodiusInputInfo, ParodiusDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_pooyan.cpp b/src/burn/drv/konami/d_pooyan.cpp index 652fdfc84..29eefe42e 100644 --- a/src/burn/drv/konami/d_pooyan.cpp +++ b/src/burn/drv/konami/d_pooyan.cpp @@ -1,757 +1,755 @@ -// FB Alpha Pooyan Driver Module -// Based on MAME driver by Allard van der Bas, Mike Cuddy, Nicola Salmoria, Martin Binder, and Marco Cassili - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *Mem, *MemEnd; -static UINT8 *Rom0, *Rom1, *Gfx0, *Gfx1, *Prom; -static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvDips[2], DrvReset; -static UINT32 *Palette, *DrvPalette; -static UINT8 DrvRecalcPalette; - -static INT16 *pFMBuffer; -static INT16 *pAY8910Buffer[6]; - -static UINT8 irqtrigger; -static UINT8 irq_enable; -static UINT8 flipscreen; -static UINT8 soundlatch; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 3, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 3, "p1 down" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, - - {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 1, "p2 coin" }, - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 4, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 3, "p2 down" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, - - {"Service" , BIT_DIGITAL , DrvJoy1 + 2, "service" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x0c, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x0c, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x0c, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x0c, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x0c, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x0c, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x0c, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x0c, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x0c, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x0c, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x0c, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x0c, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x0c, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x0c, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x0c, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x0c, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15 , "Coin B" }, - {0x0c, 0x82, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - {0x0c, 0x82, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x0c, 0x00, 0x0f, 0x00, NULL }, - - // Default Values - {0x0d, 0xff, 0xff, 0x7b, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0d, 0x01, 0x03, 0x03, "3" }, - {0x0d, 0x01, 0x03, 0x02, "4" }, - {0x0d, 0x01, 0x03, 0x01, "5" }, - {0x0d, 0x01, 0x03, 0x00, "256" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x04, 0x00, "Upright" }, - {0x0d, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0d, 0x01, 0x08, 0x08, "50K 80K+" }, - {0x0d, 0x01, 0x08, 0x00, "30K 70K+" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x0d, 0x01, 0x70, 0x70, "1 (Easy)" }, - {0x0d, 0x01, 0x70, 0x60, "2" }, - {0x0d, 0x01, 0x70, 0x50, "3" }, - {0x0d, 0x01, 0x70, 0x40, "4" }, - {0x0d, 0x01, 0x70, 0x30, "5" }, - {0x0d, 0x01, 0x70, 0x20, "6" }, - {0x0d, 0x01, 0x70, 0x10, "7" }, - {0x0d, 0x01, 0x70, 0x00, "8 (Hard)" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x80, 0x80, "Off" }, - {0x0d, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Drv) - -UINT8 __fastcall pooyan_cpu0_read(UINT16 address) -{ - UINT8 ret = 0xff; - - switch (address) - { - case 0xa000: - return DrvDips[1]; - - case 0xa080: - { - for (INT32 i = 0; i < 8; i++) { - ret ^= DrvJoy1[i] << i; - } - - return ret; - } - - case 0xa0a0: - { - for (INT32 i = 0; i < 8; i++) { - ret ^= DrvJoy2[i] << i; - } - - return ret; - } - - case 0xa0c0: - { - for (INT32 i = 0; i < 8; i++) { - ret ^= DrvJoy3[i] << i; - } - - return ret; - } - - case 0xa0e0: - return DrvDips[0]; - - } - - return 0; -} - -void __fastcall pooyan_cpu0_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xa000: - // watchdog - break; - - case 0xa100: - soundlatch = data; - break; - - case 0xa180: - irq_enable = data & 1; - - if (!irq_enable) - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - break; - - case 0xa181: - { - if (irqtrigger == 0 && data) { - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - ZetOpen(0); - } - - irqtrigger = data; - } - break; - - case 0xa183: - break; - - case 0xa187: - flipscreen = ~data & 1; - break; - } -} - -UINT8 __fastcall pooyan_cpu1_read(UINT16 address) -{ - switch (address & 0xf000) - { - case 0x4000: - return AY8910Read(0); - - case 0x6000: - return AY8910Read(1); - } - - return 0; -} - -void __fastcall pooyan_cpu1_write(UINT16 address, UINT8 data) -{ - switch (address & 0xf000) - { - case 0x4000: - AY8910Write(0, 1, data); - break; - - case 0x5000: - AY8910Write(0, 0, data); - break; - - case 0x6000: - AY8910Write(1, 1, data); - break; - - case 0x7000: - AY8910Write(1, 0, data); - break; - - case 0x8000: - case 0x9000: - case 0xa000: - case 0xb000: - case 0xc000: - case 0xd000: - case 0xe000: - case 0xf000: - // timeplt_filter_w - break; - } -} - -static UINT8 AY8910_0_port0(UINT32) -{ - return soundlatch; -} - -static UINT8 AY8910_0_port1(UINT32) -{ - static INT32 timeplt_timer[10] = - { - 0x00, 0x10, 0x20, 0x30, 0x40, 0x90, 0xa0, 0xb0, 0xa0, 0xd0 - }; - - return timeplt_timer[(ZetTotalCycles() >> 9) % 10]; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - AY8910Reset(0); - AY8910Reset(1); - - memset (Rom0 + 0x8000, 0, 0x1800); - memset (Rom1 + 0x3000, 0, 0x0400); - - irqtrigger = 0; - flipscreen = 0; - soundlatch = 0; - irq_enable = 0; - - return 0; -} - -static void DrvPaletteInit() -{ - INT32 i; - UINT32 c_pal[0x20]; - - for (i = 0; i < 0x20; i++) - { - INT32 r, g, b; - INT32 bit0, bit1, bit2; - - bit0 = (Prom[i] >> 0) & 0x01; - bit1 = (Prom[i] >> 1) & 0x01; - bit2 = (Prom[i] >> 2) & 0x01; - r = 33 * bit0 + 71 * bit1 + 151 * bit2; - - bit0 = (Prom[i] >> 3) & 0x01; - bit1 = (Prom[i] >> 4) & 0x01; - bit2 = (Prom[i] >> 5) & 0x01; - g = 33 * bit0 + 71 * bit1 + 151 * bit2; - - bit0 = (Prom[i] >> 6) & 0x01; - bit1 = (Prom[i] >> 7) & 0x01; - b = 80 * bit0 + 171 * bit1; - - c_pal[i] = (r << 16) | (g << 8) | b; - } - - for (i = 0; i < 0x100; i++) - { - Palette[i + 0x000] = c_pal[(Prom[i + 0x020] & 0x0f) | 0x10]; - Palette[i + 0x100] = c_pal[(Prom[i + 0x120] & 0x0f) | 0x00]; - } -} - -static INT32 DrvGfxDecode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x2000); - if (!tmp) return 1; - - static INT32 Planes[4] = { 0x8004, 0x8000, 4, 0 }; - static INT32 XOffs[16] = { 0, 1, 2, 3, 0x40, 0x41, 0x42, 0x43, 0x80, 0x81, 0x82, 0x83, 0xc0, 0xc1, 0xc2, 0xc3 }; - static INT32 YOffs[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 256, 264, 272, 280, 288, 296, 304, 312 }; - - memcpy (tmp, Gfx0, 0x2000); - - GfxDecode(0x100, 4, 8, 8, Planes, XOffs, YOffs, 0x080, tmp, Gfx0); - - memcpy (tmp, Gfx1, 0x2000); - - GfxDecode(0x40, 4, 16, 16, Planes, XOffs, YOffs, 0x200, tmp, Gfx1); - - BurnFree(tmp); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Rom0 = Next; Next += 0x10000; - Rom1 = Next; Next += 0x04000; - Gfx0 = Next; Next += 0x04000; - Gfx1 = Next; Next += 0x04000; - Prom = Next; Next += 0x00220; - - Palette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); - - pFMBuffer = (INT16 *)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - - { - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(Rom0 + i * 0x2000, 0 + i, 1)) return 1; - } - - for (INT32 i = 0; i < 2; i++) { - if (BurnLoadRom(Rom1 + i * 0x1000, 4 + i, 1)) return 1; - if (BurnLoadRom(Gfx0 + i * 0x1000, 6 + i, 1)) return 1; - if (BurnLoadRom(Gfx1 + i * 0x1000, 8 + i, 1)) return 1; - } - - if (BurnLoadRom(Prom + 0x000, 10, 1)) return 1; - if (BurnLoadRom(Prom + 0x020, 11, 1)) return 1; - if (BurnLoadRom(Prom + 0x120, 12, 1)) return 1; - - if (DrvGfxDecode()) return 1; - DrvPaletteInit(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, Rom0 + 0x0000); - ZetMapArea(0x0000, 0x7fff, 2, Rom0 + 0x0000); - ZetMapArea(0x8000, 0x8fff, 0, Rom0 + 0x8000); - ZetMapArea(0x8000, 0x8fff, 1, Rom0 + 0x8000); - ZetMapArea(0x8000, 0x8fff, 2, Rom0 + 0x8000); - ZetMapArea(0x9000, 0x90ff, 0, Rom0 + 0x9000); - ZetMapArea(0x9000, 0x90ff, 1, Rom0 + 0x9000); - ZetMapArea(0x9000, 0x90ff, 2, Rom0 + 0x9000); - ZetMapArea(0x9400, 0x94ff, 0, Rom0 + 0x9400); - ZetMapArea(0x9400, 0x94ff, 1, Rom0 + 0x9400); - ZetMapArea(0x9400, 0x94ff, 2, Rom0 + 0x9400); - ZetSetWriteHandler(pooyan_cpu0_write); - ZetSetReadHandler(pooyan_cpu0_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMemEnd(); - ZetMapArea(0x0000, 0x1fff, 0, Rom1 + 0x0000); - ZetMapArea(0x0000, 0x1fff, 2, Rom1 + 0x0000); - ZetMapArea(0x3000, 0x33ff, 0, Rom1 + 0x3000); - ZetMapArea(0x3000, 0x33ff, 1, Rom1 + 0x3000); - ZetMapArea(0x3000, 0x33ff, 2, Rom1 + 0x3000); - ZetSetWriteHandler(pooyan_cpu1_write); - ZetSetReadHandler(pooyan_cpu1_read); - ZetClose(); - - GenericTilesInit(); - - AY8910Init(0, 1789773, nBurnSoundRate, &AY8910_0_port0, &AY8910_0_port1, NULL, NULL); - AY8910Init(1, 1789773, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - AY8910Exit(0); - AY8910Exit(1); - - GenericTilesExit(); - - BurnFree (Mem); - - Mem = MemEnd = NULL; - Rom0 = Rom1 = Gfx0 = Gfx1 = Prom = NULL; - - Palette = DrvPalette = NULL; - pFMBuffer = NULL; - - for (INT32 i = 0; i < 6; i++) { - pAY8910Buffer[i] = NULL; - } - - irqtrigger = 0; - irq_enable = 0; - flipscreen = 0; - soundlatch = 0; - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalcPalette) { - for (INT32 i = 0; i < 0x200; i++) { - UINT32 col = Palette[i]; - DrvPalette[i] = BurnHighCol(col >> 16, col >> 8, col, 0); - } - } - - for (INT32 i = 0; i < 0x0400; i++) - { - INT32 attr = Rom0[0x8000 + i]; - INT32 code = Rom0[0x8400 + i]; - INT32 color = attr & 0x0f; - INT32 flipx = (attr >> 6) & 1; - INT32 flipy = (attr >> 7) & 1; - - INT32 sx = (i << 3) & 0xf8; - INT32 sy = (i >> 2) & 0xf8; - - if (flipscreen) { - sx ^= 0xf8; - sy ^= 0xf8; - flipx ^= 1; - flipy ^= 1; - } - - if (sy > 239 || sy < 16) continue; - sy -= 16; - - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } else { - Render8x8Tile_FlipY(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } - } else { - if (flipx) { - Render8x8Tile_FlipX(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } else { - Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } - } - } - - for (INT32 i = 0x10; i < 0x40; i += 2) - { - INT32 sx = Rom0[0x9000 + i]; - INT32 sy = 240 - Rom0[0x9401 + i]; - - INT32 code = Rom0[0x9001 + i] & 0x3f; - INT32 color = (Rom0[0x9400 + i] & 0x0f) | 0x10; - INT32 flipx = ~Rom0[0x9400 + i] & 0x40; - INT32 flipy = Rom0[0x9400 + i] & 0x80; - - if (sy == 0 || sy >= 240) continue; - - sy -= 16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, Gfx1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, Gfx1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, Gfx1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, Gfx1); - } - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - INT32 nInterleave = 10; - - INT32 nCyclesSegment; - INT32 nCyclesTotal[2], nCyclesDone[2]; - - nCyclesTotal[0] = 3072000 / 60; - nCyclesTotal[1] = 1789773 / 60; - - nCyclesDone[0] = nCyclesDone[1] = 0; - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (irq_enable && i == (nInterleave - 1)) ZetNmi(); - ZetClose(); - - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - ZetClose(); - } - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = Rom0 + 0x8000; - ba.nLen = 0x1800; - ba.szName = "Cpu #0 Ram"; - BurnAcb(&ba); - - ba.Data = Rom1 + 0x3000; - ba.nLen = 0x0400; - ba.szName = "Cpu #1 Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - AY8910Scan(nAction, pnMin); - - SCAN_VAR(soundlatch); - SCAN_VAR(irqtrigger); - SCAN_VAR(irq_enable); - SCAN_VAR(flipscreen); - } - - return 0; -} - - -// Pooyan - -static struct BurnRomInfo pooyanRomDesc[] = { - { "1.4a", 0x2000, 0xbb319c63, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "2.5a", 0x2000, 0xa1463d98, 1 | BRF_PRG | BRF_ESS }, // 1 - { "3.6a", 0x2000, 0xfe1a9e08, 1 | BRF_PRG | BRF_ESS }, // 2 - { "4.7a", 0x2000, 0x9e0f9bcc, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "xx.7a", 0x1000, 0xfbe2b368, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code - { "xx.8a", 0x1000, 0xe1795b3d, 2 | BRF_PRG | BRF_ESS }, // 5 - - { "8.10g", 0x1000, 0x931b29eb, 3 | BRF_GRA }, // 6 Characters - { "7.9g", 0x1000, 0xbbe6d6e4, 3 | BRF_GRA }, // 7 - - { "6.9a", 0x1000, 0xb2d8c121, 4 | BRF_GRA }, // 8 Sprites - { "5.8a", 0x1000, 0x1097c2b6, 4 | BRF_GRA }, // 9 - - { "pooyan.pr1", 0x0020, 0xa06a6d0e, 5 | BRF_GRA }, // 10 Color Proms - { "pooyan.pr3", 0x0100, 0x8cd4cd60, 5 | BRF_GRA }, // 11 - { "pooyan.pr2", 0x0100, 0x82748c0b, 5 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(pooyan) -STD_ROM_FN(pooyan) - -struct BurnDriver BurnDrvPooyan = { - "pooyan", NULL, NULL, NULL, "1982", - "Pooyan\0", NULL, "Konami", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, - NULL, pooyanRomInfo, pooyanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPalette, 0x200, - 224, 256, 3, 4 -}; - - -// Pooyan (Stern) - -static struct BurnRomInfo pooyansRomDesc[] = { - { "ic22_a4.cpu", 0x2000, 0x916ae7d7, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "ic23_a5.cpu", 0x2000, 0x8fe38c61, 1 | BRF_PRG | BRF_ESS }, // 1 - { "ic24_a6.cpu", 0x2000, 0x2660218a, 1 | BRF_PRG | BRF_ESS }, // 2 - { "ic25_a7.cpu", 0x2000, 0x3d2a10ad, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "xx.7a", 0x1000, 0xfbe2b368, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code - { "xx.8a", 0x1000, 0xe1795b3d, 2 | BRF_PRG | BRF_ESS }, // 5 - - { "ic13_g10.cpu", 0x1000, 0x7433aea9, 3 | BRF_GRA }, // 6 Characters - { "ic14_g9.cpu", 0x1000, 0x87c1789e, 3 | BRF_GRA }, // 7 - - { "6.9a", 0x1000, 0xb2d8c121, 4 | BRF_GRA }, // 8 Sprites - { "5.8a", 0x1000, 0x1097c2b6, 4 | BRF_GRA }, // 9 - - { "pooyan.pr1", 0x0020, 0xa06a6d0e, 5 | BRF_GRA }, // 10 Color Proms - { "pooyan.pr3", 0x0100, 0x8cd4cd60, 5 | BRF_GRA }, // 11 - { "pooyan.pr2", 0x0100, 0x82748c0b, 5 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(pooyans) -STD_ROM_FN(pooyans) - -struct BurnDriver BurnDrvPooyans = { - "pooyans", "pooyan", NULL, NULL, "1982", - "Pooyan (Stern)\0", NULL, "[Konami] (Stern license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, - NULL, pooyansRomInfo, pooyansRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPalette, 0x200, - 224, 256, 3, 4 -}; - - -// Pootan - -static struct BurnRomInfo pootanRomDesc[] = { - { "poo_ic22.bin", 0x2000, 0x41b23a24, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "poo_ic23.bin", 0x2000, 0xc9d94661, 1 | BRF_PRG | BRF_ESS }, // 1 - { "3.6a", 0x2000, 0xfe1a9e08, 1 | BRF_PRG | BRF_ESS }, // 2 - { "poo_ic25.bin", 0x2000, 0x8ae459ef, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "xx.7a", 0x1000, 0xfbe2b368, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code - { "xx.8a", 0x1000, 0xe1795b3d, 2 | BRF_PRG | BRF_ESS }, // 5 - - { "poo_ic13.bin", 0x1000, 0x0be802e4, 3 | BRF_GRA }, // 6 Characters - { "poo_ic14.bin", 0x1000, 0xcba29096, 3 | BRF_GRA }, // 7 - - { "6.9a", 0x1000, 0xb2d8c121, 4 | BRF_GRA }, // 8 Sprites - { "5.8a", 0x1000, 0x1097c2b6, 4 | BRF_GRA }, // 9 - - { "pooyan.pr1", 0x0020, 0xa06a6d0e, 5 | BRF_GRA }, // 10 Color Proms - { "pooyan.pr3", 0x0100, 0x8cd4cd60, 5 | BRF_GRA }, // 11 - { "pooyan.pr2", 0x0100, 0x82748c0b, 5 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(pootan) -STD_ROM_FN(pootan) - -struct BurnDriver BurnDrvPootan = { - "pootan", "pooyan", NULL, NULL, "1982", - "Pootan\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, - NULL, pootanRomInfo, pootanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPalette, 0x200, - 224, 256, 3, 4 -}; - +// FB Alpha Pooyan Driver Module +// Based on MAME driver by Allard van der Bas, Mike Cuddy, Nicola Salmoria, Martin Binder, and Marco Cassili + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *Mem, *MemEnd; +static UINT8 *Rom0, *Rom1, *Gfx0, *Gfx1, *Prom; +static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvDips[2], DrvReset; +static UINT32 *Palette, *DrvPalette; +static UINT8 DrvRecalcPalette; + +static INT16 *pFMBuffer; +static INT16 *pAY8910Buffer[6]; + +static UINT8 irqtrigger; +static UINT8 irq_enable; +static UINT8 flipscreen; +static UINT8 soundlatch; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 3, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 3, "p1 down" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, + + {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 1, "p2 coin" }, + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 4, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 3, "p2 down" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, + + {"Service" , BIT_DIGITAL , DrvJoy1 + 2, "service" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x0c, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x0c, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x0c, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x0c, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x0c, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x0c, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x0c, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x0c, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x0c, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x0c, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x0c, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x0c, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x0c, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x0c, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x0c, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x0c, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15 , "Coin B" }, + {0x0c, 0x82, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + {0x0c, 0x82, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x0c, 0x00, 0x0f, 0x00, NULL }, + + // Default Values + {0x0d, 0xff, 0xff, 0x7b, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0d, 0x01, 0x03, 0x03, "3" }, + {0x0d, 0x01, 0x03, 0x02, "4" }, + {0x0d, 0x01, 0x03, 0x01, "5" }, + {0x0d, 0x01, 0x03, 0x00, "256" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x04, 0x00, "Upright" }, + {0x0d, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0d, 0x01, 0x08, 0x08, "50K 80K+" }, + {0x0d, 0x01, 0x08, 0x00, "30K 70K+" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x0d, 0x01, 0x70, 0x70, "1 (Easy)" }, + {0x0d, 0x01, 0x70, 0x60, "2" }, + {0x0d, 0x01, 0x70, 0x50, "3" }, + {0x0d, 0x01, 0x70, 0x40, "4" }, + {0x0d, 0x01, 0x70, 0x30, "5" }, + {0x0d, 0x01, 0x70, 0x20, "6" }, + {0x0d, 0x01, 0x70, 0x10, "7" }, + {0x0d, 0x01, 0x70, 0x00, "8 (Hard)" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x80, 0x80, "Off" }, + {0x0d, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Drv) + +UINT8 __fastcall pooyan_cpu0_read(UINT16 address) +{ + UINT8 ret = 0xff; + + switch (address) + { + case 0xa000: + return DrvDips[1]; + + case 0xa080: + { + for (INT32 i = 0; i < 8; i++) { + ret ^= DrvJoy1[i] << i; + } + + return ret; + } + + case 0xa0a0: + { + for (INT32 i = 0; i < 8; i++) { + ret ^= DrvJoy2[i] << i; + } + + return ret; + } + + case 0xa0c0: + { + for (INT32 i = 0; i < 8; i++) { + ret ^= DrvJoy3[i] << i; + } + + return ret; + } + + case 0xa0e0: + return DrvDips[0]; + + } + + return 0; +} + +void __fastcall pooyan_cpu0_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xa000: + // watchdog + break; + + case 0xa100: + soundlatch = data; + break; + + case 0xa180: + irq_enable = data & 1; + + if (!irq_enable) + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + break; + + case 0xa181: + { + if (irqtrigger == 0 && data) { + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + ZetOpen(0); + } + + irqtrigger = data; + } + break; + + case 0xa183: + break; + + case 0xa187: + flipscreen = ~data & 1; + break; + } +} + +UINT8 __fastcall pooyan_cpu1_read(UINT16 address) +{ + switch (address & 0xf000) + { + case 0x4000: + return AY8910Read(0); + + case 0x6000: + return AY8910Read(1); + } + + return 0; +} + +void __fastcall pooyan_cpu1_write(UINT16 address, UINT8 data) +{ + switch (address & 0xf000) + { + case 0x4000: + AY8910Write(0, 1, data); + break; + + case 0x5000: + AY8910Write(0, 0, data); + break; + + case 0x6000: + AY8910Write(1, 1, data); + break; + + case 0x7000: + AY8910Write(1, 0, data); + break; + + case 0x8000: + case 0x9000: + case 0xa000: + case 0xb000: + case 0xc000: + case 0xd000: + case 0xe000: + case 0xf000: + // timeplt_filter_w + break; + } +} + +static UINT8 AY8910_0_port0(UINT32) +{ + return soundlatch; +} + +static UINT8 AY8910_0_port1(UINT32) +{ + static INT32 timeplt_timer[10] = + { + 0x00, 0x10, 0x20, 0x30, 0x40, 0x90, 0xa0, 0xb0, 0xa0, 0xd0 + }; + + return timeplt_timer[(ZetTotalCycles() >> 9) % 10]; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + AY8910Reset(0); + AY8910Reset(1); + + memset (Rom0 + 0x8000, 0, 0x1800); + memset (Rom1 + 0x3000, 0, 0x0400); + + irqtrigger = 0; + flipscreen = 0; + soundlatch = 0; + irq_enable = 0; + + return 0; +} + +static void DrvPaletteInit() +{ + INT32 i; + UINT32 c_pal[0x20]; + + for (i = 0; i < 0x20; i++) + { + INT32 r, g, b; + INT32 bit0, bit1, bit2; + + bit0 = (Prom[i] >> 0) & 0x01; + bit1 = (Prom[i] >> 1) & 0x01; + bit2 = (Prom[i] >> 2) & 0x01; + r = 33 * bit0 + 71 * bit1 + 151 * bit2; + + bit0 = (Prom[i] >> 3) & 0x01; + bit1 = (Prom[i] >> 4) & 0x01; + bit2 = (Prom[i] >> 5) & 0x01; + g = 33 * bit0 + 71 * bit1 + 151 * bit2; + + bit0 = (Prom[i] >> 6) & 0x01; + bit1 = (Prom[i] >> 7) & 0x01; + b = 80 * bit0 + 171 * bit1; + + c_pal[i] = (r << 16) | (g << 8) | b; + } + + for (i = 0; i < 0x100; i++) + { + Palette[i + 0x000] = c_pal[(Prom[i + 0x020] & 0x0f) | 0x10]; + Palette[i + 0x100] = c_pal[(Prom[i + 0x120] & 0x0f) | 0x00]; + } +} + +static INT32 DrvGfxDecode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x2000); + if (!tmp) return 1; + + static INT32 Planes[4] = { 0x8004, 0x8000, 4, 0 }; + static INT32 XOffs[16] = { 0, 1, 2, 3, 0x40, 0x41, 0x42, 0x43, 0x80, 0x81, 0x82, 0x83, 0xc0, 0xc1, 0xc2, 0xc3 }; + static INT32 YOffs[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 256, 264, 272, 280, 288, 296, 304, 312 }; + + memcpy (tmp, Gfx0, 0x2000); + + GfxDecode(0x100, 4, 8, 8, Planes, XOffs, YOffs, 0x080, tmp, Gfx0); + + memcpy (tmp, Gfx1, 0x2000); + + GfxDecode(0x40, 4, 16, 16, Planes, XOffs, YOffs, 0x200, tmp, Gfx1); + + BurnFree(tmp); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Rom0 = Next; Next += 0x10000; + Rom1 = Next; Next += 0x04000; + Gfx0 = Next; Next += 0x04000; + Gfx1 = Next; Next += 0x04000; + Prom = Next; Next += 0x00220; + + Palette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); + + pFMBuffer = (INT16 *)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + + { + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(Rom0 + i * 0x2000, 0 + i, 1)) return 1; + } + + for (INT32 i = 0; i < 2; i++) { + if (BurnLoadRom(Rom1 + i * 0x1000, 4 + i, 1)) return 1; + if (BurnLoadRom(Gfx0 + i * 0x1000, 6 + i, 1)) return 1; + if (BurnLoadRom(Gfx1 + i * 0x1000, 8 + i, 1)) return 1; + } + + if (BurnLoadRom(Prom + 0x000, 10, 1)) return 1; + if (BurnLoadRom(Prom + 0x020, 11, 1)) return 1; + if (BurnLoadRom(Prom + 0x120, 12, 1)) return 1; + + if (DrvGfxDecode()) return 1; + DrvPaletteInit(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, Rom0 + 0x0000); + ZetMapArea(0x0000, 0x7fff, 2, Rom0 + 0x0000); + ZetMapArea(0x8000, 0x8fff, 0, Rom0 + 0x8000); + ZetMapArea(0x8000, 0x8fff, 1, Rom0 + 0x8000); + ZetMapArea(0x8000, 0x8fff, 2, Rom0 + 0x8000); + ZetMapArea(0x9000, 0x90ff, 0, Rom0 + 0x9000); + ZetMapArea(0x9000, 0x90ff, 1, Rom0 + 0x9000); + ZetMapArea(0x9000, 0x90ff, 2, Rom0 + 0x9000); + ZetMapArea(0x9400, 0x94ff, 0, Rom0 + 0x9400); + ZetMapArea(0x9400, 0x94ff, 1, Rom0 + 0x9400); + ZetMapArea(0x9400, 0x94ff, 2, Rom0 + 0x9400); + ZetSetWriteHandler(pooyan_cpu0_write); + ZetSetReadHandler(pooyan_cpu0_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x1fff, 0, Rom1 + 0x0000); + ZetMapArea(0x0000, 0x1fff, 2, Rom1 + 0x0000); + ZetMapArea(0x3000, 0x33ff, 0, Rom1 + 0x3000); + ZetMapArea(0x3000, 0x33ff, 1, Rom1 + 0x3000); + ZetMapArea(0x3000, 0x33ff, 2, Rom1 + 0x3000); + ZetSetWriteHandler(pooyan_cpu1_write); + ZetSetReadHandler(pooyan_cpu1_read); + ZetClose(); + + GenericTilesInit(); + + AY8910Init(0, 1789773, nBurnSoundRate, &AY8910_0_port0, &AY8910_0_port1, NULL, NULL); + AY8910Init(1, 1789773, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + AY8910Exit(0); + AY8910Exit(1); + + GenericTilesExit(); + + BurnFree (Mem); + + Mem = MemEnd = NULL; + Rom0 = Rom1 = Gfx0 = Gfx1 = Prom = NULL; + + Palette = DrvPalette = NULL; + pFMBuffer = NULL; + + for (INT32 i = 0; i < 6; i++) { + pAY8910Buffer[i] = NULL; + } + + irqtrigger = 0; + irq_enable = 0; + flipscreen = 0; + soundlatch = 0; + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalcPalette) { + for (INT32 i = 0; i < 0x200; i++) { + UINT32 col = Palette[i]; + DrvPalette[i] = BurnHighCol(col >> 16, col >> 8, col, 0); + } + } + + for (INT32 i = 0; i < 0x0400; i++) + { + INT32 attr = Rom0[0x8000 + i]; + INT32 code = Rom0[0x8400 + i]; + INT32 color = attr & 0x0f; + INT32 flipx = (attr >> 6) & 1; + INT32 flipy = (attr >> 7) & 1; + + INT32 sx = (i << 3) & 0xf8; + INT32 sy = (i >> 2) & 0xf8; + + if (flipscreen) { + sx ^= 0xf8; + sy ^= 0xf8; + flipx ^= 1; + flipy ^= 1; + } + + if (sy > 239 || sy < 16) continue; + sy -= 16; + + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } else { + Render8x8Tile_FlipY(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } + } else { + if (flipx) { + Render8x8Tile_FlipX(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } else { + Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } + } + } + + for (INT32 i = 0x10; i < 0x40; i += 2) + { + INT32 sx = Rom0[0x9000 + i]; + INT32 sy = 240 - Rom0[0x9401 + i]; + + INT32 code = Rom0[0x9001 + i] & 0x3f; + INT32 color = (Rom0[0x9400 + i] & 0x0f) | 0x10; + INT32 flipx = ~Rom0[0x9400 + i] & 0x40; + INT32 flipy = Rom0[0x9400 + i] & 0x80; + + if (sy == 0 || sy >= 240) continue; + + sy -= 16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, Gfx1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, Gfx1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, Gfx1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, Gfx1); + } + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + INT32 nInterleave = 10; + + INT32 nCyclesSegment; + INT32 nCyclesTotal[2], nCyclesDone[2]; + + nCyclesTotal[0] = 3072000 / 60; + nCyclesTotal[1] = 1789773 / 60; + + nCyclesDone[0] = nCyclesDone[1] = 0; + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (irq_enable && i == (nInterleave - 1)) ZetNmi(); + ZetClose(); + + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + ZetClose(); + } + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = Rom0 + 0x8000; + ba.nLen = 0x1800; + ba.szName = "Cpu #0 Ram"; + BurnAcb(&ba); + + ba.Data = Rom1 + 0x3000; + ba.nLen = 0x0400; + ba.szName = "Cpu #1 Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + AY8910Scan(nAction, pnMin); + + SCAN_VAR(soundlatch); + SCAN_VAR(irqtrigger); + SCAN_VAR(irq_enable); + SCAN_VAR(flipscreen); + } + + return 0; +} + + +// Pooyan + +static struct BurnRomInfo pooyanRomDesc[] = { + { "1.4a", 0x2000, 0xbb319c63, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "2.5a", 0x2000, 0xa1463d98, 1 | BRF_PRG | BRF_ESS }, // 1 + { "3.6a", 0x2000, 0xfe1a9e08, 1 | BRF_PRG | BRF_ESS }, // 2 + { "4.7a", 0x2000, 0x9e0f9bcc, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "xx.7a", 0x1000, 0xfbe2b368, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code + { "xx.8a", 0x1000, 0xe1795b3d, 2 | BRF_PRG | BRF_ESS }, // 5 + + { "8.10g", 0x1000, 0x931b29eb, 3 | BRF_GRA }, // 6 Characters + { "7.9g", 0x1000, 0xbbe6d6e4, 3 | BRF_GRA }, // 7 + + { "6.9a", 0x1000, 0xb2d8c121, 4 | BRF_GRA }, // 8 Sprites + { "5.8a", 0x1000, 0x1097c2b6, 4 | BRF_GRA }, // 9 + + { "pooyan.pr1", 0x0020, 0xa06a6d0e, 5 | BRF_GRA }, // 10 Color Proms + { "pooyan.pr3", 0x0100, 0x8cd4cd60, 5 | BRF_GRA }, // 11 + { "pooyan.pr2", 0x0100, 0x82748c0b, 5 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(pooyan) +STD_ROM_FN(pooyan) + +struct BurnDriver BurnDrvPooyan = { + "pooyan", NULL, NULL, NULL, "1982", + "Pooyan\0", NULL, "Konami", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, + NULL, pooyanRomInfo, pooyanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPalette, 0x200, + 224, 256, 3, 4 +}; + + +// Pooyan (Stern) + +static struct BurnRomInfo pooyansRomDesc[] = { + { "ic22_a4.cpu", 0x2000, 0x916ae7d7, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "ic23_a5.cpu", 0x2000, 0x8fe38c61, 1 | BRF_PRG | BRF_ESS }, // 1 + { "ic24_a6.cpu", 0x2000, 0x2660218a, 1 | BRF_PRG | BRF_ESS }, // 2 + { "ic25_a7.cpu", 0x2000, 0x3d2a10ad, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "xx.7a", 0x1000, 0xfbe2b368, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code + { "xx.8a", 0x1000, 0xe1795b3d, 2 | BRF_PRG | BRF_ESS }, // 5 + + { "ic13_g10.cpu", 0x1000, 0x7433aea9, 3 | BRF_GRA }, // 6 Characters + { "ic14_g9.cpu", 0x1000, 0x87c1789e, 3 | BRF_GRA }, // 7 + + { "6.9a", 0x1000, 0xb2d8c121, 4 | BRF_GRA }, // 8 Sprites + { "5.8a", 0x1000, 0x1097c2b6, 4 | BRF_GRA }, // 9 + + { "pooyan.pr1", 0x0020, 0xa06a6d0e, 5 | BRF_GRA }, // 10 Color Proms + { "pooyan.pr3", 0x0100, 0x8cd4cd60, 5 | BRF_GRA }, // 11 + { "pooyan.pr2", 0x0100, 0x82748c0b, 5 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(pooyans) +STD_ROM_FN(pooyans) + +struct BurnDriver BurnDrvPooyans = { + "pooyans", "pooyan", NULL, NULL, "1982", + "Pooyan (Stern)\0", NULL, "[Konami] (Stern license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, + NULL, pooyansRomInfo, pooyansRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPalette, 0x200, + 224, 256, 3, 4 +}; + + +// Pootan + +static struct BurnRomInfo pootanRomDesc[] = { + { "poo_ic22.bin", 0x2000, 0x41b23a24, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "poo_ic23.bin", 0x2000, 0xc9d94661, 1 | BRF_PRG | BRF_ESS }, // 1 + { "3.6a", 0x2000, 0xfe1a9e08, 1 | BRF_PRG | BRF_ESS }, // 2 + { "poo_ic25.bin", 0x2000, 0x8ae459ef, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "xx.7a", 0x1000, 0xfbe2b368, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code + { "xx.8a", 0x1000, 0xe1795b3d, 2 | BRF_PRG | BRF_ESS }, // 5 + + { "poo_ic13.bin", 0x1000, 0x0be802e4, 3 | BRF_GRA }, // 6 Characters + { "poo_ic14.bin", 0x1000, 0xcba29096, 3 | BRF_GRA }, // 7 + + { "6.9a", 0x1000, 0xb2d8c121, 4 | BRF_GRA }, // 8 Sprites + { "5.8a", 0x1000, 0x1097c2b6, 4 | BRF_GRA }, // 9 + + { "pooyan.pr1", 0x0020, 0xa06a6d0e, 5 | BRF_GRA }, // 10 Color Proms + { "pooyan.pr3", 0x0100, 0x8cd4cd60, 5 | BRF_GRA }, // 11 + { "pooyan.pr2", 0x0100, 0x82748c0b, 5 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(pootan) +STD_ROM_FN(pootan) + +struct BurnDriver BurnDrvPootan = { + "pootan", "pooyan", NULL, NULL, "1982", + "Pootan\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, + NULL, pootanRomInfo, pootanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalcPalette, 0x200, + 224, 256, 3, 4 +}; + diff --git a/src/burn/drv/konami/d_rollerg.cpp b/src/burn/drv/konami/d_rollerg.cpp index 222d1f1ce..a23539dac 100644 --- a/src/burn/drv/konami/d_rollerg.cpp +++ b/src/burn/drv/konami/d_rollerg.cpp @@ -1,642 +1,641 @@ -// FB Alpha Roller Games driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "k053260.h" - -static UINT8 *AllMem; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static INT32 readzoomroms; -static UINT8 *nDrvBank; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo RollergInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 5, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 6, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 5, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 4, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 6, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 4, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 7, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Rollerg) - -static struct BurnDIPInfo RollergDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x56, NULL }, - {0x14, 0xff, 0xff, 0x0f, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x12, 0x01, 0xf0, 0x00, "No Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x03, "1" }, - {0x13, 0x01, 0x03, 0x02, "2" }, - {0x13, 0x01, 0x03, 0x01, "3" }, - {0x13, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Bonus Energy" }, - {0x13, 0x01, 0x18, 0x00, "1/2 for Stage Winner" }, - {0x13, 0x01, 0x18, 0x08, "1/4 for Stage Winner" }, - {0x13, 0x01, 0x18, 0x10, "1/4 for Cycle Winner" }, - {0x13, 0x01, 0x18, 0x18, "None" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Hard" }, - {0x13, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x01, 0x01, "Off" }, -// {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Rollerg) - -void rollerg_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x0010: - readzoomroms = data & 0x04; - K051316WrapEnable(0, data & 0x20); - return; - - case 0x0020: - // watchdog - return; - - case 0x0030: - case 0x0031: - K053260Write(0, address & 1, data); - return; - - case 0x0040: - ZetSetVector(0xff); - // ZetRaiseIrq(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - } - - if ((address & 0xfff0) == 0x0200) { - K051316WriteCtrl(0, address & 0x0f, data); - return; - } - - if ((address & 0xfff0) == 0x0300) { - K053244Write(0, address & 0x0f, data); - return; - } - - if ((address & 0xf800) == 0x0800) { - K051316Write(0, address & 0x7ff, data); - return; - } - - if ((address & 0xf800) == 0x1000) { - K053245Write(0, address & 0x7ff, data); - return; - } -} - -UINT8 rollerg_main_read(UINT16 address) -{ - switch (address) - { - case 0x0020: // watchdog - return 0; - - case 0x0030: - case 0x0031: - return K053260Read(0, (address & 1)+2); - - case 0x0050: - return DrvInputs[0]; - - case 0x0051: - return DrvInputs[1]; - - case 0x0052: - return (DrvInputs[2] & 0xf0) | (DrvDips[2] & 0x0f); - - case 0x0053: - return DrvDips[0]; - - case 0x0060: - return DrvDips[1]; - - case 0x0061: - return 0x7f; - } - - if ((address & 0xfff0) == 0x0300) { - return K053244Read(0, address & 0x0f); - } - - if ((address & 0xf800) == 0x0800) { - if (readzoomroms) - return K051316ReadRom(0, address & 0x7ff); - else - return K051316Read(0, address & 0x7ff); - } - - if ((address & 0xf800) == 0x1000) { - return K053245Read(0, address & 0x7ff); - } - - return 0; -} - -void __fastcall rollerg_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc000: - case 0xc001: - BurnYM3812Write(address & 1, data); - return; - - case 0xfc00: - ZetRun(100); - ZetNmi(); - return; - } - - if (address >= 0xa000 && address <= 0xa02f) { - K053260Write(0, address & 0x3f, data); - return; - } -} - -UINT8 __fastcall rollerg_sound_read(UINT16 address) -{ - switch (address) - { - case 0xc000: - case 0xc001: - return BurnYM3812Read(address & 1); - } - - if (address >= 0xa000 && address <= 0xa02f) { - // not sure... - if ((address & 0x3e) == 0x00) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - - return K053260Read(0, address & 0x3f); - } - - return 0; -} - -static void rollerg_set_lines(INT32 lines) -{ - nDrvBank[0] = lines; - - INT32 offs = 0x10000 + ((lines & 0x07) * 0x4000); - - konamiMapMemory(DrvKonROM + offs, 0x4000, 0x7fff, KON_ROM); -} - -static void K053245Callback(INT32 *, INT32 *color, INT32 *priority) -{ - *priority = *color & 0x10; - *color = 16 + (*color & 0x0f); -} - -static void K051316Callback(INT32 *code, INT32 *color, INT32 *flags) -{ - *flags = (*color & 0xc0) >> 6; - *code |= ((*color & 0x0f) << 8); - *color = ((*color & 0x30) >> 4); -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3579545; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - K053260Reset(0); - BurnYM3812Reset(); - - KonamiICReset(); - - readzoomroms = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x030000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x080000; - DrvGfxROMExp0 = Next; Next += 0x400000; - DrvGfxROMExp1 = Next; Next += 0x100000; - - DrvSndROM = Next; Next += 0x080000; - - Palette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); - - AllRam = Next; - - DrvKonRAM = Next; Next += 0x001b00; - DrvPalRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - nDrvBank = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; - memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x28000, 0x8000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 5, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 6, 1)) return 1; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x200000); - - K053245GfxDecode(DrvGfxROM0, DrvGfxROMExp0, 0x200000); - } - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvPalRAM, 0x1800, 0x1fff, KON_RAM); - konamiMapMemory(DrvKonRAM, 0x2000, 0x3aff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x4000, 0x4000, 0x7fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x8000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(rollerg_main_write); - konamiSetReadHandler(rollerg_main_read); - konamiSetlinesCallback(rollerg_set_lines); - konamiClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(rollerg_sound_write); - ZetSetReadHandler(rollerg_sound_read); - ZetMemEnd(); - ZetClose(); - - K053245Init(0, DrvGfxROM0, 0x1fffff, K053245Callback); - K053245SetSpriteOffset(0, -112, 17); - - K051316Init(0, DrvGfxROM1, DrvGfxROMExp1, 0x7ffff, K051316Callback, 4, 0); - K051316SetOffset(0, -90, -15); - - BurnYM3812Init(3579545, NULL, DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3812(3579545); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - K053260Init(0, 3579545, DrvSndROM, 0x80000); - K053260PCMSetAllRoutes(0, 0.70, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - konamiExit(); - ZetExit(); - - BurnYM3812Exit(); - K053260Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void DrvRecalcPal() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x800 / 2; i++) { - UINT16 d = (p[i] << 8) | (p[i] >> 8); - - b = (d >> 10) & 0x1f; - g = (d >> 5) & 0x1f; - r = (d >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - Palette[i] = (r << 16) | (g << 8) | b; - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvRecalcPal(); - } - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x100; - } - - K053245SpritesRender(0, DrvGfxROMExp0, 0x00); - K051316_zoom_draw(0, 1); - K053245SpritesRender(0, DrvGfxROMExp0, 0x10); - - KonamiBlendCopy(Palette, DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - konamiNewFrame(); - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[0] & 0x18) == 0) DrvInputs[0] |= 0x18; - if ((DrvInputs[0] & 0x60) == 0) DrvInputs[0] |= 0x60; - if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18; - if ((DrvInputs[1] & 0x60) == 0) DrvInputs[1] |= 0x60; - } - - INT32 nInterleave = nBurnSoundLen; - INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetOpen(0); - konamiOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext, nCyclesSegment; - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[0]; - nCyclesSegment = konamiRun(nCyclesSegment); - nCyclesDone[0] += nCyclesSegment; - - BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); - } - - konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - K053260Update(0, pBurnSoundOut, nBurnSoundLen); - } - - konamiClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - ZetScan(nAction); - - BurnYM3812Scan(nAction, pnMin); - K053260Scan(nAction); - - KonamiICScan(nAction); - - SCAN_VAR(readzoomroms); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - rollerg_set_lines(nDrvBank[0]); - konamiClose(); - } - - return 0; -} - - -// Rollergames (US) - -static struct BurnRomInfo rollergRomDesc[] = { - { "999m02.g7", 0x020000, 0x3df8db93, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "999m01.e11", 0x008000, 0x1fcfb22f, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "999h06.k2", 0x100000, 0xeda05130, 3 | BRF_GRA }, // 2 K053245 Tiles - { "999h05.k8", 0x100000, 0x5f321c7d, 3 | BRF_GRA }, // 3 - - { "999h03.d23", 0x040000, 0xea1edbd2, 4 | BRF_GRA }, // 4 K051316 Tiles - { "999h04.f23", 0x040000, 0xc1a35355, 4 | BRF_GRA }, // 5 - - { "999h09.c5", 0x080000, 0xc5188783, 5 | BRF_SND }, // 6 K053260 Samples -}; - -STD_ROM_PICK(rollerg) -STD_ROM_FN(rollerg) - -struct BurnDriver BurnDrvRollerg = { - "rollerg", NULL, NULL, NULL, "1991", - "Rollergames (US)\0", NULL, "Konami", "GX999", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, rollergRomInfo, rollergRomName, NULL, NULL, RollergInputInfo, RollergDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; - - -// Rollergames (Japan) - -static struct BurnRomInfo rollergjRomDesc[] = { - { "999v02.bin", 0x020000, 0x0dd8c3ac, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "999m01.e11", 0x008000, 0x1fcfb22f, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "999h06.k2", 0x100000, 0xeda05130, 3 | BRF_GRA }, // 2 K053245 Tiles - { "999h05.k8", 0x100000, 0x5f321c7d, 3 | BRF_GRA }, // 3 - - { "999h03.d23", 0x040000, 0xea1edbd2, 4 | BRF_GRA }, // 4 K051316 Tiles - { "999h04.f23", 0x040000, 0xc1a35355, 4 | BRF_GRA }, // 5 - - { "999h09.c5", 0x080000, 0xc5188783, 5 | BRF_SND }, // 6 K053260 Samples -}; - -STD_ROM_PICK(rollergj) -STD_ROM_FN(rollergj) - -struct BurnDriver BurnDrvRollergj = { - "rollergj", "rollerg", NULL, NULL, "1991", - "Rollergames (Japan)\0", NULL, "Konami", "GX999", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, rollergjRomInfo, rollergjRomName, NULL, NULL, RollergInputInfo, RollergDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; +// FB Alpha Roller Games driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "k053260.h" + +static UINT8 *AllMem; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static INT32 readzoomroms; +static UINT8 *nDrvBank; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo RollergInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 5, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 6, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 5, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 4, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 6, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 4, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 7, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Rollerg) + +static struct BurnDIPInfo RollergDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x56, NULL }, + {0x14, 0xff, 0xff, 0x0f, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x12, 0x01, 0xf0, 0x00, "No Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x03, "1" }, + {0x13, 0x01, 0x03, 0x02, "2" }, + {0x13, 0x01, 0x03, 0x01, "3" }, + {0x13, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Bonus Energy" }, + {0x13, 0x01, 0x18, 0x00, "1/2 for Stage Winner" }, + {0x13, 0x01, 0x18, 0x08, "1/4 for Stage Winner" }, + {0x13, 0x01, 0x18, 0x10, "1/4 for Cycle Winner" }, + {0x13, 0x01, 0x18, 0x18, "None" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Hard" }, + {0x13, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x01, 0x01, "Off" }, +// {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Rollerg) + +void rollerg_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x0010: + readzoomroms = data & 0x04; + K051316WrapEnable(0, data & 0x20); + return; + + case 0x0020: + // watchdog + return; + + case 0x0030: + case 0x0031: + K053260Write(0, address & 1, data); + return; + + case 0x0040: + ZetSetVector(0xff); + // ZetRaiseIrq(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + } + + if ((address & 0xfff0) == 0x0200) { + K051316WriteCtrl(0, address & 0x0f, data); + return; + } + + if ((address & 0xfff0) == 0x0300) { + K053244Write(0, address & 0x0f, data); + return; + } + + if ((address & 0xf800) == 0x0800) { + K051316Write(0, address & 0x7ff, data); + return; + } + + if ((address & 0xf800) == 0x1000) { + K053245Write(0, address & 0x7ff, data); + return; + } +} + +UINT8 rollerg_main_read(UINT16 address) +{ + switch (address) + { + case 0x0020: // watchdog + return 0; + + case 0x0030: + case 0x0031: + return K053260Read(0, (address & 1)+2); + + case 0x0050: + return DrvInputs[0]; + + case 0x0051: + return DrvInputs[1]; + + case 0x0052: + return (DrvInputs[2] & 0xf0) | (DrvDips[2] & 0x0f); + + case 0x0053: + return DrvDips[0]; + + case 0x0060: + return DrvDips[1]; + + case 0x0061: + return 0x7f; + } + + if ((address & 0xfff0) == 0x0300) { + return K053244Read(0, address & 0x0f); + } + + if ((address & 0xf800) == 0x0800) { + if (readzoomroms) + return K051316ReadRom(0, address & 0x7ff); + else + return K051316Read(0, address & 0x7ff); + } + + if ((address & 0xf800) == 0x1000) { + return K053245Read(0, address & 0x7ff); + } + + return 0; +} + +void __fastcall rollerg_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc000: + case 0xc001: + BurnYM3812Write(address & 1, data); + return; + + case 0xfc00: + ZetRun(100); + ZetNmi(); + return; + } + + if (address >= 0xa000 && address <= 0xa02f) { + K053260Write(0, address & 0x3f, data); + return; + } +} + +UINT8 __fastcall rollerg_sound_read(UINT16 address) +{ + switch (address) + { + case 0xc000: + case 0xc001: + return BurnYM3812Read(address & 1); + } + + if (address >= 0xa000 && address <= 0xa02f) { + // not sure... + if ((address & 0x3e) == 0x00) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + + return K053260Read(0, address & 0x3f); + } + + return 0; +} + +static void rollerg_set_lines(INT32 lines) +{ + nDrvBank[0] = lines; + + INT32 offs = 0x10000 + ((lines & 0x07) * 0x4000); + + konamiMapMemory(DrvKonROM + offs, 0x4000, 0x7fff, KON_ROM); +} + +static void K053245Callback(INT32 *, INT32 *color, INT32 *priority) +{ + *priority = *color & 0x10; + *color = 16 + (*color & 0x0f); +} + +static void K051316Callback(INT32 *code, INT32 *color, INT32 *flags) +{ + *flags = (*color & 0xc0) >> 6; + *code |= ((*color & 0x0f) << 8); + *color = ((*color & 0x30) >> 4); +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3579545; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + K053260Reset(0); + BurnYM3812Reset(); + + KonamiICReset(); + + readzoomroms = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x030000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x080000; + DrvGfxROMExp0 = Next; Next += 0x400000; + DrvGfxROMExp1 = Next; Next += 0x100000; + + DrvSndROM = Next; Next += 0x080000; + + Palette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); + + AllRam = Next; + + DrvKonRAM = Next; Next += 0x001b00; + DrvPalRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + nDrvBank = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; + memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x28000, 0x8000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 5, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 6, 1)) return 1; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x200000); + + K053245GfxDecode(DrvGfxROM0, DrvGfxROMExp0, 0x200000); + } + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvPalRAM, 0x1800, 0x1fff, KON_RAM); + konamiMapMemory(DrvKonRAM, 0x2000, 0x3aff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x4000, 0x4000, 0x7fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x8000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(rollerg_main_write); + konamiSetReadHandler(rollerg_main_read); + konamiSetlinesCallback(rollerg_set_lines); + konamiClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(rollerg_sound_write); + ZetSetReadHandler(rollerg_sound_read); + ZetClose(); + + K053245Init(0, DrvGfxROM0, 0x1fffff, K053245Callback); + K053245SetSpriteOffset(0, -112, 17); + + K051316Init(0, DrvGfxROM1, DrvGfxROMExp1, 0x7ffff, K051316Callback, 4, 0); + K051316SetOffset(0, -90, -15); + + BurnYM3812Init(3579545, NULL, DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3812(3579545); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + K053260Init(0, 3579545, DrvSndROM, 0x80000); + K053260PCMSetAllRoutes(0, 0.70, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + konamiExit(); + ZetExit(); + + BurnYM3812Exit(); + K053260Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void DrvRecalcPal() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x800 / 2; i++) { + UINT16 d = (p[i] << 8) | (p[i] >> 8); + + b = (d >> 10) & 0x1f; + g = (d >> 5) & 0x1f; + r = (d >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + Palette[i] = (r << 16) | (g << 8) | b; + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvRecalcPal(); + } + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x100; + } + + K053245SpritesRender(0, DrvGfxROMExp0, 0x00); + K051316_zoom_draw(0, 1); + K053245SpritesRender(0, DrvGfxROMExp0, 0x10); + + KonamiBlendCopy(Palette, DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + konamiNewFrame(); + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[0] & 0x18) == 0) DrvInputs[0] |= 0x18; + if ((DrvInputs[0] & 0x60) == 0) DrvInputs[0] |= 0x60; + if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18; + if ((DrvInputs[1] & 0x60) == 0) DrvInputs[1] |= 0x60; + } + + INT32 nInterleave = nBurnSoundLen; + INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetOpen(0); + konamiOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext, nCyclesSegment; + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[0]; + nCyclesSegment = konamiRun(nCyclesSegment); + nCyclesDone[0] += nCyclesSegment; + + BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); + } + + konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + K053260Update(0, pBurnSoundOut, nBurnSoundLen); + } + + konamiClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + ZetScan(nAction); + + BurnYM3812Scan(nAction, pnMin); + K053260Scan(nAction); + + KonamiICScan(nAction); + + SCAN_VAR(readzoomroms); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + rollerg_set_lines(nDrvBank[0]); + konamiClose(); + } + + return 0; +} + + +// Rollergames (US) + +static struct BurnRomInfo rollergRomDesc[] = { + { "999m02.g7", 0x020000, 0x3df8db93, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "999m01.e11", 0x008000, 0x1fcfb22f, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "999h06.k2", 0x100000, 0xeda05130, 3 | BRF_GRA }, // 2 K053245 Tiles + { "999h05.k8", 0x100000, 0x5f321c7d, 3 | BRF_GRA }, // 3 + + { "999h03.d23", 0x040000, 0xea1edbd2, 4 | BRF_GRA }, // 4 K051316 Tiles + { "999h04.f23", 0x040000, 0xc1a35355, 4 | BRF_GRA }, // 5 + + { "999h09.c5", 0x080000, 0xc5188783, 5 | BRF_SND }, // 6 K053260 Samples +}; + +STD_ROM_PICK(rollerg) +STD_ROM_FN(rollerg) + +struct BurnDriver BurnDrvRollerg = { + "rollerg", NULL, NULL, NULL, "1991", + "Rollergames (US)\0", NULL, "Konami", "GX999", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, rollergRomInfo, rollergRomName, NULL, NULL, RollergInputInfo, RollergDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; + + +// Rollergames (Japan) + +static struct BurnRomInfo rollergjRomDesc[] = { + { "999v02.bin", 0x020000, 0x0dd8c3ac, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "999m01.e11", 0x008000, 0x1fcfb22f, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "999h06.k2", 0x100000, 0xeda05130, 3 | BRF_GRA }, // 2 K053245 Tiles + { "999h05.k8", 0x100000, 0x5f321c7d, 3 | BRF_GRA }, // 3 + + { "999h03.d23", 0x040000, 0xea1edbd2, 4 | BRF_GRA }, // 4 K051316 Tiles + { "999h04.f23", 0x040000, 0xc1a35355, 4 | BRF_GRA }, // 5 + + { "999h09.c5", 0x080000, 0xc5188783, 5 | BRF_SND }, // 6 K053260 Samples +}; + +STD_ROM_PICK(rollergj) +STD_ROM_FN(rollergj) + +struct BurnDriver BurnDrvRollergj = { + "rollergj", "rollerg", NULL, NULL, "1991", + "Rollergames (Japan)\0", NULL, "Konami", "GX999", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, rollergjRomInfo, rollergjRomName, NULL, NULL, RollergInputInfo, RollergDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_scotrsht.cpp b/src/burn/drv/konami/d_scotrsht.cpp index dd2ddedd4..0d9015ccf 100644 --- a/src/burn/drv/konami/d_scotrsht.cpp +++ b/src/burn/drv/konami/d_scotrsht.cpp @@ -1,651 +1,650 @@ -// FB Alpha Scooter Shooter driver module -// Based on MAME driver by Pierpaolo Prazzoli - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "m6809_intf.h" -#include "burn_ym2203.h" - -static UINT8 *AllMem; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *DrvM6809ROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvColPROM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvColRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *DrvPalette; -static UINT32 *Palette; -static UINT8 DrvRecalc; - -static UINT8 *scroll; - -static UINT8 *soundlatch; -static UINT8 *charbank; -static UINT8 *irq_enable; -static UINT8 *flipscreen; -static UINT8 *palbank; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvReset; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; - -static struct BurnInputInfo ScotrshtInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Scotrsht) - -static struct BurnDIPInfo ScotrshtDIPList[]= -{ - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0x5d, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x10, 0x01, 0x0f, 0x02, "4 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x05, "3 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x10, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x10, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x10, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x10, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x10, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x10, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x10, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x10, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x10, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x10, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x10, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x10, 0x01, 0x0f, 0x00, "Invalid" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x10, 0x01, 0xf0, 0x20, "4 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x50, "3 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x10, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x10, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x10, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x10, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x10, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x10, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x10, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x10, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x10, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x10, 0x01, 0xf0, 0x00, "Invalid" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x11, 0x01, 0x03, 0x03, "2" }, - {0x11, 0x01, 0x03, 0x02, "3" }, - {0x11, 0x01, 0x03, 0x01, "4" }, - {0x11, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x11, 0x01, 0x08, 0x08, "30K 80K" }, - {0x11, 0x01, 0x08, 0x00, "40K 90K" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x11, 0x01, 0x30, 0x30, "Easy" }, - {0x11, 0x01, 0x30, 0x20, "Normal" }, - {0x11, 0x01, 0x30, 0x10, "Difficult" }, - {0x11, 0x01, 0x30, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, -}; - -STDDIPINFO(Scotrsht) - -void scotrsht_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x2043: - *charbank = data & 1; - return; - - case 0x2044: - *irq_enable = data & 2; - *flipscreen = data & 8; - return; - - case 0x3000: - *palbank = (data & 0x70) >> 4; - return; - - case 0x3100: - *soundlatch = data; - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - - case 0x3300: - // watchdog - return; - } - - if ((address & 0xffe0) == 0x2000) { - scroll[address & 0x1f] = data; - return; - } -} - -UINT8 scotrsht_main_read(UINT16 address) -{ - switch (address) - { - case 0x3100: - return DrvDips[1]; - - case 0x3200: - return DrvDips[2]; - - case 0x3300: - return DrvInputs[0]; - - case 0x3301: - return DrvInputs[1]; - - case 0x3302: - return DrvInputs[2]; - - case 0x3303: - return DrvDips[0]; - } - - if ((address & 0xffe0) == 0x2000) { - return scroll[address & 0x1f]; - } - - return 0; -} - -UINT8 __fastcall scotrsht_sound_read(UINT16 address) -{ - if (address == 0x8000) { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -void __fastcall scotrsht_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - BurnYM2203Write(0, port & 1, data); - return; - } -} - -UINT8 __fastcall scotrsht_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - return BurnYM2203Read(0, port & 1); - } - - return 0; -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3072000; -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3072000.0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - M6809Open(0); - M6809Reset(); - M6809Close(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvM6809ROM = Next; Next += 0x010000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x010000; - DrvGfxROM1 = Next; Next += 0x020000; - - DrvColPROM = Next; Next += 0x000500; - - DrvPalette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); - Palette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); - - AllRam = Next; - - scroll = Next; Next += 0x000020; - - DrvSprRAM = Next; Next += 0x001000; - DrvColRAM = Next; Next += 0x000800; - DrvVidRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000400; - - soundlatch = Next; Next += 0x000001; - charbank = Next; Next += 0x000001; - irq_enable = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - palbank = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0; i < 0x100; i++) - { - INT32 r = DrvColPROM[i + 0x000] & 0x0f; - INT32 g = DrvColPROM[i + 0x100] & 0x0f; - INT32 b = DrvColPROM[i + 0x200] & 0x0f; - - DrvPalette[i] = (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | (b << 0); - } - - for (INT32 i = 0; i < 0x200; i++) { - for (INT32 j = 0; j < 8; j++) { - INT32 col = ((~i & 0x100) >> 1) | (j << 4) | (DrvColPROM[i + 0x300] & 0x0f); - Palette[((i & 0x100) << 3) | (j << 8) | (i & 0xff)] = DrvPalette[col]; - } - } -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x000, 0x001, 0x002, 0x003 }; - INT32 XOffs[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, - 0x100, 0x104, 0x108, 0x10c, 0x110, 0x114, 0x118, 0x11c }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x08000); - - GfxDecode(0x0400, 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x10000); - - GfxDecode(0x0200, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvM6809ROM + 0x08000, 0, 1)) return 1; - memcpy (DrvM6809ROM + 0x4000, DrvM6809ROM + 0xc000, 0x4000); - if (BurnLoadRom(DrvM6809ROM + 0x0c000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x08000, 5, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00000, 6, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00100, 7, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00200, 8, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00300, 9, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00400, 10, 1)) return 1; - - DrvPaletteInit(); - DrvGfxDecode(); - } - - M6809Init(1); - M6809Open(0); - M6809MapMemory(DrvColRAM, 0x0000, 0x07ff, M6809_RAM); - M6809MapMemory(DrvVidRAM, 0x0800, 0x0fff, M6809_RAM); - M6809MapMemory(DrvSprRAM, 0x1000, 0x1fff, M6809_RAM); - M6809MapMemory(DrvM6809ROM + 0x04000, 0x4000, 0xffff, M6809_ROM); - M6809SetWriteHandler(scotrsht_main_write); - M6809SetReadHandler(scotrsht_main_read); - M6809Close(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM); - ZetMapArea(0x4000, 0x43ff, 0, DrvZ80RAM); - ZetMapArea(0x4000, 0x43ff, 1, DrvZ80RAM); - ZetMapArea(0x4000, 0x43ff, 2, DrvZ80RAM); - ZetSetReadHandler(scotrsht_sound_read); - ZetSetOutHandler(scotrsht_sound_out); - ZetSetInHandler(scotrsht_sound_in); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(1, 3072000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3072000); - BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - M6809Exit(); - ZetExit(); - - BurnYM2203Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_layer() -{ - for (INT32 offs = 0x0000; offs < 0x0800; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - if (sx & 0x100) continue; - - sy -= scroll[offs & 0x1f]; - if (sy < -7) sy += 256; - - INT32 attr = DrvColRAM[offs]; - INT32 code = DrvVidRAM[offs] | (*charbank << 9) | ((attr & 0x40) << 2); - INT32 color= (attr & 0x0f) | (*palbank << 4); - INT32 flipx = attr & 0x10; - INT32 flipy = attr & 0x20; - - if (*flipscreen) - { - flipx = !flipx; - flipy = !flipy; - sy = 248 - sy; - sx = 248 - sx; - } - - sy -= 16; - - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } else { - Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } - } - } -} - -static void draw_sprites() -{ - for (INT32 i = 0; i < 0xc0; i += 4) - { - INT32 attr = DrvSprRAM[i + 1]; - INT32 code = DrvSprRAM[i + 0] + ((attr & 0x40) << 2); - INT32 sx = DrvSprRAM[i + 2] - ((attr & 0x80) << 1); - INT32 sy = DrvSprRAM[i + 3]; - INT32 color = (attr & 0x0f) | (*palbank << 4); - INT32 flipx = attr & 0x10; - INT32 flipy = attr & 0x20; - - if (*flipscreen) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - sy -= 16; - - { - if (flipx) flipx = 0x0f; - if (flipy) flipx |= 0xf0; - - color = (color << 4) | 0x800; - - UINT8 *src = DrvGfxROM1 + (code << 8); - - for (INT32 y = 0; y < 16; y++, sy++) - { - if (sy < 0 || sy >= nScreenHeight) continue; - - INT32 xx = sx; - - for (INT32 x = 0; x < 16; x++, xx++) - { - if (xx < 0 || xx >= nScreenWidth) continue; - - INT32 pxl = src[((y << 4) | x) ^ flipx] | color; - INT32 trans = DrvPalette[pxl & 0xfff]; - - if (trans) { - pTransDraw[(sy * nScreenWidth) + xx] = pxl; - } - } - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x1000; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - BurnTransferClear(); - draw_layer(); - - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; - if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; - } - - INT32 nInterleave = 100; - INT32 nCyclesTotal[2] = { 3072000 / 60, 3072000 / 60 }; - - M6809Open(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - - M6809Run(nCyclesTotal[0] / nInterleave); - - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - } - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (*irq_enable) M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - M6809Close(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029706; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - M6809Scan(nAction); - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - } - - return 0; -} - - -// Scooter Shooter - -static struct BurnRomInfo scotrshtRomDesc[] = { - { "gx545_g03_12c.bin", 0x8000, 0xb808e0d3, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code - { "gx545_g02_10c.bin", 0x4000, 0xb22c0586, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "gx545_g01_8c.bin", 0x4000, 0x46a7cc65, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "gx545_g05_5f.bin", 0x8000, 0x856c349c, 3 | BRF_GRA }, // 3 Characters - - { "gx545_g06_6f.bin", 0x8000, 0x14ad7601, 4 | BRF_GRA }, // 4 Sprites - { "gx545_h04_4f.bin", 0x8000, 0xc06c11a3, 4 | BRF_GRA }, // 5 - - { "gx545_6301_1f.bin", 0x0100, 0xf584586f, 5 | BRF_GRA }, // 6 Color Proms - { "gx545_6301_2f.bin", 0x0100, 0xad464db1, 5 | BRF_GRA }, // 7 - { "gx545_6301_3f.bin", 0x0100, 0xbd475d23, 5 | BRF_GRA }, // 8 - { "gx545_6301_7f.bin", 0x0100, 0x2b0cd233, 5 | BRF_GRA }, // 9 - { "gx545_6301_8f.bin", 0x0100, 0xc1c7cf58, 5 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(scotrsht) -STD_ROM_FN(scotrsht) - -struct BurnDriver BurnDrvScotrsht = { - "scotrsht", NULL, NULL, NULL, "1985", - "Scooter Shooter\0", NULL, "Konami", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, scotrshtRomInfo, scotrshtRomName, NULL, NULL, ScotrshtInputInfo, ScotrshtDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 224, 256, 3, 4 -}; +// FB Alpha Scooter Shooter driver module +// Based on MAME driver by Pierpaolo Prazzoli + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "m6809_intf.h" +#include "burn_ym2203.h" + +static UINT8 *AllMem; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *DrvM6809ROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvColPROM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvColRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *DrvPalette; +static UINT32 *Palette; +static UINT8 DrvRecalc; + +static UINT8 *scroll; + +static UINT8 *soundlatch; +static UINT8 *charbank; +static UINT8 *irq_enable; +static UINT8 *flipscreen; +static UINT8 *palbank; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvReset; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; + +static struct BurnInputInfo ScotrshtInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Scotrsht) + +static struct BurnDIPInfo ScotrshtDIPList[]= +{ + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0x5d, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x10, 0x01, 0x0f, 0x02, "4 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x05, "3 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x10, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x10, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x10, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x10, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x10, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x10, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x10, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x10, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x10, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x10, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x10, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x10, 0x01, 0x0f, 0x00, "Invalid" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x10, 0x01, 0xf0, 0x20, "4 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x50, "3 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x10, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x10, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x10, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x10, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x10, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x10, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x10, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x10, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x10, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x10, 0x01, 0xf0, 0x00, "Invalid" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x11, 0x01, 0x03, 0x03, "2" }, + {0x11, 0x01, 0x03, 0x02, "3" }, + {0x11, 0x01, 0x03, 0x01, "4" }, + {0x11, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x11, 0x01, 0x08, 0x08, "30K 80K" }, + {0x11, 0x01, 0x08, 0x00, "40K 90K" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x11, 0x01, 0x30, 0x30, "Easy" }, + {0x11, 0x01, 0x30, 0x20, "Normal" }, + {0x11, 0x01, 0x30, 0x10, "Difficult" }, + {0x11, 0x01, 0x30, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, +}; + +STDDIPINFO(Scotrsht) + +void scotrsht_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x2043: + *charbank = data & 1; + return; + + case 0x2044: + *irq_enable = data & 2; + *flipscreen = data & 8; + return; + + case 0x3000: + *palbank = (data & 0x70) >> 4; + return; + + case 0x3100: + *soundlatch = data; + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + + case 0x3300: + // watchdog + return; + } + + if ((address & 0xffe0) == 0x2000) { + scroll[address & 0x1f] = data; + return; + } +} + +UINT8 scotrsht_main_read(UINT16 address) +{ + switch (address) + { + case 0x3100: + return DrvDips[1]; + + case 0x3200: + return DrvDips[2]; + + case 0x3300: + return DrvInputs[0]; + + case 0x3301: + return DrvInputs[1]; + + case 0x3302: + return DrvInputs[2]; + + case 0x3303: + return DrvDips[0]; + } + + if ((address & 0xffe0) == 0x2000) { + return scroll[address & 0x1f]; + } + + return 0; +} + +UINT8 __fastcall scotrsht_sound_read(UINT16 address) +{ + if (address == 0x8000) { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +void __fastcall scotrsht_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + BurnYM2203Write(0, port & 1, data); + return; + } +} + +UINT8 __fastcall scotrsht_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + return BurnYM2203Read(0, port & 1); + } + + return 0; +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3072000; +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3072000.0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + M6809Open(0); + M6809Reset(); + M6809Close(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvM6809ROM = Next; Next += 0x010000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x010000; + DrvGfxROM1 = Next; Next += 0x020000; + + DrvColPROM = Next; Next += 0x000500; + + DrvPalette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); + Palette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); + + AllRam = Next; + + scroll = Next; Next += 0x000020; + + DrvSprRAM = Next; Next += 0x001000; + DrvColRAM = Next; Next += 0x000800; + DrvVidRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000400; + + soundlatch = Next; Next += 0x000001; + charbank = Next; Next += 0x000001; + irq_enable = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + palbank = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0; i < 0x100; i++) + { + INT32 r = DrvColPROM[i + 0x000] & 0x0f; + INT32 g = DrvColPROM[i + 0x100] & 0x0f; + INT32 b = DrvColPROM[i + 0x200] & 0x0f; + + DrvPalette[i] = (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | (b << 0); + } + + for (INT32 i = 0; i < 0x200; i++) { + for (INT32 j = 0; j < 8; j++) { + INT32 col = ((~i & 0x100) >> 1) | (j << 4) | (DrvColPROM[i + 0x300] & 0x0f); + Palette[((i & 0x100) << 3) | (j << 8) | (i & 0xff)] = DrvPalette[col]; + } + } +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x000, 0x001, 0x002, 0x003 }; + INT32 XOffs[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, + 0x100, 0x104, 0x108, 0x10c, 0x110, 0x114, 0x118, 0x11c }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x08000); + + GfxDecode(0x0400, 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x10000); + + GfxDecode(0x0200, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvM6809ROM + 0x08000, 0, 1)) return 1; + memcpy (DrvM6809ROM + 0x4000, DrvM6809ROM + 0xc000, 0x4000); + if (BurnLoadRom(DrvM6809ROM + 0x0c000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x08000, 5, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00000, 6, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00100, 7, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00200, 8, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00300, 9, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00400, 10, 1)) return 1; + + DrvPaletteInit(); + DrvGfxDecode(); + } + + M6809Init(1); + M6809Open(0); + M6809MapMemory(DrvColRAM, 0x0000, 0x07ff, M6809_RAM); + M6809MapMemory(DrvVidRAM, 0x0800, 0x0fff, M6809_RAM); + M6809MapMemory(DrvSprRAM, 0x1000, 0x1fff, M6809_RAM); + M6809MapMemory(DrvM6809ROM + 0x04000, 0x4000, 0xffff, M6809_ROM); + M6809SetWriteHandler(scotrsht_main_write); + M6809SetReadHandler(scotrsht_main_read); + M6809Close(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM); + ZetMapArea(0x4000, 0x43ff, 0, DrvZ80RAM); + ZetMapArea(0x4000, 0x43ff, 1, DrvZ80RAM); + ZetMapArea(0x4000, 0x43ff, 2, DrvZ80RAM); + ZetSetReadHandler(scotrsht_sound_read); + ZetSetOutHandler(scotrsht_sound_out); + ZetSetInHandler(scotrsht_sound_in); + ZetClose(); + + BurnYM2203Init(1, 3072000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3072000); + BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + M6809Exit(); + ZetExit(); + + BurnYM2203Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_layer() +{ + for (INT32 offs = 0x0000; offs < 0x0800; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + if (sx & 0x100) continue; + + sy -= scroll[offs & 0x1f]; + if (sy < -7) sy += 256; + + INT32 attr = DrvColRAM[offs]; + INT32 code = DrvVidRAM[offs] | (*charbank << 9) | ((attr & 0x40) << 2); + INT32 color= (attr & 0x0f) | (*palbank << 4); + INT32 flipx = attr & 0x10; + INT32 flipy = attr & 0x20; + + if (*flipscreen) + { + flipx = !flipx; + flipy = !flipy; + sy = 248 - sy; + sx = 248 - sx; + } + + sy -= 16; + + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } else { + Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } + } + } +} + +static void draw_sprites() +{ + for (INT32 i = 0; i < 0xc0; i += 4) + { + INT32 attr = DrvSprRAM[i + 1]; + INT32 code = DrvSprRAM[i + 0] + ((attr & 0x40) << 2); + INT32 sx = DrvSprRAM[i + 2] - ((attr & 0x80) << 1); + INT32 sy = DrvSprRAM[i + 3]; + INT32 color = (attr & 0x0f) | (*palbank << 4); + INT32 flipx = attr & 0x10; + INT32 flipy = attr & 0x20; + + if (*flipscreen) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + sy -= 16; + + { + if (flipx) flipx = 0x0f; + if (flipy) flipx |= 0xf0; + + color = (color << 4) | 0x800; + + UINT8 *src = DrvGfxROM1 + (code << 8); + + for (INT32 y = 0; y < 16; y++, sy++) + { + if (sy < 0 || sy >= nScreenHeight) continue; + + INT32 xx = sx; + + for (INT32 x = 0; x < 16; x++, xx++) + { + if (xx < 0 || xx >= nScreenWidth) continue; + + INT32 pxl = src[((y << 4) | x) ^ flipx] | color; + INT32 trans = DrvPalette[pxl & 0xfff]; + + if (trans) { + pTransDraw[(sy * nScreenWidth) + xx] = pxl; + } + } + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x1000; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + BurnTransferClear(); + draw_layer(); + + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; + if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; + } + + INT32 nInterleave = 100; + INT32 nCyclesTotal[2] = { 3072000 / 60, 3072000 / 60 }; + + M6809Open(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + + M6809Run(nCyclesTotal[0] / nInterleave); + + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + } + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (*irq_enable) M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + M6809Close(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029706; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + M6809Scan(nAction); + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + } + + return 0; +} + + +// Scooter Shooter + +static struct BurnRomInfo scotrshtRomDesc[] = { + { "gx545_g03_12c.bin", 0x8000, 0xb808e0d3, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code + { "gx545_g02_10c.bin", 0x4000, 0xb22c0586, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "gx545_g01_8c.bin", 0x4000, 0x46a7cc65, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "gx545_g05_5f.bin", 0x8000, 0x856c349c, 3 | BRF_GRA }, // 3 Characters + + { "gx545_g06_6f.bin", 0x8000, 0x14ad7601, 4 | BRF_GRA }, // 4 Sprites + { "gx545_h04_4f.bin", 0x8000, 0xc06c11a3, 4 | BRF_GRA }, // 5 + + { "gx545_6301_1f.bin", 0x0100, 0xf584586f, 5 | BRF_GRA }, // 6 Color Proms + { "gx545_6301_2f.bin", 0x0100, 0xad464db1, 5 | BRF_GRA }, // 7 + { "gx545_6301_3f.bin", 0x0100, 0xbd475d23, 5 | BRF_GRA }, // 8 + { "gx545_6301_7f.bin", 0x0100, 0x2b0cd233, 5 | BRF_GRA }, // 9 + { "gx545_6301_8f.bin", 0x0100, 0xc1c7cf58, 5 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(scotrsht) +STD_ROM_FN(scotrsht) + +struct BurnDriver BurnDrvScotrsht = { + "scotrsht", NULL, NULL, NULL, "1985", + "Scooter Shooter\0", NULL, "Konami", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, scotrshtRomInfo, scotrshtRomName, NULL, NULL, ScotrshtInputInfo, ScotrshtDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 224, 256, 3, 4 +}; diff --git a/src/burn/drv/konami/d_simpsons.cpp b/src/burn/drv/konami/d_simpsons.cpp index 96b49f697..155b4abaa 100644 --- a/src/burn/drv/konami/d_simpsons.cpp +++ b/src/burn/drv/konami/d_simpsons.cpp @@ -1,1002 +1,1001 @@ -// FB Alpha The Simpsons driver module -// Based on MAME driver by Ernesto Corvi and various others - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "k053260.h" -#include "eeprom.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *nDrvBank; - -static INT32 videobank; -static INT32 init_eeprom_count; -static INT32 simpsons_firq_enabled; -static INT32 K053246Irq; - -static INT32 bg_colorbase; -static INT32 sprite_colorbase; -static INT32 layer_colorbase[3]; -static INT32 layerpri[3]; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvDiag; -static UINT8 DrvReset; -static UINT8 DrvInputs[5]; - -static INT32 nCyclesDone[2]; - -static struct BurnInputInfo SimpsonsInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy5 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy5 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"P3 Coin", BIT_DIGITAL, DrvJoy5 + 2, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, DrvJoy3 + 7, "p3 start" }, - {"P3 Up", BIT_DIGITAL, DrvJoy3 + 2, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy3 + 3, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy3 + 0, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy3 + 1, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2" }, - - {"P4 Coin", BIT_DIGITAL, DrvJoy5 + 3, "p4 coin" }, - {"P4 Start", BIT_DIGITAL, DrvJoy4 + 7, "p4 start" }, - {"P4 Up", BIT_DIGITAL, DrvJoy4 + 2, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvJoy4 + 3, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvJoy4 + 0, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvJoy4 + 1, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p4 fire 2" }, - - {"Diagnostics", BIT_DIGITAL, &DrvDiag, "diag" }, - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, -}; - -STDINPUTINFO(Simpsons) - -static struct BurnInputInfo Simpsons2pInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy5 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy5 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Diagnostics", BIT_DIGITAL, &DrvDiag, "diag" }, - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, -}; - -STDINPUTINFO(Simpsons2p) - -void simpsons_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x1fa0: - case 0x1fa1: - case 0x1fa2: - case 0x1fa3: - case 0x1fa4: - case 0x1fa5: - case 0x1fa6: - case 0x1fa7: - K053246Write(address & 7, data); - return; - - case 0x1fc0: - K052109RMRDLine = data & 0x08; - K053246_set_OBJCHA_line(~data & 0x20); - return; - - case 0x1fc2: - { - if (data == 0xff) return; // ok? - - EEPROMWrite((data & 0x10) >> 3, (data & 0x08) >> 3, (data & 0x80) >> 7); - - videobank = data & 3; - simpsons_firq_enabled = data & 0x04; - } - return; - - case 0x1fc6: - case 0x1fc7: - K053260Write(0, address & 1, data); - return; - } - - if ((address & 0xf000) == 0x0000) { - if (videobank & 1) { - DrvPalRAM[address & 0x0fff] = data; - return; - } - } - - if ((address & 0xfff0) == 0x1fb0) { - K053251Write(address & 0x0f, data); - return; - } - - if ((address & 0xe000) == 0x2000) { - if (videobank & 2) { - address ^= 1; - DrvSprRAM[address & 0x1fff] = data; - return; - } - } - - if ((address & 0xc000) == 0x0000) { - K052109Write(address & 0x3fff, data); - return; - } -} - -UINT8 simpsons_main_read(UINT16 address) -{ - switch (address) - { - case 0x1f81: - { - INT32 res = ((EEPROMRead() & 1) << 4) | 0x20 | (~DrvDiag & 1); - - if (init_eeprom_count > 0) - { - init_eeprom_count--; - res &= 0xfe; - } - return res; - } - - case 0x1f80: - return DrvInputs[4]; - - case 0x1f90: - return DrvInputs[0]; - - case 0x1f91: - return DrvInputs[1]; - - case 0x1f92: - return DrvInputs[2]; - - case 0x1f93: - return DrvInputs[3]; - - case 0x1fc4: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return 0; - - case 0x1fc6: - case 0x1fc7: - return K053260Read(0, (address & 1)+2); - - case 0x1fc8: - case 0x1fc9: - return K053246Read(address & 1); - - case 0x1fca: - return 0; // watchdog - } - - if ((address & 0xf000) == 0x0000) { - if (videobank & 1) { - return DrvPalRAM[address & 0x0fff]; - } - } - - if ((address & 0xe000) == 0x2000) { - if (videobank & 2) { - address ^= 1; - return DrvSprRAM[address & 0x1fff]; - } - } - - if ((address & 0xc000) == 0x0000) { - return K052109Read(address & 0x3fff); - } - - return 0; -} - -static void DrvZ80Bankswitch(INT32 data) -{ - data &= 0x07; - if (data < 2) return; - - INT32 nBank = (data & 7) * 0x4000; - - nDrvBank[1] = data; - - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + nBank); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + nBank); -} - -void __fastcall simpsons_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf800: - BurnYM2151SelectRegister(data); - return; - - case 0xf801: - BurnYM2151WriteRegister(data); - return; - - case 0xfa00: - nCyclesDone[1] += ZetRun(100); - ZetNmi(); - return; - - case 0xfe00: - DrvZ80Bankswitch(data); - return; - } - - if (address >= 0xfc00 && address < 0xfc30) { - K053260Write(0, address & 0xff, data); - return; - } -} - -UINT8 __fastcall simpsons_sound_read(UINT16 address) -{ - switch (address) - { - case 0xf800: - return 0xff; - case 0xf801: - return BurnYM2151ReadStatus(); - } - - if (address >= 0xfc00 && address < 0xfc30) { - if ((address & 0x3f) == 0x01) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - - return K053260Read(0, address & 0xff); - } - - return 0; -} - -static void simpsons_set_lines(INT32 lines) -{ - nDrvBank[0] = lines; - - INT32 nBank = (lines & 0x3f) * 0x2000; - - konamiMapMemory(DrvKonROM + 0x10000 + nBank, 0x6000, 0x7fff, KON_ROM); -} - -static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - *code |= ((*color & 0x3f) << 8) | (bank << 14); - *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6); - *code &= 0x7fff; -} - -static void K053247Callback(INT32 *code, INT32 *color, INT32 *priority) -{ - INT32 pri = (*color & 0x0f80) >> 6; - if (pri <= layerpri[2]) *priority = 0; - else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 1; - else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 2; - else *priority = 3; - - *color = sprite_colorbase + (*color & 0x001f); - - *code &= 0x7fff; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - K053260Reset(0); - - EEPROMReset(); - - videobank = 0; - - if (EEPROMAvailable()) { - init_eeprom_count = 0; - } else { - init_eeprom_count = 10; - } - - simpsons_firq_enabled = 0; - K053246Irq = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x090000; - DrvZ80ROM = Next; Next += 0x020000; - - DrvGfxROM0 = Next; Next += 0x100000; - DrvGfxROMExp0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x400000; - DrvGfxROMExp1 = Next; Next += 0x800000; - - DrvSndROM = Next; Next += 0x200000; - - Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x000800; - - DrvKonRAM = Next; Next += 0x002000; - DrvPalRAM = Next; Next += 0x001000; - DrvSprRAM = Next; Next += 0x002000; - - nDrvBank = Next; Next += 0x000002; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 XOffs[8] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; - INT32 YOffs[8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x100000); - konami_rom_deinterleave_4(DrvGfxROM1, 0x400000); - - GfxDecode(0x8000, 4, 8, 8, Plane, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - - K053247GfxDecode(DrvGfxROM1, DrvGfxROMExp1, 0x400000); - - return 0; -} - -static const eeprom_interface simpsons_eeprom_intf = -{ - 7, // address bits - 8, // data bits - "011000", // read command - "011100", // write command - 0, // erase command - "0100000000000", // lock command - "0100110000000", // unlock command - 0, - 0 -}; - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; - if (BurnLoadRom(DrvKonROM + 0x030000, 1, 1)) return 1; - if (BurnLoadRom(DrvKonROM + 0x050000, 2, 1)) return 1; - if (BurnLoadRom(DrvKonROM + 0x070000, 3, 1)) return 1; - memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x88000, 0x8000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x300000, 10, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 11, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x100000, 12, 1)) return 1; - - DrvGfxDecode(); - } - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvKonRAM, 0x4000, 0x5fff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(simpsons_main_write); - konamiSetReadHandler(simpsons_main_read); - konamiSetlinesCallback(simpsons_set_lines); - konamiClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x08000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x08000); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(simpsons_sound_write); - ZetSetReadHandler(simpsons_sound_read); - ZetMemEnd(); - ZetClose(); - - EEPROMInit(&simpsons_eeprom_intf); - - K052109Init(DrvGfxROM0, 0x0fffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(8, 0); - - K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 0x03 /* shadows & highlights */); - K053247SetSpriteOffset(-59, 39); - - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.00, BURN_SND_ROUTE_BOTH); // not connected - - K053260Init(0, 3579545, DrvSndROM, 0x140000); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - konamiExit(); - ZetExit(); - - EEPROMExit(); - - BurnYM2151Exit(); - K053260Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void simpsons_objdma() -{ - INT32 counter, num_inactive; - UINT8 *dstptr; - UINT16 *src, *dst; - - K053247Export(&dstptr, 0, 0, 0, &counter); - src = (UINT16*)DrvSprRAM; - dst = (UINT16*)dstptr; - num_inactive = counter = 256; - - do { - if ((*src & BURN_ENDIAN_SWAP_INT16(0x8000)) && (*src & BURN_ENDIAN_SWAP_INT16(0xff))) - { - memcpy(dst, src, 0x10); - dst += 8; - num_inactive--; - } - src += 8; - } - while (--counter); - - if (num_inactive) do { *dst = 0; dst += 8; } while (--num_inactive); -} - -static void DrvRecalcPal() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x1000 / 2; i++) { - UINT16 d = BURN_ENDIAN_SWAP_INT16((p[i] << 8) | (p[i] >> 8)); - - b = (d >> 10) & 0x1f; - g = (d >> 5) & 0x1f; - r = (d >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - Palette[i] = (r << 16) | (g << 8) | b; - } -} - -static void sortlayers(INT32 *layer,INT32 *pri) -{ -#define SWAP(a,b) \ - if (pri[a] < pri[b]) \ - { \ - INT32 t; \ - t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ - t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ - } - - SWAP(0,1) - SWAP(0,2) - SWAP(1,2) -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvRecalcPal(); - } - - K052109UpdateScroll(); - - INT32 layer[3]; - - bg_colorbase = K053251GetPaletteIndex(0); - sprite_colorbase = K053251GetPaletteIndex(1); - layer_colorbase[0] = K053251GetPaletteIndex(2); - layer_colorbase[1] = K053251GetPaletteIndex(3); - layer_colorbase[2] = K053251GetPaletteIndex(4); - - layerpri[0] = K053251GetPriority(2); - layerpri[1] = K053251GetPriority(3); - layerpri[2] = K053251GetPriority(4); - layer[0] = 0; - layer[1] = 1; - layer[2] = 2; - - sortlayers(layer,layerpri); - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 16 * bg_colorbase; - } - - if (nSpriteEnable & 8) K053247SpritesRender(DrvGfxROMExp1, 3); // title (simpsons behind clouds) - if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, DrvGfxROMExp0); // title (back-most cloud) - if (nSpriteEnable & 4) K053247SpritesRender(DrvGfxROMExp1, 2); // smithers' on first stage - if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0); // main layer (buildings, stage 1) - if (nSpriteEnable & 2) K053247SpritesRender(DrvGfxROMExp1, 1); // smithers' thugs on stage 1 - if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0); // game over text - if (nSpriteEnable & 1) K053247SpritesRender(DrvGfxROMExp1, 0); // not used? seems to make sense here... - - KonamiBlendCopy(Palette, DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - konamiNewFrame(); - - { - memset (DrvInputs, 0xff, 5); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - } - - // Clear Opposites - if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; - if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; - if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; - if ((DrvInputs[3] & 0x0c) == 0) DrvInputs[3] |= 0x0c; - if ((DrvInputs[3] & 0x03) == 0) DrvInputs[3] |= 0x03; - } - - INT32 nInterleave = nBurnSoundLen; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 }; - - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetOpen(0); - konamiOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext, nCyclesSegment; - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[0]; - nCyclesSegment = konamiRun(nCyclesSegment); - nCyclesDone[0] += nCyclesSegment; - - if (i == 1 && K053246Irq && simpsons_firq_enabled) { - konamiSetIrqLine(KONAMI_FIRQ_LINE, KONAMI_HOLD_LINE); - } - - K053246Irq = K053246_is_IRQ_enabled(); - - nNext = (i + 1) * nCyclesTotal[1] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[1]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[1] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K053246Irq) simpsons_objdma(); - if (K052109_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - } - } - - konamiClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - K053260Scan(nAction); - - KonamiICScan(nAction); - - EEPROMScan(nAction, pnMin); - - SCAN_VAR(videobank); - SCAN_VAR(init_eeprom_count); - SCAN_VAR(simpsons_firq_enabled); - SCAN_VAR(K053246Irq); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - simpsons_set_lines(nDrvBank[0]); - konamiClose(); - - ZetOpen(0); - DrvZ80Bankswitch(nDrvBank[1]); - ZetClose(); - } - - return 0; -} - - -// The Simpsons (4 Players World, set 1) - -static struct BurnRomInfo simpsonsRomDesc[] = { - { "072-g02.16c", 0x020000, 0x580ce1d6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "072-g01.17c", 0x020000, 0x9f843def, 1 | BRF_PRG | BRF_ESS }, // 1 - { "072-j13.13c", 0x020000, 0xaade2abd, 1 | BRF_PRG | BRF_ESS }, // 2 - { "072-j12.15c", 0x020000, 0x479e12f2, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "072-e03.6g", 0x020000, 0x866b7a35, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles - { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 - - { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles - { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 - { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 - { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 - - { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples - { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 - - { "simpsons.nv", 0x000080, 0xec3f0449, BRF_OPT }, -}; - -STD_ROM_PICK(simpsons) -STD_ROM_FN(simpsons) - -struct BurnDriver BurnDrvSimpsons = { - "simpsons", NULL, NULL, NULL, "1991", - "The Simpsons (4 Players World, set 1)\0", NULL, "Konami", "GX072", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, simpsonsRomInfo, simpsonsRomName, NULL, NULL, SimpsonsInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// The Simpsons (4 Players World, set 2) - -static struct BurnRomInfo simpsons4paRomDesc[] = { - { "072-g02.16c", 0x020000, 0x580ce1d6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "072-g01.17c", 0x020000, 0x9f843def, 1 | BRF_PRG | BRF_ESS }, // 1 - { "072-m13.13c", 0x020000, 0xf36c9423, 1 | BRF_PRG | BRF_ESS }, // 2 - { "072-l12.15c", 0x020000, 0x84f9d9ba, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "072-e03.6g", 0x020000, 0x866b7a35, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles - { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 - - { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles - { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 - { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 - { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 - - { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples - { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 - - { "simpsons4pa.nv", 0x000080, 0xec3f0449, BRF_OPT }, -}; - -STD_ROM_PICK(simpsons4pa) -STD_ROM_FN(simpsons4pa) - -struct BurnDriver BurnDrvSimpsons4pa = { - "simpsons4pa", "simpsons", NULL, NULL, "1991", - "The Simpsons (4 Players World, set 2)\0", NULL, "Konami", "GX072", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, simpsons4paRomInfo, simpsons4paRomName, NULL, NULL, SimpsonsInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// The Simpsons (2 Players World, set 1) - -static struct BurnRomInfo simpsons2pRomDesc[] = { - { "072-g02.16c", 0x020000, 0x580ce1d6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "072-p01.17c", 0x020000, 0x07ceeaea, 1 | BRF_PRG | BRF_ESS }, // 1 - { "072-013.13c", 0x020000, 0x8781105a, 1 | BRF_PRG | BRF_ESS }, // 2 - { "072-012.15c", 0x020000, 0x244f9289, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "072-g03.6g", 0x020000, 0x76c1850c, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles - { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 - - { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles - { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 - { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 - { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 - - { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples - { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 - - { "simpsons2p.nv", 0x000080, 0xfbac4e30, BRF_OPT }, -}; - -STD_ROM_PICK(simpsons2p) -STD_ROM_FN(simpsons2p) - -struct BurnDriver BurnDrvSimpsons2p = { - "simpsons2p", "simpsons", NULL, NULL, "1991", - "The Simpsons (2 Players World, set 1)\0", NULL, "Konami", "GX072", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, simpsons2pRomInfo, simpsons2pRomName, NULL, NULL, Simpsons2pInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// The Simpsons (2 Players World, set 2) - -static struct BurnRomInfo simpsons2p2RomDesc[] = { - { "072-g02.16c", 0x020000, 0x580ce1d6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "072-p01.17c", 0x020000, 0x07ceeaea, 1 | BRF_PRG | BRF_ESS }, // 1 - { "072-_13.13c", 0x020000, 0x54e6df66, 1 | BRF_PRG | BRF_ESS }, // 2 - { "072-_12.15c", 0x020000, 0x96636225, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "072-g03.6g", 0x020000, 0x76c1850c, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles - { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 - - { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles - { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 - { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 - { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 - - { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples - { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 - - { "simpsons2p2.nv", 0x000080, 0xfbac4e30, BRF_OPT }, -}; - -STD_ROM_PICK(simpsons2p2) -STD_ROM_FN(simpsons2p2) - -struct BurnDriver BurnDrvSimpsons2p2 = { - "simpsons2p2", "simpsons", NULL, NULL, "1991", - "The Simpsons (2 Players World, set 2)\0", NULL, "Konami", "GX072", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, simpsons2p2RomInfo, simpsons2p2RomName, NULL, NULL, SimpsonsInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// The Simpsons (2 Players Asia) - -static struct BurnRomInfo simpsons2paRomDesc[] = { - { "072-g02.16c", 0x020000, 0x580ce1d6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "072-p01.17c", 0x020000, 0x07ceeaea, 1 | BRF_PRG | BRF_ESS }, // 1 - { "072-113.13c", 0x020000, 0x8781105a, 1 | BRF_PRG | BRF_ESS }, // 2 - { "072-112.15c", 0x020000, 0x3bd69404, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "072-e03.6g", 0x020000, 0x866b7a35, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles - { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 - - { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles - { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 - { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 - { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 - - { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples - { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 - - { "simpsons2pa.nv", 0x000080, 0xfbac4e30, BRF_OPT }, -}; - -STD_ROM_PICK(simpsons2pa) -STD_ROM_FN(simpsons2pa) - -struct BurnDriver BurnDrvSimpsons2pa = { - "simpsons2pa", "simpsons", NULL, NULL, "1991", - "The Simpsons (2 Players Asia)\0", NULL, "Konami", "GX072", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, simpsons2paRomInfo, simpsons2paRomName, NULL, NULL, Simpsons2pInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// The Simpsons (2 Players Japan) - -static struct BurnRomInfo simpsons2pjRomDesc[] = { - { "072-s02.16c", 0x020000, 0x265f7a47, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "072-t01.17c", 0x020000, 0x91de5c2d, 1 | BRF_PRG | BRF_ESS }, // 1 - { "072-213.13c", 0x020000, 0xb326a9ae, 1 | BRF_PRG | BRF_ESS }, // 2 - { "072-212.15c", 0x020000, 0x584d9d37, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "072-g03.6g", 0x020000, 0x76c1850c, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles - { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 - - { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles - { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 - { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 - { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 - - { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples - { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 - - { "simpsons2pj.nv", 0x000080, 0x3550a54e, BRF_OPT }, -}; - -STD_ROM_PICK(simpsons2pj) -STD_ROM_FN(simpsons2pj) - -struct BurnDriver BurnDrvSimpsons2pj = { - "simpsons2pj", "simpsons", NULL, NULL, "1991", - "The Simpsons (2 Players Japan)\0", NULL, "Konami", "GX072", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, simpsons2pjRomInfo, simpsons2pjRomName, NULL, NULL, Simpsons2pInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; +// FB Alpha The Simpsons driver module +// Based on MAME driver by Ernesto Corvi and various others + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "k053260.h" +#include "eeprom.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *nDrvBank; + +static INT32 videobank; +static INT32 init_eeprom_count; +static INT32 simpsons_firq_enabled; +static INT32 K053246Irq; + +static INT32 bg_colorbase; +static INT32 sprite_colorbase; +static INT32 layer_colorbase[3]; +static INT32 layerpri[3]; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvDiag; +static UINT8 DrvReset; +static UINT8 DrvInputs[5]; + +static INT32 nCyclesDone[2]; + +static struct BurnInputInfo SimpsonsInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy5 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy5 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"P3 Coin", BIT_DIGITAL, DrvJoy5 + 2, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, DrvJoy3 + 7, "p3 start" }, + {"P3 Up", BIT_DIGITAL, DrvJoy3 + 2, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy3 + 3, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy3 + 0, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy3 + 1, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2" }, + + {"P4 Coin", BIT_DIGITAL, DrvJoy5 + 3, "p4 coin" }, + {"P4 Start", BIT_DIGITAL, DrvJoy4 + 7, "p4 start" }, + {"P4 Up", BIT_DIGITAL, DrvJoy4 + 2, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvJoy4 + 3, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvJoy4 + 0, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvJoy4 + 1, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p4 fire 2" }, + + {"Diagnostics", BIT_DIGITAL, &DrvDiag, "diag" }, + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, +}; + +STDINPUTINFO(Simpsons) + +static struct BurnInputInfo Simpsons2pInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy5 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy5 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Diagnostics", BIT_DIGITAL, &DrvDiag, "diag" }, + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, +}; + +STDINPUTINFO(Simpsons2p) + +void simpsons_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x1fa0: + case 0x1fa1: + case 0x1fa2: + case 0x1fa3: + case 0x1fa4: + case 0x1fa5: + case 0x1fa6: + case 0x1fa7: + K053246Write(address & 7, data); + return; + + case 0x1fc0: + K052109RMRDLine = data & 0x08; + K053246_set_OBJCHA_line(~data & 0x20); + return; + + case 0x1fc2: + { + if (data == 0xff) return; // ok? + + EEPROMWrite((data & 0x10) >> 3, (data & 0x08) >> 3, (data & 0x80) >> 7); + + videobank = data & 3; + simpsons_firq_enabled = data & 0x04; + } + return; + + case 0x1fc6: + case 0x1fc7: + K053260Write(0, address & 1, data); + return; + } + + if ((address & 0xf000) == 0x0000) { + if (videobank & 1) { + DrvPalRAM[address & 0x0fff] = data; + return; + } + } + + if ((address & 0xfff0) == 0x1fb0) { + K053251Write(address & 0x0f, data); + return; + } + + if ((address & 0xe000) == 0x2000) { + if (videobank & 2) { + address ^= 1; + DrvSprRAM[address & 0x1fff] = data; + return; + } + } + + if ((address & 0xc000) == 0x0000) { + K052109Write(address & 0x3fff, data); + return; + } +} + +UINT8 simpsons_main_read(UINT16 address) +{ + switch (address) + { + case 0x1f81: + { + INT32 res = ((EEPROMRead() & 1) << 4) | 0x20 | (~DrvDiag & 1); + + if (init_eeprom_count > 0) + { + init_eeprom_count--; + res &= 0xfe; + } + return res; + } + + case 0x1f80: + return DrvInputs[4]; + + case 0x1f90: + return DrvInputs[0]; + + case 0x1f91: + return DrvInputs[1]; + + case 0x1f92: + return DrvInputs[2]; + + case 0x1f93: + return DrvInputs[3]; + + case 0x1fc4: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return 0; + + case 0x1fc6: + case 0x1fc7: + return K053260Read(0, (address & 1)+2); + + case 0x1fc8: + case 0x1fc9: + return K053246Read(address & 1); + + case 0x1fca: + return 0; // watchdog + } + + if ((address & 0xf000) == 0x0000) { + if (videobank & 1) { + return DrvPalRAM[address & 0x0fff]; + } + } + + if ((address & 0xe000) == 0x2000) { + if (videobank & 2) { + address ^= 1; + return DrvSprRAM[address & 0x1fff]; + } + } + + if ((address & 0xc000) == 0x0000) { + return K052109Read(address & 0x3fff); + } + + return 0; +} + +static void DrvZ80Bankswitch(INT32 data) +{ + data &= 0x07; + if (data < 2) return; + + INT32 nBank = (data & 7) * 0x4000; + + nDrvBank[1] = data; + + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + nBank); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + nBank); +} + +void __fastcall simpsons_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf800: + BurnYM2151SelectRegister(data); + return; + + case 0xf801: + BurnYM2151WriteRegister(data); + return; + + case 0xfa00: + nCyclesDone[1] += ZetRun(100); + ZetNmi(); + return; + + case 0xfe00: + DrvZ80Bankswitch(data); + return; + } + + if (address >= 0xfc00 && address < 0xfc30) { + K053260Write(0, address & 0xff, data); + return; + } +} + +UINT8 __fastcall simpsons_sound_read(UINT16 address) +{ + switch (address) + { + case 0xf800: + return 0xff; + case 0xf801: + return BurnYM2151ReadStatus(); + } + + if (address >= 0xfc00 && address < 0xfc30) { + if ((address & 0x3f) == 0x01) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + + return K053260Read(0, address & 0xff); + } + + return 0; +} + +static void simpsons_set_lines(INT32 lines) +{ + nDrvBank[0] = lines; + + INT32 nBank = (lines & 0x3f) * 0x2000; + + konamiMapMemory(DrvKonROM + 0x10000 + nBank, 0x6000, 0x7fff, KON_ROM); +} + +static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + *code |= ((*color & 0x3f) << 8) | (bank << 14); + *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6); + *code &= 0x7fff; +} + +static void K053247Callback(INT32 *code, INT32 *color, INT32 *priority) +{ + INT32 pri = (*color & 0x0f80) >> 6; + if (pri <= layerpri[2]) *priority = 0; + else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 1; + else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 2; + else *priority = 3; + + *color = sprite_colorbase + (*color & 0x001f); + + *code &= 0x7fff; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + K053260Reset(0); + + EEPROMReset(); + + videobank = 0; + + if (EEPROMAvailable()) { + init_eeprom_count = 0; + } else { + init_eeprom_count = 10; + } + + simpsons_firq_enabled = 0; + K053246Irq = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x090000; + DrvZ80ROM = Next; Next += 0x020000; + + DrvGfxROM0 = Next; Next += 0x100000; + DrvGfxROMExp0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x400000; + DrvGfxROMExp1 = Next; Next += 0x800000; + + DrvSndROM = Next; Next += 0x200000; + + Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x000800; + + DrvKonRAM = Next; Next += 0x002000; + DrvPalRAM = Next; Next += 0x001000; + DrvSprRAM = Next; Next += 0x002000; + + nDrvBank = Next; Next += 0x000002; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 XOffs[8] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; + INT32 YOffs[8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x100000); + konami_rom_deinterleave_4(DrvGfxROM1, 0x400000); + + GfxDecode(0x8000, 4, 8, 8, Plane, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + + K053247GfxDecode(DrvGfxROM1, DrvGfxROMExp1, 0x400000); + + return 0; +} + +static const eeprom_interface simpsons_eeprom_intf = +{ + 7, // address bits + 8, // data bits + "011000", // read command + "011100", // write command + 0, // erase command + "0100000000000", // lock command + "0100110000000", // unlock command + 0, + 0 +}; + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; + if (BurnLoadRom(DrvKonROM + 0x030000, 1, 1)) return 1; + if (BurnLoadRom(DrvKonROM + 0x050000, 2, 1)) return 1; + if (BurnLoadRom(DrvKonROM + 0x070000, 3, 1)) return 1; + memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x88000, 0x8000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x300000, 10, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 11, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x100000, 12, 1)) return 1; + + DrvGfxDecode(); + } + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvKonRAM, 0x4000, 0x5fff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(simpsons_main_write); + konamiSetReadHandler(simpsons_main_read); + konamiSetlinesCallback(simpsons_set_lines); + konamiClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x08000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x08000); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(simpsons_sound_write); + ZetSetReadHandler(simpsons_sound_read); + ZetClose(); + + EEPROMInit(&simpsons_eeprom_intf); + + K052109Init(DrvGfxROM0, 0x0fffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(8, 0); + + K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 0x03 /* shadows & highlights */); + K053247SetSpriteOffset(-59, 39); + + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.00, BURN_SND_ROUTE_BOTH); // not connected + + K053260Init(0, 3579545, DrvSndROM, 0x140000); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + konamiExit(); + ZetExit(); + + EEPROMExit(); + + BurnYM2151Exit(); + K053260Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void simpsons_objdma() +{ + INT32 counter, num_inactive; + UINT8 *dstptr; + UINT16 *src, *dst; + + K053247Export(&dstptr, 0, 0, 0, &counter); + src = (UINT16*)DrvSprRAM; + dst = (UINT16*)dstptr; + num_inactive = counter = 256; + + do { + if ((*src & BURN_ENDIAN_SWAP_INT16(0x8000)) && (*src & BURN_ENDIAN_SWAP_INT16(0xff))) + { + memcpy(dst, src, 0x10); + dst += 8; + num_inactive--; + } + src += 8; + } + while (--counter); + + if (num_inactive) do { *dst = 0; dst += 8; } while (--num_inactive); +} + +static void DrvRecalcPal() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x1000 / 2; i++) { + UINT16 d = BURN_ENDIAN_SWAP_INT16((p[i] << 8) | (p[i] >> 8)); + + b = (d >> 10) & 0x1f; + g = (d >> 5) & 0x1f; + r = (d >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + Palette[i] = (r << 16) | (g << 8) | b; + } +} + +static void sortlayers(INT32 *layer,INT32 *pri) +{ +#define SWAP(a,b) \ + if (pri[a] < pri[b]) \ + { \ + INT32 t; \ + t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ + t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ + } + + SWAP(0,1) + SWAP(0,2) + SWAP(1,2) +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvRecalcPal(); + } + + K052109UpdateScroll(); + + INT32 layer[3]; + + bg_colorbase = K053251GetPaletteIndex(0); + sprite_colorbase = K053251GetPaletteIndex(1); + layer_colorbase[0] = K053251GetPaletteIndex(2); + layer_colorbase[1] = K053251GetPaletteIndex(3); + layer_colorbase[2] = K053251GetPaletteIndex(4); + + layerpri[0] = K053251GetPriority(2); + layerpri[1] = K053251GetPriority(3); + layerpri[2] = K053251GetPriority(4); + layer[0] = 0; + layer[1] = 1; + layer[2] = 2; + + sortlayers(layer,layerpri); + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 16 * bg_colorbase; + } + + if (nSpriteEnable & 8) K053247SpritesRender(DrvGfxROMExp1, 3); // title (simpsons behind clouds) + if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, DrvGfxROMExp0); // title (back-most cloud) + if (nSpriteEnable & 4) K053247SpritesRender(DrvGfxROMExp1, 2); // smithers' on first stage + if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0); // main layer (buildings, stage 1) + if (nSpriteEnable & 2) K053247SpritesRender(DrvGfxROMExp1, 1); // smithers' thugs on stage 1 + if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0); // game over text + if (nSpriteEnable & 1) K053247SpritesRender(DrvGfxROMExp1, 0); // not used? seems to make sense here... + + KonamiBlendCopy(Palette, DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + konamiNewFrame(); + + { + memset (DrvInputs, 0xff, 5); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + } + + // Clear Opposites + if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; + if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; + if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; + if ((DrvInputs[3] & 0x0c) == 0) DrvInputs[3] |= 0x0c; + if ((DrvInputs[3] & 0x03) == 0) DrvInputs[3] |= 0x03; + } + + INT32 nInterleave = nBurnSoundLen; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 }; + + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetOpen(0); + konamiOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext, nCyclesSegment; + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[0]; + nCyclesSegment = konamiRun(nCyclesSegment); + nCyclesDone[0] += nCyclesSegment; + + if (i == 1 && K053246Irq && simpsons_firq_enabled) { + konamiSetIrqLine(KONAMI_FIRQ_LINE, KONAMI_HOLD_LINE); + } + + K053246Irq = K053246_is_IRQ_enabled(); + + nNext = (i + 1) * nCyclesTotal[1] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[1]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[1] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K053246Irq) simpsons_objdma(); + if (K052109_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + } + } + + konamiClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + K053260Scan(nAction); + + KonamiICScan(nAction); + + EEPROMScan(nAction, pnMin); + + SCAN_VAR(videobank); + SCAN_VAR(init_eeprom_count); + SCAN_VAR(simpsons_firq_enabled); + SCAN_VAR(K053246Irq); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + simpsons_set_lines(nDrvBank[0]); + konamiClose(); + + ZetOpen(0); + DrvZ80Bankswitch(nDrvBank[1]); + ZetClose(); + } + + return 0; +} + + +// The Simpsons (4 Players World, set 1) + +static struct BurnRomInfo simpsonsRomDesc[] = { + { "072-g02.16c", 0x020000, 0x580ce1d6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "072-g01.17c", 0x020000, 0x9f843def, 1 | BRF_PRG | BRF_ESS }, // 1 + { "072-j13.13c", 0x020000, 0xaade2abd, 1 | BRF_PRG | BRF_ESS }, // 2 + { "072-j12.15c", 0x020000, 0x479e12f2, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "072-e03.6g", 0x020000, 0x866b7a35, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles + { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 + + { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles + { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 + { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 + { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 + + { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples + { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 + + { "simpsons.nv", 0x000080, 0xec3f0449, BRF_OPT }, +}; + +STD_ROM_PICK(simpsons) +STD_ROM_FN(simpsons) + +struct BurnDriver BurnDrvSimpsons = { + "simpsons", NULL, NULL, NULL, "1991", + "The Simpsons (4 Players World, set 1)\0", NULL, "Konami", "GX072", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, simpsonsRomInfo, simpsonsRomName, NULL, NULL, SimpsonsInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// The Simpsons (4 Players World, set 2) + +static struct BurnRomInfo simpsons4paRomDesc[] = { + { "072-g02.16c", 0x020000, 0x580ce1d6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "072-g01.17c", 0x020000, 0x9f843def, 1 | BRF_PRG | BRF_ESS }, // 1 + { "072-m13.13c", 0x020000, 0xf36c9423, 1 | BRF_PRG | BRF_ESS }, // 2 + { "072-l12.15c", 0x020000, 0x84f9d9ba, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "072-e03.6g", 0x020000, 0x866b7a35, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles + { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 + + { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles + { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 + { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 + { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 + + { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples + { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 + + { "simpsons4pa.nv", 0x000080, 0xec3f0449, BRF_OPT }, +}; + +STD_ROM_PICK(simpsons4pa) +STD_ROM_FN(simpsons4pa) + +struct BurnDriver BurnDrvSimpsons4pa = { + "simpsons4pa", "simpsons", NULL, NULL, "1991", + "The Simpsons (4 Players World, set 2)\0", NULL, "Konami", "GX072", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, simpsons4paRomInfo, simpsons4paRomName, NULL, NULL, SimpsonsInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// The Simpsons (2 Players World, set 1) + +static struct BurnRomInfo simpsons2pRomDesc[] = { + { "072-g02.16c", 0x020000, 0x580ce1d6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "072-p01.17c", 0x020000, 0x07ceeaea, 1 | BRF_PRG | BRF_ESS }, // 1 + { "072-013.13c", 0x020000, 0x8781105a, 1 | BRF_PRG | BRF_ESS }, // 2 + { "072-012.15c", 0x020000, 0x244f9289, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "072-g03.6g", 0x020000, 0x76c1850c, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles + { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 + + { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles + { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 + { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 + { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 + + { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples + { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 + + { "simpsons2p.nv", 0x000080, 0xfbac4e30, BRF_OPT }, +}; + +STD_ROM_PICK(simpsons2p) +STD_ROM_FN(simpsons2p) + +struct BurnDriver BurnDrvSimpsons2p = { + "simpsons2p", "simpsons", NULL, NULL, "1991", + "The Simpsons (2 Players World, set 1)\0", NULL, "Konami", "GX072", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, simpsons2pRomInfo, simpsons2pRomName, NULL, NULL, Simpsons2pInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// The Simpsons (2 Players World, set 2) + +static struct BurnRomInfo simpsons2p2RomDesc[] = { + { "072-g02.16c", 0x020000, 0x580ce1d6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "072-p01.17c", 0x020000, 0x07ceeaea, 1 | BRF_PRG | BRF_ESS }, // 1 + { "072-_13.13c", 0x020000, 0x54e6df66, 1 | BRF_PRG | BRF_ESS }, // 2 + { "072-_12.15c", 0x020000, 0x96636225, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "072-g03.6g", 0x020000, 0x76c1850c, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles + { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 + + { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles + { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 + { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 + { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 + + { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples + { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 + + { "simpsons2p2.nv", 0x000080, 0xfbac4e30, BRF_OPT }, +}; + +STD_ROM_PICK(simpsons2p2) +STD_ROM_FN(simpsons2p2) + +struct BurnDriver BurnDrvSimpsons2p2 = { + "simpsons2p2", "simpsons", NULL, NULL, "1991", + "The Simpsons (2 Players World, set 2)\0", NULL, "Konami", "GX072", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, simpsons2p2RomInfo, simpsons2p2RomName, NULL, NULL, SimpsonsInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// The Simpsons (2 Players Asia) + +static struct BurnRomInfo simpsons2paRomDesc[] = { + { "072-g02.16c", 0x020000, 0x580ce1d6, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "072-p01.17c", 0x020000, 0x07ceeaea, 1 | BRF_PRG | BRF_ESS }, // 1 + { "072-113.13c", 0x020000, 0x8781105a, 1 | BRF_PRG | BRF_ESS }, // 2 + { "072-112.15c", 0x020000, 0x3bd69404, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "072-e03.6g", 0x020000, 0x866b7a35, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles + { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 + + { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles + { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 + { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 + { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 + + { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples + { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 + + { "simpsons2pa.nv", 0x000080, 0xfbac4e30, BRF_OPT }, +}; + +STD_ROM_PICK(simpsons2pa) +STD_ROM_FN(simpsons2pa) + +struct BurnDriver BurnDrvSimpsons2pa = { + "simpsons2pa", "simpsons", NULL, NULL, "1991", + "The Simpsons (2 Players Asia)\0", NULL, "Konami", "GX072", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, simpsons2paRomInfo, simpsons2paRomName, NULL, NULL, Simpsons2pInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// The Simpsons (2 Players Japan) + +static struct BurnRomInfo simpsons2pjRomDesc[] = { + { "072-s02.16c", 0x020000, 0x265f7a47, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "072-t01.17c", 0x020000, 0x91de5c2d, 1 | BRF_PRG | BRF_ESS }, // 1 + { "072-213.13c", 0x020000, 0xb326a9ae, 1 | BRF_PRG | BRF_ESS }, // 2 + { "072-212.15c", 0x020000, 0x584d9d37, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "072-g03.6g", 0x020000, 0x76c1850c, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "072-b07.18h", 0x080000, 0xba1ec910, 3 | BRF_GRA }, // 5 K052109 Tiles + { "072-b06.16h", 0x080000, 0xcf2bbcab, 3 | BRF_GRA }, // 6 + + { "072-b08.3n", 0x100000, 0x7de500ad, 4 | BRF_GRA }, // 7 K053247 Tiles + { "072-b09.8n", 0x100000, 0xaa085093, 4 | BRF_GRA }, // 8 + { "072-b10.12n", 0x100000, 0x577dbd53, 4 | BRF_GRA }, // 9 + { "072-b11.16l", 0x100000, 0x55fab05d, 4 | BRF_GRA }, // 10 + + { "072-d05.1f", 0x100000, 0x1397a73b, 5 | BRF_SND }, // 11 K053260 Samples + { "072-d04.1d", 0x040000, 0x78778013, 5 | BRF_SND }, // 12 + + { "simpsons2pj.nv", 0x000080, 0x3550a54e, BRF_OPT }, +}; + +STD_ROM_PICK(simpsons2pj) +STD_ROM_FN(simpsons2pj) + +struct BurnDriver BurnDrvSimpsons2pj = { + "simpsons2pj", "simpsons", NULL, NULL, "1991", + "The Simpsons (2 Players Japan)\0", NULL, "Konami", "GX072", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, simpsons2pjRomInfo, simpsons2pjRomName, NULL, NULL, Simpsons2pInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_spy.cpp b/src/burn/drv/konami/d_spy.cpp index 3f034fc47..39b3e009a 100644 --- a/src/burn/drv/konami/d_spy.cpp +++ b/src/burn/drv/konami/d_spy.cpp @@ -1,813 +1,812 @@ -// FB Alpha S.P.Y. driver module -// Based on MAME driver by Nicola Salmoria and Acho A. Tang - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "m6809_intf.h" -#include "burn_ym3812.h" -#include "konamiic.h" -#include "k007232.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvM6809ROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *DrvBankRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvPMCRAM; -static UINT8 *DrvM6809RAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; - -static UINT8 *nDrvRomBank; - -static INT32 spy_video_enable; -static INT32 Drv3f90old; -static INT32 nRamBank; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[8]; -static UINT8 DrvReset; -static UINT8 DrvInputs[3]; - -static struct BurnInputInfo SpyInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 1, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 4, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 1, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 4, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Spy) - -static struct BurnDIPInfo SpyDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x5e, NULL }, - {0x14, 0xff, 0xff, 0xf0, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x03, "2" }, - {0x13, 0x01, 0x03, 0x02, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "10k and every 20k" }, - {0x13, 0x01, 0x18, 0x10, "20k and every 30k" }, - {0x13, 0x01, 0x18, 0x08, "20k only" }, - {0x13, 0x01, 0x18, 0x00, "30k only" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x10, 0x10, "Off" }, -// {0x14, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Power" }, - {0x14, 0x01, 0x20, 0x20, "Normal" }, - {0x14, 0x01, 0x20, 0x00, "Strong" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Continues" }, - {0x14, 0x01, 0x80, 0x80, "Unlimited" }, - {0x14, 0x01, 0x80, 0x00, "5 Times" }, -}; - -STDDIPINFO(Spy) - -static void DrvSetRAMBank(UINT8 bank, UINT8 data) -{ - nDrvRomBank[1] = bank; - nDrvRomBank[2] = data; - - if (data & 0x10) { - M6809MapMemory(DrvPalRAM, 0x0000, 0x07ff, M6809_RAM); - } else if (data & 0x20) { - if (bank & 0x80) { - M6809MapMemory(DrvPMCRAM, 0x0000, 0x07ff, M6809_RAM); - } else { - // unmap - M6809MapMemory(DrvM6809ROM + 0x800, 0x0000, 0x07ff, M6809_ROM); - M6809MapMemory(DrvM6809ROM + 0x000, 0x0000, 0x07ff, M6809_WRITE); - } - } else { - M6809MapMemory(DrvBankRAM, 0x0000, 0x07ff, M6809_RAM); - } -} - -static void spy_collision() -{ -#define MAX_SPRITES 64 -#define DEF_NEAR_PLANE 0x6400 -#define NEAR_PLANE_ZOOM 0x0100 -#define FAR_PLANE_ZOOM 0x0000 -#define pmcram DrvPMCRAM - - INT32 op1, x1, w1, z1, d1, y1, h1; - INT32 op2, x2, w2, z2, d2, y2, h2; - INT32 mode, i, loopend, nearplane; - - mode = pmcram[0x1]; - op1 = pmcram[0x2]; - if (op1 == 1) - { - x1 = (pmcram[0x3]<<8) + pmcram[0x4]; - w1 = (pmcram[0x5]<<8) + pmcram[0x6]; - z1 = (pmcram[0x7]<<8) + pmcram[0x8]; - d1 = (pmcram[0x9]<<8) + pmcram[0xa]; - y1 = (pmcram[0xb]<<8) + pmcram[0xc]; - h1 = (pmcram[0xd]<<8) + pmcram[0xe]; - - for (i=16; i<14*MAX_SPRITES + 2; i+=14) - { - op2 = pmcram[i]; - if (op2 || mode==0x0c) - { - x2 = (pmcram[i+0x1]<<8) + pmcram[i+0x2]; - w2 = (pmcram[i+0x3]<<8) + pmcram[i+0x4]; - z2 = (pmcram[i+0x5]<<8) + pmcram[i+0x6]; - d2 = (pmcram[i+0x7]<<8) + pmcram[i+0x8]; - y2 = (pmcram[i+0x9]<<8) + pmcram[i+0xa]; - h2 = (pmcram[i+0xb]<<8) + pmcram[i+0xc]; - - if (w2==0x58 && d2==0x04 && h2==0x10 && y2==0x30) h2 = y2; - - if ( (abs(x1-x2) 1) - { - loopend = (pmcram[0]<<8) + pmcram[1]; - nearplane = (pmcram[2]<<8) + pmcram[3]; - - if (loopend > MAX_SPRITES) loopend = MAX_SPRITES; - if (!nearplane) nearplane = DEF_NEAR_PLANE; - - loopend = (loopend<<1) + 4; - - for (i=4; i> 8; - pmcram[i+1] = op2 & 0xff; - } - - memset(pmcram+loopend, 0, 0x800-loopend); - } -} - -static void spy_3f90_w(INT32 data) -{ - K052109RMRDLine = data & 0x04; - - spy_video_enable = (~data & 0x08); - - nRamBank = data & 0xb0; - - DrvSetRAMBank(data & 0x80, data & 0x30); - - if ((data & 0x40) && (~Drv3f90old & 0x40)) - { - spy_collision(); - - M6809SetIRQLine(1 /*FIRQ*/, M6809_IRQSTATUS_ACK); - M6809Run(105); // delay or the M6809 won't read it... - M6809SetIRQLine(1 /*FIRQ*/, M6809_IRQSTATUS_NONE); - } - - Drv3f90old = data; -} - -static void bankswitch(INT32 data) -{ - nDrvRomBank[0] = data; - - INT32 nBank; - if (data & 0x10) { - nBank = 0x20000 + (data & 0x06) * 0x1000; - } else { - nBank = 0x10000 + (data & 0x0e) * 0x1000; - } - - M6809MapMemory(DrvM6809ROM + nBank, 0x6000, 0x7fff, M6809_ROM); -} - -void spy_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x3f80: - bankswitch(data); - return; - - case 0x3f90: - spy_3f90_w(data); - return; - - case 0x3fa0: - // watchdog - return; - - case 0x3fb0: - *soundlatch = data; - return; - - case 0x3fc0: - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - } - - if (address >= 0x2000 && address <= 0x5fff) { - K052109_051960_w(address - 0x2000, data); - return; - } -} - -UINT8 spy_main_read(UINT16 address) -{ - switch (address) - { - case 0x3fd0: - return (DrvInputs[2] & 0x0f) | (DrvDips[2] & 0xf0); - - case 0x3fd1: - return DrvInputs[0]; - - case 0x3fd2: - return DrvInputs[1]; - - case 0x3fd3: - return DrvDips[0]; - - case 0x3fe0: - return DrvDips[1]; - } - - if (address >= 0x2000 && address <= 0x5fff) { - return K052109_051960_r(address - 0x2000); - } - - return 0; -} - -static void sound_bankswitch(INT32 data) -{ - INT32 bank_A,bank_B; - - bank_A = (data >> 0) & 0x03; - bank_B = (data >> 2) & 0x03; - k007232_set_bank(0,bank_A,bank_B); - - bank_A = (data >> 4) & 0x03; - bank_B = (data >> 6) & 0x03; - k007232_set_bank(1,bank_A,bank_B); -} - -void __fastcall spy_sound_write(UINT16 address, UINT8 data) -{ - if ((address & 0xfff0) == 0xa000) { - K007232WriteReg(0, address & 0x0f, data); - return; - } - - if ((address & 0xfff0) == 0xb000) { - K007232WriteReg(1, address & 0x0f, data); - return; - } - - switch (address) - { - case 0x9000: - sound_bankswitch(data); - return; - - case 0xc000: - case 0xc001: - BurnYM3812Write(address & 1, data); - return; - } -} - -UINT8 __fastcall spy_sound_read(UINT16 address) -{ - if ((address & 0xfff0) == 0xa000) { - return K007232ReadReg(0, address & 0x0f); - } - - if ((address & 0xfff0) == 0xb000) { - return K007232ReadReg(1, address & 0x0f); - } - - switch (address) - { - case 0xc000: - case 0xc001: - return BurnYM3812Read(address & 1); - - case 0xd000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *flags, INT32 *) -{ - INT32 colorbase[3] = { 0x30, 0, 0x10 }; - - *flags = *color & 0x20; - *code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13); - *color = colorbase[layer] + ((*color & 0xc0) >> 6); -} - -static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) -{ - *priority = 0x00; - if ( *color & 0x10) *priority = 1; - if (~*color & 0x20) *priority = 2; - - *color = 0x20 | (*color & 0x0f); - - *code = *code & 0x1fff; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) ZetNmi(); -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3579545; -} - -static void DrvK007232VolCallback0(INT32 v) -{ - K007232SetVolume(0, 0, (v >> 4) * 0x11, 0); - K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); -} - -static void DrvK007232VolCallback1(INT32 v) -{ - K007232SetVolume(1, 0, (v >> 4) * 0x11, 0); - K007232SetVolume(1, 1, 0, (v & 0x0f) * 0x11); -} - -static int DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - M6809Open(0); - M6809Reset(); - M6809Close(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - KonamiICReset(); - - BurnYM3812Reset(); - - spy_video_enable = 0; - Drv3f90old = 0; - nRamBank = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvM6809ROM = Next; Next += 0x030000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x080000; - DrvGfxROM1 = Next; Next += 0x100000; - DrvGfxROMExp0 = Next; Next += 0x100000; - DrvGfxROMExp1 = Next; Next += 0x200000; - - DrvSndROM0 = Next; Next += 0x040000; - DrvSndROM1 = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); - - AllRam = Next; - - DrvPMCRAM = Next; Next += 0x000800; - DrvBankRAM = Next; Next += 0x000800; - DrvPalRAM = Next; Next += 0x000800; - DrvM6809RAM = Next; Next += 0x001800; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - nDrvRomBank = Next; Next += 0x000003; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x080000); - konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); - - GfxDecode(0x04000, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x02000, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvM6809ROM + 0x010000, 0, 1)) return 1; - if (BurnLoadRom(DrvM6809ROM + 0x020000, 1, 1)) return 1; - memcpy (DrvM6809ROM + 0x08000, DrvM6809ROM + 0x28000, 0x8000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 6, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x000000, 8, 1)) return 1; - - DrvGfxDecode(); - } - - M6809Init(1); - M6809Open(0); - M6809MapMemory(DrvM6809RAM, 0x0800, 0x1aff, M6809_RAM); - M6809MapMemory(DrvM6809ROM + 0x10000, 0x6000, 0x7fff, M6809_ROM); - M6809MapMemory(DrvM6809ROM + 0x08000, 0x8000, 0xffff, M6809_ROM); - M6809SetWriteHandler(spy_main_write); - M6809SetReadHandler(spy_main_read); - M6809Close(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(spy_sound_write); - ZetSetReadHandler(spy_sound_read); - ZetMemEnd(); - ZetClose(); - - K052109Init(DrvGfxROM0, 0x07ffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(-2, 0); - - K051960Init(DrvGfxROM1, 0x0fffff); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(0, 0); - - BurnYM3812Init(3579545, &DrvFMIRQHandler, DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3812(3579545); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - K007232Init(0, 3579545, DrvSndROM0, 0x40000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback0); - K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - K007232Init(1, 3579545, DrvSndROM1, 0x40000); - K007232SetPortWriteHandler(1, DrvK007232VolCallback1); - K007232PCMSetAllRoutes(1, 0.20, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - M6809Exit(); - ZetExit(); - - BurnYM3812Exit(); - - K007232Exit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800); - } - - K052109UpdateScroll(); - - if (spy_video_enable) { - K052109RenderLayer(1, 1, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 2); - K052109RenderLayer(2, 0, DrvGfxROMExp0); - K051960SpritesRender(DrvGfxROMExp1, 1); - K051960SpritesRender(DrvGfxROMExp1, 0); - K052109RenderLayer(0, 0, DrvGfxROMExp0); - } else { - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x0300; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - memset (DrvInputs, 0xff, 3); - - for (INT32 i = 0 ; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - if ((DrvInputs[0] & 0x06) == 0) DrvInputs[0] |= 0x06; - if ((DrvInputs[0] & 0x18) == 0) DrvInputs[0] |= 0x18; - if ((DrvInputs[1] & 0x06) == 0) DrvInputs[1] |= 0x06; - if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18; - } - - INT32 nCyclesSegment; - INT32 nInterleave = 100; - INT32 nCyclesTotal[2] = { (((3000000 / 60) * 133) / 100) /* 33% overclock */, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - M6809Open(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - nCyclesSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - nCyclesDone[0] += M6809Run(nCyclesSegment - nCyclesDone[0]); - - nCyclesSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); - nCyclesDone[1] += BurnTimerUpdateYM3812(nCyclesSegment - nCyclesDone[1]); - } - - if (K052109_irq_enabled) M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); - - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - K007232Update(0, pBurnSoundOut, nBurnSoundLen); - K007232Update(1, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - M6809Close(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - M6809Scan(nAction); - ZetScan(nAction); - - BurnYM3812Scan(nAction, pnMin); - K007232Scan(nAction, pnMin); - - KonamiICScan(nAction); - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(spy_video_enable); - SCAN_VAR(Drv3f90old); - SCAN_VAR(nRamBank); - } - - if (nAction & ACB_WRITE) { - M6809Open(0); - bankswitch(nDrvRomBank[0]); - DrvSetRAMBank(nDrvRomBank[1], nDrvRomBank[2]); - M6809Close(); - } - - return 0; -} - - -// S.P.Y. - Special Project Y (World ver. N) - -static struct BurnRomInfo spyRomDesc[] = { - { "857n03.bin", 0x10000, 0x97993b38, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "857n02.bin", 0x10000, 0x31a97efe, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "857d01.bin", 0x08000, 0xaad4210f, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "857b09.bin", 0x40000, 0xb8780966, 3 | BRF_GRA }, // 3 Background Tiles - { "857b08.bin", 0x40000, 0x3e4d8d50, 3 | BRF_GRA }, // 4 - - { "857b06.bin", 0x80000, 0x7b515fb1, 4 | BRF_GRA }, // 5 Sprites - { "857b05.bin", 0x80000, 0x27b0f73b, 4 | BRF_GRA }, // 6 - - { "857b07.bin", 0x40000, 0xce3512d4, 5 | BRF_SND }, // 7 K007232 #0 Samples - - { "857b04.bin", 0x40000, 0x20b83c13, 6 | BRF_SND }, // 8 K007232 #1 Samples - - { "857a10.bin", 0x00100, 0x32758507, 7 | BRF_OPT }, // 9 Proms -}; - -STD_ROM_PICK(spy) -STD_ROM_FN(spy) - -struct BurnDriver BurnDrvSpy = { - "spy", NULL, NULL, NULL, "1989", - "S.P.Y. - Special Project Y (World ver. N)\0", NULL, "Konami", "GX857", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, spyRomInfo, spyRomName, NULL, NULL, SpyInputInfo, SpyDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 304, 216, 4, 3 -}; - - -// S.P.Y. - Special Project Y (US ver. M) - -static struct BurnRomInfo spyuRomDesc[] = { - { "857m03.bin", 0x10000, 0x3bd87fa4, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "857m02.bin", 0x10000, 0x306cc659, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "857d01.bin", 0x08000, 0xaad4210f, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "857b09.bin", 0x40000, 0xb8780966, 3 | BRF_GRA }, // 3 Background Tiles - { "857b08.bin", 0x40000, 0x3e4d8d50, 3 | BRF_GRA }, // 4 - - { "857b06.bin", 0x80000, 0x7b515fb1, 4 | BRF_GRA }, // 5 Sprites - { "857b05.bin", 0x80000, 0x27b0f73b, 4 | BRF_GRA }, // 6 - - { "857b07.bin", 0x40000, 0xce3512d4, 5 | BRF_SND }, // 7 K007232 #0 Samples - - { "857b04.bin", 0x40000, 0x20b83c13, 6 | BRF_SND }, // 8 K007232 #1 Samples - - { "857a10.bin", 0x00100, 0x32758507, 7 | BRF_OPT }, // 9 Proms -}; - -STD_ROM_PICK(spyu) -STD_ROM_FN(spyu) - -struct BurnDriver BurnDrvSpyu = { - "spyu", "spy", NULL, NULL, "1989", - "S.P.Y. - Special Project Y (US ver. M)\0", NULL, "Konami", "GX857", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, spyuRomInfo, spyuRomName, NULL, NULL, SpyInputInfo, SpyDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 304, 216, 4, 3 -}; +// FB Alpha S.P.Y. driver module +// Based on MAME driver by Nicola Salmoria and Acho A. Tang + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "m6809_intf.h" +#include "burn_ym3812.h" +#include "konamiic.h" +#include "k007232.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvM6809ROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *DrvBankRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvPMCRAM; +static UINT8 *DrvM6809RAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; + +static UINT8 *nDrvRomBank; + +static INT32 spy_video_enable; +static INT32 Drv3f90old; +static INT32 nRamBank; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[8]; +static UINT8 DrvReset; +static UINT8 DrvInputs[3]; + +static struct BurnInputInfo SpyInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 1, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 4, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 1, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 4, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Spy) + +static struct BurnDIPInfo SpyDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x5e, NULL }, + {0x14, 0xff, 0xff, 0xf0, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x03, "2" }, + {0x13, 0x01, 0x03, 0x02, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "10k and every 20k" }, + {0x13, 0x01, 0x18, 0x10, "20k and every 30k" }, + {0x13, 0x01, 0x18, 0x08, "20k only" }, + {0x13, 0x01, 0x18, 0x00, "30k only" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x10, 0x10, "Off" }, +// {0x14, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Power" }, + {0x14, 0x01, 0x20, 0x20, "Normal" }, + {0x14, 0x01, 0x20, 0x00, "Strong" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Continues" }, + {0x14, 0x01, 0x80, 0x80, "Unlimited" }, + {0x14, 0x01, 0x80, 0x00, "5 Times" }, +}; + +STDDIPINFO(Spy) + +static void DrvSetRAMBank(UINT8 bank, UINT8 data) +{ + nDrvRomBank[1] = bank; + nDrvRomBank[2] = data; + + if (data & 0x10) { + M6809MapMemory(DrvPalRAM, 0x0000, 0x07ff, M6809_RAM); + } else if (data & 0x20) { + if (bank & 0x80) { + M6809MapMemory(DrvPMCRAM, 0x0000, 0x07ff, M6809_RAM); + } else { + // unmap + M6809MapMemory(DrvM6809ROM + 0x800, 0x0000, 0x07ff, M6809_ROM); + M6809MapMemory(DrvM6809ROM + 0x000, 0x0000, 0x07ff, M6809_WRITE); + } + } else { + M6809MapMemory(DrvBankRAM, 0x0000, 0x07ff, M6809_RAM); + } +} + +static void spy_collision() +{ +#define MAX_SPRITES 64 +#define DEF_NEAR_PLANE 0x6400 +#define NEAR_PLANE_ZOOM 0x0100 +#define FAR_PLANE_ZOOM 0x0000 +#define pmcram DrvPMCRAM + + INT32 op1, x1, w1, z1, d1, y1, h1; + INT32 op2, x2, w2, z2, d2, y2, h2; + INT32 mode, i, loopend, nearplane; + + mode = pmcram[0x1]; + op1 = pmcram[0x2]; + if (op1 == 1) + { + x1 = (pmcram[0x3]<<8) + pmcram[0x4]; + w1 = (pmcram[0x5]<<8) + pmcram[0x6]; + z1 = (pmcram[0x7]<<8) + pmcram[0x8]; + d1 = (pmcram[0x9]<<8) + pmcram[0xa]; + y1 = (pmcram[0xb]<<8) + pmcram[0xc]; + h1 = (pmcram[0xd]<<8) + pmcram[0xe]; + + for (i=16; i<14*MAX_SPRITES + 2; i+=14) + { + op2 = pmcram[i]; + if (op2 || mode==0x0c) + { + x2 = (pmcram[i+0x1]<<8) + pmcram[i+0x2]; + w2 = (pmcram[i+0x3]<<8) + pmcram[i+0x4]; + z2 = (pmcram[i+0x5]<<8) + pmcram[i+0x6]; + d2 = (pmcram[i+0x7]<<8) + pmcram[i+0x8]; + y2 = (pmcram[i+0x9]<<8) + pmcram[i+0xa]; + h2 = (pmcram[i+0xb]<<8) + pmcram[i+0xc]; + + if (w2==0x58 && d2==0x04 && h2==0x10 && y2==0x30) h2 = y2; + + if ( (abs(x1-x2) 1) + { + loopend = (pmcram[0]<<8) + pmcram[1]; + nearplane = (pmcram[2]<<8) + pmcram[3]; + + if (loopend > MAX_SPRITES) loopend = MAX_SPRITES; + if (!nearplane) nearplane = DEF_NEAR_PLANE; + + loopend = (loopend<<1) + 4; + + for (i=4; i> 8; + pmcram[i+1] = op2 & 0xff; + } + + memset(pmcram+loopend, 0, 0x800-loopend); + } +} + +static void spy_3f90_w(INT32 data) +{ + K052109RMRDLine = data & 0x04; + + spy_video_enable = (~data & 0x08); + + nRamBank = data & 0xb0; + + DrvSetRAMBank(data & 0x80, data & 0x30); + + if ((data & 0x40) && (~Drv3f90old & 0x40)) + { + spy_collision(); + + M6809SetIRQLine(1 /*FIRQ*/, M6809_IRQSTATUS_ACK); + M6809Run(105); // delay or the M6809 won't read it... + M6809SetIRQLine(1 /*FIRQ*/, M6809_IRQSTATUS_NONE); + } + + Drv3f90old = data; +} + +static void bankswitch(INT32 data) +{ + nDrvRomBank[0] = data; + + INT32 nBank; + if (data & 0x10) { + nBank = 0x20000 + (data & 0x06) * 0x1000; + } else { + nBank = 0x10000 + (data & 0x0e) * 0x1000; + } + + M6809MapMemory(DrvM6809ROM + nBank, 0x6000, 0x7fff, M6809_ROM); +} + +void spy_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x3f80: + bankswitch(data); + return; + + case 0x3f90: + spy_3f90_w(data); + return; + + case 0x3fa0: + // watchdog + return; + + case 0x3fb0: + *soundlatch = data; + return; + + case 0x3fc0: + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + } + + if (address >= 0x2000 && address <= 0x5fff) { + K052109_051960_w(address - 0x2000, data); + return; + } +} + +UINT8 spy_main_read(UINT16 address) +{ + switch (address) + { + case 0x3fd0: + return (DrvInputs[2] & 0x0f) | (DrvDips[2] & 0xf0); + + case 0x3fd1: + return DrvInputs[0]; + + case 0x3fd2: + return DrvInputs[1]; + + case 0x3fd3: + return DrvDips[0]; + + case 0x3fe0: + return DrvDips[1]; + } + + if (address >= 0x2000 && address <= 0x5fff) { + return K052109_051960_r(address - 0x2000); + } + + return 0; +} + +static void sound_bankswitch(INT32 data) +{ + INT32 bank_A,bank_B; + + bank_A = (data >> 0) & 0x03; + bank_B = (data >> 2) & 0x03; + k007232_set_bank(0,bank_A,bank_B); + + bank_A = (data >> 4) & 0x03; + bank_B = (data >> 6) & 0x03; + k007232_set_bank(1,bank_A,bank_B); +} + +void __fastcall spy_sound_write(UINT16 address, UINT8 data) +{ + if ((address & 0xfff0) == 0xa000) { + K007232WriteReg(0, address & 0x0f, data); + return; + } + + if ((address & 0xfff0) == 0xb000) { + K007232WriteReg(1, address & 0x0f, data); + return; + } + + switch (address) + { + case 0x9000: + sound_bankswitch(data); + return; + + case 0xc000: + case 0xc001: + BurnYM3812Write(address & 1, data); + return; + } +} + +UINT8 __fastcall spy_sound_read(UINT16 address) +{ + if ((address & 0xfff0) == 0xa000) { + return K007232ReadReg(0, address & 0x0f); + } + + if ((address & 0xfff0) == 0xb000) { + return K007232ReadReg(1, address & 0x0f); + } + + switch (address) + { + case 0xc000: + case 0xc001: + return BurnYM3812Read(address & 1); + + case 0xd000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *flags, INT32 *) +{ + INT32 colorbase[3] = { 0x30, 0, 0x10 }; + + *flags = *color & 0x20; + *code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13); + *color = colorbase[layer] + ((*color & 0xc0) >> 6); +} + +static void K051960Callback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) +{ + *priority = 0x00; + if ( *color & 0x10) *priority = 1; + if (~*color & 0x20) *priority = 2; + + *color = 0x20 | (*color & 0x0f); + + *code = *code & 0x1fff; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) ZetNmi(); +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3579545; +} + +static void DrvK007232VolCallback0(INT32 v) +{ + K007232SetVolume(0, 0, (v >> 4) * 0x11, 0); + K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); +} + +static void DrvK007232VolCallback1(INT32 v) +{ + K007232SetVolume(1, 0, (v >> 4) * 0x11, 0); + K007232SetVolume(1, 1, 0, (v & 0x0f) * 0x11); +} + +static int DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + M6809Open(0); + M6809Reset(); + M6809Close(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + KonamiICReset(); + + BurnYM3812Reset(); + + spy_video_enable = 0; + Drv3f90old = 0; + nRamBank = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvM6809ROM = Next; Next += 0x030000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x080000; + DrvGfxROM1 = Next; Next += 0x100000; + DrvGfxROMExp0 = Next; Next += 0x100000; + DrvGfxROMExp1 = Next; Next += 0x200000; + + DrvSndROM0 = Next; Next += 0x040000; + DrvSndROM1 = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); + + AllRam = Next; + + DrvPMCRAM = Next; Next += 0x000800; + DrvBankRAM = Next; Next += 0x000800; + DrvPalRAM = Next; Next += 0x000800; + DrvM6809RAM = Next; Next += 0x001800; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + nDrvRomBank = Next; Next += 0x000003; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x080000); + konami_rom_deinterleave_2(DrvGfxROM1, 0x100000); + + GfxDecode(0x04000, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x02000, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvM6809ROM + 0x010000, 0, 1)) return 1; + if (BurnLoadRom(DrvM6809ROM + 0x020000, 1, 1)) return 1; + memcpy (DrvM6809ROM + 0x08000, DrvM6809ROM + 0x28000, 0x8000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 6, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x000000, 8, 1)) return 1; + + DrvGfxDecode(); + } + + M6809Init(1); + M6809Open(0); + M6809MapMemory(DrvM6809RAM, 0x0800, 0x1aff, M6809_RAM); + M6809MapMemory(DrvM6809ROM + 0x10000, 0x6000, 0x7fff, M6809_ROM); + M6809MapMemory(DrvM6809ROM + 0x08000, 0x8000, 0xffff, M6809_ROM); + M6809SetWriteHandler(spy_main_write); + M6809SetReadHandler(spy_main_read); + M6809Close(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(spy_sound_write); + ZetSetReadHandler(spy_sound_read); + ZetClose(); + + K052109Init(DrvGfxROM0, 0x07ffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(-2, 0); + + K051960Init(DrvGfxROM1, 0x0fffff); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(0, 0); + + BurnYM3812Init(3579545, &DrvFMIRQHandler, DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3812(3579545); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + K007232Init(0, 3579545, DrvSndROM0, 0x40000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback0); + K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + K007232Init(1, 3579545, DrvSndROM1, 0x40000); + K007232SetPortWriteHandler(1, DrvK007232VolCallback1); + K007232PCMSetAllRoutes(1, 0.20, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + M6809Exit(); + ZetExit(); + + BurnYM3812Exit(); + + K007232Exit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800); + } + + K052109UpdateScroll(); + + if (spy_video_enable) { + K052109RenderLayer(1, 1, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 2); + K052109RenderLayer(2, 0, DrvGfxROMExp0); + K051960SpritesRender(DrvGfxROMExp1, 1); + K051960SpritesRender(DrvGfxROMExp1, 0); + K052109RenderLayer(0, 0, DrvGfxROMExp0); + } else { + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x0300; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + memset (DrvInputs, 0xff, 3); + + for (INT32 i = 0 ; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + if ((DrvInputs[0] & 0x06) == 0) DrvInputs[0] |= 0x06; + if ((DrvInputs[0] & 0x18) == 0) DrvInputs[0] |= 0x18; + if ((DrvInputs[1] & 0x06) == 0) DrvInputs[1] |= 0x06; + if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18; + } + + INT32 nCyclesSegment; + INT32 nInterleave = 100; + INT32 nCyclesTotal[2] = { (((3000000 / 60) * 133) / 100) /* 33% overclock */, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + M6809Open(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + nCyclesSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + nCyclesDone[0] += M6809Run(nCyclesSegment - nCyclesDone[0]); + + nCyclesSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); + nCyclesDone[1] += BurnTimerUpdateYM3812(nCyclesSegment - nCyclesDone[1]); + } + + if (K052109_irq_enabled) M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); + + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + K007232Update(0, pBurnSoundOut, nBurnSoundLen); + K007232Update(1, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + M6809Close(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + M6809Scan(nAction); + ZetScan(nAction); + + BurnYM3812Scan(nAction, pnMin); + K007232Scan(nAction, pnMin); + + KonamiICScan(nAction); + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(spy_video_enable); + SCAN_VAR(Drv3f90old); + SCAN_VAR(nRamBank); + } + + if (nAction & ACB_WRITE) { + M6809Open(0); + bankswitch(nDrvRomBank[0]); + DrvSetRAMBank(nDrvRomBank[1], nDrvRomBank[2]); + M6809Close(); + } + + return 0; +} + + +// S.P.Y. - Special Project Y (World ver. N) + +static struct BurnRomInfo spyRomDesc[] = { + { "857n03.bin", 0x10000, 0x97993b38, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "857n02.bin", 0x10000, 0x31a97efe, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "857d01.bin", 0x08000, 0xaad4210f, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "857b09.bin", 0x40000, 0xb8780966, 3 | BRF_GRA }, // 3 Background Tiles + { "857b08.bin", 0x40000, 0x3e4d8d50, 3 | BRF_GRA }, // 4 + + { "857b06.bin", 0x80000, 0x7b515fb1, 4 | BRF_GRA }, // 5 Sprites + { "857b05.bin", 0x80000, 0x27b0f73b, 4 | BRF_GRA }, // 6 + + { "857b07.bin", 0x40000, 0xce3512d4, 5 | BRF_SND }, // 7 K007232 #0 Samples + + { "857b04.bin", 0x40000, 0x20b83c13, 6 | BRF_SND }, // 8 K007232 #1 Samples + + { "857a10.bin", 0x00100, 0x32758507, 7 | BRF_OPT }, // 9 Proms +}; + +STD_ROM_PICK(spy) +STD_ROM_FN(spy) + +struct BurnDriver BurnDrvSpy = { + "spy", NULL, NULL, NULL, "1989", + "S.P.Y. - Special Project Y (World ver. N)\0", NULL, "Konami", "GX857", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, spyRomInfo, spyRomName, NULL, NULL, SpyInputInfo, SpyDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 304, 216, 4, 3 +}; + + +// S.P.Y. - Special Project Y (US ver. M) + +static struct BurnRomInfo spyuRomDesc[] = { + { "857m03.bin", 0x10000, 0x3bd87fa4, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "857m02.bin", 0x10000, 0x306cc659, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "857d01.bin", 0x08000, 0xaad4210f, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "857b09.bin", 0x40000, 0xb8780966, 3 | BRF_GRA }, // 3 Background Tiles + { "857b08.bin", 0x40000, 0x3e4d8d50, 3 | BRF_GRA }, // 4 + + { "857b06.bin", 0x80000, 0x7b515fb1, 4 | BRF_GRA }, // 5 Sprites + { "857b05.bin", 0x80000, 0x27b0f73b, 4 | BRF_GRA }, // 6 + + { "857b07.bin", 0x40000, 0xce3512d4, 5 | BRF_SND }, // 7 K007232 #0 Samples + + { "857b04.bin", 0x40000, 0x20b83c13, 6 | BRF_SND }, // 8 K007232 #1 Samples + + { "857a10.bin", 0x00100, 0x32758507, 7 | BRF_OPT }, // 9 Proms +}; + +STD_ROM_PICK(spyu) +STD_ROM_FN(spyu) + +struct BurnDriver BurnDrvSpyu = { + "spyu", "spy", NULL, NULL, "1989", + "S.P.Y. - Special Project Y (US ver. M)\0", NULL, "Konami", "GX857", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, spyuRomInfo, spyuRomName, NULL, NULL, SpyInputInfo, SpyDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 304, 216, 4, 3 +}; diff --git a/src/burn/drv/konami/d_thunderx.cpp b/src/burn/drv/konami/d_thunderx.cpp index 73f2b7fb0..2b74e6120 100644 --- a/src/burn/drv/konami/d_thunderx.cpp +++ b/src/burn/drv/konami/d_thunderx.cpp @@ -1,1174 +1,1173 @@ -// FB Alpha Thunder X / Super Contra driver module -// Based on MAME driver by by Bryan McPhail, Manuel Abadia, and Eddie Edwards - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" -#include "k007232.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM; -static UINT8 *DrvBankRAM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *nDrvKonamiBank; - -static UINT8 *pmcram; -static UINT8 thunderx_1f98_data; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static INT32 thunderx = 0; - -static struct BurnInputInfo ThunderxInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start"}, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start"}, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip"}, -}; - -STDINPUTINFO(Thunderx) - -static struct BurnDIPInfo ScontraDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x5a, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x03, "2" }, - {0x13, 0x01, 0x03, 0x02, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "30000 200000" }, - {0x13, 0x01, 0x18, 0x10, "50000 300000" }, - {0x13, 0x01, 0x18, 0x08, "30000" }, - {0x13, 0x01, 0x18, 0x00, "50000" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x01, 0x01, "Off" }, -// {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Continue Limit" }, - {0x14, 0x01, 0x08, 0x08, "3" }, - {0x14, 0x01, 0x08, 0x00, "5" }, -}; - -STDDIPINFO(Scontra) - -static struct BurnDIPInfo ThunderxDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x52, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x03, "2" }, - {0x13, 0x01, 0x03, 0x02, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Award Bonus Life" }, - {0x13, 0x01, 0x04, 0x04, "No" }, - {0x13, 0x01, 0x04, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "30000 200000" }, - {0x13, 0x01, 0x18, 0x10, "50000 300000" }, - {0x13, 0x01, 0x18, 0x08, "30000" }, - {0x13, 0x01, 0x18, 0x00, "50000" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x01, 0x01, "Off" }, -// {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Thunderx) - -static void run_collisions(INT32 s0, INT32 e0, INT32 s1, INT32 e1, INT32 cm, INT32 hm) -{ - INT32 ii, jj; - UINT8 *p0, *p1; - - p0 = &pmcram[16 + 5*s0]; - for (ii = s0; ii < e0; ii++, p0 += 5) - { - INT32 l0,r0,b0,t0; - - // check valid - if (!(p0[0] & cm)) continue; - - // get area - l0 = p0[3] - p0[1]; - r0 = p0[3] + p0[1]; - t0 = p0[4] - p0[2]; - b0 = p0[4] + p0[2]; - - p1 = &pmcram[16 + 5*s1]; - for (jj = s1; jj < e1; jj++,p1 += 5) - { - INT32 l1,r1,b1,t1; - - // check valid - if (!(p1[0] & hm)) continue; - - // get area - l1 = p1[3] - p1[1]; - r1 = p1[3] + p1[1]; - t1 = p1[4] - p1[2]; - b1 = p1[4] + p1[2]; - - // overlap check - if (l1 >= r0) continue; - if (l0 >= r1) continue; - if (t1 >= b0) continue; - if (t0 >= b1) continue; - - // set flags - p0[0] = (p0[0] & 0x9f) | (p1[0] & 0x04) | 0x10; - p1[0] = (p1[0] & 0x9f) | 0x10; - } - } -} - -static void calculate_collisions() -{ - INT32 X0,Y0; - INT32 X1,Y1; - INT32 CM,HM; - - Y0 = pmcram[0]; - Y0 = (Y0 << 8) + pmcram[1]; - Y0 = (Y0 - 15) / 5; - Y1 = (pmcram[2] - 15) / 5; - - if (pmcram[5] < 16) - { - // US Thunder Cross uses this form - X0 = pmcram[5]; - X0 = (X0 << 8) + pmcram[6]; - X0 = (X0 - 16) / 5; - X1 = (pmcram[7] - 16) / 5; - } - else - { - // Japan Thunder Cross uses this form - X0 = (pmcram[5] - 16) / 5; - X1 = (pmcram[6] - 16) / 5; - } - - CM = pmcram[3]; - HM = pmcram[4]; - - run_collisions(X0,Y0,X1,Y1,CM,HM); -} - -static void thunderx_1f98_w(UINT8 data) -{ - K052109RMRDLine = data & 0x01; - - if ((data & 4) && !(thunderx_1f98_data & 4)) - { - calculate_collisions(); - - konamiRun(10); - - konamiSetIrqLine(KONAMI_FIRQ_LINE, KONAMI_HOLD_LINE); // must be delayed - } - - thunderx_1f98_data = data; -} - -static void scontra_bankswitch(INT32 data) -{ - nDrvKonamiBank[0] = data; - - if (~data & 0x10) { - konamiMapMemory(DrvPalRAM, 0x5800, 0x5fff, KON_RAM); - } else { - konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); - } - - INT32 nBank = 0x10000 + (data & 0x0f) * 0x2000; - - konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); -} - -static void thunderx_videobank(INT32 data) -{ - nDrvKonamiBank[0] = data; - - if (data & 0x01) { - konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); - } else if (data & 0x10) { - if (thunderx_1f98_data & 2) { - konamiMapMemory(pmcram + 0x800, 0x5800, 0x5fff, KON_RAM); - } else { - konamiMapMemory(pmcram, 0x5800, 0x5fff, KON_RAM); // junk? - } - } else { - konamiMapMemory(DrvPalRAM, 0x5800, 0x5fff, KON_RAM); - } -} - -void scontra_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x1f80: - if (thunderx) { - thunderx_videobank(data); - } else { - scontra_bankswitch(data); - } - return; - - case 0x1f84: - *soundlatch = data; - return; - - case 0x1f88: - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - - case 0x1f8c: - // watchdog - return; - - case 0x1f98: - thunderx_1f98_w(data); - return; - } - - if (address < 0x4000) { - K052109_051960_w(address & 0x3fff, data); - return; - } -} - -UINT8 scontra_main_read(UINT16 address) -{ - switch (address) - { - case 0x1f90: - return DrvInputs[0]; - - case 0x1f91: - return DrvInputs[1]; - - case 0x1f92: - return DrvInputs[2]; - - case 0x1f93: - return DrvDips[2]; - - case 0x1f94: - return DrvDips[0]; - - case 0x1f95: - return DrvDips[1]; - - case 0x1f98: - return thunderx_1f98_data; - } - - if (address < 0x4000) { - return K052109_051960_r(address & 0x3fff); - } - - return 0; -} - -static void scontra_snd_bankswitch_w(INT32 data) -{ - INT32 bank_A = (data & 0x03); - INT32 bank_B = ((data >> 2) & 0x03); - k007232_set_bank(0, bank_A, bank_B ); -} - -void __fastcall scontra_sound_write(UINT16 address, UINT8 data) -{ - if ((address & 0xfff0) == 0xb000) { - K007232WriteReg(0, address & 0x0f, data); - return; - } - - switch (address) - { - case 0xc000: - BurnYM2151SelectRegister(data); - return; - - case 0xc001: - BurnYM2151WriteRegister(data); - return; - - case 0xf000: - scontra_snd_bankswitch_w(data); - return; - } -} - -UINT8 __fastcall scontra_sound_read(UINT16 address) -{ - if ((address & 0xfff0) == 0xb000) { - return K007232ReadReg(0, address & 0x0f); - } - - switch (address) - { - case 0xa000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0xc001: - return BurnYM2151ReadStatus(); - } - - return 0; -} - -static void DrvK007232VolCallback(INT32 v) -{ - K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); - K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); -} - -static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - INT32 layer_colorbase[3] = { 48, 0, 16 }; - - *code |= ((*color & 0x1f) << 8) | (bank << 13); - *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); -} - -static void K051960Callback(INT32 *, INT32 *color,INT32 *priority, INT32 *shadow) -{ - *priority = (*color & 0x30) >> 4; - *color = 0x20 + (*color & 0x0f); - *shadow = 0; -} - -static void thunderx_set_lines(INT32 lines) -{ - nDrvKonamiBank[0] = lines; - - INT32 nBank = 0x10000 + (((lines & 0x0f) ^ 0x08) * 0x2000); - if (nBank >= 0x28000) nBank -= 0x20000; - - konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x100000; - DrvGfxROM1 = Next; Next += 0x100000; - DrvGfxROMExp0 = Next; Next += 0x200000; - DrvGfxROMExp1 = Next; Next += 0x200000; - - DrvSndROM = Next; Next += 0x080000; - - DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); - - AllRam = Next; - - DrvBankRAM = Next; Next += 0x000800; - DrvKonRAM = Next; Next += 0x001800; - DrvPalRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - nDrvKonamiBank = Next; Next += 0x000002; - - pmcram = Next; Next += 0x001000; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x100000 >> thunderx); - konami_rom_deinterleave_2(DrvGfxROM1, 0x100000 >> thunderx); - - GfxDecode(0x08000 >> thunderx, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x02000 >> thunderx, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (strncmp(BurnDrvGetTextA(DRV_NAME), "scontra", 7) == 0) { - if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; - if (BurnLoadRom(DrvKonROM + 0x020000, 1, 1)) return 1; - memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x18000, 0x8000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040001, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060000, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060001, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080001, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0c0000, 11, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0c0001, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0e0000, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0e0001, 14, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 15, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 16, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 17, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020001, 18, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 19, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040001, 20, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060000, 21, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060001, 22, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 23, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080001, 24, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0a0000, 25, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0a0001, 26, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 27, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 28, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0e0000, 29, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0e0001, 30, 2)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 31, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x010000, 32, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x020000, 33, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x030000, 34, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x040000, 35, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x050000, 36, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x060000, 37, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x070000, 38, 1)) return 1; - } else { - if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; - if (BurnLoadRom(DrvKonROM + 0x020000, 1, 1)) return 1; - memcpy (DrvKonROM + 0x8000, DrvKonROM + 0x28000, 0x8000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x020000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x020001, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040001, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060000, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060001, 10, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 11, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020001, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 15, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040001, 16, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060000, 17, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060001, 18, 2)) return 1; - - thunderx = 1; - } - - DrvGfxDecode(); - } - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvKonRAM, 0x4000, 0x57ff, KON_RAM); - konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(scontra_main_write); - konamiSetReadHandler(scontra_main_read); - konamiSetlinesCallback(thunderx_set_lines); - konamiClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(scontra_sound_write); - ZetSetReadHandler(scontra_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - - K007232Init(0, 3579545, DrvSndROM, 0x80000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback); - K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - K052109Init(DrvGfxROM0, 0x0fffff >> thunderx); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(8, 0); - - K051960Init(DrvGfxROM1, 0x0fffff >> thunderx); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(8, 0); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - thunderx = 0; - - GenericTilesExit(); - - KonamiICExit(); - - konamiExit(); - ZetExit(); - - K007232Exit(); - BurnYM2151Exit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800); - } - - K052109UpdateScroll(); - -// K051960SpritesRender(DrvGfxROMExp1, 3); - - if (nDrvKonamiBank[0] & 0x08) - { - if (nBurnLayer & 1) K052109RenderLayer(2, 1, DrvGfxROMExp0); - if (nBurnLayer & 2) K052109RenderLayer(1, 0, DrvGfxROMExp0); - } - else - { - if (nBurnLayer & 8) K052109RenderLayer(2, 1, DrvGfxROMExp0); - if (nBurnLayer & 4) K052109RenderLayer(1, 0, DrvGfxROMExp0); - } - - K051960SpritesRender(DrvGfxROMExp1, 2); - - K051960SpritesRender(DrvGfxROMExp1, 1); - - K051960SpritesRender(DrvGfxROMExp1, 0); // mask? - - K052109RenderLayer(0, 0, DrvGfxROMExp0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear opposites - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; - if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; - } - - konamiNewFrame(); - ZetNewFrame(); - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 100; - INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetOpen(0); - konamiOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - - nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); - - nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); - - nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K052109_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - } - } - - konamiClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - K007232Scan(nAction, pnMin); - - KonamiICScan(nAction); - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(thunderx_1f98_data); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - if (thunderx) { - thunderx_videobank(nDrvKonamiBank[0]); - thunderx_set_lines(nDrvKonamiBank[1]); - } else { - scontra_bankswitch(nDrvKonamiBank[0]); - } - konamiClose(); - } - - return 0; -} - - -// Super Contra - -static struct BurnRomInfo scontraRomDesc[] = { - { "775-e02.k11", 0x10000, 0xa61c0ead, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "775-e03.k13", 0x10000, 0x00b02622, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "775-c01.bin", 0x08000, 0x0ced785a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "775-a07a.bin", 0x20000, 0xe716bdf3, 3 | BRF_GRA }, // 3 Background Tiles - { "775-a07e.bin", 0x20000, 0x0986e3a5, 3 | BRF_GRA }, // 4 - { "775-f07c.bin", 0x10000, 0xb0b30915, 3 | BRF_GRA }, // 5 - { "775-f07g.bin", 0x10000, 0xfbed827d, 3 | BRF_GRA }, // 6 - { "775-f07d.bin", 0x10000, 0xf184be8e, 3 | BRF_GRA }, // 7 - { "775-f07h.bin", 0x10000, 0x7b56c348, 3 | BRF_GRA }, // 8 - { "775-a08a.bin", 0x20000, 0x3ddd11a4, 3 | BRF_GRA }, // 9 - { "775-a08e.bin", 0x20000, 0x1007d963, 3 | BRF_GRA }, // 10 - { "775-f08c.bin", 0x10000, 0x53abdaec, 3 | BRF_GRA }, // 11 - { "775-f08g.bin", 0x10000, 0x3df85a6e, 3 | BRF_GRA }, // 12 - { "775-f08d.bin", 0x10000, 0x102dcace, 3 | BRF_GRA }, // 13 - { "775-f08h.bin", 0x10000, 0xad9d7016, 3 | BRF_GRA }, // 14 - - { "775-a05a.bin", 0x10000, 0xa0767045, 4 | BRF_GRA }, // 15 Sprites - { "775-a05e.bin", 0x10000, 0x2f656f08, 4 | BRF_GRA }, // 16 - { "775-a05b.bin", 0x10000, 0xab8ad4fd, 4 | BRF_GRA }, // 17 - { "775-a05f.bin", 0x10000, 0x1c0eb1b6, 4 | BRF_GRA }, // 18 - { "775-f05c.bin", 0x10000, 0x5647761e, 4 | BRF_GRA }, // 19 - { "775-f05g.bin", 0x10000, 0xa1692cca, 4 | BRF_GRA }, // 20 - { "775-f05d.bin", 0x10000, 0xad676a6f, 4 | BRF_GRA }, // 21 - { "775-f05h.bin", 0x10000, 0x3f925bcf, 4 | BRF_GRA }, // 22 - { "775-a06a.bin", 0x10000, 0x77a34ad0, 4 | BRF_GRA }, // 23 - { "775-a06e.bin", 0x10000, 0x8a910c94, 4 | BRF_GRA }, // 24 - { "775-a06b.bin", 0x10000, 0x563fb565, 4 | BRF_GRA }, // 25 - { "775-a06f.bin", 0x10000, 0xe14995c0, 4 | BRF_GRA }, // 26 - { "775-f06c.bin", 0x10000, 0x5ee6f3c1, 4 | BRF_GRA }, // 27 - { "775-f06g.bin", 0x10000, 0x2645274d, 4 | BRF_GRA }, // 28 - { "775-f06d.bin", 0x10000, 0xc8b764fa, 4 | BRF_GRA }, // 29 - { "775-f06h.bin", 0x10000, 0xd6595f59, 4 | BRF_GRA }, // 30 - - { "775-a04a.bin", 0x10000, 0x7efb2e0f, 5 | BRF_SND }, // 31 K007232 Samples - { "775-a04b.bin", 0x10000, 0xf41a2b33, 5 | BRF_SND }, // 32 - { "775-a04c.bin", 0x10000, 0xe4e58f14, 5 | BRF_SND }, // 33 - { "775-a04d.bin", 0x10000, 0xd46736f6, 5 | BRF_SND }, // 34 - { "775-f04e.bin", 0x10000, 0xfbf7e363, 5 | BRF_SND }, // 35 - { "775-f04f.bin", 0x10000, 0xb031ef2d, 5 | BRF_SND }, // 36 - { "775-f04g.bin", 0x10000, 0xee107bbb, 5 | BRF_SND }, // 37 - { "775-f04h.bin", 0x10000, 0xfb0fab46, 5 | BRF_SND }, // 38 - - { "775a09.b19", 0x00100, 0x46d1e0df, 6 | BRF_OPT }, // 39 Proms -}; - -STD_ROM_PICK(scontra) -STD_ROM_FN(scontra) - -struct BurnDriver BurnDrvScontra = { - "scontra", NULL, NULL, NULL, "1988", - "Super Contra\0", NULL, "Konami", "GX775", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT | GBF_HORSHOOT, 0, - NULL, scontraRomInfo, scontraRomName, NULL, NULL, ThunderxInputInfo, ScontraDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 224, 288, 3, 4 -}; - - -// Super Contra (Japan) - -static struct BurnRomInfo scontrajRomDesc[] = { - { "775-f02.bin", 0x10000, 0x8d5933a7, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "775-f03.bin", 0x10000, 0x1ef63d80, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "775-c01.bin", 0x08000, 0x0ced785a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "775-a07a.bin", 0x20000, 0xe716bdf3, 3 | BRF_GRA }, // 3 Background Tiles - { "775-a07e.bin", 0x20000, 0x0986e3a5, 3 | BRF_GRA }, // 4 - { "775-f07c.bin", 0x10000, 0xb0b30915, 3 | BRF_GRA }, // 5 - { "775-f07g.bin", 0x10000, 0xfbed827d, 3 | BRF_GRA }, // 6 - { "775-f07d.bin", 0x10000, 0xf184be8e, 3 | BRF_GRA }, // 7 - { "775-f07h.bin", 0x10000, 0x7b56c348, 3 | BRF_GRA }, // 8 - { "775-a08a.bin", 0x20000, 0x3ddd11a4, 3 | BRF_GRA }, // 9 - { "775-a08e.bin", 0x20000, 0x1007d963, 3 | BRF_GRA }, // 10 - { "775-f08c.bin", 0x10000, 0x53abdaec, 3 | BRF_GRA }, // 11 - { "775-f08g.bin", 0x10000, 0x3df85a6e, 3 | BRF_GRA }, // 12 - { "775-f08d.bin", 0x10000, 0x102dcace, 3 | BRF_GRA }, // 13 - { "775-f08h.bin", 0x10000, 0xad9d7016, 3 | BRF_GRA }, // 14 - - { "775-a05a.bin", 0x10000, 0xa0767045, 4 | BRF_GRA }, // 15 Sprites - { "775-a05e.bin", 0x10000, 0x2f656f08, 4 | BRF_GRA }, // 16 - { "775-a05b.bin", 0x10000, 0xab8ad4fd, 4 | BRF_GRA }, // 17 - { "775-a05f.bin", 0x10000, 0x1c0eb1b6, 4 | BRF_GRA }, // 18 - { "775-f05c.bin", 0x10000, 0x5647761e, 4 | BRF_GRA }, // 19 - { "775-f05g.bin", 0x10000, 0xa1692cca, 4 | BRF_GRA }, // 20 - { "775-f05d.bin", 0x10000, 0xad676a6f, 4 | BRF_GRA }, // 21 - { "775-f05h.bin", 0x10000, 0x3f925bcf, 4 | BRF_GRA }, // 22 - { "775-a06a.bin", 0x10000, 0x77a34ad0, 4 | BRF_GRA }, // 23 - { "775-a06e.bin", 0x10000, 0x8a910c94, 4 | BRF_GRA }, // 24 - { "775-a06b.bin", 0x10000, 0x563fb565, 4 | BRF_GRA }, // 25 - { "775-a06f.bin", 0x10000, 0xe14995c0, 4 | BRF_GRA }, // 26 - { "775-f06c.bin", 0x10000, 0x5ee6f3c1, 4 | BRF_GRA }, // 27 - { "775-f06g.bin", 0x10000, 0x2645274d, 4 | BRF_GRA }, // 28 - { "775-f06d.bin", 0x10000, 0xc8b764fa, 4 | BRF_GRA }, // 29 - { "775-f06h.bin", 0x10000, 0xd6595f59, 4 | BRF_GRA }, // 30 - - { "775-a04a.bin", 0x10000, 0x7efb2e0f, 5 | BRF_SND }, // 31 K007232 Samples - { "775-a04b.bin", 0x10000, 0xf41a2b33, 5 | BRF_SND }, // 32 - { "775-a04c.bin", 0x10000, 0xe4e58f14, 5 | BRF_SND }, // 33 - { "775-a04d.bin", 0x10000, 0xd46736f6, 5 | BRF_SND }, // 34 - { "775-f04e.bin", 0x10000, 0xfbf7e363, 5 | BRF_SND }, // 35 - { "775-f04f.bin", 0x10000, 0xb031ef2d, 5 | BRF_SND }, // 36 - { "775-f04g.bin", 0x10000, 0xee107bbb, 5 | BRF_SND }, // 37 - { "775-f04h.bin", 0x10000, 0xfb0fab46, 5 | BRF_SND }, // 38 - - { "775a09.b19", 0x00100, 0x46d1e0df, 6 | BRF_OPT }, // 39 Proms -}; - -STD_ROM_PICK(scontraj) -STD_ROM_FN(scontraj) - -struct BurnDriver BurnDrvScontraj = { - "scontraj", "scontra", NULL, NULL, "1988", - "Super Contra (Japan)\0", NULL, "Konami", "GX775", - L"Super \u9B42\u6597\u7F85 \u30A8\u30A4\u30EA\u30A2\u30F3 \u306E\u9006\u8972 (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT | GBF_HORSHOOT, 0, - NULL, scontrajRomInfo, scontrajRomName, NULL, NULL, ThunderxInputInfo, ScontraDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 224, 288, 3, 4 -}; - - -// Thunder Cross (set 1) - -static struct BurnRomInfo thunderxRomDesc[] = { - { "873-s03.k15", 0x10000, 0x2aec2699, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "873-s02.k13", 0x10000, 0x6619333a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "873-f01.f8", 0x08000, 0xea35ffa3, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "873c06a.f6", 0x10000, 0x0e340b67, 3 | BRF_GRA }, // 3 Background Tiles - { "873c06c.f5", 0x10000, 0xef0e72cd, 3 | BRF_GRA }, // 4 - { "873c06b.e6", 0x10000, 0x97ad202e, 3 | BRF_GRA }, // 5 - { "873c06d.e5", 0x10000, 0x8393d42e, 3 | BRF_GRA }, // 6 - { "873c07a.f4", 0x10000, 0xa8aab84f, 3 | BRF_GRA }, // 7 - { "873c07c.f3", 0x10000, 0x2521009a, 3 | BRF_GRA }, // 8 - { "873c07b.e4", 0x10000, 0x12a2b8ba, 3 | BRF_GRA }, // 9 - { "873c07d.e3", 0x10000, 0xfae9f965, 3 | BRF_GRA }, // 10 - - { "873c04a.f11", 0x10000, 0xf7740bf3, 4 | BRF_GRA }, // 11 Sprites - { "873c04c.f10", 0x10000, 0x5dacbd2b, 4 | BRF_GRA }, // 12 - { "873c04b.e11", 0x10000, 0x9ac581da, 4 | BRF_GRA }, // 13 - { "873c04d.e10", 0x10000, 0x44a4668c, 4 | BRF_GRA }, // 14 - { "873c05a.f9", 0x10000, 0xd73e107d, 4 | BRF_GRA }, // 15 - { "873c05c.f8", 0x10000, 0x59903200, 4 | BRF_GRA }, // 16 - { "873c05b.e9", 0x10000, 0x81059b99, 4 | BRF_GRA }, // 17 - { "873c05d.e8", 0x10000, 0x7fa3d7df, 4 | BRF_GRA }, // 18 - - { "873a08.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 19 Proms -}; - -STD_ROM_PICK(thunderx) -STD_ROM_FN(thunderx) - -struct BurnDriver BurnDrvThunderx = { - "thunderx", NULL, NULL, NULL, "1988", - "Thunder Cross (set 1)\0", NULL, "Konami", "GX873", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, thunderxRomInfo, thunderxRomName, NULL, NULL, ThunderxInputInfo, ThunderxDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; - - -// Thunder Cross (set 2) - -static struct BurnRomInfo thunderxaRomDesc[] = { - { "873-k03.k15", 0x10000, 0x276817ad, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "873-k02.k13", 0x10000, 0x80cc1c45, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "873-h01.f8", 0x08000, 0x990b7a7c, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "873c06a.f6", 0x10000, 0x0e340b67, 3 | BRF_GRA }, // 3 Background Tiles - { "873c06c.f5", 0x10000, 0xef0e72cd, 3 | BRF_GRA }, // 4 - { "873c06b.e6", 0x10000, 0x97ad202e, 3 | BRF_GRA }, // 5 - { "873c06d.e5", 0x10000, 0x8393d42e, 3 | BRF_GRA }, // 6 - { "873c07a.f4", 0x10000, 0xa8aab84f, 3 | BRF_GRA }, // 7 - { "873c07c.f3", 0x10000, 0x2521009a, 3 | BRF_GRA }, // 8 - { "873c07b.e4", 0x10000, 0x12a2b8ba, 3 | BRF_GRA }, // 9 - { "873c07d.e3", 0x10000, 0xfae9f965, 3 | BRF_GRA }, // 10 - - { "873c04a.f11", 0x10000, 0xf7740bf3, 4 | BRF_GRA }, // 11 Sprites - { "873c04c.f10", 0x10000, 0x5dacbd2b, 4 | BRF_GRA }, // 12 - { "873c04b.e11", 0x10000, 0x9ac581da, 4 | BRF_GRA }, // 13 - { "873c04d.e10", 0x10000, 0x44a4668c, 4 | BRF_GRA }, // 14 - { "873c05a.f9", 0x10000, 0xd73e107d, 4 | BRF_GRA }, // 15 - { "873c05c.f8", 0x10000, 0x59903200, 4 | BRF_GRA }, // 16 - { "873c05b.e9", 0x10000, 0x81059b99, 4 | BRF_GRA }, // 17 - { "873c05d.e8", 0x10000, 0x7fa3d7df, 4 | BRF_GRA }, // 18 - - { "873a08.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 19 Proms -}; - -STD_ROM_PICK(thunderxa) -STD_ROM_FN(thunderxa) - -struct BurnDriver BurnDrvThunderxa = { - "thunderxa", "thunderx", NULL, NULL, "1988", - "Thunder Cross (set 2)\0", NULL, "Konami", "GX873", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, thunderxaRomInfo, thunderxaRomName, NULL, NULL, ThunderxInputInfo, ThunderxDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; - - -// Thunder Cross (set 3) - -static struct BurnRomInfo thunderxbRomDesc[] = { - { "873-03.k15", 0x10000, 0x36680a4e, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "873-02.k13", 0x10000, 0xc58b2c34, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "873-f01.f8", 0x08000, 0xea35ffa3, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "873c06a.f6", 0x10000, 0x0e340b67, 3 | BRF_GRA }, // 3 Background Tiles - { "873c06c.f5", 0x10000, 0xef0e72cd, 3 | BRF_GRA }, // 4 - { "873c06b.e6", 0x10000, 0x97ad202e, 3 | BRF_GRA }, // 5 - { "873c06d.e5", 0x10000, 0x8393d42e, 3 | BRF_GRA }, // 6 - { "873c07a.f4", 0x10000, 0xa8aab84f, 3 | BRF_GRA }, // 7 - { "873c07c.f3", 0x10000, 0x2521009a, 3 | BRF_GRA }, // 8 - { "873c07b.e4", 0x10000, 0x12a2b8ba, 3 | BRF_GRA }, // 9 - { "873c07d.e3", 0x10000, 0xfae9f965, 3 | BRF_GRA }, // 10 - - { "873c04a.f11", 0x10000, 0xf7740bf3, 4 | BRF_GRA }, // 11 Sprites - { "873c04c.f10", 0x10000, 0x5dacbd2b, 4 | BRF_GRA }, // 12 - { "873c04b.e11", 0x10000, 0x9ac581da, 4 | BRF_GRA }, // 13 - { "873c04d.e10", 0x10000, 0x44a4668c, 4 | BRF_GRA }, // 14 - { "873c05a.f9", 0x10000, 0xd73e107d, 4 | BRF_GRA }, // 15 - { "873c05c.f8", 0x10000, 0x59903200, 4 | BRF_GRA }, // 16 - { "873c05b.e9", 0x10000, 0x81059b99, 4 | BRF_GRA }, // 17 - { "873c05d.e8", 0x10000, 0x7fa3d7df, 4 | BRF_GRA }, // 18 - - { "873a08.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 19 Proms -}; - -STD_ROM_PICK(thunderxb) -STD_ROM_FN(thunderxb) - -struct BurnDriver BurnDrvThunderxb = { - "thunderxb", "thunderx", NULL, NULL, "1988", - "Thunder Cross (set 3)\0", NULL, "Konami", "GX873", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, thunderxbRomInfo, thunderxbRomName, NULL, NULL, ThunderxInputInfo, ThunderxDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; - - -// Thunder Cross (Japan) - -static struct BurnRomInfo thunderxjRomDesc[] = { - { "873-n03.k15", 0x10000, 0xa01e2e3e, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - { "873-n02.k13", 0x10000, 0x55afa2cc, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "873-f01.f8", 0x08000, 0xea35ffa3, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "873c06a.f6", 0x10000, 0x0e340b67, 3 | BRF_GRA }, // 3 Background Tiles - { "873c06c.f5", 0x10000, 0xef0e72cd, 3 | BRF_GRA }, // 4 - { "873c06b.e6", 0x10000, 0x97ad202e, 3 | BRF_GRA }, // 5 - { "873c06d.e5", 0x10000, 0x8393d42e, 3 | BRF_GRA }, // 6 - { "873c07a.f4", 0x10000, 0xa8aab84f, 3 | BRF_GRA }, // 7 - { "873c07c.f3", 0x10000, 0x2521009a, 3 | BRF_GRA }, // 8 - { "873c07b.e4", 0x10000, 0x12a2b8ba, 3 | BRF_GRA }, // 9 - { "873c07d.e3", 0x10000, 0xfae9f965, 3 | BRF_GRA }, // 10 - - { "873c04a.f11", 0x10000, 0xf7740bf3, 4 | BRF_GRA }, // 11 Sprites - { "873c04c.f10", 0x10000, 0x5dacbd2b, 4 | BRF_GRA }, // 12 - { "873c04b.e11", 0x10000, 0x9ac581da, 4 | BRF_GRA }, // 13 - { "873c04d.e10", 0x10000, 0x44a4668c, 4 | BRF_GRA }, // 14 - { "873c05a.f9", 0x10000, 0xd73e107d, 4 | BRF_GRA }, // 15 - { "873c05c.f8", 0x10000, 0x59903200, 4 | BRF_GRA }, // 16 - { "873c05b.e9", 0x10000, 0x81059b99, 4 | BRF_GRA }, // 17 - { "873c05d.e8", 0x10000, 0x7fa3d7df, 4 | BRF_GRA }, // 18 - - { "873a08.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 19 Proms -}; - -STD_ROM_PICK(thunderxj) -STD_ROM_FN(thunderxj) - -struct BurnDriver BurnDrvThunderxj = { - "thunderxj", "thunderx", NULL, NULL, "1988", - "Thunder Cross (Japan)\0", NULL, "Konami", "GX873", - L"Thunder Cross\0\u30B5\u30F3\u30C0\u30FC\u30AF\u30ED\u30B9 (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, thunderxjRomInfo, thunderxjRomName, NULL, NULL, ThunderxInputInfo, ThunderxDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 288, 224, 4, 3 -}; +// FB Alpha Thunder X / Super Contra driver module +// Based on MAME driver by by Bryan McPhail, Manuel Abadia, and Eddie Edwards + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" +#include "k007232.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM; +static UINT8 *DrvBankRAM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *nDrvKonamiBank; + +static UINT8 *pmcram; +static UINT8 thunderx_1f98_data; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static INT32 thunderx = 0; + +static struct BurnInputInfo ThunderxInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start"}, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start"}, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip"}, +}; + +STDINPUTINFO(Thunderx) + +static struct BurnDIPInfo ScontraDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x5a, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x03, "2" }, + {0x13, 0x01, 0x03, 0x02, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "30000 200000" }, + {0x13, 0x01, 0x18, 0x10, "50000 300000" }, + {0x13, 0x01, 0x18, 0x08, "30000" }, + {0x13, 0x01, 0x18, 0x00, "50000" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x01, 0x01, "Off" }, +// {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Continue Limit" }, + {0x14, 0x01, 0x08, 0x08, "3" }, + {0x14, 0x01, 0x08, 0x00, "5" }, +}; + +STDDIPINFO(Scontra) + +static struct BurnDIPInfo ThunderxDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x52, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x03, "2" }, + {0x13, 0x01, 0x03, 0x02, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Award Bonus Life" }, + {0x13, 0x01, 0x04, 0x04, "No" }, + {0x13, 0x01, 0x04, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "30000 200000" }, + {0x13, 0x01, 0x18, 0x10, "50000 300000" }, + {0x13, 0x01, 0x18, 0x08, "30000" }, + {0x13, 0x01, 0x18, 0x00, "50000" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x01, 0x01, "Off" }, +// {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Thunderx) + +static void run_collisions(INT32 s0, INT32 e0, INT32 s1, INT32 e1, INT32 cm, INT32 hm) +{ + INT32 ii, jj; + UINT8 *p0, *p1; + + p0 = &pmcram[16 + 5*s0]; + for (ii = s0; ii < e0; ii++, p0 += 5) + { + INT32 l0,r0,b0,t0; + + // check valid + if (!(p0[0] & cm)) continue; + + // get area + l0 = p0[3] - p0[1]; + r0 = p0[3] + p0[1]; + t0 = p0[4] - p0[2]; + b0 = p0[4] + p0[2]; + + p1 = &pmcram[16 + 5*s1]; + for (jj = s1; jj < e1; jj++,p1 += 5) + { + INT32 l1,r1,b1,t1; + + // check valid + if (!(p1[0] & hm)) continue; + + // get area + l1 = p1[3] - p1[1]; + r1 = p1[3] + p1[1]; + t1 = p1[4] - p1[2]; + b1 = p1[4] + p1[2]; + + // overlap check + if (l1 >= r0) continue; + if (l0 >= r1) continue; + if (t1 >= b0) continue; + if (t0 >= b1) continue; + + // set flags + p0[0] = (p0[0] & 0x9f) | (p1[0] & 0x04) | 0x10; + p1[0] = (p1[0] & 0x9f) | 0x10; + } + } +} + +static void calculate_collisions() +{ + INT32 X0,Y0; + INT32 X1,Y1; + INT32 CM,HM; + + Y0 = pmcram[0]; + Y0 = (Y0 << 8) + pmcram[1]; + Y0 = (Y0 - 15) / 5; + Y1 = (pmcram[2] - 15) / 5; + + if (pmcram[5] < 16) + { + // US Thunder Cross uses this form + X0 = pmcram[5]; + X0 = (X0 << 8) + pmcram[6]; + X0 = (X0 - 16) / 5; + X1 = (pmcram[7] - 16) / 5; + } + else + { + // Japan Thunder Cross uses this form + X0 = (pmcram[5] - 16) / 5; + X1 = (pmcram[6] - 16) / 5; + } + + CM = pmcram[3]; + HM = pmcram[4]; + + run_collisions(X0,Y0,X1,Y1,CM,HM); +} + +static void thunderx_1f98_w(UINT8 data) +{ + K052109RMRDLine = data & 0x01; + + if ((data & 4) && !(thunderx_1f98_data & 4)) + { + calculate_collisions(); + + konamiRun(10); + + konamiSetIrqLine(KONAMI_FIRQ_LINE, KONAMI_HOLD_LINE); // must be delayed + } + + thunderx_1f98_data = data; +} + +static void scontra_bankswitch(INT32 data) +{ + nDrvKonamiBank[0] = data; + + if (~data & 0x10) { + konamiMapMemory(DrvPalRAM, 0x5800, 0x5fff, KON_RAM); + } else { + konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); + } + + INT32 nBank = 0x10000 + (data & 0x0f) * 0x2000; + + konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); +} + +static void thunderx_videobank(INT32 data) +{ + nDrvKonamiBank[0] = data; + + if (data & 0x01) { + konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); + } else if (data & 0x10) { + if (thunderx_1f98_data & 2) { + konamiMapMemory(pmcram + 0x800, 0x5800, 0x5fff, KON_RAM); + } else { + konamiMapMemory(pmcram, 0x5800, 0x5fff, KON_RAM); // junk? + } + } else { + konamiMapMemory(DrvPalRAM, 0x5800, 0x5fff, KON_RAM); + } +} + +void scontra_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x1f80: + if (thunderx) { + thunderx_videobank(data); + } else { + scontra_bankswitch(data); + } + return; + + case 0x1f84: + *soundlatch = data; + return; + + case 0x1f88: + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + + case 0x1f8c: + // watchdog + return; + + case 0x1f98: + thunderx_1f98_w(data); + return; + } + + if (address < 0x4000) { + K052109_051960_w(address & 0x3fff, data); + return; + } +} + +UINT8 scontra_main_read(UINT16 address) +{ + switch (address) + { + case 0x1f90: + return DrvInputs[0]; + + case 0x1f91: + return DrvInputs[1]; + + case 0x1f92: + return DrvInputs[2]; + + case 0x1f93: + return DrvDips[2]; + + case 0x1f94: + return DrvDips[0]; + + case 0x1f95: + return DrvDips[1]; + + case 0x1f98: + return thunderx_1f98_data; + } + + if (address < 0x4000) { + return K052109_051960_r(address & 0x3fff); + } + + return 0; +} + +static void scontra_snd_bankswitch_w(INT32 data) +{ + INT32 bank_A = (data & 0x03); + INT32 bank_B = ((data >> 2) & 0x03); + k007232_set_bank(0, bank_A, bank_B ); +} + +void __fastcall scontra_sound_write(UINT16 address, UINT8 data) +{ + if ((address & 0xfff0) == 0xb000) { + K007232WriteReg(0, address & 0x0f, data); + return; + } + + switch (address) + { + case 0xc000: + BurnYM2151SelectRegister(data); + return; + + case 0xc001: + BurnYM2151WriteRegister(data); + return; + + case 0xf000: + scontra_snd_bankswitch_w(data); + return; + } +} + +UINT8 __fastcall scontra_sound_read(UINT16 address) +{ + if ((address & 0xfff0) == 0xb000) { + return K007232ReadReg(0, address & 0x0f); + } + + switch (address) + { + case 0xa000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0xc001: + return BurnYM2151ReadStatus(); + } + + return 0; +} + +static void DrvK007232VolCallback(INT32 v) +{ + K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); + K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); +} + +static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + INT32 layer_colorbase[3] = { 48, 0, 16 }; + + *code |= ((*color & 0x1f) << 8) | (bank << 13); + *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); +} + +static void K051960Callback(INT32 *, INT32 *color,INT32 *priority, INT32 *shadow) +{ + *priority = (*color & 0x30) >> 4; + *color = 0x20 + (*color & 0x0f); + *shadow = 0; +} + +static void thunderx_set_lines(INT32 lines) +{ + nDrvKonamiBank[0] = lines; + + INT32 nBank = 0x10000 + (((lines & 0x0f) ^ 0x08) * 0x2000); + if (nBank >= 0x28000) nBank -= 0x20000; + + konamiMapMemory(DrvKonROM + nBank, 0x6000, 0x7fff, KON_ROM); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x100000; + DrvGfxROM1 = Next; Next += 0x100000; + DrvGfxROMExp0 = Next; Next += 0x200000; + DrvGfxROMExp1 = Next; Next += 0x200000; + + DrvSndROM = Next; Next += 0x080000; + + DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); + + AllRam = Next; + + DrvBankRAM = Next; Next += 0x000800; + DrvKonRAM = Next; Next += 0x001800; + DrvPalRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + nDrvKonamiBank = Next; Next += 0x000002; + + pmcram = Next; Next += 0x001000; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 Plane1[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x100000 >> thunderx); + konami_rom_deinterleave_2(DrvGfxROM1, 0x100000 >> thunderx); + + GfxDecode(0x08000 >> thunderx, 4, 8, 8, Plane0, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x02000 >> thunderx, 4, 16, 16, Plane1, XOffs, YOffs, 0x400, DrvGfxROM1, DrvGfxROMExp1); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (strncmp(BurnDrvGetTextA(DRV_NAME), "scontra", 7) == 0) { + if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; + if (BurnLoadRom(DrvKonROM + 0x020000, 1, 1)) return 1; + memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x18000, 0x8000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040001, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060000, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060001, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080001, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0c0000, 11, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0c0001, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0e0000, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0e0001, 14, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 15, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 16, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 17, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020001, 18, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 19, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040001, 20, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060000, 21, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060001, 22, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 23, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080001, 24, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0a0000, 25, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0a0001, 26, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 27, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 28, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0e0000, 29, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0e0001, 30, 2)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 31, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x010000, 32, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x020000, 33, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x030000, 34, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x040000, 35, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x050000, 36, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x060000, 37, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x070000, 38, 1)) return 1; + } else { + if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; + if (BurnLoadRom(DrvKonROM + 0x020000, 1, 1)) return 1; + memcpy (DrvKonROM + 0x8000, DrvKonROM + 0x28000, 0x8000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x020000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x020001, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040001, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060000, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060001, 10, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 11, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020001, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 15, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040001, 16, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060000, 17, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060001, 18, 2)) return 1; + + thunderx = 1; + } + + DrvGfxDecode(); + } + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvKonRAM, 0x4000, 0x57ff, KON_RAM); + konamiMapMemory(DrvBankRAM, 0x5800, 0x5fff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(scontra_main_write); + konamiSetReadHandler(scontra_main_read); + konamiSetlinesCallback(thunderx_set_lines); + konamiClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(scontra_sound_write); + ZetSetReadHandler(scontra_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + + K007232Init(0, 3579545, DrvSndROM, 0x80000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback); + K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + K052109Init(DrvGfxROM0, 0x0fffff >> thunderx); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(8, 0); + + K051960Init(DrvGfxROM1, 0x0fffff >> thunderx); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(8, 0); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + thunderx = 0; + + GenericTilesExit(); + + KonamiICExit(); + + konamiExit(); + ZetExit(); + + K007232Exit(); + BurnYM2151Exit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + KonamiRecalcPal(DrvPalRAM, DrvPalette, 0x800); + } + + K052109UpdateScroll(); + +// K051960SpritesRender(DrvGfxROMExp1, 3); + + if (nDrvKonamiBank[0] & 0x08) + { + if (nBurnLayer & 1) K052109RenderLayer(2, 1, DrvGfxROMExp0); + if (nBurnLayer & 2) K052109RenderLayer(1, 0, DrvGfxROMExp0); + } + else + { + if (nBurnLayer & 8) K052109RenderLayer(2, 1, DrvGfxROMExp0); + if (nBurnLayer & 4) K052109RenderLayer(1, 0, DrvGfxROMExp0); + } + + K051960SpritesRender(DrvGfxROMExp1, 2); + + K051960SpritesRender(DrvGfxROMExp1, 1); + + K051960SpritesRender(DrvGfxROMExp1, 0); // mask? + + K052109RenderLayer(0, 0, DrvGfxROMExp0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear opposites + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; + if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; + } + + konamiNewFrame(); + ZetNewFrame(); + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 100; + INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetOpen(0); + konamiOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + + nCyclesDone[0] += konamiRun(nSegment - nCyclesDone[0]); + + nSegment = (nCyclesTotal[1] / nInterleave) * (i + 1); + + nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K052109_irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + } + } + + konamiClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + K007232Scan(nAction, pnMin); + + KonamiICScan(nAction); + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(thunderx_1f98_data); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + if (thunderx) { + thunderx_videobank(nDrvKonamiBank[0]); + thunderx_set_lines(nDrvKonamiBank[1]); + } else { + scontra_bankswitch(nDrvKonamiBank[0]); + } + konamiClose(); + } + + return 0; +} + + +// Super Contra + +static struct BurnRomInfo scontraRomDesc[] = { + { "775-e02.k11", 0x10000, 0xa61c0ead, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "775-e03.k13", 0x10000, 0x00b02622, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "775-c01.bin", 0x08000, 0x0ced785a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "775-a07a.bin", 0x20000, 0xe716bdf3, 3 | BRF_GRA }, // 3 Background Tiles + { "775-a07e.bin", 0x20000, 0x0986e3a5, 3 | BRF_GRA }, // 4 + { "775-f07c.bin", 0x10000, 0xb0b30915, 3 | BRF_GRA }, // 5 + { "775-f07g.bin", 0x10000, 0xfbed827d, 3 | BRF_GRA }, // 6 + { "775-f07d.bin", 0x10000, 0xf184be8e, 3 | BRF_GRA }, // 7 + { "775-f07h.bin", 0x10000, 0x7b56c348, 3 | BRF_GRA }, // 8 + { "775-a08a.bin", 0x20000, 0x3ddd11a4, 3 | BRF_GRA }, // 9 + { "775-a08e.bin", 0x20000, 0x1007d963, 3 | BRF_GRA }, // 10 + { "775-f08c.bin", 0x10000, 0x53abdaec, 3 | BRF_GRA }, // 11 + { "775-f08g.bin", 0x10000, 0x3df85a6e, 3 | BRF_GRA }, // 12 + { "775-f08d.bin", 0x10000, 0x102dcace, 3 | BRF_GRA }, // 13 + { "775-f08h.bin", 0x10000, 0xad9d7016, 3 | BRF_GRA }, // 14 + + { "775-a05a.bin", 0x10000, 0xa0767045, 4 | BRF_GRA }, // 15 Sprites + { "775-a05e.bin", 0x10000, 0x2f656f08, 4 | BRF_GRA }, // 16 + { "775-a05b.bin", 0x10000, 0xab8ad4fd, 4 | BRF_GRA }, // 17 + { "775-a05f.bin", 0x10000, 0x1c0eb1b6, 4 | BRF_GRA }, // 18 + { "775-f05c.bin", 0x10000, 0x5647761e, 4 | BRF_GRA }, // 19 + { "775-f05g.bin", 0x10000, 0xa1692cca, 4 | BRF_GRA }, // 20 + { "775-f05d.bin", 0x10000, 0xad676a6f, 4 | BRF_GRA }, // 21 + { "775-f05h.bin", 0x10000, 0x3f925bcf, 4 | BRF_GRA }, // 22 + { "775-a06a.bin", 0x10000, 0x77a34ad0, 4 | BRF_GRA }, // 23 + { "775-a06e.bin", 0x10000, 0x8a910c94, 4 | BRF_GRA }, // 24 + { "775-a06b.bin", 0x10000, 0x563fb565, 4 | BRF_GRA }, // 25 + { "775-a06f.bin", 0x10000, 0xe14995c0, 4 | BRF_GRA }, // 26 + { "775-f06c.bin", 0x10000, 0x5ee6f3c1, 4 | BRF_GRA }, // 27 + { "775-f06g.bin", 0x10000, 0x2645274d, 4 | BRF_GRA }, // 28 + { "775-f06d.bin", 0x10000, 0xc8b764fa, 4 | BRF_GRA }, // 29 + { "775-f06h.bin", 0x10000, 0xd6595f59, 4 | BRF_GRA }, // 30 + + { "775-a04a.bin", 0x10000, 0x7efb2e0f, 5 | BRF_SND }, // 31 K007232 Samples + { "775-a04b.bin", 0x10000, 0xf41a2b33, 5 | BRF_SND }, // 32 + { "775-a04c.bin", 0x10000, 0xe4e58f14, 5 | BRF_SND }, // 33 + { "775-a04d.bin", 0x10000, 0xd46736f6, 5 | BRF_SND }, // 34 + { "775-f04e.bin", 0x10000, 0xfbf7e363, 5 | BRF_SND }, // 35 + { "775-f04f.bin", 0x10000, 0xb031ef2d, 5 | BRF_SND }, // 36 + { "775-f04g.bin", 0x10000, 0xee107bbb, 5 | BRF_SND }, // 37 + { "775-f04h.bin", 0x10000, 0xfb0fab46, 5 | BRF_SND }, // 38 + + { "775a09.b19", 0x00100, 0x46d1e0df, 6 | BRF_OPT }, // 39 Proms +}; + +STD_ROM_PICK(scontra) +STD_ROM_FN(scontra) + +struct BurnDriver BurnDrvScontra = { + "scontra", NULL, NULL, NULL, "1988", + "Super Contra\0", NULL, "Konami", "GX775", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT | GBF_HORSHOOT, 0, + NULL, scontraRomInfo, scontraRomName, NULL, NULL, ThunderxInputInfo, ScontraDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 224, 288, 3, 4 +}; + + +// Super Contra (Japan) + +static struct BurnRomInfo scontrajRomDesc[] = { + { "775-f02.bin", 0x10000, 0x8d5933a7, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "775-f03.bin", 0x10000, 0x1ef63d80, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "775-c01.bin", 0x08000, 0x0ced785a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "775-a07a.bin", 0x20000, 0xe716bdf3, 3 | BRF_GRA }, // 3 Background Tiles + { "775-a07e.bin", 0x20000, 0x0986e3a5, 3 | BRF_GRA }, // 4 + { "775-f07c.bin", 0x10000, 0xb0b30915, 3 | BRF_GRA }, // 5 + { "775-f07g.bin", 0x10000, 0xfbed827d, 3 | BRF_GRA }, // 6 + { "775-f07d.bin", 0x10000, 0xf184be8e, 3 | BRF_GRA }, // 7 + { "775-f07h.bin", 0x10000, 0x7b56c348, 3 | BRF_GRA }, // 8 + { "775-a08a.bin", 0x20000, 0x3ddd11a4, 3 | BRF_GRA }, // 9 + { "775-a08e.bin", 0x20000, 0x1007d963, 3 | BRF_GRA }, // 10 + { "775-f08c.bin", 0x10000, 0x53abdaec, 3 | BRF_GRA }, // 11 + { "775-f08g.bin", 0x10000, 0x3df85a6e, 3 | BRF_GRA }, // 12 + { "775-f08d.bin", 0x10000, 0x102dcace, 3 | BRF_GRA }, // 13 + { "775-f08h.bin", 0x10000, 0xad9d7016, 3 | BRF_GRA }, // 14 + + { "775-a05a.bin", 0x10000, 0xa0767045, 4 | BRF_GRA }, // 15 Sprites + { "775-a05e.bin", 0x10000, 0x2f656f08, 4 | BRF_GRA }, // 16 + { "775-a05b.bin", 0x10000, 0xab8ad4fd, 4 | BRF_GRA }, // 17 + { "775-a05f.bin", 0x10000, 0x1c0eb1b6, 4 | BRF_GRA }, // 18 + { "775-f05c.bin", 0x10000, 0x5647761e, 4 | BRF_GRA }, // 19 + { "775-f05g.bin", 0x10000, 0xa1692cca, 4 | BRF_GRA }, // 20 + { "775-f05d.bin", 0x10000, 0xad676a6f, 4 | BRF_GRA }, // 21 + { "775-f05h.bin", 0x10000, 0x3f925bcf, 4 | BRF_GRA }, // 22 + { "775-a06a.bin", 0x10000, 0x77a34ad0, 4 | BRF_GRA }, // 23 + { "775-a06e.bin", 0x10000, 0x8a910c94, 4 | BRF_GRA }, // 24 + { "775-a06b.bin", 0x10000, 0x563fb565, 4 | BRF_GRA }, // 25 + { "775-a06f.bin", 0x10000, 0xe14995c0, 4 | BRF_GRA }, // 26 + { "775-f06c.bin", 0x10000, 0x5ee6f3c1, 4 | BRF_GRA }, // 27 + { "775-f06g.bin", 0x10000, 0x2645274d, 4 | BRF_GRA }, // 28 + { "775-f06d.bin", 0x10000, 0xc8b764fa, 4 | BRF_GRA }, // 29 + { "775-f06h.bin", 0x10000, 0xd6595f59, 4 | BRF_GRA }, // 30 + + { "775-a04a.bin", 0x10000, 0x7efb2e0f, 5 | BRF_SND }, // 31 K007232 Samples + { "775-a04b.bin", 0x10000, 0xf41a2b33, 5 | BRF_SND }, // 32 + { "775-a04c.bin", 0x10000, 0xe4e58f14, 5 | BRF_SND }, // 33 + { "775-a04d.bin", 0x10000, 0xd46736f6, 5 | BRF_SND }, // 34 + { "775-f04e.bin", 0x10000, 0xfbf7e363, 5 | BRF_SND }, // 35 + { "775-f04f.bin", 0x10000, 0xb031ef2d, 5 | BRF_SND }, // 36 + { "775-f04g.bin", 0x10000, 0xee107bbb, 5 | BRF_SND }, // 37 + { "775-f04h.bin", 0x10000, 0xfb0fab46, 5 | BRF_SND }, // 38 + + { "775a09.b19", 0x00100, 0x46d1e0df, 6 | BRF_OPT }, // 39 Proms +}; + +STD_ROM_PICK(scontraj) +STD_ROM_FN(scontraj) + +struct BurnDriver BurnDrvScontraj = { + "scontraj", "scontra", NULL, NULL, "1988", + "Super Contra (Japan)\0", NULL, "Konami", "GX775", + L"Super \u9B42\u6597\u7F85 \u30A8\u30A4\u30EA\u30A2\u30F3 \u306E\u9006\u8972 (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT | GBF_HORSHOOT, 0, + NULL, scontrajRomInfo, scontrajRomName, NULL, NULL, ThunderxInputInfo, ScontraDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 224, 288, 3, 4 +}; + + +// Thunder Cross (set 1) + +static struct BurnRomInfo thunderxRomDesc[] = { + { "873-s03.k15", 0x10000, 0x2aec2699, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "873-s02.k13", 0x10000, 0x6619333a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "873-f01.f8", 0x08000, 0xea35ffa3, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "873c06a.f6", 0x10000, 0x0e340b67, 3 | BRF_GRA }, // 3 Background Tiles + { "873c06c.f5", 0x10000, 0xef0e72cd, 3 | BRF_GRA }, // 4 + { "873c06b.e6", 0x10000, 0x97ad202e, 3 | BRF_GRA }, // 5 + { "873c06d.e5", 0x10000, 0x8393d42e, 3 | BRF_GRA }, // 6 + { "873c07a.f4", 0x10000, 0xa8aab84f, 3 | BRF_GRA }, // 7 + { "873c07c.f3", 0x10000, 0x2521009a, 3 | BRF_GRA }, // 8 + { "873c07b.e4", 0x10000, 0x12a2b8ba, 3 | BRF_GRA }, // 9 + { "873c07d.e3", 0x10000, 0xfae9f965, 3 | BRF_GRA }, // 10 + + { "873c04a.f11", 0x10000, 0xf7740bf3, 4 | BRF_GRA }, // 11 Sprites + { "873c04c.f10", 0x10000, 0x5dacbd2b, 4 | BRF_GRA }, // 12 + { "873c04b.e11", 0x10000, 0x9ac581da, 4 | BRF_GRA }, // 13 + { "873c04d.e10", 0x10000, 0x44a4668c, 4 | BRF_GRA }, // 14 + { "873c05a.f9", 0x10000, 0xd73e107d, 4 | BRF_GRA }, // 15 + { "873c05c.f8", 0x10000, 0x59903200, 4 | BRF_GRA }, // 16 + { "873c05b.e9", 0x10000, 0x81059b99, 4 | BRF_GRA }, // 17 + { "873c05d.e8", 0x10000, 0x7fa3d7df, 4 | BRF_GRA }, // 18 + + { "873a08.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 19 Proms +}; + +STD_ROM_PICK(thunderx) +STD_ROM_FN(thunderx) + +struct BurnDriver BurnDrvThunderx = { + "thunderx", NULL, NULL, NULL, "1988", + "Thunder Cross (set 1)\0", NULL, "Konami", "GX873", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, thunderxRomInfo, thunderxRomName, NULL, NULL, ThunderxInputInfo, ThunderxDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; + + +// Thunder Cross (set 2) + +static struct BurnRomInfo thunderxaRomDesc[] = { + { "873-k03.k15", 0x10000, 0x276817ad, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "873-k02.k13", 0x10000, 0x80cc1c45, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "873-h01.f8", 0x08000, 0x990b7a7c, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "873c06a.f6", 0x10000, 0x0e340b67, 3 | BRF_GRA }, // 3 Background Tiles + { "873c06c.f5", 0x10000, 0xef0e72cd, 3 | BRF_GRA }, // 4 + { "873c06b.e6", 0x10000, 0x97ad202e, 3 | BRF_GRA }, // 5 + { "873c06d.e5", 0x10000, 0x8393d42e, 3 | BRF_GRA }, // 6 + { "873c07a.f4", 0x10000, 0xa8aab84f, 3 | BRF_GRA }, // 7 + { "873c07c.f3", 0x10000, 0x2521009a, 3 | BRF_GRA }, // 8 + { "873c07b.e4", 0x10000, 0x12a2b8ba, 3 | BRF_GRA }, // 9 + { "873c07d.e3", 0x10000, 0xfae9f965, 3 | BRF_GRA }, // 10 + + { "873c04a.f11", 0x10000, 0xf7740bf3, 4 | BRF_GRA }, // 11 Sprites + { "873c04c.f10", 0x10000, 0x5dacbd2b, 4 | BRF_GRA }, // 12 + { "873c04b.e11", 0x10000, 0x9ac581da, 4 | BRF_GRA }, // 13 + { "873c04d.e10", 0x10000, 0x44a4668c, 4 | BRF_GRA }, // 14 + { "873c05a.f9", 0x10000, 0xd73e107d, 4 | BRF_GRA }, // 15 + { "873c05c.f8", 0x10000, 0x59903200, 4 | BRF_GRA }, // 16 + { "873c05b.e9", 0x10000, 0x81059b99, 4 | BRF_GRA }, // 17 + { "873c05d.e8", 0x10000, 0x7fa3d7df, 4 | BRF_GRA }, // 18 + + { "873a08.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 19 Proms +}; + +STD_ROM_PICK(thunderxa) +STD_ROM_FN(thunderxa) + +struct BurnDriver BurnDrvThunderxa = { + "thunderxa", "thunderx", NULL, NULL, "1988", + "Thunder Cross (set 2)\0", NULL, "Konami", "GX873", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, thunderxaRomInfo, thunderxaRomName, NULL, NULL, ThunderxInputInfo, ThunderxDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; + + +// Thunder Cross (set 3) + +static struct BurnRomInfo thunderxbRomDesc[] = { + { "873-03.k15", 0x10000, 0x36680a4e, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "873-02.k13", 0x10000, 0xc58b2c34, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "873-f01.f8", 0x08000, 0xea35ffa3, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "873c06a.f6", 0x10000, 0x0e340b67, 3 | BRF_GRA }, // 3 Background Tiles + { "873c06c.f5", 0x10000, 0xef0e72cd, 3 | BRF_GRA }, // 4 + { "873c06b.e6", 0x10000, 0x97ad202e, 3 | BRF_GRA }, // 5 + { "873c06d.e5", 0x10000, 0x8393d42e, 3 | BRF_GRA }, // 6 + { "873c07a.f4", 0x10000, 0xa8aab84f, 3 | BRF_GRA }, // 7 + { "873c07c.f3", 0x10000, 0x2521009a, 3 | BRF_GRA }, // 8 + { "873c07b.e4", 0x10000, 0x12a2b8ba, 3 | BRF_GRA }, // 9 + { "873c07d.e3", 0x10000, 0xfae9f965, 3 | BRF_GRA }, // 10 + + { "873c04a.f11", 0x10000, 0xf7740bf3, 4 | BRF_GRA }, // 11 Sprites + { "873c04c.f10", 0x10000, 0x5dacbd2b, 4 | BRF_GRA }, // 12 + { "873c04b.e11", 0x10000, 0x9ac581da, 4 | BRF_GRA }, // 13 + { "873c04d.e10", 0x10000, 0x44a4668c, 4 | BRF_GRA }, // 14 + { "873c05a.f9", 0x10000, 0xd73e107d, 4 | BRF_GRA }, // 15 + { "873c05c.f8", 0x10000, 0x59903200, 4 | BRF_GRA }, // 16 + { "873c05b.e9", 0x10000, 0x81059b99, 4 | BRF_GRA }, // 17 + { "873c05d.e8", 0x10000, 0x7fa3d7df, 4 | BRF_GRA }, // 18 + + { "873a08.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 19 Proms +}; + +STD_ROM_PICK(thunderxb) +STD_ROM_FN(thunderxb) + +struct BurnDriver BurnDrvThunderxb = { + "thunderxb", "thunderx", NULL, NULL, "1988", + "Thunder Cross (set 3)\0", NULL, "Konami", "GX873", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, thunderxbRomInfo, thunderxbRomName, NULL, NULL, ThunderxInputInfo, ThunderxDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; + + +// Thunder Cross (Japan) + +static struct BurnRomInfo thunderxjRomDesc[] = { + { "873-n03.k15", 0x10000, 0xa01e2e3e, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + { "873-n02.k13", 0x10000, 0x55afa2cc, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "873-f01.f8", 0x08000, 0xea35ffa3, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "873c06a.f6", 0x10000, 0x0e340b67, 3 | BRF_GRA }, // 3 Background Tiles + { "873c06c.f5", 0x10000, 0xef0e72cd, 3 | BRF_GRA }, // 4 + { "873c06b.e6", 0x10000, 0x97ad202e, 3 | BRF_GRA }, // 5 + { "873c06d.e5", 0x10000, 0x8393d42e, 3 | BRF_GRA }, // 6 + { "873c07a.f4", 0x10000, 0xa8aab84f, 3 | BRF_GRA }, // 7 + { "873c07c.f3", 0x10000, 0x2521009a, 3 | BRF_GRA }, // 8 + { "873c07b.e4", 0x10000, 0x12a2b8ba, 3 | BRF_GRA }, // 9 + { "873c07d.e3", 0x10000, 0xfae9f965, 3 | BRF_GRA }, // 10 + + { "873c04a.f11", 0x10000, 0xf7740bf3, 4 | BRF_GRA }, // 11 Sprites + { "873c04c.f10", 0x10000, 0x5dacbd2b, 4 | BRF_GRA }, // 12 + { "873c04b.e11", 0x10000, 0x9ac581da, 4 | BRF_GRA }, // 13 + { "873c04d.e10", 0x10000, 0x44a4668c, 4 | BRF_GRA }, // 14 + { "873c05a.f9", 0x10000, 0xd73e107d, 4 | BRF_GRA }, // 15 + { "873c05c.f8", 0x10000, 0x59903200, 4 | BRF_GRA }, // 16 + { "873c05b.e9", 0x10000, 0x81059b99, 4 | BRF_GRA }, // 17 + { "873c05d.e8", 0x10000, 0x7fa3d7df, 4 | BRF_GRA }, // 18 + + { "873a08.f20", 0x00100, 0xe2d09a1b, 6 | BRF_OPT }, // 19 Proms +}; + +STD_ROM_PICK(thunderxj) +STD_ROM_FN(thunderxj) + +struct BurnDriver BurnDrvThunderxj = { + "thunderxj", "thunderx", NULL, NULL, "1988", + "Thunder Cross (Japan)\0", NULL, "Konami", "GX873", + L"Thunder Cross\0\u30B5\u30F3\u30C0\u30FC\u30AF\u30ED\u30B9 (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, thunderxjRomInfo, thunderxjRomName, NULL, NULL, ThunderxInputInfo, ThunderxDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 288, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_tmnt.cpp b/src/burn/drv/konami/d_tmnt.cpp index 0f1f2fc53..89bbfd7ef 100644 --- a/src/burn/drv/konami/d_tmnt.cpp +++ b/src/burn/drv/konami/d_tmnt.cpp @@ -1,6628 +1,6619 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" -#include "upd7759.h" -#include "k007232.h" -#include "k053260.h" -#include "eeprom.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort4[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort5[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[3] = {0, 0, 0}; -static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Drv68KRom = NULL; -static UINT8 *Drv68KRam = NULL; -static UINT8 *DrvZ80Rom = NULL; -static UINT8 *DrvZ80Ram = NULL; -static UINT8 *DrvSoundRom = NULL; -static UINT8 *DrvUPD7759CRom = NULL; -static UINT8 *DrvTileRom = NULL; -static UINT8 *DrvSpriteRom = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvPaletteRam = NULL; -static UINT8 *DrvNvRam = NULL; -static UINT8 *DrvTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *Palette; -static UINT32 *DrvPalette = NULL; -static INT16 *DrvTitleSample = NULL; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static UINT8 bIrqEnable; -static INT32 LayerColourBase[3]; -static INT32 SpriteColourBase; -static INT32 LayerPri[3]; -static UINT8 DrvSoundLatch; -static INT32 PriorityFlag; - -static INT32 dim_c, dim_v; - -static INT32 DrvNvRamBank; -static INT32 CuebrickSndIrqFire; -static INT32 BlswhstlTileRomBank; - -static INT32 TitleSoundLatch; -static INT32 PlayTitleSample; -static double TitleSamplePos = 0; -static double TitleSampleGain; -static INT32 TitleSampleOutputDir; - -static UINT8 DrvVBlank; - -static INT32 InitEEPROMCount; - -static const eeprom_interface BlswhstlEEPROMInterface = -{ - 7, - 8, - "011000", - "011100", - 0, - "0100000000000", - "0100110000000", - 0, - 0 -}; - -static const eeprom_interface thndrx2_eeprom_interface = -{ - 7, - 8, - "011000", - "010100", - 0, - "0100000000000", - "0100110000000", - 0, - 0 -}; - -static struct BurnInputInfo TmntInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, - {"Coin 3" , BIT_DIGITAL , DrvInputPort0 + 2, "p3 coin" }, - {"Coin 4" , BIT_DIGITAL , DrvInputPort0 + 3, "p4 coin" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"P3 Up" , BIT_DIGITAL , DrvInputPort3 + 2, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , DrvInputPort3 + 3, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , DrvInputPort3 + 0, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , DrvInputPort3 + 1, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , DrvInputPort3 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , DrvInputPort3 + 5, "p3 fire 2" }, - - {"P4 Up" , BIT_DIGITAL , DrvInputPort4 + 2, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , DrvInputPort4 + 3, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , DrvInputPort4 + 0, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , DrvInputPort4 + 1, "p4 right" }, - {"P4 Fire 1" , BIT_DIGITAL , DrvInputPort4 + 4, "p4 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , DrvInputPort4 + 5, "p4 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service 1" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, - {"Service 2" , BIT_DIGITAL , DrvInputPort0 + 5, "service2" }, - {"Service 3" , BIT_DIGITAL , DrvInputPort0 + 6, "service3" }, - {"Service 4" , BIT_DIGITAL , DrvInputPort0 + 7, "service4" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Tmnt) - -static struct BurnInputInfo Tmnt2pInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service 1" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, - {"Service 2" , BIT_DIGITAL , DrvInputPort0 + 5, "service2" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Tmnt2p) - -static struct BurnInputInfo MiaInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 4, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Mia) - -static struct BurnInputInfo BlswhstlInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 2, "service" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort0 + 3, "diag" }, -}; - -STDINPUTINFO(Blswhstl) - -static struct BurnInputInfo Ssriders4pInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, - {"Coin 3" , BIT_DIGITAL , DrvInputPort0 + 2, "p3 coin" }, - {"Coin 4" , BIT_DIGITAL , DrvInputPort0 + 3, "p4 coin" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"P3 Up" , BIT_DIGITAL , DrvInputPort3 + 2, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , DrvInputPort3 + 3, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , DrvInputPort3 + 0, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , DrvInputPort3 + 1, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , DrvInputPort3 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , DrvInputPort3 + 5, "p3 fire 2" }, - - {"P4 Up" , BIT_DIGITAL , DrvInputPort4 + 2, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , DrvInputPort4 + 3, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , DrvInputPort4 + 0, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , DrvInputPort4 + 1, "p4 right" }, - {"P4 Fire 1" , BIT_DIGITAL , DrvInputPort4 + 4, "p4 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , DrvInputPort4 + 5, "p4 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service 1" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, - {"Service 2" , BIT_DIGITAL , DrvInputPort0 + 5, "service2" }, - {"Service 3" , BIT_DIGITAL , DrvInputPort0 + 6, "service3" }, - {"Service 4" , BIT_DIGITAL , DrvInputPort0 + 7, "service4" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort5 + 7, "diag" }, -}; - -STDINPUTINFO(Ssriders4p) - -static struct BurnInputInfo SsridersInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service 1" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, - {"Service 2" , BIT_DIGITAL , DrvInputPort0 + 5, "service2" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort5 + 7, "diag" }, -}; - -STDINPUTINFO(Ssriders) - -static struct BurnInputInfo Ssriders4psInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 start" }, - {"Coin 3" , BIT_DIGITAL , DrvInputPort0 + 2, "p3 coin" }, - {"Start 3" , BIT_DIGITAL , DrvInputPort3 + 7, "p3 start" }, - {"Coin 4" , BIT_DIGITAL , DrvInputPort0 + 3, "p4 coin" }, - {"Start 4" , BIT_DIGITAL , DrvInputPort4 + 7, "p4 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"P3 Up" , BIT_DIGITAL , DrvInputPort3 + 2, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , DrvInputPort3 + 3, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , DrvInputPort3 + 0, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , DrvInputPort3 + 1, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , DrvInputPort3 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , DrvInputPort3 + 5, "p3 fire 2" }, - - {"P4 Up" , BIT_DIGITAL , DrvInputPort4 + 2, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , DrvInputPort4 + 3, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , DrvInputPort4 + 0, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , DrvInputPort4 + 1, "p4 right" }, - {"P4 Fire 1" , BIT_DIGITAL , DrvInputPort4 + 4, "p4 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , DrvInputPort4 + 5, "p4 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service 1" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, - {"Service 2" , BIT_DIGITAL , DrvInputPort0 + 5, "service2" }, - {"Service 3" , BIT_DIGITAL , DrvInputPort0 + 6, "service3" }, - {"Service 4" , BIT_DIGITAL , DrvInputPort0 + 7, "service4" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort5 + 7, "diag" }, -}; - -STDINPUTINFO(Ssriders4ps) - -static struct BurnInputInfo Thndrx2InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvInputPort1 + 0, "p1 coin" }, - - {"P1 Start", BIT_DIGITAL, DrvInputPort0 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvInputPort0 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvInputPort0 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvInputPort0 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvInputPort0 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvInputPort0 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvInputPort1 + 1, "p2 coin" }, - - {"P2 Start", BIT_DIGITAL, DrvInputPort2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvInputPort2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvInputPort2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvInputPort2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvInputPort2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvInputPort1 + 2, "service" }, - {"Diagnostics", BIT_DIGITAL, DrvInputPort1 + 3, "diag" }, -}; - -STDINPUTINFO(Thndrx2) - -static struct BurnInputInfo LgtnfghtInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvInputPort0 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvInputPort0 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvInputPort1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvInputPort1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvInputPort1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvInputPort1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvInputPort1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvInputPort1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvInputPort0 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvInputPort0 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvInputPort2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvInputPort2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvInputPort2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvInputPort2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvInputPort2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvInputPort0 + 6, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDip + 2, "dip" }, -}; - -STDINPUTINFO(Lgtnfght) - -static struct BurnInputInfo QgakumonInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvInputPort0 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvInputPort1 + 7, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvInputPort1 + 2, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvInputPort1 + 3, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvInputPort1 + 0, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvInputPort1 + 1, "p1 fire 4" }, - {"P1 Push", BIT_DIGITAL, DrvInputPort1 + 4, "p1 fire 5" }, - - {"P2 Coin", BIT_DIGITAL, DrvInputPort0 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvInputPort2 + 7, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 2, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 3, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvInputPort2 + 0, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, DrvInputPort2 + 1, "p2 fire 4" }, - {"P2 Push", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 5" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvInputPort0 + 4, "service" }, - {"Diagnostics", BIT_DIGITAL, DrvInputPort5 + 7, "diag" }, -}; - -STDINPUTINFO(Qgakumon) - -static struct BurnInputInfo PunkshotInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvInputPort0 + 0, "p1 coin" }, - {"P1 Up", BIT_DIGITAL, DrvInputPort1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvInputPort1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvInputPort1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvInputPort1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvInputPort1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvInputPort0 + 1, "p2 coin" }, - {"P2 Up", BIT_DIGITAL, DrvInputPort2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvInputPort2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvInputPort2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvInputPort2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 5, "p2 fire 2" }, - - {"P3 Coin", BIT_DIGITAL, DrvInputPort0 + 2, "p3 coin" }, - {"P3 Up", BIT_DIGITAL, DrvInputPort3 + 2, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvInputPort3 + 3, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvInputPort3 + 0, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvInputPort3 + 1, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvInputPort3 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvInputPort3 + 5, "p3 fire 2" }, - - {"P4 Coin", BIT_DIGITAL, DrvInputPort0 + 3, "p4 coin" }, - {"P4 Up", BIT_DIGITAL, DrvInputPort4 + 2, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvInputPort4 + 3, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvInputPort4 + 0, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvInputPort4 + 1, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvInputPort4 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvInputPort4 + 5, "p4 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service 1", BIT_DIGITAL, DrvInputPort0 + 4, "service" }, - {"Service 2", BIT_DIGITAL, DrvInputPort0 + 5, "service2" }, - {"Service 3", BIT_DIGITAL, DrvInputPort0 + 6, "service3" }, - {"Service 4", BIT_DIGITAL, DrvInputPort0 + 7, "service4" }, - {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDip + 2, "dip" }, -}; - -STDINPUTINFO(Punkshot) - -static struct BurnInputInfo Punkshot2InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvInputPort0 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvInputPort5 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvInputPort1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvInputPort1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvInputPort1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvInputPort1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvInputPort1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvInputPort0 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvInputPort5 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvInputPort2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvInputPort2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvInputPort2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvInputPort2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvInputPort0 + 4, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDip + 2, "dip" }, -}; - -STDINPUTINFO(Punkshot2) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = DrvInput[2] = DrvInput[3] = DrvInput[4] = DrvInput[5] = 0x00; - - // Compile Digital Inputs - for (int i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - DrvInput[3] |= (DrvInputPort3[i] & 1) << i; - DrvInput[4] |= (DrvInputPort4[i] & 1) << i; - DrvInput[5] |= (DrvInputPort5[i] & 1) << i; - } - - // Clear Opposites - DrvClearOpposites(&DrvInput[0]); - DrvClearOpposites(&DrvInput[1]); - DrvClearOpposites(&DrvInput[2]); - DrvClearOpposites(&DrvInput[3]); - DrvClearOpposites(&DrvInput[4]); -} - -static inline void SsridersMakeInputs() -{ - DrvMakeInputs(); - - DrvInput[5] ^= 0xf6; - //if (DrvInputPort5[7]) DrvInput[5] -= 0x80; -} - -static struct BurnDIPInfo TmntDIPList[]= -{ - // Default Values - {0x21, 0xff, 0xff, 0xff, NULL }, - {0x22, 0xff, 0xff, 0x5e, NULL }, - {0x23, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 16 , "Coinage" }, - {0x21, 0x01, 0x0f, 0x00, "5 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x21, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x21, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x21, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x21, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x21, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x21, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x21, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x21, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x22, 0x01, 0x03, 0x03, "1" }, - {0x22, 0x01, 0x03, 0x02, "2" }, - {0x22, 0x01, 0x03, 0x01, "3" }, - {0x22, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x22, 0x01, 0x60, 0x60, "Easy" }, - {0x22, 0x01, 0x60, 0x40, "Normal" }, - {0x22, 0x01, 0x60, 0x20, "Difficult" }, - {0x22, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x22, 0x01, 0x80, 0x80, "Off" }, - {0x22, 0x01, 0x80, 0x00, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x23, 0x01, 0x01, 0x01, "Off" }, - {0x23, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Test Mode" }, - {0x23, 0x01, 0x04, 0x04, "Off" }, - {0x23, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Tmnt) - -static struct BurnDIPInfo Tmnt2pDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0x5e, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x13, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x13, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x13, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x13, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15 , "Coin B" }, - {0x13, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x13, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x03, 0x03, "1" }, - {0x14, 0x01, 0x03, 0x02, "2" }, - {0x14, 0x01, 0x03, 0x01, "3" }, - {0x14, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x60, 0x60, "Easy" }, - {0x14, 0x01, 0x60, 0x40, "Normal" }, - {0x14, 0x01, 0x60, 0x20, "Difficult" }, - {0x14, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Test Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Tmnt2p) - -static struct BurnDIPInfo MiaDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x56, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x14, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 15 , "Coin B" }, - {0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x14, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x14, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x14, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x03, 0x03, "2" }, - {0x15, 0x01, 0x03, 0x02, "3" }, - {0x15, 0x01, 0x03, 0x01, "5" }, - {0x15, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x15, 0x01, 0x18, 0x18, "30k 80k" }, - {0x15, 0x01, 0x18, 0x10, "50k 100k" }, - {0x15, 0x01, 0x18, 0x08, "50k" }, - {0x15, 0x01, 0x18, 0x00, "100k" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Normal" }, - {0x15, 0x01, 0x60, 0x20, "Difficult" }, - {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "VRAM Character Check" }, - {0x16, 0x01, 0x02, 0x02, "Off" }, - {0x16, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Test Mode" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Mia) - -static struct BurnDIPInfo LgtnfghtDIPList[]= -{ - {0x14, 0xff, 0xff, 0x5e, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xfd, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x03, 0x03, "2" }, - {0x14, 0x01, 0x03, 0x02, "3" }, - {0x14, 0x01, 0x03, 0x01, "5" }, - {0x14, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x18, 0x18, "100000 400000" }, - {0x14, 0x01, 0x18, 0x10, "150000 500000" }, - {0x14, 0x01, 0x18, 0x08, "200000" }, - {0x14, 0x01, 0x18, 0x00, "None" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x60, 0x60, "Easy" }, - {0x14, 0x01, 0x60, 0x40, "Medium" }, - {0x14, 0x01, 0x60, 0x20, "Hard" }, - {0x14, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x15, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x15, 0x01, 0xf0, 0x00, "No Coin B" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Sound" }, - {0x16, 0x01, 0x02, 0x02, "Mono" }, - {0x16, 0x01, 0x02, 0x00, "Stereo" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Lgtnfght) - -static struct BurnDIPInfo PunkshotDIPList[]= -{ - {0x21, 0xff, 0xff, 0xff, NULL }, - {0x22, 0xff, 0xff, 0x7f, NULL }, - {0x23, 0xff, 0xff, 0xf0, NULL }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x21, 0x01, 0x0f, 0x00, "5 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x21, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x21, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x21, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x21, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x21, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x21, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x21, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x21, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x21, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x21, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 2, "Continue" }, - {0x21, 0x01, 0x10, 0x10, "Normal" }, - {0x21, 0x01, 0x10, 0x00, "1 Coin" }, - - {0 , 0xfe, 0 , 4, "Energy" }, - {0x22, 0x01, 0x03, 0x03, "30" }, - {0x22, 0x01, 0x03, 0x02, "40" }, - {0x22, 0x01, 0x03, 0x01, "50" }, - {0x22, 0x01, 0x03, 0x00, "60" }, - - {0 , 0xfe, 0 , 4, "Period Length" }, - {0x22, 0x01, 0x0c, 0x0c, "2 Minutes" }, - {0x22, 0x01, 0x0c, 0x08, "3 Minutes" }, - {0x22, 0x01, 0x0c, 0x04, "4 Minutes" }, - {0x22, 0x01, 0x0c, 0x00, "5 Minutes" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x22, 0x01, 0x60, 0x60, "Easy" }, - {0x22, 0x01, 0x60, 0x40, "Medium" }, - {0x22, 0x01, 0x60, 0x20, "Hard" }, - {0x22, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x22, 0x01, 0x80, 0x80, "Off" }, - {0x22, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x23, 0x01, 0x10, 0x10, "Off" }, - {0x23, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x23, 0x01, 0x40, 0x40, "Off" }, - {0x23, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x23, 0x01, 0x80, 0x80, "Off" }, - {0x23, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Punkshot) - -static struct BurnDIPInfo Punkshot2DIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x7f, NULL }, - {0x14, 0xff, 0xff, 0xf0, NULL }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x12, 0x01, 0x0f, 0x00, "5 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 2, "Continue" }, - {0x12, 0x01, 0x10, 0x10, "Normal" }, - {0x12, 0x01, 0x10, 0x00, "1 Coin" }, - - {0 , 0xfe, 0 , 4, "Energy" }, - {0x13, 0x01, 0x03, 0x03, "40" }, - {0x13, 0x01, 0x03, 0x02, "50" }, - {0x13, 0x01, 0x03, 0x01, "60" }, - {0x13, 0x01, 0x03, 0x00, "70" }, - - {0 , 0xfe, 0 , 4, "Period Length" }, - {0x13, 0x01, 0x0c, 0x0c, "3 Minutes" }, - {0x13, 0x01, 0x0c, 0x08, "4 Minutes" }, - {0x13, 0x01, 0x0c, 0x04, "5 Minutes" }, - {0x13, 0x01, 0x0c, 0x00, "6 Minutes" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Medium" }, - {0x13, 0x01, 0x60, 0x20, "Hard" }, - {0x13, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x10, 0x10, "Off" }, - {0x14, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Punkshot2) - -static struct BurnDIPInfo PunkshotjDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0x7f, NULL }, - {0x14, 0xff, 0xff, 0xf0, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x12, 0x01, 0xf0, 0x00, "No Coin B" }, - - {0 , 0xfe, 0 , 4, "Period Time" }, - {0x13, 0x01, 0x0c, 0x0c, "1 Minute" }, - {0x13, 0x01, 0x0c, 0x08, "2 Minutes" }, - {0x13, 0x01, 0x0c, 0x04, "3 Minutes" }, - {0x13, 0x01, 0x0c, 0x00, "4 Minutes" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x60, "Easy" }, - {0x13, 0x01, 0x60, 0x40, "Medium" }, - {0x13, 0x01, 0x60, 0x20, "Hard" }, - {0x13, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x10, 0x10, "Off" }, - {0x14, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Punkshotj) - -static struct BurnRomInfo TmntRomDesc[] = { - { "963-x23.j17", 0x020000, 0xa9549004, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "963-x24.k17", 0x020000, 0xe5cc9067, BRF_ESS | BRF_PRG }, // 1 - { "963-x21.j15", 0x010000, 0x5789cf92, BRF_ESS | BRF_PRG }, // 2 - { "963-x22.k15", 0x010000, 0x0a74e277, BRF_ESS | BRF_PRG }, // 3 - - { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles - { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 - - { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites - { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 - { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 - { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 - - { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs - { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 - - { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples - - { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples - - { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample -}; - -STD_ROM_PICK(Tmnt) -STD_ROM_FN(Tmnt) - -static struct BurnRomInfo TmntuRomDesc[] = { - { "963-r23.j17", 0x020000, 0xa7f61195, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "963-r24.k17", 0x020000, 0x661e056a, BRF_ESS | BRF_PRG }, // 1 - { "963-r21.j15", 0x010000, 0xde047bb6, BRF_ESS | BRF_PRG }, // 2 - { "963-r22.k15", 0x010000, 0xd86a0888, BRF_ESS | BRF_PRG }, // 3 - - { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles - { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 - - { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites - { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 - { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 - { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 - - { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs - { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 - - { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples - - { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples - - { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample -}; - -STD_ROM_PICK(Tmntu) -STD_ROM_FN(Tmntu) - -static struct BurnRomInfo TmntuaRomDesc[] = { - { "963-j23.j17", 0x020000, 0xf77314e2, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "963-j24.k17", 0x020000, 0x47f662d3, BRF_ESS | BRF_PRG }, // 1 - { "963-j21.j15", 0x010000, 0x7bee9fe8, BRF_ESS | BRF_PRG }, // 2 - { "963-j22.k15", 0x010000, 0x2efed09f, BRF_ESS | BRF_PRG }, // 3 - - { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles - { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 - - { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites - { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 - { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 - { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 - - { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs - { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 - - { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples - - { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples - - { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample -}; - -STD_ROM_PICK(Tmntua) -STD_ROM_FN(Tmntua) - -static struct BurnRomInfo TmhtRomDesc[] = { - { "963-f23.j17", 0x020000, 0x9cb5e461, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "963-f24.k17", 0x020000, 0x2d902fab, BRF_ESS | BRF_PRG }, // 1 - { "963-f21.j15", 0x010000, 0x9fa25378, BRF_ESS | BRF_PRG }, // 2 - { "963-f22.k15", 0x010000, 0x2127ee53, BRF_ESS | BRF_PRG }, // 3 - - { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles - { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 - - { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites - { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 - { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 - { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 - - { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs - { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 - - { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples - - { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples - - { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample -}; - -STD_ROM_PICK(Tmht) -STD_ROM_FN(Tmht) - -static struct BurnRomInfo TmhtaRomDesc[] = { - { "963-s23.j17", 0x020000, 0xb5af7eee, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "963-s24.k17", 0x020000, 0xbcb8ce8b, BRF_ESS | BRF_PRG }, // 1 - { "963-s21.j15", 0x010000, 0x0b88bfa6, BRF_ESS | BRF_PRG }, // 2 - { "963-s22.k15", 0x010000, 0x44ce6d4b, BRF_ESS | BRF_PRG }, // 3 - - { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles - { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 - - { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites - { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 - { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 - { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 - - { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs - { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 - - { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples - - { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples - - { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample -}; - -STD_ROM_PICK(Tmhta) -STD_ROM_FN(Tmhta) - -static struct BurnRomInfo TmntjRomDesc[] = { - { "963_223.j17", 0x020000, 0x0d34a5ff, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "963_224.k17", 0x020000, 0x2fd453f2, BRF_ESS | BRF_PRG }, // 1 - { "963_221.j15", 0x010000, 0xfa8e25fd, BRF_ESS | BRF_PRG }, // 2 - { "963_222.k15", 0x010000, 0xca437a4f, BRF_ESS | BRF_PRG }, // 3 - - { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles - { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 - - { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites - { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 - { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 - { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 - - { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs - { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 - - { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples - - { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples - - { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample -}; - -STD_ROM_PICK(Tmntj) -STD_ROM_FN(Tmntj) - -static struct BurnRomInfo Tmht2pRomDesc[] = { - { "963-u23.j17", 0x020000, 0x58bec748, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "963-u24.k17", 0x020000, 0xdce87c8d, BRF_ESS | BRF_PRG }, // 1 - { "963-u21.j15", 0x010000, 0xabce5ead, BRF_ESS | BRF_PRG }, // 2 - { "963-u22.k15", 0x010000, 0x4ecc8d6b, BRF_ESS | BRF_PRG }, // 3 - - { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles - { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 - - { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites - { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 - { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 - { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 - - { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs - { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 - - { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples - - { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples - - { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample -}; - -STD_ROM_PICK(Tmht2p) -STD_ROM_FN(Tmht2p) - -static struct BurnRomInfo Tmht2paRomDesc[] = { - { "963-_23.j17", 0x020000, 0x8698061a, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "963-_24.k17", 0x020000, 0x4036c075, BRF_ESS | BRF_PRG }, // 1 - { "963-_21.j15", 0x010000, 0xddcc979c, BRF_ESS | BRF_PRG }, // 2 - { "963-_22.k15", 0x010000, 0x71a38d27, BRF_ESS | BRF_PRG }, // 3 - - { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles - { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 - - { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites - { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 - { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 - { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 - - { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs - { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 - - { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples - - { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples - - { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample -}; - -STD_ROM_PICK(Tmht2pa) -STD_ROM_FN(Tmht2pa) - -static struct BurnRomInfo Tmnt2pjRomDesc[] = { - { "963-123.j17", 0x020000, 0x6a3527c9, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "963-124.k17", 0x020000, 0x2c4bfa15, BRF_ESS | BRF_PRG }, // 1 - { "963-121.j15", 0x010000, 0x4181b733, BRF_ESS | BRF_PRG }, // 2 - { "963-122.k15", 0x010000, 0xc64eb5ff, BRF_ESS | BRF_PRG }, // 3 - - { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles - { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 - - { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites - { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 - { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 - { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 - - { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs - { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 - - { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples - - { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples - - { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample -}; - -STD_ROM_PICK(Tmnt2pj) -STD_ROM_FN(Tmnt2pj) - -static struct BurnRomInfo Tmnt2poRomDesc[] = { - { "tmnt123.j17", 0x020000, 0x2d905183, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "tmnt124.k17", 0x020000, 0xe0125352, BRF_ESS | BRF_PRG }, // 1 - { "tmnt21.j15", 0x010000, 0x12deeafb, BRF_ESS | BRF_PRG }, // 2 - { "tmnt22.k15", 0x010000, 0xaec4f1c3, BRF_ESS | BRF_PRG }, // 3 - - { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles - { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 - - { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites - { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 - { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 - { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 - - { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs - { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 - - { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples - - { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples - - { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample -}; - -STD_ROM_PICK(Tmnt2po) -STD_ROM_FN(Tmnt2po) - -static struct BurnRomInfo MiaRomDesc[] = { - { "808t20.h17", 0x020000, 0x6f0acb1d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "808t21.j17", 0x020000, 0x42a30416, BRF_ESS | BRF_PRG }, // 1 - - { "808e03.f4", 0x008000, 0x3d93a7cd, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "808e12.f28", 0x010000, 0xd62f1fde, BRF_GRA }, // 3 Tiles - { "808e13.h28", 0x010000, 0x1fa708f4, BRF_GRA }, // 4 - { "808e22.i28", 0x010000, 0x73d758f6, BRF_GRA }, // 5 - { "808e23.k28", 0x010000, 0x8ff08b21, BRF_GRA }, // 6 - - { "808d17.j4", 0x080000, 0xd1299082, BRF_GRA }, // 7 Sprites - { "808d15.h4", 0x080000, 0x2b22a6b6, BRF_GRA }, // 8 - - { "808a18.f16", 0x000100, 0xeb95aede, BRF_GRA }, // 9 PROMs - - { "808d01.d4", 0x020000, 0xfd4d37c0, BRF_SND }, // 10 K007232 Samples -}; - -STD_ROM_PICK(Mia) -STD_ROM_FN(Mia) - -static struct BurnRomInfo Mia2RomDesc[] = { - { "808s20.h17", 0x020000, 0xcaa2897f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "808s21.j17", 0x020000, 0x3d892ffb, BRF_ESS | BRF_PRG }, // 1 - - { "808e03.f4", 0x008000, 0x3d93a7cd, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "808e12.f28", 0x010000, 0xd62f1fde, BRF_GRA }, // 3 Tiles - { "808e13.h28", 0x010000, 0x1fa708f4, BRF_GRA }, // 4 - { "808e22.i28", 0x010000, 0x73d758f6, BRF_GRA }, // 5 - { "808e23.k28", 0x010000, 0x8ff08b21, BRF_GRA }, // 6 - - { "808d17.j4", 0x080000, 0xd1299082, BRF_GRA }, // 7 Sprites - { "808d15.h4", 0x080000, 0x2b22a6b6, BRF_GRA }, // 8 - - { "808a18.f16", 0x000100, 0xeb95aede, BRF_GRA }, // 9 PROMs - - { "808d01.d4", 0x020000, 0xfd4d37c0, BRF_SND }, // 10 K007232 Samples -}; - -STD_ROM_PICK(Mia2) -STD_ROM_FN(Mia2) - -static struct BurnRomInfo CuebrickRomDesc[] = { - { "903d25.g12", 0x010000, 0x8d575663, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "903d24.f12", 0x010000, 0x2973625d, BRF_ESS | BRF_PRG }, // 1 - - { "903c29.k21", 0x010000, 0xfada986d, BRF_GRA }, // 2 Tiles - { "903c27.k17", 0x010000, 0x5bd4b8e1, BRF_GRA }, // 3 - { "903c28.k19", 0x010000, 0x80d2bfaf, BRF_GRA }, // 4 - { "903c26.k15", 0x010000, 0xf808fa3d, BRF_GRA }, // 5 - - { "903d23.k12", 0x010000, 0xc39fc9fd, BRF_GRA }, // 6 Sprites - { "903d21.k8", 0x010000, 0x3c7bf8cd, BRF_GRA }, // 7 - { "903d22.k10", 0x010000, 0x95ad8591, BRF_GRA }, // 8 - { "903d20.k6", 0x010000, 0x2872a1bb, BRF_GRA }, // 9 -}; - -STD_ROM_PICK(Cuebrick) -STD_ROM_FN(Cuebrick) - -static struct BurnRomInfo BlswhstlRomDesc[] = { - { "060_l02.e09", 0x020000, 0xe8b7b234, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "060_l03.g09", 0x020000, 0x3c26d281, BRF_ESS | BRF_PRG }, // 1 - { "060_l09.e11", 0x020000, 0x14628736, BRF_ESS | BRF_PRG }, // 2 - { "060_l10.g11", 0x020000, 0xf738ad4a, BRF_ESS | BRF_PRG }, // 3 - - { "060j01.f3", 0x010000, 0xf9d9a673, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "060e07.k16", 0x080000, 0xc400edf3, BRF_GRA }, // 5 Tiles - { "060e08.k12", 0x080000, 0x70dddba1, BRF_GRA }, // 6 - - { "060e06.k7", 0x080000, 0x09381492, BRF_GRA }, // 7 Sprites - { "060e05.k3", 0x080000, 0x32454241, BRF_GRA }, // 8 - - { "060e04.d1", 0x100000, 0xc680395d, BRF_SND }, // 9 K053260 Samples - - { "blswhstl.nv", 0x000080, 0x87434e3f, BRF_OPT }, -}; - -STD_ROM_PICK(Blswhstl) -STD_ROM_FN(Blswhstl) - -static struct BurnRomInfo DetatwinRomDesc[] = { - { "060_j02.e09", 0x020000, 0x11b761ac, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "060_j03.g09", 0x020000, 0x8d0b588c, BRF_ESS | BRF_PRG }, // 1 - { "060_j09.e11", 0x020000, 0xf2a5f15f, BRF_ESS | BRF_PRG }, // 2 - { "060_j10.g11", 0x020000, 0x36eefdbc, BRF_ESS | BRF_PRG }, // 3 - - { "060j01.f3", 0x010000, 0xf9d9a673, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "060e07.k16", 0x080000, 0xc400edf3, BRF_GRA }, // 5 Tiles - { "060e08.k12", 0x080000, 0x70dddba1, BRF_GRA }, // 6 - - { "060e06.k7", 0x080000, 0x09381492, BRF_GRA }, // 7 Sprites - { "060e05.k3", 0x080000, 0x32454241, BRF_GRA }, // 8 - - { "060e04.d1", 0x100000, 0xc680395d, BRF_SND }, // 9 K053260 Samples - - { "blswhstl.nv", 0x000080, 0x87434e3f, BRF_OPT }, -}; - -STD_ROM_PICK(Detatwin) -STD_ROM_FN(Detatwin) - -static struct BurnRomInfo SsridersRomDesc[] = { - { "064eac02.8e", 0x040000, 0x5a5425f4, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "064eac03.8g", 0x040000, 0x093c00fb, BRF_ESS | BRF_PRG }, // 1 - { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 - { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 - - { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 - - { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites - { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 - - { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples - - { "ssriders_eac.nv", 0x000080, 0xf6d641a7, BRF_OPT }, -}; - -STD_ROM_PICK(Ssriders) -STD_ROM_FN(Ssriders) - -static struct BurnRomInfo SsridersebdRomDesc[] = { - { "064ebd02.8e", 0x040000, 0x8deef9ac, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "064ebd03.8g", 0x040000, 0x2370c107, BRF_ESS | BRF_PRG }, // 1 - { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 - { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 - - { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 - - { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites - { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 - - { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples - - { "ssriders_ebd.nv", 0x000080, 0xcbc903f6, BRF_OPT }, -}; - -STD_ROM_PICK(Ssridersebd) -STD_ROM_FN(Ssridersebd) - -static struct BurnRomInfo SsridersebcRomDesc[] = { - { "064ebc02.8e", 0x040000, 0x9bd7d164, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "064ebc03.8g", 0x040000, 0x40fd4165, BRF_ESS | BRF_PRG }, // 1 - { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 - { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 - - { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 - - { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites - { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 - - { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples - - { "ssriders_ebc.nv", 0x000080, 0x1918e90f, BRF_OPT }, -}; - -STD_ROM_PICK(Ssridersebc) -STD_ROM_FN(Ssridersebc) - -static struct BurnRomInfo SsridersudaRomDesc[] = { - { "064uda02.8e", 0x040000, 0x5129a6b7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "064uda03.8g", 0x040000, 0x9f887214, BRF_ESS | BRF_PRG }, // 1 - { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 - { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 - - { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 - - { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites - { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 - - { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples - - { "ssriders_uda.nv", 0x000080, 0x148c6d64, BRF_OPT }, -}; - -STD_ROM_PICK(Ssridersuda) -STD_ROM_FN(Ssridersuda) - -static struct BurnRomInfo SsriderseaaRomDesc[] = { - { "064eaa02.8e", 0x040000, 0x4844660f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "064eaa03.8g", 0x040000, 0x0b9bcc7c, BRF_ESS | BRF_PRG }, // 1 - { "064eaa04.10e", 0x020000, 0x5d917c1c, BRF_ESS | BRF_PRG }, // 2 - { "064eaa05.10g", 0x020000, 0xf4647b74, BRF_ESS | BRF_PRG }, // 3 - - { "064eaa01.2f", 0x010000, 0xbce45d82, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 - - { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites - { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 - - { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples - - { "ssriders_eaa.nv", 0x000080, 0x74a45ef5, BRF_OPT }, -}; - -STD_ROM_PICK(Ssriderseaa) -STD_ROM_FN(Ssriderseaa) - -static struct BurnRomInfo SsridersuacRomDesc[] = { - { "064uac02.8e", 0x040000, 0x870473b6, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "064uac03.8g", 0x040000, 0xeadf289a, BRF_ESS | BRF_PRG }, // 1 - { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 - { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 - - { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 - - { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites - { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 - - { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples - - { "ssriders_uac.nv", 0x000080, 0x26c8f1a0, BRF_OPT }, -}; - -STD_ROM_PICK(Ssridersuac) -STD_ROM_FN(Ssridersuac) - -static struct BurnRomInfo SsridersubcRomDesc[] = { - { "064ubc02.8e", 0x040000, 0xaca7fda5, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "064ubc03.8g", 0x040000, 0xbb1fdeff, BRF_ESS | BRF_PRG }, // 1 - { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 - { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 - - { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 - - { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites - { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 - - { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples - - { "ssriders_ubc.nv", 0x000080, 0x31c5504f, BRF_OPT }, -}; - -STD_ROM_PICK(Ssridersubc) -STD_ROM_FN(Ssridersubc) - -static struct BurnRomInfo SsridersabdRomDesc[] = { - { "064abd02.8e", 0x040000, 0x713406cb, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "064abd03.8g", 0x040000, 0x680feb3c, BRF_ESS | BRF_PRG }, // 1 - { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 - { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 - - { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 - - { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites - { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 - - { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples - - { "ssriders_abd.nv", 0x000080, 0xbfdafedf, BRF_OPT }, -}; - -STD_ROM_PICK(Ssridersabd) -STD_ROM_FN(Ssridersabd) - -static struct BurnRomInfo SsridersaddRomDesc[] = { - { "064add02.8e", 0x040000, 0x06b0138e, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "064add03.8g", 0x040000, 0x03eb8b91, BRF_ESS | BRF_PRG }, // 1 - { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 - { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 - - { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 - - { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites - { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 - - { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples - - { "ssriders_add.nv", 0x000080, 0xf06242d5, BRF_OPT }, -}; - -STD_ROM_PICK(Ssridersadd) -STD_ROM_FN(Ssridersadd) - -static struct BurnRomInfo SsridersjbdRomDesc[] = { - { "064jbd02.8e", 0x040000, 0x7acdc1e3, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "064jbd03.8g", 0x040000, 0x6a424918, BRF_ESS | BRF_PRG }, // 1 - { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 - { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 - - { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 - - { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites - { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 - - { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples - - { "ssriders_jbd.nv", 0x000080, 0x006200e3, BRF_OPT }, -}; - -STD_ROM_PICK(Ssridersjbd) -STD_ROM_FN(Ssridersjbd) - -static struct BurnRomInfo ssridersbRomDesc[] = { - { "sunsetb.03", 0x080000, 0x37ffe90b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "sunsetb.04", 0x080000, 0x8ff647b7, BRF_ESS | BRF_PRG }, // 1 - - { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 2 Tiles - { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 3 - - { "sunsetb.05", 0x080000, 0x8a0ff31a, BRF_GRA }, // 4 Sprites - { "sunsetb.06", 0x080000, 0xfdf2c887, BRF_GRA }, // 5 - { "sunsetb.07", 0x080000, 0xa545b1ed, BRF_GRA }, // 6 - { "sunsetb.08", 0x080000, 0xf867cd38, BRF_GRA }, // 7 - - { "sunsetb.01", 0x080000, 0x1a8b5ca2, BRF_SND }, // 8 OKI Samples - { "sunsetb.02", 0x080000, 0x5d485523, BRF_SND }, // 9 -}; - -STD_ROM_PICK(ssridersb) -STD_ROM_FN(ssridersb) - -static struct BurnRomInfo thndrx2RomDesc[] = { - { "073-ea-l02.11c", 0x020000, 0xeae02b51, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "073-ea-l03.12c", 0x020000, 0x738ed007, BRF_ESS | BRF_PRG }, // 1 - - { "073-c01.4f", 0x010000, 0x44ebe83c, BRF_ESS | BRF_PRG }, // 2 Z80 Code - - { "073-c06.16k", 0x080000, 0x24e22b42, BRF_GRA }, // 3 Tiles - { "073-c05.12k", 0x080000, 0x952a935f, BRF_GRA }, // 4 - - { "073-c07.7k", 0x080000, 0x14e93f38, BRF_GRA }, // 5 Sprites - { "073-c08.3k", 0x080000, 0x09fab3ab, BRF_GRA }, // 6 - - { "073-b04.2d", 0x080000, 0x05287a0b, BRF_SND }, // 7 K053260 Samples - - { "thndrx2.nv", 0x000080, 0xca613e98, BRF_OPT }, -}; - -STD_ROM_PICK(thndrx2) -STD_ROM_FN(thndrx2) - -static struct BurnRomInfo thndrx2aRomDesc[] = { - { "073-aa-m02.11c", 0x020000, 0x5b5b4cc0, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "073-aa-m03.12c", 0x020000, 0x320435a8, BRF_ESS | BRF_PRG }, // 1 - - { "073-c01.4f", 0x010000, 0x44ebe83c, BRF_ESS | BRF_PRG }, // 2 Z80 Code - - { "073-c06.16k", 0x080000, 0x24e22b42, BRF_GRA }, // 3 Tiles - { "073-c05.12k", 0x080000, 0x952a935f, BRF_GRA }, // 4 - - { "073-c07.7k", 0x080000, 0x14e93f38, BRF_GRA }, // 5 Sprites - { "073-c08.3k", 0x080000, 0x09fab3ab, BRF_GRA }, // 6 - - { "073-b04.2d", 0x080000, 0x05287a0b, BRF_SND }, // 7 K053260 Samples - - { "thndrx2a.nv", 0x000080, 0xf7893d00, BRF_OPT }, -}; - -STD_ROM_PICK(thndrx2a) -STD_ROM_FN(thndrx2a) - -static struct BurnRomInfo thndrx2jRomDesc[] = { - { "073-ja-k02.11c", 0x020000, 0x0c8b2d3f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "073-ja-k03.12c", 0x020000, 0x3803b427, BRF_ESS | BRF_PRG }, // 1 - - { "073-c01.4f", 0x010000, 0x44ebe83c, BRF_ESS | BRF_PRG }, // 2 Z80 Code - - { "073-c06.16k", 0x080000, 0x24e22b42, BRF_GRA }, // 3 Tiles - { "073-c05.12k", 0x080000, 0x952a935f, BRF_GRA }, // 4 - - { "073-c07.7k", 0x080000, 0x14e93f38, BRF_GRA }, // 5 Sprites - { "073-c08.3k", 0x080000, 0x09fab3ab, BRF_GRA }, // 6 - - { "073-b04.2d", 0x080000, 0x05287a0b, BRF_SND }, // 7 K053260 Samples - - { "thndrx2j.nv", 0x000080, 0x83b4799b, BRF_OPT }, -}; - -STD_ROM_PICK(thndrx2j) -STD_ROM_FN(thndrx2j) - -static struct BurnRomInfo lgtnfghtRomDesc[] = { - { "939k02.e11", 0x020000, 0x2dfefa53, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "939k03.e15", 0x020000, 0x14f0c454, BRF_ESS | BRF_PRG }, // 1 - - { "939e01.d7", 0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, // 2 Z80 Code - - { "939a07.k14", 0x080000, 0x7955dfcf, BRF_GRA }, // 3 Tiles - { "939a08.k19", 0x080000, 0xed95b385, BRF_GRA }, // 4 - - { "939a06.k8", 0x080000, 0xe393c206, BRF_GRA }, // 5 Sprites - { "939a05.k2", 0x080000, 0x3662d47a, BRF_GRA }, // 6 - - { "939a04.c5", 0x080000, 0xc24e2b6e, BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(lgtnfght) -STD_ROM_FN(lgtnfght) - -static struct BurnRomInfo lgtnfghtuRomDesc[] = { - { "939m02.e11", 0x020000, 0x61a12184, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "939m03.e15", 0x020000, 0x6db6659d, BRF_ESS | BRF_PRG }, // 1 - - { "939e01.d7", 0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, // 2 Z80 Code - - { "939a07.k14", 0x080000, 0x7955dfcf, BRF_GRA }, // 3 Tiles - { "939a08.k19", 0x080000, 0xed95b385, BRF_GRA }, // 4 - - { "939a06.k8", 0x080000, 0xe393c206, BRF_GRA }, // 5 Sprites - { "939a05.k2", 0x080000, 0x3662d47a, BRF_GRA }, // 6 - - { "939a04.c5", 0x080000, 0xc24e2b6e, BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(lgtnfghtu) -STD_ROM_FN(lgtnfghtu) - -static struct BurnRomInfo lgtnfghtaRomDesc[] = { - { "939j_02.e11", 0x020000, 0xbbbb4a74, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "939j_03.e15", 0x020000, 0x8d4da7b7, BRF_ESS | BRF_PRG }, // 1 - - { "939e01.d7", 0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, // 2 Z80 Code - - { "939a07.k14", 0x080000, 0x7955dfcf, BRF_GRA }, // 3 Tiles - { "939a08.k19", 0x080000, 0xed95b385, BRF_GRA }, // 4 - - { "939a06.k8", 0x080000, 0xe393c206, BRF_GRA }, // 5 Sprites - { "939a05.k2", 0x080000, 0x3662d47a, BRF_GRA }, // 6 - - { "939a04.c5", 0x080000, 0xc24e2b6e, BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(lgtnfghta) -STD_ROM_FN(lgtnfghta) - -static struct BurnRomInfo trigonRomDesc[] = { - { "939j02.e11", 0x020000, 0x38381d1b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "939j03.e15", 0x020000, 0xb5beddcd, BRF_ESS | BRF_PRG }, // 1 - - { "939e01.d7", 0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, // 2 Z80 Code - - { "939a07.k14", 0x080000, 0x7955dfcf, BRF_GRA }, // 3 Tiles - { "939a08.k19", 0x080000, 0xed95b385, BRF_GRA }, // 4 - - { "939a06.k8", 0x080000, 0xe393c206, BRF_GRA }, // 5 Sprites - { "939a05.k2", 0x080000, 0x3662d47a, BRF_GRA }, // 6 - - { "939a04.c5", 0x080000, 0xc24e2b6e, BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(trigon) -STD_ROM_FN(trigon) - -static struct BurnRomInfo tmnt2RomDesc[] = { - { "063uaa02.e8", 0x020000, 0x58d5c93d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "063uaa03.g8", 0x020000, 0x0541fec9, BRF_ESS | BRF_PRG }, // 1 - { "063uaa04.e10", 0x020000, 0x1d441a7d, BRF_ESS | BRF_PRG }, // 2 - { "063uaa05.g10", 0x020000, 0x9c428273, BRF_ESS | BRF_PRG }, // 3 - - { "063b01", 0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, // 4 Z80 Code - - { "063b12", 0x080000, 0xd3283d19, BRF_GRA }, // 5 Tiles - { "063b11", 0x080000, 0x6ebc0c15, BRF_GRA }, // 6 - - { "063b09", 0x100000, 0x2d7a9d2a, BRF_GRA }, // 7 Sprites - { "063b10", 0x080000, 0xf2dd296e, BRF_GRA }, // 8 - { "063b07", 0x100000, 0xd9bee7bf, BRF_GRA }, // 9 - { "063b08", 0x080000, 0x3b1ae36f, BRF_GRA }, // 10 - - { "063b06", 0x200000, 0x1e510aa5, BRF_SND }, // 11 K053260 Samples - - { "tmnt2_uaa.nv", 0x000080, 0x284357bd, BRF_OPT }, -}; - -STD_ROM_PICK(tmnt2) -STD_ROM_FN(tmnt2) - -static struct BurnRomInfo tmnt22puRomDesc[] = { - { "063uda02.e8", 0x020000, 0xaadffe3a, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "063uda03.g8", 0x020000, 0x125687a8, BRF_ESS | BRF_PRG }, // 1 - { "063uda04.e10", 0x020000, 0xfb5c7ded, BRF_ESS | BRF_PRG }, // 2 - { "063uda05.g10", 0x020000, 0x3c40fe66, BRF_ESS | BRF_PRG }, // 3 - - { "063b01", 0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, // 4 Z80 Code - - { "063b12", 0x080000, 0xd3283d19, BRF_GRA }, // 5 Tiles - { "063b11", 0x080000, 0x6ebc0c15, BRF_GRA }, // 6 - - { "063b09", 0x100000, 0x2d7a9d2a, BRF_GRA }, // 7 Sprites - { "063b10", 0x080000, 0xf2dd296e, BRF_GRA }, // 8 - { "063b07", 0x100000, 0xd9bee7bf, BRF_GRA }, // 9 - { "063b08", 0x080000, 0x3b1ae36f, BRF_GRA }, // 10 - - { "063b06", 0x200000, 0x1e510aa5, BRF_SND }, // 11 K053260 Samples - - { "tmnt2_uda.nv", 0x000080, 0x44928d33, BRF_OPT }, -}; - -STD_ROM_PICK(tmnt22pu) -STD_ROM_FN(tmnt22pu) - -static struct BurnRomInfo tmht22peRomDesc[] = { - { "063eba02.e8", 0x020000, 0x99409094, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "063eba03.g8", 0x020000, 0x4d65650f, BRF_ESS | BRF_PRG }, // 1 - { "063eba04.e10", 0x020000, 0xf6e3b9c7, BRF_ESS | BRF_PRG }, // 2 - { "063eba05.g10", 0x020000, 0x1bad6696, BRF_ESS | BRF_PRG }, // 3 - - { "063b01", 0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, // 4 Z80 Code - - { "063b12", 0x080000, 0xd3283d19, BRF_GRA }, // 5 Tiles - { "063b11", 0x080000, 0x6ebc0c15, BRF_GRA }, // 6 - - { "063b09", 0x100000, 0x2d7a9d2a, BRF_GRA }, // 7 Sprites - { "063b10", 0x080000, 0xf2dd296e, BRF_GRA }, // 8 - { "063b07", 0x100000, 0xd9bee7bf, BRF_GRA }, // 9 - { "063b08", 0x080000, 0x3b1ae36f, BRF_GRA }, // 10 - - { "063b06", 0x200000, 0x1e510aa5, BRF_SND }, // 11 K053260 Samples - - { "tmnt2_eba.nv", 0x000080, 0xc0a3ed50, BRF_OPT }, -}; - -STD_ROM_PICK(tmht22pe) -STD_ROM_FN(tmht22pe) - -static struct BurnRomInfo tmnt2aRomDesc[] = { - { "063ada02.e8", 0x020000, 0x4f11b587, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "063ada03.g8", 0x020000, 0x82a1b9ac, BRF_ESS | BRF_PRG }, // 1 - { "063ada04.e10", 0x020000, 0x05ad187a, BRF_ESS | BRF_PRG }, // 2 - { "063ada05.g10", 0x020000, 0xd4826547, BRF_ESS | BRF_PRG }, // 3 - - { "063b01", 0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, // 4 Z80 Code - - { "063b12", 0x080000, 0xd3283d19, BRF_GRA }, // 5 Tiles - { "063b11", 0x080000, 0x6ebc0c15, BRF_GRA }, // 6 - - { "063b09", 0x100000, 0x2d7a9d2a, BRF_GRA }, // 7 Sprites - { "063b10", 0x080000, 0xf2dd296e, BRF_GRA }, // 8 - { "063b07", 0x100000, 0xd9bee7bf, BRF_GRA }, // 9 - { "063b08", 0x080000, 0x3b1ae36f, BRF_GRA }, // 10 - - { "063b06", 0x200000, 0x1e510aa5, BRF_SND }, // 11 K053260 Samples - - { "tmnt2_ada.nv", 0x000080, 0x063068a0, BRF_OPT }, -}; - -STD_ROM_PICK(tmnt2a) -STD_ROM_FN(tmnt2a) - -static struct BurnRomInfo qgakumonRomDesc[] = { - { "248jaa02.8e", 0x040000, 0xfab79410, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "248jaa03.8g", 0x040000, 0x8d888ef3, BRF_ESS | BRF_PRG }, // 1 - { "248jaa04.10e", 0x040000, 0x56cb16cb, BRF_ESS | BRF_PRG }, // 2 - { "248jaa05.10g", 0x040000, 0x27614fcd, BRF_ESS | BRF_PRG }, // 3 - - { "248a01.2f", 0x010000, 0xa8a41cc6, BRF_ESS | BRF_PRG }, // 4 Z80 Code - - { "248a12.16k", 0x080000, 0x62870987, BRF_GRA }, // 5 Tiles - { "248a11.12k", 0x080000, 0xfad2dbfd, BRF_GRA }, // 6 - - { "248a09.7l", 0x100000, 0xa176e205, BRF_GRA }, // 7 Sprites - { "248a07.3l", 0x100000, 0x9595589f, BRF_GRA }, // 8 - - { "248a06.1d", 0x200000, 0x0fba1def, BRF_SND }, // 9 K053260 Samples - - { "qgakumon.nv", 0x000080, 0x847bd238, BRF_OPT }, -}; - -STD_ROM_PICK(qgakumon) -STD_ROM_FN(qgakumon) - -static struct BurnRomInfo punkshotRomDesc[] = { - { "907-j02.i7", 0x020000, 0xdbb3a23b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "907-j03.i10", 0x020000, 0x2151d1ab, BRF_ESS | BRF_PRG }, // 1 - - { "907f01.e8", 0x008000, 0xf040c484, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "907d06.e23", 0x040000, 0xf5cc38f4, BRF_GRA }, // 3 Tiles - { "907d05.e22", 0x040000, 0xe25774c1, BRF_GRA }, // 4 - - { "907d07.k2", 0x100000, 0xb0fe4543, BRF_GRA }, // 5 Sprites - { "907d08.k7", 0x100000, 0xd5ac8d9d, BRF_GRA }, // 6 - - { "907d04.d3", 0x080000, 0x090feb5e, BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(punkshot) -STD_ROM_FN(punkshot) - -static struct BurnRomInfo punkshot2RomDesc[] = { - { "907m02.i7", 0x020000, 0x59e14575, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "907m03.i10", 0x020000, 0xadb14b1e, BRF_ESS | BRF_PRG }, // 1 - - { "907f01.e8", 0x008000, 0xf040c484, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "907d06.e23", 0x040000, 0xf5cc38f4, BRF_GRA }, // 3 Tiles - { "907d05.e22", 0x040000, 0xe25774c1, BRF_GRA }, // 4 - - { "907d07.k2", 0x100000, 0xb0fe4543, BRF_GRA }, // 5 Sprites - { "907d08.k7", 0x100000, 0xd5ac8d9d, BRF_GRA }, // 6 - - { "907d04.d3", 0x080000, 0x090feb5e, BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(punkshot2) -STD_ROM_FN(punkshot2) - -static struct BurnRomInfo punkshotjRomDesc[] = { - { "907z02.i7", 0x020000, 0x7a3a5c89, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "907z03.i10", 0x020000, 0x22a3d9d6, BRF_ESS | BRF_PRG }, // 1 - - { "907f01.e8", 0x008000, 0xf040c484, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "907d06.e23", 0x040000, 0xf5cc38f4, BRF_GRA }, // 3 Tiles - { "907d05.e22", 0x040000, 0xe25774c1, BRF_GRA }, // 4 - - { "907d07.k2", 0x100000, 0xb0fe4543, BRF_GRA }, // 5 Sprites - { "907d08.k7", 0x100000, 0xd5ac8d9d, BRF_GRA }, // 6 - - { "907d04.d3", 0x080000, 0x090feb5e, BRF_SND }, // 7 K053260 Samples -}; - -STD_ROM_PICK(punkshotj) -STD_ROM_FN(punkshotj) - -static INT32 TmntMemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x060000; - DrvZ80Rom = Next; Next += 0x008000; - DrvSoundRom = Next; Next += 0x020000; - DrvUPD7759CRom = Next; Next += 0x020000; - DrvTileRom = Next; Next += 0x100000; - DrvSpriteRom = Next; Next += 0x200000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x004000; - DrvZ80Ram = Next; Next += 0x000800; - DrvPaletteRam = Next; Next += 0x001000; - - RamEnd = Next; - - Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - DrvTitleSample = (INT16*)Next; Next += 0x40000 * sizeof(INT16); - DrvTiles = Next; Next += 0x008000 * 8 * 8; - DrvSprites = Next; Next += 0x004000 * 16 * 16; - - MemEnd = Next; - - return 0; -} - -static INT32 MiaMemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x040000; - DrvZ80Rom = Next; Next += 0x008000; - DrvSoundRom = Next; Next += 0x020000; - DrvTileRom = Next; Next += 0x040000; - DrvSpriteRom = Next; Next += 0x100000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x008000; - DrvZ80Ram = Next; Next += 0x000800; - DrvPaletteRam = Next; Next += 0x001000; - - RamEnd = Next; - - Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - DrvTiles = Next; Next += 0x002000 * 8 * 8; - DrvSprites = Next; Next += 0x002000 * 16 * 16; - - MemEnd = Next; - - return 0; -} - -static INT32 CuebrickMemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x020000; - DrvTileRom = Next; Next += 0x040000; - DrvSpriteRom = Next; Next += 0x040000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x008000; - DrvPaletteRam = Next; Next += 0x001000; - - RamEnd = Next; - - Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - DrvTiles = Next; Next += 0x002000 * 8 * 8; - DrvSprites = Next; Next += 0x001000 * 16 * 16; - DrvNvRam = Next; Next += 0x400 * 0x20; - - MemEnd = Next; - - return 0; -} - -static INT32 BlswhstlMemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x080000; - DrvZ80Rom = Next; Next += 0x010000; - DrvSoundRom = Next; Next += 0x100000; - DrvTileRom = Next; Next += 0x100000; - DrvSpriteRom = Next; Next += 0x100000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x004000; - DrvZ80Ram = Next; Next += 0x000800; - DrvPaletteRam = Next; Next += 0x001000; - DrvSpriteRam = Next; Next += 0x004000; - - RamEnd = Next; - - DrvTiles = Next; Next += 0x008000 * 8 * 8; - DrvSprites = Next; Next += 0x002000 * 16 * 16; - Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 SsridersMemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x0c0000; - DrvZ80Rom = Next; Next += 0x010000; - DrvSoundRom = Next; Next += 0x100000; - DrvTileRom = Next; Next += 0x100000; - DrvSpriteRom = Next; Next += 0x200000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x004080; - DrvZ80Ram = Next; Next += 0x000800; - DrvPaletteRam = Next; Next += 0x001000; - DrvSpriteRam = Next; Next += 0x004000; - - RamEnd = Next; - - Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); - DrvTiles = Next; Next += 0x008000 * 8 * 8; - DrvSprites = Next; Next += 0x004000 * 16 * 16; - - MemEnd = Next; - - return 0; -} - -static INT32 Tmnt2MemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x100000; - DrvZ80Rom = Next; Next += 0x010000; - DrvSoundRom = Next; Next += 0x200000; - DrvTileRom = Next; Next += 0x100000; - DrvSpriteRom = Next; Next += 0x400000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x005080; - DrvZ80Ram = Next; Next += 0x000800; - DrvPaletteRam = Next; Next += 0x001000; - DrvSpriteRam = Next; Next += 0x004000; - - RamEnd = Next; - - Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); - DrvTiles = Next; Next += 0x008000 * 8 * 8; - DrvSprites = Next; Next += 0x008000 * 16 * 16; - - MemEnd = Next; - - return 0; -} - -static INT32 Thndrx2MemIndex() -{ - UINT8 *Next; Next = Mem; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x004000; - DrvZ80Ram = Next; Next += 0x000800; - DrvPaletteRam = Next; Next += 0x001000; - - RamEnd = Next; - - Drv68KRom = Next; Next += 0x080000; - DrvZ80Rom = Next; Next += 0x010000; - DrvSoundRom = Next; Next += 0x080000; - DrvTileRom = Next; Next += 0x100000; - DrvSpriteRom = Next; Next += 0x100000; - - Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); - DrvTiles = Next; Next += 0x008000 * 8 * 8; - DrvSprites = Next; Next += 0x002000 * 16 * 16; - - MemEnd = Next; - - return 0; -} - -static INT32 LgtnfghtMemIndex() -{ - UINT8 *Next; Next = Mem; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x004000; - DrvZ80Ram = Next; Next += 0x000800; - DrvPaletteRam = Next; Next += 0x001000; - DrvSpriteRam = Next; Next += 0x004000; - - RamEnd = Next; - - Drv68KRom = Next; Next += 0x080000; - DrvZ80Rom = Next; Next += 0x010000; - DrvSoundRom = Next; Next += 0x080000; - DrvTileRom = Next; Next += 0x100000; - DrvSpriteRom = Next; Next += 0x100000; - - Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); - DrvTiles = Next; Next += 0x008000 * 8 * 8; - DrvSprites = Next; Next += 0x002000 * 16 * 16; - - MemEnd = Next; - - return 0; -} - -static INT32 PunkshotMemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x040000; - DrvZ80Rom = Next; Next += 0x010000; - DrvSoundRom = Next; Next += 0x080000; - DrvTileRom = Next; Next += 0x080000; - DrvSpriteRom = Next; Next += 0x200000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x004000; - DrvZ80Ram = Next; Next += 0x000800; - DrvPaletteRam = Next; Next += 0x001000; - - RamEnd = Next; - - Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); - DrvTiles = Next; Next += 0x004000 * 8 * 8; - DrvSprites = Next; Next += 0x004000 * 16 * 16; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - bIrqEnable = 0; - DrvSoundLatch = 0; - TitleSoundLatch = 0; - PlayTitleSample = 0; - TitleSamplePos = 0; - PriorityFlag = 0; - - return 0; -} - -static INT32 TmntDoReset() -{ - INT32 nRet = DrvDoReset(); - - UPD7759Reset(); - - UPD7759StartWrite(0, 0); - UPD7759ResetWrite(0, 1); - - return nRet; -} - -static INT32 CuebrickDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - bIrqEnable = 0; - DrvNvRamBank = 0; - PriorityFlag = 0; - CuebrickSndIrqFire = 0; - - return 0; -} - -static INT32 BlswhstlDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - K053260Reset(0); - - KonamiICReset(); - - EEPROMReset(); - - if (EEPROMAvailable()) { - InitEEPROMCount = 0; - } else { - InitEEPROMCount = 10; - } - - BlswhstlTileRomBank = 0; - - K052109_irq_enabled = 0; - - return 0; -} - -static INT32 SsridersDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - K053260Reset(0); - - KonamiICReset(); - - EEPROMReset(); - - if (EEPROMAvailable()) { - InitEEPROMCount = 0; - } else { - InitEEPROMCount = 10; - } - - K052109_irq_enabled = 0; - DrvVBlank = 0; - - dim_c = 0; - dim_v = 0; - - return 0; -} - -static INT32 PunkshotDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - K053260Reset(0); - - KonamiICReset(); - - K052109_irq_enabled = 0; - DrvVBlank = 0; - - return 0; -} - -UINT8 __fastcall Tmnt68KReadByte(UINT32 a) -{ - K052109WordNoA12Read(0x100000) - K051937ByteRead(0x140000) - K051960ByteRead(0x140400) - - switch (a) { - case 0x0a0001: { - return 0xff - DrvInput[0]; - } - - case 0x0a0003: { - return 0xff - DrvInput[1]; - } - - case 0x0a0005: { - return 0xff - DrvInput[2]; - } - - case 0x0a0007: { - return 0xff - DrvInput[3]; - } - - case 0x0a0011: { - return DrvDip[0]; - } - - case 0x0a0013: { - return DrvDip[1]; - } - - case 0x0a0015: { - return 0xff - DrvInput[4]; - } - - case 0x0a0019: { - return DrvDip[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Tmnt68KWriteByte(UINT32 a, UINT8 d) -{ - K052109WordNoA12Write(0x100000) - K015937ByteWrite(0x140000) - K051960ByteWrite(0x140400) - - switch (a) { - case 0x0a0001: { - static INT32 Last; - if (Last == 0x08 && (d & 0x08) == 0) { - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - } - Last = d & 0x08; - - bIrqEnable = (d & 0x20) ? 1 : 0; - - K052109RMRDLine = d & 0x80; - return; - } - - case 0x0a0009: { - DrvSoundLatch = d; - return; - } - - case 0x0a0011: { - // watchdog write - return; - } - - case 0x0c0001: { - PriorityFlag = (d & 0x0c) >> 2; - return; - } - - case 0x10e801: { - // nop??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Tmnt68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Tmnt68KWriteWord(UINT32 a, UINT16 d) -{ - K051960WordWrite(0x140400) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Mia68KReadByte(UINT32 a) -{ - K052109WordNoA12Read(0x100000) - K051937ByteRead(0x140000) - K051960ByteRead(0x140400) - - switch (a) { - case 0x0a0001: { - return 0xff - DrvInput[0]; - } - - case 0x0a0003: { - return 0xff - DrvInput[1]; - } - - case 0x0a0005: { - return 0xff - DrvInput[2]; - } - - case 0x0a0011: { - return DrvDip[0]; - } - - case 0x0a0013: { - return DrvDip[1]; - } - - case 0x0a0019: { - return DrvDip[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Mia68KWriteByte(UINT32 a, UINT8 d) -{ - K052109WordNoA12Write(0x100000) - K015937ByteWrite(0x140000) - K051960ByteWrite(0x140400) - - switch (a) { - case 0x0a0001: { - static INT32 Last; - if (Last == 0x08 && (d & 0x08) == 0) { - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - } - Last = d & 0x08; - - bIrqEnable = (d & 0x20) ? 1 : 0; - - K052109RMRDLine = d & 0x80; - return; - } - - case 0x0a0009: { - DrvSoundLatch = d; - return; - } - - case 0x0a0011: { - // watchdog write - return; - } - - case 0x10e801: { - // nop??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Mia68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Mia68KWriteWord(UINT32 a, UINT16 d) -{ - K051960WordWrite(0x140400) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Cuebrick68KReadByte(UINT32 a) -{ - K052109WordNoA12Read(0x100000) - K051937ByteRead(0x140000) - K051960ByteRead(0x140400) - - if (a >= 0x0b0000 && a <= 0x0b03ff) { - return DrvNvRam[(a - 0x0b0000) + (DrvNvRamBank * 0x400)]; - } - - switch (a) { - case 0x0a0001: { - return 0xff - DrvInput[0]; - } - - case 0x0a0003: { - return 0xff - DrvInput[1]; - } - - case 0x0a0005: { - return 0xff - DrvInput[2]; - } - - case 0x0a0011: { - return DrvDip[1]; - } - - case 0x0a0013: { - return DrvDip[0]; - } - - case 0x0a0019: { - return DrvDip[2]; - } - - case 0x0c0000: - return 0xff; - - case 0x0c0002: { - return BurnYM2151ReadStatus(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Cuebrick68KWriteByte(UINT32 a, UINT8 d) -{ - K052109WordNoA12Write(0x100000) - K015937ByteWrite(0x140000) - K051960ByteWrite(0x140400) - - if (a >= 0x0b0000 && a <= 0x0b03ff) { - DrvNvRam[(a - 0x0b0000) + (DrvNvRamBank * 0x400)] = d; - return; - } - - switch (a) { - case 0x0a0001: { - bIrqEnable = (d & 0x20) ? 1 : 0; - - K052109RMRDLine = d & 0x80; - return; - } - - case 0x0a0011: { - // watchdog write - return; - } - - case 0x0b0400: { - DrvNvRamBank = d; - return; - } - - case 0x0c0000: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x0c0002: { - BurnYM2151WriteRegister(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Cuebrick68KReadWord(UINT32 a) -{ - if (a >= 0x0b0000 && a <= 0x0b03ff) { - SEK_DEF_READ_WORD(0, a); - return 0; - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Cuebrick68KWriteWord(UINT32 a, UINT16 d) -{ - K051960WordWrite(0x140400) - - if (a >= 0x0b0000 && a <= 0x0b03ff) { - SEK_DEF_WRITE_WORD(0, a, d); - return; - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Blswhstl68KReadByte(UINT32 a) -{ - if (a >= 0x180000 && a <= 0x183fff) { - INT32 Offset = (a - 0x180000) >> 1; - - if (a & 1) { - return K052109Read(Offset + 0x2000); - } else { - return K052109Read(Offset + 0x0000); - } - } - - if (a >= 0x300000 && a <= 0x303fff) { - INT32 Offset = (a - 0x300000); - - if (Offset & (0x31 << 1)) { - return DrvSpriteRam[Offset ^ 1]; - } else { - Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); - return K053245ReadWord(0, Offset/2) >> ((~a & 1) << 3); - } - } - - if (a >= 0x500000 && a <= 0x50003f) { - INT32 Offset = (a - 0x500000) >> 1; - if (a & 1) { - return K054000Read(Offset); - } else { - return 0; - } - } - - if (a >= 0x680000 && a <= 0x68001f) { - INT32 Offset = (a - 0x680000) >> 1; - Offset &= ~1; - - if (a & 1) { - return K053244Read(0, Offset + 1); - } else { - return K053244Read(0, Offset + 0); - } - } - - switch (a) { - case 0x700001: { - return 0xff - DrvInput[1]; - } - - case 0x700003: { - return 0xff - DrvInput[2]; - } - - case 0x700005: { - UINT8 Res; - static INT32 Toggle; - - Res = 0xff - DrvInput[0]; - - if (InitEEPROMCount) { - InitEEPROMCount--; - Res &= 0xf7; - } - - Toggle ^= 0x40; - - return Res ^ Toggle; - } - - case 0x700007: { - return 0xfe | (EEPROMRead() & 0x01); - } - - case 0x780601: - case 0x780603: { - INT32 Offset = (a - 0x780601) >> 1; - return K053260Read(0, Offset + 2); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Blswhstl68KWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x180000 && a <= 0x183fff) { - INT32 Offset = (a - 0x180000) >> 1; - - if (a & 1) { - K052109Write(Offset + 0x2000, d); - } else { - K052109Write(Offset + 0x0000, d); - } - return; - } - - if (a >= 0x300000 && a <= 0x303fff) { - INT32 Offset = (a - 0x300000); - DrvSpriteRam[Offset ^ 1] = d; - - if (!(Offset & (0x31 << 1))) { - Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); - - INT32 data = K053245ReadWord(0, Offset/2); - - if (a & 1) { - data &= 0xff00; - data |= d; - } else { - data &= 0x00ff; - data |= d << 8; - } - - K053245WriteWord(0, Offset / 2, data); - } - return; - } - - if (a >= 0x500000 && a <= 0x50003f) { - INT32 Offset = (a - 0x500000) >> 1; - if (a & 1) K054000Write(Offset, d); - return; - } - - if (a >= 0x680000 && a <= 0x68001f) { - INT32 Offset = (a - 0x680000) >> 1; - Offset &= ~1; - - if (a & 1) { - K053244Write(0, Offset + 1, d); - } else { - K053244Write(0, Offset + 0, d); - } - return; - } - - if (a >= 0x780700 && a <= 0x78071f) { - K053251Write((a - 0x780700) >> 1, d); - return; - } - - switch (a) { - case 0x700201: { - EEPROMWrite(d & 0x04, d & 0x02, d & 0x01); - return; - } - - case 0x700301: { - K052109RMRDLine = d & 0x08; - BlswhstlTileRomBank = (d & 0x80) >> 7; - return; - } - - case 0x700401: { - // watchdog write - return; - } - - case 0x780601: { - K053260Write(0, 0, d); - return; - } - - case 0x780605: { - ZetOpen(0); - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Blswhstl68KReadWord(UINT32 a) -{ - if (a >= 0x300000 && a <= 0x303fff) { - UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; - INT32 Offset = (a - 0x300000) >> 1; - - if (Offset & 0x31) { - return BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]); - } else { - Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); - return K053245ReadWord(0, Offset); - } - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Blswhstl68KWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x180000 && a <= 0x183fff) { - INT32 Offset = (a - 0x180000) >> 1; - - K052109Write(Offset + 0x2000, d >> 8); - K052109Write(Offset + 0x0000, d & 0xff); - return; - } - - if (a >= 0x300000 && a <= 0x303fff) { - UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; - INT32 Offset = (a - 0x300000) >> 1; - SpriteRam[Offset] = BURN_ENDIAN_SWAP_INT16(d); - - if (!(Offset & 0x0031)) { - Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); - K053245WriteWord(0, Offset, d); - } - return; - } - - if (a >= 0x500000 && a <= 0x50003f) { - INT32 Offset = (a - 0x500000) >> 1; - K054000Write(Offset, d & 0xff); - return; - } - - if (a >= 0x680000 && a <= 0x68001f) { - INT32 Offset = (a - 0x680000) >> 1; - Offset &= ~1; - - K053244Write(0, Offset + 1, d & 0xff); - K053244Write(0, Offset + 0, d >> 8); - return; - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -static void tmnt2_protection_write() -{ - UINT32 src_addr, dst_addr, mod_addr, attr1, code, attr2, cbase, cmod, color; - INT32 xoffs, yoffs, xmod, ymod, zmod, xzoom, yzoom, i; - UINT16 *mcu; - UINT16 src[4], mod[24]; - UINT8 keepaspect, xlock, ylock, zlock; - - mcu = (UINT16*)(Drv68KRam + 0x4800); - if ((BURN_ENDIAN_SWAP_INT16(mcu[8]) & 0xff00) != 0x8200) return; - - src_addr = (BURN_ENDIAN_SWAP_INT16(mcu[0]) | (BURN_ENDIAN_SWAP_INT16(mcu[1])&0xff)<<16) >> 1; - dst_addr = (BURN_ENDIAN_SWAP_INT16(mcu[2]) | (BURN_ENDIAN_SWAP_INT16(mcu[3])&0xff)<<16) >> 1; - mod_addr = (BURN_ENDIAN_SWAP_INT16(mcu[4]) | (BURN_ENDIAN_SWAP_INT16(mcu[5])&0xff)<<16) >> 1; - zlock = (BURN_ENDIAN_SWAP_INT16(mcu[8]) & 0xff) == 0x0001; - - for (i=0; i< 4; i++) src[i] = SekReadWord((src_addr + i) * 2); - for (i=0; i<24; i++) mod[i] = SekReadWord((mod_addr + i) * 2); - - code = src[0]; // code - - i= src[1]; - attr1 = i>>2 & 0x3f00; // flip y, flip x and sprite size - attr2 = i & 0x380; // mirror y, mirror x, shadow - cbase = i & 0x01f; // base color - cmod = mod[0x2a/2]>>8; - color = (cbase != 0x0f && cmod <= 0x1f && !zlock) ? cmod : cbase; - - xoffs = (INT16)src[2]; // local x - yoffs = (INT16)src[3]; // local y - - i = mod[0]; - attr2 |= i & 0x0060; // priority - keepaspect = (i & 0x0014) == 0x0014; - if (i & 0x8000) { attr1 |= 0x8000; } // active - if (keepaspect) { attr1 |= 0x4000; } // keep aspect - if (i & 0x4000) { attr1 ^= 0x1000; xoffs = -xoffs; } // flip x - - xmod = (INT16)mod[6]; // global x - ymod = (INT16)mod[7]; // global y - zmod = (INT16)mod[8]; // global z - xzoom = mod[0x1c/2]; - yzoom = (keepaspect) ? xzoom : mod[0x1e/2]; - - ylock = xlock = (i & 0x0020 && (!xzoom || xzoom == 0x100)); - - if (!xlock) - { - i = xzoom - 0x4f00; - if (i > 0) - { - i >>= 8; - xoffs += (INT32)(pow(i, /*1.898461*/1.891292) * xoffs / 599.250121); - } - else if (i < 0) - { - i = (i>>3) + (i>>4) + (i>>5) + (i>>6) + xzoom; - xoffs = (i > 0) ? (xoffs * i / 0x4f00) : 0; - } - } - if (!ylock) - { - i = yzoom - 0x4f00; - if (i > 0) - { - i >>= 8; - yoffs += (INT32)(pow(i, /*1.898461*/1.891292) * yoffs / 599.250121); - } - else if (i < 0) - { - i = (i>>3) + (i>>4) + (i>>5) + (i>>6) + yzoom; - yoffs = (i > 0) ? (yoffs * i / 0x4f00) : 0; - } - - } - if (!zlock) yoffs += zmod; - xoffs += xmod; - yoffs += ymod; - - SekWriteWord((dst_addr + 0) * 2, attr1); - SekWriteWord((dst_addr + 2) * 2, code); - SekWriteWord((dst_addr + 4) * 2, (UINT32)yoffs); - SekWriteWord((dst_addr + 6) * 2, (UINT32)xoffs); - SekWriteWord((dst_addr + 12) * 2, attr2 | color); -} - -void __fastcall Tmnt268KProtWord(UINT32 a, UINT16 d) -{ - *((UINT16*)(Drv68KRam + 0x4800 + (a & 0x1e))) = BURN_ENDIAN_SWAP_INT16(d); -} - -void __fastcall Tmnt268KProtByte(UINT32 a, UINT8 d) -{ - a &= 0x1f; - Drv68KRam[0x4801 ^ a] = d; - - if (a == 0x18) tmnt2_protection_write(); -} - -static UINT16 ssriders_protection_r() -{ - INT32 data = SekReadWord(0x105a0a); - INT32 cmd = SekReadWord(0x1058fc); - - switch (cmd) - { - case 0x100b: - return 0x0064; - - case 0x6003: - return data & 0x000f; - - case 0x6004: - return data & 0x001f; - - case 0x6000: - return data & 0x0001; - - case 0x0000: - return data & 0x00ff; - - case 0x6007: - return data & 0x00ff; - - case 0x8abc: - /* collision table */ - data = -SekReadWord(0x105818); - data = ((data / 8 - 4) & 0x1f) * 0x40; - data += ((SekReadWord(0x105cb0) + - 256*K052109Read(0x1a01) + K052109Read(0x1a00) - 6) / 8 + 12) & 0x3f; - return data; - - default: - return 0xffff; - } -} - -static void ssriders_protection_w(INT32 offset) -{ - offset >>= 1; - - if (offset == 1) - { - INT32 logical_pri,hardware_pri; - - /* create sprite priority attributes */ - hardware_pri = 1; - for (logical_pri = 1;logical_pri < 0x100;logical_pri <<= 1) - { - INT32 i; - - for (i = 0;i < 128;i++) - { - if ((SekReadWord(0x180006 + 128*i) >> 8) == (UINT16)logical_pri) - { - K053245Write(0,((8*i) * 2)+1,hardware_pri); - hardware_pri++; - } - } - } - } -} - -UINT8 __fastcall Ssriders68KReadByte(UINT32 a) -{ - if (a >= 0x180000 && a <= 0x183fff) { - INT32 Offset = (a - 0x180000); - - if (Offset & (0x31 << 1)) { - return DrvSpriteRam[Offset ^ 1]; - } else { - Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); - return K053245ReadWord(0, Offset / 2) >> ((~a & 1) << 3); - } - } - - if ((a & 0xffff80) == 0x1c0500) { - return Drv68KRam[0x4001 ^ (a & 0x7f)]; - } - - if (a >= 0x5a0000 && a <= 0x5a001f) { - INT32 Offset = (a - 0x5a0000) >> 1; - Offset &= ~1; - - if (a & 1) { - return K053244Read(0, Offset + 1); - } else { - return K053244Read(0, Offset + 0); - } - } - - if (a >= 0x600000 && a <= 0x603fff) { - INT32 Offset = (a - 0x600000) >> 1; - - if (a & 1) { - return K052109Read(Offset + 0x2000); - } else { - return K052109Read(Offset + 0x0000); - } - } - - switch (a) { - case 0x1c0800: - case 0x1c0801: - return ssriders_protection_r() >> ((~a & 1) << 3); - - case 0x1c0001: { - return 0xff - DrvInput[1]; - } - - case 0x1c0003: { - return 0xff - DrvInput[2]; - } - - case 0x1c0005: { - return 0xff - DrvInput[3]; - } - - case 0x1c0007: { - return 0xff - DrvInput[4]; - } - - case 0x1c0101: { - return 0xff - DrvInput[0]; - } - - case 0x1c0103: { - UINT8 Res; - static INT32 Toggle; - - Res = DrvInput[5]; - if (DrvVBlank) Res |= 0x08; - Res |= EEPROMRead() & 0x01; - - if (InitEEPROMCount) { - InitEEPROMCount--; - Res &= 0x7f; - } - - Toggle ^= 0x04; - - return Res ^ Toggle; - } - - case 0x1c0401: { - // watchdog read - return 0; - } - - case 0x5c0601: - case 0x5c0603: { - INT32 Offset = (a - 0x5c0601) >> 1; - return K053260Read(0, Offset + 2); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ssriders68KWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x180000 && a <= 0x183fff) { - INT32 Offset = (a - 0x180000); - DrvSpriteRam[Offset ^ 1] = d; - - if (!(Offset & (0x31 << 1))) { - Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); - - INT32 data = K053245ReadWord(0, Offset/2); - - if (a & 1) { - data &= 0xff00; - data |= d; - } else { - data &= 0x00ff; - data |= d << 8; - } - - K053245WriteWord(0, Offset/2, data); - - } - return; - } - - if ((a & ~3) == 0x1c0800) { - bprintf (0, _T("protection write byte %x %x\n"), a, d); - return; - } - - // extra ram for tmnt2 - if ((a & 0xffff80) == 0x1c0500) { - Drv68KRam[0x4001 ^ (a & 0x7f)] = d; - //*((UINT16*)(Drv68KRam + 0x4000 + (a & 0x7e))) = d; - return; - } - - if (a >= 0x5a0000 && a <= 0x5a001f) { - INT32 Offset = (a - 0x5a0000) >> 1; - Offset &= ~1; - - K053244Write(0, Offset + 1, d & 0xff); - K053244Write(0, Offset + 0, 0); // originally d >> 8, but that is effectively 0 - return; - } - - if (a >= 0x5c0700 && a <= 0x5c071f) { - K053251Write((a - 0x5c0700) >> 1, d); - return; - } - - if (a >= 0x600000 && a <= 0x603fff) { - INT32 Offset = (a - 0x600000) >> 1; - - if (a & 1) { - K052109Write(Offset + 0x2000, d); - } else { - K052109Write(Offset + 0x0000, d); - } - return; - } - - switch (a) { - case 0x1c0201: { - EEPROMWrite(d & 0x04, d & 0x02, d & 0x01); - K053244BankSelect(0, ((d & 0x20) >> 5) << 2); - dim_c = d & 0x18; - return; - } - - case 0x1c0301: { - K052109RMRDLine = d & 0x08; - dim_v = (d & 0x70) >> 4; - return; - } - - case 0x5c0601: { - K053260Write(0, 0, d); - return; - } - - case 0x5c0605: { - ZetOpen(0); - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - - case 0x1c0401: { - // watchdog write - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Ssriders68KReadWord(UINT32 a) -{ - if (a >= 0x180000 && a <= 0x183fff) { - UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; - INT32 Offset = (a - 0x180000) >> 1; - - if (Offset & 0x31) { - return BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]); - } else { - Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); - return K053245ReadWord(0, Offset); - } - } - - if ((a & 0xffff80) == 0x1c0500) { - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(Drv68KRam + 0x4000 + (a & 0x7e)))); - } - - if (a == 0x1c0800) return ssriders_protection_r(); - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ssriders68KWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x180000 && a <= 0x183fff) { - UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; - INT32 Offset = (a - 0x180000) >> 1; - SpriteRam[Offset] = BURN_ENDIAN_SWAP_INT16(d); - - if (!(Offset & 0x0031)) { - Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); - K053245WriteWord(0, Offset, d); - } - return; - } - - if (a >= 0x5a0000 && a <= 0x5a001f) { - INT32 Offset = (a - 0x5a0000) >> 1; - Offset &= ~1; - - K053244Write(0, Offset + 1, d & 0xff); - K053244Write(0, Offset + 0, d >> 8); - return; - } - - if ((a & 0xffff80) == 0x1c0500) { - *((UINT16*)(Drv68KRam + 0x4000 + (a & 0x7e))) = BURN_ENDIAN_SWAP_INT16(d); - return; - } - - if (a == 0x1c0802) { - ssriders_protection_w(2); - return; - } - - switch (a) { - case 0x1c0800: - case 0x1c0802: { - ssriders_protection_w(a - 0x1c0800); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Thndrx268KReadByte(UINT32 a) -{ - K052109WordNoA12Read(0x600000) - K051937ByteRead(0x700000) - - if ((a & 0xffffc00) == 0x700400) { - return K051960Read(a & 0x3ff); - } - - if (a >= 0x500000 && a <= 0x50003f) { - INT32 Offset = (a - 0x500000) >> 1; - if (a & 1) { - return K054000Read(Offset); - } else { - return 0; - } - } - - switch (a) - { - case 0x400001: - case 0x400003: - return K053260Read(0, ((a & 2) >> 1) + 2); - - case 0x500200: - { - INT32 ret = DrvInput[1]^0xff; - if (InitEEPROMCount) { - ret &= 0xf7; - InitEEPROMCount--; - } - return ret; - } - - case 0x500201: - return DrvInput[0]^0xff; - - case 0x500202: - { - static INT32 toggle; - toggle ^= 0x08; - INT32 ret = 0xfe; - ret |= (EEPROMRead() & 1); - ret ^= toggle; - - return ret; - } - - case 0x500203: - return DrvInput[2]^0xff; - } - - - return 0; -} - -void __fastcall Thndrx268KWriteWord(UINT32 a, UINT16 d) -{ - if ((a & 0xffffc00) == 0x700400) { - K051960Write((a & 0x3fe) | 0, d >> 8); - K051960Write((a & 0x3fe) | 1, d & 0xff); - return; - } -} - -void __fastcall Thndrx268KWriteByte(UINT32 a, UINT8 d) -{ - K052109WordNoA12Write(0x600000) - K015937ByteWrite(0x700000) - - if ((a & 0xffffc00) == 0x700400) { - K051960Write(a & 0x3ff, d); - return; - } - - if (a >= 0x300000 && a <= 0x30001f) { - if (a & 1) K053251Write((a - 0x300000) >> 1, d); - return; - } - - if (a >= 0x500000 && a <= 0x50003f) { - INT32 Offset = (a - 0x500000) >> 1; - if (a & 1) K054000Write(Offset, d); - return; - } - - switch (a) - { - case 0x400001: - K053260Write(0, 0, d); - return; - - case 0x500101: - { - EEPROMWriteBit(d & 0x01); - EEPROMSetCSLine((d & 0x02) ? EEPROM_CLEAR_LINE : EEPROM_ASSERT_LINE); - EEPROMSetClockLine((d & 0x04) ? EEPROM_ASSERT_LINE : EEPROM_CLEAR_LINE); - - // EEPROMWrite(d & 0x04, d & 0x02, d & 0x01); - - static INT32 last; - if (last == 0 && (d & 0x20) != 0) { - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } - last = d & 0x20; - - K052109RMRDLine = d & 0x40; - } - return; - } -} - -UINT16 __fastcall Lgtnfght68KReadWord(UINT32 a) -{ - if (a >= 0xb0000 && a <= 0xb3fff) { - UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; - INT32 Offset = (a - 0xb0000) >> 1; - - if (Offset & 0x31) { - return BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]); - } else { - Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); - return K053245ReadWord(0, Offset); - } - } - - return 0; -} - -UINT8 __fastcall Lgtnfght68KReadByte(UINT32 a) -{ - K052109WordNoA12Read(0x100000) - - if (a >= 0xb0000 && a <= 0xb3fff) { - INT32 Offset = (a - 0xb0000); - - if (Offset & (0x31 << 1)) { - return DrvSpriteRam[Offset ^ 1]; - } else { - Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); - return K053245ReadWord(0, Offset / 2) >> ((~a & 1) << 3); - } - } - - if (a >= 0xc0000 && a <= 0xc001f) { - INT32 Offset = (a - 0xc0000) >> 1; - Offset &= ~1; - - if (a & 1) { - return K053244Read(0, Offset + 1); - } else { - return K053244Read(0, Offset + 0); - } - } - - switch (a) - { - case 0x0a0001: - return ~DrvInput[0] & 0xfb; - - case 0x0a0003: - return ~DrvInput[1]; - - case 0x0a0005: - return ~DrvInput[2]; - - case 0x0a0007: - return DrvDip[0]; - - case 0x0a0009: - return DrvDip[1]; - - case 0x0a0011: - return DrvDip[2]; - - case 0x0a0021: - case 0x0a0023: - return K053260Read(0, ((a & 2) >> 1) + 2); // k053260 - } - - return 0; -} - -void __fastcall Lgtnfght68KWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0xb0000 && a <= 0xb3fff) { - UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; - INT32 Offset = (a - 0xb0000) >> 1; - SpriteRam[Offset] = BURN_ENDIAN_SWAP_INT16(d); - - if (!(Offset & 0x0031)) { - Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); - K053245WriteWord(0, Offset, d); - } - return; - } -} - -void __fastcall Lgtnfght68KWriteByte(UINT32 a, UINT8 d) -{ - K052109WordNoA12Write(0x100000) - - if (a >= 0x0e0000 && a <= 0x0e001f) { - K053251Write((a - 0x0e0000) >> 1, d); - return; - } - - if (a >= 0xb0000 && a <= 0xb3fff) { - INT32 Offset = (a - 0xb0000); - DrvSpriteRam[Offset ^ 1] = d; - - if (!(Offset & (0x31 << 1))) { - Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); - - INT32 data = K053245ReadWord(0, Offset/2); - - if (a & 1) { - data &= 0xff00; - data |= d; - } else { - data &= 0x00ff; - data |= d << 8; - } - - K053245WriteWord(0, Offset/2, data); - - } - return; - } - - if (a >= 0xc0000 && a <= 0xc001f) { - INT32 Offset = (a - 0xc0000) >> 1; - Offset &= ~1; - - K053244Write(0, Offset + 1, d & 0xff); - K053244Write(0, Offset + 0, 0); // originally d >> 8, but that is effectively 0 - return; - } - - switch (a) - { - case 0xa0019: - { - static INT32 last; - if (last == 0 && (d & 0x4) != 0) { - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } - last = d & 0x4; - - K052109RMRDLine = d & 0x8; - } - return; - - case 0xa0021: - K053260Write(0, 0, d); - return; - - case 0xa0029: // watchdog - return; - } -} - -UINT16 __fastcall Punkshot68KReadWord(UINT32 a) -{ - if ((a & 0xfffc00) == 0x110400) { - return K051960Read((a & 0x3fe) | 1) | (K051960Read((a & 0x3fe) | 0) << 8); - } - - return 0; -} - -UINT8 __fastcall Punkshot68KReadByte(UINT32 a) -{ - K052109WordNoA12Read(0x100000) - K051937ByteRead(0x110000) - K051960ByteRead(0x110400) - - switch (a) - { - case 0x0a0000: - return DrvDip[1]; - - case 0x0a0001: - return DrvDip[0]; - - case 0x0a0003: - return ~DrvInput[0]; - - case 0x0a0002: - return DrvDip[2] | (~DrvInput[5] & 0x0f); - - case 0x0a0005: - return ~DrvInput[3]; - - case 0x0a0004: - return ~DrvInput[4]; - - case 0x0a0007: - return ~DrvInput[1]; - - case 0x0a0006: - return ~DrvInput[2]; - - case 0x0a0041: - case 0x0a0043: - return K053260Read(0, ((a & 2) >> 1) | 2); - - case 0xfffffc: - case 0xfffffd: - case 0xfffffe: - case 0xffffff: - return rand(); - } - - return 0; -} - -void __fastcall Punkshot68KWriteWord(UINT32 a, UINT16 d) -{ - if ((a & 0xfffc00) == 0x110400) { - K051960Write((a & 0x3fe) | 0, d >> 8); - K051960Write((a & 0x3fe) | 1, d & 0xff); - - return; - } - - if ((a & 0xff8000) == 0x100000) { - SekWriteByte(a+1, d & 0xff); - return; - } -} - -void __fastcall Punkshot68KWriteByte(UINT32 a, UINT8 d) -{ - K052109WordNoA12Write(0x100000) - K015937ByteWrite(0x110000) - K051960ByteWrite(0x110400) - - if ((a & 0xffffe1) == 0xa0061) { - K053251Write((a & 0x1f) >> 1, d); - return; - } - - switch (a) - { - case 0x0a0020: - case 0x0a0021: - { - static INT32 last; - K052109RMRDLine = d & 0x08; - - if (last == 0x04 && (d & 0x04) == 0x00) { - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } - - last = d & 0x04; - } - return; - - case 0x0a0041: - K053260Write(0, 0, d); - return; - - case 0x0a0081: - // watchdog - return; - } -} - -UINT8 __fastcall TmntZ80Read(UINT16 a) -{ - if (a >= 0xb000 && a <= 0xb00d) { - return K007232ReadReg(0, a - 0xb000); - } - - switch (a) { - case 0x9000: { - return TitleSoundLatch; - } - - case 0xa000: { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return DrvSoundLatch; - } - - case 0xc001: { - return BurnYM2151ReadStatus(); - } - - case 0xf000: { - return UPD7759BusyRead(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall TmntZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0xb000 && a <= 0xb00d) { - K007232WriteReg(0, (a - 0xb000), d); - return; - } - - switch (a) { - case 0x9000: { - TitleSoundLatch = d; - if (d & 0x04) { - PlayTitleSample = 1; - } else { - PlayTitleSample = 0; - TitleSamplePos = 0; - } - - UPD7759ResetWrite(0, d & 2); - return; - } - - case 0xc000: { - BurnYM2151SelectRegister(d); - return; - } - - case 0xc001: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xd000: { - UPD7759PortWrite(0, d); - return; - } - - case 0xe000: { - UPD7759StartWrite(0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall MiaZ80Read(UINT16 a) -{ - if (a >= 0xb000 && a <= 0xb00d) { - return K007232ReadReg(0, a - 0xb000); - } - - switch (a) { - case 0xa000: { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return DrvSoundLatch; - } - - case 0xc001: { - return BurnYM2151ReadStatus(); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall MiaZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0xb000 && a <= 0xb00d) { - K007232WriteReg(0, (a - 0xb000), d); - return; - } - - switch (a) { - case 0xc000: { - BurnYM2151SelectRegister(d); - return; - } - - case 0xc001: { - BurnYM2151WriteRegister(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall BlswhstlZ80Read(UINT16 a) -{ - if (a >= 0xfa00 && a <= 0xfa2f) { - if (a == 0xfa00) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return K053260Read(0, a - 0xfa00); - } - - switch (a) { - case 0xf801: { - return BurnYM2151ReadStatus(); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall BlswhstlZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0xfa00 && a <= 0xfa2f) { - K053260Write(0, (a - 0xfa00), d); - return; - } - - switch (a) { - case 0xf800: { - BurnYM2151SelectRegister(d); - return; - } - - case 0xf801: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xfc00: { // tmnt2 needs this - ZetRun(100); - ZetNmi(); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall Thndrx2Z80Write(UINT16 a, UINT8 d) -{ - if (a >= 0xfc00 && a <= 0xfc2f) { - K053260Write(0, (a - 0xfc00), d); - return; - } - - switch (a) - { - case 0xf800: - case 0xf810: - BurnYM2151SelectRegister(d); - return; - - case 0xf801: - case 0xf811: - BurnYM2151WriteRegister(d); - return; - - case 0xfa00: - ZetRun(100); - ZetNmi(); - return; - } -} - -UINT8 __fastcall Thndrx2Z80Read(UINT16 a) -{ - if (a >= 0xfc00 && a <= 0xfc2f) { - if (a == 0xfc00) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return K053260Read(0, a - 0xfc00); - } - - switch (a) - { - case 0xf801: - case 0xf811: - return BurnYM2151ReadStatus(); - } - - return 0; -} - -void __fastcall LgtnfghtZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0xc000 && a <= 0xc02f) { - K053260Write(0, (a - 0xc000), d); - return; - } - - switch (a) - { - case 0xa000: - BurnYM2151SelectRegister(d); - return; - - case 0xa001: - BurnYM2151WriteRegister(d); - return; - } -} - -UINT8 __fastcall LgtnfghtZ80Read(UINT16 a) -{ - if (a >= 0xc000 && a <= 0xc02f) { - if (a == 0xc000) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return K053260Read(0, a - 0xc000); - } - - switch (a) - { - case 0xa001: - return BurnYM2151ReadStatus(); - } - - return 0; -} - -static void shuffle(UINT16 *buf, INT32 len) -{ - INT32 i; - UINT16 t; - - if (len == 2) return; - - if (len % 4) return; - - len /= 2; - - for (i = 0;i < len/2;i++) { - t = buf[len/2 + i]; - buf[len/2 + i] = buf[len + i]; - buf[len + i] = t; - } - - shuffle(buf,len); - shuffle(buf + len,len); -} - -static void byte_shuffle(UINT8 *buf, INT32 len) -{ - INT32 i; - UINT8 t; - - if (len == 2) return; - - if (len % 4) return; - - len /= 2; - - for (i = 0;i < len/2;i++) { - t = buf[len/2 + i]; - buf[len/2 + i] = buf[len + i]; - buf[len + i] = t; - } - - byte_shuffle(buf,len); - byte_shuffle(buf + len,len); -} - -static void TmntUnscrambleGfx(UINT8 *pSrc, INT32 nLength) -{ - INT32 bits[32]; - for (INT32 i = 0; i < nLength; i += 4) { - for (INT32 j = 0; j < 4; j++) { - for (INT32 k = 0; k < 8; k++) { - bits[8*j + k] = (pSrc[i + j] >> k) & 1; - } - } - - for (INT32 j = 0; j < 4; j++) { - pSrc[i + j] = 0; - for (INT32 k = 0; k < 8; k++) { - pSrc[i + j] |= bits[j + 4*k] << k; - } - } - } -} - -static void TmntUnscrambleSprites() -{ - BurnLoadRom(DrvTempRom + 0x200000, 11, 1); - UINT8 *SpriteConvTable = DrvTempRom + 0x200000; - - memcpy(DrvTempRom, DrvSpriteRom, 0x200000); - - for (INT32 A = 0; A < 0x80000; A++) { - INT32 B, i, entry; - INT32 bits[10]; - - static const UINT8 bit_pick_table[10][8] = { - { 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 5, 5, 5, 5, 5, 5 }, - { 1, 1, 0, 0, 0, 7, 7, 7 }, - { 2, 2, 1, 1, 1, 0, 0, 9 }, - { 4, 4, 2, 2, 2, 1, 1, 0 }, - { 5, 6, 4, 4, 4, 2, 2, 1 }, - { 6, 5, 6, 6, 6, 4, 4, 2 }, - { 7, 7, 7, 7, 8, 6, 6, 4 }, - { 8, 8, 8, 8, 7, 8, 8, 6 }, - { 9, 9, 9, 9, 9, 9, 9, 8 } - }; - - entry = SpriteConvTable[(A & 0x7f800) >> 11] & 7; - - for (i = 0;i < 10;i++) - bits[i] = (A >> i) & 0x01; - - B = A & 0x7fc00; - - for (i = 0; i < 10;i++) B |= bits[bit_pick_table[i][entry]] << i; - - DrvSpriteRom[4*A+0] = DrvTempRom[4*B+0]; - DrvSpriteRom[4*A+1] = DrvTempRom[4*B+1]; - DrvSpriteRom[4*A+2] = DrvTempRom[4*B+2]; - DrvSpriteRom[4*A+3] = DrvTempRom[4*B+3]; - } -} - -static void MiaUnscrambleSprites() -{ - memcpy(DrvTempRom, DrvSpriteRom, 0x100000); - - for (INT32 A = 0; A < 0x40000; A++) { - INT32 B, i; - INT32 bits[8]; - for (i = 0; i < 8; i++) bits[i] = (A >> i) & 0x01; - - B = A & 0x3ff00; - - if ((A & 0x3c000) == 0x3c000) { - B |= bits[3] << 0; - B |= bits[5] << 1; - B |= bits[0] << 2; - B |= bits[1] << 3; - B |= bits[2] << 4; - B |= bits[4] << 5; - B |= bits[6] << 6; - B |= bits[7] << 7; - } else { - B |= bits[3] << 0; - B |= bits[5] << 1; - B |= bits[7] << 2; - B |= bits[0] << 3; - B |= bits[1] << 4; - B |= bits[2] << 5; - B |= bits[4] << 6; - B |= bits[6] << 7; - } - - DrvSpriteRom[4*A+0] = DrvTempRom[4*B+0]; - DrvSpriteRom[4*A+1] = DrvTempRom[4*B+1]; - DrvSpriteRom[4*A+2] = DrvTempRom[4*B+2]; - DrvSpriteRom[4*A+3] = DrvTempRom[4*B+3]; - } -} - -static void TmntDecodeTitleSample() -{ - for (INT32 i = 0; i < 0x40000; i++) { - INT32 val = DrvTempRom[2 * i + 0] + (DrvTempRom[(2 * i) + 1] << 8); - INT32 expo = val >> 13; - - val = (val >> 3) & (0x3ff); - val -= 0x200; - - val <<= (expo-3); - - DrvTitleSample[i] = val; - } -} - -static void TmntTitleSampleSetRoute(double nVolume, INT32 nRouteDir) -{ - TitleSampleGain = nVolume; - TitleSampleOutputDir = nRouteDir; -} - -static INT32 TilePlaneOffsets[4] = { 24, 16, 8, 0 }; -static INT32 TileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 TileYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 SpritePlaneOffsets[4] = { 24, 16, 8, 0 }; -static INT32 SpritePlaneOffsets2[4] = { 0, 8, 16, 24 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 256, 257, 258, 259, 260, 261, 262, 263 }; -static INT32 SpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; - -static void K052109TmntCallback(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32*, INT32 *) -{ - *Code |= ((*Colour & 0x03) << 8) | ((*Colour & 0x10) << 6) | ((*Colour & 0x0c) << 9) | (Bank << 13); - *Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5); -} - -static void K052109MiaCallback(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32 *xFlip, INT32 *) -{ - *xFlip = *Colour & 0x04; - - if (Layer == 0) { - *Code |= ((*Colour & 0x01) << 8); - *Colour = LayerColourBase[Layer] + ((*Colour & 0x80) >> 5) + ((*Colour & 0x10) >> 1); - } else { - *Code |= ((*Colour & 0x01) << 8) | ((*Colour & 0x18) << 6) | (Bank << 11); - *Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5); - } -} - -static void K052109CuebrickCallback(INT32 Layer, INT32, INT32 *Code, INT32 *Colour, INT32 *, INT32 *) -{ - if (K052109RMRDLine == 0 && Layer == 0) { - *Code |= ((*Colour & 0x01) << 8); - *Colour = LayerColourBase[Layer] + ((*Colour & 0x80) >> 5) + ((*Colour & 0x10) >> 1); - } else { - *Code |= ((*Colour & 0x0f) << 8); - *Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5); - } -} - -static void K052109BlswhstlCallback(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32 *, INT32 *) -{ - *Code |= ((*Colour & 0x01) << 8) | ((*Colour & 0x10) << 5) | ((*Colour & 0x0c) << 8) | (Bank << 12) | (BlswhstlTileRomBank << 14); - *Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5); -} - -static void K051960TmntCallback(INT32 *Code, INT32 *Colour, INT32*, INT32*) -{ - *Code |= (*Colour & 0x10) << 9; - *Colour = SpriteColourBase + (*Colour & 0x0f); -} - -static void K051960MiaCallback(INT32* /*Code*/, INT32 *Colour, INT32*, INT32*) -{ - *Colour = SpriteColourBase + (*Colour & 0x0f); -} - -static void K051960CuebrickCallback(INT32* Code, INT32 *Colour, INT32*, INT32*) -{ - *Colour = SpriteColourBase + (*Colour & 0x0f); - *Code &= 0xfff; -} - -static void K051960Thndrx2Callback(INT32* code, INT32 *color, INT32* priority, INT32*) -{ - INT32 pri = 0x20 | ((*color & 0x60) >> 2); - if (pri <= LayerPri[2]) *priority = 0; - else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 1; - else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 2; - else *priority = 3; - - *code &= 0x1fff; - *color = SpriteColourBase + (*color & 0x0f); -} - -static void K051960PunkshotCallback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) -{ - INT32 pri = 0x20 | ((*color & 0x60) >> 2); - if (pri <= LayerPri[2]) *priority = 0; - else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 1; - else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 2; - else *priority = 3; - - *code |= (*color & 0x10) << 9; - *code &= 0x3fff; - *color = SpriteColourBase + (*color & 0x0f); -} - -static void K053245BlswhstlCallback(INT32 *Code, INT32 *Colour, INT32 *Priority) -{ - INT32 Pri = 0x20 | ((*Colour & 0x60) >> 2); - if (Pri <= LayerPri[2]) *Priority = 0; - else if (Pri > LayerPri[2] && Pri <= LayerPri[1]) *Priority = 1; - else if (Pri > LayerPri[1] && Pri <= LayerPri[0]) *Priority = 2; - else *Priority = 3; - - *Code &= 0x1fff; - *Colour = SpriteColourBase + (*Colour & 0x1f); -} - -static void K053245SsridersCallback(INT32 *, INT32 *Colour, INT32 *Priority) -{ - INT32 Pri = 0x20 | ((*Colour & 0x60) >> 2); - if (Pri <= LayerPri[2]) *Priority = 0; - else if (Pri > LayerPri[2] && Pri <= LayerPri[1]) *Priority = 1; - else if (Pri > LayerPri[1] && Pri <= LayerPri[0]) *Priority = 2; - else *Priority = 3; - - *Colour = SpriteColourBase + (*Colour & 0x1f); -} - -static void K053245LgtnfghtCallback(INT32 *code, INT32 *color, INT32 *priority) -{ - INT32 pri = 0x20 | ((*color & 0x60) >> 2); - if (pri <= LayerPri[2]) *priority = 0; - else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 1; - else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 2; - else *priority = 3; - - *color = SpriteColourBase + (*color & 0x1f); - *code &= 0x3fff; -} - -static void DrvK007232VolCallback(INT32 v) -{ - K007232SetVolume(0, 0, (v >> 4) * 0x11, 0); - K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); -} - -static void CuebrickYM2151IrqHandler(INT32 Irq) -{ - CuebrickSndIrqFire = Irq; -} - -static INT32 TmntInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - TmntMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - TmntMemIndex(); - - K052109Init(DrvTileRom, 0x0fffff); - K052109SetCallback(K052109TmntCallback); - K051960Init(DrvSpriteRom, 0x1fffff); - K051960SetCallback(K051960TmntCallback); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x040001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x040000, 3, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1; - shuffle((UINT16*)DrvTileRom, 0x080000); - TmntUnscrambleGfx(DrvTileRom, 0x100000); - GfxDecode(0x100000 / 32, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); - - // Load the sprites - DrvTempRom = (UINT8 *)BurnMalloc(0x200100); - nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x080000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x100000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x180000, 10, 1); if (nRet != 0) return 1; - shuffle((UINT16*)DrvSpriteRom, 0x100000); - TmntUnscrambleGfx(DrvSpriteRom, 0x200000); - TmntUnscrambleSprites(); - - // Decode the sprites - GfxDecode(0x200000 / 128, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites); - - // Load K007232 Sample Roms - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1; - - // Load UPD7759C Sample Roms - nRet = BurnLoadRom(DrvUPD7759CRom + 0x00000, 14, 1); if (nRet != 0) return 1; - - // Load title sample - memset(DrvTempRom, 0, 0x080000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 15, 1); if (nRet != 0) return 1; - TmntDecodeTitleSample(); - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x060000, 0x063fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x080000, 0x080fff, SM_RAM); - SekSetReadWordHandler(0, Tmnt68KReadWord); - SekSetWriteWordHandler(0, Tmnt68KWriteWord); - SekSetReadByteHandler(0, Tmnt68KReadByte); - SekSetWriteByteHandler(0, Tmnt68KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(TmntZ80Read); - ZetSetWriteHandler(TmntZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - - K007232Init(0, 3579545, DrvSoundRom, 0x20000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback); - K007232PCMSetAllRoutes(0, 0.33, BURN_SND_ROUTE_BOTH); - - UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvUPD7759CRom); - UPD7759SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); - - TmntTitleSampleSetRoute(1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - LayerColourBase[0] = 0; - LayerColourBase[1] = 32; - LayerColourBase[2] = 40; - SpriteColourBase = 16; - - // Reset the driver - TmntDoReset(); - - return 0; -} - -static INT32 MiaInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MiaMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MiaMemIndex(); - - K052109Init(DrvTileRom, 0x03ffff); - K052109SetCallback(K052109MiaCallback); - K051960Init(DrvSpriteRom, 0x0fffff); - K051960SetCallback(K051960MiaCallback); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x000001, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x020000, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x020001, 6, 2); if (nRet != 0) return 1; - shuffle((UINT16*)DrvTileRom, 0x020000); - TmntUnscrambleGfx(DrvTileRom, 0x040000); - GfxDecode(0x2000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); - - // Load the sprites - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x080000, 8, 1); if (nRet != 0) return 1; - shuffle((UINT16*)DrvSpriteRom, 0x080000); - TmntUnscrambleGfx(DrvSpriteRom, 0x100000); - MiaUnscrambleSprites(); - - // Decode the sprites - GfxDecode(0x2000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites); - - // Load K007232 Sample Roms - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 10, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRam + 0x0000 , 0x040000, 0x043fff, SM_RAM); - SekMapMemory(Drv68KRam + 0x4000 , 0x060000, 0x063fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x080000, 0x080fff, SM_RAM); - SekSetReadWordHandler(0, Mia68KReadWord); - SekSetWriteWordHandler(0, Mia68KWriteWord); - SekSetReadByteHandler(0, Mia68KReadByte); - SekSetWriteByteHandler(0, Mia68KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(MiaZ80Read); - ZetSetWriteHandler(MiaZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - - K007232Init(0, 3579545, DrvSoundRom, 0x20000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback); - K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - LayerColourBase[0] = 0; - LayerColourBase[1] = 32; - LayerColourBase[2] = 40; - SpriteColourBase = 16; - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 CuebrickInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - CuebrickMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - CuebrickMemIndex(); - - K052109Init(DrvTileRom, 0x03ffff); - K052109SetCallback(K052109CuebrickCallback); - - K051960Init(DrvSpriteRom, 0x03ffff); - K051960SetCallback(K051960CuebrickCallback); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTileRom + 0x000000, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x000001, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x020000, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x020001, 5, 2); if (nRet != 0) return 1; - byte_shuffle(DrvTileRom, 0x040000); - GfxDecode(0x2000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); - - // Load the sprites - nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x000001, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x020000, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x020001, 9, 2); if (nRet != 0) return 1; - byte_shuffle(DrvSpriteRom, 0x040000); - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x01ffff, SM_ROM); - SekMapMemory(Drv68KRam + 0x0000 , 0x040000, 0x043fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x080000, 0x080fff, SM_RAM); - SekSetReadWordHandler(0, Cuebrick68KReadWord); - SekSetWriteWordHandler(0, Cuebrick68KWriteWord); - SekSetReadByteHandler(0, Cuebrick68KReadByte); - SekSetWriteByteHandler(0, Cuebrick68KWriteByte); - SekClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&CuebrickYM2151IrqHandler); - BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - LayerColourBase[0] = 0; - LayerColourBase[1] = 32; - LayerColourBase[2] = 40; - SpriteColourBase = 16; - - // Reset the driver - CuebrickDoReset(); - - return 0; -} - -static INT32 BlswhstlInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - BlswhstlMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - BlswhstlMemIndex(); - - K052109Init(DrvTileRom, 0x0fffff); - K052109SetCallback(K052109BlswhstlCallback); - K052109AdjustScroll(8, 0); - - K053245Init(0, DrvSpriteRom, 0xfffff, K053245BlswhstlCallback); - K053245SetSpriteOffset(0, -112, 16); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x040001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x040000, 3, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1; - BurnByteswap(DrvTileRom, 0x100000); - konami_rom_deinterleave_2(DrvTileRom, 0x100000); - GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); - - // Load the sprites - nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x080000, 8, 1); if (nRet != 0) return 1; - BurnByteswap(DrvSpriteRom, 0x100000); - konami_rom_deinterleave_2(DrvSpriteRom, 0x100000); - K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x100000); - - // Load K053260 Sample Roms - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x204000, 0x207fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x400000, 0x400fff, SM_RAM); - SekSetReadWordHandler(0, Blswhstl68KReadWord); - SekSetWriteWordHandler(0, Blswhstl68KWriteWord); - SekSetReadByteHandler(0, Blswhstl68KReadByte); - SekSetWriteByteHandler(0, Blswhstl68KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(BlswhstlZ80Read); - ZetSetWriteHandler(BlswhstlZ80Write); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT); - - K053260Init(0, 3579545, DrvSoundRom, 0x100000); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.50, BURN_SND_ROUTE_RIGHT); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.50, BURN_SND_ROUTE_LEFT); - - EEPROMInit(&BlswhstlEEPROMInterface); - - GenericTilesInit(); - - // Reset the driver - BlswhstlDoReset(); - - return 0; -} - -static INT32 SsridersInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - SsridersMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - SsridersMemIndex(); - - K052109Init(DrvTileRom, 0x0fffff); - K052109SetCallback(K052109TmntCallback); - K052109AdjustScroll(8, 0); - - K053245Init(0, DrvSpriteRom, 0x1fffff, K053245LgtnfghtCallback); - K053245SetSpriteOffset(0, -368, 528); - K05324xSetZRejection(0); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x080001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x080000, 3, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvTileRom, 0x100000); - GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); - - // Load the sprites - nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x100000, 8, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvSpriteRom, 0x200000); - K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x200000); - - // Load K053260 Sample Roms - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x0bffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x104000, 0x107fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x140000, 0x140fff, SM_RAM); - SekSetReadWordHandler(0, Ssriders68KReadWord); - SekSetWriteWordHandler(0, Ssriders68KWriteWord); - SekSetReadByteHandler(0, Ssriders68KReadByte); - SekSetWriteByteHandler(0, Ssriders68KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(BlswhstlZ80Read); - ZetSetWriteHandler(BlswhstlZ80Write); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - K053260Init(0, 3579545, DrvSoundRom, 0x100000); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT); - - EEPROMInit(&BlswhstlEEPROMInterface); - - GenericTilesInit(); - - // Reset the driver - SsridersDoReset(); - - return 0; -} - -static INT32 Thndrx2Init() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - Thndrx2MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - Thndrx2MemIndex(); - - K052109Init(DrvTileRom, 0x0fffff); - K052109SetCallback(K052109TmntCallback); - K052109AdjustScroll(8, 0); - - K051960Init(DrvSpriteRom, 0x0fffff); - K051960SetCallback(K051960Thndrx2Callback); - K051960SetSpriteOffset(8, 0); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x080000, 4, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvTileRom, 0x100000); - GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); - - // Load the sprites - nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x080000, 6, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvSpriteRom, 0x100000); - GfxDecode(0x2000, 4, 16, 16, SpritePlaneOffsets2, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites); - - // Load K053260 Sample Roms - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 7, 1); if (nRet != 0) return 1; - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x200000, 0x200fff, SM_RAM); - SekSetWriteWordHandler(0, Thndrx268KWriteWord); - SekSetReadByteHandler(0, Thndrx268KReadByte); - SekSetWriteByteHandler(0, Thndrx268KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Thndrx2Z80Read); - ZetSetWriteHandler(Thndrx2Z80Write); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - K053260Init(0, 3579545, DrvSoundRom, 0x80000); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); - - EEPROMInit(&thndrx2_eeprom_interface); - - GenericTilesInit(); - - // Reset the driver - SsridersDoReset(); - - return 0; -} - -static INT32 LgtnfghtInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - LgtnfghtMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - LgtnfghtMemIndex(); - - K052109Init(DrvTileRom, 0x0fffff); - K052109SetCallback(K052109TmntCallback); - K052109AdjustScroll(8, 0); - - K053245Init(0, DrvSpriteRom, 0x0fffff, K053245LgtnfghtCallback); - K053245SetSpriteOffset(0, -368, 528); - K05324xSetZRejection(0); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x080000, 4, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvTileRom, 0x100000); - GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); - - // Load the sprites - nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x080000, 6, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvSpriteRom, 0x100000); - K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x100000); - - // Load K053260 Sample Roms - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 7, 1); if (nRet != 0) return 1; - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPaletteRam , 0x080000, 0x080fff, SM_RAM); - SekMapMemory(Drv68KRam , 0x090000, 0x093fff, SM_RAM); - SekSetReadWordHandler(0, Lgtnfght68KReadWord); - SekSetWriteWordHandler(0, Lgtnfght68KWriteWord); - SekSetReadByteHandler(0, Lgtnfght68KReadByte); - SekSetWriteByteHandler(0, Lgtnfght68KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(LgtnfghtZ80Read); - ZetSetWriteHandler(LgtnfghtZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - K053260Init(0, 3579545, DrvSoundRom, 0x80000); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT); - - EEPROMInit(&thndrx2_eeprom_interface); - - GenericTilesInit(); - - // Reset the driver - SsridersDoReset(); - - return 0; -} - -static INT32 Tmnt2Init() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - Tmnt2MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - Tmnt2MemIndex(); - - K052109Init(DrvTileRom, 0x0fffff); - K052109SetCallback(K052109TmntCallback); - K052109AdjustScroll(8, 0); - - K053245Init(0, DrvSpriteRom, 0x3fffff, K053245SsridersCallback); - K053245SetSpriteOffset(0, -368, 272); - K05324xSetZRejection(0); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x040001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x040000, 3, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvTileRom, 0x100000); - GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); - - // Load the sprites - nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x100000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x200000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x300000, 10, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvSpriteRom, 0x400000); - K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x400000); - - // Load K053260 Sample Roms - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 11, 1); if (nRet != 0) return 1; - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x104000, 0x107fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x140000, 0x140fff, SM_RAM); - SekSetReadWordHandler(0, Ssriders68KReadWord); - SekSetWriteWordHandler(0, Ssriders68KWriteWord); - SekSetReadByteHandler(0, Ssriders68KReadByte); - SekSetWriteByteHandler(0, Ssriders68KWriteByte); - - SekMapHandler(1, 0x1c0800, 0x1c081f, SM_WRITE); - SekSetWriteWordHandler(1, Tmnt268KProtWord); - SekSetWriteByteHandler(1, Tmnt268KProtByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(BlswhstlZ80Read); - ZetSetWriteHandler(BlswhstlZ80Write); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - K053260Init(0, 3579545, DrvSoundRom, 0x200000); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); - - EEPROMInit(&BlswhstlEEPROMInterface); - - GenericTilesInit(); - - // Reset the driver - SsridersDoReset(); - - return 0; -} - -static INT32 QgakumonInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - Tmnt2MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - Tmnt2MemIndex(); - - K052109Init(DrvTileRom, 0x0fffff); - K052109SetCallback(K052109TmntCallback); - K052109AdjustScroll(0, 0); - - K053245Init(0, DrvSpriteRom, 0x3fffff, K053245SsridersCallback); - K053245SetSpriteOffset(0, -360, 272); - K05324xSetZRejection(0); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x080001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x080000, 3, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvTileRom, 0x100000); - GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); - - // Load the sprites - nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x200000, 8, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvSpriteRom, 0x400000); - K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x400000); - - // Load K053260 Sample Roms - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x104000, 0x107fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x140000, 0x140fff, SM_RAM); - SekSetReadWordHandler(0, Ssriders68KReadWord); - SekSetWriteWordHandler(0, Ssriders68KWriteWord); - SekSetReadByteHandler(0, Ssriders68KReadByte); - SekSetWriteByteHandler(0, Ssriders68KWriteByte); - - SekMapHandler(1, 0x1c0800, 0x1c081f, SM_WRITE); - SekSetWriteWordHandler(1, Tmnt268KProtWord); - SekSetWriteByteHandler(1, Tmnt268KProtByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(BlswhstlZ80Read); - ZetSetWriteHandler(BlswhstlZ80Write); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - K053260Init(0, 3579545, DrvSoundRom, 0x200000); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); - - EEPROMInit(&BlswhstlEEPROMInterface); - - GenericTilesInit(); - - // Reset the driver - SsridersDoReset(); - - return 0; -} - -static INT32 PunkshotInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - PunkshotMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PunkshotMemIndex(); - - K052109Init(DrvTileRom, 0x07ffff); - K052109SetCallback(K052109TmntCallback); - K052109AdjustScroll(8, 0); - - K051960Init(DrvSpriteRom, 0x1fffff); - K051960SetCallback(K051960PunkshotCallback); - K051960SetSpriteOffset(8, 0); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTileRom + 0x040000, 4, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvTileRom, 0x80000); - GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); - - // Load the sprites - nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSpriteRom + 0x100000, 6, 1); if (nRet != 0) return 1; - konami_rom_deinterleave_2(DrvSpriteRom, 0x200000); - GfxDecode(0x4000, 4, 16, 16, SpritePlaneOffsets2, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites); - - // Load K053260 Sample Roms - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 7, 1); if (nRet != 0) return 1; - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x080000, 0x083fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x090000, 0x090fff, SM_RAM); - SekSetReadWordHandler(0, Punkshot68KReadWord); - SekSetWriteWordHandler(0, Punkshot68KWriteWord); - SekSetReadByteHandler(0, Punkshot68KReadByte); - SekSetWriteByteHandler(0, Punkshot68KWriteByte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Thndrx2Z80Read); - ZetSetWriteHandler(Thndrx2Z80Write); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - - K053260Init(0, 3579545, DrvSoundRom, 0x80000); - K053260PCMSetAllRoutes(0, 0.70, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - srand ( time(NULL) ); - - // Reset the driver - PunkshotDoReset(); - - return 0; -} - -static INT32 CommonExit() -{ - SekExit(); - - BurnYM2151Exit(); - - GenericTilesExit(); - - KonamiICExit(); - - BurnFree(Mem); - - bIrqEnable = 0; - DrvSoundLatch = 0; - TitleSoundLatch = 0; - PlayTitleSample = 0; - TitleSamplePos = 0; - SpriteColourBase = 0; - memset(LayerColourBase, 0, 3); - memset(LayerPri, 0, 3); - PriorityFlag = 0; - - DrvNvRamBank = 0; - CuebrickSndIrqFire = 0; - BlswhstlTileRomBank = 0; - DrvVBlank = 0; - InitEEPROMCount = 0; - - return 0; -} - -static INT32 CommonZ80Exit() -{ - ZetExit(); - - return CommonExit(); -} - -static INT32 TmntExit() -{ - UPD7759Exit(); - K007232Exit(); - - return CommonZ80Exit(); -} - -static INT32 MiaExit() -{ - K007232Exit(); - - return CommonZ80Exit(); -} - -static INT32 BlswhstlExit() -{ - K053260Exit(); - EEPROMExit(); - - return CommonZ80Exit(); -} - -static INT32 PunkshotExit() -{ - K053260Exit(); - - return CommonZ80Exit(); -} - -static inline UINT8 pal5bit(UINT8 bits) -{ - bits &= 0x1f; - return (bits << 3) | (bits >> 2); -} - -static void DrvCalcPalette() -{ - UINT16 *PaletteRam = (UINT16*)DrvPaletteRam; - - for (INT32 i = 0; i < 0x800; i += 2) { - INT32 Offset = i & ~1; - UINT32 Data = (BURN_ENDIAN_SWAP_INT16(PaletteRam[Offset]) << 8) | BURN_ENDIAN_SWAP_INT16(PaletteRam[Offset + 1]); - - Palette[Offset >> 1] = (pal5bit(Data >> 0) << 16) | (pal5bit(Data >> 5) << 8) | pal5bit(Data >> 10); - DrvPalette[Offset >> 1] = BurnHighCol(pal5bit(Data >> 0), pal5bit(Data >> 5), pal5bit(Data >> 10), 0); - } -} - -static void BlswhstlCalcPalette() -{ - UINT16 *PaletteRam = (UINT16*)DrvPaletteRam; - - for (INT32 i = 0; i < 0x800; i++) { - UINT32 Data = BURN_ENDIAN_SWAP_INT16(PaletteRam[i]); - - Palette[i] = (pal5bit(Data >> 0) << 16) | (pal5bit(Data >> 5) << 8) | pal5bit(Data >> 10); - DrvPalette[i] = BurnHighCol(pal5bit(Data >> 0), pal5bit(Data >> 5), pal5bit(Data >> 10), 0); - } -} - -static void TmntDraw() -{ - DrvCalcPalette(); - K052109UpdateScroll(); - - K052109RenderLayer(2, 1, DrvTiles); - if ((PriorityFlag & 1) == 1) K051960SpritesRender(DrvSprites, -1); - K052109RenderLayer(1, 0, DrvTiles); - if ((PriorityFlag & 1) == 0) K051960SpritesRender(DrvSprites, -1); - K052109RenderLayer(0, 0, DrvTiles); - - BurnTransferCopy(DrvPalette); -} - -static void sortlayers(INT32 *layer,INT32 *pri) -{ -#define SWAP(a,b) \ - if (pri[a] < pri[b]) \ - { \ - INT32 t; \ - t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ - t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ - } - - SWAP(0,1) - SWAP(0,2) - SWAP(1,2) -} - -static inline void BlswhstlCalcPaletteWithContrast(INT32 i, INT32 brt) -{ - INT32 r,g,b; - UINT16 *PaletteRam = (UINT16*)DrvPaletteRam; - - UINT32 Data = BURN_ENDIAN_SWAP_INT16(PaletteRam[i]); - - r = pal5bit(Data >> 0); - g = pal5bit(Data >> 5); - b = pal5bit(Data >> 10); - - r = (r * brt) / 100; - g = (g * brt) / 100; - b = (b * brt) / 100; - - DrvPalette[i] = BurnHighCol(r, g, b, 0); -} - -static void PaletteDim(INT32 dimslayer) -{ - INT32 i, dim, en, cb, ce, brt; - - dim = dim_v | ((~dim_c & 0x10) >> 1); - en = (K053251GetPriority(5) && K053251GetPriority(5) != 0x3e); - - brt = 100; - if (en) brt -= 40*dim/8; - - if (brt < 100) { - cb = LayerColourBase[dimslayer] << 4; - ce = cb + 128; - - for (i = 0; i < cb; i++) - BlswhstlCalcPaletteWithContrast(i, brt); - - for (i = cb; i < ce; i++) // text - BlswhstlCalcPaletteWithContrast(i, 100); - - for (i = ce; i < 2048; i++) - BlswhstlCalcPaletteWithContrast(i, brt); - } else { - BlswhstlCalcPalette(); - } -} - -static void BlswhstlDraw() -{ - INT32 Layer[3]; - - K052109UpdateScroll(); - - INT32 BGColourBase = K053251GetPaletteIndex(0); - SpriteColourBase = K053251GetPaletteIndex(1); - LayerColourBase[0] = K053251GetPaletteIndex(2); - LayerColourBase[1] = K053251GetPaletteIndex(4); - LayerColourBase[2] = K053251GetPaletteIndex(3); - - LayerPri[0] = K053251GetPriority(2); - LayerPri[1] = K053251GetPriority(4); - LayerPri[2] = K053251GetPriority(3); - Layer[0] = 0; - Layer[1] = 1; - Layer[2] = 2; - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 16 * BGColourBase; - } - - sortlayers(Layer, LayerPri); - - PaletteDim(Layer[2]); - - K053245SpritesRender(0, DrvSprites, 3); - if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 0, DrvTiles); - K053245SpritesRender(0, DrvSprites, 2); - if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, DrvTiles); - K053245SpritesRender(0, DrvSprites, 1); - K053245SpritesRender(0, DrvSprites, 0); - if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, DrvTiles); - - KonamiBlendCopy(Palette, DrvPalette); -} - -static INT32 Thndrx2Draw() -{ - INT32 Layer[3]; - - BlswhstlCalcPalette(); - K052109UpdateScroll(); - - INT32 BGColourBase = K053251GetPaletteIndex(0); - SpriteColourBase = K053251GetPaletteIndex(1); - LayerColourBase[0] = K053251GetPaletteIndex(2); - LayerColourBase[1] = K053251GetPaletteIndex(4); - LayerColourBase[2] = K053251GetPaletteIndex(3); - - LayerPri[0] = K053251GetPriority(2); - LayerPri[1] = K053251GetPriority(4); - LayerPri[2] = K053251GetPriority(3); - Layer[0] = 0; - Layer[1] = 1; - Layer[2] = 2; - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 16 * BGColourBase; - } - - sortlayers(Layer, LayerPri); - - if (nSpriteEnable & 8) K051960SpritesRender(DrvSprites, 3); - if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 0, DrvTiles); - if (nSpriteEnable & 4) K051960SpritesRender(DrvSprites, 2); - if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, DrvTiles); - if (nSpriteEnable & 2) K051960SpritesRender(DrvSprites, 1); - if (nSpriteEnable & 1) K051960SpritesRender(DrvSprites, 0); - if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, DrvTiles); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 PunkshotDraw() -{ - INT32 Layer[3]; - - BlswhstlCalcPalette(); - K052109UpdateScroll(); - -// INT32 BGColourBase = K053251GetPaletteIndex(0); - SpriteColourBase = K053251GetPaletteIndex(1); - LayerColourBase[0] = K053251GetPaletteIndex(2); - LayerColourBase[1] = K053251GetPaletteIndex(4); - LayerColourBase[2] = K053251GetPaletteIndex(3); - - LayerPri[0] = K053251GetPriority(2); - LayerPri[1] = K053251GetPriority(4); - LayerPri[2] = K053251GetPriority(3); - Layer[0] = 0; - Layer[1] = 1; - Layer[2] = 2; - - sortlayers(Layer, LayerPri); - -// if (nSpriteEnable & 8) K051960SpritesRender(DrvSprites, 3); // not sure... - if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 1, DrvTiles); - if (nSpriteEnable & 4) K051960SpritesRender(DrvSprites, 2); - if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, DrvTiles); - if (nSpriteEnable & 2) K051960SpritesRender(DrvSprites, 1); - if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, DrvTiles); - if (nSpriteEnable & 1) K051960SpritesRender(DrvSprites, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static void RenderTitleSample(INT16 *pSoundBuf, INT32 nLength) -{ - double Addr = TitleSamplePos; - double Step = (double)20000 / nBurnSoundRate; - - for (INT32 i = 0; i < nLength; i += 2) { - if (Addr > 0x3ffff) break; - INT16 Sample = DrvTitleSample[(INT32)Addr]; - - INT16 nLeftSample = 0, nRightSample = 0; - - if ((TitleSampleOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { - nLeftSample += (INT32)(Sample * TitleSampleGain); - } - if ((TitleSampleOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { - nRightSample += (INT32)(Sample * TitleSampleGain); - } - - pSoundBuf[i + 0] += nLeftSample; - pSoundBuf[i + 1] += nRightSample; - - Addr += Step; - } - - TitleSamplePos = Addr; -} - -static INT32 TmntFrame() -{ - INT32 nInterleave = nBurnSoundLen; - INT32 nSoundBufferPos = 0; - - if (DrvReset) TmntDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 8000000 / 60; - nCyclesTotal[1] = 3579545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1) && bIrqEnable) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - UPD7759Update(0, pSoundBuf, nSegmentLength); - if (PlayTitleSample) RenderTitleSample(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - UPD7759Update(0, pSoundBuf, nSegmentLength); - if (PlayTitleSample) RenderTitleSample(pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) TmntDraw(); - - return 0; -} - -static INT32 MiaFrame() -{ - INT32 nInterleave = nBurnSoundLen; - INT32 nSoundBufferPos = 0; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 8000000 / 60; - nCyclesTotal[1] = 3579545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1) && bIrqEnable) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) TmntDraw(); - - return 0; -} - -static INT32 CuebrickFrame() -{ - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - - if (DrvReset) CuebrickDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 8000000 / 60; - nCyclesDone[0] = 0; - - SekNewFrame(); - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1) && bIrqEnable) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - if (CuebrickSndIrqFire) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - } - - SekClose(); - - if (pBurnDraw) TmntDraw(); - - return 0; -} - -static INT32 BlswhstlFrame() -{ - INT32 nInterleave = 32; - INT32 nSoundBufferPos = 0; - - if (DrvReset) BlswhstlDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 16000000 / 60; - nCyclesTotal[1] = 3579545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1) && K052109_irq_enabled) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) BlswhstlDraw(); - - K053245ClearBuffer(0); - - return 0; -} - -static INT32 SsridersFrame() -{ - INT32 nInterleave = 262; - INT32 nSoundBufferPos = 0; - - if (DrvReset) SsridersDoReset(); - - SsridersMakeInputs(); - - nCyclesTotal[0] = 16000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 19) DrvVBlank = 0; - if (i == 243) DrvVBlank = 1; - if (i == 243 && K052109_irq_enabled) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) BlswhstlDraw(); - - return 0; -} - -static INT32 Thndrx2Frame() -{ - INT32 nInterleave = 100; - INT32 nSoundBufferPos = 0; - - if (DrvReset) SsridersDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 12000000 / 60; - nCyclesTotal[1] = 3579545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - // Run Z80 - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K052109_irq_enabled) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) Thndrx2Draw(); - - return 0; -} - -static INT32 LgtnfghtFrame() -{ - INT32 nInterleave = 100; - INT32 nSoundBufferPos = 0; - - if (DrvReset) SsridersDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 12000000 / 60; - nCyclesTotal[1] = 3579545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - // Run Z80 - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K052109_irq_enabled) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) BlswhstlDraw(); - - return 0; -} - -static INT32 Tmnt2Frame() -{ - INT32 nInterleave = 262; - INT32 nSoundBufferPos = 0; - - if (DrvReset) SsridersDoReset(); - - SsridersMakeInputs(); - - nCyclesTotal[0] = 16000000 / 60; - nCyclesTotal[1] = 8000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 19) DrvVBlank = 0; - if (i == 243) DrvVBlank = 1; - if (i == 243 && K052109_irq_enabled) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) BlswhstlDraw(); - - return 0; -} - -static INT32 PunkshotFrame() -{ - INT32 nInterleave = 256; - INT32 nSoundBufferPos = 0; - - if (DrvReset) PunkshotDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 12000000 / 60; - nCyclesTotal[1] = 3579545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - // Run Z80 - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (K052109_irq_enabled) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) PunkshotDraw(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029693; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - KonamiICScan(nAction); - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - - BurnYM2151Scan(nAction); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(DrvDip); - SCAN_VAR(DrvInput); - SCAN_VAR(bIrqEnable); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(TitleSoundLatch); - SCAN_VAR(PlayTitleSample); - SCAN_VAR(TitleSamplePos); - SCAN_VAR(PriorityFlag); - } - - return 0; -} - -static INT32 TmntScan(INT32 nAction, INT32 *pnMin) -{ - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - K007232Scan(nAction, pnMin); - UPD7759Scan(0, nAction, pnMin); - } - - return DrvScan(nAction, pnMin); -} - -static INT32 MiaScan(INT32 nAction, INT32 *pnMin) -{ - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - K007232Scan(nAction, pnMin); - } - - return DrvScan(nAction, pnMin); -} - -static INT32 CuebrickScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (nAction & ACB_NVRAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = DrvNvRam; - ba.nLen = 0x400 * 0x20; - ba.szName = "NV RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - KonamiICScan(nAction); - SCAN_VAR(CuebrickSndIrqFire); - } - - return DrvScan(nAction, pnMin); -} - -static INT32 BlswhstlScan(INT32 nAction, INT32 *pnMin) -{ - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - K053260Scan(nAction); - - SCAN_VAR(InitEEPROMCount); - } - - EEPROMScan(nAction, pnMin); - - return DrvScan(nAction, pnMin); -} - -static INT32 SsridersScan(INT32 nAction, INT32 *pnMin) -{ - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - K053260Scan(nAction); - - SCAN_VAR(InitEEPROMCount); - SCAN_VAR(DrvVBlank); - } - - EEPROMScan(nAction, pnMin); - - return DrvScan(nAction, pnMin); -} - -static INT32 Thndrx2aScan(INT32 nAction, INT32 *pnMin) -{ - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - K053260Scan(nAction); - } - - return DrvScan(nAction, pnMin); -} - -struct BurnDriver BurnDrvTmnt = { - "tmnt", NULL, NULL, NULL, "1989", - "Teenage Mutant Ninja Turtles (World 4 Players)\0", NULL, "Konami", "GX963", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, TmntRomInfo, TmntRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, - TmntInit, TmntExit, TmntFrame, NULL, TmntScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmntu = { - "tmntu", "tmnt", NULL, NULL, "1989", - "Teenage Mutant Ninja Turtles (US 4 Players, set 1)\0", NULL, "Konami", "GX963", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, TmntuRomInfo, TmntuRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, - TmntInit, TmntExit, TmntFrame, NULL, TmntScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmntua = { - "tmntua", "tmnt", NULL, NULL, "1989", - "Teenage Mutant Ninja Turtles (US 4 Players, set 2)\0", NULL, "Konami", "GX963", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, TmntuaRomInfo, TmntuaRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, - TmntInit, TmntExit, TmntFrame, NULL, TmntScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmht = { - "tmht", "tmnt", NULL, NULL, "1989", - "Teenage Mutant Hero Turtles (UK 4 Players, set 1)\0", NULL, "Konami", "GX963", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, TmhtRomInfo, TmhtRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, - TmntInit, TmntExit, TmntFrame, NULL, TmntScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmhta = { - "tmhta", "tmnt", NULL, NULL, "1989", - "Teenage Mutant Hero Turtles (UK 4 Players, set 2)\0", NULL, "Konami", "GX963", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, TmhtaRomInfo, TmhtaRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, - TmntInit, TmntExit, TmntFrame, NULL, TmntScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmntj = { - "tmntj", "tmnt", NULL, NULL, "1990", - "Teenage Mutant Ninja Turtles (Japan 4 Players)\0", NULL, "Konami", "GX963", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, TmntjRomInfo, TmntjRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, - TmntInit, TmntExit, TmntFrame, NULL, TmntScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmht2p = { - "tmht2p", "tmnt", NULL, NULL, "1989", - "Teenage Mutant Hero Turtles (UK 2 Players, set 1)\0", NULL, "Konami", "GX963", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, Tmht2pRomInfo, Tmht2pRomName, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo, - TmntInit, TmntExit, TmntFrame, NULL, TmntScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmht2pa = { - "tmht2pa", "tmnt", NULL, NULL, "1989", - "Teenage Mutant Hero Turtles (UK 2 Players, set 2)\0", NULL, "Konami", "GX963", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, Tmht2paRomInfo, Tmht2paRomName, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo, - TmntInit, TmntExit, TmntFrame, NULL, TmntScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmht2pj = { - "tmnt2pj", "tmnt", NULL, NULL, "1990", - "Teenage Mutant Ninja Turtles (Japan 2 Players)\0", NULL, "Konami", "GX963", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, Tmnt2pjRomInfo, Tmnt2pjRomName, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo, - TmntInit, TmntExit, TmntFrame, NULL, TmntScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmht2po = { - "tmnt2po", "tmnt", NULL, NULL, "1989", - "Teenage Mutant Ninja Turtles (Oceania 2 Players)\0", NULL, "Konami", "GX963", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, Tmnt2poRomInfo, Tmnt2poRomName, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo, - TmntInit, TmntExit, TmntFrame, NULL, TmntScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMia = { - "mia", NULL, NULL, NULL, "1989", - "M.I.A. - Missing in Action (ver. T)\0", NULL, "Konami", "GX808", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, MiaRomInfo, MiaRomName, NULL, NULL, MiaInputInfo, MiaDIPInfo, - MiaInit, MiaExit, MiaFrame, NULL, MiaScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMia2 = { - "mia2", "mia", NULL, NULL, "1989", - "M.I.A. - Missing in Action (ver. S)\0", NULL, "Konami", "GX808", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, Mia2RomInfo, Mia2RomName, NULL, NULL, MiaInputInfo, MiaDIPInfo, - MiaInit, MiaExit, MiaFrame, NULL, MiaScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvCuebrick = { - "cuebrick", NULL, NULL, NULL, "1989", - "Cue Brick (World ver. D)\0", NULL, "Konami", "GX903", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_PUZZLE, 0, - NULL, CuebrickRomInfo, CuebrickRomName, NULL, NULL, MiaInputInfo, MiaDIPInfo, - CuebrickInit, CommonExit, CuebrickFrame, NULL, CuebrickScan, - NULL, 0x400, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBlswhstl = { - "blswhstl", NULL, NULL, NULL, "1991", - "Bells & Whistles (ver. L)\0", NULL, "Konami", "GX060", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, - NULL, BlswhstlRomInfo, BlswhstlRomName, NULL, NULL, BlswhstlInputInfo, NULL, - BlswhstlInit, BlswhstlExit, BlswhstlFrame, NULL, BlswhstlScan, - NULL, 0x810, 224, 280, 3, 4 -}; - -struct BurnDriver BurnDrvDetatwin = { - "detatwin", "blswhstl", NULL, NULL, "1991", - "Detana!! Twin Bee (Japan ver. J)\0", NULL, "Konami", "GX060", - L"\u51FA\u305F\u306A!! Twin Bee \u30C4\u30A4\u30F3\u30D3\u30FC (Japan ver. J)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, - NULL, DetatwinRomInfo, DetatwinRomName, NULL, NULL, BlswhstlInputInfo, NULL, - BlswhstlInit, BlswhstlExit, BlswhstlFrame, NULL, BlswhstlScan, - NULL, 0x810, 224, 280, 3, 4 -}; - -struct BurnDriver BurnDrvSsriders = { - "ssriders", NULL, NULL, NULL, "1991", - "Sunset Riders (4 Players ver. EAC)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, SsridersRomInfo, SsridersRomName, NULL, NULL, Ssriders4pInputInfo, NULL, - SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsridersebd = { - "ssridersebd", "ssriders", NULL, NULL, "1991", - "Sunset Riders (2 Players ver. EBD)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, SsridersebdRomInfo, SsridersebdRomName, NULL, NULL, SsridersInputInfo, NULL, - SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsridersebc = { - "ssridersebc", "ssriders", NULL, NULL, "1991", - "Sunset Riders (2 Players ver. EBC)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, SsridersebcRomInfo, SsridersebcRomName, NULL, NULL, SsridersInputInfo, NULL, - SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsridersuda = { - "ssridersuda", "ssriders", NULL, NULL, "1991", - "Sunset Riders (4 Players ver. UDA)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, SsridersudaRomInfo, SsridersudaRomName, NULL, NULL, Ssriders4psInputInfo, NULL, - SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsriderseaa = { - "ssriderseaa", "ssriders", NULL, NULL, "1991", - "Sunset Riders (4 Players ver. EAA)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, SsriderseaaRomInfo, SsriderseaaRomName, NULL, NULL, Ssriders4psInputInfo, NULL, - SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsridersuac = { - "ssridersuac", "ssriders", NULL, NULL, "1991", - "Sunset Riders (4 Players ver. UAC)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, SsridersuacRomInfo, SsridersuacRomName, NULL, NULL, Ssriders4pInputInfo, NULL, - SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsridersubc = { - "ssridersubc", "ssriders", NULL, NULL, "1991", - "Sunset Riders (2 Players ver. UBC)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, SsridersubcRomInfo, SsridersubcRomName, NULL, NULL, SsridersInputInfo, NULL, - SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsridersabd = { - "ssridersabd", "ssriders", NULL, NULL, "1991", - "Sunset Riders (2 Players ver. ABD)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, SsridersabdRomInfo, SsridersabdRomName, NULL, NULL, SsridersInputInfo, NULL, - SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsridersadd = { - "ssridersadd", "ssriders", NULL, NULL, "1991", - "Sunset Riders (4 Players ver. ADD)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, SsridersaddRomInfo, SsridersaddRomName, NULL, NULL, Ssriders4psInputInfo, NULL, - SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsridersjbd = { - "ssridersjbd", "ssriders", NULL, NULL, "1991", - "Sunset Riders (2 Players ver. JBD)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, SsridersjbdRomInfo, SsridersjbdRomName, NULL, NULL, SsridersInputInfo, NULL, - SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -static INT32 SsridersbInit() -{ - return 1; -} - -struct BurnDriverD BurnDrvSsridersb = { - "ssridersb", "ssriders", NULL, NULL, "1991", - "Sunset Riders (bootleg 4 Players ver. ADD)\0", NULL, "Konami", "GX064", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, - NULL, ssridersbRomInfo, ssridersbRomName, NULL, NULL, Ssriders4psInputInfo, NULL, - SsridersbInit, CommonExit, SsridersFrame, NULL, SsridersScan, - NULL, 0x810, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvThndrx2 = { - "thndrx2", NULL, NULL, NULL, "1991", - "Thunder Cross II (World)\0", NULL, "Konami", "GX073", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_HORSHOOT, 0, - NULL, thndrx2RomInfo, thndrx2RomName, NULL, NULL, Thndrx2InputInfo, NULL, - Thndrx2Init, BlswhstlExit, Thndrx2Frame, NULL, Thndrx2aScan, - NULL, 0x800, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvThndrx2a = { - "thndrx2a", "thndrx2", NULL, NULL, "1991", - "Thunder Cross II (Asia)\0", NULL, "Konami", "GX073", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_HORSHOOT, 0, - NULL, thndrx2aRomInfo, thndrx2aRomName, NULL, NULL, Thndrx2InputInfo, NULL, - Thndrx2Init, BlswhstlExit, Thndrx2Frame, NULL, Thndrx2aScan, - NULL, 0x800, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvThndrx2j = { - "thndrx2j", "thndrx2", NULL, NULL, "1991", - "Thunder Cross II (Japan)\0", NULL, "Konami", "GX073", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_HORSHOOT, 0, - NULL, thndrx2jRomInfo, thndrx2jRomName, NULL, NULL, Thndrx2InputInfo, NULL, - Thndrx2Init, BlswhstlExit, Thndrx2Frame, NULL, Thndrx2aScan, - NULL, 0x800, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvLgtnfght = { - "lgtnfght", NULL, NULL, NULL, "1990", - "Lightning Fighters (World)\0", NULL, "Konami", "GX939", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, - NULL, lgtnfghtRomInfo, lgtnfghtRomName, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo, - LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, NULL, Thndrx2aScan, - NULL, 0x800, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvLgtnfghtu = { - "lgtnfghtu", "lgtnfght", NULL, NULL, "1990", - "Lightning Fighters (US)\0", NULL, "Konami", "GX939", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, - NULL, lgtnfghtuRomInfo, lgtnfghtuRomName, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo, - LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, NULL, Thndrx2aScan, - NULL, 0x800, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvLgtnfghta = { - "lgtnfghta", "lgtnfght", NULL, NULL, "1990", - "Lightning Fighters (Asia)\0", NULL, "Konami", "GX939", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, - NULL, lgtnfghtaRomInfo, lgtnfghtaRomName, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo, - LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, NULL, Thndrx2aScan, - NULL, 0x800, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvTrigon = { - "trigon", "lgtnfght", NULL, NULL, "1990", - "Trigon (Japan)\0", NULL, "Konami", "GX939", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, - NULL, trigonRomInfo, trigonRomName, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo, - LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, NULL, Thndrx2aScan, - NULL, 0x800, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvTmnt2 = { - "tmnt2", NULL, NULL, NULL, "1991", - "Teenage Mutant Ninja Turtles - Turtles in Time (4 Players ver. UAA)\0", NULL, "Konami", "GX063", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, tmnt2RomInfo, tmnt2RomName, NULL, NULL, Ssriders4pInputInfo, NULL, - Tmnt2Init, BlswhstlExit, Tmnt2Frame, NULL, SsridersScan, - NULL, 0x800, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmnt22pu = { - "tmnt22pu", "tmnt2", NULL, NULL, "1991", - "Teenage Mutant Ninja Turtles - Turtles in Time (2 Players ver. UDA)\0", NULL, "Konami", "GX063", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, tmnt22puRomInfo, tmnt22puRomName, NULL, NULL, SsridersInputInfo, NULL, - Tmnt2Init, BlswhstlExit, Tmnt2Frame, NULL, SsridersScan, - NULL, 0x800, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmht22pe = { - "tmht22pe", "tmnt2", NULL, NULL, "1991", - "Teenage Mutant Hero Turtles - Turtles in Time (2 Players ver. EBA)\0", NULL, "Konami", "GX063", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, tmht22peRomInfo, tmht22peRomName, NULL, NULL, SsridersInputInfo, NULL, - Tmnt2Init, BlswhstlExit, Tmnt2Frame, NULL, SsridersScan, - NULL, 0x800, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTmnt2a = { - "tmnt2a", "tmnt2", NULL, NULL, "1991", - "Teenage Mutant Ninja Turtles - Turtles in Time (4 Players ver. ADA)\0", NULL, "Konami", "GX063", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, - NULL, tmnt2aRomInfo, tmnt2aRomName, NULL, NULL, Ssriders4psInputInfo, NULL, - Tmnt2Init, BlswhstlExit, Tmnt2Frame, NULL, SsridersScan, - NULL, 0x800, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQgakumon = { - "qgakumon", NULL, NULL, NULL, "1993", - "Quiz Gakumon no Susume (Japan ver. JA1 Type H)\0", NULL, "Konami", "GX248", - L"\u30AF\u30A4\u30BA \u5B66\u554F\u30CE\u30B9\u30B9\u30E1 Gakumon no Susume (Japan ver. JA1 Type H)\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_QUIZ, 0, - NULL, qgakumonRomInfo, qgakumonRomName, NULL, NULL, QgakumonInputInfo, NULL, - QgakumonInit, BlswhstlExit, Tmnt2Frame, NULL, SsridersScan, - NULL, 0x800, 304, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPunkshot = { - "punkshot", NULL, NULL, NULL, "1990", - "Punk Shot (US 4 Players)\0", NULL, "Konami", "GX907", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_SPORTSMISC, 0, - NULL, punkshotRomInfo, punkshotRomName, NULL, NULL, PunkshotInputInfo, PunkshotDIPInfo, - PunkshotInit, PunkshotExit, PunkshotFrame, NULL, Thndrx2aScan, - NULL, 0x800, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPunkshot2 = { - "punkshot2", "punkshot", NULL, NULL, "1990", - "Punk Shot (US 2 Players)\0", NULL, "Konami", "GX907", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SPORTSMISC, 0, - NULL, punkshot2RomInfo, punkshot2RomName, NULL, NULL, Punkshot2InputInfo, Punkshot2DIPInfo, - PunkshotInit, PunkshotExit, PunkshotFrame, NULL, Thndrx2aScan, - NULL, 0x800, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPunkshotj = { - "punkshotj", "punkshot", NULL, NULL, "1990", - "Punk Shot (Japan 2 Players)\0", NULL, "Konami", "GX907", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SPORTSMISC, 0, - NULL, punkshotjRomInfo, punkshotjRomName, NULL, NULL, Punkshot2InputInfo, PunkshotjDIPInfo, - PunkshotInit, PunkshotExit, PunkshotFrame, NULL, Thndrx2aScan, - NULL, 0x800, 288, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" +#include "upd7759.h" +#include "k007232.h" +#include "k053260.h" +#include "eeprom.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort4[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort5[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[3] = {0, 0, 0}; +static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Drv68KRom = NULL; +static UINT8 *Drv68KRam = NULL; +static UINT8 *DrvZ80Rom = NULL; +static UINT8 *DrvZ80Ram = NULL; +static UINT8 *DrvSoundRom = NULL; +static UINT8 *DrvUPD7759CRom = NULL; +static UINT8 *DrvTileRom = NULL; +static UINT8 *DrvSpriteRom = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvPaletteRam = NULL; +static UINT8 *DrvNvRam = NULL; +static UINT8 *DrvTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *Palette; +static UINT32 *DrvPalette = NULL; +static INT16 *DrvTitleSample = NULL; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static UINT8 bIrqEnable; +static INT32 LayerColourBase[3]; +static INT32 SpriteColourBase; +static INT32 LayerPri[3]; +static UINT8 DrvSoundLatch; +static INT32 PriorityFlag; + +static INT32 dim_c, dim_v; + +static INT32 DrvNvRamBank; +static INT32 CuebrickSndIrqFire; +static INT32 BlswhstlTileRomBank; + +static INT32 TitleSoundLatch; +static INT32 PlayTitleSample; +static double TitleSamplePos = 0; +static double TitleSampleGain; +static INT32 TitleSampleOutputDir; + +static UINT8 DrvVBlank; + +static INT32 InitEEPROMCount; + +static const eeprom_interface BlswhstlEEPROMInterface = +{ + 7, + 8, + "011000", + "011100", + 0, + "0100000000000", + "0100110000000", + 0, + 0 +}; + +static const eeprom_interface thndrx2_eeprom_interface = +{ + 7, + 8, + "011000", + "010100", + 0, + "0100000000000", + "0100110000000", + 0, + 0 +}; + +static struct BurnInputInfo TmntInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, + {"Coin 3" , BIT_DIGITAL , DrvInputPort0 + 2, "p3 coin" }, + {"Coin 4" , BIT_DIGITAL , DrvInputPort0 + 3, "p4 coin" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"P3 Up" , BIT_DIGITAL , DrvInputPort3 + 2, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , DrvInputPort3 + 3, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , DrvInputPort3 + 0, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , DrvInputPort3 + 1, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , DrvInputPort3 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , DrvInputPort3 + 5, "p3 fire 2" }, + + {"P4 Up" , BIT_DIGITAL , DrvInputPort4 + 2, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , DrvInputPort4 + 3, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , DrvInputPort4 + 0, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , DrvInputPort4 + 1, "p4 right" }, + {"P4 Fire 1" , BIT_DIGITAL , DrvInputPort4 + 4, "p4 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , DrvInputPort4 + 5, "p4 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service 1" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, + {"Service 2" , BIT_DIGITAL , DrvInputPort0 + 5, "service2" }, + {"Service 3" , BIT_DIGITAL , DrvInputPort0 + 6, "service3" }, + {"Service 4" , BIT_DIGITAL , DrvInputPort0 + 7, "service4" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Tmnt) + +static struct BurnInputInfo Tmnt2pInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service 1" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, + {"Service 2" , BIT_DIGITAL , DrvInputPort0 + 5, "service2" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Tmnt2p) + +static struct BurnInputInfo MiaInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 4, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Mia) + +static struct BurnInputInfo BlswhstlInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 2, "service" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort0 + 3, "diag" }, +}; + +STDINPUTINFO(Blswhstl) + +static struct BurnInputInfo Ssriders4pInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, + {"Coin 3" , BIT_DIGITAL , DrvInputPort0 + 2, "p3 coin" }, + {"Coin 4" , BIT_DIGITAL , DrvInputPort0 + 3, "p4 coin" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"P3 Up" , BIT_DIGITAL , DrvInputPort3 + 2, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , DrvInputPort3 + 3, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , DrvInputPort3 + 0, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , DrvInputPort3 + 1, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , DrvInputPort3 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , DrvInputPort3 + 5, "p3 fire 2" }, + + {"P4 Up" , BIT_DIGITAL , DrvInputPort4 + 2, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , DrvInputPort4 + 3, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , DrvInputPort4 + 0, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , DrvInputPort4 + 1, "p4 right" }, + {"P4 Fire 1" , BIT_DIGITAL , DrvInputPort4 + 4, "p4 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , DrvInputPort4 + 5, "p4 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service 1" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, + {"Service 2" , BIT_DIGITAL , DrvInputPort0 + 5, "service2" }, + {"Service 3" , BIT_DIGITAL , DrvInputPort0 + 6, "service3" }, + {"Service 4" , BIT_DIGITAL , DrvInputPort0 + 7, "service4" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort5 + 7, "diag" }, +}; + +STDINPUTINFO(Ssriders4p) + +static struct BurnInputInfo SsridersInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service 1" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, + {"Service 2" , BIT_DIGITAL , DrvInputPort0 + 5, "service2" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort5 + 7, "diag" }, +}; + +STDINPUTINFO(Ssriders) + +static struct BurnInputInfo Ssriders4psInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 start" }, + {"Coin 3" , BIT_DIGITAL , DrvInputPort0 + 2, "p3 coin" }, + {"Start 3" , BIT_DIGITAL , DrvInputPort3 + 7, "p3 start" }, + {"Coin 4" , BIT_DIGITAL , DrvInputPort0 + 3, "p4 coin" }, + {"Start 4" , BIT_DIGITAL , DrvInputPort4 + 7, "p4 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"P3 Up" , BIT_DIGITAL , DrvInputPort3 + 2, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , DrvInputPort3 + 3, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , DrvInputPort3 + 0, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , DrvInputPort3 + 1, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , DrvInputPort3 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , DrvInputPort3 + 5, "p3 fire 2" }, + + {"P4 Up" , BIT_DIGITAL , DrvInputPort4 + 2, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , DrvInputPort4 + 3, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , DrvInputPort4 + 0, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , DrvInputPort4 + 1, "p4 right" }, + {"P4 Fire 1" , BIT_DIGITAL , DrvInputPort4 + 4, "p4 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , DrvInputPort4 + 5, "p4 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service 1" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, + {"Service 2" , BIT_DIGITAL , DrvInputPort0 + 5, "service2" }, + {"Service 3" , BIT_DIGITAL , DrvInputPort0 + 6, "service3" }, + {"Service 4" , BIT_DIGITAL , DrvInputPort0 + 7, "service4" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort5 + 7, "diag" }, +}; + +STDINPUTINFO(Ssriders4ps) + +static struct BurnInputInfo Thndrx2InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvInputPort1 + 0, "p1 coin" }, + + {"P1 Start", BIT_DIGITAL, DrvInputPort0 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvInputPort0 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvInputPort0 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvInputPort0 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvInputPort0 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvInputPort0 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvInputPort1 + 1, "p2 coin" }, + + {"P2 Start", BIT_DIGITAL, DrvInputPort2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvInputPort2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvInputPort2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvInputPort2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvInputPort2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvInputPort1 + 2, "service" }, + {"Diagnostics", BIT_DIGITAL, DrvInputPort1 + 3, "diag" }, +}; + +STDINPUTINFO(Thndrx2) + +static struct BurnInputInfo LgtnfghtInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvInputPort0 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvInputPort0 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvInputPort1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvInputPort1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvInputPort1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvInputPort1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvInputPort1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvInputPort1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvInputPort0 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvInputPort0 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvInputPort2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvInputPort2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvInputPort2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvInputPort2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvInputPort2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvInputPort0 + 6, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDip + 2, "dip" }, +}; + +STDINPUTINFO(Lgtnfght) + +static struct BurnInputInfo QgakumonInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvInputPort0 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvInputPort1 + 7, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvInputPort1 + 2, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvInputPort1 + 3, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvInputPort1 + 0, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvInputPort1 + 1, "p1 fire 4" }, + {"P1 Push", BIT_DIGITAL, DrvInputPort1 + 4, "p1 fire 5" }, + + {"P2 Coin", BIT_DIGITAL, DrvInputPort0 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvInputPort2 + 7, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 2, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 3, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvInputPort2 + 0, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, DrvInputPort2 + 1, "p2 fire 4" }, + {"P2 Push", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 5" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvInputPort0 + 4, "service" }, + {"Diagnostics", BIT_DIGITAL, DrvInputPort5 + 7, "diag" }, +}; + +STDINPUTINFO(Qgakumon) + +static struct BurnInputInfo PunkshotInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvInputPort0 + 0, "p1 coin" }, + {"P1 Up", BIT_DIGITAL, DrvInputPort1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvInputPort1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvInputPort1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvInputPort1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvInputPort1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvInputPort0 + 1, "p2 coin" }, + {"P2 Up", BIT_DIGITAL, DrvInputPort2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvInputPort2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvInputPort2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvInputPort2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 5, "p2 fire 2" }, + + {"P3 Coin", BIT_DIGITAL, DrvInputPort0 + 2, "p3 coin" }, + {"P3 Up", BIT_DIGITAL, DrvInputPort3 + 2, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvInputPort3 + 3, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvInputPort3 + 0, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvInputPort3 + 1, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvInputPort3 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvInputPort3 + 5, "p3 fire 2" }, + + {"P4 Coin", BIT_DIGITAL, DrvInputPort0 + 3, "p4 coin" }, + {"P4 Up", BIT_DIGITAL, DrvInputPort4 + 2, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvInputPort4 + 3, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvInputPort4 + 0, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvInputPort4 + 1, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvInputPort4 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvInputPort4 + 5, "p4 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service 1", BIT_DIGITAL, DrvInputPort0 + 4, "service" }, + {"Service 2", BIT_DIGITAL, DrvInputPort0 + 5, "service2" }, + {"Service 3", BIT_DIGITAL, DrvInputPort0 + 6, "service3" }, + {"Service 4", BIT_DIGITAL, DrvInputPort0 + 7, "service4" }, + {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDip + 2, "dip" }, +}; + +STDINPUTINFO(Punkshot) + +static struct BurnInputInfo Punkshot2InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvInputPort0 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvInputPort5 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvInputPort1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvInputPort1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvInputPort1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvInputPort1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvInputPort1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvInputPort0 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvInputPort5 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvInputPort2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvInputPort2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvInputPort2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvInputPort2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvInputPort0 + 4, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDip + 2, "dip" }, +}; + +STDINPUTINFO(Punkshot2) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = DrvInput[2] = DrvInput[3] = DrvInput[4] = DrvInput[5] = 0x00; + + // Compile Digital Inputs + for (int i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + DrvInput[3] |= (DrvInputPort3[i] & 1) << i; + DrvInput[4] |= (DrvInputPort4[i] & 1) << i; + DrvInput[5] |= (DrvInputPort5[i] & 1) << i; + } + + // Clear Opposites + DrvClearOpposites(&DrvInput[0]); + DrvClearOpposites(&DrvInput[1]); + DrvClearOpposites(&DrvInput[2]); + DrvClearOpposites(&DrvInput[3]); + DrvClearOpposites(&DrvInput[4]); +} + +static inline void SsridersMakeInputs() +{ + DrvMakeInputs(); + + DrvInput[5] ^= 0xf6; + //if (DrvInputPort5[7]) DrvInput[5] -= 0x80; +} + +static struct BurnDIPInfo TmntDIPList[]= +{ + // Default Values + {0x21, 0xff, 0xff, 0xff, NULL }, + {0x22, 0xff, 0xff, 0x5e, NULL }, + {0x23, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 16 , "Coinage" }, + {0x21, 0x01, 0x0f, 0x00, "5 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x21, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x21, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x21, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x21, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x21, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x21, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x21, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x21, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x22, 0x01, 0x03, 0x03, "1" }, + {0x22, 0x01, 0x03, 0x02, "2" }, + {0x22, 0x01, 0x03, 0x01, "3" }, + {0x22, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x22, 0x01, 0x60, 0x60, "Easy" }, + {0x22, 0x01, 0x60, 0x40, "Normal" }, + {0x22, 0x01, 0x60, 0x20, "Difficult" }, + {0x22, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x22, 0x01, 0x80, 0x80, "Off" }, + {0x22, 0x01, 0x80, 0x00, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x23, 0x01, 0x01, 0x01, "Off" }, + {0x23, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Test Mode" }, + {0x23, 0x01, 0x04, 0x04, "Off" }, + {0x23, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Tmnt) + +static struct BurnDIPInfo Tmnt2pDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0x5e, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x13, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x13, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x13, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x13, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15 , "Coin B" }, + {0x13, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x13, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x03, 0x03, "1" }, + {0x14, 0x01, 0x03, 0x02, "2" }, + {0x14, 0x01, 0x03, 0x01, "3" }, + {0x14, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x60, 0x60, "Easy" }, + {0x14, 0x01, 0x60, 0x40, "Normal" }, + {0x14, 0x01, 0x60, 0x20, "Difficult" }, + {0x14, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Test Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Tmnt2p) + +static struct BurnDIPInfo MiaDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x56, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x14, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 15 , "Coin B" }, + {0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x14, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x14, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x14, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x03, 0x03, "2" }, + {0x15, 0x01, 0x03, 0x02, "3" }, + {0x15, 0x01, 0x03, 0x01, "5" }, + {0x15, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x15, 0x01, 0x18, 0x18, "30k 80k" }, + {0x15, 0x01, 0x18, 0x10, "50k 100k" }, + {0x15, 0x01, 0x18, 0x08, "50k" }, + {0x15, 0x01, 0x18, 0x00, "100k" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Normal" }, + {0x15, 0x01, 0x60, 0x20, "Difficult" }, + {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "VRAM Character Check" }, + {0x16, 0x01, 0x02, 0x02, "Off" }, + {0x16, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Test Mode" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Mia) + +static struct BurnDIPInfo LgtnfghtDIPList[]= +{ + {0x14, 0xff, 0xff, 0x5e, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xfd, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x03, 0x03, "2" }, + {0x14, 0x01, 0x03, 0x02, "3" }, + {0x14, 0x01, 0x03, 0x01, "5" }, + {0x14, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x18, 0x18, "100000 400000" }, + {0x14, 0x01, 0x18, 0x10, "150000 500000" }, + {0x14, 0x01, 0x18, 0x08, "200000" }, + {0x14, 0x01, 0x18, 0x00, "None" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x60, 0x60, "Easy" }, + {0x14, 0x01, 0x60, 0x40, "Medium" }, + {0x14, 0x01, 0x60, 0x20, "Hard" }, + {0x14, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x15, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x15, 0x01, 0xf0, 0x00, "No Coin B" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Sound" }, + {0x16, 0x01, 0x02, 0x02, "Mono" }, + {0x16, 0x01, 0x02, 0x00, "Stereo" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Lgtnfght) + +static struct BurnDIPInfo PunkshotDIPList[]= +{ + {0x21, 0xff, 0xff, 0xff, NULL }, + {0x22, 0xff, 0xff, 0x7f, NULL }, + {0x23, 0xff, 0xff, 0xf0, NULL }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x21, 0x01, 0x0f, 0x00, "5 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x21, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x21, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x21, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x21, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x21, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x21, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x21, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x21, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x21, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x21, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 2, "Continue" }, + {0x21, 0x01, 0x10, 0x10, "Normal" }, + {0x21, 0x01, 0x10, 0x00, "1 Coin" }, + + {0 , 0xfe, 0 , 4, "Energy" }, + {0x22, 0x01, 0x03, 0x03, "30" }, + {0x22, 0x01, 0x03, 0x02, "40" }, + {0x22, 0x01, 0x03, 0x01, "50" }, + {0x22, 0x01, 0x03, 0x00, "60" }, + + {0 , 0xfe, 0 , 4, "Period Length" }, + {0x22, 0x01, 0x0c, 0x0c, "2 Minutes" }, + {0x22, 0x01, 0x0c, 0x08, "3 Minutes" }, + {0x22, 0x01, 0x0c, 0x04, "4 Minutes" }, + {0x22, 0x01, 0x0c, 0x00, "5 Minutes" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x22, 0x01, 0x60, 0x60, "Easy" }, + {0x22, 0x01, 0x60, 0x40, "Medium" }, + {0x22, 0x01, 0x60, 0x20, "Hard" }, + {0x22, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x22, 0x01, 0x80, 0x80, "Off" }, + {0x22, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x23, 0x01, 0x10, 0x10, "Off" }, + {0x23, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x23, 0x01, 0x40, 0x40, "Off" }, + {0x23, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x23, 0x01, 0x80, 0x80, "Off" }, + {0x23, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Punkshot) + +static struct BurnDIPInfo Punkshot2DIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x7f, NULL }, + {0x14, 0xff, 0xff, 0xf0, NULL }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x12, 0x01, 0x0f, 0x00, "5 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 2, "Continue" }, + {0x12, 0x01, 0x10, 0x10, "Normal" }, + {0x12, 0x01, 0x10, 0x00, "1 Coin" }, + + {0 , 0xfe, 0 , 4, "Energy" }, + {0x13, 0x01, 0x03, 0x03, "40" }, + {0x13, 0x01, 0x03, 0x02, "50" }, + {0x13, 0x01, 0x03, 0x01, "60" }, + {0x13, 0x01, 0x03, 0x00, "70" }, + + {0 , 0xfe, 0 , 4, "Period Length" }, + {0x13, 0x01, 0x0c, 0x0c, "3 Minutes" }, + {0x13, 0x01, 0x0c, 0x08, "4 Minutes" }, + {0x13, 0x01, 0x0c, 0x04, "5 Minutes" }, + {0x13, 0x01, 0x0c, 0x00, "6 Minutes" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Medium" }, + {0x13, 0x01, 0x60, 0x20, "Hard" }, + {0x13, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x10, 0x10, "Off" }, + {0x14, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Punkshot2) + +static struct BurnDIPInfo PunkshotjDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0x7f, NULL }, + {0x14, 0xff, 0xff, 0xf0, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x12, 0x01, 0xf0, 0x00, "No Coin B" }, + + {0 , 0xfe, 0 , 4, "Period Time" }, + {0x13, 0x01, 0x0c, 0x0c, "1 Minute" }, + {0x13, 0x01, 0x0c, 0x08, "2 Minutes" }, + {0x13, 0x01, 0x0c, 0x04, "3 Minutes" }, + {0x13, 0x01, 0x0c, 0x00, "4 Minutes" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x60, "Easy" }, + {0x13, 0x01, 0x60, 0x40, "Medium" }, + {0x13, 0x01, 0x60, 0x20, "Hard" }, + {0x13, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x10, 0x10, "Off" }, + {0x14, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Punkshotj) + +static struct BurnRomInfo TmntRomDesc[] = { + { "963-x23.j17", 0x020000, 0xa9549004, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "963-x24.k17", 0x020000, 0xe5cc9067, BRF_ESS | BRF_PRG }, // 1 + { "963-x21.j15", 0x010000, 0x5789cf92, BRF_ESS | BRF_PRG }, // 2 + { "963-x22.k15", 0x010000, 0x0a74e277, BRF_ESS | BRF_PRG }, // 3 + + { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles + { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 + + { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites + { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 + { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 + { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 + + { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs + { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 + + { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples + + { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples + + { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample +}; + +STD_ROM_PICK(Tmnt) +STD_ROM_FN(Tmnt) + +static struct BurnRomInfo TmntuRomDesc[] = { + { "963-r23.j17", 0x020000, 0xa7f61195, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "963-r24.k17", 0x020000, 0x661e056a, BRF_ESS | BRF_PRG }, // 1 + { "963-r21.j15", 0x010000, 0xde047bb6, BRF_ESS | BRF_PRG }, // 2 + { "963-r22.k15", 0x010000, 0xd86a0888, BRF_ESS | BRF_PRG }, // 3 + + { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles + { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 + + { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites + { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 + { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 + { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 + + { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs + { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 + + { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples + + { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples + + { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample +}; + +STD_ROM_PICK(Tmntu) +STD_ROM_FN(Tmntu) + +static struct BurnRomInfo TmntuaRomDesc[] = { + { "963-j23.j17", 0x020000, 0xf77314e2, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "963-j24.k17", 0x020000, 0x47f662d3, BRF_ESS | BRF_PRG }, // 1 + { "963-j21.j15", 0x010000, 0x7bee9fe8, BRF_ESS | BRF_PRG }, // 2 + { "963-j22.k15", 0x010000, 0x2efed09f, BRF_ESS | BRF_PRG }, // 3 + + { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles + { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 + + { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites + { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 + { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 + { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 + + { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs + { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 + + { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples + + { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples + + { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample +}; + +STD_ROM_PICK(Tmntua) +STD_ROM_FN(Tmntua) + +static struct BurnRomInfo TmhtRomDesc[] = { + { "963-f23.j17", 0x020000, 0x9cb5e461, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "963-f24.k17", 0x020000, 0x2d902fab, BRF_ESS | BRF_PRG }, // 1 + { "963-f21.j15", 0x010000, 0x9fa25378, BRF_ESS | BRF_PRG }, // 2 + { "963-f22.k15", 0x010000, 0x2127ee53, BRF_ESS | BRF_PRG }, // 3 + + { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles + { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 + + { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites + { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 + { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 + { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 + + { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs + { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 + + { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples + + { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples + + { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample +}; + +STD_ROM_PICK(Tmht) +STD_ROM_FN(Tmht) + +static struct BurnRomInfo TmhtaRomDesc[] = { + { "963-s23.j17", 0x020000, 0xb5af7eee, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "963-s24.k17", 0x020000, 0xbcb8ce8b, BRF_ESS | BRF_PRG }, // 1 + { "963-s21.j15", 0x010000, 0x0b88bfa6, BRF_ESS | BRF_PRG }, // 2 + { "963-s22.k15", 0x010000, 0x44ce6d4b, BRF_ESS | BRF_PRG }, // 3 + + { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles + { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 + + { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites + { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 + { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 + { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 + + { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs + { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 + + { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples + + { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples + + { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample +}; + +STD_ROM_PICK(Tmhta) +STD_ROM_FN(Tmhta) + +static struct BurnRomInfo TmntjRomDesc[] = { + { "963_223.j17", 0x020000, 0x0d34a5ff, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "963_224.k17", 0x020000, 0x2fd453f2, BRF_ESS | BRF_PRG }, // 1 + { "963_221.j15", 0x010000, 0xfa8e25fd, BRF_ESS | BRF_PRG }, // 2 + { "963_222.k15", 0x010000, 0xca437a4f, BRF_ESS | BRF_PRG }, // 3 + + { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles + { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 + + { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites + { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 + { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 + { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 + + { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs + { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 + + { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples + + { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples + + { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample +}; + +STD_ROM_PICK(Tmntj) +STD_ROM_FN(Tmntj) + +static struct BurnRomInfo Tmht2pRomDesc[] = { + { "963-u23.j17", 0x020000, 0x58bec748, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "963-u24.k17", 0x020000, 0xdce87c8d, BRF_ESS | BRF_PRG }, // 1 + { "963-u21.j15", 0x010000, 0xabce5ead, BRF_ESS | BRF_PRG }, // 2 + { "963-u22.k15", 0x010000, 0x4ecc8d6b, BRF_ESS | BRF_PRG }, // 3 + + { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles + { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 + + { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites + { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 + { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 + { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 + + { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs + { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 + + { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples + + { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples + + { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample +}; + +STD_ROM_PICK(Tmht2p) +STD_ROM_FN(Tmht2p) + +static struct BurnRomInfo Tmht2paRomDesc[] = { + { "963-_23.j17", 0x020000, 0x8698061a, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "963-_24.k17", 0x020000, 0x4036c075, BRF_ESS | BRF_PRG }, // 1 + { "963-_21.j15", 0x010000, 0xddcc979c, BRF_ESS | BRF_PRG }, // 2 + { "963-_22.k15", 0x010000, 0x71a38d27, BRF_ESS | BRF_PRG }, // 3 + + { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles + { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 + + { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites + { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 + { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 + { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 + + { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs + { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 + + { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples + + { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples + + { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample +}; + +STD_ROM_PICK(Tmht2pa) +STD_ROM_FN(Tmht2pa) + +static struct BurnRomInfo Tmnt2pjRomDesc[] = { + { "963-123.j17", 0x020000, 0x6a3527c9, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "963-124.k17", 0x020000, 0x2c4bfa15, BRF_ESS | BRF_PRG }, // 1 + { "963-121.j15", 0x010000, 0x4181b733, BRF_ESS | BRF_PRG }, // 2 + { "963-122.k15", 0x010000, 0xc64eb5ff, BRF_ESS | BRF_PRG }, // 3 + + { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles + { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 + + { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites + { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 + { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 + { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 + + { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs + { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 + + { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples + + { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples + + { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample +}; + +STD_ROM_PICK(Tmnt2pj) +STD_ROM_FN(Tmnt2pj) + +static struct BurnRomInfo Tmnt2poRomDesc[] = { + { "tmnt123.j17", 0x020000, 0x2d905183, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "tmnt124.k17", 0x020000, 0xe0125352, BRF_ESS | BRF_PRG }, // 1 + { "tmnt21.j15", 0x010000, 0x12deeafb, BRF_ESS | BRF_PRG }, // 2 + { "tmnt22.k15", 0x010000, 0xaec4f1c3, BRF_ESS | BRF_PRG }, // 3 + + { "963e20.g13", 0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "963a28.h27", 0x080000, 0xdb4769a8, BRF_GRA }, // 5 Tiles + { "963a29.k27", 0x080000, 0x8069cd2e, BRF_GRA }, // 6 + + { "963a17.h4", 0x080000, 0xb5239a44, BRF_GRA }, // 7 Sprites + { "963a18.h6", 0x080000, 0xdd51adef, BRF_GRA }, // 8 + { "963a15.k4", 0x080000, 0x1f324eed, BRF_GRA }, // 9 + { "963a16.k6", 0x080000, 0xd4bd9984, BRF_GRA }, // 10 + + { "963a30.g7", 0x000100, 0xabd82680, BRF_GRA }, // 11 PROMs + { "963a31.g19", 0x000100, 0xf8004a1c, BRF_GRA }, // 12 + + { "963a26.c13", 0x020000, 0xe2ac3063, BRF_SND }, // 13 K007232 Samples + + { "963a27.d18", 0x020000, 0x2dfd674b, BRF_SND }, // 14 UP7759C Samples + + { "963a25.d5", 0x080000, 0xfca078c7, BRF_SND }, // 15 Title Music Sample +}; + +STD_ROM_PICK(Tmnt2po) +STD_ROM_FN(Tmnt2po) + +static struct BurnRomInfo MiaRomDesc[] = { + { "808t20.h17", 0x020000, 0x6f0acb1d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "808t21.j17", 0x020000, 0x42a30416, BRF_ESS | BRF_PRG }, // 1 + + { "808e03.f4", 0x008000, 0x3d93a7cd, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "808e12.f28", 0x010000, 0xd62f1fde, BRF_GRA }, // 3 Tiles + { "808e13.h28", 0x010000, 0x1fa708f4, BRF_GRA }, // 4 + { "808e22.i28", 0x010000, 0x73d758f6, BRF_GRA }, // 5 + { "808e23.k28", 0x010000, 0x8ff08b21, BRF_GRA }, // 6 + + { "808d17.j4", 0x080000, 0xd1299082, BRF_GRA }, // 7 Sprites + { "808d15.h4", 0x080000, 0x2b22a6b6, BRF_GRA }, // 8 + + { "808a18.f16", 0x000100, 0xeb95aede, BRF_GRA }, // 9 PROMs + + { "808d01.d4", 0x020000, 0xfd4d37c0, BRF_SND }, // 10 K007232 Samples +}; + +STD_ROM_PICK(Mia) +STD_ROM_FN(Mia) + +static struct BurnRomInfo Mia2RomDesc[] = { + { "808s20.h17", 0x020000, 0xcaa2897f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "808s21.j17", 0x020000, 0x3d892ffb, BRF_ESS | BRF_PRG }, // 1 + + { "808e03.f4", 0x008000, 0x3d93a7cd, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "808e12.f28", 0x010000, 0xd62f1fde, BRF_GRA }, // 3 Tiles + { "808e13.h28", 0x010000, 0x1fa708f4, BRF_GRA }, // 4 + { "808e22.i28", 0x010000, 0x73d758f6, BRF_GRA }, // 5 + { "808e23.k28", 0x010000, 0x8ff08b21, BRF_GRA }, // 6 + + { "808d17.j4", 0x080000, 0xd1299082, BRF_GRA }, // 7 Sprites + { "808d15.h4", 0x080000, 0x2b22a6b6, BRF_GRA }, // 8 + + { "808a18.f16", 0x000100, 0xeb95aede, BRF_GRA }, // 9 PROMs + + { "808d01.d4", 0x020000, 0xfd4d37c0, BRF_SND }, // 10 K007232 Samples +}; + +STD_ROM_PICK(Mia2) +STD_ROM_FN(Mia2) + +static struct BurnRomInfo CuebrickRomDesc[] = { + { "903d25.g12", 0x010000, 0x8d575663, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "903d24.f12", 0x010000, 0x2973625d, BRF_ESS | BRF_PRG }, // 1 + + { "903c29.k21", 0x010000, 0xfada986d, BRF_GRA }, // 2 Tiles + { "903c27.k17", 0x010000, 0x5bd4b8e1, BRF_GRA }, // 3 + { "903c28.k19", 0x010000, 0x80d2bfaf, BRF_GRA }, // 4 + { "903c26.k15", 0x010000, 0xf808fa3d, BRF_GRA }, // 5 + + { "903d23.k12", 0x010000, 0xc39fc9fd, BRF_GRA }, // 6 Sprites + { "903d21.k8", 0x010000, 0x3c7bf8cd, BRF_GRA }, // 7 + { "903d22.k10", 0x010000, 0x95ad8591, BRF_GRA }, // 8 + { "903d20.k6", 0x010000, 0x2872a1bb, BRF_GRA }, // 9 +}; + +STD_ROM_PICK(Cuebrick) +STD_ROM_FN(Cuebrick) + +static struct BurnRomInfo BlswhstlRomDesc[] = { + { "060_l02.e09", 0x020000, 0xe8b7b234, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "060_l03.g09", 0x020000, 0x3c26d281, BRF_ESS | BRF_PRG }, // 1 + { "060_l09.e11", 0x020000, 0x14628736, BRF_ESS | BRF_PRG }, // 2 + { "060_l10.g11", 0x020000, 0xf738ad4a, BRF_ESS | BRF_PRG }, // 3 + + { "060j01.f3", 0x010000, 0xf9d9a673, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "060e07.k16", 0x080000, 0xc400edf3, BRF_GRA }, // 5 Tiles + { "060e08.k12", 0x080000, 0x70dddba1, BRF_GRA }, // 6 + + { "060e06.k7", 0x080000, 0x09381492, BRF_GRA }, // 7 Sprites + { "060e05.k3", 0x080000, 0x32454241, BRF_GRA }, // 8 + + { "060e04.d1", 0x100000, 0xc680395d, BRF_SND }, // 9 K053260 Samples + + { "blswhstl.nv", 0x000080, 0x87434e3f, BRF_OPT }, +}; + +STD_ROM_PICK(Blswhstl) +STD_ROM_FN(Blswhstl) + +static struct BurnRomInfo DetatwinRomDesc[] = { + { "060_j02.e09", 0x020000, 0x11b761ac, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "060_j03.g09", 0x020000, 0x8d0b588c, BRF_ESS | BRF_PRG }, // 1 + { "060_j09.e11", 0x020000, 0xf2a5f15f, BRF_ESS | BRF_PRG }, // 2 + { "060_j10.g11", 0x020000, 0x36eefdbc, BRF_ESS | BRF_PRG }, // 3 + + { "060j01.f3", 0x010000, 0xf9d9a673, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "060e07.k16", 0x080000, 0xc400edf3, BRF_GRA }, // 5 Tiles + { "060e08.k12", 0x080000, 0x70dddba1, BRF_GRA }, // 6 + + { "060e06.k7", 0x080000, 0x09381492, BRF_GRA }, // 7 Sprites + { "060e05.k3", 0x080000, 0x32454241, BRF_GRA }, // 8 + + { "060e04.d1", 0x100000, 0xc680395d, BRF_SND }, // 9 K053260 Samples + + { "blswhstl.nv", 0x000080, 0x87434e3f, BRF_OPT }, +}; + +STD_ROM_PICK(Detatwin) +STD_ROM_FN(Detatwin) + +static struct BurnRomInfo SsridersRomDesc[] = { + { "064eac02.8e", 0x040000, 0x5a5425f4, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "064eac03.8g", 0x040000, 0x093c00fb, BRF_ESS | BRF_PRG }, // 1 + { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 + { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 + + { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 + + { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites + { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 + + { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples + + { "ssriders_eac.nv", 0x000080, 0xf6d641a7, BRF_OPT }, +}; + +STD_ROM_PICK(Ssriders) +STD_ROM_FN(Ssriders) + +static struct BurnRomInfo SsridersebdRomDesc[] = { + { "064ebd02.8e", 0x040000, 0x8deef9ac, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "064ebd03.8g", 0x040000, 0x2370c107, BRF_ESS | BRF_PRG }, // 1 + { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 + { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 + + { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 + + { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites + { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 + + { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples + + { "ssriders_ebd.nv", 0x000080, 0xcbc903f6, BRF_OPT }, +}; + +STD_ROM_PICK(Ssridersebd) +STD_ROM_FN(Ssridersebd) + +static struct BurnRomInfo SsridersebcRomDesc[] = { + { "064ebc02.8e", 0x040000, 0x9bd7d164, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "064ebc03.8g", 0x040000, 0x40fd4165, BRF_ESS | BRF_PRG }, // 1 + { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 + { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 + + { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 + + { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites + { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 + + { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples + + { "ssriders_ebc.nv", 0x000080, 0x1918e90f, BRF_OPT }, +}; + +STD_ROM_PICK(Ssridersebc) +STD_ROM_FN(Ssridersebc) + +static struct BurnRomInfo SsridersudaRomDesc[] = { + { "064uda02.8e", 0x040000, 0x5129a6b7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "064uda03.8g", 0x040000, 0x9f887214, BRF_ESS | BRF_PRG }, // 1 + { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 + { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 + + { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 + + { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites + { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 + + { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples + + { "ssriders_uda.nv", 0x000080, 0x148c6d64, BRF_OPT }, +}; + +STD_ROM_PICK(Ssridersuda) +STD_ROM_FN(Ssridersuda) + +static struct BurnRomInfo SsriderseaaRomDesc[] = { + { "064eaa02.8e", 0x040000, 0x4844660f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "064eaa03.8g", 0x040000, 0x0b9bcc7c, BRF_ESS | BRF_PRG }, // 1 + { "064eaa04.10e", 0x020000, 0x5d917c1c, BRF_ESS | BRF_PRG }, // 2 + { "064eaa05.10g", 0x020000, 0xf4647b74, BRF_ESS | BRF_PRG }, // 3 + + { "064eaa01.2f", 0x010000, 0xbce45d82, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 + + { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites + { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 + + { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples + + { "ssriders_eaa.nv", 0x000080, 0x74a45ef5, BRF_OPT }, +}; + +STD_ROM_PICK(Ssriderseaa) +STD_ROM_FN(Ssriderseaa) + +static struct BurnRomInfo SsridersuacRomDesc[] = { + { "064uac02.8e", 0x040000, 0x870473b6, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "064uac03.8g", 0x040000, 0xeadf289a, BRF_ESS | BRF_PRG }, // 1 + { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 + { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 + + { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 + + { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites + { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 + + { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples + + { "ssriders_uac.nv", 0x000080, 0x26c8f1a0, BRF_OPT }, +}; + +STD_ROM_PICK(Ssridersuac) +STD_ROM_FN(Ssridersuac) + +static struct BurnRomInfo SsridersubcRomDesc[] = { + { "064ubc02.8e", 0x040000, 0xaca7fda5, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "064ubc03.8g", 0x040000, 0xbb1fdeff, BRF_ESS | BRF_PRG }, // 1 + { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 + { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 + + { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 + + { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites + { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 + + { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples + + { "ssriders_ubc.nv", 0x000080, 0x31c5504f, BRF_OPT }, +}; + +STD_ROM_PICK(Ssridersubc) +STD_ROM_FN(Ssridersubc) + +static struct BurnRomInfo SsridersabdRomDesc[] = { + { "064abd02.8e", 0x040000, 0x713406cb, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "064abd03.8g", 0x040000, 0x680feb3c, BRF_ESS | BRF_PRG }, // 1 + { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 + { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 + + { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 + + { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites + { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 + + { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples + + { "ssriders_abd.nv", 0x000080, 0xbfdafedf, BRF_OPT }, +}; + +STD_ROM_PICK(Ssridersabd) +STD_ROM_FN(Ssridersabd) + +static struct BurnRomInfo SsridersaddRomDesc[] = { + { "064add02.8e", 0x040000, 0x06b0138e, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "064add03.8g", 0x040000, 0x03eb8b91, BRF_ESS | BRF_PRG }, // 1 + { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 + { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 + + { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 + + { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites + { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 + + { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples + + { "ssriders_add.nv", 0x000080, 0xf06242d5, BRF_OPT }, +}; + +STD_ROM_PICK(Ssridersadd) +STD_ROM_FN(Ssridersadd) + +static struct BurnRomInfo SsridersjbdRomDesc[] = { + { "064jbd02.8e", 0x040000, 0x7acdc1e3, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "064jbd03.8g", 0x040000, 0x6a424918, BRF_ESS | BRF_PRG }, // 1 + { "064eab04.10e", 0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, // 2 + { "064eab05.10g", 0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, // 3 + + { "064e01.2f", 0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 5 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 6 + + { "064e09.7l", 0x100000, 0x4160c372, BRF_GRA }, // 7 Sprites + { "064e07.3l", 0x100000, 0x64dd673c, BRF_GRA }, // 8 + + { "064e06.1d", 0x100000, 0x59810df9, BRF_SND }, // 9 K053260 Samples + + { "ssriders_jbd.nv", 0x000080, 0x006200e3, BRF_OPT }, +}; + +STD_ROM_PICK(Ssridersjbd) +STD_ROM_FN(Ssridersjbd) + +static struct BurnRomInfo ssridersbRomDesc[] = { + { "sunsetb.03", 0x080000, 0x37ffe90b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "sunsetb.04", 0x080000, 0x8ff647b7, BRF_ESS | BRF_PRG }, // 1 + + { "064e12.16k", 0x080000, 0xe2bdc619, BRF_GRA }, // 2 Tiles + { "064e11.12k", 0x080000, 0x2d8ca8b0, BRF_GRA }, // 3 + + { "sunsetb.05", 0x080000, 0x8a0ff31a, BRF_GRA }, // 4 Sprites + { "sunsetb.06", 0x080000, 0xfdf2c887, BRF_GRA }, // 5 + { "sunsetb.07", 0x080000, 0xa545b1ed, BRF_GRA }, // 6 + { "sunsetb.08", 0x080000, 0xf867cd38, BRF_GRA }, // 7 + + { "sunsetb.01", 0x080000, 0x1a8b5ca2, BRF_SND }, // 8 OKI Samples + { "sunsetb.02", 0x080000, 0x5d485523, BRF_SND }, // 9 +}; + +STD_ROM_PICK(ssridersb) +STD_ROM_FN(ssridersb) + +static struct BurnRomInfo thndrx2RomDesc[] = { + { "073-ea-l02.11c", 0x020000, 0xeae02b51, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "073-ea-l03.12c", 0x020000, 0x738ed007, BRF_ESS | BRF_PRG }, // 1 + + { "073-c01.4f", 0x010000, 0x44ebe83c, BRF_ESS | BRF_PRG }, // 2 Z80 Code + + { "073-c06.16k", 0x080000, 0x24e22b42, BRF_GRA }, // 3 Tiles + { "073-c05.12k", 0x080000, 0x952a935f, BRF_GRA }, // 4 + + { "073-c07.7k", 0x080000, 0x14e93f38, BRF_GRA }, // 5 Sprites + { "073-c08.3k", 0x080000, 0x09fab3ab, BRF_GRA }, // 6 + + { "073-b04.2d", 0x080000, 0x05287a0b, BRF_SND }, // 7 K053260 Samples + + { "thndrx2.nv", 0x000080, 0xca613e98, BRF_OPT }, +}; + +STD_ROM_PICK(thndrx2) +STD_ROM_FN(thndrx2) + +static struct BurnRomInfo thndrx2aRomDesc[] = { + { "073-aa-m02.11c", 0x020000, 0x5b5b4cc0, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "073-aa-m03.12c", 0x020000, 0x320435a8, BRF_ESS | BRF_PRG }, // 1 + + { "073-c01.4f", 0x010000, 0x44ebe83c, BRF_ESS | BRF_PRG }, // 2 Z80 Code + + { "073-c06.16k", 0x080000, 0x24e22b42, BRF_GRA }, // 3 Tiles + { "073-c05.12k", 0x080000, 0x952a935f, BRF_GRA }, // 4 + + { "073-c07.7k", 0x080000, 0x14e93f38, BRF_GRA }, // 5 Sprites + { "073-c08.3k", 0x080000, 0x09fab3ab, BRF_GRA }, // 6 + + { "073-b04.2d", 0x080000, 0x05287a0b, BRF_SND }, // 7 K053260 Samples + + { "thndrx2a.nv", 0x000080, 0xf7893d00, BRF_OPT }, +}; + +STD_ROM_PICK(thndrx2a) +STD_ROM_FN(thndrx2a) + +static struct BurnRomInfo thndrx2jRomDesc[] = { + { "073-ja-k02.11c", 0x020000, 0x0c8b2d3f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "073-ja-k03.12c", 0x020000, 0x3803b427, BRF_ESS | BRF_PRG }, // 1 + + { "073-c01.4f", 0x010000, 0x44ebe83c, BRF_ESS | BRF_PRG }, // 2 Z80 Code + + { "073-c06.16k", 0x080000, 0x24e22b42, BRF_GRA }, // 3 Tiles + { "073-c05.12k", 0x080000, 0x952a935f, BRF_GRA }, // 4 + + { "073-c07.7k", 0x080000, 0x14e93f38, BRF_GRA }, // 5 Sprites + { "073-c08.3k", 0x080000, 0x09fab3ab, BRF_GRA }, // 6 + + { "073-b04.2d", 0x080000, 0x05287a0b, BRF_SND }, // 7 K053260 Samples + + { "thndrx2j.nv", 0x000080, 0x83b4799b, BRF_OPT }, +}; + +STD_ROM_PICK(thndrx2j) +STD_ROM_FN(thndrx2j) + +static struct BurnRomInfo lgtnfghtRomDesc[] = { + { "939k02.e11", 0x020000, 0x2dfefa53, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "939k03.e15", 0x020000, 0x14f0c454, BRF_ESS | BRF_PRG }, // 1 + + { "939e01.d7", 0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, // 2 Z80 Code + + { "939a07.k14", 0x080000, 0x7955dfcf, BRF_GRA }, // 3 Tiles + { "939a08.k19", 0x080000, 0xed95b385, BRF_GRA }, // 4 + + { "939a06.k8", 0x080000, 0xe393c206, BRF_GRA }, // 5 Sprites + { "939a05.k2", 0x080000, 0x3662d47a, BRF_GRA }, // 6 + + { "939a04.c5", 0x080000, 0xc24e2b6e, BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(lgtnfght) +STD_ROM_FN(lgtnfght) + +static struct BurnRomInfo lgtnfghtuRomDesc[] = { + { "939m02.e11", 0x020000, 0x61a12184, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "939m03.e15", 0x020000, 0x6db6659d, BRF_ESS | BRF_PRG }, // 1 + + { "939e01.d7", 0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, // 2 Z80 Code + + { "939a07.k14", 0x080000, 0x7955dfcf, BRF_GRA }, // 3 Tiles + { "939a08.k19", 0x080000, 0xed95b385, BRF_GRA }, // 4 + + { "939a06.k8", 0x080000, 0xe393c206, BRF_GRA }, // 5 Sprites + { "939a05.k2", 0x080000, 0x3662d47a, BRF_GRA }, // 6 + + { "939a04.c5", 0x080000, 0xc24e2b6e, BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(lgtnfghtu) +STD_ROM_FN(lgtnfghtu) + +static struct BurnRomInfo lgtnfghtaRomDesc[] = { + { "939j_02.e11", 0x020000, 0xbbbb4a74, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "939j_03.e15", 0x020000, 0x8d4da7b7, BRF_ESS | BRF_PRG }, // 1 + + { "939e01.d7", 0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, // 2 Z80 Code + + { "939a07.k14", 0x080000, 0x7955dfcf, BRF_GRA }, // 3 Tiles + { "939a08.k19", 0x080000, 0xed95b385, BRF_GRA }, // 4 + + { "939a06.k8", 0x080000, 0xe393c206, BRF_GRA }, // 5 Sprites + { "939a05.k2", 0x080000, 0x3662d47a, BRF_GRA }, // 6 + + { "939a04.c5", 0x080000, 0xc24e2b6e, BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(lgtnfghta) +STD_ROM_FN(lgtnfghta) + +static struct BurnRomInfo trigonRomDesc[] = { + { "939j02.e11", 0x020000, 0x38381d1b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "939j03.e15", 0x020000, 0xb5beddcd, BRF_ESS | BRF_PRG }, // 1 + + { "939e01.d7", 0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, // 2 Z80 Code + + { "939a07.k14", 0x080000, 0x7955dfcf, BRF_GRA }, // 3 Tiles + { "939a08.k19", 0x080000, 0xed95b385, BRF_GRA }, // 4 + + { "939a06.k8", 0x080000, 0xe393c206, BRF_GRA }, // 5 Sprites + { "939a05.k2", 0x080000, 0x3662d47a, BRF_GRA }, // 6 + + { "939a04.c5", 0x080000, 0xc24e2b6e, BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(trigon) +STD_ROM_FN(trigon) + +static struct BurnRomInfo tmnt2RomDesc[] = { + { "063uaa02.e8", 0x020000, 0x58d5c93d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "063uaa03.g8", 0x020000, 0x0541fec9, BRF_ESS | BRF_PRG }, // 1 + { "063uaa04.e10", 0x020000, 0x1d441a7d, BRF_ESS | BRF_PRG }, // 2 + { "063uaa05.g10", 0x020000, 0x9c428273, BRF_ESS | BRF_PRG }, // 3 + + { "063b01", 0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, // 4 Z80 Code + + { "063b12", 0x080000, 0xd3283d19, BRF_GRA }, // 5 Tiles + { "063b11", 0x080000, 0x6ebc0c15, BRF_GRA }, // 6 + + { "063b09", 0x100000, 0x2d7a9d2a, BRF_GRA }, // 7 Sprites + { "063b10", 0x080000, 0xf2dd296e, BRF_GRA }, // 8 + { "063b07", 0x100000, 0xd9bee7bf, BRF_GRA }, // 9 + { "063b08", 0x080000, 0x3b1ae36f, BRF_GRA }, // 10 + + { "063b06", 0x200000, 0x1e510aa5, BRF_SND }, // 11 K053260 Samples + + { "tmnt2_uaa.nv", 0x000080, 0x284357bd, BRF_OPT }, +}; + +STD_ROM_PICK(tmnt2) +STD_ROM_FN(tmnt2) + +static struct BurnRomInfo tmnt22puRomDesc[] = { + { "063uda02.e8", 0x020000, 0xaadffe3a, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "063uda03.g8", 0x020000, 0x125687a8, BRF_ESS | BRF_PRG }, // 1 + { "063uda04.e10", 0x020000, 0xfb5c7ded, BRF_ESS | BRF_PRG }, // 2 + { "063uda05.g10", 0x020000, 0x3c40fe66, BRF_ESS | BRF_PRG }, // 3 + + { "063b01", 0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, // 4 Z80 Code + + { "063b12", 0x080000, 0xd3283d19, BRF_GRA }, // 5 Tiles + { "063b11", 0x080000, 0x6ebc0c15, BRF_GRA }, // 6 + + { "063b09", 0x100000, 0x2d7a9d2a, BRF_GRA }, // 7 Sprites + { "063b10", 0x080000, 0xf2dd296e, BRF_GRA }, // 8 + { "063b07", 0x100000, 0xd9bee7bf, BRF_GRA }, // 9 + { "063b08", 0x080000, 0x3b1ae36f, BRF_GRA }, // 10 + + { "063b06", 0x200000, 0x1e510aa5, BRF_SND }, // 11 K053260 Samples + + { "tmnt2_uda.nv", 0x000080, 0x44928d33, BRF_OPT }, +}; + +STD_ROM_PICK(tmnt22pu) +STD_ROM_FN(tmnt22pu) + +static struct BurnRomInfo tmht22peRomDesc[] = { + { "063eba02.e8", 0x020000, 0x99409094, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "063eba03.g8", 0x020000, 0x4d65650f, BRF_ESS | BRF_PRG }, // 1 + { "063eba04.e10", 0x020000, 0xf6e3b9c7, BRF_ESS | BRF_PRG }, // 2 + { "063eba05.g10", 0x020000, 0x1bad6696, BRF_ESS | BRF_PRG }, // 3 + + { "063b01", 0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, // 4 Z80 Code + + { "063b12", 0x080000, 0xd3283d19, BRF_GRA }, // 5 Tiles + { "063b11", 0x080000, 0x6ebc0c15, BRF_GRA }, // 6 + + { "063b09", 0x100000, 0x2d7a9d2a, BRF_GRA }, // 7 Sprites + { "063b10", 0x080000, 0xf2dd296e, BRF_GRA }, // 8 + { "063b07", 0x100000, 0xd9bee7bf, BRF_GRA }, // 9 + { "063b08", 0x080000, 0x3b1ae36f, BRF_GRA }, // 10 + + { "063b06", 0x200000, 0x1e510aa5, BRF_SND }, // 11 K053260 Samples + + { "tmnt2_eba.nv", 0x000080, 0xc0a3ed50, BRF_OPT }, +}; + +STD_ROM_PICK(tmht22pe) +STD_ROM_FN(tmht22pe) + +static struct BurnRomInfo tmnt2aRomDesc[] = { + { "063ada02.e8", 0x020000, 0x4f11b587, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "063ada03.g8", 0x020000, 0x82a1b9ac, BRF_ESS | BRF_PRG }, // 1 + { "063ada04.e10", 0x020000, 0x05ad187a, BRF_ESS | BRF_PRG }, // 2 + { "063ada05.g10", 0x020000, 0xd4826547, BRF_ESS | BRF_PRG }, // 3 + + { "063b01", 0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, // 4 Z80 Code + + { "063b12", 0x080000, 0xd3283d19, BRF_GRA }, // 5 Tiles + { "063b11", 0x080000, 0x6ebc0c15, BRF_GRA }, // 6 + + { "063b09", 0x100000, 0x2d7a9d2a, BRF_GRA }, // 7 Sprites + { "063b10", 0x080000, 0xf2dd296e, BRF_GRA }, // 8 + { "063b07", 0x100000, 0xd9bee7bf, BRF_GRA }, // 9 + { "063b08", 0x080000, 0x3b1ae36f, BRF_GRA }, // 10 + + { "063b06", 0x200000, 0x1e510aa5, BRF_SND }, // 11 K053260 Samples + + { "tmnt2_ada.nv", 0x000080, 0x063068a0, BRF_OPT }, +}; + +STD_ROM_PICK(tmnt2a) +STD_ROM_FN(tmnt2a) + +static struct BurnRomInfo qgakumonRomDesc[] = { + { "248jaa02.8e", 0x040000, 0xfab79410, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "248jaa03.8g", 0x040000, 0x8d888ef3, BRF_ESS | BRF_PRG }, // 1 + { "248jaa04.10e", 0x040000, 0x56cb16cb, BRF_ESS | BRF_PRG }, // 2 + { "248jaa05.10g", 0x040000, 0x27614fcd, BRF_ESS | BRF_PRG }, // 3 + + { "248a01.2f", 0x010000, 0xa8a41cc6, BRF_ESS | BRF_PRG }, // 4 Z80 Code + + { "248a12.16k", 0x080000, 0x62870987, BRF_GRA }, // 5 Tiles + { "248a11.12k", 0x080000, 0xfad2dbfd, BRF_GRA }, // 6 + + { "248a09.7l", 0x100000, 0xa176e205, BRF_GRA }, // 7 Sprites + { "248a07.3l", 0x100000, 0x9595589f, BRF_GRA }, // 8 + + { "248a06.1d", 0x200000, 0x0fba1def, BRF_SND }, // 9 K053260 Samples + + { "qgakumon.nv", 0x000080, 0x847bd238, BRF_OPT }, +}; + +STD_ROM_PICK(qgakumon) +STD_ROM_FN(qgakumon) + +static struct BurnRomInfo punkshotRomDesc[] = { + { "907-j02.i7", 0x020000, 0xdbb3a23b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "907-j03.i10", 0x020000, 0x2151d1ab, BRF_ESS | BRF_PRG }, // 1 + + { "907f01.e8", 0x008000, 0xf040c484, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "907d06.e23", 0x040000, 0xf5cc38f4, BRF_GRA }, // 3 Tiles + { "907d05.e22", 0x040000, 0xe25774c1, BRF_GRA }, // 4 + + { "907d07.k2", 0x100000, 0xb0fe4543, BRF_GRA }, // 5 Sprites + { "907d08.k7", 0x100000, 0xd5ac8d9d, BRF_GRA }, // 6 + + { "907d04.d3", 0x080000, 0x090feb5e, BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(punkshot) +STD_ROM_FN(punkshot) + +static struct BurnRomInfo punkshot2RomDesc[] = { + { "907m02.i7", 0x020000, 0x59e14575, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "907m03.i10", 0x020000, 0xadb14b1e, BRF_ESS | BRF_PRG }, // 1 + + { "907f01.e8", 0x008000, 0xf040c484, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "907d06.e23", 0x040000, 0xf5cc38f4, BRF_GRA }, // 3 Tiles + { "907d05.e22", 0x040000, 0xe25774c1, BRF_GRA }, // 4 + + { "907d07.k2", 0x100000, 0xb0fe4543, BRF_GRA }, // 5 Sprites + { "907d08.k7", 0x100000, 0xd5ac8d9d, BRF_GRA }, // 6 + + { "907d04.d3", 0x080000, 0x090feb5e, BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(punkshot2) +STD_ROM_FN(punkshot2) + +static struct BurnRomInfo punkshotjRomDesc[] = { + { "907z02.i7", 0x020000, 0x7a3a5c89, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "907z03.i10", 0x020000, 0x22a3d9d6, BRF_ESS | BRF_PRG }, // 1 + + { "907f01.e8", 0x008000, 0xf040c484, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "907d06.e23", 0x040000, 0xf5cc38f4, BRF_GRA }, // 3 Tiles + { "907d05.e22", 0x040000, 0xe25774c1, BRF_GRA }, // 4 + + { "907d07.k2", 0x100000, 0xb0fe4543, BRF_GRA }, // 5 Sprites + { "907d08.k7", 0x100000, 0xd5ac8d9d, BRF_GRA }, // 6 + + { "907d04.d3", 0x080000, 0x090feb5e, BRF_SND }, // 7 K053260 Samples +}; + +STD_ROM_PICK(punkshotj) +STD_ROM_FN(punkshotj) + +static INT32 TmntMemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x060000; + DrvZ80Rom = Next; Next += 0x008000; + DrvSoundRom = Next; Next += 0x020000; + DrvUPD7759CRom = Next; Next += 0x020000; + DrvTileRom = Next; Next += 0x100000; + DrvSpriteRom = Next; Next += 0x200000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x004000; + DrvZ80Ram = Next; Next += 0x000800; + DrvPaletteRam = Next; Next += 0x001000; + + RamEnd = Next; + + Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + DrvTitleSample = (INT16*)Next; Next += 0x40000 * sizeof(INT16); + DrvTiles = Next; Next += 0x008000 * 8 * 8; + DrvSprites = Next; Next += 0x004000 * 16 * 16; + + MemEnd = Next; + + return 0; +} + +static INT32 MiaMemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x040000; + DrvZ80Rom = Next; Next += 0x008000; + DrvSoundRom = Next; Next += 0x020000; + DrvTileRom = Next; Next += 0x040000; + DrvSpriteRom = Next; Next += 0x100000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x008000; + DrvZ80Ram = Next; Next += 0x000800; + DrvPaletteRam = Next; Next += 0x001000; + + RamEnd = Next; + + Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + DrvTiles = Next; Next += 0x002000 * 8 * 8; + DrvSprites = Next; Next += 0x002000 * 16 * 16; + + MemEnd = Next; + + return 0; +} + +static INT32 CuebrickMemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x020000; + DrvTileRom = Next; Next += 0x040000; + DrvSpriteRom = Next; Next += 0x040000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x008000; + DrvPaletteRam = Next; Next += 0x001000; + + RamEnd = Next; + + Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + DrvTiles = Next; Next += 0x002000 * 8 * 8; + DrvSprites = Next; Next += 0x001000 * 16 * 16; + DrvNvRam = Next; Next += 0x400 * 0x20; + + MemEnd = Next; + + return 0; +} + +static INT32 BlswhstlMemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x080000; + DrvZ80Rom = Next; Next += 0x010000; + DrvSoundRom = Next; Next += 0x100000; + DrvTileRom = Next; Next += 0x100000; + DrvSpriteRom = Next; Next += 0x100000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x004000; + DrvZ80Ram = Next; Next += 0x000800; + DrvPaletteRam = Next; Next += 0x001000; + DrvSpriteRam = Next; Next += 0x004000; + + RamEnd = Next; + + DrvTiles = Next; Next += 0x008000 * 8 * 8; + DrvSprites = Next; Next += 0x002000 * 16 * 16; + Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 SsridersMemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x0c0000; + DrvZ80Rom = Next; Next += 0x010000; + DrvSoundRom = Next; Next += 0x100000; + DrvTileRom = Next; Next += 0x100000; + DrvSpriteRom = Next; Next += 0x200000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x004080; + DrvZ80Ram = Next; Next += 0x000800; + DrvPaletteRam = Next; Next += 0x001000; + DrvSpriteRam = Next; Next += 0x004000; + + RamEnd = Next; + + Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); + DrvTiles = Next; Next += 0x008000 * 8 * 8; + DrvSprites = Next; Next += 0x004000 * 16 * 16; + + MemEnd = Next; + + return 0; +} + +static INT32 Tmnt2MemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x100000; + DrvZ80Rom = Next; Next += 0x010000; + DrvSoundRom = Next; Next += 0x200000; + DrvTileRom = Next; Next += 0x100000; + DrvSpriteRom = Next; Next += 0x400000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x005080; + DrvZ80Ram = Next; Next += 0x000800; + DrvPaletteRam = Next; Next += 0x001000; + DrvSpriteRam = Next; Next += 0x004000; + + RamEnd = Next; + + Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); + DrvTiles = Next; Next += 0x008000 * 8 * 8; + DrvSprites = Next; Next += 0x008000 * 16 * 16; + + MemEnd = Next; + + return 0; +} + +static INT32 Thndrx2MemIndex() +{ + UINT8 *Next; Next = Mem; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x004000; + DrvZ80Ram = Next; Next += 0x000800; + DrvPaletteRam = Next; Next += 0x001000; + + RamEnd = Next; + + Drv68KRom = Next; Next += 0x080000; + DrvZ80Rom = Next; Next += 0x010000; + DrvSoundRom = Next; Next += 0x080000; + DrvTileRom = Next; Next += 0x100000; + DrvSpriteRom = Next; Next += 0x100000; + + Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); + DrvTiles = Next; Next += 0x008000 * 8 * 8; + DrvSprites = Next; Next += 0x002000 * 16 * 16; + + MemEnd = Next; + + return 0; +} + +static INT32 LgtnfghtMemIndex() +{ + UINT8 *Next; Next = Mem; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x004000; + DrvZ80Ram = Next; Next += 0x000800; + DrvPaletteRam = Next; Next += 0x001000; + DrvSpriteRam = Next; Next += 0x004000; + + RamEnd = Next; + + Drv68KRom = Next; Next += 0x080000; + DrvZ80Rom = Next; Next += 0x010000; + DrvSoundRom = Next; Next += 0x080000; + DrvTileRom = Next; Next += 0x100000; + DrvSpriteRom = Next; Next += 0x100000; + + Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); + DrvTiles = Next; Next += 0x008000 * 8 * 8; + DrvSprites = Next; Next += 0x002000 * 16 * 16; + + MemEnd = Next; + + return 0; +} + +static INT32 PunkshotMemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x040000; + DrvZ80Rom = Next; Next += 0x010000; + DrvSoundRom = Next; Next += 0x080000; + DrvTileRom = Next; Next += 0x080000; + DrvSpriteRom = Next; Next += 0x200000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x004000; + DrvZ80Ram = Next; Next += 0x000800; + DrvPaletteRam = Next; Next += 0x001000; + + RamEnd = Next; + + Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32); + DrvTiles = Next; Next += 0x004000 * 8 * 8; + DrvSprites = Next; Next += 0x004000 * 16 * 16; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + bIrqEnable = 0; + DrvSoundLatch = 0; + TitleSoundLatch = 0; + PlayTitleSample = 0; + TitleSamplePos = 0; + PriorityFlag = 0; + + return 0; +} + +static INT32 TmntDoReset() +{ + INT32 nRet = DrvDoReset(); + + UPD7759Reset(); + + UPD7759StartWrite(0, 0); + UPD7759ResetWrite(0, 1); + + return nRet; +} + +static INT32 CuebrickDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + bIrqEnable = 0; + DrvNvRamBank = 0; + PriorityFlag = 0; + CuebrickSndIrqFire = 0; + + return 0; +} + +static INT32 BlswhstlDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + K053260Reset(0); + + KonamiICReset(); + + EEPROMReset(); + + if (EEPROMAvailable()) { + InitEEPROMCount = 0; + } else { + InitEEPROMCount = 10; + } + + BlswhstlTileRomBank = 0; + + K052109_irq_enabled = 0; + + return 0; +} + +static INT32 SsridersDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + K053260Reset(0); + + KonamiICReset(); + + EEPROMReset(); + + if (EEPROMAvailable()) { + InitEEPROMCount = 0; + } else { + InitEEPROMCount = 10; + } + + K052109_irq_enabled = 0; + DrvVBlank = 0; + + dim_c = 0; + dim_v = 0; + + return 0; +} + +static INT32 PunkshotDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + K053260Reset(0); + + KonamiICReset(); + + K052109_irq_enabled = 0; + DrvVBlank = 0; + + return 0; +} + +UINT8 __fastcall Tmnt68KReadByte(UINT32 a) +{ + K052109WordNoA12Read(0x100000) + K051937ByteRead(0x140000) + K051960ByteRead(0x140400) + + switch (a) { + case 0x0a0001: { + return 0xff - DrvInput[0]; + } + + case 0x0a0003: { + return 0xff - DrvInput[1]; + } + + case 0x0a0005: { + return 0xff - DrvInput[2]; + } + + case 0x0a0007: { + return 0xff - DrvInput[3]; + } + + case 0x0a0011: { + return DrvDip[0]; + } + + case 0x0a0013: { + return DrvDip[1]; + } + + case 0x0a0015: { + return 0xff - DrvInput[4]; + } + + case 0x0a0019: { + return DrvDip[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Tmnt68KWriteByte(UINT32 a, UINT8 d) +{ + K052109WordNoA12Write(0x100000) + K015937ByteWrite(0x140000) + K051960ByteWrite(0x140400) + + switch (a) { + case 0x0a0001: { + static INT32 Last; + if (Last == 0x08 && (d & 0x08) == 0) { + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + } + Last = d & 0x08; + + bIrqEnable = (d & 0x20) ? 1 : 0; + + K052109RMRDLine = d & 0x80; + return; + } + + case 0x0a0009: { + DrvSoundLatch = d; + return; + } + + case 0x0a0011: { + // watchdog write + return; + } + + case 0x0c0001: { + PriorityFlag = (d & 0x0c) >> 2; + return; + } + + case 0x10e801: { + // nop??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Tmnt68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Tmnt68KWriteWord(UINT32 a, UINT16 d) +{ + K051960WordWrite(0x140400) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Mia68KReadByte(UINT32 a) +{ + K052109WordNoA12Read(0x100000) + K051937ByteRead(0x140000) + K051960ByteRead(0x140400) + + switch (a) { + case 0x0a0001: { + return 0xff - DrvInput[0]; + } + + case 0x0a0003: { + return 0xff - DrvInput[1]; + } + + case 0x0a0005: { + return 0xff - DrvInput[2]; + } + + case 0x0a0011: { + return DrvDip[0]; + } + + case 0x0a0013: { + return DrvDip[1]; + } + + case 0x0a0019: { + return DrvDip[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Mia68KWriteByte(UINT32 a, UINT8 d) +{ + K052109WordNoA12Write(0x100000) + K015937ByteWrite(0x140000) + K051960ByteWrite(0x140400) + + switch (a) { + case 0x0a0001: { + static INT32 Last; + if (Last == 0x08 && (d & 0x08) == 0) { + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + } + Last = d & 0x08; + + bIrqEnable = (d & 0x20) ? 1 : 0; + + K052109RMRDLine = d & 0x80; + return; + } + + case 0x0a0009: { + DrvSoundLatch = d; + return; + } + + case 0x0a0011: { + // watchdog write + return; + } + + case 0x10e801: { + // nop??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Mia68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Mia68KWriteWord(UINT32 a, UINT16 d) +{ + K051960WordWrite(0x140400) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Cuebrick68KReadByte(UINT32 a) +{ + K052109WordNoA12Read(0x100000) + K051937ByteRead(0x140000) + K051960ByteRead(0x140400) + + if (a >= 0x0b0000 && a <= 0x0b03ff) { + return DrvNvRam[(a - 0x0b0000) + (DrvNvRamBank * 0x400)]; + } + + switch (a) { + case 0x0a0001: { + return 0xff - DrvInput[0]; + } + + case 0x0a0003: { + return 0xff - DrvInput[1]; + } + + case 0x0a0005: { + return 0xff - DrvInput[2]; + } + + case 0x0a0011: { + return DrvDip[1]; + } + + case 0x0a0013: { + return DrvDip[0]; + } + + case 0x0a0019: { + return DrvDip[2]; + } + + case 0x0c0000: + return 0xff; + + case 0x0c0002: { + return BurnYM2151ReadStatus(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Cuebrick68KWriteByte(UINT32 a, UINT8 d) +{ + K052109WordNoA12Write(0x100000) + K015937ByteWrite(0x140000) + K051960ByteWrite(0x140400) + + if (a >= 0x0b0000 && a <= 0x0b03ff) { + DrvNvRam[(a - 0x0b0000) + (DrvNvRamBank * 0x400)] = d; + return; + } + + switch (a) { + case 0x0a0001: { + bIrqEnable = (d & 0x20) ? 1 : 0; + + K052109RMRDLine = d & 0x80; + return; + } + + case 0x0a0011: { + // watchdog write + return; + } + + case 0x0b0400: { + DrvNvRamBank = d; + return; + } + + case 0x0c0000: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x0c0002: { + BurnYM2151WriteRegister(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Cuebrick68KReadWord(UINT32 a) +{ + if (a >= 0x0b0000 && a <= 0x0b03ff) { + SEK_DEF_READ_WORD(0, a); + return 0; + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Cuebrick68KWriteWord(UINT32 a, UINT16 d) +{ + K051960WordWrite(0x140400) + + if (a >= 0x0b0000 && a <= 0x0b03ff) { + SEK_DEF_WRITE_WORD(0, a, d); + return; + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Blswhstl68KReadByte(UINT32 a) +{ + if (a >= 0x180000 && a <= 0x183fff) { + INT32 Offset = (a - 0x180000) >> 1; + + if (a & 1) { + return K052109Read(Offset + 0x2000); + } else { + return K052109Read(Offset + 0x0000); + } + } + + if (a >= 0x300000 && a <= 0x303fff) { + INT32 Offset = (a - 0x300000); + + if (Offset & (0x31 << 1)) { + return DrvSpriteRam[Offset ^ 1]; + } else { + Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); + return K053245ReadWord(0, Offset/2) >> ((~a & 1) << 3); + } + } + + if (a >= 0x500000 && a <= 0x50003f) { + INT32 Offset = (a - 0x500000) >> 1; + if (a & 1) { + return K054000Read(Offset); + } else { + return 0; + } + } + + if (a >= 0x680000 && a <= 0x68001f) { + INT32 Offset = (a - 0x680000) >> 1; + Offset &= ~1; + + if (a & 1) { + return K053244Read(0, Offset + 1); + } else { + return K053244Read(0, Offset + 0); + } + } + + switch (a) { + case 0x700001: { + return 0xff - DrvInput[1]; + } + + case 0x700003: { + return 0xff - DrvInput[2]; + } + + case 0x700005: { + UINT8 Res; + static INT32 Toggle; + + Res = 0xff - DrvInput[0]; + + if (InitEEPROMCount) { + InitEEPROMCount--; + Res &= 0xf7; + } + + Toggle ^= 0x40; + + return Res ^ Toggle; + } + + case 0x700007: { + return 0xfe | (EEPROMRead() & 0x01); + } + + case 0x780601: + case 0x780603: { + INT32 Offset = (a - 0x780601) >> 1; + return K053260Read(0, Offset + 2); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Blswhstl68KWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x180000 && a <= 0x183fff) { + INT32 Offset = (a - 0x180000) >> 1; + + if (a & 1) { + K052109Write(Offset + 0x2000, d); + } else { + K052109Write(Offset + 0x0000, d); + } + return; + } + + if (a >= 0x300000 && a <= 0x303fff) { + INT32 Offset = (a - 0x300000); + DrvSpriteRam[Offset ^ 1] = d; + + if (!(Offset & (0x31 << 1))) { + Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); + + INT32 data = K053245ReadWord(0, Offset/2); + + if (a & 1) { + data &= 0xff00; + data |= d; + } else { + data &= 0x00ff; + data |= d << 8; + } + + K053245WriteWord(0, Offset / 2, data); + } + return; + } + + if (a >= 0x500000 && a <= 0x50003f) { + INT32 Offset = (a - 0x500000) >> 1; + if (a & 1) K054000Write(Offset, d); + return; + } + + if (a >= 0x680000 && a <= 0x68001f) { + INT32 Offset = (a - 0x680000) >> 1; + Offset &= ~1; + + if (a & 1) { + K053244Write(0, Offset + 1, d); + } else { + K053244Write(0, Offset + 0, d); + } + return; + } + + if (a >= 0x780700 && a <= 0x78071f) { + K053251Write((a - 0x780700) >> 1, d); + return; + } + + switch (a) { + case 0x700201: { + EEPROMWrite(d & 0x04, d & 0x02, d & 0x01); + return; + } + + case 0x700301: { + K052109RMRDLine = d & 0x08; + BlswhstlTileRomBank = (d & 0x80) >> 7; + return; + } + + case 0x700401: { + // watchdog write + return; + } + + case 0x780601: { + K053260Write(0, 0, d); + return; + } + + case 0x780605: { + ZetOpen(0); + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Blswhstl68KReadWord(UINT32 a) +{ + if (a >= 0x300000 && a <= 0x303fff) { + UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; + INT32 Offset = (a - 0x300000) >> 1; + + if (Offset & 0x31) { + return BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]); + } else { + Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); + return K053245ReadWord(0, Offset); + } + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Blswhstl68KWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x180000 && a <= 0x183fff) { + INT32 Offset = (a - 0x180000) >> 1; + + K052109Write(Offset + 0x2000, d >> 8); + K052109Write(Offset + 0x0000, d & 0xff); + return; + } + + if (a >= 0x300000 && a <= 0x303fff) { + UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; + INT32 Offset = (a - 0x300000) >> 1; + SpriteRam[Offset] = BURN_ENDIAN_SWAP_INT16(d); + + if (!(Offset & 0x0031)) { + Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); + K053245WriteWord(0, Offset, d); + } + return; + } + + if (a >= 0x500000 && a <= 0x50003f) { + INT32 Offset = (a - 0x500000) >> 1; + K054000Write(Offset, d & 0xff); + return; + } + + if (a >= 0x680000 && a <= 0x68001f) { + INT32 Offset = (a - 0x680000) >> 1; + Offset &= ~1; + + K053244Write(0, Offset + 1, d & 0xff); + K053244Write(0, Offset + 0, d >> 8); + return; + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +static void tmnt2_protection_write() +{ + UINT32 src_addr, dst_addr, mod_addr, attr1, code, attr2, cbase, cmod, color; + INT32 xoffs, yoffs, xmod, ymod, zmod, xzoom, yzoom, i; + UINT16 *mcu; + UINT16 src[4], mod[24]; + UINT8 keepaspect, xlock, ylock, zlock; + + mcu = (UINT16*)(Drv68KRam + 0x4800); + if ((BURN_ENDIAN_SWAP_INT16(mcu[8]) & 0xff00) != 0x8200) return; + + src_addr = (BURN_ENDIAN_SWAP_INT16(mcu[0]) | (BURN_ENDIAN_SWAP_INT16(mcu[1])&0xff)<<16) >> 1; + dst_addr = (BURN_ENDIAN_SWAP_INT16(mcu[2]) | (BURN_ENDIAN_SWAP_INT16(mcu[3])&0xff)<<16) >> 1; + mod_addr = (BURN_ENDIAN_SWAP_INT16(mcu[4]) | (BURN_ENDIAN_SWAP_INT16(mcu[5])&0xff)<<16) >> 1; + zlock = (BURN_ENDIAN_SWAP_INT16(mcu[8]) & 0xff) == 0x0001; + + for (i=0; i< 4; i++) src[i] = SekReadWord((src_addr + i) * 2); + for (i=0; i<24; i++) mod[i] = SekReadWord((mod_addr + i) * 2); + + code = src[0]; // code + + i= src[1]; + attr1 = i>>2 & 0x3f00; // flip y, flip x and sprite size + attr2 = i & 0x380; // mirror y, mirror x, shadow + cbase = i & 0x01f; // base color + cmod = mod[0x2a/2]>>8; + color = (cbase != 0x0f && cmod <= 0x1f && !zlock) ? cmod : cbase; + + xoffs = (INT16)src[2]; // local x + yoffs = (INT16)src[3]; // local y + + i = mod[0]; + attr2 |= i & 0x0060; // priority + keepaspect = (i & 0x0014) == 0x0014; + if (i & 0x8000) { attr1 |= 0x8000; } // active + if (keepaspect) { attr1 |= 0x4000; } // keep aspect + if (i & 0x4000) { attr1 ^= 0x1000; xoffs = -xoffs; } // flip x + + xmod = (INT16)mod[6]; // global x + ymod = (INT16)mod[7]; // global y + zmod = (INT16)mod[8]; // global z + xzoom = mod[0x1c/2]; + yzoom = (keepaspect) ? xzoom : mod[0x1e/2]; + + ylock = xlock = (i & 0x0020 && (!xzoom || xzoom == 0x100)); + + if (!xlock) + { + i = xzoom - 0x4f00; + if (i > 0) + { + i >>= 8; + xoffs += (INT32)(pow(i, /*1.898461*/1.891292) * xoffs / 599.250121); + } + else if (i < 0) + { + i = (i>>3) + (i>>4) + (i>>5) + (i>>6) + xzoom; + xoffs = (i > 0) ? (xoffs * i / 0x4f00) : 0; + } + } + if (!ylock) + { + i = yzoom - 0x4f00; + if (i > 0) + { + i >>= 8; + yoffs += (INT32)(pow(i, /*1.898461*/1.891292) * yoffs / 599.250121); + } + else if (i < 0) + { + i = (i>>3) + (i>>4) + (i>>5) + (i>>6) + yzoom; + yoffs = (i > 0) ? (yoffs * i / 0x4f00) : 0; + } + + } + if (!zlock) yoffs += zmod; + xoffs += xmod; + yoffs += ymod; + + SekWriteWord((dst_addr + 0) * 2, attr1); + SekWriteWord((dst_addr + 2) * 2, code); + SekWriteWord((dst_addr + 4) * 2, (UINT32)yoffs); + SekWriteWord((dst_addr + 6) * 2, (UINT32)xoffs); + SekWriteWord((dst_addr + 12) * 2, attr2 | color); +} + +void __fastcall Tmnt268KProtWord(UINT32 a, UINT16 d) +{ + *((UINT16*)(Drv68KRam + 0x4800 + (a & 0x1e))) = BURN_ENDIAN_SWAP_INT16(d); +} + +void __fastcall Tmnt268KProtByte(UINT32 a, UINT8 d) +{ + a &= 0x1f; + Drv68KRam[0x4801 ^ a] = d; + + if (a == 0x18) tmnt2_protection_write(); +} + +static UINT16 ssriders_protection_r() +{ + INT32 data = SekReadWord(0x105a0a); + INT32 cmd = SekReadWord(0x1058fc); + + switch (cmd) + { + case 0x100b: + return 0x0064; + + case 0x6003: + return data & 0x000f; + + case 0x6004: + return data & 0x001f; + + case 0x6000: + return data & 0x0001; + + case 0x0000: + return data & 0x00ff; + + case 0x6007: + return data & 0x00ff; + + case 0x8abc: + /* collision table */ + data = -SekReadWord(0x105818); + data = ((data / 8 - 4) & 0x1f) * 0x40; + data += ((SekReadWord(0x105cb0) + + 256*K052109Read(0x1a01) + K052109Read(0x1a00) - 6) / 8 + 12) & 0x3f; + return data; + + default: + return 0xffff; + } +} + +static void ssriders_protection_w(INT32 offset) +{ + offset >>= 1; + + if (offset == 1) + { + INT32 logical_pri,hardware_pri; + + /* create sprite priority attributes */ + hardware_pri = 1; + for (logical_pri = 1;logical_pri < 0x100;logical_pri <<= 1) + { + INT32 i; + + for (i = 0;i < 128;i++) + { + if ((SekReadWord(0x180006 + 128*i) >> 8) == (UINT16)logical_pri) + { + K053245Write(0,((8*i) * 2)+1,hardware_pri); + hardware_pri++; + } + } + } + } +} + +UINT8 __fastcall Ssriders68KReadByte(UINT32 a) +{ + if (a >= 0x180000 && a <= 0x183fff) { + INT32 Offset = (a - 0x180000); + + if (Offset & (0x31 << 1)) { + return DrvSpriteRam[Offset ^ 1]; + } else { + Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); + return K053245ReadWord(0, Offset / 2) >> ((~a & 1) << 3); + } + } + + if ((a & 0xffff80) == 0x1c0500) { + return Drv68KRam[0x4001 ^ (a & 0x7f)]; + } + + if (a >= 0x5a0000 && a <= 0x5a001f) { + INT32 Offset = (a - 0x5a0000) >> 1; + Offset &= ~1; + + if (a & 1) { + return K053244Read(0, Offset + 1); + } else { + return K053244Read(0, Offset + 0); + } + } + + if (a >= 0x600000 && a <= 0x603fff) { + INT32 Offset = (a - 0x600000) >> 1; + + if (a & 1) { + return K052109Read(Offset + 0x2000); + } else { + return K052109Read(Offset + 0x0000); + } + } + + switch (a) { + case 0x1c0800: + case 0x1c0801: + return ssriders_protection_r() >> ((~a & 1) << 3); + + case 0x1c0001: { + return 0xff - DrvInput[1]; + } + + case 0x1c0003: { + return 0xff - DrvInput[2]; + } + + case 0x1c0005: { + return 0xff - DrvInput[3]; + } + + case 0x1c0007: { + return 0xff - DrvInput[4]; + } + + case 0x1c0101: { + return 0xff - DrvInput[0]; + } + + case 0x1c0103: { + UINT8 Res; + static INT32 Toggle; + + Res = DrvInput[5]; + if (DrvVBlank) Res |= 0x08; + Res |= EEPROMRead() & 0x01; + + if (InitEEPROMCount) { + InitEEPROMCount--; + Res &= 0x7f; + } + + Toggle ^= 0x04; + + return Res ^ Toggle; + } + + case 0x1c0401: { + // watchdog read + return 0; + } + + case 0x5c0601: + case 0x5c0603: { + INT32 Offset = (a - 0x5c0601) >> 1; + return K053260Read(0, Offset + 2); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ssriders68KWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x180000 && a <= 0x183fff) { + INT32 Offset = (a - 0x180000); + DrvSpriteRam[Offset ^ 1] = d; + + if (!(Offset & (0x31 << 1))) { + Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); + + INT32 data = K053245ReadWord(0, Offset/2); + + if (a & 1) { + data &= 0xff00; + data |= d; + } else { + data &= 0x00ff; + data |= d << 8; + } + + K053245WriteWord(0, Offset/2, data); + + } + return; + } + + if ((a & ~3) == 0x1c0800) { + bprintf (0, _T("protection write byte %x %x\n"), a, d); + return; + } + + // extra ram for tmnt2 + if ((a & 0xffff80) == 0x1c0500) { + Drv68KRam[0x4001 ^ (a & 0x7f)] = d; + //*((UINT16*)(Drv68KRam + 0x4000 + (a & 0x7e))) = d; + return; + } + + if (a >= 0x5a0000 && a <= 0x5a001f) { + INT32 Offset = (a - 0x5a0000) >> 1; + Offset &= ~1; + + K053244Write(0, Offset + 1, d & 0xff); + K053244Write(0, Offset + 0, 0); // originally d >> 8, but that is effectively 0 + return; + } + + if (a >= 0x5c0700 && a <= 0x5c071f) { + K053251Write((a - 0x5c0700) >> 1, d); + return; + } + + if (a >= 0x600000 && a <= 0x603fff) { + INT32 Offset = (a - 0x600000) >> 1; + + if (a & 1) { + K052109Write(Offset + 0x2000, d); + } else { + K052109Write(Offset + 0x0000, d); + } + return; + } + + switch (a) { + case 0x1c0201: { + EEPROMWrite(d & 0x04, d & 0x02, d & 0x01); + K053244BankSelect(0, ((d & 0x20) >> 5) << 2); + dim_c = d & 0x18; + return; + } + + case 0x1c0301: { + K052109RMRDLine = d & 0x08; + dim_v = (d & 0x70) >> 4; + return; + } + + case 0x5c0601: { + K053260Write(0, 0, d); + return; + } + + case 0x5c0605: { + ZetOpen(0); + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + + case 0x1c0401: { + // watchdog write + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Ssriders68KReadWord(UINT32 a) +{ + if (a >= 0x180000 && a <= 0x183fff) { + UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; + INT32 Offset = (a - 0x180000) >> 1; + + if (Offset & 0x31) { + return BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]); + } else { + Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); + return K053245ReadWord(0, Offset); + } + } + + if ((a & 0xffff80) == 0x1c0500) { + return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(Drv68KRam + 0x4000 + (a & 0x7e)))); + } + + if (a == 0x1c0800) return ssriders_protection_r(); + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ssriders68KWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x180000 && a <= 0x183fff) { + UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; + INT32 Offset = (a - 0x180000) >> 1; + SpriteRam[Offset] = BURN_ENDIAN_SWAP_INT16(d); + + if (!(Offset & 0x0031)) { + Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); + K053245WriteWord(0, Offset, d); + } + return; + } + + if (a >= 0x5a0000 && a <= 0x5a001f) { + INT32 Offset = (a - 0x5a0000) >> 1; + Offset &= ~1; + + K053244Write(0, Offset + 1, d & 0xff); + K053244Write(0, Offset + 0, d >> 8); + return; + } + + if ((a & 0xffff80) == 0x1c0500) { + *((UINT16*)(Drv68KRam + 0x4000 + (a & 0x7e))) = BURN_ENDIAN_SWAP_INT16(d); + return; + } + + if (a == 0x1c0802) { + ssriders_protection_w(2); + return; + } + + switch (a) { + case 0x1c0800: + case 0x1c0802: { + ssriders_protection_w(a - 0x1c0800); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Thndrx268KReadByte(UINT32 a) +{ + K052109WordNoA12Read(0x600000) + K051937ByteRead(0x700000) + + if ((a & 0xffffc00) == 0x700400) { + return K051960Read(a & 0x3ff); + } + + if (a >= 0x500000 && a <= 0x50003f) { + INT32 Offset = (a - 0x500000) >> 1; + if (a & 1) { + return K054000Read(Offset); + } else { + return 0; + } + } + + switch (a) + { + case 0x400001: + case 0x400003: + return K053260Read(0, ((a & 2) >> 1) + 2); + + case 0x500200: + { + INT32 ret = DrvInput[1]^0xff; + if (InitEEPROMCount) { + ret &= 0xf7; + InitEEPROMCount--; + } + return ret; + } + + case 0x500201: + return DrvInput[0]^0xff; + + case 0x500202: + { + static INT32 toggle; + toggle ^= 0x08; + INT32 ret = 0xfe; + ret |= (EEPROMRead() & 1); + ret ^= toggle; + + return ret; + } + + case 0x500203: + return DrvInput[2]^0xff; + } + + + return 0; +} + +void __fastcall Thndrx268KWriteWord(UINT32 a, UINT16 d) +{ + if ((a & 0xffffc00) == 0x700400) { + K051960Write((a & 0x3fe) | 0, d >> 8); + K051960Write((a & 0x3fe) | 1, d & 0xff); + return; + } +} + +void __fastcall Thndrx268KWriteByte(UINT32 a, UINT8 d) +{ + K052109WordNoA12Write(0x600000) + K015937ByteWrite(0x700000) + + if ((a & 0xffffc00) == 0x700400) { + K051960Write(a & 0x3ff, d); + return; + } + + if (a >= 0x300000 && a <= 0x30001f) { + if (a & 1) K053251Write((a - 0x300000) >> 1, d); + return; + } + + if (a >= 0x500000 && a <= 0x50003f) { + INT32 Offset = (a - 0x500000) >> 1; + if (a & 1) K054000Write(Offset, d); + return; + } + + switch (a) + { + case 0x400001: + K053260Write(0, 0, d); + return; + + case 0x500101: + { + EEPROMWriteBit(d & 0x01); + EEPROMSetCSLine((d & 0x02) ? EEPROM_CLEAR_LINE : EEPROM_ASSERT_LINE); + EEPROMSetClockLine((d & 0x04) ? EEPROM_ASSERT_LINE : EEPROM_CLEAR_LINE); + + // EEPROMWrite(d & 0x04, d & 0x02, d & 0x01); + + static INT32 last; + if (last == 0 && (d & 0x20) != 0) { + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } + last = d & 0x20; + + K052109RMRDLine = d & 0x40; + } + return; + } +} + +UINT16 __fastcall Lgtnfght68KReadWord(UINT32 a) +{ + if (a >= 0xb0000 && a <= 0xb3fff) { + UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; + INT32 Offset = (a - 0xb0000) >> 1; + + if (Offset & 0x31) { + return BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]); + } else { + Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); + return K053245ReadWord(0, Offset); + } + } + + return 0; +} + +UINT8 __fastcall Lgtnfght68KReadByte(UINT32 a) +{ + K052109WordNoA12Read(0x100000) + + if (a >= 0xb0000 && a <= 0xb3fff) { + INT32 Offset = (a - 0xb0000); + + if (Offset & (0x31 << 1)) { + return DrvSpriteRam[Offset ^ 1]; + } else { + Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); + return K053245ReadWord(0, Offset / 2) >> ((~a & 1) << 3); + } + } + + if (a >= 0xc0000 && a <= 0xc001f) { + INT32 Offset = (a - 0xc0000) >> 1; + Offset &= ~1; + + if (a & 1) { + return K053244Read(0, Offset + 1); + } else { + return K053244Read(0, Offset + 0); + } + } + + switch (a) + { + case 0x0a0001: + return ~DrvInput[0] & 0xfb; + + case 0x0a0003: + return ~DrvInput[1]; + + case 0x0a0005: + return ~DrvInput[2]; + + case 0x0a0007: + return DrvDip[0]; + + case 0x0a0009: + return DrvDip[1]; + + case 0x0a0011: + return DrvDip[2]; + + case 0x0a0021: + case 0x0a0023: + return K053260Read(0, ((a & 2) >> 1) + 2); // k053260 + } + + return 0; +} + +void __fastcall Lgtnfght68KWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0xb0000 && a <= 0xb3fff) { + UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; + INT32 Offset = (a - 0xb0000) >> 1; + SpriteRam[Offset] = BURN_ENDIAN_SWAP_INT16(d); + + if (!(Offset & 0x0031)) { + Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3); + K053245WriteWord(0, Offset, d); + } + return; + } +} + +void __fastcall Lgtnfght68KWriteByte(UINT32 a, UINT8 d) +{ + K052109WordNoA12Write(0x100000) + + if (a >= 0x0e0000 && a <= 0x0e001f) { + K053251Write((a - 0x0e0000) >> 1, d); + return; + } + + if (a >= 0xb0000 && a <= 0xb3fff) { + INT32 Offset = (a - 0xb0000); + DrvSpriteRam[Offset ^ 1] = d; + + if (!(Offset & (0x31 << 1))) { + Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3); + + INT32 data = K053245ReadWord(0, Offset/2); + + if (a & 1) { + data &= 0xff00; + data |= d; + } else { + data &= 0x00ff; + data |= d << 8; + } + + K053245WriteWord(0, Offset/2, data); + + } + return; + } + + if (a >= 0xc0000 && a <= 0xc001f) { + INT32 Offset = (a - 0xc0000) >> 1; + Offset &= ~1; + + K053244Write(0, Offset + 1, d & 0xff); + K053244Write(0, Offset + 0, 0); // originally d >> 8, but that is effectively 0 + return; + } + + switch (a) + { + case 0xa0019: + { + static INT32 last; + if (last == 0 && (d & 0x4) != 0) { + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } + last = d & 0x4; + + K052109RMRDLine = d & 0x8; + } + return; + + case 0xa0021: + K053260Write(0, 0, d); + return; + + case 0xa0029: // watchdog + return; + } +} + +UINT16 __fastcall Punkshot68KReadWord(UINT32 a) +{ + if ((a & 0xfffc00) == 0x110400) { + return K051960Read((a & 0x3fe) | 1) | (K051960Read((a & 0x3fe) | 0) << 8); + } + + return 0; +} + +UINT8 __fastcall Punkshot68KReadByte(UINT32 a) +{ + K052109WordNoA12Read(0x100000) + K051937ByteRead(0x110000) + K051960ByteRead(0x110400) + + switch (a) + { + case 0x0a0000: + return DrvDip[1]; + + case 0x0a0001: + return DrvDip[0]; + + case 0x0a0003: + return ~DrvInput[0]; + + case 0x0a0002: + return DrvDip[2] | (~DrvInput[5] & 0x0f); + + case 0x0a0005: + return ~DrvInput[3]; + + case 0x0a0004: + return ~DrvInput[4]; + + case 0x0a0007: + return ~DrvInput[1]; + + case 0x0a0006: + return ~DrvInput[2]; + + case 0x0a0041: + case 0x0a0043: + return K053260Read(0, ((a & 2) >> 1) | 2); + + case 0xfffffc: + case 0xfffffd: + case 0xfffffe: + case 0xffffff: + return rand(); + } + + return 0; +} + +void __fastcall Punkshot68KWriteWord(UINT32 a, UINT16 d) +{ + if ((a & 0xfffc00) == 0x110400) { + K051960Write((a & 0x3fe) | 0, d >> 8); + K051960Write((a & 0x3fe) | 1, d & 0xff); + + return; + } + + if ((a & 0xff8000) == 0x100000) { + SekWriteByte(a+1, d & 0xff); + return; + } +} + +void __fastcall Punkshot68KWriteByte(UINT32 a, UINT8 d) +{ + K052109WordNoA12Write(0x100000) + K015937ByteWrite(0x110000) + K051960ByteWrite(0x110400) + + if ((a & 0xffffe1) == 0xa0061) { + K053251Write((a & 0x1f) >> 1, d); + return; + } + + switch (a) + { + case 0x0a0020: + case 0x0a0021: + { + static INT32 last; + K052109RMRDLine = d & 0x08; + + if (last == 0x04 && (d & 0x04) == 0x00) { + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } + + last = d & 0x04; + } + return; + + case 0x0a0041: + K053260Write(0, 0, d); + return; + + case 0x0a0081: + // watchdog + return; + } +} + +UINT8 __fastcall TmntZ80Read(UINT16 a) +{ + if (a >= 0xb000 && a <= 0xb00d) { + return K007232ReadReg(0, a - 0xb000); + } + + switch (a) { + case 0x9000: { + return TitleSoundLatch; + } + + case 0xa000: { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return DrvSoundLatch; + } + + case 0xc001: { + return BurnYM2151ReadStatus(); + } + + case 0xf000: { + return UPD7759BusyRead(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall TmntZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0xb000 && a <= 0xb00d) { + K007232WriteReg(0, (a - 0xb000), d); + return; + } + + switch (a) { + case 0x9000: { + TitleSoundLatch = d; + if (d & 0x04) { + PlayTitleSample = 1; + } else { + PlayTitleSample = 0; + TitleSamplePos = 0; + } + + UPD7759ResetWrite(0, d & 2); + return; + } + + case 0xc000: { + BurnYM2151SelectRegister(d); + return; + } + + case 0xc001: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xd000: { + UPD7759PortWrite(0, d); + return; + } + + case 0xe000: { + UPD7759StartWrite(0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall MiaZ80Read(UINT16 a) +{ + if (a >= 0xb000 && a <= 0xb00d) { + return K007232ReadReg(0, a - 0xb000); + } + + switch (a) { + case 0xa000: { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return DrvSoundLatch; + } + + case 0xc001: { + return BurnYM2151ReadStatus(); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall MiaZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0xb000 && a <= 0xb00d) { + K007232WriteReg(0, (a - 0xb000), d); + return; + } + + switch (a) { + case 0xc000: { + BurnYM2151SelectRegister(d); + return; + } + + case 0xc001: { + BurnYM2151WriteRegister(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall BlswhstlZ80Read(UINT16 a) +{ + if (a >= 0xfa00 && a <= 0xfa2f) { + if (a == 0xfa00) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return K053260Read(0, a - 0xfa00); + } + + switch (a) { + case 0xf801: { + return BurnYM2151ReadStatus(); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall BlswhstlZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0xfa00 && a <= 0xfa2f) { + K053260Write(0, (a - 0xfa00), d); + return; + } + + switch (a) { + case 0xf800: { + BurnYM2151SelectRegister(d); + return; + } + + case 0xf801: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xfc00: { // tmnt2 needs this + ZetRun(100); + ZetNmi(); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall Thndrx2Z80Write(UINT16 a, UINT8 d) +{ + if (a >= 0xfc00 && a <= 0xfc2f) { + K053260Write(0, (a - 0xfc00), d); + return; + } + + switch (a) + { + case 0xf800: + case 0xf810: + BurnYM2151SelectRegister(d); + return; + + case 0xf801: + case 0xf811: + BurnYM2151WriteRegister(d); + return; + + case 0xfa00: + ZetRun(100); + ZetNmi(); + return; + } +} + +UINT8 __fastcall Thndrx2Z80Read(UINT16 a) +{ + if (a >= 0xfc00 && a <= 0xfc2f) { + if (a == 0xfc00) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return K053260Read(0, a - 0xfc00); + } + + switch (a) + { + case 0xf801: + case 0xf811: + return BurnYM2151ReadStatus(); + } + + return 0; +} + +void __fastcall LgtnfghtZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0xc000 && a <= 0xc02f) { + K053260Write(0, (a - 0xc000), d); + return; + } + + switch (a) + { + case 0xa000: + BurnYM2151SelectRegister(d); + return; + + case 0xa001: + BurnYM2151WriteRegister(d); + return; + } +} + +UINT8 __fastcall LgtnfghtZ80Read(UINT16 a) +{ + if (a >= 0xc000 && a <= 0xc02f) { + if (a == 0xc000) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return K053260Read(0, a - 0xc000); + } + + switch (a) + { + case 0xa001: + return BurnYM2151ReadStatus(); + } + + return 0; +} + +static void shuffle(UINT16 *buf, INT32 len) +{ + INT32 i; + UINT16 t; + + if (len == 2) return; + + if (len % 4) return; + + len /= 2; + + for (i = 0;i < len/2;i++) { + t = buf[len/2 + i]; + buf[len/2 + i] = buf[len + i]; + buf[len + i] = t; + } + + shuffle(buf,len); + shuffle(buf + len,len); +} + +static void byte_shuffle(UINT8 *buf, INT32 len) +{ + INT32 i; + UINT8 t; + + if (len == 2) return; + + if (len % 4) return; + + len /= 2; + + for (i = 0;i < len/2;i++) { + t = buf[len/2 + i]; + buf[len/2 + i] = buf[len + i]; + buf[len + i] = t; + } + + byte_shuffle(buf,len); + byte_shuffle(buf + len,len); +} + +static void TmntUnscrambleGfx(UINT8 *pSrc, INT32 nLength) +{ + INT32 bits[32]; + for (INT32 i = 0; i < nLength; i += 4) { + for (INT32 j = 0; j < 4; j++) { + for (INT32 k = 0; k < 8; k++) { + bits[8*j + k] = (pSrc[i + j] >> k) & 1; + } + } + + for (INT32 j = 0; j < 4; j++) { + pSrc[i + j] = 0; + for (INT32 k = 0; k < 8; k++) { + pSrc[i + j] |= bits[j + 4*k] << k; + } + } + } +} + +static void TmntUnscrambleSprites() +{ + BurnLoadRom(DrvTempRom + 0x200000, 11, 1); + UINT8 *SpriteConvTable = DrvTempRom + 0x200000; + + memcpy(DrvTempRom, DrvSpriteRom, 0x200000); + + for (INT32 A = 0; A < 0x80000; A++) { + INT32 B, i, entry; + INT32 bits[10]; + + static const UINT8 bit_pick_table[10][8] = { + { 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 5, 5, 5, 5, 5, 5 }, + { 1, 1, 0, 0, 0, 7, 7, 7 }, + { 2, 2, 1, 1, 1, 0, 0, 9 }, + { 4, 4, 2, 2, 2, 1, 1, 0 }, + { 5, 6, 4, 4, 4, 2, 2, 1 }, + { 6, 5, 6, 6, 6, 4, 4, 2 }, + { 7, 7, 7, 7, 8, 6, 6, 4 }, + { 8, 8, 8, 8, 7, 8, 8, 6 }, + { 9, 9, 9, 9, 9, 9, 9, 8 } + }; + + entry = SpriteConvTable[(A & 0x7f800) >> 11] & 7; + + for (i = 0;i < 10;i++) + bits[i] = (A >> i) & 0x01; + + B = A & 0x7fc00; + + for (i = 0; i < 10;i++) B |= bits[bit_pick_table[i][entry]] << i; + + DrvSpriteRom[4*A+0] = DrvTempRom[4*B+0]; + DrvSpriteRom[4*A+1] = DrvTempRom[4*B+1]; + DrvSpriteRom[4*A+2] = DrvTempRom[4*B+2]; + DrvSpriteRom[4*A+3] = DrvTempRom[4*B+3]; + } +} + +static void MiaUnscrambleSprites() +{ + memcpy(DrvTempRom, DrvSpriteRom, 0x100000); + + for (INT32 A = 0; A < 0x40000; A++) { + INT32 B, i; + INT32 bits[8]; + for (i = 0; i < 8; i++) bits[i] = (A >> i) & 0x01; + + B = A & 0x3ff00; + + if ((A & 0x3c000) == 0x3c000) { + B |= bits[3] << 0; + B |= bits[5] << 1; + B |= bits[0] << 2; + B |= bits[1] << 3; + B |= bits[2] << 4; + B |= bits[4] << 5; + B |= bits[6] << 6; + B |= bits[7] << 7; + } else { + B |= bits[3] << 0; + B |= bits[5] << 1; + B |= bits[7] << 2; + B |= bits[0] << 3; + B |= bits[1] << 4; + B |= bits[2] << 5; + B |= bits[4] << 6; + B |= bits[6] << 7; + } + + DrvSpriteRom[4*A+0] = DrvTempRom[4*B+0]; + DrvSpriteRom[4*A+1] = DrvTempRom[4*B+1]; + DrvSpriteRom[4*A+2] = DrvTempRom[4*B+2]; + DrvSpriteRom[4*A+3] = DrvTempRom[4*B+3]; + } +} + +static void TmntDecodeTitleSample() +{ + for (INT32 i = 0; i < 0x40000; i++) { + INT32 val = DrvTempRom[2 * i + 0] + (DrvTempRom[(2 * i) + 1] << 8); + INT32 expo = val >> 13; + + val = (val >> 3) & (0x3ff); + val -= 0x200; + + val <<= (expo-3); + + DrvTitleSample[i] = val; + } +} + +static void TmntTitleSampleSetRoute(double nVolume, INT32 nRouteDir) +{ + TitleSampleGain = nVolume; + TitleSampleOutputDir = nRouteDir; +} + +static INT32 TilePlaneOffsets[4] = { 24, 16, 8, 0 }; +static INT32 TileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 TileYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 SpritePlaneOffsets[4] = { 24, 16, 8, 0 }; +static INT32 SpritePlaneOffsets2[4] = { 0, 8, 16, 24 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 256, 257, 258, 259, 260, 261, 262, 263 }; +static INT32 SpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; + +static void K052109TmntCallback(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32*, INT32 *) +{ + *Code |= ((*Colour & 0x03) << 8) | ((*Colour & 0x10) << 6) | ((*Colour & 0x0c) << 9) | (Bank << 13); + *Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5); +} + +static void K052109MiaCallback(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32 *xFlip, INT32 *) +{ + *xFlip = *Colour & 0x04; + + if (Layer == 0) { + *Code |= ((*Colour & 0x01) << 8); + *Colour = LayerColourBase[Layer] + ((*Colour & 0x80) >> 5) + ((*Colour & 0x10) >> 1); + } else { + *Code |= ((*Colour & 0x01) << 8) | ((*Colour & 0x18) << 6) | (Bank << 11); + *Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5); + } +} + +static void K052109CuebrickCallback(INT32 Layer, INT32, INT32 *Code, INT32 *Colour, INT32 *, INT32 *) +{ + if (K052109RMRDLine == 0 && Layer == 0) { + *Code |= ((*Colour & 0x01) << 8); + *Colour = LayerColourBase[Layer] + ((*Colour & 0x80) >> 5) + ((*Colour & 0x10) >> 1); + } else { + *Code |= ((*Colour & 0x0f) << 8); + *Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5); + } +} + +static void K052109BlswhstlCallback(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32 *, INT32 *) +{ + *Code |= ((*Colour & 0x01) << 8) | ((*Colour & 0x10) << 5) | ((*Colour & 0x0c) << 8) | (Bank << 12) | (BlswhstlTileRomBank << 14); + *Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5); +} + +static void K051960TmntCallback(INT32 *Code, INT32 *Colour, INT32*, INT32*) +{ + *Code |= (*Colour & 0x10) << 9; + *Colour = SpriteColourBase + (*Colour & 0x0f); +} + +static void K051960MiaCallback(INT32* /*Code*/, INT32 *Colour, INT32*, INT32*) +{ + *Colour = SpriteColourBase + (*Colour & 0x0f); +} + +static void K051960CuebrickCallback(INT32* Code, INT32 *Colour, INT32*, INT32*) +{ + *Colour = SpriteColourBase + (*Colour & 0x0f); + *Code &= 0xfff; +} + +static void K051960Thndrx2Callback(INT32* code, INT32 *color, INT32* priority, INT32*) +{ + INT32 pri = 0x20 | ((*color & 0x60) >> 2); + if (pri <= LayerPri[2]) *priority = 0; + else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 1; + else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 2; + else *priority = 3; + + *code &= 0x1fff; + *color = SpriteColourBase + (*color & 0x0f); +} + +static void K051960PunkshotCallback(INT32 *code, INT32 *color, INT32 *priority, INT32 *) +{ + INT32 pri = 0x20 | ((*color & 0x60) >> 2); + if (pri <= LayerPri[2]) *priority = 0; + else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 1; + else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 2; + else *priority = 3; + + *code |= (*color & 0x10) << 9; + *code &= 0x3fff; + *color = SpriteColourBase + (*color & 0x0f); +} + +static void K053245BlswhstlCallback(INT32 *Code, INT32 *Colour, INT32 *Priority) +{ + INT32 Pri = 0x20 | ((*Colour & 0x60) >> 2); + if (Pri <= LayerPri[2]) *Priority = 0; + else if (Pri > LayerPri[2] && Pri <= LayerPri[1]) *Priority = 1; + else if (Pri > LayerPri[1] && Pri <= LayerPri[0]) *Priority = 2; + else *Priority = 3; + + *Code &= 0x1fff; + *Colour = SpriteColourBase + (*Colour & 0x1f); +} + +static void K053245SsridersCallback(INT32 *, INT32 *Colour, INT32 *Priority) +{ + INT32 Pri = 0x20 | ((*Colour & 0x60) >> 2); + if (Pri <= LayerPri[2]) *Priority = 0; + else if (Pri > LayerPri[2] && Pri <= LayerPri[1]) *Priority = 1; + else if (Pri > LayerPri[1] && Pri <= LayerPri[0]) *Priority = 2; + else *Priority = 3; + + *Colour = SpriteColourBase + (*Colour & 0x1f); +} + +static void K053245LgtnfghtCallback(INT32 *code, INT32 *color, INT32 *priority) +{ + INT32 pri = 0x20 | ((*color & 0x60) >> 2); + if (pri <= LayerPri[2]) *priority = 0; + else if (pri > LayerPri[2] && pri <= LayerPri[1]) *priority = 1; + else if (pri > LayerPri[1] && pri <= LayerPri[0]) *priority = 2; + else *priority = 3; + + *color = SpriteColourBase + (*color & 0x1f); + *code &= 0x3fff; +} + +static void DrvK007232VolCallback(INT32 v) +{ + K007232SetVolume(0, 0, (v >> 4) * 0x11, 0); + K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); +} + +static void CuebrickYM2151IrqHandler(INT32 Irq) +{ + CuebrickSndIrqFire = Irq; +} + +static INT32 TmntInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + TmntMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + TmntMemIndex(); + + K052109Init(DrvTileRom, 0x0fffff); + K052109SetCallback(K052109TmntCallback); + K051960Init(DrvSpriteRom, 0x1fffff); + K051960SetCallback(K051960TmntCallback); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x040001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x040000, 3, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1; + shuffle((UINT16*)DrvTileRom, 0x080000); + TmntUnscrambleGfx(DrvTileRom, 0x100000); + GfxDecode(0x100000 / 32, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); + + // Load the sprites + DrvTempRom = (UINT8 *)BurnMalloc(0x200100); + nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x080000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x100000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x180000, 10, 1); if (nRet != 0) return 1; + shuffle((UINT16*)DrvSpriteRom, 0x100000); + TmntUnscrambleGfx(DrvSpriteRom, 0x200000); + TmntUnscrambleSprites(); + + // Decode the sprites + GfxDecode(0x200000 / 128, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites); + + // Load K007232 Sample Roms + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1; + + // Load UPD7759C Sample Roms + nRet = BurnLoadRom(DrvUPD7759CRom + 0x00000, 14, 1); if (nRet != 0) return 1; + + // Load title sample + memset(DrvTempRom, 0, 0x080000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 15, 1); if (nRet != 0) return 1; + TmntDecodeTitleSample(); + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x060000, 0x063fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x080000, 0x080fff, SM_RAM); + SekSetReadWordHandler(0, Tmnt68KReadWord); + SekSetWriteWordHandler(0, Tmnt68KWriteWord); + SekSetReadByteHandler(0, Tmnt68KReadByte); + SekSetWriteByteHandler(0, Tmnt68KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(TmntZ80Read); + ZetSetWriteHandler(TmntZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + + K007232Init(0, 3579545, DrvSoundRom, 0x20000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback); + K007232PCMSetAllRoutes(0, 0.33, BURN_SND_ROUTE_BOTH); + + UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvUPD7759CRom); + UPD7759SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); + + TmntTitleSampleSetRoute(1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + LayerColourBase[0] = 0; + LayerColourBase[1] = 32; + LayerColourBase[2] = 40; + SpriteColourBase = 16; + + // Reset the driver + TmntDoReset(); + + return 0; +} + +static INT32 MiaInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MiaMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MiaMemIndex(); + + K052109Init(DrvTileRom, 0x03ffff); + K052109SetCallback(K052109MiaCallback); + K051960Init(DrvSpriteRom, 0x0fffff); + K051960SetCallback(K051960MiaCallback); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x000001, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x020000, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x020001, 6, 2); if (nRet != 0) return 1; + shuffle((UINT16*)DrvTileRom, 0x020000); + TmntUnscrambleGfx(DrvTileRom, 0x040000); + GfxDecode(0x2000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); + + // Load the sprites + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x080000, 8, 1); if (nRet != 0) return 1; + shuffle((UINT16*)DrvSpriteRom, 0x080000); + TmntUnscrambleGfx(DrvSpriteRom, 0x100000); + MiaUnscrambleSprites(); + + // Decode the sprites + GfxDecode(0x2000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites); + + // Load K007232 Sample Roms + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 10, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRam + 0x0000 , 0x040000, 0x043fff, SM_RAM); + SekMapMemory(Drv68KRam + 0x4000 , 0x060000, 0x063fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x080000, 0x080fff, SM_RAM); + SekSetReadWordHandler(0, Mia68KReadWord); + SekSetWriteWordHandler(0, Mia68KWriteWord); + SekSetReadByteHandler(0, Mia68KReadByte); + SekSetWriteByteHandler(0, Mia68KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(MiaZ80Read); + ZetSetWriteHandler(MiaZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + + K007232Init(0, 3579545, DrvSoundRom, 0x20000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback); + K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + LayerColourBase[0] = 0; + LayerColourBase[1] = 32; + LayerColourBase[2] = 40; + SpriteColourBase = 16; + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 CuebrickInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + CuebrickMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + CuebrickMemIndex(); + + K052109Init(DrvTileRom, 0x03ffff); + K052109SetCallback(K052109CuebrickCallback); + + K051960Init(DrvSpriteRom, 0x03ffff); + K051960SetCallback(K051960CuebrickCallback); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTileRom + 0x000000, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x000001, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x020000, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x020001, 5, 2); if (nRet != 0) return 1; + byte_shuffle(DrvTileRom, 0x040000); + GfxDecode(0x2000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); + + // Load the sprites + nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x000001, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x020000, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x020001, 9, 2); if (nRet != 0) return 1; + byte_shuffle(DrvSpriteRom, 0x040000); + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x01ffff, SM_ROM); + SekMapMemory(Drv68KRam + 0x0000 , 0x040000, 0x043fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x080000, 0x080fff, SM_RAM); + SekSetReadWordHandler(0, Cuebrick68KReadWord); + SekSetWriteWordHandler(0, Cuebrick68KWriteWord); + SekSetReadByteHandler(0, Cuebrick68KReadByte); + SekSetWriteByteHandler(0, Cuebrick68KWriteByte); + SekClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&CuebrickYM2151IrqHandler); + BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + LayerColourBase[0] = 0; + LayerColourBase[1] = 32; + LayerColourBase[2] = 40; + SpriteColourBase = 16; + + // Reset the driver + CuebrickDoReset(); + + return 0; +} + +static INT32 BlswhstlInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + BlswhstlMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + BlswhstlMemIndex(); + + K052109Init(DrvTileRom, 0x0fffff); + K052109SetCallback(K052109BlswhstlCallback); + K052109AdjustScroll(8, 0); + + K053245Init(0, DrvSpriteRom, 0xfffff, K053245BlswhstlCallback); + K053245SetSpriteOffset(0, -112, 16); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x040001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x040000, 3, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1; + BurnByteswap(DrvTileRom, 0x100000); + konami_rom_deinterleave_2(DrvTileRom, 0x100000); + GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); + + // Load the sprites + nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x080000, 8, 1); if (nRet != 0) return 1; + BurnByteswap(DrvSpriteRom, 0x100000); + konami_rom_deinterleave_2(DrvSpriteRom, 0x100000); + K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x100000); + + // Load K053260 Sample Roms + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x204000, 0x207fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x400000, 0x400fff, SM_RAM); + SekSetReadWordHandler(0, Blswhstl68KReadWord); + SekSetWriteWordHandler(0, Blswhstl68KWriteWord); + SekSetReadByteHandler(0, Blswhstl68KReadByte); + SekSetWriteByteHandler(0, Blswhstl68KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(BlswhstlZ80Read); + ZetSetWriteHandler(BlswhstlZ80Write); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT); + + K053260Init(0, 3579545, DrvSoundRom, 0x100000); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.50, BURN_SND_ROUTE_RIGHT); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.50, BURN_SND_ROUTE_LEFT); + + EEPROMInit(&BlswhstlEEPROMInterface); + + GenericTilesInit(); + + // Reset the driver + BlswhstlDoReset(); + + return 0; +} + +static INT32 SsridersInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + SsridersMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + SsridersMemIndex(); + + K052109Init(DrvTileRom, 0x0fffff); + K052109SetCallback(K052109TmntCallback); + K052109AdjustScroll(8, 0); + + K053245Init(0, DrvSpriteRom, 0x1fffff, K053245LgtnfghtCallback); + K053245SetSpriteOffset(0, -368, 528); + K05324xSetZRejection(0); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x080001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x080000, 3, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvTileRom, 0x100000); + GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); + + // Load the sprites + nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x100000, 8, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvSpriteRom, 0x200000); + K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x200000); + + // Load K053260 Sample Roms + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x0bffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x104000, 0x107fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x140000, 0x140fff, SM_RAM); + SekSetReadWordHandler(0, Ssriders68KReadWord); + SekSetWriteWordHandler(0, Ssriders68KWriteWord); + SekSetReadByteHandler(0, Ssriders68KReadByte); + SekSetWriteByteHandler(0, Ssriders68KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(BlswhstlZ80Read); + ZetSetWriteHandler(BlswhstlZ80Write); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + K053260Init(0, 3579545, DrvSoundRom, 0x100000); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT); + + EEPROMInit(&BlswhstlEEPROMInterface); + + GenericTilesInit(); + + // Reset the driver + SsridersDoReset(); + + return 0; +} + +static INT32 Thndrx2Init() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + Thndrx2MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + Thndrx2MemIndex(); + + K052109Init(DrvTileRom, 0x0fffff); + K052109SetCallback(K052109TmntCallback); + K052109AdjustScroll(8, 0); + + K051960Init(DrvSpriteRom, 0x0fffff); + K051960SetCallback(K051960Thndrx2Callback); + K051960SetSpriteOffset(8, 0); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x080000, 4, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvTileRom, 0x100000); + GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); + + // Load the sprites + nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x080000, 6, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvSpriteRom, 0x100000); + GfxDecode(0x2000, 4, 16, 16, SpritePlaneOffsets2, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites); + + // Load K053260 Sample Roms + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 7, 1); if (nRet != 0) return 1; + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x200000, 0x200fff, SM_RAM); + SekSetWriteWordHandler(0, Thndrx268KWriteWord); + SekSetReadByteHandler(0, Thndrx268KReadByte); + SekSetWriteByteHandler(0, Thndrx268KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Thndrx2Z80Read); + ZetSetWriteHandler(Thndrx2Z80Write); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + K053260Init(0, 3579545, DrvSoundRom, 0x80000); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); + + EEPROMInit(&thndrx2_eeprom_interface); + + GenericTilesInit(); + + // Reset the driver + SsridersDoReset(); + + return 0; +} + +static INT32 LgtnfghtInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + LgtnfghtMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + LgtnfghtMemIndex(); + + K052109Init(DrvTileRom, 0x0fffff); + K052109SetCallback(K052109TmntCallback); + K052109AdjustScroll(8, 0); + + K053245Init(0, DrvSpriteRom, 0x0fffff, K053245LgtnfghtCallback); + K053245SetSpriteOffset(0, -368, 528); + K05324xSetZRejection(0); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x080000, 4, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvTileRom, 0x100000); + GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); + + // Load the sprites + nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x080000, 6, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvSpriteRom, 0x100000); + K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x100000); + + // Load K053260 Sample Roms + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 7, 1); if (nRet != 0) return 1; + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPaletteRam , 0x080000, 0x080fff, SM_RAM); + SekMapMemory(Drv68KRam , 0x090000, 0x093fff, SM_RAM); + SekSetReadWordHandler(0, Lgtnfght68KReadWord); + SekSetWriteWordHandler(0, Lgtnfght68KWriteWord); + SekSetReadByteHandler(0, Lgtnfght68KReadByte); + SekSetWriteByteHandler(0, Lgtnfght68KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(LgtnfghtZ80Read); + ZetSetWriteHandler(LgtnfghtZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + K053260Init(0, 3579545, DrvSoundRom, 0x80000); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT); + + EEPROMInit(&thndrx2_eeprom_interface); + + GenericTilesInit(); + + // Reset the driver + SsridersDoReset(); + + return 0; +} + +static INT32 Tmnt2Init() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + Tmnt2MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + Tmnt2MemIndex(); + + K052109Init(DrvTileRom, 0x0fffff); + K052109SetCallback(K052109TmntCallback); + K052109AdjustScroll(8, 0); + + K053245Init(0, DrvSpriteRom, 0x3fffff, K053245SsridersCallback); + K053245SetSpriteOffset(0, -368, 272); + K05324xSetZRejection(0); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x040001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x040000, 3, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvTileRom, 0x100000); + GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); + + // Load the sprites + nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x100000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x200000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x300000, 10, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvSpriteRom, 0x400000); + K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x400000); + + // Load K053260 Sample Roms + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 11, 1); if (nRet != 0) return 1; + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x104000, 0x107fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x140000, 0x140fff, SM_RAM); + SekSetReadWordHandler(0, Ssriders68KReadWord); + SekSetWriteWordHandler(0, Ssriders68KWriteWord); + SekSetReadByteHandler(0, Ssriders68KReadByte); + SekSetWriteByteHandler(0, Ssriders68KWriteByte); + + SekMapHandler(1, 0x1c0800, 0x1c081f, SM_WRITE); + SekSetWriteWordHandler(1, Tmnt268KProtWord); + SekSetWriteByteHandler(1, Tmnt268KProtByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(BlswhstlZ80Read); + ZetSetWriteHandler(BlswhstlZ80Write); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + K053260Init(0, 3579545, DrvSoundRom, 0x200000); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); + + EEPROMInit(&BlswhstlEEPROMInterface); + + GenericTilesInit(); + + // Reset the driver + SsridersDoReset(); + + return 0; +} + +static INT32 QgakumonInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + Tmnt2MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + Tmnt2MemIndex(); + + K052109Init(DrvTileRom, 0x0fffff); + K052109SetCallback(K052109TmntCallback); + K052109AdjustScroll(0, 0); + + K053245Init(0, DrvSpriteRom, 0x3fffff, K053245SsridersCallback); + K053245SetSpriteOffset(0, -360, 272); + K05324xSetZRejection(0); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x080001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x080000, 3, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvTileRom, 0x100000); + GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); + + // Load the sprites + nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x200000, 8, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvSpriteRom, 0x400000); + K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x400000); + + // Load K053260 Sample Roms + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x104000, 0x107fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x140000, 0x140fff, SM_RAM); + SekSetReadWordHandler(0, Ssriders68KReadWord); + SekSetWriteWordHandler(0, Ssriders68KWriteWord); + SekSetReadByteHandler(0, Ssriders68KReadByte); + SekSetWriteByteHandler(0, Ssriders68KWriteByte); + + SekMapHandler(1, 0x1c0800, 0x1c081f, SM_WRITE); + SekSetWriteWordHandler(1, Tmnt268KProtWord); + SekSetWriteByteHandler(1, Tmnt268KProtByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(BlswhstlZ80Read); + ZetSetWriteHandler(BlswhstlZ80Write); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + K053260Init(0, 3579545, DrvSoundRom, 0x200000); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); + + EEPROMInit(&BlswhstlEEPROMInterface); + + GenericTilesInit(); + + // Reset the driver + SsridersDoReset(); + + return 0; +} + +static INT32 PunkshotInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + PunkshotMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PunkshotMemIndex(); + + K052109Init(DrvTileRom, 0x07ffff); + K052109SetCallback(K052109TmntCallback); + K052109AdjustScroll(8, 0); + + K051960Init(DrvSpriteRom, 0x1fffff); + K051960SetCallback(K051960PunkshotCallback); + K051960SetSpriteOffset(8, 0); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTileRom + 0x040000, 4, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvTileRom, 0x80000); + GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles); + + // Load the sprites + nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSpriteRom + 0x100000, 6, 1); if (nRet != 0) return 1; + konami_rom_deinterleave_2(DrvSpriteRom, 0x200000); + GfxDecode(0x4000, 4, 16, 16, SpritePlaneOffsets2, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites); + + // Load K053260 Sample Roms + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 7, 1); if (nRet != 0) return 1; + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x080000, 0x083fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x090000, 0x090fff, SM_RAM); + SekSetReadWordHandler(0, Punkshot68KReadWord); + SekSetWriteWordHandler(0, Punkshot68KWriteWord); + SekSetReadByteHandler(0, Punkshot68KReadByte); + SekSetWriteByteHandler(0, Punkshot68KWriteByte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Thndrx2Z80Read); + ZetSetWriteHandler(Thndrx2Z80Write); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom ); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + + K053260Init(0, 3579545, DrvSoundRom, 0x80000); + K053260PCMSetAllRoutes(0, 0.70, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + srand ( time(NULL) ); + + // Reset the driver + PunkshotDoReset(); + + return 0; +} + +static INT32 CommonExit() +{ + SekExit(); + + BurnYM2151Exit(); + + GenericTilesExit(); + + KonamiICExit(); + + BurnFree(Mem); + + bIrqEnable = 0; + DrvSoundLatch = 0; + TitleSoundLatch = 0; + PlayTitleSample = 0; + TitleSamplePos = 0; + SpriteColourBase = 0; + memset(LayerColourBase, 0, 3); + memset(LayerPri, 0, 3); + PriorityFlag = 0; + + DrvNvRamBank = 0; + CuebrickSndIrqFire = 0; + BlswhstlTileRomBank = 0; + DrvVBlank = 0; + InitEEPROMCount = 0; + + return 0; +} + +static INT32 CommonZ80Exit() +{ + ZetExit(); + + return CommonExit(); +} + +static INT32 TmntExit() +{ + UPD7759Exit(); + K007232Exit(); + + return CommonZ80Exit(); +} + +static INT32 MiaExit() +{ + K007232Exit(); + + return CommonZ80Exit(); +} + +static INT32 BlswhstlExit() +{ + K053260Exit(); + EEPROMExit(); + + return CommonZ80Exit(); +} + +static INT32 PunkshotExit() +{ + K053260Exit(); + + return CommonZ80Exit(); +} + +static inline UINT8 pal5bit(UINT8 bits) +{ + bits &= 0x1f; + return (bits << 3) | (bits >> 2); +} + +static void DrvCalcPalette() +{ + UINT16 *PaletteRam = (UINT16*)DrvPaletteRam; + + for (INT32 i = 0; i < 0x800; i += 2) { + INT32 Offset = i & ~1; + UINT32 Data = (BURN_ENDIAN_SWAP_INT16(PaletteRam[Offset]) << 8) | BURN_ENDIAN_SWAP_INT16(PaletteRam[Offset + 1]); + + Palette[Offset >> 1] = (pal5bit(Data >> 0) << 16) | (pal5bit(Data >> 5) << 8) | pal5bit(Data >> 10); + DrvPalette[Offset >> 1] = BurnHighCol(pal5bit(Data >> 0), pal5bit(Data >> 5), pal5bit(Data >> 10), 0); + } +} + +static void BlswhstlCalcPalette() +{ + UINT16 *PaletteRam = (UINT16*)DrvPaletteRam; + + for (INT32 i = 0; i < 0x800; i++) { + UINT32 Data = BURN_ENDIAN_SWAP_INT16(PaletteRam[i]); + + Palette[i] = (pal5bit(Data >> 0) << 16) | (pal5bit(Data >> 5) << 8) | pal5bit(Data >> 10); + DrvPalette[i] = BurnHighCol(pal5bit(Data >> 0), pal5bit(Data >> 5), pal5bit(Data >> 10), 0); + } +} + +static void TmntDraw() +{ + DrvCalcPalette(); + K052109UpdateScroll(); + + K052109RenderLayer(2, 1, DrvTiles); + if ((PriorityFlag & 1) == 1) K051960SpritesRender(DrvSprites, -1); + K052109RenderLayer(1, 0, DrvTiles); + if ((PriorityFlag & 1) == 0) K051960SpritesRender(DrvSprites, -1); + K052109RenderLayer(0, 0, DrvTiles); + + BurnTransferCopy(DrvPalette); +} + +static void sortlayers(INT32 *layer,INT32 *pri) +{ +#define SWAP(a,b) \ + if (pri[a] < pri[b]) \ + { \ + INT32 t; \ + t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ + t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ + } + + SWAP(0,1) + SWAP(0,2) + SWAP(1,2) +} + +static inline void BlswhstlCalcPaletteWithContrast(INT32 i, INT32 brt) +{ + INT32 r,g,b; + UINT16 *PaletteRam = (UINT16*)DrvPaletteRam; + + UINT32 Data = BURN_ENDIAN_SWAP_INT16(PaletteRam[i]); + + r = pal5bit(Data >> 0); + g = pal5bit(Data >> 5); + b = pal5bit(Data >> 10); + + r = (r * brt) / 100; + g = (g * brt) / 100; + b = (b * brt) / 100; + + DrvPalette[i] = BurnHighCol(r, g, b, 0); +} + +static void PaletteDim(INT32 dimslayer) +{ + INT32 i, dim, en, cb, ce, brt; + + dim = dim_v | ((~dim_c & 0x10) >> 1); + en = (K053251GetPriority(5) && K053251GetPriority(5) != 0x3e); + + brt = 100; + if (en) brt -= 40*dim/8; + + if (brt < 100) { + cb = LayerColourBase[dimslayer] << 4; + ce = cb + 128; + + for (i = 0; i < cb; i++) + BlswhstlCalcPaletteWithContrast(i, brt); + + for (i = cb; i < ce; i++) // text + BlswhstlCalcPaletteWithContrast(i, 100); + + for (i = ce; i < 2048; i++) + BlswhstlCalcPaletteWithContrast(i, brt); + } else { + BlswhstlCalcPalette(); + } +} + +static void BlswhstlDraw() +{ + INT32 Layer[3]; + + K052109UpdateScroll(); + + INT32 BGColourBase = K053251GetPaletteIndex(0); + SpriteColourBase = K053251GetPaletteIndex(1); + LayerColourBase[0] = K053251GetPaletteIndex(2); + LayerColourBase[1] = K053251GetPaletteIndex(4); + LayerColourBase[2] = K053251GetPaletteIndex(3); + + LayerPri[0] = K053251GetPriority(2); + LayerPri[1] = K053251GetPriority(4); + LayerPri[2] = K053251GetPriority(3); + Layer[0] = 0; + Layer[1] = 1; + Layer[2] = 2; + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 16 * BGColourBase; + } + + sortlayers(Layer, LayerPri); + + PaletteDim(Layer[2]); + + K053245SpritesRender(0, DrvSprites, 3); + if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 0, DrvTiles); + K053245SpritesRender(0, DrvSprites, 2); + if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, DrvTiles); + K053245SpritesRender(0, DrvSprites, 1); + K053245SpritesRender(0, DrvSprites, 0); + if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, DrvTiles); + + KonamiBlendCopy(Palette, DrvPalette); +} + +static INT32 Thndrx2Draw() +{ + INT32 Layer[3]; + + BlswhstlCalcPalette(); + K052109UpdateScroll(); + + INT32 BGColourBase = K053251GetPaletteIndex(0); + SpriteColourBase = K053251GetPaletteIndex(1); + LayerColourBase[0] = K053251GetPaletteIndex(2); + LayerColourBase[1] = K053251GetPaletteIndex(4); + LayerColourBase[2] = K053251GetPaletteIndex(3); + + LayerPri[0] = K053251GetPriority(2); + LayerPri[1] = K053251GetPriority(4); + LayerPri[2] = K053251GetPriority(3); + Layer[0] = 0; + Layer[1] = 1; + Layer[2] = 2; + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 16 * BGColourBase; + } + + sortlayers(Layer, LayerPri); + + if (nSpriteEnable & 8) K051960SpritesRender(DrvSprites, 3); + if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 0, DrvTiles); + if (nSpriteEnable & 4) K051960SpritesRender(DrvSprites, 2); + if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, DrvTiles); + if (nSpriteEnable & 2) K051960SpritesRender(DrvSprites, 1); + if (nSpriteEnable & 1) K051960SpritesRender(DrvSprites, 0); + if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, DrvTiles); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 PunkshotDraw() +{ + INT32 Layer[3]; + + BlswhstlCalcPalette(); + K052109UpdateScroll(); + +// INT32 BGColourBase = K053251GetPaletteIndex(0); + SpriteColourBase = K053251GetPaletteIndex(1); + LayerColourBase[0] = K053251GetPaletteIndex(2); + LayerColourBase[1] = K053251GetPaletteIndex(4); + LayerColourBase[2] = K053251GetPaletteIndex(3); + + LayerPri[0] = K053251GetPriority(2); + LayerPri[1] = K053251GetPriority(4); + LayerPri[2] = K053251GetPriority(3); + Layer[0] = 0; + Layer[1] = 1; + Layer[2] = 2; + + sortlayers(Layer, LayerPri); + +// if (nSpriteEnable & 8) K051960SpritesRender(DrvSprites, 3); // not sure... + if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 1, DrvTiles); + if (nSpriteEnable & 4) K051960SpritesRender(DrvSprites, 2); + if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, DrvTiles); + if (nSpriteEnable & 2) K051960SpritesRender(DrvSprites, 1); + if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, DrvTiles); + if (nSpriteEnable & 1) K051960SpritesRender(DrvSprites, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static void RenderTitleSample(INT16 *pSoundBuf, INT32 nLength) +{ + double Addr = TitleSamplePos; + double Step = (double)20000 / nBurnSoundRate; + + for (INT32 i = 0; i < nLength; i += 2) { + if (Addr > 0x3ffff) break; + INT16 Sample = DrvTitleSample[(INT32)Addr]; + + INT16 nLeftSample = 0, nRightSample = 0; + + if ((TitleSampleOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { + nLeftSample += (INT32)(Sample * TitleSampleGain); + } + if ((TitleSampleOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { + nRightSample += (INT32)(Sample * TitleSampleGain); + } + + pSoundBuf[i + 0] += nLeftSample; + pSoundBuf[i + 1] += nRightSample; + + Addr += Step; + } + + TitleSamplePos = Addr; +} + +static INT32 TmntFrame() +{ + INT32 nInterleave = nBurnSoundLen; + INT32 nSoundBufferPos = 0; + + if (DrvReset) TmntDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 8000000 / 60; + nCyclesTotal[1] = 3579545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1) && bIrqEnable) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + UPD7759Update(0, pSoundBuf, nSegmentLength); + if (PlayTitleSample) RenderTitleSample(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + UPD7759Update(0, pSoundBuf, nSegmentLength); + if (PlayTitleSample) RenderTitleSample(pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) TmntDraw(); + + return 0; +} + +static INT32 MiaFrame() +{ + INT32 nInterleave = nBurnSoundLen; + INT32 nSoundBufferPos = 0; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 8000000 / 60; + nCyclesTotal[1] = 3579545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1) && bIrqEnable) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) TmntDraw(); + + return 0; +} + +static INT32 CuebrickFrame() +{ + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + + if (DrvReset) CuebrickDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 8000000 / 60; + nCyclesDone[0] = 0; + + SekNewFrame(); + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1) && bIrqEnable) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + if (CuebrickSndIrqFire) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + } + + SekClose(); + + if (pBurnDraw) TmntDraw(); + + return 0; +} + +static INT32 BlswhstlFrame() +{ + INT32 nInterleave = 32; + INT32 nSoundBufferPos = 0; + + if (DrvReset) BlswhstlDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 16000000 / 60; + nCyclesTotal[1] = 3579545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1) && K052109_irq_enabled) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) BlswhstlDraw(); + + K053245ClearBuffer(0); + + return 0; +} + +static INT32 SsridersFrame() +{ + INT32 nInterleave = 262; + INT32 nSoundBufferPos = 0; + + if (DrvReset) SsridersDoReset(); + + SsridersMakeInputs(); + + nCyclesTotal[0] = 16000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 19) DrvVBlank = 0; + if (i == 243) DrvVBlank = 1; + if (i == 243 && K052109_irq_enabled) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) BlswhstlDraw(); + + return 0; +} + +static INT32 Thndrx2Frame() +{ + INT32 nInterleave = 100; + INT32 nSoundBufferPos = 0; + + if (DrvReset) SsridersDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 12000000 / 60; + nCyclesTotal[1] = 3579545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + // Run Z80 + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K052109_irq_enabled) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) Thndrx2Draw(); + + return 0; +} + +static INT32 LgtnfghtFrame() +{ + INT32 nInterleave = 100; + INT32 nSoundBufferPos = 0; + + if (DrvReset) SsridersDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 12000000 / 60; + nCyclesTotal[1] = 3579545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + // Run Z80 + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K052109_irq_enabled) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) BlswhstlDraw(); + + return 0; +} + +static INT32 Tmnt2Frame() +{ + INT32 nInterleave = 262; + INT32 nSoundBufferPos = 0; + + if (DrvReset) SsridersDoReset(); + + SsridersMakeInputs(); + + nCyclesTotal[0] = 16000000 / 60; + nCyclesTotal[1] = 8000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 19) DrvVBlank = 0; + if (i == 243) DrvVBlank = 1; + if (i == 243 && K052109_irq_enabled) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) BlswhstlDraw(); + + return 0; +} + +static INT32 PunkshotFrame() +{ + INT32 nInterleave = 256; + INT32 nSoundBufferPos = 0; + + if (DrvReset) PunkshotDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 12000000 / 60; + nCyclesTotal[1] = 3579545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + // Run Z80 + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (K052109_irq_enabled) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) PunkshotDraw(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029693; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + KonamiICScan(nAction); + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + + BurnYM2151Scan(nAction); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(DrvDip); + SCAN_VAR(DrvInput); + SCAN_VAR(bIrqEnable); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(TitleSoundLatch); + SCAN_VAR(PlayTitleSample); + SCAN_VAR(TitleSamplePos); + SCAN_VAR(PriorityFlag); + } + + return 0; +} + +static INT32 TmntScan(INT32 nAction, INT32 *pnMin) +{ + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + K007232Scan(nAction, pnMin); + UPD7759Scan(0, nAction, pnMin); + } + + return DrvScan(nAction, pnMin); +} + +static INT32 MiaScan(INT32 nAction, INT32 *pnMin) +{ + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + K007232Scan(nAction, pnMin); + } + + return DrvScan(nAction, pnMin); +} + +static INT32 CuebrickScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (nAction & ACB_NVRAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = DrvNvRam; + ba.nLen = 0x400 * 0x20; + ba.szName = "NV RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + KonamiICScan(nAction); + SCAN_VAR(CuebrickSndIrqFire); + } + + return DrvScan(nAction, pnMin); +} + +static INT32 BlswhstlScan(INT32 nAction, INT32 *pnMin) +{ + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + K053260Scan(nAction); + + SCAN_VAR(InitEEPROMCount); + } + + EEPROMScan(nAction, pnMin); + + return DrvScan(nAction, pnMin); +} + +static INT32 SsridersScan(INT32 nAction, INT32 *pnMin) +{ + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + K053260Scan(nAction); + + SCAN_VAR(InitEEPROMCount); + SCAN_VAR(DrvVBlank); + } + + EEPROMScan(nAction, pnMin); + + return DrvScan(nAction, pnMin); +} + +static INT32 Thndrx2aScan(INT32 nAction, INT32 *pnMin) +{ + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + K053260Scan(nAction); + } + + return DrvScan(nAction, pnMin); +} + +struct BurnDriver BurnDrvTmnt = { + "tmnt", NULL, NULL, NULL, "1989", + "Teenage Mutant Ninja Turtles (World 4 Players)\0", NULL, "Konami", "GX963", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, TmntRomInfo, TmntRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, + TmntInit, TmntExit, TmntFrame, NULL, TmntScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmntu = { + "tmntu", "tmnt", NULL, NULL, "1989", + "Teenage Mutant Ninja Turtles (US 4 Players, set 1)\0", NULL, "Konami", "GX963", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, TmntuRomInfo, TmntuRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, + TmntInit, TmntExit, TmntFrame, NULL, TmntScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmntua = { + "tmntua", "tmnt", NULL, NULL, "1989", + "Teenage Mutant Ninja Turtles (US 4 Players, set 2)\0", NULL, "Konami", "GX963", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, TmntuaRomInfo, TmntuaRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, + TmntInit, TmntExit, TmntFrame, NULL, TmntScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmht = { + "tmht", "tmnt", NULL, NULL, "1989", + "Teenage Mutant Hero Turtles (UK 4 Players, set 1)\0", NULL, "Konami", "GX963", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, TmhtRomInfo, TmhtRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, + TmntInit, TmntExit, TmntFrame, NULL, TmntScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmhta = { + "tmhta", "tmnt", NULL, NULL, "1989", + "Teenage Mutant Hero Turtles (UK 4 Players, set 2)\0", NULL, "Konami", "GX963", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, TmhtaRomInfo, TmhtaRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, + TmntInit, TmntExit, TmntFrame, NULL, TmntScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmntj = { + "tmntj", "tmnt", NULL, NULL, "1990", + "Teenage Mutant Ninja Turtles (Japan 4 Players)\0", NULL, "Konami", "GX963", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, TmntjRomInfo, TmntjRomName, NULL, NULL, TmntInputInfo, TmntDIPInfo, + TmntInit, TmntExit, TmntFrame, NULL, TmntScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmht2p = { + "tmht2p", "tmnt", NULL, NULL, "1989", + "Teenage Mutant Hero Turtles (UK 2 Players, set 1)\0", NULL, "Konami", "GX963", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, Tmht2pRomInfo, Tmht2pRomName, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo, + TmntInit, TmntExit, TmntFrame, NULL, TmntScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmht2pa = { + "tmht2pa", "tmnt", NULL, NULL, "1989", + "Teenage Mutant Hero Turtles (UK 2 Players, set 2)\0", NULL, "Konami", "GX963", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, Tmht2paRomInfo, Tmht2paRomName, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo, + TmntInit, TmntExit, TmntFrame, NULL, TmntScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmht2pj = { + "tmnt2pj", "tmnt", NULL, NULL, "1990", + "Teenage Mutant Ninja Turtles (Japan 2 Players)\0", NULL, "Konami", "GX963", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, Tmnt2pjRomInfo, Tmnt2pjRomName, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo, + TmntInit, TmntExit, TmntFrame, NULL, TmntScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmht2po = { + "tmnt2po", "tmnt", NULL, NULL, "1989", + "Teenage Mutant Ninja Turtles (Oceania 2 Players)\0", NULL, "Konami", "GX963", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, Tmnt2poRomInfo, Tmnt2poRomName, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo, + TmntInit, TmntExit, TmntFrame, NULL, TmntScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMia = { + "mia", NULL, NULL, NULL, "1989", + "M.I.A. - Missing in Action (ver. T)\0", NULL, "Konami", "GX808", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, MiaRomInfo, MiaRomName, NULL, NULL, MiaInputInfo, MiaDIPInfo, + MiaInit, MiaExit, MiaFrame, NULL, MiaScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMia2 = { + "mia2", "mia", NULL, NULL, "1989", + "M.I.A. - Missing in Action (ver. S)\0", NULL, "Konami", "GX808", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, Mia2RomInfo, Mia2RomName, NULL, NULL, MiaInputInfo, MiaDIPInfo, + MiaInit, MiaExit, MiaFrame, NULL, MiaScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvCuebrick = { + "cuebrick", NULL, NULL, NULL, "1989", + "Cue Brick (World ver. D)\0", NULL, "Konami", "GX903", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_PUZZLE, 0, + NULL, CuebrickRomInfo, CuebrickRomName, NULL, NULL, MiaInputInfo, MiaDIPInfo, + CuebrickInit, CommonExit, CuebrickFrame, NULL, CuebrickScan, + NULL, 0x400, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBlswhstl = { + "blswhstl", NULL, NULL, NULL, "1991", + "Bells & Whistles (ver. L)\0", NULL, "Konami", "GX060", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, + NULL, BlswhstlRomInfo, BlswhstlRomName, NULL, NULL, BlswhstlInputInfo, NULL, + BlswhstlInit, BlswhstlExit, BlswhstlFrame, NULL, BlswhstlScan, + NULL, 0x810, 224, 280, 3, 4 +}; + +struct BurnDriver BurnDrvDetatwin = { + "detatwin", "blswhstl", NULL, NULL, "1991", + "Detana!! Twin Bee (Japan ver. J)\0", NULL, "Konami", "GX060", + L"\u51FA\u305F\u306A!! Twin Bee \u30C4\u30A4\u30F3\u30D3\u30FC (Japan ver. J)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, + NULL, DetatwinRomInfo, DetatwinRomName, NULL, NULL, BlswhstlInputInfo, NULL, + BlswhstlInit, BlswhstlExit, BlswhstlFrame, NULL, BlswhstlScan, + NULL, 0x810, 224, 280, 3, 4 +}; + +struct BurnDriver BurnDrvSsriders = { + "ssriders", NULL, NULL, NULL, "1991", + "Sunset Riders (4 Players ver. EAC)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, SsridersRomInfo, SsridersRomName, NULL, NULL, Ssriders4pInputInfo, NULL, + SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsridersebd = { + "ssridersebd", "ssriders", NULL, NULL, "1991", + "Sunset Riders (2 Players ver. EBD)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, SsridersebdRomInfo, SsridersebdRomName, NULL, NULL, SsridersInputInfo, NULL, + SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsridersebc = { + "ssridersebc", "ssriders", NULL, NULL, "1991", + "Sunset Riders (2 Players ver. EBC)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, SsridersebcRomInfo, SsridersebcRomName, NULL, NULL, SsridersInputInfo, NULL, + SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsridersuda = { + "ssridersuda", "ssriders", NULL, NULL, "1991", + "Sunset Riders (4 Players ver. UDA)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, SsridersudaRomInfo, SsridersudaRomName, NULL, NULL, Ssriders4psInputInfo, NULL, + SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsriderseaa = { + "ssriderseaa", "ssriders", NULL, NULL, "1991", + "Sunset Riders (4 Players ver. EAA)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, SsriderseaaRomInfo, SsriderseaaRomName, NULL, NULL, Ssriders4psInputInfo, NULL, + SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsridersuac = { + "ssridersuac", "ssriders", NULL, NULL, "1991", + "Sunset Riders (4 Players ver. UAC)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, SsridersuacRomInfo, SsridersuacRomName, NULL, NULL, Ssriders4pInputInfo, NULL, + SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsridersubc = { + "ssridersubc", "ssriders", NULL, NULL, "1991", + "Sunset Riders (2 Players ver. UBC)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, SsridersubcRomInfo, SsridersubcRomName, NULL, NULL, SsridersInputInfo, NULL, + SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsridersabd = { + "ssridersabd", "ssriders", NULL, NULL, "1991", + "Sunset Riders (2 Players ver. ABD)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, SsridersabdRomInfo, SsridersabdRomName, NULL, NULL, SsridersInputInfo, NULL, + SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsridersadd = { + "ssridersadd", "ssriders", NULL, NULL, "1991", + "Sunset Riders (4 Players ver. ADD)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, SsridersaddRomInfo, SsridersaddRomName, NULL, NULL, Ssriders4psInputInfo, NULL, + SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsridersjbd = { + "ssridersjbd", "ssriders", NULL, NULL, "1991", + "Sunset Riders (2 Players ver. JBD)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, SsridersjbdRomInfo, SsridersjbdRomName, NULL, NULL, SsridersInputInfo, NULL, + SsridersInit, BlswhstlExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +static INT32 SsridersbInit() +{ + return 1; +} + +struct BurnDriverD BurnDrvSsridersb = { + "ssridersb", "ssriders", NULL, NULL, "1991", + "Sunset Riders (bootleg 4 Players ver. ADD)\0", NULL, "Konami", "GX064", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_KONAMI_68K_Z80, GBF_PLATFORM, 0, + NULL, ssridersbRomInfo, ssridersbRomName, NULL, NULL, Ssriders4psInputInfo, NULL, + SsridersbInit, CommonExit, SsridersFrame, NULL, SsridersScan, + NULL, 0x810, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvThndrx2 = { + "thndrx2", NULL, NULL, NULL, "1991", + "Thunder Cross II (World)\0", NULL, "Konami", "GX073", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_HORSHOOT, 0, + NULL, thndrx2RomInfo, thndrx2RomName, NULL, NULL, Thndrx2InputInfo, NULL, + Thndrx2Init, BlswhstlExit, Thndrx2Frame, NULL, Thndrx2aScan, + NULL, 0x800, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvThndrx2a = { + "thndrx2a", "thndrx2", NULL, NULL, "1991", + "Thunder Cross II (Asia)\0", NULL, "Konami", "GX073", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_HORSHOOT, 0, + NULL, thndrx2aRomInfo, thndrx2aRomName, NULL, NULL, Thndrx2InputInfo, NULL, + Thndrx2Init, BlswhstlExit, Thndrx2Frame, NULL, Thndrx2aScan, + NULL, 0x800, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvThndrx2j = { + "thndrx2j", "thndrx2", NULL, NULL, "1991", + "Thunder Cross II (Japan)\0", NULL, "Konami", "GX073", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_HORSHOOT, 0, + NULL, thndrx2jRomInfo, thndrx2jRomName, NULL, NULL, Thndrx2InputInfo, NULL, + Thndrx2Init, BlswhstlExit, Thndrx2Frame, NULL, Thndrx2aScan, + NULL, 0x800, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvLgtnfght = { + "lgtnfght", NULL, NULL, NULL, "1990", + "Lightning Fighters (World)\0", NULL, "Konami", "GX939", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, + NULL, lgtnfghtRomInfo, lgtnfghtRomName, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo, + LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, NULL, Thndrx2aScan, + NULL, 0x800, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvLgtnfghtu = { + "lgtnfghtu", "lgtnfght", NULL, NULL, "1990", + "Lightning Fighters (US)\0", NULL, "Konami", "GX939", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, + NULL, lgtnfghtuRomInfo, lgtnfghtuRomName, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo, + LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, NULL, Thndrx2aScan, + NULL, 0x800, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvLgtnfghta = { + "lgtnfghta", "lgtnfght", NULL, NULL, "1990", + "Lightning Fighters (Asia)\0", NULL, "Konami", "GX939", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, + NULL, lgtnfghtaRomInfo, lgtnfghtaRomName, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo, + LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, NULL, Thndrx2aScan, + NULL, 0x800, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvTrigon = { + "trigon", "lgtnfght", NULL, NULL, "1990", + "Trigon (Japan)\0", NULL, "Konami", "GX939", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0, + NULL, trigonRomInfo, trigonRomName, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo, + LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, NULL, Thndrx2aScan, + NULL, 0x800, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvTmnt2 = { + "tmnt2", NULL, NULL, NULL, "1991", + "Teenage Mutant Ninja Turtles - Turtles in Time (4 Players ver. UAA)\0", NULL, "Konami", "GX063", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, tmnt2RomInfo, tmnt2RomName, NULL, NULL, Ssriders4pInputInfo, NULL, + Tmnt2Init, BlswhstlExit, Tmnt2Frame, NULL, SsridersScan, + NULL, 0x800, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmnt22pu = { + "tmnt22pu", "tmnt2", NULL, NULL, "1991", + "Teenage Mutant Ninja Turtles - Turtles in Time (2 Players ver. UDA)\0", NULL, "Konami", "GX063", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, tmnt22puRomInfo, tmnt22puRomName, NULL, NULL, SsridersInputInfo, NULL, + Tmnt2Init, BlswhstlExit, Tmnt2Frame, NULL, SsridersScan, + NULL, 0x800, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmht22pe = { + "tmht22pe", "tmnt2", NULL, NULL, "1991", + "Teenage Mutant Hero Turtles - Turtles in Time (2 Players ver. EBA)\0", NULL, "Konami", "GX063", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, tmht22peRomInfo, tmht22peRomName, NULL, NULL, SsridersInputInfo, NULL, + Tmnt2Init, BlswhstlExit, Tmnt2Frame, NULL, SsridersScan, + NULL, 0x800, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTmnt2a = { + "tmnt2a", "tmnt2", NULL, NULL, "1991", + "Teenage Mutant Ninja Turtles - Turtles in Time (4 Players ver. ADA)\0", NULL, "Konami", "GX063", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0, + NULL, tmnt2aRomInfo, tmnt2aRomName, NULL, NULL, Ssriders4psInputInfo, NULL, + Tmnt2Init, BlswhstlExit, Tmnt2Frame, NULL, SsridersScan, + NULL, 0x800, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQgakumon = { + "qgakumon", NULL, NULL, NULL, "1993", + "Quiz Gakumon no Susume (Japan ver. JA1 Type H)\0", NULL, "Konami", "GX248", + L"\u30AF\u30A4\u30BA \u5B66\u554F\u30CE\u30B9\u30B9\u30E1 Gakumon no Susume (Japan ver. JA1 Type H)\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_QUIZ, 0, + NULL, qgakumonRomInfo, qgakumonRomName, NULL, NULL, QgakumonInputInfo, NULL, + QgakumonInit, BlswhstlExit, Tmnt2Frame, NULL, SsridersScan, + NULL, 0x800, 304, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPunkshot = { + "punkshot", NULL, NULL, NULL, "1990", + "Punk Shot (US 4 Players)\0", NULL, "Konami", "GX907", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_SPORTSMISC, 0, + NULL, punkshotRomInfo, punkshotRomName, NULL, NULL, PunkshotInputInfo, PunkshotDIPInfo, + PunkshotInit, PunkshotExit, PunkshotFrame, NULL, Thndrx2aScan, + NULL, 0x800, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPunkshot2 = { + "punkshot2", "punkshot", NULL, NULL, "1990", + "Punk Shot (US 2 Players)\0", NULL, "Konami", "GX907", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SPORTSMISC, 0, + NULL, punkshot2RomInfo, punkshot2RomName, NULL, NULL, Punkshot2InputInfo, Punkshot2DIPInfo, + PunkshotInit, PunkshotExit, PunkshotFrame, NULL, Thndrx2aScan, + NULL, 0x800, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPunkshotj = { + "punkshotj", "punkshot", NULL, NULL, "1990", + "Punk Shot (Japan 2 Players)\0", NULL, "Konami", "GX907", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SPORTSMISC, 0, + NULL, punkshotjRomInfo, punkshotjRomName, NULL, NULL, Punkshot2InputInfo, PunkshotjDIPInfo, + PunkshotInit, PunkshotExit, PunkshotFrame, NULL, Thndrx2aScan, + NULL, 0x800, 288, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_twin16.cpp b/src/burn/drv/konami/d_twin16.cpp index 858167457..f50cb3451 100644 --- a/src/burn/drv/konami/d_twin16.cpp +++ b/src/burn/drv/konami/d_twin16.cpp @@ -1,2275 +1,2274 @@ -// FB Alpha Twin16 driver module -// Based on MAME driver by Phil Stroffolino - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "upd7759.h" -#include "k007232.h" - -static UINT8 *AllMem; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *Drv68KROM0; -static UINT8 *Drv68KROM1; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *DrvShareRAM; -static UINT8 *Drv68KRAM0; -static UINT8 *DrvPalRAM; -static UINT8 *DrvVidRAM2; -static UINT8 *DrvVidRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf; -static UINT8 *DrvNvRAM; -static UINT8 *DrvNvRAMBank; -static UINT8 *Drv68KRAM1; -static UINT8 *DrvFgRAM; -static UINT8 *DrvTileRAM; -static UINT8 *DrvSprGfxRAM; -static UINT8 *DrvGfxExp; - -static UINT8 *DrvZ80RAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT16 *scrollx; -static UINT16 *scrolly; - -static UINT8 *soundlatch; -static UINT8 *soundlatch2; - -static INT32 video_register; -static INT32 gfx_bank; - -static INT32 twin16_CPUA_register; -static INT32 twin16_CPUB_register; - -static INT32 need_process_spriteram; -static INT32 twin16_custom_video; -static INT32 is_vulcan = 0; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvJoy4[16]; -static UINT8 DrvInputs[4]; -static UINT8 DrvDips[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo DevilwInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, - {"Map Button", BIT_DIGITAL, DrvJoy1 + 3, "service2" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Devilw) - -static struct BurnInputInfo DarkadvInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, - - {"P3 Coin", BIT_DIGITAL, DrvJoy1 + 2, "p3 coin" }, - {"P3 Up", BIT_DIGITAL, DrvJoy4 + 2, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy4 + 3, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy4 + 0, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy4 + 1, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, DrvJoy4 + 6, "p3 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service 1", BIT_DIGITAL, DrvJoy1 + 6, "service" }, - {"Service 2", BIT_DIGITAL, DrvJoy1 + 7, "service2" }, - {"Service 3", BIT_DIGITAL, DrvJoy2 + 7, "service3" }, - {"Map Button", BIT_DIGITAL, DrvJoy1 + 3, "service4" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Darkadv) - -#define coinage_dips(offs) \ - {0 , 0xfe, 0 , 16, "Coin A" }, \ - {offs, 0x01, 0x0f, 0x02, "4 Coins 1 Credit " }, \ - {offs, 0x01, 0x0f, 0x05, "3 Coins 1 Credit " }, \ - {offs, 0x01, 0x0f, 0x08, "2 Coins 1 Credit " }, \ - {offs, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, \ - {offs, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, \ - {offs, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit " }, \ - {offs, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, \ - {offs, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, \ - {offs, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, \ - {offs, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, \ - {offs, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, \ - {offs, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, \ - {offs, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, \ - {offs, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, \ - {offs, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, \ - {offs, 0x01, 0x0f, 0x00, "Free Play" }, \ - \ - {0 , 0xfe, 0 , 16, "Coin B" }, \ - {offs, 0x01, 0xf0, 0x20, "4 Coins 1 Credit " }, \ - {offs, 0x01, 0xf0, 0x50, "3 Coins 1 Credit " }, \ - {offs, 0x01, 0xf0, 0x80, "2 Coins 1 Credit " }, \ - {offs, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, \ - {offs, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, \ - {offs, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit " }, \ - {offs, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, \ - {offs, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, \ - {offs, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, \ - {offs, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, \ - {offs, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, \ - {offs, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, \ - {offs, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, \ - {offs, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, \ - {offs, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, \ - {offs, 0x01, 0xf0, 0x00, "Disabled" }, - -static struct BurnDIPInfo DevilwDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0x5e, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - coinage_dips(0x13) - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x03, 0x03, "2" }, - {0x14, 0x01, 0x03, 0x02, "3" }, - {0x14, 0x01, 0x03, 0x01, "5" }, - {0x14, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x60, 0x60, "Easy" }, - {0x14, 0x01, 0x60, 0x40, "Normal" }, - {0x14, 0x01, 0x60, 0x20, "Difficult" }, - {0x14, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Devilw) - -static struct BurnDIPInfo DarkadvDIPList[]= -{ - {0x1d, 0xff, 0xff, 0xff, NULL }, - {0x1e, 0xff, 0xff, 0x5e, NULL }, - {0x1f, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x1d, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x1d, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x1d, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x1d, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x1d, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x1d, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x1d, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x1d, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x1d, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x1d, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x1d, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x1d, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x1d, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x1d, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x1d, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x1d, 0x01, 0x0f, 0x00, "Invalid" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x1e, 0x01, 0x03, 0x03, "2" }, - {0x1e, 0x01, 0x03, 0x02, "3" }, - {0x1e, 0x01, 0x03, 0x01, "5" }, - {0x1e, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x1e, 0x01, 0x60, 0x60, "Easy" }, - {0x1e, 0x01, 0x60, 0x40, "Normal" }, - {0x1e, 0x01, 0x60, 0x20, "Difficult" }, - {0x1e, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x1e, 0x01, 0x80, 0x80, "Off" }, - {0x1e, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x1f, 0x01, 0x01, 0x01, "Off" }, - {0x1f, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x1f, 0x01, 0x04, 0x04, "Off" }, - {0x1f, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Darkadv) - -static struct BurnDIPInfo VulcanDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x5a, NULL }, - {0x16, 0xff, 0xff, 0xfd, NULL }, - - coinage_dips(0x14) - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x03, "2" }, - {0x15, 0x01, 0x03, 0x02, "3" }, - {0x15, 0x01, 0x03, 0x01, "4" }, - {0x15, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x15, 0x01, 0x04, 0x00, "Upright" }, - {0x15, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x15, 0x01, 0x18, 0x18, "20K 70K" }, - {0x15, 0x01, 0x18, 0x10, "30K 80K" }, - {0x15, 0x01, 0x18, 0x08, "20K" }, - {0x15, 0x01, 0x18, 0x00, "70K" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Normal" }, - {0x15, 0x01, 0x60, 0x20, "Difficult" }, - {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Upright Controls" }, - {0x16, 0x01, 0x02, 0x02, "Single" }, - {0x16, 0x01, 0x02, 0x00, "Dual" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Vulcan) - -static struct BurnDIPInfo Gradius2DIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x5a, NULL }, - {0x16, 0xff, 0xff, 0xfd, NULL }, - - coinage_dips(0x14) - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x03, "2" }, - {0x15, 0x01, 0x03, 0x02, "3" }, - {0x15, 0x01, 0x03, 0x01, "4" }, - {0x15, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x15, 0x01, 0x04, 0x00, "Upright" }, - {0x15, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x15, 0x01, 0x18, 0x18, "20K 150K" }, - {0x15, 0x01, 0x18, 0x10, "30K 200K" }, - {0x15, 0x01, 0x18, 0x08, "20K" }, - {0x15, 0x01, 0x18, 0x00, "70K" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Normal" }, - {0x15, 0x01, 0x60, 0x20, "Difficult" }, - {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Upright Controls" }, - {0x16, 0x01, 0x02, 0x02, "Single" }, - {0x16, 0x01, 0x02, 0x00, "Dual" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Gradius2) - -static struct BurnDIPInfo FroundDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x42, NULL }, - {0x16, 0xff, 0xff, 0xfd, NULL }, - - coinage_dips(0x14) - - {0 , 0xfe, 0 , 4, "Energy" }, - {0x15, 0x01, 0x03, 0x03, "18" }, - {0x15, 0x01, 0x03, 0x02, "20" }, - {0x15, 0x01, 0x03, 0x01, "22" }, - {0x15, 0x01, 0x03, 0x00, "24" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Normal" }, - {0x15, 0x01, 0x60, 0x20, "Difficult" }, - {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Fround) - -static struct BurnDIPInfo MiajDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x52, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - coinage_dips(0x14) - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x03, "2" }, - {0x15, 0x01, 0x03, 0x02, "3" }, - {0x15, 0x01, 0x03, 0x01, "5" }, - {0x15, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x15, 0x01, 0x18, 0x18, "30K 80K" }, - {0x15, 0x01, 0x18, 0x10, "50K 100K" }, - {0x15, 0x01, 0x18, 0x08, "50K" }, - {0x15, 0x01, 0x18, 0x00, "100K" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Normal" }, - {0x15, 0x01, 0x60, 0x20, "Difficult" }, - {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "VRAM Character Check" }, - {0x16, 0x01, 0x02, 0x02, "Off" }, - {0x16, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, -}; - -STDDIPINFO(Miaj) - -static struct BurnDIPInfo CuebrckjDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x5a, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - coinage_dips(0x14) - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x03, "1" }, - {0x15, 0x01, 0x03, 0x02, "2" }, - {0x15, 0x01, 0x03, 0x01, "3" }, - {0x15, 0x01, 0x03, 0x00, "4" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x15, 0x01, 0x04, 0x00, "Upright" }, - {0x15, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Machine Name" }, - {0x15, 0x01, 0x18, 0x18, "None" }, - {0x15, 0x01, 0x18, 0x10, "Lewis" }, - {0x15, 0x01, 0x18, 0x08, "Johnson" }, - {0x15, 0x01, 0x18, 0x00, "George" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Normal" }, - {0x15, 0x01, 0x60, 0x20, "Hard" }, - {0x15, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Upright Controls" }, - {0x16, 0x01, 0x02, 0x02, "Single" }, - {0x16, 0x01, 0x02, 0x00, "Dual" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Mode" }, - {0x16, 0x01, 0x08, 0x08, "3" }, - {0x16, 0x01, 0x08, 0x00, "4" }, -}; - -STDDIPINFO(Cuebrckj) - -static void twin16_spriteram_process() -{ - INT32 dx = BURN_ENDIAN_SWAP_INT16(scrollx[0]); - INT32 dy = BURN_ENDIAN_SWAP_INT16(scrolly[0]); - - UINT16 *spriteram16 = (UINT16*)DrvSprRAM; - UINT16 *source = spriteram16; - UINT16 *finish = spriteram16 + 0x1800; - - memset(&spriteram16[0x1800], 0, 0x800); - - while (source < finish) - { - INT32 priority = BURN_ENDIAN_SWAP_INT16(source[0]); - if (priority & 0x8000 ) - { - UINT16 *dest = &spriteram16[0x1800 + ((priority & 0xff) << 2)]; - - INT32 xpos = (BURN_ENDIAN_SWAP_INT16(source[4]) << 16) | BURN_ENDIAN_SWAP_INT16(source[5]); - INT32 ypos = (BURN_ENDIAN_SWAP_INT16(source[6]) << 16) | BURN_ENDIAN_SWAP_INT16(source[7]); - - INT32 attributes = BURN_ENDIAN_SWAP_INT16(source[2])&0x03ff; - if (priority & 0x0200) attributes |= 0x4000; - - attributes |= 0x8000; - - dest[0] = source[3]; - dest[1] = BURN_ENDIAN_SWAP_INT16(((xpos >> 8) - dx) & 0xffff); - dest[2] = BURN_ENDIAN_SWAP_INT16(((ypos >> 8) - dy) & 0xffff); - dest[3] = BURN_ENDIAN_SWAP_INT16(attributes); - } - - source += 0x50/2; - } - - need_process_spriteram = 0; -} - -static void fround_CPU_register_w(INT32 data) -{ - INT32 old = twin16_CPUA_register; - twin16_CPUA_register = data; - if (twin16_CPUA_register != old) - { - if ((old & 0x08) == 0 && (twin16_CPUA_register & 0x08)) { - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } - } -} - -static void twin16_CPUA_register_w(INT32 data) -{ - if (twin16_CPUA_register != data) - { - if ((twin16_CPUA_register & 0x08) == 0 && (data & 0x08)) { - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } - - if ((twin16_CPUA_register & 0x40) && (data & 0x40) == 0) - twin16_spriteram_process(); - - if ((twin16_CPUA_register & 0x10) == 0 && (data & 0x10)) { - SekClose(); - SekOpen(1); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - SekClose(); - SekOpen(0); - } - - twin16_CPUA_register = data; - } -} - -static void twin16_CPUB_register_w(INT32 data) -{ - INT32 old = twin16_CPUB_register; - twin16_CPUB_register = data; - if (twin16_CPUB_register != old) - { - if ((old & 0x01) == 0 && (twin16_CPUB_register & 0x01)) - { - SekClose(); - SekOpen(0); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - SekClose(); - SekOpen(1); - } - - INT32 offset = (twin16_CPUB_register & 4) << 17; - SekMapMemory(DrvGfxROM1 + 0x100000 + offset, 0x700000, 0x77ffff, SM_ROM); - } -} - -void __fastcall twin16_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0xc0002: - case 0xc0006: - case 0xc000a: - scrollx[((address - 2) & 0x0c) >> 2] = BURN_ENDIAN_SWAP_INT16(data); - return; - - case 0xc0004: - case 0xc0008: - case 0xc000c: - scrolly[((address - 4) & 0x0c) >> 2] = BURN_ENDIAN_SWAP_INT16(data); - return; - - case 0xe0000: - gfx_bank = BURN_ENDIAN_SWAP_INT16(data); - return; - } -} - -void __fastcall twin16_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0xa0001: - if (twin16_custom_video == 1) { - fround_CPU_register_w(data); - } else { - twin16_CPUA_register_w(data); - } - return; - - case 0xa0008: - case 0xa0009: - *soundlatch = data; - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - - case 0xa0011: // watchdog - return; - - case 0xb0400: - { - *DrvNvRAMBank = data & 0x1f; - int offset = data & 0x1f; - SekMapMemory(DrvNvRAM + offset * 0x400, 0x0b0000, 0x0b03ff, SM_RAM); - } - return; - - case 0xc0001: - video_register = data; - return; - } -} - -UINT16 __fastcall twin16_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x0c000e: - case 0x0c000f: { - static INT32 ret = 0; - ret = 1-ret; - return ret; - } - - case 0x0a0000: - case 0x0a0002: - case 0x0a0004: - case 0x0a0006: - return DrvInputs[(address - 0xa0000)/2]; - - case 0x0a0010: - return DrvDips[1]; - - case 0x0a0012: - return DrvDips[0]; - - case 0x0a0018: - return DrvDips[2]; - } - - return 0; -} - -UINT8 __fastcall twin16_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x0c000e: - case 0x0c000f: { - static INT32 ret = 0; - ret = 1-ret; - return ret; - } - - case 0x0a0000: - case 0x0a0001: - case 0x0a0002: - case 0x0a0003: - case 0x0a0004: - case 0x0a0005: - case 0x0a0006: - case 0x0a0007: - return DrvInputs[(address - 0xa0000)/2]; - - case 0x0a0010: - case 0x0a0011: - return DrvDips[1]; - - case 0x0a0012: - case 0x0a0013: - return DrvDips[0]; - - case 0x0a0018: - case 0x0a0019: - return DrvDips[2]; - } - - return 0; -} - -static inline void twin16_tile_write(INT32 offset) -{ - DrvGfxExp[(offset << 1) + 2] = DrvTileRAM[offset + 0] >> 4; - DrvGfxExp[(offset << 1) + 3] = DrvTileRAM[offset + 0] & 0x0f; - DrvGfxExp[(offset << 1) + 0] = DrvTileRAM[offset + 1] >> 4; - DrvGfxExp[(offset << 1) + 1] = DrvTileRAM[offset + 1] & 0x0f; -} - -void __fastcall twin16_sub_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfc0000) == 0x500000) { - INT32 offset = address & 0x3ffff; - *((UINT16*)(DrvTileRAM + offset)) = BURN_ENDIAN_SWAP_INT16(data); - twin16_tile_write(offset); - return; - } -} - -void __fastcall twin16_sub_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0xa0001: - twin16_CPUB_register_w(data); - return; - } - - if ((address & 0xfc0000) == 0x500000) { - INT32 offset = address & 0x3ffff; - DrvTileRAM[offset^1] = data; - twin16_tile_write(offset & ~1); - return; - } -} - -void __fastcall twin16_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x9000: - *soundlatch2 = data; - UPD7759ResetWrite(0, data & 2); - return; - - case 0xc000: - BurnYM2151SelectRegister(data); - return; - - case 0xc001: - BurnYM2151WriteRegister(data); - return; - - case 0xd000: - UPD7759PortWrite(0, data); - return; - - case 0xe000: - UPD7759StartWrite(0, data & 1); - return; - } - - if ((address & 0xfff0) == 0xb000) { - K007232WriteReg(0, address & 0x0f, data); - return; - } -} - -UINT8 __fastcall twin16_sound_read(UINT16 address) -{ - switch (address) - { - case 0x9000: - return *soundlatch2; - - case 0xa000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0xc000: - case 0xc001: - return BurnYM2151ReadStatus(); - - case 0xf000: - return UPD7759BusyRead(0) ? 1 : 0; - } - - if ((address & 0xfff0) == 0xb000) { - return K007232ReadReg(0, address & 0x0f); - } - - return 0; -} - -static void DrvK007232VolCallback(INT32 v) -{ - K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); - K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - SekOpen(1); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - UPD7759Reset(); - - gfx_bank = 0x3210; // for other than fround - video_register = 0; - - twin16_CPUA_register = 0; - twin16_CPUB_register = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM0 = Next; Next += 0x040000; - Drv68KROM1 = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x008000; - - DrvGfxROM0 = Next; Next += 0x008000; - DrvGfxROM1 = Next; Next += 0x200000; - DrvGfxROM2 = Next; Next += 0x020000; - - DrvSndROM0 = Next; Next += 0x020000; - DrvSndROM1 = Next; Next += 0x020000; - - DrvGfxExp = Next; Next += 0x400000; - DrvNvRAM = Next; Next += 0x008000; - - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - AllRam = Next; - - DrvSprRAM = Next; Next += 0x004000; - DrvSprBuf = Next; Next += 0x004000; - DrvShareRAM = Next; Next += 0x010000; - Drv68KRAM0 = Next; Next += 0x004000; - DrvPalRAM = Next; Next += 0x001000; - DrvVidRAM2 = Next; Next += 0x006000; - DrvVidRAM = Next; Next += 0x004000; - Drv68KRAM1 = Next; Next += 0x004000; - DrvFgRAM = Next; Next += 0x004000; - DrvTileRAM = Next; Next += 0x040000; - DrvSprGfxRAM = Next; Next += 0x020000; - - DrvZ80RAM = Next; Next += 0x001000; - - DrvNvRAMBank = Next; Next += 0x000001; - - scrollx = (UINT16*)Next; Next += 0x00004 * sizeof(UINT16); - scrolly = (UINT16*)Next; Next += 0x00004 * sizeof(UINT16); - - soundlatch = Next; Next += 0x000001; - soundlatch2 = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void expand4bpp(UINT8 *src, UINT8 *dst, INT32 len) -{ - for (INT32 i = len-1; i > 0; i--) { - dst[i * 2 + 0] = src[i] >> 4; - dst[i * 2 + 1] = src[i] & 0x0f; - } -} - -static void gfxdecode() -{ - UINT16 *src = (UINT16*)DrvGfxROM1; - UINT16 *dst = (UINT16*)BurnMalloc(0x200000); - for (INT32 i = 0; i < 0x80000; i++) - { - dst[i * 2 + 0] = src[i + 0x80000]; - dst[i * 2 + 1] = src[i + 0x00000]; - } - memcpy (src, dst, 0x200000); - BurnFree(dst); -} - -static INT32 load68k(UINT8 *rom, INT32 offs) -{ - if (BurnLoadRom(rom + 0x000001, offs+0, 2)) return 1; - if (BurnLoadRom(rom + 0x000000, offs+1, 2)) return 1; - if (BurnLoadRom(rom + 0x020001, offs+2, 2)) return 1; - if (BurnLoadRom(rom + 0x020000, offs+3, 2)) return 1; - - return 0; -} - -static INT32 DrvInit(INT32 (pLoadCallback)()) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (pLoadCallback != NULL) { - if (pLoadCallback()) return 1; - } - - gfxdecode(); - expand4bpp(DrvGfxROM0, DrvGfxROM0, 0x4000); - - if (twin16_custom_video == 1) - { - BurnByteswap(DrvGfxROM1, 0x200000); - expand4bpp(DrvGfxROM1, DrvGfxExp, 0x200000); - BurnByteswap(DrvGfxROM1, 0x200000); - } - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM0, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvShareRAM, 0x040000, 0x04ffff, SM_RAM); - SekMapMemory(Drv68KRAM0, 0x060000, 0x063fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x080000, 0x080fff, SM_RAM); - SekMapMemory(DrvNvRAM, 0x0b0000, 0x0b03ff, SM_RAM); - SekMapMemory(DrvVidRAM2, 0x100000, 0x105fff, SM_RAM); - SekMapMemory(DrvVidRAM, 0x120000, 0x123fff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x140000, 0x143fff, SM_RAM); - SekMapMemory(DrvGfxROM1, 0x500000, 0x6fffff, SM_ROM); - SekSetWriteWordHandler(0, twin16_main_write_word); - SekSetWriteByteHandler(0, twin16_main_write_byte); - SekSetReadWordHandler(0, twin16_main_read_word); - SekSetReadByteHandler(0, twin16_main_read_byte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Drv68KROM1, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvShareRAM, 0x040000, 0x04ffff, SM_RAM); - SekMapMemory(Drv68KRAM1, 0x060000, 0x063fff, SM_RAM); - SekMapMemory(DrvGfxROM2, 0x080000, 0x09ffff, SM_ROM); - SekMapMemory(DrvSprRAM, 0x400000, 0x403fff, SM_RAM); - SekMapMemory(DrvVidRAM, 0x480000, 0x483fff, SM_RAM); - SekMapMemory(DrvTileRAM, 0x500000, 0x53ffff, SM_ROM); - SekMapMemory(DrvGfxROM1, 0x600000, 0x6fffff, SM_ROM); - SekMapMemory(DrvGfxROM1 + 0x100000, 0x700000, 0x77ffff, SM_ROM); - SekMapMemory(DrvSprGfxRAM, 0x780000, 0x79ffff, SM_RAM); - SekSetWriteWordHandler(0, twin16_sub_write_word); - SekSetWriteByteHandler(0, twin16_sub_write_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x8fff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x8fff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x8fff, 2, DrvZ80RAM); - ZetSetWriteHandler(twin16_sound_write); - ZetSetReadHandler(twin16_sound_read); - ZetMemEnd(); - ZetClose(); - - K007232Init(0, 3579545, DrvSndROM0, 0x20000); - K007232SetPortWriteHandler(0, DrvK007232VolCallback); - K007232PCMSetAllRoutes(0, 0.12, BURN_SND_ROUTE_BOTH); - - BurnYM2151Init(3579580); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvSndROM1); - UPD7759SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - SekExit(); - ZetExit(); - - K007232Exit(); - UPD7759Exit(); - BurnYM2151Exit(); - - BurnFree (AllMem); - - is_vulcan = 0; - twin16_custom_video = 0; - - return 0; -} - -static inline void DrvRecalcPal() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x1000 / 2; i+=2) - { - INT32 d = ((BURN_ENDIAN_SWAP_INT16(p[i+0]) & 0xff) << 8) | (BURN_ENDIAN_SWAP_INT16(p[i+1]) & 0xff); - - r = (d >> 0) & 0x1f; - g = (d >> 5) & 0x1f; - b = (d >> 10) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i/2] = BurnHighCol(r, g, b, 0); - } -} - -static void draw_fg_layer() -{ - INT32 flipx = (video_register & 2) ? 0x1f8 : 0; - INT32 flipy = (video_register & 1) ? 0x0f8 : 0; - - UINT16 *vram = (UINT16*)DrvVidRAM2; - - for (INT32 offs = 0x80; offs < 0x780; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - sx ^= flipx; - sy ^= flipy; - - if (flipx) sx -= 192; - sy -= 16; - - if (sx >= nScreenWidth) continue; - - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs]); - INT32 code = attr & 0x1ff; - INT32 color = (attr >> 9) & 0x0f; - - if (code == 0) continue; - - if (sx >= 0 && sx < nScreenWidth-7 && sy >= 0 && sy < nScreenHeight-7) { - if (flipx) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } - } - } -} - -static void draw_layer(INT32 opaque) -{ - INT32 o = 0; - INT32 banks[4]; - if (((video_register & 8) >> 3) != opaque) o = 1; - - UINT16 *vram = (UINT16*)(DrvVidRAM + (o << 13)); - banks[3] = gfx_bank >> 12; - banks[2] = (gfx_bank >> 8) & 0x0f; - banks[1] = (gfx_bank >> 4) & 0x0f; - banks[0] = gfx_bank & 0xf; - - INT32 dx = BURN_ENDIAN_SWAP_INT16(scrollx[1+o]); - INT32 dy = BURN_ENDIAN_SWAP_INT16(scrolly[1+o]); - - INT32 flipx = 0; - INT32 flipy = 0; - - if (video_register & 2) { - dx = 256-dx-64; - flipx = 1; - } - - if (video_register & 1) { - dy = 256-dy; - flipy = 1; - } - if (is_vulcan) flipy ^= 1; - - INT32 palette = o; - - for (INT32 offs = 0; offs < 64 * 64; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - if (video_register & 2) sx ^= 0x1f8; - if (video_register & 1) sy ^= 0x1f8; - - sx = (sx - dx) & 0x1ff; - sy = (sy - dy) & 0x1ff; - if (sx >= 320) sx-=512; - if (sy >= 256) sy-=512; - - sy -= 16; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); - INT32 color = (0x20 + (code >> 13) + 8 * palette); - code = (code & 0x7ff) | (banks[(code >> 11) & 3] << 11); - - if (sx >= 0 && sx < nScreenWidth-7 && sy >= 0 && sy < nScreenHeight-7) { - if (opaque) { - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); - } else { - Render8x8Tile_FlipY(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); - } - } else { - if (flipx) { - Render8x8Tile_FlipX(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); - } else { - Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); - } - } - } else { - if (code == 0) continue; - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); - } else { - Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); - } - } - } - } else { - if (sy < -7 || sy >= nScreenHeight || sx >= nScreenWidth) continue; - - if (opaque) { - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); - } else { - Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); - } - } else { - if (flipx) { - Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); - } - } - } else { - if (code == 0) continue; - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); - } - } - } - } - } -} - -static void draw_sprite(UINT16 *pen_data, INT32 pal_base, INT32 xpos, INT32 ypos, INT32 width, INT32 height, INT32 flipx, INT32 flipy) -{ - if (xpos >= 320) xpos -= 0x10000; - if (ypos >= 256) ypos -= 0x10000; - - for (INT32 y = 0; y < height; y++) - { - INT32 sy = (flipy) ? (ypos + height - 1 - y) : (ypos + y); - - if (sy >= 16 && sy < 240) - { - UINT16 *dest = pTransDraw + (sy - 16) * nScreenWidth; - - for (INT32 x = 0; x < width; x++) - { - INT32 sx = (flipx) ? (xpos + width - 1 - x) : (xpos + x); - - if (sx >= 0 && sx < 320) - { - INT32 pen = BURN_ENDIAN_SWAP_INT16(pen_data[x/4]); - - pen = (pen >> ((~x & 3) << 2)) & 0x0f; - - if (pen) dest[sx] = pal_base + pen; - } - } - } - - pen_data += width/4; - } -} - -static void draw_sprites(INT32 priority) -{ - UINT16 *twin16_sprite_gfx_ram = (UINT16*)DrvSprGfxRAM; - UINT16 *twin16_gfx_rom = (UINT16*)DrvGfxROM1; - UINT16 *buffered_spriteram16 = (UINT16*)DrvSprBuf; - - UINT16 *source = 0x1800+buffered_spriteram16; - UINT16 *finish = 0x1800+buffered_spriteram16 + 0x800 - 4; - - for (; source < finish; source += 4) - { - INT32 attributes = BURN_ENDIAN_SWAP_INT16(source[3]); - INT32 prio = (attributes&0x4000) >> 14; - if (prio != priority) continue; - - INT32 code = BURN_ENDIAN_SWAP_INT16(source[0]); - - if (code != 0xffff && attributes & 0x8000) - { - INT32 xpos = BURN_ENDIAN_SWAP_INT16(source[1]); - INT32 ypos = BURN_ENDIAN_SWAP_INT16(source[2]); - - INT32 pal_base = ((attributes&0xf)+0x10)*16; - INT32 height = 16<<((attributes>>6)&0x3); - INT32 width = 16<<((attributes>>4)&0x3); - INT32 flipy = attributes&0x0200; - INT32 flipx = attributes&0x0100; - UINT16 *pen_data = 0; - - if( twin16_custom_video == 1 ) - { - pen_data = twin16_gfx_rom + 0x80000; - } - else - { - switch( (code>>12)&0x3 ) - { - case 0: - pen_data = twin16_gfx_rom; - break; - - case 1: - pen_data = twin16_gfx_rom + 0x40000; - break; - - case 2: - pen_data = twin16_gfx_rom + 0x80000; - if( code&0x4000 ) pen_data += 0x40000; - break; - - case 3: - pen_data = twin16_sprite_gfx_ram; - break; - } - - code &= 0xfff; - } - - if (height == 64 && width == 64) - { - code &= ~8; - } - else if (height == 32 && width == 32) - { - code &= ~3; - } - else if (height == 32 && width == 16) - { - code &= ~1; - } - else if (height == 16 && width == 32) - { - code &= ~1; - } - - pen_data += code << 6; - - if( video_register&1 ) - { - if (ypos>65000) ypos=ypos-65536; - ypos = 256-ypos-height; - flipy = !flipy; - } - if( video_register&2 ) - { - if (xpos>65000) xpos=xpos-65536; - xpos = 320-xpos-width; - flipx = !flipx; - } - - draw_sprite(pen_data, pal_base, xpos, ypos, width, height, flipx, flipy); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvRecalcPal(); - } - - if (nBurnLayer & 1) draw_layer(1); - if (nSpriteEnable & 1) draw_sprites(1); - if (nBurnLayer & 2) draw_layer(0); - if (nSpriteEnable & 2) draw_sprites(0); - if (nBurnLayer & 4) draw_fg_layer(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 5); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - } - - // Clear Opposites - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; - if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; - if ((DrvInputs[3] & 0x0c) == 0) DrvInputs[3] |= 0x0c; - if ((DrvInputs[3] & 0x03) == 0) DrvInputs[3] |= 0x03; - } - - INT32 nSegment; - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 100; - if (twin16_custom_video == 0 && is_vulcan == 0) nInterleave = 1000; // devilw - - INT32 nTotalCycles[3] = { (twin16_custom_video == 1) ? 10000000 / 60 : 9216000 / 60, 9216000 / 60, 3579545 / 60 }; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - SekOpen(0); - nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); - nCyclesDone[0] += SekRun(nSegment); - if ((twin16_CPUA_register & 0x20) && i == nInterleave-1) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - SekClose(); - - if (twin16_custom_video != 1) { - SekOpen(1); - nCyclesDone[1] += SekRun(nSegment); - if ((twin16_CPUB_register & 0x02) && i == nInterleave-1) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - SekClose(); - } - - nSegment = (nTotalCycles[2] - nCyclesDone[2]) / (nInterleave - i); - - nCyclesDone[1] += ZetRun(nSegment); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - UPD7759Update(0, pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - UPD7759Update(0, pSoundBuf, nSegmentLength); - K007232Update(0, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - if(~twin16_CPUA_register & 0x40 && need_process_spriteram) - twin16_spriteram_process(); - - need_process_spriteram = 1; - - memcpy (DrvSprBuf, DrvSprRAM, 0x4000); - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.nAddress = 0x000000; - ba.szName = "All RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_NVRAM) { - ba.Data = DrvNvRAM; - ba.nLen = 0x008000; - ba.nAddress = 0xb00000; - ba.szName = "Cue Brick NV RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - UPD7759Scan(0, nAction, pnMin); - BurnYM2151Scan(nAction); - // K007232Scan(nAction, pnMin); // crash... - - SCAN_VAR(gfx_bank); - SCAN_VAR(video_register); - SCAN_VAR(twin16_CPUA_register); - SCAN_VAR(twin16_CPUB_register); - } - - if (nAction & ACB_WRITE) { - if (twin16_custom_video != 1) { - for (INT32 i = 0; i < 0x40000; i+=2) { - twin16_tile_write(i); - } - } - - SekOpen(0); - SekMapMemory(DrvNvRAM + (*DrvNvRAMBank * 0x400), 0x0b0000, 0x0b03ff, SM_RAM); - SekClose(); - - SekOpen(1); - INT32 offset = (twin16_CPUB_register & 4) << 17; - SekMapMemory(DrvGfxROM1 + 0x100000 + offset, 0x700000, 0x77ffff, SM_ROM); - SekClose(); - } - - return 0; -} - - -// Devil World - -static struct BurnRomInfo devilwRomDesc[] = { - { "687_t05.6n", 0x10000, 0x8ab7dc61, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "687_t04.4n", 0x10000, 0xc69924da, 1 | BRF_PRG | BRF_ESS }, // 1 - { "687_t09.6r", 0x10000, 0xfae97de0, 1 | BRF_PRG | BRF_ESS }, // 2 - { "687_t08.4r", 0x10000, 0x8c898d67, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "687_q07.10n", 0x10000, 0x53110c0b, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "687_q06.8n", 0x10000, 0x9c53a0c5, 2 | BRF_PRG | BRF_ESS }, // 5 - { "687_q13.10s", 0x10000, 0x36ae6014, 2 | BRF_PRG | BRF_ESS }, // 6 - { "687_q12.8s", 0x10000, 0x6d012167, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "687_l03.10a", 0x08000, 0x7201983c, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "687_m14.d8", 0x04000, 0xd7338557, 4 | BRF_GRA }, // 9 Characters - - { "687i17.p16", 0x80000, 0x66cb3923, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "687i18.p18", 0x80000, 0xa1c7d0db, 5 | BRF_GRA }, // 11 - { "687i15.p13", 0x80000, 0xeec8c5b2, 5 | BRF_GRA }, // 12 - { "687i16.p15", 0x80000, 0x746cf48b, 5 | BRF_GRA }, // 13 - - { "687_l11.10r", 0x10000, 0x399deee8, 6 | BRF_GRA }, // 14 Sprites / Bg Tiles - { "687_l10.8r", 0x10000, 0x117c91ee, 6 | BRF_GRA }, // 15 - - { "687_i01.5a", 0x20000, 0xd4992dfb, 7 | BRF_SND }, // 16 K007232 Samples - - { "687_i02.7c", 0x20000, 0xe5947501, 8 | BRF_SND }, // 17 UPD7759 Samples -}; - -STD_ROM_PICK(devilw) -STD_ROM_FN(devilw) - -static INT32 devilwCallback() -{ - if (load68k(Drv68KROM0, 0)) return 1; - if (load68k(Drv68KROM1, 4)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 13, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 15, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 16, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x000000, 17, 1)) return 1; - - return 0; -} - -static INT32 devilwInit() -{ - twin16_custom_video = 0; - - return DrvInit(devilwCallback); -} - -struct BurnDriver BurnDrvDevilw = { - "devilw", NULL, NULL, NULL, "1987", - "Devil World\0", NULL, "Konami", "GX687", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, devilwRomInfo, devilwRomName, NULL, NULL, DevilwInputInfo, DevilwDIPInfo, - devilwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// Majuu no Ohkoku - -static struct BurnRomInfo majuuRomDesc[] = { - { "687_s05.6n", 0x10000, 0xbd99b434, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "687_s04.4n", 0x10000, 0x3df732e2, 1 | BRF_PRG | BRF_ESS }, // 1 - { "687_s09.6r", 0x10000, 0x1f6efec3, 1 | BRF_PRG | BRF_ESS }, // 2 - { "687_s08.4r", 0x10000, 0x8a16c8c6, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "687_q07.10n", 0x10000, 0x53110c0b, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "687_q06.8n", 0x10000, 0x9c53a0c5, 2 | BRF_PRG | BRF_ESS }, // 5 - { "687_q13.10s", 0x10000, 0x36ae6014, 2 | BRF_PRG | BRF_ESS }, // 6 - { "687_q12.8s", 0x10000, 0x6d012167, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "687_l03.10a", 0x08000, 0x7201983c, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "687_l14.d8", 0x04000, 0x20ecccd6, 4 | BRF_GRA }, // 9 Characters - - { "687i17.p16", 0x80000, 0x66cb3923, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "687i18.p18", 0x80000, 0xa1c7d0db, 5 | BRF_GRA }, // 11 - { "687i15.p13", 0x80000, 0xeec8c5b2, 5 | BRF_GRA }, // 12 - { "687i16.p15", 0x80000, 0x746cf48b, 5 | BRF_GRA }, // 13 - - { "687_l11.10r", 0x10000, 0x399deee8, 6 | BRF_GRA }, // 14 Sprites / Bg Tiles - { "687_l10.8r", 0x10000, 0x117c91ee, 6 | BRF_GRA }, // 15 - - { "687_i01.5a", 0x20000, 0xd4992dfb, 7 | BRF_SND }, // 16 K007232 Samples - - { "687_i02.7c", 0x20000, 0xe5947501, 8 | BRF_SND }, // 17 UPD7759 Samples -}; - -STD_ROM_PICK(majuu) -STD_ROM_FN(majuu) - -struct BurnDriver BurnDrvMajuu = { - "majuu", "devilw", NULL, NULL, "1987", - "Majuu no Ohkoku\0", NULL, "Konami", "GX687", - L"\u9B54\u7363\u306E\u738B\u56FD\0Majuu no Ohkoku\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, majuuRomInfo, majuuRomName, NULL, NULL, DevilwInputInfo, DevilwDIPInfo, - devilwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// Dark Adventure - -static struct BurnRomInfo darkadvRomDesc[] = { - { "687_n05.6n", 0x10000, 0xa9195b0b, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "687_n04.4n", 0x10000, 0x65b55105, 1 | BRF_PRG | BRF_ESS }, // 1 - { "687_n09.6r", 0x10000, 0x1c6b594c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "687_n08.4r", 0x10000, 0xa9603196, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "687_n07.10n", 0x10000, 0x6154322a, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "687_n06.8n", 0x10000, 0x37a72e8b, 2 | BRF_PRG | BRF_ESS }, // 5 - { "687_n13.10s", 0x10000, 0xf1c252af, 2 | BRF_PRG | BRF_ESS }, // 6 - { "687_n12.8s", 0x10000, 0xda221944, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "687_n03.10a", 0x08000, 0xa24c682f, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "687_n14.d8", 0x04000, 0xc76ac6d2, 4 | BRF_GRA }, // 9 Characters - - { "687i17.p16", 0x80000, 0x66cb3923, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "687i18.p18", 0x80000, 0xa1c7d0db, 5 | BRF_GRA }, // 11 - { "687i15.p13", 0x80000, 0xeec8c5b2, 5 | BRF_GRA }, // 12 - { "687i16.p15", 0x80000, 0x746cf48b, 5 | BRF_GRA }, // 13 - - { "687_l11.10r", 0x10000, 0x399deee8, 6 | BRF_GRA }, // 14 Sprites / Bg Tiles - { "687_l10.8r", 0x10000, 0x117c91ee, 6 | BRF_GRA }, // 15 - - { "687_i01.5a", 0x20000, 0xd4992dfb, 7 | BRF_SND }, // 16 K007232 Samples - - { "687_i02.7c", 0x20000, 0xe5947501, 8 | BRF_SND }, // 17 UPD7759 Samples -}; - -STD_ROM_PICK(darkadv) -STD_ROM_FN(darkadv) - -struct BurnDriver BurnDrvDarkadv = { - "darkadv", "devilw", NULL, NULL, "1987", - "Dark Adventure\0", NULL, "Konami", "GX687", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 3, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, - NULL, darkadvRomInfo, darkadvRomName, NULL, NULL, DarkadvInputInfo, DarkadvDIPInfo, - devilwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// Vulcan Venture (New) - -static struct BurnRomInfo vulcanRomDesc[] = { - { "785_w05.6n", 0x10000, 0x6e0e99cd, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "785_w04.4n", 0x10000, 0x23ec74ca, 1 | BRF_PRG | BRF_ESS }, // 1 - { "785_w09.6r", 0x10000, 0x377e4f28, 1 | BRF_PRG | BRF_ESS }, // 2 - { "785_w08.4r", 0x10000, 0x813d41ea, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "785_p07.10n", 0x10000, 0x686d549d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "785_p06.8n", 0x10000, 0x70c94bee, 2 | BRF_PRG | BRF_ESS }, // 5 - { "785_p13.10s", 0x10000, 0x478fdb0a, 2 | BRF_PRG | BRF_ESS }, // 6 - { "785_p12.8s", 0x10000, 0x38ea402a, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - - { "785_h14.d8", 0x04000, 0x02f4b16f, 4 | BRF_GRA }, // 9 Characters - - { "785f17.p16", 0x80000, 0x8fbec1a4, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "785f18.p18", 0x80000, 0x50d61e38, 5 | BRF_GRA }, // 11 - { "785f15.p13", 0x80000, 0xaf96aef3, 5 | BRF_GRA }, // 12 - { "785f16.p15", 0x80000, 0xb858df1f, 5 | BRF_GRA }, // 13 - - { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_SND }, // 14 K007232 Samples - - { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_SND }, // 15 UPD7759 Samples -}; - -STD_ROM_PICK(vulcan) -STD_ROM_FN(vulcan) - -static INT32 vulcanCallback() -{ - if (load68k(Drv68KROM0, 0)) return 1; - if (load68k(Drv68KROM1, 4)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 13, 1)) return 1; - - BurnByteswap(DrvGfxROM1, 0x200000); - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 14, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x000000, 15, 1)) return 1; - - return 0; -} - -static INT32 vulcanInit() -{ - is_vulcan = 1; - twin16_custom_video = 0; - - return DrvInit(vulcanCallback); -} - -struct BurnDriver BurnDrvVulcan = { - "vulcan", NULL, NULL, NULL, "1988", - "Vulcan Venture (New)\0", NULL, "Konami", "GX785", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, vulcanRomInfo, vulcanRomName, NULL, NULL, DrvInputInfo, VulcanDIPInfo, - vulcanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// Vulcan Venture (Old) - -static struct BurnRomInfo vulcanaRomDesc[] = { - { "785_r05.6n", 0x10000, 0x1777a57b, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "785_r04.4n", 0x10000, 0x790cbdf3, 1 | BRF_PRG | BRF_ESS }, // 1 - { "785_u09.6r", 0x10000, 0x1aba7010, 1 | BRF_PRG | BRF_ESS }, // 2 - { "785_k08.4r", 0x10000, 0x36bb1be1, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "785_p07.10n", 0x10000, 0x686d549d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "785_p06.8n", 0x10000, 0x70c94bee, 2 | BRF_PRG | BRF_ESS }, // 5 - { "785_p13.10s", 0x10000, 0x478fdb0a, 2 | BRF_PRG | BRF_ESS }, // 6 - { "785_p12.8s", 0x10000, 0x38ea402a, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "785_h14.d8", 0x04000, 0x02f4b16f, 4 | BRF_GRA }, // 9 Characters - - { "785f17.p16", 0x80000, 0x8fbec1a4, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "785f18.p18", 0x80000, 0x50d61e38, 5 | BRF_GRA }, // 11 - { "785f15.p13", 0x80000, 0xaf96aef3, 5 | BRF_GRA }, // 12 - { "785f16.p15", 0x80000, 0xb858df1f, 5 | BRF_GRA }, // 13 - - { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_SND }, // 14 K007232 Samples - - { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_SND }, // 15 UPD7759 Samples -}; - -STD_ROM_PICK(vulcana) -STD_ROM_FN(vulcana) - -struct BurnDriver BurnDrvVulcana = { - "vulcana", "vulcan", NULL, NULL, "1988", - "Vulcan Venture (Old)\0", NULL, "Konami", "GX785", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, vulcanaRomInfo, vulcanaRomName, NULL, NULL, DrvInputInfo, VulcanDIPInfo, - vulcanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// Vulcan Venture (Oldest) - -static struct BurnRomInfo vulcanbRomDesc[] = { - { "785_n05.6n", 0x10000, 0x6371d475, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "785_n04.4n", 0x10000, 0xb6f24b9e, 1 | BRF_PRG | BRF_ESS }, // 1 - { "785_r09.6r", 0x10000, 0xfbfd1543, 1 | BRF_PRG | BRF_ESS }, // 2 - { "785_r08.4r", 0x10000, 0x36bb1be1, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "785_g07.10n", 0x10000, 0xee09dd5d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "785_g06.8n", 0x10000, 0x85ab7af7, 2 | BRF_PRG | BRF_ESS }, // 5 - { "785_g13.10s", 0x10000, 0x274f325d, 2 | BRF_PRG | BRF_ESS }, // 6 - { "785_g12.8s", 0x10000, 0x1625f933, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "785_h14.d8", 0x04000, 0x02f4b16f, 4 | BRF_GRA }, // 9 Characters - - { "785f17.p16", 0x80000, 0x8fbec1a4, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "785f18.p18", 0x80000, 0x50d61e38, 5 | BRF_GRA }, // 11 - { "785f15.p13", 0x80000, 0xaf96aef3, 5 | BRF_GRA }, // 12 - { "785f16.p15", 0x80000, 0xb858df1f, 5 | BRF_GRA }, // 13 - - { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_SND }, // 14 K007232 Samples - - { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_SND }, // 15 UPD7759 Samples -}; - -STD_ROM_PICK(vulcanb) -STD_ROM_FN(vulcanb) - -struct BurnDriver BurnDrvVulcanb = { - "vulcanb", "vulcan", NULL, NULL, "1988", - "Vulcan Venture (Oldest)\0", NULL, "Konami", "GX785", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, vulcanbRomInfo, vulcanbRomName, NULL, NULL, DrvInputInfo, VulcanDIPInfo, - vulcanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// Gradius II - GOFER no Yabou (Japan New ver.) - -static struct BurnRomInfo gradius2RomDesc[] = { - { "785_x05.6n", 0x10000, 0x8a23a7b8, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "785_x04.4n", 0x10000, 0x88e466ce, 1 | BRF_PRG | BRF_ESS }, // 1 - { "785_x09.6r", 0x10000, 0x3f3d7d7a, 1 | BRF_PRG | BRF_ESS }, // 2 - { "785_x08.4r", 0x10000, 0xc39c8efd, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "785_p07.10n", 0x10000, 0x686d549d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "785_p06.8n", 0x10000, 0x70c94bee, 2 | BRF_PRG | BRF_ESS }, // 5 - { "785_p13.10s", 0x10000, 0x478fdb0a, 2 | BRF_PRG | BRF_ESS }, // 6 - { "785_p12.8s", 0x10000, 0x38ea402a, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "785_g14.d8", 0x04000, 0x9dcdad9d, 4 | BRF_GRA }, // 9 Characters - - { "gr2.p16", 0x80000, 0x4e7a7b82, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "gr2.p18", 0x80000, 0x3f604e9a, 5 | BRF_GRA }, // 11 - { "gr2.p13", 0x80000, 0x5bd239ac, 5 | BRF_GRA }, // 12 - { "gr2.p15", 0x80000, 0x95c6b8a3, 5 | BRF_GRA }, // 13 - - { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_SND }, // 14 K007232 Samples - - { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_SND }, // 15 UPD7759 Samples -}; - -STD_ROM_PICK(gradius2) -STD_ROM_FN(gradius2) - -static INT32 gradius2Callback() -{ - if (load68k(Drv68KROM0, 0)) return 1; - if (load68k(Drv68KROM1, 4)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 13, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 14, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x000000, 15, 1)) return 1; - - return 0; -} - -static INT32 gradius2Init() -{ - is_vulcan = 1; - twin16_custom_video = 0; - - return DrvInit(gradius2Callback); -} - -struct BurnDriver BurnDrvGradius2 = { - "gradius2", "vulcan", NULL, NULL, "1988", - "Gradius II - GOFER no Yabou (Japan New ver.)\0", NULL, "Konami", "GX785", - L"Gradius II - GOFER \u306E\u91CE\u671B (Japan New ver.)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, gradius2RomInfo, gradius2RomName, NULL, NULL, DrvInputInfo, Gradius2DIPInfo, - gradius2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// Gradius II - GOFER no Yabou (Japan Old ver.) - -static struct BurnRomInfo gradius2aRomDesc[] = { - { "785_p05.6n", 0x10000, 0x4db0e736, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "785_p04.4n", 0x10000, 0x765b99e6, 1 | BRF_PRG | BRF_ESS }, // 1 - { "785_t09.6r", 0x10000, 0x4e3f4965, 1 | BRF_PRG | BRF_ESS }, // 2 - { "785_j08.4r", 0x10000, 0x2b1c9108, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "785_p07.10n", 0x10000, 0x686d549d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "785_p06.8n", 0x10000, 0x70c94bee, 2 | BRF_PRG | BRF_ESS }, // 5 - { "785_p13.10s", 0x10000, 0x478fdb0a, 2 | BRF_PRG | BRF_ESS }, // 6 - { "785_p12.8s", 0x10000, 0x38ea402a, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "785_g14.d8", 0x04000, 0x9dcdad9d, 4 | BRF_GRA }, // 9 Characters - - { "785f17.p16", 0x80000, 0x8fbec1a4, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "785f18.p18", 0x80000, 0x50d61e38, 5 | BRF_GRA }, // 11 - { "785f15.p13", 0x80000, 0xaf96aef3, 5 | BRF_GRA }, // 12 - { "785f16.p15", 0x80000, 0xb858df1f, 5 | BRF_GRA }, // 13 - - { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_SND }, // 14 K007232 Samples - - { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_SND }, // 15 UPD7759 Samples -}; - -STD_ROM_PICK(gradius2a) -STD_ROM_FN(gradius2a) - -struct BurnDriver BurnDrvGradius2a = { - "gradius2a", "vulcan", NULL, NULL, "1988", - "Gradius II - GOFER no Yabou (Japan Old ver.)\0", NULL, "Konami", "GX785", - L"Gradius II - GOFER \u306E\u91CE\u671B (Japan Old ver.)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, gradius2aRomInfo, gradius2aRomName, NULL, NULL, DrvInputInfo, VulcanDIPInfo, - vulcanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// Gradius II - GOFER no Yabou (Japan Older ver.) - -static struct BurnRomInfo gradius2bRomDesc[] = { - { "785_p05.6n", 0x10000, 0x4db0e736, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "785_p04.4n", 0x10000, 0x765b99e6, 1 | BRF_PRG | BRF_ESS }, // 1 - { "785_j09.6r", 0x10000, 0x6d96a7e3, 1 | BRF_PRG | BRF_ESS }, // 2 - { "785_j08.4r", 0x10000, 0x2b1c9108, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "785_p07.10n", 0x10000, 0x686d549d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "785_p06.8n", 0x10000, 0x70c94bee, 2 | BRF_PRG | BRF_ESS }, // 5 - { "785_p13.10s", 0x10000, 0x478fdb0a, 2 | BRF_PRG | BRF_ESS }, // 6 - { "785_p12.8s", 0x10000, 0x38ea402a, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "785_g14.d8", 0x04000, 0x9dcdad9d, 4 | BRF_GRA }, // 9 Characters - - { "785f17.p16", 0x80000, 0x8fbec1a4, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "785f18.p18", 0x80000, 0x50d61e38, 5 | BRF_GRA }, // 11 - { "785f15.p13", 0x80000, 0xaf96aef3, 5 | BRF_GRA }, // 12 - { "785f16.p15", 0x80000, 0xb858df1f, 5 | BRF_GRA }, // 13 - - { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_GRA }, // 14 K007232 Samples - - { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_GRA }, // 15 UPD7759 Samples -}; - -STD_ROM_PICK(gradius2b) -STD_ROM_FN(gradius2b) - -struct BurnDriver BurnDrvGradius2b = { - "gradius2b", "vulcan", NULL, NULL, "1988", - "Gradius II - GOFER no Yabou (Japan Older ver.)\0", NULL, "Konami", "GX785", - L"Gradius II - GOFER \u306E\u91CE\u671B (Japan Older ver.)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, - NULL, gradius2bRomInfo, gradius2bRomName, NULL, NULL, DrvInputInfo, VulcanDIPInfo, - vulcanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// The Final Round (ver. M) - -static struct BurnRomInfo froundRomDesc[] = { - { "870_m21.bin", 0x20000, 0x436dbffb, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "870_m20.bin", 0x20000, 0xb1c79d6a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "870_f03.10a", 0x08000, 0xa645c727, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "870_f14.d8", 0x04000, 0xc9b46615, 4 | BRF_PRG | BRF_ESS }, // 3 Characters - - { "870c18.p18", 0x80000, 0x07927fe8, 5 | BRF_GRA }, // 4 Sprites / Bg Tiles - { "870c17.p16", 0x80000, 0x2bc99ff8, 5 | BRF_GRA }, // 5 - { "870c16.p15", 0x80000, 0x41df6a1b, 5 | BRF_GRA }, // 6 - { "870c15.p13", 0x80000, 0x8c9281df, 5 | BRF_GRA }, // 7 - - { "870_c01.5a", 0x20000, 0x6af96546, 7 | BRF_GRA }, // 8 K007232 Samples - - { "870_c02.7c", 0x20000, 0x54e12c6d, 8 | BRF_GRA }, // 9 UPD7759 Samples -}; - -STD_ROM_PICK(fround) -STD_ROM_FN(fround) - -static INT32 froundCallback() -{ - if (BurnLoadRom(Drv68KROM0 + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 7, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 8, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x000000, 9, 1)) return 1; - - return 0; -} - -static INT32 froundInit() -{ - twin16_custom_video = 1; - - return DrvInit(froundCallback); -} - -struct BurnDriver BurnDrvFround = { - "fround", NULL, NULL, NULL, "1988", - "The Final Round (ver. M)\0", NULL, "Konami", "GX870", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, froundRomInfo, froundRomName, NULL, NULL, DrvInputInfo, FroundDIPInfo, - froundInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// The Final Round (ver. L) - -static struct BurnRomInfo froundlRomDesc[] = { - { "870_l21.bin", 0x20000, 0xe21a3a19, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "870_l20.bin", 0x20000, 0x0ce9786f, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "870_f03.10a", 0x08000, 0xa645c727, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "870_f14.d8", 0x04000, 0xc9b46615, 4 | BRF_PRG | BRF_ESS }, // 3 Characters - - { "870c18.p18", 0x80000, 0x07927fe8, 5 | BRF_GRA }, // 4 Sprites / Bg Tiles - { "870c17.p16", 0x80000, 0x2bc99ff8, 5 | BRF_GRA }, // 5 - { "870c16.p15", 0x80000, 0x41df6a1b, 5 | BRF_GRA }, // 6 - { "870c15.p13", 0x80000, 0x8c9281df, 5 | BRF_GRA }, // 7 - - { "870_c01.5a", 0x20000, 0x6af96546, 7 | BRF_GRA }, // 8 K007232 Samples - - { "870_c02.7c", 0x20000, 0x54e12c6d, 8 | BRF_GRA }, // 9 UPD7759 Samples -}; - -STD_ROM_PICK(froundl) -STD_ROM_FN(froundl) - -struct BurnDriver BurnDrvFroundl = { - "froundl", "fround", NULL, NULL, "1988", - "The Final Round (ver. L)\0", NULL, "Konami", "GX870", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, froundlRomInfo, froundlRomName, NULL, NULL, DrvInputInfo, FroundDIPInfo, - froundInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// Hard Puncher (Japan) - -static struct BurnRomInfo hpuncherRomDesc[] = { - { "870_h05.6n", 0x10000, 0x2bcfeef3, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "870_h04.4n", 0x10000, 0xb9f97fd3, 1 | BRF_PRG | BRF_ESS }, // 1 - { "870_h09.6r", 0x10000, 0x96a4f8b1, 1 | BRF_PRG | BRF_ESS }, // 2 - { "870_h08.4r", 0x10000, 0x46d65156, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "870_h07.10n", 0x10000, 0xb4dda612, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "870_h06.8n", 0x10000, 0x696ba702, 2 | BRF_PRG | BRF_ESS }, // 5 - - { "870_g03.10a", 0x08000, 0xdb9c10c8, 3 | BRF_PRG | BRF_ESS }, // 6 Z80 Code - - { "870_f14.d8", 0x04000, 0xc9b46615, 4 | BRF_GRA }, // 7 Characters - - { "870c17.p16", 0x80000, 0x2bc99ff8, 5 | BRF_GRA }, // 8 Sprites / Bg Tiles - { "870c18.p18", 0x80000, 0x07927fe8, 5 | BRF_GRA }, // 9 - { "870c15.p13", 0x80000, 0x8c9281df, 5 | BRF_GRA }, // 10 - { "870c16.p15", 0x80000, 0x41df6a1b, 5 | BRF_GRA }, // 11 - - { "870_c01.5a", 0x20000, 0x6af96546, 7 | BRF_GRA }, // 12 K007232 Samples - - { "870_c02.7c", 0x20000, 0x54e12c6d, 8 | BRF_GRA }, // 13 UPD7759 Samples -}; - -STD_ROM_PICK(hpuncher) -STD_ROM_FN(hpuncher) - -static INT32 hpuncherCallback() -{ - if (load68k(Drv68KROM0, 0)) return 1; - - if (BurnLoadRom(Drv68KROM1 + 0x000001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM1 + 0x000000, 5, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 11, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 12, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x000000, 13, 1)) return 1; - - return 0; -} - -static INT32 hpuncherInit() -{ - twin16_custom_video = 2; - - return DrvInit(hpuncherCallback); -} - -struct BurnDriver BurnDrvHpuncher = { - "hpuncher", "fround", NULL, NULL, "1988", - "Hard Puncher (Japan)\0", NULL, "Konami", "GX870", - L"Hard Puncher \uFF0D\u8840\u307E\u307F\u308C\u306E\u6804\u5149\uFF0D (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, - NULL, hpuncherRomInfo, hpuncherRomName, NULL, NULL, DrvInputInfo, FroundDIPInfo, - hpuncherInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// M.I.A. - Missing in Action (Japan) - -static struct BurnRomInfo miajRomDesc[] = { - { "808_r05.6n", 0x10000, 0x91fd83f4, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "808_r04.4n", 0x10000, 0xf1c8c597, 1 | BRF_PRG | BRF_ESS }, // 1 - { "808_r09.6r", 0x10000, 0xf74d4467, 1 | BRF_PRG | BRF_ESS }, // 2 - { "808_r08.4r", 0x10000, 0x26f21704, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "808_e07.10n", 0x10000, 0x297bdcea, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "808_e06.8n", 0x10000, 0x8f576b33, 2 | BRF_PRG | BRF_ESS }, // 5 - { "808_e13.10s", 0x10000, 0x1fa708f4, 2 | BRF_PRG | BRF_ESS }, // 6 - { "808_e12.8s", 0x10000, 0xd62f1fde, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "808_e03.10a", 0x08000, 0x3d93a7cd, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "808_e14.d8", 0x04000, 0xb9d36525, 4 | BRF_GRA }, // 9 Characters - - { "808d17.p16", 0x80000, 0xd1299082, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "808d15.p13", 0x80000, 0x2b22a6b6, 5 | BRF_GRA }, // 11 - - { "808_d01.5a", 0x20000, 0xfd4d37c0, 7 | BRF_GRA }, // 12 K007232 Samples -}; - -STD_ROM_PICK(miaj) -STD_ROM_FN(miaj) - -static INT32 miajCallback() -{ - if (load68k(Drv68KROM0, 0)) return 1; - if (load68k(Drv68KROM1, 4)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 11, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 12, 1)) return 1; - - return 0; -} - -static INT32 miajInit() -{ - twin16_custom_video = 2; - - return DrvInit(miajCallback); -} - -struct BurnDriver BurnDrvMiaj = { - "miaj", "mia", NULL, NULL, "1989", - "M.I.A. - Missing in Action (Japan)\0", NULL, "Konami", "GX808", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM, 0, - NULL, miajRomInfo, miajRomName, NULL, NULL, DrvInputInfo, MiajDIPInfo, - miajInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; - - -// Cue Brick (Japan) - -static struct BurnRomInfo cuebrckjRomDesc[] = { - { "903_e05.6n", 0x10000, 0x8b556220, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "903_e04.4n", 0x10000, 0xbf9c7927, 1 | BRF_PRG | BRF_ESS }, // 1 - { "903_e09.6r", 0x10000, 0x2a77554d, 1 | BRF_PRG | BRF_ESS }, // 2 - { "903_e08.4r", 0x10000, 0xc0a430c1, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "903_d07.10n", 0x10000, 0xfc0edce7, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code - { "903_d06.8n", 0x10000, 0xb2cef6fe, 2 | BRF_PRG | BRF_ESS }, // 5 - { "903_e13.10s", 0x10000, 0x4fb5fb80, 2 | BRF_PRG | BRF_ESS }, // 6 - { "903_e12.8s", 0x10000, 0x883e3097, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "903_d03.10a", 0x08000, 0x455e855a, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "903_e14.d8", 0x04000, 0xddbebbd5, 4 | BRF_GRA }, // 9 Characters - - { "903_e11.10r", 0x10000, 0x5c41faf8, 6 | BRF_GRA }, // 10 Sprites / Bg Tiles - { "903_e10.8r", 0x10000, 0x417576d4, 6 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(cuebrckj) -STD_ROM_FN(cuebrckj) - -static INT32 cuebrckjCallback() -{ - if (load68k(Drv68KROM0, 0)) return 1; - if (load68k(Drv68KROM1, 4)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 11, 2)) return 1; - - return 0; -} - -static INT32 cuebrckjInit() -{ - twin16_custom_video = 2; - - return DrvInit(cuebrckjCallback); -} - -struct BurnDriver BurnDrvCuebrckj = { - "cuebrickj", "cuebrick", NULL, NULL, "1989", - "Cue Brick (Japan)\0", NULL, "Konami", "GX903", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PUZZLE, 0, - NULL, cuebrckjRomInfo, cuebrckjRomName, NULL, NULL, DrvInputInfo, CuebrckjDIPInfo, - cuebrckjInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 224, 4, 3 -}; +// FB Alpha Twin16 driver module +// Based on MAME driver by Phil Stroffolino + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "upd7759.h" +#include "k007232.h" + +static UINT8 *AllMem; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *Drv68KROM0; +static UINT8 *Drv68KROM1; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *DrvShareRAM; +static UINT8 *Drv68KRAM0; +static UINT8 *DrvPalRAM; +static UINT8 *DrvVidRAM2; +static UINT8 *DrvVidRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf; +static UINT8 *DrvNvRAM; +static UINT8 *DrvNvRAMBank; +static UINT8 *Drv68KRAM1; +static UINT8 *DrvFgRAM; +static UINT8 *DrvTileRAM; +static UINT8 *DrvSprGfxRAM; +static UINT8 *DrvGfxExp; + +static UINT8 *DrvZ80RAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT16 *scrollx; +static UINT16 *scrolly; + +static UINT8 *soundlatch; +static UINT8 *soundlatch2; + +static INT32 video_register; +static INT32 gfx_bank; + +static INT32 twin16_CPUA_register; +static INT32 twin16_CPUB_register; + +static INT32 need_process_spriteram; +static INT32 twin16_custom_video; +static INT32 is_vulcan = 0; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvJoy4[16]; +static UINT8 DrvInputs[4]; +static UINT8 DrvDips[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo DevilwInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, + {"Map Button", BIT_DIGITAL, DrvJoy1 + 3, "service2" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Devilw) + +static struct BurnInputInfo DarkadvInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, + + {"P3 Coin", BIT_DIGITAL, DrvJoy1 + 2, "p3 coin" }, + {"P3 Up", BIT_DIGITAL, DrvJoy4 + 2, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy4 + 3, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy4 + 0, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy4 + 1, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, DrvJoy4 + 6, "p3 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service 1", BIT_DIGITAL, DrvJoy1 + 6, "service" }, + {"Service 2", BIT_DIGITAL, DrvJoy1 + 7, "service2" }, + {"Service 3", BIT_DIGITAL, DrvJoy2 + 7, "service3" }, + {"Map Button", BIT_DIGITAL, DrvJoy1 + 3, "service4" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Darkadv) + +#define coinage_dips(offs) \ + {0 , 0xfe, 0 , 16, "Coin A" }, \ + {offs, 0x01, 0x0f, 0x02, "4 Coins 1 Credit " }, \ + {offs, 0x01, 0x0f, 0x05, "3 Coins 1 Credit " }, \ + {offs, 0x01, 0x0f, 0x08, "2 Coins 1 Credit " }, \ + {offs, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, \ + {offs, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, \ + {offs, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit " }, \ + {offs, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, \ + {offs, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, \ + {offs, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, \ + {offs, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, \ + {offs, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, \ + {offs, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, \ + {offs, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, \ + {offs, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, \ + {offs, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, \ + {offs, 0x01, 0x0f, 0x00, "Free Play" }, \ + \ + {0 , 0xfe, 0 , 16, "Coin B" }, \ + {offs, 0x01, 0xf0, 0x20, "4 Coins 1 Credit " }, \ + {offs, 0x01, 0xf0, 0x50, "3 Coins 1 Credit " }, \ + {offs, 0x01, 0xf0, 0x80, "2 Coins 1 Credit " }, \ + {offs, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, \ + {offs, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, \ + {offs, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit " }, \ + {offs, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, \ + {offs, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, \ + {offs, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, \ + {offs, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, \ + {offs, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, \ + {offs, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, \ + {offs, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, \ + {offs, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, \ + {offs, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, \ + {offs, 0x01, 0xf0, 0x00, "Disabled" }, + +static struct BurnDIPInfo DevilwDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0x5e, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + coinage_dips(0x13) + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x03, 0x03, "2" }, + {0x14, 0x01, 0x03, 0x02, "3" }, + {0x14, 0x01, 0x03, 0x01, "5" }, + {0x14, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x60, 0x60, "Easy" }, + {0x14, 0x01, 0x60, 0x40, "Normal" }, + {0x14, 0x01, 0x60, 0x20, "Difficult" }, + {0x14, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Devilw) + +static struct BurnDIPInfo DarkadvDIPList[]= +{ + {0x1d, 0xff, 0xff, 0xff, NULL }, + {0x1e, 0xff, 0xff, 0x5e, NULL }, + {0x1f, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x1d, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x1d, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x1d, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x1d, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x1d, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x1d, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x1d, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x1d, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x1d, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x1d, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x1d, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x1d, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x1d, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x1d, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x1d, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x1d, 0x01, 0x0f, 0x00, "Invalid" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x1e, 0x01, 0x03, 0x03, "2" }, + {0x1e, 0x01, 0x03, 0x02, "3" }, + {0x1e, 0x01, 0x03, 0x01, "5" }, + {0x1e, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x1e, 0x01, 0x60, 0x60, "Easy" }, + {0x1e, 0x01, 0x60, 0x40, "Normal" }, + {0x1e, 0x01, 0x60, 0x20, "Difficult" }, + {0x1e, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x1e, 0x01, 0x80, 0x80, "Off" }, + {0x1e, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x1f, 0x01, 0x01, 0x01, "Off" }, + {0x1f, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x1f, 0x01, 0x04, 0x04, "Off" }, + {0x1f, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Darkadv) + +static struct BurnDIPInfo VulcanDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x5a, NULL }, + {0x16, 0xff, 0xff, 0xfd, NULL }, + + coinage_dips(0x14) + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x03, "2" }, + {0x15, 0x01, 0x03, 0x02, "3" }, + {0x15, 0x01, 0x03, 0x01, "4" }, + {0x15, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x15, 0x01, 0x04, 0x00, "Upright" }, + {0x15, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x15, 0x01, 0x18, 0x18, "20K 70K" }, + {0x15, 0x01, 0x18, 0x10, "30K 80K" }, + {0x15, 0x01, 0x18, 0x08, "20K" }, + {0x15, 0x01, 0x18, 0x00, "70K" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Normal" }, + {0x15, 0x01, 0x60, 0x20, "Difficult" }, + {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Upright Controls" }, + {0x16, 0x01, 0x02, 0x02, "Single" }, + {0x16, 0x01, 0x02, 0x00, "Dual" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Vulcan) + +static struct BurnDIPInfo Gradius2DIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x5a, NULL }, + {0x16, 0xff, 0xff, 0xfd, NULL }, + + coinage_dips(0x14) + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x03, "2" }, + {0x15, 0x01, 0x03, 0x02, "3" }, + {0x15, 0x01, 0x03, 0x01, "4" }, + {0x15, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x15, 0x01, 0x04, 0x00, "Upright" }, + {0x15, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x15, 0x01, 0x18, 0x18, "20K 150K" }, + {0x15, 0x01, 0x18, 0x10, "30K 200K" }, + {0x15, 0x01, 0x18, 0x08, "20K" }, + {0x15, 0x01, 0x18, 0x00, "70K" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Normal" }, + {0x15, 0x01, 0x60, 0x20, "Difficult" }, + {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Upright Controls" }, + {0x16, 0x01, 0x02, 0x02, "Single" }, + {0x16, 0x01, 0x02, 0x00, "Dual" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Gradius2) + +static struct BurnDIPInfo FroundDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x42, NULL }, + {0x16, 0xff, 0xff, 0xfd, NULL }, + + coinage_dips(0x14) + + {0 , 0xfe, 0 , 4, "Energy" }, + {0x15, 0x01, 0x03, 0x03, "18" }, + {0x15, 0x01, 0x03, 0x02, "20" }, + {0x15, 0x01, 0x03, 0x01, "22" }, + {0x15, 0x01, 0x03, 0x00, "24" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Normal" }, + {0x15, 0x01, 0x60, 0x20, "Difficult" }, + {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Fround) + +static struct BurnDIPInfo MiajDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x52, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + coinage_dips(0x14) + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x03, "2" }, + {0x15, 0x01, 0x03, 0x02, "3" }, + {0x15, 0x01, 0x03, 0x01, "5" }, + {0x15, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x15, 0x01, 0x18, 0x18, "30K 80K" }, + {0x15, 0x01, 0x18, 0x10, "50K 100K" }, + {0x15, 0x01, 0x18, 0x08, "50K" }, + {0x15, 0x01, 0x18, 0x00, "100K" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Normal" }, + {0x15, 0x01, 0x60, 0x20, "Difficult" }, + {0x15, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "VRAM Character Check" }, + {0x16, 0x01, 0x02, 0x02, "Off" }, + {0x16, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, +}; + +STDDIPINFO(Miaj) + +static struct BurnDIPInfo CuebrckjDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x5a, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + coinage_dips(0x14) + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x03, "1" }, + {0x15, 0x01, 0x03, 0x02, "2" }, + {0x15, 0x01, 0x03, 0x01, "3" }, + {0x15, 0x01, 0x03, 0x00, "4" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x15, 0x01, 0x04, 0x00, "Upright" }, + {0x15, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Machine Name" }, + {0x15, 0x01, 0x18, 0x18, "None" }, + {0x15, 0x01, 0x18, 0x10, "Lewis" }, + {0x15, 0x01, 0x18, 0x08, "Johnson" }, + {0x15, 0x01, 0x18, 0x00, "George" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Normal" }, + {0x15, 0x01, 0x60, 0x20, "Hard" }, + {0x15, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Upright Controls" }, + {0x16, 0x01, 0x02, 0x02, "Single" }, + {0x16, 0x01, 0x02, 0x00, "Dual" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Mode" }, + {0x16, 0x01, 0x08, 0x08, "3" }, + {0x16, 0x01, 0x08, 0x00, "4" }, +}; + +STDDIPINFO(Cuebrckj) + +static void twin16_spriteram_process() +{ + INT32 dx = BURN_ENDIAN_SWAP_INT16(scrollx[0]); + INT32 dy = BURN_ENDIAN_SWAP_INT16(scrolly[0]); + + UINT16 *spriteram16 = (UINT16*)DrvSprRAM; + UINT16 *source = spriteram16; + UINT16 *finish = spriteram16 + 0x1800; + + memset(&spriteram16[0x1800], 0, 0x800); + + while (source < finish) + { + INT32 priority = BURN_ENDIAN_SWAP_INT16(source[0]); + if (priority & 0x8000 ) + { + UINT16 *dest = &spriteram16[0x1800 + ((priority & 0xff) << 2)]; + + INT32 xpos = (BURN_ENDIAN_SWAP_INT16(source[4]) << 16) | BURN_ENDIAN_SWAP_INT16(source[5]); + INT32 ypos = (BURN_ENDIAN_SWAP_INT16(source[6]) << 16) | BURN_ENDIAN_SWAP_INT16(source[7]); + + INT32 attributes = BURN_ENDIAN_SWAP_INT16(source[2])&0x03ff; + if (priority & 0x0200) attributes |= 0x4000; + + attributes |= 0x8000; + + dest[0] = source[3]; + dest[1] = BURN_ENDIAN_SWAP_INT16(((xpos >> 8) - dx) & 0xffff); + dest[2] = BURN_ENDIAN_SWAP_INT16(((ypos >> 8) - dy) & 0xffff); + dest[3] = BURN_ENDIAN_SWAP_INT16(attributes); + } + + source += 0x50/2; + } + + need_process_spriteram = 0; +} + +static void fround_CPU_register_w(INT32 data) +{ + INT32 old = twin16_CPUA_register; + twin16_CPUA_register = data; + if (twin16_CPUA_register != old) + { + if ((old & 0x08) == 0 && (twin16_CPUA_register & 0x08)) { + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } + } +} + +static void twin16_CPUA_register_w(INT32 data) +{ + if (twin16_CPUA_register != data) + { + if ((twin16_CPUA_register & 0x08) == 0 && (data & 0x08)) { + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } + + if ((twin16_CPUA_register & 0x40) && (data & 0x40) == 0) + twin16_spriteram_process(); + + if ((twin16_CPUA_register & 0x10) == 0 && (data & 0x10)) { + SekClose(); + SekOpen(1); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + SekClose(); + SekOpen(0); + } + + twin16_CPUA_register = data; + } +} + +static void twin16_CPUB_register_w(INT32 data) +{ + INT32 old = twin16_CPUB_register; + twin16_CPUB_register = data; + if (twin16_CPUB_register != old) + { + if ((old & 0x01) == 0 && (twin16_CPUB_register & 0x01)) + { + SekClose(); + SekOpen(0); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + SekClose(); + SekOpen(1); + } + + INT32 offset = (twin16_CPUB_register & 4) << 17; + SekMapMemory(DrvGfxROM1 + 0x100000 + offset, 0x700000, 0x77ffff, SM_ROM); + } +} + +void __fastcall twin16_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0xc0002: + case 0xc0006: + case 0xc000a: + scrollx[((address - 2) & 0x0c) >> 2] = BURN_ENDIAN_SWAP_INT16(data); + return; + + case 0xc0004: + case 0xc0008: + case 0xc000c: + scrolly[((address - 4) & 0x0c) >> 2] = BURN_ENDIAN_SWAP_INT16(data); + return; + + case 0xe0000: + gfx_bank = BURN_ENDIAN_SWAP_INT16(data); + return; + } +} + +void __fastcall twin16_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0xa0001: + if (twin16_custom_video == 1) { + fround_CPU_register_w(data); + } else { + twin16_CPUA_register_w(data); + } + return; + + case 0xa0008: + case 0xa0009: + *soundlatch = data; + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + + case 0xa0011: // watchdog + return; + + case 0xb0400: + { + *DrvNvRAMBank = data & 0x1f; + int offset = data & 0x1f; + SekMapMemory(DrvNvRAM + offset * 0x400, 0x0b0000, 0x0b03ff, SM_RAM); + } + return; + + case 0xc0001: + video_register = data; + return; + } +} + +UINT16 __fastcall twin16_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x0c000e: + case 0x0c000f: { + static INT32 ret = 0; + ret = 1-ret; + return ret; + } + + case 0x0a0000: + case 0x0a0002: + case 0x0a0004: + case 0x0a0006: + return DrvInputs[(address - 0xa0000)/2]; + + case 0x0a0010: + return DrvDips[1]; + + case 0x0a0012: + return DrvDips[0]; + + case 0x0a0018: + return DrvDips[2]; + } + + return 0; +} + +UINT8 __fastcall twin16_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x0c000e: + case 0x0c000f: { + static INT32 ret = 0; + ret = 1-ret; + return ret; + } + + case 0x0a0000: + case 0x0a0001: + case 0x0a0002: + case 0x0a0003: + case 0x0a0004: + case 0x0a0005: + case 0x0a0006: + case 0x0a0007: + return DrvInputs[(address - 0xa0000)/2]; + + case 0x0a0010: + case 0x0a0011: + return DrvDips[1]; + + case 0x0a0012: + case 0x0a0013: + return DrvDips[0]; + + case 0x0a0018: + case 0x0a0019: + return DrvDips[2]; + } + + return 0; +} + +static inline void twin16_tile_write(INT32 offset) +{ + DrvGfxExp[(offset << 1) + 2] = DrvTileRAM[offset + 0] >> 4; + DrvGfxExp[(offset << 1) + 3] = DrvTileRAM[offset + 0] & 0x0f; + DrvGfxExp[(offset << 1) + 0] = DrvTileRAM[offset + 1] >> 4; + DrvGfxExp[(offset << 1) + 1] = DrvTileRAM[offset + 1] & 0x0f; +} + +void __fastcall twin16_sub_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfc0000) == 0x500000) { + INT32 offset = address & 0x3ffff; + *((UINT16*)(DrvTileRAM + offset)) = BURN_ENDIAN_SWAP_INT16(data); + twin16_tile_write(offset); + return; + } +} + +void __fastcall twin16_sub_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0xa0001: + twin16_CPUB_register_w(data); + return; + } + + if ((address & 0xfc0000) == 0x500000) { + INT32 offset = address & 0x3ffff; + DrvTileRAM[offset^1] = data; + twin16_tile_write(offset & ~1); + return; + } +} + +void __fastcall twin16_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x9000: + *soundlatch2 = data; + UPD7759ResetWrite(0, data & 2); + return; + + case 0xc000: + BurnYM2151SelectRegister(data); + return; + + case 0xc001: + BurnYM2151WriteRegister(data); + return; + + case 0xd000: + UPD7759PortWrite(0, data); + return; + + case 0xe000: + UPD7759StartWrite(0, data & 1); + return; + } + + if ((address & 0xfff0) == 0xb000) { + K007232WriteReg(0, address & 0x0f, data); + return; + } +} + +UINT8 __fastcall twin16_sound_read(UINT16 address) +{ + switch (address) + { + case 0x9000: + return *soundlatch2; + + case 0xa000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0xc000: + case 0xc001: + return BurnYM2151ReadStatus(); + + case 0xf000: + return UPD7759BusyRead(0) ? 1 : 0; + } + + if ((address & 0xfff0) == 0xb000) { + return K007232ReadReg(0, address & 0x0f); + } + + return 0; +} + +static void DrvK007232VolCallback(INT32 v) +{ + K007232SetVolume(0, 0, (v >> 0x4) * 0x11, 0); + K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + SekOpen(1); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + UPD7759Reset(); + + gfx_bank = 0x3210; // for other than fround + video_register = 0; + + twin16_CPUA_register = 0; + twin16_CPUB_register = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM0 = Next; Next += 0x040000; + Drv68KROM1 = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x008000; + + DrvGfxROM0 = Next; Next += 0x008000; + DrvGfxROM1 = Next; Next += 0x200000; + DrvGfxROM2 = Next; Next += 0x020000; + + DrvSndROM0 = Next; Next += 0x020000; + DrvSndROM1 = Next; Next += 0x020000; + + DrvGfxExp = Next; Next += 0x400000; + DrvNvRAM = Next; Next += 0x008000; + + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + AllRam = Next; + + DrvSprRAM = Next; Next += 0x004000; + DrvSprBuf = Next; Next += 0x004000; + DrvShareRAM = Next; Next += 0x010000; + Drv68KRAM0 = Next; Next += 0x004000; + DrvPalRAM = Next; Next += 0x001000; + DrvVidRAM2 = Next; Next += 0x006000; + DrvVidRAM = Next; Next += 0x004000; + Drv68KRAM1 = Next; Next += 0x004000; + DrvFgRAM = Next; Next += 0x004000; + DrvTileRAM = Next; Next += 0x040000; + DrvSprGfxRAM = Next; Next += 0x020000; + + DrvZ80RAM = Next; Next += 0x001000; + + DrvNvRAMBank = Next; Next += 0x000001; + + scrollx = (UINT16*)Next; Next += 0x00004 * sizeof(UINT16); + scrolly = (UINT16*)Next; Next += 0x00004 * sizeof(UINT16); + + soundlatch = Next; Next += 0x000001; + soundlatch2 = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void expand4bpp(UINT8 *src, UINT8 *dst, INT32 len) +{ + for (INT32 i = len-1; i > 0; i--) { + dst[i * 2 + 0] = src[i] >> 4; + dst[i * 2 + 1] = src[i] & 0x0f; + } +} + +static void gfxdecode() +{ + UINT16 *src = (UINT16*)DrvGfxROM1; + UINT16 *dst = (UINT16*)BurnMalloc(0x200000); + for (INT32 i = 0; i < 0x80000; i++) + { + dst[i * 2 + 0] = src[i + 0x80000]; + dst[i * 2 + 1] = src[i + 0x00000]; + } + memcpy (src, dst, 0x200000); + BurnFree(dst); +} + +static INT32 load68k(UINT8 *rom, INT32 offs) +{ + if (BurnLoadRom(rom + 0x000001, offs+0, 2)) return 1; + if (BurnLoadRom(rom + 0x000000, offs+1, 2)) return 1; + if (BurnLoadRom(rom + 0x020001, offs+2, 2)) return 1; + if (BurnLoadRom(rom + 0x020000, offs+3, 2)) return 1; + + return 0; +} + +static INT32 DrvInit(INT32 (pLoadCallback)()) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (pLoadCallback != NULL) { + if (pLoadCallback()) return 1; + } + + gfxdecode(); + expand4bpp(DrvGfxROM0, DrvGfxROM0, 0x4000); + + if (twin16_custom_video == 1) + { + BurnByteswap(DrvGfxROM1, 0x200000); + expand4bpp(DrvGfxROM1, DrvGfxExp, 0x200000); + BurnByteswap(DrvGfxROM1, 0x200000); + } + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM0, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvShareRAM, 0x040000, 0x04ffff, SM_RAM); + SekMapMemory(Drv68KRAM0, 0x060000, 0x063fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x080000, 0x080fff, SM_RAM); + SekMapMemory(DrvNvRAM, 0x0b0000, 0x0b03ff, SM_RAM); + SekMapMemory(DrvVidRAM2, 0x100000, 0x105fff, SM_RAM); + SekMapMemory(DrvVidRAM, 0x120000, 0x123fff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x140000, 0x143fff, SM_RAM); + SekMapMemory(DrvGfxROM1, 0x500000, 0x6fffff, SM_ROM); + SekSetWriteWordHandler(0, twin16_main_write_word); + SekSetWriteByteHandler(0, twin16_main_write_byte); + SekSetReadWordHandler(0, twin16_main_read_word); + SekSetReadByteHandler(0, twin16_main_read_byte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Drv68KROM1, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvShareRAM, 0x040000, 0x04ffff, SM_RAM); + SekMapMemory(Drv68KRAM1, 0x060000, 0x063fff, SM_RAM); + SekMapMemory(DrvGfxROM2, 0x080000, 0x09ffff, SM_ROM); + SekMapMemory(DrvSprRAM, 0x400000, 0x403fff, SM_RAM); + SekMapMemory(DrvVidRAM, 0x480000, 0x483fff, SM_RAM); + SekMapMemory(DrvTileRAM, 0x500000, 0x53ffff, SM_ROM); + SekMapMemory(DrvGfxROM1, 0x600000, 0x6fffff, SM_ROM); + SekMapMemory(DrvGfxROM1 + 0x100000, 0x700000, 0x77ffff, SM_ROM); + SekMapMemory(DrvSprGfxRAM, 0x780000, 0x79ffff, SM_RAM); + SekSetWriteWordHandler(0, twin16_sub_write_word); + SekSetWriteByteHandler(0, twin16_sub_write_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x8fff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x8fff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x8fff, 2, DrvZ80RAM); + ZetSetWriteHandler(twin16_sound_write); + ZetSetReadHandler(twin16_sound_read); + ZetClose(); + + K007232Init(0, 3579545, DrvSndROM0, 0x20000); + K007232SetPortWriteHandler(0, DrvK007232VolCallback); + K007232PCMSetAllRoutes(0, 0.12, BURN_SND_ROUTE_BOTH); + + BurnYM2151Init(3579580); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvSndROM1); + UPD7759SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + SekExit(); + ZetExit(); + + K007232Exit(); + UPD7759Exit(); + BurnYM2151Exit(); + + BurnFree (AllMem); + + is_vulcan = 0; + twin16_custom_video = 0; + + return 0; +} + +static inline void DrvRecalcPal() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x1000 / 2; i+=2) + { + INT32 d = ((BURN_ENDIAN_SWAP_INT16(p[i+0]) & 0xff) << 8) | (BURN_ENDIAN_SWAP_INT16(p[i+1]) & 0xff); + + r = (d >> 0) & 0x1f; + g = (d >> 5) & 0x1f; + b = (d >> 10) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i/2] = BurnHighCol(r, g, b, 0); + } +} + +static void draw_fg_layer() +{ + INT32 flipx = (video_register & 2) ? 0x1f8 : 0; + INT32 flipy = (video_register & 1) ? 0x0f8 : 0; + + UINT16 *vram = (UINT16*)DrvVidRAM2; + + for (INT32 offs = 0x80; offs < 0x780; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + sx ^= flipx; + sy ^= flipy; + + if (flipx) sx -= 192; + sy -= 16; + + if (sx >= nScreenWidth) continue; + + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs]); + INT32 code = attr & 0x1ff; + INT32 color = (attr >> 9) & 0x0f; + + if (code == 0) continue; + + if (sx >= 0 && sx < nScreenWidth-7 && sy >= 0 && sy < nScreenHeight-7) { + if (flipx) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } + } + } +} + +static void draw_layer(INT32 opaque) +{ + INT32 o = 0; + INT32 banks[4]; + if (((video_register & 8) >> 3) != opaque) o = 1; + + UINT16 *vram = (UINT16*)(DrvVidRAM + (o << 13)); + banks[3] = gfx_bank >> 12; + banks[2] = (gfx_bank >> 8) & 0x0f; + banks[1] = (gfx_bank >> 4) & 0x0f; + banks[0] = gfx_bank & 0xf; + + INT32 dx = BURN_ENDIAN_SWAP_INT16(scrollx[1+o]); + INT32 dy = BURN_ENDIAN_SWAP_INT16(scrolly[1+o]); + + INT32 flipx = 0; + INT32 flipy = 0; + + if (video_register & 2) { + dx = 256-dx-64; + flipx = 1; + } + + if (video_register & 1) { + dy = 256-dy; + flipy = 1; + } + if (is_vulcan) flipy ^= 1; + + INT32 palette = o; + + for (INT32 offs = 0; offs < 64 * 64; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + if (video_register & 2) sx ^= 0x1f8; + if (video_register & 1) sy ^= 0x1f8; + + sx = (sx - dx) & 0x1ff; + sy = (sy - dy) & 0x1ff; + if (sx >= 320) sx-=512; + if (sy >= 256) sy-=512; + + sy -= 16; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); + INT32 color = (0x20 + (code >> 13) + 8 * palette); + code = (code & 0x7ff) | (banks[(code >> 11) & 3] << 11); + + if (sx >= 0 && sx < nScreenWidth-7 && sy >= 0 && sy < nScreenHeight-7) { + if (opaque) { + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); + } else { + Render8x8Tile_FlipY(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); + } + } else { + if (flipx) { + Render8x8Tile_FlipX(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); + } else { + Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); + } + } + } else { + if (code == 0) continue; + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); + } else { + Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); + } + } + } + } else { + if (sy < -7 || sy >= nScreenHeight || sx >= nScreenWidth) continue; + + if (opaque) { + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); + } else { + Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); + } + } else { + if (flipx) { + Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxExp); + } + } + } else { + if (code == 0) continue; + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxExp); + } + } + } + } + } +} + +static void draw_sprite(UINT16 *pen_data, INT32 pal_base, INT32 xpos, INT32 ypos, INT32 width, INT32 height, INT32 flipx, INT32 flipy) +{ + if (xpos >= 320) xpos -= 0x10000; + if (ypos >= 256) ypos -= 0x10000; + + for (INT32 y = 0; y < height; y++) + { + INT32 sy = (flipy) ? (ypos + height - 1 - y) : (ypos + y); + + if (sy >= 16 && sy < 240) + { + UINT16 *dest = pTransDraw + (sy - 16) * nScreenWidth; + + for (INT32 x = 0; x < width; x++) + { + INT32 sx = (flipx) ? (xpos + width - 1 - x) : (xpos + x); + + if (sx >= 0 && sx < 320) + { + INT32 pen = BURN_ENDIAN_SWAP_INT16(pen_data[x/4]); + + pen = (pen >> ((~x & 3) << 2)) & 0x0f; + + if (pen) dest[sx] = pal_base + pen; + } + } + } + + pen_data += width/4; + } +} + +static void draw_sprites(INT32 priority) +{ + UINT16 *twin16_sprite_gfx_ram = (UINT16*)DrvSprGfxRAM; + UINT16 *twin16_gfx_rom = (UINT16*)DrvGfxROM1; + UINT16 *buffered_spriteram16 = (UINT16*)DrvSprBuf; + + UINT16 *source = 0x1800+buffered_spriteram16; + UINT16 *finish = 0x1800+buffered_spriteram16 + 0x800 - 4; + + for (; source < finish; source += 4) + { + INT32 attributes = BURN_ENDIAN_SWAP_INT16(source[3]); + INT32 prio = (attributes&0x4000) >> 14; + if (prio != priority) continue; + + INT32 code = BURN_ENDIAN_SWAP_INT16(source[0]); + + if (code != 0xffff && attributes & 0x8000) + { + INT32 xpos = BURN_ENDIAN_SWAP_INT16(source[1]); + INT32 ypos = BURN_ENDIAN_SWAP_INT16(source[2]); + + INT32 pal_base = ((attributes&0xf)+0x10)*16; + INT32 height = 16<<((attributes>>6)&0x3); + INT32 width = 16<<((attributes>>4)&0x3); + INT32 flipy = attributes&0x0200; + INT32 flipx = attributes&0x0100; + UINT16 *pen_data = 0; + + if( twin16_custom_video == 1 ) + { + pen_data = twin16_gfx_rom + 0x80000; + } + else + { + switch( (code>>12)&0x3 ) + { + case 0: + pen_data = twin16_gfx_rom; + break; + + case 1: + pen_data = twin16_gfx_rom + 0x40000; + break; + + case 2: + pen_data = twin16_gfx_rom + 0x80000; + if( code&0x4000 ) pen_data += 0x40000; + break; + + case 3: + pen_data = twin16_sprite_gfx_ram; + break; + } + + code &= 0xfff; + } + + if (height == 64 && width == 64) + { + code &= ~8; + } + else if (height == 32 && width == 32) + { + code &= ~3; + } + else if (height == 32 && width == 16) + { + code &= ~1; + } + else if (height == 16 && width == 32) + { + code &= ~1; + } + + pen_data += code << 6; + + if( video_register&1 ) + { + if (ypos>65000) ypos=ypos-65536; + ypos = 256-ypos-height; + flipy = !flipy; + } + if( video_register&2 ) + { + if (xpos>65000) xpos=xpos-65536; + xpos = 320-xpos-width; + flipx = !flipx; + } + + draw_sprite(pen_data, pal_base, xpos, ypos, width, height, flipx, flipy); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvRecalcPal(); + } + + if (nBurnLayer & 1) draw_layer(1); + if (nSpriteEnable & 1) draw_sprites(1); + if (nBurnLayer & 2) draw_layer(0); + if (nSpriteEnable & 2) draw_sprites(0); + if (nBurnLayer & 4) draw_fg_layer(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 5); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + } + + // Clear Opposites + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; + if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; + if ((DrvInputs[3] & 0x0c) == 0) DrvInputs[3] |= 0x0c; + if ((DrvInputs[3] & 0x03) == 0) DrvInputs[3] |= 0x03; + } + + INT32 nSegment; + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 100; + if (twin16_custom_video == 0 && is_vulcan == 0) nInterleave = 1000; // devilw + + INT32 nTotalCycles[3] = { (twin16_custom_video == 1) ? 10000000 / 60 : 9216000 / 60, 9216000 / 60, 3579545 / 60 }; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + SekOpen(0); + nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); + nCyclesDone[0] += SekRun(nSegment); + if ((twin16_CPUA_register & 0x20) && i == nInterleave-1) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + SekClose(); + + if (twin16_custom_video != 1) { + SekOpen(1); + nCyclesDone[1] += SekRun(nSegment); + if ((twin16_CPUB_register & 0x02) && i == nInterleave-1) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + SekClose(); + } + + nSegment = (nTotalCycles[2] - nCyclesDone[2]) / (nInterleave - i); + + nCyclesDone[1] += ZetRun(nSegment); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + UPD7759Update(0, pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + UPD7759Update(0, pSoundBuf, nSegmentLength); + K007232Update(0, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + if(~twin16_CPUA_register & 0x40 && need_process_spriteram) + twin16_spriteram_process(); + + need_process_spriteram = 1; + + memcpy (DrvSprBuf, DrvSprRAM, 0x4000); + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + if (nAction & ACB_MEMORY_RAM) { + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.nAddress = 0x000000; + ba.szName = "All RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_NVRAM) { + ba.Data = DrvNvRAM; + ba.nLen = 0x008000; + ba.nAddress = 0xb00000; + ba.szName = "Cue Brick NV RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + UPD7759Scan(0, nAction, pnMin); + BurnYM2151Scan(nAction); + // K007232Scan(nAction, pnMin); // crash... + + SCAN_VAR(gfx_bank); + SCAN_VAR(video_register); + SCAN_VAR(twin16_CPUA_register); + SCAN_VAR(twin16_CPUB_register); + } + + if (nAction & ACB_WRITE) { + if (twin16_custom_video != 1) { + for (INT32 i = 0; i < 0x40000; i+=2) { + twin16_tile_write(i); + } + } + + SekOpen(0); + SekMapMemory(DrvNvRAM + (*DrvNvRAMBank * 0x400), 0x0b0000, 0x0b03ff, SM_RAM); + SekClose(); + + SekOpen(1); + INT32 offset = (twin16_CPUB_register & 4) << 17; + SekMapMemory(DrvGfxROM1 + 0x100000 + offset, 0x700000, 0x77ffff, SM_ROM); + SekClose(); + } + + return 0; +} + + +// Devil World + +static struct BurnRomInfo devilwRomDesc[] = { + { "687_t05.6n", 0x10000, 0x8ab7dc61, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "687_t04.4n", 0x10000, 0xc69924da, 1 | BRF_PRG | BRF_ESS }, // 1 + { "687_t09.6r", 0x10000, 0xfae97de0, 1 | BRF_PRG | BRF_ESS }, // 2 + { "687_t08.4r", 0x10000, 0x8c898d67, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "687_q07.10n", 0x10000, 0x53110c0b, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "687_q06.8n", 0x10000, 0x9c53a0c5, 2 | BRF_PRG | BRF_ESS }, // 5 + { "687_q13.10s", 0x10000, 0x36ae6014, 2 | BRF_PRG | BRF_ESS }, // 6 + { "687_q12.8s", 0x10000, 0x6d012167, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "687_l03.10a", 0x08000, 0x7201983c, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "687_m14.d8", 0x04000, 0xd7338557, 4 | BRF_GRA }, // 9 Characters + + { "687i17.p16", 0x80000, 0x66cb3923, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "687i18.p18", 0x80000, 0xa1c7d0db, 5 | BRF_GRA }, // 11 + { "687i15.p13", 0x80000, 0xeec8c5b2, 5 | BRF_GRA }, // 12 + { "687i16.p15", 0x80000, 0x746cf48b, 5 | BRF_GRA }, // 13 + + { "687_l11.10r", 0x10000, 0x399deee8, 6 | BRF_GRA }, // 14 Sprites / Bg Tiles + { "687_l10.8r", 0x10000, 0x117c91ee, 6 | BRF_GRA }, // 15 + + { "687_i01.5a", 0x20000, 0xd4992dfb, 7 | BRF_SND }, // 16 K007232 Samples + + { "687_i02.7c", 0x20000, 0xe5947501, 8 | BRF_SND }, // 17 UPD7759 Samples +}; + +STD_ROM_PICK(devilw) +STD_ROM_FN(devilw) + +static INT32 devilwCallback() +{ + if (load68k(Drv68KROM0, 0)) return 1; + if (load68k(Drv68KROM1, 4)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 13, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 15, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 16, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x000000, 17, 1)) return 1; + + return 0; +} + +static INT32 devilwInit() +{ + twin16_custom_video = 0; + + return DrvInit(devilwCallback); +} + +struct BurnDriver BurnDrvDevilw = { + "devilw", NULL, NULL, NULL, "1987", + "Devil World\0", NULL, "Konami", "GX687", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, devilwRomInfo, devilwRomName, NULL, NULL, DevilwInputInfo, DevilwDIPInfo, + devilwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// Majuu no Ohkoku + +static struct BurnRomInfo majuuRomDesc[] = { + { "687_s05.6n", 0x10000, 0xbd99b434, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "687_s04.4n", 0x10000, 0x3df732e2, 1 | BRF_PRG | BRF_ESS }, // 1 + { "687_s09.6r", 0x10000, 0x1f6efec3, 1 | BRF_PRG | BRF_ESS }, // 2 + { "687_s08.4r", 0x10000, 0x8a16c8c6, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "687_q07.10n", 0x10000, 0x53110c0b, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "687_q06.8n", 0x10000, 0x9c53a0c5, 2 | BRF_PRG | BRF_ESS }, // 5 + { "687_q13.10s", 0x10000, 0x36ae6014, 2 | BRF_PRG | BRF_ESS }, // 6 + { "687_q12.8s", 0x10000, 0x6d012167, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "687_l03.10a", 0x08000, 0x7201983c, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "687_l14.d8", 0x04000, 0x20ecccd6, 4 | BRF_GRA }, // 9 Characters + + { "687i17.p16", 0x80000, 0x66cb3923, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "687i18.p18", 0x80000, 0xa1c7d0db, 5 | BRF_GRA }, // 11 + { "687i15.p13", 0x80000, 0xeec8c5b2, 5 | BRF_GRA }, // 12 + { "687i16.p15", 0x80000, 0x746cf48b, 5 | BRF_GRA }, // 13 + + { "687_l11.10r", 0x10000, 0x399deee8, 6 | BRF_GRA }, // 14 Sprites / Bg Tiles + { "687_l10.8r", 0x10000, 0x117c91ee, 6 | BRF_GRA }, // 15 + + { "687_i01.5a", 0x20000, 0xd4992dfb, 7 | BRF_SND }, // 16 K007232 Samples + + { "687_i02.7c", 0x20000, 0xe5947501, 8 | BRF_SND }, // 17 UPD7759 Samples +}; + +STD_ROM_PICK(majuu) +STD_ROM_FN(majuu) + +struct BurnDriver BurnDrvMajuu = { + "majuu", "devilw", NULL, NULL, "1987", + "Majuu no Ohkoku\0", NULL, "Konami", "GX687", + L"\u9B54\u7363\u306E\u738B\u56FD\0Majuu no Ohkoku\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, majuuRomInfo, majuuRomName, NULL, NULL, DevilwInputInfo, DevilwDIPInfo, + devilwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// Dark Adventure + +static struct BurnRomInfo darkadvRomDesc[] = { + { "687_n05.6n", 0x10000, 0xa9195b0b, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "687_n04.4n", 0x10000, 0x65b55105, 1 | BRF_PRG | BRF_ESS }, // 1 + { "687_n09.6r", 0x10000, 0x1c6b594c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "687_n08.4r", 0x10000, 0xa9603196, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "687_n07.10n", 0x10000, 0x6154322a, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "687_n06.8n", 0x10000, 0x37a72e8b, 2 | BRF_PRG | BRF_ESS }, // 5 + { "687_n13.10s", 0x10000, 0xf1c252af, 2 | BRF_PRG | BRF_ESS }, // 6 + { "687_n12.8s", 0x10000, 0xda221944, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "687_n03.10a", 0x08000, 0xa24c682f, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "687_n14.d8", 0x04000, 0xc76ac6d2, 4 | BRF_GRA }, // 9 Characters + + { "687i17.p16", 0x80000, 0x66cb3923, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "687i18.p18", 0x80000, 0xa1c7d0db, 5 | BRF_GRA }, // 11 + { "687i15.p13", 0x80000, 0xeec8c5b2, 5 | BRF_GRA }, // 12 + { "687i16.p15", 0x80000, 0x746cf48b, 5 | BRF_GRA }, // 13 + + { "687_l11.10r", 0x10000, 0x399deee8, 6 | BRF_GRA }, // 14 Sprites / Bg Tiles + { "687_l10.8r", 0x10000, 0x117c91ee, 6 | BRF_GRA }, // 15 + + { "687_i01.5a", 0x20000, 0xd4992dfb, 7 | BRF_SND }, // 16 K007232 Samples + + { "687_i02.7c", 0x20000, 0xe5947501, 8 | BRF_SND }, // 17 UPD7759 Samples +}; + +STD_ROM_PICK(darkadv) +STD_ROM_FN(darkadv) + +struct BurnDriver BurnDrvDarkadv = { + "darkadv", "devilw", NULL, NULL, "1987", + "Dark Adventure\0", NULL, "Konami", "GX687", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 3, HARDWARE_PREFIX_KONAMI, GBF_SHOOT, 0, + NULL, darkadvRomInfo, darkadvRomName, NULL, NULL, DarkadvInputInfo, DarkadvDIPInfo, + devilwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// Vulcan Venture (New) + +static struct BurnRomInfo vulcanRomDesc[] = { + { "785_w05.6n", 0x10000, 0x6e0e99cd, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "785_w04.4n", 0x10000, 0x23ec74ca, 1 | BRF_PRG | BRF_ESS }, // 1 + { "785_w09.6r", 0x10000, 0x377e4f28, 1 | BRF_PRG | BRF_ESS }, // 2 + { "785_w08.4r", 0x10000, 0x813d41ea, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "785_p07.10n", 0x10000, 0x686d549d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "785_p06.8n", 0x10000, 0x70c94bee, 2 | BRF_PRG | BRF_ESS }, // 5 + { "785_p13.10s", 0x10000, 0x478fdb0a, 2 | BRF_PRG | BRF_ESS }, // 6 + { "785_p12.8s", 0x10000, 0x38ea402a, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + + { "785_h14.d8", 0x04000, 0x02f4b16f, 4 | BRF_GRA }, // 9 Characters + + { "785f17.p16", 0x80000, 0x8fbec1a4, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "785f18.p18", 0x80000, 0x50d61e38, 5 | BRF_GRA }, // 11 + { "785f15.p13", 0x80000, 0xaf96aef3, 5 | BRF_GRA }, // 12 + { "785f16.p15", 0x80000, 0xb858df1f, 5 | BRF_GRA }, // 13 + + { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_SND }, // 14 K007232 Samples + + { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_SND }, // 15 UPD7759 Samples +}; + +STD_ROM_PICK(vulcan) +STD_ROM_FN(vulcan) + +static INT32 vulcanCallback() +{ + if (load68k(Drv68KROM0, 0)) return 1; + if (load68k(Drv68KROM1, 4)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 13, 1)) return 1; + + BurnByteswap(DrvGfxROM1, 0x200000); + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 14, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x000000, 15, 1)) return 1; + + return 0; +} + +static INT32 vulcanInit() +{ + is_vulcan = 1; + twin16_custom_video = 0; + + return DrvInit(vulcanCallback); +} + +struct BurnDriver BurnDrvVulcan = { + "vulcan", NULL, NULL, NULL, "1988", + "Vulcan Venture (New)\0", NULL, "Konami", "GX785", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, vulcanRomInfo, vulcanRomName, NULL, NULL, DrvInputInfo, VulcanDIPInfo, + vulcanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// Vulcan Venture (Old) + +static struct BurnRomInfo vulcanaRomDesc[] = { + { "785_r05.6n", 0x10000, 0x1777a57b, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "785_r04.4n", 0x10000, 0x790cbdf3, 1 | BRF_PRG | BRF_ESS }, // 1 + { "785_u09.6r", 0x10000, 0x1aba7010, 1 | BRF_PRG | BRF_ESS }, // 2 + { "785_k08.4r", 0x10000, 0x36bb1be1, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "785_p07.10n", 0x10000, 0x686d549d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "785_p06.8n", 0x10000, 0x70c94bee, 2 | BRF_PRG | BRF_ESS }, // 5 + { "785_p13.10s", 0x10000, 0x478fdb0a, 2 | BRF_PRG | BRF_ESS }, // 6 + { "785_p12.8s", 0x10000, 0x38ea402a, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "785_h14.d8", 0x04000, 0x02f4b16f, 4 | BRF_GRA }, // 9 Characters + + { "785f17.p16", 0x80000, 0x8fbec1a4, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "785f18.p18", 0x80000, 0x50d61e38, 5 | BRF_GRA }, // 11 + { "785f15.p13", 0x80000, 0xaf96aef3, 5 | BRF_GRA }, // 12 + { "785f16.p15", 0x80000, 0xb858df1f, 5 | BRF_GRA }, // 13 + + { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_SND }, // 14 K007232 Samples + + { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_SND }, // 15 UPD7759 Samples +}; + +STD_ROM_PICK(vulcana) +STD_ROM_FN(vulcana) + +struct BurnDriver BurnDrvVulcana = { + "vulcana", "vulcan", NULL, NULL, "1988", + "Vulcan Venture (Old)\0", NULL, "Konami", "GX785", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, vulcanaRomInfo, vulcanaRomName, NULL, NULL, DrvInputInfo, VulcanDIPInfo, + vulcanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// Vulcan Venture (Oldest) + +static struct BurnRomInfo vulcanbRomDesc[] = { + { "785_n05.6n", 0x10000, 0x6371d475, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "785_n04.4n", 0x10000, 0xb6f24b9e, 1 | BRF_PRG | BRF_ESS }, // 1 + { "785_r09.6r", 0x10000, 0xfbfd1543, 1 | BRF_PRG | BRF_ESS }, // 2 + { "785_r08.4r", 0x10000, 0x36bb1be1, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "785_g07.10n", 0x10000, 0xee09dd5d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "785_g06.8n", 0x10000, 0x85ab7af7, 2 | BRF_PRG | BRF_ESS }, // 5 + { "785_g13.10s", 0x10000, 0x274f325d, 2 | BRF_PRG | BRF_ESS }, // 6 + { "785_g12.8s", 0x10000, 0x1625f933, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "785_h14.d8", 0x04000, 0x02f4b16f, 4 | BRF_GRA }, // 9 Characters + + { "785f17.p16", 0x80000, 0x8fbec1a4, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "785f18.p18", 0x80000, 0x50d61e38, 5 | BRF_GRA }, // 11 + { "785f15.p13", 0x80000, 0xaf96aef3, 5 | BRF_GRA }, // 12 + { "785f16.p15", 0x80000, 0xb858df1f, 5 | BRF_GRA }, // 13 + + { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_SND }, // 14 K007232 Samples + + { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_SND }, // 15 UPD7759 Samples +}; + +STD_ROM_PICK(vulcanb) +STD_ROM_FN(vulcanb) + +struct BurnDriver BurnDrvVulcanb = { + "vulcanb", "vulcan", NULL, NULL, "1988", + "Vulcan Venture (Oldest)\0", NULL, "Konami", "GX785", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, vulcanbRomInfo, vulcanbRomName, NULL, NULL, DrvInputInfo, VulcanDIPInfo, + vulcanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// Gradius II - GOFER no Yabou (Japan New ver.) + +static struct BurnRomInfo gradius2RomDesc[] = { + { "785_x05.6n", 0x10000, 0x8a23a7b8, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "785_x04.4n", 0x10000, 0x88e466ce, 1 | BRF_PRG | BRF_ESS }, // 1 + { "785_x09.6r", 0x10000, 0x3f3d7d7a, 1 | BRF_PRG | BRF_ESS }, // 2 + { "785_x08.4r", 0x10000, 0xc39c8efd, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "785_p07.10n", 0x10000, 0x686d549d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "785_p06.8n", 0x10000, 0x70c94bee, 2 | BRF_PRG | BRF_ESS }, // 5 + { "785_p13.10s", 0x10000, 0x478fdb0a, 2 | BRF_PRG | BRF_ESS }, // 6 + { "785_p12.8s", 0x10000, 0x38ea402a, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "785_g14.d8", 0x04000, 0x9dcdad9d, 4 | BRF_GRA }, // 9 Characters + + { "gr2.p16", 0x80000, 0x4e7a7b82, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "gr2.p18", 0x80000, 0x3f604e9a, 5 | BRF_GRA }, // 11 + { "gr2.p13", 0x80000, 0x5bd239ac, 5 | BRF_GRA }, // 12 + { "gr2.p15", 0x80000, 0x95c6b8a3, 5 | BRF_GRA }, // 13 + + { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_SND }, // 14 K007232 Samples + + { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_SND }, // 15 UPD7759 Samples +}; + +STD_ROM_PICK(gradius2) +STD_ROM_FN(gradius2) + +static INT32 gradius2Callback() +{ + if (load68k(Drv68KROM0, 0)) return 1; + if (load68k(Drv68KROM1, 4)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 13, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 14, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x000000, 15, 1)) return 1; + + return 0; +} + +static INT32 gradius2Init() +{ + is_vulcan = 1; + twin16_custom_video = 0; + + return DrvInit(gradius2Callback); +} + +struct BurnDriver BurnDrvGradius2 = { + "gradius2", "vulcan", NULL, NULL, "1988", + "Gradius II - GOFER no Yabou (Japan New ver.)\0", NULL, "Konami", "GX785", + L"Gradius II - GOFER \u306E\u91CE\u671B (Japan New ver.)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, gradius2RomInfo, gradius2RomName, NULL, NULL, DrvInputInfo, Gradius2DIPInfo, + gradius2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// Gradius II - GOFER no Yabou (Japan Old ver.) + +static struct BurnRomInfo gradius2aRomDesc[] = { + { "785_p05.6n", 0x10000, 0x4db0e736, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "785_p04.4n", 0x10000, 0x765b99e6, 1 | BRF_PRG | BRF_ESS }, // 1 + { "785_t09.6r", 0x10000, 0x4e3f4965, 1 | BRF_PRG | BRF_ESS }, // 2 + { "785_j08.4r", 0x10000, 0x2b1c9108, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "785_p07.10n", 0x10000, 0x686d549d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "785_p06.8n", 0x10000, 0x70c94bee, 2 | BRF_PRG | BRF_ESS }, // 5 + { "785_p13.10s", 0x10000, 0x478fdb0a, 2 | BRF_PRG | BRF_ESS }, // 6 + { "785_p12.8s", 0x10000, 0x38ea402a, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "785_g14.d8", 0x04000, 0x9dcdad9d, 4 | BRF_GRA }, // 9 Characters + + { "785f17.p16", 0x80000, 0x8fbec1a4, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "785f18.p18", 0x80000, 0x50d61e38, 5 | BRF_GRA }, // 11 + { "785f15.p13", 0x80000, 0xaf96aef3, 5 | BRF_GRA }, // 12 + { "785f16.p15", 0x80000, 0xb858df1f, 5 | BRF_GRA }, // 13 + + { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_SND }, // 14 K007232 Samples + + { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_SND }, // 15 UPD7759 Samples +}; + +STD_ROM_PICK(gradius2a) +STD_ROM_FN(gradius2a) + +struct BurnDriver BurnDrvGradius2a = { + "gradius2a", "vulcan", NULL, NULL, "1988", + "Gradius II - GOFER no Yabou (Japan Old ver.)\0", NULL, "Konami", "GX785", + L"Gradius II - GOFER \u306E\u91CE\u671B (Japan Old ver.)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, gradius2aRomInfo, gradius2aRomName, NULL, NULL, DrvInputInfo, VulcanDIPInfo, + vulcanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// Gradius II - GOFER no Yabou (Japan Older ver.) + +static struct BurnRomInfo gradius2bRomDesc[] = { + { "785_p05.6n", 0x10000, 0x4db0e736, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "785_p04.4n", 0x10000, 0x765b99e6, 1 | BRF_PRG | BRF_ESS }, // 1 + { "785_j09.6r", 0x10000, 0x6d96a7e3, 1 | BRF_PRG | BRF_ESS }, // 2 + { "785_j08.4r", 0x10000, 0x2b1c9108, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "785_p07.10n", 0x10000, 0x686d549d, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "785_p06.8n", 0x10000, 0x70c94bee, 2 | BRF_PRG | BRF_ESS }, // 5 + { "785_p13.10s", 0x10000, 0x478fdb0a, 2 | BRF_PRG | BRF_ESS }, // 6 + { "785_p12.8s", 0x10000, 0x38ea402a, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "785_g03.10a", 0x08000, 0x67a3b50d, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "785_g14.d8", 0x04000, 0x9dcdad9d, 4 | BRF_GRA }, // 9 Characters + + { "785f17.p16", 0x80000, 0x8fbec1a4, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "785f18.p18", 0x80000, 0x50d61e38, 5 | BRF_GRA }, // 11 + { "785f15.p13", 0x80000, 0xaf96aef3, 5 | BRF_GRA }, // 12 + { "785f16.p15", 0x80000, 0xb858df1f, 5 | BRF_GRA }, // 13 + + { "785_f01.5a", 0x20000, 0xa0d8d69e, 7 | BRF_GRA }, // 14 K007232 Samples + + { "785_f02.7c", 0x20000, 0xc39f5ca4, 8 | BRF_GRA }, // 15 UPD7759 Samples +}; + +STD_ROM_PICK(gradius2b) +STD_ROM_FN(gradius2b) + +struct BurnDriver BurnDrvGradius2b = { + "gradius2b", "vulcan", NULL, NULL, "1988", + "Gradius II - GOFER no Yabou (Japan Older ver.)\0", NULL, "Konami", "GX785", + L"Gradius II - GOFER \u306E\u91CE\u671B (Japan Older ver.)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_HORSHOOT, 0, + NULL, gradius2bRomInfo, gradius2bRomName, NULL, NULL, DrvInputInfo, VulcanDIPInfo, + vulcanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// The Final Round (ver. M) + +static struct BurnRomInfo froundRomDesc[] = { + { "870_m21.bin", 0x20000, 0x436dbffb, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "870_m20.bin", 0x20000, 0xb1c79d6a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "870_f03.10a", 0x08000, 0xa645c727, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "870_f14.d8", 0x04000, 0xc9b46615, 4 | BRF_PRG | BRF_ESS }, // 3 Characters + + { "870c18.p18", 0x80000, 0x07927fe8, 5 | BRF_GRA }, // 4 Sprites / Bg Tiles + { "870c17.p16", 0x80000, 0x2bc99ff8, 5 | BRF_GRA }, // 5 + { "870c16.p15", 0x80000, 0x41df6a1b, 5 | BRF_GRA }, // 6 + { "870c15.p13", 0x80000, 0x8c9281df, 5 | BRF_GRA }, // 7 + + { "870_c01.5a", 0x20000, 0x6af96546, 7 | BRF_GRA }, // 8 K007232 Samples + + { "870_c02.7c", 0x20000, 0x54e12c6d, 8 | BRF_GRA }, // 9 UPD7759 Samples +}; + +STD_ROM_PICK(fround) +STD_ROM_FN(fround) + +static INT32 froundCallback() +{ + if (BurnLoadRom(Drv68KROM0 + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 7, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 8, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x000000, 9, 1)) return 1; + + return 0; +} + +static INT32 froundInit() +{ + twin16_custom_video = 1; + + return DrvInit(froundCallback); +} + +struct BurnDriver BurnDrvFround = { + "fround", NULL, NULL, NULL, "1988", + "The Final Round (ver. M)\0", NULL, "Konami", "GX870", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, froundRomInfo, froundRomName, NULL, NULL, DrvInputInfo, FroundDIPInfo, + froundInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// The Final Round (ver. L) + +static struct BurnRomInfo froundlRomDesc[] = { + { "870_l21.bin", 0x20000, 0xe21a3a19, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "870_l20.bin", 0x20000, 0x0ce9786f, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "870_f03.10a", 0x08000, 0xa645c727, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "870_f14.d8", 0x04000, 0xc9b46615, 4 | BRF_PRG | BRF_ESS }, // 3 Characters + + { "870c18.p18", 0x80000, 0x07927fe8, 5 | BRF_GRA }, // 4 Sprites / Bg Tiles + { "870c17.p16", 0x80000, 0x2bc99ff8, 5 | BRF_GRA }, // 5 + { "870c16.p15", 0x80000, 0x41df6a1b, 5 | BRF_GRA }, // 6 + { "870c15.p13", 0x80000, 0x8c9281df, 5 | BRF_GRA }, // 7 + + { "870_c01.5a", 0x20000, 0x6af96546, 7 | BRF_GRA }, // 8 K007232 Samples + + { "870_c02.7c", 0x20000, 0x54e12c6d, 8 | BRF_GRA }, // 9 UPD7759 Samples +}; + +STD_ROM_PICK(froundl) +STD_ROM_FN(froundl) + +struct BurnDriver BurnDrvFroundl = { + "froundl", "fround", NULL, NULL, "1988", + "The Final Round (ver. L)\0", NULL, "Konami", "GX870", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, froundlRomInfo, froundlRomName, NULL, NULL, DrvInputInfo, FroundDIPInfo, + froundInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// Hard Puncher (Japan) + +static struct BurnRomInfo hpuncherRomDesc[] = { + { "870_h05.6n", 0x10000, 0x2bcfeef3, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "870_h04.4n", 0x10000, 0xb9f97fd3, 1 | BRF_PRG | BRF_ESS }, // 1 + { "870_h09.6r", 0x10000, 0x96a4f8b1, 1 | BRF_PRG | BRF_ESS }, // 2 + { "870_h08.4r", 0x10000, 0x46d65156, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "870_h07.10n", 0x10000, 0xb4dda612, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "870_h06.8n", 0x10000, 0x696ba702, 2 | BRF_PRG | BRF_ESS }, // 5 + + { "870_g03.10a", 0x08000, 0xdb9c10c8, 3 | BRF_PRG | BRF_ESS }, // 6 Z80 Code + + { "870_f14.d8", 0x04000, 0xc9b46615, 4 | BRF_GRA }, // 7 Characters + + { "870c17.p16", 0x80000, 0x2bc99ff8, 5 | BRF_GRA }, // 8 Sprites / Bg Tiles + { "870c18.p18", 0x80000, 0x07927fe8, 5 | BRF_GRA }, // 9 + { "870c15.p13", 0x80000, 0x8c9281df, 5 | BRF_GRA }, // 10 + { "870c16.p15", 0x80000, 0x41df6a1b, 5 | BRF_GRA }, // 11 + + { "870_c01.5a", 0x20000, 0x6af96546, 7 | BRF_GRA }, // 12 K007232 Samples + + { "870_c02.7c", 0x20000, 0x54e12c6d, 8 | BRF_GRA }, // 13 UPD7759 Samples +}; + +STD_ROM_PICK(hpuncher) +STD_ROM_FN(hpuncher) + +static INT32 hpuncherCallback() +{ + if (load68k(Drv68KROM0, 0)) return 1; + + if (BurnLoadRom(Drv68KROM1 + 0x000001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM1 + 0x000000, 5, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 11, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 12, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x000000, 13, 1)) return 1; + + return 0; +} + +static INT32 hpuncherInit() +{ + twin16_custom_video = 2; + + return DrvInit(hpuncherCallback); +} + +struct BurnDriver BurnDrvHpuncher = { + "hpuncher", "fround", NULL, NULL, "1988", + "Hard Puncher (Japan)\0", NULL, "Konami", "GX870", + L"Hard Puncher \uFF0D\u8840\u307E\u307F\u308C\u306E\u6804\u5149\uFF0D (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SPORTSMISC, 0, + NULL, hpuncherRomInfo, hpuncherRomName, NULL, NULL, DrvInputInfo, FroundDIPInfo, + hpuncherInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// M.I.A. - Missing in Action (Japan) + +static struct BurnRomInfo miajRomDesc[] = { + { "808_r05.6n", 0x10000, 0x91fd83f4, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "808_r04.4n", 0x10000, 0xf1c8c597, 1 | BRF_PRG | BRF_ESS }, // 1 + { "808_r09.6r", 0x10000, 0xf74d4467, 1 | BRF_PRG | BRF_ESS }, // 2 + { "808_r08.4r", 0x10000, 0x26f21704, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "808_e07.10n", 0x10000, 0x297bdcea, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "808_e06.8n", 0x10000, 0x8f576b33, 2 | BRF_PRG | BRF_ESS }, // 5 + { "808_e13.10s", 0x10000, 0x1fa708f4, 2 | BRF_PRG | BRF_ESS }, // 6 + { "808_e12.8s", 0x10000, 0xd62f1fde, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "808_e03.10a", 0x08000, 0x3d93a7cd, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "808_e14.d8", 0x04000, 0xb9d36525, 4 | BRF_GRA }, // 9 Characters + + { "808d17.p16", 0x80000, 0xd1299082, 5 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "808d15.p13", 0x80000, 0x2b22a6b6, 5 | BRF_GRA }, // 11 + + { "808_d01.5a", 0x20000, 0xfd4d37c0, 7 | BRF_GRA }, // 12 K007232 Samples +}; + +STD_ROM_PICK(miaj) +STD_ROM_FN(miaj) + +static INT32 miajCallback() +{ + if (load68k(Drv68KROM0, 0)) return 1; + if (load68k(Drv68KROM1, 4)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 11, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 12, 1)) return 1; + + return 0; +} + +static INT32 miajInit() +{ + twin16_custom_video = 2; + + return DrvInit(miajCallback); +} + +struct BurnDriver BurnDrvMiaj = { + "miaj", "mia", NULL, NULL, "1989", + "M.I.A. - Missing in Action (Japan)\0", NULL, "Konami", "GX808", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PLATFORM, 0, + NULL, miajRomInfo, miajRomName, NULL, NULL, DrvInputInfo, MiajDIPInfo, + miajInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; + + +// Cue Brick (Japan) + +static struct BurnRomInfo cuebrckjRomDesc[] = { + { "903_e05.6n", 0x10000, 0x8b556220, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "903_e04.4n", 0x10000, 0xbf9c7927, 1 | BRF_PRG | BRF_ESS }, // 1 + { "903_e09.6r", 0x10000, 0x2a77554d, 1 | BRF_PRG | BRF_ESS }, // 2 + { "903_e08.4r", 0x10000, 0xc0a430c1, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "903_d07.10n", 0x10000, 0xfc0edce7, 2 | BRF_PRG | BRF_ESS }, // 4 68K #1 Code + { "903_d06.8n", 0x10000, 0xb2cef6fe, 2 | BRF_PRG | BRF_ESS }, // 5 + { "903_e13.10s", 0x10000, 0x4fb5fb80, 2 | BRF_PRG | BRF_ESS }, // 6 + { "903_e12.8s", 0x10000, 0x883e3097, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "903_d03.10a", 0x08000, 0x455e855a, 3 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "903_e14.d8", 0x04000, 0xddbebbd5, 4 | BRF_GRA }, // 9 Characters + + { "903_e11.10r", 0x10000, 0x5c41faf8, 6 | BRF_GRA }, // 10 Sprites / Bg Tiles + { "903_e10.8r", 0x10000, 0x417576d4, 6 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(cuebrckj) +STD_ROM_FN(cuebrckj) + +static INT32 cuebrckjCallback() +{ + if (load68k(Drv68KROM0, 0)) return 1; + if (load68k(Drv68KROM1, 4)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 11, 2)) return 1; + + return 0; +} + +static INT32 cuebrckjInit() +{ + twin16_custom_video = 2; + + return DrvInit(cuebrckjCallback); +} + +struct BurnDriver BurnDrvCuebrckj = { + "cuebrickj", "cuebrick", NULL, NULL, "1989", + "Cue Brick (Japan)\0", NULL, "Konami", "GX903", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_PUZZLE, 0, + NULL, cuebrckjRomInfo, cuebrckjRomName, NULL, NULL, DrvInputInfo, CuebrckjDIPInfo, + cuebrckjInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_ultraman.cpp b/src/burn/drv/konami/d_ultraman.cpp index 3a06369ad..2c17bedbd 100644 --- a/src/burn/drv/konami/d_ultraman.cpp +++ b/src/burn/drv/konami/d_ultraman.cpp @@ -1,697 +1,696 @@ -// FB Alpha Ultraman driver module -// Based on MAME driver by Manuel Abadia - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm6295.h" -#include "konamiic.h" - -static UINT8 *AllMem; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvGfxROMExp2; -static UINT8 *DrvGfxROMExp3; -static UINT8 *DrvSndROM; -static UINT8 *AllRam; -static UINT8 *Drv68KRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *soundlatch; -static UINT8 *RamEnd; -static UINT8 *MemEnd; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static INT32 bank0; -static INT32 bank1; -static INT32 bank2; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; -static UINT8 DrvInputs[3]; - -static struct BurnInputInfo UltramanInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 1, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 3, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 4, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 7, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 0, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 1, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 3, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 4, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 7, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 4, "diag" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 5, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Ultraman) - -static struct BurnDIPInfo UltramanDIPList[]= -{ - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0x74, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x15, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x15, 0x01, 0xf0, 0x00, "No Coin B" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x16, 0x01, 0x04, 0x00, "No" }, - {0x16, 0x01, 0x04, 0x04, "Yes" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x08, 0x08, "Off" }, - {0x16, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x30, 0x10, "Easy" }, - {0x16, 0x01, 0x30, 0x30, "Normal" }, - {0x16, 0x01, 0x30, 0x20, "Hard" }, - {0x16, 0x01, 0x30, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Upright Controls" }, - {0x16, 0x01, 0x40, 0x40, "Single" }, - {0x16, 0x01, 0x40, 0x00, "Dual" }, - -// {0 , 0xfe, 0 , 2, "Cabinet" }, -// {0x16, 0x01, 0x80, 0x00, "Upright" }, -// {0x16, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(Ultraman) - -void __fastcall ultraman_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x1c0019: - { - if (((data & 0x02) >> 1) != bank0) { - bank0 = (data & 0x02) >> 1; - K051316RedrawTiles(0); - } - - if (((data & 0x08) >> 3) != bank1) { - bank1 = (data & 0x08) >> 3; - K051316RedrawTiles(1); - } - - if (((data & 0x20) >> 5) != bank2) { - bank2 = (data & 0x20) >> 5; - K051316RedrawTiles(2); - } - - K051316WrapEnable(0,data & 0x01); - K051316WrapEnable(1,data & 0x04); - K051316WrapEnable(2,data & 0x10); - } - return; - - case 0x1c0021: - ZetNmi(); - return; - - case 0x1c0029: - *soundlatch = data; - return; - - case 0x1c0031: // watchdog - return; - } - - if ((address & 0xfff001) == 0x204001) { - K051316Write(0, (address >> 1) & 0x7ff, data); - return; - } - - if ((address & 0xfff001) == 0x205001) { - K051316Write(1, (address >> 1) & 0x7ff, data); - return; - } - - if ((address & 0xfff001) == 0x206001) { - K051316Write(2, (address >> 1) & 0x7ff, data); - return; - } - - if ((address & 0xffffe1) == 0x207f81) { - K051316WriteCtrl(0, (address >> 1) & 0x0f, data); - return; - } - - if ((address & 0xffffe1) == 0x207fa1) { - K051316WriteCtrl(1, (address >> 1) & 0x0f, data); - return; - } - - if ((address & 0xffffe1) == 0x207fc1) { - K051316WriteCtrl(2, (address >> 1) & 0x0f, data); - return; - } - - if ((address & 0xfffff1) == 0x304001) { - K051937Write((address >> 1) & 0x007, data); - return; - } - - if ((address & 0xfff801) == 0x304801) { - K051960Write((address >> 1) & 0x3ff, data); - return; - } - -} - -UINT8 __fastcall ultraman_read_byte(UINT32 address) -{ - switch (address) - { - case 0x1c0001: - return DrvInputs[0]; - - case 0x1c0003: - return DrvInputs[1]; - - case 0x1c0005: - return DrvInputs[2]; - - case 0x1c0007: - return DrvDips[0]; - - case 0x1c0009: - return DrvDips[1]; - } - - if ((address & 0xfff000) == 0x204000) { - return K051316Read(0, (address >> 1) & 0x7ff); - } - - if ((address & 0xfff000) == 0x205000) { - return K051316Read(1, (address >> 1) & 0x7ff); - } - - if ((address & 0xfff000) == 0x206000) { - return K051316Read(2, (address >> 1) & 0x7ff); - } - - if ((address & 0xfffff0) == 0x304000) { - return K051937Read((address >> 1) & 0x007); - } - - if ((address & 0xfff800) == 0x304800) { - return K051960Read((address >> 1) & 0x3ff); - } - - return 0; -} - -void __fastcall ultraman_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xd000: - return; - - case 0xe000: - MSM6295Command(0, data); - return; - - case 0xf000: - BurnYM2151SelectRegister(data); - return; - - case 0xf001: - BurnYM2151WriteRegister(data); - return; - } -} - -UINT8 __fastcall ultraman_sound_read(UINT16 address) -{ - switch (address) - { - case 0xc000: - return *soundlatch; - - case 0xe000: - return MSM6295ReadStatus(0); - - case 0xf000: - case 0xf001: - return BurnYM2151ReadStatus(); - } - - return 0; -} - -static void K051960Callback(INT32 *, INT32 *color, INT32 *priority, INT32 *shadow) -{ - *priority = (*color & 0x80) >> 7; - *color = 0xc0 + ((*color & 0x7e) >> 1); - *shadow = 0; -} - -static void K051316Callback0(INT32 *code, INT32 *color, INT32 *) -{ - *code |= ((*color & 0x07) << 8) | (bank0 << 11); - *color = ((*color & 0xf8) >> 3); -} - -static void K051316Callback1(INT32 *code, INT32 *color, INT32 *) -{ - *code |= ((*color & 0x07) << 8) | (bank1 << 11); - *color = 0x40 + ((*color & 0xf8) >> 3); -} - -static void K051316Callback2(INT32 *code, INT32 *color, INT32 *) -{ - *code |= ((*color & 0x07) << 8) | (bank2 << 11); - *color = 0x80 + ((*color & 0xf8) >> 3); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - MSM6295Reset(0); - - KonamiICReset(); - - bank0 = bank1 = bank2 = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x100000; - DrvGfxROM1 = Next; Next += 0x080000; - DrvGfxROM2 = Next; Next += 0x080000; - DrvGfxROM3 = Next; Next += 0x080000; - DrvGfxROMExp0 = Next; Next += 0x200000; - DrvGfxROMExp1 = Next; Next += 0x100000; - DrvGfxROMExp2 = Next; Next += 0x100000; - DrvGfxROMExp3 = Next; Next += 0x100000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x2000 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x004000; - - DrvZ80RAM = Next; Next += 0x004000; - - soundlatch = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x000, 0x008, 0x010, 0x018 }; - INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 YOffs0[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - INT32 Plane1[4] = { 0x000, 0x001, 0x002, 0x003 }; - INT32 XOffs1[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, - 0x020, 0x024, 0x028, 0x02c, 0x030, 0x034, 0x038, 0x03c }; - INT32 YOffs1[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, - 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x100000); - - GfxDecode(0x02000, 4, 16, 16, Plane0, XOffs0, YOffs0, 0x400, DrvGfxROM0, DrvGfxROMExp0); - GfxDecode(0x01000, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, DrvGfxROM1, DrvGfxROMExp1); - GfxDecode(0x01000, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, DrvGfxROM2, DrvGfxROMExp2); - GfxDecode(0x01000, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, DrvGfxROM3, DrvGfxROMExp3); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x020000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x040000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x060000, 12, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x020000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x040000, 15, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x060000, 16, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 17, 1)) return 1; - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x080000, 0x08ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x180000, 0x183fff, SM_RAM); - SekSetWriteByteHandler(0, ultraman_write_byte); - SekSetReadByteHandler(0, ultraman_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0xbfff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80RAM); - ZetSetWriteHandler(ultraman_sound_write); - ZetSetReadHandler(ultraman_sound_read); - ZetMemEnd(); - ZetClose(); - - K051960Init(DrvGfxROM0, 0xfffff); - K051960SetCallback(K051960Callback); - K051960SetSpriteOffset(9, 0); - - K051316Init(0, DrvGfxROM1, DrvGfxROMExp1, 0x7ffff, K051316Callback0, 4, 0); - K051316SetOffset(0, -105, -16); - - K051316Init(1, DrvGfxROM2, DrvGfxROMExp2, 0x7ffff, K051316Callback1, 4, 0); - K051316SetOffset(1, -105, -16); - - K051316Init(2, DrvGfxROM3, DrvGfxROMExp3, 0x7ffff, K051316Callback2, 4, 0); - K051316SetOffset(2, -105, -16); - - BurnYM2151Init(4000000); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - MSM6295Init(0, 1056000 / 132, 1); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - SekExit(); - ZetExit(); - - BurnYM2151Exit(); - MSM6295Exit(0); - - BurnFree (AllMem); - - return 0; -} - -static inline void DrvRecalcPalette() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x4000 / 2; i++) { - r = (p[i] >> 10) & 0x1f; - g = (p[i] >> 5) & 0x1f; - b = (p[i] >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvRecalcPalette(); - } - - BurnTransferClear(); - - K051316_zoom_draw(2, 0); - K051316_zoom_draw(1, 0); - K051960SpritesRender(DrvGfxROMExp0, 0); - K051316_zoom_draw(0, 0); - K051960SpritesRender(DrvGfxROMExp0, 1); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - SekNewFrame(); - ZetNewFrame(); - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear Opposites - if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18; - if ((DrvInputs[1] & 0x06) == 0) DrvInputs[1] |= 0x06; - if ((DrvInputs[2] & 0x18) == 0) DrvInputs[2] |= 0x18; - if ((DrvInputs[2] & 0x06) == 0) DrvInputs[2] |= 0x06; - } - - INT32 nInterleave = 100; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 12000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCyclesSegment = nCyclesTotal[0] / nInterleave; - - nCyclesDone[0] += SekRun(nCyclesSegment); - - nCyclesSegment = nCyclesTotal[1] / nInterleave; - - nCyclesDone[1] += ZetRun(nCyclesSegment); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - if (nSegmentLength) { - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - - KonamiICScan(nAction); - - SCAN_VAR(bank0); - SCAN_VAR(bank1); - SCAN_VAR(bank2); - } - - return 0; -} - - -// Ultraman (Japan) - -static struct BurnRomInfo ultramanRomDesc[] = { - { "910-b01.c11", 0x20000, 0x3d9e4323, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "910-b02.d11", 0x20000, 0xd24c82e9, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "910-a05.d05", 0x08000, 0xebaef189, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "910-a19.l04", 0x80000, 0x2dc9ffdc, 3 | BRF_GRA }, // 3 K051960 Sprites - { "910-a20.l01", 0x80000, 0xa4298dce, 3 | BRF_GRA }, // 4 - - { "910-a07.j15", 0x20000, 0x8b43a64e, 4 | BRF_GRA }, // 5 K051316 #0 Tiles - { "910-a08.j16", 0x20000, 0xc3829826, 4 | BRF_GRA }, // 6 - { "910-a09.j18", 0x20000, 0xee10b519, 4 | BRF_GRA }, // 7 - { "910-a10.j19", 0x20000, 0xcffbb0c3, 4 | BRF_GRA }, // 8 - - { "910-a11.l15", 0x20000, 0x17a5581d, 5 | BRF_GRA }, // 9 K051316 #1 Tiles - { "910-a12.l16", 0x20000, 0x39763fb5, 5 | BRF_GRA }, // 10 - { "910-a13.l18", 0x20000, 0x66b25a4f, 5 | BRF_GRA }, // 11 - { "910-a14.l19", 0x20000, 0x09fbd412, 5 | BRF_GRA }, // 12 - - { "910-a15.m15", 0x20000, 0x6d5bfbb7, 6 | BRF_GRA }, // 13 K051316 #2 Tiles - { "910-a16.m16", 0x20000, 0x5f6f8c3d, 6 | BRF_GRA }, // 14 - { "910-a17.m18", 0x20000, 0x1f3ec4ff, 6 | BRF_GRA }, // 15 - { "910-a18.m19", 0x20000, 0xfdc42929, 6 | BRF_GRA }, // 16 - - { "910-a06.c06", 0x40000, 0x28fa99c9, 7 | BRF_SND }, // 17 MSM6295 Samples - - { "910-a21.f14", 0x00100, 0x64460fbc, 0 | BRF_OPT }, // 18 Priority Prom -}; - -STD_ROM_PICK(ultraman) -STD_ROM_FN(ultraman) - -struct BurnDriver BurnDrvUltraman = { - "ultraman", NULL, NULL, NULL, "1991", - "Ultraman (Japan)\0", NULL, "Banpresto / Bandai", "GX910", - L"\uFEFF\u30A6\u30EB\u30c8\u30E9\u30DE\u30f3 \u7A7A\u60F3\u7279\u64AE\u30B7\u30EA\u30FC\u30BA (Japan)\0Ultraman\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_VSFIGHT, 0, - NULL, ultramanRomInfo, ultramanRomName, NULL, NULL, UltramanInputInfo, UltramanDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, - 288, 224, 4, 3 -}; +// FB Alpha Ultraman driver module +// Based on MAME driver by Manuel Abadia + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm6295.h" +#include "konamiic.h" + +static UINT8 *AllMem; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvGfxROMExp2; +static UINT8 *DrvGfxROMExp3; +static UINT8 *DrvSndROM; +static UINT8 *AllRam; +static UINT8 *Drv68KRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *soundlatch; +static UINT8 *RamEnd; +static UINT8 *MemEnd; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static INT32 bank0; +static INT32 bank1; +static INT32 bank2; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; +static UINT8 DrvInputs[3]; + +static struct BurnInputInfo UltramanInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 1, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 3, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 4, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 7, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 0, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 1, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 3, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 4, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 7, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Diagnostics", BIT_DIGITAL, DrvJoy1 + 4, "diag" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 5, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Ultraman) + +static struct BurnDIPInfo UltramanDIPList[]= +{ + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0x74, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x15, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x15, 0x01, 0xf0, 0x00, "No Coin B" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x16, 0x01, 0x04, 0x00, "No" }, + {0x16, 0x01, 0x04, 0x04, "Yes" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x08, 0x08, "Off" }, + {0x16, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x30, 0x10, "Easy" }, + {0x16, 0x01, 0x30, 0x30, "Normal" }, + {0x16, 0x01, 0x30, 0x20, "Hard" }, + {0x16, 0x01, 0x30, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Upright Controls" }, + {0x16, 0x01, 0x40, 0x40, "Single" }, + {0x16, 0x01, 0x40, 0x00, "Dual" }, + +// {0 , 0xfe, 0 , 2, "Cabinet" }, +// {0x16, 0x01, 0x80, 0x00, "Upright" }, +// {0x16, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(Ultraman) + +void __fastcall ultraman_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x1c0019: + { + if (((data & 0x02) >> 1) != bank0) { + bank0 = (data & 0x02) >> 1; + K051316RedrawTiles(0); + } + + if (((data & 0x08) >> 3) != bank1) { + bank1 = (data & 0x08) >> 3; + K051316RedrawTiles(1); + } + + if (((data & 0x20) >> 5) != bank2) { + bank2 = (data & 0x20) >> 5; + K051316RedrawTiles(2); + } + + K051316WrapEnable(0,data & 0x01); + K051316WrapEnable(1,data & 0x04); + K051316WrapEnable(2,data & 0x10); + } + return; + + case 0x1c0021: + ZetNmi(); + return; + + case 0x1c0029: + *soundlatch = data; + return; + + case 0x1c0031: // watchdog + return; + } + + if ((address & 0xfff001) == 0x204001) { + K051316Write(0, (address >> 1) & 0x7ff, data); + return; + } + + if ((address & 0xfff001) == 0x205001) { + K051316Write(1, (address >> 1) & 0x7ff, data); + return; + } + + if ((address & 0xfff001) == 0x206001) { + K051316Write(2, (address >> 1) & 0x7ff, data); + return; + } + + if ((address & 0xffffe1) == 0x207f81) { + K051316WriteCtrl(0, (address >> 1) & 0x0f, data); + return; + } + + if ((address & 0xffffe1) == 0x207fa1) { + K051316WriteCtrl(1, (address >> 1) & 0x0f, data); + return; + } + + if ((address & 0xffffe1) == 0x207fc1) { + K051316WriteCtrl(2, (address >> 1) & 0x0f, data); + return; + } + + if ((address & 0xfffff1) == 0x304001) { + K051937Write((address >> 1) & 0x007, data); + return; + } + + if ((address & 0xfff801) == 0x304801) { + K051960Write((address >> 1) & 0x3ff, data); + return; + } + +} + +UINT8 __fastcall ultraman_read_byte(UINT32 address) +{ + switch (address) + { + case 0x1c0001: + return DrvInputs[0]; + + case 0x1c0003: + return DrvInputs[1]; + + case 0x1c0005: + return DrvInputs[2]; + + case 0x1c0007: + return DrvDips[0]; + + case 0x1c0009: + return DrvDips[1]; + } + + if ((address & 0xfff000) == 0x204000) { + return K051316Read(0, (address >> 1) & 0x7ff); + } + + if ((address & 0xfff000) == 0x205000) { + return K051316Read(1, (address >> 1) & 0x7ff); + } + + if ((address & 0xfff000) == 0x206000) { + return K051316Read(2, (address >> 1) & 0x7ff); + } + + if ((address & 0xfffff0) == 0x304000) { + return K051937Read((address >> 1) & 0x007); + } + + if ((address & 0xfff800) == 0x304800) { + return K051960Read((address >> 1) & 0x3ff); + } + + return 0; +} + +void __fastcall ultraman_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xd000: + return; + + case 0xe000: + MSM6295Command(0, data); + return; + + case 0xf000: + BurnYM2151SelectRegister(data); + return; + + case 0xf001: + BurnYM2151WriteRegister(data); + return; + } +} + +UINT8 __fastcall ultraman_sound_read(UINT16 address) +{ + switch (address) + { + case 0xc000: + return *soundlatch; + + case 0xe000: + return MSM6295ReadStatus(0); + + case 0xf000: + case 0xf001: + return BurnYM2151ReadStatus(); + } + + return 0; +} + +static void K051960Callback(INT32 *, INT32 *color, INT32 *priority, INT32 *shadow) +{ + *priority = (*color & 0x80) >> 7; + *color = 0xc0 + ((*color & 0x7e) >> 1); + *shadow = 0; +} + +static void K051316Callback0(INT32 *code, INT32 *color, INT32 *) +{ + *code |= ((*color & 0x07) << 8) | (bank0 << 11); + *color = ((*color & 0xf8) >> 3); +} + +static void K051316Callback1(INT32 *code, INT32 *color, INT32 *) +{ + *code |= ((*color & 0x07) << 8) | (bank1 << 11); + *color = 0x40 + ((*color & 0xf8) >> 3); +} + +static void K051316Callback2(INT32 *code, INT32 *color, INT32 *) +{ + *code |= ((*color & 0x07) << 8) | (bank2 << 11); + *color = 0x80 + ((*color & 0xf8) >> 3); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + MSM6295Reset(0); + + KonamiICReset(); + + bank0 = bank1 = bank2 = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x100000; + DrvGfxROM1 = Next; Next += 0x080000; + DrvGfxROM2 = Next; Next += 0x080000; + DrvGfxROM3 = Next; Next += 0x080000; + DrvGfxROMExp0 = Next; Next += 0x200000; + DrvGfxROMExp1 = Next; Next += 0x100000; + DrvGfxROMExp2 = Next; Next += 0x100000; + DrvGfxROMExp3 = Next; Next += 0x100000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x2000 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x004000; + + DrvZ80RAM = Next; Next += 0x004000; + + soundlatch = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x000, 0x008, 0x010, 0x018 }; + INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 YOffs0[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + INT32 Plane1[4] = { 0x000, 0x001, 0x002, 0x003 }; + INT32 XOffs1[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, + 0x020, 0x024, 0x028, 0x02c, 0x030, 0x034, 0x038, 0x03c }; + INT32 YOffs1[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x100000); + + GfxDecode(0x02000, 4, 16, 16, Plane0, XOffs0, YOffs0, 0x400, DrvGfxROM0, DrvGfxROMExp0); + GfxDecode(0x01000, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, DrvGfxROM1, DrvGfxROMExp1); + GfxDecode(0x01000, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, DrvGfxROM2, DrvGfxROMExp2); + GfxDecode(0x01000, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, DrvGfxROM3, DrvGfxROMExp3); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x020000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x040000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x060000, 12, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x020000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x040000, 15, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x060000, 16, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 17, 1)) return 1; + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x080000, 0x08ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x180000, 0x183fff, SM_RAM); + SekSetWriteByteHandler(0, ultraman_write_byte); + SekSetReadByteHandler(0, ultraman_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0xbfff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80RAM); + ZetSetWriteHandler(ultraman_sound_write); + ZetSetReadHandler(ultraman_sound_read); + ZetClose(); + + K051960Init(DrvGfxROM0, 0xfffff); + K051960SetCallback(K051960Callback); + K051960SetSpriteOffset(9, 0); + + K051316Init(0, DrvGfxROM1, DrvGfxROMExp1, 0x7ffff, K051316Callback0, 4, 0); + K051316SetOffset(0, -105, -16); + + K051316Init(1, DrvGfxROM2, DrvGfxROMExp2, 0x7ffff, K051316Callback1, 4, 0); + K051316SetOffset(1, -105, -16); + + K051316Init(2, DrvGfxROM3, DrvGfxROMExp3, 0x7ffff, K051316Callback2, 4, 0); + K051316SetOffset(2, -105, -16); + + BurnYM2151Init(4000000); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + MSM6295Init(0, 1056000 / 132, 1); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + SekExit(); + ZetExit(); + + BurnYM2151Exit(); + MSM6295Exit(0); + + BurnFree (AllMem); + + return 0; +} + +static inline void DrvRecalcPalette() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x4000 / 2; i++) { + r = (p[i] >> 10) & 0x1f; + g = (p[i] >> 5) & 0x1f; + b = (p[i] >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvRecalcPalette(); + } + + BurnTransferClear(); + + K051316_zoom_draw(2, 0); + K051316_zoom_draw(1, 0); + K051960SpritesRender(DrvGfxROMExp0, 0); + K051316_zoom_draw(0, 0); + K051960SpritesRender(DrvGfxROMExp0, 1); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + SekNewFrame(); + ZetNewFrame(); + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear Opposites + if ((DrvInputs[1] & 0x18) == 0) DrvInputs[1] |= 0x18; + if ((DrvInputs[1] & 0x06) == 0) DrvInputs[1] |= 0x06; + if ((DrvInputs[2] & 0x18) == 0) DrvInputs[2] |= 0x18; + if ((DrvInputs[2] & 0x06) == 0) DrvInputs[2] |= 0x06; + } + + INT32 nInterleave = 100; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 12000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCyclesSegment = nCyclesTotal[0] / nInterleave; + + nCyclesDone[0] += SekRun(nCyclesSegment); + + nCyclesSegment = nCyclesTotal[1] / nInterleave; + + nCyclesDone[1] += ZetRun(nCyclesSegment); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + if (nSegmentLength) { + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + + KonamiICScan(nAction); + + SCAN_VAR(bank0); + SCAN_VAR(bank1); + SCAN_VAR(bank2); + } + + return 0; +} + + +// Ultraman (Japan) + +static struct BurnRomInfo ultramanRomDesc[] = { + { "910-b01.c11", 0x20000, 0x3d9e4323, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "910-b02.d11", 0x20000, 0xd24c82e9, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "910-a05.d05", 0x08000, 0xebaef189, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "910-a19.l04", 0x80000, 0x2dc9ffdc, 3 | BRF_GRA }, // 3 K051960 Sprites + { "910-a20.l01", 0x80000, 0xa4298dce, 3 | BRF_GRA }, // 4 + + { "910-a07.j15", 0x20000, 0x8b43a64e, 4 | BRF_GRA }, // 5 K051316 #0 Tiles + { "910-a08.j16", 0x20000, 0xc3829826, 4 | BRF_GRA }, // 6 + { "910-a09.j18", 0x20000, 0xee10b519, 4 | BRF_GRA }, // 7 + { "910-a10.j19", 0x20000, 0xcffbb0c3, 4 | BRF_GRA }, // 8 + + { "910-a11.l15", 0x20000, 0x17a5581d, 5 | BRF_GRA }, // 9 K051316 #1 Tiles + { "910-a12.l16", 0x20000, 0x39763fb5, 5 | BRF_GRA }, // 10 + { "910-a13.l18", 0x20000, 0x66b25a4f, 5 | BRF_GRA }, // 11 + { "910-a14.l19", 0x20000, 0x09fbd412, 5 | BRF_GRA }, // 12 + + { "910-a15.m15", 0x20000, 0x6d5bfbb7, 6 | BRF_GRA }, // 13 K051316 #2 Tiles + { "910-a16.m16", 0x20000, 0x5f6f8c3d, 6 | BRF_GRA }, // 14 + { "910-a17.m18", 0x20000, 0x1f3ec4ff, 6 | BRF_GRA }, // 15 + { "910-a18.m19", 0x20000, 0xfdc42929, 6 | BRF_GRA }, // 16 + + { "910-a06.c06", 0x40000, 0x28fa99c9, 7 | BRF_SND }, // 17 MSM6295 Samples + + { "910-a21.f14", 0x00100, 0x64460fbc, 0 | BRF_OPT }, // 18 Priority Prom +}; + +STD_ROM_PICK(ultraman) +STD_ROM_FN(ultraman) + +struct BurnDriver BurnDrvUltraman = { + "ultraman", NULL, NULL, NULL, "1991", + "Ultraman (Japan)\0", NULL, "Banpresto / Bandai", "GX910", + L"\uFEFF\u30A6\u30EB\u30c8\u30E9\u30DE\u30f3 \u7A7A\u60F3\u7279\u64AE\u30B7\u30EA\u30FC\u30BA (Japan)\0Ultraman\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PREFIX_KONAMI, GBF_VSFIGHT, 0, + NULL, ultramanRomInfo, ultramanRomName, NULL, NULL, UltramanInputInfo, UltramanDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, + 288, 224, 4, 3 +}; diff --git a/src/burn/drv/konami/d_vendetta.cpp b/src/burn/drv/konami/d_vendetta.cpp index f334752f7..8fd11f557 100644 --- a/src/burn/drv/konami/d_vendetta.cpp +++ b/src/burn/drv/konami/d_vendetta.cpp @@ -1,1238 +1,1237 @@ -// FB Alpha Vendetta / Crime Fighters 2 / Escape Kids driver module -// Based on MAME driver by Ernesto Corvi - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "konami_intf.h" -#include "konamiic.h" -#include "k053260.h" -#include "eeprom.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvKonROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM; -static UINT8 *DrvKonRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *nDrvBank; - -static INT32 videobank; -static INT32 init_eeprom_count; -static INT32 irq_enabled; -static INT32 vblank = 0; -static INT32 bankoffset; - -static INT32 bg_colorbase; -static INT32 sprite_colorbase; -static INT32 layer_colorbase[3]; -static INT32 layerpri[3]; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvJoy6; -static UINT8 DrvReset; -static UINT8 DrvInputs[5]; - -static INT32 nCyclesDone[2]; - -static struct BurnInputInfo Vendet4pInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p2 coin" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"P3 Coin", BIT_DIGITAL, DrvJoy3 + 7, "p3 coin" }, - {"P3 Up", BIT_DIGITAL, DrvJoy3 + 2, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy3 + 3, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy3 + 1, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy3 + 0, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2" }, - - {"P4 Coin", BIT_DIGITAL, DrvJoy4 + 7, "p4 coin" }, - {"P4 Up", BIT_DIGITAL, DrvJoy4 + 2, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvJoy4 + 3, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvJoy4 + 1, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvJoy4 + 0, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p4 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Diagnostics", BIT_DIGITAL, &DrvJoy6, "diag" }, -}; - -STDINPUTINFO(Vendet4p) - -static struct BurnInputInfo VendettaInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy5 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy5 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Diagnostics", BIT_DIGITAL, &DrvJoy6, "diag" }, - {"Service", BIT_DIGITAL, DrvJoy5 + 4, "service" }, -}; - -STDINPUTINFO(Vendetta) - -static struct BurnInputInfo EsckidsInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy5 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy5 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"P3 Coin", BIT_DIGITAL, DrvJoy3 + 7, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, DrvJoy5 + 2, "p3 start" }, - {"P3 Up", BIT_DIGITAL, DrvJoy3 + 2, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy3 + 3, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy3 + 1, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy3 + 0, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2" }, - - {"P4 Coin", BIT_DIGITAL, DrvJoy4 + 7, "p4 coin" }, - {"P4 Start", BIT_DIGITAL, DrvJoy5 + 3, "p4 start" }, - {"P4 Up", BIT_DIGITAL, DrvJoy4 + 2, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvJoy4 + 3, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvJoy4 + 1, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvJoy4 + 0, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p4 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Diagnostics", BIT_DIGITAL, &DrvJoy6, "diag" }, - {"Service 1", BIT_DIGITAL, DrvJoy5 + 4, "service" }, - {"Service 2", BIT_DIGITAL, DrvJoy5 + 5, "service2" }, - {"Service 3", BIT_DIGITAL, DrvJoy5 + 6, "service3" }, - {"Service 4", BIT_DIGITAL, DrvJoy5 + 7, "service4" }, -}; - -STDINPUTINFO(Esckids) - -static struct BurnInputInfo EsckidsjInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy5 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy5 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Diagnostics", BIT_DIGITAL, &DrvJoy6, "diag" }, - {"Service 1", BIT_DIGITAL, DrvJoy5 + 4, "service" }, - {"Service 2", BIT_DIGITAL, DrvJoy5 + 5, "service2" }, -}; - -STDINPUTINFO(Esckidsj) - -void vendetta_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x5fe0: - K052109RMRDLine = data & 0x08; - K053246_set_OBJCHA_line(data & 0x20); - return; - - case 0x5fe2: - { - if (data == 0xff) return; - - EEPROMWrite(data & 0x10, data & 0x08, data & 0x20); - - irq_enabled = (data >> 6) & 1; - - videobank = data & 1; - } - return; - - case 0x5fe4: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - - case 0x5fe6: - case 0x5fe7: - K053260Write(0, address & 1, data); - return; - } - - if ((address & 0xffe0) == 0x5f80) { - K054000Write(address, data); - return; - } - - if ((address & 0xfff0) == 0x5fa0) { - K053251Write(address & 0x0f, data); - return; - } - - if ((address & 0xfff8) == 0x5fb0) { - K053246Write(address & 7, data); - return; - } - - if (videobank) { - if ((address & 0xf000) == 0x4000) { - address ^= 1; - K053247Write(address & 0x0fff, data); - return; - } - - if ((address & 0xf000) == 0x6000) { - DrvPalRAM[address & 0xfff] = data; - return; - } - } - - if ((address & 0xc000) == 0x4000) { - K052109Write(address & 0x3fff, data); - return; - } -} - -UINT8 vendetta_main_read(UINT16 address) -{ - switch (address) - { - case 0x5fc0: - return DrvInputs[0]; - - case 0x5fc1: - return DrvInputs[1]; - - case 0x5fc2: - return DrvInputs[2]; - - case 0x5fc3: - return DrvInputs[3]; - - case 0x5fd0: - { - INT32 res = (EEPROMRead() & 1) | vblank | ((DrvJoy6 << 2) ^ 0xf6); - - if (init_eeprom_count > 0) - { - init_eeprom_count--; - res &= 0xfb; - } - return res; - } - - case 0x5fd1: - return DrvInputs[4]; - - case 0x5fe4: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return 0; - - case 0x5fe6: - case 0x5fe7: - return K053260Read(0, (address & 1)+2); - - case 0x5fe8: - case 0x5fe9: - return K053246Read(address & 1); - - case 0x5fea: - return 0; // watchdog - } - - if ((address & 0xffe0) == 0x5f80) { - return K054000Read(address); - } - - if (videobank) { - if ((address & 0xf000) == 0x4000) { - address ^= 1; - return K053247Read(address & 0x0fff); - } - - if ((address & 0xf000) == 0x6000) { - return DrvPalRAM[address & 0x0fff]; - } - } - - if ((address & 0xc000) == 0x4000) { - return K052109Read(address & 0x3fff); - } - - return 0; -} - -void esckids_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x3fd0: - K052109RMRDLine = data & 0x08; - K053246_set_OBJCHA_line(data & 0x20); - return; - - case 0x3fd2: - { - if (data == 0xff) return; - - EEPROMWrite(data & 0x10, data & 0x08, data & 0x20); - - irq_enabled = (data >> 6) & 1; - - videobank = data & 1; - } - return; - - case 0x3fd4: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - - case 0x3fd6: - case 0x3fd7: - K053260Write(0, address & 1, data); - return; - } - - if ((address & 0xfff0) == 0x3fb0) { - K053251Write(address & 0x0f, data); - return; - } - - if ((address & 0xfff8) == 0x3fa0) { - K053246Write(address & 7, data); - return; - } - - if (videobank) { - if ((address & 0xf000) == 0x2000) { - address ^= 1; - K053247Write(address & 0x0fff, data); - return; - } - - if ((address & 0xf000) == 0x4000) { - DrvPalRAM[address & 0xfff] = data; - return; - } - } - - if (address >= 0x2000 && address <= 0x5fff) { - K052109Write(address - 0x2000, data); - return; - } -} - -UINT8 esckids_main_read(UINT16 address) -{ - switch (address) - { - case 0x3f80: - return DrvInputs[0]; - - case 0x3f81: - return DrvInputs[1]; - - case 0x3f82: - return DrvInputs[2]; - - case 0x3f83: - return DrvInputs[3]; - - case 0x3f92: - { - INT32 res = (EEPROMRead() & 1) | vblank | ((DrvJoy6 << 2) ^ 0xf6); - - if (init_eeprom_count > 0) - { - init_eeprom_count--; - res &= 0xfb; - } - return res; - } - - case 0x3f93: - return DrvInputs[4]; - - case 0x3fd4: - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return 0; - - case 0x3fd6: - case 0x3fd7: - return K053260Read(0, (address & 1)+2); - - case 0x3fd8: - case 0x3fd9: - return K053246Read(address & 1); - - } - - if (videobank) { - if ((address & 0xf000) == 0x2000) { - address ^= 1; - return K053247Read(address & 0x0fff); - } - - if ((address & 0xf000) == 0x4000) { - return DrvPalRAM[address & 0x0fff]; - } - } - - if (address >= 0x2000 && address <= 0x5fff) { - return K052109Read(address - 0x2000); - } - - return 0; -} - -void __fastcall vendetta_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf800: - BurnYM2151SelectRegister(data); - return; - - case 0xf801: - BurnYM2151WriteRegister(data); - return; - - case 0xfa00: - nCyclesDone[1] += ZetRun(100); - ZetNmi(); - return; - } - - if (address >= 0xfc00 && address < 0xfc30) { - K053260Write(0, address & 0xff, data); - return; - } -} - -UINT8 __fastcall vendetta_sound_read(UINT16 address) -{ - switch (address) - { - case 0xf800: - return 0xff; - case 0xf801: - return BurnYM2151ReadStatus(); - } - - if (address >= 0xfc00 && address < 0xfc30) { - if ((address & 0x3f) == 0x01) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - - return K053260Read(0, address & 0xff); - } - - return 0; -} - -static void vendetta_set_lines(INT32 lines) -{ - nDrvBank[0] = lines; - - if (lines < 0x1c) { - konamiMapMemory(DrvKonROM + 0x10000 + (lines * 0x2000), 0x0000 | bankoffset, 0x1fff | bankoffset, KON_ROM); - } -} - -static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - *code |= ((*color & 0x03) << 8) | ((*color & 0x30) << 6) | ((*color & 0x0c) << 10) | (bank << 14); - *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6); -} - -static void EsckidsK052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) -{ - *code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13); - *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); -} - -static void K053247Callback(INT32 *code, INT32 *color, INT32 *priority) -{ - INT32 pri = (*color & 0x03e0) >> 4; - if (pri <= layerpri[2]) *priority = 0; - else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 1; - else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 2; - else *priority = 3; - - *code &= 0x7fff; - - *color = sprite_colorbase + (*color & 0x001f); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - konamiOpen(0); - konamiReset(); - konamiClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - KonamiICReset(); - - K053260Reset(0); - - EEPROMReset(); - - videobank = 0; - - if (EEPROMAvailable()) { - init_eeprom_count = 0; - } else { - init_eeprom_count = 1000; - } - - irq_enabled = 0; - videobank = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvKonROM = Next; Next += 0x050000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x100000; - DrvGfxROMExp0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x400000; - DrvGfxROMExp1 = Next; Next += 0x800000; - - DrvSndROM = Next; Next += 0x100000; - - Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x000800; - - DrvKonRAM = Next; Next += 0x002000; - DrvPalRAM = Next; Next += 0x001000; - - nDrvBank = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 XOffs[8] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; - INT32 YOffs[8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x100000); - konami_rom_deinterleave_4(DrvGfxROM1, 0x400000); - - GfxDecode(0x8000, 4, 8, 8, Plane, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - - K053247GfxDecode(DrvGfxROM1, DrvGfxROMExp1, 0x400000); - - return 0; -} - -static const eeprom_interface vendetta_eeprom_intf = -{ - 7, // address bits - 8, // data bits - "011000", // read command - "011100", // write command - 0, // erase command - "0100000000000", // lock command - "0100110000000", // unlock command - 0, - 0 -}; - -static INT32 DrvInit(INT32 nGame) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x300000, 7, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 8, 1)) return 1; - - DrvGfxDecode(); - } - - if (nGame) // escape kids - { - memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x28000, 0x8000); - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvKonRAM, 0x0000, 0x1fff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); - konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(esckids_main_write); - konamiSetReadHandler(esckids_main_read); - konamiSetlinesCallback(vendetta_set_lines); - konamiClose(); - - K052109Init(DrvGfxROM0, 0x0fffff); - K052109SetCallback(EsckidsK052109Callback); - K052109AdjustScroll(8, -8); - - K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 1); - K053247SetSpriteOffset(-11, 14); - - bankoffset = 0x6000; - } else { - memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x48000, 0x8000); - - konamiInit(1); - konamiOpen(0); - konamiMapMemory(DrvKonROM + 0x10000, 0x0000, 0x1fff, KON_ROM); - konamiMapMemory(DrvKonRAM, 0x2000, 0x3fff, KON_RAM); - konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); - konamiSetWriteHandler(vendetta_main_write); - konamiSetReadHandler(vendetta_main_read); - konamiSetlinesCallback(vendetta_set_lines); - konamiClose(); - - K052109Init(DrvGfxROM0, 0x0fffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(0, 0); - - K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 1); - K053247SetSpriteOffset(-53, 22); - - bankoffset = 0; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(vendetta_sound_write); - ZetSetReadHandler(vendetta_sound_read); - ZetMemEnd(); - ZetClose(); - - EEPROMInit(&vendetta_eeprom_intf); - - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - K053260Init(0, 3579545, DrvSndROM, 0x100000 >> nGame); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); - K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - konamiExit(); - ZetExit(); - - EEPROMExit(); - - BurnYM2151Exit(); - K053260Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void DrvRecalcPal() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x1000 / 2; i++) { - UINT16 d = BURN_ENDIAN_SWAP_INT16((p[i] << 8) | (p[i] >> 8)); - - b = (d >> 10) & 0x1f; - g = (d >> 5) & 0x1f; - r = (d >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - Palette[i] = (r << 16) | (g << 8) | b; - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static void sortlayers(INT32 *layer,INT32 *pri) -{ -#define SWAP(a,b) \ - if (pri[a] < pri[b]) \ - { \ - INT32 t; \ - t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ - t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ - } - - SWAP(0,1) - SWAP(0,2) - SWAP(1,2) -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvRecalcPal(); - } - - K052109UpdateScroll(); - - INT32 layer[3]; - - bg_colorbase = K053251GetPaletteIndex(0); - sprite_colorbase = K053251GetPaletteIndex(1); - layer_colorbase[0] = K053251GetPaletteIndex(2); - layer_colorbase[1] = K053251GetPaletteIndex(3); - layer_colorbase[2] = K053251GetPaletteIndex(4); - - layerpri[0] = K053251GetPriority(2); - layerpri[1] = K053251GetPriority(3); - layerpri[2] = K053251GetPriority(4); - layer[0] = 0; - layer[1] = 1; - layer[2] = 2; - - sortlayers(layer,layerpri); - - BurnTransferClear(); - - // this order makes sense... - if (nSpriteEnable & 8) K053247SpritesRender(DrvGfxROMExp1, 0); - - if (nBurnLayer & 1) K052109RenderLayer(layer[0], 1, DrvGfxROMExp0); - - if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0); - - if (nSpriteEnable & 4) K053247SpritesRender(DrvGfxROMExp1, 1); - if (nSpriteEnable & 2) K053247SpritesRender(DrvGfxROMExp1, 2); - - if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0); - - if (nSpriteEnable & 1) K053247SpritesRender(DrvGfxROMExp1, 3); - - KonamiBlendCopy(Palette, DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - konamiNewFrame(); - - { - memset (DrvInputs, 0xff, 5); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - } - - // Clear Opposites - if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; - if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; - if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; - if ((DrvInputs[3] & 0x0c) == 0) DrvInputs[3] |= 0x0c; - if ((DrvInputs[3] & 0x03) == 0) DrvInputs[3] |= 0x03; - } - - INT32 nInterleave = 100; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 6000000 / 60, 3579545 / 60 }; - - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetOpen(0); - konamiOpen(0); - - vblank = 8; - - INT32 trigger_vblank = (nInterleave / 256) * 240; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext, nCyclesSegment; - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[0]; - nCyclesSegment = konamiRun(nCyclesSegment); - nCyclesDone[0] += nCyclesSegment; - - nNext = (i + 1) * nCyclesTotal[1] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[1]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[1] += nCyclesSegment; - - if (i == trigger_vblank) vblank = 0; // or 8? - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K053260Update(0, pSoundBuf, nSegmentLength); - } - } - - konamiClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - konamiCpuScan(nAction, pnMin); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - K053260Scan(nAction); - - KonamiICScan(nAction); - - EEPROMScan(nAction, pnMin); - - SCAN_VAR(irq_enabled); - SCAN_VAR(videobank); - SCAN_VAR(nCyclesDone[1]); - } - - if (nAction & ACB_WRITE) { - konamiOpen(0); - vendetta_set_lines(nDrvBank[0]); - konamiClose(); - } - - return 0; -} - - -// Vendetta (World 4 Players ver. T) - -static struct BurnRomInfo vendettaRomDesc[] = { - { "081t01", 0x040000, 0xe76267f5, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles - { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 - - { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles - { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 - { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 - { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 - - { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples - - { "vendetta.nv", 0x000080, 0xfbac4e30, BRF_OPT }, -}; - -STD_ROM_PICK(vendetta) -STD_ROM_FN(vendetta) - -static INT32 VendettaInit() -{ - return DrvInit(0); -} - -struct BurnDriver BurnDrvVendetta = { - "vendetta", NULL, NULL, NULL, "1991", - "Vendetta (World 4 Players ver. T)\0", NULL, "Konami", "GX081", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, vendettaRomInfo, vendettaRomName, NULL, NULL, Vendet4pInputInfo, NULL, - VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 304, 224, 4, 3 -}; - - -// Vendetta (World 4 Players ver. R) - -static struct BurnRomInfo vendettarRomDesc[] = { - { "081r01", 0x040000, 0x84796281, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles - { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 - - { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles - { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 - { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 - { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 - - { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples - - { "vendettar.nv", 0x000080, 0xec3f0449, BRF_OPT }, -}; - -STD_ROM_PICK(vendettar) -STD_ROM_FN(vendettar) - -struct BurnDriver BurnDrvVendettar = { - "vendettar", "vendetta", NULL, NULL, "1991", - "Vendetta (World 4 Players ver. R)\0", NULL, "Konami", "GX081", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, vendettarRomInfo, vendettarRomName, NULL, NULL, Vendet4pInputInfo, NULL, - VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 304, 224, 4, 3 -}; - - -// Vendetta (World 2 Players ver. W) - -static struct BurnRomInfo vendetta2pRomDesc[] = { - { "081w01", 0x040000, 0xcee57132, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles - { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 - - { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles - { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 - { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 - { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 - - { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples - - { "vendetta.nv", 0x000080, 0xfbac4e30, BRF_OPT }, -}; - -STD_ROM_PICK(vendetta2p) -STD_ROM_FN(vendetta2p) - -struct BurnDriver BurnDrvVendetta2p = { - "vendetta2p", "vendetta", NULL, NULL, "1991", - "Vendetta (World 2 Players ver. W)\0", NULL, "Konami", "GX081", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, vendetta2pRomInfo, vendetta2pRomName, NULL, NULL, VendettaInputInfo, NULL, - VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 304, 224, 4, 3 -}; - - -// Vendetta (Asia 2 Players ver. U) - -static struct BurnRomInfo vendetta2puRomDesc[] = { - { "081u01", 0x040000, 0xb4d9ade5, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles - { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 - - { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles - { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 - { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 - { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 - - { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples - - { "vendetta.nv", 0x000080, 0xfbac4e30, BRF_OPT }, -}; - -STD_ROM_PICK(vendetta2pu) -STD_ROM_FN(vendetta2pu) - -struct BurnDriver BurnDrvVendetta2pu = { - "vendetta2pu", "vendetta", NULL, NULL, "1991", - "Vendetta (Asia 2 Players ver. U)\0", NULL, "Konami", "GX081", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, vendetta2puRomInfo, vendetta2puRomName, NULL, NULL, VendettaInputInfo, NULL, - VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 304, 224, 4, 3 -}; - - -// Vendetta (Asia 2 Players ver. D) - -static struct BurnRomInfo vendetta2pdRomDesc[] = { - { "081d01", 0x040000, 0x335da495, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles - { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 - - { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles - { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 - { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 - { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 - - { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples - - { "vendetta.nv", 0x000080, 0xfbac4e30, BRF_OPT }, -}; - -STD_ROM_PICK(vendetta2pd) -STD_ROM_FN(vendetta2pd) - -struct BurnDriver BurnDrvVendetta2pd = { - "vendetta2pd", "vendetta", NULL, NULL, "1991", - "Vendetta (Asia 2 Players ver. D)\0", NULL, "Konami", "GX081", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, vendetta2pdRomInfo, vendetta2pdRomName, NULL, NULL, VendettaInputInfo, NULL, - VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 304, 224, 4, 3 -}; - - -// Crime Fighters 2 (Japan 2 Players ver. P) - -static struct BurnRomInfo vendettajRomDesc[] = { - { "081p01", 0x040000, 0x5fe30242, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles - { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 - - { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles - { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 - { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 - { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 - - { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples - - { "vendettaj.nv", 0x000080, 0x3550a54e, BRF_OPT }, -}; - -STD_ROM_PICK(vendettaj) -STD_ROM_FN(vendettaj) - -struct BurnDriver BurnDrvVendettaj = { - "vendettaj", "vendetta", NULL, NULL, "1991", - "Crime Fighters 2 (Japan 2 Players ver. P)\0", NULL, "Konami", "GX081", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, vendettajRomInfo, vendettajRomName, NULL, NULL, VendettaInputInfo, NULL, - VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 304, 224, 4, 3 -}; - - -// Escape Kids (Asia, 4 Players) - -static struct BurnRomInfo esckidsRomDesc[] = { - { "17c.bin", 0x020000, 0x9dfba99c, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "975f02", 0x010000, 0x994fb229, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "975c09", 0x080000, 0xbc52210e, 3 | BRF_GRA }, // 2 K052109 Tiles - { "975c08", 0x080000, 0xfcff9256, 3 | BRF_GRA }, // 3 - - { "975c04", 0x100000, 0x15688a6f, 4 | BRF_GRA }, // 4 K053247 Tiles - { "975c05", 0x100000, 0x1ff33bb7, 4 | BRF_GRA }, // 5 - { "975c06", 0x100000, 0x36d410f9, 4 | BRF_GRA }, // 6 - { "975c07", 0x100000, 0x97ec541e, 4 | BRF_GRA }, // 7 - - { "975c03", 0x080000, 0xdc4a1707, 5 | BRF_SND }, // 8 K053260 Samples - - { "esckids.nv", 0x000080, 0xa8522e1f, BRF_OPT }, -}; - -STD_ROM_PICK(esckids) -STD_ROM_FN(esckids) - -static INT32 EsckidsInit() -{ - return DrvInit(1); -} - -struct BurnDriver BurnDrvEsckids = { - "esckids", NULL, NULL, NULL, "1991", - "Escape Kids (Asia, 4 Players)\0", NULL, "Konami", "GX975", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, - NULL, esckidsRomInfo, esckidsRomName, NULL, NULL, EsckidsInputInfo, NULL, - EsckidsInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x800, - 288, 240, 4, 3 -}; - - -// Escape Kids (Japan, 2 Players) - -static struct BurnRomInfo esckidsjRomDesc[] = { - { "975r01", 0x020000, 0x7b5c5572, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code - - { "975f02", 0x010000, 0x994fb229, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "975c09", 0x080000, 0xbc52210e, 3 | BRF_GRA }, // 2 K052109 Tiles - { "975c08", 0x080000, 0xfcff9256, 3 | BRF_GRA }, // 3 - - { "975c04", 0x100000, 0x15688a6f, 4 | BRF_GRA }, // 4 K053247 Tiles - { "975c05", 0x100000, 0x1ff33bb7, 4 | BRF_GRA }, // 5 - { "975c06", 0x100000, 0x36d410f9, 4 | BRF_GRA }, // 6 - { "975c07", 0x100000, 0x97ec541e, 4 | BRF_GRA }, // 7 - - { "975c03", 0x080000, 0xdc4a1707, 5 | BRF_SND }, // 8 K053260 Samples - - { "esckidsj.nv", 0x000080, 0x985e2a2d, BRF_OPT }, -}; - -STD_ROM_PICK(esckidsj) -STD_ROM_FN(esckidsj) - -struct BurnDriver BurnDrvEsckidsj = { - "esckidsj", "esckids", NULL, NULL, "1991", - "Escape Kids (Japan, 2 Players)\0", NULL, "Konami", "GX975", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, - NULL, esckidsjRomInfo, esckidsjRomName, NULL, NULL, EsckidsjInputInfo, NULL, - EsckidsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 240, 4, 3 -}; +// FB Alpha Vendetta / Crime Fighters 2 / Escape Kids driver module +// Based on MAME driver by Ernesto Corvi + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "konami_intf.h" +#include "konamiic.h" +#include "k053260.h" +#include "eeprom.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvKonROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM; +static UINT8 *DrvKonRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *nDrvBank; + +static INT32 videobank; +static INT32 init_eeprom_count; +static INT32 irq_enabled; +static INT32 vblank = 0; +static INT32 bankoffset; + +static INT32 bg_colorbase; +static INT32 sprite_colorbase; +static INT32 layer_colorbase[3]; +static INT32 layerpri[3]; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvJoy6; +static UINT8 DrvReset; +static UINT8 DrvInputs[5]; + +static INT32 nCyclesDone[2]; + +static struct BurnInputInfo Vendet4pInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p2 coin" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"P3 Coin", BIT_DIGITAL, DrvJoy3 + 7, "p3 coin" }, + {"P3 Up", BIT_DIGITAL, DrvJoy3 + 2, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy3 + 3, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy3 + 1, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy3 + 0, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2" }, + + {"P4 Coin", BIT_DIGITAL, DrvJoy4 + 7, "p4 coin" }, + {"P4 Up", BIT_DIGITAL, DrvJoy4 + 2, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvJoy4 + 3, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvJoy4 + 1, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvJoy4 + 0, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p4 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Diagnostics", BIT_DIGITAL, &DrvJoy6, "diag" }, +}; + +STDINPUTINFO(Vendet4p) + +static struct BurnInputInfo VendettaInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy5 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy5 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Diagnostics", BIT_DIGITAL, &DrvJoy6, "diag" }, + {"Service", BIT_DIGITAL, DrvJoy5 + 4, "service" }, +}; + +STDINPUTINFO(Vendetta) + +static struct BurnInputInfo EsckidsInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy5 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy5 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"P3 Coin", BIT_DIGITAL, DrvJoy3 + 7, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, DrvJoy5 + 2, "p3 start" }, + {"P3 Up", BIT_DIGITAL, DrvJoy3 + 2, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy3 + 3, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy3 + 1, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy3 + 0, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2" }, + + {"P4 Coin", BIT_DIGITAL, DrvJoy4 + 7, "p4 coin" }, + {"P4 Start", BIT_DIGITAL, DrvJoy5 + 3, "p4 start" }, + {"P4 Up", BIT_DIGITAL, DrvJoy4 + 2, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvJoy4 + 3, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvJoy4 + 1, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvJoy4 + 0, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p4 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Diagnostics", BIT_DIGITAL, &DrvJoy6, "diag" }, + {"Service 1", BIT_DIGITAL, DrvJoy5 + 4, "service" }, + {"Service 2", BIT_DIGITAL, DrvJoy5 + 5, "service2" }, + {"Service 3", BIT_DIGITAL, DrvJoy5 + 6, "service3" }, + {"Service 4", BIT_DIGITAL, DrvJoy5 + 7, "service4" }, +}; + +STDINPUTINFO(Esckids) + +static struct BurnInputInfo EsckidsjInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy5 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy5 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Diagnostics", BIT_DIGITAL, &DrvJoy6, "diag" }, + {"Service 1", BIT_DIGITAL, DrvJoy5 + 4, "service" }, + {"Service 2", BIT_DIGITAL, DrvJoy5 + 5, "service2" }, +}; + +STDINPUTINFO(Esckidsj) + +void vendetta_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x5fe0: + K052109RMRDLine = data & 0x08; + K053246_set_OBJCHA_line(data & 0x20); + return; + + case 0x5fe2: + { + if (data == 0xff) return; + + EEPROMWrite(data & 0x10, data & 0x08, data & 0x20); + + irq_enabled = (data >> 6) & 1; + + videobank = data & 1; + } + return; + + case 0x5fe4: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + + case 0x5fe6: + case 0x5fe7: + K053260Write(0, address & 1, data); + return; + } + + if ((address & 0xffe0) == 0x5f80) { + K054000Write(address, data); + return; + } + + if ((address & 0xfff0) == 0x5fa0) { + K053251Write(address & 0x0f, data); + return; + } + + if ((address & 0xfff8) == 0x5fb0) { + K053246Write(address & 7, data); + return; + } + + if (videobank) { + if ((address & 0xf000) == 0x4000) { + address ^= 1; + K053247Write(address & 0x0fff, data); + return; + } + + if ((address & 0xf000) == 0x6000) { + DrvPalRAM[address & 0xfff] = data; + return; + } + } + + if ((address & 0xc000) == 0x4000) { + K052109Write(address & 0x3fff, data); + return; + } +} + +UINT8 vendetta_main_read(UINT16 address) +{ + switch (address) + { + case 0x5fc0: + return DrvInputs[0]; + + case 0x5fc1: + return DrvInputs[1]; + + case 0x5fc2: + return DrvInputs[2]; + + case 0x5fc3: + return DrvInputs[3]; + + case 0x5fd0: + { + INT32 res = (EEPROMRead() & 1) | vblank | ((DrvJoy6 << 2) ^ 0xf6); + + if (init_eeprom_count > 0) + { + init_eeprom_count--; + res &= 0xfb; + } + return res; + } + + case 0x5fd1: + return DrvInputs[4]; + + case 0x5fe4: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return 0; + + case 0x5fe6: + case 0x5fe7: + return K053260Read(0, (address & 1)+2); + + case 0x5fe8: + case 0x5fe9: + return K053246Read(address & 1); + + case 0x5fea: + return 0; // watchdog + } + + if ((address & 0xffe0) == 0x5f80) { + return K054000Read(address); + } + + if (videobank) { + if ((address & 0xf000) == 0x4000) { + address ^= 1; + return K053247Read(address & 0x0fff); + } + + if ((address & 0xf000) == 0x6000) { + return DrvPalRAM[address & 0x0fff]; + } + } + + if ((address & 0xc000) == 0x4000) { + return K052109Read(address & 0x3fff); + } + + return 0; +} + +void esckids_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x3fd0: + K052109RMRDLine = data & 0x08; + K053246_set_OBJCHA_line(data & 0x20); + return; + + case 0x3fd2: + { + if (data == 0xff) return; + + EEPROMWrite(data & 0x10, data & 0x08, data & 0x20); + + irq_enabled = (data >> 6) & 1; + + videobank = data & 1; + } + return; + + case 0x3fd4: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + + case 0x3fd6: + case 0x3fd7: + K053260Write(0, address & 1, data); + return; + } + + if ((address & 0xfff0) == 0x3fb0) { + K053251Write(address & 0x0f, data); + return; + } + + if ((address & 0xfff8) == 0x3fa0) { + K053246Write(address & 7, data); + return; + } + + if (videobank) { + if ((address & 0xf000) == 0x2000) { + address ^= 1; + K053247Write(address & 0x0fff, data); + return; + } + + if ((address & 0xf000) == 0x4000) { + DrvPalRAM[address & 0xfff] = data; + return; + } + } + + if (address >= 0x2000 && address <= 0x5fff) { + K052109Write(address - 0x2000, data); + return; + } +} + +UINT8 esckids_main_read(UINT16 address) +{ + switch (address) + { + case 0x3f80: + return DrvInputs[0]; + + case 0x3f81: + return DrvInputs[1]; + + case 0x3f82: + return DrvInputs[2]; + + case 0x3f83: + return DrvInputs[3]; + + case 0x3f92: + { + INT32 res = (EEPROMRead() & 1) | vblank | ((DrvJoy6 << 2) ^ 0xf6); + + if (init_eeprom_count > 0) + { + init_eeprom_count--; + res &= 0xfb; + } + return res; + } + + case 0x3f93: + return DrvInputs[4]; + + case 0x3fd4: + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return 0; + + case 0x3fd6: + case 0x3fd7: + return K053260Read(0, (address & 1)+2); + + case 0x3fd8: + case 0x3fd9: + return K053246Read(address & 1); + + } + + if (videobank) { + if ((address & 0xf000) == 0x2000) { + address ^= 1; + return K053247Read(address & 0x0fff); + } + + if ((address & 0xf000) == 0x4000) { + return DrvPalRAM[address & 0x0fff]; + } + } + + if (address >= 0x2000 && address <= 0x5fff) { + return K052109Read(address - 0x2000); + } + + return 0; +} + +void __fastcall vendetta_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf800: + BurnYM2151SelectRegister(data); + return; + + case 0xf801: + BurnYM2151WriteRegister(data); + return; + + case 0xfa00: + nCyclesDone[1] += ZetRun(100); + ZetNmi(); + return; + } + + if (address >= 0xfc00 && address < 0xfc30) { + K053260Write(0, address & 0xff, data); + return; + } +} + +UINT8 __fastcall vendetta_sound_read(UINT16 address) +{ + switch (address) + { + case 0xf800: + return 0xff; + case 0xf801: + return BurnYM2151ReadStatus(); + } + + if (address >= 0xfc00 && address < 0xfc30) { + if ((address & 0x3f) == 0x01) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + + return K053260Read(0, address & 0xff); + } + + return 0; +} + +static void vendetta_set_lines(INT32 lines) +{ + nDrvBank[0] = lines; + + if (lines < 0x1c) { + konamiMapMemory(DrvKonROM + 0x10000 + (lines * 0x2000), 0x0000 | bankoffset, 0x1fff | bankoffset, KON_ROM); + } +} + +static void K052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + *code |= ((*color & 0x03) << 8) | ((*color & 0x30) << 6) | ((*color & 0x0c) << 10) | (bank << 14); + *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6); +} + +static void EsckidsK052109Callback(INT32 layer, INT32 bank, INT32 *code, INT32 *color, INT32 *, INT32 *) +{ + *code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13); + *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); +} + +static void K053247Callback(INT32 *code, INT32 *color, INT32 *priority) +{ + INT32 pri = (*color & 0x03e0) >> 4; + if (pri <= layerpri[2]) *priority = 0; + else if (pri > layerpri[2] && pri <= layerpri[1]) *priority = 1; + else if (pri > layerpri[1] && pri <= layerpri[0]) *priority = 2; + else *priority = 3; + + *code &= 0x7fff; + + *color = sprite_colorbase + (*color & 0x001f); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + konamiOpen(0); + konamiReset(); + konamiClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + KonamiICReset(); + + K053260Reset(0); + + EEPROMReset(); + + videobank = 0; + + if (EEPROMAvailable()) { + init_eeprom_count = 0; + } else { + init_eeprom_count = 1000; + } + + irq_enabled = 0; + videobank = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvKonROM = Next; Next += 0x050000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x100000; + DrvGfxROMExp0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x400000; + DrvGfxROMExp1 = Next; Next += 0x800000; + + DrvSndROM = Next; Next += 0x100000; + + Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x000800; + + DrvKonRAM = Next; Next += 0x002000; + DrvPalRAM = Next; Next += 0x001000; + + nDrvBank = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 XOffs[8] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; + INT32 YOffs[8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x100000); + konami_rom_deinterleave_4(DrvGfxROM1, 0x400000); + + GfxDecode(0x8000, 4, 8, 8, Plane, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + + K053247GfxDecode(DrvGfxROM1, DrvGfxROMExp1, 0x400000); + + return 0; +} + +static const eeprom_interface vendetta_eeprom_intf = +{ + 7, // address bits + 8, // data bits + "011000", // read command + "011100", // write command + 0, // erase command + "0100000000000", // lock command + "0100110000000", // unlock command + 0, + 0 +}; + +static INT32 DrvInit(INT32 nGame) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvKonROM + 0x010000, 0, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x300000, 7, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 8, 1)) return 1; + + DrvGfxDecode(); + } + + if (nGame) // escape kids + { + memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x28000, 0x8000); + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvKonRAM, 0x0000, 0x1fff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x10000, 0x6000, 0x7fff, KON_ROM); + konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(esckids_main_write); + konamiSetReadHandler(esckids_main_read); + konamiSetlinesCallback(vendetta_set_lines); + konamiClose(); + + K052109Init(DrvGfxROM0, 0x0fffff); + K052109SetCallback(EsckidsK052109Callback); + K052109AdjustScroll(8, -8); + + K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 1); + K053247SetSpriteOffset(-11, 14); + + bankoffset = 0x6000; + } else { + memcpy (DrvKonROM + 0x08000, DrvKonROM + 0x48000, 0x8000); + + konamiInit(1); + konamiOpen(0); + konamiMapMemory(DrvKonROM + 0x10000, 0x0000, 0x1fff, KON_ROM); + konamiMapMemory(DrvKonRAM, 0x2000, 0x3fff, KON_RAM); + konamiMapMemory(DrvKonROM + 0x08000, 0x8000, 0xffff, KON_ROM); + konamiSetWriteHandler(vendetta_main_write); + konamiSetReadHandler(vendetta_main_read); + konamiSetlinesCallback(vendetta_set_lines); + konamiClose(); + + K052109Init(DrvGfxROM0, 0x0fffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(0, 0); + + K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 1); + K053247SetSpriteOffset(-53, 22); + + bankoffset = 0; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(vendetta_sound_write); + ZetSetReadHandler(vendetta_sound_read); + ZetClose(); + + EEPROMInit(&vendetta_eeprom_intf); + + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + K053260Init(0, 3579545, DrvSndROM, 0x100000 >> nGame); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); + K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + konamiExit(); + ZetExit(); + + EEPROMExit(); + + BurnYM2151Exit(); + K053260Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void DrvRecalcPal() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x1000 / 2; i++) { + UINT16 d = BURN_ENDIAN_SWAP_INT16((p[i] << 8) | (p[i] >> 8)); + + b = (d >> 10) & 0x1f; + g = (d >> 5) & 0x1f; + r = (d >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + Palette[i] = (r << 16) | (g << 8) | b; + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static void sortlayers(INT32 *layer,INT32 *pri) +{ +#define SWAP(a,b) \ + if (pri[a] < pri[b]) \ + { \ + INT32 t; \ + t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ + t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ + } + + SWAP(0,1) + SWAP(0,2) + SWAP(1,2) +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvRecalcPal(); + } + + K052109UpdateScroll(); + + INT32 layer[3]; + + bg_colorbase = K053251GetPaletteIndex(0); + sprite_colorbase = K053251GetPaletteIndex(1); + layer_colorbase[0] = K053251GetPaletteIndex(2); + layer_colorbase[1] = K053251GetPaletteIndex(3); + layer_colorbase[2] = K053251GetPaletteIndex(4); + + layerpri[0] = K053251GetPriority(2); + layerpri[1] = K053251GetPriority(3); + layerpri[2] = K053251GetPriority(4); + layer[0] = 0; + layer[1] = 1; + layer[2] = 2; + + sortlayers(layer,layerpri); + + BurnTransferClear(); + + // this order makes sense... + if (nSpriteEnable & 8) K053247SpritesRender(DrvGfxROMExp1, 0); + + if (nBurnLayer & 1) K052109RenderLayer(layer[0], 1, DrvGfxROMExp0); + + if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0); + + if (nSpriteEnable & 4) K053247SpritesRender(DrvGfxROMExp1, 1); + if (nSpriteEnable & 2) K053247SpritesRender(DrvGfxROMExp1, 2); + + if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0); + + if (nSpriteEnable & 1) K053247SpritesRender(DrvGfxROMExp1, 3); + + KonamiBlendCopy(Palette, DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + konamiNewFrame(); + + { + memset (DrvInputs, 0xff, 5); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + } + + // Clear Opposites + if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; + if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[2] & 0x0c) == 0) DrvInputs[2] |= 0x0c; + if ((DrvInputs[2] & 0x03) == 0) DrvInputs[2] |= 0x03; + if ((DrvInputs[3] & 0x0c) == 0) DrvInputs[3] |= 0x0c; + if ((DrvInputs[3] & 0x03) == 0) DrvInputs[3] |= 0x03; + } + + INT32 nInterleave = 100; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 6000000 / 60, 3579545 / 60 }; + + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetOpen(0); + konamiOpen(0); + + vblank = 8; + + INT32 trigger_vblank = (nInterleave / 256) * 240; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext, nCyclesSegment; + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[0]; + nCyclesSegment = konamiRun(nCyclesSegment); + nCyclesDone[0] += nCyclesSegment; + + nNext = (i + 1) * nCyclesTotal[1] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[1]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[1] += nCyclesSegment; + + if (i == trigger_vblank) vblank = 0; // or 8? + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (irq_enabled) konamiSetIrqLine(KONAMI_IRQ_LINE, KONAMI_HOLD_LINE); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K053260Update(0, pSoundBuf, nSegmentLength); + } + } + + konamiClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + konamiCpuScan(nAction, pnMin); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + K053260Scan(nAction); + + KonamiICScan(nAction); + + EEPROMScan(nAction, pnMin); + + SCAN_VAR(irq_enabled); + SCAN_VAR(videobank); + SCAN_VAR(nCyclesDone[1]); + } + + if (nAction & ACB_WRITE) { + konamiOpen(0); + vendetta_set_lines(nDrvBank[0]); + konamiClose(); + } + + return 0; +} + + +// Vendetta (World 4 Players ver. T) + +static struct BurnRomInfo vendettaRomDesc[] = { + { "081t01", 0x040000, 0xe76267f5, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles + { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 + + { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles + { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 + { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 + { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 + + { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples + + { "vendetta.nv", 0x000080, 0xfbac4e30, BRF_OPT }, +}; + +STD_ROM_PICK(vendetta) +STD_ROM_FN(vendetta) + +static INT32 VendettaInit() +{ + return DrvInit(0); +} + +struct BurnDriver BurnDrvVendetta = { + "vendetta", NULL, NULL, NULL, "1991", + "Vendetta (World 4 Players ver. T)\0", NULL, "Konami", "GX081", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, vendettaRomInfo, vendettaRomName, NULL, NULL, Vendet4pInputInfo, NULL, + VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 304, 224, 4, 3 +}; + + +// Vendetta (World 4 Players ver. R) + +static struct BurnRomInfo vendettarRomDesc[] = { + { "081r01", 0x040000, 0x84796281, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles + { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 + + { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles + { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 + { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 + { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 + + { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples + + { "vendettar.nv", 0x000080, 0xec3f0449, BRF_OPT }, +}; + +STD_ROM_PICK(vendettar) +STD_ROM_FN(vendettar) + +struct BurnDriver BurnDrvVendettar = { + "vendettar", "vendetta", NULL, NULL, "1991", + "Vendetta (World 4 Players ver. R)\0", NULL, "Konami", "GX081", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, vendettarRomInfo, vendettarRomName, NULL, NULL, Vendet4pInputInfo, NULL, + VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 304, 224, 4, 3 +}; + + +// Vendetta (World 2 Players ver. W) + +static struct BurnRomInfo vendetta2pRomDesc[] = { + { "081w01", 0x040000, 0xcee57132, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles + { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 + + { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles + { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 + { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 + { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 + + { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples + + { "vendetta.nv", 0x000080, 0xfbac4e30, BRF_OPT }, +}; + +STD_ROM_PICK(vendetta2p) +STD_ROM_FN(vendetta2p) + +struct BurnDriver BurnDrvVendetta2p = { + "vendetta2p", "vendetta", NULL, NULL, "1991", + "Vendetta (World 2 Players ver. W)\0", NULL, "Konami", "GX081", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, vendetta2pRomInfo, vendetta2pRomName, NULL, NULL, VendettaInputInfo, NULL, + VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 304, 224, 4, 3 +}; + + +// Vendetta (Asia 2 Players ver. U) + +static struct BurnRomInfo vendetta2puRomDesc[] = { + { "081u01", 0x040000, 0xb4d9ade5, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles + { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 + + { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles + { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 + { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 + { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 + + { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples + + { "vendetta.nv", 0x000080, 0xfbac4e30, BRF_OPT }, +}; + +STD_ROM_PICK(vendetta2pu) +STD_ROM_FN(vendetta2pu) + +struct BurnDriver BurnDrvVendetta2pu = { + "vendetta2pu", "vendetta", NULL, NULL, "1991", + "Vendetta (Asia 2 Players ver. U)\0", NULL, "Konami", "GX081", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, vendetta2puRomInfo, vendetta2puRomName, NULL, NULL, VendettaInputInfo, NULL, + VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 304, 224, 4, 3 +}; + + +// Vendetta (Asia 2 Players ver. D) + +static struct BurnRomInfo vendetta2pdRomDesc[] = { + { "081d01", 0x040000, 0x335da495, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles + { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 + + { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles + { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 + { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 + { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 + + { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples + + { "vendetta.nv", 0x000080, 0xfbac4e30, BRF_OPT }, +}; + +STD_ROM_PICK(vendetta2pd) +STD_ROM_FN(vendetta2pd) + +struct BurnDriver BurnDrvVendetta2pd = { + "vendetta2pd", "vendetta", NULL, NULL, "1991", + "Vendetta (Asia 2 Players ver. D)\0", NULL, "Konami", "GX081", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, vendetta2pdRomInfo, vendetta2pdRomName, NULL, NULL, VendettaInputInfo, NULL, + VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 304, 224, 4, 3 +}; + + +// Crime Fighters 2 (Japan 2 Players ver. P) + +static struct BurnRomInfo vendettajRomDesc[] = { + { "081p01", 0x040000, 0x5fe30242, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "081b02", 0x010000, 0x4c604d9b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "081a09", 0x080000, 0xb4c777a9, 3 | BRF_GRA }, // 2 K052109 Tiles + { "081a08", 0x080000, 0x272ac8d9, 3 | BRF_GRA }, // 3 + + { "081a04", 0x100000, 0x464b9aa4, 4 | BRF_GRA }, // 4 K053247 Tiles + { "081a05", 0x100000, 0x4e173759, 4 | BRF_GRA }, // 5 + { "081a06", 0x100000, 0xe9fe6d80, 4 | BRF_GRA }, // 6 + { "081a07", 0x100000, 0x8a22b29a, 4 | BRF_GRA }, // 7 + + { "081a03", 0x100000, 0x14b6baea, 5 | BRF_SND }, // 8 K053260 Samples + + { "vendettaj.nv", 0x000080, 0x3550a54e, BRF_OPT }, +}; + +STD_ROM_PICK(vendettaj) +STD_ROM_FN(vendettaj) + +struct BurnDriver BurnDrvVendettaj = { + "vendettaj", "vendetta", NULL, NULL, "1991", + "Crime Fighters 2 (Japan 2 Players ver. P)\0", NULL, "Konami", "GX081", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, vendettajRomInfo, vendettajRomName, NULL, NULL, VendettaInputInfo, NULL, + VendettaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 304, 224, 4, 3 +}; + + +// Escape Kids (Asia, 4 Players) + +static struct BurnRomInfo esckidsRomDesc[] = { + { "17c.bin", 0x020000, 0x9dfba99c, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "975f02", 0x010000, 0x994fb229, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "975c09", 0x080000, 0xbc52210e, 3 | BRF_GRA }, // 2 K052109 Tiles + { "975c08", 0x080000, 0xfcff9256, 3 | BRF_GRA }, // 3 + + { "975c04", 0x100000, 0x15688a6f, 4 | BRF_GRA }, // 4 K053247 Tiles + { "975c05", 0x100000, 0x1ff33bb7, 4 | BRF_GRA }, // 5 + { "975c06", 0x100000, 0x36d410f9, 4 | BRF_GRA }, // 6 + { "975c07", 0x100000, 0x97ec541e, 4 | BRF_GRA }, // 7 + + { "975c03", 0x080000, 0xdc4a1707, 5 | BRF_SND }, // 8 K053260 Samples + + { "esckids.nv", 0x000080, 0xa8522e1f, BRF_OPT }, +}; + +STD_ROM_PICK(esckids) +STD_ROM_FN(esckids) + +static INT32 EsckidsInit() +{ + return DrvInit(1); +} + +struct BurnDriver BurnDrvEsckids = { + "esckids", NULL, NULL, NULL, "1991", + "Escape Kids (Asia, 4 Players)\0", NULL, "Konami", "GX975", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, + NULL, esckidsRomInfo, esckidsRomName, NULL, NULL, EsckidsInputInfo, NULL, + EsckidsInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x800, + 288, 240, 4, 3 +}; + + +// Escape Kids (Japan, 2 Players) + +static struct BurnRomInfo esckidsjRomDesc[] = { + { "975r01", 0x020000, 0x7b5c5572, 1 | BRF_PRG | BRF_ESS }, // 0 Konami Custom Code + + { "975f02", 0x010000, 0x994fb229, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "975c09", 0x080000, 0xbc52210e, 3 | BRF_GRA }, // 2 K052109 Tiles + { "975c08", 0x080000, 0xfcff9256, 3 | BRF_GRA }, // 3 + + { "975c04", 0x100000, 0x15688a6f, 4 | BRF_GRA }, // 4 K053247 Tiles + { "975c05", 0x100000, 0x1ff33bb7, 4 | BRF_GRA }, // 5 + { "975c06", 0x100000, 0x36d410f9, 4 | BRF_GRA }, // 6 + { "975c07", 0x100000, 0x97ec541e, 4 | BRF_GRA }, // 7 + + { "975c03", 0x080000, 0xdc4a1707, 5 | BRF_SND }, // 8 K053260 Samples + + { "esckidsj.nv", 0x000080, 0x985e2a2d, BRF_OPT }, +}; + +STD_ROM_PICK(esckidsj) +STD_ROM_FN(esckidsj) + +struct BurnDriver BurnDrvEsckidsj = { + "esckidsj", "esckids", NULL, NULL, "1991", + "Escape Kids (Japan, 2 Players)\0", NULL, "Konami", "GX975", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_MISC, 0, + NULL, esckidsjRomInfo, esckidsjRomName, NULL, NULL, EsckidsjInputInfo, NULL, + EsckidsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 240, 4, 3 +}; diff --git a/src/burn/drv/konami/d_xmen.cpp b/src/burn/drv/konami/d_xmen.cpp index 4062eb124..c93c63bf3 100644 --- a/src/burn/drv/konami/d_xmen.cpp +++ b/src/burn/drv/konami/d_xmen.cpp @@ -1,1048 +1,1047 @@ -// FB Alpha X-Men driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "konamiic.h" -#include "burn_ym2151.h" -#include "k054539.h" -#include "eeprom.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROMExp0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROMExp1; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *soundlatch2; -static UINT8 *nDrvZ80Bank; - -static INT32 interrupt_enable; -static INT32 init_eeprom_count; - -static INT32 sprite_colorbase; -static INT32 bg_colorbase; -static INT32 layerpri[3]; -static INT32 layer_colorbase[3]; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvReset; -static UINT16 DrvInputs[3]; - -static struct BurnInputInfo XmenInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 8, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 9, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p2 fire 3" }, - - {"P3 Coin", BIT_DIGITAL, DrvJoy2 + 15, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, DrvJoy3 + 10, "p3 start" }, - {"P3 Up", BIT_DIGITAL, DrvJoy2 + 8, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy2 + 9, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy2 + 10, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy2 + 11, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, DrvJoy2 + 14, "p3 fire 3" }, - - {"P4 Coin", BIT_DIGITAL, DrvJoy1 + 15, "p4 coin" }, - {"P4 Start", BIT_DIGITAL, DrvJoy3 + 11, "p4 start" }, - {"P4 Up", BIT_DIGITAL, DrvJoy1 + 8, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvJoy1 + 9, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvJoy1 + 10, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvJoy1 + 11, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p4 fire 2" }, - {"P4 Button 3", BIT_DIGITAL, DrvJoy1 + 14, "p4 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Diagnostics", BIT_DIGITAL, DrvJoy3 + 14, "diag" }, -}; - -STDINPUTINFO(Xmen) - -static struct BurnInputInfo Xmen2pInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 8, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 9, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Diagnostics", BIT_DIGITAL, DrvJoy3 + 14, "diag" }, - {"Service 1", BIT_DIGITAL, DrvJoy3 + 0, "service" }, - {"Service 2", BIT_DIGITAL, DrvJoy3 + 1, "service2" }, -}; - -STDINPUTINFO(Xmen2p) - -void __fastcall xmen_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x108000: - K052109RMRDLine = data & 0x02; - K053246_set_OBJCHA_line(data & 0x01); - return; - - case 0x108001: - EEPROMWrite(data & 0x08, data & 0x10, data & 0x04); - return; - - case 0x10804d: - *soundlatch = data; - return; - - case 0x10804e: - case 0x10804f: - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - - case 0x10a001: - // watchdog - return; - - case 0x18fa01: - interrupt_enable = data & 0x04; - return; - } - - if (address >= 0x18c000 && address <= 0x197fff) { - if (address & 1) K052109Write((address - 0x18c000) >> 1, data); - return; - } - - if ((address & 0xfff000) == 0x100000) { - K053247Write((address & 0xfff) ^ 1, data); - return; - } - - if ((address & 0xfffff8) == 0x108020) { - K053246Write((address & 0x007)^1, data); - return; - } - - if ((address & 0xffffe0) == 0x108060) { - if (address & 1) K053251Write((address >> 1) & 0x0f, data); - return; - } -} - -void __fastcall xmen_main_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfff000) == 0x100000) { - K053247Write(address & 0xffe, data | 0x10000); - return; - } - - if ((address & 0xfffff8) == 0x108020) { - K053246Write((address & 0x006) | 0, data & 0xff); - K053246Write((address & 0x006) | 1, data >> 8); - return; - } -} - -UINT8 __fastcall xmen_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x108054: - case 0x108055: - return *soundlatch2; - - case 0x10a000: - case 0x10a001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x10a002: - case 0x10a003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x10a004: - if (init_eeprom_count > 0) { - init_eeprom_count--; - return 0xbf; - } - return DrvInputs[2] >> 8; - - case 0x10a005: // eeprom_r - init_eeprom_count--; - return (DrvInputs[2] & 0xbf) | (EEPROMRead() << 6); - - case 0x10a00c: - case 0x10a00d: - return K053246Read(~address & 1); - } - - if ((address & 0xfff000) == 0x100000) { - return K053247Read((address & 0xfff)^1); - } - - if (address >= 0x18c000 && address <= 0x197fff) { - return K052109Read((address - 0x18c000) >> 1); - } - - return 0; -} - -UINT16 __fastcall xmen_main_read_word(UINT32 /*address*/) -{ - return 0; -} - -static void bankswitch(INT32 bank) -{ - nDrvZ80Bank[0] = bank & 7; - - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + nDrvZ80Bank[0] * 0x4000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + nDrvZ80Bank[0] * 0x4000); -} - -void __fastcall xmen_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe800: - case 0xec00: - BurnYM2151SelectRegister(data); - return; - - case 0xe801: - case 0xec01: - BurnYM2151WriteRegister(data); - return; - - case 0xf000: - *soundlatch2 = data; - return; - - case 0xf800: - bankswitch(data); - return; - } - - if (address >= 0xe000 && address <= 0xe22f) { - return K054539Write(0, address & 0x3ff, data); - } -} - -UINT8 __fastcall xmen_sound_read(UINT16 address) -{ - switch (address) - { - case 0xe800: - case 0xe801: - case 0xec00: - case 0xec01: - return BurnYM2151ReadStatus(); - - case 0xf002: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - if (address >= 0xe000 && address <= 0xe22f) { - return K054539Read(0, address & 0x3ff); - } - - return 0; -} - -static void K052109Callback(INT32 layer, INT32 , INT32 *, INT32 *color, INT32 *, INT32 *) -{ - if (layer == 0) - *color = layer_colorbase[layer] + ((*color & 0xf0) >> 4); - else - *color = layer_colorbase[layer] + ((*color & 0x7c) >> 2); -} - -static void K053247Callback(INT32 *code, INT32 *color, INT32 *priority_mask) -{ - INT32 pri = (*color & 0x00e0) >> 4; - if (pri <= layerpri[2]) *priority_mask = 0; - else if (pri > layerpri[2] && pri <= layerpri[1]) *priority_mask = 1; - else if (pri > layerpri[1] && pri <= layerpri[0]) *priority_mask = 2; - else *priority_mask = 3; - - *color = sprite_colorbase + (*color & 0x001f); - *code &= 0x7fff; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - K054539Reset(0); - - KonamiICReset(); - - EEPROMReset(); - - if (EEPROMAvailable()) { - init_eeprom_count = 0; - } else { - init_eeprom_count = 10; - } - - interrupt_enable = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x100000; - DrvZ80ROM = Next; Next += 0x020000; - - DrvGfxROM0 = Next; Next += 0x200000; - DrvGfxROMExp0 = Next; Next += 0x400000; - DrvGfxROM1 = Next; Next += 0x400000; - DrvGfxROMExp1 = Next; Next += 0x800000; - - DrvSndROM = Next; Next += 0x200000; - - Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); - - AllRam = Next; - - DrvPalRAM = Next; Next += 0x001000; - Drv68KRAM = Next; Next += 0x005000; - - DrvZ80RAM = Next; Next += 0x002000; - - soundlatch = Next; Next += 0x000001; - soundlatch2 = Next; Next += 0x000001; - - nDrvZ80Bank = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x018, 0x010, 0x008, 0x000 }; - INT32 XOffs[8] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; - INT32 YOffs[8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; - - konami_rom_deinterleave_2(DrvGfxROM0, 0x200000); - konami_rom_deinterleave_4(DrvGfxROM1, 0x400000); - - GfxDecode(0x10000, 4, 8, 8, Plane, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); - - K053247GfxDecode(DrvGfxROM1, DrvGfxROMExp1, 0x400000); - - return 0; -} - -static const eeprom_interface xmen_eeprom_intf = -{ - 7, // address bits - 8, // data bits - "011000", // read command - "011100", // write command - 0, // erase command - "0100000000000", // lock command - "0100110000000", // unlock command - 0, - 0 -}; - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x080001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x080000, 3, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x300000, 10, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 11, 1)) return 1; - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRAM + 0x00000, 0x101000, 0x101fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x104000, 0x104fff, SM_RAM); - SekMapMemory(Drv68KRAM + 0x01000, 0x110000, 0x113fff, SM_RAM); - SekSetWriteByteHandler(0, xmen_main_write_byte); - SekSetWriteWordHandler(0, xmen_main_write_word); - SekSetReadByteHandler(0, xmen_main_read_byte); - SekSetReadWordHandler(0, xmen_main_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x8000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x8000); - ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM); - ZetSetWriteHandler(xmen_sound_write); - ZetSetReadHandler(xmen_sound_read); - ZetMemEnd(); - ZetClose(); - - EEPROMInit(&xmen_eeprom_intf); - - K052109Init(DrvGfxROM0, 0x1fffff); - K052109SetCallback(K052109Callback); - K052109AdjustScroll(8, 0); - - K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 1); - K053247SetSpriteOffset(-510, 158); - - BurnYM2151Init(4000000); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.20, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.20, BURN_SND_ROUTE_RIGHT); - - K054539Init(0, 48000, DrvSndROM, 0x200000); - K054539SetRoute(0, BURN_SND_K054539_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - K054539SetRoute(0, BURN_SND_K054539_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - KonamiICExit(); - - SekExit(); - ZetExit(); - - BurnYM2151Exit(); - K054539Exit(); - - EEPROMExit(); - - BurnFree (AllMem); - - return 0; -} - -static void sortlayers(INT32 *layer,INT32 *pri) -{ -#define SWAP(a,b) \ - if (pri[a] < pri[b]) \ - { \ - INT32 t; \ - t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ - t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ - } - - SWAP(0,1) - SWAP(0,2) - SWAP(1,2) -} - -static inline void DrvRecalcPalette() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x1000 / 2; i++) { - INT32 d = BURN_ENDIAN_SWAP_INT16(p[i]); - - r = (d >> 0) & 0x1f; - g = (d >> 5) & 0x1f; - b = (d >> 10) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - Palette[i] = (r << 16) | (g << 8) | b; - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvRecalcPalette(); - } - - K052109UpdateScroll(); - - INT32 layer[3]; - - bg_colorbase = K053251GetPaletteIndex(4); - sprite_colorbase = K053251GetPaletteIndex(1); - layer_colorbase[0] = K053251GetPaletteIndex(3); - layer_colorbase[1] = K053251GetPaletteIndex(0); - layer_colorbase[2] = K053251GetPaletteIndex(2); - - layerpri[0] = K053251GetPriority(3); - layerpri[1] = K053251GetPriority(0); - layerpri[2] = K053251GetPriority(2); - layer[0] = 0; - layer[1] = 1; - layer[2] = 2; - - sortlayers(layer,layerpri); - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 16 * bg_colorbase+1; - } - - if (nSpriteEnable & 8) K053247SpritesRender(DrvGfxROMExp1, 3); - - if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, DrvGfxROMExp0); - - if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0); - -if (nBurnLayer & 8) { - if (nSpriteEnable & 1) K053247SpritesRender(DrvGfxROMExp1, 0); - if (nSpriteEnable & 2) K053247SpritesRender(DrvGfxROMExp1, 1); - if (nSpriteEnable & 4) K053247SpritesRender(DrvGfxROMExp1, 2); -} - - if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0); - - KonamiBlendCopy(Palette, DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3 * sizeof(INT16)); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // Clear Opposites - if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; - if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; - if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; - if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; - if ((DrvInputs[1] & 0xc00) == 0) DrvInputs[1] |= 0xc00; - if ((DrvInputs[1] & 0x300) == 0) DrvInputs[1] |= 0x300; - if ((DrvInputs[0] & 0xc00) == 0) DrvInputs[0] |= 0xc00; - if ((DrvInputs[0] & 0x300) == 0) DrvInputs[0] |= 0x300; - } - - INT32 nInterleave = nBurnSoundLen; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 16000000 / 60, 8000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext, nCyclesSegment; - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[0]; - nCyclesSegment = SekRun(nCyclesSegment); - nCyclesDone[0] += nCyclesSegment; - - if (i == (nInterleave / 2) && interrupt_enable) { - SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - } - - nNext = (i + 1) * nCyclesTotal[1] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[1]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[1] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - K054539Update(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (interrupt_enable) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - K054539Update(0, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029705; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - - K054539Scan(nAction); - - KonamiICScan(nAction); - EEPROMScan(nAction, pnMin); - - SCAN_VAR(interrupt_enable); - SCAN_VAR(init_eeprom_count); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - bankswitch(nDrvZ80Bank[0]); - ZetClose(); - } - - EEPROMScan(nAction, pnMin); - - return 0; -} - - -// X-Men (4 Players ver UBB) - -static struct BurnRomInfo xmenRomDesc[] = { - { "065-ubb04.10d", 0x020000, 0xf896c93b, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "065-ubb05.10f", 0x020000, 0xe02e5d64, 1 | BRF_PRG | BRF_ESS }, // 1 - { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles - { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 - - { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites - { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 - { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 - { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 - - { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples - - { "xmen_ubb.nv", 0x000080, 0x52f334ba, BRF_OPT }, -}; - -STD_ROM_PICK(xmen) -STD_ROM_FN(xmen) - -struct BurnDriver BurnDrvXmen = { - "xmen", NULL, NULL, NULL, "1992", - "X-Men (4 Players ver UBB)\0", NULL, "Konami", "GX065", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, xmenRomInfo, xmenRomName, NULL, NULL, XmenInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// X-Men (4 Players ver ADA) - -static struct BurnRomInfo xmenaRomDesc[] = { - { "065-ada.10d", 0x020000, 0xb8276624, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "065-ada.10f", 0x020000, 0xc68582ad, 1 | BRF_PRG | BRF_ESS }, // 1 - { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles - { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 - - { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites - { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 - { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 - { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 - - { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples - - { "xmen_ada.nv", 0x000080, 0xa77a3891, BRF_OPT }, -}; - -STD_ROM_PICK(xmena) -STD_ROM_FN(xmena) - -struct BurnDriver BurnDrvXmena = { - "xmena", "xmen", NULL, NULL, "1992", - "X-Men (4 Players ver ADA)\0", NULL, "Konami", "GX065", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, xmenaRomInfo, xmenaRomName, NULL, NULL, XmenInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// X-Men (4 Players ver EBA) - -static struct BurnRomInfo xmeneRomDesc[] = { - { "065-eba04.10d", 0x020000, 0x3588c5ec, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "065-eba05.10f", 0x020000, 0x79ce32f8, 1 | BRF_PRG | BRF_ESS }, // 1 - { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles - { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 - - { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites - { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 - { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 - { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 - - { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples - - { "xmen_eba.nv", 0x000080, 0x37f8e77a, BRF_OPT }, -}; - -STD_ROM_PICK(xmene) -STD_ROM_FN(xmene) - -struct BurnDriver BurnDrvXmene = { - "xmene", "xmen", NULL, NULL, "1992", - "X-Men (4 Players ver EBA)\0", NULL, "Konami", "GX065", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, xmeneRomInfo, xmeneRomName, NULL, NULL, XmenInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// X-Men (4 Players ver JBA) - -static struct BurnRomInfo xmenjRomDesc[] = { - { "065-jba04.10d", 0x020000, 0xd86cf5eb, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "065-jba05.10f", 0x020000, 0xabbc8126, 1 | BRF_PRG | BRF_ESS }, // 1 - { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles - { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 - - { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites - { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 - { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 - { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 - - { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples - - { "xmen_jba.nv", 0x000080, 0x7439cea7, BRF_OPT }, -}; - -STD_ROM_PICK(xmenj) -STD_ROM_FN(xmenj) - -struct BurnDriver BurnDrvXmenj = { - "xmenj", "xmen", NULL, NULL, "1992", - "X-Men (4 Players ver JBA)\0", NULL, "Konami", "GX065", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, xmenjRomInfo, xmenjRomName, NULL, NULL, XmenInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// X-Men (2 Players ver EAA) - -static struct BurnRomInfo xmen2peRomDesc[] = { - { "065-eaa04.10d", 0x020000, 0x502861e7, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "065-eaa05.10f", 0x020000, 0xca6071bf, 1 | BRF_PRG | BRF_ESS }, // 1 - { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles - { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 - - { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites - { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 - { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 - { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 - - { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples - - { "xmen_eaa.nv", 0x000080, 0x1cbcb653, BRF_OPT }, -}; - -STD_ROM_PICK(xmen2pe) -STD_ROM_FN(xmen2pe) - -struct BurnDriver BurnDrvXmen2pe = { - "xmen2pe", "xmen", NULL, NULL, "1992", - "X-Men (2 Players ver EAA)\0", NULL, "Konami", "GX065", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, xmen2peRomInfo, xmen2peRomName, NULL, NULL, Xmen2pInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// X-Men (2 Players ver AAA) - -static struct BurnRomInfo xmen2paRomDesc[] = { - { "065-aaa04.10d", 0x020000, 0x7f8b27c2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "065-aaa05.10f", 0x020000, 0x841ed636, 1 | BRF_PRG | BRF_ESS }, // 1 - { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles - { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 - - { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites - { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 - { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 - { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 - - { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples - - { "xmen_aaa.nv", 0x000080, 0x750fd447, BRF_OPT }, -}; - -STD_ROM_PICK(xmen2pa) -STD_ROM_FN(xmen2pa) - -struct BurnDriver BurnDrvXmen2pa = { - "xmen2pa", "xmen", NULL, NULL, "1992", - "X-Men (2 Players ver AAA)\0", NULL, "Konami", "GX065", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, xmen2paRomInfo, xmen2paRomName, NULL, NULL, Xmen2pInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// X-Men (2 Players ver JAA) - -static struct BurnRomInfo xmen2pjRomDesc[] = { - { "065-jaa04.10d", 0x020000, 0x66746339, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "065-jaa05.10f", 0x020000, 0x1215b706, 1 | BRF_PRG | BRF_ESS }, // 1 - { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles - { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 - - { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites - { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 - { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 - { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 - - { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples - - { "xmen_jaa.nv", 0x000080, 0x849a9e19, BRF_OPT }, -}; - -STD_ROM_PICK(xmen2pj) -STD_ROM_FN(xmen2pj) - -struct BurnDriver BurnDrvXmen2pj = { - "xmen2pj", "xmen", NULL, NULL, "1992", - "X-Men (2 Players ver JAA)\0", NULL, "Konami", "GX065", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, xmen2pjRomInfo, xmen2pjRomName, NULL, NULL, Xmen2pInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// X-Men (6 Players ver ECB) - -static struct BurnRomInfo xmen6pRomDesc[] = { - { "065-ecb04.18g", 0x020000, 0x258eb21f, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "065-ecb05.18j", 0x020000, 0x25997bcd, 1 | BRF_PRG | BRF_ESS }, // 1 - { "065-a02.17g", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "065-a03.17j", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "065-a01.7b", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "065-a08.1l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles - { "065-a07.1h", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 - - { "065-a09.12l", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites - { "065-a10.17l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 - { "065-a12.22h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 - { "065-a11.22l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 - - { "065-a06.1d", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples - - { "xmen_ecb.nv", 0x000080, 0x462c6e1a, BRF_OPT }, -}; - -STD_ROM_PICK(xmen6p) -STD_ROM_FN(xmen6p) - -struct BurnDriverD BurnDrvXmen6p = { - "xmen6p", "xmen", NULL, NULL, "1992", - "X-Men (6 Players ver ECB)\0", NULL, "Konami", "GX065", - NULL, NULL, NULL, NULL, - BDF_CLONE, 6, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, xmen6pRomInfo, xmen6pRomName, NULL, NULL, XmenInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 256, 256, 4, 3 -}; - - -// X-Men (6 Players ver UCB) - -static struct BurnRomInfo xmen6puRomDesc[] = { - { "065-ucb04.18g", 0x020000, 0x0f09b8e0, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "065-ucb05.18j", 0x020000, 0x867becbf, 1 | BRF_PRG | BRF_ESS }, // 1 - { "065-a02.17g", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "065-a03.17j", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "065-a01.7b", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "065-a08.1l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles - { "065-a07.1h", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 - - { "065-a09.12l", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites - { "065-a10.17l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 - { "065-a12.22h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 - { "065-a11.22l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 - - { "065-a06.1d", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples - - { "xmen_ucb.nv", 0x000080, 0xf3d0f682, BRF_OPT }, -}; - -STD_ROM_PICK(xmen6pu) -STD_ROM_FN(xmen6pu) - -struct BurnDriverD BurnDrvXmen6pu = { - "xmen6pu", "xmen", NULL, NULL, "1992", - "X-Men (6 Players ver UCB)\0", NULL, "Konami", "GX065", - NULL, NULL, NULL, NULL, - BDF_CLONE, 6, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, - NULL, xmen6puRomInfo, xmen6puRomName, NULL, NULL, XmenInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 256, 256, 4, 3 -}; +// FB Alpha X-Men driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "konamiic.h" +#include "burn_ym2151.h" +#include "k054539.h" +#include "eeprom.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROMExp0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROMExp1; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *soundlatch2; +static UINT8 *nDrvZ80Bank; + +static INT32 interrupt_enable; +static INT32 init_eeprom_count; + +static INT32 sprite_colorbase; +static INT32 bg_colorbase; +static INT32 layerpri[3]; +static INT32 layer_colorbase[3]; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvReset; +static UINT16 DrvInputs[3]; + +static struct BurnInputInfo XmenInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 8, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 9, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p2 fire 3" }, + + {"P3 Coin", BIT_DIGITAL, DrvJoy2 + 15, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, DrvJoy3 + 10, "p3 start" }, + {"P3 Up", BIT_DIGITAL, DrvJoy2 + 8, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy2 + 9, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy2 + 10, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy2 + 11, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, DrvJoy2 + 14, "p3 fire 3" }, + + {"P4 Coin", BIT_DIGITAL, DrvJoy1 + 15, "p4 coin" }, + {"P4 Start", BIT_DIGITAL, DrvJoy3 + 11, "p4 start" }, + {"P4 Up", BIT_DIGITAL, DrvJoy1 + 8, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvJoy1 + 9, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvJoy1 + 10, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvJoy1 + 11, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p4 fire 2" }, + {"P4 Button 3", BIT_DIGITAL, DrvJoy1 + 14, "p4 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Diagnostics", BIT_DIGITAL, DrvJoy3 + 14, "diag" }, +}; + +STDINPUTINFO(Xmen) + +static struct BurnInputInfo Xmen2pInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 8, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 9, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Diagnostics", BIT_DIGITAL, DrvJoy3 + 14, "diag" }, + {"Service 1", BIT_DIGITAL, DrvJoy3 + 0, "service" }, + {"Service 2", BIT_DIGITAL, DrvJoy3 + 1, "service2" }, +}; + +STDINPUTINFO(Xmen2p) + +void __fastcall xmen_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x108000: + K052109RMRDLine = data & 0x02; + K053246_set_OBJCHA_line(data & 0x01); + return; + + case 0x108001: + EEPROMWrite(data & 0x08, data & 0x10, data & 0x04); + return; + + case 0x10804d: + *soundlatch = data; + return; + + case 0x10804e: + case 0x10804f: + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + + case 0x10a001: + // watchdog + return; + + case 0x18fa01: + interrupt_enable = data & 0x04; + return; + } + + if (address >= 0x18c000 && address <= 0x197fff) { + if (address & 1) K052109Write((address - 0x18c000) >> 1, data); + return; + } + + if ((address & 0xfff000) == 0x100000) { + K053247Write((address & 0xfff) ^ 1, data); + return; + } + + if ((address & 0xfffff8) == 0x108020) { + K053246Write((address & 0x007)^1, data); + return; + } + + if ((address & 0xffffe0) == 0x108060) { + if (address & 1) K053251Write((address >> 1) & 0x0f, data); + return; + } +} + +void __fastcall xmen_main_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfff000) == 0x100000) { + K053247Write(address & 0xffe, data | 0x10000); + return; + } + + if ((address & 0xfffff8) == 0x108020) { + K053246Write((address & 0x006) | 0, data & 0xff); + K053246Write((address & 0x006) | 1, data >> 8); + return; + } +} + +UINT8 __fastcall xmen_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x108054: + case 0x108055: + return *soundlatch2; + + case 0x10a000: + case 0x10a001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x10a002: + case 0x10a003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x10a004: + if (init_eeprom_count > 0) { + init_eeprom_count--; + return 0xbf; + } + return DrvInputs[2] >> 8; + + case 0x10a005: // eeprom_r + init_eeprom_count--; + return (DrvInputs[2] & 0xbf) | (EEPROMRead() << 6); + + case 0x10a00c: + case 0x10a00d: + return K053246Read(~address & 1); + } + + if ((address & 0xfff000) == 0x100000) { + return K053247Read((address & 0xfff)^1); + } + + if (address >= 0x18c000 && address <= 0x197fff) { + return K052109Read((address - 0x18c000) >> 1); + } + + return 0; +} + +UINT16 __fastcall xmen_main_read_word(UINT32 /*address*/) +{ + return 0; +} + +static void bankswitch(INT32 bank) +{ + nDrvZ80Bank[0] = bank & 7; + + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + nDrvZ80Bank[0] * 0x4000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + nDrvZ80Bank[0] * 0x4000); +} + +void __fastcall xmen_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe800: + case 0xec00: + BurnYM2151SelectRegister(data); + return; + + case 0xe801: + case 0xec01: + BurnYM2151WriteRegister(data); + return; + + case 0xf000: + *soundlatch2 = data; + return; + + case 0xf800: + bankswitch(data); + return; + } + + if (address >= 0xe000 && address <= 0xe22f) { + return K054539Write(0, address & 0x3ff, data); + } +} + +UINT8 __fastcall xmen_sound_read(UINT16 address) +{ + switch (address) + { + case 0xe800: + case 0xe801: + case 0xec00: + case 0xec01: + return BurnYM2151ReadStatus(); + + case 0xf002: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + if (address >= 0xe000 && address <= 0xe22f) { + return K054539Read(0, address & 0x3ff); + } + + return 0; +} + +static void K052109Callback(INT32 layer, INT32 , INT32 *, INT32 *color, INT32 *, INT32 *) +{ + if (layer == 0) + *color = layer_colorbase[layer] + ((*color & 0xf0) >> 4); + else + *color = layer_colorbase[layer] + ((*color & 0x7c) >> 2); +} + +static void K053247Callback(INT32 *code, INT32 *color, INT32 *priority_mask) +{ + INT32 pri = (*color & 0x00e0) >> 4; + if (pri <= layerpri[2]) *priority_mask = 0; + else if (pri > layerpri[2] && pri <= layerpri[1]) *priority_mask = 1; + else if (pri > layerpri[1] && pri <= layerpri[0]) *priority_mask = 2; + else *priority_mask = 3; + + *color = sprite_colorbase + (*color & 0x001f); + *code &= 0x7fff; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + K054539Reset(0); + + KonamiICReset(); + + EEPROMReset(); + + if (EEPROMAvailable()) { + init_eeprom_count = 0; + } else { + init_eeprom_count = 10; + } + + interrupt_enable = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x100000; + DrvZ80ROM = Next; Next += 0x020000; + + DrvGfxROM0 = Next; Next += 0x200000; + DrvGfxROMExp0 = Next; Next += 0x400000; + DrvGfxROM1 = Next; Next += 0x400000; + DrvGfxROMExp1 = Next; Next += 0x800000; + + DrvSndROM = Next; Next += 0x200000; + + Palette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32); + + AllRam = Next; + + DrvPalRAM = Next; Next += 0x001000; + Drv68KRAM = Next; Next += 0x005000; + + DrvZ80RAM = Next; Next += 0x002000; + + soundlatch = Next; Next += 0x000001; + soundlatch2 = Next; Next += 0x000001; + + nDrvZ80Bank = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x018, 0x010, 0x008, 0x000 }; + INT32 XOffs[8] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; + INT32 YOffs[8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; + + konami_rom_deinterleave_2(DrvGfxROM0, 0x200000); + konami_rom_deinterleave_4(DrvGfxROM1, 0x400000); + + GfxDecode(0x10000, 4, 8, 8, Plane, XOffs, YOffs, 0x100, DrvGfxROM0, DrvGfxROMExp0); + + K053247GfxDecode(DrvGfxROM1, DrvGfxROMExp1, 0x400000); + + return 0; +} + +static const eeprom_interface xmen_eeprom_intf = +{ + 7, // address bits + 8, // data bits + "011000", // read command + "011100", // write command + 0, // erase command + "0100000000000", // lock command + "0100110000000", // unlock command + 0, + 0 +}; + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x080001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x080000, 3, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x300000, 10, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 11, 1)) return 1; + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRAM + 0x00000, 0x101000, 0x101fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x104000, 0x104fff, SM_RAM); + SekMapMemory(Drv68KRAM + 0x01000, 0x110000, 0x113fff, SM_RAM); + SekSetWriteByteHandler(0, xmen_main_write_byte); + SekSetWriteWordHandler(0, xmen_main_write_word); + SekSetReadByteHandler(0, xmen_main_read_byte); + SekSetReadWordHandler(0, xmen_main_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x8000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x8000); + ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM); + ZetSetWriteHandler(xmen_sound_write); + ZetSetReadHandler(xmen_sound_read); + ZetClose(); + + EEPROMInit(&xmen_eeprom_intf); + + K052109Init(DrvGfxROM0, 0x1fffff); + K052109SetCallback(K052109Callback); + K052109AdjustScroll(8, 0); + + K053247Init(DrvGfxROM1, 0x3fffff, K053247Callback, 1); + K053247SetSpriteOffset(-510, 158); + + BurnYM2151Init(4000000); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.20, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.20, BURN_SND_ROUTE_RIGHT); + + K054539Init(0, 48000, DrvSndROM, 0x200000); + K054539SetRoute(0, BURN_SND_K054539_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + K054539SetRoute(0, BURN_SND_K054539_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + KonamiICExit(); + + SekExit(); + ZetExit(); + + BurnYM2151Exit(); + K054539Exit(); + + EEPROMExit(); + + BurnFree (AllMem); + + return 0; +} + +static void sortlayers(INT32 *layer,INT32 *pri) +{ +#define SWAP(a,b) \ + if (pri[a] < pri[b]) \ + { \ + INT32 t; \ + t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ + t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ + } + + SWAP(0,1) + SWAP(0,2) + SWAP(1,2) +} + +static inline void DrvRecalcPalette() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x1000 / 2; i++) { + INT32 d = BURN_ENDIAN_SWAP_INT16(p[i]); + + r = (d >> 0) & 0x1f; + g = (d >> 5) & 0x1f; + b = (d >> 10) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + Palette[i] = (r << 16) | (g << 8) | b; + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvRecalcPalette(); + } + + K052109UpdateScroll(); + + INT32 layer[3]; + + bg_colorbase = K053251GetPaletteIndex(4); + sprite_colorbase = K053251GetPaletteIndex(1); + layer_colorbase[0] = K053251GetPaletteIndex(3); + layer_colorbase[1] = K053251GetPaletteIndex(0); + layer_colorbase[2] = K053251GetPaletteIndex(2); + + layerpri[0] = K053251GetPriority(3); + layerpri[1] = K053251GetPriority(0); + layerpri[2] = K053251GetPriority(2); + layer[0] = 0; + layer[1] = 1; + layer[2] = 2; + + sortlayers(layer,layerpri); + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 16 * bg_colorbase+1; + } + + if (nSpriteEnable & 8) K053247SpritesRender(DrvGfxROMExp1, 3); + + if (nBurnLayer & 1) K052109RenderLayer(layer[0], 0, DrvGfxROMExp0); + + if (nBurnLayer & 2) K052109RenderLayer(layer[1], 0, DrvGfxROMExp0); + +if (nBurnLayer & 8) { + if (nSpriteEnable & 1) K053247SpritesRender(DrvGfxROMExp1, 0); + if (nSpriteEnable & 2) K053247SpritesRender(DrvGfxROMExp1, 1); + if (nSpriteEnable & 4) K053247SpritesRender(DrvGfxROMExp1, 2); +} + + if (nBurnLayer & 4) K052109RenderLayer(layer[2], 0, DrvGfxROMExp0); + + KonamiBlendCopy(Palette, DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3 * sizeof(INT16)); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // Clear Opposites + if ((DrvInputs[1] & 0x0c) == 0) DrvInputs[1] |= 0x0c; + if ((DrvInputs[1] & 0x03) == 0) DrvInputs[1] |= 0x03; + if ((DrvInputs[0] & 0x0c) == 0) DrvInputs[0] |= 0x0c; + if ((DrvInputs[0] & 0x03) == 0) DrvInputs[0] |= 0x03; + if ((DrvInputs[1] & 0xc00) == 0) DrvInputs[1] |= 0xc00; + if ((DrvInputs[1] & 0x300) == 0) DrvInputs[1] |= 0x300; + if ((DrvInputs[0] & 0xc00) == 0) DrvInputs[0] |= 0xc00; + if ((DrvInputs[0] & 0x300) == 0) DrvInputs[0] |= 0x300; + } + + INT32 nInterleave = nBurnSoundLen; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 16000000 / 60, 8000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext, nCyclesSegment; + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[0]; + nCyclesSegment = SekRun(nCyclesSegment); + nCyclesDone[0] += nCyclesSegment; + + if (i == (nInterleave / 2) && interrupt_enable) { + SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + } + + nNext = (i + 1) * nCyclesTotal[1] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[1]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[1] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + K054539Update(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (interrupt_enable) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + K054539Update(0, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029705; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + + K054539Scan(nAction); + + KonamiICScan(nAction); + EEPROMScan(nAction, pnMin); + + SCAN_VAR(interrupt_enable); + SCAN_VAR(init_eeprom_count); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + bankswitch(nDrvZ80Bank[0]); + ZetClose(); + } + + EEPROMScan(nAction, pnMin); + + return 0; +} + + +// X-Men (4 Players ver UBB) + +static struct BurnRomInfo xmenRomDesc[] = { + { "065-ubb04.10d", 0x020000, 0xf896c93b, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "065-ubb05.10f", 0x020000, 0xe02e5d64, 1 | BRF_PRG | BRF_ESS }, // 1 + { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles + { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 + + { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites + { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 + { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 + { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 + + { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples + + { "xmen_ubb.nv", 0x000080, 0x52f334ba, BRF_OPT }, +}; + +STD_ROM_PICK(xmen) +STD_ROM_FN(xmen) + +struct BurnDriver BurnDrvXmen = { + "xmen", NULL, NULL, NULL, "1992", + "X-Men (4 Players ver UBB)\0", NULL, "Konami", "GX065", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, xmenRomInfo, xmenRomName, NULL, NULL, XmenInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// X-Men (4 Players ver ADA) + +static struct BurnRomInfo xmenaRomDesc[] = { + { "065-ada.10d", 0x020000, 0xb8276624, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "065-ada.10f", 0x020000, 0xc68582ad, 1 | BRF_PRG | BRF_ESS }, // 1 + { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles + { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 + + { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites + { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 + { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 + { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 + + { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples + + { "xmen_ada.nv", 0x000080, 0xa77a3891, BRF_OPT }, +}; + +STD_ROM_PICK(xmena) +STD_ROM_FN(xmena) + +struct BurnDriver BurnDrvXmena = { + "xmena", "xmen", NULL, NULL, "1992", + "X-Men (4 Players ver ADA)\0", NULL, "Konami", "GX065", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, xmenaRomInfo, xmenaRomName, NULL, NULL, XmenInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// X-Men (4 Players ver EBA) + +static struct BurnRomInfo xmeneRomDesc[] = { + { "065-eba04.10d", 0x020000, 0x3588c5ec, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "065-eba05.10f", 0x020000, 0x79ce32f8, 1 | BRF_PRG | BRF_ESS }, // 1 + { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles + { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 + + { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites + { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 + { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 + { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 + + { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples + + { "xmen_eba.nv", 0x000080, 0x37f8e77a, BRF_OPT }, +}; + +STD_ROM_PICK(xmene) +STD_ROM_FN(xmene) + +struct BurnDriver BurnDrvXmene = { + "xmene", "xmen", NULL, NULL, "1992", + "X-Men (4 Players ver EBA)\0", NULL, "Konami", "GX065", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, xmeneRomInfo, xmeneRomName, NULL, NULL, XmenInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// X-Men (4 Players ver JBA) + +static struct BurnRomInfo xmenjRomDesc[] = { + { "065-jba04.10d", 0x020000, 0xd86cf5eb, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "065-jba05.10f", 0x020000, 0xabbc8126, 1 | BRF_PRG | BRF_ESS }, // 1 + { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles + { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 + + { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites + { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 + { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 + { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 + + { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples + + { "xmen_jba.nv", 0x000080, 0x7439cea7, BRF_OPT }, +}; + +STD_ROM_PICK(xmenj) +STD_ROM_FN(xmenj) + +struct BurnDriver BurnDrvXmenj = { + "xmenj", "xmen", NULL, NULL, "1992", + "X-Men (4 Players ver JBA)\0", NULL, "Konami", "GX065", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, xmenjRomInfo, xmenjRomName, NULL, NULL, XmenInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// X-Men (2 Players ver EAA) + +static struct BurnRomInfo xmen2peRomDesc[] = { + { "065-eaa04.10d", 0x020000, 0x502861e7, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "065-eaa05.10f", 0x020000, 0xca6071bf, 1 | BRF_PRG | BRF_ESS }, // 1 + { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles + { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 + + { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites + { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 + { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 + { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 + + { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples + + { "xmen_eaa.nv", 0x000080, 0x1cbcb653, BRF_OPT }, +}; + +STD_ROM_PICK(xmen2pe) +STD_ROM_FN(xmen2pe) + +struct BurnDriver BurnDrvXmen2pe = { + "xmen2pe", "xmen", NULL, NULL, "1992", + "X-Men (2 Players ver EAA)\0", NULL, "Konami", "GX065", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, xmen2peRomInfo, xmen2peRomName, NULL, NULL, Xmen2pInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// X-Men (2 Players ver AAA) + +static struct BurnRomInfo xmen2paRomDesc[] = { + { "065-aaa04.10d", 0x020000, 0x7f8b27c2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "065-aaa05.10f", 0x020000, 0x841ed636, 1 | BRF_PRG | BRF_ESS }, // 1 + { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles + { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 + + { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites + { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 + { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 + { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 + + { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples + + { "xmen_aaa.nv", 0x000080, 0x750fd447, BRF_OPT }, +}; + +STD_ROM_PICK(xmen2pa) +STD_ROM_FN(xmen2pa) + +struct BurnDriver BurnDrvXmen2pa = { + "xmen2pa", "xmen", NULL, NULL, "1992", + "X-Men (2 Players ver AAA)\0", NULL, "Konami", "GX065", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, xmen2paRomInfo, xmen2paRomName, NULL, NULL, Xmen2pInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// X-Men (2 Players ver JAA) + +static struct BurnRomInfo xmen2pjRomDesc[] = { + { "065-jaa04.10d", 0x020000, 0x66746339, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "065-jaa05.10f", 0x020000, 0x1215b706, 1 | BRF_PRG | BRF_ESS }, // 1 + { "065-a02.9d", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "065-a03.9f", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "065-a01.6f", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "065-a08.15l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles + { "065-a07.16l", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 + + { "065-a09.2h", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites + { "065-a10.2l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 + { "065-a12.1h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 + { "065-a11.1l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 + + { "065-a06.1f", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples + + { "xmen_jaa.nv", 0x000080, 0x849a9e19, BRF_OPT }, +}; + +STD_ROM_PICK(xmen2pj) +STD_ROM_FN(xmen2pj) + +struct BurnDriver BurnDrvXmen2pj = { + "xmen2pj", "xmen", NULL, NULL, "1992", + "X-Men (2 Players ver JAA)\0", NULL, "Konami", "GX065", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, xmen2pjRomInfo, xmen2pjRomName, NULL, NULL, Xmen2pInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// X-Men (6 Players ver ECB) + +static struct BurnRomInfo xmen6pRomDesc[] = { + { "065-ecb04.18g", 0x020000, 0x258eb21f, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "065-ecb05.18j", 0x020000, 0x25997bcd, 1 | BRF_PRG | BRF_ESS }, // 1 + { "065-a02.17g", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "065-a03.17j", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "065-a01.7b", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "065-a08.1l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles + { "065-a07.1h", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 + + { "065-a09.12l", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites + { "065-a10.17l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 + { "065-a12.22h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 + { "065-a11.22l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 + + { "065-a06.1d", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples + + { "xmen_ecb.nv", 0x000080, 0x462c6e1a, BRF_OPT }, +}; + +STD_ROM_PICK(xmen6p) +STD_ROM_FN(xmen6p) + +struct BurnDriverD BurnDrvXmen6p = { + "xmen6p", "xmen", NULL, NULL, "1992", + "X-Men (6 Players ver ECB)\0", NULL, "Konami", "GX065", + NULL, NULL, NULL, NULL, + BDF_CLONE, 6, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, xmen6pRomInfo, xmen6pRomName, NULL, NULL, XmenInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 256, 256, 4, 3 +}; + + +// X-Men (6 Players ver UCB) + +static struct BurnRomInfo xmen6puRomDesc[] = { + { "065-ucb04.18g", 0x020000, 0x0f09b8e0, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "065-ucb05.18j", 0x020000, 0x867becbf, 1 | BRF_PRG | BRF_ESS }, // 1 + { "065-a02.17g", 0x040000, 0xb31dc44c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "065-a03.17j", 0x040000, 0x13842fe6, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "065-a01.7b", 0x020000, 0x147d3a4d, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "065-a08.1l", 0x100000, 0x6b649aca, 3 | BRF_GRA }, // 5 Background Tiles + { "065-a07.1h", 0x100000, 0xc5dc8fc4, 3 | BRF_GRA }, // 6 + + { "065-a09.12l", 0x100000, 0xea05d52f, 4 | BRF_GRA }, // 7 Sprites + { "065-a10.17l", 0x100000, 0x96b91802, 4 | BRF_GRA }, // 8 + { "065-a12.22h", 0x100000, 0x321ed07a, 4 | BRF_GRA }, // 9 + { "065-a11.22l", 0x100000, 0x46da948e, 4 | BRF_GRA }, // 10 + + { "065-a06.1d", 0x200000, 0x5adbcee0, 5 | BRF_SND }, // 11 K054539 Samples + + { "xmen_ucb.nv", 0x000080, 0xf3d0f682, BRF_OPT }, +}; + +STD_ROM_PICK(xmen6pu) +STD_ROM_FN(xmen6pu) + +struct BurnDriverD BurnDrvXmen6pu = { + "xmen6pu", "xmen", NULL, NULL, "1992", + "X-Men (6 Players ver UCB)\0", NULL, "Konami", "GX065", + NULL, NULL, NULL, NULL, + BDF_CLONE, 6, HARDWARE_PREFIX_KONAMI, GBF_SCRFIGHT, 0, + NULL, xmen6puRomInfo, xmen6puRomName, NULL, NULL, XmenInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 256, 256, 4, 3 +}; diff --git a/src/burn/drv/megadrive/megadrive.cpp b/src/burn/drv/megadrive/megadrive.cpp index a61236a98..2d394b248 100644 --- a/src/burn/drv/megadrive/megadrive.cpp +++ b/src/burn/drv/megadrive/megadrive.cpp @@ -1,4230 +1,4229 @@ -/******************************************************************************** - SEGA Genesis / Mega Drive Driver for FBA - ******************************************************************************** - This is part of Pico Library v0936 - - (c) Copyright 2004 Dave, All rights reserved. - (c) Copyright 2006 notaz, All rights reserved. - Free for non-commercial use. - - For commercial use, separate licencing terms must be obtained. - ******************************************************************************** - - PicoOpt bits LSb->MSb: - enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound, - alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites, - draw_no_32col_border, external_ym2612 - - ******************************************************************************** - Port by OopsWare - ********************************************************************************/ - -#include "burnint.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2612.h" -#include "sn76496.h" -#include "megadrive.h" -#include "bitswap.h" -#include "m68000_debug.h" - -#define OSC_NTSC 53693175 -#define OSC_PAL 53203424 - -#define MAX_CARTRIDGE_SIZE 0xc00000 -#define MAX_SRAM_SIZE 0x010000 - -static INT32 cycles_68k, cycles_z80; - -typedef void (*MegadriveCb)(); -static MegadriveCb MegadriveCallback; - -struct PicoVideo { - UINT8 reg[0x20]; - UINT32 command; // 32-bit Command - UINT8 pending; // 1 if waiting for second half of 32-bit command - UINT8 type; // Command type (v/c/vsram read/write) - UINT16 addr; // Read/Write address - INT32 status; // Status bits - UINT8 pending_ints; // pending interrupts: ??VH???? - UINT8 pad[0x13]; // -}; - -struct PicoMisc { - UINT32 Z80Run; - UINT32 Bank68k; - UINT8 Rotate; - -// UINT8 Pad[3]; - -// UINT32 SRamReg; - UINT32 SRamStart; - UINT32 SRamEnd; - UINT32 SRamDetected; - UINT32 SRamActive; - UINT32 SRamHandlersInstalled; - UINT32 SRamReadOnly; - UINT32 SRamHasSerialEEPROM; - - UINT8 I2CMem; - UINT8 I2CClk; - - UINT16 JCartIOData[2]; - - UINT8 L3AltPDat; - UINT8 L3AltPCmd; - - UINT16 SquirrelkingExtra; - - UINT16 Lionk2ProtData; - UINT16 Lionk2ProtData2; - - UINT32 RealtecBankAddr; - UINT32 RealtecBankSize; -}; - -struct TileStrip -{ - INT32 nametab; // Position in VRAM of name table (for this tile line) - INT32 line; // Line number in pixels 0x000-0x3ff within the virtual tilemap - INT32 hscroll; // Horizontal scroll value in pixels for the line - INT32 xmask; // X-Mask (0x1f - 0x7f) for horizontal wraparound in the tilemap - INT32 *hc; // cache for high tile codes and their positions - INT32 cells; // cells (tiles) to draw (32 col mode doesn't need to update whole 320) -}; - -struct MegadriveJoyPad { - UINT16 pad[4]; - UINT8 padTHPhase[4]; - UINT8 padDelay[4]; -}; - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; - -static UINT8 *RomMain; -static UINT8 *OriginalRom; - -static UINT8 *Ram68K; -static UINT8 *RamZ80; - -static UINT8 *SRam; -static UINT8 *RamIO; - -static UINT16 *RamPal; -static UINT16 *RamVid; -static UINT16 *RamSVid; -static struct PicoVideo *RamVReg; -static struct PicoMisc *RamMisc; -static struct MegadriveJoyPad *JoyPad; - -UINT16 *MegadriveCurPal; - -static UINT16 *MegadriveBackupRam; - -static UINT8 *HighCol; -static UINT8 *HighColFull; - -static INT32 *HighCacheA; -static INT32 *HighCacheB; -static INT32 *HighCacheS; -static INT32 *HighPreSpr; -static INT8 *HighSprZ; - -UINT8 MegadriveReset = 0; -UINT8 bMegadriveRecalcPalette = 0; - -UINT8 MegadriveJoy1[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 MegadriveJoy2[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 MegadriveJoy3[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 MegadriveJoy4[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 MegadriveDIP[2] = {0, 0}; - -static UINT32 RomNum = 0; -static UINT32 RomSize = 0; -static UINT32 SRamSize = 0; - -static INT32 SpriteBlocks; - -static INT32 Scanline = 0; - -static INT32 Z80HasBus = 0; -static INT32 MegadriveZ80Reset = 0; -static INT32 RomNoByteswap; - -static UINT8 Hardware; -static UINT8 DrvSECAM = 0; // NTSC - -void MegadriveCheckHardware() -{ - Hardware = MegadriveDIP[0] & 0xe0; - if (MegadriveDIP[0] & 0x01) { - // Auto Detect Region and SECAM - UINT32 support = 0; - for (INT32 i = 0; i < 4; i++) { - UINT32 v = RomMain[0x1f0 + i]; - if (v <= 0x20) continue; - - switch (v) { - case 0x30: - case 0x31: - case 0x32: - case 0x33: - case 0x34: - case 0x35: - case 0x36: - case 0x37: - case 0x38: - case 0x39: { - support |= v - 0x30; - break; - } - - case 0x41: - case 0x42: - case 0x43: - case 0x44: - case 0x46: { - support |= v - 0x41; - break; - } - - case 0x45: { - // Japan - support |= 0x08; - break; - } - - case 0x4a: { - // Europe - support |= 0x01; - break; - } - - case 0x55: { - // USA - support |= 0x04; - break; - } - - case 0x61: - case 0x62: - case 0x63: - case 0x64: - case 0x65: - case 0x66: { - support |= v - 0x61; - break; - } - } - } - - bprintf(PRINT_IMPORTANT, _T("Autodetecting Cartridge (Hardware Code: %02x%02x%02x%02x):\n"), RomMain[0x1f0], RomMain[0x1f1], RomMain[0x1f2], RomMain[0x1f3]); - Hardware = 0x80; - - if (support & 0x02) { - Hardware = 0x40; // Japan PAL - bprintf(PRINT_IMPORTANT, _T("Japan PAL supported ???\n")); - } - - if (support & 0x01) { - Hardware = 0x00; // Japan NTSC - bprintf(PRINT_IMPORTANT, _T("Japan NTSC supported\n")); - } - - if (support & 0x08) { - Hardware = 0xc0; // Europe PAL - bprintf(PRINT_IMPORTANT, _T("Europe PAL supported\n")); - } - - if (support & 0x04) { - Hardware = 0x80; // USA NTSC - bprintf(PRINT_IMPORTANT, _T("USA NTSC supported\n")); - } - - if ((Hardware & 0xc0) == 0xc0) { - bprintf(PRINT_IMPORTANT, _T("Emulating Europe PAL Machine\n")); - } else { - if ((Hardware & 0x80) == 0x80) { - bprintf(PRINT_IMPORTANT, _T("Emulating USA NTSC Machine\n")); - } else { - if ((Hardware & 0x40) == 0x40) { - bprintf(PRINT_IMPORTANT, _T("Emulating Japan PAL Machine ???\n")); - } else { - if ((Hardware & 0x00) == 0x00) { - bprintf(PRINT_IMPORTANT, _T("Emulating Japan NTSC Machine\n")); - } - } - } - } - - // CD-ROM - Hardware |= MegadriveDIP[0] & 0x20; - } - - if ((Hardware & 0x20) != 0x20) bprintf(PRINT_IMPORTANT, _T("Emulating Mega-CD Add-on\n")); -} - -//----------------------------------------------------------------- - -inline static void CalcCol(INT32 index, UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour & 0x000f) << 4; // Red - g = (nColour & 0x00f0) << 0; // Green - b = (nColour & 0x0f00) >> 4; // Blue - - r |= r >> 4; - g |= g >> 4; - b |= b >> 4; - - RamPal[index] = nColour; - - // Normal Color - MegadriveCurPal[index + 0x00] = BurnHighCol(r, g, b, 0); - - // Shadow Color - MegadriveCurPal[index + 0x40] = MegadriveCurPal[index + 0xc0] = BurnHighCol(r>>1, g>>1, b>>1, 0); - - // Highlight Color - r += 0x80; if (r > 0xFF) r = 0xFF; - g += 0x80; if (g > 0xFF) g = 0xFF; - b += 0x80; if (b > 0xFF) b = 0xFF; - MegadriveCurPal[index + 0x80] = BurnHighCol(r, g, b, 0); -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - RomMain = Next; Next += MAX_CARTRIDGE_SIZE; // 68000 ROM, Max enough - - RamStart = Next; - - Ram68K = Next; Next += 0x010000; - RamZ80 = Next; Next += 0x002000; - SRam = Next; Next += MAX_SRAM_SIZE; // SRam - RamIO = Next; Next += 0x000010; // I/O - - RamPal = (UINT16 *) Next; Next += 0x000040 * sizeof(UINT16); - RamSVid = (UINT16 *) Next; Next += 0x000040 * sizeof(UINT16); // VSRam - RamVid = (UINT16 *) Next; Next += 0x008000 * sizeof(UINT16); // Video Ram - - RamVReg = (struct PicoVideo *)Next; Next += sizeof(struct PicoVideo); - RamMisc = (struct PicoMisc *)Next; Next += sizeof(struct PicoMisc); - - RamEnd = Next; - - MegadriveCurPal = (UINT16 *) Next; Next += 0x000040 * sizeof(UINT16) * 4; - - HighColFull = Next; Next += (8 + 320 + 8) * 240; - - HighCacheA = (INT32 *) Next; Next += (41+1) * sizeof(INT32); // caches for high layers - HighCacheB = (INT32 *) Next; Next += (41+1) * sizeof(INT32); - HighCacheS = (INT32 *) Next; Next += (80+1) * sizeof(INT32); // and sprites - HighPreSpr = (INT32 *) Next; Next += (80*2+1) * sizeof(INT32); // slightly preprocessed sprites - HighSprZ = (INT8*) Next; Next += (320+8+8); // Z-buffer for accurate sprites and shadow/hilight mode - - JoyPad = (struct MegadriveJoyPad *) Next; Next += sizeof(struct MegadriveJoyPad); - - MemEnd = Next; - return 0; -} - -UINT16 __fastcall MegadriveReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xa11100: { - UINT16 retVal = rand() & 0xffff; - if (Z80HasBus || MegadriveZ80Reset) { - retVal |= 0x100; - } else { - retVal &= 0xfeff; - } - return retVal; - } - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); - } - } - return 0; -} - -UINT8 __fastcall MegadriveReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xa04000: - case 0xa04001: - case 0xa04002: - case 0xa04003: { - if (!Z80HasBus && !MegadriveZ80Reset) { - return BurnYM2612Read(0, 0); - } else { - return 0; - } - } - - case 0xa11100: { - UINT8 retVal = rand() & 0xff; - if (Z80HasBus || MegadriveZ80Reset) { - retVal |= 0x01; - } else { - retVal &= 0xfe; - } - return retVal; - } - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); - } - } - return 0; -} - -void __fastcall MegadriveWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if(sekAddress >= 0xA13004 && sekAddress < 0xA13040) { - // dumb 12-in-1 or 4-in-1 banking support - sekAddress &= 0x3f; - sekAddress <<= 16; - INT32 len = RomSize - sekAddress; - if (len <= 0) return; // invalid/missing bank - if (len > 0x200000) len = 0x200000; // 2 megs - // code which does this is in RAM so this is safe. - memcpy(RomMain, RomMain + sekAddress, len); - return; - } - - switch (sekAddress) { - case 0xa04000: { - if (!Z80HasBus && !MegadriveZ80Reset) { - BurnYM2612Write(0, 0, byteValue); - } - return; - } - - case 0xa04001: { - if (!Z80HasBus && !MegadriveZ80Reset) { - BurnYM2612Write(0, 1, byteValue); - } - return; - } - - case 0xa04002: { - if (!Z80HasBus && !MegadriveZ80Reset) { - BurnYM2612Write(0, 2, byteValue); - } - return; - } - - case 0xa04003: { - if (!Z80HasBus && !MegadriveZ80Reset) { - BurnYM2612Write(0, 3, byteValue); - } - return; - } - - case 0xA11100: { - if (byteValue & 1) { - RamMisc->Z80Run = 0; - Z80HasBus = 0; - } else { - RamMisc->Z80Run = 1; - Z80HasBus = 1; - } - return; - } - - case 0xA11200: { - if (!(byteValue & 1)) { - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2612Reset(); - MegadriveZ80Reset = 1; - } else { - MegadriveZ80Reset = 0; - } - return; - } - -// case 0xA130F1: { - // sram access register -// RamMisc->SRamReg = byteValue & 0x03; -// return; -// } - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); - } - } -} - -void __fastcall MegadriveWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - case 0xa11100: { - if (wordValue & 0x100) { - RamMisc->Z80Run = 0; - Z80HasBus = 0; - } else { - RamMisc->Z80Run = 1; - Z80HasBus = 1; - } - return; - } - - case 0xa11200: { - if (!(wordValue & 0x100)) { - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2612Reset(); - MegadriveZ80Reset = 1; - } else { - MegadriveZ80Reset = 0; - } - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); - } - } -} - -//--------------------------------------------------------------- -// Megadrive Video Port Read Write -//--------------------------------------------------------------- - -static INT32 rendstatus = 0; - -// calculate the number of cycles 68k->VDP dma operation would take -static INT32 DmaSlowBurn(INT32 len) -{ - // test: Legend of Galahad, Time Killers - INT32 burn,maxlen,line=Scanline; - //if(line == -1) line=vcounts[SekCyclesDone()>>8]; - maxlen = (224-line) * 18; - if(len <= maxlen) - burn = len*(((cycles_68k<<8)/18))>>8; - else { - burn = maxlen*(((cycles_68k<<8)/18))>>8; - burn += (len-maxlen)*(((cycles_68k<<8)/180))>>8; - } - return burn; -} - -static INT32 GetDmaLength() -{ - INT32 len = 0; - // 16-bit words to transfer: - len = RamVReg->reg[0x13]; - len |= RamVReg->reg[0x14]<<8; - // Charles MacDonald: - if(!len) len = 0xffff; - return len; -} - -static void DmaSlow(INT32 len) -{ - UINT16 *pd=0, *pdend, *r; - UINT32 a = RamVReg->addr, a2, d; - UINT8 inc = RamVReg->reg[0xf]; - UINT32 source, burn; - - source = RamVReg->reg[0x15] << 1; - source |= RamVReg->reg[0x16] << 9; - source |= RamVReg->reg[0x17] << 17; - - //dprintf("DmaSlow[%i] %06x->%04x len %i inc=%i blank %i [%i|%i]", Pico.video.type, source, a, len, inc, - // (Pico.video.status&8)||!(Pico.video.reg[1]&0x40), Pico.m.scanline, SekCyclesDone()); - - if ((source & 0xe00000) == 0xe00000) { // RAM - pd = (UINT16 *)(Ram68K + (source & 0xfffe)); - pdend = (UINT16 *)(Ram68K + 0x10000); - } else if( source < RomSize) { // ROM - pd = (UINT16 *)(RomMain + (source & ~1)); - pdend = (UINT16 *)(RomMain + RomSize); - } else return; // Invalid source address - - // CPU is stopped during DMA, so we burn some cycles to compensate that - if((RamVReg->status & 8) || !(RamVReg->reg[1] & 0x40)) { // vblank? - burn = (len*(((cycles_68k<<8)/167))>>8); // very approximate - if(!(RamVReg->status & 8)) burn += burn>>1; // a hack for Legend of Galahad - } else burn = DmaSlowBurn(len); - - //SekCyclesBurn(burn); - SekRunAdjust( 0 - burn ); - - if(!(RamVReg->status & 8)) - SekRunEnd(); - //dprintf("DmaSlow burn: %i @ %06x", burn, SekPc); - - switch ( RamVReg->type ) { - case 1: // vram - r = RamVid; - for(; len; len--) { - d = *pd++; - if(a&1) d=(d<<8)|(d>>8); - r[a>>1] = (UINT16)d; // will drop the upper bits - // AutoIncrement - a = (UINT16)(a+inc); - // didn't src overlap? - if(pd >= pdend) pd -= 0x8000; // should be good for RAM, bad for ROM - } - rendstatus |= 0x10; - break; - - case 3: // cram - //dprintf("DmaSlow[%i] %06x->%04x len %i inc=%i blank %i [%i|%i]", Pico.video.type, source, a, len, inc, - // (Pico.video.status&8)||!(Pico.video.reg[1]&0x40), Pico.m.scanline, SekCyclesDone()); - for(a2 = a&0x7f; len; len--) { - CalcCol( a2>>1, BURN_ENDIAN_SWAP_INT16(*pd) ); - pd++; - // AutoIncrement - a2+=inc; - // didn't src overlap? - if(pd >= pdend) pd-=0x8000; - // good dest? - if(a2 >= 0x80) break; // Todds Adventures in Slime World / Andre Agassi tennis - } - a = (a&0xff00) | a2; - break; - - case 5: // vsram[a&0x003f]=d; - r = RamSVid; - for(a2=a&0x7f; len; len--) { - r[a2>>1] = (UINT16)*pd++; - // AutoIncrement - a2+=inc; - // didn't src overlap? - if(pd >= pdend) pd-=0x8000; - // good dest? - if(a2 >= 0x80) break; - } - a=(a&0xff00)|a2; - break; - } - // remember addr - RamVReg->addr = (UINT16)a; -} - -static void DmaCopy(INT32 len) -{ - UINT8 * vr = (UINT8 *) RamVid; - UINT8 * vrs; - //UINT16 a = Pico.video.addr; - //UINT8 inc = RamVReg->reg[0xf]; - INT32 source; - - //dprintf("DmaCopy len %i [%i|%i]", len, Pico.m.scanline, SekCyclesDone()); - - source = RamVReg->reg[0x15]; - source |= RamVReg->reg[0x16]<<8; - vrs = vr + source; - - if (source+len > 0x10000) - len = 0x10000 - source; // clip?? - - for(;len;len--) { - vr[RamVReg->addr] = *vrs++; - // AutoIncrement - //a = (u16)(a + inc); - RamVReg->addr += RamVReg->reg[0xf]; - } - rendstatus |= 0x10; -} - -static void DmaFill(INT32 data) -{ - INT32 len = GetDmaLength(); - UINT8 *vr = (UINT8 *) RamVid; - UINT8 high = (UINT8) (data >> 8); - UINT16 a = RamVReg->addr; - UINT8 inc = RamVReg->reg[0xf]; - - //dprintf("DmaFill len %i inc %i [%i|%i]", len, inc, Pico.m.scanline, SekCyclesDone()); - - // from Charles MacDonald's genvdp.txt: - // Write lower byte to address specified - vr[a] = (UINT8) data; - a = (UINT16)(a+inc); - - if(!inc) len=1; - - for(;len;len--) { - // Write upper byte to adjacent address - // (here we are byteswapped, so address is already 'adjacent') - vr[a] = high; - // Increment address register - a = (UINT16)(a+inc); - } - // remember addr - RamVReg->addr = a; - // update length - RamVReg->reg[0x13] = RamVReg->reg[0x14] = 0; // Dino Dini's Soccer (E) (by Haze) - - rendstatus |= 0x10; -} - -static void CommandChange() -{ - //struct PicoVideo *pvid=&Pico.video; - UINT32 cmd = RamVReg->command; - UINT32 addr = 0; - - // Get type of transfer 0xc0000030 (v/c/vsram read/write) - RamVReg->type = (UINT8)(((cmd >> 2) & 0xc) | (cmd >> 30)); - - // Get address 0x3fff0003 - addr = (cmd >> 16) & 0x3fff; - addr |= (cmd << 14) & 0xc000; - RamVReg->addr = (UINT16)addr; - //dprintf("addr set: %04x", addr); - - // Check for dma: - if (cmd & 0x80) { - // Command DMA - if ((RamVReg->reg[1] & 0x10) == 0) return; // DMA not enabled - INT32 len = GetDmaLength(); - switch ( RamVReg->reg[0x17]>>6 ) { - case 0x00: - case 0x01: - DmaSlow(len); // 68000 to VDP - break; - case 0x03: - DmaCopy(len); // VRAM Copy - break; - case 0x02: // DMA Fill Flag ??? - default: - ;//bprintf(PRINT_NORMAL, _T("Video Command DMA Unknown %02x len %d\n"), RamVReg->reg[0x17]>>6, len); - } - } -} - -// H-counter table for hvcounter reads in 40col mode -// based on Gens code -const UINT8 hcounts_40[] = { - 0x07,0x07,0x08,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d, - 0x0e,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x13,0x14, - 0x14,0x15,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x18,0x19,0x19,0x1a,0x1a,0x1b, - 0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x21,0x21, - 0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x27,0x27,0x28,0x28, - 0x28,0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2f, - 0x2f,0x30,0x30,0x30,0x31,0x31,0x32,0x32,0x32,0x33,0x33,0x34,0x34,0x35,0x35,0x35, - 0x36,0x36,0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3b,0x3c,0x3c, - 0x3d,0x3d,0x3d,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x41,0x41,0x42,0x42,0x42,0x43, - 0x43,0x44,0x44,0x45,0x45,0x45,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x49,0x49,0x4a, - 0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x4f,0x50,0x50, - 0x51,0x51,0x52,0x52,0x52,0x53,0x53,0x54,0x54,0x55,0x55,0x55,0x56,0x56,0x57,0x57, - 0x57,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e, - 0x5e,0x5f,0x5f,0x5f,0x60,0x60,0x61,0x61,0x62,0x62,0x62,0x63,0x63,0x64,0x64,0x64, - 0x65,0x65,0x66,0x66,0x67,0x67,0x67,0x68,0x68,0x69,0x69,0x6a,0x6a,0x6a,0x6b,0x6b, - 0x6c,0x6c,0x6c,0x6d,0x6d,0x6e,0x6e,0x6f,0x6f,0x6f,0x70,0x70,0x71,0x71,0x71,0x72, - 0x72,0x73,0x73,0x74,0x74,0x74,0x75,0x75,0x76,0x76,0x77,0x77,0x77,0x78,0x78,0x79, - 0x79,0x79,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c,0x7c,0x7d,0x7d,0x7e,0x7e,0x7f,0x7f,0x7f, - 0x80,0x80,0x81,0x81,0x81,0x82,0x82,0x83,0x83,0x84,0x84,0x84,0x85,0x85,0x86,0x86, - 0x86,0x87,0x87,0x88,0x88,0x89,0x89,0x89,0x8a,0x8a,0x8b,0x8b,0x8c,0x8c,0x8c,0x8d, - 0x8d,0x8e,0x8e,0x8e,0x8f,0x8f,0x90,0x90,0x91,0x91,0x91,0x92,0x92,0x93,0x93,0x94, - 0x94,0x94,0x95,0x95,0x96,0x96,0x96,0x97,0x97,0x98,0x98,0x99,0x99,0x99,0x9a,0x9a, - 0x9b,0x9b,0x9b,0x9c,0x9c,0x9d,0x9d,0x9e,0x9e,0x9e,0x9f,0x9f,0xa0,0xa0,0xa1,0xa1, - 0xa1,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,0xa8, - 0xa8,0xa9,0xa9,0xa9,0xaa,0xaa,0xab,0xab,0xab,0xac,0xac,0xad,0xad,0xae,0xae,0xae, - 0xaf,0xaf,0xb0,0xb0,0xe4,0xe4,0xe4,0xe5,0xe5,0xe6,0xe6,0xe6,0xe7,0xe7,0xe8,0xe8, - 0xe9,0xe9,0xe9,0xea,0xea,0xeb,0xeb,0xeb,0xec,0xec,0xed,0xed,0xee,0xee,0xee,0xef, - 0xef,0xf0,0xf0,0xf1,0xf1,0xf1,0xf2,0xf2,0xf3,0xf3,0xf3,0xf4,0xf4,0xf5,0xf5,0xf6, - 0xf6,0xf6,0xf7,0xf7,0xf8,0xf8,0xf9,0xf9,0xf9,0xfa,0xfa,0xfb,0xfb,0xfb,0xfc,0xfc, - 0xfd,0xfd,0xfe,0xfe,0xfe,0xff,0xff,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03, - 0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x06,0x07,0x07,0x08,0x08,0x08,0x09,0x09,0x0a, - 0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x10, -}; - -// H-counter table for hvcounter reads in 32col mode -const UINT8 hcounts_32[] = { - 0x05,0x05,0x05,0x06,0x06,0x07,0x07,0x07,0x08,0x08,0x08,0x09,0x09,0x09,0x0a,0x0a, - 0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x0f,0x10, - 0x10,0x10,0x11,0x11,0x11,0x12,0x12,0x12,0x13,0x13,0x13,0x14,0x14,0x14,0x15,0x15, - 0x15,0x16,0x16,0x17,0x17,0x17,0x18,0x18,0x18,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b, - 0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20, - 0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x26,0x26, - 0x26,0x27,0x27,0x27,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b, - 0x2c,0x2c,0x2c,0x2d,0x2d,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x31,0x31, - 0x31,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x37, - 0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3c,0x3c, - 0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x41,0x41,0x41,0x42, - 0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x45,0x45,0x45,0x46,0x46,0x46,0x47,0x47,0x47, - 0x48,0x48,0x48,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4d,0x4d, - 0x4d,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x51,0x51,0x51,0x52,0x52,0x52, - 0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x55,0x56,0x56,0x56,0x57,0x57,0x57,0x58,0x58, - 0x58,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e, - 0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x61,0x61,0x61,0x62,0x62,0x62,0x63,0x63, - 0x64,0x64,0x64,0x65,0x65,0x65,0x66,0x66,0x66,0x67,0x67,0x67,0x68,0x68,0x68,0x69, - 0x69,0x69,0x6a,0x6a,0x6a,0x6b,0x6b,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e, - 0x6f,0x6f,0x6f,0x70,0x70,0x70,0x71,0x71,0x71,0x72,0x72,0x72,0x73,0x73,0x74,0x74, - 0x74,0x75,0x75,0x75,0x76,0x76,0x76,0x77,0x77,0x77,0x78,0x78,0x78,0x79,0x79,0x79, - 0x7a,0x7a,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f, - 0x7f,0x80,0x80,0x80,0x81,0x81,0x81,0x82,0x82,0x83,0x83,0x83,0x84,0x84,0x84,0x85, - 0x85,0x85,0x86,0x86,0x86,0x87,0x87,0x87,0x88,0x88,0x88,0x89,0x89,0x89,0x8a,0x8a, - 0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8f,0x8f,0x8f,0x90, - 0x90,0x90,0x91,0x91,0xe8,0xe8,0xe8,0xe9,0xe9,0xe9,0xea,0xea,0xea,0xeb,0xeb,0xeb, - 0xec,0xec,0xec,0xed,0xed,0xed,0xee,0xee,0xee,0xef,0xef,0xf0,0xf0,0xf0,0xf1,0xf1, - 0xf1,0xf2,0xf2,0xf2,0xf3,0xf3,0xf3,0xf4,0xf4,0xf4,0xf5,0xf5,0xf5,0xf6,0xf6,0xf6, - 0xf7,0xf7,0xf8,0xf8,0xf8,0xf9,0xf9,0xf9,0xfa,0xfa,0xfa,0xfb,0xfb,0xfb,0xfc,0xfc, - 0xfc,0xfd,0xfd,0xfd,0xfe,0xfe,0xfe,0xff,0xff,0x00,0x00,0x00,0x01,0x01,0x01,0x02, - 0x02,0x02,0x03,0x03,0x03,0x04,0x04,0x04,0x05,0x05,0x05,0x06,0x06,0x07,0x07,0x07, - 0x08,0x08,0x08,0x09,0x09,0x09,0x0a,0x0a,0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d, -}; - -UINT16 __fastcall MegadriveVideoReadWord(UINT32 sekAddress) -{ - //bprintf(PRINT_NORMAL, _T("Video Attempt to read word value of location %x\n"), sekAddress); - //return MegadriveVDPRead((sekAddress - 0xc00000) >> 1); - - if (sekAddress > 0xC0001F) - bprintf(PRINT_NORMAL, _T("Video Attempt to read word value of location %x\n"), sekAddress); - - UINT16 res = 0; - - switch (sekAddress & 0x1c) { - case 0x00: // data - switch (RamVReg->type) { - case 0: res = BURN_ENDIAN_SWAP_INT16(RamVid [(RamVReg->addr >> 1) & 0x7fff]); break; - case 4: res = BURN_ENDIAN_SWAP_INT16(RamSVid[(RamVReg->addr >> 1) & 0x003f]); break; - case 8: res = BURN_ENDIAN_SWAP_INT16(RamPal [(RamVReg->addr >> 1) & 0x003f]); break; - } - RamVReg->addr += RamVReg->reg[0xf]; - break; - - case 0x04: // command - res = RamVReg->status; - //if(PicoOpt&0x10) d|=0x0020; // sprite collision (Shadow of the Beast) - if(RamMisc->Rotate++&8) res |= 0x0100; else res |= 0x0200; // Toggle fifo full empty (who uses that stuff?) - if(!(RamVReg->reg[1] & 0x40)) res |= 0x0008; // set V-Blank if display is disabled - if(m68k_ICount < 84+4) res |= 0x0004; // H-Blank (Sonic3 vs) - RamVReg->pending = 0; // ctrl port reads clear write-pending flag (Charles MacDonald) - break; - - case 0x08: // H-counter info - { - UINT32 hc = 50; - - INT32 lineCycles = (cycles_68k - m68k_ICount) & 0x1ff; - res = Scanline; // V-Counter - - if(RamVReg->reg[12]&1) - hc = hcounts_40[lineCycles]; - else hc = hcounts_32[lineCycles]; - - if(lineCycles > cycles_68k-12) res++; // Wheel of Fortune - - if( Hardware & 0x40 ) { - if(res >= 0x103) res -= 56; // based on Gens - } else { - if(res >= 0x0EB) res -= 6; - } - - if((RamVReg->reg[12]&6) == 6) { - // interlace mode 2 (Combat Cars (UE) [!]) - res <<= 1; - if (res & 0xf00) res |= 1; - } - - //dprintf("hv: %02x %02x (%i) @ %06x", hc, d, SekCyclesDone(), SekPc); - res &= 0xff; - res <<= 8; - res |= hc; - } - break; - - default: - bprintf(PRINT_NORMAL, _T("Video Attempt to read word value of location %x, %x\n"), sekAddress, sekAddress & 0x1c); - break; - } - - return res; -} - -UINT8 __fastcall MegadriveVideoReadByte(UINT32 sekAddress) -{ - //bprintf(PRINT_NORMAL, _T("Video Attempt to read byte value of location %x\n"), sekAddress); - UINT16 res = MegadriveVideoReadWord(sekAddress & ~1); - if ((sekAddress&1)==0) res >>= 8; - return res & 0xff; -} - -void __fastcall MegadriveVideoWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - if (sekAddress > 0xC0001F) - bprintf(PRINT_NORMAL, _T("Video Attempt to write word value %x to location %x\n"), wordValue, sekAddress); - - switch (sekAddress & 0x1c) { - case 0x00: // data - if (RamVReg->pending) - CommandChange(); - RamVReg->pending = 0; - if ((RamVReg->command & 0x80) && (RamVReg->reg[1]&0x10) && (RamVReg->reg[0x17]>>6)==2) { - - DmaFill(wordValue); - - } else { - //UINT32 a=Pico.video.addr; - switch (RamVReg->type) { - case 1: - // If address is odd, bytes are swapped (which game needs this?) - if (RamVReg->addr & 1) { - bprintf(PRINT_NORMAL, _T("Video address is odd, bytes are swapped!!!\n")); - wordValue = (wordValue<<8)|(wordValue>>8); - } - RamVid[(RamVReg->addr >> 1) & 0x7fff] = BURN_ENDIAN_SWAP_INT16(wordValue); - rendstatus |= 0x10; - break; - case 3: - //Pico.m.dirtyPal = 1; - //dprintf("w[%i] @ %04x, inc=%i [%i|%i]", Pico.video.type, a, Pico.video.reg[0xf], Pico.m.scanline, SekCyclesDone()); - CalcCol((RamVReg->addr >> 1) & 0x003f, wordValue); - break; - case 5: - RamSVid[(RamVReg->addr >> 1) & 0x003f] = BURN_ENDIAN_SWAP_INT16(wordValue); - break; - } - //dprintf("w[%i] @ %04x, inc=%i [%i|%i]", Pico.video.type, a, Pico.video.reg[0xf], Pico.m.scanline, SekCyclesDone()); - //AutoIncrement(); - RamVReg->addr += RamVReg->reg[0xf]; - } - return; - - case 0x04: // command - if(RamVReg->pending) { - // Low word of command: - RamVReg->command &= 0xffff0000; - RamVReg->command |= wordValue; - RamVReg->pending = 0; - CommandChange(); - } else { - if((wordValue & 0xc000) == 0x8000) { - INT32 num = (wordValue >> 8) & 0x1f; - RamVReg->reg[num] = wordValue & 0xff; - - // update IRQ level (Lemmings, Wiz 'n' Liz intro, ... ) - // may break if done improperly: - // International Superstar Soccer Deluxe (crash), Street Racer (logos), Burning Force (gfx), Fatal Rewind (hang), Sesame Street Counting Cafe - if(num < 2) { - - INT32 lines = (RamVReg->reg[1] & 0x20) | (RamVReg->reg[0] & 0x10); - INT32 pints = (RamVReg->pending_ints & lines); - if(pints & 0x20) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - else if(pints & 0x10) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - else SekSetIRQLine(0, SEK_IRQSTATUS_NONE); - - } - - if (num == 5) rendstatus |= 1; -// else if(num == 0xc) Pico.m.dirtyPal = 2; // renderers should update their palettes if sh/hi mode is changed - RamVReg->type = 0; // register writes clear command (else no Sega logo in Golden Axe II) - } else { - // High word of command: - RamVReg->command &= 0x0000ffff; - RamVReg->command |= wordValue << 16; - RamVReg->pending = 1; - } - } - return; - - case 0x10: - case 0x14: - // PSG Sound - //bprintf(PRINT_NORMAL, _T("PSG Attempt to write word value %04x to location %08x\n"), wordValue, sekAddress); - SN76496Write(0, wordValue & 0xFF); - return; - - } -} - -void __fastcall MegadriveVideoWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - //bprintf(PRINT_NORMAL, _T("Video Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); - MegadriveVideoWriteWord(sekAddress, (byteValue << 8) | byteValue); -} - -// -- Z80 Ram Read Write ------------------------------------------ - -UINT8 __fastcall MegadriveZ80RamReadByte(UINT32 sekAddress) -{ - if (!Z80HasBus && !MegadriveZ80Reset) { - return RamZ80[sekAddress & 0x1fff]; - } - - return 0; -} - -UINT16 __fastcall MegadriveZ80RamReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Z80Ram Attempt to read word value of location %x\n"), sekAddress); - return 0; -} - -void __fastcall MegadriveZ80RamWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if (!Z80HasBus && !MegadriveZ80Reset) { - RamZ80[sekAddress & 0x1fff] = byteValue; - return; - } - bprintf(PRINT_NORMAL, _T("Z80Ram Attempt to write byte value %x to location %x and didn't have the Bus!\n"), byteValue, sekAddress); -} - -void __fastcall MegadriveZ80RamWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - if (!Z80HasBus && !MegadriveZ80Reset) { - RamZ80[sekAddress & 0x1fff] = wordValue >> 8; - return; - } - - bprintf(PRINT_NORMAL, _T("Z80Ram Attempt to write word value %x to location %x and didn't have the Bus!\n"), wordValue, sekAddress); -// MegadriveZ80RamWriteByte(sekAddress, wordValue >> 0x08); -} - -// -- I/O Read Write ------------------------------------------ - -static INT32 PadRead(INT32 i) -{ - INT32 pad=0,value=0,TH; - pad = ~(JoyPad->pad[i]); // Get inverse of pad MXYZ SACB RLDU - TH = RamIO[i+1] & 0x40; - - /*if(PicoOpt & 0x20)*/ { // 6 button gamepad enabled - INT32 phase = JoyPad->padTHPhase[i]; - - if(phase == 2 && !TH) { - value = (pad&0xc0)>>2; // ?0SA 0000 - goto end; - } else if(phase == 3 && TH) { - value=(pad&0x30)|((pad>>8)&0xf); // ?1CB MXYZ - goto end; - } else if(phase == 3 && !TH) { - value=((pad&0xc0)>>2)|0x0f; // ?0SA 1111 - goto end; - } - } - - if(TH) value=(pad&0x3f); // ?1CB RLDU - else value=((pad&0xc0)>>2)|(pad&3); // ?0SA 00DU - -end: - - // orr the bits, which are set as output - value |= RamIO[i+1] & RamIO[i+4]; - - return value; // will mirror later -} - -UINT8 __fastcall MegadriveIOReadByte(UINT32 sekAddress) -{ - if (sekAddress > 0xA1001F) - bprintf(PRINT_NORMAL, _T("IO Attempt to read byte value of location %x\n"), sekAddress); - - INT32 offset = (sekAddress >> 1) & 0xf; - switch (offset) { - case 0: // Get Hardware - return Hardware; - case 1: // Pad 1 - return (RamIO[1] & 0x80) | PadRead(0); - case 2: // Pad 2 - return (RamIO[2] & 0x80) | PadRead(1); - default: - //bprintf(PRINT_NORMAL, _T("IO Attempt to read byte value of location %x\n"), sekAddress); - return RamIO[offset]; - } - return 0; -} - -UINT16 __fastcall MegadriveIOReadWord(UINT32 sekAddress) -{ - //if (sekAddress > 0xA1001F) - // bprintf(PRINT_NORMAL, _T("IO Attempt to read word value of location %x\n"), sekAddress); - - UINT8 res = MegadriveIOReadByte(sekAddress); - return res | (res << 8); -} - -void __fastcall MegadriveIOWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if (sekAddress > 0xA1001F) - bprintf(PRINT_NORMAL, _T("IO Attempt to byte byte value %x to location %x\n"), byteValue, sekAddress); - - INT32 offset = (sekAddress >> 1) & 0xf; - // 6-Button Support - switch( offset ) { - case 1: - JoyPad->padDelay[0] = 0; - if(!(RamIO[1] & 0x40) && (byteValue&0x40)) - JoyPad->padTHPhase[0] ++; - break; - case 2: - JoyPad->padDelay[1] = 0; - if(!(RamIO[2] & 0x40) && (byteValue&0x40)) - JoyPad->padTHPhase[1] ++; - break; - } - RamIO[offset] = byteValue; -} - -void __fastcall MegadriveIOWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - //if (sekAddress > 0xA1001F) - // bprintf(PRINT_NORMAL, _T("IO Attempt to write word value %x to location %x\n"), wordValue, sekAddress); - - MegadriveIOWriteByte(sekAddress, wordValue & 0xff); -} - -// -- YM2612/YM2612 FM Chip ---------------------------------------------------------- - -inline static INT32 MegadriveSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)SekTotalCycles() * nSoundRate / (OSC_NTSC / 7); -} - -inline static double MegadriveGetTime() -{ - return (double)SekTotalCycles() / (OSC_NTSC / 7); -} - -inline static INT32 MegadriveSynchroniseStreamPAL(INT32 nSoundRate) -{ - return (INT64)SekTotalCycles() * nSoundRate / (OSC_PAL / 7); -} - -inline static double MegadriveGetTimePAL() -{ - return (double)SekTotalCycles() / (OSC_PAL / 7); -} - -// --------------------------------------------------------------- - -static INT32 MegadriveResetDo() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2612Reset(); - - MegadriveZ80Reset = 1; - Z80HasBus = 1; - -#if 0 - FILE * f = fopen("Megadrive.bin", "wb+"); - fwrite(RomMain, 1, 0x200000, f); - fclose(f); -#endif - - MegadriveCheckHardware(); - - if (Hardware & 0x40) { - BurnSetRefreshRate(50.0); - Reinitialise(); - - BurnYM2612Exit(); - BurnYM2612Init(1, OSC_PAL / 7, NULL, MegadriveSynchroniseStreamPAL, MegadriveGetTimePAL, 0); - BurnTimerAttachSek(OSC_PAL / 7); - BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - - BurnYM2612Reset(); - - SN76496Exit(); - SN76496Init(0, OSC_PAL / 15, 1); - SN76496SetRoute(0, 0.25, BURN_SND_ROUTE_BOTH); - } else { - BurnSetRefreshRate(60.0); - Reinitialise(); - - BurnYM2612Exit(); - BurnYM2612Init(1, OSC_NTSC / 7, NULL, MegadriveSynchroniseStream, MegadriveGetTime, 0); - BurnTimerAttachSek(OSC_NTSC / 7); - BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - - BurnYM2612Reset(); - - SN76496Exit(); - SN76496Init(0, OSC_NTSC / 15, 1); - SN76496SetRoute(0, 0.25, BURN_SND_ROUTE_BOTH); - } - - // other reset -// memset(RamMisc, 0, sizeof(struct PicoMisc)); - memset(JoyPad, 0, sizeof(struct MegadriveJoyPad)); - - // default VDP register values (based on Fusion) - memset(RamVReg, 0, sizeof(struct PicoVideo)); - RamVReg->reg[0x00] = 0x04; - RamVReg->reg[0x01] = 0x04; - RamVReg->reg[0x0c] = 0x81; - RamVReg->reg[0x0f] = 0x02; - - RamVReg->status = 0x3408 | ((MegadriveDIP[0] & 0x40) >> 6); - - return 0; -} - -INT32 __fastcall MegadriveIrqCallback(INT32 irq) -{ - switch ( irq ) { - case 4: RamVReg->pending_ints = 0x00; break; - case 6: RamVReg->pending_ints &= ~0x20; break; - } - return -1; -} - -// ---------------------------------------------------------------- -// Z80 Read/Write -// ---------------------------------------------------------------- - -UINT8 __fastcall MegadriveZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Read %02x\n"), a); - } - } - - return 0; -} - -void __fastcall MegadriveZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write %02x, %02%x\n"), a, d); - } - } -} - -UINT8 __fastcall MegadriveZ80ProgRead(UINT16 a) -{ - if (a >= 0x6100 && a <= 0x7eff) { - return 0xff; - } - - if (a >= 0x8000) { - UINT32 addr68k = RamMisc->Bank68k; - addr68k += a & 0x7fff; - if (addr68k <= 0x3fffff) return RomMain[addr68k ^ 1]; - - bprintf(PRINT_NORMAL, _T("%Z80 trying to read 68k address %06X\n"), addr68k); - return 0; - } - - switch (a) { - case 0x4000: - case 0x4001: - case 0x4002: { - return BurnYM2612Read(0, 0); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read %04x\n"), a); - } - } - - return 0; -} - -UINT32 Z80BankPartial = 0; -UINT32 Z80BankPos = 0; - -void __fastcall MegadriveZ80ProgWrite(UINT16 a, UINT8 d) -{ - if (a == 0x6000 || a == 0x6001) { - Z80BankPartial |= (d & 0x01) << 23; - Z80BankPos++; - - if (Z80BankPos < 9) { - Z80BankPartial >>= 1; - } else { - Z80BankPos = 0; - RamMisc->Bank68k = Z80BankPartial; - Z80BankPartial = 0; - } - return; - } - - if (a >= 0x8000) { - UINT32 addr68k = RamMisc->Bank68k; - addr68k += a & 0x7fff; - - if (addr68k <= 0x3fffff) return; - - if (addr68k == 0xc00011) { - SN76496Write(0, d); - return; - } - - if ((addr68k >= 0xe00000) && (addr68k <= 0xffffff)) { - addr68k &=0xffff; - UINT16 *Ram = (UINT16*)Ram68K; - if (addr68k & 0x01) { - Ram[addr68k >> 1] = (Ram[addr68k >> 1] & 0xff00) | d; - } else { - Ram[addr68k >> 1] = (Ram[addr68k >> 1] & 0x00ff) | (d << 8); - } - return; - } - - bprintf(PRINT_NORMAL, _T("Z80-Bank68K Attempt to write byte value %02x to location %06x\n"), d, addr68k); - return; - } - - switch (a) { - case 0x4000: { - SekOpen(0); - BurnYM2612Write(0, 0, d); - SekClose(); - return; - } - - case 0x4001: { - SekOpen(0); - BurnYM2612Write(0, 1, d); - SekClose(); - return; - } - - case 0x4002: { - SekOpen(0); - BurnYM2612Write(0, 2, d); - SekClose(); - return; - } - - case 0x4003: { - SekOpen(0); - BurnYM2612Write(0, 3, d); - SekClose(); - return; - } - - case 0x7f11: - case 0x7f13: - case 0x7f15: - case 0x7f17: { - SN76496Write(0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write %04x, %02x\n"), a, d); - } - } -} - -static INT32 MegadriveLoadRoms(bool bLoad) -{ - struct BurnRomInfo ri; - ri.nType = 0; - ri.nLen = 0; - INT32 nOffset = -1; - UINT32 i; - INT32 nRet = 0; - - if (!bLoad) { - do { - ri.nLen = 0; - ri.nType = 0; - BurnDrvGetRomInfo(&ri, ++nOffset); - if(ri.nLen) RomNum++; - RomSize += ri.nLen; - } while (ri.nLen); - - bprintf(PRINT_NORMAL, _T("68K Rom, Num %i, Size %x\n"), RomNum, RomSize); - } - - if (bLoad) { - INT32 Offset = 0; - - for (i = 0; i < RomNum; i++) { - BurnDrvGetRomInfo(&ri, i); - - switch (ri.nType & 0x0f) { - case SEGA_MD_ROM_OFFS_000000: Offset = 0x000000; break; - case SEGA_MD_ROM_OFFS_000001: Offset = 0x000001; break; - case SEGA_MD_ROM_OFFS_020000: Offset = 0x020000; break; - case SEGA_MD_ROM_OFFS_080000: Offset = 0x080000; break; - case SEGA_MD_ROM_OFFS_100000: Offset = 0x100000; break; - case SEGA_MD_ROM_OFFS_100001: Offset = 0x100001; break; - case SEGA_MD_ROM_OFFS_200000: Offset = 0x200000; break; - } - - switch (ri.nType & 0xf0) { - case SEGA_MD_ROM_LOAD_NORMAL: { - nRet = BurnLoadRom(RomMain + Offset, i, 1); if (nRet) return 1; - break; - } - - case SEGA_MD_ROM_LOAD16_WORD_SWAP: { - nRet = BurnLoadRom(RomMain + Offset, i, 1); if (nRet) return 1; - BurnByteswap(RomMain + Offset, ri.nLen); - break; - } - - case SEGA_MD_ROM_LOAD16_BYTE: { - nRet = BurnLoadRom(RomMain + Offset, i, 2); if (nRet) return 1; - break; - } - - case SEGA_MD_ROM_LOAD16_WORD_SWAP_CONTINUE_040000_100000: { - nRet = BurnLoadRom(RomMain + Offset, i, 1); if (nRet) return 1; - memcpy(RomMain + 0x100000, RomMain + 0x040000, 0x40000); - BurnByteswap(RomMain + Offset, 0x140000); - break; - } - } - } - } - - return 0; -} - -// Custom Cartridge Mapping - -UINT8 __fastcall JCartCtrlReadByte(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("JCartCtrlRead Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall JCartCtrlReadWord(UINT32 /*sekAddress*/) -{ - UINT16 retData = 0; - - UINT8 JPad3 = ~(JoyPad->pad[2] & 0xff); - UINT8 JPad4 = ~(JoyPad->pad[3] & 0xff); - - if (RamMisc->JCartIOData[0] & 0x40) { - retData = (RamMisc->JCartIOData[0] & 0x40) | JPad3 | (JPad4 << 8); - } else { - retData = ((JPad3 & 0xc0) >> 2) | (JPad3 & 0x03); - retData += (((JPad4 & 0xc0) >> 2) | (JPad4 & 0x03)) << 8; - } - - return retData; -} - -void __fastcall JCartCtrlWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - bprintf(PRINT_NORMAL, _T("JCartCtrlWrite byte %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall JCartCtrlWriteWord(UINT32 /*sekAddress*/, UINT16 wordValue) -{ - RamMisc->JCartIOData[0] = (wordValue & 1) << 6; - RamMisc->JCartIOData[1] = (wordValue & 1) << 6; -} - -void __fastcall Ssf2BankWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - case 0xa130f1: { - if (byteValue == 2) memcpy(RomMain + 0x000000, RomMain + 0x400000 + (((byteValue & 0x0f) - 2) * 0x080000), 0x080000); - return; - } - - case 0xa130f3: { - memcpy(RomMain + 0x080000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); - return; - } - - case 0xa130f5: { - memcpy(RomMain + 0x100000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); - return; - } - - case 0xa130f7: { - memcpy(RomMain + 0x180000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); - return; - } - - case 0xa130f9: { - memcpy(RomMain + 0x200000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); - return; - } - - case 0xa130fb: { - memcpy(RomMain + 0x280000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); - return; - } - - case 0xa130fd: { - memcpy(RomMain + 0x300000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); - return; - } - - case 0xa130ff: { - memcpy(RomMain + 0x380000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); - return; - } - } -} - -UINT8 __fastcall LK3AltProtReadByte(UINT32 sekAddress) -{ - INT32 Offset = (sekAddress - 0x600000) >> 1; - Offset &= 0x07; - - UINT8 retData = 0; - - switch (Offset) { - case 0x02: { - switch (RamMisc->L3AltPCmd) { - case 1: - retData = RamMisc->L3AltPDat >> 1; - break; - - case 2: - retData = RamMisc->L3AltPDat >> 4; - retData |= (RamMisc->L3AltPDat & 0x0f) << 4; - break; - - default: - retData = (BIT(RamMisc->L3AltPDat, 7) << 0); - retData |= (BIT(RamMisc->L3AltPDat, 6) << 1); - retData |= (BIT(RamMisc->L3AltPDat, 5) << 2); - retData |= (BIT(RamMisc->L3AltPDat, 4) << 3); - retData |= (BIT(RamMisc->L3AltPDat, 3) << 4); - retData |= (BIT(RamMisc->L3AltPDat, 2) << 5); - retData |= (BIT(RamMisc->L3AltPDat, 1) << 6); - retData |= (BIT(RamMisc->L3AltPDat, 0) << 7); - break; - } - break; - } - } - -// bprintf(PRINT_NORMAL, _T("LK3AltProt Read Byte %x\n"), sekAddress); - - return retData; -} - -UINT16 __fastcall LK3AltProtReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("LK3AltProt Read Word %x\n"), sekAddress); - - return 0; -} - -void __fastcall LK3AltProtWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - INT32 Offset = (sekAddress - 0x600000) >> 1; - Offset &= 0x07; - - switch (Offset) { - case 0x00: - RamMisc->L3AltPDat = byteValue; - return; - - case 0x01: - RamMisc->L3AltPCmd = byteValue; - return; - } - -// bprintf(PRINT_NORMAL, _T("LK3AltProt write byte %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall LK3AltProtWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("LK3AltProt write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -void __fastcall LK3AltBankWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - INT32 Offset = (sekAddress - 0x700000) >> 1; - Offset &= 0x07; - - if (Offset == 0) { - memcpy(RomMain, OriginalRom + ((byteValue & 0xff) * 0x8000), 0x8000); - return; - } - - bprintf(PRINT_NORMAL, _T("LK3AltBank write byte %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall LK3AltBankWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("LK3AltBank write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -UINT8 __fastcall RedclifProtReadByte(UINT32 /*sekAddress*/) -{ - return (UINT8)-0x56; -} - -UINT16 __fastcall RedclifProtReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("RedclifeProt Read Word %x\n"), sekAddress); - - return 0; -} - -UINT8 __fastcall RedclifProt2ReadByte(UINT32 /*sekAddress*/) -{ - return 0x55; -} - -UINT16 __fastcall RedclifProt2ReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("RedclifeProt2 Read Word %x\n"), sekAddress); - - return 0; -} - -UINT8 __fastcall RadicaBankSelectReadByte(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("RadicaBankSelect Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall RadicaBankSelectReadWord(UINT32 sekAddress) -{ - INT32 Bank = ((sekAddress - 0xa13000) >> 1) & 0x3f; - memcpy(RomMain, RomMain + 0x400000 + (Bank * 0x10000), 0x400000); - - return 0; -} - -UINT8 __fastcall Kof99A13000ReadByte(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Kof99A13000 Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall Kof99A13000ReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xa13000: return 0x00; - case 0xa13002: return 0x01; - case 0xa1303e: return 0x1f; - - } - - bprintf(PRINT_NORMAL, _T("Kof99A13000 Read Word %x\n"), sekAddress); - - return 0; -} - -UINT8 __fastcall SoulbladReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x400002: return 0x98; - case 0x400004: return 0xc0; - case 0x400006: return 0xf0; - - } - - bprintf(PRINT_NORMAL, _T("Soulblad Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall SoulbladReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Soulblad Read Word %x\n"), sekAddress); - - return 0; -} - -UINT8 __fastcall MjloverProt1ReadByte(UINT32 /*sekAddress*/) -{ - return 0x90; -} - -UINT16 __fastcall MjloverProt1ReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("MjloverProt1 Read Word %x\n"), sekAddress); - - return 0; -} - -UINT8 __fastcall MjloverProt2ReadByte(UINT32 /*sekAddress*/) -{ - return 0xd3; -} - -UINT16 __fastcall MjloverProt2ReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("MjloverProt2 Read Word %x\n"), sekAddress); - - return 0; -} - -UINT8 __fastcall SquirrelKingExtraReadByte(UINT32 /*sekAddress*/) -{ - return RamMisc->SquirrelkingExtra; -} - -UINT16 __fastcall SquirrelKingExtraReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("SquirrelKingExtra Read Word %x\n"), sekAddress); - - return 0; -} - -void __fastcall SquirrelKingExtraWriteByte(UINT32 /*sekAddress*/, UINT8 byteValue) -{ - RamMisc->SquirrelkingExtra = byteValue; -} - -void __fastcall SquirrelKingExtraWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("SquirrelKingExtra write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -UINT8 __fastcall SmouseProtReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x400000: return 0x55; - case 0x400002: return 0x0f; - case 0x400004: return 0xaa; - case 0x400005: return 0xf0; - } - - return 0; -} - -UINT16 __fastcall SmouseProtReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("SmouseProt Read Word %x\n"), sekAddress); - - return 0; -} - -UINT8 __fastcall SmbProtReadByte(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Smbprot Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall SmbProtReadWord(UINT32 /*sekAddress*/) -{ - return 0x0c; -} - -UINT8 __fastcall Smb2ProtReadByte(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Smb2Prot Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall Smb2ProtReadWord(UINT32 /*sekAddress*/) -{ - return 0x0a; -} - -void __fastcall KaijuBankWriteByte(UINT32 /*sekAddress*/, UINT8 byteValue) -{ - memcpy(RomMain + 0x000000, RomMain + 0x400000 + (byteValue & 0x7f) * 0x8000, 0x8000); -} - -void __fastcall KaijuBankWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("KaijuBank write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -UINT8 __fastcall Chinfi3ProtReadByte(UINT32 /*sekAddress*/) -{ - UINT8 retDat = 0; - - if (SekGetPC(0) == 0x01782) // makes 'VS' screen appear - { - retDat = SekDbgGetRegister(SEK_REG_D3) & 0xff; -// retDat <<= 8; - return retDat; - } - else if (SekGetPC(0) == 0x1c24) // background gfx etc. - { - retDat = SekDbgGetRegister(SEK_REG_D3) & 0xff; -// retDat <<= 8; - return retDat; - } - else if (SekGetPC(0) == 0x10c4a) // unknown - { - return rand() & 0xff;//space->machine().rand(); - } - else if (SekGetPC(0) == 0x10c50) // unknown - { - return rand() & 0xff;//space->machine().rand(); - } - else if (SekGetPC(0) == 0x10c52) // relates to the game speed.. - { - retDat = SekDbgGetRegister(SEK_REG_D4) & 0xff; -// retDat <<= 8; - return retDat; - } - else if (SekGetPC(0) == 0x061ae) - { - retDat = SekDbgGetRegister(SEK_REG_D3) & 0xff; -// retDat <<= 8; - return retDat; - } - else if (SekGetPC(0) == 0x061b0) - { - retDat = SekDbgGetRegister(SEK_REG_D3) & 0xff; -// retDat <<= 8; - return retDat; - } - - return 0; -} - -UINT16 __fastcall Chinfi3ProtReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Chinfi3Prot Read Word %x\n"), sekAddress); - - return 0; -} - -void __fastcall Chinfi3BankWriteByte(UINT32 /*sekAddress*/, UINT8 byteValue) -{ - if (byteValue == 0xf1) // *hit player - { - INT32 x; - for (x = 0; x < 0x100000; x += 0x10000) - { - memcpy(RomMain + x, RomMain + 0x410000, 0x10000); - } - } - else if (byteValue == 0xd7) // title screen.. - { - INT32 x; - for (x = 0; x < 0x100000; x += 0x10000) - { - memcpy(RomMain + x, RomMain + 0x470000, 0x10000); - } - } - else if (byteValue == 0xd3) // character hits floor - { - INT32 x; - for (x = 0; x < 0x100000; x += 0x10000) - { - memcpy(RomMain + x, RomMain + 0x430000, 0x10000); - } - } - else if (byteValue == 0x00) - { - INT32 x; - for (x = 0; x < 0x100000; x += 0x10000) - { - memcpy(RomMain + x, RomMain + 0x400000 + x, 0x10000); - } - } -} - -void __fastcall Chinfi3BankWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("Chinfi3Bank write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -UINT8 __fastcall Lionk2ProtReadByte(UINT32 sekAddress) -{ - switch(sekAddress) { - case 0x400002: { - return RamMisc->Lionk2ProtData; - } - - case 0x400006: { - return RamMisc->Lionk2ProtData2; - } - } - - bprintf(PRINT_NORMAL, _T("Lion2Prot Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall Lionk2ProtReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Lion2Prot Read Word %x\n"), sekAddress); - - return 0; -} - -void __fastcall Lionk2ProtWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - case 0x400000: { - RamMisc->Lionk2ProtData = byteValue; - return; - } - - case 0x400004: { - RamMisc->Lionk2ProtData2 = byteValue; - return; - } - } - - bprintf(PRINT_NORMAL, _T("Lion2Prot write byte %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall Lionk2ProtWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("Lion2Prot write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -UINT8 __fastcall BuglExtraReadByte(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("BuglExtra Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall BuglExtraReadWord(UINT32 /*sekAddress*/) -{ - return 0x28; -} - -UINT8 __fastcall Elfwor400000ReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x400000: return 0x55; - case 0x400002: return 0x0f; - case 0x400004: return 0xc9; - case 0x400006: return 0x18; - } - - bprintf(PRINT_NORMAL, _T("Elfwor400000 Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall Elfwor400000ReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Elfwor400000 Read Word %x\n"), sekAddress); - - return 0; -} - -UINT8 __fastcall RockmanX3ExtraReadByte(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("RockmanX3Extra Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall RockmanX3ExtraReadWord(UINT32 /*sekAddress*/) -{ - return 0x0c; -} - -UINT8 __fastcall SbubExtraReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x400000: return 0x55; - case 0x400002: return 0x0f; - } - - bprintf(PRINT_NORMAL, _T("SbubExtra Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall SbubExtraReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("SbubExtra Read Word %x\n"), sekAddress); - - return 0; -} - -UINT8 __fastcall Kof98ReadByte(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Kof98 Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall Kof98ReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x480000: return 0xaa00; - case 0x4800e0: return 0xaa00; - case 0x4824a0: return 0xaa00; - case 0x488880: return 0xaa00; - case 0x4a8820: return 0x0a00; - case 0x4f8820: return 0x0000; - } - - bprintf(PRINT_NORMAL, _T("Kof98 Read Word %x\n"), sekAddress); - - return 0; -} - -void __fastcall RealtecWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - case 0x400000: { - INT32 BankData = (byteValue >> 1) & 0x7; - - RamMisc->RealtecBankAddr = (RamMisc->RealtecBankAddr & 0x7) | BankData << 3; - - memcpy(RomMain, RomMain + (RamMisc->RealtecBankAddr * 0x20000) + 0x400000, RamMisc->RealtecBankSize * 0x20000); - memcpy(RomMain + RamMisc->RealtecBankSize * 0x20000, RomMain + (RamMisc->RealtecBankAddr * 0x20000) + 0x400000, RamMisc->RealtecBankSize * 0x20000); - return; - } - - case 0x402000:{ - RamMisc->RealtecBankAddr = 0; - RamMisc->RealtecBankSize = byteValue & 0x1f; - return; - } - - case 0x404000: { - INT32 BankData = byteValue & 0x3; - - RamMisc->RealtecBankAddr = (RamMisc->RealtecBankAddr & 0xf8) | BankData; - - memcpy(RomMain, RomMain + (RamMisc->RealtecBankAddr * 0x20000)+ 0x400000, RamMisc->RealtecBankSize * 0x20000); - memcpy(RomMain + RamMisc->RealtecBankSize * 0x20000, RomMain + (RamMisc->RealtecBankAddr * 0x20000) + 0x400000, RamMisc->RealtecBankSize * 0x20000); - return; - } - } - - bprintf(PRINT_NORMAL, _T("Realtec write byte %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall RealtecWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("Realtec write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -void __fastcall Sup19in1BankWriteByte(UINT32 sekAddress, UINT8 /*byteValue*/) -{ - INT32 Offset = (sekAddress - 0xa13000) >> 1; - - memcpy(RomMain + 0x000000, RomMain + 0x400000 + ((Offset << 1) * 0x10000), 0x80000); -} - -void __fastcall Sup19in1BankWriteWord(UINT32 sekAddress, UINT16 /*wordValue*/) -{ - INT32 Offset = (sekAddress - 0xa13000) >> 1; - - memcpy(RomMain + 0x000000, RomMain + 0x400000 + ((Offset << 1) * 0x10000), 0x80000); -} - -void __fastcall Mc12in1BankWriteByte(UINT32 sekAddress, UINT8 /*byteValue*/) -{ - INT32 Offset = (sekAddress - 0xa13000) >> 1; - memcpy(RomMain + 0x000000, OriginalRom + ((Offset & 0x3f) << 17), 0x100000); -} - -void __fastcall Mc12in1BankWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("Mc12in1Bank write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -UINT8 __fastcall TopfigReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x645b45: return 0x9f; - - case 0x6bd295: { - static INT32 x = -1; - - if (SekGetPC(0) == 0x1771a2) { - return 0x50; - } else { - x++; - return (UINT8)x; - } - } - - case 0x6f5345: { - static INT32 x = -1; - - if (SekGetPC(0) == 0x4C94E) { - return SekDbgGetRegister(SEK_REG_D0) & 0xff; - } else { - x++; - return (UINT8)x; - } - } - } - - bprintf(PRINT_NORMAL, _T("Topfig Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall TopfigReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Topfig Read Word %x\n"), sekAddress); - - return 0; -} - -void __fastcall TopfigWriteByte(UINT32 /*sekAddress*/, UINT8 byteValue) -{ - if (byteValue == 0x002a) - { - memcpy(RomMain + 0x060000, RomMain + 0x570000, 0x8000); // == 0x2e*0x8000?! - - } - else if (byteValue==0x0035) // characters ingame - { - memcpy(RomMain + 0x020000, RomMain + 0x5a8000, 0x8000); // == 0x35*0x8000 - } - else if (byteValue==0x000f) // special moves - { - memcpy(RomMain + 0x058000, RomMain + 0x478000, 0x8000); // == 0xf*0x8000 - } - else if (byteValue==0x0000) - { - memcpy(RomMain + 0x060000, RomMain + 0x460000, 0x8000); - memcpy(RomMain + 0x020000, RomMain + 0x420000, 0x8000); - memcpy(RomMain + 0x058000, RomMain + 0x458000, 0x8000); - } -} - -void __fastcall TopfigWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("Topfig write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -static void SetupCustomCartridgeMappers() -{ - if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART_SEPROM)) { - SekOpen(0); - SekMapHandler(7, 0x38fffe, 0x38ffff, SM_READ | SM_WRITE); - SekSetReadByteHandler(7, JCartCtrlReadByte); - SekSetReadWordHandler(7, JCartCtrlReadWord); - SekSetWriteByteHandler(7, JCartCtrlWriteByte); - SekSetWriteWordHandler(7, JCartCtrlWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SSF2) { - OriginalRom = (UINT8*)BurnMalloc(0x500000); - memcpy(OriginalRom, RomMain, 0x500000); - - memcpy(RomMain + 0x800000, OriginalRom + 0x400000, 0x100000); - memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x400000); - memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x400000); - - SekOpen(0); - SekMapHandler(7, 0xa130f0, 0xa130ff, SM_WRITE); - SekSetWriteByteHandler(7, Ssf2BankWriteByte); - SekClose(); - } - - if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_LIONK3) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SKINGKONG)) { - RamMisc->L3AltPDat = 0; - RamMisc->L3AltPCmd = 0; - - OriginalRom = (UINT8*)BurnMalloc(0x200000); - memcpy(OriginalRom, RomMain, 0x200000); - - memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x200000); - memcpy(RomMain + 0x200000, OriginalRom + 0x000000, 0x200000); - - SekOpen(0); - SekMapHandler(7, 0x600000, 0x6fffff, SM_READ | SM_WRITE); - SekSetReadByteHandler(7, LK3AltProtReadByte); - SekSetReadWordHandler(7, LK3AltProtReadWord); - SekSetWriteByteHandler(7, LK3AltProtWriteByte); - SekSetWriteWordHandler(7, LK3AltProtWriteWord); - SekMapHandler(8, 0x700000, 0x7fffff, SM_WRITE); - SekSetWriteByteHandler(8, LK3AltBankWriteByte); - SekSetWriteWordHandler(8, LK3AltBankWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SDK99) { - RamMisc->L3AltPDat = 0; - RamMisc->L3AltPCmd = 0; - - OriginalRom = (UINT8*)BurnMalloc(0x300000); - memcpy(OriginalRom, RomMain, 0x300000); - - memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x300000); - memcpy(RomMain + 0x300000, OriginalRom + 0x000000, 0x100000); - - SekOpen(0); - SekMapHandler(7, 0x600000, 0x6fffff, SM_READ | SM_WRITE); - SekSetReadByteHandler(7, LK3AltProtReadByte); - SekSetReadWordHandler(7, LK3AltProtReadWord); - SekSetWriteByteHandler(7, LK3AltProtWriteByte); - SekSetWriteWordHandler(7, LK3AltProtWriteWord); - SekMapHandler(8, 0x700000, 0x7fffff, SM_WRITE); - SekSetWriteByteHandler(8, LK3AltBankWriteByte); - SekSetWriteWordHandler(8, LK3AltBankWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_REDCL_EN) { - OriginalRom = (UINT8*)BurnMalloc(0x200005); - memcpy(OriginalRom, RomMain, 0x200005); - for (UINT32 i = 0; i < RomSize; i++) { - OriginalRom[i] ^= 0x40; - } - - memcpy(RomMain + 0x000000, OriginalRom + 0x000004, 0x200000); - - SekOpen(0); - SekMapHandler(7, 0x400000, 0x400001, SM_READ); - SekSetReadByteHandler(7, RedclifProt2ReadByte); - SekSetReadWordHandler(7, RedclifProt2ReadWord); - SekMapHandler(8, 0x400004, 0x400005, SM_READ); - SekSetReadByteHandler(8, RedclifProtReadByte); - SekSetReadWordHandler(8, RedclifProtReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_RADICA) { - OriginalRom = (UINT8*)BurnMalloc(RomSize); - memcpy(OriginalRom, RomMain, RomSize); - - memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x400000); - memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x400000); - memcpy(RomMain + 0x800000, OriginalRom + 0x000000, 0x400000); - - SekOpen(0); - SekMapHandler(7, 0xa13000, 0xa1307f, SM_READ); - SekSetReadByteHandler(7, RadicaBankSelectReadByte); - SekSetReadWordHandler(7, RadicaBankSelectReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_KOF99) { - SekOpen(0); - SekMapHandler(7, 0xa13000, 0xa1303f, SM_READ); - SekSetReadByteHandler(7, Kof99A13000ReadByte); - SekSetReadWordHandler(7, Kof99A13000ReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SOULBLAD) { - SekOpen(0); - SekMapHandler(7, 0x400002, 0x400007, SM_READ); - SekSetReadByteHandler(7, SoulbladReadByte); - SekSetReadWordHandler(7, SoulbladReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MJLOVER) { - SekOpen(0); - SekMapHandler(7, 0x400000, 0x400001, SM_READ); - SekSetReadByteHandler(7, MjloverProt1ReadByte); - SekSetReadWordHandler(7, MjloverProt1ReadWord); - SekMapHandler(8, 0x401000, 0x401001, SM_READ); - SekSetReadByteHandler(8, MjloverProt2ReadByte); - SekSetReadWordHandler(8, MjloverProt2ReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SQUIRRELK) { - SekOpen(0); - SekMapHandler(7, 0x400000, 0x400007, SM_READ | SM_WRITE); - SekSetReadByteHandler(7, SquirrelKingExtraReadByte); - SekSetReadWordHandler(7, SquirrelKingExtraReadWord); - SekSetWriteByteHandler(7, SquirrelKingExtraWriteByte); - SekSetWriteWordHandler(7, SquirrelKingExtraWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SMOUSE) { - SekOpen(0); - SekMapHandler(7, 0x400000, 0x400007, SM_READ); - SekSetReadByteHandler(7, SmouseProtReadByte); - SekSetReadWordHandler(7, SmouseProtReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SMB) { - SekOpen(0); - SekMapHandler(7, 0xa13000, 0xa13001, SM_READ); - SekSetReadByteHandler(7, SmbProtReadByte); - SekSetReadWordHandler(7, SmbProtReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SMB2) { - SekOpen(0); - SekMapHandler(7, 0xa13000, 0xa13001, SM_READ); - SekSetReadByteHandler(7, Smb2ProtReadByte); - SekSetReadWordHandler(7, Smb2ProtReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_KAIJU) { - OriginalRom = (UINT8*)BurnMalloc(RomSize); - memcpy(OriginalRom, RomMain, RomSize); - - memcpy(RomMain + 0x400000, OriginalRom, 0x200000); - memcpy(RomMain + 0x600000, OriginalRom, 0x200000); - memcpy(RomMain + 0x000000, OriginalRom, 0x200000); - - SekOpen(0); - SekMapHandler(7, 0x700000, 0x7fffff, SM_WRITE); - SekSetWriteByteHandler(7, KaijuBankWriteByte); - SekSetWriteWordHandler(7, KaijuBankWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CHINFIGHT3) { - OriginalRom = (UINT8*)BurnMalloc(RomSize); - memcpy(OriginalRom, RomMain, RomSize); - - memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x200000); - memcpy(RomMain + 0x600000, OriginalRom + 0x000000, 0x200000); - memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x200000); - - SekOpen(0); - SekMapHandler(7, 0x400000, 0x4fffff, SM_READ); - SekSetReadByteHandler(7, Chinfi3ProtReadByte); - SekSetReadWordHandler(7, Chinfi3ProtReadWord); - SekMapHandler(8, 0x600000, 0x6fffff, SM_WRITE); - SekSetWriteByteHandler(8, Chinfi3BankWriteByte); - SekSetWriteWordHandler(8, Chinfi3BankWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_LIONK2) { - RamMisc->Lionk2ProtData = 0; - RamMisc->Lionk2ProtData2 = 0; - - SekOpen(0); - SekMapHandler(7, 0x400000, 0x400007, SM_READ | SM_WRITE); - SekSetReadByteHandler(7, Lionk2ProtReadByte); - SekSetReadWordHandler(7, Lionk2ProtReadWord); - SekSetWriteByteHandler(7, Lionk2ProtWriteByte); - SekSetWriteWordHandler(7, Lionk2ProtWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_BUGSLIFE) { - SekOpen(0); - SekMapHandler(7, 0xa13000, 0xa13001, SM_READ); - SekSetReadByteHandler(7, BuglExtraReadByte); - SekSetReadWordHandler(7, BuglExtraReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_ELFWOR) { - SekOpen(0); - SekMapHandler(7, 0x400000, 0x400007, SM_READ); - SekSetReadByteHandler(7, Elfwor400000ReadByte); - SekSetReadWordHandler(7, Elfwor400000ReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_ROCKMANX3) { - SekOpen(0); - SekMapHandler(7, 0xa13000, 0xa13001, SM_READ); - SekSetReadByteHandler(7, RockmanX3ExtraReadByte); - SekSetReadWordHandler(7, RockmanX3ExtraReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SBUBBOB) { - SekOpen(0); - SekMapHandler(7, 0x400000, 0x400003, SM_READ); - SekSetReadByteHandler(7, SbubExtraReadByte); - SekSetReadWordHandler(7, SbubExtraReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_KOF98) { - SekOpen(0); - SekMapHandler(7, 0x480000, 0x4fffff, SM_READ); - SekSetReadByteHandler(7, Kof98ReadByte); - SekSetReadWordHandler(7, Kof98ReadWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_REALTEC) { - RamMisc->RealtecBankAddr = 0; - RamMisc->RealtecBankSize = 0; - - OriginalRom = (UINT8*)BurnMalloc(RomSize); - memcpy(OriginalRom, RomMain, RomSize); - - memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x080000); - - for (INT32 i = 0; i < 0x400000; i += 0x2000) { - memcpy(RomMain + i, OriginalRom + 0x7e000, 0x2000); - } - - SekOpen(0); - SekMapHandler(7, 0x400000, 0x40400f, SM_WRITE); - SekSetWriteByteHandler(7, RealtecWriteByte); - SekSetWriteWordHandler(7, RealtecWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MC_SUP19IN1) { - OriginalRom = (UINT8*)BurnMalloc(RomSize); - memcpy(OriginalRom, RomMain, RomSize); - - memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x400000); - - SekOpen(0); - SekMapHandler(7, 0xa13000, 0xa13039, SM_WRITE); - SekSetWriteByteHandler(7, Sup19in1BankWriteByte); - SekSetWriteWordHandler(7, Sup19in1BankWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MC_SUP15IN1) { - OriginalRom = (UINT8*)BurnMalloc(RomSize); - memcpy(OriginalRom, RomMain, RomSize); - - memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x200000); - - SekOpen(0); - SekMapHandler(7, 0xa13000, 0xa13039, SM_WRITE); - SekSetWriteByteHandler(7, Sup19in1BankWriteByte); - SekSetWriteWordHandler(7, Sup19in1BankWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_12IN1) { - OriginalRom = (UINT8*)BurnMalloc(RomSize); - memcpy(OriginalRom, RomMain, RomSize); - - memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x200000); - - SekOpen(0); - SekMapHandler(7, 0xa13000, 0xa1303f, SM_WRITE); - SekSetWriteByteHandler(7, Mc12in1BankWriteByte); - SekSetWriteWordHandler(7, Mc12in1BankWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_TOPFIGHTER) { - OriginalRom = (UINT8*)BurnMalloc(RomSize); - memcpy(OriginalRom, RomMain, RomSize); - - memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x200000); - memcpy(RomMain + 0x200000, OriginalRom + 0x000000, 0x200000); - memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x200000); - memcpy(RomMain + 0x600000, OriginalRom + 0x000000, 0x200000); - - SekOpen(0); - SekMapHandler(7, 0x600000, 0x6fffff, SM_READ); - SekSetReadByteHandler(7, TopfigReadByte); - SekSetReadWordHandler(7, TopfigReadWord); - SekMapHandler(8, 0x700000, 0x7fffff, SM_WRITE); - SekSetWriteByteHandler(8, TopfigWriteByte); - SekSetWriteWordHandler(8, TopfigWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_POKEMON) { - UINT16 *ROM16 = (UINT16 *)RomMain; - - ROM16[0x0dd19e/2] = 0x47F8; - ROM16[0x0dd1a0/2] = 0xFFF0; - ROM16[0x0dd1a2/2] = 0x4E63; - ROM16[0x0dd46e/2] = 0x4EF8; - ROM16[0x0dd470/2] = 0x0300; - ROM16[0x0dd49c/2] = 0x6002; - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_POKEMON2) { - UINT16 *ROM16 = (UINT16 *)RomMain; - - ROM16[0x06036/2] = 0xE000; - ROM16[0x02540/2] = 0x6026; - ROM16[0x01ED0/2] = 0x6026; - ROM16[0x02476/2] = 0x6022; - - ROM16[0x7E300/2] = 0x60FE; - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MULAN) { - UINT16 *ROM16 = (UINT16 *)RomMain; - - ROM16[0x06036/2] = 0xE000; - } -} - -// SRAM and EEPROM Handling - -UINT8 __fastcall MegadriveSRAMReadByte(UINT32 sekAddress) -{ - if (RamMisc->SRamActive) { - return SRam[(sekAddress - RamMisc->SRamStart) ^ 1]; - } else { - return RomMain[sekAddress ^ 1]; - } -} - -UINT16 __fastcall MegadriveSRAMReadWord(UINT32 sekAddress) -{ - if (RamMisc->SRamActive) { - UINT16 *Ram = (UINT16*)SRam; - return Ram[(sekAddress - RamMisc->SRamStart) >> 1]; - } else { - UINT16 *Rom = (UINT16*)RomMain; - return Rom[sekAddress >> 1]; - } -} - -void __fastcall MegadriveSRAMWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if (RamMisc->SRamActive) { - if (!RamMisc->SRamReadOnly) { - SRam[(sekAddress - RamMisc->SRamStart) ^ 1] = byteValue; - return; - } - } -} - -void __fastcall MegadriveSRAMWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - if (RamMisc->SRamActive) { - if (!RamMisc->SRamReadOnly) { - UINT16 *Ram = (UINT16*)SRam; - Ram[(sekAddress - RamMisc->SRamStart) >> 1] = wordValue; - return; - } - } -} - -static void InstallSRAMHandlers(bool MaskAddr) -{ - UINT32 Mask = MaskAddr ? 0x3fffff : 0xffffff; - - memset(SRam, 0xff, MAX_SRAM_SIZE); - memcpy((UINT8*)MegadriveBackupRam, SRam, RamMisc->SRamEnd - RamMisc->SRamStart + 1); - - SekOpen(0); - SekMapHandler(6, RamMisc->SRamStart & Mask, RamMisc->SRamEnd & Mask, SM_READ | SM_WRITE); - SekSetReadByteHandler(6, MegadriveSRAMReadByte); - SekSetReadWordHandler(6, MegadriveSRAMReadWord); - SekSetWriteByteHandler(6, MegadriveSRAMWriteByte); - SekSetWriteWordHandler(6, MegadriveSRAMWriteWord); - SekClose(); - - RamMisc->SRamHandlersInstalled = 1; -} - -UINT8 __fastcall Megadrive6658ARegReadByte(UINT32 sekAddress) -{ - if (sekAddress & 1) return RamMisc->SRamActive; - - bprintf(PRINT_NORMAL, _T("Megadrive6658AReg Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall Megadrive6658ARegReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Megadrive6658AReg Read Word %x\n"), sekAddress); - - return 0; -} - -void __fastcall Megadrive6658ARegWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if (sekAddress & 1) { - if (byteValue == 1) { - RamMisc->SRamActive = 1; - return; - } - - if (byteValue == 0) { - RamMisc->SRamActive = 0; - return; - } - } - - bprintf(PRINT_NORMAL, _T("6658A Reg write byte %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall Megadrive6658ARegWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("6658A Reg write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -UINT8 __fastcall WboyVEEPROMReadByte(UINT32 sekAddress) -{ - if (sekAddress & 1) return ~RamMisc->I2CMem & 1; - - bprintf(PRINT_NORMAL, _T("WboyVEEPROM Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall WboyVEEPROMReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("WboyVEEPROM Read Word %x\n"), sekAddress); - - return 0; -} - -void __fastcall WboyVEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if (sekAddress & 1) { - RamMisc->I2CClk = (byteValue & 0x0002) >> 1; - RamMisc->I2CMem = (byteValue & 0x0001); - return; - } - - bprintf(PRINT_NORMAL, _T("WboyVEEPROM write byte value %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall WboyVEEPROMWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("WboyVEEPROM write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -UINT8 __fastcall NbajamEEPROMReadByte(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Nbajam Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall NbajamEEPROMReadWord(UINT32 /*sekAddress*/) -{ - return RamMisc->I2CMem & 1; -} - -void __fastcall NbajamEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - bprintf(PRINT_NORMAL, _T("Nbajam write byte value %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall NbajamEEPROMWriteWord(UINT32 /*sekAddress*/, UINT16 wordValue) -{ - RamMisc->I2CClk = (wordValue & 0x0002) >> 1; - RamMisc->I2CMem = (wordValue & 0x0001); -} - -UINT8 __fastcall NbajamteEEPROMReadByte(UINT32 sekAddress) -{ - if (sekAddress & 1) return RamMisc->I2CMem & 1; - - bprintf(PRINT_NORMAL, _T("Nbajamte Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall NbajamteEEPROMReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Nbajamte Read Word %x\n"), sekAddress); - - return 0; -} - -void __fastcall NbajamteEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if (sekAddress & 1) { -// RamMisc->I2CClk = (wordValue & 0x0002) >> 1; - RamMisc->I2CMem = (byteValue & 0x0001); - return; - } - - bprintf(PRINT_NORMAL, _T("Nbajamte write byte value %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall NbajamteEEPROMWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("Nbajamte write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -UINT8 __fastcall EANhlpaEEPROMReadByte(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("EANhlpa Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall EANhlpaEEPROMReadWord(UINT32 /*sekAddress*/) -{ - return (RamMisc->I2CMem & 1) << 7; -} - -void __fastcall EANhlpaEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - bprintf(PRINT_NORMAL, _T("EANhlpa write byte value %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall EANhlpaEEPROMWriteWord(UINT32 /*sekAddress*/, UINT16 wordValue) -{ - RamMisc->I2CClk = ((wordValue & 0x0040) >> 6); - RamMisc->I2CMem = ((wordValue & 0x0080) >> 7); -} - -UINT8 __fastcall CodemastersEEPROMReadByte(UINT32 sekAddress) -{ - if (sekAddress & 1) return RamMisc->I2CMem & 1; - - bprintf(PRINT_NORMAL, _T("Codemasters Read Byte %x\n"), sekAddress); - - return 0; -} - -UINT16 __fastcall CodemastersEEPROMReadWord(UINT32 sekAddress) -{ - bprintf(PRINT_NORMAL, _T("Codemasters Read Word %x\n"), sekAddress); - - return 0; -} - -void __fastcall CodemastersEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if (sekAddress & 1) { - RamMisc->I2CClk = (byteValue & 0x0002) >> 1; - RamMisc->I2CMem = (byteValue & 0x0001); - return; - } else { - RamMisc->I2CClk = (byteValue & 0x0002) >> 1; - RamMisc->I2CMem = (byteValue & 0x0001); - return; - } - - bprintf(PRINT_NORMAL, _T("Codemasters write byte value %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall CodemastersEEPROMWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("Codemasters write word value %04x to location %08x\n"), wordValue, sekAddress); -} - -void __fastcall MegadriveSRAMToggleWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - bprintf(PRINT_NORMAL, _T("SRam Toggle byte %02x to location %08x\n"), byteValue, sekAddress); -} - -void __fastcall MegadriveSRAMToggleWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - bprintf(PRINT_NORMAL, _T("SRam Toggle word value %04x to location %08x\n"), wordValue, sekAddress); -} - -static void MegadriveSetupSRAM() -{ - SRamSize = 0; - RamMisc->SRamStart = 0; - RamMisc->SRamEnd = 0; - RamMisc->SRamDetected = 0; - RamMisc->SRamHandlersInstalled = 0; - RamMisc->SRamActive = 0; - RamMisc->SRamReadOnly = 0; - RamMisc->SRamHasSerialEEPROM = 0; - MegadriveBackupRam = NULL; - - if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_00400) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_00800) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_01000) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_04000) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_10000)) { - RamMisc->SRamStart = 0x200000; - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_00400) RamMisc->SRamEnd = 0x2003ff; - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_00800) RamMisc->SRamEnd = 0x2007ff; - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_01000) RamMisc->SRamEnd = 0x200fff; - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_04000) RamMisc->SRamEnd = 0x203fff; - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_10000) RamMisc->SRamEnd = 0x20ffff; - - RamMisc->SRamDetected = 1; - MegadriveBackupRam = (UINT16*)RomMain + RamMisc->SRamStart; - - SekOpen(0); - SekMapHandler(5, 0xa130f0, 0xa130f1, SM_WRITE); - SekSetWriteByteHandler(5, MegadriveSRAMToggleWriteByte); - SekSetWriteWordHandler(5, MegadriveSRAMToggleWriteWord); - SekClose(); - - if (RomSize <= RamMisc->SRamStart) { - RamMisc->SRamActive = 1; - InstallSRAMHandlers(false); - } - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_BEGGAR) { - RamMisc->SRamStart = 0x400000; - RamMisc->SRamEnd = 0x40ffff; - - RamMisc->SRamDetected = 1; - MegadriveBackupRam = (UINT16*)RomMain + RamMisc->SRamStart; - - RamMisc->SRamActive = 1; - InstallSRAMHandlers(false); - } - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_FRAM_00400) { - RamMisc->SRamStart = 0x200000; - RamMisc->SRamEnd = 0x2003ff; - - RamMisc->SRamDetected = 1; - MegadriveBackupRam = (UINT16*)RomMain + RamMisc->SRamStart; - - SekOpen(0); - SekMapHandler(5, 0xa130f0, 0xa130f1, SM_READ | SM_WRITE); - SekSetReadByteHandler(5, Megadrive6658ARegReadByte); - SekSetReadWordHandler(5, Megadrive6658ARegReadWord); - SekSetWriteByteHandler(5, Megadrive6658ARegWriteByte); - SekSetWriteWordHandler(5, Megadrive6658ARegWriteWord); - SekClose(); - - InstallSRAMHandlers(false); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SEGA_EEPROM) { - RamMisc->SRamHasSerialEEPROM = 1; - SekOpen(0); - SekMapHandler(5, 0x200000, 0x200001, SM_READ | SM_WRITE); - SekSetReadByteHandler(5, WboyVEEPROMReadByte); - SekSetReadWordHandler(5, WboyVEEPROMReadWord); - SekSetWriteByteHandler(5, WboyVEEPROMWriteByte); - SekSetWriteWordHandler(5, WboyVEEPROMWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_NBA_JAM) { - RamMisc->SRamHasSerialEEPROM = 1; - SekOpen(0); - SekMapHandler(5, 0x200000, 0x200001, SM_READ | SM_WRITE); - SekSetReadByteHandler(5, NbajamEEPROMReadByte); - SekSetReadWordHandler(5, NbajamEEPROMReadWord); - SekSetWriteByteHandler(5, NbajamEEPROMWriteByte); - SekSetWriteWordHandler(5, NbajamEEPROMWriteWord); - SekClose(); - } - - if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_NBA_JAM_TE) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_NFL_QB_96) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_C_SLAM)) { - RamMisc->SRamHasSerialEEPROM = 1; - SekOpen(0); - SekMapHandler(5, 0x200000, 0x200001, SM_READ | SM_WRITE); - SekSetReadByteHandler(5, NbajamteEEPROMReadByte); - SekSetReadWordHandler(5, NbajamteEEPROMReadWord); - SekSetWriteByteHandler(5, NbajamteEEPROMWriteByte); - SekSetWriteWordHandler(5, NbajamteEEPROMWriteWord); - SekClose(); - } - - if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_EA_NHLPA) { - RamMisc->SRamHasSerialEEPROM = 1; - SekOpen(0); - SekMapHandler(5, 0x200000, 0x200001, SM_READ | SM_WRITE); - SekSetReadByteHandler(5, EANhlpaEEPROMReadByte); - SekSetReadWordHandler(5, EANhlpaEEPROMReadWord); - SekSetWriteByteHandler(5, EANhlpaEEPROMWriteByte); - SekSetWriteWordHandler(5, EANhlpaEEPROMWriteWord); - SekClose(); - } - - if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CODE_MASTERS) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART_SEPROM)) { - RamMisc->SRamHasSerialEEPROM = 1; - SekOpen(0); - SekMapHandler(5, 0x300000, 0x300001, SM_WRITE); - SekSetWriteByteHandler(5, CodemastersEEPROMWriteByte); - SekSetWriteWordHandler(5, CodemastersEEPROMWriteWord); - SekMapHandler(6, 0x380000, 0x380001, SM_READ); - SekSetReadByteHandler(6, CodemastersEEPROMReadByte); - SekSetReadWordHandler(6, CodemastersEEPROMReadWord); - SekClose(); - } - - if (!RamMisc->SRamDetected && !RamMisc->SRamHasSerialEEPROM) { - // check if cart has battery save - if (RomMain[0x1b1] == 'R' && RomMain[0x1b0] == 'A') { - // SRAM info found in header - RamMisc->SRamStart = (RomMain[0x1b5] << 24 | RomMain[0x1b4] << 16 | RomMain[0x1b7] << 8 | RomMain[0x1b6]); - RamMisc->SRamEnd = (RomMain[0x1b9] << 24 | RomMain[0x1b8] << 16 | RomMain[0x1bb] << 8 | RomMain[0x1ba]); - - if ((RamMisc->SRamStart > RamMisc->SRamEnd) || ((RamMisc->SRamEnd - RamMisc->SRamStart) >= 0x10000)) { - RamMisc->SRamEnd = RamMisc->SRamStart + 0x0FFFF; - } - - // for some games using serial EEPROM, difference between SRAM end to start is 0 or 1. Currently EEPROM is not emulated. - if ((RamMisc->SRamEnd - RamMisc->SRamStart) < 2) { - RamMisc->SRamHasSerialEEPROM = 1; - } else { - RamMisc->SRamDetected = 1; - } - } else { - // set default SRAM positions, with size = 64k - RamMisc->SRamStart = 0x200000; - RamMisc->SRamEnd = RamMisc->SRamStart + 0xffff; - } - - if (RamMisc->SRamStart & 1) RamMisc->SRamStart -= 1; - - if (!(RamMisc->SRamEnd & 1)) RamMisc->SRamEnd += 1; - - // calculate backup RAM location - MegadriveBackupRam = (UINT16*) (RomMain + (RamMisc->SRamStart & 0x3fffff)); - - if (RamMisc->SRamDetected) { - bprintf(PRINT_IMPORTANT, _T("SRAM detected in header: start %06x - end %06x\n"), RamMisc->SRamStart, RamMisc->SRamEnd); - } - - // Enable SRAM handlers only if the game does not use EEPROM. - if (!RamMisc->SRamHasSerialEEPROM) { - // Info from DGen: If SRAM does not overlap main ROM, set it active by default since a few games can't manage to properly switch it on/off. - if (RomSize <= RamMisc->SRamStart) { - RamMisc->SRamActive = 1; - } - - SekOpen(0); - SekMapHandler(5, 0xa130f0, 0xa130f1, SM_WRITE); - SekSetWriteByteHandler(5, MegadriveSRAMToggleWriteByte); - SekSetWriteWordHandler(5, MegadriveSRAMToggleWriteWord); - SekClose(); - - // Sonic 1 included in Sonic Classics doesn't have SRAM and does lots of ROM access at this range, then only install read write handlers if SRAM is active to not slow down emulation. - if (RamMisc->SRamActive) InstallSRAMHandlers(true); - } - } -} - -INT32 MegadriveInit() -{ - Mem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - MegadriveLoadRoms(0); - MegadriveLoadRoms(1); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(RomMain, 0x000000, 0x3FFFFF, SM_ROM); // 68000 ROM - SekMapMemory(Ram68K, 0xFF0000, 0xFFFFFF, SM_RAM); // 68000 RAM - - SekMapHandler(1, 0xC00000, 0xC0001F, SM_RAM); // Video Port - SekMapHandler(2, 0xA00000, 0xA01FFF, SM_RAM); // Z80 Ram - SekMapHandler(3, 0xA02000, 0xA03FFF, SM_RAM); // Z80 Ram - SekMapHandler(4, 0xA10000, 0xA1001F, SM_RAM); // I/O - - SekSetReadByteHandler (0, MegadriveReadByte); - SekSetReadWordHandler (0, MegadriveReadWord); - SekSetWriteByteHandler(0, MegadriveWriteByte); - SekSetWriteWordHandler(0, MegadriveWriteWord); - - SekSetReadByteHandler (1, MegadriveVideoReadByte); - SekSetReadWordHandler (1, MegadriveVideoReadWord); - SekSetWriteByteHandler(1, MegadriveVideoWriteByte); - SekSetWriteWordHandler(1, MegadriveVideoWriteWord); - - SekSetReadByteHandler (2, MegadriveZ80RamReadByte); - SekSetReadWordHandler (2, MegadriveZ80RamReadWord); - SekSetWriteByteHandler(2, MegadriveZ80RamWriteByte); - SekSetWriteWordHandler(2, MegadriveZ80RamWriteWord); - - SekSetReadByteHandler (3, MegadriveZ80RamReadByte); - SekSetReadWordHandler (3, MegadriveZ80RamReadWord); - SekSetWriteByteHandler(3, MegadriveZ80RamWriteByte); - SekSetWriteWordHandler(3, MegadriveZ80RamWriteWord); - - SekSetReadByteHandler (4, MegadriveIOReadByte); - SekSetReadWordHandler (4, MegadriveIOReadWord); - SekSetWriteByteHandler(4, MegadriveIOWriteByte); - SekSetWriteWordHandler(4, MegadriveIOWriteWord); - - SekSetIrqCallback( MegadriveIrqCallback ); - SekClose(); - } - - { - ZetInit(0); - ZetOpen(0); - - ZetMapArea(0x0000, 0x1FFF, 0, RamZ80); - ZetMapArea(0x0000, 0x1FFF, 1, RamZ80); - ZetMapArea(0x0000, 0x1FFF, 2, RamZ80); - - ZetMapArea(0x2000, 0x3FFF, 0, RamZ80); - ZetMapArea(0x2000, 0x3FFF, 1, RamZ80); - ZetMapArea(0x2000, 0x3FFF, 2, RamZ80); - - ZetMemEnd(); - - ZetSetReadHandler(MegadriveZ80ProgRead); - ZetSetWriteHandler(MegadriveZ80ProgWrite); - ZetSetInHandler(MegadriveZ80PortRead); - ZetSetOutHandler(MegadriveZ80PortWrite); - ZetClose(); - } - - // OSC_NTSC / 7 - BurnSetRefreshRate(60.0); - - DrvSECAM = 0; - BurnYM2612Init(1, OSC_NTSC / 7, NULL, MegadriveSynchroniseStream, MegadriveGetTime, 0); - BurnTimerAttachSek(OSC_NTSC / 7); - BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - - SN76496Init(0, OSC_NTSC / 15, 1); - SN76496SetRoute(0, 0.25, BURN_SND_ROUTE_BOTH); - - MegadriveSetupSRAM(); - SetupCustomCartridgeMappers(); - - if (MegadriveCallback) MegadriveCallback(); - - pBurnDrvPalette = (UINT32*)MegadriveCurPal; - - MegadriveResetDo(); - - return 0; -} - -INT32 MegadriveExit() -{ - SekExit(); - ZetExit(); - - BurnYM2612Exit(); - SN76496Exit(); - - BurnFree(Mem); - BurnFree(OriginalRom); - - MegadriveCallback = NULL; - cycles_68k = 0; - cycles_z80 = 0; - RomNoByteswap = 0; - MegadriveReset = 0; - RomSize = 0; - RomNum = 0; - SRamSize = 0; - Scanline = 0; - Z80HasBus = 0; - MegadriveZ80Reset = 0; - Hardware = 0; - DrvSECAM = 0; - HighCol = NULL; - - return 0; -} - -//--------------------------------------------------------------- -// Megadrive Draw -//--------------------------------------------------------------- - -static INT32 TileNorm(INT32 sx,INT32 addr,INT32 pal) -{ - UINT8 *pd = HighCol+sx; - UINT32 pack=0; - UINT32 t=0; - - pack = BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid + addr)); // Get 8 pixels - if (pack) { - t=pack&0x0000f000; if (t) pd[0]=(UINT8)(pal|(t>>12)); - t=pack&0x00000f00; if (t) pd[1]=(UINT8)(pal|(t>> 8)); - t=pack&0x000000f0; if (t) pd[2]=(UINT8)(pal|(t>> 4)); - t=pack&0x0000000f; if (t) pd[3]=(UINT8)(pal|(t )); - t=pack&0xf0000000; if (t) pd[4]=(UINT8)(pal|(t>>28)); - t=pack&0x0f000000; if (t) pd[5]=(UINT8)(pal|(t>>24)); - t=pack&0x00f00000; if (t) pd[6]=(UINT8)(pal|(t>>20)); - t=pack&0x000f0000; if (t) pd[7]=(UINT8)(pal|(t>>16)); - return 0; - } - return 1; // Tile blank -} - -static INT32 TileFlip(INT32 sx,INT32 addr,INT32 pal) -{ - UINT8 *pd = HighCol+sx; - UINT32 pack=0; - UINT32 t=0; - - pack = BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid + addr)); // Get 8 pixels - if (pack) { - t=pack&0x000f0000; if (t) pd[0]=(UINT8)(pal|(t>>16)); - t=pack&0x00f00000; if (t) pd[1]=(UINT8)(pal|(t>>20)); - t=pack&0x0f000000; if (t) pd[2]=(UINT8)(pal|(t>>24)); - t=pack&0xf0000000; if (t) pd[3]=(UINT8)(pal|(t>>28)); - t=pack&0x0000000f; if (t) pd[4]=(UINT8)(pal|(t )); - t=pack&0x000000f0; if (t) pd[5]=(UINT8)(pal|(t>> 4)); - t=pack&0x00000f00; if (t) pd[6]=(UINT8)(pal|(t>> 8)); - t=pack&0x0000f000; if (t) pd[7]=(UINT8)(pal|(t>>12)); - return 0; - } - return 1; // Tile blank -} - -// tile renderers for hacky operator sprite support -#define sh_pix(x) \ - if(!t); \ - else if(t==0xe) pd[x]=(UINT8)((pd[x]&0x3f)|0x80); /* hilight */ \ - else if(t==0xf) pd[x]=(UINT8)((pd[x]&0x3f)|0xc0); /* shadow */ \ - else pd[x]=(UINT8)(pal|t); - -static INT32 TileNormSH(INT32 sx,INT32 addr,INT32 pal) -{ - UINT32 pack=0; UINT32 t=0; - UINT8 *pd = HighCol+sx; - - pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels - if (pack) { - t=(pack&0x0000f000)>>12; sh_pix(0); - t=(pack&0x00000f00)>> 8; sh_pix(1); - t=(pack&0x000000f0)>> 4; sh_pix(2); - t=(pack&0x0000000f) ; sh_pix(3); - t=(pack&0xf0000000)>>28; sh_pix(4); - t=(pack&0x0f000000)>>24; sh_pix(5); - t=(pack&0x00f00000)>>20; sh_pix(6); - t=(pack&0x000f0000)>>16; sh_pix(7); - return 0; - } - return 1; // Tile blank -} - -static INT32 TileFlipSH(INT32 sx,INT32 addr,INT32 pal) -{ - UINT32 pack=0; UINT32 t=0; - UINT8 *pd = HighCol+sx; - - pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels - if (pack) { - t=(pack&0x000f0000)>>16; sh_pix(0); - t=(pack&0x00f00000)>>20; sh_pix(1); - t=(pack&0x0f000000)>>24; sh_pix(2); - t=(pack&0xf0000000)>>28; sh_pix(3); - t=(pack&0x0000000f) ; sh_pix(4); - t=(pack&0x000000f0)>> 4; sh_pix(5); - t=(pack&0x00000f00)>> 8; sh_pix(6); - t=(pack&0x0000f000)>>12; sh_pix(7); - return 0; - } - return 1; // Tile blank -} - -static INT32 TileNormZ(INT32 sx,INT32 addr,INT32 pal,INT32 zval) -{ - UINT32 pack=0; - UINT32 t=0; - UINT8 *pd = HighCol+sx; - INT8 *zb = HighSprZ+sx; - INT32 collision = 0, zb_s; - - pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels - if (pack) { - t=pack&0x0000f000; if(t) { zb_s=zb[0]; if(zb_s) collision=1; if(zval>zb_s) { pd[0]=(UINT8)(pal|(t>>12)); zb[0]=(INT8)zval; } } - t=pack&0x00000f00; if(t) { zb_s=zb[1]; if(zb_s) collision=1; if(zval>zb_s) { pd[1]=(UINT8)(pal|(t>> 8)); zb[1]=(INT8)zval; } } - t=pack&0x000000f0; if(t) { zb_s=zb[2]; if(zb_s) collision=1; if(zval>zb_s) { pd[2]=(UINT8)(pal|(t>> 4)); zb[2]=(INT8)zval; } } - t=pack&0x0000000f; if(t) { zb_s=zb[3]; if(zb_s) collision=1; if(zval>zb_s) { pd[3]=(UINT8)(pal|(t )); zb[3]=(INT8)zval; } } - t=pack&0xf0000000; if(t) { zb_s=zb[4]; if(zb_s) collision=1; if(zval>zb_s) { pd[4]=(UINT8)(pal|(t>>28)); zb[4]=(INT8)zval; } } - t=pack&0x0f000000; if(t) { zb_s=zb[5]; if(zb_s) collision=1; if(zval>zb_s) { pd[5]=(UINT8)(pal|(t>>24)); zb[5]=(INT8)zval; } } - t=pack&0x00f00000; if(t) { zb_s=zb[6]; if(zb_s) collision=1; if(zval>zb_s) { pd[6]=(UINT8)(pal|(t>>20)); zb[6]=(INT8)zval; } } - t=pack&0x000f0000; if(t) { zb_s=zb[7]; if(zb_s) collision=1; if(zval>zb_s) { pd[7]=(UINT8)(pal|(t>>16)); zb[7]=(INT8)zval; } } - if(collision) RamVReg->status |= 0x20; - return 0; - } - return 1; // Tile blank -} - -static INT32 TileFlipZ(INT32 sx,INT32 addr,INT32 pal,INT32 zval) -{ - UINT32 pack=0; - UINT32 t=0; - UINT8 *pd = HighCol+sx; - INT8 *zb = HighSprZ+sx; - INT32 collision = 0, zb_s; - - pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels - if (pack) { - t=pack&0x000f0000; if(t) { zb_s=zb[0]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[0]=(UINT8)(pal|(t>>16)); zb[0]=(INT8)zval; } } - t=pack&0x00f00000; if(t) { zb_s=zb[1]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[1]=(UINT8)(pal|(t>>20)); zb[1]=(INT8)zval; } } - t=pack&0x0f000000; if(t) { zb_s=zb[2]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[2]=(UINT8)(pal|(t>>24)); zb[2]=(INT8)zval; } } - t=pack&0xf0000000; if(t) { zb_s=zb[3]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[3]=(UINT8)(pal|(t>>28)); zb[3]=(INT8)zval; } } - t=pack&0x0000000f; if(t) { zb_s=zb[4]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[4]=(UINT8)(pal|(t )); zb[4]=(INT8)zval; } } - t=pack&0x000000f0; if(t) { zb_s=zb[5]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[5]=(UINT8)(pal|(t>> 4)); zb[5]=(INT8)zval; } } - t=pack&0x00000f00; if(t) { zb_s=zb[6]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[6]=(UINT8)(pal|(t>> 8)); zb[6]=(INT8)zval; } } - t=pack&0x0000f000; if(t) { zb_s=zb[7]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[7]=(UINT8)(pal|(t>>12)); zb[7]=(INT8)zval; } } - if(collision) RamVReg->status |= 0x20; - return 0; - } - return 1; // Tile blank -} - - -#define sh_pixZ(x) \ - if(t) { \ - if(zb[x]) collision=1; \ - if(zval>zb[x]) { \ - if (t==0xe) { pd[x]=(UINT8)((pd[x]&0x3f)|0x80); /* hilight */ } \ - else if(t==0xf) { pd[x]=(UINT8)((pd[x]&0x3f)|0xc0); /* shadow */ } \ - else { zb[x]=(INT8)zval; pd[x]=(UINT8)(pal|t); } \ - } \ - } - -static INT32 TileNormZSH(INT32 sx,INT32 addr,INT32 pal,INT32 zval) -{ - UINT32 pack=0; - UINT32 t=0; - UINT8 *pd = HighCol+sx; - INT8 *zb = HighSprZ+sx; - INT32 collision = 0; - - pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels - if (pack) { - t=(pack&0x0000f000)>>12; sh_pixZ(0); - t=(pack&0x00000f00)>> 8; sh_pixZ(1); - t=(pack&0x000000f0)>> 4; sh_pixZ(2); - t=(pack&0x0000000f) ; sh_pixZ(3); - t=(pack&0xf0000000)>>28; sh_pixZ(4); - t=(pack&0x0f000000)>>24; sh_pixZ(5); - t=(pack&0x00f00000)>>20; sh_pixZ(6); - t=(pack&0x000f0000)>>16; sh_pixZ(7); - if(collision) RamVReg->status |= 0x20; - return 0; - } - return 1; // Tile blank -} - -static INT32 TileFlipZSH(INT32 sx,INT32 addr,INT32 pal,INT32 zval) -{ - UINT32 pack=0; - UINT32 t=0; - UINT8 *pd = HighCol+sx; - INT8 *zb = HighSprZ+sx; - INT32 collision = 0; - - pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels - if (pack) { - t=(pack&0x000f0000)>>16; sh_pixZ(0); - t=(pack&0x00f00000)>>20; sh_pixZ(1); - t=(pack&0x0f000000)>>24; sh_pixZ(2); - t=(pack&0xf0000000)>>28; sh_pixZ(3); - t=(pack&0x0000000f) ; sh_pixZ(4); - t=(pack&0x000000f0)>> 4; sh_pixZ(5); - t=(pack&0x00000f00)>> 8; sh_pixZ(6); - t=(pack&0x0000f000)>>12; sh_pixZ(7); - if(collision) RamVReg->status |= 0x20; - return 0; - } - return 1; // Tile blank -} - -static void DrawStrip(struct TileStrip *ts, INT32 sh) -{ - INT32 tilex=0,dx=0,ty=0,code=0,addr=0,cells; - INT32 oldcode=-1,blank=-1; // The tile we know is blank - INT32 pal=0; - - // Draw tiles across screen: - tilex = (-ts->hscroll)>>3; - ty = (ts->line&7)<<1; // Y-Offset into tile - dx = ((ts->hscroll-1)&7)+1; - cells = ts->cells; - if(dx != 8) cells++; // have hscroll, need to draw 1 cell more - - for (; cells; dx+=8,tilex++,cells--) { - INT32 zero=0; - - code=BURN_ENDIAN_SWAP_INT16(RamVid[ts->nametab + (tilex&ts->xmask)]); - if (code==blank) continue; - if (code>>15) { // high priority tile - INT32 cval = code | (dx<<16) | (ty<<25); - if(code&0x1000) cval^=7<<26; - *ts->hc++ = cval; // cache it - continue; - } - - if (code!=oldcode) { - oldcode = code; - // Get tile address/2: - addr=(code&0x7ff)<<4; - addr+=ty; - if (code&0x1000) addr^=0xe; // Y-flip - pal=((code>>9)&0x30)|(sh<<6); - } - - if (code&0x0800) zero=TileFlip(dx,addr,pal); - else zero=TileNorm(dx,addr,pal); - - if (zero) blank=code; // We know this tile is blank now - } - - // terminate the cache list - *ts->hc = 0; -} - -static void DrawStripVSRam(struct TileStrip *ts, INT32 plane) -{ - INT32 tilex=0,dx=0,ty=0,code=0,addr=0,cell=0,nametabadd=0; - INT32 oldcode=-1,blank=-1; // The tile we know is blank - INT32 pal=0,scan=Scanline; - - // Draw tiles across screen: - tilex=(-ts->hscroll)>>3; - dx=((ts->hscroll-1)&7)+1; - if(dx != 8) { - INT32 vscroll, line; - cell--; // have hscroll, start with negative cell - // also calculate intial VS stuff - vscroll = BURN_ENDIAN_SWAP_INT16(RamSVid[plane]); - - // Find the line in the name table - line = (vscroll+scan)&ts->line&0xffff; // ts->line is really ymask .. - nametabadd = (line>>3)<<(ts->line>>24); // .. and shift[width] - ty = (line&7)<<1; // Y-Offset into tile - } - - for (; cell < ts->cells; dx+=8,tilex++,cell++) { - INT32 zero=0; - - if((cell&1)==0) { - INT32 line,vscroll; - vscroll = BURN_ENDIAN_SWAP_INT16(RamSVid[plane+(cell&~1)]); - - // Find the line in the name table - line = (vscroll+scan)&ts->line&0xffff; // ts->line is really ymask .. - nametabadd = (line>>3)<<(ts->line>>24); // .. and shift[width] - ty = (line&7)<<1; // Y-Offset into tile - } - - code = BURN_ENDIAN_SWAP_INT16(RamVid[ts->nametab + nametabadd + (tilex&ts->xmask)]); - if (code==blank) continue; - if (code>>15) { // high priority tile - INT32 cval = code | (dx<<16) | (ty<<25); - if(code&0x1000) cval^=7<<26; - *ts->hc++ = cval; // cache it - continue; - } - - if (code!=oldcode) { - oldcode = code; - // Get tile address/2: - addr=(code&0x7ff)<<4; - if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip - pal=((code>>9)&0x30); - } - - if (code&0x0800) zero=TileFlip(dx,addr,pal); - else zero=TileNorm(dx,addr,pal); - - if (zero) blank=code; // We know this tile is blank now - } - - // terminate the cache list - *ts->hc = 0; -} - -static void DrawStripInterlace(struct TileStrip *ts) -{ - INT32 tilex=0,dx=0,ty=0,code=0,addr=0,cells; - INT32 oldcode=-1,blank=-1; // The tile we know is blank - INT32 pal=0; - - // Draw tiles across screen: - tilex=(-ts->hscroll)>>3; - ty=(ts->line&15)<<1; // Y-Offset into tile - dx=((ts->hscroll-1)&7)+1; - cells = ts->cells; - if(dx != 8) cells++; // have hscroll, need to draw 1 cell more - - for (; cells; dx+=8,tilex++,cells--) { - INT32 zero=0; - - code=BURN_ENDIAN_SWAP_INT16(RamVid[ts->nametab+(tilex&ts->xmask)]); - if (code==blank) continue; - if (code>>15) { // high priority tile - INT32 cval = (code&0xfc00) | (dx<<16) | (ty<<25); - cval |= (code&0x3ff)<<1; - if(code&0x1000) cval^=0xf<<26; - *ts->hc++ = cval; // cache it - continue; - } - - if (code!=oldcode) { - oldcode = code; - // Get tile address/2: - addr=(code&0x7ff)<<5; - if (code&0x1000) addr+=30-ty; else addr+=ty; // Y-flip - pal=((code>>9)&0x30); - } - - if (code&0x0800) zero=TileFlip(dx,addr,pal); - else zero=TileNorm(dx,addr,pal); - - if (zero) blank=code; // We know this tile is blank now - } - - // terminate the cache list - *ts->hc = 0; -} - -static void DrawLayer(INT32 plane, INT32 *hcache, INT32 maxcells, INT32 sh) -{ - const INT8 shift[4]={5,6,5,7}; // 32,64 or 128 sized tilemaps (2 is invalid) - struct TileStrip ts; - INT32 width, height, ymask; - INT32 vscroll, htab; - - ts.hc = hcache; - ts.cells = maxcells; - - // Work out the TileStrip to draw - - // Work out the name table size: 32 64 or 128 tiles (0-3) - width = RamVReg->reg[16]; - height = (width>>4)&3; - width &= 3; - - ts.xmask=(1<1) ymask =0x0ff; - - // Find name table: - if (plane==0) ts.nametab=(RamVReg->reg[2] & 0x38)<< 9; // A - else ts.nametab=(RamVReg->reg[4] & 0x07)<<12; // B - - htab = RamVReg->reg[13] << 9; // Horizontal scroll table address - if ( RamVReg->reg[11] & 2) htab += Scanline<<1; // Offset by line - if ((RamVReg->reg[11] & 1)==0) htab &= ~0xf; // Offset by tile - htab += plane; // A or B - - // Get horizontal scroll value, will be masked later - ts.hscroll = BURN_ENDIAN_SWAP_INT16(RamVid[htab & 0x7fff]); - - if((RamVReg->reg[12]&6) == 6) { - // interlace mode 2 - vscroll = BURN_ENDIAN_SWAP_INT16(RamSVid[plane]); // Get vertical scroll value - - // Find the line in the name table - ts.line=(vscroll+(Scanline<<1))&((ymask<<1)|1); - ts.nametab+=(ts.line>>4)<reg[11]&4) { - // shit, we have 2-cell column based vscroll - // luckily this doesn't happen too often - ts.line = ymask | (shift[width]<<24); // save some stuff instead of line - DrawStripVSRam(&ts, plane); - } else { - vscroll = BURN_ENDIAN_SWAP_INT16(RamSVid[plane]); // Get vertical scroll value - - // Find the line in the name table - ts.line = (vscroll+Scanline)&ymask; - ts.nametab += (ts.line>>3)<reg[3] & 0x3c)<<9; - if (RamVReg->reg[12] & 1) nametab += (Scanline>>3)<<6; // 40-cell mode - else nametab += (Scanline>>3)<<5; // 32-cell mode - - tilex = tstart<<1; - tend <<= 1; - - ty = (Scanline & 7)<<1; // Y-Offset into tile - - if(!(rendstatus & 2)) { - // check the first tile code - code = BURN_ENDIAN_SWAP_INT16(RamVid[nametab + tilex]); - // if the whole window uses same priority (what is often the case), we may be able to skip this field - if((code>>15) != prio) return; - } - - // Draw tiles across screen: - for (; tilex < tend; tilex++) { - INT32 addr=0, zero=0, pal; - - code = BURN_ENDIAN_SWAP_INT16(RamVid[nametab + tilex]); - if(code==blank) continue; - if((code>>15) != prio) { - rendstatus |= 2; - continue; - } - - pal=((code>>9)&0x30); - - if(sh) { - INT32 tmp, *zb = (INT32 *)(HighCol+8+(tilex<<3)); - if(prio) { - tmp = *zb; - if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000; - if(!(tmp&0x00800000)) tmp&=~0x00c00000; if(!(tmp&0x80000000)) tmp&=~0xc0000000; - *zb++=tmp; tmp = *zb; - if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000; - if(!(tmp&0x00800000)) tmp&=~0x00c00000; if(!(tmp&0x80000000)) tmp&=~0xc0000000; - *zb++=tmp; - } else { - pal |= 0x40; - } - } - - // Get tile address/2: - addr = (code&0x7ff)<<4; - if (code&0x1000) addr += 14-ty; else addr += ty; // Y-flip - - if (code&0x0800) zero = TileFlip(8+(tilex<<3),addr,pal); - else zero = TileNorm(8+(tilex<<3),addr,pal); - - if (zero) blank = code; // We know this tile is blank now - } - // terminate the cache list - //*hcache = 0; -} - -static void DrawTilesFromCache(INT32 *hc, INT32 sh) -{ - INT32 code, addr, zero, dx; - INT32 pal; - INT16 blank=-1; // The tile we know is blank - - // *ts->hc++ = code | (dx<<16) | (ty<<25); // cache it - - while((code = *hc++)) { - if(!sh && (INT16)code == blank) continue; - - // Get tile address/2: - addr=(code&0x7ff)<<4; - addr+=(UINT32)code>>25; // y offset into tile - dx=(code>>16)&0x1ff; - if(sh) { - UINT8 *zb = HighCol+dx; - if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++; - if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++; - if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++; - if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++; - } - - pal=((code>>9)&0x30); - - if (code&0x0800) zero=TileFlip(dx,addr,pal); - else zero=TileNorm(dx,addr,pal); - - if(zero) blank=(INT16)code; - } -} - -// Index + 0 : hhhhvvvv ab--hhvv yyyyyyyy yyyyyyyy // a: offscreen h, b: offs. v, h: horiz. size -// Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8 - -static void DrawSprite(INT32 *sprite, INT32 **hc, INT32 sh) -{ - INT32 width=0,height=0; - INT32 row=0,code=0; - INT32 pal; - INT32 tile=0,delta=0; - INT32 sx, sy; - INT32 (*fTileFunc)(INT32 sx,INT32 addr,INT32 pal); - - // parse the sprite data - sy=sprite[0]; - code=sprite[1]; - sx=code>>16; // X - width=sy>>28; - height=(sy>>24)&7; // Width and height in tiles - sy=(sy<<16)>>16; // Y - - row=Scanline-sy; // Row of the sprite we are on - - if (code&0x1000) row=(height<<3)-1-row; // Flip Y - - tile=code&0x7ff; // Tile number - tile+=row>>3; // Tile number increases going down - delta=height; // Delta to increase tile by going right - if (code&0x0800) { tile+=delta*(width-1); delta=-delta; } // Flip X - - tile<<=4; tile+=(row&7)<<1; // Tile address - - if(code&0x8000) { // high priority - cache it - *(*hc)++ = (tile<<16)|((code&0x0800)<<5)|((sx<<6)&0x0000ffc0)|((code>>9)&0x30)|((sprite[0]>>16)&0xf); - } else { - delta<<=4; // Delta of address - pal=((code>>9)&0x30)|(sh<<6); - - if(sh && (code&0x6000) == 0x6000) { - if(code&0x0800) fTileFunc=TileFlipSH; - else fTileFunc=TileNormSH; - } else { - if(code&0x0800) fTileFunc=TileFlip; - else fTileFunc=TileNorm; - } - - for (; width; width--,sx+=8,tile+=delta) { - if(sx<=0) continue; - if(sx>=328) break; // Offscreen - - tile&=0x7fff; // Clip tile address - fTileFunc(sx,tile,pal); - } - } -} - -// Index + 0 : hhhhvvvv s---hhvv yyyyyyyy yyyyyyyy // s: skip flag, h: horiz. size -// Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8 - -static void DrawSpriteZ(INT32 pack, INT32 pack2, INT32 shpri, INT32 sprio) -{ - INT32 width=0,height=0; - INT32 row=0; - INT32 pal; - INT32 tile=0,delta=0; - INT32 sx, sy; - INT32 (*fTileFunc)(INT32 sx,INT32 addr,INT32 pal,INT32 zval); - - // parse the sprite data - sx = pack2>>16; // X - sy = (pack <<16)>>16; // Y - width = pack >>28; - height= (pack >>24)&7; // Width and height in tiles - - row = Scanline-sy; // Row of the sprite we are on - - if (pack2&0x1000) row=(height<<3)-1-row; // Flip Y - - tile = pack2&0x7ff; // Tile number - tile+= row>>3; // Tile number increases going down - delta=height; // Delta to increase tile by going right - if (pack2&0x0800) { // Flip X - tile += delta*(width-1); - delta = -delta; - } - - tile<<=4; - tile+=(row&7)<<1; // Tile address - delta<<=4; // Delta of address - pal=((pack2>>9)&0x30); - if((shpri&1)&&!(shpri&2)) pal|=0x40; - - shpri&=1; - if((pack2&0x6000) != 0x6000) shpri = 0; - shpri |= (pack2&0x0800)>>10; - switch(shpri) { - default: - case 0: fTileFunc=TileNormZ; break; - case 1: fTileFunc=TileNormZSH; break; - case 2: fTileFunc=TileFlipZ; break; - case 3: fTileFunc=TileFlipZSH; break; - } - - for (; width; width--,sx+=8,tile+=delta) { - if(sx<=0) continue; - if(sx>=328) break; // Offscreen - - tile&=0x7fff; // Clip tile address - fTileFunc(sx,tile,pal,sprio); - } -} - - -static void DrawSpriteInterlace(UINT32 *sprite) -{ - INT32 width=0,height=0; - INT32 row=0,code=0; - INT32 pal; - INT32 tile=0,delta=0; - INT32 sx, sy; - - // parse the sprite data - sy=sprite[0]; - height=sy>>24; - sy=(sy&0x3ff)-0x100; // Y - width=(height>>2)&3; height&=3; - width++; height++; // Width and height in tiles - - row=(Scanline<<1)-sy; // Row of the sprite we are on - - code=sprite[1]; - sx=((code>>16)&0x1ff)-0x78; // X - - if (code&0x1000) row^=(16<>4; // Tile number increases going down - delta=height; // Delta to increase tile by going right - if (code&0x0800) { tile+=delta*(width-1); delta=-delta; } // Flip X - - tile<<=5; tile+=(row&15)<<1; // Tile address - - delta<<=5; // Delta of address - pal=((code>>9)&0x30); // Get palette pointer - - for (; width; width--,sx+=8,tile+=delta) { - if(sx<=0) continue; - if(sx>=328) break; // Offscreen - - tile&=0x7fff; // Clip tile address - if (code&0x0800) TileFlip(sx,tile,pal); - else TileNorm(sx,tile,pal); - } -} - - -static void DrawAllSpritesInterlace(INT32 pri, INT32 maxwidth) -{ - INT32 i,u,table,link=0,sline=Scanline<<1; - UINT32 *sprites[80]; // Sprite index - - table = RamVReg->reg[5]&0x7f; - if (RamVReg->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode - table<<=8; // Get sprite table address/2 - - for (i=u=0; u < 80 && i < 21; u++) { - UINT32 *sprite; - INT32 code, sx, sy, height; - - sprite=(UINT32 *)(RamVid+((table+(link<<2))&0x7ffc)); // Find sprite - - // get sprite info - code = BURN_ENDIAN_SWAP_INT32(sprite[0]); - sx = BURN_ENDIAN_SWAP_INT32(sprite[1]); - if(((sx>>15)&1) != pri) goto nextsprite; // wrong priority sprite - - // check if it is on this line - sy = (code&0x3ff)-0x100; - height = (((code>>24)&3)+1)<<4; - if(sline < sy || sline >= sy+height) goto nextsprite; // no - - // check if sprite is not hidden offscreen - sx = (sx>>16)&0x1ff; - sx -= 0x78; // Get X coordinate + 8 - if(sx <= -8*3 || sx >= maxwidth) goto nextsprite; - - // sprite is good, save it's pointer - sprites[i++]=sprite; - - nextsprite: - // Find next sprite - link=(code>>16)&0x7f; - if(!link) break; // End of sprites - } - - // Go through sprites backwards: - for (i-- ;i>=0; i--) - DrawSpriteInterlace(sprites[i]); -} - -static void DrawSpritesFromCache(INT32 *hc, INT32 sh) -{ - INT32 code, tile, sx, delta, width; - INT32 pal; - INT32 (*fTileFunc)(INT32 sx,INT32 addr,INT32 pal); - - // *(*hc)++ = (tile<<16)|((code&0x0800)<<5)|((sx<<6)&0x0000ffc0)|((code>>9)&0x30)|((sprite[0]>>24)&0xf); - - while((code=*hc++)) { - pal=(code&0x30); - delta=code&0xf; - width=delta>>2; delta&=3; - width++; delta++; // Width and height in tiles - if (code&0x10000) delta=-delta; // Flip X - delta<<=4; - tile=((UINT32)code>>17)<<1; - sx=(code<<16)>>22; // sx can be negative (start offscreen), so sign extend - - if(sh && pal == 0x30) { // - if(code&0x10000) fTileFunc=TileFlipSH; - else fTileFunc=TileNormSH; - } else { - if(code&0x10000) fTileFunc=TileFlip; - else fTileFunc=TileNorm; - } - - for (; width; width--,sx+=8,tile+=delta) { - if(sx<=0) continue; - if(sx>=328) break; // Offscreen - - tile&=0x7fff; // Clip tile address - fTileFunc(sx,tile,pal); - } - } -} - -// Index + 0 : ----hhvv -lllllll -------y yyyyyyyy -// Index + 4 : -------x xxxxxxxx pccvhnnn nnnnnnnn -// v -// Index + 0 : hhhhvvvv ab--hhvv yyyyyyyy yyyyyyyy // a: offscreen h, b: offs. v, h: horiz. size -// Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8 - -static void PrepareSprites(INT32 full) -{ - INT32 u=0,link=0,sblocks=0; - INT32 table=0; - INT32 *pd = HighPreSpr; - - table=RamVReg->reg[5]&0x7f; - if (RamVReg->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode - table<<=8; // Get sprite table address/2 - - if (!full) { - INT32 pack; - // updates: tilecode, sx - for (u=0; u < 80 && (pack = *pd); u++, pd+=2) { - UINT32 *sprite; - INT32 code, code2, sx, sy, skip=0; - - sprite=(UINT32 *)(RamVid+((table+(link<<2))&0x7ffc)); // Find sprite - - // parse sprite info - code = BURN_ENDIAN_SWAP_INT32(sprite[0]); - code2 = BURN_ENDIAN_SWAP_INT32(sprite[1]); - code2 &= ~0xfe000000; - code2 -= 0x00780000; // Get X coordinate + 8 in upper 16 bits - sx = code2>>16; - - if((sx <= 8-((pack>>28)<<3) && sx >= -0x76) || sx >= 328) skip=1<<23; - else if ((sy = (pack<<16)>>16) < 240 && sy > -32) { - INT32 sbl = (2<<(pack>>28))-1; - sblocks |= sbl<<(sy>>3); - } - - *pd = (pack&~(1<<23))|skip; - *(pd+1) = code2; - - // Find next sprite - link=(code>>16)&0x7f; - if(!link) break; // End of sprites - } - SpriteBlocks |= sblocks; - } else { - for (; u < 80; u++) { - UINT32 *sprite; - INT32 code, code2, sx, sy, hv, height, width, skip=0, sx_min; - - sprite=(UINT32 *)(RamVid+((table+(link<<2))&0x7ffc)); // Find sprite - - // parse sprite info - code = BURN_ENDIAN_SWAP_INT32(sprite[0]); - sy = (code&0x1ff)-0x80; - hv = (code>>24)&0xf; - height = (hv&3)+1; - - if(sy > 240 || sy + (height<<3) <= 0) skip|=1<<22; - - width = (hv>>2)+1; - code2 = BURN_ENDIAN_SWAP_INT32(sprite[1]); - sx = (code2>>16)&0x1ff; - sx -= 0x78; // Get X coordinate + 8 - sx_min = 8-(width<<3); - - if((sx <= sx_min && sx >= -0x76) || sx >= 328) skip|=1<<23; - else if (sx > sx_min && !skip) { - INT32 sbl = (2<>3; - if(shi < 0) shi=0; // negative sy - sblocks |= sbl<>16)&0x7f; - if(!link) break; // End of sprites - } - SpriteBlocks = sblocks; - *pd = 0; // terminate - } -} - -static void DrawAllSprites(INT32 *hcache, INT32 maxwidth, INT32 prio, INT32 sh) -{ - INT32 i,u,n; - INT32 sx1seen=0; // sprite with x coord 1 or 0 seen - INT32 ntiles = 0; // tile counter for sprite limit emulation - INT32 *sprites[40]; // Sprites to draw in fast mode - INT32 *ps, pack, rs = rendstatus, scan=Scanline; - - if(rs&8) { - DrawAllSpritesInterlace(prio, maxwidth); - return; - } - if(rs&0x11) { - //dprintf("PrepareSprites(%i) [%i]", (rs>>4)&1, scan); - PrepareSprites(rs&0x10); - rendstatus=rs&~0x11; - } - if (!(SpriteBlocks & (1<<(scan>>3)))) return; - - if(((rs&4)||sh)&&prio==0) - memset(HighSprZ, 0, 328); - if(!(rs&4)&&prio) { - if(hcache[0]) DrawSpritesFromCache(hcache, sh); - return; - } - - ps = HighPreSpr; - - // Index + 0 : hhhhvvvv ab--hhvv yyyyyyyy yyyyyyyy // a: offscreen h, b: offs. v, h: horiz. size - // Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8 - - for(i=u=n=0; (pack = *ps) && n < 20; ps+=2, u++) { - INT32 sx, sy, row, pack2; - - if(pack & 0x00400000) continue; - - // get sprite info - pack2 = *(ps+1); - sx = pack2>>16; - sy = (pack <<16)>>16; - row = scan-sy; - - //dprintf("x: %i y: %i %ix%i", sx, sy, (pack>>28)<<3, (pack>>21)&0x38); - - if(sx == -0x77) sx1seen |= 1; // for masking mode 2 - - // check if it is on this line - if(row < 0 || row >= ((pack>>21)&0x38)) continue; // no - n++; // number of sprites on this line (both visible and hidden, max is 20) [broken] - - // sprite limit - ntiles += pack>>28; - if(ntiles > 40) break; - - if(pack & 0x00800000) continue; - - // masking sprite? - if(sx == -0x78) { - if(!(sx1seen&1) || sx1seen==3) { - break; // this sprite is not drawn and remaining sprites are masked - } - if((sx1seen>>8) == 0) sx1seen=(i+1)<<8; - continue; - } - else if(sx == -0x77) { - // masking mode2 (Outrun, Galaxy Force II, Shadow of the beast) - if(sx1seen>>8) { - i=(sx1seen>>8)-1; - break; - } // seen both 0 and 1 - sx1seen |= 2; - continue; - } - - // accurate sprites - //dprintf("P:%i",((sx>>15)&1)); - if(rs&4) { - // might need to skip this sprite - if((pack2&0x8000) ^ (prio<<15)) continue; - DrawSpriteZ(pack,pack2,sh|(prio<<1),(INT8)(0x1f-n)); - continue; - } - - // sprite is good, save it's pointer - sprites[i++]=ps; - } - - // Go through sprites backwards: - if(!(rs&4)) { - for (i--; i>=0; i--) - DrawSprite(sprites[i],&hcache,sh); - - // terminate cache list - *hcache = 0; - } -} - - -static void BackFill(INT32 reg7, INT32 sh) -{ - // Start with a blank scanline (background colour): - UINT32 *pd = (UINT32 *)(HighCol+8); - UINT32 *end= (UINT32 *)(HighCol+8+320); - UINT32 back = reg7 & 0x3f; - back |= sh<<6; - back |= back<<8; - back |= back<<16; - do { pd[0]=pd[1]=pd[2]=pd[3]=back; pd+=4; } while (pd < end); -} - - -static INT32 DrawDisplay(INT32 sh) -{ - INT32 maxw, maxcells; - INT32 win=0, edge=0, hvwind=0; - - if(RamVReg->reg[12] & 1) { - maxw = 328; maxcells = 40; - } else { - maxw = 264; maxcells = 32; - } - - // Find out if the window is on this line: - win = RamVReg->reg[0x12]; - edge = (win & 0x1f)<<3; - - if (win&0x80) { if (Scanline>=edge) hvwind=1; } - else { if (Scanline< edge) hvwind=1; } - - if(!hvwind) { // we might have a vertical window here - win = RamVReg->reg[0x11]; - edge = win&0x1f; - if(win&0x80) { - if(!edge) hvwind=1; - else if(edge < (maxcells>>1)) hvwind=2; - } else { - if(!edge); - else if(edge < (maxcells>>1)) hvwind=2; - else hvwind=1; - } - } - - DrawLayer(1, HighCacheB, maxcells, sh); - if(hvwind == 1) - DrawWindow(0, maxcells>>1, 0, sh); // HighCacheAW - else if(hvwind == 2) { - // ahh, we have vertical window - DrawLayer(0, HighCacheA, (win&0x80) ? edge<<1 : maxcells, sh); - DrawWindow((win&0x80) ? edge : 0, (win&0x80) ? maxcells>>1 : edge, 0, sh); // HighCacheW - } else - DrawLayer(0, HighCacheA, maxcells, sh); - DrawAllSprites(HighCacheS, maxw, 0, sh); - - if(HighCacheB[0]) - DrawTilesFromCache(HighCacheB, sh); - if(hvwind == 1) - DrawWindow(0, maxcells>>1, 1, sh); - else if(hvwind == 2) { - if(HighCacheA[0]) DrawTilesFromCache(HighCacheA, sh); - DrawWindow((win&0x80) ? edge : 0, (win&0x80) ? maxcells>>1 : edge, 1, sh); - } else - if(HighCacheA[0]) DrawTilesFromCache(HighCacheA, sh); - DrawAllSprites(HighCacheS, maxw, 1, sh); - - return 0; -} - -static void PicoFrameStart() -{ - // prepare to do this frame - rendstatus = 0x80 >> 5; // accurate sprites - RamVReg->status &= ~0x0020; - if((RamVReg->reg[12]&6) == 6) rendstatus |= 8; // interlace mode - //if(Pico.m.dirtyPal) Pico.m.dirtyPal = 2; // reset dirty if needed - PrepareSprites(1); -} - -static INT32 PicoLine(INT32 /*scan*/) -{ - INT32 sh = (RamVReg->reg[0xC] & 8)>>3; // shadow/hilight? - - BackFill(RamVReg->reg[7], sh); - if (RamVReg->reg[1] & 0x40) - DrawDisplay(sh); - - { - INT32 num = Scanline + 1; - if (!(RamVReg->reg[1] & 8)) num += 8; - HighCol = HighColFull + ( num * (8 + 320 + 8) ); - }; - - return 0; -} - -static void MegadriveDraw() -{ - UINT16 * pDest = (UINT16 *)pBurnDraw; - - if ((RamVReg->reg[12]&1) || !(MegadriveDIP[1] & 0x03)) { - - for (INT32 j=0; j<224; j++) { - UINT8 * pSrc = HighColFull + (j+9)*(8+320+8) + 8; - for (INT32 i=0;i<320;i++) - pDest[i] = MegadriveCurPal[ pSrc[i] ]; - pDest += 320; - } - - } else { - - if (( MegadriveDIP[1] & 0x03 ) == 0x01 ) { - // Center - pDest += 32; - for (INT32 j=0; j<224; j++) { - UINT8 * pSrc = HighColFull + (j+9)*(8+320+8) + 8; - - memset((UINT8 *)pDest - 32*2, 0, 64); - - for (INT32 i=0;i<256;i++) - pDest[i] = MegadriveCurPal[ pSrc[i] ]; - - memset((UINT8 *)pDest + 256*2, 0, 64); - - pDest += 320; - } - } else { - // Zoom - for (INT32 j=0; j<224; j++) { - UINT8 * pSrc = HighColFull + (j+9)*(8+320+8) + 8; - UINT32 delta = 0; - for (INT32 i=0;i<320;i++) { - pDest[i] = MegadriveCurPal[ pSrc[ delta >> 16 ] ]; - delta += 0xCCCC; - } - pDest += 320; - } - } - - } -} - -#define TOTAL_68K_CYCLES ((double)OSC_NTSC / 7) / 60 -#define TOTAL_Z80_CYCLES ((double)OSC_NTSC / 15) / 60 -#define TOTAL_68K_CYCLES_PAL ((double)OSC_PAL / 7) / 50 -#define TOTAL_Z80_CYCLES_PAL ((double)OSC_PAL / 15) / 50 - -INT32 MegadriveFrame() -{ - if (MegadriveReset) { - MegadriveResetDo(); - MegadriveReset = 0; - } - - if (bMegadriveRecalcPalette) { - for (INT32 i=0;i<0x40;i++) - CalcCol(i, BURN_ENDIAN_SWAP_INT16(RamPal[i])); - bMegadriveRecalcPalette = 0; - } - - JoyPad->pad[0] = JoyPad->pad[1] = JoyPad->pad[2] = JoyPad->pad[3] = 0; - for (INT32 i = 0; i < 12; i++) { - JoyPad->pad[0] |= (MegadriveJoy1[i] & 1) << i; - JoyPad->pad[1] |= (MegadriveJoy2[i] & 1) << i; - JoyPad->pad[2] |= (MegadriveJoy3[i] & 1) << i; - JoyPad->pad[3] |= (MegadriveJoy4[i] & 1) << i; - } - - - SekNewFrame(); - ZetNewFrame(); - - HighCol = HighColFull; - PicoFrameStart(); - - INT32 lines,lines_vis = 224,line_sample; - INT32 done_z80 = 0; - INT32 hint = RamVReg->reg[10]; // Hint counter - INT32 total_68k_cycles, total_z80_cycles; - - if( Hardware & 0x40 ) { - lines = 313; - line_sample = 68; - if( RamVReg->reg[1]&8 ) lines_vis = 240; - total_68k_cycles = (INT32)(INT64)(TOTAL_68K_CYCLES_PAL * nBurnCPUSpeedAdjust / 0x100); - total_z80_cycles = (INT32)TOTAL_Z80_CYCLES_PAL; - } else { - lines = 262; - line_sample = 93; - total_68k_cycles = (INT32)(INT64)(TOTAL_68K_CYCLES * nBurnCPUSpeedAdjust / 0x100); - total_z80_cycles = (INT32)TOTAL_Z80_CYCLES; - } - - cycles_68k = total_68k_cycles / lines; - cycles_z80 = total_z80_cycles / lines; - - RamVReg->status &= ~0x88; // clear V-Int, come out of vblank - - for (INT32 y=0; ypadDelay[0]++ > 25) JoyPad->padTHPhase[0] = 0; - if(JoyPad->padDelay[1]++ > 25) JoyPad->padTHPhase[1] = 0; - } - - // H-Interrupts: - if((y <= lines_vis) && (--hint < 0)) { // y <= lines_vis: Comix Zone, Golden Axe - //dprintf("rhint:old @ %06x", SekPc); - hint = RamVReg->reg[10]; // Reload H-Int counter - RamVReg->pending_ints |= 0x10; - if (RamVReg->reg[0] & 0x10) { - SekOpen(0); - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - } - } - - // V-Interrupt: - if (y == lines_vis) { - //dprintf("vint: @ %06x [%i|%i]", SekPc, y, SekCycleCnt); - RamVReg->status |= 0x88; // V-Int happened, go into vblank - - // there must be a gap between H and V ints, also after vblank bit set (Mazin Saga, Bram Stoker's Dracula) - SekOpen(0); -// done_68k+=SekRun(128); - BurnTimerUpdate((y * cycles_68k) + 128 - cycles_68k); - SekClose(); - - RamVReg->pending_ints |= 0x20; - if(RamVReg->reg[1] & 0x20) { - SekOpen(0); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - SekClose(); - } - } - - // decide if we draw this line - if ((!(RamVReg->reg[1]&8) && y<=224) || ((RamVReg->reg[1]&8) && y<240)) - PicoLine(y); - - // Run scanline - SekOpen(0); - BurnTimerUpdate(y * cycles_68k); - SekClose(); - - if (Z80HasBus && !MegadriveZ80Reset) { - ZetOpen(0); - done_z80 += ZetRun(cycles_z80); - if (y == line_sample) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (y == line_sample + 1) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - } - } - - if (pBurnDraw) MegadriveDraw(); - - SekOpen(0); - BurnTimerEndFrame(total_68k_cycles); - SekClose(); - - if (Z80HasBus && !MegadriveZ80Reset) { - if (done_z80 < total_z80_cycles) { - ZetOpen(0); - ZetRun(total_z80_cycles - done_z80); - ZetClose(); - } - } - - if (pBurnSoundOut) { - SekOpen(0); - BurnYM2612Update(pBurnSoundOut, nBurnSoundLen); - SekClose(); - SN76496Update(0, pBurnSoundOut, nBurnSoundLen); - } - - return 0; -} - -INT32 MegadriveScan(INT32 /*nAction*/, INT32 * /*pnMin*/) -{ - //BurnYM2612Scan(nAction, pnMin); - - return 1; -} +/******************************************************************************** + SEGA Genesis / Mega Drive Driver for FBA + ******************************************************************************** + This is part of Pico Library v0936 + + (c) Copyright 2004 Dave, All rights reserved. + (c) Copyright 2006 notaz, All rights reserved. + Free for non-commercial use. + + For commercial use, separate licencing terms must be obtained. + ******************************************************************************** + + PicoOpt bits LSb->MSb: + enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound, + alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites, + draw_no_32col_border, external_ym2612 + + ******************************************************************************** + Port by OopsWare + ********************************************************************************/ + +#include "burnint.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2612.h" +#include "sn76496.h" +#include "megadrive.h" +#include "bitswap.h" +#include "m68000_debug.h" + +#define OSC_NTSC 53693175 +#define OSC_PAL 53203424 + +#define MAX_CARTRIDGE_SIZE 0xc00000 +#define MAX_SRAM_SIZE 0x010000 + +static INT32 cycles_68k, cycles_z80; + +typedef void (*MegadriveCb)(); +static MegadriveCb MegadriveCallback; + +struct PicoVideo { + UINT8 reg[0x20]; + UINT32 command; // 32-bit Command + UINT8 pending; // 1 if waiting for second half of 32-bit command + UINT8 type; // Command type (v/c/vsram read/write) + UINT16 addr; // Read/Write address + INT32 status; // Status bits + UINT8 pending_ints; // pending interrupts: ??VH???? + UINT8 pad[0x13]; // +}; + +struct PicoMisc { + UINT32 Z80Run; + UINT32 Bank68k; + UINT8 Rotate; + +// UINT8 Pad[3]; + +// UINT32 SRamReg; + UINT32 SRamStart; + UINT32 SRamEnd; + UINT32 SRamDetected; + UINT32 SRamActive; + UINT32 SRamHandlersInstalled; + UINT32 SRamReadOnly; + UINT32 SRamHasSerialEEPROM; + + UINT8 I2CMem; + UINT8 I2CClk; + + UINT16 JCartIOData[2]; + + UINT8 L3AltPDat; + UINT8 L3AltPCmd; + + UINT16 SquirrelkingExtra; + + UINT16 Lionk2ProtData; + UINT16 Lionk2ProtData2; + + UINT32 RealtecBankAddr; + UINT32 RealtecBankSize; +}; + +struct TileStrip +{ + INT32 nametab; // Position in VRAM of name table (for this tile line) + INT32 line; // Line number in pixels 0x000-0x3ff within the virtual tilemap + INT32 hscroll; // Horizontal scroll value in pixels for the line + INT32 xmask; // X-Mask (0x1f - 0x7f) for horizontal wraparound in the tilemap + INT32 *hc; // cache for high tile codes and their positions + INT32 cells; // cells (tiles) to draw (32 col mode doesn't need to update whole 320) +}; + +struct MegadriveJoyPad { + UINT16 pad[4]; + UINT8 padTHPhase[4]; + UINT8 padDelay[4]; +}; + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; + +static UINT8 *RomMain; +static UINT8 *OriginalRom; + +static UINT8 *Ram68K; +static UINT8 *RamZ80; + +static UINT8 *SRam; +static UINT8 *RamIO; + +static UINT16 *RamPal; +static UINT16 *RamVid; +static UINT16 *RamSVid; +static struct PicoVideo *RamVReg; +static struct PicoMisc *RamMisc; +static struct MegadriveJoyPad *JoyPad; + +UINT16 *MegadriveCurPal; + +static UINT16 *MegadriveBackupRam; + +static UINT8 *HighCol; +static UINT8 *HighColFull; + +static INT32 *HighCacheA; +static INT32 *HighCacheB; +static INT32 *HighCacheS; +static INT32 *HighPreSpr; +static INT8 *HighSprZ; + +UINT8 MegadriveReset = 0; +UINT8 bMegadriveRecalcPalette = 0; + +UINT8 MegadriveJoy1[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 MegadriveJoy2[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 MegadriveJoy3[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 MegadriveJoy4[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 MegadriveDIP[2] = {0, 0}; + +static UINT32 RomNum = 0; +static UINT32 RomSize = 0; +static UINT32 SRamSize = 0; + +static INT32 SpriteBlocks; + +static INT32 Scanline = 0; + +static INT32 Z80HasBus = 0; +static INT32 MegadriveZ80Reset = 0; +static INT32 RomNoByteswap; + +static UINT8 Hardware; +static UINT8 DrvSECAM = 0; // NTSC + +void MegadriveCheckHardware() +{ + Hardware = MegadriveDIP[0] & 0xe0; + if (MegadriveDIP[0] & 0x01) { + // Auto Detect Region and SECAM + UINT32 support = 0; + for (INT32 i = 0; i < 4; i++) { + UINT32 v = RomMain[0x1f0 + i]; + if (v <= 0x20) continue; + + switch (v) { + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: { + support |= v - 0x30; + break; + } + + case 0x41: + case 0x42: + case 0x43: + case 0x44: + case 0x46: { + support |= v - 0x41; + break; + } + + case 0x45: { + // Japan + support |= 0x08; + break; + } + + case 0x4a: { + // Europe + support |= 0x01; + break; + } + + case 0x55: { + // USA + support |= 0x04; + break; + } + + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x66: { + support |= v - 0x61; + break; + } + } + } + + bprintf(PRINT_IMPORTANT, _T("Autodetecting Cartridge (Hardware Code: %02x%02x%02x%02x):\n"), RomMain[0x1f0], RomMain[0x1f1], RomMain[0x1f2], RomMain[0x1f3]); + Hardware = 0x80; + + if (support & 0x02) { + Hardware = 0x40; // Japan PAL + bprintf(PRINT_IMPORTANT, _T("Japan PAL supported ???\n")); + } + + if (support & 0x01) { + Hardware = 0x00; // Japan NTSC + bprintf(PRINT_IMPORTANT, _T("Japan NTSC supported\n")); + } + + if (support & 0x08) { + Hardware = 0xc0; // Europe PAL + bprintf(PRINT_IMPORTANT, _T("Europe PAL supported\n")); + } + + if (support & 0x04) { + Hardware = 0x80; // USA NTSC + bprintf(PRINT_IMPORTANT, _T("USA NTSC supported\n")); + } + + if ((Hardware & 0xc0) == 0xc0) { + bprintf(PRINT_IMPORTANT, _T("Emulating Europe PAL Machine\n")); + } else { + if ((Hardware & 0x80) == 0x80) { + bprintf(PRINT_IMPORTANT, _T("Emulating USA NTSC Machine\n")); + } else { + if ((Hardware & 0x40) == 0x40) { + bprintf(PRINT_IMPORTANT, _T("Emulating Japan PAL Machine ???\n")); + } else { + if ((Hardware & 0x00) == 0x00) { + bprintf(PRINT_IMPORTANT, _T("Emulating Japan NTSC Machine\n")); + } + } + } + } + + // CD-ROM + Hardware |= MegadriveDIP[0] & 0x20; + } + + if ((Hardware & 0x20) != 0x20) bprintf(PRINT_IMPORTANT, _T("Emulating Mega-CD Add-on\n")); +} + +//----------------------------------------------------------------- + +inline static void CalcCol(INT32 index, UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour & 0x000f) << 4; // Red + g = (nColour & 0x00f0) << 0; // Green + b = (nColour & 0x0f00) >> 4; // Blue + + r |= r >> 4; + g |= g >> 4; + b |= b >> 4; + + RamPal[index] = nColour; + + // Normal Color + MegadriveCurPal[index + 0x00] = BurnHighCol(r, g, b, 0); + + // Shadow Color + MegadriveCurPal[index + 0x40] = MegadriveCurPal[index + 0xc0] = BurnHighCol(r>>1, g>>1, b>>1, 0); + + // Highlight Color + r += 0x80; if (r > 0xFF) r = 0xFF; + g += 0x80; if (g > 0xFF) g = 0xFF; + b += 0x80; if (b > 0xFF) b = 0xFF; + MegadriveCurPal[index + 0x80] = BurnHighCol(r, g, b, 0); +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + RomMain = Next; Next += MAX_CARTRIDGE_SIZE; // 68000 ROM, Max enough + + RamStart = Next; + + Ram68K = Next; Next += 0x010000; + RamZ80 = Next; Next += 0x002000; + SRam = Next; Next += MAX_SRAM_SIZE; // SRam + RamIO = Next; Next += 0x000010; // I/O + + RamPal = (UINT16 *) Next; Next += 0x000040 * sizeof(UINT16); + RamSVid = (UINT16 *) Next; Next += 0x000040 * sizeof(UINT16); // VSRam + RamVid = (UINT16 *) Next; Next += 0x008000 * sizeof(UINT16); // Video Ram + + RamVReg = (struct PicoVideo *)Next; Next += sizeof(struct PicoVideo); + RamMisc = (struct PicoMisc *)Next; Next += sizeof(struct PicoMisc); + + RamEnd = Next; + + MegadriveCurPal = (UINT16 *) Next; Next += 0x000040 * sizeof(UINT16) * 4; + + HighColFull = Next; Next += (8 + 320 + 8) * 240; + + HighCacheA = (INT32 *) Next; Next += (41+1) * sizeof(INT32); // caches for high layers + HighCacheB = (INT32 *) Next; Next += (41+1) * sizeof(INT32); + HighCacheS = (INT32 *) Next; Next += (80+1) * sizeof(INT32); // and sprites + HighPreSpr = (INT32 *) Next; Next += (80*2+1) * sizeof(INT32); // slightly preprocessed sprites + HighSprZ = (INT8*) Next; Next += (320+8+8); // Z-buffer for accurate sprites and shadow/hilight mode + + JoyPad = (struct MegadriveJoyPad *) Next; Next += sizeof(struct MegadriveJoyPad); + + MemEnd = Next; + return 0; +} + +UINT16 __fastcall MegadriveReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xa11100: { + UINT16 retVal = rand() & 0xffff; + if (Z80HasBus || MegadriveZ80Reset) { + retVal |= 0x100; + } else { + retVal &= 0xfeff; + } + return retVal; + } + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); + } + } + return 0; +} + +UINT8 __fastcall MegadriveReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xa04000: + case 0xa04001: + case 0xa04002: + case 0xa04003: { + if (!Z80HasBus && !MegadriveZ80Reset) { + return BurnYM2612Read(0, 0); + } else { + return 0; + } + } + + case 0xa11100: { + UINT8 retVal = rand() & 0xff; + if (Z80HasBus || MegadriveZ80Reset) { + retVal |= 0x01; + } else { + retVal &= 0xfe; + } + return retVal; + } + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); + } + } + return 0; +} + +void __fastcall MegadriveWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if(sekAddress >= 0xA13004 && sekAddress < 0xA13040) { + // dumb 12-in-1 or 4-in-1 banking support + sekAddress &= 0x3f; + sekAddress <<= 16; + INT32 len = RomSize - sekAddress; + if (len <= 0) return; // invalid/missing bank + if (len > 0x200000) len = 0x200000; // 2 megs + // code which does this is in RAM so this is safe. + memcpy(RomMain, RomMain + sekAddress, len); + return; + } + + switch (sekAddress) { + case 0xa04000: { + if (!Z80HasBus && !MegadriveZ80Reset) { + BurnYM2612Write(0, 0, byteValue); + } + return; + } + + case 0xa04001: { + if (!Z80HasBus && !MegadriveZ80Reset) { + BurnYM2612Write(0, 1, byteValue); + } + return; + } + + case 0xa04002: { + if (!Z80HasBus && !MegadriveZ80Reset) { + BurnYM2612Write(0, 2, byteValue); + } + return; + } + + case 0xa04003: { + if (!Z80HasBus && !MegadriveZ80Reset) { + BurnYM2612Write(0, 3, byteValue); + } + return; + } + + case 0xA11100: { + if (byteValue & 1) { + RamMisc->Z80Run = 0; + Z80HasBus = 0; + } else { + RamMisc->Z80Run = 1; + Z80HasBus = 1; + } + return; + } + + case 0xA11200: { + if (!(byteValue & 1)) { + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2612Reset(); + MegadriveZ80Reset = 1; + } else { + MegadriveZ80Reset = 0; + } + return; + } + +// case 0xA130F1: { + // sram access register +// RamMisc->SRamReg = byteValue & 0x03; +// return; +// } + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); + } + } +} + +void __fastcall MegadriveWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + case 0xa11100: { + if (wordValue & 0x100) { + RamMisc->Z80Run = 0; + Z80HasBus = 0; + } else { + RamMisc->Z80Run = 1; + Z80HasBus = 1; + } + return; + } + + case 0xa11200: { + if (!(wordValue & 0x100)) { + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2612Reset(); + MegadriveZ80Reset = 1; + } else { + MegadriveZ80Reset = 0; + } + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); + } + } +} + +//--------------------------------------------------------------- +// Megadrive Video Port Read Write +//--------------------------------------------------------------- + +static INT32 rendstatus = 0; + +// calculate the number of cycles 68k->VDP dma operation would take +static INT32 DmaSlowBurn(INT32 len) +{ + // test: Legend of Galahad, Time Killers + INT32 burn,maxlen,line=Scanline; + //if(line == -1) line=vcounts[SekCyclesDone()>>8]; + maxlen = (224-line) * 18; + if(len <= maxlen) + burn = len*(((cycles_68k<<8)/18))>>8; + else { + burn = maxlen*(((cycles_68k<<8)/18))>>8; + burn += (len-maxlen)*(((cycles_68k<<8)/180))>>8; + } + return burn; +} + +static INT32 GetDmaLength() +{ + INT32 len = 0; + // 16-bit words to transfer: + len = RamVReg->reg[0x13]; + len |= RamVReg->reg[0x14]<<8; + // Charles MacDonald: + if(!len) len = 0xffff; + return len; +} + +static void DmaSlow(INT32 len) +{ + UINT16 *pd=0, *pdend, *r; + UINT32 a = RamVReg->addr, a2, d; + UINT8 inc = RamVReg->reg[0xf]; + UINT32 source, burn; + + source = RamVReg->reg[0x15] << 1; + source |= RamVReg->reg[0x16] << 9; + source |= RamVReg->reg[0x17] << 17; + + //dprintf("DmaSlow[%i] %06x->%04x len %i inc=%i blank %i [%i|%i]", Pico.video.type, source, a, len, inc, + // (Pico.video.status&8)||!(Pico.video.reg[1]&0x40), Pico.m.scanline, SekCyclesDone()); + + if ((source & 0xe00000) == 0xe00000) { // RAM + pd = (UINT16 *)(Ram68K + (source & 0xfffe)); + pdend = (UINT16 *)(Ram68K + 0x10000); + } else if( source < RomSize) { // ROM + pd = (UINT16 *)(RomMain + (source & ~1)); + pdend = (UINT16 *)(RomMain + RomSize); + } else return; // Invalid source address + + // CPU is stopped during DMA, so we burn some cycles to compensate that + if((RamVReg->status & 8) || !(RamVReg->reg[1] & 0x40)) { // vblank? + burn = (len*(((cycles_68k<<8)/167))>>8); // very approximate + if(!(RamVReg->status & 8)) burn += burn>>1; // a hack for Legend of Galahad + } else burn = DmaSlowBurn(len); + + //SekCyclesBurn(burn); + SekRunAdjust( 0 - burn ); + + if(!(RamVReg->status & 8)) + SekRunEnd(); + //dprintf("DmaSlow burn: %i @ %06x", burn, SekPc); + + switch ( RamVReg->type ) { + case 1: // vram + r = RamVid; + for(; len; len--) { + d = *pd++; + if(a&1) d=(d<<8)|(d>>8); + r[a>>1] = (UINT16)d; // will drop the upper bits + // AutoIncrement + a = (UINT16)(a+inc); + // didn't src overlap? + if(pd >= pdend) pd -= 0x8000; // should be good for RAM, bad for ROM + } + rendstatus |= 0x10; + break; + + case 3: // cram + //dprintf("DmaSlow[%i] %06x->%04x len %i inc=%i blank %i [%i|%i]", Pico.video.type, source, a, len, inc, + // (Pico.video.status&8)||!(Pico.video.reg[1]&0x40), Pico.m.scanline, SekCyclesDone()); + for(a2 = a&0x7f; len; len--) { + CalcCol( a2>>1, BURN_ENDIAN_SWAP_INT16(*pd) ); + pd++; + // AutoIncrement + a2+=inc; + // didn't src overlap? + if(pd >= pdend) pd-=0x8000; + // good dest? + if(a2 >= 0x80) break; // Todds Adventures in Slime World / Andre Agassi tennis + } + a = (a&0xff00) | a2; + break; + + case 5: // vsram[a&0x003f]=d; + r = RamSVid; + for(a2=a&0x7f; len; len--) { + r[a2>>1] = (UINT16)*pd++; + // AutoIncrement + a2+=inc; + // didn't src overlap? + if(pd >= pdend) pd-=0x8000; + // good dest? + if(a2 >= 0x80) break; + } + a=(a&0xff00)|a2; + break; + } + // remember addr + RamVReg->addr = (UINT16)a; +} + +static void DmaCopy(INT32 len) +{ + UINT8 * vr = (UINT8 *) RamVid; + UINT8 * vrs; + //UINT16 a = Pico.video.addr; + //UINT8 inc = RamVReg->reg[0xf]; + INT32 source; + + //dprintf("DmaCopy len %i [%i|%i]", len, Pico.m.scanline, SekCyclesDone()); + + source = RamVReg->reg[0x15]; + source |= RamVReg->reg[0x16]<<8; + vrs = vr + source; + + if (source+len > 0x10000) + len = 0x10000 - source; // clip?? + + for(;len;len--) { + vr[RamVReg->addr] = *vrs++; + // AutoIncrement + //a = (u16)(a + inc); + RamVReg->addr += RamVReg->reg[0xf]; + } + rendstatus |= 0x10; +} + +static void DmaFill(INT32 data) +{ + INT32 len = GetDmaLength(); + UINT8 *vr = (UINT8 *) RamVid; + UINT8 high = (UINT8) (data >> 8); + UINT16 a = RamVReg->addr; + UINT8 inc = RamVReg->reg[0xf]; + + //dprintf("DmaFill len %i inc %i [%i|%i]", len, inc, Pico.m.scanline, SekCyclesDone()); + + // from Charles MacDonald's genvdp.txt: + // Write lower byte to address specified + vr[a] = (UINT8) data; + a = (UINT16)(a+inc); + + if(!inc) len=1; + + for(;len;len--) { + // Write upper byte to adjacent address + // (here we are byteswapped, so address is already 'adjacent') + vr[a] = high; + // Increment address register + a = (UINT16)(a+inc); + } + // remember addr + RamVReg->addr = a; + // update length + RamVReg->reg[0x13] = RamVReg->reg[0x14] = 0; // Dino Dini's Soccer (E) (by Haze) + + rendstatus |= 0x10; +} + +static void CommandChange() +{ + //struct PicoVideo *pvid=&Pico.video; + UINT32 cmd = RamVReg->command; + UINT32 addr = 0; + + // Get type of transfer 0xc0000030 (v/c/vsram read/write) + RamVReg->type = (UINT8)(((cmd >> 2) & 0xc) | (cmd >> 30)); + + // Get address 0x3fff0003 + addr = (cmd >> 16) & 0x3fff; + addr |= (cmd << 14) & 0xc000; + RamVReg->addr = (UINT16)addr; + //dprintf("addr set: %04x", addr); + + // Check for dma: + if (cmd & 0x80) { + // Command DMA + if ((RamVReg->reg[1] & 0x10) == 0) return; // DMA not enabled + INT32 len = GetDmaLength(); + switch ( RamVReg->reg[0x17]>>6 ) { + case 0x00: + case 0x01: + DmaSlow(len); // 68000 to VDP + break; + case 0x03: + DmaCopy(len); // VRAM Copy + break; + case 0x02: // DMA Fill Flag ??? + default: + ;//bprintf(PRINT_NORMAL, _T("Video Command DMA Unknown %02x len %d\n"), RamVReg->reg[0x17]>>6, len); + } + } +} + +// H-counter table for hvcounter reads in 40col mode +// based on Gens code +const UINT8 hcounts_40[] = { + 0x07,0x07,0x08,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d, + 0x0e,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x13,0x14, + 0x14,0x15,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x18,0x19,0x19,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x21,0x21, + 0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x27,0x27,0x28,0x28, + 0x28,0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2f, + 0x2f,0x30,0x30,0x30,0x31,0x31,0x32,0x32,0x32,0x33,0x33,0x34,0x34,0x35,0x35,0x35, + 0x36,0x36,0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3b,0x3c,0x3c, + 0x3d,0x3d,0x3d,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x41,0x41,0x42,0x42,0x42,0x43, + 0x43,0x44,0x44,0x45,0x45,0x45,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x49,0x49,0x4a, + 0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x4f,0x50,0x50, + 0x51,0x51,0x52,0x52,0x52,0x53,0x53,0x54,0x54,0x55,0x55,0x55,0x56,0x56,0x57,0x57, + 0x57,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e, + 0x5e,0x5f,0x5f,0x5f,0x60,0x60,0x61,0x61,0x62,0x62,0x62,0x63,0x63,0x64,0x64,0x64, + 0x65,0x65,0x66,0x66,0x67,0x67,0x67,0x68,0x68,0x69,0x69,0x6a,0x6a,0x6a,0x6b,0x6b, + 0x6c,0x6c,0x6c,0x6d,0x6d,0x6e,0x6e,0x6f,0x6f,0x6f,0x70,0x70,0x71,0x71,0x71,0x72, + 0x72,0x73,0x73,0x74,0x74,0x74,0x75,0x75,0x76,0x76,0x77,0x77,0x77,0x78,0x78,0x79, + 0x79,0x79,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c,0x7c,0x7d,0x7d,0x7e,0x7e,0x7f,0x7f,0x7f, + 0x80,0x80,0x81,0x81,0x81,0x82,0x82,0x83,0x83,0x84,0x84,0x84,0x85,0x85,0x86,0x86, + 0x86,0x87,0x87,0x88,0x88,0x89,0x89,0x89,0x8a,0x8a,0x8b,0x8b,0x8c,0x8c,0x8c,0x8d, + 0x8d,0x8e,0x8e,0x8e,0x8f,0x8f,0x90,0x90,0x91,0x91,0x91,0x92,0x92,0x93,0x93,0x94, + 0x94,0x94,0x95,0x95,0x96,0x96,0x96,0x97,0x97,0x98,0x98,0x99,0x99,0x99,0x9a,0x9a, + 0x9b,0x9b,0x9b,0x9c,0x9c,0x9d,0x9d,0x9e,0x9e,0x9e,0x9f,0x9f,0xa0,0xa0,0xa1,0xa1, + 0xa1,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,0xa8, + 0xa8,0xa9,0xa9,0xa9,0xaa,0xaa,0xab,0xab,0xab,0xac,0xac,0xad,0xad,0xae,0xae,0xae, + 0xaf,0xaf,0xb0,0xb0,0xe4,0xe4,0xe4,0xe5,0xe5,0xe6,0xe6,0xe6,0xe7,0xe7,0xe8,0xe8, + 0xe9,0xe9,0xe9,0xea,0xea,0xeb,0xeb,0xeb,0xec,0xec,0xed,0xed,0xee,0xee,0xee,0xef, + 0xef,0xf0,0xf0,0xf1,0xf1,0xf1,0xf2,0xf2,0xf3,0xf3,0xf3,0xf4,0xf4,0xf5,0xf5,0xf6, + 0xf6,0xf6,0xf7,0xf7,0xf8,0xf8,0xf9,0xf9,0xf9,0xfa,0xfa,0xfb,0xfb,0xfb,0xfc,0xfc, + 0xfd,0xfd,0xfe,0xfe,0xfe,0xff,0xff,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03, + 0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x06,0x07,0x07,0x08,0x08,0x08,0x09,0x09,0x0a, + 0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x10, +}; + +// H-counter table for hvcounter reads in 32col mode +const UINT8 hcounts_32[] = { + 0x05,0x05,0x05,0x06,0x06,0x07,0x07,0x07,0x08,0x08,0x08,0x09,0x09,0x09,0x0a,0x0a, + 0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x0f,0x10, + 0x10,0x10,0x11,0x11,0x11,0x12,0x12,0x12,0x13,0x13,0x13,0x14,0x14,0x14,0x15,0x15, + 0x15,0x16,0x16,0x17,0x17,0x17,0x18,0x18,0x18,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x26,0x26, + 0x26,0x27,0x27,0x27,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b, + 0x2c,0x2c,0x2c,0x2d,0x2d,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x31,0x31, + 0x31,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x37, + 0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3c,0x3c, + 0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x41,0x41,0x41,0x42, + 0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x45,0x45,0x45,0x46,0x46,0x46,0x47,0x47,0x47, + 0x48,0x48,0x48,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4d,0x4d, + 0x4d,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x51,0x51,0x51,0x52,0x52,0x52, + 0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x55,0x56,0x56,0x56,0x57,0x57,0x57,0x58,0x58, + 0x58,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e, + 0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x61,0x61,0x61,0x62,0x62,0x62,0x63,0x63, + 0x64,0x64,0x64,0x65,0x65,0x65,0x66,0x66,0x66,0x67,0x67,0x67,0x68,0x68,0x68,0x69, + 0x69,0x69,0x6a,0x6a,0x6a,0x6b,0x6b,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e, + 0x6f,0x6f,0x6f,0x70,0x70,0x70,0x71,0x71,0x71,0x72,0x72,0x72,0x73,0x73,0x74,0x74, + 0x74,0x75,0x75,0x75,0x76,0x76,0x76,0x77,0x77,0x77,0x78,0x78,0x78,0x79,0x79,0x79, + 0x7a,0x7a,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f, + 0x7f,0x80,0x80,0x80,0x81,0x81,0x81,0x82,0x82,0x83,0x83,0x83,0x84,0x84,0x84,0x85, + 0x85,0x85,0x86,0x86,0x86,0x87,0x87,0x87,0x88,0x88,0x88,0x89,0x89,0x89,0x8a,0x8a, + 0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8f,0x8f,0x8f,0x90, + 0x90,0x90,0x91,0x91,0xe8,0xe8,0xe8,0xe9,0xe9,0xe9,0xea,0xea,0xea,0xeb,0xeb,0xeb, + 0xec,0xec,0xec,0xed,0xed,0xed,0xee,0xee,0xee,0xef,0xef,0xf0,0xf0,0xf0,0xf1,0xf1, + 0xf1,0xf2,0xf2,0xf2,0xf3,0xf3,0xf3,0xf4,0xf4,0xf4,0xf5,0xf5,0xf5,0xf6,0xf6,0xf6, + 0xf7,0xf7,0xf8,0xf8,0xf8,0xf9,0xf9,0xf9,0xfa,0xfa,0xfa,0xfb,0xfb,0xfb,0xfc,0xfc, + 0xfc,0xfd,0xfd,0xfd,0xfe,0xfe,0xfe,0xff,0xff,0x00,0x00,0x00,0x01,0x01,0x01,0x02, + 0x02,0x02,0x03,0x03,0x03,0x04,0x04,0x04,0x05,0x05,0x05,0x06,0x06,0x07,0x07,0x07, + 0x08,0x08,0x08,0x09,0x09,0x09,0x0a,0x0a,0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d, +}; + +UINT16 __fastcall MegadriveVideoReadWord(UINT32 sekAddress) +{ + //bprintf(PRINT_NORMAL, _T("Video Attempt to read word value of location %x\n"), sekAddress); + //return MegadriveVDPRead((sekAddress - 0xc00000) >> 1); + + if (sekAddress > 0xC0001F) + bprintf(PRINT_NORMAL, _T("Video Attempt to read word value of location %x\n"), sekAddress); + + UINT16 res = 0; + + switch (sekAddress & 0x1c) { + case 0x00: // data + switch (RamVReg->type) { + case 0: res = BURN_ENDIAN_SWAP_INT16(RamVid [(RamVReg->addr >> 1) & 0x7fff]); break; + case 4: res = BURN_ENDIAN_SWAP_INT16(RamSVid[(RamVReg->addr >> 1) & 0x003f]); break; + case 8: res = BURN_ENDIAN_SWAP_INT16(RamPal [(RamVReg->addr >> 1) & 0x003f]); break; + } + RamVReg->addr += RamVReg->reg[0xf]; + break; + + case 0x04: // command + res = RamVReg->status; + //if(PicoOpt&0x10) d|=0x0020; // sprite collision (Shadow of the Beast) + if(RamMisc->Rotate++&8) res |= 0x0100; else res |= 0x0200; // Toggle fifo full empty (who uses that stuff?) + if(!(RamVReg->reg[1] & 0x40)) res |= 0x0008; // set V-Blank if display is disabled + if(m68k_ICount < 84+4) res |= 0x0004; // H-Blank (Sonic3 vs) + RamVReg->pending = 0; // ctrl port reads clear write-pending flag (Charles MacDonald) + break; + + case 0x08: // H-counter info + { + UINT32 hc = 50; + + INT32 lineCycles = (cycles_68k - m68k_ICount) & 0x1ff; + res = Scanline; // V-Counter + + if(RamVReg->reg[12]&1) + hc = hcounts_40[lineCycles]; + else hc = hcounts_32[lineCycles]; + + if(lineCycles > cycles_68k-12) res++; // Wheel of Fortune + + if( Hardware & 0x40 ) { + if(res >= 0x103) res -= 56; // based on Gens + } else { + if(res >= 0x0EB) res -= 6; + } + + if((RamVReg->reg[12]&6) == 6) { + // interlace mode 2 (Combat Cars (UE) [!]) + res <<= 1; + if (res & 0xf00) res |= 1; + } + + //dprintf("hv: %02x %02x (%i) @ %06x", hc, d, SekCyclesDone(), SekPc); + res &= 0xff; + res <<= 8; + res |= hc; + } + break; + + default: + bprintf(PRINT_NORMAL, _T("Video Attempt to read word value of location %x, %x\n"), sekAddress, sekAddress & 0x1c); + break; + } + + return res; +} + +UINT8 __fastcall MegadriveVideoReadByte(UINT32 sekAddress) +{ + //bprintf(PRINT_NORMAL, _T("Video Attempt to read byte value of location %x\n"), sekAddress); + UINT16 res = MegadriveVideoReadWord(sekAddress & ~1); + if ((sekAddress&1)==0) res >>= 8; + return res & 0xff; +} + +void __fastcall MegadriveVideoWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + if (sekAddress > 0xC0001F) + bprintf(PRINT_NORMAL, _T("Video Attempt to write word value %x to location %x\n"), wordValue, sekAddress); + + switch (sekAddress & 0x1c) { + case 0x00: // data + if (RamVReg->pending) + CommandChange(); + RamVReg->pending = 0; + if ((RamVReg->command & 0x80) && (RamVReg->reg[1]&0x10) && (RamVReg->reg[0x17]>>6)==2) { + + DmaFill(wordValue); + + } else { + //UINT32 a=Pico.video.addr; + switch (RamVReg->type) { + case 1: + // If address is odd, bytes are swapped (which game needs this?) + if (RamVReg->addr & 1) { + bprintf(PRINT_NORMAL, _T("Video address is odd, bytes are swapped!!!\n")); + wordValue = (wordValue<<8)|(wordValue>>8); + } + RamVid[(RamVReg->addr >> 1) & 0x7fff] = BURN_ENDIAN_SWAP_INT16(wordValue); + rendstatus |= 0x10; + break; + case 3: + //Pico.m.dirtyPal = 1; + //dprintf("w[%i] @ %04x, inc=%i [%i|%i]", Pico.video.type, a, Pico.video.reg[0xf], Pico.m.scanline, SekCyclesDone()); + CalcCol((RamVReg->addr >> 1) & 0x003f, wordValue); + break; + case 5: + RamSVid[(RamVReg->addr >> 1) & 0x003f] = BURN_ENDIAN_SWAP_INT16(wordValue); + break; + } + //dprintf("w[%i] @ %04x, inc=%i [%i|%i]", Pico.video.type, a, Pico.video.reg[0xf], Pico.m.scanline, SekCyclesDone()); + //AutoIncrement(); + RamVReg->addr += RamVReg->reg[0xf]; + } + return; + + case 0x04: // command + if(RamVReg->pending) { + // Low word of command: + RamVReg->command &= 0xffff0000; + RamVReg->command |= wordValue; + RamVReg->pending = 0; + CommandChange(); + } else { + if((wordValue & 0xc000) == 0x8000) { + INT32 num = (wordValue >> 8) & 0x1f; + RamVReg->reg[num] = wordValue & 0xff; + + // update IRQ level (Lemmings, Wiz 'n' Liz intro, ... ) + // may break if done improperly: + // International Superstar Soccer Deluxe (crash), Street Racer (logos), Burning Force (gfx), Fatal Rewind (hang), Sesame Street Counting Cafe + if(num < 2) { + + INT32 lines = (RamVReg->reg[1] & 0x20) | (RamVReg->reg[0] & 0x10); + INT32 pints = (RamVReg->pending_ints & lines); + if(pints & 0x20) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + else if(pints & 0x10) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + else SekSetIRQLine(0, SEK_IRQSTATUS_NONE); + + } + + if (num == 5) rendstatus |= 1; +// else if(num == 0xc) Pico.m.dirtyPal = 2; // renderers should update their palettes if sh/hi mode is changed + RamVReg->type = 0; // register writes clear command (else no Sega logo in Golden Axe II) + } else { + // High word of command: + RamVReg->command &= 0x0000ffff; + RamVReg->command |= wordValue << 16; + RamVReg->pending = 1; + } + } + return; + + case 0x10: + case 0x14: + // PSG Sound + //bprintf(PRINT_NORMAL, _T("PSG Attempt to write word value %04x to location %08x\n"), wordValue, sekAddress); + SN76496Write(0, wordValue & 0xFF); + return; + + } +} + +void __fastcall MegadriveVideoWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + //bprintf(PRINT_NORMAL, _T("Video Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); + MegadriveVideoWriteWord(sekAddress, (byteValue << 8) | byteValue); +} + +// -- Z80 Ram Read Write ------------------------------------------ + +UINT8 __fastcall MegadriveZ80RamReadByte(UINT32 sekAddress) +{ + if (!Z80HasBus && !MegadriveZ80Reset) { + return RamZ80[sekAddress & 0x1fff]; + } + + return 0; +} + +UINT16 __fastcall MegadriveZ80RamReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Z80Ram Attempt to read word value of location %x\n"), sekAddress); + return 0; +} + +void __fastcall MegadriveZ80RamWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if (!Z80HasBus && !MegadriveZ80Reset) { + RamZ80[sekAddress & 0x1fff] = byteValue; + return; + } + bprintf(PRINT_NORMAL, _T("Z80Ram Attempt to write byte value %x to location %x and didn't have the Bus!\n"), byteValue, sekAddress); +} + +void __fastcall MegadriveZ80RamWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + if (!Z80HasBus && !MegadriveZ80Reset) { + RamZ80[sekAddress & 0x1fff] = wordValue >> 8; + return; + } + + bprintf(PRINT_NORMAL, _T("Z80Ram Attempt to write word value %x to location %x and didn't have the Bus!\n"), wordValue, sekAddress); +// MegadriveZ80RamWriteByte(sekAddress, wordValue >> 0x08); +} + +// -- I/O Read Write ------------------------------------------ + +static INT32 PadRead(INT32 i) +{ + INT32 pad=0,value=0,TH; + pad = ~(JoyPad->pad[i]); // Get inverse of pad MXYZ SACB RLDU + TH = RamIO[i+1] & 0x40; + + /*if(PicoOpt & 0x20)*/ { // 6 button gamepad enabled + INT32 phase = JoyPad->padTHPhase[i]; + + if(phase == 2 && !TH) { + value = (pad&0xc0)>>2; // ?0SA 0000 + goto end; + } else if(phase == 3 && TH) { + value=(pad&0x30)|((pad>>8)&0xf); // ?1CB MXYZ + goto end; + } else if(phase == 3 && !TH) { + value=((pad&0xc0)>>2)|0x0f; // ?0SA 1111 + goto end; + } + } + + if(TH) value=(pad&0x3f); // ?1CB RLDU + else value=((pad&0xc0)>>2)|(pad&3); // ?0SA 00DU + +end: + + // orr the bits, which are set as output + value |= RamIO[i+1] & RamIO[i+4]; + + return value; // will mirror later +} + +UINT8 __fastcall MegadriveIOReadByte(UINT32 sekAddress) +{ + if (sekAddress > 0xA1001F) + bprintf(PRINT_NORMAL, _T("IO Attempt to read byte value of location %x\n"), sekAddress); + + INT32 offset = (sekAddress >> 1) & 0xf; + switch (offset) { + case 0: // Get Hardware + return Hardware; + case 1: // Pad 1 + return (RamIO[1] & 0x80) | PadRead(0); + case 2: // Pad 2 + return (RamIO[2] & 0x80) | PadRead(1); + default: + //bprintf(PRINT_NORMAL, _T("IO Attempt to read byte value of location %x\n"), sekAddress); + return RamIO[offset]; + } + return 0; +} + +UINT16 __fastcall MegadriveIOReadWord(UINT32 sekAddress) +{ + //if (sekAddress > 0xA1001F) + // bprintf(PRINT_NORMAL, _T("IO Attempt to read word value of location %x\n"), sekAddress); + + UINT8 res = MegadriveIOReadByte(sekAddress); + return res | (res << 8); +} + +void __fastcall MegadriveIOWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if (sekAddress > 0xA1001F) + bprintf(PRINT_NORMAL, _T("IO Attempt to byte byte value %x to location %x\n"), byteValue, sekAddress); + + INT32 offset = (sekAddress >> 1) & 0xf; + // 6-Button Support + switch( offset ) { + case 1: + JoyPad->padDelay[0] = 0; + if(!(RamIO[1] & 0x40) && (byteValue&0x40)) + JoyPad->padTHPhase[0] ++; + break; + case 2: + JoyPad->padDelay[1] = 0; + if(!(RamIO[2] & 0x40) && (byteValue&0x40)) + JoyPad->padTHPhase[1] ++; + break; + } + RamIO[offset] = byteValue; +} + +void __fastcall MegadriveIOWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + //if (sekAddress > 0xA1001F) + // bprintf(PRINT_NORMAL, _T("IO Attempt to write word value %x to location %x\n"), wordValue, sekAddress); + + MegadriveIOWriteByte(sekAddress, wordValue & 0xff); +} + +// -- YM2612/YM2612 FM Chip ---------------------------------------------------------- + +inline static INT32 MegadriveSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)SekTotalCycles() * nSoundRate / (OSC_NTSC / 7); +} + +inline static double MegadriveGetTime() +{ + return (double)SekTotalCycles() / (OSC_NTSC / 7); +} + +inline static INT32 MegadriveSynchroniseStreamPAL(INT32 nSoundRate) +{ + return (INT64)SekTotalCycles() * nSoundRate / (OSC_PAL / 7); +} + +inline static double MegadriveGetTimePAL() +{ + return (double)SekTotalCycles() / (OSC_PAL / 7); +} + +// --------------------------------------------------------------- + +static INT32 MegadriveResetDo() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2612Reset(); + + MegadriveZ80Reset = 1; + Z80HasBus = 1; + +#if 0 + FILE * f = fopen("Megadrive.bin", "wb+"); + fwrite(RomMain, 1, 0x200000, f); + fclose(f); +#endif + + MegadriveCheckHardware(); + + if (Hardware & 0x40) { + BurnSetRefreshRate(50.0); + Reinitialise(); + + BurnYM2612Exit(); + BurnYM2612Init(1, OSC_PAL / 7, NULL, MegadriveSynchroniseStreamPAL, MegadriveGetTimePAL, 0); + BurnTimerAttachSek(OSC_PAL / 7); + BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + + BurnYM2612Reset(); + + SN76496Exit(); + SN76496Init(0, OSC_PAL / 15, 1); + SN76496SetRoute(0, 0.25, BURN_SND_ROUTE_BOTH); + } else { + BurnSetRefreshRate(60.0); + Reinitialise(); + + BurnYM2612Exit(); + BurnYM2612Init(1, OSC_NTSC / 7, NULL, MegadriveSynchroniseStream, MegadriveGetTime, 0); + BurnTimerAttachSek(OSC_NTSC / 7); + BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + + BurnYM2612Reset(); + + SN76496Exit(); + SN76496Init(0, OSC_NTSC / 15, 1); + SN76496SetRoute(0, 0.25, BURN_SND_ROUTE_BOTH); + } + + // other reset +// memset(RamMisc, 0, sizeof(struct PicoMisc)); + memset(JoyPad, 0, sizeof(struct MegadriveJoyPad)); + + // default VDP register values (based on Fusion) + memset(RamVReg, 0, sizeof(struct PicoVideo)); + RamVReg->reg[0x00] = 0x04; + RamVReg->reg[0x01] = 0x04; + RamVReg->reg[0x0c] = 0x81; + RamVReg->reg[0x0f] = 0x02; + + RamVReg->status = 0x3408 | ((MegadriveDIP[0] & 0x40) >> 6); + + return 0; +} + +INT32 __fastcall MegadriveIrqCallback(INT32 irq) +{ + switch ( irq ) { + case 4: RamVReg->pending_ints = 0x00; break; + case 6: RamVReg->pending_ints &= ~0x20; break; + } + return -1; +} + +// ---------------------------------------------------------------- +// Z80 Read/Write +// ---------------------------------------------------------------- + +UINT8 __fastcall MegadriveZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Read %02x\n"), a); + } + } + + return 0; +} + +void __fastcall MegadriveZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write %02x, %02%x\n"), a, d); + } + } +} + +UINT8 __fastcall MegadriveZ80ProgRead(UINT16 a) +{ + if (a >= 0x6100 && a <= 0x7eff) { + return 0xff; + } + + if (a >= 0x8000) { + UINT32 addr68k = RamMisc->Bank68k; + addr68k += a & 0x7fff; + if (addr68k <= 0x3fffff) return RomMain[addr68k ^ 1]; + + bprintf(PRINT_NORMAL, _T("%Z80 trying to read 68k address %06X\n"), addr68k); + return 0; + } + + switch (a) { + case 0x4000: + case 0x4001: + case 0x4002: { + return BurnYM2612Read(0, 0); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read %04x\n"), a); + } + } + + return 0; +} + +UINT32 Z80BankPartial = 0; +UINT32 Z80BankPos = 0; + +void __fastcall MegadriveZ80ProgWrite(UINT16 a, UINT8 d) +{ + if (a == 0x6000 || a == 0x6001) { + Z80BankPartial |= (d & 0x01) << 23; + Z80BankPos++; + + if (Z80BankPos < 9) { + Z80BankPartial >>= 1; + } else { + Z80BankPos = 0; + RamMisc->Bank68k = Z80BankPartial; + Z80BankPartial = 0; + } + return; + } + + if (a >= 0x8000) { + UINT32 addr68k = RamMisc->Bank68k; + addr68k += a & 0x7fff; + + if (addr68k <= 0x3fffff) return; + + if (addr68k == 0xc00011) { + SN76496Write(0, d); + return; + } + + if ((addr68k >= 0xe00000) && (addr68k <= 0xffffff)) { + addr68k &=0xffff; + UINT16 *Ram = (UINT16*)Ram68K; + if (addr68k & 0x01) { + Ram[addr68k >> 1] = (Ram[addr68k >> 1] & 0xff00) | d; + } else { + Ram[addr68k >> 1] = (Ram[addr68k >> 1] & 0x00ff) | (d << 8); + } + return; + } + + bprintf(PRINT_NORMAL, _T("Z80-Bank68K Attempt to write byte value %02x to location %06x\n"), d, addr68k); + return; + } + + switch (a) { + case 0x4000: { + SekOpen(0); + BurnYM2612Write(0, 0, d); + SekClose(); + return; + } + + case 0x4001: { + SekOpen(0); + BurnYM2612Write(0, 1, d); + SekClose(); + return; + } + + case 0x4002: { + SekOpen(0); + BurnYM2612Write(0, 2, d); + SekClose(); + return; + } + + case 0x4003: { + SekOpen(0); + BurnYM2612Write(0, 3, d); + SekClose(); + return; + } + + case 0x7f11: + case 0x7f13: + case 0x7f15: + case 0x7f17: { + SN76496Write(0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write %04x, %02x\n"), a, d); + } + } +} + +static INT32 MegadriveLoadRoms(bool bLoad) +{ + struct BurnRomInfo ri; + ri.nType = 0; + ri.nLen = 0; + INT32 nOffset = -1; + UINT32 i; + INT32 nRet = 0; + + if (!bLoad) { + do { + ri.nLen = 0; + ri.nType = 0; + BurnDrvGetRomInfo(&ri, ++nOffset); + if(ri.nLen) RomNum++; + RomSize += ri.nLen; + } while (ri.nLen); + + bprintf(PRINT_NORMAL, _T("68K Rom, Num %i, Size %x\n"), RomNum, RomSize); + } + + if (bLoad) { + INT32 Offset = 0; + + for (i = 0; i < RomNum; i++) { + BurnDrvGetRomInfo(&ri, i); + + switch (ri.nType & 0x0f) { + case SEGA_MD_ROM_OFFS_000000: Offset = 0x000000; break; + case SEGA_MD_ROM_OFFS_000001: Offset = 0x000001; break; + case SEGA_MD_ROM_OFFS_020000: Offset = 0x020000; break; + case SEGA_MD_ROM_OFFS_080000: Offset = 0x080000; break; + case SEGA_MD_ROM_OFFS_100000: Offset = 0x100000; break; + case SEGA_MD_ROM_OFFS_100001: Offset = 0x100001; break; + case SEGA_MD_ROM_OFFS_200000: Offset = 0x200000; break; + } + + switch (ri.nType & 0xf0) { + case SEGA_MD_ROM_LOAD_NORMAL: { + nRet = BurnLoadRom(RomMain + Offset, i, 1); if (nRet) return 1; + break; + } + + case SEGA_MD_ROM_LOAD16_WORD_SWAP: { + nRet = BurnLoadRom(RomMain + Offset, i, 1); if (nRet) return 1; + BurnByteswap(RomMain + Offset, ri.nLen); + break; + } + + case SEGA_MD_ROM_LOAD16_BYTE: { + nRet = BurnLoadRom(RomMain + Offset, i, 2); if (nRet) return 1; + break; + } + + case SEGA_MD_ROM_LOAD16_WORD_SWAP_CONTINUE_040000_100000: { + nRet = BurnLoadRom(RomMain + Offset, i, 1); if (nRet) return 1; + memcpy(RomMain + 0x100000, RomMain + 0x040000, 0x40000); + BurnByteswap(RomMain + Offset, 0x140000); + break; + } + } + } + } + + return 0; +} + +// Custom Cartridge Mapping + +UINT8 __fastcall JCartCtrlReadByte(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("JCartCtrlRead Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall JCartCtrlReadWord(UINT32 /*sekAddress*/) +{ + UINT16 retData = 0; + + UINT8 JPad3 = ~(JoyPad->pad[2] & 0xff); + UINT8 JPad4 = ~(JoyPad->pad[3] & 0xff); + + if (RamMisc->JCartIOData[0] & 0x40) { + retData = (RamMisc->JCartIOData[0] & 0x40) | JPad3 | (JPad4 << 8); + } else { + retData = ((JPad3 & 0xc0) >> 2) | (JPad3 & 0x03); + retData += (((JPad4 & 0xc0) >> 2) | (JPad4 & 0x03)) << 8; + } + + return retData; +} + +void __fastcall JCartCtrlWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + bprintf(PRINT_NORMAL, _T("JCartCtrlWrite byte %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall JCartCtrlWriteWord(UINT32 /*sekAddress*/, UINT16 wordValue) +{ + RamMisc->JCartIOData[0] = (wordValue & 1) << 6; + RamMisc->JCartIOData[1] = (wordValue & 1) << 6; +} + +void __fastcall Ssf2BankWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + case 0xa130f1: { + if (byteValue == 2) memcpy(RomMain + 0x000000, RomMain + 0x400000 + (((byteValue & 0x0f) - 2) * 0x080000), 0x080000); + return; + } + + case 0xa130f3: { + memcpy(RomMain + 0x080000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); + return; + } + + case 0xa130f5: { + memcpy(RomMain + 0x100000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); + return; + } + + case 0xa130f7: { + memcpy(RomMain + 0x180000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); + return; + } + + case 0xa130f9: { + memcpy(RomMain + 0x200000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); + return; + } + + case 0xa130fb: { + memcpy(RomMain + 0x280000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); + return; + } + + case 0xa130fd: { + memcpy(RomMain + 0x300000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); + return; + } + + case 0xa130ff: { + memcpy(RomMain + 0x380000, RomMain + 0x400000 + ((byteValue & 0xf) * 0x080000), 0x080000); + return; + } + } +} + +UINT8 __fastcall LK3AltProtReadByte(UINT32 sekAddress) +{ + INT32 Offset = (sekAddress - 0x600000) >> 1; + Offset &= 0x07; + + UINT8 retData = 0; + + switch (Offset) { + case 0x02: { + switch (RamMisc->L3AltPCmd) { + case 1: + retData = RamMisc->L3AltPDat >> 1; + break; + + case 2: + retData = RamMisc->L3AltPDat >> 4; + retData |= (RamMisc->L3AltPDat & 0x0f) << 4; + break; + + default: + retData = (BIT(RamMisc->L3AltPDat, 7) << 0); + retData |= (BIT(RamMisc->L3AltPDat, 6) << 1); + retData |= (BIT(RamMisc->L3AltPDat, 5) << 2); + retData |= (BIT(RamMisc->L3AltPDat, 4) << 3); + retData |= (BIT(RamMisc->L3AltPDat, 3) << 4); + retData |= (BIT(RamMisc->L3AltPDat, 2) << 5); + retData |= (BIT(RamMisc->L3AltPDat, 1) << 6); + retData |= (BIT(RamMisc->L3AltPDat, 0) << 7); + break; + } + break; + } + } + +// bprintf(PRINT_NORMAL, _T("LK3AltProt Read Byte %x\n"), sekAddress); + + return retData; +} + +UINT16 __fastcall LK3AltProtReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("LK3AltProt Read Word %x\n"), sekAddress); + + return 0; +} + +void __fastcall LK3AltProtWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + INT32 Offset = (sekAddress - 0x600000) >> 1; + Offset &= 0x07; + + switch (Offset) { + case 0x00: + RamMisc->L3AltPDat = byteValue; + return; + + case 0x01: + RamMisc->L3AltPCmd = byteValue; + return; + } + +// bprintf(PRINT_NORMAL, _T("LK3AltProt write byte %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall LK3AltProtWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("LK3AltProt write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +void __fastcall LK3AltBankWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + INT32 Offset = (sekAddress - 0x700000) >> 1; + Offset &= 0x07; + + if (Offset == 0) { + memcpy(RomMain, OriginalRom + ((byteValue & 0xff) * 0x8000), 0x8000); + return; + } + + bprintf(PRINT_NORMAL, _T("LK3AltBank write byte %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall LK3AltBankWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("LK3AltBank write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +UINT8 __fastcall RedclifProtReadByte(UINT32 /*sekAddress*/) +{ + return (UINT8)-0x56; +} + +UINT16 __fastcall RedclifProtReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("RedclifeProt Read Word %x\n"), sekAddress); + + return 0; +} + +UINT8 __fastcall RedclifProt2ReadByte(UINT32 /*sekAddress*/) +{ + return 0x55; +} + +UINT16 __fastcall RedclifProt2ReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("RedclifeProt2 Read Word %x\n"), sekAddress); + + return 0; +} + +UINT8 __fastcall RadicaBankSelectReadByte(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("RadicaBankSelect Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall RadicaBankSelectReadWord(UINT32 sekAddress) +{ + INT32 Bank = ((sekAddress - 0xa13000) >> 1) & 0x3f; + memcpy(RomMain, RomMain + 0x400000 + (Bank * 0x10000), 0x400000); + + return 0; +} + +UINT8 __fastcall Kof99A13000ReadByte(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Kof99A13000 Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall Kof99A13000ReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xa13000: return 0x00; + case 0xa13002: return 0x01; + case 0xa1303e: return 0x1f; + + } + + bprintf(PRINT_NORMAL, _T("Kof99A13000 Read Word %x\n"), sekAddress); + + return 0; +} + +UINT8 __fastcall SoulbladReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x400002: return 0x98; + case 0x400004: return 0xc0; + case 0x400006: return 0xf0; + + } + + bprintf(PRINT_NORMAL, _T("Soulblad Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall SoulbladReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Soulblad Read Word %x\n"), sekAddress); + + return 0; +} + +UINT8 __fastcall MjloverProt1ReadByte(UINT32 /*sekAddress*/) +{ + return 0x90; +} + +UINT16 __fastcall MjloverProt1ReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("MjloverProt1 Read Word %x\n"), sekAddress); + + return 0; +} + +UINT8 __fastcall MjloverProt2ReadByte(UINT32 /*sekAddress*/) +{ + return 0xd3; +} + +UINT16 __fastcall MjloverProt2ReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("MjloverProt2 Read Word %x\n"), sekAddress); + + return 0; +} + +UINT8 __fastcall SquirrelKingExtraReadByte(UINT32 /*sekAddress*/) +{ + return RamMisc->SquirrelkingExtra; +} + +UINT16 __fastcall SquirrelKingExtraReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("SquirrelKingExtra Read Word %x\n"), sekAddress); + + return 0; +} + +void __fastcall SquirrelKingExtraWriteByte(UINT32 /*sekAddress*/, UINT8 byteValue) +{ + RamMisc->SquirrelkingExtra = byteValue; +} + +void __fastcall SquirrelKingExtraWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("SquirrelKingExtra write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +UINT8 __fastcall SmouseProtReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x400000: return 0x55; + case 0x400002: return 0x0f; + case 0x400004: return 0xaa; + case 0x400005: return 0xf0; + } + + return 0; +} + +UINT16 __fastcall SmouseProtReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("SmouseProt Read Word %x\n"), sekAddress); + + return 0; +} + +UINT8 __fastcall SmbProtReadByte(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Smbprot Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall SmbProtReadWord(UINT32 /*sekAddress*/) +{ + return 0x0c; +} + +UINT8 __fastcall Smb2ProtReadByte(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Smb2Prot Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall Smb2ProtReadWord(UINT32 /*sekAddress*/) +{ + return 0x0a; +} + +void __fastcall KaijuBankWriteByte(UINT32 /*sekAddress*/, UINT8 byteValue) +{ + memcpy(RomMain + 0x000000, RomMain + 0x400000 + (byteValue & 0x7f) * 0x8000, 0x8000); +} + +void __fastcall KaijuBankWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("KaijuBank write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +UINT8 __fastcall Chinfi3ProtReadByte(UINT32 /*sekAddress*/) +{ + UINT8 retDat = 0; + + if (SekGetPC(0) == 0x01782) // makes 'VS' screen appear + { + retDat = SekDbgGetRegister(SEK_REG_D3) & 0xff; +// retDat <<= 8; + return retDat; + } + else if (SekGetPC(0) == 0x1c24) // background gfx etc. + { + retDat = SekDbgGetRegister(SEK_REG_D3) & 0xff; +// retDat <<= 8; + return retDat; + } + else if (SekGetPC(0) == 0x10c4a) // unknown + { + return rand() & 0xff;//space->machine().rand(); + } + else if (SekGetPC(0) == 0x10c50) // unknown + { + return rand() & 0xff;//space->machine().rand(); + } + else if (SekGetPC(0) == 0x10c52) // relates to the game speed.. + { + retDat = SekDbgGetRegister(SEK_REG_D4) & 0xff; +// retDat <<= 8; + return retDat; + } + else if (SekGetPC(0) == 0x061ae) + { + retDat = SekDbgGetRegister(SEK_REG_D3) & 0xff; +// retDat <<= 8; + return retDat; + } + else if (SekGetPC(0) == 0x061b0) + { + retDat = SekDbgGetRegister(SEK_REG_D3) & 0xff; +// retDat <<= 8; + return retDat; + } + + return 0; +} + +UINT16 __fastcall Chinfi3ProtReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Chinfi3Prot Read Word %x\n"), sekAddress); + + return 0; +} + +void __fastcall Chinfi3BankWriteByte(UINT32 /*sekAddress*/, UINT8 byteValue) +{ + if (byteValue == 0xf1) // *hit player + { + INT32 x; + for (x = 0; x < 0x100000; x += 0x10000) + { + memcpy(RomMain + x, RomMain + 0x410000, 0x10000); + } + } + else if (byteValue == 0xd7) // title screen.. + { + INT32 x; + for (x = 0; x < 0x100000; x += 0x10000) + { + memcpy(RomMain + x, RomMain + 0x470000, 0x10000); + } + } + else if (byteValue == 0xd3) // character hits floor + { + INT32 x; + for (x = 0; x < 0x100000; x += 0x10000) + { + memcpy(RomMain + x, RomMain + 0x430000, 0x10000); + } + } + else if (byteValue == 0x00) + { + INT32 x; + for (x = 0; x < 0x100000; x += 0x10000) + { + memcpy(RomMain + x, RomMain + 0x400000 + x, 0x10000); + } + } +} + +void __fastcall Chinfi3BankWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("Chinfi3Bank write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +UINT8 __fastcall Lionk2ProtReadByte(UINT32 sekAddress) +{ + switch(sekAddress) { + case 0x400002: { + return RamMisc->Lionk2ProtData; + } + + case 0x400006: { + return RamMisc->Lionk2ProtData2; + } + } + + bprintf(PRINT_NORMAL, _T("Lion2Prot Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall Lionk2ProtReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Lion2Prot Read Word %x\n"), sekAddress); + + return 0; +} + +void __fastcall Lionk2ProtWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + case 0x400000: { + RamMisc->Lionk2ProtData = byteValue; + return; + } + + case 0x400004: { + RamMisc->Lionk2ProtData2 = byteValue; + return; + } + } + + bprintf(PRINT_NORMAL, _T("Lion2Prot write byte %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall Lionk2ProtWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("Lion2Prot write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +UINT8 __fastcall BuglExtraReadByte(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("BuglExtra Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall BuglExtraReadWord(UINT32 /*sekAddress*/) +{ + return 0x28; +} + +UINT8 __fastcall Elfwor400000ReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x400000: return 0x55; + case 0x400002: return 0x0f; + case 0x400004: return 0xc9; + case 0x400006: return 0x18; + } + + bprintf(PRINT_NORMAL, _T("Elfwor400000 Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall Elfwor400000ReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Elfwor400000 Read Word %x\n"), sekAddress); + + return 0; +} + +UINT8 __fastcall RockmanX3ExtraReadByte(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("RockmanX3Extra Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall RockmanX3ExtraReadWord(UINT32 /*sekAddress*/) +{ + return 0x0c; +} + +UINT8 __fastcall SbubExtraReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x400000: return 0x55; + case 0x400002: return 0x0f; + } + + bprintf(PRINT_NORMAL, _T("SbubExtra Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall SbubExtraReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("SbubExtra Read Word %x\n"), sekAddress); + + return 0; +} + +UINT8 __fastcall Kof98ReadByte(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Kof98 Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall Kof98ReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x480000: return 0xaa00; + case 0x4800e0: return 0xaa00; + case 0x4824a0: return 0xaa00; + case 0x488880: return 0xaa00; + case 0x4a8820: return 0x0a00; + case 0x4f8820: return 0x0000; + } + + bprintf(PRINT_NORMAL, _T("Kof98 Read Word %x\n"), sekAddress); + + return 0; +} + +void __fastcall RealtecWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + case 0x400000: { + INT32 BankData = (byteValue >> 1) & 0x7; + + RamMisc->RealtecBankAddr = (RamMisc->RealtecBankAddr & 0x7) | BankData << 3; + + memcpy(RomMain, RomMain + (RamMisc->RealtecBankAddr * 0x20000) + 0x400000, RamMisc->RealtecBankSize * 0x20000); + memcpy(RomMain + RamMisc->RealtecBankSize * 0x20000, RomMain + (RamMisc->RealtecBankAddr * 0x20000) + 0x400000, RamMisc->RealtecBankSize * 0x20000); + return; + } + + case 0x402000:{ + RamMisc->RealtecBankAddr = 0; + RamMisc->RealtecBankSize = byteValue & 0x1f; + return; + } + + case 0x404000: { + INT32 BankData = byteValue & 0x3; + + RamMisc->RealtecBankAddr = (RamMisc->RealtecBankAddr & 0xf8) | BankData; + + memcpy(RomMain, RomMain + (RamMisc->RealtecBankAddr * 0x20000)+ 0x400000, RamMisc->RealtecBankSize * 0x20000); + memcpy(RomMain + RamMisc->RealtecBankSize * 0x20000, RomMain + (RamMisc->RealtecBankAddr * 0x20000) + 0x400000, RamMisc->RealtecBankSize * 0x20000); + return; + } + } + + bprintf(PRINT_NORMAL, _T("Realtec write byte %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall RealtecWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("Realtec write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +void __fastcall Sup19in1BankWriteByte(UINT32 sekAddress, UINT8 /*byteValue*/) +{ + INT32 Offset = (sekAddress - 0xa13000) >> 1; + + memcpy(RomMain + 0x000000, RomMain + 0x400000 + ((Offset << 1) * 0x10000), 0x80000); +} + +void __fastcall Sup19in1BankWriteWord(UINT32 sekAddress, UINT16 /*wordValue*/) +{ + INT32 Offset = (sekAddress - 0xa13000) >> 1; + + memcpy(RomMain + 0x000000, RomMain + 0x400000 + ((Offset << 1) * 0x10000), 0x80000); +} + +void __fastcall Mc12in1BankWriteByte(UINT32 sekAddress, UINT8 /*byteValue*/) +{ + INT32 Offset = (sekAddress - 0xa13000) >> 1; + memcpy(RomMain + 0x000000, OriginalRom + ((Offset & 0x3f) << 17), 0x100000); +} + +void __fastcall Mc12in1BankWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("Mc12in1Bank write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +UINT8 __fastcall TopfigReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x645b45: return 0x9f; + + case 0x6bd295: { + static INT32 x = -1; + + if (SekGetPC(0) == 0x1771a2) { + return 0x50; + } else { + x++; + return (UINT8)x; + } + } + + case 0x6f5345: { + static INT32 x = -1; + + if (SekGetPC(0) == 0x4C94E) { + return SekDbgGetRegister(SEK_REG_D0) & 0xff; + } else { + x++; + return (UINT8)x; + } + } + } + + bprintf(PRINT_NORMAL, _T("Topfig Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall TopfigReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Topfig Read Word %x\n"), sekAddress); + + return 0; +} + +void __fastcall TopfigWriteByte(UINT32 /*sekAddress*/, UINT8 byteValue) +{ + if (byteValue == 0x002a) + { + memcpy(RomMain + 0x060000, RomMain + 0x570000, 0x8000); // == 0x2e*0x8000?! + + } + else if (byteValue==0x0035) // characters ingame + { + memcpy(RomMain + 0x020000, RomMain + 0x5a8000, 0x8000); // == 0x35*0x8000 + } + else if (byteValue==0x000f) // special moves + { + memcpy(RomMain + 0x058000, RomMain + 0x478000, 0x8000); // == 0xf*0x8000 + } + else if (byteValue==0x0000) + { + memcpy(RomMain + 0x060000, RomMain + 0x460000, 0x8000); + memcpy(RomMain + 0x020000, RomMain + 0x420000, 0x8000); + memcpy(RomMain + 0x058000, RomMain + 0x458000, 0x8000); + } +} + +void __fastcall TopfigWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("Topfig write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +static void SetupCustomCartridgeMappers() +{ + if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART_SEPROM)) { + SekOpen(0); + SekMapHandler(7, 0x38fffe, 0x38ffff, SM_READ | SM_WRITE); + SekSetReadByteHandler(7, JCartCtrlReadByte); + SekSetReadWordHandler(7, JCartCtrlReadWord); + SekSetWriteByteHandler(7, JCartCtrlWriteByte); + SekSetWriteWordHandler(7, JCartCtrlWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SSF2) { + OriginalRom = (UINT8*)BurnMalloc(0x500000); + memcpy(OriginalRom, RomMain, 0x500000); + + memcpy(RomMain + 0x800000, OriginalRom + 0x400000, 0x100000); + memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x400000); + memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x400000); + + SekOpen(0); + SekMapHandler(7, 0xa130f0, 0xa130ff, SM_WRITE); + SekSetWriteByteHandler(7, Ssf2BankWriteByte); + SekClose(); + } + + if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_LIONK3) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SKINGKONG)) { + RamMisc->L3AltPDat = 0; + RamMisc->L3AltPCmd = 0; + + OriginalRom = (UINT8*)BurnMalloc(0x200000); + memcpy(OriginalRom, RomMain, 0x200000); + + memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x200000); + memcpy(RomMain + 0x200000, OriginalRom + 0x000000, 0x200000); + + SekOpen(0); + SekMapHandler(7, 0x600000, 0x6fffff, SM_READ | SM_WRITE); + SekSetReadByteHandler(7, LK3AltProtReadByte); + SekSetReadWordHandler(7, LK3AltProtReadWord); + SekSetWriteByteHandler(7, LK3AltProtWriteByte); + SekSetWriteWordHandler(7, LK3AltProtWriteWord); + SekMapHandler(8, 0x700000, 0x7fffff, SM_WRITE); + SekSetWriteByteHandler(8, LK3AltBankWriteByte); + SekSetWriteWordHandler(8, LK3AltBankWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SDK99) { + RamMisc->L3AltPDat = 0; + RamMisc->L3AltPCmd = 0; + + OriginalRom = (UINT8*)BurnMalloc(0x300000); + memcpy(OriginalRom, RomMain, 0x300000); + + memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x300000); + memcpy(RomMain + 0x300000, OriginalRom + 0x000000, 0x100000); + + SekOpen(0); + SekMapHandler(7, 0x600000, 0x6fffff, SM_READ | SM_WRITE); + SekSetReadByteHandler(7, LK3AltProtReadByte); + SekSetReadWordHandler(7, LK3AltProtReadWord); + SekSetWriteByteHandler(7, LK3AltProtWriteByte); + SekSetWriteWordHandler(7, LK3AltProtWriteWord); + SekMapHandler(8, 0x700000, 0x7fffff, SM_WRITE); + SekSetWriteByteHandler(8, LK3AltBankWriteByte); + SekSetWriteWordHandler(8, LK3AltBankWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_REDCL_EN) { + OriginalRom = (UINT8*)BurnMalloc(0x200005); + memcpy(OriginalRom, RomMain, 0x200005); + for (UINT32 i = 0; i < RomSize; i++) { + OriginalRom[i] ^= 0x40; + } + + memcpy(RomMain + 0x000000, OriginalRom + 0x000004, 0x200000); + + SekOpen(0); + SekMapHandler(7, 0x400000, 0x400001, SM_READ); + SekSetReadByteHandler(7, RedclifProt2ReadByte); + SekSetReadWordHandler(7, RedclifProt2ReadWord); + SekMapHandler(8, 0x400004, 0x400005, SM_READ); + SekSetReadByteHandler(8, RedclifProtReadByte); + SekSetReadWordHandler(8, RedclifProtReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_RADICA) { + OriginalRom = (UINT8*)BurnMalloc(RomSize); + memcpy(OriginalRom, RomMain, RomSize); + + memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x400000); + memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x400000); + memcpy(RomMain + 0x800000, OriginalRom + 0x000000, 0x400000); + + SekOpen(0); + SekMapHandler(7, 0xa13000, 0xa1307f, SM_READ); + SekSetReadByteHandler(7, RadicaBankSelectReadByte); + SekSetReadWordHandler(7, RadicaBankSelectReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_KOF99) { + SekOpen(0); + SekMapHandler(7, 0xa13000, 0xa1303f, SM_READ); + SekSetReadByteHandler(7, Kof99A13000ReadByte); + SekSetReadWordHandler(7, Kof99A13000ReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SOULBLAD) { + SekOpen(0); + SekMapHandler(7, 0x400002, 0x400007, SM_READ); + SekSetReadByteHandler(7, SoulbladReadByte); + SekSetReadWordHandler(7, SoulbladReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MJLOVER) { + SekOpen(0); + SekMapHandler(7, 0x400000, 0x400001, SM_READ); + SekSetReadByteHandler(7, MjloverProt1ReadByte); + SekSetReadWordHandler(7, MjloverProt1ReadWord); + SekMapHandler(8, 0x401000, 0x401001, SM_READ); + SekSetReadByteHandler(8, MjloverProt2ReadByte); + SekSetReadWordHandler(8, MjloverProt2ReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SQUIRRELK) { + SekOpen(0); + SekMapHandler(7, 0x400000, 0x400007, SM_READ | SM_WRITE); + SekSetReadByteHandler(7, SquirrelKingExtraReadByte); + SekSetReadWordHandler(7, SquirrelKingExtraReadWord); + SekSetWriteByteHandler(7, SquirrelKingExtraWriteByte); + SekSetWriteWordHandler(7, SquirrelKingExtraWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SMOUSE) { + SekOpen(0); + SekMapHandler(7, 0x400000, 0x400007, SM_READ); + SekSetReadByteHandler(7, SmouseProtReadByte); + SekSetReadWordHandler(7, SmouseProtReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SMB) { + SekOpen(0); + SekMapHandler(7, 0xa13000, 0xa13001, SM_READ); + SekSetReadByteHandler(7, SmbProtReadByte); + SekSetReadWordHandler(7, SmbProtReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SMB2) { + SekOpen(0); + SekMapHandler(7, 0xa13000, 0xa13001, SM_READ); + SekSetReadByteHandler(7, Smb2ProtReadByte); + SekSetReadWordHandler(7, Smb2ProtReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_KAIJU) { + OriginalRom = (UINT8*)BurnMalloc(RomSize); + memcpy(OriginalRom, RomMain, RomSize); + + memcpy(RomMain + 0x400000, OriginalRom, 0x200000); + memcpy(RomMain + 0x600000, OriginalRom, 0x200000); + memcpy(RomMain + 0x000000, OriginalRom, 0x200000); + + SekOpen(0); + SekMapHandler(7, 0x700000, 0x7fffff, SM_WRITE); + SekSetWriteByteHandler(7, KaijuBankWriteByte); + SekSetWriteWordHandler(7, KaijuBankWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CHINFIGHT3) { + OriginalRom = (UINT8*)BurnMalloc(RomSize); + memcpy(OriginalRom, RomMain, RomSize); + + memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x200000); + memcpy(RomMain + 0x600000, OriginalRom + 0x000000, 0x200000); + memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x200000); + + SekOpen(0); + SekMapHandler(7, 0x400000, 0x4fffff, SM_READ); + SekSetReadByteHandler(7, Chinfi3ProtReadByte); + SekSetReadWordHandler(7, Chinfi3ProtReadWord); + SekMapHandler(8, 0x600000, 0x6fffff, SM_WRITE); + SekSetWriteByteHandler(8, Chinfi3BankWriteByte); + SekSetWriteWordHandler(8, Chinfi3BankWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_LIONK2) { + RamMisc->Lionk2ProtData = 0; + RamMisc->Lionk2ProtData2 = 0; + + SekOpen(0); + SekMapHandler(7, 0x400000, 0x400007, SM_READ | SM_WRITE); + SekSetReadByteHandler(7, Lionk2ProtReadByte); + SekSetReadWordHandler(7, Lionk2ProtReadWord); + SekSetWriteByteHandler(7, Lionk2ProtWriteByte); + SekSetWriteWordHandler(7, Lionk2ProtWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_BUGSLIFE) { + SekOpen(0); + SekMapHandler(7, 0xa13000, 0xa13001, SM_READ); + SekSetReadByteHandler(7, BuglExtraReadByte); + SekSetReadWordHandler(7, BuglExtraReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_ELFWOR) { + SekOpen(0); + SekMapHandler(7, 0x400000, 0x400007, SM_READ); + SekSetReadByteHandler(7, Elfwor400000ReadByte); + SekSetReadWordHandler(7, Elfwor400000ReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_ROCKMANX3) { + SekOpen(0); + SekMapHandler(7, 0xa13000, 0xa13001, SM_READ); + SekSetReadByteHandler(7, RockmanX3ExtraReadByte); + SekSetReadWordHandler(7, RockmanX3ExtraReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SBUBBOB) { + SekOpen(0); + SekMapHandler(7, 0x400000, 0x400003, SM_READ); + SekSetReadByteHandler(7, SbubExtraReadByte); + SekSetReadWordHandler(7, SbubExtraReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_KOF98) { + SekOpen(0); + SekMapHandler(7, 0x480000, 0x4fffff, SM_READ); + SekSetReadByteHandler(7, Kof98ReadByte); + SekSetReadWordHandler(7, Kof98ReadWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_REALTEC) { + RamMisc->RealtecBankAddr = 0; + RamMisc->RealtecBankSize = 0; + + OriginalRom = (UINT8*)BurnMalloc(RomSize); + memcpy(OriginalRom, RomMain, RomSize); + + memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x080000); + + for (INT32 i = 0; i < 0x400000; i += 0x2000) { + memcpy(RomMain + i, OriginalRom + 0x7e000, 0x2000); + } + + SekOpen(0); + SekMapHandler(7, 0x400000, 0x40400f, SM_WRITE); + SekSetWriteByteHandler(7, RealtecWriteByte); + SekSetWriteWordHandler(7, RealtecWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MC_SUP19IN1) { + OriginalRom = (UINT8*)BurnMalloc(RomSize); + memcpy(OriginalRom, RomMain, RomSize); + + memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x400000); + + SekOpen(0); + SekMapHandler(7, 0xa13000, 0xa13039, SM_WRITE); + SekSetWriteByteHandler(7, Sup19in1BankWriteByte); + SekSetWriteWordHandler(7, Sup19in1BankWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MC_SUP15IN1) { + OriginalRom = (UINT8*)BurnMalloc(RomSize); + memcpy(OriginalRom, RomMain, RomSize); + + memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x200000); + + SekOpen(0); + SekMapHandler(7, 0xa13000, 0xa13039, SM_WRITE); + SekSetWriteByteHandler(7, Sup19in1BankWriteByte); + SekSetWriteWordHandler(7, Sup19in1BankWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_12IN1) { + OriginalRom = (UINT8*)BurnMalloc(RomSize); + memcpy(OriginalRom, RomMain, RomSize); + + memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x200000); + + SekOpen(0); + SekMapHandler(7, 0xa13000, 0xa1303f, SM_WRITE); + SekSetWriteByteHandler(7, Mc12in1BankWriteByte); + SekSetWriteWordHandler(7, Mc12in1BankWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_TOPFIGHTER) { + OriginalRom = (UINT8*)BurnMalloc(RomSize); + memcpy(OriginalRom, RomMain, RomSize); + + memcpy(RomMain + 0x000000, OriginalRom + 0x000000, 0x200000); + memcpy(RomMain + 0x200000, OriginalRom + 0x000000, 0x200000); + memcpy(RomMain + 0x400000, OriginalRom + 0x000000, 0x200000); + memcpy(RomMain + 0x600000, OriginalRom + 0x000000, 0x200000); + + SekOpen(0); + SekMapHandler(7, 0x600000, 0x6fffff, SM_READ); + SekSetReadByteHandler(7, TopfigReadByte); + SekSetReadWordHandler(7, TopfigReadWord); + SekMapHandler(8, 0x700000, 0x7fffff, SM_WRITE); + SekSetWriteByteHandler(8, TopfigWriteByte); + SekSetWriteWordHandler(8, TopfigWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_POKEMON) { + UINT16 *ROM16 = (UINT16 *)RomMain; + + ROM16[0x0dd19e/2] = 0x47F8; + ROM16[0x0dd1a0/2] = 0xFFF0; + ROM16[0x0dd1a2/2] = 0x4E63; + ROM16[0x0dd46e/2] = 0x4EF8; + ROM16[0x0dd470/2] = 0x0300; + ROM16[0x0dd49c/2] = 0x6002; + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_POKEMON2) { + UINT16 *ROM16 = (UINT16 *)RomMain; + + ROM16[0x06036/2] = 0xE000; + ROM16[0x02540/2] = 0x6026; + ROM16[0x01ED0/2] = 0x6026; + ROM16[0x02476/2] = 0x6022; + + ROM16[0x7E300/2] = 0x60FE; + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MULAN) { + UINT16 *ROM16 = (UINT16 *)RomMain; + + ROM16[0x06036/2] = 0xE000; + } +} + +// SRAM and EEPROM Handling + +UINT8 __fastcall MegadriveSRAMReadByte(UINT32 sekAddress) +{ + if (RamMisc->SRamActive) { + return SRam[(sekAddress - RamMisc->SRamStart) ^ 1]; + } else { + return RomMain[sekAddress ^ 1]; + } +} + +UINT16 __fastcall MegadriveSRAMReadWord(UINT32 sekAddress) +{ + if (RamMisc->SRamActive) { + UINT16 *Ram = (UINT16*)SRam; + return Ram[(sekAddress - RamMisc->SRamStart) >> 1]; + } else { + UINT16 *Rom = (UINT16*)RomMain; + return Rom[sekAddress >> 1]; + } +} + +void __fastcall MegadriveSRAMWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if (RamMisc->SRamActive) { + if (!RamMisc->SRamReadOnly) { + SRam[(sekAddress - RamMisc->SRamStart) ^ 1] = byteValue; + return; + } + } +} + +void __fastcall MegadriveSRAMWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + if (RamMisc->SRamActive) { + if (!RamMisc->SRamReadOnly) { + UINT16 *Ram = (UINT16*)SRam; + Ram[(sekAddress - RamMisc->SRamStart) >> 1] = wordValue; + return; + } + } +} + +static void InstallSRAMHandlers(bool MaskAddr) +{ + UINT32 Mask = MaskAddr ? 0x3fffff : 0xffffff; + + memset(SRam, 0xff, MAX_SRAM_SIZE); + memcpy((UINT8*)MegadriveBackupRam, SRam, RamMisc->SRamEnd - RamMisc->SRamStart + 1); + + SekOpen(0); + SekMapHandler(6, RamMisc->SRamStart & Mask, RamMisc->SRamEnd & Mask, SM_READ | SM_WRITE); + SekSetReadByteHandler(6, MegadriveSRAMReadByte); + SekSetReadWordHandler(6, MegadriveSRAMReadWord); + SekSetWriteByteHandler(6, MegadriveSRAMWriteByte); + SekSetWriteWordHandler(6, MegadriveSRAMWriteWord); + SekClose(); + + RamMisc->SRamHandlersInstalled = 1; +} + +UINT8 __fastcall Megadrive6658ARegReadByte(UINT32 sekAddress) +{ + if (sekAddress & 1) return RamMisc->SRamActive; + + bprintf(PRINT_NORMAL, _T("Megadrive6658AReg Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall Megadrive6658ARegReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Megadrive6658AReg Read Word %x\n"), sekAddress); + + return 0; +} + +void __fastcall Megadrive6658ARegWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if (sekAddress & 1) { + if (byteValue == 1) { + RamMisc->SRamActive = 1; + return; + } + + if (byteValue == 0) { + RamMisc->SRamActive = 0; + return; + } + } + + bprintf(PRINT_NORMAL, _T("6658A Reg write byte %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall Megadrive6658ARegWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("6658A Reg write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +UINT8 __fastcall WboyVEEPROMReadByte(UINT32 sekAddress) +{ + if (sekAddress & 1) return ~RamMisc->I2CMem & 1; + + bprintf(PRINT_NORMAL, _T("WboyVEEPROM Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall WboyVEEPROMReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("WboyVEEPROM Read Word %x\n"), sekAddress); + + return 0; +} + +void __fastcall WboyVEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if (sekAddress & 1) { + RamMisc->I2CClk = (byteValue & 0x0002) >> 1; + RamMisc->I2CMem = (byteValue & 0x0001); + return; + } + + bprintf(PRINT_NORMAL, _T("WboyVEEPROM write byte value %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall WboyVEEPROMWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("WboyVEEPROM write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +UINT8 __fastcall NbajamEEPROMReadByte(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Nbajam Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall NbajamEEPROMReadWord(UINT32 /*sekAddress*/) +{ + return RamMisc->I2CMem & 1; +} + +void __fastcall NbajamEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + bprintf(PRINT_NORMAL, _T("Nbajam write byte value %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall NbajamEEPROMWriteWord(UINT32 /*sekAddress*/, UINT16 wordValue) +{ + RamMisc->I2CClk = (wordValue & 0x0002) >> 1; + RamMisc->I2CMem = (wordValue & 0x0001); +} + +UINT8 __fastcall NbajamteEEPROMReadByte(UINT32 sekAddress) +{ + if (sekAddress & 1) return RamMisc->I2CMem & 1; + + bprintf(PRINT_NORMAL, _T("Nbajamte Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall NbajamteEEPROMReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Nbajamte Read Word %x\n"), sekAddress); + + return 0; +} + +void __fastcall NbajamteEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if (sekAddress & 1) { +// RamMisc->I2CClk = (wordValue & 0x0002) >> 1; + RamMisc->I2CMem = (byteValue & 0x0001); + return; + } + + bprintf(PRINT_NORMAL, _T("Nbajamte write byte value %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall NbajamteEEPROMWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("Nbajamte write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +UINT8 __fastcall EANhlpaEEPROMReadByte(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("EANhlpa Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall EANhlpaEEPROMReadWord(UINT32 /*sekAddress*/) +{ + return (RamMisc->I2CMem & 1) << 7; +} + +void __fastcall EANhlpaEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + bprintf(PRINT_NORMAL, _T("EANhlpa write byte value %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall EANhlpaEEPROMWriteWord(UINT32 /*sekAddress*/, UINT16 wordValue) +{ + RamMisc->I2CClk = ((wordValue & 0x0040) >> 6); + RamMisc->I2CMem = ((wordValue & 0x0080) >> 7); +} + +UINT8 __fastcall CodemastersEEPROMReadByte(UINT32 sekAddress) +{ + if (sekAddress & 1) return RamMisc->I2CMem & 1; + + bprintf(PRINT_NORMAL, _T("Codemasters Read Byte %x\n"), sekAddress); + + return 0; +} + +UINT16 __fastcall CodemastersEEPROMReadWord(UINT32 sekAddress) +{ + bprintf(PRINT_NORMAL, _T("Codemasters Read Word %x\n"), sekAddress); + + return 0; +} + +void __fastcall CodemastersEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if (sekAddress & 1) { + RamMisc->I2CClk = (byteValue & 0x0002) >> 1; + RamMisc->I2CMem = (byteValue & 0x0001); + return; + } else { + RamMisc->I2CClk = (byteValue & 0x0002) >> 1; + RamMisc->I2CMem = (byteValue & 0x0001); + return; + } + + bprintf(PRINT_NORMAL, _T("Codemasters write byte value %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall CodemastersEEPROMWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("Codemasters write word value %04x to location %08x\n"), wordValue, sekAddress); +} + +void __fastcall MegadriveSRAMToggleWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + bprintf(PRINT_NORMAL, _T("SRam Toggle byte %02x to location %08x\n"), byteValue, sekAddress); +} + +void __fastcall MegadriveSRAMToggleWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + bprintf(PRINT_NORMAL, _T("SRam Toggle word value %04x to location %08x\n"), wordValue, sekAddress); +} + +static void MegadriveSetupSRAM() +{ + SRamSize = 0; + RamMisc->SRamStart = 0; + RamMisc->SRamEnd = 0; + RamMisc->SRamDetected = 0; + RamMisc->SRamHandlersInstalled = 0; + RamMisc->SRamActive = 0; + RamMisc->SRamReadOnly = 0; + RamMisc->SRamHasSerialEEPROM = 0; + MegadriveBackupRam = NULL; + + if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_00400) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_00800) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_01000) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_04000) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_10000)) { + RamMisc->SRamStart = 0x200000; + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_00400) RamMisc->SRamEnd = 0x2003ff; + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_00800) RamMisc->SRamEnd = 0x2007ff; + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_01000) RamMisc->SRamEnd = 0x200fff; + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_04000) RamMisc->SRamEnd = 0x203fff; + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_SRAM_10000) RamMisc->SRamEnd = 0x20ffff; + + RamMisc->SRamDetected = 1; + MegadriveBackupRam = (UINT16*)RomMain + RamMisc->SRamStart; + + SekOpen(0); + SekMapHandler(5, 0xa130f0, 0xa130f1, SM_WRITE); + SekSetWriteByteHandler(5, MegadriveSRAMToggleWriteByte); + SekSetWriteWordHandler(5, MegadriveSRAMToggleWriteWord); + SekClose(); + + if (RomSize <= RamMisc->SRamStart) { + RamMisc->SRamActive = 1; + InstallSRAMHandlers(false); + } + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_BEGGAR) { + RamMisc->SRamStart = 0x400000; + RamMisc->SRamEnd = 0x40ffff; + + RamMisc->SRamDetected = 1; + MegadriveBackupRam = (UINT16*)RomMain + RamMisc->SRamStart; + + RamMisc->SRamActive = 1; + InstallSRAMHandlers(false); + } + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MEGADRIVE_FRAM_00400) { + RamMisc->SRamStart = 0x200000; + RamMisc->SRamEnd = 0x2003ff; + + RamMisc->SRamDetected = 1; + MegadriveBackupRam = (UINT16*)RomMain + RamMisc->SRamStart; + + SekOpen(0); + SekMapHandler(5, 0xa130f0, 0xa130f1, SM_READ | SM_WRITE); + SekSetReadByteHandler(5, Megadrive6658ARegReadByte); + SekSetReadWordHandler(5, Megadrive6658ARegReadWord); + SekSetWriteByteHandler(5, Megadrive6658ARegWriteByte); + SekSetWriteWordHandler(5, Megadrive6658ARegWriteWord); + SekClose(); + + InstallSRAMHandlers(false); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SEGA_EEPROM) { + RamMisc->SRamHasSerialEEPROM = 1; + SekOpen(0); + SekMapHandler(5, 0x200000, 0x200001, SM_READ | SM_WRITE); + SekSetReadByteHandler(5, WboyVEEPROMReadByte); + SekSetReadWordHandler(5, WboyVEEPROMReadWord); + SekSetWriteByteHandler(5, WboyVEEPROMWriteByte); + SekSetWriteWordHandler(5, WboyVEEPROMWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_NBA_JAM) { + RamMisc->SRamHasSerialEEPROM = 1; + SekOpen(0); + SekMapHandler(5, 0x200000, 0x200001, SM_READ | SM_WRITE); + SekSetReadByteHandler(5, NbajamEEPROMReadByte); + SekSetReadWordHandler(5, NbajamEEPROMReadWord); + SekSetWriteByteHandler(5, NbajamEEPROMWriteByte); + SekSetWriteWordHandler(5, NbajamEEPROMWriteWord); + SekClose(); + } + + if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_NBA_JAM_TE) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_NFL_QB_96) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_C_SLAM)) { + RamMisc->SRamHasSerialEEPROM = 1; + SekOpen(0); + SekMapHandler(5, 0x200000, 0x200001, SM_READ | SM_WRITE); + SekSetReadByteHandler(5, NbajamteEEPROMReadByte); + SekSetReadWordHandler(5, NbajamteEEPROMReadWord); + SekSetWriteByteHandler(5, NbajamteEEPROMWriteByte); + SekSetWriteWordHandler(5, NbajamteEEPROMWriteWord); + SekClose(); + } + + if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_EA_NHLPA) { + RamMisc->SRamHasSerialEEPROM = 1; + SekOpen(0); + SekMapHandler(5, 0x200000, 0x200001, SM_READ | SM_WRITE); + SekSetReadByteHandler(5, EANhlpaEEPROMReadByte); + SekSetReadWordHandler(5, EANhlpaEEPROMReadWord); + SekSetWriteByteHandler(5, EANhlpaEEPROMWriteByte); + SekSetWriteWordHandler(5, EANhlpaEEPROMWriteWord); + SekClose(); + } + + if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CODE_MASTERS) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART_SEPROM)) { + RamMisc->SRamHasSerialEEPROM = 1; + SekOpen(0); + SekMapHandler(5, 0x300000, 0x300001, SM_WRITE); + SekSetWriteByteHandler(5, CodemastersEEPROMWriteByte); + SekSetWriteWordHandler(5, CodemastersEEPROMWriteWord); + SekMapHandler(6, 0x380000, 0x380001, SM_READ); + SekSetReadByteHandler(6, CodemastersEEPROMReadByte); + SekSetReadWordHandler(6, CodemastersEEPROMReadWord); + SekClose(); + } + + if (!RamMisc->SRamDetected && !RamMisc->SRamHasSerialEEPROM) { + // check if cart has battery save + if (RomMain[0x1b1] == 'R' && RomMain[0x1b0] == 'A') { + // SRAM info found in header + RamMisc->SRamStart = (RomMain[0x1b5] << 24 | RomMain[0x1b4] << 16 | RomMain[0x1b7] << 8 | RomMain[0x1b6]); + RamMisc->SRamEnd = (RomMain[0x1b9] << 24 | RomMain[0x1b8] << 16 | RomMain[0x1bb] << 8 | RomMain[0x1ba]); + + if ((RamMisc->SRamStart > RamMisc->SRamEnd) || ((RamMisc->SRamEnd - RamMisc->SRamStart) >= 0x10000)) { + RamMisc->SRamEnd = RamMisc->SRamStart + 0x0FFFF; + } + + // for some games using serial EEPROM, difference between SRAM end to start is 0 or 1. Currently EEPROM is not emulated. + if ((RamMisc->SRamEnd - RamMisc->SRamStart) < 2) { + RamMisc->SRamHasSerialEEPROM = 1; + } else { + RamMisc->SRamDetected = 1; + } + } else { + // set default SRAM positions, with size = 64k + RamMisc->SRamStart = 0x200000; + RamMisc->SRamEnd = RamMisc->SRamStart + 0xffff; + } + + if (RamMisc->SRamStart & 1) RamMisc->SRamStart -= 1; + + if (!(RamMisc->SRamEnd & 1)) RamMisc->SRamEnd += 1; + + // calculate backup RAM location + MegadriveBackupRam = (UINT16*) (RomMain + (RamMisc->SRamStart & 0x3fffff)); + + if (RamMisc->SRamDetected) { + bprintf(PRINT_IMPORTANT, _T("SRAM detected in header: start %06x - end %06x\n"), RamMisc->SRamStart, RamMisc->SRamEnd); + } + + // Enable SRAM handlers only if the game does not use EEPROM. + if (!RamMisc->SRamHasSerialEEPROM) { + // Info from DGen: If SRAM does not overlap main ROM, set it active by default since a few games can't manage to properly switch it on/off. + if (RomSize <= RamMisc->SRamStart) { + RamMisc->SRamActive = 1; + } + + SekOpen(0); + SekMapHandler(5, 0xa130f0, 0xa130f1, SM_WRITE); + SekSetWriteByteHandler(5, MegadriveSRAMToggleWriteByte); + SekSetWriteWordHandler(5, MegadriveSRAMToggleWriteWord); + SekClose(); + + // Sonic 1 included in Sonic Classics doesn't have SRAM and does lots of ROM access at this range, then only install read write handlers if SRAM is active to not slow down emulation. + if (RamMisc->SRamActive) InstallSRAMHandlers(true); + } + } +} + +INT32 MegadriveInit() +{ + Mem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + MegadriveLoadRoms(0); + MegadriveLoadRoms(1); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(RomMain, 0x000000, 0x3FFFFF, SM_ROM); // 68000 ROM + SekMapMemory(Ram68K, 0xFF0000, 0xFFFFFF, SM_RAM); // 68000 RAM + + SekMapHandler(1, 0xC00000, 0xC0001F, SM_RAM); // Video Port + SekMapHandler(2, 0xA00000, 0xA01FFF, SM_RAM); // Z80 Ram + SekMapHandler(3, 0xA02000, 0xA03FFF, SM_RAM); // Z80 Ram + SekMapHandler(4, 0xA10000, 0xA1001F, SM_RAM); // I/O + + SekSetReadByteHandler (0, MegadriveReadByte); + SekSetReadWordHandler (0, MegadriveReadWord); + SekSetWriteByteHandler(0, MegadriveWriteByte); + SekSetWriteWordHandler(0, MegadriveWriteWord); + + SekSetReadByteHandler (1, MegadriveVideoReadByte); + SekSetReadWordHandler (1, MegadriveVideoReadWord); + SekSetWriteByteHandler(1, MegadriveVideoWriteByte); + SekSetWriteWordHandler(1, MegadriveVideoWriteWord); + + SekSetReadByteHandler (2, MegadriveZ80RamReadByte); + SekSetReadWordHandler (2, MegadriveZ80RamReadWord); + SekSetWriteByteHandler(2, MegadriveZ80RamWriteByte); + SekSetWriteWordHandler(2, MegadriveZ80RamWriteWord); + + SekSetReadByteHandler (3, MegadriveZ80RamReadByte); + SekSetReadWordHandler (3, MegadriveZ80RamReadWord); + SekSetWriteByteHandler(3, MegadriveZ80RamWriteByte); + SekSetWriteWordHandler(3, MegadriveZ80RamWriteWord); + + SekSetReadByteHandler (4, MegadriveIOReadByte); + SekSetReadWordHandler (4, MegadriveIOReadWord); + SekSetWriteByteHandler(4, MegadriveIOWriteByte); + SekSetWriteWordHandler(4, MegadriveIOWriteWord); + + SekSetIrqCallback( MegadriveIrqCallback ); + SekClose(); + } + + { + ZetInit(0); + ZetOpen(0); + + ZetMapArea(0x0000, 0x1FFF, 0, RamZ80); + ZetMapArea(0x0000, 0x1FFF, 1, RamZ80); + ZetMapArea(0x0000, 0x1FFF, 2, RamZ80); + + ZetMapArea(0x2000, 0x3FFF, 0, RamZ80); + ZetMapArea(0x2000, 0x3FFF, 1, RamZ80); + ZetMapArea(0x2000, 0x3FFF, 2, RamZ80); + + + ZetSetReadHandler(MegadriveZ80ProgRead); + ZetSetWriteHandler(MegadriveZ80ProgWrite); + ZetSetInHandler(MegadriveZ80PortRead); + ZetSetOutHandler(MegadriveZ80PortWrite); + ZetClose(); + } + + // OSC_NTSC / 7 + BurnSetRefreshRate(60.0); + + DrvSECAM = 0; + BurnYM2612Init(1, OSC_NTSC / 7, NULL, MegadriveSynchroniseStream, MegadriveGetTime, 0); + BurnTimerAttachSek(OSC_NTSC / 7); + BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYM2612SetRoute(0, BURN_SND_YM2612_YM2612_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + + SN76496Init(0, OSC_NTSC / 15, 1); + SN76496SetRoute(0, 0.25, BURN_SND_ROUTE_BOTH); + + MegadriveSetupSRAM(); + SetupCustomCartridgeMappers(); + + if (MegadriveCallback) MegadriveCallback(); + + pBurnDrvPalette = (UINT32*)MegadriveCurPal; + + MegadriveResetDo(); + + return 0; +} + +INT32 MegadriveExit() +{ + SekExit(); + ZetExit(); + + BurnYM2612Exit(); + SN76496Exit(); + + BurnFree(Mem); + BurnFree(OriginalRom); + + MegadriveCallback = NULL; + cycles_68k = 0; + cycles_z80 = 0; + RomNoByteswap = 0; + MegadriveReset = 0; + RomSize = 0; + RomNum = 0; + SRamSize = 0; + Scanline = 0; + Z80HasBus = 0; + MegadriveZ80Reset = 0; + Hardware = 0; + DrvSECAM = 0; + HighCol = NULL; + + return 0; +} + +//--------------------------------------------------------------- +// Megadrive Draw +//--------------------------------------------------------------- + +static INT32 TileNorm(INT32 sx,INT32 addr,INT32 pal) +{ + UINT8 *pd = HighCol+sx; + UINT32 pack=0; + UINT32 t=0; + + pack = BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid + addr)); // Get 8 pixels + if (pack) { + t=pack&0x0000f000; if (t) pd[0]=(UINT8)(pal|(t>>12)); + t=pack&0x00000f00; if (t) pd[1]=(UINT8)(pal|(t>> 8)); + t=pack&0x000000f0; if (t) pd[2]=(UINT8)(pal|(t>> 4)); + t=pack&0x0000000f; if (t) pd[3]=(UINT8)(pal|(t )); + t=pack&0xf0000000; if (t) pd[4]=(UINT8)(pal|(t>>28)); + t=pack&0x0f000000; if (t) pd[5]=(UINT8)(pal|(t>>24)); + t=pack&0x00f00000; if (t) pd[6]=(UINT8)(pal|(t>>20)); + t=pack&0x000f0000; if (t) pd[7]=(UINT8)(pal|(t>>16)); + return 0; + } + return 1; // Tile blank +} + +static INT32 TileFlip(INT32 sx,INT32 addr,INT32 pal) +{ + UINT8 *pd = HighCol+sx; + UINT32 pack=0; + UINT32 t=0; + + pack = BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid + addr)); // Get 8 pixels + if (pack) { + t=pack&0x000f0000; if (t) pd[0]=(UINT8)(pal|(t>>16)); + t=pack&0x00f00000; if (t) pd[1]=(UINT8)(pal|(t>>20)); + t=pack&0x0f000000; if (t) pd[2]=(UINT8)(pal|(t>>24)); + t=pack&0xf0000000; if (t) pd[3]=(UINT8)(pal|(t>>28)); + t=pack&0x0000000f; if (t) pd[4]=(UINT8)(pal|(t )); + t=pack&0x000000f0; if (t) pd[5]=(UINT8)(pal|(t>> 4)); + t=pack&0x00000f00; if (t) pd[6]=(UINT8)(pal|(t>> 8)); + t=pack&0x0000f000; if (t) pd[7]=(UINT8)(pal|(t>>12)); + return 0; + } + return 1; // Tile blank +} + +// tile renderers for hacky operator sprite support +#define sh_pix(x) \ + if(!t); \ + else if(t==0xe) pd[x]=(UINT8)((pd[x]&0x3f)|0x80); /* hilight */ \ + else if(t==0xf) pd[x]=(UINT8)((pd[x]&0x3f)|0xc0); /* shadow */ \ + else pd[x]=(UINT8)(pal|t); + +static INT32 TileNormSH(INT32 sx,INT32 addr,INT32 pal) +{ + UINT32 pack=0; UINT32 t=0; + UINT8 *pd = HighCol+sx; + + pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels + if (pack) { + t=(pack&0x0000f000)>>12; sh_pix(0); + t=(pack&0x00000f00)>> 8; sh_pix(1); + t=(pack&0x000000f0)>> 4; sh_pix(2); + t=(pack&0x0000000f) ; sh_pix(3); + t=(pack&0xf0000000)>>28; sh_pix(4); + t=(pack&0x0f000000)>>24; sh_pix(5); + t=(pack&0x00f00000)>>20; sh_pix(6); + t=(pack&0x000f0000)>>16; sh_pix(7); + return 0; + } + return 1; // Tile blank +} + +static INT32 TileFlipSH(INT32 sx,INT32 addr,INT32 pal) +{ + UINT32 pack=0; UINT32 t=0; + UINT8 *pd = HighCol+sx; + + pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels + if (pack) { + t=(pack&0x000f0000)>>16; sh_pix(0); + t=(pack&0x00f00000)>>20; sh_pix(1); + t=(pack&0x0f000000)>>24; sh_pix(2); + t=(pack&0xf0000000)>>28; sh_pix(3); + t=(pack&0x0000000f) ; sh_pix(4); + t=(pack&0x000000f0)>> 4; sh_pix(5); + t=(pack&0x00000f00)>> 8; sh_pix(6); + t=(pack&0x0000f000)>>12; sh_pix(7); + return 0; + } + return 1; // Tile blank +} + +static INT32 TileNormZ(INT32 sx,INT32 addr,INT32 pal,INT32 zval) +{ + UINT32 pack=0; + UINT32 t=0; + UINT8 *pd = HighCol+sx; + INT8 *zb = HighSprZ+sx; + INT32 collision = 0, zb_s; + + pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels + if (pack) { + t=pack&0x0000f000; if(t) { zb_s=zb[0]; if(zb_s) collision=1; if(zval>zb_s) { pd[0]=(UINT8)(pal|(t>>12)); zb[0]=(INT8)zval; } } + t=pack&0x00000f00; if(t) { zb_s=zb[1]; if(zb_s) collision=1; if(zval>zb_s) { pd[1]=(UINT8)(pal|(t>> 8)); zb[1]=(INT8)zval; } } + t=pack&0x000000f0; if(t) { zb_s=zb[2]; if(zb_s) collision=1; if(zval>zb_s) { pd[2]=(UINT8)(pal|(t>> 4)); zb[2]=(INT8)zval; } } + t=pack&0x0000000f; if(t) { zb_s=zb[3]; if(zb_s) collision=1; if(zval>zb_s) { pd[3]=(UINT8)(pal|(t )); zb[3]=(INT8)zval; } } + t=pack&0xf0000000; if(t) { zb_s=zb[4]; if(zb_s) collision=1; if(zval>zb_s) { pd[4]=(UINT8)(pal|(t>>28)); zb[4]=(INT8)zval; } } + t=pack&0x0f000000; if(t) { zb_s=zb[5]; if(zb_s) collision=1; if(zval>zb_s) { pd[5]=(UINT8)(pal|(t>>24)); zb[5]=(INT8)zval; } } + t=pack&0x00f00000; if(t) { zb_s=zb[6]; if(zb_s) collision=1; if(zval>zb_s) { pd[6]=(UINT8)(pal|(t>>20)); zb[6]=(INT8)zval; } } + t=pack&0x000f0000; if(t) { zb_s=zb[7]; if(zb_s) collision=1; if(zval>zb_s) { pd[7]=(UINT8)(pal|(t>>16)); zb[7]=(INT8)zval; } } + if(collision) RamVReg->status |= 0x20; + return 0; + } + return 1; // Tile blank +} + +static INT32 TileFlipZ(INT32 sx,INT32 addr,INT32 pal,INT32 zval) +{ + UINT32 pack=0; + UINT32 t=0; + UINT8 *pd = HighCol+sx; + INT8 *zb = HighSprZ+sx; + INT32 collision = 0, zb_s; + + pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels + if (pack) { + t=pack&0x000f0000; if(t) { zb_s=zb[0]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[0]=(UINT8)(pal|(t>>16)); zb[0]=(INT8)zval; } } + t=pack&0x00f00000; if(t) { zb_s=zb[1]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[1]=(UINT8)(pal|(t>>20)); zb[1]=(INT8)zval; } } + t=pack&0x0f000000; if(t) { zb_s=zb[2]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[2]=(UINT8)(pal|(t>>24)); zb[2]=(INT8)zval; } } + t=pack&0xf0000000; if(t) { zb_s=zb[3]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[3]=(UINT8)(pal|(t>>28)); zb[3]=(INT8)zval; } } + t=pack&0x0000000f; if(t) { zb_s=zb[4]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[4]=(UINT8)(pal|(t )); zb[4]=(INT8)zval; } } + t=pack&0x000000f0; if(t) { zb_s=zb[5]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[5]=(UINT8)(pal|(t>> 4)); zb[5]=(INT8)zval; } } + t=pack&0x00000f00; if(t) { zb_s=zb[6]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[6]=(UINT8)(pal|(t>> 8)); zb[6]=(INT8)zval; } } + t=pack&0x0000f000; if(t) { zb_s=zb[7]&0x1f; if(zb_s) collision=1; if(zval>zb_s) { pd[7]=(UINT8)(pal|(t>>12)); zb[7]=(INT8)zval; } } + if(collision) RamVReg->status |= 0x20; + return 0; + } + return 1; // Tile blank +} + + +#define sh_pixZ(x) \ + if(t) { \ + if(zb[x]) collision=1; \ + if(zval>zb[x]) { \ + if (t==0xe) { pd[x]=(UINT8)((pd[x]&0x3f)|0x80); /* hilight */ } \ + else if(t==0xf) { pd[x]=(UINT8)((pd[x]&0x3f)|0xc0); /* shadow */ } \ + else { zb[x]=(INT8)zval; pd[x]=(UINT8)(pal|t); } \ + } \ + } + +static INT32 TileNormZSH(INT32 sx,INT32 addr,INT32 pal,INT32 zval) +{ + UINT32 pack=0; + UINT32 t=0; + UINT8 *pd = HighCol+sx; + INT8 *zb = HighSprZ+sx; + INT32 collision = 0; + + pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels + if (pack) { + t=(pack&0x0000f000)>>12; sh_pixZ(0); + t=(pack&0x00000f00)>> 8; sh_pixZ(1); + t=(pack&0x000000f0)>> 4; sh_pixZ(2); + t=(pack&0x0000000f) ; sh_pixZ(3); + t=(pack&0xf0000000)>>28; sh_pixZ(4); + t=(pack&0x0f000000)>>24; sh_pixZ(5); + t=(pack&0x00f00000)>>20; sh_pixZ(6); + t=(pack&0x000f0000)>>16; sh_pixZ(7); + if(collision) RamVReg->status |= 0x20; + return 0; + } + return 1; // Tile blank +} + +static INT32 TileFlipZSH(INT32 sx,INT32 addr,INT32 pal,INT32 zval) +{ + UINT32 pack=0; + UINT32 t=0; + UINT8 *pd = HighCol+sx; + INT8 *zb = HighSprZ+sx; + INT32 collision = 0; + + pack=BURN_ENDIAN_SWAP_INT32(*(UINT32 *)(RamVid+addr)); // Get 8 pixels + if (pack) { + t=(pack&0x000f0000)>>16; sh_pixZ(0); + t=(pack&0x00f00000)>>20; sh_pixZ(1); + t=(pack&0x0f000000)>>24; sh_pixZ(2); + t=(pack&0xf0000000)>>28; sh_pixZ(3); + t=(pack&0x0000000f) ; sh_pixZ(4); + t=(pack&0x000000f0)>> 4; sh_pixZ(5); + t=(pack&0x00000f00)>> 8; sh_pixZ(6); + t=(pack&0x0000f000)>>12; sh_pixZ(7); + if(collision) RamVReg->status |= 0x20; + return 0; + } + return 1; // Tile blank +} + +static void DrawStrip(struct TileStrip *ts, INT32 sh) +{ + INT32 tilex=0,dx=0,ty=0,code=0,addr=0,cells; + INT32 oldcode=-1,blank=-1; // The tile we know is blank + INT32 pal=0; + + // Draw tiles across screen: + tilex = (-ts->hscroll)>>3; + ty = (ts->line&7)<<1; // Y-Offset into tile + dx = ((ts->hscroll-1)&7)+1; + cells = ts->cells; + if(dx != 8) cells++; // have hscroll, need to draw 1 cell more + + for (; cells; dx+=8,tilex++,cells--) { + INT32 zero=0; + + code=BURN_ENDIAN_SWAP_INT16(RamVid[ts->nametab + (tilex&ts->xmask)]); + if (code==blank) continue; + if (code>>15) { // high priority tile + INT32 cval = code | (dx<<16) | (ty<<25); + if(code&0x1000) cval^=7<<26; + *ts->hc++ = cval; // cache it + continue; + } + + if (code!=oldcode) { + oldcode = code; + // Get tile address/2: + addr=(code&0x7ff)<<4; + addr+=ty; + if (code&0x1000) addr^=0xe; // Y-flip + pal=((code>>9)&0x30)|(sh<<6); + } + + if (code&0x0800) zero=TileFlip(dx,addr,pal); + else zero=TileNorm(dx,addr,pal); + + if (zero) blank=code; // We know this tile is blank now + } + + // terminate the cache list + *ts->hc = 0; +} + +static void DrawStripVSRam(struct TileStrip *ts, INT32 plane) +{ + INT32 tilex=0,dx=0,ty=0,code=0,addr=0,cell=0,nametabadd=0; + INT32 oldcode=-1,blank=-1; // The tile we know is blank + INT32 pal=0,scan=Scanline; + + // Draw tiles across screen: + tilex=(-ts->hscroll)>>3; + dx=((ts->hscroll-1)&7)+1; + if(dx != 8) { + INT32 vscroll, line; + cell--; // have hscroll, start with negative cell + // also calculate intial VS stuff + vscroll = BURN_ENDIAN_SWAP_INT16(RamSVid[plane]); + + // Find the line in the name table + line = (vscroll+scan)&ts->line&0xffff; // ts->line is really ymask .. + nametabadd = (line>>3)<<(ts->line>>24); // .. and shift[width] + ty = (line&7)<<1; // Y-Offset into tile + } + + for (; cell < ts->cells; dx+=8,tilex++,cell++) { + INT32 zero=0; + + if((cell&1)==0) { + INT32 line,vscroll; + vscroll = BURN_ENDIAN_SWAP_INT16(RamSVid[plane+(cell&~1)]); + + // Find the line in the name table + line = (vscroll+scan)&ts->line&0xffff; // ts->line is really ymask .. + nametabadd = (line>>3)<<(ts->line>>24); // .. and shift[width] + ty = (line&7)<<1; // Y-Offset into tile + } + + code = BURN_ENDIAN_SWAP_INT16(RamVid[ts->nametab + nametabadd + (tilex&ts->xmask)]); + if (code==blank) continue; + if (code>>15) { // high priority tile + INT32 cval = code | (dx<<16) | (ty<<25); + if(code&0x1000) cval^=7<<26; + *ts->hc++ = cval; // cache it + continue; + } + + if (code!=oldcode) { + oldcode = code; + // Get tile address/2: + addr=(code&0x7ff)<<4; + if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip + pal=((code>>9)&0x30); + } + + if (code&0x0800) zero=TileFlip(dx,addr,pal); + else zero=TileNorm(dx,addr,pal); + + if (zero) blank=code; // We know this tile is blank now + } + + // terminate the cache list + *ts->hc = 0; +} + +static void DrawStripInterlace(struct TileStrip *ts) +{ + INT32 tilex=0,dx=0,ty=0,code=0,addr=0,cells; + INT32 oldcode=-1,blank=-1; // The tile we know is blank + INT32 pal=0; + + // Draw tiles across screen: + tilex=(-ts->hscroll)>>3; + ty=(ts->line&15)<<1; // Y-Offset into tile + dx=((ts->hscroll-1)&7)+1; + cells = ts->cells; + if(dx != 8) cells++; // have hscroll, need to draw 1 cell more + + for (; cells; dx+=8,tilex++,cells--) { + INT32 zero=0; + + code=BURN_ENDIAN_SWAP_INT16(RamVid[ts->nametab+(tilex&ts->xmask)]); + if (code==blank) continue; + if (code>>15) { // high priority tile + INT32 cval = (code&0xfc00) | (dx<<16) | (ty<<25); + cval |= (code&0x3ff)<<1; + if(code&0x1000) cval^=0xf<<26; + *ts->hc++ = cval; // cache it + continue; + } + + if (code!=oldcode) { + oldcode = code; + // Get tile address/2: + addr=(code&0x7ff)<<5; + if (code&0x1000) addr+=30-ty; else addr+=ty; // Y-flip + pal=((code>>9)&0x30); + } + + if (code&0x0800) zero=TileFlip(dx,addr,pal); + else zero=TileNorm(dx,addr,pal); + + if (zero) blank=code; // We know this tile is blank now + } + + // terminate the cache list + *ts->hc = 0; +} + +static void DrawLayer(INT32 plane, INT32 *hcache, INT32 maxcells, INT32 sh) +{ + const INT8 shift[4]={5,6,5,7}; // 32,64 or 128 sized tilemaps (2 is invalid) + struct TileStrip ts; + INT32 width, height, ymask; + INT32 vscroll, htab; + + ts.hc = hcache; + ts.cells = maxcells; + + // Work out the TileStrip to draw + + // Work out the name table size: 32 64 or 128 tiles (0-3) + width = RamVReg->reg[16]; + height = (width>>4)&3; + width &= 3; + + ts.xmask=(1<1) ymask =0x0ff; + + // Find name table: + if (plane==0) ts.nametab=(RamVReg->reg[2] & 0x38)<< 9; // A + else ts.nametab=(RamVReg->reg[4] & 0x07)<<12; // B + + htab = RamVReg->reg[13] << 9; // Horizontal scroll table address + if ( RamVReg->reg[11] & 2) htab += Scanline<<1; // Offset by line + if ((RamVReg->reg[11] & 1)==0) htab &= ~0xf; // Offset by tile + htab += plane; // A or B + + // Get horizontal scroll value, will be masked later + ts.hscroll = BURN_ENDIAN_SWAP_INT16(RamVid[htab & 0x7fff]); + + if((RamVReg->reg[12]&6) == 6) { + // interlace mode 2 + vscroll = BURN_ENDIAN_SWAP_INT16(RamSVid[plane]); // Get vertical scroll value + + // Find the line in the name table + ts.line=(vscroll+(Scanline<<1))&((ymask<<1)|1); + ts.nametab+=(ts.line>>4)<reg[11]&4) { + // shit, we have 2-cell column based vscroll + // luckily this doesn't happen too often + ts.line = ymask | (shift[width]<<24); // save some stuff instead of line + DrawStripVSRam(&ts, plane); + } else { + vscroll = BURN_ENDIAN_SWAP_INT16(RamSVid[plane]); // Get vertical scroll value + + // Find the line in the name table + ts.line = (vscroll+Scanline)&ymask; + ts.nametab += (ts.line>>3)<reg[3] & 0x3c)<<9; + if (RamVReg->reg[12] & 1) nametab += (Scanline>>3)<<6; // 40-cell mode + else nametab += (Scanline>>3)<<5; // 32-cell mode + + tilex = tstart<<1; + tend <<= 1; + + ty = (Scanline & 7)<<1; // Y-Offset into tile + + if(!(rendstatus & 2)) { + // check the first tile code + code = BURN_ENDIAN_SWAP_INT16(RamVid[nametab + tilex]); + // if the whole window uses same priority (what is often the case), we may be able to skip this field + if((code>>15) != prio) return; + } + + // Draw tiles across screen: + for (; tilex < tend; tilex++) { + INT32 addr=0, zero=0, pal; + + code = BURN_ENDIAN_SWAP_INT16(RamVid[nametab + tilex]); + if(code==blank) continue; + if((code>>15) != prio) { + rendstatus |= 2; + continue; + } + + pal=((code>>9)&0x30); + + if(sh) { + INT32 tmp, *zb = (INT32 *)(HighCol+8+(tilex<<3)); + if(prio) { + tmp = *zb; + if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000; + if(!(tmp&0x00800000)) tmp&=~0x00c00000; if(!(tmp&0x80000000)) tmp&=~0xc0000000; + *zb++=tmp; tmp = *zb; + if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000; + if(!(tmp&0x00800000)) tmp&=~0x00c00000; if(!(tmp&0x80000000)) tmp&=~0xc0000000; + *zb++=tmp; + } else { + pal |= 0x40; + } + } + + // Get tile address/2: + addr = (code&0x7ff)<<4; + if (code&0x1000) addr += 14-ty; else addr += ty; // Y-flip + + if (code&0x0800) zero = TileFlip(8+(tilex<<3),addr,pal); + else zero = TileNorm(8+(tilex<<3),addr,pal); + + if (zero) blank = code; // We know this tile is blank now + } + // terminate the cache list + //*hcache = 0; +} + +static void DrawTilesFromCache(INT32 *hc, INT32 sh) +{ + INT32 code, addr, zero, dx; + INT32 pal; + INT16 blank=-1; // The tile we know is blank + + // *ts->hc++ = code | (dx<<16) | (ty<<25); // cache it + + while((code = *hc++)) { + if(!sh && (INT16)code == blank) continue; + + // Get tile address/2: + addr=(code&0x7ff)<<4; + addr+=(UINT32)code>>25; // y offset into tile + dx=(code>>16)&0x1ff; + if(sh) { + UINT8 *zb = HighCol+dx; + if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++; + if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++; + if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++; + if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++; + } + + pal=((code>>9)&0x30); + + if (code&0x0800) zero=TileFlip(dx,addr,pal); + else zero=TileNorm(dx,addr,pal); + + if(zero) blank=(INT16)code; + } +} + +// Index + 0 : hhhhvvvv ab--hhvv yyyyyyyy yyyyyyyy // a: offscreen h, b: offs. v, h: horiz. size +// Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8 + +static void DrawSprite(INT32 *sprite, INT32 **hc, INT32 sh) +{ + INT32 width=0,height=0; + INT32 row=0,code=0; + INT32 pal; + INT32 tile=0,delta=0; + INT32 sx, sy; + INT32 (*fTileFunc)(INT32 sx,INT32 addr,INT32 pal); + + // parse the sprite data + sy=sprite[0]; + code=sprite[1]; + sx=code>>16; // X + width=sy>>28; + height=(sy>>24)&7; // Width and height in tiles + sy=(sy<<16)>>16; // Y + + row=Scanline-sy; // Row of the sprite we are on + + if (code&0x1000) row=(height<<3)-1-row; // Flip Y + + tile=code&0x7ff; // Tile number + tile+=row>>3; // Tile number increases going down + delta=height; // Delta to increase tile by going right + if (code&0x0800) { tile+=delta*(width-1); delta=-delta; } // Flip X + + tile<<=4; tile+=(row&7)<<1; // Tile address + + if(code&0x8000) { // high priority - cache it + *(*hc)++ = (tile<<16)|((code&0x0800)<<5)|((sx<<6)&0x0000ffc0)|((code>>9)&0x30)|((sprite[0]>>16)&0xf); + } else { + delta<<=4; // Delta of address + pal=((code>>9)&0x30)|(sh<<6); + + if(sh && (code&0x6000) == 0x6000) { + if(code&0x0800) fTileFunc=TileFlipSH; + else fTileFunc=TileNormSH; + } else { + if(code&0x0800) fTileFunc=TileFlip; + else fTileFunc=TileNorm; + } + + for (; width; width--,sx+=8,tile+=delta) { + if(sx<=0) continue; + if(sx>=328) break; // Offscreen + + tile&=0x7fff; // Clip tile address + fTileFunc(sx,tile,pal); + } + } +} + +// Index + 0 : hhhhvvvv s---hhvv yyyyyyyy yyyyyyyy // s: skip flag, h: horiz. size +// Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8 + +static void DrawSpriteZ(INT32 pack, INT32 pack2, INT32 shpri, INT32 sprio) +{ + INT32 width=0,height=0; + INT32 row=0; + INT32 pal; + INT32 tile=0,delta=0; + INT32 sx, sy; + INT32 (*fTileFunc)(INT32 sx,INT32 addr,INT32 pal,INT32 zval); + + // parse the sprite data + sx = pack2>>16; // X + sy = (pack <<16)>>16; // Y + width = pack >>28; + height= (pack >>24)&7; // Width and height in tiles + + row = Scanline-sy; // Row of the sprite we are on + + if (pack2&0x1000) row=(height<<3)-1-row; // Flip Y + + tile = pack2&0x7ff; // Tile number + tile+= row>>3; // Tile number increases going down + delta=height; // Delta to increase tile by going right + if (pack2&0x0800) { // Flip X + tile += delta*(width-1); + delta = -delta; + } + + tile<<=4; + tile+=(row&7)<<1; // Tile address + delta<<=4; // Delta of address + pal=((pack2>>9)&0x30); + if((shpri&1)&&!(shpri&2)) pal|=0x40; + + shpri&=1; + if((pack2&0x6000) != 0x6000) shpri = 0; + shpri |= (pack2&0x0800)>>10; + switch(shpri) { + default: + case 0: fTileFunc=TileNormZ; break; + case 1: fTileFunc=TileNormZSH; break; + case 2: fTileFunc=TileFlipZ; break; + case 3: fTileFunc=TileFlipZSH; break; + } + + for (; width; width--,sx+=8,tile+=delta) { + if(sx<=0) continue; + if(sx>=328) break; // Offscreen + + tile&=0x7fff; // Clip tile address + fTileFunc(sx,tile,pal,sprio); + } +} + + +static void DrawSpriteInterlace(UINT32 *sprite) +{ + INT32 width=0,height=0; + INT32 row=0,code=0; + INT32 pal; + INT32 tile=0,delta=0; + INT32 sx, sy; + + // parse the sprite data + sy=sprite[0]; + height=sy>>24; + sy=(sy&0x3ff)-0x100; // Y + width=(height>>2)&3; height&=3; + width++; height++; // Width and height in tiles + + row=(Scanline<<1)-sy; // Row of the sprite we are on + + code=sprite[1]; + sx=((code>>16)&0x1ff)-0x78; // X + + if (code&0x1000) row^=(16<>4; // Tile number increases going down + delta=height; // Delta to increase tile by going right + if (code&0x0800) { tile+=delta*(width-1); delta=-delta; } // Flip X + + tile<<=5; tile+=(row&15)<<1; // Tile address + + delta<<=5; // Delta of address + pal=((code>>9)&0x30); // Get palette pointer + + for (; width; width--,sx+=8,tile+=delta) { + if(sx<=0) continue; + if(sx>=328) break; // Offscreen + + tile&=0x7fff; // Clip tile address + if (code&0x0800) TileFlip(sx,tile,pal); + else TileNorm(sx,tile,pal); + } +} + + +static void DrawAllSpritesInterlace(INT32 pri, INT32 maxwidth) +{ + INT32 i,u,table,link=0,sline=Scanline<<1; + UINT32 *sprites[80]; // Sprite index + + table = RamVReg->reg[5]&0x7f; + if (RamVReg->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode + table<<=8; // Get sprite table address/2 + + for (i=u=0; u < 80 && i < 21; u++) { + UINT32 *sprite; + INT32 code, sx, sy, height; + + sprite=(UINT32 *)(RamVid+((table+(link<<2))&0x7ffc)); // Find sprite + + // get sprite info + code = BURN_ENDIAN_SWAP_INT32(sprite[0]); + sx = BURN_ENDIAN_SWAP_INT32(sprite[1]); + if(((sx>>15)&1) != pri) goto nextsprite; // wrong priority sprite + + // check if it is on this line + sy = (code&0x3ff)-0x100; + height = (((code>>24)&3)+1)<<4; + if(sline < sy || sline >= sy+height) goto nextsprite; // no + + // check if sprite is not hidden offscreen + sx = (sx>>16)&0x1ff; + sx -= 0x78; // Get X coordinate + 8 + if(sx <= -8*3 || sx >= maxwidth) goto nextsprite; + + // sprite is good, save it's pointer + sprites[i++]=sprite; + + nextsprite: + // Find next sprite + link=(code>>16)&0x7f; + if(!link) break; // End of sprites + } + + // Go through sprites backwards: + for (i-- ;i>=0; i--) + DrawSpriteInterlace(sprites[i]); +} + +static void DrawSpritesFromCache(INT32 *hc, INT32 sh) +{ + INT32 code, tile, sx, delta, width; + INT32 pal; + INT32 (*fTileFunc)(INT32 sx,INT32 addr,INT32 pal); + + // *(*hc)++ = (tile<<16)|((code&0x0800)<<5)|((sx<<6)&0x0000ffc0)|((code>>9)&0x30)|((sprite[0]>>24)&0xf); + + while((code=*hc++)) { + pal=(code&0x30); + delta=code&0xf; + width=delta>>2; delta&=3; + width++; delta++; // Width and height in tiles + if (code&0x10000) delta=-delta; // Flip X + delta<<=4; + tile=((UINT32)code>>17)<<1; + sx=(code<<16)>>22; // sx can be negative (start offscreen), so sign extend + + if(sh && pal == 0x30) { // + if(code&0x10000) fTileFunc=TileFlipSH; + else fTileFunc=TileNormSH; + } else { + if(code&0x10000) fTileFunc=TileFlip; + else fTileFunc=TileNorm; + } + + for (; width; width--,sx+=8,tile+=delta) { + if(sx<=0) continue; + if(sx>=328) break; // Offscreen + + tile&=0x7fff; // Clip tile address + fTileFunc(sx,tile,pal); + } + } +} + +// Index + 0 : ----hhvv -lllllll -------y yyyyyyyy +// Index + 4 : -------x xxxxxxxx pccvhnnn nnnnnnnn +// v +// Index + 0 : hhhhvvvv ab--hhvv yyyyyyyy yyyyyyyy // a: offscreen h, b: offs. v, h: horiz. size +// Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8 + +static void PrepareSprites(INT32 full) +{ + INT32 u=0,link=0,sblocks=0; + INT32 table=0; + INT32 *pd = HighPreSpr; + + table=RamVReg->reg[5]&0x7f; + if (RamVReg->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode + table<<=8; // Get sprite table address/2 + + if (!full) { + INT32 pack; + // updates: tilecode, sx + for (u=0; u < 80 && (pack = *pd); u++, pd+=2) { + UINT32 *sprite; + INT32 code, code2, sx, sy, skip=0; + + sprite=(UINT32 *)(RamVid+((table+(link<<2))&0x7ffc)); // Find sprite + + // parse sprite info + code = BURN_ENDIAN_SWAP_INT32(sprite[0]); + code2 = BURN_ENDIAN_SWAP_INT32(sprite[1]); + code2 &= ~0xfe000000; + code2 -= 0x00780000; // Get X coordinate + 8 in upper 16 bits + sx = code2>>16; + + if((sx <= 8-((pack>>28)<<3) && sx >= -0x76) || sx >= 328) skip=1<<23; + else if ((sy = (pack<<16)>>16) < 240 && sy > -32) { + INT32 sbl = (2<<(pack>>28))-1; + sblocks |= sbl<<(sy>>3); + } + + *pd = (pack&~(1<<23))|skip; + *(pd+1) = code2; + + // Find next sprite + link=(code>>16)&0x7f; + if(!link) break; // End of sprites + } + SpriteBlocks |= sblocks; + } else { + for (; u < 80; u++) { + UINT32 *sprite; + INT32 code, code2, sx, sy, hv, height, width, skip=0, sx_min; + + sprite=(UINT32 *)(RamVid+((table+(link<<2))&0x7ffc)); // Find sprite + + // parse sprite info + code = BURN_ENDIAN_SWAP_INT32(sprite[0]); + sy = (code&0x1ff)-0x80; + hv = (code>>24)&0xf; + height = (hv&3)+1; + + if(sy > 240 || sy + (height<<3) <= 0) skip|=1<<22; + + width = (hv>>2)+1; + code2 = BURN_ENDIAN_SWAP_INT32(sprite[1]); + sx = (code2>>16)&0x1ff; + sx -= 0x78; // Get X coordinate + 8 + sx_min = 8-(width<<3); + + if((sx <= sx_min && sx >= -0x76) || sx >= 328) skip|=1<<23; + else if (sx > sx_min && !skip) { + INT32 sbl = (2<>3; + if(shi < 0) shi=0; // negative sy + sblocks |= sbl<>16)&0x7f; + if(!link) break; // End of sprites + } + SpriteBlocks = sblocks; + *pd = 0; // terminate + } +} + +static void DrawAllSprites(INT32 *hcache, INT32 maxwidth, INT32 prio, INT32 sh) +{ + INT32 i,u,n; + INT32 sx1seen=0; // sprite with x coord 1 or 0 seen + INT32 ntiles = 0; // tile counter for sprite limit emulation + INT32 *sprites[40]; // Sprites to draw in fast mode + INT32 *ps, pack, rs = rendstatus, scan=Scanline; + + if(rs&8) { + DrawAllSpritesInterlace(prio, maxwidth); + return; + } + if(rs&0x11) { + //dprintf("PrepareSprites(%i) [%i]", (rs>>4)&1, scan); + PrepareSprites(rs&0x10); + rendstatus=rs&~0x11; + } + if (!(SpriteBlocks & (1<<(scan>>3)))) return; + + if(((rs&4)||sh)&&prio==0) + memset(HighSprZ, 0, 328); + if(!(rs&4)&&prio) { + if(hcache[0]) DrawSpritesFromCache(hcache, sh); + return; + } + + ps = HighPreSpr; + + // Index + 0 : hhhhvvvv ab--hhvv yyyyyyyy yyyyyyyy // a: offscreen h, b: offs. v, h: horiz. size + // Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8 + + for(i=u=n=0; (pack = *ps) && n < 20; ps+=2, u++) { + INT32 sx, sy, row, pack2; + + if(pack & 0x00400000) continue; + + // get sprite info + pack2 = *(ps+1); + sx = pack2>>16; + sy = (pack <<16)>>16; + row = scan-sy; + + //dprintf("x: %i y: %i %ix%i", sx, sy, (pack>>28)<<3, (pack>>21)&0x38); + + if(sx == -0x77) sx1seen |= 1; // for masking mode 2 + + // check if it is on this line + if(row < 0 || row >= ((pack>>21)&0x38)) continue; // no + n++; // number of sprites on this line (both visible and hidden, max is 20) [broken] + + // sprite limit + ntiles += pack>>28; + if(ntiles > 40) break; + + if(pack & 0x00800000) continue; + + // masking sprite? + if(sx == -0x78) { + if(!(sx1seen&1) || sx1seen==3) { + break; // this sprite is not drawn and remaining sprites are masked + } + if((sx1seen>>8) == 0) sx1seen=(i+1)<<8; + continue; + } + else if(sx == -0x77) { + // masking mode2 (Outrun, Galaxy Force II, Shadow of the beast) + if(sx1seen>>8) { + i=(sx1seen>>8)-1; + break; + } // seen both 0 and 1 + sx1seen |= 2; + continue; + } + + // accurate sprites + //dprintf("P:%i",((sx>>15)&1)); + if(rs&4) { + // might need to skip this sprite + if((pack2&0x8000) ^ (prio<<15)) continue; + DrawSpriteZ(pack,pack2,sh|(prio<<1),(INT8)(0x1f-n)); + continue; + } + + // sprite is good, save it's pointer + sprites[i++]=ps; + } + + // Go through sprites backwards: + if(!(rs&4)) { + for (i--; i>=0; i--) + DrawSprite(sprites[i],&hcache,sh); + + // terminate cache list + *hcache = 0; + } +} + + +static void BackFill(INT32 reg7, INT32 sh) +{ + // Start with a blank scanline (background colour): + UINT32 *pd = (UINT32 *)(HighCol+8); + UINT32 *end= (UINT32 *)(HighCol+8+320); + UINT32 back = reg7 & 0x3f; + back |= sh<<6; + back |= back<<8; + back |= back<<16; + do { pd[0]=pd[1]=pd[2]=pd[3]=back; pd+=4; } while (pd < end); +} + + +static INT32 DrawDisplay(INT32 sh) +{ + INT32 maxw, maxcells; + INT32 win=0, edge=0, hvwind=0; + + if(RamVReg->reg[12] & 1) { + maxw = 328; maxcells = 40; + } else { + maxw = 264; maxcells = 32; + } + + // Find out if the window is on this line: + win = RamVReg->reg[0x12]; + edge = (win & 0x1f)<<3; + + if (win&0x80) { if (Scanline>=edge) hvwind=1; } + else { if (Scanline< edge) hvwind=1; } + + if(!hvwind) { // we might have a vertical window here + win = RamVReg->reg[0x11]; + edge = win&0x1f; + if(win&0x80) { + if(!edge) hvwind=1; + else if(edge < (maxcells>>1)) hvwind=2; + } else { + if(!edge); + else if(edge < (maxcells>>1)) hvwind=2; + else hvwind=1; + } + } + + DrawLayer(1, HighCacheB, maxcells, sh); + if(hvwind == 1) + DrawWindow(0, maxcells>>1, 0, sh); // HighCacheAW + else if(hvwind == 2) { + // ahh, we have vertical window + DrawLayer(0, HighCacheA, (win&0x80) ? edge<<1 : maxcells, sh); + DrawWindow((win&0x80) ? edge : 0, (win&0x80) ? maxcells>>1 : edge, 0, sh); // HighCacheW + } else + DrawLayer(0, HighCacheA, maxcells, sh); + DrawAllSprites(HighCacheS, maxw, 0, sh); + + if(HighCacheB[0]) + DrawTilesFromCache(HighCacheB, sh); + if(hvwind == 1) + DrawWindow(0, maxcells>>1, 1, sh); + else if(hvwind == 2) { + if(HighCacheA[0]) DrawTilesFromCache(HighCacheA, sh); + DrawWindow((win&0x80) ? edge : 0, (win&0x80) ? maxcells>>1 : edge, 1, sh); + } else + if(HighCacheA[0]) DrawTilesFromCache(HighCacheA, sh); + DrawAllSprites(HighCacheS, maxw, 1, sh); + + return 0; +} + +static void PicoFrameStart() +{ + // prepare to do this frame + rendstatus = 0x80 >> 5; // accurate sprites + RamVReg->status &= ~0x0020; + if((RamVReg->reg[12]&6) == 6) rendstatus |= 8; // interlace mode + //if(Pico.m.dirtyPal) Pico.m.dirtyPal = 2; // reset dirty if needed + PrepareSprites(1); +} + +static INT32 PicoLine(INT32 /*scan*/) +{ + INT32 sh = (RamVReg->reg[0xC] & 8)>>3; // shadow/hilight? + + BackFill(RamVReg->reg[7], sh); + if (RamVReg->reg[1] & 0x40) + DrawDisplay(sh); + + { + INT32 num = Scanline + 1; + if (!(RamVReg->reg[1] & 8)) num += 8; + HighCol = HighColFull + ( num * (8 + 320 + 8) ); + }; + + return 0; +} + +static void MegadriveDraw() +{ + UINT16 * pDest = (UINT16 *)pBurnDraw; + + if ((RamVReg->reg[12]&1) || !(MegadriveDIP[1] & 0x03)) { + + for (INT32 j=0; j<224; j++) { + UINT8 * pSrc = HighColFull + (j+9)*(8+320+8) + 8; + for (INT32 i=0;i<320;i++) + pDest[i] = MegadriveCurPal[ pSrc[i] ]; + pDest += 320; + } + + } else { + + if (( MegadriveDIP[1] & 0x03 ) == 0x01 ) { + // Center + pDest += 32; + for (INT32 j=0; j<224; j++) { + UINT8 * pSrc = HighColFull + (j+9)*(8+320+8) + 8; + + memset((UINT8 *)pDest - 32*2, 0, 64); + + for (INT32 i=0;i<256;i++) + pDest[i] = MegadriveCurPal[ pSrc[i] ]; + + memset((UINT8 *)pDest + 256*2, 0, 64); + + pDest += 320; + } + } else { + // Zoom + for (INT32 j=0; j<224; j++) { + UINT8 * pSrc = HighColFull + (j+9)*(8+320+8) + 8; + UINT32 delta = 0; + for (INT32 i=0;i<320;i++) { + pDest[i] = MegadriveCurPal[ pSrc[ delta >> 16 ] ]; + delta += 0xCCCC; + } + pDest += 320; + } + } + + } +} + +#define TOTAL_68K_CYCLES ((double)OSC_NTSC / 7) / 60 +#define TOTAL_Z80_CYCLES ((double)OSC_NTSC / 15) / 60 +#define TOTAL_68K_CYCLES_PAL ((double)OSC_PAL / 7) / 50 +#define TOTAL_Z80_CYCLES_PAL ((double)OSC_PAL / 15) / 50 + +INT32 MegadriveFrame() +{ + if (MegadriveReset) { + MegadriveResetDo(); + MegadriveReset = 0; + } + + if (bMegadriveRecalcPalette) { + for (INT32 i=0;i<0x40;i++) + CalcCol(i, BURN_ENDIAN_SWAP_INT16(RamPal[i])); + bMegadriveRecalcPalette = 0; + } + + JoyPad->pad[0] = JoyPad->pad[1] = JoyPad->pad[2] = JoyPad->pad[3] = 0; + for (INT32 i = 0; i < 12; i++) { + JoyPad->pad[0] |= (MegadriveJoy1[i] & 1) << i; + JoyPad->pad[1] |= (MegadriveJoy2[i] & 1) << i; + JoyPad->pad[2] |= (MegadriveJoy3[i] & 1) << i; + JoyPad->pad[3] |= (MegadriveJoy4[i] & 1) << i; + } + + + SekNewFrame(); + ZetNewFrame(); + + HighCol = HighColFull; + PicoFrameStart(); + + INT32 lines,lines_vis = 224,line_sample; + INT32 done_z80 = 0; + INT32 hint = RamVReg->reg[10]; // Hint counter + INT32 total_68k_cycles, total_z80_cycles; + + if( Hardware & 0x40 ) { + lines = 313; + line_sample = 68; + if( RamVReg->reg[1]&8 ) lines_vis = 240; + total_68k_cycles = (INT32)(INT64)(TOTAL_68K_CYCLES_PAL * nBurnCPUSpeedAdjust / 0x100); + total_z80_cycles = (INT32)TOTAL_Z80_CYCLES_PAL; + } else { + lines = 262; + line_sample = 93; + total_68k_cycles = (INT32)(INT64)(TOTAL_68K_CYCLES * nBurnCPUSpeedAdjust / 0x100); + total_z80_cycles = (INT32)TOTAL_Z80_CYCLES; + } + + cycles_68k = total_68k_cycles / lines; + cycles_z80 = total_z80_cycles / lines; + + RamVReg->status &= ~0x88; // clear V-Int, come out of vblank + + for (INT32 y=0; ypadDelay[0]++ > 25) JoyPad->padTHPhase[0] = 0; + if(JoyPad->padDelay[1]++ > 25) JoyPad->padTHPhase[1] = 0; + } + + // H-Interrupts: + if((y <= lines_vis) && (--hint < 0)) { // y <= lines_vis: Comix Zone, Golden Axe + //dprintf("rhint:old @ %06x", SekPc); + hint = RamVReg->reg[10]; // Reload H-Int counter + RamVReg->pending_ints |= 0x10; + if (RamVReg->reg[0] & 0x10) { + SekOpen(0); + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + } + } + + // V-Interrupt: + if (y == lines_vis) { + //dprintf("vint: @ %06x [%i|%i]", SekPc, y, SekCycleCnt); + RamVReg->status |= 0x88; // V-Int happened, go into vblank + + // there must be a gap between H and V ints, also after vblank bit set (Mazin Saga, Bram Stoker's Dracula) + SekOpen(0); +// done_68k+=SekRun(128); + BurnTimerUpdate((y * cycles_68k) + 128 - cycles_68k); + SekClose(); + + RamVReg->pending_ints |= 0x20; + if(RamVReg->reg[1] & 0x20) { + SekOpen(0); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + SekClose(); + } + } + + // decide if we draw this line + if ((!(RamVReg->reg[1]&8) && y<=224) || ((RamVReg->reg[1]&8) && y<240)) + PicoLine(y); + + // Run scanline + SekOpen(0); + BurnTimerUpdate(y * cycles_68k); + SekClose(); + + if (Z80HasBus && !MegadriveZ80Reset) { + ZetOpen(0); + done_z80 += ZetRun(cycles_z80); + if (y == line_sample) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (y == line_sample + 1) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + } + } + + if (pBurnDraw) MegadriveDraw(); + + SekOpen(0); + BurnTimerEndFrame(total_68k_cycles); + SekClose(); + + if (Z80HasBus && !MegadriveZ80Reset) { + if (done_z80 < total_z80_cycles) { + ZetOpen(0); + ZetRun(total_z80_cycles - done_z80); + ZetClose(); + } + } + + if (pBurnSoundOut) { + SekOpen(0); + BurnYM2612Update(pBurnSoundOut, nBurnSoundLen); + SekClose(); + SN76496Update(0, pBurnSoundOut, nBurnSoundLen); + } + + return 0; +} + +INT32 MegadriveScan(INT32 /*nAction*/, INT32 * /*pnMin*/) +{ + //BurnYM2612Scan(nAction, pnMin); + + return 1; +} diff --git a/src/burn/drv/neogeo/neo_run.cpp b/src/burn/drv/neogeo/neo_run.cpp index 44236d96a..1a9bc1faf 100644 --- a/src/burn/drv/neogeo/neo_run.cpp +++ b/src/burn/drv/neogeo/neo_run.cpp @@ -1,4870 +1,4868 @@ -/* - -struct NeoMediaInfo { - UINT8* p68KROM; - UINT8* pVector; - UINT8* pZ80ROM; - UINT8* pSpriteROM; - UINT8* pTextROM; - UINT8* pADPCMROM; - UINT8* pDeltaTROM; - - INT32 n68KBankOffset; - INT32 nVectorOffset; - - INT32 n68KROMSize; - INT32 nZ80ROMSize; - INT32 nSpriteROMSize; - INT32 nTextROMSize; - INT32 nADPCMROMSize; - INT32 nADeltaROMSize; - - // Function callbacks - - void (*pLoadCallback)(); - void (*pUnloadCallback)(); - void (*pInstallCallback)(); - void (*pUnnstallCallback)(); - void (*pBankswitchCallback)(); - INT32 (*pScan)(int, int*); - - // Private data - - INT32 nSRAMProtectionOffset; - - void* pCustomData; - void* pTextData; -}; - -*/ - -/* - * FB Alpha Neo Geo module - * - * The video frequencies of MVS hardware are: - * hsync: 15625 Hz - * vsync: ~59.18 Hz (264 scanlines make up a single frame) - * The image occupies 224 scanlines, spanning scanlines 24 to 248. - * - * The memory card interface occupies 128KB of memory. There are 2 kinds of - * memory cards that can be used -- 16bit or 8bit. For games, a maximum of 16kB - * data is stored on either, but 16bit cards can be used to transfer bookkeeping - * information. For 8bit cards, only odd bytes are used to address memory and - * the BIOS tests the size of the inserted card by writing to the first byte of - * each 2kB block. The interface used is JEIDA 3.0. - * - * bit 6 of memory location 0x300081 = 0 -> 1/2 slot MVS - * = 1 + bit 5 of 0x320001 = 0 -> 4 slot MVS - * = 1 -> 6 slot MVS - * - * On MVS hardware with multiple slots, address 0x380021 is used to select the - * active slot. - * - * The watchdog timer will reset the system after ~0.13 seconds - * - * On an MV-1F system, the following code was used to test: - * 000100 203C 0001 4F51 MOVE.L #0x14F51,D0 - * 000106 13C0 0030 0001 MOVE.B D0,0x300001 - * 00010C 5380 SUBQ.L #1,D0 - * 00010E 64FC BCC.S *-0x2 [0x10C] - * 000110 13C0 0030 0001 MOVE.B D0,0x300001 - * 000116 60F8 BRA.S *-0x6 [0x110] - * This code loops long enough to sometimes cause a reset, sometimes not. - * The move takes 16 cycles, subq 8, bcc 10 if taken and 8 if not taken, so: - * (0x14F51 * 18 + 14) cycles / 12000000 cycles per second = 0.12876 seconds - * - * Newer games force a reset using the following code (this from kof99): - * 009CDA 203C 0003 0D40 MOVE.L #0x30D40,D0 - * 009CE0 5380 SUBQ.L #1,D0 - * 009CE2 64FC BCC.S *-0x2 [0x9CE0] - * Note however that there is a valid code path after this loop, and indeed - * there are many games that employ the watchdog as a protection device, by - * writing a value to SRAM (usually to 0xD00100) when the watchdog doesn't - * trigger a reset. Later on, the presence of this value can trigger various - * actions, usually a text screen indicating the game is an unlicensed copy. - * - * On AES hardware, reading unmapped memory returns the last value that was on - * the data-bus. - * - * Raster interrupts can be generated by specifying an offset, in pixels. - * This offset can be added to the following (depending on a control register): - * - the position of the electron beam, when setting the offset - * - the position of the electron beam, when interrupt 2 is triggered - * - the position of the electron beam, when interrupt 4 (vblank) is triggered - * - * Note that the offset is *always* relative; when setting the offset from the - * vblank (scanline 248), to trigger an interrupt at scanline 24, you would - * point the offset to 24 scanlines past the screen end at line 264, and set it - * to 15360 (40 scanlines * 384 pixels per scanline). - * - */ - -#include "neogeo.h" -#include "cd_interface.h" -#include "burn_ym2610.h" -#include "bitswap.h" -#include "neocdlist.h" - -// #undef USE_SPEEDHACKS - -// #define LOG_IRQ -// #define LOG_DRAW - -#define NEO_HREFRESH (15625.0) -#define NEO_VREFRESH (NEO_HREFRESH / 264.0) -// #define NEO_VREFRESH (NEO_HREFRESH / 312.0) - -// If defined, enable emulation of the watchdog timer (timing doesn't match real hardware 100%) -#define EMULATE_WATCHDOG - -// If defined, reset the Z80 when switching between the Z80 BIOS/cartridge ROM -//#define Z80_RESET_ON_BANKSWITCH - -// If defined, adjust the Z80 speed along with the 68000 when overclocking -#define Z80_SPEED_ADJUST - -// If defined, use kludges to better align raster effects in some games (e.g. mosyougi) -#define RASTER_KLUDGE - -// If defined, use the bAllowRasters variable to enable/disable raster effects -// #define RASTERS_OPTIONAL - -#if defined Z80_SPEED_ADJUST - static INT32 nZ80Clockspeed; -#else - static const INT32 nZ80Clockspeed = 4000000; -#endif - -#if defined RASTER_KLUDGE - static UINT16 nScanlineOffset; -#else - // 0xF8 is correct as verified on MVS hardware - static const UINT16 nScanlineOffset = 0xF8; -#endif - -#if defined RASTERS_OPTIONAL - static bool bAllowRasters = false; -#endif - -// The number of cartridge slots on the emulated MVS hardware (can be 1, 2, 4, or 6) -UINT8 nNeoNumSlots = 1; - -UINT32 nNeoActiveSlot = 0; - -UINT8 NeoButton1[32] = { 0, }; -UINT8 NeoButton2[8] = { 0, }; -UINT8 NeoButton3[8] = { 0, }; -UINT8 NeoButton4[8] = { 0, }; -UINT8 NeoJoy1[8] = { 0, }; -UINT8 NeoJoy2[8] = { 0, }; -UINT8 NeoJoy3[8] = { 0, }; -UINT8 NeoJoy4[8] = { 0, }; -UINT16 NeoAxis[2] = { 0, }; -UINT8 NeoInput[32] = { 0, }; -UINT8 NeoDiag[2] = { 0, }; -UINT8 NeoDebugDip[2] = { 0, }; -UINT8 NeoReset = 0, NeoSystem = 0; - -static UINT8 OldDebugDip[2]; - -// Which 68K BIOS to use -INT32 nBIOS; - -// Joyports are multiplexed -static INT32 nJoyport0[8] = { 0, }; -static INT32 nJoyport1[8] = { 0, }; - -// Ports always mirror the joystick, except when other controllers are hooked up: -// -// input no. corresponds to -// -// Joyport0: 0x00 : trackball X in irrmaze / p1 paddle in popbounc -// 0x01 : trackball Y in irrmaze -// 0x09 : mahjong controller -// 0x12 : mahjong controller (BIOS controls) -// 0x1B : Always has p1 joystick & buttons -// 0x24 : mahjong controller -// 0x20 & 0x21 : selected by irrmaze instead of 0x00 & 0x01 when you lose a life -// (activates air-jets) -// Joyport1: 0x00 : p2 paddle in popbounc -// 0x1B : Always has p2 joystick & buttons - -// ---------------------------------------------------------------------------- -// Variables that need to be included in savestates - -static INT32 nCyclesExtra[2]; -static INT32 nPrevBurnCPUSpeedAdjust; - -bool bNeoEnableGraphics; - -UINT32 nNeo68KROMBank; - -static INT32 nIRQAcknowledge; - -static INT32 nIRQControl; -static bool bSRAMWritable; - -static bool b68KBoardROMBankedIn; -static bool bZ80BoardROMBankedIn; -static INT32 nZ80Bank0, nZ80Bank1, nZ80Bank2, nZ80Bank3; - -static UINT8* NeoGraphicsRAMBank; -static UINT16 NeoGraphicsRAMPointer; -static INT32 nNeoGraphicsModulo; - -INT32 nNeoSpriteFrame; - -static INT32 nSpriteFrameSpeed; -static INT32 nSpriteFrameTimer; - -static UINT8 nSoundLatch; -static UINT8 nSoundReply; -static UINT32 nSoundStatus; - -#if 1 && defined USE_SPEEDHACKS -static INT32 nSoundPrevReply; -#endif - -static INT32 nInputSelect; -static UINT8* NeoInputBank; -static UINT32 nAnalogAxis[2]; - -static UINT32 nuPD4990ATicks; - -static UINT32 nIRQOffset; - -#define NO_IRQ_PENDING (0x7FFFFFFF) -static INT32 nIRQCycles; - -#if defined EMULATE_WATCHDOG -static INT32 nNeoWatchdog; -#endif - -bool bDisableNeoWatchdog = false; - -static INT32 nNeoCDIRQVector; -static INT32 nNeoCDIRQVectorAck; - -static INT32 nNeoCDZ80ProgWriteWordCancelHack = 0; - -INT32 nNeoScreenWidth; - -UINT8 nLEDLatch, nLED[3]; - -// ---------------------------------------------------------------------------- - -static bool bMemoryCardInserted, bMemoryCardWritable; - -NEO_CALLBACK NeoCallback[MAX_SLOT] = { { NULL, NULL, NULL, NULL, NULL }, }; -NEO_CALLBACK* NeoCallbackActive = &NeoCallback[0]; - -static INT32 nCyclesTotal[2]; -static INT32 nCyclesSegment; -static INT32 nCyclesVBlank; -static INT32 nCycles68KSync; - -UINT8 *Neo68KROM[MAX_SLOT] = { NULL, }, *Neo68KROMActive = NULL; -UINT8 *NeoVector[MAX_SLOT] = { NULL, }, *NeoVectorActive = NULL; -UINT8 *Neo68KFix[MAX_SLOT] = { NULL, }; -UINT8 *NeoZ80ROM[MAX_SLOT] = { NULL, }, *NeoZ80ROMActive = NULL; - -static UINT8 *AllRAM = NULL, *RAMEnd = NULL, *AllROM = NULL, *ROMEnd = NULL; - -UINT8 *NeoSpriteRAM, *NeoTextRAM; - -UINT8 *Neo68KBIOS, *NeoZ80BIOS; -static UINT8 *Neo68KRAM, *NeoZ80RAM, *NeoNVRAM, *NeoNVRAM2, *NeoMemoryCard; - -static UINT32 nSpriteSize[MAX_SLOT] = { 0, }; -static UINT32 nCodeSize[MAX_SLOT] = { 0, }; - -UINT8* NeoGraphicsRAM; - -UINT8* YM2610ADPCMAROM[MAX_SLOT] = { NULL, }; -UINT8* YM2610ADPCMBROM[MAX_SLOT] = { NULL, }; - -static INT32 nYM2610ADPCMASize[MAX_SLOT] = { 0, }; -static INT32 nYM2610ADPCMBSize[MAX_SLOT] = { 0, }; - -static bool bIRQEnabled; -static INT32 nVBLankIRQ; -static INT32 nScanlineIRQ; - -static bool bRenderImage; - -static bool bRenderLineByLine; - -static bool bForcePartialRender; -static bool bForceUpdateOnStatusRead; - -static INT32 nNeoControlConfig; - -static INT32 nNeoSystemType; -static bool bZ80BIOS; - -static INT32 /*nNeoCDCyclesIRQ = 0,*/ nNeoCDCyclesIRQPeriod = 0; - -static bool bUseAsm68KCoreOldValue = false; - -bool IsNeoGeoCD() { - return (nNeoSystemType & NEO_SYS_CD); -} - -// This function is called once to determine how much memory is needed (RAMEnd-(UINT8 *)0), -// then a second time after the memory is allocated to set up all the pointers. -static INT32 RAMIndex() -{ - UINT8* Next = AllRAM; - - NeoPalSrc[0] = Next; Next += 0x002000; // Palette RAM Bank 0 - NeoPalSrc[1] = Next; Next += 0x002000; // Palette RAM Bank 1 - - NeoGraphicsRAM = Next; Next += 0x020000; // Graphics controller RAM (2 64KB banks) - - if (nNeoSystemType & NEO_SYS_CART) { - Neo68KRAM = Next; Next += 0x010000; // 68K work RAM - NeoZ80RAM = Next; Next += 0x000800; // Z80 RAM - - NeoNVRAM = Next; Next += 0x010000; // Battery backed SRAM - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_GAMBLING) { - NeoNVRAM2 = Next; Next += 0x002000; // Extra SRAM for vliner/jockeygp - } - NeoMemoryCard = Next; Next += 0x020000; // Memory card - - if (nNeoSystemType & NEO_SYS_CD) { - NeoSpriteRAM = Next; Next += nSpriteSize[0]; - NeoTextRAM = Next; Next += nNeoTextROMSize[0]; - } - - RAMEnd = Next; - - return 0; -} - -// This function is called once to determine how much memory is needed (ROMEnd-(UINT8*)0), -// then a second time after the memory is allocated to set up all the pointers. -static INT32 ROMIndex() -{ - UINT8* Next = AllROM; - - NeoZ80BIOS = Next; Next += 0x020000; // Z80 boardROM - NeoZoomROM = Next; Next += 0x020000; // Y Zoom table - NeoTextROMBIOS = Next; Next += 0x020000; - - if (nNeoSystemType & NEO_SYS_CART) { - Neo68KBIOS = Next; Next += 0x080000; // 68K boardROM - } else { - Neo68KROM[0] = Next; Next += nCodeSize[0]; - NeoVector[0] = Next; Next += 0x000400; // Copy of 68K cartridge ROM with boardROM vector table - Neo68KBIOS = Next; Next += 0x080000; // 68K boardROM - - NeoZ80ROM[0] = Next; Next += 0x080000; - NeoSpriteROM[0] = Next; Next += nSpriteSize[0]; - NeoTextROM[0] = Next; Next += nNeoTextROMSize[0]; - YM2610ADPCMAROM[0] = Next; Next += nYM2610ADPCMASize[0]; - YM2610ADPCMBROM[0] = Next; Next += nYM2610ADPCMBSize[0]; - } - - ROMEnd = Next; - - return 0; -} - -// ----------------------------------------------------------------------------- -// ROM loading - -static void NeoSetSystemType() -{ - // Neo CD - if (nNeoSystemType & NEO_SYS_CD) { - return; - } - // Dedicated JAMMA PCB - if (nNeoSystemType & NEO_SYS_PCB) { - return; - } - - // See if we're emulating MVS or AES hardware - if (nBIOS == -1 || nBIOS == 10 || nBIOS == 11 || nBIOS == 12 || ((NeoSystem & 0x74) == 0x20)) { - nNeoSystemType = NEO_SYS_CART | NEO_SYS_AES; - return; - } - - nNeoSystemType = NEO_SYS_CART | NEO_SYS_MVS; -} - -static INT32 NeoLoad68KBIOS(INT32 nNewBIOS) -{ - // Neo CD - if (nNeoSystemType & NEO_SYS_CD) { - return 0; - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_TRACKBALL) { - nNewBIOS = 25; - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) { - nNewBIOS = 26; - } - - // The most recent MVS models doesn't have a Z80 BIOS - bZ80BIOS = (nNewBIOS != 0) ? true : false; - - // Check if we need to load a new BIOS - if (nNewBIOS == nBIOS) { - return 0; - } - - nBIOS = nNewBIOS; - - // Load the BIOS ROMs - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { - // Load the BIOS ROMs - BurnLoadRom(Neo68KBIOS, 0x00000 + nBIOS, 1); - } else { - if (nBIOS >= 0) { - BurnLoadRom(Neo68KBIOS, 0x00080 + nBIOS, 1); - } else { - BurnLoadRom(Neo68KBIOS, 0x00080 + 0, 1); - } - } - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "kf2k3pcb") || !strcmp(BurnDrvGetTextA(DRV_NAME), "k2k3pcbd")) kf2k3pcb_bios_decode(); - - NeoUpdateVector(); - - return 0; -} - -static INT32 FindType(const char* pName) -{ - INT32 i = 0; - - while (pName[i] && pName[i] != '-' && pName[i] != '_') { - i++; - } - - return i + 1; -} - -static INT32 FindROMs(UINT32 nType, INT32* pOffset, INT32* pNum) -{ - INT32 nOffset = -1; - INT32 nNum = -1; - - struct BurnRomInfo ri; - ri.nType = 0; - ri.nLen = 0; - - // Invalidate indices - if (pOffset) { - *pOffset = -1; - } - if (pNum) { - *pNum = 0; - } - - do { - if (BurnDrvGetRomInfo(&ri, ++nOffset)) { - return 1; - } - } while ((ri.nType & 7) != nType && nOffset < 0x80); - - if (nOffset >= 0x7F) { - return 1; - } - - do { - if (BurnDrvGetRomInfo(&ri, nOffset + ++nNum)) { - break; - } - } while ((ri.nType & 7) == nType && nOffset < 0x80); - - if (pOffset) { - *pOffset = nOffset; - } - if (pNum) { - *pNum = nNum >= 0 ? nNum : 0; - } - - return 0; -} - -static INT32 LoadRoms() -{ - NeoGameInfo info; - NeoGameInfo* pInfo = &info; - - { - struct BurnRomInfo ri; - - ri.nType = 0; - ri.nLen = 0; - - // Find 'P' ROMs - FindROMs(1, &pInfo->nCodeOffset, &pInfo->nCodeNum); - // Find 'S' ROM - FindROMs(2, &pInfo->nTextOffset, NULL); - // Find 'C' ROMs - FindROMs(3, &pInfo->nSpriteOffset, &pInfo->nSpriteNum); - // Find 'M' ROM - FindROMs(4, &pInfo->nSoundOffset, NULL); - // Find 'V' ROMs - FindROMs(5, &pInfo->nADPCMOffset, &pInfo->nADPCMANum); - FindROMs(6, NULL, &pInfo->nADPCMBNum); - - if (pInfo->nADPCMBNum < 0) { - pInfo->nADPCMBNum = 0; - } - -#if 1 && defined FBA_DEBUG - bprintf(PRINT_IMPORTANT, _T(" - P: %i (%i);"), pInfo->nCodeOffset, pInfo->nCodeNum); - if (pInfo->nTextOffset >= 0) { - bprintf(PRINT_IMPORTANT, _T(" S: %i;"), pInfo->nTextOffset); - } else { - bprintf(PRINT_IMPORTANT, _T(" S: unused;")); - } - bprintf(PRINT_IMPORTANT, _T(" C: %i (%i); M: %i"), pInfo->nSpriteOffset, pInfo->nSpriteNum, pInfo->nSoundOffset); - if (pInfo->nADPCMOffset >= 0) { - bprintf(PRINT_IMPORTANT, _T(" V: %i (%i, %i)"), pInfo->nADPCMOffset, pInfo->nADPCMANum, pInfo->nADPCMBNum); - } else { - bprintf(PRINT_IMPORTANT, _T(" V: unused")); - } - bprintf(PRINT_IMPORTANT,_T("\n")); -#endif - - nCodeSize[nNeoActiveSlot] = 0; - for (INT32 i = 0; i < pInfo->nCodeNum; i++) { - BurnDrvGetRomInfo(&ri, pInfo->nCodeOffset + i); - nCodeSize[nNeoActiveSlot] += ri.nLen; - } - nCodeSize[nNeoActiveSlot] = (nCodeSize[nNeoActiveSlot] + 0x0FFFFF) & ~0x0FFFFF; - - nSpriteSize[nNeoActiveSlot] = 0; - - if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPC) { - BurnDrvGetRomInfo(&ri, pInfo->nSpriteOffset); - // for viewpoin, aof, ssideki - if (pInfo->nSpriteNum == 2) { - nSpriteSize[nNeoActiveSlot] = 0x600000; - } - // for kotm2 - if (pInfo->nSpriteNum == 4) { - BurnDrvGetRomInfo(&ri, pInfo->nSpriteOffset + 2); - if (ri.nLen == 0x080000) { - nSpriteSize[nNeoActiveSlot] = 0x600000; - } - } - } - - if (nSpriteSize[nNeoActiveSlot] == 0) { - - // Compute correct size taking gaps into account (kizuna) - for (INT32 i = 0; i < pInfo->nSpriteNum - 2; i += 2) { - BurnDrvGetRomInfo(&ri, pInfo->nSpriteOffset + i); - if (ri.nLen > nSpriteSize[nNeoActiveSlot]) { - nSpriteSize[nNeoActiveSlot] = ri.nLen; - } - } - nSpriteSize[nNeoActiveSlot] *= pInfo->nSpriteNum - 2; - - // The final 2 ROMs may have a different size - BurnDrvGetRomInfo(&ri, pInfo->nSpriteOffset + pInfo->nSpriteNum - 2); - nSpriteSize[nNeoActiveSlot] += ri.nLen * 2; - } - - { - UINT32 nSize = nSpriteSize[nNeoActiveSlot]; -// if (nSize > 0x4000000) { -// nSize = 0x4000000; -// } - - for (nNeoTileMask[nNeoActiveSlot] = 1; nNeoTileMask[nNeoActiveSlot] < nSize; nNeoTileMask[nNeoActiveSlot] <<= 1) { } - nNeoTileMask[nNeoActiveSlot] = (nNeoTileMask[nNeoActiveSlot] >> 7) - 1; - nNeoMaxTile[nNeoActiveSlot] = nSize >> 7; - } - - if (nNeoTextROMSize[nNeoActiveSlot] == 0) { - if (pInfo->nTextOffset > 0) { - BurnDrvGetRomInfo(&ri, pInfo->nTextOffset); - nNeoTextROMSize[nNeoActiveSlot] = ri.nLen; - } else { - nNeoTextROMSize[nNeoActiveSlot] = 0x080000; - } - } - - nYM2610ADPCMASize[nNeoActiveSlot] = nYM2610ADPCMBSize[nNeoActiveSlot] = 0; - if (pInfo->nADPCMOffset >= 0) { - char* pName; - BurnDrvGetRomInfo(&ri, pInfo->nADPCMOffset); - BurnDrvGetRomName(&pName, pInfo->nADPCMOffset, 0); - nYM2610ADPCMASize[nNeoActiveSlot] = ri.nLen; - - if (pInfo->nADPCMANum > 1) { - BurnDrvGetRomInfo(&ri, pInfo->nADPCMOffset + pInfo->nADPCMANum - 1); - BurnDrvGetRomName(&pName, pInfo->nADPCMOffset + pInfo->nADPCMANum - 1, 0); - if (pInfo->nADPCMBNum == 0) { - nYM2610ADPCMASize[nNeoActiveSlot] *= pName[FindType(pName) + 1] - '1'; - } else { - nYM2610ADPCMASize[nNeoActiveSlot] *= pName[FindType(pName) + 2] - '1'; - } - nYM2610ADPCMASize[nNeoActiveSlot] += ri.nLen; - } - - if (pInfo->nADPCMBNum) { - BurnDrvGetRomInfo(&ri, pInfo->nADPCMOffset + pInfo->nADPCMANum); - nYM2610ADPCMBSize[nNeoActiveSlot] = ri.nLen * (pInfo->nADPCMBNum - 1); - BurnDrvGetRomInfo(&ri, pInfo->nADPCMOffset + pInfo->nADPCMANum + pInfo->nADPCMBNum - 1); - nYM2610ADPCMBSize[nNeoActiveSlot] += ri.nLen; - } - } - } - - if (!strcmp("kof2k4se", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x800000; - if (!strcmp("kf2k4pls", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x800000; - if (!strcmp("svcboot", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x400000; - if (!strcmp("svcplus", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x400000; - if (!strcmp("svcplusa", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x400000; - if (!strcmp("svcsplus", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x400000; - if (!strcmp("pbobblenb", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] = 0x380000; - if (!strcmp("alpham2p", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] = 0x200000; - if (!strcmp("burningfp", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] = 0x180000; - if (!strcmp("kotm2p", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] = 0x300000; - if (!strcmp("sbp", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] = 0x800000; - -// bprintf(PRINT_NORMAL, _T("%x\n"), nYM2610ADPCMASize[nNeoActiveSlot]); - - // The kof2k3 PCB has 96MB of graphics ROM, however the last 16MB are unused, and the protection/decryption hardware does not see them -// if (nSpriteSize[nNeoActiveSlot] > 0x4000000) { -// nSpriteSize[nNeoActiveSlot] = 0x5000000; -// } - - NeoSpriteROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(nSpriteSize[nNeoActiveSlot] < (nNeoTileMask[nNeoActiveSlot] << 7) ? ((nNeoTileMask[nNeoActiveSlot] + 1) << 7) : nSpriteSize[nNeoActiveSlot]); - if (NeoSpriteROM[nNeoActiveSlot] == NULL) { - return 1; - } - -/* if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) { - BurnSetProgressRange(1.0 / ((double)nSpriteSize[nNeoActiveSlot] / 0x800000 / 12)); - } else if (BurnDrvGetHardwareCode() & (HARDWARE_SNK_CMC42 | HARDWARE_SNK_CMC50)) { - BurnSetProgressRange(1.0 / ((double)nSpriteSize[nNeoActiveSlot] / 0x800000 / 9)); - } else { - BurnSetProgressRange(1.0 / ((double)nSpriteSize[nNeoActiveSlot] / 0x800000 / 3)); - }*/ - - if (BurnDrvGetHardwareCode() & (HARDWARE_SNK_CMC42 | HARDWARE_SNK_CMC50)) { - double fRange = (double)pInfo->nSpriteNum / 4.0; - if (fRange < 1.5) { - fRange = 1.5; - } - BurnSetProgressRange(1.0 / fRange); - } else { - BurnSetProgressRange(1.0 / pInfo->nSpriteNum); - } - - // Load sprite data - NeoLoadSprites(pInfo->nSpriteOffset, pInfo->nSpriteNum, NeoSpriteROM[nNeoActiveSlot], nSpriteSize[nNeoActiveSlot]); - - NeoTextROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(nNeoTextROMSize[nNeoActiveSlot]); - if (NeoTextROM[nNeoActiveSlot] == NULL) { - return 1; - } - - // Load Text layer tiledata - { - if (pInfo->nTextOffset != -1) { - // Load S ROM data - BurnLoadRom(NeoTextROM[nNeoActiveSlot], pInfo->nTextOffset, 1); - } else { - // Extract data from the end of C ROMS - BurnUpdateProgress(0.0, _T("Decrypting text layer graphics...")/*, BST_DECRYPT_TXT*/, 0); - NeoCMCExtractSData(NeoSpriteROM[nNeoActiveSlot], NeoTextROM[nNeoActiveSlot], nSpriteSize[nNeoActiveSlot], nNeoTextROMSize[nNeoActiveSlot]); - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) { - for (INT32 i = 0; i < nNeoTextROMSize[nNeoActiveSlot]; i++) { - NeoTextROM[nNeoActiveSlot][i] = BITSWAP08(NeoTextROM[nNeoActiveSlot][i] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3); - } - } - } - } - - Neo68KROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(nCodeSize[nNeoActiveSlot]); // 68K cartridge ROM - if (Neo68KROM[nNeoActiveSlot] == NULL) { - return 1; - } - Neo68KROMActive = Neo68KROM[nNeoActiveSlot]; - Neo68KFix[nNeoActiveSlot] = Neo68KROM[nNeoActiveSlot]; - - // Load the roms into memory - if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SMA_PROTECTION) { - BurnLoadRom(Neo68KROMActive + 0x0C0000, 0, 1); - NeoLoadCode(pInfo->nCodeOffset + 1, pInfo->nCodeNum - 1, Neo68KROMActive + 0x100000); - } else { - NeoLoadCode(pInfo->nCodeOffset, pInfo->nCodeNum, Neo68KROMActive); - } - - NeoZ80ROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(0x080000); // Z80 cartridge ROM - if (NeoZ80ROM[nNeoActiveSlot] == NULL) { - return 1; - } - NeoZ80ROMActive = NeoZ80ROM[nNeoActiveSlot]; - - BurnLoadRom(NeoZ80ROMActive, pInfo->nSoundOffset, 1); - if (BurnDrvGetHardwareCode() & HARDWARE_SNK_ENCRYPTED_M1) { - neogeo_cmc50_m1_decrypt(); - } - - if (NeoCallbackActive && NeoCallbackActive->pInitialise) { - NeoCallbackActive->pInitialise(); - } - - // Decode text data - BurnUpdateProgress(0.0, _T("Preprocessing text layer graphics...")/*, BST_PROCESS_TXT*/, 0); - NeoDecodeText(0, nNeoTextROMSize[nNeoActiveSlot], NeoTextROM[nNeoActiveSlot], NeoTextROM[nNeoActiveSlot]); - - // Decode sprite data - NeoDecodeSprites(NeoSpriteROM[nNeoActiveSlot], nSpriteSize[nNeoActiveSlot]); - - if (pInfo->nADPCMANum) { - char* pName; - struct BurnRomInfo ri; - UINT8* pADPCMData; - - YM2610ADPCMAROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(nYM2610ADPCMASize[nNeoActiveSlot]); - if (YM2610ADPCMAROM[nNeoActiveSlot] == NULL) { - return 1; - } - - ri.nType = 0; - ri.nLen = 0; - BurnDrvGetRomInfo(&ri, pInfo->nADPCMOffset); - BurnDrvGetRomName(&pName, pInfo->nADPCMOffset, 0); - - pADPCMData = YM2610ADPCMAROM[nNeoActiveSlot]; - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "sbp") != 0) { // not for sbp! - // pbobblen needs this (V ROMs are v3 & v4), note aof/wh1/wh1h/kotm2 (V ROMs are v2 & v4) - if (pInfo->nADPCMANum == 2 && pName[FindType(pName) + 1] == '3') { - pADPCMData += ri.nLen * 2; - } - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "pbobblenb")) { - pADPCMData = YM2610ADPCMAROM[nNeoActiveSlot] + 0x200000; - } - - NeoLoadADPCM(pInfo->nADPCMOffset, pInfo->nADPCMANum, pADPCMData); - - if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPV) { - for (INT32 i = 0; i < 0x00200000; i++) { - UINT8 n = YM2610ADPCMAROM[nNeoActiveSlot][i]; - YM2610ADPCMAROM[nNeoActiveSlot][i] = YM2610ADPCMAROM[nNeoActiveSlot][0x00200000 + i]; - YM2610ADPCMAROM[nNeoActiveSlot][0x00200000 + i] = n; - } - } - } - - if (pInfo->nADPCMBNum) { - YM2610ADPCMBROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(nYM2610ADPCMBSize[nNeoActiveSlot]); - if (YM2610ADPCMBROM[nNeoActiveSlot] == NULL) { - return 1; - } - - NeoLoadADPCM(pInfo->nADPCMOffset + pInfo->nADPCMANum, pInfo->nADPCMBNum, YM2610ADPCMBROM[nNeoActiveSlot]); - } else { - YM2610ADPCMBROM[nNeoActiveSlot] = YM2610ADPCMAROM[nNeoActiveSlot]; - nYM2610ADPCMBSize[nNeoActiveSlot] = nYM2610ADPCMASize[nNeoActiveSlot]; - } - - return 0; -} - -// ---------------------------------------------------------------------------- -// Bankswitch / memory map functions - -static void NeoZ80SetBank0(INT32 nBank) -{ - nBank &= 0x0F; - if (nBank != nZ80Bank0) { - UINT8* nStartAddress = NeoZ80ROMActive + (nBank << 14); - ZetMapArea(0x8000, 0xBFFF, 0, nStartAddress); - ZetMapArea(0x8000, 0xBFFF, 2, nStartAddress); - - nZ80Bank0 = nBank; - } - - return; -} - -static void NeoZ80SetBank1(INT32 nBank) -{ - nBank &= 0x1F; - if (nBank != nZ80Bank1) { - UINT8* nStartAddress = NeoZ80ROMActive + (nBank << 13); - ZetMapArea(0xC000, 0xDFFF, 0, nStartAddress); - ZetMapArea(0xC000, 0xDFFF, 2, nStartAddress); - - nZ80Bank1 = nBank; - } - - return; -} - -static void NeoZ80SetBank2(INT32 nBank) -{ - nBank &= 0x3F; - if (nBank != nZ80Bank2) { - UINT8* nStartAddress = NeoZ80ROMActive + (nBank << 12); - ZetMapArea(0xE000, 0xEFFF, 0, nStartAddress); - ZetMapArea(0xE000, 0xEFFF, 2, nStartAddress); - - nZ80Bank2 = nBank; - } - - return; -} - -static void NeoZ80SetBank3(INT32 nBank) -{ - nBank &= 0x7F; - if (nBank != nZ80Bank3) { - UINT8* nStartAddress = NeoZ80ROMActive + (nBank << 11); - ZetMapArea(0xF000, 0xF7FF, 0, nStartAddress); - ZetMapArea(0xF000, 0xF7FF, 2, nStartAddress); - - nZ80Bank3 = nBank; - } - - return; -} - -static void NeoZ80MapROM(bool bMapBoardROM) -{ - if (nNeoSystemType & NEO_SYS_CART) { - if (bMapBoardROM && bZ80BIOS) { - // Bank in the Z80 boardROM - ZetMapArea(0x0000, 0x7FFF, 0, NeoZ80BIOS); - ZetMapArea(0x0000, 0x7FFF, 2, NeoZ80BIOS); - } else { - // Bank in the Z80 cartridge ROM - ZetMapArea(0x0000, 0x7FFF, 0, NeoZ80ROMActive); - ZetMapArea(0x0000, 0x7FFF, 2, NeoZ80ROMActive); - } - } -} - -static void MapVectorTable(bool bMapBoardROM) -{ - if (!bMapBoardROM && Neo68KROMActive) { - SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x000000, 0x0003FF, SM_ROM); - } else { - SekMapMemory(NeoVectorActive, 0x000000, 0x0003FF, SM_ROM); - } -} - -inline static void MapPalette(INT32 nBank) -{ - if (nNeoPaletteBank != nBank) { - nNeoPaletteBank = nBank; - SekMapMemory(NeoPalSrc[nBank], 0x400000, 0x401FFF, SM_ROM); - - NeoSetPalette(); - } -} - -static void Bankswitch(UINT32 nBank) -{ - nBank = 0x100000 + ((nBank & 7) << 20); - if (nBank >= nCodeSize[nNeoActiveSlot]) { - nBank = 0x100000; - } - - if (nBank != nNeo68KROMBank) { -// bprintf(PRINT_NORMAL, "Bankswitched main ROM, new address is 0x%08X.\n", nBank); - nNeo68KROMBank = nBank; - SekMapMemory(Neo68KROMActive + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM); - } -} - -void NeoMapBank() -{ - SekMapMemory(Neo68KROMActive + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM); -} - -void NeoMap68KFix() -{ - if ((nNeoSystemType & NEO_SYS_CART) && (nCodeSize[nNeoActiveSlot] > 0x100000)) { - - SekMapMemory(Neo68KFix[nNeoActiveSlot] + 0x0400, 0x000400, 0x0FFFFF, SM_ROM); - - if (Neo68KROM[nNeoActiveSlot]) { - memcpy(NeoVector[nNeoActiveSlot] + 0x80, Neo68KFix[nNeoActiveSlot] + 0x80, 0x0380); - } - } - - MapVectorTable(b68KBoardROMBankedIn); -} - -void NeoUpdateVector() -{ - // Create copy of 68K with BIOS vector table - for (INT32 i = 0; i < MAX_SLOT; i++) { - if (NeoVector[i]) { - memcpy(NeoVector[i] + 0x00, Neo68KBIOS, 0x0080); - if (Neo68KROM[i]) { - memcpy(NeoVector[i] + 0x80, Neo68KFix[i] + 0x80, 0x0380); - } - } - } -} - -// ---------------------------------------------------------------------------- -// 68K bankswitch for most games without SMA/PVC protection - -void __fastcall neogeoWriteByteBankswitch(UINT32 sekAddress, UINT8 byteValue) -{ - if (sekAddress >= 0x2FFFF0) { - -// bprintf(PRINT_NORMAL, _T(" - Bankswitch: 0x%06X -> 0x%02X\n"), sekAddress, byteValue); - - Bankswitch(byteValue); - return; - } -} - -void __fastcall neogeoWriteWordBankswitch(UINT32 sekAddress, UINT16 wordValue) -{ - if (sekAddress >= 0x2FFFF0) { - -// bprintf(PRINT_NORMAL, _T(" - Bankswitch: 0x%06X -> 0x%04X\n"), sekAddress, wordValue); - - Bankswitch(wordValue); - return; - } -} - -// ---------------------------------------------------------------------------- -// CPU synchronisation - -static inline void neogeoSynchroniseZ80(INT32 nExtraCycles) -{ -#if defined Z80_SPEED_ADJUST - INT32 nCycles = SekTotalCycles() / 3 + nExtraCycles; -#else - INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]) + nExtraCycles; -#endif - - if (nCycles <= ZetTotalCycles()) { - return; - } - - nCycles68KSync = nCycles - nExtraCycles; - - BurnTimerUpdate(nCycles); -} - -// Callbacks for the FM chip - -static void neogeoFMIRQHandler(INT32, INT32 nStatus) -{ -// bprintf(PRINT_NORMAL, _T(" YM2610 IRQ status: 0x%02X (%6i cycles)\n"), nStatus, ZetTotalCycles()); - - if (nStatus & 1) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 neogeoSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / nZ80Clockspeed; -} - -static double neogeoGetTime() -{ - return (double)ZetTotalCycles() / nZ80Clockspeed; -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall neogeoReadByteGambling(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x280001: { - return 0xff - NeoInput[3]; - } - - case 0x2c0001: { - return 0x03; - } - } - -// bprintf(PRINT_NORMAL, _T("Read Byte 0x%08X.\n"), sekAddress); - - return 0xff; -} - -UINT16 __fastcall neogeoReadWordGambling(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x280000: { - return 0xff - NeoInput[3]; - } - - case 0x2c0000: { - return 0x0003; - } - } - -// bprintf(PRINT_NORMAL, _T("Read Word 0x%08X.\n"), sekAddress); - - return 0xffff; -} - -UINT8 __fastcall vliner_timing(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x320000: { - INT32 nReply = nSoundReply; - -#if 1 && defined USE_SPEEDHACKS - // nSoundStatus: &1 = sound latch read, &2 = response written - if (nSoundStatus != 3) { - neogeoSynchroniseZ80(0x0100); - } -#endif - - if (nSoundStatus & 1) { -// bprintf(PRINT_NORMAL, _T(" - Sound reply read (0x%02X).\n"), nSoundReply); - - return nReply; - } else { -// bprintf(PRINT_NORMAL, _T(" - Sound reply read while sound pending (0x%02X).\n"), nSoundReply); - - return nReply & 0x7F; - } - } - - case 0x320001: { -// if (!bAESBIOS) { - if (nBIOS != 10 && nBIOS != 11 && nBIOS != 12) { - UINT8 nuPD4990AOutput = uPD4990ARead(SekTotalCycles() - nuPD4990ATicks); - nuPD4990ATicks = SekTotalCycles(); - return 0x3F | (nuPD4990AOutput << 6); - } - - return (0x3f) & 0xE7; - } - } - -// bprintf(PRINT_NORMAL, _T("Read Byte 0x%08X.\n"), sekAddress); - return 0xff; -} - -// ----------------------------------------------------------------------------- - -static void NeoMapActiveCartridge() -{ - if (!(nNeoSystemType & NEO_SYS_CART)) { - nNeoActiveSlot = 0; - return; - } - - neogeoSynchroniseZ80(0); - - if (NeoCallbackActive && NeoCallbackActive->pRemoveHandlers) { - NeoCallbackActive->pRemoveHandlers(); - } - - NeoVectorActive = NeoVector[nNeoActiveSlot]; - - if (Neo68KROM[nNeoActiveSlot] == NULL) { - - // If an empty slot is selected, only the vector table is valid - - Neo68KROMActive = NULL; - - SekMapHandler(0, 0x000000, 0x0FFFFF, SM_RAM); - SekMapHandler(0, 0x200000, 0x2FFFFF, SM_RAM); - - b68KBoardROMBankedIn = true; - MapVectorTable(b68KBoardROMBankedIn); - - NeoCallbackActive = NULL; - - ZetSetBUSREQLine(1); - - NeoSetSpriteSlot(nNeoActiveSlot); - NeoSetTextSlot(nNeoActiveSlot); - - return; - } - - Neo68KROMActive = Neo68KROM[nNeoActiveSlot]; - NeoZ80ROMActive = NeoZ80ROM[nNeoActiveSlot]; - NeoCallbackActive = &NeoCallback[nNeoActiveSlot]; - - SekSetReadWordHandler(6, NULL); - SekSetWriteWordHandler(6, NULL); - SekSetReadByteHandler(6, NULL); - SekSetWriteByteHandler(6, NULL); - SekSetReadWordHandler(7, NULL); - SekSetWriteWordHandler(7, NULL); - SekSetReadByteHandler(7, NULL); - SekSetWriteByteHandler(7, NULL); - - SekMapHandler(0, 0x000000, 0x0FFFFF, SM_WRITE); - - if (nCodeSize[nNeoActiveSlot] <= 0x080000) { - SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x000000, 0x07FFFF, SM_ROM); - SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x080000, 0x0FFFFF, SM_ROM); - SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x200000, 0x27FFFF, SM_ROM); - SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x280000, 0x2FFFFF, SM_ROM); - } - - if (nCodeSize[nNeoActiveSlot] <= 0x100000) { - SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x000000, 0x0FFFFF, SM_ROM); - SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x200000, 0x2FFFFF, SM_ROM); - } - - if (nCodeSize[nNeoActiveSlot] > 0x100000) { - SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x000000, 0x0FFFFF, SM_ROM); - - SekMapHandler(4, 0x200000, 0x2FFFFF, SM_WRITE); - - SekSetWriteWordHandler(4, neogeoWriteWordBankswitch); - SekSetWriteByteHandler(4, neogeoWriteByteBankswitch); - } - - if (NeoCallbackActive->pInstallHandlers) { - NeoCallbackActive->pInstallHandlers(); - } - - if (nCodeSize[nNeoActiveSlot] > 0x100000) { - nNeo68KROMBank = 0x100000; - - if (NeoCallbackActive->pBankswitch) { - NeoCallbackActive->pBankswitch(); - } else { - if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) { - NeoMapBank(); - } - } - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_GAMBLING) { - SekMapMemory(NeoNVRAM2, 0x200000, 0x201FFF, SM_RAM); // 68K RAM - - SekMapHandler(6, 0x202000, 0x2FFFFF, SM_READ); - SekSetReadByteHandler(6, neogeoReadByteGambling); - SekSetReadWordHandler(6, neogeoReadWordGambling); - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "vliner") || !strcmp(BurnDrvGetTextA(DRV_NAME), "vlinero")) { - SekMapHandler(7, 0x320000, 0x320001, SM_READ); - SekSetReadByteHandler(7, vliner_timing); - } - } - - if (NeoZ80ROMActive) { - ZetSetBUSREQLine(0); - - nZ80Bank0 = nZ80Bank1 = nZ80Bank2 = nZ80Bank3 = -1; - NeoZ80SetBank0(0x02); - NeoZ80SetBank1(0x06); - NeoZ80SetBank2(0x0E); - NeoZ80SetBank3(0x1E); - } else { - ZetSetBUSREQLine(1); - } - - MapVectorTable(b68KBoardROMBankedIn); - NeoZ80MapROM(bZ80BoardROMBankedIn); - - NeoSetSpriteSlot(nNeoActiveSlot); - NeoSetTextSlot(nNeoActiveSlot); - - // the text rendering code will get confused if we don't do this - memset(NeoGraphicsRAM + 0xEA00, 0, 0x0200); - - BurnYM2610MapADPCMROM(YM2610ADPCMAROM[nNeoActiveSlot], nYM2610ADPCMASize[nNeoActiveSlot], YM2610ADPCMBROM[nNeoActiveSlot], nYM2610ADPCMBSize[nNeoActiveSlot]); - - return; -} - -// ----------------------------------------------------------------------------- -// Savestate support - -INT32 NeoScan(INT32 nAction, INT32* pnMin) -{ - INT32 nOldBIOS = nBIOS; - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029713; - } - - // Make sure we have the correct value for nBIOS - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(nBIOS); - // Update the system type immediately - NeoSetSystemType(); - } - - if (nAction & ACB_MEMORY_ROM) { - - if (nNeoSystemType & NEO_SYS_CART) { - ba.Data = Neo68KBIOS; - ba.nLen = 0x80000;//(nNeoSystemType & NEO_SYS_PCB) ? 0x00080000 : 0x00020000; - ba.nAddress = 0; - ba.szName = "68K BIOS"; - BurnAcb(&ba); - - ba.Data = Neo68KROMActive; - ba.nLen = nCodeSize[nNeoActiveSlot]; - ba.nAddress = 0; - ba.szName = "68K ROM"; - BurnAcb(&ba); - - ba.Data = NeoZ80BIOS; - ba.nLen = 0x00020000; - ba.nAddress = 0; - ba.szName = "Z80 BIOS"; - BurnAcb(&ba); - - ba.Data = NeoZ80ROMActive; - ba.nLen = 0x00080000; - ba.nAddress = 0; - ba.szName = "Z80 ROM"; - BurnAcb(&ba); - - ba.Data = YM2610ADPCMAROM[nNeoActiveSlot]; - ba.nLen = nYM2610ADPCMASize[nNeoActiveSlot]; - ba.nAddress = 0; - ba.szName = "ADPCM ROM"; - BurnAcb(&ba); - - ba.Data = YM2610ADPCMBROM[nNeoActiveSlot]; - ba.nLen = nYM2610ADPCMBSize[nNeoActiveSlot]; - ba.nAddress = 0; - ba.szName = "Delta-T ROM"; - BurnAcb(&ba); - } else { - ba.Data = Neo68KBIOS; - ba.nLen = 0x00080000; - ba.nAddress = 0; - ba.szName = "68K BIOS"; - BurnAcb(&ba); - } - } - - if (nAction & ACB_MEMCARD) { - if ((nNeoSystemType & NEO_SYS_CART) && !(nNeoSystemType & NEO_SYS_PCB)) { // Scan memory card - - if (pnMin && (nAction & ACB_TYPEMASK) == ACB_MEMCARD) { // Return minimum compatible version - *pnMin = 0x029713; - } - - ba.Data = NeoMemoryCard; - ba.nLen = 0x020000; - ba.nAddress = 0; - ba.szName = "Memory card"; - - if ((nAction & ACB_TYPEMASK) == ACB_MEMCARD) { - if (nAction & ACB_WRITE) { - bMemoryCardInserted = true; - } - if (nAction & ACB_READ) { - bMemoryCardInserted = false; - - // If a card is inserted, determine the size - if (*((UINT16*)NeoMemoryCard) != 0x8000) { - INT32 nSize = (NeoMemoryCard[21] << 8) | NeoMemoryCard[23]; - if (nSize >= 0x1000) { - ba.nLen = nSize; - } - } - } - } - - BurnAcb(&ba); - } - } - - if ((nNeoSystemType & NEO_SYS_CD) && (nAction & ACB_NVRAM)) { // Scan non-volatile memory (built-in memory card) - - if (pnMin && (nAction & ACB_TYPEMASK) == ACB_NVRAM) { // Return minimum compatible version - *pnMin = 0x029713; - } - - ba.Data = NeoMemoryCard; - ba.nLen = 0x004000; - ba.nAddress = 0; - ba.szName = "Memory card"; - BurnAcb(&ba); - } - - if ((nNeoSystemType & NEO_SYS_MVS) && (nAction & ACB_NVRAM)) { // Scan non-volatile memory - - if (pnMin && (nAction & ACB_TYPEMASK) == ACB_NVRAM) { // Return minimum compatible version - *pnMin = 0x029713; - } - - ba.Data = NeoNVRAM; - ba.nLen = 0x00010000; - ba.nAddress = 0; - ba.szName = "NVRAM"; - BurnAcb(&ba); - } - - if (((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_GAMBLING) && (nAction & ACB_NVRAM)) { - ba.Data = NeoNVRAM2; - ba.nLen = 0x00002000; - ba.nAddress = 0; - ba.szName = "Extra NVRAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_MEMORY_RAM) { // Scan RAM - - if (nNeoSystemType & NEO_SYS_CART) { - ba.Data = Neo68KRAM; - ba.nLen = 0x00010000; - ba.nAddress = 0; - ba.szName = "68K RAM"; - BurnAcb(&ba); - - ba.Data = NeoZ80RAM; - ba.nLen = 0x00000800; - ba.nAddress = 0; - ba.szName = "Z80 RAM"; - BurnAcb(&ba); - } - - if (nNeoSystemType & NEO_SYS_CD) { - ba.Data = Neo68KROMActive; - ba.nLen = nCodeSize[0]; - ba.nAddress = 0; - ba.szName = "68K program RAM"; - BurnAcb(&ba); - - ba.Data = NeoZ80ROMActive; - ba.nLen = 0x00080000; - ba.nAddress = 0; - ba.szName = "Z80 program RAM"; - BurnAcb(&ba); - } - - ba.Data = NeoPalSrc[0]; - ba.nLen = 0x000002000; - ba.nAddress = 0; - ba.szName = "Palette 0"; - BurnAcb(&ba); - ba.Data = NeoPalSrc[1]; - ba.nLen = 0x000002000; - ba.nAddress = 0; - ba.szName = "Palette 1"; - BurnAcb(&ba); - - ba.Data = NeoGraphicsRAM; - ba.nLen = 0x00020000; - ba.nAddress = 0; - ba.szName = "Graphics RAM"; - BurnAcb(&ba); - - if (nNeoSystemType & NEO_SYS_CD) { - ba.Data = NeoSpriteRAM; - ba.nLen = nSpriteSize[0]; - ba.nAddress = 0; - ba.szName = "Sprite layer tile RAM"; - BurnAcb(&ba); - - ba.Data = NeoTextRAM; - ba.nLen = nNeoTextROMSize[0]; - ba.nAddress = 0; - ba.szName = "Text layer tile RAM"; - BurnAcb(&ba); - - ba.Data = YM2610ADPCMBROM[0]; - ba.nLen = nYM2610ADPCMBSize[0]; - ba.nAddress = 0; - ba.szName = "ADPCM sample RAM"; - BurnAcb(&ba); - } - - if (NeoCallbackActive && NeoCallbackActive->pScan) { - NeoCallbackActive->pScan(nAction, pnMin); - } - } - - if (nAction & ACB_DRIVER_DATA) { // Scan driver data - - SekScan(nAction); // Scan 68000 state - ZetScan(nAction); // Scan Z80 state - - BurnYM2610Scan(nAction, pnMin); - - if (nNeoSystemType & NEO_SYS_MVS) { - uPD4990AScan(nAction, pnMin); - } - - if (NeoCallbackActive && NeoCallbackActive->pScan) { - NeoCallbackActive->pScan(nAction, pnMin); - } - - SCAN_VAR(nCyclesExtra); - - SCAN_VAR(bNeoEnableGraphics); - SCAN_VAR(nIRQAcknowledge); - - SCAN_VAR(nIRQControl); SCAN_VAR(nIRQOffset); SCAN_VAR(nIRQCycles); - SCAN_VAR(bSRAMWritable); - -#if defined EMULATE_WATCHDOG - SCAN_VAR(nNeoWatchdog); -#endif - - SCAN_VAR(b68KBoardROMBankedIn); - if (nNeoSystemType & NEO_SYS_CART) { - SCAN_VAR(bBIOSTextROMEnabled); - SCAN_VAR(nZ80Bank0); SCAN_VAR(nZ80Bank1); SCAN_VAR(nZ80Bank2); SCAN_VAR(nZ80Bank3); - SCAN_VAR(nNeo68KROMBank); - } - - SCAN_OFF(NeoGraphicsRAMBank, NeoGraphicsRAM, nAction); - - SCAN_VAR(nNeoSpriteFrame); SCAN_VAR(nSpriteFrameSpeed); SCAN_VAR(nSpriteFrameTimer); - - SCAN_VAR(nNeoPaletteBank); - - SCAN_VAR(nSoundLatch); - SCAN_VAR(nSoundReply); - SCAN_VAR(nSoundStatus); - -#if 1 && defined USE_SPEEDHACKS - SCAN_VAR(nSoundPrevReply); -#endif - - SCAN_VAR(nInputSelect); - - SCAN_OFF(NeoInputBank, NeoInput, nAction); - - SCAN_VAR(nAnalogAxis); - - SCAN_VAR(nuPD4990ATicks); - - SCAN_OFF(Neo68KFix[nNeoActiveSlot], Neo68KROM[nNeoActiveSlot], nAction); - - if (nAction & ACB_WRITE) { - INT32 nNewBIOS = nBIOS; - INT32 nBank; - - SekOpen(0); - NeoMap68KFix(); - SekClose(); - - if (nNeoSystemType & NEO_SYS_CART) { - ZetOpen(0); - NeoZ80MapROM(bZ80BoardROMBankedIn); - - nBank = nZ80Bank0; nZ80Bank0 = -1; - NeoZ80SetBank0(nBank); - nBank = nZ80Bank1; nZ80Bank1 = -1; - NeoZ80SetBank1(nBank); - nBank = nZ80Bank2; nZ80Bank2 = -1; - NeoZ80SetBank2(nBank); - nBank = nZ80Bank3; nZ80Bank3 = -1; - NeoZ80SetBank3(nBank); - ZetClose(); - - if (NeoCallbackActive && NeoCallbackActive->pBankswitch) { - NeoCallbackActive->pBankswitch(); - } else { - if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) { - SekOpen(0); - SekMapMemory(Neo68KROMActive + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM); - SekClose(); - } - } - } - - nBank = nNeoPaletteBank; nNeoPaletteBank = -1; - SekOpen(0); - MapPalette(nBank); - SekClose(); - - NeoRecalcPalette = 1; - - if (nNeoSystemType & NEO_SYS_CART) { - nBIOS = nOldBIOS; - NeoLoad68KBIOS(nNewBIOS); - - NeoSetSystemType(); - } - - nPrevBurnCPUSpeedAdjust = -1; - - SCAN_VAR(nLEDLatch); - SCAN_VAR(nLED[3]); - -// BurnGameFeedback(sizeof(nLED), nLED); - } - } - - return 0; -} - -// ----------------------------------------------------------------------------- -// Z80 handlers - -UINT8 __fastcall neogeoZ80In(UINT16 nAddress) -{ - switch (nAddress & 0xFF) { - case 0x00: // Read sound command -// bprintf(PRINT_NORMAL, _T(" - Sound command received (0x%02X).\n"), nSoundLatch); - nSoundStatus = 1; -#if 1 && defined USE_SPEEDHACKS - nSoundPrevReply = -1; -#endif - return nSoundLatch; - - case 0x04: - return BurnYM2610Read(0); - case 0x05: - return BurnYM2610Read(1); - case 0x06: - return BurnYM2610Read(2); - - case 0x08: -// bprintf(PRINT_NORMAL, " - Z80 bank 3 -> 0x%02X\n", nAddress >> 8); - NeoZ80SetBank3(nAddress >> 8); - break; - case 0x09: -// bprintf(PRINT_NORMAL, " - Z80 bank 2 -> 0x%02X\n", nAddress >> 8); - NeoZ80SetBank2(nAddress >> 8); - break; - case 0x0A: -// bprintf(PRINT_NORMAL, " - Z80 bank 1 -> 0x%02X\n", nAddress >> 8); - NeoZ80SetBank1(nAddress >> 8); - break; - case 0x0B: -// bprintf(PRINT_NORMAL, " - Z80 bank 0 -> 0x%02X\n", nAddress >> 8); - NeoZ80SetBank0(nAddress >> 8); - break; - -// default: { -// bprintf(PRINT_NORMAL, _T)" - Z80 read port 0x%04X.\n"), nAddress); -// } - } - - return 0; -} - -UINT8 __fastcall neogeoZ80InCD(UINT16 nAddress) -{ - switch (nAddress & 0xFF) { - case 0x00: // Read sound command -// bprintf(PRINT_NORMAL, _T(" - Sound command received (0x%02X).\n"), nSoundLatch); - nSoundStatus = 1; -#if 1 && defined USE_SPEEDHACKS - nSoundPrevReply = -1; -#endif - return nSoundLatch; - - case 0x04: - return BurnYM2610Read(0); - case 0x05: - return BurnYM2610Read(1); - case 0x06: - return BurnYM2610Read(2); - - // banskswitch on MVS/AES - case 0x08: - case 0x09: - case 0x0A: - case 0x0B: - break; - - default: { -// bprintf(PRINT_NORMAL, _T(" - Z80 read port 0x%04X.\n"), nAddress); - } - } - - return 0; -} - -void __fastcall neogeoZ80Out(UINT16 nAddress, UINT8 nValue) -{ - switch (nAddress & 0x0FF) { - case 0x00: -// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x00 -> 0x%02X.\n"), nValue); - break; - case 0x04: - case 0x05: - case 0x06: - case 0x07: - BurnYM2610Write(nAddress & 3, nValue); - break; - - case 0x0C: // Write reply to sound commands -// bprintf(PRINT_NORMAL, _T(" - Sound reply sent (0x%02X).\n"), nValue); - nSoundReply = nValue; - -#if 1 && defined USE_SPEEDHACKS - if (nSoundPrevReply != nValue) { - nSoundPrevReply = nValue; - - // s1945p replies a 0x00, then an 0xFF; - // the 68K loops until it has read both - if (nSoundReply == 0) { - nSoundStatus &= ~2; - } else { - nSoundStatus |= 2; - } - } else { - nSoundStatus |= 2; - } - - if (ZetTotalCycles() > nCycles68KSync) { - -// bprintf(PRINT_NORMAL, _T(" %i\n"), ZetTotalCycles()); - BurnTimerUpdateEnd(); -// bprintf(PRINT_NORMAL, _T(" %i - %i\n"), ZetTotalCycles(), nCycles68KSync); - } -#endif - - break; - - case 0x80: - bprintf(PRINT_ERROR, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue); - break; - - default: { -// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue); - } - } -} - -// ----------------------------------------------------------------------------- -// 68K handlers - -INT32 __fastcall NeoCDIRQCallback(INT32 /* nIRQ */) -{ -// bprintf(PRINT_NORMAL, _T(" - IRQ Callback %i %2X.\n"), nIRQ, nNeoCDIRQVector); - if (nNeoCDIRQVectorAck) { - nNeoCDIRQVectorAck = 0; - return nNeoCDIRQVector; - } - return M68K_INT_ACK_AUTOVECTOR; -} - -static inline INT32 NeoConvertIRQPosition(INT32 nOffset) -{ - UINT64 nNewPosition = ((UINT64)nOffset * nBurnCPUSpeedAdjust) >> 7; - - return (nNewPosition < NO_IRQ_PENDING) ? nNewPosition : NO_IRQ_PENDING; -} - -static inline void NeoIRQUpdate(UINT16 wordValue) -{ - nIRQAcknowledge |= (wordValue & 7); - -// bprintf(PRINT_NORMAL, _T(" - IRQ Ack -> %02X (at line %3i).\n"), nIRQAcknowledge, SekCurrentScanline()); - - if ((nIRQAcknowledge & 7) == 7) { - SekSetIRQLine(7, SEK_IRQSTATUS_NONE); - } else { - if ((nIRQAcknowledge & 1) == 0) { - SekSetIRQLine(3, SEK_IRQSTATUS_ACK); - } - if ((nIRQAcknowledge & 2) == 0) { - SekSetIRQLine(nScanlineIRQ, SEK_IRQSTATUS_ACK); - } - if ((nIRQAcknowledge & 4) == 0) { - SekSetIRQLine(nVBLankIRQ, SEK_IRQSTATUS_ACK); - } - } -} - -static inline void NeoCDIRQUpdate(UINT8 byteValue) -{ - nIRQAcknowledge |= (byteValue & 0x38); - -// bprintf(PRINT_NORMAL, _T(" - IRQ Ack -> %02X (CD, at line %3i).\n"), nIRQAcknowledge, SekCurrentScanline()); - - if ((nIRQAcknowledge & 0x3F) == 0x3F) { - SekSetIRQLine(7, SEK_IRQSTATUS_NONE); - } else { - if ((nIRQAcknowledge & 0x07) != 7) { - NeoIRQUpdate(0); - return; - } - if ((nIRQAcknowledge & 0x08) == 0) { - nNeoCDIRQVector = 0x17; - nNeoCDIRQVectorAck = 1; - SekSetIRQLine(4, SEK_IRQSTATUS_ACK /*| SEK_IRQSTATUS_CALLBACK*/); - return; - } - if ((nIRQAcknowledge & 0x10) == 0) { - nNeoCDIRQVector = 0x16; - nNeoCDIRQVectorAck = 1; - SekSetIRQLine(4, SEK_IRQSTATUS_ACK /*| SEK_IRQSTATUS_CALLBACK*/); - return; - } - if ((nIRQAcknowledge & 0x20) == 0) { - nNeoCDIRQVector = 0x15; - nNeoCDIRQVectorAck = 1; - SekSetIRQLine(4, SEK_IRQSTATUS_ACK /*| SEK_IRQSTATUS_CALLBACK*/); - return; - } - } -} - -static inline void SendSoundCommand(const UINT8 nCommand) -{ -// bprintf(PRINT_NORMAL, _T(" - Sound command sent (0x%02X).\n"), nCommand); - - neogeoSynchroniseZ80(0); - - nSoundStatus &= ~1; - nSoundLatch = nCommand; - - ZetNmi(); - -#if 1 && defined USE_SPEEDHACKS - neogeoSynchroniseZ80(0x0200); -#endif -} - -static UINT8 ReadInput1(INT32 nOffset) -{ - switch (nOffset) { - case 0x00: -// bprintf(PRINT_NORMAL, _T(" -- bank %d inputP0[0x%02X] read (%i).\n"), 0, nInputSelect, SekTotalCycles()); - return ~NeoInputBank[nJoyport0[nInputSelect & 0x07]]; - - case 0x01: -// bprintf(PRINT_NORMAL, _T(" - 0x%06X read (byte).\n"), sekAddress); - if (nNeoSystemType & NEO_SYS_MVS) { - return ~NeoInputBank[4]; - } - return ~0; - - case 0x81: -// bprintf(PRINT_NORMAL, _T(" - 0x%06X read (byte).\n"), sekAddress); - if (nNeoSystemType & NEO_SYS_MVS) { - return ~NeoInputBank[5]; - } - return ~0; - } - - return ~0; -} - -static UINT8 ReadInput2(INT32 nOffset) -{ - if ((nOffset & 1) == 0) { -// bprintf(PRINT_NORMAL, _T(" -- bank %d inputP1[0x%02X] read.\n"), 0, nInputSelect); - return ~NeoInputBank[nJoyport1[(nInputSelect >> 3) & 0x07]]; - } - - return ~0; -} - -static UINT8 ReadInput3(INT32 nOffset) -{ - if ((nOffset & 1) == 0) { -// bprintf(PRINT_NORMAL, " -- input 2 read.\n"); - return ~NeoInputBank[2]; - } - - return ~0; -} - -UINT8 __fastcall neogeoReadByte(UINT32 sekAddress) -{ - switch (sekAddress & 0xFE0000) { - case 0x300000: - return ReadInput1(sekAddress & 0xFF); - - case 0x320000: { - if ((sekAddress & 1) == 0) { - INT32 nReply = nSoundReply; - -#if 1 && defined USE_SPEEDHACKS - // nSoundStatus: &1 = sound latch read, &2 = response written - if (nSoundStatus != 3) { - neogeoSynchroniseZ80(0x0100); - } -#else - neogeoSynchroniseZ80(0); -#endif - - if ((nSoundStatus & 1) == 0) { -// bprintf(PRINT_NORMAL, _T(" - Sound reply read while sound pending (0x%02X).\n"), nSoundReply); - - return nReply & 0x7F; - } - -// bprintf(PRINT_NORMAL, _T(" - Sound reply read (0x%02X).\n"), nSoundReply); - return nReply; - } - - if (nNeoSystemType & NEO_SYS_MVS) { - UINT8 nuPD4990AOutput = uPD4990ARead(SekTotalCycles() - nuPD4990ATicks); - nuPD4990ATicks = SekTotalCycles(); - return (~NeoInputBank[3] & 0x3F) | (nuPD4990AOutput << 6); - } - - return (~NeoInputBank[3] & 0x7F) & 0xE7; - } - - case 0x340000: - return ReadInput2(sekAddress & 0xFF); - - case 0x380000: - return ReadInput3(sekAddress & 0xFF); - - default: - bprintf(PRINT_NORMAL, _T(" - 0x%08X read (byte, PC: %08X)\n"), sekAddress, SekGetPC(-1)); - } - - return ~0; -} - -UINT16 __fastcall neogeoReadWord(UINT32 sekAddress) -{ - switch (sekAddress & 0xFE0000) { - case 0x300000: - return (ReadInput1(sekAddress & 0xFE) << 8) | ReadInput1((sekAddress & 0xFE) | 1); - - case 0x320000: - SEK_DEF_READ_WORD(0, sekAddress); - - case 0x340000: - return (ReadInput2(sekAddress & 0xFE) << 8) | ReadInput2((sekAddress & 0xFE) | 1); - - case 0x380000: - return (ReadInput3(sekAddress & 0xFE) << 8) | ReadInput3((sekAddress & 0xFE) | 1); - - default: - bprintf(PRINT_NORMAL, _T(" - 0x%08X read (word, PC: %08X)\n"), sekAddress, SekGetPC(-1)); - } - - return ~0; -} - -static void WriteIO1(INT32 nOffset, UINT8 byteValue) -{ - switch (nOffset) { - case 0x01: // Select the input returned at 0x300000 -// bprintf(PRINT_NORMAL, _T(" - InputP0/P1 0x%02X selected (%i).\n"), byteValue, SekTotalCycles()); - nInputSelect = byteValue; - break; - - case 0x21: // Select the active cartridge slot -// bprintf(PRINT_NORMAL, _T(" - Cartridge slot 0x%02X activated.\n"), byteValue); - nNeoActiveSlot = byteValue; - if (nNeoActiveSlot >= nNeoNumSlots) { - nNeoActiveSlot = 0; - } - - NeoMapActiveCartridge(); - break; - - case 0x31: // Send latched output to LEDs (bits 5/4 - numeric displays, bit 3 - marquee lights, one per slot) -// bprintf(PRINT_NORMAL, _T(" - 0x%06X -> 0x%02X.\n"), sekAddress, byteValue); -// if (byteValue != 255) { -// bprintf(PRINT_NORMAL, _T(" - LED %02X -> %02X\n"), ~byteValue & 255, nLEDLatch & 255); -// } - -/* if ((byteValue & 0x20) == 0) { - nLED[0] = nLEDLatch; - } - if ((byteValue & 0x10) == 0) { - nLED[1] = nLEDLatch; - } - if ((byteValue & 0x08) == 0) { - nLED[2] = nLEDLatch; - } - - BurnGameFeedback(sizeof(nLED), nLED);*/ - - break; - - case 0x41: // Latch LED output - // for numeric displays - digits displayed = ~bytevalue - // for start buttons - highlighted marquee = ~bytevalue -// bprintf(PRINT_NORMAL, _T(" - LED output -> 0x%02X.\n"), byteValue); - nLEDLatch = ~byteValue; - break; - - case 0x51: // Send command to RTC -// bprintf(PRINT_NORMAL, _T(" - RTC -> 0x%02X.\n"), byteValue); - if (nNeoSystemType & NEO_SYS_MVS) { - uPD4990AWrite(byteValue & 2, byteValue & 4, byteValue & 1); - } - break; - - case 0x61: // Coin lockout chute 1 & input bank select -// bprintf(PRINT_NORMAL, _T(" - %sInput bank 0 selected (0x%02X).\n"), byteValue ? _T("Chute 1 coin lockout -> High / ") : _T(""), byteValue); - NeoInputBank = NeoInput + 0; - break; - case 0x63: // Coin lockout chute 2 -// bprintf(PRINT_NORMAL, _T(" - Chute 2 coin lockout -> High (0x%02X).\n"), byteValue); - break; - - case 0x65: // Coin counter chute 1 -> High - break; -// bprintf(PRINT_NORMAL, _T(" - Chute 1 coin counter -> High (0x%02X).\n"), byteValue); - case 0x67: // Coin counter chute 2 -> High -// bprintf(PRINT_NORMAL, _T(" - Chute 2 coin counter -> High (0x%02X).\n"), byteValue); - break; - - case 0xD1: // Send command to RTC -// bprintf(PRINT_NORMAL, _T(" - RTC -> 0x%02X.\n"), byteValue); - if (nNeoSystemType & NEO_SYS_MVS) { - uPD4990AWrite(byteValue & 2, byteValue & 4, byteValue & 1); - } - break; - - case 0xE1: -// bprintf(PRINT_NORMAL, _T(" - Chute 2 coin lockout -> Low / Input bank 1 selected (0x%02X).\n"), byteValue); - NeoInputBank = NeoInput + 8; - break; - case 0xE3: -// bprintf(PRINT_NORMAL, _T(" - Chute 2 coin lockout -> Low (0x%02X).\n"), byteValue); - break; - - case 0xE5: // Coin counter chute 1 -> Low -// bprintf(PRINT_NORMAL, _T(" - Chute 1 coin counter -> Low (0x%02X).\n"), byteValue); - break; - case 0xE7: // Coin counter chute 2 -> Low -// bprintf(PRINT_NORMAL, _T(" - Chute 2 coin counter -> Low (0x%02X).\n"), byteValue); - break; - } - - return; -} - -static void WriteIO2(INT32 nOffset, UINT8 /*byteValue*/) -{ - switch (nOffset) { - case 0x01: // Enable display - if (nNeoSystemType & NEO_SYS_CART) { - bNeoEnableGraphics = true; -// bprintf(PRINT_NORMAL, _T(" - Display enabled (0x%02X, at scanline %i).\n"), byteValue, SekCurrentScanline()); - break; - } - - case 0x03: // Select BIOS vector table - if (nNeoSystemType & NEO_SYS_CART) { - if (!b68KBoardROMBankedIn) { - MapVectorTable(true); - b68KBoardROMBankedIn = true; - } -// bprintf(PRINT_NORMAL, _T(" - BIOS vector table banked in (0x%02X).\n"), byteValue); - } - break; - - case 0x0B: // Select BIOS text ROM -// bprintf(PRINT_NORMAL, _T(" - BIOS text/Z80 ROM banked in (0x%02X).\n"), byteValue); - - bBIOSTextROMEnabled = !(nNeoSystemType & (NEO_SYS_PCB | NEO_SYS_AES)); - - if (bZ80BIOS) { - if (!bZ80BoardROMBankedIn) { - bZ80BoardROMBankedIn = true; - NeoZ80MapROM(true); - } - -#if defined Z80_RESET_ON_BANKSWITCH - nSoundStatus |= 1; - ZetReset(); -#endif - } - - break; - - case 0x0D: // Write-protect SRAM - bSRAMWritable = false; -// bprintf(PRINT_NORMAL, _T(" - SRAM write-protected (0x%02X).\n"), byteValue); - break; - - case 0x0F: // Select palette bank 1 -// bprintf(PRINT_NORMAL, _T(" - Palette 1 banked in (0x%02X).\n"), byteValue); - MapPalette(1); - break; - - case 0x11: // Disable display - if (nNeoSystemType & NEO_SYS_CART) { - bNeoEnableGraphics = false; -// bprintf(PRINT_NORMAL, _T(" - Display disabled (0x%02X, at scanline %i).\n"), byteValue, SekCurrentScanline()); - break; - } - - case 0x13: // Select game vector table - if (nNeoSystemType & NEO_SYS_CART) { - if (b68KBoardROMBankedIn) { - MapVectorTable(false); - b68KBoardROMBankedIn = false; - } -// bprintf(PRINT_NORMAL, _T(" - ROM vector table banked in (0x%02X).\n"), byteValue); - } - break; - - case 0x1B: // Select game text ROM -// bprintf(PRINT_NORMAL, _T(" - Cartridge text/Z80 ROM banked in (0x%02X).\n"), byteValue); - - bBIOSTextROMEnabled = false; - - if (bZ80BIOS) { - if (bZ80BoardROMBankedIn) { - bZ80BoardROMBankedIn = false; - NeoZ80MapROM(false); - } - -#if defined Z80_RESET_ON_BANKSWITCH - nSoundStatus |= 1; - ZetReset(); -#endif - } - - break; - - case 0x1D: // Write-enable SRAM - bSRAMWritable = true; -// bprintf(PRINT_NORMAL, _T(" - SRAM writable (0x%02X).\n"), byteValue); - break; - - case 0x1F: // Select palette bank 0 -// bprintf(PRINT_NORMAL, _T(" - Palette 0 banked in (0x%02X).\n"), byteValue); - MapPalette(0); - break; - } - - return; -} - -void __fastcall neogeoWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress & 0xFF0000) { - case 0x300000: - if ((sekAddress & 1) == 1) { -// bprintf(PRINT_NORMAL, " - Watchdog timer reset (%02X, at scanline %i)\n", byteValue, SekCurrentScanline()); - -#if defined EMULATE_WATCHDOG - nNeoWatchdog = -SekTotalCycles(); -#endif - - } - return; - - case 0x320000: - if ((sekAddress & 1) == 0) { - SendSoundCommand(byteValue); - } - return; - - case 0x380000: - WriteIO1(sekAddress & 0xFF, byteValue); - return; - - case 0x3A0000: - WriteIO2(sekAddress & 0x1F, byteValue); - return; - } - -// bprintf(PRINT_NORMAL, _T(" - Attempt to write byte 0x%06X -> 0x%02X\n"), sekAddress, byteValue); - - return; -} - -void __fastcall neogeoWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ -// neogeoWriteByte(sekAddress | 1, wordValue); - - SEK_DEF_WRITE_WORD(0, sekAddress, wordValue); - -// bprintf(PRINT_NORMAL, _T(" - Attempt to write word 0x%06X -> 0x%04X\n"), sekAddress, wordValue); -} - -// ---------------------------------------------------------------------------- -// Video controller reads - -UINT16 __fastcall neogeoReadWordVideo(UINT32 sekAddress) -{ - switch (sekAddress & 6) { - case 0x00: - case 0x02: -// bprintf(PRINT_NORMAL, " - Graphics RAM read (Bank %i, address 0x%04X).\n", NeoGraphicsRAMPointer > 0xFFFF ? 1 : 0, NeoGraphicsRAMPointer & 0xFFFF); - return *((UINT16*)(NeoGraphicsRAMBank + NeoGraphicsRAMPointer)); - - case 0x04: -// bprintf(PRINT_NORMAL, " - Graphics RAM modulo read.\n"); - return (UINT16)(nNeoGraphicsModulo >> 1); - - case 0x06: // Display status -// bprintf(PRINT_NORMAL, " - Display status read, line: %3i, anim: %i\n", SekCurrentScanline(), nNeoSpriteFrame); - -#if 1 && !defined USE_SPEEDHACKS - bForcePartialRender |= bForceUpdateOnStatusRead; -#endif - - return ((SekCurrentScanline() + nScanlineOffset) << 7) | 0 | (nNeoSpriteFrame & 7); - } - - return 0; -} - -UINT8 __fastcall neogeoReadByteVideo(UINT32 sekAddress) -{ - if (sekAddress & 1) { - return 0x0FF; - } else { - return neogeoReadWordVideo(sekAddress) >> 8; - } -} - -void __fastcall neogeoWriteWordVideo(UINT32 sekAddress, UINT16 wordValue) -{ -// if (sekAddress >= 0x3C0010) -// bprintf(PRINT_NORMAL, _T(" - Attempt to write word 0x%06X -> 0x%04X\n"), sekAddress, wordValue); - - switch (sekAddress & 14) { - case 0x00: { - NeoGraphicsRAMPointer = wordValue << 1; - NeoGraphicsRAMBank = NeoGraphicsRAM; - if (wordValue & 0x8000) { - NeoGraphicsRAMBank += 0x00010000; - } - break; - } - case 0x02: { - *((UINT16*)(NeoGraphicsRAMBank + NeoGraphicsRAMPointer)) = wordValue; - NeoGraphicsRAMPointer += nNeoGraphicsModulo; - -#if 0 - if ((NeoGraphicsRAMBank == NeoGraphicsRAM) && NeoGraphicsRAMPointer >= 0xC000 && NeoGraphicsRAMPointer < 0xE000) { - bprintf(PRINT_NORMAL, _T("VRAM bank 0 + 0x%04X -> %04X\n"), NeoGraphicsRAMPointer, wordValue); - } - if ((NeoGraphicsRAMBank != NeoGraphicsRAM) && NeoGraphicsRAMPointer >= 0x0C00) { - bprintf(PRINT_NORMAL, _T("VRAM bank 1 + 0x%04X -> %04X\n"), NeoGraphicsRAMPointer, wordValue); - } -#endif - -#if 1 && defined USE_SPEEDHACKS - bForcePartialRender |= bForceUpdateOnStatusRead; -#endif - break; - } - case 0x04: { - nNeoGraphicsModulo = ((INT16)wordValue) << 1; - break; - } - - case 0x06: { - nSpriteFrameSpeed = (wordValue >> 8); - - if ((nIRQControl & 0x10) == 0 && wordValue & 0x10) { - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ enabled (at line %3i, IRQControl: 0x%02X).\n"), SekCurrentScanline(), wordValue & 0xFF); -#endif - - if (nIRQCycles < nCyclesSegment) { - SekRunAdjust(nIRQCycles - nCyclesSegment); - } - } - -#if 0 || defined LOG_IRQ - if (nIRQControl & 0x10 && (wordValue & 0x10) == 0) { - bprintf(PRINT_NORMAL, _T(" - IRQ disabled (at line %3i, IRQControl: 0x%02X).\n"), SekCurrentScanline(), wordValue & 0xFF); - } -#endif - - nIRQControl = wordValue; -// bprintf(PRINT_NORMAL, _T(" - Autoanim speed -> 0x%02X\n"), wordValue >> 8); -// bprintf(PRINT_NORMAL, _T(" - IRQ control register -> 0x%02X (at line %3i)\n"), wordValue & 0xFF, SekCurrentScanline()); - break; - } - - case 0x08: { -// bprintf(PRINT_NORMAL, "0x%06X -> 0x%04X\n", sekAddress, wordValue); - // Bit 15 seems to be ignored - nIRQOffset = (nIRQOffset & 0x0000FFFF) | ((wordValue & 0x7FFF) << 16); - break; - } - case 0x0A: { -// bprintf(PRINT_NORMAL, "0x%06X -> 0x%04X\n", sekAddress, wordValue); - nIRQOffset = (nIRQOffset & 0xFFFF0000) | wordValue; - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ offs -> 0x%08X (at line %3i, IRQControl: 0x%02X).\n"), nIRQOffset, SekCurrentScanline(), nIRQControl); -#endif - - if (nIRQControl & 0x20) { - -#if 0 -// nIRQCycles = SekTotalCycles() - 64 + NeoConvertIRQPosition(nIRQOffset); - nIRQCycles = SekTotalCycles() + NeoConvertIRQPosition(nIRQOffset); -#else - // Turfmast uses this to set the timing of the raster interrupts. Using the code below, - // all raster effects in turfmast are correctly aligned and exhibit no flicker. - // (this sets the offset of the IRQ to the start of the current scanline instead of the actual beam position) - - // ssideki2 has some problems with this - nIRQCycles = SekCurrentScanline() * nSekCyclesScanline + NeoConvertIRQPosition(nIRQOffset + 8); -// bprintf(PRINT_NORMAL, _T(" %i - %i\n"), SekCurrentScanline(), SekTotalCycles() % SekCyclesScanline()); -#endif - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" IRQ Line -> %3i (at line %3i, relative).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); -#endif - - if (nIRQCycles < 0) { - nIRQCycles = NO_IRQ_PENDING; - } - if (nIRQCycles < nCyclesSegment) { - SekRunAdjust(nIRQCycles - nCyclesSegment); - } - } - - break; - } - - case 0x0C: { - NeoIRQUpdate(wordValue); - break; - } - } -} - -void __fastcall neogeoWriteByteVideo(UINT32 sekAddress, UINT8 byteValue) -{ -// bprintf(PRINT_NORMAL, _T(" - Attempt to write byte 0x%06X -> 0x%02X\n"), sekAddress, byteValue); - -#if 1 - if ((sekAddress & 1) == 0) { - neogeoWriteWordVideo(sekAddress, byteValue); - } -#else - if (sekAddress & 1) { - neogeoWriteWordVideo(sekAddress, byteValue); - } else { - neogeoWriteWordVideo(sekAddress, (byteValue << 8)); - } -#endif - -#if 1 && defined USE_SPEEDHACKS - bForcePartialRender |= bForceUpdateOnStatusRead; -#endif -} - -// ---------------------------------------------------------------------------- -// Backup RAM on MVS hardware - -void __fastcall neogeoWriteByteSRAM(UINT32 sekAddress, UINT8 byteValue) -{ - sekAddress &= 0xFFFF; - - if (bSRAMWritable) { - NeoNVRAM[sekAddress ^ 1] = byteValue; - } -} - -void __fastcall neogeoWriteWordSRAM(UINT32 sekAddress, UINT16 wordValue) -{ - sekAddress &= 0xFFFF; - - if (bSRAMWritable) { - *((UINT16*)(NeoNVRAM + sekAddress)) = BURN_ENDIAN_SWAP_INT16(wordValue); - } -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall neogeoReadByteMemoryCard(UINT32 sekAddress) -{ -// if (sekAddress < 0x800100) -// bprintf(PRINT_NORMAL, _T(" - Memcard 0x%04X read (PC: 0x%06X).\n"), sekAddress & 0x7FFF, SekGetPC(-1)); - - if (bMemoryCardInserted) { - if ((NeoSystem & 0x40) || (sekAddress & 1)) { - return NeoMemoryCard[sekAddress & 0x01FFFF]; - } - } - - return 0xFF; -} - -void __fastcall neogeoWriteByteMemoryCard(UINT32 sekAddress, UINT8 byteValue) -{ -// if (sekAddress < 0x800100) -// bprintf(PRINT_NORMAL, _T(" - Memcard 0x%04X -> 0x%02X (PC: 0x%06X).\n"), sekAddress & 0x7FFF, byteValue, SekGetPC(-1)); - - if (bMemoryCardInserted && bMemoryCardWritable) { - if ((NeoSystem & 0x40) || (sekAddress & 1)) { - NeoMemoryCard[sekAddress & 0x01FFFF] = byteValue; - } - } -} - -UINT8 __fastcall neoCDReadByteMemoryCard(UINT32 sekAddress) -{ - sekAddress &= 0x01FFFF; - if (sekAddress < 0x4000 && sekAddress & 1) { - return NeoMemoryCard[sekAddress]; - } - - return 0xFF; -} - -void __fastcall neoCDWriteByteMemoryCard(UINT32 sekAddress, UINT8 byteValue) -{ - sekAddress &= 0x01FFFF; - if (sekAddress < 0x4000 && sekAddress & 1) { - NeoMemoryCard[sekAddress] = byteValue; - } -} - -// ---------------------------------------------------------------------------- -// NeoCD CD-ROM controller handlers - -#define CD_FRAMES_MINUTE (60 * 75) -#define CD_FRAMES_SECOND ( 75) -#define CD_FRAMES_PREGAP ( 2 * 75) - -static INT32 nLC8951Register = 0; -static INT32 LC8951RegistersR[16]; -static INT32 LC8951RegistersW[16]; - -static INT32 nActiveTransferArea; -static INT32 nSpriteTransferBank; -static INT32 nADPCMTransferBank; - -static UINT8 nTransferWriteEnable; - -static bool NeoCDOBJBankUpdate[4]; - -static bool bNeoCDCommsClock, bNeoCDCommsSend; - -static UINT8 NeoCDCommsCommandFIFO[10] = { 0, }; -static UINT8 NeoCDCommsStatusFIFO[10] = { 0, }; - -static INT32 NeoCDCommsWordCount = 0; - -static INT32 NeoCDAssyStatus = 0; - -static INT32 NeoCDTrack = 0; - -static INT32 NeoCDSectorMin = 0; -static INT32 NeoCDSectorSec = 0; -static INT32 NeoCDSectorFrm = 0; -static INT32 NeoCDSectorLBA = 0; - -static char NeoCDSectorData[2352]; - -static bool bNeoCDLoadSector = false; - -static INT32 NeoCDDMAAddress1 = 0; -static INT32 NeoCDDMAAddress2 = 0; -static INT32 NeoCDDMAValue1 = 0; -static INT32 NeoCDDMAValue2 = 0; -static INT32 NeoCDDMACount = 0; - -static INT32 NeoCDDMAMode = 0; - -// hax0r -static INT32 nNeoCDMode = 0; -static INT32 nff0002 = 0; - -static void NeoCDLBAToMSF(const INT32 LBA) -{ - NeoCDSectorMin = (LBA + CD_FRAMES_PREGAP) / CD_FRAMES_MINUTE; - NeoCDSectorSec = (LBA + CD_FRAMES_PREGAP) % CD_FRAMES_MINUTE / CD_FRAMES_SECOND; - NeoCDSectorFrm = (LBA + CD_FRAMES_PREGAP) % CD_FRAMES_SECOND; -} - -static void NeoCDCommsWrite(UINT8 data) -{ - if (NeoCDCommsWordCount >= 0 && NeoCDCommsWordCount < 10) { - NeoCDCommsCommandFIFO[NeoCDCommsWordCount] = data & 0x0F; - } -} - -static UINT8 NeoCDCommsread() -{ - UINT8 ret = 0; - - if (NeoCDCommsWordCount >= 0 && NeoCDCommsWordCount < 10) { - ret = NeoCDCommsStatusFIFO[NeoCDCommsWordCount] & 0x0F; - } - - if (bNeoCDCommsClock) { - ret |= 0x10; - } - - return ret; -} - -static void NeoCDCommsReset() -{ - bNeoCDCommsSend = false; - bNeoCDCommsClock = true; - - memset(NeoCDCommsCommandFIFO, 0, sizeof(NeoCDCommsCommandFIFO)); - memset(NeoCDCommsStatusFIFO, 0, sizeof(NeoCDCommsStatusFIFO)); - - NeoCDCommsWordCount = 0; - - NeoCDAssyStatus = 9; - - memset(NeoCDSectorData, 0, sizeof(NeoCDSectorData)); - - bNeoCDLoadSector = false; - - nNeoCDMode = 0; -} - -static void LC8951UpdateHeader() -{ - NeoCDLBAToMSF(NeoCDSectorLBA); - - if (LC8951RegistersW[11] & 1) { - - // HEAD registers have sub-header - - LC8951RegistersR[4] = 0; // HEAD0 - LC8951RegistersR[5] = 0; // HEAD1 - LC8951RegistersR[6] = 0; // HEAD2 - LC8951RegistersR[7] = 0; // HEAD3 - - } else { - - // HEAD registers have header - - LC8951RegistersR[4] = ((NeoCDSectorMin / 10) << 4) | (NeoCDSectorMin % 10); // HEAD0 - LC8951RegistersR[5] = ((NeoCDSectorSec / 10) << 4) | (NeoCDSectorSec % 10); // HEAD1 - LC8951RegistersR[6] = ((NeoCDSectorFrm / 10) << 4) | (NeoCDSectorFrm % 10); // HEAD2 - LC8951RegistersR[7] = 1; // HEAD3 - } -} - -static char* LC8915InitTransfer() -{ - if (!LC8951RegistersW[6]) { - bprintf(PRINT_ERROR, _T(" LC8951 DTTRG status invalid\n")); - return NULL; - } - if (!(LC8951RegistersW[1] & 0x02)) { - bprintf(PRINT_ERROR, _T(" LC8951 DOUTEN status invalid\n")); - return NULL; - } - if (((LC8951RegistersW[5] << 8) | LC8951RegistersW[4]) + (NeoCDDMACount << 1) > 2352) { - bprintf(PRINT_ERROR, _T(" DMA transfer exceeds current sector in LC8951 external buffer\n")); - return NULL; - } - - return NeoCDSectorData + ((LC8951RegistersW[5] << 8) | LC8951RegistersW[4]); -} - -static void LC8915EndTransfer() -{ - LC8951RegistersW[6] = 0x00; // reset DTTRG - - LC8951RegistersR[1] |= 0x48; // set DTEI & DTBSY - if (LC8951RegistersW[1] & 0x40) { - - // trigger DTE interrupt - - // the Neo Geo CD doesn't use the DTE interrupt - // nIRQAcknowledge &= ~0x20; - // NeoCDIRQUpdate(0); - - } -} - -static void LC8951Reset() -{ - memset(LC8951RegistersR, 0, sizeof(LC8951RegistersR)); - memset(LC8951RegistersW, 0, sizeof(LC8951RegistersW)); - LC8951RegistersR[0x01] = 0xFF; - LC8951RegistersR[0x0F] = 0x80; - - LC8951UpdateHeader(); -} - -static void NeoCDProcessCommand() -{ - memset(NeoCDCommsStatusFIFO, 0, sizeof(NeoCDCommsStatusFIFO)); - - if (NeoCDCommsCommandFIFO[0]) { - NeoCDCommsStatusFIFO[1] = 15; - } - - switch (NeoCDCommsCommandFIFO[0]) { - case 0: - break; - case 1: -// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); - CDEmuStop(); - - NeoCDAssyStatus = 0x0E; - bNeoCDLoadSector = false; - break; - case 2: -// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); - NeoCDCommsStatusFIFO[1] = NeoCDCommsCommandFIFO[3]; - switch (NeoCDCommsCommandFIFO[3]) { - - case 0: { - UINT8* ChannelData = CDEmuReadQChannel(); - - NeoCDCommsStatusFIFO[2] = ChannelData[1] / 10; - NeoCDCommsStatusFIFO[3] = ChannelData[1] % 10; - - NeoCDCommsStatusFIFO[4] = ChannelData[2] / 10; - NeoCDCommsStatusFIFO[5] = ChannelData[2] % 10; - - NeoCDCommsStatusFIFO[6] = ChannelData[3] / 10; - NeoCDCommsStatusFIFO[7] = ChannelData[3] % 10; - - NeoCDCommsStatusFIFO[8] = ChannelData[7]; - -// bprintf(PRINT_ERROR, _T(" %02i %02i:%02i:%02i %02i:%02i:%02i %02i\n"), ChannelData[0], ChannelData[1], ChannelData[2], ChannelData[3], ChannelData[4], ChannelData[5], ChannelData[6], ChannelData[7]); - - break; - } - case 1: { - UINT8* ChannelData = CDEmuReadQChannel(); - - NeoCDCommsStatusFIFO[2] = ChannelData[4] / 10; - NeoCDCommsStatusFIFO[3] = ChannelData[4] % 10; - - NeoCDCommsStatusFIFO[4] = ChannelData[5] / 10; - NeoCDCommsStatusFIFO[5] = ChannelData[5] % 10; - - NeoCDCommsStatusFIFO[6] = ChannelData[6] / 10; - NeoCDCommsStatusFIFO[7] = ChannelData[6] % 10; - - NeoCDCommsStatusFIFO[8] = ChannelData[7]; - - break; - } - case 2: { - - UINT8* ChannelData = CDEmuReadQChannel(); - - NeoCDCommsStatusFIFO[2] = ChannelData[0] / 10; - NeoCDCommsStatusFIFO[3] = ChannelData[0] % 10; - - - NeoCDCommsStatusFIFO[8] = ChannelData[7]; - - break; - } - case 3: { - UINT8* TOCEntry = CDEmuReadTOC(-2); - - NeoCDCommsStatusFIFO[2] = TOCEntry[0] / 10; - NeoCDCommsStatusFIFO[3] = TOCEntry[0] % 10; - - NeoCDCommsStatusFIFO[4] = TOCEntry[1] / 10; - NeoCDCommsStatusFIFO[5] = TOCEntry[1] % 10; - - NeoCDCommsStatusFIFO[6] = TOCEntry[2] / 10; - NeoCDCommsStatusFIFO[7] = TOCEntry[2] % 10; - - break; - } - case 4: { - UINT8* TOCEntry = CDEmuReadTOC(-1); - - NeoCDCommsStatusFIFO[2] = TOCEntry[0] / 10; - NeoCDCommsStatusFIFO[3] = TOCEntry[0] % 10; - - NeoCDCommsStatusFIFO[4] = TOCEntry[1] / 10; - NeoCDCommsStatusFIFO[5] = TOCEntry[1] % 10; - - break; - } - case 5: { - NeoCDTrack = NeoCDCommsCommandFIFO[4] * 10 + NeoCDCommsCommandFIFO[5]; - - UINT8* TOCEntry = CDEmuReadTOC(NeoCDTrack); - - NeoCDCommsStatusFIFO[2] = TOCEntry[0] / 10; - NeoCDCommsStatusFIFO[3] = TOCEntry[0] % 10; - - NeoCDCommsStatusFIFO[4] = TOCEntry[1] / 10; - NeoCDCommsStatusFIFO[5] = TOCEntry[1] % 10; - - NeoCDCommsStatusFIFO[6] = TOCEntry[2] / 10; - NeoCDCommsStatusFIFO[7] = TOCEntry[2] % 10; - - // bit 3 of the 1st minutes digit indicates a data track - if (TOCEntry[3] & 4) { - NeoCDCommsStatusFIFO[6] |= 8; - } - - NeoCDCommsStatusFIFO[8] = NeoCDTrack % 10; - - break; - } - - case 6: { - - UINT8* ChannelData = CDEmuReadQChannel(); - - NeoCDCommsStatusFIFO[8] = ChannelData[7]; - - break; - } - - case 7: { - - // must be 02, 0E, 0F, or 05 - NeoCDCommsStatusFIFO[2] = 0; - NeoCDCommsStatusFIFO[3] = 5; - - NeoCDCommsStatusFIFO[4] = 0; - NeoCDCommsStatusFIFO[5] = 0; - - NeoCDCommsStatusFIFO[6] = 0; - NeoCDCommsStatusFIFO[7] = 0; - break; - } - } - break; - - case 3: { - - if (LC8951RegistersW[10] & 4) { - - if (CDEmuGetStatus() == playing) { - bprintf(PRINT_ERROR, _T("*** Switching CD mode to CD-ROM while in audio mode!(PC: 0x%06X)\n"), SekGetPC(-1)); - } - - NeoCDSectorLBA = NeoCDCommsCommandFIFO[2] * (10 * CD_FRAMES_MINUTE); - NeoCDSectorLBA += NeoCDCommsCommandFIFO[3] * ( 1 * CD_FRAMES_MINUTE); - NeoCDSectorLBA += NeoCDCommsCommandFIFO[4] * (10 * CD_FRAMES_SECOND); - NeoCDSectorLBA += NeoCDCommsCommandFIFO[5] * ( 1 * CD_FRAMES_SECOND); - NeoCDSectorLBA += NeoCDCommsCommandFIFO[6] * (10 ); - NeoCDSectorLBA += NeoCDCommsCommandFIFO[7] * ( 1 ); - - NeoCDSectorLBA -= CD_FRAMES_PREGAP; - - CDEmuStartRead(); -// LC8951RegistersR[1] |= 0x20; - } else { - - if (CDEmuGetStatus() == reading) { - bprintf(PRINT_ERROR, _T("*** Switching CD mode to audio while in CD-ROM mode!(PC: 0x%06X)\n"), SekGetPC(-1)); - } - - CDEmuPlay((NeoCDCommsCommandFIFO[2] * 10) + NeoCDCommsCommandFIFO[3], (NeoCDCommsCommandFIFO[4] * 10) + NeoCDCommsCommandFIFO[5], (NeoCDCommsCommandFIFO[6] * 10) + NeoCDCommsCommandFIFO[7]); - } - - NeoCDAssyStatus = 1; - bNeoCDLoadSector = true; - - break; - } - case 4: -// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); - CDEmuPause(); - break; - case 5: -// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); -// NeoCDAssyStatus = 9; -// bNeoCDLoadSector = false; - break; - - case 6: -// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); - NeoCDAssyStatus = 4; - bNeoCDLoadSector = false; - break; - case 7: -// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); - NeoCDAssyStatus = 1; - bNeoCDLoadSector = true; - break; - - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: -// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); - NeoCDAssyStatus = 9; - bNeoCDLoadSector = false; - break; - } -} - -static void NeoCDDoDMA() -{ - - // The LC8953 chip has a programmable DMA controller, which is not properly emulated. - // Since the software only uses it in a limited way, we can apply a simple heuristic - // to determnine the requested operation. - - // Additionally, we don't know how many cycles DMA operations take. - // Here, only bus access is used to get a rough approximation -- - // each read/write takes a single cycle, setup and everything else is ignored. - -// bprintf(PRINT_IMPORTANT, _T(" - DMA controller transfer started (PC: 0x%06X)\n"), SekGetPC(-1)); - - switch (NeoCDDMAMode) { - - case 0xCFFD: { -// bprintf(PRINT_NORMAL, _T(" adr : 0x%08X - 0x%08X <- address, skip odd bytes\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 8); - - // - DMA controller 0x7E -> 0xCFFD (PC: 0xC07CE2) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) - // - DMA controller program[02] -> 0xE8DA (PC: 0xC07CEE) - // - DMA controller program[04] -> 0x92DA (PC: 0xC07CF4) - // - DMA controller program[06] -> 0x92DB (PC: 0xC07CFA) - // - DMA controller program[08] -> 0x96DB (PC: 0xC07D00) - // - DMA controller program[10] -> 0x96F6 (PC: 0xC07D06) - // - DMA controller program[12] -> 0x2E02 (PC: 0xC07D0C) - // - DMA controller program[14] -> 0xFDFF (PC: 0xC07D12) - - SekIdle(NeoCDDMACount * 4); - - while (NeoCDDMACount--) { - SekWriteWord(NeoCDDMAAddress1 + 0, NeoCDDMAAddress1 >> 24); - SekWriteWord(NeoCDDMAAddress1 + 2, NeoCDDMAAddress1 >> 16); - SekWriteWord(NeoCDDMAAddress1 + 4, NeoCDDMAAddress1 >> 8); - SekWriteWord(NeoCDDMAAddress1 + 6, NeoCDDMAAddress1 >> 0); - NeoCDDMAAddress1 += 8; - } - - break; - } - - case 0xE2DD: { -// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- 0x%08X - 0x%08X, skip odd bytes\n"), NeoCDDMAAddress2, NeoCDDMAAddress2 + NeoCDDMACount * 2, NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); - - // - DMA controller 0x7E -> 0xE2DD (PC: 0xC0A190) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) - // - DMA controller program[02] -> 0x82BE (PC: 0xC0A194) - // - DMA controller program[04] -> 0x93DA (PC: 0xC0A196) - // - DMA controller program[06] -> 0xBE93 (PC: 0xC0A198) - // - DMA controller program[08] -> 0xDABE (PC: 0xC0A19A) - // - DMA controller program[10] -> 0xF62D (PC: 0xC0A19C) - // - DMA controller program[12] -> 0x02FD (PC: 0xC0A19E) - // - DMA controller program[14] -> 0xFFFF (PC: 0xC0A1A0) - - SekIdle(NeoCDDMACount * 1); - - while (NeoCDDMACount--) { - SekWriteWord(NeoCDDMAAddress2 + 0, SekReadByte(NeoCDDMAAddress1 + 0)); - SekWriteWord(NeoCDDMAAddress2 + 2, SekReadByte(NeoCDDMAAddress1 + 1)); - NeoCDDMAAddress1 += 2; - NeoCDDMAAddress2 += 4; - } - - break; - } - - case 0xFC2D: { -// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- LC8951 external buffer, skip odd bytes\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); - - // - DMA controller 0x7E -> 0xFC2D (PC: 0xC0A190) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) - // - DMA controller program[02] -> 0x8492 (PC: 0xC0A194) - // - DMA controller program[04] -> 0xDA92 (PC: 0xC0A196) - // - DMA controller program[06] -> 0xDAF6 (PC: 0xC0A198) - // - DMA controller program[08] -> 0x2A02 (PC: 0xC0A19A) - // - DMA controller program[10] -> 0xFDFF (PC: 0xC0A19C) - // - DMA controller program[12] -> 0x48E7 (PC: 0xC0A19E) - // - DMA controller program[14] -> 0xFFFE (PC: 0xC0A1A0) - - char* data = LC8915InitTransfer(); - if (data == NULL) { - break; - } - - SekIdle(NeoCDDMACount * 4); - - while (NeoCDDMACount--) { - SekWriteByte(NeoCDDMAAddress1 + 0, data[0]); - SekWriteByte(NeoCDDMAAddress1 + 2, data[1]); - NeoCDDMAAddress1 += 4; - data += 2; - } - - LC8915EndTransfer(); - - break; - } - - case 0xFE3D: - - // - DMA controller 0x7E -> 0xFE3D (PC: 0xC0A190) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) - // - DMA controller program[02] -> 0x82BF (PC: 0xC0A194) - // - DMA controller program[04] -> 0x93BF (PC: 0xC0A196) - // - DMA controller program[06] -> 0xF629 (PC: 0xC0A198) - // - DMA controller program[08] -> 0x02FD (PC: 0xC0A19A) - // - DMA controller program[10] -> 0xFFFF (PC: 0xC0A19C) - // - DMA controller program[12] -> 0xF17D (PC: 0xC0A19E) - // - DMA controller program[14] -> 0xFCF5 (PC: 0xC0A1A0) - - case 0xFE6D: { -// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- 0x%08X - 0x%08X\n"), NeoCDDMAAddress2, NeoCDDMAAddress2 + NeoCDDMACount * 2, NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2); - - // - DMA controller 0x7E -> 0xFE6D (PC: 0xC0FD7A) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0FD7C) - // - DMA controller program[02] -> 0x82BF (PC: 0xC0FD7E) - // - DMA controller program[04] -> 0xF693 (PC: 0xC0FD80) - // - DMA controller program[06] -> 0xBF29 (PC: 0xC0FD82) - // - DMA controller program[08] -> 0x02FD (PC: 0xC0FD84) - // - DMA controller program[10] -> 0xFFFF (PC: 0xC0FD86) - // - DMA controller program[12] -> 0xC515 (PC: 0xC0FD88) - // - DMA controller program[14] -> 0xFCF5 (PC: 0xC0FD8A) - - SekIdle(NeoCDDMACount * 1); - - while (NeoCDDMACount--) { - SekWriteWord(NeoCDDMAAddress2, SekReadWord(NeoCDDMAAddress1)); - NeoCDDMAAddress1 += 2; - NeoCDDMAAddress2 += 2; - } - -if (NeoCDDMAAddress2 == 0x0800) { -// MapVectorTable(false); -// bprintf(PRINT_ERROR, _T(" RAM vectors mapped (PC = 0x%08X\n"), SekGetPC(0)); -// extern INT32 bRunPause; -// bRunPause = 1; -} - break; - } - - case 0xFEF5: { -// bprintf(PRINT_NORMAL, _T(" adr : 0x%08X - 0x%08X <- address\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); - - // - DMA controller 0x7E -> 0xFEF5 (PC: 0xC07CE2) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) - // - DMA controller program[02] -> 0x92E8 (PC: 0xC07CEE) - // - DMA controller program[04] -> 0xBE96 (PC: 0xC07CF4) - // - DMA controller program[06] -> 0xF629 (PC: 0xC07CFA) - // - DMA controller program[08] -> 0x02FD (PC: 0xC07D00) - // - DMA controller program[10] -> 0xFFFF (PC: 0xC07D06) - // - DMA controller program[12] -> 0xFC3D (PC: 0xC07D0C) - // - DMA controller program[14] -> 0xFCF5 (PC: 0xC07D12) - - SekIdle(NeoCDDMACount * 2); - - while (NeoCDDMACount--) { - SekWriteWord(NeoCDDMAAddress1 + 0, NeoCDDMAAddress1 >> 16); - SekWriteWord(NeoCDDMAAddress1 + 2, NeoCDDMAAddress1 >> 0); - NeoCDDMAAddress1 += 4; - } - - break; - } - - case 0xFFC5: { -// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- LC8951 external buffer\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2); - - // - DMA controller 0x7E -> 0xFFC5 (PC: 0xC0A190) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) - // - DMA controller program[02] -> 0xA6F6 (PC: 0xC0A194) - // - DMA controller program[04] -> 0x2602 (PC: 0xC0A196) - // - DMA controller program[06] -> 0xFDFF (PC: 0xC0A198) - // - DMA controller program[08] -> 0xFC2D (PC: 0xC0A19A) - // - DMA controller program[10] -> 0xFCF5 (PC: 0xC0A19C) - // - DMA controller program[12] -> 0x8492 (PC: 0xC0A19E) - // - DMA controller program[14] -> 0xDA92 (PC: 0xC0A1A0) - - char* data = LC8915InitTransfer(); - if (data == NULL) { - break; - } - - SekIdle(NeoCDDMACount * 4); - - while (NeoCDDMACount--) { - SekWriteByte(NeoCDDMAAddress1 + 0, data[0]); - SekWriteByte(NeoCDDMAAddress1 + 1, data[1]); - NeoCDDMAAddress1 += 2; - data += 2; - } - - LC8915EndTransfer(); - - break; - } - - case 0xFFCD: - - // - DMA controller 0x7E -> 0xFFCD (PC: 0xC0A190) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) - // - DMA controller program[02] -> 0x92F6 (PC: 0xC0A194) - // - DMA controller program[04] -> 0x2602 (PC: 0xC0A196) - // - DMA controller program[06] -> 0xFDFF (PC: 0xC0A198) - // - DMA controller program[08] -> 0x7006 (PC: 0xC0A19A) - // - DMA controller program[10] -> 0x6100 (PC: 0xC0A19C) - // - DMA controller program[12] -> 0x2412 (PC: 0xC0A19E) - // - DMA controller program[14] -> 0x13FC (PC: 0xC0A1A0) - - case 0xFFDD: { -// bprintf(PRINT_NORMAL, _T(" Fill: 0x%08X - 0x%08X <- 0x%04X\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2, NeoCDDMAValue1); - - // - DMA controller 0x7E -> 0xFFDD (PC: 0xC07CE2) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) - // - DMA controller program[02] -> 0x92F6 (PC: 0xC07CEE) - // - DMA controller program[04] -> 0x2602 (PC: 0xC07CF4) - // - DMA controller program[06] -> 0xFDFF (PC: 0xC07CFA) - // - DMA controller program[08] -> 0xFFFF (PC: 0xC07D00) - // - DMA controller program[10] -> 0xFCF5 (PC: 0xC07D06) - // - DMA controller program[12] -> 0x8AF0 (PC: 0xC07D0C) - // - DMA controller program[14] -> 0x1609 (PC: 0xC07D12) - - SekIdle(NeoCDDMACount * 1); - - while (NeoCDDMACount--) { - SekWriteWord(NeoCDDMAAddress1, NeoCDDMAValue1); - NeoCDDMAAddress1 += 2; - } - - break; - } - default: { - bprintf(PRINT_ERROR, _T(" Unknown transfer type 0x%04X (PC: 0x%06X)\n"), NeoCDDMAMode, SekGetPC(-1)); - bprintf(PRINT_NORMAL, _T(" ??? : 0x%08X 0x%08X 0x%04X 0x%04X 0x%08X\n"), NeoCDDMAAddress1, NeoCDDMAAddress2, NeoCDDMAValue1, NeoCDDMAValue2, NeoCDDMACount); - -extern INT32 bRunPause; -bRunPause = 1; - - } - } -} - -static void NeoCDCommsControl(UINT8 clock, UINT8 send) -{ - if (clock && !bNeoCDCommsClock) { - NeoCDCommsWordCount++; - if (NeoCDCommsWordCount >= 10) { - NeoCDCommsWordCount = 0; - - if (send) { - - // command receive complete - - if (NeoCDCommsCommandFIFO[0]) { - INT32 sum = 0; - -// bprintf(PRINT_NORMAL, _T(" - CD mechanism command receive completed : 0x")); - for (INT32 i = 0; i < 9; i++) { -// bprintf(PRINT_NORMAL, _T("%X"), NeoCDCommsCommandFIFO[i]); - sum += NeoCDCommsCommandFIFO[i]; - } - sum = ~(sum + 5) & 0x0F; -// bprintf(PRINT_NORMAL, _T(" (CS 0x%X, %s)\n"), NeoCDCommsCommandFIFO[9], (sum == NeoCDCommsCommandFIFO[9]) ? _T("OK") : _T("NG")); - if (sum == NeoCDCommsCommandFIFO[9]) { - - NeoCDProcessCommand(); - - if (NeoCDCommsCommandFIFO[0]) { - - if (NeoCDAssyStatus == 1) { - if (CDEmuGetStatus() == idle) { - NeoCDAssyStatus = 0x0E; - bNeoCDLoadSector = false; - } - } - - NeoCDCommsStatusFIFO[0] = NeoCDAssyStatus; - -#if 0 - extern INT32 counter; - if (counter) { - NeoCDCommsStatusFIFO[0] = counter & 0x0F; - } -#endif - - // compute checksum - - sum = 0; - - for (INT32 i = 0; i < 9; i++) { - sum += NeoCDCommsStatusFIFO[i]; - } - NeoCDCommsStatusFIFO[9] = ~(sum + 5) & 0x0F; - } - } - } - } else { - - // status send complete - -// if (NeoCDCommsStatusFIFO[0] || NeoCDCommsStatusFIFO[1]) { -// INT32 sum = 0; -// -// bprintf(PRINT_NORMAL, _T(" - CD mechanism status send completed : 0x")); -// for (INT32 i = 0; i < 9; i++) { -// bprintf(PRINT_NORMAL, _T("%X"), NeoCDCommsStatusFIFO[i]); -// sum += NeoCDCommsStatusFIFO[i]; -// } -// sum = ~(sum + 5) & 0x0F; -// bprintf(PRINT_NORMAL, _T(" (CS 0x%X, %s)\n"), NeoCDCommsStatusFIFO[9], (sum == NeoCDCommsStatusFIFO[9]) ? _T("OK") : _T("NG")); -// } - -// if (NeoCDAssyStatus == 0xE) { -// NeoCDAssyStatus = 9; -// } - } - - } - bNeoCDCommsSend = send; - } - bNeoCDCommsClock = clock; -} - -void NeoCDReadSector() -{ - if ((nff0002 & 0x0500)) { - if (NeoCDAssyStatus == 1 && bNeoCDLoadSector) { - -// if (LC8951RegistersW[10] & 0x80) { - NeoCDSectorLBA++; - NeoCDSectorLBA = CDEmuLoadSector(NeoCDSectorLBA, NeoCDSectorData + 4) - 1; -// } - - if (LC8951RegistersW[10] & 0x80) { - LC8951UpdateHeader(); - - LC8951RegistersR[12] = 0x80; // STAT0 - LC8951RegistersR[13] = 0; // STAT1 - LC8951RegistersR[14] = 0x10; // STAT2 - LC8951RegistersR[15] = 0; // STAT3 - -// bprintf(PRINT_IMPORTANT, _T(" Sector %08i (%02i:%02i:%02i) read\n"), NeoCDSectorLBA, NeoCDSectorMin, NeoCDSectorSec, NeoCDSectorFrm); - -#if 1 - if (NeoCDSectorData[4 + 64] == 'g' && !strncmp(NeoCDSectorData + 4, "Copyright by SNK", 16)) { -// printf(PRINT_ERROR, _T(" simulated CDZ protection error\n")); -// bprintf(PRINT_ERROR, _T(" %.70hs\n"), NeoCDSectorData + 4); - - NeoCDSectorData[4 + 64] = 'f'; - - // LC8951RegistersR[12] = 0x00; // STAT0 - } -#endif - - nIRQAcknowledge &= ~0x20; - NeoCDIRQUpdate(0); - - LC8951RegistersR[1] &= ~0x20; - -// bprintf(PRINT_IMPORTANT, _T(" DECI interrupt triggered\n")); - } - } - - bNeoCDLoadSector = true; -// bNeoCDLoadSector = false; - } -} - -UINT8 __fastcall neogeoReadByteCDROM(UINT32 sekAddress) -{ -// bprintf(PRINT_NORMAL, _T(" - CDROM: 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); - - switch (sekAddress & 0xFFFF) { - - case 0x0017: - return nNeoCDMode; - - // LC8951 registers - case 0x0101: -// bprintf(PRINT_NORMAL, _T(" - LC8951 register read (PC: 0x%06X)\n"), SekGetPC(-1)); - return nLC8951Register; - case 0x0103: { -// bprintf(PRINT_NORMAL, _T(" - LC8951 register 0x%X read (PC: 0x%06X)\n"), nLC8951Register, SekGetPC(-1)); - - INT32 reg = LC8951RegistersR[nLC8951Register]; - - switch (nLC8951Register) { - case 0x03: // DBCH - LC8951RegistersR[3] &= 0x0F; - LC8951RegistersR[3] |= (LC8951RegistersR[1] & 0x40) ? 0x00 : 0xF0; - break; - case 0x0D: // STAT3 - LC8951RegistersR[1] |= 0x20; // reset DECI - // bprintf(PRINT_ERROR, _T(" - DECI (PC: 0x%06X)\n"), SekGetPC(-1)); - break; - } - - nLC8951Register = (nLC8951Register + 1) & 0x0F; - return reg; - } - - // CD mechanism communication - case 0x0161: - return NeoCDCommsread(); - - default: { -// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); - } - } - - return ~0; -} - -UINT16 __fastcall neogeoReadWordCDROM(UINT32 sekAddress) -{ -// bprintf(PRINT_NORMAL, _T(" - CDROM: 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); - -#if 1 - switch (sekAddress & 0xFFFF) { - case 0x011C: - return ~((0x10 | (NeoSystem & 3)) << 8); - } -#endif - -// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); - - return ~0; -} - -void __fastcall neogeoWriteByteCDROM(UINT32 sekAddress, UINT8 byteValue) -{ -// bprintf(PRINT_NORMAL, _T(" - Neo Geo CD: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); - - switch (sekAddress & 0xFFFF) { - case 0x000F: - NeoCDIRQUpdate(byteValue); - break; - - case 0x0017: - nNeoCDMode = byteValue; - break; - - case 0x0061: - if (byteValue & 0x40) { - NeoCDDoDMA(); - } - break; - - // LC8951 registers - case 0x0101: - nLC8951Register = byteValue & 0x0F; -// bprintf(PRINT_NORMAL, _T(" - LC8951 register -> 0x%02X (PC: 0x%06X)\n"), nLC8951Register, SekGetPC(-1)); - break; - case 0x0103: -// bprintf(PRINT_NORMAL, _T(" - LC8951 register 0x%X -> 0x%02X (PC: 0x%06X)\n"), nLC8951Register, byteValue, SekGetPC(-1)); - switch (nLC8951Register) { - case 3: // DBCH - LC8951RegistersW[ 3] = byteValue & 0x0F; - break; - case 6: // DTTRG - LC8951RegistersW[ 6] = ~0x00; - LC8951RegistersR[ 1] &= ~0x08; - break; - case 7: // DTACK - LC8951RegistersW[ 7] = ~0x00; - LC8951RegistersR[ 1] &= ~0x40; - break; -// case 10: -// LC8951RegistersW[nLC8951Register] = byteValue; -// bprintf(PRINT_NORMAL, _T(" - CTRL0 -> %02X (PC: 0x%06X)\n"), LC8951RegistersW[nLC8951Register], byteValue, SekGetPC(-1)); -// break; - case 11: - LC8951RegistersW[11] = byteValue; // CTRL1 - LC8951UpdateHeader(); - break; - case 15: - LC8951Reset(); - break; - default: - LC8951RegistersW[nLC8951Register] = byteValue; - } - nLC8951Register = (nLC8951Register + 1) & 0x0F; - break; - - case 0x0105: -// bprintf(PRINT_NORMAL, _T(" - NGCD 0xE00000 area -> 0x%02X (PC: 0x%06X)\n"), byteValue, SekGetPC(-1)); - nActiveTransferArea = byteValue; - break; - - case 0x0121: -// bprintf(PRINT_NORMAL, _T(" - NGCD OBJ BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); - NeoSetSpriteSlot(1); - memset(NeoCDOBJBankUpdate, 0, sizeof(NeoCDOBJBankUpdate)); - break; - case 0x0123: -// bprintf(PRINT_NORMAL, _T(" - NGCD PCM BUSREQ -> 1 (PC: 0x%06X) %x\n"), SekGetPC(-1), byteValue); - break; - case 0x0127: -// bprintf(PRINT_NORMAL, _T(" - NGCD Z80 BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); - neogeoSynchroniseZ80(0); - ZetSetBUSREQLine(1); - break; - case 0x0129: -// bprintf(PRINT_NORMAL, _T(" - NGCD FIX BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); - NeoSetTextSlot(1); - break; - - case 0x0141: -// bprintf(PRINT_NORMAL, _T(" - NGCD OBJ BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); - NeoSetSpriteSlot(0); - for (INT32 i = 0; i < 4; i++) { - if (NeoCDOBJBankUpdate[i]) { - NeoDecodeSpritesCD(NeoSpriteRAM + (i << 20), NeoSpriteROM[0] + (i << 20), 0x100000); - NeoUpdateSprites((i << 20), 0x100000); - } - } - - break; - case 0x0143: -// bprintf(PRINT_NORMAL, _T(" - NGCD PCM BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); - break; - case 0x0147: -// bprintf(PRINT_NORMAL, _T(" - NGCD Z80 BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); - neogeoSynchroniseZ80(0); - ZetSetBUSREQLine(0); - break; - case 0x0149: -// bprintf(PRINT_NORMAL, _T(" - NGCD FIX BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); - NeoSetTextSlot(0); - NeoUpdateText(0, 0x020000, NeoTextRAM, NeoTextROM[0]); - break; - - // CD mechanism communication - case 0x0163: - NeoCDCommsWrite(byteValue); - break; - case 0x0165: - NeoCDCommsControl(byteValue & 1, byteValue & 2); - break; - - case 0x016D: -// bprintf(PRINT_ERROR, _T(" - NGCD port 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); - - MapVectorTable(!(byteValue == 0xFF)); - -//extern INT32 bRunPause; -//bRunPause = 1; - break; - - case 0x016F: -// bprintf(PRINT_IMPORTANT, _T(" - NGCD 0xE00000 area write access %s (0x%02X, PC: 0x%06X)\n"), byteValue ? _T("enabled") : _T("disabled"), byteValue, SekGetPC(-1)); - - nTransferWriteEnable = byteValue; - break; - - case 0x0181: { - static UINT8 clara = 0; - if (!byteValue && clara) { -// bprintf(PRINT_IMPORTANT, _T(" - NGCD CD communication reset (PC: 0x%06X)\n"), SekGetPC(-1)); -// NeoCDCommsReset(); - } - clara = byteValue; - break; - } - case 0x0183: { - static UINT8 clara = 0; - if (!byteValue && clara) { -// bprintf(PRINT_IMPORTANT, _T(" - NGCD Z80 reset (PC: 0x%06X)\n"), SekGetPC(-1)); - //ZetReset(); - } - clara = byteValue; - break; - } - case 0x01A1: - nSpriteTransferBank = (byteValue & 3) << 20; - break; - case 0x01A3: - nADPCMTransferBank = (byteValue & 1) << 19; - break; - - default: { -// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); - } - } -} - -void __fastcall neogeoWriteWordCDROM(UINT32 sekAddress, UINT16 wordValue) -{ -// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); - - switch (sekAddress & 0xFFFE) { - case 0x0002: -// bprintf(PRINT_IMPORTANT, _T(" - NGCD Interrupt mask -> 0x%04X (PC: 0x%06X)\n"), wordValue, SekGetPC(-1)); - nff0002 = wordValue; - -// LC8951RegistersR[1] |= 0x20; - - if (nff0002 & 0x0500) - nNeoCDCyclesIRQPeriod = (INT32)(12000000.0 * nBurnCPUSpeedAdjust / (256.0 * 75.0)); - else - nNeoCDCyclesIRQPeriod = (INT32)(12000000.0 * nBurnCPUSpeedAdjust / (256.0 * 75.0)); - - break; - - case 0x000E: - NeoCDIRQUpdate(wordValue); - break; - - // DMA controller - - case 0x0064: - NeoCDDMAAddress1 &= 0x0000FFFF; - NeoCDDMAAddress1 |= wordValue << 16; - break; - case 0x0066: - NeoCDDMAAddress1 &= 0xFFFF0000; - NeoCDDMAAddress1 |= wordValue; - break; - case 0x0068: - NeoCDDMAAddress2 &= 0x0000FFFF; - NeoCDDMAAddress2 |= wordValue << 16; - break; - case 0x006A: - NeoCDDMAAddress2 &= 0xFFFF0000; - NeoCDDMAAddress2 |= wordValue; - break; - case 0x006C: - NeoCDDMAValue1 = wordValue; - break; - case 0x006E: - NeoCDDMAValue2 = wordValue; - break; - case 0x0070: - NeoCDDMACount &= 0x0000FFFF; - NeoCDDMACount |= wordValue << 16; - break; - case 0x0072: - NeoCDDMACount &= 0xFFFF0000; - NeoCDDMACount |= wordValue; - break; - - case 0x007E: - NeoCDDMAMode = wordValue; -// bprintf(PRINT_NORMAL, _T(" - DMA controller 0x%2X -> 0x%04X (PC: 0x%06X)\n"), sekAddress & 0xFF, wordValue, SekGetPC(-1)); - break; - - // upload DMA controller program - - case 0x0080: - case 0x0082: - case 0x0084: - case 0x0086: - case 0x0088: - case 0x008A: - case 0x008C: - case 0x008E: -// bprintf(PRINT_NORMAL, _T(" - DMA controller program[%02i] -> 0x%04X (PC: 0x%06X)\n"), sekAddress & 0x0F, wordValue, SekGetPC(-1)); - break; - - default: { -// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); - } - } - -} - -// Reads from / writes to the transfer area - -UINT8 __fastcall neogeoReadByteTransfer(UINT32 sekAddress) -{ -// if ((sekAddress & 0x0FFFFF) < 16) -// printf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); - - sekAddress ^= 1; - - switch (nActiveTransferArea) { - case 0: // Sprites - return NeoSpriteRAM[nSpriteTransferBank + (sekAddress & 0x0FFFFF)]; - break; - case 1: // ADPCM - return YM2610ADPCMAROM[nNeoActiveSlot][nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)]; - break; - case 4: // Z80 - if ((sekAddress & 0xfffff) >= 0x20000) break; - return NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1]; - break; - case 5: // Text - return NeoTextRAM[(sekAddress & 0x3FFFF) >> 1]; - break; - } - - return ~0; -} - -UINT16 __fastcall neogeoReadWordTransfer(UINT32 sekAddress) -{ -// if ((sekAddress & 0x0FFFFF) < 16) -// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); - - switch (nActiveTransferArea) { - case 0: // Sprites - return *((UINT16*)(NeoSpriteRAM + nSpriteTransferBank + (sekAddress & 0xFFFFF))); - break; - case 1: // ADPCM - return 0xFF00 | YM2610ADPCMAROM[nNeoActiveSlot][nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)]; - break; - case 4: // Z80 - if ((sekAddress & 0xfffff) >= 0x20000) break; - return 0xFF00 | NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1]; - break; - case 5: // Text - return 0xFF00 | NeoTextRAM[(sekAddress & 0x3FFFF) >> 1]; - break; - } - - return ~0; -} - -void __fastcall neogeoWriteByteTransfer(UINT32 sekAddress, UINT8 byteValue) -{ -// if ((sekAddress & 0x0FFFFF) < 16) -// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); - - if (!nTransferWriteEnable) { -// return; - } - - sekAddress ^= 1; - - switch (nActiveTransferArea) { - case 0: // Sprites - NeoSpriteRAM[nSpriteTransferBank + (sekAddress & 0x0FFFFF)] = byteValue; - NeoCDOBJBankUpdate[nSpriteTransferBank >> 20] = true; - break; - case 1: // ADPCM - YM2610ADPCMAROM[nNeoActiveSlot][nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = byteValue; - break; - case 4: // Z80 - if ((sekAddress & 0xfffff) >= 0x20000) break; - NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1] = byteValue; - break; - case 5: // Text - NeoTextRAM[(sekAddress & 0x3FFFF) >> 1] = byteValue; -// NeoUpdateTextOne((sekAddress & 0x3FFFF) >> 1, byteValue); - break; - } -} - -void __fastcall neogeoWriteWordTransfer(UINT32 sekAddress, UINT16 wordValue) -{ -// if ((sekAddress & 0x0FFFFF) < 16) -// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); - - if (!nTransferWriteEnable) { -// return; - } - - switch (nActiveTransferArea) { - case 0: // Sprites - *((UINT16*)(NeoSpriteRAM + nSpriteTransferBank + (sekAddress & 0xFFFFF))) = wordValue; - NeoCDOBJBankUpdate[nSpriteTransferBank >> 20] = true; - break; - case 1: // ADPCM - YM2610ADPCMAROM[nNeoActiveSlot][nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = wordValue; - break; - case 4: // Z80 - // The games that write here, seem to write crap, however the BIOS writes the Z80 code here, and not in the byte area - // So basically, we are allowing writes to here, until the BIOS has finished writing the program, then not allowing any further writes - if (((sekAddress & 0xfffff) >= 0x20000) || nNeoCDZ80ProgWriteWordCancelHack) break; - if (sekAddress == 0xe1fdf2) nNeoCDZ80ProgWriteWordCancelHack = 1; - NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1] = wordValue; - break; - case 5: // Text - NeoTextRAM[(sekAddress & 0x3FFFF) >> 1] = wordValue; -// NeoUpdateTextOne((sekAddress & 0x3FFFF) >> 1, wordValue); - break; - } -} - -// 68K memory - -void __fastcall neogeoWriteWord68KProgram(UINT32 sekAddress, UINT16 wordValue) -{ -// if (sekAddress < 16) -// bprintf(PRINT_NORMAL, _T(" - 68K: 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); - - *((UINT16*)(Neo68KROMActive + sekAddress)) = BURN_ENDIAN_SWAP_INT16(wordValue); - if (sekAddress >= 0x0100) { - *((UINT16*)(NeoVectorActive + sekAddress)) = BURN_ENDIAN_SWAP_INT16(wordValue); - } -} - -void __fastcall neogeoWriteByte68KProgram(UINT32 sekAddress, UINT8 byteValue) -{ -// if (sekAddress < 16) -// bprintf(PRINT_NORMAL, _T(" - 68K: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); - - Neo68KROMActive[sekAddress ^ 1] = byteValue; - if (sekAddress >= 0x0100) { - NeoVectorActive[sekAddress ^ 1] = byteValue; - } -} - -// ---------------------------------------------------------------------------- - -// for NeoGeo CD (WAV playback) -void wav_exit(); - -static INT32 neogeoReset() -{ - if (nNeoSystemType & NEO_SYS_CART) { - NeoLoad68KBIOS(NeoSystem & 0x1f); - - if (nBIOS == -1 || nBIOS == 23) { - // Write system type & region code into BIOS ROM - *((UINT16*)(Neo68KBIOS + 0x000400)) = BURN_ENDIAN_SWAP_INT16(((NeoSystem & 4) << 13) | (NeoSystem & 0x03)); - } - -#if 1 && defined FBA_DEBUG - if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_SNK_DEDICATED_PCB) && (BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_TRACKBALL) { - switch (NeoSystem & 0x1f) { - case 0x00: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Asia/Europe ver. 6 (1 slot) BIOS\n")); break; } - case 0x01: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Asia/Europe ver. 5 (1 slot) BIOS\n")); break; } - case 0x02: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Asia/Europe ver. 3 (4 slot) BIOS\n")); break; } - case 0x03: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS USA ver. 5 (2 slot) BIOS\n")); break; } - case 0x04: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS USA ver. 5 (6 slot) BIOS\n")); break; } - case 0x05: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Japan ver. 6 (? slot) BIOS\n")); break; } - case 0x06: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Japan ver. 5 (? slot) BIOS\n")); break; } - case 0x07: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Japan ver. 3 (4 slot) BIOS\n")); break; } - case 0x08: { bprintf(PRINT_IMPORTANT, _T("Emulating using NEO-MVH MV1C BIOS\n")); break; } - case 0x09: { bprintf(PRINT_IMPORTANT, _T("MVS Japan (J3)\n")); break; } - case 0x0a: { bprintf(PRINT_IMPORTANT, _T("Emulating using AES Japan BIOS\n")); break; } - case 0x0b: { bprintf(PRINT_IMPORTANT, _T("Emulating using AES Asia BIOS\n")); break; } - case 0x0c: { bprintf(PRINT_IMPORTANT, _T("Emulating using Development Kit BIOS\n")); break; } - case 0x0d: { bprintf(PRINT_IMPORTANT, _T("Emulating using Deck ver. 6 (Git Ver 1.3) BIOS\n")); break; } - case 0x0e: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 3.0 BIOS\n")); break; } - case 0x0f: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 2.3 BIOS\n")); break; } - case 0x10: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 2.3 (alt) BIOS\n")); break; } - case 0x11: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 2.2 BIOS\n")); break; } - case 0x12: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 2.1 BIOS\n")); break; } - case 0x13: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 2.0 BIOS\n")); break; } - case 0x14: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 1.3 BIOS\n")); break; } - case 0x15: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 1.2 BIOS\n")); break; } - case 0x16: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 1.2 (alt) BIOS\n")); break; } - case 0x17: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 1.1 BIOS\n")); break; } - case 0x18: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 1.0 BIOS\n")); break; } - case 0x19: { bprintf(PRINT_IMPORTANT, _T("Emulating using NeoOpen BIOS v0.1 beta BIOS\n")); break; } - } - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_TRACKBALL) { - bprintf(PRINT_IMPORTANT, _T("Emulating using custom Trackball BIOS\n")); - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) { - bprintf(PRINT_IMPORTANT, _T("Emulating using custom PCB BIOS\n")); - } -#endif - - OldDebugDip[0] = NeoDebugDip[0] = 0; - OldDebugDip[1] = NeoDebugDip[1] = 0; - } - -#if 1 && defined FBA_DEBUG - if (nNeoSystemType & NEO_SYS_CD) { - bprintf(PRINT_IMPORTANT, _T(" - Emulating Neo CD system.\n")); - - // exit WAV object if needed - wav_exit(); - - nNeoCDZ80ProgWriteWordCancelHack = 0; - } -#endif - - NeoSetSystemType(); - - bSRAMWritable = false; - - bNeoEnableGraphics = true; - - bBIOSTextROMEnabled = false; - bZ80BoardROMBankedIn = false; - b68KBoardROMBankedIn = true; - - nNeoPaletteBank = -1; - - nSpriteFrameSpeed = 4; - nSpriteFrameTimer = 0; - nNeoSpriteFrame = 0; - - nIRQAcknowledge = ~0; - bIRQEnabled = false; - - nSoundLatch = 0x00; - nSoundReply = 0x00; - nSoundStatus = 1; - -#if 1 && defined USE_SPEEDHACKS - nSoundPrevReply = -1; -#endif - - nIRQOffset = 0; - nIRQControl = 0; - - nInputSelect = 0; - NeoInputBank = NeoInput; - - nCyclesExtra[0] = nCyclesExtra[1] = 0; - - { - SekOpen(0); - ZetOpen(0); - - if (nNeoSystemType & NEO_SYS_MVS) { - for (INT32 a = 0xD00000; a < 0xE00000; a += 0x010000) { - SekMapMemory(NeoNVRAM, a, a + 0xFFFF, SM_RAM); // 68K RAM - } - SekMapHandler(1, 0xD00000, 0xDFFFFF, SM_WRITE); // - } else { - SekMapHandler(0, 0xD00000, 0xDFFFFF, SM_RAM); // AES/NeoCD don't have the SRAM - } - - if (nNeoSystemType & NEO_SYS_CART) { - NeoMapActiveCartridge(); - } - - if (nNeoSystemType & NEO_SYS_PCB) { - if (BurnDrvGetHardwareCode() & HARDWARE_SNK_KOF2K3) { - SekMapMemory(Neo68KBIOS, 0xC00000, 0xC7FFFF, SM_ROM); - SekMapMemory(Neo68KBIOS, 0xC80000, 0xCFFFFF, SM_ROM); - } else { - for (INT32 a = 0xC00000; a < 0xD00000; a += 0x020000) { - SekMapMemory(Neo68KBIOS + (NeoSystem & 0x03) * 0x020000, a, a + 0x01FFFF, SM_ROM); - } - } - } - - // Set by a switch on the PCB - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "svcpcb") || !strcmp(BurnDrvGetTextA(DRV_NAME), "svcpcba") || !strcmp(BurnDrvGetTextA(DRV_NAME), "svcpcbnd") || !strcmp(BurnDrvGetTextA(DRV_NAME), "ms5pcb") || !strcmp(BurnDrvGetTextA(DRV_NAME), "ms5pcbnd")) { - SekMapMemory(Neo68KBIOS + 0x20000 * (~NeoSystem & 1), 0xc00000, 0xc1ffff, SM_ROM); - } - - MapVectorTable(true); - - if (nNeoSystemType & NEO_SYS_CD) { - nActiveTransferArea = -1; - nSpriteTransferBank = -1; - nADPCMTransferBank = -1; - - NeoCDCommsReset(); - - nTransferWriteEnable = 0; - - NeoSetTextSlot(0); - NeoSetSpriteSlot(0); - - memset(NeoCDOBJBankUpdate, 0, sizeof(NeoCDOBJBankUpdate)); - - LC8951Reset(); - } - - ZetSetBUSREQLine(0); - - SekReset(); - ZetReset(); - - MapPalette(0); - - ZetClose(); - SekClose(); - } - - ZetOpen(0); - BurnYM2610Reset(); - ZetClose(); - -#if defined EMULATE_WATCHDOG - nNeoWatchdog = 0; -#endif - - nIRQCycles = NO_IRQ_PENDING; - - nNeoCDIRQVector = 0; - nNeoCDIRQVectorAck = 0; - nff0002 = 0; - - return 0; -} - -static void SwitchToMusashi() -{ - if (bBurnUseASMCPUEmulation) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); -#endif - bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; - bBurnUseASMCPUEmulation = false; - } -} - -static INT32 NeoInitCommon() -{ - BurnSetRefreshRate(NEO_VREFRESH); - INT32 nNeoScreenHeight; // not used - BurnDrvGetFullSize(&nNeoScreenWidth, &nNeoScreenHeight); - - if (nNeoSystemType & NEO_SYS_CART) { - nVBLankIRQ = 1; - nScanlineIRQ = 2; - } else { - nVBLankIRQ = 2; - nScanlineIRQ = 1; - } - - // Allocate all memory is needed for RAM - { - INT32 nLen; - - RAMIndex(); // Get amount of memory needed - nLen = RAMEnd - (UINT8*)0; - if ((AllRAM = (UINT8*)BurnMalloc(nLen)) == NULL) { // Allocate memory - return 1; - } - memset(AllRAM, 0, nLen); // Initialise memory - RAMIndex(); // Index the allocated memory - } - - if (nNeoSystemType & NEO_SYS_CD) { - SwitchToMusashi(); - } - - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - ZetInit(0); - ZetOpen(0); - - { - if (nNeoSystemType & NEO_SYS_CD) { - SekSetIrqCallback(NeoCDIRQCallback); - } - - SekSetCyclesScanline((INT32)(12000000.0 / NEO_HREFRESH)); - - // Map 68000 memory: - - if (nNeoSystemType & NEO_SYS_CART) { - - for (INT32 a = 0x100000; a < 0x200000; a += 0x010000) { - SekMapMemory(Neo68KRAM, a, a + 0xFFFF, SM_RAM); // 68K RAM - } - - if (!(nNeoSystemType & NEO_SYS_PCB)) { -// for (INT32 a = 0xC00000; a < 0xD00000; a += 0x020000) { -// SekMapMemory(Neo68KBIOS, a, a + 0x01FFFF, SM_ROM); // MVS/AES BIOS ROM -// } - SekMapMemory(Neo68KBIOS, 0xC00000, 0xC7FFFF, SM_ROM); // BIOS ROM - } - - } else { - SekMapMemory(Neo68KFix[0], 0x000000, 0x1FFFFF, SM_RAM); // Main 68K RAM - SekMapMemory(Neo68KBIOS, 0xC00000, 0xC7FFFF, SM_ROM); // NeoCD BIOS ROM - SekMapMemory(Neo68KBIOS, 0xC80000, 0xCFFFFF, SM_ROM); // - } - - SekSetReadWordHandler(0, neogeoReadWord); - SekSetReadByteHandler(0, neogeoReadByte); - SekSetWriteWordHandler(0, neogeoWriteWord); - SekSetWriteByteHandler(0, neogeoWriteByte); - - SekSetWriteWordHandler(1, neogeoWriteWordSRAM); - SekSetWriteByteHandler(1, neogeoWriteByteSRAM); - - if (!(nNeoSystemType & NEO_SYS_PCB)) { - SekMapHandler(2, 0x800000, 0xBFFFFF, SM_ROM); // Memory card - SekMapHandler(2, 0x800000, 0xBFFFFF, SM_WRITE); // - - SekSetReadByteHandler(2, neogeoReadByteMemoryCard); - SekSetWriteByteHandler(2, neogeoWriteByteMemoryCard); - } - - SekMapHandler(3, 0x400000, 0x7FFFFF, SM_WRITE); // Palette - - SekSetWriteWordHandler(3, NeoPalWriteWord); - SekSetWriteByteHandler(3, NeoPalWriteByte); - - // Set up mirrors - for (INT32 a = 0x420000; a < 0x800000; a += 0x2000) { - SekMapMemory(NeoPalSrc[0], a, a + 0x1FFF, SM_ROM); - } - - SekMapHandler(5, 0x3C0000, 0x3DFFFF, SM_RAM); // Read Video Controller - SekSetReadWordHandler(5, neogeoReadWordVideo); - SekSetReadByteHandler(5, neogeoReadByteVideo); - SekSetWriteWordHandler(5, neogeoWriteWordVideo); - SekSetWriteByteHandler(5, neogeoWriteByteVideo); - - if (nNeoSystemType & NEO_SYS_CD) { - SekMapHandler(4, 0x000000, 0x0003FF, SM_WRITE); - - SekSetWriteWordHandler(4, neogeoWriteWord68KProgram); - SekSetWriteByteHandler(4, neogeoWriteByte68KProgram); - - SekMapHandler(6, 0xE00000, 0xEFFFFF, SM_RAM); - - SekSetReadWordHandler(6, neogeoReadWordTransfer); - SekSetReadByteHandler(6, neogeoReadByteTransfer); - SekSetWriteWordHandler(6, neogeoWriteWordTransfer); - SekSetWriteByteHandler(6, neogeoWriteByteTransfer); - - SekMapHandler(7, 0xF00000, 0xFFFFFF, SM_RAM); - - SekSetReadWordHandler(7, neogeoReadWordCDROM); - SekSetReadByteHandler(7, neogeoReadByteCDROM); - SekSetWriteWordHandler(7, neogeoWriteWordCDROM); - SekSetWriteByteHandler(7, neogeoWriteByteCDROM); - - SekSetReadByteHandler(2, neoCDReadByteMemoryCard); - SekSetWriteByteHandler(2, neoCDWriteByteMemoryCard); - - } - } - - { - // Z80 setup - - if (nNeoSystemType & NEO_SYS_CART) { - // Work RAM - ZetMapArea(0xF800, 0xFFFF, 0, NeoZ80RAM); - ZetMapArea(0xF800, 0xFFFF, 1, NeoZ80RAM); - ZetMapArea(0xF800, 0xFFFF, 2, NeoZ80RAM); - - ZetMemEnd(); - - ZetSetInHandler(neogeoZ80In); - ZetSetOutHandler(neogeoZ80Out); - } - - if (nNeoSystemType & NEO_SYS_CD) { - // Main Z80 RAM - ZetMapArea(0x0000, 0xFFFF, 0, NeoZ80ROMActive); - ZetMapArea(0x0000, 0xFFFF, 1, NeoZ80ROMActive); - ZetMapArea(0x0000, 0xFFFF, 2, NeoZ80ROMActive); - - ZetMemEnd(); - - ZetSetInHandler(neogeoZ80InCD); - ZetSetOutHandler(neogeoZ80Out); - } - } - - ZetClose(); - SekClose(); - -#if defined USE_SPEEDHACKS - bRenderLineByLine = false; -#else - bRenderLineByLine = false; -#endif - -#if defined RASTER_KLUDGE - nScanlineOffset = 0xF8; // correct as verified on MVS hardware -#endif - - // These games rely on reading the line counter for synchronising raster effects - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "mosyougi")) { - bRenderLineByLine = true; - -#if defined RASTER_KLUDGE - nScanlineOffset = 0xFB; -#endif - - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "neodrift")) { - bRenderLineByLine = true; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "zedblade")) { - bRenderLineByLine = true; - } -// if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ssideki2")) { -// bRenderLineByLine = true; -// } - - nNeoControlConfig = BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK; - - // Hook up standard joysticks to all ports - for (INT32 i = 0; i < 8; i++) { - nJoyport0[i] = 0; - nJoyport1[i] = 1; - } - - if (nNeoSystemType & NEO_SYS_CD) { - nJoyport0[4] = 16; - nJoyport1[4] = 17; - } else { - // Override for special controllers - switch (nNeoControlConfig) { - case HARDWARE_SNK_PADDLE: // Two Paddles + joysticks - nJoyport0[0] = 6; - nJoyport1[0] = 7; - break; - case HARDWARE_SNK_TRACKBALL: // Trackball controller - nJoyport0[0] = 6; - nJoyport0[1] = 7; - break; - case HARDWARE_SNK_MAHJONG: // Mahjong controller - nJoyport0[1] = 16; - nJoyport0[2] = 17; - nJoyport0[4] = 18; - break; - } - } - -#if defined Z80_SPEED_ADJUST - nZ80Clockspeed = 4000000; -#endif - - if (nNeoSystemType & NEO_SYS_CART) { - BurnYM2610Init(8000000, YM2610ADPCMAROM[0], &nYM2610ADPCMASize[0], YM2610ADPCMBROM[0], &nYM2610ADPCMBSize[0], &neogeoFMIRQHandler, neogeoSynchroniseStream, neogeoGetTime, 0); - } else { - BurnYM2610Init(8000000, YM2610ADPCMBROM[0], &nYM2610ADPCMBSize[0], YM2610ADPCMBROM[0], &nYM2610ADPCMBSize[0], &neogeoFMIRQHandler, neogeoSynchroniseStream, neogeoGetTime, 0); - } - - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); - - BurnTimerAttachZet(nZ80Clockspeed); - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { - for (nNeoActiveSlot = 0; nNeoActiveSlot < MAX_SLOT; nNeoActiveSlot++) { - if (nBurnDrvSelect[nNeoActiveSlot] < nBurnDrvCount) { -// NeoInitText(nNeoActiveSlot); -// NeoInitSprites(nNeoActiveSlot); - } - } - - NeoInitText(-1); - - } else { - NeoInitText(0); - NeoInitText(-1); - NeoInitSprites(0); - } - - if (nNeoSystemType & NEO_SYS_CART) { - ZetOpen(0); - nZ80Bank0 = nZ80Bank1 = nZ80Bank2 = nZ80Bank3 = -1; - NeoZ80SetBank0(0x02); - NeoZ80SetBank1(0x06); - NeoZ80SetBank2(0x0E); - NeoZ80SetBank3(0x1E); - - NeoZ80MapROM(false); - ZetClose(); - } - - NeoInitPalette(); - - uPD4990AInit(12000000); - nPrevBurnCPUSpeedAdjust = -1; - - if (nNeoSystemType & NEO_SYS_CD) { - bMemoryCardInserted = true; - bMemoryCardWritable = true; - } else { - bMemoryCardInserted = false; - bMemoryCardWritable = false; - } - - nNeoActiveSlot = 0; - neogeoReset(); // Reset machine - - return 0; -} - -static bool recursing = false; - -INT32 NeoInit() -{ - if (recursing) { - if (LoadRoms()) { - return 1; - } - return 0; - } - - recursing = true; - - nNeoSystemType = NEO_SYS_CART; - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) { - nNeoSystemType |= NEO_SYS_MVS | NEO_SYS_PCB; - } - - nNeoActiveSlot = 0; - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { - UINT32 nDriver = nBurnDrvActive; - -// memset(NeoCallback, 0, sizeof(NeoCallback)); - - for (nNeoActiveSlot = 0; nNeoActiveSlot < MAX_SLOT; nNeoActiveSlot++) { - - if (nBurnDrvSelect[nNeoActiveSlot] < nBurnDrvCount) { - - nBurnDrvActive = nBurnDrvSelect[nNeoActiveSlot]; - NeoCallbackActive = &NeoCallback[nNeoActiveSlot]; - - if (BurnDrvCartridgeSetup(CART_INIT_START)) { - return 1; - } - - NeoInitText(nNeoActiveSlot); - NeoInitSprites(nNeoActiveSlot); - } - } - - for (nNeoNumSlots = 5; nNeoNumSlots > 0 && nBurnDrvSelect[nNeoNumSlots] >= nBurnDrvCount; nNeoNumSlots--) { } - - switch (nNeoNumSlots) { - case 0: - nNeoNumSlots = 1; - break; - case 1: - nNeoNumSlots = 2; - break; - case 2: - case 3: - nNeoNumSlots = 4; - break; - case 4: - case 5: - nNeoNumSlots = 6; - break; - } - - nBurnDrvActive = nDriver; - - if (BurnDrvCartridgeSetup(CART_INIT_END)) { - return 1; - } - - } else { - if (LoadRoms()) { - return 1; - } - } - - recursing = false; - - for (nNeoActiveSlot = 0; nNeoActiveSlot < nNeoNumSlots; nNeoActiveSlot++) { - NeoVector[nNeoActiveSlot] = (UINT8*)BurnMalloc(0x0400); - if (NeoVector[nNeoActiveSlot] == NULL) { - return 1; - } - memset(NeoVector[nNeoActiveSlot], 0, 0x0400); - } - - // Allocate all memory needed for ROM - { - INT32 nLen; - - ROMIndex(); // Get amount of memory needed - nLen = ROMEnd - (UINT8*)0; - if ((AllROM = (UINT8*)BurnMalloc(nLen)) == NULL) { // Allocate memory - return 1; - } - memset(AllROM, 0, nLen); // Initialise memory - ROMIndex(); // Index the allocated memory - } - - if (nNeoSystemType & NEO_SYS_PCB) { - BurnLoadRom(Neo68KBIOS, 0x00080 + 27, 1); - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { - BurnLoadRom(NeoZ80BIOS, 0x00000 + 28, 1); - BurnLoadRom(NeoTextROMBIOS, 0x00000 + 29, 1); - BurnLoadRom(NeoZoomROM, 0x00000 + 30, 1); - } else { - - // Still load the Z80 BIOS & text layer data for AES systems, since it might be switched to MVS later - - if (nNeoSystemType & NEO_SYS_PCB) { - bZ80BIOS = false; - BurnLoadRom(NeoTextROMBIOS, 0x00080 + 29, 1); - BurnLoadRom(NeoZoomROM, 0x00080 + 30, 1); - } else { - BurnLoadRom(NeoZ80BIOS, 0x00080 + 28, 1); - BurnLoadRom(NeoTextROMBIOS, 0x00080 + 29, 1); - BurnLoadRom(NeoZoomROM, 0x00080 + 30, 1); - } - } - BurnUpdateProgress(0.0, _T("Preprocessing text layer graphics...")/*, BST_PROCESS_TXT*/, 0); - NeoDecodeTextBIOS(0, 0x020000, NeoTextROMBIOS); - - nBIOS = 9999; - if (NeoLoad68KBIOS(NeoSystem & 0x1f)) { - return 1; - } - - return NeoInitCommon(); -} - -INT32 NeoCDInit() -{ - recursing = false; - - nNeoSystemType = NEO_SYS_CD; - - nCodeSize[0] = 0x200000; - nSpriteSize[0] = 0x400000; - nNeoTextROMSize[0] = 0x020000; - nYM2610ADPCMASize[0] = 0; - nYM2610ADPCMBSize[0] = 0x100000; - - // Allocate all memory is needed for ROM - { - INT32 nLen; - - ROMIndex(); // Get amount of memory needed - nLen = ROMEnd - (UINT8*)0; - if ((AllROM = (UINT8*)BurnMalloc(nLen)) == NULL) { // Allocate memory - return 1; - } - memset(AllROM, 0, nLen); // Initialise memory - ROMIndex(); // Index the allocated memory - } - - Neo68KROMActive = Neo68KROM[0]; - NeoVectorActive = NeoVector[0]; - NeoZ80ROMActive = NeoZ80ROM[0]; - - Neo68KFix[0] = Neo68KROM[0]; - - BurnLoadRom(Neo68KBIOS, 0, 1); - BurnLoadRom(NeoZoomROM, 1, 1); - - // Create copy of 68K with BIOS vector table - memcpy(NeoVectorActive + 0x00, Neo68KBIOS, 0x0100); - - // Create a default program for the Z80 - NeoZ80ROMActive[0] = 0xC3; // JP 0 - NeoZ80ROMActive[1] = 0x00; // - NeoZ80ROMActive[2] = 0x00; // - - bZ80BIOS = false; - - for (nNeoTileMask[0] = 1; nNeoTileMask[0] < nSpriteSize[0]; nNeoTileMask[0] <<= 1) { } - nNeoTileMask[0] = (nNeoTileMask[0] >> 7) - 1; - nNeoMaxTile[0] = nSpriteSize[0] >> 7; - - return NeoInitCommon(); -} - -INT32 NeoExit() -{ - if (recursing) { - return 0; - } - - recursing = true; - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { - UINT32 nDriver = nBurnDrvActive; - - for (nNeoActiveSlot = 0; nNeoActiveSlot < MAX_SLOT; nNeoActiveSlot++) { - - if (nBurnDrvSelect[nNeoActiveSlot] < nBurnDrvCount) { - - nBurnDrvActive = nBurnDrvSelect[nNeoActiveSlot]; - - if (BurnDrvCartridgeSetup(CART_EXIT)) { - return 1; - } - } - } - - nBurnDrvActive = nDriver; - } - - uPD4990AExit(); - - NeoExitPalette(); - - BurnYM2610Exit(); - - ZetExit(); // Deallocate Z80 - SekExit(); // Deallocate 68000 - - if (nNeoSystemType & NEO_SYS_CART) { - - // Deallocate all used memory - - for (nNeoActiveSlot = 0; nNeoActiveSlot < MAX_SLOT; nNeoActiveSlot++) { - - NeoExitSprites(nNeoActiveSlot); - NeoExitText(nNeoActiveSlot); - - BurnFree(NeoTextROM[nNeoActiveSlot]); // Text ROM - nNeoTextROMSize[nNeoActiveSlot] = 0; - - BurnFree(NeoSpriteROM[nNeoActiveSlot]); // Sprite ROM - BurnFree(Neo68KROM[nNeoActiveSlot]); // 68K ROM - BurnFree(NeoVector[nNeoActiveSlot]); // 68K vectors - BurnFree(NeoZ80ROM[nNeoActiveSlot]); // Z80 ROM - BurnFree(YM2610ADPCMAROM[nNeoActiveSlot]); - BurnFree(YM2610ADPCMBROM[nNeoActiveSlot]); - } - } - - if (nNeoSystemType & NEO_SYS_CD) { - NeoExitSprites(0); - NeoExitText(0); - } - - BurnFree(AllROM); // Misc ROM - BurnFree(AllRAM); // Misc RAM - - memset(NeoCallback, 0, sizeof(NeoCallback)); - NeoCallbackActive = &NeoCallback[0]; - - nNeoTextROMSize[0] = 0; - - nBIOS = 9999; - - nNeoActiveSlot = 0; - NeoVectorActive = NULL; - Neo68KROMActive = NULL; - NeoZ80ROMActive = NULL; - - nCodeSize[0] = 0; - - nNeoCDZ80ProgWriteWordCancelHack = 0; - - // Switch back CPU core if needed - if (nNeoSystemType & NEO_SYS_CD) { - if (bUseAsm68KCoreOldValue) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); -#endif - bUseAsm68KCoreOldValue = false; - bBurnUseASMCPUEmulation = true; - } - } - - recursing = false; - - bDisableNeoWatchdog = false; - - // release the NeoGeo CD information object if needed - NeoCDInfo_Exit(); - - return 0; -} - -INT32 NeoRender() -{ - NeoUpdatePalette(); // Update the palette - NeoClearScreen(); - - if (bNeoEnableGraphics) { - nSliceStart = 0x10; nSliceEnd = 0xF0; - nSliceSize = nSliceEnd - nSliceStart; - -#if 0 || defined LOG_DRAW - bprintf(PRINT_NORMAL, _T(" -- Drawing slice: %3i - %3i.\n"), nSliceStart, nSliceEnd); -#endif - - NeoRenderSprites(); // Render sprites - NeoRenderText(); // Render text layer - } - - return 0; -} - -inline static void NeoClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0C) == 0x0C) { - *nJoystickInputs &= ~0x0C; - } -} - -static void NeoStandardInputs(INT32 nBank) -{ - if (nBank) { - NeoInput[ 8] = 0x00; // Player 1 - NeoInput[ 9] = 0x00; // Player 2 - NeoInput[10] = 0x00; // Buttons - NeoInput[11] = 0x00; // - for (INT32 i = 0; i < 8; i++) { - NeoInput[ 8] |= (NeoJoy3[i] & 1) << i; - NeoInput[ 9] |= (NeoJoy4[i] & 1) << i; - NeoInput[10] |= (NeoButton3[i] & 1) << i; - NeoInput[11] |= (NeoButton4[i] & 1) << i; - } - NeoClearOpposites(&NeoInput[ 8]); - NeoClearOpposites(&NeoInput[ 9]); - - if (NeoDiag[1]) { - NeoInput[13] |= 0x80; - } - } else { - NeoInput[ 0] = 0x00; // Player 1 - NeoInput[ 1] = 0x00; // Player 2 - NeoInput[ 2] = 0x00; // Buttons - NeoInput[ 3] = 0x00; // - for (INT32 i = 0; i < 8; i++) { - NeoInput[ 0] |= (NeoJoy1[i] & 1) << i; - NeoInput[ 1] |= (NeoJoy2[i] & 1) << i; - NeoInput[ 2] |= (NeoButton1[i] & 1) << i; - NeoInput[ 3] |= (NeoButton2[i] & 1) << i; - } - NeoClearOpposites(&NeoInput[ 0]); - NeoClearOpposites(&NeoInput[ 1]); - - if (NeoDiag[0]) { - NeoInput[ 5] |= 0x80; - } - } -} - -#if 1 -#define NeoSekRun SekRun -#else -static INT32 NeoSekRun(const INT32 nCycles) -{ - INT32 nCyclesExecutedTotal = 0, nOldCyclesSegment = nCyclesSegment; - - if (!(nNeoSystemType & NEO_SYS_CD) || !(nff0002 & 0x0050)) - return SekRun(nCycles); - -//bprintf(PRINT_NORMAL, _T("***\n")); - - while (nCyclesExecutedTotal < nCycles) { - - INT32 nCyclesExecuted; - - if (nNeoCDCyclesIRQ <= 0) { - nNeoCDCyclesIRQ += nNeoCDCyclesIRQPeriod; - - // Trigger CD mechanism communication interrupt -//bprintf(PRINT_NORMAL, _T(" DECI status %i\n"), (LC8951RegistersR[1] & 0x20) >> 5); - - nIRQAcknowledge &= ~0x10; - NeoCDIRQUpdate(0); - - if ((nff0002 & 0x0500) && (LC8951RegistersR[1] & 0x20)) - NeoCDReadSector(); - } - - nCyclesSegment = (nNeoCDCyclesIRQ < (nCycles - nCyclesExecutedTotal)) ? nNeoCDCyclesIRQ : (nCycles - nCyclesExecutedTotal); - nCyclesExecuted = SekRun(nCyclesSegment); - -//bprintf(PRINT_NORMAL, _T("%010i %010i %010i %010i\n"), nCycles, nCyclesExecutedTotal, nCyclesExecuted, nNeoCDCyclesIRQ); - - nCyclesExecutedTotal += nCyclesExecuted; - nNeoCDCyclesIRQ -= nCyclesExecuted; - - } - - nCyclesSegment = nOldCyclesSegment; - - return nCyclesExecutedTotal; -} -#endif - -INT32 NeoFrame() -{ - if (NeoReset) { // Reset machine - if (nNeoSystemType & NEO_SYS_CART) { - memset(Neo68KRAM, 0, 0x010000); - } - - neogeoReset(); - } - - NeoInput[ 5] &= 0x1F; // Clear ports - NeoInput[13] = 0x00; // - - switch (nNeoControlConfig) { - case HARDWARE_SNK_PADDLE: { // Two Paddles + joysticks - - NeoStandardInputs(0); - - // Handle analog controls - nAnalogAxis[0] -= NeoAxis[0]; - nAnalogAxis[1] -= NeoAxis[1]; - NeoInput[6] = (nAnalogAxis[0] >> 8) & 0xFF; - NeoInput[7] = (nAnalogAxis[1] >> 8) & 0xFF; - - break; - } - - case HARDWARE_SNK_TRACKBALL: { // Trackball controller - NeoInput[1] = 0x00; // Buttons - NeoInput[2] = 0x00; // - NeoInput[3] = 0x00; // - for (INT32 i = 0; i < 8; i++) { - NeoInput[1] |= (NeoJoy2[i] & 1) << i; - NeoInput[2] |= (NeoButton1[i] & 1) << i; - NeoInput[3] |= (NeoButton2[i] & 1) << i; - } - // Handle analog controls - nAnalogAxis[0] += NeoAxis[0]; - nAnalogAxis[1] += NeoAxis[1]; - NeoInput[6] = (nAnalogAxis[0] >> 8) & 0xFF; - NeoInput[7] = (nAnalogAxis[1] >> 8) & 0xFF; - - if (NeoDiag[0]) { - NeoInput[5] |= 0x80; - } - - break; - } - - case HARDWARE_SNK_4_JOYSTICKS: { // Four joystick controllers - - NeoStandardInputs(0); - NeoStandardInputs(1); - - break; - } - - case HARDWARE_SNK_MAHJONG: { // Mahjong controller - - NeoStandardInputs(0); - - NeoInput[16] = 0x00; - NeoInput[17] = 0x00; - NeoInput[18] = 0x00; - for (INT32 i = 0; i < 7; i++) { - NeoInput[16] |= (NeoButton1[i + 8] & 1) << i; - NeoInput[17] |= (NeoButton1[i + 16] & 1) << i; - NeoInput[18] |= (NeoButton1[i + 24] & 1) << i; - } - - break; - } - - case HARDWARE_SNK_GAMBLING: { // Gambling configuration - - NeoStandardInputs(0); - -/* NeoInput[16] = 0x00; - for (INT32 i = 0; i < 7; i++) { - NeoInput[16] |= (NeoButton1[i + 16] & 1) << i; - }*/ - - break; - } - - default: { // Two joystick controllers - NeoStandardInputs(0); - } - } - - if (nNeoSystemType & NEO_SYS_CART) { - - bMemoryCardWritable = (NeoSystem & 0x80); - - if (bMemoryCardInserted) { - NeoInput[2] |= 0x30; // JEIDA connector pen /CD1, /READY - if (bMemoryCardWritable) { - NeoInput[2] |= 0x40; // JEIDA connector pen /WP - } - } - - if (nNeoSystemType & NEO_SYS_AES) { // Report the type of hardware - NeoInput[2] |= 0x80; - } - - if (nNeoControlConfig != HARDWARE_SNK_GAMBLING) { - if (nNeoSystemType & NEO_SYS_MVS) { // Report the appropriate number of slots on MVS hardware - switch (nNeoNumSlots) { - case 4: - NeoInput[ 5] &= ~0x40; - NeoInput[ 3] |= 0x20; - break; - case 6: - NeoInput[ 5] &= ~0x40; - NeoInput[ 3] &= ~0x20; - break; - default: - - // Default to 1/2 slot hardware - - NeoInput[ 5] |= 0x40; - NeoInput[ 3] |= 0x20; - } - } - } - - if (OldDebugDip[0] != NeoDebugDip[0]) { - SekOpen(0); - SekWriteByte(SekReadLong(0x010E) + 0, NeoDebugDip[0]); - SekClose(); - OldDebugDip[0] = NeoDebugDip[0]; - } - if (OldDebugDip[1] != NeoDebugDip[1]) { - SekOpen(0); - SekWriteByte(SekReadLong(0x010E) + 1, NeoDebugDip[1]); - SekClose(); - OldDebugDip[1] = NeoDebugDip[1]; - } - } else { - NeoInput[2] |= 0x70; - - NeoInput[16] = 0x00; - NeoInput[17] = 0x00; - - if (NeoDiag[0]) { - NeoInput[16] = (UINT8)~0xDA; - } - } - - if (nPrevBurnCPUSpeedAdjust != nBurnCPUSpeedAdjust) { - // 68K CPU clock is 12MHz, modified by nBurnCPUSpeedAdjust - nCyclesTotal[0] = (INT32)((INT64)12000000 * nBurnCPUSpeedAdjust / (256.0 * NEO_VREFRESH)); - -#if defined Z80_SPEED_ADJUST - // Z80 CPU clock always 68K / 3 - nCyclesTotal[1] = nCyclesTotal[0] / 3; - nZ80Clockspeed = (INT32)((INT64)4000000 * nBurnCPUSpeedAdjust / 256); - BurnTimerAttachZet(nZ80Clockspeed); -#else - // Z80 CPU clock is always 4MHz - nCyclesTotal[1] = 4000000.0 / NEO_VREFRESH; -#endif - // 68K cycles executed each scanline - SekOpen(0); - SekSetCyclesScanline((INT32)(12000000.0 * nBurnCPUSpeedAdjust / (256.0 * NEO_HREFRESH))); - SekClose(); - - // uPD499A ticks per second (same as 68K clock) - uPD499ASetTicks((INT64)12000000 * nBurnCPUSpeedAdjust / 256); - - nPrevBurnCPUSpeedAdjust = nBurnCPUSpeedAdjust; - } - -#if defined EMULATE_WATCHDOG - // If the watchdog isn't reset every 8 frames, reset the system - // This can't be 100% accurate, as the 68000 instruction timings are not 100% - if ((nNeoSystemType & NEO_SYS_CART) && nNeoWatchdog > nCyclesTotal[0] * 8) { - if (bDisableNeoWatchdog == false) { -#if 1 && defined FBA_DEBUG - SekOpen(0); - bprintf(PRINT_IMPORTANT, _T(" ** Watchdog triggered system reset (PC: 0x%06X)\n"), SekGetPC(-1)); - SekClose(); -#endif - neogeoReset(); - } - } -#endif -//bprintf(PRINT_NORMAL, _T("***\n")); - - bRenderImage = false; - bForceUpdateOnStatusRead = false; - - if (pBurnDraw) { - NeoUpdatePalette(); // Update the palette - NeoClearScreen(); - } - nSliceEnd = 0x10; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - // Compensate for extra cycles executed - SekIdle(nCyclesExtra[0]); - ZetIdle(nCyclesExtra[1]); - - nuPD4990ATicks = nCyclesExtra[0]; - - // Run 68000 - - - if ((nNeoSystemType & NEO_SYS_CD) && (nff0002 & 0x0050)) { - nIRQAcknowledge &= ~0x10; - NeoCDIRQUpdate(0); - - if (nff0002 & 0x0500) { - NeoCDReadSector(); - } - } - - - nCyclesSegment = nSekCyclesScanline * 24; - while (SekTotalCycles() < nCyclesSegment) { - - if ((nIRQControl & 0x10) && (nIRQCycles < NO_IRQ_PENDING) && (SekTotalCycles() >= nIRQCycles)) { - - nIRQAcknowledge &= ~2; - SekSetIRQLine(nScanlineIRQ, SEK_IRQSTATUS_ACK); - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ triggered (line %3i + %3i cycles).\n"), SekCurrentScanline(), SekTotalCycles() - SekCurrentScanline() * SekCyclesScanline()); -#endif - - if (nIRQControl & 0x80) { - nIRQCycles += NeoConvertIRQPosition(nIRQOffset + 1); - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ Line -> %3i (at line %3i, autoload).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); -#endif - - } - } - - if (nCyclesSegment < nIRQCycles || SekTotalCycles() >= nIRQCycles) { - NeoSekRun(nCyclesSegment - SekTotalCycles()); - } else { - NeoSekRun(nIRQCycles - SekTotalCycles()); - } - } - - bRenderImage = pBurnDraw != NULL && bNeoEnableGraphics; - bForceUpdateOnStatusRead = bRenderImage && bRenderLineByLine; - bForcePartialRender = false; - - // Display starts here - - nCyclesVBlank = nSekCyclesScanline * 248; - if (bRenderLineByLine) { - INT32 nLastIRQ = nIRQCycles - 1; - while (SekTotalCycles() < nCyclesVBlank) { - - if ((nIRQControl & 0x10) && (nIRQCycles < NO_IRQ_PENDING) && (nLastIRQ < nIRQCycles) && (SekTotalCycles() >= nIRQCycles)) { - nLastIRQ = nIRQCycles; - nIRQAcknowledge &= ~2; - SekSetIRQLine(nScanlineIRQ, SEK_IRQSTATUS_ACK); -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ triggered (line %3i + %3i cycles).\n"), SekCurrentScanline(), SekTotalCycles() - SekCurrentScanline() * SekCyclesScanline()); -#endif - - if (nIRQControl & 0x80) { - nIRQCycles += NeoConvertIRQPosition(nIRQOffset + 1); -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ Line -> %3i (at line %3i, autoload).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); -#endif - - } - - bForcePartialRender = bRenderImage; - if (bForcePartialRender) { - nSliceStart = nSliceEnd; - nSliceEnd = SekCurrentScanline() - 5; - } - } else { - if (bForcePartialRender) { - nSliceStart = nSliceEnd; - nSliceEnd = SekCurrentScanline() - 6; - } - } - - if (bForcePartialRender) { - - if (nSliceEnd > 240) { - nSliceEnd = 240; - } - nSliceSize = nSliceEnd - nSliceStart; - if (nSliceSize > 0) { - -#if 0 || defined LOG_DRAW - bprintf(PRINT_NORMAL, _T(" -- Drawing slice: %3i - %3i.\n"), nSliceStart, nSliceEnd); -#endif - - NeoRenderSprites(); // Render sprites - } - } - - bForcePartialRender = false; - - if (SekTotalCycles() >= nCyclesSegment) { - nCyclesSegment += nSekCyclesScanline; - } - if (nCyclesSegment < nIRQCycles || SekTotalCycles() >= nIRQCycles) { - NeoSekRun(nCyclesSegment - SekTotalCycles()); - } else { - NeoSekRun(nIRQCycles - SekTotalCycles()); - } - } - } else { - nCyclesSegment = nCyclesVBlank; - while (SekTotalCycles() < nCyclesVBlank) { - - if ((nIRQControl & 0x10) && (nIRQCycles < NO_IRQ_PENDING) && (SekTotalCycles() >= nIRQCycles)) { - nIRQAcknowledge &= ~2; - SekSetIRQLine(nScanlineIRQ, SEK_IRQSTATUS_ACK); - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ triggered (line %3i + %3i cycles).\n"), SekCurrentScanline(), SekTotalCycles() - SekCurrentScanline() * SekCyclesScanline()); -#endif - - if (nIRQControl & 0x80) { - nIRQCycles += NeoConvertIRQPosition(nIRQOffset + 1); - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ Line -> %3i (at line %3i, autoload).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); -#endif - - } - - bForcePartialRender = bRenderImage; - } - -#if defined RASTERS_OPTIONAL - if (bAllowRasters) { -#endif - if (bForcePartialRender) { - - nSliceStart = nSliceEnd; - nSliceEnd = SekCurrentScanline() - 5; - - if (nSliceEnd > 240) { - nSliceEnd = 240; - } - nSliceSize = nSliceEnd - nSliceStart; - if (nSliceSize > 0) { - -#if 0 || defined LOG_DRAW - bprintf(PRINT_NORMAL, _T(" -- Drawing slice: %3i - %3i.\n"), nSliceStart, nSliceEnd); -#endif - - NeoRenderSprites(); // Render sprites - } - } - -#if defined RASTERS_OPTIONAL - } -#endif - - bForcePartialRender = false; - - if (nCyclesSegment < nIRQCycles || SekTotalCycles() >= nIRQCycles) { - NeoSekRun(nCyclesSegment - SekTotalCycles()); - } else { - NeoSekRun(nIRQCycles - SekTotalCycles()); - } - } - } - - if (bRenderImage) { - if (nSliceEnd < 240) { - nSliceStart = nSliceEnd; - nSliceEnd = 240; - nSliceSize = nSliceEnd - nSliceStart; - -#if 0 || defined LOG_DRAW - bprintf(PRINT_NORMAL, _T(" -- Drawing slice: %3i - %3i.\n"), nSliceStart, nSliceEnd); -#endif - - NeoRenderSprites(); // Render sprites - } - NeoRenderText(); // Render text layer - } - - nIRQAcknowledge &= ~4; - SekSetIRQLine(nVBLankIRQ, SEK_IRQSTATUS_ACK); - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - VBLank.\n")); -#endif - - // set IRQ scanline at line 248 - if (nIRQControl & 0x40) { - if (NeoConvertIRQPosition(nIRQOffset) < NO_IRQ_PENDING) { - nIRQCycles = nCyclesSegment + NeoConvertIRQPosition(nIRQOffset); - } - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ Line -> %3i (at line %3i, VBlank).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); -#endif - - } - - nCyclesSegment = nCyclesTotal[0]; - while (SekTotalCycles() < nCyclesSegment) { - - if ((nIRQControl & 0x10) && (nIRQCycles < NO_IRQ_PENDING) && (SekTotalCycles() >= nIRQCycles)) { - nIRQAcknowledge &= ~2; - SekSetIRQLine(nScanlineIRQ, SEK_IRQSTATUS_ACK); - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ triggered (line %3i + %3i cycles).\n"), SekCurrentScanline(), SekTotalCycles() - SekCurrentScanline() * SekCyclesScanline()); -#endif - - if (nIRQControl & 0x80) { - nIRQCycles += NeoConvertIRQPosition(nIRQOffset + 1); - -#if 0 || defined LOG_IRQ - bprintf(PRINT_NORMAL, _T(" - IRQ Line -> %3i (at line %3i, autoload).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); -#endif - - } - } - - if (nCyclesSegment < nIRQCycles || SekTotalCycles() >= nIRQCycles) { - NeoSekRun(nCyclesSegment - SekTotalCycles()); - } else { - NeoSekRun(nIRQCycles - SekTotalCycles()); - } - } - - if (nIRQCycles < NO_IRQ_PENDING) { - nIRQCycles -= nCyclesTotal[0]; - if (nIRQCycles < 0) { - nIRQCycles = NO_IRQ_PENDING; - -#if 0 || defined LOG_IRQ - } else { - bprintf(PRINT_NORMAL, _T(" - IRQ Line past screen end (IRQControl: %02X, line -> %3i).\n"), nIRQControl, nIRQCycles / SekCyclesScanline()); -#endif - - } - } -// bprintf(PRINT_NORMAL, " -- IRQControl: %02X, nIRQCycles / SekCyclesScanline(): %3i.\n", nIRQControl, nIRQCycles / SekCyclesScanline()); - - // Update the sound until the end of the frame - - nCycles68KSync = SekTotalCycles(); - BurnTimerEndFrame(nCyclesTotal[1]); - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - - // Update the uPD4990 until the end of the frame - uPD4990AUpdate(SekTotalCycles() - nuPD4990ATicks); - -#if defined EMULATE_WATCHDOG - // Handle the watchdog - nNeoWatchdog += SekTotalCycles(); -#endif - - // Remember extra cycles executed - nCyclesExtra[0] = SekTotalCycles() - nCyclesTotal[0]; - nCyclesExtra[1] = ZetTotalCycles() - nCyclesTotal[1]; - -// bprintf(PRINT_NORMAL, _T(" Z80 PC 0x%04X\n"), Doze.pc); -// bprintf(PRINT_NORMAL, _T(" - %i\n"), SekTotalCycles()); - - ZetClose(); - SekClose(); - - if ((nIRQControl & 8) == 0) { - if (++nSpriteFrameTimer > nSpriteFrameSpeed) { - nSpriteFrameTimer = 0; - nNeoSpriteFrame++; - } - } - - CDEmuGetSoundBuffer(pBurnSoundOut, nBurnSoundLen); - - return 0; -} +/* + +struct NeoMediaInfo { + UINT8* p68KROM; + UINT8* pVector; + UINT8* pZ80ROM; + UINT8* pSpriteROM; + UINT8* pTextROM; + UINT8* pADPCMROM; + UINT8* pDeltaTROM; + + INT32 n68KBankOffset; + INT32 nVectorOffset; + + INT32 n68KROMSize; + INT32 nZ80ROMSize; + INT32 nSpriteROMSize; + INT32 nTextROMSize; + INT32 nADPCMROMSize; + INT32 nADeltaROMSize; + + // Function callbacks + + void (*pLoadCallback)(); + void (*pUnloadCallback)(); + void (*pInstallCallback)(); + void (*pUnnstallCallback)(); + void (*pBankswitchCallback)(); + INT32 (*pScan)(int, int*); + + // Private data + + INT32 nSRAMProtectionOffset; + + void* pCustomData; + void* pTextData; +}; + +*/ + +/* + * FB Alpha Neo Geo module + * + * The video frequencies of MVS hardware are: + * hsync: 15625 Hz + * vsync: ~59.18 Hz (264 scanlines make up a single frame) + * The image occupies 224 scanlines, spanning scanlines 24 to 248. + * + * The memory card interface occupies 128KB of memory. There are 2 kinds of + * memory cards that can be used -- 16bit or 8bit. For games, a maximum of 16kB + * data is stored on either, but 16bit cards can be used to transfer bookkeeping + * information. For 8bit cards, only odd bytes are used to address memory and + * the BIOS tests the size of the inserted card by writing to the first byte of + * each 2kB block. The interface used is JEIDA 3.0. + * + * bit 6 of memory location 0x300081 = 0 -> 1/2 slot MVS + * = 1 + bit 5 of 0x320001 = 0 -> 4 slot MVS + * = 1 -> 6 slot MVS + * + * On MVS hardware with multiple slots, address 0x380021 is used to select the + * active slot. + * + * The watchdog timer will reset the system after ~0.13 seconds + * + * On an MV-1F system, the following code was used to test: + * 000100 203C 0001 4F51 MOVE.L #0x14F51,D0 + * 000106 13C0 0030 0001 MOVE.B D0,0x300001 + * 00010C 5380 SUBQ.L #1,D0 + * 00010E 64FC BCC.S *-0x2 [0x10C] + * 000110 13C0 0030 0001 MOVE.B D0,0x300001 + * 000116 60F8 BRA.S *-0x6 [0x110] + * This code loops long enough to sometimes cause a reset, sometimes not. + * The move takes 16 cycles, subq 8, bcc 10 if taken and 8 if not taken, so: + * (0x14F51 * 18 + 14) cycles / 12000000 cycles per second = 0.12876 seconds + * + * Newer games force a reset using the following code (this from kof99): + * 009CDA 203C 0003 0D40 MOVE.L #0x30D40,D0 + * 009CE0 5380 SUBQ.L #1,D0 + * 009CE2 64FC BCC.S *-0x2 [0x9CE0] + * Note however that there is a valid code path after this loop, and indeed + * there are many games that employ the watchdog as a protection device, by + * writing a value to SRAM (usually to 0xD00100) when the watchdog doesn't + * trigger a reset. Later on, the presence of this value can trigger various + * actions, usually a text screen indicating the game is an unlicensed copy. + * + * On AES hardware, reading unmapped memory returns the last value that was on + * the data-bus. + * + * Raster interrupts can be generated by specifying an offset, in pixels. + * This offset can be added to the following (depending on a control register): + * - the position of the electron beam, when setting the offset + * - the position of the electron beam, when interrupt 2 is triggered + * - the position of the electron beam, when interrupt 4 (vblank) is triggered + * + * Note that the offset is *always* relative; when setting the offset from the + * vblank (scanline 248), to trigger an interrupt at scanline 24, you would + * point the offset to 24 scanlines past the screen end at line 264, and set it + * to 15360 (40 scanlines * 384 pixels per scanline). + * + */ + +#include "neogeo.h" +#include "cd_interface.h" +#include "burn_ym2610.h" +#include "bitswap.h" +#include "neocdlist.h" + +// #undef USE_SPEEDHACKS + +// #define LOG_IRQ +// #define LOG_DRAW + +#define NEO_HREFRESH (15625.0) +#define NEO_VREFRESH (NEO_HREFRESH / 264.0) +// #define NEO_VREFRESH (NEO_HREFRESH / 312.0) + +// If defined, enable emulation of the watchdog timer (timing doesn't match real hardware 100%) +#define EMULATE_WATCHDOG + +// If defined, reset the Z80 when switching between the Z80 BIOS/cartridge ROM +//#define Z80_RESET_ON_BANKSWITCH + +// If defined, adjust the Z80 speed along with the 68000 when overclocking +#define Z80_SPEED_ADJUST + +// If defined, use kludges to better align raster effects in some games (e.g. mosyougi) +#define RASTER_KLUDGE + +// If defined, use the bAllowRasters variable to enable/disable raster effects +// #define RASTERS_OPTIONAL + +#if defined Z80_SPEED_ADJUST + static INT32 nZ80Clockspeed; +#else + static const INT32 nZ80Clockspeed = 4000000; +#endif + +#if defined RASTER_KLUDGE + static UINT16 nScanlineOffset; +#else + // 0xF8 is correct as verified on MVS hardware + static const UINT16 nScanlineOffset = 0xF8; +#endif + +#if defined RASTERS_OPTIONAL + static bool bAllowRasters = false; +#endif + +// The number of cartridge slots on the emulated MVS hardware (can be 1, 2, 4, or 6) +UINT8 nNeoNumSlots = 1; + +UINT32 nNeoActiveSlot = 0; + +UINT8 NeoButton1[32] = { 0, }; +UINT8 NeoButton2[8] = { 0, }; +UINT8 NeoButton3[8] = { 0, }; +UINT8 NeoButton4[8] = { 0, }; +UINT8 NeoJoy1[8] = { 0, }; +UINT8 NeoJoy2[8] = { 0, }; +UINT8 NeoJoy3[8] = { 0, }; +UINT8 NeoJoy4[8] = { 0, }; +UINT16 NeoAxis[2] = { 0, }; +UINT8 NeoInput[32] = { 0, }; +UINT8 NeoDiag[2] = { 0, }; +UINT8 NeoDebugDip[2] = { 0, }; +UINT8 NeoReset = 0, NeoSystem = 0; + +static UINT8 OldDebugDip[2]; + +// Which 68K BIOS to use +INT32 nBIOS; + +// Joyports are multiplexed +static INT32 nJoyport0[8] = { 0, }; +static INT32 nJoyport1[8] = { 0, }; + +// Ports always mirror the joystick, except when other controllers are hooked up: +// +// input no. corresponds to +// +// Joyport0: 0x00 : trackball X in irrmaze / p1 paddle in popbounc +// 0x01 : trackball Y in irrmaze +// 0x09 : mahjong controller +// 0x12 : mahjong controller (BIOS controls) +// 0x1B : Always has p1 joystick & buttons +// 0x24 : mahjong controller +// 0x20 & 0x21 : selected by irrmaze instead of 0x00 & 0x01 when you lose a life +// (activates air-jets) +// Joyport1: 0x00 : p2 paddle in popbounc +// 0x1B : Always has p2 joystick & buttons + +// ---------------------------------------------------------------------------- +// Variables that need to be included in savestates + +static INT32 nCyclesExtra[2]; +static INT32 nPrevBurnCPUSpeedAdjust; + +bool bNeoEnableGraphics; + +UINT32 nNeo68KROMBank; + +static INT32 nIRQAcknowledge; + +static INT32 nIRQControl; +static bool bSRAMWritable; + +static bool b68KBoardROMBankedIn; +static bool bZ80BoardROMBankedIn; +static INT32 nZ80Bank0, nZ80Bank1, nZ80Bank2, nZ80Bank3; + +static UINT8* NeoGraphicsRAMBank; +static UINT16 NeoGraphicsRAMPointer; +static INT32 nNeoGraphicsModulo; + +INT32 nNeoSpriteFrame; + +static INT32 nSpriteFrameSpeed; +static INT32 nSpriteFrameTimer; + +static UINT8 nSoundLatch; +static UINT8 nSoundReply; +static UINT32 nSoundStatus; + +#if 1 && defined USE_SPEEDHACKS +static INT32 nSoundPrevReply; +#endif + +static INT32 nInputSelect; +static UINT8* NeoInputBank; +static UINT32 nAnalogAxis[2]; + +static UINT32 nuPD4990ATicks; + +static UINT32 nIRQOffset; + +#define NO_IRQ_PENDING (0x7FFFFFFF) +static INT32 nIRQCycles; + +#if defined EMULATE_WATCHDOG +static INT32 nNeoWatchdog; +#endif + +bool bDisableNeoWatchdog = false; + +static INT32 nNeoCDIRQVector; +static INT32 nNeoCDIRQVectorAck; + +static INT32 nNeoCDZ80ProgWriteWordCancelHack = 0; + +INT32 nNeoScreenWidth; + +UINT8 nLEDLatch, nLED[3]; + +// ---------------------------------------------------------------------------- + +static bool bMemoryCardInserted, bMemoryCardWritable; + +NEO_CALLBACK NeoCallback[MAX_SLOT] = { { NULL, NULL, NULL, NULL, NULL }, }; +NEO_CALLBACK* NeoCallbackActive = &NeoCallback[0]; + +static INT32 nCyclesTotal[2]; +static INT32 nCyclesSegment; +static INT32 nCyclesVBlank; +static INT32 nCycles68KSync; + +UINT8 *Neo68KROM[MAX_SLOT] = { NULL, }, *Neo68KROMActive = NULL; +UINT8 *NeoVector[MAX_SLOT] = { NULL, }, *NeoVectorActive = NULL; +UINT8 *Neo68KFix[MAX_SLOT] = { NULL, }; +UINT8 *NeoZ80ROM[MAX_SLOT] = { NULL, }, *NeoZ80ROMActive = NULL; + +static UINT8 *AllRAM = NULL, *RAMEnd = NULL, *AllROM = NULL, *ROMEnd = NULL; + +UINT8 *NeoSpriteRAM, *NeoTextRAM; + +UINT8 *Neo68KBIOS, *NeoZ80BIOS; +static UINT8 *Neo68KRAM, *NeoZ80RAM, *NeoNVRAM, *NeoNVRAM2, *NeoMemoryCard; + +static UINT32 nSpriteSize[MAX_SLOT] = { 0, }; +static UINT32 nCodeSize[MAX_SLOT] = { 0, }; + +UINT8* NeoGraphicsRAM; + +UINT8* YM2610ADPCMAROM[MAX_SLOT] = { NULL, }; +UINT8* YM2610ADPCMBROM[MAX_SLOT] = { NULL, }; + +static INT32 nYM2610ADPCMASize[MAX_SLOT] = { 0, }; +static INT32 nYM2610ADPCMBSize[MAX_SLOT] = { 0, }; + +static bool bIRQEnabled; +static INT32 nVBLankIRQ; +static INT32 nScanlineIRQ; + +static bool bRenderImage; + +static bool bRenderLineByLine; + +static bool bForcePartialRender; +static bool bForceUpdateOnStatusRead; + +static INT32 nNeoControlConfig; + +static INT32 nNeoSystemType; +static bool bZ80BIOS; + +static INT32 /*nNeoCDCyclesIRQ = 0,*/ nNeoCDCyclesIRQPeriod = 0; + +static bool bUseAsm68KCoreOldValue = false; + +bool IsNeoGeoCD() { + return (nNeoSystemType & NEO_SYS_CD); +} + +// This function is called once to determine how much memory is needed (RAMEnd-(UINT8 *)0), +// then a second time after the memory is allocated to set up all the pointers. +static INT32 RAMIndex() +{ + UINT8* Next = AllRAM; + + NeoPalSrc[0] = Next; Next += 0x002000; // Palette RAM Bank 0 + NeoPalSrc[1] = Next; Next += 0x002000; // Palette RAM Bank 1 + + NeoGraphicsRAM = Next; Next += 0x020000; // Graphics controller RAM (2 64KB banks) + + if (nNeoSystemType & NEO_SYS_CART) { + Neo68KRAM = Next; Next += 0x010000; // 68K work RAM + NeoZ80RAM = Next; Next += 0x000800; // Z80 RAM + + NeoNVRAM = Next; Next += 0x010000; // Battery backed SRAM + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_GAMBLING) { + NeoNVRAM2 = Next; Next += 0x002000; // Extra SRAM for vliner/jockeygp + } + NeoMemoryCard = Next; Next += 0x020000; // Memory card + + if (nNeoSystemType & NEO_SYS_CD) { + NeoSpriteRAM = Next; Next += nSpriteSize[0]; + NeoTextRAM = Next; Next += nNeoTextROMSize[0]; + } + + RAMEnd = Next; + + return 0; +} + +// This function is called once to determine how much memory is needed (ROMEnd-(UINT8*)0), +// then a second time after the memory is allocated to set up all the pointers. +static INT32 ROMIndex() +{ + UINT8* Next = AllROM; + + NeoZ80BIOS = Next; Next += 0x020000; // Z80 boardROM + NeoZoomROM = Next; Next += 0x020000; // Y Zoom table + NeoTextROMBIOS = Next; Next += 0x020000; + + if (nNeoSystemType & NEO_SYS_CART) { + Neo68KBIOS = Next; Next += 0x080000; // 68K boardROM + } else { + Neo68KROM[0] = Next; Next += nCodeSize[0]; + NeoVector[0] = Next; Next += 0x000400; // Copy of 68K cartridge ROM with boardROM vector table + Neo68KBIOS = Next; Next += 0x080000; // 68K boardROM + + NeoZ80ROM[0] = Next; Next += 0x080000; + NeoSpriteROM[0] = Next; Next += nSpriteSize[0]; + NeoTextROM[0] = Next; Next += nNeoTextROMSize[0]; + YM2610ADPCMAROM[0] = Next; Next += nYM2610ADPCMASize[0]; + YM2610ADPCMBROM[0] = Next; Next += nYM2610ADPCMBSize[0]; + } + + ROMEnd = Next; + + return 0; +} + +// ----------------------------------------------------------------------------- +// ROM loading + +static void NeoSetSystemType() +{ + // Neo CD + if (nNeoSystemType & NEO_SYS_CD) { + return; + } + // Dedicated JAMMA PCB + if (nNeoSystemType & NEO_SYS_PCB) { + return; + } + + // See if we're emulating MVS or AES hardware + if (nBIOS == -1 || nBIOS == 10 || nBIOS == 11 || nBIOS == 12 || ((NeoSystem & 0x74) == 0x20)) { + nNeoSystemType = NEO_SYS_CART | NEO_SYS_AES; + return; + } + + nNeoSystemType = NEO_SYS_CART | NEO_SYS_MVS; +} + +static INT32 NeoLoad68KBIOS(INT32 nNewBIOS) +{ + // Neo CD + if (nNeoSystemType & NEO_SYS_CD) { + return 0; + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_TRACKBALL) { + nNewBIOS = 25; + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) { + nNewBIOS = 26; + } + + // The most recent MVS models doesn't have a Z80 BIOS + bZ80BIOS = (nNewBIOS != 0) ? true : false; + + // Check if we need to load a new BIOS + if (nNewBIOS == nBIOS) { + return 0; + } + + nBIOS = nNewBIOS; + + // Load the BIOS ROMs + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { + // Load the BIOS ROMs + BurnLoadRom(Neo68KBIOS, 0x00000 + nBIOS, 1); + } else { + if (nBIOS >= 0) { + BurnLoadRom(Neo68KBIOS, 0x00080 + nBIOS, 1); + } else { + BurnLoadRom(Neo68KBIOS, 0x00080 + 0, 1); + } + } + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "kf2k3pcb") || !strcmp(BurnDrvGetTextA(DRV_NAME), "k2k3pcbd")) kf2k3pcb_bios_decode(); + + NeoUpdateVector(); + + return 0; +} + +static INT32 FindType(const char* pName) +{ + INT32 i = 0; + + while (pName[i] && pName[i] != '-' && pName[i] != '_') { + i++; + } + + return i + 1; +} + +static INT32 FindROMs(UINT32 nType, INT32* pOffset, INT32* pNum) +{ + INT32 nOffset = -1; + INT32 nNum = -1; + + struct BurnRomInfo ri; + ri.nType = 0; + ri.nLen = 0; + + // Invalidate indices + if (pOffset) { + *pOffset = -1; + } + if (pNum) { + *pNum = 0; + } + + do { + if (BurnDrvGetRomInfo(&ri, ++nOffset)) { + return 1; + } + } while ((ri.nType & 7) != nType && nOffset < 0x80); + + if (nOffset >= 0x7F) { + return 1; + } + + do { + if (BurnDrvGetRomInfo(&ri, nOffset + ++nNum)) { + break; + } + } while ((ri.nType & 7) == nType && nOffset < 0x80); + + if (pOffset) { + *pOffset = nOffset; + } + if (pNum) { + *pNum = nNum >= 0 ? nNum : 0; + } + + return 0; +} + +static INT32 LoadRoms() +{ + NeoGameInfo info; + NeoGameInfo* pInfo = &info; + + { + struct BurnRomInfo ri; + + ri.nType = 0; + ri.nLen = 0; + + // Find 'P' ROMs + FindROMs(1, &pInfo->nCodeOffset, &pInfo->nCodeNum); + // Find 'S' ROM + FindROMs(2, &pInfo->nTextOffset, NULL); + // Find 'C' ROMs + FindROMs(3, &pInfo->nSpriteOffset, &pInfo->nSpriteNum); + // Find 'M' ROM + FindROMs(4, &pInfo->nSoundOffset, NULL); + // Find 'V' ROMs + FindROMs(5, &pInfo->nADPCMOffset, &pInfo->nADPCMANum); + FindROMs(6, NULL, &pInfo->nADPCMBNum); + + if (pInfo->nADPCMBNum < 0) { + pInfo->nADPCMBNum = 0; + } + +#if 1 && defined FBA_DEBUG + bprintf(PRINT_IMPORTANT, _T(" - P: %i (%i);"), pInfo->nCodeOffset, pInfo->nCodeNum); + if (pInfo->nTextOffset >= 0) { + bprintf(PRINT_IMPORTANT, _T(" S: %i;"), pInfo->nTextOffset); + } else { + bprintf(PRINT_IMPORTANT, _T(" S: unused;")); + } + bprintf(PRINT_IMPORTANT, _T(" C: %i (%i); M: %i"), pInfo->nSpriteOffset, pInfo->nSpriteNum, pInfo->nSoundOffset); + if (pInfo->nADPCMOffset >= 0) { + bprintf(PRINT_IMPORTANT, _T(" V: %i (%i, %i)"), pInfo->nADPCMOffset, pInfo->nADPCMANum, pInfo->nADPCMBNum); + } else { + bprintf(PRINT_IMPORTANT, _T(" V: unused")); + } + bprintf(PRINT_IMPORTANT,_T("\n")); +#endif + + nCodeSize[nNeoActiveSlot] = 0; + for (INT32 i = 0; i < pInfo->nCodeNum; i++) { + BurnDrvGetRomInfo(&ri, pInfo->nCodeOffset + i); + nCodeSize[nNeoActiveSlot] += ri.nLen; + } + nCodeSize[nNeoActiveSlot] = (nCodeSize[nNeoActiveSlot] + 0x0FFFFF) & ~0x0FFFFF; + + nSpriteSize[nNeoActiveSlot] = 0; + + if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPC) { + BurnDrvGetRomInfo(&ri, pInfo->nSpriteOffset); + // for viewpoin, aof, ssideki + if (pInfo->nSpriteNum == 2) { + nSpriteSize[nNeoActiveSlot] = 0x600000; + } + // for kotm2 + if (pInfo->nSpriteNum == 4) { + BurnDrvGetRomInfo(&ri, pInfo->nSpriteOffset + 2); + if (ri.nLen == 0x080000) { + nSpriteSize[nNeoActiveSlot] = 0x600000; + } + } + } + + if (nSpriteSize[nNeoActiveSlot] == 0) { + + // Compute correct size taking gaps into account (kizuna) + for (INT32 i = 0; i < pInfo->nSpriteNum - 2; i += 2) { + BurnDrvGetRomInfo(&ri, pInfo->nSpriteOffset + i); + if (ri.nLen > nSpriteSize[nNeoActiveSlot]) { + nSpriteSize[nNeoActiveSlot] = ri.nLen; + } + } + nSpriteSize[nNeoActiveSlot] *= pInfo->nSpriteNum - 2; + + // The final 2 ROMs may have a different size + BurnDrvGetRomInfo(&ri, pInfo->nSpriteOffset + pInfo->nSpriteNum - 2); + nSpriteSize[nNeoActiveSlot] += ri.nLen * 2; + } + + { + UINT32 nSize = nSpriteSize[nNeoActiveSlot]; +// if (nSize > 0x4000000) { +// nSize = 0x4000000; +// } + + for (nNeoTileMask[nNeoActiveSlot] = 1; nNeoTileMask[nNeoActiveSlot] < nSize; nNeoTileMask[nNeoActiveSlot] <<= 1) { } + nNeoTileMask[nNeoActiveSlot] = (nNeoTileMask[nNeoActiveSlot] >> 7) - 1; + nNeoMaxTile[nNeoActiveSlot] = nSize >> 7; + } + + if (nNeoTextROMSize[nNeoActiveSlot] == 0) { + if (pInfo->nTextOffset > 0) { + BurnDrvGetRomInfo(&ri, pInfo->nTextOffset); + nNeoTextROMSize[nNeoActiveSlot] = ri.nLen; + } else { + nNeoTextROMSize[nNeoActiveSlot] = 0x080000; + } + } + + nYM2610ADPCMASize[nNeoActiveSlot] = nYM2610ADPCMBSize[nNeoActiveSlot] = 0; + if (pInfo->nADPCMOffset >= 0) { + char* pName; + BurnDrvGetRomInfo(&ri, pInfo->nADPCMOffset); + BurnDrvGetRomName(&pName, pInfo->nADPCMOffset, 0); + nYM2610ADPCMASize[nNeoActiveSlot] = ri.nLen; + + if (pInfo->nADPCMANum > 1) { + BurnDrvGetRomInfo(&ri, pInfo->nADPCMOffset + pInfo->nADPCMANum - 1); + BurnDrvGetRomName(&pName, pInfo->nADPCMOffset + pInfo->nADPCMANum - 1, 0); + if (pInfo->nADPCMBNum == 0) { + nYM2610ADPCMASize[nNeoActiveSlot] *= pName[FindType(pName) + 1] - '1'; + } else { + nYM2610ADPCMASize[nNeoActiveSlot] *= pName[FindType(pName) + 2] - '1'; + } + nYM2610ADPCMASize[nNeoActiveSlot] += ri.nLen; + } + + if (pInfo->nADPCMBNum) { + BurnDrvGetRomInfo(&ri, pInfo->nADPCMOffset + pInfo->nADPCMANum); + nYM2610ADPCMBSize[nNeoActiveSlot] = ri.nLen * (pInfo->nADPCMBNum - 1); + BurnDrvGetRomInfo(&ri, pInfo->nADPCMOffset + pInfo->nADPCMANum + pInfo->nADPCMBNum - 1); + nYM2610ADPCMBSize[nNeoActiveSlot] += ri.nLen; + } + } + } + + if (!strcmp("kof2k4se", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x800000; + if (!strcmp("kf2k4pls", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x800000; + if (!strcmp("svcboot", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x400000; + if (!strcmp("svcplus", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x400000; + if (!strcmp("svcplusa", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x400000; + if (!strcmp("svcsplus", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] += 0x400000; + if (!strcmp("pbobblenb", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] = 0x380000; + if (!strcmp("alpham2p", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] = 0x200000; + if (!strcmp("burningfp", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] = 0x180000; + if (!strcmp("kotm2p", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] = 0x300000; + if (!strcmp("sbp", BurnDrvGetTextA(DRV_NAME))) nYM2610ADPCMASize[nNeoActiveSlot] = 0x800000; + +// bprintf(PRINT_NORMAL, _T("%x\n"), nYM2610ADPCMASize[nNeoActiveSlot]); + + // The kof2k3 PCB has 96MB of graphics ROM, however the last 16MB are unused, and the protection/decryption hardware does not see them +// if (nSpriteSize[nNeoActiveSlot] > 0x4000000) { +// nSpriteSize[nNeoActiveSlot] = 0x5000000; +// } + + NeoSpriteROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(nSpriteSize[nNeoActiveSlot] < (nNeoTileMask[nNeoActiveSlot] << 7) ? ((nNeoTileMask[nNeoActiveSlot] + 1) << 7) : nSpriteSize[nNeoActiveSlot]); + if (NeoSpriteROM[nNeoActiveSlot] == NULL) { + return 1; + } + +/* if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) { + BurnSetProgressRange(1.0 / ((double)nSpriteSize[nNeoActiveSlot] / 0x800000 / 12)); + } else if (BurnDrvGetHardwareCode() & (HARDWARE_SNK_CMC42 | HARDWARE_SNK_CMC50)) { + BurnSetProgressRange(1.0 / ((double)nSpriteSize[nNeoActiveSlot] / 0x800000 / 9)); + } else { + BurnSetProgressRange(1.0 / ((double)nSpriteSize[nNeoActiveSlot] / 0x800000 / 3)); + }*/ + + if (BurnDrvGetHardwareCode() & (HARDWARE_SNK_CMC42 | HARDWARE_SNK_CMC50)) { + double fRange = (double)pInfo->nSpriteNum / 4.0; + if (fRange < 1.5) { + fRange = 1.5; + } + BurnSetProgressRange(1.0 / fRange); + } else { + BurnSetProgressRange(1.0 / pInfo->nSpriteNum); + } + + // Load sprite data + NeoLoadSprites(pInfo->nSpriteOffset, pInfo->nSpriteNum, NeoSpriteROM[nNeoActiveSlot], nSpriteSize[nNeoActiveSlot]); + + NeoTextROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(nNeoTextROMSize[nNeoActiveSlot]); + if (NeoTextROM[nNeoActiveSlot] == NULL) { + return 1; + } + + // Load Text layer tiledata + { + if (pInfo->nTextOffset != -1) { + // Load S ROM data + BurnLoadRom(NeoTextROM[nNeoActiveSlot], pInfo->nTextOffset, 1); + } else { + // Extract data from the end of C ROMS + BurnUpdateProgress(0.0, _T("Decrypting text layer graphics...")/*, BST_DECRYPT_TXT*/, 0); + NeoCMCExtractSData(NeoSpriteROM[nNeoActiveSlot], NeoTextROM[nNeoActiveSlot], nSpriteSize[nNeoActiveSlot], nNeoTextROMSize[nNeoActiveSlot]); + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) { + for (INT32 i = 0; i < nNeoTextROMSize[nNeoActiveSlot]; i++) { + NeoTextROM[nNeoActiveSlot][i] = BITSWAP08(NeoTextROM[nNeoActiveSlot][i] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3); + } + } + } + } + + Neo68KROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(nCodeSize[nNeoActiveSlot]); // 68K cartridge ROM + if (Neo68KROM[nNeoActiveSlot] == NULL) { + return 1; + } + Neo68KROMActive = Neo68KROM[nNeoActiveSlot]; + Neo68KFix[nNeoActiveSlot] = Neo68KROM[nNeoActiveSlot]; + + // Load the roms into memory + if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SMA_PROTECTION) { + BurnLoadRom(Neo68KROMActive + 0x0C0000, 0, 1); + NeoLoadCode(pInfo->nCodeOffset + 1, pInfo->nCodeNum - 1, Neo68KROMActive + 0x100000); + } else { + NeoLoadCode(pInfo->nCodeOffset, pInfo->nCodeNum, Neo68KROMActive); + } + + NeoZ80ROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(0x080000); // Z80 cartridge ROM + if (NeoZ80ROM[nNeoActiveSlot] == NULL) { + return 1; + } + NeoZ80ROMActive = NeoZ80ROM[nNeoActiveSlot]; + + BurnLoadRom(NeoZ80ROMActive, pInfo->nSoundOffset, 1); + if (BurnDrvGetHardwareCode() & HARDWARE_SNK_ENCRYPTED_M1) { + neogeo_cmc50_m1_decrypt(); + } + + if (NeoCallbackActive && NeoCallbackActive->pInitialise) { + NeoCallbackActive->pInitialise(); + } + + // Decode text data + BurnUpdateProgress(0.0, _T("Preprocessing text layer graphics...")/*, BST_PROCESS_TXT*/, 0); + NeoDecodeText(0, nNeoTextROMSize[nNeoActiveSlot], NeoTextROM[nNeoActiveSlot], NeoTextROM[nNeoActiveSlot]); + + // Decode sprite data + NeoDecodeSprites(NeoSpriteROM[nNeoActiveSlot], nSpriteSize[nNeoActiveSlot]); + + if (pInfo->nADPCMANum) { + char* pName; + struct BurnRomInfo ri; + UINT8* pADPCMData; + + YM2610ADPCMAROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(nYM2610ADPCMASize[nNeoActiveSlot]); + if (YM2610ADPCMAROM[nNeoActiveSlot] == NULL) { + return 1; + } + + ri.nType = 0; + ri.nLen = 0; + BurnDrvGetRomInfo(&ri, pInfo->nADPCMOffset); + BurnDrvGetRomName(&pName, pInfo->nADPCMOffset, 0); + + pADPCMData = YM2610ADPCMAROM[nNeoActiveSlot]; + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "sbp") != 0) { // not for sbp! + // pbobblen needs this (V ROMs are v3 & v4), note aof/wh1/wh1h/kotm2 (V ROMs are v2 & v4) + if (pInfo->nADPCMANum == 2 && pName[FindType(pName) + 1] == '3') { + pADPCMData += ri.nLen * 2; + } + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "pbobblenb")) { + pADPCMData = YM2610ADPCMAROM[nNeoActiveSlot] + 0x200000; + } + + NeoLoadADPCM(pInfo->nADPCMOffset, pInfo->nADPCMANum, pADPCMData); + + if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPV) { + for (INT32 i = 0; i < 0x00200000; i++) { + UINT8 n = YM2610ADPCMAROM[nNeoActiveSlot][i]; + YM2610ADPCMAROM[nNeoActiveSlot][i] = YM2610ADPCMAROM[nNeoActiveSlot][0x00200000 + i]; + YM2610ADPCMAROM[nNeoActiveSlot][0x00200000 + i] = n; + } + } + } + + if (pInfo->nADPCMBNum) { + YM2610ADPCMBROM[nNeoActiveSlot] = (UINT8*)BurnMalloc(nYM2610ADPCMBSize[nNeoActiveSlot]); + if (YM2610ADPCMBROM[nNeoActiveSlot] == NULL) { + return 1; + } + + NeoLoadADPCM(pInfo->nADPCMOffset + pInfo->nADPCMANum, pInfo->nADPCMBNum, YM2610ADPCMBROM[nNeoActiveSlot]); + } else { + YM2610ADPCMBROM[nNeoActiveSlot] = YM2610ADPCMAROM[nNeoActiveSlot]; + nYM2610ADPCMBSize[nNeoActiveSlot] = nYM2610ADPCMASize[nNeoActiveSlot]; + } + + return 0; +} + +// ---------------------------------------------------------------------------- +// Bankswitch / memory map functions + +static void NeoZ80SetBank0(INT32 nBank) +{ + nBank &= 0x0F; + if (nBank != nZ80Bank0) { + UINT8* nStartAddress = NeoZ80ROMActive + (nBank << 14); + ZetMapArea(0x8000, 0xBFFF, 0, nStartAddress); + ZetMapArea(0x8000, 0xBFFF, 2, nStartAddress); + + nZ80Bank0 = nBank; + } + + return; +} + +static void NeoZ80SetBank1(INT32 nBank) +{ + nBank &= 0x1F; + if (nBank != nZ80Bank1) { + UINT8* nStartAddress = NeoZ80ROMActive + (nBank << 13); + ZetMapArea(0xC000, 0xDFFF, 0, nStartAddress); + ZetMapArea(0xC000, 0xDFFF, 2, nStartAddress); + + nZ80Bank1 = nBank; + } + + return; +} + +static void NeoZ80SetBank2(INT32 nBank) +{ + nBank &= 0x3F; + if (nBank != nZ80Bank2) { + UINT8* nStartAddress = NeoZ80ROMActive + (nBank << 12); + ZetMapArea(0xE000, 0xEFFF, 0, nStartAddress); + ZetMapArea(0xE000, 0xEFFF, 2, nStartAddress); + + nZ80Bank2 = nBank; + } + + return; +} + +static void NeoZ80SetBank3(INT32 nBank) +{ + nBank &= 0x7F; + if (nBank != nZ80Bank3) { + UINT8* nStartAddress = NeoZ80ROMActive + (nBank << 11); + ZetMapArea(0xF000, 0xF7FF, 0, nStartAddress); + ZetMapArea(0xF000, 0xF7FF, 2, nStartAddress); + + nZ80Bank3 = nBank; + } + + return; +} + +static void NeoZ80MapROM(bool bMapBoardROM) +{ + if (nNeoSystemType & NEO_SYS_CART) { + if (bMapBoardROM && bZ80BIOS) { + // Bank in the Z80 boardROM + ZetMapArea(0x0000, 0x7FFF, 0, NeoZ80BIOS); + ZetMapArea(0x0000, 0x7FFF, 2, NeoZ80BIOS); + } else { + // Bank in the Z80 cartridge ROM + ZetMapArea(0x0000, 0x7FFF, 0, NeoZ80ROMActive); + ZetMapArea(0x0000, 0x7FFF, 2, NeoZ80ROMActive); + } + } +} + +static void MapVectorTable(bool bMapBoardROM) +{ + if (!bMapBoardROM && Neo68KROMActive) { + SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x000000, 0x0003FF, SM_ROM); + } else { + SekMapMemory(NeoVectorActive, 0x000000, 0x0003FF, SM_ROM); + } +} + +inline static void MapPalette(INT32 nBank) +{ + if (nNeoPaletteBank != nBank) { + nNeoPaletteBank = nBank; + SekMapMemory(NeoPalSrc[nBank], 0x400000, 0x401FFF, SM_ROM); + + NeoSetPalette(); + } +} + +static void Bankswitch(UINT32 nBank) +{ + nBank = 0x100000 + ((nBank & 7) << 20); + if (nBank >= nCodeSize[nNeoActiveSlot]) { + nBank = 0x100000; + } + + if (nBank != nNeo68KROMBank) { +// bprintf(PRINT_NORMAL, "Bankswitched main ROM, new address is 0x%08X.\n", nBank); + nNeo68KROMBank = nBank; + SekMapMemory(Neo68KROMActive + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM); + } +} + +void NeoMapBank() +{ + SekMapMemory(Neo68KROMActive + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM); +} + +void NeoMap68KFix() +{ + if ((nNeoSystemType & NEO_SYS_CART) && (nCodeSize[nNeoActiveSlot] > 0x100000)) { + + SekMapMemory(Neo68KFix[nNeoActiveSlot] + 0x0400, 0x000400, 0x0FFFFF, SM_ROM); + + if (Neo68KROM[nNeoActiveSlot]) { + memcpy(NeoVector[nNeoActiveSlot] + 0x80, Neo68KFix[nNeoActiveSlot] + 0x80, 0x0380); + } + } + + MapVectorTable(b68KBoardROMBankedIn); +} + +void NeoUpdateVector() +{ + // Create copy of 68K with BIOS vector table + for (INT32 i = 0; i < MAX_SLOT; i++) { + if (NeoVector[i]) { + memcpy(NeoVector[i] + 0x00, Neo68KBIOS, 0x0080); + if (Neo68KROM[i]) { + memcpy(NeoVector[i] + 0x80, Neo68KFix[i] + 0x80, 0x0380); + } + } + } +} + +// ---------------------------------------------------------------------------- +// 68K bankswitch for most games without SMA/PVC protection + +void __fastcall neogeoWriteByteBankswitch(UINT32 sekAddress, UINT8 byteValue) +{ + if (sekAddress >= 0x2FFFF0) { + +// bprintf(PRINT_NORMAL, _T(" - Bankswitch: 0x%06X -> 0x%02X\n"), sekAddress, byteValue); + + Bankswitch(byteValue); + return; + } +} + +void __fastcall neogeoWriteWordBankswitch(UINT32 sekAddress, UINT16 wordValue) +{ + if (sekAddress >= 0x2FFFF0) { + +// bprintf(PRINT_NORMAL, _T(" - Bankswitch: 0x%06X -> 0x%04X\n"), sekAddress, wordValue); + + Bankswitch(wordValue); + return; + } +} + +// ---------------------------------------------------------------------------- +// CPU synchronisation + +static inline void neogeoSynchroniseZ80(INT32 nExtraCycles) +{ +#if defined Z80_SPEED_ADJUST + INT32 nCycles = SekTotalCycles() / 3 + nExtraCycles; +#else + INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]) + nExtraCycles; +#endif + + if (nCycles <= ZetTotalCycles()) { + return; + } + + nCycles68KSync = nCycles - nExtraCycles; + + BurnTimerUpdate(nCycles); +} + +// Callbacks for the FM chip + +static void neogeoFMIRQHandler(INT32, INT32 nStatus) +{ +// bprintf(PRINT_NORMAL, _T(" YM2610 IRQ status: 0x%02X (%6i cycles)\n"), nStatus, ZetTotalCycles()); + + if (nStatus & 1) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 neogeoSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / nZ80Clockspeed; +} + +static double neogeoGetTime() +{ + return (double)ZetTotalCycles() / nZ80Clockspeed; +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall neogeoReadByteGambling(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x280001: { + return 0xff - NeoInput[3]; + } + + case 0x2c0001: { + return 0x03; + } + } + +// bprintf(PRINT_NORMAL, _T("Read Byte 0x%08X.\n"), sekAddress); + + return 0xff; +} + +UINT16 __fastcall neogeoReadWordGambling(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x280000: { + return 0xff - NeoInput[3]; + } + + case 0x2c0000: { + return 0x0003; + } + } + +// bprintf(PRINT_NORMAL, _T("Read Word 0x%08X.\n"), sekAddress); + + return 0xffff; +} + +UINT8 __fastcall vliner_timing(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x320000: { + INT32 nReply = nSoundReply; + +#if 1 && defined USE_SPEEDHACKS + // nSoundStatus: &1 = sound latch read, &2 = response written + if (nSoundStatus != 3) { + neogeoSynchroniseZ80(0x0100); + } +#endif + + if (nSoundStatus & 1) { +// bprintf(PRINT_NORMAL, _T(" - Sound reply read (0x%02X).\n"), nSoundReply); + + return nReply; + } else { +// bprintf(PRINT_NORMAL, _T(" - Sound reply read while sound pending (0x%02X).\n"), nSoundReply); + + return nReply & 0x7F; + } + } + + case 0x320001: { +// if (!bAESBIOS) { + if (nBIOS != 10 && nBIOS != 11 && nBIOS != 12) { + UINT8 nuPD4990AOutput = uPD4990ARead(SekTotalCycles() - nuPD4990ATicks); + nuPD4990ATicks = SekTotalCycles(); + return 0x3F | (nuPD4990AOutput << 6); + } + + return (0x3f) & 0xE7; + } + } + +// bprintf(PRINT_NORMAL, _T("Read Byte 0x%08X.\n"), sekAddress); + return 0xff; +} + +// ----------------------------------------------------------------------------- + +static void NeoMapActiveCartridge() +{ + if (!(nNeoSystemType & NEO_SYS_CART)) { + nNeoActiveSlot = 0; + return; + } + + neogeoSynchroniseZ80(0); + + if (NeoCallbackActive && NeoCallbackActive->pRemoveHandlers) { + NeoCallbackActive->pRemoveHandlers(); + } + + NeoVectorActive = NeoVector[nNeoActiveSlot]; + + if (Neo68KROM[nNeoActiveSlot] == NULL) { + + // If an empty slot is selected, only the vector table is valid + + Neo68KROMActive = NULL; + + SekMapHandler(0, 0x000000, 0x0FFFFF, SM_RAM); + SekMapHandler(0, 0x200000, 0x2FFFFF, SM_RAM); + + b68KBoardROMBankedIn = true; + MapVectorTable(b68KBoardROMBankedIn); + + NeoCallbackActive = NULL; + + ZetSetBUSREQLine(1); + + NeoSetSpriteSlot(nNeoActiveSlot); + NeoSetTextSlot(nNeoActiveSlot); + + return; + } + + Neo68KROMActive = Neo68KROM[nNeoActiveSlot]; + NeoZ80ROMActive = NeoZ80ROM[nNeoActiveSlot]; + NeoCallbackActive = &NeoCallback[nNeoActiveSlot]; + + SekSetReadWordHandler(6, NULL); + SekSetWriteWordHandler(6, NULL); + SekSetReadByteHandler(6, NULL); + SekSetWriteByteHandler(6, NULL); + SekSetReadWordHandler(7, NULL); + SekSetWriteWordHandler(7, NULL); + SekSetReadByteHandler(7, NULL); + SekSetWriteByteHandler(7, NULL); + + SekMapHandler(0, 0x000000, 0x0FFFFF, SM_WRITE); + + if (nCodeSize[nNeoActiveSlot] <= 0x080000) { + SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x000000, 0x07FFFF, SM_ROM); + SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x080000, 0x0FFFFF, SM_ROM); + SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x200000, 0x27FFFF, SM_ROM); + SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x280000, 0x2FFFFF, SM_ROM); + } + + if (nCodeSize[nNeoActiveSlot] <= 0x100000) { + SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x000000, 0x0FFFFF, SM_ROM); + SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x200000, 0x2FFFFF, SM_ROM); + } + + if (nCodeSize[nNeoActiveSlot] > 0x100000) { + SekMapMemory(Neo68KFix[nNeoActiveSlot], 0x000000, 0x0FFFFF, SM_ROM); + + SekMapHandler(4, 0x200000, 0x2FFFFF, SM_WRITE); + + SekSetWriteWordHandler(4, neogeoWriteWordBankswitch); + SekSetWriteByteHandler(4, neogeoWriteByteBankswitch); + } + + if (NeoCallbackActive->pInstallHandlers) { + NeoCallbackActive->pInstallHandlers(); + } + + if (nCodeSize[nNeoActiveSlot] > 0x100000) { + nNeo68KROMBank = 0x100000; + + if (NeoCallbackActive->pBankswitch) { + NeoCallbackActive->pBankswitch(); + } else { + if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) { + NeoMapBank(); + } + } + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_GAMBLING) { + SekMapMemory(NeoNVRAM2, 0x200000, 0x201FFF, SM_RAM); // 68K RAM + + SekMapHandler(6, 0x202000, 0x2FFFFF, SM_READ); + SekSetReadByteHandler(6, neogeoReadByteGambling); + SekSetReadWordHandler(6, neogeoReadWordGambling); + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "vliner") || !strcmp(BurnDrvGetTextA(DRV_NAME), "vlinero")) { + SekMapHandler(7, 0x320000, 0x320001, SM_READ); + SekSetReadByteHandler(7, vliner_timing); + } + } + + if (NeoZ80ROMActive) { + ZetSetBUSREQLine(0); + + nZ80Bank0 = nZ80Bank1 = nZ80Bank2 = nZ80Bank3 = -1; + NeoZ80SetBank0(0x02); + NeoZ80SetBank1(0x06); + NeoZ80SetBank2(0x0E); + NeoZ80SetBank3(0x1E); + } else { + ZetSetBUSREQLine(1); + } + + MapVectorTable(b68KBoardROMBankedIn); + NeoZ80MapROM(bZ80BoardROMBankedIn); + + NeoSetSpriteSlot(nNeoActiveSlot); + NeoSetTextSlot(nNeoActiveSlot); + + // the text rendering code will get confused if we don't do this + memset(NeoGraphicsRAM + 0xEA00, 0, 0x0200); + + BurnYM2610MapADPCMROM(YM2610ADPCMAROM[nNeoActiveSlot], nYM2610ADPCMASize[nNeoActiveSlot], YM2610ADPCMBROM[nNeoActiveSlot], nYM2610ADPCMBSize[nNeoActiveSlot]); + + return; +} + +// ----------------------------------------------------------------------------- +// Savestate support + +INT32 NeoScan(INT32 nAction, INT32* pnMin) +{ + INT32 nOldBIOS = nBIOS; + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029713; + } + + // Make sure we have the correct value for nBIOS + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(nBIOS); + // Update the system type immediately + NeoSetSystemType(); + } + + if (nAction & ACB_MEMORY_ROM) { + + if (nNeoSystemType & NEO_SYS_CART) { + ba.Data = Neo68KBIOS; + ba.nLen = 0x80000;//(nNeoSystemType & NEO_SYS_PCB) ? 0x00080000 : 0x00020000; + ba.nAddress = 0; + ba.szName = "68K BIOS"; + BurnAcb(&ba); + + ba.Data = Neo68KROMActive; + ba.nLen = nCodeSize[nNeoActiveSlot]; + ba.nAddress = 0; + ba.szName = "68K ROM"; + BurnAcb(&ba); + + ba.Data = NeoZ80BIOS; + ba.nLen = 0x00020000; + ba.nAddress = 0; + ba.szName = "Z80 BIOS"; + BurnAcb(&ba); + + ba.Data = NeoZ80ROMActive; + ba.nLen = 0x00080000; + ba.nAddress = 0; + ba.szName = "Z80 ROM"; + BurnAcb(&ba); + + ba.Data = YM2610ADPCMAROM[nNeoActiveSlot]; + ba.nLen = nYM2610ADPCMASize[nNeoActiveSlot]; + ba.nAddress = 0; + ba.szName = "ADPCM ROM"; + BurnAcb(&ba); + + ba.Data = YM2610ADPCMBROM[nNeoActiveSlot]; + ba.nLen = nYM2610ADPCMBSize[nNeoActiveSlot]; + ba.nAddress = 0; + ba.szName = "Delta-T ROM"; + BurnAcb(&ba); + } else { + ba.Data = Neo68KBIOS; + ba.nLen = 0x00080000; + ba.nAddress = 0; + ba.szName = "68K BIOS"; + BurnAcb(&ba); + } + } + + if (nAction & ACB_MEMCARD) { + if ((nNeoSystemType & NEO_SYS_CART) && !(nNeoSystemType & NEO_SYS_PCB)) { // Scan memory card + + if (pnMin && (nAction & ACB_TYPEMASK) == ACB_MEMCARD) { // Return minimum compatible version + *pnMin = 0x029713; + } + + ba.Data = NeoMemoryCard; + ba.nLen = 0x020000; + ba.nAddress = 0; + ba.szName = "Memory card"; + + if ((nAction & ACB_TYPEMASK) == ACB_MEMCARD) { + if (nAction & ACB_WRITE) { + bMemoryCardInserted = true; + } + if (nAction & ACB_READ) { + bMemoryCardInserted = false; + + // If a card is inserted, determine the size + if (*((UINT16*)NeoMemoryCard) != 0x8000) { + INT32 nSize = (NeoMemoryCard[21] << 8) | NeoMemoryCard[23]; + if (nSize >= 0x1000) { + ba.nLen = nSize; + } + } + } + } + + BurnAcb(&ba); + } + } + + if ((nNeoSystemType & NEO_SYS_CD) && (nAction & ACB_NVRAM)) { // Scan non-volatile memory (built-in memory card) + + if (pnMin && (nAction & ACB_TYPEMASK) == ACB_NVRAM) { // Return minimum compatible version + *pnMin = 0x029713; + } + + ba.Data = NeoMemoryCard; + ba.nLen = 0x004000; + ba.nAddress = 0; + ba.szName = "Memory card"; + BurnAcb(&ba); + } + + if ((nNeoSystemType & NEO_SYS_MVS) && (nAction & ACB_NVRAM)) { // Scan non-volatile memory + + if (pnMin && (nAction & ACB_TYPEMASK) == ACB_NVRAM) { // Return minimum compatible version + *pnMin = 0x029713; + } + + ba.Data = NeoNVRAM; + ba.nLen = 0x00010000; + ba.nAddress = 0; + ba.szName = "NVRAM"; + BurnAcb(&ba); + } + + if (((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_GAMBLING) && (nAction & ACB_NVRAM)) { + ba.Data = NeoNVRAM2; + ba.nLen = 0x00002000; + ba.nAddress = 0; + ba.szName = "Extra NVRAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_MEMORY_RAM) { // Scan RAM + + if (nNeoSystemType & NEO_SYS_CART) { + ba.Data = Neo68KRAM; + ba.nLen = 0x00010000; + ba.nAddress = 0; + ba.szName = "68K RAM"; + BurnAcb(&ba); + + ba.Data = NeoZ80RAM; + ba.nLen = 0x00000800; + ba.nAddress = 0; + ba.szName = "Z80 RAM"; + BurnAcb(&ba); + } + + if (nNeoSystemType & NEO_SYS_CD) { + ba.Data = Neo68KROMActive; + ba.nLen = nCodeSize[0]; + ba.nAddress = 0; + ba.szName = "68K program RAM"; + BurnAcb(&ba); + + ba.Data = NeoZ80ROMActive; + ba.nLen = 0x00080000; + ba.nAddress = 0; + ba.szName = "Z80 program RAM"; + BurnAcb(&ba); + } + + ba.Data = NeoPalSrc[0]; + ba.nLen = 0x000002000; + ba.nAddress = 0; + ba.szName = "Palette 0"; + BurnAcb(&ba); + ba.Data = NeoPalSrc[1]; + ba.nLen = 0x000002000; + ba.nAddress = 0; + ba.szName = "Palette 1"; + BurnAcb(&ba); + + ba.Data = NeoGraphicsRAM; + ba.nLen = 0x00020000; + ba.nAddress = 0; + ba.szName = "Graphics RAM"; + BurnAcb(&ba); + + if (nNeoSystemType & NEO_SYS_CD) { + ba.Data = NeoSpriteRAM; + ba.nLen = nSpriteSize[0]; + ba.nAddress = 0; + ba.szName = "Sprite layer tile RAM"; + BurnAcb(&ba); + + ba.Data = NeoTextRAM; + ba.nLen = nNeoTextROMSize[0]; + ba.nAddress = 0; + ba.szName = "Text layer tile RAM"; + BurnAcb(&ba); + + ba.Data = YM2610ADPCMBROM[0]; + ba.nLen = nYM2610ADPCMBSize[0]; + ba.nAddress = 0; + ba.szName = "ADPCM sample RAM"; + BurnAcb(&ba); + } + + if (NeoCallbackActive && NeoCallbackActive->pScan) { + NeoCallbackActive->pScan(nAction, pnMin); + } + } + + if (nAction & ACB_DRIVER_DATA) { // Scan driver data + + SekScan(nAction); // Scan 68000 state + ZetScan(nAction); // Scan Z80 state + + BurnYM2610Scan(nAction, pnMin); + + if (nNeoSystemType & NEO_SYS_MVS) { + uPD4990AScan(nAction, pnMin); + } + + if (NeoCallbackActive && NeoCallbackActive->pScan) { + NeoCallbackActive->pScan(nAction, pnMin); + } + + SCAN_VAR(nCyclesExtra); + + SCAN_VAR(bNeoEnableGraphics); + SCAN_VAR(nIRQAcknowledge); + + SCAN_VAR(nIRQControl); SCAN_VAR(nIRQOffset); SCAN_VAR(nIRQCycles); + SCAN_VAR(bSRAMWritable); + +#if defined EMULATE_WATCHDOG + SCAN_VAR(nNeoWatchdog); +#endif + + SCAN_VAR(b68KBoardROMBankedIn); + if (nNeoSystemType & NEO_SYS_CART) { + SCAN_VAR(bBIOSTextROMEnabled); + SCAN_VAR(nZ80Bank0); SCAN_VAR(nZ80Bank1); SCAN_VAR(nZ80Bank2); SCAN_VAR(nZ80Bank3); + SCAN_VAR(nNeo68KROMBank); + } + + SCAN_OFF(NeoGraphicsRAMBank, NeoGraphicsRAM, nAction); + + SCAN_VAR(nNeoSpriteFrame); SCAN_VAR(nSpriteFrameSpeed); SCAN_VAR(nSpriteFrameTimer); + + SCAN_VAR(nNeoPaletteBank); + + SCAN_VAR(nSoundLatch); + SCAN_VAR(nSoundReply); + SCAN_VAR(nSoundStatus); + +#if 1 && defined USE_SPEEDHACKS + SCAN_VAR(nSoundPrevReply); +#endif + + SCAN_VAR(nInputSelect); + + SCAN_OFF(NeoInputBank, NeoInput, nAction); + + SCAN_VAR(nAnalogAxis); + + SCAN_VAR(nuPD4990ATicks); + + SCAN_OFF(Neo68KFix[nNeoActiveSlot], Neo68KROM[nNeoActiveSlot], nAction); + + if (nAction & ACB_WRITE) { + INT32 nNewBIOS = nBIOS; + INT32 nBank; + + SekOpen(0); + NeoMap68KFix(); + SekClose(); + + if (nNeoSystemType & NEO_SYS_CART) { + ZetOpen(0); + NeoZ80MapROM(bZ80BoardROMBankedIn); + + nBank = nZ80Bank0; nZ80Bank0 = -1; + NeoZ80SetBank0(nBank); + nBank = nZ80Bank1; nZ80Bank1 = -1; + NeoZ80SetBank1(nBank); + nBank = nZ80Bank2; nZ80Bank2 = -1; + NeoZ80SetBank2(nBank); + nBank = nZ80Bank3; nZ80Bank3 = -1; + NeoZ80SetBank3(nBank); + ZetClose(); + + if (NeoCallbackActive && NeoCallbackActive->pBankswitch) { + NeoCallbackActive->pBankswitch(); + } else { + if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) { + SekOpen(0); + SekMapMemory(Neo68KROMActive + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM); + SekClose(); + } + } + } + + nBank = nNeoPaletteBank; nNeoPaletteBank = -1; + SekOpen(0); + MapPalette(nBank); + SekClose(); + + NeoRecalcPalette = 1; + + if (nNeoSystemType & NEO_SYS_CART) { + nBIOS = nOldBIOS; + NeoLoad68KBIOS(nNewBIOS); + + NeoSetSystemType(); + } + + nPrevBurnCPUSpeedAdjust = -1; + + SCAN_VAR(nLEDLatch); + SCAN_VAR(nLED[3]); + +// BurnGameFeedback(sizeof(nLED), nLED); + } + } + + return 0; +} + +// ----------------------------------------------------------------------------- +// Z80 handlers + +UINT8 __fastcall neogeoZ80In(UINT16 nAddress) +{ + switch (nAddress & 0xFF) { + case 0x00: // Read sound command +// bprintf(PRINT_NORMAL, _T(" - Sound command received (0x%02X).\n"), nSoundLatch); + nSoundStatus = 1; +#if 1 && defined USE_SPEEDHACKS + nSoundPrevReply = -1; +#endif + return nSoundLatch; + + case 0x04: + return BurnYM2610Read(0); + case 0x05: + return BurnYM2610Read(1); + case 0x06: + return BurnYM2610Read(2); + + case 0x08: +// bprintf(PRINT_NORMAL, " - Z80 bank 3 -> 0x%02X\n", nAddress >> 8); + NeoZ80SetBank3(nAddress >> 8); + break; + case 0x09: +// bprintf(PRINT_NORMAL, " - Z80 bank 2 -> 0x%02X\n", nAddress >> 8); + NeoZ80SetBank2(nAddress >> 8); + break; + case 0x0A: +// bprintf(PRINT_NORMAL, " - Z80 bank 1 -> 0x%02X\n", nAddress >> 8); + NeoZ80SetBank1(nAddress >> 8); + break; + case 0x0B: +// bprintf(PRINT_NORMAL, " - Z80 bank 0 -> 0x%02X\n", nAddress >> 8); + NeoZ80SetBank0(nAddress >> 8); + break; + +// default: { +// bprintf(PRINT_NORMAL, _T)" - Z80 read port 0x%04X.\n"), nAddress); +// } + } + + return 0; +} + +UINT8 __fastcall neogeoZ80InCD(UINT16 nAddress) +{ + switch (nAddress & 0xFF) { + case 0x00: // Read sound command +// bprintf(PRINT_NORMAL, _T(" - Sound command received (0x%02X).\n"), nSoundLatch); + nSoundStatus = 1; +#if 1 && defined USE_SPEEDHACKS + nSoundPrevReply = -1; +#endif + return nSoundLatch; + + case 0x04: + return BurnYM2610Read(0); + case 0x05: + return BurnYM2610Read(1); + case 0x06: + return BurnYM2610Read(2); + + // banskswitch on MVS/AES + case 0x08: + case 0x09: + case 0x0A: + case 0x0B: + break; + + default: { +// bprintf(PRINT_NORMAL, _T(" - Z80 read port 0x%04X.\n"), nAddress); + } + } + + return 0; +} + +void __fastcall neogeoZ80Out(UINT16 nAddress, UINT8 nValue) +{ + switch (nAddress & 0x0FF) { + case 0x00: +// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x00 -> 0x%02X.\n"), nValue); + break; + case 0x04: + case 0x05: + case 0x06: + case 0x07: + BurnYM2610Write(nAddress & 3, nValue); + break; + + case 0x0C: // Write reply to sound commands +// bprintf(PRINT_NORMAL, _T(" - Sound reply sent (0x%02X).\n"), nValue); + nSoundReply = nValue; + +#if 1 && defined USE_SPEEDHACKS + if (nSoundPrevReply != nValue) { + nSoundPrevReply = nValue; + + // s1945p replies a 0x00, then an 0xFF; + // the 68K loops until it has read both + if (nSoundReply == 0) { + nSoundStatus &= ~2; + } else { + nSoundStatus |= 2; + } + } else { + nSoundStatus |= 2; + } + + if (ZetTotalCycles() > nCycles68KSync) { + +// bprintf(PRINT_NORMAL, _T(" %i\n"), ZetTotalCycles()); + BurnTimerUpdateEnd(); +// bprintf(PRINT_NORMAL, _T(" %i - %i\n"), ZetTotalCycles(), nCycles68KSync); + } +#endif + + break; + + case 0x80: + bprintf(PRINT_ERROR, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue); + break; + + default: { +// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue); + } + } +} + +// ----------------------------------------------------------------------------- +// 68K handlers + +INT32 __fastcall NeoCDIRQCallback(INT32 /* nIRQ */) +{ +// bprintf(PRINT_NORMAL, _T(" - IRQ Callback %i %2X.\n"), nIRQ, nNeoCDIRQVector); + if (nNeoCDIRQVectorAck) { + nNeoCDIRQVectorAck = 0; + return nNeoCDIRQVector; + } + return M68K_INT_ACK_AUTOVECTOR; +} + +static inline INT32 NeoConvertIRQPosition(INT32 nOffset) +{ + UINT64 nNewPosition = ((UINT64)nOffset * nBurnCPUSpeedAdjust) >> 7; + + return (nNewPosition < NO_IRQ_PENDING) ? nNewPosition : NO_IRQ_PENDING; +} + +static inline void NeoIRQUpdate(UINT16 wordValue) +{ + nIRQAcknowledge |= (wordValue & 7); + +// bprintf(PRINT_NORMAL, _T(" - IRQ Ack -> %02X (at line %3i).\n"), nIRQAcknowledge, SekCurrentScanline()); + + if ((nIRQAcknowledge & 7) == 7) { + SekSetIRQLine(7, SEK_IRQSTATUS_NONE); + } else { + if ((nIRQAcknowledge & 1) == 0) { + SekSetIRQLine(3, SEK_IRQSTATUS_ACK); + } + if ((nIRQAcknowledge & 2) == 0) { + SekSetIRQLine(nScanlineIRQ, SEK_IRQSTATUS_ACK); + } + if ((nIRQAcknowledge & 4) == 0) { + SekSetIRQLine(nVBLankIRQ, SEK_IRQSTATUS_ACK); + } + } +} + +static inline void NeoCDIRQUpdate(UINT8 byteValue) +{ + nIRQAcknowledge |= (byteValue & 0x38); + +// bprintf(PRINT_NORMAL, _T(" - IRQ Ack -> %02X (CD, at line %3i).\n"), nIRQAcknowledge, SekCurrentScanline()); + + if ((nIRQAcknowledge & 0x3F) == 0x3F) { + SekSetIRQLine(7, SEK_IRQSTATUS_NONE); + } else { + if ((nIRQAcknowledge & 0x07) != 7) { + NeoIRQUpdate(0); + return; + } + if ((nIRQAcknowledge & 0x08) == 0) { + nNeoCDIRQVector = 0x17; + nNeoCDIRQVectorAck = 1; + SekSetIRQLine(4, SEK_IRQSTATUS_ACK /*| SEK_IRQSTATUS_CALLBACK*/); + return; + } + if ((nIRQAcknowledge & 0x10) == 0) { + nNeoCDIRQVector = 0x16; + nNeoCDIRQVectorAck = 1; + SekSetIRQLine(4, SEK_IRQSTATUS_ACK /*| SEK_IRQSTATUS_CALLBACK*/); + return; + } + if ((nIRQAcknowledge & 0x20) == 0) { + nNeoCDIRQVector = 0x15; + nNeoCDIRQVectorAck = 1; + SekSetIRQLine(4, SEK_IRQSTATUS_ACK /*| SEK_IRQSTATUS_CALLBACK*/); + return; + } + } +} + +static inline void SendSoundCommand(const UINT8 nCommand) +{ +// bprintf(PRINT_NORMAL, _T(" - Sound command sent (0x%02X).\n"), nCommand); + + neogeoSynchroniseZ80(0); + + nSoundStatus &= ~1; + nSoundLatch = nCommand; + + ZetNmi(); + +#if 1 && defined USE_SPEEDHACKS + neogeoSynchroniseZ80(0x0200); +#endif +} + +static UINT8 ReadInput1(INT32 nOffset) +{ + switch (nOffset) { + case 0x00: +// bprintf(PRINT_NORMAL, _T(" -- bank %d inputP0[0x%02X] read (%i).\n"), 0, nInputSelect, SekTotalCycles()); + return ~NeoInputBank[nJoyport0[nInputSelect & 0x07]]; + + case 0x01: +// bprintf(PRINT_NORMAL, _T(" - 0x%06X read (byte).\n"), sekAddress); + if (nNeoSystemType & NEO_SYS_MVS) { + return ~NeoInputBank[4]; + } + return ~0; + + case 0x81: +// bprintf(PRINT_NORMAL, _T(" - 0x%06X read (byte).\n"), sekAddress); + if (nNeoSystemType & NEO_SYS_MVS) { + return ~NeoInputBank[5]; + } + return ~0; + } + + return ~0; +} + +static UINT8 ReadInput2(INT32 nOffset) +{ + if ((nOffset & 1) == 0) { +// bprintf(PRINT_NORMAL, _T(" -- bank %d inputP1[0x%02X] read.\n"), 0, nInputSelect); + return ~NeoInputBank[nJoyport1[(nInputSelect >> 3) & 0x07]]; + } + + return ~0; +} + +static UINT8 ReadInput3(INT32 nOffset) +{ + if ((nOffset & 1) == 0) { +// bprintf(PRINT_NORMAL, " -- input 2 read.\n"); + return ~NeoInputBank[2]; + } + + return ~0; +} + +UINT8 __fastcall neogeoReadByte(UINT32 sekAddress) +{ + switch (sekAddress & 0xFE0000) { + case 0x300000: + return ReadInput1(sekAddress & 0xFF); + + case 0x320000: { + if ((sekAddress & 1) == 0) { + INT32 nReply = nSoundReply; + +#if 1 && defined USE_SPEEDHACKS + // nSoundStatus: &1 = sound latch read, &2 = response written + if (nSoundStatus != 3) { + neogeoSynchroniseZ80(0x0100); + } +#else + neogeoSynchroniseZ80(0); +#endif + + if ((nSoundStatus & 1) == 0) { +// bprintf(PRINT_NORMAL, _T(" - Sound reply read while sound pending (0x%02X).\n"), nSoundReply); + + return nReply & 0x7F; + } + +// bprintf(PRINT_NORMAL, _T(" - Sound reply read (0x%02X).\n"), nSoundReply); + return nReply; + } + + if (nNeoSystemType & NEO_SYS_MVS) { + UINT8 nuPD4990AOutput = uPD4990ARead(SekTotalCycles() - nuPD4990ATicks); + nuPD4990ATicks = SekTotalCycles(); + return (~NeoInputBank[3] & 0x3F) | (nuPD4990AOutput << 6); + } + + return (~NeoInputBank[3] & 0x7F) & 0xE7; + } + + case 0x340000: + return ReadInput2(sekAddress & 0xFF); + + case 0x380000: + return ReadInput3(sekAddress & 0xFF); + + default: + bprintf(PRINT_NORMAL, _T(" - 0x%08X read (byte, PC: %08X)\n"), sekAddress, SekGetPC(-1)); + } + + return ~0; +} + +UINT16 __fastcall neogeoReadWord(UINT32 sekAddress) +{ + switch (sekAddress & 0xFE0000) { + case 0x300000: + return (ReadInput1(sekAddress & 0xFE) << 8) | ReadInput1((sekAddress & 0xFE) | 1); + + case 0x320000: + SEK_DEF_READ_WORD(0, sekAddress); + + case 0x340000: + return (ReadInput2(sekAddress & 0xFE) << 8) | ReadInput2((sekAddress & 0xFE) | 1); + + case 0x380000: + return (ReadInput3(sekAddress & 0xFE) << 8) | ReadInput3((sekAddress & 0xFE) | 1); + + default: + bprintf(PRINT_NORMAL, _T(" - 0x%08X read (word, PC: %08X)\n"), sekAddress, SekGetPC(-1)); + } + + return ~0; +} + +static void WriteIO1(INT32 nOffset, UINT8 byteValue) +{ + switch (nOffset) { + case 0x01: // Select the input returned at 0x300000 +// bprintf(PRINT_NORMAL, _T(" - InputP0/P1 0x%02X selected (%i).\n"), byteValue, SekTotalCycles()); + nInputSelect = byteValue; + break; + + case 0x21: // Select the active cartridge slot +// bprintf(PRINT_NORMAL, _T(" - Cartridge slot 0x%02X activated.\n"), byteValue); + nNeoActiveSlot = byteValue; + if (nNeoActiveSlot >= nNeoNumSlots) { + nNeoActiveSlot = 0; + } + + NeoMapActiveCartridge(); + break; + + case 0x31: // Send latched output to LEDs (bits 5/4 - numeric displays, bit 3 - marquee lights, one per slot) +// bprintf(PRINT_NORMAL, _T(" - 0x%06X -> 0x%02X.\n"), sekAddress, byteValue); +// if (byteValue != 255) { +// bprintf(PRINT_NORMAL, _T(" - LED %02X -> %02X\n"), ~byteValue & 255, nLEDLatch & 255); +// } + +/* if ((byteValue & 0x20) == 0) { + nLED[0] = nLEDLatch; + } + if ((byteValue & 0x10) == 0) { + nLED[1] = nLEDLatch; + } + if ((byteValue & 0x08) == 0) { + nLED[2] = nLEDLatch; + } + + BurnGameFeedback(sizeof(nLED), nLED);*/ + + break; + + case 0x41: // Latch LED output + // for numeric displays - digits displayed = ~bytevalue + // for start buttons - highlighted marquee = ~bytevalue +// bprintf(PRINT_NORMAL, _T(" - LED output -> 0x%02X.\n"), byteValue); + nLEDLatch = ~byteValue; + break; + + case 0x51: // Send command to RTC +// bprintf(PRINT_NORMAL, _T(" - RTC -> 0x%02X.\n"), byteValue); + if (nNeoSystemType & NEO_SYS_MVS) { + uPD4990AWrite(byteValue & 2, byteValue & 4, byteValue & 1); + } + break; + + case 0x61: // Coin lockout chute 1 & input bank select +// bprintf(PRINT_NORMAL, _T(" - %sInput bank 0 selected (0x%02X).\n"), byteValue ? _T("Chute 1 coin lockout -> High / ") : _T(""), byteValue); + NeoInputBank = NeoInput + 0; + break; + case 0x63: // Coin lockout chute 2 +// bprintf(PRINT_NORMAL, _T(" - Chute 2 coin lockout -> High (0x%02X).\n"), byteValue); + break; + + case 0x65: // Coin counter chute 1 -> High + break; +// bprintf(PRINT_NORMAL, _T(" - Chute 1 coin counter -> High (0x%02X).\n"), byteValue); + case 0x67: // Coin counter chute 2 -> High +// bprintf(PRINT_NORMAL, _T(" - Chute 2 coin counter -> High (0x%02X).\n"), byteValue); + break; + + case 0xD1: // Send command to RTC +// bprintf(PRINT_NORMAL, _T(" - RTC -> 0x%02X.\n"), byteValue); + if (nNeoSystemType & NEO_SYS_MVS) { + uPD4990AWrite(byteValue & 2, byteValue & 4, byteValue & 1); + } + break; + + case 0xE1: +// bprintf(PRINT_NORMAL, _T(" - Chute 2 coin lockout -> Low / Input bank 1 selected (0x%02X).\n"), byteValue); + NeoInputBank = NeoInput + 8; + break; + case 0xE3: +// bprintf(PRINT_NORMAL, _T(" - Chute 2 coin lockout -> Low (0x%02X).\n"), byteValue); + break; + + case 0xE5: // Coin counter chute 1 -> Low +// bprintf(PRINT_NORMAL, _T(" - Chute 1 coin counter -> Low (0x%02X).\n"), byteValue); + break; + case 0xE7: // Coin counter chute 2 -> Low +// bprintf(PRINT_NORMAL, _T(" - Chute 2 coin counter -> Low (0x%02X).\n"), byteValue); + break; + } + + return; +} + +static void WriteIO2(INT32 nOffset, UINT8 /*byteValue*/) +{ + switch (nOffset) { + case 0x01: // Enable display + if (nNeoSystemType & NEO_SYS_CART) { + bNeoEnableGraphics = true; +// bprintf(PRINT_NORMAL, _T(" - Display enabled (0x%02X, at scanline %i).\n"), byteValue, SekCurrentScanline()); + break; + } + + case 0x03: // Select BIOS vector table + if (nNeoSystemType & NEO_SYS_CART) { + if (!b68KBoardROMBankedIn) { + MapVectorTable(true); + b68KBoardROMBankedIn = true; + } +// bprintf(PRINT_NORMAL, _T(" - BIOS vector table banked in (0x%02X).\n"), byteValue); + } + break; + + case 0x0B: // Select BIOS text ROM +// bprintf(PRINT_NORMAL, _T(" - BIOS text/Z80 ROM banked in (0x%02X).\n"), byteValue); + + bBIOSTextROMEnabled = !(nNeoSystemType & (NEO_SYS_PCB | NEO_SYS_AES)); + + if (bZ80BIOS) { + if (!bZ80BoardROMBankedIn) { + bZ80BoardROMBankedIn = true; + NeoZ80MapROM(true); + } + +#if defined Z80_RESET_ON_BANKSWITCH + nSoundStatus |= 1; + ZetReset(); +#endif + } + + break; + + case 0x0D: // Write-protect SRAM + bSRAMWritable = false; +// bprintf(PRINT_NORMAL, _T(" - SRAM write-protected (0x%02X).\n"), byteValue); + break; + + case 0x0F: // Select palette bank 1 +// bprintf(PRINT_NORMAL, _T(" - Palette 1 banked in (0x%02X).\n"), byteValue); + MapPalette(1); + break; + + case 0x11: // Disable display + if (nNeoSystemType & NEO_SYS_CART) { + bNeoEnableGraphics = false; +// bprintf(PRINT_NORMAL, _T(" - Display disabled (0x%02X, at scanline %i).\n"), byteValue, SekCurrentScanline()); + break; + } + + case 0x13: // Select game vector table + if (nNeoSystemType & NEO_SYS_CART) { + if (b68KBoardROMBankedIn) { + MapVectorTable(false); + b68KBoardROMBankedIn = false; + } +// bprintf(PRINT_NORMAL, _T(" - ROM vector table banked in (0x%02X).\n"), byteValue); + } + break; + + case 0x1B: // Select game text ROM +// bprintf(PRINT_NORMAL, _T(" - Cartridge text/Z80 ROM banked in (0x%02X).\n"), byteValue); + + bBIOSTextROMEnabled = false; + + if (bZ80BIOS) { + if (bZ80BoardROMBankedIn) { + bZ80BoardROMBankedIn = false; + NeoZ80MapROM(false); + } + +#if defined Z80_RESET_ON_BANKSWITCH + nSoundStatus |= 1; + ZetReset(); +#endif + } + + break; + + case 0x1D: // Write-enable SRAM + bSRAMWritable = true; +// bprintf(PRINT_NORMAL, _T(" - SRAM writable (0x%02X).\n"), byteValue); + break; + + case 0x1F: // Select palette bank 0 +// bprintf(PRINT_NORMAL, _T(" - Palette 0 banked in (0x%02X).\n"), byteValue); + MapPalette(0); + break; + } + + return; +} + +void __fastcall neogeoWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress & 0xFF0000) { + case 0x300000: + if ((sekAddress & 1) == 1) { +// bprintf(PRINT_NORMAL, " - Watchdog timer reset (%02X, at scanline %i)\n", byteValue, SekCurrentScanline()); + +#if defined EMULATE_WATCHDOG + nNeoWatchdog = -SekTotalCycles(); +#endif + + } + return; + + case 0x320000: + if ((sekAddress & 1) == 0) { + SendSoundCommand(byteValue); + } + return; + + case 0x380000: + WriteIO1(sekAddress & 0xFF, byteValue); + return; + + case 0x3A0000: + WriteIO2(sekAddress & 0x1F, byteValue); + return; + } + +// bprintf(PRINT_NORMAL, _T(" - Attempt to write byte 0x%06X -> 0x%02X\n"), sekAddress, byteValue); + + return; +} + +void __fastcall neogeoWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ +// neogeoWriteByte(sekAddress | 1, wordValue); + + SEK_DEF_WRITE_WORD(0, sekAddress, wordValue); + +// bprintf(PRINT_NORMAL, _T(" - Attempt to write word 0x%06X -> 0x%04X\n"), sekAddress, wordValue); +} + +// ---------------------------------------------------------------------------- +// Video controller reads + +UINT16 __fastcall neogeoReadWordVideo(UINT32 sekAddress) +{ + switch (sekAddress & 6) { + case 0x00: + case 0x02: +// bprintf(PRINT_NORMAL, " - Graphics RAM read (Bank %i, address 0x%04X).\n", NeoGraphicsRAMPointer > 0xFFFF ? 1 : 0, NeoGraphicsRAMPointer & 0xFFFF); + return *((UINT16*)(NeoGraphicsRAMBank + NeoGraphicsRAMPointer)); + + case 0x04: +// bprintf(PRINT_NORMAL, " - Graphics RAM modulo read.\n"); + return (UINT16)(nNeoGraphicsModulo >> 1); + + case 0x06: // Display status +// bprintf(PRINT_NORMAL, " - Display status read, line: %3i, anim: %i\n", SekCurrentScanline(), nNeoSpriteFrame); + +#if 1 && !defined USE_SPEEDHACKS + bForcePartialRender |= bForceUpdateOnStatusRead; +#endif + + return ((SekCurrentScanline() + nScanlineOffset) << 7) | 0 | (nNeoSpriteFrame & 7); + } + + return 0; +} + +UINT8 __fastcall neogeoReadByteVideo(UINT32 sekAddress) +{ + if (sekAddress & 1) { + return 0x0FF; + } else { + return neogeoReadWordVideo(sekAddress) >> 8; + } +} + +void __fastcall neogeoWriteWordVideo(UINT32 sekAddress, UINT16 wordValue) +{ +// if (sekAddress >= 0x3C0010) +// bprintf(PRINT_NORMAL, _T(" - Attempt to write word 0x%06X -> 0x%04X\n"), sekAddress, wordValue); + + switch (sekAddress & 14) { + case 0x00: { + NeoGraphicsRAMPointer = wordValue << 1; + NeoGraphicsRAMBank = NeoGraphicsRAM; + if (wordValue & 0x8000) { + NeoGraphicsRAMBank += 0x00010000; + } + break; + } + case 0x02: { + *((UINT16*)(NeoGraphicsRAMBank + NeoGraphicsRAMPointer)) = wordValue; + NeoGraphicsRAMPointer += nNeoGraphicsModulo; + +#if 0 + if ((NeoGraphicsRAMBank == NeoGraphicsRAM) && NeoGraphicsRAMPointer >= 0xC000 && NeoGraphicsRAMPointer < 0xE000) { + bprintf(PRINT_NORMAL, _T("VRAM bank 0 + 0x%04X -> %04X\n"), NeoGraphicsRAMPointer, wordValue); + } + if ((NeoGraphicsRAMBank != NeoGraphicsRAM) && NeoGraphicsRAMPointer >= 0x0C00) { + bprintf(PRINT_NORMAL, _T("VRAM bank 1 + 0x%04X -> %04X\n"), NeoGraphicsRAMPointer, wordValue); + } +#endif + +#if 1 && defined USE_SPEEDHACKS + bForcePartialRender |= bForceUpdateOnStatusRead; +#endif + break; + } + case 0x04: { + nNeoGraphicsModulo = ((INT16)wordValue) << 1; + break; + } + + case 0x06: { + nSpriteFrameSpeed = (wordValue >> 8); + + if ((nIRQControl & 0x10) == 0 && wordValue & 0x10) { + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ enabled (at line %3i, IRQControl: 0x%02X).\n"), SekCurrentScanline(), wordValue & 0xFF); +#endif + + if (nIRQCycles < nCyclesSegment) { + SekRunAdjust(nIRQCycles - nCyclesSegment); + } + } + +#if 0 || defined LOG_IRQ + if (nIRQControl & 0x10 && (wordValue & 0x10) == 0) { + bprintf(PRINT_NORMAL, _T(" - IRQ disabled (at line %3i, IRQControl: 0x%02X).\n"), SekCurrentScanline(), wordValue & 0xFF); + } +#endif + + nIRQControl = wordValue; +// bprintf(PRINT_NORMAL, _T(" - Autoanim speed -> 0x%02X\n"), wordValue >> 8); +// bprintf(PRINT_NORMAL, _T(" - IRQ control register -> 0x%02X (at line %3i)\n"), wordValue & 0xFF, SekCurrentScanline()); + break; + } + + case 0x08: { +// bprintf(PRINT_NORMAL, "0x%06X -> 0x%04X\n", sekAddress, wordValue); + // Bit 15 seems to be ignored + nIRQOffset = (nIRQOffset & 0x0000FFFF) | ((wordValue & 0x7FFF) << 16); + break; + } + case 0x0A: { +// bprintf(PRINT_NORMAL, "0x%06X -> 0x%04X\n", sekAddress, wordValue); + nIRQOffset = (nIRQOffset & 0xFFFF0000) | wordValue; + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ offs -> 0x%08X (at line %3i, IRQControl: 0x%02X).\n"), nIRQOffset, SekCurrentScanline(), nIRQControl); +#endif + + if (nIRQControl & 0x20) { + +#if 0 +// nIRQCycles = SekTotalCycles() - 64 + NeoConvertIRQPosition(nIRQOffset); + nIRQCycles = SekTotalCycles() + NeoConvertIRQPosition(nIRQOffset); +#else + // Turfmast uses this to set the timing of the raster interrupts. Using the code below, + // all raster effects in turfmast are correctly aligned and exhibit no flicker. + // (this sets the offset of the IRQ to the start of the current scanline instead of the actual beam position) + + // ssideki2 has some problems with this + nIRQCycles = SekCurrentScanline() * nSekCyclesScanline + NeoConvertIRQPosition(nIRQOffset + 8); +// bprintf(PRINT_NORMAL, _T(" %i - %i\n"), SekCurrentScanline(), SekTotalCycles() % SekCyclesScanline()); +#endif + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" IRQ Line -> %3i (at line %3i, relative).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); +#endif + + if (nIRQCycles < 0) { + nIRQCycles = NO_IRQ_PENDING; + } + if (nIRQCycles < nCyclesSegment) { + SekRunAdjust(nIRQCycles - nCyclesSegment); + } + } + + break; + } + + case 0x0C: { + NeoIRQUpdate(wordValue); + break; + } + } +} + +void __fastcall neogeoWriteByteVideo(UINT32 sekAddress, UINT8 byteValue) +{ +// bprintf(PRINT_NORMAL, _T(" - Attempt to write byte 0x%06X -> 0x%02X\n"), sekAddress, byteValue); + +#if 1 + if ((sekAddress & 1) == 0) { + neogeoWriteWordVideo(sekAddress, byteValue); + } +#else + if (sekAddress & 1) { + neogeoWriteWordVideo(sekAddress, byteValue); + } else { + neogeoWriteWordVideo(sekAddress, (byteValue << 8)); + } +#endif + +#if 1 && defined USE_SPEEDHACKS + bForcePartialRender |= bForceUpdateOnStatusRead; +#endif +} + +// ---------------------------------------------------------------------------- +// Backup RAM on MVS hardware + +void __fastcall neogeoWriteByteSRAM(UINT32 sekAddress, UINT8 byteValue) +{ + sekAddress &= 0xFFFF; + + if (bSRAMWritable) { + NeoNVRAM[sekAddress ^ 1] = byteValue; + } +} + +void __fastcall neogeoWriteWordSRAM(UINT32 sekAddress, UINT16 wordValue) +{ + sekAddress &= 0xFFFF; + + if (bSRAMWritable) { + *((UINT16*)(NeoNVRAM + sekAddress)) = BURN_ENDIAN_SWAP_INT16(wordValue); + } +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall neogeoReadByteMemoryCard(UINT32 sekAddress) +{ +// if (sekAddress < 0x800100) +// bprintf(PRINT_NORMAL, _T(" - Memcard 0x%04X read (PC: 0x%06X).\n"), sekAddress & 0x7FFF, SekGetPC(-1)); + + if (bMemoryCardInserted) { + if ((NeoSystem & 0x40) || (sekAddress & 1)) { + return NeoMemoryCard[sekAddress & 0x01FFFF]; + } + } + + return 0xFF; +} + +void __fastcall neogeoWriteByteMemoryCard(UINT32 sekAddress, UINT8 byteValue) +{ +// if (sekAddress < 0x800100) +// bprintf(PRINT_NORMAL, _T(" - Memcard 0x%04X -> 0x%02X (PC: 0x%06X).\n"), sekAddress & 0x7FFF, byteValue, SekGetPC(-1)); + + if (bMemoryCardInserted && bMemoryCardWritable) { + if ((NeoSystem & 0x40) || (sekAddress & 1)) { + NeoMemoryCard[sekAddress & 0x01FFFF] = byteValue; + } + } +} + +UINT8 __fastcall neoCDReadByteMemoryCard(UINT32 sekAddress) +{ + sekAddress &= 0x01FFFF; + if (sekAddress < 0x4000 && sekAddress & 1) { + return NeoMemoryCard[sekAddress]; + } + + return 0xFF; +} + +void __fastcall neoCDWriteByteMemoryCard(UINT32 sekAddress, UINT8 byteValue) +{ + sekAddress &= 0x01FFFF; + if (sekAddress < 0x4000 && sekAddress & 1) { + NeoMemoryCard[sekAddress] = byteValue; + } +} + +// ---------------------------------------------------------------------------- +// NeoCD CD-ROM controller handlers + +#define CD_FRAMES_MINUTE (60 * 75) +#define CD_FRAMES_SECOND ( 75) +#define CD_FRAMES_PREGAP ( 2 * 75) + +static INT32 nLC8951Register = 0; +static INT32 LC8951RegistersR[16]; +static INT32 LC8951RegistersW[16]; + +static INT32 nActiveTransferArea; +static INT32 nSpriteTransferBank; +static INT32 nADPCMTransferBank; + +static UINT8 nTransferWriteEnable; + +static bool NeoCDOBJBankUpdate[4]; + +static bool bNeoCDCommsClock, bNeoCDCommsSend; + +static UINT8 NeoCDCommsCommandFIFO[10] = { 0, }; +static UINT8 NeoCDCommsStatusFIFO[10] = { 0, }; + +static INT32 NeoCDCommsWordCount = 0; + +static INT32 NeoCDAssyStatus = 0; + +static INT32 NeoCDTrack = 0; + +static INT32 NeoCDSectorMin = 0; +static INT32 NeoCDSectorSec = 0; +static INT32 NeoCDSectorFrm = 0; +static INT32 NeoCDSectorLBA = 0; + +static char NeoCDSectorData[2352]; + +static bool bNeoCDLoadSector = false; + +static INT32 NeoCDDMAAddress1 = 0; +static INT32 NeoCDDMAAddress2 = 0; +static INT32 NeoCDDMAValue1 = 0; +static INT32 NeoCDDMAValue2 = 0; +static INT32 NeoCDDMACount = 0; + +static INT32 NeoCDDMAMode = 0; + +// hax0r +static INT32 nNeoCDMode = 0; +static INT32 nff0002 = 0; + +static void NeoCDLBAToMSF(const INT32 LBA) +{ + NeoCDSectorMin = (LBA + CD_FRAMES_PREGAP) / CD_FRAMES_MINUTE; + NeoCDSectorSec = (LBA + CD_FRAMES_PREGAP) % CD_FRAMES_MINUTE / CD_FRAMES_SECOND; + NeoCDSectorFrm = (LBA + CD_FRAMES_PREGAP) % CD_FRAMES_SECOND; +} + +static void NeoCDCommsWrite(UINT8 data) +{ + if (NeoCDCommsWordCount >= 0 && NeoCDCommsWordCount < 10) { + NeoCDCommsCommandFIFO[NeoCDCommsWordCount] = data & 0x0F; + } +} + +static UINT8 NeoCDCommsread() +{ + UINT8 ret = 0; + + if (NeoCDCommsWordCount >= 0 && NeoCDCommsWordCount < 10) { + ret = NeoCDCommsStatusFIFO[NeoCDCommsWordCount] & 0x0F; + } + + if (bNeoCDCommsClock) { + ret |= 0x10; + } + + return ret; +} + +static void NeoCDCommsReset() +{ + bNeoCDCommsSend = false; + bNeoCDCommsClock = true; + + memset(NeoCDCommsCommandFIFO, 0, sizeof(NeoCDCommsCommandFIFO)); + memset(NeoCDCommsStatusFIFO, 0, sizeof(NeoCDCommsStatusFIFO)); + + NeoCDCommsWordCount = 0; + + NeoCDAssyStatus = 9; + + memset(NeoCDSectorData, 0, sizeof(NeoCDSectorData)); + + bNeoCDLoadSector = false; + + nNeoCDMode = 0; +} + +static void LC8951UpdateHeader() +{ + NeoCDLBAToMSF(NeoCDSectorLBA); + + if (LC8951RegistersW[11] & 1) { + + // HEAD registers have sub-header + + LC8951RegistersR[4] = 0; // HEAD0 + LC8951RegistersR[5] = 0; // HEAD1 + LC8951RegistersR[6] = 0; // HEAD2 + LC8951RegistersR[7] = 0; // HEAD3 + + } else { + + // HEAD registers have header + + LC8951RegistersR[4] = ((NeoCDSectorMin / 10) << 4) | (NeoCDSectorMin % 10); // HEAD0 + LC8951RegistersR[5] = ((NeoCDSectorSec / 10) << 4) | (NeoCDSectorSec % 10); // HEAD1 + LC8951RegistersR[6] = ((NeoCDSectorFrm / 10) << 4) | (NeoCDSectorFrm % 10); // HEAD2 + LC8951RegistersR[7] = 1; // HEAD3 + } +} + +static char* LC8915InitTransfer() +{ + if (!LC8951RegistersW[6]) { + bprintf(PRINT_ERROR, _T(" LC8951 DTTRG status invalid\n")); + return NULL; + } + if (!(LC8951RegistersW[1] & 0x02)) { + bprintf(PRINT_ERROR, _T(" LC8951 DOUTEN status invalid\n")); + return NULL; + } + if (((LC8951RegistersW[5] << 8) | LC8951RegistersW[4]) + (NeoCDDMACount << 1) > 2352) { + bprintf(PRINT_ERROR, _T(" DMA transfer exceeds current sector in LC8951 external buffer\n")); + return NULL; + } + + return NeoCDSectorData + ((LC8951RegistersW[5] << 8) | LC8951RegistersW[4]); +} + +static void LC8915EndTransfer() +{ + LC8951RegistersW[6] = 0x00; // reset DTTRG + + LC8951RegistersR[1] |= 0x48; // set DTEI & DTBSY + if (LC8951RegistersW[1] & 0x40) { + + // trigger DTE interrupt + + // the Neo Geo CD doesn't use the DTE interrupt + // nIRQAcknowledge &= ~0x20; + // NeoCDIRQUpdate(0); + + } +} + +static void LC8951Reset() +{ + memset(LC8951RegistersR, 0, sizeof(LC8951RegistersR)); + memset(LC8951RegistersW, 0, sizeof(LC8951RegistersW)); + LC8951RegistersR[0x01] = 0xFF; + LC8951RegistersR[0x0F] = 0x80; + + LC8951UpdateHeader(); +} + +static void NeoCDProcessCommand() +{ + memset(NeoCDCommsStatusFIFO, 0, sizeof(NeoCDCommsStatusFIFO)); + + if (NeoCDCommsCommandFIFO[0]) { + NeoCDCommsStatusFIFO[1] = 15; + } + + switch (NeoCDCommsCommandFIFO[0]) { + case 0: + break; + case 1: +// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); + CDEmuStop(); + + NeoCDAssyStatus = 0x0E; + bNeoCDLoadSector = false; + break; + case 2: +// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); + NeoCDCommsStatusFIFO[1] = NeoCDCommsCommandFIFO[3]; + switch (NeoCDCommsCommandFIFO[3]) { + + case 0: { + UINT8* ChannelData = CDEmuReadQChannel(); + + NeoCDCommsStatusFIFO[2] = ChannelData[1] / 10; + NeoCDCommsStatusFIFO[3] = ChannelData[1] % 10; + + NeoCDCommsStatusFIFO[4] = ChannelData[2] / 10; + NeoCDCommsStatusFIFO[5] = ChannelData[2] % 10; + + NeoCDCommsStatusFIFO[6] = ChannelData[3] / 10; + NeoCDCommsStatusFIFO[7] = ChannelData[3] % 10; + + NeoCDCommsStatusFIFO[8] = ChannelData[7]; + +// bprintf(PRINT_ERROR, _T(" %02i %02i:%02i:%02i %02i:%02i:%02i %02i\n"), ChannelData[0], ChannelData[1], ChannelData[2], ChannelData[3], ChannelData[4], ChannelData[5], ChannelData[6], ChannelData[7]); + + break; + } + case 1: { + UINT8* ChannelData = CDEmuReadQChannel(); + + NeoCDCommsStatusFIFO[2] = ChannelData[4] / 10; + NeoCDCommsStatusFIFO[3] = ChannelData[4] % 10; + + NeoCDCommsStatusFIFO[4] = ChannelData[5] / 10; + NeoCDCommsStatusFIFO[5] = ChannelData[5] % 10; + + NeoCDCommsStatusFIFO[6] = ChannelData[6] / 10; + NeoCDCommsStatusFIFO[7] = ChannelData[6] % 10; + + NeoCDCommsStatusFIFO[8] = ChannelData[7]; + + break; + } + case 2: { + + UINT8* ChannelData = CDEmuReadQChannel(); + + NeoCDCommsStatusFIFO[2] = ChannelData[0] / 10; + NeoCDCommsStatusFIFO[3] = ChannelData[0] % 10; + + + NeoCDCommsStatusFIFO[8] = ChannelData[7]; + + break; + } + case 3: { + UINT8* TOCEntry = CDEmuReadTOC(-2); + + NeoCDCommsStatusFIFO[2] = TOCEntry[0] / 10; + NeoCDCommsStatusFIFO[3] = TOCEntry[0] % 10; + + NeoCDCommsStatusFIFO[4] = TOCEntry[1] / 10; + NeoCDCommsStatusFIFO[5] = TOCEntry[1] % 10; + + NeoCDCommsStatusFIFO[6] = TOCEntry[2] / 10; + NeoCDCommsStatusFIFO[7] = TOCEntry[2] % 10; + + break; + } + case 4: { + UINT8* TOCEntry = CDEmuReadTOC(-1); + + NeoCDCommsStatusFIFO[2] = TOCEntry[0] / 10; + NeoCDCommsStatusFIFO[3] = TOCEntry[0] % 10; + + NeoCDCommsStatusFIFO[4] = TOCEntry[1] / 10; + NeoCDCommsStatusFIFO[5] = TOCEntry[1] % 10; + + break; + } + case 5: { + NeoCDTrack = NeoCDCommsCommandFIFO[4] * 10 + NeoCDCommsCommandFIFO[5]; + + UINT8* TOCEntry = CDEmuReadTOC(NeoCDTrack); + + NeoCDCommsStatusFIFO[2] = TOCEntry[0] / 10; + NeoCDCommsStatusFIFO[3] = TOCEntry[0] % 10; + + NeoCDCommsStatusFIFO[4] = TOCEntry[1] / 10; + NeoCDCommsStatusFIFO[5] = TOCEntry[1] % 10; + + NeoCDCommsStatusFIFO[6] = TOCEntry[2] / 10; + NeoCDCommsStatusFIFO[7] = TOCEntry[2] % 10; + + // bit 3 of the 1st minutes digit indicates a data track + if (TOCEntry[3] & 4) { + NeoCDCommsStatusFIFO[6] |= 8; + } + + NeoCDCommsStatusFIFO[8] = NeoCDTrack % 10; + + break; + } + + case 6: { + + UINT8* ChannelData = CDEmuReadQChannel(); + + NeoCDCommsStatusFIFO[8] = ChannelData[7]; + + break; + } + + case 7: { + + // must be 02, 0E, 0F, or 05 + NeoCDCommsStatusFIFO[2] = 0; + NeoCDCommsStatusFIFO[3] = 5; + + NeoCDCommsStatusFIFO[4] = 0; + NeoCDCommsStatusFIFO[5] = 0; + + NeoCDCommsStatusFIFO[6] = 0; + NeoCDCommsStatusFIFO[7] = 0; + break; + } + } + break; + + case 3: { + + if (LC8951RegistersW[10] & 4) { + + if (CDEmuGetStatus() == playing) { + bprintf(PRINT_ERROR, _T("*** Switching CD mode to CD-ROM while in audio mode!(PC: 0x%06X)\n"), SekGetPC(-1)); + } + + NeoCDSectorLBA = NeoCDCommsCommandFIFO[2] * (10 * CD_FRAMES_MINUTE); + NeoCDSectorLBA += NeoCDCommsCommandFIFO[3] * ( 1 * CD_FRAMES_MINUTE); + NeoCDSectorLBA += NeoCDCommsCommandFIFO[4] * (10 * CD_FRAMES_SECOND); + NeoCDSectorLBA += NeoCDCommsCommandFIFO[5] * ( 1 * CD_FRAMES_SECOND); + NeoCDSectorLBA += NeoCDCommsCommandFIFO[6] * (10 ); + NeoCDSectorLBA += NeoCDCommsCommandFIFO[7] * ( 1 ); + + NeoCDSectorLBA -= CD_FRAMES_PREGAP; + + CDEmuStartRead(); +// LC8951RegistersR[1] |= 0x20; + } else { + + if (CDEmuGetStatus() == reading) { + bprintf(PRINT_ERROR, _T("*** Switching CD mode to audio while in CD-ROM mode!(PC: 0x%06X)\n"), SekGetPC(-1)); + } + + CDEmuPlay((NeoCDCommsCommandFIFO[2] * 10) + NeoCDCommsCommandFIFO[3], (NeoCDCommsCommandFIFO[4] * 10) + NeoCDCommsCommandFIFO[5], (NeoCDCommsCommandFIFO[6] * 10) + NeoCDCommsCommandFIFO[7]); + } + + NeoCDAssyStatus = 1; + bNeoCDLoadSector = true; + + break; + } + case 4: +// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); + CDEmuPause(); + break; + case 5: +// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); +// NeoCDAssyStatus = 9; +// bNeoCDLoadSector = false; + break; + + case 6: +// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); + NeoCDAssyStatus = 4; + bNeoCDLoadSector = false; + break; + case 7: +// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); + NeoCDAssyStatus = 1; + bNeoCDLoadSector = true; + break; + + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: +// bprintf(PRINT_ERROR, _T(" CD comms received command %i\n"), NeoCDCommsCommandFIFO[0]); + NeoCDAssyStatus = 9; + bNeoCDLoadSector = false; + break; + } +} + +static void NeoCDDoDMA() +{ + + // The LC8953 chip has a programmable DMA controller, which is not properly emulated. + // Since the software only uses it in a limited way, we can apply a simple heuristic + // to determnine the requested operation. + + // Additionally, we don't know how many cycles DMA operations take. + // Here, only bus access is used to get a rough approximation -- + // each read/write takes a single cycle, setup and everything else is ignored. + +// bprintf(PRINT_IMPORTANT, _T(" - DMA controller transfer started (PC: 0x%06X)\n"), SekGetPC(-1)); + + switch (NeoCDDMAMode) { + + case 0xCFFD: { +// bprintf(PRINT_NORMAL, _T(" adr : 0x%08X - 0x%08X <- address, skip odd bytes\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 8); + + // - DMA controller 0x7E -> 0xCFFD (PC: 0xC07CE2) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) + // - DMA controller program[02] -> 0xE8DA (PC: 0xC07CEE) + // - DMA controller program[04] -> 0x92DA (PC: 0xC07CF4) + // - DMA controller program[06] -> 0x92DB (PC: 0xC07CFA) + // - DMA controller program[08] -> 0x96DB (PC: 0xC07D00) + // - DMA controller program[10] -> 0x96F6 (PC: 0xC07D06) + // - DMA controller program[12] -> 0x2E02 (PC: 0xC07D0C) + // - DMA controller program[14] -> 0xFDFF (PC: 0xC07D12) + + SekIdle(NeoCDDMACount * 4); + + while (NeoCDDMACount--) { + SekWriteWord(NeoCDDMAAddress1 + 0, NeoCDDMAAddress1 >> 24); + SekWriteWord(NeoCDDMAAddress1 + 2, NeoCDDMAAddress1 >> 16); + SekWriteWord(NeoCDDMAAddress1 + 4, NeoCDDMAAddress1 >> 8); + SekWriteWord(NeoCDDMAAddress1 + 6, NeoCDDMAAddress1 >> 0); + NeoCDDMAAddress1 += 8; + } + + break; + } + + case 0xE2DD: { +// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- 0x%08X - 0x%08X, skip odd bytes\n"), NeoCDDMAAddress2, NeoCDDMAAddress2 + NeoCDDMACount * 2, NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); + + // - DMA controller 0x7E -> 0xE2DD (PC: 0xC0A190) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) + // - DMA controller program[02] -> 0x82BE (PC: 0xC0A194) + // - DMA controller program[04] -> 0x93DA (PC: 0xC0A196) + // - DMA controller program[06] -> 0xBE93 (PC: 0xC0A198) + // - DMA controller program[08] -> 0xDABE (PC: 0xC0A19A) + // - DMA controller program[10] -> 0xF62D (PC: 0xC0A19C) + // - DMA controller program[12] -> 0x02FD (PC: 0xC0A19E) + // - DMA controller program[14] -> 0xFFFF (PC: 0xC0A1A0) + + SekIdle(NeoCDDMACount * 1); + + while (NeoCDDMACount--) { + SekWriteWord(NeoCDDMAAddress2 + 0, SekReadByte(NeoCDDMAAddress1 + 0)); + SekWriteWord(NeoCDDMAAddress2 + 2, SekReadByte(NeoCDDMAAddress1 + 1)); + NeoCDDMAAddress1 += 2; + NeoCDDMAAddress2 += 4; + } + + break; + } + + case 0xFC2D: { +// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- LC8951 external buffer, skip odd bytes\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); + + // - DMA controller 0x7E -> 0xFC2D (PC: 0xC0A190) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) + // - DMA controller program[02] -> 0x8492 (PC: 0xC0A194) + // - DMA controller program[04] -> 0xDA92 (PC: 0xC0A196) + // - DMA controller program[06] -> 0xDAF6 (PC: 0xC0A198) + // - DMA controller program[08] -> 0x2A02 (PC: 0xC0A19A) + // - DMA controller program[10] -> 0xFDFF (PC: 0xC0A19C) + // - DMA controller program[12] -> 0x48E7 (PC: 0xC0A19E) + // - DMA controller program[14] -> 0xFFFE (PC: 0xC0A1A0) + + char* data = LC8915InitTransfer(); + if (data == NULL) { + break; + } + + SekIdle(NeoCDDMACount * 4); + + while (NeoCDDMACount--) { + SekWriteByte(NeoCDDMAAddress1 + 0, data[0]); + SekWriteByte(NeoCDDMAAddress1 + 2, data[1]); + NeoCDDMAAddress1 += 4; + data += 2; + } + + LC8915EndTransfer(); + + break; + } + + case 0xFE3D: + + // - DMA controller 0x7E -> 0xFE3D (PC: 0xC0A190) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) + // - DMA controller program[02] -> 0x82BF (PC: 0xC0A194) + // - DMA controller program[04] -> 0x93BF (PC: 0xC0A196) + // - DMA controller program[06] -> 0xF629 (PC: 0xC0A198) + // - DMA controller program[08] -> 0x02FD (PC: 0xC0A19A) + // - DMA controller program[10] -> 0xFFFF (PC: 0xC0A19C) + // - DMA controller program[12] -> 0xF17D (PC: 0xC0A19E) + // - DMA controller program[14] -> 0xFCF5 (PC: 0xC0A1A0) + + case 0xFE6D: { +// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- 0x%08X - 0x%08X\n"), NeoCDDMAAddress2, NeoCDDMAAddress2 + NeoCDDMACount * 2, NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2); + + // - DMA controller 0x7E -> 0xFE6D (PC: 0xC0FD7A) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0FD7C) + // - DMA controller program[02] -> 0x82BF (PC: 0xC0FD7E) + // - DMA controller program[04] -> 0xF693 (PC: 0xC0FD80) + // - DMA controller program[06] -> 0xBF29 (PC: 0xC0FD82) + // - DMA controller program[08] -> 0x02FD (PC: 0xC0FD84) + // - DMA controller program[10] -> 0xFFFF (PC: 0xC0FD86) + // - DMA controller program[12] -> 0xC515 (PC: 0xC0FD88) + // - DMA controller program[14] -> 0xFCF5 (PC: 0xC0FD8A) + + SekIdle(NeoCDDMACount * 1); + + while (NeoCDDMACount--) { + SekWriteWord(NeoCDDMAAddress2, SekReadWord(NeoCDDMAAddress1)); + NeoCDDMAAddress1 += 2; + NeoCDDMAAddress2 += 2; + } + +if (NeoCDDMAAddress2 == 0x0800) { +// MapVectorTable(false); +// bprintf(PRINT_ERROR, _T(" RAM vectors mapped (PC = 0x%08X\n"), SekGetPC(0)); +// extern INT32 bRunPause; +// bRunPause = 1; +} + break; + } + + case 0xFEF5: { +// bprintf(PRINT_NORMAL, _T(" adr : 0x%08X - 0x%08X <- address\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); + + // - DMA controller 0x7E -> 0xFEF5 (PC: 0xC07CE2) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) + // - DMA controller program[02] -> 0x92E8 (PC: 0xC07CEE) + // - DMA controller program[04] -> 0xBE96 (PC: 0xC07CF4) + // - DMA controller program[06] -> 0xF629 (PC: 0xC07CFA) + // - DMA controller program[08] -> 0x02FD (PC: 0xC07D00) + // - DMA controller program[10] -> 0xFFFF (PC: 0xC07D06) + // - DMA controller program[12] -> 0xFC3D (PC: 0xC07D0C) + // - DMA controller program[14] -> 0xFCF5 (PC: 0xC07D12) + + SekIdle(NeoCDDMACount * 2); + + while (NeoCDDMACount--) { + SekWriteWord(NeoCDDMAAddress1 + 0, NeoCDDMAAddress1 >> 16); + SekWriteWord(NeoCDDMAAddress1 + 2, NeoCDDMAAddress1 >> 0); + NeoCDDMAAddress1 += 4; + } + + break; + } + + case 0xFFC5: { +// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- LC8951 external buffer\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2); + + // - DMA controller 0x7E -> 0xFFC5 (PC: 0xC0A190) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) + // - DMA controller program[02] -> 0xA6F6 (PC: 0xC0A194) + // - DMA controller program[04] -> 0x2602 (PC: 0xC0A196) + // - DMA controller program[06] -> 0xFDFF (PC: 0xC0A198) + // - DMA controller program[08] -> 0xFC2D (PC: 0xC0A19A) + // - DMA controller program[10] -> 0xFCF5 (PC: 0xC0A19C) + // - DMA controller program[12] -> 0x8492 (PC: 0xC0A19E) + // - DMA controller program[14] -> 0xDA92 (PC: 0xC0A1A0) + + char* data = LC8915InitTransfer(); + if (data == NULL) { + break; + } + + SekIdle(NeoCDDMACount * 4); + + while (NeoCDDMACount--) { + SekWriteByte(NeoCDDMAAddress1 + 0, data[0]); + SekWriteByte(NeoCDDMAAddress1 + 1, data[1]); + NeoCDDMAAddress1 += 2; + data += 2; + } + + LC8915EndTransfer(); + + break; + } + + case 0xFFCD: + + // - DMA controller 0x7E -> 0xFFCD (PC: 0xC0A190) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) + // - DMA controller program[02] -> 0x92F6 (PC: 0xC0A194) + // - DMA controller program[04] -> 0x2602 (PC: 0xC0A196) + // - DMA controller program[06] -> 0xFDFF (PC: 0xC0A198) + // - DMA controller program[08] -> 0x7006 (PC: 0xC0A19A) + // - DMA controller program[10] -> 0x6100 (PC: 0xC0A19C) + // - DMA controller program[12] -> 0x2412 (PC: 0xC0A19E) + // - DMA controller program[14] -> 0x13FC (PC: 0xC0A1A0) + + case 0xFFDD: { +// bprintf(PRINT_NORMAL, _T(" Fill: 0x%08X - 0x%08X <- 0x%04X\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2, NeoCDDMAValue1); + + // - DMA controller 0x7E -> 0xFFDD (PC: 0xC07CE2) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) + // - DMA controller program[02] -> 0x92F6 (PC: 0xC07CEE) + // - DMA controller program[04] -> 0x2602 (PC: 0xC07CF4) + // - DMA controller program[06] -> 0xFDFF (PC: 0xC07CFA) + // - DMA controller program[08] -> 0xFFFF (PC: 0xC07D00) + // - DMA controller program[10] -> 0xFCF5 (PC: 0xC07D06) + // - DMA controller program[12] -> 0x8AF0 (PC: 0xC07D0C) + // - DMA controller program[14] -> 0x1609 (PC: 0xC07D12) + + SekIdle(NeoCDDMACount * 1); + + while (NeoCDDMACount--) { + SekWriteWord(NeoCDDMAAddress1, NeoCDDMAValue1); + NeoCDDMAAddress1 += 2; + } + + break; + } + default: { + bprintf(PRINT_ERROR, _T(" Unknown transfer type 0x%04X (PC: 0x%06X)\n"), NeoCDDMAMode, SekGetPC(-1)); + bprintf(PRINT_NORMAL, _T(" ??? : 0x%08X 0x%08X 0x%04X 0x%04X 0x%08X\n"), NeoCDDMAAddress1, NeoCDDMAAddress2, NeoCDDMAValue1, NeoCDDMAValue2, NeoCDDMACount); + +extern INT32 bRunPause; +bRunPause = 1; + + } + } +} + +static void NeoCDCommsControl(UINT8 clock, UINT8 send) +{ + if (clock && !bNeoCDCommsClock) { + NeoCDCommsWordCount++; + if (NeoCDCommsWordCount >= 10) { + NeoCDCommsWordCount = 0; + + if (send) { + + // command receive complete + + if (NeoCDCommsCommandFIFO[0]) { + INT32 sum = 0; + +// bprintf(PRINT_NORMAL, _T(" - CD mechanism command receive completed : 0x")); + for (INT32 i = 0; i < 9; i++) { +// bprintf(PRINT_NORMAL, _T("%X"), NeoCDCommsCommandFIFO[i]); + sum += NeoCDCommsCommandFIFO[i]; + } + sum = ~(sum + 5) & 0x0F; +// bprintf(PRINT_NORMAL, _T(" (CS 0x%X, %s)\n"), NeoCDCommsCommandFIFO[9], (sum == NeoCDCommsCommandFIFO[9]) ? _T("OK") : _T("NG")); + if (sum == NeoCDCommsCommandFIFO[9]) { + + NeoCDProcessCommand(); + + if (NeoCDCommsCommandFIFO[0]) { + + if (NeoCDAssyStatus == 1) { + if (CDEmuGetStatus() == idle) { + NeoCDAssyStatus = 0x0E; + bNeoCDLoadSector = false; + } + } + + NeoCDCommsStatusFIFO[0] = NeoCDAssyStatus; + +#if 0 + extern INT32 counter; + if (counter) { + NeoCDCommsStatusFIFO[0] = counter & 0x0F; + } +#endif + + // compute checksum + + sum = 0; + + for (INT32 i = 0; i < 9; i++) { + sum += NeoCDCommsStatusFIFO[i]; + } + NeoCDCommsStatusFIFO[9] = ~(sum + 5) & 0x0F; + } + } + } + } else { + + // status send complete + +// if (NeoCDCommsStatusFIFO[0] || NeoCDCommsStatusFIFO[1]) { +// INT32 sum = 0; +// +// bprintf(PRINT_NORMAL, _T(" - CD mechanism status send completed : 0x")); +// for (INT32 i = 0; i < 9; i++) { +// bprintf(PRINT_NORMAL, _T("%X"), NeoCDCommsStatusFIFO[i]); +// sum += NeoCDCommsStatusFIFO[i]; +// } +// sum = ~(sum + 5) & 0x0F; +// bprintf(PRINT_NORMAL, _T(" (CS 0x%X, %s)\n"), NeoCDCommsStatusFIFO[9], (sum == NeoCDCommsStatusFIFO[9]) ? _T("OK") : _T("NG")); +// } + +// if (NeoCDAssyStatus == 0xE) { +// NeoCDAssyStatus = 9; +// } + } + + } + bNeoCDCommsSend = send; + } + bNeoCDCommsClock = clock; +} + +void NeoCDReadSector() +{ + if ((nff0002 & 0x0500)) { + if (NeoCDAssyStatus == 1 && bNeoCDLoadSector) { + +// if (LC8951RegistersW[10] & 0x80) { + NeoCDSectorLBA++; + NeoCDSectorLBA = CDEmuLoadSector(NeoCDSectorLBA, NeoCDSectorData + 4) - 1; +// } + + if (LC8951RegistersW[10] & 0x80) { + LC8951UpdateHeader(); + + LC8951RegistersR[12] = 0x80; // STAT0 + LC8951RegistersR[13] = 0; // STAT1 + LC8951RegistersR[14] = 0x10; // STAT2 + LC8951RegistersR[15] = 0; // STAT3 + +// bprintf(PRINT_IMPORTANT, _T(" Sector %08i (%02i:%02i:%02i) read\n"), NeoCDSectorLBA, NeoCDSectorMin, NeoCDSectorSec, NeoCDSectorFrm); + +#if 1 + if (NeoCDSectorData[4 + 64] == 'g' && !strncmp(NeoCDSectorData + 4, "Copyright by SNK", 16)) { +// printf(PRINT_ERROR, _T(" simulated CDZ protection error\n")); +// bprintf(PRINT_ERROR, _T(" %.70hs\n"), NeoCDSectorData + 4); + + NeoCDSectorData[4 + 64] = 'f'; + + // LC8951RegistersR[12] = 0x00; // STAT0 + } +#endif + + nIRQAcknowledge &= ~0x20; + NeoCDIRQUpdate(0); + + LC8951RegistersR[1] &= ~0x20; + +// bprintf(PRINT_IMPORTANT, _T(" DECI interrupt triggered\n")); + } + } + + bNeoCDLoadSector = true; +// bNeoCDLoadSector = false; + } +} + +UINT8 __fastcall neogeoReadByteCDROM(UINT32 sekAddress) +{ +// bprintf(PRINT_NORMAL, _T(" - CDROM: 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); + + switch (sekAddress & 0xFFFF) { + + case 0x0017: + return nNeoCDMode; + + // LC8951 registers + case 0x0101: +// bprintf(PRINT_NORMAL, _T(" - LC8951 register read (PC: 0x%06X)\n"), SekGetPC(-1)); + return nLC8951Register; + case 0x0103: { +// bprintf(PRINT_NORMAL, _T(" - LC8951 register 0x%X read (PC: 0x%06X)\n"), nLC8951Register, SekGetPC(-1)); + + INT32 reg = LC8951RegistersR[nLC8951Register]; + + switch (nLC8951Register) { + case 0x03: // DBCH + LC8951RegistersR[3] &= 0x0F; + LC8951RegistersR[3] |= (LC8951RegistersR[1] & 0x40) ? 0x00 : 0xF0; + break; + case 0x0D: // STAT3 + LC8951RegistersR[1] |= 0x20; // reset DECI + // bprintf(PRINT_ERROR, _T(" - DECI (PC: 0x%06X)\n"), SekGetPC(-1)); + break; + } + + nLC8951Register = (nLC8951Register + 1) & 0x0F; + return reg; + } + + // CD mechanism communication + case 0x0161: + return NeoCDCommsread(); + + default: { +// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); + } + } + + return ~0; +} + +UINT16 __fastcall neogeoReadWordCDROM(UINT32 sekAddress) +{ +// bprintf(PRINT_NORMAL, _T(" - CDROM: 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); + +#if 1 + switch (sekAddress & 0xFFFF) { + case 0x011C: + return ~((0x10 | (NeoSystem & 3)) << 8); + } +#endif + +// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); + + return ~0; +} + +void __fastcall neogeoWriteByteCDROM(UINT32 sekAddress, UINT8 byteValue) +{ +// bprintf(PRINT_NORMAL, _T(" - Neo Geo CD: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); + + switch (sekAddress & 0xFFFF) { + case 0x000F: + NeoCDIRQUpdate(byteValue); + break; + + case 0x0017: + nNeoCDMode = byteValue; + break; + + case 0x0061: + if (byteValue & 0x40) { + NeoCDDoDMA(); + } + break; + + // LC8951 registers + case 0x0101: + nLC8951Register = byteValue & 0x0F; +// bprintf(PRINT_NORMAL, _T(" - LC8951 register -> 0x%02X (PC: 0x%06X)\n"), nLC8951Register, SekGetPC(-1)); + break; + case 0x0103: +// bprintf(PRINT_NORMAL, _T(" - LC8951 register 0x%X -> 0x%02X (PC: 0x%06X)\n"), nLC8951Register, byteValue, SekGetPC(-1)); + switch (nLC8951Register) { + case 3: // DBCH + LC8951RegistersW[ 3] = byteValue & 0x0F; + break; + case 6: // DTTRG + LC8951RegistersW[ 6] = ~0x00; + LC8951RegistersR[ 1] &= ~0x08; + break; + case 7: // DTACK + LC8951RegistersW[ 7] = ~0x00; + LC8951RegistersR[ 1] &= ~0x40; + break; +// case 10: +// LC8951RegistersW[nLC8951Register] = byteValue; +// bprintf(PRINT_NORMAL, _T(" - CTRL0 -> %02X (PC: 0x%06X)\n"), LC8951RegistersW[nLC8951Register], byteValue, SekGetPC(-1)); +// break; + case 11: + LC8951RegistersW[11] = byteValue; // CTRL1 + LC8951UpdateHeader(); + break; + case 15: + LC8951Reset(); + break; + default: + LC8951RegistersW[nLC8951Register] = byteValue; + } + nLC8951Register = (nLC8951Register + 1) & 0x0F; + break; + + case 0x0105: +// bprintf(PRINT_NORMAL, _T(" - NGCD 0xE00000 area -> 0x%02X (PC: 0x%06X)\n"), byteValue, SekGetPC(-1)); + nActiveTransferArea = byteValue; + break; + + case 0x0121: +// bprintf(PRINT_NORMAL, _T(" - NGCD OBJ BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); + NeoSetSpriteSlot(1); + memset(NeoCDOBJBankUpdate, 0, sizeof(NeoCDOBJBankUpdate)); + break; + case 0x0123: +// bprintf(PRINT_NORMAL, _T(" - NGCD PCM BUSREQ -> 1 (PC: 0x%06X) %x\n"), SekGetPC(-1), byteValue); + break; + case 0x0127: +// bprintf(PRINT_NORMAL, _T(" - NGCD Z80 BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); + neogeoSynchroniseZ80(0); + ZetSetBUSREQLine(1); + break; + case 0x0129: +// bprintf(PRINT_NORMAL, _T(" - NGCD FIX BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); + NeoSetTextSlot(1); + break; + + case 0x0141: +// bprintf(PRINT_NORMAL, _T(" - NGCD OBJ BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); + NeoSetSpriteSlot(0); + for (INT32 i = 0; i < 4; i++) { + if (NeoCDOBJBankUpdate[i]) { + NeoDecodeSpritesCD(NeoSpriteRAM + (i << 20), NeoSpriteROM[0] + (i << 20), 0x100000); + NeoUpdateSprites((i << 20), 0x100000); + } + } + + break; + case 0x0143: +// bprintf(PRINT_NORMAL, _T(" - NGCD PCM BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); + break; + case 0x0147: +// bprintf(PRINT_NORMAL, _T(" - NGCD Z80 BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); + neogeoSynchroniseZ80(0); + ZetSetBUSREQLine(0); + break; + case 0x0149: +// bprintf(PRINT_NORMAL, _T(" - NGCD FIX BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); + NeoSetTextSlot(0); + NeoUpdateText(0, 0x020000, NeoTextRAM, NeoTextROM[0]); + break; + + // CD mechanism communication + case 0x0163: + NeoCDCommsWrite(byteValue); + break; + case 0x0165: + NeoCDCommsControl(byteValue & 1, byteValue & 2); + break; + + case 0x016D: +// bprintf(PRINT_ERROR, _T(" - NGCD port 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); + + MapVectorTable(!(byteValue == 0xFF)); + +//extern INT32 bRunPause; +//bRunPause = 1; + break; + + case 0x016F: +// bprintf(PRINT_IMPORTANT, _T(" - NGCD 0xE00000 area write access %s (0x%02X, PC: 0x%06X)\n"), byteValue ? _T("enabled") : _T("disabled"), byteValue, SekGetPC(-1)); + + nTransferWriteEnable = byteValue; + break; + + case 0x0181: { + static UINT8 clara = 0; + if (!byteValue && clara) { +// bprintf(PRINT_IMPORTANT, _T(" - NGCD CD communication reset (PC: 0x%06X)\n"), SekGetPC(-1)); +// NeoCDCommsReset(); + } + clara = byteValue; + break; + } + case 0x0183: { + static UINT8 clara = 0; + if (!byteValue && clara) { +// bprintf(PRINT_IMPORTANT, _T(" - NGCD Z80 reset (PC: 0x%06X)\n"), SekGetPC(-1)); + //ZetReset(); + } + clara = byteValue; + break; + } + case 0x01A1: + nSpriteTransferBank = (byteValue & 3) << 20; + break; + case 0x01A3: + nADPCMTransferBank = (byteValue & 1) << 19; + break; + + default: { +// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); + } + } +} + +void __fastcall neogeoWriteWordCDROM(UINT32 sekAddress, UINT16 wordValue) +{ +// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); + + switch (sekAddress & 0xFFFE) { + case 0x0002: +// bprintf(PRINT_IMPORTANT, _T(" - NGCD Interrupt mask -> 0x%04X (PC: 0x%06X)\n"), wordValue, SekGetPC(-1)); + nff0002 = wordValue; + +// LC8951RegistersR[1] |= 0x20; + + if (nff0002 & 0x0500) + nNeoCDCyclesIRQPeriod = (INT32)(12000000.0 * nBurnCPUSpeedAdjust / (256.0 * 75.0)); + else + nNeoCDCyclesIRQPeriod = (INT32)(12000000.0 * nBurnCPUSpeedAdjust / (256.0 * 75.0)); + + break; + + case 0x000E: + NeoCDIRQUpdate(wordValue); + break; + + // DMA controller + + case 0x0064: + NeoCDDMAAddress1 &= 0x0000FFFF; + NeoCDDMAAddress1 |= wordValue << 16; + break; + case 0x0066: + NeoCDDMAAddress1 &= 0xFFFF0000; + NeoCDDMAAddress1 |= wordValue; + break; + case 0x0068: + NeoCDDMAAddress2 &= 0x0000FFFF; + NeoCDDMAAddress2 |= wordValue << 16; + break; + case 0x006A: + NeoCDDMAAddress2 &= 0xFFFF0000; + NeoCDDMAAddress2 |= wordValue; + break; + case 0x006C: + NeoCDDMAValue1 = wordValue; + break; + case 0x006E: + NeoCDDMAValue2 = wordValue; + break; + case 0x0070: + NeoCDDMACount &= 0x0000FFFF; + NeoCDDMACount |= wordValue << 16; + break; + case 0x0072: + NeoCDDMACount &= 0xFFFF0000; + NeoCDDMACount |= wordValue; + break; + + case 0x007E: + NeoCDDMAMode = wordValue; +// bprintf(PRINT_NORMAL, _T(" - DMA controller 0x%2X -> 0x%04X (PC: 0x%06X)\n"), sekAddress & 0xFF, wordValue, SekGetPC(-1)); + break; + + // upload DMA controller program + + case 0x0080: + case 0x0082: + case 0x0084: + case 0x0086: + case 0x0088: + case 0x008A: + case 0x008C: + case 0x008E: +// bprintf(PRINT_NORMAL, _T(" - DMA controller program[%02i] -> 0x%04X (PC: 0x%06X)\n"), sekAddress & 0x0F, wordValue, SekGetPC(-1)); + break; + + default: { +// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); + } + } + +} + +// Reads from / writes to the transfer area + +UINT8 __fastcall neogeoReadByteTransfer(UINT32 sekAddress) +{ +// if ((sekAddress & 0x0FFFFF) < 16) +// printf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (byte, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); + + sekAddress ^= 1; + + switch (nActiveTransferArea) { + case 0: // Sprites + return NeoSpriteRAM[nSpriteTransferBank + (sekAddress & 0x0FFFFF)]; + break; + case 1: // ADPCM + return YM2610ADPCMAROM[nNeoActiveSlot][nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)]; + break; + case 4: // Z80 + if ((sekAddress & 0xfffff) >= 0x20000) break; + return NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1]; + break; + case 5: // Text + return NeoTextRAM[(sekAddress & 0x3FFFF) >> 1]; + break; + } + + return ~0; +} + +UINT16 __fastcall neogeoReadWordTransfer(UINT32 sekAddress) +{ +// if ((sekAddress & 0x0FFFFF) < 16) +// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); + + switch (nActiveTransferArea) { + case 0: // Sprites + return *((UINT16*)(NeoSpriteRAM + nSpriteTransferBank + (sekAddress & 0xFFFFF))); + break; + case 1: // ADPCM + return 0xFF00 | YM2610ADPCMAROM[nNeoActiveSlot][nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)]; + break; + case 4: // Z80 + if ((sekAddress & 0xfffff) >= 0x20000) break; + return 0xFF00 | NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1]; + break; + case 5: // Text + return 0xFF00 | NeoTextRAM[(sekAddress & 0x3FFFF) >> 1]; + break; + } + + return ~0; +} + +void __fastcall neogeoWriteByteTransfer(UINT32 sekAddress, UINT8 byteValue) +{ +// if ((sekAddress & 0x0FFFFF) < 16) +// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); + + if (!nTransferWriteEnable) { +// return; + } + + sekAddress ^= 1; + + switch (nActiveTransferArea) { + case 0: // Sprites + NeoSpriteRAM[nSpriteTransferBank + (sekAddress & 0x0FFFFF)] = byteValue; + NeoCDOBJBankUpdate[nSpriteTransferBank >> 20] = true; + break; + case 1: // ADPCM + YM2610ADPCMAROM[nNeoActiveSlot][nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = byteValue; + break; + case 4: // Z80 + if ((sekAddress & 0xfffff) >= 0x20000) break; + NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1] = byteValue; + break; + case 5: // Text + NeoTextRAM[(sekAddress & 0x3FFFF) >> 1] = byteValue; +// NeoUpdateTextOne((sekAddress & 0x3FFFF) >> 1, byteValue); + break; + } +} + +void __fastcall neogeoWriteWordTransfer(UINT32 sekAddress, UINT16 wordValue) +{ +// if ((sekAddress & 0x0FFFFF) < 16) +// bprintf(PRINT_NORMAL, _T(" - Transfer: 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); + + if (!nTransferWriteEnable) { +// return; + } + + switch (nActiveTransferArea) { + case 0: // Sprites + *((UINT16*)(NeoSpriteRAM + nSpriteTransferBank + (sekAddress & 0xFFFFF))) = wordValue; + NeoCDOBJBankUpdate[nSpriteTransferBank >> 20] = true; + break; + case 1: // ADPCM + YM2610ADPCMAROM[nNeoActiveSlot][nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = wordValue; + break; + case 4: // Z80 + // The games that write here, seem to write crap, however the BIOS writes the Z80 code here, and not in the byte area + // So basically, we are allowing writes to here, until the BIOS has finished writing the program, then not allowing any further writes + if (((sekAddress & 0xfffff) >= 0x20000) || nNeoCDZ80ProgWriteWordCancelHack) break; + if (sekAddress == 0xe1fdf2) nNeoCDZ80ProgWriteWordCancelHack = 1; + NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1] = wordValue; + break; + case 5: // Text + NeoTextRAM[(sekAddress & 0x3FFFF) >> 1] = wordValue; +// NeoUpdateTextOne((sekAddress & 0x3FFFF) >> 1, wordValue); + break; + } +} + +// 68K memory + +void __fastcall neogeoWriteWord68KProgram(UINT32 sekAddress, UINT16 wordValue) +{ +// if (sekAddress < 16) +// bprintf(PRINT_NORMAL, _T(" - 68K: 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); + + *((UINT16*)(Neo68KROMActive + sekAddress)) = BURN_ENDIAN_SWAP_INT16(wordValue); + if (sekAddress >= 0x0100) { + *((UINT16*)(NeoVectorActive + sekAddress)) = BURN_ENDIAN_SWAP_INT16(wordValue); + } +} + +void __fastcall neogeoWriteByte68KProgram(UINT32 sekAddress, UINT8 byteValue) +{ +// if (sekAddress < 16) +// bprintf(PRINT_NORMAL, _T(" - 68K: 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); + + Neo68KROMActive[sekAddress ^ 1] = byteValue; + if (sekAddress >= 0x0100) { + NeoVectorActive[sekAddress ^ 1] = byteValue; + } +} + +// ---------------------------------------------------------------------------- + +// for NeoGeo CD (WAV playback) +void wav_exit(); + +static INT32 neogeoReset() +{ + if (nNeoSystemType & NEO_SYS_CART) { + NeoLoad68KBIOS(NeoSystem & 0x1f); + + if (nBIOS == -1 || nBIOS == 23) { + // Write system type & region code into BIOS ROM + *((UINT16*)(Neo68KBIOS + 0x000400)) = BURN_ENDIAN_SWAP_INT16(((NeoSystem & 4) << 13) | (NeoSystem & 0x03)); + } + +#if 1 && defined FBA_DEBUG + if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) != HARDWARE_SNK_DEDICATED_PCB) && (BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_TRACKBALL) { + switch (NeoSystem & 0x1f) { + case 0x00: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Asia/Europe ver. 6 (1 slot) BIOS\n")); break; } + case 0x01: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Asia/Europe ver. 5 (1 slot) BIOS\n")); break; } + case 0x02: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Asia/Europe ver. 3 (4 slot) BIOS\n")); break; } + case 0x03: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS USA ver. 5 (2 slot) BIOS\n")); break; } + case 0x04: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS USA ver. 5 (6 slot) BIOS\n")); break; } + case 0x05: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Japan ver. 6 (? slot) BIOS\n")); break; } + case 0x06: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Japan ver. 5 (? slot) BIOS\n")); break; } + case 0x07: { bprintf(PRINT_IMPORTANT, _T("Emulating using MVS Japan ver. 3 (4 slot) BIOS\n")); break; } + case 0x08: { bprintf(PRINT_IMPORTANT, _T("Emulating using NEO-MVH MV1C BIOS\n")); break; } + case 0x09: { bprintf(PRINT_IMPORTANT, _T("MVS Japan (J3)\n")); break; } + case 0x0a: { bprintf(PRINT_IMPORTANT, _T("Emulating using AES Japan BIOS\n")); break; } + case 0x0b: { bprintf(PRINT_IMPORTANT, _T("Emulating using AES Asia BIOS\n")); break; } + case 0x0c: { bprintf(PRINT_IMPORTANT, _T("Emulating using Development Kit BIOS\n")); break; } + case 0x0d: { bprintf(PRINT_IMPORTANT, _T("Emulating using Deck ver. 6 (Git Ver 1.3) BIOS\n")); break; } + case 0x0e: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 3.0 BIOS\n")); break; } + case 0x0f: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 2.3 BIOS\n")); break; } + case 0x10: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 2.3 (alt) BIOS\n")); break; } + case 0x11: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 2.2 BIOS\n")); break; } + case 0x12: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 2.1 BIOS\n")); break; } + case 0x13: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 2.0 BIOS\n")); break; } + case 0x14: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 1.3 BIOS\n")); break; } + case 0x15: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 1.2 BIOS\n")); break; } + case 0x16: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 1.2 (alt) BIOS\n")); break; } + case 0x17: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 1.1 BIOS\n")); break; } + case 0x18: { bprintf(PRINT_IMPORTANT, _T("Emulating using Universe BIOS ver. 1.0 BIOS\n")); break; } + case 0x19: { bprintf(PRINT_IMPORTANT, _T("Emulating using NeoOpen BIOS v0.1 beta BIOS\n")); break; } + } + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_TRACKBALL) { + bprintf(PRINT_IMPORTANT, _T("Emulating using custom Trackball BIOS\n")); + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) { + bprintf(PRINT_IMPORTANT, _T("Emulating using custom PCB BIOS\n")); + } +#endif + + OldDebugDip[0] = NeoDebugDip[0] = 0; + OldDebugDip[1] = NeoDebugDip[1] = 0; + } + +#if 1 && defined FBA_DEBUG + if (nNeoSystemType & NEO_SYS_CD) { + bprintf(PRINT_IMPORTANT, _T(" - Emulating Neo CD system.\n")); + + // exit WAV object if needed + wav_exit(); + + nNeoCDZ80ProgWriteWordCancelHack = 0; + } +#endif + + NeoSetSystemType(); + + bSRAMWritable = false; + + bNeoEnableGraphics = true; + + bBIOSTextROMEnabled = false; + bZ80BoardROMBankedIn = false; + b68KBoardROMBankedIn = true; + + nNeoPaletteBank = -1; + + nSpriteFrameSpeed = 4; + nSpriteFrameTimer = 0; + nNeoSpriteFrame = 0; + + nIRQAcknowledge = ~0; + bIRQEnabled = false; + + nSoundLatch = 0x00; + nSoundReply = 0x00; + nSoundStatus = 1; + +#if 1 && defined USE_SPEEDHACKS + nSoundPrevReply = -1; +#endif + + nIRQOffset = 0; + nIRQControl = 0; + + nInputSelect = 0; + NeoInputBank = NeoInput; + + nCyclesExtra[0] = nCyclesExtra[1] = 0; + + { + SekOpen(0); + ZetOpen(0); + + if (nNeoSystemType & NEO_SYS_MVS) { + for (INT32 a = 0xD00000; a < 0xE00000; a += 0x010000) { + SekMapMemory(NeoNVRAM, a, a + 0xFFFF, SM_RAM); // 68K RAM + } + SekMapHandler(1, 0xD00000, 0xDFFFFF, SM_WRITE); // + } else { + SekMapHandler(0, 0xD00000, 0xDFFFFF, SM_RAM); // AES/NeoCD don't have the SRAM + } + + if (nNeoSystemType & NEO_SYS_CART) { + NeoMapActiveCartridge(); + } + + if (nNeoSystemType & NEO_SYS_PCB) { + if (BurnDrvGetHardwareCode() & HARDWARE_SNK_KOF2K3) { + SekMapMemory(Neo68KBIOS, 0xC00000, 0xC7FFFF, SM_ROM); + SekMapMemory(Neo68KBIOS, 0xC80000, 0xCFFFFF, SM_ROM); + } else { + for (INT32 a = 0xC00000; a < 0xD00000; a += 0x020000) { + SekMapMemory(Neo68KBIOS + (NeoSystem & 0x03) * 0x020000, a, a + 0x01FFFF, SM_ROM); + } + } + } + + // Set by a switch on the PCB + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "svcpcb") || !strcmp(BurnDrvGetTextA(DRV_NAME), "svcpcba") || !strcmp(BurnDrvGetTextA(DRV_NAME), "svcpcbnd") || !strcmp(BurnDrvGetTextA(DRV_NAME), "ms5pcb") || !strcmp(BurnDrvGetTextA(DRV_NAME), "ms5pcbnd")) { + SekMapMemory(Neo68KBIOS + 0x20000 * (~NeoSystem & 1), 0xc00000, 0xc1ffff, SM_ROM); + } + + MapVectorTable(true); + + if (nNeoSystemType & NEO_SYS_CD) { + nActiveTransferArea = -1; + nSpriteTransferBank = -1; + nADPCMTransferBank = -1; + + NeoCDCommsReset(); + + nTransferWriteEnable = 0; + + NeoSetTextSlot(0); + NeoSetSpriteSlot(0); + + memset(NeoCDOBJBankUpdate, 0, sizeof(NeoCDOBJBankUpdate)); + + LC8951Reset(); + } + + ZetSetBUSREQLine(0); + + SekReset(); + ZetReset(); + + MapPalette(0); + + ZetClose(); + SekClose(); + } + + ZetOpen(0); + BurnYM2610Reset(); + ZetClose(); + +#if defined EMULATE_WATCHDOG + nNeoWatchdog = 0; +#endif + + nIRQCycles = NO_IRQ_PENDING; + + nNeoCDIRQVector = 0; + nNeoCDIRQVectorAck = 0; + nff0002 = 0; + + return 0; +} + +static void SwitchToMusashi() +{ + if (bBurnUseASMCPUEmulation) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); +#endif + bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; + bBurnUseASMCPUEmulation = false; + } +} + +static INT32 NeoInitCommon() +{ + BurnSetRefreshRate(NEO_VREFRESH); + INT32 nNeoScreenHeight; // not used + BurnDrvGetFullSize(&nNeoScreenWidth, &nNeoScreenHeight); + + if (nNeoSystemType & NEO_SYS_CART) { + nVBLankIRQ = 1; + nScanlineIRQ = 2; + } else { + nVBLankIRQ = 2; + nScanlineIRQ = 1; + } + + // Allocate all memory is needed for RAM + { + INT32 nLen; + + RAMIndex(); // Get amount of memory needed + nLen = RAMEnd - (UINT8*)0; + if ((AllRAM = (UINT8*)BurnMalloc(nLen)) == NULL) { // Allocate memory + return 1; + } + memset(AllRAM, 0, nLen); // Initialise memory + RAMIndex(); // Index the allocated memory + } + + if (nNeoSystemType & NEO_SYS_CD) { + SwitchToMusashi(); + } + + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + ZetInit(0); + ZetOpen(0); + + { + if (nNeoSystemType & NEO_SYS_CD) { + SekSetIrqCallback(NeoCDIRQCallback); + } + + SekSetCyclesScanline((INT32)(12000000.0 / NEO_HREFRESH)); + + // Map 68000 memory: + + if (nNeoSystemType & NEO_SYS_CART) { + + for (INT32 a = 0x100000; a < 0x200000; a += 0x010000) { + SekMapMemory(Neo68KRAM, a, a + 0xFFFF, SM_RAM); // 68K RAM + } + + if (!(nNeoSystemType & NEO_SYS_PCB)) { +// for (INT32 a = 0xC00000; a < 0xD00000; a += 0x020000) { +// SekMapMemory(Neo68KBIOS, a, a + 0x01FFFF, SM_ROM); // MVS/AES BIOS ROM +// } + SekMapMemory(Neo68KBIOS, 0xC00000, 0xC7FFFF, SM_ROM); // BIOS ROM + } + + } else { + SekMapMemory(Neo68KFix[0], 0x000000, 0x1FFFFF, SM_RAM); // Main 68K RAM + SekMapMemory(Neo68KBIOS, 0xC00000, 0xC7FFFF, SM_ROM); // NeoCD BIOS ROM + SekMapMemory(Neo68KBIOS, 0xC80000, 0xCFFFFF, SM_ROM); // + } + + SekSetReadWordHandler(0, neogeoReadWord); + SekSetReadByteHandler(0, neogeoReadByte); + SekSetWriteWordHandler(0, neogeoWriteWord); + SekSetWriteByteHandler(0, neogeoWriteByte); + + SekSetWriteWordHandler(1, neogeoWriteWordSRAM); + SekSetWriteByteHandler(1, neogeoWriteByteSRAM); + + if (!(nNeoSystemType & NEO_SYS_PCB)) { + SekMapHandler(2, 0x800000, 0xBFFFFF, SM_ROM); // Memory card + SekMapHandler(2, 0x800000, 0xBFFFFF, SM_WRITE); // + + SekSetReadByteHandler(2, neogeoReadByteMemoryCard); + SekSetWriteByteHandler(2, neogeoWriteByteMemoryCard); + } + + SekMapHandler(3, 0x400000, 0x7FFFFF, SM_WRITE); // Palette + + SekSetWriteWordHandler(3, NeoPalWriteWord); + SekSetWriteByteHandler(3, NeoPalWriteByte); + + // Set up mirrors + for (INT32 a = 0x420000; a < 0x800000; a += 0x2000) { + SekMapMemory(NeoPalSrc[0], a, a + 0x1FFF, SM_ROM); + } + + SekMapHandler(5, 0x3C0000, 0x3DFFFF, SM_RAM); // Read Video Controller + SekSetReadWordHandler(5, neogeoReadWordVideo); + SekSetReadByteHandler(5, neogeoReadByteVideo); + SekSetWriteWordHandler(5, neogeoWriteWordVideo); + SekSetWriteByteHandler(5, neogeoWriteByteVideo); + + if (nNeoSystemType & NEO_SYS_CD) { + SekMapHandler(4, 0x000000, 0x0003FF, SM_WRITE); + + SekSetWriteWordHandler(4, neogeoWriteWord68KProgram); + SekSetWriteByteHandler(4, neogeoWriteByte68KProgram); + + SekMapHandler(6, 0xE00000, 0xEFFFFF, SM_RAM); + + SekSetReadWordHandler(6, neogeoReadWordTransfer); + SekSetReadByteHandler(6, neogeoReadByteTransfer); + SekSetWriteWordHandler(6, neogeoWriteWordTransfer); + SekSetWriteByteHandler(6, neogeoWriteByteTransfer); + + SekMapHandler(7, 0xF00000, 0xFFFFFF, SM_RAM); + + SekSetReadWordHandler(7, neogeoReadWordCDROM); + SekSetReadByteHandler(7, neogeoReadByteCDROM); + SekSetWriteWordHandler(7, neogeoWriteWordCDROM); + SekSetWriteByteHandler(7, neogeoWriteByteCDROM); + + SekSetReadByteHandler(2, neoCDReadByteMemoryCard); + SekSetWriteByteHandler(2, neoCDWriteByteMemoryCard); + + } + } + + { + // Z80 setup + + if (nNeoSystemType & NEO_SYS_CART) { + // Work RAM + ZetMapArea(0xF800, 0xFFFF, 0, NeoZ80RAM); + ZetMapArea(0xF800, 0xFFFF, 1, NeoZ80RAM); + ZetMapArea(0xF800, 0xFFFF, 2, NeoZ80RAM); + + + ZetSetInHandler(neogeoZ80In); + ZetSetOutHandler(neogeoZ80Out); + } + + if (nNeoSystemType & NEO_SYS_CD) { + // Main Z80 RAM + ZetMapArea(0x0000, 0xFFFF, 0, NeoZ80ROMActive); + ZetMapArea(0x0000, 0xFFFF, 1, NeoZ80ROMActive); + ZetMapArea(0x0000, 0xFFFF, 2, NeoZ80ROMActive); + + + ZetSetInHandler(neogeoZ80InCD); + ZetSetOutHandler(neogeoZ80Out); + } + } + + ZetClose(); + SekClose(); + +#if defined USE_SPEEDHACKS + bRenderLineByLine = false; +#else + bRenderLineByLine = false; +#endif + +#if defined RASTER_KLUDGE + nScanlineOffset = 0xF8; // correct as verified on MVS hardware +#endif + + // These games rely on reading the line counter for synchronising raster effects + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "mosyougi")) { + bRenderLineByLine = true; + +#if defined RASTER_KLUDGE + nScanlineOffset = 0xFB; +#endif + + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "neodrift")) { + bRenderLineByLine = true; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "zedblade")) { + bRenderLineByLine = true; + } +// if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ssideki2")) { +// bRenderLineByLine = true; +// } + + nNeoControlConfig = BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK; + + // Hook up standard joysticks to all ports + for (INT32 i = 0; i < 8; i++) { + nJoyport0[i] = 0; + nJoyport1[i] = 1; + } + + if (nNeoSystemType & NEO_SYS_CD) { + nJoyport0[4] = 16; + nJoyport1[4] = 17; + } else { + // Override for special controllers + switch (nNeoControlConfig) { + case HARDWARE_SNK_PADDLE: // Two Paddles + joysticks + nJoyport0[0] = 6; + nJoyport1[0] = 7; + break; + case HARDWARE_SNK_TRACKBALL: // Trackball controller + nJoyport0[0] = 6; + nJoyport0[1] = 7; + break; + case HARDWARE_SNK_MAHJONG: // Mahjong controller + nJoyport0[1] = 16; + nJoyport0[2] = 17; + nJoyport0[4] = 18; + break; + } + } + +#if defined Z80_SPEED_ADJUST + nZ80Clockspeed = 4000000; +#endif + + if (nNeoSystemType & NEO_SYS_CART) { + BurnYM2610Init(8000000, YM2610ADPCMAROM[0], &nYM2610ADPCMASize[0], YM2610ADPCMBROM[0], &nYM2610ADPCMBSize[0], &neogeoFMIRQHandler, neogeoSynchroniseStream, neogeoGetTime, 0); + } else { + BurnYM2610Init(8000000, YM2610ADPCMBROM[0], &nYM2610ADPCMBSize[0], YM2610ADPCMBROM[0], &nYM2610ADPCMBSize[0], &neogeoFMIRQHandler, neogeoSynchroniseStream, neogeoGetTime, 0); + } + + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); + + BurnTimerAttachZet(nZ80Clockspeed); + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { + for (nNeoActiveSlot = 0; nNeoActiveSlot < MAX_SLOT; nNeoActiveSlot++) { + if (nBurnDrvSelect[nNeoActiveSlot] < nBurnDrvCount) { +// NeoInitText(nNeoActiveSlot); +// NeoInitSprites(nNeoActiveSlot); + } + } + + NeoInitText(-1); + + } else { + NeoInitText(0); + NeoInitText(-1); + NeoInitSprites(0); + } + + if (nNeoSystemType & NEO_SYS_CART) { + ZetOpen(0); + nZ80Bank0 = nZ80Bank1 = nZ80Bank2 = nZ80Bank3 = -1; + NeoZ80SetBank0(0x02); + NeoZ80SetBank1(0x06); + NeoZ80SetBank2(0x0E); + NeoZ80SetBank3(0x1E); + + NeoZ80MapROM(false); + ZetClose(); + } + + NeoInitPalette(); + + uPD4990AInit(12000000); + nPrevBurnCPUSpeedAdjust = -1; + + if (nNeoSystemType & NEO_SYS_CD) { + bMemoryCardInserted = true; + bMemoryCardWritable = true; + } else { + bMemoryCardInserted = false; + bMemoryCardWritable = false; + } + + nNeoActiveSlot = 0; + neogeoReset(); // Reset machine + + return 0; +} + +static bool recursing = false; + +INT32 NeoInit() +{ + if (recursing) { + if (LoadRoms()) { + return 1; + } + return 0; + } + + recursing = true; + + nNeoSystemType = NEO_SYS_CART; + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) { + nNeoSystemType |= NEO_SYS_MVS | NEO_SYS_PCB; + } + + nNeoActiveSlot = 0; + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { + UINT32 nDriver = nBurnDrvActive; + +// memset(NeoCallback, 0, sizeof(NeoCallback)); + + for (nNeoActiveSlot = 0; nNeoActiveSlot < MAX_SLOT; nNeoActiveSlot++) { + + if (nBurnDrvSelect[nNeoActiveSlot] < nBurnDrvCount) { + + nBurnDrvActive = nBurnDrvSelect[nNeoActiveSlot]; + NeoCallbackActive = &NeoCallback[nNeoActiveSlot]; + + if (BurnDrvCartridgeSetup(CART_INIT_START)) { + return 1; + } + + NeoInitText(nNeoActiveSlot); + NeoInitSprites(nNeoActiveSlot); + } + } + + for (nNeoNumSlots = 5; nNeoNumSlots > 0 && nBurnDrvSelect[nNeoNumSlots] >= nBurnDrvCount; nNeoNumSlots--) { } + + switch (nNeoNumSlots) { + case 0: + nNeoNumSlots = 1; + break; + case 1: + nNeoNumSlots = 2; + break; + case 2: + case 3: + nNeoNumSlots = 4; + break; + case 4: + case 5: + nNeoNumSlots = 6; + break; + } + + nBurnDrvActive = nDriver; + + if (BurnDrvCartridgeSetup(CART_INIT_END)) { + return 1; + } + + } else { + if (LoadRoms()) { + return 1; + } + } + + recursing = false; + + for (nNeoActiveSlot = 0; nNeoActiveSlot < nNeoNumSlots; nNeoActiveSlot++) { + NeoVector[nNeoActiveSlot] = (UINT8*)BurnMalloc(0x0400); + if (NeoVector[nNeoActiveSlot] == NULL) { + return 1; + } + memset(NeoVector[nNeoActiveSlot], 0, 0x0400); + } + + // Allocate all memory needed for ROM + { + INT32 nLen; + + ROMIndex(); // Get amount of memory needed + nLen = ROMEnd - (UINT8*)0; + if ((AllROM = (UINT8*)BurnMalloc(nLen)) == NULL) { // Allocate memory + return 1; + } + memset(AllROM, 0, nLen); // Initialise memory + ROMIndex(); // Index the allocated memory + } + + if (nNeoSystemType & NEO_SYS_PCB) { + BurnLoadRom(Neo68KBIOS, 0x00080 + 27, 1); + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { + BurnLoadRom(NeoZ80BIOS, 0x00000 + 28, 1); + BurnLoadRom(NeoTextROMBIOS, 0x00000 + 29, 1); + BurnLoadRom(NeoZoomROM, 0x00000 + 30, 1); + } else { + + // Still load the Z80 BIOS & text layer data for AES systems, since it might be switched to MVS later + + if (nNeoSystemType & NEO_SYS_PCB) { + bZ80BIOS = false; + BurnLoadRom(NeoTextROMBIOS, 0x00080 + 29, 1); + BurnLoadRom(NeoZoomROM, 0x00080 + 30, 1); + } else { + BurnLoadRom(NeoZ80BIOS, 0x00080 + 28, 1); + BurnLoadRom(NeoTextROMBIOS, 0x00080 + 29, 1); + BurnLoadRom(NeoZoomROM, 0x00080 + 30, 1); + } + } + BurnUpdateProgress(0.0, _T("Preprocessing text layer graphics...")/*, BST_PROCESS_TXT*/, 0); + NeoDecodeTextBIOS(0, 0x020000, NeoTextROMBIOS); + + nBIOS = 9999; + if (NeoLoad68KBIOS(NeoSystem & 0x1f)) { + return 1; + } + + return NeoInitCommon(); +} + +INT32 NeoCDInit() +{ + recursing = false; + + nNeoSystemType = NEO_SYS_CD; + + nCodeSize[0] = 0x200000; + nSpriteSize[0] = 0x400000; + nNeoTextROMSize[0] = 0x020000; + nYM2610ADPCMASize[0] = 0; + nYM2610ADPCMBSize[0] = 0x100000; + + // Allocate all memory is needed for ROM + { + INT32 nLen; + + ROMIndex(); // Get amount of memory needed + nLen = ROMEnd - (UINT8*)0; + if ((AllROM = (UINT8*)BurnMalloc(nLen)) == NULL) { // Allocate memory + return 1; + } + memset(AllROM, 0, nLen); // Initialise memory + ROMIndex(); // Index the allocated memory + } + + Neo68KROMActive = Neo68KROM[0]; + NeoVectorActive = NeoVector[0]; + NeoZ80ROMActive = NeoZ80ROM[0]; + + Neo68KFix[0] = Neo68KROM[0]; + + BurnLoadRom(Neo68KBIOS, 0, 1); + BurnLoadRom(NeoZoomROM, 1, 1); + + // Create copy of 68K with BIOS vector table + memcpy(NeoVectorActive + 0x00, Neo68KBIOS, 0x0100); + + // Create a default program for the Z80 + NeoZ80ROMActive[0] = 0xC3; // JP 0 + NeoZ80ROMActive[1] = 0x00; // + NeoZ80ROMActive[2] = 0x00; // + + bZ80BIOS = false; + + for (nNeoTileMask[0] = 1; nNeoTileMask[0] < nSpriteSize[0]; nNeoTileMask[0] <<= 1) { } + nNeoTileMask[0] = (nNeoTileMask[0] >> 7) - 1; + nNeoMaxTile[0] = nSpriteSize[0] >> 7; + + return NeoInitCommon(); +} + +INT32 NeoExit() +{ + if (recursing) { + return 0; + } + + recursing = true; + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) { + UINT32 nDriver = nBurnDrvActive; + + for (nNeoActiveSlot = 0; nNeoActiveSlot < MAX_SLOT; nNeoActiveSlot++) { + + if (nBurnDrvSelect[nNeoActiveSlot] < nBurnDrvCount) { + + nBurnDrvActive = nBurnDrvSelect[nNeoActiveSlot]; + + if (BurnDrvCartridgeSetup(CART_EXIT)) { + return 1; + } + } + } + + nBurnDrvActive = nDriver; + } + + uPD4990AExit(); + + NeoExitPalette(); + + BurnYM2610Exit(); + + ZetExit(); // Deallocate Z80 + SekExit(); // Deallocate 68000 + + if (nNeoSystemType & NEO_SYS_CART) { + + // Deallocate all used memory + + for (nNeoActiveSlot = 0; nNeoActiveSlot < MAX_SLOT; nNeoActiveSlot++) { + + NeoExitSprites(nNeoActiveSlot); + NeoExitText(nNeoActiveSlot); + + BurnFree(NeoTextROM[nNeoActiveSlot]); // Text ROM + nNeoTextROMSize[nNeoActiveSlot] = 0; + + BurnFree(NeoSpriteROM[nNeoActiveSlot]); // Sprite ROM + BurnFree(Neo68KROM[nNeoActiveSlot]); // 68K ROM + BurnFree(NeoVector[nNeoActiveSlot]); // 68K vectors + BurnFree(NeoZ80ROM[nNeoActiveSlot]); // Z80 ROM + BurnFree(YM2610ADPCMAROM[nNeoActiveSlot]); + BurnFree(YM2610ADPCMBROM[nNeoActiveSlot]); + } + } + + if (nNeoSystemType & NEO_SYS_CD) { + NeoExitSprites(0); + NeoExitText(0); + } + + BurnFree(AllROM); // Misc ROM + BurnFree(AllRAM); // Misc RAM + + memset(NeoCallback, 0, sizeof(NeoCallback)); + NeoCallbackActive = &NeoCallback[0]; + + nNeoTextROMSize[0] = 0; + + nBIOS = 9999; + + nNeoActiveSlot = 0; + NeoVectorActive = NULL; + Neo68KROMActive = NULL; + NeoZ80ROMActive = NULL; + + nCodeSize[0] = 0; + + nNeoCDZ80ProgWriteWordCancelHack = 0; + + // Switch back CPU core if needed + if (nNeoSystemType & NEO_SYS_CD) { + if (bUseAsm68KCoreOldValue) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); +#endif + bUseAsm68KCoreOldValue = false; + bBurnUseASMCPUEmulation = true; + } + } + + recursing = false; + + bDisableNeoWatchdog = false; + + // release the NeoGeo CD information object if needed + NeoCDInfo_Exit(); + + return 0; +} + +INT32 NeoRender() +{ + NeoUpdatePalette(); // Update the palette + NeoClearScreen(); + + if (bNeoEnableGraphics) { + nSliceStart = 0x10; nSliceEnd = 0xF0; + nSliceSize = nSliceEnd - nSliceStart; + +#if 0 || defined LOG_DRAW + bprintf(PRINT_NORMAL, _T(" -- Drawing slice: %3i - %3i.\n"), nSliceStart, nSliceEnd); +#endif + + NeoRenderSprites(); // Render sprites + NeoRenderText(); // Render text layer + } + + return 0; +} + +inline static void NeoClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0C) == 0x0C) { + *nJoystickInputs &= ~0x0C; + } +} + +static void NeoStandardInputs(INT32 nBank) +{ + if (nBank) { + NeoInput[ 8] = 0x00; // Player 1 + NeoInput[ 9] = 0x00; // Player 2 + NeoInput[10] = 0x00; // Buttons + NeoInput[11] = 0x00; // + for (INT32 i = 0; i < 8; i++) { + NeoInput[ 8] |= (NeoJoy3[i] & 1) << i; + NeoInput[ 9] |= (NeoJoy4[i] & 1) << i; + NeoInput[10] |= (NeoButton3[i] & 1) << i; + NeoInput[11] |= (NeoButton4[i] & 1) << i; + } + NeoClearOpposites(&NeoInput[ 8]); + NeoClearOpposites(&NeoInput[ 9]); + + if (NeoDiag[1]) { + NeoInput[13] |= 0x80; + } + } else { + NeoInput[ 0] = 0x00; // Player 1 + NeoInput[ 1] = 0x00; // Player 2 + NeoInput[ 2] = 0x00; // Buttons + NeoInput[ 3] = 0x00; // + for (INT32 i = 0; i < 8; i++) { + NeoInput[ 0] |= (NeoJoy1[i] & 1) << i; + NeoInput[ 1] |= (NeoJoy2[i] & 1) << i; + NeoInput[ 2] |= (NeoButton1[i] & 1) << i; + NeoInput[ 3] |= (NeoButton2[i] & 1) << i; + } + NeoClearOpposites(&NeoInput[ 0]); + NeoClearOpposites(&NeoInput[ 1]); + + if (NeoDiag[0]) { + NeoInput[ 5] |= 0x80; + } + } +} + +#if 1 +#define NeoSekRun SekRun +#else +static INT32 NeoSekRun(const INT32 nCycles) +{ + INT32 nCyclesExecutedTotal = 0, nOldCyclesSegment = nCyclesSegment; + + if (!(nNeoSystemType & NEO_SYS_CD) || !(nff0002 & 0x0050)) + return SekRun(nCycles); + +//bprintf(PRINT_NORMAL, _T("***\n")); + + while (nCyclesExecutedTotal < nCycles) { + + INT32 nCyclesExecuted; + + if (nNeoCDCyclesIRQ <= 0) { + nNeoCDCyclesIRQ += nNeoCDCyclesIRQPeriod; + + // Trigger CD mechanism communication interrupt +//bprintf(PRINT_NORMAL, _T(" DECI status %i\n"), (LC8951RegistersR[1] & 0x20) >> 5); + + nIRQAcknowledge &= ~0x10; + NeoCDIRQUpdate(0); + + if ((nff0002 & 0x0500) && (LC8951RegistersR[1] & 0x20)) + NeoCDReadSector(); + } + + nCyclesSegment = (nNeoCDCyclesIRQ < (nCycles - nCyclesExecutedTotal)) ? nNeoCDCyclesIRQ : (nCycles - nCyclesExecutedTotal); + nCyclesExecuted = SekRun(nCyclesSegment); + +//bprintf(PRINT_NORMAL, _T("%010i %010i %010i %010i\n"), nCycles, nCyclesExecutedTotal, nCyclesExecuted, nNeoCDCyclesIRQ); + + nCyclesExecutedTotal += nCyclesExecuted; + nNeoCDCyclesIRQ -= nCyclesExecuted; + + } + + nCyclesSegment = nOldCyclesSegment; + + return nCyclesExecutedTotal; +} +#endif + +INT32 NeoFrame() +{ + if (NeoReset) { // Reset machine + if (nNeoSystemType & NEO_SYS_CART) { + memset(Neo68KRAM, 0, 0x010000); + } + + neogeoReset(); + } + + NeoInput[ 5] &= 0x1F; // Clear ports + NeoInput[13] = 0x00; // + + switch (nNeoControlConfig) { + case HARDWARE_SNK_PADDLE: { // Two Paddles + joysticks + + NeoStandardInputs(0); + + // Handle analog controls + nAnalogAxis[0] -= NeoAxis[0]; + nAnalogAxis[1] -= NeoAxis[1]; + NeoInput[6] = (nAnalogAxis[0] >> 8) & 0xFF; + NeoInput[7] = (nAnalogAxis[1] >> 8) & 0xFF; + + break; + } + + case HARDWARE_SNK_TRACKBALL: { // Trackball controller + NeoInput[1] = 0x00; // Buttons + NeoInput[2] = 0x00; // + NeoInput[3] = 0x00; // + for (INT32 i = 0; i < 8; i++) { + NeoInput[1] |= (NeoJoy2[i] & 1) << i; + NeoInput[2] |= (NeoButton1[i] & 1) << i; + NeoInput[3] |= (NeoButton2[i] & 1) << i; + } + // Handle analog controls + nAnalogAxis[0] += NeoAxis[0]; + nAnalogAxis[1] += NeoAxis[1]; + NeoInput[6] = (nAnalogAxis[0] >> 8) & 0xFF; + NeoInput[7] = (nAnalogAxis[1] >> 8) & 0xFF; + + if (NeoDiag[0]) { + NeoInput[5] |= 0x80; + } + + break; + } + + case HARDWARE_SNK_4_JOYSTICKS: { // Four joystick controllers + + NeoStandardInputs(0); + NeoStandardInputs(1); + + break; + } + + case HARDWARE_SNK_MAHJONG: { // Mahjong controller + + NeoStandardInputs(0); + + NeoInput[16] = 0x00; + NeoInput[17] = 0x00; + NeoInput[18] = 0x00; + for (INT32 i = 0; i < 7; i++) { + NeoInput[16] |= (NeoButton1[i + 8] & 1) << i; + NeoInput[17] |= (NeoButton1[i + 16] & 1) << i; + NeoInput[18] |= (NeoButton1[i + 24] & 1) << i; + } + + break; + } + + case HARDWARE_SNK_GAMBLING: { // Gambling configuration + + NeoStandardInputs(0); + +/* NeoInput[16] = 0x00; + for (INT32 i = 0; i < 7; i++) { + NeoInput[16] |= (NeoButton1[i + 16] & 1) << i; + }*/ + + break; + } + + default: { // Two joystick controllers + NeoStandardInputs(0); + } + } + + if (nNeoSystemType & NEO_SYS_CART) { + + bMemoryCardWritable = (NeoSystem & 0x80); + + if (bMemoryCardInserted) { + NeoInput[2] |= 0x30; // JEIDA connector pen /CD1, /READY + if (bMemoryCardWritable) { + NeoInput[2] |= 0x40; // JEIDA connector pen /WP + } + } + + if (nNeoSystemType & NEO_SYS_AES) { // Report the type of hardware + NeoInput[2] |= 0x80; + } + + if (nNeoControlConfig != HARDWARE_SNK_GAMBLING) { + if (nNeoSystemType & NEO_SYS_MVS) { // Report the appropriate number of slots on MVS hardware + switch (nNeoNumSlots) { + case 4: + NeoInput[ 5] &= ~0x40; + NeoInput[ 3] |= 0x20; + break; + case 6: + NeoInput[ 5] &= ~0x40; + NeoInput[ 3] &= ~0x20; + break; + default: + + // Default to 1/2 slot hardware + + NeoInput[ 5] |= 0x40; + NeoInput[ 3] |= 0x20; + } + } + } + + if (OldDebugDip[0] != NeoDebugDip[0]) { + SekOpen(0); + SekWriteByte(SekReadLong(0x010E) + 0, NeoDebugDip[0]); + SekClose(); + OldDebugDip[0] = NeoDebugDip[0]; + } + if (OldDebugDip[1] != NeoDebugDip[1]) { + SekOpen(0); + SekWriteByte(SekReadLong(0x010E) + 1, NeoDebugDip[1]); + SekClose(); + OldDebugDip[1] = NeoDebugDip[1]; + } + } else { + NeoInput[2] |= 0x70; + + NeoInput[16] = 0x00; + NeoInput[17] = 0x00; + + if (NeoDiag[0]) { + NeoInput[16] = (UINT8)~0xDA; + } + } + + if (nPrevBurnCPUSpeedAdjust != nBurnCPUSpeedAdjust) { + // 68K CPU clock is 12MHz, modified by nBurnCPUSpeedAdjust + nCyclesTotal[0] = (INT32)((INT64)12000000 * nBurnCPUSpeedAdjust / (256.0 * NEO_VREFRESH)); + +#if defined Z80_SPEED_ADJUST + // Z80 CPU clock always 68K / 3 + nCyclesTotal[1] = nCyclesTotal[0] / 3; + nZ80Clockspeed = (INT32)((INT64)4000000 * nBurnCPUSpeedAdjust / 256); + BurnTimerAttachZet(nZ80Clockspeed); +#else + // Z80 CPU clock is always 4MHz + nCyclesTotal[1] = 4000000.0 / NEO_VREFRESH; +#endif + // 68K cycles executed each scanline + SekOpen(0); + SekSetCyclesScanline((INT32)(12000000.0 * nBurnCPUSpeedAdjust / (256.0 * NEO_HREFRESH))); + SekClose(); + + // uPD499A ticks per second (same as 68K clock) + uPD499ASetTicks((INT64)12000000 * nBurnCPUSpeedAdjust / 256); + + nPrevBurnCPUSpeedAdjust = nBurnCPUSpeedAdjust; + } + +#if defined EMULATE_WATCHDOG + // If the watchdog isn't reset every 8 frames, reset the system + // This can't be 100% accurate, as the 68000 instruction timings are not 100% + if ((nNeoSystemType & NEO_SYS_CART) && nNeoWatchdog > nCyclesTotal[0] * 8) { + if (bDisableNeoWatchdog == false) { +#if 1 && defined FBA_DEBUG + SekOpen(0); + bprintf(PRINT_IMPORTANT, _T(" ** Watchdog triggered system reset (PC: 0x%06X)\n"), SekGetPC(-1)); + SekClose(); +#endif + neogeoReset(); + } + } +#endif +//bprintf(PRINT_NORMAL, _T("***\n")); + + bRenderImage = false; + bForceUpdateOnStatusRead = false; + + if (pBurnDraw) { + NeoUpdatePalette(); // Update the palette + NeoClearScreen(); + } + nSliceEnd = 0x10; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + // Compensate for extra cycles executed + SekIdle(nCyclesExtra[0]); + ZetIdle(nCyclesExtra[1]); + + nuPD4990ATicks = nCyclesExtra[0]; + + // Run 68000 + + + if ((nNeoSystemType & NEO_SYS_CD) && (nff0002 & 0x0050)) { + nIRQAcknowledge &= ~0x10; + NeoCDIRQUpdate(0); + + if (nff0002 & 0x0500) { + NeoCDReadSector(); + } + } + + + nCyclesSegment = nSekCyclesScanline * 24; + while (SekTotalCycles() < nCyclesSegment) { + + if ((nIRQControl & 0x10) && (nIRQCycles < NO_IRQ_PENDING) && (SekTotalCycles() >= nIRQCycles)) { + + nIRQAcknowledge &= ~2; + SekSetIRQLine(nScanlineIRQ, SEK_IRQSTATUS_ACK); + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ triggered (line %3i + %3i cycles).\n"), SekCurrentScanline(), SekTotalCycles() - SekCurrentScanline() * SekCyclesScanline()); +#endif + + if (nIRQControl & 0x80) { + nIRQCycles += NeoConvertIRQPosition(nIRQOffset + 1); + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ Line -> %3i (at line %3i, autoload).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); +#endif + + } + } + + if (nCyclesSegment < nIRQCycles || SekTotalCycles() >= nIRQCycles) { + NeoSekRun(nCyclesSegment - SekTotalCycles()); + } else { + NeoSekRun(nIRQCycles - SekTotalCycles()); + } + } + + bRenderImage = pBurnDraw != NULL && bNeoEnableGraphics; + bForceUpdateOnStatusRead = bRenderImage && bRenderLineByLine; + bForcePartialRender = false; + + // Display starts here + + nCyclesVBlank = nSekCyclesScanline * 248; + if (bRenderLineByLine) { + INT32 nLastIRQ = nIRQCycles - 1; + while (SekTotalCycles() < nCyclesVBlank) { + + if ((nIRQControl & 0x10) && (nIRQCycles < NO_IRQ_PENDING) && (nLastIRQ < nIRQCycles) && (SekTotalCycles() >= nIRQCycles)) { + nLastIRQ = nIRQCycles; + nIRQAcknowledge &= ~2; + SekSetIRQLine(nScanlineIRQ, SEK_IRQSTATUS_ACK); +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ triggered (line %3i + %3i cycles).\n"), SekCurrentScanline(), SekTotalCycles() - SekCurrentScanline() * SekCyclesScanline()); +#endif + + if (nIRQControl & 0x80) { + nIRQCycles += NeoConvertIRQPosition(nIRQOffset + 1); +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ Line -> %3i (at line %3i, autoload).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); +#endif + + } + + bForcePartialRender = bRenderImage; + if (bForcePartialRender) { + nSliceStart = nSliceEnd; + nSliceEnd = SekCurrentScanline() - 5; + } + } else { + if (bForcePartialRender) { + nSliceStart = nSliceEnd; + nSliceEnd = SekCurrentScanline() - 6; + } + } + + if (bForcePartialRender) { + + if (nSliceEnd > 240) { + nSliceEnd = 240; + } + nSliceSize = nSliceEnd - nSliceStart; + if (nSliceSize > 0) { + +#if 0 || defined LOG_DRAW + bprintf(PRINT_NORMAL, _T(" -- Drawing slice: %3i - %3i.\n"), nSliceStart, nSliceEnd); +#endif + + NeoRenderSprites(); // Render sprites + } + } + + bForcePartialRender = false; + + if (SekTotalCycles() >= nCyclesSegment) { + nCyclesSegment += nSekCyclesScanline; + } + if (nCyclesSegment < nIRQCycles || SekTotalCycles() >= nIRQCycles) { + NeoSekRun(nCyclesSegment - SekTotalCycles()); + } else { + NeoSekRun(nIRQCycles - SekTotalCycles()); + } + } + } else { + nCyclesSegment = nCyclesVBlank; + while (SekTotalCycles() < nCyclesVBlank) { + + if ((nIRQControl & 0x10) && (nIRQCycles < NO_IRQ_PENDING) && (SekTotalCycles() >= nIRQCycles)) { + nIRQAcknowledge &= ~2; + SekSetIRQLine(nScanlineIRQ, SEK_IRQSTATUS_ACK); + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ triggered (line %3i + %3i cycles).\n"), SekCurrentScanline(), SekTotalCycles() - SekCurrentScanline() * SekCyclesScanline()); +#endif + + if (nIRQControl & 0x80) { + nIRQCycles += NeoConvertIRQPosition(nIRQOffset + 1); + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ Line -> %3i (at line %3i, autoload).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); +#endif + + } + + bForcePartialRender = bRenderImage; + } + +#if defined RASTERS_OPTIONAL + if (bAllowRasters) { +#endif + if (bForcePartialRender) { + + nSliceStart = nSliceEnd; + nSliceEnd = SekCurrentScanline() - 5; + + if (nSliceEnd > 240) { + nSliceEnd = 240; + } + nSliceSize = nSliceEnd - nSliceStart; + if (nSliceSize > 0) { + +#if 0 || defined LOG_DRAW + bprintf(PRINT_NORMAL, _T(" -- Drawing slice: %3i - %3i.\n"), nSliceStart, nSliceEnd); +#endif + + NeoRenderSprites(); // Render sprites + } + } + +#if defined RASTERS_OPTIONAL + } +#endif + + bForcePartialRender = false; + + if (nCyclesSegment < nIRQCycles || SekTotalCycles() >= nIRQCycles) { + NeoSekRun(nCyclesSegment - SekTotalCycles()); + } else { + NeoSekRun(nIRQCycles - SekTotalCycles()); + } + } + } + + if (bRenderImage) { + if (nSliceEnd < 240) { + nSliceStart = nSliceEnd; + nSliceEnd = 240; + nSliceSize = nSliceEnd - nSliceStart; + +#if 0 || defined LOG_DRAW + bprintf(PRINT_NORMAL, _T(" -- Drawing slice: %3i - %3i.\n"), nSliceStart, nSliceEnd); +#endif + + NeoRenderSprites(); // Render sprites + } + NeoRenderText(); // Render text layer + } + + nIRQAcknowledge &= ~4; + SekSetIRQLine(nVBLankIRQ, SEK_IRQSTATUS_ACK); + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - VBLank.\n")); +#endif + + // set IRQ scanline at line 248 + if (nIRQControl & 0x40) { + if (NeoConvertIRQPosition(nIRQOffset) < NO_IRQ_PENDING) { + nIRQCycles = nCyclesSegment + NeoConvertIRQPosition(nIRQOffset); + } + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ Line -> %3i (at line %3i, VBlank).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); +#endif + + } + + nCyclesSegment = nCyclesTotal[0]; + while (SekTotalCycles() < nCyclesSegment) { + + if ((nIRQControl & 0x10) && (nIRQCycles < NO_IRQ_PENDING) && (SekTotalCycles() >= nIRQCycles)) { + nIRQAcknowledge &= ~2; + SekSetIRQLine(nScanlineIRQ, SEK_IRQSTATUS_ACK); + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ triggered (line %3i + %3i cycles).\n"), SekCurrentScanline(), SekTotalCycles() - SekCurrentScanline() * SekCyclesScanline()); +#endif + + if (nIRQControl & 0x80) { + nIRQCycles += NeoConvertIRQPosition(nIRQOffset + 1); + +#if 0 || defined LOG_IRQ + bprintf(PRINT_NORMAL, _T(" - IRQ Line -> %3i (at line %3i, autoload).\n"), nIRQCycles / SekCyclesScanline(), SekCurrentScanline()); +#endif + + } + } + + if (nCyclesSegment < nIRQCycles || SekTotalCycles() >= nIRQCycles) { + NeoSekRun(nCyclesSegment - SekTotalCycles()); + } else { + NeoSekRun(nIRQCycles - SekTotalCycles()); + } + } + + if (nIRQCycles < NO_IRQ_PENDING) { + nIRQCycles -= nCyclesTotal[0]; + if (nIRQCycles < 0) { + nIRQCycles = NO_IRQ_PENDING; + +#if 0 || defined LOG_IRQ + } else { + bprintf(PRINT_NORMAL, _T(" - IRQ Line past screen end (IRQControl: %02X, line -> %3i).\n"), nIRQControl, nIRQCycles / SekCyclesScanline()); +#endif + + } + } +// bprintf(PRINT_NORMAL, " -- IRQControl: %02X, nIRQCycles / SekCyclesScanline(): %3i.\n", nIRQControl, nIRQCycles / SekCyclesScanline()); + + // Update the sound until the end of the frame + + nCycles68KSync = SekTotalCycles(); + BurnTimerEndFrame(nCyclesTotal[1]); + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + + // Update the uPD4990 until the end of the frame + uPD4990AUpdate(SekTotalCycles() - nuPD4990ATicks); + +#if defined EMULATE_WATCHDOG + // Handle the watchdog + nNeoWatchdog += SekTotalCycles(); +#endif + + // Remember extra cycles executed + nCyclesExtra[0] = SekTotalCycles() - nCyclesTotal[0]; + nCyclesExtra[1] = ZetTotalCycles() - nCyclesTotal[1]; + +// bprintf(PRINT_NORMAL, _T(" Z80 PC 0x%04X\n"), Doze.pc); +// bprintf(PRINT_NORMAL, _T(" - %i\n"), SekTotalCycles()); + + ZetClose(); + SekClose(); + + if ((nIRQControl & 8) == 0) { + if (++nSpriteFrameTimer > nSpriteFrameSpeed) { + nSpriteFrameTimer = 0; + nNeoSpriteFrame++; + } + } + + CDEmuGetSoundBuffer(pBurnSoundOut, nBurnSoundLen); + + return 0; +} diff --git a/src/burn/drv/pgm/pgm_run.cpp b/src/burn/drv/pgm/pgm_run.cpp index 1df43a8d2..3fd81d3f3 100644 --- a/src/burn/drv/pgm/pgm_run.cpp +++ b/src/burn/drv/pgm/pgm_run.cpp @@ -1,962 +1,961 @@ - -#include "pgm.h" -#include "arm7_intf.h" -#include "v3021.h" - -UINT8 PgmJoy1[8] = {0,0,0,0,0,0,0,0}; -UINT8 PgmJoy2[8] = {0,0,0,0,0,0,0,0}; -UINT8 PgmJoy3[8] = {0,0,0,0,0,0,0,0}; -UINT8 PgmJoy4[8] = {0,0,0,0,0,0,0,0}; -UINT8 PgmBtn1[8] = {0,0,0,0,0,0,0,0}; -UINT8 PgmBtn2[8] = {0,0,0,0,0,0,0,0}; -UINT8 PgmInput[9] = {0,0,0,0,0,0,0,0, 0}; -UINT8 PgmReset = 0; - -INT32 nPGM68KROMLen = 0; -INT32 nPGMTileROMLen = 0; -INT32 nPGMSPRColROMLen = 0; -INT32 nPGMSPRMaskROMLen = 0; -INT32 nPGMSNDROMLen = 0; -INT32 nPGMSPRColMaskLen = 0; -INT32 nPGMSPRMaskMaskLen = 0; -INT32 nPGMExternalARMLen = 0; - -UINT32 *PGMBgRAM; -UINT32 *PGMTxtRAM; -UINT32 *RamCurPal; -UINT16 *PGMRowRAM; -UINT16 *PGMPalRAM; -UINT16 *PGMVidReg; -UINT16 *PGMSprBuf; -static UINT8 *RamZ80; -UINT8 *PGM68KRAM; - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; - -UINT8 *PGM68KBIOS, *PGM68KROM, *PGMTileROM, *PGMTileROMExp, *PGMSPRColROM, *PGMSPRMaskROM, *PGMARMROM; -UINT8 *PGMARMRAM0, *PGMUSER0, *PGMARMRAM1, *PGMARMRAM2, *PGMARMShareRAM, *PGMARMShareRAM2; - -UINT8 nPgmPalRecalc = 0; -static UINT8 nPgmZ80Work = 0; -static INT32 nPgmCurrentBios = -1; - -void (*pPgmResetCallback)() = NULL; -void (*pPgmInitCallback)() = NULL; -void (*pPgmProtCallback)() = NULL; -INT32 (*pPgmScanCallback)(INT32, INT32*) = NULL; - -static INT32 nEnableArm7 = 0; -INT32 nPGMDisableIRQ4 = 0; -INT32 nPGMArm7Type = 0; - -#define M68K_CYCS_PER_FRAME ((20000000 * 100) / nBurnFPS) -#define ARM7_CYCS_PER_FRAME ((20000000 * 100) / nBurnFPS) -#define Z80_CYCS_PER_FRAME (( 8468000 * 100) / nBurnFPS) - -#define PGM_INTER_LEAVE 100 - -#define M68K_CYCS_PER_INTER (M68K_CYCS_PER_FRAME / PGM_INTER_LEAVE) -#define ARM7_CYCS_PER_INTER (ARM7_CYCS_PER_FRAME / PGM_INTER_LEAVE) -#define Z80_CYCS_PER_INTER (Z80_CYCS_PER_FRAME / PGM_INTER_LEAVE) - -static INT32 nCyclesDone[3]; - -static INT32 pgmMemIndex() -{ - UINT8 *Next; Next = Mem; - PGM68KBIOS = Next; Next += 0x0080000; - PGM68KROM = Next; Next += nPGM68KROMLen; - - PGMUSER0 = Next; Next += nPGMExternalARMLen; - - if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { - PGMARMROM = Next; Next += 0x0004000; - } - - RamStart = Next; - - PGM68KRAM = Next; Next += 0x0020000; - RamZ80 = Next; Next += 0x0010000; - - if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { - PGMARMShareRAM = Next; Next += 0x0020000; - PGMARMShareRAM2 = Next; Next += 0x0020000; - PGMARMRAM0 = Next; Next += 0x0001000; // minimum map is 0x1000 - should be 0x400 - PGMARMRAM1 = Next; Next += 0x0040000; - PGMARMRAM2 = Next; Next += 0x0001000; // minimum map is 0x1000 - should be 0x400 - } - - PGMBgRAM = (UINT32 *) Next; Next += 0x0001000; - PGMTxtRAM = (UINT32 *) Next; Next += 0x0002000; - - PGMRowRAM = (UINT16 *) Next; Next += 0x0001000; // Row Scroll - PGMPalRAM = (UINT16 *) Next; Next += 0x0001400; // Palette R5G5B5 - PGMVidReg = (UINT16 *) Next; Next += 0x0010000; // Video Regs inc. Zoom Table - PGMSprBuf = (UINT16 *) Next; Next += 0x0000a00; - - RamEnd = Next; - - RamCurPal = (UINT32 *) Next; Next += (0x0001202 / 2) * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 pgmGetRoms(bool bLoad) -{ - INT32 kov2 = (strncmp(BurnDrvGetTextA(DRV_NAME), "kov2", 4) == 0) ? 1 : 0; - - char* pRomName; - struct BurnRomInfo ri; - struct BurnRomInfo pi; - - UINT8 *PGMUSER0Load = PGMUSER0; - UINT8 *PGM68KROMLoad = PGM68KROM; - UINT8 *PGMTileROMLoad = PGMTileROM + 0x180000; - UINT8 *PGMSPRMaskROMLoad = PGMSPRMaskROM; - UINT8 *PGMSNDROMLoad = ICSSNDROM + 0x400000; - - if (kov2 && bLoad) { - PGMSNDROMLoad += 0x400000; - } - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 1) - { - if (bLoad) { - BurnDrvGetRomInfo(&pi, i+1); - - if (ri.nLen == 0x80000 && pi.nLen == 0x80000) - { - BurnLoadRom(PGM68KROMLoad + 0, i + 0, 2); - BurnLoadRom(PGM68KROMLoad + 1, i + 1, 2); - PGM68KROMLoad += pi.nLen; - i += 1; - } - else - { - BurnLoadRom(PGM68KROMLoad, i, 1); - } - PGM68KROMLoad += ri.nLen; - } else { - nPGM68KROMLen += ri.nLen; - } - continue; - } - - if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 2) - { - if (bLoad) { - BurnLoadRom(PGMTileROMLoad, i, 1); - PGMTileROMLoad += ri.nLen; - } else { - nPGMTileROMLen += ri.nLen; - } - continue; - } - - if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 3) - { - if (bLoad) { - } else { - nPGMSPRColROMLen += ri.nLen; - } - continue; - } - - if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 4) - { - if (bLoad) { - BurnLoadRom(PGMSPRMaskROMLoad, i, 1); - PGMSPRMaskROMLoad += ri.nLen; - } else { - nPGMSPRMaskROMLen += ri.nLen; - } - continue; - } - - if ((ri.nType & BRF_SND) && (ri.nType & 0x0f) == 5) - { - if (bLoad) { - BurnLoadRom(PGMSNDROMLoad, i, 1); - PGMSNDROMLoad += ri.nLen; - } else { - nPGMSNDROMLen += ri.nLen; - } - continue; - } - - if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 7) - { - if (bLoad) { - if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { - BurnLoadRom(PGMARMROM, i, 1); - } - } - continue; - } - - if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 8) - { - if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { - if (bLoad) { - BurnLoadRom(PGMUSER0, i, 1); - PGMUSER0Load += ri.nLen; - } else { - nPGMExternalARMLen += ri.nLen; - } - } - continue; - } - } - - if (!bLoad) { - nPGMTileROMLen += 0x180000; - if (nPGMTileROMLen < 0x400000) nPGMTileROMLen = 0x400000; - - nPGMSNDROMLen += 0x400000; - - if (kov2) nPGMSNDROMLen += 0x400000; - - nPGMSNDROMLen = ((nPGMSNDROMLen-1) | 0xfffff) + 1; - nICSSNDROMLen = (nPGMSNDROMLen-1) & 0xf00000; - - if (nPGMExternalARMLen == 0) nPGMExternalARMLen = 0x200000; - } - - return 0; -} - -UINT8 __fastcall PgmReadByte(UINT32 sekAddress) -{ - switch (sekAddress) - { - case 0xC00007: - return v3021Read(); - - case 0xC08007: // dipswitches - (ddp2) - return ~(PgmInput[6]) | 0xe0; - - // default: - // bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x (PC: %5.5x)\n"), sekAddress, SekGetPC(-1)); - } - - return 0; -} - -UINT16 __fastcall PgmReadWord(UINT32 sekAddress) -{ - switch (sekAddress) - { - case 0xC00004: - return ics2115_soundlatch_r(1); - - case 0xC00006: // ketsui wants this - return v3021Read(); - - case 0xC08000: // p1+p2 controls - return ~(PgmInput[0] | (PgmInput[1] << 8)); - - case 0xC08002: // p3+p4 controls - return ~(PgmInput[2] | (PgmInput[3] << 8)); - - case 0xC08004: // extra controls - return ~(PgmInput[4] | (PgmInput[5] << 8)); - - case 0xC08006: // dipswitches - return ~(PgmInput[6]) | 0xffe0; - - // default: - // bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x (PC: %5.5x)\n"), sekAddress, SekGetPC(-1)); - } - - return 0; -} - -void __fastcall PgmWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - byteValue=byteValue; // fix warning - - switch (sekAddress) - { - // default: - // bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x (PC: %5.5x)\n"), byteValue, sekAddress, SekGetPC(-1)); - } -} - -void __fastcall PgmWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - static INT32 coin_counter_previous; - - switch (sekAddress) - { - case 0x700006: // Watchdog? - break; - - case 0xC00002: - ics2115_soundlatch_w(0, wordValue); - if (nPgmZ80Work) ZetNmi(); - break; - - case 0xC00004: - ics2115_soundlatch_w(1, wordValue); - break; - - case 0xC00006: - v3021Write(wordValue); - break; - - case 0xC00008: - if (wordValue == 0x5050) { - ics2115_reset(); - nPgmZ80Work = 1; - - ZetReset(); - } else { - nPgmZ80Work = 0; - } - break; - - case 0xC0000A: // z80_ctrl_w - break; - - case 0xC0000C: - ics2115_soundlatch_w(2, wordValue); - break; - - case 0xC08006: // coin counter - if (coin_counter_previous == 0xf && wordValue == 0) { - // bprintf (0, _T("increment coin counter!\n")); - } - coin_counter_previous = wordValue & 0x0f; - break; - - // default: - // bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x (PC: %5.5x)\n"), wordValue, sekAddress, SekGetPC(-1)); - } -} - -UINT8 __fastcall PgmZ80ReadByte(UINT32 sekAddress) -{ - switch (sekAddress) - { - // default: - // bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); - } - - return 0; -} - -UINT16 __fastcall PgmZ80ReadWord(UINT32 sekAddress) -{ - sekAddress &= 0xffff; - return (RamZ80[sekAddress] << 8) | RamZ80[sekAddress+1]; -} - -void __fastcall PgmZ80WriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - sekAddress &= 0xffff; - RamZ80[sekAddress] = wordValue >> 8; - RamZ80[sekAddress+1] = wordValue & 0xFF; -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour & 0x7C00) >> 7; // Red - r |= r >> 5; - g = (nColour & 0x03E0) >> 2; // Green - g |= g >> 5; - b = (nColour & 0x001F) << 3; // Blue - b |= b >> 5; - - return BurnHighCol(r, g, b, 0); -} - -void __fastcall PgmPaletteWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - sekAddress = (sekAddress - 0xa00000) >> 1; - PGMPalRAM[sekAddress] =BURN_ENDIAN_SWAP_INT16(wordValue); - RamCurPal[sekAddress] = CalcCol(wordValue); -} - -void __fastcall PgmPaletteWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - sekAddress -= 0xa00000; - UINT8 *pal = (UINT8*)PGMPalRAM; - pal[sekAddress ^ 1] = byteValue; - - RamCurPal[sekAddress >> 1] = CalcCol(PGMPalRAM[sekAddress >> 1]); -} - -UINT8 __fastcall PgmZ80PortRead(UINT16 port) -{ - switch (port >> 8) - { - case 0x80: - return ics2115read(port & 0xff); - - case 0x81: - return ics2115_soundlatch_r(2) & 0xff; - - case 0x82: - return ics2115_soundlatch_r(0) & 0xff; - - case 0x84: - return ics2115_soundlatch_r(1) & 0xff; - -// default: -// bprintf(PRINT_NORMAL, _T("Z80 Attempt to read port %04x\n"), port); - } - return 0; -} - -void __fastcall PgmZ80PortWrite(UINT16 port, UINT8 data) -{ - switch (port >> 8) - { - case 0x80: - ics2115write(port & 0xff, data); - break; - - case 0x81: - ics2115_soundlatch_w(2, data); - break; - - case 0x82: - ics2115_soundlatch_w(0, data); - break; - - case 0x84: - ics2115_soundlatch_w(1, data); - break; - -// default: -// bprintf(PRINT_NORMAL, _T("Z80 Attempt to write %02x to port %04x\n"), data, port); - } -} - -INT32 PgmDoReset() -{ - if (nPgmCurrentBios != PgmInput[8]) { // Load the 68k bios - if (!(BurnDrvGetHardwareCode() & HARDWARE_IGS_JAMMAPCB)) { - nPgmCurrentBios = PgmInput[8]; - BurnLoadRom(PGM68KBIOS, 0x00082 + nPgmCurrentBios, 1); // 68k bios - } - } - - SekOpen(0); - SekReset(); - SekClose(); - - if (nEnableArm7) { - Arm7Open(0); - Arm7Reset(); - Arm7Close(); - } - - ZetOpen(0); - nPgmZ80Work = 0; - ZetReset(); - ZetClose(); - - ics2115_reset(); - - if (pPgmResetCallback) { - pPgmResetCallback(); - } - - return 0; -} - -static void expand_tile_gfx() -{ - UINT8 *src = PGMTileROM; - UINT8 *dst = PGMTileROMExp; - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "kovqhsgs") == 0 || - strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsqh2") == 0 || - strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsjb") == 0 || - strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsjba") == 0 || - strcmp(BurnDrvGetTextA(DRV_NAME), "kovassg") == 0) { - pgm_decode_kovqhsgs_tile_data(PGMTileROM + 0x180000); - } - - for (INT32 i = nPGMTileROMLen/5-1; i >= 0 ; i --) { - dst[0+8*i] = ((src[0+5*i] >> 0) & 0x1f); - dst[1+8*i] = ((src[0+5*i] >> 5) & 0x07) | ((src[1+5*i] << 3) & 0x18); - dst[2+8*i] = ((src[1+5*i] >> 2) & 0x1f ); - dst[3+8*i] = ((src[1+5*i] >> 7) & 0x01) | ((src[2+5*i] << 1) & 0x1e); - dst[4+8*i] = ((src[2+5*i] >> 4) & 0x0f) | ((src[3+5*i] << 4) & 0x10); - dst[5+8*i] = ((src[3+5*i] >> 1) & 0x1f ); - dst[6+8*i] = ((src[3+5*i] >> 6) & 0x03) | ((src[4+5*i] << 2) & 0x1c); - dst[7+8*i] = ((src[4+5*i] >> 3) & 0x1f ); - } - - for (INT32 i = 0x200000-1; i >= 0; i--) { - INT32 d = PGMTileROM[i]; - PGMTileROM[i * 2 + 0] = d & 0x0f; - PGMTileROM[i * 2 + 1] = d >> 4; - } - - PGMTileROM = (UINT8*)realloc(PGMTileROM, 0x400000); -} - -static void expand_colourdata() -{ - // allocate - { - INT32 needed = (nPGMSPRColROMLen / 2) * 3; - nPGMSPRColMaskLen = 1; - while (nPGMSPRColMaskLen < needed) - nPGMSPRColMaskLen <<= 1; - - needed = nPGMSPRMaskROMLen; - nPGMSPRMaskMaskLen = 1; - while (nPGMSPRMaskMaskLen < needed) - nPGMSPRMaskMaskLen <<= 1; - nPGMSPRMaskMaskLen-=1; - - PGMSPRColROM = (UINT8*)BurnMalloc(nPGMSPRColMaskLen); - nPGMSPRColMaskLen -= 1; - } - - UINT8 *tmp = (UINT8*)BurnMalloc(nPGMSPRColROMLen); - if (tmp == NULL) return; - - // load sprite color roms - { - char* pRomName; - struct BurnRomInfo ri; - - UINT8 *PGMSPRColROMLoad = tmp; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 3) - { - BurnLoadRom(PGMSPRColROMLoad, i, 1); - PGMSPRColROMLoad += ri.nLen; - - // fix for 2x size b0601 rom - if (strcmp(BurnDrvGetTextA(DRV_NAME), "kovsh") == 0 || - strcmp(BurnDrvGetTextA(DRV_NAME), "kovsh103") == 0) { - if (ri.nLen == 0x400000) { - PGMSPRColROMLoad -= 0x200000; - } - } - - continue; - } - } - } - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "kovqhsgs") == 0 || - strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsqh2") == 0 || - strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsjb") == 0 || - strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsjba") == 0 || - strcmp(BurnDrvGetTextA(DRV_NAME), "kovassg") == 0) { - pgm_decode_kovqhsgs_gfx_block(tmp + 0x0000000); - pgm_decode_kovqhsgs_gfx_block(tmp + 0x0800000); - pgm_decode_kovqhsgs_gfx_block(tmp + 0x1000000); - pgm_decode_kovqhsgs_gfx_block(tmp + 0x1800000); - pgm_decode_kovqhsgs_gfx_block(tmp + 0x2000000); - pgm_decode_kovqhsgs_gfx_block(tmp + 0x2800000); - } - - // convert from 3bpp packed - for (INT32 cnt = 0; cnt < nPGMSPRColROMLen / 2; cnt++) - { - UINT16 colpack = ((tmp[cnt*2]) | (tmp[cnt*2+1] << 8)); - PGMSPRColROM[cnt*3+0] = (colpack >> 0 ) & 0x1f; - PGMSPRColROM[cnt*3+1] = (colpack >> 5 ) & 0x1f; - PGMSPRColROM[cnt*3+2] = (colpack >> 10) & 0x1f; - } - - BurnFree (tmp); -} - -INT32 pgmInit() -{ - BurnSetRefreshRate((BurnDrvGetHardwareCode() & HARDWARE_IGS_JAMMAPCB) ? 59.17 : 60.00); // different? - - Mem = NULL; - - pgmGetRoms(false); - - expand_colourdata(); - - PGMTileROM = (UINT8*)BurnMalloc(nPGMTileROMLen); // 8x8 Text Tiles + 32x32 BG Tiles - PGMTileROMExp = (UINT8*)BurnMalloc((nPGMTileROMLen / 5) * 8); // Expanded 8x8 Text Tiles and 32x32 BG Tiles - PGMSPRMaskROM = (UINT8*)BurnMalloc(nPGMSPRMaskROMLen); - ICSSNDROM = (UINT8*)BurnMalloc(nPGMSNDROMLen); - - pgmMemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - pgmMemIndex(); - - // load bios roms (68k bios loaded in reset routine) - if (BurnLoadRom(PGMTileROM, 0x80, 1)) return 1; // Bios Text and Tiles - BurnLoadRom(ICSSNDROM, 0x81, 1); // Bios Intro Sounds - - pgmGetRoms(true); - - expand_tile_gfx(); // expand graphics - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // ketsui and espgaluda - if (BurnDrvGetHardwareCode() & HARDWARE_IGS_JAMMAPCB) - { - SekMapMemory(PGM68KROM, 0x000000, (nPGM68KROMLen-1), SM_ROM); // 68000 ROM (no bios) - } - else - { - SekMapMemory(PGM68KBIOS, 0x000000, 0x07ffff, SM_ROM); // 68000 BIOS - SekMapMemory(PGM68KROM, 0x100000, (nPGM68KROMLen-1)+0x100000, SM_ROM); // 68000 ROM - } - - for (INT32 i = 0; i < 0x100000; i+=0x20000) { // Main Ram + Mirrors... - SekMapMemory(PGM68KRAM, 0x800000 | i, 0x81ffff | i, SM_RAM); - } - - // Ripped from FBA Shuffle. - for (INT32 i = 0; i < 0x100000; i+=0x08000) { // Video Ram + Mirrors... - SekMapMemory((UINT8 *)PGMBgRAM, 0x900000 | i, 0x900fff | i, SM_RAM); - SekMapMemory((UINT8 *)PGMBgRAM, 0x901000 | i, 0x901fff | i, SM_RAM); // mirror - SekMapMemory((UINT8 *)PGMBgRAM, 0x902000 | i, 0x902fff | i, SM_RAM); // mirror - SekMapMemory((UINT8 *)PGMBgRAM, 0x903000 | i, 0x904fff | i, SM_RAM); // mirror - - SekMapMemory((UINT8 *)PGMTxtRAM, 0x904000 | i, 0x905fff | i, SM_RAM); - SekMapMemory((UINT8 *)PGMTxtRAM, 0x906000 | i, 0x906fff | i, SM_RAM); // mirror - - SekMapMemory((UINT8 *)PGMRowRAM, 0x907000 | i, 0x907fff | i, SM_RAM); - } - - SekMapMemory((UINT8 *)PGMPalRAM, 0xa00000, 0xa013ff, SM_ROM); // palette - SekMapMemory((UINT8 *)PGMVidReg, 0xb00000, 0xb0ffff, SM_RAM); // should be mirrored? - - SekMapHandler(1, 0xa00000, 0xa013ff, SM_WRITE); - SekMapHandler(2, 0xc10000, 0xc1ffff, SM_READ | SM_WRITE); - - SekSetReadWordHandler(0, PgmReadWord); - SekSetReadByteHandler(0, PgmReadByte); - SekSetWriteWordHandler(0, PgmWriteWord); - SekSetWriteByteHandler(0, PgmWriteByte); - - SekSetWriteByteHandler(1, PgmPaletteWriteByte); - SekSetWriteWordHandler(1, PgmPaletteWriteWord); - - SekSetReadWordHandler(2, PgmZ80ReadWord); - SekSetWriteWordHandler(2, PgmZ80WriteWord); - - SekClose(); - } - - { - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xffff, 0, RamZ80); - ZetMapArea(0x0000, 0xffff, 1, RamZ80); - ZetMapArea(0x0000, 0xffff, 2, RamZ80); - ZetSetOutHandler(PgmZ80PortWrite); - ZetSetInHandler(PgmZ80PortRead); - ZetMemEnd(); - ZetClose(); - } - - if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { - nEnableArm7 = 1; - } - - pgmInitDraw(); - - ics2115_init(); - - pBurnDrvPalette = (UINT32*)PGMPalRAM; - - if (pPgmInitCallback) { - pPgmInitCallback(); - } - - if (pPgmProtCallback) { - pPgmProtCallback(); - } - - PgmDoReset(); - - return 0; -} - -INT32 pgmExit() -{ - pgmExitDraw(); - - SekExit(); - ZetExit(); - - if (nEnableArm7) { - Arm7Exit(); - } - - BurnFree(Mem); - - ics2115_exit(); // frees ICSSNDROM - - BurnFree (PGMTileROM); - BurnFree (PGMTileROMExp); - BurnFree (PGMSPRColROM); - BurnFree (PGMSPRMaskROM); - - nPGM68KROMLen = 0; - nPGMTileROMLen = 0; - nPGMSPRColROMLen = 0; - nPGMSPRMaskROMLen = 0; - nPGMSNDROMLen = 0; - nPGMExternalARMLen = 0; - - pPgmInitCallback = NULL; - pPgmProtCallback = NULL; - pPgmScanCallback = NULL; - pPgmResetCallback = NULL; - - nEnableArm7 = 0; - nPGMDisableIRQ4 = 0; - nPGMArm7Type = 0; - - nPgmCurrentBios = -1; - - return 0; -} - -INT32 pgmFrame() -{ - if (PgmReset) { - PgmDoReset(); - } - - // compile inputs - { - memset (PgmInput, 0, 6); - for (INT32 i = 0; i < 8; i++) { - PgmInput[0] |= (PgmJoy1[i] & 1) << i; - PgmInput[1] |= (PgmJoy2[i] & 1) << i; - PgmInput[2] |= (PgmJoy3[i] & 1) << i; - PgmInput[3] |= (PgmJoy4[i] & 1) << i; - PgmInput[4] |= (PgmBtn1[i] & 1) << i; - PgmInput[5] |= (PgmBtn2[i] & 1) << i; - } - - // clear opposites - if ((PgmInput[0] & 0x06) == 0x06) PgmInput[0] &= 0xf9; // up/down - if ((PgmInput[0] & 0x18) == 0x18) PgmInput[0] &= 0xe7; // left/right - if ((PgmInput[1] & 0x06) == 0x06) PgmInput[1] &= 0xf9; - if ((PgmInput[1] & 0x18) == 0x18) PgmInput[1] &= 0xe7; - if ((PgmInput[2] & 0x06) == 0x06) PgmInput[2] &= 0xf9; - if ((PgmInput[2] & 0x18) == 0x18) PgmInput[2] &= 0xe7; - if ((PgmInput[3] & 0x06) == 0x06) PgmInput[3] &= 0xf9; - if ((PgmInput[3] & 0x18) == 0x18) PgmInput[3] &= 0xe7; - } - - INT32 nCyclesNext[3] = {0, 0, 0}; - nCyclesDone[0] = 0; - nCyclesDone[1] = 0; - nCyclesDone[2] = 0; - - SekNewFrame(); - ZetNewFrame(); - - if (nEnableArm7) - { - Arm7NewFrame(); - - switch (nPGMArm7Type) // region hacks - { - case 1: // kov/kovsh/kovshp/photoy2k/puzlstar/puzzli2/oldsplus/py2k2 - PGMARMShareRAM[0x008] = PgmInput[7]; - break; - - case 2: // martmast/kov2/dw2001/ddp2 - if (strncmp(BurnDrvGetTextA(DRV_NAME), "ddp2", 4) == 0) { - PGMARMShareRAM[0x002] = PgmInput[7]; - } else { - PGMARMShareRAM[0x138] = PgmInput[7]; - } - break; - - case 3: // svg/killbldp/dmnfrnt/theglad/happy6in1 - if (strncmp(BurnDrvGetTextA(DRV_NAME), "dmnfrnt", 7) == 0) { - PGMARMShareRAM[0x158] = PgmInput[7]; - } else { - // unknown - } - break; - } - } - - SekOpen(0); - ZetOpen(0); - if (nEnableArm7) Arm7Open(0); - - for (INT32 i = 0; i < PGM_INTER_LEAVE; i++) - { - nCyclesNext[0] += M68K_CYCS_PER_INTER; - nCyclesNext[1] += Z80_CYCS_PER_INTER; - nCyclesNext[2] += ARM7_CYCS_PER_INTER; - - INT32 cycles = M68K_CYCS_PER_INTER; - - nCyclesDone[0] += SekRun(cycles); - - if (nEnableArm7) { - cycles = SekTotalCycles() - Arm7TotalCycles(); - - if (cycles > 0) { - nCyclesDone[2] += Arm7Run(cycles); - } - } - - if (i == (PGM_INTER_LEAVE / 2) - 1 || i == (PGM_INTER_LEAVE - 1)) { - if (nPgmZ80Work) { - nCyclesDone[1] += ZetRun( nCyclesNext[1] - nCyclesDone[1] ); - } else { - nCyclesDone[1] += nCyclesNext[1] - nCyclesDone[1]; - } - } - - if (i == ((PGM_INTER_LEAVE / 2)-1) && !nPGMDisableIRQ4) { - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - } - - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - - ics2115_frame(); - - if (nEnableArm7) Arm7Close(); - ZetClose(); - SekClose(); - - ics2115_update(nBurnSoundLen); - - if (pBurnDraw) { - pgmDraw(); - } - - memcpy (PGMSprBuf, PGM68KRAM /* Sprite RAM 0-bff */, 0xa00); // buffer sprites - - return 0; -} - -INT32 pgmScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - nPgmPalRecalc = 1; - - if (nAction & ACB_MEMORY_ROM) { - if (BurnDrvGetHardwareCode() & HARDWARE_IGS_JAMMAPCB) { - ba.Data = PGM68KROM; - ba.nLen = nPGM68KROMLen; - ba.nAddress = 0; - ba.szName = "68K ROM"; - BurnAcb(&ba); - } else { - ba.Data = PGM68KBIOS; - ba.nLen = 0x0020000; - ba.nAddress = 0; - ba.szName = "BIOS ROM"; - BurnAcb(&ba); - - ba.Data = PGM68KROM; - ba.nLen = nPGM68KROMLen; - ba.nAddress = 0x100000; - ba.szName = "68K ROM"; - BurnAcb(&ba); - } - } - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = PGMBgRAM; - ba.nLen = 0x0004000; - ba.nAddress = 0x900000; - ba.szName = "Bg RAM"; - BurnAcb(&ba); - - ba.Data = PGMTxtRAM; - ba.nLen = 0x0003000; - ba.nAddress = 0x904000; - ba.szName = "Tx RAM"; - BurnAcb(&ba); - - ba.Data = PGMRowRAM; - ba.nLen = 0x0001000; - ba.nAddress = 0x907000; - ba.szName = "Row Scroll"; - BurnAcb(&ba); - - ba.Data = PGMPalRAM; - ba.nLen = 0x0001400; - ba.nAddress = 0xA00000; - ba.szName = "Palette"; - BurnAcb(&ba); - - ba.Data = PGMVidReg; - ba.nLen = 0x0010000; - ba.nAddress = 0xB00000; - ba.szName = "Video Regs"; - BurnAcb(&ba); - - ba.Data = RamZ80; - ba.nLen = 0x0010000; - ba.nAddress = 0xC10000; - ba.szName = "Z80 RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_NVRAM) { - ba.Data = PGM68KRAM; - ba.nLen = 0x020000; - ba.nAddress = 0x800000; - ba.szName = "68K RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - - SekScan(nAction); - ZetScan(nAction); - - v3021Scan(); - - SCAN_VAR(PgmInput); - - SCAN_VAR(nPgmZ80Work); - - SCAN_VAR(nPgmCurrentBios); - - ics2115_scan(nAction, pnMin); - } - - if (pPgmScanCallback) { - pPgmScanCallback(nAction, pnMin); - } - - return 0; -} + +#include "pgm.h" +#include "arm7_intf.h" +#include "v3021.h" + +UINT8 PgmJoy1[8] = {0,0,0,0,0,0,0,0}; +UINT8 PgmJoy2[8] = {0,0,0,0,0,0,0,0}; +UINT8 PgmJoy3[8] = {0,0,0,0,0,0,0,0}; +UINT8 PgmJoy4[8] = {0,0,0,0,0,0,0,0}; +UINT8 PgmBtn1[8] = {0,0,0,0,0,0,0,0}; +UINT8 PgmBtn2[8] = {0,0,0,0,0,0,0,0}; +UINT8 PgmInput[9] = {0,0,0,0,0,0,0,0, 0}; +UINT8 PgmReset = 0; + +INT32 nPGM68KROMLen = 0; +INT32 nPGMTileROMLen = 0; +INT32 nPGMSPRColROMLen = 0; +INT32 nPGMSPRMaskROMLen = 0; +INT32 nPGMSNDROMLen = 0; +INT32 nPGMSPRColMaskLen = 0; +INT32 nPGMSPRMaskMaskLen = 0; +INT32 nPGMExternalARMLen = 0; + +UINT32 *PGMBgRAM; +UINT32 *PGMTxtRAM; +UINT32 *RamCurPal; +UINT16 *PGMRowRAM; +UINT16 *PGMPalRAM; +UINT16 *PGMVidReg; +UINT16 *PGMSprBuf; +static UINT8 *RamZ80; +UINT8 *PGM68KRAM; + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; + +UINT8 *PGM68KBIOS, *PGM68KROM, *PGMTileROM, *PGMTileROMExp, *PGMSPRColROM, *PGMSPRMaskROM, *PGMARMROM; +UINT8 *PGMARMRAM0, *PGMUSER0, *PGMARMRAM1, *PGMARMRAM2, *PGMARMShareRAM, *PGMARMShareRAM2; + +UINT8 nPgmPalRecalc = 0; +static UINT8 nPgmZ80Work = 0; +static INT32 nPgmCurrentBios = -1; + +void (*pPgmResetCallback)() = NULL; +void (*pPgmInitCallback)() = NULL; +void (*pPgmProtCallback)() = NULL; +INT32 (*pPgmScanCallback)(INT32, INT32*) = NULL; + +static INT32 nEnableArm7 = 0; +INT32 nPGMDisableIRQ4 = 0; +INT32 nPGMArm7Type = 0; + +#define M68K_CYCS_PER_FRAME ((20000000 * 100) / nBurnFPS) +#define ARM7_CYCS_PER_FRAME ((20000000 * 100) / nBurnFPS) +#define Z80_CYCS_PER_FRAME (( 8468000 * 100) / nBurnFPS) + +#define PGM_INTER_LEAVE 100 + +#define M68K_CYCS_PER_INTER (M68K_CYCS_PER_FRAME / PGM_INTER_LEAVE) +#define ARM7_CYCS_PER_INTER (ARM7_CYCS_PER_FRAME / PGM_INTER_LEAVE) +#define Z80_CYCS_PER_INTER (Z80_CYCS_PER_FRAME / PGM_INTER_LEAVE) + +static INT32 nCyclesDone[3]; + +static INT32 pgmMemIndex() +{ + UINT8 *Next; Next = Mem; + PGM68KBIOS = Next; Next += 0x0080000; + PGM68KROM = Next; Next += nPGM68KROMLen; + + PGMUSER0 = Next; Next += nPGMExternalARMLen; + + if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { + PGMARMROM = Next; Next += 0x0004000; + } + + RamStart = Next; + + PGM68KRAM = Next; Next += 0x0020000; + RamZ80 = Next; Next += 0x0010000; + + if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { + PGMARMShareRAM = Next; Next += 0x0020000; + PGMARMShareRAM2 = Next; Next += 0x0020000; + PGMARMRAM0 = Next; Next += 0x0001000; // minimum map is 0x1000 - should be 0x400 + PGMARMRAM1 = Next; Next += 0x0040000; + PGMARMRAM2 = Next; Next += 0x0001000; // minimum map is 0x1000 - should be 0x400 + } + + PGMBgRAM = (UINT32 *) Next; Next += 0x0001000; + PGMTxtRAM = (UINT32 *) Next; Next += 0x0002000; + + PGMRowRAM = (UINT16 *) Next; Next += 0x0001000; // Row Scroll + PGMPalRAM = (UINT16 *) Next; Next += 0x0001400; // Palette R5G5B5 + PGMVidReg = (UINT16 *) Next; Next += 0x0010000; // Video Regs inc. Zoom Table + PGMSprBuf = (UINT16 *) Next; Next += 0x0000a00; + + RamEnd = Next; + + RamCurPal = (UINT32 *) Next; Next += (0x0001202 / 2) * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 pgmGetRoms(bool bLoad) +{ + INT32 kov2 = (strncmp(BurnDrvGetTextA(DRV_NAME), "kov2", 4) == 0) ? 1 : 0; + + char* pRomName; + struct BurnRomInfo ri; + struct BurnRomInfo pi; + + UINT8 *PGMUSER0Load = PGMUSER0; + UINT8 *PGM68KROMLoad = PGM68KROM; + UINT8 *PGMTileROMLoad = PGMTileROM + 0x180000; + UINT8 *PGMSPRMaskROMLoad = PGMSPRMaskROM; + UINT8 *PGMSNDROMLoad = ICSSNDROM + 0x400000; + + if (kov2 && bLoad) { + PGMSNDROMLoad += 0x400000; + } + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 1) + { + if (bLoad) { + BurnDrvGetRomInfo(&pi, i+1); + + if (ri.nLen == 0x80000 && pi.nLen == 0x80000) + { + BurnLoadRom(PGM68KROMLoad + 0, i + 0, 2); + BurnLoadRom(PGM68KROMLoad + 1, i + 1, 2); + PGM68KROMLoad += pi.nLen; + i += 1; + } + else + { + BurnLoadRom(PGM68KROMLoad, i, 1); + } + PGM68KROMLoad += ri.nLen; + } else { + nPGM68KROMLen += ri.nLen; + } + continue; + } + + if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 2) + { + if (bLoad) { + BurnLoadRom(PGMTileROMLoad, i, 1); + PGMTileROMLoad += ri.nLen; + } else { + nPGMTileROMLen += ri.nLen; + } + continue; + } + + if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 3) + { + if (bLoad) { + } else { + nPGMSPRColROMLen += ri.nLen; + } + continue; + } + + if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 4) + { + if (bLoad) { + BurnLoadRom(PGMSPRMaskROMLoad, i, 1); + PGMSPRMaskROMLoad += ri.nLen; + } else { + nPGMSPRMaskROMLen += ri.nLen; + } + continue; + } + + if ((ri.nType & BRF_SND) && (ri.nType & 0x0f) == 5) + { + if (bLoad) { + BurnLoadRom(PGMSNDROMLoad, i, 1); + PGMSNDROMLoad += ri.nLen; + } else { + nPGMSNDROMLen += ri.nLen; + } + continue; + } + + if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 7) + { + if (bLoad) { + if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { + BurnLoadRom(PGMARMROM, i, 1); + } + } + continue; + } + + if ((ri.nType & BRF_PRG) && (ri.nType & 0x0f) == 8) + { + if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { + if (bLoad) { + BurnLoadRom(PGMUSER0, i, 1); + PGMUSER0Load += ri.nLen; + } else { + nPGMExternalARMLen += ri.nLen; + } + } + continue; + } + } + + if (!bLoad) { + nPGMTileROMLen += 0x180000; + if (nPGMTileROMLen < 0x400000) nPGMTileROMLen = 0x400000; + + nPGMSNDROMLen += 0x400000; + + if (kov2) nPGMSNDROMLen += 0x400000; + + nPGMSNDROMLen = ((nPGMSNDROMLen-1) | 0xfffff) + 1; + nICSSNDROMLen = (nPGMSNDROMLen-1) & 0xf00000; + + if (nPGMExternalARMLen == 0) nPGMExternalARMLen = 0x200000; + } + + return 0; +} + +UINT8 __fastcall PgmReadByte(UINT32 sekAddress) +{ + switch (sekAddress) + { + case 0xC00007: + return v3021Read(); + + case 0xC08007: // dipswitches - (ddp2) + return ~(PgmInput[6]) | 0xe0; + + // default: + // bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x (PC: %5.5x)\n"), sekAddress, SekGetPC(-1)); + } + + return 0; +} + +UINT16 __fastcall PgmReadWord(UINT32 sekAddress) +{ + switch (sekAddress) + { + case 0xC00004: + return ics2115_soundlatch_r(1); + + case 0xC00006: // ketsui wants this + return v3021Read(); + + case 0xC08000: // p1+p2 controls + return ~(PgmInput[0] | (PgmInput[1] << 8)); + + case 0xC08002: // p3+p4 controls + return ~(PgmInput[2] | (PgmInput[3] << 8)); + + case 0xC08004: // extra controls + return ~(PgmInput[4] | (PgmInput[5] << 8)); + + case 0xC08006: // dipswitches + return ~(PgmInput[6]) | 0xffe0; + + // default: + // bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x (PC: %5.5x)\n"), sekAddress, SekGetPC(-1)); + } + + return 0; +} + +void __fastcall PgmWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + byteValue=byteValue; // fix warning + + switch (sekAddress) + { + // default: + // bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x (PC: %5.5x)\n"), byteValue, sekAddress, SekGetPC(-1)); + } +} + +void __fastcall PgmWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + static INT32 coin_counter_previous; + + switch (sekAddress) + { + case 0x700006: // Watchdog? + break; + + case 0xC00002: + ics2115_soundlatch_w(0, wordValue); + if (nPgmZ80Work) ZetNmi(); + break; + + case 0xC00004: + ics2115_soundlatch_w(1, wordValue); + break; + + case 0xC00006: + v3021Write(wordValue); + break; + + case 0xC00008: + if (wordValue == 0x5050) { + ics2115_reset(); + nPgmZ80Work = 1; + + ZetReset(); + } else { + nPgmZ80Work = 0; + } + break; + + case 0xC0000A: // z80_ctrl_w + break; + + case 0xC0000C: + ics2115_soundlatch_w(2, wordValue); + break; + + case 0xC08006: // coin counter + if (coin_counter_previous == 0xf && wordValue == 0) { + // bprintf (0, _T("increment coin counter!\n")); + } + coin_counter_previous = wordValue & 0x0f; + break; + + // default: + // bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x (PC: %5.5x)\n"), wordValue, sekAddress, SekGetPC(-1)); + } +} + +UINT8 __fastcall PgmZ80ReadByte(UINT32 sekAddress) +{ + switch (sekAddress) + { + // default: + // bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); + } + + return 0; +} + +UINT16 __fastcall PgmZ80ReadWord(UINT32 sekAddress) +{ + sekAddress &= 0xffff; + return (RamZ80[sekAddress] << 8) | RamZ80[sekAddress+1]; +} + +void __fastcall PgmZ80WriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + sekAddress &= 0xffff; + RamZ80[sekAddress] = wordValue >> 8; + RamZ80[sekAddress+1] = wordValue & 0xFF; +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour & 0x7C00) >> 7; // Red + r |= r >> 5; + g = (nColour & 0x03E0) >> 2; // Green + g |= g >> 5; + b = (nColour & 0x001F) << 3; // Blue + b |= b >> 5; + + return BurnHighCol(r, g, b, 0); +} + +void __fastcall PgmPaletteWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + sekAddress = (sekAddress - 0xa00000) >> 1; + PGMPalRAM[sekAddress] =BURN_ENDIAN_SWAP_INT16(wordValue); + RamCurPal[sekAddress] = CalcCol(wordValue); +} + +void __fastcall PgmPaletteWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + sekAddress -= 0xa00000; + UINT8 *pal = (UINT8*)PGMPalRAM; + pal[sekAddress ^ 1] = byteValue; + + RamCurPal[sekAddress >> 1] = CalcCol(PGMPalRAM[sekAddress >> 1]); +} + +UINT8 __fastcall PgmZ80PortRead(UINT16 port) +{ + switch (port >> 8) + { + case 0x80: + return ics2115read(port & 0xff); + + case 0x81: + return ics2115_soundlatch_r(2) & 0xff; + + case 0x82: + return ics2115_soundlatch_r(0) & 0xff; + + case 0x84: + return ics2115_soundlatch_r(1) & 0xff; + +// default: +// bprintf(PRINT_NORMAL, _T("Z80 Attempt to read port %04x\n"), port); + } + return 0; +} + +void __fastcall PgmZ80PortWrite(UINT16 port, UINT8 data) +{ + switch (port >> 8) + { + case 0x80: + ics2115write(port & 0xff, data); + break; + + case 0x81: + ics2115_soundlatch_w(2, data); + break; + + case 0x82: + ics2115_soundlatch_w(0, data); + break; + + case 0x84: + ics2115_soundlatch_w(1, data); + break; + +// default: +// bprintf(PRINT_NORMAL, _T("Z80 Attempt to write %02x to port %04x\n"), data, port); + } +} + +INT32 PgmDoReset() +{ + if (nPgmCurrentBios != PgmInput[8]) { // Load the 68k bios + if (!(BurnDrvGetHardwareCode() & HARDWARE_IGS_JAMMAPCB)) { + nPgmCurrentBios = PgmInput[8]; + BurnLoadRom(PGM68KBIOS, 0x00082 + nPgmCurrentBios, 1); // 68k bios + } + } + + SekOpen(0); + SekReset(); + SekClose(); + + if (nEnableArm7) { + Arm7Open(0); + Arm7Reset(); + Arm7Close(); + } + + ZetOpen(0); + nPgmZ80Work = 0; + ZetReset(); + ZetClose(); + + ics2115_reset(); + + if (pPgmResetCallback) { + pPgmResetCallback(); + } + + return 0; +} + +static void expand_tile_gfx() +{ + UINT8 *src = PGMTileROM; + UINT8 *dst = PGMTileROMExp; + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "kovqhsgs") == 0 || + strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsqh2") == 0 || + strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsjb") == 0 || + strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsjba") == 0 || + strcmp(BurnDrvGetTextA(DRV_NAME), "kovassg") == 0) { + pgm_decode_kovqhsgs_tile_data(PGMTileROM + 0x180000); + } + + for (INT32 i = nPGMTileROMLen/5-1; i >= 0 ; i --) { + dst[0+8*i] = ((src[0+5*i] >> 0) & 0x1f); + dst[1+8*i] = ((src[0+5*i] >> 5) & 0x07) | ((src[1+5*i] << 3) & 0x18); + dst[2+8*i] = ((src[1+5*i] >> 2) & 0x1f ); + dst[3+8*i] = ((src[1+5*i] >> 7) & 0x01) | ((src[2+5*i] << 1) & 0x1e); + dst[4+8*i] = ((src[2+5*i] >> 4) & 0x0f) | ((src[3+5*i] << 4) & 0x10); + dst[5+8*i] = ((src[3+5*i] >> 1) & 0x1f ); + dst[6+8*i] = ((src[3+5*i] >> 6) & 0x03) | ((src[4+5*i] << 2) & 0x1c); + dst[7+8*i] = ((src[4+5*i] >> 3) & 0x1f ); + } + + for (INT32 i = 0x200000-1; i >= 0; i--) { + INT32 d = PGMTileROM[i]; + PGMTileROM[i * 2 + 0] = d & 0x0f; + PGMTileROM[i * 2 + 1] = d >> 4; + } + + PGMTileROM = (UINT8*)realloc(PGMTileROM, 0x400000); +} + +static void expand_colourdata() +{ + // allocate + { + INT32 needed = (nPGMSPRColROMLen / 2) * 3; + nPGMSPRColMaskLen = 1; + while (nPGMSPRColMaskLen < needed) + nPGMSPRColMaskLen <<= 1; + + needed = nPGMSPRMaskROMLen; + nPGMSPRMaskMaskLen = 1; + while (nPGMSPRMaskMaskLen < needed) + nPGMSPRMaskMaskLen <<= 1; + nPGMSPRMaskMaskLen-=1; + + PGMSPRColROM = (UINT8*)BurnMalloc(nPGMSPRColMaskLen); + nPGMSPRColMaskLen -= 1; + } + + UINT8 *tmp = (UINT8*)BurnMalloc(nPGMSPRColROMLen); + if (tmp == NULL) return; + + // load sprite color roms + { + char* pRomName; + struct BurnRomInfo ri; + + UINT8 *PGMSPRColROMLoad = tmp; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & BRF_GRA) && (ri.nType & 0x0f) == 3) + { + BurnLoadRom(PGMSPRColROMLoad, i, 1); + PGMSPRColROMLoad += ri.nLen; + + // fix for 2x size b0601 rom + if (strcmp(BurnDrvGetTextA(DRV_NAME), "kovsh") == 0 || + strcmp(BurnDrvGetTextA(DRV_NAME), "kovsh103") == 0) { + if (ri.nLen == 0x400000) { + PGMSPRColROMLoad -= 0x200000; + } + } + + continue; + } + } + } + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "kovqhsgs") == 0 || + strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsqh2") == 0 || + strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsjb") == 0 || + strcmp(BurnDrvGetTextA(DRV_NAME), "kovlsjba") == 0 || + strcmp(BurnDrvGetTextA(DRV_NAME), "kovassg") == 0) { + pgm_decode_kovqhsgs_gfx_block(tmp + 0x0000000); + pgm_decode_kovqhsgs_gfx_block(tmp + 0x0800000); + pgm_decode_kovqhsgs_gfx_block(tmp + 0x1000000); + pgm_decode_kovqhsgs_gfx_block(tmp + 0x1800000); + pgm_decode_kovqhsgs_gfx_block(tmp + 0x2000000); + pgm_decode_kovqhsgs_gfx_block(tmp + 0x2800000); + } + + // convert from 3bpp packed + for (INT32 cnt = 0; cnt < nPGMSPRColROMLen / 2; cnt++) + { + UINT16 colpack = ((tmp[cnt*2]) | (tmp[cnt*2+1] << 8)); + PGMSPRColROM[cnt*3+0] = (colpack >> 0 ) & 0x1f; + PGMSPRColROM[cnt*3+1] = (colpack >> 5 ) & 0x1f; + PGMSPRColROM[cnt*3+2] = (colpack >> 10) & 0x1f; + } + + BurnFree (tmp); +} + +INT32 pgmInit() +{ + BurnSetRefreshRate((BurnDrvGetHardwareCode() & HARDWARE_IGS_JAMMAPCB) ? 59.17 : 60.00); // different? + + Mem = NULL; + + pgmGetRoms(false); + + expand_colourdata(); + + PGMTileROM = (UINT8*)BurnMalloc(nPGMTileROMLen); // 8x8 Text Tiles + 32x32 BG Tiles + PGMTileROMExp = (UINT8*)BurnMalloc((nPGMTileROMLen / 5) * 8); // Expanded 8x8 Text Tiles and 32x32 BG Tiles + PGMSPRMaskROM = (UINT8*)BurnMalloc(nPGMSPRMaskROMLen); + ICSSNDROM = (UINT8*)BurnMalloc(nPGMSNDROMLen); + + pgmMemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + pgmMemIndex(); + + // load bios roms (68k bios loaded in reset routine) + if (BurnLoadRom(PGMTileROM, 0x80, 1)) return 1; // Bios Text and Tiles + BurnLoadRom(ICSSNDROM, 0x81, 1); // Bios Intro Sounds + + pgmGetRoms(true); + + expand_tile_gfx(); // expand graphics + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // ketsui and espgaluda + if (BurnDrvGetHardwareCode() & HARDWARE_IGS_JAMMAPCB) + { + SekMapMemory(PGM68KROM, 0x000000, (nPGM68KROMLen-1), SM_ROM); // 68000 ROM (no bios) + } + else + { + SekMapMemory(PGM68KBIOS, 0x000000, 0x07ffff, SM_ROM); // 68000 BIOS + SekMapMemory(PGM68KROM, 0x100000, (nPGM68KROMLen-1)+0x100000, SM_ROM); // 68000 ROM + } + + for (INT32 i = 0; i < 0x100000; i+=0x20000) { // Main Ram + Mirrors... + SekMapMemory(PGM68KRAM, 0x800000 | i, 0x81ffff | i, SM_RAM); + } + + // Ripped from FBA Shuffle. + for (INT32 i = 0; i < 0x100000; i+=0x08000) { // Video Ram + Mirrors... + SekMapMemory((UINT8 *)PGMBgRAM, 0x900000 | i, 0x900fff | i, SM_RAM); + SekMapMemory((UINT8 *)PGMBgRAM, 0x901000 | i, 0x901fff | i, SM_RAM); // mirror + SekMapMemory((UINT8 *)PGMBgRAM, 0x902000 | i, 0x902fff | i, SM_RAM); // mirror + SekMapMemory((UINT8 *)PGMBgRAM, 0x903000 | i, 0x904fff | i, SM_RAM); // mirror + + SekMapMemory((UINT8 *)PGMTxtRAM, 0x904000 | i, 0x905fff | i, SM_RAM); + SekMapMemory((UINT8 *)PGMTxtRAM, 0x906000 | i, 0x906fff | i, SM_RAM); // mirror + + SekMapMemory((UINT8 *)PGMRowRAM, 0x907000 | i, 0x907fff | i, SM_RAM); + } + + SekMapMemory((UINT8 *)PGMPalRAM, 0xa00000, 0xa013ff, SM_ROM); // palette + SekMapMemory((UINT8 *)PGMVidReg, 0xb00000, 0xb0ffff, SM_RAM); // should be mirrored? + + SekMapHandler(1, 0xa00000, 0xa013ff, SM_WRITE); + SekMapHandler(2, 0xc10000, 0xc1ffff, SM_READ | SM_WRITE); + + SekSetReadWordHandler(0, PgmReadWord); + SekSetReadByteHandler(0, PgmReadByte); + SekSetWriteWordHandler(0, PgmWriteWord); + SekSetWriteByteHandler(0, PgmWriteByte); + + SekSetWriteByteHandler(1, PgmPaletteWriteByte); + SekSetWriteWordHandler(1, PgmPaletteWriteWord); + + SekSetReadWordHandler(2, PgmZ80ReadWord); + SekSetWriteWordHandler(2, PgmZ80WriteWord); + + SekClose(); + } + + { + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xffff, 0, RamZ80); + ZetMapArea(0x0000, 0xffff, 1, RamZ80); + ZetMapArea(0x0000, 0xffff, 2, RamZ80); + ZetSetOutHandler(PgmZ80PortWrite); + ZetSetInHandler(PgmZ80PortRead); + ZetClose(); + } + + if (BurnDrvGetHardwareCode() & HARDWARE_IGS_USE_ARM_CPU) { + nEnableArm7 = 1; + } + + pgmInitDraw(); + + ics2115_init(); + + pBurnDrvPalette = (UINT32*)PGMPalRAM; + + if (pPgmInitCallback) { + pPgmInitCallback(); + } + + if (pPgmProtCallback) { + pPgmProtCallback(); + } + + PgmDoReset(); + + return 0; +} + +INT32 pgmExit() +{ + pgmExitDraw(); + + SekExit(); + ZetExit(); + + if (nEnableArm7) { + Arm7Exit(); + } + + BurnFree(Mem); + + ics2115_exit(); // frees ICSSNDROM + + BurnFree (PGMTileROM); + BurnFree (PGMTileROMExp); + BurnFree (PGMSPRColROM); + BurnFree (PGMSPRMaskROM); + + nPGM68KROMLen = 0; + nPGMTileROMLen = 0; + nPGMSPRColROMLen = 0; + nPGMSPRMaskROMLen = 0; + nPGMSNDROMLen = 0; + nPGMExternalARMLen = 0; + + pPgmInitCallback = NULL; + pPgmProtCallback = NULL; + pPgmScanCallback = NULL; + pPgmResetCallback = NULL; + + nEnableArm7 = 0; + nPGMDisableIRQ4 = 0; + nPGMArm7Type = 0; + + nPgmCurrentBios = -1; + + return 0; +} + +INT32 pgmFrame() +{ + if (PgmReset) { + PgmDoReset(); + } + + // compile inputs + { + memset (PgmInput, 0, 6); + for (INT32 i = 0; i < 8; i++) { + PgmInput[0] |= (PgmJoy1[i] & 1) << i; + PgmInput[1] |= (PgmJoy2[i] & 1) << i; + PgmInput[2] |= (PgmJoy3[i] & 1) << i; + PgmInput[3] |= (PgmJoy4[i] & 1) << i; + PgmInput[4] |= (PgmBtn1[i] & 1) << i; + PgmInput[5] |= (PgmBtn2[i] & 1) << i; + } + + // clear opposites + if ((PgmInput[0] & 0x06) == 0x06) PgmInput[0] &= 0xf9; // up/down + if ((PgmInput[0] & 0x18) == 0x18) PgmInput[0] &= 0xe7; // left/right + if ((PgmInput[1] & 0x06) == 0x06) PgmInput[1] &= 0xf9; + if ((PgmInput[1] & 0x18) == 0x18) PgmInput[1] &= 0xe7; + if ((PgmInput[2] & 0x06) == 0x06) PgmInput[2] &= 0xf9; + if ((PgmInput[2] & 0x18) == 0x18) PgmInput[2] &= 0xe7; + if ((PgmInput[3] & 0x06) == 0x06) PgmInput[3] &= 0xf9; + if ((PgmInput[3] & 0x18) == 0x18) PgmInput[3] &= 0xe7; + } + + INT32 nCyclesNext[3] = {0, 0, 0}; + nCyclesDone[0] = 0; + nCyclesDone[1] = 0; + nCyclesDone[2] = 0; + + SekNewFrame(); + ZetNewFrame(); + + if (nEnableArm7) + { + Arm7NewFrame(); + + switch (nPGMArm7Type) // region hacks + { + case 1: // kov/kovsh/kovshp/photoy2k/puzlstar/puzzli2/oldsplus/py2k2 + PGMARMShareRAM[0x008] = PgmInput[7]; + break; + + case 2: // martmast/kov2/dw2001/ddp2 + if (strncmp(BurnDrvGetTextA(DRV_NAME), "ddp2", 4) == 0) { + PGMARMShareRAM[0x002] = PgmInput[7]; + } else { + PGMARMShareRAM[0x138] = PgmInput[7]; + } + break; + + case 3: // svg/killbldp/dmnfrnt/theglad/happy6in1 + if (strncmp(BurnDrvGetTextA(DRV_NAME), "dmnfrnt", 7) == 0) { + PGMARMShareRAM[0x158] = PgmInput[7]; + } else { + // unknown + } + break; + } + } + + SekOpen(0); + ZetOpen(0); + if (nEnableArm7) Arm7Open(0); + + for (INT32 i = 0; i < PGM_INTER_LEAVE; i++) + { + nCyclesNext[0] += M68K_CYCS_PER_INTER; + nCyclesNext[1] += Z80_CYCS_PER_INTER; + nCyclesNext[2] += ARM7_CYCS_PER_INTER; + + INT32 cycles = M68K_CYCS_PER_INTER; + + nCyclesDone[0] += SekRun(cycles); + + if (nEnableArm7) { + cycles = SekTotalCycles() - Arm7TotalCycles(); + + if (cycles > 0) { + nCyclesDone[2] += Arm7Run(cycles); + } + } + + if (i == (PGM_INTER_LEAVE / 2) - 1 || i == (PGM_INTER_LEAVE - 1)) { + if (nPgmZ80Work) { + nCyclesDone[1] += ZetRun( nCyclesNext[1] - nCyclesDone[1] ); + } else { + nCyclesDone[1] += nCyclesNext[1] - nCyclesDone[1]; + } + } + + if (i == ((PGM_INTER_LEAVE / 2)-1) && !nPGMDisableIRQ4) { + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + } + + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + + ics2115_frame(); + + if (nEnableArm7) Arm7Close(); + ZetClose(); + SekClose(); + + ics2115_update(nBurnSoundLen); + + if (pBurnDraw) { + pgmDraw(); + } + + memcpy (PGMSprBuf, PGM68KRAM /* Sprite RAM 0-bff */, 0xa00); // buffer sprites + + return 0; +} + +INT32 pgmScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + nPgmPalRecalc = 1; + + if (nAction & ACB_MEMORY_ROM) { + if (BurnDrvGetHardwareCode() & HARDWARE_IGS_JAMMAPCB) { + ba.Data = PGM68KROM; + ba.nLen = nPGM68KROMLen; + ba.nAddress = 0; + ba.szName = "68K ROM"; + BurnAcb(&ba); + } else { + ba.Data = PGM68KBIOS; + ba.nLen = 0x0020000; + ba.nAddress = 0; + ba.szName = "BIOS ROM"; + BurnAcb(&ba); + + ba.Data = PGM68KROM; + ba.nLen = nPGM68KROMLen; + ba.nAddress = 0x100000; + ba.szName = "68K ROM"; + BurnAcb(&ba); + } + } + + if (nAction & ACB_MEMORY_RAM) { + ba.Data = PGMBgRAM; + ba.nLen = 0x0004000; + ba.nAddress = 0x900000; + ba.szName = "Bg RAM"; + BurnAcb(&ba); + + ba.Data = PGMTxtRAM; + ba.nLen = 0x0003000; + ba.nAddress = 0x904000; + ba.szName = "Tx RAM"; + BurnAcb(&ba); + + ba.Data = PGMRowRAM; + ba.nLen = 0x0001000; + ba.nAddress = 0x907000; + ba.szName = "Row Scroll"; + BurnAcb(&ba); + + ba.Data = PGMPalRAM; + ba.nLen = 0x0001400; + ba.nAddress = 0xA00000; + ba.szName = "Palette"; + BurnAcb(&ba); + + ba.Data = PGMVidReg; + ba.nLen = 0x0010000; + ba.nAddress = 0xB00000; + ba.szName = "Video Regs"; + BurnAcb(&ba); + + ba.Data = RamZ80; + ba.nLen = 0x0010000; + ba.nAddress = 0xC10000; + ba.szName = "Z80 RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_NVRAM) { + ba.Data = PGM68KRAM; + ba.nLen = 0x020000; + ba.nAddress = 0x800000; + ba.szName = "68K RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + + SekScan(nAction); + ZetScan(nAction); + + v3021Scan(); + + SCAN_VAR(PgmInput); + + SCAN_VAR(nPgmZ80Work); + + SCAN_VAR(nPgmCurrentBios); + + ics2115_scan(nAction, pnMin); + } + + if (pPgmScanCallback) { + pPgmScanCallback(nAction, pnMin); + } + + return 0; +} diff --git a/src/burn/drv/pre90s/d_1942.cpp b/src/burn/drv/pre90s/d_1942.cpp index 0dbb0e1d8..47e97f45a 100644 --- a/src/burn/drv/pre90s/d_1942.cpp +++ b/src/burn/drv/pre90s/d_1942.cpp @@ -1,1065 +1,1063 @@ -#include "tiles_generic.h" -#include "z80_intf.h" - -#include "driver.h" -extern "C" { - #include "ay8910.h" -} - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[2] = {0, 0}; -static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *DrvZ80Rom1 = NULL; -static UINT8 *DrvZ80Rom2 = NULL; -static UINT8 *DrvZ80Ram1 = NULL; -static UINT8 *DrvZ80Ram2 = NULL; -static UINT8 *DrvFgVideoRam = NULL; -static UINT8 *DrvBgVideoRam = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvPromRed = NULL; -static UINT8 *DrvPromGreen = NULL; -static UINT8 *DrvPromBlue = NULL; -static UINT8 *DrvPromCharLookup = NULL; -static UINT8 *DrvPromTileLookup = NULL; -static UINT8 *DrvPromSpriteLookup = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; -static INT16* pFMBuffer; -static INT16* pAY8910Buffer[6]; - -static UINT8 DrvRomBank; -static UINT8 DrvPaletteBank; -static UINT8 DrvBgScroll[2]; -static UINT8 DrvFlipScreen; -static UINT8 DrvSoundLatch; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, - {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - - -STDINPUTINFO(Drv) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - } - - // Clear Opposites - DrvClearOpposites(&DrvInput[1]); - DrvClearOpposites(&DrvInput[2]); -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xf7, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x12, 0x01, 0x07, 0x01, "4 Coins 1 Play" }, - {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Play" }, - {0x12, 0x01, 0x07, 0x04, "2 Coins 1 Play" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x12, 0x01, 0x07, 0x03, "2 Coins 3 Plays" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 4 Plays" }, - {0x12, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x08, 0x00, "Upright" }, - {0x12, 0x01, 0x08, 0x08, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x12, 0x01, 0x30, 0x30, "20k 80k 80k+" }, - {0x12, 0x01, 0x30, 0x20, "20k 100k 100k+" }, - {0x12, 0x01, 0x30, 0x10, "30k 80k 80k+" }, - {0x12, 0x01, 0x30, 0x00, "30k 100k 100k+" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0xc0, 0x80, "1" }, - {0x12, 0x01, 0xc0, 0x40, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x00, "5" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x07, 0x01, "4 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x02, "3 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x04, "2 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x13, 0x01, 0x07, 0x03, "2 Coins 3 Plays" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x60, 0x40, "Easy" }, - {0x13, 0x01, 0x60, 0x60, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2 , "Screen Stop" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Drv) - -static struct BurnRomInfo DrvRomDesc[] = { - { "srb-03.m3", 0x04000, 0xd9dafcc3, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "srb-04.m4", 0x04000, 0xda0cf924, BRF_ESS | BRF_PRG }, // 1 - { "srb-05.m5", 0x04000, 0xd102911c, BRF_ESS | BRF_PRG }, // 2 - { "srb-06.m6", 0x02000, 0x466f8248, BRF_ESS | BRF_PRG }, // 3 - { "srb-07.m7", 0x04000, 0x0d31038c, BRF_ESS | BRF_PRG }, // 4 - - { "sr-01.c11", 0x04000, 0xbd87f06b, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program - - { "sr-02.f2", 0x02000, 0x6ebca191, BRF_GRA }, // 6 Characters - - { "sr-08.a1", 0x02000, 0x3884d9eb, BRF_GRA }, // 7 Tiles - { "sr-09.a2", 0x02000, 0x999cf6e0, BRF_GRA }, // 8 - { "sr-10.a3", 0x02000, 0x8edb273a, BRF_GRA }, // 9 - { "sr-11.a4", 0x02000, 0x3a2726c3, BRF_GRA }, // 10 - { "sr-12.a5", 0x02000, 0x1bd3d8bb, BRF_GRA }, // 11 - { "sr-13.a6", 0x02000, 0x658f02c4, BRF_GRA }, // 12 - - { "sr-14.l1", 0x04000, 0x2528bec6, BRF_GRA }, // 13 Sprites - { "sr-15.l2", 0x04000, 0xf89287aa, BRF_GRA }, // 14 - { "sr-16.n1", 0x04000, 0x024418f8, BRF_GRA }, // 15 - { "sr-17.n2", 0x04000, 0xe2c7e489, BRF_GRA }, // 16 - - { "sb-5.e8", 0x00100, 0x93ab8153, BRF_GRA }, // 17 PROMs - { "sb-6.e9", 0x00100, 0x8ab44f7d, BRF_GRA }, // 18 - { "sb-7.e10", 0x00100, 0xf4ade9a4, BRF_GRA }, // 19 - { "sb-0.f1", 0x00100, 0x6047d91b, BRF_GRA }, // 20 - { "sb-4.d6", 0x00100, 0x4858968d, BRF_GRA }, // 21 - { "sb-8.k3", 0x00100, 0xf6fad943, BRF_GRA }, // 22 - { "sb-2.d1", 0x00100, 0x8bb8b3df, BRF_GRA }, // 23 - { "sb-3.d2", 0x00100, 0x3b0c99af, BRF_GRA }, // 24 - { "sb-1.k6", 0x00100, 0x712ac508, BRF_GRA }, // 25 - { "sb-9.m11", 0x00100, 0x4921635c, BRF_GRA }, // 26 -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo DrvaRomDesc[] = { - { "sra-03.m3", 0x04000, 0x40201bab, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "sr-04.m4", 0x04000, 0xa60ac644, BRF_ESS | BRF_PRG }, // 1 - { "sr-05.m5", 0x04000, 0x835f7b24, BRF_ESS | BRF_PRG }, // 2 - { "sr-06.m6", 0x02000, 0x821c6481, BRF_ESS | BRF_PRG }, // 3 - { "sr-07.m7", 0x04000, 0x5df525e1, BRF_ESS | BRF_PRG }, // 4 - - { "sr-01.c11", 0x04000, 0xbd87f06b, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program - - { "sr-02.f2", 0x02000, 0x6ebca191, BRF_GRA }, // 6 Characters - - { "sr-08.a1", 0x02000, 0x3884d9eb, BRF_GRA }, // 7 Tiles - { "sr-09.a2", 0x02000, 0x999cf6e0, BRF_GRA }, // 8 - { "sr-10.a3", 0x02000, 0x8edb273a, BRF_GRA }, // 9 - { "sr-11.a4", 0x02000, 0x3a2726c3, BRF_GRA }, // 10 - { "sr-12.a5", 0x02000, 0x1bd3d8bb, BRF_GRA }, // 11 - { "sr-13.a6", 0x02000, 0x658f02c4, BRF_GRA }, // 12 - - { "sr-14.l1", 0x04000, 0x2528bec6, BRF_GRA }, // 13 Sprites - { "sr-15.l2", 0x04000, 0xf89287aa, BRF_GRA }, // 14 - { "sr-16.n1", 0x04000, 0x024418f8, BRF_GRA }, // 15 - { "sr-17.n2", 0x04000, 0xe2c7e489, BRF_GRA }, // 16 - - { "sb-5.e8", 0x00100, 0x93ab8153, BRF_GRA }, // 17 PROMs - { "sb-6.e9", 0x00100, 0x8ab44f7d, BRF_GRA }, // 18 - { "sb-7.e10", 0x00100, 0xf4ade9a4, BRF_GRA }, // 19 - { "sb-0.f1", 0x00100, 0x6047d91b, BRF_GRA }, // 20 - { "sb-4.d6", 0x00100, 0x4858968d, BRF_GRA }, // 21 - { "sb-8.k3", 0x00100, 0xf6fad943, BRF_GRA }, // 22 - { "sb-2.d1", 0x00100, 0x8bb8b3df, BRF_GRA }, // 23 - { "sb-3.d2", 0x00100, 0x3b0c99af, BRF_GRA }, // 24 - { "sb-1.k6", 0x00100, 0x712ac508, BRF_GRA }, // 25 - { "sb-9.m11", 0x00100, 0x4921635c, BRF_GRA }, // 26 -}; - -STD_ROM_PICK(Drva) -STD_ROM_FN(Drva) - -static struct BurnRomInfo DrvablRomDesc[] = { - { "3.bin", 0x08000, 0xf3184f5a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "5.bin", 0x04000, 0x835f7b24, BRF_ESS | BRF_PRG }, // 1 - { "7.bin", 0x08000, 0x2f456c6e, BRF_ESS | BRF_PRG }, // 2 - - { "1.bin", 0x04000, 0xbd87f06b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "2.bin", 0x02000, 0x6ebca191, BRF_GRA }, // 4 Characters - - { "9.bin", 0x04000, 0x60329fa4, BRF_GRA }, // 5 Tiles - { "11.bin", 0x04000, 0x66bac116, BRF_GRA }, // 6 - { "13.bin", 0x04000, 0x623fcec1, BRF_GRA }, // 7 - - { "14.bin", 0x08000, 0xdf2345ef, BRF_GRA }, // 8 Sprites - { "16.bin", 0x08000, 0xc106b1ed, BRF_GRA }, // 9 - - { "sb-5.e8", 0x00100, 0x93ab8153, BRF_GRA }, // 10 PROMs - { "sb-6.e9", 0x00100, 0x8ab44f7d, BRF_GRA }, // 11 - { "sb-7.e10", 0x00100, 0xf4ade9a4, BRF_GRA }, // 12 - { "sb-0.f1", 0x00100, 0x6047d91b, BRF_GRA }, // 13 - { "sb-4.d6", 0x00100, 0x4858968d, BRF_GRA }, // 14 - { "sb-8.k3", 0x00100, 0xf6fad943, BRF_GRA }, // 15 - { "sb-2.d1", 0x00100, 0x8bb8b3df, BRF_GRA }, // 16 - { "sb-3.d2", 0x00100, 0x3b0c99af, BRF_GRA }, // 17 - { "sb-1.k6", 0x00100, 0x712ac508, BRF_GRA }, // 18 - { "sb-9.m11", 0x00100, 0x4921635c, BRF_GRA }, // 19 -}; - -STD_ROM_PICK(Drvabl) -STD_ROM_FN(Drvabl) - -static struct BurnRomInfo DrvbRomDesc[] = { - { "sr-03.m3", 0x04000, 0x612975f2, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "sr-04.m4", 0x04000, 0xa60ac644, BRF_ESS | BRF_PRG }, // 1 - { "sr-05.m5", 0x04000, 0x835f7b24, BRF_ESS | BRF_PRG }, // 2 - { "sr-06.m6", 0x02000, 0x821c6481, BRF_ESS | BRF_PRG }, // 3 - { "sr-07.m7", 0x04000, 0x5df525e1, BRF_ESS | BRF_PRG }, // 4 - - { "sr-01.c11", 0x04000, 0xbd87f06b, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program - - { "sr-02.f2", 0x02000, 0x6ebca191, BRF_GRA }, // 6 Characters - - { "sr-08.a1", 0x02000, 0x3884d9eb, BRF_GRA }, // 7 Tiles - { "sr-09.a2", 0x02000, 0x999cf6e0, BRF_GRA }, // 8 - { "sr-10.a3", 0x02000, 0x8edb273a, BRF_GRA }, // 9 - { "sr-11.a4", 0x02000, 0x3a2726c3, BRF_GRA }, // 10 - { "sr-12.a5", 0x02000, 0x1bd3d8bb, BRF_GRA }, // 11 - { "sr-13.a6", 0x02000, 0x658f02c4, BRF_GRA }, // 12 - - { "sr-14.l1", 0x04000, 0x2528bec6, BRF_GRA }, // 13 Sprites - { "sr-15.l2", 0x04000, 0xf89287aa, BRF_GRA }, // 14 - { "sr-16.n1", 0x04000, 0x024418f8, BRF_GRA }, // 15 - { "sr-17.n2", 0x04000, 0xe2c7e489, BRF_GRA }, // 16 - - { "sb-5.e8", 0x00100, 0x93ab8153, BRF_GRA }, // 17 PROMs - { "sb-6.e9", 0x00100, 0x8ab44f7d, BRF_GRA }, // 18 - { "sb-7.e10", 0x00100, 0xf4ade9a4, BRF_GRA }, // 19 - { "sb-0.f1", 0x00100, 0x6047d91b, BRF_GRA }, // 20 - { "sb-4.d6", 0x00100, 0x4858968d, BRF_GRA }, // 21 - { "sb-8.k3", 0x00100, 0xf6fad943, BRF_GRA }, // 22 - { "sb-2.d1", 0x00100, 0x8bb8b3df, BRF_GRA }, // 23 - { "sb-3.d2", 0x00100, 0x3b0c99af, BRF_GRA }, // 24 - { "sb-1.k6", 0x00100, 0x712ac508, BRF_GRA }, // 25 - { "sb-9.m11", 0x00100, 0x4921635c, BRF_GRA }, // 26 -}; - -STD_ROM_PICK(Drvb) -STD_ROM_FN(Drvb) - -static struct BurnRomInfo DrvwRomDesc[] = { - { "sw-03.m3", 0x04000, 0xafd79770, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "sw-04.m4", 0x04000, 0x933d9910, BRF_ESS | BRF_PRG }, // 1 - { "sw-05.m5", 0x04000, 0xe9a71bb6, BRF_ESS | BRF_PRG }, // 2 - { "sw-06.m6", 0x02000, 0x466f8248, BRF_ESS | BRF_PRG }, // 3 - { "sw-07.m7", 0x04000, 0xec41655e, BRF_ESS | BRF_PRG }, // 4 - - { "sr-01.c11", 0x04000, 0xbd87f06b, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program - - { "sw-02.f2", 0x02000, 0xf8e9ada2, BRF_GRA }, // 6 Characters - - { "sr-08.a1", 0x02000, 0x3884d9eb, BRF_GRA }, // 7 Tiles - { "sr-09.a2", 0x02000, 0x999cf6e0, BRF_GRA }, // 8 - { "sr-10.a3", 0x02000, 0x8edb273a, BRF_GRA }, // 9 - { "sr-11.a4", 0x02000, 0x3a2726c3, BRF_GRA }, // 10 - { "sr-12.a5", 0x02000, 0x1bd3d8bb, BRF_GRA }, // 11 - { "sr-13.a6", 0x02000, 0x658f02c4, BRF_GRA }, // 12 - - { "sr-14.l1", 0x04000, 0x2528bec6, BRF_GRA }, // 13 Sprites - { "sr-15.l2", 0x04000, 0xf89287aa, BRF_GRA }, // 14 - { "sr-16.n1", 0x04000, 0x024418f8, BRF_GRA }, // 15 - { "sr-17.n2", 0x04000, 0xe2c7e489, BRF_GRA }, // 16 - - { "sb-5.e8", 0x00100, 0x93ab8153, BRF_GRA }, // 17 PROMs - { "sb-6.e9", 0x00100, 0x8ab44f7d, BRF_GRA }, // 18 - { "sb-7.e10", 0x00100, 0xf4ade9a4, BRF_GRA }, // 19 - { "sb-0.f1", 0x00100, 0x6047d91b, BRF_GRA }, // 20 - { "sb-4.d6", 0x00100, 0x4858968d, BRF_GRA }, // 21 - { "sb-8.k3", 0x00100, 0xf6fad943, BRF_GRA }, // 22 - { "sb-2.d1", 0x00100, 0x8bb8b3df, BRF_GRA }, // 23 - { "sb-3.d2", 0x00100, 0x3b0c99af, BRF_GRA }, // 24 - { "sb-1.k6", 0x00100, 0x712ac508, BRF_GRA }, // 25 - { "sb-9.m11", 0x00100, 0x4921635c, BRF_GRA }, // 26 -}; - -STD_ROM_PICK(Drvw) -STD_ROM_FN(Drvw) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom1 = Next; Next += 0x1c000; - DrvZ80Rom2 = Next; Next += 0x04000; - DrvPromRed = Next; Next += 0x00100; - DrvPromGreen = Next; Next += 0x00100; - DrvPromBlue = Next; Next += 0x00100; - DrvPromCharLookup = Next; Next += 0x00100; - DrvPromTileLookup = Next; Next += 0x00100; - DrvPromSpriteLookup = Next; Next += 0x00100; - - RamStart = Next; - - DrvZ80Ram1 = Next; Next += 0x01000; - DrvZ80Ram2 = Next; Next += 0x00800; - DrvSpriteRam = Next; Next += 0x00080; - DrvFgVideoRam = Next; Next += 0x00800; - DrvBgVideoRam = Next; Next += 0x00400; - - RamEnd = Next; - - DrvChars = Next; Next += 0x200 * 8 * 8; - DrvTiles = Next; Next += 0x200 * 16 * 16; - DrvSprites = Next; Next += 0x200 * 16 * 16; - pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); - DrvPalette = (UINT32*)Next; Next += 0x00600 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - for (INT32 i = 0; i < 2; i++) { - AY8910Reset(i); - } - - DrvPaletteBank = 0; - DrvBgScroll[0] = 0; - DrvBgScroll[1] = 0; - DrvFlipScreen = 0; - DrvSoundLatch = 0; - DrvRomBank = 0; - - return 0; -} - -UINT8 __fastcall Drv1942Read1(UINT16 a) -{ - switch (a) { - case 0xc000: { - return 0xff - DrvInput[0]; - } - - case 0xc001: { - return 0xff - DrvInput[1]; - } - - case 0xc002: { - return 0xff - DrvInput[2]; - } - - case 0xc003: { - return DrvDip[0]; - } - - case 0xc004: { - return DrvDip[1]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall Drv1942Write1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xc800: { - DrvSoundLatch = d; - return; - } - - case 0xc802: { - DrvBgScroll[0] = d; - return; - } - - case 0xc803: { - DrvBgScroll[1] = d; - return; - } - - case 0xc804: { - DrvFlipScreen = d & 0x80; - if (d & 0x10) { - ZetClose(); - ZetOpen(1); - ZetReset(); - ZetClose(); - ZetOpen(0); - } - return; - } - - case 0xc805: { - DrvPaletteBank = d; - return; - } - - case 0xc806: { - d &= 0x03; - DrvRomBank = d; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x4000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x4000 ); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Drv1942Read2(UINT16 a) -{ - switch (a) { - case 0x6000: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall Drv1942Write2(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x8000: { - AY8910Write(0, 0, d); - return; - } - - case 0x8001: { - AY8910Write(0, 1, d); - return; - } - - case 0xc000: { - AY8910Write(1, 0, d); - return; - } - - case 0xc001: { - AY8910Write(1, 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); - } - } -} - - -static INT32 CharPlaneOffsets[2] = { 4, 0 }; -static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; -static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; -static INT32 TilePlaneOffsets[3] = { 0, 0x20000, 0x40000 }; -static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; -static INT32 SpritePlaneOffsets[4] = { 0x40004, 0x40000, 4, 0 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; -static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; - -static void MachineInit() -{ - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Drv1942Read1); - ZetSetWriteHandler(Drv1942Write1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0xcc00, 0xcc7f, 0, DrvSpriteRam ); - ZetMapArea(0xcc00, 0xcc7f, 1, DrvSpriteRam ); - ZetMapArea(0xcc00, 0xcc7f, 2, DrvSpriteRam ); - ZetMapArea(0xd000, 0xd7ff, 0, DrvFgVideoRam ); - ZetMapArea(0xd000, 0xd7ff, 1, DrvFgVideoRam ); - ZetMapArea(0xd000, 0xd7ff, 2, DrvFgVideoRam ); - ZetMapArea(0xd800, 0xdbff, 0, DrvBgVideoRam ); - ZetMapArea(0xd800, 0xdbff, 1, DrvBgVideoRam ); - ZetMapArea(0xd800, 0xdbff, 2, DrvBgVideoRam ); - ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(Drv1942Read2); - ZetSetWriteHandler(Drv1942Write2); - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom2 ); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom2 ); - ZetMapArea(0x4000, 0x47ff, 0, DrvZ80Ram2 ); - ZetMapArea(0x4000, 0x47ff, 1, DrvZ80Ram2 ); - ZetMapArea(0x4000, 0x47ff, 2, DrvZ80Ram2 ); - ZetMemEnd(); - ZetClose(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - - AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); -} - -static INT32 DrvInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x10000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x14000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 4, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 5, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x02000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x06000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0a000, 12, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 3, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c000, 16, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load the PROMs - nRet = BurnLoadRom(DrvPromRed, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromGreen, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBlue, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromCharLookup, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromTileLookup, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromSpriteLookup, 22, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - MachineInit(); - - return 0; -} - -static INT32 DrvablInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x14000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 4, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 3, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; - memcpy(DrvTempRom + 0x04000, DrvTempRom + 0x10000, 0x4000); - memcpy(DrvTempRom + 0x00000, DrvTempRom + 0x14000, 0x4000); - nRet = BurnLoadRom(DrvTempRom + 0x10000, 9, 1); if (nRet != 0) return 1; - memcpy(DrvTempRom + 0x0c000, DrvTempRom + 0x10000, 0x4000); - memcpy(DrvTempRom + 0x08000, DrvTempRom + 0x14000, 0x4000); - GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load the PROMs - nRet = BurnLoadRom(DrvPromRed, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromGreen, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBlue, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromCharLookup, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromTileLookup, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromSpriteLookup, 15, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - MachineInit(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - - for (INT32 i = 0; i < 2; i++) { - AY8910Exit(i); - } - - GenericTilesExit(); - - DrvPaletteBank = 0; - DrvBgScroll[0] = 0; - DrvBgScroll[1] = 0; - DrvFlipScreen = 0; - DrvSoundLatch = 0; - DrvRomBank = 0; - - BurnFree(Mem); - - return 0; -} - -static void DrvCalcPalette() -{ - INT32 i; - UINT32 Palette[256]; - - for (i = 0; i < 256; i++) { - INT32 bit0, bit1, bit2, bit3, r, g, b; - - bit0 = (DrvPromRed[i] >> 0) & 0x01; - bit1 = (DrvPromRed[i] >> 1) & 0x01; - bit2 = (DrvPromRed[i] >> 2) & 0x01; - bit3 = (DrvPromRed[i] >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvPromGreen[i] >> 0) & 0x01; - bit1 = (DrvPromGreen[i] >> 1) & 0x01; - bit2 = (DrvPromGreen[i] >> 2) & 0x01; - bit3 = (DrvPromGreen[i] >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvPromBlue[i] >> 0) & 0x01; - bit1 = (DrvPromBlue[i] >> 1) & 0x01; - bit2 = (DrvPromBlue[i] >> 2) & 0x01; - bit3 = (DrvPromBlue[i] >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - Palette[i] = BurnHighCol(r, g, b, 0); - } - - for (i = 0; i < 256; i++) { - DrvPalette[i] = Palette[0x80 | DrvPromCharLookup[i]]; - } - - for (i = 0; i < 256; i++) { - DrvPalette[256 + i + 0] = Palette[0x00 | DrvPromTileLookup[i]]; - DrvPalette[256 + i + 256] = Palette[0x10 | DrvPromTileLookup[i]]; - DrvPalette[256 + i + 512] = Palette[0x20 | DrvPromTileLookup[i]]; - DrvPalette[256 + i + 768] = Palette[0x30 | DrvPromTileLookup[i]]; - } - - for (i = 0; i < 256; i++) { - DrvPalette[1280 + i] = Palette[0x40 | DrvPromSpriteLookup[i]]; - } -} - -static void DrvRenderBgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex, xScroll, Flip, xFlip, yFlip; - - xScroll = DrvBgScroll[0] | (DrvBgScroll[1] << 8); - xScroll &= 0x1ff; - - for (mx = 0; mx < 16; mx++) { - for (my = 0; my < 32; my++) { - TileIndex = (my * 16) + mx; - TileIndex = (TileIndex & 0x0f) | ((TileIndex & 0x01f0) << 1); - - Code = DrvBgVideoRam[TileIndex]; - Colour = DrvBgVideoRam[TileIndex + 0x10]; - Code += (Colour & 0x80) << 1; - Flip = (Colour & 0x60) >> 5; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - Colour &= 0x1f; - - y = 16 * mx; - x = 16 * my; - x -= xScroll; - if (x < -16) x += 512; - y -= 16; - - if (x > 0 && x < 240 && y > 0 && y < 208) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); - } else { - Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); - } else { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); - } else { - Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); - } - } - } - } - } -} - -static void DrvRenderSpriteLayer() -{ - INT32 Offset; - - for (Offset = 0x80 - 4; Offset >= 0; Offset -= 4) { - INT32 i, Code, Colour, sx, sy, Dir; - - Code = (DrvSpriteRam[Offset] & 0x7f) + (4 * (DrvSpriteRam[Offset + 1] & 0x20)) + (2 * (DrvSpriteRam[Offset] & 0x80)); - Colour = DrvSpriteRam[Offset + 1] & 0x0f; - sx = DrvSpriteRam[Offset + 3] - (0x10 * (DrvSpriteRam[Offset + 1] & 0x10)); - sy = DrvSpriteRam[Offset + 2]; - Dir = 1; - - i = (DrvSpriteRam[Offset + 1] & 0xc0) >> 6; - if (i == 2) i = 3; - - do { - Render16x16Tile_Mask_Clip(pTransDraw, Code + i, sx, (sy + (16 * i) * Dir) - 16, Colour, 4, 15, 1280, DrvSprites); - - i--; - } while (i >= 0); - } -} - -static void DrvRenderCharLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Code = DrvFgVideoRam[TileIndex]; - Colour = DrvFgVideoRam[TileIndex + 0x400]; - Code += (Colour & 0x80) << 1; - Colour &= 0x3f; - - x = 8 * mx; - y = 8 * my; - - y -= 16; - - if (x > 0 && x < 248 && y > 0 && y < 216) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 0, 0, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, DrvChars); - } - - TileIndex++; - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - DrvRenderBgLayer(); - DrvRenderSpriteLayer(); - DrvRenderCharLayer(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 4; - INT32 nSoundBufferPos = 0; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 4000000 / 60; - nCyclesTotal[1] = 3000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - -// ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 1) { - ZetSetVector(0xcf); - ZetRaiseIrq(0); - } - if (i == 3) { - ZetSetVector(0xd7); - ZetRaiseIrq(0); - } - ZetClose(); - - // Run Z80 #2 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetRaiseIrq(0); - ZetClose(); - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029672; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); // Scan Z80 - AY8910Scan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(DrvRomBank); - SCAN_VAR(DrvPaletteBank); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(DrvBgScroll); - SCAN_VAR(DrvFlipScreen); - SCAN_VAR(DrvDip); - SCAN_VAR(DrvInput); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x4000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x4000 ); - ZetClose(); - } - - return 0; -} - -struct BurnDriver BurnDrvNineteen42 = { - "1942", NULL, NULL, NULL, "1984", - "1942 (Revision B)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNineteen42a = { - "1942a", "1942", NULL, NULL, "1984", - "1942 (Revision A)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvaRomInfo, DrvaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNineteen42abl = { - "1942abl", "1942", NULL, NULL, "1984", - "1942 (Revision A, bootleg)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvablRomInfo, DrvablRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvablInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNineteen42b = { - "1942b", "1942", NULL, NULL, "1984", - "1942 (First Version)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNineteen42w = { - "1942w", "1942", NULL, NULL, "1985", - "1942 (Williams Electronics license)\0", NULL, "Capcom (Williams Electronics license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvwRomInfo, DrvwRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 224, 256, 3, 4 -}; +#include "tiles_generic.h" +#include "z80_intf.h" + +#include "driver.h" +extern "C" { + #include "ay8910.h" +} + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[2] = {0, 0}; +static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *DrvZ80Rom1 = NULL; +static UINT8 *DrvZ80Rom2 = NULL; +static UINT8 *DrvZ80Ram1 = NULL; +static UINT8 *DrvZ80Ram2 = NULL; +static UINT8 *DrvFgVideoRam = NULL; +static UINT8 *DrvBgVideoRam = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvPromRed = NULL; +static UINT8 *DrvPromGreen = NULL; +static UINT8 *DrvPromBlue = NULL; +static UINT8 *DrvPromCharLookup = NULL; +static UINT8 *DrvPromTileLookup = NULL; +static UINT8 *DrvPromSpriteLookup = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; +static INT16* pFMBuffer; +static INT16* pAY8910Buffer[6]; + +static UINT8 DrvRomBank; +static UINT8 DrvPaletteBank; +static UINT8 DrvBgScroll[2]; +static UINT8 DrvFlipScreen; +static UINT8 DrvSoundLatch; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, + {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 4, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + + +STDINPUTINFO(Drv) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + } + + // Clear Opposites + DrvClearOpposites(&DrvInput[1]); + DrvClearOpposites(&DrvInput[2]); +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xf7, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x12, 0x01, 0x07, 0x01, "4 Coins 1 Play" }, + {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Play" }, + {0x12, 0x01, 0x07, 0x04, "2 Coins 1 Play" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x12, 0x01, 0x07, 0x03, "2 Coins 3 Plays" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 4 Plays" }, + {0x12, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x08, 0x00, "Upright" }, + {0x12, 0x01, 0x08, 0x08, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x12, 0x01, 0x30, 0x30, "20k 80k 80k+" }, + {0x12, 0x01, 0x30, 0x20, "20k 100k 100k+" }, + {0x12, 0x01, 0x30, 0x10, "30k 80k 80k+" }, + {0x12, 0x01, 0x30, 0x00, "30k 100k 100k+" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0xc0, 0x80, "1" }, + {0x12, 0x01, 0xc0, 0x40, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x00, "5" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x07, 0x01, "4 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x02, "3 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x04, "2 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x13, 0x01, 0x07, 0x03, "2 Coins 3 Plays" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x60, 0x40, "Easy" }, + {0x13, 0x01, 0x60, 0x60, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2 , "Screen Stop" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Drv) + +static struct BurnRomInfo DrvRomDesc[] = { + { "srb-03.m3", 0x04000, 0xd9dafcc3, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "srb-04.m4", 0x04000, 0xda0cf924, BRF_ESS | BRF_PRG }, // 1 + { "srb-05.m5", 0x04000, 0xd102911c, BRF_ESS | BRF_PRG }, // 2 + { "srb-06.m6", 0x02000, 0x466f8248, BRF_ESS | BRF_PRG }, // 3 + { "srb-07.m7", 0x04000, 0x0d31038c, BRF_ESS | BRF_PRG }, // 4 + + { "sr-01.c11", 0x04000, 0xbd87f06b, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program + + { "sr-02.f2", 0x02000, 0x6ebca191, BRF_GRA }, // 6 Characters + + { "sr-08.a1", 0x02000, 0x3884d9eb, BRF_GRA }, // 7 Tiles + { "sr-09.a2", 0x02000, 0x999cf6e0, BRF_GRA }, // 8 + { "sr-10.a3", 0x02000, 0x8edb273a, BRF_GRA }, // 9 + { "sr-11.a4", 0x02000, 0x3a2726c3, BRF_GRA }, // 10 + { "sr-12.a5", 0x02000, 0x1bd3d8bb, BRF_GRA }, // 11 + { "sr-13.a6", 0x02000, 0x658f02c4, BRF_GRA }, // 12 + + { "sr-14.l1", 0x04000, 0x2528bec6, BRF_GRA }, // 13 Sprites + { "sr-15.l2", 0x04000, 0xf89287aa, BRF_GRA }, // 14 + { "sr-16.n1", 0x04000, 0x024418f8, BRF_GRA }, // 15 + { "sr-17.n2", 0x04000, 0xe2c7e489, BRF_GRA }, // 16 + + { "sb-5.e8", 0x00100, 0x93ab8153, BRF_GRA }, // 17 PROMs + { "sb-6.e9", 0x00100, 0x8ab44f7d, BRF_GRA }, // 18 + { "sb-7.e10", 0x00100, 0xf4ade9a4, BRF_GRA }, // 19 + { "sb-0.f1", 0x00100, 0x6047d91b, BRF_GRA }, // 20 + { "sb-4.d6", 0x00100, 0x4858968d, BRF_GRA }, // 21 + { "sb-8.k3", 0x00100, 0xf6fad943, BRF_GRA }, // 22 + { "sb-2.d1", 0x00100, 0x8bb8b3df, BRF_GRA }, // 23 + { "sb-3.d2", 0x00100, 0x3b0c99af, BRF_GRA }, // 24 + { "sb-1.k6", 0x00100, 0x712ac508, BRF_GRA }, // 25 + { "sb-9.m11", 0x00100, 0x4921635c, BRF_GRA }, // 26 +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo DrvaRomDesc[] = { + { "sra-03.m3", 0x04000, 0x40201bab, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "sr-04.m4", 0x04000, 0xa60ac644, BRF_ESS | BRF_PRG }, // 1 + { "sr-05.m5", 0x04000, 0x835f7b24, BRF_ESS | BRF_PRG }, // 2 + { "sr-06.m6", 0x02000, 0x821c6481, BRF_ESS | BRF_PRG }, // 3 + { "sr-07.m7", 0x04000, 0x5df525e1, BRF_ESS | BRF_PRG }, // 4 + + { "sr-01.c11", 0x04000, 0xbd87f06b, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program + + { "sr-02.f2", 0x02000, 0x6ebca191, BRF_GRA }, // 6 Characters + + { "sr-08.a1", 0x02000, 0x3884d9eb, BRF_GRA }, // 7 Tiles + { "sr-09.a2", 0x02000, 0x999cf6e0, BRF_GRA }, // 8 + { "sr-10.a3", 0x02000, 0x8edb273a, BRF_GRA }, // 9 + { "sr-11.a4", 0x02000, 0x3a2726c3, BRF_GRA }, // 10 + { "sr-12.a5", 0x02000, 0x1bd3d8bb, BRF_GRA }, // 11 + { "sr-13.a6", 0x02000, 0x658f02c4, BRF_GRA }, // 12 + + { "sr-14.l1", 0x04000, 0x2528bec6, BRF_GRA }, // 13 Sprites + { "sr-15.l2", 0x04000, 0xf89287aa, BRF_GRA }, // 14 + { "sr-16.n1", 0x04000, 0x024418f8, BRF_GRA }, // 15 + { "sr-17.n2", 0x04000, 0xe2c7e489, BRF_GRA }, // 16 + + { "sb-5.e8", 0x00100, 0x93ab8153, BRF_GRA }, // 17 PROMs + { "sb-6.e9", 0x00100, 0x8ab44f7d, BRF_GRA }, // 18 + { "sb-7.e10", 0x00100, 0xf4ade9a4, BRF_GRA }, // 19 + { "sb-0.f1", 0x00100, 0x6047d91b, BRF_GRA }, // 20 + { "sb-4.d6", 0x00100, 0x4858968d, BRF_GRA }, // 21 + { "sb-8.k3", 0x00100, 0xf6fad943, BRF_GRA }, // 22 + { "sb-2.d1", 0x00100, 0x8bb8b3df, BRF_GRA }, // 23 + { "sb-3.d2", 0x00100, 0x3b0c99af, BRF_GRA }, // 24 + { "sb-1.k6", 0x00100, 0x712ac508, BRF_GRA }, // 25 + { "sb-9.m11", 0x00100, 0x4921635c, BRF_GRA }, // 26 +}; + +STD_ROM_PICK(Drva) +STD_ROM_FN(Drva) + +static struct BurnRomInfo DrvablRomDesc[] = { + { "3.bin", 0x08000, 0xf3184f5a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "5.bin", 0x04000, 0x835f7b24, BRF_ESS | BRF_PRG }, // 1 + { "7.bin", 0x08000, 0x2f456c6e, BRF_ESS | BRF_PRG }, // 2 + + { "1.bin", 0x04000, 0xbd87f06b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "2.bin", 0x02000, 0x6ebca191, BRF_GRA }, // 4 Characters + + { "9.bin", 0x04000, 0x60329fa4, BRF_GRA }, // 5 Tiles + { "11.bin", 0x04000, 0x66bac116, BRF_GRA }, // 6 + { "13.bin", 0x04000, 0x623fcec1, BRF_GRA }, // 7 + + { "14.bin", 0x08000, 0xdf2345ef, BRF_GRA }, // 8 Sprites + { "16.bin", 0x08000, 0xc106b1ed, BRF_GRA }, // 9 + + { "sb-5.e8", 0x00100, 0x93ab8153, BRF_GRA }, // 10 PROMs + { "sb-6.e9", 0x00100, 0x8ab44f7d, BRF_GRA }, // 11 + { "sb-7.e10", 0x00100, 0xf4ade9a4, BRF_GRA }, // 12 + { "sb-0.f1", 0x00100, 0x6047d91b, BRF_GRA }, // 13 + { "sb-4.d6", 0x00100, 0x4858968d, BRF_GRA }, // 14 + { "sb-8.k3", 0x00100, 0xf6fad943, BRF_GRA }, // 15 + { "sb-2.d1", 0x00100, 0x8bb8b3df, BRF_GRA }, // 16 + { "sb-3.d2", 0x00100, 0x3b0c99af, BRF_GRA }, // 17 + { "sb-1.k6", 0x00100, 0x712ac508, BRF_GRA }, // 18 + { "sb-9.m11", 0x00100, 0x4921635c, BRF_GRA }, // 19 +}; + +STD_ROM_PICK(Drvabl) +STD_ROM_FN(Drvabl) + +static struct BurnRomInfo DrvbRomDesc[] = { + { "sr-03.m3", 0x04000, 0x612975f2, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "sr-04.m4", 0x04000, 0xa60ac644, BRF_ESS | BRF_PRG }, // 1 + { "sr-05.m5", 0x04000, 0x835f7b24, BRF_ESS | BRF_PRG }, // 2 + { "sr-06.m6", 0x02000, 0x821c6481, BRF_ESS | BRF_PRG }, // 3 + { "sr-07.m7", 0x04000, 0x5df525e1, BRF_ESS | BRF_PRG }, // 4 + + { "sr-01.c11", 0x04000, 0xbd87f06b, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program + + { "sr-02.f2", 0x02000, 0x6ebca191, BRF_GRA }, // 6 Characters + + { "sr-08.a1", 0x02000, 0x3884d9eb, BRF_GRA }, // 7 Tiles + { "sr-09.a2", 0x02000, 0x999cf6e0, BRF_GRA }, // 8 + { "sr-10.a3", 0x02000, 0x8edb273a, BRF_GRA }, // 9 + { "sr-11.a4", 0x02000, 0x3a2726c3, BRF_GRA }, // 10 + { "sr-12.a5", 0x02000, 0x1bd3d8bb, BRF_GRA }, // 11 + { "sr-13.a6", 0x02000, 0x658f02c4, BRF_GRA }, // 12 + + { "sr-14.l1", 0x04000, 0x2528bec6, BRF_GRA }, // 13 Sprites + { "sr-15.l2", 0x04000, 0xf89287aa, BRF_GRA }, // 14 + { "sr-16.n1", 0x04000, 0x024418f8, BRF_GRA }, // 15 + { "sr-17.n2", 0x04000, 0xe2c7e489, BRF_GRA }, // 16 + + { "sb-5.e8", 0x00100, 0x93ab8153, BRF_GRA }, // 17 PROMs + { "sb-6.e9", 0x00100, 0x8ab44f7d, BRF_GRA }, // 18 + { "sb-7.e10", 0x00100, 0xf4ade9a4, BRF_GRA }, // 19 + { "sb-0.f1", 0x00100, 0x6047d91b, BRF_GRA }, // 20 + { "sb-4.d6", 0x00100, 0x4858968d, BRF_GRA }, // 21 + { "sb-8.k3", 0x00100, 0xf6fad943, BRF_GRA }, // 22 + { "sb-2.d1", 0x00100, 0x8bb8b3df, BRF_GRA }, // 23 + { "sb-3.d2", 0x00100, 0x3b0c99af, BRF_GRA }, // 24 + { "sb-1.k6", 0x00100, 0x712ac508, BRF_GRA }, // 25 + { "sb-9.m11", 0x00100, 0x4921635c, BRF_GRA }, // 26 +}; + +STD_ROM_PICK(Drvb) +STD_ROM_FN(Drvb) + +static struct BurnRomInfo DrvwRomDesc[] = { + { "sw-03.m3", 0x04000, 0xafd79770, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "sw-04.m4", 0x04000, 0x933d9910, BRF_ESS | BRF_PRG }, // 1 + { "sw-05.m5", 0x04000, 0xe9a71bb6, BRF_ESS | BRF_PRG }, // 2 + { "sw-06.m6", 0x02000, 0x466f8248, BRF_ESS | BRF_PRG }, // 3 + { "sw-07.m7", 0x04000, 0xec41655e, BRF_ESS | BRF_PRG }, // 4 + + { "sr-01.c11", 0x04000, 0xbd87f06b, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program + + { "sw-02.f2", 0x02000, 0xf8e9ada2, BRF_GRA }, // 6 Characters + + { "sr-08.a1", 0x02000, 0x3884d9eb, BRF_GRA }, // 7 Tiles + { "sr-09.a2", 0x02000, 0x999cf6e0, BRF_GRA }, // 8 + { "sr-10.a3", 0x02000, 0x8edb273a, BRF_GRA }, // 9 + { "sr-11.a4", 0x02000, 0x3a2726c3, BRF_GRA }, // 10 + { "sr-12.a5", 0x02000, 0x1bd3d8bb, BRF_GRA }, // 11 + { "sr-13.a6", 0x02000, 0x658f02c4, BRF_GRA }, // 12 + + { "sr-14.l1", 0x04000, 0x2528bec6, BRF_GRA }, // 13 Sprites + { "sr-15.l2", 0x04000, 0xf89287aa, BRF_GRA }, // 14 + { "sr-16.n1", 0x04000, 0x024418f8, BRF_GRA }, // 15 + { "sr-17.n2", 0x04000, 0xe2c7e489, BRF_GRA }, // 16 + + { "sb-5.e8", 0x00100, 0x93ab8153, BRF_GRA }, // 17 PROMs + { "sb-6.e9", 0x00100, 0x8ab44f7d, BRF_GRA }, // 18 + { "sb-7.e10", 0x00100, 0xf4ade9a4, BRF_GRA }, // 19 + { "sb-0.f1", 0x00100, 0x6047d91b, BRF_GRA }, // 20 + { "sb-4.d6", 0x00100, 0x4858968d, BRF_GRA }, // 21 + { "sb-8.k3", 0x00100, 0xf6fad943, BRF_GRA }, // 22 + { "sb-2.d1", 0x00100, 0x8bb8b3df, BRF_GRA }, // 23 + { "sb-3.d2", 0x00100, 0x3b0c99af, BRF_GRA }, // 24 + { "sb-1.k6", 0x00100, 0x712ac508, BRF_GRA }, // 25 + { "sb-9.m11", 0x00100, 0x4921635c, BRF_GRA }, // 26 +}; + +STD_ROM_PICK(Drvw) +STD_ROM_FN(Drvw) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom1 = Next; Next += 0x1c000; + DrvZ80Rom2 = Next; Next += 0x04000; + DrvPromRed = Next; Next += 0x00100; + DrvPromGreen = Next; Next += 0x00100; + DrvPromBlue = Next; Next += 0x00100; + DrvPromCharLookup = Next; Next += 0x00100; + DrvPromTileLookup = Next; Next += 0x00100; + DrvPromSpriteLookup = Next; Next += 0x00100; + + RamStart = Next; + + DrvZ80Ram1 = Next; Next += 0x01000; + DrvZ80Ram2 = Next; Next += 0x00800; + DrvSpriteRam = Next; Next += 0x00080; + DrvFgVideoRam = Next; Next += 0x00800; + DrvBgVideoRam = Next; Next += 0x00400; + + RamEnd = Next; + + DrvChars = Next; Next += 0x200 * 8 * 8; + DrvTiles = Next; Next += 0x200 * 16 * 16; + DrvSprites = Next; Next += 0x200 * 16 * 16; + pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); + DrvPalette = (UINT32*)Next; Next += 0x00600 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + for (INT32 i = 0; i < 2; i++) { + AY8910Reset(i); + } + + DrvPaletteBank = 0; + DrvBgScroll[0] = 0; + DrvBgScroll[1] = 0; + DrvFlipScreen = 0; + DrvSoundLatch = 0; + DrvRomBank = 0; + + return 0; +} + +UINT8 __fastcall Drv1942Read1(UINT16 a) +{ + switch (a) { + case 0xc000: { + return 0xff - DrvInput[0]; + } + + case 0xc001: { + return 0xff - DrvInput[1]; + } + + case 0xc002: { + return 0xff - DrvInput[2]; + } + + case 0xc003: { + return DrvDip[0]; + } + + case 0xc004: { + return DrvDip[1]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall Drv1942Write1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xc800: { + DrvSoundLatch = d; + return; + } + + case 0xc802: { + DrvBgScroll[0] = d; + return; + } + + case 0xc803: { + DrvBgScroll[1] = d; + return; + } + + case 0xc804: { + DrvFlipScreen = d & 0x80; + if (d & 0x10) { + ZetClose(); + ZetOpen(1); + ZetReset(); + ZetClose(); + ZetOpen(0); + } + return; + } + + case 0xc805: { + DrvPaletteBank = d; + return; + } + + case 0xc806: { + d &= 0x03; + DrvRomBank = d; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x4000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x4000 ); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Drv1942Read2(UINT16 a) +{ + switch (a) { + case 0x6000: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall Drv1942Write2(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x8000: { + AY8910Write(0, 0, d); + return; + } + + case 0x8001: { + AY8910Write(0, 1, d); + return; + } + + case 0xc000: { + AY8910Write(1, 0, d); + return; + } + + case 0xc001: { + AY8910Write(1, 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); + } + } +} + + +static INT32 CharPlaneOffsets[2] = { 4, 0 }; +static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; +static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; +static INT32 TilePlaneOffsets[3] = { 0, 0x20000, 0x40000 }; +static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; +static INT32 SpritePlaneOffsets[4] = { 0x40004, 0x40000, 4, 0 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; +static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; + +static void MachineInit() +{ + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Drv1942Read1); + ZetSetWriteHandler(Drv1942Write1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0xcc00, 0xcc7f, 0, DrvSpriteRam ); + ZetMapArea(0xcc00, 0xcc7f, 1, DrvSpriteRam ); + ZetMapArea(0xcc00, 0xcc7f, 2, DrvSpriteRam ); + ZetMapArea(0xd000, 0xd7ff, 0, DrvFgVideoRam ); + ZetMapArea(0xd000, 0xd7ff, 1, DrvFgVideoRam ); + ZetMapArea(0xd000, 0xd7ff, 2, DrvFgVideoRam ); + ZetMapArea(0xd800, 0xdbff, 0, DrvBgVideoRam ); + ZetMapArea(0xd800, 0xdbff, 1, DrvBgVideoRam ); + ZetMapArea(0xd800, 0xdbff, 2, DrvBgVideoRam ); + ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(Drv1942Read2); + ZetSetWriteHandler(Drv1942Write2); + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom2 ); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom2 ); + ZetMapArea(0x4000, 0x47ff, 0, DrvZ80Ram2 ); + ZetMapArea(0x4000, 0x47ff, 1, DrvZ80Ram2 ); + ZetMapArea(0x4000, 0x47ff, 2, DrvZ80Ram2 ); + ZetClose(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + + AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); +} + +static INT32 DrvInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x10000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x14000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 4, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 5, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x02000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x06000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0a000, 12, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 3, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c000, 16, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load the PROMs + nRet = BurnLoadRom(DrvPromRed, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromGreen, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBlue, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromCharLookup, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromTileLookup, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromSpriteLookup, 22, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + MachineInit(); + + return 0; +} + +static INT32 DrvablInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x14000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 4, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 3, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; + memcpy(DrvTempRom + 0x04000, DrvTempRom + 0x10000, 0x4000); + memcpy(DrvTempRom + 0x00000, DrvTempRom + 0x14000, 0x4000); + nRet = BurnLoadRom(DrvTempRom + 0x10000, 9, 1); if (nRet != 0) return 1; + memcpy(DrvTempRom + 0x0c000, DrvTempRom + 0x10000, 0x4000); + memcpy(DrvTempRom + 0x08000, DrvTempRom + 0x14000, 0x4000); + GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load the PROMs + nRet = BurnLoadRom(DrvPromRed, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromGreen, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBlue, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromCharLookup, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromTileLookup, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromSpriteLookup, 15, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + MachineInit(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + + for (INT32 i = 0; i < 2; i++) { + AY8910Exit(i); + } + + GenericTilesExit(); + + DrvPaletteBank = 0; + DrvBgScroll[0] = 0; + DrvBgScroll[1] = 0; + DrvFlipScreen = 0; + DrvSoundLatch = 0; + DrvRomBank = 0; + + BurnFree(Mem); + + return 0; +} + +static void DrvCalcPalette() +{ + INT32 i; + UINT32 Palette[256]; + + for (i = 0; i < 256; i++) { + INT32 bit0, bit1, bit2, bit3, r, g, b; + + bit0 = (DrvPromRed[i] >> 0) & 0x01; + bit1 = (DrvPromRed[i] >> 1) & 0x01; + bit2 = (DrvPromRed[i] >> 2) & 0x01; + bit3 = (DrvPromRed[i] >> 3) & 0x01; + r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvPromGreen[i] >> 0) & 0x01; + bit1 = (DrvPromGreen[i] >> 1) & 0x01; + bit2 = (DrvPromGreen[i] >> 2) & 0x01; + bit3 = (DrvPromGreen[i] >> 3) & 0x01; + g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvPromBlue[i] >> 0) & 0x01; + bit1 = (DrvPromBlue[i] >> 1) & 0x01; + bit2 = (DrvPromBlue[i] >> 2) & 0x01; + bit3 = (DrvPromBlue[i] >> 3) & 0x01; + b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + Palette[i] = BurnHighCol(r, g, b, 0); + } + + for (i = 0; i < 256; i++) { + DrvPalette[i] = Palette[0x80 | DrvPromCharLookup[i]]; + } + + for (i = 0; i < 256; i++) { + DrvPalette[256 + i + 0] = Palette[0x00 | DrvPromTileLookup[i]]; + DrvPalette[256 + i + 256] = Palette[0x10 | DrvPromTileLookup[i]]; + DrvPalette[256 + i + 512] = Palette[0x20 | DrvPromTileLookup[i]]; + DrvPalette[256 + i + 768] = Palette[0x30 | DrvPromTileLookup[i]]; + } + + for (i = 0; i < 256; i++) { + DrvPalette[1280 + i] = Palette[0x40 | DrvPromSpriteLookup[i]]; + } +} + +static void DrvRenderBgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex, xScroll, Flip, xFlip, yFlip; + + xScroll = DrvBgScroll[0] | (DrvBgScroll[1] << 8); + xScroll &= 0x1ff; + + for (mx = 0; mx < 16; mx++) { + for (my = 0; my < 32; my++) { + TileIndex = (my * 16) + mx; + TileIndex = (TileIndex & 0x0f) | ((TileIndex & 0x01f0) << 1); + + Code = DrvBgVideoRam[TileIndex]; + Colour = DrvBgVideoRam[TileIndex + 0x10]; + Code += (Colour & 0x80) << 1; + Flip = (Colour & 0x60) >> 5; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + Colour &= 0x1f; + + y = 16 * mx; + x = 16 * my; + x -= xScroll; + if (x < -16) x += 512; + y -= 16; + + if (x > 0 && x < 240 && y > 0 && y < 208) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); + } else { + Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); + } else { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); + } else { + Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 3, 256 + (0x100 * DrvPaletteBank), DrvTiles); + } + } + } + } + } +} + +static void DrvRenderSpriteLayer() +{ + INT32 Offset; + + for (Offset = 0x80 - 4; Offset >= 0; Offset -= 4) { + INT32 i, Code, Colour, sx, sy, Dir; + + Code = (DrvSpriteRam[Offset] & 0x7f) + (4 * (DrvSpriteRam[Offset + 1] & 0x20)) + (2 * (DrvSpriteRam[Offset] & 0x80)); + Colour = DrvSpriteRam[Offset + 1] & 0x0f; + sx = DrvSpriteRam[Offset + 3] - (0x10 * (DrvSpriteRam[Offset + 1] & 0x10)); + sy = DrvSpriteRam[Offset + 2]; + Dir = 1; + + i = (DrvSpriteRam[Offset + 1] & 0xc0) >> 6; + if (i == 2) i = 3; + + do { + Render16x16Tile_Mask_Clip(pTransDraw, Code + i, sx, (sy + (16 * i) * Dir) - 16, Colour, 4, 15, 1280, DrvSprites); + + i--; + } while (i >= 0); + } +} + +static void DrvRenderCharLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Code = DrvFgVideoRam[TileIndex]; + Colour = DrvFgVideoRam[TileIndex + 0x400]; + Code += (Colour & 0x80) << 1; + Colour &= 0x3f; + + x = 8 * mx; + y = 8 * my; + + y -= 16; + + if (x > 0 && x < 248 && y > 0 && y < 216) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 0, 0, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, DrvChars); + } + + TileIndex++; + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + DrvRenderBgLayer(); + DrvRenderSpriteLayer(); + DrvRenderCharLayer(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 4; + INT32 nSoundBufferPos = 0; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 4000000 / 60; + nCyclesTotal[1] = 3000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + +// ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 1) { + ZetSetVector(0xcf); + ZetRaiseIrq(0); + } + if (i == 3) { + ZetSetVector(0xd7); + ZetRaiseIrq(0); + } + ZetClose(); + + // Run Z80 #2 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetRaiseIrq(0); + ZetClose(); + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029672; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); // Scan Z80 + AY8910Scan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(DrvRomBank); + SCAN_VAR(DrvPaletteBank); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(DrvBgScroll); + SCAN_VAR(DrvFlipScreen); + SCAN_VAR(DrvDip); + SCAN_VAR(DrvInput); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x4000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x4000 ); + ZetClose(); + } + + return 0; +} + +struct BurnDriver BurnDrvNineteen42 = { + "1942", NULL, NULL, NULL, "1984", + "1942 (Revision B)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNineteen42a = { + "1942a", "1942", NULL, NULL, "1984", + "1942 (Revision A)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvaRomInfo, DrvaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNineteen42abl = { + "1942abl", "1942", NULL, NULL, "1984", + "1942 (Revision A, bootleg)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvablRomInfo, DrvablRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvablInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNineteen42b = { + "1942b", "1942", NULL, NULL, "1984", + "1942 (First Version)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNineteen42w = { + "1942w", "1942", NULL, NULL, "1985", + "1942 (Williams Electronics license)\0", NULL, "Capcom (Williams Electronics license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvwRomInfo, DrvwRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 224, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_1943.cpp b/src/burn/drv/pre90s/d_1943.cpp index 068245fd5..e22c57a05 100644 --- a/src/burn/drv/pre90s/d_1943.cpp +++ b/src/burn/drv/pre90s/d_1943.cpp @@ -1,1704 +1,1698 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2203.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[2] = {0, 0}; -static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *DrvZ80Rom1 = NULL; -static UINT8 *DrvZ80Rom2 = NULL; -static UINT8 *DrvZ80Ram1 = NULL; -static UINT8 *DrvZ80Ram2 = NULL; -static UINT8 *DrvVideoRam = NULL; -static UINT8 *DrvPaletteRam = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvPromRed = NULL; -static UINT8 *DrvPromGreen = NULL; -static UINT8 *DrvPromBlue = NULL; -static UINT8 *DrvPromCharLookup = NULL; -static UINT8 *DrvPromBg2Lookup = NULL; -static UINT8 *DrvPromBg2PalBank = NULL; -static UINT8 *DrvPromBgLookup = NULL; -static UINT8 *DrvPromBgPalBank = NULL; -static UINT8 *DrvPromSpriteLookup = NULL; -static UINT8 *DrvPromSpritePalBank = NULL; -static UINT8 *DrvBgTilemap = NULL; -static UINT8 *DrvBg2Tilemap = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvBg2Tiles = NULL; -static UINT8 *DrvBgTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT8 DrvSoundLatch; -static UINT8 DrvRomBank; -static UINT8 DrvBg2ScrollX[2]; -static UINT8 DrvBgScrollX[2]; -static UINT8 DrvBgScrollY; -static UINT8 DrvBg2On; -static UINT8 DrvBg1On; -static UINT8 DrvSpritesOn; -static UINT8 DrvCharsOn; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 7, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - } - - // Clear Opposites - DrvClearOpposites(&DrvInput[1]); - DrvClearOpposites(&DrvInput[2]); -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xf8, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 16 , "Difficulty" }, - {0x11, 0x01, 0x0f, 0x0f, "1 (Easy)" }, - {0x11, 0x01, 0x0f, 0x0e, "2" }, - {0x11, 0x01, 0x0f, 0x0d, "3" }, - {0x11, 0x01, 0x0f, 0x0c, "4" }, - {0x11, 0x01, 0x0f, 0x0b, "5" }, - {0x11, 0x01, 0x0f, 0x0a, "6" }, - {0x11, 0x01, 0x0f, 0x09, "7" }, - {0x11, 0x01, 0x0f, 0x08, "8 (Normal)" }, - {0x11, 0x01, 0x0f, 0x07, "9" }, - {0x11, 0x01, 0x0f, 0x06, "10" }, - {0x11, 0x01, 0x0f, 0x05, "11" }, - {0x11, 0x01, 0x0f, 0x04, "12" }, - {0x11, 0x01, 0x0f, 0x03, "13" }, - {0x11, 0x01, 0x0f, 0x02, "14" }, - {0x11, 0x01, 0x0f, 0x01, "15" }, - {0x11, 0x01, 0x0f, 0x00, "16 (Difficult)" }, - - {0 , 0xfe, 0 , 2 , "2 Player Game" }, - {0x11, 0x01, 0x10, 0x00, "1 Credit / 2 Players" }, - {0x11, 0x01, 0x10, 0x10, "2 Credits / 2 Players" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x20, 0x20, "Off" }, - {0x11, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x11, 0x01, 0x40, 0x40, "Off" }, - {0x11, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x12, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, - {0x12, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, - {0x12, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Plays" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x12, 0x01, 0x38, 0x00, "4 Coins 1 Play" }, - {0x12, 0x01, 0x38, 0x08, "3 Coins 1 Play" }, - {0x12, 0x01, 0x38, 0x10, "2 Coins 1 Play" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, - {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Plays" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x12, 0x01, 0x40, 0x00, "No" }, - {0x12, 0x01, 0x40, 0x40, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x80, 0x00, "Off" }, - {0x12, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Drv) - -static struct BurnRomInfo DrvRomDesc[] = { - { "bme01.12d", 0x08000, 0x55fd447e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bme02.13d", 0x10000, 0x073fc57c, BRF_ESS | BRF_PRG }, // 1 - { "bme03.14d", 0x10000, 0x835822c2, BRF_ESS | BRF_PRG }, // 2 - - { "bm04.5h", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "bm05.4k", 0x08000, 0x46cb9d3d, BRF_GRA }, // 4 Characters - - { "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles - { "bm16.11f", 0x08000, 0x23c908c2, BRF_GRA }, // 6 - { "bm17.12f", 0x08000, 0x46bcdd07, BRF_GRA }, // 7 - { "bm18.14f", 0x08000, 0xe6ae7ba0, BRF_GRA }, // 8 - { "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 - { "bm20.11j", 0x08000, 0x0917e5d4, BRF_GRA }, // 10 - { "bm21.12j", 0x08000, 0x9bfb0d89, BRF_GRA }, // 11 - { "bm22.14j", 0x08000, 0x04f3c274, BRF_GRA }, // 12 - - { "bm24.14k", 0x08000, 0x11134036, BRF_GRA }, // 13 BG2 Tiles - { "bm25.14l", 0x08000, 0x092cf9c1, BRF_GRA }, // 14 - - { "bm06.10a", 0x08000, 0x97acc8af, BRF_GRA }, // 15 Sprites - { "bm07.11a", 0x08000, 0xd78f7197, BRF_GRA }, // 16 - { "bm08.12a", 0x08000, 0x1a626608, BRF_GRA }, // 17 - { "bm09.14a", 0x08000, 0x92408400, BRF_GRA }, // 18 - { "bm10.10c", 0x08000, 0x8438a44a, BRF_GRA }, // 19 - { "bm11.11c", 0x08000, 0x6c69351d, BRF_GRA }, // 20 - { "bm12.12c", 0x08000, 0x5e7efdb7, BRF_GRA }, // 21 - { "bm13.14c", 0x08000, 0x1143829a, BRF_GRA }, // 22 - - { "bm14.5f", 0x08000, 0x4d3c6401, BRF_GRA }, // 23 Tilemaps - { "bm23.8k", 0x08000, 0xa52aecbd, BRF_GRA }, // 24 - - { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 25 PROMs - { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 26 - { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 27 - { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 28 - { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 29 - { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 30 - { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 31 - { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 32 - { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 33 - { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 34 - { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 35 - { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 36 - - { "bm.7k", 0x10000, 0x00000000, BRF_NODUMP }, // 37 MCU -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo DrvuRomDesc[] = { - { "bmu01c.12d", 0x08000, 0xc686cc5c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bmu02c.13d", 0x10000, 0xd8880a41, BRF_ESS | BRF_PRG }, // 1 - { "bmu03c.14d", 0x10000, 0x3f0ee26c, BRF_ESS | BRF_PRG }, // 2 - - { "bm04.5h", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "bm05.4k", 0x08000, 0x46cb9d3d, BRF_GRA }, // 4 Characters - - { "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles - { "bm16.11f", 0x08000, 0x23c908c2, BRF_GRA }, // 6 - { "bm17.12f", 0x08000, 0x46bcdd07, BRF_GRA }, // 7 - { "bm18.14f", 0x08000, 0xe6ae7ba0, BRF_GRA }, // 8 - { "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 - { "bm20.11j", 0x08000, 0x0917e5d4, BRF_GRA }, // 10 - { "bm21.12j", 0x08000, 0x9bfb0d89, BRF_GRA }, // 11 - { "bm22.14j", 0x08000, 0x04f3c274, BRF_GRA }, // 12 - - { "bm24.14k", 0x08000, 0x11134036, BRF_GRA }, // 13 BG2 Tiles - { "bm25.14l", 0x08000, 0x092cf9c1, BRF_GRA }, // 14 - - { "bm06.10a", 0x08000, 0x97acc8af, BRF_GRA }, // 15 Sprites - { "bm07.11a", 0x08000, 0xd78f7197, BRF_GRA }, // 16 - { "bm08.12a", 0x08000, 0x1a626608, BRF_GRA }, // 17 - { "bm09.14a", 0x08000, 0x92408400, BRF_GRA }, // 18 - { "bm10.10c", 0x08000, 0x8438a44a, BRF_GRA }, // 19 - { "bm11.11c", 0x08000, 0x6c69351d, BRF_GRA }, // 20 - { "bm12.12c", 0x08000, 0x5e7efdb7, BRF_GRA }, // 21 - { "bm13.14c", 0x08000, 0x1143829a, BRF_GRA }, // 22 - - { "bm14.5f", 0x08000, 0x4d3c6401, BRF_GRA }, // 23 Tilemaps - { "bm23.8k", 0x08000, 0xa52aecbd, BRF_GRA }, // 24 - - { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 25 PROMs - { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 26 - { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 27 - { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 28 - { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 29 - { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 30 - { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 31 - { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 32 - { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 33 - { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 34 - { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 35 - { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 36 - - { "bm.7k", 0x10000, 0x00000000, BRF_NODUMP }, // 37 MCU -}; - -STD_ROM_PICK(Drvu) -STD_ROM_FN(Drvu) - -static struct BurnRomInfo DrvjRomDesc[] = { - { "bm01b.12d", 0x08000, 0x363f9f3d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bm02b.13d", 0x10000, 0x7f0d7edc, BRF_ESS | BRF_PRG }, // 1 - { "bm03b.14d", 0x10000, 0x7093da2a, BRF_ESS | BRF_PRG }, // 2 - - { "bm04.5h", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "bm05.4k", 0x08000, 0x46cb9d3d, BRF_GRA }, // 4 Characters - - { "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles - { "bm16.11f", 0x08000, 0x23c908c2, BRF_GRA }, // 6 - { "bm17.12f", 0x08000, 0x46bcdd07, BRF_GRA }, // 7 - { "bm18.14f", 0x08000, 0xe6ae7ba0, BRF_GRA }, // 8 - { "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 - { "bm20.11j", 0x08000, 0x0917e5d4, BRF_GRA }, // 10 - { "bm21.12j", 0x08000, 0x9bfb0d89, BRF_GRA }, // 11 - { "bm22.14j", 0x08000, 0x04f3c274, BRF_GRA }, // 12 - - { "bm24.14k", 0x08000, 0x11134036, BRF_GRA }, // 13 BG2 Tiles - { "bm25.14l", 0x08000, 0x092cf9c1, BRF_GRA }, // 14 - - { "bm06.10a", 0x08000, 0x97acc8af, BRF_GRA }, // 15 Sprites - { "bm07.11a", 0x08000, 0xd78f7197, BRF_GRA }, // 16 - { "bm08.12a", 0x08000, 0x1a626608, BRF_GRA }, // 17 - { "bm09.14a", 0x08000, 0x92408400, BRF_GRA }, // 18 - { "bm10.10c", 0x08000, 0x8438a44a, BRF_GRA }, // 19 - { "bm11.11c", 0x08000, 0x6c69351d, BRF_GRA }, // 20 - { "bm12.12c", 0x08000, 0x5e7efdb7, BRF_GRA }, // 21 - { "bm13.14c", 0x08000, 0x1143829a, BRF_GRA }, // 22 - - { "bm14.5f", 0x08000, 0x4d3c6401, BRF_GRA }, // 23 Tilemaps - { "bm23.8k", 0x08000, 0xa52aecbd, BRF_GRA }, // 24 - - { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 25 PROMs - { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 26 - { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 27 - { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 28 - { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 29 - { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 30 - { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 31 - { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 32 - { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 33 - { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 34 - { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 35 - { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 36 - - { "bm.7k", 0x10000, 0x00000000, BRF_NODUMP }, // 37 MCU -}; - -STD_ROM_PICK(Drvj) -STD_ROM_FN(Drvj) - -static struct BurnRomInfo DrvjaRomDesc[] = { - { "bm01.12d", 0x08000, 0xf6935937, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bm02.13d", 0x10000, 0xaf971575, BRF_ESS | BRF_PRG }, // 1 - { "bm03.14d", 0x10000, 0x300ec713, BRF_ESS | BRF_PRG }, // 2 - - { "bm04.5h", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "bm05.4k", 0x08000, 0x46cb9d3d, BRF_GRA }, // 4 Characters - - { "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles - { "bm16.11f", 0x08000, 0x23c908c2, BRF_GRA }, // 6 - { "bm17.12f", 0x08000, 0x46bcdd07, BRF_GRA }, // 7 - { "bm18.14f", 0x08000, 0xe6ae7ba0, BRF_GRA }, // 8 - { "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 - { "bm20.11j", 0x08000, 0x0917e5d4, BRF_GRA }, // 10 - { "bm21.12j", 0x08000, 0x9bfb0d89, BRF_GRA }, // 11 - { "bm22.14j", 0x08000, 0x04f3c274, BRF_GRA }, // 12 - - { "bm24.14k", 0x08000, 0x11134036, BRF_GRA }, // 13 BG2 Tiles - { "bm25.14l", 0x08000, 0x092cf9c1, BRF_GRA }, // 14 - - { "bm06.10a", 0x08000, 0x97acc8af, BRF_GRA }, // 15 Sprites - { "bm07.11a", 0x08000, 0xd78f7197, BRF_GRA }, // 16 - { "bm08.12a", 0x08000, 0x1a626608, BRF_GRA }, // 17 - { "bm09.14a", 0x08000, 0x92408400, BRF_GRA }, // 18 - { "bm10.10c", 0x08000, 0x8438a44a, BRF_GRA }, // 19 - { "bm11.11c", 0x08000, 0x6c69351d, BRF_GRA }, // 20 - { "bm12.12c", 0x08000, 0x5e7efdb7, BRF_GRA }, // 21 - { "bm13.14c", 0x08000, 0x1143829a, BRF_GRA }, // 22 - - { "bm14.5f", 0x08000, 0x4d3c6401, BRF_GRA }, // 23 Tilemaps - { "bm23.8k", 0x08000, 0xa52aecbd, BRF_GRA }, // 24 - - { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 25 PROMs - { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 26 - { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 27 - { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 28 - { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 29 - { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 30 - { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 31 - { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 32 - { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 33 - { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 34 - { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 35 - { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 36 - - { "bm.7k", 0x10000, 0x00000000, BRF_NODUMP }, // 37 MCU -}; - -STD_ROM_PICK(Drvja) -STD_ROM_FN(Drvja) - -static struct BurnRomInfo DrvbRomDesc[] = { - { "1.12d", 0x08000, 0x9a2d70ab, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bm02.13d", 0x10000, 0xaf971575, BRF_ESS | BRF_PRG }, // 1 - { "bm03.14d", 0x10000, 0x300ec713, BRF_ESS | BRF_PRG }, // 2 - - { "bm04.5h", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "4.5h", 0x08000, 0x0aba2096, BRF_GRA }, // 4 Characters - - { "15.12f", 0x10000, 0x622b4fba, BRF_GRA }, // 5 BG Tiles - { "16.14f", 0x10000, 0x25471a8d, BRF_GRA }, // 6 - { "17.12j", 0x10000, 0x9da79653, BRF_GRA }, // 7 - { "18.14j", 0x10000, 0x1f3aced8, BRF_GRA }, // 8 - - { "bm24.14k", 0x08000, 0x11134036, BRF_GRA }, // 9 BG2 Tiles - { "bm25.14l", 0x08000, 0x092cf9c1, BRF_GRA }, // 10 - - { "bm06.10a", 0x08000, 0x97acc8af, BRF_GRA }, // 11 Sprites - { "bm07.11a", 0x08000, 0xd78f7197, BRF_GRA }, // 12 - { "bm08.12a", 0x08000, 0x1a626608, BRF_GRA }, // 13 - { "bm09.14a", 0x08000, 0x92408400, BRF_GRA }, // 14 - { "bm10.10c", 0x08000, 0x8438a44a, BRF_GRA }, // 15 - { "bm11.11c", 0x08000, 0x6c69351d, BRF_GRA }, // 16 - { "bm12.12c", 0x08000, 0x5e7efdb7, BRF_GRA }, // 17 - { "bm13.14c", 0x08000, 0x1143829a, BRF_GRA }, // 18 - - { "bm14.5f", 0x08000, 0x4d3c6401, BRF_GRA }, // 19 Tilemaps - { "bm23.8k", 0x08000, 0xa52aecbd, BRF_GRA }, // 20 - - { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 21 PROMs - { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 22 - { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 23 - { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 24 - { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 25 - { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 26 - { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 27 - { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 28 - { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 29 - { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 30 - { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 31 - { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 32 -}; - -STD_ROM_PICK(Drvb) -STD_ROM_FN(Drvb) - -static struct BurnRomInfo Drvb2RomDesc[] = { - { "u28.bin", 0x08000, 0xb3b7c7cd, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "u27.bin", 0x10000, 0xaf971575, BRF_ESS | BRF_PRG }, // 1 - { "u26.bin", 0x10000, 0x300ec713, BRF_ESS | BRF_PRG }, // 2 - - { "u88.bin", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "u62.bin", 0x08000, 0x0aba2096, BRF_GRA }, // 4 Characters - - { "u66.bin", 0x10000, 0x075e9a7f, BRF_GRA }, // 5 BG Tiles - { "u65.bin", 0x10000, 0x05aca09a, BRF_GRA }, // 6 - { "u79.bin", 0x10000, 0x0f4b7e0e, BRF_GRA }, // 7 - { "u70.bin", 0x10000, 0x61a90c0a, BRF_GRA }, // 8 - - { "u102.bin", 0x08000, 0x11134036, BRF_GRA }, // 9 BG2 Tiles - { "u116.bin", 0x08000, 0x092cf9c1, BRF_GRA }, // 10 - - { "u9.bin", 0x08000, 0x97acc8af, BRF_GRA }, // 11 Sprites - { "u10.bin", 0x08000, 0xd78f7197, BRF_GRA }, // 12 - { "u8.bin", 0x10000, 0xed5c788a, BRF_GRA }, // 13 - { "u18.bin", 0x08000, 0x8438a44a, BRF_GRA }, // 14 - { "u19.bin", 0x08000, 0x6c69351d, BRF_GRA }, // 15 - { "u17.bin", 0x10000, 0x4b42445e, BRF_GRA }, // 16 - - { "u58.bin", 0x08000, 0x4d3c6401, BRF_GRA }, // 17 Tilemaps - { "u96.bin", 0x08000, 0x254c881d, BRF_GRA }, // 18 - - { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 19 PROMs - { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 20 - { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 21 - { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 22 - { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 23 - { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 24 - { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 25 - { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 26 - { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 27 - { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 28 - { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 29 - { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 30 -}; - -STD_ROM_PICK(Drvb2) -STD_ROM_FN(Drvb2) - -static struct BurnRomInfo DrvkaiRomDesc[] = { - { "bmk01.12d", 0x08000, 0x7d2211db, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bmk02.13d", 0x10000, 0x2ebbc8c5, BRF_ESS | BRF_PRG }, // 1 - { "bmk03.14d", 0x10000, 0x475a6ac5, BRF_ESS | BRF_PRG }, // 2 - - { "bmk04.5h", 0x08000, 0x25f37957, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "bmk05.4k", 0x08000, 0x884a8692, BRF_GRA }, // 4 Characters - - { "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles - { "bmk16.11f", 0x08000, 0x9416fe0d, BRF_GRA }, // 6 - { "bmk17.12f", 0x08000, 0x3d5acab9, BRF_GRA }, // 7 - { "bmk18.14f", 0x08000, 0x7b62da1d, BRF_GRA }, // 8 - { "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 - { "bmk20.11j", 0x08000, 0xb90364c1, BRF_GRA }, // 10 - { "bmk21.12j", 0x08000, 0x8c7fe74a, BRF_GRA }, // 11 - { "bmk22.14j", 0x08000, 0xd5ef8a0e, BRF_GRA }, // 12 - - { "bmk24.14k", 0x08000, 0xbf186ef2, BRF_GRA }, // 13 BG2 Tiles - { "bmk25.14l", 0x08000, 0xa755faf1, BRF_GRA }, // 14 - - { "bmk06.10a", 0x08000, 0x5f7e38b3, BRF_GRA }, // 15 Sprites - { "bmk07.11a", 0x08000, 0xff3751fd, BRF_GRA }, // 16 - { "bmk08.12a", 0x08000, 0x159d51bd, BRF_GRA }, // 17 - { "bmk09.14a", 0x08000, 0x8683e3d2, BRF_GRA }, // 18 - { "bmk10.10c", 0x08000, 0x1e0d9571, BRF_GRA }, // 19 - { "bmk11.11c", 0x08000, 0xf1fc5ee1, BRF_GRA }, // 20 - { "bmk12.12c", 0x08000, 0x0f50c001, BRF_GRA }, // 21 - { "bmk13.14c", 0x08000, 0xfd1acf8e, BRF_GRA }, // 22 - - { "bmk14.5f", 0x08000, 0xcf0f5a53, BRF_GRA }, // 23 Tilemaps - { "bmk23.8k", 0x08000, 0x17f77ef9, BRF_GRA }, // 24 - - { "bmk1.12a", 0x00100, 0xe001ea33, BRF_GRA }, // 25 PROMs - { "bmk2.13a", 0x00100, 0xaf34d91a, BRF_GRA }, // 26 - { "bmk3.14a", 0x00100, 0x43e9f6ef, BRF_GRA }, // 27 - { "bmk5.7f", 0x00100, 0x41878934, BRF_GRA }, // 28 - { "bmk10.7l", 0x00100, 0xde44b748, BRF_GRA }, // 29 - { "bmk9.6l", 0x00100, 0x59ea57c0, BRF_GRA }, // 30 - { "bmk12.12m", 0x00100, 0x8765f8b0, BRF_GRA }, // 31 - { "bmk11.12l", 0x00100, 0x87a8854e, BRF_GRA }, // 32 - { "bmk8.8c", 0x00100, 0xdad17e2d, BRF_GRA }, // 33 - { "bmk7.7c", 0x00100, 0x76307f8d, BRF_GRA }, // 34 - { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 35 - { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 36 - - { "bm.7k", 0x10000, 0x00000000, BRF_NODUMP }, // 37 MCU -}; - -STD_ROM_PICK(Drvkai) -STD_ROM_FN(Drvkai) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom1 = Next; Next += 0x30000; - DrvZ80Rom2 = Next; Next += 0x08000; - DrvPromRed = Next; Next += 0x00100; - DrvPromGreen = Next; Next += 0x00100; - DrvPromBlue = Next; Next += 0x00100; - DrvPromCharLookup = Next; Next += 0x00100; - DrvPromBg2Lookup = Next; Next += 0x00100; - DrvPromBg2PalBank = Next; Next += 0x00100; - DrvPromBgLookup = Next; Next += 0x00100; - DrvPromBgPalBank = Next; Next += 0x00100; - DrvPromSpriteLookup = Next; Next += 0x00100; - DrvPromSpritePalBank = Next; Next += 0x00100; - DrvBgTilemap = Next; Next += 0x08000; - DrvBg2Tilemap = Next; Next += 0x08000; - - RamStart = Next; - - DrvZ80Ram1 = Next; Next += 0x01000; - DrvZ80Ram2 = Next; Next += 0x00800; - DrvVideoRam = Next; Next += 0x00400; - DrvPaletteRam = Next; Next += 0x00400; - DrvSpriteRam = Next; Next += 0x01000; - - RamEnd = Next; - - DrvChars = Next; Next += 2048 * 8 * 8; - DrvBg2Tiles = Next; Next += 128 * 32 * 32; - DrvBgTiles = Next; Next += 512 * 32 * 32; - DrvSprites = Next; Next += 2048 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00380 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - BurnYM2203Reset(); - - DrvRomBank = 0; - DrvSoundLatch = 0; - DrvBg2ScrollX[0] = 0; - DrvBg2ScrollX[1] = 0; - DrvBgScrollX[0] = 0; - DrvBgScrollX[1] = 0; - DrvBgScrollY = 0; - DrvBg2On = 0; - DrvBg1On = 0; - DrvSpritesOn = 0; - DrvCharsOn = 0; - - return 0; -} - -UINT8 __fastcall Drv1943Read1(UINT16 a) -{ - switch (a) { - case 0xc000: { - return 0xff - DrvInput[0]; - } - - case 0xc001: { - return 0xff - DrvInput[1]; - } - - case 0xc002: { - return 0xff - DrvInput[2]; - } - - case 0xc003: { - return DrvDip[0]; - } - - case 0xc004: { - return DrvDip[1]; - } - - case 0xc007: { - return ZetBc(-1) >> 8; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall Drvb1943Read1(UINT16 a) -{ - switch (a) { - case 0xc000: { - return 0xff - DrvInput[0]; - } - - case 0xc001: { - return 0xff - DrvInput[1]; - } - - case 0xc002: { - return 0xff - DrvInput[2]; - } - - case 0xc003: { - return DrvDip[0]; - } - - case 0xc004: { - return DrvDip[1]; - } - - case 0xc007: { - return 0x00; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall Drv1943Write1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xc800: { - DrvSoundLatch = d; - return; - } - - case 0xc804: { - DrvRomBank = d & 0x1c; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x1000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x1000 ); - - if (d & 0x40) bprintf(PRINT_NORMAL, _T("c804 write %x\n"), d); - - DrvCharsOn = d & 0x80; - return; - } - - case 0xc806: { - // Watchdog - return; - } - - case 0xc807: { - // NOP - return; - } - - case 0xd800: { - DrvBgScrollX[0] = d; - return; - } - - case 0xd801: { - DrvBgScrollX[1] = d; - return; - } - - case 0xd802: { - DrvBgScrollY = d; - return; - } - - case 0xd803: { - DrvBg2ScrollX[0] = d; - return; - } - - case 0xd804: { - DrvBg2ScrollX[1] = d; - return; - } - - case 0xd806: { - DrvBg1On = d & 0x10; - DrvBg2On = d & 0x20; - DrvSpritesOn = d & 0x40; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Drv1943PortRead1(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall Drv1943PortWrite1(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Drv1943Read2(UINT16 a) -{ - switch (a) { - case 0xc800: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall Drv1943Write2(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0xe001: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0xe002: { - BurnYM2203Write(1, 0, d); - return; - } - - case 0xe003: { - BurnYM2203Write(1, 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Drv1943PortRead2(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall Drv1943PortWrite2(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); - } - } -} - -static INT32 CharPlaneOffsets[2] = { 4, 0 }; -static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; -static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; -static INT32 Bg2TilePlaneOffsets[4] = { 0x40004, 0x40000, 4, 0 }; -static INT32 BgTilePlaneOffsets[4] = { 0x100004, 0x100000, 4, 0 }; -static INT32 TileXOffsets[32] = { 0, 1, 2, 3, 8, 9, 10, 11, 512, 513, 514, 515, 520, 521, 522, 523, 1024, 1025, 1026, 1027, 1032, 1033, 1034, 1035, 1536, 1537, 1538, 1539, 1544, 1545, 1546, 1547 }; -static INT32 TileYOffsets[32] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256, 272, 288, 304, 320, 336, 352, 368, 384, 400, 416, 432, 448, 464, 480, 496 }; -static INT32 SpritePlaneOffsets[4] = { 0x100004, 0x100000, 4, 0 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; -static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3000000; -} - -static INT32 DrvInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x40000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 4, 1); if (nRet != 0) return 1; - GfxDecode(2048, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the bg2 tiles - memset(DrvTempRom, 0, 0x40000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 14, 1); if (nRet != 0) return 1; - GfxDecode(128, 4, 32, 32, Bg2TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBg2Tiles); - - // Load and decode the bg tiles - memset(DrvTempRom, 0, 0x40000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x18000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x28000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x38000, 12, 1); if (nRet != 0) return 1; - GfxDecode(512, 4, 32, 32, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBgTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x40000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x18000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x28000, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x38000, 22, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load the Tilemaps - nRet = BurnLoadRom(DrvBgTilemap, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvBg2Tilemap, 24, 1); if (nRet != 0) return 1; - - // Load the PROMs - nRet = BurnLoadRom(DrvPromRed, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromGreen, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBlue, 27, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromCharLookup, 28, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBgLookup, 29, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBgPalBank, 30, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBg2Lookup, 31, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBg2PalBank, 32, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromSpriteLookup, 33, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromSpritePalBank, 34, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Drv1943Read1); - ZetSetWriteHandler(Drv1943Write1); - ZetSetInHandler(Drv1943PortRead1); - ZetSetOutHandler(Drv1943PortWrite1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0xd000, 0xd3ff, 0, DrvVideoRam ); - ZetMapArea(0xd000, 0xd3ff, 1, DrvVideoRam ); - ZetMapArea(0xd000, 0xd3ff, 2, DrvVideoRam ); - ZetMapArea(0xd400, 0xd7ff, 0, DrvPaletteRam ); - ZetMapArea(0xd400, 0xd7ff, 1, DrvPaletteRam ); - ZetMapArea(0xd400, 0xd7ff, 2, DrvPaletteRam ); - ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); - ZetMapArea(0xf000, 0xffff, 0, DrvSpriteRam ); - ZetMapArea(0xf000, 0xffff, 1, DrvSpriteRam ); - ZetMapArea(0xf000, 0xffff, 2, DrvSpriteRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(Drv1943Read2); - ZetSetWriteHandler(Drv1943Write2); - ZetSetInHandler(Drv1943PortRead2); - ZetSetOutHandler(Drv1943PortWrite2); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2 ); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram2 ); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram2 ); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram2 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 DrvbInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x40000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 4, 1); if (nRet != 0) return 1; - GfxDecode(2048, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the bg2 tiles - memset(DrvTempRom, 0, 0x40000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 10, 1); if (nRet != 0) return 1; - GfxDecode(128, 4, 32, 32, Bg2TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBg2Tiles); - - // Load and decode the bg tiles - memset(DrvTempRom, 0, 0x40000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 8, 1); if (nRet != 0) return 1; - GfxDecode(512, 4, 32, 32, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBgTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x40000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x18000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x28000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x38000, 18, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load the Tilemaps - nRet = BurnLoadRom(DrvBgTilemap, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvBg2Tilemap, 20, 1); if (nRet != 0) return 1; - - // Load the PROMs - nRet = BurnLoadRom(DrvPromRed, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromGreen, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBlue, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromCharLookup, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBgLookup, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBgPalBank, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBg2Lookup, 27, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBg2PalBank, 28, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromSpriteLookup, 29, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromSpritePalBank, 30, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Drvb1943Read1); - ZetSetWriteHandler(Drv1943Write1); - ZetSetInHandler(Drv1943PortRead1); - ZetSetOutHandler(Drv1943PortWrite1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0xd000, 0xd3ff, 0, DrvVideoRam ); - ZetMapArea(0xd000, 0xd3ff, 1, DrvVideoRam ); - ZetMapArea(0xd000, 0xd3ff, 2, DrvVideoRam ); - ZetMapArea(0xd400, 0xd7ff, 0, DrvPaletteRam ); - ZetMapArea(0xd400, 0xd7ff, 1, DrvPaletteRam ); - ZetMapArea(0xd400, 0xd7ff, 2, DrvPaletteRam ); - ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); - ZetMapArea(0xf000, 0xffff, 0, DrvSpriteRam ); - ZetMapArea(0xf000, 0xffff, 1, DrvSpriteRam ); - ZetMapArea(0xf000, 0xffff, 2, DrvSpriteRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(Drv1943Read2); - ZetSetWriteHandler(Drv1943Write2); - ZetSetInHandler(Drv1943PortRead2); - ZetSetOutHandler(Drv1943PortWrite2); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2 ); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram2 ); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram2 ); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram2 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 Drvb2Init() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x40000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 4, 1); if (nRet != 0) return 1; - GfxDecode(2048, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the bg2 tiles - memset(DrvTempRom, 0, 0x40000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 10, 1); if (nRet != 0) return 1; - GfxDecode(128, 4, 32, 32, Bg2TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBg2Tiles); - - // Load and decode the bg tiles - - //{ "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles - //{ "bm16.11f", 0x08000, 0x23c908c2, BRF_GRA }, // 6 - //{ "bm17.12f", 0x08000, 0x46bcdd07, BRF_GRA }, // 7 - //{ "bm18.14f", 0x08000, 0xe6ae7ba0, BRF_GRA }, // 8 - //{ "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 - //{ "bm20.11j", 0x08000, 0x0917e5d4, BRF_GRA }, // 10 - //{ "bm21.12j", 0x08000, 0x9bfb0d89, BRF_GRA }, // 11 - //{ "bm22.14j", 0x08000, 0x04f3c274, BRF_GRA }, // 12 - - // 0x00000, 0x10000 - // 0x08000, 0x18000 - // 0x20000, 0x30000 - // 0x28000, 0x38000 - - memset(DrvTempRom, 0, 0x40000); - UINT8 *pTemp = (UINT8*)BurnMalloc(0x40000); - nRet = BurnLoadRom(pTemp + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(pTemp + 0x10000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(pTemp + 0x20000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(pTemp + 0x30000, 8, 1); if (nRet != 0) return 1; - memcpy(DrvTempRom + 0x00000, pTemp + 0x00000, 0x8000); - memcpy(DrvTempRom + 0x10000, pTemp + 0x08000, 0x8000); - memcpy(DrvTempRom + 0x08000, pTemp + 0x10000, 0x8000); - memcpy(DrvTempRom + 0x18000, pTemp + 0x18000, 0x8000); - memcpy(DrvTempRom + 0x20000, pTemp + 0x20000, 0x8000); - memcpy(DrvTempRom + 0x30000, pTemp + 0x28000, 0x8000); - memcpy(DrvTempRom + 0x28000, pTemp + 0x30000, 0x8000); - memcpy(DrvTempRom + 0x38000, pTemp + 0x38000, 0x8000); - BurnFree(pTemp); - GfxDecode(512, 4, 32, 32, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBgTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x40000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x28000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 16, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load the Tilemaps - nRet = BurnLoadRom(DrvBgTilemap, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom, 18, 1); if (nRet != 0) return 1; - memcpy(DrvBg2Tilemap + 0x6000, DrvTempRom + 0x0000, 0x2000); - memcpy(DrvBg2Tilemap + 0x4000, DrvTempRom + 0x2000, 0x2000); - memcpy(DrvBg2Tilemap + 0x2000, DrvTempRom + 0x4000, 0x2000); - memcpy(DrvBg2Tilemap + 0x0000, DrvTempRom + 0x6000, 0x2000); - - // Load the PROMs - nRet = BurnLoadRom(DrvPromRed, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromGreen, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBlue, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromCharLookup, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBgLookup, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBgPalBank, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBg2Lookup, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBg2PalBank, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromSpriteLookup, 27, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromSpritePalBank, 28, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Drvb1943Read1); - ZetSetWriteHandler(Drv1943Write1); - ZetSetInHandler(Drv1943PortRead1); - ZetSetOutHandler(Drv1943PortWrite1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0xd000, 0xd3ff, 0, DrvVideoRam ); - ZetMapArea(0xd000, 0xd3ff, 1, DrvVideoRam ); - ZetMapArea(0xd000, 0xd3ff, 2, DrvVideoRam ); - ZetMapArea(0xd400, 0xd7ff, 0, DrvPaletteRam ); - ZetMapArea(0xd400, 0xd7ff, 1, DrvPaletteRam ); - ZetMapArea(0xd400, 0xd7ff, 2, DrvPaletteRam ); - ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); - ZetMapArea(0xf000, 0xffff, 0, DrvSpriteRam ); - ZetMapArea(0xf000, 0xffff, 1, DrvSpriteRam ); - ZetMapArea(0xf000, 0xffff, 2, DrvSpriteRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(Drv1943Read2); - ZetSetWriteHandler(Drv1943Write2); - ZetSetInHandler(Drv1943PortRead2); - ZetSetOutHandler(Drv1943PortWrite2); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2 ); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram2 ); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram2 ); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram2 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - BurnYM2203Exit(); - - GenericTilesExit(); - - DrvRomBank = 0; - DrvSoundLatch = 0; - DrvBg2ScrollX[0] = 0; - DrvBg2ScrollX[1] = 0; - DrvBgScrollX[0] = 0; - DrvBgScrollX[1] = 0; - DrvBgScrollY = 0; - DrvBg2On = 0; - DrvBg1On = 0; - DrvSpritesOn = 0; - DrvCharsOn = 0; - - BurnFree(Mem); - - return 0; -} - -static void DrvCalcPalette() -{ - INT32 i; - UINT32 Palette[256]; - - for (i = 0; i < 256; i++) { - INT32 bit0, bit1, bit2, bit3, r, g, b; - - bit0 = (DrvPromRed[i] >> 0) & 0x01; - bit1 = (DrvPromRed[i] >> 1) & 0x01; - bit2 = (DrvPromRed[i] >> 2) & 0x01; - bit3 = (DrvPromRed[i] >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvPromGreen[i] >> 0) & 0x01; - bit1 = (DrvPromGreen[i] >> 1) & 0x01; - bit2 = (DrvPromGreen[i] >> 2) & 0x01; - bit3 = (DrvPromGreen[i] >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvPromBlue[i] >> 0) & 0x01; - bit1 = (DrvPromBlue[i] >> 1) & 0x01; - bit2 = (DrvPromBlue[i] >> 2) & 0x01; - bit3 = (DrvPromBlue[i] >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - Palette[i] = BurnHighCol(r, g, b, 0); - } - - for (i = 0; i < 0x80; i++) { - DrvPalette[i] = Palette[(DrvPromCharLookup[i] & 0x0f) | 0x40]; - } - - for (i = 0x80; i < 0x180; i++) { - DrvPalette[i] = Palette[((DrvPromBgPalBank[i - 0x80] & 0x03) << 4) | (DrvPromBgLookup[i - 0x80] & 0x0f)]; - } - - for (i = 0x180; i < 0x280; i++) { - DrvPalette[i] = Palette[((DrvPromBg2PalBank[i - 0x180] & 0x03) << 4) | (DrvPromBg2Lookup[i - 0x180] & 0x0f)]; - } - - for (i = 0x280; i < 0x380; i++) { - DrvPalette[i] = Palette[((DrvPromSpritePalBank[i - 0x280] & 0x07) << 4) | (DrvPromSpriteLookup[i - 0x280] & 0x0f) | 0x80]; - } -} - -static void DrvRenderBg2Layer() -{ - INT32 mx, my, Offs, Attr, Code, Colour, x, y, TileIndex, xScroll, Flip, xFlip, yFlip; - - xFlip = 0; - yFlip = 0; - - xScroll = DrvBg2ScrollX[0] + (256 * DrvBg2ScrollX[1]); - - for (mx = 0; mx < 8; mx++) { - for (my = 0; my < 2048; my++) { - TileIndex = (my * 8) + mx; - - Offs = TileIndex * 2; - Attr = DrvBg2Tilemap[Offs + 1]; - Code = DrvBg2Tilemap[Offs] & 0x7f; - Colour = ((Attr & 0x3c) >> 2) + 0x18; - Flip = (Attr & 0xc0) >> 6; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - - y = 32 * mx; - x = 32 * my; - - x -= xScroll; - y -= 16; - - if (x < -31) x += 65536; - - if (x > 256) continue; - if (y > 240) continue; - - if (x > 0 && x < 224 && y > 0 && y < 192) { - if (xFlip) { - if (yFlip) { - Render32x32Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); - } else { - Render32x32Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); - } - } else { - if (yFlip) { - Render32x32Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); - } else { - Render32x32Tile(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render32x32Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); - } else { - Render32x32Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); - } - } else { - if (yFlip) { - Render32x32Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); - } else { - Render32x32Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); - } - } - } - } - } -} - -static void DrvRenderBgLayer() -{ - INT32 mx, my, Offs, Attr, Code, Colour, x, y, TileIndex, xScroll, yScroll, Flip, xFlip, yFlip; - - xFlip = 0; - yFlip = 0; - - yScroll = (DrvBgScrollY + 16) & 0xff; - xScroll = DrvBgScrollX[0] + (256 * DrvBgScrollX[1]); - - for (mx = 0; mx < 8; mx++) { - for (my = 0; my < 2048; my++) { - TileIndex = (my * 8) + mx; - - Offs = TileIndex * 2; - Attr = DrvBgTilemap[Offs + 1]; - Code = DrvBgTilemap[Offs] + ((Attr & 0x01) << 8); - Colour = ((Attr & 0x3c) >> 2) + 0x08; - Flip = (Attr & 0xc0) >> 6; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - - y = 32 * mx; - x = 32 * my; - - x -= xScroll; - y -= yScroll; - - if (x < -31) x += 65536; - if (y < -31) y += 256; - - if (x > 256) continue; - if (y > 240) continue; - - if (x > 0 && x < 224 && y > 0 && y < 192) { - if (xFlip) { - if (yFlip) { - Render32x32Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); - } else { - Render32x32Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); - } - } else { - if (yFlip) { - Render32x32Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); - } else { - Render32x32Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render32x32Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); - } else { - Render32x32Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); - } - } else { - if (yFlip) { - Render32x32Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); - } else { - Render32x32Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); - } - } - } - } - } -} - -static void DrvRenderSprites(INT32 Priority) -{ - INT32 Offs; - - for (Offs = 0x1000 - 32; Offs >= 0; Offs -= 32) { - INT32 Attr = DrvSpriteRam[Offs + 1]; - INT32 Code = DrvSpriteRam[Offs + 0] + ((Attr & 0xe0) << 3); - INT32 Colour = Attr & 0x0f; - INT32 sx = DrvSpriteRam[Offs + 3] - ((Attr & 0x10) << 4); - INT32 sy = DrvSpriteRam[Offs + 2]; - - sy -= 16; - - if (Priority) { - if (Colour != 0x0a && Colour != 0x0b) { - if (sx > 0 && sx < 240 && sy > 0 && sy < 208) { - Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour + 0x28, 4, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour + 0x28, 4, 0, 0, DrvSprites); - } - } - } else { - if (Colour == 0x0a || Colour == 0x0b) { - if (sx > 0 && sx < 240 && sy > 0 && sy < 208) { - Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour + 0x28, 4, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour + 0x28, 4, 0, 0, DrvSprites); - } - } - - } - } -} - -static void DrvRenderCharLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Attr = DrvPaletteRam[TileIndex]; - Code = DrvVideoRam[TileIndex] + ((Attr & 0xe0) << 3); - Colour = Attr & 0x1f; - - x = 8 * mx; - y = 8 * my; - - y -= 16; - - if (x > 0 && x < 248 && y > 0 && y < 216) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 0, 0, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, DrvChars); - } - - TileIndex++; - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - if (DrvBg2On && nBurnLayer & 1) DrvRenderBg2Layer(); - if (DrvSpritesOn) DrvRenderSprites(0); - if (DrvBg1On && nBurnLayer & 2) DrvRenderBgLayer(); - if (DrvSpritesOn) DrvRenderSprites(1); - if (DrvCharsOn && nBurnLayer & 4) DrvRenderCharLayer(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 100; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 6000000 / 60; - nCyclesTotal[1] = 3000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 95) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == 96) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - // Run Z80 #2 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - if (i == 20 || i == 40 || i == 60 || i == 80) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == 21 || i == 41 || i == 61 || i == 81) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - } - - ZetOpen(1); - BurnTimerEndFrame(nCyclesTotal[1]); - ZetClose(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - ZetOpen(1); - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - } - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029672; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(DrvRomBank); - SCAN_VAR(DrvBg2ScrollX[0]); - SCAN_VAR(DrvBg2ScrollX[1]); - SCAN_VAR(DrvBgScrollX[0]); - SCAN_VAR(DrvBgScrollX[1]); - SCAN_VAR(DrvBgScrollY); - SCAN_VAR(DrvBg2On); - SCAN_VAR(DrvBg1On); - SCAN_VAR(DrvSpritesOn); - SCAN_VAR(DrvCharsOn); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x1000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x1000 ); - ZetClose(); - } - - return 0; -} - -struct BurnDriver BurnDrvNineteen43 = { - "1943", NULL, NULL, NULL, "1987", - "1943: The Battle of Midway (Euro)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x380, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNineteen43u = { - "1943u", "1943", NULL, NULL, "1987", - "1943: The Battle of Midway (US)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvuRomInfo, DrvuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x380, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNineteen43j = { - "1943j", "1943", NULL, NULL, "1987", - "1943: Midway Kaisen (Japan, Rev B)\0", NULL, "Capcom", "Miscellaneous", - L"1943: \u30DF\u30C3\u30C9\u30A6\u30A7\u30A4\u6D77\u6226 (Japan, Rev B)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x380, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNineteen43ja = { - "1943ja", "1943", NULL, NULL, "1987", - "1943: Midway Kaisen (Japan)\0", NULL, "Capcom", "Miscellaneous", - L"1943: \u30DF\u30C3\u30C9\u30A6\u30A7\u30A4\u6D77\u6226 (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvjaRomInfo, DrvjaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x380, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNineteen43b = { - "1943b", "1943", NULL, NULL, "1987", - "1943: The Battle of Midway (bootleg set 1, hack of Japan set)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvbInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x380, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNineteen43b2 = { - "1943b2", "1943", NULL, NULL, "1987", - "1943: The Battle of Midway (bootleg set 2, hack of Japan set)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, Drvb2RomInfo, Drvb2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - Drvb2Init, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x380, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvNineteen43kai = { - "1943kai", NULL, NULL, NULL, "1987", - "1943 Kai: Midway Kaisen (Japan)\0", NULL, "Capcom", "Miscellaneous", - L"1943 \u6539: \u30DF\u30C3\u30C9\u30A6\u30A7\u30A4\u6D77\u6226 (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvkaiRomInfo, DrvkaiRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x380, 224, 256, 3, 4 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2203.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[2] = {0, 0}; +static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *DrvZ80Rom1 = NULL; +static UINT8 *DrvZ80Rom2 = NULL; +static UINT8 *DrvZ80Ram1 = NULL; +static UINT8 *DrvZ80Ram2 = NULL; +static UINT8 *DrvVideoRam = NULL; +static UINT8 *DrvPaletteRam = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvPromRed = NULL; +static UINT8 *DrvPromGreen = NULL; +static UINT8 *DrvPromBlue = NULL; +static UINT8 *DrvPromCharLookup = NULL; +static UINT8 *DrvPromBg2Lookup = NULL; +static UINT8 *DrvPromBg2PalBank = NULL; +static UINT8 *DrvPromBgLookup = NULL; +static UINT8 *DrvPromBgPalBank = NULL; +static UINT8 *DrvPromSpriteLookup = NULL; +static UINT8 *DrvPromSpritePalBank = NULL; +static UINT8 *DrvBgTilemap = NULL; +static UINT8 *DrvBg2Tilemap = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvBg2Tiles = NULL; +static UINT8 *DrvBgTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT8 DrvSoundLatch; +static UINT8 DrvRomBank; +static UINT8 DrvBg2ScrollX[2]; +static UINT8 DrvBgScrollX[2]; +static UINT8 DrvBgScrollY; +static UINT8 DrvBg2On; +static UINT8 DrvBg1On; +static UINT8 DrvSpritesOn; +static UINT8 DrvCharsOn; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 7, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + } + + // Clear Opposites + DrvClearOpposites(&DrvInput[1]); + DrvClearOpposites(&DrvInput[2]); +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xf8, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 16 , "Difficulty" }, + {0x11, 0x01, 0x0f, 0x0f, "1 (Easy)" }, + {0x11, 0x01, 0x0f, 0x0e, "2" }, + {0x11, 0x01, 0x0f, 0x0d, "3" }, + {0x11, 0x01, 0x0f, 0x0c, "4" }, + {0x11, 0x01, 0x0f, 0x0b, "5" }, + {0x11, 0x01, 0x0f, 0x0a, "6" }, + {0x11, 0x01, 0x0f, 0x09, "7" }, + {0x11, 0x01, 0x0f, 0x08, "8 (Normal)" }, + {0x11, 0x01, 0x0f, 0x07, "9" }, + {0x11, 0x01, 0x0f, 0x06, "10" }, + {0x11, 0x01, 0x0f, 0x05, "11" }, + {0x11, 0x01, 0x0f, 0x04, "12" }, + {0x11, 0x01, 0x0f, 0x03, "13" }, + {0x11, 0x01, 0x0f, 0x02, "14" }, + {0x11, 0x01, 0x0f, 0x01, "15" }, + {0x11, 0x01, 0x0f, 0x00, "16 (Difficult)" }, + + {0 , 0xfe, 0 , 2 , "2 Player Game" }, + {0x11, 0x01, 0x10, 0x00, "1 Credit / 2 Players" }, + {0x11, 0x01, 0x10, 0x10, "2 Credits / 2 Players" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x20, 0x20, "Off" }, + {0x11, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x11, 0x01, 0x40, 0x40, "Off" }, + {0x11, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x12, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, + {0x12, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, + {0x12, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Plays" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x12, 0x01, 0x38, 0x00, "4 Coins 1 Play" }, + {0x12, 0x01, 0x38, 0x08, "3 Coins 1 Play" }, + {0x12, 0x01, 0x38, 0x10, "2 Coins 1 Play" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, + {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Plays" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x12, 0x01, 0x40, 0x00, "No" }, + {0x12, 0x01, 0x40, 0x40, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x80, 0x00, "Off" }, + {0x12, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Drv) + +static struct BurnRomInfo DrvRomDesc[] = { + { "bme01.12d", 0x08000, 0x55fd447e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bme02.13d", 0x10000, 0x073fc57c, BRF_ESS | BRF_PRG }, // 1 + { "bme03.14d", 0x10000, 0x835822c2, BRF_ESS | BRF_PRG }, // 2 + + { "bm04.5h", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "bm05.4k", 0x08000, 0x46cb9d3d, BRF_GRA }, // 4 Characters + + { "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles + { "bm16.11f", 0x08000, 0x23c908c2, BRF_GRA }, // 6 + { "bm17.12f", 0x08000, 0x46bcdd07, BRF_GRA }, // 7 + { "bm18.14f", 0x08000, 0xe6ae7ba0, BRF_GRA }, // 8 + { "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 + { "bm20.11j", 0x08000, 0x0917e5d4, BRF_GRA }, // 10 + { "bm21.12j", 0x08000, 0x9bfb0d89, BRF_GRA }, // 11 + { "bm22.14j", 0x08000, 0x04f3c274, BRF_GRA }, // 12 + + { "bm24.14k", 0x08000, 0x11134036, BRF_GRA }, // 13 BG2 Tiles + { "bm25.14l", 0x08000, 0x092cf9c1, BRF_GRA }, // 14 + + { "bm06.10a", 0x08000, 0x97acc8af, BRF_GRA }, // 15 Sprites + { "bm07.11a", 0x08000, 0xd78f7197, BRF_GRA }, // 16 + { "bm08.12a", 0x08000, 0x1a626608, BRF_GRA }, // 17 + { "bm09.14a", 0x08000, 0x92408400, BRF_GRA }, // 18 + { "bm10.10c", 0x08000, 0x8438a44a, BRF_GRA }, // 19 + { "bm11.11c", 0x08000, 0x6c69351d, BRF_GRA }, // 20 + { "bm12.12c", 0x08000, 0x5e7efdb7, BRF_GRA }, // 21 + { "bm13.14c", 0x08000, 0x1143829a, BRF_GRA }, // 22 + + { "bm14.5f", 0x08000, 0x4d3c6401, BRF_GRA }, // 23 Tilemaps + { "bm23.8k", 0x08000, 0xa52aecbd, BRF_GRA }, // 24 + + { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 25 PROMs + { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 26 + { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 27 + { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 28 + { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 29 + { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 30 + { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 31 + { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 32 + { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 33 + { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 34 + { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 35 + { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 36 + + { "bm.7k", 0x10000, 0x00000000, BRF_NODUMP }, // 37 MCU +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo DrvuRomDesc[] = { + { "bmu01c.12d", 0x08000, 0xc686cc5c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bmu02c.13d", 0x10000, 0xd8880a41, BRF_ESS | BRF_PRG }, // 1 + { "bmu03c.14d", 0x10000, 0x3f0ee26c, BRF_ESS | BRF_PRG }, // 2 + + { "bm04.5h", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "bm05.4k", 0x08000, 0x46cb9d3d, BRF_GRA }, // 4 Characters + + { "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles + { "bm16.11f", 0x08000, 0x23c908c2, BRF_GRA }, // 6 + { "bm17.12f", 0x08000, 0x46bcdd07, BRF_GRA }, // 7 + { "bm18.14f", 0x08000, 0xe6ae7ba0, BRF_GRA }, // 8 + { "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 + { "bm20.11j", 0x08000, 0x0917e5d4, BRF_GRA }, // 10 + { "bm21.12j", 0x08000, 0x9bfb0d89, BRF_GRA }, // 11 + { "bm22.14j", 0x08000, 0x04f3c274, BRF_GRA }, // 12 + + { "bm24.14k", 0x08000, 0x11134036, BRF_GRA }, // 13 BG2 Tiles + { "bm25.14l", 0x08000, 0x092cf9c1, BRF_GRA }, // 14 + + { "bm06.10a", 0x08000, 0x97acc8af, BRF_GRA }, // 15 Sprites + { "bm07.11a", 0x08000, 0xd78f7197, BRF_GRA }, // 16 + { "bm08.12a", 0x08000, 0x1a626608, BRF_GRA }, // 17 + { "bm09.14a", 0x08000, 0x92408400, BRF_GRA }, // 18 + { "bm10.10c", 0x08000, 0x8438a44a, BRF_GRA }, // 19 + { "bm11.11c", 0x08000, 0x6c69351d, BRF_GRA }, // 20 + { "bm12.12c", 0x08000, 0x5e7efdb7, BRF_GRA }, // 21 + { "bm13.14c", 0x08000, 0x1143829a, BRF_GRA }, // 22 + + { "bm14.5f", 0x08000, 0x4d3c6401, BRF_GRA }, // 23 Tilemaps + { "bm23.8k", 0x08000, 0xa52aecbd, BRF_GRA }, // 24 + + { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 25 PROMs + { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 26 + { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 27 + { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 28 + { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 29 + { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 30 + { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 31 + { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 32 + { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 33 + { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 34 + { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 35 + { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 36 + + { "bm.7k", 0x10000, 0x00000000, BRF_NODUMP }, // 37 MCU +}; + +STD_ROM_PICK(Drvu) +STD_ROM_FN(Drvu) + +static struct BurnRomInfo DrvjRomDesc[] = { + { "bm01b.12d", 0x08000, 0x363f9f3d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bm02b.13d", 0x10000, 0x7f0d7edc, BRF_ESS | BRF_PRG }, // 1 + { "bm03b.14d", 0x10000, 0x7093da2a, BRF_ESS | BRF_PRG }, // 2 + + { "bm04.5h", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "bm05.4k", 0x08000, 0x46cb9d3d, BRF_GRA }, // 4 Characters + + { "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles + { "bm16.11f", 0x08000, 0x23c908c2, BRF_GRA }, // 6 + { "bm17.12f", 0x08000, 0x46bcdd07, BRF_GRA }, // 7 + { "bm18.14f", 0x08000, 0xe6ae7ba0, BRF_GRA }, // 8 + { "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 + { "bm20.11j", 0x08000, 0x0917e5d4, BRF_GRA }, // 10 + { "bm21.12j", 0x08000, 0x9bfb0d89, BRF_GRA }, // 11 + { "bm22.14j", 0x08000, 0x04f3c274, BRF_GRA }, // 12 + + { "bm24.14k", 0x08000, 0x11134036, BRF_GRA }, // 13 BG2 Tiles + { "bm25.14l", 0x08000, 0x092cf9c1, BRF_GRA }, // 14 + + { "bm06.10a", 0x08000, 0x97acc8af, BRF_GRA }, // 15 Sprites + { "bm07.11a", 0x08000, 0xd78f7197, BRF_GRA }, // 16 + { "bm08.12a", 0x08000, 0x1a626608, BRF_GRA }, // 17 + { "bm09.14a", 0x08000, 0x92408400, BRF_GRA }, // 18 + { "bm10.10c", 0x08000, 0x8438a44a, BRF_GRA }, // 19 + { "bm11.11c", 0x08000, 0x6c69351d, BRF_GRA }, // 20 + { "bm12.12c", 0x08000, 0x5e7efdb7, BRF_GRA }, // 21 + { "bm13.14c", 0x08000, 0x1143829a, BRF_GRA }, // 22 + + { "bm14.5f", 0x08000, 0x4d3c6401, BRF_GRA }, // 23 Tilemaps + { "bm23.8k", 0x08000, 0xa52aecbd, BRF_GRA }, // 24 + + { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 25 PROMs + { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 26 + { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 27 + { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 28 + { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 29 + { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 30 + { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 31 + { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 32 + { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 33 + { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 34 + { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 35 + { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 36 + + { "bm.7k", 0x10000, 0x00000000, BRF_NODUMP }, // 37 MCU +}; + +STD_ROM_PICK(Drvj) +STD_ROM_FN(Drvj) + +static struct BurnRomInfo DrvjaRomDesc[] = { + { "bm01.12d", 0x08000, 0xf6935937, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bm02.13d", 0x10000, 0xaf971575, BRF_ESS | BRF_PRG }, // 1 + { "bm03.14d", 0x10000, 0x300ec713, BRF_ESS | BRF_PRG }, // 2 + + { "bm04.5h", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "bm05.4k", 0x08000, 0x46cb9d3d, BRF_GRA }, // 4 Characters + + { "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles + { "bm16.11f", 0x08000, 0x23c908c2, BRF_GRA }, // 6 + { "bm17.12f", 0x08000, 0x46bcdd07, BRF_GRA }, // 7 + { "bm18.14f", 0x08000, 0xe6ae7ba0, BRF_GRA }, // 8 + { "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 + { "bm20.11j", 0x08000, 0x0917e5d4, BRF_GRA }, // 10 + { "bm21.12j", 0x08000, 0x9bfb0d89, BRF_GRA }, // 11 + { "bm22.14j", 0x08000, 0x04f3c274, BRF_GRA }, // 12 + + { "bm24.14k", 0x08000, 0x11134036, BRF_GRA }, // 13 BG2 Tiles + { "bm25.14l", 0x08000, 0x092cf9c1, BRF_GRA }, // 14 + + { "bm06.10a", 0x08000, 0x97acc8af, BRF_GRA }, // 15 Sprites + { "bm07.11a", 0x08000, 0xd78f7197, BRF_GRA }, // 16 + { "bm08.12a", 0x08000, 0x1a626608, BRF_GRA }, // 17 + { "bm09.14a", 0x08000, 0x92408400, BRF_GRA }, // 18 + { "bm10.10c", 0x08000, 0x8438a44a, BRF_GRA }, // 19 + { "bm11.11c", 0x08000, 0x6c69351d, BRF_GRA }, // 20 + { "bm12.12c", 0x08000, 0x5e7efdb7, BRF_GRA }, // 21 + { "bm13.14c", 0x08000, 0x1143829a, BRF_GRA }, // 22 + + { "bm14.5f", 0x08000, 0x4d3c6401, BRF_GRA }, // 23 Tilemaps + { "bm23.8k", 0x08000, 0xa52aecbd, BRF_GRA }, // 24 + + { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 25 PROMs + { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 26 + { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 27 + { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 28 + { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 29 + { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 30 + { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 31 + { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 32 + { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 33 + { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 34 + { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 35 + { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 36 + + { "bm.7k", 0x10000, 0x00000000, BRF_NODUMP }, // 37 MCU +}; + +STD_ROM_PICK(Drvja) +STD_ROM_FN(Drvja) + +static struct BurnRomInfo DrvbRomDesc[] = { + { "1.12d", 0x08000, 0x9a2d70ab, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bm02.13d", 0x10000, 0xaf971575, BRF_ESS | BRF_PRG }, // 1 + { "bm03.14d", 0x10000, 0x300ec713, BRF_ESS | BRF_PRG }, // 2 + + { "bm04.5h", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "4.5h", 0x08000, 0x0aba2096, BRF_GRA }, // 4 Characters + + { "15.12f", 0x10000, 0x622b4fba, BRF_GRA }, // 5 BG Tiles + { "16.14f", 0x10000, 0x25471a8d, BRF_GRA }, // 6 + { "17.12j", 0x10000, 0x9da79653, BRF_GRA }, // 7 + { "18.14j", 0x10000, 0x1f3aced8, BRF_GRA }, // 8 + + { "bm24.14k", 0x08000, 0x11134036, BRF_GRA }, // 9 BG2 Tiles + { "bm25.14l", 0x08000, 0x092cf9c1, BRF_GRA }, // 10 + + { "bm06.10a", 0x08000, 0x97acc8af, BRF_GRA }, // 11 Sprites + { "bm07.11a", 0x08000, 0xd78f7197, BRF_GRA }, // 12 + { "bm08.12a", 0x08000, 0x1a626608, BRF_GRA }, // 13 + { "bm09.14a", 0x08000, 0x92408400, BRF_GRA }, // 14 + { "bm10.10c", 0x08000, 0x8438a44a, BRF_GRA }, // 15 + { "bm11.11c", 0x08000, 0x6c69351d, BRF_GRA }, // 16 + { "bm12.12c", 0x08000, 0x5e7efdb7, BRF_GRA }, // 17 + { "bm13.14c", 0x08000, 0x1143829a, BRF_GRA }, // 18 + + { "bm14.5f", 0x08000, 0x4d3c6401, BRF_GRA }, // 19 Tilemaps + { "bm23.8k", 0x08000, 0xa52aecbd, BRF_GRA }, // 20 + + { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 21 PROMs + { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 22 + { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 23 + { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 24 + { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 25 + { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 26 + { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 27 + { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 28 + { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 29 + { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 30 + { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 31 + { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 32 +}; + +STD_ROM_PICK(Drvb) +STD_ROM_FN(Drvb) + +static struct BurnRomInfo Drvb2RomDesc[] = { + { "u28.bin", 0x08000, 0xb3b7c7cd, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "u27.bin", 0x10000, 0xaf971575, BRF_ESS | BRF_PRG }, // 1 + { "u26.bin", 0x10000, 0x300ec713, BRF_ESS | BRF_PRG }, // 2 + + { "u88.bin", 0x08000, 0xee2bd2d7, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "u62.bin", 0x08000, 0x0aba2096, BRF_GRA }, // 4 Characters + + { "u66.bin", 0x10000, 0x075e9a7f, BRF_GRA }, // 5 BG Tiles + { "u65.bin", 0x10000, 0x05aca09a, BRF_GRA }, // 6 + { "u79.bin", 0x10000, 0x0f4b7e0e, BRF_GRA }, // 7 + { "u70.bin", 0x10000, 0x61a90c0a, BRF_GRA }, // 8 + + { "u102.bin", 0x08000, 0x11134036, BRF_GRA }, // 9 BG2 Tiles + { "u116.bin", 0x08000, 0x092cf9c1, BRF_GRA }, // 10 + + { "u9.bin", 0x08000, 0x97acc8af, BRF_GRA }, // 11 Sprites + { "u10.bin", 0x08000, 0xd78f7197, BRF_GRA }, // 12 + { "u8.bin", 0x10000, 0xed5c788a, BRF_GRA }, // 13 + { "u18.bin", 0x08000, 0x8438a44a, BRF_GRA }, // 14 + { "u19.bin", 0x08000, 0x6c69351d, BRF_GRA }, // 15 + { "u17.bin", 0x10000, 0x4b42445e, BRF_GRA }, // 16 + + { "u58.bin", 0x08000, 0x4d3c6401, BRF_GRA }, // 17 Tilemaps + { "u96.bin", 0x08000, 0x254c881d, BRF_GRA }, // 18 + + { "bm1.12a", 0x00100, 0x74421f18, BRF_GRA }, // 19 PROMs + { "bm2.13a", 0x00100, 0xac27541f, BRF_GRA }, // 20 + { "bm3.14a", 0x00100, 0x251fb6ff, BRF_GRA }, // 21 + { "bm5.7f", 0x00100, 0x206713d0, BRF_GRA }, // 22 + { "bm10.7l", 0x00100, 0x33c2491c, BRF_GRA }, // 23 + { "bm9.6l", 0x00100, 0xaeea4af7, BRF_GRA }, // 24 + { "bm12.12m", 0x00100, 0xc18aa136, BRF_GRA }, // 25 + { "bm11.12l", 0x00100, 0x405aae37, BRF_GRA }, // 26 + { "bm8.8c", 0x00100, 0xc2010a9e, BRF_GRA }, // 27 + { "bm7.7c", 0x00100, 0xb56f30c3, BRF_GRA }, // 28 + { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 29 + { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 30 +}; + +STD_ROM_PICK(Drvb2) +STD_ROM_FN(Drvb2) + +static struct BurnRomInfo DrvkaiRomDesc[] = { + { "bmk01.12d", 0x08000, 0x7d2211db, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bmk02.13d", 0x10000, 0x2ebbc8c5, BRF_ESS | BRF_PRG }, // 1 + { "bmk03.14d", 0x10000, 0x475a6ac5, BRF_ESS | BRF_PRG }, // 2 + + { "bmk04.5h", 0x08000, 0x25f37957, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "bmk05.4k", 0x08000, 0x884a8692, BRF_GRA }, // 4 Characters + + { "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles + { "bmk16.11f", 0x08000, 0x9416fe0d, BRF_GRA }, // 6 + { "bmk17.12f", 0x08000, 0x3d5acab9, BRF_GRA }, // 7 + { "bmk18.14f", 0x08000, 0x7b62da1d, BRF_GRA }, // 8 + { "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 + { "bmk20.11j", 0x08000, 0xb90364c1, BRF_GRA }, // 10 + { "bmk21.12j", 0x08000, 0x8c7fe74a, BRF_GRA }, // 11 + { "bmk22.14j", 0x08000, 0xd5ef8a0e, BRF_GRA }, // 12 + + { "bmk24.14k", 0x08000, 0xbf186ef2, BRF_GRA }, // 13 BG2 Tiles + { "bmk25.14l", 0x08000, 0xa755faf1, BRF_GRA }, // 14 + + { "bmk06.10a", 0x08000, 0x5f7e38b3, BRF_GRA }, // 15 Sprites + { "bmk07.11a", 0x08000, 0xff3751fd, BRF_GRA }, // 16 + { "bmk08.12a", 0x08000, 0x159d51bd, BRF_GRA }, // 17 + { "bmk09.14a", 0x08000, 0x8683e3d2, BRF_GRA }, // 18 + { "bmk10.10c", 0x08000, 0x1e0d9571, BRF_GRA }, // 19 + { "bmk11.11c", 0x08000, 0xf1fc5ee1, BRF_GRA }, // 20 + { "bmk12.12c", 0x08000, 0x0f50c001, BRF_GRA }, // 21 + { "bmk13.14c", 0x08000, 0xfd1acf8e, BRF_GRA }, // 22 + + { "bmk14.5f", 0x08000, 0xcf0f5a53, BRF_GRA }, // 23 Tilemaps + { "bmk23.8k", 0x08000, 0x17f77ef9, BRF_GRA }, // 24 + + { "bmk1.12a", 0x00100, 0xe001ea33, BRF_GRA }, // 25 PROMs + { "bmk2.13a", 0x00100, 0xaf34d91a, BRF_GRA }, // 26 + { "bmk3.14a", 0x00100, 0x43e9f6ef, BRF_GRA }, // 27 + { "bmk5.7f", 0x00100, 0x41878934, BRF_GRA }, // 28 + { "bmk10.7l", 0x00100, 0xde44b748, BRF_GRA }, // 29 + { "bmk9.6l", 0x00100, 0x59ea57c0, BRF_GRA }, // 30 + { "bmk12.12m", 0x00100, 0x8765f8b0, BRF_GRA }, // 31 + { "bmk11.12l", 0x00100, 0x87a8854e, BRF_GRA }, // 32 + { "bmk8.8c", 0x00100, 0xdad17e2d, BRF_GRA }, // 33 + { "bmk7.7c", 0x00100, 0x76307f8d, BRF_GRA }, // 34 + { "bm4.12c", 0x00100, 0x91a8a2e1, BRF_GRA }, // 35 + { "bm6.4b", 0x00100, 0x0eaf5158, BRF_GRA }, // 36 + + { "bm.7k", 0x10000, 0x00000000, BRF_NODUMP }, // 37 MCU +}; + +STD_ROM_PICK(Drvkai) +STD_ROM_FN(Drvkai) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom1 = Next; Next += 0x30000; + DrvZ80Rom2 = Next; Next += 0x08000; + DrvPromRed = Next; Next += 0x00100; + DrvPromGreen = Next; Next += 0x00100; + DrvPromBlue = Next; Next += 0x00100; + DrvPromCharLookup = Next; Next += 0x00100; + DrvPromBg2Lookup = Next; Next += 0x00100; + DrvPromBg2PalBank = Next; Next += 0x00100; + DrvPromBgLookup = Next; Next += 0x00100; + DrvPromBgPalBank = Next; Next += 0x00100; + DrvPromSpriteLookup = Next; Next += 0x00100; + DrvPromSpritePalBank = Next; Next += 0x00100; + DrvBgTilemap = Next; Next += 0x08000; + DrvBg2Tilemap = Next; Next += 0x08000; + + RamStart = Next; + + DrvZ80Ram1 = Next; Next += 0x01000; + DrvZ80Ram2 = Next; Next += 0x00800; + DrvVideoRam = Next; Next += 0x00400; + DrvPaletteRam = Next; Next += 0x00400; + DrvSpriteRam = Next; Next += 0x01000; + + RamEnd = Next; + + DrvChars = Next; Next += 2048 * 8 * 8; + DrvBg2Tiles = Next; Next += 128 * 32 * 32; + DrvBgTiles = Next; Next += 512 * 32 * 32; + DrvSprites = Next; Next += 2048 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00380 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + BurnYM2203Reset(); + + DrvRomBank = 0; + DrvSoundLatch = 0; + DrvBg2ScrollX[0] = 0; + DrvBg2ScrollX[1] = 0; + DrvBgScrollX[0] = 0; + DrvBgScrollX[1] = 0; + DrvBgScrollY = 0; + DrvBg2On = 0; + DrvBg1On = 0; + DrvSpritesOn = 0; + DrvCharsOn = 0; + + return 0; +} + +UINT8 __fastcall Drv1943Read1(UINT16 a) +{ + switch (a) { + case 0xc000: { + return 0xff - DrvInput[0]; + } + + case 0xc001: { + return 0xff - DrvInput[1]; + } + + case 0xc002: { + return 0xff - DrvInput[2]; + } + + case 0xc003: { + return DrvDip[0]; + } + + case 0xc004: { + return DrvDip[1]; + } + + case 0xc007: { + return ZetBc(-1) >> 8; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall Drvb1943Read1(UINT16 a) +{ + switch (a) { + case 0xc000: { + return 0xff - DrvInput[0]; + } + + case 0xc001: { + return 0xff - DrvInput[1]; + } + + case 0xc002: { + return 0xff - DrvInput[2]; + } + + case 0xc003: { + return DrvDip[0]; + } + + case 0xc004: { + return DrvDip[1]; + } + + case 0xc007: { + return 0x00; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall Drv1943Write1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xc800: { + DrvSoundLatch = d; + return; + } + + case 0xc804: { + DrvRomBank = d & 0x1c; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x1000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x1000 ); + + if (d & 0x40) bprintf(PRINT_NORMAL, _T("c804 write %x\n"), d); + + DrvCharsOn = d & 0x80; + return; + } + + case 0xc806: { + // Watchdog + return; + } + + case 0xc807: { + // NOP + return; + } + + case 0xd800: { + DrvBgScrollX[0] = d; + return; + } + + case 0xd801: { + DrvBgScrollX[1] = d; + return; + } + + case 0xd802: { + DrvBgScrollY = d; + return; + } + + case 0xd803: { + DrvBg2ScrollX[0] = d; + return; + } + + case 0xd804: { + DrvBg2ScrollX[1] = d; + return; + } + + case 0xd806: { + DrvBg1On = d & 0x10; + DrvBg2On = d & 0x20; + DrvSpritesOn = d & 0x40; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Drv1943PortRead1(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall Drv1943PortWrite1(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Drv1943Read2(UINT16 a) +{ + switch (a) { + case 0xc800: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall Drv1943Write2(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0xe001: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0xe002: { + BurnYM2203Write(1, 0, d); + return; + } + + case 0xe003: { + BurnYM2203Write(1, 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Drv1943PortRead2(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall Drv1943PortWrite2(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); + } + } +} + +static INT32 CharPlaneOffsets[2] = { 4, 0 }; +static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; +static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; +static INT32 Bg2TilePlaneOffsets[4] = { 0x40004, 0x40000, 4, 0 }; +static INT32 BgTilePlaneOffsets[4] = { 0x100004, 0x100000, 4, 0 }; +static INT32 TileXOffsets[32] = { 0, 1, 2, 3, 8, 9, 10, 11, 512, 513, 514, 515, 520, 521, 522, 523, 1024, 1025, 1026, 1027, 1032, 1033, 1034, 1035, 1536, 1537, 1538, 1539, 1544, 1545, 1546, 1547 }; +static INT32 TileYOffsets[32] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256, 272, 288, 304, 320, 336, 352, 368, 384, 400, 416, 432, 448, 464, 480, 496 }; +static INT32 SpritePlaneOffsets[4] = { 0x100004, 0x100000, 4, 0 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; +static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3000000; +} + +static INT32 DrvInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x40000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 4, 1); if (nRet != 0) return 1; + GfxDecode(2048, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the bg2 tiles + memset(DrvTempRom, 0, 0x40000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 14, 1); if (nRet != 0) return 1; + GfxDecode(128, 4, 32, 32, Bg2TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBg2Tiles); + + // Load and decode the bg tiles + memset(DrvTempRom, 0, 0x40000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x18000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x28000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x38000, 12, 1); if (nRet != 0) return 1; + GfxDecode(512, 4, 32, 32, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBgTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x40000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x18000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x28000, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x38000, 22, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load the Tilemaps + nRet = BurnLoadRom(DrvBgTilemap, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvBg2Tilemap, 24, 1); if (nRet != 0) return 1; + + // Load the PROMs + nRet = BurnLoadRom(DrvPromRed, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromGreen, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBlue, 27, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromCharLookup, 28, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBgLookup, 29, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBgPalBank, 30, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBg2Lookup, 31, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBg2PalBank, 32, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromSpriteLookup, 33, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromSpritePalBank, 34, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Drv1943Read1); + ZetSetWriteHandler(Drv1943Write1); + ZetSetInHandler(Drv1943PortRead1); + ZetSetOutHandler(Drv1943PortWrite1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0xd000, 0xd3ff, 0, DrvVideoRam ); + ZetMapArea(0xd000, 0xd3ff, 1, DrvVideoRam ); + ZetMapArea(0xd000, 0xd3ff, 2, DrvVideoRam ); + ZetMapArea(0xd400, 0xd7ff, 0, DrvPaletteRam ); + ZetMapArea(0xd400, 0xd7ff, 1, DrvPaletteRam ); + ZetMapArea(0xd400, 0xd7ff, 2, DrvPaletteRam ); + ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); + ZetMapArea(0xf000, 0xffff, 0, DrvSpriteRam ); + ZetMapArea(0xf000, 0xffff, 1, DrvSpriteRam ); + ZetMapArea(0xf000, 0xffff, 2, DrvSpriteRam ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(Drv1943Read2); + ZetSetWriteHandler(Drv1943Write2); + ZetSetInHandler(Drv1943PortRead2); + ZetSetOutHandler(Drv1943PortWrite2); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2 ); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram2 ); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram2 ); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram2 ); + ZetClose(); + + BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 DrvbInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x40000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 4, 1); if (nRet != 0) return 1; + GfxDecode(2048, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the bg2 tiles + memset(DrvTempRom, 0, 0x40000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 10, 1); if (nRet != 0) return 1; + GfxDecode(128, 4, 32, 32, Bg2TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBg2Tiles); + + // Load and decode the bg tiles + memset(DrvTempRom, 0, 0x40000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 8, 1); if (nRet != 0) return 1; + GfxDecode(512, 4, 32, 32, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBgTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x40000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x18000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x28000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x38000, 18, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load the Tilemaps + nRet = BurnLoadRom(DrvBgTilemap, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvBg2Tilemap, 20, 1); if (nRet != 0) return 1; + + // Load the PROMs + nRet = BurnLoadRom(DrvPromRed, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromGreen, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBlue, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromCharLookup, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBgLookup, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBgPalBank, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBg2Lookup, 27, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBg2PalBank, 28, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromSpriteLookup, 29, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromSpritePalBank, 30, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Drvb1943Read1); + ZetSetWriteHandler(Drv1943Write1); + ZetSetInHandler(Drv1943PortRead1); + ZetSetOutHandler(Drv1943PortWrite1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0xd000, 0xd3ff, 0, DrvVideoRam ); + ZetMapArea(0xd000, 0xd3ff, 1, DrvVideoRam ); + ZetMapArea(0xd000, 0xd3ff, 2, DrvVideoRam ); + ZetMapArea(0xd400, 0xd7ff, 0, DrvPaletteRam ); + ZetMapArea(0xd400, 0xd7ff, 1, DrvPaletteRam ); + ZetMapArea(0xd400, 0xd7ff, 2, DrvPaletteRam ); + ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); + ZetMapArea(0xf000, 0xffff, 0, DrvSpriteRam ); + ZetMapArea(0xf000, 0xffff, 1, DrvSpriteRam ); + ZetMapArea(0xf000, 0xffff, 2, DrvSpriteRam ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(Drv1943Read2); + ZetSetWriteHandler(Drv1943Write2); + ZetSetInHandler(Drv1943PortRead2); + ZetSetOutHandler(Drv1943PortWrite2); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2 ); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram2 ); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram2 ); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram2 ); + ZetClose(); + + BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 Drvb2Init() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x40000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 4, 1); if (nRet != 0) return 1; + GfxDecode(2048, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the bg2 tiles + memset(DrvTempRom, 0, 0x40000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 10, 1); if (nRet != 0) return 1; + GfxDecode(128, 4, 32, 32, Bg2TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBg2Tiles); + + // Load and decode the bg tiles + + //{ "bm15.10f", 0x08000, 0x6b1a0443, BRF_GRA }, // 5 BG Tiles + //{ "bm16.11f", 0x08000, 0x23c908c2, BRF_GRA }, // 6 + //{ "bm17.12f", 0x08000, 0x46bcdd07, BRF_GRA }, // 7 + //{ "bm18.14f", 0x08000, 0xe6ae7ba0, BRF_GRA }, // 8 + //{ "bm19.10j", 0x08000, 0x868ababc, BRF_GRA }, // 9 + //{ "bm20.11j", 0x08000, 0x0917e5d4, BRF_GRA }, // 10 + //{ "bm21.12j", 0x08000, 0x9bfb0d89, BRF_GRA }, // 11 + //{ "bm22.14j", 0x08000, 0x04f3c274, BRF_GRA }, // 12 + + // 0x00000, 0x10000 + // 0x08000, 0x18000 + // 0x20000, 0x30000 + // 0x28000, 0x38000 + + memset(DrvTempRom, 0, 0x40000); + UINT8 *pTemp = (UINT8*)BurnMalloc(0x40000); + nRet = BurnLoadRom(pTemp + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(pTemp + 0x10000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(pTemp + 0x20000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(pTemp + 0x30000, 8, 1); if (nRet != 0) return 1; + memcpy(DrvTempRom + 0x00000, pTemp + 0x00000, 0x8000); + memcpy(DrvTempRom + 0x10000, pTemp + 0x08000, 0x8000); + memcpy(DrvTempRom + 0x08000, pTemp + 0x10000, 0x8000); + memcpy(DrvTempRom + 0x18000, pTemp + 0x18000, 0x8000); + memcpy(DrvTempRom + 0x20000, pTemp + 0x20000, 0x8000); + memcpy(DrvTempRom + 0x30000, pTemp + 0x28000, 0x8000); + memcpy(DrvTempRom + 0x28000, pTemp + 0x30000, 0x8000); + memcpy(DrvTempRom + 0x38000, pTemp + 0x38000, 0x8000); + BurnFree(pTemp); + GfxDecode(512, 4, 32, 32, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x800, DrvTempRom, DrvBgTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x40000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x28000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 16, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load the Tilemaps + nRet = BurnLoadRom(DrvBgTilemap, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom, 18, 1); if (nRet != 0) return 1; + memcpy(DrvBg2Tilemap + 0x6000, DrvTempRom + 0x0000, 0x2000); + memcpy(DrvBg2Tilemap + 0x4000, DrvTempRom + 0x2000, 0x2000); + memcpy(DrvBg2Tilemap + 0x2000, DrvTempRom + 0x4000, 0x2000); + memcpy(DrvBg2Tilemap + 0x0000, DrvTempRom + 0x6000, 0x2000); + + // Load the PROMs + nRet = BurnLoadRom(DrvPromRed, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromGreen, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBlue, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromCharLookup, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBgLookup, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBgPalBank, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBg2Lookup, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBg2PalBank, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromSpriteLookup, 27, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromSpritePalBank, 28, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Drvb1943Read1); + ZetSetWriteHandler(Drv1943Write1); + ZetSetInHandler(Drv1943PortRead1); + ZetSetOutHandler(Drv1943PortWrite1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0xd000, 0xd3ff, 0, DrvVideoRam ); + ZetMapArea(0xd000, 0xd3ff, 1, DrvVideoRam ); + ZetMapArea(0xd000, 0xd3ff, 2, DrvVideoRam ); + ZetMapArea(0xd400, 0xd7ff, 0, DrvPaletteRam ); + ZetMapArea(0xd400, 0xd7ff, 1, DrvPaletteRam ); + ZetMapArea(0xd400, 0xd7ff, 2, DrvPaletteRam ); + ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram1 ); + ZetMapArea(0xf000, 0xffff, 0, DrvSpriteRam ); + ZetMapArea(0xf000, 0xffff, 1, DrvSpriteRam ); + ZetMapArea(0xf000, 0xffff, 2, DrvSpriteRam ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(Drv1943Read2); + ZetSetWriteHandler(Drv1943Write2); + ZetSetInHandler(Drv1943PortRead2); + ZetSetOutHandler(Drv1943PortWrite2); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2 ); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram2 ); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram2 ); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram2 ); + ZetClose(); + + BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + BurnYM2203Exit(); + + GenericTilesExit(); + + DrvRomBank = 0; + DrvSoundLatch = 0; + DrvBg2ScrollX[0] = 0; + DrvBg2ScrollX[1] = 0; + DrvBgScrollX[0] = 0; + DrvBgScrollX[1] = 0; + DrvBgScrollY = 0; + DrvBg2On = 0; + DrvBg1On = 0; + DrvSpritesOn = 0; + DrvCharsOn = 0; + + BurnFree(Mem); + + return 0; +} + +static void DrvCalcPalette() +{ + INT32 i; + UINT32 Palette[256]; + + for (i = 0; i < 256; i++) { + INT32 bit0, bit1, bit2, bit3, r, g, b; + + bit0 = (DrvPromRed[i] >> 0) & 0x01; + bit1 = (DrvPromRed[i] >> 1) & 0x01; + bit2 = (DrvPromRed[i] >> 2) & 0x01; + bit3 = (DrvPromRed[i] >> 3) & 0x01; + r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvPromGreen[i] >> 0) & 0x01; + bit1 = (DrvPromGreen[i] >> 1) & 0x01; + bit2 = (DrvPromGreen[i] >> 2) & 0x01; + bit3 = (DrvPromGreen[i] >> 3) & 0x01; + g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvPromBlue[i] >> 0) & 0x01; + bit1 = (DrvPromBlue[i] >> 1) & 0x01; + bit2 = (DrvPromBlue[i] >> 2) & 0x01; + bit3 = (DrvPromBlue[i] >> 3) & 0x01; + b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + Palette[i] = BurnHighCol(r, g, b, 0); + } + + for (i = 0; i < 0x80; i++) { + DrvPalette[i] = Palette[(DrvPromCharLookup[i] & 0x0f) | 0x40]; + } + + for (i = 0x80; i < 0x180; i++) { + DrvPalette[i] = Palette[((DrvPromBgPalBank[i - 0x80] & 0x03) << 4) | (DrvPromBgLookup[i - 0x80] & 0x0f)]; + } + + for (i = 0x180; i < 0x280; i++) { + DrvPalette[i] = Palette[((DrvPromBg2PalBank[i - 0x180] & 0x03) << 4) | (DrvPromBg2Lookup[i - 0x180] & 0x0f)]; + } + + for (i = 0x280; i < 0x380; i++) { + DrvPalette[i] = Palette[((DrvPromSpritePalBank[i - 0x280] & 0x07) << 4) | (DrvPromSpriteLookup[i - 0x280] & 0x0f) | 0x80]; + } +} + +static void DrvRenderBg2Layer() +{ + INT32 mx, my, Offs, Attr, Code, Colour, x, y, TileIndex, xScroll, Flip, xFlip, yFlip; + + xFlip = 0; + yFlip = 0; + + xScroll = DrvBg2ScrollX[0] + (256 * DrvBg2ScrollX[1]); + + for (mx = 0; mx < 8; mx++) { + for (my = 0; my < 2048; my++) { + TileIndex = (my * 8) + mx; + + Offs = TileIndex * 2; + Attr = DrvBg2Tilemap[Offs + 1]; + Code = DrvBg2Tilemap[Offs] & 0x7f; + Colour = ((Attr & 0x3c) >> 2) + 0x18; + Flip = (Attr & 0xc0) >> 6; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + + y = 32 * mx; + x = 32 * my; + + x -= xScroll; + y -= 16; + + if (x < -31) x += 65536; + + if (x > 256) continue; + if (y > 240) continue; + + if (x > 0 && x < 224 && y > 0 && y < 192) { + if (xFlip) { + if (yFlip) { + Render32x32Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); + } else { + Render32x32Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); + } + } else { + if (yFlip) { + Render32x32Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); + } else { + Render32x32Tile(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render32x32Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); + } else { + Render32x32Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); + } + } else { + if (yFlip) { + Render32x32Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); + } else { + Render32x32Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBg2Tiles); + } + } + } + } + } +} + +static void DrvRenderBgLayer() +{ + INT32 mx, my, Offs, Attr, Code, Colour, x, y, TileIndex, xScroll, yScroll, Flip, xFlip, yFlip; + + xFlip = 0; + yFlip = 0; + + yScroll = (DrvBgScrollY + 16) & 0xff; + xScroll = DrvBgScrollX[0] + (256 * DrvBgScrollX[1]); + + for (mx = 0; mx < 8; mx++) { + for (my = 0; my < 2048; my++) { + TileIndex = (my * 8) + mx; + + Offs = TileIndex * 2; + Attr = DrvBgTilemap[Offs + 1]; + Code = DrvBgTilemap[Offs] + ((Attr & 0x01) << 8); + Colour = ((Attr & 0x3c) >> 2) + 0x08; + Flip = (Attr & 0xc0) >> 6; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + + y = 32 * mx; + x = 32 * my; + + x -= xScroll; + y -= yScroll; + + if (x < -31) x += 65536; + if (y < -31) y += 256; + + if (x > 256) continue; + if (y > 240) continue; + + if (x > 0 && x < 224 && y > 0 && y < 192) { + if (xFlip) { + if (yFlip) { + Render32x32Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); + } else { + Render32x32Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); + } + } else { + if (yFlip) { + Render32x32Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); + } else { + Render32x32Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render32x32Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); + } else { + Render32x32Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); + } + } else { + if (yFlip) { + Render32x32Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); + } else { + Render32x32Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvBgTiles); + } + } + } + } + } +} + +static void DrvRenderSprites(INT32 Priority) +{ + INT32 Offs; + + for (Offs = 0x1000 - 32; Offs >= 0; Offs -= 32) { + INT32 Attr = DrvSpriteRam[Offs + 1]; + INT32 Code = DrvSpriteRam[Offs + 0] + ((Attr & 0xe0) << 3); + INT32 Colour = Attr & 0x0f; + INT32 sx = DrvSpriteRam[Offs + 3] - ((Attr & 0x10) << 4); + INT32 sy = DrvSpriteRam[Offs + 2]; + + sy -= 16; + + if (Priority) { + if (Colour != 0x0a && Colour != 0x0b) { + if (sx > 0 && sx < 240 && sy > 0 && sy < 208) { + Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour + 0x28, 4, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour + 0x28, 4, 0, 0, DrvSprites); + } + } + } else { + if (Colour == 0x0a || Colour == 0x0b) { + if (sx > 0 && sx < 240 && sy > 0 && sy < 208) { + Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour + 0x28, 4, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour + 0x28, 4, 0, 0, DrvSprites); + } + } + + } + } +} + +static void DrvRenderCharLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Attr = DrvPaletteRam[TileIndex]; + Code = DrvVideoRam[TileIndex] + ((Attr & 0xe0) << 3); + Colour = Attr & 0x1f; + + x = 8 * mx; + y = 8 * my; + + y -= 16; + + if (x > 0 && x < 248 && y > 0 && y < 216) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 0, 0, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, DrvChars); + } + + TileIndex++; + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + if (DrvBg2On && nBurnLayer & 1) DrvRenderBg2Layer(); + if (DrvSpritesOn) DrvRenderSprites(0); + if (DrvBg1On && nBurnLayer & 2) DrvRenderBgLayer(); + if (DrvSpritesOn) DrvRenderSprites(1); + if (DrvCharsOn && nBurnLayer & 4) DrvRenderCharLayer(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 100; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 6000000 / 60; + nCyclesTotal[1] = 3000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 95) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == 96) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + // Run Z80 #2 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + if (i == 20 || i == 40 || i == 60 || i == 80) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == 21 || i == 41 || i == 61 || i == 81) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + } + + ZetOpen(1); + BurnTimerEndFrame(nCyclesTotal[1]); + ZetClose(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + ZetOpen(1); + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + } + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029672; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(DrvRomBank); + SCAN_VAR(DrvBg2ScrollX[0]); + SCAN_VAR(DrvBg2ScrollX[1]); + SCAN_VAR(DrvBgScrollX[0]); + SCAN_VAR(DrvBgScrollX[1]); + SCAN_VAR(DrvBgScrollY); + SCAN_VAR(DrvBg2On); + SCAN_VAR(DrvBg1On); + SCAN_VAR(DrvSpritesOn); + SCAN_VAR(DrvCharsOn); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x1000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + DrvRomBank * 0x1000 ); + ZetClose(); + } + + return 0; +} + +struct BurnDriver BurnDrvNineteen43 = { + "1943", NULL, NULL, NULL, "1987", + "1943: The Battle of Midway (Euro)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x380, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNineteen43u = { + "1943u", "1943", NULL, NULL, "1987", + "1943: The Battle of Midway (US)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvuRomInfo, DrvuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x380, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNineteen43j = { + "1943j", "1943", NULL, NULL, "1987", + "1943: Midway Kaisen (Japan, Rev B)\0", NULL, "Capcom", "Miscellaneous", + L"1943: \u30DF\u30C3\u30C9\u30A6\u30A7\u30A4\u6D77\u6226 (Japan, Rev B)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x380, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNineteen43ja = { + "1943ja", "1943", NULL, NULL, "1987", + "1943: Midway Kaisen (Japan)\0", NULL, "Capcom", "Miscellaneous", + L"1943: \u30DF\u30C3\u30C9\u30A6\u30A7\u30A4\u6D77\u6226 (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvjaRomInfo, DrvjaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x380, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNineteen43b = { + "1943b", "1943", NULL, NULL, "1987", + "1943: The Battle of Midway (bootleg set 1, hack of Japan set)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvbInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x380, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNineteen43b2 = { + "1943b2", "1943", NULL, NULL, "1987", + "1943: The Battle of Midway (bootleg set 2, hack of Japan set)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, Drvb2RomInfo, Drvb2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + Drvb2Init, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x380, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvNineteen43kai = { + "1943kai", NULL, NULL, NULL, "1987", + "1943 Kai: Midway Kaisen (Japan)\0", NULL, "Capcom", "Miscellaneous", + L"1943 \u6539: \u30DF\u30C3\u30C9\u30A6\u30A7\u30A4\u6D77\u6226 (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvkaiRomInfo, DrvkaiRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x380, 224, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_4enraya.cpp b/src/burn/drv/pre90s/d_4enraya.cpp index 7310e4ff2..6cdacac4b 100644 --- a/src/burn/drv/pre90s/d_4enraya.cpp +++ b/src/burn/drv/pre90s/d_4enraya.cpp @@ -335,7 +335,6 @@ static INT32 DrvInit(INT32 game, INT32 sbit) ZetSetOutHandler(enraya4_out_port); ZetSetInHandler(enraya4_in_port); ZetSetWriteHandler(enraya4_write); - ZetMemEnd(); ZetClose(); AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); diff --git a/src/burn/drv/pre90s/d_ambush.cpp b/src/burn/drv/pre90s/d_ambush.cpp index f34fdecac..adf180111 100644 --- a/src/burn/drv/pre90s/d_ambush.cpp +++ b/src/burn/drv/pre90s/d_ambush.cpp @@ -1,620 +1,619 @@ -// FB Alpha Ambush driver module -// Based on MAME driver by Zsolt Vasvari - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvColPROM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvColRAM; -static UINT8 *DrvScrRAM; -static INT16 *pAY8910Buffer[6]; -static UINT32 *DrvPalette; -static UINT32 *Palette; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvDips[1]; -static UINT8 DrvInputs[2]; -static UINT8 DrvReset; - -static UINT8 *color_bank; -static UINT8 *flipscreen; - -static struct BurnInputInfo AmbushInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 5, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 6, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 7, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 2, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Ambush) - -static struct BurnDIPInfo AmbushDIPList[]= -{ - {0x11, 0xff, 0xff, 0xc0, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x00, "3" }, - {0x11, 0x01, 0x03, 0x01, "4" }, - {0x11, 0x01, 0x03, 0x02, "5" }, - {0x11, 0x01, 0x03, 0x03, "6" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x11, 0x01, 0x1c, 0x14, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x1c, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x1c, 0x00, "1 Coins 1 Credit" }, - {0x11, 0x01, 0x1c, 0x04, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x1c, 0x18, "2 Coins 5 Credits" }, - {0x11, 0x01, 0x1c, 0x08, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x1c, 0x0c, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x1c, 0x1c, "Free Play / Service" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x11, 0x01, 0x20, 0x00, "Easy" }, - {0x11, 0x01, 0x20, 0x20, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x11, 0x01, 0x40, 0x40, "80000" }, - {0x11, 0x01, 0x40, 0x00, "120000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x80, 0x80, "Upright" }, - {0x11, 0x01, 0x80, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Ambush) - -UINT8 __fastcall ambush_read_byte(UINT16 address) -{ - switch (address) - { - case 0xc800: - return DrvDips[0]; - } - - return 0; -} - -void __fastcall ambush_write_byte(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xcc04: - *flipscreen = data; - break; - - case 0xcc05: - *color_bank = (data & 3) << 4; - break; - } -} - -UINT8 __fastcall ambush_in_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return AY8910Read(0); - - case 0x80: - return AY8910Read(1); - } - - return 0; -} - -void __fastcall ambush_out_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - AY8910Write(0, 0, data); - break; - - case 0x01: - AY8910Write(0, 1, data); - break; - - case 0x80: - AY8910Write(1, 0, data); - break; - - case 0x81: - AY8910Write(1, 1, data); - break; - } -} - -UINT8 AY8910_0_port0(UINT32) -{ - return DrvInputs[0]; -} - -UINT8 AY8910_1_port0(UINT32) -{ - return DrvInputs[1]; -} - -static INT32 DrvDoReset() -{ - memset(AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - AY8910Reset(1); - - return 0; -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0;i < 0x100; i++) - { - INT32 bit0,bit1,bit2,r,g,b; - - bit0 = (DrvColPROM[i] >> 0) & 0x01; - bit1 = (DrvColPROM[i] >> 1) & 0x01; - bit2 = (DrvColPROM[i] >> 2) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (DrvColPROM[i] >> 3) & 0x01; - bit1 = (DrvColPROM[i] >> 4) & 0x01; - bit2 = (DrvColPROM[i] >> 5) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit1 = (DrvColPROM[i] >> 6) & 0x01; - bit2 = (DrvColPROM[i] >> 7) & 0x01; - b = 0x47 * bit1 + 0x97 * bit2; - - Palette[i] = (r << 16) | (g << 8) | b; - } -} - -static void DrvGfxDecode() -{ - static INT32 Plane[2] = { 0, 0x10000 }; - static INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; - static INT32 YOffs[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; - - UINT8 *tmp = (UINT8 *)BurnMalloc(0x4000); - if (tmp == NULL) { - return; - } - - memcpy (tmp, DrvGfxROM0, 0x4000); - - GfxDecode(0x0400, 2, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); - - GfxDecode(0x0100, 2, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); - - BurnFree (tmp); -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x008000; - - DrvGfxROM0 = Next; Next += 0x010000; - DrvGfxROM1 = Next; Next += 0x010000; - - DrvColPROM = Next; Next += 0x000100; - - DrvPalette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); - Palette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x000800; - DrvVidRAM = Next; Next += 0x000400; - DrvSprRAM = Next; Next += 0x000200; - DrvColRAM = Next; Next += 0x000100; - DrvScrRAM = Next; Next += 0x000100; - - flipscreen = Next; Next += 0x000001; - color_bank = Next; Next += 0x000001; - - RamEnd = Next; - - pAY8910Buffer[0] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[3] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[4] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[5] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x4000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x6000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x0000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x2000, 5, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x0000, 6, 1)) return 1; - - DrvPaletteInit(); - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetMapArea(0xc000, 0xc0ff, 0, DrvScrRAM); - ZetMapArea(0xc000, 0xc0ff, 1, DrvScrRAM); - ZetMapArea(0xc000, 0xc0ff, 2, DrvScrRAM); - ZetMapArea(0xc100, 0xc1ff, 0, DrvColRAM); - ZetMapArea(0xc100, 0xc1ff, 1, DrvColRAM); - ZetMapArea(0xc100, 0xc1ff, 2, DrvColRAM); - ZetMapArea(0xc200, 0xc3ff, 0, DrvSprRAM); - ZetMapArea(0xc200, 0xc3ff, 1, DrvSprRAM); - ZetMapArea(0xc200, 0xc3ff, 2, DrvSprRAM); - ZetMapArea(0xc400, 0xc7ff, 0, DrvVidRAM); - ZetMapArea(0xc400, 0xc7ff, 1, DrvVidRAM); - ZetMapArea(0xc400, 0xc7ff, 2, DrvVidRAM); - ZetSetWriteHandler(ambush_write_byte); - ZetSetReadHandler(ambush_read_byte); - ZetSetOutHandler(ambush_out_port); - ZetSetInHandler(ambush_in_port); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 1500000, nBurnSoundRate, &AY8910_0_port0, NULL, NULL, NULL); - AY8910Init(1, 1500000, nBurnSoundRate, &AY8910_1_port0, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.33, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.33, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - AY8910Exit(0); - AY8910Exit(1); - - BurnFree (AllMem); - - return 0; -} - -static void draw_layer(INT32 priority) -{ - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - INT32 attr = DrvColRAM[(sy & 0xe0) | (sx >> 3)]; - if ((attr & 0x10) != priority) continue; - - INT32 code = DrvVidRAM[offs] | ((attr & 0x60) << 3); - INT32 color = (attr & 0x0f) | *color_bank; - - sy = (sy + (DrvScrRAM[sx >> 3] ^ 0xff)) & 0xff; - - INT32 flip = 0; - - if (*flipscreen) { - flip = 1; - sx = 248 - sx; - sy = (248 - sy) - 16; - } - - if (priority) { - if (flip) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); - } - } else { - if (flip) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 2, 0, DrvGfxROM0); - } - } - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0x200 - 4; offs >= 0; offs -= 4) - { - INT32 sy = DrvSprRAM[offs + 0]; - INT32 sx = DrvSprRAM[offs + 3]; - - if (sy == 0 || sy == 0xff || (sx < 0x40 && DrvSprRAM[offs + 2] & 0x10) || (sx >= 0xc0 && ~DrvSprRAM[offs + 2] & 0x10)) - continue; - - INT32 code = (DrvSprRAM[offs + 1] & 0x3f) | ((DrvSprRAM[offs + 2] & 0x60) << 1); - - INT32 color =(DrvSprRAM[offs + 2] & 0x0f) | *color_bank; - INT32 flipx = DrvSprRAM[offs + 1] & 0x40; - INT32 flipy = DrvSprRAM[offs + 1] & 0x80; - - if (*flipscreen) - { - flipx = !flipx; - flipy = !flipy; - sy -= 16; - } - - if (DrvSprRAM[offs + 2] & 0x80) - { - if (*flipscreen) { - sx = 240 - sx; - } else { - sy = 240 - sy; - } - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } - } - } else { - code <<= 2; - - if (*flipscreen) { - sx = 248 - sx; - } else { - sy = 248 - sy; - } - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); - } - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x100; i++) { - INT32 p = Palette[i]; - DrvPalette[i] = BurnHighCol(p >> 16, (p >> 8) & 0xff, p & 0xff, 0); - } - } - - BurnTransferClear(); - - draw_layer(0x00); - draw_sprites(); - draw_layer(0x10); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 2); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - ZetOpen(0); - ZetRun(4000000 / 60); - ZetRaiseIrq(0); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - AY8910Scan(nAction, pnMin); - } - - return 0; -} - - -// Ambush - -static struct BurnRomInfo ambushjRomDesc[] = { - { "ambush.h7", 0x2000, 0xce306563, BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ambush.g7", 0x2000, 0x90291409, BRF_ESS | BRF_PRG }, // 1 - { "ambush.f7", 0x2000, 0xd023ca29, BRF_ESS | BRF_PRG }, // 2 - { "ambush.e7", 0x2000, 0x6cc2d3ee, BRF_ESS | BRF_PRG }, // 3 - - { "ambush.n4", 0x2000, 0xecc0dc85, BRF_GRA }, // 4 Graphics tiles - { "ambush.m4", 0x2000, 0xe86ca98a, BRF_GRA }, // 5 - - { "a.bpr", 0x0100, 0x5f27f511, BRF_GRA }, // 6 color PROMs - - { "b.bpr", 0x0100, 0x1b03fd3b, BRF_OPT }, // 7 Proms - Not used - { "13.bpr", 0x0100, 0x547e970f, BRF_OPT }, // 8 - { "14.bpr", 0x0100, 0x622a8ce7, BRF_OPT }, // 9 -}; - -STD_ROM_PICK(ambushj) -STD_ROM_FN(ambushj) - -struct BurnDriver BurnDrvAmbushj = { - "ambushj", "ambush", NULL, NULL, "1983", - "Ambush (Japan)\0", NULL, "Nippon Amuse Co-Ltd", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, ambushjRomInfo, ambushjRomName, NULL, NULL, AmbushInputInfo, AmbushDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 256, 224, 4, 3 -}; - - -// Ambush (Tecfri) - -static struct BurnRomInfo ambushRomDesc[] = { - { "a1.i7", 0x2000, 0xa7cd149d, BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "a2.g7", 0x2000, 0x8328d88a, BRF_ESS | BRF_PRG }, // 1 - { "a3.f7", 0x2000, 0x8db57ab5, BRF_ESS | BRF_PRG }, // 2 - { "a4.e7", 0x2000, 0x4a34d2a4, BRF_ESS | BRF_PRG }, // 3 - - { "fa2.n4", 0x2000, 0xe7f134ba, BRF_GRA }, // 4 Graphics tiles - { "fa1.m4", 0x2000, 0xad10969e, BRF_GRA }, // 5 - - { "a.bpr", 0x0100, 0x5f27f511, BRF_GRA }, // 6 color PROMs - - { "b.bpr", 0x0100, 0x1b03fd3b, BRF_OPT }, // 7 Proms - Not used - { "13.bpr", 0x0100, 0x547e970f, BRF_OPT }, // 8 - { "14.bpr", 0x0100, 0x622a8ce7, BRF_OPT }, // 9 -}; - -STD_ROM_PICK(ambush) -STD_ROM_FN(ambush) - -struct BurnDriver BurnDrvAmbush = { - "ambush", NULL, NULL, NULL, "1983", - "Ambush\0", NULL, "Tecfri", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, ambushRomInfo, ambushRomName, NULL, NULL, AmbushInputInfo, AmbushDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 256, 224, 4, 3 -}; - - -// Ambush (Volt Elec co-ltd) - -static struct BurnRomInfo ambushvRomDesc[] = { - { "n1_h7.bin", 0x2000, 0x3c0833b4, BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ambush.g7", 0x2000, 0x90291409, BRF_ESS | BRF_PRG }, // 1 - { "ambush.f7", 0x2000, 0xd023ca29, BRF_ESS | BRF_PRG }, // 2 - { "ambush.e7", 0x2000, 0x6cc2d3ee, BRF_ESS | BRF_PRG }, // 3 - - { "ambush.n4", 0x2000, 0xecc0dc85, BRF_GRA }, // 4 Graphics tiles - { "ambush.m4", 0x2000, 0xe86ca98a, BRF_GRA }, // 5 - - { "a.bpr", 0x0100, 0x5f27f511, BRF_GRA }, // 6 color PROMs - - { "b.bpr", 0x0100, 0x1b03fd3b, BRF_OPT }, // 7 Proms - Not used - { "13.bpr", 0x0100, 0x547e970f, BRF_OPT }, // 8 - { "14.bpr", 0x0100, 0x622a8ce7, BRF_OPT }, // 9 -}; - -STD_ROM_PICK(ambushv) -STD_ROM_FN(ambushv) - -struct BurnDriver BurnDrvAmbushv = { - "ambushv", "ambush", NULL, NULL, "1983", - "Ambush (Volt Elec co-ltd)\0", NULL, "Volt Elec co-ltd", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, ambushvRomInfo, ambushvRomName, NULL, NULL, AmbushInputInfo, AmbushDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 256, 224, 4, 3 -}; - - +// FB Alpha Ambush driver module +// Based on MAME driver by Zsolt Vasvari + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvColPROM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvColRAM; +static UINT8 *DrvScrRAM; +static INT16 *pAY8910Buffer[6]; +static UINT32 *DrvPalette; +static UINT32 *Palette; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvDips[1]; +static UINT8 DrvInputs[2]; +static UINT8 DrvReset; + +static UINT8 *color_bank; +static UINT8 *flipscreen; + +static struct BurnInputInfo AmbushInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 5, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 6, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 7, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 2, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Ambush) + +static struct BurnDIPInfo AmbushDIPList[]= +{ + {0x11, 0xff, 0xff, 0xc0, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x00, "3" }, + {0x11, 0x01, 0x03, 0x01, "4" }, + {0x11, 0x01, 0x03, 0x02, "5" }, + {0x11, 0x01, 0x03, 0x03, "6" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x11, 0x01, 0x1c, 0x14, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x1c, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x1c, 0x00, "1 Coins 1 Credit" }, + {0x11, 0x01, 0x1c, 0x04, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x1c, 0x18, "2 Coins 5 Credits" }, + {0x11, 0x01, 0x1c, 0x08, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x1c, 0x0c, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x1c, 0x1c, "Free Play / Service" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x11, 0x01, 0x20, 0x00, "Easy" }, + {0x11, 0x01, 0x20, 0x20, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x11, 0x01, 0x40, 0x40, "80000" }, + {0x11, 0x01, 0x40, 0x00, "120000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x80, 0x80, "Upright" }, + {0x11, 0x01, 0x80, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Ambush) + +UINT8 __fastcall ambush_read_byte(UINT16 address) +{ + switch (address) + { + case 0xc800: + return DrvDips[0]; + } + + return 0; +} + +void __fastcall ambush_write_byte(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xcc04: + *flipscreen = data; + break; + + case 0xcc05: + *color_bank = (data & 3) << 4; + break; + } +} + +UINT8 __fastcall ambush_in_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return AY8910Read(0); + + case 0x80: + return AY8910Read(1); + } + + return 0; +} + +void __fastcall ambush_out_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + AY8910Write(0, 0, data); + break; + + case 0x01: + AY8910Write(0, 1, data); + break; + + case 0x80: + AY8910Write(1, 0, data); + break; + + case 0x81: + AY8910Write(1, 1, data); + break; + } +} + +UINT8 AY8910_0_port0(UINT32) +{ + return DrvInputs[0]; +} + +UINT8 AY8910_1_port0(UINT32) +{ + return DrvInputs[1]; +} + +static INT32 DrvDoReset() +{ + memset(AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + AY8910Reset(1); + + return 0; +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0;i < 0x100; i++) + { + INT32 bit0,bit1,bit2,r,g,b; + + bit0 = (DrvColPROM[i] >> 0) & 0x01; + bit1 = (DrvColPROM[i] >> 1) & 0x01; + bit2 = (DrvColPROM[i] >> 2) & 0x01; + r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (DrvColPROM[i] >> 3) & 0x01; + bit1 = (DrvColPROM[i] >> 4) & 0x01; + bit2 = (DrvColPROM[i] >> 5) & 0x01; + g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit1 = (DrvColPROM[i] >> 6) & 0x01; + bit2 = (DrvColPROM[i] >> 7) & 0x01; + b = 0x47 * bit1 + 0x97 * bit2; + + Palette[i] = (r << 16) | (g << 8) | b; + } +} + +static void DrvGfxDecode() +{ + static INT32 Plane[2] = { 0, 0x10000 }; + static INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; + static INT32 YOffs[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; + + UINT8 *tmp = (UINT8 *)BurnMalloc(0x4000); + if (tmp == NULL) { + return; + } + + memcpy (tmp, DrvGfxROM0, 0x4000); + + GfxDecode(0x0400, 2, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); + + GfxDecode(0x0100, 2, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); + + BurnFree (tmp); +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x008000; + + DrvGfxROM0 = Next; Next += 0x010000; + DrvGfxROM1 = Next; Next += 0x010000; + + DrvColPROM = Next; Next += 0x000100; + + DrvPalette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); + Palette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x000800; + DrvVidRAM = Next; Next += 0x000400; + DrvSprRAM = Next; Next += 0x000200; + DrvColRAM = Next; Next += 0x000100; + DrvScrRAM = Next; Next += 0x000100; + + flipscreen = Next; Next += 0x000001; + color_bank = Next; Next += 0x000001; + + RamEnd = Next; + + pAY8910Buffer[0] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[3] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[4] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[5] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x4000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x6000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x0000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x2000, 5, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x0000, 6, 1)) return 1; + + DrvPaletteInit(); + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetMapArea(0xc000, 0xc0ff, 0, DrvScrRAM); + ZetMapArea(0xc000, 0xc0ff, 1, DrvScrRAM); + ZetMapArea(0xc000, 0xc0ff, 2, DrvScrRAM); + ZetMapArea(0xc100, 0xc1ff, 0, DrvColRAM); + ZetMapArea(0xc100, 0xc1ff, 1, DrvColRAM); + ZetMapArea(0xc100, 0xc1ff, 2, DrvColRAM); + ZetMapArea(0xc200, 0xc3ff, 0, DrvSprRAM); + ZetMapArea(0xc200, 0xc3ff, 1, DrvSprRAM); + ZetMapArea(0xc200, 0xc3ff, 2, DrvSprRAM); + ZetMapArea(0xc400, 0xc7ff, 0, DrvVidRAM); + ZetMapArea(0xc400, 0xc7ff, 1, DrvVidRAM); + ZetMapArea(0xc400, 0xc7ff, 2, DrvVidRAM); + ZetSetWriteHandler(ambush_write_byte); + ZetSetReadHandler(ambush_read_byte); + ZetSetOutHandler(ambush_out_port); + ZetSetInHandler(ambush_in_port); + ZetClose(); + + AY8910Init(0, 1500000, nBurnSoundRate, &AY8910_0_port0, NULL, NULL, NULL); + AY8910Init(1, 1500000, nBurnSoundRate, &AY8910_1_port0, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.33, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.33, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + AY8910Exit(0); + AY8910Exit(1); + + BurnFree (AllMem); + + return 0; +} + +static void draw_layer(INT32 priority) +{ + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + INT32 attr = DrvColRAM[(sy & 0xe0) | (sx >> 3)]; + if ((attr & 0x10) != priority) continue; + + INT32 code = DrvVidRAM[offs] | ((attr & 0x60) << 3); + INT32 color = (attr & 0x0f) | *color_bank; + + sy = (sy + (DrvScrRAM[sx >> 3] ^ 0xff)) & 0xff; + + INT32 flip = 0; + + if (*flipscreen) { + flip = 1; + sx = 248 - sx; + sy = (248 - sy) - 16; + } + + if (priority) { + if (flip) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); + } + } else { + if (flip) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 2, 0, DrvGfxROM0); + } + } + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0x200 - 4; offs >= 0; offs -= 4) + { + INT32 sy = DrvSprRAM[offs + 0]; + INT32 sx = DrvSprRAM[offs + 3]; + + if (sy == 0 || sy == 0xff || (sx < 0x40 && DrvSprRAM[offs + 2] & 0x10) || (sx >= 0xc0 && ~DrvSprRAM[offs + 2] & 0x10)) + continue; + + INT32 code = (DrvSprRAM[offs + 1] & 0x3f) | ((DrvSprRAM[offs + 2] & 0x60) << 1); + + INT32 color =(DrvSprRAM[offs + 2] & 0x0f) | *color_bank; + INT32 flipx = DrvSprRAM[offs + 1] & 0x40; + INT32 flipy = DrvSprRAM[offs + 1] & 0x80; + + if (*flipscreen) + { + flipx = !flipx; + flipy = !flipy; + sy -= 16; + } + + if (DrvSprRAM[offs + 2] & 0x80) + { + if (*flipscreen) { + sx = 240 - sx; + } else { + sy = 240 - sy; + } + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } + } + } else { + code <<= 2; + + if (*flipscreen) { + sx = 248 - sx; + } else { + sy = 248 - sy; + } + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM0); + } + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x100; i++) { + INT32 p = Palette[i]; + DrvPalette[i] = BurnHighCol(p >> 16, (p >> 8) & 0xff, p & 0xff, 0); + } + } + + BurnTransferClear(); + + draw_layer(0x00); + draw_sprites(); + draw_layer(0x10); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 2); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + ZetOpen(0); + ZetRun(4000000 / 60); + ZetRaiseIrq(0); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + AY8910Scan(nAction, pnMin); + } + + return 0; +} + + +// Ambush + +static struct BurnRomInfo ambushjRomDesc[] = { + { "ambush.h7", 0x2000, 0xce306563, BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ambush.g7", 0x2000, 0x90291409, BRF_ESS | BRF_PRG }, // 1 + { "ambush.f7", 0x2000, 0xd023ca29, BRF_ESS | BRF_PRG }, // 2 + { "ambush.e7", 0x2000, 0x6cc2d3ee, BRF_ESS | BRF_PRG }, // 3 + + { "ambush.n4", 0x2000, 0xecc0dc85, BRF_GRA }, // 4 Graphics tiles + { "ambush.m4", 0x2000, 0xe86ca98a, BRF_GRA }, // 5 + + { "a.bpr", 0x0100, 0x5f27f511, BRF_GRA }, // 6 color PROMs + + { "b.bpr", 0x0100, 0x1b03fd3b, BRF_OPT }, // 7 Proms - Not used + { "13.bpr", 0x0100, 0x547e970f, BRF_OPT }, // 8 + { "14.bpr", 0x0100, 0x622a8ce7, BRF_OPT }, // 9 +}; + +STD_ROM_PICK(ambushj) +STD_ROM_FN(ambushj) + +struct BurnDriver BurnDrvAmbushj = { + "ambushj", "ambush", NULL, NULL, "1983", + "Ambush (Japan)\0", NULL, "Nippon Amuse Co-Ltd", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, ambushjRomInfo, ambushjRomName, NULL, NULL, AmbushInputInfo, AmbushDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 256, 224, 4, 3 +}; + + +// Ambush (Tecfri) + +static struct BurnRomInfo ambushRomDesc[] = { + { "a1.i7", 0x2000, 0xa7cd149d, BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "a2.g7", 0x2000, 0x8328d88a, BRF_ESS | BRF_PRG }, // 1 + { "a3.f7", 0x2000, 0x8db57ab5, BRF_ESS | BRF_PRG }, // 2 + { "a4.e7", 0x2000, 0x4a34d2a4, BRF_ESS | BRF_PRG }, // 3 + + { "fa2.n4", 0x2000, 0xe7f134ba, BRF_GRA }, // 4 Graphics tiles + { "fa1.m4", 0x2000, 0xad10969e, BRF_GRA }, // 5 + + { "a.bpr", 0x0100, 0x5f27f511, BRF_GRA }, // 6 color PROMs + + { "b.bpr", 0x0100, 0x1b03fd3b, BRF_OPT }, // 7 Proms - Not used + { "13.bpr", 0x0100, 0x547e970f, BRF_OPT }, // 8 + { "14.bpr", 0x0100, 0x622a8ce7, BRF_OPT }, // 9 +}; + +STD_ROM_PICK(ambush) +STD_ROM_FN(ambush) + +struct BurnDriver BurnDrvAmbush = { + "ambush", NULL, NULL, NULL, "1983", + "Ambush\0", NULL, "Tecfri", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, ambushRomInfo, ambushRomName, NULL, NULL, AmbushInputInfo, AmbushDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 256, 224, 4, 3 +}; + + +// Ambush (Volt Elec co-ltd) + +static struct BurnRomInfo ambushvRomDesc[] = { + { "n1_h7.bin", 0x2000, 0x3c0833b4, BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ambush.g7", 0x2000, 0x90291409, BRF_ESS | BRF_PRG }, // 1 + { "ambush.f7", 0x2000, 0xd023ca29, BRF_ESS | BRF_PRG }, // 2 + { "ambush.e7", 0x2000, 0x6cc2d3ee, BRF_ESS | BRF_PRG }, // 3 + + { "ambush.n4", 0x2000, 0xecc0dc85, BRF_GRA }, // 4 Graphics tiles + { "ambush.m4", 0x2000, 0xe86ca98a, BRF_GRA }, // 5 + + { "a.bpr", 0x0100, 0x5f27f511, BRF_GRA }, // 6 color PROMs + + { "b.bpr", 0x0100, 0x1b03fd3b, BRF_OPT }, // 7 Proms - Not used + { "13.bpr", 0x0100, 0x547e970f, BRF_OPT }, // 8 + { "14.bpr", 0x0100, 0x622a8ce7, BRF_OPT }, // 9 +}; + +STD_ROM_PICK(ambushv) +STD_ROM_FN(ambushv) + +struct BurnDriver BurnDrvAmbushv = { + "ambushv", "ambush", NULL, NULL, "1983", + "Ambush (Volt Elec co-ltd)\0", NULL, "Volt Elec co-ltd", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, ambushvRomInfo, ambushvRomName, NULL, NULL, AmbushInputInfo, AmbushDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 256, 224, 4, 3 +}; + + diff --git a/src/burn/drv/pre90s/d_arabian.cpp b/src/burn/drv/pre90s/d_arabian.cpp index 340836c19..a079d82d1 100644 --- a/src/burn/drv/pre90s/d_arabian.cpp +++ b/src/burn/drv/pre90s/d_arabian.cpp @@ -1,695 +1,694 @@ -// FB Alpha Arabian driver module -// Based on MAME driver by Jarek Burczynski and various others - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvBlitRAM; -static UINT8 *DrvTempBmp; -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static INT16 *pAY8910Buffer[3]; - -static UINT8 *arabian_color; -static UINT8 *flipscreen; - -static INT32 custom_cpu_reset; -static INT32 custom_cpu_busy; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvJoy6[8]; -static UINT8 DrvJoy7[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[8]; -static UINT8 DrvReset; - -static struct BurnInputInfo ArabianInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 1, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy4 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy4 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy4 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy4 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy5 + 0, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 2, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy6 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy6 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy6 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy6 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy7 + 0, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 3, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Arabian) - -static struct BurnDIPInfo ArabianDIPList[]= -{ - {0x10, 0xff, 0xff, 0x06, NULL }, - {0x11, 0xff, 0xff, 0x0d, NULL }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x10, 0x01, 0x01, 0x00, "3" }, - {0x10, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x10, 0x01, 0x02, 0x02, "Upright" }, - {0x10, 0x01, 0x02, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x10, 0x01, 0x04, 0x04, "Off" }, - {0x10, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x10, 0x01, 0x08, 0x00, "Easy" }, - {0x10, 0x01, 0x08, 0x08, "Hard" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x10, 0x01, 0xf0, 0x10, "A 2/1 B 2/1" }, - {0x10, 0x01, 0xf0, 0x20, "A 2/1 B 1/3" }, - {0x10, 0x01, 0xf0, 0x00, "A 1/1 B 1/1" }, - {0x10, 0x01, 0xf0, 0x30, "A 1/1 B 1/2" }, - {0x10, 0x01, 0xf0, 0x40, "A 1/1 B 1/3" }, - {0x10, 0x01, 0xf0, 0x50, "A 1/1 B 1/4" }, - {0x10, 0x01, 0xf0, 0x60, "A 1/1 B 1/5" }, - {0x10, 0x01, 0xf0, 0x70, "A 1/1 B 1/6" }, - {0x10, 0x01, 0xf0, 0x80, "A 1/2 B 1/2" }, - {0x10, 0x01, 0xf0, 0x90, "A 1/2 B 1/4" }, - {0x10, 0x01, 0xf0, 0xa0, "A 1/2 B 1/5" }, - {0x10, 0x01, 0xf0, 0xe0, "A 1/2 B 1/6" }, - {0x10, 0x01, 0xf0, 0xb0, "A 1/2 B 1/10" }, - {0x10, 0x01, 0xf0, 0xc0, "A 1/2 B 1/11" }, - {0x10, 0x01, 0xf0, 0xd0, "A 1/2 B 1/12" }, - {0x10, 0x01, 0xf0, 0xf0, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Coin Counters" }, - {0x11, 0x01, 0x01, 0x01, "1" }, - {0x11, 0x01, 0x01, 0x00, "2" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x11, 0x01, 0x0c, 0x0c, "30k 70k 40k+" }, - {0x11, 0x01, 0x0c, 0x04, "20k only" }, - {0x11, 0x01, 0x0c, 0x08, "40k only" }, - {0x11, 0x01, 0x0c, 0x00, "None" }, -}; - -STDDIPINFO(Arabian) - -static struct BurnDIPInfo ArabianaDIPList[]= -{ - {0x10, 0xff, 0xff, 0x06, NULL }, - {0x11, 0xff, 0xff, 0x0d, NULL }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x10, 0x01, 0x01, 0x00, "3" }, - {0x10, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x10, 0x01, 0x02, 0x02, "Upright" }, - {0x10, 0x01, 0x02, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x10, 0x01, 0x04, 0x04, "Off" }, - {0x10, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x10, 0x01, 0x08, 0x00, "Easy" }, - {0x10, 0x01, 0x08, 0x08, "Hard" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x10, 0x01, 0xf0, 0x10, "A 2/1 B 2/1" }, - {0x10, 0x01, 0xf0, 0x20, "A 2/1 B 1/3" }, - {0x10, 0x01, 0xf0, 0x00, "A 1/1 B 1/1" }, - {0x10, 0x01, 0xf0, 0x30, "A 1/1 B 1/2" }, - {0x10, 0x01, 0xf0, 0x40, "A 1/1 B 1/3" }, - {0x10, 0x01, 0xf0, 0x50, "A 1/1 B 1/4" }, - {0x10, 0x01, 0xf0, 0x60, "A 1/1 B 1/5" }, - {0x10, 0x01, 0xf0, 0x70, "A 1/1 B 1/6" }, - {0x10, 0x01, 0xf0, 0x80, "A 1/2 B 1/2" }, - {0x10, 0x01, 0xf0, 0x90, "A 1/2 B 1/4" }, - {0x10, 0x01, 0xf0, 0xa0, "A 1/2 B 1/5" }, - {0x10, 0x01, 0xf0, 0xe0, "A 1/2 B 1/6" }, - {0x10, 0x01, 0xf0, 0xb0, "A 1/2 B 1/10" }, - {0x10, 0x01, 0xf0, 0xc0, "A 1/2 B 1/11" }, - {0x10, 0x01, 0xf0, 0xd0, "A 1/2 B 1/12" }, - {0x10, 0x01, 0xf0, 0xf0, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Coin Counters" }, - {0x11, 0x01, 0x01, 0x01, "1" }, - {0x11, 0x01, 0x01, 0x00, "2" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x11, 0x01, 0x0c, 0x0c, "20k 50k 150k 100k+" }, - {0x11, 0x01, 0x0c, 0x04, "20k only" }, - {0x11, 0x01, 0x0c, 0x08, "40k only" }, - {0x11, 0x01, 0x0c, 0x00, "None" }, -}; - -STDDIPINFO(Arabiana) - -static UINT8 custom_cpu_r(UINT16 offset) -{ - if (custom_cpu_reset || offset < 0x7f0) - return DrvZ80RAM[offset]; - - switch (offset & 0x0f) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - return DrvInputs[(offset & 0x0f)+2]; - - case 6: - return custom_cpu_busy ^= 1; - - case 8: - return DrvZ80RAM[offset - 1]; - - default: - return 0; - } - return 0; -} - -static void blit_area(UINT8 plane, UINT16 src, UINT8 x, UINT8 y, UINT8 sx, UINT8 sy) -{ - UINT8 *srcdata = DrvGfxROM + src * 4; - - for (INT32 i = 0; i <= sx; i++, x += 4) - { - for (INT32 j = 0; j <= sy; j++) - { - UINT8 p1 = *srcdata++; - UINT8 p2 = *srcdata++; - UINT8 p3 = *srcdata++; - UINT8 p4 = *srcdata++; - UINT8 *base = DrvTempBmp + (((y + j) & 0xff) * 256 + (x & 0xff)); - - if (plane & 0x01) - { - if (p4 != 8) base[0] = (base[0] & ~0xf0) | (p4 << 4); - if (p3 != 8) base[1] = (base[1] & ~0xf0) | (p3 << 4); - if (p2 != 8) base[2] = (base[2] & ~0xf0) | (p2 << 4); - if (p1 != 8) base[3] = (base[3] & ~0xf0) | (p1 << 4); - } - - if (plane & 0x04) - { - if (p4 != 8) base[0] = (base[0] & ~0x0f) | p4; - if (p3 != 8) base[1] = (base[1] & ~0x0f) | p3; - if (p2 != 8) base[2] = (base[2] & ~0x0f) | p2; - if (p1 != 8) base[3] = (base[3] & ~0x0f) | p1; - } - } - } -} - -static void arabian_blitter_w(INT32 offset, UINT8 data) -{ - DrvBlitRAM[offset] = data; - - if (offset == 0x0006) - { - INT32 plane = DrvBlitRAM[offset - 6]; - INT32 src = DrvBlitRAM[offset - 5] | (DrvBlitRAM[offset - 4] << 8); - INT32 x = DrvBlitRAM[offset - 2] << 2; - INT32 y = DrvBlitRAM[offset - 3]; - INT32 sx = DrvBlitRAM[offset - 0]; - INT32 sy = DrvBlitRAM[offset - 1]; - - blit_area(plane, src, x, y, sx, sy); - } -} - -void __fastcall arabian_videoram_w(UINT16 offset, UINT8 data) -{ - UINT8 *base; - UINT8 x, y; - - x = (offset >> 8) << 2; - y = offset & 0xff; - - DrvVidRAM[offset & 0x3fff] = data; - - base = &DrvTempBmp[y * 256 + x]; - - if (DrvBlitRAM[0] & 0x08) - { - base[0] = (base[0] & ~0x03) | ((data & 0x10) >> 3) | ((data & 0x01) >> 0); - base[1] = (base[1] & ~0x03) | ((data & 0x20) >> 4) | ((data & 0x02) >> 1); - base[2] = (base[2] & ~0x03) | ((data & 0x40) >> 5) | ((data & 0x04) >> 2); - base[3] = (base[3] & ~0x03) | ((data & 0x80) >> 6) | ((data & 0x08) >> 3); - } - - if (DrvBlitRAM[0] & 0x04) - { - base[0] = (base[0] & ~0x0c) | ((data & 0x10) >> 1) | ((data & 0x01) << 2); - base[1] = (base[1] & ~0x0c) | ((data & 0x20) >> 2) | ((data & 0x02) << 1); - base[2] = (base[2] & ~0x0c) | ((data & 0x40) >> 3) | ((data & 0x04) << 0); - base[3] = (base[3] & ~0x0c) | ((data & 0x80) >> 4) | ((data & 0x08) >> 1); - } - - if (DrvBlitRAM[0] & 0x02) - { - base[0] = (base[0] & ~0x30) | ((data & 0x10) << 1) | ((data & 0x01) << 4); - base[1] = (base[1] & ~0x30) | ((data & 0x20) << 0) | ((data & 0x02) << 3); - base[2] = (base[2] & ~0x30) | ((data & 0x40) >> 1) | ((data & 0x04) << 2); - base[3] = (base[3] & ~0x30) | ((data & 0x80) >> 2) | ((data & 0x08) << 1); - } - - if (DrvBlitRAM[0] & 0x01) - { - base[0] = (base[0] & ~0xc0) | ((data & 0x10) << 3) | ((data & 0x01) << 6); - base[1] = (base[1] & ~0xc0) | ((data & 0x20) << 2) | ((data & 0x02) << 5); - base[2] = (base[2] & ~0xc0) | ((data & 0x40) << 1) | ((data & 0x04) << 4); - base[3] = (base[3] & ~0xc0) | ((data & 0x80) << 0) | ((data & 0x08) << 3); - } -} - -void __fastcall arabian_write(UINT16 address, UINT8 data) -{ - if ((address & 0xc000) == 0x8000) { - arabian_videoram_w(address & 0x3fff, data); - return; - } - - if ((address & 0xf000) == 0xe000) { - arabian_blitter_w(address & 0x0007, data); - return; - } -} - -UINT8 __fastcall arabian_read(UINT16 address) -{ - if ((address & 0xfe00) == 0xc000) { - return DrvInputs[0]; - } - - if ((address & 0xfe00) == 0xc200) { - return DrvDips[0]; - } - - if ((address & 0xff00) == 0xd700) { - return custom_cpu_r(address & 0x7ff); - } - - return 0; -} - -void __fastcall arabian_out(UINT16 port, UINT8 data) -{ - switch (port) - { - case 0xc800: - AY8910Write(0, 0, data); - break; - - case 0xca00: - AY8910Write(0, 1, data); - break; - } -} - -void ay8910_porta_w(UINT32, UINT32 data) -{ - *arabian_color = data >> 3; -} - -void ay8910_portb_w(UINT32, UINT32 data) -{ - custom_cpu_reset = ~data & 0x10; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - - custom_cpu_reset = 0; - custom_cpu_busy = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x008000; - - DrvGfxROM = Next; Next += 0x010000; - - Palette = (UINT32*)Next; Next += 0x2000 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x2000 * sizeof(UINT32); - - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x000800; - DrvVidRAM = Next; Next += 0x004000; - DrvBlitRAM = Next; Next += 0x001000; - - DrvTempBmp = Next; Next += 256 * 256; - - flipscreen = Next; Next += 0x000001; - arabian_color = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static void DrvPaletteInit() -{ - UINT32 tpal[0x40]; - - for (INT32 i = 0; i < 64; i++) - { - INT32 r, b, g; - r = ((i >> 5) & 1) * (153*192/255) + ((i >> 4) & 1) * (102*192/255) + ((i & 0x30) ? 63 : 0); - g = ((i >> 3) & 1) * (156*192/255) + ((i >> 2) & 1) * (99*192/255) + ((i & 0x0c) ? 63 : 0); - b = ((i >> 1) & 1) * 192 + ((i >> 0) & 1) * 63; - tpal[i] = (r << 16) | (g << 8) | b; - } - - for (INT32 i = 0; i < (1 << 13); i++) - { - INT32 ena = (i >> 12) & 1; - INT32 enb = (i >> 11) & 1; - INT32 abhf = (~i >> 10) & 1; - INT32 aghf = (~i >> 9) & 1; - INT32 arhf = (~i >> 8) & 1; - INT32 az = (i >> 7) & 1; - INT32 ar = (i >> 6) & 1; - INT32 ag = (i >> 5) & 1; - INT32 ab = (i >> 4) & 1; - INT32 bz = (i >> 3) & 1; - INT32 br = (i >> 2) & 1; - INT32 bg = (i >> 1) & 1; - INT32 bb = (i >> 0) & 1; - - INT32 planea = (az | ar | ag | ab) & ena; - - INT32 rhi = planea ? ar : enb ? bz : 0; - INT32 rlo = planea ? ((!arhf & az) ? 0 : ar) : enb ? br : 0; - - INT32 ghi = planea ? ag : enb ? bb : 0; - INT32 glo = planea ? ((!aghf & az) ? 0 : ag) : enb ? bg : 0; - - INT32 bhi = ab; - INT32 bbase = (!abhf & az) ? 0 : ab; - - INT32 t = (rhi << 5) | (rlo << 4) | (ghi << 3) | (glo << 2) | (bhi << 1) | bbase; - - Palette[i] = tpal[t]; - } -} - -static void DrvGfxDecode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); - - for (INT32 offs = 0; offs < 0x4000 * 4; offs+=4) - { - INT32 v1 = DrvGfxROM[(offs / 4) + 0x0000]; - INT32 v2 = DrvGfxROM[(offs / 4) + 0x4000]; - - for (INT32 j = 0; j < 4; j++, v1>>=1, v2>>=1) { - tmp[offs + 3 - j] = (v1 & 1) | ((v1 >> 3) & 2) | ((v2 << 2) & 4) | ((v2 >> 1) & 8); - } - } - - memcpy (DrvGfxROM, tmp, 0x10000); - BurnFree (tmp); -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x4000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x6000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x0000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x2000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x4000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x6000, 7, 1)) return 1; - - DrvPaletteInit(); - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xd000, 0xd6ff, 0, DrvZ80RAM); - ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80RAM); - ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(arabian_write); - ZetSetReadHandler(arabian_read); - ZetSetOutHandler(arabian_out); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, ay8910_porta_w, ay8910_portb_w); - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - AY8910Exit(0); - - BurnFree (AllMem); - - return 0; -} - -static inline void update_flip_state() -{ - *flipscreen = DrvZ80RAM[0x034b]; - - if (DrvZ80RAM[0x0400] != 0 && !(DrvZ80RAM[0x0401] & 0x02)) - *flipscreen = !*flipscreen; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x2000; i++) { - INT32 d = Palette[i]; - DrvPalette[i] = BurnHighCol(d >> 16, (d >> 8) & 0xff, d & 0xff, 0); - } - } - - update_flip_state(); - - UINT16 *pDst = pTransDraw; - UINT8 *pSrc = DrvTempBmp + (11 * 256); - - if (*flipscreen) { - pDst += nScreenWidth * (nScreenHeight - 1); - for (INT32 y = 11; y < 256-11; y++) { - for (INT32 x = 0; x < 256; x++) { - pDst[x] = pSrc[x ^ 0xff]; - } - pDst -= nScreenWidth; - pSrc += 256; - } - } else { - for (INT32 y = 11; y < 256-11; y++) { - for (INT32 x = 0; x < 256; x++) { - pDst[x] = pSrc[x]; - } - pDst += nScreenWidth; - pSrc += 256; - } - } - - BurnTransferCopy(DrvPalette + (*arabian_color << 8)); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0, 8); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - DrvInputs[5] ^= (DrvJoy6[i] & 1) << i; - DrvInputs[6] ^= (DrvJoy7[i] & 1) << i; - } - DrvInputs[1] = DrvDips[0]; - DrvInputs[2] |= 1; - DrvInputs[7] = DrvDips[1]; - } - - ZetOpen(0); - ZetRun(3000000 / 60); - ZetRaiseIrq(0); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - AY8910Scan(nAction, pnMin); - - SCAN_VAR(custom_cpu_reset); - SCAN_VAR(custom_cpu_busy); - } - - return 0; -} - - -// Arabian - -static struct BurnRomInfo arabianRomDesc[] = { - { "ic1rev2.87", 0x2000, 0x5e1c98b8, BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ic2rev2.88", 0x2000, 0x092f587e, BRF_ESS | BRF_PRG }, // 1 - { "ic3rev2.89", 0x2000, 0x15145f23, BRF_ESS | BRF_PRG }, // 2 - { "ic4rev2.90", 0x2000, 0x32b77b44, BRF_ESS | BRF_PRG }, // 3 - - { "tvg-91.ic84",0x2000, 0xc4637822, BRF_GRA }, // 4 Graphics - { "tvg-92.ic85",0x2000, 0xf7c6866d, BRF_GRA }, // 5 - { "tvg-93.ic86",0x2000, 0x71acd48d, BRF_GRA }, // 6 - { "tvg-94.ic87",0x2000, 0x82160b9a, BRF_GRA }, // 7 - - { "sun-8212.ic3",0x0800, 0x8869611e, BRF_OPT }, // 8 MCU -}; - -STD_ROM_PICK(arabian) -STD_ROM_FN(arabian) - -struct BurnDriver BurnDrvarabian = { - "arabian", NULL, NULL, NULL, "1983", - "Arabian\0", NULL, "Sun Electronics", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, arabianRomInfo, arabianRomName, NULL, NULL, ArabianInputInfo, ArabianDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, - 234, 256, 3, 4 -}; - -// Arabian (Atari) - -static struct BurnRomInfo arabianaRomDesc[] = { - { "tvg-87.ic1", 0x2000, 0x51e9a6b1, BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "tvg-88.ic2", 0x2000, 0x1cdcc1ab, BRF_ESS | BRF_PRG }, // 1 - { "tvg-89.ic3", 0x2000, 0xb7b7faa0, BRF_ESS | BRF_PRG }, // 2 - { "tvg-90.ic4", 0x2000, 0xdbded961, BRF_ESS | BRF_PRG }, // 3 - - { "tvg-91.ic84",0x2000, 0xc4637822, BRF_GRA }, // 4 Graphics - { "tvg-92.ic85",0x2000, 0xf7c6866d, BRF_GRA }, // 5 - { "tvg-93.ic86",0x2000, 0x71acd48d, BRF_GRA }, // 6 - { "tvg-94.ic87",0x2000, 0x82160b9a, BRF_GRA }, // 7 - - { "sun-8212.ic3",0x0800, 0x8869611e, BRF_OPT }, // 8 MCU -}; - -STD_ROM_PICK(arabiana) -STD_ROM_FN(arabiana) - -struct BurnDriver BurnDrvarabiana = { - "arabiana", "arabian", NULL, NULL, "1983", - "Arabian (Atari)\0", NULL, "[Sun Electronics] (Atari license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, arabianaRomInfo, arabianaRomName, NULL, NULL, ArabianInputInfo, ArabianaDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, - 234, 256, 3, 4 -}; +// FB Alpha Arabian driver module +// Based on MAME driver by Jarek Burczynski and various others + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvBlitRAM; +static UINT8 *DrvTempBmp; +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static INT16 *pAY8910Buffer[3]; + +static UINT8 *arabian_color; +static UINT8 *flipscreen; + +static INT32 custom_cpu_reset; +static INT32 custom_cpu_busy; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvJoy6[8]; +static UINT8 DrvJoy7[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[8]; +static UINT8 DrvReset; + +static struct BurnInputInfo ArabianInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 1, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy4 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy4 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy4 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy4 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy5 + 0, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 2, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy6 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy6 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy6 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy6 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy7 + 0, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 3, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Arabian) + +static struct BurnDIPInfo ArabianDIPList[]= +{ + {0x10, 0xff, 0xff, 0x06, NULL }, + {0x11, 0xff, 0xff, 0x0d, NULL }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x10, 0x01, 0x01, 0x00, "3" }, + {0x10, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x10, 0x01, 0x02, 0x02, "Upright" }, + {0x10, 0x01, 0x02, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x10, 0x01, 0x04, 0x04, "Off" }, + {0x10, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x10, 0x01, 0x08, 0x00, "Easy" }, + {0x10, 0x01, 0x08, 0x08, "Hard" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x10, 0x01, 0xf0, 0x10, "A 2/1 B 2/1" }, + {0x10, 0x01, 0xf0, 0x20, "A 2/1 B 1/3" }, + {0x10, 0x01, 0xf0, 0x00, "A 1/1 B 1/1" }, + {0x10, 0x01, 0xf0, 0x30, "A 1/1 B 1/2" }, + {0x10, 0x01, 0xf0, 0x40, "A 1/1 B 1/3" }, + {0x10, 0x01, 0xf0, 0x50, "A 1/1 B 1/4" }, + {0x10, 0x01, 0xf0, 0x60, "A 1/1 B 1/5" }, + {0x10, 0x01, 0xf0, 0x70, "A 1/1 B 1/6" }, + {0x10, 0x01, 0xf0, 0x80, "A 1/2 B 1/2" }, + {0x10, 0x01, 0xf0, 0x90, "A 1/2 B 1/4" }, + {0x10, 0x01, 0xf0, 0xa0, "A 1/2 B 1/5" }, + {0x10, 0x01, 0xf0, 0xe0, "A 1/2 B 1/6" }, + {0x10, 0x01, 0xf0, 0xb0, "A 1/2 B 1/10" }, + {0x10, 0x01, 0xf0, 0xc0, "A 1/2 B 1/11" }, + {0x10, 0x01, 0xf0, 0xd0, "A 1/2 B 1/12" }, + {0x10, 0x01, 0xf0, 0xf0, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Coin Counters" }, + {0x11, 0x01, 0x01, 0x01, "1" }, + {0x11, 0x01, 0x01, 0x00, "2" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x11, 0x01, 0x0c, 0x0c, "30k 70k 40k+" }, + {0x11, 0x01, 0x0c, 0x04, "20k only" }, + {0x11, 0x01, 0x0c, 0x08, "40k only" }, + {0x11, 0x01, 0x0c, 0x00, "None" }, +}; + +STDDIPINFO(Arabian) + +static struct BurnDIPInfo ArabianaDIPList[]= +{ + {0x10, 0xff, 0xff, 0x06, NULL }, + {0x11, 0xff, 0xff, 0x0d, NULL }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x10, 0x01, 0x01, 0x00, "3" }, + {0x10, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x10, 0x01, 0x02, 0x02, "Upright" }, + {0x10, 0x01, 0x02, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x10, 0x01, 0x04, 0x04, "Off" }, + {0x10, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x10, 0x01, 0x08, 0x00, "Easy" }, + {0x10, 0x01, 0x08, 0x08, "Hard" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x10, 0x01, 0xf0, 0x10, "A 2/1 B 2/1" }, + {0x10, 0x01, 0xf0, 0x20, "A 2/1 B 1/3" }, + {0x10, 0x01, 0xf0, 0x00, "A 1/1 B 1/1" }, + {0x10, 0x01, 0xf0, 0x30, "A 1/1 B 1/2" }, + {0x10, 0x01, 0xf0, 0x40, "A 1/1 B 1/3" }, + {0x10, 0x01, 0xf0, 0x50, "A 1/1 B 1/4" }, + {0x10, 0x01, 0xf0, 0x60, "A 1/1 B 1/5" }, + {0x10, 0x01, 0xf0, 0x70, "A 1/1 B 1/6" }, + {0x10, 0x01, 0xf0, 0x80, "A 1/2 B 1/2" }, + {0x10, 0x01, 0xf0, 0x90, "A 1/2 B 1/4" }, + {0x10, 0x01, 0xf0, 0xa0, "A 1/2 B 1/5" }, + {0x10, 0x01, 0xf0, 0xe0, "A 1/2 B 1/6" }, + {0x10, 0x01, 0xf0, 0xb0, "A 1/2 B 1/10" }, + {0x10, 0x01, 0xf0, 0xc0, "A 1/2 B 1/11" }, + {0x10, 0x01, 0xf0, 0xd0, "A 1/2 B 1/12" }, + {0x10, 0x01, 0xf0, 0xf0, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Coin Counters" }, + {0x11, 0x01, 0x01, 0x01, "1" }, + {0x11, 0x01, 0x01, 0x00, "2" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x11, 0x01, 0x0c, 0x0c, "20k 50k 150k 100k+" }, + {0x11, 0x01, 0x0c, 0x04, "20k only" }, + {0x11, 0x01, 0x0c, 0x08, "40k only" }, + {0x11, 0x01, 0x0c, 0x00, "None" }, +}; + +STDDIPINFO(Arabiana) + +static UINT8 custom_cpu_r(UINT16 offset) +{ + if (custom_cpu_reset || offset < 0x7f0) + return DrvZ80RAM[offset]; + + switch (offset & 0x0f) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + return DrvInputs[(offset & 0x0f)+2]; + + case 6: + return custom_cpu_busy ^= 1; + + case 8: + return DrvZ80RAM[offset - 1]; + + default: + return 0; + } + return 0; +} + +static void blit_area(UINT8 plane, UINT16 src, UINT8 x, UINT8 y, UINT8 sx, UINT8 sy) +{ + UINT8 *srcdata = DrvGfxROM + src * 4; + + for (INT32 i = 0; i <= sx; i++, x += 4) + { + for (INT32 j = 0; j <= sy; j++) + { + UINT8 p1 = *srcdata++; + UINT8 p2 = *srcdata++; + UINT8 p3 = *srcdata++; + UINT8 p4 = *srcdata++; + UINT8 *base = DrvTempBmp + (((y + j) & 0xff) * 256 + (x & 0xff)); + + if (plane & 0x01) + { + if (p4 != 8) base[0] = (base[0] & ~0xf0) | (p4 << 4); + if (p3 != 8) base[1] = (base[1] & ~0xf0) | (p3 << 4); + if (p2 != 8) base[2] = (base[2] & ~0xf0) | (p2 << 4); + if (p1 != 8) base[3] = (base[3] & ~0xf0) | (p1 << 4); + } + + if (plane & 0x04) + { + if (p4 != 8) base[0] = (base[0] & ~0x0f) | p4; + if (p3 != 8) base[1] = (base[1] & ~0x0f) | p3; + if (p2 != 8) base[2] = (base[2] & ~0x0f) | p2; + if (p1 != 8) base[3] = (base[3] & ~0x0f) | p1; + } + } + } +} + +static void arabian_blitter_w(INT32 offset, UINT8 data) +{ + DrvBlitRAM[offset] = data; + + if (offset == 0x0006) + { + INT32 plane = DrvBlitRAM[offset - 6]; + INT32 src = DrvBlitRAM[offset - 5] | (DrvBlitRAM[offset - 4] << 8); + INT32 x = DrvBlitRAM[offset - 2] << 2; + INT32 y = DrvBlitRAM[offset - 3]; + INT32 sx = DrvBlitRAM[offset - 0]; + INT32 sy = DrvBlitRAM[offset - 1]; + + blit_area(plane, src, x, y, sx, sy); + } +} + +void __fastcall arabian_videoram_w(UINT16 offset, UINT8 data) +{ + UINT8 *base; + UINT8 x, y; + + x = (offset >> 8) << 2; + y = offset & 0xff; + + DrvVidRAM[offset & 0x3fff] = data; + + base = &DrvTempBmp[y * 256 + x]; + + if (DrvBlitRAM[0] & 0x08) + { + base[0] = (base[0] & ~0x03) | ((data & 0x10) >> 3) | ((data & 0x01) >> 0); + base[1] = (base[1] & ~0x03) | ((data & 0x20) >> 4) | ((data & 0x02) >> 1); + base[2] = (base[2] & ~0x03) | ((data & 0x40) >> 5) | ((data & 0x04) >> 2); + base[3] = (base[3] & ~0x03) | ((data & 0x80) >> 6) | ((data & 0x08) >> 3); + } + + if (DrvBlitRAM[0] & 0x04) + { + base[0] = (base[0] & ~0x0c) | ((data & 0x10) >> 1) | ((data & 0x01) << 2); + base[1] = (base[1] & ~0x0c) | ((data & 0x20) >> 2) | ((data & 0x02) << 1); + base[2] = (base[2] & ~0x0c) | ((data & 0x40) >> 3) | ((data & 0x04) << 0); + base[3] = (base[3] & ~0x0c) | ((data & 0x80) >> 4) | ((data & 0x08) >> 1); + } + + if (DrvBlitRAM[0] & 0x02) + { + base[0] = (base[0] & ~0x30) | ((data & 0x10) << 1) | ((data & 0x01) << 4); + base[1] = (base[1] & ~0x30) | ((data & 0x20) << 0) | ((data & 0x02) << 3); + base[2] = (base[2] & ~0x30) | ((data & 0x40) >> 1) | ((data & 0x04) << 2); + base[3] = (base[3] & ~0x30) | ((data & 0x80) >> 2) | ((data & 0x08) << 1); + } + + if (DrvBlitRAM[0] & 0x01) + { + base[0] = (base[0] & ~0xc0) | ((data & 0x10) << 3) | ((data & 0x01) << 6); + base[1] = (base[1] & ~0xc0) | ((data & 0x20) << 2) | ((data & 0x02) << 5); + base[2] = (base[2] & ~0xc0) | ((data & 0x40) << 1) | ((data & 0x04) << 4); + base[3] = (base[3] & ~0xc0) | ((data & 0x80) << 0) | ((data & 0x08) << 3); + } +} + +void __fastcall arabian_write(UINT16 address, UINT8 data) +{ + if ((address & 0xc000) == 0x8000) { + arabian_videoram_w(address & 0x3fff, data); + return; + } + + if ((address & 0xf000) == 0xe000) { + arabian_blitter_w(address & 0x0007, data); + return; + } +} + +UINT8 __fastcall arabian_read(UINT16 address) +{ + if ((address & 0xfe00) == 0xc000) { + return DrvInputs[0]; + } + + if ((address & 0xfe00) == 0xc200) { + return DrvDips[0]; + } + + if ((address & 0xff00) == 0xd700) { + return custom_cpu_r(address & 0x7ff); + } + + return 0; +} + +void __fastcall arabian_out(UINT16 port, UINT8 data) +{ + switch (port) + { + case 0xc800: + AY8910Write(0, 0, data); + break; + + case 0xca00: + AY8910Write(0, 1, data); + break; + } +} + +void ay8910_porta_w(UINT32, UINT32 data) +{ + *arabian_color = data >> 3; +} + +void ay8910_portb_w(UINT32, UINT32 data) +{ + custom_cpu_reset = ~data & 0x10; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + + custom_cpu_reset = 0; + custom_cpu_busy = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x008000; + + DrvGfxROM = Next; Next += 0x010000; + + Palette = (UINT32*)Next; Next += 0x2000 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x2000 * sizeof(UINT32); + + pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x000800; + DrvVidRAM = Next; Next += 0x004000; + DrvBlitRAM = Next; Next += 0x001000; + + DrvTempBmp = Next; Next += 256 * 256; + + flipscreen = Next; Next += 0x000001; + arabian_color = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static void DrvPaletteInit() +{ + UINT32 tpal[0x40]; + + for (INT32 i = 0; i < 64; i++) + { + INT32 r, b, g; + r = ((i >> 5) & 1) * (153*192/255) + ((i >> 4) & 1) * (102*192/255) + ((i & 0x30) ? 63 : 0); + g = ((i >> 3) & 1) * (156*192/255) + ((i >> 2) & 1) * (99*192/255) + ((i & 0x0c) ? 63 : 0); + b = ((i >> 1) & 1) * 192 + ((i >> 0) & 1) * 63; + tpal[i] = (r << 16) | (g << 8) | b; + } + + for (INT32 i = 0; i < (1 << 13); i++) + { + INT32 ena = (i >> 12) & 1; + INT32 enb = (i >> 11) & 1; + INT32 abhf = (~i >> 10) & 1; + INT32 aghf = (~i >> 9) & 1; + INT32 arhf = (~i >> 8) & 1; + INT32 az = (i >> 7) & 1; + INT32 ar = (i >> 6) & 1; + INT32 ag = (i >> 5) & 1; + INT32 ab = (i >> 4) & 1; + INT32 bz = (i >> 3) & 1; + INT32 br = (i >> 2) & 1; + INT32 bg = (i >> 1) & 1; + INT32 bb = (i >> 0) & 1; + + INT32 planea = (az | ar | ag | ab) & ena; + + INT32 rhi = planea ? ar : enb ? bz : 0; + INT32 rlo = planea ? ((!arhf & az) ? 0 : ar) : enb ? br : 0; + + INT32 ghi = planea ? ag : enb ? bb : 0; + INT32 glo = planea ? ((!aghf & az) ? 0 : ag) : enb ? bg : 0; + + INT32 bhi = ab; + INT32 bbase = (!abhf & az) ? 0 : ab; + + INT32 t = (rhi << 5) | (rlo << 4) | (ghi << 3) | (glo << 2) | (bhi << 1) | bbase; + + Palette[i] = tpal[t]; + } +} + +static void DrvGfxDecode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); + + for (INT32 offs = 0; offs < 0x4000 * 4; offs+=4) + { + INT32 v1 = DrvGfxROM[(offs / 4) + 0x0000]; + INT32 v2 = DrvGfxROM[(offs / 4) + 0x4000]; + + for (INT32 j = 0; j < 4; j++, v1>>=1, v2>>=1) { + tmp[offs + 3 - j] = (v1 & 1) | ((v1 >> 3) & 2) | ((v2 << 2) & 4) | ((v2 >> 1) & 8); + } + } + + memcpy (DrvGfxROM, tmp, 0x10000); + BurnFree (tmp); +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x4000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x6000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x0000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x2000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x4000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x6000, 7, 1)) return 1; + + DrvPaletteInit(); + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xd000, 0xd6ff, 0, DrvZ80RAM); + ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80RAM); + ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(arabian_write); + ZetSetReadHandler(arabian_read); + ZetSetOutHandler(arabian_out); + ZetClose(); + + AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, ay8910_porta_w, ay8910_portb_w); + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + AY8910Exit(0); + + BurnFree (AllMem); + + return 0; +} + +static inline void update_flip_state() +{ + *flipscreen = DrvZ80RAM[0x034b]; + + if (DrvZ80RAM[0x0400] != 0 && !(DrvZ80RAM[0x0401] & 0x02)) + *flipscreen = !*flipscreen; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x2000; i++) { + INT32 d = Palette[i]; + DrvPalette[i] = BurnHighCol(d >> 16, (d >> 8) & 0xff, d & 0xff, 0); + } + } + + update_flip_state(); + + UINT16 *pDst = pTransDraw; + UINT8 *pSrc = DrvTempBmp + (11 * 256); + + if (*flipscreen) { + pDst += nScreenWidth * (nScreenHeight - 1); + for (INT32 y = 11; y < 256-11; y++) { + for (INT32 x = 0; x < 256; x++) { + pDst[x] = pSrc[x ^ 0xff]; + } + pDst -= nScreenWidth; + pSrc += 256; + } + } else { + for (INT32 y = 11; y < 256-11; y++) { + for (INT32 x = 0; x < 256; x++) { + pDst[x] = pSrc[x]; + } + pDst += nScreenWidth; + pSrc += 256; + } + } + + BurnTransferCopy(DrvPalette + (*arabian_color << 8)); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0, 8); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + DrvInputs[5] ^= (DrvJoy6[i] & 1) << i; + DrvInputs[6] ^= (DrvJoy7[i] & 1) << i; + } + DrvInputs[1] = DrvDips[0]; + DrvInputs[2] |= 1; + DrvInputs[7] = DrvDips[1]; + } + + ZetOpen(0); + ZetRun(3000000 / 60); + ZetRaiseIrq(0); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + AY8910Scan(nAction, pnMin); + + SCAN_VAR(custom_cpu_reset); + SCAN_VAR(custom_cpu_busy); + } + + return 0; +} + + +// Arabian + +static struct BurnRomInfo arabianRomDesc[] = { + { "ic1rev2.87", 0x2000, 0x5e1c98b8, BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ic2rev2.88", 0x2000, 0x092f587e, BRF_ESS | BRF_PRG }, // 1 + { "ic3rev2.89", 0x2000, 0x15145f23, BRF_ESS | BRF_PRG }, // 2 + { "ic4rev2.90", 0x2000, 0x32b77b44, BRF_ESS | BRF_PRG }, // 3 + + { "tvg-91.ic84",0x2000, 0xc4637822, BRF_GRA }, // 4 Graphics + { "tvg-92.ic85",0x2000, 0xf7c6866d, BRF_GRA }, // 5 + { "tvg-93.ic86",0x2000, 0x71acd48d, BRF_GRA }, // 6 + { "tvg-94.ic87",0x2000, 0x82160b9a, BRF_GRA }, // 7 + + { "sun-8212.ic3",0x0800, 0x8869611e, BRF_OPT }, // 8 MCU +}; + +STD_ROM_PICK(arabian) +STD_ROM_FN(arabian) + +struct BurnDriver BurnDrvarabian = { + "arabian", NULL, NULL, NULL, "1983", + "Arabian\0", NULL, "Sun Electronics", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, arabianRomInfo, arabianRomName, NULL, NULL, ArabianInputInfo, ArabianDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, + 234, 256, 3, 4 +}; + +// Arabian (Atari) + +static struct BurnRomInfo arabianaRomDesc[] = { + { "tvg-87.ic1", 0x2000, 0x51e9a6b1, BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "tvg-88.ic2", 0x2000, 0x1cdcc1ab, BRF_ESS | BRF_PRG }, // 1 + { "tvg-89.ic3", 0x2000, 0xb7b7faa0, BRF_ESS | BRF_PRG }, // 2 + { "tvg-90.ic4", 0x2000, 0xdbded961, BRF_ESS | BRF_PRG }, // 3 + + { "tvg-91.ic84",0x2000, 0xc4637822, BRF_GRA }, // 4 Graphics + { "tvg-92.ic85",0x2000, 0xf7c6866d, BRF_GRA }, // 5 + { "tvg-93.ic86",0x2000, 0x71acd48d, BRF_GRA }, // 6 + { "tvg-94.ic87",0x2000, 0x82160b9a, BRF_GRA }, // 7 + + { "sun-8212.ic3",0x0800, 0x8869611e, BRF_OPT }, // 8 MCU +}; + +STD_ROM_PICK(arabiana) +STD_ROM_FN(arabiana) + +struct BurnDriver BurnDrvarabiana = { + "arabiana", "arabian", NULL, NULL, "1983", + "Arabian (Atari)\0", NULL, "[Sun Electronics] (Atari license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, arabianaRomInfo, arabianaRomName, NULL, NULL, ArabianInputInfo, ArabianaDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, + 234, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_armedf.cpp b/src/burn/drv/pre90s/d_armedf.cpp index f9241af7d..844697b2c 100644 --- a/src/burn/drv/pre90s/d_armedf.cpp +++ b/src/burn/drv/pre90s/d_armedf.cpp @@ -1,1908 +1,1906 @@ -// FB Alpha Armed Formation driver module -// Based on MAME driver by Carlos A. Lozano, Phil Stroffolino, and Takahiro Nogi - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "dac.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *Drv68KRAM0; -static UINT8 *Drv68KRAM1; -static UINT8 *Drv68KRAM2; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvZ80ROM2; -static UINT8 *DrvZ80RAM2; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf; -static UINT8 *DrvBgRAM; -static UINT8 *DrvFgRAM; -static UINT8 *DrvTxRAM; -static UINT32 *DrvPalette; - -static UINT16*DrvMcuCmd; -static UINT16*DrvScroll; -static UINT8 *DrvVidRegs; -static UINT8 *soundlatch; -static UINT8 *flipscreen; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[2]; -static UINT16 DrvInputs[4]; -static UINT8 DrvReset; - -static INT32 scroll_type; -static INT32 sprite_offy; -static INT32 yoffset; -static INT32 xoffset; -static INT32 irqline; - -static INT32 Terrafjb = 0; - -static struct BurnInputInfo ArmedfInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 10, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 8, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 11, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 9, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 8, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy2 + 10, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Armedf) - -static struct BurnInputInfo Cclimbr2InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 10, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 8, "p1 start" }, - {"P1 Up 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down 1", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Up 2", BIT_DIGITAL, DrvJoy1 + 4, "p3 up" }, - {"P1 Down 2", BIT_DIGITAL, DrvJoy1 + 5, "p3 down" }, - {"P1 Left 2", BIT_DIGITAL, DrvJoy1 + 6, "p3 left" }, - {"P1 Right 2", BIT_DIGITAL, DrvJoy1 + 7, "p3 right" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 11, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 9, "p2 start" }, - {"P2 Up 1", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down 1", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right 1", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Up 2", BIT_DIGITAL, DrvJoy2 + 4, "p4 up" }, - {"P2 Down 2", BIT_DIGITAL, DrvJoy2 + 5, "p4 down" }, - {"P2 Left 2", BIT_DIGITAL, DrvJoy2 + 6, "p4 left" }, - {"P2 Right 2", BIT_DIGITAL, DrvJoy2 + 7, "p4 right" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 8, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy2 + 10, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Cclimbr2) - -static struct BurnDIPInfo ArmedfDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xdf, NULL }, - {0x16, 0xff, 0xff, 0xcf, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x03, "3" }, - {0x15, 0x01, 0x03, 0x02, "4" }, - {0x15, 0x01, 0x03, 0x01, "5" }, - {0x15, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2, "1st Bonus Life" }, - {0x15, 0x01, 0x04, 0x04, "20k" }, - {0x15, 0x01, 0x04, 0x00, "40k" }, - - {0 , 0xfe, 0 , 2, "2nd Bonus Life" }, - {0x15, 0x01, 0x08, 0x08, "60k" }, - {0x15, 0x01, 0x08, 0x00, "80k" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x15, 0x01, 0x0c, 0x0c, "20k then every 60k" }, - {0x15, 0x01, 0x0c, 0x04, "20k then every 80k" }, - {0x15, 0x01, 0x0c, 0x08, "40k then every 60k" }, - {0x15, 0x01, 0x0c, 0x00, "40k then every 80k" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x10, 0x00, "Off" }, - {0x15, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x15, 0x01, 0x20, 0x00, "Upright" }, - {0x15, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0xc0, 0xc0, "Easy" }, - {0x15, 0x01, 0xc0, 0x80, "Normal" }, - {0x15, 0x01, 0xc0, 0x40, "Hard" }, - {0x15, 0x01, 0xc0, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, - {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, - {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x16, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x16, 0x01, 0x0c, 0x04, "2 Coins 1 Credits" }, - {0x16, 0x01, 0x0c, 0x0c, "1 Coin 1 Credits" }, - {0x16, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, - {0x16, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Allow Continue" }, - {0x16, 0x01, 0x30, 0x30, "No" }, - {0x16, 0x01, 0x30, 0x20, "3 Times" }, - {0x16, 0x01, 0x30, 0x10, "5 Times" }, - {0x16, 0x01, 0x30, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x16, 0x01, 0x40, 0x40, "Off" }, - {0x16, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(Armedf) - -static struct BurnDIPInfo KozureDIPList[]= -{ - {0x15, 0xff, 0xff, 0xcf, NULL }, - {0x16, 0xff, 0xff, 0xcf, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x03, "3" }, - {0x15, 0x01, 0x03, 0x02, "4" }, - {0x15, 0x01, 0x03, 0x01, "5" }, - {0x15, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2, "1st Bonus Life" }, - {0x15, 0x01, 0x04, 0x04, "None" }, - {0x15, 0x01, 0x04, 0x00, "50k" }, - - {0 , 0xfe, 0 , 2, "2nd Bonus Life" }, - {0x15, 0x01, 0x08, 0x08, "60k" }, - {0x15, 0x01, 0x08, 0x00, "90k" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x15, 0x01, 0x0c, 0x08, "50k then every 60k" }, - {0x15, 0x01, 0x0c, 0x00, "50k then every 90k" }, - {0x15, 0x01, 0x0c, 0x0c, "Every 60k" }, - {0x15, 0x01, 0x0c, 0x04, "Every 90k" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x15, 0x01, 0x40, 0x40, "Easy" }, - {0x15, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 0, "Coin A" }, - {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, - {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, - {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x16, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x16, 0x01, 0x0c, 0x00, "3 Coins 1 Credits" }, - {0x16, 0x01, 0x0c, 0x04, "2 Coins 3 Credits" }, - {0x16, 0x01, 0x0c, 0x0c, "1 Coin 3 Credits" }, - {0x16, 0x01, 0x0c, 0x08, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Allow Continue" }, - {0x16, 0x01, 0x30, 0x30, "No" }, - {0x16, 0x01, 0x30, 0x20, "3 Times" }, - {0x16, 0x01, 0x30, 0x10, "5 Times" }, - {0x16, 0x01, 0x30, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4, "Allow Continue" }, - {0x16, 0x01, 0x40, 0x00, "No" }, - {0x16, 0x01, 0x40, 0x40, "Yes" }, -}; - -STDDIPINFO(Kozure) - -static struct BurnDIPInfo Cclimbr2DIPList[]= -{ - {0x17, 0xff, 0xff, 0xcf, NULL }, - {0x18, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x17, 0x01, 0x03, 0x03, "3" }, - {0x17, 0x01, 0x03, 0x02, "4" }, - {0x17, 0x01, 0x03, 0x01, "5" }, - {0x17, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2, "1st Bonus Life" }, - {0x17, 0x01, 0x04, 0x04, "30k" }, - {0x17, 0x01, 0x04, 0x00, "60k" }, - - {0 , 0xfe, 0 , 2, "2nd Bonus Life" }, - {0x17, 0x01, 0x08, 0x08, "70k" }, - {0x17, 0x01, 0x08, 0x00, "None" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x17, 0x01, 0x0c, 0x0c, "30K and 100k" }, - {0x17, 0x01, 0x0c, 0x08, "60k and 130k" }, - {0x17, 0x01, 0x0c, 0x04, "30k only" }, - {0x17, 0x01, 0x0c, 0x00, "60k only" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x17, 0x01, 0x40, 0x40, "Easy" }, - {0x17, 0x01, 0x40, 0x00, "Normal" }, - - {0 , 0xfe, 0 , 0, "Coin A" }, - {0x18, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, - {0x18, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, - {0x18, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x18, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x18, 0x01, 0x0c, 0x04, "2 Coins 1 Credits" }, - {0x18, 0x01, 0x0c, 0x0c, "1 Coin 1 Credits" }, - {0x18, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, - {0x18, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Allow Continue" }, - {0x18, 0x01, 0x10, 0x00, "No" }, - {0x18, 0x01, 0x10, 0x10, "3 Times" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x18, 0x01, 0x20, 0x20, "Off" }, - {0x18, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Partial Invulnerability (Cheat)" }, - {0x18, 0x01, 0x40, 0x40, "Off" }, - {0x18, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(Cclimbr2) - -static struct BurnDIPInfo LegionDIPList[]= -{ - {0x15, 0xff, 0xff, 0xf7, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x03, "3" }, - {0x15, 0x01, 0x03, 0x02, "4" }, - {0x15, 0x01, 0x03, 0x01, "5" }, - {0x15, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x15, 0x01, 0x04, 0x04, "30k Then Every 100k" }, - {0x15, 0x01, 0x04, 0x00, "50k Only" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x08, "Off" }, - {0x15, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x10, 0x10, "Off" }, - {0x15, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 0, "Allow Invulnerability (Cheat)" }, - {0x15, 0x01, 0x80, 0x80, "No" }, - {0x15, 0x01, 0x80, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 0, "Coin A" }, - {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, - {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, - {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x16, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Coin B" }, - {0x16, 0x01, 0x0c, 0x04, "2 Coins 1 Credits" }, - {0x16, 0x01, 0x0c, 0x0c, "1 Coin 1 Credits" }, - {0x16, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, - {0x16, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin Slots" }, - {0x16, 0x01, 0x10, 0x10, "Common" }, - {0x16, 0x01, 0x10, 0x00, "Individual" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x20, 0x20, "Easy" }, - {0x16, 0x01, 0x20, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2, "P1 Invulnerability (Cheat)" }, - {0x16, 0x01, 0x40, 0x40, "Off" }, - {0x16, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "P2 Invulnerability (Cheat)" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Legion) - -static struct BurnDIPInfo TerrafDIPList[]= -{ - {0x15, 0xff, 0xff, 0x0f, NULL }, - {0x16, 0xff, 0xff, 0x3f, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x03, "3" }, - {0x15, 0x01, 0x03, 0x02, "4" }, - {0x15, 0x01, 0x03, 0x01, "5" }, - {0x15, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2, "1st Bonus Life" }, - {0x15, 0x01, 0x04, 0x04, "20k" }, - {0x15, 0x01, 0x04, 0x00, "50k" }, - - {0 , 0xfe, 0 , 2, "2nd Bonus Life" }, - {0x15, 0x01, 0x08, 0x08, "60k" }, - {0x15, 0x01, 0x08, 0x00, "90k" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x15, 0x01, 0x0c, 0x0c, "20k then every 60k" }, - {0x15, 0x01, 0x0c, 0x04, "20k then every 90k" }, - {0x15, 0x01, 0x0c, 0x08, "50k then every 60k" }, - {0x15, 0x01, 0x0c, 0x00, "50k then every 90k" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x10, 0x10, "Off" }, - {0x15, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, - {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, - {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x16, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x16, 0x01, 0x0c, 0x04, "2 Coins 1 Credits" }, - {0x16, 0x01, 0x0c, 0x0c, "1 Coin 1 Credits" }, - {0x16, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, - {0x16, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 0, "Flip Screen" }, - {0x16, 0x01, 0x20, 0x20, "Off" }, - {0x16, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x16, 0x01, 0xc0, 0xc0, "No" }, - {0x16, 0x01, 0xc0, 0x80, "Only 3 Times" }, - {0x16, 0x01, 0xc0, 0x40, "Only 5 Times" }, - {0x16, 0x01, 0xc0, 0x00, "Yes" }, -}; - -STDDIPINFO(Terraf) - -void __fastcall armedf_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x06d000: - *DrvVidRegs = data >> 8; - *flipscreen = (data >> 12) & 1; - return; - - case 0x06d002: - DrvScroll[0] = data & 0x3ff; - return; - - case 0x06d004: - DrvScroll[1] = data & 0x1ff; - return; - - case 0x06d006: - DrvScroll[2] = data & 0x3ff; - return; - - case 0x06d008: - DrvScroll[3] = data & 0x1ff; - return; - - case 0x06d00a: - *soundlatch = ((data & 0x7f) << 1) | 1; - return; - } -} - -void __fastcall cclimbr2_write_word(UINT32 address, UINT16 data) -{ - if (scroll_type == 6 && (address & 0xffffc0) == 0x040000) { - DrvMcuCmd[(address >> 1) & 0x1f] = data; - return; - } - - switch (address) - { - case 0x7c000: - { -/* if (Terrafjb) { - // We should be using the extra Z80 - but it doesn't seem to work - the normal simulation does though - static UINT32 OldData = 0; - if ((data & 0x4000) && (OldData & 0x4000) == 0) { - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - ZetOpen(0); - } - OldData = data; - } else {*/ - if (scroll_type == 2) { - if (~data & 0x0080) { - memset (DrvTxRAM, 0xff, 0x2000); - } - } - - if (scroll_type == 0 || scroll_type == 3 || scroll_type == 5 || scroll_type == 6) { // scroll6 - hack - if (((data & 0x4100) == 0x4000 && scroll_type != 6) || - ((data & 0x4100) == 0x0000 && scroll_type == 6)) { - UINT16 *ram = (UINT16*)DrvTxRAM; - for (INT32 i = 0x10; i < 0x1000; i++) { - ram[i] = 0x0020; - } - } - } -// } - - *DrvVidRegs = data >> 8; - *flipscreen = (data >> 12) & 1; - } - return; - - case 0x7c002: - DrvScroll[0] = data & 0x3ff; - return; - - case 0x7c004: - DrvScroll[1] = data & 0x1ff; - return; - - case 0x7c00a: - *soundlatch = ((data & 0x7f) << 1) | 1; - return; - - case 0x7c00e: - if (scroll_type == 0 || scroll_type == 3 || scroll_type == 5) { - *DrvMcuCmd = data; - } - return; - } -} - -void __fastcall cclimbr2_write_byte(UINT32 address, UINT8 data) -{ - if (scroll_type != 0) return; - - switch (address) - { - case 0x7c006: - DrvMcuCmd[11] = data; - DrvMcuCmd[31] = 1; - return; - - case 0x7c008: - if (DrvMcuCmd[31]) { - DrvMcuCmd[14] = data >> 4; - DrvMcuCmd[12] = data; - } else { - DrvMcuCmd[13] = data; - } - return; - - case 0xc0000: - DrvMcuCmd[31] = 0; - return; - } -} - -UINT16 __fastcall cclimbr2_read_word(UINT32 address) -{ - switch (address) - { - case 0x78000: - return DrvInputs[0]; - - case 0x78002: - return DrvInputs[1]; - - case 0x78004: - return DrvInputs[2]; - - case 0x78006: - return DrvInputs[3]; - } - - return 0; -} - -void __fastcall armedf_write_port(UINT16 port, UINT8 data) -{ -// bprintf (PRINT_NORMAL, _T("%2.2x %2.2x\n"), port & 0xff, data); - - switch (port & 0xff) - { - case 0x00: - BurnYM3812Write(0, data); - return; - - case 0x01: - BurnYM3812Write(1, data); - return; - - case 0x02: - DACSignedWrite(0, data); - return; - - case 0x03: - DACSignedWrite(1, data); - return; - } -} - -UINT8 __fastcall armedf_read_port(UINT16 port) -{ -// bprintf (PRINT_NORMAL, _T("%2.2x read\n"), port & 0xff); - - switch (port & 0xff) - { - case 0x04: - *soundlatch = 0; - return 0; - - case 0x06: - return *soundlatch; - } - - return 0; -} - -void __fastcall terrafjbextra_write_port(UINT16 port, UINT8 data) -{ - // rendering code reads scroll values from RAM - we write the values to RAM here so that the rendering code still works -// UINT16 *RAM = (UINT16*)DrvTxRAM; - - switch (port & 0xff) { - case 0x00: { -// RAM[13] = data & 0xff; -// RAM[14] = data >> 8; - return; - } - - case 0x01: { -// RAM[11] = data & 0xff; -// RAM[12] = data >> 8; - return; - } - - case 0x02: { - /* - state->m_fg_scrolly = (((data & 0x03) >> 0) << 8) | (state->m_fg_scrolly & 0xff); - state->m_fg_scrollx = (((data & 0x0c) >> 2) << 8) | (state->m_fg_scrollx & 0xff);*/ -// RAM[12] = data;//(data & 0x03) >> 0; -// RAM[14] = data;//(data & 0x0c) >> 2; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Port write %x, %x\n"), port, data); - } - } -} - -UINT8 __fastcall terrafjbextra_read_port(UINT16 port) -{ - switch (port & 0xff) { - default: { - bprintf(PRINT_NORMAL, _T("Port read %x\n"), port); - } - } - - return 0; -} - -void __fastcall terrafjbextra_write(UINT16 address, UINT8 data) -{ - if (address >= 0x4000 && address <= 0x5fff) { - DrvTxRAM[(address ^ 1) - 0x4000] = data; - return; - } - - switch (address) { - default: { - bprintf(PRINT_NORMAL, _T("Write %x, %x\n"), address, data); - } - } -} - -UINT8 __fastcall terrafjbextra_read(UINT16 address) -{ - if (address >= 0x4000 && address <= 0x5fff) { - return DrvTxRAM[(address ^ 1) - 0x4000]; - } - - switch (address) { - default: { - bprintf(PRINT_NORMAL, _T("Read %x\n"), address); - } - } - - return 0; -} - - - - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static INT32 DrvSyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (4000000.000 / (nBurnFPS / 100.000)))); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - if (Terrafjb) { - ZetOpen(1); - ZetReset(); - ZetClose(); - } - - BurnYM3812Reset(); - DACReset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x010000; - Drv68KROM = Next; Next += 0x060000; - - DrvGfxROM0 = Next; Next += 0x010000; - DrvGfxROM1 = Next; Next += 0x080000; - DrvGfxROM2 = Next; Next += 0x080000; - DrvGfxROM3 = Next; Next += 0x080000; - - if (Terrafjb) { - DrvZ80ROM2 = Next; Next += 0x004000; - } - - DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); - - AllRam = Next; - - DrvSprRAM = Next; Next += 0x001000; - DrvSprBuf = Next; Next += 0x001000; - DrvBgRAM = Next; Next += 0x001000; - DrvFgRAM = Next; Next += 0x001000; - DrvTxRAM = Next; Next += 0x002000; - DrvPalRAM = Next; Next += 0x001000; - Drv68KRAM0 = Next; Next += 0x005000; - Drv68KRAM1 = Next; Next += 0x001000; - Drv68KRAM2 = Next; Next += 0x001000; - - flipscreen = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - DrvVidRegs = Next; Next += 0x000001; - DrvScroll = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); - DrvMcuCmd = (UINT16*)Next; Next += 0x000020 * sizeof(UINT16); - - DrvZ80RAM = Next; Next += 0x004000; - - if (Terrafjb) { - DrvZ80RAM2 = Next; Next += 0x000800; - } - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x000, 0x001, 0x002, 0x003 }; - INT32 XOffs0[16] = { 0x004, 0x000, 0x00c, 0x008, 0x014, 0x010, 0x01c, 0x018, - 0x024, 0x020, 0x02c, 0x028, 0x034, 0x030, 0x03c, 0x038 }; - INT32 YOffs0[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }; - INT32 XOffs1[16] = { 0x000004, 0x000000, 0x100004, 0x100000, 0x00000c, 0x000008, 0x10000c, 0x100008, - 0x000014, 0x000010, 0x100014, 0x100010, 0x00001c, 0x000018, 0x10001c, 0x100018 }; - INT32 YOffs1[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, - 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x08000); - - GfxDecode(0x0400, 4, 8, 8, Plane, XOffs0, YOffs0, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x40000); - - GfxDecode(0x0800, 4, 16, 16, Plane, XOffs0, YOffs1, 0x400, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x20000); - - GfxDecode(0x0400, 4, 16, 16, Plane, XOffs0, YOffs1, 0x400, tmp, DrvGfxROM2); - - memcpy (tmp, DrvGfxROM3, 0x40000); - - GfxDecode(0x0800, 4, 16, 16, Plane, XOffs1, YOffs0, 0x200, tmp, DrvGfxROM3); - - BurnFree (tmp); - - return 0; -} - -static void Armedf68KInit() -{ - SekMapMemory(Drv68KROM, 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(DrvSprRAM, 0x060000, 0x060fff, SM_RAM); - SekMapMemory(Drv68KRAM0, 0x061000, 0x065fff, SM_RAM); - SekMapMemory(DrvBgRAM, 0x066000, 0x066fff, SM_RAM); - SekMapMemory(DrvFgRAM, 0x067000, 0x067fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x068000, 0x069fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x06a000, 0x06afff, SM_RAM); - SekMapMemory(Drv68KRAM1, 0x06b000, 0x06bfff, SM_RAM); - SekMapMemory(Drv68KRAM2, 0x06c000, 0x06c7ff, SM_RAM); - SekSetWriteWordHandler(0, armedf_write_word); -} - -static void Cclimbr268KInit() -{ - SekMapMemory(Drv68KROM, 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(DrvSprRAM, 0x060000, 0x060fff, SM_RAM); - SekMapMemory(Drv68KRAM0, 0x061000, 0x063fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x064000, 0x064fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x068000, 0x069fff, SM_RAM); - SekMapMemory(Drv68KRAM1, 0x06a000, 0x06a9ff, SM_RAM); - SekMapMemory(Drv68KRAM2, 0x06c000, 0x06c9ff, SM_RAM); - SekMapMemory(DrvFgRAM, 0x070000, 0x070fff, SM_RAM); - SekMapMemory(DrvBgRAM, 0x074000, 0x074fff, SM_RAM); - SekSetWriteWordHandler(0, cclimbr2_write_word); - SekSetWriteByteHandler(0, cclimbr2_write_byte); - SekSetReadWordHandler(0, cclimbr2_read_word); -} - -static INT32 DrvInit(INT32 (*pLoadRoms)(), void (*p68KInit)(), INT32 zLen) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (pLoadRoms) { - if (pLoadRoms()) return 1; - } - - DrvGfxDecode(); - - SekInit(0, 0x68000); - SekOpen(0); - - if (p68KInit) - { - p68KInit(); - } - - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, zLen-1, 0, DrvZ80ROM); - ZetMapArea(0x0000, zLen-1, 2, DrvZ80ROM); - ZetMapArea(zLen+0, 0xffff, 0, DrvZ80RAM); - ZetMapArea(zLen+0, 0xffff, 1, DrvZ80RAM); - ZetMapArea(zLen+0, 0xffff, 2, DrvZ80RAM); - ZetSetOutHandler(armedf_write_port); - ZetSetInHandler(armedf_read_port); - ZetMemEnd(); - ZetClose(); - - if (Terrafjb) { - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM2); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM2); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(terrafjbextra_write); - ZetSetReadHandler(terrafjbextra_read); - ZetSetOutHandler(terrafjbextra_write_port); - ZetSetInHandler(terrafjbextra_read_port); - ZetMemEnd(); - ZetClose(); - } - - BurnYM3812Init(4000000, NULL, &DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3812(4000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); - - DACInit(0, 0, 1, DrvSyncDAC); - DACInit(1, 0, 1, DrvSyncDAC); - DACSetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); - DACSetRoute(1, 0.40, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - if (nScreenWidth == 320) { - xoffset = 96; - yoffset = 8; - } else { - xoffset = 112; - yoffset = 16; - } - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - DACExit(); - BurnYM3812Exit(); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - Terrafjb = 0; - - return 0; -} - -static inline void DrvPaletteRecalc() -{ - UINT8 r,g,b; - UINT16 *pal = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x1000 / 2; i++) { - INT32 d = pal[i]; - - r = (d >> 4) & 0xf0; - g = (d & 0xf0); - b = (d & 0x0f); - - r |= r >> 4; - g |= g >> 4; - b |= b << 4; - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static inline void AssembleInputs() -{ - memset (DrvInputs, 0xff, 2 * sizeof(INT16)); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - - DrvInputs[2] = DrvDips[0] | 0xff00; - DrvInputs[3] = DrvDips[1] | 0xff00; - - if (scroll_type == 1) { - UINT16 *ptr = (UINT16*)Drv68KRAM2; - ptr[0] = DrvInputs[0]; - ptr[1] = DrvInputs[1]; - ptr[2] = DrvInputs[2]; - ptr[3] = DrvInputs[3]; - } -} - -static void draw_layer(UINT8 *ram, UINT8 *gfxbase, INT32 scrollx, INT32 scrolly, INT32 coloff, INT32 code_and) -{ - UINT16 *vram = (UINT16*)ram; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sy = (offs & 0x1f) << 4; - INT32 sx = (offs >> 5) << 4; - sy -= scrolly + yoffset; - sx -= scrollx + xoffset; - if (sy < -15) sy += 512; - if (sx < -15) sx += 1024; - - if (sy >= nScreenHeight || sx >= nScreenWidth) continue; - - INT32 code = vram[offs] & code_and; - INT32 color = vram[offs] >> 11; - - if (*flipscreen) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, (nScreenWidth - 16) - sx, (nScreenHeight - 16) - sy, color, 4, 15, coloff, gfxbase); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, coloff, gfxbase); - } - } -} - -static void draw_txt_layer(INT32 transp) -{ - UINT16 *vram = (UINT16*)DrvTxRAM; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 ofst = 0; - INT32 ofsta = 0x400; - INT32 sx = offs & 0x3f; - INT32 sy = offs >> 6; - - if (scroll_type == 1) { - ofst = (sx << 5) | sy; - ofsta = 0x800; - } else if (scroll_type == 3 || scroll_type == 6) { - ofst = ((sx & 0x1f) << 5) | sy | ((sx >> 5) << 11); - } else { - ofst = ((sy ^ 0x1f) << 5) | (sx & 0x1f) | ((sx >> 5) << 11); - } - - sx = (sx << 3) - xoffset; - sy = (sy << 3) - yoffset; - if (scroll_type != 1) sx += 128; - - if (sx < -7 || sy < -7 || sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 attr = vram[ofst+ofsta] & 0xff; - INT32 code = (vram[ofst] & 0xff) | ((attr & 3) << 8); - - if (transp) { - if (*flipscreen) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, (nScreenWidth - 8) - sx, (nScreenHeight - 8) - sy, attr >> 4, 4, 15, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, attr >> 4, 4, 15, 0, DrvGfxROM0); - } - } else { - if (*flipscreen) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, (nScreenWidth - 8) - sx, (nScreenHeight - 8) -sy, attr >> 4, 4, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, attr >> 4, 4, 0, DrvGfxROM0); - } - } - } -} - -static void draw_sprites(INT32 priority) -{ - UINT16 *spr = (UINT16*)DrvSprBuf; - - INT32 sprlen = 0x1000; - if (scroll_type == 0 || scroll_type == 5) sprlen = 0x400; - - for (INT32 offs = 0; offs < sprlen / 2; offs+=4) - { - INT32 attr = spr[offs + 0]; - if (((attr & 0x3000) >> 12) != priority) continue; - - INT32 code = spr[offs + 1]; - INT32 flipx = code & 0x2000; - INT32 flipy = code & 0x1000; - INT32 color =(spr[offs + 2] >> 8) & 0x1f; - INT32 sx = spr[offs + 3]; - INT32 sy = sprite_offy + 240 - (attr & 0x1ff); - code &= 0xfff; - - if (*flipscreen) { - sx = 320 - sx + 176; - sy = 240 - sy + 1; - flipx = !flipx; - flipy = !flipy; - } - - sy -= yoffset; - sx -= xoffset; - - if (sx < -15 || sy < -15 || sx >= nScreenWidth || sy >= nScreenHeight) continue; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvPaletteRecalc(); - } - - for (INT32 offs = 0; offs < nScreenWidth * nScreenHeight; offs++) - pTransDraw[offs] = 0x00ff; - - INT32 txt_transp = 1; - - if (scroll_type == 0 || scroll_type == 5) { - if ((*DrvMcuCmd & 0x000f) == 0x000f) txt_transp = 0; - } - - if (scroll_type != 1) { - UINT16 *ram = (UINT16*)DrvTxRAM; - if (scroll_type == 0 || scroll_type == 6) ram = DrvMcuCmd; - - DrvScroll[2] = (ram[13] & 0xff) | ((ram[14] & 3) << 8); - DrvScroll[3] = (ram[11] & 0xff) | ((ram[12] & 1) << 8); - } - - if (*DrvVidRegs & 0x08) draw_layer(DrvBgRAM, DrvGfxROM2, DrvScroll[0], DrvScroll[1], 0x600, 0x3ff); - if ((*DrvMcuCmd & 0x30) == 0x30 && *DrvVidRegs & 0x01) draw_txt_layer(txt_transp); - if (*DrvVidRegs & 0x02) draw_sprites(2); - if ((*DrvMcuCmd & 0x30) == 0x20 && *DrvVidRegs & 0x01) draw_txt_layer(txt_transp); - if (*DrvVidRegs & 0x04) draw_layer(DrvFgRAM, DrvGfxROM1, DrvScroll[2], DrvScroll[3], 0x400, 0x7ff); - if ((*DrvMcuCmd & 0x30) == 0x10 && *DrvVidRegs & 0x01) draw_txt_layer(txt_transp); - if (*DrvVidRegs & 0x02) draw_sprites(1); - if ((*DrvMcuCmd & 0x30) == 0x00 && *DrvVidRegs & 0x01) draw_txt_layer(txt_transp); - if (*DrvVidRegs & 0x02) draw_sprites(0); - - BurnTransferCopy(DrvPalette); - - memcpy (DrvSprBuf, DrvSprRAM, 0x1000); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - SekNewFrame(); - ZetNewFrame(); - - AssembleInputs(); - - INT32 nSegment; - INT32 nInterleave = 100; - INT32 nTotalCycles[3] = { 8000000 / 60, 4000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - - INT32 Z80IRQSlice[9]; - for (INT32 i = 0; i < 9; i++) { - Z80IRQSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 10)); - } - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nNext; - - nNext = (i + 1) * nTotalCycles[0] / nInterleave; - nSegment = nNext - nCyclesDone[0]; - nSegment = SekRun(nSegment); - nCyclesDone[0] += nSegment; - - BurnTimerUpdateYM3812(i * (nTotalCycles[1] / nInterleave)); - - for (INT32 j = 0; j < 9; j++) { - if (i == Z80IRQSlice[j]) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nCyclesDone[1] += ZetRun(3000); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } - } - - if (Terrafjb) { - ZetClose(); - ZetOpen(1); - nNext = (i + 1) * nTotalCycles[2] / nInterleave; - nSegment = nNext - nCyclesDone[2]; - nSegment = ZetRun(nSegment); - nCyclesDone[2] += nSegment; - ZetClose(); - ZetOpen(0); - } - } - - BurnTimerEndFrameYM3812(nTotalCycles[1]); - - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - SekSetIRQLine(irqline, SEK_IRQSTATUS_AUTO); - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029702; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM3812Scan(nAction, pnMin); - DACScan(nAction, pnMin); - } - - return 0; -} - - -// Armed Formation - -static struct BurnRomInfo armedfRomDesc[] = { - { "06.3d", 0x10000, 0x0f9015e2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "01.3f", 0x10000, 0x816ff7c5, 1 | BRF_PRG | BRF_ESS }, // 1 - { "07.5d", 0x10000, 0x5b3144a5, 1 | BRF_PRG | BRF_ESS }, // 2 - { "02.4f", 0x10000, 0xfa10c29d, 1 | BRF_PRG | BRF_ESS }, // 3 - { "af_08.rom", 0x10000, 0xd1d43600, 1 | BRF_PRG | BRF_ESS }, // 4 - { "af_03.rom", 0x10000, 0xbbe1fe2d, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "af_10.rom", 0x10000, 0xc5eacb87, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code - - { "09.11c", 0x08000, 0x5c6993d5, 3 | BRF_GRA }, // 7 Characters - - { "af_04.rom", 0x10000, 0x44d3af4f, 4 | BRF_GRA }, // 8 Foreground Tiles - { "af_05.rom", 0x10000, 0x92076cab, 4 | BRF_GRA }, // 9 - - { "af_14.rom", 0x10000, 0x8c5dc5a7, 5 | BRF_GRA }, // 10 Background Tiles - { "af_13.rom", 0x10000, 0x136a58a3, 5 | BRF_GRA }, // 11 - - { "af_11.rom", 0x20000, 0xb46c473c, 6 | BRF_GRA }, // 12 Sprites - { "af_12.rom", 0x20000, 0x23cb6bfe, 6 | BRF_GRA }, // 13 -}; - -STD_ROM_PICK(armedf) -STD_ROM_FN(armedf) - -static struct BurnRomInfo armedffRomDesc[] = { - { "af_06.rom", 0x10000, 0xc5326603, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "af_01.rom", 0x10000, 0x458e9542, 1 | BRF_PRG | BRF_ESS }, // 1 - { "af_07.rom", 0x10000, 0xcc8517f5, 1 | BRF_PRG | BRF_ESS }, // 2 - { "af_02.rom", 0x10000, 0x214ef220, 1 | BRF_PRG | BRF_ESS }, // 3 - { "af_08.rom", 0x10000, 0xd1d43600, 1 | BRF_PRG | BRF_ESS }, // 4 - { "af_03.rom", 0x10000, 0xbbe1fe2d, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "af_10.rom", 0x10000, 0xc5eacb87, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code - - { "af_09.rom", 0x08000, 0x7025e92d, 3 | BRF_GRA }, // 7 Characters - - { "af_04.rom", 0x10000, 0x44d3af4f, 4 | BRF_GRA }, // 8 Foreground Tiles - { "af_05.rom", 0x10000, 0x92076cab, 4 | BRF_GRA }, // 9 - - { "af_14.rom", 0x10000, 0x8c5dc5a7, 5 | BRF_GRA }, // 10 Background Tiles - { "af_13.rom", 0x10000, 0x136a58a3, 5 | BRF_GRA }, // 11 - - { "af_11.rom", 0x20000, 0xb46c473c, 6 | BRF_GRA }, // 12 Sprites - { "af_12.rom", 0x20000, 0x23cb6bfe, 6 | BRF_GRA }, // 13 -}; - -STD_ROM_PICK(armedff) -STD_ROM_FN(armedff) - -static INT32 ArmedfLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x040001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x040000, 5, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x010000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x010000, 11, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x020000, 13, 1)) return 1; - - return 0; -} - -static INT32 ArmedfInit() -{ - scroll_type = 1; - sprite_offy = 128; - irqline = 1; - - INT32 nRet = DrvInit(ArmedfLoadRoms, Armedf68KInit, 0xf800); - - DACSetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - DACSetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -struct BurnDriver BurnDrvArmedf = { - "armedf", NULL, NULL, NULL, "1988", - "Armed Formation\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, armedfRomInfo, armedfRomName, NULL, NULL, ArmedfInputInfo, ArmedfDIPInfo, - ArmedfInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvArmedff = { - "armedff", "armedf", NULL, NULL, "1988", - "Armed Formation (Fillmore license)\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, armedffRomInfo, armedffRomName, NULL, NULL, ArmedfInputInfo, ArmedfDIPInfo, - ArmedfInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 240, 320, 3, 4 -}; - - -// missing text layer on left? - - -// Crazy Climber 2 (Japan) - -static struct BurnRomInfo cclimbr2RomDesc[] = { - { "4.bin", 0x10000, 0x7922ea14, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "1.bin", 0x10000, 0x2ac7ed67, 1 | BRF_PRG | BRF_ESS }, // 1 - { "6.bin", 0x10000, 0x7905c992, 1 | BRF_PRG | BRF_ESS }, // 2 - { "5.bin", 0x10000, 0x47be6c1e, 1 | BRF_PRG | BRF_ESS }, // 3 - { "3.bin", 0x10000, 0x1fb110d6, 1 | BRF_PRG | BRF_ESS }, // 4 - { "2.bin", 0x10000, 0x0024c15b, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "11.bin", 0x04000, 0xfe0175be, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code - { "12.bin", 0x08000, 0x5ddf18f2, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "10.bin", 0x08000, 0x7f475266, 3 | BRF_GRA }, // 8 Characters - - { "7.bin", 0x10000, 0xcbdd3906, 4 | BRF_GRA }, // 9 Foreground Tiles - { "8.bin", 0x10000, 0xb2a613c0, 4 | BRF_GRA }, // 10 - - { "17.bin", 0x10000, 0xe24bb2d7, 5 | BRF_GRA }, // 11 Background Tiles - { "18.bin", 0x10000, 0x56834554, 5 | BRF_GRA }, // 12 - - { "15.bin", 0x10000, 0x4bf838be, 6 | BRF_GRA }, // 13 Sprites - { "16.bin", 0x10000, 0x21a265c5, 6 | BRF_GRA }, // 14 - { "13.bin", 0x10000, 0x6b6ec999, 6 | BRF_GRA }, // 15 - { "14.bin", 0x10000, 0xf426a4ad, 6 | BRF_GRA }, // 16 - - { "9.bin", 0x04000, 0x740d260f, 7 | BRF_GRA | BRF_OPT }, // 17 MCU data -}; - -STD_ROM_PICK(cclimbr2) -STD_ROM_FN(cclimbr2) - -static INT32 Cclimbr2LoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x040001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x040000, 5, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 6, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x004000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x010000, 10, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x010000, 12, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x010000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x020000, 15, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x030000, 16, 1)) return 1; - - return 0; -} - -static INT32 Cclimbr2Init() -{ - scroll_type = 4; - sprite_offy = 0; - irqline = 2; - - return DrvInit(Cclimbr2LoadRoms, Cclimbr268KInit, 0xc000); -} - -struct BurnDriver BurnDrvCclimbr2 = { - "cclimbr2", NULL, NULL, NULL, "1988", - "Crazy Climber 2 (Japan)\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, cclimbr2RomInfo, cclimbr2RomName, NULL, NULL, Cclimbr2InputInfo, Cclimbr2DIPInfo, - Cclimbr2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// Crazy Climber 2 (Japan, Harder) - -static struct BurnRomInfo cclmbr2aRomDesc[] = { - { "4a.bin", 0x10000, 0xe1d3192c, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "1a.bin", 0x10000, 0x3ef84974, 1 | BRF_PRG | BRF_ESS }, // 1 - { "6.bin", 0x10000, 0x7905c992, 1 | BRF_PRG | BRF_ESS }, // 2 - { "5.bin", 0x10000, 0x47be6c1e, 1 | BRF_PRG | BRF_ESS }, // 3 - { "3.bin", 0x10000, 0x1fb110d6, 1 | BRF_PRG | BRF_ESS }, // 4 - { "2.bin", 0x10000, 0x0024c15b, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "11.bin", 0x04000, 0xfe0175be, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code - { "12.bin", 0x08000, 0x5ddf18f2, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "10.bin", 0x08000, 0x7f475266, 3 | BRF_GRA }, // 8 Characters - - { "7.bin", 0x10000, 0xcbdd3906, 4 | BRF_GRA }, // 9 Foreground Tiles - { "8.bin", 0x10000, 0xb2a613c0, 4 | BRF_GRA }, // 10 - - { "17.bin", 0x10000, 0xe24bb2d7, 5 | BRF_GRA }, // 11 Background Tiles - { "18.bin", 0x10000, 0x56834554, 5 | BRF_GRA }, // 12 - - { "15.bin", 0x10000, 0x4bf838be, 6 | BRF_GRA }, // 13 Sprites - { "16.bin", 0x10000, 0x21a265c5, 6 | BRF_GRA }, // 14 - { "13.bin", 0x10000, 0x6b6ec999, 6 | BRF_GRA }, // 15 - { "14.bin", 0x10000, 0xf426a4ad, 6 | BRF_GRA }, // 16 - - { "9.bin", 0x04000, 0x740d260f, 7 | BRF_GRA | BRF_OPT }, // 17 MCU data -}; - -STD_ROM_PICK(cclmbr2a) -STD_ROM_FN(cclmbr2a) - -struct BurnDriver BurnDrvCclmbr2a = { - "cclimbr2a", "cclimbr2", NULL, NULL, "1988", - "Crazy Climber 2 (Japan, Harder)\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, cclmbr2aRomInfo, cclmbr2aRomName, NULL, NULL, Cclimbr2InputInfo, Cclimbr2DIPInfo, - Cclimbr2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// Kozure Ookami (Japan) - -static struct BurnRomInfo kozureRomDesc[] = { - { "kozure8.6e", 0x10000, 0x6bbfb1e6, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "kozure3.6h", 0x10000, 0xf9178ec8, 1 | BRF_PRG | BRF_ESS }, // 1 - { "kozure7.5e", 0x10000, 0xa7ee09bb, 1 | BRF_PRG | BRF_ESS }, // 2 - { "kozure2.5h", 0x10000, 0x236d820f, 1 | BRF_PRG | BRF_ESS }, // 3 - { "kozure6.3e", 0x10000, 0x9120e728, 1 | BRF_PRG | BRF_ESS }, // 4 - { "kozure1.3h", 0x10000, 0x345fe7a5, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "kozure11.17k", 0x10000, 0xdba51e2d, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code - - { "kozure9.11e", 0x08000, 0xe041356e, 3 | BRF_GRA }, // 7 Characters - - { "kozure5.15h", 0x20000, 0x0b510258, 4 | BRF_GRA }, // 8 Foreground Tiles - { "kozure4.14h", 0x10000, 0xfb8e13e6, 4 | BRF_GRA }, // 9 - - { "kozure14.8a", 0x10000, 0x94a9c3d0, 5 | BRF_GRA }, // 10 Background Tiles - - { "kozure12.8d", 0x20000, 0x15f4021d, 6 | BRF_GRA }, // 11 Sprites - { "kozure13.9d", 0x20000, 0xb3b6c753, 6 | BRF_GRA }, // 12 - - { "kozure10.11c", 0x04000, 0xf48be21d, 7 | BRF_GRA | BRF_OPT }, // 13 MCU data - - { "n82s129an.11j", 0x00100, 0x81244757, 8 | BRF_OPT }, // 14 Proms -}; - -STD_ROM_PICK(kozure) -STD_ROM_FN(kozure) - -static INT32 KozureLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x040001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x040000, 5, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2, 10, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x020000, 12, 1)) return 1; - - return 0; -} - -static INT32 KozureInit() -{ - scroll_type = 2; - sprite_offy = 128; - irqline = 1; - - return DrvInit(KozureLoadRoms, Cclimbr268KInit, 0xf800); -} - -struct BurnDriver BurnDrvKozure = { - "kozure", NULL, NULL, NULL, "1987", - "Kozure Ookami (Japan)\0", "Imperfect Graphics", "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, kozureRomInfo, kozureRomName, NULL, NULL, ArmedfInputInfo, KozureDIPInfo, - KozureInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 288, 224, 4, 3 -}; - - -// Chouji Meikyuu Legion (ver 2.03) - -static struct BurnRomInfo legionRomDesc[] = { - { "lg3.bin", 0x10000, 0x777e4935, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "lg1.bin", 0x10000, 0xc4aeb724, 1 | BRF_PRG | BRF_ESS }, // 1 - { "legion.1d", 0x10000, 0xc2e45e1e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "legion.1b", 0x10000, 0xc306660a, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "legion.1h", 0x04000, 0x2ca4f7f0, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 code - - { "lg8.bin", 0x08000, 0xe0596570, 3 | BRF_GRA }, // 5 Characters - - { "legion.1e", 0x10000, 0xa9d70faf, 4 | BRF_GRA }, // 6 Foreground Tiles - { "legion.1f", 0x08000, 0xf018313b, 4 | BRF_GRA }, // 7 - - { "legion.1l", 0x10000, 0x29b8adaa, 5 | BRF_GRA }, // 8 Background Tiles - - { "legion.1k", 0x10000, 0xff5a0db9, 6 | BRF_GRA }, // 9 Sprites - { "legion.1j", 0x10000, 0xbae220c8, 6 | BRF_GRA }, // 10 - - { "lg7.bin", 0x04000, 0x533e2b58, 7 | BRF_GRA | BRF_OPT }, // 11 MCU data - - { "legion.1i", 0x08000, 0x79f4a827, 2 | BRF_OPT }, // 12 Unknown -}; - -STD_ROM_PICK(legion) -STD_ROM_FN(legion) - -static INT32 LegionLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x04000, 12, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x018000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x020000, 10, 1)) return 1; - - return 0; -} - -static INT32 LegionInit() -{ - scroll_type = 3; - sprite_offy = 0; - irqline = 2; - - INT32 nRet = DrvInit(LegionLoadRoms, Cclimbr268KInit, 0xc000); - - if (nRet == 0) { // hack - *((UINT16*)(Drv68KROM + 0x001d6)) = 0x0001; - *((UINT16*)(Drv68KROM + 0x00488)) = 0x4e71; - } - - return nRet; -} - -struct BurnDriver BurnDrvLegion = { - "legion", NULL, NULL, NULL, "1987", - "Chouji Meikyuu Legion (ver 2.03)\0", "Imperfect Graphics", "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, legionRomInfo, legionRomName, NULL, NULL, ArmedfInputInfo, LegionDIPInfo, - LegionInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 224, 288, 3, 4 -}; - - -// Chouji Meikyuu Legion (ver 1.05) - -static struct BurnRomInfo legionoRomDesc[] = { - { "legion.1c", 0x10000, 0x21226660, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "legion.1a", 0x10000, 0x8c0cda1d, 1 | BRF_PRG | BRF_ESS }, // 1 - { "legion.1d", 0x10000, 0xc2e45e1e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "legion.1b", 0x10000, 0xc306660a, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "legion.1h", 0x04000, 0x2ca4f7f0, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 code - - { "legion.1g", 0x08000, 0xc50b0125, 3 | BRF_GRA }, // 5 Characters - - { "legion.1e", 0x10000, 0xa9d70faf, 4 | BRF_GRA }, // 6 Foreground Tiles - { "legion.1f", 0x08000, 0xf018313b, 4 | BRF_GRA }, // 7 - - { "legion.1l", 0x10000, 0x29b8adaa, 5 | BRF_GRA }, // 8 Background Tiles - - { "legion.1k", 0x10000, 0xff5a0db9, 6 | BRF_GRA }, // 9 Sprites - { "legion.1j", 0x10000, 0xbae220c8, 6 | BRF_GRA }, // 10 - - { "legion.1i", 0x08000, 0x79f4a827, 0 | BRF_OPT }, // 11 Unknown -}; - -STD_ROM_PICK(legiono) -STD_ROM_FN(legiono) - -static INT32 LegionoLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x04000, 11, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x018000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x020000, 10, 1)) return 1; - - return 0; -} - -static INT32 LegionoInit() -{ - scroll_type = 6; - sprite_offy = 0; - irqline = 2; - - INT32 nRet = DrvInit(LegionoLoadRoms, Cclimbr268KInit, 0xc000); - - if (nRet == 0) { // hack - *((UINT16*)(Drv68KROM + 0x001d6)) = 0x0001; - } - - return nRet; -} - -struct BurnDriver BurnDrvLegiono = { - "legiono", "legion", NULL, NULL, "1987", - "Chouji Meikyuu Legion (ver 1.05)\0", "Imperfect Graphics", "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, legionoRomInfo, legionoRomName, NULL, NULL, ArmedfInputInfo, LegionDIPInfo, - LegionoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 224, 288, 3, 4 -}; - - -// Terra Force (set 1) - -static struct BurnRomInfo terrafRomDesc[] = { - { "8.6e", 0x10000, 0xfd58fa06, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "3.6h", 0x10000, 0x54823a7d, 1 | BRF_PRG | BRF_ESS }, // 1 - { "7.4e", 0x10000, 0xfde8de7e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "2.4h", 0x10000, 0xdb987414, 1 | BRF_PRG | BRF_ESS }, // 3 - { "6.3e", 0x10000, 0xa5bb8c3b, 1 | BRF_PRG | BRF_ESS }, // 4 - { "1.3h", 0x10000, 0xd2de6d28, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "11.17k", 0x10000, 0x4407d475, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code - - { "9.11e", 0x08000, 0xbc6f7cbc, 3 | BRF_GRA }, // 7 Characters - - { "5.15h", 0x10000, 0x25d23dfd, 4 | BRF_GRA }, // 8 Foreground Tiles - { "4.13h", 0x10000, 0xb9b0fe27, 4 | BRF_GRA }, // 9 - - { "15.8a", 0x10000, 0x2144d8e0, 5 | BRF_GRA }, // 10 Background Tiles - { "14.6a", 0x10000, 0x744f5c9e, 5 | BRF_GRA }, // 11 - - { "12.7d", 0x10000, 0x2d1f2ceb, 6 | BRF_GRA }, // 12 Sprites - { "13.9d", 0x10000, 0x1d2f92d6, 6 | BRF_GRA }, // 13 - - { "10.11c", 0x04000, 0xac705812, 7 | BRF_GRA | BRF_OPT }, // 14 MCU data - - { "n82s129an.11j", 0x00100, 0x81244757, 8 | BRF_OPT }, // 15 Proms -}; - -STD_ROM_PICK(terraf) -STD_ROM_FN(terraf) - -static INT32 TerrafInit() -{ - scroll_type = 0; - sprite_offy = 128; - irqline = 1; - - INT32 nRet = DrvInit(ArmedfLoadRoms, Cclimbr268KInit, 0xf800); - - DACSetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); - DACSetRoute(1, 0.80, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -struct BurnDriver BurnDrvTerraf = { - "terraf", NULL, NULL, NULL, "1987", - "Terra Force\0", "imperfect graphics", "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, terrafRomInfo, terrafRomName, NULL, NULL, ArmedfInputInfo, TerrafDIPInfo, - TerrafInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; - - -// Terra Force (US) - -static struct BurnRomInfo terrafuRomDesc[] = { - { "tf-8.6e", 0x10000, 0xfea6dd64, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tf-3.6h", 0x10000, 0x02f9d05a, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tf-7.4e", 0x10000, 0xfde8de7e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tf-2.4h", 0x10000, 0xdb987414, 1 | BRF_PRG | BRF_ESS }, // 3 - { "tf-6.3e", 0x08000, 0xb91e9ba3, 1 | BRF_PRG | BRF_ESS }, // 4 - { "tf-1.3h", 0x08000, 0xd6e22375, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "tf-001.17k", 0x10000, 0xeb6b4138, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code - - { "9.11e", 0x08000, 0xbc6f7cbc, 3 | BRF_GRA }, // 7 Characters - - { "5.15h", 0x10000, 0x25d23dfd, 4 | BRF_GRA }, // 8 Foreground Tiles - { "4.13h", 0x10000, 0xb9b0fe27, 4 | BRF_GRA }, // 9 - - { "15.8a", 0x10000, 0x2144d8e0, 5 | BRF_GRA }, // 10 Background Tiles - { "14.6a", 0x10000, 0x744f5c9e, 5 | BRF_GRA }, // 11 - - { "tf-003.7d", 0x10000, 0xd74085a1, 6 | BRF_GRA }, // 12 Sprites - { "tf-002.9d", 0x10000, 0x148aa0c5, 6 | BRF_GRA }, // 13 - - { "10.11c", 0x04000, 0xac705812, 7 | BRF_GRA | BRF_OPT }, // 14 MCU data - - { "n82s129an.11j", 0x00100, 0x81244757, 8 | BRF_OPT }, // 15 Proms -}; - -STD_ROM_PICK(terrafu) -STD_ROM_FN(terrafu) - -static INT32 TerrafuInit() -{ - scroll_type = 5; - sprite_offy = 128; - irqline = 1; - - INT32 nRet = DrvInit(ArmedfLoadRoms, Cclimbr268KInit, 0xf800); - - DACSetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); - DACSetRoute(1, 0.80, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -struct BurnDriver BurnDrvTerrafu = { - "terrafu", "terraf", NULL, NULL, "1987", - "Terra Force (US)\0", "imperfect graphics", "Nichibutsu USA", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, terrafuRomInfo, terrafuRomName, NULL, NULL, ArmedfInputInfo, TerrafDIPInfo, - TerrafuInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; - -// Terra Force (bootleg with additional Z80) - -static struct BurnRomInfo terrafjbRomDesc[] = { - { "tfj-8.bin", 0x10000, 0xb11a6fa7, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tfj-3.bin", 0x10000, 0x6c6aa7ed, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tfj-7.bin", 0x10000, 0xfde8de7e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tfj-2.bin", 0x10000, 0xdb987414, 1 | BRF_PRG | BRF_ESS }, // 3 - { "tfb-6.bin", 0x08000, 0x552c3c63, 1 | BRF_PRG | BRF_ESS }, // 4 - { "tfb-1.bin", 0x08000, 0x6a0b94c7, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "tf-001.17k", 0x10000, 0xeb6b4138, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 Code - - { "tfb-10.bin", 0x04000, 0x3f9aa367, 9 | BRF_PRG | BRF_ESS }, // 7 Z80 Code (Mcu replacement) - - { "9.11e", 0x08000, 0xbc6f7cbc, 3 | BRF_GRA }, // 8 Characters - - { "5.15h", 0x10000, 0x25d23dfd, 4 | BRF_GRA }, // 9 Foreground Tiles - { "4.13h", 0x10000, 0xb9b0fe27, 4 | BRF_GRA }, // 10 - - { "15.8a", 0x10000, 0x2144d8e0, 5 | BRF_GRA }, // 11 Background Tiles - { "14.6a", 0x10000, 0x744f5c9e, 5 | BRF_GRA }, // 12 - - { "tfj-12.7d", 0x10000, 0xd74085a1, 6 | BRF_GRA | BRF_OPT }, // 13 Sprites - { "tfj-13.9d", 0x10000, 0x148aa0c5, 6 | BRF_GRA | BRF_OPT }, // 14 - - { "n82s129an.11j", 0x00100, 0x81244757, 7 | BRF_OPT }, // 15 proms -}; - -STD_ROM_PICK(terrafjb) -STD_ROM_FN(terrafjb) - -static INT32 TerrafjbLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x040001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x040000, 5, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 6, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM2, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x010000, 10, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x010000, 12, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x020000, 14, 1)) return 1; - - return 0; -} - -static INT32 TerrafjbInit() -{ - scroll_type = 5; - sprite_offy = 128; - irqline = 1; - - Terrafjb = 1; - - INT32 nRet = DrvInit(TerrafjbLoadRoms, Cclimbr268KInit, 0xf800); - - DACSetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); - DACSetRoute(1, 0.80, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -struct BurnDriver BurnDrvTerrafjb = { - "terrafjb", "terraf", NULL, NULL, "1987", - "Terra Force (Japan bootleg with additional Z80)\0", "imperfect graphics", "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, terrafjbRomInfo, terrafjbRomName, NULL, NULL, ArmedfInputInfo, TerrafDIPInfo, - TerrafjbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; - -// Terra Force (set 2) - -static struct BurnRomInfo terrafbRomDesc[] = { - { "tf-014.6e", 0x10000, 0x8e5f557f, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tf-011.6h", 0x10000, 0x5320162a, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tf-013.4e", 0x10000, 0xa86951e0, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tf-010.4h", 0x10000, 0x58b5f43b, 1 | BRF_PRG | BRF_ESS }, // 3 - { "tf-012.3e", 0x08000, 0x4f0e1d76, 1 | BRF_PRG | BRF_ESS }, // 4 - { "tf-009.3h", 0x08000, 0xd1014280, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "tf-001.17k", 0x10000, 0xeb6b4138, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code - - { "9.11e", 0x08000, 0xbc6f7cbc, 3 | BRF_GRA }, // 7 Characters - - { "5.15h", 0x10000, 0x25d23dfd, 4 | BRF_GRA }, // 8 Foreground Tiles - { "4.13h", 0x10000, 0xb9b0fe27, 4 | BRF_GRA }, // 9 - - { "15.8a", 0x10000, 0x2144d8e0, 5 | BRF_GRA }, // 10 Background Tiles - { "14.6a", 0x10000, 0x744f5c9e, 5 | BRF_GRA }, // 11 - - { "tfj-12.7d", 0x10000, 0xd74085a1, 6 | BRF_GRA }, // 12 Sprites - { "tfj-13.9d", 0x10000, 0x148aa0c5, 6 | BRF_GRA }, // 13 - - { "tf-10.11c", 0x04000, 0xac705812, 7 | BRF_GRA | BRF_OPT }, // 14 MCU data - - { "n82s129an.11j", 0x00100, 0x81244757, 8 | BRF_OPT }, // 15 Proms -}; - -STD_ROM_PICK(terrafb) -STD_ROM_FN(terrafb) - -struct BurnDriver BurnDrvTerrafb = { - "terrafb", "terraf", NULL, NULL, "1987", - "Terra Force (bootleg)\0", "imperfect graphics", "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, terrafbRomInfo, terrafbRomName, NULL, NULL, ArmedfInputInfo, TerrafDIPInfo, - TerrafuInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 240, 4, 3 -}; +// FB Alpha Armed Formation driver module +// Based on MAME driver by Carlos A. Lozano, Phil Stroffolino, and Takahiro Nogi + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "dac.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *Drv68KRAM0; +static UINT8 *Drv68KRAM1; +static UINT8 *Drv68KRAM2; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvZ80ROM2; +static UINT8 *DrvZ80RAM2; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf; +static UINT8 *DrvBgRAM; +static UINT8 *DrvFgRAM; +static UINT8 *DrvTxRAM; +static UINT32 *DrvPalette; + +static UINT16*DrvMcuCmd; +static UINT16*DrvScroll; +static UINT8 *DrvVidRegs; +static UINT8 *soundlatch; +static UINT8 *flipscreen; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[2]; +static UINT16 DrvInputs[4]; +static UINT8 DrvReset; + +static INT32 scroll_type; +static INT32 sprite_offy; +static INT32 yoffset; +static INT32 xoffset; +static INT32 irqline; + +static INT32 Terrafjb = 0; + +static struct BurnInputInfo ArmedfInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 10, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 8, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 11, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 9, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 8, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy2 + 10, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Armedf) + +static struct BurnInputInfo Cclimbr2InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 10, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 8, "p1 start" }, + {"P1 Up 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down 1", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Up 2", BIT_DIGITAL, DrvJoy1 + 4, "p3 up" }, + {"P1 Down 2", BIT_DIGITAL, DrvJoy1 + 5, "p3 down" }, + {"P1 Left 2", BIT_DIGITAL, DrvJoy1 + 6, "p3 left" }, + {"P1 Right 2", BIT_DIGITAL, DrvJoy1 + 7, "p3 right" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 11, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 9, "p2 start" }, + {"P2 Up 1", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down 1", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right 1", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Up 2", BIT_DIGITAL, DrvJoy2 + 4, "p4 up" }, + {"P2 Down 2", BIT_DIGITAL, DrvJoy2 + 5, "p4 down" }, + {"P2 Left 2", BIT_DIGITAL, DrvJoy2 + 6, "p4 left" }, + {"P2 Right 2", BIT_DIGITAL, DrvJoy2 + 7, "p4 right" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 8, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy2 + 10, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Cclimbr2) + +static struct BurnDIPInfo ArmedfDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xdf, NULL }, + {0x16, 0xff, 0xff, 0xcf, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x03, "3" }, + {0x15, 0x01, 0x03, 0x02, "4" }, + {0x15, 0x01, 0x03, 0x01, "5" }, + {0x15, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2, "1st Bonus Life" }, + {0x15, 0x01, 0x04, 0x04, "20k" }, + {0x15, 0x01, 0x04, 0x00, "40k" }, + + {0 , 0xfe, 0 , 2, "2nd Bonus Life" }, + {0x15, 0x01, 0x08, 0x08, "60k" }, + {0x15, 0x01, 0x08, 0x00, "80k" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x15, 0x01, 0x0c, 0x0c, "20k then every 60k" }, + {0x15, 0x01, 0x0c, 0x04, "20k then every 80k" }, + {0x15, 0x01, 0x0c, 0x08, "40k then every 60k" }, + {0x15, 0x01, 0x0c, 0x00, "40k then every 80k" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x10, 0x00, "Off" }, + {0x15, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x15, 0x01, 0x20, 0x00, "Upright" }, + {0x15, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0xc0, 0xc0, "Easy" }, + {0x15, 0x01, 0xc0, 0x80, "Normal" }, + {0x15, 0x01, 0xc0, 0x40, "Hard" }, + {0x15, 0x01, 0xc0, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, + {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, + {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x16, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x16, 0x01, 0x0c, 0x04, "2 Coins 1 Credits" }, + {0x16, 0x01, 0x0c, 0x0c, "1 Coin 1 Credits" }, + {0x16, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, + {0x16, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Allow Continue" }, + {0x16, 0x01, 0x30, 0x30, "No" }, + {0x16, 0x01, 0x30, 0x20, "3 Times" }, + {0x16, 0x01, 0x30, 0x10, "5 Times" }, + {0x16, 0x01, 0x30, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x16, 0x01, 0x40, 0x40, "Off" }, + {0x16, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(Armedf) + +static struct BurnDIPInfo KozureDIPList[]= +{ + {0x15, 0xff, 0xff, 0xcf, NULL }, + {0x16, 0xff, 0xff, 0xcf, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x03, "3" }, + {0x15, 0x01, 0x03, 0x02, "4" }, + {0x15, 0x01, 0x03, 0x01, "5" }, + {0x15, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2, "1st Bonus Life" }, + {0x15, 0x01, 0x04, 0x04, "None" }, + {0x15, 0x01, 0x04, 0x00, "50k" }, + + {0 , 0xfe, 0 , 2, "2nd Bonus Life" }, + {0x15, 0x01, 0x08, 0x08, "60k" }, + {0x15, 0x01, 0x08, 0x00, "90k" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x15, 0x01, 0x0c, 0x08, "50k then every 60k" }, + {0x15, 0x01, 0x0c, 0x00, "50k then every 90k" }, + {0x15, 0x01, 0x0c, 0x0c, "Every 60k" }, + {0x15, 0x01, 0x0c, 0x04, "Every 90k" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x15, 0x01, 0x40, 0x40, "Easy" }, + {0x15, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 0, "Coin A" }, + {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, + {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, + {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x16, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x16, 0x01, 0x0c, 0x00, "3 Coins 1 Credits" }, + {0x16, 0x01, 0x0c, 0x04, "2 Coins 3 Credits" }, + {0x16, 0x01, 0x0c, 0x0c, "1 Coin 3 Credits" }, + {0x16, 0x01, 0x0c, 0x08, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Allow Continue" }, + {0x16, 0x01, 0x30, 0x30, "No" }, + {0x16, 0x01, 0x30, 0x20, "3 Times" }, + {0x16, 0x01, 0x30, 0x10, "5 Times" }, + {0x16, 0x01, 0x30, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4, "Allow Continue" }, + {0x16, 0x01, 0x40, 0x00, "No" }, + {0x16, 0x01, 0x40, 0x40, "Yes" }, +}; + +STDDIPINFO(Kozure) + +static struct BurnDIPInfo Cclimbr2DIPList[]= +{ + {0x17, 0xff, 0xff, 0xcf, NULL }, + {0x18, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x17, 0x01, 0x03, 0x03, "3" }, + {0x17, 0x01, 0x03, 0x02, "4" }, + {0x17, 0x01, 0x03, 0x01, "5" }, + {0x17, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2, "1st Bonus Life" }, + {0x17, 0x01, 0x04, 0x04, "30k" }, + {0x17, 0x01, 0x04, 0x00, "60k" }, + + {0 , 0xfe, 0 , 2, "2nd Bonus Life" }, + {0x17, 0x01, 0x08, 0x08, "70k" }, + {0x17, 0x01, 0x08, 0x00, "None" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x17, 0x01, 0x0c, 0x0c, "30K and 100k" }, + {0x17, 0x01, 0x0c, 0x08, "60k and 130k" }, + {0x17, 0x01, 0x0c, 0x04, "30k only" }, + {0x17, 0x01, 0x0c, 0x00, "60k only" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x17, 0x01, 0x40, 0x40, "Easy" }, + {0x17, 0x01, 0x40, 0x00, "Normal" }, + + {0 , 0xfe, 0 , 0, "Coin A" }, + {0x18, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, + {0x18, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, + {0x18, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x18, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x18, 0x01, 0x0c, 0x04, "2 Coins 1 Credits" }, + {0x18, 0x01, 0x0c, 0x0c, "1 Coin 1 Credits" }, + {0x18, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, + {0x18, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Allow Continue" }, + {0x18, 0x01, 0x10, 0x00, "No" }, + {0x18, 0x01, 0x10, 0x10, "3 Times" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x18, 0x01, 0x20, 0x20, "Off" }, + {0x18, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Partial Invulnerability (Cheat)" }, + {0x18, 0x01, 0x40, 0x40, "Off" }, + {0x18, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(Cclimbr2) + +static struct BurnDIPInfo LegionDIPList[]= +{ + {0x15, 0xff, 0xff, 0xf7, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x03, "3" }, + {0x15, 0x01, 0x03, 0x02, "4" }, + {0x15, 0x01, 0x03, 0x01, "5" }, + {0x15, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x15, 0x01, 0x04, 0x04, "30k Then Every 100k" }, + {0x15, 0x01, 0x04, 0x00, "50k Only" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x08, "Off" }, + {0x15, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x10, 0x10, "Off" }, + {0x15, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 0, "Allow Invulnerability (Cheat)" }, + {0x15, 0x01, 0x80, 0x80, "No" }, + {0x15, 0x01, 0x80, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 0, "Coin A" }, + {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, + {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, + {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x16, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Coin B" }, + {0x16, 0x01, 0x0c, 0x04, "2 Coins 1 Credits" }, + {0x16, 0x01, 0x0c, 0x0c, "1 Coin 1 Credits" }, + {0x16, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, + {0x16, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin Slots" }, + {0x16, 0x01, 0x10, 0x10, "Common" }, + {0x16, 0x01, 0x10, 0x00, "Individual" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x20, 0x20, "Easy" }, + {0x16, 0x01, 0x20, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2, "P1 Invulnerability (Cheat)" }, + {0x16, 0x01, 0x40, 0x40, "Off" }, + {0x16, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "P2 Invulnerability (Cheat)" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Legion) + +static struct BurnDIPInfo TerrafDIPList[]= +{ + {0x15, 0xff, 0xff, 0x0f, NULL }, + {0x16, 0xff, 0xff, 0x3f, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x03, "3" }, + {0x15, 0x01, 0x03, 0x02, "4" }, + {0x15, 0x01, 0x03, 0x01, "5" }, + {0x15, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2, "1st Bonus Life" }, + {0x15, 0x01, 0x04, 0x04, "20k" }, + {0x15, 0x01, 0x04, 0x00, "50k" }, + + {0 , 0xfe, 0 , 2, "2nd Bonus Life" }, + {0x15, 0x01, 0x08, 0x08, "60k" }, + {0x15, 0x01, 0x08, 0x00, "90k" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x15, 0x01, 0x0c, 0x0c, "20k then every 60k" }, + {0x15, 0x01, 0x0c, 0x04, "20k then every 90k" }, + {0x15, 0x01, 0x0c, 0x08, "50k then every 60k" }, + {0x15, 0x01, 0x0c, 0x00, "50k then every 90k" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x10, 0x10, "Off" }, + {0x15, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, + {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, + {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x16, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x16, 0x01, 0x0c, 0x04, "2 Coins 1 Credits" }, + {0x16, 0x01, 0x0c, 0x0c, "1 Coin 1 Credits" }, + {0x16, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, + {0x16, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 0, "Flip Screen" }, + {0x16, 0x01, 0x20, 0x20, "Off" }, + {0x16, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x16, 0x01, 0xc0, 0xc0, "No" }, + {0x16, 0x01, 0xc0, 0x80, "Only 3 Times" }, + {0x16, 0x01, 0xc0, 0x40, "Only 5 Times" }, + {0x16, 0x01, 0xc0, 0x00, "Yes" }, +}; + +STDDIPINFO(Terraf) + +void __fastcall armedf_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x06d000: + *DrvVidRegs = data >> 8; + *flipscreen = (data >> 12) & 1; + return; + + case 0x06d002: + DrvScroll[0] = data & 0x3ff; + return; + + case 0x06d004: + DrvScroll[1] = data & 0x1ff; + return; + + case 0x06d006: + DrvScroll[2] = data & 0x3ff; + return; + + case 0x06d008: + DrvScroll[3] = data & 0x1ff; + return; + + case 0x06d00a: + *soundlatch = ((data & 0x7f) << 1) | 1; + return; + } +} + +void __fastcall cclimbr2_write_word(UINT32 address, UINT16 data) +{ + if (scroll_type == 6 && (address & 0xffffc0) == 0x040000) { + DrvMcuCmd[(address >> 1) & 0x1f] = data; + return; + } + + switch (address) + { + case 0x7c000: + { +/* if (Terrafjb) { + // We should be using the extra Z80 - but it doesn't seem to work - the normal simulation does though + static UINT32 OldData = 0; + if ((data & 0x4000) && (OldData & 0x4000) == 0) { + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + ZetOpen(0); + } + OldData = data; + } else {*/ + if (scroll_type == 2) { + if (~data & 0x0080) { + memset (DrvTxRAM, 0xff, 0x2000); + } + } + + if (scroll_type == 0 || scroll_type == 3 || scroll_type == 5 || scroll_type == 6) { // scroll6 - hack + if (((data & 0x4100) == 0x4000 && scroll_type != 6) || + ((data & 0x4100) == 0x0000 && scroll_type == 6)) { + UINT16 *ram = (UINT16*)DrvTxRAM; + for (INT32 i = 0x10; i < 0x1000; i++) { + ram[i] = 0x0020; + } + } + } +// } + + *DrvVidRegs = data >> 8; + *flipscreen = (data >> 12) & 1; + } + return; + + case 0x7c002: + DrvScroll[0] = data & 0x3ff; + return; + + case 0x7c004: + DrvScroll[1] = data & 0x1ff; + return; + + case 0x7c00a: + *soundlatch = ((data & 0x7f) << 1) | 1; + return; + + case 0x7c00e: + if (scroll_type == 0 || scroll_type == 3 || scroll_type == 5) { + *DrvMcuCmd = data; + } + return; + } +} + +void __fastcall cclimbr2_write_byte(UINT32 address, UINT8 data) +{ + if (scroll_type != 0) return; + + switch (address) + { + case 0x7c006: + DrvMcuCmd[11] = data; + DrvMcuCmd[31] = 1; + return; + + case 0x7c008: + if (DrvMcuCmd[31]) { + DrvMcuCmd[14] = data >> 4; + DrvMcuCmd[12] = data; + } else { + DrvMcuCmd[13] = data; + } + return; + + case 0xc0000: + DrvMcuCmd[31] = 0; + return; + } +} + +UINT16 __fastcall cclimbr2_read_word(UINT32 address) +{ + switch (address) + { + case 0x78000: + return DrvInputs[0]; + + case 0x78002: + return DrvInputs[1]; + + case 0x78004: + return DrvInputs[2]; + + case 0x78006: + return DrvInputs[3]; + } + + return 0; +} + +void __fastcall armedf_write_port(UINT16 port, UINT8 data) +{ +// bprintf (PRINT_NORMAL, _T("%2.2x %2.2x\n"), port & 0xff, data); + + switch (port & 0xff) + { + case 0x00: + BurnYM3812Write(0, data); + return; + + case 0x01: + BurnYM3812Write(1, data); + return; + + case 0x02: + DACSignedWrite(0, data); + return; + + case 0x03: + DACSignedWrite(1, data); + return; + } +} + +UINT8 __fastcall armedf_read_port(UINT16 port) +{ +// bprintf (PRINT_NORMAL, _T("%2.2x read\n"), port & 0xff); + + switch (port & 0xff) + { + case 0x04: + *soundlatch = 0; + return 0; + + case 0x06: + return *soundlatch; + } + + return 0; +} + +void __fastcall terrafjbextra_write_port(UINT16 port, UINT8 data) +{ + // rendering code reads scroll values from RAM - we write the values to RAM here so that the rendering code still works +// UINT16 *RAM = (UINT16*)DrvTxRAM; + + switch (port & 0xff) { + case 0x00: { +// RAM[13] = data & 0xff; +// RAM[14] = data >> 8; + return; + } + + case 0x01: { +// RAM[11] = data & 0xff; +// RAM[12] = data >> 8; + return; + } + + case 0x02: { + /* + state->m_fg_scrolly = (((data & 0x03) >> 0) << 8) | (state->m_fg_scrolly & 0xff); + state->m_fg_scrollx = (((data & 0x0c) >> 2) << 8) | (state->m_fg_scrollx & 0xff);*/ +// RAM[12] = data;//(data & 0x03) >> 0; +// RAM[14] = data;//(data & 0x0c) >> 2; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Port write %x, %x\n"), port, data); + } + } +} + +UINT8 __fastcall terrafjbextra_read_port(UINT16 port) +{ + switch (port & 0xff) { + default: { + bprintf(PRINT_NORMAL, _T("Port read %x\n"), port); + } + } + + return 0; +} + +void __fastcall terrafjbextra_write(UINT16 address, UINT8 data) +{ + if (address >= 0x4000 && address <= 0x5fff) { + DrvTxRAM[(address ^ 1) - 0x4000] = data; + return; + } + + switch (address) { + default: { + bprintf(PRINT_NORMAL, _T("Write %x, %x\n"), address, data); + } + } +} + +UINT8 __fastcall terrafjbextra_read(UINT16 address) +{ + if (address >= 0x4000 && address <= 0x5fff) { + return DrvTxRAM[(address ^ 1) - 0x4000]; + } + + switch (address) { + default: { + bprintf(PRINT_NORMAL, _T("Read %x\n"), address); + } + } + + return 0; +} + + + + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static INT32 DrvSyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (4000000.000 / (nBurnFPS / 100.000)))); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + if (Terrafjb) { + ZetOpen(1); + ZetReset(); + ZetClose(); + } + + BurnYM3812Reset(); + DACReset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x010000; + Drv68KROM = Next; Next += 0x060000; + + DrvGfxROM0 = Next; Next += 0x010000; + DrvGfxROM1 = Next; Next += 0x080000; + DrvGfxROM2 = Next; Next += 0x080000; + DrvGfxROM3 = Next; Next += 0x080000; + + if (Terrafjb) { + DrvZ80ROM2 = Next; Next += 0x004000; + } + + DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); + + AllRam = Next; + + DrvSprRAM = Next; Next += 0x001000; + DrvSprBuf = Next; Next += 0x001000; + DrvBgRAM = Next; Next += 0x001000; + DrvFgRAM = Next; Next += 0x001000; + DrvTxRAM = Next; Next += 0x002000; + DrvPalRAM = Next; Next += 0x001000; + Drv68KRAM0 = Next; Next += 0x005000; + Drv68KRAM1 = Next; Next += 0x001000; + Drv68KRAM2 = Next; Next += 0x001000; + + flipscreen = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + DrvVidRegs = Next; Next += 0x000001; + DrvScroll = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); + DrvMcuCmd = (UINT16*)Next; Next += 0x000020 * sizeof(UINT16); + + DrvZ80RAM = Next; Next += 0x004000; + + if (Terrafjb) { + DrvZ80RAM2 = Next; Next += 0x000800; + } + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x000, 0x001, 0x002, 0x003 }; + INT32 XOffs0[16] = { 0x004, 0x000, 0x00c, 0x008, 0x014, 0x010, 0x01c, 0x018, + 0x024, 0x020, 0x02c, 0x028, 0x034, 0x030, 0x03c, 0x038 }; + INT32 YOffs0[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }; + INT32 XOffs1[16] = { 0x000004, 0x000000, 0x100004, 0x100000, 0x00000c, 0x000008, 0x10000c, 0x100008, + 0x000014, 0x000010, 0x100014, 0x100010, 0x00001c, 0x000018, 0x10001c, 0x100018 }; + INT32 YOffs1[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x08000); + + GfxDecode(0x0400, 4, 8, 8, Plane, XOffs0, YOffs0, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x40000); + + GfxDecode(0x0800, 4, 16, 16, Plane, XOffs0, YOffs1, 0x400, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x20000); + + GfxDecode(0x0400, 4, 16, 16, Plane, XOffs0, YOffs1, 0x400, tmp, DrvGfxROM2); + + memcpy (tmp, DrvGfxROM3, 0x40000); + + GfxDecode(0x0800, 4, 16, 16, Plane, XOffs1, YOffs0, 0x200, tmp, DrvGfxROM3); + + BurnFree (tmp); + + return 0; +} + +static void Armedf68KInit() +{ + SekMapMemory(Drv68KROM, 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(DrvSprRAM, 0x060000, 0x060fff, SM_RAM); + SekMapMemory(Drv68KRAM0, 0x061000, 0x065fff, SM_RAM); + SekMapMemory(DrvBgRAM, 0x066000, 0x066fff, SM_RAM); + SekMapMemory(DrvFgRAM, 0x067000, 0x067fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x068000, 0x069fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x06a000, 0x06afff, SM_RAM); + SekMapMemory(Drv68KRAM1, 0x06b000, 0x06bfff, SM_RAM); + SekMapMemory(Drv68KRAM2, 0x06c000, 0x06c7ff, SM_RAM); + SekSetWriteWordHandler(0, armedf_write_word); +} + +static void Cclimbr268KInit() +{ + SekMapMemory(Drv68KROM, 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(DrvSprRAM, 0x060000, 0x060fff, SM_RAM); + SekMapMemory(Drv68KRAM0, 0x061000, 0x063fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x064000, 0x064fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x068000, 0x069fff, SM_RAM); + SekMapMemory(Drv68KRAM1, 0x06a000, 0x06a9ff, SM_RAM); + SekMapMemory(Drv68KRAM2, 0x06c000, 0x06c9ff, SM_RAM); + SekMapMemory(DrvFgRAM, 0x070000, 0x070fff, SM_RAM); + SekMapMemory(DrvBgRAM, 0x074000, 0x074fff, SM_RAM); + SekSetWriteWordHandler(0, cclimbr2_write_word); + SekSetWriteByteHandler(0, cclimbr2_write_byte); + SekSetReadWordHandler(0, cclimbr2_read_word); +} + +static INT32 DrvInit(INT32 (*pLoadRoms)(), void (*p68KInit)(), INT32 zLen) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (pLoadRoms) { + if (pLoadRoms()) return 1; + } + + DrvGfxDecode(); + + SekInit(0, 0x68000); + SekOpen(0); + + if (p68KInit) + { + p68KInit(); + } + + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, zLen-1, 0, DrvZ80ROM); + ZetMapArea(0x0000, zLen-1, 2, DrvZ80ROM); + ZetMapArea(zLen+0, 0xffff, 0, DrvZ80RAM); + ZetMapArea(zLen+0, 0xffff, 1, DrvZ80RAM); + ZetMapArea(zLen+0, 0xffff, 2, DrvZ80RAM); + ZetSetOutHandler(armedf_write_port); + ZetSetInHandler(armedf_read_port); + ZetClose(); + + if (Terrafjb) { + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM2); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM2); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(terrafjbextra_write); + ZetSetReadHandler(terrafjbextra_read); + ZetSetOutHandler(terrafjbextra_write_port); + ZetSetInHandler(terrafjbextra_read_port); + ZetClose(); + } + + BurnYM3812Init(4000000, NULL, &DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3812(4000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); + + DACInit(0, 0, 1, DrvSyncDAC); + DACInit(1, 0, 1, DrvSyncDAC); + DACSetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); + DACSetRoute(1, 0.40, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + if (nScreenWidth == 320) { + xoffset = 96; + yoffset = 8; + } else { + xoffset = 112; + yoffset = 16; + } + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + DACExit(); + BurnYM3812Exit(); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + Terrafjb = 0; + + return 0; +} + +static inline void DrvPaletteRecalc() +{ + UINT8 r,g,b; + UINT16 *pal = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x1000 / 2; i++) { + INT32 d = pal[i]; + + r = (d >> 4) & 0xf0; + g = (d & 0xf0); + b = (d & 0x0f); + + r |= r >> 4; + g |= g >> 4; + b |= b << 4; + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static inline void AssembleInputs() +{ + memset (DrvInputs, 0xff, 2 * sizeof(INT16)); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + + DrvInputs[2] = DrvDips[0] | 0xff00; + DrvInputs[3] = DrvDips[1] | 0xff00; + + if (scroll_type == 1) { + UINT16 *ptr = (UINT16*)Drv68KRAM2; + ptr[0] = DrvInputs[0]; + ptr[1] = DrvInputs[1]; + ptr[2] = DrvInputs[2]; + ptr[3] = DrvInputs[3]; + } +} + +static void draw_layer(UINT8 *ram, UINT8 *gfxbase, INT32 scrollx, INT32 scrolly, INT32 coloff, INT32 code_and) +{ + UINT16 *vram = (UINT16*)ram; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sy = (offs & 0x1f) << 4; + INT32 sx = (offs >> 5) << 4; + sy -= scrolly + yoffset; + sx -= scrollx + xoffset; + if (sy < -15) sy += 512; + if (sx < -15) sx += 1024; + + if (sy >= nScreenHeight || sx >= nScreenWidth) continue; + + INT32 code = vram[offs] & code_and; + INT32 color = vram[offs] >> 11; + + if (*flipscreen) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, (nScreenWidth - 16) - sx, (nScreenHeight - 16) - sy, color, 4, 15, coloff, gfxbase); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, coloff, gfxbase); + } + } +} + +static void draw_txt_layer(INT32 transp) +{ + UINT16 *vram = (UINT16*)DrvTxRAM; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 ofst = 0; + INT32 ofsta = 0x400; + INT32 sx = offs & 0x3f; + INT32 sy = offs >> 6; + + if (scroll_type == 1) { + ofst = (sx << 5) | sy; + ofsta = 0x800; + } else if (scroll_type == 3 || scroll_type == 6) { + ofst = ((sx & 0x1f) << 5) | sy | ((sx >> 5) << 11); + } else { + ofst = ((sy ^ 0x1f) << 5) | (sx & 0x1f) | ((sx >> 5) << 11); + } + + sx = (sx << 3) - xoffset; + sy = (sy << 3) - yoffset; + if (scroll_type != 1) sx += 128; + + if (sx < -7 || sy < -7 || sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 attr = vram[ofst+ofsta] & 0xff; + INT32 code = (vram[ofst] & 0xff) | ((attr & 3) << 8); + + if (transp) { + if (*flipscreen) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, (nScreenWidth - 8) - sx, (nScreenHeight - 8) - sy, attr >> 4, 4, 15, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, attr >> 4, 4, 15, 0, DrvGfxROM0); + } + } else { + if (*flipscreen) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, (nScreenWidth - 8) - sx, (nScreenHeight - 8) -sy, attr >> 4, 4, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, attr >> 4, 4, 0, DrvGfxROM0); + } + } + } +} + +static void draw_sprites(INT32 priority) +{ + UINT16 *spr = (UINT16*)DrvSprBuf; + + INT32 sprlen = 0x1000; + if (scroll_type == 0 || scroll_type == 5) sprlen = 0x400; + + for (INT32 offs = 0; offs < sprlen / 2; offs+=4) + { + INT32 attr = spr[offs + 0]; + if (((attr & 0x3000) >> 12) != priority) continue; + + INT32 code = spr[offs + 1]; + INT32 flipx = code & 0x2000; + INT32 flipy = code & 0x1000; + INT32 color =(spr[offs + 2] >> 8) & 0x1f; + INT32 sx = spr[offs + 3]; + INT32 sy = sprite_offy + 240 - (attr & 0x1ff); + code &= 0xfff; + + if (*flipscreen) { + sx = 320 - sx + 176; + sy = 240 - sy + 1; + flipx = !flipx; + flipy = !flipy; + } + + sy -= yoffset; + sx -= xoffset; + + if (sx < -15 || sy < -15 || sx >= nScreenWidth || sy >= nScreenHeight) continue; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvPaletteRecalc(); + } + + for (INT32 offs = 0; offs < nScreenWidth * nScreenHeight; offs++) + pTransDraw[offs] = 0x00ff; + + INT32 txt_transp = 1; + + if (scroll_type == 0 || scroll_type == 5) { + if ((*DrvMcuCmd & 0x000f) == 0x000f) txt_transp = 0; + } + + if (scroll_type != 1) { + UINT16 *ram = (UINT16*)DrvTxRAM; + if (scroll_type == 0 || scroll_type == 6) ram = DrvMcuCmd; + + DrvScroll[2] = (ram[13] & 0xff) | ((ram[14] & 3) << 8); + DrvScroll[3] = (ram[11] & 0xff) | ((ram[12] & 1) << 8); + } + + if (*DrvVidRegs & 0x08) draw_layer(DrvBgRAM, DrvGfxROM2, DrvScroll[0], DrvScroll[1], 0x600, 0x3ff); + if ((*DrvMcuCmd & 0x30) == 0x30 && *DrvVidRegs & 0x01) draw_txt_layer(txt_transp); + if (*DrvVidRegs & 0x02) draw_sprites(2); + if ((*DrvMcuCmd & 0x30) == 0x20 && *DrvVidRegs & 0x01) draw_txt_layer(txt_transp); + if (*DrvVidRegs & 0x04) draw_layer(DrvFgRAM, DrvGfxROM1, DrvScroll[2], DrvScroll[3], 0x400, 0x7ff); + if ((*DrvMcuCmd & 0x30) == 0x10 && *DrvVidRegs & 0x01) draw_txt_layer(txt_transp); + if (*DrvVidRegs & 0x02) draw_sprites(1); + if ((*DrvMcuCmd & 0x30) == 0x00 && *DrvVidRegs & 0x01) draw_txt_layer(txt_transp); + if (*DrvVidRegs & 0x02) draw_sprites(0); + + BurnTransferCopy(DrvPalette); + + memcpy (DrvSprBuf, DrvSprRAM, 0x1000); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + SekNewFrame(); + ZetNewFrame(); + + AssembleInputs(); + + INT32 nSegment; + INT32 nInterleave = 100; + INT32 nTotalCycles[3] = { 8000000 / 60, 4000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + + INT32 Z80IRQSlice[9]; + for (INT32 i = 0; i < 9; i++) { + Z80IRQSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 10)); + } + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nNext; + + nNext = (i + 1) * nTotalCycles[0] / nInterleave; + nSegment = nNext - nCyclesDone[0]; + nSegment = SekRun(nSegment); + nCyclesDone[0] += nSegment; + + BurnTimerUpdateYM3812(i * (nTotalCycles[1] / nInterleave)); + + for (INT32 j = 0; j < 9; j++) { + if (i == Z80IRQSlice[j]) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nCyclesDone[1] += ZetRun(3000); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } + } + + if (Terrafjb) { + ZetClose(); + ZetOpen(1); + nNext = (i + 1) * nTotalCycles[2] / nInterleave; + nSegment = nNext - nCyclesDone[2]; + nSegment = ZetRun(nSegment); + nCyclesDone[2] += nSegment; + ZetClose(); + ZetOpen(0); + } + } + + BurnTimerEndFrameYM3812(nTotalCycles[1]); + + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + SekSetIRQLine(irqline, SEK_IRQSTATUS_AUTO); + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029702; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM3812Scan(nAction, pnMin); + DACScan(nAction, pnMin); + } + + return 0; +} + + +// Armed Formation + +static struct BurnRomInfo armedfRomDesc[] = { + { "06.3d", 0x10000, 0x0f9015e2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "01.3f", 0x10000, 0x816ff7c5, 1 | BRF_PRG | BRF_ESS }, // 1 + { "07.5d", 0x10000, 0x5b3144a5, 1 | BRF_PRG | BRF_ESS }, // 2 + { "02.4f", 0x10000, 0xfa10c29d, 1 | BRF_PRG | BRF_ESS }, // 3 + { "af_08.rom", 0x10000, 0xd1d43600, 1 | BRF_PRG | BRF_ESS }, // 4 + { "af_03.rom", 0x10000, 0xbbe1fe2d, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "af_10.rom", 0x10000, 0xc5eacb87, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code + + { "09.11c", 0x08000, 0x5c6993d5, 3 | BRF_GRA }, // 7 Characters + + { "af_04.rom", 0x10000, 0x44d3af4f, 4 | BRF_GRA }, // 8 Foreground Tiles + { "af_05.rom", 0x10000, 0x92076cab, 4 | BRF_GRA }, // 9 + + { "af_14.rom", 0x10000, 0x8c5dc5a7, 5 | BRF_GRA }, // 10 Background Tiles + { "af_13.rom", 0x10000, 0x136a58a3, 5 | BRF_GRA }, // 11 + + { "af_11.rom", 0x20000, 0xb46c473c, 6 | BRF_GRA }, // 12 Sprites + { "af_12.rom", 0x20000, 0x23cb6bfe, 6 | BRF_GRA }, // 13 +}; + +STD_ROM_PICK(armedf) +STD_ROM_FN(armedf) + +static struct BurnRomInfo armedffRomDesc[] = { + { "af_06.rom", 0x10000, 0xc5326603, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "af_01.rom", 0x10000, 0x458e9542, 1 | BRF_PRG | BRF_ESS }, // 1 + { "af_07.rom", 0x10000, 0xcc8517f5, 1 | BRF_PRG | BRF_ESS }, // 2 + { "af_02.rom", 0x10000, 0x214ef220, 1 | BRF_PRG | BRF_ESS }, // 3 + { "af_08.rom", 0x10000, 0xd1d43600, 1 | BRF_PRG | BRF_ESS }, // 4 + { "af_03.rom", 0x10000, 0xbbe1fe2d, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "af_10.rom", 0x10000, 0xc5eacb87, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code + + { "af_09.rom", 0x08000, 0x7025e92d, 3 | BRF_GRA }, // 7 Characters + + { "af_04.rom", 0x10000, 0x44d3af4f, 4 | BRF_GRA }, // 8 Foreground Tiles + { "af_05.rom", 0x10000, 0x92076cab, 4 | BRF_GRA }, // 9 + + { "af_14.rom", 0x10000, 0x8c5dc5a7, 5 | BRF_GRA }, // 10 Background Tiles + { "af_13.rom", 0x10000, 0x136a58a3, 5 | BRF_GRA }, // 11 + + { "af_11.rom", 0x20000, 0xb46c473c, 6 | BRF_GRA }, // 12 Sprites + { "af_12.rom", 0x20000, 0x23cb6bfe, 6 | BRF_GRA }, // 13 +}; + +STD_ROM_PICK(armedff) +STD_ROM_FN(armedff) + +static INT32 ArmedfLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x040001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x040000, 5, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x010000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x010000, 11, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x020000, 13, 1)) return 1; + + return 0; +} + +static INT32 ArmedfInit() +{ + scroll_type = 1; + sprite_offy = 128; + irqline = 1; + + INT32 nRet = DrvInit(ArmedfLoadRoms, Armedf68KInit, 0xf800); + + DACSetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + DACSetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +struct BurnDriver BurnDrvArmedf = { + "armedf", NULL, NULL, NULL, "1988", + "Armed Formation\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, armedfRomInfo, armedfRomName, NULL, NULL, ArmedfInputInfo, ArmedfDIPInfo, + ArmedfInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvArmedff = { + "armedff", "armedf", NULL, NULL, "1988", + "Armed Formation (Fillmore license)\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, armedffRomInfo, armedffRomName, NULL, NULL, ArmedfInputInfo, ArmedfDIPInfo, + ArmedfInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 240, 320, 3, 4 +}; + + +// missing text layer on left? + + +// Crazy Climber 2 (Japan) + +static struct BurnRomInfo cclimbr2RomDesc[] = { + { "4.bin", 0x10000, 0x7922ea14, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "1.bin", 0x10000, 0x2ac7ed67, 1 | BRF_PRG | BRF_ESS }, // 1 + { "6.bin", 0x10000, 0x7905c992, 1 | BRF_PRG | BRF_ESS }, // 2 + { "5.bin", 0x10000, 0x47be6c1e, 1 | BRF_PRG | BRF_ESS }, // 3 + { "3.bin", 0x10000, 0x1fb110d6, 1 | BRF_PRG | BRF_ESS }, // 4 + { "2.bin", 0x10000, 0x0024c15b, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "11.bin", 0x04000, 0xfe0175be, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code + { "12.bin", 0x08000, 0x5ddf18f2, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "10.bin", 0x08000, 0x7f475266, 3 | BRF_GRA }, // 8 Characters + + { "7.bin", 0x10000, 0xcbdd3906, 4 | BRF_GRA }, // 9 Foreground Tiles + { "8.bin", 0x10000, 0xb2a613c0, 4 | BRF_GRA }, // 10 + + { "17.bin", 0x10000, 0xe24bb2d7, 5 | BRF_GRA }, // 11 Background Tiles + { "18.bin", 0x10000, 0x56834554, 5 | BRF_GRA }, // 12 + + { "15.bin", 0x10000, 0x4bf838be, 6 | BRF_GRA }, // 13 Sprites + { "16.bin", 0x10000, 0x21a265c5, 6 | BRF_GRA }, // 14 + { "13.bin", 0x10000, 0x6b6ec999, 6 | BRF_GRA }, // 15 + { "14.bin", 0x10000, 0xf426a4ad, 6 | BRF_GRA }, // 16 + + { "9.bin", 0x04000, 0x740d260f, 7 | BRF_GRA | BRF_OPT }, // 17 MCU data +}; + +STD_ROM_PICK(cclimbr2) +STD_ROM_FN(cclimbr2) + +static INT32 Cclimbr2LoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x040001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x040000, 5, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 6, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x004000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x010000, 10, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x010000, 12, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x010000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x020000, 15, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x030000, 16, 1)) return 1; + + return 0; +} + +static INT32 Cclimbr2Init() +{ + scroll_type = 4; + sprite_offy = 0; + irqline = 2; + + return DrvInit(Cclimbr2LoadRoms, Cclimbr268KInit, 0xc000); +} + +struct BurnDriver BurnDrvCclimbr2 = { + "cclimbr2", NULL, NULL, NULL, "1988", + "Crazy Climber 2 (Japan)\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, cclimbr2RomInfo, cclimbr2RomName, NULL, NULL, Cclimbr2InputInfo, Cclimbr2DIPInfo, + Cclimbr2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// Crazy Climber 2 (Japan, Harder) + +static struct BurnRomInfo cclmbr2aRomDesc[] = { + { "4a.bin", 0x10000, 0xe1d3192c, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "1a.bin", 0x10000, 0x3ef84974, 1 | BRF_PRG | BRF_ESS }, // 1 + { "6.bin", 0x10000, 0x7905c992, 1 | BRF_PRG | BRF_ESS }, // 2 + { "5.bin", 0x10000, 0x47be6c1e, 1 | BRF_PRG | BRF_ESS }, // 3 + { "3.bin", 0x10000, 0x1fb110d6, 1 | BRF_PRG | BRF_ESS }, // 4 + { "2.bin", 0x10000, 0x0024c15b, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "11.bin", 0x04000, 0xfe0175be, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code + { "12.bin", 0x08000, 0x5ddf18f2, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "10.bin", 0x08000, 0x7f475266, 3 | BRF_GRA }, // 8 Characters + + { "7.bin", 0x10000, 0xcbdd3906, 4 | BRF_GRA }, // 9 Foreground Tiles + { "8.bin", 0x10000, 0xb2a613c0, 4 | BRF_GRA }, // 10 + + { "17.bin", 0x10000, 0xe24bb2d7, 5 | BRF_GRA }, // 11 Background Tiles + { "18.bin", 0x10000, 0x56834554, 5 | BRF_GRA }, // 12 + + { "15.bin", 0x10000, 0x4bf838be, 6 | BRF_GRA }, // 13 Sprites + { "16.bin", 0x10000, 0x21a265c5, 6 | BRF_GRA }, // 14 + { "13.bin", 0x10000, 0x6b6ec999, 6 | BRF_GRA }, // 15 + { "14.bin", 0x10000, 0xf426a4ad, 6 | BRF_GRA }, // 16 + + { "9.bin", 0x04000, 0x740d260f, 7 | BRF_GRA | BRF_OPT }, // 17 MCU data +}; + +STD_ROM_PICK(cclmbr2a) +STD_ROM_FN(cclmbr2a) + +struct BurnDriver BurnDrvCclmbr2a = { + "cclimbr2a", "cclimbr2", NULL, NULL, "1988", + "Crazy Climber 2 (Japan, Harder)\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, cclmbr2aRomInfo, cclmbr2aRomName, NULL, NULL, Cclimbr2InputInfo, Cclimbr2DIPInfo, + Cclimbr2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// Kozure Ookami (Japan) + +static struct BurnRomInfo kozureRomDesc[] = { + { "kozure8.6e", 0x10000, 0x6bbfb1e6, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "kozure3.6h", 0x10000, 0xf9178ec8, 1 | BRF_PRG | BRF_ESS }, // 1 + { "kozure7.5e", 0x10000, 0xa7ee09bb, 1 | BRF_PRG | BRF_ESS }, // 2 + { "kozure2.5h", 0x10000, 0x236d820f, 1 | BRF_PRG | BRF_ESS }, // 3 + { "kozure6.3e", 0x10000, 0x9120e728, 1 | BRF_PRG | BRF_ESS }, // 4 + { "kozure1.3h", 0x10000, 0x345fe7a5, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "kozure11.17k", 0x10000, 0xdba51e2d, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code + + { "kozure9.11e", 0x08000, 0xe041356e, 3 | BRF_GRA }, // 7 Characters + + { "kozure5.15h", 0x20000, 0x0b510258, 4 | BRF_GRA }, // 8 Foreground Tiles + { "kozure4.14h", 0x10000, 0xfb8e13e6, 4 | BRF_GRA }, // 9 + + { "kozure14.8a", 0x10000, 0x94a9c3d0, 5 | BRF_GRA }, // 10 Background Tiles + + { "kozure12.8d", 0x20000, 0x15f4021d, 6 | BRF_GRA }, // 11 Sprites + { "kozure13.9d", 0x20000, 0xb3b6c753, 6 | BRF_GRA }, // 12 + + { "kozure10.11c", 0x04000, 0xf48be21d, 7 | BRF_GRA | BRF_OPT }, // 13 MCU data + + { "n82s129an.11j", 0x00100, 0x81244757, 8 | BRF_OPT }, // 14 Proms +}; + +STD_ROM_PICK(kozure) +STD_ROM_FN(kozure) + +static INT32 KozureLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x040001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x040000, 5, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2, 10, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x020000, 12, 1)) return 1; + + return 0; +} + +static INT32 KozureInit() +{ + scroll_type = 2; + sprite_offy = 128; + irqline = 1; + + return DrvInit(KozureLoadRoms, Cclimbr268KInit, 0xf800); +} + +struct BurnDriver BurnDrvKozure = { + "kozure", NULL, NULL, NULL, "1987", + "Kozure Ookami (Japan)\0", "Imperfect Graphics", "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, kozureRomInfo, kozureRomName, NULL, NULL, ArmedfInputInfo, KozureDIPInfo, + KozureInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 288, 224, 4, 3 +}; + + +// Chouji Meikyuu Legion (ver 2.03) + +static struct BurnRomInfo legionRomDesc[] = { + { "lg3.bin", 0x10000, 0x777e4935, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "lg1.bin", 0x10000, 0xc4aeb724, 1 | BRF_PRG | BRF_ESS }, // 1 + { "legion.1d", 0x10000, 0xc2e45e1e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "legion.1b", 0x10000, 0xc306660a, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "legion.1h", 0x04000, 0x2ca4f7f0, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 code + + { "lg8.bin", 0x08000, 0xe0596570, 3 | BRF_GRA }, // 5 Characters + + { "legion.1e", 0x10000, 0xa9d70faf, 4 | BRF_GRA }, // 6 Foreground Tiles + { "legion.1f", 0x08000, 0xf018313b, 4 | BRF_GRA }, // 7 + + { "legion.1l", 0x10000, 0x29b8adaa, 5 | BRF_GRA }, // 8 Background Tiles + + { "legion.1k", 0x10000, 0xff5a0db9, 6 | BRF_GRA }, // 9 Sprites + { "legion.1j", 0x10000, 0xbae220c8, 6 | BRF_GRA }, // 10 + + { "lg7.bin", 0x04000, 0x533e2b58, 7 | BRF_GRA | BRF_OPT }, // 11 MCU data + + { "legion.1i", 0x08000, 0x79f4a827, 2 | BRF_OPT }, // 12 Unknown +}; + +STD_ROM_PICK(legion) +STD_ROM_FN(legion) + +static INT32 LegionLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x04000, 12, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x018000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x020000, 10, 1)) return 1; + + return 0; +} + +static INT32 LegionInit() +{ + scroll_type = 3; + sprite_offy = 0; + irqline = 2; + + INT32 nRet = DrvInit(LegionLoadRoms, Cclimbr268KInit, 0xc000); + + if (nRet == 0) { // hack + *((UINT16*)(Drv68KROM + 0x001d6)) = 0x0001; + *((UINT16*)(Drv68KROM + 0x00488)) = 0x4e71; + } + + return nRet; +} + +struct BurnDriver BurnDrvLegion = { + "legion", NULL, NULL, NULL, "1987", + "Chouji Meikyuu Legion (ver 2.03)\0", "Imperfect Graphics", "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, legionRomInfo, legionRomName, NULL, NULL, ArmedfInputInfo, LegionDIPInfo, + LegionInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 224, 288, 3, 4 +}; + + +// Chouji Meikyuu Legion (ver 1.05) + +static struct BurnRomInfo legionoRomDesc[] = { + { "legion.1c", 0x10000, 0x21226660, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "legion.1a", 0x10000, 0x8c0cda1d, 1 | BRF_PRG | BRF_ESS }, // 1 + { "legion.1d", 0x10000, 0xc2e45e1e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "legion.1b", 0x10000, 0xc306660a, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "legion.1h", 0x04000, 0x2ca4f7f0, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 code + + { "legion.1g", 0x08000, 0xc50b0125, 3 | BRF_GRA }, // 5 Characters + + { "legion.1e", 0x10000, 0xa9d70faf, 4 | BRF_GRA }, // 6 Foreground Tiles + { "legion.1f", 0x08000, 0xf018313b, 4 | BRF_GRA }, // 7 + + { "legion.1l", 0x10000, 0x29b8adaa, 5 | BRF_GRA }, // 8 Background Tiles + + { "legion.1k", 0x10000, 0xff5a0db9, 6 | BRF_GRA }, // 9 Sprites + { "legion.1j", 0x10000, 0xbae220c8, 6 | BRF_GRA }, // 10 + + { "legion.1i", 0x08000, 0x79f4a827, 0 | BRF_OPT }, // 11 Unknown +}; + +STD_ROM_PICK(legiono) +STD_ROM_FN(legiono) + +static INT32 LegionoLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x04000, 11, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x018000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x020000, 10, 1)) return 1; + + return 0; +} + +static INT32 LegionoInit() +{ + scroll_type = 6; + sprite_offy = 0; + irqline = 2; + + INT32 nRet = DrvInit(LegionoLoadRoms, Cclimbr268KInit, 0xc000); + + if (nRet == 0) { // hack + *((UINT16*)(Drv68KROM + 0x001d6)) = 0x0001; + } + + return nRet; +} + +struct BurnDriver BurnDrvLegiono = { + "legiono", "legion", NULL, NULL, "1987", + "Chouji Meikyuu Legion (ver 1.05)\0", "Imperfect Graphics", "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, legionoRomInfo, legionoRomName, NULL, NULL, ArmedfInputInfo, LegionDIPInfo, + LegionoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 224, 288, 3, 4 +}; + + +// Terra Force (set 1) + +static struct BurnRomInfo terrafRomDesc[] = { + { "8.6e", 0x10000, 0xfd58fa06, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "3.6h", 0x10000, 0x54823a7d, 1 | BRF_PRG | BRF_ESS }, // 1 + { "7.4e", 0x10000, 0xfde8de7e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "2.4h", 0x10000, 0xdb987414, 1 | BRF_PRG | BRF_ESS }, // 3 + { "6.3e", 0x10000, 0xa5bb8c3b, 1 | BRF_PRG | BRF_ESS }, // 4 + { "1.3h", 0x10000, 0xd2de6d28, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "11.17k", 0x10000, 0x4407d475, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code + + { "9.11e", 0x08000, 0xbc6f7cbc, 3 | BRF_GRA }, // 7 Characters + + { "5.15h", 0x10000, 0x25d23dfd, 4 | BRF_GRA }, // 8 Foreground Tiles + { "4.13h", 0x10000, 0xb9b0fe27, 4 | BRF_GRA }, // 9 + + { "15.8a", 0x10000, 0x2144d8e0, 5 | BRF_GRA }, // 10 Background Tiles + { "14.6a", 0x10000, 0x744f5c9e, 5 | BRF_GRA }, // 11 + + { "12.7d", 0x10000, 0x2d1f2ceb, 6 | BRF_GRA }, // 12 Sprites + { "13.9d", 0x10000, 0x1d2f92d6, 6 | BRF_GRA }, // 13 + + { "10.11c", 0x04000, 0xac705812, 7 | BRF_GRA | BRF_OPT }, // 14 MCU data + + { "n82s129an.11j", 0x00100, 0x81244757, 8 | BRF_OPT }, // 15 Proms +}; + +STD_ROM_PICK(terraf) +STD_ROM_FN(terraf) + +static INT32 TerrafInit() +{ + scroll_type = 0; + sprite_offy = 128; + irqline = 1; + + INT32 nRet = DrvInit(ArmedfLoadRoms, Cclimbr268KInit, 0xf800); + + DACSetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); + DACSetRoute(1, 0.80, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +struct BurnDriver BurnDrvTerraf = { + "terraf", NULL, NULL, NULL, "1987", + "Terra Force\0", "imperfect graphics", "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, terrafRomInfo, terrafRomName, NULL, NULL, ArmedfInputInfo, TerrafDIPInfo, + TerrafInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; + + +// Terra Force (US) + +static struct BurnRomInfo terrafuRomDesc[] = { + { "tf-8.6e", 0x10000, 0xfea6dd64, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tf-3.6h", 0x10000, 0x02f9d05a, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tf-7.4e", 0x10000, 0xfde8de7e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tf-2.4h", 0x10000, 0xdb987414, 1 | BRF_PRG | BRF_ESS }, // 3 + { "tf-6.3e", 0x08000, 0xb91e9ba3, 1 | BRF_PRG | BRF_ESS }, // 4 + { "tf-1.3h", 0x08000, 0xd6e22375, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "tf-001.17k", 0x10000, 0xeb6b4138, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code + + { "9.11e", 0x08000, 0xbc6f7cbc, 3 | BRF_GRA }, // 7 Characters + + { "5.15h", 0x10000, 0x25d23dfd, 4 | BRF_GRA }, // 8 Foreground Tiles + { "4.13h", 0x10000, 0xb9b0fe27, 4 | BRF_GRA }, // 9 + + { "15.8a", 0x10000, 0x2144d8e0, 5 | BRF_GRA }, // 10 Background Tiles + { "14.6a", 0x10000, 0x744f5c9e, 5 | BRF_GRA }, // 11 + + { "tf-003.7d", 0x10000, 0xd74085a1, 6 | BRF_GRA }, // 12 Sprites + { "tf-002.9d", 0x10000, 0x148aa0c5, 6 | BRF_GRA }, // 13 + + { "10.11c", 0x04000, 0xac705812, 7 | BRF_GRA | BRF_OPT }, // 14 MCU data + + { "n82s129an.11j", 0x00100, 0x81244757, 8 | BRF_OPT }, // 15 Proms +}; + +STD_ROM_PICK(terrafu) +STD_ROM_FN(terrafu) + +static INT32 TerrafuInit() +{ + scroll_type = 5; + sprite_offy = 128; + irqline = 1; + + INT32 nRet = DrvInit(ArmedfLoadRoms, Cclimbr268KInit, 0xf800); + + DACSetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); + DACSetRoute(1, 0.80, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +struct BurnDriver BurnDrvTerrafu = { + "terrafu", "terraf", NULL, NULL, "1987", + "Terra Force (US)\0", "imperfect graphics", "Nichibutsu USA", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, terrafuRomInfo, terrafuRomName, NULL, NULL, ArmedfInputInfo, TerrafDIPInfo, + TerrafuInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; + +// Terra Force (bootleg with additional Z80) + +static struct BurnRomInfo terrafjbRomDesc[] = { + { "tfj-8.bin", 0x10000, 0xb11a6fa7, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tfj-3.bin", 0x10000, 0x6c6aa7ed, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tfj-7.bin", 0x10000, 0xfde8de7e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tfj-2.bin", 0x10000, 0xdb987414, 1 | BRF_PRG | BRF_ESS }, // 3 + { "tfb-6.bin", 0x08000, 0x552c3c63, 1 | BRF_PRG | BRF_ESS }, // 4 + { "tfb-1.bin", 0x08000, 0x6a0b94c7, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "tf-001.17k", 0x10000, 0xeb6b4138, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 Code + + { "tfb-10.bin", 0x04000, 0x3f9aa367, 9 | BRF_PRG | BRF_ESS }, // 7 Z80 Code (Mcu replacement) + + { "9.11e", 0x08000, 0xbc6f7cbc, 3 | BRF_GRA }, // 8 Characters + + { "5.15h", 0x10000, 0x25d23dfd, 4 | BRF_GRA }, // 9 Foreground Tiles + { "4.13h", 0x10000, 0xb9b0fe27, 4 | BRF_GRA }, // 10 + + { "15.8a", 0x10000, 0x2144d8e0, 5 | BRF_GRA }, // 11 Background Tiles + { "14.6a", 0x10000, 0x744f5c9e, 5 | BRF_GRA }, // 12 + + { "tfj-12.7d", 0x10000, 0xd74085a1, 6 | BRF_GRA | BRF_OPT }, // 13 Sprites + { "tfj-13.9d", 0x10000, 0x148aa0c5, 6 | BRF_GRA | BRF_OPT }, // 14 + + { "n82s129an.11j", 0x00100, 0x81244757, 7 | BRF_OPT }, // 15 proms +}; + +STD_ROM_PICK(terrafjb) +STD_ROM_FN(terrafjb) + +static INT32 TerrafjbLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x040001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x040000, 5, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 6, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM2, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x010000, 10, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x010000, 12, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x020000, 14, 1)) return 1; + + return 0; +} + +static INT32 TerrafjbInit() +{ + scroll_type = 5; + sprite_offy = 128; + irqline = 1; + + Terrafjb = 1; + + INT32 nRet = DrvInit(TerrafjbLoadRoms, Cclimbr268KInit, 0xf800); + + DACSetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); + DACSetRoute(1, 0.80, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +struct BurnDriver BurnDrvTerrafjb = { + "terrafjb", "terraf", NULL, NULL, "1987", + "Terra Force (Japan bootleg with additional Z80)\0", "imperfect graphics", "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, terrafjbRomInfo, terrafjbRomName, NULL, NULL, ArmedfInputInfo, TerrafDIPInfo, + TerrafjbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; + +// Terra Force (set 2) + +static struct BurnRomInfo terrafbRomDesc[] = { + { "tf-014.6e", 0x10000, 0x8e5f557f, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tf-011.6h", 0x10000, 0x5320162a, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tf-013.4e", 0x10000, 0xa86951e0, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tf-010.4h", 0x10000, 0x58b5f43b, 1 | BRF_PRG | BRF_ESS }, // 3 + { "tf-012.3e", 0x08000, 0x4f0e1d76, 1 | BRF_PRG | BRF_ESS }, // 4 + { "tf-009.3h", 0x08000, 0xd1014280, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "tf-001.17k", 0x10000, 0xeb6b4138, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 code + + { "9.11e", 0x08000, 0xbc6f7cbc, 3 | BRF_GRA }, // 7 Characters + + { "5.15h", 0x10000, 0x25d23dfd, 4 | BRF_GRA }, // 8 Foreground Tiles + { "4.13h", 0x10000, 0xb9b0fe27, 4 | BRF_GRA }, // 9 + + { "15.8a", 0x10000, 0x2144d8e0, 5 | BRF_GRA }, // 10 Background Tiles + { "14.6a", 0x10000, 0x744f5c9e, 5 | BRF_GRA }, // 11 + + { "tfj-12.7d", 0x10000, 0xd74085a1, 6 | BRF_GRA }, // 12 Sprites + { "tfj-13.9d", 0x10000, 0x148aa0c5, 6 | BRF_GRA }, // 13 + + { "tf-10.11c", 0x04000, 0xac705812, 7 | BRF_GRA | BRF_OPT }, // 14 MCU data + + { "n82s129an.11j", 0x00100, 0x81244757, 8 | BRF_OPT }, // 15 Proms +}; + +STD_ROM_PICK(terrafb) +STD_ROM_FN(terrafb) + +struct BurnDriver BurnDrvTerrafb = { + "terrafb", "terraf", NULL, NULL, "1987", + "Terra Force (bootleg)\0", "imperfect graphics", "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, terrafbRomInfo, terrafbRomName, NULL, NULL, ArmedfInputInfo, TerrafDIPInfo, + TerrafuInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_aztarac.cpp b/src/burn/drv/pre90s/d_aztarac.cpp index 3c294ec1e..341d9b5f4 100644 --- a/src/burn/drv/pre90s/d_aztarac.cpp +++ b/src/burn/drv/pre90s/d_aztarac.cpp @@ -1,636 +1,635 @@ -// FB Alpha Aztarac driver module -// Based on MAME driver by Mathis Rosenhauer - -#include "burnint.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "vector.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvVecRAM; -static UINT8 *DrvNVRAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static INT32 sound_irq_timer; -static INT32 sound_status; - -static INT32 sound_initialized = 0; -static INT16 *pFMBuffer[12]; - -static INT32 xcenter; -static INT32 ycenter; - -static INT32 watchdog; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvInputs[1]; -static UINT8 DrvReset; - -static INT16 DrvAnalogPort0; -static INT16 DrvAnalogPort1; - -static UINT8 xAxis = 0; -static UINT8 yAxis = 0; -static UINT8 Dial = 0; -static UINT8 DialInputs[2]; - -#define A(a, b, c, d) {a, b, (UINT8*)(c), d} - -static struct BurnInputInfo AztaracInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 2" }, - - A("Left/Right", BIT_ANALOG_REL, &DrvAnalogPort0, "p1 x-axis" ), - A("Up/Down", BIT_ANALOG_REL, &DrvAnalogPort1, "p1 y-axis" ), - {"Aim Left", BIT_DIGITAL, DialInputs + 0, "p1 fire 3" }, - {"Aim Right", BIT_DIGITAL, DialInputs + 1, "p1 fire 4" }, - - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 7, "service" }, -}; - -STDINPUTINFO(Aztarac) - -#undef A - -static inline void read_vectorram (INT32 addr, INT32 *x, INT32 *y, INT32 *c) -{ - *c = SekReadWord(0xff8000 + addr); - *x = SekReadWord(0xff9000 + addr) & 0x03ff; - *y = SekReadWord(0xffa000 + addr) & 0x03ff; - if (*x & 0x200) *x |= 0xfffffc00; // signed - if (*y & 0x200) *y |= 0xfffffc00; // signed -} - -static void aztarac_process_vector_list() -{ - INT32 x, y, c, intensity, xoffset, yoffset, color; - INT32 defaddr, objaddr, ndefs; - - vector_reset(); - - for (objaddr = 0; objaddr < 0x800; objaddr++) - { - read_vectorram (objaddr * 2, &xoffset, &yoffset, &c); - - if (c & 0x4000) break; - - if ((c & 0x2000) == 0) - { - defaddr = (c >> 1) & 0x7ff; - - vector_add_point((xcenter + (xoffset << 16)), (ycenter - (yoffset << 16)), 0, 0); - - read_vectorram (defaddr * 2, &x, &ndefs, &c); - ndefs++; - - if (c & 0xff00) - { - intensity = (c >> 8); - color = c & 0x3f; - - while (ndefs--) - { - defaddr++; - read_vectorram (defaddr * 2, &x, &y, &c); - - if ((c & 0xff00) == 0) - vector_add_point((xcenter + ((x + xoffset) << 16)), (ycenter - ((y + yoffset) << 16)), 0, 0); - else - vector_add_point((xcenter + ((x + xoffset) << 16)), (ycenter - ((y + yoffset) << 16)), color, intensity); - } - } - else - { - while (ndefs--) - { - defaddr++; - read_vectorram (defaddr * 2, &x, &y, &c); - - color = c & 0x3f; - vector_add_point((xcenter + ((x + xoffset) << 16)), (ycenter - ((y + yoffset) << 16)), color, c >> 8); - } - } - } - } -} - -static inline void sync_cpu() -{ - INT32 cycles = (SekTotalCycles() / 4) - ZetTotalCycles(); - - if (cycles > 0) ZetRun(cycles); -} - -void __fastcall aztarac_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfffff00) == 0x022000) { - *((UINT16*)(DrvNVRAM + (address & 0xfe))) = data | 0xfff0; - return; - } - - if (address == 0xffb000) { - if (data) aztarac_process_vector_list(); // used once? - return; - } -} - -void __fastcall aztarac_write_byte(UINT32 address, UINT8 data) -{ - if (address == 0x027009) { - sync_cpu(); - *soundlatch = data; - sound_status ^= 0x21; - - if (sound_status & 0x20) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - - return; - } - - if (address == 0xffb001) { - if (data) aztarac_process_vector_list(); - return; - } -} - -UINT16 __fastcall aztarac_read_word(UINT32 address) -{ - switch (address) - { - case 0x027004: - return 0xff00 | DrvInputs[0]; - - case 0x02700e: - watchdog = 0; - return 0; - } - - return 0; -} - -UINT8 __fastcall aztarac_read_byte(UINT32 address) -{ - switch (address) - { - case 0x027000: - return xAxis - 0x0f; - - case 0x027001: - return yAxis - 0x0f; - - case 0x027005: - return DrvInputs[0]; // inputs - - case 0x027009: - sync_cpu(); - return sound_status & 0x01; - - case 0x02700d: - return Dial; - } - - return 0; -} - -void __fastcall aztarac_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8c00: - case 0x8c01: - case 0x8c02: - case 0x8c03: - case 0x8c04: - case 0x8c05: - case 0x8c06: - case 0x8c07: - AY8910Write((address & 6) / 2, ~address & 1, data); - return; - - case 0x9000: - sound_status &= ~0x10; - return; - } -} - -UINT8 __fastcall aztarac_sound_read(UINT16 address) -{ - switch (address) - { - case 0x8800: - sound_status = (sound_status | 0x01) & ~0x20; - return *soundlatch; - - case 0x8c00: - case 0x8c01: - case 0x8c02: - case 0x8c03: - case 0x8c04: - case 0x8c05: - case 0x8c06: - case 0x8c07: - return AY8910Read((address & 6) / 2); - - case 0x9000: - return sound_status & ~0x01; - } - - return 0; -} - -static INT32 __fastcall aztarac_irq_callback(INT32) -{ - return 0x0c; -} - -static INT32 DrvDoReset(INT32 reset_ram) -{ - if (reset_ram) { - memset (AllRam, 0, RamEnd - AllRam); - } - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - AY8910Reset(1); - AY8910Reset(2); - AY8910Reset(3); - - sound_status = 0; - sound_irq_timer = 0; - - watchdog = 0; - - vector_reset(); - - return 0; -} - -static void sound_init() // Changed refresh rate causes crashes -{ - for (INT32 i = 0; i < 12; i++) { - pFMBuffer[i] = (INT16*)BurnMalloc(nBurnSoundLen * sizeof(INT16)); - } - - sound_initialized = 1; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x010000; - DrvZ80ROM = Next; Next += 0x002000; - - DrvNVRAM = Next; Next += 0x000400; - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x002000; - DrvZ80RAM = Next; Next += 0x000800; - DrvVecRAM = Next; Next += 0x003000; - - soundlatch = Next; Next += 0x000001; - - RamEnd = Next; - - DrvPalette = (UINT32*)Next; Next += 0x0040 * 256 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0; i < 0x40; i++) // color - { - for (INT32 j = 0; j < 256; j++) // intensity - { - INT32 r = (i >> 4) & 3; - r = (r << 6) | (r << 4) | (r << 2) | (r << 0); - - INT32 g = (i >> 2) & 3; - g = (g << 6) | (g << 4) | (g << 2) | (g << 0); - - INT32 b = (i >> 0) & 3; - b = (b << 6) | (b << 4) | (b << 2) | (b << 0); - - r = (r * j) / 255; - g = (g * j) / 255; - b = (b * j) / 255; - - DrvPalette[i * 256 + j] = (r << 16) | (g << 8) | b; - } - } -} - -static INT32 DrvInit() -{ - BurnSetRefreshRate(40.0); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x02001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x02000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x04001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x04000, 5, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x06001, 6, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x06000, 7, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x08001, 8, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x08000, 9, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x0a001, 10, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x0a000, 11, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 12, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x01000, 13, 1)) return 1; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekSetIrqCallback(aztarac_irq_callback); - SekMapMemory(Drv68KROM, 0x000000, 0x00bfff, SM_ROM); - SekMapMemory(DrvNVRAM, 0x022000, 0x0223ff, SM_ROM); - SekMapMemory(DrvVecRAM, 0xff8000, 0xffafff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xffe000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, aztarac_write_word); - SekSetWriteByteHandler(0, aztarac_write_byte); - SekSetReadWordHandler(0, aztarac_read_word); - SekSetReadByteHandler(0, aztarac_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x1fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x1fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(aztarac_sound_write); - ZetSetReadHandler(aztarac_sound_read); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(2, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(3, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.15, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.15, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(2, 0.15, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(3, 0.15, BURN_SND_ROUTE_BOTH); - - DrvPaletteInit(); - - vector_init(); - - xcenter = (1024 / 2) << 16; - ycenter = ( 768 / 2) << 16; - - memset (DrvNVRAM, 0xff, 0x100); - - DrvDoReset(1); - - return 0; -} - -static INT32 DrvExit() -{ - vector_exit(); - - SekExit(); - ZetExit(); - - AY8910Exit(0); - AY8910Exit(1); - AY8910Exit(2); - AY8910Exit(3); - - BurnFree (AllMem); - - sound_initialized = 0; - for (INT32 i = 0; i < 12; i++) { - BurnFree (pFMBuffer[i]); - } - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvPaletteInit(); - DrvRecalc = 0; - } - - draw_vector(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (sound_initialized == 0) { - if (pBurnSoundOut) { - sound_init(); - } - } - - if (DrvReset) { - DrvDoReset(1); - } - - watchdog++; - if (watchdog == 180) { // 3 seconds? - DrvDoReset(0); - } - - SekNewFrame(); - ZetNewFrame(); - - { - DrvInputs[0] = 0xff; - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - } - - xAxis = (DrvAnalogPort0 >> 7) + 0x0f; - if (xAxis > 0x80) xAxis = 0; - - yAxis = (~DrvAnalogPort1 >> 7) + 0x10; - if (yAxis > 0x1d) yAxis = 0x1d; - - if (DialInputs[0]) { - Dial += 0x04; - } else { - if (DialInputs[1]) { - Dial -= 0x04; - } - } - } - - INT32 nInterleave = 100; - INT32 nCyclesTotal[2] = { 8000000 / 40, 2000000 / 40 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++, sound_irq_timer++) - { - nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); - if (i == (nInterleave - 1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - //nCyclesDone[1] += ZetRun((SekTotalCycles() / 4) - ZetTotalCycles()); - sync_cpu(); - - if ((sound_irq_timer % 40) == 39) { // every 20000 cycles, 50000 / frame - sound_status ^= 0x10; - if (sound_status & 0x10) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - } - - SekClose(); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pFMBuffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029698; - } - - if (nAction & ACB_MEMORY_ROM) { - ba.Data = Drv68KROM; - ba.nLen = 0x000c000; - ba.nAddress = 0x0000000; - ba.szName = "68K ROM"; - BurnAcb(&ba); - - ba.Data = DrvZ80ROM; - ba.nLen = 0x0002000; - ba.nAddress = 0x0000000; - ba.szName = "Z80 ROM"; - BurnAcb(&ba); - } - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = Drv68KRAM; - ba.nLen = 0x0002000; - ba.nAddress = 0x0ffe000; - ba.szName = "68K RAM"; - BurnAcb(&ba); - - ba.Data = DrvVecRAM; - ba.nLen = 0x0003000; - ba.nAddress = 0x0ff8000; - ba.szName = "Vector RAM"; - BurnAcb(&ba); - - ba.Data = DrvZ80RAM; - ba.nLen = 0x0000800; - ba.nAddress = 0x0000000; - ba.szName = "Z80 RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_NVRAM) { - ba.Data = DrvNVRAM; - ba.nLen = 0x000100; - ba.nAddress = 0x022000; - ba.szName = "NV RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - AY8910Scan(nAction, pnMin); - - SCAN_VAR(*soundlatch); - SCAN_VAR(sound_irq_timer); - SCAN_VAR(sound_status); - } - - vector_scan(nAction); - - return 0; -} - - -// Aztarac - -static struct BurnRomInfo aztaracRomDesc[] = { - { "l8_6.bin", 0x1000, 0x25f8da18, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "n8_0.bin", 0x1000, 0x04e20626, 1 | BRF_PRG | BRF_ESS }, // 1 - { "l7_7.bin", 0x1000, 0x230e244c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "n7_1.bin", 0x1000, 0x37b12697, 1 | BRF_PRG | BRF_ESS }, // 3 - { "l6_8.bin", 0x1000, 0x1293fb9d, 1 | BRF_PRG | BRF_ESS }, // 4 - { "n6_2.bin", 0x1000, 0x712c206a, 1 | BRF_PRG | BRF_ESS }, // 5 - { "l5_9.bin", 0x1000, 0x743a6501, 1 | BRF_PRG | BRF_ESS }, // 6 - { "n5_3.bin", 0x1000, 0xa65cbf99, 1 | BRF_PRG | BRF_ESS }, // 7 - { "l4_a.bin", 0x1000, 0x9cf1b0a1, 1 | BRF_PRG | BRF_ESS }, // 8 - { "n4_4.bin", 0x1000, 0x5f0080d5, 1 | BRF_PRG | BRF_ESS }, // 9 - { "l3_b.bin", 0x1000, 0x8cc7f7fa, 1 | BRF_PRG | BRF_ESS }, // 10 - { "n3_5.bin", 0x1000, 0x40452376, 1 | BRF_PRG | BRF_ESS }, // 11 - - { "j4_c.bin", 0x1000, 0xe897dfcd, 2 | BRF_PRG | BRF_ESS }, // 12 Z80 Code - { "j3_d.bin", 0x1000, 0x4016de77, 2 | BRF_PRG | BRF_ESS }, // 13 -}; - -STD_ROM_PICK(aztarac) -STD_ROM_FN(aztarac) - -struct BurnDriver BurnDrvAztarac = { - "aztarac", NULL, NULL, NULL, "1983", - "Aztarac\0", "Vector graphics", "Centuri", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, aztaracRomInfo, aztaracRomName, NULL, NULL, AztaracInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40 * 256, - 1024, 768, 4, 3 -}; +// FB Alpha Aztarac driver module +// Based on MAME driver by Mathis Rosenhauer + +#include "burnint.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "vector.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvVecRAM; +static UINT8 *DrvNVRAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static INT32 sound_irq_timer; +static INT32 sound_status; + +static INT32 sound_initialized = 0; +static INT16 *pFMBuffer[12]; + +static INT32 xcenter; +static INT32 ycenter; + +static INT32 watchdog; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvInputs[1]; +static UINT8 DrvReset; + +static INT16 DrvAnalogPort0; +static INT16 DrvAnalogPort1; + +static UINT8 xAxis = 0; +static UINT8 yAxis = 0; +static UINT8 Dial = 0; +static UINT8 DialInputs[2]; + +#define A(a, b, c, d) {a, b, (UINT8*)(c), d} + +static struct BurnInputInfo AztaracInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 2" }, + + A("Left/Right", BIT_ANALOG_REL, &DrvAnalogPort0, "p1 x-axis" ), + A("Up/Down", BIT_ANALOG_REL, &DrvAnalogPort1, "p1 y-axis" ), + {"Aim Left", BIT_DIGITAL, DialInputs + 0, "p1 fire 3" }, + {"Aim Right", BIT_DIGITAL, DialInputs + 1, "p1 fire 4" }, + + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 7, "service" }, +}; + +STDINPUTINFO(Aztarac) + +#undef A + +static inline void read_vectorram (INT32 addr, INT32 *x, INT32 *y, INT32 *c) +{ + *c = SekReadWord(0xff8000 + addr); + *x = SekReadWord(0xff9000 + addr) & 0x03ff; + *y = SekReadWord(0xffa000 + addr) & 0x03ff; + if (*x & 0x200) *x |= 0xfffffc00; // signed + if (*y & 0x200) *y |= 0xfffffc00; // signed +} + +static void aztarac_process_vector_list() +{ + INT32 x, y, c, intensity, xoffset, yoffset, color; + INT32 defaddr, objaddr, ndefs; + + vector_reset(); + + for (objaddr = 0; objaddr < 0x800; objaddr++) + { + read_vectorram (objaddr * 2, &xoffset, &yoffset, &c); + + if (c & 0x4000) break; + + if ((c & 0x2000) == 0) + { + defaddr = (c >> 1) & 0x7ff; + + vector_add_point((xcenter + (xoffset << 16)), (ycenter - (yoffset << 16)), 0, 0); + + read_vectorram (defaddr * 2, &x, &ndefs, &c); + ndefs++; + + if (c & 0xff00) + { + intensity = (c >> 8); + color = c & 0x3f; + + while (ndefs--) + { + defaddr++; + read_vectorram (defaddr * 2, &x, &y, &c); + + if ((c & 0xff00) == 0) + vector_add_point((xcenter + ((x + xoffset) << 16)), (ycenter - ((y + yoffset) << 16)), 0, 0); + else + vector_add_point((xcenter + ((x + xoffset) << 16)), (ycenter - ((y + yoffset) << 16)), color, intensity); + } + } + else + { + while (ndefs--) + { + defaddr++; + read_vectorram (defaddr * 2, &x, &y, &c); + + color = c & 0x3f; + vector_add_point((xcenter + ((x + xoffset) << 16)), (ycenter - ((y + yoffset) << 16)), color, c >> 8); + } + } + } + } +} + +static inline void sync_cpu() +{ + INT32 cycles = (SekTotalCycles() / 4) - ZetTotalCycles(); + + if (cycles > 0) ZetRun(cycles); +} + +void __fastcall aztarac_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfffff00) == 0x022000) { + *((UINT16*)(DrvNVRAM + (address & 0xfe))) = data | 0xfff0; + return; + } + + if (address == 0xffb000) { + if (data) aztarac_process_vector_list(); // used once? + return; + } +} + +void __fastcall aztarac_write_byte(UINT32 address, UINT8 data) +{ + if (address == 0x027009) { + sync_cpu(); + *soundlatch = data; + sound_status ^= 0x21; + + if (sound_status & 0x20) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + + return; + } + + if (address == 0xffb001) { + if (data) aztarac_process_vector_list(); + return; + } +} + +UINT16 __fastcall aztarac_read_word(UINT32 address) +{ + switch (address) + { + case 0x027004: + return 0xff00 | DrvInputs[0]; + + case 0x02700e: + watchdog = 0; + return 0; + } + + return 0; +} + +UINT8 __fastcall aztarac_read_byte(UINT32 address) +{ + switch (address) + { + case 0x027000: + return xAxis - 0x0f; + + case 0x027001: + return yAxis - 0x0f; + + case 0x027005: + return DrvInputs[0]; // inputs + + case 0x027009: + sync_cpu(); + return sound_status & 0x01; + + case 0x02700d: + return Dial; + } + + return 0; +} + +void __fastcall aztarac_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8c00: + case 0x8c01: + case 0x8c02: + case 0x8c03: + case 0x8c04: + case 0x8c05: + case 0x8c06: + case 0x8c07: + AY8910Write((address & 6) / 2, ~address & 1, data); + return; + + case 0x9000: + sound_status &= ~0x10; + return; + } +} + +UINT8 __fastcall aztarac_sound_read(UINT16 address) +{ + switch (address) + { + case 0x8800: + sound_status = (sound_status | 0x01) & ~0x20; + return *soundlatch; + + case 0x8c00: + case 0x8c01: + case 0x8c02: + case 0x8c03: + case 0x8c04: + case 0x8c05: + case 0x8c06: + case 0x8c07: + return AY8910Read((address & 6) / 2); + + case 0x9000: + return sound_status & ~0x01; + } + + return 0; +} + +static INT32 __fastcall aztarac_irq_callback(INT32) +{ + return 0x0c; +} + +static INT32 DrvDoReset(INT32 reset_ram) +{ + if (reset_ram) { + memset (AllRam, 0, RamEnd - AllRam); + } + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + AY8910Reset(1); + AY8910Reset(2); + AY8910Reset(3); + + sound_status = 0; + sound_irq_timer = 0; + + watchdog = 0; + + vector_reset(); + + return 0; +} + +static void sound_init() // Changed refresh rate causes crashes +{ + for (INT32 i = 0; i < 12; i++) { + pFMBuffer[i] = (INT16*)BurnMalloc(nBurnSoundLen * sizeof(INT16)); + } + + sound_initialized = 1; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x010000; + DrvZ80ROM = Next; Next += 0x002000; + + DrvNVRAM = Next; Next += 0x000400; + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x002000; + DrvZ80RAM = Next; Next += 0x000800; + DrvVecRAM = Next; Next += 0x003000; + + soundlatch = Next; Next += 0x000001; + + RamEnd = Next; + + DrvPalette = (UINT32*)Next; Next += 0x0040 * 256 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0; i < 0x40; i++) // color + { + for (INT32 j = 0; j < 256; j++) // intensity + { + INT32 r = (i >> 4) & 3; + r = (r << 6) | (r << 4) | (r << 2) | (r << 0); + + INT32 g = (i >> 2) & 3; + g = (g << 6) | (g << 4) | (g << 2) | (g << 0); + + INT32 b = (i >> 0) & 3; + b = (b << 6) | (b << 4) | (b << 2) | (b << 0); + + r = (r * j) / 255; + g = (g * j) / 255; + b = (b * j) / 255; + + DrvPalette[i * 256 + j] = (r << 16) | (g << 8) | b; + } + } +} + +static INT32 DrvInit() +{ + BurnSetRefreshRate(40.0); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x02001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x02000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x04001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x04000, 5, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x06001, 6, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x06000, 7, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x08001, 8, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x08000, 9, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x0a001, 10, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x0a000, 11, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 12, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x01000, 13, 1)) return 1; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekSetIrqCallback(aztarac_irq_callback); + SekMapMemory(Drv68KROM, 0x000000, 0x00bfff, SM_ROM); + SekMapMemory(DrvNVRAM, 0x022000, 0x0223ff, SM_ROM); + SekMapMemory(DrvVecRAM, 0xff8000, 0xffafff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xffe000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, aztarac_write_word); + SekSetWriteByteHandler(0, aztarac_write_byte); + SekSetReadWordHandler(0, aztarac_read_word); + SekSetReadByteHandler(0, aztarac_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x1fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x1fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(aztarac_sound_write); + ZetSetReadHandler(aztarac_sound_read); + ZetClose(); + + AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(2, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(3, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.15, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.15, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(2, 0.15, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(3, 0.15, BURN_SND_ROUTE_BOTH); + + DrvPaletteInit(); + + vector_init(); + + xcenter = (1024 / 2) << 16; + ycenter = ( 768 / 2) << 16; + + memset (DrvNVRAM, 0xff, 0x100); + + DrvDoReset(1); + + return 0; +} + +static INT32 DrvExit() +{ + vector_exit(); + + SekExit(); + ZetExit(); + + AY8910Exit(0); + AY8910Exit(1); + AY8910Exit(2); + AY8910Exit(3); + + BurnFree (AllMem); + + sound_initialized = 0; + for (INT32 i = 0; i < 12; i++) { + BurnFree (pFMBuffer[i]); + } + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvPaletteInit(); + DrvRecalc = 0; + } + + draw_vector(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (sound_initialized == 0) { + if (pBurnSoundOut) { + sound_init(); + } + } + + if (DrvReset) { + DrvDoReset(1); + } + + watchdog++; + if (watchdog == 180) { // 3 seconds? + DrvDoReset(0); + } + + SekNewFrame(); + ZetNewFrame(); + + { + DrvInputs[0] = 0xff; + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + } + + xAxis = (DrvAnalogPort0 >> 7) + 0x0f; + if (xAxis > 0x80) xAxis = 0; + + yAxis = (~DrvAnalogPort1 >> 7) + 0x10; + if (yAxis > 0x1d) yAxis = 0x1d; + + if (DialInputs[0]) { + Dial += 0x04; + } else { + if (DialInputs[1]) { + Dial -= 0x04; + } + } + } + + INT32 nInterleave = 100; + INT32 nCyclesTotal[2] = { 8000000 / 40, 2000000 / 40 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++, sound_irq_timer++) + { + nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); + if (i == (nInterleave - 1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + //nCyclesDone[1] += ZetRun((SekTotalCycles() / 4) - ZetTotalCycles()); + sync_cpu(); + + if ((sound_irq_timer % 40) == 39) { // every 20000 cycles, 50000 / frame + sound_status ^= 0x10; + if (sound_status & 0x10) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + } + + SekClose(); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pFMBuffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029698; + } + + if (nAction & ACB_MEMORY_ROM) { + ba.Data = Drv68KROM; + ba.nLen = 0x000c000; + ba.nAddress = 0x0000000; + ba.szName = "68K ROM"; + BurnAcb(&ba); + + ba.Data = DrvZ80ROM; + ba.nLen = 0x0002000; + ba.nAddress = 0x0000000; + ba.szName = "Z80 ROM"; + BurnAcb(&ba); + } + + if (nAction & ACB_MEMORY_RAM) { + ba.Data = Drv68KRAM; + ba.nLen = 0x0002000; + ba.nAddress = 0x0ffe000; + ba.szName = "68K RAM"; + BurnAcb(&ba); + + ba.Data = DrvVecRAM; + ba.nLen = 0x0003000; + ba.nAddress = 0x0ff8000; + ba.szName = "Vector RAM"; + BurnAcb(&ba); + + ba.Data = DrvZ80RAM; + ba.nLen = 0x0000800; + ba.nAddress = 0x0000000; + ba.szName = "Z80 RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_NVRAM) { + ba.Data = DrvNVRAM; + ba.nLen = 0x000100; + ba.nAddress = 0x022000; + ba.szName = "NV RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + AY8910Scan(nAction, pnMin); + + SCAN_VAR(*soundlatch); + SCAN_VAR(sound_irq_timer); + SCAN_VAR(sound_status); + } + + vector_scan(nAction); + + return 0; +} + + +// Aztarac + +static struct BurnRomInfo aztaracRomDesc[] = { + { "l8_6.bin", 0x1000, 0x25f8da18, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "n8_0.bin", 0x1000, 0x04e20626, 1 | BRF_PRG | BRF_ESS }, // 1 + { "l7_7.bin", 0x1000, 0x230e244c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "n7_1.bin", 0x1000, 0x37b12697, 1 | BRF_PRG | BRF_ESS }, // 3 + { "l6_8.bin", 0x1000, 0x1293fb9d, 1 | BRF_PRG | BRF_ESS }, // 4 + { "n6_2.bin", 0x1000, 0x712c206a, 1 | BRF_PRG | BRF_ESS }, // 5 + { "l5_9.bin", 0x1000, 0x743a6501, 1 | BRF_PRG | BRF_ESS }, // 6 + { "n5_3.bin", 0x1000, 0xa65cbf99, 1 | BRF_PRG | BRF_ESS }, // 7 + { "l4_a.bin", 0x1000, 0x9cf1b0a1, 1 | BRF_PRG | BRF_ESS }, // 8 + { "n4_4.bin", 0x1000, 0x5f0080d5, 1 | BRF_PRG | BRF_ESS }, // 9 + { "l3_b.bin", 0x1000, 0x8cc7f7fa, 1 | BRF_PRG | BRF_ESS }, // 10 + { "n3_5.bin", 0x1000, 0x40452376, 1 | BRF_PRG | BRF_ESS }, // 11 + + { "j4_c.bin", 0x1000, 0xe897dfcd, 2 | BRF_PRG | BRF_ESS }, // 12 Z80 Code + { "j3_d.bin", 0x1000, 0x4016de77, 2 | BRF_PRG | BRF_ESS }, // 13 +}; + +STD_ROM_PICK(aztarac) +STD_ROM_FN(aztarac) + +struct BurnDriver BurnDrvAztarac = { + "aztarac", NULL, NULL, NULL, "1983", + "Aztarac\0", "Vector graphics", "Centuri", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, aztaracRomInfo, aztaracRomName, NULL, NULL, AztaracInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40 * 256, + 1024, 768, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_bionicc.cpp b/src/burn/drv/pre90s/d_bionicc.cpp index 268b03b33..685ca223f 100644 --- a/src/burn/drv/pre90s/d_bionicc.cpp +++ b/src/burn/drv/pre90s/d_bionicc.cpp @@ -1,948 +1,947 @@ -// FB Alpha Bionic Commando driver module -// Based on MAME driver by Steven Frew, Phil Stroffolino, and Paul Leaman - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; -static UINT8 DrvDips[2]; - -static UINT8 *Mem, *MemEnd; -static UINT8 *AllRam, *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *Drv68KRAM0; -static UINT8 *DrvTextRAM; -static UINT8 *DrvVidRAM0; -static UINT8 *DrvVidRAM1; -static UINT8 *DrvPalRAM; -static UINT8 *Drv68KRAM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSprBuf; - -static UINT32 *DrvPalette; -static UINT32 *Palette; -static UINT8 DrvRecalc; - - -static UINT8 *soundlatch; - -static INT32 flipscreen; - -static INT32 fg_scroll_x; -static INT32 fg_scroll_y; -static INT32 bg_scroll_x; -static INT32 bg_scroll_y; - -static INT32 fg_enable; -static INT32 bg_enable; - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 5, "p1 start" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p1 right" }, - {"P1 Down", BIT_DIGITAL , DrvJoy2 + 4, "p1 down", }, - {"P1 Up", BIT_DIGITAL , DrvJoy2 + 5, "p1 up", }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 1, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 2"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 4, "p2 start" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 3, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 2, "p2 right" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 4, "p2 down", }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 5, "p2 up", }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 1, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 0, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8 , "Coin_A" }, - {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credit " }, - {0x11, 0x01, 0x07, 0x01, "3 Coins 1 Credit " }, - {0x11, 0x01, 0x07, 0x02, "2 Coins 1 Credit " }, - {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credit " }, - {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x07, 0x03, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin_B" }, - {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credit " }, - {0x11, 0x01, 0x38, 0x08, "3 Coins 1 Credit " }, - {0x11, 0x01, 0x38, 0x10, "2 Coins 1 Credit " }, - {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credit " }, - {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x38, 0x18, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x40, 0x40, "Off" }, - {0x11, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x04, 0x04, "Upright" }, - {0x12, 0x01, 0x04, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Bonus_Life" }, - {0x12, 0x01, 0x18, 0x18, "20K, 40K, every 60K" }, - {0x12, 0x01, 0x18, 0x10, "30K, 50K, every 70K" }, - {0x12, 0x01, 0x18, 0x08, "20K and 60K only" }, - {0x12, 0x01, 0x18, 0x00, "30K and 70K only" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x60, 0x40, "Easy" }, - {0x12, 0x01, 0x60, 0x60, "Medium" }, - {0x12, 0x01, 0x60, 0x20, "Hard" }, - {0x12, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Drv) - -static void bionicc_palette_write(INT32 offset) -{ - offset >>= 1; - - INT32 r, g, b, bright; - INT32 data = *((UINT16*)(DrvPalRAM + (offset << 1))); - - bright = (data&0x0f); - - r = ((data>>12)&0x0f) * 0x11; - g = ((data>>8 )&0x0f) * 0x11; - b = ((data>>4 )&0x0f) * 0x11; - - if ((bright & 0x08) == 0) - { - r = r * (0x07 + bright) / 0x0e; - g = g * (0x07 + bright) / 0x0e; - b = b * (0x07 + bright) / 0x0e; - } - - Palette[offset] = (r << 16) | (g << 8) | b; - DrvPalette[offset] = BurnHighCol(r, g, b, 0); -} - -void __fastcall bionicc_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfffff800) == 0xff8000) { - address &= 0x7ff; - - DrvPalRAM[address ^ 1] = data; - - bionicc_palette_write(address); - - return; - } - - switch (address) - { - case 0xfe4000: - case 0xfe4001: - flipscreen = data & 0x01; - fg_enable = data & 0x10; - bg_enable = data & 0x20; - return; - } -} - -void __fastcall bionicc_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfffff800) == 0xff8000) { - address &= 0x7ff; - - *((UINT16*)(DrvPalRAM + address)) = data; - - bionicc_palette_write(address); - - return; - } - - switch (address) - { - case 0xfe8010: - fg_scroll_x = data & 0x3ff; - return; - - case 0xfe8012: - fg_scroll_y = data & 0x3ff; - return; - - case 0xfe8014: - bg_scroll_x = data & 0x1ff; - return; - - case 0xfe8016: - bg_scroll_y = data & 0x1ff; - return; - - case 0xfe801a: - UINT16 *inp = (UINT16*)(Drv68KRAM1 + 0x3ffa); - inp[0] = (DrvInputs[0] >> 4) ^ 0x0f; - inp[1] = DrvInputs[2] ^ 0xff; - inp[2] = DrvInputs[1] ^ 0xff; - return; - } -} - -UINT8 __fastcall bionicc_read_byte(UINT32 address) -{ - switch (address) - { - case 0xfe4000: - return DrvInputs[0]; - - case 0xfe4001: - return 0xff; - - case 0xfe4002: - return DrvDips[0]; - - case 0xfe4003: - return DrvDips[1]; - } - - return 0; -} - -UINT16 __fastcall bionicc_read_word(UINT32 address) -{ - switch (address) - { - case 0xfe4000: - return 0x00ff | (DrvInputs[0] << 8); - - case 0xfe4002: - return DrvDips[0] | (DrvDips[1] << 8); - } - - return 0; -} - -UINT8 __fastcall bionicc_sound_read(UINT16 address) -{ - switch (address) - { - case 0x8001: - return BurnYM2151ReadStatus(); - - case 0xa000: - return *soundlatch; - } - - return 0; -} - -void __fastcall bionicc_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8000: - BurnYM2151SelectRegister(data); - return; - - case 0x8001: - BurnYM2151WriteRegister(data); - return; - } -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KROM = Next; Next += 0x0040000; - DrvZ80ROM = Next; Next += 0x0008000; - - DrvGfxROM0 = Next; Next += 0x0020000; - DrvGfxROM1 = Next; Next += 0x0020000; - DrvGfxROM2 = Next; Next += 0x0080000; - DrvGfxROM3 = Next; Next += 0x0080000; - - DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM0 = Next; Next += 0x0004000; - Drv68KRAM1 = Next; Next += 0x0004000; - DrvPalRAM = Next; Next += 0x0000800; - DrvTextRAM = Next; Next += 0x0001000; - DrvVidRAM0 = Next; Next += 0x0004000; - DrvVidRAM1 = Next; Next += 0x0004000; - - DrvSprBuf = Next; Next += 0x0000500; - - DrvZ80RAM = Next; Next += 0x0000800; - - Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - fg_scroll_x = 0; - fg_scroll_y = 0; - bg_scroll_x = 0; - bg_scroll_y = 0; - - soundlatch = Drv68KRAM1 + 0x3ff8; - flipscreen = 0; - - fg_enable = 0; - bg_enable = 0; - - SekOpen(0); - SekReset(); - SekClose(); - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - return 0; -} - -static INT32 DrvGfxDecode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); - if (tmp == NULL) { - return 1; - } - - static INT32 CharPlanes[2] = { 0x000004, 0x000000 }; - static INT32 Tile0Planes[4] = { 0x040004, 0x040000, 0x000004, 0x000000 }; - static INT32 Tile1Planes[4] = { 0x100004, 0x100000, 0x000004, 0x000000 }; - static INT32 SpriPlanes[4] = { 0x180000, 0x100000, 0x080000, 0x000000 }; - static INT32 CharXOffsets[16] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, - 0x100, 0x101, 0x102, 0x103, 0x108, 0x109, 0x10a, 0x10b }; - static INT32 SpriXOffsets[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087 }; - static INT32 CharYOffsets[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, - 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0 }; - static INT32 SpriYOffsets[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, - 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; - - memcpy (tmp, DrvGfxROM0, 0x08000); - - GfxDecode(0x00400, 2, 8, 8, CharPlanes, CharXOffsets, CharYOffsets, 0x080, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x10000); - - GfxDecode(0x00800, 4, 8, 8, Tile0Planes, CharXOffsets, CharYOffsets, 0x080, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x40000); - - GfxDecode(0x00800, 4, 16, 16, Tile1Planes, CharXOffsets, CharYOffsets, 0x200, tmp, DrvGfxROM2); - - memcpy (tmp, DrvGfxROM3, 0x40000); - - GfxDecode(0x00800, 4, 16, 16, SpriPlanes, SpriXOffsets, SpriYOffsets, 0x100, tmp, DrvGfxROM3); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x20001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x20000, 3, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x0000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x8000, 7, 1)) return 1; - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(DrvGfxROM2 + i * 0x8000, i + 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + i * 0x8000, i + 16, 1)) return 1; - } - - if (DrvGfxDecode()) return 1; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRAM0, 0xfe0000, 0xfe3fff, SM_RAM); - SekMapMemory(DrvTextRAM, 0xfec000, 0xfecfff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0xff0000, 0xff3fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0xff4000, 0xff7fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xff8000, 0xff87ff, SM_ROM); - SekMapMemory(Drv68KRAM1, 0xffc000, 0xffffff, SM_RAM); - SekSetReadByteHandler(0, bionicc_read_byte); - SekSetReadWordHandler(0, bionicc_read_word); - SekSetWriteByteHandler(0, bionicc_write_byte); - SekSetWriteWordHandler(0, bionicc_write_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(bionicc_sound_write); - ZetSetReadHandler(bionicc_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - BurnYM2151Exit(); - SekExit(); - ZetExit(); - - BurnFree (Mem); - - GenericTilesExit(); - - return 0; -} - -static void draw_foreground(INT32 priority) -{ - UINT16 *vidram = (UINT16*)DrvVidRAM0; - - for (INT32 offs = 0; offs < 0x4000 / 4; offs++) - { - INT32 sx = (offs & 0x3f) << 4; - INT32 sy = (offs >> 6) << 4; - - sx -= fg_scroll_x; - sy -= fg_scroll_y; - - if (sx < -15) sx += 0x400; - if (sy < -15) sy += 0x400; - if (sx < -15 || sx > 255 || sy < 1 || sy > 239) continue; - sy -= 16; - - INT32 attr = vidram[(offs << 1) | 1]; - INT32 code = (vidram[offs << 1] & 0xff) | ((attr & 0x07) << 8); - INT32 color = (attr & 0x18) >> 3; - INT32 flipx = attr & 0x80; - INT32 flipy = attr & 0x40; - INT32 prior = (attr & 0x20) >> 5; - - if ((attr & 0xc0) == 0xc0) { - flipx = 0; - flipy = 0; - prior = 2; - } - - if (prior != priority) continue; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - memset (pTransDraw, 0, nScreenHeight * nScreenWidth * 2); - - if (fg_enable) { - draw_foreground(2); - } - - if (bg_enable) - { - UINT16 *vidram = (UINT16*)DrvVidRAM1; - - for (INT32 offs = 0; offs < 0x4000 / 4; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - sx -= bg_scroll_x; - sy -= bg_scroll_y; - - if (sx < -7) sx += 0x200; - if (sy < -7) sy += 0x200; - if (sy < 9 || sy > 239 || sx < -7 || sx > 255) continue; - sy -= 16; - - INT32 attr = vidram[(offs << 1) | 1]; - INT32 code = (vidram[offs << 1] & 0xff) | ((attr & 0x07) << 8); - INT32 color = (attr & 0x18) >> 3; - INT32 flipx = attr & 0x80; - INT32 flipy = attr & 0x40; - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x000, DrvGfxROM1); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x000, DrvGfxROM1); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x000, DrvGfxROM1); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x000, DrvGfxROM1); - } - } - } - } - - if (fg_enable) { - draw_foreground(0); - } - - { - UINT16 *vidram = (UINT16*)DrvSprBuf; - - for (INT32 offs = (0x500-8)/2; offs >= 0; offs -= 4) - { - INT32 code = vidram[offs] & 0x7ff; - - if (code != 0x7ff) - { - INT32 attr = vidram[offs+1]; - INT32 color = (attr&0x3C)>>2; - INT32 flipx = attr & 0x02; - INT32 sx = (INT16)vidram[offs+3]; - INT32 sy = (INT16)vidram[offs+2]; - if(sy>512-16) sy-=512; - - if (sx < -15 || sx > 255 || sy < 1 || sy > 239) continue; - - sy -= 16; - - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); - } - } - } - } - - if (fg_enable) { - draw_foreground(1); - } - - { - UINT16 *vidram = (UINT16*)DrvTextRAM; - - for (INT32 offs = 0; offs < 0x800 / 2; offs++) - { - INT32 sx = (offs << 3) & 0xf8; - INT32 sy = (offs >> 2) & 0xf8; - sy -= 16; - if (sy < 0 || sy > 223) continue; - - INT32 attr = vidram[offs + 0x400]; - INT32 code = (vidram[offs] & 0xff) | ((attr & 0xc0) << 2); - INT32 color = attr & 0x3f; - - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 2, 3, 0x300, DrvGfxROM0); - } - } - - if (flipscreen) { - INT32 nSize = (nScreenWidth * nScreenHeight) - 1; - for (INT32 i = 0; i < nSize >> 1; i++) { - INT32 n = pTransDraw[i]; - pTransDraw[i] = pTransDraw[nSize - i]; - pTransDraw[nSize - i] = n; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= DrvJoy1[i] << i; - DrvInputs[1] ^= DrvJoy2[i] << i; - DrvInputs[2] ^= DrvJoy3[i] << i; - } - } - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 8; - INT32 nTotalCycles[2] = { 12000000 / 60, 3579545 / 60 }; - - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nTotalCycles[0] -= SekRun(nTotalCycles[0] / (nInterleave - i)); - if (i != (nInterleave - 1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - nTotalCycles[1] -= ZetRun(nTotalCycles[1] / (nInterleave - i)); - if ((i & 1) == 1) ZetNmi(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - // Lag sprites 1 frame - memcpy (DrvSprBuf, Drv68KRAM0 + 0x800, 0x500); - - return 0; -} - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029682; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - - SCAN_VAR(fg_scroll_x); - SCAN_VAR(fg_scroll_y); - SCAN_VAR(bg_scroll_x); - SCAN_VAR(bg_scroll_y); - SCAN_VAR(fg_enable); - SCAN_VAR(bg_enable); - SCAN_VAR(flipscreen); - } - - return 0; -} - -// Bionic Commando (Euro) - -static struct BurnRomInfo bioniccRomDesc[] = { - { "tse_02.1a", 0x10000, 0xe4aeefaa, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tse_04.1b", 0x10000, 0xd0c8ec75, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tse_03.2a", 0x10000, 0xb2ac0a45, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tse_05.2b", 0x10000, 0xa79cb406, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "ts_01b.4e", 0x08000, 0xa9a6cafa, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "tsu_08.8l", 0x08000, 0x9bf0b7a2, 3 | BRF_GRA }, // 5 Characters - - { "tsu_07.5l", 0x08000, 0x9469efa4, 4 | BRF_GRA }, // 6 Background Tiles - { "tsu_06.4l", 0x08000, 0x40bf0eb4, 4 | BRF_GRA }, // 7 - - { "ts_12.17f", 0x08000, 0xe4b4619e, 5 | BRF_GRA }, // 8 Foreground Tiles - { "ts_11.15f", 0x08000, 0xab30237a, 5 | BRF_GRA }, // 9 - { "ts_17.17g", 0x08000, 0xdeb657e4, 5 | BRF_GRA }, // 10 - { "ts_16.15g", 0x08000, 0xd363b5f9, 5 | BRF_GRA }, // 11 - { "ts_13.18f", 0x08000, 0xa8f5a004, 5 | BRF_GRA }, // 12 - { "ts_18.18g", 0x08000, 0x3b36948c, 5 | BRF_GRA }, // 13 - { "ts_23.18j", 0x08000, 0xbbfbe58a, 5 | BRF_GRA }, // 14 - { "ts_24.18k", 0x08000, 0xf156e564, 5 | BRF_GRA }, // 15 - - { "tse_10.13f", 0x08000, 0xd28eeacc, 6 | BRF_GRA }, // 16 Sprites - { "tsu_09.11f", 0x08000, 0x6a049292, 6 | BRF_GRA }, // 17 - { "tse_15.13g", 0x08000, 0x9b5593c0, 6 | BRF_GRA }, // 18 - { "tsu_14.11g", 0x08000, 0x46b2ad83, 6 | BRF_GRA }, // 19 - { "tse_20.13j", 0x08000, 0xb03db778, 6 | BRF_GRA }, // 20 - { "tsu_19.11j", 0x08000, 0xb5c82722, 6 | BRF_GRA }, // 21 - { "tse_22.17j", 0x08000, 0xd4dedeb3, 6 | BRF_GRA }, // 22 - { "tsu_21.15j", 0x08000, 0x98777006, 6 | BRF_GRA }, // 23 - - { "63s141.18f", 0x00100, 0xb58d0023, 0 | BRF_OPT }, // 24 Priority (not used) - - { "c8751h-88", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(bionicc) -STD_ROM_FN(bionicc) - -struct BurnDriver BurnDrvbionicc = { - "bionicc", NULL, NULL, NULL, "1987", - "Bionic Commando (Euro)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, bioniccRomInfo, bioniccRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Bionic Commando (US set 1) - -static struct BurnRomInfo bionicc1RomDesc[] = { - { "tsu_02b.1a", 0x10000, 0xcf965a0a, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tsu_04b.1b", 0x10000, 0xc9884bfb, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tsu_03b.2a", 0x10000, 0x4e157ae2, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tsu_05b.2b", 0x10000, 0xe66ca0f9, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "ts_01b.4e", 0x08000, 0xa9a6cafa, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "tsu_08.8l", 0x08000, 0x9bf0b7a2, 3 | BRF_GRA }, // 5 Characters - - { "tsu_07.5l", 0x08000, 0x9469efa4, 4 | BRF_GRA }, // 6 Background Tiles - { "tsu_06.4l", 0x08000, 0x40bf0eb4, 4 | BRF_GRA }, // 7 - - { "ts_12.17f", 0x08000, 0xe4b4619e, 5 | BRF_GRA }, // 8 Foreground Tiles - { "ts_11.15f", 0x08000, 0xab30237a, 5 | BRF_GRA }, // 9 - { "ts_17.17g", 0x08000, 0xdeb657e4, 5 | BRF_GRA }, // 10 - { "ts_16.15g", 0x08000, 0xd363b5f9, 5 | BRF_GRA }, // 11 - { "ts_13.18f", 0x08000, 0xa8f5a004, 5 | BRF_GRA }, // 12 - { "ts_18.18g", 0x08000, 0x3b36948c, 5 | BRF_GRA }, // 13 - { "ts_23.18j", 0x08000, 0xbbfbe58a, 5 | BRF_GRA }, // 14 - { "ts_24.18k", 0x08000, 0xf156e564, 5 | BRF_GRA }, // 15 - - { "tsu_10.13f", 0x08000, 0xf1180d02, 6 | BRF_GRA }, // 16 Sprites - { "tsu_09.11f", 0x08000, 0x6a049292, 6 | BRF_GRA }, // 17 - { "tsu_15.13g", 0x08000, 0xea912701, 6 | BRF_GRA }, // 18 - { "tsu_14.11g", 0x08000, 0x46b2ad83, 6 | BRF_GRA }, // 19 - { "tsu_20.13j", 0x08000, 0x17857ad2, 6 | BRF_GRA }, // 20 - { "tsu_19.11j", 0x08000, 0xb5c82722, 6 | BRF_GRA }, // 21 - { "tsu_22.17j", 0x08000, 0x5ee1ae6a, 6 | BRF_GRA }, // 22 - { "tsu_21.15j", 0x08000, 0x98777006, 6 | BRF_GRA }, // 23 - - { "63s141.18f", 0x00100, 0xb58d0023, 0 | BRF_OPT }, // 24 Priority (not used) - - { "c8751h-88", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(bionicc1) -STD_ROM_FN(bionicc1) - -struct BurnDriver BurnDrvbionicc1 = { - "bionicc1", "bionicc", NULL, NULL, "1987", - "Bionic Commando (US set 1)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, bionicc1RomInfo, bionicc1RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Bionic Commando (US set 2) - -static struct BurnRomInfo bionicc2RomDesc[] = { - { "tsu_02.1a", 0x10000, 0xf2528f08, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tsu_04.1b", 0x10000, 0x38b1c7e4, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tsu_03.2a", 0x10000, 0x72c3b76f, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tsu_05.2b", 0x10000, 0x70621f83, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "ts_01b.4e", 0x08000, 0xa9a6cafa, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "tsu_08.8l", 0x08000, 0x9bf0b7a2, 3 | BRF_GRA }, // 5 Characters - - { "tsu_07.5l", 0x08000, 0x9469efa4, 4 | BRF_GRA }, // 6 Background Tiles - { "tsu_06.4l", 0x08000, 0x40bf0eb4, 4 | BRF_GRA }, // 7 - - { "ts_12.17f", 0x08000, 0xe4b4619e, 5 | BRF_GRA }, // 8 Foreground Tiles - { "ts_11.15f", 0x08000, 0xab30237a, 5 | BRF_GRA }, // 9 - { "ts_17.17g", 0x08000, 0xdeb657e4, 5 | BRF_GRA }, // 10 - { "ts_16.15g", 0x08000, 0xd363b5f9, 5 | BRF_GRA }, // 11 - { "ts_13.18f", 0x08000, 0xa8f5a004, 5 | BRF_GRA }, // 12 - { "ts_18.18g", 0x08000, 0x3b36948c, 5 | BRF_GRA }, // 13 - { "ts_23.18j", 0x08000, 0xbbfbe58a, 5 | BRF_GRA }, // 14 - { "ts_24.18k", 0x08000, 0xf156e564, 5 | BRF_GRA }, // 15 - - { "tsu_10.13f", 0x08000, 0xf1180d02, 6 | BRF_GRA }, // 16 Sprites - { "tsu_09.11f", 0x08000, 0x6a049292, 6 | BRF_GRA }, // 17 - { "tsu_15.13g", 0x08000, 0xea912701, 6 | BRF_GRA }, // 18 - { "tsu_14.11g", 0x08000, 0x46b2ad83, 6 | BRF_GRA }, // 19 - { "tsu_20.13j", 0x08000, 0x17857ad2, 6 | BRF_GRA }, // 20 - { "tsu_19.11j", 0x08000, 0xb5c82722, 6 | BRF_GRA }, // 21 - { "tsu_22.17j", 0x08000, 0x5ee1ae6a, 6 | BRF_GRA }, // 22 - { "tsu_21.15j", 0x08000, 0x98777006, 6 | BRF_GRA }, // 23 - - { "63s141.18f", 0x00100, 0xb58d0023, 0 | BRF_OPT }, // 24 Priority (not used) - - { "c8751h-88", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(bionicc2) -STD_ROM_FN(bionicc2) - -struct BurnDriver BurnDrvbionicc2 = { - "bionicc2", "bionicc", NULL, NULL, "1987", - "Bionic Commando (US set 2)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, bionicc2RomInfo, bionicc2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Top Secret (Japan) - -static struct BurnRomInfo topsecrtRomDesc[] = { - { "ts_02.1a", 0x10000, 0xb2fe1ddb, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ts_04.1b", 0x10000, 0x427a003d, 1 | BRF_PRG | BRF_ESS }, // 1 - { "ts_03.2a", 0x10000, 0x27f04bb6, 1 | BRF_PRG | BRF_ESS }, // 2 - { "ts_05.2b", 0x10000, 0xc01547b1, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "ts_01.4e", 0x08000, 0x8ea07917, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "ts_08.8l", 0x08000, 0x96ad379e, 3 | BRF_GRA }, // 5 Characters - - { "ts_07.5l", 0x08000, 0x25cdf8b2, 4 | BRF_GRA }, // 6 Background Tiles - { "ts_06.4l", 0x08000, 0x314fb12d, 4 | BRF_GRA }, // 7 - - { "ts_12.17f", 0x08000, 0xe4b4619e, 5 | BRF_GRA }, // 8 Foreground Tiles - { "ts_11.15f", 0x08000, 0xab30237a, 5 | BRF_GRA }, // 9 - { "ts_17.17g", 0x08000, 0xdeb657e4, 5 | BRF_GRA }, // 10 - { "ts_16.15g", 0x08000, 0xd363b5f9, 5 | BRF_GRA }, // 11 - { "ts_13.18f", 0x08000, 0xa8f5a004, 5 | BRF_GRA }, // 12 - { "ts_18.18g", 0x08000, 0x3b36948c, 5 | BRF_GRA }, // 13 - { "ts_23.18j", 0x08000, 0xbbfbe58a, 5 | BRF_GRA }, // 14 - { "ts_24.18k", 0x08000, 0xf156e564, 5 | BRF_GRA }, // 15 - - { "ts_10.13f", 0x08000, 0xc3587d05, 6 | BRF_GRA }, // 16 Sprites - { "ts_09.11f", 0x08000, 0x6b63eef2, 6 | BRF_GRA }, // 17 - { "ts_15.13g", 0x08000, 0xdb8cebb0, 6 | BRF_GRA }, // 18 - { "ts_14.11g", 0x08000, 0xe2e41abf, 6 | BRF_GRA }, // 19 - { "ts_20.13j", 0x08000, 0xbfd1a695, 6 | BRF_GRA }, // 20 - { "ts_19.11j", 0x08000, 0x928b669e, 6 | BRF_GRA }, // 21 - { "ts_22.17j", 0x08000, 0x3fe05d9a, 6 | BRF_GRA }, // 22 - { "ts_21.15j", 0x08000, 0x27a9bb7c, 6 | BRF_GRA }, // 23 - - { "63s141.18f", 0x00100, 0xb58d0023, 0 | BRF_OPT }, // 24 Priority (not used) - - { "c8751h-88", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(topsecrt) -STD_ROM_FN(topsecrt) - -struct BurnDriver BurnDrvtopsecrt = { - "topsecrt", "bionicc", NULL, NULL, "1987", - "Top Secret (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, topsecrtRomInfo, topsecrtRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; +// FB Alpha Bionic Commando driver module +// Based on MAME driver by Steven Frew, Phil Stroffolino, and Paul Leaman + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; +static UINT8 DrvDips[2]; + +static UINT8 *Mem, *MemEnd; +static UINT8 *AllRam, *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *Drv68KRAM0; +static UINT8 *DrvTextRAM; +static UINT8 *DrvVidRAM0; +static UINT8 *DrvVidRAM1; +static UINT8 *DrvPalRAM; +static UINT8 *Drv68KRAM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSprBuf; + +static UINT32 *DrvPalette; +static UINT32 *Palette; +static UINT8 DrvRecalc; + + +static UINT8 *soundlatch; + +static INT32 flipscreen; + +static INT32 fg_scroll_x; +static INT32 fg_scroll_y; +static INT32 bg_scroll_x; +static INT32 bg_scroll_y; + +static INT32 fg_enable; +static INT32 bg_enable; + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 5, "p1 start" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p1 right" }, + {"P1 Down", BIT_DIGITAL , DrvJoy2 + 4, "p1 down", }, + {"P1 Up", BIT_DIGITAL , DrvJoy2 + 5, "p1 up", }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 1, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 2"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 4, "p2 start" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 3, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 2, "p2 right" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 4, "p2 down", }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 5, "p2 up", }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 1, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 0, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8 , "Coin_A" }, + {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credit " }, + {0x11, 0x01, 0x07, 0x01, "3 Coins 1 Credit " }, + {0x11, 0x01, 0x07, 0x02, "2 Coins 1 Credit " }, + {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credit " }, + {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x07, 0x03, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin_B" }, + {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credit " }, + {0x11, 0x01, 0x38, 0x08, "3 Coins 1 Credit " }, + {0x11, 0x01, 0x38, 0x10, "2 Coins 1 Credit " }, + {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credit " }, + {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x38, 0x18, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x40, 0x40, "Off" }, + {0x11, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x04, 0x04, "Upright" }, + {0x12, 0x01, 0x04, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Bonus_Life" }, + {0x12, 0x01, 0x18, 0x18, "20K, 40K, every 60K" }, + {0x12, 0x01, 0x18, 0x10, "30K, 50K, every 70K" }, + {0x12, 0x01, 0x18, 0x08, "20K and 60K only" }, + {0x12, 0x01, 0x18, 0x00, "30K and 70K only" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x60, 0x40, "Easy" }, + {0x12, 0x01, 0x60, 0x60, "Medium" }, + {0x12, 0x01, 0x60, 0x20, "Hard" }, + {0x12, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Drv) + +static void bionicc_palette_write(INT32 offset) +{ + offset >>= 1; + + INT32 r, g, b, bright; + INT32 data = *((UINT16*)(DrvPalRAM + (offset << 1))); + + bright = (data&0x0f); + + r = ((data>>12)&0x0f) * 0x11; + g = ((data>>8 )&0x0f) * 0x11; + b = ((data>>4 )&0x0f) * 0x11; + + if ((bright & 0x08) == 0) + { + r = r * (0x07 + bright) / 0x0e; + g = g * (0x07 + bright) / 0x0e; + b = b * (0x07 + bright) / 0x0e; + } + + Palette[offset] = (r << 16) | (g << 8) | b; + DrvPalette[offset] = BurnHighCol(r, g, b, 0); +} + +void __fastcall bionicc_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfffff800) == 0xff8000) { + address &= 0x7ff; + + DrvPalRAM[address ^ 1] = data; + + bionicc_palette_write(address); + + return; + } + + switch (address) + { + case 0xfe4000: + case 0xfe4001: + flipscreen = data & 0x01; + fg_enable = data & 0x10; + bg_enable = data & 0x20; + return; + } +} + +void __fastcall bionicc_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfffff800) == 0xff8000) { + address &= 0x7ff; + + *((UINT16*)(DrvPalRAM + address)) = data; + + bionicc_palette_write(address); + + return; + } + + switch (address) + { + case 0xfe8010: + fg_scroll_x = data & 0x3ff; + return; + + case 0xfe8012: + fg_scroll_y = data & 0x3ff; + return; + + case 0xfe8014: + bg_scroll_x = data & 0x1ff; + return; + + case 0xfe8016: + bg_scroll_y = data & 0x1ff; + return; + + case 0xfe801a: + UINT16 *inp = (UINT16*)(Drv68KRAM1 + 0x3ffa); + inp[0] = (DrvInputs[0] >> 4) ^ 0x0f; + inp[1] = DrvInputs[2] ^ 0xff; + inp[2] = DrvInputs[1] ^ 0xff; + return; + } +} + +UINT8 __fastcall bionicc_read_byte(UINT32 address) +{ + switch (address) + { + case 0xfe4000: + return DrvInputs[0]; + + case 0xfe4001: + return 0xff; + + case 0xfe4002: + return DrvDips[0]; + + case 0xfe4003: + return DrvDips[1]; + } + + return 0; +} + +UINT16 __fastcall bionicc_read_word(UINT32 address) +{ + switch (address) + { + case 0xfe4000: + return 0x00ff | (DrvInputs[0] << 8); + + case 0xfe4002: + return DrvDips[0] | (DrvDips[1] << 8); + } + + return 0; +} + +UINT8 __fastcall bionicc_sound_read(UINT16 address) +{ + switch (address) + { + case 0x8001: + return BurnYM2151ReadStatus(); + + case 0xa000: + return *soundlatch; + } + + return 0; +} + +void __fastcall bionicc_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8000: + BurnYM2151SelectRegister(data); + return; + + case 0x8001: + BurnYM2151WriteRegister(data); + return; + } +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KROM = Next; Next += 0x0040000; + DrvZ80ROM = Next; Next += 0x0008000; + + DrvGfxROM0 = Next; Next += 0x0020000; + DrvGfxROM1 = Next; Next += 0x0020000; + DrvGfxROM2 = Next; Next += 0x0080000; + DrvGfxROM3 = Next; Next += 0x0080000; + + DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM0 = Next; Next += 0x0004000; + Drv68KRAM1 = Next; Next += 0x0004000; + DrvPalRAM = Next; Next += 0x0000800; + DrvTextRAM = Next; Next += 0x0001000; + DrvVidRAM0 = Next; Next += 0x0004000; + DrvVidRAM1 = Next; Next += 0x0004000; + + DrvSprBuf = Next; Next += 0x0000500; + + DrvZ80RAM = Next; Next += 0x0000800; + + Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + fg_scroll_x = 0; + fg_scroll_y = 0; + bg_scroll_x = 0; + bg_scroll_y = 0; + + soundlatch = Drv68KRAM1 + 0x3ff8; + flipscreen = 0; + + fg_enable = 0; + bg_enable = 0; + + SekOpen(0); + SekReset(); + SekClose(); + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + return 0; +} + +static INT32 DrvGfxDecode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); + if (tmp == NULL) { + return 1; + } + + static INT32 CharPlanes[2] = { 0x000004, 0x000000 }; + static INT32 Tile0Planes[4] = { 0x040004, 0x040000, 0x000004, 0x000000 }; + static INT32 Tile1Planes[4] = { 0x100004, 0x100000, 0x000004, 0x000000 }; + static INT32 SpriPlanes[4] = { 0x180000, 0x100000, 0x080000, 0x000000 }; + static INT32 CharXOffsets[16] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, + 0x100, 0x101, 0x102, 0x103, 0x108, 0x109, 0x10a, 0x10b }; + static INT32 SpriXOffsets[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087 }; + static INT32 CharYOffsets[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, + 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0 }; + static INT32 SpriYOffsets[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, + 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; + + memcpy (tmp, DrvGfxROM0, 0x08000); + + GfxDecode(0x00400, 2, 8, 8, CharPlanes, CharXOffsets, CharYOffsets, 0x080, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x10000); + + GfxDecode(0x00800, 4, 8, 8, Tile0Planes, CharXOffsets, CharYOffsets, 0x080, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x40000); + + GfxDecode(0x00800, 4, 16, 16, Tile1Planes, CharXOffsets, CharYOffsets, 0x200, tmp, DrvGfxROM2); + + memcpy (tmp, DrvGfxROM3, 0x40000); + + GfxDecode(0x00800, 4, 16, 16, SpriPlanes, SpriXOffsets, SpriYOffsets, 0x100, tmp, DrvGfxROM3); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x20001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x20000, 3, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x0000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x8000, 7, 1)) return 1; + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(DrvGfxROM2 + i * 0x8000, i + 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + i * 0x8000, i + 16, 1)) return 1; + } + + if (DrvGfxDecode()) return 1; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRAM0, 0xfe0000, 0xfe3fff, SM_RAM); + SekMapMemory(DrvTextRAM, 0xfec000, 0xfecfff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0xff0000, 0xff3fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0xff4000, 0xff7fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xff8000, 0xff87ff, SM_ROM); + SekMapMemory(Drv68KRAM1, 0xffc000, 0xffffff, SM_RAM); + SekSetReadByteHandler(0, bionicc_read_byte); + SekSetReadWordHandler(0, bionicc_read_word); + SekSetWriteByteHandler(0, bionicc_write_byte); + SekSetWriteWordHandler(0, bionicc_write_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(bionicc_sound_write); + ZetSetReadHandler(bionicc_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + BurnYM2151Exit(); + SekExit(); + ZetExit(); + + BurnFree (Mem); + + GenericTilesExit(); + + return 0; +} + +static void draw_foreground(INT32 priority) +{ + UINT16 *vidram = (UINT16*)DrvVidRAM0; + + for (INT32 offs = 0; offs < 0x4000 / 4; offs++) + { + INT32 sx = (offs & 0x3f) << 4; + INT32 sy = (offs >> 6) << 4; + + sx -= fg_scroll_x; + sy -= fg_scroll_y; + + if (sx < -15) sx += 0x400; + if (sy < -15) sy += 0x400; + if (sx < -15 || sx > 255 || sy < 1 || sy > 239) continue; + sy -= 16; + + INT32 attr = vidram[(offs << 1) | 1]; + INT32 code = (vidram[offs << 1] & 0xff) | ((attr & 0x07) << 8); + INT32 color = (attr & 0x18) >> 3; + INT32 flipx = attr & 0x80; + INT32 flipy = attr & 0x40; + INT32 prior = (attr & 0x20) >> 5; + + if ((attr & 0xc0) == 0xc0) { + flipx = 0; + flipy = 0; + prior = 2; + } + + if (prior != priority) continue; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + memset (pTransDraw, 0, nScreenHeight * nScreenWidth * 2); + + if (fg_enable) { + draw_foreground(2); + } + + if (bg_enable) + { + UINT16 *vidram = (UINT16*)DrvVidRAM1; + + for (INT32 offs = 0; offs < 0x4000 / 4; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + sx -= bg_scroll_x; + sy -= bg_scroll_y; + + if (sx < -7) sx += 0x200; + if (sy < -7) sy += 0x200; + if (sy < 9 || sy > 239 || sx < -7 || sx > 255) continue; + sy -= 16; + + INT32 attr = vidram[(offs << 1) | 1]; + INT32 code = (vidram[offs << 1] & 0xff) | ((attr & 0x07) << 8); + INT32 color = (attr & 0x18) >> 3; + INT32 flipx = attr & 0x80; + INT32 flipy = attr & 0x40; + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x000, DrvGfxROM1); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x000, DrvGfxROM1); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x000, DrvGfxROM1); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x000, DrvGfxROM1); + } + } + } + } + + if (fg_enable) { + draw_foreground(0); + } + + { + UINT16 *vidram = (UINT16*)DrvSprBuf; + + for (INT32 offs = (0x500-8)/2; offs >= 0; offs -= 4) + { + INT32 code = vidram[offs] & 0x7ff; + + if (code != 0x7ff) + { + INT32 attr = vidram[offs+1]; + INT32 color = (attr&0x3C)>>2; + INT32 flipx = attr & 0x02; + INT32 sx = (INT16)vidram[offs+3]; + INT32 sy = (INT16)vidram[offs+2]; + if(sy>512-16) sy-=512; + + if (sx < -15 || sx > 255 || sy < 1 || sy > 239) continue; + + sy -= 16; + + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x200, DrvGfxROM3); + } + } + } + } + + if (fg_enable) { + draw_foreground(1); + } + + { + UINT16 *vidram = (UINT16*)DrvTextRAM; + + for (INT32 offs = 0; offs < 0x800 / 2; offs++) + { + INT32 sx = (offs << 3) & 0xf8; + INT32 sy = (offs >> 2) & 0xf8; + sy -= 16; + if (sy < 0 || sy > 223) continue; + + INT32 attr = vidram[offs + 0x400]; + INT32 code = (vidram[offs] & 0xff) | ((attr & 0xc0) << 2); + INT32 color = attr & 0x3f; + + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 2, 3, 0x300, DrvGfxROM0); + } + } + + if (flipscreen) { + INT32 nSize = (nScreenWidth * nScreenHeight) - 1; + for (INT32 i = 0; i < nSize >> 1; i++) { + INT32 n = pTransDraw[i]; + pTransDraw[i] = pTransDraw[nSize - i]; + pTransDraw[nSize - i] = n; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= DrvJoy1[i] << i; + DrvInputs[1] ^= DrvJoy2[i] << i; + DrvInputs[2] ^= DrvJoy3[i] << i; + } + } + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 8; + INT32 nTotalCycles[2] = { 12000000 / 60, 3579545 / 60 }; + + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nTotalCycles[0] -= SekRun(nTotalCycles[0] / (nInterleave - i)); + if (i != (nInterleave - 1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + nTotalCycles[1] -= ZetRun(nTotalCycles[1] / (nInterleave - i)); + if ((i & 1) == 1) ZetNmi(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + // Lag sprites 1 frame + memcpy (DrvSprBuf, Drv68KRAM0 + 0x800, 0x500); + + return 0; +} + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029682; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + + SCAN_VAR(fg_scroll_x); + SCAN_VAR(fg_scroll_y); + SCAN_VAR(bg_scroll_x); + SCAN_VAR(bg_scroll_y); + SCAN_VAR(fg_enable); + SCAN_VAR(bg_enable); + SCAN_VAR(flipscreen); + } + + return 0; +} + +// Bionic Commando (Euro) + +static struct BurnRomInfo bioniccRomDesc[] = { + { "tse_02.1a", 0x10000, 0xe4aeefaa, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tse_04.1b", 0x10000, 0xd0c8ec75, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tse_03.2a", 0x10000, 0xb2ac0a45, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tse_05.2b", 0x10000, 0xa79cb406, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "ts_01b.4e", 0x08000, 0xa9a6cafa, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "tsu_08.8l", 0x08000, 0x9bf0b7a2, 3 | BRF_GRA }, // 5 Characters + + { "tsu_07.5l", 0x08000, 0x9469efa4, 4 | BRF_GRA }, // 6 Background Tiles + { "tsu_06.4l", 0x08000, 0x40bf0eb4, 4 | BRF_GRA }, // 7 + + { "ts_12.17f", 0x08000, 0xe4b4619e, 5 | BRF_GRA }, // 8 Foreground Tiles + { "ts_11.15f", 0x08000, 0xab30237a, 5 | BRF_GRA }, // 9 + { "ts_17.17g", 0x08000, 0xdeb657e4, 5 | BRF_GRA }, // 10 + { "ts_16.15g", 0x08000, 0xd363b5f9, 5 | BRF_GRA }, // 11 + { "ts_13.18f", 0x08000, 0xa8f5a004, 5 | BRF_GRA }, // 12 + { "ts_18.18g", 0x08000, 0x3b36948c, 5 | BRF_GRA }, // 13 + { "ts_23.18j", 0x08000, 0xbbfbe58a, 5 | BRF_GRA }, // 14 + { "ts_24.18k", 0x08000, 0xf156e564, 5 | BRF_GRA }, // 15 + + { "tse_10.13f", 0x08000, 0xd28eeacc, 6 | BRF_GRA }, // 16 Sprites + { "tsu_09.11f", 0x08000, 0x6a049292, 6 | BRF_GRA }, // 17 + { "tse_15.13g", 0x08000, 0x9b5593c0, 6 | BRF_GRA }, // 18 + { "tsu_14.11g", 0x08000, 0x46b2ad83, 6 | BRF_GRA }, // 19 + { "tse_20.13j", 0x08000, 0xb03db778, 6 | BRF_GRA }, // 20 + { "tsu_19.11j", 0x08000, 0xb5c82722, 6 | BRF_GRA }, // 21 + { "tse_22.17j", 0x08000, 0xd4dedeb3, 6 | BRF_GRA }, // 22 + { "tsu_21.15j", 0x08000, 0x98777006, 6 | BRF_GRA }, // 23 + + { "63s141.18f", 0x00100, 0xb58d0023, 0 | BRF_OPT }, // 24 Priority (not used) + + { "c8751h-88", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(bionicc) +STD_ROM_FN(bionicc) + +struct BurnDriver BurnDrvbionicc = { + "bionicc", NULL, NULL, NULL, "1987", + "Bionic Commando (Euro)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, bioniccRomInfo, bioniccRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Bionic Commando (US set 1) + +static struct BurnRomInfo bionicc1RomDesc[] = { + { "tsu_02b.1a", 0x10000, 0xcf965a0a, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tsu_04b.1b", 0x10000, 0xc9884bfb, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tsu_03b.2a", 0x10000, 0x4e157ae2, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tsu_05b.2b", 0x10000, 0xe66ca0f9, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "ts_01b.4e", 0x08000, 0xa9a6cafa, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "tsu_08.8l", 0x08000, 0x9bf0b7a2, 3 | BRF_GRA }, // 5 Characters + + { "tsu_07.5l", 0x08000, 0x9469efa4, 4 | BRF_GRA }, // 6 Background Tiles + { "tsu_06.4l", 0x08000, 0x40bf0eb4, 4 | BRF_GRA }, // 7 + + { "ts_12.17f", 0x08000, 0xe4b4619e, 5 | BRF_GRA }, // 8 Foreground Tiles + { "ts_11.15f", 0x08000, 0xab30237a, 5 | BRF_GRA }, // 9 + { "ts_17.17g", 0x08000, 0xdeb657e4, 5 | BRF_GRA }, // 10 + { "ts_16.15g", 0x08000, 0xd363b5f9, 5 | BRF_GRA }, // 11 + { "ts_13.18f", 0x08000, 0xa8f5a004, 5 | BRF_GRA }, // 12 + { "ts_18.18g", 0x08000, 0x3b36948c, 5 | BRF_GRA }, // 13 + { "ts_23.18j", 0x08000, 0xbbfbe58a, 5 | BRF_GRA }, // 14 + { "ts_24.18k", 0x08000, 0xf156e564, 5 | BRF_GRA }, // 15 + + { "tsu_10.13f", 0x08000, 0xf1180d02, 6 | BRF_GRA }, // 16 Sprites + { "tsu_09.11f", 0x08000, 0x6a049292, 6 | BRF_GRA }, // 17 + { "tsu_15.13g", 0x08000, 0xea912701, 6 | BRF_GRA }, // 18 + { "tsu_14.11g", 0x08000, 0x46b2ad83, 6 | BRF_GRA }, // 19 + { "tsu_20.13j", 0x08000, 0x17857ad2, 6 | BRF_GRA }, // 20 + { "tsu_19.11j", 0x08000, 0xb5c82722, 6 | BRF_GRA }, // 21 + { "tsu_22.17j", 0x08000, 0x5ee1ae6a, 6 | BRF_GRA }, // 22 + { "tsu_21.15j", 0x08000, 0x98777006, 6 | BRF_GRA }, // 23 + + { "63s141.18f", 0x00100, 0xb58d0023, 0 | BRF_OPT }, // 24 Priority (not used) + + { "c8751h-88", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(bionicc1) +STD_ROM_FN(bionicc1) + +struct BurnDriver BurnDrvbionicc1 = { + "bionicc1", "bionicc", NULL, NULL, "1987", + "Bionic Commando (US set 1)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, bionicc1RomInfo, bionicc1RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Bionic Commando (US set 2) + +static struct BurnRomInfo bionicc2RomDesc[] = { + { "tsu_02.1a", 0x10000, 0xf2528f08, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tsu_04.1b", 0x10000, 0x38b1c7e4, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tsu_03.2a", 0x10000, 0x72c3b76f, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tsu_05.2b", 0x10000, 0x70621f83, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "ts_01b.4e", 0x08000, 0xa9a6cafa, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "tsu_08.8l", 0x08000, 0x9bf0b7a2, 3 | BRF_GRA }, // 5 Characters + + { "tsu_07.5l", 0x08000, 0x9469efa4, 4 | BRF_GRA }, // 6 Background Tiles + { "tsu_06.4l", 0x08000, 0x40bf0eb4, 4 | BRF_GRA }, // 7 + + { "ts_12.17f", 0x08000, 0xe4b4619e, 5 | BRF_GRA }, // 8 Foreground Tiles + { "ts_11.15f", 0x08000, 0xab30237a, 5 | BRF_GRA }, // 9 + { "ts_17.17g", 0x08000, 0xdeb657e4, 5 | BRF_GRA }, // 10 + { "ts_16.15g", 0x08000, 0xd363b5f9, 5 | BRF_GRA }, // 11 + { "ts_13.18f", 0x08000, 0xa8f5a004, 5 | BRF_GRA }, // 12 + { "ts_18.18g", 0x08000, 0x3b36948c, 5 | BRF_GRA }, // 13 + { "ts_23.18j", 0x08000, 0xbbfbe58a, 5 | BRF_GRA }, // 14 + { "ts_24.18k", 0x08000, 0xf156e564, 5 | BRF_GRA }, // 15 + + { "tsu_10.13f", 0x08000, 0xf1180d02, 6 | BRF_GRA }, // 16 Sprites + { "tsu_09.11f", 0x08000, 0x6a049292, 6 | BRF_GRA }, // 17 + { "tsu_15.13g", 0x08000, 0xea912701, 6 | BRF_GRA }, // 18 + { "tsu_14.11g", 0x08000, 0x46b2ad83, 6 | BRF_GRA }, // 19 + { "tsu_20.13j", 0x08000, 0x17857ad2, 6 | BRF_GRA }, // 20 + { "tsu_19.11j", 0x08000, 0xb5c82722, 6 | BRF_GRA }, // 21 + { "tsu_22.17j", 0x08000, 0x5ee1ae6a, 6 | BRF_GRA }, // 22 + { "tsu_21.15j", 0x08000, 0x98777006, 6 | BRF_GRA }, // 23 + + { "63s141.18f", 0x00100, 0xb58d0023, 0 | BRF_OPT }, // 24 Priority (not used) + + { "c8751h-88", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(bionicc2) +STD_ROM_FN(bionicc2) + +struct BurnDriver BurnDrvbionicc2 = { + "bionicc2", "bionicc", NULL, NULL, "1987", + "Bionic Commando (US set 2)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, bionicc2RomInfo, bionicc2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Top Secret (Japan) + +static struct BurnRomInfo topsecrtRomDesc[] = { + { "ts_02.1a", 0x10000, 0xb2fe1ddb, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ts_04.1b", 0x10000, 0x427a003d, 1 | BRF_PRG | BRF_ESS }, // 1 + { "ts_03.2a", 0x10000, 0x27f04bb6, 1 | BRF_PRG | BRF_ESS }, // 2 + { "ts_05.2b", 0x10000, 0xc01547b1, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "ts_01.4e", 0x08000, 0x8ea07917, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "ts_08.8l", 0x08000, 0x96ad379e, 3 | BRF_GRA }, // 5 Characters + + { "ts_07.5l", 0x08000, 0x25cdf8b2, 4 | BRF_GRA }, // 6 Background Tiles + { "ts_06.4l", 0x08000, 0x314fb12d, 4 | BRF_GRA }, // 7 + + { "ts_12.17f", 0x08000, 0xe4b4619e, 5 | BRF_GRA }, // 8 Foreground Tiles + { "ts_11.15f", 0x08000, 0xab30237a, 5 | BRF_GRA }, // 9 + { "ts_17.17g", 0x08000, 0xdeb657e4, 5 | BRF_GRA }, // 10 + { "ts_16.15g", 0x08000, 0xd363b5f9, 5 | BRF_GRA }, // 11 + { "ts_13.18f", 0x08000, 0xa8f5a004, 5 | BRF_GRA }, // 12 + { "ts_18.18g", 0x08000, 0x3b36948c, 5 | BRF_GRA }, // 13 + { "ts_23.18j", 0x08000, 0xbbfbe58a, 5 | BRF_GRA }, // 14 + { "ts_24.18k", 0x08000, 0xf156e564, 5 | BRF_GRA }, // 15 + + { "ts_10.13f", 0x08000, 0xc3587d05, 6 | BRF_GRA }, // 16 Sprites + { "ts_09.11f", 0x08000, 0x6b63eef2, 6 | BRF_GRA }, // 17 + { "ts_15.13g", 0x08000, 0xdb8cebb0, 6 | BRF_GRA }, // 18 + { "ts_14.11g", 0x08000, 0xe2e41abf, 6 | BRF_GRA }, // 19 + { "ts_20.13j", 0x08000, 0xbfd1a695, 6 | BRF_GRA }, // 20 + { "ts_19.11j", 0x08000, 0x928b669e, 6 | BRF_GRA }, // 21 + { "ts_22.17j", 0x08000, 0x3fe05d9a, 6 | BRF_GRA }, // 22 + { "ts_21.15j", 0x08000, 0x27a9bb7c, 6 | BRF_GRA }, // 23 + + { "63s141.18f", 0x00100, 0xb58d0023, 0 | BRF_OPT }, // 24 Priority (not used) + + { "c8751h-88", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(topsecrt) +STD_ROM_FN(topsecrt) + +struct BurnDriver BurnDrvtopsecrt = { + "topsecrt", "bionicc", NULL, NULL, "1987", + "Top Secret (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, topsecrtRomInfo, topsecrtRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_blktiger.cpp b/src/burn/drv/pre90s/d_blktiger.cpp index 9a4fa9ce1..4bb55e1c0 100644 --- a/src/burn/drv/pre90s/d_blktiger.cpp +++ b/src/burn/drv/pre90s/d_blktiger.cpp @@ -1,1093 +1,1091 @@ -// FB Alpha Black Tiger driver module -// Based on MAME driver by Paul Leaman - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2203.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf; -static UINT8 *DrvPalRAM; -static UINT8 *DrvBgRAM; -static UINT8 *DrvTxRAM; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *DrvScreenLayout; -static UINT8 *DrvBgEnable; -static UINT8 *DrvFgEnable; -static UINT8 *DrvSprEnable; -static UINT8 *DrvVidBank; -static UINT8 *DrvRomBank; - -static UINT8 *soundlatch; -static UINT8 *flipscreen; -static UINT8 *coin_lockout; -static INT32 watchdog; - -static UINT16 *DrvScrollx; -static UINT16 *DrvScrolly; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static INT32 nCyclesTotal[2]; - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - - {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Service", BIT_DIGITAL , DrvJoy1 + 5, "service" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0x01, 0x01, NULL }, - - {0x12, 0xfe, 0, 8, "Coin A" }, - {0x12, 0x01, 0x07, 0x00, "4 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "3 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x02, "2 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, - - {0x12, 0xfe, 0, 8, "Coin B" }, - {0x12, 0x01, 0x38, 0x00, "4 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x08, "3 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x10, "2 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, - - {0x12, 0xfe, 0, 2, "Flip Screen" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0x12, 0xfe, 0, 2, "Test" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0x13, 0xfe, 0, 4, "Lives" }, - {0x13, 0x01, 0x03, 0x02, "2" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0x13, 0xfe, 0, 8, "Difficulty" }, - {0x13, 0x01, 0x1c, 0x1c, "1 (Easiest)" }, - {0x13, 0x01, 0x1c, 0x18, "2" }, - {0x13, 0x01, 0x1c, 0x14, "3" }, - {0x13, 0x01, 0x1c, 0x10, "4" }, - {0x13, 0x01, 0x1c, 0x0c, "5 (Normal)" }, - {0x13, 0x01, 0x1c, 0x08, "6" }, - {0x13, 0x01, 0x1c, 0x04, "7" }, - {0x13, 0x01, 0x1c, 0x00, "8 (Hardest)" }, - - {0x13, 0xfe, 0, 2, "Demo Sounds" }, - {0x13, 0x01, 0x20, 0x00, "Off" }, - {0x13, 0x01, 0x20, 0x20, "On" }, - - {0x13, 0xfe, 0, 2, "Allow Continue" }, - {0x13, 0x01, 0x40, 0x00, "No" }, - {0x13, 0x01, 0x40, 0x40, "Yes" }, - - {0x13, 0xfe, 0, 2, "Cabinet" }, - {0x13, 0x01, 0x80, 0x00, "Upright" }, - {0x13, 0x01, 0x80, 0x80, "Cocktail" }, - - {0x14, 0xfe, 0, 2, "Coin Lockout Present?"}, - {0x14, 0x01, 0x01, 0x01, "Yes" }, - {0x14, 0x01, 0x01, 0x00, "No" }, -}; - -STDDIPINFO(Drv) - -static void palette_write(INT32 offset) -{ - UINT8 r,g,b; - UINT16 data = (DrvPalRAM[offset]) | (DrvPalRAM[offset | 0x400] << 8); - - r = (data >> 4) & 0x0f; - g = (data >> 0) & 0x0f; - b = (data >> 8) & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - DrvPalette[offset] = BurnHighCol(r, g, b, 0); -} - -static void DrvRomBankswitch(INT32 bank) -{ - *DrvRomBank = bank & 0x0f; - - INT32 nBank = 0x10000 + (bank & 0x0f) * 0x4000; - - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + nBank); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + nBank); -} - -static void DrvVidRamBankswitch(INT32 bank) -{ - *DrvVidBank = bank & 0x03; - - INT32 nBank = (bank & 3) * 0x1000; - - ZetMapArea(0xc000, 0xcfff, 0, DrvBgRAM + nBank); - ZetMapArea(0xc000, 0xcfff, 1, DrvBgRAM + nBank); - ZetMapArea(0xc000, 0xcfff, 2, DrvBgRAM + nBank); -} - -void __fastcall blacktiger_write(UINT16 address, UINT8 data) -{ - if ((address & 0xf800) == 0xd800) { - DrvPalRAM[address & 0x7ff] = data; - - palette_write(address & 0x3ff); - - return; - } - - return; -} - -UINT8 __fastcall blacktiger_read(UINT16 /*address*/) -{ - return 0; -} - -void __fastcall blacktiger_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - { - // INT64 cycles = ZetTotalCycles(); - // ZetClose(); - // ZetOpen(1); - - // INT32 nCycles = ((INT64)cycles * nCyclesTotal[1] / nCyclesTotal[0]); - // if (nCycles <= ZetTotalCycles()) return; - - // BurnTimerUpdate(nCycles); - // ZetClose(); - // ZetOpen(0); - - *soundlatch = data; - } - return; - - case 0x01: - DrvRomBankswitch(data); - return; - - case 0x03: - if (DrvDips[2] & 1) { - *coin_lockout = ~data << 6; - } - return; - - case 0x04: - if (data & 0x20) { - ZetClose(); - ZetOpen(1); - ZetReset(); - ZetClose(); - ZetOpen(0); - } - - *flipscreen = data & 0x40; - *DrvFgEnable = ~data & 0x80; - - return; - - case 0x06: - watchdog = 0; - return; - - case 0x08: - *DrvScrollx = (*DrvScrollx & 0xff00) | data; - return; - - case 0x09: - *DrvScrollx = (*DrvScrollx & 0x00ff) | (data << 8); - return; - - case 0x0a: - *DrvScrolly = (*DrvScrolly & 0xff00) | data; - return; - - case 0x0b: - *DrvScrolly = (*DrvScrolly & 0x00ff) | (data << 8); - return; - - case 0x0c: - *DrvSprEnable = ~data & 0x02; - *DrvBgEnable = ~data & 0x04; - return; - - case 0x0d: - DrvVidRamBankswitch(data); - return; - - case 0x0e: - *DrvScreenLayout = data ? 1 : 0; - return; - } -} - -UINT8 __fastcall blacktiger_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - case 0x02: - return DrvInputs[port & 3]; - - case 0x03: - case 0x04: - return DrvDips[~port & 1]; - - case 0x05: - return 0x01; - - case 0x07: - return ZetDe(-1) >> 8; - } - - return 0; -} - -void __fastcall blacktiger_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe000: - BurnYM2203Write(0, 0, data); - return; - - case 0xe001: - BurnYM2203Write(0, 1, data); - return; - - case 0xe002: - BurnYM2203Write(1, 0, data); - return; - - case 0xe003: - BurnYM2203Write(1, 1, data); - return; - } -} - -UINT8 __fastcall blacktiger_sound_read(UINT16 address) -{ - switch (address) - { - case 0xc800: - return *soundlatch; - - case 0xe000: - return BurnYM2203Read(0, 0); - - case 0xe001: - return BurnYM2203Read(0, 1); - - case 0xe002: - return BurnYM2203Read(1, 0); - - case 0xe003: - return BurnYM2203Read(1, 1); - } - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x050000; - DrvZ80ROM1 = Next; Next += 0x008000; - - DrvGfxROM0 = Next; Next += 0x020000; - DrvGfxROM1 = Next; Next += 0x080000; - DrvGfxROM2 = Next; Next += 0x080000; - - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x001e00; - DrvZ80RAM1 = Next; Next += 0x000800; - - DrvPalRAM = Next; Next += 0x000800; - DrvTxRAM = Next; Next += 0x000800; - DrvBgRAM = Next; Next += 0x004000; - DrvSprRAM = Next; Next += 0x001200; - DrvSprBuf = Next; Next += 0x001200; - - DrvScreenLayout = Next; Next += 0x000001; - DrvBgEnable = Next; Next += 0x000001; - DrvFgEnable = Next; Next += 0x000001; - DrvSprEnable = Next; Next += 0x000001; - - DrvVidBank = Next; Next += 0x000001; - DrvRomBank = Next; Next += 0x000001; - - DrvScrollx = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); - DrvScrolly = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); - - soundlatch = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - coin_lockout = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset(INT32 full_reset) -{ - if (full_reset) { - memset (AllRam, 0, RamEnd - AllRam); - } - - ZetOpen(0); - ZetReset(); - DrvRomBankswitch(1); - DrvVidRamBankswitch(1); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - - watchdog = 0; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { ((0x40000 * 8) / 2) + 4, ((0x40000 * 8) / 2) + 0, 4, 0 }; - INT32 XOffs[16] = { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3, - 16*16+0, 16*16+1, 16*16+2, 16*16+3, 16*16+8+0, 16*16+8+1, 16*16+8+2, 16*16+8+3 }; - INT32 YOffs[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, - 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x08000); - - GfxDecode(0x0800, 2, 8, 8, Plane + 2, XOffs, YOffs, 0x080, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x40000); - - GfxDecode(0x0800, 4, 16, 16, Plane + 0, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x40000); - - GfxDecode(0x0800, 4, 16, 16, Plane + 0, XOffs, YOffs, 0x200, tmp, DrvGfxROM2); - - BurnFree (tmp); - - return 0; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3579545; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3579545; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - for (INT32 i = 0; i < 5; i++) { - if (BurnLoadRom(DrvZ80ROM0 + i * 0x10000, 0 + i, 1)) return 1; - } - - if (BurnLoadRom(DrvZ80ROM1, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 6, 1)) return 1; - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x10000, 7 + i, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + i * 0x10000, 11 + i, 1)) return 1; - } - - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0xd000, 0xd7ff, 0, DrvTxRAM); - ZetMapArea(0xd000, 0xd7ff, 1, DrvTxRAM); - ZetMapArea(0xd000, 0xd7ff, 2, DrvTxRAM); - ZetMapArea(0xd800, 0xdfff, 0, DrvPalRAM); -// ZetMapArea(0xd800, 0xdfff, 1, DrvPalRAM); - ZetMapArea(0xd800, 0xdfff, 2, DrvPalRAM); - ZetMapArea(0xe000, 0xfdff, 0, DrvZ80RAM0); - ZetMapArea(0xe000, 0xfdff, 1, DrvZ80RAM0); - ZetMapArea(0xe000, 0xfdff, 2, DrvZ80RAM0); - ZetMapArea(0xfe00, 0xffff, 0, DrvSprRAM); - ZetMapArea(0xfe00, 0xffff, 1, DrvSprRAM); - ZetMapArea(0xfe00, 0xffff, 2, DrvSprRAM); - ZetSetWriteHandler(blacktiger_write); - ZetSetReadHandler(blacktiger_read); - ZetSetInHandler(blacktiger_in); - ZetSetOutHandler(blacktiger_out); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM1); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM1); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM1); - ZetSetWriteHandler(blacktiger_sound_write); - ZetSetReadHandler(blacktiger_sound_read); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - - BurnYM2203Init(2, 3579545, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3579545); - BurnYM2203SetAllRoutes(0, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetAllRoutes(1, 0.15, BURN_SND_ROUTE_BOTH); - - DrvDoReset(1); - - return 0; -} - -static INT32 DrvExit() -{ - BurnYM2203Exit(); - ZetExit(); - GenericTilesExit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_bg(INT32 type, INT32 layer) -{ -// Priority masks should be enabled, but I don't see anywhere that they are used? -//#define USE_MASKS - -#ifdef USE_MASKS - UINT16 masks[2][4] = { { 0xffff, 0xfff0, 0xff00, 0xf000 }, { 0x8000, 0x800f, 0x80ff, 0x8fff } }; -#else - if (layer == 0) return; -#endif - - INT32 scrollx = (*DrvScrollx) & (0x3ff | (0x200 << type)); - INT32 scrolly = ((*DrvScrolly)+16) & (0x7ff >> type); - - for (INT32 offs = 0; offs < 0x2000; offs++) - { - INT32 sx, sy, ofst; - - if (type) { // 1 = 128x64, 0 = 64x128 - sx = (offs & 0x7f); - sy = (offs >> 7); - - ofst = (sx & 0x0f) + ((sy & 0x0f) << 4) + ((sx & 0x70) << 4) + ((sy & 0x30) << 7); - } else { - sx = (offs & 0x3f); - sy = (offs >> 6); - - ofst = (sx & 0x0f) + ((sy & 0x0f) << 4) + ((sx & 0x30) << 4) + ((sy & 0x70) << 7); - } - - sx = (sx * 16) - scrollx; - sy = (sy * 16) - scrolly; - - if (sx < -15) sx += (0x400 << type); - if (sy < -15) sy += (0x800 >> type); - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 attr = DrvBgRAM[(ofst << 1) | 1]; - INT32 color = (attr >> 3) & 0x0f; - INT32 code = DrvBgRAM[ofst << 1] | ((attr & 0x07) << 8); - INT32 flipx = attr & 0x80; - INT32 flipy = 0; - - if (*flipscreen) { - flipx ^= 0x80; - flipy = 1; - - sx = 240 - sx; - sy = 208 - sy; - } - -#ifdef USE_MASKS - INT32 colmask = masks[layer][(color < 2) ? 3 : 0]; - - { - UINT8 *gfx = DrvGfxROM1 + (code * 0x100); - color <<= 4; - - INT32 flip = (flipx ? 0x0f : 0) + (flipy ? 0xf0 : 0); - - for (INT32 y = 0; y < 16; y++, sy++, sx-=16) { - for (INT32 x = 0; x < 16; x++, sx++) { - if (sx < 0 || sx >= nScreenWidth || sy < 0 || sy >= nScreenHeight) continue; - - INT32 pxl = gfx[(y*16+x)^flip]; - - if (colmask & (1 << pxl)) continue; // right? - - pTransDraw[sy * nScreenWidth + sx] = pxl + color; - } - } - } -#else - if (*flipscreen) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM1); - } - } -#endif - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0x1200 - 4; offs >= 0; offs -= 4) - { - INT32 attr = DrvSprBuf[offs+1]; - INT32 sx = DrvSprBuf[offs + 3] - ((attr & 0x10) << 4); - INT32 sy = DrvSprBuf[offs + 2]; - INT32 code = DrvSprBuf[offs] | ((attr & 0xe0) << 3); - INT32 color = attr & 0x07; - INT32 flipx = attr & 0x08; - - if (*flipscreen) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - } - - sy -= 16; - - if (sy < -15 || sy > 239 || sx < -15 || sx > 255) continue; - - if (*flipscreen) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0x200, DrvGfxROM2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0x200, DrvGfxROM2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0x200, DrvGfxROM2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0x200, DrvGfxROM2); - } - } - } -} - -static void draw_text_layer() -{ - for (INT32 offs = 0x40; offs < 0x3c0; offs++) - { - INT32 attr = DrvTxRAM[offs | 0x400]; - INT32 code = DrvTxRAM[offs] | ((attr & 0xe0) << 3); - - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - if (*flipscreen) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, 248 - sx, 216 - (sy - 16), (attr & 0x1f)/*color*/, 2, 3, 0x300, DrvGfxROM0); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy - 16, (attr & 0x1f)/*color*/, 2, 3, 0x300, DrvGfxROM0); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - palette_write(i); - } - } - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x3ff; - } - - if (*DrvBgEnable) { - if (nSpriteEnable & 1) draw_bg(*DrvScreenLayout, 1); - } - - if (*DrvSprEnable) { - if (nSpriteEnable & 2) draw_sprites(); - } - - if (*DrvBgEnable) { - if (nSpriteEnable & 4) draw_bg(*DrvScreenLayout, 0); - } - - if (*DrvFgEnable) { - if (nSpriteEnable & 8) draw_text_layer(); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(1); - } - - if (watchdog >= 180) { - DrvDoReset(0); - } - watchdog++; - - { - DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - DrvInputs[0] |= *coin_lockout; - } - - ZetNewFrame(); - - INT32 nInterleave = 100; - nCyclesTotal[0] = 6000000 / 60; - nCyclesTotal[1] = 3579545 / 60; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 98) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == 99) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - // Run Z80 #2 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - ZetClose(); - } - - ZetOpen(1); - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - memcpy (DrvSprBuf, DrvSprRAM, 0x1200); - - return 0; -} - - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029698; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - } - - ZetOpen(0); - DrvRomBankswitch(*DrvRomBank); - DrvVidRamBankswitch(*DrvVidBank); - ZetClose(); - - return 0; -} - - -// Black Tiger - -static struct BurnRomInfo blktigerRomDesc[] = { - { "bdu-01a.5e", 0x08000, 0xa8f98f22, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code - { "bdu-02a.6e", 0x10000, 0x7bef96e8, 1 | BRF_PRG | BRF_ESS }, // 1 - { "bdu-03a.8e", 0x10000, 0x4089e157, 1 | BRF_PRG | BRF_ESS }, // 2 - { "bd-04.9e", 0x10000, 0xed6af6ec, 1 | BRF_PRG | BRF_ESS }, // 3 - { "bd-05.10e", 0x10000, 0xae59b72e, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "bd-06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code - - { "bd-15.2n", 0x08000, 0x70175d78, 3 | BRF_GRA }, // 6 - Characters - - { "bd-12.5b", 0x10000, 0xc4524993, 4 | BRF_GRA }, // 7 - Background Tiles - { "bd-11.4b", 0x10000, 0x7932c86f, 4 | BRF_GRA }, // 8 - { "bd-14.9b", 0x10000, 0xdc49593a, 4 | BRF_GRA }, // 9 - { "bd-13.8b", 0x10000, 0x7ed7a122, 4 | BRF_GRA }, // 10 - - { "bd-08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites - { "bd-07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 - { "bd-10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 - { "bd-09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 - - { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) - { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 - { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 - { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 - - { "bd.6k", 0x01000, 0xac7d14f1, 7 | BRF_PRG | BRF_OPT }, // 19 I8751 Mcu Code -}; - -STD_ROM_PICK(blktiger) -STD_ROM_FN(blktiger) - -struct BurnDriver BurnDrvBlktiger = { - "blktiger", NULL, NULL, NULL, "1987", - "Black Tiger\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, - NULL, blktigerRomInfo, blktigerRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Black Tiger (older) - -static struct BurnRomInfo blktigeraRomDesc[] = { - { "bdu-01.5e", 0x08000, 0x47b13922, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code - { "bdu-02.6e", 0x10000, 0x2e0daf1b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "bdu-03.8e", 0x10000, 0x3b67dfec, 1 | BRF_PRG | BRF_ESS }, // 2 - { "bd-04.9e", 0x10000, 0xed6af6ec, 1 | BRF_PRG | BRF_ESS }, // 3 - { "bd-05.10e", 0x10000, 0xae59b72e, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "bd-06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code - - { "bd-15.2n", 0x08000, 0x70175d78, 3 | BRF_GRA }, // 6 - Characters - - { "bd-12.5b", 0x10000, 0xc4524993, 4 | BRF_GRA }, // 7 - Background Tiles - { "bd-11.4b", 0x10000, 0x7932c86f, 4 | BRF_GRA }, // 8 - { "bd-14.9b", 0x10000, 0xdc49593a, 4 | BRF_GRA }, // 9 - { "bd-13.8b", 0x10000, 0x7ed7a122, 4 | BRF_GRA }, // 10 - - { "bd-08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites - { "bd-07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 - { "bd-10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 - { "bd-09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 - - { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) - { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 - { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 - { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 - - { "bd.6k", 0x01000, 0xac7d14f1, 7 | BRF_PRG | BRF_OPT }, // 19 I8751 Mcu Code -}; - -STD_ROM_PICK(blktigera) -STD_ROM_FN(blktigera) - -struct BurnDriver BurnDrvBlktigera = { - "blktigera", "blktiger", NULL, NULL, "1987", - "Black Tiger (older)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, - NULL, blktigeraRomInfo, blktigeraRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Black Tiger (bootleg) - -static struct BurnRomInfo blktigerb1RomDesc[] = { - { "btiger1.f6", 0x08000, 0x9d8464e8, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code - { "bdu-02a.6e", 0x10000, 0x7bef96e8, 1 | BRF_PRG | BRF_ESS }, // 1 - { "btiger3.j6", 0x10000, 0x52c56ed1, 1 | BRF_PRG | BRF_ESS }, // 2 - { "bd-04.9e", 0x10000, 0xed6af6ec, 1 | BRF_PRG | BRF_ESS }, // 3 - { "bd-05.10e", 0x10000, 0xae59b72e, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "bd-06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code - - { "bd-15.2n", 0x08000, 0x70175d78, 3 | BRF_GRA }, // 6 - Characters - - { "bd-12.5b", 0x10000, 0xc4524993, 4 | BRF_GRA }, // 7 - Background Tiles - { "bd-11.4b", 0x10000, 0x7932c86f, 4 | BRF_GRA }, // 8 - { "bd-14.9b", 0x10000, 0xdc49593a, 4 | BRF_GRA }, // 9 - { "bd-13.8b", 0x10000, 0x7ed7a122, 4 | BRF_GRA }, // 10 - - { "bd-08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites - { "bd-07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 - { "bd-10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 - { "bd-09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 - - { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) - { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 - { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 - { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 -}; - -STD_ROM_PICK(blktigerb1) -STD_ROM_FN(blktigerb1) - -struct BurnDriver BurnDrvBlktigerb1 = { - "blktigerb1", "blktiger", NULL, NULL, "1987", - "Black Tiger (bootleg set 1)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, - NULL, blktigerb1RomInfo, blktigerb1RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - - -// Black Tiger (bootleg set 2) - -static struct BurnRomInfo blktigerb2RomDesc[] = { - { "1.bin", 0x08000, 0x47E2B21E, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code - { "bdu-02a.6e", 0x10000, 0x7bef96e8, 1 | BRF_PRG | BRF_ESS }, // 1 - { "3.bin", 0x10000, 0x52c56ed1, 1 | BRF_PRG | BRF_ESS }, // 2 - { "bd-04.9e", 0x10000, 0xed6af6ec, 1 | BRF_PRG | BRF_ESS }, // 3 - { "bd-05.10e", 0x10000, 0xae59b72e, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "bd-06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code - - { "bd-15.2n", 0x08000, 0x70175d78, 3 | BRF_GRA }, // 6 - Characters - - { "bd-12.5b", 0x10000, 0xc4524993, 4 | BRF_GRA }, // 7 - Background Tiles - { "bd-11.4b", 0x10000, 0x7932c86f, 4 | BRF_GRA }, // 8 - { "bd-14.9b", 0x10000, 0xdc49593a, 4 | BRF_GRA }, // 9 - { "bd-13.8b", 0x10000, 0x7ed7a122, 4 | BRF_GRA }, // 10 - - { "bd-08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites - { "bd-07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 - { "bd-10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 - { "bd-09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 - - { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) - { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 - { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 - { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 -}; - -STD_ROM_PICK(blktigerb2) -STD_ROM_FN(blktigerb2) - -struct BurnDriver BurnDrvblktigerb2 = { - "blktigerb2", "blktiger", NULL, NULL, "1987", - "Black Tiger (bootleg set 2)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, - NULL, blktigerb2RomInfo, blktigerb2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Black Dragon (Japan) - -static struct BurnRomInfo blkdrgonRomDesc[] = { - { "bd_01.5e", 0x08000, 0x27ccdfbc, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code - { "bd_02.6e", 0x10000, 0x7d39c26f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "bd_03.8e", 0x10000, 0xd1bf3757, 1 | BRF_PRG | BRF_ESS }, // 2 - { "bd_04.9e", 0x10000, 0x4d1d6680, 1 | BRF_PRG | BRF_ESS }, // 3 - { "bd_05.10e", 0x10000, 0xc8d0c45e, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "bd_06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code - - { "bd_15.2n", 0x08000, 0x3821ab29, 3 | BRF_GRA }, // 6 - Characters - - { "bd_12.5b", 0x10000, 0x22d0a4b0, 4 | BRF_GRA }, // 7 - Background Tiles - { "bd_11.4b", 0x10000, 0xc8b5fc52, 4 | BRF_GRA }, // 8 - { "bd_14.9b", 0x10000, 0x9498c378, 4 | BRF_GRA }, // 9 - { "bd_13.8b", 0x10000, 0x5b0df8ce, 4 | BRF_GRA }, // 10 - - { "bd_08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites - { "bd_07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 - { "bd_10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 - { "bd_09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 - - { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) - { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 - { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 - { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 - - { "bd.6k", 0x01000, 0xac7d14f1, 7 | BRF_PRG | BRF_OPT }, // 19 I8751 Mcu Code -}; - -STD_ROM_PICK(blkdrgon) -STD_ROM_FN(blkdrgon) - -struct BurnDriver BurnDrvBlkdrgon = { - "blkdrgon", "blktiger", NULL, NULL, "1987", - "Black Dragon (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, - NULL, blkdrgonRomInfo, blkdrgonRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Black Dragon (bootleg) - -static struct BurnRomInfo blkdrgonbRomDesc[] = { - { "a1", 0x08000, 0x7caf2ba0, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code - { "blkdrgon.6e", 0x10000, 0x7d39c26f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "a3", 0x10000, 0xf4cd0f39, 1 | BRF_PRG | BRF_ESS }, // 2 - { "blkdrgon.9e", 0x10000, 0x4d1d6680, 1 | BRF_PRG | BRF_ESS }, // 3 - { "blkdrgon.10e", 0x10000, 0xc8d0c45e, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "bd-06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code - - { "b5", 0x08000, 0x852ad2b7, 3 | BRF_GRA }, // 6 - Characters - - { "blkdrgon.5b", 0x10000, 0x22d0a4b0, 4 | BRF_GRA }, // 7 - Background Tiles - { "b1", 0x10000, 0x053ab15c, 4 | BRF_GRA }, // 8 - { "blkdrgon.9b", 0x10000, 0x9498c378, 4 | BRF_GRA }, // 9 - { "b3", 0x10000, 0x9dc6e943, 4 | BRF_GRA }, // 10 - - { "bd-08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites - { "bd-07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 - { "bd-10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 - { "bd-09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 - - { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) - { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 - { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 - { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 -}; - -STD_ROM_PICK(blkdrgonb) -STD_ROM_FN(blkdrgonb) - -struct BurnDriver BurnDrvBlkdrgonb = { - "blkdrgonb", "blktiger", NULL, NULL, "1987", - "Black Dragon (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, - NULL, blkdrgonbRomInfo, blkdrgonbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; +// FB Alpha Black Tiger driver module +// Based on MAME driver by Paul Leaman + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2203.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf; +static UINT8 *DrvPalRAM; +static UINT8 *DrvBgRAM; +static UINT8 *DrvTxRAM; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *DrvScreenLayout; +static UINT8 *DrvBgEnable; +static UINT8 *DrvFgEnable; +static UINT8 *DrvSprEnable; +static UINT8 *DrvVidBank; +static UINT8 *DrvRomBank; + +static UINT8 *soundlatch; +static UINT8 *flipscreen; +static UINT8 *coin_lockout; +static INT32 watchdog; + +static UINT16 *DrvScrollx; +static UINT16 *DrvScrolly; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static INT32 nCyclesTotal[2]; + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + + {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Service", BIT_DIGITAL , DrvJoy1 + 5, "service" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0x01, 0x01, NULL }, + + {0x12, 0xfe, 0, 8, "Coin A" }, + {0x12, 0x01, 0x07, 0x00, "4 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "3 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x02, "2 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, + + {0x12, 0xfe, 0, 8, "Coin B" }, + {0x12, 0x01, 0x38, 0x00, "4 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x08, "3 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x10, "2 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, + + {0x12, 0xfe, 0, 2, "Flip Screen" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0x12, 0xfe, 0, 2, "Test" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0x13, 0xfe, 0, 4, "Lives" }, + {0x13, 0x01, 0x03, 0x02, "2" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0x13, 0xfe, 0, 8, "Difficulty" }, + {0x13, 0x01, 0x1c, 0x1c, "1 (Easiest)" }, + {0x13, 0x01, 0x1c, 0x18, "2" }, + {0x13, 0x01, 0x1c, 0x14, "3" }, + {0x13, 0x01, 0x1c, 0x10, "4" }, + {0x13, 0x01, 0x1c, 0x0c, "5 (Normal)" }, + {0x13, 0x01, 0x1c, 0x08, "6" }, + {0x13, 0x01, 0x1c, 0x04, "7" }, + {0x13, 0x01, 0x1c, 0x00, "8 (Hardest)" }, + + {0x13, 0xfe, 0, 2, "Demo Sounds" }, + {0x13, 0x01, 0x20, 0x00, "Off" }, + {0x13, 0x01, 0x20, 0x20, "On" }, + + {0x13, 0xfe, 0, 2, "Allow Continue" }, + {0x13, 0x01, 0x40, 0x00, "No" }, + {0x13, 0x01, 0x40, 0x40, "Yes" }, + + {0x13, 0xfe, 0, 2, "Cabinet" }, + {0x13, 0x01, 0x80, 0x00, "Upright" }, + {0x13, 0x01, 0x80, 0x80, "Cocktail" }, + + {0x14, 0xfe, 0, 2, "Coin Lockout Present?"}, + {0x14, 0x01, 0x01, 0x01, "Yes" }, + {0x14, 0x01, 0x01, 0x00, "No" }, +}; + +STDDIPINFO(Drv) + +static void palette_write(INT32 offset) +{ + UINT8 r,g,b; + UINT16 data = (DrvPalRAM[offset]) | (DrvPalRAM[offset | 0x400] << 8); + + r = (data >> 4) & 0x0f; + g = (data >> 0) & 0x0f; + b = (data >> 8) & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + DrvPalette[offset] = BurnHighCol(r, g, b, 0); +} + +static void DrvRomBankswitch(INT32 bank) +{ + *DrvRomBank = bank & 0x0f; + + INT32 nBank = 0x10000 + (bank & 0x0f) * 0x4000; + + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + nBank); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + nBank); +} + +static void DrvVidRamBankswitch(INT32 bank) +{ + *DrvVidBank = bank & 0x03; + + INT32 nBank = (bank & 3) * 0x1000; + + ZetMapArea(0xc000, 0xcfff, 0, DrvBgRAM + nBank); + ZetMapArea(0xc000, 0xcfff, 1, DrvBgRAM + nBank); + ZetMapArea(0xc000, 0xcfff, 2, DrvBgRAM + nBank); +} + +void __fastcall blacktiger_write(UINT16 address, UINT8 data) +{ + if ((address & 0xf800) == 0xd800) { + DrvPalRAM[address & 0x7ff] = data; + + palette_write(address & 0x3ff); + + return; + } + + return; +} + +UINT8 __fastcall blacktiger_read(UINT16 /*address*/) +{ + return 0; +} + +void __fastcall blacktiger_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + { + // INT64 cycles = ZetTotalCycles(); + // ZetClose(); + // ZetOpen(1); + + // INT32 nCycles = ((INT64)cycles * nCyclesTotal[1] / nCyclesTotal[0]); + // if (nCycles <= ZetTotalCycles()) return; + + // BurnTimerUpdate(nCycles); + // ZetClose(); + // ZetOpen(0); + + *soundlatch = data; + } + return; + + case 0x01: + DrvRomBankswitch(data); + return; + + case 0x03: + if (DrvDips[2] & 1) { + *coin_lockout = ~data << 6; + } + return; + + case 0x04: + if (data & 0x20) { + ZetClose(); + ZetOpen(1); + ZetReset(); + ZetClose(); + ZetOpen(0); + } + + *flipscreen = data & 0x40; + *DrvFgEnable = ~data & 0x80; + + return; + + case 0x06: + watchdog = 0; + return; + + case 0x08: + *DrvScrollx = (*DrvScrollx & 0xff00) | data; + return; + + case 0x09: + *DrvScrollx = (*DrvScrollx & 0x00ff) | (data << 8); + return; + + case 0x0a: + *DrvScrolly = (*DrvScrolly & 0xff00) | data; + return; + + case 0x0b: + *DrvScrolly = (*DrvScrolly & 0x00ff) | (data << 8); + return; + + case 0x0c: + *DrvSprEnable = ~data & 0x02; + *DrvBgEnable = ~data & 0x04; + return; + + case 0x0d: + DrvVidRamBankswitch(data); + return; + + case 0x0e: + *DrvScreenLayout = data ? 1 : 0; + return; + } +} + +UINT8 __fastcall blacktiger_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + case 0x02: + return DrvInputs[port & 3]; + + case 0x03: + case 0x04: + return DrvDips[~port & 1]; + + case 0x05: + return 0x01; + + case 0x07: + return ZetDe(-1) >> 8; + } + + return 0; +} + +void __fastcall blacktiger_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe000: + BurnYM2203Write(0, 0, data); + return; + + case 0xe001: + BurnYM2203Write(0, 1, data); + return; + + case 0xe002: + BurnYM2203Write(1, 0, data); + return; + + case 0xe003: + BurnYM2203Write(1, 1, data); + return; + } +} + +UINT8 __fastcall blacktiger_sound_read(UINT16 address) +{ + switch (address) + { + case 0xc800: + return *soundlatch; + + case 0xe000: + return BurnYM2203Read(0, 0); + + case 0xe001: + return BurnYM2203Read(0, 1); + + case 0xe002: + return BurnYM2203Read(1, 0); + + case 0xe003: + return BurnYM2203Read(1, 1); + } + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x050000; + DrvZ80ROM1 = Next; Next += 0x008000; + + DrvGfxROM0 = Next; Next += 0x020000; + DrvGfxROM1 = Next; Next += 0x080000; + DrvGfxROM2 = Next; Next += 0x080000; + + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x001e00; + DrvZ80RAM1 = Next; Next += 0x000800; + + DrvPalRAM = Next; Next += 0x000800; + DrvTxRAM = Next; Next += 0x000800; + DrvBgRAM = Next; Next += 0x004000; + DrvSprRAM = Next; Next += 0x001200; + DrvSprBuf = Next; Next += 0x001200; + + DrvScreenLayout = Next; Next += 0x000001; + DrvBgEnable = Next; Next += 0x000001; + DrvFgEnable = Next; Next += 0x000001; + DrvSprEnable = Next; Next += 0x000001; + + DrvVidBank = Next; Next += 0x000001; + DrvRomBank = Next; Next += 0x000001; + + DrvScrollx = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); + DrvScrolly = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); + + soundlatch = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + coin_lockout = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset(INT32 full_reset) +{ + if (full_reset) { + memset (AllRam, 0, RamEnd - AllRam); + } + + ZetOpen(0); + ZetReset(); + DrvRomBankswitch(1); + DrvVidRamBankswitch(1); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + + watchdog = 0; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { ((0x40000 * 8) / 2) + 4, ((0x40000 * 8) / 2) + 0, 4, 0 }; + INT32 XOffs[16] = { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3, + 16*16+0, 16*16+1, 16*16+2, 16*16+3, 16*16+8+0, 16*16+8+1, 16*16+8+2, 16*16+8+3 }; + INT32 YOffs[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, + 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x08000); + + GfxDecode(0x0800, 2, 8, 8, Plane + 2, XOffs, YOffs, 0x080, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x40000); + + GfxDecode(0x0800, 4, 16, 16, Plane + 0, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x40000); + + GfxDecode(0x0800, 4, 16, 16, Plane + 0, XOffs, YOffs, 0x200, tmp, DrvGfxROM2); + + BurnFree (tmp); + + return 0; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3579545; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3579545; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + for (INT32 i = 0; i < 5; i++) { + if (BurnLoadRom(DrvZ80ROM0 + i * 0x10000, 0 + i, 1)) return 1; + } + + if (BurnLoadRom(DrvZ80ROM1, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 6, 1)) return 1; + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x10000, 7 + i, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + i * 0x10000, 11 + i, 1)) return 1; + } + + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0xd000, 0xd7ff, 0, DrvTxRAM); + ZetMapArea(0xd000, 0xd7ff, 1, DrvTxRAM); + ZetMapArea(0xd000, 0xd7ff, 2, DrvTxRAM); + ZetMapArea(0xd800, 0xdfff, 0, DrvPalRAM); +// ZetMapArea(0xd800, 0xdfff, 1, DrvPalRAM); + ZetMapArea(0xd800, 0xdfff, 2, DrvPalRAM); + ZetMapArea(0xe000, 0xfdff, 0, DrvZ80RAM0); + ZetMapArea(0xe000, 0xfdff, 1, DrvZ80RAM0); + ZetMapArea(0xe000, 0xfdff, 2, DrvZ80RAM0); + ZetMapArea(0xfe00, 0xffff, 0, DrvSprRAM); + ZetMapArea(0xfe00, 0xffff, 1, DrvSprRAM); + ZetMapArea(0xfe00, 0xffff, 2, DrvSprRAM); + ZetSetWriteHandler(blacktiger_write); + ZetSetReadHandler(blacktiger_read); + ZetSetInHandler(blacktiger_in); + ZetSetOutHandler(blacktiger_out); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM1); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM1); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM1); + ZetSetWriteHandler(blacktiger_sound_write); + ZetSetReadHandler(blacktiger_sound_read); + ZetClose(); + + GenericTilesInit(); + + BurnYM2203Init(2, 3579545, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3579545); + BurnYM2203SetAllRoutes(0, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetAllRoutes(1, 0.15, BURN_SND_ROUTE_BOTH); + + DrvDoReset(1); + + return 0; +} + +static INT32 DrvExit() +{ + BurnYM2203Exit(); + ZetExit(); + GenericTilesExit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_bg(INT32 type, INT32 layer) +{ +// Priority masks should be enabled, but I don't see anywhere that they are used? +//#define USE_MASKS + +#ifdef USE_MASKS + UINT16 masks[2][4] = { { 0xffff, 0xfff0, 0xff00, 0xf000 }, { 0x8000, 0x800f, 0x80ff, 0x8fff } }; +#else + if (layer == 0) return; +#endif + + INT32 scrollx = (*DrvScrollx) & (0x3ff | (0x200 << type)); + INT32 scrolly = ((*DrvScrolly)+16) & (0x7ff >> type); + + for (INT32 offs = 0; offs < 0x2000; offs++) + { + INT32 sx, sy, ofst; + + if (type) { // 1 = 128x64, 0 = 64x128 + sx = (offs & 0x7f); + sy = (offs >> 7); + + ofst = (sx & 0x0f) + ((sy & 0x0f) << 4) + ((sx & 0x70) << 4) + ((sy & 0x30) << 7); + } else { + sx = (offs & 0x3f); + sy = (offs >> 6); + + ofst = (sx & 0x0f) + ((sy & 0x0f) << 4) + ((sx & 0x30) << 4) + ((sy & 0x70) << 7); + } + + sx = (sx * 16) - scrollx; + sy = (sy * 16) - scrolly; + + if (sx < -15) sx += (0x400 << type); + if (sy < -15) sy += (0x800 >> type); + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 attr = DrvBgRAM[(ofst << 1) | 1]; + INT32 color = (attr >> 3) & 0x0f; + INT32 code = DrvBgRAM[ofst << 1] | ((attr & 0x07) << 8); + INT32 flipx = attr & 0x80; + INT32 flipy = 0; + + if (*flipscreen) { + flipx ^= 0x80; + flipy = 1; + + sx = 240 - sx; + sy = 208 - sy; + } + +#ifdef USE_MASKS + INT32 colmask = masks[layer][(color < 2) ? 3 : 0]; + + { + UINT8 *gfx = DrvGfxROM1 + (code * 0x100); + color <<= 4; + + INT32 flip = (flipx ? 0x0f : 0) + (flipy ? 0xf0 : 0); + + for (INT32 y = 0; y < 16; y++, sy++, sx-=16) { + for (INT32 x = 0; x < 16; x++, sx++) { + if (sx < 0 || sx >= nScreenWidth || sy < 0 || sy >= nScreenHeight) continue; + + INT32 pxl = gfx[(y*16+x)^flip]; + + if (colmask & (1 << pxl)) continue; // right? + + pTransDraw[sy * nScreenWidth + sx] = pxl + color; + } + } + } +#else + if (*flipscreen) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM1); + } + } +#endif + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0x1200 - 4; offs >= 0; offs -= 4) + { + INT32 attr = DrvSprBuf[offs+1]; + INT32 sx = DrvSprBuf[offs + 3] - ((attr & 0x10) << 4); + INT32 sy = DrvSprBuf[offs + 2]; + INT32 code = DrvSprBuf[offs] | ((attr & 0xe0) << 3); + INT32 color = attr & 0x07; + INT32 flipx = attr & 0x08; + + if (*flipscreen) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + } + + sy -= 16; + + if (sy < -15 || sy > 239 || sx < -15 || sx > 255) continue; + + if (*flipscreen) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0x200, DrvGfxROM2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0x200, DrvGfxROM2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0x200, DrvGfxROM2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0x200, DrvGfxROM2); + } + } + } +} + +static void draw_text_layer() +{ + for (INT32 offs = 0x40; offs < 0x3c0; offs++) + { + INT32 attr = DrvTxRAM[offs | 0x400]; + INT32 code = DrvTxRAM[offs] | ((attr & 0xe0) << 3); + + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + if (*flipscreen) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, 248 - sx, 216 - (sy - 16), (attr & 0x1f)/*color*/, 2, 3, 0x300, DrvGfxROM0); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy - 16, (attr & 0x1f)/*color*/, 2, 3, 0x300, DrvGfxROM0); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + palette_write(i); + } + } + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x3ff; + } + + if (*DrvBgEnable) { + if (nSpriteEnable & 1) draw_bg(*DrvScreenLayout, 1); + } + + if (*DrvSprEnable) { + if (nSpriteEnable & 2) draw_sprites(); + } + + if (*DrvBgEnable) { + if (nSpriteEnable & 4) draw_bg(*DrvScreenLayout, 0); + } + + if (*DrvFgEnable) { + if (nSpriteEnable & 8) draw_text_layer(); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(1); + } + + if (watchdog >= 180) { + DrvDoReset(0); + } + watchdog++; + + { + DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + DrvInputs[0] |= *coin_lockout; + } + + ZetNewFrame(); + + INT32 nInterleave = 100; + nCyclesTotal[0] = 6000000 / 60; + nCyclesTotal[1] = 3579545 / 60; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 98) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == 99) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + // Run Z80 #2 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + ZetClose(); + } + + ZetOpen(1); + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + memcpy (DrvSprBuf, DrvSprRAM, 0x1200); + + return 0; +} + + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029698; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + } + + ZetOpen(0); + DrvRomBankswitch(*DrvRomBank); + DrvVidRamBankswitch(*DrvVidBank); + ZetClose(); + + return 0; +} + + +// Black Tiger + +static struct BurnRomInfo blktigerRomDesc[] = { + { "bdu-01a.5e", 0x08000, 0xa8f98f22, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code + { "bdu-02a.6e", 0x10000, 0x7bef96e8, 1 | BRF_PRG | BRF_ESS }, // 1 + { "bdu-03a.8e", 0x10000, 0x4089e157, 1 | BRF_PRG | BRF_ESS }, // 2 + { "bd-04.9e", 0x10000, 0xed6af6ec, 1 | BRF_PRG | BRF_ESS }, // 3 + { "bd-05.10e", 0x10000, 0xae59b72e, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "bd-06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code + + { "bd-15.2n", 0x08000, 0x70175d78, 3 | BRF_GRA }, // 6 - Characters + + { "bd-12.5b", 0x10000, 0xc4524993, 4 | BRF_GRA }, // 7 - Background Tiles + { "bd-11.4b", 0x10000, 0x7932c86f, 4 | BRF_GRA }, // 8 + { "bd-14.9b", 0x10000, 0xdc49593a, 4 | BRF_GRA }, // 9 + { "bd-13.8b", 0x10000, 0x7ed7a122, 4 | BRF_GRA }, // 10 + + { "bd-08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites + { "bd-07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 + { "bd-10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 + { "bd-09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 + + { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) + { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 + { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 + { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 + + { "bd.6k", 0x01000, 0xac7d14f1, 7 | BRF_PRG | BRF_OPT }, // 19 I8751 Mcu Code +}; + +STD_ROM_PICK(blktiger) +STD_ROM_FN(blktiger) + +struct BurnDriver BurnDrvBlktiger = { + "blktiger", NULL, NULL, NULL, "1987", + "Black Tiger\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, + NULL, blktigerRomInfo, blktigerRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Black Tiger (older) + +static struct BurnRomInfo blktigeraRomDesc[] = { + { "bdu-01.5e", 0x08000, 0x47b13922, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code + { "bdu-02.6e", 0x10000, 0x2e0daf1b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "bdu-03.8e", 0x10000, 0x3b67dfec, 1 | BRF_PRG | BRF_ESS }, // 2 + { "bd-04.9e", 0x10000, 0xed6af6ec, 1 | BRF_PRG | BRF_ESS }, // 3 + { "bd-05.10e", 0x10000, 0xae59b72e, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "bd-06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code + + { "bd-15.2n", 0x08000, 0x70175d78, 3 | BRF_GRA }, // 6 - Characters + + { "bd-12.5b", 0x10000, 0xc4524993, 4 | BRF_GRA }, // 7 - Background Tiles + { "bd-11.4b", 0x10000, 0x7932c86f, 4 | BRF_GRA }, // 8 + { "bd-14.9b", 0x10000, 0xdc49593a, 4 | BRF_GRA }, // 9 + { "bd-13.8b", 0x10000, 0x7ed7a122, 4 | BRF_GRA }, // 10 + + { "bd-08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites + { "bd-07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 + { "bd-10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 + { "bd-09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 + + { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) + { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 + { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 + { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 + + { "bd.6k", 0x01000, 0xac7d14f1, 7 | BRF_PRG | BRF_OPT }, // 19 I8751 Mcu Code +}; + +STD_ROM_PICK(blktigera) +STD_ROM_FN(blktigera) + +struct BurnDriver BurnDrvBlktigera = { + "blktigera", "blktiger", NULL, NULL, "1987", + "Black Tiger (older)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, + NULL, blktigeraRomInfo, blktigeraRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Black Tiger (bootleg) + +static struct BurnRomInfo blktigerb1RomDesc[] = { + { "btiger1.f6", 0x08000, 0x9d8464e8, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code + { "bdu-02a.6e", 0x10000, 0x7bef96e8, 1 | BRF_PRG | BRF_ESS }, // 1 + { "btiger3.j6", 0x10000, 0x52c56ed1, 1 | BRF_PRG | BRF_ESS }, // 2 + { "bd-04.9e", 0x10000, 0xed6af6ec, 1 | BRF_PRG | BRF_ESS }, // 3 + { "bd-05.10e", 0x10000, 0xae59b72e, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "bd-06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code + + { "bd-15.2n", 0x08000, 0x70175d78, 3 | BRF_GRA }, // 6 - Characters + + { "bd-12.5b", 0x10000, 0xc4524993, 4 | BRF_GRA }, // 7 - Background Tiles + { "bd-11.4b", 0x10000, 0x7932c86f, 4 | BRF_GRA }, // 8 + { "bd-14.9b", 0x10000, 0xdc49593a, 4 | BRF_GRA }, // 9 + { "bd-13.8b", 0x10000, 0x7ed7a122, 4 | BRF_GRA }, // 10 + + { "bd-08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites + { "bd-07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 + { "bd-10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 + { "bd-09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 + + { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) + { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 + { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 + { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 +}; + +STD_ROM_PICK(blktigerb1) +STD_ROM_FN(blktigerb1) + +struct BurnDriver BurnDrvBlktigerb1 = { + "blktigerb1", "blktiger", NULL, NULL, "1987", + "Black Tiger (bootleg set 1)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, + NULL, blktigerb1RomInfo, blktigerb1RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + + +// Black Tiger (bootleg set 2) + +static struct BurnRomInfo blktigerb2RomDesc[] = { + { "1.bin", 0x08000, 0x47E2B21E, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code + { "bdu-02a.6e", 0x10000, 0x7bef96e8, 1 | BRF_PRG | BRF_ESS }, // 1 + { "3.bin", 0x10000, 0x52c56ed1, 1 | BRF_PRG | BRF_ESS }, // 2 + { "bd-04.9e", 0x10000, 0xed6af6ec, 1 | BRF_PRG | BRF_ESS }, // 3 + { "bd-05.10e", 0x10000, 0xae59b72e, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "bd-06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code + + { "bd-15.2n", 0x08000, 0x70175d78, 3 | BRF_GRA }, // 6 - Characters + + { "bd-12.5b", 0x10000, 0xc4524993, 4 | BRF_GRA }, // 7 - Background Tiles + { "bd-11.4b", 0x10000, 0x7932c86f, 4 | BRF_GRA }, // 8 + { "bd-14.9b", 0x10000, 0xdc49593a, 4 | BRF_GRA }, // 9 + { "bd-13.8b", 0x10000, 0x7ed7a122, 4 | BRF_GRA }, // 10 + + { "bd-08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites + { "bd-07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 + { "bd-10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 + { "bd-09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 + + { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) + { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 + { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 + { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 +}; + +STD_ROM_PICK(blktigerb2) +STD_ROM_FN(blktigerb2) + +struct BurnDriver BurnDrvblktigerb2 = { + "blktigerb2", "blktiger", NULL, NULL, "1987", + "Black Tiger (bootleg set 2)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, + NULL, blktigerb2RomInfo, blktigerb2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Black Dragon (Japan) + +static struct BurnRomInfo blkdrgonRomDesc[] = { + { "bd_01.5e", 0x08000, 0x27ccdfbc, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code + { "bd_02.6e", 0x10000, 0x7d39c26f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "bd_03.8e", 0x10000, 0xd1bf3757, 1 | BRF_PRG | BRF_ESS }, // 2 + { "bd_04.9e", 0x10000, 0x4d1d6680, 1 | BRF_PRG | BRF_ESS }, // 3 + { "bd_05.10e", 0x10000, 0xc8d0c45e, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "bd_06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code + + { "bd_15.2n", 0x08000, 0x3821ab29, 3 | BRF_GRA }, // 6 - Characters + + { "bd_12.5b", 0x10000, 0x22d0a4b0, 4 | BRF_GRA }, // 7 - Background Tiles + { "bd_11.4b", 0x10000, 0xc8b5fc52, 4 | BRF_GRA }, // 8 + { "bd_14.9b", 0x10000, 0x9498c378, 4 | BRF_GRA }, // 9 + { "bd_13.8b", 0x10000, 0x5b0df8ce, 4 | BRF_GRA }, // 10 + + { "bd_08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites + { "bd_07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 + { "bd_10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 + { "bd_09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 + + { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) + { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 + { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 + { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 + + { "bd.6k", 0x01000, 0xac7d14f1, 7 | BRF_PRG | BRF_OPT }, // 19 I8751 Mcu Code +}; + +STD_ROM_PICK(blkdrgon) +STD_ROM_FN(blkdrgon) + +struct BurnDriver BurnDrvBlkdrgon = { + "blkdrgon", "blktiger", NULL, NULL, "1987", + "Black Dragon (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, + NULL, blkdrgonRomInfo, blkdrgonRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Black Dragon (bootleg) + +static struct BurnRomInfo blkdrgonbRomDesc[] = { + { "a1", 0x08000, 0x7caf2ba0, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 #0 Code + { "blkdrgon.6e", 0x10000, 0x7d39c26f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "a3", 0x10000, 0xf4cd0f39, 1 | BRF_PRG | BRF_ESS }, // 2 + { "blkdrgon.9e", 0x10000, 0x4d1d6680, 1 | BRF_PRG | BRF_ESS }, // 3 + { "blkdrgon.10e", 0x10000, 0xc8d0c45e, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "bd-06.1l", 0x08000, 0x2cf54274, 2 | BRF_PRG | BRF_ESS }, // 5 - Z80 #0 Code + + { "b5", 0x08000, 0x852ad2b7, 3 | BRF_GRA }, // 6 - Characters + + { "blkdrgon.5b", 0x10000, 0x22d0a4b0, 4 | BRF_GRA }, // 7 - Background Tiles + { "b1", 0x10000, 0x053ab15c, 4 | BRF_GRA }, // 8 + { "blkdrgon.9b", 0x10000, 0x9498c378, 4 | BRF_GRA }, // 9 + { "b3", 0x10000, 0x9dc6e943, 4 | BRF_GRA }, // 10 + + { "bd-08.5a", 0x10000, 0xe2f17438, 5 | BRF_GRA }, // 11 - Sprites + { "bd-07.4a", 0x10000, 0x5fccbd27, 5 | BRF_GRA }, // 12 + { "bd-10.9a", 0x10000, 0xfc33ccc6, 5 | BRF_GRA }, // 13 + { "bd-09.8a", 0x10000, 0xf449de01, 5 | BRF_GRA }, // 14 + + { "bd01.8j", 0x00100, 0x29b459e5, 6 | BRF_OPT }, // 15 - Proms (not used) + { "bd02.9j", 0x00100, 0x8b741e66, 6 | BRF_OPT }, // 16 + { "bd03.11k", 0x00100, 0x27201c75, 6 | BRF_OPT }, // 17 + { "bd04.11l", 0x00100, 0xe5490b68, 6 | BRF_OPT }, // 18 +}; + +STD_ROM_PICK(blkdrgonb) +STD_ROM_FN(blkdrgonb) + +struct BurnDriver BurnDrvBlkdrgonb = { + "blkdrgonb", "blktiger", NULL, NULL, "1987", + "Black Dragon (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, + NULL, blkdrgonbRomInfo, blkdrgonbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_blockout.cpp b/src/burn/drv/pre90s/d_blockout.cpp index 6421c065a..5066f4a04 100644 --- a/src/burn/drv/pre90s/d_blockout.cpp +++ b/src/burn/drv/pre90s/d_blockout.cpp @@ -1,750 +1,749 @@ -// FB Alpha Block Out driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM0; -static UINT8 *Drv68KRAM1; -static UINT8 *Drv68KRAM2; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvVidRAM0; -static UINT8 *DrvVidRAM1; -static UINT16*DrvTmpBmp; -static UINT32 *DrvPalette; - -static UINT8 *soundlatch; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvJoy5[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; -static UINT8 DrvInputs[5]; - -static struct BurnInputInfo BlockoutInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy3 + 1, "p1 coin" }, - {"Coin 2", BIT_DIGITAL, DrvJoy3 + 2, "p2 coin" }, - {"Coin 3", BIT_DIGITAL, DrvJoy3 + 3, "p3 coin" }, - - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy5 + 6, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 4"}, - - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy5 + 7, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 4"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Blockout) - -static struct BurnInputInfo BlckoutjInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy3 + 1, "p1 coin" }, - {"Coin 2", BIT_DIGITAL, DrvJoy3 + 2, "p2 coin" }, - {"Coin 3", BIT_DIGITAL, DrvJoy3 + 3, "p3 coin" }, - - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - {"P1 Button 4", BIT_DIGITAL, DrvJoy5 + 6, "p1 fire 4"}, - - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - {"P2 Button 4", BIT_DIGITAL, DrvJoy5 + 7, "p2 fire 4"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Blckoutj) - -static struct BurnDIPInfo BlockoutDIPList[]= -{ - // Default Values - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0x3f, NULL }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x16, 0x01, 0x03, 0x00, "3 Coins 1 Credits " }, - {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits " }, - {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits " }, - {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits " }, - - {0 , 0xfe, 0 , 2, "1 Coin to Continue" }, - {0x16, 0x01, 0x10, 0x10, "Off" }, - {0x16, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x20, 0x00, "Off" }, - {0x16, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x17, 0x01, 0x03, 0x02, "Easy" }, - {0x17, 0x01, 0x03, 0x03, "Normal" }, - {0x17, 0x01, 0x03, 0x01, "Hard" }, - {0x17, 0x01, 0x03, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Rotate Buttons" }, - {0x17, 0x01, 0x04, 0x00, "2" }, - {0x17, 0x01, 0x04, 0x04, "3" }, -}; - -STDDIPINFO(Blockout) - -static struct BurnDIPInfo AgressDIPList[]= -{ - // Default Values - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0x3f, NULL }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x16, 0x01, 0x03, 0x00, "3 Coins 1 Credits " }, - {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits " }, - {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits " }, - {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits " }, - - {0 , 0xfe, 0 , 2, "Opening Cut" }, - {0x16, 0x01, 0x04, 0x00, "Off" }, - {0x16, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x20, 0x00, "Off" }, - {0x16, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x17, 0x01, 0x03, 0x02, "Easy" }, - {0x17, 0x01, 0x03, 0x03, "Normal" }, - {0x17, 0x01, 0x03, 0x01, "Hard" }, - {0x17, 0x01, 0x03, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Players" }, - {0x17, 0x01, 0x04, 0x04, "1" }, - {0x17, 0x01, 0x04, 0x00, "2" }, -}; - -STDDIPINFO(Agress) - -static void palette_write(INT32 offset) -{ - UINT16 rgb = *((UINT16*)(DrvPalRAM + offset)); - - INT32 bit0,bit1,bit2,bit3; - INT32 r,g,b; - - bit0 = (rgb >> 0) & 0x01; - bit1 = (rgb >> 1) & 0x01; - bit2 = (rgb >> 2) & 0x01; - bit3 = (rgb >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (rgb >> 4) & 0x01; - bit1 = (rgb >> 5) & 0x01; - bit2 = (rgb >> 6) & 0x01; - bit3 = (rgb >> 7) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (rgb >> 8) & 0x01; - bit1 = (rgb >> 9) & 0x01; - bit2 = (rgb >> 10) & 0x01; - bit3 = (rgb >> 11) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); -} - -static void update_pixels(INT32 offset) -{ - INT32 x = (offset & 0xff); - INT32 y = (offset >> 8) & 0xff; - if (x >= 320 || y < 8 || y > 247) return; - - UINT16 *src = (UINT16*)DrvVidRAM0 + ((y << 8) | x); - UINT16 *dst = DrvTmpBmp + (y-8) * 320 + x * 2; - - INT32 front = src[0x00000]; - INT32 back = src[0x10000]; - - if (front >> 8) dst[0] = front >> 8; - else dst[0] = (back >> 8) | 0x100; - - if (front & 0xff) dst[1] = front & 0xff; - else dst[1] = (back & 0xff) | 0x100; -} - -void __fastcall blockout_write_byte(UINT32 address, UINT8 data) -{ - if (address >= 0x180000 && address <= 0x1bffff) { - address = (address & 0x3ffff) ^ 1; - DrvVidRAM0[address] = data; - update_pixels(address>>1); - return; - } - - switch (address ^ 1) - { - case 0x100014: - *soundlatch = data & 0xff; - ZetNmi(); - return; - } - - return; -} - -void __fastcall blockout_write_word(UINT32 address, UINT16 data) -{ - if (address >= 0x280200 && address <= 0x2805ff) { - *((UINT16*)(DrvPalRAM + (address - 0x280200))) = data; - palette_write(address & 0x3fe); - return; - } - - if (address >= 0x180000 && address <= 0x1bffff) { - address &= 0x3fffe; - *((UINT16*)(DrvVidRAM0 + address)) = data; - update_pixels(address>>1); - return; - } - - switch (address) - { - case 0x100014: - *soundlatch = data & 0xff; - ZetNmi(); - return; - - case 0x280002: // front color - *((UINT16*)(DrvPalRAM + 0x400)) = data; - palette_write(0x400); - return; - } - - return; -} - -UINT8 __fastcall blockout_read_byte(UINT32 address) -{ - switch (address^1) - { - case 0x100000: - return DrvInputs[0]; - - case 0x100002: - return DrvInputs[1]; - - case 0x100004: - return DrvInputs[2] & 0x0e; - - case 0x100006: - return DrvDips[0]; - - case 0x100008: - return ((DrvDips[1] & 0x3f) | (DrvInputs[4] & 0xc0)); - } - - return 0; -} - -UINT16 __fastcall blockout_read_word(UINT32 address) -{ - switch (address) - { - case 0x100000: - return DrvInputs[0]; - - case 0x100002: - return DrvInputs[1]; - - case 0x100004: - return DrvInputs[2] & 0x0e; - - case 0x100006: - return DrvDips[0]; - - case 0x100008: - return ((DrvDips[1] & 0x3f) | (DrvInputs[4] & 0xc0)); - } - - return 0; -} - -void __fastcall blockout_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8800: - BurnYM2151SelectRegister(data); - return; - - case 0x8801: - BurnYM2151WriteRegister(data); - return; - - case 0x9800: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall blockout_sound_read(UINT16 address) -{ - switch (address) - { - case 0x8801: - return BurnYM2151ReadStatus(); - - case 0x9800: - return MSM6295ReadStatus(0); - - case 0xa000: - return *soundlatch; - } - - return 0; -} - -void BlockoutYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM2151Reset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x008000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x0201 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM0 = Next; Next += 0x00c000; - Drv68KRAM1 = Next; Next += 0x00c000; - Drv68KRAM2 = Next; Next += 0x018000; - DrvVidRAM0 = Next; Next += 0x040000; - DrvVidRAM1 = Next; Next += 0x008000; - DrvPalRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - DrvTmpBmp = (UINT16*)Next; Next += (320 * 240) * sizeof(UINT16); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - BurnSetRefreshRate(58.0); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 3, 1)) return 1; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvVidRAM0, 0x180000, 0x1bffff, SM_ROM); - SekMapMemory(Drv68KRAM0, 0x1d4000, 0x1dffff, SM_RAM); - SekMapMemory(Drv68KRAM1, 0x1f4000, 0x1fffff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x200000, 0x207fff, SM_RAM); - SekMapMemory(Drv68KRAM2, 0x208000, 0x21ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x280200, 0x2805ff, SM_ROM); // maps 280000 - 2707ff - SekSetWriteByteHandler(0, blockout_write_byte); - SekSetWriteWordHandler(0, blockout_write_word); - SekSetReadByteHandler(0, blockout_read_byte); - SekSetReadWordHandler(0, blockout_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(blockout_sound_write); - ZetSetReadHandler(blockout_sound_read); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 1056000 / 132, 1); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&BlockoutYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.60, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.60, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - MSM6295Exit(0); - BurnYM2151Exit(); - - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x402; i+=2) { - palette_write(i); - } - } - - memcpy (pTransDraw, DrvTmpBmp, 320 * 240 * sizeof(UINT16)); - - { - UINT16 *vram = (UINT16*)DrvVidRAM1; - - for (INT32 y = 0; y < 240;y++) - { - for (INT32 x = 0; x < 320; x+=8) - { - INT32 d = vram[((y + 8) << 6) + (x >> 3)]; - - if (d) { - for (INT32 v = 0x80, c = 0; v > 0; v >>= 1, c++) - if (d & v) pTransDraw[(y * 320) + x + c] = 512; - } - } - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 5); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - } - } - - INT32 nSegment; - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - INT32 nTotalCycles[2] = { 10000000 / 58, 3579545 / 58 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - - nSegment = nTotalCycles[0] / nInterleave; - - SekRun(nSegment); - - nSegment = nTotalCycles[1] / nInterleave; - - ZetRun(nSegment); - nSegment = nBurnSoundLen / nInterleave; - - if (pBurnSoundOut) { - INT16 *pSoundBuf = pBurnSoundOut + nSoundBufferPos * 2; - BurnYM2151Render(pSoundBuf, nSegment); - MSM6295Render(0, pSoundBuf, nSegment); - nSoundBufferPos += nSegment; - } - - if (i == (nInterleave / 2)-1) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - } - - if (pBurnSoundOut) { - INT16 *pSoundBuf = pBurnSoundOut + nSoundBufferPos * 2; - nSegment = nBurnSoundLen - nSoundBufferPos; - if (nSegment) { - BurnYM2151Render(pSoundBuf, nSegment); - MSM6295Render(0, pSoundBuf, nSegment); - } - } - - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029698; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - } - - return 0; -} - - -// Block Out (set 1) - -static struct BurnRomInfo blockoutRomDesc[] = { - { "bo29a0-2.bin", 0x20000, 0xb0103427, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "bo29a1-2.bin", 0x20000, 0x5984d5a2, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bo29e3-0.bin", 0x08000, 0x3ea01f78, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "bo29e2-0.bin", 0x20000, 0x15c5a99d, 3 | BRF_SND }, // 3 Samples - - { "mb7114h.25", 0x00100, 0xb25bbda7, 0 | BRF_OPT }, // 4 Unused Prom -}; - -STD_ROM_PICK(blockout) -STD_ROM_FN(blockout) - -struct BurnDriver BurnDrvBlockout = { - "blockout", NULL, NULL, NULL, "1989", - "Block Out (set 1)\0", NULL, "Technos + California Dreams", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_PUZZLE, 0, - NULL, blockoutRomInfo, blockoutRomName, NULL, NULL, BlockoutInputInfo, BlockoutDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x201, - 320, 240, 4, 3 -}; - - -// Block Out (set 2) - -static struct BurnRomInfo blckout2RomDesc[] = { - { "29a0", 0x20000, 0x605f931e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "29a1", 0x20000, 0x38f07000, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bo29e3-0.bin", 0x08000, 0x3ea01f78, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "bo29e2-0.bin", 0x20000, 0x15c5a99d, 3 | BRF_SND }, // 3 Samples - - { "mb7114h.25", 0x00100, 0xb25bbda7, 0 | BRF_OPT }, // 4 Unused Prom -}; - -STD_ROM_PICK(blckout2) -STD_ROM_FN(blckout2) - -struct BurnDriver BurnDrvBlckout2 = { - "blockout2", "blockout", NULL, NULL, "1989", - "Block Out (set 2)\0", NULL, "Technos + California Dreams", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_PUZZLE, 0, - NULL, blckout2RomInfo, blckout2RomName, NULL, NULL, BlockoutInputInfo, BlockoutDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x201, - 320, 240, 4, 3 -}; - - -// Block Out (Japan) - -static struct BurnRomInfo blckoutjRomDesc[] = { - { "2.bin", 0x20000, 0xe16cf065, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "1.bin", 0x20000, 0x950b28a3, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bo29e3-0.bin", 0x08000, 0x3ea01f78, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "bo29e2-0.bin", 0x20000, 0x15c5a99d, 3 | BRF_SND }, // 3 Samples - - { "mb7114h.25", 0x00100, 0xb25bbda7, 0 | BRF_OPT }, // 4 Unused Prom -}; - -STD_ROM_PICK(blckoutj) -STD_ROM_FN(blckoutj) - -struct BurnDriver BurnDrvBlckoutj = { - "blockoutj", "blockout", NULL, NULL, "1989", - "Block Out (Japan)\0", NULL, "Technos + California Dreams", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_PUZZLE, 0, - NULL, blckoutjRomInfo, blckoutjRomName, NULL, NULL, BlckoutjInputInfo, BlockoutDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x201, - 320, 240, 4, 3 -}; - - -// Agress - -static struct BurnRomInfo agressRomDesc[] = { - { "palco1.81", 0x20000, 0x3acc917a, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "palco2.91", 0x20000, 0xabfd5bcc, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "palco3.73", 0x08000, 0x2a21c97d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "palco4.78", 0x20000, 0x9dfd9cfe, 3 | BRF_SND }, // 3 Samples - - { "82s129pr.25", 0x00100, 0xb25bbda7, 0 | BRF_OPT }, // 4 Unused Prom -}; - -STD_ROM_PICK(agress) -STD_ROM_FN(agress) - -struct BurnDriver BurnDrvAgress = { - "agress", NULL, NULL, NULL, "1991", - "Agress\0", NULL, "Palco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_PUZZLE, 0, - NULL, agressRomInfo, agressRomName, NULL, NULL, BlockoutInputInfo, AgressDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x201, - 320, 240, 4, 3 -}; - - -// Agress (English bootleg) - -static struct BurnRomInfo agressbRomDesc[] = { - { "palco1.ic81", 0x20000, 0xa1875175, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "palco2.ic91", 0x20000, 0xab3182c3, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "palco3.ic73", 0x08000, 0x2a21c97d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "palco4.ic78", 0x20000, 0x9dfd9cfe, 3 | BRF_SND }, // 3 Samples - - { "prom29-mb7114h.ic25", 0x00100, 0xb25bbda7, 0 | BRF_OPT }, // 4 Unused Prom -}; - -STD_ROM_PICK(agressb) -STD_ROM_FN(agressb) - -struct BurnDriver BurnDrvAgressb = { - "agressb", "agress", NULL, NULL, "2003", - "Agress (English bootleg)\0", NULL, "Palco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_PUZZLE, 0, - NULL, agressbRomInfo, agressbRomName, NULL, NULL, BlockoutInputInfo, AgressDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x201, - 320, 240, 4, 3 -}; +// FB Alpha Block Out driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM0; +static UINT8 *Drv68KRAM1; +static UINT8 *Drv68KRAM2; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvVidRAM0; +static UINT8 *DrvVidRAM1; +static UINT16*DrvTmpBmp; +static UINT32 *DrvPalette; + +static UINT8 *soundlatch; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvJoy5[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; +static UINT8 DrvInputs[5]; + +static struct BurnInputInfo BlockoutInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy3 + 1, "p1 coin" }, + {"Coin 2", BIT_DIGITAL, DrvJoy3 + 2, "p2 coin" }, + {"Coin 3", BIT_DIGITAL, DrvJoy3 + 3, "p3 coin" }, + + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy5 + 6, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 4"}, + + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy5 + 7, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 4"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Blockout) + +static struct BurnInputInfo BlckoutjInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy3 + 1, "p1 coin" }, + {"Coin 2", BIT_DIGITAL, DrvJoy3 + 2, "p2 coin" }, + {"Coin 3", BIT_DIGITAL, DrvJoy3 + 3, "p3 coin" }, + + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + {"P1 Button 4", BIT_DIGITAL, DrvJoy5 + 6, "p1 fire 4"}, + + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + {"P2 Button 4", BIT_DIGITAL, DrvJoy5 + 7, "p2 fire 4"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Blckoutj) + +static struct BurnDIPInfo BlockoutDIPList[]= +{ + // Default Values + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0x3f, NULL }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x16, 0x01, 0x03, 0x00, "3 Coins 1 Credits " }, + {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits " }, + {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits " }, + {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits " }, + + {0 , 0xfe, 0 , 2, "1 Coin to Continue" }, + {0x16, 0x01, 0x10, 0x10, "Off" }, + {0x16, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x20, 0x00, "Off" }, + {0x16, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x17, 0x01, 0x03, 0x02, "Easy" }, + {0x17, 0x01, 0x03, 0x03, "Normal" }, + {0x17, 0x01, 0x03, 0x01, "Hard" }, + {0x17, 0x01, 0x03, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Rotate Buttons" }, + {0x17, 0x01, 0x04, 0x00, "2" }, + {0x17, 0x01, 0x04, 0x04, "3" }, +}; + +STDDIPINFO(Blockout) + +static struct BurnDIPInfo AgressDIPList[]= +{ + // Default Values + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0x3f, NULL }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x16, 0x01, 0x03, 0x00, "3 Coins 1 Credits " }, + {0x16, 0x01, 0x03, 0x01, "2 Coins 1 Credits " }, + {0x16, 0x01, 0x03, 0x03, "1 Coin 1 Credits " }, + {0x16, 0x01, 0x03, 0x02, "1 Coin 2 Credits " }, + + {0 , 0xfe, 0 , 2, "Opening Cut" }, + {0x16, 0x01, 0x04, 0x00, "Off" }, + {0x16, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x20, 0x00, "Off" }, + {0x16, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x17, 0x01, 0x03, 0x02, "Easy" }, + {0x17, 0x01, 0x03, 0x03, "Normal" }, + {0x17, 0x01, 0x03, 0x01, "Hard" }, + {0x17, 0x01, 0x03, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Players" }, + {0x17, 0x01, 0x04, 0x04, "1" }, + {0x17, 0x01, 0x04, 0x00, "2" }, +}; + +STDDIPINFO(Agress) + +static void palette_write(INT32 offset) +{ + UINT16 rgb = *((UINT16*)(DrvPalRAM + offset)); + + INT32 bit0,bit1,bit2,bit3; + INT32 r,g,b; + + bit0 = (rgb >> 0) & 0x01; + bit1 = (rgb >> 1) & 0x01; + bit2 = (rgb >> 2) & 0x01; + bit3 = (rgb >> 3) & 0x01; + r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (rgb >> 4) & 0x01; + bit1 = (rgb >> 5) & 0x01; + bit2 = (rgb >> 6) & 0x01; + bit3 = (rgb >> 7) & 0x01; + g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (rgb >> 8) & 0x01; + bit1 = (rgb >> 9) & 0x01; + bit2 = (rgb >> 10) & 0x01; + bit3 = (rgb >> 11) & 0x01; + b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); +} + +static void update_pixels(INT32 offset) +{ + INT32 x = (offset & 0xff); + INT32 y = (offset >> 8) & 0xff; + if (x >= 320 || y < 8 || y > 247) return; + + UINT16 *src = (UINT16*)DrvVidRAM0 + ((y << 8) | x); + UINT16 *dst = DrvTmpBmp + (y-8) * 320 + x * 2; + + INT32 front = src[0x00000]; + INT32 back = src[0x10000]; + + if (front >> 8) dst[0] = front >> 8; + else dst[0] = (back >> 8) | 0x100; + + if (front & 0xff) dst[1] = front & 0xff; + else dst[1] = (back & 0xff) | 0x100; +} + +void __fastcall blockout_write_byte(UINT32 address, UINT8 data) +{ + if (address >= 0x180000 && address <= 0x1bffff) { + address = (address & 0x3ffff) ^ 1; + DrvVidRAM0[address] = data; + update_pixels(address>>1); + return; + } + + switch (address ^ 1) + { + case 0x100014: + *soundlatch = data & 0xff; + ZetNmi(); + return; + } + + return; +} + +void __fastcall blockout_write_word(UINT32 address, UINT16 data) +{ + if (address >= 0x280200 && address <= 0x2805ff) { + *((UINT16*)(DrvPalRAM + (address - 0x280200))) = data; + palette_write(address & 0x3fe); + return; + } + + if (address >= 0x180000 && address <= 0x1bffff) { + address &= 0x3fffe; + *((UINT16*)(DrvVidRAM0 + address)) = data; + update_pixels(address>>1); + return; + } + + switch (address) + { + case 0x100014: + *soundlatch = data & 0xff; + ZetNmi(); + return; + + case 0x280002: // front color + *((UINT16*)(DrvPalRAM + 0x400)) = data; + palette_write(0x400); + return; + } + + return; +} + +UINT8 __fastcall blockout_read_byte(UINT32 address) +{ + switch (address^1) + { + case 0x100000: + return DrvInputs[0]; + + case 0x100002: + return DrvInputs[1]; + + case 0x100004: + return DrvInputs[2] & 0x0e; + + case 0x100006: + return DrvDips[0]; + + case 0x100008: + return ((DrvDips[1] & 0x3f) | (DrvInputs[4] & 0xc0)); + } + + return 0; +} + +UINT16 __fastcall blockout_read_word(UINT32 address) +{ + switch (address) + { + case 0x100000: + return DrvInputs[0]; + + case 0x100002: + return DrvInputs[1]; + + case 0x100004: + return DrvInputs[2] & 0x0e; + + case 0x100006: + return DrvDips[0]; + + case 0x100008: + return ((DrvDips[1] & 0x3f) | (DrvInputs[4] & 0xc0)); + } + + return 0; +} + +void __fastcall blockout_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8800: + BurnYM2151SelectRegister(data); + return; + + case 0x8801: + BurnYM2151WriteRegister(data); + return; + + case 0x9800: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall blockout_sound_read(UINT16 address) +{ + switch (address) + { + case 0x8801: + return BurnYM2151ReadStatus(); + + case 0x9800: + return MSM6295ReadStatus(0); + + case 0xa000: + return *soundlatch; + } + + return 0; +} + +void BlockoutYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM2151Reset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x008000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x0201 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM0 = Next; Next += 0x00c000; + Drv68KRAM1 = Next; Next += 0x00c000; + Drv68KRAM2 = Next; Next += 0x018000; + DrvVidRAM0 = Next; Next += 0x040000; + DrvVidRAM1 = Next; Next += 0x008000; + DrvPalRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + DrvTmpBmp = (UINT16*)Next; Next += (320 * 240) * sizeof(UINT16); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + BurnSetRefreshRate(58.0); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 3, 1)) return 1; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvVidRAM0, 0x180000, 0x1bffff, SM_ROM); + SekMapMemory(Drv68KRAM0, 0x1d4000, 0x1dffff, SM_RAM); + SekMapMemory(Drv68KRAM1, 0x1f4000, 0x1fffff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x200000, 0x207fff, SM_RAM); + SekMapMemory(Drv68KRAM2, 0x208000, 0x21ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x280200, 0x2805ff, SM_ROM); // maps 280000 - 2707ff + SekSetWriteByteHandler(0, blockout_write_byte); + SekSetWriteWordHandler(0, blockout_write_word); + SekSetReadByteHandler(0, blockout_read_byte); + SekSetReadWordHandler(0, blockout_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(blockout_sound_write); + ZetSetReadHandler(blockout_sound_read); + ZetClose(); + + MSM6295Init(0, 1056000 / 132, 1); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&BlockoutYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.60, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.60, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + MSM6295Exit(0); + BurnYM2151Exit(); + + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x402; i+=2) { + palette_write(i); + } + } + + memcpy (pTransDraw, DrvTmpBmp, 320 * 240 * sizeof(UINT16)); + + { + UINT16 *vram = (UINT16*)DrvVidRAM1; + + for (INT32 y = 0; y < 240;y++) + { + for (INT32 x = 0; x < 320; x+=8) + { + INT32 d = vram[((y + 8) << 6) + (x >> 3)]; + + if (d) { + for (INT32 v = 0x80, c = 0; v > 0; v >>= 1, c++) + if (d & v) pTransDraw[(y * 320) + x + c] = 512; + } + } + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 5); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + } + } + + INT32 nSegment; + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + INT32 nTotalCycles[2] = { 10000000 / 58, 3579545 / 58 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + + nSegment = nTotalCycles[0] / nInterleave; + + SekRun(nSegment); + + nSegment = nTotalCycles[1] / nInterleave; + + ZetRun(nSegment); + nSegment = nBurnSoundLen / nInterleave; + + if (pBurnSoundOut) { + INT16 *pSoundBuf = pBurnSoundOut + nSoundBufferPos * 2; + BurnYM2151Render(pSoundBuf, nSegment); + MSM6295Render(0, pSoundBuf, nSegment); + nSoundBufferPos += nSegment; + } + + if (i == (nInterleave / 2)-1) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + } + + if (pBurnSoundOut) { + INT16 *pSoundBuf = pBurnSoundOut + nSoundBufferPos * 2; + nSegment = nBurnSoundLen - nSoundBufferPos; + if (nSegment) { + BurnYM2151Render(pSoundBuf, nSegment); + MSM6295Render(0, pSoundBuf, nSegment); + } + } + + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029698; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + } + + return 0; +} + + +// Block Out (set 1) + +static struct BurnRomInfo blockoutRomDesc[] = { + { "bo29a0-2.bin", 0x20000, 0xb0103427, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "bo29a1-2.bin", 0x20000, 0x5984d5a2, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bo29e3-0.bin", 0x08000, 0x3ea01f78, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "bo29e2-0.bin", 0x20000, 0x15c5a99d, 3 | BRF_SND }, // 3 Samples + + { "mb7114h.25", 0x00100, 0xb25bbda7, 0 | BRF_OPT }, // 4 Unused Prom +}; + +STD_ROM_PICK(blockout) +STD_ROM_FN(blockout) + +struct BurnDriver BurnDrvBlockout = { + "blockout", NULL, NULL, NULL, "1989", + "Block Out (set 1)\0", NULL, "Technos + California Dreams", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_PUZZLE, 0, + NULL, blockoutRomInfo, blockoutRomName, NULL, NULL, BlockoutInputInfo, BlockoutDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x201, + 320, 240, 4, 3 +}; + + +// Block Out (set 2) + +static struct BurnRomInfo blckout2RomDesc[] = { + { "29a0", 0x20000, 0x605f931e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "29a1", 0x20000, 0x38f07000, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bo29e3-0.bin", 0x08000, 0x3ea01f78, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "bo29e2-0.bin", 0x20000, 0x15c5a99d, 3 | BRF_SND }, // 3 Samples + + { "mb7114h.25", 0x00100, 0xb25bbda7, 0 | BRF_OPT }, // 4 Unused Prom +}; + +STD_ROM_PICK(blckout2) +STD_ROM_FN(blckout2) + +struct BurnDriver BurnDrvBlckout2 = { + "blockout2", "blockout", NULL, NULL, "1989", + "Block Out (set 2)\0", NULL, "Technos + California Dreams", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_PUZZLE, 0, + NULL, blckout2RomInfo, blckout2RomName, NULL, NULL, BlockoutInputInfo, BlockoutDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x201, + 320, 240, 4, 3 +}; + + +// Block Out (Japan) + +static struct BurnRomInfo blckoutjRomDesc[] = { + { "2.bin", 0x20000, 0xe16cf065, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "1.bin", 0x20000, 0x950b28a3, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bo29e3-0.bin", 0x08000, 0x3ea01f78, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "bo29e2-0.bin", 0x20000, 0x15c5a99d, 3 | BRF_SND }, // 3 Samples + + { "mb7114h.25", 0x00100, 0xb25bbda7, 0 | BRF_OPT }, // 4 Unused Prom +}; + +STD_ROM_PICK(blckoutj) +STD_ROM_FN(blckoutj) + +struct BurnDriver BurnDrvBlckoutj = { + "blockoutj", "blockout", NULL, NULL, "1989", + "Block Out (Japan)\0", NULL, "Technos + California Dreams", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_PUZZLE, 0, + NULL, blckoutjRomInfo, blckoutjRomName, NULL, NULL, BlckoutjInputInfo, BlockoutDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x201, + 320, 240, 4, 3 +}; + + +// Agress + +static struct BurnRomInfo agressRomDesc[] = { + { "palco1.81", 0x20000, 0x3acc917a, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "palco2.91", 0x20000, 0xabfd5bcc, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "palco3.73", 0x08000, 0x2a21c97d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "palco4.78", 0x20000, 0x9dfd9cfe, 3 | BRF_SND }, // 3 Samples + + { "82s129pr.25", 0x00100, 0xb25bbda7, 0 | BRF_OPT }, // 4 Unused Prom +}; + +STD_ROM_PICK(agress) +STD_ROM_FN(agress) + +struct BurnDriver BurnDrvAgress = { + "agress", NULL, NULL, NULL, "1991", + "Agress\0", NULL, "Palco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_PUZZLE, 0, + NULL, agressRomInfo, agressRomName, NULL, NULL, BlockoutInputInfo, AgressDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x201, + 320, 240, 4, 3 +}; + + +// Agress (English bootleg) + +static struct BurnRomInfo agressbRomDesc[] = { + { "palco1.ic81", 0x20000, 0xa1875175, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "palco2.ic91", 0x20000, 0xab3182c3, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "palco3.ic73", 0x08000, 0x2a21c97d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "palco4.ic78", 0x20000, 0x9dfd9cfe, 3 | BRF_SND }, // 3 Samples + + { "prom29-mb7114h.ic25", 0x00100, 0xb25bbda7, 0 | BRF_OPT }, // 4 Unused Prom +}; + +STD_ROM_PICK(agressb) +STD_ROM_FN(agressb) + +struct BurnDriver BurnDrvAgressb = { + "agressb", "agress", NULL, NULL, "2003", + "Agress (English bootleg)\0", NULL, "Palco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_PUZZLE, 0, + NULL, agressbRomInfo, agressbRomName, NULL, NULL, BlockoutInputInfo, AgressDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x201, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_blueprnt.cpp b/src/burn/drv/pre90s/d_blueprnt.cpp index ff4a80baa..b1b8dda6f 100644 --- a/src/burn/drv/pre90s/d_blueprnt.cpp +++ b/src/burn/drv/pre90s/d_blueprnt.cpp @@ -1,735 +1,733 @@ -// FB Alpha Blue Print driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *RamEnd; -static UINT8 *AllRam; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvColRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvScrollRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT32 *DrvPalette; -static INT16 *pAY8910Buffer[6]; - -static UINT8 *watchdog; -static UINT8 *dipsw; -static UINT8 *soundlatch; -static UINT8 *flipscreen; -static UINT8 *gfx_bank; - -static UINT8 DrvReset; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[2]; - -static UINT8 DrvRecalc; - -static struct BurnInputInfo BlueprntInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 1, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 6, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 7, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 4, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 5, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 6, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 7, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 4, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 5, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 2, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Blueprnt) - -static struct BurnDIPInfo BlueprntDIPList[]= -{ - {0x11, 0xff, 0xff, 0xc3, NULL }, - {0x12, 0xff, 0xff, 0xd5, NULL }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x11, 0x01, 0x06, 0x00, "20K" }, - {0x11, 0x01, 0x06, 0x02, "30K" }, - {0x11, 0x01, 0x06, 0x04, "40K" }, - {0x11, 0x01, 0x06, 0x06, "50K" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x11, 0x01, 0x08, 0x00, "Off" }, - {0x11, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Maze Monster Appears In" }, - {0x11, 0x01, 0x10, 0x00, "2nd Maze" }, - {0x11, 0x01, 0x10, 0x10, "3rd Maze" }, - - {0 , 0xfe, 0 , 2, "Coin A" }, - {0x11, 0x01, 0x20, 0x20, "2 Coins 1 Credits " }, - {0x11, 0x01, 0x20, 0x00, "1 Coin 1 Credits " }, - - {0 , 0xfe, 0 , 2, "Coin B" }, - {0x11, 0x01, 0x40, 0x40, "1 Coin 3 Credits " }, - {0x11, 0x01, 0x40, 0x00, "1 Coin 5 Credits " }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x03, 0x00, "2" }, - {0x12, 0x01, 0x03, 0x01, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x03, "5" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x08, 0x00, "Upright" }, - {0x12, 0x01, 0x08, 0x08, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x30, 0x00, "Level 1" }, - {0x12, 0x01, 0x30, 0x10, "Level 2" }, - {0x12, 0x01, 0x30, 0x20, "Level 3" }, - {0x12, 0x01, 0x30, 0x30, "Level 4" }, -}; - -STDDIPINFO(Blueprnt) - -static struct BurnInputInfo SaturnInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 1, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 6, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 7, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 4, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 5, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 6, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 7, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 4, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 5, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Saturn) - -static struct BurnDIPInfo SaturnDIPList[]= -{ - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x04, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x11, 0x01, 0x02, 0x00, "Upright" }, - {0x11, 0x01, 0x02, 0x02, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x11, 0x01, 0xc0, 0x00, "3" }, - {0x11, 0x01, 0xc0, 0x40, "4" }, - {0x11, 0x01, 0xc0, 0x80, "5" }, - {0x11, 0x01, 0xc0, 0xc0, "6" }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x12, 0x01, 0x02, 0x02, "A 2/1 B 1/3" }, - {0x12, 0x01, 0x02, 0x00, "A 1/1 B 1/6" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x04, 0x00, "Off" }, - {0x12, 0x01, 0x04, 0x04, "On" }, -}; - -STDDIPINFO(Saturn) - -void __fastcall blueprint_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xd000: - { - *soundlatch = data; - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - } - return; - - case 0xe000: - { - *flipscreen = ~data & 2; - *gfx_bank = (data >> 2) & 1; - } - - return; - } -} - -UINT8 __fastcall blueprint_read(UINT16 address) -{ - switch (address) - { - case 0xc000: - case 0xc001: - return DrvInputs[address & 1]; - - case 0xc003: - return *dipsw; - - case 0xe000: - *watchdog = 0; - return 0; - } - - return 0; -} - -void __fastcall blueprint_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x6000: - AY8910Write(0, 0, data); - return; - - case 0x6001: - AY8910Write(0, 1, data); - return; - - case 0x8000: - AY8910Write(1, 0, data); - return; - - case 0x8001: - AY8910Write(1, 1, data); - return; - } -} - -UINT8 __fastcall blueprint_sound_read(UINT16 address) -{ - switch (address) - { - case 0x6002: - return AY8910Read(0); - - case 0x8002: - return AY8910Read(1); - } - - return 0; -} - -UINT8 ay8910_0_read_port_1(UINT32) -{ - return *soundlatch; -} - -void ay8910_0_write_port_0(UINT32, UINT32 data) -{ - *dipsw = data & 0xff; -} - -UINT8 ay8910_1_read_port_0(UINT32) -{ - return DrvDips[0]; -} - -UINT8 ay8910_1_read_port_1(UINT32) -{ - return DrvDips[1]; -} - -static void palette_init() -{ - for (INT32 i = 0; i < 512 + 8; i++) - { - UINT8 pen; - - if (i < 0x200) - pen = ((i & 0x100) >> 5) | ((i & 0x002) ? ((i & 0x0e0) >> 5) : 0) | ((i & 0x001) ? ((i & 0x01c) >> 2) : 0); - else - pen = i - 0x200; - - INT32 r = ((pen >> 0) & 1) * (((pen & 8) >> 1) ^ 0xff); - INT32 g = ((pen >> 2) & 1) * (((pen & 8) >> 1) ^ 0xff); - INT32 b = ((pen >> 1) & 1) * (((pen & 8) >> 1) ^ 0xff); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[3] = { (0x1000 * 8) * 2, (0x1000 * 8) * 1, (0x1000 * 8) * 0 }; - INT32 XOffs[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; - INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x03000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x02000); - - GfxDecode(0x0200, 2, 8, 8, Plane + 1, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x03000); - - GfxDecode(0x0100, 3, 8, 16, Plane + 0, XOffs, YOffs, 0x080, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - AY8910Reset(1); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x010000; - DrvZ80ROM1 = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x008000; - DrvGfxROM1 = Next; Next += 0x008000; - - DrvPalette = (UINT32*)Next; Next += 0x0208 * sizeof(UINT32); - - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[3] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[4] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[5] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - AllRam = Next; - - DrvColRAM = Next; Next += 0x000400; - DrvVidRAM = Next; Next += 0x000400; - DrvScrollRAM = Next; Next += 0x000100; - DrvSprRAM = Next; Next += 0x000100; - - DrvZ80RAM0 = Next; Next += 0x000800; - DrvZ80RAM1 = Next; Next += 0x000800; - - dipsw = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - gfx_bank = Next; Next += 0x000001; - watchdog = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - INT32 lofst = 0; - - if (BurnLoadRom(DrvZ80ROM0 + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x1000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x2000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x3000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x4000, 4, 1)) return 1; - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "saturnzi")) { - if (BurnLoadRom(DrvZ80ROM0 + 0x5000, 5, 1)) return 1; - lofst = 1; - } - - if (BurnLoadRom(DrvZ80ROM1 + 0x0000, 5+lofst, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x2000, 6+lofst, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x0000, 7+lofst, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x1000, 8+lofst, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x0000, 9+lofst, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x1000, 10+lofst,1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x2000, 11+lofst,1)) return 1; - - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM0); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM0); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM0); - ZetMapArea(0x9000, 0x93ff, 0, DrvVidRAM); - ZetMapArea(0x9000, 0x93ff, 1, DrvVidRAM); - ZetMapArea(0x9000, 0x93ff, 2, DrvVidRAM); - ZetMapArea(0x9400, 0x97ff, 0, DrvVidRAM); - ZetMapArea(0x9400, 0x97ff, 1, DrvVidRAM); - ZetMapArea(0x9400, 0x97ff, 2, DrvVidRAM); - ZetMapArea(0xa000, 0xa0ff, 0, DrvScrollRAM); - ZetMapArea(0xa000, 0xa0ff, 1, DrvScrollRAM); - ZetMapArea(0xa000, 0xa0ff, 2, DrvScrollRAM); - ZetMapArea(0xb000, 0xb0ff, 0, DrvSprRAM); - ZetMapArea(0xb000, 0xb0ff, 1, DrvSprRAM); - ZetMapArea(0xb000, 0xb0ff, 2, DrvSprRAM); - ZetMapArea(0xf000, 0xf3ff, 0, DrvColRAM); - ZetMapArea(0xf000, 0xf3ff, 1, DrvColRAM); - ZetMapArea(0xf000, 0xf3ff, 2, DrvColRAM); - ZetSetWriteHandler(blueprint_write); - ZetSetReadHandler(blueprint_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x2fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x2fff, 2, DrvZ80ROM1); - ZetMapArea(0x4000, 0x43ff, 0, DrvZ80RAM1); - ZetMapArea(0x4000, 0x43ff, 1, DrvZ80RAM1); - ZetMapArea(0x4000, 0x43ff, 2, DrvZ80RAM1); - ZetSetWriteHandler(blueprint_sound_write); - ZetSetReadHandler(blueprint_sound_read); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 625000, nBurnSoundRate, NULL, &ay8910_0_read_port_1, &ay8910_0_write_port_0, NULL); - AY8910Init(1, 625000, nBurnSoundRate, &ay8910_1_read_port_0, &ay8910_1_read_port_1, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - - AY8910Exit(0); - AY8910Exit(1); - - BurnFree (AllMem); - - return 0; -} - -static void draw_layer(INT32 prio) -{ - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 attr = DrvColRAM[offs]; - if ((attr >> 7) != prio) continue; - - INT32 code = DrvVidRAM[offs] | (*gfx_bank << 8); - INT32 color = attr & 0x7f; - - INT32 sx = (~offs & 0x3e0) >> 2; - INT32 sy = (offs & 0x1f) << 3; - - sy -= DrvScrollRAM[(30 + *flipscreen) - (sx >> 3)]; - if (sy < -7) sy += 0x100; - - if (*flipscreen) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx ^ 0xf8, (248 - sy) - 16, color, 2, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy - 16, color, 2, 0, 0, DrvGfxROM0); - } - } -} - -static void draw_8x16_tile(INT32 code, INT32 sx, INT32 sy, INT32 fx, INT32 fy) -{ - UINT8 *src = DrvGfxROM1 + (code << 7); - - for (INT32 y = 0; y < 16; y++) - { - INT32 yy = sy + y; - - for (INT32 x = 0; x < 8; x++) - { - INT32 xx = sx + x; - INT32 d = src[((y ^ fy) << 3) | (x ^ fx)]; - - if (yy < 0 || xx < 0 || yy >= nScreenHeight || xx >= nScreenWidth || !d) continue; - - pTransDraw[(yy * nScreenWidth) + xx] = d | 0x200; - } - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0; offs < 0x100; offs += 4) - { - INT32 code = DrvSprRAM[offs + 1]; - INT32 sx = DrvSprRAM[offs + 3]; - INT32 sy = 240 - DrvSprRAM[offs]; - INT32 flipx = (DrvSprRAM[offs + 2] >> 6) & 1; - INT32 flipy = (DrvSprRAM[offs + 2 - 4] >> 7) & 1; - - if (*flipscreen) - { - sx = 248 - sx; - sy = 240 - sy; - flipx ^= 1; - flipy ^= 1; - } - - draw_8x16_tile(code, sx+2, sy-17, flipx * 0x07, flipy * 0x0f); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - palette_init(); - } - - memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); - - draw_layer(0); - draw_sprites(); - draw_layer(1); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - if (*watchdog > 180) { - DrvDoReset(); - } - - *watchdog = *watchdog + 1; - } - - { - DrvInputs[0] = DrvInputs[1] = 0; - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] |= (DrvJoy1[i] & 1) << i; - DrvInputs[1] |= (DrvJoy2[i] & 1) << i; - } - } - - INT32 nSegment; - INT32 nInterleave = 256; - INT32 nTotalCycles[2] = { 3500000 / 60, 625000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); - - ZetOpen(0); - nCyclesDone[0] += ZetRun(nSegment); - if (i == 255) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - nSegment = (nTotalCycles[1] - nCyclesDone[1]) / (nInterleave - i); - - ZetOpen(1); - nCyclesDone[1] += ZetRun(nSegment); - if ((i & 0x3f) == 0x3f) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - } - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029698; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - AY8910Scan(nAction, pnMin); - } - - return 0; -} - - -// Blue Print (Midway) - -static struct BurnRomInfo blueprntRomDesc[] = { - { "bp-1.1m", 0x1000, 0xb20069a6, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "bp-2.1n", 0x1000, 0x4a30302e, 1 | BRF_PRG | BRF_ESS }, // 1 - { "bp-3.1p", 0x1000, 0x6866ca07, 1 | BRF_PRG | BRF_ESS }, // 2 - { "bp-4.1r", 0x1000, 0x5d3cfac3, 1 | BRF_PRG | BRF_ESS }, // 3 - { "bp-5.1s", 0x1000, 0xa556cac4, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "snd-1.3u", 0x1000, 0xfd38777a, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 Code - { "snd-2.3v", 0x1000, 0x33d5bf5b, 2 | BRF_PRG | BRF_ESS }, // 6 - - { "bg-1.3c", 0x1000, 0xac2a61bc, 3 | BRF_GRA }, // 7 Background Tiles - { "bg-2.3d", 0x1000, 0x81fe85d7, 3 | BRF_GRA }, // 8 - - { "red.17d", 0x1000, 0xa73b6483, 4 | BRF_GRA }, // 9 Sprites - { "blue.18d", 0x1000, 0x7d622550, 4 | BRF_GRA }, // 10 - { "green.20d", 0x1000, 0x2fcb4f26, 4 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(blueprnt) -STD_ROM_FN(blueprnt) - -struct BurnDriver BurnDrvBlueprnt = { - "blueprnt", NULL, NULL, NULL, "1982", - "Blue Print (Midway)\0", NULL, "[Zilec Electronics] Bally Midway", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, blueprntRomInfo, blueprntRomName, NULL, NULL, BlueprntInputInfo, BlueprntDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x208, - 224, 256, 3, 4 -}; - - -// Blue Print (Jaleco) - -static struct BurnRomInfo blueprnjRomDesc[] = { - { "bp-1j.1m", 0x1000, 0x2e746693, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "bp-2j.1n", 0x1000, 0xa0eb0b8e, 1 | BRF_PRG | BRF_ESS }, // 1 - { "bp-3j.1p", 0x1000, 0xc34981bb, 1 | BRF_PRG | BRF_ESS }, // 2 - { "bp-4j.1r", 0x1000, 0x525e77b5, 1 | BRF_PRG | BRF_ESS }, // 3 - { "bp-5j.1s", 0x1000, 0x431a015f, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "snd-1.3u", 0x1000, 0xfd38777a, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 Code - { "snd-2.3v", 0x1000, 0x33d5bf5b, 2 | BRF_PRG | BRF_ESS }, // 6 - - { "bg-1j.3c", 0x0800, 0x43718c34, 3 | BRF_GRA }, // 7 Background Tiles - { "bg-2j.3d", 0x0800, 0xd3ce077d, 3 | BRF_GRA }, // 8 - - { "redj.17d", 0x1000, 0x83da108f, 4 | BRF_GRA }, // 9 Sprites - { "bluej.18d", 0x1000, 0xb440f32f, 4 | BRF_GRA }, // 10 - { "greenj.20d", 0x1000, 0x23026765, 4 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(blueprnj) -STD_ROM_FN(blueprnj) - -struct BurnDriver BurnDrvBlueprnj = { - "blueprntj", "blueprnt", NULL, NULL, "1982", - "Blue Print (Jaleco)\0", NULL, "[Zilec Electronics] Jaleco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, blueprnjRomInfo, blueprnjRomName, NULL, NULL, BlueprntInputInfo, BlueprntDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x208, - 224, 256, 3, 4 -}; - - -// Saturn - -static struct BurnRomInfo saturnziRomDesc[] = { - { "r1", 0x1000, 0x18a6d68e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "r2", 0x1000, 0xa7dd2665, 1 | BRF_PRG | BRF_ESS }, // 1 - { "r3", 0x1000, 0xb9cfa791, 1 | BRF_PRG | BRF_ESS }, // 2 - { "r4", 0x1000, 0xc5a997e7, 1 | BRF_PRG | BRF_ESS }, // 3 - { "r5", 0x1000, 0x43444d00, 1 | BRF_PRG | BRF_ESS }, // 4 - { "r6", 0x1000, 0x4d4821f6, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "r7", 0x1000, 0xdd43e02f, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 Code - { "r8", 0x1000, 0x7f9d0877, 2 | BRF_PRG | BRF_ESS }, // 7 - - { "r10", 0x1000, 0x35987d61, 3 | BRF_GRA }, // 8 Background Tiles - { "r9", 0x1000, 0xca6a7fda, 3 | BRF_GRA }, // 9 - - { "r11", 0x1000, 0x6e4e6e5d, 4 | BRF_GRA }, // 10 Sprites - { "r12", 0x1000, 0x46fc049e, 4 | BRF_GRA }, // 11 - { "r13", 0x1000, 0x8b3e8c32, 4 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(saturnzi) -STD_ROM_FN(saturnzi) - -struct BurnDriver BurnDrvSaturnzi = { - "saturnzi", NULL, NULL, NULL, "1983", - "Saturn\0", NULL, "[Zilec Electronics] Jaleco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, saturnziRomInfo, saturnziRomName, NULL, NULL, SaturnInputInfo, SaturnDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x208, - 224, 256, 3, 4 -}; +// FB Alpha Blue Print driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *RamEnd; +static UINT8 *AllRam; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvColRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvScrollRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT32 *DrvPalette; +static INT16 *pAY8910Buffer[6]; + +static UINT8 *watchdog; +static UINT8 *dipsw; +static UINT8 *soundlatch; +static UINT8 *flipscreen; +static UINT8 *gfx_bank; + +static UINT8 DrvReset; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[2]; + +static UINT8 DrvRecalc; + +static struct BurnInputInfo BlueprntInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 1, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 6, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 7, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 4, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 5, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 6, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 7, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 4, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 5, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 2, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Blueprnt) + +static struct BurnDIPInfo BlueprntDIPList[]= +{ + {0x11, 0xff, 0xff, 0xc3, NULL }, + {0x12, 0xff, 0xff, 0xd5, NULL }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x11, 0x01, 0x06, 0x00, "20K" }, + {0x11, 0x01, 0x06, 0x02, "30K" }, + {0x11, 0x01, 0x06, 0x04, "40K" }, + {0x11, 0x01, 0x06, 0x06, "50K" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x11, 0x01, 0x08, 0x00, "Off" }, + {0x11, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Maze Monster Appears In" }, + {0x11, 0x01, 0x10, 0x00, "2nd Maze" }, + {0x11, 0x01, 0x10, 0x10, "3rd Maze" }, + + {0 , 0xfe, 0 , 2, "Coin A" }, + {0x11, 0x01, 0x20, 0x20, "2 Coins 1 Credits " }, + {0x11, 0x01, 0x20, 0x00, "1 Coin 1 Credits " }, + + {0 , 0xfe, 0 , 2, "Coin B" }, + {0x11, 0x01, 0x40, 0x40, "1 Coin 3 Credits " }, + {0x11, 0x01, 0x40, 0x00, "1 Coin 5 Credits " }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x03, 0x00, "2" }, + {0x12, 0x01, 0x03, 0x01, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x03, "5" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x08, 0x00, "Upright" }, + {0x12, 0x01, 0x08, 0x08, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x30, 0x00, "Level 1" }, + {0x12, 0x01, 0x30, 0x10, "Level 2" }, + {0x12, 0x01, 0x30, 0x20, "Level 3" }, + {0x12, 0x01, 0x30, 0x30, "Level 4" }, +}; + +STDDIPINFO(Blueprnt) + +static struct BurnInputInfo SaturnInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 1, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 6, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 7, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 4, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 5, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 6, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 7, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 4, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 5, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Saturn) + +static struct BurnDIPInfo SaturnDIPList[]= +{ + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x04, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x11, 0x01, 0x02, 0x00, "Upright" }, + {0x11, 0x01, 0x02, 0x02, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x11, 0x01, 0xc0, 0x00, "3" }, + {0x11, 0x01, 0xc0, 0x40, "4" }, + {0x11, 0x01, 0xc0, 0x80, "5" }, + {0x11, 0x01, 0xc0, 0xc0, "6" }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x12, 0x01, 0x02, 0x02, "A 2/1 B 1/3" }, + {0x12, 0x01, 0x02, 0x00, "A 1/1 B 1/6" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x04, 0x00, "Off" }, + {0x12, 0x01, 0x04, 0x04, "On" }, +}; + +STDDIPINFO(Saturn) + +void __fastcall blueprint_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xd000: + { + *soundlatch = data; + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + } + return; + + case 0xe000: + { + *flipscreen = ~data & 2; + *gfx_bank = (data >> 2) & 1; + } + + return; + } +} + +UINT8 __fastcall blueprint_read(UINT16 address) +{ + switch (address) + { + case 0xc000: + case 0xc001: + return DrvInputs[address & 1]; + + case 0xc003: + return *dipsw; + + case 0xe000: + *watchdog = 0; + return 0; + } + + return 0; +} + +void __fastcall blueprint_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x6000: + AY8910Write(0, 0, data); + return; + + case 0x6001: + AY8910Write(0, 1, data); + return; + + case 0x8000: + AY8910Write(1, 0, data); + return; + + case 0x8001: + AY8910Write(1, 1, data); + return; + } +} + +UINT8 __fastcall blueprint_sound_read(UINT16 address) +{ + switch (address) + { + case 0x6002: + return AY8910Read(0); + + case 0x8002: + return AY8910Read(1); + } + + return 0; +} + +UINT8 ay8910_0_read_port_1(UINT32) +{ + return *soundlatch; +} + +void ay8910_0_write_port_0(UINT32, UINT32 data) +{ + *dipsw = data & 0xff; +} + +UINT8 ay8910_1_read_port_0(UINT32) +{ + return DrvDips[0]; +} + +UINT8 ay8910_1_read_port_1(UINT32) +{ + return DrvDips[1]; +} + +static void palette_init() +{ + for (INT32 i = 0; i < 512 + 8; i++) + { + UINT8 pen; + + if (i < 0x200) + pen = ((i & 0x100) >> 5) | ((i & 0x002) ? ((i & 0x0e0) >> 5) : 0) | ((i & 0x001) ? ((i & 0x01c) >> 2) : 0); + else + pen = i - 0x200; + + INT32 r = ((pen >> 0) & 1) * (((pen & 8) >> 1) ^ 0xff); + INT32 g = ((pen >> 2) & 1) * (((pen & 8) >> 1) ^ 0xff); + INT32 b = ((pen >> 1) & 1) * (((pen & 8) >> 1) ^ 0xff); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[3] = { (0x1000 * 8) * 2, (0x1000 * 8) * 1, (0x1000 * 8) * 0 }; + INT32 XOffs[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, + 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x03000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x02000); + + GfxDecode(0x0200, 2, 8, 8, Plane + 1, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x03000); + + GfxDecode(0x0100, 3, 8, 16, Plane + 0, XOffs, YOffs, 0x080, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + AY8910Reset(1); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x010000; + DrvZ80ROM1 = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x008000; + DrvGfxROM1 = Next; Next += 0x008000; + + DrvPalette = (UINT32*)Next; Next += 0x0208 * sizeof(UINT32); + + pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[3] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[4] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[5] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + AllRam = Next; + + DrvColRAM = Next; Next += 0x000400; + DrvVidRAM = Next; Next += 0x000400; + DrvScrollRAM = Next; Next += 0x000100; + DrvSprRAM = Next; Next += 0x000100; + + DrvZ80RAM0 = Next; Next += 0x000800; + DrvZ80RAM1 = Next; Next += 0x000800; + + dipsw = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + gfx_bank = Next; Next += 0x000001; + watchdog = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + INT32 lofst = 0; + + if (BurnLoadRom(DrvZ80ROM0 + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x1000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x2000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x3000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x4000, 4, 1)) return 1; + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "saturnzi")) { + if (BurnLoadRom(DrvZ80ROM0 + 0x5000, 5, 1)) return 1; + lofst = 1; + } + + if (BurnLoadRom(DrvZ80ROM1 + 0x0000, 5+lofst, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x2000, 6+lofst, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x0000, 7+lofst, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x1000, 8+lofst, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x0000, 9+lofst, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x1000, 10+lofst,1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x2000, 11+lofst,1)) return 1; + + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM0); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM0); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM0); + ZetMapArea(0x9000, 0x93ff, 0, DrvVidRAM); + ZetMapArea(0x9000, 0x93ff, 1, DrvVidRAM); + ZetMapArea(0x9000, 0x93ff, 2, DrvVidRAM); + ZetMapArea(0x9400, 0x97ff, 0, DrvVidRAM); + ZetMapArea(0x9400, 0x97ff, 1, DrvVidRAM); + ZetMapArea(0x9400, 0x97ff, 2, DrvVidRAM); + ZetMapArea(0xa000, 0xa0ff, 0, DrvScrollRAM); + ZetMapArea(0xa000, 0xa0ff, 1, DrvScrollRAM); + ZetMapArea(0xa000, 0xa0ff, 2, DrvScrollRAM); + ZetMapArea(0xb000, 0xb0ff, 0, DrvSprRAM); + ZetMapArea(0xb000, 0xb0ff, 1, DrvSprRAM); + ZetMapArea(0xb000, 0xb0ff, 2, DrvSprRAM); + ZetMapArea(0xf000, 0xf3ff, 0, DrvColRAM); + ZetMapArea(0xf000, 0xf3ff, 1, DrvColRAM); + ZetMapArea(0xf000, 0xf3ff, 2, DrvColRAM); + ZetSetWriteHandler(blueprint_write); + ZetSetReadHandler(blueprint_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x2fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x2fff, 2, DrvZ80ROM1); + ZetMapArea(0x4000, 0x43ff, 0, DrvZ80RAM1); + ZetMapArea(0x4000, 0x43ff, 1, DrvZ80RAM1); + ZetMapArea(0x4000, 0x43ff, 2, DrvZ80RAM1); + ZetSetWriteHandler(blueprint_sound_write); + ZetSetReadHandler(blueprint_sound_read); + ZetClose(); + + AY8910Init(0, 625000, nBurnSoundRate, NULL, &ay8910_0_read_port_1, &ay8910_0_write_port_0, NULL); + AY8910Init(1, 625000, nBurnSoundRate, &ay8910_1_read_port_0, &ay8910_1_read_port_1, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + + AY8910Exit(0); + AY8910Exit(1); + + BurnFree (AllMem); + + return 0; +} + +static void draw_layer(INT32 prio) +{ + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 attr = DrvColRAM[offs]; + if ((attr >> 7) != prio) continue; + + INT32 code = DrvVidRAM[offs] | (*gfx_bank << 8); + INT32 color = attr & 0x7f; + + INT32 sx = (~offs & 0x3e0) >> 2; + INT32 sy = (offs & 0x1f) << 3; + + sy -= DrvScrollRAM[(30 + *flipscreen) - (sx >> 3)]; + if (sy < -7) sy += 0x100; + + if (*flipscreen) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx ^ 0xf8, (248 - sy) - 16, color, 2, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy - 16, color, 2, 0, 0, DrvGfxROM0); + } + } +} + +static void draw_8x16_tile(INT32 code, INT32 sx, INT32 sy, INT32 fx, INT32 fy) +{ + UINT8 *src = DrvGfxROM1 + (code << 7); + + for (INT32 y = 0; y < 16; y++) + { + INT32 yy = sy + y; + + for (INT32 x = 0; x < 8; x++) + { + INT32 xx = sx + x; + INT32 d = src[((y ^ fy) << 3) | (x ^ fx)]; + + if (yy < 0 || xx < 0 || yy >= nScreenHeight || xx >= nScreenWidth || !d) continue; + + pTransDraw[(yy * nScreenWidth) + xx] = d | 0x200; + } + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0; offs < 0x100; offs += 4) + { + INT32 code = DrvSprRAM[offs + 1]; + INT32 sx = DrvSprRAM[offs + 3]; + INT32 sy = 240 - DrvSprRAM[offs]; + INT32 flipx = (DrvSprRAM[offs + 2] >> 6) & 1; + INT32 flipy = (DrvSprRAM[offs + 2 - 4] >> 7) & 1; + + if (*flipscreen) + { + sx = 248 - sx; + sy = 240 - sy; + flipx ^= 1; + flipy ^= 1; + } + + draw_8x16_tile(code, sx+2, sy-17, flipx * 0x07, flipy * 0x0f); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + palette_init(); + } + + memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); + + draw_layer(0); + draw_sprites(); + draw_layer(1); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + if (*watchdog > 180) { + DrvDoReset(); + } + + *watchdog = *watchdog + 1; + } + + { + DrvInputs[0] = DrvInputs[1] = 0; + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] |= (DrvJoy1[i] & 1) << i; + DrvInputs[1] |= (DrvJoy2[i] & 1) << i; + } + } + + INT32 nSegment; + INT32 nInterleave = 256; + INT32 nTotalCycles[2] = { 3500000 / 60, 625000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); + + ZetOpen(0); + nCyclesDone[0] += ZetRun(nSegment); + if (i == 255) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + nSegment = (nTotalCycles[1] - nCyclesDone[1]) / (nInterleave - i); + + ZetOpen(1); + nCyclesDone[1] += ZetRun(nSegment); + if ((i & 0x3f) == 0x3f) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + } + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029698; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + AY8910Scan(nAction, pnMin); + } + + return 0; +} + + +// Blue Print (Midway) + +static struct BurnRomInfo blueprntRomDesc[] = { + { "bp-1.1m", 0x1000, 0xb20069a6, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "bp-2.1n", 0x1000, 0x4a30302e, 1 | BRF_PRG | BRF_ESS }, // 1 + { "bp-3.1p", 0x1000, 0x6866ca07, 1 | BRF_PRG | BRF_ESS }, // 2 + { "bp-4.1r", 0x1000, 0x5d3cfac3, 1 | BRF_PRG | BRF_ESS }, // 3 + { "bp-5.1s", 0x1000, 0xa556cac4, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "snd-1.3u", 0x1000, 0xfd38777a, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 Code + { "snd-2.3v", 0x1000, 0x33d5bf5b, 2 | BRF_PRG | BRF_ESS }, // 6 + + { "bg-1.3c", 0x1000, 0xac2a61bc, 3 | BRF_GRA }, // 7 Background Tiles + { "bg-2.3d", 0x1000, 0x81fe85d7, 3 | BRF_GRA }, // 8 + + { "red.17d", 0x1000, 0xa73b6483, 4 | BRF_GRA }, // 9 Sprites + { "blue.18d", 0x1000, 0x7d622550, 4 | BRF_GRA }, // 10 + { "green.20d", 0x1000, 0x2fcb4f26, 4 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(blueprnt) +STD_ROM_FN(blueprnt) + +struct BurnDriver BurnDrvBlueprnt = { + "blueprnt", NULL, NULL, NULL, "1982", + "Blue Print (Midway)\0", NULL, "[Zilec Electronics] Bally Midway", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, blueprntRomInfo, blueprntRomName, NULL, NULL, BlueprntInputInfo, BlueprntDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x208, + 224, 256, 3, 4 +}; + + +// Blue Print (Jaleco) + +static struct BurnRomInfo blueprnjRomDesc[] = { + { "bp-1j.1m", 0x1000, 0x2e746693, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "bp-2j.1n", 0x1000, 0xa0eb0b8e, 1 | BRF_PRG | BRF_ESS }, // 1 + { "bp-3j.1p", 0x1000, 0xc34981bb, 1 | BRF_PRG | BRF_ESS }, // 2 + { "bp-4j.1r", 0x1000, 0x525e77b5, 1 | BRF_PRG | BRF_ESS }, // 3 + { "bp-5j.1s", 0x1000, 0x431a015f, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "snd-1.3u", 0x1000, 0xfd38777a, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 Code + { "snd-2.3v", 0x1000, 0x33d5bf5b, 2 | BRF_PRG | BRF_ESS }, // 6 + + { "bg-1j.3c", 0x0800, 0x43718c34, 3 | BRF_GRA }, // 7 Background Tiles + { "bg-2j.3d", 0x0800, 0xd3ce077d, 3 | BRF_GRA }, // 8 + + { "redj.17d", 0x1000, 0x83da108f, 4 | BRF_GRA }, // 9 Sprites + { "bluej.18d", 0x1000, 0xb440f32f, 4 | BRF_GRA }, // 10 + { "greenj.20d", 0x1000, 0x23026765, 4 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(blueprnj) +STD_ROM_FN(blueprnj) + +struct BurnDriver BurnDrvBlueprnj = { + "blueprntj", "blueprnt", NULL, NULL, "1982", + "Blue Print (Jaleco)\0", NULL, "[Zilec Electronics] Jaleco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, blueprnjRomInfo, blueprnjRomName, NULL, NULL, BlueprntInputInfo, BlueprntDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x208, + 224, 256, 3, 4 +}; + + +// Saturn + +static struct BurnRomInfo saturnziRomDesc[] = { + { "r1", 0x1000, 0x18a6d68e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "r2", 0x1000, 0xa7dd2665, 1 | BRF_PRG | BRF_ESS }, // 1 + { "r3", 0x1000, 0xb9cfa791, 1 | BRF_PRG | BRF_ESS }, // 2 + { "r4", 0x1000, 0xc5a997e7, 1 | BRF_PRG | BRF_ESS }, // 3 + { "r5", 0x1000, 0x43444d00, 1 | BRF_PRG | BRF_ESS }, // 4 + { "r6", 0x1000, 0x4d4821f6, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "r7", 0x1000, 0xdd43e02f, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 Code + { "r8", 0x1000, 0x7f9d0877, 2 | BRF_PRG | BRF_ESS }, // 7 + + { "r10", 0x1000, 0x35987d61, 3 | BRF_GRA }, // 8 Background Tiles + { "r9", 0x1000, 0xca6a7fda, 3 | BRF_GRA }, // 9 + + { "r11", 0x1000, 0x6e4e6e5d, 4 | BRF_GRA }, // 10 Sprites + { "r12", 0x1000, 0x46fc049e, 4 | BRF_GRA }, // 11 + { "r13", 0x1000, 0x8b3e8c32, 4 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(saturnzi) +STD_ROM_FN(saturnzi) + +struct BurnDriver BurnDrvSaturnzi = { + "saturnzi", NULL, NULL, NULL, "1983", + "Saturn\0", NULL, "[Zilec Electronics] Jaleco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, saturnziRomInfo, saturnziRomName, NULL, NULL, SaturnInputInfo, SaturnDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x208, + 224, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_bombjack.cpp b/src/burn/drv/pre90s/d_bombjack.cpp index e36e05c7c..96de33972 100644 --- a/src/burn/drv/pre90s/d_bombjack.cpp +++ b/src/burn/drv/pre90s/d_bombjack.cpp @@ -1,923 +1,921 @@ -#include "tiles_generic.h" -#include "z80_intf.h" - -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -UINT8 DrvJoy1[7] = {0, 0, 0, 0, 0, 0, 0}; -UINT8 DrvJoy2[7] = {0, 0, 0, 0, 0, 0, 0}; -UINT8 BjDip[2] = {0, 0}; -static UINT8 DrvReset = 0; -static INT32 bombjackIRQ = 0; -static INT32 latch; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *BjGfx = NULL; -static UINT8 *BjMap = NULL; -static UINT8 *BjRom = NULL; -static UINT8 *BjRam = NULL; -static UINT8 *BjColRam = NULL; -static UINT8 *BjVidRam = NULL; -static UINT8 *BjSprRam = NULL; - -// sound cpu -static UINT8 *SndRom = NULL; -static UINT8 *SndRam = NULL; - -// graphics tiles -static UINT8 *text = NULL; -static UINT8 *sprites = NULL; -static UINT8 *tiles = NULL; - -// pallete -static UINT8 *BjPalSrc = NULL; -static UINT32 *BjPalReal = NULL; - -static INT16* pFMBuffer; -static INT16* pAY8910Buffer[9]; - -// Dip Switch and Input Definitions -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p1 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 4, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 5, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 1"}, - - {"P2 Coin" , BIT_DIGITAL , DrvJoy2 + 0, "p2 coin" }, - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 1, "p2 start" }, - - {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 4, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 5, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 1"}, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip Sw(1)" , BIT_DIPSWITCH, BjDip + 0 , "dip" }, - {"Dip Sw(2)" , BIT_DIPSWITCH, BjDip + 1 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo BjDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xc0, NULL}, - {0x10, 0xff, 0xff, 0x00, NULL}, - - // Dip Sw(1) - {0, 0xfe, 0, 4, "Coin A"}, - {0x0f, 0x01, 0x03, 0x00, "1 coin 1 credit"}, - {0x0f, 0x01, 0x03, 0x01, "1 coin 2 credits"}, - {0x0f, 0x01, 0x03, 0x02, "1 coin 3 credits"}, - {0x0f, 0x01, 0x03, 0x03, "1 coin 6 credits"}, - - {0, 0xfe, 0, 4, "Coin B"}, - {0x0f, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, - {0x0f, 0x01, 0x0c, 0x00, "1 coin 1 credit"}, - {0x0f, 0x01, 0x0c, 0x08, "1 coin 2 credits"}, - {0x0f, 0x01, 0x0c, 0x0c, "1 coin 3 credits"}, - - {0, 0xfe, 0, 4, "Lives"}, - {0x0f, 0x01, 0x30, 0x30, "2"}, - {0x0f, 0x01, 0x30, 0x00, "3"}, - {0x0f, 0x01, 0x30, 0x10, "4"}, - {0x0f, 0x01, 0x30, 0x20, "5"}, - - {0, 0xfe, 0, 2, "Cabinet"}, - {0x0f, 0x01, 0x40, 0x40, "Upright"}, - {0x0f, 0x01, 0x40, 0x00, "Cocktail"}, - - {0, 0xfe, 0, 2, "Demo sounds"}, - {0x0f, 0x01, 0x80, 0x00, "Off"}, - {0x0f, 0x01, 0x80, 0x80, "On"}, - - // Dip Sw(2) - {0, 0xfe, 0, 4, "Initial high score"}, - {0x10, 0x01, 0x07, 0x00, "10000"}, - {0x10, 0x01, 0x07, 0x01, "100000"}, - {0x10, 0x01, 0x07, 0x02, "30000"}, - {0x10, 0x01, 0x07, 0x03, "50000"}, - {0x10, 0x01, 0x07, 0x04, "100000"}, - {0x10, 0x01, 0x07, 0x05, "50000"}, - {0x10, 0x01, 0x07, 0x06, "100000"}, - {0x10, 0x01, 0x07, 0x07, "50000"}, - - {0, 0xfe, 0, 4, "Bird speed"}, - {0x10, 0x01, 0x18, 0x00, "Easy"}, - {0x10, 0x01, 0x18, 0x08, "Medium"}, - {0x10, 0x01, 0x18, 0x10, "Hard"}, - {0x10, 0x01, 0x18, 0x18, "Hardest"}, - - {0, 0xfe, 0, 4, "Enemies number & speed"}, - {0x10, 0x01, 0x60, 0x20, "Easy"}, - {0x10, 0x01, 0x60, 0x00, "Medium"}, - {0x10, 0x01, 0x60, 0x40, "Hard"}, - {0x10, 0x01, 0x60, 0x60, "Hardest"}, - - {0, 0xfe, 0, 2, "Special coin"}, - {0x10, 0x01, 0x80, 0x00, "Easy"}, - {0x10, 0x01, 0x80, 0x80, "Hard"}, -}; - -STDDIPINFO(Bj) - -// Bomb Jack (set 1) -static struct BurnRomInfo BombjackRomDesc[] = { - { "09_j01b.bin", 0x2000, 0xc668dc30, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "10_l01b.bin", 0x2000, 0x52a1e5fb, BRF_ESS | BRF_PRG }, // 1 - { "11_m01b.bin", 0x2000, 0xb68a062a, BRF_ESS | BRF_PRG }, // 2 - { "12_n01b.bin", 0x2000, 0x1d3ecee5, BRF_ESS | BRF_PRG }, // 3 - { "13.1r", 0x2000, 0x70e0244d, BRF_ESS | BRF_PRG }, // 4 - - // graphics 3 bit planes: - { "03_e08t.bin", 0x1000, 0x9f0470d5, BRF_GRA }, // chars - { "04_h08t.bin", 0x1000, 0x81ec12e6, BRF_GRA }, - { "05_k08t.bin", 0x1000, 0xe87ec8b1, BRF_GRA }, - - { "14_j07b.bin", 0x2000, 0x101c858d, BRF_GRA }, // sprites - { "15_l07b.bin", 0x2000, 0x013f58f2, BRF_GRA }, - { "16_m07b.bin", 0x2000, 0x94694097, BRF_GRA }, - - { "06_l08t.bin", 0x2000, 0x51eebd89, BRF_GRA }, // background tiles - { "07_n08t.bin", 0x2000, 0x9dd98e9d, BRF_GRA }, - { "08_r08t.bin", 0x2000, 0x3155ee7d, BRF_GRA }, - - { "02_p04t.bin", 0x1000, 0x398d4a02, BRF_GRA }, // background tilemaps - - { "01_h03t.bin", 0x2000, 0x8407917d, BRF_ESS | BRF_SND }, // sound CPU -}; - -STD_ROM_PICK(Bombjack) -STD_ROM_FN(Bombjack) - - -// Bomb Jack (set 2) -static struct BurnRomInfo Bombjac2RomDesc[] = { - { "09_j01b.bin", 0x2000, 0xc668dc30, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "10_l01b.bin", 0x2000, 0x52a1e5fb, BRF_ESS | BRF_PRG }, // 1 - { "11_m01b.bin", 0x2000, 0xb68a062a, BRF_ESS | BRF_PRG }, // 2 - { "12_n01b.bin", 0x2000, 0x1d3ecee5, BRF_ESS | BRF_PRG }, // 3 - { "13_r01b.bin", 0x2000, 0xbcafdd29, BRF_ESS | BRF_PRG }, // 4 - - // graphics 3 bit planes: - { "03_e08t.bin", 0x1000, 0x9f0470d5, BRF_GRA }, // chars - { "04_h08t.bin", 0x1000, 0x81ec12e6, BRF_GRA }, - { "05_k08t.bin", 0x1000, 0xe87ec8b1, BRF_GRA }, - - { "14_j07b.bin", 0x2000, 0x101c858d, BRF_GRA }, // sprites - { "15_l07b.bin", 0x2000, 0x013f58f2, BRF_GRA }, - { "16_m07b.bin", 0x2000, 0x94694097, BRF_GRA }, - - { "06_l08t.bin", 0x2000, 0x51eebd89, BRF_GRA }, // background tiles - { "07_n08t.bin", 0x2000, 0x9dd98e9d, BRF_GRA }, - { "08_r08t.bin", 0x2000, 0x3155ee7d, BRF_GRA }, - - { "02_p04t.bin", 0x1000, 0x398d4a02, BRF_GRA }, // background tilemaps - - { "01_h03t.bin", 0x2000, 0x8407917d, BRF_ESS | BRF_SND }, // sound CPU -}; - -STD_ROM_PICK(Bombjac2) -STD_ROM_FN(Bombjac2) - - -static INT32 DrvDoReset() -{ - bombjackIRQ = 0; - latch = 0; - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - for (INT32 i = 0; i < 3; i++) { - AY8910Reset(i); - } - return 0; -} - - -UINT8 __fastcall BjMemRead(UINT16 addr) -{ - UINT8 inputs=0; - - if (addr >= 0x9820 && addr <= 0x987f) return BjSprRam[addr - 0x9820]; - - if (addr==0xb000) { - if (DrvJoy1[5]) - inputs|=0x01; - if (DrvJoy1[4]) - inputs|=0x02; - if (DrvJoy1[2]) - inputs|=0x04; - if (DrvJoy1[3]) - inputs|=0x08; - if (DrvJoy1[6]) - inputs|=0x10; - return inputs; - } - if (addr==0xb001) { - if (DrvJoy2[5]) - inputs|=0x01; - if (DrvJoy2[4]) - inputs|=0x02; - if (DrvJoy2[2]) - inputs|=0x04; - if (DrvJoy2[3]) - inputs|=0x08; - if (DrvJoy2[6]) - inputs|=0x10; - return inputs; - } - if (addr==0xb002) { - if (DrvJoy1[0]) - inputs|=0x01; - if (DrvJoy1[1]) - inputs|=0x04; - if (DrvJoy2[0]) - inputs|=0x02; - if (DrvJoy2[1]) - inputs|=0x08; - return inputs; - } - if (addr==0xb004) { - return BjDip[0]; // Dip Sw(1) - } - if (addr==0xb005) { - return BjDip[1]; // Dip Sw(2) - } - return 0; -} - -void __fastcall BjMemWrite(UINT16 addr,UINT8 val) -{ - if (addr >= 0x9820 && addr <= 0x987f) { BjSprRam[addr - 0x9820] = val; return; } - - if (addr==0xb000) - { - bombjackIRQ = val; - } - if(addr==0xb800) - { - latch=val; - return; - } - BjRam[addr]=val; -} - -UINT8 __fastcall SndMemRead(UINT16 a) -{ - if (a==0xFF00) - { - return 0x7f; - } - if(a==0x6000) - { - INT32 res; - res = latch; - latch = 0; - return res; - } - return 0; -} - - - -void __fastcall SndPortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - switch (a) { - case 0x00: { - AY8910Write(0, 0, d); - return; - } - case 0x01: { - AY8910Write(0, 1, d); - return; - } - case 0x10: { - AY8910Write(1, 0, d); - return; - } - case 0x11: { - AY8910Write(1, 1, d); - return; - } - case 0x80: { - AY8910Write(2, 0, d); - return; - } - case 0x81: { - AY8910Write(2, 1, d); - return; - } - } -} - -INT32 BjZInit() -{ - // Init the z80 - ZetInit(0); - // Main CPU setup - ZetOpen(0); - - ZetMapArea (0x0000,0x7fff,0,BjRom+0x0000); // Direct Read from ROM - ZetMapArea (0x0000,0x7fff,2,BjRom+0x0000); // Direct Fetch from ROM - ZetMapArea (0xc000,0xdfff,0,BjRom+0x8000); // Direct Read from ROM - ZetMapArea (0xc000,0xdfff,2,BjRom+0x8000); // Direct Fetch from ROM - - ZetMapArea (0x8000,0x8fff,0,BjRam+0x8000); - ZetMapArea (0x8000,0x8fff,1,BjRam+0x8000); - - ZetMapArea (0x9000,0x93ff,0,BjVidRam); - ZetMapArea (0x9000,0x93ff,1,BjVidRam); - - ZetMapArea (0x9400,0x97ff,0,BjColRam); - ZetMapArea (0x9400,0x97ff,1,BjColRam); - -// ZetMapArea (0x9820,0x987f,0,BjSprRam); -// ZetMapArea (0x9820,0x987f,1,BjSprRam); - - ZetMapArea (0x9c00,0x9cff,0,BjPalSrc); - ZetMapArea (0x9c00,0x9cff,1,BjPalSrc); - - ZetMapArea (0x9e00,0x9e00,0,BjRam+0x9e00); - ZetMapArea (0x9e00,0x9e00,1,BjRam+0x9e00); - - // ZetMapArea (0xb000,0xb000,0,BjRam+0xb000); - // ZetMapArea (0xb000,0xb000,1,BjRam+0xb000); - - // ZetMapArea (0xb800,0xb800,0,BjRam+0xb800); - // ZetMapArea (0xb800,0xb800,1,BjRam+0xb800); - - ZetSetReadHandler(BjMemRead); - ZetSetWriteHandler(BjMemWrite); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea (0x0000,0x1fff,0,SndRom); // Direct Read from ROM - ZetMapArea (0x0000,0x1fff,2,SndRom); // Direct Fetch from ROM - ZetMapArea (0x4000,0x43ff,0,SndRam); - ZetMapArea (0x4000,0x43ff,1,SndRam); - ZetMapArea (0x4000,0x43ff,2,SndRam); // fetch from ram? - ZetMapArea (0xff00,0xffff,0,SndRam); - ZetMapArea (0xff00,0xffff,1,SndRam); - ZetMapArea (0xff00,0xffff,2,SndRam); // more fetch from ram? What the hell . . - - // ZetMapArea (0x6000,0x6000,0,BjRam+0xb800); - // ZetMapArea (0x6000,0x6000,1,BjRam+0xb800); - ZetSetReadHandler(SndMemRead); - ZetSetOutHandler(SndPortWrite); - ZetMemEnd(); - ZetClose(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - pAY8910Buffer[6] = pFMBuffer + nBurnSoundLen * 6; - pAY8910Buffer[7] = pFMBuffer + nBurnSoundLen * 7; - pAY8910Buffer[8] = pFMBuffer + nBurnSoundLen * 8; - - AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(2, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.13, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.13, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(2, 0.13, BURN_SND_ROUTE_BOTH); - - // remember to do ZetReset() in main driver - - DrvDoReset(); - return 0; -} - - - -void DecodeTiles(UINT8 *TilePointer, INT32 num,INT32 off1,INT32 off2, INT32 off3) -{ - INT32 c,y,x,dat1,dat2,dat3,col; - for (c=0;c>=1; - dat2>>=1; - dat3>>=1; - } - } - } -} - - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - BjRom = Next; Next += 0x10000; - BjGfx = Next; Next += 0x0f000; - BjMap = Next; Next += 0x01000; - SndRom = Next; Next += 0x02000; - RamStart = Next; - BjRam = Next; Next += 0x10000; - SndRam = Next; Next += 0x01000; - BjPalSrc = Next; Next += 0x00100; - BjVidRam = Next; Next += 0x00400; - BjColRam = Next; Next += 0x00400; - BjSprRam = Next; Next += 0x00060; - RamEnd = Next; - text = Next; Next += 512 * 8 * 8; - sprites = Next; Next += 1024 * 8 * 8; - tiles = Next; Next += 1024 * 8 * 8; - pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 9 * sizeof(INT16); - BjPalReal = (UINT32*)Next; Next += 0x0080 * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - - -INT32 BjInit() -{ - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - for (INT32 i =0; i<5 ; i++) - { - BurnLoadRom(BjRom+(0x2000*i),i,1); // load code roms - } - - for (INT32 i=0;i<3;i++) - { - BurnLoadRom(BjGfx+(0x1000*i),i+5,1); - } - - BurnLoadRom(BjGfx+0x3000,8,1); - BurnLoadRom(BjGfx+0x5000,9,1); - BurnLoadRom(BjGfx+0x7000,10,1); - - BurnLoadRom(BjGfx+0x9000,11,1); - BurnLoadRom(BjGfx+0xB000,12,1); - BurnLoadRom(BjGfx+0xD000,13,1); - - BurnLoadRom(BjMap,14,1); // load Background tile maps - BurnLoadRom(SndRom,15,1); // load Sound CPU - - // Set memory access & Init - BjZInit(); - - DecodeTiles(text,512,0,0x1000,0x2000); - DecodeTiles(sprites,1024,0x7000,0x5000,0x3000); - DecodeTiles(tiles,1024,0x9000,0xB000,0xD000); - // done - - GenericTilesInit(); - - DrvDoReset(); - return 0; -} - -INT32 BjExit() -{ - ZetExit(); - - for (INT32 i = 0; i < 3; i++) { - AY8910Exit(i); - } - - GenericTilesExit(); - BurnFree(Mem); - return 0; -} - -static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour >> 0) & 0x0f; - g = (nColour >> 4) & 0x0f; - b = (nColour >> 8) & 0x0f; - - r = (r << 4) | r; - g = (g << 4) | g; - b = (b << 4) | b; - - return BurnHighCol(r, g, b, 0); -} - -INT32 CalcAll() -{ - for (INT32 i = 0; i < 0x100; i++) { - BjPalReal[i / 2] = CalcCol(BjPalSrc[i & ~1] | (BjPalSrc[i | 1] << 8)); - } - - return 0; -} - -void BjRenderFgLayer() -{ - for (INT32 tileCount = 0; tileCount < 1024 ;tileCount++) - { - INT32 code = BjVidRam[tileCount] + 16 * (BjColRam[tileCount] & 0x10); - INT32 color = BjColRam[tileCount] & 0x0f; - INT32 sy = (tileCount % 32); - INT32 sx = 31 - (tileCount / 32); - - sx<<=3; - sx-=16; - sy<<=3; - if (sx >= 0 && sx < 215 && sy >= 0 && sy < 246) - { - Render8x8Tile_Mask(pTransDraw, code,sx,sy,color, 3, 0, 0, text); - } - else - { - Render8x8Tile_Mask_Clip(pTransDraw, code,sx,sy,color, 3, 0, 0, text); - } - } -} - - -void BjRenderBgLayer() -{ - for (INT32 tileCount = 0; tileCount < 256;tileCount++) { - INT32 FlipX; - - INT32 BgSel=BjRam[0x9e00]; - - INT32 offs = (BgSel & 0x07) * 0x200 + tileCount; - INT32 Code = (BgSel & 0x10) ? BjMap[offs] : 0; - - INT32 attr = BjMap[offs + 0x100]; - INT32 Colour = attr & 0x0f; - //INT32 flags = (attr & 0x80) ? TILE_FLIPY : 0; - - - INT32 sy = (tileCount % 16); - INT32 sx = 15 - (tileCount / 16); - FlipX = attr & 0x80; - - /*if (SolomonFlipScreen) { - sx = 31 - sx; - sy = 31 - sy; - FlipX = !FlipX; - FlipY = !FlipY; - }*/ - - sx <<= 4; - sx -=16; - sy <<= 4; - Code <<= 2; - if (sx >= 0 && sx < 215 && sy >= 0 && sy < 246) { - - if (FlipX&0x80) - { - Render8x8Tile_Mask(pTransDraw, Code+0,sx+8,sy+0, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask(pTransDraw, Code+1,sx+8,sy+8, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask(pTransDraw, Code+2,sx+0,sy+0, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask(pTransDraw, Code+3,sx+0,sy+8, Colour, 3, 0, 0, tiles); - - } - else - { - Render8x8Tile_Mask(pTransDraw, Code+0,sx+8,sy+0, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask(pTransDraw, Code+1,sx+8,sy+8, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask(pTransDraw, Code+2,sx+0,sy+0, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask(pTransDraw, Code+3,sx+0,sy+8, Colour, 3, 0, 0, tiles); - } - - } else { - - if (FlipX&0x80) - { - Render8x8Tile_Mask_Clip(pTransDraw, Code+0,sx+8,sy+0, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask_Clip(pTransDraw, Code+1,sx+8,sy+8, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask_Clip(pTransDraw, Code+2,sx+0,sy+0, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask_Clip(pTransDraw, Code+3,sx+0,sy+8, Colour, 3, 0, 0, tiles); - - } - else - { - Render8x8Tile_Mask_Clip(pTransDraw, Code+0,sx+8,sy+0, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask_Clip(pTransDraw, Code+1,sx+8,sy+8, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask_Clip(pTransDraw, Code+2,sx+0,sy+0, Colour, 3, 0, 0, tiles); - Render8x8Tile_Mask_Clip(pTransDraw, Code+3,sx+0,sy+8, Colour, 3, 0, 0, tiles); - } - - } - } -} - - -static void BjDrawSprites() -{ - INT32 offs; - - for (offs = 0x60 - 4; offs >= 0; offs -= 4) - { - - /* - abbbbbbb cdefgggg hhhhhhhh iiiiiiii - - a use big sprites (32x32 instead of 16x16) - bbbbbbb sprite code - c x flip - d y flip (used only in death sequence?) - e ? (set when big sprites are selected) - f ? (set only when the bonus (B) materializes?) - gggg color - hhhhhhhh x position - iiiiiiii y position - */ - INT32 sx,sy,flipx,flipy, code, colour, big; - - - sy = BjSprRam[offs+3]; - if (BjSprRam[offs] & 0x80) - sx = BjSprRam[offs+2]; - else - sx = BjSprRam[offs+2]; - flipx = BjSprRam[offs+1] & 0x80; - flipy = BjSprRam[offs+1] & 0x40; - - code = BjSprRam[offs] & 0x7f; - colour = (BjSprRam[offs+1] & 0x0f); - big = (BjSprRam[offs] & 0x80); - - //sy -= 32; - - sx -=16; - if (!big) - { - code <<= 2; - if (sx >= 0 && sx < 215 && sy >= 0 && sy < 246) { - if (!flipy) { - if (!flipx) { - Render8x8Tile_Mask(pTransDraw, code + 0, sx + 8, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code + 1, sx + 8, sy + 8, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code + 2, sx + 0, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code + 3, sx + 0, sy + 8, colour, 3, 0, 0, sprites); - } else { - Render8x8Tile_Mask_FlipX(pTransDraw, code + 2, sx + 8, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipX(pTransDraw, code + 3, sx + 8, sy + 8, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipX(pTransDraw, code + 0, sx + 0, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipX(pTransDraw, code + 1, sx + 0, sy + 8, colour, 3, 0, 0, sprites); - } - } else { - if (!flipx) { - Render8x8Tile_Mask_FlipY(pTransDraw, code + 1, sx + 8, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipY(pTransDraw, code + 0, sx + 8, sy + 8, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipY(pTransDraw, code + 3, sx + 0, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipY(pTransDraw, code + 2, sx + 0, sy + 8, colour, 3, 0, 0, sprites); - } else { - Render8x8Tile_Mask_FlipXY(pTransDraw, code + 3, sx + 8, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipXY(pTransDraw, code + 2, sx + 8, sy + 8, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipXY(pTransDraw, code + 1, sx + 0, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipXY(pTransDraw, code + 0, sx + 0, sy + 8, colour, 3, 0, 0, sprites); - } - } - } else { - if (!flipy) { - if (!flipx) { - Render8x8Tile_Mask_Clip(pTransDraw, code + 0, sx + 8, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code + 1, sx + 8, sy + 8, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code + 2, sx + 0, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code + 3, sx + 0, sy + 8, colour, 3, 0, 0, sprites); - } else { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code + 2, sx + 8, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code + 3, sx + 8, sy + 8, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code + 0, sx + 0, sy + 0, colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code + 1, sx + 0, sy + 8, colour, 3, 0, 0, sprites); - } - } else { - if (!flipx) { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code + 1, sx + 0, sy + 0, colour, 4, 0, 0, sprites); - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code + 0, sx + 0, sy + 8, colour, 4, 0, 0, sprites); - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code + 3, sx + 8, sy + 0, colour, 4, 0, 0, sprites); - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code + 2, sx + 8, sy + 8, colour, 4, 0, 0, sprites); - } else { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code + 3, sx + 8, sy + 0, colour, 4, 0, 0, sprites); - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code + 2, sx + 8, sy + 8, colour, 4, 0, 0, sprites); - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code + 1, sx + 0, sy + 0, colour, 4, 0, 0, sprites); - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code + 0, sx + 0, sy + 8, colour, 4, 0, 0, sprites); - } - } - } - } - else - { - code&=31; - code <<= 4; - sx-=1; - if (sx >= 0 && sx < 215 && sy >= 0 && sy < 246) - { - if (!flipy) - { - if (!flipx) { - Render8x8Tile_Mask(pTransDraw, code+512,sx+8+16,sy,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+513,sx+8+16,sy+8,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+514,sx+16,sy,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+515,sx+16,sy+8,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+516,sx+8+16,sy+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+517,sx+8+16,sy+8+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+518,sx+16,sy+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+519,sx+16,sy+8+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+520,sx+8,sy,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+521,sx+8,sy+8,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+522,sx,sy,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+523,sx,sy+8,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+524,sx+8,sy+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+525,sx+8,sy+8+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+526,sx,sy+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask(pTransDraw, code+527,sx,sy+8+16,colour, 3, 0, 0, sprites); - } - } - } - else - { - if (!flipy) - { - if (!flipx) { - Render8x8Tile_Mask_Clip(pTransDraw, code+512,sx+8+16,sy,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+513,sx+8+16,sy+8,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+514,sx+16,sy,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+515,sx+16,sy+8,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+516,sx+8+16,sy+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+517,sx+8+16,sy+8+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+518,sx+16,sy+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+519,sx+16,sy+8+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+520,sx+8,sy,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+521,sx+8,sy+8,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+522,sx,sy,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+523,sx,sy+8,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+524,sx+8,sy+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+525,sx+8,sy+8+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+526,sx,sy+16,colour, 3, 0, 0, sprites); - Render8x8Tile_Mask_Clip(pTransDraw, code+527,sx,sy+8+16,colour, 3, 0, 0, sprites); - } - } - } - } - } -} - -INT32 BjFrame() -{ - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - - nCyclesTotal[0] = 4000000 / 60; - nCyclesTotal[1] = 3000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 1) - { - if(bombjackIRQ) - { - ZetNmi(); - } - } - ZetClose(); - - // Run Z80 #2 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - /*ZetOpen(0); - if (BjRam[0xb000]) - ZetNmi(); - ZetClose();*/ - - ZetOpen(1); - ZetNmi(); - ZetClose(); - - - if (pBurnDraw != NULL) - { - BurnTransferClear(); - CalcAll(); - - BjRenderBgLayer(); - BjRenderFgLayer(); - BjDrawSprites(); - BurnTransferCopy(BjPalReal); - } - return 0; -} - -static INT32 BjScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); // Scan Z80 - - // Scan critical driver variables - SCAN_VAR(bombjackIRQ); - SCAN_VAR(latch); - SCAN_VAR(DrvJoy1); - SCAN_VAR(DrvJoy2); - SCAN_VAR(BjDip); - } - - return 0; -} - -struct BurnDriver BurnDrvBombjack = { - "bombjack", NULL, NULL, NULL, "1984", - "Bomb Jack (set 1)\0", NULL, "Tehkan", "Bomb Jack", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING,2,HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, BombjackRomInfo,BombjackRomName, NULL, NULL,DrvInputInfo,BjDIPInfo, - BjInit,BjExit,BjFrame,NULL,BjScan, - NULL,0x80,224,256,3,4 -}; - -struct BurnDriver BurnDrvBombjac2 = { - "bombjack2", "bombjack", NULL, NULL, "1984", - "Bomb Jack (set 2)\0", NULL, "Tehkan", "Bomb Jack", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE,2,HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, Bombjac2RomInfo,Bombjac2RomName, NULL, NULL,DrvInputInfo,BjDIPInfo, - BjInit,BjExit,BjFrame,NULL,BjScan, - NULL,0x80,224,256,3,4 -}; +#include "tiles_generic.h" +#include "z80_intf.h" + +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +UINT8 DrvJoy1[7] = {0, 0, 0, 0, 0, 0, 0}; +UINT8 DrvJoy2[7] = {0, 0, 0, 0, 0, 0, 0}; +UINT8 BjDip[2] = {0, 0}; +static UINT8 DrvReset = 0; +static INT32 bombjackIRQ = 0; +static INT32 latch; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *BjGfx = NULL; +static UINT8 *BjMap = NULL; +static UINT8 *BjRom = NULL; +static UINT8 *BjRam = NULL; +static UINT8 *BjColRam = NULL; +static UINT8 *BjVidRam = NULL; +static UINT8 *BjSprRam = NULL; + +// sound cpu +static UINT8 *SndRom = NULL; +static UINT8 *SndRam = NULL; + +// graphics tiles +static UINT8 *text = NULL; +static UINT8 *sprites = NULL; +static UINT8 *tiles = NULL; + +// pallete +static UINT8 *BjPalSrc = NULL; +static UINT32 *BjPalReal = NULL; + +static INT16* pFMBuffer; +static INT16* pAY8910Buffer[9]; + +// Dip Switch and Input Definitions +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p1 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 4, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 5, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 1"}, + + {"P2 Coin" , BIT_DIGITAL , DrvJoy2 + 0, "p2 coin" }, + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 1, "p2 start" }, + + {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 4, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 5, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 1"}, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip Sw(1)" , BIT_DIPSWITCH, BjDip + 0 , "dip" }, + {"Dip Sw(2)" , BIT_DIPSWITCH, BjDip + 1 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo BjDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xc0, NULL}, + {0x10, 0xff, 0xff, 0x00, NULL}, + + // Dip Sw(1) + {0, 0xfe, 0, 4, "Coin A"}, + {0x0f, 0x01, 0x03, 0x00, "1 coin 1 credit"}, + {0x0f, 0x01, 0x03, 0x01, "1 coin 2 credits"}, + {0x0f, 0x01, 0x03, 0x02, "1 coin 3 credits"}, + {0x0f, 0x01, 0x03, 0x03, "1 coin 6 credits"}, + + {0, 0xfe, 0, 4, "Coin B"}, + {0x0f, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, + {0x0f, 0x01, 0x0c, 0x00, "1 coin 1 credit"}, + {0x0f, 0x01, 0x0c, 0x08, "1 coin 2 credits"}, + {0x0f, 0x01, 0x0c, 0x0c, "1 coin 3 credits"}, + + {0, 0xfe, 0, 4, "Lives"}, + {0x0f, 0x01, 0x30, 0x30, "2"}, + {0x0f, 0x01, 0x30, 0x00, "3"}, + {0x0f, 0x01, 0x30, 0x10, "4"}, + {0x0f, 0x01, 0x30, 0x20, "5"}, + + {0, 0xfe, 0, 2, "Cabinet"}, + {0x0f, 0x01, 0x40, 0x40, "Upright"}, + {0x0f, 0x01, 0x40, 0x00, "Cocktail"}, + + {0, 0xfe, 0, 2, "Demo sounds"}, + {0x0f, 0x01, 0x80, 0x00, "Off"}, + {0x0f, 0x01, 0x80, 0x80, "On"}, + + // Dip Sw(2) + {0, 0xfe, 0, 4, "Initial high score"}, + {0x10, 0x01, 0x07, 0x00, "10000"}, + {0x10, 0x01, 0x07, 0x01, "100000"}, + {0x10, 0x01, 0x07, 0x02, "30000"}, + {0x10, 0x01, 0x07, 0x03, "50000"}, + {0x10, 0x01, 0x07, 0x04, "100000"}, + {0x10, 0x01, 0x07, 0x05, "50000"}, + {0x10, 0x01, 0x07, 0x06, "100000"}, + {0x10, 0x01, 0x07, 0x07, "50000"}, + + {0, 0xfe, 0, 4, "Bird speed"}, + {0x10, 0x01, 0x18, 0x00, "Easy"}, + {0x10, 0x01, 0x18, 0x08, "Medium"}, + {0x10, 0x01, 0x18, 0x10, "Hard"}, + {0x10, 0x01, 0x18, 0x18, "Hardest"}, + + {0, 0xfe, 0, 4, "Enemies number & speed"}, + {0x10, 0x01, 0x60, 0x20, "Easy"}, + {0x10, 0x01, 0x60, 0x00, "Medium"}, + {0x10, 0x01, 0x60, 0x40, "Hard"}, + {0x10, 0x01, 0x60, 0x60, "Hardest"}, + + {0, 0xfe, 0, 2, "Special coin"}, + {0x10, 0x01, 0x80, 0x00, "Easy"}, + {0x10, 0x01, 0x80, 0x80, "Hard"}, +}; + +STDDIPINFO(Bj) + +// Bomb Jack (set 1) +static struct BurnRomInfo BombjackRomDesc[] = { + { "09_j01b.bin", 0x2000, 0xc668dc30, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "10_l01b.bin", 0x2000, 0x52a1e5fb, BRF_ESS | BRF_PRG }, // 1 + { "11_m01b.bin", 0x2000, 0xb68a062a, BRF_ESS | BRF_PRG }, // 2 + { "12_n01b.bin", 0x2000, 0x1d3ecee5, BRF_ESS | BRF_PRG }, // 3 + { "13.1r", 0x2000, 0x70e0244d, BRF_ESS | BRF_PRG }, // 4 + + // graphics 3 bit planes: + { "03_e08t.bin", 0x1000, 0x9f0470d5, BRF_GRA }, // chars + { "04_h08t.bin", 0x1000, 0x81ec12e6, BRF_GRA }, + { "05_k08t.bin", 0x1000, 0xe87ec8b1, BRF_GRA }, + + { "14_j07b.bin", 0x2000, 0x101c858d, BRF_GRA }, // sprites + { "15_l07b.bin", 0x2000, 0x013f58f2, BRF_GRA }, + { "16_m07b.bin", 0x2000, 0x94694097, BRF_GRA }, + + { "06_l08t.bin", 0x2000, 0x51eebd89, BRF_GRA }, // background tiles + { "07_n08t.bin", 0x2000, 0x9dd98e9d, BRF_GRA }, + { "08_r08t.bin", 0x2000, 0x3155ee7d, BRF_GRA }, + + { "02_p04t.bin", 0x1000, 0x398d4a02, BRF_GRA }, // background tilemaps + + { "01_h03t.bin", 0x2000, 0x8407917d, BRF_ESS | BRF_SND }, // sound CPU +}; + +STD_ROM_PICK(Bombjack) +STD_ROM_FN(Bombjack) + + +// Bomb Jack (set 2) +static struct BurnRomInfo Bombjac2RomDesc[] = { + { "09_j01b.bin", 0x2000, 0xc668dc30, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "10_l01b.bin", 0x2000, 0x52a1e5fb, BRF_ESS | BRF_PRG }, // 1 + { "11_m01b.bin", 0x2000, 0xb68a062a, BRF_ESS | BRF_PRG }, // 2 + { "12_n01b.bin", 0x2000, 0x1d3ecee5, BRF_ESS | BRF_PRG }, // 3 + { "13_r01b.bin", 0x2000, 0xbcafdd29, BRF_ESS | BRF_PRG }, // 4 + + // graphics 3 bit planes: + { "03_e08t.bin", 0x1000, 0x9f0470d5, BRF_GRA }, // chars + { "04_h08t.bin", 0x1000, 0x81ec12e6, BRF_GRA }, + { "05_k08t.bin", 0x1000, 0xe87ec8b1, BRF_GRA }, + + { "14_j07b.bin", 0x2000, 0x101c858d, BRF_GRA }, // sprites + { "15_l07b.bin", 0x2000, 0x013f58f2, BRF_GRA }, + { "16_m07b.bin", 0x2000, 0x94694097, BRF_GRA }, + + { "06_l08t.bin", 0x2000, 0x51eebd89, BRF_GRA }, // background tiles + { "07_n08t.bin", 0x2000, 0x9dd98e9d, BRF_GRA }, + { "08_r08t.bin", 0x2000, 0x3155ee7d, BRF_GRA }, + + { "02_p04t.bin", 0x1000, 0x398d4a02, BRF_GRA }, // background tilemaps + + { "01_h03t.bin", 0x2000, 0x8407917d, BRF_ESS | BRF_SND }, // sound CPU +}; + +STD_ROM_PICK(Bombjac2) +STD_ROM_FN(Bombjac2) + + +static INT32 DrvDoReset() +{ + bombjackIRQ = 0; + latch = 0; + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + for (INT32 i = 0; i < 3; i++) { + AY8910Reset(i); + } + return 0; +} + + +UINT8 __fastcall BjMemRead(UINT16 addr) +{ + UINT8 inputs=0; + + if (addr >= 0x9820 && addr <= 0x987f) return BjSprRam[addr - 0x9820]; + + if (addr==0xb000) { + if (DrvJoy1[5]) + inputs|=0x01; + if (DrvJoy1[4]) + inputs|=0x02; + if (DrvJoy1[2]) + inputs|=0x04; + if (DrvJoy1[3]) + inputs|=0x08; + if (DrvJoy1[6]) + inputs|=0x10; + return inputs; + } + if (addr==0xb001) { + if (DrvJoy2[5]) + inputs|=0x01; + if (DrvJoy2[4]) + inputs|=0x02; + if (DrvJoy2[2]) + inputs|=0x04; + if (DrvJoy2[3]) + inputs|=0x08; + if (DrvJoy2[6]) + inputs|=0x10; + return inputs; + } + if (addr==0xb002) { + if (DrvJoy1[0]) + inputs|=0x01; + if (DrvJoy1[1]) + inputs|=0x04; + if (DrvJoy2[0]) + inputs|=0x02; + if (DrvJoy2[1]) + inputs|=0x08; + return inputs; + } + if (addr==0xb004) { + return BjDip[0]; // Dip Sw(1) + } + if (addr==0xb005) { + return BjDip[1]; // Dip Sw(2) + } + return 0; +} + +void __fastcall BjMemWrite(UINT16 addr,UINT8 val) +{ + if (addr >= 0x9820 && addr <= 0x987f) { BjSprRam[addr - 0x9820] = val; return; } + + if (addr==0xb000) + { + bombjackIRQ = val; + } + if(addr==0xb800) + { + latch=val; + return; + } + BjRam[addr]=val; +} + +UINT8 __fastcall SndMemRead(UINT16 a) +{ + if (a==0xFF00) + { + return 0x7f; + } + if(a==0x6000) + { + INT32 res; + res = latch; + latch = 0; + return res; + } + return 0; +} + + + +void __fastcall SndPortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + switch (a) { + case 0x00: { + AY8910Write(0, 0, d); + return; + } + case 0x01: { + AY8910Write(0, 1, d); + return; + } + case 0x10: { + AY8910Write(1, 0, d); + return; + } + case 0x11: { + AY8910Write(1, 1, d); + return; + } + case 0x80: { + AY8910Write(2, 0, d); + return; + } + case 0x81: { + AY8910Write(2, 1, d); + return; + } + } +} + +INT32 BjZInit() +{ + // Init the z80 + ZetInit(0); + // Main CPU setup + ZetOpen(0); + + ZetMapArea (0x0000,0x7fff,0,BjRom+0x0000); // Direct Read from ROM + ZetMapArea (0x0000,0x7fff,2,BjRom+0x0000); // Direct Fetch from ROM + ZetMapArea (0xc000,0xdfff,0,BjRom+0x8000); // Direct Read from ROM + ZetMapArea (0xc000,0xdfff,2,BjRom+0x8000); // Direct Fetch from ROM + + ZetMapArea (0x8000,0x8fff,0,BjRam+0x8000); + ZetMapArea (0x8000,0x8fff,1,BjRam+0x8000); + + ZetMapArea (0x9000,0x93ff,0,BjVidRam); + ZetMapArea (0x9000,0x93ff,1,BjVidRam); + + ZetMapArea (0x9400,0x97ff,0,BjColRam); + ZetMapArea (0x9400,0x97ff,1,BjColRam); + +// ZetMapArea (0x9820,0x987f,0,BjSprRam); +// ZetMapArea (0x9820,0x987f,1,BjSprRam); + + ZetMapArea (0x9c00,0x9cff,0,BjPalSrc); + ZetMapArea (0x9c00,0x9cff,1,BjPalSrc); + + ZetMapArea (0x9e00,0x9e00,0,BjRam+0x9e00); + ZetMapArea (0x9e00,0x9e00,1,BjRam+0x9e00); + + // ZetMapArea (0xb000,0xb000,0,BjRam+0xb000); + // ZetMapArea (0xb000,0xb000,1,BjRam+0xb000); + + // ZetMapArea (0xb800,0xb800,0,BjRam+0xb800); + // ZetMapArea (0xb800,0xb800,1,BjRam+0xb800); + + ZetSetReadHandler(BjMemRead); + ZetSetWriteHandler(BjMemWrite); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea (0x0000,0x1fff,0,SndRom); // Direct Read from ROM + ZetMapArea (0x0000,0x1fff,2,SndRom); // Direct Fetch from ROM + ZetMapArea (0x4000,0x43ff,0,SndRam); + ZetMapArea (0x4000,0x43ff,1,SndRam); + ZetMapArea (0x4000,0x43ff,2,SndRam); // fetch from ram? + ZetMapArea (0xff00,0xffff,0,SndRam); + ZetMapArea (0xff00,0xffff,1,SndRam); + ZetMapArea (0xff00,0xffff,2,SndRam); // more fetch from ram? What the hell . . + + // ZetMapArea (0x6000,0x6000,0,BjRam+0xb800); + // ZetMapArea (0x6000,0x6000,1,BjRam+0xb800); + ZetSetReadHandler(SndMemRead); + ZetSetOutHandler(SndPortWrite); + ZetClose(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + pAY8910Buffer[6] = pFMBuffer + nBurnSoundLen * 6; + pAY8910Buffer[7] = pFMBuffer + nBurnSoundLen * 7; + pAY8910Buffer[8] = pFMBuffer + nBurnSoundLen * 8; + + AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(2, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.13, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.13, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(2, 0.13, BURN_SND_ROUTE_BOTH); + + // remember to do ZetReset() in main driver + + DrvDoReset(); + return 0; +} + + + +void DecodeTiles(UINT8 *TilePointer, INT32 num,INT32 off1,INT32 off2, INT32 off3) +{ + INT32 c,y,x,dat1,dat2,dat3,col; + for (c=0;c>=1; + dat2>>=1; + dat3>>=1; + } + } + } +} + + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + BjRom = Next; Next += 0x10000; + BjGfx = Next; Next += 0x0f000; + BjMap = Next; Next += 0x01000; + SndRom = Next; Next += 0x02000; + RamStart = Next; + BjRam = Next; Next += 0x10000; + SndRam = Next; Next += 0x01000; + BjPalSrc = Next; Next += 0x00100; + BjVidRam = Next; Next += 0x00400; + BjColRam = Next; Next += 0x00400; + BjSprRam = Next; Next += 0x00060; + RamEnd = Next; + text = Next; Next += 512 * 8 * 8; + sprites = Next; Next += 1024 * 8 * 8; + tiles = Next; Next += 1024 * 8 * 8; + pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 9 * sizeof(INT16); + BjPalReal = (UINT32*)Next; Next += 0x0080 * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + + +INT32 BjInit() +{ + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + for (INT32 i =0; i<5 ; i++) + { + BurnLoadRom(BjRom+(0x2000*i),i,1); // load code roms + } + + for (INT32 i=0;i<3;i++) + { + BurnLoadRom(BjGfx+(0x1000*i),i+5,1); + } + + BurnLoadRom(BjGfx+0x3000,8,1); + BurnLoadRom(BjGfx+0x5000,9,1); + BurnLoadRom(BjGfx+0x7000,10,1); + + BurnLoadRom(BjGfx+0x9000,11,1); + BurnLoadRom(BjGfx+0xB000,12,1); + BurnLoadRom(BjGfx+0xD000,13,1); + + BurnLoadRom(BjMap,14,1); // load Background tile maps + BurnLoadRom(SndRom,15,1); // load Sound CPU + + // Set memory access & Init + BjZInit(); + + DecodeTiles(text,512,0,0x1000,0x2000); + DecodeTiles(sprites,1024,0x7000,0x5000,0x3000); + DecodeTiles(tiles,1024,0x9000,0xB000,0xD000); + // done + + GenericTilesInit(); + + DrvDoReset(); + return 0; +} + +INT32 BjExit() +{ + ZetExit(); + + for (INT32 i = 0; i < 3; i++) { + AY8910Exit(i); + } + + GenericTilesExit(); + BurnFree(Mem); + return 0; +} + +static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour >> 0) & 0x0f; + g = (nColour >> 4) & 0x0f; + b = (nColour >> 8) & 0x0f; + + r = (r << 4) | r; + g = (g << 4) | g; + b = (b << 4) | b; + + return BurnHighCol(r, g, b, 0); +} + +INT32 CalcAll() +{ + for (INT32 i = 0; i < 0x100; i++) { + BjPalReal[i / 2] = CalcCol(BjPalSrc[i & ~1] | (BjPalSrc[i | 1] << 8)); + } + + return 0; +} + +void BjRenderFgLayer() +{ + for (INT32 tileCount = 0; tileCount < 1024 ;tileCount++) + { + INT32 code = BjVidRam[tileCount] + 16 * (BjColRam[tileCount] & 0x10); + INT32 color = BjColRam[tileCount] & 0x0f; + INT32 sy = (tileCount % 32); + INT32 sx = 31 - (tileCount / 32); + + sx<<=3; + sx-=16; + sy<<=3; + if (sx >= 0 && sx < 215 && sy >= 0 && sy < 246) + { + Render8x8Tile_Mask(pTransDraw, code,sx,sy,color, 3, 0, 0, text); + } + else + { + Render8x8Tile_Mask_Clip(pTransDraw, code,sx,sy,color, 3, 0, 0, text); + } + } +} + + +void BjRenderBgLayer() +{ + for (INT32 tileCount = 0; tileCount < 256;tileCount++) { + INT32 FlipX; + + INT32 BgSel=BjRam[0x9e00]; + + INT32 offs = (BgSel & 0x07) * 0x200 + tileCount; + INT32 Code = (BgSel & 0x10) ? BjMap[offs] : 0; + + INT32 attr = BjMap[offs + 0x100]; + INT32 Colour = attr & 0x0f; + //INT32 flags = (attr & 0x80) ? TILE_FLIPY : 0; + + + INT32 sy = (tileCount % 16); + INT32 sx = 15 - (tileCount / 16); + FlipX = attr & 0x80; + + /*if (SolomonFlipScreen) { + sx = 31 - sx; + sy = 31 - sy; + FlipX = !FlipX; + FlipY = !FlipY; + }*/ + + sx <<= 4; + sx -=16; + sy <<= 4; + Code <<= 2; + if (sx >= 0 && sx < 215 && sy >= 0 && sy < 246) { + + if (FlipX&0x80) + { + Render8x8Tile_Mask(pTransDraw, Code+0,sx+8,sy+0, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask(pTransDraw, Code+1,sx+8,sy+8, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask(pTransDraw, Code+2,sx+0,sy+0, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask(pTransDraw, Code+3,sx+0,sy+8, Colour, 3, 0, 0, tiles); + + } + else + { + Render8x8Tile_Mask(pTransDraw, Code+0,sx+8,sy+0, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask(pTransDraw, Code+1,sx+8,sy+8, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask(pTransDraw, Code+2,sx+0,sy+0, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask(pTransDraw, Code+3,sx+0,sy+8, Colour, 3, 0, 0, tiles); + } + + } else { + + if (FlipX&0x80) + { + Render8x8Tile_Mask_Clip(pTransDraw, Code+0,sx+8,sy+0, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask_Clip(pTransDraw, Code+1,sx+8,sy+8, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask_Clip(pTransDraw, Code+2,sx+0,sy+0, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask_Clip(pTransDraw, Code+3,sx+0,sy+8, Colour, 3, 0, 0, tiles); + + } + else + { + Render8x8Tile_Mask_Clip(pTransDraw, Code+0,sx+8,sy+0, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask_Clip(pTransDraw, Code+1,sx+8,sy+8, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask_Clip(pTransDraw, Code+2,sx+0,sy+0, Colour, 3, 0, 0, tiles); + Render8x8Tile_Mask_Clip(pTransDraw, Code+3,sx+0,sy+8, Colour, 3, 0, 0, tiles); + } + + } + } +} + + +static void BjDrawSprites() +{ + INT32 offs; + + for (offs = 0x60 - 4; offs >= 0; offs -= 4) + { + + /* + abbbbbbb cdefgggg hhhhhhhh iiiiiiii + + a use big sprites (32x32 instead of 16x16) + bbbbbbb sprite code + c x flip + d y flip (used only in death sequence?) + e ? (set when big sprites are selected) + f ? (set only when the bonus (B) materializes?) + gggg color + hhhhhhhh x position + iiiiiiii y position + */ + INT32 sx,sy,flipx,flipy, code, colour, big; + + + sy = BjSprRam[offs+3]; + if (BjSprRam[offs] & 0x80) + sx = BjSprRam[offs+2]; + else + sx = BjSprRam[offs+2]; + flipx = BjSprRam[offs+1] & 0x80; + flipy = BjSprRam[offs+1] & 0x40; + + code = BjSprRam[offs] & 0x7f; + colour = (BjSprRam[offs+1] & 0x0f); + big = (BjSprRam[offs] & 0x80); + + //sy -= 32; + + sx -=16; + if (!big) + { + code <<= 2; + if (sx >= 0 && sx < 215 && sy >= 0 && sy < 246) { + if (!flipy) { + if (!flipx) { + Render8x8Tile_Mask(pTransDraw, code + 0, sx + 8, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code + 1, sx + 8, sy + 8, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code + 2, sx + 0, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code + 3, sx + 0, sy + 8, colour, 3, 0, 0, sprites); + } else { + Render8x8Tile_Mask_FlipX(pTransDraw, code + 2, sx + 8, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipX(pTransDraw, code + 3, sx + 8, sy + 8, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipX(pTransDraw, code + 0, sx + 0, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipX(pTransDraw, code + 1, sx + 0, sy + 8, colour, 3, 0, 0, sprites); + } + } else { + if (!flipx) { + Render8x8Tile_Mask_FlipY(pTransDraw, code + 1, sx + 8, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipY(pTransDraw, code + 0, sx + 8, sy + 8, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipY(pTransDraw, code + 3, sx + 0, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipY(pTransDraw, code + 2, sx + 0, sy + 8, colour, 3, 0, 0, sprites); + } else { + Render8x8Tile_Mask_FlipXY(pTransDraw, code + 3, sx + 8, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipXY(pTransDraw, code + 2, sx + 8, sy + 8, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipXY(pTransDraw, code + 1, sx + 0, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipXY(pTransDraw, code + 0, sx + 0, sy + 8, colour, 3, 0, 0, sprites); + } + } + } else { + if (!flipy) { + if (!flipx) { + Render8x8Tile_Mask_Clip(pTransDraw, code + 0, sx + 8, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code + 1, sx + 8, sy + 8, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code + 2, sx + 0, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code + 3, sx + 0, sy + 8, colour, 3, 0, 0, sprites); + } else { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code + 2, sx + 8, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code + 3, sx + 8, sy + 8, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code + 0, sx + 0, sy + 0, colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code + 1, sx + 0, sy + 8, colour, 3, 0, 0, sprites); + } + } else { + if (!flipx) { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code + 1, sx + 0, sy + 0, colour, 4, 0, 0, sprites); + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code + 0, sx + 0, sy + 8, colour, 4, 0, 0, sprites); + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code + 3, sx + 8, sy + 0, colour, 4, 0, 0, sprites); + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code + 2, sx + 8, sy + 8, colour, 4, 0, 0, sprites); + } else { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code + 3, sx + 8, sy + 0, colour, 4, 0, 0, sprites); + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code + 2, sx + 8, sy + 8, colour, 4, 0, 0, sprites); + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code + 1, sx + 0, sy + 0, colour, 4, 0, 0, sprites); + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code + 0, sx + 0, sy + 8, colour, 4, 0, 0, sprites); + } + } + } + } + else + { + code&=31; + code <<= 4; + sx-=1; + if (sx >= 0 && sx < 215 && sy >= 0 && sy < 246) + { + if (!flipy) + { + if (!flipx) { + Render8x8Tile_Mask(pTransDraw, code+512,sx+8+16,sy,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+513,sx+8+16,sy+8,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+514,sx+16,sy,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+515,sx+16,sy+8,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+516,sx+8+16,sy+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+517,sx+8+16,sy+8+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+518,sx+16,sy+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+519,sx+16,sy+8+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+520,sx+8,sy,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+521,sx+8,sy+8,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+522,sx,sy,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+523,sx,sy+8,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+524,sx+8,sy+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+525,sx+8,sy+8+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+526,sx,sy+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask(pTransDraw, code+527,sx,sy+8+16,colour, 3, 0, 0, sprites); + } + } + } + else + { + if (!flipy) + { + if (!flipx) { + Render8x8Tile_Mask_Clip(pTransDraw, code+512,sx+8+16,sy,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+513,sx+8+16,sy+8,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+514,sx+16,sy,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+515,sx+16,sy+8,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+516,sx+8+16,sy+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+517,sx+8+16,sy+8+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+518,sx+16,sy+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+519,sx+16,sy+8+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+520,sx+8,sy,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+521,sx+8,sy+8,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+522,sx,sy,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+523,sx,sy+8,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+524,sx+8,sy+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+525,sx+8,sy+8+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+526,sx,sy+16,colour, 3, 0, 0, sprites); + Render8x8Tile_Mask_Clip(pTransDraw, code+527,sx,sy+8+16,colour, 3, 0, 0, sprites); + } + } + } + } + } +} + +INT32 BjFrame() +{ + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + + nCyclesTotal[0] = 4000000 / 60; + nCyclesTotal[1] = 3000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 1) + { + if(bombjackIRQ) + { + ZetNmi(); + } + } + ZetClose(); + + // Run Z80 #2 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + /*ZetOpen(0); + if (BjRam[0xb000]) + ZetNmi(); + ZetClose();*/ + + ZetOpen(1); + ZetNmi(); + ZetClose(); + + + if (pBurnDraw != NULL) + { + BurnTransferClear(); + CalcAll(); + + BjRenderBgLayer(); + BjRenderFgLayer(); + BjDrawSprites(); + BurnTransferCopy(BjPalReal); + } + return 0; +} + +static INT32 BjScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); // Scan Z80 + + // Scan critical driver variables + SCAN_VAR(bombjackIRQ); + SCAN_VAR(latch); + SCAN_VAR(DrvJoy1); + SCAN_VAR(DrvJoy2); + SCAN_VAR(BjDip); + } + + return 0; +} + +struct BurnDriver BurnDrvBombjack = { + "bombjack", NULL, NULL, NULL, "1984", + "Bomb Jack (set 1)\0", NULL, "Tehkan", "Bomb Jack", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING,2,HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, BombjackRomInfo,BombjackRomName, NULL, NULL,DrvInputInfo,BjDIPInfo, + BjInit,BjExit,BjFrame,NULL,BjScan, + NULL,0x80,224,256,3,4 +}; + +struct BurnDriver BurnDrvBombjac2 = { + "bombjack2", "bombjack", NULL, NULL, "1984", + "Bomb Jack (set 2)\0", NULL, "Tehkan", "Bomb Jack", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE,2,HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, Bombjac2RomInfo,Bombjac2RomName, NULL, NULL,DrvInputInfo,BjDIPInfo, + BjInit,BjExit,BjFrame,NULL,BjScan, + NULL,0x80,224,256,3,4 +}; diff --git a/src/burn/drv/pre90s/d_commando.cpp b/src/burn/drv/pre90s/d_commando.cpp index 9ddc44269..da63077fa 100644 --- a/src/burn/drv/pre90s/d_commando.cpp +++ b/src/burn/drv/pre90s/d_commando.cpp @@ -1,1102 +1,1100 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2203.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[2] = {0, 0}; -static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *DrvZ80Rom1 = NULL; -static UINT8 *DrvZ80Rom1Op = NULL; -static UINT8 *DrvZ80Rom2 = NULL; -static UINT8 *DrvZ80Ram1 = NULL; -static UINT8 *DrvZ80Ram2 = NULL; -static UINT8 *DrvFgVideoRam = NULL; -static UINT8 *DrvFgColourRam = NULL; -static UINT8 *DrvBgVideoRam = NULL; -static UINT8 *DrvBgColourRam = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvSpriteRamBuffer = NULL; -static UINT8 *DrvPromRed = NULL; -static UINT8 *DrvPromGreen = NULL; -static UINT8 *DrvPromBlue = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT8 DrvBgScrollX[2]; -static UINT8 DrvBgScrollY[2]; -static UINT8 DrvFlipScreen; -static UINT8 DrvSoundLatch; - -static bool bFirstOpCodeEncrypted = false; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 7, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, - {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - - -STDINPUTINFO(Drv) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - } - - // Clear Opposites - DrvClearOpposites(&DrvInput[1]); - DrvClearOpposites(&DrvInput[2]); -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x1f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Starting Area" }, - {0x11, 0x01, 0x03, 0x03, "0 (Forest 1)" }, - {0x11, 0x01, 0x03, 0x01, "2 (Forest 1)" }, - {0x11, 0x01, 0x03, 0x02, "4 (Forest 2)" }, - {0x11, 0x01, 0x03, 0x00, "6 (Forest 2)" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x0c, 0x04, "2" }, - {0x11, 0x01, 0x0c, 0x0c, "3" }, - {0x11, 0x01, 0x0c, 0x08, "4" }, - {0x11, 0x01, 0x0c, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0xc0, 0x00, "2 Coins 1 Play" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, - {0x11, 0x01, 0xc0, 0x40, "1 Coin 2 Plays" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 3 Plays" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0x30, 0x00, "4 Coins 1 Play" }, - {0x11, 0x01, 0x30, 0x20, "3 Coins 1 Play" }, - {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Play" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x12, 0x01, 0x07, 0x07, "10k 50k+" }, - {0x12, 0x01, 0x07, 0x03, "10k 60k+" }, - {0x12, 0x01, 0x07, 0x05, "20k 60k+" }, - {0x12, 0x01, 0x07, 0x01, "20k 70k+" }, - {0x12, 0x01, 0x07, 0x06, "30k 70k+" }, - {0x12, 0x01, 0x07, 0x02, "30k 80k+" }, - {0x12, 0x01, 0x07, 0x04, "40k 100k+" }, - {0x12, 0x01, 0x07, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x08, 0x00, "Off" }, - {0x12, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x12, 0x01, 0x10, 0x10, "Normal" }, - {0x12, 0x01, 0x10, 0x00, "Difficult" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x12, 0x01, 0x20, 0x00, "Off" }, - {0x12, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 3 , "Cabinet" }, - {0x12, 0x01, 0xc0, 0x00, "Upright" }, - {0x12, 0x01, 0xc0, 0x40, "Upright 2 Players" }, - {0x12, 0x01, 0xc0, 0xc0, "Cocktail" }, -}; - -STDDIPINFO(Drv) - -static struct BurnRomInfo DrvRomDesc[] = { - { "cm04.9m", 0x08000, 0x8438b694, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "cm03.8m", 0x04000, 0x35486542, BRF_ESS | BRF_PRG }, // 1 - - { "cm02.9f", 0x04000, 0xf9cc4a74, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "vt01.5d", 0x04000, 0x505726e0, BRF_GRA }, // 3 Characters - - { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles - { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 - { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 - { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 - { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 - { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 - - { "vt05.7e", 0x04000, 0x79f16e3d, BRF_GRA }, // 10 Sprites - { "vt06.8e", 0x04000, 0x26fee521, BRF_GRA }, // 11 - { "vt07.9e", 0x04000, 0xca88bdfd, BRF_GRA }, // 12 - { "vt08.7h", 0x04000, 0x2019c883, BRF_GRA }, // 13 - { "vt09.8h", 0x04000, 0x98703982, BRF_GRA }, // 14 - { "vt10.9h", 0x04000, 0xf069d2f8, BRF_GRA }, // 15 - - { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs - { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 - { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 - { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 - { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 - { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo DrvuRomDesc[] = { - { "u4-f.9m", 0x08000, 0xa6118935, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "u3-f.8m", 0x04000, 0x24f49684, BRF_ESS | BRF_PRG }, // 1 - - { "cm02.9f", 0x04000, 0xf9cc4a74, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "vt01.5d", 0x04000, 0x505726e0, BRF_GRA }, // 3 Characters - - { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles - { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 - { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 - { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 - { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 - { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 - - { "vt05.7e", 0x04000, 0x79f16e3d, BRF_GRA }, // 10 Sprites - { "vt06.8e", 0x04000, 0x26fee521, BRF_GRA }, // 11 - { "vt07.9e", 0x04000, 0xca88bdfd, BRF_GRA }, // 12 - { "vt08.7h", 0x04000, 0x2019c883, BRF_GRA }, // 13 - { "vt09.8h", 0x04000, 0x98703982, BRF_GRA }, // 14 - { "vt10.9h", 0x04000, 0xf069d2f8, BRF_GRA }, // 15 - - { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs - { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 - { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 - { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 - { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 - { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 -}; - -STD_ROM_PICK(Drvu) -STD_ROM_FN(Drvu) - -static struct BurnRomInfo DrvjRomDesc[] = { - { "so04.9m", 0x08000, 0xd3f2bfb3, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "so03.8m", 0x04000, 0xed01f472, BRF_ESS | BRF_PRG }, // 1 - - { "so02.9f", 0x04000, 0xca20aca5, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "vt01.5d", 0x04000, 0x505726e0, BRF_GRA }, // 3 Characters - - { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles - { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 - { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 - { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 - { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 - { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 - - { "vt05.7e", 0x04000, 0x79f16e3d, BRF_GRA }, // 10 Sprites - { "vt06.8e", 0x04000, 0x26fee521, BRF_GRA }, // 11 - { "vt07.9e", 0x04000, 0xca88bdfd, BRF_GRA }, // 12 - { "vt08.7h", 0x04000, 0x2019c883, BRF_GRA }, // 13 - { "vt09.8h", 0x04000, 0x98703982, BRF_GRA }, // 14 - { "vt10.9h", 0x04000, 0xf069d2f8, BRF_GRA }, // 15 - - { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs - { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 - { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 - { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 - { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 - { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 -}; - -STD_ROM_PICK(Drvj) -STD_ROM_FN(Drvj) - -static struct BurnRomInfo DrvbRomDesc[] = { - { "commandob_04_9m_27256.bin", 0x08000, 0x348a7654, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "cm03.8m", 0x04000, 0x35486542, BRF_ESS | BRF_PRG }, // 1 - - { "cm02.9f", 0x04000, 0xf9cc4a74, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "vt01.5d", 0x04000, 0x505726e0, BRF_GRA }, // 3 Characters - - { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles - { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 - { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 - { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 - { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 - { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 - - { "vt05.7e", 0x04000, 0x79f16e3d, BRF_GRA }, // 10 Sprites - { "vt06.8e", 0x04000, 0x26fee521, BRF_GRA }, // 11 - { "vt07.9e", 0x04000, 0xca88bdfd, BRF_GRA }, // 12 - { "vt08.7h", 0x04000, 0x2019c883, BRF_GRA }, // 13 - { "vt09.8h", 0x04000, 0x98703982, BRF_GRA }, // 14 - { "vt10.9h", 0x04000, 0xf069d2f8, BRF_GRA }, // 15 - - { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs - { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 - { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 - { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 - { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 - { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 - - { "commandob_pal16l8a.bin", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, // 22 PLDs -}; - -STD_ROM_PICK(Drvb) -STD_ROM_FN(Drvb) - -static struct BurnRomInfo SinvasnRomDesc[] = { - { "sp04.9m", 0x08000, 0x33f9601e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "sp03.8m", 0x04000, 0xc7fb43b3, BRF_ESS | BRF_PRG }, // 1 - - { "u2.9f", 0x04000, 0xcbf8c40e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "u1.5d", 0x04000, 0xf477e13a, BRF_GRA }, // 3 Characters - - { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles - { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 - { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 - { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 - { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 - { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 - - { "u5.e7", 0x04000, 0x2a97c933, BRF_GRA }, // 10 Sprites - { "sp06.e8", 0x04000, 0xd7887212, BRF_GRA }, // 11 - { "sp07.e9", 0x04000, 0x9abe7a20, BRF_GRA }, // 12 - { "u8.h7", 0x04000, 0xd6b4aa2e, BRF_GRA }, // 13 - { "sp09.h8", 0x04000, 0x3985b318, BRF_GRA }, // 14 - { "sp10.h9", 0x04000, 0x3c131b0f, BRF_GRA }, // 15 - - { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs - { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 - { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 - { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 - { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 - { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 -}; - -STD_ROM_PICK(Sinvasn) -STD_ROM_FN(Sinvasn) - -static struct BurnRomInfo SinvasnbRomDesc[] = { - { "u4", 0x08000, 0x834ba0de, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "u3", 0x04000, 0x07e4ee3a, BRF_ESS | BRF_PRG }, // 1 - - { "u2", 0x04000, 0xcbf8c40e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "u1", 0x04000, 0xf477e13a, BRF_GRA }, // 3 Characters - - { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles - { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 - { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 - { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 - { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 - { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 - - { "u5", 0x04000, 0x2a97c933, BRF_GRA }, // 10 Sprites - { "vt06.e8", 0x04000, 0x26fee521, BRF_GRA }, // 11 - { "vt07.e9", 0x04000, 0xca88bdfd, BRF_GRA }, // 12 - { "u8", 0x04000, 0xd6b4aa2e, BRF_GRA }, // 13 - { "vt09.h8", 0x04000, 0x98703982, BRF_GRA }, // 14 - { "vt10.h9", 0x04000, 0xf069d2f8, BRF_GRA }, // 15 - - { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs - { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 - { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 - { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 - { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 - { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 -}; - -STD_ROM_PICK(Sinvasnb) -STD_ROM_FN(Sinvasnb) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom1 = Next; Next += 0x0c000; - DrvZ80Rom1Op = Next; Next += 0x0c000; - DrvZ80Rom2 = Next; Next += 0x04000; - DrvPromRed = Next; Next += 0x00100; - DrvPromGreen = Next; Next += 0x00100; - DrvPromBlue = Next; Next += 0x00100; - - RamStart = Next; - - DrvZ80Ram1 = Next; Next += 0x01e00; - DrvZ80Ram2 = Next; Next += 0x00800; - DrvSpriteRam = Next; Next += 0x00180; - DrvSpriteRamBuffer = Next; Next += 0x00180; - DrvBgVideoRam = Next; Next += 0x00400; - DrvBgColourRam = Next; Next += 0x00400; - DrvFgVideoRam = Next; Next += 0x00400; - DrvFgColourRam = Next; Next += 0x00400; - - RamEnd = Next; - - DrvChars = Next; Next += 0x400 * 8 * 8; - DrvTiles = Next; Next += 0x400 * 16 * 16; - DrvSprites = Next; Next += 0x300 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00100 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - BurnYM2203Reset(); - - DrvBgScrollX[0] = DrvBgScrollX[1] = 0; - DrvBgScrollY[0] = DrvBgScrollY[1] = 0; - DrvFlipScreen = 0; - DrvSoundLatch = 0; - - return 0; -} - -UINT8 __fastcall CommandoRead1(UINT16 a) -{ - switch (a) { - case 0xc000: { - return 0xff - DrvInput[0]; - } - - case 0xc001: { - return 0xff - DrvInput[1]; - } - - case 0xc002: { - return 0xff - DrvInput[2]; - } - - case 0xc003: { - return DrvDip[0]; - } - - case 0xc004: { - return DrvDip[1]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall CommandoWrite1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xc800: { - DrvSoundLatch = d; - return; - } - - case 0xc804: { - DrvFlipScreen = d & 0x80; - - if (d & 0x10) { - ZetClose(); - ZetOpen(1); - ZetReset(); - ZetClose(); - ZetOpen(0); - } - - return; - } - - case 0xc806: { - // ??? - return; - } - - case 0xc808: { - DrvBgScrollX[0] = d; - return; - } - - case 0xc809: { - DrvBgScrollX[1] = d; - return; - } - - case 0xc80a: { - DrvBgScrollY[0] = d; - return; - } - - case 0xc80b: { - DrvBgScrollY[1] = d; - return; - } - - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall CommandoRead2(UINT16 a) -{ - switch (a) { - case 0x6000: { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall CommandoWrite2(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x8000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0x8001: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0x8002: { - BurnYM2203Write(1, 0, d); - return; - } - - case 0x8003: { - BurnYM2203Write(1, 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); - } - } -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3000000; -} - -static INT32 CharPlaneOffsets[2] = { 4, 0 }; -static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; -static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; -static INT32 TilePlaneOffsets[3] = { 0, 0x40000, 0x80000 }; -static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; -static INT32 SpritePlaneOffsets[4] = { 0x60004, 0x60000, 4, 0 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; -static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; - -static INT32 DrvInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x08000, 1, 1); if (nRet != 0) return 1; - - if (bFirstOpCodeEncrypted) { - for (INT32 A = 0; A < 0xc000; A++) { - INT32 src; - - src = DrvZ80Rom1[A]; - DrvZ80Rom1Op[A] = (src & 0x11) | ((src & 0xe0) >> 4) | ((src & 0x0e) << 4); - } - } else { - DrvZ80Rom1Op[0] = DrvZ80Rom1[0]; - for (INT32 A = 1; A < 0xc000; A++) { - INT32 src; - - src = DrvZ80Rom1[A]; - DrvZ80Rom1Op[A] = (src & 0x11) | ((src & 0xe0) >> 4) | ((src & 0x0e) << 4); - } - } - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 3, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x18000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x14000, 9, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 3, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x18000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x14000, 15, 1); if (nRet != 0) return 1; - GfxDecode(0x300, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load the PROMs - nRet = BurnLoadRom(DrvPromRed, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromGreen, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromBlue, 18, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(CommandoRead1); - ZetSetWriteHandler(CommandoWrite1); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom1 ); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom1Op, DrvZ80Rom1 ); - ZetMapArea(0xd000, 0xd3ff, 0, DrvFgVideoRam ); - ZetMapArea(0xd000, 0xd3ff, 1, DrvFgVideoRam ); - ZetMapArea(0xd000, 0xd3ff, 2, DrvFgVideoRam ); - ZetMapArea(0xd400, 0xd7ff, 0, DrvFgColourRam ); - ZetMapArea(0xd400, 0xd7ff, 1, DrvFgColourRam ); - ZetMapArea(0xd400, 0xd7ff, 2, DrvFgColourRam ); - ZetMapArea(0xd800, 0xdbff, 0, DrvBgVideoRam ); - ZetMapArea(0xd800, 0xdbff, 1, DrvBgVideoRam ); - ZetMapArea(0xd800, 0xdbff, 2, DrvBgVideoRam ); - ZetMapArea(0xdc00, 0xdfff, 0, DrvBgColourRam ); - ZetMapArea(0xdc00, 0xdfff, 1, DrvBgColourRam ); - ZetMapArea(0xdc00, 0xdfff, 2, DrvBgColourRam ); - ZetMapArea(0xe000, 0xfdff, 0, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xfdff, 1, DrvZ80Ram1 ); - ZetMapArea(0xe000, 0xfdff, 2, DrvZ80Ram1 ); - ZetMapArea(0xfe00, 0xff7f, 0, DrvSpriteRam ); - ZetMapArea(0xfe00, 0xff7f, 1, DrvSpriteRam ); - ZetMapArea(0xfe00, 0xff7f, 2, DrvSpriteRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(CommandoRead2); - ZetSetWriteHandler(CommandoWrite2); - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom2 ); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom2 ); - ZetMapArea(0x4000, 0x47ff, 0, DrvZ80Ram2 ); - ZetMapArea(0x4000, 0x47ff, 1, DrvZ80Ram2 ); - ZetMapArea(0x4000, 0x47ff, 2, DrvZ80Ram2 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetAllRoutes(0, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetAllRoutes(1, 0.15, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 BootlegInit() -{ - bFirstOpCodeEncrypted = true; - - return DrvInit(); -} - -static INT32 DrvExit() -{ - ZetExit(); - BurnYM2203Exit(); - - GenericTilesExit(); - - BurnFree(Mem); - - DrvBgScrollX[0] = DrvBgScrollX[1] = 0; - DrvBgScrollY[0] = DrvBgScrollY[1] = 0; - DrvFlipScreen = 0; - DrvSoundLatch = 0; - - bFirstOpCodeEncrypted = false; - - return 0; -} - -static void DrvCalcPalette() -{ - for (INT32 i = 0; i < 256; i++) { - INT32 bit0, bit1, bit2, bit3, r, g, b; - - bit0 = (DrvPromRed[i] >> 0) & 0x01; - bit1 = (DrvPromRed[i] >> 1) & 0x01; - bit2 = (DrvPromRed[i] >> 2) & 0x01; - bit3 = (DrvPromRed[i] >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvPromGreen[i] >> 0) & 0x01; - bit1 = (DrvPromGreen[i] >> 1) & 0x01; - bit2 = (DrvPromGreen[i] >> 2) & 0x01; - bit3 = (DrvPromGreen[i] >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvPromBlue[i] >> 0) & 0x01; - bit1 = (DrvPromBlue[i] >> 1) & 0x01; - bit2 = (DrvPromBlue[i] >> 2) & 0x01; - bit3 = (DrvPromBlue[i] >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static void DrvRenderBgLayer() -{ - INT32 mx, my, Code, Colour, Attr, x, y, TileIndex, xScroll, yScroll, Flip, xFlip, yFlip; - - xScroll = DrvBgScrollX[0] | (DrvBgScrollX[1] << 8); - xScroll &= 0x3ff; - - yScroll = DrvBgScrollY[0] | (DrvBgScrollY[1] << 8); - yScroll &= 0x3ff; - - for (mx = 0; mx < 32; mx++) { - for (my = 0; my < 32; my++) { - TileIndex = (my * 32) + mx; - - Attr = DrvBgColourRam[TileIndex]; - Code = DrvBgVideoRam[TileIndex] + ((Attr & 0xc0) << 2); - Colour = Attr & 0x0f; - Code &= 0x3ff; - Flip = (Attr & 0x30) >> 4; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - - y = 16 * mx; - x = 16 * my; - - y -= 16; - - x -= xScroll; - y -= yScroll; - if (x < -16) x += 512; - if (y < -16) y += 512; - - if (DrvFlipScreen) { - x = 240 - x; - y = 208 - y; - xFlip = !xFlip; - yFlip = !yFlip; - } - - if (x > 0 && x < 240 && y > 0 && y < 208) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } else { - Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } else { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } else { - Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } - } - } - } - } -} - -static void DrvRenderSprites() -{ - for (INT32 Offset = 0x180 - 4; Offset >= 0; Offset -= 4) { - INT32 Attr = DrvSpriteRamBuffer[Offset + 1]; - INT32 Bank = (Attr & 0xc0) >> 6; - INT32 Code = DrvSpriteRamBuffer[Offset + 0] + (Bank << 8); - INT32 Colour = (Attr & 0x30) >> 4; - INT32 xFlip = Attr & 0x04; - INT32 yFlip = Attr & 0x08; - INT32 x = DrvSpriteRamBuffer[Offset + 3] - ((Attr & 0x01) << 8); - INT32 y = DrvSpriteRamBuffer[Offset + 2]; - - y -= 16; - - if (DrvFlipScreen) { - x = 240 - x; - y = 208 - y; - xFlip = !xFlip; - yFlip = !yFlip; - } - - if (Bank < 3) { - if (x > 0 && x < 240 && y > 0 && y < 208) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); - } - } - } - } - } -} - -static void DrvRenderCharLayer() -{ - INT32 mx, my, Code, Colour, Attr, x, y, TileIndex = 0, Flip, xFlip, yFlip; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Attr = DrvFgColourRam[TileIndex]; - Code = DrvFgVideoRam[TileIndex] + ((Attr & 0xc0) << 2); - Colour = Attr & 0x0f; - Code &= 0x3ff; - Flip = (Attr & 0x30) >> 4; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - - x = 8 * mx; - y = 8 * my; - - y -= 16; - - if (DrvFlipScreen) { - x = 248 - x; - y = 216 - y; - xFlip = !xFlip; - yFlip = !yFlip; - } - - if (x > 0 && x < 248 && y > 0 && y < 216) { - if (xFlip) { - if (yFlip) { - Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); - } else { - Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); - } - } else { - if (yFlip) { - Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); - } else { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); - } else { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); - } - } else { - if (yFlip) { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); - } - } - } - - TileIndex++; - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - DrvRenderBgLayer(); - DrvRenderSprites(); - DrvRenderCharLayer(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 25; - INT32 nSoundBufferPos = 0; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 4000000 / 60; - nCyclesTotal[1] = 3000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 24) { - ZetSetVector(0xd7); - ZetRaiseIrq(0); - } - ZetClose(); - - // Run Z80 #2 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 5 || i == 10 || i == 15 || i == 20) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - ZetOpen(1); - BurnYM2203Update(pSoundBuf, nSegmentLength); - ZetClose(); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - ZetOpen(1); - BurnYM2203Update(pSoundBuf, nSegmentLength); - ZetClose(); - } - } - - ZetOpen(1); - BurnTimerEndFrame(nCyclesTotal[1] - nCyclesDone[1]); - ZetClose(); - - if (pBurnDraw) DrvDraw(); - - memcpy(DrvSpriteRamBuffer, DrvSpriteRam, 0x180); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029693; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); // Scan Z80 - BurnYM2203Scan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(DrvBgScrollX); - SCAN_VAR(DrvBgScrollY); - SCAN_VAR(DrvFlipScreen); - SCAN_VAR(DrvDip); - SCAN_VAR(DrvInput); - } - - return 0; -} - -struct BurnDriver BurnDrvCommando = { - "commando", NULL, NULL, NULL, "1985", - "Commando (World)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvCommandu = { - "commandou", "commando", NULL, NULL, "1985", - "Commando (US)\0", NULL, "Capcom (Data East USA license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvuRomInfo, DrvuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvCommandj = { - "commandoj", "commando", NULL, NULL, "1985", - "Senjou no Ookami\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvCommandb = { - "commandob", "commando", NULL, NULL, "1985", - "Commando (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - BootlegInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSinvasn = { - "sinvasn", "commando", NULL, NULL, "1985", - "Space Invasion (Europe)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, SinvasnRomInfo, SinvasnRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvSinvasnb = { - "sinvasnb", "commando", NULL, NULL, "1985", - "Space Invasion (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, SinvasnbRomInfo, SinvasnbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - BootlegInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 224, 256, 3, 4 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2203.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[2] = {0, 0}; +static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *DrvZ80Rom1 = NULL; +static UINT8 *DrvZ80Rom1Op = NULL; +static UINT8 *DrvZ80Rom2 = NULL; +static UINT8 *DrvZ80Ram1 = NULL; +static UINT8 *DrvZ80Ram2 = NULL; +static UINT8 *DrvFgVideoRam = NULL; +static UINT8 *DrvFgColourRam = NULL; +static UINT8 *DrvBgVideoRam = NULL; +static UINT8 *DrvBgColourRam = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvSpriteRamBuffer = NULL; +static UINT8 *DrvPromRed = NULL; +static UINT8 *DrvPromGreen = NULL; +static UINT8 *DrvPromBlue = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT8 DrvBgScrollX[2]; +static UINT8 DrvBgScrollY[2]; +static UINT8 DrvFlipScreen; +static UINT8 DrvSoundLatch; + +static bool bFirstOpCodeEncrypted = false; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 7, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, + {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + + +STDINPUTINFO(Drv) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + } + + // Clear Opposites + DrvClearOpposites(&DrvInput[1]); + DrvClearOpposites(&DrvInput[2]); +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x1f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Starting Area" }, + {0x11, 0x01, 0x03, 0x03, "0 (Forest 1)" }, + {0x11, 0x01, 0x03, 0x01, "2 (Forest 1)" }, + {0x11, 0x01, 0x03, 0x02, "4 (Forest 2)" }, + {0x11, 0x01, 0x03, 0x00, "6 (Forest 2)" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x0c, 0x04, "2" }, + {0x11, 0x01, 0x0c, 0x0c, "3" }, + {0x11, 0x01, 0x0c, 0x08, "4" }, + {0x11, 0x01, 0x0c, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0xc0, 0x00, "2 Coins 1 Play" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, + {0x11, 0x01, 0xc0, 0x40, "1 Coin 2 Plays" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 3 Plays" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0x30, 0x00, "4 Coins 1 Play" }, + {0x11, 0x01, 0x30, 0x20, "3 Coins 1 Play" }, + {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Play" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x12, 0x01, 0x07, 0x07, "10k 50k+" }, + {0x12, 0x01, 0x07, 0x03, "10k 60k+" }, + {0x12, 0x01, 0x07, 0x05, "20k 60k+" }, + {0x12, 0x01, 0x07, 0x01, "20k 70k+" }, + {0x12, 0x01, 0x07, 0x06, "30k 70k+" }, + {0x12, 0x01, 0x07, 0x02, "30k 80k+" }, + {0x12, 0x01, 0x07, 0x04, "40k 100k+" }, + {0x12, 0x01, 0x07, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x08, 0x00, "Off" }, + {0x12, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x12, 0x01, 0x10, 0x10, "Normal" }, + {0x12, 0x01, 0x10, 0x00, "Difficult" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x12, 0x01, 0x20, 0x00, "Off" }, + {0x12, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 3 , "Cabinet" }, + {0x12, 0x01, 0xc0, 0x00, "Upright" }, + {0x12, 0x01, 0xc0, 0x40, "Upright 2 Players" }, + {0x12, 0x01, 0xc0, 0xc0, "Cocktail" }, +}; + +STDDIPINFO(Drv) + +static struct BurnRomInfo DrvRomDesc[] = { + { "cm04.9m", 0x08000, 0x8438b694, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "cm03.8m", 0x04000, 0x35486542, BRF_ESS | BRF_PRG }, // 1 + + { "cm02.9f", 0x04000, 0xf9cc4a74, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "vt01.5d", 0x04000, 0x505726e0, BRF_GRA }, // 3 Characters + + { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles + { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 + { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 + { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 + { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 + { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 + + { "vt05.7e", 0x04000, 0x79f16e3d, BRF_GRA }, // 10 Sprites + { "vt06.8e", 0x04000, 0x26fee521, BRF_GRA }, // 11 + { "vt07.9e", 0x04000, 0xca88bdfd, BRF_GRA }, // 12 + { "vt08.7h", 0x04000, 0x2019c883, BRF_GRA }, // 13 + { "vt09.8h", 0x04000, 0x98703982, BRF_GRA }, // 14 + { "vt10.9h", 0x04000, 0xf069d2f8, BRF_GRA }, // 15 + + { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs + { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 + { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 + { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 + { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 + { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo DrvuRomDesc[] = { + { "u4-f.9m", 0x08000, 0xa6118935, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "u3-f.8m", 0x04000, 0x24f49684, BRF_ESS | BRF_PRG }, // 1 + + { "cm02.9f", 0x04000, 0xf9cc4a74, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "vt01.5d", 0x04000, 0x505726e0, BRF_GRA }, // 3 Characters + + { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles + { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 + { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 + { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 + { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 + { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 + + { "vt05.7e", 0x04000, 0x79f16e3d, BRF_GRA }, // 10 Sprites + { "vt06.8e", 0x04000, 0x26fee521, BRF_GRA }, // 11 + { "vt07.9e", 0x04000, 0xca88bdfd, BRF_GRA }, // 12 + { "vt08.7h", 0x04000, 0x2019c883, BRF_GRA }, // 13 + { "vt09.8h", 0x04000, 0x98703982, BRF_GRA }, // 14 + { "vt10.9h", 0x04000, 0xf069d2f8, BRF_GRA }, // 15 + + { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs + { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 + { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 + { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 + { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 + { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 +}; + +STD_ROM_PICK(Drvu) +STD_ROM_FN(Drvu) + +static struct BurnRomInfo DrvjRomDesc[] = { + { "so04.9m", 0x08000, 0xd3f2bfb3, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "so03.8m", 0x04000, 0xed01f472, BRF_ESS | BRF_PRG }, // 1 + + { "so02.9f", 0x04000, 0xca20aca5, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "vt01.5d", 0x04000, 0x505726e0, BRF_GRA }, // 3 Characters + + { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles + { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 + { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 + { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 + { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 + { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 + + { "vt05.7e", 0x04000, 0x79f16e3d, BRF_GRA }, // 10 Sprites + { "vt06.8e", 0x04000, 0x26fee521, BRF_GRA }, // 11 + { "vt07.9e", 0x04000, 0xca88bdfd, BRF_GRA }, // 12 + { "vt08.7h", 0x04000, 0x2019c883, BRF_GRA }, // 13 + { "vt09.8h", 0x04000, 0x98703982, BRF_GRA }, // 14 + { "vt10.9h", 0x04000, 0xf069d2f8, BRF_GRA }, // 15 + + { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs + { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 + { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 + { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 + { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 + { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 +}; + +STD_ROM_PICK(Drvj) +STD_ROM_FN(Drvj) + +static struct BurnRomInfo DrvbRomDesc[] = { + { "commandob_04_9m_27256.bin", 0x08000, 0x348a7654, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "cm03.8m", 0x04000, 0x35486542, BRF_ESS | BRF_PRG }, // 1 + + { "cm02.9f", 0x04000, 0xf9cc4a74, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "vt01.5d", 0x04000, 0x505726e0, BRF_GRA }, // 3 Characters + + { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles + { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 + { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 + { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 + { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 + { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 + + { "vt05.7e", 0x04000, 0x79f16e3d, BRF_GRA }, // 10 Sprites + { "vt06.8e", 0x04000, 0x26fee521, BRF_GRA }, // 11 + { "vt07.9e", 0x04000, 0xca88bdfd, BRF_GRA }, // 12 + { "vt08.7h", 0x04000, 0x2019c883, BRF_GRA }, // 13 + { "vt09.8h", 0x04000, 0x98703982, BRF_GRA }, // 14 + { "vt10.9h", 0x04000, 0xf069d2f8, BRF_GRA }, // 15 + + { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs + { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 + { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 + { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 + { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 + { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 + + { "commandob_pal16l8a.bin", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, // 22 PLDs +}; + +STD_ROM_PICK(Drvb) +STD_ROM_FN(Drvb) + +static struct BurnRomInfo SinvasnRomDesc[] = { + { "sp04.9m", 0x08000, 0x33f9601e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "sp03.8m", 0x04000, 0xc7fb43b3, BRF_ESS | BRF_PRG }, // 1 + + { "u2.9f", 0x04000, 0xcbf8c40e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "u1.5d", 0x04000, 0xf477e13a, BRF_GRA }, // 3 Characters + + { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles + { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 + { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 + { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 + { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 + { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 + + { "u5.e7", 0x04000, 0x2a97c933, BRF_GRA }, // 10 Sprites + { "sp06.e8", 0x04000, 0xd7887212, BRF_GRA }, // 11 + { "sp07.e9", 0x04000, 0x9abe7a20, BRF_GRA }, // 12 + { "u8.h7", 0x04000, 0xd6b4aa2e, BRF_GRA }, // 13 + { "sp09.h8", 0x04000, 0x3985b318, BRF_GRA }, // 14 + { "sp10.h9", 0x04000, 0x3c131b0f, BRF_GRA }, // 15 + + { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs + { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 + { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 + { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 + { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 + { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 +}; + +STD_ROM_PICK(Sinvasn) +STD_ROM_FN(Sinvasn) + +static struct BurnRomInfo SinvasnbRomDesc[] = { + { "u4", 0x08000, 0x834ba0de, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "u3", 0x04000, 0x07e4ee3a, BRF_ESS | BRF_PRG }, // 1 + + { "u2", 0x04000, 0xcbf8c40e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "u1", 0x04000, 0xf477e13a, BRF_GRA }, // 3 Characters + + { "vt11.5a", 0x04000, 0x7b2e1b48, BRF_GRA }, // 4 Tiles + { "vt12.6a", 0x04000, 0x81b417d3, BRF_GRA }, // 5 + { "vt13.7a", 0x04000, 0x5612dbd2, BRF_GRA }, // 6 + { "vt14.8a", 0x04000, 0x2b2dee36, BRF_GRA }, // 7 + { "vt15.9a", 0x04000, 0xde70babf, BRF_GRA }, // 8 + { "vt16.10a", 0x04000, 0x14178237, BRF_GRA }, // 9 + + { "u5", 0x04000, 0x2a97c933, BRF_GRA }, // 10 Sprites + { "vt06.e8", 0x04000, 0x26fee521, BRF_GRA }, // 11 + { "vt07.e9", 0x04000, 0xca88bdfd, BRF_GRA }, // 12 + { "u8", 0x04000, 0xd6b4aa2e, BRF_GRA }, // 13 + { "vt09.h8", 0x04000, 0x98703982, BRF_GRA }, // 14 + { "vt10.h9", 0x04000, 0xf069d2f8, BRF_GRA }, // 15 + + { "vtb1.1d", 0x00100, 0x3aba15a1, BRF_GRA }, // 16 PROMs + { "vtb2.2d", 0x00100, 0x88865754, BRF_GRA }, // 17 + { "vtb3.3d", 0x00100, 0x4c14c3f6, BRF_GRA }, // 18 + { "vtb4.1h", 0x00100, 0xb388c246, BRF_GRA }, // 19 + { "vtb5.6l", 0x00100, 0x712ac508, BRF_GRA }, // 20 + { "vtb6.6e", 0x00100, 0x0eaf5158, BRF_GRA }, // 21 +}; + +STD_ROM_PICK(Sinvasnb) +STD_ROM_FN(Sinvasnb) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom1 = Next; Next += 0x0c000; + DrvZ80Rom1Op = Next; Next += 0x0c000; + DrvZ80Rom2 = Next; Next += 0x04000; + DrvPromRed = Next; Next += 0x00100; + DrvPromGreen = Next; Next += 0x00100; + DrvPromBlue = Next; Next += 0x00100; + + RamStart = Next; + + DrvZ80Ram1 = Next; Next += 0x01e00; + DrvZ80Ram2 = Next; Next += 0x00800; + DrvSpriteRam = Next; Next += 0x00180; + DrvSpriteRamBuffer = Next; Next += 0x00180; + DrvBgVideoRam = Next; Next += 0x00400; + DrvBgColourRam = Next; Next += 0x00400; + DrvFgVideoRam = Next; Next += 0x00400; + DrvFgColourRam = Next; Next += 0x00400; + + RamEnd = Next; + + DrvChars = Next; Next += 0x400 * 8 * 8; + DrvTiles = Next; Next += 0x400 * 16 * 16; + DrvSprites = Next; Next += 0x300 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00100 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + BurnYM2203Reset(); + + DrvBgScrollX[0] = DrvBgScrollX[1] = 0; + DrvBgScrollY[0] = DrvBgScrollY[1] = 0; + DrvFlipScreen = 0; + DrvSoundLatch = 0; + + return 0; +} + +UINT8 __fastcall CommandoRead1(UINT16 a) +{ + switch (a) { + case 0xc000: { + return 0xff - DrvInput[0]; + } + + case 0xc001: { + return 0xff - DrvInput[1]; + } + + case 0xc002: { + return 0xff - DrvInput[2]; + } + + case 0xc003: { + return DrvDip[0]; + } + + case 0xc004: { + return DrvDip[1]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall CommandoWrite1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xc800: { + DrvSoundLatch = d; + return; + } + + case 0xc804: { + DrvFlipScreen = d & 0x80; + + if (d & 0x10) { + ZetClose(); + ZetOpen(1); + ZetReset(); + ZetClose(); + ZetOpen(0); + } + + return; + } + + case 0xc806: { + // ??? + return; + } + + case 0xc808: { + DrvBgScrollX[0] = d; + return; + } + + case 0xc809: { + DrvBgScrollX[1] = d; + return; + } + + case 0xc80a: { + DrvBgScrollY[0] = d; + return; + } + + case 0xc80b: { + DrvBgScrollY[1] = d; + return; + } + + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall CommandoRead2(UINT16 a) +{ + switch (a) { + case 0x6000: { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall CommandoWrite2(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x8000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0x8001: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0x8002: { + BurnYM2203Write(1, 0, d); + return; + } + + case 0x8003: { + BurnYM2203Write(1, 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); + } + } +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3000000; +} + +static INT32 CharPlaneOffsets[2] = { 4, 0 }; +static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; +static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; +static INT32 TilePlaneOffsets[3] = { 0, 0x40000, 0x80000 }; +static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; +static INT32 SpritePlaneOffsets[4] = { 0x60004, 0x60000, 4, 0 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; +static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; + +static INT32 DrvInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x08000, 1, 1); if (nRet != 0) return 1; + + if (bFirstOpCodeEncrypted) { + for (INT32 A = 0; A < 0xc000; A++) { + INT32 src; + + src = DrvZ80Rom1[A]; + DrvZ80Rom1Op[A] = (src & 0x11) | ((src & 0xe0) >> 4) | ((src & 0x0e) << 4); + } + } else { + DrvZ80Rom1Op[0] = DrvZ80Rom1[0]; + for (INT32 A = 1; A < 0xc000; A++) { + INT32 src; + + src = DrvZ80Rom1[A]; + DrvZ80Rom1Op[A] = (src & 0x11) | ((src & 0xe0) >> 4) | ((src & 0x0e) << 4); + } + } + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 3, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x18000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x14000, 9, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 3, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x18000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x14000, 15, 1); if (nRet != 0) return 1; + GfxDecode(0x300, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load the PROMs + nRet = BurnLoadRom(DrvPromRed, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromGreen, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromBlue, 18, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(CommandoRead1); + ZetSetWriteHandler(CommandoWrite1); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom1 ); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom1Op, DrvZ80Rom1 ); + ZetMapArea(0xd000, 0xd3ff, 0, DrvFgVideoRam ); + ZetMapArea(0xd000, 0xd3ff, 1, DrvFgVideoRam ); + ZetMapArea(0xd000, 0xd3ff, 2, DrvFgVideoRam ); + ZetMapArea(0xd400, 0xd7ff, 0, DrvFgColourRam ); + ZetMapArea(0xd400, 0xd7ff, 1, DrvFgColourRam ); + ZetMapArea(0xd400, 0xd7ff, 2, DrvFgColourRam ); + ZetMapArea(0xd800, 0xdbff, 0, DrvBgVideoRam ); + ZetMapArea(0xd800, 0xdbff, 1, DrvBgVideoRam ); + ZetMapArea(0xd800, 0xdbff, 2, DrvBgVideoRam ); + ZetMapArea(0xdc00, 0xdfff, 0, DrvBgColourRam ); + ZetMapArea(0xdc00, 0xdfff, 1, DrvBgColourRam ); + ZetMapArea(0xdc00, 0xdfff, 2, DrvBgColourRam ); + ZetMapArea(0xe000, 0xfdff, 0, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xfdff, 1, DrvZ80Ram1 ); + ZetMapArea(0xe000, 0xfdff, 2, DrvZ80Ram1 ); + ZetMapArea(0xfe00, 0xff7f, 0, DrvSpriteRam ); + ZetMapArea(0xfe00, 0xff7f, 1, DrvSpriteRam ); + ZetMapArea(0xfe00, 0xff7f, 2, DrvSpriteRam ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(CommandoRead2); + ZetSetWriteHandler(CommandoWrite2); + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom2 ); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom2 ); + ZetMapArea(0x4000, 0x47ff, 0, DrvZ80Ram2 ); + ZetMapArea(0x4000, 0x47ff, 1, DrvZ80Ram2 ); + ZetMapArea(0x4000, 0x47ff, 2, DrvZ80Ram2 ); + ZetClose(); + + BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetAllRoutes(0, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetAllRoutes(1, 0.15, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 BootlegInit() +{ + bFirstOpCodeEncrypted = true; + + return DrvInit(); +} + +static INT32 DrvExit() +{ + ZetExit(); + BurnYM2203Exit(); + + GenericTilesExit(); + + BurnFree(Mem); + + DrvBgScrollX[0] = DrvBgScrollX[1] = 0; + DrvBgScrollY[0] = DrvBgScrollY[1] = 0; + DrvFlipScreen = 0; + DrvSoundLatch = 0; + + bFirstOpCodeEncrypted = false; + + return 0; +} + +static void DrvCalcPalette() +{ + for (INT32 i = 0; i < 256; i++) { + INT32 bit0, bit1, bit2, bit3, r, g, b; + + bit0 = (DrvPromRed[i] >> 0) & 0x01; + bit1 = (DrvPromRed[i] >> 1) & 0x01; + bit2 = (DrvPromRed[i] >> 2) & 0x01; + bit3 = (DrvPromRed[i] >> 3) & 0x01; + r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvPromGreen[i] >> 0) & 0x01; + bit1 = (DrvPromGreen[i] >> 1) & 0x01; + bit2 = (DrvPromGreen[i] >> 2) & 0x01; + bit3 = (DrvPromGreen[i] >> 3) & 0x01; + g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvPromBlue[i] >> 0) & 0x01; + bit1 = (DrvPromBlue[i] >> 1) & 0x01; + bit2 = (DrvPromBlue[i] >> 2) & 0x01; + bit3 = (DrvPromBlue[i] >> 3) & 0x01; + b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static void DrvRenderBgLayer() +{ + INT32 mx, my, Code, Colour, Attr, x, y, TileIndex, xScroll, yScroll, Flip, xFlip, yFlip; + + xScroll = DrvBgScrollX[0] | (DrvBgScrollX[1] << 8); + xScroll &= 0x3ff; + + yScroll = DrvBgScrollY[0] | (DrvBgScrollY[1] << 8); + yScroll &= 0x3ff; + + for (mx = 0; mx < 32; mx++) { + for (my = 0; my < 32; my++) { + TileIndex = (my * 32) + mx; + + Attr = DrvBgColourRam[TileIndex]; + Code = DrvBgVideoRam[TileIndex] + ((Attr & 0xc0) << 2); + Colour = Attr & 0x0f; + Code &= 0x3ff; + Flip = (Attr & 0x30) >> 4; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + + y = 16 * mx; + x = 16 * my; + + y -= 16; + + x -= xScroll; + y -= yScroll; + if (x < -16) x += 512; + if (y < -16) y += 512; + + if (DrvFlipScreen) { + x = 240 - x; + y = 208 - y; + xFlip = !xFlip; + yFlip = !yFlip; + } + + if (x > 0 && x < 240 && y > 0 && y < 208) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } else { + Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } else { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } else { + Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } + } + } + } + } +} + +static void DrvRenderSprites() +{ + for (INT32 Offset = 0x180 - 4; Offset >= 0; Offset -= 4) { + INT32 Attr = DrvSpriteRamBuffer[Offset + 1]; + INT32 Bank = (Attr & 0xc0) >> 6; + INT32 Code = DrvSpriteRamBuffer[Offset + 0] + (Bank << 8); + INT32 Colour = (Attr & 0x30) >> 4; + INT32 xFlip = Attr & 0x04; + INT32 yFlip = Attr & 0x08; + INT32 x = DrvSpriteRamBuffer[Offset + 3] - ((Attr & 0x01) << 8); + INT32 y = DrvSpriteRamBuffer[Offset + 2]; + + y -= 16; + + if (DrvFlipScreen) { + x = 240 - x; + y = 208 - y; + xFlip = !xFlip; + yFlip = !yFlip; + } + + if (Bank < 3) { + if (x > 0 && x < 240 && y > 0 && y < 208) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); + } else { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 128, DrvSprites); + } + } + } + } + } +} + +static void DrvRenderCharLayer() +{ + INT32 mx, my, Code, Colour, Attr, x, y, TileIndex = 0, Flip, xFlip, yFlip; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Attr = DrvFgColourRam[TileIndex]; + Code = DrvFgVideoRam[TileIndex] + ((Attr & 0xc0) << 2); + Colour = Attr & 0x0f; + Code &= 0x3ff; + Flip = (Attr & 0x30) >> 4; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + + x = 8 * mx; + y = 8 * my; + + y -= 16; + + if (DrvFlipScreen) { + x = 248 - x; + y = 216 - y; + xFlip = !xFlip; + yFlip = !yFlip; + } + + if (x > 0 && x < 248 && y > 0 && y < 216) { + if (xFlip) { + if (yFlip) { + Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); + } else { + Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); + } + } else { + if (yFlip) { + Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); + } else { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); + } else { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); + } + } else { + if (yFlip) { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 192, DrvChars); + } + } + } + + TileIndex++; + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + DrvRenderBgLayer(); + DrvRenderSprites(); + DrvRenderCharLayer(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 25; + INT32 nSoundBufferPos = 0; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 4000000 / 60; + nCyclesTotal[1] = 3000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 24) { + ZetSetVector(0xd7); + ZetRaiseIrq(0); + } + ZetClose(); + + // Run Z80 #2 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 5 || i == 10 || i == 15 || i == 20) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + ZetOpen(1); + BurnYM2203Update(pSoundBuf, nSegmentLength); + ZetClose(); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + ZetOpen(1); + BurnYM2203Update(pSoundBuf, nSegmentLength); + ZetClose(); + } + } + + ZetOpen(1); + BurnTimerEndFrame(nCyclesTotal[1] - nCyclesDone[1]); + ZetClose(); + + if (pBurnDraw) DrvDraw(); + + memcpy(DrvSpriteRamBuffer, DrvSpriteRam, 0x180); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029693; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); // Scan Z80 + BurnYM2203Scan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(DrvBgScrollX); + SCAN_VAR(DrvBgScrollY); + SCAN_VAR(DrvFlipScreen); + SCAN_VAR(DrvDip); + SCAN_VAR(DrvInput); + } + + return 0; +} + +struct BurnDriver BurnDrvCommando = { + "commando", NULL, NULL, NULL, "1985", + "Commando (World)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvCommandu = { + "commandou", "commando", NULL, NULL, "1985", + "Commando (US)\0", NULL, "Capcom (Data East USA license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvuRomInfo, DrvuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvCommandj = { + "commandoj", "commando", NULL, NULL, "1985", + "Senjou no Ookami\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvCommandb = { + "commandob", "commando", NULL, NULL, "1985", + "Commando (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + BootlegInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSinvasn = { + "sinvasn", "commando", NULL, NULL, "1985", + "Space Invasion (Europe)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, SinvasnRomInfo, SinvasnRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvSinvasnb = { + "sinvasnb", "commando", NULL, NULL, "1985", + "Space Invasion (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, SinvasnbRomInfo, SinvasnbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + BootlegInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 224, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_cybertnk.cpp b/src/burn/drv/pre90s/d_cybertnk.cpp index 1028b2b97..bff161366 100644 --- a/src/burn/drv/pre90s/d_cybertnk.cpp +++ b/src/burn/drv/pre90s/d_cybertnk.cpp @@ -580,7 +580,6 @@ static INT32 DrvInit() ZetMapArea(0x8000, 0x9fff, 2, DrvZ80RAM); ZetSetWriteHandler(cybertnk_sound_write); ZetSetReadHandler(cybertnk_sound_read); - ZetMemEnd(); ZetClose(); BurnY8950Init(2, 3579545, DrvSndROM0, 0x40000, DrvSndROM1, 0x80000, NULL, &DrvSynchroniseStream, 0); diff --git a/src/burn/drv/pre90s/d_ddragon.cpp b/src/burn/drv/pre90s/d_ddragon.cpp index c67271394..b9eb703dc 100644 --- a/src/burn/drv/pre90s/d_ddragon.cpp +++ b/src/burn/drv/pre90s/d_ddragon.cpp @@ -1,2652 +1,2650 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "hd6309_intf.h" -#include "m6800_intf.h" -#include "m6805_intf.h" -#include "m6809_intf.h" -#include "burn_ym2151.h" -#include "msm5205.h" -#include "msm6295.h" -#include "bitswap.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[2] = {0, 0}; -static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *DrvHD6309Rom = NULL; -static UINT8 *DrvSubCPURom = NULL; -static UINT8 *DrvSoundCPURom = NULL; -static UINT8 *DrvMCURom = NULL; -static UINT8 *DrvMSM5205Rom = NULL; -static UINT8 *DrvHD6309Ram = NULL; -static UINT8 *DrvSubCPURam = NULL; -static UINT8 *DrvSoundCPURam = NULL; -static UINT8 *DrvMCURam = NULL; -static UINT8 *DrvMCUPorts = NULL; -static UINT8 *DrvFgVideoRam = NULL; -static UINT8 *DrvBgVideoRam = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvPaletteRam1 = NULL; -static UINT8 *DrvPaletteRam2 = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT8 DrvRomBank; -static UINT8 DrvVBlank; -static UINT8 DrvSubCPUBusy; -static UINT8 DrvSoundLatch; -static UINT8 DrvADPCMIdle[2]; -static UINT32 DrvADPCMPos[2]; -static UINT32 DrvADPCMEnd[2]; -static INT32 DrvADPCMData[2]; - -static UINT16 DrvScrollXHi; -static UINT16 DrvScrollYHi; -static UINT8 DrvScrollXLo; -static UINT8 DrvScrollYLo; - -static INT32 nCyclesDone[4], nCyclesTotal[4]; -static INT32 nCyclesSegment; - -#define DD_CPU_TYPE_NONE 0 -#define DD_CPU_TYPE_HD63701 1 -#define DD_CPU_TYPE_HD6309 2 -#define DD_CPU_TYPE_M6803 3 -#define DD_CPU_TYPE_Z80 4 -#define DD_CPU_TYPE_M6809 5 -static INT32 DrvSubCPUType; -static INT32 DrvSoundCPUType; - -#define DD_VID_TYPE_DD2 1 -static INT32 DrvVidHardwareType; - -#define DD_GAME_DARKTOWR 1 -static INT32 DrvGameType; - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 1, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort2 + 0, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = 0xff; - DrvInput[2] = 0xe7; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] -= (DrvInputPort0[i] & 1) << i; - DrvInput[1] -= (DrvInputPort1[i] & 1) << i; - DrvInput[2] -= (DrvInputPort2[i] & 1) << i; - } -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x14, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, - {0x14, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, - {0x14, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x14, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x14, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x14, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x14, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x14, 0x01, 0x07, 0x03, "1 Coin 5 Plays" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x14, 0x01, 0x38, 0x00, "4 Coins 1 Play" }, - {0x14, 0x01, 0x38, 0x08, "3 Coins 1 Play" }, - {0x14, 0x01, 0x38, 0x10, "2 Coins 1 Play" }, - {0x14, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x14, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x14, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, - {0x14, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, - {0x14, 0x01, 0x38, 0x18, "1 Coin 5 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x40, 0x40, "Upright" }, - {0x14, 0x01, 0x40, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x03, 0x01, "Easy" }, - {0x15, 0x01, 0x03, 0x03, "Medium" }, - {0x15, 0x01, 0x03, 0x02, "Hard" }, - {0x15, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x04, 0x00, "Off" }, - {0x15, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x15, 0x01, 0x30, 0x10, "20k" }, - {0x15, 0x01, 0x30, 0x00, "40k" }, - {0x15, 0x01, 0x30, 0x30, "30k and every 60k" }, - {0x15, 0x01, 0x30, 0x20, "40k and every 80k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0xc0, 0xc0, "2" }, - {0x15, 0x01, 0xc0, 0x80, "3" }, - {0x15, 0x01, 0xc0, 0x40, "4" }, - {0x15, 0x01, 0xc0, 0x00, "Infinite" }, -}; - -STDDIPINFO(Drv) - -static struct BurnDIPInfo Drv2DIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x14, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, - {0x14, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, - {0x14, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x14, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x14, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x14, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x14, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x14, 0x01, 0x07, 0x03, "1 Coin 5 Plays" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x14, 0x01, 0x38, 0x00, "4 Coins 1 Play" }, - {0x14, 0x01, 0x38, 0x08, "3 Coins 1 Play" }, - {0x14, 0x01, 0x38, 0x10, "2 Coins 1 Play" }, - {0x14, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x14, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x14, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, - {0x14, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, - {0x14, 0x01, 0x38, 0x18, "1 Coin 5 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x40, 0x40, "Upright" }, - {0x14, 0x01, 0x40, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Hurricane Kick" }, - {0x15, 0x01, 0x08, 0x00, "Easy" }, - {0x15, 0x01, 0x08, 0x08, "Normal" }, - - {0 , 0xfe, 0 , 4 , "Timer" }, - {0x15, 0x01, 0x30, 0x00, "60" }, - {0x15, 0x01, 0x30, 0x10, "65" }, - {0x15, 0x01, 0x30, 0x30, "70" }, - {0x15, 0x01, 0x30, 0x20, "80" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0xc0, 0xc0, "1" }, - {0x15, 0x01, 0xc0, 0x80, "2" }, - {0x15, 0x01, 0xc0, 0x40, "3" }, - {0x15, 0x01, 0xc0, 0x00, "4" }, -}; - -STDDIPINFO(Drv2) - -static struct BurnDIPInfo DdungeonDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0x9d, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x14, 0x01, 0x0f, 0x03, "4 Coins 1 Play" }, - {0x14, 0x01, 0x0f, 0x02, "3 Coins 1 Play" }, - {0x14, 0x01, 0x0f, 0x07, "4 Coins 2 Plays" }, - {0x14, 0x01, 0x0f, 0x01, "2 Coins 1 Play" }, - {0x14, 0x01, 0x0f, 0x06, "3 Coins 2 Plays" }, - {0x14, 0x01, 0x0f, 0x0b, "4 Coins 3 Plays" }, - {0x14, 0x01, 0x0f, 0x0f, "4 Coins 4 Plays" }, - {0x14, 0x01, 0x0f, 0x0a, "3 Coins 3 Plays" }, - {0x14, 0x01, 0x0f, 0x05, "2 Coins 2 Plays" }, - {0x14, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, - {0x14, 0x01, 0x0f, 0x0e, "3 Coins 4 Plays" }, - {0x14, 0x01, 0x0f, 0x09, "2 Coins 3 Plays" }, - {0x14, 0x01, 0x0f, 0x0d, "2 Coins 4 Plays" }, - {0x14, 0x01, 0x0f, 0x04, "1 Coin 2 Plays" }, - {0x14, 0x01, 0x0f, 0x08, "1 Coin 3 Plays" }, - {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x14, 0x01, 0xf0, 0x30, "4 Coins 1 Play" }, - {0x14, 0x01, 0xf0, 0x20, "3 Coins 1 Play" }, - {0x14, 0x01, 0xf0, 0x70, "4 Coins 2 Plays" }, - {0x14, 0x01, 0xf0, 0x10, "2 Coins 1 Play" }, - {0x14, 0x01, 0xf0, 0x60, "3 Coins 2 Plays" }, - {0x14, 0x01, 0xf0, 0xb0, "4 Coins 3 Plays" }, - {0x14, 0x01, 0xf0, 0xf0, "4 Coins 4 Plays" }, - {0x14, 0x01, 0xf0, 0xa0, "3 Coins 3 Plays" }, - {0x14, 0x01, 0xf0, 0x50, "2 Coins 2 Plays" }, - {0x14, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, - {0x14, 0x01, 0xf0, 0xe0, "3 Coins 4 Plays" }, - {0x14, 0x01, 0xf0, 0x90, "2 Coins 3 Plays" }, - {0x14, 0x01, 0xf0, 0xd0, "2 Coins 4 Plays" }, - {0x14, 0x01, 0xf0, 0x40, "1 Coin 2 Plays" }, - {0x14, 0x01, 0xf0, 0x80, "1 Coin 3 Plays" }, - {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x03, 0x00, "1" }, - {0x15, 0x01, 0x03, 0x01, "2" }, - {0x15, 0x01, 0x03, 0x02, "3" }, - {0x15, 0x01, 0x03, 0x03, "4" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0xf0, 0xf0, "Easy" }, - {0x15, 0x01, 0xf0, 0x90, "Medium" }, - {0x15, 0x01, 0xf0, 0x70, "Hard" }, - {0x15, 0x01, 0xf0, 0x00, "Hardest" }, -}; - -STDDIPINFO(Ddungeon) - -static struct BurnDIPInfo DarktowrDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x14, 0x01, 0x0f, 0x03, "4 Coins 1 Play" }, - {0x14, 0x01, 0x0f, 0x02, "3 Coins 1 Play" }, - {0x14, 0x01, 0x0f, 0x07, "4 Coins 2 Plays" }, - {0x14, 0x01, 0x0f, 0x01, "2 Coins 1 Play" }, - {0x14, 0x01, 0x0f, 0x06, "3 Coins 2 Plays" }, - {0x14, 0x01, 0x0f, 0x0b, "4 Coins 3 Plays" }, - {0x14, 0x01, 0x0f, 0x0f, "4 Coins 4 Plays" }, - {0x14, 0x01, 0x0f, 0x0a, "3 Coins 3 Plays" }, - {0x14, 0x01, 0x0f, 0x05, "2 Coins 2 Plays" }, - {0x14, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, - {0x14, 0x01, 0x0f, 0x0e, "3 Coins 4 Plays" }, - {0x14, 0x01, 0x0f, 0x09, "2 Coins 3 Plays" }, - {0x14, 0x01, 0x0f, 0x0d, "2 Coins 4 Plays" }, - {0x14, 0x01, 0x0f, 0x04, "1 Coin 2 Plays" }, - {0x14, 0x01, 0x0f, 0x08, "1 Coin 3 Plays" }, - {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x14, 0x01, 0xf0, 0x30, "4 Coins 1 Play" }, - {0x14, 0x01, 0xf0, 0x20, "3 Coins 1 Play" }, - {0x14, 0x01, 0xf0, 0x70, "4 Coins 2 Plays" }, - {0x14, 0x01, 0xf0, 0x10, "2 Coins 1 Play" }, - {0x14, 0x01, 0xf0, 0x60, "3 Coins 2 Plays" }, - {0x14, 0x01, 0xf0, 0xb0, "4 Coins 3 Plays" }, - {0x14, 0x01, 0xf0, 0xf0, "4 Coins 4 Plays" }, - {0x14, 0x01, 0xf0, 0xa0, "3 Coins 3 Plays" }, - {0x14, 0x01, 0xf0, 0x50, "2 Coins 2 Plays" }, - {0x14, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, - {0x14, 0x01, 0xf0, 0xe0, "3 Coins 4 Plays" }, - {0x14, 0x01, 0xf0, 0x90, "2 Coins 3 Plays" }, - {0x14, 0x01, 0xf0, 0xd0, "2 Coins 4 Plays" }, - {0x14, 0x01, 0xf0, 0x40, "1 Coin 2 Plays" }, - {0x14, 0x01, 0xf0, 0x80, "1 Coin 3 Plays" }, - {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, -}; - -STDDIPINFO(Darktowr) - -static struct BurnRomInfo DrvRomDesc[] = { - { "21j-1-5.26", 0x08000, 0x42045dfd, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "21j-2-3.25", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 - { "21j-3.24", 0x08000, 0x3bdea613, BRF_ESS | BRF_PRG }, // 2 - { "21j-4-1.23", 0x08000, 0x728f87b9, BRF_ESS | BRF_PRG }, // 3 - - { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code - - { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code - - { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters - - { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites - { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 - { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 - { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 - { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 - { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 - { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 - { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 - - { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles - { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 - { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 - { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 - - { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples - { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo DrvwRomDesc[] = { - { "21j-1.26", 0x08000, 0xae714964, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "21j-2-3.25", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 - { "21a-3.24", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 - { "21j-4.23", 0x08000, 0x6c9f46fa, BRF_ESS | BRF_PRG }, // 3 - - { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code - - { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code - - { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters - - { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites - { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 - { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 - { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 - { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 - { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 - { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 - { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 - - { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles - { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 - { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 - { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 - - { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples - { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Drvw) -STD_ROM_FN(Drvw) - -static struct BurnRomInfo Drvw1RomDesc[] = { - { "e1-1.26", 0x08000, 0x4b951643, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "21a-2-4.25", 0x08000, 0x5cd67657, BRF_ESS | BRF_PRG }, // 1 - { "21a-3.24", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 - { "e4-1.23", 0x08000, 0xb1e26935, BRF_ESS | BRF_PRG }, // 3 - - { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code - - { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code - - { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters - - { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites - { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 - { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 - { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 - { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 - { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 - { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 - { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 - - { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles - { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 - { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 - { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 - - { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples - { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Drvw1) -STD_ROM_FN(Drvw1) - -static struct BurnRomInfo DrvuRomDesc[] = { - { "21a-1-5.26", 0x08000, 0xe24a6e11, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "21j-2-3.25", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 - { "21a-3.24", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 - { "21a-4.23", 0x08000, 0x6ea16072, BRF_ESS | BRF_PRG }, // 3 - - { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code - - { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code - - { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters - - { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites - { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 - { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 - { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 - { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 - { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 - { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 - { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 - - { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles - { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 - { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 - { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 - - { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples - { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Drvu) -STD_ROM_FN(Drvu) - -static struct BurnRomInfo DrvuaRomDesc[] = { - { "21a-1", 0x08000, 0x1d625008, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "21a-2_4", 0x08000, 0x5cd67657, BRF_ESS | BRF_PRG }, // 1 - { "21a-3", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 - { "21a-4_2", 0x08000, 0x9b019598, BRF_ESS | BRF_PRG }, // 3 - - { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code - - { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code - - { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters - - { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites - { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 - { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 - { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 - { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 - { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 - { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 - { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 - - { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles - { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 - { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 - { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 - - { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples - { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Drvua) -STD_ROM_FN(Drvua) - -static struct BurnRomInfo DrvubRomDesc[] = { - { "21a-1_6.bin", 0x08000, 0xf354b0e1, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "21a-2_4", 0x08000, 0x5cd67657, BRF_ESS | BRF_PRG }, // 1 - { "21a-3", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 - { "21a-4_2", 0x08000, 0x9b019598, BRF_ESS | BRF_PRG }, // 3 - - { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code - - { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code - - { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters - - { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites - { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 - { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 - { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 - { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 - { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 - { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 - { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 - - { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles - { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 - { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 - { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 - - { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples - { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Drvub) -STD_ROM_FN(Drvub) - -static struct BurnRomInfo Drvb2RomDesc[] = { - { "b2_4.bin", 0x08000, 0x668dfa19, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "b2_5.bin", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 - { "b2_6.bin", 0x08000, 0x3bdea613, BRF_ESS | BRF_PRG }, // 2 - { "b2_7.bin", 0x08000, 0x728f87b9, BRF_ESS | BRF_PRG }, // 3 - - { "63701.bin", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code - - { "b2_3.bin", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code - - { "b2_8.bin", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters - - { "11.bin", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites - { "12.bin", 0x10000, 0x40507a76, BRF_GRA }, // 8 - { "13.bin", 0x10000, 0xc8b91e17, BRF_GRA }, // 9 - { "14.bin", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 - { "15.bin", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 - { "16.bin", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 - { "17.bin", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 - { "18.bin", 0x10000, 0x65c7517d, BRF_GRA }, // 14 - - { "9.bin", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles - { "10.bin", 0x10000, 0xc6640aed, BRF_GRA }, // 16 - { "19.bin", 0x10000, 0x22d65df2, BRF_GRA }, // 17 - { "20.bin", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 - - { "b2_1.bin", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples - { "2.bin", 0x10000, 0x904de6f8, BRF_GRA }, // 20 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Drvb2) -STD_ROM_FN(Drvb2) - -static struct BurnRomInfo DrvbRomDesc[] = { - { "21j-1.26", 0x08000, 0xae714964, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "21j-2-3.25", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 - { "21a-3.24", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 - { "21j-4.23", 0x08000, 0x6c9f46fa, BRF_ESS | BRF_PRG }, // 3 - - { "ic38", 0x04000, 0x6a6a0325, BRF_ESS | BRF_PRG }, // 4 HD6309 Program Code - - { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code - - { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters - - { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites - { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 - { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 - { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 - { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 - { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 - { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 - { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 - - { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles - { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 - { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 - { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 - - { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples - { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Drvb) -STD_ROM_FN(Drvb) - -static struct BurnRomInfo DrvbaRomDesc[] = { - { "5.bin", 0x08000, 0xae714964, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "4.bin", 0x10000, 0x48045762, BRF_ESS | BRF_PRG }, // 1 - { "3.bin", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 - - { "2_32.bin", 0x04000, 0x67875473, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code - - { "6.bin", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 4 M6809 Program Code - - { "1.bin", 0x08000, 0x7a8b8db4, BRF_GRA }, // 5 Characters - - { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 6 Sprites - { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 7 - { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 8 - { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 9 - { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 10 - { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 11 - { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 12 - { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 13 - - { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 14 Tiles - { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 15 - { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 16 - { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 17 - - { "8.bin", 0x10000, 0x34755de3, BRF_GRA }, // 18 Samples - { "7.bin", 0x10000, 0xf9311f72, BRF_GRA }, // 19 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 20 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 21 -}; - -STD_ROM_PICK(Drvba) -STD_ROM_FN(Drvba) - -static struct BurnRomInfo Drv2RomDesc[] = { - { "26a9-04.bin", 0x08000, 0xf2cfc649, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "26aa-03.bin", 0x08000, 0x44dd5d4b, BRF_ESS | BRF_PRG }, // 1 - { "26ab-0.bin", 0x08000, 0x49ddddcd, BRF_ESS | BRF_PRG }, // 2 - { "26ac-0e.63", 0x08000, 0x57acad2c, BRF_ESS | BRF_PRG }, // 3 - - { "26ae-0.bin", 0x10000, 0xea437867, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - - { "26ad-0.bin", 0x08000, 0x75e36cd6, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program Code - - { "26a8-0e.19", 0x10000, 0x4e80cd36, BRF_GRA }, // 6 Characters - - { "26j0-0.bin", 0x20000, 0xdb309c84, BRF_GRA }, // 7 Sprites - { "26j1-0.bin", 0x20000, 0xc3081e0c, BRF_GRA }, // 8 - { "26af-0.bin", 0x20000, 0x3a615aad, BRF_GRA }, // 9 - { "26j2-0.bin", 0x20000, 0x589564ae, BRF_GRA }, // 10 - { "26j3-0.bin", 0x20000, 0xdaf040d6, BRF_GRA }, // 11 - { "26a10-0.bin", 0x20000, 0x6d16d889, BRF_GRA }, // 12 - - { "26j4-0.bin", 0x20000, 0xa8c93e76, BRF_GRA }, // 13 Tiles - { "26j5-0.bin", 0x20000, 0xee555237, BRF_GRA }, // 14 - - { "26j6-0.bin", 0x20000, 0xa84b2a29, BRF_GRA }, // 15 Samples - { "26j7-0.bin", 0x20000, 0xbc6a48d5, BRF_GRA }, // 16 - - { "prom.16", 0x00200, 0x46339529, BRF_GRA }, // 17 PROMs -}; - -STD_ROM_PICK(Drv2) -STD_ROM_FN(Drv2) - -static struct BurnRomInfo Drv2uRomDesc[] = { - { "26a9-04.bin", 0x08000, 0xf2cfc649, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "26aa-03.bin", 0x08000, 0x44dd5d4b, BRF_ESS | BRF_PRG }, // 1 - { "26ab-0.bin", 0x08000, 0x49ddddcd, BRF_ESS | BRF_PRG }, // 2 - { "26ac-02.bin", 0x08000, 0x097eaf26, BRF_ESS | BRF_PRG }, // 3 - - { "26ae-0.bin", 0x10000, 0xea437867, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - - { "26ad-0.bin", 0x08000, 0x75e36cd6, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program Code - - { "26a8-0.bin", 0x10000, 0x3ad1049c, BRF_GRA }, // 6 Characters - - { "26j0-0.bin", 0x20000, 0xdb309c84, BRF_GRA }, // 7 Sprites - { "26j1-0.bin", 0x20000, 0xc3081e0c, BRF_GRA }, // 8 - { "26af-0.bin", 0x20000, 0x3a615aad, BRF_GRA }, // 9 - { "26j2-0.bin", 0x20000, 0x589564ae, BRF_GRA }, // 10 - { "26j3-0.bin", 0x20000, 0xdaf040d6, BRF_GRA }, // 11 - { "26a10-0.bin", 0x20000, 0x6d16d889, BRF_GRA }, // 12 - - { "26j4-0.bin", 0x20000, 0xa8c93e76, BRF_GRA }, // 13 Tiles - { "26j5-0.bin", 0x20000, 0xee555237, BRF_GRA }, // 14 - - { "26j6-0.bin", 0x20000, 0xa84b2a29, BRF_GRA }, // 15 Samples - { "26j7-0.bin", 0x20000, 0xbc6a48d5, BRF_GRA }, // 16 - - { "prom.16", 0x00200, 0x46339529, BRF_GRA }, // 17 PROMs -}; - -STD_ROM_PICK(Drv2u) -STD_ROM_FN(Drv2u) - -static struct BurnRomInfo DdungeonRomDesc[] = { - { "dd26.26", 0x08000, 0xa6e7f608, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "dd25.25", 0x08000, 0x922e719c, BRF_ESS | BRF_PRG }, // 1 - - { "63701.bin", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 2 HD63701 Program Code - - { "dd30.30", 0x08000, 0xef1af99a, BRF_ESS | BRF_PRG }, // 3 M6809 Program Code - - { "dd_mcu.bin", 0x00800, 0x34cbb2d3, BRF_ESS | BRF_PRG }, // 4 M68705 MCU Program Code - - { "dd20.20", 0x08000, 0xd976b78d, BRF_GRA }, // 5 Characters - - { "dd117.117", 0x08000, 0xe912ca81, BRF_GRA }, // 6 Sprites - { "dd113.113", 0x08000, 0x43264ad8, BRF_GRA }, // 7 - - { "dd78.78", 0x08000, 0x3deacae9, BRF_GRA }, // 8 Tiles - { "dd109.109", 0x08000, 0x5a2f31eb, BRF_GRA }, // 9 - - { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 10 Samples - { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 11 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 12 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 13 -}; - -STD_ROM_PICK(Ddungeon) -STD_ROM_FN(Ddungeon) - -static struct BurnRomInfo DarktowrRomDesc[] = { - { "dt.26", 0x08000, 0x8134a472, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code - { "21j-2-3.25", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 - { "dt.24", 0x08000, 0x523a5413, BRF_ESS | BRF_PRG }, // 2 - - { "63701.bin", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 3 HD63701 Program Code - - { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 4 M6809 Program Code - - { "68705prt.mcu", 0x00800, 0x34cbb2d3, BRF_ESS | BRF_PRG }, // 5 M68705 MCU Program Code - - { "dt.20", 0x08000, 0x860b0298, BRF_GRA }, // 6 Characters - - { "dt.117", 0x10000, 0x750dd0fa, BRF_GRA }, // 7 Sprites - { "dt.116", 0x10000, 0x22cfa87b, BRF_GRA }, // 8 - { "dt.115", 0x10000, 0x8a9f1c34, BRF_GRA }, // 9 - { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 - { "dt.113", 0x10000, 0x7b4bbf9c, BRF_GRA }, // 11 - { "dt.112", 0x10000, 0xdf3709d4, BRF_GRA }, // 12 - { "dt.111", 0x10000, 0x59032154, BRF_GRA }, // 13 - { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 - - { "dt.78", 0x10000, 0x72c15604, BRF_GRA }, // 15 Tiles - { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 - { "dt.109", 0x10000, 0x15bdcb62, BRF_GRA }, // 17 - { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 - - { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples - { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 - - { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs - { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Darktowr) -STD_ROM_FN(Darktowr) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvHD6309Rom = Next; Next += 0x30000; - DrvSubCPURom = Next; Next += 0x04000; - DrvSoundCPURom = Next; Next += 0x08000; - DrvMSM5205Rom = Next; Next += 0x20000; - - RamStart = Next; - - DrvHD6309Ram = Next; Next += 0x01000; - DrvSubCPURam = Next; Next += 0x00fd0; - DrvSoundCPURam = Next; Next += 0x01000; - DrvFgVideoRam = Next; Next += 0x00800; - DrvSpriteRam = Next; Next += 0x01000; - DrvBgVideoRam = Next; Next += 0x00800; - DrvPaletteRam1 = Next; Next += 0x00200; - DrvPaletteRam2 = Next; Next += 0x00200; - - RamEnd = Next; - - DrvChars = Next; Next += 0x0400 * 8 * 8; - DrvTiles = Next; Next += 0x0800 * 16 * 16; - DrvSprites = Next; Next += 0x1000 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00180 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 Drv2MemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvHD6309Rom = Next; Next += 0x30000; - DrvSubCPURom = Next; Next += 0x10000; - DrvSoundCPURom = Next; Next += 0x08000; - MSM6295ROM = Next; Next += 0x40000; - - RamStart = Next; - - DrvHD6309Ram = Next; Next += 0x01800; - DrvSoundCPURam = Next; Next += 0x00800; - DrvFgVideoRam = Next; Next += 0x00800; - DrvSpriteRam = Next; Next += 0x01000; - DrvBgVideoRam = Next; Next += 0x00800; - DrvPaletteRam1 = Next; Next += 0x00200; - DrvPaletteRam2 = Next; Next += 0x00200; - - RamEnd = Next; - - DrvChars = Next; Next += 0x0800 * 8 * 8; - DrvTiles = Next; Next += 0x0800 * 16 * 16; - DrvSprites = Next; Next += 0x1800 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00180 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DarktowrMemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvHD6309Rom = Next; Next += 0x30000; - DrvSubCPURom = Next; Next += 0x04000; - DrvSoundCPURom = Next; Next += 0x08000; - DrvMCURom = Next; Next += 0x00800; - DrvMSM5205Rom = Next; Next += 0x20000; - - RamStart = Next; - - DrvHD6309Ram = Next; Next += 0x01000; - DrvSubCPURam = Next; Next += 0x00fd0; - DrvSoundCPURam = Next; Next += 0x01000; - DrvMCURam = Next; Next += 0x00078; - DrvMCUPorts = Next; Next += 0x00008; - DrvFgVideoRam = Next; Next += 0x00800; - DrvSpriteRam = Next; Next += 0x01000; - DrvBgVideoRam = Next; Next += 0x00800; - DrvPaletteRam1 = Next; Next += 0x00200; - DrvPaletteRam2 = Next; Next += 0x00200; - - RamEnd = Next; - - DrvChars = Next; Next += 0x0400 * 8 * 8; - DrvTiles = Next; Next += 0x0800 * 16 * 16; - DrvSprites = Next; Next += 0x1000 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00180 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - HD6309Open(0); - HD6309Reset(); - HD6309Close(); - - if (DrvSubCPUType == DD_CPU_TYPE_HD63701) { - HD63701Reset(); - } - - if (DrvSubCPUType == DD_CPU_TYPE_HD6309) { - HD6309Open(1); - HD6309Reset(); - HD6309Close(); - } - - if (DrvSubCPUType == DD_CPU_TYPE_M6803) { - M6803Reset(); - } - - if (DrvSubCPUType == DD_CPU_TYPE_Z80) { - ZetOpen(0); - ZetReset(); - ZetClose(); - } - - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { - M6809Open(0); - M6809Reset(); - M6809Close(); - - MSM5205Reset(); - } - - if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { - ZetOpen(1); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - } - - if (DrvGameType == DD_GAME_DARKTOWR) { - m68705Reset(); - } - - BurnYM2151Reset(); - - DrvRomBank = 0; - DrvVBlank = 0; - DrvSubCPUBusy = 1; - DrvSoundLatch = 0; - DrvScrollXHi = 0; - DrvScrollYHi = 0; - DrvScrollXLo = 0; - DrvScrollYLo = 0; - - DrvADPCMIdle[0] = 1; - DrvADPCMIdle[1] = 1; - DrvADPCMPos[0] = 0; - DrvADPCMPos[1] = 0; - DrvADPCMEnd[0] = 0; - DrvADPCMEnd[1] = 0; - DrvADPCMData[0] = -1; - DrvADPCMData[1] = -1; - - return 0; -} - -UINT8 DrvDdragonHD6309ReadByte(UINT16 Address) -{ - if (Address >= 0x2000 && Address <= 0x2fff) { - if (Address == 0x2049 && HD6309GetPC() == 0x6261 && DrvSpriteRam[0x0049] == 0x1f) return 0x01; - return DrvSpriteRam[Address - 0x2000]; - } - - if (DrvGameType == DD_GAME_DARKTOWR && Address >= 0x4000 && Address <= 0x7fff) { - UINT32 Offset = Address - 0x4000; - - if (Offset == 0x1401 || Offset == 0x0001) return DrvMCUPorts[0]; - return 0xff; - } - - switch (Address) { - case 0x3800: { - return DrvInput[0]; - } - - case 0x3801: { - return DrvInput[1]; - } - - case 0x3802: { - return DrvInput[2] | ((DrvVBlank) ? 0x08 : 0) | (DrvSubCPUBusy ? 0x10 : 0); - } - - case 0x3803: { - return DrvDip[0]; - } - - case 0x3804: { - return DrvDip[1]; - } - - case 0x380b: { - // ??? - return 0; - } - } - - bprintf(PRINT_NORMAL, _T("HD6309 Read Byte -> %04X\n"), Address); - - return 0; -} - -void DrvDdragonHD6309WriteByte(UINT16 Address, UINT8 Data) -{ - if (DrvGameType == DD_GAME_DARKTOWR && Address >= 0x4000 && Address <= 0x7fff) { - UINT32 Offset = Address - 0x4000; - - if (Offset == 0x1400 || Offset == 0x0000) { - DrvMCUPorts[1] = BITSWAP08(Data, 0, 1, 2, 3, 4, 5, 6, 7); - } - return; - } - - switch (Address) { - case 0x3808: { - UINT8 DrvOldRomBank = DrvRomBank; - DrvRomBank = (Data & 0xe0) >> 5; - HD6309MapMemory(DrvHD6309Rom + 0x8000 + (DrvRomBank * 0x4000), 0x4000, 0x7fff, M6809_ROM); - - DrvScrollXHi = (Data & 0x01) << 8; - DrvScrollYHi = (Data & 0x02) << 7; - - if (Data & 0x10) { - DrvSubCPUBusy = 0; - } else { - if (DrvSubCPUBusy == 0) { - if (DrvSubCPUType == DD_CPU_TYPE_HD63701) { - HD63701SetIRQLine(HD63701_INPUT_LINE_NMI, HD63701_IRQSTATUS_ACK); - } - - if (DrvSubCPUType == DD_CPU_TYPE_HD6309) { - HD6309Close(); - HD6309Open(1); - HD6309SetIRQLine(HD6309_INPUT_LINE_NMI, HD6309_IRQSTATUS_ACK); - HD6309Close(); - HD6309Open(0); - } - - if (DrvSubCPUType == DD_CPU_TYPE_M6803) { - M6803SetIRQLine(M6803_INPUT_LINE_NMI, M6803_IRQSTATUS_ACK); - } - - if (DrvSubCPUType == DD_CPU_TYPE_Z80) { - ZetOpen(0); - ZetNmi(); - ZetClose(); - } - } - } - - if (DrvGameType == DD_GAME_DARKTOWR) { - if (DrvRomBank == 4 && DrvOldRomBank != 4) { - HD6309MemCallback(0x4000, 0x7fff, HD6309_RAM); - } else { - if (DrvRomBank != 4 && DrvOldRomBank == 4) { - HD6309MapMemory(DrvHD6309Rom + 0x8000 + (DrvRomBank * 0x4000), 0x4000, 0x7fff, M6809_ROM); - } - } - } - - return; - } - - case 0x3809: { - DrvScrollXLo = Data; - return; - } - - case 0x380a: { - DrvScrollYLo = Data; - return; - } - - case 0x380b: { - HD6309SetIRQLine(HD6309_INPUT_LINE_NMI, HD6309_IRQSTATUS_NONE); - return; - } - - case 0x380c: { - HD6309SetIRQLine(HD6309_FIRQ_LINE, HD6309_IRQSTATUS_NONE); - return; - } - - case 0x380d: { - HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_NONE); - return; - } - - case 0x380e: { - DrvSoundLatch = Data; - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { - M6809Open(0); - M6809SetIRQLine(M6809_IRQ_LINE, M6809_IRQSTATUS_ACK); - M6809Close(); - } - - if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { - ZetOpen(1); - ZetNmi(); - ZetClose(); - } - return; - } - - case 0x380f: { - // ??? - return; - } - } - - bprintf(PRINT_NORMAL, _T("HD6309 Write Byte -> %04X, %02X\n"), Address, Data); -} - -UINT8 DrvDdragonHD63701ReadByte(UINT16 Address) -{ - if (Address >= 0x0020 && Address <= 0x0fff) { - return DrvSubCPURam[Address - 0x0020]; - } - - if (Address >= 0x8000 && Address <= 0x8fff) { - if (Address == 0x8049 && HD63701GetPC() == 0x6261 && DrvSpriteRam[0x0049] == 0x1f) return 0x01; - return DrvSpriteRam[Address - 0x8000]; - } - - bprintf(PRINT_NORMAL, _T("M6800 Read Byte -> %04X\n"), Address); - - return 0; -} - -void DrvDdragonHD63701WriteByte(UINT16 Address, UINT8 Data) -{ - if (Address <= 0x001f) { - if (Address == 0x17) { - if (Data & 3) { - HD6309Open(0); - HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_ACK); - HD6309Close(); - - HD63701SetIRQLine(HD63701_INPUT_LINE_NMI, HD63701_IRQSTATUS_NONE); - } - } - return; - } - - if (Address >= 0x0020 && Address <= 0x0fff) { - DrvSubCPURam[Address - 0x0020] = Data; - return; - } - - if (Address >= 0x8000 && Address <= 0x8fff) { - if (Address == 0x8000) DrvSubCPUBusy = 1; - DrvSpriteRam[Address - 0x8000] = Data; - return; - } - - bprintf(PRINT_NORMAL, _T("M6800 Write Byte -> %04X, %02X\n"), Address, Data); -} - -UINT8 DrvDdragonbSubHD6309ReadByte(UINT16 Address) -{ - if (Address >= 0x0020 && Address <= 0x0fff) { - return DrvSubCPURam[Address - 0x0020]; - } - - if (Address >= 0x8000 && Address <= 0x8fff) { - return DrvSpriteRam[Address - 0x8000]; - } - - bprintf(PRINT_NORMAL, _T("Sub HD6309 Read Byte -> %04X\n"), Address); - - return 0; -} - -void DrvDdragonbSubHD6309WriteByte(UINT16 Address, UINT8 Data) -{ - if (Address <= 0x001f) { - if (Address == 0x17) { - if (Data & 3) { - HD6309Close(); - - HD6309Open(0); - HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_ACK); - HD6309Close(); - - HD6309Open(1); - HD6309SetIRQLine(HD6309_INPUT_LINE_NMI, HD6309_IRQSTATUS_NONE); - } - } - return; - } - - if (Address >= 0x0020 && Address <= 0x0fff) { - DrvSubCPURam[Address - 0x0020] = Data; - return; - } - - if (Address >= 0x8000 && Address <= 0x8fff) { - if (Address == 0x8000) DrvSubCPUBusy = 1; - DrvSpriteRam[Address - 0x8000] = Data; - return; - } - - bprintf(PRINT_NORMAL, _T("Sub HD6309 Write Byte -> %04X, %02X\n"), Address, Data); -} - -UINT8 DrvDdragonbaM6803ReadByte(UINT16 Address) -{ - if (Address >= 0x0020 && Address <= 0x0fff) { - return DrvSubCPURam[Address - 0x0020]; - } - - if (Address >= 0x8000 && Address <= 0x8fff) { - return DrvSpriteRam[Address - 0x8000]; - } - - bprintf(PRINT_NORMAL, _T("M6803 Read Byte -> %04X\n"), Address); - - return 0; -} - -void DrvDdragonbaM6803WriteByte(UINT16 Address, UINT8 Data) -{ - if (Address >= 0x0020 && Address <= 0x0fff) { - DrvSubCPURam[Address - 0x0020] = Data; - return; - } - - if (Address >= 0x8000 && Address <= 0x8fff) { - if (Address == 0x8000) DrvSubCPUBusy = 1; - DrvSpriteRam[Address - 0x8000] = Data; - return; - } - - if (Address <= 0x001f) { - m6803_internal_registers_w(Address, Data); - return; - } - - bprintf(PRINT_NORMAL, _T("M6803 Write Byte -> %04X, %02X\n"), Address, Data); -} - -void DrvDdragonbaM6803WritePort(UINT16, UINT8) -{ - M6803SetIRQLine(M6803_INPUT_LINE_NMI, M6803_IRQSTATUS_NONE); - - HD6309Open(0); - HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_ACK); - HD6309Close(); -} - -void __fastcall Ddragon2SubZ80Write(UINT16 Address, UINT8 Data) -{ - if (Address >= 0xc000 && Address <= 0xc3ff) { - if (Address == 0xc000) DrvSubCPUBusy = 1; - DrvSpriteRam[Address - 0xc000] = Data; - return; - } - - switch (Address) { - case 0xd000: { - // Lower NMI - return; - } - - case 0xe000: { - HD6309Open(0); - HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_ACK); - HD6309Close(); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Sub Z80 Write => %04X, %02X\n"), Address, Data); - } - } -} - -UINT8 DrvDdragonM6809ReadByte(UINT16 Address) -{ - switch (Address) { - case 0x1000: { - M6809SetIRQLine(M6809_IRQ_LINE, M6809_IRQSTATUS_NONE); - return DrvSoundLatch; - } - - case 0x1800: { - return DrvADPCMIdle[0] + (DrvADPCMIdle[1] << 1); - } - - case 0x2801: { - return BurnYM2151ReadStatus(); - } - } - - bprintf(PRINT_NORMAL, _T("M6809 Read Byte -> %04X\n"), Address); - - return 0; -} - - -void DrvDdragonM6809WriteByte(UINT16 Address, UINT8 Data) -{ - switch (Address) { - case 0x2800: { - BurnYM2151SelectRegister(Data); - return; - } - - case 0x2801: { - BurnYM2151WriteRegister(Data); - return; - } - - case 0x3800: { - DrvADPCMIdle[0] = 0; - MSM5205ResetWrite(0, 0); - return; - } - - case 0x3801: { - DrvADPCMIdle[1] = 0; - MSM5205ResetWrite(1, 0); - return; - } - - case 0x3802: { - DrvADPCMEnd[0] = (Data & 0x7f) * 0x200; - return; - } - - case 0x3803: { - DrvADPCMEnd[1] = (Data & 0x7f) * 0x200; - return; - } - - case 0x3804: { - DrvADPCMPos[0] = (Data & 0x7f) * 0x200; - return; - } - - case 0x3805: { - DrvADPCMPos[1] = (Data & 0x7f) * 0x200; - return; - } - - case 0x3806: { - DrvADPCMIdle[0] = 1; - MSM5205ResetWrite(0, 1); - return; - } - - case 0x3807: { - DrvADPCMIdle[1] = 1; - MSM5205ResetWrite(1, 1); - return; - } - } - - bprintf(PRINT_NORMAL, _T("M6809 Write Byte -> %04X, %02X\n"), Address, Data); -} - -UINT8 __fastcall Ddragon2SoundZ80Read(UINT16 Address) -{ - switch (Address) { - case 0x8801: { - return BurnYM2151ReadStatus(); - } - - case 0x9800: { - return MSM6295ReadStatus(0); - } - - case 0xa000: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Sound Z80 Read => %04X\n"), Address); - } - } - - return 0; -} - -void __fastcall Ddragon2SoundZ80Write(UINT16 Address, UINT8 Data) -{ - switch (Address) { - case 0x8800: { - BurnYM2151SelectRegister(Data); - return; - } - - case 0x8801: { - BurnYM2151WriteRegister(Data); - return; - } - - case 0x9800: { - MSM6295Command(0, Data); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Sound Z80 Write => %04X, %02X\n"), Address, Data); - } - } -} - -UINT8 DrvMCUReadByte(UINT16 Address) -{ - if (Address <= 0x0007) { - return DrvMCUPorts[Address]; - } - - bprintf(PRINT_NORMAL, _T("M68705 Read Byte -> %04X\n"), Address); - - return 0; -} - -void DrvMCUWriteByte(UINT16 Address, UINT8 Data) -{ - if (Address <= 0x0007) { - DrvMCUPorts[Address] = Data; - return; - } - - bprintf(PRINT_NORMAL, _T("M68705 Write Byte -> %04X, %02X\n"), Address, Data); -} - -static INT32 CharPlaneOffsets[4] = { 0, 2, 4, 6 }; -static INT32 CharXOffsets[8] = { 1, 0, 65, 64, 129, 128, 193, 192 }; -static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 TilePlaneOffsets[4] = { 0x100000, 0x100004, 0, 4 }; -static INT32 DdungeonTilePlaneOffsets[4] = { 0x080000, 0x080004, 0, 4 }; -static INT32 TileXOffsets[16] = { 3, 2, 1, 0, 131, 130, 129, 128, 259, 258, 257, 256, 387, 386, 385, 384 }; -static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; -static INT32 SpritePlaneOffsets[4] = { 0x200000, 0x200004, 0, 4 }; -static INT32 Dd2SpritePlaneOffsets[4] = { 0x300000, 0x300004, 0, 4 }; - -static void DrvYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - M6809SetIRQLine(M6809_FIRQ_LINE, M6809_IRQSTATUS_ACK); -#if 1 - // This fixes music tempo but breaks MSM5205 sound if we use the M6809 for the MSM5205 timing, - // because the interleave run count is 190 cycles - nCyclesDone[2] += M6809Run(1000); -#endif - } else { - M6809SetIRQLine(M6809_FIRQ_LINE, M6809_IRQSTATUS_NONE); - } -} - -static void Ddragon2YM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)((double)HD6309TotalCycles() * nSoundRate / ((INT32)(nCyclesTotal[0] * 57.444853))); -} - -static void DrvMSM5205Vck0() -{ - if (DrvADPCMPos[0] >= DrvADPCMEnd[0] || DrvADPCMPos[0] >= 0x10000) { - DrvADPCMIdle[0] = 1; - MSM5205ResetWrite(0, 1); - } else { - if (DrvADPCMData[0] != -1) { - MSM5205DataWrite(0, DrvADPCMData[0] & 0x0f); - DrvADPCMData[0] = -1; - } else { - UINT8 *ROM = DrvMSM5205Rom + 0x00000; - - DrvADPCMData[0] = ROM[(DrvADPCMPos[0]++) & 0xffff]; - MSM5205DataWrite(0, DrvADPCMData[0] >> 4); - } - } -} - -static void DrvMSM5205Vck1() -{ - if (DrvADPCMPos[1] >= DrvADPCMEnd[1] || DrvADPCMPos[1] >= 0x10000) { - DrvADPCMIdle[1] = 1; - MSM5205ResetWrite(1, 1); - } else { - if (DrvADPCMData[1] != -1) { - MSM5205DataWrite(1, DrvADPCMData[1] & 0x0f); - DrvADPCMData[1] = -1; - } else { - UINT8 *ROM = DrvMSM5205Rom + 0x10000; - - DrvADPCMData[1] = ROM[(DrvADPCMPos[1]++) & 0xffff]; - MSM5205DataWrite(1, DrvADPCMData[1] >> 4); - } - } -} - -static INT32 DrvMemInit() -{ - INT32 nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - return 0; -} - -static INT32 Drv2MemInit() -{ - INT32 nLen; - - // Allocate and Blank all required memory - Mem = NULL; - Drv2MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - Drv2MemIndex(); - - return 0; -} - -static INT32 DarktowrMemInit() -{ - INT32 nLen; - - // Allocate and Blank all required memory - Mem = NULL; - DarktowrMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - DarktowrMemIndex(); - - return 0; -} - -static INT32 DrvLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load HD6309 Program Roms - nRet = BurnLoadRom(DrvHD6309Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvHD6309Rom + 0x08000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvHD6309Rom + 0x10000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvHD6309Rom + 0x18000, 3, 1); if (nRet != 0) return 1; - - // Load HD63701 Program Roms - nRet = BurnLoadRom(DrvSubCPURom + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load M6809 Program Roms - nRet = BurnLoadRom(DrvSoundCPURom + 0x00000, 5, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x70000, 14, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 18, 1); if (nRet != 0) return 1; - GfxDecode(0x800, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load samples - nRet = BurnLoadRom(DrvMSM5205Rom + 0x00000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvMSM5205Rom + 0x10000, 20, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 DrvbaLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load HD6309 Program Roms - nRet = BurnLoadRom(DrvHD6309Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvHD6309Rom + 0x08000, 1, 1); if (nRet != 0) return 1; - memcpy(DrvHD6309Rom + 0x18000, DrvHD6309Rom + 0x10000, 0x8000); - nRet = BurnLoadRom(DrvHD6309Rom + 0x10000, 2, 1); if (nRet != 0) return 1; - - // Load M6803 Program Roms - nRet = BurnLoadRom(DrvSubCPURom + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load M6809 Program Roms - nRet = BurnLoadRom(DrvSoundCPURom + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x70000, 13, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 17, 1); if (nRet != 0) return 1; - GfxDecode(0x800, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load samples - nRet = BurnLoadRom(DrvMSM5205Rom + 0x00000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvMSM5205Rom + 0x10000, 19, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 Drv2LoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0xc0000); - - // Load HD6309 Program Roms - nRet = BurnLoadRom(DrvHD6309Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvHD6309Rom + 0x08000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvHD6309Rom + 0x10000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvHD6309Rom + 0x18000, 3, 1); if (nRet != 0) return 1; - - // Load HD63701 Program Roms - nRet = BurnLoadRom(DrvSubCPURom + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load M6809 Program Roms - nRet = BurnLoadRom(DrvSoundCPURom + 0x00000, 5, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x800, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0xc0000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 12, 1); if (nRet != 0) return 1; - GfxDecode(0x1800, 4, 16, 16, Dd2SpritePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0xc0000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 14, 1); if (nRet != 0) return 1; - GfxDecode(0x800, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load samples - nRet = BurnLoadRom(MSM6295ROM + 0x00000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROM + 0x20000, 16, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 DdungeonLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load HD6309 Program Roms - nRet = BurnLoadRom(DrvHD6309Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvHD6309Rom + 0x08000, 1, 1); if (nRet != 0) return 1; - - // Load HD63701 Program Roms - nRet = BurnLoadRom(DrvSubCPURom + 0x00000, 2, 1); if (nRet != 0) return 1; - - // Load M6809 Program Roms - nRet = BurnLoadRom(DrvSoundCPURom + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load M68705 MCU Program Roms - nRet = BurnLoadRom(DrvMCURom + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 9, 1); if (nRet != 0) return 1; - GfxDecode(0x800, 4, 16, 16, DdungeonTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load samples - nRet = BurnLoadRom(DrvMSM5205Rom + 0x00000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvMSM5205Rom + 0x10000, 11, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 DarktowrLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load HD6309 Program Roms - nRet = BurnLoadRom(DrvHD6309Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvHD6309Rom + 0x08000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvHD6309Rom + 0x10000, 2, 1); if (nRet != 0) return 1; - - // Load HD63701 Program Roms - nRet = BurnLoadRom(DrvSubCPURom + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load M6809 Program Roms - nRet = BurnLoadRom(DrvSoundCPURom + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load M68705 MCU Program Roms - nRet = BurnLoadRom(DrvMCURom + 0x00000, 5, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x70000, 14, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 18, 1); if (nRet != 0) return 1; - GfxDecode(0x800, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load samples - nRet = BurnLoadRom(DrvMSM5205Rom + 0x00000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvMSM5205Rom + 0x10000, 20, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 DrvMachineInit() -{ - BurnSetRefreshRate(57.444853); - - // Setup the HD6309 emulation - if (DrvSubCPUType == DD_CPU_TYPE_HD6309) { - HD6309Init(2); - } else { - HD6309Init(1); - } - HD6309Open(0); - HD6309MapMemory(DrvHD6309Ram , 0x0000, 0x0fff, M6809_RAM); - HD6309MapMemory(DrvPaletteRam1 , 0x1000, 0x11ff, M6809_RAM); - HD6309MapMemory(DrvPaletteRam2 , 0x1200, 0x13ff, M6809_RAM); - HD6309MapMemory(DrvFgVideoRam , 0x1800, 0x1fff, M6809_RAM); - HD6309MapMemory(DrvSpriteRam , 0x2000, 0x2fff, M6809_WRITE); - HD6309MapMemory(DrvBgVideoRam , 0x3000, 0x37ff, M6809_RAM); - HD6309MapMemory(DrvHD6309Rom + 0x8000, 0x4000, 0x7fff, M6809_ROM); - HD6309MapMemory(DrvHD6309Rom , 0x8000, 0xffff, M6809_ROM); - HD6309SetReadHandler(DrvDdragonHD6309ReadByte); - HD6309SetWriteHandler(DrvDdragonHD6309WriteByte); - HD6309Close(); - - if (DrvSubCPUType == DD_CPU_TYPE_HD63701) { - HD63701Init(1); - HD63701MapMemory(DrvSubCPURom , 0xc000, 0xffff, HD63701_ROM); - HD63701SetReadHandler(DrvDdragonHD63701ReadByte); - HD63701SetWriteHandler(DrvDdragonHD63701WriteByte); - } - - if (DrvSubCPUType == DD_CPU_TYPE_HD6309) { - HD6309Open(1); - HD6309MapMemory(DrvSubCPURom , 0xc000, 0xffff, HD6309_ROM); - HD6309SetReadHandler(DrvDdragonbSubHD6309ReadByte); - HD6309SetWriteHandler(DrvDdragonbSubHD6309WriteByte); - HD6309Close(); - } - - if (DrvSubCPUType == DD_CPU_TYPE_M6803) { - M6803Init(1); - M6803MapMemory(DrvSubCPURom , 0xc000, 0xffff, M6803_ROM); - M6803SetReadHandler(DrvDdragonbaM6803ReadByte); - M6803SetWriteHandler(DrvDdragonbaM6803WriteByte); - M6803SetWritePortHandler(DrvDdragonbaM6803WritePort); - } - - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { - M6809Init(1); - M6809Open(0); - M6809MapMemory(DrvSoundCPURam , 0x0000, 0x0fff, M6809_RAM); - M6809MapMemory(DrvSoundCPURom , 0x8000, 0xffff, M6809_ROM); - M6809SetReadHandler(DrvDdragonM6809ReadByte); - M6809SetWriteHandler(DrvDdragonM6809WriteByte); - M6809Close(); - - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); - - MSM5205Init(0, DrvSynchroniseStream, 375000, DrvMSM5205Vck0, MSM5205_S48_4B, 1); - MSM5205Init(1, DrvSynchroniseStream, 375000, DrvMSM5205Vck1, MSM5205_S48_4B, 1); - MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - MSM5205SetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); - } - - if (DrvGameType == DD_GAME_DARKTOWR) { - m6805Init(1, 0x800); - m6805MapMemory(DrvMCURom + 0x80, 0x080, 0x7ff, M6805_ROM); - m6805MapMemory(DrvMCURom, 0x008, 0x07f, M6805_RAM); - m6805SetReadHandler(DrvMCUReadByte); - m6805SetWriteHandler(DrvMCUWriteByte); - } - - nCyclesTotal[0] = (INT32)((double)4000000 / 57.44853); - nCyclesTotal[1] = (INT32)((double)4000000 / 57.44853); - nCyclesTotal[2] = (INT32)((double)1500000 / 57.44853); - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 Drv2MachineInit() -{ - // Setup the HD6309 emulation - HD6309Init(1); - HD6309Open(0); - HD6309MapMemory(DrvHD6309Ram , 0x0000, 0x17ff, M6809_RAM); - HD6309MapMemory(DrvFgVideoRam , 0x1800, 0x1fff, M6809_RAM); - HD6309MapMemory(DrvSpriteRam , 0x2000, 0x2fff, M6809_WRITE); - HD6309MapMemory(DrvBgVideoRam , 0x3000, 0x37ff, M6809_RAM); - HD6309MapMemory(DrvPaletteRam1 , 0x3c00, 0x3dff, M6809_RAM); - HD6309MapMemory(DrvPaletteRam2 , 0x3e00, 0x3fff, M6809_RAM); - HD6309MapMemory(DrvHD6309Rom + 0x8000, 0x4000, 0x7fff, M6809_ROM); - HD6309MapMemory(DrvHD6309Rom , 0x8000, 0xffff, M6809_ROM); - HD6309SetReadHandler(DrvDdragonHD6309ReadByte); - HD6309SetWriteHandler(DrvDdragonHD6309WriteByte); - HD6309Close(); - - ZetInit(0); - ZetOpen(0); - ZetSetWriteHandler(Ddragon2SubZ80Write); - ZetMapArea(0x0000, 0xbfff, 0, DrvSubCPURom); - ZetMapArea(0x0000, 0xbfff, 2, DrvSubCPURom); - ZetMapArea(0xc000, 0xc3ff, 0, DrvSpriteRam); - ZetMapArea(0xc000, 0xc3ff, 2, DrvSpriteRam); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(Ddragon2SoundZ80Read); - ZetSetWriteHandler(Ddragon2SoundZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvSoundCPURom); - ZetMapArea(0x0000, 0x7fff, 2, DrvSoundCPURom); - ZetMapArea(0x8000, 0x87ff, 0, DrvSoundCPURam); - ZetMapArea(0x8000, 0x87ff, 1, DrvSoundCPURam); - ZetMapArea(0x8000, 0x87ff, 2, DrvSoundCPURam); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&Ddragon2YM2151IrqHandler); - BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 1056000 / 132, 1); - MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); - - BurnSetRefreshRate(57.444853); - - nCyclesTotal[0] = (INT32)((double)4000000 / 57.44853); - nCyclesTotal[1] = (INT32)((double)4000000 / 57.44853); - nCyclesTotal[2] = (INT32)((double)3579545 / 57.44853); - nCyclesTotal[3] = (INT32)((double)4000000 / 57.44853); - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 DrvInit() -{ - DrvSubCPUType = DD_CPU_TYPE_HD63701; - DrvSoundCPUType = DD_CPU_TYPE_M6809; - - if (DrvMemInit()) return 1; - if (DrvLoadRoms()) return 1; - if (DrvMachineInit()) return 1; - - return 0; -} - -static INT32 DrvbInit() -{ - DrvSubCPUType = DD_CPU_TYPE_HD6309; - DrvSoundCPUType = DD_CPU_TYPE_M6809; - - if (DrvMemInit()) return 1; - if (DrvLoadRoms()) return 1; - if (DrvMachineInit()) return 1; - - nCyclesTotal[1] = (INT32)((double)1500000 / 57.44853); - - return 0; -} - -static INT32 DrvbaInit() -{ - DrvSubCPUType = DD_CPU_TYPE_M6803; - DrvSoundCPUType = DD_CPU_TYPE_M6809; - - if (DrvMemInit()) return 1; - if (DrvbaLoadRoms()) return 1; - if (DrvMachineInit()) return 1; - - return 0; -} - -static INT32 Drv2Init() -{ - DrvSubCPUType = DD_CPU_TYPE_Z80; - DrvSoundCPUType = DD_CPU_TYPE_Z80; - DrvVidHardwareType = DD_VID_TYPE_DD2; - - if (Drv2MemInit()) return 1; - if (Drv2LoadRoms()) return 1; - if (Drv2MachineInit()) return 1; - - return 0; -} - -static INT32 DdungeonInit() -{ - DrvSubCPUType = DD_CPU_TYPE_HD63701; - DrvSoundCPUType = DD_CPU_TYPE_M6809; - DrvGameType = DD_GAME_DARKTOWR; - - if (DarktowrMemInit()) return 1; - if (DdungeonLoadRoms()) return 1; - if (DrvMachineInit()) return 1; - - return 0; -} - -static INT32 DarktowrInit() -{ - DrvSubCPUType = DD_CPU_TYPE_HD63701; - DrvSoundCPUType = DD_CPU_TYPE_M6809; - DrvGameType = DD_GAME_DARKTOWR; - - if (DarktowrMemInit()) return 1; - if (DarktowrLoadRoms()) return 1; - if (DrvMachineInit()) return 1; - - return 0; -} - -static INT32 DrvExit() -{ - HD6309Exit(); - if (DrvSubCPUType == DD_CPU_TYPE_M6803 || DrvSubCPUType == DD_CPU_TYPE_HD63701) M6800Exit(); - if (DrvGameType == DD_GAME_DARKTOWR) m6805Exit(); - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) M6809Exit(); - if (DrvSubCPUType == DD_CPU_TYPE_Z80 || DrvSoundCPUType == DD_CPU_TYPE_Z80) ZetExit(); - - BurnYM2151Exit(); - if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { - MSM6295Exit(0); - } else { - MSM5205Exit(); - } - - GenericTilesExit(); - - BurnFree(Mem); - - DrvRomBank = 0; - DrvVBlank = 0; - DrvSubCPUBusy = 0; - DrvSoundLatch = 0; - DrvScrollXHi = 0; - DrvScrollYHi = 0; - DrvScrollXLo = 0; - DrvScrollYLo = 0; - - DrvADPCMIdle[0] = 0; - DrvADPCMIdle[1] = 0; - DrvADPCMPos[0] = 0; - DrvADPCMPos[1] = 0; - DrvADPCMEnd[0] = 0; - DrvADPCMEnd[1] = 0; - DrvADPCMData[0] = 0; - DrvADPCMData[1] = 0; - - DrvSubCPUType = DD_CPU_TYPE_NONE; - DrvSoundCPUType = DD_CPU_TYPE_NONE; - DrvVidHardwareType = 0; - DrvGameType = 0; - - return 0; -} - -static inline UINT8 pal4bit(UINT8 bits) -{ - bits &= 0x0f; - return (bits << 4) | bits; -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(nColour >> 0); - g = pal4bit(nColour >> 4); - b = pal4bit(nColour >> 8); - - return BurnHighCol(r, g, b, 0); -} - -static void DrvCalcPalette() -{ - for (INT32 i = 0; i < 0x180; i++) { - INT32 Val = DrvPaletteRam1[i] + (DrvPaletteRam2[i] << 8); - - DrvPalette[i] = CalcCol(Val); - } -} - -static void DrvRenderBgLayer() -{ - INT32 mx, my, Code, Attr, Colour, x, y, TileIndex, xScroll, yScroll, Flip, xFlip, yFlip; - - xScroll = DrvScrollXHi + DrvScrollXLo; - xScroll &= 0x1ff; - - yScroll = DrvScrollYHi + DrvScrollYLo; - yScroll &= 0x1ff; - - for (mx = 0; mx < 32; mx++) { - for (my = 0; my < 32; my++) { - TileIndex = (my & 0x0f) + ((mx & 0x0f) << 4) + ((my & 0x10) << 4) + ((mx & 0x10) << 5); - - Attr = DrvBgVideoRam[(2 * TileIndex) + 0]; - Code = DrvBgVideoRam[(2 * TileIndex) + 1] + ((Attr & 0x07) << 8); - Colour = (Attr >> 3) & 0x07; - Flip = (Attr & 0xc0) >> 6; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - - y = 16 * mx; - x = 16 * my; - - x -= xScroll; - if (x < -16) x += 512; - - y -= yScroll; - if (y < -16) y += 512; - - y -= 8; - - if (x > 16 && x < 240 && y > 16 && y < 224) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } else { - Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } else { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } else { - Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } - } - } - } - } -} - -#define DRAW_SPRITE(Order, sx, sy) \ - if (sx > 16 && sx < 240 && sy > 16 && sy < 224) { \ - if (xFlip) { \ - if (yFlip) { \ - Render16x16Tile_Mask_FlipXY(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ - } else { \ - Render16x16Tile_Mask_FlipX(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ - } \ - } else { \ - if (yFlip) { \ - Render16x16Tile_Mask_FlipY(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ - } else { \ - Render16x16Tile_Mask(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ - } \ - } \ - } else { \ - if (xFlip) { \ - if (yFlip) { \ - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ - } else { \ - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ - } \ - } else { \ - if (yFlip) { \ - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ - } else { \ - Render16x16Tile_Mask_Clip(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ - } \ - } \ - } - -static void DrvRenderSpriteLayer() -{ - UINT8 *Src = &DrvSpriteRam[0x800]; - - for (INT32 i = 0; i < (64 * 5); i += 5) { - INT32 Attr = Src[i + 1]; - - if (Attr & 0x80) { - INT32 sx = 240 - Src[i + 4] + ((Attr & 2) << 7); - INT32 sy = 232 - Src[i + 0] + ((Attr & 1) << 8); - INT32 Size = (Attr & 0x30) >> 4; - INT32 xFlip = Attr & 0x08; - INT32 yFlip = Attr & 0x04; - INT32 dx = -16; - INT32 dy = -16; - - INT32 Colour; - INT32 Code; - - if (DrvVidHardwareType == DD_VID_TYPE_DD2) { - Colour = (Src[i + 2] >> 5); - Code = Src[i + 3] + ((Src[i + 2] & 0x1f) << 8); - } else { - Colour = (Src[i + 2] >> 4) & 0x07; - Code = Src[i + 3] + ((Src[i + 2] & 0x0f) << 8); - } - - Code &= ~Size; - - switch (Size) { - case 0: { - DRAW_SPRITE(0, sx, sy) - break; - } - - case 1: { - DRAW_SPRITE(0, sx, sy + dy) - DRAW_SPRITE(1, sx, sy) - break; - } - - case 2: { - DRAW_SPRITE(0, sx + dx, sy) - DRAW_SPRITE(2, sx, sy) - break; - } - - case 3: { - DRAW_SPRITE(0, sx + dx, sy + dy) - DRAW_SPRITE(1, sx + dx, sy) - DRAW_SPRITE(2, sx, sy + dy) - DRAW_SPRITE(3, sx, sy) - break; - } - } - } - } -} - -#undef DRAW_SPRITE - -static void DrvRenderCharLayer() -{ - INT32 mx, my, Code, Attr, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Attr = DrvFgVideoRam[(2 * TileIndex) + 0]; - Code = DrvFgVideoRam[(2 * TileIndex) + 1] + ((Attr & 0x07) << 8); - if (DrvVidHardwareType != DD_VID_TYPE_DD2) Code &= 0x3ff; - - Colour = Attr >> 5; - - x = 8 * mx; - y = 8 * my; - - y -= 8; - - if (x > 0 && x < 248 && y > 0 && y < 232) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvChars); - } - - TileIndex++; - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - DrvRenderBgLayer(); - DrvRenderSpriteLayer(); - DrvRenderCharLayer(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 272; - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) nInterleave = MSM5205CalcInterleave(0, (INT32)(nCyclesTotal[0] * 57.444853)); - INT32 nSoundBufferPos = 0; - - INT32 VBlankSlice = (INT32)((double)(nInterleave * 240) / 272); - INT32 FIRQFireSlice[16]; - for (INT32 i = 0; i < 16; i++) { - FIRQFireSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 17)); - } - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - UINT32 nCyclesToDo[2]; - nCyclesToDo[0] = (INT32)((double)nCyclesTotal[0] * nBurnCPUSpeedAdjust / 0x0100); - nCyclesToDo[1] = (INT32)((double)nCyclesTotal[1] * nBurnCPUSpeedAdjust / 0x0100); - - nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = nCyclesDone[3] = 0; - - HD6309NewFrame(); - if (DrvSubCPUType == DD_CPU_TYPE_HD63701) HD63701NewFrame(); - if (DrvSubCPUType == DD_CPU_TYPE_M6803) M6803NewFrame(); - if (DrvSubCPUType == DD_CPU_TYPE_Z80 || DrvSoundCPUType == DD_CPU_TYPE_Z80) ZetNewFrame(); - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) M6809NewFrame(); - if (DrvGameType == DD_GAME_DARKTOWR) m6805NewFrame(); - - DrvVBlank = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - HD6309Open(0); - nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += HD6309Run(nCyclesSegment); - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) MSM5205Update(); - HD6309Close(); - - if (DrvSubCPUType == DD_CPU_TYPE_HD63701) { - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = HD63701Run(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - } - - if (DrvSubCPUType == DD_CPU_TYPE_HD6309) { - nCurrentCPU = 1; - HD6309Open(1); - nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = HD6309Run(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - HD6309Close(); - } - - if (DrvSubCPUType == DD_CPU_TYPE_M6803) { - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = M6803Run(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - } - - if (DrvSubCPUType == DD_CPU_TYPE_Z80) { - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - } - - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { - nCurrentCPU = 2; - M6809Open(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += M6809Run(nCyclesSegment); - M6809Close(); - } - - if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { - nCurrentCPU = 2; - ZetOpen(1); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - } - - if (DrvGameType == DD_GAME_DARKTOWR) { - nCurrentCPU = 3; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = m6805Run(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - } - - if (i == VBlankSlice) { - DrvVBlank = 1; - HD6309Open(0); - HD6309SetIRQLine(HD6309_INPUT_LINE_NMI, HD6309_IRQSTATUS_ACK); - HD6309Close(); - } - - for (INT32 j = 0; j < 16; j++) { - if (i == FIRQFireSlice[j]) { - HD6309Open(0); - HD6309SetIRQLine(HD6309_FIRQ_LINE, HD6309_IRQSTATUS_ACK); - HD6309Close(); - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { - M6809Open(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - M6809Close(); - } - - if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { - ZetOpen(1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { - M6809Open(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - M6809Close(); - } - - if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { - ZetOpen(1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - } - - if (DrvSoundCPUType == DD_CPU_TYPE_M6809 && pBurnSoundOut) { - M6809Open(0); - MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - MSM5205Render(1, pBurnSoundOut, nBurnSoundLen); - M6809Close(); - } - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029719; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - HD6309Scan(nAction); - - if (DrvSubCPUType == DD_CPU_TYPE_HD63701) HD63701Scan(nAction); - if (DrvSubCPUType == DD_CPU_TYPE_M6803) M6803Scan(nAction); - if (DrvSubCPUType == DD_CPU_TYPE_Z80 || DrvSoundCPUType == DD_CPU_TYPE_Z80) ZetScan(nAction); - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) M6809Scan(nAction); - if (DrvGameType == DD_GAME_DARKTOWR) m68705Scan(nAction, pnMin); - - BurnYM2151Scan(nAction); - if (DrvSoundCPUType == DD_CPU_TYPE_Z80) MSM6295Scan(0, nAction); - if (DrvSoundCPUType == DD_CPU_TYPE_M6809) MSM5205Scan(nAction, pnMin); - - SCAN_VAR(DrvRomBank); - SCAN_VAR(DrvVBlank); - SCAN_VAR(DrvSubCPUBusy); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(DrvScrollXHi); - SCAN_VAR(DrvScrollYHi); - SCAN_VAR(DrvScrollXLo); - SCAN_VAR(DrvScrollYLo); - SCAN_VAR(DrvADPCMIdle); - SCAN_VAR(DrvADPCMPos); - SCAN_VAR(DrvADPCMEnd); - SCAN_VAR(DrvADPCMData); - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - - if (nAction & ACB_WRITE) { - HD6309Open(0); - HD6309MapMemory(DrvHD6309Rom + 0x8000 + (DrvRomBank * 0x4000), 0x4000, 0x7fff, M6809_ROM); - HD6309Close(); - - if (DrvSubCPUBusy == 0) { - if (DrvSubCPUType == DD_CPU_TYPE_HD63701) { - HD63701SetIRQLine(HD63701_INPUT_LINE_NMI, HD63701_IRQSTATUS_ACK); - } - - if (DrvSubCPUType == DD_CPU_TYPE_M6803) { - M6803SetIRQLine(M6803_INPUT_LINE_NMI, M6803_IRQSTATUS_ACK); - } - } - } - } - - return 0; -} - -struct BurnDriver BurnDrvDdragon = { - "ddragon", NULL, NULL, NULL, "1987", - "Double Dragon (Japan)\0", NULL, "Technos", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdragonw = { - "ddragonw", "ddragon", NULL, NULL, "1987", - "Double Dragon (World set 1)\0", NULL, "[Technos] (Taito license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvwRomInfo, DrvwRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdragnw1 = { - "ddragonw1", "ddragon", NULL, NULL, "1987", - "Double Dragon (World set 2)\0", NULL, "[Technos] (Taito license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, Drvw1RomInfo, Drvw1RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdragonu = { - "ddragonu", "ddragon", NULL, NULL, "1987", - "Double Dragon (US set 1)\0", NULL, "[Technos] (Taito America license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvuRomInfo, DrvuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdragoua = { - "ddragonua", "ddragon", NULL, NULL, "1987", - "Double Dragon (US set 2)\0", NULL, "[Technos] (Taito America license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvuaRomInfo, DrvuaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdragoub = { - "ddragonub", "ddragon", NULL, NULL, "1987", - "Double Dragon (US set 3)\0", NULL, "[Technos] (Taito America license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvubRomInfo, DrvubRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdragob2 = { - "ddragonb2", "ddragon", NULL, NULL, "1987", - "Double Dragon (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, Drvb2RomInfo, Drvb2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdragonb = { - "ddragonb", "ddragon", NULL, NULL, "1987", - "Double Dragon (bootleg with HD6309)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvbInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdragnba = { - "ddragonba", "ddragon", NULL, NULL, "1987", - "Double Dragon (bootleg with M6803)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvbaRomInfo, DrvbaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvbaInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdragon2 = { - "ddragon2", NULL, NULL, NULL, "1988", - "Double Dragon II - The Revenge (World)\0", NULL, "Technos", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, Drv2RomInfo, Drv2RomName, NULL, NULL, DrvInputInfo, Drv2DIPInfo, - Drv2Init, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdragon2u = { - "ddragon2u", "ddragon2", NULL, NULL, "1988", - "Double Dragon II - The Revenge (US)\0", NULL, "Technos", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, Drv2uRomInfo, Drv2uRomName, NULL, NULL, DrvInputInfo, Drv2DIPInfo, - Drv2Init, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriverD BurnDrvDdungeon = { - "ddungeon", NULL, NULL, NULL, "1992", - "Dangerous Dungeons\0", NULL, "Game Room", "Miscellaneous", - NULL, NULL, NULL, NULL, - 0, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DdungeonRomInfo, DdungeonRomName, NULL, NULL, DrvInputInfo, DdungeonDIPInfo, - DdungeonInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDarktowr = { - "darktowr", NULL, NULL, NULL, "1992", - "Dark Tower\0", NULL, "Game Room", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DarktowrRomInfo, DarktowrRomName, NULL, NULL, DrvInputInfo, DarktowrDIPInfo, - DarktowrInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x180, 256, 240, 4, 3 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "hd6309_intf.h" +#include "m6800_intf.h" +#include "m6805_intf.h" +#include "m6809_intf.h" +#include "burn_ym2151.h" +#include "msm5205.h" +#include "msm6295.h" +#include "bitswap.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[2] = {0, 0}; +static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *DrvHD6309Rom = NULL; +static UINT8 *DrvSubCPURom = NULL; +static UINT8 *DrvSoundCPURom = NULL; +static UINT8 *DrvMCURom = NULL; +static UINT8 *DrvMSM5205Rom = NULL; +static UINT8 *DrvHD6309Ram = NULL; +static UINT8 *DrvSubCPURam = NULL; +static UINT8 *DrvSoundCPURam = NULL; +static UINT8 *DrvMCURam = NULL; +static UINT8 *DrvMCUPorts = NULL; +static UINT8 *DrvFgVideoRam = NULL; +static UINT8 *DrvBgVideoRam = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvPaletteRam1 = NULL; +static UINT8 *DrvPaletteRam2 = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT8 DrvRomBank; +static UINT8 DrvVBlank; +static UINT8 DrvSubCPUBusy; +static UINT8 DrvSoundLatch; +static UINT8 DrvADPCMIdle[2]; +static UINT32 DrvADPCMPos[2]; +static UINT32 DrvADPCMEnd[2]; +static INT32 DrvADPCMData[2]; + +static UINT16 DrvScrollXHi; +static UINT16 DrvScrollYHi; +static UINT8 DrvScrollXLo; +static UINT8 DrvScrollYLo; + +static INT32 nCyclesDone[4], nCyclesTotal[4]; +static INT32 nCyclesSegment; + +#define DD_CPU_TYPE_NONE 0 +#define DD_CPU_TYPE_HD63701 1 +#define DD_CPU_TYPE_HD6309 2 +#define DD_CPU_TYPE_M6803 3 +#define DD_CPU_TYPE_Z80 4 +#define DD_CPU_TYPE_M6809 5 +static INT32 DrvSubCPUType; +static INT32 DrvSoundCPUType; + +#define DD_VID_TYPE_DD2 1 +static INT32 DrvVidHardwareType; + +#define DD_GAME_DARKTOWR 1 +static INT32 DrvGameType; + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 1, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort2 + 0, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = 0xff; + DrvInput[2] = 0xe7; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] -= (DrvInputPort0[i] & 1) << i; + DrvInput[1] -= (DrvInputPort1[i] & 1) << i; + DrvInput[2] -= (DrvInputPort2[i] & 1) << i; + } +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x14, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, + {0x14, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, + {0x14, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x14, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x14, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x14, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x14, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x14, 0x01, 0x07, 0x03, "1 Coin 5 Plays" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x14, 0x01, 0x38, 0x00, "4 Coins 1 Play" }, + {0x14, 0x01, 0x38, 0x08, "3 Coins 1 Play" }, + {0x14, 0x01, 0x38, 0x10, "2 Coins 1 Play" }, + {0x14, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x14, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x14, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, + {0x14, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, + {0x14, 0x01, 0x38, 0x18, "1 Coin 5 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x40, 0x40, "Upright" }, + {0x14, 0x01, 0x40, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x03, 0x01, "Easy" }, + {0x15, 0x01, 0x03, 0x03, "Medium" }, + {0x15, 0x01, 0x03, 0x02, "Hard" }, + {0x15, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x04, 0x00, "Off" }, + {0x15, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x15, 0x01, 0x30, 0x10, "20k" }, + {0x15, 0x01, 0x30, 0x00, "40k" }, + {0x15, 0x01, 0x30, 0x30, "30k and every 60k" }, + {0x15, 0x01, 0x30, 0x20, "40k and every 80k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0xc0, 0xc0, "2" }, + {0x15, 0x01, 0xc0, 0x80, "3" }, + {0x15, 0x01, 0xc0, 0x40, "4" }, + {0x15, 0x01, 0xc0, 0x00, "Infinite" }, +}; + +STDDIPINFO(Drv) + +static struct BurnDIPInfo Drv2DIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x14, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, + {0x14, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, + {0x14, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x14, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x14, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x14, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x14, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x14, 0x01, 0x07, 0x03, "1 Coin 5 Plays" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x14, 0x01, 0x38, 0x00, "4 Coins 1 Play" }, + {0x14, 0x01, 0x38, 0x08, "3 Coins 1 Play" }, + {0x14, 0x01, 0x38, 0x10, "2 Coins 1 Play" }, + {0x14, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x14, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x14, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, + {0x14, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, + {0x14, 0x01, 0x38, 0x18, "1 Coin 5 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x40, 0x40, "Upright" }, + {0x14, 0x01, 0x40, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Hurricane Kick" }, + {0x15, 0x01, 0x08, 0x00, "Easy" }, + {0x15, 0x01, 0x08, 0x08, "Normal" }, + + {0 , 0xfe, 0 , 4 , "Timer" }, + {0x15, 0x01, 0x30, 0x00, "60" }, + {0x15, 0x01, 0x30, 0x10, "65" }, + {0x15, 0x01, 0x30, 0x30, "70" }, + {0x15, 0x01, 0x30, 0x20, "80" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0xc0, 0xc0, "1" }, + {0x15, 0x01, 0xc0, 0x80, "2" }, + {0x15, 0x01, 0xc0, 0x40, "3" }, + {0x15, 0x01, 0xc0, 0x00, "4" }, +}; + +STDDIPINFO(Drv2) + +static struct BurnDIPInfo DdungeonDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0x9d, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x14, 0x01, 0x0f, 0x03, "4 Coins 1 Play" }, + {0x14, 0x01, 0x0f, 0x02, "3 Coins 1 Play" }, + {0x14, 0x01, 0x0f, 0x07, "4 Coins 2 Plays" }, + {0x14, 0x01, 0x0f, 0x01, "2 Coins 1 Play" }, + {0x14, 0x01, 0x0f, 0x06, "3 Coins 2 Plays" }, + {0x14, 0x01, 0x0f, 0x0b, "4 Coins 3 Plays" }, + {0x14, 0x01, 0x0f, 0x0f, "4 Coins 4 Plays" }, + {0x14, 0x01, 0x0f, 0x0a, "3 Coins 3 Plays" }, + {0x14, 0x01, 0x0f, 0x05, "2 Coins 2 Plays" }, + {0x14, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, + {0x14, 0x01, 0x0f, 0x0e, "3 Coins 4 Plays" }, + {0x14, 0x01, 0x0f, 0x09, "2 Coins 3 Plays" }, + {0x14, 0x01, 0x0f, 0x0d, "2 Coins 4 Plays" }, + {0x14, 0x01, 0x0f, 0x04, "1 Coin 2 Plays" }, + {0x14, 0x01, 0x0f, 0x08, "1 Coin 3 Plays" }, + {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x14, 0x01, 0xf0, 0x30, "4 Coins 1 Play" }, + {0x14, 0x01, 0xf0, 0x20, "3 Coins 1 Play" }, + {0x14, 0x01, 0xf0, 0x70, "4 Coins 2 Plays" }, + {0x14, 0x01, 0xf0, 0x10, "2 Coins 1 Play" }, + {0x14, 0x01, 0xf0, 0x60, "3 Coins 2 Plays" }, + {0x14, 0x01, 0xf0, 0xb0, "4 Coins 3 Plays" }, + {0x14, 0x01, 0xf0, 0xf0, "4 Coins 4 Plays" }, + {0x14, 0x01, 0xf0, 0xa0, "3 Coins 3 Plays" }, + {0x14, 0x01, 0xf0, 0x50, "2 Coins 2 Plays" }, + {0x14, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, + {0x14, 0x01, 0xf0, 0xe0, "3 Coins 4 Plays" }, + {0x14, 0x01, 0xf0, 0x90, "2 Coins 3 Plays" }, + {0x14, 0x01, 0xf0, 0xd0, "2 Coins 4 Plays" }, + {0x14, 0x01, 0xf0, 0x40, "1 Coin 2 Plays" }, + {0x14, 0x01, 0xf0, 0x80, "1 Coin 3 Plays" }, + {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x03, 0x00, "1" }, + {0x15, 0x01, 0x03, 0x01, "2" }, + {0x15, 0x01, 0x03, 0x02, "3" }, + {0x15, 0x01, 0x03, 0x03, "4" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0xf0, 0xf0, "Easy" }, + {0x15, 0x01, 0xf0, 0x90, "Medium" }, + {0x15, 0x01, 0xf0, 0x70, "Hard" }, + {0x15, 0x01, 0xf0, 0x00, "Hardest" }, +}; + +STDDIPINFO(Ddungeon) + +static struct BurnDIPInfo DarktowrDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x14, 0x01, 0x0f, 0x03, "4 Coins 1 Play" }, + {0x14, 0x01, 0x0f, 0x02, "3 Coins 1 Play" }, + {0x14, 0x01, 0x0f, 0x07, "4 Coins 2 Plays" }, + {0x14, 0x01, 0x0f, 0x01, "2 Coins 1 Play" }, + {0x14, 0x01, 0x0f, 0x06, "3 Coins 2 Plays" }, + {0x14, 0x01, 0x0f, 0x0b, "4 Coins 3 Plays" }, + {0x14, 0x01, 0x0f, 0x0f, "4 Coins 4 Plays" }, + {0x14, 0x01, 0x0f, 0x0a, "3 Coins 3 Plays" }, + {0x14, 0x01, 0x0f, 0x05, "2 Coins 2 Plays" }, + {0x14, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, + {0x14, 0x01, 0x0f, 0x0e, "3 Coins 4 Plays" }, + {0x14, 0x01, 0x0f, 0x09, "2 Coins 3 Plays" }, + {0x14, 0x01, 0x0f, 0x0d, "2 Coins 4 Plays" }, + {0x14, 0x01, 0x0f, 0x04, "1 Coin 2 Plays" }, + {0x14, 0x01, 0x0f, 0x08, "1 Coin 3 Plays" }, + {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x14, 0x01, 0xf0, 0x30, "4 Coins 1 Play" }, + {0x14, 0x01, 0xf0, 0x20, "3 Coins 1 Play" }, + {0x14, 0x01, 0xf0, 0x70, "4 Coins 2 Plays" }, + {0x14, 0x01, 0xf0, 0x10, "2 Coins 1 Play" }, + {0x14, 0x01, 0xf0, 0x60, "3 Coins 2 Plays" }, + {0x14, 0x01, 0xf0, 0xb0, "4 Coins 3 Plays" }, + {0x14, 0x01, 0xf0, 0xf0, "4 Coins 4 Plays" }, + {0x14, 0x01, 0xf0, 0xa0, "3 Coins 3 Plays" }, + {0x14, 0x01, 0xf0, 0x50, "2 Coins 2 Plays" }, + {0x14, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, + {0x14, 0x01, 0xf0, 0xe0, "3 Coins 4 Plays" }, + {0x14, 0x01, 0xf0, 0x90, "2 Coins 3 Plays" }, + {0x14, 0x01, 0xf0, 0xd0, "2 Coins 4 Plays" }, + {0x14, 0x01, 0xf0, 0x40, "1 Coin 2 Plays" }, + {0x14, 0x01, 0xf0, 0x80, "1 Coin 3 Plays" }, + {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, +}; + +STDDIPINFO(Darktowr) + +static struct BurnRomInfo DrvRomDesc[] = { + { "21j-1-5.26", 0x08000, 0x42045dfd, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "21j-2-3.25", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 + { "21j-3.24", 0x08000, 0x3bdea613, BRF_ESS | BRF_PRG }, // 2 + { "21j-4-1.23", 0x08000, 0x728f87b9, BRF_ESS | BRF_PRG }, // 3 + + { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code + + { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code + + { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters + + { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites + { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 + { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 + { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 + { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 + { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 + { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 + { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 + + { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles + { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 + { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 + { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 + + { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples + { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo DrvwRomDesc[] = { + { "21j-1.26", 0x08000, 0xae714964, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "21j-2-3.25", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 + { "21a-3.24", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 + { "21j-4.23", 0x08000, 0x6c9f46fa, BRF_ESS | BRF_PRG }, // 3 + + { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code + + { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code + + { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters + + { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites + { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 + { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 + { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 + { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 + { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 + { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 + { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 + + { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles + { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 + { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 + { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 + + { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples + { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Drvw) +STD_ROM_FN(Drvw) + +static struct BurnRomInfo Drvw1RomDesc[] = { + { "e1-1.26", 0x08000, 0x4b951643, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "21a-2-4.25", 0x08000, 0x5cd67657, BRF_ESS | BRF_PRG }, // 1 + { "21a-3.24", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 + { "e4-1.23", 0x08000, 0xb1e26935, BRF_ESS | BRF_PRG }, // 3 + + { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code + + { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code + + { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters + + { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites + { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 + { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 + { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 + { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 + { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 + { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 + { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 + + { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles + { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 + { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 + { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 + + { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples + { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Drvw1) +STD_ROM_FN(Drvw1) + +static struct BurnRomInfo DrvuRomDesc[] = { + { "21a-1-5.26", 0x08000, 0xe24a6e11, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "21j-2-3.25", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 + { "21a-3.24", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 + { "21a-4.23", 0x08000, 0x6ea16072, BRF_ESS | BRF_PRG }, // 3 + + { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code + + { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code + + { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters + + { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites + { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 + { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 + { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 + { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 + { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 + { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 + { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 + + { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles + { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 + { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 + { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 + + { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples + { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Drvu) +STD_ROM_FN(Drvu) + +static struct BurnRomInfo DrvuaRomDesc[] = { + { "21a-1", 0x08000, 0x1d625008, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "21a-2_4", 0x08000, 0x5cd67657, BRF_ESS | BRF_PRG }, // 1 + { "21a-3", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 + { "21a-4_2", 0x08000, 0x9b019598, BRF_ESS | BRF_PRG }, // 3 + + { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code + + { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code + + { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters + + { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites + { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 + { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 + { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 + { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 + { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 + { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 + { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 + + { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles + { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 + { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 + { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 + + { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples + { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Drvua) +STD_ROM_FN(Drvua) + +static struct BurnRomInfo DrvubRomDesc[] = { + { "21a-1_6.bin", 0x08000, 0xf354b0e1, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "21a-2_4", 0x08000, 0x5cd67657, BRF_ESS | BRF_PRG }, // 1 + { "21a-3", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 + { "21a-4_2", 0x08000, 0x9b019598, BRF_ESS | BRF_PRG }, // 3 + + { "21jm-0.ic55", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code + + { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code + + { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters + + { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites + { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 + { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 + { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 + { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 + { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 + { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 + { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 + + { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles + { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 + { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 + { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 + + { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples + { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Drvub) +STD_ROM_FN(Drvub) + +static struct BurnRomInfo Drvb2RomDesc[] = { + { "b2_4.bin", 0x08000, 0x668dfa19, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "b2_5.bin", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 + { "b2_6.bin", 0x08000, 0x3bdea613, BRF_ESS | BRF_PRG }, // 2 + { "b2_7.bin", 0x08000, 0x728f87b9, BRF_ESS | BRF_PRG }, // 3 + + { "63701.bin", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 4 HD63701 Program Code + + { "b2_3.bin", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code + + { "b2_8.bin", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters + + { "11.bin", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites + { "12.bin", 0x10000, 0x40507a76, BRF_GRA }, // 8 + { "13.bin", 0x10000, 0xc8b91e17, BRF_GRA }, // 9 + { "14.bin", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 + { "15.bin", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 + { "16.bin", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 + { "17.bin", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 + { "18.bin", 0x10000, 0x65c7517d, BRF_GRA }, // 14 + + { "9.bin", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles + { "10.bin", 0x10000, 0xc6640aed, BRF_GRA }, // 16 + { "19.bin", 0x10000, 0x22d65df2, BRF_GRA }, // 17 + { "20.bin", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 + + { "b2_1.bin", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples + { "2.bin", 0x10000, 0x904de6f8, BRF_GRA }, // 20 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Drvb2) +STD_ROM_FN(Drvb2) + +static struct BurnRomInfo DrvbRomDesc[] = { + { "21j-1.26", 0x08000, 0xae714964, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "21j-2-3.25", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 + { "21a-3.24", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 + { "21j-4.23", 0x08000, 0x6c9f46fa, BRF_ESS | BRF_PRG }, // 3 + + { "ic38", 0x04000, 0x6a6a0325, BRF_ESS | BRF_PRG }, // 4 HD6309 Program Code + + { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 5 M6809 Program Code + + { "21j-5", 0x08000, 0x7a8b8db4, BRF_GRA }, // 6 Characters + + { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 7 Sprites + { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 8 + { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 9 + { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 + { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 11 + { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 12 + { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 13 + { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 + + { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 15 Tiles + { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 + { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 17 + { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 + + { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples + { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Drvb) +STD_ROM_FN(Drvb) + +static struct BurnRomInfo DrvbaRomDesc[] = { + { "5.bin", 0x08000, 0xae714964, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "4.bin", 0x10000, 0x48045762, BRF_ESS | BRF_PRG }, // 1 + { "3.bin", 0x08000, 0xdbf24897, BRF_ESS | BRF_PRG }, // 2 + + { "2_32.bin", 0x04000, 0x67875473, BRF_ESS | BRF_PRG }, // 3 M6803 Program Code + + { "6.bin", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 4 M6809 Program Code + + { "1.bin", 0x08000, 0x7a8b8db4, BRF_GRA }, // 5 Characters + + { "21j-a", 0x10000, 0x574face3, BRF_GRA }, // 6 Sprites + { "21j-b", 0x10000, 0x40507a76, BRF_GRA }, // 7 + { "21j-c", 0x10000, 0xbb0bc76f, BRF_GRA }, // 8 + { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 9 + { "21j-e", 0x10000, 0xa0a0c261, BRF_GRA }, // 10 + { "21j-f", 0x10000, 0x6ba152f6, BRF_GRA }, // 11 + { "21j-g", 0x10000, 0x3220a0b6, BRF_GRA }, // 12 + { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 13 + + { "21j-8", 0x10000, 0x7c435887, BRF_GRA }, // 14 Tiles + { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 15 + { "21j-i", 0x10000, 0x5effb0a0, BRF_GRA }, // 16 + { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 17 + + { "8.bin", 0x10000, 0x34755de3, BRF_GRA }, // 18 Samples + { "7.bin", 0x10000, 0xf9311f72, BRF_GRA }, // 19 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 20 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 21 +}; + +STD_ROM_PICK(Drvba) +STD_ROM_FN(Drvba) + +static struct BurnRomInfo Drv2RomDesc[] = { + { "26a9-04.bin", 0x08000, 0xf2cfc649, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "26aa-03.bin", 0x08000, 0x44dd5d4b, BRF_ESS | BRF_PRG }, // 1 + { "26ab-0.bin", 0x08000, 0x49ddddcd, BRF_ESS | BRF_PRG }, // 2 + { "26ac-0e.63", 0x08000, 0x57acad2c, BRF_ESS | BRF_PRG }, // 3 + + { "26ae-0.bin", 0x10000, 0xea437867, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + + { "26ad-0.bin", 0x08000, 0x75e36cd6, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program Code + + { "26a8-0e.19", 0x10000, 0x4e80cd36, BRF_GRA }, // 6 Characters + + { "26j0-0.bin", 0x20000, 0xdb309c84, BRF_GRA }, // 7 Sprites + { "26j1-0.bin", 0x20000, 0xc3081e0c, BRF_GRA }, // 8 + { "26af-0.bin", 0x20000, 0x3a615aad, BRF_GRA }, // 9 + { "26j2-0.bin", 0x20000, 0x589564ae, BRF_GRA }, // 10 + { "26j3-0.bin", 0x20000, 0xdaf040d6, BRF_GRA }, // 11 + { "26a10-0.bin", 0x20000, 0x6d16d889, BRF_GRA }, // 12 + + { "26j4-0.bin", 0x20000, 0xa8c93e76, BRF_GRA }, // 13 Tiles + { "26j5-0.bin", 0x20000, 0xee555237, BRF_GRA }, // 14 + + { "26j6-0.bin", 0x20000, 0xa84b2a29, BRF_GRA }, // 15 Samples + { "26j7-0.bin", 0x20000, 0xbc6a48d5, BRF_GRA }, // 16 + + { "prom.16", 0x00200, 0x46339529, BRF_GRA }, // 17 PROMs +}; + +STD_ROM_PICK(Drv2) +STD_ROM_FN(Drv2) + +static struct BurnRomInfo Drv2uRomDesc[] = { + { "26a9-04.bin", 0x08000, 0xf2cfc649, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "26aa-03.bin", 0x08000, 0x44dd5d4b, BRF_ESS | BRF_PRG }, // 1 + { "26ab-0.bin", 0x08000, 0x49ddddcd, BRF_ESS | BRF_PRG }, // 2 + { "26ac-02.bin", 0x08000, 0x097eaf26, BRF_ESS | BRF_PRG }, // 3 + + { "26ae-0.bin", 0x10000, 0xea437867, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + + { "26ad-0.bin", 0x08000, 0x75e36cd6, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program Code + + { "26a8-0.bin", 0x10000, 0x3ad1049c, BRF_GRA }, // 6 Characters + + { "26j0-0.bin", 0x20000, 0xdb309c84, BRF_GRA }, // 7 Sprites + { "26j1-0.bin", 0x20000, 0xc3081e0c, BRF_GRA }, // 8 + { "26af-0.bin", 0x20000, 0x3a615aad, BRF_GRA }, // 9 + { "26j2-0.bin", 0x20000, 0x589564ae, BRF_GRA }, // 10 + { "26j3-0.bin", 0x20000, 0xdaf040d6, BRF_GRA }, // 11 + { "26a10-0.bin", 0x20000, 0x6d16d889, BRF_GRA }, // 12 + + { "26j4-0.bin", 0x20000, 0xa8c93e76, BRF_GRA }, // 13 Tiles + { "26j5-0.bin", 0x20000, 0xee555237, BRF_GRA }, // 14 + + { "26j6-0.bin", 0x20000, 0xa84b2a29, BRF_GRA }, // 15 Samples + { "26j7-0.bin", 0x20000, 0xbc6a48d5, BRF_GRA }, // 16 + + { "prom.16", 0x00200, 0x46339529, BRF_GRA }, // 17 PROMs +}; + +STD_ROM_PICK(Drv2u) +STD_ROM_FN(Drv2u) + +static struct BurnRomInfo DdungeonRomDesc[] = { + { "dd26.26", 0x08000, 0xa6e7f608, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "dd25.25", 0x08000, 0x922e719c, BRF_ESS | BRF_PRG }, // 1 + + { "63701.bin", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 2 HD63701 Program Code + + { "dd30.30", 0x08000, 0xef1af99a, BRF_ESS | BRF_PRG }, // 3 M6809 Program Code + + { "dd_mcu.bin", 0x00800, 0x34cbb2d3, BRF_ESS | BRF_PRG }, // 4 M68705 MCU Program Code + + { "dd20.20", 0x08000, 0xd976b78d, BRF_GRA }, // 5 Characters + + { "dd117.117", 0x08000, 0xe912ca81, BRF_GRA }, // 6 Sprites + { "dd113.113", 0x08000, 0x43264ad8, BRF_GRA }, // 7 + + { "dd78.78", 0x08000, 0x3deacae9, BRF_GRA }, // 8 Tiles + { "dd109.109", 0x08000, 0x5a2f31eb, BRF_GRA }, // 9 + + { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 10 Samples + { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 11 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 12 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 13 +}; + +STD_ROM_PICK(Ddungeon) +STD_ROM_FN(Ddungeon) + +static struct BurnRomInfo DarktowrRomDesc[] = { + { "dt.26", 0x08000, 0x8134a472, BRF_ESS | BRF_PRG }, // 0 HD6309 Program Code + { "21j-2-3.25", 0x08000, 0x5779705e, BRF_ESS | BRF_PRG }, // 1 + { "dt.24", 0x08000, 0x523a5413, BRF_ESS | BRF_PRG }, // 2 + + { "63701.bin", 0x04000, 0xf5232d03, BRF_ESS | BRF_PRG }, // 3 HD63701 Program Code + + { "21j-0-1", 0x08000, 0x9efa95bb, BRF_ESS | BRF_PRG }, // 4 M6809 Program Code + + { "68705prt.mcu", 0x00800, 0x34cbb2d3, BRF_ESS | BRF_PRG }, // 5 M68705 MCU Program Code + + { "dt.20", 0x08000, 0x860b0298, BRF_GRA }, // 6 Characters + + { "dt.117", 0x10000, 0x750dd0fa, BRF_GRA }, // 7 Sprites + { "dt.116", 0x10000, 0x22cfa87b, BRF_GRA }, // 8 + { "dt.115", 0x10000, 0x8a9f1c34, BRF_GRA }, // 9 + { "21j-d", 0x10000, 0xcb4f231b, BRF_GRA }, // 10 + { "dt.113", 0x10000, 0x7b4bbf9c, BRF_GRA }, // 11 + { "dt.112", 0x10000, 0xdf3709d4, BRF_GRA }, // 12 + { "dt.111", 0x10000, 0x59032154, BRF_GRA }, // 13 + { "21j-h", 0x10000, 0x65c7517d, BRF_GRA }, // 14 + + { "dt.78", 0x10000, 0x72c15604, BRF_GRA }, // 15 Tiles + { "21j-9", 0x10000, 0xc6640aed, BRF_GRA }, // 16 + { "dt.109", 0x10000, 0x15bdcb62, BRF_GRA }, // 17 + { "21j-j", 0x10000, 0x5fb42e7c, BRF_GRA }, // 18 + + { "21j-6", 0x10000, 0x34755de3, BRF_GRA }, // 19 Samples + { "21j-7", 0x10000, 0x904de6f8, BRF_GRA }, // 20 + + { "21j-k-0", 0x00100, 0xfdb130a9, BRF_GRA }, // 21 PROMs + { "21j-l-0", 0x00200, 0x46339529, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Darktowr) +STD_ROM_FN(Darktowr) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvHD6309Rom = Next; Next += 0x30000; + DrvSubCPURom = Next; Next += 0x04000; + DrvSoundCPURom = Next; Next += 0x08000; + DrvMSM5205Rom = Next; Next += 0x20000; + + RamStart = Next; + + DrvHD6309Ram = Next; Next += 0x01000; + DrvSubCPURam = Next; Next += 0x00fd0; + DrvSoundCPURam = Next; Next += 0x01000; + DrvFgVideoRam = Next; Next += 0x00800; + DrvSpriteRam = Next; Next += 0x01000; + DrvBgVideoRam = Next; Next += 0x00800; + DrvPaletteRam1 = Next; Next += 0x00200; + DrvPaletteRam2 = Next; Next += 0x00200; + + RamEnd = Next; + + DrvChars = Next; Next += 0x0400 * 8 * 8; + DrvTiles = Next; Next += 0x0800 * 16 * 16; + DrvSprites = Next; Next += 0x1000 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00180 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 Drv2MemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvHD6309Rom = Next; Next += 0x30000; + DrvSubCPURom = Next; Next += 0x10000; + DrvSoundCPURom = Next; Next += 0x08000; + MSM6295ROM = Next; Next += 0x40000; + + RamStart = Next; + + DrvHD6309Ram = Next; Next += 0x01800; + DrvSoundCPURam = Next; Next += 0x00800; + DrvFgVideoRam = Next; Next += 0x00800; + DrvSpriteRam = Next; Next += 0x01000; + DrvBgVideoRam = Next; Next += 0x00800; + DrvPaletteRam1 = Next; Next += 0x00200; + DrvPaletteRam2 = Next; Next += 0x00200; + + RamEnd = Next; + + DrvChars = Next; Next += 0x0800 * 8 * 8; + DrvTiles = Next; Next += 0x0800 * 16 * 16; + DrvSprites = Next; Next += 0x1800 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00180 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DarktowrMemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvHD6309Rom = Next; Next += 0x30000; + DrvSubCPURom = Next; Next += 0x04000; + DrvSoundCPURom = Next; Next += 0x08000; + DrvMCURom = Next; Next += 0x00800; + DrvMSM5205Rom = Next; Next += 0x20000; + + RamStart = Next; + + DrvHD6309Ram = Next; Next += 0x01000; + DrvSubCPURam = Next; Next += 0x00fd0; + DrvSoundCPURam = Next; Next += 0x01000; + DrvMCURam = Next; Next += 0x00078; + DrvMCUPorts = Next; Next += 0x00008; + DrvFgVideoRam = Next; Next += 0x00800; + DrvSpriteRam = Next; Next += 0x01000; + DrvBgVideoRam = Next; Next += 0x00800; + DrvPaletteRam1 = Next; Next += 0x00200; + DrvPaletteRam2 = Next; Next += 0x00200; + + RamEnd = Next; + + DrvChars = Next; Next += 0x0400 * 8 * 8; + DrvTiles = Next; Next += 0x0800 * 16 * 16; + DrvSprites = Next; Next += 0x1000 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00180 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + HD6309Open(0); + HD6309Reset(); + HD6309Close(); + + if (DrvSubCPUType == DD_CPU_TYPE_HD63701) { + HD63701Reset(); + } + + if (DrvSubCPUType == DD_CPU_TYPE_HD6309) { + HD6309Open(1); + HD6309Reset(); + HD6309Close(); + } + + if (DrvSubCPUType == DD_CPU_TYPE_M6803) { + M6803Reset(); + } + + if (DrvSubCPUType == DD_CPU_TYPE_Z80) { + ZetOpen(0); + ZetReset(); + ZetClose(); + } + + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { + M6809Open(0); + M6809Reset(); + M6809Close(); + + MSM5205Reset(); + } + + if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { + ZetOpen(1); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + } + + if (DrvGameType == DD_GAME_DARKTOWR) { + m68705Reset(); + } + + BurnYM2151Reset(); + + DrvRomBank = 0; + DrvVBlank = 0; + DrvSubCPUBusy = 1; + DrvSoundLatch = 0; + DrvScrollXHi = 0; + DrvScrollYHi = 0; + DrvScrollXLo = 0; + DrvScrollYLo = 0; + + DrvADPCMIdle[0] = 1; + DrvADPCMIdle[1] = 1; + DrvADPCMPos[0] = 0; + DrvADPCMPos[1] = 0; + DrvADPCMEnd[0] = 0; + DrvADPCMEnd[1] = 0; + DrvADPCMData[0] = -1; + DrvADPCMData[1] = -1; + + return 0; +} + +UINT8 DrvDdragonHD6309ReadByte(UINT16 Address) +{ + if (Address >= 0x2000 && Address <= 0x2fff) { + if (Address == 0x2049 && HD6309GetPC() == 0x6261 && DrvSpriteRam[0x0049] == 0x1f) return 0x01; + return DrvSpriteRam[Address - 0x2000]; + } + + if (DrvGameType == DD_GAME_DARKTOWR && Address >= 0x4000 && Address <= 0x7fff) { + UINT32 Offset = Address - 0x4000; + + if (Offset == 0x1401 || Offset == 0x0001) return DrvMCUPorts[0]; + return 0xff; + } + + switch (Address) { + case 0x3800: { + return DrvInput[0]; + } + + case 0x3801: { + return DrvInput[1]; + } + + case 0x3802: { + return DrvInput[2] | ((DrvVBlank) ? 0x08 : 0) | (DrvSubCPUBusy ? 0x10 : 0); + } + + case 0x3803: { + return DrvDip[0]; + } + + case 0x3804: { + return DrvDip[1]; + } + + case 0x380b: { + // ??? + return 0; + } + } + + bprintf(PRINT_NORMAL, _T("HD6309 Read Byte -> %04X\n"), Address); + + return 0; +} + +void DrvDdragonHD6309WriteByte(UINT16 Address, UINT8 Data) +{ + if (DrvGameType == DD_GAME_DARKTOWR && Address >= 0x4000 && Address <= 0x7fff) { + UINT32 Offset = Address - 0x4000; + + if (Offset == 0x1400 || Offset == 0x0000) { + DrvMCUPorts[1] = BITSWAP08(Data, 0, 1, 2, 3, 4, 5, 6, 7); + } + return; + } + + switch (Address) { + case 0x3808: { + UINT8 DrvOldRomBank = DrvRomBank; + DrvRomBank = (Data & 0xe0) >> 5; + HD6309MapMemory(DrvHD6309Rom + 0x8000 + (DrvRomBank * 0x4000), 0x4000, 0x7fff, M6809_ROM); + + DrvScrollXHi = (Data & 0x01) << 8; + DrvScrollYHi = (Data & 0x02) << 7; + + if (Data & 0x10) { + DrvSubCPUBusy = 0; + } else { + if (DrvSubCPUBusy == 0) { + if (DrvSubCPUType == DD_CPU_TYPE_HD63701) { + HD63701SetIRQLine(HD63701_INPUT_LINE_NMI, HD63701_IRQSTATUS_ACK); + } + + if (DrvSubCPUType == DD_CPU_TYPE_HD6309) { + HD6309Close(); + HD6309Open(1); + HD6309SetIRQLine(HD6309_INPUT_LINE_NMI, HD6309_IRQSTATUS_ACK); + HD6309Close(); + HD6309Open(0); + } + + if (DrvSubCPUType == DD_CPU_TYPE_M6803) { + M6803SetIRQLine(M6803_INPUT_LINE_NMI, M6803_IRQSTATUS_ACK); + } + + if (DrvSubCPUType == DD_CPU_TYPE_Z80) { + ZetOpen(0); + ZetNmi(); + ZetClose(); + } + } + } + + if (DrvGameType == DD_GAME_DARKTOWR) { + if (DrvRomBank == 4 && DrvOldRomBank != 4) { + HD6309MemCallback(0x4000, 0x7fff, HD6309_RAM); + } else { + if (DrvRomBank != 4 && DrvOldRomBank == 4) { + HD6309MapMemory(DrvHD6309Rom + 0x8000 + (DrvRomBank * 0x4000), 0x4000, 0x7fff, M6809_ROM); + } + } + } + + return; + } + + case 0x3809: { + DrvScrollXLo = Data; + return; + } + + case 0x380a: { + DrvScrollYLo = Data; + return; + } + + case 0x380b: { + HD6309SetIRQLine(HD6309_INPUT_LINE_NMI, HD6309_IRQSTATUS_NONE); + return; + } + + case 0x380c: { + HD6309SetIRQLine(HD6309_FIRQ_LINE, HD6309_IRQSTATUS_NONE); + return; + } + + case 0x380d: { + HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_NONE); + return; + } + + case 0x380e: { + DrvSoundLatch = Data; + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { + M6809Open(0); + M6809SetIRQLine(M6809_IRQ_LINE, M6809_IRQSTATUS_ACK); + M6809Close(); + } + + if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { + ZetOpen(1); + ZetNmi(); + ZetClose(); + } + return; + } + + case 0x380f: { + // ??? + return; + } + } + + bprintf(PRINT_NORMAL, _T("HD6309 Write Byte -> %04X, %02X\n"), Address, Data); +} + +UINT8 DrvDdragonHD63701ReadByte(UINT16 Address) +{ + if (Address >= 0x0020 && Address <= 0x0fff) { + return DrvSubCPURam[Address - 0x0020]; + } + + if (Address >= 0x8000 && Address <= 0x8fff) { + if (Address == 0x8049 && HD63701GetPC() == 0x6261 && DrvSpriteRam[0x0049] == 0x1f) return 0x01; + return DrvSpriteRam[Address - 0x8000]; + } + + bprintf(PRINT_NORMAL, _T("M6800 Read Byte -> %04X\n"), Address); + + return 0; +} + +void DrvDdragonHD63701WriteByte(UINT16 Address, UINT8 Data) +{ + if (Address <= 0x001f) { + if (Address == 0x17) { + if (Data & 3) { + HD6309Open(0); + HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_ACK); + HD6309Close(); + + HD63701SetIRQLine(HD63701_INPUT_LINE_NMI, HD63701_IRQSTATUS_NONE); + } + } + return; + } + + if (Address >= 0x0020 && Address <= 0x0fff) { + DrvSubCPURam[Address - 0x0020] = Data; + return; + } + + if (Address >= 0x8000 && Address <= 0x8fff) { + if (Address == 0x8000) DrvSubCPUBusy = 1; + DrvSpriteRam[Address - 0x8000] = Data; + return; + } + + bprintf(PRINT_NORMAL, _T("M6800 Write Byte -> %04X, %02X\n"), Address, Data); +} + +UINT8 DrvDdragonbSubHD6309ReadByte(UINT16 Address) +{ + if (Address >= 0x0020 && Address <= 0x0fff) { + return DrvSubCPURam[Address - 0x0020]; + } + + if (Address >= 0x8000 && Address <= 0x8fff) { + return DrvSpriteRam[Address - 0x8000]; + } + + bprintf(PRINT_NORMAL, _T("Sub HD6309 Read Byte -> %04X\n"), Address); + + return 0; +} + +void DrvDdragonbSubHD6309WriteByte(UINT16 Address, UINT8 Data) +{ + if (Address <= 0x001f) { + if (Address == 0x17) { + if (Data & 3) { + HD6309Close(); + + HD6309Open(0); + HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_ACK); + HD6309Close(); + + HD6309Open(1); + HD6309SetIRQLine(HD6309_INPUT_LINE_NMI, HD6309_IRQSTATUS_NONE); + } + } + return; + } + + if (Address >= 0x0020 && Address <= 0x0fff) { + DrvSubCPURam[Address - 0x0020] = Data; + return; + } + + if (Address >= 0x8000 && Address <= 0x8fff) { + if (Address == 0x8000) DrvSubCPUBusy = 1; + DrvSpriteRam[Address - 0x8000] = Data; + return; + } + + bprintf(PRINT_NORMAL, _T("Sub HD6309 Write Byte -> %04X, %02X\n"), Address, Data); +} + +UINT8 DrvDdragonbaM6803ReadByte(UINT16 Address) +{ + if (Address >= 0x0020 && Address <= 0x0fff) { + return DrvSubCPURam[Address - 0x0020]; + } + + if (Address >= 0x8000 && Address <= 0x8fff) { + return DrvSpriteRam[Address - 0x8000]; + } + + bprintf(PRINT_NORMAL, _T("M6803 Read Byte -> %04X\n"), Address); + + return 0; +} + +void DrvDdragonbaM6803WriteByte(UINT16 Address, UINT8 Data) +{ + if (Address >= 0x0020 && Address <= 0x0fff) { + DrvSubCPURam[Address - 0x0020] = Data; + return; + } + + if (Address >= 0x8000 && Address <= 0x8fff) { + if (Address == 0x8000) DrvSubCPUBusy = 1; + DrvSpriteRam[Address - 0x8000] = Data; + return; + } + + if (Address <= 0x001f) { + m6803_internal_registers_w(Address, Data); + return; + } + + bprintf(PRINT_NORMAL, _T("M6803 Write Byte -> %04X, %02X\n"), Address, Data); +} + +void DrvDdragonbaM6803WritePort(UINT16, UINT8) +{ + M6803SetIRQLine(M6803_INPUT_LINE_NMI, M6803_IRQSTATUS_NONE); + + HD6309Open(0); + HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_ACK); + HD6309Close(); +} + +void __fastcall Ddragon2SubZ80Write(UINT16 Address, UINT8 Data) +{ + if (Address >= 0xc000 && Address <= 0xc3ff) { + if (Address == 0xc000) DrvSubCPUBusy = 1; + DrvSpriteRam[Address - 0xc000] = Data; + return; + } + + switch (Address) { + case 0xd000: { + // Lower NMI + return; + } + + case 0xe000: { + HD6309Open(0); + HD6309SetIRQLine(HD6309_IRQ_LINE, HD6309_IRQSTATUS_ACK); + HD6309Close(); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Sub Z80 Write => %04X, %02X\n"), Address, Data); + } + } +} + +UINT8 DrvDdragonM6809ReadByte(UINT16 Address) +{ + switch (Address) { + case 0x1000: { + M6809SetIRQLine(M6809_IRQ_LINE, M6809_IRQSTATUS_NONE); + return DrvSoundLatch; + } + + case 0x1800: { + return DrvADPCMIdle[0] + (DrvADPCMIdle[1] << 1); + } + + case 0x2801: { + return BurnYM2151ReadStatus(); + } + } + + bprintf(PRINT_NORMAL, _T("M6809 Read Byte -> %04X\n"), Address); + + return 0; +} + + +void DrvDdragonM6809WriteByte(UINT16 Address, UINT8 Data) +{ + switch (Address) { + case 0x2800: { + BurnYM2151SelectRegister(Data); + return; + } + + case 0x2801: { + BurnYM2151WriteRegister(Data); + return; + } + + case 0x3800: { + DrvADPCMIdle[0] = 0; + MSM5205ResetWrite(0, 0); + return; + } + + case 0x3801: { + DrvADPCMIdle[1] = 0; + MSM5205ResetWrite(1, 0); + return; + } + + case 0x3802: { + DrvADPCMEnd[0] = (Data & 0x7f) * 0x200; + return; + } + + case 0x3803: { + DrvADPCMEnd[1] = (Data & 0x7f) * 0x200; + return; + } + + case 0x3804: { + DrvADPCMPos[0] = (Data & 0x7f) * 0x200; + return; + } + + case 0x3805: { + DrvADPCMPos[1] = (Data & 0x7f) * 0x200; + return; + } + + case 0x3806: { + DrvADPCMIdle[0] = 1; + MSM5205ResetWrite(0, 1); + return; + } + + case 0x3807: { + DrvADPCMIdle[1] = 1; + MSM5205ResetWrite(1, 1); + return; + } + } + + bprintf(PRINT_NORMAL, _T("M6809 Write Byte -> %04X, %02X\n"), Address, Data); +} + +UINT8 __fastcall Ddragon2SoundZ80Read(UINT16 Address) +{ + switch (Address) { + case 0x8801: { + return BurnYM2151ReadStatus(); + } + + case 0x9800: { + return MSM6295ReadStatus(0); + } + + case 0xa000: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Sound Z80 Read => %04X\n"), Address); + } + } + + return 0; +} + +void __fastcall Ddragon2SoundZ80Write(UINT16 Address, UINT8 Data) +{ + switch (Address) { + case 0x8800: { + BurnYM2151SelectRegister(Data); + return; + } + + case 0x8801: { + BurnYM2151WriteRegister(Data); + return; + } + + case 0x9800: { + MSM6295Command(0, Data); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Sound Z80 Write => %04X, %02X\n"), Address, Data); + } + } +} + +UINT8 DrvMCUReadByte(UINT16 Address) +{ + if (Address <= 0x0007) { + return DrvMCUPorts[Address]; + } + + bprintf(PRINT_NORMAL, _T("M68705 Read Byte -> %04X\n"), Address); + + return 0; +} + +void DrvMCUWriteByte(UINT16 Address, UINT8 Data) +{ + if (Address <= 0x0007) { + DrvMCUPorts[Address] = Data; + return; + } + + bprintf(PRINT_NORMAL, _T("M68705 Write Byte -> %04X, %02X\n"), Address, Data); +} + +static INT32 CharPlaneOffsets[4] = { 0, 2, 4, 6 }; +static INT32 CharXOffsets[8] = { 1, 0, 65, 64, 129, 128, 193, 192 }; +static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 TilePlaneOffsets[4] = { 0x100000, 0x100004, 0, 4 }; +static INT32 DdungeonTilePlaneOffsets[4] = { 0x080000, 0x080004, 0, 4 }; +static INT32 TileXOffsets[16] = { 3, 2, 1, 0, 131, 130, 129, 128, 259, 258, 257, 256, 387, 386, 385, 384 }; +static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; +static INT32 SpritePlaneOffsets[4] = { 0x200000, 0x200004, 0, 4 }; +static INT32 Dd2SpritePlaneOffsets[4] = { 0x300000, 0x300004, 0, 4 }; + +static void DrvYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + M6809SetIRQLine(M6809_FIRQ_LINE, M6809_IRQSTATUS_ACK); +#if 1 + // This fixes music tempo but breaks MSM5205 sound if we use the M6809 for the MSM5205 timing, + // because the interleave run count is 190 cycles + nCyclesDone[2] += M6809Run(1000); +#endif + } else { + M6809SetIRQLine(M6809_FIRQ_LINE, M6809_IRQSTATUS_NONE); + } +} + +static void Ddragon2YM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)((double)HD6309TotalCycles() * nSoundRate / ((INT32)(nCyclesTotal[0] * 57.444853))); +} + +static void DrvMSM5205Vck0() +{ + if (DrvADPCMPos[0] >= DrvADPCMEnd[0] || DrvADPCMPos[0] >= 0x10000) { + DrvADPCMIdle[0] = 1; + MSM5205ResetWrite(0, 1); + } else { + if (DrvADPCMData[0] != -1) { + MSM5205DataWrite(0, DrvADPCMData[0] & 0x0f); + DrvADPCMData[0] = -1; + } else { + UINT8 *ROM = DrvMSM5205Rom + 0x00000; + + DrvADPCMData[0] = ROM[(DrvADPCMPos[0]++) & 0xffff]; + MSM5205DataWrite(0, DrvADPCMData[0] >> 4); + } + } +} + +static void DrvMSM5205Vck1() +{ + if (DrvADPCMPos[1] >= DrvADPCMEnd[1] || DrvADPCMPos[1] >= 0x10000) { + DrvADPCMIdle[1] = 1; + MSM5205ResetWrite(1, 1); + } else { + if (DrvADPCMData[1] != -1) { + MSM5205DataWrite(1, DrvADPCMData[1] & 0x0f); + DrvADPCMData[1] = -1; + } else { + UINT8 *ROM = DrvMSM5205Rom + 0x10000; + + DrvADPCMData[1] = ROM[(DrvADPCMPos[1]++) & 0xffff]; + MSM5205DataWrite(1, DrvADPCMData[1] >> 4); + } + } +} + +static INT32 DrvMemInit() +{ + INT32 nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + return 0; +} + +static INT32 Drv2MemInit() +{ + INT32 nLen; + + // Allocate and Blank all required memory + Mem = NULL; + Drv2MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + Drv2MemIndex(); + + return 0; +} + +static INT32 DarktowrMemInit() +{ + INT32 nLen; + + // Allocate and Blank all required memory + Mem = NULL; + DarktowrMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + DarktowrMemIndex(); + + return 0; +} + +static INT32 DrvLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load HD6309 Program Roms + nRet = BurnLoadRom(DrvHD6309Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvHD6309Rom + 0x08000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvHD6309Rom + 0x10000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvHD6309Rom + 0x18000, 3, 1); if (nRet != 0) return 1; + + // Load HD63701 Program Roms + nRet = BurnLoadRom(DrvSubCPURom + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load M6809 Program Roms + nRet = BurnLoadRom(DrvSoundCPURom + 0x00000, 5, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x70000, 14, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 18, 1); if (nRet != 0) return 1; + GfxDecode(0x800, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load samples + nRet = BurnLoadRom(DrvMSM5205Rom + 0x00000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvMSM5205Rom + 0x10000, 20, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 DrvbaLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load HD6309 Program Roms + nRet = BurnLoadRom(DrvHD6309Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvHD6309Rom + 0x08000, 1, 1); if (nRet != 0) return 1; + memcpy(DrvHD6309Rom + 0x18000, DrvHD6309Rom + 0x10000, 0x8000); + nRet = BurnLoadRom(DrvHD6309Rom + 0x10000, 2, 1); if (nRet != 0) return 1; + + // Load M6803 Program Roms + nRet = BurnLoadRom(DrvSubCPURom + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load M6809 Program Roms + nRet = BurnLoadRom(DrvSoundCPURom + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x70000, 13, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 17, 1); if (nRet != 0) return 1; + GfxDecode(0x800, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load samples + nRet = BurnLoadRom(DrvMSM5205Rom + 0x00000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvMSM5205Rom + 0x10000, 19, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 Drv2LoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0xc0000); + + // Load HD6309 Program Roms + nRet = BurnLoadRom(DrvHD6309Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvHD6309Rom + 0x08000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvHD6309Rom + 0x10000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvHD6309Rom + 0x18000, 3, 1); if (nRet != 0) return 1; + + // Load HD63701 Program Roms + nRet = BurnLoadRom(DrvSubCPURom + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load M6809 Program Roms + nRet = BurnLoadRom(DrvSoundCPURom + 0x00000, 5, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x800, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0xc0000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 12, 1); if (nRet != 0) return 1; + GfxDecode(0x1800, 4, 16, 16, Dd2SpritePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0xc0000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 14, 1); if (nRet != 0) return 1; + GfxDecode(0x800, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load samples + nRet = BurnLoadRom(MSM6295ROM + 0x00000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROM + 0x20000, 16, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 DdungeonLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load HD6309 Program Roms + nRet = BurnLoadRom(DrvHD6309Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvHD6309Rom + 0x08000, 1, 1); if (nRet != 0) return 1; + + // Load HD63701 Program Roms + nRet = BurnLoadRom(DrvSubCPURom + 0x00000, 2, 1); if (nRet != 0) return 1; + + // Load M6809 Program Roms + nRet = BurnLoadRom(DrvSoundCPURom + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load M68705 MCU Program Roms + nRet = BurnLoadRom(DrvMCURom + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 9, 1); if (nRet != 0) return 1; + GfxDecode(0x800, 4, 16, 16, DdungeonTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load samples + nRet = BurnLoadRom(DrvMSM5205Rom + 0x00000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvMSM5205Rom + 0x10000, 11, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 DarktowrLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load HD6309 Program Roms + nRet = BurnLoadRom(DrvHD6309Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvHD6309Rom + 0x08000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvHD6309Rom + 0x10000, 2, 1); if (nRet != 0) return 1; + + // Load HD63701 Program Roms + nRet = BurnLoadRom(DrvSubCPURom + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load M6809 Program Roms + nRet = BurnLoadRom(DrvSoundCPURom + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load M68705 MCU Program Roms + nRet = BurnLoadRom(DrvMCURom + 0x00000, 5, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x70000, 14, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 18, 1); if (nRet != 0) return 1; + GfxDecode(0x800, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load samples + nRet = BurnLoadRom(DrvMSM5205Rom + 0x00000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvMSM5205Rom + 0x10000, 20, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 DrvMachineInit() +{ + BurnSetRefreshRate(57.444853); + + // Setup the HD6309 emulation + if (DrvSubCPUType == DD_CPU_TYPE_HD6309) { + HD6309Init(2); + } else { + HD6309Init(1); + } + HD6309Open(0); + HD6309MapMemory(DrvHD6309Ram , 0x0000, 0x0fff, M6809_RAM); + HD6309MapMemory(DrvPaletteRam1 , 0x1000, 0x11ff, M6809_RAM); + HD6309MapMemory(DrvPaletteRam2 , 0x1200, 0x13ff, M6809_RAM); + HD6309MapMemory(DrvFgVideoRam , 0x1800, 0x1fff, M6809_RAM); + HD6309MapMemory(DrvSpriteRam , 0x2000, 0x2fff, M6809_WRITE); + HD6309MapMemory(DrvBgVideoRam , 0x3000, 0x37ff, M6809_RAM); + HD6309MapMemory(DrvHD6309Rom + 0x8000, 0x4000, 0x7fff, M6809_ROM); + HD6309MapMemory(DrvHD6309Rom , 0x8000, 0xffff, M6809_ROM); + HD6309SetReadHandler(DrvDdragonHD6309ReadByte); + HD6309SetWriteHandler(DrvDdragonHD6309WriteByte); + HD6309Close(); + + if (DrvSubCPUType == DD_CPU_TYPE_HD63701) { + HD63701Init(1); + HD63701MapMemory(DrvSubCPURom , 0xc000, 0xffff, HD63701_ROM); + HD63701SetReadHandler(DrvDdragonHD63701ReadByte); + HD63701SetWriteHandler(DrvDdragonHD63701WriteByte); + } + + if (DrvSubCPUType == DD_CPU_TYPE_HD6309) { + HD6309Open(1); + HD6309MapMemory(DrvSubCPURom , 0xc000, 0xffff, HD6309_ROM); + HD6309SetReadHandler(DrvDdragonbSubHD6309ReadByte); + HD6309SetWriteHandler(DrvDdragonbSubHD6309WriteByte); + HD6309Close(); + } + + if (DrvSubCPUType == DD_CPU_TYPE_M6803) { + M6803Init(1); + M6803MapMemory(DrvSubCPURom , 0xc000, 0xffff, M6803_ROM); + M6803SetReadHandler(DrvDdragonbaM6803ReadByte); + M6803SetWriteHandler(DrvDdragonbaM6803WriteByte); + M6803SetWritePortHandler(DrvDdragonbaM6803WritePort); + } + + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { + M6809Init(1); + M6809Open(0); + M6809MapMemory(DrvSoundCPURam , 0x0000, 0x0fff, M6809_RAM); + M6809MapMemory(DrvSoundCPURom , 0x8000, 0xffff, M6809_ROM); + M6809SetReadHandler(DrvDdragonM6809ReadByte); + M6809SetWriteHandler(DrvDdragonM6809WriteByte); + M6809Close(); + + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); + + MSM5205Init(0, DrvSynchroniseStream, 375000, DrvMSM5205Vck0, MSM5205_S48_4B, 1); + MSM5205Init(1, DrvSynchroniseStream, 375000, DrvMSM5205Vck1, MSM5205_S48_4B, 1); + MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + MSM5205SetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); + } + + if (DrvGameType == DD_GAME_DARKTOWR) { + m6805Init(1, 0x800); + m6805MapMemory(DrvMCURom + 0x80, 0x080, 0x7ff, M6805_ROM); + m6805MapMemory(DrvMCURom, 0x008, 0x07f, M6805_RAM); + m6805SetReadHandler(DrvMCUReadByte); + m6805SetWriteHandler(DrvMCUWriteByte); + } + + nCyclesTotal[0] = (INT32)((double)4000000 / 57.44853); + nCyclesTotal[1] = (INT32)((double)4000000 / 57.44853); + nCyclesTotal[2] = (INT32)((double)1500000 / 57.44853); + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 Drv2MachineInit() +{ + // Setup the HD6309 emulation + HD6309Init(1); + HD6309Open(0); + HD6309MapMemory(DrvHD6309Ram , 0x0000, 0x17ff, M6809_RAM); + HD6309MapMemory(DrvFgVideoRam , 0x1800, 0x1fff, M6809_RAM); + HD6309MapMemory(DrvSpriteRam , 0x2000, 0x2fff, M6809_WRITE); + HD6309MapMemory(DrvBgVideoRam , 0x3000, 0x37ff, M6809_RAM); + HD6309MapMemory(DrvPaletteRam1 , 0x3c00, 0x3dff, M6809_RAM); + HD6309MapMemory(DrvPaletteRam2 , 0x3e00, 0x3fff, M6809_RAM); + HD6309MapMemory(DrvHD6309Rom + 0x8000, 0x4000, 0x7fff, M6809_ROM); + HD6309MapMemory(DrvHD6309Rom , 0x8000, 0xffff, M6809_ROM); + HD6309SetReadHandler(DrvDdragonHD6309ReadByte); + HD6309SetWriteHandler(DrvDdragonHD6309WriteByte); + HD6309Close(); + + ZetInit(0); + ZetOpen(0); + ZetSetWriteHandler(Ddragon2SubZ80Write); + ZetMapArea(0x0000, 0xbfff, 0, DrvSubCPURom); + ZetMapArea(0x0000, 0xbfff, 2, DrvSubCPURom); + ZetMapArea(0xc000, 0xc3ff, 0, DrvSpriteRam); + ZetMapArea(0xc000, 0xc3ff, 2, DrvSpriteRam); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(Ddragon2SoundZ80Read); + ZetSetWriteHandler(Ddragon2SoundZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvSoundCPURom); + ZetMapArea(0x0000, 0x7fff, 2, DrvSoundCPURom); + ZetMapArea(0x8000, 0x87ff, 0, DrvSoundCPURam); + ZetMapArea(0x8000, 0x87ff, 1, DrvSoundCPURam); + ZetMapArea(0x8000, 0x87ff, 2, DrvSoundCPURam); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&Ddragon2YM2151IrqHandler); + BurnYM2151SetAllRoutes(0.60, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 1056000 / 132, 1); + MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); + + BurnSetRefreshRate(57.444853); + + nCyclesTotal[0] = (INT32)((double)4000000 / 57.44853); + nCyclesTotal[1] = (INT32)((double)4000000 / 57.44853); + nCyclesTotal[2] = (INT32)((double)3579545 / 57.44853); + nCyclesTotal[3] = (INT32)((double)4000000 / 57.44853); + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 DrvInit() +{ + DrvSubCPUType = DD_CPU_TYPE_HD63701; + DrvSoundCPUType = DD_CPU_TYPE_M6809; + + if (DrvMemInit()) return 1; + if (DrvLoadRoms()) return 1; + if (DrvMachineInit()) return 1; + + return 0; +} + +static INT32 DrvbInit() +{ + DrvSubCPUType = DD_CPU_TYPE_HD6309; + DrvSoundCPUType = DD_CPU_TYPE_M6809; + + if (DrvMemInit()) return 1; + if (DrvLoadRoms()) return 1; + if (DrvMachineInit()) return 1; + + nCyclesTotal[1] = (INT32)((double)1500000 / 57.44853); + + return 0; +} + +static INT32 DrvbaInit() +{ + DrvSubCPUType = DD_CPU_TYPE_M6803; + DrvSoundCPUType = DD_CPU_TYPE_M6809; + + if (DrvMemInit()) return 1; + if (DrvbaLoadRoms()) return 1; + if (DrvMachineInit()) return 1; + + return 0; +} + +static INT32 Drv2Init() +{ + DrvSubCPUType = DD_CPU_TYPE_Z80; + DrvSoundCPUType = DD_CPU_TYPE_Z80; + DrvVidHardwareType = DD_VID_TYPE_DD2; + + if (Drv2MemInit()) return 1; + if (Drv2LoadRoms()) return 1; + if (Drv2MachineInit()) return 1; + + return 0; +} + +static INT32 DdungeonInit() +{ + DrvSubCPUType = DD_CPU_TYPE_HD63701; + DrvSoundCPUType = DD_CPU_TYPE_M6809; + DrvGameType = DD_GAME_DARKTOWR; + + if (DarktowrMemInit()) return 1; + if (DdungeonLoadRoms()) return 1; + if (DrvMachineInit()) return 1; + + return 0; +} + +static INT32 DarktowrInit() +{ + DrvSubCPUType = DD_CPU_TYPE_HD63701; + DrvSoundCPUType = DD_CPU_TYPE_M6809; + DrvGameType = DD_GAME_DARKTOWR; + + if (DarktowrMemInit()) return 1; + if (DarktowrLoadRoms()) return 1; + if (DrvMachineInit()) return 1; + + return 0; +} + +static INT32 DrvExit() +{ + HD6309Exit(); + if (DrvSubCPUType == DD_CPU_TYPE_M6803 || DrvSubCPUType == DD_CPU_TYPE_HD63701) M6800Exit(); + if (DrvGameType == DD_GAME_DARKTOWR) m6805Exit(); + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) M6809Exit(); + if (DrvSubCPUType == DD_CPU_TYPE_Z80 || DrvSoundCPUType == DD_CPU_TYPE_Z80) ZetExit(); + + BurnYM2151Exit(); + if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { + MSM6295Exit(0); + } else { + MSM5205Exit(); + } + + GenericTilesExit(); + + BurnFree(Mem); + + DrvRomBank = 0; + DrvVBlank = 0; + DrvSubCPUBusy = 0; + DrvSoundLatch = 0; + DrvScrollXHi = 0; + DrvScrollYHi = 0; + DrvScrollXLo = 0; + DrvScrollYLo = 0; + + DrvADPCMIdle[0] = 0; + DrvADPCMIdle[1] = 0; + DrvADPCMPos[0] = 0; + DrvADPCMPos[1] = 0; + DrvADPCMEnd[0] = 0; + DrvADPCMEnd[1] = 0; + DrvADPCMData[0] = 0; + DrvADPCMData[1] = 0; + + DrvSubCPUType = DD_CPU_TYPE_NONE; + DrvSoundCPUType = DD_CPU_TYPE_NONE; + DrvVidHardwareType = 0; + DrvGameType = 0; + + return 0; +} + +static inline UINT8 pal4bit(UINT8 bits) +{ + bits &= 0x0f; + return (bits << 4) | bits; +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(nColour >> 0); + g = pal4bit(nColour >> 4); + b = pal4bit(nColour >> 8); + + return BurnHighCol(r, g, b, 0); +} + +static void DrvCalcPalette() +{ + for (INT32 i = 0; i < 0x180; i++) { + INT32 Val = DrvPaletteRam1[i] + (DrvPaletteRam2[i] << 8); + + DrvPalette[i] = CalcCol(Val); + } +} + +static void DrvRenderBgLayer() +{ + INT32 mx, my, Code, Attr, Colour, x, y, TileIndex, xScroll, yScroll, Flip, xFlip, yFlip; + + xScroll = DrvScrollXHi + DrvScrollXLo; + xScroll &= 0x1ff; + + yScroll = DrvScrollYHi + DrvScrollYLo; + yScroll &= 0x1ff; + + for (mx = 0; mx < 32; mx++) { + for (my = 0; my < 32; my++) { + TileIndex = (my & 0x0f) + ((mx & 0x0f) << 4) + ((my & 0x10) << 4) + ((mx & 0x10) << 5); + + Attr = DrvBgVideoRam[(2 * TileIndex) + 0]; + Code = DrvBgVideoRam[(2 * TileIndex) + 1] + ((Attr & 0x07) << 8); + Colour = (Attr >> 3) & 0x07; + Flip = (Attr & 0xc0) >> 6; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + + y = 16 * mx; + x = 16 * my; + + x -= xScroll; + if (x < -16) x += 512; + + y -= yScroll; + if (y < -16) y += 512; + + y -= 8; + + if (x > 16 && x < 240 && y > 16 && y < 224) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } else { + Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } else { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } else { + Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } + } + } + } + } +} + +#define DRAW_SPRITE(Order, sx, sy) \ + if (sx > 16 && sx < 240 && sy > 16 && sy < 224) { \ + if (xFlip) { \ + if (yFlip) { \ + Render16x16Tile_Mask_FlipXY(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ + } else { \ + Render16x16Tile_Mask_FlipX(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ + } \ + } else { \ + if (yFlip) { \ + Render16x16Tile_Mask_FlipY(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ + } else { \ + Render16x16Tile_Mask(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ + } \ + } \ + } else { \ + if (xFlip) { \ + if (yFlip) { \ + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ + } else { \ + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ + } \ + } else { \ + if (yFlip) { \ + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ + } else { \ + Render16x16Tile_Mask_Clip(pTransDraw, Code + Order, sx, sy, Colour, 4, 0, 128, DrvSprites); \ + } \ + } \ + } + +static void DrvRenderSpriteLayer() +{ + UINT8 *Src = &DrvSpriteRam[0x800]; + + for (INT32 i = 0; i < (64 * 5); i += 5) { + INT32 Attr = Src[i + 1]; + + if (Attr & 0x80) { + INT32 sx = 240 - Src[i + 4] + ((Attr & 2) << 7); + INT32 sy = 232 - Src[i + 0] + ((Attr & 1) << 8); + INT32 Size = (Attr & 0x30) >> 4; + INT32 xFlip = Attr & 0x08; + INT32 yFlip = Attr & 0x04; + INT32 dx = -16; + INT32 dy = -16; + + INT32 Colour; + INT32 Code; + + if (DrvVidHardwareType == DD_VID_TYPE_DD2) { + Colour = (Src[i + 2] >> 5); + Code = Src[i + 3] + ((Src[i + 2] & 0x1f) << 8); + } else { + Colour = (Src[i + 2] >> 4) & 0x07; + Code = Src[i + 3] + ((Src[i + 2] & 0x0f) << 8); + } + + Code &= ~Size; + + switch (Size) { + case 0: { + DRAW_SPRITE(0, sx, sy) + break; + } + + case 1: { + DRAW_SPRITE(0, sx, sy + dy) + DRAW_SPRITE(1, sx, sy) + break; + } + + case 2: { + DRAW_SPRITE(0, sx + dx, sy) + DRAW_SPRITE(2, sx, sy) + break; + } + + case 3: { + DRAW_SPRITE(0, sx + dx, sy + dy) + DRAW_SPRITE(1, sx + dx, sy) + DRAW_SPRITE(2, sx, sy + dy) + DRAW_SPRITE(3, sx, sy) + break; + } + } + } + } +} + +#undef DRAW_SPRITE + +static void DrvRenderCharLayer() +{ + INT32 mx, my, Code, Attr, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Attr = DrvFgVideoRam[(2 * TileIndex) + 0]; + Code = DrvFgVideoRam[(2 * TileIndex) + 1] + ((Attr & 0x07) << 8); + if (DrvVidHardwareType != DD_VID_TYPE_DD2) Code &= 0x3ff; + + Colour = Attr >> 5; + + x = 8 * mx; + y = 8 * my; + + y -= 8; + + if (x > 0 && x < 248 && y > 0 && y < 232) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvChars); + } + + TileIndex++; + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + DrvRenderBgLayer(); + DrvRenderSpriteLayer(); + DrvRenderCharLayer(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 272; + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) nInterleave = MSM5205CalcInterleave(0, (INT32)(nCyclesTotal[0] * 57.444853)); + INT32 nSoundBufferPos = 0; + + INT32 VBlankSlice = (INT32)((double)(nInterleave * 240) / 272); + INT32 FIRQFireSlice[16]; + for (INT32 i = 0; i < 16; i++) { + FIRQFireSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 17)); + } + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + UINT32 nCyclesToDo[2]; + nCyclesToDo[0] = (INT32)((double)nCyclesTotal[0] * nBurnCPUSpeedAdjust / 0x0100); + nCyclesToDo[1] = (INT32)((double)nCyclesTotal[1] * nBurnCPUSpeedAdjust / 0x0100); + + nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = nCyclesDone[3] = 0; + + HD6309NewFrame(); + if (DrvSubCPUType == DD_CPU_TYPE_HD63701) HD63701NewFrame(); + if (DrvSubCPUType == DD_CPU_TYPE_M6803) M6803NewFrame(); + if (DrvSubCPUType == DD_CPU_TYPE_Z80 || DrvSoundCPUType == DD_CPU_TYPE_Z80) ZetNewFrame(); + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) M6809NewFrame(); + if (DrvGameType == DD_GAME_DARKTOWR) m6805NewFrame(); + + DrvVBlank = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + HD6309Open(0); + nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += HD6309Run(nCyclesSegment); + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) MSM5205Update(); + HD6309Close(); + + if (DrvSubCPUType == DD_CPU_TYPE_HD63701) { + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = HD63701Run(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + } + + if (DrvSubCPUType == DD_CPU_TYPE_HD6309) { + nCurrentCPU = 1; + HD6309Open(1); + nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = HD6309Run(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + HD6309Close(); + } + + if (DrvSubCPUType == DD_CPU_TYPE_M6803) { + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = M6803Run(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + } + + if (DrvSubCPUType == DD_CPU_TYPE_Z80) { + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + } + + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { + nCurrentCPU = 2; + M6809Open(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += M6809Run(nCyclesSegment); + M6809Close(); + } + + if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { + nCurrentCPU = 2; + ZetOpen(1); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + } + + if (DrvGameType == DD_GAME_DARKTOWR) { + nCurrentCPU = 3; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = m6805Run(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + } + + if (i == VBlankSlice) { + DrvVBlank = 1; + HD6309Open(0); + HD6309SetIRQLine(HD6309_INPUT_LINE_NMI, HD6309_IRQSTATUS_ACK); + HD6309Close(); + } + + for (INT32 j = 0; j < 16; j++) { + if (i == FIRQFireSlice[j]) { + HD6309Open(0); + HD6309SetIRQLine(HD6309_FIRQ_LINE, HD6309_IRQSTATUS_ACK); + HD6309Close(); + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { + M6809Open(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + M6809Close(); + } + + if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { + ZetOpen(1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) { + M6809Open(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + M6809Close(); + } + + if (DrvSoundCPUType == DD_CPU_TYPE_Z80) { + ZetOpen(1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + } + + if (DrvSoundCPUType == DD_CPU_TYPE_M6809 && pBurnSoundOut) { + M6809Open(0); + MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + MSM5205Render(1, pBurnSoundOut, nBurnSoundLen); + M6809Close(); + } + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029719; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + HD6309Scan(nAction); + + if (DrvSubCPUType == DD_CPU_TYPE_HD63701) HD63701Scan(nAction); + if (DrvSubCPUType == DD_CPU_TYPE_M6803) M6803Scan(nAction); + if (DrvSubCPUType == DD_CPU_TYPE_Z80 || DrvSoundCPUType == DD_CPU_TYPE_Z80) ZetScan(nAction); + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) M6809Scan(nAction); + if (DrvGameType == DD_GAME_DARKTOWR) m68705Scan(nAction, pnMin); + + BurnYM2151Scan(nAction); + if (DrvSoundCPUType == DD_CPU_TYPE_Z80) MSM6295Scan(0, nAction); + if (DrvSoundCPUType == DD_CPU_TYPE_M6809) MSM5205Scan(nAction, pnMin); + + SCAN_VAR(DrvRomBank); + SCAN_VAR(DrvVBlank); + SCAN_VAR(DrvSubCPUBusy); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(DrvScrollXHi); + SCAN_VAR(DrvScrollYHi); + SCAN_VAR(DrvScrollXLo); + SCAN_VAR(DrvScrollYLo); + SCAN_VAR(DrvADPCMIdle); + SCAN_VAR(DrvADPCMPos); + SCAN_VAR(DrvADPCMEnd); + SCAN_VAR(DrvADPCMData); + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + + if (nAction & ACB_WRITE) { + HD6309Open(0); + HD6309MapMemory(DrvHD6309Rom + 0x8000 + (DrvRomBank * 0x4000), 0x4000, 0x7fff, M6809_ROM); + HD6309Close(); + + if (DrvSubCPUBusy == 0) { + if (DrvSubCPUType == DD_CPU_TYPE_HD63701) { + HD63701SetIRQLine(HD63701_INPUT_LINE_NMI, HD63701_IRQSTATUS_ACK); + } + + if (DrvSubCPUType == DD_CPU_TYPE_M6803) { + M6803SetIRQLine(M6803_INPUT_LINE_NMI, M6803_IRQSTATUS_ACK); + } + } + } + } + + return 0; +} + +struct BurnDriver BurnDrvDdragon = { + "ddragon", NULL, NULL, NULL, "1987", + "Double Dragon (Japan)\0", NULL, "Technos", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdragonw = { + "ddragonw", "ddragon", NULL, NULL, "1987", + "Double Dragon (World set 1)\0", NULL, "[Technos] (Taito license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvwRomInfo, DrvwRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdragnw1 = { + "ddragonw1", "ddragon", NULL, NULL, "1987", + "Double Dragon (World set 2)\0", NULL, "[Technos] (Taito license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, Drvw1RomInfo, Drvw1RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdragonu = { + "ddragonu", "ddragon", NULL, NULL, "1987", + "Double Dragon (US set 1)\0", NULL, "[Technos] (Taito America license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvuRomInfo, DrvuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdragoua = { + "ddragonua", "ddragon", NULL, NULL, "1987", + "Double Dragon (US set 2)\0", NULL, "[Technos] (Taito America license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvuaRomInfo, DrvuaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdragoub = { + "ddragonub", "ddragon", NULL, NULL, "1987", + "Double Dragon (US set 3)\0", NULL, "[Technos] (Taito America license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvubRomInfo, DrvubRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdragob2 = { + "ddragonb2", "ddragon", NULL, NULL, "1987", + "Double Dragon (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, Drvb2RomInfo, Drvb2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdragonb = { + "ddragonb", "ddragon", NULL, NULL, "1987", + "Double Dragon (bootleg with HD6309)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvbInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdragnba = { + "ddragonba", "ddragon", NULL, NULL, "1987", + "Double Dragon (bootleg with M6803)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvbaRomInfo, DrvbaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvbaInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdragon2 = { + "ddragon2", NULL, NULL, NULL, "1988", + "Double Dragon II - The Revenge (World)\0", NULL, "Technos", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, Drv2RomInfo, Drv2RomName, NULL, NULL, DrvInputInfo, Drv2DIPInfo, + Drv2Init, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdragon2u = { + "ddragon2u", "ddragon2", NULL, NULL, "1988", + "Double Dragon II - The Revenge (US)\0", NULL, "Technos", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, Drv2uRomInfo, Drv2uRomName, NULL, NULL, DrvInputInfo, Drv2DIPInfo, + Drv2Init, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriverD BurnDrvDdungeon = { + "ddungeon", NULL, NULL, NULL, "1992", + "Dangerous Dungeons\0", NULL, "Game Room", "Miscellaneous", + NULL, NULL, NULL, NULL, + 0, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DdungeonRomInfo, DdungeonRomName, NULL, NULL, DrvInputInfo, DdungeonDIPInfo, + DdungeonInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDarktowr = { + "darktowr", NULL, NULL, NULL, "1992", + "Dark Tower\0", NULL, "Game Room", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DarktowrRomInfo, DarktowrRomName, NULL, NULL, DrvInputInfo, DarktowrDIPInfo, + DarktowrInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x180, 256, 240, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_dkong.cpp b/src/burn/drv/pre90s/d_dkong.cpp index 8e1924b17..614257bdb 100644 --- a/src/burn/drv/pre90s/d_dkong.cpp +++ b/src/burn/drv/pre90s/d_dkong.cpp @@ -1310,7 +1310,6 @@ static INT32 DrvInit(INT32 (*pRomLoadCallback)(), void (*pPaletteUpdate)(), UINT ZetSetWriteHandler(dkong_main_write); ZetSetReadHandler(dkong_main_read); - ZetMemEnd(); ZetClose(); I8039Init(NULL); diff --git a/src/burn/drv/pre90s/d_epos.cpp b/src/burn/drv/pre90s/d_epos.cpp index 7248b9ed9..9d0719672 100644 --- a/src/burn/drv/pre90s/d_epos.cpp +++ b/src/burn/drv/pre90s/d_epos.cpp @@ -1,933 +1,931 @@ -// FB Alpha Epos Tristar Hardware driver module -// Based on MAME driver by Zsolt Vasvari - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "8255ppi.h" -#include "bitswap.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvColPROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvVidRAM; -static UINT32 *Palette; -static UINT32 *DrvPalette; - -static INT16* pAY8910Buffer[3]; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[2]; -static UINT8 DrvReset; - -static UINT8 *DrvPaletteBank; -static UINT8 *DealerZ80Bank; -static UINT8 *DealerZ80Bank2; - -static int watchdog; - -static struct BurnInputInfo MegadonInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Megadon) - -static struct BurnInputInfo SuprglobInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 4, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 5, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Suprglob) - -static struct BurnInputInfo DealerInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 6, "p1 coin" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 4" }, - {"P1 Button 5", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 5" }, - {"P1 Button 6", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 6" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Dealer) - - -static struct BurnDIPInfo MegadonDIPList[]= -{ - {0x07, 0xff, 0xff, 0x28, NULL }, - {0x08, 0xff, 0xff, 0xfe, NULL }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x07, 0x01, 0x01, 0x00, "1 Coin 1 Credits " }, - {0x07, 0x01, 0x01, 0x01, "1 Coin 2 Credits " }, - - {0 , 0xfe, 0 , 2, "Fuel Consumption" }, - {0x07, 0x01, 0x02, 0x00, "Slow" }, - {0x07, 0x01, 0x02, 0x02, "Fast" }, - - {0 , 0xfe, 0 , 2, "Rotation" }, - {0x07, 0x01, 0x04, 0x04, "Slow" }, - {0x07, 0x01, 0x04, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2, "ERG" }, - {0x07, 0x01, 0x08, 0x08, "Easy" }, - {0x07, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2, "Enemy Fire Rate" }, - {0x07, 0x01, 0x20, 0x20, "Slow" }, - {0x07, 0x01, 0x20, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x07, 0x01, 0x50, 0x00, "3" }, - {0x07, 0x01, 0x50, 0x10, "4" }, - {0x07, 0x01, 0x50, 0x40, "5" }, - {0x07, 0x01, 0x50, 0x50, "6" }, - - {0 , 0xfe, 0 , 2, "Game Mode" }, - {0x07, 0x01, 0x80, 0x00, "Arcade" }, - {0x07, 0x01, 0x80, 0x80, "Contest" }, -}; - -STDDIPINFO(Megadon) - -static struct BurnDIPInfo SuprglobDIPList[]= -{ - // Default Values - {0x09, 0xff, 0xff, 0x00, NULL }, - {0x0A, 0xff, 0xff, 0xbe, NULL }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x09, 0x01, 0x01, 0x00, "1 Coin 1 Credits " }, - {0x09, 0x01, 0x01, 0x01, "1 Coin 2 Credits " }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x09, 0x01, 0x08, 0x00, "10000 + Difficulty * 10000" }, - {0x09, 0x01, 0x08, 0x08, "90000 + Difficulty * 10000" }, - - {0 , 0xfe, 0 , 8, "Difficulty" }, - {0x09, 0x01, 0x26, 0x00, "1" }, - {0x09, 0x01, 0x26, 0x02, "2" }, - {0x09, 0x01, 0x26, 0x20, "3" }, - {0x09, 0x01, 0x26, 0x22, "4" }, - {0x09, 0x01, 0x26, 0x04, "5" }, - {0x09, 0x01, 0x26, 0x06, "6" }, - {0x09, 0x01, 0x26, 0x24, "7" }, - {0x09, 0x01, 0x26, 0x26, "8" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x09, 0x01, 0x50, 0x00, "3" }, - {0x09, 0x01, 0x50, 0x10, "4" }, - {0x09, 0x01, 0x50, 0x40, "5" }, - {0x09, 0x01, 0x50, 0x50, "6" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x09, 0x01, 0x80, 0x80, "Off" }, - {0x09, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Suprglob) - -static struct BurnDIPInfo IgmoDIPList[]= -{ - {0x09, 0xff, 0xff, 0x00, NULL }, - {0x0A, 0xff, 0xff, 0xfe, NULL }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x09, 0x01, 0x01, 0x00, "1 Coin 1 Credits " }, - {0x09, 0x01, 0x01, 0x01, "1 Coin 2 Credits " }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x09, 0x01, 0x22, 0x00, "20000" }, - {0x09, 0x01, 0x22, 0x02, "40000" }, - {0x09, 0x01, 0x22, 0x20, "60000" }, - {0x09, 0x01, 0x22, 0x22, "80000" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x09, 0x01, 0x50, 0x00, "3" }, - {0x09, 0x01, 0x50, 0x10, "4" }, - {0x09, 0x01, 0x50, 0x40, "5" }, - {0x09, 0x01, 0x50, 0x50, "6" }, - - {0 , 0xfe, 0 , 8, "Difficulty" }, - {0x09, 0x01, 0x8c, 0x00, "1" }, - {0x09, 0x01, 0x8c, 0x04, "2" }, - {0x09, 0x01, 0x8c, 0x08, "3" }, - {0x09, 0x01, 0x8c, 0x0c, "4" }, - {0x09, 0x01, 0x8c, 0x80, "5" }, - {0x09, 0x01, 0x8c, 0x84, "6" }, - {0x09, 0x01, 0x8c, 0x88, "7" }, - {0x09, 0x01, 0x8c, 0x8c, "8" }, -}; - -STDDIPINFO(Igmo) - -static struct BurnDIPInfo CatapultDIPList[]= -{ - {0x09, 0xff, 0xff, 0x00, NULL }, - {0x0A, 0xff, 0xff, 0xfe, NULL }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x09, 0x01, 0x01, 0x00, "1 Coin 1 Credits " }, - {0x09, 0x01, 0x01, 0x01, "1 Coin 2 Credits " }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x09, 0x01, 0x0c, 0x00, "20000" }, - {0x09, 0x01, 0x0c, 0x04, "40000" }, - {0x09, 0x01, 0x0c, 0x08, "60000" }, - {0x09, 0x01, 0x0c, 0x0c, "80000" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x09, 0x01, 0x22, 0x00, "1" }, - {0x09, 0x01, 0x22, 0x02, "2" }, - {0x09, 0x01, 0x22, 0x20, "3" }, - {0x09, 0x01, 0x22, 0x22, "4" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x09, 0x01, 0x50, 0x00, "3" }, - {0x09, 0x01, 0x50, 0x10, "4" }, - {0x09, 0x01, 0x50, 0x40, "5" }, - {0x09, 0x01, 0x50, 0x50, "6" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x09, 0x01, 0x80, 0x80, "Off" }, - {0x09, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Catapult) - -static struct BurnDIPInfo DealerDIPList[]= -{ - {0x08, 0xff, 0xff, 0xfe, NULL }, - {0x09, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x08, 0x01, 0x01, 0x01, "Off" }, - {0x08, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x08, 0x01, 0x02, 0x02, "Off" }, - {0x08, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x08, 0x01, 0x40, 0x40, "Upright" }, - {0x08, 0x01, 0x40, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x08, 0x01, 0x80, 0x80, "Off" }, - {0x08, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Dealer) - -UINT8 __fastcall epos_read_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return DrvDips[0]; - - case 0x01: - return DrvInputs[0]; - - case 0x02: - return DrvInputs[1]; - - case 0x03: - return 0; - } - - return 0; -} - -void __fastcall epos_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - watchdog = 0; - return; - - case 0x01: - *DrvPaletteBank = (data << 1) & 0x10; - return; - - case 0x02: - AY8910Write(0, 1, data); - return; - - case 0x06: - AY8910Write(0, 0, data); - return; - } -} - -static void dealer_set_bank() -{ - ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM + (*DealerZ80Bank << 16)); - ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM + (*DealerZ80Bank << 16)); -} - -static void dealer_bankswitch(INT32 offset) -{ - INT32 nBank = *DealerZ80Bank; - - if (offset & 4) { - nBank = (nBank + 1) & 3; - } else { - nBank = (nBank - 1) & 3; - } - - *DealerZ80Bank = nBank; - - dealer_set_bank(); -} - -static void dealer_bankswitch2(INT32 data) -{ - *DealerZ80Bank2 = data & 1; - - INT32 nBank = 0x6000 + ((data & 1) << 12); - ZetMapArea(0x6000, 0x6fff, 0, DrvZ80ROM + nBank); - ZetMapArea(0x6000, 0x6fff, 2, DrvZ80ROM + nBank); -} - -UINT8 __fastcall dealer_read_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x10: - case 0x11: - case 0x12: - case 0x13: - return ppi8255_r(0, port & 3); - - case 0x38: - return DrvDips[0]; - } - - return 0; -} - -void __fastcall dealer_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x10: - case 0x11: - case 0x12: - case 0x13: - ppi8255_w(0, port & 3, data); - return; - - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - dealer_bankswitch(port & 7); - return; - - case 0x34: - AY8910Write(0, 1, data); - return; - - case 0x3c: - AY8910Write(0, 0, data); - return; - - case 0x40: - watchdog = 0; - return; - } -} - -UINT8 DealerPPIReadA() -{ - return DrvInputs[1]; -} - -void DealerPPIWriteC(UINT8 data) -{ - dealer_bankswitch2(data); -} - -static INT32 DrvDoReset(INT32 full_reset) -{ - if (full_reset) { - memset (AllRam, 0, RamEnd - AllRam); - } - - ZetOpen(0); - ZetReset(); - dealer_set_bank(); - dealer_bankswitch2(0); - ZetClose(); - - AY8910Reset(0); - - watchdog = 0; - - return 0; -} - -static void DrvPaletteInit(INT32 num) -{ - UINT8 prom[32] = { // in case the set lacks a prom dump - 0x00, 0xE1, 0xC3, 0xFC, 0xEC, 0xF8, 0x34, 0xFF, - 0x17, 0xF0, 0xEE, 0xEF, 0xAC, 0xC2, 0x1C, 0x07, - 0x00, 0xE1, 0xC3, 0xFC, 0xEC, 0xF8, 0x34, 0xFF, - 0x17, 0xF0, 0xEE, 0xEF, 0xAC, 0xC2, 0x1C, 0x07 - }; - - memcpy (DrvColPROM, prom, 32); - - BurnLoadRom(DrvColPROM, num, 1); - - for (INT32 i = 0; i < 0x20; i++) { - Palette[i] = BITSWAP24(DrvColPROM[i], 7,6,5,7,6,6,7,5,4,3,2,4,3,3,4,2,1,0,1,0,1,1,0,1); - } -} - -static void DealerDecode() -{ - for (INT32 i = 0;i < 0x8000;i++) - DrvZ80ROM[i + 0x00000] = BITSWAP08(DrvZ80ROM[i] ^ 0xbd, 2,6,4,0,5,7,1,3); - - for (INT32 i = 0;i < 0x8000;i++) - DrvZ80ROM[i + 0x10000] = BITSWAP08(DrvZ80ROM[i] ^ 0x00, 7,5,4,6,3,2,1,0); - - for (INT32 i = 0;i < 0x8000;i++) - DrvZ80ROM[i + 0x20000] = BITSWAP08(DrvZ80ROM[i] ^ 0x01, 7,6,5,4,3,0,2,1); - - for (INT32 i = 0;i < 0x8000;i++) - DrvZ80ROM[i + 0x30000] = BITSWAP08(DrvZ80ROM[i] ^ 0x01, 7,5,4,6,3,0,2,1); -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x040000; - - DrvColPROM = Next; Next += 0x000020; - - Palette = (UINT32*)Next; Next += 0x0020 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x0020 * sizeof(UINT32); - - pAY8910Buffer[0] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x001000; - DrvVidRAM = Next; Next += 0x008000; - - DrvPaletteBank = Next; Next += 0x000001; - DealerZ80Bank = Next; Next += 0x000001; - DealerZ80Bank2 = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x1000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x2000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x3000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x4000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x5000, 5, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x6000, 6, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x7000, 7, 1)) return 1; - - DrvPaletteInit(8); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x77ff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x77ff, 2, DrvZ80ROM); - ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); - ZetMapArea(0x8000, 0xffff, 0, DrvVidRAM); - ZetMapArea(0x8000, 0xffff, 1, DrvVidRAM); - ZetMapArea(0x8000, 0xffff, 2, DrvVidRAM); - ZetSetInHandler(epos_read_port); - ZetSetOutHandler(epos_write_port); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 2750000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(1); - - return 0; -} - -static INT32 DealerInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x4000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x6000, 3, 1)) return 1; - - DrvPaletteInit(4); - DealerDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x6fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x6fff, 2, DrvZ80ROM); - ZetMapArea(0x7000, 0x7fff, 0, DrvZ80RAM); - ZetMapArea(0x7000, 0x7fff, 1, DrvZ80RAM); - ZetMapArea(0x7000, 0x7fff, 2, DrvZ80RAM); - ZetMapArea(0x8000, 0xffff, 0, DrvVidRAM); - ZetMapArea(0x8000, 0xffff, 1, DrvVidRAM); - ZetMapArea(0x8000, 0xffff, 2, DrvVidRAM); - ZetSetInHandler(dealer_read_port); - ZetSetOutHandler(dealer_write_port); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 2750000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - - ppi8255_init(1); - PPI0PortReadA = DealerPPIReadA; - PPI0PortWriteC = DealerPPIWriteC; - - GenericTilesInit(); - - DrvDoReset(1); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - AY8910Exit(0); - ZetExit(); - - if (PPI0PortReadA) { - ppi8255_exit(); - } - - BurnFree(AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - UINT8 r,g,b; - for (INT32 i = 0; i < 0x20; i++) { - INT32 rgb = Palette[i]; - r = (rgb >> 16) & 0xff; - g = (rgb >> 8) & 0xff; - b = (rgb >> 0) & 0xff; - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } - - DrvRecalc = 0; - } - - for (INT32 i = 0; i < 0x8000; i++) - { - INT32 x = (i % 136) << 1; - INT32 y = (i / 136); - if (y > 235) break; - - pTransDraw[(y * nScreenWidth) + x + 0] = *DrvPaletteBank | ((DrvVidRAM[i] >> 0) & 0x0f); - pTransDraw[(y * nScreenWidth) + x + 1] = *DrvPaletteBank | ((DrvVidRAM[i] >> 4) & 0x0f); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - watchdog++; - if (watchdog > 180) { - DrvDoReset(0); - } - - if (DrvReset) { - DrvDoReset(1); - } - - { - DrvInputs[0] = DrvDips[1]; - DrvInputs[1] = 0xff; - for (INT32 i = 0; i < 8; i++) - { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - ZetOpen(0); - ZetRun(2750000 / 60); - ZetRaiseIrq(0); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - AY8910Scan(nAction, pnMin); - - if (PPI0PortReadA) { - ppi8255_scan(); - - if (nAction & ACB_WRITE) { - dealer_set_bank(); - dealer_bankswitch2(*DealerZ80Bank2); - } - } - } - - return 0; -} - - -// Megadon - -static struct BurnRomInfo megadonRomDesc[] = { - { "2732u10b.bin", 0x1000, 0xaf8fbe80, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "2732u09b.bin", 0x1000, 0x097d1e73, BRF_ESS | BRF_PRG }, // 1 - { "2732u08b.bin", 0x1000, 0x526784da, BRF_ESS | BRF_PRG }, // 2 - { "2732u07b.bin", 0x1000, 0x5b060910, BRF_ESS | BRF_PRG }, // 3 - { "2732u06b.bin", 0x1000, 0x8ac8af6d, BRF_ESS | BRF_PRG }, // 4 - { "2732u05b.bin", 0x1000, 0x052bb603, BRF_ESS | BRF_PRG }, // 5 - { "2732u04b.bin", 0x1000, 0x9b8b7e92, BRF_ESS | BRF_PRG }, // 6 - { "2716u11b.bin", 0x0800, 0x599b8b61, BRF_ESS | BRF_PRG }, // 7 - - { "74s288.bin", 0x0020, 0xc779ea99, BRF_GRA }, // 8 Color PROM -}; - -STD_ROM_PICK(megadon) -STD_ROM_FN(megadon) - -struct BurnDriver BurnDrvMegadon = { - "megadon", NULL, NULL, NULL, "1982", - "Megadon\0", NULL, "Epos Corporation (Photar Industries License)", "EPOS Tristar", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, megadonRomInfo, megadonRomName, NULL, NULL, MegadonInputInfo, MegadonDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 236, 272, 3, 4 -}; - - -// Catapult - -static struct BurnRomInfo catapultRomDesc[] = { - { "co3223.u10", 0x1000, 0x50abcfd2, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "co3223.u09", 0x1000, 0xfd5a9a1c, BRF_ESS | BRF_PRG }, // 1 - { "co3223.u08", 0x1000, 0x4bfc36f3, BRF_ESS | BRF_PRG }, // 2 - { "co3223.u07", 0x1000, 0x4113bb99, BRF_ESS | BRF_PRG }, // 3 - { "co3223.u06", 0x1000, 0x966bb9f5, BRF_ESS | BRF_PRG }, // 4 - { "co3223.u05", 0x1000, 0x65f9fb9a, BRF_ESS | BRF_PRG }, // 5 - { "co3223.u04", 0x1000, 0x648453bc, BRF_ESS | BRF_PRG }, // 6 - { "co3223.u11", 0x0800, 0x08fb8c28, BRF_ESS | BRF_PRG }, // 7 - - { "co3223.u66", 0x0020, 0xe7de76a7, BRF_GRA }, // 8 Color PROM -}; - -STD_ROM_PICK(catapult) -STD_ROM_FN(catapult) - -struct BurnDriverD BurnDrvCatapult = { - "catapult", NULL, NULL, NULL, "1982", - "Catapult\0", "Bad dump", "Epos Corporation", "EPOS Tristar", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, catapultRomInfo, catapultRomName, NULL, NULL, SuprglobInputInfo, CatapultDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 236, 272, 3, 4 -}; - - -// Super Glob - -static struct BurnRomInfo suprglobRomDesc[] = { - { "u10", 0x1000, 0xc0141324, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "u9", 0x1000, 0x58be8128, BRF_ESS | BRF_PRG }, // 1 - { "u8", 0x1000, 0x6d088c16, BRF_ESS | BRF_PRG }, // 2 - { "u7", 0x1000, 0xb2768203, BRF_ESS | BRF_PRG }, // 3 - { "u6", 0x1000, 0x976c8f46, BRF_ESS | BRF_PRG }, // 4 - { "u5", 0x1000, 0x340f5290, BRF_ESS | BRF_PRG }, // 5 - { "u4", 0x1000, 0x173bd589, BRF_ESS | BRF_PRG }, // 6 - { "u11", 0x0800, 0xd45b740d, BRF_ESS | BRF_PRG }, // 7 - - { "82s123.u66", 0x0020, 0xf4f6ddc5, BRF_GRA }, // 8 Color PROM -}; - -STD_ROM_PICK(suprglob) -STD_ROM_FN(suprglob) - -struct BurnDriver BurnDrvSuprglob = { - "suprglob", NULL, NULL, NULL, "1983", - "Super Glob\0", NULL, "Epos Corporation", "EPOS Tristar", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, suprglobRomInfo, suprglobRomName, NULL, NULL, SuprglobInputInfo, SuprglobDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 236, 272, 3, 4 -}; - - -// The Glob - -static struct BurnRomInfo theglobRomDesc[] = { - { "globu10.bin", 0x1000, 0x08fdb495, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "globu9.bin", 0x1000, 0x827cd56c, BRF_ESS | BRF_PRG }, // 1 - { "globu8.bin", 0x1000, 0xd1219966, BRF_ESS | BRF_PRG }, // 2 - { "globu7.bin", 0x1000, 0xb1649da7, BRF_ESS | BRF_PRG }, // 3 - { "globu6.bin", 0x1000, 0xb3457e67, BRF_ESS | BRF_PRG }, // 4 - { "globu5.bin", 0x1000, 0x89d582cd, BRF_ESS | BRF_PRG }, // 5 - { "globu4.bin", 0x1000, 0x7ee9fdeb, BRF_ESS | BRF_PRG }, // 6 - { "globu11.bin", 0x0800, 0x9e05dee3, BRF_ESS | BRF_PRG }, // 7 - - { "82s123.u66", 0x0020, 0xf4f6ddc5, BRF_GRA }, // 8 Color PROM -}; - -STD_ROM_PICK(theglob) -STD_ROM_FN(theglob) - -struct BurnDriver BurnDrvTheglob = { - "theglob", "suprglob", NULL, NULL, "1983", - "The Glob\0", NULL, "Epos Corporation", "EPOS Tristar", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, theglobRomInfo, theglobRomName, NULL, NULL, SuprglobInputInfo, SuprglobDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 236, 272, 3, 4 -}; - - -// The Glob (earlier) - -static struct BurnRomInfo theglob2RomDesc[] = { - { "611293.u10", 0x1000, 0x870af7ce, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "611293.u9", 0x1000, 0xa3679782, BRF_ESS | BRF_PRG }, // 1 - { "611293.u8", 0x1000, 0x67499d1a, BRF_ESS | BRF_PRG }, // 2 - { "611293.u7", 0x1000, 0x55e53aac, BRF_ESS | BRF_PRG }, // 3 - { "611293.u6", 0x1000, 0xc64ad743, BRF_ESS | BRF_PRG }, // 4 - { "611293.u5", 0x1000, 0xf93c3203, BRF_ESS | BRF_PRG }, // 5 - { "611293.u4", 0x1000, 0xceea0018, BRF_ESS | BRF_PRG }, // 6 - { "611293.u11", 0x0800, 0x6ac83f9b, BRF_ESS | BRF_PRG }, // 7 - - { "82s123.u66", 0x0020, 0xf4f6ddc5, BRF_GRA }, // 8 Color PROM -}; - -STD_ROM_PICK(theglob2) -STD_ROM_FN(theglob2) - -struct BurnDriver BurnDrvTheglob2 = { - "theglob2", "suprglob", NULL, NULL, "1983", - "The Glob (earlier)\0", NULL, "Epos Corporation", "EPOS Tristar", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, theglob2RomInfo, theglob2RomName, NULL, NULL, SuprglobInputInfo, SuprglobDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 236, 272, 3, 4 -}; - - -// The Glob (set 3) - -static struct BurnRomInfo theglob3RomDesc[] = { - { "theglob3.u10", 0x1000, 0x969cfaf6, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "theglob3.u9", 0x1000, 0x8e6c010a, BRF_ESS | BRF_PRG }, // 1 - { "theglob3.u8", 0x1000, 0x1c1ca5c8, BRF_ESS | BRF_PRG }, // 2 - { "theglob3.u7", 0x1000, 0xa54b9d22, BRF_ESS | BRF_PRG }, // 3 - { "theglob3.u6", 0x1000, 0x5a6f82a9, BRF_ESS | BRF_PRG }, // 4 - { "theglob3.u5", 0x1000, 0x72f935db, BRF_ESS | BRF_PRG }, // 5 - { "theglob3.u4", 0x1000, 0x81db53ad, BRF_ESS | BRF_PRG }, // 6 - { "theglob3.u11", 0x0800, 0x0e2e6359, BRF_ESS | BRF_PRG }, // 7 - - { "82s123.u66", 0x0020, 0xf4f6ddc5, BRF_GRA }, // 8 Color PROM -}; - -STD_ROM_PICK(theglob3) -STD_ROM_FN(theglob3) - -struct BurnDriver BurnDrvTheglob3 = { - "theglob3", "suprglob", NULL, NULL, "1983", - "The Glob (set 3)\0", NULL, "Epos Corporation", "EPOS Tristar", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, theglob3RomInfo, theglob3RomName, NULL, NULL, SuprglobInputInfo, SuprglobDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 236, 272, 3, 4 -}; - - -// IGMO - -static struct BurnRomInfo igmoRomDesc[] = { - { "igmo-u10.732", 0x1000, 0xa9f691a4, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "igmo-u9.732", 0x1000, 0x3c133c97, BRF_ESS | BRF_PRG }, // 1 - { "igmo-u8.732", 0x1000, 0x5692f8d8, BRF_ESS | BRF_PRG }, // 2 - { "igmo-u7.732", 0x1000, 0x630ae2ed, BRF_ESS | BRF_PRG }, // 3 - { "igmo-u6.732", 0x1000, 0xd3f20e1d, BRF_ESS | BRF_PRG }, // 4 - { "igmo-u5.732", 0x1000, 0xe26bb391, BRF_ESS | BRF_PRG }, // 5 - { "igmo-u4.732", 0x1000, 0x762a4417, BRF_ESS | BRF_PRG }, // 6 - { "igmo-u11.716", 0x0800, 0x8c675837, BRF_ESS | BRF_PRG }, // 7 - - { "82s123.u66", 0x0020, 0x00000000, BRF_GRA | BRF_NODUMP }, // 8 Color Prom (missing) -}; - -STD_ROM_PICK(igmo) -STD_ROM_FN(igmo) - -struct BurnDriver BurnDrvIgmo = { - "igmo", NULL, NULL, NULL, "1984", - "IGMO\0", "Incorrect Colors", "Epos Corporation", "EPOS Tristar", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, igmoRomInfo, igmoRomName, NULL, NULL, SuprglobInputInfo, IgmoDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 236, 272, 3, 4 -}; - - -// The Dealer - -static struct BurnRomInfo dealerRomDesc[] = { - { "u1.bin", 0x2000, 0xe06f3563, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "u2.bin", 0x2000, 0x726bbbd6, BRF_ESS | BRF_PRG }, // 1 - { "u3.bin", 0x2000, 0xab721455, BRF_ESS | BRF_PRG }, // 2 - { "u4.bin", 0x2000, 0xddb903e4, BRF_ESS | BRF_PRG }, // 3 - - { "82s123.u66", 0x0020, 0x00000000, BRF_GRA | BRF_NODUMP }, // 4 Color Prom (missing) -}; - -STD_ROM_PICK(dealer) -STD_ROM_FN(dealer) - -struct BurnDriver BurnDrvDealer = { - "dealer", NULL, NULL, NULL, "198?", - "The Dealer\0", "Incorrect Colors", "Epos Corporation", "EPOS Tristar", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_CASINO, 0, - NULL, dealerRomInfo, dealerRomName, NULL, NULL, DealerInputInfo, DealerDIPInfo, - DealerInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 236, 272, 3, 4 -}; - - -// Revenger - -static struct BurnRomInfo revengerRomDesc[] = { - { "r06124.u1", 0x2000, 0xfad1a2a5, BRF_ESS | BRF_PRG }, // 0 Z80 code - { "r06124.u2", 0x2000, 0xa8e0ee7b, BRF_ESS | BRF_PRG }, // 1 - { "r06124.u3", 0x2000, 0xcca414a5, BRF_ESS | BRF_PRG }, // 2 - { "r06124.u4", 0x2000, 0x0b81c303, BRF_ESS | BRF_PRG }, // 3 - - { "82s123.u66", 0x0020, 0x00000000, BRF_GRA | BRF_NODUMP }, // 4 Color Prom (missing) -}; - -STD_ROM_PICK(revenger) -STD_ROM_FN(revenger) - -struct BurnDriverD BurnDrvRevenger = { - "revenger", NULL, NULL, NULL, "1984", - "Revenger\0", "Bad dump", "Epos Corporation", "EPOS Tristar", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, revengerRomInfo, revengerRomName, NULL, NULL, DealerInputInfo, DealerDIPInfo, - DealerInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 236, 272, 3, 4 -}; +// FB Alpha Epos Tristar Hardware driver module +// Based on MAME driver by Zsolt Vasvari + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "8255ppi.h" +#include "bitswap.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvColPROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvVidRAM; +static UINT32 *Palette; +static UINT32 *DrvPalette; + +static INT16* pAY8910Buffer[3]; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[2]; +static UINT8 DrvReset; + +static UINT8 *DrvPaletteBank; +static UINT8 *DealerZ80Bank; +static UINT8 *DealerZ80Bank2; + +static int watchdog; + +static struct BurnInputInfo MegadonInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Megadon) + +static struct BurnInputInfo SuprglobInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 4, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 5, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Suprglob) + +static struct BurnInputInfo DealerInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 6, "p1 coin" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 4" }, + {"P1 Button 5", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 5" }, + {"P1 Button 6", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 6" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Dealer) + + +static struct BurnDIPInfo MegadonDIPList[]= +{ + {0x07, 0xff, 0xff, 0x28, NULL }, + {0x08, 0xff, 0xff, 0xfe, NULL }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x07, 0x01, 0x01, 0x00, "1 Coin 1 Credits " }, + {0x07, 0x01, 0x01, 0x01, "1 Coin 2 Credits " }, + + {0 , 0xfe, 0 , 2, "Fuel Consumption" }, + {0x07, 0x01, 0x02, 0x00, "Slow" }, + {0x07, 0x01, 0x02, 0x02, "Fast" }, + + {0 , 0xfe, 0 , 2, "Rotation" }, + {0x07, 0x01, 0x04, 0x04, "Slow" }, + {0x07, 0x01, 0x04, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2, "ERG" }, + {0x07, 0x01, 0x08, 0x08, "Easy" }, + {0x07, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2, "Enemy Fire Rate" }, + {0x07, 0x01, 0x20, 0x20, "Slow" }, + {0x07, 0x01, 0x20, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x07, 0x01, 0x50, 0x00, "3" }, + {0x07, 0x01, 0x50, 0x10, "4" }, + {0x07, 0x01, 0x50, 0x40, "5" }, + {0x07, 0x01, 0x50, 0x50, "6" }, + + {0 , 0xfe, 0 , 2, "Game Mode" }, + {0x07, 0x01, 0x80, 0x00, "Arcade" }, + {0x07, 0x01, 0x80, 0x80, "Contest" }, +}; + +STDDIPINFO(Megadon) + +static struct BurnDIPInfo SuprglobDIPList[]= +{ + // Default Values + {0x09, 0xff, 0xff, 0x00, NULL }, + {0x0A, 0xff, 0xff, 0xbe, NULL }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x09, 0x01, 0x01, 0x00, "1 Coin 1 Credits " }, + {0x09, 0x01, 0x01, 0x01, "1 Coin 2 Credits " }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x09, 0x01, 0x08, 0x00, "10000 + Difficulty * 10000" }, + {0x09, 0x01, 0x08, 0x08, "90000 + Difficulty * 10000" }, + + {0 , 0xfe, 0 , 8, "Difficulty" }, + {0x09, 0x01, 0x26, 0x00, "1" }, + {0x09, 0x01, 0x26, 0x02, "2" }, + {0x09, 0x01, 0x26, 0x20, "3" }, + {0x09, 0x01, 0x26, 0x22, "4" }, + {0x09, 0x01, 0x26, 0x04, "5" }, + {0x09, 0x01, 0x26, 0x06, "6" }, + {0x09, 0x01, 0x26, 0x24, "7" }, + {0x09, 0x01, 0x26, 0x26, "8" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x09, 0x01, 0x50, 0x00, "3" }, + {0x09, 0x01, 0x50, 0x10, "4" }, + {0x09, 0x01, 0x50, 0x40, "5" }, + {0x09, 0x01, 0x50, 0x50, "6" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x09, 0x01, 0x80, 0x80, "Off" }, + {0x09, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Suprglob) + +static struct BurnDIPInfo IgmoDIPList[]= +{ + {0x09, 0xff, 0xff, 0x00, NULL }, + {0x0A, 0xff, 0xff, 0xfe, NULL }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x09, 0x01, 0x01, 0x00, "1 Coin 1 Credits " }, + {0x09, 0x01, 0x01, 0x01, "1 Coin 2 Credits " }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x09, 0x01, 0x22, 0x00, "20000" }, + {0x09, 0x01, 0x22, 0x02, "40000" }, + {0x09, 0x01, 0x22, 0x20, "60000" }, + {0x09, 0x01, 0x22, 0x22, "80000" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x09, 0x01, 0x50, 0x00, "3" }, + {0x09, 0x01, 0x50, 0x10, "4" }, + {0x09, 0x01, 0x50, 0x40, "5" }, + {0x09, 0x01, 0x50, 0x50, "6" }, + + {0 , 0xfe, 0 , 8, "Difficulty" }, + {0x09, 0x01, 0x8c, 0x00, "1" }, + {0x09, 0x01, 0x8c, 0x04, "2" }, + {0x09, 0x01, 0x8c, 0x08, "3" }, + {0x09, 0x01, 0x8c, 0x0c, "4" }, + {0x09, 0x01, 0x8c, 0x80, "5" }, + {0x09, 0x01, 0x8c, 0x84, "6" }, + {0x09, 0x01, 0x8c, 0x88, "7" }, + {0x09, 0x01, 0x8c, 0x8c, "8" }, +}; + +STDDIPINFO(Igmo) + +static struct BurnDIPInfo CatapultDIPList[]= +{ + {0x09, 0xff, 0xff, 0x00, NULL }, + {0x0A, 0xff, 0xff, 0xfe, NULL }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x09, 0x01, 0x01, 0x00, "1 Coin 1 Credits " }, + {0x09, 0x01, 0x01, 0x01, "1 Coin 2 Credits " }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x09, 0x01, 0x0c, 0x00, "20000" }, + {0x09, 0x01, 0x0c, 0x04, "40000" }, + {0x09, 0x01, 0x0c, 0x08, "60000" }, + {0x09, 0x01, 0x0c, 0x0c, "80000" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x09, 0x01, 0x22, 0x00, "1" }, + {0x09, 0x01, 0x22, 0x02, "2" }, + {0x09, 0x01, 0x22, 0x20, "3" }, + {0x09, 0x01, 0x22, 0x22, "4" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x09, 0x01, 0x50, 0x00, "3" }, + {0x09, 0x01, 0x50, 0x10, "4" }, + {0x09, 0x01, 0x50, 0x40, "5" }, + {0x09, 0x01, 0x50, 0x50, "6" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x09, 0x01, 0x80, 0x80, "Off" }, + {0x09, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Catapult) + +static struct BurnDIPInfo DealerDIPList[]= +{ + {0x08, 0xff, 0xff, 0xfe, NULL }, + {0x09, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x08, 0x01, 0x01, 0x01, "Off" }, + {0x08, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x08, 0x01, 0x02, 0x02, "Off" }, + {0x08, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x08, 0x01, 0x40, 0x40, "Upright" }, + {0x08, 0x01, 0x40, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x08, 0x01, 0x80, 0x80, "Off" }, + {0x08, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Dealer) + +UINT8 __fastcall epos_read_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return DrvDips[0]; + + case 0x01: + return DrvInputs[0]; + + case 0x02: + return DrvInputs[1]; + + case 0x03: + return 0; + } + + return 0; +} + +void __fastcall epos_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + watchdog = 0; + return; + + case 0x01: + *DrvPaletteBank = (data << 1) & 0x10; + return; + + case 0x02: + AY8910Write(0, 1, data); + return; + + case 0x06: + AY8910Write(0, 0, data); + return; + } +} + +static void dealer_set_bank() +{ + ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM + (*DealerZ80Bank << 16)); + ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM + (*DealerZ80Bank << 16)); +} + +static void dealer_bankswitch(INT32 offset) +{ + INT32 nBank = *DealerZ80Bank; + + if (offset & 4) { + nBank = (nBank + 1) & 3; + } else { + nBank = (nBank - 1) & 3; + } + + *DealerZ80Bank = nBank; + + dealer_set_bank(); +} + +static void dealer_bankswitch2(INT32 data) +{ + *DealerZ80Bank2 = data & 1; + + INT32 nBank = 0x6000 + ((data & 1) << 12); + ZetMapArea(0x6000, 0x6fff, 0, DrvZ80ROM + nBank); + ZetMapArea(0x6000, 0x6fff, 2, DrvZ80ROM + nBank); +} + +UINT8 __fastcall dealer_read_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x10: + case 0x11: + case 0x12: + case 0x13: + return ppi8255_r(0, port & 3); + + case 0x38: + return DrvDips[0]; + } + + return 0; +} + +void __fastcall dealer_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x10: + case 0x11: + case 0x12: + case 0x13: + ppi8255_w(0, port & 3, data); + return; + + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + dealer_bankswitch(port & 7); + return; + + case 0x34: + AY8910Write(0, 1, data); + return; + + case 0x3c: + AY8910Write(0, 0, data); + return; + + case 0x40: + watchdog = 0; + return; + } +} + +UINT8 DealerPPIReadA() +{ + return DrvInputs[1]; +} + +void DealerPPIWriteC(UINT8 data) +{ + dealer_bankswitch2(data); +} + +static INT32 DrvDoReset(INT32 full_reset) +{ + if (full_reset) { + memset (AllRam, 0, RamEnd - AllRam); + } + + ZetOpen(0); + ZetReset(); + dealer_set_bank(); + dealer_bankswitch2(0); + ZetClose(); + + AY8910Reset(0); + + watchdog = 0; + + return 0; +} + +static void DrvPaletteInit(INT32 num) +{ + UINT8 prom[32] = { // in case the set lacks a prom dump + 0x00, 0xE1, 0xC3, 0xFC, 0xEC, 0xF8, 0x34, 0xFF, + 0x17, 0xF0, 0xEE, 0xEF, 0xAC, 0xC2, 0x1C, 0x07, + 0x00, 0xE1, 0xC3, 0xFC, 0xEC, 0xF8, 0x34, 0xFF, + 0x17, 0xF0, 0xEE, 0xEF, 0xAC, 0xC2, 0x1C, 0x07 + }; + + memcpy (DrvColPROM, prom, 32); + + BurnLoadRom(DrvColPROM, num, 1); + + for (INT32 i = 0; i < 0x20; i++) { + Palette[i] = BITSWAP24(DrvColPROM[i], 7,6,5,7,6,6,7,5,4,3,2,4,3,3,4,2,1,0,1,0,1,1,0,1); + } +} + +static void DealerDecode() +{ + for (INT32 i = 0;i < 0x8000;i++) + DrvZ80ROM[i + 0x00000] = BITSWAP08(DrvZ80ROM[i] ^ 0xbd, 2,6,4,0,5,7,1,3); + + for (INT32 i = 0;i < 0x8000;i++) + DrvZ80ROM[i + 0x10000] = BITSWAP08(DrvZ80ROM[i] ^ 0x00, 7,5,4,6,3,2,1,0); + + for (INT32 i = 0;i < 0x8000;i++) + DrvZ80ROM[i + 0x20000] = BITSWAP08(DrvZ80ROM[i] ^ 0x01, 7,6,5,4,3,0,2,1); + + for (INT32 i = 0;i < 0x8000;i++) + DrvZ80ROM[i + 0x30000] = BITSWAP08(DrvZ80ROM[i] ^ 0x01, 7,5,4,6,3,0,2,1); +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x040000; + + DrvColPROM = Next; Next += 0x000020; + + Palette = (UINT32*)Next; Next += 0x0020 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x0020 * sizeof(UINT32); + + pAY8910Buffer[0] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16 *)Next; Next += nBurnSoundLen * sizeof(INT16); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x001000; + DrvVidRAM = Next; Next += 0x008000; + + DrvPaletteBank = Next; Next += 0x000001; + DealerZ80Bank = Next; Next += 0x000001; + DealerZ80Bank2 = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x1000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x2000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x3000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x4000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x5000, 5, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x6000, 6, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x7000, 7, 1)) return 1; + + DrvPaletteInit(8); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x77ff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x77ff, 2, DrvZ80ROM); + ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); + ZetMapArea(0x8000, 0xffff, 0, DrvVidRAM); + ZetMapArea(0x8000, 0xffff, 1, DrvVidRAM); + ZetMapArea(0x8000, 0xffff, 2, DrvVidRAM); + ZetSetInHandler(epos_read_port); + ZetSetOutHandler(epos_write_port); + ZetClose(); + + AY8910Init(0, 2750000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(1); + + return 0; +} + +static INT32 DealerInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x4000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x6000, 3, 1)) return 1; + + DrvPaletteInit(4); + DealerDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x6fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x6fff, 2, DrvZ80ROM); + ZetMapArea(0x7000, 0x7fff, 0, DrvZ80RAM); + ZetMapArea(0x7000, 0x7fff, 1, DrvZ80RAM); + ZetMapArea(0x7000, 0x7fff, 2, DrvZ80RAM); + ZetMapArea(0x8000, 0xffff, 0, DrvVidRAM); + ZetMapArea(0x8000, 0xffff, 1, DrvVidRAM); + ZetMapArea(0x8000, 0xffff, 2, DrvVidRAM); + ZetSetInHandler(dealer_read_port); + ZetSetOutHandler(dealer_write_port); + ZetClose(); + + AY8910Init(0, 2750000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + + ppi8255_init(1); + PPI0PortReadA = DealerPPIReadA; + PPI0PortWriteC = DealerPPIWriteC; + + GenericTilesInit(); + + DrvDoReset(1); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + AY8910Exit(0); + ZetExit(); + + if (PPI0PortReadA) { + ppi8255_exit(); + } + + BurnFree(AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + UINT8 r,g,b; + for (INT32 i = 0; i < 0x20; i++) { + INT32 rgb = Palette[i]; + r = (rgb >> 16) & 0xff; + g = (rgb >> 8) & 0xff; + b = (rgb >> 0) & 0xff; + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } + + DrvRecalc = 0; + } + + for (INT32 i = 0; i < 0x8000; i++) + { + INT32 x = (i % 136) << 1; + INT32 y = (i / 136); + if (y > 235) break; + + pTransDraw[(y * nScreenWidth) + x + 0] = *DrvPaletteBank | ((DrvVidRAM[i] >> 0) & 0x0f); + pTransDraw[(y * nScreenWidth) + x + 1] = *DrvPaletteBank | ((DrvVidRAM[i] >> 4) & 0x0f); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + watchdog++; + if (watchdog > 180) { + DrvDoReset(0); + } + + if (DrvReset) { + DrvDoReset(1); + } + + { + DrvInputs[0] = DrvDips[1]; + DrvInputs[1] = 0xff; + for (INT32 i = 0; i < 8; i++) + { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + ZetOpen(0); + ZetRun(2750000 / 60); + ZetRaiseIrq(0); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + AY8910Scan(nAction, pnMin); + + if (PPI0PortReadA) { + ppi8255_scan(); + + if (nAction & ACB_WRITE) { + dealer_set_bank(); + dealer_bankswitch2(*DealerZ80Bank2); + } + } + } + + return 0; +} + + +// Megadon + +static struct BurnRomInfo megadonRomDesc[] = { + { "2732u10b.bin", 0x1000, 0xaf8fbe80, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "2732u09b.bin", 0x1000, 0x097d1e73, BRF_ESS | BRF_PRG }, // 1 + { "2732u08b.bin", 0x1000, 0x526784da, BRF_ESS | BRF_PRG }, // 2 + { "2732u07b.bin", 0x1000, 0x5b060910, BRF_ESS | BRF_PRG }, // 3 + { "2732u06b.bin", 0x1000, 0x8ac8af6d, BRF_ESS | BRF_PRG }, // 4 + { "2732u05b.bin", 0x1000, 0x052bb603, BRF_ESS | BRF_PRG }, // 5 + { "2732u04b.bin", 0x1000, 0x9b8b7e92, BRF_ESS | BRF_PRG }, // 6 + { "2716u11b.bin", 0x0800, 0x599b8b61, BRF_ESS | BRF_PRG }, // 7 + + { "74s288.bin", 0x0020, 0xc779ea99, BRF_GRA }, // 8 Color PROM +}; + +STD_ROM_PICK(megadon) +STD_ROM_FN(megadon) + +struct BurnDriver BurnDrvMegadon = { + "megadon", NULL, NULL, NULL, "1982", + "Megadon\0", NULL, "Epos Corporation (Photar Industries License)", "EPOS Tristar", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, megadonRomInfo, megadonRomName, NULL, NULL, MegadonInputInfo, MegadonDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 236, 272, 3, 4 +}; + + +// Catapult + +static struct BurnRomInfo catapultRomDesc[] = { + { "co3223.u10", 0x1000, 0x50abcfd2, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "co3223.u09", 0x1000, 0xfd5a9a1c, BRF_ESS | BRF_PRG }, // 1 + { "co3223.u08", 0x1000, 0x4bfc36f3, BRF_ESS | BRF_PRG }, // 2 + { "co3223.u07", 0x1000, 0x4113bb99, BRF_ESS | BRF_PRG }, // 3 + { "co3223.u06", 0x1000, 0x966bb9f5, BRF_ESS | BRF_PRG }, // 4 + { "co3223.u05", 0x1000, 0x65f9fb9a, BRF_ESS | BRF_PRG }, // 5 + { "co3223.u04", 0x1000, 0x648453bc, BRF_ESS | BRF_PRG }, // 6 + { "co3223.u11", 0x0800, 0x08fb8c28, BRF_ESS | BRF_PRG }, // 7 + + { "co3223.u66", 0x0020, 0xe7de76a7, BRF_GRA }, // 8 Color PROM +}; + +STD_ROM_PICK(catapult) +STD_ROM_FN(catapult) + +struct BurnDriverD BurnDrvCatapult = { + "catapult", NULL, NULL, NULL, "1982", + "Catapult\0", "Bad dump", "Epos Corporation", "EPOS Tristar", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, catapultRomInfo, catapultRomName, NULL, NULL, SuprglobInputInfo, CatapultDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 236, 272, 3, 4 +}; + + +// Super Glob + +static struct BurnRomInfo suprglobRomDesc[] = { + { "u10", 0x1000, 0xc0141324, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "u9", 0x1000, 0x58be8128, BRF_ESS | BRF_PRG }, // 1 + { "u8", 0x1000, 0x6d088c16, BRF_ESS | BRF_PRG }, // 2 + { "u7", 0x1000, 0xb2768203, BRF_ESS | BRF_PRG }, // 3 + { "u6", 0x1000, 0x976c8f46, BRF_ESS | BRF_PRG }, // 4 + { "u5", 0x1000, 0x340f5290, BRF_ESS | BRF_PRG }, // 5 + { "u4", 0x1000, 0x173bd589, BRF_ESS | BRF_PRG }, // 6 + { "u11", 0x0800, 0xd45b740d, BRF_ESS | BRF_PRG }, // 7 + + { "82s123.u66", 0x0020, 0xf4f6ddc5, BRF_GRA }, // 8 Color PROM +}; + +STD_ROM_PICK(suprglob) +STD_ROM_FN(suprglob) + +struct BurnDriver BurnDrvSuprglob = { + "suprglob", NULL, NULL, NULL, "1983", + "Super Glob\0", NULL, "Epos Corporation", "EPOS Tristar", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, suprglobRomInfo, suprglobRomName, NULL, NULL, SuprglobInputInfo, SuprglobDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 236, 272, 3, 4 +}; + + +// The Glob + +static struct BurnRomInfo theglobRomDesc[] = { + { "globu10.bin", 0x1000, 0x08fdb495, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "globu9.bin", 0x1000, 0x827cd56c, BRF_ESS | BRF_PRG }, // 1 + { "globu8.bin", 0x1000, 0xd1219966, BRF_ESS | BRF_PRG }, // 2 + { "globu7.bin", 0x1000, 0xb1649da7, BRF_ESS | BRF_PRG }, // 3 + { "globu6.bin", 0x1000, 0xb3457e67, BRF_ESS | BRF_PRG }, // 4 + { "globu5.bin", 0x1000, 0x89d582cd, BRF_ESS | BRF_PRG }, // 5 + { "globu4.bin", 0x1000, 0x7ee9fdeb, BRF_ESS | BRF_PRG }, // 6 + { "globu11.bin", 0x0800, 0x9e05dee3, BRF_ESS | BRF_PRG }, // 7 + + { "82s123.u66", 0x0020, 0xf4f6ddc5, BRF_GRA }, // 8 Color PROM +}; + +STD_ROM_PICK(theglob) +STD_ROM_FN(theglob) + +struct BurnDriver BurnDrvTheglob = { + "theglob", "suprglob", NULL, NULL, "1983", + "The Glob\0", NULL, "Epos Corporation", "EPOS Tristar", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, theglobRomInfo, theglobRomName, NULL, NULL, SuprglobInputInfo, SuprglobDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 236, 272, 3, 4 +}; + + +// The Glob (earlier) + +static struct BurnRomInfo theglob2RomDesc[] = { + { "611293.u10", 0x1000, 0x870af7ce, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "611293.u9", 0x1000, 0xa3679782, BRF_ESS | BRF_PRG }, // 1 + { "611293.u8", 0x1000, 0x67499d1a, BRF_ESS | BRF_PRG }, // 2 + { "611293.u7", 0x1000, 0x55e53aac, BRF_ESS | BRF_PRG }, // 3 + { "611293.u6", 0x1000, 0xc64ad743, BRF_ESS | BRF_PRG }, // 4 + { "611293.u5", 0x1000, 0xf93c3203, BRF_ESS | BRF_PRG }, // 5 + { "611293.u4", 0x1000, 0xceea0018, BRF_ESS | BRF_PRG }, // 6 + { "611293.u11", 0x0800, 0x6ac83f9b, BRF_ESS | BRF_PRG }, // 7 + + { "82s123.u66", 0x0020, 0xf4f6ddc5, BRF_GRA }, // 8 Color PROM +}; + +STD_ROM_PICK(theglob2) +STD_ROM_FN(theglob2) + +struct BurnDriver BurnDrvTheglob2 = { + "theglob2", "suprglob", NULL, NULL, "1983", + "The Glob (earlier)\0", NULL, "Epos Corporation", "EPOS Tristar", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, theglob2RomInfo, theglob2RomName, NULL, NULL, SuprglobInputInfo, SuprglobDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 236, 272, 3, 4 +}; + + +// The Glob (set 3) + +static struct BurnRomInfo theglob3RomDesc[] = { + { "theglob3.u10", 0x1000, 0x969cfaf6, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "theglob3.u9", 0x1000, 0x8e6c010a, BRF_ESS | BRF_PRG }, // 1 + { "theglob3.u8", 0x1000, 0x1c1ca5c8, BRF_ESS | BRF_PRG }, // 2 + { "theglob3.u7", 0x1000, 0xa54b9d22, BRF_ESS | BRF_PRG }, // 3 + { "theglob3.u6", 0x1000, 0x5a6f82a9, BRF_ESS | BRF_PRG }, // 4 + { "theglob3.u5", 0x1000, 0x72f935db, BRF_ESS | BRF_PRG }, // 5 + { "theglob3.u4", 0x1000, 0x81db53ad, BRF_ESS | BRF_PRG }, // 6 + { "theglob3.u11", 0x0800, 0x0e2e6359, BRF_ESS | BRF_PRG }, // 7 + + { "82s123.u66", 0x0020, 0xf4f6ddc5, BRF_GRA }, // 8 Color PROM +}; + +STD_ROM_PICK(theglob3) +STD_ROM_FN(theglob3) + +struct BurnDriver BurnDrvTheglob3 = { + "theglob3", "suprglob", NULL, NULL, "1983", + "The Glob (set 3)\0", NULL, "Epos Corporation", "EPOS Tristar", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, theglob3RomInfo, theglob3RomName, NULL, NULL, SuprglobInputInfo, SuprglobDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 236, 272, 3, 4 +}; + + +// IGMO + +static struct BurnRomInfo igmoRomDesc[] = { + { "igmo-u10.732", 0x1000, 0xa9f691a4, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "igmo-u9.732", 0x1000, 0x3c133c97, BRF_ESS | BRF_PRG }, // 1 + { "igmo-u8.732", 0x1000, 0x5692f8d8, BRF_ESS | BRF_PRG }, // 2 + { "igmo-u7.732", 0x1000, 0x630ae2ed, BRF_ESS | BRF_PRG }, // 3 + { "igmo-u6.732", 0x1000, 0xd3f20e1d, BRF_ESS | BRF_PRG }, // 4 + { "igmo-u5.732", 0x1000, 0xe26bb391, BRF_ESS | BRF_PRG }, // 5 + { "igmo-u4.732", 0x1000, 0x762a4417, BRF_ESS | BRF_PRG }, // 6 + { "igmo-u11.716", 0x0800, 0x8c675837, BRF_ESS | BRF_PRG }, // 7 + + { "82s123.u66", 0x0020, 0x00000000, BRF_GRA | BRF_NODUMP }, // 8 Color Prom (missing) +}; + +STD_ROM_PICK(igmo) +STD_ROM_FN(igmo) + +struct BurnDriver BurnDrvIgmo = { + "igmo", NULL, NULL, NULL, "1984", + "IGMO\0", "Incorrect Colors", "Epos Corporation", "EPOS Tristar", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, igmoRomInfo, igmoRomName, NULL, NULL, SuprglobInputInfo, IgmoDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 236, 272, 3, 4 +}; + + +// The Dealer + +static struct BurnRomInfo dealerRomDesc[] = { + { "u1.bin", 0x2000, 0xe06f3563, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "u2.bin", 0x2000, 0x726bbbd6, BRF_ESS | BRF_PRG }, // 1 + { "u3.bin", 0x2000, 0xab721455, BRF_ESS | BRF_PRG }, // 2 + { "u4.bin", 0x2000, 0xddb903e4, BRF_ESS | BRF_PRG }, // 3 + + { "82s123.u66", 0x0020, 0x00000000, BRF_GRA | BRF_NODUMP }, // 4 Color Prom (missing) +}; + +STD_ROM_PICK(dealer) +STD_ROM_FN(dealer) + +struct BurnDriver BurnDrvDealer = { + "dealer", NULL, NULL, NULL, "198?", + "The Dealer\0", "Incorrect Colors", "Epos Corporation", "EPOS Tristar", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_CASINO, 0, + NULL, dealerRomInfo, dealerRomName, NULL, NULL, DealerInputInfo, DealerDIPInfo, + DealerInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 236, 272, 3, 4 +}; + + +// Revenger + +static struct BurnRomInfo revengerRomDesc[] = { + { "r06124.u1", 0x2000, 0xfad1a2a5, BRF_ESS | BRF_PRG }, // 0 Z80 code + { "r06124.u2", 0x2000, 0xa8e0ee7b, BRF_ESS | BRF_PRG }, // 1 + { "r06124.u3", 0x2000, 0xcca414a5, BRF_ESS | BRF_PRG }, // 2 + { "r06124.u4", 0x2000, 0x0b81c303, BRF_ESS | BRF_PRG }, // 3 + + { "82s123.u66", 0x0020, 0x00000000, BRF_GRA | BRF_NODUMP }, // 4 Color Prom (missing) +}; + +STD_ROM_PICK(revenger) +STD_ROM_FN(revenger) + +struct BurnDriverD BurnDrvRevenger = { + "revenger", NULL, NULL, NULL, "1984", + "Revenger\0", "Bad dump", "Epos Corporation", "EPOS Tristar", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, revengerRomInfo, revengerRomName, NULL, NULL, DealerInputInfo, DealerDIPInfo, + DealerInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 236, 272, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_exedexes.cpp b/src/burn/drv/pre90s/d_exedexes.cpp index f0907960a..ff181f015 100644 --- a/src/burn/drv/pre90s/d_exedexes.cpp +++ b/src/burn/drv/pre90s/d_exedexes.cpp @@ -1,819 +1,817 @@ -// FB Alpha Exed Exes driver module -// Based on MAME driver by Richard Davies, Paul Swan, and various others - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "sn76496.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *Mem, *MemEnd; -static UINT8 *Rom0, *Rom1, *Gfx0, *Gfx1, *Gfx2, *Gfx3, *Gfx4, *Prom; -static INT16 *pAY8910Buffer[3], *pFMBuffer = NULL; -static UINT32 *Palette, *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *fg_tile_transp; - -static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvDips[2], DrvInputs[3], DrvReset; - -static UINT8 exedexes_soundlatch; - -static UINT8 exedexes_txt_enable; -static UINT8 exedexes_obj_enable; -static UINT8 exedexes_bg_enable; -static UINT8 exedexes_fg_enable; - -static UINT16 exedexes_nbg_yscroll; -static UINT16 exedexes_nbg_xscroll; -static UINT16 exedexes_bg_xscroll; - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, - - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p2 right" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p2 left" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 2"}, - - {"Service" , BIT_DIGITAL , DrvJoy1 + 5, "service" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip 1" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip 2" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xdf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Normal" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x0c, 0x08, "1" }, - {0x12, 0x01, 0x0c, 0x04, "2" }, - {0x12, 0x01, 0x0c, 0x0c, "3" }, - {0x12, 0x01, 0x0c, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "2 Players Game" }, - {0x12, 0x01, 0x10, 0x00, "1 Credit" }, - {0x12, 0x01, 0x10, 0x10, "2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x12, 0x01, 0x20, 0x00, "English" }, - {0x12, 0x01, 0x20, 0x20, "Japanese" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 5 Plays" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "4 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x08, "3 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x10, "2 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x38, 0x18, "1 Coin 5 Plays" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x40, 0x00, "No" }, - {0x13, 0x01, 0x40, 0x40, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x00, "Off" }, - {0x13, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Drv) - -UINT8 __fastcall exedexes_cpu0_read(UINT16 address) -{ - switch (address) - { - case 0xc000: - case 0xc001: - case 0xc002: - return DrvInputs[address & 3]; - - case 0xc003: - case 0xc004: - return DrvDips[~address & 1]; - } - - return 0; -} - -void __fastcall exedexes_cpu0_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc800: - exedexes_soundlatch = data; - break; - - case 0xc804: - exedexes_txt_enable = data >> 7; - break; - - case 0xc806: - break; - - case 0xd800: - exedexes_nbg_yscroll = (exedexes_nbg_yscroll & 0xff00) | (data << 0); - break; - - case 0xd801: - exedexes_nbg_yscroll = (exedexes_nbg_yscroll & 0x00ff) | (data << 8); - break; - - case 0xd802: - exedexes_nbg_xscroll = (exedexes_nbg_xscroll & 0xff00) | (data << 0); - break; - - case 0xd803: - exedexes_nbg_xscroll = (exedexes_nbg_xscroll & 0x00ff) | (data << 8); - break; - - case 0xd804: - exedexes_bg_xscroll = (exedexes_bg_xscroll & 0xff00) | (data << 0); - break; - - case 0xd805: - exedexes_bg_xscroll = (exedexes_bg_xscroll & 0x00ff) | (data << 8); - break; - - case 0xd807: - exedexes_bg_enable = (data >> 4) & 1; - exedexes_fg_enable = (data >> 5) & 1; - exedexes_obj_enable = (data >> 6) & 1; - break; - } -} - -UINT8 __fastcall exedexes_cpu1_read(UINT16 address) -{ - switch (address) - { - case 0x6000: - return exedexes_soundlatch; - } - - return 0; -} - -void __fastcall exedexes_cpu1_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8000: - case 0x8001: - AY8910Write(0, address & 1, data); - break; - - case 0x8002: - case 0x8003: - SN76496Write(address & 1, data); - break; - } -} - -static inline void DrvMakeInputs() -{ - DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (Rom0 + 0xd000, 0, 0x3000); - memset (Rom1 + 0x4000, 0, 0x0800); - - exedexes_soundlatch = 0; - exedexes_txt_enable = 0; - exedexes_obj_enable = 0; - exedexes_bg_enable = 0; - exedexes_fg_enable = 0; - exedexes_nbg_yscroll = 0; - exedexes_nbg_xscroll = 0; - exedexes_bg_xscroll = 0; - - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - AY8910Reset(0); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Rom0 = Next; Next += 0x10000; - Rom1 = Next; Next += 0x05000; - - Gfx0 = Next; Next += 0x08000; - Gfx1 = Next; Next += 0x10000; - Gfx2 = Next; Next += 0x10000; - Gfx3 = Next; Next += 0x10000; - - Gfx4 = Next; Next += 0x06000; - - Prom = Next; Next += 0x00800; - - fg_tile_transp = Next; Next += 0x00100; - - Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - - pFMBuffer = (INT16*)Next; Next += (nBurnSoundLen * 3 * sizeof(INT16)); - - MemEnd = Next; - - return 0; -} - -static INT32 PaletteInit() -{ - UINT32 *tmp = (UINT32*)BurnMalloc(0x100 * sizeof(UINT32)); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x100; i++) - { - INT32 r = Prom[i + 0x000]; - INT32 g = Prom[i + 0x100]; - INT32 b = Prom[i + 0x200]; - - tmp[i] = (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b; - } - - Prom += 0x300; - - for (INT32 i = 0; i < 0x100; i++) { - Palette[i] = tmp[Prom[i] | 0xc0]; - } - - for (INT32 i = 0x100; i < 0x200; i++) { - Palette[i] = tmp[Prom[i] | 0x00]; - } - - for (INT32 i = 0x200; i < 0x300; i++) { - Palette[i] = tmp[Prom[i] | 0x40]; - } - - for (INT32 i = 0x300; i < 0x400; i++) { - INT32 entry = Prom[i] | (Prom[i + 0x100] << 4) | 0x80; - Palette[i] = tmp[entry]; - } - - BurnFree (tmp); - - return 0; -} - -static INT32 GraphicsDecode() -{ - static INT32 TilePlanes[2] = { 0x004, 0x000 }; - static INT32 SpriPlanes[4] = { 0x20004, 0x20000, 0x00004, 0x00000 }; - static INT32 TileXOffs[32] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, - 0x200, 0x201, 0x202, 0x203, 0x208, 0x209, 0x20a, 0x20b, - 0x400, 0x401, 0x402, 0x403, 0x408, 0x409, 0x40a, 0x40b, - 0x600, 0x601, 0x602, 0x603, 0x608, 0x609, 0x60a, 0x60b }; - static INT32 SpriXOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, - 0x100, 0x101, 0x102, 0x103, 0x108, 0x109, 0x10a, 0x10b }; - static INT32 TileYOffs[32] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, - 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0, - 0x100, 0x110, 0x120, 0x130, 0x140, 0x150, 0x160, 0x170, - 0x180, 0x190, 0x1a0, 0x1b0, 0x1c0, 0x1d0, 0x1e0, 0x1f0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x8000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, Gfx0, 0x02000); - - GfxDecode(0x200, 2, 8, 8, TilePlanes, TileXOffs, TileYOffs, 0x080, tmp, Gfx0); - - memcpy (tmp, Gfx1, 0x04000); - - GfxDecode(0x040, 2, 32, 32, TilePlanes, TileXOffs, TileYOffs, 0x800, tmp, Gfx1); - - memcpy (tmp, Gfx2, 0x08000); - - GfxDecode(0x100, 4, 16, 16, SpriPlanes, SpriXOffs, TileYOffs, 0x200, tmp, Gfx2); - - memcpy (tmp, Gfx3, 0x08000); - - GfxDecode(0x100, 4, 16, 16, SpriPlanes, SpriXOffs, TileYOffs, 0x200, tmp, Gfx3); - - for (INT32 i = 0; i < 0x10000; i++) { - if (Gfx2[i]) fg_tile_transp[i>>8] = 1; - } - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - for (INT32 i = 0; i < 3; i++) { - pAY8910Buffer[i] = pFMBuffer + nBurnSoundLen * i; - } - - { - for (INT32 i = 0; i < 3; i++) { - if (BurnLoadRom(Rom0 + i * 0x4000, i + 0, 1)) return 1; - } - - if (BurnLoadRom(Rom1, 3, 1)) return 1; - if (BurnLoadRom(Gfx0, 4, 1)) return 1; - if (BurnLoadRom(Gfx1, 5, 1)) return 1; - - for (INT32 i = 0; i < 2; i++) { - if (BurnLoadRom(Gfx2 + i * 0x4000, i + 6, 1)) return 1; - if (BurnLoadRom(Gfx3 + i * 0x4000, i + 8, 1)) return 1; - if (BurnLoadRom(Gfx4 + i * 0x4000, i + 10, 1)) return 1; - } - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(Prom + i * 0x0100, i + 12, 1)) return 1; - } - - if (GraphicsDecode()) return 1; - if (PaletteInit()) return 1; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, Rom0 + 0x0000); - ZetMapArea(0x0000, 0xbfff, 2, Rom0 + 0x0000); - ZetMapArea(0xd000, 0xd7ff, 0, Rom0 + 0xd000); - ZetMapArea(0xd000, 0xd7ff, 1, Rom0 + 0xd000); - ZetMapArea(0xe000, 0xefff, 0, Rom0 + 0xe000); - ZetMapArea(0xe000, 0xefff, 1, Rom0 + 0xe000); - ZetMapArea(0xe000, 0xefff, 2, Rom0 + 0xe000); - ZetMapArea(0xf000, 0xffff, 0, Rom0 + 0xf000); - ZetMapArea(0xf000, 0xffff, 1, Rom0 + 0xf000); - ZetSetWriteHandler(exedexes_cpu0_write); - ZetSetReadHandler(exedexes_cpu0_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x3fff, 0, Rom1 + 0x0000); - ZetMapArea(0x0000, 0x3fff, 2, Rom1 + 0x0000); - ZetMapArea(0x4000, 0x47ff, 0, Rom1 + 0x4000); - ZetMapArea(0x4000, 0x47ff, 1, Rom1 + 0x4000); - ZetMapArea(0x4000, 0x47ff, 2, Rom1 + 0x4000); - ZetSetWriteHandler(exedexes_cpu1_write); - ZetSetReadHandler(exedexes_cpu1_read); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.10, BURN_SND_ROUTE_BOTH); - - SN76489Init(0, 3000000, 0); - SN76489Init(1, 3000000, 1); - SN76496SetRoute(0, 0.36, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 0.36, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - AY8910Exit(0); - SN76496Exit(); - ZetExit(); - GenericTilesExit(); - - BurnFree (Mem); - - Mem = MemEnd = Rom0 = Rom1 = NULL; - Gfx0 = Gfx1 = Gfx2 = Gfx3 = Gfx4 = Prom = NULL; - for (INT32 i = 0; i < 3; i++) pAY8910Buffer[i] = NULL; - Palette = DrvPalette = NULL; - fg_tile_transp = NULL; - pFMBuffer = NULL; - DrvRecalc = 0; - - return 0; -} - - -static void draw_sprites(INT32 priority) -{ - if (!exedexes_obj_enable) return; - - for (INT32 offs = 0x0fe0; offs >= 0; offs -= 0x20) - { - if ((Rom0[0xf000 + offs + 1] & 0x40) == priority) - { - INT32 code = Rom0[0xf000 + offs]; - INT32 color = Rom0[0xf001 + offs] & 0x0f; - INT32 flipx = Rom0[0xf001 + offs] & 0x10; - INT32 flipy = Rom0[0xf001 + offs] & 0x20; - INT32 sx = Rom0[0xf003 + offs] - ((Rom0[0xf001 + offs] & 0x80) << 1); - INT32 sy = Rom0[0xf002 + offs] - 0x10; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x300, Gfx3); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x300, Gfx3); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x300, Gfx3); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x300, Gfx3); - } - } - } - } -} - -static inline void draw_8x8(INT32 sx, INT32 sy, INT32 code, INT32 color) -{ - UINT8 *src = Gfx0 + (code << 6); - color <<= 2; - - for (INT32 y = sy; y < sy + 8; y++) { - for (INT32 x = sx; x < sx + 8; x++, src++) { - if (y < 0 || x < 0 || y >= nScreenHeight || x >= nScreenWidth) continue; - - INT32 pxl = color | *src; - if (Prom[pxl] == 0x0f) continue; - - pTransDraw[(y * nScreenWidth) + x] = pxl; - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - INT32 col = Palette[i]; - DrvPalette[i] = BurnHighCol(col >> 16, col >> 8, col, 0); - } - } - - if (exedexes_bg_enable) - { - for (INT32 i = 0; i < 16 * 8; i++) { - INT32 sx = ((i & 0x0f) << 5); - INT32 sy = (i >> 4) << 5; - - INT32 sxscr = sx + exedexes_bg_xscroll; - - sx -= (exedexes_bg_xscroll & 0x1f); - - if (sx > 0x100) continue; - sy -= 0x10; - - INT32 offset = ((sxscr & 0xe0) >> 5) | ((sy & 0xe0) >> 2) | ((sxscr & 0x3f00) >> 1) | 0x4000; - - INT32 attr = Gfx4[offset]; - INT32 color = Gfx4[offset + 0x40]; - INT32 code = attr & 0x3f; - INT32 flipx = attr & 0x40; - INT32 flipy = attr & 0x80; - - if (flipy) { - if (flipx) { - Render32x32Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0x100, Gfx1); - } else { - Render32x32Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0x100, Gfx1); - } - } else { - if (flipx) { - Render32x32Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0x100, Gfx1); - } else { - Render32x32Tile_Clip(pTransDraw, code, sx, sy, color, 2, 0x100, Gfx1); - } - } - } - } else { - memset(pTransDraw, 0, nScreenWidth * nScreenHeight * sizeof (UINT16)); - } - - draw_sprites(0x40); - - if (exedexes_fg_enable) - { - for (INT32 i = 0; i < 32 * 16; i++) { - INT32 sx = (i & 0x1f) << 4; - INT32 sy = (i >> 5) << 4; - - INT32 vx = sx + exedexes_nbg_yscroll; - INT32 vy = sy + exedexes_nbg_xscroll; - - sx -= exedexes_nbg_yscroll & 0x0f; - sy -= exedexes_nbg_xscroll & 0x0f; - - if (sx > 0x100) continue; - - INT32 offset = ((vx & 0xf0) >> 4) | (vy & 0xf0) | (vx & 0x700) | ((vy & 0x700) << 3); - - INT32 code = Gfx4[offset]; - - if (!fg_tile_transp[code]) continue; - sy -= 0x10; - - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, 0, 2, 0, 0x200, Gfx2); - } - } - - draw_sprites(0); - - if (exedexes_txt_enable) - { - for (INT32 i = 0x40; i < 0x3c0; i++) { - INT32 sx = (i & 0x1f) << 3; - INT32 sy = ((i >> 5) << 3) - 0x10; - INT32 code = Rom0[0xd000 | i] | ((Rom0[0xd400 | i] & 0x80) << 1); - INT32 color = Rom0[0xd400 | i] & 0x3f; - - if (code == 0x0024) continue; - - draw_8x8(sx, sy, code, color); - //Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, Gfx0); - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - DrvMakeInputs(); - - INT32 nInterleave = 16; - INT32 nCyclesDone[2] = { 0, 0 }; - INT32 nCyclesTotal[2] = { 4000000 / 60, 3000000 / 60 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 0) { - ZetSetVector(0xcf); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nCyclesDone[nCurrentCPU] += ZetRun(100); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } - if (i == ( nInterleave - 2)) { - ZetSetVector(0xd7); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nCyclesDone[nCurrentCPU] += ZetRun(100); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } - ZetClose(); - - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if ((i & 3) == 3) { - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - ZetClose(); - } - - if (pBurnSoundOut) { - SN76496Update(0, pBurnSoundOut, nBurnSoundLen); - SN76496Update(1, pBurnSoundOut, nBurnSoundLen); - - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 1); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = Rom0 + 0xd000; - ba.nLen = 0x3000; - ba.szName = "All CPU #0 Ram"; - BurnAcb(&ba); - - ba.Data = Rom1 + 0x4000; - ba.nLen = 0x0800; - ba.szName = "All CPU #1 Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - AY8910Scan(nAction, pnMin); - SN76496Scan(nAction, pnMin); - - SCAN_VAR(exedexes_soundlatch); - SCAN_VAR(exedexes_txt_enable); - SCAN_VAR(exedexes_obj_enable); - SCAN_VAR(exedexes_bg_enable); - SCAN_VAR(exedexes_fg_enable); - SCAN_VAR(exedexes_nbg_yscroll); - SCAN_VAR(exedexes_nbg_xscroll); - SCAN_VAR(exedexes_bg_xscroll); - } - - return 0; -} - - -// Exed Exes - -static struct BurnRomInfo exedexesRomDesc[] = { - { "11m_ee04.bin", 0x4000, 0x44140dbd, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "10m_ee03.bin", 0x4000, 0xbf72cfba, 1 | BRF_PRG | BRF_ESS }, // 1 - { "09m_ee02.bin", 0x4000, 0x7ad95e2f, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "11e_ee01.bin", 0x4000, 0x73cdf3b2, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "05c_ee00.bin", 0x2000, 0xcadb75bd, 3 | BRF_GRA }, // 4 Characters - - { "h01_ee08.bin", 0x4000, 0x96a65c1d, 4 | BRF_GRA }, // 5 32x32 tiles - - { "a03_ee06.bin", 0x4000, 0x6039bdd1, 5 | BRF_GRA }, // 6 16x16 tiles - { "a02_ee05.bin", 0x4000, 0xb32d8252, 5 | BRF_GRA }, // 7 - - { "j11_ee10.bin", 0x4000, 0xbc83e265, 6 | BRF_GRA }, // 8 Sprites - { "j12_ee11.bin", 0x4000, 0x0e0f300d, 6 | BRF_GRA }, // 9 - - { "c01_ee07.bin", 0x4000, 0x3625a68d, 7 | BRF_GRA }, // 10 Tile Maps - { "h04_ee09.bin", 0x2000, 0x6057c907, 7 | BRF_GRA }, // 11 - - { "02d_e-02.bin", 0x0100, 0x8d0d5935, 8 | BRF_GRA }, // 12 Color Proms - { "03d_e-03.bin", 0x0100, 0xd3c17efc, 8 | BRF_GRA }, // 13 - { "04d_e-04.bin", 0x0100, 0x58ba964c, 8 | BRF_GRA }, // 14 - { "06f_e-05.bin", 0x0100, 0x35a03579, 8 | BRF_GRA }, // 15 - { "l04_e-10.bin", 0x0100, 0x1dfad87a, 8 | BRF_GRA }, // 16 - { "c04_e-07.bin", 0x0100, 0x850064e0, 8 | BRF_GRA }, // 17 - { "l09_e-11.bin", 0x0100, 0x2bb68710, 8 | BRF_GRA }, // 18 - { "l10_e-12.bin", 0x0100, 0x173184ef, 8 | BRF_GRA }, // 19 - - { "06l_e-06.bin", 0x0100, 0x712ac508, 0 | BRF_OPT }, // 20 Misc. Proms - { "k06_e-08.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 21 - { "l03_e-09.bin", 0x0100, 0x0d968558, 0 | BRF_OPT }, // 22 - { "03e_e-01.bin", 0x0020, 0x1acee376, 0 | BRF_OPT }, // 23 -}; - -STD_ROM_PICK(exedexes) -STD_ROM_FN(exedexes) - -struct BurnDriver BurnDrvExedexes = { - "exedexes", NULL, NULL, NULL, "1985", - "Exed Exes\0", NULL, "Capcom", "Miscellaneous", - L"Exed Exes\0\u30A8\u30B0\u30BC\u30C9 \u30A8\u30B0\u30BC\u30B9\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, exedexesRomInfo, exedexesRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 224, 256, 3, 4 -}; - - -// Savage Bees - -static struct BurnRomInfo savgbeesRomDesc[] = { - { "ee04e.11m", 0x4000, 0xc0caf442, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "ee03e.10m", 0x4000, 0x9cd70ae1, 1 | BRF_PRG | BRF_ESS }, // 1 - { "ee02e.9m", 0x4000, 0xa04e6368, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "ee01e.11e", 0x4000, 0x93d3f952, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "ee00e.5c", 0x2000, 0x5972f95f, 3 | BRF_GRA }, // 4 Characters - - { "h01_ee08.bin", 0x4000, 0x96a65c1d, 4 | BRF_GRA }, // 5 32x32 tiles - - { "a03_ee06.bin", 0x4000, 0x6039bdd1, 5 | BRF_GRA }, // 6 16x16 tiles - { "a02_ee05.bin", 0x4000, 0xb32d8252, 5 | BRF_GRA }, // 7 - - { "j11_ee10.bin", 0x4000, 0xbc83e265, 6 | BRF_GRA }, // 8 Sprites - { "j12_ee11.bin", 0x4000, 0x0e0f300d, 6 | BRF_GRA }, // 9 - - { "c01_ee07.bin", 0x4000, 0x3625a68d, 7 | BRF_GRA }, // 10 Tile Maps - { "h04_ee09.bin", 0x2000, 0x6057c907, 7 | BRF_GRA }, // 11 - - { "02d_e-02.bin", 0x0100, 0x8d0d5935, 8 | BRF_GRA }, // 12 Color Proms - { "03d_e-03.bin", 0x0100, 0xd3c17efc, 8 | BRF_GRA }, // 13 - { "04d_e-04.bin", 0x0100, 0x58ba964c, 8 | BRF_GRA }, // 14 - { "06f_e-05.bin", 0x0100, 0x35a03579, 8 | BRF_GRA }, // 15 - { "l04_e-10.bin", 0x0100, 0x1dfad87a, 8 | BRF_GRA }, // 16 - { "c04_e-07.bin", 0x0100, 0x850064e0, 8 | BRF_GRA }, // 17 - { "l09_e-11.bin", 0x0100, 0x2bb68710, 8 | BRF_GRA }, // 18 - { "l10_e-12.bin", 0x0100, 0x173184ef, 8 | BRF_GRA }, // 19 - - { "06l_e-06.bin", 0x0100, 0x712ac508, 0 | BRF_OPT }, // 20 Misc. Proms - { "k06_e-08.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 21 - { "l03_e-09.bin", 0x0100, 0x0d968558, 0 | BRF_OPT }, // 22 - { "03e_e-01.bin", 0x0020, 0x1acee376, 0 | BRF_OPT }, // 23 -}; - -STD_ROM_PICK(savgbees) -STD_ROM_FN(savgbees) - -struct BurnDriver BurnDrvSavgbees = { - "savgbees", "exedexes", NULL, NULL, "1985", - "Savage Bees\0", NULL, "Capcom (Memetron license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, savgbeesRomInfo, savgbeesRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 224, 256, 3, 4 -}; +// FB Alpha Exed Exes driver module +// Based on MAME driver by Richard Davies, Paul Swan, and various others + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "sn76496.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *Mem, *MemEnd; +static UINT8 *Rom0, *Rom1, *Gfx0, *Gfx1, *Gfx2, *Gfx3, *Gfx4, *Prom; +static INT16 *pAY8910Buffer[3], *pFMBuffer = NULL; +static UINT32 *Palette, *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *fg_tile_transp; + +static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvDips[2], DrvInputs[3], DrvReset; + +static UINT8 exedexes_soundlatch; + +static UINT8 exedexes_txt_enable; +static UINT8 exedexes_obj_enable; +static UINT8 exedexes_bg_enable; +static UINT8 exedexes_fg_enable; + +static UINT16 exedexes_nbg_yscroll; +static UINT16 exedexes_nbg_xscroll; +static UINT16 exedexes_bg_xscroll; + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, + + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p2 right" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p2 left" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 2"}, + + {"Service" , BIT_DIGITAL , DrvJoy1 + 5, "service" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip 1" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip 2" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xdf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Normal" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x0c, 0x08, "1" }, + {0x12, 0x01, 0x0c, 0x04, "2" }, + {0x12, 0x01, 0x0c, 0x0c, "3" }, + {0x12, 0x01, 0x0c, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "2 Players Game" }, + {0x12, 0x01, 0x10, 0x00, "1 Credit" }, + {0x12, 0x01, 0x10, 0x10, "2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x12, 0x01, 0x20, 0x00, "English" }, + {0x12, 0x01, 0x20, 0x20, "Japanese" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 5 Plays" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "4 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x08, "3 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x10, "2 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x38, 0x18, "1 Coin 5 Plays" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x40, 0x00, "No" }, + {0x13, 0x01, 0x40, 0x40, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x00, "Off" }, + {0x13, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Drv) + +UINT8 __fastcall exedexes_cpu0_read(UINT16 address) +{ + switch (address) + { + case 0xc000: + case 0xc001: + case 0xc002: + return DrvInputs[address & 3]; + + case 0xc003: + case 0xc004: + return DrvDips[~address & 1]; + } + + return 0; +} + +void __fastcall exedexes_cpu0_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc800: + exedexes_soundlatch = data; + break; + + case 0xc804: + exedexes_txt_enable = data >> 7; + break; + + case 0xc806: + break; + + case 0xd800: + exedexes_nbg_yscroll = (exedexes_nbg_yscroll & 0xff00) | (data << 0); + break; + + case 0xd801: + exedexes_nbg_yscroll = (exedexes_nbg_yscroll & 0x00ff) | (data << 8); + break; + + case 0xd802: + exedexes_nbg_xscroll = (exedexes_nbg_xscroll & 0xff00) | (data << 0); + break; + + case 0xd803: + exedexes_nbg_xscroll = (exedexes_nbg_xscroll & 0x00ff) | (data << 8); + break; + + case 0xd804: + exedexes_bg_xscroll = (exedexes_bg_xscroll & 0xff00) | (data << 0); + break; + + case 0xd805: + exedexes_bg_xscroll = (exedexes_bg_xscroll & 0x00ff) | (data << 8); + break; + + case 0xd807: + exedexes_bg_enable = (data >> 4) & 1; + exedexes_fg_enable = (data >> 5) & 1; + exedexes_obj_enable = (data >> 6) & 1; + break; + } +} + +UINT8 __fastcall exedexes_cpu1_read(UINT16 address) +{ + switch (address) + { + case 0x6000: + return exedexes_soundlatch; + } + + return 0; +} + +void __fastcall exedexes_cpu1_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8000: + case 0x8001: + AY8910Write(0, address & 1, data); + break; + + case 0x8002: + case 0x8003: + SN76496Write(address & 1, data); + break; + } +} + +static inline void DrvMakeInputs() +{ + DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (Rom0 + 0xd000, 0, 0x3000); + memset (Rom1 + 0x4000, 0, 0x0800); + + exedexes_soundlatch = 0; + exedexes_txt_enable = 0; + exedexes_obj_enable = 0; + exedexes_bg_enable = 0; + exedexes_fg_enable = 0; + exedexes_nbg_yscroll = 0; + exedexes_nbg_xscroll = 0; + exedexes_bg_xscroll = 0; + + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + AY8910Reset(0); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Rom0 = Next; Next += 0x10000; + Rom1 = Next; Next += 0x05000; + + Gfx0 = Next; Next += 0x08000; + Gfx1 = Next; Next += 0x10000; + Gfx2 = Next; Next += 0x10000; + Gfx3 = Next; Next += 0x10000; + + Gfx4 = Next; Next += 0x06000; + + Prom = Next; Next += 0x00800; + + fg_tile_transp = Next; Next += 0x00100; + + Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + + pFMBuffer = (INT16*)Next; Next += (nBurnSoundLen * 3 * sizeof(INT16)); + + MemEnd = Next; + + return 0; +} + +static INT32 PaletteInit() +{ + UINT32 *tmp = (UINT32*)BurnMalloc(0x100 * sizeof(UINT32)); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x100; i++) + { + INT32 r = Prom[i + 0x000]; + INT32 g = Prom[i + 0x100]; + INT32 b = Prom[i + 0x200]; + + tmp[i] = (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b; + } + + Prom += 0x300; + + for (INT32 i = 0; i < 0x100; i++) { + Palette[i] = tmp[Prom[i] | 0xc0]; + } + + for (INT32 i = 0x100; i < 0x200; i++) { + Palette[i] = tmp[Prom[i] | 0x00]; + } + + for (INT32 i = 0x200; i < 0x300; i++) { + Palette[i] = tmp[Prom[i] | 0x40]; + } + + for (INT32 i = 0x300; i < 0x400; i++) { + INT32 entry = Prom[i] | (Prom[i + 0x100] << 4) | 0x80; + Palette[i] = tmp[entry]; + } + + BurnFree (tmp); + + return 0; +} + +static INT32 GraphicsDecode() +{ + static INT32 TilePlanes[2] = { 0x004, 0x000 }; + static INT32 SpriPlanes[4] = { 0x20004, 0x20000, 0x00004, 0x00000 }; + static INT32 TileXOffs[32] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, + 0x200, 0x201, 0x202, 0x203, 0x208, 0x209, 0x20a, 0x20b, + 0x400, 0x401, 0x402, 0x403, 0x408, 0x409, 0x40a, 0x40b, + 0x600, 0x601, 0x602, 0x603, 0x608, 0x609, 0x60a, 0x60b }; + static INT32 SpriXOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, + 0x100, 0x101, 0x102, 0x103, 0x108, 0x109, 0x10a, 0x10b }; + static INT32 TileYOffs[32] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, + 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0, + 0x100, 0x110, 0x120, 0x130, 0x140, 0x150, 0x160, 0x170, + 0x180, 0x190, 0x1a0, 0x1b0, 0x1c0, 0x1d0, 0x1e0, 0x1f0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x8000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, Gfx0, 0x02000); + + GfxDecode(0x200, 2, 8, 8, TilePlanes, TileXOffs, TileYOffs, 0x080, tmp, Gfx0); + + memcpy (tmp, Gfx1, 0x04000); + + GfxDecode(0x040, 2, 32, 32, TilePlanes, TileXOffs, TileYOffs, 0x800, tmp, Gfx1); + + memcpy (tmp, Gfx2, 0x08000); + + GfxDecode(0x100, 4, 16, 16, SpriPlanes, SpriXOffs, TileYOffs, 0x200, tmp, Gfx2); + + memcpy (tmp, Gfx3, 0x08000); + + GfxDecode(0x100, 4, 16, 16, SpriPlanes, SpriXOffs, TileYOffs, 0x200, tmp, Gfx3); + + for (INT32 i = 0; i < 0x10000; i++) { + if (Gfx2[i]) fg_tile_transp[i>>8] = 1; + } + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + for (INT32 i = 0; i < 3; i++) { + pAY8910Buffer[i] = pFMBuffer + nBurnSoundLen * i; + } + + { + for (INT32 i = 0; i < 3; i++) { + if (BurnLoadRom(Rom0 + i * 0x4000, i + 0, 1)) return 1; + } + + if (BurnLoadRom(Rom1, 3, 1)) return 1; + if (BurnLoadRom(Gfx0, 4, 1)) return 1; + if (BurnLoadRom(Gfx1, 5, 1)) return 1; + + for (INT32 i = 0; i < 2; i++) { + if (BurnLoadRom(Gfx2 + i * 0x4000, i + 6, 1)) return 1; + if (BurnLoadRom(Gfx3 + i * 0x4000, i + 8, 1)) return 1; + if (BurnLoadRom(Gfx4 + i * 0x4000, i + 10, 1)) return 1; + } + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(Prom + i * 0x0100, i + 12, 1)) return 1; + } + + if (GraphicsDecode()) return 1; + if (PaletteInit()) return 1; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, Rom0 + 0x0000); + ZetMapArea(0x0000, 0xbfff, 2, Rom0 + 0x0000); + ZetMapArea(0xd000, 0xd7ff, 0, Rom0 + 0xd000); + ZetMapArea(0xd000, 0xd7ff, 1, Rom0 + 0xd000); + ZetMapArea(0xe000, 0xefff, 0, Rom0 + 0xe000); + ZetMapArea(0xe000, 0xefff, 1, Rom0 + 0xe000); + ZetMapArea(0xe000, 0xefff, 2, Rom0 + 0xe000); + ZetMapArea(0xf000, 0xffff, 0, Rom0 + 0xf000); + ZetMapArea(0xf000, 0xffff, 1, Rom0 + 0xf000); + ZetSetWriteHandler(exedexes_cpu0_write); + ZetSetReadHandler(exedexes_cpu0_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x3fff, 0, Rom1 + 0x0000); + ZetMapArea(0x0000, 0x3fff, 2, Rom1 + 0x0000); + ZetMapArea(0x4000, 0x47ff, 0, Rom1 + 0x4000); + ZetMapArea(0x4000, 0x47ff, 1, Rom1 + 0x4000); + ZetMapArea(0x4000, 0x47ff, 2, Rom1 + 0x4000); + ZetSetWriteHandler(exedexes_cpu1_write); + ZetSetReadHandler(exedexes_cpu1_read); + ZetClose(); + + AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.10, BURN_SND_ROUTE_BOTH); + + SN76489Init(0, 3000000, 0); + SN76489Init(1, 3000000, 1); + SN76496SetRoute(0, 0.36, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 0.36, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + AY8910Exit(0); + SN76496Exit(); + ZetExit(); + GenericTilesExit(); + + BurnFree (Mem); + + Mem = MemEnd = Rom0 = Rom1 = NULL; + Gfx0 = Gfx1 = Gfx2 = Gfx3 = Gfx4 = Prom = NULL; + for (INT32 i = 0; i < 3; i++) pAY8910Buffer[i] = NULL; + Palette = DrvPalette = NULL; + fg_tile_transp = NULL; + pFMBuffer = NULL; + DrvRecalc = 0; + + return 0; +} + + +static void draw_sprites(INT32 priority) +{ + if (!exedexes_obj_enable) return; + + for (INT32 offs = 0x0fe0; offs >= 0; offs -= 0x20) + { + if ((Rom0[0xf000 + offs + 1] & 0x40) == priority) + { + INT32 code = Rom0[0xf000 + offs]; + INT32 color = Rom0[0xf001 + offs] & 0x0f; + INT32 flipx = Rom0[0xf001 + offs] & 0x10; + INT32 flipy = Rom0[0xf001 + offs] & 0x20; + INT32 sx = Rom0[0xf003 + offs] - ((Rom0[0xf001 + offs] & 0x80) << 1); + INT32 sy = Rom0[0xf002 + offs] - 0x10; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x300, Gfx3); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x300, Gfx3); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x300, Gfx3); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x300, Gfx3); + } + } + } + } +} + +static inline void draw_8x8(INT32 sx, INT32 sy, INT32 code, INT32 color) +{ + UINT8 *src = Gfx0 + (code << 6); + color <<= 2; + + for (INT32 y = sy; y < sy + 8; y++) { + for (INT32 x = sx; x < sx + 8; x++, src++) { + if (y < 0 || x < 0 || y >= nScreenHeight || x >= nScreenWidth) continue; + + INT32 pxl = color | *src; + if (Prom[pxl] == 0x0f) continue; + + pTransDraw[(y * nScreenWidth) + x] = pxl; + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + INT32 col = Palette[i]; + DrvPalette[i] = BurnHighCol(col >> 16, col >> 8, col, 0); + } + } + + if (exedexes_bg_enable) + { + for (INT32 i = 0; i < 16 * 8; i++) { + INT32 sx = ((i & 0x0f) << 5); + INT32 sy = (i >> 4) << 5; + + INT32 sxscr = sx + exedexes_bg_xscroll; + + sx -= (exedexes_bg_xscroll & 0x1f); + + if (sx > 0x100) continue; + sy -= 0x10; + + INT32 offset = ((sxscr & 0xe0) >> 5) | ((sy & 0xe0) >> 2) | ((sxscr & 0x3f00) >> 1) | 0x4000; + + INT32 attr = Gfx4[offset]; + INT32 color = Gfx4[offset + 0x40]; + INT32 code = attr & 0x3f; + INT32 flipx = attr & 0x40; + INT32 flipy = attr & 0x80; + + if (flipy) { + if (flipx) { + Render32x32Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0x100, Gfx1); + } else { + Render32x32Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0x100, Gfx1); + } + } else { + if (flipx) { + Render32x32Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0x100, Gfx1); + } else { + Render32x32Tile_Clip(pTransDraw, code, sx, sy, color, 2, 0x100, Gfx1); + } + } + } + } else { + memset(pTransDraw, 0, nScreenWidth * nScreenHeight * sizeof (UINT16)); + } + + draw_sprites(0x40); + + if (exedexes_fg_enable) + { + for (INT32 i = 0; i < 32 * 16; i++) { + INT32 sx = (i & 0x1f) << 4; + INT32 sy = (i >> 5) << 4; + + INT32 vx = sx + exedexes_nbg_yscroll; + INT32 vy = sy + exedexes_nbg_xscroll; + + sx -= exedexes_nbg_yscroll & 0x0f; + sy -= exedexes_nbg_xscroll & 0x0f; + + if (sx > 0x100) continue; + + INT32 offset = ((vx & 0xf0) >> 4) | (vy & 0xf0) | (vx & 0x700) | ((vy & 0x700) << 3); + + INT32 code = Gfx4[offset]; + + if (!fg_tile_transp[code]) continue; + sy -= 0x10; + + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, 0, 2, 0, 0x200, Gfx2); + } + } + + draw_sprites(0); + + if (exedexes_txt_enable) + { + for (INT32 i = 0x40; i < 0x3c0; i++) { + INT32 sx = (i & 0x1f) << 3; + INT32 sy = ((i >> 5) << 3) - 0x10; + INT32 code = Rom0[0xd000 | i] | ((Rom0[0xd400 | i] & 0x80) << 1); + INT32 color = Rom0[0xd400 | i] & 0x3f; + + if (code == 0x0024) continue; + + draw_8x8(sx, sy, code, color); + //Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, Gfx0); + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + DrvMakeInputs(); + + INT32 nInterleave = 16; + INT32 nCyclesDone[2] = { 0, 0 }; + INT32 nCyclesTotal[2] = { 4000000 / 60, 3000000 / 60 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 0) { + ZetSetVector(0xcf); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nCyclesDone[nCurrentCPU] += ZetRun(100); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } + if (i == ( nInterleave - 2)) { + ZetSetVector(0xd7); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nCyclesDone[nCurrentCPU] += ZetRun(100); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } + ZetClose(); + + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if ((i & 3) == 3) { + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + ZetClose(); + } + + if (pBurnSoundOut) { + SN76496Update(0, pBurnSoundOut, nBurnSoundLen); + SN76496Update(1, pBurnSoundOut, nBurnSoundLen); + + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 1); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = Rom0 + 0xd000; + ba.nLen = 0x3000; + ba.szName = "All CPU #0 Ram"; + BurnAcb(&ba); + + ba.Data = Rom1 + 0x4000; + ba.nLen = 0x0800; + ba.szName = "All CPU #1 Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + AY8910Scan(nAction, pnMin); + SN76496Scan(nAction, pnMin); + + SCAN_VAR(exedexes_soundlatch); + SCAN_VAR(exedexes_txt_enable); + SCAN_VAR(exedexes_obj_enable); + SCAN_VAR(exedexes_bg_enable); + SCAN_VAR(exedexes_fg_enable); + SCAN_VAR(exedexes_nbg_yscroll); + SCAN_VAR(exedexes_nbg_xscroll); + SCAN_VAR(exedexes_bg_xscroll); + } + + return 0; +} + + +// Exed Exes + +static struct BurnRomInfo exedexesRomDesc[] = { + { "11m_ee04.bin", 0x4000, 0x44140dbd, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "10m_ee03.bin", 0x4000, 0xbf72cfba, 1 | BRF_PRG | BRF_ESS }, // 1 + { "09m_ee02.bin", 0x4000, 0x7ad95e2f, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "11e_ee01.bin", 0x4000, 0x73cdf3b2, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "05c_ee00.bin", 0x2000, 0xcadb75bd, 3 | BRF_GRA }, // 4 Characters + + { "h01_ee08.bin", 0x4000, 0x96a65c1d, 4 | BRF_GRA }, // 5 32x32 tiles + + { "a03_ee06.bin", 0x4000, 0x6039bdd1, 5 | BRF_GRA }, // 6 16x16 tiles + { "a02_ee05.bin", 0x4000, 0xb32d8252, 5 | BRF_GRA }, // 7 + + { "j11_ee10.bin", 0x4000, 0xbc83e265, 6 | BRF_GRA }, // 8 Sprites + { "j12_ee11.bin", 0x4000, 0x0e0f300d, 6 | BRF_GRA }, // 9 + + { "c01_ee07.bin", 0x4000, 0x3625a68d, 7 | BRF_GRA }, // 10 Tile Maps + { "h04_ee09.bin", 0x2000, 0x6057c907, 7 | BRF_GRA }, // 11 + + { "02d_e-02.bin", 0x0100, 0x8d0d5935, 8 | BRF_GRA }, // 12 Color Proms + { "03d_e-03.bin", 0x0100, 0xd3c17efc, 8 | BRF_GRA }, // 13 + { "04d_e-04.bin", 0x0100, 0x58ba964c, 8 | BRF_GRA }, // 14 + { "06f_e-05.bin", 0x0100, 0x35a03579, 8 | BRF_GRA }, // 15 + { "l04_e-10.bin", 0x0100, 0x1dfad87a, 8 | BRF_GRA }, // 16 + { "c04_e-07.bin", 0x0100, 0x850064e0, 8 | BRF_GRA }, // 17 + { "l09_e-11.bin", 0x0100, 0x2bb68710, 8 | BRF_GRA }, // 18 + { "l10_e-12.bin", 0x0100, 0x173184ef, 8 | BRF_GRA }, // 19 + + { "06l_e-06.bin", 0x0100, 0x712ac508, 0 | BRF_OPT }, // 20 Misc. Proms + { "k06_e-08.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 21 + { "l03_e-09.bin", 0x0100, 0x0d968558, 0 | BRF_OPT }, // 22 + { "03e_e-01.bin", 0x0020, 0x1acee376, 0 | BRF_OPT }, // 23 +}; + +STD_ROM_PICK(exedexes) +STD_ROM_FN(exedexes) + +struct BurnDriver BurnDrvExedexes = { + "exedexes", NULL, NULL, NULL, "1985", + "Exed Exes\0", NULL, "Capcom", "Miscellaneous", + L"Exed Exes\0\u30A8\u30B0\u30BC\u30C9 \u30A8\u30B0\u30BC\u30B9\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, exedexesRomInfo, exedexesRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 224, 256, 3, 4 +}; + + +// Savage Bees + +static struct BurnRomInfo savgbeesRomDesc[] = { + { "ee04e.11m", 0x4000, 0xc0caf442, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "ee03e.10m", 0x4000, 0x9cd70ae1, 1 | BRF_PRG | BRF_ESS }, // 1 + { "ee02e.9m", 0x4000, 0xa04e6368, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "ee01e.11e", 0x4000, 0x93d3f952, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "ee00e.5c", 0x2000, 0x5972f95f, 3 | BRF_GRA }, // 4 Characters + + { "h01_ee08.bin", 0x4000, 0x96a65c1d, 4 | BRF_GRA }, // 5 32x32 tiles + + { "a03_ee06.bin", 0x4000, 0x6039bdd1, 5 | BRF_GRA }, // 6 16x16 tiles + { "a02_ee05.bin", 0x4000, 0xb32d8252, 5 | BRF_GRA }, // 7 + + { "j11_ee10.bin", 0x4000, 0xbc83e265, 6 | BRF_GRA }, // 8 Sprites + { "j12_ee11.bin", 0x4000, 0x0e0f300d, 6 | BRF_GRA }, // 9 + + { "c01_ee07.bin", 0x4000, 0x3625a68d, 7 | BRF_GRA }, // 10 Tile Maps + { "h04_ee09.bin", 0x2000, 0x6057c907, 7 | BRF_GRA }, // 11 + + { "02d_e-02.bin", 0x0100, 0x8d0d5935, 8 | BRF_GRA }, // 12 Color Proms + { "03d_e-03.bin", 0x0100, 0xd3c17efc, 8 | BRF_GRA }, // 13 + { "04d_e-04.bin", 0x0100, 0x58ba964c, 8 | BRF_GRA }, // 14 + { "06f_e-05.bin", 0x0100, 0x35a03579, 8 | BRF_GRA }, // 15 + { "l04_e-10.bin", 0x0100, 0x1dfad87a, 8 | BRF_GRA }, // 16 + { "c04_e-07.bin", 0x0100, 0x850064e0, 8 | BRF_GRA }, // 17 + { "l09_e-11.bin", 0x0100, 0x2bb68710, 8 | BRF_GRA }, // 18 + { "l10_e-12.bin", 0x0100, 0x173184ef, 8 | BRF_GRA }, // 19 + + { "06l_e-06.bin", 0x0100, 0x712ac508, 0 | BRF_OPT }, // 20 Misc. Proms + { "k06_e-08.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 21 + { "l03_e-09.bin", 0x0100, 0x0d968558, 0 | BRF_OPT }, // 22 + { "03e_e-01.bin", 0x0020, 0x1acee376, 0 | BRF_OPT }, // 23 +}; + +STD_ROM_PICK(savgbees) +STD_ROM_FN(savgbees) + +struct BurnDriver BurnDrvSavgbees = { + "savgbees", "exedexes", NULL, NULL, "1985", + "Savage Bees\0", NULL, "Capcom (Memetron license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, savgbeesRomInfo, savgbeesRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 224, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_funkybee.cpp b/src/burn/drv/pre90s/d_funkybee.cpp index ad028250d..949dddf30 100644 --- a/src/burn/drv/pre90s/d_funkybee.cpp +++ b/src/burn/drv/pre90s/d_funkybee.cpp @@ -1,731 +1,730 @@ -// FB Alpha Funky Bee Driver Module -// Based on MAME driver by Zsolt Vasvari - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvColPROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvColRAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static INT16 *pAY8910Buffer[3]; - -static UINT8 *scroll; -static UINT8 *flipscreen; -static UINT8 *gfx_bank; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvInputs[3]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; - -static INT32 watchdog; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, - {"P1 start" , BIT_DIGITAL , DrvJoy1 + 3, "p1 start" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p1 right" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up", }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down", }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, - - {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 1, "p2 coin" }, - {"P2 start" , BIT_DIGITAL , DrvJoy1 + 4, "p2 start" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up", }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down", }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo funkybeeDIPList[]= -{ - {0x0f, 0xff, 0xff, 0x20, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x0f, 0x01, 0x20, 0x20, "Off" }, - {0x0f, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x10, 0x01, 0x03, 0x03, "1C 1C" }, - {0x10, 0x01, 0x03, 0x02, "1C 2C" }, - {0x10, 0x01, 0x03, 0x01, "1C 3C" }, - {0x10, 0x01, 0x03, 0x00, "1C 4C" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x10, 0x01, 0x0c, 0x08, "2C 1C" }, - {0x10, 0x01, 0x0c, 0x0c, "1C 1C" }, - {0x10, 0x01, 0x0c, 0x04, "2C 3C" }, - {0x10, 0x01, 0x0c, 0x00, "1C 6C" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x10, 0x01, 0x30, 0x30, "3" }, - {0x10, 0x01, 0x30, 0x20, "4" }, - {0x10, 0x01, 0x30, 0x10, "5" }, - {0x10, 0x01, 0x30, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x40, 0x40, "20000" }, - {0x10, 0x01, 0x40, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x00, "Upright" }, - {0x10, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(funkybee) - -static struct BurnDIPInfo funkbeebDIPList[]= -{ - {0x0f, 0xff, 0xff, 0x20, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x0f, 0x01, 0x20, 0x20, "Off" }, - {0x0f, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x10, 0x01, 0x03, 0x03, "1C 1C" }, - {0x10, 0x01, 0x03, 0x02, "1C 2C" }, - {0x10, 0x01, 0x03, 0x01, "1C 3C" }, - {0x10, 0x01, 0x03, 0x00, "1C 4C" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x10, 0x01, 0x0c, 0x08, "2C 1C" }, - {0x10, 0x01, 0x0c, 0x0c, "1C 1C" }, - {0x10, 0x01, 0x0c, 0x04, "2C 3C" }, - {0x10, 0x01, 0x0c, 0x00, "1C 6C" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x10, 0x01, 0x30, 0x30, "1" }, - {0x10, 0x01, 0x30, 0x20, "2" }, - {0x10, 0x01, 0x30, 0x10, "3" }, - {0x10, 0x01, 0x30, 0x00, "4" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x40, 0x40, "20000" }, - {0x10, 0x01, 0x40, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x00, "Upright" }, - {0x10, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(funkbeeb) - -static struct BurnDIPInfo skylancrDIPList[]= -{ - {0x0f, 0xff, 0xff, 0x20, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x0f, 0x01, 0x20, 0x20, "Off" }, - {0x0f, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x10, 0x01, 0x03, 0x03, "1C 1C" }, - {0x10, 0x01, 0x03, 0x02, "1C 2C" }, - {0x10, 0x01, 0x03, 0x01, "1C 3C" }, - {0x10, 0x01, 0x03, 0x00, "1C 6C" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x10, 0x01, 0x0c, 0x08, "2C 1C" }, - {0x10, 0x01, 0x0c, 0x0c, "1C 1C" }, - {0x10, 0x01, 0x0c, 0x04, "2C 3C" }, - {0x10, 0x01, 0x0c, 0x00, "1C 6C" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x10, 0x01, 0x30, 0x30, "1" }, - {0x10, 0x01, 0x30, 0x20, "2" }, - {0x10, 0x01, 0x30, 0x10, "3" }, - {0x10, 0x01, 0x30, 0x00, "4" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x40, 0x40, "20000" }, - {0x10, 0x01, 0x40, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x00, "Upright" }, - {0x10, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(skylancr) - -static struct BurnDIPInfo skylanceDIPList[]= -{ - {0x0f, 0xff, 0xff, 0x20, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x0f, 0x01, 0x20, 0x20, "Off" }, - {0x0f, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x10, 0x01, 0x03, 0x03, "1C 1C" }, - {0x10, 0x01, 0x03, 0x02, "1C 2C" }, - {0x10, 0x01, 0x03, 0x01, "1C 3C" }, - {0x10, 0x01, 0x03, 0x00, "1C 6C" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x10, 0x01, 0x0c, 0x08, "2C 1C" }, - {0x10, 0x01, 0x0c, 0x0c, "1C 1C" }, - {0x10, 0x01, 0x0c, 0x04, "2C 3C" }, - {0x10, 0x01, 0x0c, 0x00, "1C 6C" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x10, 0x01, 0x30, 0x30, "3" }, - {0x10, 0x01, 0x30, 0x20, "4" }, - {0x10, 0x01, 0x30, 0x10, "5" }, - {0x10, 0x01, 0x30, 0x00, "64" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x40, 0x40, "20000 50000" }, - {0x10, 0x01, 0x40, 0x00, "40000 70000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x00, "Upright" }, - {0x10, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(skylance) - -UINT8 __fastcall funkybee_read(UINT16 address) -{ - switch (address) - { - case 0xf000: - return 0; - - case 0xf800: - watchdog = 0; - return DrvInputs[0] | (DrvDips[0] & 0xe0); - - case 0xf801: - return DrvInputs[1]; - - case 0xf802: - return DrvInputs[2]; - } - - return 0; -} - -void __fastcall funkybee_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe000: - *scroll = data; - break; - - case 0xe800: - *flipscreen = data & 1; - break; - - case 0xe802: // coin counter - case 0xe803: - break; - - case 0xe805: - *gfx_bank = data & 1; - break; - - case 0xf800: - watchdog = 0; - break; - } -} - -UINT8 __fastcall funkybee_in_port(UINT16 address) -{ - switch (address & 0xff) - { - case 0x02: - return AY8910Read(0); - } - - return 0; -} - -void __fastcall funkybee_out_port(UINT16 address, UINT8 data) -{ - switch (address & 0xff) - { - case 0x00: - case 0x01: - AY8910Write(0, address & 1, data); - break; - } -} - -static UINT8 funkybee_ay8910_read_A(UINT32) -{ - return DrvDips[1]; -} - -static INT32 DrvDoReset(INT32 clear_mem) -{ - if (clear_mem) { - memset (AllRam, 0, RamEnd - AllRam); - } - - ZetOpen(0); - ZetReset(); - ZetClose(); - - watchdog = 0; - - return 0; -} - -static void DrvGfxDecode() -{ - INT32 Planes[2] = { 0, 4 }; - INT32 XOffs[8] = { STEP4(0, 1), STEP4(0x40, 1) }; - INT32 YOffs[32] = { STEP8(0, 8), STEP8(0x80, 8), STEP8(0x100, 8), STEP8(0x180, 8) }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x4000); - if (tmp == NULL) { - return; - } - - memcpy (tmp, DrvGfxROM0, 0x4000); - - GfxDecode(0x400, 2, 8, 8, Planes, XOffs, YOffs, 0x080, tmp, DrvGfxROM0); - GfxDecode(0x100, 2, 8, 32, Planes, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); - - BurnFree (tmp); -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0; i < 32; i++) - { - INT32 bit0 = (DrvColPROM[i] >> 0) & 0x01; - INT32 bit1 = (DrvColPROM[i] >> 1) & 0x01; - INT32 bit2 = (DrvColPROM[i] >> 2) & 0x01; - INT32 r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (DrvColPROM[i] >> 3) & 0x01; - bit1 = (DrvColPROM[i] >> 4) & 0x01; - bit2 = (DrvColPROM[i] >> 5) & 0x01; - INT32 g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = 0; - bit1 = (DrvColPROM[i] >> 6) & 0x01; - bit2 = (DrvColPROM[i] >> 7) & 0x01; - INT32 b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - DrvPalette[i] = (r << 16) | (g << 8) | b; - } -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x005000; - - DrvGfxROM0 = Next; Next += 0x010000; - DrvGfxROM1 = Next; Next += 0x010000; - - DrvColPROM = Next; Next += 0x000020; - - DrvPalette = (UINT32*)Next; Next += 0x0020 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x000800; - DrvVidRAM = Next; Next += 0x002000; - DrvColRAM = Next; Next += 0x002000; - - flipscreen = Next; Next += 0x000001; - gfx_bank = Next; Next += 0x000001; - scroll = Next; Next += 0x000001; - - RamEnd = Next; - - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit(INT32 game) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (game) { - if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x4000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x0000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x2000, 4, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x0000, 5, 1)) return 1; - } else { - if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x1000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x2000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x3000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x0000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x2000, 5, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x0000, 6, 1)) return 1; - } - - DrvPaletteInit(); - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x4fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x4fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetMapArea(0xa000, 0xbfff, 0, DrvVidRAM); - ZetMapArea(0xa000, 0xbfff, 1, DrvVidRAM); - ZetMapArea(0xa000, 0xbfff, 2, DrvVidRAM); - ZetMapArea(0xc000, 0xdfff, 0, DrvColRAM); - ZetMapArea(0xc000, 0xdfff, 1, DrvColRAM); - ZetMapArea(0xc000, 0xdfff, 2, DrvColRAM); - ZetSetWriteHandler(funkybee_write); - ZetSetReadHandler(funkybee_read); - ZetSetOutHandler(funkybee_out_port); - ZetSetInHandler(funkybee_in_port); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 1500000, nBurnSoundRate, &funkybee_ay8910_read_A, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(1); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - AY8910Exit(0); - - BurnFree(AllMem); - - return 0; -} - -static void draw_bg_layer() -{ - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) * 8; - INT32 sy = (offs / 0x20) * 8; - - sx -= *scroll; - if (sx < -7) sx += 256; - - INT32 ofst = ((offs / 0x20) * 0x100) + (offs & 0x1f); - - INT32 attr = DrvColRAM[ofst]; - INT32 code = DrvVidRAM[ofst] + ((attr & 0x80) << 1) + (*gfx_bank * 0x200); - INT32 color = attr & 0x03; - - Render8x8Tile_Clip(pTransDraw, code, sx - 12, sy, color, 2, 0, DrvGfxROM0); - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0x0f; offs >= 0; offs--) - { - INT32 ofst = offs + 0x1e00; - INT32 attr = DrvVidRAM[ofst]; - INT32 sy = 224 - DrvColRAM[ofst]; - INT32 sx = DrvVidRAM[ofst + 0x10]; - INT32 color = DrvColRAM[ofst + 0x10] & 3; - INT32 code = (attr >> 2) + ((attr & 2) << 5) + (*gfx_bank * 0x080); - INT32 flipy = attr & 1; - INT32 flipx = 0; - - if (flipy) { - if (flipx) { - RenderCustomTile_Mask_FlipXY_Clip(pTransDraw, 8, 32, code, sx - 12, sy, color, 2, 0, 0x10, DrvGfxROM1); - } else { - RenderCustomTile_Mask_FlipY_Clip(pTransDraw, 8, 32, code, sx - 12, sy, color, 2, 0, 0x10, DrvGfxROM1); - } - } else { - if (flipx) { - RenderCustomTile_Mask_FlipX_Clip(pTransDraw, 8, 32, code, sx - 12, sy, color, 2, 0, 0x10, DrvGfxROM1); - } else { - RenderCustomTile_Mask_Clip(pTransDraw, 8, 32, code, sx - 12, sy, color, 2, 0, 0x10, DrvGfxROM1); - } - } - } -} - -static void draw_fg_layer() -{ - for (INT32 offs = 0x1f; offs >= 0; offs--) - { - int flip = *flipscreen; - int sy = offs * 8; - if (flip) sy = 248 - sy; - - int code = DrvVidRAM[0x1c00 + offs] + (*gfx_bank * 0x200); - int color = DrvColRAM[0x1f10] & 0x03; - int sx = flip ? DrvVidRAM[0x1f1f] : DrvVidRAM[0x1f10]; - - if (flip) - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, (232 - sx) + 4, sy ^ 0xf8, color, 2, 0, 0, DrvGfxROM0); - else - Render8x8Tile_Mask_Clip(pTransDraw, code, sx - 12, sy, color, 2, 0, 0, DrvGfxROM0); - - code = DrvVidRAM[0x1d00 + offs] + (*gfx_bank * 0x200); - color = DrvColRAM[0x1f11] & 0x03; - sx = flip ? DrvVidRAM[0x1f1e] : DrvVidRAM[0x1f11]; - - if (flip) - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, (232 - sx) + 4, sy ^ 0xf8, color, 2, 0, 0, DrvGfxROM0); - else - Render8x8Tile_Mask_Clip(pTransDraw, code, sx - 12, sy, color, 2, 0, 0, DrvGfxROM0); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvPaletteInit(); - DrvRecalc = 0; - } - - draw_bg_layer(); - draw_sprites(); - draw_fg_layer(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(1); - } - - watchdog++; - if (watchdog >= 180) { - DrvDoReset(0); - } - - { - memset (DrvInputs, 0, 3); - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - ZetOpen(0); - ZetRun(3072000 / 60); - ZetRaiseIrq(0); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - AY8910Scan(nAction, pnMin); - } - - return 0; -} - - -// Funky Bee - -static struct BurnRomInfo funkybeeRomDesc[] = { - { "funkybee.1", 0x1000, 0x3372cb33, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "funkybee.3", 0x1000, 0x7bf7c62f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "funkybee.2", 0x1000, 0x8cc0fe8e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "funkybee.4", 0x1000, 0x1e1aac26, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "funkybee.5", 0x2000, 0x86126655, 2 | BRF_GRA }, // 4 Graphics tiles - { "funkybee.6", 0x2000, 0x5fffd323, 2 | BRF_GRA }, // 5 - - { "funkybee.clr", 0x0020, 0xe2cf5fe2, 3 | BRF_GRA }, // 6 Color prom -}; - -STD_ROM_PICK(funkybee) -STD_ROM_FN(funkybee) - -static INT32 funkybeeInit() -{ - return DrvInit(0); -} - -struct BurnDriver BurnDrvfunkybee = { - "funkybee", NULL, NULL, NULL, "1982", - "Funky Bee\0", NULL, "Orca", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, funkybeeRomInfo, funkybeeRomName, NULL, NULL, DrvInputInfo, funkybeeDIPInfo, - funkybeeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 224, 236, 3, 4 -}; - - -// Funky Bee (bootleg, harder) - -static struct BurnRomInfo funkbeebRomDesc[] = { - { "senza_orca.fb1", 0x1000, 0x7f2e7f85, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "funkybee.3", 0x1000, 0x7bf7c62f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "funkybee.2", 0x1000, 0x8cc0fe8e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "senza_orca.fb4", 0x1000, 0x53c2db3b, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "funkybee.5", 0x2000, 0x86126655, 2 | BRF_GRA }, // 4 Graphics tiles - { "funkybee.6", 0x2000, 0x5fffd323, 2 | BRF_GRA }, // 5 - - { "funkybee.clr", 0x0020, 0xe2cf5fe2, 3 | BRF_GRA }, // 6 Color prom -}; - -STD_ROM_PICK(funkbeeb) -STD_ROM_FN(funkbeeb) - -struct BurnDriver BurnDrvfunkbeeb = { - "funkybeeb", "funkybee", NULL, NULL, "1982", - "Funky Bee (bootleg, harder)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, funkbeebRomInfo, funkbeebRomName, NULL, NULL, DrvInputInfo, funkbeebDIPInfo, - funkybeeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 224, 236, 3, 4 -}; - - -// Sky Lancer - -static struct BurnRomInfo skylancrRomDesc[] = { - { "1sl.5a", 0x2000, 0xe80b315e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "2sl.5c", 0x2000, 0x9d70567b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "3sl.5d", 0x2000, 0x64c39457, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "4sl.6a", 0x2000, 0x9b4469a5, 2 | BRF_GRA }, // 3 Graphics tiles - { "5sl.6c", 0x2000, 0x29afa134, 2 | BRF_GRA }, // 4 - - { "18s030.1a", 0x0020, 0xe645bacb, 3 | BRF_GRA }, // 5 Color prom -}; - -STD_ROM_PICK(skylancr) -STD_ROM_FN(skylancr) - -static INT32 skylancrInit() -{ - return DrvInit(1); -} - -struct BurnDriver BurnDrvskylancr = { - "skylancr", NULL, NULL, NULL, "1983", - "Sky Lancer\0", NULL, "Orca", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, skylancrRomInfo, skylancrRomName, NULL, NULL, DrvInputInfo, skylancrDIPInfo, - skylancrInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 224, 236, 3, 4 -}; - - -// Sky Lancer (Esco Trading Co license) - -static struct BurnRomInfo skylanceRomDesc[] = { - { "1.5a", 0x2000, 0x82d55824, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "2.5c", 0x2000, 0xdff3a682, 1 | BRF_PRG | BRF_ESS }, // 1 - { "3.5d", 0x1000, 0x7c006ee6, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "4.6a", 0x2000, 0x0f8ede07, 2 | BRF_GRA }, // 3 Graphics tiles - { "5.6b", 0x2000, 0x24cec070, 2 | BRF_GRA }, // 4 - - { "18s030.1a", 0x0020, 0xe645bacb, 3 | BRF_GRA }, // 5 Color prom -}; - -STD_ROM_PICK(skylance) -STD_ROM_FN(skylance) - -struct BurnDriver BurnDrvskylance = { - "skylancre", "skylancr", NULL, NULL, "1983", - "Sky Lancer (Esco Trading Co license)\0", NULL, "Orca (Esco Trading Co license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, skylanceRomInfo, skylanceRomName, NULL, NULL, DrvInputInfo, skylanceDIPInfo, - skylancrInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, - 224, 236, 3, 4 -}; +// FB Alpha Funky Bee Driver Module +// Based on MAME driver by Zsolt Vasvari + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvColPROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvColRAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static INT16 *pAY8910Buffer[3]; + +static UINT8 *scroll; +static UINT8 *flipscreen; +static UINT8 *gfx_bank; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvInputs[3]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; + +static INT32 watchdog; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, + {"P1 start" , BIT_DIGITAL , DrvJoy1 + 3, "p1 start" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p1 right" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up", }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down", }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, + + {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 1, "p2 coin" }, + {"P2 start" , BIT_DIGITAL , DrvJoy1 + 4, "p2 start" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up", }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down", }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo funkybeeDIPList[]= +{ + {0x0f, 0xff, 0xff, 0x20, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x0f, 0x01, 0x20, 0x20, "Off" }, + {0x0f, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x10, 0x01, 0x03, 0x03, "1C 1C" }, + {0x10, 0x01, 0x03, 0x02, "1C 2C" }, + {0x10, 0x01, 0x03, 0x01, "1C 3C" }, + {0x10, 0x01, 0x03, 0x00, "1C 4C" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x10, 0x01, 0x0c, 0x08, "2C 1C" }, + {0x10, 0x01, 0x0c, 0x0c, "1C 1C" }, + {0x10, 0x01, 0x0c, 0x04, "2C 3C" }, + {0x10, 0x01, 0x0c, 0x00, "1C 6C" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x10, 0x01, 0x30, 0x30, "3" }, + {0x10, 0x01, 0x30, 0x20, "4" }, + {0x10, 0x01, 0x30, 0x10, "5" }, + {0x10, 0x01, 0x30, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x40, 0x40, "20000" }, + {0x10, 0x01, 0x40, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x00, "Upright" }, + {0x10, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(funkybee) + +static struct BurnDIPInfo funkbeebDIPList[]= +{ + {0x0f, 0xff, 0xff, 0x20, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x0f, 0x01, 0x20, 0x20, "Off" }, + {0x0f, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x10, 0x01, 0x03, 0x03, "1C 1C" }, + {0x10, 0x01, 0x03, 0x02, "1C 2C" }, + {0x10, 0x01, 0x03, 0x01, "1C 3C" }, + {0x10, 0x01, 0x03, 0x00, "1C 4C" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x10, 0x01, 0x0c, 0x08, "2C 1C" }, + {0x10, 0x01, 0x0c, 0x0c, "1C 1C" }, + {0x10, 0x01, 0x0c, 0x04, "2C 3C" }, + {0x10, 0x01, 0x0c, 0x00, "1C 6C" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x10, 0x01, 0x30, 0x30, "1" }, + {0x10, 0x01, 0x30, 0x20, "2" }, + {0x10, 0x01, 0x30, 0x10, "3" }, + {0x10, 0x01, 0x30, 0x00, "4" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x40, 0x40, "20000" }, + {0x10, 0x01, 0x40, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x00, "Upright" }, + {0x10, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(funkbeeb) + +static struct BurnDIPInfo skylancrDIPList[]= +{ + {0x0f, 0xff, 0xff, 0x20, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x0f, 0x01, 0x20, 0x20, "Off" }, + {0x0f, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x10, 0x01, 0x03, 0x03, "1C 1C" }, + {0x10, 0x01, 0x03, 0x02, "1C 2C" }, + {0x10, 0x01, 0x03, 0x01, "1C 3C" }, + {0x10, 0x01, 0x03, 0x00, "1C 6C" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x10, 0x01, 0x0c, 0x08, "2C 1C" }, + {0x10, 0x01, 0x0c, 0x0c, "1C 1C" }, + {0x10, 0x01, 0x0c, 0x04, "2C 3C" }, + {0x10, 0x01, 0x0c, 0x00, "1C 6C" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x10, 0x01, 0x30, 0x30, "1" }, + {0x10, 0x01, 0x30, 0x20, "2" }, + {0x10, 0x01, 0x30, 0x10, "3" }, + {0x10, 0x01, 0x30, 0x00, "4" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x40, 0x40, "20000" }, + {0x10, 0x01, 0x40, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x00, "Upright" }, + {0x10, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(skylancr) + +static struct BurnDIPInfo skylanceDIPList[]= +{ + {0x0f, 0xff, 0xff, 0x20, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x0f, 0x01, 0x20, 0x20, "Off" }, + {0x0f, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x10, 0x01, 0x03, 0x03, "1C 1C" }, + {0x10, 0x01, 0x03, 0x02, "1C 2C" }, + {0x10, 0x01, 0x03, 0x01, "1C 3C" }, + {0x10, 0x01, 0x03, 0x00, "1C 6C" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x10, 0x01, 0x0c, 0x08, "2C 1C" }, + {0x10, 0x01, 0x0c, 0x0c, "1C 1C" }, + {0x10, 0x01, 0x0c, 0x04, "2C 3C" }, + {0x10, 0x01, 0x0c, 0x00, "1C 6C" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x10, 0x01, 0x30, 0x30, "3" }, + {0x10, 0x01, 0x30, 0x20, "4" }, + {0x10, 0x01, 0x30, 0x10, "5" }, + {0x10, 0x01, 0x30, 0x00, "64" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x40, 0x40, "20000 50000" }, + {0x10, 0x01, 0x40, 0x00, "40000 70000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x00, "Upright" }, + {0x10, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(skylance) + +UINT8 __fastcall funkybee_read(UINT16 address) +{ + switch (address) + { + case 0xf000: + return 0; + + case 0xf800: + watchdog = 0; + return DrvInputs[0] | (DrvDips[0] & 0xe0); + + case 0xf801: + return DrvInputs[1]; + + case 0xf802: + return DrvInputs[2]; + } + + return 0; +} + +void __fastcall funkybee_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe000: + *scroll = data; + break; + + case 0xe800: + *flipscreen = data & 1; + break; + + case 0xe802: // coin counter + case 0xe803: + break; + + case 0xe805: + *gfx_bank = data & 1; + break; + + case 0xf800: + watchdog = 0; + break; + } +} + +UINT8 __fastcall funkybee_in_port(UINT16 address) +{ + switch (address & 0xff) + { + case 0x02: + return AY8910Read(0); + } + + return 0; +} + +void __fastcall funkybee_out_port(UINT16 address, UINT8 data) +{ + switch (address & 0xff) + { + case 0x00: + case 0x01: + AY8910Write(0, address & 1, data); + break; + } +} + +static UINT8 funkybee_ay8910_read_A(UINT32) +{ + return DrvDips[1]; +} + +static INT32 DrvDoReset(INT32 clear_mem) +{ + if (clear_mem) { + memset (AllRam, 0, RamEnd - AllRam); + } + + ZetOpen(0); + ZetReset(); + ZetClose(); + + watchdog = 0; + + return 0; +} + +static void DrvGfxDecode() +{ + INT32 Planes[2] = { 0, 4 }; + INT32 XOffs[8] = { STEP4(0, 1), STEP4(0x40, 1) }; + INT32 YOffs[32] = { STEP8(0, 8), STEP8(0x80, 8), STEP8(0x100, 8), STEP8(0x180, 8) }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x4000); + if (tmp == NULL) { + return; + } + + memcpy (tmp, DrvGfxROM0, 0x4000); + + GfxDecode(0x400, 2, 8, 8, Planes, XOffs, YOffs, 0x080, tmp, DrvGfxROM0); + GfxDecode(0x100, 2, 8, 32, Planes, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); + + BurnFree (tmp); +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0; i < 32; i++) + { + INT32 bit0 = (DrvColPROM[i] >> 0) & 0x01; + INT32 bit1 = (DrvColPROM[i] >> 1) & 0x01; + INT32 bit2 = (DrvColPROM[i] >> 2) & 0x01; + INT32 r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (DrvColPROM[i] >> 3) & 0x01; + bit1 = (DrvColPROM[i] >> 4) & 0x01; + bit2 = (DrvColPROM[i] >> 5) & 0x01; + INT32 g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = 0; + bit1 = (DrvColPROM[i] >> 6) & 0x01; + bit2 = (DrvColPROM[i] >> 7) & 0x01; + INT32 b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + DrvPalette[i] = (r << 16) | (g << 8) | b; + } +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x005000; + + DrvGfxROM0 = Next; Next += 0x010000; + DrvGfxROM1 = Next; Next += 0x010000; + + DrvColPROM = Next; Next += 0x000020; + + DrvPalette = (UINT32*)Next; Next += 0x0020 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x000800; + DrvVidRAM = Next; Next += 0x002000; + DrvColRAM = Next; Next += 0x002000; + + flipscreen = Next; Next += 0x000001; + gfx_bank = Next; Next += 0x000001; + scroll = Next; Next += 0x000001; + + RamEnd = Next; + + pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit(INT32 game) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (game) { + if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x4000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x0000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x2000, 4, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x0000, 5, 1)) return 1; + } else { + if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x1000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x2000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x3000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x0000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x2000, 5, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x0000, 6, 1)) return 1; + } + + DrvPaletteInit(); + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x4fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x4fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetMapArea(0xa000, 0xbfff, 0, DrvVidRAM); + ZetMapArea(0xa000, 0xbfff, 1, DrvVidRAM); + ZetMapArea(0xa000, 0xbfff, 2, DrvVidRAM); + ZetMapArea(0xc000, 0xdfff, 0, DrvColRAM); + ZetMapArea(0xc000, 0xdfff, 1, DrvColRAM); + ZetMapArea(0xc000, 0xdfff, 2, DrvColRAM); + ZetSetWriteHandler(funkybee_write); + ZetSetReadHandler(funkybee_read); + ZetSetOutHandler(funkybee_out_port); + ZetSetInHandler(funkybee_in_port); + ZetClose(); + + AY8910Init(0, 1500000, nBurnSoundRate, &funkybee_ay8910_read_A, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(1); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + AY8910Exit(0); + + BurnFree(AllMem); + + return 0; +} + +static void draw_bg_layer() +{ + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) * 8; + INT32 sy = (offs / 0x20) * 8; + + sx -= *scroll; + if (sx < -7) sx += 256; + + INT32 ofst = ((offs / 0x20) * 0x100) + (offs & 0x1f); + + INT32 attr = DrvColRAM[ofst]; + INT32 code = DrvVidRAM[ofst] + ((attr & 0x80) << 1) + (*gfx_bank * 0x200); + INT32 color = attr & 0x03; + + Render8x8Tile_Clip(pTransDraw, code, sx - 12, sy, color, 2, 0, DrvGfxROM0); + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0x0f; offs >= 0; offs--) + { + INT32 ofst = offs + 0x1e00; + INT32 attr = DrvVidRAM[ofst]; + INT32 sy = 224 - DrvColRAM[ofst]; + INT32 sx = DrvVidRAM[ofst + 0x10]; + INT32 color = DrvColRAM[ofst + 0x10] & 3; + INT32 code = (attr >> 2) + ((attr & 2) << 5) + (*gfx_bank * 0x080); + INT32 flipy = attr & 1; + INT32 flipx = 0; + + if (flipy) { + if (flipx) { + RenderCustomTile_Mask_FlipXY_Clip(pTransDraw, 8, 32, code, sx - 12, sy, color, 2, 0, 0x10, DrvGfxROM1); + } else { + RenderCustomTile_Mask_FlipY_Clip(pTransDraw, 8, 32, code, sx - 12, sy, color, 2, 0, 0x10, DrvGfxROM1); + } + } else { + if (flipx) { + RenderCustomTile_Mask_FlipX_Clip(pTransDraw, 8, 32, code, sx - 12, sy, color, 2, 0, 0x10, DrvGfxROM1); + } else { + RenderCustomTile_Mask_Clip(pTransDraw, 8, 32, code, sx - 12, sy, color, 2, 0, 0x10, DrvGfxROM1); + } + } + } +} + +static void draw_fg_layer() +{ + for (INT32 offs = 0x1f; offs >= 0; offs--) + { + int flip = *flipscreen; + int sy = offs * 8; + if (flip) sy = 248 - sy; + + int code = DrvVidRAM[0x1c00 + offs] + (*gfx_bank * 0x200); + int color = DrvColRAM[0x1f10] & 0x03; + int sx = flip ? DrvVidRAM[0x1f1f] : DrvVidRAM[0x1f10]; + + if (flip) + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, (232 - sx) + 4, sy ^ 0xf8, color, 2, 0, 0, DrvGfxROM0); + else + Render8x8Tile_Mask_Clip(pTransDraw, code, sx - 12, sy, color, 2, 0, 0, DrvGfxROM0); + + code = DrvVidRAM[0x1d00 + offs] + (*gfx_bank * 0x200); + color = DrvColRAM[0x1f11] & 0x03; + sx = flip ? DrvVidRAM[0x1f1e] : DrvVidRAM[0x1f11]; + + if (flip) + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, (232 - sx) + 4, sy ^ 0xf8, color, 2, 0, 0, DrvGfxROM0); + else + Render8x8Tile_Mask_Clip(pTransDraw, code, sx - 12, sy, color, 2, 0, 0, DrvGfxROM0); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvPaletteInit(); + DrvRecalc = 0; + } + + draw_bg_layer(); + draw_sprites(); + draw_fg_layer(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(1); + } + + watchdog++; + if (watchdog >= 180) { + DrvDoReset(0); + } + + { + memset (DrvInputs, 0, 3); + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + ZetOpen(0); + ZetRun(3072000 / 60); + ZetRaiseIrq(0); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + AY8910Scan(nAction, pnMin); + } + + return 0; +} + + +// Funky Bee + +static struct BurnRomInfo funkybeeRomDesc[] = { + { "funkybee.1", 0x1000, 0x3372cb33, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "funkybee.3", 0x1000, 0x7bf7c62f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "funkybee.2", 0x1000, 0x8cc0fe8e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "funkybee.4", 0x1000, 0x1e1aac26, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "funkybee.5", 0x2000, 0x86126655, 2 | BRF_GRA }, // 4 Graphics tiles + { "funkybee.6", 0x2000, 0x5fffd323, 2 | BRF_GRA }, // 5 + + { "funkybee.clr", 0x0020, 0xe2cf5fe2, 3 | BRF_GRA }, // 6 Color prom +}; + +STD_ROM_PICK(funkybee) +STD_ROM_FN(funkybee) + +static INT32 funkybeeInit() +{ + return DrvInit(0); +} + +struct BurnDriver BurnDrvfunkybee = { + "funkybee", NULL, NULL, NULL, "1982", + "Funky Bee\0", NULL, "Orca", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, funkybeeRomInfo, funkybeeRomName, NULL, NULL, DrvInputInfo, funkybeeDIPInfo, + funkybeeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 224, 236, 3, 4 +}; + + +// Funky Bee (bootleg, harder) + +static struct BurnRomInfo funkbeebRomDesc[] = { + { "senza_orca.fb1", 0x1000, 0x7f2e7f85, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "funkybee.3", 0x1000, 0x7bf7c62f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "funkybee.2", 0x1000, 0x8cc0fe8e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "senza_orca.fb4", 0x1000, 0x53c2db3b, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "funkybee.5", 0x2000, 0x86126655, 2 | BRF_GRA }, // 4 Graphics tiles + { "funkybee.6", 0x2000, 0x5fffd323, 2 | BRF_GRA }, // 5 + + { "funkybee.clr", 0x0020, 0xe2cf5fe2, 3 | BRF_GRA }, // 6 Color prom +}; + +STD_ROM_PICK(funkbeeb) +STD_ROM_FN(funkbeeb) + +struct BurnDriver BurnDrvfunkbeeb = { + "funkybeeb", "funkybee", NULL, NULL, "1982", + "Funky Bee (bootleg, harder)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, funkbeebRomInfo, funkbeebRomName, NULL, NULL, DrvInputInfo, funkbeebDIPInfo, + funkybeeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 224, 236, 3, 4 +}; + + +// Sky Lancer + +static struct BurnRomInfo skylancrRomDesc[] = { + { "1sl.5a", 0x2000, 0xe80b315e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "2sl.5c", 0x2000, 0x9d70567b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "3sl.5d", 0x2000, 0x64c39457, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "4sl.6a", 0x2000, 0x9b4469a5, 2 | BRF_GRA }, // 3 Graphics tiles + { "5sl.6c", 0x2000, 0x29afa134, 2 | BRF_GRA }, // 4 + + { "18s030.1a", 0x0020, 0xe645bacb, 3 | BRF_GRA }, // 5 Color prom +}; + +STD_ROM_PICK(skylancr) +STD_ROM_FN(skylancr) + +static INT32 skylancrInit() +{ + return DrvInit(1); +} + +struct BurnDriver BurnDrvskylancr = { + "skylancr", NULL, NULL, NULL, "1983", + "Sky Lancer\0", NULL, "Orca", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, skylancrRomInfo, skylancrRomName, NULL, NULL, DrvInputInfo, skylancrDIPInfo, + skylancrInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 224, 236, 3, 4 +}; + + +// Sky Lancer (Esco Trading Co license) + +static struct BurnRomInfo skylanceRomDesc[] = { + { "1.5a", 0x2000, 0x82d55824, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "2.5c", 0x2000, 0xdff3a682, 1 | BRF_PRG | BRF_ESS }, // 1 + { "3.5d", 0x1000, 0x7c006ee6, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "4.6a", 0x2000, 0x0f8ede07, 2 | BRF_GRA }, // 3 Graphics tiles + { "5.6b", 0x2000, 0x24cec070, 2 | BRF_GRA }, // 4 + + { "18s030.1a", 0x0020, 0xe645bacb, 3 | BRF_GRA }, // 5 Color prom +}; + +STD_ROM_PICK(skylance) +STD_ROM_FN(skylance) + +struct BurnDriver BurnDrvskylance = { + "skylancre", "skylancr", NULL, NULL, "1983", + "Sky Lancer (Esco Trading Co license)\0", NULL, "Orca (Esco Trading Co license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, skylanceRomInfo, skylanceRomName, NULL, NULL, DrvInputInfo, skylanceDIPInfo, + skylancrInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x20, + 224, 236, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_galaga.cpp b/src/burn/drv/pre90s/d_galaga.cpp index e80dd4f43..1604f60c8 100644 --- a/src/burn/drv/pre90s/d_galaga.cpp +++ b/src/burn/drv/pre90s/d_galaga.cpp @@ -1,1654 +1,1651 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "namco_snd.h" -#include "samples.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[3] = {0, 0, 0}; -static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *DrvZ80Rom1 = NULL; -static UINT8 *DrvZ80Rom2 = NULL; -static UINT8 *DrvZ80Rom3 = NULL; -static UINT8 *DrvVideoRam = NULL; -static UINT8 *DrvSharedRam1 = NULL; -static UINT8 *DrvSharedRam2 = NULL; -static UINT8 *DrvSharedRam3 = NULL; -static UINT8 *DrvPromPalette = NULL; -static UINT8 *DrvPromCharLookup = NULL; -static UINT8 *DrvPromSpriteLookup = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT8 DrvCPU1FireIRQ; -static UINT8 DrvCPU2FireIRQ; -static UINT8 DrvCPU3FireIRQ; -static UINT8 DrvCPU2Halt; -static UINT8 DrvCPU3Halt; -static UINT8 DrvFlipScreen; -static UINT8 DrvStarControl[6]; -static UINT32 DrvStarScrollX; -static UINT32 DrvStarScrollY; - -static UINT8 IOChipCustomCommand; -static UINT8 IOChipCPU1FireIRQ; -static UINT8 IOChipMode; -static UINT8 IOChipCredits; -static UINT8 IOChipCoinPerCredit; -static UINT8 IOChipCreditPerCoin; -static UINT8 IOChipCustom[16]; -static UINT8 PrevInValue; - -static INT32 nCyclesDone[3], nCyclesTotal[3]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 3, "p2 start" }, - - {"Left" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - - {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = 0x7f; - DrvInput[1] = 0xff; - DrvInput[2] = 0xff; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] -= (DrvInputPort0[i] & 1) << i; - DrvInput[1] -= (DrvInputPort1[i] & 1) << i; - DrvInput[2] -= (DrvInputPort2[i] & 1) << i; - } -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x80, NULL }, - {0x0d, 0xff, 0xff, 0xf7, NULL }, - {0x0e, 0xff, 0xff, 0x97, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x80, 0x80, "Off" }, - {0x0c, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0d, 0x01, 0x03, 0x03, "Easy" }, - {0x0d, 0x01, 0x03, 0x00, "Medium" }, - {0x0d, 0x01, 0x03, 0x01, "Hard" }, - {0x0d, 0x01, 0x03, 0x02, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x08, 0x08, "Off" }, - {0x0d, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x0d, 0x01, 0x10, 0x10, "Off" }, - {0x0d, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Rack Test" }, - {0x0d, 0x01, 0x20, 0x20, "Off" }, - {0x0d, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x80, 0x80, "Upright" }, - {0x0d, 0x01, 0x80, 0x00, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x0e, 0x01, 0x07, 0x04, "4 Coins 1 Play" }, - {0x0e, 0x01, 0x07, 0x02, "3 Coins 1 Play" }, - {0x0e, 0x01, 0x07, 0x06, "2 Coins 1 Play" }, - {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x0e, 0x01, 0x07, 0x01, "2 Coins 3 Plays" }, - {0x0e, 0x01, 0x07, 0x03, "1 Coin 2 Plays" }, - {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x0e, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x0e, 0x01, 0x38, 0x20, "20k 60k 60k" }, - {0x0e, 0x01, 0x38, 0x18, "20k 60k" }, - {0x0e, 0x01, 0x38, 0x10, "20k 70k 70k" }, - {0x0e, 0x01, 0x38, 0x30, "20k 80k 80k" }, - {0x0e, 0x01, 0x38, 0x38, "30k 80k" }, - {0x0e, 0x01, 0x38, 0x08, "30k 100k 100k" }, - {0x0e, 0x01, 0x38, 0x28, "30k 120k 120k" }, - {0x0e, 0x01, 0x38, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0xc0, 0x00, "2" }, - {0x0e, 0x01, 0xc0, 0x80, "3" }, - {0x0e, 0x01, 0xc0, 0x40, "4" }, - {0x0e, 0x01, 0xc0, 0xc0, "5" }, -}; - -STDDIPINFO(Drv) - -static struct BurnDIPInfo GalagamwDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0x80, NULL }, - {0x0d, 0xff, 0xff, 0xf7, NULL }, - {0x0e, 0xff, 0xff, 0x97, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x80, 0x80, "Off" }, - {0x0c, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "2 Credits Game" }, - {0x0d, 0x01, 0x01, 0x00, "1 Player" }, - {0x0d, 0x01, 0x01, 0x01, "2 Players" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0d, 0x01, 0x06, 0x06, "Easy" }, - {0x0d, 0x01, 0x06, 0x00, "Medium" }, - {0x0d, 0x01, 0x06, 0x02, "Hard" }, - {0x0d, 0x01, 0x06, 0x04, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x08, 0x08, "Off" }, - {0x0d, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x0d, 0x01, 0x10, 0x10, "Off" }, - {0x0d, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Rack Test" }, - {0x0d, 0x01, 0x20, 0x20, "Off" }, - {0x0d, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x80, 0x80, "Upright" }, - {0x0d, 0x01, 0x80, 0x00, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x0e, 0x01, 0x07, 0x04, "4 Coins 1 Play" }, - {0x0e, 0x01, 0x07, 0x02, "3 Coins 1 Play" }, - {0x0e, 0x01, 0x07, 0x06, "2 Coins 1 Play" }, - {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x0e, 0x01, 0x07, 0x01, "2 Coins 3 Plays" }, - {0x0e, 0x01, 0x07, 0x03, "1 Coin 2 Plays" }, - {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x0e, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x0e, 0x01, 0x38, 0x20, "20k 60k 60k" }, - {0x0e, 0x01, 0x38, 0x18, "20k 60k" }, - {0x0e, 0x01, 0x38, 0x10, "20k 70k 70k" }, - {0x0e, 0x01, 0x38, 0x30, "20k 80k 80k" }, - {0x0e, 0x01, 0x38, 0x38, "30k 80k" }, - {0x0e, 0x01, 0x38, 0x08, "30k 100k 100k" }, - {0x0e, 0x01, 0x38, 0x28, "30k 120k 120k" }, - {0x0e, 0x01, 0x38, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0xc0, 0x00, "2" }, - {0x0e, 0x01, 0xc0, 0x80, "3" }, - {0x0e, 0x01, 0xc0, 0x40, "4" }, - {0x0e, 0x01, 0xc0, 0xc0, "5" }, -}; - -STDDIPINFO(Galagamw) - -static struct BurnRomInfo DrvRomDesc[] = { - { "gg1_1b.3p", 0x01000, 0xab036c9f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "gg1_2b.3m", 0x01000, 0xd9232240, BRF_ESS | BRF_PRG }, // 1 - { "gg1_3.2m", 0x01000, 0x753ce503, BRF_ESS | BRF_PRG }, // 2 - { "gg1_4b.2l", 0x01000, 0x499fcc76, BRF_ESS | BRF_PRG }, // 3 - - { "gg1_5b.3f", 0x01000, 0xbb5caae3, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code - - { "gg1_7b.2c", 0x01000, 0xd016686b, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code - - { "gg1_9.4l", 0x01000, 0x58b2f47c, BRF_GRA }, // 6 Characters - - { "gg1_11.4d", 0x01000, 0xad447c80, BRF_GRA }, // 7 Sprites - { "gg1_10.4f", 0x01000, 0xdd6f1afc, BRF_GRA }, // 8 - - { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 9 PROMs - { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 10 - { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 11 - { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 12 - { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 13 -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo GalagaoRomDesc[] = { - { "gg1-1.3p", 0x01000, 0xa3a0f743, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "gg1-2.3m", 0x01000, 0x43bb0d5c, BRF_ESS | BRF_PRG }, // 1 - { "gg1-3.2m", 0x01000, 0x753ce503, BRF_ESS | BRF_PRG }, // 2 - { "gg1-4.2l", 0x01000, 0x83874442, BRF_ESS | BRF_PRG }, // 3 - - { "gg1-5.3f", 0x01000, 0x3102fccd, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code - - { "gg1-7.2c", 0x01000, 0x8995088d, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code - - { "gg1-9.4l", 0x01000, 0x58b2f47c, BRF_GRA }, // 6 Characters - - { "gg1-11.4d", 0x01000, 0xad447c80, BRF_GRA }, // 7 Sprites - { "gg1-10.4f", 0x01000, 0xdd6f1afc, BRF_GRA }, // 8 - - { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 9 PROMs - { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 10 - { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 11 - { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 12 - { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 13 -}; - -STD_ROM_PICK(Galagao) -STD_ROM_FN(Galagao) - -static struct BurnRomInfo GalagamwRomDesc[] = { - { "3200a.bin", 0x01000, 0x3ef0b053, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "3300b.bin", 0x01000, 0x1b280831, BRF_ESS | BRF_PRG }, // 1 - { "3400c.bin", 0x01000, 0x16233d33, BRF_ESS | BRF_PRG }, // 2 - { "3500d.bin", 0x01000, 0x0aaf5c23, BRF_ESS | BRF_PRG }, // 3 - - { "3600e.bin", 0x01000, 0xbc556e76, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code - - { "3700g.bin", 0x01000, 0xb07f0aa4, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code - - { "2600j.bin", 0x01000, 0x58b2f47c, BRF_GRA }, // 6 Characters - - { "2800l.bin", 0x01000, 0xad447c80, BRF_GRA }, // 7 Sprites - { "2700k.bin", 0x01000, 0xdd6f1afc, BRF_GRA }, // 8 - - { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 9 PROMs - { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 10 - { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 11 - { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 12 - { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 13 -}; - -STD_ROM_PICK(Galagamw) -STD_ROM_FN(Galagamw) - -static struct BurnRomInfo GalagamfRomDesc[] = { - { "3200a.bin", 0x01000, 0x3ef0b053, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "3300b.bin", 0x01000, 0x1b280831, BRF_ESS | BRF_PRG }, // 1 - { "3400c.bin", 0x01000, 0x16233d33, BRF_ESS | BRF_PRG }, // 2 - { "3500d.bin", 0x01000, 0x0aaf5c23, BRF_ESS | BRF_PRG }, // 3 - - { "3600fast.bin", 0x01000, 0x23d586e5, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code - - { "3700g.bin", 0x01000, 0xb07f0aa4, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code - - { "2600j.bin", 0x01000, 0x58b2f47c, BRF_GRA }, // 6 Characters - - { "2800l.bin", 0x01000, 0xad447c80, BRF_GRA }, // 7 Sprites - { "2700k.bin", 0x01000, 0xdd6f1afc, BRF_GRA }, // 8 - - { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 9 PROMs - { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 10 - { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 11 - { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 12 - { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 13 -}; - -STD_ROM_PICK(Galagamf) -STD_ROM_FN(Galagamf) - -static struct BurnRomInfo GalagamkRomDesc[] = { - { "mk2-1", 0x01000, 0x23cea1e2, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "mk2-2", 0x01000, 0x89695b1a, BRF_ESS | BRF_PRG }, // 1 - { "3400c.bin", 0x01000, 0x16233d33, BRF_ESS | BRF_PRG }, // 2 - { "mk2-4", 0x01000, 0x24b767f5, BRF_ESS | BRF_PRG }, // 3 - - { "gg1-5.3f", 0x01000, 0x3102fccd, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code - - { "gg1-7b.2c", 0x01000, 0xd016686b, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code - - { "gg1-9.4l", 0x01000, 0x58b2f47c, BRF_GRA }, // 6 Characters - - { "gg1-11.4d", 0x01000, 0xad447c80, BRF_GRA }, // 7 Sprites - { "gg1-10.4f", 0x01000, 0xdd6f1afc, BRF_GRA }, // 8 - - { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 9 PROMs - { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 10 - { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 11 - { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 12 - { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 13 -}; - -STD_ROM_PICK(Galagamk) -STD_ROM_FN(Galagamk) - -static struct BurnRomInfo GallagRomDesc[] = { - { "gallag.1", 0x01000, 0xa3a0f743, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "gallag.2", 0x01000, 0x5eda60a7, BRF_ESS | BRF_PRG }, // 1 - { "gallag.3", 0x01000, 0x753ce503, BRF_ESS | BRF_PRG }, // 2 - { "gallag.4", 0x01000, 0x83874442, BRF_ESS | BRF_PRG }, // 3 - - { "gallag.5", 0x01000, 0x3102fccd, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code - - { "gallag.7", 0x01000, 0x8995088d, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code - - { "gallag.6", 0x01000, 0x001b70bc, BRF_ESS | BRF_PRG }, // 6 Z80 #4 Program Code - - { "gallag.8", 0x01000, 0x169a98a4, BRF_GRA }, // 7 Characters - - { "gallag.a", 0x01000, 0xad447c80, BRF_GRA }, // 8 Sprites - { "gallag.9", 0x01000, 0xdd6f1afc, BRF_GRA }, // 9 - - { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 10 PROMs - { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 11 - { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 12 - { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 13 - { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 14 -}; - -STD_ROM_PICK(Gallag) -STD_ROM_FN(Gallag) - -static struct BurnSampleInfo GalagaSampleDesc[] = { -#if !defined (ROM_VERIFY) - { "bang.wav", SAMPLE_NOLOOP }, - { "bang.wav", SAMPLE_NOLOOP }, -#endif - { "", 0 } -}; - -STD_SAMPLE_PICK(Galaga) -STD_SAMPLE_FN(Galaga) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom1 = Next; Next += 0x04000; - DrvZ80Rom2 = Next; Next += 0x04000; - DrvZ80Rom3 = Next; Next += 0x04000; - DrvPromPalette = Next; Next += 0x00020; - DrvPromCharLookup = Next; Next += 0x00100; - DrvPromSpriteLookup = Next; Next += 0x00100; - NamcoSoundProm = Next; Next += 0x00100; - - RamStart = Next; - - DrvVideoRam = Next; Next += 0x00800; - DrvSharedRam1 = Next; Next += 0x00400; - DrvSharedRam1 = Next; Next += 0x04000; - DrvSharedRam2 = Next; Next += 0x00400; - DrvSharedRam3 = Next; Next += 0x00400; - - RamEnd = Next; - - DrvChars = Next; Next += 0x100 * 8 * 8; - DrvSprites = Next; Next += 0x080 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 576 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - for (INT32 i = 0; i < 3; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - BurnSampleReset(); - - DrvCPU1FireIRQ = 0; - DrvCPU2FireIRQ = 0; - DrvCPU3FireIRQ = 0; - DrvCPU2Halt = 0; - DrvCPU3Halt = 0; - DrvFlipScreen = 0; - for (INT32 i = 0; i < 6; i++) { - DrvStarControl[i] = 0; - } - DrvStarScrollX = 0; - DrvStarScrollY = 0; - - IOChipCustomCommand = 0; - IOChipCPU1FireIRQ = 0; - IOChipMode = 0; - IOChipCredits = 0; - IOChipCoinPerCredit = 0; - IOChipCreditPerCoin = 0; - for (INT32 i = 0; i < 16; i++) { - IOChipCustom[i] = 0; - } - - return 0; -} - -static void Namco54XXWrite(INT32 Data) -{ - static INT32 Fetch; - static INT32 FetchMode; - static UINT8 Config1[4], Config2[4], Config3[5]; - - if (Fetch) { - switch (FetchMode) { - default: - case 1: - Config1[4 - (Fetch--)] = Data; - break; - - case 2: - Config2[4 - (Fetch--)] = Data; - break; - - case 3: - Config3[5 - (Fetch--)] = Data; - break; - } - } else { - switch (Data & 0xf0) { - case 0x00: // nop - break; - - case 0x10: // output sound on pins 4-7 only - if (memcmp(Config1,"\x40\x00\x02\xdf",4) == 0) - // bosco - // galaga - // xevious - BurnSamplePlay(0); -// else if (memcmp(Config1,"\x10\x00\x80\xff",4) == 0) - // xevious -// sample_start(0, 1, 0); -// else if (memcmp(Config1,"\x80\x80\x01\xff",4) == 0) - // xevious -// sample_start(0, 2, 0); - break; - - case 0x20: // output sound on pins 8-11 only -// if (memcmp(Config2,"\x40\x40\x01\xff",4) == 0) - // xevious -// sample_start(1, 3, 0); -// BurnSamplePlay(1); - /*else*/ if (memcmp(Config2,"\x30\x30\x03\xdf",4) == 0) - // bosco - // galaga - BurnSamplePlay(1); -// else if (memcmp(Config2,"\x60\x30\x03\x66",4) == 0) - // polepos -// sample_start( 0, 0, 0 ); - break; - - case 0x30: - Fetch = 4; - FetchMode = 1; - break; - - case 0x40: - Fetch = 4; - FetchMode = 2; - break; - - case 0x50: // output sound on pins 17-20 only -// if (memcmp(Config3,"\x08\x04\x21\x00\xf1",5) == 0) - // bosco -// sample_start(2, 2, 0); - break; - - case 0x60: - Fetch = 5; - FetchMode = 3; - break; - - case 0x70: - // polepos - /* 0x7n = Screech sound. n = pitch (if 0 then no sound) */ - /* followed by 0x60 command? */ - if (( Data & 0x0f ) == 0) { -// if (sample_playing(1)) -// sample_stop(1); - } else { -// INT32 freq = (INT32)( ( 44100.0f / 10.0f ) * (float)(Data & 0x0f) ); - -// if (!sample_playing(1)) -// sample_start(1, 1, 1); -// sample_set_freq(1, freq); - } - break; - } - } -} - -UINT8 __fastcall GalagaZ80ProgRead(UINT16 a) -{ - switch (a) { - case 0x6800: - case 0x6801: - case 0x6802: - case 0x6803: - case 0x6804: - case 0x6805: - case 0x6806: - case 0x6807: { - INT32 Offset = a - 0x6800; - INT32 Bit0 = (DrvDip[2] >> Offset) & 0x01; - INT32 Bit1 = (DrvDip[1] >> Offset) & 0x01; - - return Bit0 | (Bit1 << 1); - } - - case 0x7000: - case 0x7001: - case 0x7002: - case 0x7003: - case 0x7004: - case 0x7005: - case 0x7006: - case 0x7007: - case 0x7008: - case 0x7009: - case 0x700a: - case 0x700b: - case 0x700c: - case 0x700d: - case 0x700e: - case 0x700f: { - INT32 Offset = a - 0x7000; - - switch (IOChipCustomCommand) { - case 0x71: - case 0xb1: { - if (Offset == 0) { - if (IOChipMode) { - return DrvInput[0] | DrvDip[0]; - } else { - UINT8 In; - static UINT8 CoinInserted; - - In = DrvInput[0] | DrvDip[0]; - if (In != PrevInValue) { - if (IOChipCoinPerCredit > 0) { - if ((In & 0x70) != 0x70 && IOChipCredits < 99) { - CoinInserted++; - if (CoinInserted >= IOChipCoinPerCredit) { - IOChipCredits += IOChipCreditPerCoin; - CoinInserted = 0; - } - } - } else { - IOChipCredits = 2; - } - - if ((In & 0x04) == 0) { - if (IOChipCredits >= 1) IOChipCredits--; - } - - if ((In & 0x08) == 0) { - if (IOChipCredits >= 2) IOChipCredits -= 2; - } - } - - PrevInValue = In; - - return (IOChipCredits / 10) * 16 + IOChipCredits % 10; - } - } - - if (Offset == 1) return DrvInput[1]; - if (Offset == 2) return DrvInput[2]; - } - } - - return 0xff; - } - - case 0x7100: { - return IOChipCustomCommand; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #%i Read %04x\n"), ZetGetActive(), a); - } - } - - return 0; -} - -void __fastcall GalagaZ80ProgWrite(UINT16 a, UINT8 d) -{ - if (a >= 0x6800 && a <= 0x681f) { NamcoSoundWrite(a - 0x6800, d); return; } - - switch (a) { - case 0x6820: { - DrvCPU1FireIRQ = d & 0x01; - if (!DrvCPU1FireIRQ) { - - } - return; - } - - case 0x6821: { - DrvCPU2FireIRQ = d & 0x01; - if (!DrvCPU2FireIRQ) { - - } - return; - } - - case 0x6822: { - DrvCPU3FireIRQ = !(d & 0x01); - return; - } - - case 0x6823: { - if (!(d & 0x01)) { - INT32 nActive = ZetGetActive(); - ZetClose(); - ZetOpen(1); - ZetReset(); - ZetClose(); - ZetOpen(2); - ZetReset(); - ZetClose(); - ZetOpen(nActive); - DrvCPU2Halt = 1; - DrvCPU3Halt = 1; - return; - } else { - DrvCPU2Halt = 0; - DrvCPU3Halt = 0; - } - } - - case 0x6830: { - // watchdog write - return; - } - - case 0x7000: - case 0x7001: - case 0x7002: - case 0x7003: - case 0x7004: - case 0x7005: - case 0x7006: - case 0x7007: - case 0x7008: - case 0x7009: - case 0x700a: - case 0x700b: - case 0x700c: - case 0x700d: - case 0x700e: - case 0x700f: { - INT32 Offset = a - 0x7000; - IOChipCustom[Offset] = d; - Namco54XXWrite(d); - - switch (IOChipCustomCommand) { - case 0xe1: { - if (Offset == 7) { - IOChipCoinPerCredit = IOChipCustom[1]; - IOChipCreditPerCoin = IOChipCustom[2]; - } - break; - } - } - - return; - } - - case 0x7100: { - IOChipCustomCommand = d; - IOChipCPU1FireIRQ = 1; - - switch (IOChipCustomCommand) { - case 0x10: { - IOChipCPU1FireIRQ = 0; - return; - } - - case 0xa1: { - IOChipMode = 1; - return; - } - - case 0xe1: { - IOChipCredits = 0; - IOChipMode = 0; - return; - } - } - - return; - } - - case 0xa000: - case 0xa001: - case 0xa002: - case 0xa003: - case 0xa004: - case 0xa005: - case 0xa006: { - DrvStarControl[a - 0xa000] = d & 0x01; - return; - } - - case 0xa007: { - DrvFlipScreen = d & 0x01; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #%i Write %04x, %02x\n"), ZetGetActive(), a, d); - } - } -} - -static INT32 CharPlaneOffsets[2] = { 0, 4 }; -static INT32 CharXOffsets[8] = { 64, 65, 66, 67, 0, 1, 2, 3 }; -static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 SpritePlaneOffsets[2] = { 0, 4 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 64, 65, 66, 67, 128, 129, 130, 131, 192, 193, 194, 195 }; -static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 256, 264, 272, 280, 288, 296, 304, 312 }; - -static void MachineInit() -{ - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(GalagaZ80ProgRead); - ZetSetWriteHandler(GalagaZ80ProgWrite); - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom1); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom1); - ZetMapArea(0x8000, 0x87ff, 0, DrvVideoRam); - ZetMapArea(0x8000, 0x87ff, 1, DrvVideoRam); - ZetMapArea(0x8000, 0x87ff, 2, DrvVideoRam); - ZetMapArea(0x8800, 0x8bff, 0, DrvSharedRam1); - ZetMapArea(0x8800, 0x8bff, 1, DrvSharedRam1); - ZetMapArea(0x8800, 0x8bff, 2, DrvSharedRam1); - ZetMapArea(0x9000, 0x93ff, 0, DrvSharedRam2); - ZetMapArea(0x9000, 0x93ff, 1, DrvSharedRam2); - ZetMapArea(0x9000, 0x93ff, 2, DrvSharedRam2); - ZetMapArea(0x9800, 0x9bff, 0, DrvSharedRam3); - ZetMapArea(0x9800, 0x9bff, 1, DrvSharedRam3); - ZetMapArea(0x9800, 0x9bff, 2, DrvSharedRam3); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(GalagaZ80ProgRead); - ZetSetWriteHandler(GalagaZ80ProgWrite); - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom2); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom2); - ZetMapArea(0x8000, 0x87ff, 0, DrvVideoRam); - ZetMapArea(0x8000, 0x87ff, 1, DrvVideoRam); - ZetMapArea(0x8000, 0x87ff, 2, DrvVideoRam); - ZetMapArea(0x8800, 0x8bff, 0, DrvSharedRam1); - ZetMapArea(0x8800, 0x8bff, 1, DrvSharedRam1); - ZetMapArea(0x8800, 0x8bff, 2, DrvSharedRam1); - ZetMapArea(0x9000, 0x93ff, 0, DrvSharedRam2); - ZetMapArea(0x9000, 0x93ff, 1, DrvSharedRam2); - ZetMapArea(0x9000, 0x93ff, 2, DrvSharedRam2); - ZetMapArea(0x9800, 0x9bff, 0, DrvSharedRam3); - ZetMapArea(0x9800, 0x9bff, 1, DrvSharedRam3); - ZetMapArea(0x9800, 0x9bff, 2, DrvSharedRam3); - ZetMemEnd(); - ZetClose(); - - ZetInit(2); - ZetOpen(2); - ZetSetReadHandler(GalagaZ80ProgRead); - ZetSetWriteHandler(GalagaZ80ProgWrite); - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom3); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom3); - ZetMapArea(0x8000, 0x87ff, 0, DrvVideoRam); - ZetMapArea(0x8000, 0x87ff, 1, DrvVideoRam); - ZetMapArea(0x8000, 0x87ff, 2, DrvVideoRam); - ZetMapArea(0x8800, 0x8bff, 0, DrvSharedRam1); - ZetMapArea(0x8800, 0x8bff, 1, DrvSharedRam1); - ZetMapArea(0x8800, 0x8bff, 2, DrvSharedRam1); - ZetMapArea(0x9000, 0x93ff, 0, DrvSharedRam2); - ZetMapArea(0x9000, 0x93ff, 1, DrvSharedRam2); - ZetMapArea(0x9000, 0x93ff, 2, DrvSharedRam2); - ZetMapArea(0x9800, 0x9bff, 0, DrvSharedRam3); - ZetMapArea(0x9800, 0x9bff, 1, DrvSharedRam3); - ZetMapArea(0x9800, 0x9bff, 2, DrvSharedRam3); - ZetMemEnd(); - ZetClose(); - - NamcoSoundInit(18432000 / 6 / 32, 3); - NacmoSoundSetAllRoutes(0.90 * 10.0 / 16.0, BURN_SND_ROUTE_BOTH); - BurnSampleInit(0); - BurnSampleSetAllRoutesAllSamples(0.80, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); -} - -static INT32 DrvInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x02000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x01000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x02000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x03000, 3, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load Z80 #3 Program Roms - nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 5, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x02000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x01000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x80, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load the PROMs - nRet = BurnLoadRom(DrvPromPalette, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromCharLookup, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromSpriteLookup, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(NamcoSoundProm, 12, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - MachineInit(); - - return 0; -} - -static INT32 GallagInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x02000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x01000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x02000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x03000, 3, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load Z80 #3 Program Roms - nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 5, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x02000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x01000, 9, 1); if (nRet != 0) return 1; - GfxDecode(0x80, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load the PROMs - nRet = BurnLoadRom(DrvPromPalette, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromCharLookup, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromSpriteLookup, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(NamcoSoundProm, 13, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - MachineInit(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - NamcoSoundExit(); - BurnSampleExit(); - ZetExit(); - - BurnFree(Mem); - - DrvCPU1FireIRQ = 0; - DrvCPU2FireIRQ = 0; - DrvCPU3FireIRQ = 0; - DrvCPU2Halt = 0; - DrvCPU3Halt = 0; - DrvFlipScreen = 0; - for (INT32 i = 0; i < 6; i++) { - DrvStarControl[i] = 0; - } - DrvStarScrollX = 0; - DrvStarScrollY = 0; - - IOChipCustomCommand = 0; - IOChipCPU1FireIRQ = 0; - IOChipMode = 0; - IOChipCredits = 0; - IOChipCoinPerCredit = 0; - IOChipCreditPerCoin = 0; - for (INT32 i = 0; i < 16; i++) { - IOChipCustom[i] = 0; - } - - return 0; -} - -static void DrvCalcPalette() -{ - INT32 i; - UINT32 Palette[96]; - - for (i = 0; i < 32; i++) { - INT32 bit0, bit1, bit2, r, g, b; - - bit0 = (DrvPromPalette[i] >> 0) & 0x01; - bit1 = (DrvPromPalette[i] >> 1) & 0x01; - bit2 = (DrvPromPalette[i] >> 2) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - bit0 = (DrvPromPalette[i] >> 3) & 0x01; - bit1 = (DrvPromPalette[i] >> 4) & 0x01; - bit2 = (DrvPromPalette[i] >> 5) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - bit0 = 0; - bit1 = (DrvPromPalette[i] >> 6) & 0x01; - bit2 = (DrvPromPalette[i] >> 7) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - Palette[i] = BurnHighCol(r, g, b, 0); - } - - for (i = 0; i < 64; i++) { - INT32 bits, r, g, b; - static const INT32 map[4] = { 0x00, 0x47, 0x97, 0xde }; - - bits = (i >> 0) & 0x03; - r = map[bits]; - bits = (i >> 2) & 0x03; - g = map[bits]; - bits = (i >> 4) & 0x03; - b = map[bits]; - - Palette[32 + i] = BurnHighCol(r, g, b, 0); - } - - for (i = 0; i < 256; i++) { - DrvPalette[i] = Palette[((DrvPromCharLookup[i]) & 0x0f) + 0x10]; - } - - for (i = 0; i < 256; i++) { - DrvPalette[256 + i] = Palette[DrvPromSpriteLookup[i] & 0x0f]; - } - - for (i = 0; i < 64; i++) { - DrvPalette[512 + i] = Palette[32 + i]; - } -} - -struct Star { - UINT16 x, y; - UINT8 Colour, Set; -}; - -const struct Star StarSeedTab[252] = { - // set 0 - {0x0085, 0x0006, 0x35, 0x00}, - {0x008F, 0x0008, 0x30, 0x00}, - {0x00E5, 0x001B, 0x07, 0x00}, - {0x0022, 0x001C, 0x31, 0x00}, - {0x00E5, 0x0025, 0x1D, 0x00}, - {0x0015, 0x0026, 0x29, 0x00}, - {0x0080, 0x002D, 0x3B, 0x00}, - {0x0097, 0x002E, 0x1C, 0x00}, - {0x00BA, 0x003B, 0x05, 0x00}, - {0x0036, 0x003D, 0x36, 0x00}, - {0x0057, 0x0044, 0x09, 0x00}, - {0x00CF, 0x0044, 0x3D, 0x00}, - {0x0061, 0x004E, 0x27, 0x00}, - {0x0087, 0x0064, 0x1A, 0x00}, - {0x00D6, 0x0064, 0x17, 0x00}, - {0x000B, 0x006C, 0x3C, 0x00}, - {0x0006, 0x006D, 0x24, 0x00}, - {0x0018, 0x006E, 0x3A, 0x00}, - {0x00A9, 0x0079, 0x23, 0x00}, - {0x008A, 0x007B, 0x11, 0x00}, - {0x00D6, 0x0080, 0x0C, 0x00}, - {0x0067, 0x0082, 0x3F, 0x00}, - {0x0039, 0x0083, 0x38, 0x00}, - {0x0072, 0x0083, 0x14, 0x00}, - {0x00EC, 0x0084, 0x16, 0x00}, - {0x008E, 0x0085, 0x10, 0x00}, - {0x0020, 0x0088, 0x25, 0x00}, - {0x0095, 0x008A, 0x0F, 0x00}, - {0x000E, 0x008D, 0x00, 0x00}, - {0x0006, 0x0091, 0x2E, 0x00}, - {0x0007, 0x0094, 0x0D, 0x00}, - {0x00AE, 0x0097, 0x0B, 0x00}, - {0x0000, 0x0098, 0x2D, 0x00}, - {0x0086, 0x009B, 0x01, 0x00}, - {0x0058, 0x00A1, 0x34, 0x00}, - {0x00FE, 0x00A1, 0x3E, 0x00}, - {0x00A2, 0x00A8, 0x1F, 0x00}, - {0x0041, 0x00AA, 0x0A, 0x00}, - {0x003F, 0x00AC, 0x32, 0x00}, - {0x00DE, 0x00AC, 0x03, 0x00}, - {0x00D4, 0x00B9, 0x26, 0x00}, - {0x006D, 0x00BB, 0x1B, 0x00}, - {0x0062, 0x00BD, 0x39, 0x00}, - {0x00C9, 0x00BE, 0x18, 0x00}, - {0x006C, 0x00C1, 0x04, 0x00}, - {0x0059, 0x00C3, 0x21, 0x00}, - {0x0060, 0x00CC, 0x0E, 0x00}, - {0x0091, 0x00CC, 0x12, 0x00}, - {0x003F, 0x00CF, 0x06, 0x00}, - {0x00F7, 0x00CF, 0x22, 0x00}, - {0x0044, 0x00D0, 0x33, 0x00}, - {0x0034, 0x00D2, 0x08, 0x00}, - {0x00D3, 0x00D9, 0x20, 0x00}, - {0x0071, 0x00DD, 0x37, 0x00}, - {0x0073, 0x00E1, 0x2C, 0x00}, - {0x00B9, 0x00E3, 0x2F, 0x00}, - {0x00A9, 0x00E4, 0x13, 0x00}, - {0x00D3, 0x00E7, 0x19, 0x00}, - {0x0037, 0x00ED, 0x02, 0x00}, - {0x00BD, 0x00F4, 0x15, 0x00}, - {0x000F, 0x00F6, 0x28, 0x00}, - {0x004F, 0x00F7, 0x2B, 0x00}, - {0x00FB, 0x00FF, 0x2A, 0x00}, - - // set 1 - {0x00FE, 0x0004, 0x3D, 0x01}, - {0x00C4, 0x0006, 0x10, 0x01}, - {0x001E, 0x0007, 0x2D, 0x01}, - {0x0083, 0x000B, 0x1F, 0x01}, - {0x002E, 0x000D, 0x3C, 0x01}, - {0x001F, 0x000E, 0x00, 0x01}, - {0x00D8, 0x000E, 0x2C, 0x01}, - {0x0003, 0x000F, 0x17, 0x01}, - {0x0095, 0x0011, 0x3F, 0x01}, - {0x006A, 0x0017, 0x35, 0x01}, - {0x00CC, 0x0017, 0x02, 0x01}, - {0x0000, 0x0018, 0x32, 0x01}, - {0x0092, 0x001D, 0x36, 0x01}, - {0x00E3, 0x0021, 0x04, 0x01}, - {0x002F, 0x002D, 0x37, 0x01}, - {0x00F0, 0x002F, 0x0C, 0x01}, - {0x009B, 0x003E, 0x06, 0x01}, - {0x00A4, 0x004C, 0x07, 0x01}, - {0x00EA, 0x004D, 0x13, 0x01}, - {0x0084, 0x004E, 0x21, 0x01}, - {0x0033, 0x0052, 0x0F, 0x01}, - {0x0070, 0x0053, 0x0E, 0x01}, - {0x0006, 0x0059, 0x08, 0x01}, - {0x0081, 0x0060, 0x28, 0x01}, - {0x0037, 0x0061, 0x29, 0x01}, - {0x008F, 0x0067, 0x2F, 0x01}, - {0x001B, 0x006A, 0x1D, 0x01}, - {0x00BF, 0x007C, 0x12, 0x01}, - {0x0051, 0x007F, 0x31, 0x01}, - {0x0061, 0x0086, 0x25, 0x01}, - {0x006A, 0x008F, 0x0D, 0x01}, - {0x006A, 0x0091, 0x19, 0x01}, - {0x0090, 0x0092, 0x05, 0x01}, - {0x003B, 0x0096, 0x24, 0x01}, - {0x008C, 0x0097, 0x0A, 0x01}, - {0x0006, 0x0099, 0x03, 0x01}, - {0x0038, 0x0099, 0x38, 0x01}, - {0x00A8, 0x0099, 0x18, 0x01}, - {0x0076, 0x00A6, 0x20, 0x01}, - {0x00AD, 0x00A6, 0x1C, 0x01}, - {0x00EC, 0x00A6, 0x1E, 0x01}, - {0x0086, 0x00AC, 0x15, 0x01}, - {0x0078, 0x00AF, 0x3E, 0x01}, - {0x007B, 0x00B3, 0x09, 0x01}, - {0x0027, 0x00B8, 0x39, 0x01}, - {0x0088, 0x00C2, 0x23, 0x01}, - {0x0044, 0x00C3, 0x3A, 0x01}, - {0x00CF, 0x00C5, 0x34, 0x01}, - {0x0035, 0x00C9, 0x30, 0x01}, - {0x006E, 0x00D1, 0x3B, 0x01}, - {0x00D6, 0x00D7, 0x16, 0x01}, - {0x003A, 0x00D9, 0x2B, 0x01}, - {0x00AB, 0x00E0, 0x11, 0x01}, - {0x00E0, 0x00E2, 0x1B, 0x01}, - {0x006F, 0x00E6, 0x0B, 0x01}, - {0x00B8, 0x00E8, 0x14, 0x01}, - {0x00D9, 0x00E8, 0x1A, 0x01}, - {0x00F9, 0x00E8, 0x22, 0x01}, - {0x0004, 0x00F1, 0x2E, 0x01}, - {0x0049, 0x00F8, 0x26, 0x01}, - {0x0010, 0x00F9, 0x01, 0x01}, - {0x0039, 0x00FB, 0x33, 0x01}, - {0x0028, 0x00FC, 0x27, 0x01}, - - // set 2 - {0x00FA, 0x0006, 0x19, 0x02}, - {0x00E4, 0x0007, 0x2D, 0x02}, - {0x0072, 0x000A, 0x03, 0x02}, - {0x0084, 0x001B, 0x00, 0x02}, - {0x00BA, 0x001D, 0x29, 0x02}, - {0x00E3, 0x0022, 0x04, 0x02}, - {0x00D1, 0x0026, 0x2A, 0x02}, - {0x0089, 0x0032, 0x30, 0x02}, - {0x005B, 0x0036, 0x27, 0x02}, - {0x0084, 0x003A, 0x36, 0x02}, - {0x0053, 0x003F, 0x0D, 0x02}, - {0x0008, 0x0040, 0x1D, 0x02}, - {0x0055, 0x0040, 0x1A, 0x02}, - {0x00AA, 0x0041, 0x31, 0x02}, - {0x00FB, 0x0041, 0x2B, 0x02}, - {0x00BC, 0x0046, 0x16, 0x02}, - {0x0093, 0x0052, 0x39, 0x02}, - {0x00B9, 0x0057, 0x10, 0x02}, - {0x0054, 0x0059, 0x28, 0x02}, - {0x00E6, 0x005A, 0x01, 0x02}, - {0x00A7, 0x005D, 0x1B, 0x02}, - {0x002D, 0x005E, 0x35, 0x02}, - {0x0014, 0x0062, 0x21, 0x02}, - {0x0069, 0x006D, 0x1F, 0x02}, - {0x00CE, 0x006F, 0x0B, 0x02}, - {0x00DF, 0x0075, 0x2F, 0x02}, - {0x00CB, 0x0077, 0x12, 0x02}, - {0x004E, 0x007C, 0x23, 0x02}, - {0x004A, 0x0084, 0x0F, 0x02}, - {0x0012, 0x0086, 0x25, 0x02}, - {0x0068, 0x008C, 0x32, 0x02}, - {0x0003, 0x0095, 0x20, 0x02}, - {0x000A, 0x009C, 0x17, 0x02}, - {0x005B, 0x00A3, 0x08, 0x02}, - {0x005F, 0x00A4, 0x3E, 0x02}, - {0x0072, 0x00A4, 0x2E, 0x02}, - {0x00CC, 0x00A6, 0x06, 0x02}, - {0x008A, 0x00AB, 0x0C, 0x02}, - {0x00E0, 0x00AD, 0x26, 0x02}, - {0x00F3, 0x00AF, 0x0A, 0x02}, - {0x0075, 0x00B4, 0x13, 0x02}, - {0x0068, 0x00B7, 0x11, 0x02}, - {0x006D, 0x00C2, 0x2C, 0x02}, - {0x0076, 0x00C3, 0x14, 0x02}, - {0x00CF, 0x00C4, 0x1E, 0x02}, - {0x0004, 0x00C5, 0x1C, 0x02}, - {0x0013, 0x00C6, 0x3F, 0x02}, - {0x00B9, 0x00C7, 0x3C, 0x02}, - {0x0005, 0x00D7, 0x34, 0x02}, - {0x0095, 0x00D7, 0x3A, 0x02}, - {0x00FC, 0x00D8, 0x02, 0x02}, - {0x00E7, 0x00DC, 0x09, 0x02}, - {0x001D, 0x00E1, 0x05, 0x02}, - {0x0005, 0x00E6, 0x33, 0x02}, - {0x001C, 0x00E9, 0x3B, 0x02}, - {0x00A2, 0x00ED, 0x37, 0x02}, - {0x0028, 0x00EE, 0x07, 0x02}, - {0x00DD, 0x00EF, 0x18, 0x02}, - {0x006D, 0x00F0, 0x38, 0x02}, - {0x00A1, 0x00F2, 0x0E, 0x02}, - {0x0074, 0x00F7, 0x3D, 0x02}, - {0x0069, 0x00F9, 0x22, 0x02}, - {0x003F, 0x00FF, 0x24, 0x02}, - - // set 3 - {0x0071, 0x0010, 0x34, 0x03}, - {0x00AF, 0x0011, 0x23, 0x03}, - {0x00A0, 0x0014, 0x26, 0x03}, - {0x0002, 0x0017, 0x02, 0x03}, - {0x004B, 0x0019, 0x31, 0x03}, - {0x0093, 0x001C, 0x0E, 0x03}, - {0x001B, 0x001E, 0x25, 0x03}, - {0x0032, 0x0020, 0x2E, 0x03}, - {0x00EE, 0x0020, 0x3A, 0x03}, - {0x0079, 0x0022, 0x2F, 0x03}, - {0x006C, 0x0023, 0x17, 0x03}, - {0x00BC, 0x0025, 0x11, 0x03}, - {0x0041, 0x0029, 0x30, 0x03}, - {0x001C, 0x002E, 0x32, 0x03}, - {0x00B9, 0x0031, 0x01, 0x03}, - {0x0083, 0x0032, 0x05, 0x03}, - {0x0095, 0x003A, 0x12, 0x03}, - {0x000D, 0x003F, 0x07, 0x03}, - {0x0020, 0x0041, 0x33, 0x03}, - {0x0092, 0x0045, 0x2C, 0x03}, - {0x00D4, 0x0047, 0x08, 0x03}, - {0x00A1, 0x004B, 0x2D, 0x03}, - {0x00D2, 0x004B, 0x3B, 0x03}, - {0x00D6, 0x0052, 0x24, 0x03}, - {0x009A, 0x005F, 0x1C, 0x03}, - {0x0016, 0x0060, 0x3D, 0x03}, - {0x001A, 0x0063, 0x1F, 0x03}, - {0x00CD, 0x0066, 0x28, 0x03}, - {0x00FF, 0x0067, 0x10, 0x03}, - {0x0035, 0x0069, 0x20, 0x03}, - {0x008F, 0x006C, 0x04, 0x03}, - {0x00CA, 0x006C, 0x2A, 0x03}, - {0x005A, 0x0074, 0x09, 0x03}, - {0x0060, 0x0078, 0x38, 0x03}, - {0x0072, 0x0079, 0x1E, 0x03}, - {0x0037, 0x007F, 0x29, 0x03}, - {0x0012, 0x0080, 0x14, 0x03}, - {0x0029, 0x0082, 0x2B, 0x03}, - {0x0084, 0x0098, 0x36, 0x03}, - {0x0032, 0x0099, 0x37, 0x03}, - {0x00BB, 0x00A0, 0x19, 0x03}, - {0x003E, 0x00A3, 0x3E, 0x03}, - {0x004A, 0x00A6, 0x1A, 0x03}, - {0x0029, 0x00A7, 0x21, 0x03}, - {0x009D, 0x00B7, 0x22, 0x03}, - {0x006C, 0x00B9, 0x15, 0x03}, - {0x000C, 0x00C0, 0x0A, 0x03}, - {0x00C2, 0x00C3, 0x0F, 0x03}, - {0x002F, 0x00C9, 0x0D, 0x03}, - {0x00D2, 0x00CE, 0x16, 0x03}, - {0x00F3, 0x00CE, 0x0B, 0x03}, - {0x0075, 0x00CF, 0x27, 0x03}, - {0x001A, 0x00D5, 0x35, 0x03}, - {0x0026, 0x00D6, 0x39, 0x03}, - {0x0080, 0x00DA, 0x3C, 0x03}, - {0x00A9, 0x00DD, 0x00, 0x03}, - {0x00BC, 0x00EB, 0x03, 0x03}, - {0x0032, 0x00EF, 0x1B, 0x03}, - {0x0067, 0x00F0, 0x3F, 0x03}, - {0x00EF, 0x00F1, 0x18, 0x03}, - {0x00A8, 0x00F3, 0x0C, 0x03}, - {0x00DE, 0x00F9, 0x1D, 0x03}, - {0x002C, 0x00FA, 0x13, 0x03} -}; - -static void DrvRenderStars() -{ - if (DrvStarControl[5] == 1) { - INT32 StarCounter; - INT32 SetA, SetB; - - SetA = DrvStarControl[3]; - SetB = DrvStarControl[4] | 0x02; - - for (StarCounter = 0; StarCounter < 252; StarCounter++) { - INT32 x, y; - - if ((SetA == StarSeedTab[StarCounter].Set) || (SetB == StarSeedTab[StarCounter].Set)) { - x = (StarSeedTab[StarCounter].x + DrvStarScrollX) % 256 + 16; - y = (112 + StarSeedTab[StarCounter].y + DrvStarScrollY) % 256; - - if (x >= 0 && x < 288 && y >= 0 && y < 224) { - pTransDraw[(y * nScreenWidth) + x] = StarSeedTab[StarCounter].Colour + 512; - } - } - - } - } -} - -static void DrvRenderTilemap() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex, Row, Col; - - for (mx = 0; mx < 28; mx++) { - for (my = 0; my < 36; my++) { - Row = mx + 2; - Col = my - 2; - if (Col & 0x20) { - TileIndex = Row + ((Col & 0x1f) << 5); - } else { - TileIndex = Col + (Row << 5); - } - - Code = DrvVideoRam[TileIndex + 0x000] & 0x7f; - Colour = DrvVideoRam[TileIndex + 0x400] & 0x3f; - - y = 8 * mx; - x = 8 * my; - - if (DrvFlipScreen) { - x = 280 - x; - y = 216 - y; - } - - if (x > 8 && x < 280 && y > 8 && y < 216) { - if (DrvFlipScreen) { - Render8x8Tile_FlipXY(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } else { - Render8x8Tile(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } - } else { - if (DrvFlipScreen) { - Render8x8Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } else { - Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } - } - } - } -} - -static void DrvRenderSprites() -{ - UINT8 *SpriteRam1 = DrvSharedRam1 + 0x380; - UINT8 *SpriteRam2 = DrvSharedRam2 + 0x380; - UINT8 *SpriteRam3 = DrvSharedRam3 + 0x380; - - for (INT32 Offset = 0; Offset < 0x80; Offset += 2) { - static const INT32 GfxOffset[2][2] = { - { 0, 1 }, - { 2, 3 } - }; - INT32 Sprite = SpriteRam1[Offset + 0] & 0x7f; - INT32 Colour = SpriteRam1[Offset + 1] & 0x3f; - INT32 sx = SpriteRam2[Offset + 1] - 40 + (0x100 * (SpriteRam3[Offset + 1] & 0x03)); - INT32 sy = 256 - SpriteRam2[Offset + 0] + 1; - INT32 xFlip = (SpriteRam3[Offset + 0] & 0x01); - INT32 yFlip = (SpriteRam3[Offset + 0] & 0x02) >> 1; - INT32 xSize = (SpriteRam3[Offset + 0] & 0x04) >> 2; - INT32 ySize = (SpriteRam3[Offset + 0] & 0x08) >> 3; - - sy -= 16 * ySize; - sy = (sy & 0xff) - 32; - - if (DrvFlipScreen) { - xFlip = !xFlip; - yFlip = !yFlip; - } - - for (INT32 y = 0; y <= ySize; y++) { - for (INT32 x = 0; x <= xSize; x++) { - INT32 Code = Sprite + GfxOffset[y ^ (ySize * yFlip)][x ^ (xSize * xFlip)]; - INT32 xPos = sx + 16 * x; - INT32 yPos = sy + 16 * y; - - if (xPos > 16 && xPos < 272 && yPos > 16 && yPos < 208) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); - } else { - Render16x16Tile_Mask(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); - } - } - } - } - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - DrvRenderTilemap(); - DrvRenderStars(); - DrvRenderSprites(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = nBurnSoundLen; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - INT32 nSoundBufferPos = 0; - - nCyclesTotal[0] = (18432000 / 6) / 60; - nCyclesTotal[1] = (18432000 / 6) / 60; - nCyclesTotal[2] = (18432000 / 6) / 60; - nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == (nInterleave - 1) && DrvCPU1FireIRQ) { - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - if ((i == 0 || i == (nInterleave / 3) || i == (nInterleave / 3 * 2)) && IOChipCPU1FireIRQ) { - ZetNmi(); - } - ZetClose(); - - if (!DrvCPU2Halt) { - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == (nInterleave - 1) && DrvCPU2FireIRQ) { - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - ZetClose(); - } - - if (!DrvCPU3Halt) { - nCurrentCPU = 2; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if ((i == (nInterleave / 2) || i == (nInterleave - 1)) && DrvCPU3FireIRQ) { - ZetNmi(); - } - ZetClose(); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - NamcoSoundUpdate(pSoundBuf, nSegmentLength); - BurnSampleRender(pSoundBuf, nSegmentLength); - } - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - NamcoSoundUpdate(pSoundBuf, nSegmentLength); - BurnSampleRender(pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) DrvDraw(); - - static const INT32 Speeds[8] = { -1, -2, -3, 0, 3, 2, 1, 0 }; - - DrvStarScrollX += Speeds[DrvStarControl[0] + (DrvStarControl[1] * 2) + (DrvStarControl[2] * 4)]; - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029698; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); // Scan Z80 - NamcoSoundScan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(DrvCPU1FireIRQ); - SCAN_VAR(DrvCPU2FireIRQ); - SCAN_VAR(DrvCPU3FireIRQ); - SCAN_VAR(DrvCPU2Halt); - SCAN_VAR(DrvCPU3Halt); - SCAN_VAR(DrvFlipScreen); - SCAN_VAR(DrvStarScrollX); - SCAN_VAR(DrvStarScrollY); - SCAN_VAR(IOChipCustomCommand); - SCAN_VAR(IOChipCPU1FireIRQ); - SCAN_VAR(IOChipMode); - SCAN_VAR(IOChipCredits); - SCAN_VAR(IOChipCoinPerCredit); - SCAN_VAR(IOChipCreditPerCoin); - SCAN_VAR(PrevInValue); - for (INT32 i = 0; i < 6; i++) { - SCAN_VAR(DrvStarControl[i]); - } - for (INT32 i = 0; i < 16; i++) { - SCAN_VAR(IOChipCustom[i]); - } - SCAN_VAR(DrvDip); - SCAN_VAR(DrvInput); - } - - return 0; -} - -struct BurnDriver BurnDrvGalaga = { - "galaga", NULL, NULL, "galaga", "1981", - "Galaga (Namco rev. B)\0", NULL, "Namco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, DrvRomInfo, DrvRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 576, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvGalagao = { - "galagao", "galaga", NULL, "galaga", "1981", - "Galaga (Namco)\0", NULL, "Namco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, GalagaoRomInfo, GalagaoRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 576, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvGalagamw = { - "galagamw", "galaga", NULL, "galaga", "1981", - "Galaga (Midway set 1)\0", NULL, "Namco (Midway License)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, GalagamwRomInfo, GalagamwRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, GalagamwDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 576, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvGalagamk = { - "galagamk", "galaga", NULL, "galaga", "1981", - "Galaga (Midway set 2)\0", NULL, "Namco (Midway License)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, GalagamkRomInfo, GalagamkRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 576, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvGalagamf = { - "galagamf", "galaga", NULL, "galaga", "1981", - "Galaga (Midway set 1 with fast shoot hack)\0", NULL, "Namco (Midway License)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, GalagamfRomInfo, GalagamfRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 576, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvGallag = { - "gallag", "galaga", NULL, "galaga", "1981", - "Gallag\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, GallagRomInfo, GallagRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, DrvDIPInfo, - GallagInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 576, 224, 288, 3, 4 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "namco_snd.h" +#include "samples.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[3] = {0, 0, 0}; +static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *DrvZ80Rom1 = NULL; +static UINT8 *DrvZ80Rom2 = NULL; +static UINT8 *DrvZ80Rom3 = NULL; +static UINT8 *DrvVideoRam = NULL; +static UINT8 *DrvSharedRam1 = NULL; +static UINT8 *DrvSharedRam2 = NULL; +static UINT8 *DrvSharedRam3 = NULL; +static UINT8 *DrvPromPalette = NULL; +static UINT8 *DrvPromCharLookup = NULL; +static UINT8 *DrvPromSpriteLookup = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT8 DrvCPU1FireIRQ; +static UINT8 DrvCPU2FireIRQ; +static UINT8 DrvCPU3FireIRQ; +static UINT8 DrvCPU2Halt; +static UINT8 DrvCPU3Halt; +static UINT8 DrvFlipScreen; +static UINT8 DrvStarControl[6]; +static UINT32 DrvStarScrollX; +static UINT32 DrvStarScrollY; + +static UINT8 IOChipCustomCommand; +static UINT8 IOChipCPU1FireIRQ; +static UINT8 IOChipMode; +static UINT8 IOChipCredits; +static UINT8 IOChipCoinPerCredit; +static UINT8 IOChipCreditPerCoin; +static UINT8 IOChipCustom[16]; +static UINT8 PrevInValue; + +static INT32 nCyclesDone[3], nCyclesTotal[3]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 3, "p2 start" }, + + {"Left" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + + {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = 0x7f; + DrvInput[1] = 0xff; + DrvInput[2] = 0xff; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] -= (DrvInputPort0[i] & 1) << i; + DrvInput[1] -= (DrvInputPort1[i] & 1) << i; + DrvInput[2] -= (DrvInputPort2[i] & 1) << i; + } +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x80, NULL }, + {0x0d, 0xff, 0xff, 0xf7, NULL }, + {0x0e, 0xff, 0xff, 0x97, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x80, 0x80, "Off" }, + {0x0c, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0d, 0x01, 0x03, 0x03, "Easy" }, + {0x0d, 0x01, 0x03, 0x00, "Medium" }, + {0x0d, 0x01, 0x03, 0x01, "Hard" }, + {0x0d, 0x01, 0x03, 0x02, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x08, 0x08, "Off" }, + {0x0d, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x0d, 0x01, 0x10, 0x10, "Off" }, + {0x0d, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Rack Test" }, + {0x0d, 0x01, 0x20, 0x20, "Off" }, + {0x0d, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x80, 0x80, "Upright" }, + {0x0d, 0x01, 0x80, 0x00, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x0e, 0x01, 0x07, 0x04, "4 Coins 1 Play" }, + {0x0e, 0x01, 0x07, 0x02, "3 Coins 1 Play" }, + {0x0e, 0x01, 0x07, 0x06, "2 Coins 1 Play" }, + {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x0e, 0x01, 0x07, 0x01, "2 Coins 3 Plays" }, + {0x0e, 0x01, 0x07, 0x03, "1 Coin 2 Plays" }, + {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x0e, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x0e, 0x01, 0x38, 0x20, "20k 60k 60k" }, + {0x0e, 0x01, 0x38, 0x18, "20k 60k" }, + {0x0e, 0x01, 0x38, 0x10, "20k 70k 70k" }, + {0x0e, 0x01, 0x38, 0x30, "20k 80k 80k" }, + {0x0e, 0x01, 0x38, 0x38, "30k 80k" }, + {0x0e, 0x01, 0x38, 0x08, "30k 100k 100k" }, + {0x0e, 0x01, 0x38, 0x28, "30k 120k 120k" }, + {0x0e, 0x01, 0x38, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0xc0, 0x00, "2" }, + {0x0e, 0x01, 0xc0, 0x80, "3" }, + {0x0e, 0x01, 0xc0, 0x40, "4" }, + {0x0e, 0x01, 0xc0, 0xc0, "5" }, +}; + +STDDIPINFO(Drv) + +static struct BurnDIPInfo GalagamwDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0x80, NULL }, + {0x0d, 0xff, 0xff, 0xf7, NULL }, + {0x0e, 0xff, 0xff, 0x97, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x80, 0x80, "Off" }, + {0x0c, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "2 Credits Game" }, + {0x0d, 0x01, 0x01, 0x00, "1 Player" }, + {0x0d, 0x01, 0x01, 0x01, "2 Players" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0d, 0x01, 0x06, 0x06, "Easy" }, + {0x0d, 0x01, 0x06, 0x00, "Medium" }, + {0x0d, 0x01, 0x06, 0x02, "Hard" }, + {0x0d, 0x01, 0x06, 0x04, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x08, 0x08, "Off" }, + {0x0d, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x0d, 0x01, 0x10, 0x10, "Off" }, + {0x0d, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Rack Test" }, + {0x0d, 0x01, 0x20, 0x20, "Off" }, + {0x0d, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x80, 0x80, "Upright" }, + {0x0d, 0x01, 0x80, 0x00, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x0e, 0x01, 0x07, 0x04, "4 Coins 1 Play" }, + {0x0e, 0x01, 0x07, 0x02, "3 Coins 1 Play" }, + {0x0e, 0x01, 0x07, 0x06, "2 Coins 1 Play" }, + {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x0e, 0x01, 0x07, 0x01, "2 Coins 3 Plays" }, + {0x0e, 0x01, 0x07, 0x03, "1 Coin 2 Plays" }, + {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x0e, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x0e, 0x01, 0x38, 0x20, "20k 60k 60k" }, + {0x0e, 0x01, 0x38, 0x18, "20k 60k" }, + {0x0e, 0x01, 0x38, 0x10, "20k 70k 70k" }, + {0x0e, 0x01, 0x38, 0x30, "20k 80k 80k" }, + {0x0e, 0x01, 0x38, 0x38, "30k 80k" }, + {0x0e, 0x01, 0x38, 0x08, "30k 100k 100k" }, + {0x0e, 0x01, 0x38, 0x28, "30k 120k 120k" }, + {0x0e, 0x01, 0x38, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0xc0, 0x00, "2" }, + {0x0e, 0x01, 0xc0, 0x80, "3" }, + {0x0e, 0x01, 0xc0, 0x40, "4" }, + {0x0e, 0x01, 0xc0, 0xc0, "5" }, +}; + +STDDIPINFO(Galagamw) + +static struct BurnRomInfo DrvRomDesc[] = { + { "gg1_1b.3p", 0x01000, 0xab036c9f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "gg1_2b.3m", 0x01000, 0xd9232240, BRF_ESS | BRF_PRG }, // 1 + { "gg1_3.2m", 0x01000, 0x753ce503, BRF_ESS | BRF_PRG }, // 2 + { "gg1_4b.2l", 0x01000, 0x499fcc76, BRF_ESS | BRF_PRG }, // 3 + + { "gg1_5b.3f", 0x01000, 0xbb5caae3, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code + + { "gg1_7b.2c", 0x01000, 0xd016686b, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code + + { "gg1_9.4l", 0x01000, 0x58b2f47c, BRF_GRA }, // 6 Characters + + { "gg1_11.4d", 0x01000, 0xad447c80, BRF_GRA }, // 7 Sprites + { "gg1_10.4f", 0x01000, 0xdd6f1afc, BRF_GRA }, // 8 + + { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 9 PROMs + { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 10 + { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 11 + { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 12 + { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 13 +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo GalagaoRomDesc[] = { + { "gg1-1.3p", 0x01000, 0xa3a0f743, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "gg1-2.3m", 0x01000, 0x43bb0d5c, BRF_ESS | BRF_PRG }, // 1 + { "gg1-3.2m", 0x01000, 0x753ce503, BRF_ESS | BRF_PRG }, // 2 + { "gg1-4.2l", 0x01000, 0x83874442, BRF_ESS | BRF_PRG }, // 3 + + { "gg1-5.3f", 0x01000, 0x3102fccd, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code + + { "gg1-7.2c", 0x01000, 0x8995088d, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code + + { "gg1-9.4l", 0x01000, 0x58b2f47c, BRF_GRA }, // 6 Characters + + { "gg1-11.4d", 0x01000, 0xad447c80, BRF_GRA }, // 7 Sprites + { "gg1-10.4f", 0x01000, 0xdd6f1afc, BRF_GRA }, // 8 + + { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 9 PROMs + { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 10 + { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 11 + { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 12 + { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 13 +}; + +STD_ROM_PICK(Galagao) +STD_ROM_FN(Galagao) + +static struct BurnRomInfo GalagamwRomDesc[] = { + { "3200a.bin", 0x01000, 0x3ef0b053, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "3300b.bin", 0x01000, 0x1b280831, BRF_ESS | BRF_PRG }, // 1 + { "3400c.bin", 0x01000, 0x16233d33, BRF_ESS | BRF_PRG }, // 2 + { "3500d.bin", 0x01000, 0x0aaf5c23, BRF_ESS | BRF_PRG }, // 3 + + { "3600e.bin", 0x01000, 0xbc556e76, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code + + { "3700g.bin", 0x01000, 0xb07f0aa4, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code + + { "2600j.bin", 0x01000, 0x58b2f47c, BRF_GRA }, // 6 Characters + + { "2800l.bin", 0x01000, 0xad447c80, BRF_GRA }, // 7 Sprites + { "2700k.bin", 0x01000, 0xdd6f1afc, BRF_GRA }, // 8 + + { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 9 PROMs + { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 10 + { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 11 + { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 12 + { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 13 +}; + +STD_ROM_PICK(Galagamw) +STD_ROM_FN(Galagamw) + +static struct BurnRomInfo GalagamfRomDesc[] = { + { "3200a.bin", 0x01000, 0x3ef0b053, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "3300b.bin", 0x01000, 0x1b280831, BRF_ESS | BRF_PRG }, // 1 + { "3400c.bin", 0x01000, 0x16233d33, BRF_ESS | BRF_PRG }, // 2 + { "3500d.bin", 0x01000, 0x0aaf5c23, BRF_ESS | BRF_PRG }, // 3 + + { "3600fast.bin", 0x01000, 0x23d586e5, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code + + { "3700g.bin", 0x01000, 0xb07f0aa4, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code + + { "2600j.bin", 0x01000, 0x58b2f47c, BRF_GRA }, // 6 Characters + + { "2800l.bin", 0x01000, 0xad447c80, BRF_GRA }, // 7 Sprites + { "2700k.bin", 0x01000, 0xdd6f1afc, BRF_GRA }, // 8 + + { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 9 PROMs + { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 10 + { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 11 + { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 12 + { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 13 +}; + +STD_ROM_PICK(Galagamf) +STD_ROM_FN(Galagamf) + +static struct BurnRomInfo GalagamkRomDesc[] = { + { "mk2-1", 0x01000, 0x23cea1e2, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "mk2-2", 0x01000, 0x89695b1a, BRF_ESS | BRF_PRG }, // 1 + { "3400c.bin", 0x01000, 0x16233d33, BRF_ESS | BRF_PRG }, // 2 + { "mk2-4", 0x01000, 0x24b767f5, BRF_ESS | BRF_PRG }, // 3 + + { "gg1-5.3f", 0x01000, 0x3102fccd, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code + + { "gg1-7b.2c", 0x01000, 0xd016686b, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code + + { "gg1-9.4l", 0x01000, 0x58b2f47c, BRF_GRA }, // 6 Characters + + { "gg1-11.4d", 0x01000, 0xad447c80, BRF_GRA }, // 7 Sprites + { "gg1-10.4f", 0x01000, 0xdd6f1afc, BRF_GRA }, // 8 + + { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 9 PROMs + { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 10 + { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 11 + { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 12 + { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 13 +}; + +STD_ROM_PICK(Galagamk) +STD_ROM_FN(Galagamk) + +static struct BurnRomInfo GallagRomDesc[] = { + { "gallag.1", 0x01000, 0xa3a0f743, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "gallag.2", 0x01000, 0x5eda60a7, BRF_ESS | BRF_PRG }, // 1 + { "gallag.3", 0x01000, 0x753ce503, BRF_ESS | BRF_PRG }, // 2 + { "gallag.4", 0x01000, 0x83874442, BRF_ESS | BRF_PRG }, // 3 + + { "gallag.5", 0x01000, 0x3102fccd, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code + + { "gallag.7", 0x01000, 0x8995088d, BRF_ESS | BRF_PRG }, // 5 Z80 #3 Program Code + + { "gallag.6", 0x01000, 0x001b70bc, BRF_ESS | BRF_PRG }, // 6 Z80 #4 Program Code + + { "gallag.8", 0x01000, 0x169a98a4, BRF_GRA }, // 7 Characters + + { "gallag.a", 0x01000, 0xad447c80, BRF_GRA }, // 8 Sprites + { "gallag.9", 0x01000, 0xdd6f1afc, BRF_GRA }, // 9 + + { "prom-5.5n", 0x00020, 0x54603c6b, BRF_GRA }, // 10 PROMs + { "prom-4.2n", 0x00100, 0x59b6edab, BRF_GRA }, // 11 + { "prom-3.1c", 0x00100, 0x4a04bb6b, BRF_GRA }, // 12 + { "prom-1.1d", 0x00100, 0x7a2815b4, BRF_GRA }, // 13 + { "prom-2.5c", 0x00100, 0x77245b66, BRF_GRA }, // 14 +}; + +STD_ROM_PICK(Gallag) +STD_ROM_FN(Gallag) + +static struct BurnSampleInfo GalagaSampleDesc[] = { +#if !defined (ROM_VERIFY) + { "bang.wav", SAMPLE_NOLOOP }, + { "bang.wav", SAMPLE_NOLOOP }, +#endif + { "", 0 } +}; + +STD_SAMPLE_PICK(Galaga) +STD_SAMPLE_FN(Galaga) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom1 = Next; Next += 0x04000; + DrvZ80Rom2 = Next; Next += 0x04000; + DrvZ80Rom3 = Next; Next += 0x04000; + DrvPromPalette = Next; Next += 0x00020; + DrvPromCharLookup = Next; Next += 0x00100; + DrvPromSpriteLookup = Next; Next += 0x00100; + NamcoSoundProm = Next; Next += 0x00100; + + RamStart = Next; + + DrvVideoRam = Next; Next += 0x00800; + DrvSharedRam1 = Next; Next += 0x00400; + DrvSharedRam1 = Next; Next += 0x04000; + DrvSharedRam2 = Next; Next += 0x00400; + DrvSharedRam3 = Next; Next += 0x00400; + + RamEnd = Next; + + DrvChars = Next; Next += 0x100 * 8 * 8; + DrvSprites = Next; Next += 0x080 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 576 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + for (INT32 i = 0; i < 3; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + BurnSampleReset(); + + DrvCPU1FireIRQ = 0; + DrvCPU2FireIRQ = 0; + DrvCPU3FireIRQ = 0; + DrvCPU2Halt = 0; + DrvCPU3Halt = 0; + DrvFlipScreen = 0; + for (INT32 i = 0; i < 6; i++) { + DrvStarControl[i] = 0; + } + DrvStarScrollX = 0; + DrvStarScrollY = 0; + + IOChipCustomCommand = 0; + IOChipCPU1FireIRQ = 0; + IOChipMode = 0; + IOChipCredits = 0; + IOChipCoinPerCredit = 0; + IOChipCreditPerCoin = 0; + for (INT32 i = 0; i < 16; i++) { + IOChipCustom[i] = 0; + } + + return 0; +} + +static void Namco54XXWrite(INT32 Data) +{ + static INT32 Fetch; + static INT32 FetchMode; + static UINT8 Config1[4], Config2[4], Config3[5]; + + if (Fetch) { + switch (FetchMode) { + default: + case 1: + Config1[4 - (Fetch--)] = Data; + break; + + case 2: + Config2[4 - (Fetch--)] = Data; + break; + + case 3: + Config3[5 - (Fetch--)] = Data; + break; + } + } else { + switch (Data & 0xf0) { + case 0x00: // nop + break; + + case 0x10: // output sound on pins 4-7 only + if (memcmp(Config1,"\x40\x00\x02\xdf",4) == 0) + // bosco + // galaga + // xevious + BurnSamplePlay(0); +// else if (memcmp(Config1,"\x10\x00\x80\xff",4) == 0) + // xevious +// sample_start(0, 1, 0); +// else if (memcmp(Config1,"\x80\x80\x01\xff",4) == 0) + // xevious +// sample_start(0, 2, 0); + break; + + case 0x20: // output sound on pins 8-11 only +// if (memcmp(Config2,"\x40\x40\x01\xff",4) == 0) + // xevious +// sample_start(1, 3, 0); +// BurnSamplePlay(1); + /*else*/ if (memcmp(Config2,"\x30\x30\x03\xdf",4) == 0) + // bosco + // galaga + BurnSamplePlay(1); +// else if (memcmp(Config2,"\x60\x30\x03\x66",4) == 0) + // polepos +// sample_start( 0, 0, 0 ); + break; + + case 0x30: + Fetch = 4; + FetchMode = 1; + break; + + case 0x40: + Fetch = 4; + FetchMode = 2; + break; + + case 0x50: // output sound on pins 17-20 only +// if (memcmp(Config3,"\x08\x04\x21\x00\xf1",5) == 0) + // bosco +// sample_start(2, 2, 0); + break; + + case 0x60: + Fetch = 5; + FetchMode = 3; + break; + + case 0x70: + // polepos + /* 0x7n = Screech sound. n = pitch (if 0 then no sound) */ + /* followed by 0x60 command? */ + if (( Data & 0x0f ) == 0) { +// if (sample_playing(1)) +// sample_stop(1); + } else { +// INT32 freq = (INT32)( ( 44100.0f / 10.0f ) * (float)(Data & 0x0f) ); + +// if (!sample_playing(1)) +// sample_start(1, 1, 1); +// sample_set_freq(1, freq); + } + break; + } + } +} + +UINT8 __fastcall GalagaZ80ProgRead(UINT16 a) +{ + switch (a) { + case 0x6800: + case 0x6801: + case 0x6802: + case 0x6803: + case 0x6804: + case 0x6805: + case 0x6806: + case 0x6807: { + INT32 Offset = a - 0x6800; + INT32 Bit0 = (DrvDip[2] >> Offset) & 0x01; + INT32 Bit1 = (DrvDip[1] >> Offset) & 0x01; + + return Bit0 | (Bit1 << 1); + } + + case 0x7000: + case 0x7001: + case 0x7002: + case 0x7003: + case 0x7004: + case 0x7005: + case 0x7006: + case 0x7007: + case 0x7008: + case 0x7009: + case 0x700a: + case 0x700b: + case 0x700c: + case 0x700d: + case 0x700e: + case 0x700f: { + INT32 Offset = a - 0x7000; + + switch (IOChipCustomCommand) { + case 0x71: + case 0xb1: { + if (Offset == 0) { + if (IOChipMode) { + return DrvInput[0] | DrvDip[0]; + } else { + UINT8 In; + static UINT8 CoinInserted; + + In = DrvInput[0] | DrvDip[0]; + if (In != PrevInValue) { + if (IOChipCoinPerCredit > 0) { + if ((In & 0x70) != 0x70 && IOChipCredits < 99) { + CoinInserted++; + if (CoinInserted >= IOChipCoinPerCredit) { + IOChipCredits += IOChipCreditPerCoin; + CoinInserted = 0; + } + } + } else { + IOChipCredits = 2; + } + + if ((In & 0x04) == 0) { + if (IOChipCredits >= 1) IOChipCredits--; + } + + if ((In & 0x08) == 0) { + if (IOChipCredits >= 2) IOChipCredits -= 2; + } + } + + PrevInValue = In; + + return (IOChipCredits / 10) * 16 + IOChipCredits % 10; + } + } + + if (Offset == 1) return DrvInput[1]; + if (Offset == 2) return DrvInput[2]; + } + } + + return 0xff; + } + + case 0x7100: { + return IOChipCustomCommand; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #%i Read %04x\n"), ZetGetActive(), a); + } + } + + return 0; +} + +void __fastcall GalagaZ80ProgWrite(UINT16 a, UINT8 d) +{ + if (a >= 0x6800 && a <= 0x681f) { NamcoSoundWrite(a - 0x6800, d); return; } + + switch (a) { + case 0x6820: { + DrvCPU1FireIRQ = d & 0x01; + if (!DrvCPU1FireIRQ) { + + } + return; + } + + case 0x6821: { + DrvCPU2FireIRQ = d & 0x01; + if (!DrvCPU2FireIRQ) { + + } + return; + } + + case 0x6822: { + DrvCPU3FireIRQ = !(d & 0x01); + return; + } + + case 0x6823: { + if (!(d & 0x01)) { + INT32 nActive = ZetGetActive(); + ZetClose(); + ZetOpen(1); + ZetReset(); + ZetClose(); + ZetOpen(2); + ZetReset(); + ZetClose(); + ZetOpen(nActive); + DrvCPU2Halt = 1; + DrvCPU3Halt = 1; + return; + } else { + DrvCPU2Halt = 0; + DrvCPU3Halt = 0; + } + } + + case 0x6830: { + // watchdog write + return; + } + + case 0x7000: + case 0x7001: + case 0x7002: + case 0x7003: + case 0x7004: + case 0x7005: + case 0x7006: + case 0x7007: + case 0x7008: + case 0x7009: + case 0x700a: + case 0x700b: + case 0x700c: + case 0x700d: + case 0x700e: + case 0x700f: { + INT32 Offset = a - 0x7000; + IOChipCustom[Offset] = d; + Namco54XXWrite(d); + + switch (IOChipCustomCommand) { + case 0xe1: { + if (Offset == 7) { + IOChipCoinPerCredit = IOChipCustom[1]; + IOChipCreditPerCoin = IOChipCustom[2]; + } + break; + } + } + + return; + } + + case 0x7100: { + IOChipCustomCommand = d; + IOChipCPU1FireIRQ = 1; + + switch (IOChipCustomCommand) { + case 0x10: { + IOChipCPU1FireIRQ = 0; + return; + } + + case 0xa1: { + IOChipMode = 1; + return; + } + + case 0xe1: { + IOChipCredits = 0; + IOChipMode = 0; + return; + } + } + + return; + } + + case 0xa000: + case 0xa001: + case 0xa002: + case 0xa003: + case 0xa004: + case 0xa005: + case 0xa006: { + DrvStarControl[a - 0xa000] = d & 0x01; + return; + } + + case 0xa007: { + DrvFlipScreen = d & 0x01; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #%i Write %04x, %02x\n"), ZetGetActive(), a, d); + } + } +} + +static INT32 CharPlaneOffsets[2] = { 0, 4 }; +static INT32 CharXOffsets[8] = { 64, 65, 66, 67, 0, 1, 2, 3 }; +static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 SpritePlaneOffsets[2] = { 0, 4 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 64, 65, 66, 67, 128, 129, 130, 131, 192, 193, 194, 195 }; +static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 256, 264, 272, 280, 288, 296, 304, 312 }; + +static void MachineInit() +{ + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(GalagaZ80ProgRead); + ZetSetWriteHandler(GalagaZ80ProgWrite); + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom1); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom1); + ZetMapArea(0x8000, 0x87ff, 0, DrvVideoRam); + ZetMapArea(0x8000, 0x87ff, 1, DrvVideoRam); + ZetMapArea(0x8000, 0x87ff, 2, DrvVideoRam); + ZetMapArea(0x8800, 0x8bff, 0, DrvSharedRam1); + ZetMapArea(0x8800, 0x8bff, 1, DrvSharedRam1); + ZetMapArea(0x8800, 0x8bff, 2, DrvSharedRam1); + ZetMapArea(0x9000, 0x93ff, 0, DrvSharedRam2); + ZetMapArea(0x9000, 0x93ff, 1, DrvSharedRam2); + ZetMapArea(0x9000, 0x93ff, 2, DrvSharedRam2); + ZetMapArea(0x9800, 0x9bff, 0, DrvSharedRam3); + ZetMapArea(0x9800, 0x9bff, 1, DrvSharedRam3); + ZetMapArea(0x9800, 0x9bff, 2, DrvSharedRam3); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(GalagaZ80ProgRead); + ZetSetWriteHandler(GalagaZ80ProgWrite); + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom2); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom2); + ZetMapArea(0x8000, 0x87ff, 0, DrvVideoRam); + ZetMapArea(0x8000, 0x87ff, 1, DrvVideoRam); + ZetMapArea(0x8000, 0x87ff, 2, DrvVideoRam); + ZetMapArea(0x8800, 0x8bff, 0, DrvSharedRam1); + ZetMapArea(0x8800, 0x8bff, 1, DrvSharedRam1); + ZetMapArea(0x8800, 0x8bff, 2, DrvSharedRam1); + ZetMapArea(0x9000, 0x93ff, 0, DrvSharedRam2); + ZetMapArea(0x9000, 0x93ff, 1, DrvSharedRam2); + ZetMapArea(0x9000, 0x93ff, 2, DrvSharedRam2); + ZetMapArea(0x9800, 0x9bff, 0, DrvSharedRam3); + ZetMapArea(0x9800, 0x9bff, 1, DrvSharedRam3); + ZetMapArea(0x9800, 0x9bff, 2, DrvSharedRam3); + ZetClose(); + + ZetInit(2); + ZetOpen(2); + ZetSetReadHandler(GalagaZ80ProgRead); + ZetSetWriteHandler(GalagaZ80ProgWrite); + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom3); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom3); + ZetMapArea(0x8000, 0x87ff, 0, DrvVideoRam); + ZetMapArea(0x8000, 0x87ff, 1, DrvVideoRam); + ZetMapArea(0x8000, 0x87ff, 2, DrvVideoRam); + ZetMapArea(0x8800, 0x8bff, 0, DrvSharedRam1); + ZetMapArea(0x8800, 0x8bff, 1, DrvSharedRam1); + ZetMapArea(0x8800, 0x8bff, 2, DrvSharedRam1); + ZetMapArea(0x9000, 0x93ff, 0, DrvSharedRam2); + ZetMapArea(0x9000, 0x93ff, 1, DrvSharedRam2); + ZetMapArea(0x9000, 0x93ff, 2, DrvSharedRam2); + ZetMapArea(0x9800, 0x9bff, 0, DrvSharedRam3); + ZetMapArea(0x9800, 0x9bff, 1, DrvSharedRam3); + ZetMapArea(0x9800, 0x9bff, 2, DrvSharedRam3); + ZetClose(); + + NamcoSoundInit(18432000 / 6 / 32, 3); + NacmoSoundSetAllRoutes(0.90 * 10.0 / 16.0, BURN_SND_ROUTE_BOTH); + BurnSampleInit(0); + BurnSampleSetAllRoutesAllSamples(0.80, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); +} + +static INT32 DrvInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x02000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x01000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x02000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x03000, 3, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load Z80 #3 Program Roms + nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 5, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x02000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x01000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x80, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load the PROMs + nRet = BurnLoadRom(DrvPromPalette, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromCharLookup, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromSpriteLookup, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(NamcoSoundProm, 12, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + MachineInit(); + + return 0; +} + +static INT32 GallagInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x02000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x01000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x02000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x03000, 3, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load Z80 #3 Program Roms + nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 5, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x02000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x01000, 9, 1); if (nRet != 0) return 1; + GfxDecode(0x80, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load the PROMs + nRet = BurnLoadRom(DrvPromPalette, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromCharLookup, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromSpriteLookup, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(NamcoSoundProm, 13, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + MachineInit(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + NamcoSoundExit(); + BurnSampleExit(); + ZetExit(); + + BurnFree(Mem); + + DrvCPU1FireIRQ = 0; + DrvCPU2FireIRQ = 0; + DrvCPU3FireIRQ = 0; + DrvCPU2Halt = 0; + DrvCPU3Halt = 0; + DrvFlipScreen = 0; + for (INT32 i = 0; i < 6; i++) { + DrvStarControl[i] = 0; + } + DrvStarScrollX = 0; + DrvStarScrollY = 0; + + IOChipCustomCommand = 0; + IOChipCPU1FireIRQ = 0; + IOChipMode = 0; + IOChipCredits = 0; + IOChipCoinPerCredit = 0; + IOChipCreditPerCoin = 0; + for (INT32 i = 0; i < 16; i++) { + IOChipCustom[i] = 0; + } + + return 0; +} + +static void DrvCalcPalette() +{ + INT32 i; + UINT32 Palette[96]; + + for (i = 0; i < 32; i++) { + INT32 bit0, bit1, bit2, r, g, b; + + bit0 = (DrvPromPalette[i] >> 0) & 0x01; + bit1 = (DrvPromPalette[i] >> 1) & 0x01; + bit2 = (DrvPromPalette[i] >> 2) & 0x01; + r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + bit0 = (DrvPromPalette[i] >> 3) & 0x01; + bit1 = (DrvPromPalette[i] >> 4) & 0x01; + bit2 = (DrvPromPalette[i] >> 5) & 0x01; + g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + bit0 = 0; + bit1 = (DrvPromPalette[i] >> 6) & 0x01; + bit2 = (DrvPromPalette[i] >> 7) & 0x01; + b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + Palette[i] = BurnHighCol(r, g, b, 0); + } + + for (i = 0; i < 64; i++) { + INT32 bits, r, g, b; + static const INT32 map[4] = { 0x00, 0x47, 0x97, 0xde }; + + bits = (i >> 0) & 0x03; + r = map[bits]; + bits = (i >> 2) & 0x03; + g = map[bits]; + bits = (i >> 4) & 0x03; + b = map[bits]; + + Palette[32 + i] = BurnHighCol(r, g, b, 0); + } + + for (i = 0; i < 256; i++) { + DrvPalette[i] = Palette[((DrvPromCharLookup[i]) & 0x0f) + 0x10]; + } + + for (i = 0; i < 256; i++) { + DrvPalette[256 + i] = Palette[DrvPromSpriteLookup[i] & 0x0f]; + } + + for (i = 0; i < 64; i++) { + DrvPalette[512 + i] = Palette[32 + i]; + } +} + +struct Star { + UINT16 x, y; + UINT8 Colour, Set; +}; + +const struct Star StarSeedTab[252] = { + // set 0 + {0x0085, 0x0006, 0x35, 0x00}, + {0x008F, 0x0008, 0x30, 0x00}, + {0x00E5, 0x001B, 0x07, 0x00}, + {0x0022, 0x001C, 0x31, 0x00}, + {0x00E5, 0x0025, 0x1D, 0x00}, + {0x0015, 0x0026, 0x29, 0x00}, + {0x0080, 0x002D, 0x3B, 0x00}, + {0x0097, 0x002E, 0x1C, 0x00}, + {0x00BA, 0x003B, 0x05, 0x00}, + {0x0036, 0x003D, 0x36, 0x00}, + {0x0057, 0x0044, 0x09, 0x00}, + {0x00CF, 0x0044, 0x3D, 0x00}, + {0x0061, 0x004E, 0x27, 0x00}, + {0x0087, 0x0064, 0x1A, 0x00}, + {0x00D6, 0x0064, 0x17, 0x00}, + {0x000B, 0x006C, 0x3C, 0x00}, + {0x0006, 0x006D, 0x24, 0x00}, + {0x0018, 0x006E, 0x3A, 0x00}, + {0x00A9, 0x0079, 0x23, 0x00}, + {0x008A, 0x007B, 0x11, 0x00}, + {0x00D6, 0x0080, 0x0C, 0x00}, + {0x0067, 0x0082, 0x3F, 0x00}, + {0x0039, 0x0083, 0x38, 0x00}, + {0x0072, 0x0083, 0x14, 0x00}, + {0x00EC, 0x0084, 0x16, 0x00}, + {0x008E, 0x0085, 0x10, 0x00}, + {0x0020, 0x0088, 0x25, 0x00}, + {0x0095, 0x008A, 0x0F, 0x00}, + {0x000E, 0x008D, 0x00, 0x00}, + {0x0006, 0x0091, 0x2E, 0x00}, + {0x0007, 0x0094, 0x0D, 0x00}, + {0x00AE, 0x0097, 0x0B, 0x00}, + {0x0000, 0x0098, 0x2D, 0x00}, + {0x0086, 0x009B, 0x01, 0x00}, + {0x0058, 0x00A1, 0x34, 0x00}, + {0x00FE, 0x00A1, 0x3E, 0x00}, + {0x00A2, 0x00A8, 0x1F, 0x00}, + {0x0041, 0x00AA, 0x0A, 0x00}, + {0x003F, 0x00AC, 0x32, 0x00}, + {0x00DE, 0x00AC, 0x03, 0x00}, + {0x00D4, 0x00B9, 0x26, 0x00}, + {0x006D, 0x00BB, 0x1B, 0x00}, + {0x0062, 0x00BD, 0x39, 0x00}, + {0x00C9, 0x00BE, 0x18, 0x00}, + {0x006C, 0x00C1, 0x04, 0x00}, + {0x0059, 0x00C3, 0x21, 0x00}, + {0x0060, 0x00CC, 0x0E, 0x00}, + {0x0091, 0x00CC, 0x12, 0x00}, + {0x003F, 0x00CF, 0x06, 0x00}, + {0x00F7, 0x00CF, 0x22, 0x00}, + {0x0044, 0x00D0, 0x33, 0x00}, + {0x0034, 0x00D2, 0x08, 0x00}, + {0x00D3, 0x00D9, 0x20, 0x00}, + {0x0071, 0x00DD, 0x37, 0x00}, + {0x0073, 0x00E1, 0x2C, 0x00}, + {0x00B9, 0x00E3, 0x2F, 0x00}, + {0x00A9, 0x00E4, 0x13, 0x00}, + {0x00D3, 0x00E7, 0x19, 0x00}, + {0x0037, 0x00ED, 0x02, 0x00}, + {0x00BD, 0x00F4, 0x15, 0x00}, + {0x000F, 0x00F6, 0x28, 0x00}, + {0x004F, 0x00F7, 0x2B, 0x00}, + {0x00FB, 0x00FF, 0x2A, 0x00}, + + // set 1 + {0x00FE, 0x0004, 0x3D, 0x01}, + {0x00C4, 0x0006, 0x10, 0x01}, + {0x001E, 0x0007, 0x2D, 0x01}, + {0x0083, 0x000B, 0x1F, 0x01}, + {0x002E, 0x000D, 0x3C, 0x01}, + {0x001F, 0x000E, 0x00, 0x01}, + {0x00D8, 0x000E, 0x2C, 0x01}, + {0x0003, 0x000F, 0x17, 0x01}, + {0x0095, 0x0011, 0x3F, 0x01}, + {0x006A, 0x0017, 0x35, 0x01}, + {0x00CC, 0x0017, 0x02, 0x01}, + {0x0000, 0x0018, 0x32, 0x01}, + {0x0092, 0x001D, 0x36, 0x01}, + {0x00E3, 0x0021, 0x04, 0x01}, + {0x002F, 0x002D, 0x37, 0x01}, + {0x00F0, 0x002F, 0x0C, 0x01}, + {0x009B, 0x003E, 0x06, 0x01}, + {0x00A4, 0x004C, 0x07, 0x01}, + {0x00EA, 0x004D, 0x13, 0x01}, + {0x0084, 0x004E, 0x21, 0x01}, + {0x0033, 0x0052, 0x0F, 0x01}, + {0x0070, 0x0053, 0x0E, 0x01}, + {0x0006, 0x0059, 0x08, 0x01}, + {0x0081, 0x0060, 0x28, 0x01}, + {0x0037, 0x0061, 0x29, 0x01}, + {0x008F, 0x0067, 0x2F, 0x01}, + {0x001B, 0x006A, 0x1D, 0x01}, + {0x00BF, 0x007C, 0x12, 0x01}, + {0x0051, 0x007F, 0x31, 0x01}, + {0x0061, 0x0086, 0x25, 0x01}, + {0x006A, 0x008F, 0x0D, 0x01}, + {0x006A, 0x0091, 0x19, 0x01}, + {0x0090, 0x0092, 0x05, 0x01}, + {0x003B, 0x0096, 0x24, 0x01}, + {0x008C, 0x0097, 0x0A, 0x01}, + {0x0006, 0x0099, 0x03, 0x01}, + {0x0038, 0x0099, 0x38, 0x01}, + {0x00A8, 0x0099, 0x18, 0x01}, + {0x0076, 0x00A6, 0x20, 0x01}, + {0x00AD, 0x00A6, 0x1C, 0x01}, + {0x00EC, 0x00A6, 0x1E, 0x01}, + {0x0086, 0x00AC, 0x15, 0x01}, + {0x0078, 0x00AF, 0x3E, 0x01}, + {0x007B, 0x00B3, 0x09, 0x01}, + {0x0027, 0x00B8, 0x39, 0x01}, + {0x0088, 0x00C2, 0x23, 0x01}, + {0x0044, 0x00C3, 0x3A, 0x01}, + {0x00CF, 0x00C5, 0x34, 0x01}, + {0x0035, 0x00C9, 0x30, 0x01}, + {0x006E, 0x00D1, 0x3B, 0x01}, + {0x00D6, 0x00D7, 0x16, 0x01}, + {0x003A, 0x00D9, 0x2B, 0x01}, + {0x00AB, 0x00E0, 0x11, 0x01}, + {0x00E0, 0x00E2, 0x1B, 0x01}, + {0x006F, 0x00E6, 0x0B, 0x01}, + {0x00B8, 0x00E8, 0x14, 0x01}, + {0x00D9, 0x00E8, 0x1A, 0x01}, + {0x00F9, 0x00E8, 0x22, 0x01}, + {0x0004, 0x00F1, 0x2E, 0x01}, + {0x0049, 0x00F8, 0x26, 0x01}, + {0x0010, 0x00F9, 0x01, 0x01}, + {0x0039, 0x00FB, 0x33, 0x01}, + {0x0028, 0x00FC, 0x27, 0x01}, + + // set 2 + {0x00FA, 0x0006, 0x19, 0x02}, + {0x00E4, 0x0007, 0x2D, 0x02}, + {0x0072, 0x000A, 0x03, 0x02}, + {0x0084, 0x001B, 0x00, 0x02}, + {0x00BA, 0x001D, 0x29, 0x02}, + {0x00E3, 0x0022, 0x04, 0x02}, + {0x00D1, 0x0026, 0x2A, 0x02}, + {0x0089, 0x0032, 0x30, 0x02}, + {0x005B, 0x0036, 0x27, 0x02}, + {0x0084, 0x003A, 0x36, 0x02}, + {0x0053, 0x003F, 0x0D, 0x02}, + {0x0008, 0x0040, 0x1D, 0x02}, + {0x0055, 0x0040, 0x1A, 0x02}, + {0x00AA, 0x0041, 0x31, 0x02}, + {0x00FB, 0x0041, 0x2B, 0x02}, + {0x00BC, 0x0046, 0x16, 0x02}, + {0x0093, 0x0052, 0x39, 0x02}, + {0x00B9, 0x0057, 0x10, 0x02}, + {0x0054, 0x0059, 0x28, 0x02}, + {0x00E6, 0x005A, 0x01, 0x02}, + {0x00A7, 0x005D, 0x1B, 0x02}, + {0x002D, 0x005E, 0x35, 0x02}, + {0x0014, 0x0062, 0x21, 0x02}, + {0x0069, 0x006D, 0x1F, 0x02}, + {0x00CE, 0x006F, 0x0B, 0x02}, + {0x00DF, 0x0075, 0x2F, 0x02}, + {0x00CB, 0x0077, 0x12, 0x02}, + {0x004E, 0x007C, 0x23, 0x02}, + {0x004A, 0x0084, 0x0F, 0x02}, + {0x0012, 0x0086, 0x25, 0x02}, + {0x0068, 0x008C, 0x32, 0x02}, + {0x0003, 0x0095, 0x20, 0x02}, + {0x000A, 0x009C, 0x17, 0x02}, + {0x005B, 0x00A3, 0x08, 0x02}, + {0x005F, 0x00A4, 0x3E, 0x02}, + {0x0072, 0x00A4, 0x2E, 0x02}, + {0x00CC, 0x00A6, 0x06, 0x02}, + {0x008A, 0x00AB, 0x0C, 0x02}, + {0x00E0, 0x00AD, 0x26, 0x02}, + {0x00F3, 0x00AF, 0x0A, 0x02}, + {0x0075, 0x00B4, 0x13, 0x02}, + {0x0068, 0x00B7, 0x11, 0x02}, + {0x006D, 0x00C2, 0x2C, 0x02}, + {0x0076, 0x00C3, 0x14, 0x02}, + {0x00CF, 0x00C4, 0x1E, 0x02}, + {0x0004, 0x00C5, 0x1C, 0x02}, + {0x0013, 0x00C6, 0x3F, 0x02}, + {0x00B9, 0x00C7, 0x3C, 0x02}, + {0x0005, 0x00D7, 0x34, 0x02}, + {0x0095, 0x00D7, 0x3A, 0x02}, + {0x00FC, 0x00D8, 0x02, 0x02}, + {0x00E7, 0x00DC, 0x09, 0x02}, + {0x001D, 0x00E1, 0x05, 0x02}, + {0x0005, 0x00E6, 0x33, 0x02}, + {0x001C, 0x00E9, 0x3B, 0x02}, + {0x00A2, 0x00ED, 0x37, 0x02}, + {0x0028, 0x00EE, 0x07, 0x02}, + {0x00DD, 0x00EF, 0x18, 0x02}, + {0x006D, 0x00F0, 0x38, 0x02}, + {0x00A1, 0x00F2, 0x0E, 0x02}, + {0x0074, 0x00F7, 0x3D, 0x02}, + {0x0069, 0x00F9, 0x22, 0x02}, + {0x003F, 0x00FF, 0x24, 0x02}, + + // set 3 + {0x0071, 0x0010, 0x34, 0x03}, + {0x00AF, 0x0011, 0x23, 0x03}, + {0x00A0, 0x0014, 0x26, 0x03}, + {0x0002, 0x0017, 0x02, 0x03}, + {0x004B, 0x0019, 0x31, 0x03}, + {0x0093, 0x001C, 0x0E, 0x03}, + {0x001B, 0x001E, 0x25, 0x03}, + {0x0032, 0x0020, 0x2E, 0x03}, + {0x00EE, 0x0020, 0x3A, 0x03}, + {0x0079, 0x0022, 0x2F, 0x03}, + {0x006C, 0x0023, 0x17, 0x03}, + {0x00BC, 0x0025, 0x11, 0x03}, + {0x0041, 0x0029, 0x30, 0x03}, + {0x001C, 0x002E, 0x32, 0x03}, + {0x00B9, 0x0031, 0x01, 0x03}, + {0x0083, 0x0032, 0x05, 0x03}, + {0x0095, 0x003A, 0x12, 0x03}, + {0x000D, 0x003F, 0x07, 0x03}, + {0x0020, 0x0041, 0x33, 0x03}, + {0x0092, 0x0045, 0x2C, 0x03}, + {0x00D4, 0x0047, 0x08, 0x03}, + {0x00A1, 0x004B, 0x2D, 0x03}, + {0x00D2, 0x004B, 0x3B, 0x03}, + {0x00D6, 0x0052, 0x24, 0x03}, + {0x009A, 0x005F, 0x1C, 0x03}, + {0x0016, 0x0060, 0x3D, 0x03}, + {0x001A, 0x0063, 0x1F, 0x03}, + {0x00CD, 0x0066, 0x28, 0x03}, + {0x00FF, 0x0067, 0x10, 0x03}, + {0x0035, 0x0069, 0x20, 0x03}, + {0x008F, 0x006C, 0x04, 0x03}, + {0x00CA, 0x006C, 0x2A, 0x03}, + {0x005A, 0x0074, 0x09, 0x03}, + {0x0060, 0x0078, 0x38, 0x03}, + {0x0072, 0x0079, 0x1E, 0x03}, + {0x0037, 0x007F, 0x29, 0x03}, + {0x0012, 0x0080, 0x14, 0x03}, + {0x0029, 0x0082, 0x2B, 0x03}, + {0x0084, 0x0098, 0x36, 0x03}, + {0x0032, 0x0099, 0x37, 0x03}, + {0x00BB, 0x00A0, 0x19, 0x03}, + {0x003E, 0x00A3, 0x3E, 0x03}, + {0x004A, 0x00A6, 0x1A, 0x03}, + {0x0029, 0x00A7, 0x21, 0x03}, + {0x009D, 0x00B7, 0x22, 0x03}, + {0x006C, 0x00B9, 0x15, 0x03}, + {0x000C, 0x00C0, 0x0A, 0x03}, + {0x00C2, 0x00C3, 0x0F, 0x03}, + {0x002F, 0x00C9, 0x0D, 0x03}, + {0x00D2, 0x00CE, 0x16, 0x03}, + {0x00F3, 0x00CE, 0x0B, 0x03}, + {0x0075, 0x00CF, 0x27, 0x03}, + {0x001A, 0x00D5, 0x35, 0x03}, + {0x0026, 0x00D6, 0x39, 0x03}, + {0x0080, 0x00DA, 0x3C, 0x03}, + {0x00A9, 0x00DD, 0x00, 0x03}, + {0x00BC, 0x00EB, 0x03, 0x03}, + {0x0032, 0x00EF, 0x1B, 0x03}, + {0x0067, 0x00F0, 0x3F, 0x03}, + {0x00EF, 0x00F1, 0x18, 0x03}, + {0x00A8, 0x00F3, 0x0C, 0x03}, + {0x00DE, 0x00F9, 0x1D, 0x03}, + {0x002C, 0x00FA, 0x13, 0x03} +}; + +static void DrvRenderStars() +{ + if (DrvStarControl[5] == 1) { + INT32 StarCounter; + INT32 SetA, SetB; + + SetA = DrvStarControl[3]; + SetB = DrvStarControl[4] | 0x02; + + for (StarCounter = 0; StarCounter < 252; StarCounter++) { + INT32 x, y; + + if ((SetA == StarSeedTab[StarCounter].Set) || (SetB == StarSeedTab[StarCounter].Set)) { + x = (StarSeedTab[StarCounter].x + DrvStarScrollX) % 256 + 16; + y = (112 + StarSeedTab[StarCounter].y + DrvStarScrollY) % 256; + + if (x >= 0 && x < 288 && y >= 0 && y < 224) { + pTransDraw[(y * nScreenWidth) + x] = StarSeedTab[StarCounter].Colour + 512; + } + } + + } + } +} + +static void DrvRenderTilemap() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex, Row, Col; + + for (mx = 0; mx < 28; mx++) { + for (my = 0; my < 36; my++) { + Row = mx + 2; + Col = my - 2; + if (Col & 0x20) { + TileIndex = Row + ((Col & 0x1f) << 5); + } else { + TileIndex = Col + (Row << 5); + } + + Code = DrvVideoRam[TileIndex + 0x000] & 0x7f; + Colour = DrvVideoRam[TileIndex + 0x400] & 0x3f; + + y = 8 * mx; + x = 8 * my; + + if (DrvFlipScreen) { + x = 280 - x; + y = 216 - y; + } + + if (x > 8 && x < 280 && y > 8 && y < 216) { + if (DrvFlipScreen) { + Render8x8Tile_FlipXY(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } else { + Render8x8Tile(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } + } else { + if (DrvFlipScreen) { + Render8x8Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } else { + Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } + } + } + } +} + +static void DrvRenderSprites() +{ + UINT8 *SpriteRam1 = DrvSharedRam1 + 0x380; + UINT8 *SpriteRam2 = DrvSharedRam2 + 0x380; + UINT8 *SpriteRam3 = DrvSharedRam3 + 0x380; + + for (INT32 Offset = 0; Offset < 0x80; Offset += 2) { + static const INT32 GfxOffset[2][2] = { + { 0, 1 }, + { 2, 3 } + }; + INT32 Sprite = SpriteRam1[Offset + 0] & 0x7f; + INT32 Colour = SpriteRam1[Offset + 1] & 0x3f; + INT32 sx = SpriteRam2[Offset + 1] - 40 + (0x100 * (SpriteRam3[Offset + 1] & 0x03)); + INT32 sy = 256 - SpriteRam2[Offset + 0] + 1; + INT32 xFlip = (SpriteRam3[Offset + 0] & 0x01); + INT32 yFlip = (SpriteRam3[Offset + 0] & 0x02) >> 1; + INT32 xSize = (SpriteRam3[Offset + 0] & 0x04) >> 2; + INT32 ySize = (SpriteRam3[Offset + 0] & 0x08) >> 3; + + sy -= 16 * ySize; + sy = (sy & 0xff) - 32; + + if (DrvFlipScreen) { + xFlip = !xFlip; + yFlip = !yFlip; + } + + for (INT32 y = 0; y <= ySize; y++) { + for (INT32 x = 0; x <= xSize; x++) { + INT32 Code = Sprite + GfxOffset[y ^ (ySize * yFlip)][x ^ (xSize * xFlip)]; + INT32 xPos = sx + 16 * x; + INT32 yPos = sy + 16 * y; + + if (xPos > 16 && xPos < 272 && yPos > 16 && yPos < 208) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); + } else { + Render16x16Tile_Mask(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, xPos, yPos, Colour, 2, 0, 256, DrvSprites); + } + } + } + } + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + DrvRenderTilemap(); + DrvRenderStars(); + DrvRenderSprites(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = nBurnSoundLen; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + INT32 nSoundBufferPos = 0; + + nCyclesTotal[0] = (18432000 / 6) / 60; + nCyclesTotal[1] = (18432000 / 6) / 60; + nCyclesTotal[2] = (18432000 / 6) / 60; + nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == (nInterleave - 1) && DrvCPU1FireIRQ) { + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + if ((i == 0 || i == (nInterleave / 3) || i == (nInterleave / 3 * 2)) && IOChipCPU1FireIRQ) { + ZetNmi(); + } + ZetClose(); + + if (!DrvCPU2Halt) { + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == (nInterleave - 1) && DrvCPU2FireIRQ) { + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + ZetClose(); + } + + if (!DrvCPU3Halt) { + nCurrentCPU = 2; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if ((i == (nInterleave / 2) || i == (nInterleave - 1)) && DrvCPU3FireIRQ) { + ZetNmi(); + } + ZetClose(); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + NamcoSoundUpdate(pSoundBuf, nSegmentLength); + BurnSampleRender(pSoundBuf, nSegmentLength); + } + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + NamcoSoundUpdate(pSoundBuf, nSegmentLength); + BurnSampleRender(pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) DrvDraw(); + + static const INT32 Speeds[8] = { -1, -2, -3, 0, 3, 2, 1, 0 }; + + DrvStarScrollX += Speeds[DrvStarControl[0] + (DrvStarControl[1] * 2) + (DrvStarControl[2] * 4)]; + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029698; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); // Scan Z80 + NamcoSoundScan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(DrvCPU1FireIRQ); + SCAN_VAR(DrvCPU2FireIRQ); + SCAN_VAR(DrvCPU3FireIRQ); + SCAN_VAR(DrvCPU2Halt); + SCAN_VAR(DrvCPU3Halt); + SCAN_VAR(DrvFlipScreen); + SCAN_VAR(DrvStarScrollX); + SCAN_VAR(DrvStarScrollY); + SCAN_VAR(IOChipCustomCommand); + SCAN_VAR(IOChipCPU1FireIRQ); + SCAN_VAR(IOChipMode); + SCAN_VAR(IOChipCredits); + SCAN_VAR(IOChipCoinPerCredit); + SCAN_VAR(IOChipCreditPerCoin); + SCAN_VAR(PrevInValue); + for (INT32 i = 0; i < 6; i++) { + SCAN_VAR(DrvStarControl[i]); + } + for (INT32 i = 0; i < 16; i++) { + SCAN_VAR(IOChipCustom[i]); + } + SCAN_VAR(DrvDip); + SCAN_VAR(DrvInput); + } + + return 0; +} + +struct BurnDriver BurnDrvGalaga = { + "galaga", NULL, NULL, "galaga", "1981", + "Galaga (Namco rev. B)\0", NULL, "Namco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, DrvRomInfo, DrvRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 576, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvGalagao = { + "galagao", "galaga", NULL, "galaga", "1981", + "Galaga (Namco)\0", NULL, "Namco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, GalagaoRomInfo, GalagaoRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 576, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvGalagamw = { + "galagamw", "galaga", NULL, "galaga", "1981", + "Galaga (Midway set 1)\0", NULL, "Namco (Midway License)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, GalagamwRomInfo, GalagamwRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, GalagamwDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 576, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvGalagamk = { + "galagamk", "galaga", NULL, "galaga", "1981", + "Galaga (Midway set 2)\0", NULL, "Namco (Midway License)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, GalagamkRomInfo, GalagamkRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 576, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvGalagamf = { + "galagamf", "galaga", NULL, "galaga", "1981", + "Galaga (Midway set 1 with fast shoot hack)\0", NULL, "Namco (Midway License)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, GalagamfRomInfo, GalagamfRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 576, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvGallag = { + "gallag", "galaga", NULL, "galaga", "1981", + "Gallag\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, GallagRomInfo, GallagRomName, GalagaSampleInfo, GalagaSampleName, DrvInputInfo, DrvDIPInfo, + GallagInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 576, 224, 288, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_gng.cpp b/src/burn/drv/pre90s/d_gng.cpp index c27af5458..b30ffe83f 100644 --- a/src/burn/drv/pre90s/d_gng.cpp +++ b/src/burn/drv/pre90s/d_gng.cpp @@ -1,1535 +1,1533 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "m6809_intf.h" -#include "burn_ym2203.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[2] = {0, 0}; -static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *DrvM6809Rom = NULL; -static UINT8 *DrvZ80Rom = NULL; -static UINT8 *DrvM6809Ram = NULL; -static UINT8 *DrvZ80Ram = NULL; -static UINT8 *DrvFgVideoRam = NULL; -static UINT8 *DrvBgVideoRam = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvSpriteRamBuffer = NULL; -static UINT8 *DrvPaletteRam1 = NULL; -static UINT8 *DrvPaletteRam2 = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT8 DrvRomBank; -static UINT8 DrvBgScrollX[2]; -static UINT8 DrvBgScrollY[2]; -static UINT8 DrvSoundLatch; - -static INT32 RomLoadOffset = 0; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static INT32 Diamond; - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 7, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, - {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 5, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo DiamondInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 7, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, - {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Diamond) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - } - - // Clear Opposites - DrvClearOpposites(&DrvInput[1]); - DrvClearOpposites(&DrvInput[2]); -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xdf, NULL }, - {0x13, 0xff, 0xff, 0xfb, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 16 , "Coinage" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Plays" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Plays" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Plays" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Plays" }, - {0x12, 0x01, 0x0f, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 2 , "Coinage affects" }, - {0x12, 0x01, 0x10, 0x10, "Coin A" }, - {0x12, 0x01, 0x10, 0x00, "Coin B" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x04, 0x00, "Upright" }, - {0x13, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "20k 70k 70k" }, - {0x13, 0x01, 0x18, 0x10, "30k 80k 80k" }, - {0x13, 0x01, 0x18, 0x08, "20k 80k" }, - {0x13, 0x01, 0x18, 0x00, "30k 80k" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x60, 0x40, "Easy" }, - {0x13, 0x01, 0x60, 0x60, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, -}; - -STDDIPINFO(Drv) - -static struct BurnDIPInfo DrvjDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xdf, NULL }, - {0x13, 0xff, 0xff, 0xfb, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 16 , "Coinage" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Plays" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Plays" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Plays" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Plays" }, - {0x12, 0x01, 0x0f, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 2 , "Coinage affects" }, - {0x12, 0x01, 0x10, 0x10, "Coin A" }, - {0x12, 0x01, 0x10, 0x00, "Coin B" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x04, 0x00, "Upright" }, - {0x13, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "20k 70k 70k" }, - {0x13, 0x01, 0x18, 0x10, "30k 80k 80k" }, - {0x13, 0x01, 0x18, 0x08, "20k 80k" }, - {0x13, 0x01, 0x18, 0x00, "30k 80k" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x60, 0x40, "Easy" }, - {0x13, 0x01, 0x60, 0x60, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Difficult" }, - {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Drvj) - -static struct BurnDIPInfo DiamondDIPList[]= -{ - // Default Values - {0x0a, 0xff, 0xff, 0x81, NULL }, - {0x0b, 0xff, 0xff, 0x07, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0a, 0x01, 0x03, 0x00, "2" }, - {0x0a, 0x01, 0x03, 0x01, "3" }, - {0x0a, 0x01, 0x03, 0x02, "4" }, - {0x0a, 0x01, 0x03, 0x03, "5" }, - - {0 , 0xfe, 0 , 4 , "Credits A" }, - {0x0a, 0x01, 0x0c, 0x00, "x1" }, - {0x0a, 0x01, 0x0c, 0x04, "x2" }, - {0x0a, 0x01, 0x0c, 0x08, "x3" }, - {0x0a, 0x01, 0x0c, 0x0c, "x4" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0a, 0x01, 0x30, 0x30, "4 Coins 1 Play" }, - {0x0a, 0x01, 0x30, 0x20, "3 Coins 1 Play" }, - {0x0a, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, - {0x0a, 0x01, 0x30, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0a, 0x01, 0x80, 0x80, "Off" }, - {0x0a, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Energy Loss" }, - {0x0b, 0x01, 0x0f, 0x00, "Slowest" }, - {0x0b, 0x01, 0x0f, 0x01, "-6 Slower" }, - {0x0b, 0x01, 0x0f, 0x02, "-5 Slower" }, - {0x0b, 0x01, 0x0f, 0x03, "-4 Slower" }, - {0x0b, 0x01, 0x0f, 0x04, "-3 Slower" }, - {0x0b, 0x01, 0x0f, 0x05, "-2 Slower" }, - {0x0b, 0x01, 0x0f, 0x06, "-1 Slower" }, - {0x0b, 0x01, 0x0f, 0x07, "Normal" }, - {0x0b, 0x01, 0x0f, 0x08, "+1 Faster" }, - {0x0b, 0x01, 0x0f, 0x09, "+2 Faster" }, - {0x0b, 0x01, 0x0f, 0x0a, "+3 Faster" }, - {0x0b, 0x01, 0x0f, 0x0b, "+4 Faster" }, - {0x0b, 0x01, 0x0f, 0x0c, "+5 Faster" }, - {0x0b, 0x01, 0x0f, 0x0d, "+6 Faster" }, - {0x0b, 0x01, 0x0f, 0x0e, "+7 Faster" }, - {0x0b, 0x01, 0x0f, 0x0f, "Fastest" }, - - {0 , 0xfe, 0 , 4 , "Credits B" }, - {0x0b, 0x01, 0x30, 0x00, "x1" }, - {0x0b, 0x01, 0x30, 0x10, "x2" }, - {0x0b, 0x01, 0x30, 0x20, "x3" }, - {0x0b, 0x01, 0x30, 0x30, "x4" }, -}; - -STDDIPINFO(Diamond) - -static struct BurnRomInfo DrvRomDesc[] = { - { "gg4.bin", 0x04000, 0x66606beb, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "gg3.bin", 0x08000, 0x9e01c65e, BRF_ESS | BRF_PRG }, // 1 - { "gg5.bin", 0x08000, 0xd6397b2b, BRF_ESS | BRF_PRG }, // 2 - - { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters - - { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles - { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 - { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 - { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 - { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 - { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 - - { "gg17.bin", 0x04000, 0x93e50a8f, BRF_GRA }, // 11 Sprites - { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 - { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 - { "gg14.bin", 0x04000, 0x6aaf12f9, BRF_GRA }, // 14 - { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 - { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 - - { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs - { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 - - { "gg-pal10l8.bin",0x0002c, 0x87f1b7e0, BRF_GRA }, // 19 PLDs -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo DrvaRomDesc[] = { - { "gng.n10", 0x04000, 0x60343188, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "gng.n9", 0x04000, 0xb6b91cfb, BRF_ESS | BRF_PRG }, // 1 - { "gng.n8", 0x04000, 0xa5cfa928, BRF_ESS | BRF_PRG }, // 2 - { "gng.n13", 0x04000, 0xfd9a8dda, BRF_ESS | BRF_PRG }, // 3 - { "gng.n12", 0x04000, 0x13cf6238, BRF_ESS | BRF_PRG }, // 4 - - { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 5 Z80 Program - - { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 6 Characters - - { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 7 Tiles - { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 8 - { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 9 - { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 10 - { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 11 - { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 12 - - { "gg17.bin", 0x04000, 0x93e50a8f, BRF_GRA }, // 13 Sprites - { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 14 - { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 15 - { "gg14.bin", 0x04000, 0x6aaf12f9, BRF_GRA }, // 16 - { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 17 - { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 18 - - { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 19 PROMs - { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 20 -}; - -STD_ROM_PICK(Drva) -STD_ROM_FN(Drva) - -static struct BurnRomInfo DrvcRomDesc[] = { - { "mm_c_04", 0x04000, 0x4f94130f, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "mm_c_03", 0x08000, 0x1def138a, BRF_ESS | BRF_PRG }, // 1 - { "mm_c_05", 0x08000, 0xed28e86e, BRF_ESS | BRF_PRG }, // 2 - - { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters - - { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles - { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 - { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 - { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 - { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 - { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 - - { "gg17.bin", 0x04000, 0x93e50a8f, BRF_GRA }, // 11 Sprites - { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 - { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 - { "gg14.bin", 0x04000, 0x6aaf12f9, BRF_GRA }, // 14 - { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 - { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 - - { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs - { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 -}; - -STD_ROM_PICK(Drvc) -STD_ROM_FN(Drvc) - -static struct BurnRomInfo DrvblRomDesc[] = { - { "5.84490.10n", 0x04000, 0x66606beb, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "4.84490.9n", 0x04000, 0x527f5c39, BRF_ESS | BRF_PRG }, // 1 - { "3.84490.8n", 0x04000, 0x1c5175d5, BRF_ESS | BRF_PRG }, // 2 - { "7.84490.13n", 0x04000, 0xfd9a8dda, BRF_ESS | BRF_PRG }, // 3 - { "6.84490.12n", 0x04000, 0xc83dbd10, BRF_ESS | BRF_PRG }, // 4 - - { "2.8529.13h", 0x08000, 0x55cfb196, BRF_ESS | BRF_PRG }, // 5 Z80 Program - - { "1.84490.11e", 0x04000, 0xecfccf07, BRF_GRA }, // 6 Characters - - { "13.84490.3e", 0x04000, 0xddd56fa9, BRF_GRA }, // 7 Tiles - { "12.84490.1e", 0x04000, 0x7302529d, BRF_GRA }, // 8 - { "11.84490.3c", 0x04000, 0x20035bda, BRF_GRA }, // 9 - { "10.84490.1c", 0x04000, 0xf12ba271, BRF_GRA }, // 10 - { "9.84490.3b", 0x04000, 0xe525207d, BRF_GRA }, // 11 - { "8.84490.1b", 0x04000, 0x2d77e9b2, BRF_GRA }, // 12 - - { "19.84472.4n", 0x04000, 0x4613afdc, BRF_GRA }, // 13 Sprites - { "18.84472.3n", 0x04000, 0x06d7e5ca, BRF_GRA }, // 14 - { "17.84472.1n", 0x04000, 0xbc1fe02d, BRF_GRA }, // 15 - { "16.84472.4l", 0x04000, 0x608d68d5, BRF_GRA }, // 16 - { "15.84490.3l", 0x04000, 0xe80c3fca, BRF_GRA }, // 17 - { "14.84490.1l", 0x04000, 0x7780a925, BRF_GRA }, // 18 -}; - -STD_ROM_PICK(Drvbl) -STD_ROM_FN(Drvbl) - -static struct BurnRomInfo DrvblitaRomDesc[] = { - { "3", 0x04000, 0x4859d068, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "4-5", 0x08000, 0x233a4589, BRF_ESS | BRF_PRG }, // 1 - { "1-2", 0x08000, 0xed28e86e, BRF_ESS | BRF_PRG }, // 2 - - { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters - - { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles - { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 - { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 - { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 - { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 - { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 - - { "gg17.bin", 0x04000, 0x93e50a8f, BRF_GRA }, // 11 Sprites - { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 - { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 - { "gg14.bin", 0x04000, 0x6aaf12f9, BRF_GRA }, // 14 - { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 - { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 - - { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs - { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 - - { "gg-pal10l8.bin",0x0002c, 0x87f1b7e0, BRF_GRA }, // 19 PLDs -}; - -STD_ROM_PICK(Drvblita) -STD_ROM_FN(Drvblita) - -static struct BurnRomInfo DrvprotRomDesc[] = { - { "gg10n.bin", 0x04000, 0x5d2a2c90, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "gg9n.bin", 0x04000, 0x30eb183d, BRF_ESS | BRF_PRG }, // 1 - { "gg8n.bin", 0x04000, 0x4b5e2145, BRF_ESS | BRF_PRG }, // 2 - { "gg13n.bin", 0x04000, 0x2664aae6, BRF_ESS | BRF_PRG }, // 3 - { "gg12n.bin", 0x04000, 0xc7ef4ae8, BRF_ESS | BRF_PRG }, // 4 - - { "gg14h.bin", 0x08000, 0x55cfb196, BRF_ESS | BRF_PRG }, // 5 Z80 Program - - { "1.84490.11e", 0x04000, 0xecfccf07, BRF_GRA }, // 6 Characters - - { "gg3e.bin", 0x04000, 0x68db22c8, BRF_GRA }, // 7 Tiles - { "gg1e.bin", 0x04000, 0xdad8dd2f, BRF_GRA }, // 8 - { "gg3c.bin", 0x04000, 0x7a158323, BRF_GRA }, // 9 - { "gg1c.bin", 0x04000, 0x7314d095, BRF_GRA }, // 10 - { "gg3b.bin", 0x04000, 0x03a96d9b, BRF_GRA }, // 11 - { "gg1b.bin", 0x04000, 0x7b9899bc, BRF_GRA }, // 12 - - { "gg41.bin", 0x04000, 0x49cf81b4, BRF_GRA }, // 13 Sprites - { "gg31.bin", 0x04000, 0xe61437b1, BRF_GRA }, // 14 - { "gg11.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 15 - { "gg4n.bin", 0x04000, 0xd5aff5a7, BRF_GRA }, // 16 - { "gg3n.bin", 0x04000, 0xd589caeb, BRF_GRA }, // 17 - { "gg1n.bin", 0x04000, 0x7780a925, BRF_GRA }, // 18 -}; - -STD_ROM_PICK(Drvprot) -STD_ROM_FN(Drvprot) - -static struct BurnRomInfo DrvtRomDesc[] = { - { "mm04", 0x04000, 0x652406f6, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "mm03", 0x08000, 0xfb040b42, BRF_ESS | BRF_PRG }, // 1 - { "mm05", 0x08000, 0x8f7cff61, BRF_ESS | BRF_PRG }, // 2 - - { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters - - { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles - { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 - { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 - { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 - { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 - { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 - - { "gg17.bin", 0x04000, 0x93e50a8f, BRF_GRA }, // 11 Sprites - { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 - { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 - { "gg14.bin", 0x04000, 0x6aaf12f9, BRF_GRA }, // 14 - { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 - { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 - - { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs - { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 -}; - -STD_ROM_PICK(Drvt) -STD_ROM_FN(Drvt) - -static struct BurnRomInfo MakaimurRomDesc[] = { - { "10n.rom", 0x04000, 0x81e567e0, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "8n.rom", 0x08000, 0x9612d66c, BRF_ESS | BRF_PRG }, // 1 - { "12n.rom", 0x08000, 0x65a6a97b, BRF_ESS | BRF_PRG }, // 2 - - { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters - - { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles - { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 - { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 - { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 - { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 - { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 - - { "gng13.n4", 0x04000, 0x4613afdc, BRF_GRA }, // 11 Sprites - { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 - { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 - { "gng16.l4", 0x04000, 0x608d68d5, BRF_GRA }, // 14 - { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 - { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 - - { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs - { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 -}; - -STD_ROM_PICK(Makaimur) -STD_ROM_FN(Makaimur) - -static struct BurnRomInfo MakaimucRomDesc[] = { - { "mj04c.bin", 0x04000, 0x1294edb1, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "mj03c.bin", 0x08000, 0xd343332d, BRF_ESS | BRF_PRG }, // 1 - { "mj05c.bin", 0x08000, 0x535342c2, BRF_ESS | BRF_PRG }, // 2 - - { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters - - { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles - { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 - { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 - { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 - { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 - { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 - - { "gng13.n4", 0x04000, 0x4613afdc, BRF_GRA }, // 11 Sprites - { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 - { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 - { "gng16.l4", 0x04000, 0x608d68d5, BRF_GRA }, // 14 - { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 - { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 - - { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs - { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 -}; - -STD_ROM_PICK(Makaimuc) -STD_ROM_FN(Makaimuc) - -static struct BurnRomInfo MakaimugRomDesc[] = { - { "mj04g.bin", 0x04000, 0x757c94d3, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "mj03g.bin", 0x08000, 0x61b043bb, BRF_ESS | BRF_PRG }, // 1 - { "mj05g.bin", 0x08000, 0xf2fdccf5, BRF_ESS | BRF_PRG }, // 2 - - { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters - - { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles - { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 - { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 - { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 - { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 - { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 - - { "gng13.n4", 0x04000, 0x4613afdc, BRF_GRA }, // 11 Sprites - { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 - { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 - { "gng16.l4", 0x04000, 0x608d68d5, BRF_GRA }, // 14 - { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 - { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 - - { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs - { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 -}; - -STD_ROM_PICK(Makaimug) -STD_ROM_FN(Makaimug) - -static struct BurnRomInfo DiamondRomDesc[] = { - { "d3o", 0x04000, 0xba4bf9f1, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code - { "d3", 0x08000, 0xf436d6fa, BRF_ESS | BRF_PRG }, // 1 - { "d5o", 0x08000, 0xae58bd3a, BRF_ESS | BRF_PRG }, // 2 - { "d5", 0x08000, 0x453f3f9e, BRF_ESS | BRF_PRG }, // 3 - - { "d2", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "d1", 0x04000, 0x3a24e504, BRF_GRA }, // 5 Characters - - { "d11", 0x04000, 0x754357d7, BRF_GRA }, // 6 Tiles - { "d10", 0x04000, 0x7531edcd, BRF_GRA }, // 7 - { "d9", 0x04000, 0x22eeca08, BRF_GRA }, // 8 - { "d8", 0x04000, 0x6b61be60, BRF_GRA }, // 9 - { "d7", 0x04000, 0xfd595274, BRF_GRA }, // 10 - { "d6", 0x04000, 0x7f51dcd2, BRF_GRA }, // 11 - - { "d17", 0x04000, 0x8164b005, BRF_GRA }, // 12 Sprites - { "d14", 0x04000, 0x6f132163, BRF_GRA }, // 13 - - { "prom1", 0x00100, 0x0eaf5158, BRF_GRA }, // 14 PROMs - { "prom2", 0x00100, 0x4a1285a4, BRF_GRA }, // 15 -}; - -STD_ROM_PICK(Diamond) -STD_ROM_FN(Diamond) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvM6809Rom = Next; Next += 0x14000; - DrvZ80Rom = Next; Next += 0x08000; - - RamStart = Next; - - DrvM6809Ram = Next; Next += 0x01e00; - DrvZ80Ram = Next; Next += 0x00800; - DrvSpriteRam = Next; Next += 0x00200; - DrvSpriteRamBuffer = Next; Next += 0x00200; - DrvFgVideoRam = Next; Next += 0x00800; - DrvBgVideoRam = Next; Next += 0x00800; - DrvPaletteRam1 = Next; Next += 0x00100; - DrvPaletteRam2 = Next; Next += 0x00100; - - RamEnd = Next; - - DrvChars = Next; Next += 0x400 * 8 * 8; - DrvTiles = Next; Next += 0x400 * 16 * 16; - DrvSprites = Next; Next += 0x400 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00100 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - M6809Open(0); - M6809Reset(); - M6809Close(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - - DrvRomBank = 0; - DrvBgScrollX[0] = DrvBgScrollX[1] = 0; - DrvBgScrollY[0] = DrvBgScrollY[1] = 0; - DrvSoundLatch = 0; - - return 0; -} - -UINT8 DrvGngM6809ReadByte(UINT16 Address) -{ - switch (Address) { - case 0x3000: { - return 0xff - DrvInput[0]; - } - - case 0x3001: { - return 0xff - DrvInput[1]; - } - - case 0x3002: { - return 0xff - DrvInput[2]; - } - - case 0x3003: { - return DrvDip[0]; - } - - case 0x3004: { - return DrvDip[1]; - } - - case 0x3c00: { - // nop - return 0; - } - } - - bprintf(PRINT_NORMAL, _T("M6809 Read Byte -> %04X\n"), Address); - - return 0; -} - - -void DrvGngM6809WriteByte(UINT16 Address, UINT8 Data) -{ - switch (Address) { - case 0x3a00: { - DrvSoundLatch = Data; - return; - } - - case 0x3b08: { - DrvBgScrollX[0] = Data; - return; - } - - case 0x3b09: { - DrvBgScrollX[1] = Data; - return; - } - - case 0x3b0a: { - DrvBgScrollY[0] = Data; - return; - } - - case 0x3b0b: { - DrvBgScrollY[1] = Data; - return; - } - - case 0x3c00: { - // nop - return; - } - - case 0x3d00: { - // flipscreen - return; - } - - case 0x3d01: { - // ??? - return; - } - - case 0x3e00: { - DrvRomBank = Data & 3; - if (Data == 4) { - DrvRomBank = 4; - M6809MapMemory(DrvM6809Rom, 0x4000, 0x5fff, M6809_ROM); - } else { - M6809MapMemory(DrvM6809Rom + 0xc000 + (DrvRomBank * 0x2000), 0x4000, 0x5fff, M6809_ROM); - } - return; - } - } - - bprintf(PRINT_NORMAL, _T("M6809 Write Byte -> %04X, %02X\n"), Address, Data); -} - -UINT8 __fastcall DrvGngZ80Read(UINT16 a) -{ - switch (a) { - case 0xc800: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall DrvGngZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0xe001: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0xe002: { - BurnYM2203Write(1, 0, d); - return; - } - - case 0xe003: { - BurnYM2203Write(1, 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 CharPlaneOffsets[2] = { 4, 0 }; -static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; -static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; -static INT32 TilePlaneOffsets[3] = { 0x80000, 0x40000, 0 }; -static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; -static INT32 SpritePlaneOffsets[4] = { 0x80004, 0x80000, 4, 0 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; -static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3000000; -} - -static INT32 DrvInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x20000); - - // Load M6809 Program Roms - if (RomLoadOffset == 2) { - nRet = BurnLoadRom(DrvM6809Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvM6809Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvM6809Rom + 0x08000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvM6809Rom + 0x0c000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvM6809Rom + 0x10000, 4, 1); if (nRet != 0) return 1; - } else { - nRet = BurnLoadRom(DrvM6809Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvM6809Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvM6809Rom + 0x0c000, 2, 1); if (nRet != 0) return 1; - } - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 3 + RomLoadOffset, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 4 + RomLoadOffset, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x20000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5 + RomLoadOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 6 + RomLoadOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 7 + RomLoadOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c000, 8 + RomLoadOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 9 + RomLoadOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x14000, 10 + RomLoadOffset, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 3, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0xff, 0x20000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 11 + RomLoadOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 12 + RomLoadOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 13 + RomLoadOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 14 + RomLoadOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x14000, 15 + RomLoadOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x18000, 16 + RomLoadOffset, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - // Setup the M6809 emulation - M6809Init(1); - M6809Open(0); - M6809MapMemory(DrvM6809Ram , 0x0000, 0x1dff, M6809_RAM); - M6809MapMemory(DrvSpriteRam , 0x1e00, 0x1fff, M6809_RAM); - M6809MapMemory(DrvFgVideoRam , 0x2000, 0x27ff, M6809_RAM); - M6809MapMemory(DrvBgVideoRam , 0x2800, 0x2fff, M6809_RAM); - M6809MapMemory(DrvPaletteRam2 , 0x3800, 0x38ff, M6809_RAM); - M6809MapMemory(DrvPaletteRam1 , 0x3900, 0x39ff, M6809_RAM); - M6809MapMemory(DrvM6809Rom , 0x4000, 0x5fff, M6809_ROM); - M6809MapMemory(DrvM6809Rom + 0x2000 , 0x6000, 0xffff, M6809_ROM); - M6809SetReadHandler(DrvGngM6809ReadByte); - M6809SetWriteHandler(DrvGngM6809WriteByte); - M6809Close(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(DrvGngZ80Read); - ZetSetWriteHandler(DrvGngZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 DiamondInit() -{ - INT32 nRet = 0, nLen; - - Diamond = 1; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x20000); - - // Load M6809 Program Roms - nRet = BurnLoadRom(DrvM6809Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvM6809Rom + 0x04000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvM6809Rom + 0x0c000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvM6809Rom + 0x14000, 3, 1); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x20000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x14000, 11, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 3, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0xff, 0x20000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 13 + RomLoadOffset, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - // Setup the M6809 emulation - M6809Init(1); - M6809Open(0); - M6809MapMemory(DrvM6809Ram , 0x0000, 0x1dff, M6809_RAM); - M6809MapMemory(DrvSpriteRam , 0x1e00, 0x1fff, M6809_RAM); - M6809MapMemory(DrvFgVideoRam , 0x2000, 0x27ff, M6809_RAM); - M6809MapMemory(DrvBgVideoRam , 0x2800, 0x2fff, M6809_RAM); - M6809MapMemory(DrvPaletteRam2 , 0x3800, 0x38ff, M6809_RAM); - M6809MapMemory(DrvPaletteRam1 , 0x3900, 0x39ff, M6809_RAM); - M6809MapMemory(DrvM6809Rom , 0x4000, 0x5fff, M6809_ROM); - M6809MapMemory(DrvM6809Rom + 0x2000 , 0x6000, 0xffff, M6809_ROM); - M6809SetReadHandler(DrvGngM6809ReadByte); - M6809SetWriteHandler(DrvGngM6809WriteByte); - M6809Close(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(DrvGngZ80Read); - ZetSetWriteHandler(DrvGngZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvM6809Rom[0x2000] = 0; - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 GngaInit() -{ - RomLoadOffset = 2; - - return DrvInit(); -} - -static INT32 DrvExit() -{ - M6809Exit(); - ZetExit(); - - BurnYM2203Exit(); - - GenericTilesExit(); - - BurnFree(Mem); - - DrvRomBank = 0; - DrvBgScrollX[0] = DrvBgScrollX[1] = 0; - DrvBgScrollY[0] = DrvBgScrollY[1] = 0; - DrvSoundLatch = 0; - - RomLoadOffset = 0; - Diamond = 0; - - return 0; -} - -static inline UINT8 pal4bit(UINT8 bits) -{ - bits &= 0x0f; - return (bits << 4) | bits; -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(nColour >> 12); - g = pal4bit(nColour >> 8); - b = pal4bit(nColour >> 4); - - return BurnHighCol(r, g, b, 0); -} - -static void DrvCalcPalette() -{ - for (INT32 i = 0; i < 0x100; i++) { - INT32 Val = DrvPaletteRam1[i] + (DrvPaletteRam2[i] << 8); - - DrvPalette[i] = CalcCol(Val); - } -} - -static void DrvRenderBgLayer(INT32 Priority, INT32 Opaque) -{ - INT32 mx, my, Code, Attr, Colour, x, y, TileIndex, xScroll, yScroll, Split, Flip, xFlip, yFlip; - - xScroll = DrvBgScrollX[0] | (DrvBgScrollX[1] << 8); - xScroll &= 0x1ff; - - yScroll = DrvBgScrollY[0] | (DrvBgScrollY[1] << 8); - yScroll &= 0x1ff; - - for (mx = 0; mx < 32; mx++) { - for (my = 0; my < 32; my++) { - TileIndex = (my * 32) + mx; - - Attr = DrvBgVideoRam[TileIndex + 0x400]; - Code = DrvBgVideoRam[TileIndex + 0x000]; - - Code += (Attr & 0xc0) << 2; - Colour = Attr & 0x07; - - Split = (Attr & 0x08) >> 3; - - if (Split != Priority) continue; - - Flip = (Attr & 0x30) >> 4; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - - y = 16 * mx; - x = 16 * my; - - x -= xScroll; - if (x < -16) x += 512; - y -= yScroll; - if (y < -16) y += 512; - - y -= 16; - - if (Opaque) { - if (x > 16 && x < 240 && y > 16 && y < 208) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } else { - Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } else { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } else { - Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); - } - } - } - } else { - if (x > 16 && x < 240 && y > 16 && y < 208) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); - } - } - } - } - } - } -} - -static void DrvRenderSprites() -{ - for (INT32 Offs = 0x200 - 4; Offs >= 0; Offs -= 4) { - UINT8 Attr = DrvSpriteRamBuffer[Offs + 1]; - INT32 sx = DrvSpriteRamBuffer[Offs + 3] - (0x100 * (Attr & 0x01)); - INT32 sy = DrvSpriteRamBuffer[Offs + 2]; - INT32 xFlip = Attr & 0x04; - INT32 yFlip = Attr & 0x08; - INT32 Code = DrvSpriteRamBuffer[Offs + 0] + ((Attr << 2) & 0x300); - INT32 Colour = (Attr >> 4) & 3; - - if (sx > 16 && sx < 240 && sy > 16 && sy < 208) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); - } else { - Render16x16Tile_Mask(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); - } - } - } - } -} - -static void DrvRenderCharLayer() -{ - INT32 mx, my, Code, Attr, Colour, x, y, TileIndex = 0, Flip, xFlip, yFlip; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Attr = DrvFgVideoRam[TileIndex + 0x400]; - Code = DrvFgVideoRam[TileIndex + 0x000]; - - Code += (Attr & 0xc0) << 2; - Colour = Attr & 0x0f; - - Flip = (Attr & 0x30) >> 4; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - - x = 8 * mx; - y = 8 * my; - - y -= 16; - - if (x > 8 && x < 248 && y > 8 && y < 216) { - if (xFlip) { - if (yFlip) { - Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); - } else { - Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); - } - } else { - if (yFlip) { - Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); - } else { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); - } else { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); - } - } else { - if (yFlip) { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); - } - } - } - - TileIndex++; - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - DrvRenderBgLayer(0, 1); - DrvRenderSprites(); - DrvRenderBgLayer(1, 0); - DrvRenderCharLayer(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 25; - INT32 nSoundBufferPos = 0; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 1500000 / 60; - nCyclesTotal[1] = 3000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run M6809 - nCurrentCPU = 0; - M6809Open(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += M6809Run(nCyclesSegment); - if (i == 24) { - M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); - } - M6809Close(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - if (i == 5 || i == 10 || i == 15 || i == 20) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == 6 || i == 11 || i == 16 || i == 21) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - ZetOpen(0); - BurnYM2203Update(pSoundBuf, nSegmentLength); - ZetClose(); - nSoundBufferPos += nSegmentLength; - } - } - - ZetOpen(0); - BurnTimerEndFrame(nCyclesTotal[1]); - ZetClose(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - ZetOpen(0); - BurnYM2203Update(pSoundBuf, nSegmentLength); - ZetClose(); - } - } - - if (pBurnDraw) DrvDraw(); - - memcpy(DrvSpriteRamBuffer, DrvSpriteRam, 0x200); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029696; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - M6809Scan(nAction); - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(DrvRomBank); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(DrvBgScrollX); - SCAN_VAR(DrvBgScrollY); - SCAN_VAR(DrvDip); - SCAN_VAR(DrvInput); - } - - return 0; -} - -struct BurnDriver BurnDrvGng = { - "gng", NULL, NULL, NULL, "1985", - "Ghosts'n Goblins (World? set 1)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGnga = { - "gnga", "gng", NULL, NULL, "1985", - "Ghosts'n Goblins (World? set 2)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, DrvaRomInfo, DrvaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - GngaInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGngbl = { - "gngbl", "gng", NULL, NULL, "1985", - "Ghosts'n Goblins (bootleg with Cross)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, DrvblRomInfo, DrvblRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - GngaInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGngblita = { - "gngblita", "gng", NULL, NULL, "1985", - "Ghosts'n Goblins (Italian bootleg, harder)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, DrvblitaRomInfo, DrvblitaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGngprot = { - "gngprot", "gng", NULL, NULL, "1985", - "Ghosts'n Goblins (prototype)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, DrvprotRomInfo, DrvprotRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - GngaInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGngt = { - "gngt", "gng", NULL, NULL, "1985", - "Ghosts'n Goblins (US)\0", NULL, "Capcom (Taito America License)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, DrvtRomInfo, DrvtRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGngc = { - "gngc", "gng", NULL, NULL, "1985", - "Ghosts'n Goblins (World Revision C)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, DrvcRomInfo, DrvcRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMakaimur = { - "makaimur", "gng", NULL, NULL, "1985", - "Makai-Mura (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, MakaimurRomInfo, MakaimurRomName, NULL, NULL, DrvInputInfo, DrvjDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMakaimuc = { - "makaimurc", "gng", NULL, NULL, "1985", - "Makai-Mura (Japan revision C)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, MakaimucRomInfo, MakaimucRomName, NULL, NULL, DrvInputInfo, DrvjDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMakaimug = { - "makaimurg", "gng", NULL, NULL, "1985", - "Makai-Mura (Japan revision G)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, MakaimugRomInfo, MakaimugRomName, NULL, NULL, DrvInputInfo, DrvjDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDiamond = { - "diamond", NULL, NULL, NULL, "1985", - "Diamond Run\0", NULL, "KH Video", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, - NULL, DiamondRomInfo, DiamondRomName, NULL, NULL, DiamondInputInfo, DiamondDIPInfo, - DiamondInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "m6809_intf.h" +#include "burn_ym2203.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[2] = {0, 0}; +static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *DrvM6809Rom = NULL; +static UINT8 *DrvZ80Rom = NULL; +static UINT8 *DrvM6809Ram = NULL; +static UINT8 *DrvZ80Ram = NULL; +static UINT8 *DrvFgVideoRam = NULL; +static UINT8 *DrvBgVideoRam = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvSpriteRamBuffer = NULL; +static UINT8 *DrvPaletteRam1 = NULL; +static UINT8 *DrvPaletteRam2 = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT8 DrvRomBank; +static UINT8 DrvBgScrollX[2]; +static UINT8 DrvBgScrollY[2]; +static UINT8 DrvSoundLatch; + +static INT32 RomLoadOffset = 0; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static INT32 Diamond; + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 7, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, + {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 5, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo DiamondInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 7, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 up" }, + {"Down" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 1" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Diamond) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + } + + // Clear Opposites + DrvClearOpposites(&DrvInput[1]); + DrvClearOpposites(&DrvInput[2]); +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xdf, NULL }, + {0x13, 0xff, 0xff, 0xfb, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 16 , "Coinage" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Plays" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Plays" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Plays" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Plays" }, + {0x12, 0x01, 0x0f, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 2 , "Coinage affects" }, + {0x12, 0x01, 0x10, 0x10, "Coin A" }, + {0x12, 0x01, 0x10, 0x00, "Coin B" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x04, 0x00, "Upright" }, + {0x13, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "20k 70k 70k" }, + {0x13, 0x01, 0x18, 0x10, "30k 80k 80k" }, + {0x13, 0x01, 0x18, 0x08, "20k 80k" }, + {0x13, 0x01, 0x18, 0x00, "30k 80k" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x60, 0x40, "Easy" }, + {0x13, 0x01, 0x60, 0x60, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, +}; + +STDDIPINFO(Drv) + +static struct BurnDIPInfo DrvjDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xdf, NULL }, + {0x13, 0xff, 0xff, 0xfb, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 16 , "Coinage" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Plays" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Plays" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Plays" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Plays" }, + {0x12, 0x01, 0x0f, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 2 , "Coinage affects" }, + {0x12, 0x01, 0x10, 0x10, "Coin A" }, + {0x12, 0x01, 0x10, 0x00, "Coin B" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x04, 0x00, "Upright" }, + {0x13, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "20k 70k 70k" }, + {0x13, 0x01, 0x18, 0x10, "30k 80k 80k" }, + {0x13, 0x01, 0x18, 0x08, "20k 80k" }, + {0x13, 0x01, 0x18, 0x00, "30k 80k" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x60, 0x40, "Easy" }, + {0x13, 0x01, 0x60, 0x60, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Difficult" }, + {0x13, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Drvj) + +static struct BurnDIPInfo DiamondDIPList[]= +{ + // Default Values + {0x0a, 0xff, 0xff, 0x81, NULL }, + {0x0b, 0xff, 0xff, 0x07, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0a, 0x01, 0x03, 0x00, "2" }, + {0x0a, 0x01, 0x03, 0x01, "3" }, + {0x0a, 0x01, 0x03, 0x02, "4" }, + {0x0a, 0x01, 0x03, 0x03, "5" }, + + {0 , 0xfe, 0 , 4 , "Credits A" }, + {0x0a, 0x01, 0x0c, 0x00, "x1" }, + {0x0a, 0x01, 0x0c, 0x04, "x2" }, + {0x0a, 0x01, 0x0c, 0x08, "x3" }, + {0x0a, 0x01, 0x0c, 0x0c, "x4" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0a, 0x01, 0x30, 0x30, "4 Coins 1 Play" }, + {0x0a, 0x01, 0x30, 0x20, "3 Coins 1 Play" }, + {0x0a, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, + {0x0a, 0x01, 0x30, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0a, 0x01, 0x80, 0x80, "Off" }, + {0x0a, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Energy Loss" }, + {0x0b, 0x01, 0x0f, 0x00, "Slowest" }, + {0x0b, 0x01, 0x0f, 0x01, "-6 Slower" }, + {0x0b, 0x01, 0x0f, 0x02, "-5 Slower" }, + {0x0b, 0x01, 0x0f, 0x03, "-4 Slower" }, + {0x0b, 0x01, 0x0f, 0x04, "-3 Slower" }, + {0x0b, 0x01, 0x0f, 0x05, "-2 Slower" }, + {0x0b, 0x01, 0x0f, 0x06, "-1 Slower" }, + {0x0b, 0x01, 0x0f, 0x07, "Normal" }, + {0x0b, 0x01, 0x0f, 0x08, "+1 Faster" }, + {0x0b, 0x01, 0x0f, 0x09, "+2 Faster" }, + {0x0b, 0x01, 0x0f, 0x0a, "+3 Faster" }, + {0x0b, 0x01, 0x0f, 0x0b, "+4 Faster" }, + {0x0b, 0x01, 0x0f, 0x0c, "+5 Faster" }, + {0x0b, 0x01, 0x0f, 0x0d, "+6 Faster" }, + {0x0b, 0x01, 0x0f, 0x0e, "+7 Faster" }, + {0x0b, 0x01, 0x0f, 0x0f, "Fastest" }, + + {0 , 0xfe, 0 , 4 , "Credits B" }, + {0x0b, 0x01, 0x30, 0x00, "x1" }, + {0x0b, 0x01, 0x30, 0x10, "x2" }, + {0x0b, 0x01, 0x30, 0x20, "x3" }, + {0x0b, 0x01, 0x30, 0x30, "x4" }, +}; + +STDDIPINFO(Diamond) + +static struct BurnRomInfo DrvRomDesc[] = { + { "gg4.bin", 0x04000, 0x66606beb, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "gg3.bin", 0x08000, 0x9e01c65e, BRF_ESS | BRF_PRG }, // 1 + { "gg5.bin", 0x08000, 0xd6397b2b, BRF_ESS | BRF_PRG }, // 2 + + { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters + + { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles + { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 + { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 + { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 + { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 + { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 + + { "gg17.bin", 0x04000, 0x93e50a8f, BRF_GRA }, // 11 Sprites + { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 + { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 + { "gg14.bin", 0x04000, 0x6aaf12f9, BRF_GRA }, // 14 + { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 + { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 + + { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs + { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 + + { "gg-pal10l8.bin",0x0002c, 0x87f1b7e0, BRF_GRA }, // 19 PLDs +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo DrvaRomDesc[] = { + { "gng.n10", 0x04000, 0x60343188, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "gng.n9", 0x04000, 0xb6b91cfb, BRF_ESS | BRF_PRG }, // 1 + { "gng.n8", 0x04000, 0xa5cfa928, BRF_ESS | BRF_PRG }, // 2 + { "gng.n13", 0x04000, 0xfd9a8dda, BRF_ESS | BRF_PRG }, // 3 + { "gng.n12", 0x04000, 0x13cf6238, BRF_ESS | BRF_PRG }, // 4 + + { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 5 Z80 Program + + { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 6 Characters + + { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 7 Tiles + { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 8 + { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 9 + { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 10 + { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 11 + { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 12 + + { "gg17.bin", 0x04000, 0x93e50a8f, BRF_GRA }, // 13 Sprites + { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 14 + { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 15 + { "gg14.bin", 0x04000, 0x6aaf12f9, BRF_GRA }, // 16 + { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 17 + { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 18 + + { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 19 PROMs + { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 20 +}; + +STD_ROM_PICK(Drva) +STD_ROM_FN(Drva) + +static struct BurnRomInfo DrvcRomDesc[] = { + { "mm_c_04", 0x04000, 0x4f94130f, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "mm_c_03", 0x08000, 0x1def138a, BRF_ESS | BRF_PRG }, // 1 + { "mm_c_05", 0x08000, 0xed28e86e, BRF_ESS | BRF_PRG }, // 2 + + { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters + + { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles + { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 + { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 + { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 + { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 + { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 + + { "gg17.bin", 0x04000, 0x93e50a8f, BRF_GRA }, // 11 Sprites + { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 + { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 + { "gg14.bin", 0x04000, 0x6aaf12f9, BRF_GRA }, // 14 + { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 + { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 + + { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs + { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 +}; + +STD_ROM_PICK(Drvc) +STD_ROM_FN(Drvc) + +static struct BurnRomInfo DrvblRomDesc[] = { + { "5.84490.10n", 0x04000, 0x66606beb, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "4.84490.9n", 0x04000, 0x527f5c39, BRF_ESS | BRF_PRG }, // 1 + { "3.84490.8n", 0x04000, 0x1c5175d5, BRF_ESS | BRF_PRG }, // 2 + { "7.84490.13n", 0x04000, 0xfd9a8dda, BRF_ESS | BRF_PRG }, // 3 + { "6.84490.12n", 0x04000, 0xc83dbd10, BRF_ESS | BRF_PRG }, // 4 + + { "2.8529.13h", 0x08000, 0x55cfb196, BRF_ESS | BRF_PRG }, // 5 Z80 Program + + { "1.84490.11e", 0x04000, 0xecfccf07, BRF_GRA }, // 6 Characters + + { "13.84490.3e", 0x04000, 0xddd56fa9, BRF_GRA }, // 7 Tiles + { "12.84490.1e", 0x04000, 0x7302529d, BRF_GRA }, // 8 + { "11.84490.3c", 0x04000, 0x20035bda, BRF_GRA }, // 9 + { "10.84490.1c", 0x04000, 0xf12ba271, BRF_GRA }, // 10 + { "9.84490.3b", 0x04000, 0xe525207d, BRF_GRA }, // 11 + { "8.84490.1b", 0x04000, 0x2d77e9b2, BRF_GRA }, // 12 + + { "19.84472.4n", 0x04000, 0x4613afdc, BRF_GRA }, // 13 Sprites + { "18.84472.3n", 0x04000, 0x06d7e5ca, BRF_GRA }, // 14 + { "17.84472.1n", 0x04000, 0xbc1fe02d, BRF_GRA }, // 15 + { "16.84472.4l", 0x04000, 0x608d68d5, BRF_GRA }, // 16 + { "15.84490.3l", 0x04000, 0xe80c3fca, BRF_GRA }, // 17 + { "14.84490.1l", 0x04000, 0x7780a925, BRF_GRA }, // 18 +}; + +STD_ROM_PICK(Drvbl) +STD_ROM_FN(Drvbl) + +static struct BurnRomInfo DrvblitaRomDesc[] = { + { "3", 0x04000, 0x4859d068, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "4-5", 0x08000, 0x233a4589, BRF_ESS | BRF_PRG }, // 1 + { "1-2", 0x08000, 0xed28e86e, BRF_ESS | BRF_PRG }, // 2 + + { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters + + { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles + { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 + { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 + { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 + { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 + { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 + + { "gg17.bin", 0x04000, 0x93e50a8f, BRF_GRA }, // 11 Sprites + { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 + { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 + { "gg14.bin", 0x04000, 0x6aaf12f9, BRF_GRA }, // 14 + { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 + { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 + + { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs + { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 + + { "gg-pal10l8.bin",0x0002c, 0x87f1b7e0, BRF_GRA }, // 19 PLDs +}; + +STD_ROM_PICK(Drvblita) +STD_ROM_FN(Drvblita) + +static struct BurnRomInfo DrvprotRomDesc[] = { + { "gg10n.bin", 0x04000, 0x5d2a2c90, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "gg9n.bin", 0x04000, 0x30eb183d, BRF_ESS | BRF_PRG }, // 1 + { "gg8n.bin", 0x04000, 0x4b5e2145, BRF_ESS | BRF_PRG }, // 2 + { "gg13n.bin", 0x04000, 0x2664aae6, BRF_ESS | BRF_PRG }, // 3 + { "gg12n.bin", 0x04000, 0xc7ef4ae8, BRF_ESS | BRF_PRG }, // 4 + + { "gg14h.bin", 0x08000, 0x55cfb196, BRF_ESS | BRF_PRG }, // 5 Z80 Program + + { "1.84490.11e", 0x04000, 0xecfccf07, BRF_GRA }, // 6 Characters + + { "gg3e.bin", 0x04000, 0x68db22c8, BRF_GRA }, // 7 Tiles + { "gg1e.bin", 0x04000, 0xdad8dd2f, BRF_GRA }, // 8 + { "gg3c.bin", 0x04000, 0x7a158323, BRF_GRA }, // 9 + { "gg1c.bin", 0x04000, 0x7314d095, BRF_GRA }, // 10 + { "gg3b.bin", 0x04000, 0x03a96d9b, BRF_GRA }, // 11 + { "gg1b.bin", 0x04000, 0x7b9899bc, BRF_GRA }, // 12 + + { "gg41.bin", 0x04000, 0x49cf81b4, BRF_GRA }, // 13 Sprites + { "gg31.bin", 0x04000, 0xe61437b1, BRF_GRA }, // 14 + { "gg11.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 15 + { "gg4n.bin", 0x04000, 0xd5aff5a7, BRF_GRA }, // 16 + { "gg3n.bin", 0x04000, 0xd589caeb, BRF_GRA }, // 17 + { "gg1n.bin", 0x04000, 0x7780a925, BRF_GRA }, // 18 +}; + +STD_ROM_PICK(Drvprot) +STD_ROM_FN(Drvprot) + +static struct BurnRomInfo DrvtRomDesc[] = { + { "mm04", 0x04000, 0x652406f6, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "mm03", 0x08000, 0xfb040b42, BRF_ESS | BRF_PRG }, // 1 + { "mm05", 0x08000, 0x8f7cff61, BRF_ESS | BRF_PRG }, // 2 + + { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters + + { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles + { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 + { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 + { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 + { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 + { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 + + { "gg17.bin", 0x04000, 0x93e50a8f, BRF_GRA }, // 11 Sprites + { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 + { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 + { "gg14.bin", 0x04000, 0x6aaf12f9, BRF_GRA }, // 14 + { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 + { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 + + { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs + { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 +}; + +STD_ROM_PICK(Drvt) +STD_ROM_FN(Drvt) + +static struct BurnRomInfo MakaimurRomDesc[] = { + { "10n.rom", 0x04000, 0x81e567e0, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "8n.rom", 0x08000, 0x9612d66c, BRF_ESS | BRF_PRG }, // 1 + { "12n.rom", 0x08000, 0x65a6a97b, BRF_ESS | BRF_PRG }, // 2 + + { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters + + { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles + { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 + { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 + { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 + { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 + { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 + + { "gng13.n4", 0x04000, 0x4613afdc, BRF_GRA }, // 11 Sprites + { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 + { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 + { "gng16.l4", 0x04000, 0x608d68d5, BRF_GRA }, // 14 + { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 + { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 + + { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs + { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 +}; + +STD_ROM_PICK(Makaimur) +STD_ROM_FN(Makaimur) + +static struct BurnRomInfo MakaimucRomDesc[] = { + { "mj04c.bin", 0x04000, 0x1294edb1, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "mj03c.bin", 0x08000, 0xd343332d, BRF_ESS | BRF_PRG }, // 1 + { "mj05c.bin", 0x08000, 0x535342c2, BRF_ESS | BRF_PRG }, // 2 + + { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters + + { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles + { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 + { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 + { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 + { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 + { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 + + { "gng13.n4", 0x04000, 0x4613afdc, BRF_GRA }, // 11 Sprites + { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 + { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 + { "gng16.l4", 0x04000, 0x608d68d5, BRF_GRA }, // 14 + { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 + { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 + + { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs + { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 +}; + +STD_ROM_PICK(Makaimuc) +STD_ROM_FN(Makaimuc) + +static struct BurnRomInfo MakaimugRomDesc[] = { + { "mj04g.bin", 0x04000, 0x757c94d3, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "mj03g.bin", 0x08000, 0x61b043bb, BRF_ESS | BRF_PRG }, // 1 + { "mj05g.bin", 0x08000, 0xf2fdccf5, BRF_ESS | BRF_PRG }, // 2 + + { "gg2.bin", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "gg1.bin", 0x04000, 0xecfccf07, BRF_GRA }, // 4 Characters + + { "gg11.bin", 0x04000, 0xddd56fa9, BRF_GRA }, // 5 Tiles + { "gg10.bin", 0x04000, 0x7302529d, BRF_GRA }, // 6 + { "gg9.bin", 0x04000, 0x20035bda, BRF_GRA }, // 7 + { "gg8.bin", 0x04000, 0xf12ba271, BRF_GRA }, // 8 + { "gg7.bin", 0x04000, 0xe525207d, BRF_GRA }, // 9 + { "gg6.bin", 0x04000, 0x2d77e9b2, BRF_GRA }, // 10 + + { "gng13.n4", 0x04000, 0x4613afdc, BRF_GRA }, // 11 Sprites + { "gg16.bin", 0x04000, 0x06d7e5ca, BRF_GRA }, // 12 + { "gg15.bin", 0x04000, 0xbc1fe02d, BRF_GRA }, // 13 + { "gng16.l4", 0x04000, 0x608d68d5, BRF_GRA }, // 14 + { "gg13.bin", 0x04000, 0xe80c3fca, BRF_GRA }, // 15 + { "gg12.bin", 0x04000, 0x7780a925, BRF_GRA }, // 16 + + { "tbp24s10.14k", 0x00100, 0x0eaf5158, BRF_GRA }, // 17 PROMs + { "63s141.2e", 0x00100, 0x4a1285a4, BRF_GRA }, // 18 +}; + +STD_ROM_PICK(Makaimug) +STD_ROM_FN(Makaimug) + +static struct BurnRomInfo DiamondRomDesc[] = { + { "d3o", 0x04000, 0xba4bf9f1, BRF_ESS | BRF_PRG }, // 0 M6809 Program Code + { "d3", 0x08000, 0xf436d6fa, BRF_ESS | BRF_PRG }, // 1 + { "d5o", 0x08000, 0xae58bd3a, BRF_ESS | BRF_PRG }, // 2 + { "d5", 0x08000, 0x453f3f9e, BRF_ESS | BRF_PRG }, // 3 + + { "d2", 0x08000, 0x615f5b6f, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "d1", 0x04000, 0x3a24e504, BRF_GRA }, // 5 Characters + + { "d11", 0x04000, 0x754357d7, BRF_GRA }, // 6 Tiles + { "d10", 0x04000, 0x7531edcd, BRF_GRA }, // 7 + { "d9", 0x04000, 0x22eeca08, BRF_GRA }, // 8 + { "d8", 0x04000, 0x6b61be60, BRF_GRA }, // 9 + { "d7", 0x04000, 0xfd595274, BRF_GRA }, // 10 + { "d6", 0x04000, 0x7f51dcd2, BRF_GRA }, // 11 + + { "d17", 0x04000, 0x8164b005, BRF_GRA }, // 12 Sprites + { "d14", 0x04000, 0x6f132163, BRF_GRA }, // 13 + + { "prom1", 0x00100, 0x0eaf5158, BRF_GRA }, // 14 PROMs + { "prom2", 0x00100, 0x4a1285a4, BRF_GRA }, // 15 +}; + +STD_ROM_PICK(Diamond) +STD_ROM_FN(Diamond) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvM6809Rom = Next; Next += 0x14000; + DrvZ80Rom = Next; Next += 0x08000; + + RamStart = Next; + + DrvM6809Ram = Next; Next += 0x01e00; + DrvZ80Ram = Next; Next += 0x00800; + DrvSpriteRam = Next; Next += 0x00200; + DrvSpriteRamBuffer = Next; Next += 0x00200; + DrvFgVideoRam = Next; Next += 0x00800; + DrvBgVideoRam = Next; Next += 0x00800; + DrvPaletteRam1 = Next; Next += 0x00100; + DrvPaletteRam2 = Next; Next += 0x00100; + + RamEnd = Next; + + DrvChars = Next; Next += 0x400 * 8 * 8; + DrvTiles = Next; Next += 0x400 * 16 * 16; + DrvSprites = Next; Next += 0x400 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00100 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + M6809Open(0); + M6809Reset(); + M6809Close(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + + DrvRomBank = 0; + DrvBgScrollX[0] = DrvBgScrollX[1] = 0; + DrvBgScrollY[0] = DrvBgScrollY[1] = 0; + DrvSoundLatch = 0; + + return 0; +} + +UINT8 DrvGngM6809ReadByte(UINT16 Address) +{ + switch (Address) { + case 0x3000: { + return 0xff - DrvInput[0]; + } + + case 0x3001: { + return 0xff - DrvInput[1]; + } + + case 0x3002: { + return 0xff - DrvInput[2]; + } + + case 0x3003: { + return DrvDip[0]; + } + + case 0x3004: { + return DrvDip[1]; + } + + case 0x3c00: { + // nop + return 0; + } + } + + bprintf(PRINT_NORMAL, _T("M6809 Read Byte -> %04X\n"), Address); + + return 0; +} + + +void DrvGngM6809WriteByte(UINT16 Address, UINT8 Data) +{ + switch (Address) { + case 0x3a00: { + DrvSoundLatch = Data; + return; + } + + case 0x3b08: { + DrvBgScrollX[0] = Data; + return; + } + + case 0x3b09: { + DrvBgScrollX[1] = Data; + return; + } + + case 0x3b0a: { + DrvBgScrollY[0] = Data; + return; + } + + case 0x3b0b: { + DrvBgScrollY[1] = Data; + return; + } + + case 0x3c00: { + // nop + return; + } + + case 0x3d00: { + // flipscreen + return; + } + + case 0x3d01: { + // ??? + return; + } + + case 0x3e00: { + DrvRomBank = Data & 3; + if (Data == 4) { + DrvRomBank = 4; + M6809MapMemory(DrvM6809Rom, 0x4000, 0x5fff, M6809_ROM); + } else { + M6809MapMemory(DrvM6809Rom + 0xc000 + (DrvRomBank * 0x2000), 0x4000, 0x5fff, M6809_ROM); + } + return; + } + } + + bprintf(PRINT_NORMAL, _T("M6809 Write Byte -> %04X, %02X\n"), Address, Data); +} + +UINT8 __fastcall DrvGngZ80Read(UINT16 a) +{ + switch (a) { + case 0xc800: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall DrvGngZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0xe001: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0xe002: { + BurnYM2203Write(1, 0, d); + return; + } + + case 0xe003: { + BurnYM2203Write(1, 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 CharPlaneOffsets[2] = { 4, 0 }; +static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; +static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; +static INT32 TilePlaneOffsets[3] = { 0x80000, 0x40000, 0 }; +static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; +static INT32 SpritePlaneOffsets[4] = { 0x80004, 0x80000, 4, 0 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; +static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3000000; +} + +static INT32 DrvInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x20000); + + // Load M6809 Program Roms + if (RomLoadOffset == 2) { + nRet = BurnLoadRom(DrvM6809Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvM6809Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvM6809Rom + 0x08000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvM6809Rom + 0x0c000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvM6809Rom + 0x10000, 4, 1); if (nRet != 0) return 1; + } else { + nRet = BurnLoadRom(DrvM6809Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvM6809Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvM6809Rom + 0x0c000, 2, 1); if (nRet != 0) return 1; + } + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 3 + RomLoadOffset, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 4 + RomLoadOffset, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x20000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5 + RomLoadOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 6 + RomLoadOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 7 + RomLoadOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c000, 8 + RomLoadOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 9 + RomLoadOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x14000, 10 + RomLoadOffset, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 3, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0xff, 0x20000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 11 + RomLoadOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 12 + RomLoadOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 13 + RomLoadOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 14 + RomLoadOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x14000, 15 + RomLoadOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x18000, 16 + RomLoadOffset, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + // Setup the M6809 emulation + M6809Init(1); + M6809Open(0); + M6809MapMemory(DrvM6809Ram , 0x0000, 0x1dff, M6809_RAM); + M6809MapMemory(DrvSpriteRam , 0x1e00, 0x1fff, M6809_RAM); + M6809MapMemory(DrvFgVideoRam , 0x2000, 0x27ff, M6809_RAM); + M6809MapMemory(DrvBgVideoRam , 0x2800, 0x2fff, M6809_RAM); + M6809MapMemory(DrvPaletteRam2 , 0x3800, 0x38ff, M6809_RAM); + M6809MapMemory(DrvPaletteRam1 , 0x3900, 0x39ff, M6809_RAM); + M6809MapMemory(DrvM6809Rom , 0x4000, 0x5fff, M6809_ROM); + M6809MapMemory(DrvM6809Rom + 0x2000 , 0x6000, 0xffff, M6809_ROM); + M6809SetReadHandler(DrvGngM6809ReadByte); + M6809SetWriteHandler(DrvGngM6809WriteByte); + M6809Close(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(DrvGngZ80Read); + ZetSetWriteHandler(DrvGngZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); + ZetClose(); + + BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 DiamondInit() +{ + INT32 nRet = 0, nLen; + + Diamond = 1; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x20000); + + // Load M6809 Program Roms + nRet = BurnLoadRom(DrvM6809Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvM6809Rom + 0x04000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvM6809Rom + 0x0c000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvM6809Rom + 0x14000, 3, 1); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x20000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x14000, 11, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 3, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0xff, 0x20000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 13 + RomLoadOffset, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + // Setup the M6809 emulation + M6809Init(1); + M6809Open(0); + M6809MapMemory(DrvM6809Ram , 0x0000, 0x1dff, M6809_RAM); + M6809MapMemory(DrvSpriteRam , 0x1e00, 0x1fff, M6809_RAM); + M6809MapMemory(DrvFgVideoRam , 0x2000, 0x27ff, M6809_RAM); + M6809MapMemory(DrvBgVideoRam , 0x2800, 0x2fff, M6809_RAM); + M6809MapMemory(DrvPaletteRam2 , 0x3800, 0x38ff, M6809_RAM); + M6809MapMemory(DrvPaletteRam1 , 0x3900, 0x39ff, M6809_RAM); + M6809MapMemory(DrvM6809Rom , 0x4000, 0x5fff, M6809_ROM); + M6809MapMemory(DrvM6809Rom + 0x2000 , 0x6000, 0xffff, M6809_ROM); + M6809SetReadHandler(DrvGngM6809ReadByte); + M6809SetWriteHandler(DrvGngM6809WriteByte); + M6809Close(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(DrvGngZ80Read); + ZetSetWriteHandler(DrvGngZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); + ZetClose(); + + BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.40, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvM6809Rom[0x2000] = 0; + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 GngaInit() +{ + RomLoadOffset = 2; + + return DrvInit(); +} + +static INT32 DrvExit() +{ + M6809Exit(); + ZetExit(); + + BurnYM2203Exit(); + + GenericTilesExit(); + + BurnFree(Mem); + + DrvRomBank = 0; + DrvBgScrollX[0] = DrvBgScrollX[1] = 0; + DrvBgScrollY[0] = DrvBgScrollY[1] = 0; + DrvSoundLatch = 0; + + RomLoadOffset = 0; + Diamond = 0; + + return 0; +} + +static inline UINT8 pal4bit(UINT8 bits) +{ + bits &= 0x0f; + return (bits << 4) | bits; +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(nColour >> 12); + g = pal4bit(nColour >> 8); + b = pal4bit(nColour >> 4); + + return BurnHighCol(r, g, b, 0); +} + +static void DrvCalcPalette() +{ + for (INT32 i = 0; i < 0x100; i++) { + INT32 Val = DrvPaletteRam1[i] + (DrvPaletteRam2[i] << 8); + + DrvPalette[i] = CalcCol(Val); + } +} + +static void DrvRenderBgLayer(INT32 Priority, INT32 Opaque) +{ + INT32 mx, my, Code, Attr, Colour, x, y, TileIndex, xScroll, yScroll, Split, Flip, xFlip, yFlip; + + xScroll = DrvBgScrollX[0] | (DrvBgScrollX[1] << 8); + xScroll &= 0x1ff; + + yScroll = DrvBgScrollY[0] | (DrvBgScrollY[1] << 8); + yScroll &= 0x1ff; + + for (mx = 0; mx < 32; mx++) { + for (my = 0; my < 32; my++) { + TileIndex = (my * 32) + mx; + + Attr = DrvBgVideoRam[TileIndex + 0x400]; + Code = DrvBgVideoRam[TileIndex + 0x000]; + + Code += (Attr & 0xc0) << 2; + Colour = Attr & 0x07; + + Split = (Attr & 0x08) >> 3; + + if (Split != Priority) continue; + + Flip = (Attr & 0x30) >> 4; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + + y = 16 * mx; + x = 16 * my; + + x -= xScroll; + if (x < -16) x += 512; + y -= yScroll; + if (y < -16) y += 512; + + y -= 16; + + if (Opaque) { + if (x > 16 && x < 240 && y > 16 && y < 208) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } else { + Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } else { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } else { + Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 3, 0, DrvTiles); + } + } + } + } else { + if (x > 16 && x < 240 && y > 16 && y < 208) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); + } else { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 3, 0, 0, DrvTiles); + } + } + } + } + } + } +} + +static void DrvRenderSprites() +{ + for (INT32 Offs = 0x200 - 4; Offs >= 0; Offs -= 4) { + UINT8 Attr = DrvSpriteRamBuffer[Offs + 1]; + INT32 sx = DrvSpriteRamBuffer[Offs + 3] - (0x100 * (Attr & 0x01)); + INT32 sy = DrvSpriteRamBuffer[Offs + 2]; + INT32 xFlip = Attr & 0x04; + INT32 yFlip = Attr & 0x08; + INT32 Code = DrvSpriteRamBuffer[Offs + 0] + ((Attr << 2) & 0x300); + INT32 Colour = (Attr >> 4) & 3; + + if (sx > 16 && sx < 240 && sy > 16 && sy < 208) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); + } else { + Render16x16Tile_Mask(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy - 16, Colour, 4, 15, 0x40, DrvSprites); + } + } + } + } +} + +static void DrvRenderCharLayer() +{ + INT32 mx, my, Code, Attr, Colour, x, y, TileIndex = 0, Flip, xFlip, yFlip; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Attr = DrvFgVideoRam[TileIndex + 0x400]; + Code = DrvFgVideoRam[TileIndex + 0x000]; + + Code += (Attr & 0xc0) << 2; + Colour = Attr & 0x0f; + + Flip = (Attr & 0x30) >> 4; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + + x = 8 * mx; + y = 8 * my; + + y -= 16; + + if (x > 8 && x < 248 && y > 8 && y < 216) { + if (xFlip) { + if (yFlip) { + Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); + } else { + Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); + } + } else { + if (yFlip) { + Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); + } else { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); + } else { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); + } + } else { + if (yFlip) { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x80, DrvChars); + } + } + } + + TileIndex++; + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + DrvRenderBgLayer(0, 1); + DrvRenderSprites(); + DrvRenderBgLayer(1, 0); + DrvRenderCharLayer(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 25; + INT32 nSoundBufferPos = 0; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 1500000 / 60; + nCyclesTotal[1] = 3000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run M6809 + nCurrentCPU = 0; + M6809Open(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += M6809Run(nCyclesSegment); + if (i == 24) { + M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); + } + M6809Close(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + if (i == 5 || i == 10 || i == 15 || i == 20) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == 6 || i == 11 || i == 16 || i == 21) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + ZetOpen(0); + BurnYM2203Update(pSoundBuf, nSegmentLength); + ZetClose(); + nSoundBufferPos += nSegmentLength; + } + } + + ZetOpen(0); + BurnTimerEndFrame(nCyclesTotal[1]); + ZetClose(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + ZetOpen(0); + BurnYM2203Update(pSoundBuf, nSegmentLength); + ZetClose(); + } + } + + if (pBurnDraw) DrvDraw(); + + memcpy(DrvSpriteRamBuffer, DrvSpriteRam, 0x200); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029696; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + M6809Scan(nAction); + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(DrvRomBank); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(DrvBgScrollX); + SCAN_VAR(DrvBgScrollY); + SCAN_VAR(DrvDip); + SCAN_VAR(DrvInput); + } + + return 0; +} + +struct BurnDriver BurnDrvGng = { + "gng", NULL, NULL, NULL, "1985", + "Ghosts'n Goblins (World? set 1)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGnga = { + "gnga", "gng", NULL, NULL, "1985", + "Ghosts'n Goblins (World? set 2)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, DrvaRomInfo, DrvaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + GngaInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGngbl = { + "gngbl", "gng", NULL, NULL, "1985", + "Ghosts'n Goblins (bootleg with Cross)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, DrvblRomInfo, DrvblRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + GngaInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGngblita = { + "gngblita", "gng", NULL, NULL, "1985", + "Ghosts'n Goblins (Italian bootleg, harder)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, DrvblitaRomInfo, DrvblitaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGngprot = { + "gngprot", "gng", NULL, NULL, "1985", + "Ghosts'n Goblins (prototype)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, DrvprotRomInfo, DrvprotRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + GngaInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGngt = { + "gngt", "gng", NULL, NULL, "1985", + "Ghosts'n Goblins (US)\0", NULL, "Capcom (Taito America License)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, DrvtRomInfo, DrvtRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGngc = { + "gngc", "gng", NULL, NULL, "1985", + "Ghosts'n Goblins (World Revision C)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, DrvcRomInfo, DrvcRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMakaimur = { + "makaimur", "gng", NULL, NULL, "1985", + "Makai-Mura (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, MakaimurRomInfo, MakaimurRomName, NULL, NULL, DrvInputInfo, DrvjDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMakaimuc = { + "makaimurc", "gng", NULL, NULL, "1985", + "Makai-Mura (Japan revision C)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, MakaimucRomInfo, MakaimucRomName, NULL, NULL, DrvInputInfo, DrvjDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMakaimug = { + "makaimurg", "gng", NULL, NULL, "1985", + "Makai-Mura (Japan revision G)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, MakaimugRomInfo, MakaimugRomName, NULL, NULL, DrvInputInfo, DrvjDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDiamond = { + "diamond", NULL, NULL, NULL, "1985", + "Diamond Run\0", NULL, "KH Video", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM, 0, + NULL, DiamondRomInfo, DiamondRomName, NULL, NULL, DiamondInputInfo, DiamondDIPInfo, + DiamondInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_gunsmoke.cpp b/src/burn/drv/pre90s/d_gunsmoke.cpp index 48168c2fb..f005db8a4 100644 --- a/src/burn/drv/pre90s/d_gunsmoke.cpp +++ b/src/burn/drv/pre90s/d_gunsmoke.cpp @@ -1,1020 +1,1018 @@ -// FB Alpha Gun.Smoke driver module -// Based on MAME driver by Paul Leaman - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2203.h" - -static UINT8 *Mem, *MemEnd, *Rom0, *Rom1, *Ram; -static UINT8 *Gfx0, *Gfx1, *Gfx2, *Gfx3, *Prom; -static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvDips[2], DrvReset; -static UINT32 *Palette, *DrvPal; -static UINT8 DrvCalcPal; -static UINT8 *SprTrnsp; - -static UINT8 soundlatch; -static UINT8 flipscreen; -static INT32 nGunsmokeBank; - -static UINT8 sprite3bank; -static UINT8 chon, bgon, objon; -static UINT8 gunsmoke_scrollx[2], gunsmoke_scrolly; - - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, - {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy2 + 6, "p1 fire 3"}, - - {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, - {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p2 right" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p2 left" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 6, "p2 fire 3"}, - - {"Service" , BIT_DIGITAL , DrvJoy1 + 4, "service" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip" }, - -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xf7, NULL }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x03, 0x01, "30k 80k 80k+" }, - {0x14, 0x01, 0x03, 0x03, "30k 100k 100k+" }, - {0x14, 0x01, 0x03, 0x00, "30k 100k 150k+" }, - {0x14, 0x01, 0x03, 0x02, "30k 100k" }, - - {0 , 0xfe, 0 , 2 , "Demo" }, - {0x14, 0x01, 0x04, 0x00, "Off" }, - {0x14, 0x01, 0x04, 0x04, "On" }, -}; - -static struct BurnDIPInfo gunsmokaDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xf7, NULL }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x03, 0x01, "30k 80k 80k+" }, - {0x14, 0x01, 0x03, 0x03, "30k 100k 100k+" }, - {0x14, 0x01, 0x03, 0x00, "30k 100k 150k+" }, - {0x14, 0x01, 0x03, 0x02, "30k 100k" }, - - {0 , 0xfe, 0 , 2 , "Lifes" }, - {0x14, 0x01, 0x04, 0x04, "3" }, - {0x14, 0x01, 0x04, 0x00, "5" }, -}; - -static struct BurnDIPInfo gunsmokeDIPList[]= -{ - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x08, 0x00, "Upright" }, - {0x14, 0x01, 0x08, 0x08, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x30, 0x20, "Easy" }, - {0x14, 0x01, 0x30, 0x30, "Normal" }, - {0x14, 0x01, 0x30, 0x10, "Difficult" }, - {0x14, 0x01, 0x30, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x15, 0x01, 0x07, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x07, 0x01, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x07, 0x02, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x15, 0x01, 0x07, 0x03, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x15, 0x01, 0x38, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x38, 0x08, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x38, 0x10, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x15, 0x01, 0x38, 0x18, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x40, 0x00, "No" }, - {0x15, 0x01, 0x40, 0x40, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x00, "Off" }, - {0x15, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFOEXT(Drv, Drv, gunsmoke) -STDDIPINFOEXT(gunsmoka, gunsmoka, gunsmoke) - - -static inline void gunsmoke_bankswitch(INT32 nBank) -{ - if (nGunsmokeBank != nBank) { - nGunsmokeBank = nBank; - - ZetMapArea(0x8000, 0xbfff, 0, Rom0 + 0x10000 + nBank * 0x04000); - ZetMapArea(0x8000, 0xbfff, 2, Rom0 + 0x10000 + nBank * 0x04000); - } -} - -void __fastcall gunsmoke_cpu0_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc800: - soundlatch = data; - break; - - case 0xc804: - gunsmoke_bankswitch((data >> 2) & 3); - - flipscreen = data & 0x40; - chon = data & 0x80; - break; - - case 0xc806: - break; - - case 0xd800: - case 0xd801: - gunsmoke_scrollx[address & 1] = data; - break; - - case 0xd802: - case 0xd803: - gunsmoke_scrolly = data; - break; - - case 0xd806: - sprite3bank = data & 0x07; - - bgon = data & 0x10; - objon = data & 0x20; - break; - } -} - -UINT8 __fastcall gunsmoke_cpu0_read(UINT16 address) -{ - UINT8 ret = 0xff; - - switch (address) - { - case 0xc000: - { - for (INT32 i = 0; i < 8; i++) - ret ^= DrvJoy1[i] << i; - - return ret | 0x08; - } - - case 0xc001: - { - for (INT32 i = 0; i < 8; i++) - ret ^= DrvJoy2[i] << i; - - return ret; - } - - case 0xc002: - { - for (INT32 i = 0; i < 8; i++) - ret ^= DrvJoy3[i] << i; - - return ret; - } - - case 0xc003: // dips - return DrvDips[0]; - - case 0xc004: - return DrvDips[1]; - - // reads at c4c9 - c4cb are part of some sort of protection or bug - case 0xc4c9: - return 0xff; - case 0xc4ca: - case 0xc4cb: - return 0; - } - - return 0; -} - -void __fastcall gunsmoke_cpu1_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe000: // control 0 - BurnYM2203Write(0, 0, data); - break; - - case 0xe001: // write 0 - BurnYM2203Write(0, 1, data); - break; - - case 0xe002: // control 1 - BurnYM2203Write(1, 0, data); - break; - - case 0xe003: // write 1 - BurnYM2203Write(1, 1, data); - break; - } -} - -UINT8 __fastcall gunsmoke_cpu1_read(UINT16 address) -{ - if (address == 0xc800) return soundlatch; - - return 0; -} - - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (Ram, 0, 0x4000); - - nGunsmokeBank = -1; - soundlatch = 0; - flipscreen = 0; - - sprite3bank = 0; - chon = bgon = objon = 0; - gunsmoke_scrollx[0] = gunsmoke_scrollx[1] = 0; - gunsmoke_scrolly = 0; - - ZetOpen(0); - ZetReset(); - gunsmoke_bankswitch(0); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - - return 0; -} - -static INT32 gunsmoke_palette_init() -{ - INT32 i, ctabentry; - UINT32 tmp[0x100]; - - for (i = 0; i < 0x100; i++) - { - UINT8 r, g, b; - - r = Prom[i + 0x000] & 0x0f; - r |= r << 4; - g = Prom[i + 0x100] & 0x0f; - g |= g << 4; - b = Prom[i + 0x200] & 0x0f; - b |= b << 4; - - tmp[i] = (r << 16) | (g << 8) | b; - } - - for (i = 0; i < 0x100; i++) - { - ctabentry = Prom[0x300 + i] | 0x40; - Palette[0x000 + i] = tmp[ctabentry]; - - ctabentry = Prom[0x400 + i] | ((Prom[0x500 + i] & 0x03) << 4); - Palette[0x100 + i] = tmp[ctabentry]; - - ctabentry = Prom[0x600 + i] | ((Prom[0x700 + i] & 0x07) << 4) | 0x80; - Palette[0x200 + i] = tmp[ctabentry]; - } - - return 0; -} - -static INT32 gunsmoke_gfx_decode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x80000); - if (!tmp) return 1; - - static INT32 Planes[4] = { 0x100004, 0x100000, 4, 0 }; - - static INT32 CharXOffs[8] = { 11, 10, 9, 8, 3, 2, 1, 0 }; - static INT32 CharYOffs[8] = { 112, 96, 80, 64, 48, 32, 16, 0 }; - - static INT32 TileXOffs[32] = { 0, 1, 2, 3, 8, 9, 10, 11, - 512, 513, 514, 515, 520, 521, 522, 523, - 1024, 1025, 1026, 1027, 1032, 1033, 1034, 1035, - 1536, 1537, 1538, 1539, 1544, 1545, 1546, 1547 }; - - static INT32 TileYOffs[32] = { 0, 16, 32, 48, 64, 80, 96, 112, - 128, 144, 160, 176, 192, 208, 224, 240, - 256, 272, 288, 304, 320, 336, 352, 368, - 384, 400, 416, 432, 448, 464, 480, 496 }; - - static INT32 SpriXOffs[16] = { 0, 1, 2, 3, 8, 9, 10, 11, - 256, 257, 258, 259, 264, 265, 266, 267 }; - - memcpy (tmp, Gfx0, 0x04000); - GfxDecode(0x400, 2, 8, 8, Planes + 2, CharXOffs, CharYOffs, 0x080, tmp, Gfx0); - - memcpy (tmp, Gfx1, 0x40000); - GfxDecode(0x200, 4, 32, 32, Planes + 0, TileXOffs, TileYOffs, 0x800, tmp, Gfx1); - - memcpy (tmp, Gfx2, 0x40000); - GfxDecode(0x800, 4, 16, 16, Planes + 0, SpriXOffs, TileYOffs, 0x200, tmp, Gfx2); - - BurnFree (tmp); - - { - memset (SprTrnsp, 1, 0x800); - - for (INT32 i = 0; i < 0x80000; i++) - if (Gfx2[i]) SprTrnsp[i >> 8] = 0; - } - - return 0; -} - -static INT32 gunsmokeSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3000000; -} - -static double gunsmokeGetTime() -{ - return (double)ZetTotalCycles() / 3000000; -} - - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Rom0 = Next; Next += 0x20000; - Rom1 = Next; Next += 0x08000; - Ram = Next; Next += 0x04000; - Gfx0 = Next; Next += 0x10000; - Gfx1 = Next; Next += 0x80000; - Gfx2 = Next; Next += 0x80000; - Gfx3 = Next; Next += 0x08000; - Prom = Next; Next += 0x00800; - - SprTrnsp = Next; Next += 0x00800; - - Palette = (UINT32*)Next; Next += 0x00300 * sizeof(UINT32); - DrvPal = (UINT32*)Next; Next += 0x00300 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Rom0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(Rom0 + 0x10000, 1, 1)) return 1; - if (BurnLoadRom(Rom0 + 0x18000, 2, 1)) return 1; - - if (BurnLoadRom(Rom1 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(Gfx0 + 0x00000, 4, 1)) return 1; - - if (BurnLoadRom(Gfx3 + 0x00000, 21, 1)) return 1; - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(Gfx1 + i * 0x8000, 5 + i, 1)) return 1; - if (BurnLoadRom(Gfx2 + i * 0x8000, 13 + i, 1)) return 1; - if (BurnLoadRom(Prom + i * 0x0100, 22 + i, 1)) return 1; - } - - gunsmoke_gfx_decode(); - gunsmoke_palette_init(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, Rom0 + 0x00000); - ZetMapArea(0x0000, 0x7fff, 2, Rom0 + 0x00000); - ZetMapArea(0x8000, 0xbfff, 0, Rom0 + 0x10000); - ZetMapArea(0x8000, 0xbfff, 2, Rom0 + 0x10000); - ZetMapArea(0xd000, 0xd7ff, 0, Ram + 0x00000); - ZetMapArea(0xd000, 0xd7ff, 1, Ram + 0x00000); - ZetMapArea(0xe000, 0xefff, 0, Ram + 0x01000); - ZetMapArea(0xe000, 0xefff, 1, Ram + 0x01000); - ZetMapArea(0xe000, 0xefff, 2, Ram + 0x01000); - ZetMapArea(0xf000, 0xffff, 0, Ram + 0x02000); - ZetMapArea(0xf000, 0xffff, 1, Ram + 0x02000); - ZetSetReadHandler(gunsmoke_cpu0_read); - ZetSetWriteHandler(gunsmoke_cpu0_write); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, Rom1 + 0x00000); - ZetMapArea(0x0000, 0x7fff, 2, Rom1 + 0x00000); - ZetMapArea(0xc000, 0xc7ff, 0, Ram + 0x03000); - ZetMapArea(0xc000, 0xc7ff, 1, Ram + 0x03000); - ZetMapArea(0xc000, 0xc7ff, 2, Ram + 0x03000); - ZetSetReadHandler(gunsmoke_cpu1_read); - ZetSetWriteHandler(gunsmoke_cpu1_write); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - - BurnYM2203Init(2, 1500000, NULL, gunsmokeSynchroniseStream, gunsmokeGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.14, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.22, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.22, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.22, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.14, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.22, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.22, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.22, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - BurnYM2203Exit(); - - BurnFree (Mem); - - Mem = MemEnd = Rom0 = Rom1 = Ram = NULL; - Gfx0 = Gfx1 = Gfx2 = Gfx3 = Prom = NULL; - SprTrnsp = NULL; - Palette = DrvPal = NULL; - - soundlatch = flipscreen = nGunsmokeBank; - - sprite3bank = chon = bgon = objon = 0; - gunsmoke_scrollx[0] = gunsmoke_scrollx[1] = 0; - gunsmoke_scrolly = 0; - - return 0; -} - -static void draw_bg_layer() -{ - UINT16 scroll = gunsmoke_scrollx[0] + (gunsmoke_scrollx[1] << 8); - - UINT8 *tilerom = Gfx3 + ((scroll >> 1) & ~0x0f); - - for (INT32 offs = 0; offs < 0x50; offs++) - { - INT32 attr = tilerom[1]; - INT32 code = tilerom[0] + ((attr & 1) << 8); - INT32 color = (attr & 0x3c) >> 2; - INT32 flipy = attr & 0x80; - INT32 flipx = attr & 0x40; - - INT32 sy = (offs & 7) << 5; - INT32 sx = (offs >> 3) << 5; - - sy -= gunsmoke_scrolly; - sx -= (scroll & 0x1f); - - if (flipscreen) { - flipy ^= 0x80; - flipx ^= 0x40; - - sy = 224 - sy; - sx = 224 - sx; - } - - sy -= 16; - - if (flipy) { - if (flipx) { - Render32x32Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, Gfx1); - } else { - Render32x32Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, Gfx1); - } - } else { - if (flipx) { - Render32x32Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, Gfx1); - } else { - Render32x32Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, Gfx1); - } - } - - tilerom += 2; - } -} - -static void draw_fg_layer() -{ - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 sx = (offs << 3) & 0xf8; - INT32 sy = (offs >> 2) & 0xf8; - - INT32 attr = Ram[0x0400 + offs]; - INT32 code = Ram[0x0000 + offs] + ((attr & 0xe0) << 2); - INT32 color = attr & 0x1f; - - if (code == 0x0024) continue; - - UINT8 *src = Gfx0 + (code << 6); - color <<= 2; - - if (flipscreen) { - sy = 240 - sy; - sx = 240 - sx; - - sy -= 8; - - for (INT32 y = sy + 7; y >= sy; y--) - { - for (INT32 x = sx + 7; x >= sx; x--, src++) - { - if (y < 0 || x < 0 || y > 223 || x > 255) continue; - if (!Palette[color|*src]) continue; - - pTransDraw[(y << 8) | x] = color | *src; - } - } - } else { - sy -= 16; - - for (INT32 y = sy; y < sy + 8; y++) - { - for (INT32 x = sx; x < sx + 8; x++, src++) - { - if (y < 0 || x < 0 || y > 223 || x > 255) continue; - if (!Palette[color|*src]) continue; - - pTransDraw[(y << 8) | x] = color | *src; - } - } - } - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0x1000 - 32; offs >= 0; offs -= 32) - { - INT32 attr = Ram[0x2001 + offs]; - INT32 bank = (attr & 0xc0) >> 6; - INT32 code = Ram[0x2000 + offs]; - INT32 color = attr & 0x0f; - INT32 flipx = 0; - INT32 flipy = attr & 0x10; - INT32 sx = Ram[0x2003 + offs] - ((attr & 0x20) << 3); - INT32 sy = Ram[0x2002 + offs]; - - if (sy == 0 || sy > 0xef) continue; - - if (bank == 3) bank += sprite3bank; - code += 256 * bank; - - if (SprTrnsp[code]) continue; - - if (flipscreen) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - sy -= 16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x200, Gfx2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x200, Gfx2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x200, Gfx2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x200, Gfx2); - } - } - } -} - -static INT32 DrvDraw() -{ - // Recalculate palette - if (DrvCalcPal) { - for (INT32 i = 0; i < 0x300; i++) { - UINT32 col = Palette[i]; - DrvPal[i] = BurnHighCol(col >> 16, col >> 8, col, 0); - } - } - - if (!bgon) memset (pTransDraw, 0, 224 * 256 * 2); - - if (bgon) draw_bg_layer(); - if (objon) draw_sprites(); - if (chon) draw_fg_layer(); - - BurnTransferCopy(DrvPal); - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - INT32 nInterleave = 25; - INT32 nSoundBufferPos = 0; - - INT32 nCyclesSegment; - INT32 nCyclesDone[2], nCyclesTotal[2]; - - nCyclesTotal[0] = 4000000 / 60; - nCyclesTotal[1] = 3000000 / 60; - - nCyclesDone[0] = nCyclesDone[1] = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #0 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 20) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == 21) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - // Run Z80 #1 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - if (i == 5 || i == 10 || i == 15 || i == 20) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == 6 || i == 11 || i == 16 || i == 21) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - - ZetClose(); - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - ZetOpen(1); - BurnYM2203Update(pSoundBuf, nSegmentLength); - ZetClose(); - nSoundBufferPos += nSegmentLength; - } - - } - - ZetOpen(1); - BurnTimerEndFrame(nCyclesTotal[1]); - ZetClose(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - ZetOpen(1); - BurnYM2203Update(pSoundBuf, nSegmentLength); - ZetClose(); - } - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = Ram; - ba.nLen = 0x4000; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - BurnYM2203Scan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(soundlatch); - SCAN_VAR(flipscreen); - SCAN_VAR(nGunsmokeBank); - SCAN_VAR(sprite3bank); - SCAN_VAR(chon); - SCAN_VAR(bgon); - SCAN_VAR(objon); - SCAN_VAR(gunsmoke_scrollx[0]); - SCAN_VAR(gunsmoke_scrollx[1]); - SCAN_VAR(gunsmoke_scrolly); - } - - return 0; -} - - -// Gun. Smoke (World) - -static struct BurnRomInfo gunsmokeRomDesc[] = { - { "09n_gs03.bin", 0x8000, 0x40a06cef, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "10n_gs04.bin", 0x8000, 0x8d4b423f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "12n_gs05.bin", 0x8000, 0x2b5667fb, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "14h_gs02.bin", 0x8000, 0xcd7a2c38, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "11f_gs01.bin", 0x4000, 0xb61ece9b, 3 | BRF_GRA }, // 4 Character Tiles - - { "06c_gs13.bin", 0x8000, 0xf6769fc5, 4 | BRF_GRA }, // 5 32x32 Tiles - { "05c_gs12.bin", 0x8000, 0xd997b78c, 4 | BRF_GRA }, // 6 - { "04c_gs11.bin", 0x8000, 0x125ba58e, 4 | BRF_GRA }, // 7 - { "02c_gs10.bin", 0x8000, 0xf469c13c, 4 | BRF_GRA }, // 8 - { "06a_gs09.bin", 0x8000, 0x539f182d, 4 | BRF_GRA }, // 9 - { "05a_gs08.bin", 0x8000, 0xe87e526d, 4 | BRF_GRA }, // 10 - { "04a_gs07.bin", 0x8000, 0x4382c0d2, 4 | BRF_GRA }, // 11 - { "02a_gs06.bin", 0x8000, 0x4cafe7a6, 4 | BRF_GRA }, // 12 - - { "06n_gs22.bin", 0x8000, 0xdc9c508c, 5 | BRF_GRA }, // 13 Sprites - { "04n_gs21.bin", 0x8000, 0x68883749, 5 | BRF_GRA }, // 14 - { "03n_gs20.bin", 0x8000, 0x0be932ed, 5 | BRF_GRA }, // 15 - { "01n_gs19.bin", 0x8000, 0x63072f93, 5 | BRF_GRA }, // 16 - { "06l_gs18.bin", 0x8000, 0xf69a3c7c, 5 | BRF_GRA }, // 17 - { "04l_gs17.bin", 0x8000, 0x4e98562a, 5 | BRF_GRA }, // 18 - { "03l_gs16.bin", 0x8000, 0x0d99c3b3, 5 | BRF_GRA }, // 19 - { "01l_gs15.bin", 0x8000, 0x7f14270e, 5 | BRF_GRA }, // 20 - - { "11c_gs14.bin", 0x8000, 0x0af4f7eb, 6 | BRF_GRA }, // 21 Background Tilemaps - - { "03b_g-01.bin", 0x0100, 0x02f55589, 7 | BRF_GRA }, // 22 Color Proms - { "04b_g-02.bin", 0x0100, 0xe1e36dd9, 7 | BRF_GRA }, // 23 - { "05b_g-03.bin", 0x0100, 0x989399c0, 7 | BRF_GRA }, // 24 - { "09d_g-04.bin", 0x0100, 0x906612b5, 7 | BRF_GRA }, // 25 - { "14a_g-06.bin", 0x0100, 0x4a9da18b, 7 | BRF_GRA }, // 26 - { "15a_g-07.bin", 0x0100, 0xcb9394fc, 7 | BRF_GRA }, // 27 - { "09f_g-09.bin", 0x0100, 0x3cee181e, 7 | BRF_GRA }, // 28 - { "08f_g-08.bin", 0x0100, 0xef91cdd2, 7 | BRF_GRA }, // 29 - - { "02j_g-10.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 30 Video Timing - { "01f_g-05.bin", 0x0100, 0x25c90c2a, 0 | BRF_OPT }, // 31 Priority -}; - -STD_ROM_PICK(gunsmoke) -STD_ROM_FN(gunsmoke) - -struct BurnDriver BurnDrvGunsmoke = { - "gunsmoke", NULL, NULL, NULL, "1985", - "Gun. Smoke (World)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, gunsmokeRomInfo, gunsmokeRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x300, - 224, 256, 3, 4 -}; - - -// Gun. Smoke (Japan) - -static struct BurnRomInfo gunsmokjRomDesc[] = { - { "gs03_9n.rom", 0x8000, 0xb56b5df6, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "10n_gs04.bin", 0x8000, 0x8d4b423f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "12n_gs05.bin", 0x8000, 0x2b5667fb, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "14h_gs02.bin", 0x8000, 0xcd7a2c38, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "11f_gs01.bin", 0x4000, 0xb61ece9b, 3 | BRF_GRA }, // 4 Character Tiles - - { "06c_gs13.bin", 0x8000, 0xf6769fc5, 4 | BRF_GRA }, // 5 32x32 Tiles - { "05c_gs12.bin", 0x8000, 0xd997b78c, 4 | BRF_GRA }, // 6 - { "04c_gs11.bin", 0x8000, 0x125ba58e, 4 | BRF_GRA }, // 7 - { "02c_gs10.bin", 0x8000, 0xf469c13c, 4 | BRF_GRA }, // 8 - { "06a_gs09.bin", 0x8000, 0x539f182d, 4 | BRF_GRA }, // 9 - { "05a_gs08.bin", 0x8000, 0xe87e526d, 4 | BRF_GRA }, // 10 - { "04a_gs07.bin", 0x8000, 0x4382c0d2, 4 | BRF_GRA }, // 11 - { "02a_gs06.bin", 0x8000, 0x4cafe7a6, 4 | BRF_GRA }, // 12 - - { "06n_gs22.bin", 0x8000, 0xdc9c508c, 5 | BRF_GRA }, // 13 Sprites - { "04n_gs21.bin", 0x8000, 0x68883749, 5 | BRF_GRA }, // 14 - { "03n_gs20.bin", 0x8000, 0x0be932ed, 5 | BRF_GRA }, // 15 - { "01n_gs19.bin", 0x8000, 0x63072f93, 5 | BRF_GRA }, // 16 - { "06l_gs18.bin", 0x8000, 0xf69a3c7c, 5 | BRF_GRA }, // 17 - { "04l_gs17.bin", 0x8000, 0x4e98562a, 5 | BRF_GRA }, // 18 - { "03l_gs16.bin", 0x8000, 0x0d99c3b3, 5 | BRF_GRA }, // 19 - { "01l_gs15.bin", 0x8000, 0x7f14270e, 5 | BRF_GRA }, // 20 - - { "11c_gs14.bin", 0x8000, 0x0af4f7eb, 6 | BRF_GRA }, // 21 Background Tilemaps - - { "03b_g-01.bin", 0x0100, 0x02f55589, 7 | BRF_GRA }, // 22 Color Proms - { "04b_g-02.bin", 0x0100, 0xe1e36dd9, 7 | BRF_GRA }, // 23 - { "05b_g-03.bin", 0x0100, 0x989399c0, 7 | BRF_GRA }, // 24 - { "09d_g-04.bin", 0x0100, 0x906612b5, 7 | BRF_GRA }, // 25 - { "14a_g-06.bin", 0x0100, 0x4a9da18b, 7 | BRF_GRA }, // 26 - { "15a_g-07.bin", 0x0100, 0xcb9394fc, 7 | BRF_GRA }, // 27 - { "09f_g-09.bin", 0x0100, 0x3cee181e, 7 | BRF_GRA }, // 28 - { "08f_g-08.bin", 0x0100, 0xef91cdd2, 7 | BRF_GRA }, // 29 - - { "02j_g-10.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 30 Video Timing - { "01f_g-05.bin", 0x0100, 0x25c90c2a, 0 | BRF_OPT }, // 31 Priority -}; - -STD_ROM_PICK(gunsmokj) -STD_ROM_FN(gunsmokj) - -struct BurnDriver BurnDrvGunsmokj = { - "gunsmokej", "gunsmoke", NULL, NULL, "1985", - "Gun. Smoke (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, gunsmokjRomInfo, gunsmokjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x300, - 224, 256, 3, 4 -}; - - -// Gun. Smoke (US set 1) - -static struct BurnRomInfo gunsmokuRomDesc[] = { - { "9n_gs03.bin", 0x8000, 0x592f211b, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "10n_gs04.bin", 0x8000, 0x8d4b423f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "12n_gs05.bin", 0x8000, 0x2b5667fb, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "14h_gs02.bin", 0x8000, 0xcd7a2c38, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "11f_gs01.bin", 0x4000, 0xb61ece9b, 3 | BRF_GRA }, // 4 Character Tiles - - { "06c_gs13.bin", 0x8000, 0xf6769fc5, 4 | BRF_GRA }, // 5 32x32 Tiles - { "05c_gs12.bin", 0x8000, 0xd997b78c, 4 | BRF_GRA }, // 6 - { "04c_gs11.bin", 0x8000, 0x125ba58e, 4 | BRF_GRA }, // 7 - { "02c_gs10.bin", 0x8000, 0xf469c13c, 4 | BRF_GRA }, // 8 - { "06a_gs09.bin", 0x8000, 0x539f182d, 4 | BRF_GRA }, // 9 - { "05a_gs08.bin", 0x8000, 0xe87e526d, 4 | BRF_GRA }, // 10 - { "04a_gs07.bin", 0x8000, 0x4382c0d2, 4 | BRF_GRA }, // 11 - { "02a_gs06.bin", 0x8000, 0x4cafe7a6, 4 | BRF_GRA }, // 12 - - { "06n_gs22.bin", 0x8000, 0xdc9c508c, 5 | BRF_GRA }, // 13 Sprites - { "04n_gs21.bin", 0x8000, 0x68883749, 5 | BRF_GRA }, // 14 - { "03n_gs20.bin", 0x8000, 0x0be932ed, 5 | BRF_GRA }, // 15 - { "01n_gs19.bin", 0x8000, 0x63072f93, 5 | BRF_GRA }, // 16 - { "06l_gs18.bin", 0x8000, 0xf69a3c7c, 5 | BRF_GRA }, // 17 - { "04l_gs17.bin", 0x8000, 0x4e98562a, 5 | BRF_GRA }, // 18 - { "03l_gs16.bin", 0x8000, 0x0d99c3b3, 5 | BRF_GRA }, // 19 - { "01l_gs15.bin", 0x8000, 0x7f14270e, 5 | BRF_GRA }, // 20 - - { "11c_gs14.bin", 0x8000, 0x0af4f7eb, 6 | BRF_GRA }, // 21 Background Tilemaps - - { "03b_g-01.bin", 0x0100, 0x02f55589, 7 | BRF_GRA }, // 22 Color Proms - { "04b_g-02.bin", 0x0100, 0xe1e36dd9, 7 | BRF_GRA }, // 23 - { "05b_g-03.bin", 0x0100, 0x989399c0, 7 | BRF_GRA }, // 24 - { "09d_g-04.bin", 0x0100, 0x906612b5, 7 | BRF_GRA }, // 25 - { "14a_g-06.bin", 0x0100, 0x4a9da18b, 7 | BRF_GRA }, // 26 - { "15a_g-07.bin", 0x0100, 0xcb9394fc, 7 | BRF_GRA }, // 27 - { "09f_g-09.bin", 0x0100, 0x3cee181e, 7 | BRF_GRA }, // 28 - { "08f_g-08.bin", 0x0100, 0xef91cdd2, 7 | BRF_GRA }, // 29 - - { "02j_g-10.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 30 Video Timing - { "01f_g-05.bin", 0x0100, 0x25c90c2a, 0 | BRF_OPT }, // 31 Priority -}; - -STD_ROM_PICK(gunsmoku) -STD_ROM_FN(gunsmoku) - -struct BurnDriver BurnDrvGunsmoku = { - "gunsmokeu", "gunsmoke", NULL, NULL, "1985", - "Gun. Smoke (US set 1)\0", NULL, "Capcom (Romstar License)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, gunsmokuRomInfo, gunsmokuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x300, - 224, 256, 3, 4 -}; - - -// Gun. Smoke (US set 2) - -static struct BurnRomInfo gunsmokaRomDesc[] = { - { "gs03.9n", 0x8000, 0x51dc3f76, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "gs04.10n", 0x8000, 0x5ecf31b8, 1 | BRF_PRG | BRF_ESS }, // 1 - { "gs05.12n", 0x8000, 0x1c9aca13, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "14h_gs02.bin", 0x8000, 0xcd7a2c38, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "11f_gs01.bin", 0x4000, 0xb61ece9b, 3 | BRF_GRA }, // 4 Character Tiles - - { "06c_gs13.bin", 0x8000, 0xf6769fc5, 4 | BRF_GRA }, // 5 32x32 Tiles - { "05c_gs12.bin", 0x8000, 0xd997b78c, 4 | BRF_GRA }, // 6 - { "04c_gs11.bin", 0x8000, 0x125ba58e, 4 | BRF_GRA }, // 7 - { "02c_gs10.bin", 0x8000, 0xf469c13c, 4 | BRF_GRA }, // 8 - { "06a_gs09.bin", 0x8000, 0x539f182d, 4 | BRF_GRA }, // 9 - { "05a_gs08.bin", 0x8000, 0xe87e526d, 4 | BRF_GRA }, // 10 - { "04a_gs07.bin", 0x8000, 0x4382c0d2, 4 | BRF_GRA }, // 11 - { "02a_gs06.bin", 0x8000, 0x4cafe7a6, 4 | BRF_GRA }, // 12 - - { "06n_gs22.bin", 0x8000, 0xdc9c508c, 5 | BRF_GRA }, // 13 Sprites - { "04n_gs21.bin", 0x8000, 0x68883749, 5 | BRF_GRA }, // 14 - { "03n_gs20.bin", 0x8000, 0x0be932ed, 5 | BRF_GRA }, // 15 - { "01n_gs19.bin", 0x8000, 0x63072f93, 5 | BRF_GRA }, // 16 - { "06l_gs18.bin", 0x8000, 0xf69a3c7c, 5 | BRF_GRA }, // 17 - { "04l_gs17.bin", 0x8000, 0x4e98562a, 5 | BRF_GRA }, // 18 - { "03l_gs16.bin", 0x8000, 0x0d99c3b3, 5 | BRF_GRA }, // 19 - { "01l_gs15.bin", 0x8000, 0x7f14270e, 5 | BRF_GRA }, // 20 - - { "11c_gs14.bin", 0x8000, 0x0af4f7eb, 6 | BRF_GRA }, // 21 Background Tilemaps - - { "03b_g-01.bin", 0x0100, 0x02f55589, 7 | BRF_GRA }, // 22 Color Proms - { "04b_g-02.bin", 0x0100, 0xe1e36dd9, 7 | BRF_GRA }, // 23 - { "05b_g-03.bin", 0x0100, 0x989399c0, 7 | BRF_GRA }, // 24 - { "09d_g-04.bin", 0x0100, 0x906612b5, 7 | BRF_GRA }, // 25 - { "14a_g-06.bin", 0x0100, 0x4a9da18b, 7 | BRF_GRA }, // 26 - { "15a_g-07.bin", 0x0100, 0xcb9394fc, 7 | BRF_GRA }, // 27 - { "09f_g-09.bin", 0x0100, 0x3cee181e, 7 | BRF_GRA }, // 28 - { "08f_g-08.bin", 0x0100, 0xef91cdd2, 7 | BRF_GRA }, // 29 - - { "02j_g-10.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 30 Video Timing - { "01f_g-05.bin", 0x0100, 0x25c90c2a, 0 | BRF_OPT }, // 31 Priority -}; - -STD_ROM_PICK(gunsmoka) -STD_ROM_FN(gunsmoka) - -struct BurnDriver BurnDrvGunsmoka = { - "gunsmokeua", "gunsmoke", NULL, NULL, "1986", - "Gun. Smoke (US set 2)\0", NULL, "Capcom (Romstar License)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, gunsmokaRomInfo, gunsmokaRomName, NULL, NULL, DrvInputInfo, gunsmokaDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x300, - 224, 256, 3, 4 -}; - +// FB Alpha Gun.Smoke driver module +// Based on MAME driver by Paul Leaman + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2203.h" + +static UINT8 *Mem, *MemEnd, *Rom0, *Rom1, *Ram; +static UINT8 *Gfx0, *Gfx1, *Gfx2, *Gfx3, *Prom; +static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvDips[2], DrvReset; +static UINT32 *Palette, *DrvPal; +static UINT8 DrvCalcPal; +static UINT8 *SprTrnsp; + +static UINT8 soundlatch; +static UINT8 flipscreen; +static INT32 nGunsmokeBank; + +static UINT8 sprite3bank; +static UINT8 chon, bgon, objon; +static UINT8 gunsmoke_scrollx[2], gunsmoke_scrolly; + + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, + {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy2 + 6, "p1 fire 3"}, + + {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, + {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p2 right" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p2 left" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 6, "p2 fire 3"}, + + {"Service" , BIT_DIGITAL , DrvJoy1 + 4, "service" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip" }, + +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xf7, NULL }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x03, 0x01, "30k 80k 80k+" }, + {0x14, 0x01, 0x03, 0x03, "30k 100k 100k+" }, + {0x14, 0x01, 0x03, 0x00, "30k 100k 150k+" }, + {0x14, 0x01, 0x03, 0x02, "30k 100k" }, + + {0 , 0xfe, 0 , 2 , "Demo" }, + {0x14, 0x01, 0x04, 0x00, "Off" }, + {0x14, 0x01, 0x04, 0x04, "On" }, +}; + +static struct BurnDIPInfo gunsmokaDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xf7, NULL }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x03, 0x01, "30k 80k 80k+" }, + {0x14, 0x01, 0x03, 0x03, "30k 100k 100k+" }, + {0x14, 0x01, 0x03, 0x00, "30k 100k 150k+" }, + {0x14, 0x01, 0x03, 0x02, "30k 100k" }, + + {0 , 0xfe, 0 , 2 , "Lifes" }, + {0x14, 0x01, 0x04, 0x04, "3" }, + {0x14, 0x01, 0x04, 0x00, "5" }, +}; + +static struct BurnDIPInfo gunsmokeDIPList[]= +{ + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x08, 0x00, "Upright" }, + {0x14, 0x01, 0x08, 0x08, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x30, 0x20, "Easy" }, + {0x14, 0x01, 0x30, 0x30, "Normal" }, + {0x14, 0x01, 0x30, 0x10, "Difficult" }, + {0x14, 0x01, 0x30, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x15, 0x01, 0x07, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x07, 0x01, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x07, 0x02, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x15, 0x01, 0x07, 0x03, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x15, 0x01, 0x38, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x38, 0x08, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x38, 0x10, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x15, 0x01, 0x38, 0x18, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x40, 0x00, "No" }, + {0x15, 0x01, 0x40, 0x40, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x00, "Off" }, + {0x15, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFOEXT(Drv, Drv, gunsmoke) +STDDIPINFOEXT(gunsmoka, gunsmoka, gunsmoke) + + +static inline void gunsmoke_bankswitch(INT32 nBank) +{ + if (nGunsmokeBank != nBank) { + nGunsmokeBank = nBank; + + ZetMapArea(0x8000, 0xbfff, 0, Rom0 + 0x10000 + nBank * 0x04000); + ZetMapArea(0x8000, 0xbfff, 2, Rom0 + 0x10000 + nBank * 0x04000); + } +} + +void __fastcall gunsmoke_cpu0_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc800: + soundlatch = data; + break; + + case 0xc804: + gunsmoke_bankswitch((data >> 2) & 3); + + flipscreen = data & 0x40; + chon = data & 0x80; + break; + + case 0xc806: + break; + + case 0xd800: + case 0xd801: + gunsmoke_scrollx[address & 1] = data; + break; + + case 0xd802: + case 0xd803: + gunsmoke_scrolly = data; + break; + + case 0xd806: + sprite3bank = data & 0x07; + + bgon = data & 0x10; + objon = data & 0x20; + break; + } +} + +UINT8 __fastcall gunsmoke_cpu0_read(UINT16 address) +{ + UINT8 ret = 0xff; + + switch (address) + { + case 0xc000: + { + for (INT32 i = 0; i < 8; i++) + ret ^= DrvJoy1[i] << i; + + return ret | 0x08; + } + + case 0xc001: + { + for (INT32 i = 0; i < 8; i++) + ret ^= DrvJoy2[i] << i; + + return ret; + } + + case 0xc002: + { + for (INT32 i = 0; i < 8; i++) + ret ^= DrvJoy3[i] << i; + + return ret; + } + + case 0xc003: // dips + return DrvDips[0]; + + case 0xc004: + return DrvDips[1]; + + // reads at c4c9 - c4cb are part of some sort of protection or bug + case 0xc4c9: + return 0xff; + case 0xc4ca: + case 0xc4cb: + return 0; + } + + return 0; +} + +void __fastcall gunsmoke_cpu1_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe000: // control 0 + BurnYM2203Write(0, 0, data); + break; + + case 0xe001: // write 0 + BurnYM2203Write(0, 1, data); + break; + + case 0xe002: // control 1 + BurnYM2203Write(1, 0, data); + break; + + case 0xe003: // write 1 + BurnYM2203Write(1, 1, data); + break; + } +} + +UINT8 __fastcall gunsmoke_cpu1_read(UINT16 address) +{ + if (address == 0xc800) return soundlatch; + + return 0; +} + + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (Ram, 0, 0x4000); + + nGunsmokeBank = -1; + soundlatch = 0; + flipscreen = 0; + + sprite3bank = 0; + chon = bgon = objon = 0; + gunsmoke_scrollx[0] = gunsmoke_scrollx[1] = 0; + gunsmoke_scrolly = 0; + + ZetOpen(0); + ZetReset(); + gunsmoke_bankswitch(0); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + + return 0; +} + +static INT32 gunsmoke_palette_init() +{ + INT32 i, ctabentry; + UINT32 tmp[0x100]; + + for (i = 0; i < 0x100; i++) + { + UINT8 r, g, b; + + r = Prom[i + 0x000] & 0x0f; + r |= r << 4; + g = Prom[i + 0x100] & 0x0f; + g |= g << 4; + b = Prom[i + 0x200] & 0x0f; + b |= b << 4; + + tmp[i] = (r << 16) | (g << 8) | b; + } + + for (i = 0; i < 0x100; i++) + { + ctabentry = Prom[0x300 + i] | 0x40; + Palette[0x000 + i] = tmp[ctabentry]; + + ctabentry = Prom[0x400 + i] | ((Prom[0x500 + i] & 0x03) << 4); + Palette[0x100 + i] = tmp[ctabentry]; + + ctabentry = Prom[0x600 + i] | ((Prom[0x700 + i] & 0x07) << 4) | 0x80; + Palette[0x200 + i] = tmp[ctabentry]; + } + + return 0; +} + +static INT32 gunsmoke_gfx_decode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x80000); + if (!tmp) return 1; + + static INT32 Planes[4] = { 0x100004, 0x100000, 4, 0 }; + + static INT32 CharXOffs[8] = { 11, 10, 9, 8, 3, 2, 1, 0 }; + static INT32 CharYOffs[8] = { 112, 96, 80, 64, 48, 32, 16, 0 }; + + static INT32 TileXOffs[32] = { 0, 1, 2, 3, 8, 9, 10, 11, + 512, 513, 514, 515, 520, 521, 522, 523, + 1024, 1025, 1026, 1027, 1032, 1033, 1034, 1035, + 1536, 1537, 1538, 1539, 1544, 1545, 1546, 1547 }; + + static INT32 TileYOffs[32] = { 0, 16, 32, 48, 64, 80, 96, 112, + 128, 144, 160, 176, 192, 208, 224, 240, + 256, 272, 288, 304, 320, 336, 352, 368, + 384, 400, 416, 432, 448, 464, 480, 496 }; + + static INT32 SpriXOffs[16] = { 0, 1, 2, 3, 8, 9, 10, 11, + 256, 257, 258, 259, 264, 265, 266, 267 }; + + memcpy (tmp, Gfx0, 0x04000); + GfxDecode(0x400, 2, 8, 8, Planes + 2, CharXOffs, CharYOffs, 0x080, tmp, Gfx0); + + memcpy (tmp, Gfx1, 0x40000); + GfxDecode(0x200, 4, 32, 32, Planes + 0, TileXOffs, TileYOffs, 0x800, tmp, Gfx1); + + memcpy (tmp, Gfx2, 0x40000); + GfxDecode(0x800, 4, 16, 16, Planes + 0, SpriXOffs, TileYOffs, 0x200, tmp, Gfx2); + + BurnFree (tmp); + + { + memset (SprTrnsp, 1, 0x800); + + for (INT32 i = 0; i < 0x80000; i++) + if (Gfx2[i]) SprTrnsp[i >> 8] = 0; + } + + return 0; +} + +static INT32 gunsmokeSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3000000; +} + +static double gunsmokeGetTime() +{ + return (double)ZetTotalCycles() / 3000000; +} + + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Rom0 = Next; Next += 0x20000; + Rom1 = Next; Next += 0x08000; + Ram = Next; Next += 0x04000; + Gfx0 = Next; Next += 0x10000; + Gfx1 = Next; Next += 0x80000; + Gfx2 = Next; Next += 0x80000; + Gfx3 = Next; Next += 0x08000; + Prom = Next; Next += 0x00800; + + SprTrnsp = Next; Next += 0x00800; + + Palette = (UINT32*)Next; Next += 0x00300 * sizeof(UINT32); + DrvPal = (UINT32*)Next; Next += 0x00300 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Rom0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(Rom0 + 0x10000, 1, 1)) return 1; + if (BurnLoadRom(Rom0 + 0x18000, 2, 1)) return 1; + + if (BurnLoadRom(Rom1 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(Gfx0 + 0x00000, 4, 1)) return 1; + + if (BurnLoadRom(Gfx3 + 0x00000, 21, 1)) return 1; + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(Gfx1 + i * 0x8000, 5 + i, 1)) return 1; + if (BurnLoadRom(Gfx2 + i * 0x8000, 13 + i, 1)) return 1; + if (BurnLoadRom(Prom + i * 0x0100, 22 + i, 1)) return 1; + } + + gunsmoke_gfx_decode(); + gunsmoke_palette_init(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, Rom0 + 0x00000); + ZetMapArea(0x0000, 0x7fff, 2, Rom0 + 0x00000); + ZetMapArea(0x8000, 0xbfff, 0, Rom0 + 0x10000); + ZetMapArea(0x8000, 0xbfff, 2, Rom0 + 0x10000); + ZetMapArea(0xd000, 0xd7ff, 0, Ram + 0x00000); + ZetMapArea(0xd000, 0xd7ff, 1, Ram + 0x00000); + ZetMapArea(0xe000, 0xefff, 0, Ram + 0x01000); + ZetMapArea(0xe000, 0xefff, 1, Ram + 0x01000); + ZetMapArea(0xe000, 0xefff, 2, Ram + 0x01000); + ZetMapArea(0xf000, 0xffff, 0, Ram + 0x02000); + ZetMapArea(0xf000, 0xffff, 1, Ram + 0x02000); + ZetSetReadHandler(gunsmoke_cpu0_read); + ZetSetWriteHandler(gunsmoke_cpu0_write); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, Rom1 + 0x00000); + ZetMapArea(0x0000, 0x7fff, 2, Rom1 + 0x00000); + ZetMapArea(0xc000, 0xc7ff, 0, Ram + 0x03000); + ZetMapArea(0xc000, 0xc7ff, 1, Ram + 0x03000); + ZetMapArea(0xc000, 0xc7ff, 2, Ram + 0x03000); + ZetSetReadHandler(gunsmoke_cpu1_read); + ZetSetWriteHandler(gunsmoke_cpu1_write); + ZetClose(); + + GenericTilesInit(); + + BurnYM2203Init(2, 1500000, NULL, gunsmokeSynchroniseStream, gunsmokeGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.14, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.22, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.22, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.22, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.14, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.22, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.22, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.22, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + BurnYM2203Exit(); + + BurnFree (Mem); + + Mem = MemEnd = Rom0 = Rom1 = Ram = NULL; + Gfx0 = Gfx1 = Gfx2 = Gfx3 = Prom = NULL; + SprTrnsp = NULL; + Palette = DrvPal = NULL; + + soundlatch = flipscreen = nGunsmokeBank; + + sprite3bank = chon = bgon = objon = 0; + gunsmoke_scrollx[0] = gunsmoke_scrollx[1] = 0; + gunsmoke_scrolly = 0; + + return 0; +} + +static void draw_bg_layer() +{ + UINT16 scroll = gunsmoke_scrollx[0] + (gunsmoke_scrollx[1] << 8); + + UINT8 *tilerom = Gfx3 + ((scroll >> 1) & ~0x0f); + + for (INT32 offs = 0; offs < 0x50; offs++) + { + INT32 attr = tilerom[1]; + INT32 code = tilerom[0] + ((attr & 1) << 8); + INT32 color = (attr & 0x3c) >> 2; + INT32 flipy = attr & 0x80; + INT32 flipx = attr & 0x40; + + INT32 sy = (offs & 7) << 5; + INT32 sx = (offs >> 3) << 5; + + sy -= gunsmoke_scrolly; + sx -= (scroll & 0x1f); + + if (flipscreen) { + flipy ^= 0x80; + flipx ^= 0x40; + + sy = 224 - sy; + sx = 224 - sx; + } + + sy -= 16; + + if (flipy) { + if (flipx) { + Render32x32Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, Gfx1); + } else { + Render32x32Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, Gfx1); + } + } else { + if (flipx) { + Render32x32Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, Gfx1); + } else { + Render32x32Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, Gfx1); + } + } + + tilerom += 2; + } +} + +static void draw_fg_layer() +{ + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 sx = (offs << 3) & 0xf8; + INT32 sy = (offs >> 2) & 0xf8; + + INT32 attr = Ram[0x0400 + offs]; + INT32 code = Ram[0x0000 + offs] + ((attr & 0xe0) << 2); + INT32 color = attr & 0x1f; + + if (code == 0x0024) continue; + + UINT8 *src = Gfx0 + (code << 6); + color <<= 2; + + if (flipscreen) { + sy = 240 - sy; + sx = 240 - sx; + + sy -= 8; + + for (INT32 y = sy + 7; y >= sy; y--) + { + for (INT32 x = sx + 7; x >= sx; x--, src++) + { + if (y < 0 || x < 0 || y > 223 || x > 255) continue; + if (!Palette[color|*src]) continue; + + pTransDraw[(y << 8) | x] = color | *src; + } + } + } else { + sy -= 16; + + for (INT32 y = sy; y < sy + 8; y++) + { + for (INT32 x = sx; x < sx + 8; x++, src++) + { + if (y < 0 || x < 0 || y > 223 || x > 255) continue; + if (!Palette[color|*src]) continue; + + pTransDraw[(y << 8) | x] = color | *src; + } + } + } + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0x1000 - 32; offs >= 0; offs -= 32) + { + INT32 attr = Ram[0x2001 + offs]; + INT32 bank = (attr & 0xc0) >> 6; + INT32 code = Ram[0x2000 + offs]; + INT32 color = attr & 0x0f; + INT32 flipx = 0; + INT32 flipy = attr & 0x10; + INT32 sx = Ram[0x2003 + offs] - ((attr & 0x20) << 3); + INT32 sy = Ram[0x2002 + offs]; + + if (sy == 0 || sy > 0xef) continue; + + if (bank == 3) bank += sprite3bank; + code += 256 * bank; + + if (SprTrnsp[code]) continue; + + if (flipscreen) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + sy -= 16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x200, Gfx2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x200, Gfx2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x200, Gfx2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x200, Gfx2); + } + } + } +} + +static INT32 DrvDraw() +{ + // Recalculate palette + if (DrvCalcPal) { + for (INT32 i = 0; i < 0x300; i++) { + UINT32 col = Palette[i]; + DrvPal[i] = BurnHighCol(col >> 16, col >> 8, col, 0); + } + } + + if (!bgon) memset (pTransDraw, 0, 224 * 256 * 2); + + if (bgon) draw_bg_layer(); + if (objon) draw_sprites(); + if (chon) draw_fg_layer(); + + BurnTransferCopy(DrvPal); + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + INT32 nInterleave = 25; + INT32 nSoundBufferPos = 0; + + INT32 nCyclesSegment; + INT32 nCyclesDone[2], nCyclesTotal[2]; + + nCyclesTotal[0] = 4000000 / 60; + nCyclesTotal[1] = 3000000 / 60; + + nCyclesDone[0] = nCyclesDone[1] = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #0 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 20) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == 21) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + // Run Z80 #1 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + if (i == 5 || i == 10 || i == 15 || i == 20) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == 6 || i == 11 || i == 16 || i == 21) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + + ZetClose(); + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + ZetOpen(1); + BurnYM2203Update(pSoundBuf, nSegmentLength); + ZetClose(); + nSoundBufferPos += nSegmentLength; + } + + } + + ZetOpen(1); + BurnTimerEndFrame(nCyclesTotal[1]); + ZetClose(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + ZetOpen(1); + BurnYM2203Update(pSoundBuf, nSegmentLength); + ZetClose(); + } + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = Ram; + ba.nLen = 0x4000; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + BurnYM2203Scan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(soundlatch); + SCAN_VAR(flipscreen); + SCAN_VAR(nGunsmokeBank); + SCAN_VAR(sprite3bank); + SCAN_VAR(chon); + SCAN_VAR(bgon); + SCAN_VAR(objon); + SCAN_VAR(gunsmoke_scrollx[0]); + SCAN_VAR(gunsmoke_scrollx[1]); + SCAN_VAR(gunsmoke_scrolly); + } + + return 0; +} + + +// Gun. Smoke (World) + +static struct BurnRomInfo gunsmokeRomDesc[] = { + { "09n_gs03.bin", 0x8000, 0x40a06cef, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "10n_gs04.bin", 0x8000, 0x8d4b423f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "12n_gs05.bin", 0x8000, 0x2b5667fb, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "14h_gs02.bin", 0x8000, 0xcd7a2c38, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "11f_gs01.bin", 0x4000, 0xb61ece9b, 3 | BRF_GRA }, // 4 Character Tiles + + { "06c_gs13.bin", 0x8000, 0xf6769fc5, 4 | BRF_GRA }, // 5 32x32 Tiles + { "05c_gs12.bin", 0x8000, 0xd997b78c, 4 | BRF_GRA }, // 6 + { "04c_gs11.bin", 0x8000, 0x125ba58e, 4 | BRF_GRA }, // 7 + { "02c_gs10.bin", 0x8000, 0xf469c13c, 4 | BRF_GRA }, // 8 + { "06a_gs09.bin", 0x8000, 0x539f182d, 4 | BRF_GRA }, // 9 + { "05a_gs08.bin", 0x8000, 0xe87e526d, 4 | BRF_GRA }, // 10 + { "04a_gs07.bin", 0x8000, 0x4382c0d2, 4 | BRF_GRA }, // 11 + { "02a_gs06.bin", 0x8000, 0x4cafe7a6, 4 | BRF_GRA }, // 12 + + { "06n_gs22.bin", 0x8000, 0xdc9c508c, 5 | BRF_GRA }, // 13 Sprites + { "04n_gs21.bin", 0x8000, 0x68883749, 5 | BRF_GRA }, // 14 + { "03n_gs20.bin", 0x8000, 0x0be932ed, 5 | BRF_GRA }, // 15 + { "01n_gs19.bin", 0x8000, 0x63072f93, 5 | BRF_GRA }, // 16 + { "06l_gs18.bin", 0x8000, 0xf69a3c7c, 5 | BRF_GRA }, // 17 + { "04l_gs17.bin", 0x8000, 0x4e98562a, 5 | BRF_GRA }, // 18 + { "03l_gs16.bin", 0x8000, 0x0d99c3b3, 5 | BRF_GRA }, // 19 + { "01l_gs15.bin", 0x8000, 0x7f14270e, 5 | BRF_GRA }, // 20 + + { "11c_gs14.bin", 0x8000, 0x0af4f7eb, 6 | BRF_GRA }, // 21 Background Tilemaps + + { "03b_g-01.bin", 0x0100, 0x02f55589, 7 | BRF_GRA }, // 22 Color Proms + { "04b_g-02.bin", 0x0100, 0xe1e36dd9, 7 | BRF_GRA }, // 23 + { "05b_g-03.bin", 0x0100, 0x989399c0, 7 | BRF_GRA }, // 24 + { "09d_g-04.bin", 0x0100, 0x906612b5, 7 | BRF_GRA }, // 25 + { "14a_g-06.bin", 0x0100, 0x4a9da18b, 7 | BRF_GRA }, // 26 + { "15a_g-07.bin", 0x0100, 0xcb9394fc, 7 | BRF_GRA }, // 27 + { "09f_g-09.bin", 0x0100, 0x3cee181e, 7 | BRF_GRA }, // 28 + { "08f_g-08.bin", 0x0100, 0xef91cdd2, 7 | BRF_GRA }, // 29 + + { "02j_g-10.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 30 Video Timing + { "01f_g-05.bin", 0x0100, 0x25c90c2a, 0 | BRF_OPT }, // 31 Priority +}; + +STD_ROM_PICK(gunsmoke) +STD_ROM_FN(gunsmoke) + +struct BurnDriver BurnDrvGunsmoke = { + "gunsmoke", NULL, NULL, NULL, "1985", + "Gun. Smoke (World)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, gunsmokeRomInfo, gunsmokeRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x300, + 224, 256, 3, 4 +}; + + +// Gun. Smoke (Japan) + +static struct BurnRomInfo gunsmokjRomDesc[] = { + { "gs03_9n.rom", 0x8000, 0xb56b5df6, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "10n_gs04.bin", 0x8000, 0x8d4b423f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "12n_gs05.bin", 0x8000, 0x2b5667fb, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "14h_gs02.bin", 0x8000, 0xcd7a2c38, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "11f_gs01.bin", 0x4000, 0xb61ece9b, 3 | BRF_GRA }, // 4 Character Tiles + + { "06c_gs13.bin", 0x8000, 0xf6769fc5, 4 | BRF_GRA }, // 5 32x32 Tiles + { "05c_gs12.bin", 0x8000, 0xd997b78c, 4 | BRF_GRA }, // 6 + { "04c_gs11.bin", 0x8000, 0x125ba58e, 4 | BRF_GRA }, // 7 + { "02c_gs10.bin", 0x8000, 0xf469c13c, 4 | BRF_GRA }, // 8 + { "06a_gs09.bin", 0x8000, 0x539f182d, 4 | BRF_GRA }, // 9 + { "05a_gs08.bin", 0x8000, 0xe87e526d, 4 | BRF_GRA }, // 10 + { "04a_gs07.bin", 0x8000, 0x4382c0d2, 4 | BRF_GRA }, // 11 + { "02a_gs06.bin", 0x8000, 0x4cafe7a6, 4 | BRF_GRA }, // 12 + + { "06n_gs22.bin", 0x8000, 0xdc9c508c, 5 | BRF_GRA }, // 13 Sprites + { "04n_gs21.bin", 0x8000, 0x68883749, 5 | BRF_GRA }, // 14 + { "03n_gs20.bin", 0x8000, 0x0be932ed, 5 | BRF_GRA }, // 15 + { "01n_gs19.bin", 0x8000, 0x63072f93, 5 | BRF_GRA }, // 16 + { "06l_gs18.bin", 0x8000, 0xf69a3c7c, 5 | BRF_GRA }, // 17 + { "04l_gs17.bin", 0x8000, 0x4e98562a, 5 | BRF_GRA }, // 18 + { "03l_gs16.bin", 0x8000, 0x0d99c3b3, 5 | BRF_GRA }, // 19 + { "01l_gs15.bin", 0x8000, 0x7f14270e, 5 | BRF_GRA }, // 20 + + { "11c_gs14.bin", 0x8000, 0x0af4f7eb, 6 | BRF_GRA }, // 21 Background Tilemaps + + { "03b_g-01.bin", 0x0100, 0x02f55589, 7 | BRF_GRA }, // 22 Color Proms + { "04b_g-02.bin", 0x0100, 0xe1e36dd9, 7 | BRF_GRA }, // 23 + { "05b_g-03.bin", 0x0100, 0x989399c0, 7 | BRF_GRA }, // 24 + { "09d_g-04.bin", 0x0100, 0x906612b5, 7 | BRF_GRA }, // 25 + { "14a_g-06.bin", 0x0100, 0x4a9da18b, 7 | BRF_GRA }, // 26 + { "15a_g-07.bin", 0x0100, 0xcb9394fc, 7 | BRF_GRA }, // 27 + { "09f_g-09.bin", 0x0100, 0x3cee181e, 7 | BRF_GRA }, // 28 + { "08f_g-08.bin", 0x0100, 0xef91cdd2, 7 | BRF_GRA }, // 29 + + { "02j_g-10.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 30 Video Timing + { "01f_g-05.bin", 0x0100, 0x25c90c2a, 0 | BRF_OPT }, // 31 Priority +}; + +STD_ROM_PICK(gunsmokj) +STD_ROM_FN(gunsmokj) + +struct BurnDriver BurnDrvGunsmokj = { + "gunsmokej", "gunsmoke", NULL, NULL, "1985", + "Gun. Smoke (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, gunsmokjRomInfo, gunsmokjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x300, + 224, 256, 3, 4 +}; + + +// Gun. Smoke (US set 1) + +static struct BurnRomInfo gunsmokuRomDesc[] = { + { "9n_gs03.bin", 0x8000, 0x592f211b, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "10n_gs04.bin", 0x8000, 0x8d4b423f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "12n_gs05.bin", 0x8000, 0x2b5667fb, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "14h_gs02.bin", 0x8000, 0xcd7a2c38, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "11f_gs01.bin", 0x4000, 0xb61ece9b, 3 | BRF_GRA }, // 4 Character Tiles + + { "06c_gs13.bin", 0x8000, 0xf6769fc5, 4 | BRF_GRA }, // 5 32x32 Tiles + { "05c_gs12.bin", 0x8000, 0xd997b78c, 4 | BRF_GRA }, // 6 + { "04c_gs11.bin", 0x8000, 0x125ba58e, 4 | BRF_GRA }, // 7 + { "02c_gs10.bin", 0x8000, 0xf469c13c, 4 | BRF_GRA }, // 8 + { "06a_gs09.bin", 0x8000, 0x539f182d, 4 | BRF_GRA }, // 9 + { "05a_gs08.bin", 0x8000, 0xe87e526d, 4 | BRF_GRA }, // 10 + { "04a_gs07.bin", 0x8000, 0x4382c0d2, 4 | BRF_GRA }, // 11 + { "02a_gs06.bin", 0x8000, 0x4cafe7a6, 4 | BRF_GRA }, // 12 + + { "06n_gs22.bin", 0x8000, 0xdc9c508c, 5 | BRF_GRA }, // 13 Sprites + { "04n_gs21.bin", 0x8000, 0x68883749, 5 | BRF_GRA }, // 14 + { "03n_gs20.bin", 0x8000, 0x0be932ed, 5 | BRF_GRA }, // 15 + { "01n_gs19.bin", 0x8000, 0x63072f93, 5 | BRF_GRA }, // 16 + { "06l_gs18.bin", 0x8000, 0xf69a3c7c, 5 | BRF_GRA }, // 17 + { "04l_gs17.bin", 0x8000, 0x4e98562a, 5 | BRF_GRA }, // 18 + { "03l_gs16.bin", 0x8000, 0x0d99c3b3, 5 | BRF_GRA }, // 19 + { "01l_gs15.bin", 0x8000, 0x7f14270e, 5 | BRF_GRA }, // 20 + + { "11c_gs14.bin", 0x8000, 0x0af4f7eb, 6 | BRF_GRA }, // 21 Background Tilemaps + + { "03b_g-01.bin", 0x0100, 0x02f55589, 7 | BRF_GRA }, // 22 Color Proms + { "04b_g-02.bin", 0x0100, 0xe1e36dd9, 7 | BRF_GRA }, // 23 + { "05b_g-03.bin", 0x0100, 0x989399c0, 7 | BRF_GRA }, // 24 + { "09d_g-04.bin", 0x0100, 0x906612b5, 7 | BRF_GRA }, // 25 + { "14a_g-06.bin", 0x0100, 0x4a9da18b, 7 | BRF_GRA }, // 26 + { "15a_g-07.bin", 0x0100, 0xcb9394fc, 7 | BRF_GRA }, // 27 + { "09f_g-09.bin", 0x0100, 0x3cee181e, 7 | BRF_GRA }, // 28 + { "08f_g-08.bin", 0x0100, 0xef91cdd2, 7 | BRF_GRA }, // 29 + + { "02j_g-10.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 30 Video Timing + { "01f_g-05.bin", 0x0100, 0x25c90c2a, 0 | BRF_OPT }, // 31 Priority +}; + +STD_ROM_PICK(gunsmoku) +STD_ROM_FN(gunsmoku) + +struct BurnDriver BurnDrvGunsmoku = { + "gunsmokeu", "gunsmoke", NULL, NULL, "1985", + "Gun. Smoke (US set 1)\0", NULL, "Capcom (Romstar License)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, gunsmokuRomInfo, gunsmokuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x300, + 224, 256, 3, 4 +}; + + +// Gun. Smoke (US set 2) + +static struct BurnRomInfo gunsmokaRomDesc[] = { + { "gs03.9n", 0x8000, 0x51dc3f76, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "gs04.10n", 0x8000, 0x5ecf31b8, 1 | BRF_PRG | BRF_ESS }, // 1 + { "gs05.12n", 0x8000, 0x1c9aca13, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "14h_gs02.bin", 0x8000, 0xcd7a2c38, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "11f_gs01.bin", 0x4000, 0xb61ece9b, 3 | BRF_GRA }, // 4 Character Tiles + + { "06c_gs13.bin", 0x8000, 0xf6769fc5, 4 | BRF_GRA }, // 5 32x32 Tiles + { "05c_gs12.bin", 0x8000, 0xd997b78c, 4 | BRF_GRA }, // 6 + { "04c_gs11.bin", 0x8000, 0x125ba58e, 4 | BRF_GRA }, // 7 + { "02c_gs10.bin", 0x8000, 0xf469c13c, 4 | BRF_GRA }, // 8 + { "06a_gs09.bin", 0x8000, 0x539f182d, 4 | BRF_GRA }, // 9 + { "05a_gs08.bin", 0x8000, 0xe87e526d, 4 | BRF_GRA }, // 10 + { "04a_gs07.bin", 0x8000, 0x4382c0d2, 4 | BRF_GRA }, // 11 + { "02a_gs06.bin", 0x8000, 0x4cafe7a6, 4 | BRF_GRA }, // 12 + + { "06n_gs22.bin", 0x8000, 0xdc9c508c, 5 | BRF_GRA }, // 13 Sprites + { "04n_gs21.bin", 0x8000, 0x68883749, 5 | BRF_GRA }, // 14 + { "03n_gs20.bin", 0x8000, 0x0be932ed, 5 | BRF_GRA }, // 15 + { "01n_gs19.bin", 0x8000, 0x63072f93, 5 | BRF_GRA }, // 16 + { "06l_gs18.bin", 0x8000, 0xf69a3c7c, 5 | BRF_GRA }, // 17 + { "04l_gs17.bin", 0x8000, 0x4e98562a, 5 | BRF_GRA }, // 18 + { "03l_gs16.bin", 0x8000, 0x0d99c3b3, 5 | BRF_GRA }, // 19 + { "01l_gs15.bin", 0x8000, 0x7f14270e, 5 | BRF_GRA }, // 20 + + { "11c_gs14.bin", 0x8000, 0x0af4f7eb, 6 | BRF_GRA }, // 21 Background Tilemaps + + { "03b_g-01.bin", 0x0100, 0x02f55589, 7 | BRF_GRA }, // 22 Color Proms + { "04b_g-02.bin", 0x0100, 0xe1e36dd9, 7 | BRF_GRA }, // 23 + { "05b_g-03.bin", 0x0100, 0x989399c0, 7 | BRF_GRA }, // 24 + { "09d_g-04.bin", 0x0100, 0x906612b5, 7 | BRF_GRA }, // 25 + { "14a_g-06.bin", 0x0100, 0x4a9da18b, 7 | BRF_GRA }, // 26 + { "15a_g-07.bin", 0x0100, 0xcb9394fc, 7 | BRF_GRA }, // 27 + { "09f_g-09.bin", 0x0100, 0x3cee181e, 7 | BRF_GRA }, // 28 + { "08f_g-08.bin", 0x0100, 0xef91cdd2, 7 | BRF_GRA }, // 29 + + { "02j_g-10.bin", 0x0100, 0x0eaf5158, 0 | BRF_OPT }, // 30 Video Timing + { "01f_g-05.bin", 0x0100, 0x25c90c2a, 0 | BRF_OPT }, // 31 Priority +}; + +STD_ROM_PICK(gunsmoka) +STD_ROM_FN(gunsmoka) + +struct BurnDriver BurnDrvGunsmoka = { + "gunsmokeua", "gunsmoke", NULL, NULL, "1986", + "Gun. Smoke (US set 2)\0", NULL, "Capcom (Romstar License)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, gunsmokaRomInfo, gunsmokaRomName, NULL, NULL, DrvInputInfo, gunsmokaDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x300, + 224, 256, 3, 4 +}; + diff --git a/src/burn/drv/pre90s/d_ikki.cpp b/src/burn/drv/pre90s/d_ikki.cpp index 5373d5dda..aafe111d5 100644 --- a/src/burn/drv/pre90s/d_ikki.cpp +++ b/src/burn/drv/pre90s/d_ikki.cpp @@ -1,670 +1,668 @@ -// FB Alpha Ikki / Farmers Rebellion driver module -// Based on MAME driver by Uki - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "sn76496.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvColPROM; -static UINT8 *DrvVidAttr; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvShareRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvVidRAM; -static UINT32 *DrvPalette; -static UINT32 *Palette; -static UINT8 *DrvTransMask; -static UINT8 DrvRecalc; - -static UINT8 DrvReset; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[3]; - -static UINT8 *flipscreen; -static UINT8 *ikki_scroll; - -static INT32 vblank; - -static struct BurnInputInfo IkkiInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 7, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Ikki) - -static struct BurnDIPInfo IkkiDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x10, 0x01, 0x01, 0x00, "3" }, - {0x10, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2, "2 Player Game" }, - {0x10, 0x01, 0x02, 0x00, "2 Credits" }, - {0x10, 0x01, 0x02, 0x02, "1 Credit" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x10, 0x01, 0x04, 0x00, "Off" }, - {0x10, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 16, "Coin1 / Coin2" }, - {0x10, 0x01, 0xf0, 0x00, "1 Coin 1 Credit / 1 Coin 1 Credit " }, - {0x10, 0x01, 0xf0, 0x10, "2 Coins 1 Credit / 2 Coins 1 Credit " }, - {0x10, 0x01, 0xf0, 0x20, "2 Coins 1 Credit / 1 Coin 3 Credits" }, - {0x10, 0x01, 0xf0, 0x30, "1 Coin 1 Credit / 1 Coin 2 Credits" }, - {0x10, 0x01, 0xf0, 0x40, "1 Coin 1 Credit / 1 Coin 3 Credits" }, - {0x10, 0x01, 0xf0, 0x50, "1 Coin 1 Credit / 1 Coin 4 Credits" }, - {0x10, 0x01, 0xf0, 0x60, "1 Coin 1 Credit / 1 Coin 5 Credits" }, - {0x10, 0x01, 0xf0, 0x70, "1 Coin 1 Credit / 1 Coin 6 Credits" }, - {0x10, 0x01, 0xf0, 0x80, "1 Coin 2 Credits / 1 Coin 2 Credits" }, - {0x10, 0x01, 0xf0, 0x90, "1 Coin 2 Credits / 1 Coin 4 Credits" }, - {0x10, 0x01, 0xf0, 0xa0, "1 Coin 2 Credits / 1 Coin 5 Credits" }, - {0x10, 0x01, 0xf0, 0xb0, "1 Coin 2 Credits / 1 Coin 10 Credits" }, - {0x10, 0x01, 0xf0, 0xc0, "1 Coin 2 Credits / 1 Coin 11 Credits" }, - {0x10, 0x01, 0xf0, 0xd0, "1 Coin 2 Credits / 1 Coin 12 Credits" }, - {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits / 1 Coin 6 Credits" }, - {0x10, 0x01, 0xf0, 0xf0, "Free_Play" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x11, 0x01, 0x06, 0x00, "1 (Normal)" }, - {0x11, 0x01, 0x06, 0x02, "2" }, - {0x11, 0x01, 0x06, 0x04, "3" }, - {0x11, 0x01, 0x06, 0x06, "4 (Difficult)" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x11, 0x01, 0x80, 0x00, "Off" }, - {0x11, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Ikki) - -void __fastcall ikki_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe008: - *flipscreen = data & 4; - return; - - case 0xe00a: - case 0xe00b: - ikki_scroll[address & 1] = data; - return; - } -} - -UINT8 __fastcall ikki_main_read(UINT16 address) -{ - switch (address) - { - case 0xe000: - return (vblank ? 2 : 0); - - case 0xe001: - return DrvDips[0]; - - case 0xe002: - return DrvDips[1]; - - case 0xe003: - return DrvInputs[2]; - - case 0xe004: - return DrvInputs[0]; - - case 0xe005: - return DrvInputs[1]; - } - - return 0; -} - -void __fastcall ikki_sub_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xd801: - SN76496Write(0, data); - return; - - case 0xd802: - SN76496Write(1, data); - return; - } -} - -UINT8 __fastcall ikki_sub_read(UINT16 /*address*/) -{ - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - return 0; -} - -static void DrvPaletteInit() -{ - UINT32 *tmp = (UINT32*)BurnMalloc(0x100 * sizeof(UINT32)); - - for (INT32 i = 0; i < 0x100; i++) - { - UINT8 r, g, b; - - r = DrvColPROM[i + 0x000] & 0x0f; - g = DrvColPROM[i + 0x100] & 0x0f; - b = DrvColPROM[i + 0x200] & 0x0f; - - tmp[i] = (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b; - } - - DrvColPROM += 0x300; - - memset (DrvTransMask, 1, 0x200); - - for (INT32 i = 0; i < 0x200; i++) - { - UINT16 ctabentry = DrvColPROM[i] ^ 0xff; - - if ((i & 0x07) == 0x07 && ctabentry == 0) DrvTransMask[i] = 0; - if ((i & 0x07) == 0x00) DrvTransMask[i] = 0; // Seems to work... - - Palette[i] = tmp[ctabentry]; - } - - for (INT32 i = 0x200; i < 0x400; i++) { - Palette[i] = tmp[DrvColPROM[i]]; - } - - BurnFree(tmp); -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[3] = { 16384*8*2,16384*8,0 }; - INT32 XOffs[16] = { 7,6,5,4,3,2,1,0,8*16+7,8*16+6,8*16+5,8*16+4,8*16+3,8*16+2,8*16+1,8*16+0 }; - INT32 YOffs[32] = { 8*0, 8*1, 8*2, 8*3, 8*4, 8*5, 8*6, 8*7, 8*8,8*9,8*10,8*11,8*12,8*13,8*14,8*15, - 8*32,8*33,8*34,8*35,8*36,8*37,8*38,8*39, 8*40,8*41,8*42,8*43,8*44,8*45,8*46,8*47 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0xc000); - - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0xc000); - - GfxDecode(0x800, 3, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0xc000); - - GfxDecode(0x100, 3, 16, 32, Plane, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x010000; - DrvZ80ROM1 = Next; Next += 0x010000; - - DrvColPROM = Next; Next += 0x000800; - - DrvVidAttr = Next; Next += 0x000100; - - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - Palette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - DrvGfxROM0 = Next; Next += 0x020000; - DrvGfxROM1 = Next; Next += 0x020000; - - DrvTransMask = Next; Next += 0x000200; - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x000800; - DrvShareRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x000800; - DrvVidRAM = Next; Next += 0x000800; - - ikki_scroll = Next; Next += 0x000002; - flipscreen = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x0000, 0, 1)) return 1; - memcpy (DrvZ80ROM0 + 0x8000, DrvZ80ROM0 + 0x2000, 0x2000); - - if (BurnLoadRom(DrvZ80ROM0 + 0x2000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x4000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x6000, 3, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x0000, 4, 1)) return 1; - - for (INT32 i = 0; i < 3; i++) { - if (BurnLoadRom(DrvGfxROM1 + 0x4000 * i, 5 + i, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x4000 * i, 8 + i, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x0100 * i, 11 + i, 1)) return 1; - } - - if (BurnLoadRom(DrvColPROM + 0x0300, 14, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x0500, 15, 1)) return 1; - - if (BurnLoadRom(DrvVidAttr + 0x0000, 16, 1)) return 1; - - DrvGfxDecode(); - DrvPaletteInit(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x9fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x9fff, 2, DrvZ80ROM0); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM0); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM0); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM0); - ZetMapArea(0xc800, 0xcfff, 0, DrvShareRAM); - ZetMapArea(0xc800, 0xcfff, 1, DrvShareRAM); - ZetMapArea(0xc800, 0xcfff, 2, DrvShareRAM); - ZetMapArea(0xd000, 0xd7ff, 0, DrvVidRAM); - ZetMapArea(0xd000, 0xd7ff, 1, DrvVidRAM); - ZetMapArea(0xd000, 0xd7ff, 2, DrvVidRAM); - ZetSetWriteHandler(ikki_main_write); - ZetSetReadHandler(ikki_main_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x1fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x1fff, 2, DrvZ80ROM1); - ZetMapArea(0xc000, 0xc7ff, 0, DrvSprRAM); - ZetMapArea(0xc000, 0xc7ff, 1, DrvSprRAM); - ZetMapArea(0xc000, 0xc7ff, 2, DrvSprRAM); - ZetMapArea(0xc800, 0xcfff, 0, DrvShareRAM); - ZetMapArea(0xc800, 0xcfff, 1, DrvShareRAM); - ZetMapArea(0xc800, 0xcfff, 2, DrvShareRAM); - ZetSetWriteHandler(ikki_sub_write); - ZetSetReadHandler(ikki_sub_read); - ZetMemEnd(); - ZetClose(); - - SN76496Init(0, 8000000/4, 0); - SN76496Init(1, 8000000/2, 1); - SN76496SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 0.75, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - SN76496Exit(); - ZetExit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_sprites() -{ - for (INT32 offs = 0; offs < 0x800; offs += 4) - { - INT32 code = (DrvSprRAM[offs + 2] & 0x80) | (DrvSprRAM[offs + 1] >> 1); - INT32 color = DrvSprRAM[offs + 2] & 0x3f; - - INT32 sx = DrvSprRAM[offs + 3]; - INT32 sy = DrvSprRAM[offs + 0]; - - if (*flipscreen) - sx = 240 - sx; - else - sy = 224 - sy; - - sx &= 0xff; - sy &= 0xff; - if (sx > 248) sx -= 256; - if (sy > 240) sy -= 256; - - sy -= 16; - sx -= 8; - - { - UINT8 *src = DrvGfxROM1 + (code << 9); - color <<= 3; - - if (*flipscreen) { - for (INT32 y = 31; y >= 0; y--) - { - INT32 yy = sy + y; - - for (INT32 x = 15; x >= 0; x--) - { - INT32 xx = sx + x; - INT32 pxl = src[15-x] | color; - - if (xx < 0 || yy < 0 || xx >= nScreenWidth || yy >= nScreenHeight) continue; - - if (DrvTransMask[pxl]) - pTransDraw[(yy * nScreenWidth) + xx] = pxl; - } - - src += 16; - } - } else { - for (INT32 y = 0; y < 32; y++) - { - INT32 yy = sy + y; - - for (INT32 x = 0; x < 16; x++) - { - INT32 xx = sx + x; - INT32 pxl = src[x] | color; - - if (xx < 0 || yy < 0 || xx >= nScreenWidth || yy >= nScreenHeight) continue; - - if (DrvTransMask[pxl]) - pTransDraw[(yy * nScreenWidth) + xx] = pxl; - } - - src += 16; - } - } - } - } -} - -static void draw_bg_layer(INT32 prio) -{ - for (INT32 offs = 0; offs < 0x800 / 2; offs++) - { - INT32 x = (offs >> 5) << 3; - INT32 y = (offs & 0x1f) << 3; - INT32 d = DrvVidAttr[x >> 3]; - - if (d != 0 && d != 0x0d) { - if (prio) continue; - } - - INT32 color = DrvVidRAM[offs << 1]; - INT32 code = DrvVidRAM[(offs << 1) | 1] + ((color & 0xe0) << 3); - color = (color & 0x1f) | ((color & 0x80) >> 2); - - if (d == 0x02 && prio == 0) { - x -= ikki_scroll[1]; - if (x < 0) x += 176; - - y = (y + ~ikki_scroll[0]) & 0xff; - } - - if (*flipscreen) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, (248-x)-8, (248-y)-16, color, 3, 0x200, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, x-8, y-16, color, 3, 0x200, DrvGfxROM0); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - draw_bg_layer(0); - draw_sprites(); - draw_bg_layer(1); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0x00, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - // clear opposites - if (DrvJoy1[2] && DrvJoy1[3]) DrvInputs[0] &= ~0x0c; - if (DrvJoy1[1] && DrvJoy1[0]) DrvInputs[0] &= ~0x03; - if (DrvJoy2[3] && DrvJoy2[2]) DrvInputs[1] &= ~0x0c; - if (DrvJoy2[1] && DrvJoy2[0]) DrvInputs[1] &= ~0x03; - } - - INT32 nCycleSegment; - INT32 nInterleave = 256; - INT32 nCyclesTotal[2] = { 4000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - vblank = 1; - - for (INT32 i = 0; i < nInterleave; i++) - { - nCycleSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); - - ZetOpen(0); - nCyclesDone[0] += ZetRun(nCycleSegment); - if (i == 15) { - vblank = 0; - ZetRaiseIrq(0); - } - if (i == 239) { - ZetRaiseIrq(0); - vblank = 1; - } - ZetClose(); - - nCycleSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i); - - ZetOpen(1); - nCyclesDone[1] += ZetRun(nCycleSegment); - if (i == 15) ZetRaiseIrq(0); - if (i == 239)ZetRaiseIrq(0); - ZetClose(); - } - - if (pBurnSoundOut) { - SN76496Update(0, pBurnSoundOut, nBurnSoundLen); - SN76496Update(1, pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029698; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - // SN76496Scan(nAction, pnMin); - } - - return 0; -} - - -// Ikki (Japan) - -static struct BurnRomInfo ikkiRomDesc[] = { - { "tvg17_1", 0x4000, 0xcb28167c, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "tvg17_2", 0x2000, 0x756c7450, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tvg17_3", 0x2000, 0x91f0a8b6, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tvg17_4", 0x2000, 0x696fcf7d, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "tvg17_5", 0x2000, 0x22bdb40e, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code - - { "tvg17_6", 0x4000, 0xdc8aa269, 3 | BRF_GRA }, // 5 Sprites - { "tvg17_7", 0x4000, 0x0e9efeba, 3 | BRF_GRA }, // 6 - { "tvg17_8", 0x4000, 0x45c9087a, 3 | BRF_GRA }, // 7 - - { "tvg17_9", 0x4000, 0xc594f3c5, 4 | BRF_GRA }, // 8 Background Tiles - { "tvg17_10", 0x4000, 0x2e510b4e, 4 | BRF_GRA }, // 9 - { "tvg17_11", 0x4000, 0x35012775, 4 | BRF_GRA }, // 10 - - { "prom17_3", 0x0100, 0xdbcd3bec, 5 | BRF_GRA }, // 11 Color Proms - { "prom17_4", 0x0100, 0x9eb7b6cf, 5 | BRF_GRA }, // 12 - { "prom17_5", 0x0100, 0x9b30a7f3, 5 | BRF_GRA }, // 13 - { "prom17_6", 0x0200, 0x962e619d, 5 | BRF_GRA }, // 14 - { "prom17_7", 0x0200, 0xb1f5148c, 5 | BRF_GRA }, // 15 - - { "prom17_1", 0x0100, 0xca0af30c, 6 | BRF_OPT }, // 16 Unused Proms - { "prom17_2", 0x0100, 0xf3c55174, 6 | BRF_OPT }, // 17 -}; - -STD_ROM_PICK(ikki) -STD_ROM_FN(ikki) - -struct BurnDriver BurnDrvIkki = { - "ikki", NULL, NULL, NULL, "1985", - "Ikki (Japan)\0", NULL, "Sun Electronics", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE | GBF_SCRFIGHT, 0, - NULL, ikkiRomInfo, ikkiRomName, NULL, NULL, IkkiInputInfo, IkkiDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 224, 4, 3 -}; - - -// Farmers Rebellion - -static struct BurnRomInfo farmerRomDesc[] = { - { "tvg-1.10", 0x4000, 0x2c0bd392, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "tvg-2.9", 0x2000, 0xb86efe02, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tvg-3.8", 0x2000, 0xfd686ff4, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tvg-4.7", 0x2000, 0x1415355d, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "tvg-5.30", 0x2000, 0x22bdb40e, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code - - { "tvg-6.104", 0x4000, 0xdc8aa269, 3 | BRF_GRA }, // 5 Sprites - { "tvg-7.103", 0x4000, 0x0e9efeba, 3 | BRF_GRA }, // 6 - { "tvg-8.102", 0x4000, 0x45c9087a, 3 | BRF_GRA }, // 7 - - { "tvg17_9", 0x4000, 0xc594f3c5, 4 | BRF_GRA }, // 8 Background Tiles - { "tvg17_10", 0x4000, 0x2e510b4e, 4 | BRF_GRA }, // 9 - { "tvg17_11", 0x4000, 0x35012775, 4 | BRF_GRA }, // 10 - - { "prom17_3", 0x0100, 0xdbcd3bec, 5 | BRF_GRA }, // 11 Color Proms - { "prom17_4", 0x0100, 0x9eb7b6cf, 5 | BRF_GRA }, // 12 - { "prom17_5", 0x0100, 0x9b30a7f3, 5 | BRF_GRA }, // 13 - { "prom17_6", 0x0200, 0x962e619d, 5 | BRF_GRA }, // 14 - { "prom17_7", 0x0200, 0xb1f5148c, 5 | BRF_GRA }, // 15 - - { "prom17_1", 0x0100, 0xca0af30c, 6 | BRF_OPT }, // 16 Unused Proms - { "prom17_2", 0x0100, 0xf3c55174, 6 | BRF_OPT }, // 17 -}; - -STD_ROM_PICK(farmer) -STD_ROM_FN(farmer) - -struct BurnDriver BurnDrvFarmer = { - "farmer", "ikki", NULL, NULL, "1985", - "Farmers Rebellion\0", NULL, "Sun Electronics", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE | GBF_SCRFIGHT, 0, - NULL, farmerRomInfo, farmerRomName, NULL, NULL, IkkiInputInfo, IkkiDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 224, 4, 3 -}; +// FB Alpha Ikki / Farmers Rebellion driver module +// Based on MAME driver by Uki + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "sn76496.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvColPROM; +static UINT8 *DrvVidAttr; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvShareRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvVidRAM; +static UINT32 *DrvPalette; +static UINT32 *Palette; +static UINT8 *DrvTransMask; +static UINT8 DrvRecalc; + +static UINT8 DrvReset; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[3]; + +static UINT8 *flipscreen; +static UINT8 *ikki_scroll; + +static INT32 vblank; + +static struct BurnInputInfo IkkiInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 7, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Ikki) + +static struct BurnDIPInfo IkkiDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x10, 0x01, 0x01, 0x00, "3" }, + {0x10, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2, "2 Player Game" }, + {0x10, 0x01, 0x02, 0x00, "2 Credits" }, + {0x10, 0x01, 0x02, 0x02, "1 Credit" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x10, 0x01, 0x04, 0x00, "Off" }, + {0x10, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 16, "Coin1 / Coin2" }, + {0x10, 0x01, 0xf0, 0x00, "1 Coin 1 Credit / 1 Coin 1 Credit " }, + {0x10, 0x01, 0xf0, 0x10, "2 Coins 1 Credit / 2 Coins 1 Credit " }, + {0x10, 0x01, 0xf0, 0x20, "2 Coins 1 Credit / 1 Coin 3 Credits" }, + {0x10, 0x01, 0xf0, 0x30, "1 Coin 1 Credit / 1 Coin 2 Credits" }, + {0x10, 0x01, 0xf0, 0x40, "1 Coin 1 Credit / 1 Coin 3 Credits" }, + {0x10, 0x01, 0xf0, 0x50, "1 Coin 1 Credit / 1 Coin 4 Credits" }, + {0x10, 0x01, 0xf0, 0x60, "1 Coin 1 Credit / 1 Coin 5 Credits" }, + {0x10, 0x01, 0xf0, 0x70, "1 Coin 1 Credit / 1 Coin 6 Credits" }, + {0x10, 0x01, 0xf0, 0x80, "1 Coin 2 Credits / 1 Coin 2 Credits" }, + {0x10, 0x01, 0xf0, 0x90, "1 Coin 2 Credits / 1 Coin 4 Credits" }, + {0x10, 0x01, 0xf0, 0xa0, "1 Coin 2 Credits / 1 Coin 5 Credits" }, + {0x10, 0x01, 0xf0, 0xb0, "1 Coin 2 Credits / 1 Coin 10 Credits" }, + {0x10, 0x01, 0xf0, 0xc0, "1 Coin 2 Credits / 1 Coin 11 Credits" }, + {0x10, 0x01, 0xf0, 0xd0, "1 Coin 2 Credits / 1 Coin 12 Credits" }, + {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits / 1 Coin 6 Credits" }, + {0x10, 0x01, 0xf0, 0xf0, "Free_Play" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x11, 0x01, 0x06, 0x00, "1 (Normal)" }, + {0x11, 0x01, 0x06, 0x02, "2" }, + {0x11, 0x01, 0x06, 0x04, "3" }, + {0x11, 0x01, 0x06, 0x06, "4 (Difficult)" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x11, 0x01, 0x80, 0x00, "Off" }, + {0x11, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Ikki) + +void __fastcall ikki_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe008: + *flipscreen = data & 4; + return; + + case 0xe00a: + case 0xe00b: + ikki_scroll[address & 1] = data; + return; + } +} + +UINT8 __fastcall ikki_main_read(UINT16 address) +{ + switch (address) + { + case 0xe000: + return (vblank ? 2 : 0); + + case 0xe001: + return DrvDips[0]; + + case 0xe002: + return DrvDips[1]; + + case 0xe003: + return DrvInputs[2]; + + case 0xe004: + return DrvInputs[0]; + + case 0xe005: + return DrvInputs[1]; + } + + return 0; +} + +void __fastcall ikki_sub_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xd801: + SN76496Write(0, data); + return; + + case 0xd802: + SN76496Write(1, data); + return; + } +} + +UINT8 __fastcall ikki_sub_read(UINT16 /*address*/) +{ + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + return 0; +} + +static void DrvPaletteInit() +{ + UINT32 *tmp = (UINT32*)BurnMalloc(0x100 * sizeof(UINT32)); + + for (INT32 i = 0; i < 0x100; i++) + { + UINT8 r, g, b; + + r = DrvColPROM[i + 0x000] & 0x0f; + g = DrvColPROM[i + 0x100] & 0x0f; + b = DrvColPROM[i + 0x200] & 0x0f; + + tmp[i] = (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b; + } + + DrvColPROM += 0x300; + + memset (DrvTransMask, 1, 0x200); + + for (INT32 i = 0; i < 0x200; i++) + { + UINT16 ctabentry = DrvColPROM[i] ^ 0xff; + + if ((i & 0x07) == 0x07 && ctabentry == 0) DrvTransMask[i] = 0; + if ((i & 0x07) == 0x00) DrvTransMask[i] = 0; // Seems to work... + + Palette[i] = tmp[ctabentry]; + } + + for (INT32 i = 0x200; i < 0x400; i++) { + Palette[i] = tmp[DrvColPROM[i]]; + } + + BurnFree(tmp); +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[3] = { 16384*8*2,16384*8,0 }; + INT32 XOffs[16] = { 7,6,5,4,3,2,1,0,8*16+7,8*16+6,8*16+5,8*16+4,8*16+3,8*16+2,8*16+1,8*16+0 }; + INT32 YOffs[32] = { 8*0, 8*1, 8*2, 8*3, 8*4, 8*5, 8*6, 8*7, 8*8,8*9,8*10,8*11,8*12,8*13,8*14,8*15, + 8*32,8*33,8*34,8*35,8*36,8*37,8*38,8*39, 8*40,8*41,8*42,8*43,8*44,8*45,8*46,8*47 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0xc000); + + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0xc000); + + GfxDecode(0x800, 3, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0xc000); + + GfxDecode(0x100, 3, 16, 32, Plane, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x010000; + DrvZ80ROM1 = Next; Next += 0x010000; + + DrvColPROM = Next; Next += 0x000800; + + DrvVidAttr = Next; Next += 0x000100; + + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + Palette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + DrvGfxROM0 = Next; Next += 0x020000; + DrvGfxROM1 = Next; Next += 0x020000; + + DrvTransMask = Next; Next += 0x000200; + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x000800; + DrvShareRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x000800; + DrvVidRAM = Next; Next += 0x000800; + + ikki_scroll = Next; Next += 0x000002; + flipscreen = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x0000, 0, 1)) return 1; + memcpy (DrvZ80ROM0 + 0x8000, DrvZ80ROM0 + 0x2000, 0x2000); + + if (BurnLoadRom(DrvZ80ROM0 + 0x2000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x4000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x6000, 3, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x0000, 4, 1)) return 1; + + for (INT32 i = 0; i < 3; i++) { + if (BurnLoadRom(DrvGfxROM1 + 0x4000 * i, 5 + i, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x4000 * i, 8 + i, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x0100 * i, 11 + i, 1)) return 1; + } + + if (BurnLoadRom(DrvColPROM + 0x0300, 14, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x0500, 15, 1)) return 1; + + if (BurnLoadRom(DrvVidAttr + 0x0000, 16, 1)) return 1; + + DrvGfxDecode(); + DrvPaletteInit(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x9fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x9fff, 2, DrvZ80ROM0); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM0); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM0); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM0); + ZetMapArea(0xc800, 0xcfff, 0, DrvShareRAM); + ZetMapArea(0xc800, 0xcfff, 1, DrvShareRAM); + ZetMapArea(0xc800, 0xcfff, 2, DrvShareRAM); + ZetMapArea(0xd000, 0xd7ff, 0, DrvVidRAM); + ZetMapArea(0xd000, 0xd7ff, 1, DrvVidRAM); + ZetMapArea(0xd000, 0xd7ff, 2, DrvVidRAM); + ZetSetWriteHandler(ikki_main_write); + ZetSetReadHandler(ikki_main_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x1fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x1fff, 2, DrvZ80ROM1); + ZetMapArea(0xc000, 0xc7ff, 0, DrvSprRAM); + ZetMapArea(0xc000, 0xc7ff, 1, DrvSprRAM); + ZetMapArea(0xc000, 0xc7ff, 2, DrvSprRAM); + ZetMapArea(0xc800, 0xcfff, 0, DrvShareRAM); + ZetMapArea(0xc800, 0xcfff, 1, DrvShareRAM); + ZetMapArea(0xc800, 0xcfff, 2, DrvShareRAM); + ZetSetWriteHandler(ikki_sub_write); + ZetSetReadHandler(ikki_sub_read); + ZetClose(); + + SN76496Init(0, 8000000/4, 0); + SN76496Init(1, 8000000/2, 1); + SN76496SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 0.75, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + SN76496Exit(); + ZetExit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_sprites() +{ + for (INT32 offs = 0; offs < 0x800; offs += 4) + { + INT32 code = (DrvSprRAM[offs + 2] & 0x80) | (DrvSprRAM[offs + 1] >> 1); + INT32 color = DrvSprRAM[offs + 2] & 0x3f; + + INT32 sx = DrvSprRAM[offs + 3]; + INT32 sy = DrvSprRAM[offs + 0]; + + if (*flipscreen) + sx = 240 - sx; + else + sy = 224 - sy; + + sx &= 0xff; + sy &= 0xff; + if (sx > 248) sx -= 256; + if (sy > 240) sy -= 256; + + sy -= 16; + sx -= 8; + + { + UINT8 *src = DrvGfxROM1 + (code << 9); + color <<= 3; + + if (*flipscreen) { + for (INT32 y = 31; y >= 0; y--) + { + INT32 yy = sy + y; + + for (INT32 x = 15; x >= 0; x--) + { + INT32 xx = sx + x; + INT32 pxl = src[15-x] | color; + + if (xx < 0 || yy < 0 || xx >= nScreenWidth || yy >= nScreenHeight) continue; + + if (DrvTransMask[pxl]) + pTransDraw[(yy * nScreenWidth) + xx] = pxl; + } + + src += 16; + } + } else { + for (INT32 y = 0; y < 32; y++) + { + INT32 yy = sy + y; + + for (INT32 x = 0; x < 16; x++) + { + INT32 xx = sx + x; + INT32 pxl = src[x] | color; + + if (xx < 0 || yy < 0 || xx >= nScreenWidth || yy >= nScreenHeight) continue; + + if (DrvTransMask[pxl]) + pTransDraw[(yy * nScreenWidth) + xx] = pxl; + } + + src += 16; + } + } + } + } +} + +static void draw_bg_layer(INT32 prio) +{ + for (INT32 offs = 0; offs < 0x800 / 2; offs++) + { + INT32 x = (offs >> 5) << 3; + INT32 y = (offs & 0x1f) << 3; + INT32 d = DrvVidAttr[x >> 3]; + + if (d != 0 && d != 0x0d) { + if (prio) continue; + } + + INT32 color = DrvVidRAM[offs << 1]; + INT32 code = DrvVidRAM[(offs << 1) | 1] + ((color & 0xe0) << 3); + color = (color & 0x1f) | ((color & 0x80) >> 2); + + if (d == 0x02 && prio == 0) { + x -= ikki_scroll[1]; + if (x < 0) x += 176; + + y = (y + ~ikki_scroll[0]) & 0xff; + } + + if (*flipscreen) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, (248-x)-8, (248-y)-16, color, 3, 0x200, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, x-8, y-16, color, 3, 0x200, DrvGfxROM0); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + draw_bg_layer(0); + draw_sprites(); + draw_bg_layer(1); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0x00, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + // clear opposites + if (DrvJoy1[2] && DrvJoy1[3]) DrvInputs[0] &= ~0x0c; + if (DrvJoy1[1] && DrvJoy1[0]) DrvInputs[0] &= ~0x03; + if (DrvJoy2[3] && DrvJoy2[2]) DrvInputs[1] &= ~0x0c; + if (DrvJoy2[1] && DrvJoy2[0]) DrvInputs[1] &= ~0x03; + } + + INT32 nCycleSegment; + INT32 nInterleave = 256; + INT32 nCyclesTotal[2] = { 4000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + vblank = 1; + + for (INT32 i = 0; i < nInterleave; i++) + { + nCycleSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); + + ZetOpen(0); + nCyclesDone[0] += ZetRun(nCycleSegment); + if (i == 15) { + vblank = 0; + ZetRaiseIrq(0); + } + if (i == 239) { + ZetRaiseIrq(0); + vblank = 1; + } + ZetClose(); + + nCycleSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i); + + ZetOpen(1); + nCyclesDone[1] += ZetRun(nCycleSegment); + if (i == 15) ZetRaiseIrq(0); + if (i == 239)ZetRaiseIrq(0); + ZetClose(); + } + + if (pBurnSoundOut) { + SN76496Update(0, pBurnSoundOut, nBurnSoundLen); + SN76496Update(1, pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029698; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + // SN76496Scan(nAction, pnMin); + } + + return 0; +} + + +// Ikki (Japan) + +static struct BurnRomInfo ikkiRomDesc[] = { + { "tvg17_1", 0x4000, 0xcb28167c, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "tvg17_2", 0x2000, 0x756c7450, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tvg17_3", 0x2000, 0x91f0a8b6, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tvg17_4", 0x2000, 0x696fcf7d, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "tvg17_5", 0x2000, 0x22bdb40e, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code + + { "tvg17_6", 0x4000, 0xdc8aa269, 3 | BRF_GRA }, // 5 Sprites + { "tvg17_7", 0x4000, 0x0e9efeba, 3 | BRF_GRA }, // 6 + { "tvg17_8", 0x4000, 0x45c9087a, 3 | BRF_GRA }, // 7 + + { "tvg17_9", 0x4000, 0xc594f3c5, 4 | BRF_GRA }, // 8 Background Tiles + { "tvg17_10", 0x4000, 0x2e510b4e, 4 | BRF_GRA }, // 9 + { "tvg17_11", 0x4000, 0x35012775, 4 | BRF_GRA }, // 10 + + { "prom17_3", 0x0100, 0xdbcd3bec, 5 | BRF_GRA }, // 11 Color Proms + { "prom17_4", 0x0100, 0x9eb7b6cf, 5 | BRF_GRA }, // 12 + { "prom17_5", 0x0100, 0x9b30a7f3, 5 | BRF_GRA }, // 13 + { "prom17_6", 0x0200, 0x962e619d, 5 | BRF_GRA }, // 14 + { "prom17_7", 0x0200, 0xb1f5148c, 5 | BRF_GRA }, // 15 + + { "prom17_1", 0x0100, 0xca0af30c, 6 | BRF_OPT }, // 16 Unused Proms + { "prom17_2", 0x0100, 0xf3c55174, 6 | BRF_OPT }, // 17 +}; + +STD_ROM_PICK(ikki) +STD_ROM_FN(ikki) + +struct BurnDriver BurnDrvIkki = { + "ikki", NULL, NULL, NULL, "1985", + "Ikki (Japan)\0", NULL, "Sun Electronics", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE | GBF_SCRFIGHT, 0, + NULL, ikkiRomInfo, ikkiRomName, NULL, NULL, IkkiInputInfo, IkkiDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 224, 4, 3 +}; + + +// Farmers Rebellion + +static struct BurnRomInfo farmerRomDesc[] = { + { "tvg-1.10", 0x4000, 0x2c0bd392, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "tvg-2.9", 0x2000, 0xb86efe02, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tvg-3.8", 0x2000, 0xfd686ff4, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tvg-4.7", 0x2000, 0x1415355d, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "tvg-5.30", 0x2000, 0x22bdb40e, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code + + { "tvg-6.104", 0x4000, 0xdc8aa269, 3 | BRF_GRA }, // 5 Sprites + { "tvg-7.103", 0x4000, 0x0e9efeba, 3 | BRF_GRA }, // 6 + { "tvg-8.102", 0x4000, 0x45c9087a, 3 | BRF_GRA }, // 7 + + { "tvg17_9", 0x4000, 0xc594f3c5, 4 | BRF_GRA }, // 8 Background Tiles + { "tvg17_10", 0x4000, 0x2e510b4e, 4 | BRF_GRA }, // 9 + { "tvg17_11", 0x4000, 0x35012775, 4 | BRF_GRA }, // 10 + + { "prom17_3", 0x0100, 0xdbcd3bec, 5 | BRF_GRA }, // 11 Color Proms + { "prom17_4", 0x0100, 0x9eb7b6cf, 5 | BRF_GRA }, // 12 + { "prom17_5", 0x0100, 0x9b30a7f3, 5 | BRF_GRA }, // 13 + { "prom17_6", 0x0200, 0x962e619d, 5 | BRF_GRA }, // 14 + { "prom17_7", 0x0200, 0xb1f5148c, 5 | BRF_GRA }, // 15 + + { "prom17_1", 0x0100, 0xca0af30c, 6 | BRF_OPT }, // 16 Unused Proms + { "prom17_2", 0x0100, 0xf3c55174, 6 | BRF_OPT }, // 17 +}; + +STD_ROM_PICK(farmer) +STD_ROM_FN(farmer) + +struct BurnDriver BurnDrvFarmer = { + "farmer", "ikki", NULL, NULL, "1985", + "Farmers Rebellion\0", NULL, "Sun Electronics", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE | GBF_SCRFIGHT, 0, + NULL, farmerRomInfo, farmerRomName, NULL, NULL, IkkiInputInfo, IkkiDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_jack.cpp b/src/burn/drv/pre90s/d_jack.cpp index 731287a95..c04f37b95 100644 --- a/src/burn/drv/pre90s/d_jack.cpp +++ b/src/burn/drv/pre90s/d_jack.cpp @@ -1,1942 +1,1940 @@ -// FB Alpha Jack the Giantkiller driver module -// Based on MAME driver by Brad Oliver - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "bitswap.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - - -static UINT8 *Mem, *Rom0, *Rom1, *Gfx, *Prom, *User; -static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvJoy4[8], DrvReset, DrvDips[2]; -static INT16 *pAY8910Buffer[3], *pFMBuffer = NULL; -static INT32 tri_fix, joinem, loverb, suprtriv; -static INT32 timer_rate, flip_screen; -static UINT32 *Palette, *DrvPal; -static UINT8 DrvCalcPal; - -static UINT8 soundlatch; -static INT32 question_address, question_rom, remap_address[16]; -static INT32 joinem_snd_bit; - -static INT32 nCyclesSegment; -static INT32 nCyclesDone[2], nCyclesTotal[2]; - -static struct BurnInputInfo JackInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, - {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"p1 Up" , BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down", }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p1 left" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 1, "p1 fire 2"}, - - {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 5, "p2 coin" }, - {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"p2 Up" , BIT_DIGITAL, DrvJoy2 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down", }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 6, "p2 right" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 7, "p2 left" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Jack) - -static struct BurnInputInfo ZzyzzyxxInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 5, "p1 coin" }, - {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down", }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 1"}, - - {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 4, "p2 Up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down", }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Zzyzzyxx) - -static struct BurnInputInfo FreezeInputList[] = { - {"Coin" , BIT_DIGITAL , DrvJoy1 + 5, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 1, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 2"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Freeze) - -static struct BurnInputInfo SucasinoInputList[] = { - {"Coin" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, - - {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p1 left" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 1"}, - - {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 6, "p2 right" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 7, "p2 left" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Sucasino) - -static struct BurnInputInfo TripoolInputList[] = { - {"Select Game 1", BIT_DIGITAL , DrvJoy1 + 2, "Select Game 1"}, - {"Select Game 2", BIT_DIGITAL, DrvJoy1 + 3, "Select Game 2"}, - {"Select Game 3", BIT_DIGITAL, DrvJoy1 + 4, "Select Game 3"}, - - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, - {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down", }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p1 left" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 1, "p1 fire 2"}, - - {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 5, "p2 coin" }, - {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 4, "p1 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down", }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 6, "p2 right" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 7, "p2 left" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, -}; - -STDINPUTINFO(Tripool) - -static struct BurnInputInfo JoinemInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy3 + 0, "p1 coin" }, - {"P1 start" , BIT_DIGITAL , DrvJoy3 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up", }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down", }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 2, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" }, - - {"P2 Coin" , BIT_DIGITAL , DrvJoy3 + 1, "p2 coin" }, - {"P2 start" , BIT_DIGITAL , DrvJoy3 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up", }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down", }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p2 right" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p2 left" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Joinem) - -static struct BurnInputInfo LoverboyInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy3 + 0, "p1 coin" }, - {"P1 start" , BIT_DIGITAL , DrvJoy3 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up", }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down", }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 2, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, - - {"P2 Coin" , BIT_DIGITAL , DrvJoy3 + 1, "p2 coin" }, - {"P2 start" , BIT_DIGITAL , DrvJoy3 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up", }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down", }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p2 right" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p2 left" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Loverboy) - -static struct BurnInputInfo StrivInputList[] = { - {"Coin" , BIT_DIGITAL , DrvJoy3 + 1, "p1 coin" }, - - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 1, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 2, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 3, "p1 fire 3"}, - {"P1 Button 4" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 4"}, - - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 1, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 2, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 3, "p2 fire 3"}, - {"P2 Button 4" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 4"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Striv) - -static struct BurnDIPInfo JackDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL}, - {0x12, 0xff, 0xff, 0x00, NULL}, - - // DSW1 - {0 , 0xfe, 0 , 4 , "Coin B"}, - {0x11, 0x01, 0x03, 0x01, "2 coins 1 credit"}, - {0x11, 0x01, 0x03, 0x03, "4 coins 3 credits"}, - {0x11, 0x01, 0x03, 0x00, "1 coin 1 credit"}, - {0x11, 0x01, 0x03, 0x02, "1 coin 3 credits"}, - - {0 , 0xfe, 0 , 4 , "Coin A"}, - {0x11, 0x01, 0x0c, 0x00, "3 coins 1 credit"}, - {0x11, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, - {0x11, 0x01, 0x0c, 0x08, "4 coins 3 credits"}, - {0x11, 0x01, 0x0c, 0x0c, "1 coin 1 credits"}, - - {0 , 0xfe, 0 , 2 , "Lives"}, - {0x11, 0x01, 0x10, 0x00, "3"}, - {0x11, 0x01, 0x10, 0x10, "5"}, - - {0 , 0xfe, 0 , 2 , "Bonus Life"}, - {0x11, 0x01, 0x20, 0x00, "Every 10000"}, - {0x11, 0x01, 0x20, 0x20, "10000 ONly"}, - - {0 , 0xfe, 0 , 2 , "Difficulty"}, - {0x11, 0x01, 0x40, 0x00, "Start on Level 1"}, - {0x11, 0x01, 0x40, 0x40, "Start on Level 13"}, - - {0 , 0xfe, 0 , 2 , "Bullets per Bean Collected"}, - {0x11, 0x01, 0x80, 0x00, "1"}, - {0x11, 0x01, 0x80, 0x80, "2"}, - - // DSW2 - {0 , 0xfe, 0 , 2 , "Cabinet"}, - {0x12, 0x01, 0x01, 0x01, "Upright"}, - {0x12, 0x01, 0x01, 0x00, "Cocktail"}, - - {0 , 0xfe, 0 , 2 , "Invulnerability (Cheat)"}, - {0x12, 0x01, 0x40, 0x00, "Off"}, - {0x12, 0x01, 0x40, 0x40, "On"}, - - {0 , 0xfe, 0 , 4 , "255 Lives (Cheat)"}, - {0x12, 0x01, 0x80, 0x00, "Off"}, - {0x12, 0x01, 0x80, 0x80, "On"}, -}; - -STDDIPINFO(Jack) - - -static struct BurnDIPInfo Jack2DIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL}, - {0x12, 0xff, 0xff, 0x00, NULL}, - - // DSW1 - {0 , 0xfe, 0 , 4 , "Coin B"}, - {0x11, 0x01, 0x03, 0x03, "4 coins 3 credits"}, - {0x11, 0x01, 0x03, 0x00, "1 coin 1 credit"}, - {0x11, 0x01, 0x03, 0x01, "1 coin 2 credits"}, - {0x11, 0x01, 0x03, 0x02, "1 coin 3 credits"}, - - {0 , 0xfe, 0 , 4 , "Coin A"}, - {0x11, 0x01, 0x0c, 0x08, "3 coins 1 credit"}, - {0x11, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, - {0x11, 0x01, 0x0c, 0x0c, "4 coins 3 credits"}, - {0x11, 0x01, 0x0c, 0x00, "1 coin 1 credits"}, - - {0 , 0xfe, 0 , 2 , "Lives"}, - {0x11, 0x01, 0x10, 0x00, "3"}, - {0x11, 0x01, 0x10, 0x10, "5"}, - - {0 , 0xfe, 0 , 2 , "Bonus Life"}, - {0x11, 0x01, 0x20, 0x00, "Every 10000"}, - {0x11, 0x01, 0x20, 0x20, "10000 ONly"}, - - {0 , 0xfe, 0 , 2 , "Difficulty"}, - {0x11, 0x01, 0x40, 0x00, "Start on Level 1"}, - {0x11, 0x01, 0x40, 0x40, "Start on Level 13"}, - - {0 , 0xfe, 0 , 2 , "Bullets per Bean Collected"}, - {0x11, 0x01, 0x80, 0x00, "1"}, - {0x11, 0x01, 0x80, 0x80, "2"}, - - // DSW2 - {0 , 0xfe, 0 , 2 , "Cabinet"}, - {0x12, 0x01, 0x01, 0x01, "Upright"}, - {0x12, 0x01, 0x01, 0x00, "Cocktail"}, - - {0 , 0xfe, 0 , 2 , "Invulnerability (Cheat)"}, - {0x12, 0x01, 0x40, 0x00, "Off"}, - {0x12, 0x01, 0x40, 0x40, "On"}, - - {0 , 0xfe, 0 , 4 , "255 Lives (Cheat)"}, - {0x12, 0x01, 0x80, 0x00, "Off"}, - {0x12, 0x01, 0x80, 0x80, "On"}, -}; - -STDDIPINFO(Jack2) - -static struct BurnDIPInfo Jack3DIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL}, - {0x12, 0xff, 0xff, 0x00, NULL}, - - // DSW1 - {0 , 0xfe, 0 , 4 , "Coin B"}, - {0x11, 0x01, 0x03, 0x00, "1 coin 1 credit"}, - {0x11, 0x01, 0x03, 0x01, "1 coin 2 credits"}, - {0x11, 0x01, 0x03, 0x02, "1 coin 3 credits"}, - {0x11, 0x01, 0x03, 0x03, "1 coin 5 credits"}, - - {0 , 0xfe, 0 , 4 , "Coin A"}, - {0x11, 0x01, 0x0c, 0x0c, "4 coins 1 credit"}, - {0x11, 0x01, 0x0c, 0x08, "3 coins 1 credit"}, - {0x11, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, - {0x11, 0x01, 0x0c, 0x00, "1 coin 1 credit"}, - - {0 , 0xfe, 0 , 2 , "Lives"}, - {0x11, 0x01, 0x10, 0x00, "3"}, - {0x11, 0x01, 0x10, 0x10, "5"}, - - {0 , 0xfe, 0 , 2 , "Bonus Life"}, - {0x11, 0x01, 0x20, 0x00, "Every 10000"}, - {0x11, 0x01, 0x20, 0x20, "10000 ONly"}, - - {0 , 0xfe, 0 , 2 , "Difficulty"}, - {0x11, 0x01, 0x40, 0x00, "Start on Level 1"}, - {0x11, 0x01, 0x40, 0x40, "Start on Level 13"}, - - {0 , 0xfe, 0 , 2 , "Bullets per Bean Collected"}, - {0x11, 0x01, 0x80, 0x00, "1"}, - {0x11, 0x01, 0x80, 0x80, "2"}, - - // DSW2 - {0 , 0xfe, 0 , 2 , "Cabinet"}, - {0x12, 0x01, 0x01, 0x01, "Upright"}, - {0x12, 0x01, 0x01, 0x00, "Cocktail"}, - - {0 , 0xfe, 0 , 2 , "Invulnerability (Cheat)"}, - {0x12, 0x01, 0x40, 0x00, "Off"}, - {0x12, 0x01, 0x40, 0x40, "On"}, - - {0 , 0xfe, 0 , 4 , "255 Lives (Cheat)"}, - {0x12, 0x01, 0x80, 0x00, "Off"}, - {0x12, 0x01, 0x80, 0x80, "On"}, -}; - -STDDIPINFO(Jack3) - -static struct BurnDIPInfo TreahuntDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL}, - {0x12, 0xff, 0xff, 0x00, NULL}, - - // DSW1 - {0 , 0xfe, 0 , 4 , "Coin B"}, - {0x11, 0x01, 0x03, 0x01, "2 coins 1 credit"}, - {0x11, 0x01, 0x03, 0x03, "4 coins 3 credits"}, - {0x11, 0x01, 0x03, 0x00, "1 coin 1 credit"}, - {0x11, 0x01, 0x03, 0x02, "1 coin 3 credits"}, - - {0 , 0xfe, 0 , 4 , "Coin A"}, - {0x11, 0x01, 0x0c, 0x08, "3 coins 1 credit"}, - {0x11, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, - {0x11, 0x01, 0x0c, 0x0c, "4 coins 3 credits"}, - {0x11, 0x01, 0x0c, 0x00, "1 coin 1 credit"}, - - {0 , 0xfe, 0 , 2 , "Lives"}, - {0x11, 0x01, 0x10, 0x00, "3"}, - {0x11, 0x01, 0x10, 0x10, "5"}, - - {0 , 0xfe, 0 , 2 , "Bonus Life"}, - {0x11, 0x01, 0x20, 0x00, "Every 10000"}, - {0x11, 0x01, 0x20, 0x20, "10000 ONly"}, - - {0 , 0xfe, 0 , 2 , "Difficulty"}, - {0x11, 0x01, 0x40, 0x00, "Start on Level 1"}, - {0x11, 0x01, 0x40, 0x40, "Start on Level 6"}, - - {0 , 0xfe, 0 , 2 , "Bullets per Bean Collected"}, - {0x11, 0x01, 0x80, 0x00, "5"}, - {0x11, 0x01, 0x80, 0x80, "20"}, - - // DSW2 - {0 , 0xfe, 0 , 2 , "Cabinet"}, - {0x12, 0x01, 0x01, 0x01, "Upright"}, - {0x12, 0x01, 0x01, 0x00, "Cocktail"}, - - {0 , 0xfe, 0 , 2 , "Invulnerability (Cheat)"}, - {0x12, 0x01, 0x40, 0x00, "Off"}, - {0x12, 0x01, 0x40, 0x40, "On"}, - - {0 , 0xfe, 0 , 4 , "255 Lives (Cheat)"}, - {0x12, 0x01, 0x80, 0x00, "Off"}, - {0x12, 0x01, 0x80, 0x80, "On"}, -}; - -STDDIPINFO(Treahunt) - - -static struct BurnDIPInfo ZzyzzyxxDIPList[]= -{ - // Default Values - {0x0A, 0xff, 0xff, 0x00, NULL}, - {0x0B, 0xff, 0xff, 0x00, NULL}, - - // DSW1 - {0 , 0xfe, 0 , 4 , "Coinage"}, - {0x0A, 0x01, 0x03, 0x01, "2 coins 1 credit"}, - {0x0A, 0x01, 0x03, 0x03, "4 coins 3 credits"}, - {0x0A, 0x01, 0x03, 0x00, "1 coin 1 credit"}, - {0x0A, 0x01, 0x03, 0x02, "1 coin 3 credits"}, - - {0 , 0xfe, 0 , 2 , "Lives"}, - {0x0A, 0x01, 0x04, 0x00, "3"}, - {0x0A, 0x01, 0x04, 0x04, "2"}, - - {0 , 0xfe, 0 , 2 , "Credits on Reset"}, - {0x0A, 0x01, 0x08, 0x00, "Off"}, - {0x0A, 0x01, 0x08, 0x08, "On"}, - - {0 , 0xfe, 0 , 2 , "Demo Sounds"}, - {0x0A, 0x01, 0x10, 0x10, "Off"}, - {0x0A, 0x01, 0x10, 0x00, "On"}, - - {0 , 0xfe, 0 , 2 , "Cabinet"}, - {0x0A, 0x01, 0x20, 0x20, "Upright"}, - {0x0A, 0x01, 0x20, 0x00, "Cocktail"}, - - {0 , 0xfe, 0 , 2 , "Free Play"}, - {0x0A, 0x01, 0x80, 0x00, "Off"}, - {0x0A, 0x01, 0x80, 0x80, "On"}, - - // DSW2 - {0 , 0xfe, 0 , 2 , "Bonus Life"}, - {0x0B, 0x01, 0x03, 0x02, "None"}, - {0x0B, 0x01, 0x03, 0x00, "10000 50000"}, - {0x0B, 0x01, 0x03, 0x01, "25000 100000"}, - {0x0B, 0x01, 0x03, 0x03, "100000 300000"}, - - {0 , 0xfe, 0 , 2 , "2nd Bonus Given"}, - {0x0B, 0x01, 0x04, 0x00, "No"}, - {0x0B, 0x01, 0x04, 0x04, "Yes"}, - - {0 , 0xfe, 0 , 2 , "Starting Laps"}, - {0x0B, 0x01, 0x08, 0x00, "2"}, - {0x0B, 0x01, 0x08, 0x08, "3"}, - - {0 , 0xfe, 0 , 2 , "Difficulty of Pleasing Lola"}, - {0x0B, 0x01, 0x10, 0x00, "Easy"}, - {0x0B, 0x01, 0x10, 0x10, "Hard"}, - - {0 , 0xfe, 0 , 2 , "Show Intermissions"}, - {0x0B, 0x01, 0x20, 0x00, "No"}, - {0x0B, 0x01, 0x20, 0x20, "Yes"}, - - {0 , 0xfe, 0 , 3 , "Show Intermissions"}, - {0x0B, 0x01, 0xc0, 0x00, "3 under 4000 pts"}, - {0x0B, 0x01, 0xc0, 0x80, "5 under 4000 pts"}, - {0x0B, 0x01, 0xc0, 0x40, "None"}, -}; - -STDDIPINFO(Zzyzzyxx) - -static struct BurnDIPInfo FreezeDIPList[]= -{ - // Default Values - {0x08, 0xff, 0xff, 0x00, NULL}, - - // DSW1 - {0 , 0xfe, 0 , 2 , "Flip Screen"}, - {0x08, 0x01, 0x01, 0x00, "Off"}, - {0x08, 0x01, 0x01, 0x01, "On"}, - - {0 , 0xfe, 0 , 2 , "Difficulty"}, - {0x08, 0x01, 0x04, 0x00, "Easy"}, - {0x08, 0x01, 0x04, 0x04, "Hard"}, - - {0 , 0xfe, 0 , 2 , "Lives"}, - {0x08, 0x01, 0x08, 0x00, "3"}, - {0x08, 0x01, 0x08, 0x08, "5"}, - - {0 , 0xfe, 0 , 4 , "Bonus Life"}, - {0x08, 0x01, 0x30, 0x00, "10000"}, - {0x08, 0x01, 0x30, 0x10, "10000 40000"}, - {0x08, 0x01, 0x30, 0x20, "10000 60000"}, - {0x08, 0x01, 0x30, 0x30, "20000 100000"}, - - {0 , 0xfe, 0 , 4 , "Coinage"}, - {0x08, 0x01, 0xc0, 0x80, "2 Coins 1 Credit"}, - {0x08, 0x01, 0xc0, 0x00, "1 Coin 1 Credit"}, - {0x08, 0x01, 0xc0, 0x40, "1 Coin 2 Credits"}, - {0x08, 0x01, 0xc0, 0xc0, "Free Play"}, -}; - -STDDIPINFO(Freeze) - -static struct BurnDIPInfo SucasinoDIPList[]= -{ - // Default Values - {0x0A, 0xff, 0xff, 0x00, NULL}, - - // DSW1 - {0 , 0xfe, 0 , 4 , "Coinage"}, - {0x0A, 0x01, 0x03, 0x00, "1 Coin 1 Credit"}, - {0x0A, 0x01, 0x03, 0x01, "1 Coin 2 Credits"}, - {0x0A, 0x01, 0x03, 0x02, "1 Coin 3 Credits"}, - {0x0A, 0x01, 0x03, 0x03, "1 Coin 4 Credits"}, - - {0 , 0xfe, 0 , 2 , "Cabinet"}, - {0x0A, 0x01, 0x04, 0x00, "Upright"}, - {0x0A, 0x01, 0x04, 0x04, "Cocktail"}, - - {0 , 0xfe, 0 , 2 , "Flip Screen"}, - {0x0A, 0x01, 0x08, 0x00, "Off"}, - {0x0A, 0x01, 0x08, 0x08, "On"}, -}; - -STDDIPINFO(Sucasino) - -static struct BurnDIPInfo JoinemDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0x00, NULL}, - {0x0e, 0xff, 0xff, 0x00, NULL}, - - // DSW1 - {0 , 0xfe, 0 , 4 , "Coin A"}, - {0x0d, 0x01, 0x03, 0x01, "2 coins 1 credit"}, - {0x0d, 0x01, 0x03, 0x03, "4 coins 3 credits"}, - {0x0d, 0x01, 0x03, 0x00, "1 coin 1 credit"}, - {0x0d, 0x01, 0x03, 0x02, "1 coin 3 credits"}, - - {0 , 0xfe, 0 , 4 , "Coin B"}, - {0x0d, 0x01, 0x0c, 0x08, "3 coins 1 credit"}, - {0x0d, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, - {0x0d, 0x01, 0x0c, 0x0c, "4 coins 3 credits"}, - {0x0d, 0x01, 0x0c, 0x00, "1 coin 1 credit"}, - - {0 , 0xfe, 0 , 2 , "Lives"}, - {0x0d, 0x01, 0x10, 0x00, "2"}, - {0x0d, 0x01, 0x10, 0x10, "5"}, - - // DSW2 - {0 , 0xfe, 0 , 2 , "Cabinet"}, - {0x0e, 0x01, 0x01, 0x01, "Upright"}, - {0x0e, 0x01, 0x01, 0x00, "Cocktail"}, - - {0 , 0xfe, 0 , 2 , "Sound Check"}, - {0x0e, 0x01, 0x20, 0x00, "Off"}, - {0x0e, 0x01, 0x20, 0x20, "On"}, - - {0 , 0xfe, 0 , 2 , "Infinite Lives"}, - {0x0e, 0x01, 0x80, 0x00, "2"}, - {0x0e, 0x01, 0x80, 0x80, "3"}, -}; - -STDDIPINFO(Joinem) - -static struct BurnDIPInfo LoverboyDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x00, NULL}, - - // DSW1 - {0 , 0xfe, 0 , 15 , "Coin A"}, - {0x0f, 0x01, 0x0f, 0x0c, "4 Coins 1 Credit"}, - {0x0f, 0x01, 0x0f, 0x08, "3 Coins 1 Credit"}, - {0x0f, 0x01, 0x0f, 0x0d, "4 Coins 2 Credit"}, - {0x0f, 0x01, 0x0f, 0x04, "2 Coins 1 Credit"}, - {0x0f, 0x01, 0x0f, 0x09, "3 Coins 2 Credit"}, - {0x0f, 0x01, 0x0f, 0x0e, "4 Coins 3 Credit"}, - {0x0f, 0x01, 0x0f, 0x0f, "4 Coins 4 Credit"}, - {0x0f, 0x01, 0x0f, 0x0a, "3 Coins 3 Credit"}, - {0x0f, 0x01, 0x0f, 0x05, "2 Coins 2 Credit"}, - {0x0f, 0x01, 0x0f, 0x00, "1 Coins 1 Credit"}, - {0x0f, 0x01, 0x0f, 0x0b, "3 Coins 4 Credit"}, - {0x0f, 0x01, 0x0f, 0x06, "2 Coins 3 Credit"}, - {0x0f, 0x01, 0x0f, 0x07, "2 Coins 4 Credit"}, - {0x0f, 0x01, 0x0f, 0x01, "1 Coins 2 Credit"}, - {0x0f, 0x01, 0x0f, 0x02, "1 Coins 3 Credit"}, - {0x0f, 0x01, 0x0f, 0x03, "1 Coins 4 Credit"}, - - {0 , 0xfe, 0 , 2 , "Bonus"}, - {0x0f, 0x01, 0x20, 0x00, "20,000"}, - {0x0f, 0x01, 0x20, 0x20, "30,000"}, - - {0 , 0xfe, 0 , 2 , "Lives"}, - {0x0f, 0x01, 0x40, 0x00, "3"}, - {0x0f, 0x01, 0x40, 0x40, "5"}, - - {0 , 0xfe, 0 , 2 , "Cabinet"}, - {0x0f, 0x01, 0x80, 0x80, "Upright"}, - {0x0f, 0x01, 0x80, 0x00, "Cocktail"}, -}; - -STDDIPINFO(Loverboy) - -static struct BurnDIPInfo StrivDIPList[]= -{ - // Default Values - {0x0A, 0xff, 0xff, 0xfd, NULL}, - - // DSW1 - {0 , 0xfe, 0 , 2 , "Monitor"}, - {0x0A, 0x01, 0x02, 0x02, "Horizontal"}, - {0x0A, 0x01, 0x02, 0x00, "Vertical"}, - - {0 , 0xfe, 0 , 8 , "Gaming Option Number"}, - {0x0A, 0x01, 0x05, 0x01, "2"}, - {0x0A, 0x01, 0x05, 0x05, "3"}, - {0x0A, 0x01, 0x05, 0x00, "4"}, - {0x0A, 0x01, 0x05, 0x04, "5"}, - {0x0A, 0x01, 0x05, 0x01, "4"}, - {0x0A, 0x01, 0x05, 0x05, "5"}, - {0x0A, 0x01, 0x05, 0x00, "6"}, - {0x0A, 0x01, 0x05, 0x04, "7"}, - - {0 , 0xfe, 0 , 2 , "Cabinet"}, - {0x0A, 0x01, 0x08, 0x08, "Upright"}, - {0x0A, 0x01, 0x08, 0x00, "Cocktail"}, - - {0 , 0xfe, 0 , 2 , "Coinage"}, - {0x0A, 0x01, 0x10, 0x00, "2 Coins 1 Credit"}, - {0x0A, 0x01, 0x10, 0x10, "1 Coin 1 Credit"}, - - {0 , 0xfe, 0 , 2 , "Gaming Options"}, - {0x0A, 0x01, 0x20, 0x20, "Number of Wrong Answer"}, - {0x0A, 0x01, 0x20, 0x00, "Number of Questions"}, - - {0 , 0xfe, 0 , 2 , "Show Correct Answer"}, - {0x0A, 0x01, 0x40, 0x00, "No"}, - {0x0A, 0x01, 0x40, 0x40, "Yes"}, -}; - -STDDIPINFO(Striv) - -static UINT8 timer_r(UINT32) -{ - return ZetTotalCycles() / timer_rate; -} - -static UINT8 soundlatch_r(UINT32) -{ - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return soundlatch; -} - -static UINT8 __fastcall striv_question_r(UINT16 offset) -{ - if((offset & 0xc00) == 0x800) - { - remap_address[offset & 0x0f] = (offset & 0xf0) >> 4; - } - else if((offset & 0xc00) == 0xc00) - { - question_rom = offset & 7; - question_address = (offset & 0xf8) << 7; - } - else - { - UINT8 *ROM = User; - INT32 real_address; - - real_address = question_address | (offset & 0x3f0) | remap_address[offset & 0x0f]; - - if(offset & 0x400) - real_address |= 0x8000 * (question_rom + 8); - else - real_address |= 0x8000 * question_rom; - - return ROM[real_address]; - } - - return 0; -} - -void jack_paletteram_w(UINT16 offset, UINT8 data) -{ - UINT32 *pl = Palette + (offset & 0x1f); - - Rom0[offset] = data; - - DrvCalcPal = 1; - - data ^= 0xff; - - *pl = ((data & 7) << 21) | ((data & 7) << 18) | ((data & 6) << 15); - - data >>= 3; - - *pl |= ((data & 7) << 13) | ((data & 7) << 10) | ((data & 6) << 7); - - data >>= 3; - - *pl |= ((data & 3) << 6) | ((data & 3) << 4) | ((data & 3) << 2) | (data & 3); -} - -UINT8 __fastcall jack_cpu0_read(UINT16 address) -{ - UINT8 ret = 0; - - switch (address) - { - case 0xb500: - return DrvDips[0]; - - case 0xb501: - { - ret = DrvDips[1]; - if (joinem && DrvJoy2[7] && !joinem_snd_bit) ret |= 0x20; - - return ret; - } - - case 0xb502: - { - for (INT32 i = 0; i < 8; i++) ret |= DrvJoy1[i] << i; - - return ret; - } - - case 0xb503: - { - for (INT32 i = 0; i < 8; i++) ret |= DrvJoy2[i] << i; - - return ret; - } - - case 0xb504: - { - for (INT32 i = 0; i < 8; i++) ret |= DrvJoy3[i] << i; - if (joinem || loverb) ret |= 0x40; - - return ret; - } - - case 0xb505: - { - for (INT32 i = 0; i < 8; i++) ret |= DrvJoy4[i] << i; - - return ret; - } - - case 0xb506: - case 0xb507: - flip_screen = (address & 1) ^ suprtriv; - return 0; - } - - if (suprtriv && address >= 0xc000 && address <= 0xcfff) { - return striv_question_r(address & 0x0fff); - } - - return 0; -} - -void __fastcall jack_cpu0_write(UINT16 address, UINT8 data) -{ - if (address >= 0xb600 && address <= 0xb61f) - { - jack_paletteram_w(address, data); - return; - } - - switch (address) - { - case 0xb400: - soundlatch = data; - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(0); - break; - - case 0xb506: - flip_screen = 1; - break; - - case 0xb700: - flip_screen = data >> 7; - joinem_snd_bit = data & 1; - break; - } -} - -UINT8 __fastcall jack_in_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x40: - return AY8910Read(0); - } - - return 0; -} - -void __fastcall jack_out_port(UINT16 address, UINT8 data) -{ - switch (address & 0xff) - { - case 0x40: - AY8910Write(0, 1, data); - return; - - case 0x80: - AY8910Write(0, 0, data); - return; - } -} - -void __fastcall jack_cpu1_write() -{ -} - - -static INT32 DrvDoReset() -{ - flip_screen = 0; - DrvReset = 0; - soundlatch = 0; - - if (loverb || joinem) { - memset (Rom0 + 0x8000, 0, 0x1000); - } else { - memset ((UINT8*)Palette, 0, 0x400); - memset (Rom0 + 0x4000, 0, 0x1000); - } - - memset (Rom0 + 0xb000, 0, 0x1000); - memset (Rom1 + 0x4000, 0, 0x0400); - memset ((UINT8*)remap_address, 0, 0x40); - - question_address = question_rom = 0; - joinem_snd_bit = 0; - soundlatch = 0; - - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - AY8910Reset(0); - - return 0; -} - -static INT32 GetRoms() -{ - char* pRomName; - struct BurnRomInfo ri; - UINT8 *Load0 = Rom0; - UINT8 *Load1 = Rom1; - UINT8 *Loadg = Gfx; - UINT8 *Loadt = User; - INT32 gCount = 0; - - if (!joinem && !loverb) Loadg += 0x2000; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & 7) == 1) { - if (ri.nLen == 0x2000) - { - if (BurnLoadRom(Load0, i, 1)) return 1; - Load0 += ri.nLen; - } - else - { - if (BurnLoadRom(Load0, i, 1)) return 1; - Load0 += ri.nLen; - - if (tri_fix && i == 0) { - Load0 += 0x1000; - } - - if (i == (3 - tri_fix)) Load0 += 0x8000; - } - - continue; - } - - if ((ri.nType & 7) == 2) { - if (BurnLoadRom(Load1, i, 1)) return 1; - Load1 += ri.nLen; - - continue; - } - - if ((ri.nType & 7) == 3) { - if (BurnLoadRom(Loadg, i, 1)) return 1; - Loadg += ri.nLen; - if (joinem) Loadg += 0x1000; - gCount++; - - continue; - } - - if ((ri.nType & 7) == 4) { - if (BurnLoadRom(Prom + 0x000, i + 0, 1)) return 1; - if (BurnLoadRom(Prom + 0x200, i + 1, 1)) return 1; - i++; - - // Roms are nibbles, (1/2 byte), #0 is low, #1 is high - for (INT32 j = 0; j < 0x200; j++) { - Prom[j] = Prom[j] | (Prom[j + 0x200] << 4); - } - - continue; - } - - if ((ri.nType & 7) == 5) { - if (BurnLoadRom(Loadt, i, 1)) return 1; - Loadt += ri.nLen; - - continue; - } - } - - // sucasino, tripool, tripoola - if (gCount == 2) { - memcpy (Gfx + 0x4000, Gfx + 0x3000, 0x1000); - memset (Gfx + 0x3000, 0, 0x1000); - } - - return 0; -} - -static void gfx_decode() -{ - UINT8* tmp = (UINT8*)BurnMalloc( 0x2000 * 3 ); - if (!tmp) return; - - memcpy (tmp, Gfx, 0x6000); - - static INT32 Planes[3] = { 0, 1024*8*8, 1024*8*8*2 }; - static INT32 YOffs[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; - static INT32 XOffs[8] = { 56, 48, 40, 32, 24, 16, 8, 0 }; - - GfxDecode(1024, 3, 8, 8, Planes, XOffs, YOffs, 64, tmp, Gfx); - - BurnFree (tmp); -} - -static INT32 DrvInit() -{ - Mem = (UINT8 *)BurnMalloc (0x100000); - if (Mem == NULL) { - return 1; - } - - pFMBuffer = (INT16 *)malloc (nBurnSoundLen * 3 * sizeof(INT16)); - if (pFMBuffer == NULL) { - return 1; - } - - Rom0 = Mem + 0x00000; - Rom1 = Mem + 0x10000; - Gfx = Mem + 0x20000; - User = Mem + 0x30000; - Prom = Mem + 0xb0000; - Palette = (UINT32*)(Mem + 0xc0000); - DrvPal = (UINT32*)(Mem + 0xc1000); - - GetRoms(); - - gfx_decode(); - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(jack_cpu0_read); - ZetSetWriteHandler(jack_cpu0_write); - - if (joinem || loverb) - { - ZetMapArea(0x0000, 0x8fff, 0, Rom0 + 0x0000); - ZetMapArea(0x0000, 0x8fff, 2, Rom0 + 0x0000); - - ZetMapArea(0x8000, 0x8fff, 1, Rom0 + 0x8000); - - ZetMapArea(0xb500, 0xb5ff, 0, Rom0 + 0xb500); // controls hack - } else { - ZetMapArea(0x0000, 0x3fff, 0, Rom0 + 0x0000); - ZetMapArea(0x0000, 0x3fff, 2, Rom0 + 0x0000); - - ZetMapArea(0x4000, 0x5fff, 0, Rom0 + 0x4000); - ZetMapArea(0x4000, 0x5fff, 1, Rom0 + 0x4000); - ZetMapArea(0x4000, 0x5fff, 2, Rom0 + 0x4000); - } - - ZetMapArea(0xb000, 0xb0ff, 0, Rom0 + 0xb000); - ZetMapArea(0xb000, 0xb0ff, 1, Rom0 + 0xb000); - - ZetMapArea(0xb800, 0xbbff, 0, Rom0 + 0xb800); - ZetMapArea(0xb800, 0xbbff, 1, Rom0 + 0xb800); - - ZetMapArea(0xbc00, 0xbfff, 0, Rom0 + 0xbc00); - ZetMapArea(0xbc00, 0xbfff, 1, Rom0 + 0xbc00); - - if (suprtriv) - { - ZetMapArea(0xd000, 0xffff, 0, Rom0 + 0xc000); - ZetMapArea(0xd000, 0xffff, 2, Rom0 + 0xc000); - } else { - ZetMapArea(0xc000, 0xffff, 0, Rom0 + 0xc000); - ZetMapArea(0xc000, 0xffff, 2, Rom0 + 0xc000); - } - - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetInHandler(jack_in_port); - ZetSetOutHandler(jack_out_port); - ZetMapArea(0x0000, 0x1fff, 0, Rom1 + 0x0000); - ZetMapArea(0x0000, 0x1fff, 2, Rom1 + 0x0000); - ZetMapArea(0x4000, 0x43ff, 0, Rom1 + 0x4000); - ZetMapArea(0x4000, 0x43ff, 1, Rom1 + 0x4000); - ZetMapArea(0x4000, 0x43ff, 2, Rom1 + 0x4000); - ZetMemEnd(); - ZetClose(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - - AY8910Init(0, 1500000, nBurnSoundRate, &soundlatch_r, &timer_r, NULL, NULL); - AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - AY8910Exit(0); - GenericTilesExit(); - - BurnFree (pFMBuffer); - BurnFree (Mem); - - DrvPal = Palette = NULL; - pFMBuffer = NULL; - Mem = Rom0 = Rom1 = Gfx = User = NULL; - pAY8910Buffer[0] = pAY8910Buffer[1] = pAY8910Buffer[2] = NULL; - - tri_fix = 0; - joinem = 0; - loverb = 0; - suprtriv = 0; - - return 0; -} - - -static INT32 DrvDraw() -{ - if (DrvCalcPal) - { - for (INT32 i = 0; i < 0x100; i++) { - UINT32 col = Palette[i]; - DrvPal[i] = BurnHighCol(col >> 16, col >> 8, col, 0); - } - DrvCalcPal = 0; - } - - UINT8 *sram = Rom0 + 0xb000; // sprite ram - UINT8 *vram = Rom0 + 0xb800; // video ram - UINT8 *cram = Rom0 + 0xbc00; // color ram - INT32 offs, sx, sy, num, color, flipx, flipy; - - for (offs = 0; offs < 0x400; offs++) - { - sx = (offs & 0x1f) << 3; - sy = (offs >> 2) & 0xf8; - - if (joinem || loverb) { - num = vram[offs] + ((cram[offs] & 0x03) << 8); - color = (cram[offs] & 0x38) >> 2; - } else { - num = vram[offs] + ((cram[offs] & 0x18) << 5); - color = (cram[offs] & 0x07); - } - - if (flip_screen) { - Render8x8Tile_FlipXY_Clip(pTransDraw, num, sx ^ 0xf8, sy ^ 0xf8, color, 2, 0, Gfx); - } else { - sx -= 16; - Render8x8Tile_Clip(pTransDraw, num, sx, sy, color, 2, 0, Gfx); - } - } - - for (offs = 0; offs < 0x80; offs += 4) - { - sx = 248 - sram[offs]; - sy = sram[offs + 1]; - - if (joinem || loverb) { - num = sram[offs + 2] + ((sram[offs + 3] & 0x01) << 8); - color = (sram[offs + 3] & 0x38) >> 2; - } else { - num = sram[offs + 2] + ((sram[offs + 3] & 0x08) << 5); - color = (sram[offs + 3] & 0x07); - } - - flipx = sram[offs + 3] & 0x40; - flipy = sram[offs + 3] & 0x80; - - if (flip_screen) { - flipx = !flipx; - flipy = !flipy; - sx = 248 - sx; - sy = 248 - sy; - } - - sx -= 16; - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, num, sx, sy, color, 2, 0, 0, Gfx); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, num, sx, sy, color, 2, 0, 0, Gfx); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, num, sx, sy, color, 2, 0, 0, Gfx); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, num, sx, sy, color, 2, 0, 0, Gfx); - } - } - } - - BurnTransferCopy(DrvPal); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - if (joinem || loverb) { - for (INT32 i = 0; i < 6; i++) - Rom0[0xb500 + i] = jack_cpu0_read(0xb500 + i); - } - - INT32 nInterleave = 1000; - INT32 nSoundBufferPos = 0; - - nCyclesTotal[0] = 3000000 / 60; - nCyclesTotal[1] = 1500000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #0 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - - if (joinem) - if (i == (nInterleave / 3) || i == ((nInterleave / 3) * 2)) - ZetRaiseIrq(0); - - if (tri_fix && i == (nInterleave / 2)) ZetRaiseIrq(0); - - if (i == (nInterleave - 1)) - { - if (joinem) { // joinem - if (!DrvJoy3[7]) ZetNmi(); - } else if (loverb) { // loverboy - ZetNmi(); - - } else { // other - ZetRaiseIrq(0); - } - } - - ZetClose(); - - // Run Z80 #1 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - // Render Sound Segment - if (pBurnSoundOut && !suprtriv) { // disable sound for suprtriv - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut && !suprtriv) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - -//------------------------------------------------------------------------------------- -// Save states - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - if (joinem || loverb) { - ba.Data = Rom0 + 0x8000; - } else { - ba.Data = Rom0 + 0x4000; - } - ba.nLen = 0x01000; - ba.szName = "Main Ram"; - BurnAcb(&ba); - - memset(&ba, 0, sizeof(ba)); - ba.Data = Rom0 + 0xb000; - ba.nLen = 0x01000; - ba.szName = "Video Ram"; - BurnAcb(&ba); - - memset(&ba, 0, sizeof(ba)); - ba.Data = (UINT8*)Palette; - ba.nLen = 0x00400; - ba.szName = "Palette"; - BurnAcb(&ba); - - memset(&ba, 0, sizeof(ba)); - ba.Data = (UINT8*)remap_address; - ba.nLen = 0x00040; - ba.szName = "striv question addresses"; - BurnAcb(&ba); - - ZetScan(nAction); - AY8910Scan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(question_address); - SCAN_VAR(question_rom); - SCAN_VAR(soundlatch); - SCAN_VAR(joinem_snd_bit); - } - - return 0; -} - - -// Jack the Giantkiller (set 1) - -static struct BurnRomInfo jackRomDesc[] = { - { "j8", 0x1000, 0xc8e73998, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "jgk.j6", 0x1000, 0x36d7810e, 1 | BRF_PRG | BRF_ESS }, // 1 - { "jgk.j7", 0x1000, 0xb15ff3ee, 1 | BRF_PRG | BRF_ESS }, // 2 - { "jgk.j5", 0x1000, 0x4a63d242, 1 | BRF_PRG | BRF_ESS }, // 3 - { "jgk.j3", 0x1000, 0x605514a8, 1 | BRF_PRG | BRF_ESS }, // 4 - { "jgk.j4", 0x1000, 0xbce489b7, 1 | BRF_PRG | BRF_ESS }, // 5 - { "jgk.j2", 0x1000, 0xdb21bd55, 1 | BRF_PRG | BRF_ESS }, // 6 - { "jgk.j1", 0x1000, 0x49fffe31, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "jgk.j9", 0x1000, 0xc2dc1e00, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code - - { "jgk.j12", 0x1000, 0xce726df0, 3 | BRF_GRA }, // 9 Graphics - { "jgk.j13", 0x1000, 0x6aec2c8d, 3 | BRF_GRA }, // 10 - { "jgk.j11", 0x1000, 0xfd14c525, 3 | BRF_GRA }, // 11 - { "jgk.j10", 0x1000, 0xeab890b2, 3 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(jack) -STD_ROM_FN(jack) - -static INT32 jackInit() -{ - timer_rate = 128; - - return DrvInit(); -} - -struct BurnDriver BurnDrvjack = { - "jack", NULL, NULL, NULL, "1982", - "Jack the Giantkiller (set 1)\0", NULL, "Cinematronics", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, jackRomInfo, jackRomName, NULL, NULL, JackInputInfo, JackDIPInfo, - jackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Jack the Giantkiller (set 2) - -static struct BurnRomInfo jack2RomDesc[] = { - { "jgk.j8", 0x1000, 0xfe229e20, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "jgk.j6", 0x1000, 0x36d7810e, 1 | BRF_PRG | BRF_ESS }, // 1 - { "jgk.j7", 0x1000, 0xb15ff3ee, 1 | BRF_PRG | BRF_ESS }, // 2 - { "jgk.j5", 0x1000, 0x4a63d242, 1 | BRF_PRG | BRF_ESS }, // 3 - { "jgk.j3", 0x1000, 0x605514a8, 1 | BRF_PRG | BRF_ESS }, // 4 - { "jgk.j4", 0x1000, 0xbce489b7, 1 | BRF_PRG | BRF_ESS }, // 5 - { "jgk.j2", 0x1000, 0xdb21bd55, 1 | BRF_PRG | BRF_ESS }, // 6 - { "jgk.j1", 0x1000, 0x49fffe31, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "jgk.j9", 0x1000, 0xc2dc1e00, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code - - { "jgk.j12", 0x1000, 0xce726df0, 3 | BRF_GRA }, // 9 Graphics - { "jgk.j13", 0x1000, 0x6aec2c8d, 3 | BRF_GRA }, // 10 - { "jgk.j11", 0x1000, 0xfd14c525, 3 | BRF_GRA }, // 11 - { "jgk.j10", 0x1000, 0xeab890b2, 3 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(jack2) -STD_ROM_FN(jack2) - -struct BurnDriver BurnDrvjack2 = { - "jack2", "jack", NULL, NULL, "1982", - "Jack the Giantkiller (set 2)\0", NULL, "Cinematronics", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, jack2RomInfo, jack2RomName, NULL, NULL, JackInputInfo, Jack2DIPInfo, - jackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Jack the Giantkiller (set 3) - -static struct BurnRomInfo jack3RomDesc[] = { - { "jack8", 0x1000, 0x632151d2, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "jack6", 0x1000, 0xf94f80d9, 1 | BRF_PRG | BRF_ESS }, // 1 - { "jack7", 0x1000, 0xc830ff1e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "jack5", 0x1000, 0x8dea17e7, 1 | BRF_PRG | BRF_ESS }, // 3 - { "jgk.j3", 0x1000, 0x605514a8, 1 | BRF_PRG | BRF_ESS }, // 4 // bank 2 - { "jgk.j4", 0x1000, 0xbce489b7, 1 | BRF_PRG | BRF_ESS }, // 5 - { "jgk.j2", 0x1000, 0xdb21bd55, 1 | BRF_PRG | BRF_ESS }, // 6 - { "jack1", 0x1000, 0x7e75ea3d, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "jgk.j9", 0x1000, 0xc2dc1e00, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code - - { "jack12", 0x1000, 0x80320647, 3 | BRF_GRA }, // 9 Graphics - { "jgk.j13", 0x1000, 0x6aec2c8d, 3 | BRF_GRA }, // 10 - { "jgk.j11", 0x1000, 0xfd14c525, 3 | BRF_GRA }, // 11 - { "jgk.j10", 0x1000, 0xeab890b2, 3 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(jack3) -STD_ROM_FN(jack3) - -struct BurnDriver BurnDrvjack3 = { - "jack3", "jack", NULL, NULL, "1982", - "Jack the Giantkiller (set 3)\0", NULL, "Cinematronics", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, jack3RomInfo, jack3RomName, NULL, NULL, JackInputInfo, Jack3DIPInfo, - jackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Treasure Hunt (bootleg?) - -static struct BurnRomInfo treahuntRomDesc[] = { - { "thunt-1.f2", 0x1000, 0x0b35858c, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "thunt-2.f3", 0x1000, 0x67305a51, 1 | BRF_PRG | BRF_ESS }, // 1 - { "thunt-3.4f", 0x1000, 0xd7a969c3, 1 | BRF_PRG | BRF_ESS }, // 2 - { "thunt-4.6f", 0x1000, 0x2483f14d, 1 | BRF_PRG | BRF_ESS }, // 3 - { "thunt-5.7f", 0x1000, 0xc69d5e21, 1 | BRF_PRG | BRF_ESS }, // 4 - { "thunt-6.7e", 0x1000, 0x11bf3d49, 1 | BRF_PRG | BRF_ESS }, // 5 - { "thunt-7.6e", 0x1000, 0x7c2d6279, 1 | BRF_PRG | BRF_ESS }, // 6 - { "thunt-8.4e", 0x1000, 0xf73b86fb, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "jgk.j9", 0x1000, 0xc2dc1e00, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code - - { "thunt-13.a4", 0x1000, 0xe03f1f09, 3 | BRF_GRA }, // 9 Graphics - { "thunt-12.a3", 0x1000, 0xda4ee9eb, 3 | BRF_GRA }, // 10 - { "thunt-10.a1", 0x1000, 0x51ec7934, 3 | BRF_GRA }, // 11 - { "thunt-11.a2", 0x1000, 0xf9781143, 3 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(treahunt) -STD_ROM_FN(treahunt) - -static void treahunt_decode() -{ - for (INT32 i = 0; i < 0x4000; i++) - { - if (i & 0x1000) - { - User[i] = BITSWAP08(Rom0[i], 0, 2, 5, 1, 3, 6, 4, 7); - - if (~i & 0x04) User[i] ^= 0x81; - } - else - { - User[i] = BITSWAP08(Rom0[i], 7, 2, 5, 1, 3, 6, 4, 0) ^ 0x81; - } - } - - ZetOpen(0); - ZetMapArea(0x0000, 0x3fff, 2, User, Rom0); - ZetClose(); -} - -static INT32 treahuntInit() -{ - timer_rate = 128; - - INT32 nRet = DrvInit(); - - treahunt_decode(); - - return nRet; -} - -struct BurnDriver BurnDrvtreahunt = { - "treahunt", "jack", NULL, NULL, "1982", - "Treasure Hunt (bootleg?)\0", NULL, "Hara Industries", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, treahuntRomInfo, treahuntRomName, NULL, NULL, JackInputInfo, TreahuntDIPInfo, - treahuntInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Zzyzzyxx (set 1) - -static struct BurnRomInfo zzyzzyxxRomDesc[] = { - { "a.2f", 0x1000, 0xa9102e34, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "zzyzzyxx.b", 0x1000, 0xefa9d4c6, 1 | BRF_PRG | BRF_ESS }, // 1 - { "zzyzzyxx.c", 0x1000, 0xb0a365b1, 1 | BRF_PRG | BRF_ESS }, // 2 - { "zzyzzyxx.d", 0x1000, 0x5ed6dd9a, 1 | BRF_PRG | BRF_ESS }, // 3 - { "zzyzzyxx.e", 0x1000, 0x5966fdbf, 1 | BRF_PRG | BRF_ESS }, // 4 - { "f.7e", 0x1000, 0x12f24c68, 1 | BRF_PRG | BRF_ESS }, // 5 - { "g.6e", 0x1000, 0x408f2326, 1 | BRF_PRG | BRF_ESS }, // 6 - { "h.4e", 0x1000, 0xf8bbabe0, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "i.5a", 0x1000, 0xc7742460, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code - { "j.6a", 0x1000, 0x72166ccd, 2 | BRF_PRG | BRF_ESS }, // 9 - - { "n.1c", 0x1000, 0x4f64538d, 3 | BRF_GRA }, // 10 Graphics - { "m.1d", 0x1000, 0x217b1402, 3 | BRF_GRA }, // 11 - { "k.1b", 0x1000, 0xb8b2b8cc, 3 | BRF_GRA }, // 12 - { "l.1a", 0x1000, 0xab421a83, 3 | BRF_GRA }, // 13 -}; - -STD_ROM_PICK(zzyzzyxx) -STD_ROM_FN(zzyzzyxx) - -static INT32 zzyzzyxxInit() -{ - timer_rate = 16; - - return DrvInit(); -} - -struct BurnDriver BurnDrvzzyzzyxx = { - "zzyzzyxx", NULL, NULL, NULL, "1982", - "Zzyzzyxx (set 1)\0", NULL, "Cinematronics + Advanced Microcomputer Systems", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, zzyzzyxxRomInfo, zzyzzyxxRomName, NULL, NULL, ZzyzzyxxInputInfo, ZzyzzyxxDIPInfo, - zzyzzyxxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Zzyzzyxx (set 2) - -static struct BurnRomInfo zzyzzyx2RomDesc[] = { - { "a.2f", 0x1000, 0xa9102e34, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b.3f", 0x1000, 0x4277beab, 1 | BRF_PRG | BRF_ESS }, // 1 - { "c.4f", 0x1000, 0x72ac99e1, 1 | BRF_PRG | BRF_ESS }, // 2 - { "d.6f", 0x1000, 0x7c7eec2b, 1 | BRF_PRG | BRF_ESS }, // 3 - { "e.7f", 0x1000, 0xcffc4a68, 1 | BRF_PRG | BRF_ESS }, // 4 - { "f.7e", 0x1000, 0x12f24c68, 1 | BRF_PRG | BRF_ESS }, // 5 - { "g.6e", 0x1000, 0x408f2326, 1 | BRF_PRG | BRF_ESS }, // 6 - { "h.4e", 0x1000, 0xf8bbabe0, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "i.5a", 0x1000, 0xc7742460, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code - { "j.6a", 0x1000, 0x72166ccd, 2 | BRF_PRG | BRF_ESS }, // 9 - - { "n.1c", 0x1000, 0x4f64538d, 3 | BRF_GRA }, // 10 Graphics - { "m.1d", 0x1000, 0x217b1402, 3 | BRF_GRA }, // 11 - { "k.1b", 0x1000, 0xb8b2b8cc, 3 | BRF_GRA }, // 12 - { "l.1a", 0x1000, 0xab421a83, 3 | BRF_GRA }, // 13 -}; - -STD_ROM_PICK(zzyzzyx2) -STD_ROM_FN(zzyzzyx2) - -struct BurnDriver BurnDrvzzyzzyx2 = { - "zzyzzyxx2", "zzyzzyxx", NULL, NULL, "1982", - "Zzyzzyxx (set 2)\0", NULL, "Cinematronics + Advanced Microcomputer Systems", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, zzyzzyx2RomInfo, zzyzzyx2RomName, NULL, NULL, ZzyzzyxxInputInfo, ZzyzzyxxDIPInfo, - zzyzzyxxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Brix - -static struct BurnRomInfo brixRomDesc[] = { - { "a", 0x1000, 0x050e0d70, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b", 0x1000, 0x668118ae, 1 | BRF_PRG | BRF_ESS }, // 1 - { "c", 0x1000, 0xff5ed6cf, 1 | BRF_PRG | BRF_ESS }, // 2 - { "d", 0x1000, 0xc3ae45a9, 1 | BRF_PRG | BRF_ESS }, // 3 - { "e", 0x1000, 0xdef99fa9, 1 | BRF_PRG | BRF_ESS }, // 4 - { "f", 0x1000, 0xdde717ed, 1 | BRF_PRG | BRF_ESS }, // 5 - { "g", 0x1000, 0xadca02d8, 1 | BRF_PRG | BRF_ESS }, // 6 - { "h", 0x1000, 0xbc3b878c, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "i.5a", 0x1000, 0xc7742460, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code - { "j.6a", 0x1000, 0x72166ccd, 2 | BRF_PRG | BRF_ESS }, // 9 - - { "n", 0x1000, 0x8064910e, 3 | BRF_GRA }, // 10 Graphics - { "m.1d", 0x1000, 0x217b1402, 3 | BRF_GRA }, // 11 - { "k", 0x1000, 0xc7d7e2a0, 3 | BRF_GRA }, // 12 - { "l.1a", 0x1000, 0xab421a83, 3 | BRF_GRA }, // 13 -}; - -STD_ROM_PICK(brix) -STD_ROM_FN(brix) - -struct BurnDriver BurnDrvbrix = { - "brix", "zzyzzyxx", NULL, NULL, "1982", - "Brix\0", NULL, "Cinematronics + Advanced Microcomputer Systems", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, brixRomInfo, brixRomName, NULL, NULL, ZzyzzyxxInputInfo, ZzyzzyxxDIPInfo, - zzyzzyxxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Freeze - -static struct BurnRomInfo freezeRomDesc[] = { - { "freeze.f2", 0x1000, 0x0a431665, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "freeze.f3", 0x1000, 0x1189b8ad, 1 | BRF_PRG | BRF_ESS }, // 1 - { "freeze.f4", 0x1000, 0x10c4a5ea, 1 | BRF_PRG | BRF_ESS }, // 2 - { "freeze.f5", 0x1000, 0x16024c53, 1 | BRF_PRG | BRF_ESS }, // 3 - { "freeze.f7", 0x1000, 0xea0b0765, 1 | BRF_PRG | BRF_ESS }, // 4 - { "freeze.e7", 0x1000, 0x1155c00b, 1 | BRF_PRG | BRF_ESS }, // 5 - { "freeze.e5", 0x1000, 0x95c18d75, 1 | BRF_PRG | BRF_ESS }, // 6 - { "freeze.e4", 0x1000, 0x7e8f5afc, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "freeze.a1", 0x1000, 0x7771f5b9, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code - - { "freeze.5a", 0x1000, 0x6c8a98a0, 3 | BRF_GRA }, // 9 Graphics - { "freeze.3a", 0x1000, 0x6d2125e4, 3 | BRF_GRA }, // 10 - { "freeze.1a", 0x1000, 0x3a7f2fa9, 3 | BRF_GRA }, // 11 - { "freeze.2a", 0x1000, 0xdd70ddd6, 3 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(freeze) -STD_ROM_FN(freeze) - -struct BurnDriver BurnDrvfreeze = { - "freeze", NULL, NULL, NULL, "1984", - "Freeze\0", NULL, "Cinematronics", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, freezeRomInfo, freezeRomName, NULL, NULL, FreezeInputInfo, FreezeDIPInfo, - jackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Super Casino - -static struct BurnRomInfo sucasinoRomDesc[] = { - { "1", 0x1000, 0xe116e979, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "2", 0x1000, 0x2a2635f5, 1 | BRF_PRG | BRF_ESS }, // 1 - { "3", 0x1000, 0x69864d90, 1 | BRF_PRG | BRF_ESS }, // 2 - { "4", 0x1000, 0x174c9373, 1 | BRF_PRG | BRF_ESS }, // 3 - { "5", 0x1000, 0x115bcb1e, 1 | BRF_PRG | BRF_ESS }, // 4 - { "6", 0x1000, 0x434caa17, 1 | BRF_PRG | BRF_ESS }, // 5 - { "7", 0x1000, 0x67c68b82, 1 | BRF_PRG | BRF_ESS }, // 6 - { "8", 0x1000, 0xf5b63006, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "9", 0x1000, 0x67cf8aec, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code - - { "11", 0x1000, 0xf92c4c5b, 3 | BRF_GRA }, // 9 Graphics - { "10", 0x1000, 0x3b0783ce, 3 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(sucasino) -STD_ROM_FN(sucasino) - -struct BurnDriver BurnDrvsucasino = { - "sucasino", NULL, NULL, NULL, "1984", - "Super Casino\0", NULL, "Data Amusement", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_CASINO, 0, - NULL, sucasinoRomInfo, sucasinoRomName, NULL, NULL, SucasinoInputInfo, SucasinoDIPInfo, - jackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Tri-Pool (Casino Tech) - -static struct BurnRomInfo tripoolRomDesc[] = { - { "tri73a.bin", 0x1000, 0x96893aa7, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "tri62a.bin", 0x1000, 0x3299dc65, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tri52b.bin", 0x1000, 0x27ef765e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tri33c.bin", 0x1000, 0xd7ef061d, 1 | BRF_PRG | BRF_ESS }, // 3 - { "tri45c.bin", 0x1000, 0x51b813b1, 1 | BRF_PRG | BRF_ESS }, // 4 - { "tri25d.bin", 0x1000, 0x8e64512d, 1 | BRF_PRG | BRF_ESS }, // 5 - { "tri13d.bin", 0x1000, 0xad268e9b, 1 | BRF_PRG | BRF_ESS }, // 6 - - { "trisnd.bin", 0x1000, 0x945c4b8b, 2 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code - - { "tri105a.bin", 0x1000, 0x366a753c, 3 | BRF_GRA }, // 8 Graphics - { "tri93a.bin", 0x1000, 0x35213782, 3 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(tripool) -STD_ROM_FN(tripool) - -static INT32 tripoolInit() -{ - tri_fix = 1; - timer_rate = 128; - - return DrvInit(); -} - -struct BurnDriver BurnDrvtripool = { - "tripool", NULL, NULL, NULL, "1981", - "Tri-Pool (Casino Tech)\0", NULL, "Noma (Casino Tech license)", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0, - NULL, tripoolRomInfo, tripoolRomName, NULL, NULL, TripoolInputInfo, NULL, - tripoolInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Tri-Pool (Costal Games) - -static struct BurnRomInfo tripoolaRomDesc[] = { - { "tri73a.bin", 0x1000, 0x96893aa7, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "tri62a.bin", 0x1000, 0x3299dc65, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tri52b.bin", 0x1000, 0x27ef765e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tri33c.bin", 0x1000, 0xd7ef061d, 1 | BRF_PRG | BRF_ESS }, // 3 - { "tri45c.bin", 0x1000, 0x51b813b1, 1 | BRF_PRG | BRF_ESS }, // 4 - { "tri25d.bin", 0x1000, 0x8e64512d, 1 | BRF_PRG | BRF_ESS }, // 5 - { "tp1ckt", 0x1000, 0x72ec43a3, 1 | BRF_PRG | BRF_ESS }, // 6 - - { "trisnd.bin", 0x1000, 0x945c4b8b, 2 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code - - { "tri105a.bin", 0x1000, 0x366a753c, 3 | BRF_GRA }, // 8 Graphics - { "tri93a.bin", 0x1000, 0x35213782, 3 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(tripoola) -STD_ROM_FN(tripoola) - -struct BurnDriver BurnDrvtripoola = { - "tripoola", "tripool", NULL, NULL, "1981", - "Tri-Pool (Costal Games)\0", NULL, "Noma (Costal Games license)", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0, - NULL, tripoolaRomInfo, tripoolaRomName, NULL, NULL, TripoolInputInfo, NULL, - tripoolInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - - -// Joinem - -static struct BurnRomInfo joinemRomDesc[] = { - { "join1.r0", 0x2000, 0xb5b2e2cc, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "join2.r2", 0x2000, 0xbcf140e6, 1 | BRF_PRG | BRF_ESS }, // 1 - { "join3.r4", 0x2000, 0xfe04e4d4, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "join7.s0", 0x1000, 0xbb8a7814, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "join4.p3", 0x1000, 0x4964c82c, 3 | BRF_GRA }, // 4 Graphics - { "join5.p2", 0x1000, 0xae78fa89, 3 | BRF_GRA }, // 5 - { "join6.p1", 0x1000, 0x2b533261, 3 | BRF_GRA }, // 6 - - { "l82s129.11n", 0x0100, 0x7b724211, 4 | BRF_GRA }, // 7 Color Proms - { "h82s129.12n", 0x0100, 0x2e81c5ff, 4 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(joinem) -STD_ROM_FN(joinem) - -static void joinem_palette_init() -{ - for (INT32 i = 0; i < 0x100; i++) - { - INT32 bit0,bit1,bit2,r,g,b; - - bit0 = (Prom[i] >> 0) & 1; - bit1 = (Prom[i] >> 1) & 1; - bit2 = (Prom[i] >> 2) & 1; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (Prom[i] >> 3) & 1; - bit1 = (Prom[i] >> 4) & 1; - bit2 = (Prom[i] >> 5) & 1; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = 0; - bit1 = (Prom[i] >> 6) & 1; - bit2 = (Prom[i] >> 7) & 1; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - Palette[i] = (r << 16) | (g << 8) | b; - } -} - -static INT32 joinemInit() -{ - joinem = 1; - timer_rate = 16; - - INT32 nRet = DrvInit(); - - joinem_palette_init(); - - return nRet; -} - -struct BurnDriver BurnDrvjoinem = { - "joinem", NULL, NULL, NULL, "1986", - "Joinem\0", NULL, "Global Corporation", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, joinemRomInfo, joinemRomName, NULL, NULL, JoinemInputInfo, JoinemDIPInfo, - joinemInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 240, 3, 4 -}; - - -// Lover Boy - -static struct BurnRomInfo loverboyRomDesc[] = { - { "lover.r0", 0x2000, 0xffec4e41, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "lover.r2", 0x2000, 0x04052262, 1 | BRF_PRG | BRF_ESS }, // 1 - { "lover.r4", 0x2000, 0xce5f3b49, 1 | BRF_PRG | BRF_ESS }, // 2 - { "lover.r6", 0x1000, 0x839d79b7, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "lover.s0", 0x1000, 0xec38111c, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code - - { "lover.p3", 0x2000, 0x1a519c8f, 3 | BRF_GRA }, // 5 Graphics - { "lover.p2", 0x2000, 0xe465372f, 3 | BRF_GRA }, // 6 - { "lover.p1", 0x2000, 0xcda0d87e, 3 | BRF_GRA }, // 7 - - { "color.n11", 0x0200, 0xcf4a16ae, 4 | BRF_GRA }, // 8 Color Proms - { "color.n12", 0x0200, 0x4b11ac21, 4 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(loverboy) -STD_ROM_FN(loverboy) - -static INT32 loverboyInit() -{ - loverb = 1; - timer_rate = 16; - - INT32 nRet = DrvInit(); - - // Hack (Protection?) - Rom0[0x12] = 0x9d; - Rom0[0x13] = 0x01; - - joinem_palette_init(); - - return nRet; -} - -struct BurnDriver BurnDrvloverboy = { - "loverboy", NULL, NULL, NULL, "1983", - "Lover Boy\0", "No sound", "G.T Enterprise Inc", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, loverboyRomInfo, loverboyRomName, NULL, NULL, LoverboyInputInfo, LoverboyDIPInfo, - loverboyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 240, 3, 4 -}; - - -// Super Triv - -static struct BurnRomInfo strivRomDesc[] = { - { "pr1.f2", 0x1000, 0xdcf5da6e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "pr2.4f", 0x1000, 0x921610ba, 1 | BRF_PRG | BRF_ESS }, // 1 - { "pr3.5f", 0x1000, 0xc36f0e21, 1 | BRF_PRG | BRF_ESS }, // 2 - { "pr4.6f", 0x1000, 0x0dc98a97, 1 | BRF_PRG | BRF_ESS }, // 3 - { "bc3.7e", 0x1000, 0x83f03885, 1 | BRF_PRG | BRF_ESS }, // 4 - { "bc2.6e", 0x1000, 0x75f18361, 1 | BRF_PRG | BRF_ESS }, // 5 - { "bc1.5e", 0x1000, 0x0d150385, 1 | BRF_PRG | BRF_ESS }, // 6 - - { "snd.5a", 0x1000, 0xb7ddf84f, 2 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code - - { "chr0.1a", 0x1000, 0x8f60229b, 3 | BRF_GRA }, // 8 Graphics - { "chr2.4a", 0x1000, 0x8f982a9c, 3 | BRF_GRA }, // 9 - { "chr3.5a", 0x1000, 0x8f982a9c, 3 | BRF_GRA }, // 10 - { "chr1.2a", 0x1000, 0x7ad4358e, 3 | BRF_GRA }, // 11 - - { "rom.u6", 0x8000, 0xa32d7a28, 5 | BRF_PRG | BRF_ESS }, // 12 Question ROMs - { "rom.u7", 0x8000, 0xbc44ae18, 5 | BRF_PRG | BRF_ESS }, // 13 - { "tbfd2.u8", 0x8000, 0x9572984a, 5 | BRF_PRG | BRF_ESS }, // 14 - { "tbfd3.u9", 0x8000, 0xd904a2f1, 5 | BRF_PRG | BRF_ESS }, // 15 - { "tbfl0.u10", 0x8000, 0x680264a2, 5 | BRF_PRG | BRF_ESS }, // 16 - { "tbfl1.u11", 0x8000, 0x33e99d00, 5 | BRF_PRG | BRF_ESS }, // 17 - { "tbfl2.u12", 0x8000, 0x2e7a941f, 5 | BRF_PRG | BRF_ESS }, // 18 - { "tbft0.u13", 0x8000, 0x7d2e5e89, 5 | BRF_PRG | BRF_ESS }, // 19 - { "tbft1.u14", 0x8000, 0xd36246cf, 5 | BRF_PRG | BRF_ESS }, // 20 - { "tbfd1.u15", 0x8000, 0x745db398, 5 | BRF_PRG | BRF_ESS }, // 21 - - { "tbfd0.u21", 0x2000, 0x15b83099, 0 | BRF_OPT }, // 22 Junk -}; - -STD_ROM_PICK(striv) -STD_ROM_FN(striv) - -static INT32 strivInit() -{ - suprtriv = 1; - timer_rate = 128; - - INT32 nRet = DrvInit(); - - for (INT32 i = 0; i < 0x4000; i++) - { - if (i & 0x1000) - { - if (i & 4) - Rom0[i] = BITSWAP08(Rom0[i],7,2,5,1,3,6,4,0) ^ 1; - else - Rom0[i] = BITSWAP08(Rom0[i],0,2,5,1,3,6,4,7) ^ 0x81; - } - else - { - if (i & 4) - Rom0[i] = BITSWAP08(Rom0[i],7,2,5,1,3,6,4,0) ^ 1; - else - Rom0[i] = BITSWAP08(Rom0[i],0,2,5,1,3,6,4,7); - } - } - - return nRet; -} - -struct BurnDriver BurnDrvstriv = { - "striv", NULL, NULL, NULL, "1985", - "Super Triv\0", "No sound", "Hara Industries", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_QUIZ, 0, - NULL, strivRomInfo, strivRomName, NULL, NULL, StrivInputInfo, StrivDIPInfo, - strivInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; - -static struct BurnRomInfo striv2RomDesc[] = { - { "s.triv_p1.2f", 0x1000, 0xdcf5da6e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "s.triv_p2.3f", 0x1000, 0x921610ba, 1 | BRF_PRG | BRF_ESS }, // 1 - { "s.triv_p3.4f", 0x1000, 0xc36f0e21, 1 | BRF_PRG | BRF_ESS }, // 2 - { "s.triv_cp4.f6", 0x1000, 0x0dc98a97, 1 | BRF_PRG | BRF_ESS }, // 3 - { "s.triv_c3.e7", 0x1000, 0x2f4b0570, 1 | BRF_PRG | BRF_ESS }, // 4 - { "s.triv_c2.e6", 0x1000, 0xe21bd3ab, 1 | BRF_PRG | BRF_ESS }, // 5 - { "s.triv_c1.5e", 0x1000, 0x2c2c7282, 1 | BRF_PRG | BRF_ESS }, // 6 - - { "s.triv_sound.5a", 0x1000, 0xb7ddf84f, 2 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code - - { "s.triv.1a", 0x1000, 0x8f60229b, 3 | BRF_GRA }, // 8 Graphics - { "s.triv.4a", 0x1000, 0x8f982a9c, 3 | BRF_GRA }, // 9 - { "s.triv.5a", 0x1000, 0x8f982a9c, 3 | BRF_GRA }, // 10 - { "s.triv.2a", 0x1000, 0x7ad4358e, 3 | BRF_GRA }, // 11 - - { "s.triv_ts0.u6", 0x8000, 0x796849da, 5 | BRF_PRG | BRF_ESS }, // 12 Question ROMs - { "s.triv_ts1.u7", 0x8000, 0x059d4900, 5 | BRF_PRG | BRF_ESS }, // 13 - { "s.triv_ts2.u8", 0x8000, 0x184159aa, 5 | BRF_PRG | BRF_ESS }, // 14 - { "s.triv_ta0.u9", 0x8000, 0xc4eb7f2e, 5 | BRF_PRG | BRF_ESS }, // 15 - { "s.triv_ta1.u10", 0x8000, 0x3d9a136f, 5 | BRF_PRG | BRF_ESS }, // 16 - { "s.triv_ta2.u11", 0x8000, 0x8fa557b2, 5 | BRF_PRG | BRF_ESS }, // 17 - { "s.triv_te0.u12", 0x8000, 0x3f5d1c4b, 5 | BRF_PRG | BRF_ESS }, // 18 - { "s.triv_te1.u13", 0x8000, 0x6ae2bf3a, 5 | BRF_PRG | BRF_ESS }, // 19 - { "s.triv_tg0.u14", 0x8000, 0x8fc9c76d, 5 | BRF_PRG | BRF_ESS }, // 20 - { "s.triv_tg1.u15", 0x8000, 0x981a2a43, 5 | BRF_PRG | BRF_ESS }, // 21 -}; - -STD_ROM_PICK(striv2) -STD_ROM_FN(striv2) - -struct BurnDriver BurnDrvstriv2 = { - "striv2", "striv", NULL, NULL, "1985", - "Super Triv (set 2)\0", "No sound", "Hara Industries", "Jack the Giantkiller", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_QUIZ, 0, - NULL, striv2RomInfo, striv2RomName, NULL, NULL, StrivInputInfo, StrivDIPInfo, - strivInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, - 224, 256, 3, 4 -}; +// FB Alpha Jack the Giantkiller driver module +// Based on MAME driver by Brad Oliver + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "bitswap.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + + +static UINT8 *Mem, *Rom0, *Rom1, *Gfx, *Prom, *User; +static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvJoy4[8], DrvReset, DrvDips[2]; +static INT16 *pAY8910Buffer[3], *pFMBuffer = NULL; +static INT32 tri_fix, joinem, loverb, suprtriv; +static INT32 timer_rate, flip_screen; +static UINT32 *Palette, *DrvPal; +static UINT8 DrvCalcPal; + +static UINT8 soundlatch; +static INT32 question_address, question_rom, remap_address[16]; +static INT32 joinem_snd_bit; + +static INT32 nCyclesSegment; +static INT32 nCyclesDone[2], nCyclesTotal[2]; + +static struct BurnInputInfo JackInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, + {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"p1 Up" , BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down", }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p1 left" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 1, "p1 fire 2"}, + + {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 5, "p2 coin" }, + {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"p2 Up" , BIT_DIGITAL, DrvJoy2 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down", }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 6, "p2 right" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 7, "p2 left" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Jack) + +static struct BurnInputInfo ZzyzzyxxInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 5, "p1 coin" }, + {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down", }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 1"}, + + {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 4, "p2 Up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down", }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Zzyzzyxx) + +static struct BurnInputInfo FreezeInputList[] = { + {"Coin" , BIT_DIGITAL , DrvJoy1 + 5, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 1, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 2"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Freeze) + +static struct BurnInputInfo SucasinoInputList[] = { + {"Coin" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, + + {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p1 left" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 1"}, + + {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 6, "p2 right" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 7, "p2 left" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Sucasino) + +static struct BurnInputInfo TripoolInputList[] = { + {"Select Game 1", BIT_DIGITAL , DrvJoy1 + 2, "Select Game 1"}, + {"Select Game 2", BIT_DIGITAL, DrvJoy1 + 3, "Select Game 2"}, + {"Select Game 3", BIT_DIGITAL, DrvJoy1 + 4, "Select Game 3"}, + + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, + {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down", }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p1 left" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 1, "p1 fire 2"}, + + {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 5, "p2 coin" }, + {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 4, "p1 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down", }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 6, "p2 right" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 7, "p2 left" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, +}; + +STDINPUTINFO(Tripool) + +static struct BurnInputInfo JoinemInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy3 + 0, "p1 coin" }, + {"P1 start" , BIT_DIGITAL , DrvJoy3 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up", }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down", }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 2, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" }, + + {"P2 Coin" , BIT_DIGITAL , DrvJoy3 + 1, "p2 coin" }, + {"P2 start" , BIT_DIGITAL , DrvJoy3 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up", }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down", }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p2 right" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p2 left" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Joinem) + +static struct BurnInputInfo LoverboyInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy3 + 0, "p1 coin" }, + {"P1 start" , BIT_DIGITAL , DrvJoy3 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up", }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down", }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 2, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, + + {"P2 Coin" , BIT_DIGITAL , DrvJoy3 + 1, "p2 coin" }, + {"P2 start" , BIT_DIGITAL , DrvJoy3 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up", }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down", }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p2 right" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p2 left" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Loverboy) + +static struct BurnInputInfo StrivInputList[] = { + {"Coin" , BIT_DIGITAL , DrvJoy3 + 1, "p1 coin" }, + + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 1, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 2, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 3, "p1 fire 3"}, + {"P1 Button 4" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 4"}, + + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 1, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 2, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 3, "p2 fire 3"}, + {"P2 Button 4" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 4"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Striv) + +static struct BurnDIPInfo JackDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL}, + {0x12, 0xff, 0xff, 0x00, NULL}, + + // DSW1 + {0 , 0xfe, 0 , 4 , "Coin B"}, + {0x11, 0x01, 0x03, 0x01, "2 coins 1 credit"}, + {0x11, 0x01, 0x03, 0x03, "4 coins 3 credits"}, + {0x11, 0x01, 0x03, 0x00, "1 coin 1 credit"}, + {0x11, 0x01, 0x03, 0x02, "1 coin 3 credits"}, + + {0 , 0xfe, 0 , 4 , "Coin A"}, + {0x11, 0x01, 0x0c, 0x00, "3 coins 1 credit"}, + {0x11, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, + {0x11, 0x01, 0x0c, 0x08, "4 coins 3 credits"}, + {0x11, 0x01, 0x0c, 0x0c, "1 coin 1 credits"}, + + {0 , 0xfe, 0 , 2 , "Lives"}, + {0x11, 0x01, 0x10, 0x00, "3"}, + {0x11, 0x01, 0x10, 0x10, "5"}, + + {0 , 0xfe, 0 , 2 , "Bonus Life"}, + {0x11, 0x01, 0x20, 0x00, "Every 10000"}, + {0x11, 0x01, 0x20, 0x20, "10000 ONly"}, + + {0 , 0xfe, 0 , 2 , "Difficulty"}, + {0x11, 0x01, 0x40, 0x00, "Start on Level 1"}, + {0x11, 0x01, 0x40, 0x40, "Start on Level 13"}, + + {0 , 0xfe, 0 , 2 , "Bullets per Bean Collected"}, + {0x11, 0x01, 0x80, 0x00, "1"}, + {0x11, 0x01, 0x80, 0x80, "2"}, + + // DSW2 + {0 , 0xfe, 0 , 2 , "Cabinet"}, + {0x12, 0x01, 0x01, 0x01, "Upright"}, + {0x12, 0x01, 0x01, 0x00, "Cocktail"}, + + {0 , 0xfe, 0 , 2 , "Invulnerability (Cheat)"}, + {0x12, 0x01, 0x40, 0x00, "Off"}, + {0x12, 0x01, 0x40, 0x40, "On"}, + + {0 , 0xfe, 0 , 4 , "255 Lives (Cheat)"}, + {0x12, 0x01, 0x80, 0x00, "Off"}, + {0x12, 0x01, 0x80, 0x80, "On"}, +}; + +STDDIPINFO(Jack) + + +static struct BurnDIPInfo Jack2DIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL}, + {0x12, 0xff, 0xff, 0x00, NULL}, + + // DSW1 + {0 , 0xfe, 0 , 4 , "Coin B"}, + {0x11, 0x01, 0x03, 0x03, "4 coins 3 credits"}, + {0x11, 0x01, 0x03, 0x00, "1 coin 1 credit"}, + {0x11, 0x01, 0x03, 0x01, "1 coin 2 credits"}, + {0x11, 0x01, 0x03, 0x02, "1 coin 3 credits"}, + + {0 , 0xfe, 0 , 4 , "Coin A"}, + {0x11, 0x01, 0x0c, 0x08, "3 coins 1 credit"}, + {0x11, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, + {0x11, 0x01, 0x0c, 0x0c, "4 coins 3 credits"}, + {0x11, 0x01, 0x0c, 0x00, "1 coin 1 credits"}, + + {0 , 0xfe, 0 , 2 , "Lives"}, + {0x11, 0x01, 0x10, 0x00, "3"}, + {0x11, 0x01, 0x10, 0x10, "5"}, + + {0 , 0xfe, 0 , 2 , "Bonus Life"}, + {0x11, 0x01, 0x20, 0x00, "Every 10000"}, + {0x11, 0x01, 0x20, 0x20, "10000 ONly"}, + + {0 , 0xfe, 0 , 2 , "Difficulty"}, + {0x11, 0x01, 0x40, 0x00, "Start on Level 1"}, + {0x11, 0x01, 0x40, 0x40, "Start on Level 13"}, + + {0 , 0xfe, 0 , 2 , "Bullets per Bean Collected"}, + {0x11, 0x01, 0x80, 0x00, "1"}, + {0x11, 0x01, 0x80, 0x80, "2"}, + + // DSW2 + {0 , 0xfe, 0 , 2 , "Cabinet"}, + {0x12, 0x01, 0x01, 0x01, "Upright"}, + {0x12, 0x01, 0x01, 0x00, "Cocktail"}, + + {0 , 0xfe, 0 , 2 , "Invulnerability (Cheat)"}, + {0x12, 0x01, 0x40, 0x00, "Off"}, + {0x12, 0x01, 0x40, 0x40, "On"}, + + {0 , 0xfe, 0 , 4 , "255 Lives (Cheat)"}, + {0x12, 0x01, 0x80, 0x00, "Off"}, + {0x12, 0x01, 0x80, 0x80, "On"}, +}; + +STDDIPINFO(Jack2) + +static struct BurnDIPInfo Jack3DIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL}, + {0x12, 0xff, 0xff, 0x00, NULL}, + + // DSW1 + {0 , 0xfe, 0 , 4 , "Coin B"}, + {0x11, 0x01, 0x03, 0x00, "1 coin 1 credit"}, + {0x11, 0x01, 0x03, 0x01, "1 coin 2 credits"}, + {0x11, 0x01, 0x03, 0x02, "1 coin 3 credits"}, + {0x11, 0x01, 0x03, 0x03, "1 coin 5 credits"}, + + {0 , 0xfe, 0 , 4 , "Coin A"}, + {0x11, 0x01, 0x0c, 0x0c, "4 coins 1 credit"}, + {0x11, 0x01, 0x0c, 0x08, "3 coins 1 credit"}, + {0x11, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, + {0x11, 0x01, 0x0c, 0x00, "1 coin 1 credit"}, + + {0 , 0xfe, 0 , 2 , "Lives"}, + {0x11, 0x01, 0x10, 0x00, "3"}, + {0x11, 0x01, 0x10, 0x10, "5"}, + + {0 , 0xfe, 0 , 2 , "Bonus Life"}, + {0x11, 0x01, 0x20, 0x00, "Every 10000"}, + {0x11, 0x01, 0x20, 0x20, "10000 ONly"}, + + {0 , 0xfe, 0 , 2 , "Difficulty"}, + {0x11, 0x01, 0x40, 0x00, "Start on Level 1"}, + {0x11, 0x01, 0x40, 0x40, "Start on Level 13"}, + + {0 , 0xfe, 0 , 2 , "Bullets per Bean Collected"}, + {0x11, 0x01, 0x80, 0x00, "1"}, + {0x11, 0x01, 0x80, 0x80, "2"}, + + // DSW2 + {0 , 0xfe, 0 , 2 , "Cabinet"}, + {0x12, 0x01, 0x01, 0x01, "Upright"}, + {0x12, 0x01, 0x01, 0x00, "Cocktail"}, + + {0 , 0xfe, 0 , 2 , "Invulnerability (Cheat)"}, + {0x12, 0x01, 0x40, 0x00, "Off"}, + {0x12, 0x01, 0x40, 0x40, "On"}, + + {0 , 0xfe, 0 , 4 , "255 Lives (Cheat)"}, + {0x12, 0x01, 0x80, 0x00, "Off"}, + {0x12, 0x01, 0x80, 0x80, "On"}, +}; + +STDDIPINFO(Jack3) + +static struct BurnDIPInfo TreahuntDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL}, + {0x12, 0xff, 0xff, 0x00, NULL}, + + // DSW1 + {0 , 0xfe, 0 , 4 , "Coin B"}, + {0x11, 0x01, 0x03, 0x01, "2 coins 1 credit"}, + {0x11, 0x01, 0x03, 0x03, "4 coins 3 credits"}, + {0x11, 0x01, 0x03, 0x00, "1 coin 1 credit"}, + {0x11, 0x01, 0x03, 0x02, "1 coin 3 credits"}, + + {0 , 0xfe, 0 , 4 , "Coin A"}, + {0x11, 0x01, 0x0c, 0x08, "3 coins 1 credit"}, + {0x11, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, + {0x11, 0x01, 0x0c, 0x0c, "4 coins 3 credits"}, + {0x11, 0x01, 0x0c, 0x00, "1 coin 1 credit"}, + + {0 , 0xfe, 0 , 2 , "Lives"}, + {0x11, 0x01, 0x10, 0x00, "3"}, + {0x11, 0x01, 0x10, 0x10, "5"}, + + {0 , 0xfe, 0 , 2 , "Bonus Life"}, + {0x11, 0x01, 0x20, 0x00, "Every 10000"}, + {0x11, 0x01, 0x20, 0x20, "10000 ONly"}, + + {0 , 0xfe, 0 , 2 , "Difficulty"}, + {0x11, 0x01, 0x40, 0x00, "Start on Level 1"}, + {0x11, 0x01, 0x40, 0x40, "Start on Level 6"}, + + {0 , 0xfe, 0 , 2 , "Bullets per Bean Collected"}, + {0x11, 0x01, 0x80, 0x00, "5"}, + {0x11, 0x01, 0x80, 0x80, "20"}, + + // DSW2 + {0 , 0xfe, 0 , 2 , "Cabinet"}, + {0x12, 0x01, 0x01, 0x01, "Upright"}, + {0x12, 0x01, 0x01, 0x00, "Cocktail"}, + + {0 , 0xfe, 0 , 2 , "Invulnerability (Cheat)"}, + {0x12, 0x01, 0x40, 0x00, "Off"}, + {0x12, 0x01, 0x40, 0x40, "On"}, + + {0 , 0xfe, 0 , 4 , "255 Lives (Cheat)"}, + {0x12, 0x01, 0x80, 0x00, "Off"}, + {0x12, 0x01, 0x80, 0x80, "On"}, +}; + +STDDIPINFO(Treahunt) + + +static struct BurnDIPInfo ZzyzzyxxDIPList[]= +{ + // Default Values + {0x0A, 0xff, 0xff, 0x00, NULL}, + {0x0B, 0xff, 0xff, 0x00, NULL}, + + // DSW1 + {0 , 0xfe, 0 , 4 , "Coinage"}, + {0x0A, 0x01, 0x03, 0x01, "2 coins 1 credit"}, + {0x0A, 0x01, 0x03, 0x03, "4 coins 3 credits"}, + {0x0A, 0x01, 0x03, 0x00, "1 coin 1 credit"}, + {0x0A, 0x01, 0x03, 0x02, "1 coin 3 credits"}, + + {0 , 0xfe, 0 , 2 , "Lives"}, + {0x0A, 0x01, 0x04, 0x00, "3"}, + {0x0A, 0x01, 0x04, 0x04, "2"}, + + {0 , 0xfe, 0 , 2 , "Credits on Reset"}, + {0x0A, 0x01, 0x08, 0x00, "Off"}, + {0x0A, 0x01, 0x08, 0x08, "On"}, + + {0 , 0xfe, 0 , 2 , "Demo Sounds"}, + {0x0A, 0x01, 0x10, 0x10, "Off"}, + {0x0A, 0x01, 0x10, 0x00, "On"}, + + {0 , 0xfe, 0 , 2 , "Cabinet"}, + {0x0A, 0x01, 0x20, 0x20, "Upright"}, + {0x0A, 0x01, 0x20, 0x00, "Cocktail"}, + + {0 , 0xfe, 0 , 2 , "Free Play"}, + {0x0A, 0x01, 0x80, 0x00, "Off"}, + {0x0A, 0x01, 0x80, 0x80, "On"}, + + // DSW2 + {0 , 0xfe, 0 , 2 , "Bonus Life"}, + {0x0B, 0x01, 0x03, 0x02, "None"}, + {0x0B, 0x01, 0x03, 0x00, "10000 50000"}, + {0x0B, 0x01, 0x03, 0x01, "25000 100000"}, + {0x0B, 0x01, 0x03, 0x03, "100000 300000"}, + + {0 , 0xfe, 0 , 2 , "2nd Bonus Given"}, + {0x0B, 0x01, 0x04, 0x00, "No"}, + {0x0B, 0x01, 0x04, 0x04, "Yes"}, + + {0 , 0xfe, 0 , 2 , "Starting Laps"}, + {0x0B, 0x01, 0x08, 0x00, "2"}, + {0x0B, 0x01, 0x08, 0x08, "3"}, + + {0 , 0xfe, 0 , 2 , "Difficulty of Pleasing Lola"}, + {0x0B, 0x01, 0x10, 0x00, "Easy"}, + {0x0B, 0x01, 0x10, 0x10, "Hard"}, + + {0 , 0xfe, 0 , 2 , "Show Intermissions"}, + {0x0B, 0x01, 0x20, 0x00, "No"}, + {0x0B, 0x01, 0x20, 0x20, "Yes"}, + + {0 , 0xfe, 0 , 3 , "Show Intermissions"}, + {0x0B, 0x01, 0xc0, 0x00, "3 under 4000 pts"}, + {0x0B, 0x01, 0xc0, 0x80, "5 under 4000 pts"}, + {0x0B, 0x01, 0xc0, 0x40, "None"}, +}; + +STDDIPINFO(Zzyzzyxx) + +static struct BurnDIPInfo FreezeDIPList[]= +{ + // Default Values + {0x08, 0xff, 0xff, 0x00, NULL}, + + // DSW1 + {0 , 0xfe, 0 , 2 , "Flip Screen"}, + {0x08, 0x01, 0x01, 0x00, "Off"}, + {0x08, 0x01, 0x01, 0x01, "On"}, + + {0 , 0xfe, 0 , 2 , "Difficulty"}, + {0x08, 0x01, 0x04, 0x00, "Easy"}, + {0x08, 0x01, 0x04, 0x04, "Hard"}, + + {0 , 0xfe, 0 , 2 , "Lives"}, + {0x08, 0x01, 0x08, 0x00, "3"}, + {0x08, 0x01, 0x08, 0x08, "5"}, + + {0 , 0xfe, 0 , 4 , "Bonus Life"}, + {0x08, 0x01, 0x30, 0x00, "10000"}, + {0x08, 0x01, 0x30, 0x10, "10000 40000"}, + {0x08, 0x01, 0x30, 0x20, "10000 60000"}, + {0x08, 0x01, 0x30, 0x30, "20000 100000"}, + + {0 , 0xfe, 0 , 4 , "Coinage"}, + {0x08, 0x01, 0xc0, 0x80, "2 Coins 1 Credit"}, + {0x08, 0x01, 0xc0, 0x00, "1 Coin 1 Credit"}, + {0x08, 0x01, 0xc0, 0x40, "1 Coin 2 Credits"}, + {0x08, 0x01, 0xc0, 0xc0, "Free Play"}, +}; + +STDDIPINFO(Freeze) + +static struct BurnDIPInfo SucasinoDIPList[]= +{ + // Default Values + {0x0A, 0xff, 0xff, 0x00, NULL}, + + // DSW1 + {0 , 0xfe, 0 , 4 , "Coinage"}, + {0x0A, 0x01, 0x03, 0x00, "1 Coin 1 Credit"}, + {0x0A, 0x01, 0x03, 0x01, "1 Coin 2 Credits"}, + {0x0A, 0x01, 0x03, 0x02, "1 Coin 3 Credits"}, + {0x0A, 0x01, 0x03, 0x03, "1 Coin 4 Credits"}, + + {0 , 0xfe, 0 , 2 , "Cabinet"}, + {0x0A, 0x01, 0x04, 0x00, "Upright"}, + {0x0A, 0x01, 0x04, 0x04, "Cocktail"}, + + {0 , 0xfe, 0 , 2 , "Flip Screen"}, + {0x0A, 0x01, 0x08, 0x00, "Off"}, + {0x0A, 0x01, 0x08, 0x08, "On"}, +}; + +STDDIPINFO(Sucasino) + +static struct BurnDIPInfo JoinemDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0x00, NULL}, + {0x0e, 0xff, 0xff, 0x00, NULL}, + + // DSW1 + {0 , 0xfe, 0 , 4 , "Coin A"}, + {0x0d, 0x01, 0x03, 0x01, "2 coins 1 credit"}, + {0x0d, 0x01, 0x03, 0x03, "4 coins 3 credits"}, + {0x0d, 0x01, 0x03, 0x00, "1 coin 1 credit"}, + {0x0d, 0x01, 0x03, 0x02, "1 coin 3 credits"}, + + {0 , 0xfe, 0 , 4 , "Coin B"}, + {0x0d, 0x01, 0x0c, 0x08, "3 coins 1 credit"}, + {0x0d, 0x01, 0x0c, 0x04, "2 coins 1 credit"}, + {0x0d, 0x01, 0x0c, 0x0c, "4 coins 3 credits"}, + {0x0d, 0x01, 0x0c, 0x00, "1 coin 1 credit"}, + + {0 , 0xfe, 0 , 2 , "Lives"}, + {0x0d, 0x01, 0x10, 0x00, "2"}, + {0x0d, 0x01, 0x10, 0x10, "5"}, + + // DSW2 + {0 , 0xfe, 0 , 2 , "Cabinet"}, + {0x0e, 0x01, 0x01, 0x01, "Upright"}, + {0x0e, 0x01, 0x01, 0x00, "Cocktail"}, + + {0 , 0xfe, 0 , 2 , "Sound Check"}, + {0x0e, 0x01, 0x20, 0x00, "Off"}, + {0x0e, 0x01, 0x20, 0x20, "On"}, + + {0 , 0xfe, 0 , 2 , "Infinite Lives"}, + {0x0e, 0x01, 0x80, 0x00, "2"}, + {0x0e, 0x01, 0x80, 0x80, "3"}, +}; + +STDDIPINFO(Joinem) + +static struct BurnDIPInfo LoverboyDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x00, NULL}, + + // DSW1 + {0 , 0xfe, 0 , 15 , "Coin A"}, + {0x0f, 0x01, 0x0f, 0x0c, "4 Coins 1 Credit"}, + {0x0f, 0x01, 0x0f, 0x08, "3 Coins 1 Credit"}, + {0x0f, 0x01, 0x0f, 0x0d, "4 Coins 2 Credit"}, + {0x0f, 0x01, 0x0f, 0x04, "2 Coins 1 Credit"}, + {0x0f, 0x01, 0x0f, 0x09, "3 Coins 2 Credit"}, + {0x0f, 0x01, 0x0f, 0x0e, "4 Coins 3 Credit"}, + {0x0f, 0x01, 0x0f, 0x0f, "4 Coins 4 Credit"}, + {0x0f, 0x01, 0x0f, 0x0a, "3 Coins 3 Credit"}, + {0x0f, 0x01, 0x0f, 0x05, "2 Coins 2 Credit"}, + {0x0f, 0x01, 0x0f, 0x00, "1 Coins 1 Credit"}, + {0x0f, 0x01, 0x0f, 0x0b, "3 Coins 4 Credit"}, + {0x0f, 0x01, 0x0f, 0x06, "2 Coins 3 Credit"}, + {0x0f, 0x01, 0x0f, 0x07, "2 Coins 4 Credit"}, + {0x0f, 0x01, 0x0f, 0x01, "1 Coins 2 Credit"}, + {0x0f, 0x01, 0x0f, 0x02, "1 Coins 3 Credit"}, + {0x0f, 0x01, 0x0f, 0x03, "1 Coins 4 Credit"}, + + {0 , 0xfe, 0 , 2 , "Bonus"}, + {0x0f, 0x01, 0x20, 0x00, "20,000"}, + {0x0f, 0x01, 0x20, 0x20, "30,000"}, + + {0 , 0xfe, 0 , 2 , "Lives"}, + {0x0f, 0x01, 0x40, 0x00, "3"}, + {0x0f, 0x01, 0x40, 0x40, "5"}, + + {0 , 0xfe, 0 , 2 , "Cabinet"}, + {0x0f, 0x01, 0x80, 0x80, "Upright"}, + {0x0f, 0x01, 0x80, 0x00, "Cocktail"}, +}; + +STDDIPINFO(Loverboy) + +static struct BurnDIPInfo StrivDIPList[]= +{ + // Default Values + {0x0A, 0xff, 0xff, 0xfd, NULL}, + + // DSW1 + {0 , 0xfe, 0 , 2 , "Monitor"}, + {0x0A, 0x01, 0x02, 0x02, "Horizontal"}, + {0x0A, 0x01, 0x02, 0x00, "Vertical"}, + + {0 , 0xfe, 0 , 8 , "Gaming Option Number"}, + {0x0A, 0x01, 0x05, 0x01, "2"}, + {0x0A, 0x01, 0x05, 0x05, "3"}, + {0x0A, 0x01, 0x05, 0x00, "4"}, + {0x0A, 0x01, 0x05, 0x04, "5"}, + {0x0A, 0x01, 0x05, 0x01, "4"}, + {0x0A, 0x01, 0x05, 0x05, "5"}, + {0x0A, 0x01, 0x05, 0x00, "6"}, + {0x0A, 0x01, 0x05, 0x04, "7"}, + + {0 , 0xfe, 0 , 2 , "Cabinet"}, + {0x0A, 0x01, 0x08, 0x08, "Upright"}, + {0x0A, 0x01, 0x08, 0x00, "Cocktail"}, + + {0 , 0xfe, 0 , 2 , "Coinage"}, + {0x0A, 0x01, 0x10, 0x00, "2 Coins 1 Credit"}, + {0x0A, 0x01, 0x10, 0x10, "1 Coin 1 Credit"}, + + {0 , 0xfe, 0 , 2 , "Gaming Options"}, + {0x0A, 0x01, 0x20, 0x20, "Number of Wrong Answer"}, + {0x0A, 0x01, 0x20, 0x00, "Number of Questions"}, + + {0 , 0xfe, 0 , 2 , "Show Correct Answer"}, + {0x0A, 0x01, 0x40, 0x00, "No"}, + {0x0A, 0x01, 0x40, 0x40, "Yes"}, +}; + +STDDIPINFO(Striv) + +static UINT8 timer_r(UINT32) +{ + return ZetTotalCycles() / timer_rate; +} + +static UINT8 soundlatch_r(UINT32) +{ + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return soundlatch; +} + +static UINT8 __fastcall striv_question_r(UINT16 offset) +{ + if((offset & 0xc00) == 0x800) + { + remap_address[offset & 0x0f] = (offset & 0xf0) >> 4; + } + else if((offset & 0xc00) == 0xc00) + { + question_rom = offset & 7; + question_address = (offset & 0xf8) << 7; + } + else + { + UINT8 *ROM = User; + INT32 real_address; + + real_address = question_address | (offset & 0x3f0) | remap_address[offset & 0x0f]; + + if(offset & 0x400) + real_address |= 0x8000 * (question_rom + 8); + else + real_address |= 0x8000 * question_rom; + + return ROM[real_address]; + } + + return 0; +} + +void jack_paletteram_w(UINT16 offset, UINT8 data) +{ + UINT32 *pl = Palette + (offset & 0x1f); + + Rom0[offset] = data; + + DrvCalcPal = 1; + + data ^= 0xff; + + *pl = ((data & 7) << 21) | ((data & 7) << 18) | ((data & 6) << 15); + + data >>= 3; + + *pl |= ((data & 7) << 13) | ((data & 7) << 10) | ((data & 6) << 7); + + data >>= 3; + + *pl |= ((data & 3) << 6) | ((data & 3) << 4) | ((data & 3) << 2) | (data & 3); +} + +UINT8 __fastcall jack_cpu0_read(UINT16 address) +{ + UINT8 ret = 0; + + switch (address) + { + case 0xb500: + return DrvDips[0]; + + case 0xb501: + { + ret = DrvDips[1]; + if (joinem && DrvJoy2[7] && !joinem_snd_bit) ret |= 0x20; + + return ret; + } + + case 0xb502: + { + for (INT32 i = 0; i < 8; i++) ret |= DrvJoy1[i] << i; + + return ret; + } + + case 0xb503: + { + for (INT32 i = 0; i < 8; i++) ret |= DrvJoy2[i] << i; + + return ret; + } + + case 0xb504: + { + for (INT32 i = 0; i < 8; i++) ret |= DrvJoy3[i] << i; + if (joinem || loverb) ret |= 0x40; + + return ret; + } + + case 0xb505: + { + for (INT32 i = 0; i < 8; i++) ret |= DrvJoy4[i] << i; + + return ret; + } + + case 0xb506: + case 0xb507: + flip_screen = (address & 1) ^ suprtriv; + return 0; + } + + if (suprtriv && address >= 0xc000 && address <= 0xcfff) { + return striv_question_r(address & 0x0fff); + } + + return 0; +} + +void __fastcall jack_cpu0_write(UINT16 address, UINT8 data) +{ + if (address >= 0xb600 && address <= 0xb61f) + { + jack_paletteram_w(address, data); + return; + } + + switch (address) + { + case 0xb400: + soundlatch = data; + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(0); + break; + + case 0xb506: + flip_screen = 1; + break; + + case 0xb700: + flip_screen = data >> 7; + joinem_snd_bit = data & 1; + break; + } +} + +UINT8 __fastcall jack_in_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x40: + return AY8910Read(0); + } + + return 0; +} + +void __fastcall jack_out_port(UINT16 address, UINT8 data) +{ + switch (address & 0xff) + { + case 0x40: + AY8910Write(0, 1, data); + return; + + case 0x80: + AY8910Write(0, 0, data); + return; + } +} + +void __fastcall jack_cpu1_write() +{ +} + + +static INT32 DrvDoReset() +{ + flip_screen = 0; + DrvReset = 0; + soundlatch = 0; + + if (loverb || joinem) { + memset (Rom0 + 0x8000, 0, 0x1000); + } else { + memset ((UINT8*)Palette, 0, 0x400); + memset (Rom0 + 0x4000, 0, 0x1000); + } + + memset (Rom0 + 0xb000, 0, 0x1000); + memset (Rom1 + 0x4000, 0, 0x0400); + memset ((UINT8*)remap_address, 0, 0x40); + + question_address = question_rom = 0; + joinem_snd_bit = 0; + soundlatch = 0; + + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + AY8910Reset(0); + + return 0; +} + +static INT32 GetRoms() +{ + char* pRomName; + struct BurnRomInfo ri; + UINT8 *Load0 = Rom0; + UINT8 *Load1 = Rom1; + UINT8 *Loadg = Gfx; + UINT8 *Loadt = User; + INT32 gCount = 0; + + if (!joinem && !loverb) Loadg += 0x2000; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & 7) == 1) { + if (ri.nLen == 0x2000) + { + if (BurnLoadRom(Load0, i, 1)) return 1; + Load0 += ri.nLen; + } + else + { + if (BurnLoadRom(Load0, i, 1)) return 1; + Load0 += ri.nLen; + + if (tri_fix && i == 0) { + Load0 += 0x1000; + } + + if (i == (3 - tri_fix)) Load0 += 0x8000; + } + + continue; + } + + if ((ri.nType & 7) == 2) { + if (BurnLoadRom(Load1, i, 1)) return 1; + Load1 += ri.nLen; + + continue; + } + + if ((ri.nType & 7) == 3) { + if (BurnLoadRom(Loadg, i, 1)) return 1; + Loadg += ri.nLen; + if (joinem) Loadg += 0x1000; + gCount++; + + continue; + } + + if ((ri.nType & 7) == 4) { + if (BurnLoadRom(Prom + 0x000, i + 0, 1)) return 1; + if (BurnLoadRom(Prom + 0x200, i + 1, 1)) return 1; + i++; + + // Roms are nibbles, (1/2 byte), #0 is low, #1 is high + for (INT32 j = 0; j < 0x200; j++) { + Prom[j] = Prom[j] | (Prom[j + 0x200] << 4); + } + + continue; + } + + if ((ri.nType & 7) == 5) { + if (BurnLoadRom(Loadt, i, 1)) return 1; + Loadt += ri.nLen; + + continue; + } + } + + // sucasino, tripool, tripoola + if (gCount == 2) { + memcpy (Gfx + 0x4000, Gfx + 0x3000, 0x1000); + memset (Gfx + 0x3000, 0, 0x1000); + } + + return 0; +} + +static void gfx_decode() +{ + UINT8* tmp = (UINT8*)BurnMalloc( 0x2000 * 3 ); + if (!tmp) return; + + memcpy (tmp, Gfx, 0x6000); + + static INT32 Planes[3] = { 0, 1024*8*8, 1024*8*8*2 }; + static INT32 YOffs[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + static INT32 XOffs[8] = { 56, 48, 40, 32, 24, 16, 8, 0 }; + + GfxDecode(1024, 3, 8, 8, Planes, XOffs, YOffs, 64, tmp, Gfx); + + BurnFree (tmp); +} + +static INT32 DrvInit() +{ + Mem = (UINT8 *)BurnMalloc (0x100000); + if (Mem == NULL) { + return 1; + } + + pFMBuffer = (INT16 *)malloc (nBurnSoundLen * 3 * sizeof(INT16)); + if (pFMBuffer == NULL) { + return 1; + } + + Rom0 = Mem + 0x00000; + Rom1 = Mem + 0x10000; + Gfx = Mem + 0x20000; + User = Mem + 0x30000; + Prom = Mem + 0xb0000; + Palette = (UINT32*)(Mem + 0xc0000); + DrvPal = (UINT32*)(Mem + 0xc1000); + + GetRoms(); + + gfx_decode(); + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(jack_cpu0_read); + ZetSetWriteHandler(jack_cpu0_write); + + if (joinem || loverb) + { + ZetMapArea(0x0000, 0x8fff, 0, Rom0 + 0x0000); + ZetMapArea(0x0000, 0x8fff, 2, Rom0 + 0x0000); + + ZetMapArea(0x8000, 0x8fff, 1, Rom0 + 0x8000); + + ZetMapArea(0xb500, 0xb5ff, 0, Rom0 + 0xb500); // controls hack + } else { + ZetMapArea(0x0000, 0x3fff, 0, Rom0 + 0x0000); + ZetMapArea(0x0000, 0x3fff, 2, Rom0 + 0x0000); + + ZetMapArea(0x4000, 0x5fff, 0, Rom0 + 0x4000); + ZetMapArea(0x4000, 0x5fff, 1, Rom0 + 0x4000); + ZetMapArea(0x4000, 0x5fff, 2, Rom0 + 0x4000); + } + + ZetMapArea(0xb000, 0xb0ff, 0, Rom0 + 0xb000); + ZetMapArea(0xb000, 0xb0ff, 1, Rom0 + 0xb000); + + ZetMapArea(0xb800, 0xbbff, 0, Rom0 + 0xb800); + ZetMapArea(0xb800, 0xbbff, 1, Rom0 + 0xb800); + + ZetMapArea(0xbc00, 0xbfff, 0, Rom0 + 0xbc00); + ZetMapArea(0xbc00, 0xbfff, 1, Rom0 + 0xbc00); + + if (suprtriv) + { + ZetMapArea(0xd000, 0xffff, 0, Rom0 + 0xc000); + ZetMapArea(0xd000, 0xffff, 2, Rom0 + 0xc000); + } else { + ZetMapArea(0xc000, 0xffff, 0, Rom0 + 0xc000); + ZetMapArea(0xc000, 0xffff, 2, Rom0 + 0xc000); + } + + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetInHandler(jack_in_port); + ZetSetOutHandler(jack_out_port); + ZetMapArea(0x0000, 0x1fff, 0, Rom1 + 0x0000); + ZetMapArea(0x0000, 0x1fff, 2, Rom1 + 0x0000); + ZetMapArea(0x4000, 0x43ff, 0, Rom1 + 0x4000); + ZetMapArea(0x4000, 0x43ff, 1, Rom1 + 0x4000); + ZetMapArea(0x4000, 0x43ff, 2, Rom1 + 0x4000); + ZetClose(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + + AY8910Init(0, 1500000, nBurnSoundRate, &soundlatch_r, &timer_r, NULL, NULL); + AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + AY8910Exit(0); + GenericTilesExit(); + + BurnFree (pFMBuffer); + BurnFree (Mem); + + DrvPal = Palette = NULL; + pFMBuffer = NULL; + Mem = Rom0 = Rom1 = Gfx = User = NULL; + pAY8910Buffer[0] = pAY8910Buffer[1] = pAY8910Buffer[2] = NULL; + + tri_fix = 0; + joinem = 0; + loverb = 0; + suprtriv = 0; + + return 0; +} + + +static INT32 DrvDraw() +{ + if (DrvCalcPal) + { + for (INT32 i = 0; i < 0x100; i++) { + UINT32 col = Palette[i]; + DrvPal[i] = BurnHighCol(col >> 16, col >> 8, col, 0); + } + DrvCalcPal = 0; + } + + UINT8 *sram = Rom0 + 0xb000; // sprite ram + UINT8 *vram = Rom0 + 0xb800; // video ram + UINT8 *cram = Rom0 + 0xbc00; // color ram + INT32 offs, sx, sy, num, color, flipx, flipy; + + for (offs = 0; offs < 0x400; offs++) + { + sx = (offs & 0x1f) << 3; + sy = (offs >> 2) & 0xf8; + + if (joinem || loverb) { + num = vram[offs] + ((cram[offs] & 0x03) << 8); + color = (cram[offs] & 0x38) >> 2; + } else { + num = vram[offs] + ((cram[offs] & 0x18) << 5); + color = (cram[offs] & 0x07); + } + + if (flip_screen) { + Render8x8Tile_FlipXY_Clip(pTransDraw, num, sx ^ 0xf8, sy ^ 0xf8, color, 2, 0, Gfx); + } else { + sx -= 16; + Render8x8Tile_Clip(pTransDraw, num, sx, sy, color, 2, 0, Gfx); + } + } + + for (offs = 0; offs < 0x80; offs += 4) + { + sx = 248 - sram[offs]; + sy = sram[offs + 1]; + + if (joinem || loverb) { + num = sram[offs + 2] + ((sram[offs + 3] & 0x01) << 8); + color = (sram[offs + 3] & 0x38) >> 2; + } else { + num = sram[offs + 2] + ((sram[offs + 3] & 0x08) << 5); + color = (sram[offs + 3] & 0x07); + } + + flipx = sram[offs + 3] & 0x40; + flipy = sram[offs + 3] & 0x80; + + if (flip_screen) { + flipx = !flipx; + flipy = !flipy; + sx = 248 - sx; + sy = 248 - sy; + } + + sx -= 16; + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, num, sx, sy, color, 2, 0, 0, Gfx); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, num, sx, sy, color, 2, 0, 0, Gfx); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, num, sx, sy, color, 2, 0, 0, Gfx); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, num, sx, sy, color, 2, 0, 0, Gfx); + } + } + } + + BurnTransferCopy(DrvPal); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + if (joinem || loverb) { + for (INT32 i = 0; i < 6; i++) + Rom0[0xb500 + i] = jack_cpu0_read(0xb500 + i); + } + + INT32 nInterleave = 1000; + INT32 nSoundBufferPos = 0; + + nCyclesTotal[0] = 3000000 / 60; + nCyclesTotal[1] = 1500000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #0 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + + if (joinem) + if (i == (nInterleave / 3) || i == ((nInterleave / 3) * 2)) + ZetRaiseIrq(0); + + if (tri_fix && i == (nInterleave / 2)) ZetRaiseIrq(0); + + if (i == (nInterleave - 1)) + { + if (joinem) { // joinem + if (!DrvJoy3[7]) ZetNmi(); + } else if (loverb) { // loverboy + ZetNmi(); + + } else { // other + ZetRaiseIrq(0); + } + } + + ZetClose(); + + // Run Z80 #1 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + // Render Sound Segment + if (pBurnSoundOut && !suprtriv) { // disable sound for suprtriv + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut && !suprtriv) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + +//------------------------------------------------------------------------------------- +// Save states + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + if (joinem || loverb) { + ba.Data = Rom0 + 0x8000; + } else { + ba.Data = Rom0 + 0x4000; + } + ba.nLen = 0x01000; + ba.szName = "Main Ram"; + BurnAcb(&ba); + + memset(&ba, 0, sizeof(ba)); + ba.Data = Rom0 + 0xb000; + ba.nLen = 0x01000; + ba.szName = "Video Ram"; + BurnAcb(&ba); + + memset(&ba, 0, sizeof(ba)); + ba.Data = (UINT8*)Palette; + ba.nLen = 0x00400; + ba.szName = "Palette"; + BurnAcb(&ba); + + memset(&ba, 0, sizeof(ba)); + ba.Data = (UINT8*)remap_address; + ba.nLen = 0x00040; + ba.szName = "striv question addresses"; + BurnAcb(&ba); + + ZetScan(nAction); + AY8910Scan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(question_address); + SCAN_VAR(question_rom); + SCAN_VAR(soundlatch); + SCAN_VAR(joinem_snd_bit); + } + + return 0; +} + + +// Jack the Giantkiller (set 1) + +static struct BurnRomInfo jackRomDesc[] = { + { "j8", 0x1000, 0xc8e73998, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "jgk.j6", 0x1000, 0x36d7810e, 1 | BRF_PRG | BRF_ESS }, // 1 + { "jgk.j7", 0x1000, 0xb15ff3ee, 1 | BRF_PRG | BRF_ESS }, // 2 + { "jgk.j5", 0x1000, 0x4a63d242, 1 | BRF_PRG | BRF_ESS }, // 3 + { "jgk.j3", 0x1000, 0x605514a8, 1 | BRF_PRG | BRF_ESS }, // 4 + { "jgk.j4", 0x1000, 0xbce489b7, 1 | BRF_PRG | BRF_ESS }, // 5 + { "jgk.j2", 0x1000, 0xdb21bd55, 1 | BRF_PRG | BRF_ESS }, // 6 + { "jgk.j1", 0x1000, 0x49fffe31, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "jgk.j9", 0x1000, 0xc2dc1e00, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code + + { "jgk.j12", 0x1000, 0xce726df0, 3 | BRF_GRA }, // 9 Graphics + { "jgk.j13", 0x1000, 0x6aec2c8d, 3 | BRF_GRA }, // 10 + { "jgk.j11", 0x1000, 0xfd14c525, 3 | BRF_GRA }, // 11 + { "jgk.j10", 0x1000, 0xeab890b2, 3 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(jack) +STD_ROM_FN(jack) + +static INT32 jackInit() +{ + timer_rate = 128; + + return DrvInit(); +} + +struct BurnDriver BurnDrvjack = { + "jack", NULL, NULL, NULL, "1982", + "Jack the Giantkiller (set 1)\0", NULL, "Cinematronics", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, jackRomInfo, jackRomName, NULL, NULL, JackInputInfo, JackDIPInfo, + jackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Jack the Giantkiller (set 2) + +static struct BurnRomInfo jack2RomDesc[] = { + { "jgk.j8", 0x1000, 0xfe229e20, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "jgk.j6", 0x1000, 0x36d7810e, 1 | BRF_PRG | BRF_ESS }, // 1 + { "jgk.j7", 0x1000, 0xb15ff3ee, 1 | BRF_PRG | BRF_ESS }, // 2 + { "jgk.j5", 0x1000, 0x4a63d242, 1 | BRF_PRG | BRF_ESS }, // 3 + { "jgk.j3", 0x1000, 0x605514a8, 1 | BRF_PRG | BRF_ESS }, // 4 + { "jgk.j4", 0x1000, 0xbce489b7, 1 | BRF_PRG | BRF_ESS }, // 5 + { "jgk.j2", 0x1000, 0xdb21bd55, 1 | BRF_PRG | BRF_ESS }, // 6 + { "jgk.j1", 0x1000, 0x49fffe31, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "jgk.j9", 0x1000, 0xc2dc1e00, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code + + { "jgk.j12", 0x1000, 0xce726df0, 3 | BRF_GRA }, // 9 Graphics + { "jgk.j13", 0x1000, 0x6aec2c8d, 3 | BRF_GRA }, // 10 + { "jgk.j11", 0x1000, 0xfd14c525, 3 | BRF_GRA }, // 11 + { "jgk.j10", 0x1000, 0xeab890b2, 3 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(jack2) +STD_ROM_FN(jack2) + +struct BurnDriver BurnDrvjack2 = { + "jack2", "jack", NULL, NULL, "1982", + "Jack the Giantkiller (set 2)\0", NULL, "Cinematronics", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, jack2RomInfo, jack2RomName, NULL, NULL, JackInputInfo, Jack2DIPInfo, + jackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Jack the Giantkiller (set 3) + +static struct BurnRomInfo jack3RomDesc[] = { + { "jack8", 0x1000, 0x632151d2, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "jack6", 0x1000, 0xf94f80d9, 1 | BRF_PRG | BRF_ESS }, // 1 + { "jack7", 0x1000, 0xc830ff1e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "jack5", 0x1000, 0x8dea17e7, 1 | BRF_PRG | BRF_ESS }, // 3 + { "jgk.j3", 0x1000, 0x605514a8, 1 | BRF_PRG | BRF_ESS }, // 4 // bank 2 + { "jgk.j4", 0x1000, 0xbce489b7, 1 | BRF_PRG | BRF_ESS }, // 5 + { "jgk.j2", 0x1000, 0xdb21bd55, 1 | BRF_PRG | BRF_ESS }, // 6 + { "jack1", 0x1000, 0x7e75ea3d, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "jgk.j9", 0x1000, 0xc2dc1e00, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code + + { "jack12", 0x1000, 0x80320647, 3 | BRF_GRA }, // 9 Graphics + { "jgk.j13", 0x1000, 0x6aec2c8d, 3 | BRF_GRA }, // 10 + { "jgk.j11", 0x1000, 0xfd14c525, 3 | BRF_GRA }, // 11 + { "jgk.j10", 0x1000, 0xeab890b2, 3 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(jack3) +STD_ROM_FN(jack3) + +struct BurnDriver BurnDrvjack3 = { + "jack3", "jack", NULL, NULL, "1982", + "Jack the Giantkiller (set 3)\0", NULL, "Cinematronics", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, jack3RomInfo, jack3RomName, NULL, NULL, JackInputInfo, Jack3DIPInfo, + jackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Treasure Hunt (bootleg?) + +static struct BurnRomInfo treahuntRomDesc[] = { + { "thunt-1.f2", 0x1000, 0x0b35858c, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "thunt-2.f3", 0x1000, 0x67305a51, 1 | BRF_PRG | BRF_ESS }, // 1 + { "thunt-3.4f", 0x1000, 0xd7a969c3, 1 | BRF_PRG | BRF_ESS }, // 2 + { "thunt-4.6f", 0x1000, 0x2483f14d, 1 | BRF_PRG | BRF_ESS }, // 3 + { "thunt-5.7f", 0x1000, 0xc69d5e21, 1 | BRF_PRG | BRF_ESS }, // 4 + { "thunt-6.7e", 0x1000, 0x11bf3d49, 1 | BRF_PRG | BRF_ESS }, // 5 + { "thunt-7.6e", 0x1000, 0x7c2d6279, 1 | BRF_PRG | BRF_ESS }, // 6 + { "thunt-8.4e", 0x1000, 0xf73b86fb, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "jgk.j9", 0x1000, 0xc2dc1e00, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code + + { "thunt-13.a4", 0x1000, 0xe03f1f09, 3 | BRF_GRA }, // 9 Graphics + { "thunt-12.a3", 0x1000, 0xda4ee9eb, 3 | BRF_GRA }, // 10 + { "thunt-10.a1", 0x1000, 0x51ec7934, 3 | BRF_GRA }, // 11 + { "thunt-11.a2", 0x1000, 0xf9781143, 3 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(treahunt) +STD_ROM_FN(treahunt) + +static void treahunt_decode() +{ + for (INT32 i = 0; i < 0x4000; i++) + { + if (i & 0x1000) + { + User[i] = BITSWAP08(Rom0[i], 0, 2, 5, 1, 3, 6, 4, 7); + + if (~i & 0x04) User[i] ^= 0x81; + } + else + { + User[i] = BITSWAP08(Rom0[i], 7, 2, 5, 1, 3, 6, 4, 0) ^ 0x81; + } + } + + ZetOpen(0); + ZetMapArea(0x0000, 0x3fff, 2, User, Rom0); + ZetClose(); +} + +static INT32 treahuntInit() +{ + timer_rate = 128; + + INT32 nRet = DrvInit(); + + treahunt_decode(); + + return nRet; +} + +struct BurnDriver BurnDrvtreahunt = { + "treahunt", "jack", NULL, NULL, "1982", + "Treasure Hunt (bootleg?)\0", NULL, "Hara Industries", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, treahuntRomInfo, treahuntRomName, NULL, NULL, JackInputInfo, TreahuntDIPInfo, + treahuntInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Zzyzzyxx (set 1) + +static struct BurnRomInfo zzyzzyxxRomDesc[] = { + { "a.2f", 0x1000, 0xa9102e34, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "zzyzzyxx.b", 0x1000, 0xefa9d4c6, 1 | BRF_PRG | BRF_ESS }, // 1 + { "zzyzzyxx.c", 0x1000, 0xb0a365b1, 1 | BRF_PRG | BRF_ESS }, // 2 + { "zzyzzyxx.d", 0x1000, 0x5ed6dd9a, 1 | BRF_PRG | BRF_ESS }, // 3 + { "zzyzzyxx.e", 0x1000, 0x5966fdbf, 1 | BRF_PRG | BRF_ESS }, // 4 + { "f.7e", 0x1000, 0x12f24c68, 1 | BRF_PRG | BRF_ESS }, // 5 + { "g.6e", 0x1000, 0x408f2326, 1 | BRF_PRG | BRF_ESS }, // 6 + { "h.4e", 0x1000, 0xf8bbabe0, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "i.5a", 0x1000, 0xc7742460, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code + { "j.6a", 0x1000, 0x72166ccd, 2 | BRF_PRG | BRF_ESS }, // 9 + + { "n.1c", 0x1000, 0x4f64538d, 3 | BRF_GRA }, // 10 Graphics + { "m.1d", 0x1000, 0x217b1402, 3 | BRF_GRA }, // 11 + { "k.1b", 0x1000, 0xb8b2b8cc, 3 | BRF_GRA }, // 12 + { "l.1a", 0x1000, 0xab421a83, 3 | BRF_GRA }, // 13 +}; + +STD_ROM_PICK(zzyzzyxx) +STD_ROM_FN(zzyzzyxx) + +static INT32 zzyzzyxxInit() +{ + timer_rate = 16; + + return DrvInit(); +} + +struct BurnDriver BurnDrvzzyzzyxx = { + "zzyzzyxx", NULL, NULL, NULL, "1982", + "Zzyzzyxx (set 1)\0", NULL, "Cinematronics + Advanced Microcomputer Systems", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, zzyzzyxxRomInfo, zzyzzyxxRomName, NULL, NULL, ZzyzzyxxInputInfo, ZzyzzyxxDIPInfo, + zzyzzyxxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Zzyzzyxx (set 2) + +static struct BurnRomInfo zzyzzyx2RomDesc[] = { + { "a.2f", 0x1000, 0xa9102e34, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b.3f", 0x1000, 0x4277beab, 1 | BRF_PRG | BRF_ESS }, // 1 + { "c.4f", 0x1000, 0x72ac99e1, 1 | BRF_PRG | BRF_ESS }, // 2 + { "d.6f", 0x1000, 0x7c7eec2b, 1 | BRF_PRG | BRF_ESS }, // 3 + { "e.7f", 0x1000, 0xcffc4a68, 1 | BRF_PRG | BRF_ESS }, // 4 + { "f.7e", 0x1000, 0x12f24c68, 1 | BRF_PRG | BRF_ESS }, // 5 + { "g.6e", 0x1000, 0x408f2326, 1 | BRF_PRG | BRF_ESS }, // 6 + { "h.4e", 0x1000, 0xf8bbabe0, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "i.5a", 0x1000, 0xc7742460, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code + { "j.6a", 0x1000, 0x72166ccd, 2 | BRF_PRG | BRF_ESS }, // 9 + + { "n.1c", 0x1000, 0x4f64538d, 3 | BRF_GRA }, // 10 Graphics + { "m.1d", 0x1000, 0x217b1402, 3 | BRF_GRA }, // 11 + { "k.1b", 0x1000, 0xb8b2b8cc, 3 | BRF_GRA }, // 12 + { "l.1a", 0x1000, 0xab421a83, 3 | BRF_GRA }, // 13 +}; + +STD_ROM_PICK(zzyzzyx2) +STD_ROM_FN(zzyzzyx2) + +struct BurnDriver BurnDrvzzyzzyx2 = { + "zzyzzyxx2", "zzyzzyxx", NULL, NULL, "1982", + "Zzyzzyxx (set 2)\0", NULL, "Cinematronics + Advanced Microcomputer Systems", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, zzyzzyx2RomInfo, zzyzzyx2RomName, NULL, NULL, ZzyzzyxxInputInfo, ZzyzzyxxDIPInfo, + zzyzzyxxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Brix + +static struct BurnRomInfo brixRomDesc[] = { + { "a", 0x1000, 0x050e0d70, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b", 0x1000, 0x668118ae, 1 | BRF_PRG | BRF_ESS }, // 1 + { "c", 0x1000, 0xff5ed6cf, 1 | BRF_PRG | BRF_ESS }, // 2 + { "d", 0x1000, 0xc3ae45a9, 1 | BRF_PRG | BRF_ESS }, // 3 + { "e", 0x1000, 0xdef99fa9, 1 | BRF_PRG | BRF_ESS }, // 4 + { "f", 0x1000, 0xdde717ed, 1 | BRF_PRG | BRF_ESS }, // 5 + { "g", 0x1000, 0xadca02d8, 1 | BRF_PRG | BRF_ESS }, // 6 + { "h", 0x1000, 0xbc3b878c, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "i.5a", 0x1000, 0xc7742460, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code + { "j.6a", 0x1000, 0x72166ccd, 2 | BRF_PRG | BRF_ESS }, // 9 + + { "n", 0x1000, 0x8064910e, 3 | BRF_GRA }, // 10 Graphics + { "m.1d", 0x1000, 0x217b1402, 3 | BRF_GRA }, // 11 + { "k", 0x1000, 0xc7d7e2a0, 3 | BRF_GRA }, // 12 + { "l.1a", 0x1000, 0xab421a83, 3 | BRF_GRA }, // 13 +}; + +STD_ROM_PICK(brix) +STD_ROM_FN(brix) + +struct BurnDriver BurnDrvbrix = { + "brix", "zzyzzyxx", NULL, NULL, "1982", + "Brix\0", NULL, "Cinematronics + Advanced Microcomputer Systems", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, brixRomInfo, brixRomName, NULL, NULL, ZzyzzyxxInputInfo, ZzyzzyxxDIPInfo, + zzyzzyxxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Freeze + +static struct BurnRomInfo freezeRomDesc[] = { + { "freeze.f2", 0x1000, 0x0a431665, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "freeze.f3", 0x1000, 0x1189b8ad, 1 | BRF_PRG | BRF_ESS }, // 1 + { "freeze.f4", 0x1000, 0x10c4a5ea, 1 | BRF_PRG | BRF_ESS }, // 2 + { "freeze.f5", 0x1000, 0x16024c53, 1 | BRF_PRG | BRF_ESS }, // 3 + { "freeze.f7", 0x1000, 0xea0b0765, 1 | BRF_PRG | BRF_ESS }, // 4 + { "freeze.e7", 0x1000, 0x1155c00b, 1 | BRF_PRG | BRF_ESS }, // 5 + { "freeze.e5", 0x1000, 0x95c18d75, 1 | BRF_PRG | BRF_ESS }, // 6 + { "freeze.e4", 0x1000, 0x7e8f5afc, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "freeze.a1", 0x1000, 0x7771f5b9, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code + + { "freeze.5a", 0x1000, 0x6c8a98a0, 3 | BRF_GRA }, // 9 Graphics + { "freeze.3a", 0x1000, 0x6d2125e4, 3 | BRF_GRA }, // 10 + { "freeze.1a", 0x1000, 0x3a7f2fa9, 3 | BRF_GRA }, // 11 + { "freeze.2a", 0x1000, 0xdd70ddd6, 3 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(freeze) +STD_ROM_FN(freeze) + +struct BurnDriver BurnDrvfreeze = { + "freeze", NULL, NULL, NULL, "1984", + "Freeze\0", NULL, "Cinematronics", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, freezeRomInfo, freezeRomName, NULL, NULL, FreezeInputInfo, FreezeDIPInfo, + jackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Super Casino + +static struct BurnRomInfo sucasinoRomDesc[] = { + { "1", 0x1000, 0xe116e979, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "2", 0x1000, 0x2a2635f5, 1 | BRF_PRG | BRF_ESS }, // 1 + { "3", 0x1000, 0x69864d90, 1 | BRF_PRG | BRF_ESS }, // 2 + { "4", 0x1000, 0x174c9373, 1 | BRF_PRG | BRF_ESS }, // 3 + { "5", 0x1000, 0x115bcb1e, 1 | BRF_PRG | BRF_ESS }, // 4 + { "6", 0x1000, 0x434caa17, 1 | BRF_PRG | BRF_ESS }, // 5 + { "7", 0x1000, 0x67c68b82, 1 | BRF_PRG | BRF_ESS }, // 6 + { "8", 0x1000, 0xf5b63006, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "9", 0x1000, 0x67cf8aec, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 #1 Code + + { "11", 0x1000, 0xf92c4c5b, 3 | BRF_GRA }, // 9 Graphics + { "10", 0x1000, 0x3b0783ce, 3 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(sucasino) +STD_ROM_FN(sucasino) + +struct BurnDriver BurnDrvsucasino = { + "sucasino", NULL, NULL, NULL, "1984", + "Super Casino\0", NULL, "Data Amusement", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_CASINO, 0, + NULL, sucasinoRomInfo, sucasinoRomName, NULL, NULL, SucasinoInputInfo, SucasinoDIPInfo, + jackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Tri-Pool (Casino Tech) + +static struct BurnRomInfo tripoolRomDesc[] = { + { "tri73a.bin", 0x1000, 0x96893aa7, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "tri62a.bin", 0x1000, 0x3299dc65, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tri52b.bin", 0x1000, 0x27ef765e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tri33c.bin", 0x1000, 0xd7ef061d, 1 | BRF_PRG | BRF_ESS }, // 3 + { "tri45c.bin", 0x1000, 0x51b813b1, 1 | BRF_PRG | BRF_ESS }, // 4 + { "tri25d.bin", 0x1000, 0x8e64512d, 1 | BRF_PRG | BRF_ESS }, // 5 + { "tri13d.bin", 0x1000, 0xad268e9b, 1 | BRF_PRG | BRF_ESS }, // 6 + + { "trisnd.bin", 0x1000, 0x945c4b8b, 2 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code + + { "tri105a.bin", 0x1000, 0x366a753c, 3 | BRF_GRA }, // 8 Graphics + { "tri93a.bin", 0x1000, 0x35213782, 3 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(tripool) +STD_ROM_FN(tripool) + +static INT32 tripoolInit() +{ + tri_fix = 1; + timer_rate = 128; + + return DrvInit(); +} + +struct BurnDriver BurnDrvtripool = { + "tripool", NULL, NULL, NULL, "1981", + "Tri-Pool (Casino Tech)\0", NULL, "Noma (Casino Tech license)", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0, + NULL, tripoolRomInfo, tripoolRomName, NULL, NULL, TripoolInputInfo, NULL, + tripoolInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Tri-Pool (Costal Games) + +static struct BurnRomInfo tripoolaRomDesc[] = { + { "tri73a.bin", 0x1000, 0x96893aa7, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "tri62a.bin", 0x1000, 0x3299dc65, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tri52b.bin", 0x1000, 0x27ef765e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tri33c.bin", 0x1000, 0xd7ef061d, 1 | BRF_PRG | BRF_ESS }, // 3 + { "tri45c.bin", 0x1000, 0x51b813b1, 1 | BRF_PRG | BRF_ESS }, // 4 + { "tri25d.bin", 0x1000, 0x8e64512d, 1 | BRF_PRG | BRF_ESS }, // 5 + { "tp1ckt", 0x1000, 0x72ec43a3, 1 | BRF_PRG | BRF_ESS }, // 6 + + { "trisnd.bin", 0x1000, 0x945c4b8b, 2 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code + + { "tri105a.bin", 0x1000, 0x366a753c, 3 | BRF_GRA }, // 8 Graphics + { "tri93a.bin", 0x1000, 0x35213782, 3 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(tripoola) +STD_ROM_FN(tripoola) + +struct BurnDriver BurnDrvtripoola = { + "tripoola", "tripool", NULL, NULL, "1981", + "Tri-Pool (Costal Games)\0", NULL, "Noma (Costal Games license)", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0, + NULL, tripoolaRomInfo, tripoolaRomName, NULL, NULL, TripoolInputInfo, NULL, + tripoolInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + + +// Joinem + +static struct BurnRomInfo joinemRomDesc[] = { + { "join1.r0", 0x2000, 0xb5b2e2cc, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "join2.r2", 0x2000, 0xbcf140e6, 1 | BRF_PRG | BRF_ESS }, // 1 + { "join3.r4", 0x2000, 0xfe04e4d4, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "join7.s0", 0x1000, 0xbb8a7814, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "join4.p3", 0x1000, 0x4964c82c, 3 | BRF_GRA }, // 4 Graphics + { "join5.p2", 0x1000, 0xae78fa89, 3 | BRF_GRA }, // 5 + { "join6.p1", 0x1000, 0x2b533261, 3 | BRF_GRA }, // 6 + + { "l82s129.11n", 0x0100, 0x7b724211, 4 | BRF_GRA }, // 7 Color Proms + { "h82s129.12n", 0x0100, 0x2e81c5ff, 4 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(joinem) +STD_ROM_FN(joinem) + +static void joinem_palette_init() +{ + for (INT32 i = 0; i < 0x100; i++) + { + INT32 bit0,bit1,bit2,r,g,b; + + bit0 = (Prom[i] >> 0) & 1; + bit1 = (Prom[i] >> 1) & 1; + bit2 = (Prom[i] >> 2) & 1; + r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (Prom[i] >> 3) & 1; + bit1 = (Prom[i] >> 4) & 1; + bit2 = (Prom[i] >> 5) & 1; + g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = 0; + bit1 = (Prom[i] >> 6) & 1; + bit2 = (Prom[i] >> 7) & 1; + b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + Palette[i] = (r << 16) | (g << 8) | b; + } +} + +static INT32 joinemInit() +{ + joinem = 1; + timer_rate = 16; + + INT32 nRet = DrvInit(); + + joinem_palette_init(); + + return nRet; +} + +struct BurnDriver BurnDrvjoinem = { + "joinem", NULL, NULL, NULL, "1986", + "Joinem\0", NULL, "Global Corporation", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, joinemRomInfo, joinemRomName, NULL, NULL, JoinemInputInfo, JoinemDIPInfo, + joinemInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 240, 3, 4 +}; + + +// Lover Boy + +static struct BurnRomInfo loverboyRomDesc[] = { + { "lover.r0", 0x2000, 0xffec4e41, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "lover.r2", 0x2000, 0x04052262, 1 | BRF_PRG | BRF_ESS }, // 1 + { "lover.r4", 0x2000, 0xce5f3b49, 1 | BRF_PRG | BRF_ESS }, // 2 + { "lover.r6", 0x1000, 0x839d79b7, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "lover.s0", 0x1000, 0xec38111c, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 #1 Code + + { "lover.p3", 0x2000, 0x1a519c8f, 3 | BRF_GRA }, // 5 Graphics + { "lover.p2", 0x2000, 0xe465372f, 3 | BRF_GRA }, // 6 + { "lover.p1", 0x2000, 0xcda0d87e, 3 | BRF_GRA }, // 7 + + { "color.n11", 0x0200, 0xcf4a16ae, 4 | BRF_GRA }, // 8 Color Proms + { "color.n12", 0x0200, 0x4b11ac21, 4 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(loverboy) +STD_ROM_FN(loverboy) + +static INT32 loverboyInit() +{ + loverb = 1; + timer_rate = 16; + + INT32 nRet = DrvInit(); + + // Hack (Protection?) + Rom0[0x12] = 0x9d; + Rom0[0x13] = 0x01; + + joinem_palette_init(); + + return nRet; +} + +struct BurnDriver BurnDrvloverboy = { + "loverboy", NULL, NULL, NULL, "1983", + "Lover Boy\0", "No sound", "G.T Enterprise Inc", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, loverboyRomInfo, loverboyRomName, NULL, NULL, LoverboyInputInfo, LoverboyDIPInfo, + loverboyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 240, 3, 4 +}; + + +// Super Triv + +static struct BurnRomInfo strivRomDesc[] = { + { "pr1.f2", 0x1000, 0xdcf5da6e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "pr2.4f", 0x1000, 0x921610ba, 1 | BRF_PRG | BRF_ESS }, // 1 + { "pr3.5f", 0x1000, 0xc36f0e21, 1 | BRF_PRG | BRF_ESS }, // 2 + { "pr4.6f", 0x1000, 0x0dc98a97, 1 | BRF_PRG | BRF_ESS }, // 3 + { "bc3.7e", 0x1000, 0x83f03885, 1 | BRF_PRG | BRF_ESS }, // 4 + { "bc2.6e", 0x1000, 0x75f18361, 1 | BRF_PRG | BRF_ESS }, // 5 + { "bc1.5e", 0x1000, 0x0d150385, 1 | BRF_PRG | BRF_ESS }, // 6 + + { "snd.5a", 0x1000, 0xb7ddf84f, 2 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code + + { "chr0.1a", 0x1000, 0x8f60229b, 3 | BRF_GRA }, // 8 Graphics + { "chr2.4a", 0x1000, 0x8f982a9c, 3 | BRF_GRA }, // 9 + { "chr3.5a", 0x1000, 0x8f982a9c, 3 | BRF_GRA }, // 10 + { "chr1.2a", 0x1000, 0x7ad4358e, 3 | BRF_GRA }, // 11 + + { "rom.u6", 0x8000, 0xa32d7a28, 5 | BRF_PRG | BRF_ESS }, // 12 Question ROMs + { "rom.u7", 0x8000, 0xbc44ae18, 5 | BRF_PRG | BRF_ESS }, // 13 + { "tbfd2.u8", 0x8000, 0x9572984a, 5 | BRF_PRG | BRF_ESS }, // 14 + { "tbfd3.u9", 0x8000, 0xd904a2f1, 5 | BRF_PRG | BRF_ESS }, // 15 + { "tbfl0.u10", 0x8000, 0x680264a2, 5 | BRF_PRG | BRF_ESS }, // 16 + { "tbfl1.u11", 0x8000, 0x33e99d00, 5 | BRF_PRG | BRF_ESS }, // 17 + { "tbfl2.u12", 0x8000, 0x2e7a941f, 5 | BRF_PRG | BRF_ESS }, // 18 + { "tbft0.u13", 0x8000, 0x7d2e5e89, 5 | BRF_PRG | BRF_ESS }, // 19 + { "tbft1.u14", 0x8000, 0xd36246cf, 5 | BRF_PRG | BRF_ESS }, // 20 + { "tbfd1.u15", 0x8000, 0x745db398, 5 | BRF_PRG | BRF_ESS }, // 21 + + { "tbfd0.u21", 0x2000, 0x15b83099, 0 | BRF_OPT }, // 22 Junk +}; + +STD_ROM_PICK(striv) +STD_ROM_FN(striv) + +static INT32 strivInit() +{ + suprtriv = 1; + timer_rate = 128; + + INT32 nRet = DrvInit(); + + for (INT32 i = 0; i < 0x4000; i++) + { + if (i & 0x1000) + { + if (i & 4) + Rom0[i] = BITSWAP08(Rom0[i],7,2,5,1,3,6,4,0) ^ 1; + else + Rom0[i] = BITSWAP08(Rom0[i],0,2,5,1,3,6,4,7) ^ 0x81; + } + else + { + if (i & 4) + Rom0[i] = BITSWAP08(Rom0[i],7,2,5,1,3,6,4,0) ^ 1; + else + Rom0[i] = BITSWAP08(Rom0[i],0,2,5,1,3,6,4,7); + } + } + + return nRet; +} + +struct BurnDriver BurnDrvstriv = { + "striv", NULL, NULL, NULL, "1985", + "Super Triv\0", "No sound", "Hara Industries", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_QUIZ, 0, + NULL, strivRomInfo, strivRomName, NULL, NULL, StrivInputInfo, StrivDIPInfo, + strivInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; + +static struct BurnRomInfo striv2RomDesc[] = { + { "s.triv_p1.2f", 0x1000, 0xdcf5da6e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "s.triv_p2.3f", 0x1000, 0x921610ba, 1 | BRF_PRG | BRF_ESS }, // 1 + { "s.triv_p3.4f", 0x1000, 0xc36f0e21, 1 | BRF_PRG | BRF_ESS }, // 2 + { "s.triv_cp4.f6", 0x1000, 0x0dc98a97, 1 | BRF_PRG | BRF_ESS }, // 3 + { "s.triv_c3.e7", 0x1000, 0x2f4b0570, 1 | BRF_PRG | BRF_ESS }, // 4 + { "s.triv_c2.e6", 0x1000, 0xe21bd3ab, 1 | BRF_PRG | BRF_ESS }, // 5 + { "s.triv_c1.5e", 0x1000, 0x2c2c7282, 1 | BRF_PRG | BRF_ESS }, // 6 + + { "s.triv_sound.5a", 0x1000, 0xb7ddf84f, 2 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code + + { "s.triv.1a", 0x1000, 0x8f60229b, 3 | BRF_GRA }, // 8 Graphics + { "s.triv.4a", 0x1000, 0x8f982a9c, 3 | BRF_GRA }, // 9 + { "s.triv.5a", 0x1000, 0x8f982a9c, 3 | BRF_GRA }, // 10 + { "s.triv.2a", 0x1000, 0x7ad4358e, 3 | BRF_GRA }, // 11 + + { "s.triv_ts0.u6", 0x8000, 0x796849da, 5 | BRF_PRG | BRF_ESS }, // 12 Question ROMs + { "s.triv_ts1.u7", 0x8000, 0x059d4900, 5 | BRF_PRG | BRF_ESS }, // 13 + { "s.triv_ts2.u8", 0x8000, 0x184159aa, 5 | BRF_PRG | BRF_ESS }, // 14 + { "s.triv_ta0.u9", 0x8000, 0xc4eb7f2e, 5 | BRF_PRG | BRF_ESS }, // 15 + { "s.triv_ta1.u10", 0x8000, 0x3d9a136f, 5 | BRF_PRG | BRF_ESS }, // 16 + { "s.triv_ta2.u11", 0x8000, 0x8fa557b2, 5 | BRF_PRG | BRF_ESS }, // 17 + { "s.triv_te0.u12", 0x8000, 0x3f5d1c4b, 5 | BRF_PRG | BRF_ESS }, // 18 + { "s.triv_te1.u13", 0x8000, 0x6ae2bf3a, 5 | BRF_PRG | BRF_ESS }, // 19 + { "s.triv_tg0.u14", 0x8000, 0x8fc9c76d, 5 | BRF_PRG | BRF_ESS }, // 20 + { "s.triv_tg1.u15", 0x8000, 0x981a2a43, 5 | BRF_PRG | BRF_ESS }, // 21 +}; + +STD_ROM_PICK(striv2) +STD_ROM_FN(striv2) + +struct BurnDriver BurnDrvstriv2 = { + "striv2", "striv", NULL, NULL, "1985", + "Super Triv (set 2)\0", "No sound", "Hara Industries", "Jack the Giantkiller", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_QUIZ, 0, + NULL, striv2RomInfo, striv2RomName, NULL, NULL, StrivInputInfo, StrivDIPInfo, + strivInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvCalcPal, 0x100, + 224, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_kangaroo.cpp b/src/burn/drv/pre90s/d_kangaroo.cpp index f41025874..90f68d04a 100644 --- a/src/burn/drv/pre90s/d_kangaroo.cpp +++ b/src/burn/drv/pre90s/d_kangaroo.cpp @@ -1,731 +1,729 @@ -#include "tiles_generic.h" -#include "z80_intf.h" - -#include "driver.h" -extern "C" { - #include "ay8910.h" -} - -static UINT8 *Mem, *MemEnd, *AllRAM, *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvGfxROM; -static UINT32 *DrvPalette; -static UINT32 *Palette; -static UINT8 DrvRecalc; - -static UINT32 *DrvVidRAM32; - -static INT16* pAY8910Buffer[3]; -static INT16 *pFMBuffer; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; - -static UINT8 kangaroo_clock; -static UINT8 soundlatch; -static UINT8 *DrvVidControl; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p1 start" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 2, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 4, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 5, "p1 down", }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 1"}, - - {"P2 Coin" , BIT_DIGITAL , DrvJoy2 + 0, "p2 coin" }, - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 1, "p2 start" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p2 right" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p2 left" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down", }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 1"}, - - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag" }, - {"Reset" , BIT_DIGITAL ,&DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Music" }, - {0x10, 0x01, 0x20, 0x20, "Off" }, - {0x10, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x40, 0x00, "Upright" }, - {0x10, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x10, 0x01, 0x80, 0x00, "Off" }, - {0x10, 0x01, 0x80, 0x80, "On" }, - - // Default Values - {0x11, 0xff, 0xff, 0x00, NULL }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x11, 0x01, 0x01, 0x00, "3" }, - {0x11, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x11, 0x01, 0x02, 0x00, "Easy" }, - {0x11, 0x01, 0x02, 0x02, "Hard" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x11, 0x01, 0x0c, 0x08, "10000 30000" }, - {0x11, 0x01, 0x0c, 0x0c, "20000 40000" }, - {0x11, 0x01, 0x0c, 0x04, "10000" }, - {0x11, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 0x10, "Coinage" }, - {0x11, 0x01, 0xf0, 0x10, "2C_1C" }, - {0x11, 0x01, 0xf0, 0x20, "A 2C/1C B 1C/3C" }, - {0x11, 0x01, 0xf0, 0x00, "1C_1C" }, - {0x11, 0x01, 0xf0, 0x30, "A 1C/1C B 1C/2C" }, - {0x11, 0x01, 0xf0, 0x40, "A 1C/1C B 1C/3C" }, - {0x11, 0x01, 0xf0, 0x50, "A 1C/1C B 1C/4C" }, - {0x11, 0x01, 0xf0, 0x60, "A 1C/1C B 1C/5C" }, - {0x11, 0x01, 0xf0, 0x70, "A 1C/1C B 1C/6C" }, - {0x11, 0x01, 0xf0, 0x80, "1C_2C" }, - {0x11, 0x01, 0xf0, 0x90, "A 1C/2C B 1C/4C" }, - {0x11, 0x01, 0xf0, 0xa0, "A 1C/2C B 1C/5C" }, - {0x11, 0x01, 0xf0, 0xe0, "A 1C/2C B 1C/6C" }, - {0x11, 0x01, 0xf0, 0xb0, "A 1C/2C B 1C/10C" }, - {0x11, 0x01, 0xf0, 0xc0, "A 1C/2C B 1C/11C" }, - {0x11, 0x01, 0xf0, 0xd0, "A 1C/2C B 1C/12C" }, - {0x11, 0x01, 0xf0, 0xf0, "Free_Play" }, -}; - -STDDIPINFO(Drv) - - -static void videoram_write(UINT16 offset, UINT8 data, UINT8 mask) -{ - UINT32 expdata, layermask; - - // data contains 4 2-bit values packed as DCBADCBA; expand these into 4 8-bit values - expdata = 0; - if (data & 0x01) expdata |= 0x00000055; - if (data & 0x10) expdata |= 0x000000aa; - if (data & 0x02) expdata |= 0x00005500; - if (data & 0x20) expdata |= 0x0000aa00; - if (data & 0x04) expdata |= 0x00550000; - if (data & 0x40) expdata |= 0x00aa0000; - if (data & 0x08) expdata |= 0x55000000; - if (data & 0x80) expdata |= 0xaa000000; - - // determine which layers are enabled - layermask = 0; - if (mask & 0x08) layermask |= 0x30303030; - if (mask & 0x04) layermask |= 0xc0c0c0c0; - if (mask & 0x02) layermask |= 0x03030303; - if (mask & 0x01) layermask |= 0x0c0c0c0c; - - // update layers - DrvVidRAM32[offset] = (DrvVidRAM32[offset] & ~layermask) | (expdata & layermask); -} - -static void blitter_execute() -{ - UINT16 src = DrvVidControl[0] | (DrvVidControl[1] << 8); - UINT16 dst = DrvVidControl[2] | (DrvVidControl[3] << 8); - UINT8 height = DrvVidControl[5]; - UINT8 width = DrvVidControl[4]; - UINT8 mask = DrvVidControl[8]; - - // during DMA operations, the top 2 bits are ORed together, as well as the bottom 2 bits - // adjust the mask to account for this - mask |= ((mask & 0x41) << 1) | ((mask & 0x82) >> 1); - - // loop over height, then width - for (INT32 y = 0; y <= height; y++, dst += 256) { - for (INT32 x = 0; x <= width; x++) { - UINT16 effdst = (dst + x) & 0x3fff; - UINT16 effsrc = src++ & 0x1fff; - videoram_write(effdst, DrvGfxROM[0x0000 + effsrc], mask & 0x05); - videoram_write(effdst, DrvGfxROM[0x2000 + effsrc], mask & 0x0a); - } - } -} - -void __fastcall kangaroo_main_write(UINT16 address, UINT8 data) -{ - if (address >= 0x8000 && address <= 0xbfff) { - videoram_write(address & 0x3fff, data, DrvVidControl[8]); - return; - } - - if ((address & 0xec00) == 0xe800) address &= 0xfc0f; - if ((address & 0xec00) == 0xec00) address &= 0xff00; - - switch (address) - { - case 0xe800: - case 0xe801: - case 0xe802: - case 0xe803: - case 0xe804: - DrvVidControl[address & 0x0f] = data; - return; - - case 0xe805: - DrvVidControl[address & 0x0f] = data; - - blitter_execute(); - return; - - case 0xe806: - case 0xe807: - DrvVidControl[address & 0x0f] = data; - return; - - case 0xe808: - DrvVidControl[address & 0x0f] = data; - - ZetMapArea(0xc000, 0xdfff, 0, DrvGfxROM + ((data & 0x05) ? 0 : 0x2000)); - return; - - case 0xe809: - case 0xe80a: - DrvVidControl[address & 0x0f] = data; - return; - - case 0xec00: - soundlatch = data; - return; - - case 0xed00: - // coin counter - return; - } - - - - if (address > 0x5fff) bprintf (PRINT_NORMAL, _T("%4.4x, %2.2x wm\n"), address, data); - - return; -} - -UINT8 __fastcall kangaroo_main_read(UINT16 address) -{ - if ((address & 0xec00) == 0xe400) address &= 0xfc00; - if ((address & 0xec00) == 0xec00) address &= 0xff00; - - switch (address) - { - case 0xe400: - return DrvDips[1]; - - case 0xec00: // in0 - { - UINT8 ret = DrvDips[0]; - if (DrvJoy1[7]) ret |= 0x01; // service - if (DrvJoy1[1]) ret |= 0x02; - if (DrvJoy2[1]) ret |= 0x04; - if (DrvJoy1[0]) ret |= 0x08; - if (DrvJoy2[0]) ret |= 0x10; - return ret; - } - - case 0xed00: // in1 - { - UINT8 ret = 0; - if (DrvJoy1[2]) ret |= 0x01; - if (DrvJoy1[3]) ret |= 0x02; - if (DrvJoy1[4]) ret |= 0x04; - if (DrvJoy1[5]) ret |= 0x08; - if (DrvJoy1[6]) ret |= 0x10; - // if (DrvJoy1[7]) ret |= 0x80; // service? - return ret; - } - - - case 0xee00: // in2 - { - UINT8 ret = 0; - if (DrvJoy2[2]) ret |= 0x01; - if (DrvJoy2[3]) ret |= 0x02; - if (DrvJoy2[4]) ret |= 0x04; - if (DrvJoy2[5]) ret |= 0x08; - if (DrvJoy2[6]) ret |= 0x10; - return ret; - } - - case 0xef00: - return ++kangaroo_clock & 0x0f; - } - - bprintf (PRINT_NORMAL, _T("%4.4x, rm\n"), address); - - return 0; -} - -UINT8 __fastcall kangaroo_sound_read(UINT16 address) -{ - switch (address & 0xf000) - { - case 0x6000: - return soundlatch; - } - - bprintf (PRINT_NORMAL, _T("%4.4x, rs\n"), address); - - return 0; -} - -void __fastcall kangaroo_sound_write(UINT16 address, UINT8 data) -{ - switch (address & 0xf000) - { - case 0x7000: - AY8910Write(0, 1, data); - return; - - case 0x8000: - AY8910Write(0, 0, data); - return; - } - - bprintf (PRINT_NORMAL, _T("%4.4x, %2.2x ws\n"), address, data); - - return; -} - -static INT32 MemIndex() -{ - UINT8 *Next; - - Next = Mem; Next += 0x10000; // buffer - - DrvZ80ROM0 = Next; Next += 0x06000; - DrvZ80ROM1 = Next; Next += 0x01000; - DrvGfxROM = Next; Next += 0x04000; - - Palette = (UINT32*)Next; Next += 0x00008 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00008 * sizeof(UINT32); - - AllRAM = Next; - - DrvZ80RAM0 = Next; Next += 0x00400; - DrvZ80RAM1 = Next; Next += 0x00400; - - DrvVidRAM32 = (UINT32*)Next; Next += 0x4000 * sizeof(UINT32); - - DrvVidControl = Next; Next += 16; - - RamEnd = Next; - - pFMBuffer = (INT16 *)Next; Next += nBurnSoundLen * 3 * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRAM, 0, RamEnd - AllRAM); - - ZetOpen(0); - ZetReset(); - ZetNmi(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - - soundlatch = 0; - kangaroo_clock = 0; - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - for (INT32 i = 0; i < 3; i++) - pAY8910Buffer[i] = pFMBuffer + nBurnSoundLen * i; - - // kangaroo - if (strncmp ("kangaro", BurnDrvGetTextA(DRV_NAME), 7) == 0) - { - for (INT32 i = 0; i < 6; i++) - if (BurnLoadRom(DrvZ80ROM0 + i * 0x1000, 0 + i, 0)) return 1; - - if (BurnLoadRom(DrvZ80ROM1, 6, 0)) return 1; - - for (INT32 i = 0; i < 4; i++) - if (BurnLoadRom(DrvGfxROM + i * 0x1000, 7 + i, 0)) return 1; - } - // funkyfish - else - { - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvZ80ROM0 + i * 0x1000, 0 + i, 0)) return 1; - if (BurnLoadRom(DrvGfxROM + i * 0x1000, 5 + i, 0)) return 1; - } - - if (BurnLoadRom(DrvZ80ROM1, 4, 0)) return 1; - } - - for (INT32 i = 0; i < 8; i++) - Palette[i] = ((i & 4 ? 0xff : 0) << 16) | ((i & 2 ? 0xff : 0) << 8) | (i & 1 ? 0xff : 0); - - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM0); - - ZetMapArea(0xc000, 0xdfff, 0, DrvGfxROM ); // Gfx are banked here - - ZetMapArea(0xe000, 0xe3ff, 0, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe3ff, 1, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe3ff, 2, DrvZ80RAM0); - - ZetSetWriteHandler(kangaroo_main_write); - ZetSetReadHandler(kangaroo_main_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM1); - - // mirrored 4x - ZetMapArea(0x4000, 0x43ff, 0, DrvZ80RAM1); - ZetMapArea(0x4000, 0x43ff, 1, DrvZ80RAM1); - ZetMapArea(0x4000, 0x43ff, 2, DrvZ80RAM1); - - ZetSetWriteHandler(kangaroo_sound_write); - ZetSetReadHandler(kangaroo_sound_read); - ZetSetInHandler(kangaroo_sound_read); - ZetSetOutHandler(kangaroo_sound_write); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 1250000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - BurnFree (Mem); - - GenericTilesExit(); - ZetExit(); - AY8910Exit(0); - - return 0; -} - - -static INT32 DrvDraw() -{ - UINT8 scrolly = DrvVidControl[6]; - UINT8 scrollx = DrvVidControl[7]; - UINT8 maska = (DrvVidControl[10] & 0x28) >> 3; - UINT8 maskb = (DrvVidControl[10] & 0x07) >> 0; - UINT8 xora = (DrvVidControl[9] & 0x20) ? 0xff : 0x00; - UINT8 xorb = (DrvVidControl[9] & 0x10) ? 0xff : 0x00; - UINT8 enaa = (DrvVidControl[9] & 0x08); - UINT8 enab = (DrvVidControl[9] & 0x04); - UINT8 pria = (~DrvVidControl[9] & 0x02); - UINT8 prib = (~DrvVidControl[9] & 0x01); - INT32 x, y; - - if (DrvRecalc) { - for (x = 0; x < 8; x++) { - UINT32 col = Palette[x]; - DrvPalette[x] = BurnHighCol(col >> 16, col >> 8, col, 0); - } - } - - // iterate over pixels - for (y = 0; y < nScreenHeight; y++) - { - UINT16 *dest = pTransDraw + (y * nScreenWidth); - - for (x = 0; x < nScreenWidth; x += 2) - { - UINT8 effxa = scrollx + ((x / 2) ^ xora); - UINT8 effya = scrolly + (y ^ xora); - UINT8 effxb = (x / 2) ^ xorb; - UINT8 effyb = y ^ xorb; - UINT8 pixa = (DrvVidRAM32[effya + 256 * (effxa / 4)] >> (8 * (effxa % 4) + 0)) & 0x0f; - UINT8 pixb = (DrvVidRAM32[effyb + 256 * (effxb / 4)] >> (8 * (effxb % 4) + 4)) & 0x0f; - UINT8 finalpens; - - // for each layer, contribute bits if (a) enabled, and (b) either has priority or the opposite plane is 0 - finalpens = 0; - if (enaa && (pria || pixb == 0)) - finalpens |= pixa; - if (enab && (prib || pixa == 0)) - finalpens |= pixb; - - // store the first of two pixels, which is always full brightness - dest[x + 0] = finalpens & 7; - - // KOS1 alternates at 5MHz, offset from the pixel clock by 1/2 clock - // when 0, it enables the color mask for pixels with Z = 0 - finalpens = 0; - if (enaa && (pria || pixb == 0)) - { - if (!(pixa & 0x08)) pixa &= maska; - finalpens |= pixa; - } - if (enab && (prib || pixa == 0)) - { - if (!(pixb & 0x08)) pixb &= maskb; - finalpens |= pixb; - } - - // store the second of two pixels, which is affected by KOS1 and the A/B masks - dest[x + 1] = finalpens & 7; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { 2500000 / 60, 1250000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == (nInterleave - 1)) { - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - ZetClose(); - - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == (nInterleave - 1)) { - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - ZetClose(); - -/* ZetOpen(0); - nCyclesDone[0] -= ZetRun(nCyclesDone[0] / (nInterleave - i)); - if (i == (nInterleave - 1)) ZetRaiseIrq(0); - ZetClose(); - - // Run Z80 #1 - ZetOpen(1); - nCyclesDone[1] -= ZetRun(nCyclesDone[1] / (nInterleave - i)); - if (i == (nInterleave - 1)) ZetRaiseIrq(0); - ZetClose();*/ - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -// Funky Fish - -static struct BurnRomInfo fnkyfishRomDesc[] = { - { "tvg_64.0", 0x1000, 0xaf728803, 1 | BRF_ESS | BRF_PRG }, // 0 Main Z80 Code - { "tvg_65.1", 0x1000, 0x71959e6b, 1 | BRF_ESS | BRF_PRG }, // 1 - { "tvg_66.2", 0x1000, 0x5ccf68d4, 1 | BRF_ESS | BRF_PRG }, // 2 - { "tvg_67.3", 0x1000, 0x938ff36f, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "tvg_68.8", 0x1000, 0xd36bb2be, 2 | BRF_ESS | BRF_PRG }, // 4 Sound Z80 Code - - { "tvg_69.v0", 0x1000, 0xcd532d0b, 3 | BRF_GRA }, // 5 Graphics - { "tvg_71.v2", 0x1000, 0xa59c9713, 3 | BRF_GRA }, // 6 - { "tvg_70.v1", 0x1000, 0xfd308ef1, 3 | BRF_GRA }, // 7 - { "tvg_72.v3", 0x1000, 0x6ae9b584, 3 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(fnkyfish) -STD_ROM_FN(fnkyfish) - -struct BurnDriver BurnDrvfnkyfish = { - "fnkyfish", NULL, NULL, NULL, "1981", - "Funky Fish\0", NULL, "Sun Electronics", "Kangaroo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, fnkyfishRomInfo, fnkyfishRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, - &DrvRecalc, 0x08, 256, 512, 3, 4 -}; - - -// Kangaroo - -static struct BurnRomInfo kangarooRomDesc[] = { - { "tvg_75.0", 0x1000, 0x0d18c581, 1 | BRF_ESS | BRF_PRG }, // 0 Main Z80 Code - { "tvg_76.1", 0x1000, 0x5978d37a, 1 | BRF_ESS | BRF_PRG }, // 1 - { "tvg_77.2", 0x1000, 0x522d1097, 1 | BRF_ESS | BRF_PRG }, // 2 - { "tvg_78.3", 0x1000, 0x063da970, 1 | BRF_ESS | BRF_PRG }, // 3 - { "tvg_79.4", 0x1000, 0x9e5cf8ca, 1 | BRF_ESS | BRF_PRG }, // 4 - { "tvg_80.5", 0x1000, 0x2fc18049, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "tvg_81.8", 0x1000, 0xfb449bfd, 2 | BRF_ESS | BRF_PRG }, // 6 Sound Z80 Code - - { "tvg_83.v0", 0x1000, 0xc0446ca6, 3 | BRF_GRA }, // 7 Graphics - { "tvg_85.v2", 0x1000, 0x72c52695, 3 | BRF_GRA }, // 8 - { "tvg_84.v1", 0x1000, 0xe4cb26c2, 3 | BRF_GRA }, // 9 - { "tvg_86.v3", 0x1000, 0x9e6a599f, 3 | BRF_GRA }, // 10 - - { "tvg_82.12", 0x0800, 0x57766f69, 0 | BRF_ESS | BRF_PRG }, // 11 MB8841 custom microcontroller data (unused) - - { "mb8841.ic29", 0x0800, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 12 MB8841 custom microcontroller prg (unused) -}; - -STD_ROM_PICK(kangaroo) -STD_ROM_FN(kangaroo) - -struct BurnDriver BurnDrvkangaroo = { - "kangaroo", NULL, NULL, NULL, "1982", - "Kangaroo\0", NULL, "Sun Electronics", "Kangaroo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, kangarooRomInfo, kangarooRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, - &DrvRecalc, 0x08, 256, 512, 3, 4 -}; - - -// Kangaroo (Atari) -static struct BurnRomInfo kangaroaRomDesc[] = { - { "136008-101.ic7", 0x1000, 0x0d18c581, 1 | BRF_ESS | BRF_PRG }, // 0 Main Z80 Code - { "136008-102.ic8", 0x1000, 0x5978d37a, 1 | BRF_ESS | BRF_PRG }, // 1 - { "136008-103.ic9", 0x1000, 0x522d1097, 1 | BRF_ESS | BRF_PRG }, // 2 - { "136008-104.ic10", 0x1000, 0x063da970, 1 | BRF_ESS | BRF_PRG }, // 3 - { "136008-105.ic16", 0x1000, 0x82a26c7d, 1 | BRF_ESS | BRF_PRG }, // 4 - { "136008-106.ic17", 0x1000, 0x3dead542, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "136008-107.ic24", 0x1000, 0xfb449bfd, 2 | BRF_ESS | BRF_PRG }, // 6 Sound Z80 Code - - { "136008-108.ic76", 0x1000, 0xc0446ca6, 3 | BRF_GRA }, // 7 Graphics - { "136008-110.ic77", 0x1000, 0x72c52695, 3 | BRF_GRA }, // 8 - { "136008-109.ic52", 0x1000, 0xe4cb26c2, 3 | BRF_GRA }, // 9 - { "136008-111.ic53", 0x1000, 0x9e6a599f, 3 | BRF_GRA }, // 10 - - { "136008-112.ic28", 0x0800, 0x57766f69, 0 | BRF_ESS | BRF_PRG }, // 11 MB8841 custom microcontroller (unused) - - { "mb8841.ic29", 0x0800, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 12 MB8841 custom microcontroller prg (unused) -}; - -STD_ROM_PICK(kangaroa) -STD_ROM_FN(kangaroa) - -struct BurnDriver BurnDrvkangaroa = { - "kangarooa", "kangaroo", NULL, NULL, "1982", - "Kangaroo (Atari)\0", NULL, "[Sun Electronics] (Atari license)", "Kangaroo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, kangaroaRomInfo, kangaroaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, - &DrvRecalc, 0x08, 256, 512, 3, 4 -}; - - -// Kangaroo (bootleg) - -static struct BurnRomInfo kangarobRomDesc[] = { - { "tvg_75.0", 0x1000, 0x0d18c581, 1 | BRF_ESS | BRF_PRG }, // 0 Main Z80 Code - { "tvg_76.1", 0x1000, 0x5978d37a, 1 | BRF_ESS | BRF_PRG }, // 1 - { "tvg_77.2", 0x1000, 0x522d1097, 1 | BRF_ESS | BRF_PRG }, // 2 - { "tvg_78.3", 0x1000, 0x063da970, 1 | BRF_ESS | BRF_PRG }, // 3 - { "tvg_79.4", 0x1000, 0x9e5cf8ca, 1 | BRF_ESS | BRF_PRG }, // 4 - { "k6", 0x1000, 0x7644504a, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "tvg_81.8", 0x1000, 0xfb449bfd, 2 | BRF_ESS | BRF_PRG }, // 6 Sound Z80 Code - - { "tvg_83.v0", 0x1000, 0xc0446ca6, 3 | BRF_GRA }, // 7 Graphics - { "tvg_85.v2", 0x1000, 0x72c52695, 3 | BRF_GRA }, // 8 - { "tvg_84.v1", 0x1000, 0xe4cb26c2, 3 | BRF_GRA }, // 9 - { "tvg_86.v3", 0x1000, 0x9e6a599f, 3 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(kangarob) -STD_ROM_FN(kangarob) - -struct BurnDriver BurnDrvkangarob = { - "kangaroob", "kangaroo", NULL, NULL, "1982", - "Kangaroo (bootleg)\0", NULL, "Bootleg", "Kangaroo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, kangarobRomInfo, kangarobRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, - &DrvRecalc, 0x08, 256, 512, 3, 4 -}; +#include "tiles_generic.h" +#include "z80_intf.h" + +#include "driver.h" +extern "C" { + #include "ay8910.h" +} + +static UINT8 *Mem, *MemEnd, *AllRAM, *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvGfxROM; +static UINT32 *DrvPalette; +static UINT32 *Palette; +static UINT8 DrvRecalc; + +static UINT32 *DrvVidRAM32; + +static INT16* pAY8910Buffer[3]; +static INT16 *pFMBuffer; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; + +static UINT8 kangaroo_clock; +static UINT8 soundlatch; +static UINT8 *DrvVidControl; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p1 start" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 2, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 4, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 5, "p1 down", }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 1"}, + + {"P2 Coin" , BIT_DIGITAL , DrvJoy2 + 0, "p2 coin" }, + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 1, "p2 start" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p2 right" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p2 left" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down", }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 1"}, + + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag" }, + {"Reset" , BIT_DIGITAL ,&DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Music" }, + {0x10, 0x01, 0x20, 0x20, "Off" }, + {0x10, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x40, 0x00, "Upright" }, + {0x10, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x10, 0x01, 0x80, 0x00, "Off" }, + {0x10, 0x01, 0x80, 0x80, "On" }, + + // Default Values + {0x11, 0xff, 0xff, 0x00, NULL }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x11, 0x01, 0x01, 0x00, "3" }, + {0x11, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x11, 0x01, 0x02, 0x00, "Easy" }, + {0x11, 0x01, 0x02, 0x02, "Hard" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x11, 0x01, 0x0c, 0x08, "10000 30000" }, + {0x11, 0x01, 0x0c, 0x0c, "20000 40000" }, + {0x11, 0x01, 0x0c, 0x04, "10000" }, + {0x11, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 0x10, "Coinage" }, + {0x11, 0x01, 0xf0, 0x10, "2C_1C" }, + {0x11, 0x01, 0xf0, 0x20, "A 2C/1C B 1C/3C" }, + {0x11, 0x01, 0xf0, 0x00, "1C_1C" }, + {0x11, 0x01, 0xf0, 0x30, "A 1C/1C B 1C/2C" }, + {0x11, 0x01, 0xf0, 0x40, "A 1C/1C B 1C/3C" }, + {0x11, 0x01, 0xf0, 0x50, "A 1C/1C B 1C/4C" }, + {0x11, 0x01, 0xf0, 0x60, "A 1C/1C B 1C/5C" }, + {0x11, 0x01, 0xf0, 0x70, "A 1C/1C B 1C/6C" }, + {0x11, 0x01, 0xf0, 0x80, "1C_2C" }, + {0x11, 0x01, 0xf0, 0x90, "A 1C/2C B 1C/4C" }, + {0x11, 0x01, 0xf0, 0xa0, "A 1C/2C B 1C/5C" }, + {0x11, 0x01, 0xf0, 0xe0, "A 1C/2C B 1C/6C" }, + {0x11, 0x01, 0xf0, 0xb0, "A 1C/2C B 1C/10C" }, + {0x11, 0x01, 0xf0, 0xc0, "A 1C/2C B 1C/11C" }, + {0x11, 0x01, 0xf0, 0xd0, "A 1C/2C B 1C/12C" }, + {0x11, 0x01, 0xf0, 0xf0, "Free_Play" }, +}; + +STDDIPINFO(Drv) + + +static void videoram_write(UINT16 offset, UINT8 data, UINT8 mask) +{ + UINT32 expdata, layermask; + + // data contains 4 2-bit values packed as DCBADCBA; expand these into 4 8-bit values + expdata = 0; + if (data & 0x01) expdata |= 0x00000055; + if (data & 0x10) expdata |= 0x000000aa; + if (data & 0x02) expdata |= 0x00005500; + if (data & 0x20) expdata |= 0x0000aa00; + if (data & 0x04) expdata |= 0x00550000; + if (data & 0x40) expdata |= 0x00aa0000; + if (data & 0x08) expdata |= 0x55000000; + if (data & 0x80) expdata |= 0xaa000000; + + // determine which layers are enabled + layermask = 0; + if (mask & 0x08) layermask |= 0x30303030; + if (mask & 0x04) layermask |= 0xc0c0c0c0; + if (mask & 0x02) layermask |= 0x03030303; + if (mask & 0x01) layermask |= 0x0c0c0c0c; + + // update layers + DrvVidRAM32[offset] = (DrvVidRAM32[offset] & ~layermask) | (expdata & layermask); +} + +static void blitter_execute() +{ + UINT16 src = DrvVidControl[0] | (DrvVidControl[1] << 8); + UINT16 dst = DrvVidControl[2] | (DrvVidControl[3] << 8); + UINT8 height = DrvVidControl[5]; + UINT8 width = DrvVidControl[4]; + UINT8 mask = DrvVidControl[8]; + + // during DMA operations, the top 2 bits are ORed together, as well as the bottom 2 bits + // adjust the mask to account for this + mask |= ((mask & 0x41) << 1) | ((mask & 0x82) >> 1); + + // loop over height, then width + for (INT32 y = 0; y <= height; y++, dst += 256) { + for (INT32 x = 0; x <= width; x++) { + UINT16 effdst = (dst + x) & 0x3fff; + UINT16 effsrc = src++ & 0x1fff; + videoram_write(effdst, DrvGfxROM[0x0000 + effsrc], mask & 0x05); + videoram_write(effdst, DrvGfxROM[0x2000 + effsrc], mask & 0x0a); + } + } +} + +void __fastcall kangaroo_main_write(UINT16 address, UINT8 data) +{ + if (address >= 0x8000 && address <= 0xbfff) { + videoram_write(address & 0x3fff, data, DrvVidControl[8]); + return; + } + + if ((address & 0xec00) == 0xe800) address &= 0xfc0f; + if ((address & 0xec00) == 0xec00) address &= 0xff00; + + switch (address) + { + case 0xe800: + case 0xe801: + case 0xe802: + case 0xe803: + case 0xe804: + DrvVidControl[address & 0x0f] = data; + return; + + case 0xe805: + DrvVidControl[address & 0x0f] = data; + + blitter_execute(); + return; + + case 0xe806: + case 0xe807: + DrvVidControl[address & 0x0f] = data; + return; + + case 0xe808: + DrvVidControl[address & 0x0f] = data; + + ZetMapArea(0xc000, 0xdfff, 0, DrvGfxROM + ((data & 0x05) ? 0 : 0x2000)); + return; + + case 0xe809: + case 0xe80a: + DrvVidControl[address & 0x0f] = data; + return; + + case 0xec00: + soundlatch = data; + return; + + case 0xed00: + // coin counter + return; + } + + + + if (address > 0x5fff) bprintf (PRINT_NORMAL, _T("%4.4x, %2.2x wm\n"), address, data); + + return; +} + +UINT8 __fastcall kangaroo_main_read(UINT16 address) +{ + if ((address & 0xec00) == 0xe400) address &= 0xfc00; + if ((address & 0xec00) == 0xec00) address &= 0xff00; + + switch (address) + { + case 0xe400: + return DrvDips[1]; + + case 0xec00: // in0 + { + UINT8 ret = DrvDips[0]; + if (DrvJoy1[7]) ret |= 0x01; // service + if (DrvJoy1[1]) ret |= 0x02; + if (DrvJoy2[1]) ret |= 0x04; + if (DrvJoy1[0]) ret |= 0x08; + if (DrvJoy2[0]) ret |= 0x10; + return ret; + } + + case 0xed00: // in1 + { + UINT8 ret = 0; + if (DrvJoy1[2]) ret |= 0x01; + if (DrvJoy1[3]) ret |= 0x02; + if (DrvJoy1[4]) ret |= 0x04; + if (DrvJoy1[5]) ret |= 0x08; + if (DrvJoy1[6]) ret |= 0x10; + // if (DrvJoy1[7]) ret |= 0x80; // service? + return ret; + } + + + case 0xee00: // in2 + { + UINT8 ret = 0; + if (DrvJoy2[2]) ret |= 0x01; + if (DrvJoy2[3]) ret |= 0x02; + if (DrvJoy2[4]) ret |= 0x04; + if (DrvJoy2[5]) ret |= 0x08; + if (DrvJoy2[6]) ret |= 0x10; + return ret; + } + + case 0xef00: + return ++kangaroo_clock & 0x0f; + } + + bprintf (PRINT_NORMAL, _T("%4.4x, rm\n"), address); + + return 0; +} + +UINT8 __fastcall kangaroo_sound_read(UINT16 address) +{ + switch (address & 0xf000) + { + case 0x6000: + return soundlatch; + } + + bprintf (PRINT_NORMAL, _T("%4.4x, rs\n"), address); + + return 0; +} + +void __fastcall kangaroo_sound_write(UINT16 address, UINT8 data) +{ + switch (address & 0xf000) + { + case 0x7000: + AY8910Write(0, 1, data); + return; + + case 0x8000: + AY8910Write(0, 0, data); + return; + } + + bprintf (PRINT_NORMAL, _T("%4.4x, %2.2x ws\n"), address, data); + + return; +} + +static INT32 MemIndex() +{ + UINT8 *Next; + + Next = Mem; Next += 0x10000; // buffer + + DrvZ80ROM0 = Next; Next += 0x06000; + DrvZ80ROM1 = Next; Next += 0x01000; + DrvGfxROM = Next; Next += 0x04000; + + Palette = (UINT32*)Next; Next += 0x00008 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00008 * sizeof(UINT32); + + AllRAM = Next; + + DrvZ80RAM0 = Next; Next += 0x00400; + DrvZ80RAM1 = Next; Next += 0x00400; + + DrvVidRAM32 = (UINT32*)Next; Next += 0x4000 * sizeof(UINT32); + + DrvVidControl = Next; Next += 16; + + RamEnd = Next; + + pFMBuffer = (INT16 *)Next; Next += nBurnSoundLen * 3 * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRAM, 0, RamEnd - AllRAM); + + ZetOpen(0); + ZetReset(); + ZetNmi(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + + soundlatch = 0; + kangaroo_clock = 0; + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + for (INT32 i = 0; i < 3; i++) + pAY8910Buffer[i] = pFMBuffer + nBurnSoundLen * i; + + // kangaroo + if (strncmp ("kangaro", BurnDrvGetTextA(DRV_NAME), 7) == 0) + { + for (INT32 i = 0; i < 6; i++) + if (BurnLoadRom(DrvZ80ROM0 + i * 0x1000, 0 + i, 0)) return 1; + + if (BurnLoadRom(DrvZ80ROM1, 6, 0)) return 1; + + for (INT32 i = 0; i < 4; i++) + if (BurnLoadRom(DrvGfxROM + i * 0x1000, 7 + i, 0)) return 1; + } + // funkyfish + else + { + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvZ80ROM0 + i * 0x1000, 0 + i, 0)) return 1; + if (BurnLoadRom(DrvGfxROM + i * 0x1000, 5 + i, 0)) return 1; + } + + if (BurnLoadRom(DrvZ80ROM1, 4, 0)) return 1; + } + + for (INT32 i = 0; i < 8; i++) + Palette[i] = ((i & 4 ? 0xff : 0) << 16) | ((i & 2 ? 0xff : 0) << 8) | (i & 1 ? 0xff : 0); + + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM0); + + ZetMapArea(0xc000, 0xdfff, 0, DrvGfxROM ); // Gfx are banked here + + ZetMapArea(0xe000, 0xe3ff, 0, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe3ff, 1, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe3ff, 2, DrvZ80RAM0); + + ZetSetWriteHandler(kangaroo_main_write); + ZetSetReadHandler(kangaroo_main_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM1); + + // mirrored 4x + ZetMapArea(0x4000, 0x43ff, 0, DrvZ80RAM1); + ZetMapArea(0x4000, 0x43ff, 1, DrvZ80RAM1); + ZetMapArea(0x4000, 0x43ff, 2, DrvZ80RAM1); + + ZetSetWriteHandler(kangaroo_sound_write); + ZetSetReadHandler(kangaroo_sound_read); + ZetSetInHandler(kangaroo_sound_read); + ZetSetOutHandler(kangaroo_sound_write); + ZetClose(); + + AY8910Init(0, 1250000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + BurnFree (Mem); + + GenericTilesExit(); + ZetExit(); + AY8910Exit(0); + + return 0; +} + + +static INT32 DrvDraw() +{ + UINT8 scrolly = DrvVidControl[6]; + UINT8 scrollx = DrvVidControl[7]; + UINT8 maska = (DrvVidControl[10] & 0x28) >> 3; + UINT8 maskb = (DrvVidControl[10] & 0x07) >> 0; + UINT8 xora = (DrvVidControl[9] & 0x20) ? 0xff : 0x00; + UINT8 xorb = (DrvVidControl[9] & 0x10) ? 0xff : 0x00; + UINT8 enaa = (DrvVidControl[9] & 0x08); + UINT8 enab = (DrvVidControl[9] & 0x04); + UINT8 pria = (~DrvVidControl[9] & 0x02); + UINT8 prib = (~DrvVidControl[9] & 0x01); + INT32 x, y; + + if (DrvRecalc) { + for (x = 0; x < 8; x++) { + UINT32 col = Palette[x]; + DrvPalette[x] = BurnHighCol(col >> 16, col >> 8, col, 0); + } + } + + // iterate over pixels + for (y = 0; y < nScreenHeight; y++) + { + UINT16 *dest = pTransDraw + (y * nScreenWidth); + + for (x = 0; x < nScreenWidth; x += 2) + { + UINT8 effxa = scrollx + ((x / 2) ^ xora); + UINT8 effya = scrolly + (y ^ xora); + UINT8 effxb = (x / 2) ^ xorb; + UINT8 effyb = y ^ xorb; + UINT8 pixa = (DrvVidRAM32[effya + 256 * (effxa / 4)] >> (8 * (effxa % 4) + 0)) & 0x0f; + UINT8 pixb = (DrvVidRAM32[effyb + 256 * (effxb / 4)] >> (8 * (effxb % 4) + 4)) & 0x0f; + UINT8 finalpens; + + // for each layer, contribute bits if (a) enabled, and (b) either has priority or the opposite plane is 0 + finalpens = 0; + if (enaa && (pria || pixb == 0)) + finalpens |= pixa; + if (enab && (prib || pixa == 0)) + finalpens |= pixb; + + // store the first of two pixels, which is always full brightness + dest[x + 0] = finalpens & 7; + + // KOS1 alternates at 5MHz, offset from the pixel clock by 1/2 clock + // when 0, it enables the color mask for pixels with Z = 0 + finalpens = 0; + if (enaa && (pria || pixb == 0)) + { + if (!(pixa & 0x08)) pixa &= maska; + finalpens |= pixa; + } + if (enab && (prib || pixa == 0)) + { + if (!(pixb & 0x08)) pixb &= maskb; + finalpens |= pixb; + } + + // store the second of two pixels, which is affected by KOS1 and the A/B masks + dest[x + 1] = finalpens & 7; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { 2500000 / 60, 1250000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == (nInterleave - 1)) { + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + ZetClose(); + + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == (nInterleave - 1)) { + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + ZetClose(); + +/* ZetOpen(0); + nCyclesDone[0] -= ZetRun(nCyclesDone[0] / (nInterleave - i)); + if (i == (nInterleave - 1)) ZetRaiseIrq(0); + ZetClose(); + + // Run Z80 #1 + ZetOpen(1); + nCyclesDone[1] -= ZetRun(nCyclesDone[1] / (nInterleave - i)); + if (i == (nInterleave - 1)) ZetRaiseIrq(0); + ZetClose();*/ + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +// Funky Fish + +static struct BurnRomInfo fnkyfishRomDesc[] = { + { "tvg_64.0", 0x1000, 0xaf728803, 1 | BRF_ESS | BRF_PRG }, // 0 Main Z80 Code + { "tvg_65.1", 0x1000, 0x71959e6b, 1 | BRF_ESS | BRF_PRG }, // 1 + { "tvg_66.2", 0x1000, 0x5ccf68d4, 1 | BRF_ESS | BRF_PRG }, // 2 + { "tvg_67.3", 0x1000, 0x938ff36f, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "tvg_68.8", 0x1000, 0xd36bb2be, 2 | BRF_ESS | BRF_PRG }, // 4 Sound Z80 Code + + { "tvg_69.v0", 0x1000, 0xcd532d0b, 3 | BRF_GRA }, // 5 Graphics + { "tvg_71.v2", 0x1000, 0xa59c9713, 3 | BRF_GRA }, // 6 + { "tvg_70.v1", 0x1000, 0xfd308ef1, 3 | BRF_GRA }, // 7 + { "tvg_72.v3", 0x1000, 0x6ae9b584, 3 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(fnkyfish) +STD_ROM_FN(fnkyfish) + +struct BurnDriver BurnDrvfnkyfish = { + "fnkyfish", NULL, NULL, NULL, "1981", + "Funky Fish\0", NULL, "Sun Electronics", "Kangaroo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, fnkyfishRomInfo, fnkyfishRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, + &DrvRecalc, 0x08, 256, 512, 3, 4 +}; + + +// Kangaroo + +static struct BurnRomInfo kangarooRomDesc[] = { + { "tvg_75.0", 0x1000, 0x0d18c581, 1 | BRF_ESS | BRF_PRG }, // 0 Main Z80 Code + { "tvg_76.1", 0x1000, 0x5978d37a, 1 | BRF_ESS | BRF_PRG }, // 1 + { "tvg_77.2", 0x1000, 0x522d1097, 1 | BRF_ESS | BRF_PRG }, // 2 + { "tvg_78.3", 0x1000, 0x063da970, 1 | BRF_ESS | BRF_PRG }, // 3 + { "tvg_79.4", 0x1000, 0x9e5cf8ca, 1 | BRF_ESS | BRF_PRG }, // 4 + { "tvg_80.5", 0x1000, 0x2fc18049, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "tvg_81.8", 0x1000, 0xfb449bfd, 2 | BRF_ESS | BRF_PRG }, // 6 Sound Z80 Code + + { "tvg_83.v0", 0x1000, 0xc0446ca6, 3 | BRF_GRA }, // 7 Graphics + { "tvg_85.v2", 0x1000, 0x72c52695, 3 | BRF_GRA }, // 8 + { "tvg_84.v1", 0x1000, 0xe4cb26c2, 3 | BRF_GRA }, // 9 + { "tvg_86.v3", 0x1000, 0x9e6a599f, 3 | BRF_GRA }, // 10 + + { "tvg_82.12", 0x0800, 0x57766f69, 0 | BRF_ESS | BRF_PRG }, // 11 MB8841 custom microcontroller data (unused) + + { "mb8841.ic29", 0x0800, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 12 MB8841 custom microcontroller prg (unused) +}; + +STD_ROM_PICK(kangaroo) +STD_ROM_FN(kangaroo) + +struct BurnDriver BurnDrvkangaroo = { + "kangaroo", NULL, NULL, NULL, "1982", + "Kangaroo\0", NULL, "Sun Electronics", "Kangaroo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, kangarooRomInfo, kangarooRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, + &DrvRecalc, 0x08, 256, 512, 3, 4 +}; + + +// Kangaroo (Atari) +static struct BurnRomInfo kangaroaRomDesc[] = { + { "136008-101.ic7", 0x1000, 0x0d18c581, 1 | BRF_ESS | BRF_PRG }, // 0 Main Z80 Code + { "136008-102.ic8", 0x1000, 0x5978d37a, 1 | BRF_ESS | BRF_PRG }, // 1 + { "136008-103.ic9", 0x1000, 0x522d1097, 1 | BRF_ESS | BRF_PRG }, // 2 + { "136008-104.ic10", 0x1000, 0x063da970, 1 | BRF_ESS | BRF_PRG }, // 3 + { "136008-105.ic16", 0x1000, 0x82a26c7d, 1 | BRF_ESS | BRF_PRG }, // 4 + { "136008-106.ic17", 0x1000, 0x3dead542, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "136008-107.ic24", 0x1000, 0xfb449bfd, 2 | BRF_ESS | BRF_PRG }, // 6 Sound Z80 Code + + { "136008-108.ic76", 0x1000, 0xc0446ca6, 3 | BRF_GRA }, // 7 Graphics + { "136008-110.ic77", 0x1000, 0x72c52695, 3 | BRF_GRA }, // 8 + { "136008-109.ic52", 0x1000, 0xe4cb26c2, 3 | BRF_GRA }, // 9 + { "136008-111.ic53", 0x1000, 0x9e6a599f, 3 | BRF_GRA }, // 10 + + { "136008-112.ic28", 0x0800, 0x57766f69, 0 | BRF_ESS | BRF_PRG }, // 11 MB8841 custom microcontroller (unused) + + { "mb8841.ic29", 0x0800, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 12 MB8841 custom microcontroller prg (unused) +}; + +STD_ROM_PICK(kangaroa) +STD_ROM_FN(kangaroa) + +struct BurnDriver BurnDrvkangaroa = { + "kangarooa", "kangaroo", NULL, NULL, "1982", + "Kangaroo (Atari)\0", NULL, "[Sun Electronics] (Atari license)", "Kangaroo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, kangaroaRomInfo, kangaroaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, + &DrvRecalc, 0x08, 256, 512, 3, 4 +}; + + +// Kangaroo (bootleg) + +static struct BurnRomInfo kangarobRomDesc[] = { + { "tvg_75.0", 0x1000, 0x0d18c581, 1 | BRF_ESS | BRF_PRG }, // 0 Main Z80 Code + { "tvg_76.1", 0x1000, 0x5978d37a, 1 | BRF_ESS | BRF_PRG }, // 1 + { "tvg_77.2", 0x1000, 0x522d1097, 1 | BRF_ESS | BRF_PRG }, // 2 + { "tvg_78.3", 0x1000, 0x063da970, 1 | BRF_ESS | BRF_PRG }, // 3 + { "tvg_79.4", 0x1000, 0x9e5cf8ca, 1 | BRF_ESS | BRF_PRG }, // 4 + { "k6", 0x1000, 0x7644504a, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "tvg_81.8", 0x1000, 0xfb449bfd, 2 | BRF_ESS | BRF_PRG }, // 6 Sound Z80 Code + + { "tvg_83.v0", 0x1000, 0xc0446ca6, 3 | BRF_GRA }, // 7 Graphics + { "tvg_85.v2", 0x1000, 0x72c52695, 3 | BRF_GRA }, // 8 + { "tvg_84.v1", 0x1000, 0xe4cb26c2, 3 | BRF_GRA }, // 9 + { "tvg_86.v3", 0x1000, 0x9e6a599f, 3 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(kangarob) +STD_ROM_FN(kangarob) + +struct BurnDriver BurnDrvkangarob = { + "kangaroob", "kangaroo", NULL, NULL, "1982", + "Kangaroo (bootleg)\0", NULL, "Bootleg", "Kangaroo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, kangarobRomInfo, kangarobRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, + &DrvRecalc, 0x08, 256, 512, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_kyugo.cpp b/src/burn/drv/pre90s/d_kyugo.cpp index dfd457b70..72ed19cea 100644 --- a/src/burn/drv/pre90s/d_kyugo.cpp +++ b/src/burn/drv/pre90s/d_kyugo.cpp @@ -1,2631 +1,2627 @@ -#include "tiles_generic.h" -#include "z80_intf.h" - -#include "driver.h" -extern "C" { - #include "ay8910.h" -} - -static UINT8 KyugoInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 KyugoInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 KyugoInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 KyugoDip[2] = {0, 0}; -static UINT8 KyugoInput[3] = {0x00, 0x00, 0x00}; -static UINT8 KyugoReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *KyugoZ80Rom1 = NULL; -static UINT8 *KyugoZ80Rom2 = NULL; -static UINT8 *KyugoSharedZ80Ram = NULL; -static UINT8 *KyugoZ80Ram2 = NULL; -static UINT8 *KyugoSprite1Ram = NULL; -static UINT8 *KyugoSprite2Ram = NULL; -static UINT8 *KyugoFgVideoRam = NULL; -static UINT8 *KyugoBgVideoRam = NULL; -static UINT8 *KyugoBgAttrRam = NULL; -static UINT8 *KyugoPromRed = NULL; -static UINT8 *KyugoPromGreen = NULL; -static UINT8 *KyugoPromBlue = NULL; -static UINT8 *KyugoPromCharLookup = NULL; -static UINT8 *KyugoChars = NULL; -static UINT8 *KyugoTiles = NULL; -static UINT8 *KyugoSprites = NULL; -static UINT8 *KyugoTempRom = NULL; -static UINT32 *KyugoPalette = NULL; -static INT16* pFMBuffer; -static INT16* pAY8910Buffer[6]; - -static UINT8 KyugoIRQEnable; -static UINT8 KyugoSubCPUEnable; -static UINT8 KyugoFgColour; -static UINT8 KyugoBgPaletteBank; -static UINT8 KyugoBgScrollXHi; -static UINT8 KyugoBgScrollXLo; -static UINT8 KyugoBgScrollY; -static UINT8 KyugoFlipScreen; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static INT32 KyugoNumZ80Rom1; -static INT32 KyugoNumZ80Rom2; -static INT32 KyugoNumSpriteRom; -static INT32 KyugoSizeZ80Rom1; -static INT32 KyugoSizeZ80Rom2; -static INT32 KyugoSizeSpriteRom; - -static struct BurnInputInfo KyugoInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , KyugoInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , KyugoInputPort0 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , KyugoInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , KyugoInputPort0 + 4, "p2 start" }, - - {"Up" , BIT_DIGITAL , KyugoInputPort1 + 2, "p1 up" }, - {"Down" , BIT_DIGITAL , KyugoInputPort1 + 3, "p1 down" }, - {"Left" , BIT_DIGITAL , KyugoInputPort1 + 0, "p1 left" }, - {"Right" , BIT_DIGITAL , KyugoInputPort1 + 1, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , KyugoInputPort1 + 4, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , KyugoInputPort1 + 5, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 2, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 3, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 0, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 1, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 4, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &KyugoReset , "reset" }, - {"Service" , BIT_DIGITAL , KyugoInputPort0 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH, KyugoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, KyugoDip + 1 , "dip" }, -}; - - -STDINPUTINFO(Kyugo) - -inline void KyugoClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -inline void KyugoMakeInputs() -{ - // Reset Inputs - KyugoInput[0] = KyugoInput[1] = KyugoInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - KyugoInput[0] |= (KyugoInputPort0[i] & 1) << i; - KyugoInput[1] |= (KyugoInputPort1[i] & 1) << i; - KyugoInput[2] |= (KyugoInputPort2[i] & 1) << i; - } - - // Clear Opposites - KyugoClearOpposites(&KyugoInput[1]); - KyugoClearOpposites(&KyugoInput[2]); -} - -static struct BurnDIPInfo AirwolfDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xbb, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "4" }, - {0x12, 0x01, 0x03, 0x02, "5" }, - {0x12, 0x01, 0x03, 0x01, "6" }, - {0x12, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x12, 0x01, 0x04, 0x04, "Off" }, - {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Slow Motion" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Sound Test" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x40, 0x00, "Upright" }, - {0x12, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, - {0x13, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, -}; - -STDDIPINFO(Airwolf) - -static struct BurnDIPInfo SkywolfDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xbb, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x12, 0x01, 0x04, 0x04, "Off" }, - {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Slow Motion" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Sound Test" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x40, 0x00, "Upright" }, - {0x12, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, - {0x13, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, -}; - -STDDIPINFO(Skywolf) - -static struct BurnDIPInfo FlashgalDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xaf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x12, 0x01, 0x04, 0x04, "Every 50000" }, - {0x12, 0x01, 0x04, 0x00, "Every 70000" }, - - {0 , 0xfe, 0 , 2 , "Slow Motion" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Sound Test" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x40, 0x00, "Upright" }, - {0x12, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, - {0x13, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, -}; - -STDDIPINFO(Flashgal) - -static struct BurnDIPInfo GyrodineDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xbf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x12, 0x01, 0x10, 0x10, "Easy" }, - {0x12, 0x01, 0x10, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x12, 0x01, 0x20, 0x20, "20000 50000" }, - {0x12, 0x01, 0x20, 0x00, "40000 70000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x40, 0x00, "Upright" }, - {0x12, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, - {0x13, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, -}; - -STDDIPINFO(Gyrodine) - -static struct BurnDIPInfo LegendDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xbf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life / Continue" }, - {0x12, 0x01, 0x04, 0x04, "Every 50000 / No" }, - {0x12, 0x01, 0x04, 0x00, "Every 70000 / Yes" }, - - {0 , 0xfe, 0 , 2 , "Slow Motion" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Sound Test" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x40, 0x00, "Upright" }, - {0x12, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, - {0x13, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, -}; - -STDDIPINFO(Legend) - -static struct BurnDIPInfo SonofphxDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xbf, NULL }, - {0x13, 0xff, 0xff, 0xbf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x12, 0x01, 0x04, 0x04, "Every 50000" }, - {0x12, 0x01, 0x04, 0x00, "Every 70000" }, - - {0 , 0xfe, 0 , 2 , "Slow Motion" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Sound Test" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x40, 0x00, "Upright" }, - {0x12, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, - {0x13, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0xc0, 0xc0, "Easy" }, - {0x13, 0x01, 0xc0, 0x80, "Normal" }, - {0x13, 0x01, 0xc0, 0x40, "Hard" }, - {0x13, 0x01, 0xc0, 0x00, "Hardest" }, -}; - -STDDIPINFO(Sonofphx) - -static struct BurnDIPInfo SrdmissnDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xbf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life / Continue" }, - {0x12, 0x01, 0x04, 0x04, "Every 50000 / No" }, - {0x12, 0x01, 0x04, 0x00, "Every 70000 / Yes" }, - - {0 , 0xfe, 0 , 2 , "Slow Motion" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Sound Test" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x40, 0x00, "Upright" }, - {0x12, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, - {0x13, 0x01, 0x07, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, -}; - -STDDIPINFO(Srdmissn) - -static struct BurnRomInfo AirwolfRomDesc[] = { - { "b.2s", 0x08000, 0x8c993cce, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - - { "a.7s", 0x08000, 0xa3c7af5c, BRF_ESS | BRF_PRG }, // 1 Z80 #2 Program - - { "f.4a", 0x01000, 0x4df44ce9, BRF_GRA }, // 2 Characters - - { "09h_14.bin", 0x02000, 0x25e57e1f, BRF_GRA }, // 3 Tiles - { "10h_13.bin", 0x02000, 0xcf0de5e9, BRF_GRA }, // 4 - { "11h_12.bin", 0x02000, 0x4050c048, BRF_GRA }, // 5 - - { "e.6a", 0x08000, 0xe8fbc7d2, BRF_GRA }, // 6 Sprites - { "d.8a", 0x08000, 0xc5d4156b, BRF_GRA }, // 7 - { "c.10a", 0x08000, 0xde91dfb1, BRF_GRA }, // 8 - - { "01j.bin", 0x00100, 0x6a94b2a3, BRF_GRA }, // 9 PROMs - { "01h.bin", 0x00100, 0xec0923d3, BRF_GRA }, // 10 - { "01f.bin", 0x00100, 0xade97052, BRF_GRA }, // 11 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 12 - - { "pal16l8a.2j", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, // 13 PLDs - { "epl12p6a.9j", 0x00034, 0x19808f14, BRF_OPT }, // 14 - { "epl12p6a.9k", 0x00034, 0xf5acad85, BRF_OPT }, // 15 -}; - -STD_ROM_PICK(Airwolf) -STD_ROM_FN(Airwolf) - -static struct BurnRomInfo AirwolfaRomDesc[] = { - { "airwolf.2", 0x08000, 0xbc1a8587, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - - { "airwolf.1", 0x08000, 0xa3c7af5c, BRF_ESS | BRF_PRG }, // 1 Z80 #2 Program - - { "airwolf.6", 0x02000, 0x5b0a01e9, BRF_GRA }, // 2 Characters - - { "airwolf.9", 0x02000, 0x25e57e1f, BRF_GRA }, // 3 Tiles - { "airwolf.8", 0x02000, 0xcf0de5e9, BRF_GRA }, // 4 - { "airwolf.7", 0x02000, 0x4050c048, BRF_GRA }, // 5 - - { "airwolf.5", 0x08000, 0xe8fbc7d2, BRF_GRA }, // 6 Sprites - { "airwolf.4", 0x08000, 0xc5d4156b, BRF_GRA }, // 7 - { "airwolf.3", 0x08000, 0xde91dfb1, BRF_GRA }, // 8 - - { "01j.bin", 0x00100, 0x6a94b2a3, BRF_GRA }, // 9 PROMs - { "01h.bin", 0x00100, 0xec0923d3, BRF_GRA }, // 10 - { "01f.bin", 0x00100, 0xade97052, BRF_GRA }, // 11 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 12 - - { "pal16l8a.2j", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, // 13 PLDs - { "epl12p6a.9j", 0x00034, 0x19808f14, BRF_OPT }, // 14 - { "epl12p6a.9k", 0x00034, 0xf5acad85, BRF_OPT }, // 15 -}; - -STD_ROM_PICK(Airwolfa) -STD_ROM_FN(Airwolfa) - -static struct BurnRomInfo SkywolfRomDesc[] = { - { "02s_03.bin", 0x04000, 0xa0891798, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "03s_04.bin", 0x04000, 0x5f515d46, BRF_ESS | BRF_PRG }, // 1 Z80 - - { "07s_01.bin", 0x04000, 0xc680a905, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - { "08s_02.bin", 0x04000, 0x3d66bf26, BRF_ESS | BRF_PRG }, // 3 Z80 - - { "04a_11.bin", 0x01000, 0x219de9aa, BRF_GRA }, // 4 Characters - - { "09h_14.bin", 0x02000, 0x25e57e1f, BRF_GRA }, // 5 Tiles - { "10h_13.bin", 0x02000, 0xcf0de5e9, BRF_GRA }, // 6 - { "11h_12.bin", 0x02000, 0x4050c048, BRF_GRA }, // 7 - - { "06a_10.bin", 0x04000, 0x1c809383, BRF_GRA }, // 6 Sprites - { "07a_09.bin", 0x04000, 0x5665d774, BRF_GRA }, // 7 - { "08a_08.bin", 0x04000, 0x6dda8f2a, BRF_GRA }, // 8 - { "09a_07.bin", 0x04000, 0x6a21ddb8, BRF_GRA }, // 9 - { "10a_06.bin", 0x04000, 0xf2e548e0, BRF_GRA }, // 10 - { "11a_05.bin", 0x04000, 0x8681b112, BRF_GRA }, // 11 - - { "01j.bin", 0x00100, 0x6a94b2a3, BRF_GRA }, // 12 PROMs - { "01h.bin", 0x00100, 0xec0923d3, BRF_GRA }, // 13 - { "01f.bin", 0x00100, 0xade97052, BRF_GRA }, // 14 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 15 -}; - -STD_ROM_PICK(Skywolf) -STD_ROM_FN(Skywolf) - -static struct BurnRomInfo Skywolf2RomDesc[] = { - { "z80_2.bin", 0x08000, 0x34db7bda, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - - { "07s_01.bin", 0x04000, 0xc680a905, BRF_ESS | BRF_PRG }, // 1 Z80 #2 Program - { "08s_02.bin", 0x04000, 0x3d66bf26, BRF_ESS | BRF_PRG }, // 2 Z80 - - { "04a_11.bin", 0x01000, 0x219de9aa, BRF_GRA }, // 3 Characters - - { "09h_14.bin", 0x02000, 0x25e57e1f, BRF_GRA }, // 4 Tiles - { "10h_13.bin", 0x02000, 0xcf0de5e9, BRF_GRA }, // 5 - { "11h_12.bin", 0x02000, 0x4050c048, BRF_GRA }, // 6 - - { "06a_10.bin", 0x04000, 0x1c809383, BRF_GRA }, // 7 Sprites - { "07a_09.bin", 0x04000, 0x5665d774, BRF_GRA }, // 8 - { "08a_08.bin", 0x04000, 0x6dda8f2a, BRF_GRA }, // 9 - { "09a_07.bin", 0x04000, 0x6a21ddb8, BRF_GRA }, // 10 - { "10a_06.bin", 0x04000, 0xf2e548e0, BRF_GRA }, // 11 - { "11a_05.bin", 0x04000, 0x8681b112, BRF_GRA }, // 12 - - { "01j.bin", 0x00100, 0x6a94b2a3, BRF_GRA }, // 13 PROMs - { "01h.bin", 0x00100, 0xec0923d3, BRF_GRA }, // 14 - { "01f.bin", 0x00100, 0xade97052, BRF_GRA }, // 15 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 16 -}; - -STD_ROM_PICK(Skywolf2) -STD_ROM_FN(Skywolf2) - -static struct BurnRomInfo Skywolf3RomDesc[] = { - { "1.bin", 0x08000, 0x74a86ec8, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "2.bin", 0x08000, 0xf02143de, BRF_ESS | BRF_PRG }, // 1 - - { "3.bin", 0x08000, 0x787cdd0a, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - { "4.bin", 0x08000, 0x07a2c814, BRF_ESS | BRF_PRG }, // 3 Z80 - - { "8.bin", 0x08000, 0xb86d3dac, BRF_GRA }, // 4 Characters - - { "11.bin", 0x08000, 0xfc7bbf7a, BRF_GRA }, // 5 Tiles - { "10.bin", 0x08000, 0x1a3710ab, BRF_GRA }, // 6 - { "9.bin", 0x08000, 0xa184349a, BRF_GRA }, // 7 - - { "7.bin", 0x08000, 0x086612e8, BRF_GRA }, // 8 Sprites - { "6.bin", 0x08000, 0x3a9beabd, BRF_GRA }, // 9 - { "5.bin", 0x08000, 0xbd83658e, BRF_GRA }, // 10 - - { "82s129-1.bin", 0x00100, 0x6a94b2a3, BRF_GRA }, // 11 PROMs - { "82s129-2.bin", 0x00100, 0xec0923d3, BRF_GRA }, // 12 - { "82s129-3.bin", 0x00100, 0xade97052, BRF_GRA }, // 13 - { "74s288-2.bin", 0x00020, 0x190a55ad, BRF_GRA }, // 14 - { "74s288-1.bin", 0x00020, 0x5ddb2d15, BRF_GRA }, // 15 -}; - -STD_ROM_PICK(Skywolf3) -STD_ROM_FN(Skywolf3) - -static struct BurnRomInfo FlashgalRomDesc[] = { - { "epr-7167.4f", 0x02000, 0xcf5ad733, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-7168.4h", 0x02000, 0x00c4851f, BRF_ESS | BRF_PRG }, // 1 - { "epr-7169.4j", 0x02000, 0x1ef0b8f7, BRF_ESS | BRF_PRG }, // 2 - { "epr-7170.4k", 0x02000, 0x885d53de, BRF_ESS | BRF_PRG }, // 3 - - { "epr-7163.2f", 0x02000, 0xeee2134d, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program - { "epr-7164.2h", 0x02000, 0xe5e0cd22, BRF_ESS | BRF_PRG }, // 5 - { "epr-7165.2j", 0x02000, 0x4cd3fe5e, BRF_ESS | BRF_PRG }, // 6 - { "epr-7166.2k", 0x02000, 0x552ca339, BRF_ESS | BRF_PRG }, // 7 - - { "epr-7177.4a", 0x01000, 0xdca9052f, BRF_GRA }, // 8 Characters - - { "epr-7178.9h", 0x02000, 0x2f5b62c0, BRF_GRA }, // 9 Tiles - { "epr-7179.10h", 0x02000, 0x8fbb49b5, BRF_GRA }, // 10 - { "epr-7180.11h", 0x02000, 0x26a8e5c3, BRF_GRA }, // 11 - - { "epr-7171.6a", 0x04000, 0x62caf2a1, BRF_GRA }, // 12 Sprites - { "epr-7172.7a", 0x04000, 0x10f78a10, BRF_GRA }, // 13 - { "epr-7173.8a", 0x04000, 0x36ea1d59, BRF_GRA }, // 14 - { "epr-7174.9a", 0x04000, 0xf527d837, BRF_GRA }, // 15 - { "epr-7175.10a", 0x04000, 0xba76e4c1, BRF_GRA }, // 16 - { "epr-7176.11a", 0x04000, 0xf095d619, BRF_GRA }, // 17 - - { "7161.1j", 0x00100, 0x02c4043f, BRF_GRA }, // 18 PROMs - { "7160.1h", 0x00100, 0x225938d1, BRF_GRA }, // 19 - { "7159.1f", 0x00100, 0x1e0a1cd3, BRF_GRA }, // 20 - { "7162.5j", 0x00020, 0xcce2e29f, BRF_GRA }, // 21 - { "bpr.2c", 0x00020, 0x83a39201, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Flashgal) -STD_ROM_FN(Flashgal) - -static struct BurnRomInfo FlashgalaRomDesc[] = { - { "flashgal.5", 0x02000, 0xaa889ace, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-7168.4h", 0x02000, 0x00c4851f, BRF_ESS | BRF_PRG }, // 1 - { "epr-7169.4j", 0x02000, 0x1ef0b8f7, BRF_ESS | BRF_PRG }, // 2 - { "epr-7170.4k", 0x02000, 0x885d53de, BRF_ESS | BRF_PRG }, // 3 - - { "flashgal.1", 0x02000, 0x55171cc1, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program - { "flashgal.2", 0x02000, 0x3fd21aac, BRF_ESS | BRF_PRG }, // 5 - { "flashgal.3", 0x02000, 0xa1223b74, BRF_ESS | BRF_PRG }, // 6 - { "flashgal.4", 0x02000, 0x04d2a05f, BRF_ESS | BRF_PRG }, // 7 - - { "epr-7177.4a", 0x01000, 0xdca9052f, BRF_GRA }, // 8 Characters - - { "epr-7178.9h", 0x02000, 0x2f5b62c0, BRF_GRA }, // 9 Tiles - { "epr-7179.10h", 0x02000, 0x8fbb49b5, BRF_GRA }, // 10 - { "epr-7180.11h", 0x02000, 0x26a8e5c3, BRF_GRA }, // 11 - - { "epr-7171.6a", 0x04000, 0x62caf2a1, BRF_GRA }, // 12 Sprites - { "epr-7172.7a", 0x04000, 0x10f78a10, BRF_GRA }, // 13 - { "epr-7173.8a", 0x04000, 0x36ea1d59, BRF_GRA }, // 14 - { "epr-7174.9a", 0x04000, 0xf527d837, BRF_GRA }, // 15 - { "epr-7175.10a", 0x04000, 0xba76e4c1, BRF_GRA }, // 16 - { "epr-7176.11a", 0x04000, 0xf095d619, BRF_GRA }, // 17 - - { "7161.1j", 0x00100, 0x02c4043f, BRF_GRA }, // 18 PROMs - { "7160.1h", 0x00100, 0x225938d1, BRF_GRA }, // 19 - { "7159.1f", 0x00100, 0x1e0a1cd3, BRF_GRA }, // 20 - { "7162.5j", 0x00020, 0xcce2e29f, BRF_GRA }, // 21 - { "bpr.2c", 0x00020, 0x83a39201, BRF_GRA }, // 22 -}; - -STD_ROM_PICK(Flashgala) -STD_ROM_FN(Flashgala) - -static struct BurnRomInfo GyrodineRomDesc[] = { - { "rom2", 0x02000, 0x85ddea38, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a21.03", 0x02000, 0x4e9323bd, BRF_ESS | BRF_PRG }, // 1 - { "a21.04", 0x02000, 0x57e659d4, BRF_ESS | BRF_PRG }, // 2 - { "a21.05", 0x02000, 0x1e7293f3, BRF_ESS | BRF_PRG }, // 3 - - { "a21.01", 0x02000, 0xb2ce0aa2, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program - - { "a21.15", 0x01000, 0xadba18d0, BRF_GRA }, // 5 Characters - - { "a21.08", 0x02000, 0xa57df1c9, BRF_GRA }, // 6 Tiles - { "a21.07", 0x02000, 0x63623ba3, BRF_GRA }, // 7 - { "a21.06", 0x02000, 0x4cc969a9, BRF_GRA }, // 8 - - { "a21.14", 0x02000, 0x9c5c4d5b, BRF_GRA }, // 9 Sprites - { "a21.13", 0x02000, 0xd36b5aad, BRF_GRA }, // 10 - { "a21.12", 0x02000, 0xf387aea2, BRF_GRA }, // 11 - { "a21.11", 0x02000, 0x87967d7d, BRF_GRA }, // 12 - { "a21.10", 0x02000, 0x59640ab4, BRF_GRA }, // 13 - { "a21.09", 0x02000, 0x22ad88d8, BRF_GRA }, // 14 - - { "a21.16", 0x00100, 0xcc25fb56, BRF_GRA }, // 15 PROMs - { "a21.17", 0x00100, 0xca054448, BRF_GRA }, // 16 - { "a21.18", 0x00100, 0x23c0c449, BRF_GRA }, // 17 - { "a21.20", 0x00020, 0xefc4985e, BRF_GRA }, // 18 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 19 -}; - -STD_ROM_PICK(Gyrodine) -STD_ROM_FN(Gyrodine) - -static struct BurnRomInfo GyrodinetRomDesc[] = { - { "a21.02", 0x02000, 0xc5ec4a50, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a21.03", 0x02000, 0x4e9323bd, BRF_ESS | BRF_PRG }, // 1 - { "a21.04", 0x02000, 0x57e659d4, BRF_ESS | BRF_PRG }, // 2 - { "a21.05", 0x02000, 0x1e7293f3, BRF_ESS | BRF_PRG }, // 3 - - { "a21.01", 0x02000, 0xb2ce0aa2, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program - - { "a21.15", 0x01000, 0xadba18d0, BRF_GRA }, // 5 Characters - - { "a21.08", 0x02000, 0xa57df1c9, BRF_GRA }, // 6 Tiles - { "a21.07", 0x02000, 0x63623ba3, BRF_GRA }, // 7 - { "a21.06", 0x02000, 0x4cc969a9, BRF_GRA }, // 8 - - { "a21.14", 0x02000, 0x9c5c4d5b, BRF_GRA }, // 9 Sprites - { "a21.13", 0x02000, 0xd36b5aad, BRF_GRA }, // 10 - { "a21.12", 0x02000, 0xf387aea2, BRF_GRA }, // 11 - { "a21.11", 0x02000, 0x87967d7d, BRF_GRA }, // 12 - { "a21.10", 0x02000, 0x59640ab4, BRF_GRA }, // 13 - { "a21.09", 0x02000, 0x22ad88d8, BRF_GRA }, // 14 - - { "a21.16", 0x00100, 0xcc25fb56, BRF_GRA }, // 15 PROMs - { "a21.17", 0x00100, 0xca054448, BRF_GRA }, // 16 - { "a21.18", 0x00100, 0x23c0c449, BRF_GRA }, // 17 - { "a21.20", 0x00020, 0xefc4985e, BRF_GRA }, // 18 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 19 -}; - -STD_ROM_PICK(Gyrodinet) -STD_ROM_FN(Gyrodinet) - -static struct BurnRomInfo BuzzardRomDesc[] = { - { "rom2", 0x02000, 0x85ddea38, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a21.03", 0x02000, 0x4e9323bd, BRF_ESS | BRF_PRG }, // 1 - { "a21.04", 0x02000, 0x57e659d4, BRF_ESS | BRF_PRG }, // 2 - { "a21.05", 0x02000, 0x1e7293f3, BRF_ESS | BRF_PRG }, // 3 - - { "a21.01", 0x02000, 0xb2ce0aa2, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program - - { "buzl01.bin", 0x01000, 0x65d728d0, BRF_GRA }, // 5 Characters - - { "a21.08", 0x02000, 0xa57df1c9, BRF_GRA }, // 6 Tiles - { "a21.07", 0x02000, 0x63623ba3, BRF_GRA }, // 7 - { "a21.06", 0x02000, 0x4cc969a9, BRF_GRA }, // 8 - - { "a21.14", 0x02000, 0x9c5c4d5b, BRF_GRA }, // 9 Sprites - { "a21.13", 0x02000, 0xd36b5aad, BRF_GRA }, // 10 - { "a21.12", 0x02000, 0xf387aea2, BRF_GRA }, // 11 - { "a21.11", 0x02000, 0x87967d7d, BRF_GRA }, // 12 - { "a21.10", 0x02000, 0x59640ab4, BRF_GRA }, // 13 - { "a21.09", 0x02000, 0x22ad88d8, BRF_GRA }, // 14 - - { "a21.16", 0x00100, 0xcc25fb56, BRF_GRA }, // 15 PROMs - { "a21.17", 0x00100, 0xca054448, BRF_GRA }, // 16 - { "a21.18", 0x00100, 0x23c0c449, BRF_GRA }, // 17 - { "a21.20", 0x00020, 0xefc4985e, BRF_GRA }, // 18 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 19 -}; - -STD_ROM_PICK(Buzzard) -STD_ROM_FN(Buzzard) - -static struct BurnRomInfo LegendRomDesc[] = { - { "a_r2.rom", 0x04000, 0x0cc1c4f4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a_r3.rom", 0x04000, 0x4b270c6b, BRF_ESS | BRF_PRG }, // 1 - - { "a_r7.rom", 0x02000, 0xabfe5eb4, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - { "a_r8.rom", 0x02000, 0x7e7b9ba9, BRF_ESS | BRF_PRG }, // 3 - { "a_r9.rom", 0x02000, 0x66737f1e, BRF_ESS | BRF_PRG }, // 4 - { "a_n7.rom", 0x02000, 0x13915a53, BRF_ESS | BRF_PRG }, // 5 - - { "b_a4.rom", 0x01000, 0xc7dd3cf7, BRF_GRA }, // 6 Characters - - { "b_h9.rom", 0x02000, 0x1fe8644a, BRF_GRA }, // 7 Tiles - { "b_h10.rom", 0x02000, 0x5f7dc82e, BRF_GRA }, // 8 - { "b_h11.rom", 0x02000, 0x46741643, BRF_GRA }, // 9 - - { "b_a6.rom", 0x04000, 0x1689f21c, BRF_GRA }, // 10 Sprites - { "b_a7.rom", 0x04000, 0xf527c909, BRF_GRA }, // 11 - { "b_a8.rom", 0x04000, 0x8d618629, BRF_GRA }, // 12 - { "b_a9.rom", 0x04000, 0x7d7e2d55, BRF_GRA }, // 13 - { "b_a10.rom", 0x04000, 0xf12232fe, BRF_GRA }, // 14 - { "b_a11.rom", 0x04000, 0x8c09243d, BRF_GRA }, // 15 - - { "82s129.1j", 0x00100, 0x40590ac0, BRF_GRA }, // 16 PROMs - { "82s129.1h", 0x00100, 0xe542b363, BRF_GRA }, // 17 - { "82s129.1f", 0x00100, 0x75536fc8, BRF_GRA }, // 18 - { "82s123.5j", 0x00020, 0xc98f0651, BRF_GRA }, // 19 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 - - { "epl10p8.2j", 0x0002c, 0x8abc03bf, BRF_OPT }, // 21 PLDs - { "epl12p6.9k", 0x00034, 0x9b0bd6f8, BRF_OPT }, // 22 - { "epl12p6.9j", 0x00034, 0xdcae870d, BRF_OPT }, // 23 -}; - -STD_ROM_PICK(Legend) -STD_ROM_FN(Legend) - -static struct BurnRomInfo SonofphxRomDesc[] = { - { "5.f4", 0x02000, 0xe0d2c6cf, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "6.h4", 0x02000, 0x3a0d0336, BRF_ESS | BRF_PRG }, // 1 - { "7.j4", 0x02000, 0x57a8e900, BRF_ESS | BRF_PRG }, // 2 - - { "1.f2", 0x02000, 0xc485c621, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - { "2.h2", 0x02000, 0xb3c6a886, BRF_ESS | BRF_PRG }, // 4 - { "3.j2", 0x02000, 0x197e314c, BRF_ESS | BRF_PRG }, // 5 - { "4.k2", 0x02000, 0x4f3695a1, BRF_ESS | BRF_PRG }, // 6 - - { "14.4a", 0x01000, 0xb3859b8b, BRF_GRA }, // 7 Characters - - { "15.9h", 0x02000, 0xc9213469, BRF_GRA }, // 8 Tiles - { "16.10h", 0x02000, 0x7de5d39e, BRF_GRA }, // 9 - { "17.11h", 0x02000, 0x0ba5f72c, BRF_GRA }, // 10 - - { "8.6a", 0x04000, 0x0e9f757e, BRF_GRA }, // 11 Sprites - { "9.7a", 0x04000, 0xf7d2e650, BRF_GRA }, // 12 - { "10.8a", 0x04000, 0xe717baf4, BRF_GRA }, // 13 - { "11.9a", 0x04000, 0x04b2250b, BRF_GRA }, // 14 - { "12.10a", 0x04000, 0xd110e140, BRF_GRA }, // 15 - { "13.11a", 0x04000, 0x8fdc713c, BRF_GRA }, // 16 - - { "b.1j", 0x00100, 0x3ea35431, BRF_GRA }, // 17 PROMs - { "g.1h", 0x00100, 0xacd7a69e, BRF_GRA }, // 18 - { "r.1f", 0x00100, 0xb7f48b41, BRF_GRA }, // 19 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 -}; - -STD_ROM_PICK(Sonofphx) -STD_ROM_FN(Sonofphx) - -static struct BurnRomInfo RepulseRomDesc[] = { - { "repulse.b5", 0x02000, 0xfb2b7c9d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "repulse.b6", 0x02000, 0x99129918, BRF_ESS | BRF_PRG }, // 1 - { "7.j4", 0x02000, 0x57a8e900, BRF_ESS | BRF_PRG }, // 2 - - { "1.f2", 0x02000, 0xc485c621, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - { "2.h2", 0x02000, 0xb3c6a886, BRF_ESS | BRF_PRG }, // 4 - { "3.j2", 0x02000, 0x197e314c, BRF_ESS | BRF_PRG }, // 5 - { "repulse.b4", 0x02000, 0x86b267f3, BRF_ESS | BRF_PRG }, // 6 - - { "repulse.a11", 0x01000, 0x8e1de90a, BRF_GRA }, // 7 Characters - - { "15.9h", 0x02000, 0xc9213469, BRF_GRA }, // 8 Tiles - { "16.10h", 0x02000, 0x7de5d39e, BRF_GRA }, // 9 - { "17.11h", 0x02000, 0x0ba5f72c, BRF_GRA }, // 10 - - { "8.6a", 0x04000, 0x0e9f757e, BRF_GRA }, // 11 Sprites - { "9.7a", 0x04000, 0xf7d2e650, BRF_GRA }, // 12 - { "10.8a", 0x04000, 0xe717baf4, BRF_GRA }, // 13 - { "11.9a", 0x04000, 0x04b2250b, BRF_GRA }, // 14 - { "12.10a", 0x04000, 0xd110e140, BRF_GRA }, // 15 - { "13.11a", 0x04000, 0x8fdc713c, BRF_GRA }, // 16 - - { "b.1j", 0x00100, 0x3ea35431, BRF_GRA }, // 17 PROMs - { "g.1h", 0x00100, 0xacd7a69e, BRF_GRA }, // 18 - { "r.1f", 0x00100, 0xb7f48b41, BRF_GRA }, // 19 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 -}; - -STD_ROM_PICK(Repulse) -STD_ROM_FN(Repulse) - -static struct BurnRomInfo Lstwar99RomDesc[] = { - { "1999.4f", 0x02000, 0xe3cfc09f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "1999.4h", 0x02000, 0xfd58c6e1, BRF_ESS | BRF_PRG }, // 1 - { "7.j4", 0x02000, 0x57a8e900, BRF_ESS | BRF_PRG }, // 2 - - { "1.f2", 0x02000, 0xc485c621, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - { "2.h2", 0x02000, 0xb3c6a886, BRF_ESS | BRF_PRG }, // 4 - { "3.j2", 0x02000, 0x197e314c, BRF_ESS | BRF_PRG }, // 5 - { "repulse.b4", 0x02000, 0x86b267f3, BRF_ESS | BRF_PRG }, // 6 - - { "1999.4a", 0x01000, 0x49a2383e, BRF_GRA }, // 7 Characters - - { "15.9h", 0x02000, 0xc9213469, BRF_GRA }, // 8 Tiles - { "16.10h", 0x02000, 0x7de5d39e, BRF_GRA }, // 9 - { "17.11h", 0x02000, 0x0ba5f72c, BRF_GRA }, // 10 - - { "8.6a", 0x04000, 0x0e9f757e, BRF_GRA }, // 11 Sprites - { "9.7a", 0x04000, 0xf7d2e650, BRF_GRA }, // 12 - { "10.8a", 0x04000, 0xe717baf4, BRF_GRA }, // 13 - { "11.9a", 0x04000, 0x04b2250b, BRF_GRA }, // 14 - { "12.10a", 0x04000, 0xd110e140, BRF_GRA }, // 15 - { "13.11a", 0x04000, 0x8fdc713c, BRF_GRA }, // 16 - - { "b.1j", 0x00100, 0x3ea35431, BRF_GRA }, // 17 PROMs - { "g.1h", 0x00100, 0xacd7a69e, BRF_GRA }, // 18 - { "r.1f", 0x00100, 0xb7f48b41, BRF_GRA }, // 19 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 -}; - -STD_ROM_PICK(Lstwar99) -STD_ROM_FN(Lstwar99) - -static struct BurnRomInfo Lstwra99RomDesc[] = { - { "4f.bin", 0x02000, 0xefe2908d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "4h.bin", 0x02000, 0x5b79c342, BRF_ESS | BRF_PRG }, // 1 - { "4j.bin", 0x02000, 0xd2a62c1b, BRF_ESS | BRF_PRG }, // 2 - - { "2f.bin", 0x02000, 0xcb9d8291, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - { "2h.bin", 0x02000, 0x24dbddc3, BRF_ESS | BRF_PRG }, // 4 - { "2j.bin", 0x02000, 0x16879c4c, BRF_ESS | BRF_PRG }, // 5 - { "repulse.b4", 0x02000, 0x86b267f3, BRF_ESS | BRF_PRG }, // 6 - - { "1999.4a", 0x01000, 0x49a2383e, BRF_GRA }, // 7 Characters - - { "9h.bin", 0x02000, 0x59993c27, BRF_GRA }, // 8 Tiles - { "10h.bin", 0x02000, 0xdfbf0280, BRF_GRA }, // 9 - { "11h.bin", 0x02000, 0xe4f29fc0, BRF_GRA }, // 10 - - { "6a.bin", 0x04000, 0x98d44410, BRF_GRA }, // 11 Sprites - { "7a.bin", 0x04000, 0x4c54d281, BRF_GRA }, // 12 - { "8a.bin", 0x04000, 0x81018101, BRF_GRA }, // 13 - { "9a.bin", 0x04000, 0x347b91fd, BRF_GRA }, // 14 - { "10a.bin", 0x04000, 0xf07de4fa, BRF_GRA }, // 15 - { "11a.bin", 0x04000, 0x34a04f48, BRF_GRA }, // 16 - - { "b.1j", 0x00100, 0x3ea35431, BRF_GRA }, // 17 PROMs - { "g.1h", 0x00100, 0xacd7a69e, BRF_GRA }, // 18 - { "r.1f", 0x00100, 0xb7f48b41, BRF_GRA }, // 19 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 -}; - -STD_ROM_PICK(Lstwra99) -STD_ROM_FN(Lstwra99) - -static struct BurnRomInfo Lstwrk99RomDesc[] = { - { "1999.4f", 0x02000, 0xe3cfc09f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "1999.4h", 0x02000, 0xfd58c6e1, BRF_ESS | BRF_PRG }, // 1 - { "7.j4", 0x02000, 0x57a8e900, BRF_ESS | BRF_PRG }, // 2 - - { "1.f2", 0x02000, 0xc485c621, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - { "2.h2", 0x02000, 0xb3c6a886, BRF_ESS | BRF_PRG }, // 4 - { "3.j2", 0x02000, 0x197e314c, BRF_ESS | BRF_PRG }, // 5 - { "repulse.b4", 0x02000, 0x86b267f3, BRF_ESS | BRF_PRG }, // 6 - - { "1999-14.rom", 0x01000, 0xb4995072, BRF_GRA }, // 7 Characters - - { "15.9h", 0x02000, 0xc9213469, BRF_GRA }, // 8 Tiles - { "16.10h", 0x02000, 0x7de5d39e, BRF_GRA }, // 9 - { "17.11h", 0x02000, 0x0ba5f72c, BRF_GRA }, // 10 - - { "8.6a", 0x04000, 0x0e9f757e, BRF_GRA }, // 11 Sprites - { "9.7a", 0x04000, 0xf7d2e650, BRF_GRA }, // 12 - { "10.8a", 0x04000, 0xe717baf4, BRF_GRA }, // 13 - { "11.9a", 0x04000, 0x04b2250b, BRF_GRA }, // 14 - { "12.10a", 0x04000, 0xd110e140, BRF_GRA }, // 15 - { "13.11a", 0x04000, 0x8fdc713c, BRF_GRA }, // 16 - - { "b.1j", 0x00100, 0x3ea35431, BRF_GRA }, // 17 PROMs - { "g.1h", 0x00100, 0xacd7a69e, BRF_GRA }, // 18 - { "r.1f", 0x00100, 0xb7f48b41, BRF_GRA }, // 19 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 - { "1999-00.rom", 0x00800, 0x0c0c449f, BRF_GRA }, // 21 -}; - -STD_ROM_PICK(Lstwrk99) -STD_ROM_FN(Lstwrk99) - -static struct BurnRomInfo SrdmissnRomDesc[] = { - { "5.t2", 0x04000, 0xa682b48c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "7.t3", 0x04000, 0x1719c58c, BRF_ESS | BRF_PRG }, // 1 - - { "1.t7", 0x04000, 0xdc48595e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - { "3.t8", 0x04000, 0x216be1e8, BRF_ESS | BRF_PRG }, // 3 - - { "15.4a", 0x01000, 0x4961f7fd, BRF_GRA }, // 4 Characters - - { "17.9h", 0x02000, 0x41211458, BRF_GRA }, // 5 Tiles - { "18.10h", 0x02000, 0x740eccd4, BRF_GRA }, // 6 - { "16.11h", 0x02000, 0xc1f4a5db, BRF_GRA }, // 7 - - { "14.6a", 0x04000, 0x3d4c0447, BRF_GRA }, // 8 Sprites - { "13.7a", 0x04000, 0x22414a67, BRF_GRA }, // 9 - { "12.8a", 0x04000, 0x61e34283, BRF_GRA }, // 10 - { "11.9a", 0x04000, 0xbbbaffef, BRF_GRA }, // 11 - { "10.10a", 0x04000, 0xde564f97, BRF_GRA }, // 12 - { "9.11a", 0x04000, 0x890dc815, BRF_GRA }, // 13 - - { "mr.1j", 0x00100, 0x110a436e, BRF_GRA }, // 14 PROMs - { "mg.1h", 0x00100, 0x0fbfd9f0, BRF_GRA }, // 15 - { "mb.1f", 0x00100, 0xa342890c, BRF_GRA }, // 16 - { "m2.5j", 0x00020, 0x190a55ad, BRF_GRA }, // 17 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 18 -}; - -STD_ROM_PICK(Srdmissn) -STD_ROM_FN(Srdmissn) - -static struct BurnRomInfo FxRomDesc[] = { - { "fx.01", 0x04000, 0xb651754b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "fx.02", 0x04000, 0xf3d2dcc1, BRF_ESS | BRF_PRG }, // 1 - - { "fx.03", 0x04000, 0x8907df6b, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - { "fx.04", 0x04000, 0xc665834f, BRF_ESS | BRF_PRG }, // 3 - - { "fx.05", 0x01000, 0x4a504286, BRF_GRA }, // 4 Characters - - { "17.9h", 0x02000, 0x41211458, BRF_GRA }, // 5 Tiles - { "18.10h", 0x02000, 0x740eccd4, BRF_GRA }, // 6 - { "16.11h", 0x02000, 0xc1f4a5db, BRF_GRA }, // 7 - - { "14.6a", 0x04000, 0x3d4c0447, BRF_GRA }, // 8 Sprites - { "13.7a", 0x04000, 0x22414a67, BRF_GRA }, // 9 - { "12.8a", 0x04000, 0x61e34283, BRF_GRA }, // 10 - { "11.9a", 0x04000, 0xbbbaffef, BRF_GRA }, // 11 - { "10.10a", 0x04000, 0xde564f97, BRF_GRA }, // 12 - { "9.11a", 0x04000, 0x890dc815, BRF_GRA }, // 13 - - { "mr.1j", 0x00100, 0x110a436e, BRF_GRA }, // 14 PROMs - { "mg.1h", 0x00100, 0x0fbfd9f0, BRF_GRA }, // 15 - { "mb.1f", 0x00100, 0xa342890c, BRF_GRA }, // 16 - { "m2.5j", 0x00020, 0x190a55ad, BRF_GRA }, // 17 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 18 -}; - -STD_ROM_PICK(Fx) -STD_ROM_FN(Fx) - -// f205v id 989 -// same data as fx, different format -static struct BurnRomInfo FxaRomDesc[] = { - { "fxa1.t4", 0x08000, 0xa71332aa, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - - { "fxa2.t8", 0x08000, 0xeb299381, BRF_ESS | BRF_PRG }, // 1 Z80 #2 Program - - { "fx.05", 0x01000, 0x4a504286, BRF_GRA }, // 2 Characters - - { "17.9h", 0x02000, 0x41211458, BRF_GRA }, // 3 Tiles - { "18.10h", 0x02000, 0x740eccd4, BRF_GRA }, // 4 - { "16.11h", 0x02000, 0xc1f4a5db, BRF_GRA }, // 5 - - { "fxa5.7a", 0x08000, 0x3e2289dc, BRF_GRA }, // 6 Sprites - { "fxa4.9a", 0x08000, 0x26963d7f, BRF_GRA }, // 7 - { "fxa3.11a", 0x08000, 0x8687f1a0, BRF_GRA }, // 8 - - { "mr.1j", 0x00100, 0x110a436e, BRF_GRA }, // 9 PROMs - { "mg.1h", 0x00100, 0x0fbfd9f0, BRF_GRA }, // 10 - { "mb.1f", 0x00100, 0xa342890c, BRF_GRA }, // 11 - { "m2.5j", 0x00020, 0x190a55ad, BRF_GRA }, // 12 - { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 13 -}; - -STD_ROM_PICK(Fxa) -STD_ROM_FN(Fxa) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - KyugoZ80Rom1 = Next; Next += 0x08000; - KyugoZ80Rom2 = Next; Next += 0x08000; - KyugoPromRed = Next; Next += 0x00100; - KyugoPromGreen = Next; Next += 0x00100; - KyugoPromBlue = Next; Next += 0x00100; - KyugoPromCharLookup = Next; Next += 0x00020; - - RamStart = Next; - - KyugoSharedZ80Ram = Next; Next += 0x00800; - KyugoZ80Ram2 = Next; Next += 0x00800; - KyugoSprite1Ram = Next; Next += 0x00800; - KyugoSprite2Ram = Next; Next += 0x00800; - KyugoFgVideoRam = Next; Next += 0x00800; - KyugoBgVideoRam = Next; Next += 0x00800; - KyugoBgAttrRam = Next; Next += 0x00800; - - RamEnd = Next; - - KyugoChars = Next; Next += 0x100 * 8 * 8; - KyugoTiles = Next; Next += 0x400 * 8 * 8; - KyugoSprites = Next; Next += 0x400 * 16 * 16; - pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); - KyugoPalette = (UINT32*)Next; Next += 256 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 KyugoDoReset() -{ - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - for (INT32 i = 0; i < 2; i++) { - AY8910Reset(i); - } - - KyugoIRQEnable = 0; - KyugoSubCPUEnable = 0; - KyugoFgColour = 0; - KyugoBgPaletteBank = 0; - KyugoBgScrollXHi = 0; - KyugoBgScrollXLo = 0; - KyugoBgScrollY = 0; - KyugoFlipScreen = 0; - - return 0; -} - -UINT8 __fastcall KyugoRead1(UINT16 a) -{ - if (a >= 0x9800 && a <= 0x9fff) { - return KyugoSprite2Ram[a - 0x9800] | 0xf0; - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall KyugoWrite1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xa800: { - KyugoBgScrollXLo = d; - return; - } - - case 0xb000: { - KyugoBgScrollXHi = d & 1; - KyugoFgColour = (d & 0x20) >> 5; - KyugoBgPaletteBank = (d & 0x40) >> 6; - return; - } - - case 0xb800: { - KyugoBgScrollY = d; - return; - } - - - case 0xe000: { - // watchdog write - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall FlashgalPortWrite1(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x40: { - KyugoIRQEnable = d & 1; - return; - } - - case 0x41: { - KyugoFlipScreen = d & 1; - return; - } - - case 0x42: { - KyugoSubCPUEnable = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall FlashgalaPortWrite1(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0xc0: { - KyugoIRQEnable = d & 1; - return; - } - - case 0xc1: { - KyugoFlipScreen = d & 1; - return; - } - - case 0xc2: { - KyugoSubCPUEnable = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall GyrodinePortWrite1(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - KyugoIRQEnable = d & 1; - return; - } - - case 0x01: { - KyugoFlipScreen = d & 1; - return; - } - - case 0x02: { - KyugoSubCPUEnable = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall SrdmissnPortWrite1(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x08: { - KyugoIRQEnable = d & 1; - return; - } - - case 0x09: { - KyugoFlipScreen = d & 1; - return; - } - - case 0x0a: { - KyugoSubCPUEnable = d & 1; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall FlashgalRead2(UINT16 a) -{ - switch (a) { - case 0xc000: { - return KyugoInput[2]; - } - - case 0xc040: { - return KyugoInput[1]; - } - - case 0xc080: { - return KyugoInput[0]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall FlashgalaRead2(UINT16 a) -{ - switch (a) { - case 0xc040: { - return KyugoInput[0]; - } - - case 0xc080: { - return KyugoInput[1]; - } - - case 0xc0c0: { - return KyugoInput[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall GyrodineRead2(UINT16 a) -{ - switch (a) { - case 0x8000: { - return KyugoInput[2]; - } - - case 0x8040: { - return KyugoInput[1]; - } - - case 0x8080: { - return KyugoInput[0]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall SrdmissnRead2(UINT16 a) -{ - switch (a) { - case 0xf400: { - return KyugoInput[0]; - } - - case 0xf401: { - return KyugoInput[1]; - } - - case 0xf402: { - return KyugoInput[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall LegendRead2(UINT16 a) -{ - switch (a) { - case 0xf800: { - return KyugoInput[0]; - } - - case 0xf801: { - return KyugoInput[1]; - } - - case 0xf802: { - return KyugoInput[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall KyugoWrite2(UINT16 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall KyugoPortRead2(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x02: { - return AY8910Read(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall FlashgalaPortRead2(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x42: { - return AY8910Read(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall SrdmissnPortRead2(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x82: { - return AY8910Read(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall FlashgalPortWrite2(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - AY8910Write(0, 0, d); - return; - } - - case 0x01: { - AY8910Write(0, 1, d); - return; - } - - case 0x40: { - AY8910Write(1, 0, d); - return; - } - - case 0x41: { - AY8910Write(1, 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall FlashgalaPortWrite2(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x40: { - AY8910Write(0, 0, d); - return; - } - - case 0x41: { - AY8910Write(0, 1, d); - return; - } - - case 0x80: { - AY8910Write(1, 0, d); - return; - } - - case 0x81: { - AY8910Write(1, 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall GyrodinePortWrite2(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - AY8910Write(0, 0, d); - return; - } - - case 0x01: { - AY8910Write(0, 1, d); - return; - } - - case 0xc0: { - AY8910Write(1, 0, d); - return; - } - - case 0xc1: { - AY8910Write(1, 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall SrdmissnPortWrite2(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x80: { - AY8910Write(0, 0, d); - return; - } - - case 0x81: { - AY8910Write(0, 1, d); - return; - } - - case 0x84: { - AY8910Write(1, 0, d); - return; - } - - case 0x85: { - AY8910Write(1, 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); - } - } -} - -static INT32 CharPlaneOffsets[2] = { 0, 4 }; -static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 64, 65, 66, 67 }; -static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 TilePlaneOffsets[3] = { 0, 0x10000, 0x20000 }; -static INT32 TileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 TileYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 SpritePlaneOffsets[3] = { 0, 0x40000, 0x80000 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; -static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; - -static UINT8 KyugoDip0Read(UINT32 /*a*/) -{ - return KyugoDip[0]; -} - -static UINT8 KyugoDip1Read(UINT32 /*a*/) -{ - return KyugoDip[1]; -} - -static INT32 KyugoInit() -{ - INT32 nRet = 0, nLen, i; - - KyugoNumZ80Rom1 = 4; - KyugoNumZ80Rom2 = 4; - KyugoNumSpriteRom = 6; - KyugoSizeZ80Rom1 = 0x2000; - KyugoSizeZ80Rom2 = 0x2000; - KyugoSizeSpriteRom = 0x4000; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "airwolf") || !strcmp(BurnDrvGetTextA(DRV_NAME), "airwolfa")) { - KyugoNumZ80Rom1 = 1; - KyugoNumZ80Rom2 = 1; - KyugoNumSpriteRom = 3; - KyugoSizeZ80Rom1 = 0x8000; - KyugoSizeZ80Rom2 = 0x8000; - KyugoSizeSpriteRom = 0x8000; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodine") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodinet") || !strcmp(BurnDrvGetTextA(DRV_NAME), "buzzard")) { - KyugoNumZ80Rom2 = 1; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "legend")) { - KyugoNumZ80Rom1 = 2; - KyugoNumZ80Rom2 = 4; - KyugoSizeZ80Rom1 = 0x4000; - KyugoSizeZ80Rom2 = 0x2000; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "sonofphx") || !strcmp(BurnDrvGetTextA(DRV_NAME), "repulse") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwar") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwara") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwark")) { - KyugoNumZ80Rom1 = 3; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "skywolf") || !strcmp(BurnDrvGetTextA(DRV_NAME), "srdmissn") || !strcmp(BurnDrvGetTextA(DRV_NAME), "fx")) { - KyugoNumZ80Rom1 = 2; - KyugoNumZ80Rom2 = 2; - KyugoSizeZ80Rom1 = 0x4000; - KyugoSizeZ80Rom2 = 0x4000; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "skywolf2")) { - KyugoNumZ80Rom1 = 1; - KyugoNumZ80Rom2 = 2; - KyugoSizeZ80Rom1 = 0x8000; - KyugoSizeZ80Rom2 = 0x4000; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "fxa")) { - KyugoNumZ80Rom1 = 1; - KyugoNumZ80Rom2 = 1; - KyugoNumSpriteRom = 3; - KyugoSizeZ80Rom1 = 0x8000; - KyugoSizeZ80Rom2 = 0x8000; - KyugoSizeSpriteRom = 0x8000; - } - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - KyugoTempRom = (UINT8 *)BurnMalloc(0x18000); - - // Load Z80 #1 Program Roms - for (i = 0; i < KyugoNumZ80Rom1; i++) { - nRet = BurnLoadRom(KyugoZ80Rom1 + (KyugoSizeZ80Rom1 * i), i, 1); if (nRet != 0) return 1; - } - - // Load Z80 #2 Program Roms - for (i = KyugoNumZ80Rom1; i < KyugoNumZ80Rom2 + KyugoNumZ80Rom1; i++) { - nRet = BurnLoadRom(KyugoZ80Rom2 + (KyugoSizeZ80Rom2 * (i - KyugoNumZ80Rom1)), i, 1); if (nRet != 0) return 1; - } - - // Load and decode the chars - nRet = BurnLoadRom(KyugoTempRom, KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 0, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, KyugoTempRom, KyugoChars); - - // Load and decode the tiles - memset(KyugoTempRom, 0, 0x18000); - nRet = BurnLoadRom(KyugoTempRom + 0x00000, KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(KyugoTempRom + 0x02000, KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(KyugoTempRom + 0x04000, KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 3, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 3, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, KyugoTempRom, KyugoTiles); - - // Load and decode the sprites - memset(KyugoTempRom, 0, 0x18000); - for (i = KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 4; i < KyugoNumSpriteRom + KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 4; i++) { - nRet = BurnLoadRom(KyugoTempRom + (KyugoSizeSpriteRom * (i - KyugoNumZ80Rom2 - KyugoNumZ80Rom1 - 4)), i, 1); if (nRet != 0) return 1; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "airwolf") || !strcmp(BurnDrvGetTextA(DRV_NAME), "airwolfa")) { - UINT8 *Temp = (UINT8*)BurnMalloc(0x18000); - memcpy(Temp, KyugoTempRom, 0x18000); - memcpy(KyugoTempRom + 0x00000, Temp + 0x00000, 0x2000); - memcpy(KyugoTempRom + 0x04000, Temp + 0x02000, 0x2000); - memcpy(KyugoTempRom + 0x02000, Temp + 0x04000, 0x2000); - memcpy(KyugoTempRom + 0x06000, Temp + 0x06000, 0x2000); - memcpy(KyugoTempRom + 0x08000, Temp + 0x08000, 0x2000); - memcpy(KyugoTempRom + 0x0c000, Temp + 0x0a000, 0x2000); - memcpy(KyugoTempRom + 0x0a000, Temp + 0x0c000, 0x2000); - memcpy(KyugoTempRom + 0x0e000, Temp + 0x0e000, 0x2000); - memcpy(KyugoTempRom + 0x10000, Temp + 0x10000, 0x2000); - memcpy(KyugoTempRom + 0x14000, Temp + 0x12000, 0x2000); - memcpy(KyugoTempRom + 0x12000, Temp + 0x14000, 0x2000); - memcpy(KyugoTempRom + 0x16000, Temp + 0x16000, 0x2000); - BurnFree(Temp); - } - GfxDecode(0x400, 3, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, KyugoTempRom, KyugoSprites); - - // Load the PROMs - nRet = BurnLoadRom(KyugoPromRed, KyugoNumSpriteRom + KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(KyugoPromGreen, KyugoNumSpriteRom + KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(KyugoPromBlue, KyugoNumSpriteRom + KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 6, 1); if (nRet != 0) return 1; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "flashgal") || !strcmp(BurnDrvGetTextA(DRV_NAME), "flashgala") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodine") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodinet") || !strcmp(BurnDrvGetTextA(DRV_NAME), "buzzard") || !strcmp(BurnDrvGetTextA(DRV_NAME), "legend") || !strcmp(BurnDrvGetTextA(DRV_NAME), "srdmissn") || !strcmp(BurnDrvGetTextA(DRV_NAME), "fx") || !strcmp(BurnDrvGetTextA(DRV_NAME), "fxa")) { - nRet = BurnLoadRom(KyugoPromCharLookup, KyugoNumSpriteRom + KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 7, 1); if (nRet != 0) return 1; - } - - BurnFree(KyugoTempRom); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(KyugoRead1); - ZetSetWriteHandler(KyugoWrite1); - ZetMapArea(0x0000, 0x7fff, 0, KyugoZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, KyugoZ80Rom1 ); - ZetMapArea(0x8000, 0x87ff, 0, KyugoBgVideoRam ); - ZetMapArea(0x8000, 0x87ff, 1, KyugoBgVideoRam ); - ZetMapArea(0x8000, 0x87ff, 2, KyugoBgVideoRam ); - ZetMapArea(0x8800, 0x8fff, 0, KyugoBgAttrRam ); - ZetMapArea(0x8800, 0x8fff, 1, KyugoBgAttrRam ); - ZetMapArea(0x8800, 0x8fff, 2, KyugoBgAttrRam ); - ZetMapArea(0x9000, 0x97ff, 0, KyugoFgVideoRam ); - ZetMapArea(0x9000, 0x97ff, 1, KyugoFgVideoRam ); - ZetMapArea(0x9000, 0x97ff, 2, KyugoFgVideoRam ); - ZetMapArea(0x9800, 0x9fff, 1, KyugoSprite2Ram ); - ZetMapArea(0x9800, 0x9fff, 2, KyugoSprite2Ram ); - ZetMapArea(0xa000, 0xa7ff, 0, KyugoSprite1Ram ); - ZetMapArea(0xa000, 0xa7ff, 1, KyugoSprite1Ram ); - ZetMapArea(0xa000, 0xa7ff, 2, KyugoSprite1Ram ); - ZetMapArea(0xf000, 0xf7ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 2, KyugoSharedZ80Ram ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetWriteHandler(KyugoWrite2); - ZetSetInHandler(KyugoPortRead2); - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodine") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodinet") || !strcmp(BurnDrvGetTextA(DRV_NAME), "buzzard")) { - ZetMapArea(0x0000, 0x1fff, 0, KyugoZ80Rom2 ); - ZetMapArea(0x0000, 0x1fff, 2, KyugoZ80Rom2 ); - } else { - ZetMapArea(0x0000, 0x7fff, 0, KyugoZ80Rom2 ); - ZetMapArea(0x0000, 0x7fff, 2, KyugoZ80Rom2 ); - } - ZetMemEnd(); - ZetClose(); - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "airwolf") || !strcmp(BurnDrvGetTextA(DRV_NAME), "airwolfa") || !strcmp(BurnDrvGetTextA(DRV_NAME), "skywolf") || !strcmp(BurnDrvGetTextA(DRV_NAME), "skywolf2")) { - ZetOpen(0); - ZetSetOutHandler(SrdmissnPortWrite1); - ZetMapArea(0xe000, 0xe7ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 2, KyugoSharedZ80Ram ); - ZetClose(); - - ZetOpen(1); - ZetSetReadHandler(SrdmissnRead2); - ZetSetInHandler(SrdmissnPortRead2); - ZetSetOutHandler(SrdmissnPortWrite2); - ZetMapArea(0x8000, 0x87ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 2, KyugoSharedZ80Ram ); - ZetClose(); - } - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "flashgal")) { - ZetOpen(0); - ZetSetOutHandler(FlashgalPortWrite1); - ZetClose(); - - ZetOpen(1); - ZetSetReadHandler(FlashgalRead2); - ZetSetOutHandler(FlashgalPortWrite2); - ZetMapArea(0xa000, 0xa7ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0xa000, 0xa7ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0xa000, 0xa7ff, 2, KyugoSharedZ80Ram ); - ZetClose(); - } - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "flashgala")) { - ZetOpen(0); - ZetSetOutHandler(FlashgalaPortWrite1); - ZetClose(); - - ZetOpen(1); - ZetSetReadHandler(FlashgalaRead2); - ZetSetInHandler(FlashgalaPortRead2); - ZetSetOutHandler(FlashgalaPortWrite2); - ZetMapArea(0xe000, 0xe7ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 2, KyugoSharedZ80Ram ); - ZetClose(); - } - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodine") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodinet") || !strcmp(BurnDrvGetTextA(DRV_NAME), "buzzard")) { - ZetOpen(0); - ZetSetOutHandler(GyrodinePortWrite1); - ZetClose(); - - ZetOpen(1); - ZetSetReadHandler(GyrodineRead2); - ZetSetOutHandler(GyrodinePortWrite2); - ZetMapArea(0x4000, 0x47ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0x4000, 0x47ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0x4000, 0x47ff, 2, KyugoSharedZ80Ram ); - ZetClose(); - } - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "legend")) { - ZetOpen(0); - ZetSetOutHandler(GyrodinePortWrite1); - ZetClose(); - - ZetOpen(1); - ZetSetReadHandler(LegendRead2); - ZetSetInHandler(SrdmissnPortRead2); - ZetSetOutHandler(SrdmissnPortWrite2); - ZetMapArea(0xc000, 0xc7ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 2, KyugoSharedZ80Ram ); - ZetClose(); - } - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "sonofphx") || !strcmp(BurnDrvGetTextA(DRV_NAME), "repulse") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwar") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwara") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwark")) { - ZetOpen(0); - ZetSetOutHandler(GyrodinePortWrite1); - ZetClose(); - - ZetOpen(1); - ZetSetReadHandler(FlashgalRead2); - ZetSetOutHandler(FlashgalPortWrite2); - ZetMapArea(0xa000, 0xa7ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0xa000, 0xa7ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0xa000, 0xa7ff, 2, KyugoSharedZ80Ram ); - ZetClose(); - } - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "srdmissn") || !strcmp(BurnDrvGetTextA(DRV_NAME), "fx") || !strcmp(BurnDrvGetTextA(DRV_NAME), "fxa")) { - ZetOpen(0); - ZetSetOutHandler(SrdmissnPortWrite1); - ZetMapArea(0xe000, 0xe7ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 2, KyugoSharedZ80Ram ); - ZetClose(); - - ZetOpen(1); - ZetSetReadHandler(SrdmissnRead2); - ZetSetInHandler(SrdmissnPortRead2); - ZetSetOutHandler(SrdmissnPortWrite2); - ZetMapArea(0x8000, 0x87ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 2, KyugoSharedZ80Ram ); - ZetMapArea(0x8800, 0x8fff, 0, KyugoZ80Ram2 ); - ZetMapArea(0x8800, 0x8fff, 1, KyugoZ80Ram2 ); - ZetMapArea(0x8800, 0x8fff, 2, KyugoZ80Ram2 ); - ZetClose(); - } - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - - AY8910Init(0, 18432000 / 12, nBurnSoundRate, &KyugoDip0Read, &KyugoDip1Read, NULL, NULL); - AY8910Init(1, 18432000 / 12, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.30, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - KyugoDoReset(); - - return 0; -} - -static INT32 Skywolf3Init() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - KyugoTempRom = (UINT8 *)BurnMalloc(0x18000); - UINT8 *pTemp = (UINT8*)BurnMalloc(0x8000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(pTemp, 0, 1); if (nRet != 0) return 1; - memcpy(KyugoZ80Rom1 + 0x00000, pTemp + 0x04000, 0x4000); - nRet = BurnLoadRom(pTemp, 1, 1); if (nRet != 0) return 1; - memcpy(KyugoZ80Rom1 + 0x04000, pTemp + 0x04000, 0x4000); - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(pTemp, 2, 1); if (nRet != 0) return 1; - memcpy(KyugoZ80Rom2 + 0x00000, pTemp + 0x04000, 0x4000); - nRet = BurnLoadRom(pTemp, 3, 1); if (nRet != 0) return 1; - memcpy(KyugoZ80Rom2 + 0x04000, pTemp + 0x04000, 0x4000); - - // Load and decode the chars - nRet = BurnLoadRom(pTemp, 4, 1); if (nRet != 0) return 1; - memcpy(KyugoTempRom + 0x00000, pTemp + 0x07000, 0x1000); - GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, KyugoTempRom, KyugoChars); - - // Load and decode the tiles - memset(KyugoTempRom, 0, 0x18000); - nRet = BurnLoadRom(pTemp, 5, 1); if (nRet != 0) return 1; - memcpy(KyugoTempRom + 0x00000, pTemp + 0x06000, 0x2000); - nRet = BurnLoadRom(pTemp, 6, 1); if (nRet != 0) return 1; - memcpy(KyugoTempRom + 0x02000, pTemp + 0x06000, 0x2000); - nRet = BurnLoadRom(pTemp, 7, 1); if (nRet != 0) return 1; - memcpy(KyugoTempRom + 0x04000, pTemp + 0x06000, 0x2000); - GfxDecode(0x400, 3, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, KyugoTempRom, KyugoTiles); - - // Load and decode the sprites - memset(KyugoTempRom, 0, 0x18000); - nRet = BurnLoadRom(KyugoTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(KyugoTempRom + 0x08000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(KyugoTempRom + 0x10000, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 3, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, KyugoTempRom, KyugoSprites); - - // Load the PROMs - nRet = BurnLoadRom(KyugoPromRed, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(KyugoPromGreen, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(KyugoPromBlue, 13, 1); if (nRet != 0) return 1; - - BurnFree(KyugoTempRom); - BurnFree(pTemp); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(KyugoRead1); - ZetSetWriteHandler(KyugoWrite1); - ZetMapArea(0x0000, 0x7fff, 0, KyugoZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, KyugoZ80Rom1 ); - ZetMapArea(0x8000, 0x87ff, 0, KyugoBgVideoRam ); - ZetMapArea(0x8000, 0x87ff, 1, KyugoBgVideoRam ); - ZetMapArea(0x8000, 0x87ff, 2, KyugoBgVideoRam ); - ZetMapArea(0x8800, 0x8fff, 0, KyugoBgAttrRam ); - ZetMapArea(0x8800, 0x8fff, 1, KyugoBgAttrRam ); - ZetMapArea(0x8800, 0x8fff, 2, KyugoBgAttrRam ); - ZetMapArea(0x9000, 0x97ff, 0, KyugoFgVideoRam ); - ZetMapArea(0x9000, 0x97ff, 1, KyugoFgVideoRam ); - ZetMapArea(0x9000, 0x97ff, 2, KyugoFgVideoRam ); - ZetMapArea(0x9800, 0x9fff, 1, KyugoSprite2Ram ); - ZetMapArea(0x9800, 0x9fff, 2, KyugoSprite2Ram ); - ZetMapArea(0xa000, 0xa7ff, 0, KyugoSprite1Ram ); - ZetMapArea(0xa000, 0xa7ff, 1, KyugoSprite1Ram ); - ZetMapArea(0xa000, 0xa7ff, 2, KyugoSprite1Ram ); - ZetMapArea(0xf000, 0xf7ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0xf000, 0xf7ff, 2, KyugoSharedZ80Ram ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetWriteHandler(KyugoWrite2); - ZetSetInHandler(KyugoPortRead2); - ZetMapArea(0x0000, 0x7fff, 0, KyugoZ80Rom2 ); - ZetMapArea(0x0000, 0x7fff, 2, KyugoZ80Rom2 ); - ZetMemEnd(); - ZetClose(); - - ZetOpen(0); - ZetSetOutHandler(SrdmissnPortWrite1); - ZetMapArea(0xe000, 0xe7ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 2, KyugoSharedZ80Ram ); - ZetClose(); - - ZetOpen(1); - ZetSetReadHandler(SrdmissnRead2); - ZetSetInHandler(SrdmissnPortRead2); - ZetSetOutHandler(SrdmissnPortWrite2); - ZetMapArea(0x8000, 0x87ff, 0, KyugoSharedZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 1, KyugoSharedZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 2, KyugoSharedZ80Ram ); - ZetClose(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - - AY8910Init(0, 18432000 / 12, nBurnSoundRate, &KyugoDip0Read, &KyugoDip1Read, NULL, NULL); - AY8910Init(1, 18432000 / 12, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.30, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - KyugoDoReset(); - - return 0; -} - -static INT32 KyugoExit() -{ - ZetExit(); - - for (INT32 i = 0; i < 2; i++) { - AY8910Exit(i); - } - - GenericTilesExit(); - - KyugoIRQEnable = 0; - KyugoSubCPUEnable = 0; - KyugoFgColour = 0; - KyugoBgPaletteBank = 0; - KyugoBgScrollXHi = 0; - KyugoBgScrollXLo = 0; - KyugoBgScrollY = 0; - KyugoFlipScreen = 0; - - KyugoNumZ80Rom1 = 0; - KyugoNumZ80Rom2 = 0; - KyugoNumSpriteRom = 0; - KyugoSizeZ80Rom1 = 0; - KyugoSizeZ80Rom2 = 0; - KyugoSizeSpriteRom = 0; - - BurnFree(Mem); - - return 0; -} - -static void KyugoCalcPalette() -{ - INT32 i; - - for (i = 0; i < 256; i++) { - INT32 bit0, bit1, bit2, bit3, r, g, b; - - bit0 = (KyugoPromRed[i] >> 0) & 0x01; - bit1 = (KyugoPromRed[i] >> 1) & 0x01; - bit2 = (KyugoPromRed[i] >> 2) & 0x01; - bit3 = (KyugoPromRed[i] >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (KyugoPromGreen[i] >> 0) & 0x01; - bit1 = (KyugoPromGreen[i] >> 1) & 0x01; - bit2 = (KyugoPromGreen[i] >> 2) & 0x01; - bit3 = (KyugoPromGreen[i] >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (KyugoPromBlue[i] >> 0) & 0x01; - bit1 = (KyugoPromBlue[i] >> 1) & 0x01; - bit2 = (KyugoPromBlue[i] >> 2) & 0x01; - bit3 = (KyugoPromBlue[i] >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - KyugoPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static void KyugoRenderBgLayer() -{ - INT32 mx, my, Code, Attr, Colour, x, y, TileIndex = 0, xScroll, Flip, xFlip, yFlip; - - xScroll = KyugoBgScrollXLo + (KyugoBgScrollXHi * 256); - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Code = KyugoBgVideoRam[TileIndex]; - Attr = KyugoBgAttrRam[TileIndex]; - Code = Code | ((Attr & 0x03) << 8); - Code &= 0x3ff; - Colour = (Attr >> 4) | (KyugoBgPaletteBank << 4); - Flip = (Attr & 0x0c) >> 2; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - - x = 8 * mx; - y = 8 * my; - - if (KyugoFlipScreen) { - xFlip = !xFlip; - yFlip = !yFlip; - y = 248 - y; - x = 504 - x; - x -= xScroll; - y += KyugoBgScrollY; - } else { - x -= xScroll; - y -= KyugoBgScrollY; - } - - if (x < -8) x += 512; - if (y < -8) y += 256; - if (y > 264) y -= 256; - - x -= 32; - y -= 16; - - if (x > 8 && x < 280 && y > 8 && y < 216) { - if (xFlip) { - if (yFlip) { - Render8x8Tile_FlipXY(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); - } else { - Render8x8Tile_FlipX(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); - } - } else { - if (yFlip) { - Render8x8Tile_FlipY(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); - } else { - Render8x8Tile(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render8x8Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); - } else { - Render8x8Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); - } - } else { - if (yFlip) { - Render8x8Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); - } else { - Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); - } - } - } - - TileIndex++; - } - } -} - -static void KyugoRenderSpriteLayer() -{ - UINT8 *SpriteRam_Area1 = &KyugoSprite1Ram[0x28]; - UINT8 *SpriteRam_Area2 = &KyugoSprite2Ram[0x28]; - UINT8 *SpriteRam_Area3 = &KyugoFgVideoRam[0x28]; - - INT32 i; - - for (i = 0; i < 24; i++) { - INT32 Offset, y, sy, sx, Colour; - - Offset = 2 * (i % 12) + 64 * (i / 12); - - sx = SpriteRam_Area3[Offset + 1] + 256 * (SpriteRam_Area2[Offset + 1] & 1); - if (sx > 320) sx -= 512; - sy = 255 - SpriteRam_Area1[Offset] + 2; - if (sy > 0xf0) sy -= 256; - if (KyugoFlipScreen) sy = 240 - sy; - sy -= 16; - - Colour = SpriteRam_Area1[Offset + 1] & 0x1f; - - for (y = 0; y < 16; y++) { - INT32 Code, Attr, FlipX, FlipY, yPos; - - Code = SpriteRam_Area3[Offset + 128 * y]; - Attr = SpriteRam_Area2[Offset + 128 * y]; - Code = Code | ((Attr & 0x01) << 9) | ((Attr & 0x02) << 7); - Code &= 0x3ff; - - FlipX = Attr & 0x08; - FlipY = Attr & 0x04; - - yPos = sy + 16 * y; - - if (KyugoFlipScreen) { - FlipX = !FlipX; - FlipY = !FlipY; - yPos = sy - 16 * y; - } - - if (sx > 16 && sx < 272 && yPos > 16 && yPos < 208) { - if (FlipX) { - if (FlipY) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); - } - } else { - if (FlipY) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); - } else { - Render16x16Tile_Mask(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); - } - } - } else { - if (FlipX) { - if (FlipY) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); - } - } else { - if (FlipY) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); - } - } - } - } - } -} - -static void KyugoRenderCharLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0, FlipX = 0, FlipY = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Code = KyugoFgVideoRam[TileIndex]; - Colour = 2 * KyugoPromCharLookup[Code >> 3] + KyugoFgColour; - Code &= 0xff; - - x = 8 * mx; - y = 8 * my; - - if (KyugoFlipScreen) { - FlipX = 1; - FlipY = 1; - y = 248 - y; - x = 280 - x; - } - - y -= 16; - - if (x > 0 && x < 280 && y > 0 && y < 216) { - if (FlipX) { - if (FlipY) { - Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); - } else { - Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); - } - } else { - if (FlipY) { - Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); - } else { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); - } - } - } else { - if (FlipX) { - if (FlipY) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); - } else { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); - } - } else { - if (FlipY) { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); - } - } - } - - TileIndex++; - } - } -} - -static void KyugoDraw() -{ - BurnTransferClear(); - KyugoCalcPalette(); - KyugoRenderBgLayer(); - KyugoRenderSpriteLayer(); - KyugoRenderCharLayer(); - BurnTransferCopy(KyugoPalette); -} - -static INT32 KyugoFrame() -{ - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - - if (KyugoReset) KyugoDoReset(); - - KyugoMakeInputs(); - - nCyclesTotal[0] = (18432000 / 6) / 60; - nCyclesTotal[1] = (18432000 / 6) / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 9 && KyugoIRQEnable) ZetNmi(); - ZetClose(); - - // Run Z80 #2 - nCurrentCPU = 1; - if (KyugoSubCPUEnable) { - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 2 || i == 4 || i == 6 || i == 8) ZetRaiseIrq(0); - ZetClose(); - } - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - - if (pBurnDraw) KyugoDraw(); - - return 0; -} - -static INT32 KyugoScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029674; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); // Scan Z80 - AY8910Scan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(KyugoDip); - SCAN_VAR(KyugoInput); - SCAN_VAR(KyugoIRQEnable); - SCAN_VAR(KyugoSubCPUEnable); - SCAN_VAR(KyugoFgColour); - SCAN_VAR(KyugoBgPaletteBank); - SCAN_VAR(KyugoBgScrollXHi); - SCAN_VAR(KyugoBgScrollXLo); - SCAN_VAR(KyugoBgScrollY); - SCAN_VAR(KyugoFlipScreen); - } - - - return 0; -} - -struct BurnDriver BurnDrvAirwolf = { - "airwolf", NULL, NULL, NULL, "1987", - "Airwolf\0", NULL, "Kyugo", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, AirwolfRomInfo, AirwolfRomName, NULL, NULL, KyugoInputInfo, AirwolfDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAirwolfa = { - "airwolfa", "airwolf", NULL, NULL, "1987", - "Airwolf (US)\0", NULL, "Kyugo (UA Theatre license)", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, AirwolfaRomInfo, AirwolfaRomName, NULL, NULL, KyugoInputInfo, AirwolfDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSkywolf = { - "skywolf", "airwolf", NULL, NULL, "1987", - "Sky Wolf (set 1)\0", NULL, "bootleg", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, SkywolfRomInfo, SkywolfRomName, NULL, NULL, KyugoInputInfo, SkywolfDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSkywolf2 = { - "skywolf2", "airwolf", NULL, NULL, "1987", - "Sky Wolf (set 2)\0", NULL, "bootleg", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, Skywolf2RomInfo, Skywolf2RomName, NULL, NULL, KyugoInputInfo, AirwolfDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSkywolf3 = { - "skywolf3", "airwolf", NULL, NULL, "1987", - "Sky Wolf (set 3)\0", NULL, "bootleg", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, Skywolf3RomInfo, Skywolf3RomName, NULL, NULL, KyugoInputInfo, AirwolfDIPInfo, - Skywolf3Init, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFlashgal = { - "flashgal", NULL, NULL, NULL, "1985", - "Flashgal (set 1)\0", NULL, "Sega", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, FlashgalRomInfo, FlashgalRomName, NULL, NULL, KyugoInputInfo, FlashgalDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFlashgala = { - "flashgala", "flashgal", NULL, NULL, "1985", - "Flashgal (set 2)\0", NULL, "Sega", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, FlashgalaRomInfo, FlashgalaRomName, NULL, NULL, KyugoInputInfo, FlashgalDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGyrodine = { - "gyrodine", NULL, NULL, NULL, "1984", - "Gyrodine\0", NULL, "Crux", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, GyrodineRomInfo, GyrodineRomName, NULL, NULL, KyugoInputInfo, GyrodineDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvGyrodinet = { - "gyrodinet", "gyrodine", NULL, NULL, "1984", - "Gyrodine (Taito Corporation license)\0", NULL, "Crux (Taito Corporation license)", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, GyrodinetRomInfo, GyrodinetRomName, NULL, NULL, KyugoInputInfo, GyrodineDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvBuzzard = { - "buzzard", "gyrodine", NULL, NULL, "1984", - "Buzzard\0", NULL, "Crux", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, BuzzardRomInfo, BuzzardRomName, NULL, NULL, KyugoInputInfo, GyrodineDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvLegend = { - "legend", NULL, NULL, NULL, "1986", - "Legend\0", NULL, "Sega / Coreland", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, LegendRomInfo, LegendRomName, NULL, NULL, KyugoInputInfo, LegendDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSonofphx = { - "sonofphx", "repulse", NULL, NULL, "1985", - "Son of Phoenix\0", NULL, "Associated Overseas MFR, Inc", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, SonofphxRomInfo, SonofphxRomName, NULL, NULL, KyugoInputInfo, SonofphxDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvRepulse = { - "repulse", NULL, NULL, NULL, "1985", - "Repulse\0", NULL, "Sega", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, RepulseRomInfo, RepulseRomName, NULL, NULL, KyugoInputInfo, SonofphxDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrv99lstwar = { - "99lstwar", "repulse", NULL, NULL, "1985", - "'99: The Last War\0", NULL, "Proma", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, Lstwar99RomInfo, Lstwar99RomName, NULL, NULL, KyugoInputInfo, SonofphxDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrv99lstwara = { - "99lstwara", "repulse", NULL, NULL, "1985", - "'99: The Last War (alternate)\0", NULL, "Proma", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, Lstwra99RomInfo, Lstwra99RomName, NULL, NULL, KyugoInputInfo, SonofphxDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrv99lstwark = { - "99lstwark", "repulse", NULL, NULL, "1985", - "'99: The Last War (Kyugo)\0", NULL, "Kyugo", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, Lstwrk99RomInfo, Lstwrk99RomName, NULL, NULL, KyugoInputInfo, SonofphxDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvSrdmissn = { - "srdmissn", NULL, NULL, NULL, "1986", - "S.R.D. Mission\0", NULL, "Taito Corporation", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, SrdmissnRomInfo, SrdmissnRomName, NULL, NULL, KyugoInputInfo, SrdmissnDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvFx = { - "fx", "srdmissn", NULL, NULL, "1986", - "F-X\0", NULL, "bootleg", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, FxRomInfo, FxRomName, NULL, NULL, KyugoInputInfo, SrdmissnDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; - -struct BurnDriver BurnDrvFxa = { - "fxa", "srdmissn", NULL, NULL, "1986", - "F-X (alternate set)\0", NULL, "bootleg", "Kyugo", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, FxaRomInfo, FxaRomName, NULL, NULL, KyugoInputInfo, SrdmissnDIPInfo, - KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, - NULL, 0x100, 224, 288, 3, 4 -}; +#include "tiles_generic.h" +#include "z80_intf.h" + +#include "driver.h" +extern "C" { + #include "ay8910.h" +} + +static UINT8 KyugoInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 KyugoInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 KyugoInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 KyugoDip[2] = {0, 0}; +static UINT8 KyugoInput[3] = {0x00, 0x00, 0x00}; +static UINT8 KyugoReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *KyugoZ80Rom1 = NULL; +static UINT8 *KyugoZ80Rom2 = NULL; +static UINT8 *KyugoSharedZ80Ram = NULL; +static UINT8 *KyugoZ80Ram2 = NULL; +static UINT8 *KyugoSprite1Ram = NULL; +static UINT8 *KyugoSprite2Ram = NULL; +static UINT8 *KyugoFgVideoRam = NULL; +static UINT8 *KyugoBgVideoRam = NULL; +static UINT8 *KyugoBgAttrRam = NULL; +static UINT8 *KyugoPromRed = NULL; +static UINT8 *KyugoPromGreen = NULL; +static UINT8 *KyugoPromBlue = NULL; +static UINT8 *KyugoPromCharLookup = NULL; +static UINT8 *KyugoChars = NULL; +static UINT8 *KyugoTiles = NULL; +static UINT8 *KyugoSprites = NULL; +static UINT8 *KyugoTempRom = NULL; +static UINT32 *KyugoPalette = NULL; +static INT16* pFMBuffer; +static INT16* pAY8910Buffer[6]; + +static UINT8 KyugoIRQEnable; +static UINT8 KyugoSubCPUEnable; +static UINT8 KyugoFgColour; +static UINT8 KyugoBgPaletteBank; +static UINT8 KyugoBgScrollXHi; +static UINT8 KyugoBgScrollXLo; +static UINT8 KyugoBgScrollY; +static UINT8 KyugoFlipScreen; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static INT32 KyugoNumZ80Rom1; +static INT32 KyugoNumZ80Rom2; +static INT32 KyugoNumSpriteRom; +static INT32 KyugoSizeZ80Rom1; +static INT32 KyugoSizeZ80Rom2; +static INT32 KyugoSizeSpriteRom; + +static struct BurnInputInfo KyugoInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , KyugoInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , KyugoInputPort0 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , KyugoInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , KyugoInputPort0 + 4, "p2 start" }, + + {"Up" , BIT_DIGITAL , KyugoInputPort1 + 2, "p1 up" }, + {"Down" , BIT_DIGITAL , KyugoInputPort1 + 3, "p1 down" }, + {"Left" , BIT_DIGITAL , KyugoInputPort1 + 0, "p1 left" }, + {"Right" , BIT_DIGITAL , KyugoInputPort1 + 1, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , KyugoInputPort1 + 4, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , KyugoInputPort1 + 5, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 2, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 3, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 0, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 1, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 4, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , KyugoInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &KyugoReset , "reset" }, + {"Service" , BIT_DIGITAL , KyugoInputPort0 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH, KyugoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, KyugoDip + 1 , "dip" }, +}; + + +STDINPUTINFO(Kyugo) + +inline void KyugoClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +inline void KyugoMakeInputs() +{ + // Reset Inputs + KyugoInput[0] = KyugoInput[1] = KyugoInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + KyugoInput[0] |= (KyugoInputPort0[i] & 1) << i; + KyugoInput[1] |= (KyugoInputPort1[i] & 1) << i; + KyugoInput[2] |= (KyugoInputPort2[i] & 1) << i; + } + + // Clear Opposites + KyugoClearOpposites(&KyugoInput[1]); + KyugoClearOpposites(&KyugoInput[2]); +} + +static struct BurnDIPInfo AirwolfDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xbb, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "4" }, + {0x12, 0x01, 0x03, 0x02, "5" }, + {0x12, 0x01, 0x03, 0x01, "6" }, + {0x12, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x12, 0x01, 0x04, 0x04, "Off" }, + {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Slow Motion" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Sound Test" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x40, 0x00, "Upright" }, + {0x12, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, + {0x13, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, +}; + +STDDIPINFO(Airwolf) + +static struct BurnDIPInfo SkywolfDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xbb, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x12, 0x01, 0x04, 0x04, "Off" }, + {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Slow Motion" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Sound Test" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x40, 0x00, "Upright" }, + {0x12, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, + {0x13, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, +}; + +STDDIPINFO(Skywolf) + +static struct BurnDIPInfo FlashgalDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xaf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x12, 0x01, 0x04, 0x04, "Every 50000" }, + {0x12, 0x01, 0x04, 0x00, "Every 70000" }, + + {0 , 0xfe, 0 , 2 , "Slow Motion" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Sound Test" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x40, 0x00, "Upright" }, + {0x12, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, + {0x13, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, +}; + +STDDIPINFO(Flashgal) + +static struct BurnDIPInfo GyrodineDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xbf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x12, 0x01, 0x10, 0x10, "Easy" }, + {0x12, 0x01, 0x10, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x12, 0x01, 0x20, 0x20, "20000 50000" }, + {0x12, 0x01, 0x20, 0x00, "40000 70000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x40, 0x00, "Upright" }, + {0x12, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, + {0x13, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, +}; + +STDDIPINFO(Gyrodine) + +static struct BurnDIPInfo LegendDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xbf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life / Continue" }, + {0x12, 0x01, 0x04, 0x04, "Every 50000 / No" }, + {0x12, 0x01, 0x04, 0x00, "Every 70000 / Yes" }, + + {0 , 0xfe, 0 , 2 , "Slow Motion" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Sound Test" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x40, 0x00, "Upright" }, + {0x12, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, + {0x13, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, +}; + +STDDIPINFO(Legend) + +static struct BurnDIPInfo SonofphxDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xbf, NULL }, + {0x13, 0xff, 0xff, 0xbf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x12, 0x01, 0x04, 0x04, "Every 50000" }, + {0x12, 0x01, 0x04, 0x00, "Every 70000" }, + + {0 , 0xfe, 0 , 2 , "Slow Motion" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Sound Test" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x40, 0x00, "Upright" }, + {0x12, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, + {0x13, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0xc0, 0xc0, "Easy" }, + {0x13, 0x01, 0xc0, 0x80, "Normal" }, + {0x13, 0x01, 0xc0, 0x40, "Hard" }, + {0x13, 0x01, 0xc0, 0x00, "Hardest" }, +}; + +STDDIPINFO(Sonofphx) + +static struct BurnDIPInfo SrdmissnDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xbf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life / Continue" }, + {0x12, 0x01, 0x04, 0x04, "Every 50000 / No" }, + {0x12, 0x01, 0x04, 0x00, "Every 70000 / Yes" }, + + {0 , 0xfe, 0 , 2 , "Slow Motion" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Sound Test" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x40, 0x00, "Upright" }, + {0x12, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 2 Plays" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, + {0x13, 0x01, 0x07, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x13, 0x01, 0x38, 0x20, "3 Coins 4 Plays" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, +}; + +STDDIPINFO(Srdmissn) + +static struct BurnRomInfo AirwolfRomDesc[] = { + { "b.2s", 0x08000, 0x8c993cce, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + + { "a.7s", 0x08000, 0xa3c7af5c, BRF_ESS | BRF_PRG }, // 1 Z80 #2 Program + + { "f.4a", 0x01000, 0x4df44ce9, BRF_GRA }, // 2 Characters + + { "09h_14.bin", 0x02000, 0x25e57e1f, BRF_GRA }, // 3 Tiles + { "10h_13.bin", 0x02000, 0xcf0de5e9, BRF_GRA }, // 4 + { "11h_12.bin", 0x02000, 0x4050c048, BRF_GRA }, // 5 + + { "e.6a", 0x08000, 0xe8fbc7d2, BRF_GRA }, // 6 Sprites + { "d.8a", 0x08000, 0xc5d4156b, BRF_GRA }, // 7 + { "c.10a", 0x08000, 0xde91dfb1, BRF_GRA }, // 8 + + { "01j.bin", 0x00100, 0x6a94b2a3, BRF_GRA }, // 9 PROMs + { "01h.bin", 0x00100, 0xec0923d3, BRF_GRA }, // 10 + { "01f.bin", 0x00100, 0xade97052, BRF_GRA }, // 11 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 12 + + { "pal16l8a.2j", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, // 13 PLDs + { "epl12p6a.9j", 0x00034, 0x19808f14, BRF_OPT }, // 14 + { "epl12p6a.9k", 0x00034, 0xf5acad85, BRF_OPT }, // 15 +}; + +STD_ROM_PICK(Airwolf) +STD_ROM_FN(Airwolf) + +static struct BurnRomInfo AirwolfaRomDesc[] = { + { "airwolf.2", 0x08000, 0xbc1a8587, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + + { "airwolf.1", 0x08000, 0xa3c7af5c, BRF_ESS | BRF_PRG }, // 1 Z80 #2 Program + + { "airwolf.6", 0x02000, 0x5b0a01e9, BRF_GRA }, // 2 Characters + + { "airwolf.9", 0x02000, 0x25e57e1f, BRF_GRA }, // 3 Tiles + { "airwolf.8", 0x02000, 0xcf0de5e9, BRF_GRA }, // 4 + { "airwolf.7", 0x02000, 0x4050c048, BRF_GRA }, // 5 + + { "airwolf.5", 0x08000, 0xe8fbc7d2, BRF_GRA }, // 6 Sprites + { "airwolf.4", 0x08000, 0xc5d4156b, BRF_GRA }, // 7 + { "airwolf.3", 0x08000, 0xde91dfb1, BRF_GRA }, // 8 + + { "01j.bin", 0x00100, 0x6a94b2a3, BRF_GRA }, // 9 PROMs + { "01h.bin", 0x00100, 0xec0923d3, BRF_GRA }, // 10 + { "01f.bin", 0x00100, 0xade97052, BRF_GRA }, // 11 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 12 + + { "pal16l8a.2j", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, // 13 PLDs + { "epl12p6a.9j", 0x00034, 0x19808f14, BRF_OPT }, // 14 + { "epl12p6a.9k", 0x00034, 0xf5acad85, BRF_OPT }, // 15 +}; + +STD_ROM_PICK(Airwolfa) +STD_ROM_FN(Airwolfa) + +static struct BurnRomInfo SkywolfRomDesc[] = { + { "02s_03.bin", 0x04000, 0xa0891798, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "03s_04.bin", 0x04000, 0x5f515d46, BRF_ESS | BRF_PRG }, // 1 Z80 + + { "07s_01.bin", 0x04000, 0xc680a905, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + { "08s_02.bin", 0x04000, 0x3d66bf26, BRF_ESS | BRF_PRG }, // 3 Z80 + + { "04a_11.bin", 0x01000, 0x219de9aa, BRF_GRA }, // 4 Characters + + { "09h_14.bin", 0x02000, 0x25e57e1f, BRF_GRA }, // 5 Tiles + { "10h_13.bin", 0x02000, 0xcf0de5e9, BRF_GRA }, // 6 + { "11h_12.bin", 0x02000, 0x4050c048, BRF_GRA }, // 7 + + { "06a_10.bin", 0x04000, 0x1c809383, BRF_GRA }, // 6 Sprites + { "07a_09.bin", 0x04000, 0x5665d774, BRF_GRA }, // 7 + { "08a_08.bin", 0x04000, 0x6dda8f2a, BRF_GRA }, // 8 + { "09a_07.bin", 0x04000, 0x6a21ddb8, BRF_GRA }, // 9 + { "10a_06.bin", 0x04000, 0xf2e548e0, BRF_GRA }, // 10 + { "11a_05.bin", 0x04000, 0x8681b112, BRF_GRA }, // 11 + + { "01j.bin", 0x00100, 0x6a94b2a3, BRF_GRA }, // 12 PROMs + { "01h.bin", 0x00100, 0xec0923d3, BRF_GRA }, // 13 + { "01f.bin", 0x00100, 0xade97052, BRF_GRA }, // 14 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 15 +}; + +STD_ROM_PICK(Skywolf) +STD_ROM_FN(Skywolf) + +static struct BurnRomInfo Skywolf2RomDesc[] = { + { "z80_2.bin", 0x08000, 0x34db7bda, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + + { "07s_01.bin", 0x04000, 0xc680a905, BRF_ESS | BRF_PRG }, // 1 Z80 #2 Program + { "08s_02.bin", 0x04000, 0x3d66bf26, BRF_ESS | BRF_PRG }, // 2 Z80 + + { "04a_11.bin", 0x01000, 0x219de9aa, BRF_GRA }, // 3 Characters + + { "09h_14.bin", 0x02000, 0x25e57e1f, BRF_GRA }, // 4 Tiles + { "10h_13.bin", 0x02000, 0xcf0de5e9, BRF_GRA }, // 5 + { "11h_12.bin", 0x02000, 0x4050c048, BRF_GRA }, // 6 + + { "06a_10.bin", 0x04000, 0x1c809383, BRF_GRA }, // 7 Sprites + { "07a_09.bin", 0x04000, 0x5665d774, BRF_GRA }, // 8 + { "08a_08.bin", 0x04000, 0x6dda8f2a, BRF_GRA }, // 9 + { "09a_07.bin", 0x04000, 0x6a21ddb8, BRF_GRA }, // 10 + { "10a_06.bin", 0x04000, 0xf2e548e0, BRF_GRA }, // 11 + { "11a_05.bin", 0x04000, 0x8681b112, BRF_GRA }, // 12 + + { "01j.bin", 0x00100, 0x6a94b2a3, BRF_GRA }, // 13 PROMs + { "01h.bin", 0x00100, 0xec0923d3, BRF_GRA }, // 14 + { "01f.bin", 0x00100, 0xade97052, BRF_GRA }, // 15 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 16 +}; + +STD_ROM_PICK(Skywolf2) +STD_ROM_FN(Skywolf2) + +static struct BurnRomInfo Skywolf3RomDesc[] = { + { "1.bin", 0x08000, 0x74a86ec8, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "2.bin", 0x08000, 0xf02143de, BRF_ESS | BRF_PRG }, // 1 + + { "3.bin", 0x08000, 0x787cdd0a, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + { "4.bin", 0x08000, 0x07a2c814, BRF_ESS | BRF_PRG }, // 3 Z80 + + { "8.bin", 0x08000, 0xb86d3dac, BRF_GRA }, // 4 Characters + + { "11.bin", 0x08000, 0xfc7bbf7a, BRF_GRA }, // 5 Tiles + { "10.bin", 0x08000, 0x1a3710ab, BRF_GRA }, // 6 + { "9.bin", 0x08000, 0xa184349a, BRF_GRA }, // 7 + + { "7.bin", 0x08000, 0x086612e8, BRF_GRA }, // 8 Sprites + { "6.bin", 0x08000, 0x3a9beabd, BRF_GRA }, // 9 + { "5.bin", 0x08000, 0xbd83658e, BRF_GRA }, // 10 + + { "82s129-1.bin", 0x00100, 0x6a94b2a3, BRF_GRA }, // 11 PROMs + { "82s129-2.bin", 0x00100, 0xec0923d3, BRF_GRA }, // 12 + { "82s129-3.bin", 0x00100, 0xade97052, BRF_GRA }, // 13 + { "74s288-2.bin", 0x00020, 0x190a55ad, BRF_GRA }, // 14 + { "74s288-1.bin", 0x00020, 0x5ddb2d15, BRF_GRA }, // 15 +}; + +STD_ROM_PICK(Skywolf3) +STD_ROM_FN(Skywolf3) + +static struct BurnRomInfo FlashgalRomDesc[] = { + { "epr-7167.4f", 0x02000, 0xcf5ad733, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-7168.4h", 0x02000, 0x00c4851f, BRF_ESS | BRF_PRG }, // 1 + { "epr-7169.4j", 0x02000, 0x1ef0b8f7, BRF_ESS | BRF_PRG }, // 2 + { "epr-7170.4k", 0x02000, 0x885d53de, BRF_ESS | BRF_PRG }, // 3 + + { "epr-7163.2f", 0x02000, 0xeee2134d, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program + { "epr-7164.2h", 0x02000, 0xe5e0cd22, BRF_ESS | BRF_PRG }, // 5 + { "epr-7165.2j", 0x02000, 0x4cd3fe5e, BRF_ESS | BRF_PRG }, // 6 + { "epr-7166.2k", 0x02000, 0x552ca339, BRF_ESS | BRF_PRG }, // 7 + + { "epr-7177.4a", 0x01000, 0xdca9052f, BRF_GRA }, // 8 Characters + + { "epr-7178.9h", 0x02000, 0x2f5b62c0, BRF_GRA }, // 9 Tiles + { "epr-7179.10h", 0x02000, 0x8fbb49b5, BRF_GRA }, // 10 + { "epr-7180.11h", 0x02000, 0x26a8e5c3, BRF_GRA }, // 11 + + { "epr-7171.6a", 0x04000, 0x62caf2a1, BRF_GRA }, // 12 Sprites + { "epr-7172.7a", 0x04000, 0x10f78a10, BRF_GRA }, // 13 + { "epr-7173.8a", 0x04000, 0x36ea1d59, BRF_GRA }, // 14 + { "epr-7174.9a", 0x04000, 0xf527d837, BRF_GRA }, // 15 + { "epr-7175.10a", 0x04000, 0xba76e4c1, BRF_GRA }, // 16 + { "epr-7176.11a", 0x04000, 0xf095d619, BRF_GRA }, // 17 + + { "7161.1j", 0x00100, 0x02c4043f, BRF_GRA }, // 18 PROMs + { "7160.1h", 0x00100, 0x225938d1, BRF_GRA }, // 19 + { "7159.1f", 0x00100, 0x1e0a1cd3, BRF_GRA }, // 20 + { "7162.5j", 0x00020, 0xcce2e29f, BRF_GRA }, // 21 + { "bpr.2c", 0x00020, 0x83a39201, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Flashgal) +STD_ROM_FN(Flashgal) + +static struct BurnRomInfo FlashgalaRomDesc[] = { + { "flashgal.5", 0x02000, 0xaa889ace, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-7168.4h", 0x02000, 0x00c4851f, BRF_ESS | BRF_PRG }, // 1 + { "epr-7169.4j", 0x02000, 0x1ef0b8f7, BRF_ESS | BRF_PRG }, // 2 + { "epr-7170.4k", 0x02000, 0x885d53de, BRF_ESS | BRF_PRG }, // 3 + + { "flashgal.1", 0x02000, 0x55171cc1, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program + { "flashgal.2", 0x02000, 0x3fd21aac, BRF_ESS | BRF_PRG }, // 5 + { "flashgal.3", 0x02000, 0xa1223b74, BRF_ESS | BRF_PRG }, // 6 + { "flashgal.4", 0x02000, 0x04d2a05f, BRF_ESS | BRF_PRG }, // 7 + + { "epr-7177.4a", 0x01000, 0xdca9052f, BRF_GRA }, // 8 Characters + + { "epr-7178.9h", 0x02000, 0x2f5b62c0, BRF_GRA }, // 9 Tiles + { "epr-7179.10h", 0x02000, 0x8fbb49b5, BRF_GRA }, // 10 + { "epr-7180.11h", 0x02000, 0x26a8e5c3, BRF_GRA }, // 11 + + { "epr-7171.6a", 0x04000, 0x62caf2a1, BRF_GRA }, // 12 Sprites + { "epr-7172.7a", 0x04000, 0x10f78a10, BRF_GRA }, // 13 + { "epr-7173.8a", 0x04000, 0x36ea1d59, BRF_GRA }, // 14 + { "epr-7174.9a", 0x04000, 0xf527d837, BRF_GRA }, // 15 + { "epr-7175.10a", 0x04000, 0xba76e4c1, BRF_GRA }, // 16 + { "epr-7176.11a", 0x04000, 0xf095d619, BRF_GRA }, // 17 + + { "7161.1j", 0x00100, 0x02c4043f, BRF_GRA }, // 18 PROMs + { "7160.1h", 0x00100, 0x225938d1, BRF_GRA }, // 19 + { "7159.1f", 0x00100, 0x1e0a1cd3, BRF_GRA }, // 20 + { "7162.5j", 0x00020, 0xcce2e29f, BRF_GRA }, // 21 + { "bpr.2c", 0x00020, 0x83a39201, BRF_GRA }, // 22 +}; + +STD_ROM_PICK(Flashgala) +STD_ROM_FN(Flashgala) + +static struct BurnRomInfo GyrodineRomDesc[] = { + { "rom2", 0x02000, 0x85ddea38, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a21.03", 0x02000, 0x4e9323bd, BRF_ESS | BRF_PRG }, // 1 + { "a21.04", 0x02000, 0x57e659d4, BRF_ESS | BRF_PRG }, // 2 + { "a21.05", 0x02000, 0x1e7293f3, BRF_ESS | BRF_PRG }, // 3 + + { "a21.01", 0x02000, 0xb2ce0aa2, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program + + { "a21.15", 0x01000, 0xadba18d0, BRF_GRA }, // 5 Characters + + { "a21.08", 0x02000, 0xa57df1c9, BRF_GRA }, // 6 Tiles + { "a21.07", 0x02000, 0x63623ba3, BRF_GRA }, // 7 + { "a21.06", 0x02000, 0x4cc969a9, BRF_GRA }, // 8 + + { "a21.14", 0x02000, 0x9c5c4d5b, BRF_GRA }, // 9 Sprites + { "a21.13", 0x02000, 0xd36b5aad, BRF_GRA }, // 10 + { "a21.12", 0x02000, 0xf387aea2, BRF_GRA }, // 11 + { "a21.11", 0x02000, 0x87967d7d, BRF_GRA }, // 12 + { "a21.10", 0x02000, 0x59640ab4, BRF_GRA }, // 13 + { "a21.09", 0x02000, 0x22ad88d8, BRF_GRA }, // 14 + + { "a21.16", 0x00100, 0xcc25fb56, BRF_GRA }, // 15 PROMs + { "a21.17", 0x00100, 0xca054448, BRF_GRA }, // 16 + { "a21.18", 0x00100, 0x23c0c449, BRF_GRA }, // 17 + { "a21.20", 0x00020, 0xefc4985e, BRF_GRA }, // 18 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 19 +}; + +STD_ROM_PICK(Gyrodine) +STD_ROM_FN(Gyrodine) + +static struct BurnRomInfo GyrodinetRomDesc[] = { + { "a21.02", 0x02000, 0xc5ec4a50, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a21.03", 0x02000, 0x4e9323bd, BRF_ESS | BRF_PRG }, // 1 + { "a21.04", 0x02000, 0x57e659d4, BRF_ESS | BRF_PRG }, // 2 + { "a21.05", 0x02000, 0x1e7293f3, BRF_ESS | BRF_PRG }, // 3 + + { "a21.01", 0x02000, 0xb2ce0aa2, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program + + { "a21.15", 0x01000, 0xadba18d0, BRF_GRA }, // 5 Characters + + { "a21.08", 0x02000, 0xa57df1c9, BRF_GRA }, // 6 Tiles + { "a21.07", 0x02000, 0x63623ba3, BRF_GRA }, // 7 + { "a21.06", 0x02000, 0x4cc969a9, BRF_GRA }, // 8 + + { "a21.14", 0x02000, 0x9c5c4d5b, BRF_GRA }, // 9 Sprites + { "a21.13", 0x02000, 0xd36b5aad, BRF_GRA }, // 10 + { "a21.12", 0x02000, 0xf387aea2, BRF_GRA }, // 11 + { "a21.11", 0x02000, 0x87967d7d, BRF_GRA }, // 12 + { "a21.10", 0x02000, 0x59640ab4, BRF_GRA }, // 13 + { "a21.09", 0x02000, 0x22ad88d8, BRF_GRA }, // 14 + + { "a21.16", 0x00100, 0xcc25fb56, BRF_GRA }, // 15 PROMs + { "a21.17", 0x00100, 0xca054448, BRF_GRA }, // 16 + { "a21.18", 0x00100, 0x23c0c449, BRF_GRA }, // 17 + { "a21.20", 0x00020, 0xefc4985e, BRF_GRA }, // 18 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 19 +}; + +STD_ROM_PICK(Gyrodinet) +STD_ROM_FN(Gyrodinet) + +static struct BurnRomInfo BuzzardRomDesc[] = { + { "rom2", 0x02000, 0x85ddea38, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a21.03", 0x02000, 0x4e9323bd, BRF_ESS | BRF_PRG }, // 1 + { "a21.04", 0x02000, 0x57e659d4, BRF_ESS | BRF_PRG }, // 2 + { "a21.05", 0x02000, 0x1e7293f3, BRF_ESS | BRF_PRG }, // 3 + + { "a21.01", 0x02000, 0xb2ce0aa2, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program + + { "buzl01.bin", 0x01000, 0x65d728d0, BRF_GRA }, // 5 Characters + + { "a21.08", 0x02000, 0xa57df1c9, BRF_GRA }, // 6 Tiles + { "a21.07", 0x02000, 0x63623ba3, BRF_GRA }, // 7 + { "a21.06", 0x02000, 0x4cc969a9, BRF_GRA }, // 8 + + { "a21.14", 0x02000, 0x9c5c4d5b, BRF_GRA }, // 9 Sprites + { "a21.13", 0x02000, 0xd36b5aad, BRF_GRA }, // 10 + { "a21.12", 0x02000, 0xf387aea2, BRF_GRA }, // 11 + { "a21.11", 0x02000, 0x87967d7d, BRF_GRA }, // 12 + { "a21.10", 0x02000, 0x59640ab4, BRF_GRA }, // 13 + { "a21.09", 0x02000, 0x22ad88d8, BRF_GRA }, // 14 + + { "a21.16", 0x00100, 0xcc25fb56, BRF_GRA }, // 15 PROMs + { "a21.17", 0x00100, 0xca054448, BRF_GRA }, // 16 + { "a21.18", 0x00100, 0x23c0c449, BRF_GRA }, // 17 + { "a21.20", 0x00020, 0xefc4985e, BRF_GRA }, // 18 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 19 +}; + +STD_ROM_PICK(Buzzard) +STD_ROM_FN(Buzzard) + +static struct BurnRomInfo LegendRomDesc[] = { + { "a_r2.rom", 0x04000, 0x0cc1c4f4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a_r3.rom", 0x04000, 0x4b270c6b, BRF_ESS | BRF_PRG }, // 1 + + { "a_r7.rom", 0x02000, 0xabfe5eb4, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + { "a_r8.rom", 0x02000, 0x7e7b9ba9, BRF_ESS | BRF_PRG }, // 3 + { "a_r9.rom", 0x02000, 0x66737f1e, BRF_ESS | BRF_PRG }, // 4 + { "a_n7.rom", 0x02000, 0x13915a53, BRF_ESS | BRF_PRG }, // 5 + + { "b_a4.rom", 0x01000, 0xc7dd3cf7, BRF_GRA }, // 6 Characters + + { "b_h9.rom", 0x02000, 0x1fe8644a, BRF_GRA }, // 7 Tiles + { "b_h10.rom", 0x02000, 0x5f7dc82e, BRF_GRA }, // 8 + { "b_h11.rom", 0x02000, 0x46741643, BRF_GRA }, // 9 + + { "b_a6.rom", 0x04000, 0x1689f21c, BRF_GRA }, // 10 Sprites + { "b_a7.rom", 0x04000, 0xf527c909, BRF_GRA }, // 11 + { "b_a8.rom", 0x04000, 0x8d618629, BRF_GRA }, // 12 + { "b_a9.rom", 0x04000, 0x7d7e2d55, BRF_GRA }, // 13 + { "b_a10.rom", 0x04000, 0xf12232fe, BRF_GRA }, // 14 + { "b_a11.rom", 0x04000, 0x8c09243d, BRF_GRA }, // 15 + + { "82s129.1j", 0x00100, 0x40590ac0, BRF_GRA }, // 16 PROMs + { "82s129.1h", 0x00100, 0xe542b363, BRF_GRA }, // 17 + { "82s129.1f", 0x00100, 0x75536fc8, BRF_GRA }, // 18 + { "82s123.5j", 0x00020, 0xc98f0651, BRF_GRA }, // 19 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 + + { "epl10p8.2j", 0x0002c, 0x8abc03bf, BRF_OPT }, // 21 PLDs + { "epl12p6.9k", 0x00034, 0x9b0bd6f8, BRF_OPT }, // 22 + { "epl12p6.9j", 0x00034, 0xdcae870d, BRF_OPT }, // 23 +}; + +STD_ROM_PICK(Legend) +STD_ROM_FN(Legend) + +static struct BurnRomInfo SonofphxRomDesc[] = { + { "5.f4", 0x02000, 0xe0d2c6cf, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "6.h4", 0x02000, 0x3a0d0336, BRF_ESS | BRF_PRG }, // 1 + { "7.j4", 0x02000, 0x57a8e900, BRF_ESS | BRF_PRG }, // 2 + + { "1.f2", 0x02000, 0xc485c621, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + { "2.h2", 0x02000, 0xb3c6a886, BRF_ESS | BRF_PRG }, // 4 + { "3.j2", 0x02000, 0x197e314c, BRF_ESS | BRF_PRG }, // 5 + { "4.k2", 0x02000, 0x4f3695a1, BRF_ESS | BRF_PRG }, // 6 + + { "14.4a", 0x01000, 0xb3859b8b, BRF_GRA }, // 7 Characters + + { "15.9h", 0x02000, 0xc9213469, BRF_GRA }, // 8 Tiles + { "16.10h", 0x02000, 0x7de5d39e, BRF_GRA }, // 9 + { "17.11h", 0x02000, 0x0ba5f72c, BRF_GRA }, // 10 + + { "8.6a", 0x04000, 0x0e9f757e, BRF_GRA }, // 11 Sprites + { "9.7a", 0x04000, 0xf7d2e650, BRF_GRA }, // 12 + { "10.8a", 0x04000, 0xe717baf4, BRF_GRA }, // 13 + { "11.9a", 0x04000, 0x04b2250b, BRF_GRA }, // 14 + { "12.10a", 0x04000, 0xd110e140, BRF_GRA }, // 15 + { "13.11a", 0x04000, 0x8fdc713c, BRF_GRA }, // 16 + + { "b.1j", 0x00100, 0x3ea35431, BRF_GRA }, // 17 PROMs + { "g.1h", 0x00100, 0xacd7a69e, BRF_GRA }, // 18 + { "r.1f", 0x00100, 0xb7f48b41, BRF_GRA }, // 19 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 +}; + +STD_ROM_PICK(Sonofphx) +STD_ROM_FN(Sonofphx) + +static struct BurnRomInfo RepulseRomDesc[] = { + { "repulse.b5", 0x02000, 0xfb2b7c9d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "repulse.b6", 0x02000, 0x99129918, BRF_ESS | BRF_PRG }, // 1 + { "7.j4", 0x02000, 0x57a8e900, BRF_ESS | BRF_PRG }, // 2 + + { "1.f2", 0x02000, 0xc485c621, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + { "2.h2", 0x02000, 0xb3c6a886, BRF_ESS | BRF_PRG }, // 4 + { "3.j2", 0x02000, 0x197e314c, BRF_ESS | BRF_PRG }, // 5 + { "repulse.b4", 0x02000, 0x86b267f3, BRF_ESS | BRF_PRG }, // 6 + + { "repulse.a11", 0x01000, 0x8e1de90a, BRF_GRA }, // 7 Characters + + { "15.9h", 0x02000, 0xc9213469, BRF_GRA }, // 8 Tiles + { "16.10h", 0x02000, 0x7de5d39e, BRF_GRA }, // 9 + { "17.11h", 0x02000, 0x0ba5f72c, BRF_GRA }, // 10 + + { "8.6a", 0x04000, 0x0e9f757e, BRF_GRA }, // 11 Sprites + { "9.7a", 0x04000, 0xf7d2e650, BRF_GRA }, // 12 + { "10.8a", 0x04000, 0xe717baf4, BRF_GRA }, // 13 + { "11.9a", 0x04000, 0x04b2250b, BRF_GRA }, // 14 + { "12.10a", 0x04000, 0xd110e140, BRF_GRA }, // 15 + { "13.11a", 0x04000, 0x8fdc713c, BRF_GRA }, // 16 + + { "b.1j", 0x00100, 0x3ea35431, BRF_GRA }, // 17 PROMs + { "g.1h", 0x00100, 0xacd7a69e, BRF_GRA }, // 18 + { "r.1f", 0x00100, 0xb7f48b41, BRF_GRA }, // 19 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 +}; + +STD_ROM_PICK(Repulse) +STD_ROM_FN(Repulse) + +static struct BurnRomInfo Lstwar99RomDesc[] = { + { "1999.4f", 0x02000, 0xe3cfc09f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "1999.4h", 0x02000, 0xfd58c6e1, BRF_ESS | BRF_PRG }, // 1 + { "7.j4", 0x02000, 0x57a8e900, BRF_ESS | BRF_PRG }, // 2 + + { "1.f2", 0x02000, 0xc485c621, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + { "2.h2", 0x02000, 0xb3c6a886, BRF_ESS | BRF_PRG }, // 4 + { "3.j2", 0x02000, 0x197e314c, BRF_ESS | BRF_PRG }, // 5 + { "repulse.b4", 0x02000, 0x86b267f3, BRF_ESS | BRF_PRG }, // 6 + + { "1999.4a", 0x01000, 0x49a2383e, BRF_GRA }, // 7 Characters + + { "15.9h", 0x02000, 0xc9213469, BRF_GRA }, // 8 Tiles + { "16.10h", 0x02000, 0x7de5d39e, BRF_GRA }, // 9 + { "17.11h", 0x02000, 0x0ba5f72c, BRF_GRA }, // 10 + + { "8.6a", 0x04000, 0x0e9f757e, BRF_GRA }, // 11 Sprites + { "9.7a", 0x04000, 0xf7d2e650, BRF_GRA }, // 12 + { "10.8a", 0x04000, 0xe717baf4, BRF_GRA }, // 13 + { "11.9a", 0x04000, 0x04b2250b, BRF_GRA }, // 14 + { "12.10a", 0x04000, 0xd110e140, BRF_GRA }, // 15 + { "13.11a", 0x04000, 0x8fdc713c, BRF_GRA }, // 16 + + { "b.1j", 0x00100, 0x3ea35431, BRF_GRA }, // 17 PROMs + { "g.1h", 0x00100, 0xacd7a69e, BRF_GRA }, // 18 + { "r.1f", 0x00100, 0xb7f48b41, BRF_GRA }, // 19 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 +}; + +STD_ROM_PICK(Lstwar99) +STD_ROM_FN(Lstwar99) + +static struct BurnRomInfo Lstwra99RomDesc[] = { + { "4f.bin", 0x02000, 0xefe2908d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "4h.bin", 0x02000, 0x5b79c342, BRF_ESS | BRF_PRG }, // 1 + { "4j.bin", 0x02000, 0xd2a62c1b, BRF_ESS | BRF_PRG }, // 2 + + { "2f.bin", 0x02000, 0xcb9d8291, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + { "2h.bin", 0x02000, 0x24dbddc3, BRF_ESS | BRF_PRG }, // 4 + { "2j.bin", 0x02000, 0x16879c4c, BRF_ESS | BRF_PRG }, // 5 + { "repulse.b4", 0x02000, 0x86b267f3, BRF_ESS | BRF_PRG }, // 6 + + { "1999.4a", 0x01000, 0x49a2383e, BRF_GRA }, // 7 Characters + + { "9h.bin", 0x02000, 0x59993c27, BRF_GRA }, // 8 Tiles + { "10h.bin", 0x02000, 0xdfbf0280, BRF_GRA }, // 9 + { "11h.bin", 0x02000, 0xe4f29fc0, BRF_GRA }, // 10 + + { "6a.bin", 0x04000, 0x98d44410, BRF_GRA }, // 11 Sprites + { "7a.bin", 0x04000, 0x4c54d281, BRF_GRA }, // 12 + { "8a.bin", 0x04000, 0x81018101, BRF_GRA }, // 13 + { "9a.bin", 0x04000, 0x347b91fd, BRF_GRA }, // 14 + { "10a.bin", 0x04000, 0xf07de4fa, BRF_GRA }, // 15 + { "11a.bin", 0x04000, 0x34a04f48, BRF_GRA }, // 16 + + { "b.1j", 0x00100, 0x3ea35431, BRF_GRA }, // 17 PROMs + { "g.1h", 0x00100, 0xacd7a69e, BRF_GRA }, // 18 + { "r.1f", 0x00100, 0xb7f48b41, BRF_GRA }, // 19 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 +}; + +STD_ROM_PICK(Lstwra99) +STD_ROM_FN(Lstwra99) + +static struct BurnRomInfo Lstwrk99RomDesc[] = { + { "1999.4f", 0x02000, 0xe3cfc09f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "1999.4h", 0x02000, 0xfd58c6e1, BRF_ESS | BRF_PRG }, // 1 + { "7.j4", 0x02000, 0x57a8e900, BRF_ESS | BRF_PRG }, // 2 + + { "1.f2", 0x02000, 0xc485c621, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + { "2.h2", 0x02000, 0xb3c6a886, BRF_ESS | BRF_PRG }, // 4 + { "3.j2", 0x02000, 0x197e314c, BRF_ESS | BRF_PRG }, // 5 + { "repulse.b4", 0x02000, 0x86b267f3, BRF_ESS | BRF_PRG }, // 6 + + { "1999-14.rom", 0x01000, 0xb4995072, BRF_GRA }, // 7 Characters + + { "15.9h", 0x02000, 0xc9213469, BRF_GRA }, // 8 Tiles + { "16.10h", 0x02000, 0x7de5d39e, BRF_GRA }, // 9 + { "17.11h", 0x02000, 0x0ba5f72c, BRF_GRA }, // 10 + + { "8.6a", 0x04000, 0x0e9f757e, BRF_GRA }, // 11 Sprites + { "9.7a", 0x04000, 0xf7d2e650, BRF_GRA }, // 12 + { "10.8a", 0x04000, 0xe717baf4, BRF_GRA }, // 13 + { "11.9a", 0x04000, 0x04b2250b, BRF_GRA }, // 14 + { "12.10a", 0x04000, 0xd110e140, BRF_GRA }, // 15 + { "13.11a", 0x04000, 0x8fdc713c, BRF_GRA }, // 16 + + { "b.1j", 0x00100, 0x3ea35431, BRF_GRA }, // 17 PROMs + { "g.1h", 0x00100, 0xacd7a69e, BRF_GRA }, // 18 + { "r.1f", 0x00100, 0xb7f48b41, BRF_GRA }, // 19 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 20 + { "1999-00.rom", 0x00800, 0x0c0c449f, BRF_GRA }, // 21 +}; + +STD_ROM_PICK(Lstwrk99) +STD_ROM_FN(Lstwrk99) + +static struct BurnRomInfo SrdmissnRomDesc[] = { + { "5.t2", 0x04000, 0xa682b48c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "7.t3", 0x04000, 0x1719c58c, BRF_ESS | BRF_PRG }, // 1 + + { "1.t7", 0x04000, 0xdc48595e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + { "3.t8", 0x04000, 0x216be1e8, BRF_ESS | BRF_PRG }, // 3 + + { "15.4a", 0x01000, 0x4961f7fd, BRF_GRA }, // 4 Characters + + { "17.9h", 0x02000, 0x41211458, BRF_GRA }, // 5 Tiles + { "18.10h", 0x02000, 0x740eccd4, BRF_GRA }, // 6 + { "16.11h", 0x02000, 0xc1f4a5db, BRF_GRA }, // 7 + + { "14.6a", 0x04000, 0x3d4c0447, BRF_GRA }, // 8 Sprites + { "13.7a", 0x04000, 0x22414a67, BRF_GRA }, // 9 + { "12.8a", 0x04000, 0x61e34283, BRF_GRA }, // 10 + { "11.9a", 0x04000, 0xbbbaffef, BRF_GRA }, // 11 + { "10.10a", 0x04000, 0xde564f97, BRF_GRA }, // 12 + { "9.11a", 0x04000, 0x890dc815, BRF_GRA }, // 13 + + { "mr.1j", 0x00100, 0x110a436e, BRF_GRA }, // 14 PROMs + { "mg.1h", 0x00100, 0x0fbfd9f0, BRF_GRA }, // 15 + { "mb.1f", 0x00100, 0xa342890c, BRF_GRA }, // 16 + { "m2.5j", 0x00020, 0x190a55ad, BRF_GRA }, // 17 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 18 +}; + +STD_ROM_PICK(Srdmissn) +STD_ROM_FN(Srdmissn) + +static struct BurnRomInfo FxRomDesc[] = { + { "fx.01", 0x04000, 0xb651754b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "fx.02", 0x04000, 0xf3d2dcc1, BRF_ESS | BRF_PRG }, // 1 + + { "fx.03", 0x04000, 0x8907df6b, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + { "fx.04", 0x04000, 0xc665834f, BRF_ESS | BRF_PRG }, // 3 + + { "fx.05", 0x01000, 0x4a504286, BRF_GRA }, // 4 Characters + + { "17.9h", 0x02000, 0x41211458, BRF_GRA }, // 5 Tiles + { "18.10h", 0x02000, 0x740eccd4, BRF_GRA }, // 6 + { "16.11h", 0x02000, 0xc1f4a5db, BRF_GRA }, // 7 + + { "14.6a", 0x04000, 0x3d4c0447, BRF_GRA }, // 8 Sprites + { "13.7a", 0x04000, 0x22414a67, BRF_GRA }, // 9 + { "12.8a", 0x04000, 0x61e34283, BRF_GRA }, // 10 + { "11.9a", 0x04000, 0xbbbaffef, BRF_GRA }, // 11 + { "10.10a", 0x04000, 0xde564f97, BRF_GRA }, // 12 + { "9.11a", 0x04000, 0x890dc815, BRF_GRA }, // 13 + + { "mr.1j", 0x00100, 0x110a436e, BRF_GRA }, // 14 PROMs + { "mg.1h", 0x00100, 0x0fbfd9f0, BRF_GRA }, // 15 + { "mb.1f", 0x00100, 0xa342890c, BRF_GRA }, // 16 + { "m2.5j", 0x00020, 0x190a55ad, BRF_GRA }, // 17 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 18 +}; + +STD_ROM_PICK(Fx) +STD_ROM_FN(Fx) + +// f205v id 989 +// same data as fx, different format +static struct BurnRomInfo FxaRomDesc[] = { + { "fxa1.t4", 0x08000, 0xa71332aa, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + + { "fxa2.t8", 0x08000, 0xeb299381, BRF_ESS | BRF_PRG }, // 1 Z80 #2 Program + + { "fx.05", 0x01000, 0x4a504286, BRF_GRA }, // 2 Characters + + { "17.9h", 0x02000, 0x41211458, BRF_GRA }, // 3 Tiles + { "18.10h", 0x02000, 0x740eccd4, BRF_GRA }, // 4 + { "16.11h", 0x02000, 0xc1f4a5db, BRF_GRA }, // 5 + + { "fxa5.7a", 0x08000, 0x3e2289dc, BRF_GRA }, // 6 Sprites + { "fxa4.9a", 0x08000, 0x26963d7f, BRF_GRA }, // 7 + { "fxa3.11a", 0x08000, 0x8687f1a0, BRF_GRA }, // 8 + + { "mr.1j", 0x00100, 0x110a436e, BRF_GRA }, // 9 PROMs + { "mg.1h", 0x00100, 0x0fbfd9f0, BRF_GRA }, // 10 + { "mb.1f", 0x00100, 0xa342890c, BRF_GRA }, // 11 + { "m2.5j", 0x00020, 0x190a55ad, BRF_GRA }, // 12 + { "m1.2c", 0x00020, 0x83a39201, BRF_GRA }, // 13 +}; + +STD_ROM_PICK(Fxa) +STD_ROM_FN(Fxa) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + KyugoZ80Rom1 = Next; Next += 0x08000; + KyugoZ80Rom2 = Next; Next += 0x08000; + KyugoPromRed = Next; Next += 0x00100; + KyugoPromGreen = Next; Next += 0x00100; + KyugoPromBlue = Next; Next += 0x00100; + KyugoPromCharLookup = Next; Next += 0x00020; + + RamStart = Next; + + KyugoSharedZ80Ram = Next; Next += 0x00800; + KyugoZ80Ram2 = Next; Next += 0x00800; + KyugoSprite1Ram = Next; Next += 0x00800; + KyugoSprite2Ram = Next; Next += 0x00800; + KyugoFgVideoRam = Next; Next += 0x00800; + KyugoBgVideoRam = Next; Next += 0x00800; + KyugoBgAttrRam = Next; Next += 0x00800; + + RamEnd = Next; + + KyugoChars = Next; Next += 0x100 * 8 * 8; + KyugoTiles = Next; Next += 0x400 * 8 * 8; + KyugoSprites = Next; Next += 0x400 * 16 * 16; + pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); + KyugoPalette = (UINT32*)Next; Next += 256 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 KyugoDoReset() +{ + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + for (INT32 i = 0; i < 2; i++) { + AY8910Reset(i); + } + + KyugoIRQEnable = 0; + KyugoSubCPUEnable = 0; + KyugoFgColour = 0; + KyugoBgPaletteBank = 0; + KyugoBgScrollXHi = 0; + KyugoBgScrollXLo = 0; + KyugoBgScrollY = 0; + KyugoFlipScreen = 0; + + return 0; +} + +UINT8 __fastcall KyugoRead1(UINT16 a) +{ + if (a >= 0x9800 && a <= 0x9fff) { + return KyugoSprite2Ram[a - 0x9800] | 0xf0; + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall KyugoWrite1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xa800: { + KyugoBgScrollXLo = d; + return; + } + + case 0xb000: { + KyugoBgScrollXHi = d & 1; + KyugoFgColour = (d & 0x20) >> 5; + KyugoBgPaletteBank = (d & 0x40) >> 6; + return; + } + + case 0xb800: { + KyugoBgScrollY = d; + return; + } + + + case 0xe000: { + // watchdog write + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall FlashgalPortWrite1(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x40: { + KyugoIRQEnable = d & 1; + return; + } + + case 0x41: { + KyugoFlipScreen = d & 1; + return; + } + + case 0x42: { + KyugoSubCPUEnable = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall FlashgalaPortWrite1(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0xc0: { + KyugoIRQEnable = d & 1; + return; + } + + case 0xc1: { + KyugoFlipScreen = d & 1; + return; + } + + case 0xc2: { + KyugoSubCPUEnable = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall GyrodinePortWrite1(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + KyugoIRQEnable = d & 1; + return; + } + + case 0x01: { + KyugoFlipScreen = d & 1; + return; + } + + case 0x02: { + KyugoSubCPUEnable = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall SrdmissnPortWrite1(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x08: { + KyugoIRQEnable = d & 1; + return; + } + + case 0x09: { + KyugoFlipScreen = d & 1; + return; + } + + case 0x0a: { + KyugoSubCPUEnable = d & 1; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall FlashgalRead2(UINT16 a) +{ + switch (a) { + case 0xc000: { + return KyugoInput[2]; + } + + case 0xc040: { + return KyugoInput[1]; + } + + case 0xc080: { + return KyugoInput[0]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall FlashgalaRead2(UINT16 a) +{ + switch (a) { + case 0xc040: { + return KyugoInput[0]; + } + + case 0xc080: { + return KyugoInput[1]; + } + + case 0xc0c0: { + return KyugoInput[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall GyrodineRead2(UINT16 a) +{ + switch (a) { + case 0x8000: { + return KyugoInput[2]; + } + + case 0x8040: { + return KyugoInput[1]; + } + + case 0x8080: { + return KyugoInput[0]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall SrdmissnRead2(UINT16 a) +{ + switch (a) { + case 0xf400: { + return KyugoInput[0]; + } + + case 0xf401: { + return KyugoInput[1]; + } + + case 0xf402: { + return KyugoInput[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall LegendRead2(UINT16 a) +{ + switch (a) { + case 0xf800: { + return KyugoInput[0]; + } + + case 0xf801: { + return KyugoInput[1]; + } + + case 0xf802: { + return KyugoInput[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall KyugoWrite2(UINT16 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall KyugoPortRead2(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x02: { + return AY8910Read(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall FlashgalaPortRead2(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x42: { + return AY8910Read(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall SrdmissnPortRead2(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x82: { + return AY8910Read(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall FlashgalPortWrite2(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + AY8910Write(0, 0, d); + return; + } + + case 0x01: { + AY8910Write(0, 1, d); + return; + } + + case 0x40: { + AY8910Write(1, 0, d); + return; + } + + case 0x41: { + AY8910Write(1, 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall FlashgalaPortWrite2(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x40: { + AY8910Write(0, 0, d); + return; + } + + case 0x41: { + AY8910Write(0, 1, d); + return; + } + + case 0x80: { + AY8910Write(1, 0, d); + return; + } + + case 0x81: { + AY8910Write(1, 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall GyrodinePortWrite2(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + AY8910Write(0, 0, d); + return; + } + + case 0x01: { + AY8910Write(0, 1, d); + return; + } + + case 0xc0: { + AY8910Write(1, 0, d); + return; + } + + case 0xc1: { + AY8910Write(1, 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall SrdmissnPortWrite2(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x80: { + AY8910Write(0, 0, d); + return; + } + + case 0x81: { + AY8910Write(0, 1, d); + return; + } + + case 0x84: { + AY8910Write(1, 0, d); + return; + } + + case 0x85: { + AY8910Write(1, 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); + } + } +} + +static INT32 CharPlaneOffsets[2] = { 0, 4 }; +static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 64, 65, 66, 67 }; +static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 TilePlaneOffsets[3] = { 0, 0x10000, 0x20000 }; +static INT32 TileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 TileYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 SpritePlaneOffsets[3] = { 0, 0x40000, 0x80000 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; +static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; + +static UINT8 KyugoDip0Read(UINT32 /*a*/) +{ + return KyugoDip[0]; +} + +static UINT8 KyugoDip1Read(UINT32 /*a*/) +{ + return KyugoDip[1]; +} + +static INT32 KyugoInit() +{ + INT32 nRet = 0, nLen, i; + + KyugoNumZ80Rom1 = 4; + KyugoNumZ80Rom2 = 4; + KyugoNumSpriteRom = 6; + KyugoSizeZ80Rom1 = 0x2000; + KyugoSizeZ80Rom2 = 0x2000; + KyugoSizeSpriteRom = 0x4000; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "airwolf") || !strcmp(BurnDrvGetTextA(DRV_NAME), "airwolfa")) { + KyugoNumZ80Rom1 = 1; + KyugoNumZ80Rom2 = 1; + KyugoNumSpriteRom = 3; + KyugoSizeZ80Rom1 = 0x8000; + KyugoSizeZ80Rom2 = 0x8000; + KyugoSizeSpriteRom = 0x8000; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodine") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodinet") || !strcmp(BurnDrvGetTextA(DRV_NAME), "buzzard")) { + KyugoNumZ80Rom2 = 1; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "legend")) { + KyugoNumZ80Rom1 = 2; + KyugoNumZ80Rom2 = 4; + KyugoSizeZ80Rom1 = 0x4000; + KyugoSizeZ80Rom2 = 0x2000; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "sonofphx") || !strcmp(BurnDrvGetTextA(DRV_NAME), "repulse") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwar") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwara") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwark")) { + KyugoNumZ80Rom1 = 3; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "skywolf") || !strcmp(BurnDrvGetTextA(DRV_NAME), "srdmissn") || !strcmp(BurnDrvGetTextA(DRV_NAME), "fx")) { + KyugoNumZ80Rom1 = 2; + KyugoNumZ80Rom2 = 2; + KyugoSizeZ80Rom1 = 0x4000; + KyugoSizeZ80Rom2 = 0x4000; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "skywolf2")) { + KyugoNumZ80Rom1 = 1; + KyugoNumZ80Rom2 = 2; + KyugoSizeZ80Rom1 = 0x8000; + KyugoSizeZ80Rom2 = 0x4000; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "fxa")) { + KyugoNumZ80Rom1 = 1; + KyugoNumZ80Rom2 = 1; + KyugoNumSpriteRom = 3; + KyugoSizeZ80Rom1 = 0x8000; + KyugoSizeZ80Rom2 = 0x8000; + KyugoSizeSpriteRom = 0x8000; + } + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + KyugoTempRom = (UINT8 *)BurnMalloc(0x18000); + + // Load Z80 #1 Program Roms + for (i = 0; i < KyugoNumZ80Rom1; i++) { + nRet = BurnLoadRom(KyugoZ80Rom1 + (KyugoSizeZ80Rom1 * i), i, 1); if (nRet != 0) return 1; + } + + // Load Z80 #2 Program Roms + for (i = KyugoNumZ80Rom1; i < KyugoNumZ80Rom2 + KyugoNumZ80Rom1; i++) { + nRet = BurnLoadRom(KyugoZ80Rom2 + (KyugoSizeZ80Rom2 * (i - KyugoNumZ80Rom1)), i, 1); if (nRet != 0) return 1; + } + + // Load and decode the chars + nRet = BurnLoadRom(KyugoTempRom, KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 0, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, KyugoTempRom, KyugoChars); + + // Load and decode the tiles + memset(KyugoTempRom, 0, 0x18000); + nRet = BurnLoadRom(KyugoTempRom + 0x00000, KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(KyugoTempRom + 0x02000, KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(KyugoTempRom + 0x04000, KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 3, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 3, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, KyugoTempRom, KyugoTiles); + + // Load and decode the sprites + memset(KyugoTempRom, 0, 0x18000); + for (i = KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 4; i < KyugoNumSpriteRom + KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 4; i++) { + nRet = BurnLoadRom(KyugoTempRom + (KyugoSizeSpriteRom * (i - KyugoNumZ80Rom2 - KyugoNumZ80Rom1 - 4)), i, 1); if (nRet != 0) return 1; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "airwolf") || !strcmp(BurnDrvGetTextA(DRV_NAME), "airwolfa")) { + UINT8 *Temp = (UINT8*)BurnMalloc(0x18000); + memcpy(Temp, KyugoTempRom, 0x18000); + memcpy(KyugoTempRom + 0x00000, Temp + 0x00000, 0x2000); + memcpy(KyugoTempRom + 0x04000, Temp + 0x02000, 0x2000); + memcpy(KyugoTempRom + 0x02000, Temp + 0x04000, 0x2000); + memcpy(KyugoTempRom + 0x06000, Temp + 0x06000, 0x2000); + memcpy(KyugoTempRom + 0x08000, Temp + 0x08000, 0x2000); + memcpy(KyugoTempRom + 0x0c000, Temp + 0x0a000, 0x2000); + memcpy(KyugoTempRom + 0x0a000, Temp + 0x0c000, 0x2000); + memcpy(KyugoTempRom + 0x0e000, Temp + 0x0e000, 0x2000); + memcpy(KyugoTempRom + 0x10000, Temp + 0x10000, 0x2000); + memcpy(KyugoTempRom + 0x14000, Temp + 0x12000, 0x2000); + memcpy(KyugoTempRom + 0x12000, Temp + 0x14000, 0x2000); + memcpy(KyugoTempRom + 0x16000, Temp + 0x16000, 0x2000); + BurnFree(Temp); + } + GfxDecode(0x400, 3, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, KyugoTempRom, KyugoSprites); + + // Load the PROMs + nRet = BurnLoadRom(KyugoPromRed, KyugoNumSpriteRom + KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(KyugoPromGreen, KyugoNumSpriteRom + KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(KyugoPromBlue, KyugoNumSpriteRom + KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 6, 1); if (nRet != 0) return 1; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "flashgal") || !strcmp(BurnDrvGetTextA(DRV_NAME), "flashgala") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodine") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodinet") || !strcmp(BurnDrvGetTextA(DRV_NAME), "buzzard") || !strcmp(BurnDrvGetTextA(DRV_NAME), "legend") || !strcmp(BurnDrvGetTextA(DRV_NAME), "srdmissn") || !strcmp(BurnDrvGetTextA(DRV_NAME), "fx") || !strcmp(BurnDrvGetTextA(DRV_NAME), "fxa")) { + nRet = BurnLoadRom(KyugoPromCharLookup, KyugoNumSpriteRom + KyugoNumZ80Rom2 + KyugoNumZ80Rom1 + 7, 1); if (nRet != 0) return 1; + } + + BurnFree(KyugoTempRom); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(KyugoRead1); + ZetSetWriteHandler(KyugoWrite1); + ZetMapArea(0x0000, 0x7fff, 0, KyugoZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, KyugoZ80Rom1 ); + ZetMapArea(0x8000, 0x87ff, 0, KyugoBgVideoRam ); + ZetMapArea(0x8000, 0x87ff, 1, KyugoBgVideoRam ); + ZetMapArea(0x8000, 0x87ff, 2, KyugoBgVideoRam ); + ZetMapArea(0x8800, 0x8fff, 0, KyugoBgAttrRam ); + ZetMapArea(0x8800, 0x8fff, 1, KyugoBgAttrRam ); + ZetMapArea(0x8800, 0x8fff, 2, KyugoBgAttrRam ); + ZetMapArea(0x9000, 0x97ff, 0, KyugoFgVideoRam ); + ZetMapArea(0x9000, 0x97ff, 1, KyugoFgVideoRam ); + ZetMapArea(0x9000, 0x97ff, 2, KyugoFgVideoRam ); + ZetMapArea(0x9800, 0x9fff, 1, KyugoSprite2Ram ); + ZetMapArea(0x9800, 0x9fff, 2, KyugoSprite2Ram ); + ZetMapArea(0xa000, 0xa7ff, 0, KyugoSprite1Ram ); + ZetMapArea(0xa000, 0xa7ff, 1, KyugoSprite1Ram ); + ZetMapArea(0xa000, 0xa7ff, 2, KyugoSprite1Ram ); + ZetMapArea(0xf000, 0xf7ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetWriteHandler(KyugoWrite2); + ZetSetInHandler(KyugoPortRead2); + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodine") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodinet") || !strcmp(BurnDrvGetTextA(DRV_NAME), "buzzard")) { + ZetMapArea(0x0000, 0x1fff, 0, KyugoZ80Rom2 ); + ZetMapArea(0x0000, 0x1fff, 2, KyugoZ80Rom2 ); + } else { + ZetMapArea(0x0000, 0x7fff, 0, KyugoZ80Rom2 ); + ZetMapArea(0x0000, 0x7fff, 2, KyugoZ80Rom2 ); + } + ZetClose(); + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "airwolf") || !strcmp(BurnDrvGetTextA(DRV_NAME), "airwolfa") || !strcmp(BurnDrvGetTextA(DRV_NAME), "skywolf") || !strcmp(BurnDrvGetTextA(DRV_NAME), "skywolf2")) { + ZetOpen(0); + ZetSetOutHandler(SrdmissnPortWrite1); + ZetMapArea(0xe000, 0xe7ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + + ZetOpen(1); + ZetSetReadHandler(SrdmissnRead2); + ZetSetInHandler(SrdmissnPortRead2); + ZetSetOutHandler(SrdmissnPortWrite2); + ZetMapArea(0x8000, 0x87ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + } + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "flashgal")) { + ZetOpen(0); + ZetSetOutHandler(FlashgalPortWrite1); + ZetClose(); + + ZetOpen(1); + ZetSetReadHandler(FlashgalRead2); + ZetSetOutHandler(FlashgalPortWrite2); + ZetMapArea(0xa000, 0xa7ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0xa000, 0xa7ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0xa000, 0xa7ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + } + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "flashgala")) { + ZetOpen(0); + ZetSetOutHandler(FlashgalaPortWrite1); + ZetClose(); + + ZetOpen(1); + ZetSetReadHandler(FlashgalaRead2); + ZetSetInHandler(FlashgalaPortRead2); + ZetSetOutHandler(FlashgalaPortWrite2); + ZetMapArea(0xe000, 0xe7ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + } + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodine") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gyrodinet") || !strcmp(BurnDrvGetTextA(DRV_NAME), "buzzard")) { + ZetOpen(0); + ZetSetOutHandler(GyrodinePortWrite1); + ZetClose(); + + ZetOpen(1); + ZetSetReadHandler(GyrodineRead2); + ZetSetOutHandler(GyrodinePortWrite2); + ZetMapArea(0x4000, 0x47ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0x4000, 0x47ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0x4000, 0x47ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + } + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "legend")) { + ZetOpen(0); + ZetSetOutHandler(GyrodinePortWrite1); + ZetClose(); + + ZetOpen(1); + ZetSetReadHandler(LegendRead2); + ZetSetInHandler(SrdmissnPortRead2); + ZetSetOutHandler(SrdmissnPortWrite2); + ZetMapArea(0xc000, 0xc7ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + } + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "sonofphx") || !strcmp(BurnDrvGetTextA(DRV_NAME), "repulse") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwar") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwara") || !strcmp(BurnDrvGetTextA(DRV_NAME), "99lstwark")) { + ZetOpen(0); + ZetSetOutHandler(GyrodinePortWrite1); + ZetClose(); + + ZetOpen(1); + ZetSetReadHandler(FlashgalRead2); + ZetSetOutHandler(FlashgalPortWrite2); + ZetMapArea(0xa000, 0xa7ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0xa000, 0xa7ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0xa000, 0xa7ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + } + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "srdmissn") || !strcmp(BurnDrvGetTextA(DRV_NAME), "fx") || !strcmp(BurnDrvGetTextA(DRV_NAME), "fxa")) { + ZetOpen(0); + ZetSetOutHandler(SrdmissnPortWrite1); + ZetMapArea(0xe000, 0xe7ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + + ZetOpen(1); + ZetSetReadHandler(SrdmissnRead2); + ZetSetInHandler(SrdmissnPortRead2); + ZetSetOutHandler(SrdmissnPortWrite2); + ZetMapArea(0x8000, 0x87ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 2, KyugoSharedZ80Ram ); + ZetMapArea(0x8800, 0x8fff, 0, KyugoZ80Ram2 ); + ZetMapArea(0x8800, 0x8fff, 1, KyugoZ80Ram2 ); + ZetMapArea(0x8800, 0x8fff, 2, KyugoZ80Ram2 ); + ZetClose(); + } + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + + AY8910Init(0, 18432000 / 12, nBurnSoundRate, &KyugoDip0Read, &KyugoDip1Read, NULL, NULL); + AY8910Init(1, 18432000 / 12, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.30, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + KyugoDoReset(); + + return 0; +} + +static INT32 Skywolf3Init() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + KyugoTempRom = (UINT8 *)BurnMalloc(0x18000); + UINT8 *pTemp = (UINT8*)BurnMalloc(0x8000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(pTemp, 0, 1); if (nRet != 0) return 1; + memcpy(KyugoZ80Rom1 + 0x00000, pTemp + 0x04000, 0x4000); + nRet = BurnLoadRom(pTemp, 1, 1); if (nRet != 0) return 1; + memcpy(KyugoZ80Rom1 + 0x04000, pTemp + 0x04000, 0x4000); + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(pTemp, 2, 1); if (nRet != 0) return 1; + memcpy(KyugoZ80Rom2 + 0x00000, pTemp + 0x04000, 0x4000); + nRet = BurnLoadRom(pTemp, 3, 1); if (nRet != 0) return 1; + memcpy(KyugoZ80Rom2 + 0x04000, pTemp + 0x04000, 0x4000); + + // Load and decode the chars + nRet = BurnLoadRom(pTemp, 4, 1); if (nRet != 0) return 1; + memcpy(KyugoTempRom + 0x00000, pTemp + 0x07000, 0x1000); + GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, KyugoTempRom, KyugoChars); + + // Load and decode the tiles + memset(KyugoTempRom, 0, 0x18000); + nRet = BurnLoadRom(pTemp, 5, 1); if (nRet != 0) return 1; + memcpy(KyugoTempRom + 0x00000, pTemp + 0x06000, 0x2000); + nRet = BurnLoadRom(pTemp, 6, 1); if (nRet != 0) return 1; + memcpy(KyugoTempRom + 0x02000, pTemp + 0x06000, 0x2000); + nRet = BurnLoadRom(pTemp, 7, 1); if (nRet != 0) return 1; + memcpy(KyugoTempRom + 0x04000, pTemp + 0x06000, 0x2000); + GfxDecode(0x400, 3, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, KyugoTempRom, KyugoTiles); + + // Load and decode the sprites + memset(KyugoTempRom, 0, 0x18000); + nRet = BurnLoadRom(KyugoTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(KyugoTempRom + 0x08000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(KyugoTempRom + 0x10000, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 3, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, KyugoTempRom, KyugoSprites); + + // Load the PROMs + nRet = BurnLoadRom(KyugoPromRed, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(KyugoPromGreen, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(KyugoPromBlue, 13, 1); if (nRet != 0) return 1; + + BurnFree(KyugoTempRom); + BurnFree(pTemp); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(KyugoRead1); + ZetSetWriteHandler(KyugoWrite1); + ZetMapArea(0x0000, 0x7fff, 0, KyugoZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, KyugoZ80Rom1 ); + ZetMapArea(0x8000, 0x87ff, 0, KyugoBgVideoRam ); + ZetMapArea(0x8000, 0x87ff, 1, KyugoBgVideoRam ); + ZetMapArea(0x8000, 0x87ff, 2, KyugoBgVideoRam ); + ZetMapArea(0x8800, 0x8fff, 0, KyugoBgAttrRam ); + ZetMapArea(0x8800, 0x8fff, 1, KyugoBgAttrRam ); + ZetMapArea(0x8800, 0x8fff, 2, KyugoBgAttrRam ); + ZetMapArea(0x9000, 0x97ff, 0, KyugoFgVideoRam ); + ZetMapArea(0x9000, 0x97ff, 1, KyugoFgVideoRam ); + ZetMapArea(0x9000, 0x97ff, 2, KyugoFgVideoRam ); + ZetMapArea(0x9800, 0x9fff, 1, KyugoSprite2Ram ); + ZetMapArea(0x9800, 0x9fff, 2, KyugoSprite2Ram ); + ZetMapArea(0xa000, 0xa7ff, 0, KyugoSprite1Ram ); + ZetMapArea(0xa000, 0xa7ff, 1, KyugoSprite1Ram ); + ZetMapArea(0xa000, 0xa7ff, 2, KyugoSprite1Ram ); + ZetMapArea(0xf000, 0xf7ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0xf000, 0xf7ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetWriteHandler(KyugoWrite2); + ZetSetInHandler(KyugoPortRead2); + ZetMapArea(0x0000, 0x7fff, 0, KyugoZ80Rom2 ); + ZetMapArea(0x0000, 0x7fff, 2, KyugoZ80Rom2 ); + ZetClose(); + + ZetOpen(0); + ZetSetOutHandler(SrdmissnPortWrite1); + ZetMapArea(0xe000, 0xe7ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + + ZetOpen(1); + ZetSetReadHandler(SrdmissnRead2); + ZetSetInHandler(SrdmissnPortRead2); + ZetSetOutHandler(SrdmissnPortWrite2); + ZetMapArea(0x8000, 0x87ff, 0, KyugoSharedZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 1, KyugoSharedZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 2, KyugoSharedZ80Ram ); + ZetClose(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + + AY8910Init(0, 18432000 / 12, nBurnSoundRate, &KyugoDip0Read, &KyugoDip1Read, NULL, NULL); + AY8910Init(1, 18432000 / 12, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.30, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + KyugoDoReset(); + + return 0; +} + +static INT32 KyugoExit() +{ + ZetExit(); + + for (INT32 i = 0; i < 2; i++) { + AY8910Exit(i); + } + + GenericTilesExit(); + + KyugoIRQEnable = 0; + KyugoSubCPUEnable = 0; + KyugoFgColour = 0; + KyugoBgPaletteBank = 0; + KyugoBgScrollXHi = 0; + KyugoBgScrollXLo = 0; + KyugoBgScrollY = 0; + KyugoFlipScreen = 0; + + KyugoNumZ80Rom1 = 0; + KyugoNumZ80Rom2 = 0; + KyugoNumSpriteRom = 0; + KyugoSizeZ80Rom1 = 0; + KyugoSizeZ80Rom2 = 0; + KyugoSizeSpriteRom = 0; + + BurnFree(Mem); + + return 0; +} + +static void KyugoCalcPalette() +{ + INT32 i; + + for (i = 0; i < 256; i++) { + INT32 bit0, bit1, bit2, bit3, r, g, b; + + bit0 = (KyugoPromRed[i] >> 0) & 0x01; + bit1 = (KyugoPromRed[i] >> 1) & 0x01; + bit2 = (KyugoPromRed[i] >> 2) & 0x01; + bit3 = (KyugoPromRed[i] >> 3) & 0x01; + r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (KyugoPromGreen[i] >> 0) & 0x01; + bit1 = (KyugoPromGreen[i] >> 1) & 0x01; + bit2 = (KyugoPromGreen[i] >> 2) & 0x01; + bit3 = (KyugoPromGreen[i] >> 3) & 0x01; + g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (KyugoPromBlue[i] >> 0) & 0x01; + bit1 = (KyugoPromBlue[i] >> 1) & 0x01; + bit2 = (KyugoPromBlue[i] >> 2) & 0x01; + bit3 = (KyugoPromBlue[i] >> 3) & 0x01; + b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + KyugoPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static void KyugoRenderBgLayer() +{ + INT32 mx, my, Code, Attr, Colour, x, y, TileIndex = 0, xScroll, Flip, xFlip, yFlip; + + xScroll = KyugoBgScrollXLo + (KyugoBgScrollXHi * 256); + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Code = KyugoBgVideoRam[TileIndex]; + Attr = KyugoBgAttrRam[TileIndex]; + Code = Code | ((Attr & 0x03) << 8); + Code &= 0x3ff; + Colour = (Attr >> 4) | (KyugoBgPaletteBank << 4); + Flip = (Attr & 0x0c) >> 2; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + + x = 8 * mx; + y = 8 * my; + + if (KyugoFlipScreen) { + xFlip = !xFlip; + yFlip = !yFlip; + y = 248 - y; + x = 504 - x; + x -= xScroll; + y += KyugoBgScrollY; + } else { + x -= xScroll; + y -= KyugoBgScrollY; + } + + if (x < -8) x += 512; + if (y < -8) y += 256; + if (y > 264) y -= 256; + + x -= 32; + y -= 16; + + if (x > 8 && x < 280 && y > 8 && y < 216) { + if (xFlip) { + if (yFlip) { + Render8x8Tile_FlipXY(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); + } else { + Render8x8Tile_FlipX(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); + } + } else { + if (yFlip) { + Render8x8Tile_FlipY(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); + } else { + Render8x8Tile(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render8x8Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); + } else { + Render8x8Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); + } + } else { + if (yFlip) { + Render8x8Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); + } else { + Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 3, 0, KyugoTiles); + } + } + } + + TileIndex++; + } + } +} + +static void KyugoRenderSpriteLayer() +{ + UINT8 *SpriteRam_Area1 = &KyugoSprite1Ram[0x28]; + UINT8 *SpriteRam_Area2 = &KyugoSprite2Ram[0x28]; + UINT8 *SpriteRam_Area3 = &KyugoFgVideoRam[0x28]; + + INT32 i; + + for (i = 0; i < 24; i++) { + INT32 Offset, y, sy, sx, Colour; + + Offset = 2 * (i % 12) + 64 * (i / 12); + + sx = SpriteRam_Area3[Offset + 1] + 256 * (SpriteRam_Area2[Offset + 1] & 1); + if (sx > 320) sx -= 512; + sy = 255 - SpriteRam_Area1[Offset] + 2; + if (sy > 0xf0) sy -= 256; + if (KyugoFlipScreen) sy = 240 - sy; + sy -= 16; + + Colour = SpriteRam_Area1[Offset + 1] & 0x1f; + + for (y = 0; y < 16; y++) { + INT32 Code, Attr, FlipX, FlipY, yPos; + + Code = SpriteRam_Area3[Offset + 128 * y]; + Attr = SpriteRam_Area2[Offset + 128 * y]; + Code = Code | ((Attr & 0x01) << 9) | ((Attr & 0x02) << 7); + Code &= 0x3ff; + + FlipX = Attr & 0x08; + FlipY = Attr & 0x04; + + yPos = sy + 16 * y; + + if (KyugoFlipScreen) { + FlipX = !FlipX; + FlipY = !FlipY; + yPos = sy - 16 * y; + } + + if (sx > 16 && sx < 272 && yPos > 16 && yPos < 208) { + if (FlipX) { + if (FlipY) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); + } + } else { + if (FlipY) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); + } else { + Render16x16Tile_Mask(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); + } + } + } else { + if (FlipX) { + if (FlipY) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); + } + } else { + if (FlipY) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, yPos, Colour, 3, 0, 0, KyugoSprites); + } + } + } + } + } +} + +static void KyugoRenderCharLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0, FlipX = 0, FlipY = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Code = KyugoFgVideoRam[TileIndex]; + Colour = 2 * KyugoPromCharLookup[Code >> 3] + KyugoFgColour; + Code &= 0xff; + + x = 8 * mx; + y = 8 * my; + + if (KyugoFlipScreen) { + FlipX = 1; + FlipY = 1; + y = 248 - y; + x = 280 - x; + } + + y -= 16; + + if (x > 0 && x < 280 && y > 0 && y < 216) { + if (FlipX) { + if (FlipY) { + Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); + } else { + Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); + } + } else { + if (FlipY) { + Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); + } else { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); + } + } + } else { + if (FlipX) { + if (FlipY) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); + } else { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); + } + } else { + if (FlipY) { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, KyugoChars); + } + } + } + + TileIndex++; + } + } +} + +static void KyugoDraw() +{ + BurnTransferClear(); + KyugoCalcPalette(); + KyugoRenderBgLayer(); + KyugoRenderSpriteLayer(); + KyugoRenderCharLayer(); + BurnTransferCopy(KyugoPalette); +} + +static INT32 KyugoFrame() +{ + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + + if (KyugoReset) KyugoDoReset(); + + KyugoMakeInputs(); + + nCyclesTotal[0] = (18432000 / 6) / 60; + nCyclesTotal[1] = (18432000 / 6) / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 9 && KyugoIRQEnable) ZetNmi(); + ZetClose(); + + // Run Z80 #2 + nCurrentCPU = 1; + if (KyugoSubCPUEnable) { + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 2 || i == 4 || i == 6 || i == 8) ZetRaiseIrq(0); + ZetClose(); + } + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + + if (pBurnDraw) KyugoDraw(); + + return 0; +} + +static INT32 KyugoScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029674; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); // Scan Z80 + AY8910Scan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(KyugoDip); + SCAN_VAR(KyugoInput); + SCAN_VAR(KyugoIRQEnable); + SCAN_VAR(KyugoSubCPUEnable); + SCAN_VAR(KyugoFgColour); + SCAN_VAR(KyugoBgPaletteBank); + SCAN_VAR(KyugoBgScrollXHi); + SCAN_VAR(KyugoBgScrollXLo); + SCAN_VAR(KyugoBgScrollY); + SCAN_VAR(KyugoFlipScreen); + } + + + return 0; +} + +struct BurnDriver BurnDrvAirwolf = { + "airwolf", NULL, NULL, NULL, "1987", + "Airwolf\0", NULL, "Kyugo", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, AirwolfRomInfo, AirwolfRomName, NULL, NULL, KyugoInputInfo, AirwolfDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAirwolfa = { + "airwolfa", "airwolf", NULL, NULL, "1987", + "Airwolf (US)\0", NULL, "Kyugo (UA Theatre license)", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, AirwolfaRomInfo, AirwolfaRomName, NULL, NULL, KyugoInputInfo, AirwolfDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSkywolf = { + "skywolf", "airwolf", NULL, NULL, "1987", + "Sky Wolf (set 1)\0", NULL, "bootleg", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, SkywolfRomInfo, SkywolfRomName, NULL, NULL, KyugoInputInfo, SkywolfDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSkywolf2 = { + "skywolf2", "airwolf", NULL, NULL, "1987", + "Sky Wolf (set 2)\0", NULL, "bootleg", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, Skywolf2RomInfo, Skywolf2RomName, NULL, NULL, KyugoInputInfo, AirwolfDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSkywolf3 = { + "skywolf3", "airwolf", NULL, NULL, "1987", + "Sky Wolf (set 3)\0", NULL, "bootleg", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, Skywolf3RomInfo, Skywolf3RomName, NULL, NULL, KyugoInputInfo, AirwolfDIPInfo, + Skywolf3Init, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFlashgal = { + "flashgal", NULL, NULL, NULL, "1985", + "Flashgal (set 1)\0", NULL, "Sega", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, FlashgalRomInfo, FlashgalRomName, NULL, NULL, KyugoInputInfo, FlashgalDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFlashgala = { + "flashgala", "flashgal", NULL, NULL, "1985", + "Flashgal (set 2)\0", NULL, "Sega", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, FlashgalaRomInfo, FlashgalaRomName, NULL, NULL, KyugoInputInfo, FlashgalDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGyrodine = { + "gyrodine", NULL, NULL, NULL, "1984", + "Gyrodine\0", NULL, "Crux", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, GyrodineRomInfo, GyrodineRomName, NULL, NULL, KyugoInputInfo, GyrodineDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvGyrodinet = { + "gyrodinet", "gyrodine", NULL, NULL, "1984", + "Gyrodine (Taito Corporation license)\0", NULL, "Crux (Taito Corporation license)", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, GyrodinetRomInfo, GyrodinetRomName, NULL, NULL, KyugoInputInfo, GyrodineDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvBuzzard = { + "buzzard", "gyrodine", NULL, NULL, "1984", + "Buzzard\0", NULL, "Crux", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, BuzzardRomInfo, BuzzardRomName, NULL, NULL, KyugoInputInfo, GyrodineDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvLegend = { + "legend", NULL, NULL, NULL, "1986", + "Legend\0", NULL, "Sega / Coreland", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, LegendRomInfo, LegendRomName, NULL, NULL, KyugoInputInfo, LegendDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSonofphx = { + "sonofphx", "repulse", NULL, NULL, "1985", + "Son of Phoenix\0", NULL, "Associated Overseas MFR, Inc", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, SonofphxRomInfo, SonofphxRomName, NULL, NULL, KyugoInputInfo, SonofphxDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvRepulse = { + "repulse", NULL, NULL, NULL, "1985", + "Repulse\0", NULL, "Sega", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, RepulseRomInfo, RepulseRomName, NULL, NULL, KyugoInputInfo, SonofphxDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrv99lstwar = { + "99lstwar", "repulse", NULL, NULL, "1985", + "'99: The Last War\0", NULL, "Proma", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, Lstwar99RomInfo, Lstwar99RomName, NULL, NULL, KyugoInputInfo, SonofphxDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrv99lstwara = { + "99lstwara", "repulse", NULL, NULL, "1985", + "'99: The Last War (alternate)\0", NULL, "Proma", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, Lstwra99RomInfo, Lstwra99RomName, NULL, NULL, KyugoInputInfo, SonofphxDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrv99lstwark = { + "99lstwark", "repulse", NULL, NULL, "1985", + "'99: The Last War (Kyugo)\0", NULL, "Kyugo", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, Lstwrk99RomInfo, Lstwrk99RomName, NULL, NULL, KyugoInputInfo, SonofphxDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvSrdmissn = { + "srdmissn", NULL, NULL, NULL, "1986", + "S.R.D. Mission\0", NULL, "Taito Corporation", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, SrdmissnRomInfo, SrdmissnRomName, NULL, NULL, KyugoInputInfo, SrdmissnDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvFx = { + "fx", "srdmissn", NULL, NULL, "1986", + "F-X\0", NULL, "bootleg", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, FxRomInfo, FxRomName, NULL, NULL, KyugoInputInfo, SrdmissnDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; + +struct BurnDriver BurnDrvFxa = { + "fxa", "srdmissn", NULL, NULL, "1986", + "F-X (alternate set)\0", NULL, "bootleg", "Kyugo", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, FxaRomInfo, FxaRomName, NULL, NULL, KyugoInputInfo, SrdmissnDIPInfo, + KyugoInit, KyugoExit, KyugoFrame, NULL, KyugoScan, + NULL, 0x100, 224, 288, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_ladybug.cpp b/src/burn/drv/pre90s/d_ladybug.cpp index ca88f33d1..742e7f27a 100644 --- a/src/burn/drv/pre90s/d_ladybug.cpp +++ b/src/burn/drv/pre90s/d_ladybug.cpp @@ -1,1539 +1,1536 @@ -// FB Alpha Lady Bug driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "sn76496.h" -#include "bitswap.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvZ80Ops0; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvColPROM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvColRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvGridRAM; - -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *flipscreen; -static UINT8 *soundlatch; -static UINT8 *gridcolor; -static UINT8 *enablestars; -static UINT8 *starspeed; - -static INT32 stars_offset; -static INT32 stars_state; -static INT32 vblank; -static INT32 ladybug = 0; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[4]; -static UINT8 DrvReset; - -static struct BurnInputInfo LadybugInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy4 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 5, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy3 + 0, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy4 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 6, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 7, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Ladybug) - -static struct BurnInputInfo SraiderInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 6, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 5, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 6, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Sraider) - -static struct BurnDIPInfo LadybugDIPList[]= -{ - {0x12, 0xff, 0xff, 0xdf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x03, 0x03, "Easy" }, - {0x12, 0x01, 0x03, 0x02, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "High Score Names" }, - {0x12, 0x01, 0x04, 0x00, "3 Letters" }, - {0x12, 0x01, 0x04, 0x04, "10 Letters" }, - - {0 , 0xfe, 0 , 2, "Rack Test (Cheat)" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x20, 0x00, "Upright" }, - {0x12, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x12, 0x01, 0x40, 0x40, "No" }, - {0x12, 0x01, 0x40, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x12, 0x01, 0x80, 0x80, "3" }, - {0x12, 0x01, 0x80, 0x00, "5" }, - - {0 , 0xfe, 0 , 10, "Coin B" }, - {0x13, 0x01, 0x0f, 0x06, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x07, "3 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x0f, 0x09, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 10, "Coin A" }, - {0x13, 0x01, 0xf0, 0x60, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, -}; - -STDDIPINFO(Ladybug) - -static struct BurnDIPInfo SnapjackDIPList[]= -{ - {0x12, 0xff, 0xff, 0xf7, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x03, 0x03, "Easy" }, - {0x12, 0x01, 0x03, 0x02, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "High Score Names" }, - {0x12, 0x01, 0x04, 0x00, "3 Letters" }, - {0x12, 0x01, 0x04, 0x04, "10 Letters" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x08, 0x00, "Upright" }, - {0x12, 0x01, 0x08, 0x08, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x80, "4" }, - {0x12, 0x01, 0xc0, 0x40, "5" }, - - {0 , 0xfe, 0 , 11, "Coin B" }, - {0x13, 0x01, 0x0f, 0x05, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x07, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x06, "3 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x09, "2 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x0f, 0x08, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 11, "Coin A" }, - {0x13, 0x01, 0xf0, 0x50, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "2 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, -}; - -STDDIPINFO(Snapjack) - -static struct BurnDIPInfo CavengerDIPList[]= -{ - {0x12, 0xff, 0xff, 0xc7, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x03, 0x03, "Easy" }, - {0x12, 0x01, 0x03, 0x02, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "High Score Names" }, - {0x12, 0x01, 0x04, 0x00, "3 Letters" }, - {0x12, 0x01, 0x04, 0x04, "10 Letters" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x08, 0x00, "Upright" }, - {0x12, 0x01, 0x08, 0x08, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Initial High Score" }, - {0x12, 0x01, 0x30, 0x00, "0" }, - {0x12, 0x01, 0x30, 0x30, "5000" }, - {0x12, 0x01, 0x30, 0x20, "8000" }, - {0x12, 0x01, 0x30, 0x10, "10000" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x80, "4" }, - {0x12, 0x01, 0xc0, 0x40, "5" }, - - {0 , 0xfe, 0 , 10, "Coin B" }, - {0x13, 0x01, 0x0f, 0x06, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x07, "3 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x0f, 0x09, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 10, "Coin A" }, - {0x13, 0x01, 0xf0, 0x60, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, -}; - -STDDIPINFO(Cavenger) - -static struct BurnDIPInfo DorodonDIPList[]= -{ - {0x12, 0xff, 0xff, 0xdf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x03, 0x03, "Easy" }, - {0x12, 0x01, 0x03, 0x02, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x12, 0x01, 0x04, 0x04, "20000" }, - {0x12, 0x01, 0x04, 0x00, "30000" }, - - {0 , 0xfe, 0 , 2, "Rack Test (Cheat)" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x20, 0x00, "Upright" }, - {0x12, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x12, 0x01, 0x40, 0x40, "No" }, - {0x12, 0x01, 0x40, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x12, 0x01, 0x80, 0x80, "3" }, - {0x12, 0x01, 0x80, 0x00, "5" }, - - {0 , 0xfe, 0 , 10, "Coin B" }, - {0x13, 0x01, 0x0f, 0x06, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x07, "3 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x0f, 0x09, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 10, "Coin A" }, - {0x13, 0x01, 0xf0, 0x60, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, -}; - -STDDIPINFO(Dorodon) - -static struct BurnDIPInfo SraiderDIPList[]= -{ - {0x0f, 0xff, 0xff, 0xdf, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x0f, 0x01, 0x03, 0x03, "Easy" }, - {0x0f, 0x01, 0x03, 0x02, "Medium" }, - {0x0f, 0x01, 0x03, 0x01, "Hard" }, - {0x0f, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "High Score Names" }, - {0x0f, 0x01, 0x04, 0x00, "3 Letters" }, - {0x0f, 0x01, 0x04, 0x04, "10 Letters" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x0f, 0x01, 0x08, 0x08, "No" }, - {0x0f, 0x01, 0x08, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x0f, 0x01, 0x20, 0x00, "Upright" }, - {0x0f, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x0f, 0x01, 0xc0, 0x00, "2" }, - {0x0f, 0x01, 0xc0, 0xc0, "3" }, - {0x0f, 0x01, 0xc0, 0x80, "4" }, - {0x0f, 0x01, 0xc0, 0x40, "5" }, - - {0 , 0xfe, 0 , 11, "Coin A" }, - {0x10, 0x01, 0x0f, 0x06, "4 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x07, "3 Coins 2 Credits" }, - {0x10, 0x01, 0x0f, 0x09, "2 Coins 2 Credits" }, - {0x10, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x10, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x10, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x10, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x10, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x10, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 11, "Coin B" }, - {0x10, 0x01, 0xf0, 0x60, "4 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x70, "3 Coins 2 Credits" }, - {0x10, 0x01, 0xf0, 0x90, "2 Coins 2 Credits" }, - {0x10, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x10, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x10, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x10, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Sraider) - -void __fastcall ladybug_write(UINT16 address, UINT8 data) -{ - switch (address & 0xf000) - { - case 0xa000: - *flipscreen = data & 1; - return; - - case 0xb000: - SN76496Write(0, data); - return; - - case 0xc000: - SN76496Write(1, data); - return; - } -} - -UINT8 __fastcall ladybug_read(UINT16 address) -{ - switch (address) - { - case 0x8005: - return 0x3e; - - case 0x9000: - return DrvInputs[0]; - - case 0x9001: { - if (ladybug) { - if (DrvDips[0] & 0x20) { - return DrvInputs[1] ^ vblank; - } else { - return (DrvInputs[0] & 0x7f) ^ vblank; - } - } - - return DrvInputs[1] ^ vblank; - } - - case 0x9002: - return DrvDips[0]; - - case 0x9003: - return DrvDips[1]; - - case 0xe000: - return DrvInputs[2]; - } - - return 0; -} - -void __fastcall sraider_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8006: - soundlatch[0] = data; - return; - - case 0x8007: - soundlatch[1] = data; - return; - } -} - -void __fastcall sraider_sub_write(UINT16 address, UINT8 data) -{ - if (address == 0xe800) { - *flipscreen = data & 0x80; - *gridcolor = data & 0x70; - *enablestars = data & 0x08; - *starspeed =(data & 0x07) - 1; - } -} - -UINT8 __fastcall sraider_sub_read(UINT16 address) -{ - switch (address) - { - case 0x8000: - return soundlatch[0]; - - case 0xa000: - return soundlatch[1]; - } - - return 0; -} - -void __fastcall sraider_sub_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - SN76496Write(0, data); - return; - - case 0x08: - SN76496Write(1, data); - return; - - case 0x10: - SN76496Write(2, data); - return; - - case 0x18: - SN76496Write(3, data); - return; - - case 0x20: - SN76496Write(4, data); - return; - } -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - stars_offset = 0; - stars_state = 0; - vblank = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x010000; - DrvZ80ROM1 = Next; - DrvZ80Ops0 = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x008000; - DrvGfxROM1 = Next; Next += 0x008000; - DrvGfxROM2 = Next; Next += 0x008000; - DrvGfxROM3 = Next; Next += 0x008000; - - DrvColPROM = Next; Next += 0x000040; - - Palette = (UINT32*)Next; Next += 0x0082 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x0082 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x001000; - DrvZ80RAM1 = Next; Next += 0x000400; - - DrvColRAM = Next; Next += 0x000400; - DrvVidRAM = Next; Next += 0x000400; - DrvSprRAM = Next; Next += 0x000400; - DrvGridRAM = Next; Next += 0x000100; - - flipscreen = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000002; - gridcolor = Next; Next += 0x000001; - enablestars = Next; Next += 0x000001; - starspeed = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[2] = { 0x0000, 0x8000 }; - INT32 Plane1[2] = { 0x0001, 0x0000 }; - INT32 XOffs0[8] = { 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000 }; - INT32 YOffs0[8] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038 }; - INT32 XOffs1[16] = { 0x000, 0x002, 0x004, 0x006, 0x008, 0x00a, 0x00c, 0x00e, - 0x080, 0x082, 0x084, 0x086, 0x088, 0x08a, 0x08c, 0x08e }; - INT32 YOffs1[16] = { 0x170, 0x160, 0x150, 0x140, 0x130, 0x120, 0x110, 0x100, - 0x070, 0x060, 0x050, 0x040, 0x030, 0x020, 0x010, 0x000 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x2000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x2000); - - GfxDecode(0x200, 2, 8, 8, Plane0, XOffs0, YOffs0 + 0, 0x040, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x2000); - - GfxDecode(0x080, 2, 16, 16, Plane1, XOffs1, YOffs1 + 0, 0x200, tmp, DrvGfxROM1); - GfxDecode(0x200, 2, 8, 8, Plane1, XOffs1, YOffs1 + 8, 0x080, tmp, DrvGfxROM2); - - memcpy (tmp, DrvGfxROM3, 0x1000); - - GfxDecode(0x200, 1, 8, 8, Plane0, XOffs0, YOffs0 + 0, 0x040, tmp, DrvGfxROM3); - - BurnFree (tmp); - - return 0; -} - -static void DrvPaletteInit(INT32 sh0, INT32 sh1, INT32 sh2, INT32 sh3, INT32 sh4, INT32 sh5) -{ - for (INT32 i = 0; i < 0x20; i++) - { - INT32 bit0 = (~DrvColPROM[i] >> sh0) & 0x01; - INT32 bit1 = (~DrvColPROM[i] >> sh1) & 0x01; - INT32 r = bit0 * 82 + bit1 * 173; - - bit0 = (~DrvColPROM[i] >> sh2) & 0x01; - bit1 = (~DrvColPROM[i] >> sh3) & 0x01; - INT32 g = bit0 * 82 + bit1 * 173; - - bit0 = (~DrvColPROM[i] >> sh4) & 0x01; - bit1 = (~DrvColPROM[i] >> sh5) & 0x01; - INT32 b = bit0 * 82 + bit1 * 173; - - DrvPalette[i] = (r << 16) | (g << 8) | b; - } - - for (INT32 i = 0; i < 0x20; i++) - { - Palette[i + 0x00] = DrvPalette[((i << 3) & 0x18) | ((i >> 2) & 0x07)]; - Palette[i + 0x20] = DrvPalette[BITSWAP08(DrvColPROM[i + 0x20] & 0x0f, 7,6,5,4,0,1,2,3)]; - Palette[i + 0x40] = DrvPalette[BITSWAP08(DrvColPROM[i + 0x20] >> 4, 7,6,5,4,0,1,2,3)]; - } - - DrvRecalc = 1; -} - -static void SraiderPaletteInit() -{ - DrvPaletteInit(3, 0, 5, 4, 7, 6); - - for (INT32 i = 0; i < 0x20; i++) - { - INT32 bit0 = (i >> 3) & 0x01; - INT32 bit1 = (i >> 4) & 0x01; - INT32 b = 0x47 * bit0 + 0x97 * bit1; - - bit0 = (i >> 1) & 0x01; - bit1 = (i >> 2) & 0x01; - INT32 g = 0x47 * bit0 + 0x97 * bit1; - - bit0 = (i >> 0) & 0x01; - INT32 r = 0x47 * bit0; - - Palette[i + 0x60] = (r << 16) | (g << 8) | b; - } -} - -static INT32 DorodonDecode() -{ - UINT8 *tmp = DrvZ80RAM0; - - if (BurnLoadRom(tmp + 0x000, 7, 1)) return 1; - if (BurnLoadRom(tmp + 0x100, 8, 1)) return 1; - for (INT32 i = 0; i < 0x100; i++) { - tmp[i] = (tmp[i] << 4) | tmp[i + 0x100]; - } - - for (INT32 i = 0; i < 0x10000; i++) { - DrvZ80Ops0[i] = tmp[DrvZ80ROM0[i]]; - } - - return 0; -} - -static INT32 DrvInit(INT32 game_select) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - switch (game_select) - { - case 0: // ladybug, snapjack - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x01000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x03000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x05000, 5, 1)) return 1; - memcpy (DrvZ80Ops0, DrvZ80ROM0, 0x10000); - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x01000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x01000, 9, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00000, 10, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00020, 11, 1)) return 1; - - ladybug = 1; - } - break; - - case 1: // cavenger - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x01000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x03000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x05000, 5, 1)) return 1; - memcpy (DrvZ80Ops0, DrvZ80ROM0, 0x10000); - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x01000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00000, 9, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00020, 10, 1)) return 1; - } - break; - - case 2: // dorodon - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x01000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x01000, 6, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00000, 9, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00020, 10, 1)) return 1; - - DorodonDecode(); - } - break; - } - - DrvPaletteInit(0, 5, 2, 6, 4, 7); - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x5fff, 2, DrvZ80Ops0, DrvZ80ROM0); - ZetMapArea(0x6000, 0x6fff, 0, DrvZ80RAM0); - ZetMapArea(0x6000, 0x6fff, 1, DrvZ80RAM0); - ZetMapArea(0x6000, 0x6fff, 2, DrvZ80RAM0); - ZetMapArea(0x7000, 0x73ff, 0, DrvSprRAM); - ZetMapArea(0x7000, 0x73ff, 1, DrvSprRAM); - ZetMapArea(0x7000, 0x73ff, 2, DrvSprRAM); - ZetMapArea(0xd000, 0xd3ff, 0, DrvVidRAM); - ZetMapArea(0xd000, 0xd3ff, 1, DrvVidRAM); - ZetMapArea(0xd000, 0xd3ff, 2, DrvVidRAM); - ZetMapArea(0xd400, 0xd7ff, 0, DrvColRAM); - ZetMapArea(0xd400, 0xd7ff, 1, DrvColRAM); - ZetMapArea(0xd400, 0xd7ff, 2, DrvColRAM); - ZetSetWriteHandler(ladybug_write); - ZetSetReadHandler(ladybug_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); // So reset function can be shared - - SN76489Init(0, 4000000, 0); - SN76489Init(1, 4000000, 1); - SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 SraiderInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x02000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x04000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x01000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x01000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x00000, 10, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00000, 11, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00020, 12, 1)) return 1; - - SraiderPaletteInit(); - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM0); - ZetMapArea(0x6000, 0x6fff, 0, DrvZ80RAM0); - ZetMapArea(0x6000, 0x6fff, 1, DrvZ80RAM0); - ZetMapArea(0x6000, 0x6fff, 2, DrvZ80RAM0); - ZetMapArea(0x7000, 0x73ff, 0, DrvSprRAM); - ZetMapArea(0x7000, 0x73ff, 1, DrvSprRAM); - ZetMapArea(0x7000, 0x73ff, 2, DrvSprRAM); - ZetMapArea(0xd000, 0xd3ff, 0, DrvVidRAM); - ZetMapArea(0xd000, 0xd3ff, 1, DrvVidRAM); - ZetMapArea(0xd000, 0xd3ff, 2, DrvVidRAM); - ZetMapArea(0xd400, 0xd7ff, 0, DrvColRAM); - ZetMapArea(0xd400, 0xd7ff, 1, DrvColRAM); - ZetMapArea(0xd400, 0xd7ff, 2, DrvColRAM); - ZetSetWriteHandler(sraider_main_write); - ZetSetReadHandler(ladybug_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM1); - ZetMapArea(0x6000, 0x63ff, 0, DrvZ80RAM1); - ZetMapArea(0x6000, 0x63ff, 1, DrvZ80RAM1); - ZetMapArea(0x6000, 0x63ff, 2, DrvZ80RAM1); - ZetMapArea(0xe000, 0xe0ff, 0, DrvGridRAM); - ZetMapArea(0xe000, 0xe0ff, 1, DrvGridRAM); - ZetMapArea(0xe000, 0xe0ff, 2, DrvGridRAM); - ZetSetWriteHandler(sraider_sub_write); - ZetSetReadHandler(sraider_sub_read); - ZetSetOutHandler(sraider_sub_out); - ZetMemEnd(); - ZetClose(); - - SN76489Init(0, 4000000, 0); - SN76489Init(1, 4000000, 1); - SN76489Init(2, 4000000, 1); - SN76489Init(3, 4000000, 1); - SN76489Init(4, 4000000, 1); - SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(2, 1.00, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(3, 1.00, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(4, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - SN76496Exit(); - - BurnFree (AllMem); - - ladybug = 0; - - return 0; -} - -static void draw_layer() -{ - for (INT32 offs = 4 * 32; offs < 32 * 28; offs++) { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5); - - sx -= DrvVidRAM[((sy & 3) << 5) | (sy >> 2)] + 8; - if (sx < -7) sx += 256; - - INT32 code = DrvVidRAM[offs] | ((DrvColRAM[offs] & 0x08) << 5); - INT32 color = DrvColRAM[offs] & 0x07; - - if (*flipscreen) { - sx = 240 - sx; - sy = 196 - sy; - - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, (sy * 8) - 32, color, 2, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, (sy * 8) - 32, color, 2, 0, 0, DrvGfxROM0); - } - } -} - -static void draw_grid() -{ - for (INT32 offs = 4 * 32; offs < 32 * 28; offs++) - { - INT32 sx = ((offs & 0x1f) << 3) - 8; - INT32 sy = ((offs >> 5) << 3) - 32; - - if (*flipscreen) { - sx = 240 - sx; - sy = 196 - sy; - - if (offs & 0x200) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, (offs & 0x1ff) ^ 0x1e0, sx, sy, 0, 1, 0, 0x80, DrvGfxROM3); - } else { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, offs, sx, sy, 0, 1, 0, 0x80, DrvGfxROM3); - } - } else { - if (offs & 0x200) { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, (offs & 0x1ff) ^ 0x1e0, sx, sy, 0, 1, 0, 0x80, DrvGfxROM3); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, offs, sx, sy, 0, 1, 0, 0x80, DrvGfxROM3); - } - } - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0x400 - 2*0x40;offs >= 2*0x40;offs -= 0x40) - { - INT32 i = 0; - - while (i < 0x40 && DrvSprRAM[offs + i + 0] != 0) - i += 4; - - while (i > 0) - { - i -= 4; - - if (DrvSprRAM[offs + i + 0] & 0x80) - { - INT32 size = (DrvSprRAM[offs + i + 0] >> 6) & 0x01; - INT32 code = (DrvSprRAM[offs + i + 1] >> 2) + ((DrvSprRAM[offs + i + 2] & 0x10) << (4 >> size)); - INT32 color = (DrvSprRAM[offs + i + 2] & 0x0f) + 8; - INT32 flipx = DrvSprRAM[offs + i + 0] & 0x20; - INT32 flipy = DrvSprRAM[offs + i + 0] & 0x10; - INT32 sx = DrvSprRAM[offs + i + 3] - 8; - INT32 sy = (DrvSprRAM[offs + i + 0] & 0x0f) + offs / 4 - 32; - - if (size) { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy - 8, color, 2, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy - 8, color, 2, 0, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy - 8, color, 2, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy - 8, color, 2, 0, 0, DrvGfxROM1); - } - } - } else { - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } - } - } - } - } - } -} - -static void redclash_update_stars() -{ - static INT32 count = 0; - - if (*enablestars == 0) - return; - - count = (count + 1) & 1; - - if (count == 0) - { - stars_offset += ((*starspeed << 1) - 0x09); - stars_offset &= 0xffff; - stars_state = 0; - } - else - { - stars_state = 0x1fc71; - } -} - -static void redclash_draw_stars(INT32 palette_offset, INT32 sraider, INT32 firstx, INT32 lastx) -{ - UINT8 tempbit, feedback, star_color, hcond,vcond; - - if (*enablestars == 0) - return; - - UINT32 state = stars_state; - - for (INT32 i = 0; i < 256 * 256; i++) - { - INT32 xloc = (stars_offset + i) & 0xff; - INT32 yloc = ((stars_offset + i) >> 8) & 0xff; - - xloc -= 8; - yloc -= 32; - - if ((state & 0x10000) == 0) - tempbit = 1; - else - tempbit = 0; - - if ((state & 0x00020) != 0) - feedback = tempbit ^ 1; - else - feedback = tempbit ^ 0; - - hcond = ((xloc + 8) & 0x10) >> 4; - - if (sraider) - vcond = 1; - else - vcond = yloc & 0x01; - - if (xloc >= 0 && xloc < nScreenWidth && - yloc >= 0 && yloc < nScreenHeight) - { - if ((hcond ^ vcond) == 0) - { - if (((state & 0x000ff) == 0x000ff) && (feedback == 0)) - { - if ((xloc >= firstx) && (xloc <= lastx)) - { - star_color = (state >> 9) & 0x1f; - pTransDraw[(yloc * nScreenWidth) + xloc] = palette_offset + star_color; - } - } - } - } - - state = ((state << 1) & 0x1fffe) | feedback; - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x60; i++) { - INT32 d = Palette[i]; - DrvPalette[i] = BurnHighCol(d >> 16, d >> 8, d, 0); - } - DrvRecalc = 0; - } - - BurnTransferClear(); - - draw_layer(); - - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 SraiderDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x80; i++) { - INT32 d = Palette[i]; - DrvPalette[i] = BurnHighCol(d >> 16, d >> 8, d, 0); - } - DrvRecalc = 0; - } - - DrvPalette[0x81] = BurnHighCol((*gridcolor & 0x40) ? 0xff : 0, (*gridcolor & 0x20) ? 0xff : 0, (*gridcolor & 0x10) ? 0xff : 0, 0); - - BurnTransferClear(); - - if (*flipscreen) { - redclash_draw_stars(0x60, 1, 0x27, 0xff); - } else { - redclash_draw_stars(0x60, 1, 0x00, 0xd8); - } - redclash_update_stars(); - - draw_grid(); - - draw_layer(); - - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - INT32 coin = 0; - - { - INT32 previous = DrvInputs[3] ^ 0xff; - - memset (DrvInputs, 0xff, 4); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - } - if ((previous & 1) != (~DrvInputs[3] & 1)) coin |= 1; - if ((previous & 2) != (~DrvInputs[3] & 2)) coin |= 2; - DrvInputs[1] &= 0x7f; - } - - ZetOpen(0); - if (coin & 1) Z80SetIrqLine(0x20, DrvJoy4[0] ? Z80_ASSERT_LINE : Z80_CLEAR_LINE); - if (coin & 2) Z80SetIrqLine(0x00, DrvJoy4[1] ? Z80_ASSERT_LINE : Z80_CLEAR_LINE); - - vblank = 0xc0; - - for (INT32 i = 0; i < 32; i++) { - if (i == 5) vblank = 0; - if (i == 31) vblank = 0xc0; - - INT32 nSegment = (4000000 / 60) / 32; - - ZetRun(nSegment); - } - - ZetClose(); - - SN76496Update(0, pBurnSoundOut, nBurnSoundLen); - SN76496Update(1, pBurnSoundOut, nBurnSoundLen); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 SraiderFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 2); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - INT32 nInterleave = 100; - INT32 nTotalCycles[2] = { 4000000 / 60, 4000000 / 60 }; - - for (INT32 i = 0; i < nInterleave; i++) { - ZetOpen(0); - ZetRun(nTotalCycles[0] / nInterleave); - if (i == (nInterleave - 1)) ZetRaiseIrq(0); - ZetClose(); - - ZetOpen(1); - ZetRun(nTotalCycles[1] / nInterleave); - if (i == (nInterleave - 1)) ZetRaiseIrq(0); - ZetClose(); - } - - SN76496Update(0, pBurnSoundOut, nBurnSoundLen); - SN76496Update(1, pBurnSoundOut, nBurnSoundLen); - SN76496Update(2, pBurnSoundOut, nBurnSoundLen); - SN76496Update(3, pBurnSoundOut, nBurnSoundLen); - SN76496Update(4, pBurnSoundOut, nBurnSoundLen); - - if (pBurnDraw) { - SraiderDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029706; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - SN76496Scan(nAction, pnMin); - - SCAN_VAR(stars_offset); - SCAN_VAR(stars_state); - } - - return 0; -} - - -// Lady Bug - -static struct BurnRomInfo ladybugRomDesc[] = { - { "l1.c4", 0x1000, 0xd09e0adb, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "l2.d4", 0x1000, 0x88bc4a0a, 1 | BRF_PRG | BRF_ESS }, // 1 - { "l3.e4", 0x1000, 0x53e9efce, 1 | BRF_PRG | BRF_ESS }, // 2 - { "l4.h4", 0x1000, 0xffc424d7, 1 | BRF_PRG | BRF_ESS }, // 3 - { "l5.j4", 0x1000, 0xad6af809, 1 | BRF_PRG | BRF_ESS }, // 4 - { "l6.k4", 0x1000, 0xcf1acca4, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "l9.f7", 0x1000, 0x77b1da1e, 2 | BRF_GRA }, // 6 Characters - { "l0.h7", 0x1000, 0xaa82e00b, 2 | BRF_GRA }, // 7 - - { "l8.l7", 0x1000, 0x8b99910b, 3 | BRF_GRA }, // 8 Sprites - { "l7.m7", 0x1000, 0x86a5b448, 3 | BRF_GRA }, // 9 - - { "10-2.k1", 0x0020, 0xdf091e52, 4 | BRF_GRA }, // 10 Color PROMs - { "10-1.f4", 0x0020, 0x40640d8f, 4 | BRF_GRA }, // 11 - { "10-3.c4", 0x0020, 0x27fa3a50, 4 | BRF_OPT }, // 12 -}; - -STD_ROM_PICK(ladybug) -STD_ROM_FN(ladybug) - -static INT32 LadybugInit() -{ - return DrvInit(0); -} - -struct BurnDriver BurnDrvLadybug = { - "ladybug", NULL, NULL, NULL, "1981", - "Lady Bug\0", NULL, "Universal", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, ladybugRomInfo, ladybugRomName, NULL, NULL, LadybugInputInfo, LadybugDIPInfo, - LadybugInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, - 196, 240, 3, 4 -}; - - -// Lady Bug (bootleg set 1) - -static struct BurnRomInfo ladybugbRomDesc[] = { - { "lb1a.cpu", 0x1000, 0xec135e54, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "lb2a.cpu", 0x1000, 0x3049c5c6, 1 | BRF_PRG | BRF_ESS }, // 1 - { "lb3a.cpu", 0x1000, 0xb0fef837, 1 | BRF_PRG | BRF_ESS }, // 2 - { "l4.h4", 0x1000, 0xffc424d7, 1 | BRF_PRG | BRF_ESS }, // 3 - { "l5.j4", 0x1000, 0xad6af809, 1 | BRF_PRG | BRF_ESS }, // 4 - { "lb6a.cpu", 0x1000, 0x88c8002a, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "l9.f7", 0x1000, 0x77b1da1e, 2 | BRF_GRA }, // 6 Characters - { "l0.h7", 0x1000, 0xaa82e00b, 2 | BRF_GRA }, // 7 - - { "l8.l7", 0x1000, 0x8b99910b, 3 | BRF_GRA }, // 8 Sprites - { "l7.m7", 0x1000, 0x86a5b448, 3 | BRF_GRA }, // 9 - - { "10-2.k1", 0x0020, 0xdf091e52, 4 | BRF_GRA }, // 10 Color PROMs - { "10-1.f4", 0x0020, 0x40640d8f, 4 | BRF_GRA }, // 11 - { "10-3.c4", 0x0020, 0x27fa3a50, 4 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(ladybugb) -STD_ROM_FN(ladybugb) - -struct BurnDriver BurnDrvLadybugb = { - "ladybugb", "ladybug", NULL, NULL, "1981", - "Lady Bug (bootleg set 1)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, ladybugbRomInfo, ladybugbRomName, NULL, NULL, LadybugInputInfo, LadybugDIPInfo, - LadybugInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, - 196, 240, 3, 4 -}; - - -// Lady Bug (bootleg set 2) - -static struct BurnRomInfo ladybgb2RomDesc[] = { - { "lb1b.cpu", 0x1000, 0x35d61e65, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "lb2b.cpu", 0x1000, 0xa13e0fe4, 1 | BRF_PRG | BRF_ESS }, // 1 - { "lb3b.cpu", 0x1000, 0xee8ac716, 1 | BRF_PRG | BRF_ESS }, // 2 - { "l4.h4", 0x1000, 0xffc424d7, 1 | BRF_PRG | BRF_ESS }, // 3 - { "l5.j4", 0x1000, 0xad6af809, 1 | BRF_PRG | BRF_ESS }, // 4 - { "lb6b.cpu", 0x1000, 0xdc906e89, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "l9.f7", 0x1000, 0x77b1da1e, 2 | BRF_GRA }, // 6 Characters - { "l0.h7", 0x1000, 0xaa82e00b, 2 | BRF_GRA }, // 7 - - { "l8.l7", 0x1000, 0x8b99910b, 3 | BRF_GRA }, // 8 Sprites - { "l7.m7", 0x1000, 0x86a5b448, 3 | BRF_GRA }, // 9 - - { "10-2.k1", 0x0020, 0xdf091e52, 4 | BRF_GRA }, // 10 Color PROMs - { "10-1.f4", 0x0020, 0x40640d8f, 4 | BRF_GRA }, // 11 - { "10-3.c4", 0x0020, 0x27fa3a50, 4 | BRF_OPT }, // 12 -}; - -STD_ROM_PICK(ladybgb2) -STD_ROM_FN(ladybgb2) - -struct BurnDriver BurnDrvLadybgb2 = { - "ladybgb2", "ladybug", NULL, NULL, "1981", - "Lady Bug (bootleg set 2)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, ladybgb2RomInfo, ladybgb2RomName, NULL, NULL, LadybugInputInfo, LadybugDIPInfo, - LadybugInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, - 196, 240, 3, 4 -}; - - -// Snap Jack - -static struct BurnRomInfo snapjackRomDesc[] = { - { "sj1.c4", 0x1000, 0x6b30fcda, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "sj2.d4", 0x1000, 0x1f1088d1, 1 | BRF_PRG | BRF_ESS }, // 1 - { "sj3.e4", 0x1000, 0xedd65f3a, 1 | BRF_PRG | BRF_ESS }, // 2 - { "sj4.h4", 0x1000, 0xf4481192, 1 | BRF_PRG | BRF_ESS }, // 3 - { "sj5.j4", 0x1000, 0x1bff7d05, 1 | BRF_PRG | BRF_ESS }, // 4 - { "sj6.k4", 0x1000, 0x21793edf, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "sj9.f7", 0x1000, 0xff2011c7, 2 | BRF_GRA }, // 6 Characters - { "sj0.h7", 0x1000, 0xf097babb, 2 | BRF_GRA }, // 7 - - { "sj8.l7", 0x1000, 0xb7f105b6, 3 | BRF_GRA }, // 8 Sprites - { "sj7.m7", 0x1000, 0x1cdb03a8, 3 | BRF_GRA }, // 9 - - { "10-2.k1", 0x0020, 0xcbbd9dd1, 4 | BRF_GRA }, // 10 Color PROMs - { "10-1.f4", 0x0020, 0x5b16fbd2, 4 | BRF_GRA }, // 11 - { "10-3.c4", 0x0020, 0x27fa3a50, 4 | BRF_OPT }, // 12 -}; - -STD_ROM_PICK(snapjack) -STD_ROM_FN(snapjack) - -struct BurnDriver BurnDrvSnapjack = { - "snapjack", NULL, NULL, NULL, "1982", - "Snap Jack\0", NULL, "Universal", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, snapjackRomInfo, snapjackRomName, NULL, NULL, LadybugInputInfo, SnapjackDIPInfo, - LadybugInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, - 240, 196, 4, 3 -}; - - -// Cosmic Avenger - -static struct BurnRomInfo cavengerRomDesc[] = { - { "1.c4", 0x1000, 0x9e0cc781, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "2.d4", 0x1000, 0x5ce5b950, 1 | BRF_PRG | BRF_ESS }, // 1 - { "3.e4", 0x1000, 0xbc28218d, 1 | BRF_PRG | BRF_ESS }, // 2 - { "4.h4", 0x1000, 0x2b32e9f5, 1 | BRF_PRG | BRF_ESS }, // 3 - { "5.j4", 0x1000, 0xd117153e, 1 | BRF_PRG | BRF_ESS }, // 4 - { "6.k4", 0x1000, 0xc7d366cb, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "9.f7", 0x1000, 0x63357785, 2 | BRF_GRA }, // 6 Characters - { "0.h7", 0x1000, 0x52ad1133, 2 | BRF_GRA }, // 7 - - { "8.l7", 0x1000, 0xb022bf2d, 3 | BRF_GRA }, // 8 Sprites - - { "10-2.k1", 0x0020, 0x42a24dd5, 4 | BRF_GRA }, // 9 Color PROMs - { "10-1.f4", 0x0020, 0xd736b8de, 4 | BRF_GRA }, // 10 - { "10-3.c4", 0x0020, 0x27fa3a50, 4 | BRF_OPT }, // 11 -}; - -STD_ROM_PICK(cavenger) -STD_ROM_FN(cavenger) - -static INT32 CavengerInit() -{ - return DrvInit(1); -} - -struct BurnDriver BurnDrvCavenger = { - "cavenger", NULL, NULL, NULL, "1981", - "Cosmic Avenger\0", NULL, "Universal", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, cavengerRomInfo, cavengerRomName, NULL, NULL, LadybugInputInfo, CavengerDIPInfo, - CavengerInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, - 240, 196, 4, 3 -}; - - -// Dorodon (set 1) - -static struct BurnRomInfo dorodonRomDesc[] = { - { "dorodon.0", 0x2000, 0x460aaf26, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "dorodon.1", 0x2000, 0xd2451eb6, 1 | BRF_PRG | BRF_ESS }, // 1 - { "dorodon.2", 0x2000, 0xd3c6ee6c, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "dorodon.5", 0x1000, 0x5eee2b85, 2 | BRF_GRA }, // 3 Characters - { "dorodon.6", 0x1000, 0x395ac25a, 2 | BRF_GRA }, // 4 - - { "dorodon.4", 0x1000, 0xd70bb50a, 3 | BRF_GRA }, // 5 Sprites - { "dorodon.3", 0x1000, 0xe44e59e6, 3 | BRF_GRA }, // 6 - - { "dorodon.bp4", 0x0100, 0xf865c135, 4 | BRF_PRG | BRF_ESS }, // 7 Protection PROMs - { "dorodon.bp3", 0x0100, 0x47b2f0bb, 4 | BRF_PRG | BRF_ESS }, // 8 - - { "dorodon.bp0", 0x0020, 0x8fcf0bc8, 5 | BRF_GRA }, // 9 Color PROMs - { "dorodon.bp1", 0x0020, 0x3f209be4, 5 | BRF_GRA }, // 10 - { "dorodon.bp2", 0x0020, 0x27fa3a50, 5 | BRF_OPT }, // 11 -}; - -STD_ROM_PICK(dorodon) -STD_ROM_FN(dorodon) - -static INT32 DorodonInit() -{ - return DrvInit(2); -} - -struct BurnDriver BurnDrvDorodon = { - "dorodon", NULL, NULL, NULL, "1982", - "Dorodon (set 1)\0", NULL, "Falcon", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, dorodonRomInfo, dorodonRomName, NULL, NULL, LadybugInputInfo, DorodonDIPInfo, - DorodonInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, - 196, 240, 3, 4 -}; - - -// Dorodon (set 2) - -static struct BurnRomInfo dorodon2RomDesc[] = { - { "1.3fg", 0x2000, 0x4d05d6f8, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "2.3h", 0x2000, 0x27b43b09, 1 | BRF_PRG | BRF_ESS }, // 1 - { "3.3k", 0x2000, 0x38d2f295, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "6.6a", 0x1000, 0x2a2d8b9c, 2 | BRF_GRA }, // 3 Characters - { "7.6bc", 0x1000, 0xd14f95fa, 2 | BRF_GRA }, // 4 - - { "5.3t", 0x1000, 0x54c04f58, 3 | BRF_GRA }, // 5 Sprites - { "4.3r", 0x1000, 0x1ebb6493, 3 | BRF_GRA }, // 6 - - { "dorodon.bp4", 0x0100, 0xf865c135, 4 | BRF_PRG | BRF_ESS }, // 7 Protection PROMs - { "dorodon.bp3", 0x0100, 0x47b2f0bb, 4 | BRF_PRG | BRF_ESS }, // 8 - - { "dorodon.bp0", 0x0020, 0x8fcf0bc8, 5 | BRF_GRA }, // 9 Color PROMs - { "dorodon.bp1", 0x0020, 0x3f209be4, 5 | BRF_GRA }, // 10 - { "dorodon.bp2", 0x0020, 0x27fa3a50, 5 | BRF_OPT }, // 11 -}; - -STD_ROM_PICK(dorodon2) -STD_ROM_FN(dorodon2) - -struct BurnDriver BurnDrvDorodon2 = { - "dorodon2", "dorodon", NULL, NULL, "1982", - "Dorodon (set 2)\0", NULL, "Falcon", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, dorodon2RomInfo, dorodon2RomName, NULL, NULL, LadybugInputInfo, DorodonDIPInfo, - DorodonInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, - 196, 240, 3, 4 -}; - - -// Space Raider - -static struct BurnRomInfo sraiderRomDesc[] = { - { "sraid3.r4", 0x2000, 0x0f389774, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "sraid2.n4", 0x2000, 0x38a48db0, 1 | BRF_PRG | BRF_ESS }, // 1 - { "sraid1.m4", 0x2000, 0x2f302a4e, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "sraid-s4.h6", 0x2000, 0x57173a12, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - { "sraid-s5.j6", 0x2000, 0x5a459179, 2 | BRF_PRG | BRF_ESS }, // 4 - { "sraid-s6.l6", 0x2000, 0xea3aa25d, 2 | BRF_PRG | BRF_ESS }, // 5 - - { "sraid-s0.k6", 0x1000, 0xa0373909, 3 | BRF_GRA }, // 6 Characters - { "sraids11.l6", 0x1000, 0xba22d949, 3 | BRF_GRA }, // 7 - - { "sraid-s7.m2", 0x1000, 0x299f8e07, 4 | BRF_GRA }, // 8 Sprites - { "sraid-s8.n2", 0x1000, 0x57ba8888, 4 | BRF_GRA }, // 9 - - { "sraid-s9.f6", 0x1000, 0x2380b90f, 5 | BRF_GRA }, // 10 Grid Tiles - - { "srpr10-1.a2", 0x0020, 0x121fdb99, 6 | BRF_GRA }, // 11 Color PROMs - { "srpr10-2.l3", 0x0020, 0x88b67e70, 6 | BRF_GRA }, // 12 - { "srpr10-3.c1", 0x0020, 0x27fa3a50, 6 | BRF_OPT }, // 13 -}; - -STD_ROM_PICK(sraider) -STD_ROM_FN(sraider) - -struct BurnDriver BurnDrvSraider = { - "sraider", NULL, NULL, NULL, "1982", - "Space Raider\0", NULL, "Universal", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, sraiderRomInfo, sraiderRomName, NULL, NULL, SraiderInputInfo, SraiderDIPInfo, - SraiderInit, DrvExit, SraiderFrame, SraiderDraw, DrvScan, &DrvRecalc, 0x82, - 196, 240, 3, 4 -}; +// FB Alpha Lady Bug driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "sn76496.h" +#include "bitswap.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvZ80Ops0; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvColPROM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvColRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvGridRAM; + +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *flipscreen; +static UINT8 *soundlatch; +static UINT8 *gridcolor; +static UINT8 *enablestars; +static UINT8 *starspeed; + +static INT32 stars_offset; +static INT32 stars_state; +static INT32 vblank; +static INT32 ladybug = 0; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[4]; +static UINT8 DrvReset; + +static struct BurnInputInfo LadybugInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy4 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 5, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy3 + 0, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy4 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 6, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 7, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Ladybug) + +static struct BurnInputInfo SraiderInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 6, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 5, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 6, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Sraider) + +static struct BurnDIPInfo LadybugDIPList[]= +{ + {0x12, 0xff, 0xff, 0xdf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x03, 0x03, "Easy" }, + {0x12, 0x01, 0x03, 0x02, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "High Score Names" }, + {0x12, 0x01, 0x04, 0x00, "3 Letters" }, + {0x12, 0x01, 0x04, 0x04, "10 Letters" }, + + {0 , 0xfe, 0 , 2, "Rack Test (Cheat)" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x20, 0x00, "Upright" }, + {0x12, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x12, 0x01, 0x40, 0x40, "No" }, + {0x12, 0x01, 0x40, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x12, 0x01, 0x80, 0x80, "3" }, + {0x12, 0x01, 0x80, 0x00, "5" }, + + {0 , 0xfe, 0 , 10, "Coin B" }, + {0x13, 0x01, 0x0f, 0x06, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x07, "3 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x0f, 0x09, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 10, "Coin A" }, + {0x13, 0x01, 0xf0, 0x60, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, +}; + +STDDIPINFO(Ladybug) + +static struct BurnDIPInfo SnapjackDIPList[]= +{ + {0x12, 0xff, 0xff, 0xf7, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x03, 0x03, "Easy" }, + {0x12, 0x01, 0x03, 0x02, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "High Score Names" }, + {0x12, 0x01, 0x04, 0x00, "3 Letters" }, + {0x12, 0x01, 0x04, 0x04, "10 Letters" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x08, 0x00, "Upright" }, + {0x12, 0x01, 0x08, 0x08, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x80, "4" }, + {0x12, 0x01, 0xc0, 0x40, "5" }, + + {0 , 0xfe, 0 , 11, "Coin B" }, + {0x13, 0x01, 0x0f, 0x05, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x07, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x06, "3 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x09, "2 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x0f, 0x08, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 11, "Coin A" }, + {0x13, 0x01, 0xf0, 0x50, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "2 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, +}; + +STDDIPINFO(Snapjack) + +static struct BurnDIPInfo CavengerDIPList[]= +{ + {0x12, 0xff, 0xff, 0xc7, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x03, 0x03, "Easy" }, + {0x12, 0x01, 0x03, 0x02, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "High Score Names" }, + {0x12, 0x01, 0x04, 0x00, "3 Letters" }, + {0x12, 0x01, 0x04, 0x04, "10 Letters" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x08, 0x00, "Upright" }, + {0x12, 0x01, 0x08, 0x08, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Initial High Score" }, + {0x12, 0x01, 0x30, 0x00, "0" }, + {0x12, 0x01, 0x30, 0x30, "5000" }, + {0x12, 0x01, 0x30, 0x20, "8000" }, + {0x12, 0x01, 0x30, 0x10, "10000" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x80, "4" }, + {0x12, 0x01, 0xc0, 0x40, "5" }, + + {0 , 0xfe, 0 , 10, "Coin B" }, + {0x13, 0x01, 0x0f, 0x06, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x07, "3 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x0f, 0x09, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 10, "Coin A" }, + {0x13, 0x01, 0xf0, 0x60, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, +}; + +STDDIPINFO(Cavenger) + +static struct BurnDIPInfo DorodonDIPList[]= +{ + {0x12, 0xff, 0xff, 0xdf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x03, 0x03, "Easy" }, + {0x12, 0x01, 0x03, 0x02, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x12, 0x01, 0x04, 0x04, "20000" }, + {0x12, 0x01, 0x04, 0x00, "30000" }, + + {0 , 0xfe, 0 , 2, "Rack Test (Cheat)" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x20, 0x00, "Upright" }, + {0x12, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x12, 0x01, 0x40, 0x40, "No" }, + {0x12, 0x01, 0x40, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x12, 0x01, 0x80, 0x80, "3" }, + {0x12, 0x01, 0x80, 0x00, "5" }, + + {0 , 0xfe, 0 , 10, "Coin B" }, + {0x13, 0x01, 0x0f, 0x06, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x07, "3 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x0f, 0x09, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 10, "Coin A" }, + {0x13, 0x01, 0xf0, 0x60, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, +}; + +STDDIPINFO(Dorodon) + +static struct BurnDIPInfo SraiderDIPList[]= +{ + {0x0f, 0xff, 0xff, 0xdf, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x0f, 0x01, 0x03, 0x03, "Easy" }, + {0x0f, 0x01, 0x03, 0x02, "Medium" }, + {0x0f, 0x01, 0x03, 0x01, "Hard" }, + {0x0f, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "High Score Names" }, + {0x0f, 0x01, 0x04, 0x00, "3 Letters" }, + {0x0f, 0x01, 0x04, 0x04, "10 Letters" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x0f, 0x01, 0x08, 0x08, "No" }, + {0x0f, 0x01, 0x08, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x0f, 0x01, 0x20, 0x00, "Upright" }, + {0x0f, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x0f, 0x01, 0xc0, 0x00, "2" }, + {0x0f, 0x01, 0xc0, 0xc0, "3" }, + {0x0f, 0x01, 0xc0, 0x80, "4" }, + {0x0f, 0x01, 0xc0, 0x40, "5" }, + + {0 , 0xfe, 0 , 11, "Coin A" }, + {0x10, 0x01, 0x0f, 0x06, "4 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x07, "3 Coins 2 Credits" }, + {0x10, 0x01, 0x0f, 0x09, "2 Coins 2 Credits" }, + {0x10, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x10, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x10, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x10, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x10, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x10, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 11, "Coin B" }, + {0x10, 0x01, 0xf0, 0x60, "4 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x70, "3 Coins 2 Credits" }, + {0x10, 0x01, 0xf0, 0x90, "2 Coins 2 Credits" }, + {0x10, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x10, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x10, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x10, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x10, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x10, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Sraider) + +void __fastcall ladybug_write(UINT16 address, UINT8 data) +{ + switch (address & 0xf000) + { + case 0xa000: + *flipscreen = data & 1; + return; + + case 0xb000: + SN76496Write(0, data); + return; + + case 0xc000: + SN76496Write(1, data); + return; + } +} + +UINT8 __fastcall ladybug_read(UINT16 address) +{ + switch (address) + { + case 0x8005: + return 0x3e; + + case 0x9000: + return DrvInputs[0]; + + case 0x9001: { + if (ladybug) { + if (DrvDips[0] & 0x20) { + return DrvInputs[1] ^ vblank; + } else { + return (DrvInputs[0] & 0x7f) ^ vblank; + } + } + + return DrvInputs[1] ^ vblank; + } + + case 0x9002: + return DrvDips[0]; + + case 0x9003: + return DrvDips[1]; + + case 0xe000: + return DrvInputs[2]; + } + + return 0; +} + +void __fastcall sraider_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8006: + soundlatch[0] = data; + return; + + case 0x8007: + soundlatch[1] = data; + return; + } +} + +void __fastcall sraider_sub_write(UINT16 address, UINT8 data) +{ + if (address == 0xe800) { + *flipscreen = data & 0x80; + *gridcolor = data & 0x70; + *enablestars = data & 0x08; + *starspeed =(data & 0x07) - 1; + } +} + +UINT8 __fastcall sraider_sub_read(UINT16 address) +{ + switch (address) + { + case 0x8000: + return soundlatch[0]; + + case 0xa000: + return soundlatch[1]; + } + + return 0; +} + +void __fastcall sraider_sub_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + SN76496Write(0, data); + return; + + case 0x08: + SN76496Write(1, data); + return; + + case 0x10: + SN76496Write(2, data); + return; + + case 0x18: + SN76496Write(3, data); + return; + + case 0x20: + SN76496Write(4, data); + return; + } +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + stars_offset = 0; + stars_state = 0; + vblank = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x010000; + DrvZ80ROM1 = Next; + DrvZ80Ops0 = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x008000; + DrvGfxROM1 = Next; Next += 0x008000; + DrvGfxROM2 = Next; Next += 0x008000; + DrvGfxROM3 = Next; Next += 0x008000; + + DrvColPROM = Next; Next += 0x000040; + + Palette = (UINT32*)Next; Next += 0x0082 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x0082 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x001000; + DrvZ80RAM1 = Next; Next += 0x000400; + + DrvColRAM = Next; Next += 0x000400; + DrvVidRAM = Next; Next += 0x000400; + DrvSprRAM = Next; Next += 0x000400; + DrvGridRAM = Next; Next += 0x000100; + + flipscreen = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000002; + gridcolor = Next; Next += 0x000001; + enablestars = Next; Next += 0x000001; + starspeed = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[2] = { 0x0000, 0x8000 }; + INT32 Plane1[2] = { 0x0001, 0x0000 }; + INT32 XOffs0[8] = { 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000 }; + INT32 YOffs0[8] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038 }; + INT32 XOffs1[16] = { 0x000, 0x002, 0x004, 0x006, 0x008, 0x00a, 0x00c, 0x00e, + 0x080, 0x082, 0x084, 0x086, 0x088, 0x08a, 0x08c, 0x08e }; + INT32 YOffs1[16] = { 0x170, 0x160, 0x150, 0x140, 0x130, 0x120, 0x110, 0x100, + 0x070, 0x060, 0x050, 0x040, 0x030, 0x020, 0x010, 0x000 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x2000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x2000); + + GfxDecode(0x200, 2, 8, 8, Plane0, XOffs0, YOffs0 + 0, 0x040, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x2000); + + GfxDecode(0x080, 2, 16, 16, Plane1, XOffs1, YOffs1 + 0, 0x200, tmp, DrvGfxROM1); + GfxDecode(0x200, 2, 8, 8, Plane1, XOffs1, YOffs1 + 8, 0x080, tmp, DrvGfxROM2); + + memcpy (tmp, DrvGfxROM3, 0x1000); + + GfxDecode(0x200, 1, 8, 8, Plane0, XOffs0, YOffs0 + 0, 0x040, tmp, DrvGfxROM3); + + BurnFree (tmp); + + return 0; +} + +static void DrvPaletteInit(INT32 sh0, INT32 sh1, INT32 sh2, INT32 sh3, INT32 sh4, INT32 sh5) +{ + for (INT32 i = 0; i < 0x20; i++) + { + INT32 bit0 = (~DrvColPROM[i] >> sh0) & 0x01; + INT32 bit1 = (~DrvColPROM[i] >> sh1) & 0x01; + INT32 r = bit0 * 82 + bit1 * 173; + + bit0 = (~DrvColPROM[i] >> sh2) & 0x01; + bit1 = (~DrvColPROM[i] >> sh3) & 0x01; + INT32 g = bit0 * 82 + bit1 * 173; + + bit0 = (~DrvColPROM[i] >> sh4) & 0x01; + bit1 = (~DrvColPROM[i] >> sh5) & 0x01; + INT32 b = bit0 * 82 + bit1 * 173; + + DrvPalette[i] = (r << 16) | (g << 8) | b; + } + + for (INT32 i = 0; i < 0x20; i++) + { + Palette[i + 0x00] = DrvPalette[((i << 3) & 0x18) | ((i >> 2) & 0x07)]; + Palette[i + 0x20] = DrvPalette[BITSWAP08(DrvColPROM[i + 0x20] & 0x0f, 7,6,5,4,0,1,2,3)]; + Palette[i + 0x40] = DrvPalette[BITSWAP08(DrvColPROM[i + 0x20] >> 4, 7,6,5,4,0,1,2,3)]; + } + + DrvRecalc = 1; +} + +static void SraiderPaletteInit() +{ + DrvPaletteInit(3, 0, 5, 4, 7, 6); + + for (INT32 i = 0; i < 0x20; i++) + { + INT32 bit0 = (i >> 3) & 0x01; + INT32 bit1 = (i >> 4) & 0x01; + INT32 b = 0x47 * bit0 + 0x97 * bit1; + + bit0 = (i >> 1) & 0x01; + bit1 = (i >> 2) & 0x01; + INT32 g = 0x47 * bit0 + 0x97 * bit1; + + bit0 = (i >> 0) & 0x01; + INT32 r = 0x47 * bit0; + + Palette[i + 0x60] = (r << 16) | (g << 8) | b; + } +} + +static INT32 DorodonDecode() +{ + UINT8 *tmp = DrvZ80RAM0; + + if (BurnLoadRom(tmp + 0x000, 7, 1)) return 1; + if (BurnLoadRom(tmp + 0x100, 8, 1)) return 1; + for (INT32 i = 0; i < 0x100; i++) { + tmp[i] = (tmp[i] << 4) | tmp[i + 0x100]; + } + + for (INT32 i = 0; i < 0x10000; i++) { + DrvZ80Ops0[i] = tmp[DrvZ80ROM0[i]]; + } + + return 0; +} + +static INT32 DrvInit(INT32 game_select) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + switch (game_select) + { + case 0: // ladybug, snapjack + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x01000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x03000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x05000, 5, 1)) return 1; + memcpy (DrvZ80Ops0, DrvZ80ROM0, 0x10000); + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x01000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x01000, 9, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00000, 10, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00020, 11, 1)) return 1; + + ladybug = 1; + } + break; + + case 1: // cavenger + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x01000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x03000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x05000, 5, 1)) return 1; + memcpy (DrvZ80Ops0, DrvZ80ROM0, 0x10000); + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x01000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00000, 9, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00020, 10, 1)) return 1; + } + break; + + case 2: // dorodon + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x01000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x01000, 6, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00000, 9, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00020, 10, 1)) return 1; + + DorodonDecode(); + } + break; + } + + DrvPaletteInit(0, 5, 2, 6, 4, 7); + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x5fff, 2, DrvZ80Ops0, DrvZ80ROM0); + ZetMapArea(0x6000, 0x6fff, 0, DrvZ80RAM0); + ZetMapArea(0x6000, 0x6fff, 1, DrvZ80RAM0); + ZetMapArea(0x6000, 0x6fff, 2, DrvZ80RAM0); + ZetMapArea(0x7000, 0x73ff, 0, DrvSprRAM); + ZetMapArea(0x7000, 0x73ff, 1, DrvSprRAM); + ZetMapArea(0x7000, 0x73ff, 2, DrvSprRAM); + ZetMapArea(0xd000, 0xd3ff, 0, DrvVidRAM); + ZetMapArea(0xd000, 0xd3ff, 1, DrvVidRAM); + ZetMapArea(0xd000, 0xd3ff, 2, DrvVidRAM); + ZetMapArea(0xd400, 0xd7ff, 0, DrvColRAM); + ZetMapArea(0xd400, 0xd7ff, 1, DrvColRAM); + ZetMapArea(0xd400, 0xd7ff, 2, DrvColRAM); + ZetSetWriteHandler(ladybug_write); + ZetSetReadHandler(ladybug_read); + ZetClose(); + + ZetInit(1); // So reset function can be shared + + SN76489Init(0, 4000000, 0); + SN76489Init(1, 4000000, 1); + SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 SraiderInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x02000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x04000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x01000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x01000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x00000, 10, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00000, 11, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00020, 12, 1)) return 1; + + SraiderPaletteInit(); + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM0); + ZetMapArea(0x6000, 0x6fff, 0, DrvZ80RAM0); + ZetMapArea(0x6000, 0x6fff, 1, DrvZ80RAM0); + ZetMapArea(0x6000, 0x6fff, 2, DrvZ80RAM0); + ZetMapArea(0x7000, 0x73ff, 0, DrvSprRAM); + ZetMapArea(0x7000, 0x73ff, 1, DrvSprRAM); + ZetMapArea(0x7000, 0x73ff, 2, DrvSprRAM); + ZetMapArea(0xd000, 0xd3ff, 0, DrvVidRAM); + ZetMapArea(0xd000, 0xd3ff, 1, DrvVidRAM); + ZetMapArea(0xd000, 0xd3ff, 2, DrvVidRAM); + ZetMapArea(0xd400, 0xd7ff, 0, DrvColRAM); + ZetMapArea(0xd400, 0xd7ff, 1, DrvColRAM); + ZetMapArea(0xd400, 0xd7ff, 2, DrvColRAM); + ZetSetWriteHandler(sraider_main_write); + ZetSetReadHandler(ladybug_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM1); + ZetMapArea(0x6000, 0x63ff, 0, DrvZ80RAM1); + ZetMapArea(0x6000, 0x63ff, 1, DrvZ80RAM1); + ZetMapArea(0x6000, 0x63ff, 2, DrvZ80RAM1); + ZetMapArea(0xe000, 0xe0ff, 0, DrvGridRAM); + ZetMapArea(0xe000, 0xe0ff, 1, DrvGridRAM); + ZetMapArea(0xe000, 0xe0ff, 2, DrvGridRAM); + ZetSetWriteHandler(sraider_sub_write); + ZetSetReadHandler(sraider_sub_read); + ZetSetOutHandler(sraider_sub_out); + ZetClose(); + + SN76489Init(0, 4000000, 0); + SN76489Init(1, 4000000, 1); + SN76489Init(2, 4000000, 1); + SN76489Init(3, 4000000, 1); + SN76489Init(4, 4000000, 1); + SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(2, 1.00, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(3, 1.00, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(4, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + SN76496Exit(); + + BurnFree (AllMem); + + ladybug = 0; + + return 0; +} + +static void draw_layer() +{ + for (INT32 offs = 4 * 32; offs < 32 * 28; offs++) { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5); + + sx -= DrvVidRAM[((sy & 3) << 5) | (sy >> 2)] + 8; + if (sx < -7) sx += 256; + + INT32 code = DrvVidRAM[offs] | ((DrvColRAM[offs] & 0x08) << 5); + INT32 color = DrvColRAM[offs] & 0x07; + + if (*flipscreen) { + sx = 240 - sx; + sy = 196 - sy; + + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, (sy * 8) - 32, color, 2, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, (sy * 8) - 32, color, 2, 0, 0, DrvGfxROM0); + } + } +} + +static void draw_grid() +{ + for (INT32 offs = 4 * 32; offs < 32 * 28; offs++) + { + INT32 sx = ((offs & 0x1f) << 3) - 8; + INT32 sy = ((offs >> 5) << 3) - 32; + + if (*flipscreen) { + sx = 240 - sx; + sy = 196 - sy; + + if (offs & 0x200) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, (offs & 0x1ff) ^ 0x1e0, sx, sy, 0, 1, 0, 0x80, DrvGfxROM3); + } else { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, offs, sx, sy, 0, 1, 0, 0x80, DrvGfxROM3); + } + } else { + if (offs & 0x200) { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, (offs & 0x1ff) ^ 0x1e0, sx, sy, 0, 1, 0, 0x80, DrvGfxROM3); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, offs, sx, sy, 0, 1, 0, 0x80, DrvGfxROM3); + } + } + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0x400 - 2*0x40;offs >= 2*0x40;offs -= 0x40) + { + INT32 i = 0; + + while (i < 0x40 && DrvSprRAM[offs + i + 0] != 0) + i += 4; + + while (i > 0) + { + i -= 4; + + if (DrvSprRAM[offs + i + 0] & 0x80) + { + INT32 size = (DrvSprRAM[offs + i + 0] >> 6) & 0x01; + INT32 code = (DrvSprRAM[offs + i + 1] >> 2) + ((DrvSprRAM[offs + i + 2] & 0x10) << (4 >> size)); + INT32 color = (DrvSprRAM[offs + i + 2] & 0x0f) + 8; + INT32 flipx = DrvSprRAM[offs + i + 0] & 0x20; + INT32 flipy = DrvSprRAM[offs + i + 0] & 0x10; + INT32 sx = DrvSprRAM[offs + i + 3] - 8; + INT32 sy = (DrvSprRAM[offs + i + 0] & 0x0f) + offs / 4 - 32; + + if (size) { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy - 8, color, 2, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy - 8, color, 2, 0, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy - 8, color, 2, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy - 8, color, 2, 0, 0, DrvGfxROM1); + } + } + } else { + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } + } + } + } + } + } +} + +static void redclash_update_stars() +{ + static INT32 count = 0; + + if (*enablestars == 0) + return; + + count = (count + 1) & 1; + + if (count == 0) + { + stars_offset += ((*starspeed << 1) - 0x09); + stars_offset &= 0xffff; + stars_state = 0; + } + else + { + stars_state = 0x1fc71; + } +} + +static void redclash_draw_stars(INT32 palette_offset, INT32 sraider, INT32 firstx, INT32 lastx) +{ + UINT8 tempbit, feedback, star_color, hcond,vcond; + + if (*enablestars == 0) + return; + + UINT32 state = stars_state; + + for (INT32 i = 0; i < 256 * 256; i++) + { + INT32 xloc = (stars_offset + i) & 0xff; + INT32 yloc = ((stars_offset + i) >> 8) & 0xff; + + xloc -= 8; + yloc -= 32; + + if ((state & 0x10000) == 0) + tempbit = 1; + else + tempbit = 0; + + if ((state & 0x00020) != 0) + feedback = tempbit ^ 1; + else + feedback = tempbit ^ 0; + + hcond = ((xloc + 8) & 0x10) >> 4; + + if (sraider) + vcond = 1; + else + vcond = yloc & 0x01; + + if (xloc >= 0 && xloc < nScreenWidth && + yloc >= 0 && yloc < nScreenHeight) + { + if ((hcond ^ vcond) == 0) + { + if (((state & 0x000ff) == 0x000ff) && (feedback == 0)) + { + if ((xloc >= firstx) && (xloc <= lastx)) + { + star_color = (state >> 9) & 0x1f; + pTransDraw[(yloc * nScreenWidth) + xloc] = palette_offset + star_color; + } + } + } + } + + state = ((state << 1) & 0x1fffe) | feedback; + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x60; i++) { + INT32 d = Palette[i]; + DrvPalette[i] = BurnHighCol(d >> 16, d >> 8, d, 0); + } + DrvRecalc = 0; + } + + BurnTransferClear(); + + draw_layer(); + + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 SraiderDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x80; i++) { + INT32 d = Palette[i]; + DrvPalette[i] = BurnHighCol(d >> 16, d >> 8, d, 0); + } + DrvRecalc = 0; + } + + DrvPalette[0x81] = BurnHighCol((*gridcolor & 0x40) ? 0xff : 0, (*gridcolor & 0x20) ? 0xff : 0, (*gridcolor & 0x10) ? 0xff : 0, 0); + + BurnTransferClear(); + + if (*flipscreen) { + redclash_draw_stars(0x60, 1, 0x27, 0xff); + } else { + redclash_draw_stars(0x60, 1, 0x00, 0xd8); + } + redclash_update_stars(); + + draw_grid(); + + draw_layer(); + + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + INT32 coin = 0; + + { + INT32 previous = DrvInputs[3] ^ 0xff; + + memset (DrvInputs, 0xff, 4); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + } + if ((previous & 1) != (~DrvInputs[3] & 1)) coin |= 1; + if ((previous & 2) != (~DrvInputs[3] & 2)) coin |= 2; + DrvInputs[1] &= 0x7f; + } + + ZetOpen(0); + if (coin & 1) Z80SetIrqLine(0x20, DrvJoy4[0] ? Z80_ASSERT_LINE : Z80_CLEAR_LINE); + if (coin & 2) Z80SetIrqLine(0x00, DrvJoy4[1] ? Z80_ASSERT_LINE : Z80_CLEAR_LINE); + + vblank = 0xc0; + + for (INT32 i = 0; i < 32; i++) { + if (i == 5) vblank = 0; + if (i == 31) vblank = 0xc0; + + INT32 nSegment = (4000000 / 60) / 32; + + ZetRun(nSegment); + } + + ZetClose(); + + SN76496Update(0, pBurnSoundOut, nBurnSoundLen); + SN76496Update(1, pBurnSoundOut, nBurnSoundLen); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 SraiderFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 2); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + INT32 nInterleave = 100; + INT32 nTotalCycles[2] = { 4000000 / 60, 4000000 / 60 }; + + for (INT32 i = 0; i < nInterleave; i++) { + ZetOpen(0); + ZetRun(nTotalCycles[0] / nInterleave); + if (i == (nInterleave - 1)) ZetRaiseIrq(0); + ZetClose(); + + ZetOpen(1); + ZetRun(nTotalCycles[1] / nInterleave); + if (i == (nInterleave - 1)) ZetRaiseIrq(0); + ZetClose(); + } + + SN76496Update(0, pBurnSoundOut, nBurnSoundLen); + SN76496Update(1, pBurnSoundOut, nBurnSoundLen); + SN76496Update(2, pBurnSoundOut, nBurnSoundLen); + SN76496Update(3, pBurnSoundOut, nBurnSoundLen); + SN76496Update(4, pBurnSoundOut, nBurnSoundLen); + + if (pBurnDraw) { + SraiderDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029706; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + SN76496Scan(nAction, pnMin); + + SCAN_VAR(stars_offset); + SCAN_VAR(stars_state); + } + + return 0; +} + + +// Lady Bug + +static struct BurnRomInfo ladybugRomDesc[] = { + { "l1.c4", 0x1000, 0xd09e0adb, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "l2.d4", 0x1000, 0x88bc4a0a, 1 | BRF_PRG | BRF_ESS }, // 1 + { "l3.e4", 0x1000, 0x53e9efce, 1 | BRF_PRG | BRF_ESS }, // 2 + { "l4.h4", 0x1000, 0xffc424d7, 1 | BRF_PRG | BRF_ESS }, // 3 + { "l5.j4", 0x1000, 0xad6af809, 1 | BRF_PRG | BRF_ESS }, // 4 + { "l6.k4", 0x1000, 0xcf1acca4, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "l9.f7", 0x1000, 0x77b1da1e, 2 | BRF_GRA }, // 6 Characters + { "l0.h7", 0x1000, 0xaa82e00b, 2 | BRF_GRA }, // 7 + + { "l8.l7", 0x1000, 0x8b99910b, 3 | BRF_GRA }, // 8 Sprites + { "l7.m7", 0x1000, 0x86a5b448, 3 | BRF_GRA }, // 9 + + { "10-2.k1", 0x0020, 0xdf091e52, 4 | BRF_GRA }, // 10 Color PROMs + { "10-1.f4", 0x0020, 0x40640d8f, 4 | BRF_GRA }, // 11 + { "10-3.c4", 0x0020, 0x27fa3a50, 4 | BRF_OPT }, // 12 +}; + +STD_ROM_PICK(ladybug) +STD_ROM_FN(ladybug) + +static INT32 LadybugInit() +{ + return DrvInit(0); +} + +struct BurnDriver BurnDrvLadybug = { + "ladybug", NULL, NULL, NULL, "1981", + "Lady Bug\0", NULL, "Universal", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, ladybugRomInfo, ladybugRomName, NULL, NULL, LadybugInputInfo, LadybugDIPInfo, + LadybugInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, + 196, 240, 3, 4 +}; + + +// Lady Bug (bootleg set 1) + +static struct BurnRomInfo ladybugbRomDesc[] = { + { "lb1a.cpu", 0x1000, 0xec135e54, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "lb2a.cpu", 0x1000, 0x3049c5c6, 1 | BRF_PRG | BRF_ESS }, // 1 + { "lb3a.cpu", 0x1000, 0xb0fef837, 1 | BRF_PRG | BRF_ESS }, // 2 + { "l4.h4", 0x1000, 0xffc424d7, 1 | BRF_PRG | BRF_ESS }, // 3 + { "l5.j4", 0x1000, 0xad6af809, 1 | BRF_PRG | BRF_ESS }, // 4 + { "lb6a.cpu", 0x1000, 0x88c8002a, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "l9.f7", 0x1000, 0x77b1da1e, 2 | BRF_GRA }, // 6 Characters + { "l0.h7", 0x1000, 0xaa82e00b, 2 | BRF_GRA }, // 7 + + { "l8.l7", 0x1000, 0x8b99910b, 3 | BRF_GRA }, // 8 Sprites + { "l7.m7", 0x1000, 0x86a5b448, 3 | BRF_GRA }, // 9 + + { "10-2.k1", 0x0020, 0xdf091e52, 4 | BRF_GRA }, // 10 Color PROMs + { "10-1.f4", 0x0020, 0x40640d8f, 4 | BRF_GRA }, // 11 + { "10-3.c4", 0x0020, 0x27fa3a50, 4 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(ladybugb) +STD_ROM_FN(ladybugb) + +struct BurnDriver BurnDrvLadybugb = { + "ladybugb", "ladybug", NULL, NULL, "1981", + "Lady Bug (bootleg set 1)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, ladybugbRomInfo, ladybugbRomName, NULL, NULL, LadybugInputInfo, LadybugDIPInfo, + LadybugInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, + 196, 240, 3, 4 +}; + + +// Lady Bug (bootleg set 2) + +static struct BurnRomInfo ladybgb2RomDesc[] = { + { "lb1b.cpu", 0x1000, 0x35d61e65, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "lb2b.cpu", 0x1000, 0xa13e0fe4, 1 | BRF_PRG | BRF_ESS }, // 1 + { "lb3b.cpu", 0x1000, 0xee8ac716, 1 | BRF_PRG | BRF_ESS }, // 2 + { "l4.h4", 0x1000, 0xffc424d7, 1 | BRF_PRG | BRF_ESS }, // 3 + { "l5.j4", 0x1000, 0xad6af809, 1 | BRF_PRG | BRF_ESS }, // 4 + { "lb6b.cpu", 0x1000, 0xdc906e89, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "l9.f7", 0x1000, 0x77b1da1e, 2 | BRF_GRA }, // 6 Characters + { "l0.h7", 0x1000, 0xaa82e00b, 2 | BRF_GRA }, // 7 + + { "l8.l7", 0x1000, 0x8b99910b, 3 | BRF_GRA }, // 8 Sprites + { "l7.m7", 0x1000, 0x86a5b448, 3 | BRF_GRA }, // 9 + + { "10-2.k1", 0x0020, 0xdf091e52, 4 | BRF_GRA }, // 10 Color PROMs + { "10-1.f4", 0x0020, 0x40640d8f, 4 | BRF_GRA }, // 11 + { "10-3.c4", 0x0020, 0x27fa3a50, 4 | BRF_OPT }, // 12 +}; + +STD_ROM_PICK(ladybgb2) +STD_ROM_FN(ladybgb2) + +struct BurnDriver BurnDrvLadybgb2 = { + "ladybgb2", "ladybug", NULL, NULL, "1981", + "Lady Bug (bootleg set 2)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, ladybgb2RomInfo, ladybgb2RomName, NULL, NULL, LadybugInputInfo, LadybugDIPInfo, + LadybugInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, + 196, 240, 3, 4 +}; + + +// Snap Jack + +static struct BurnRomInfo snapjackRomDesc[] = { + { "sj1.c4", 0x1000, 0x6b30fcda, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "sj2.d4", 0x1000, 0x1f1088d1, 1 | BRF_PRG | BRF_ESS }, // 1 + { "sj3.e4", 0x1000, 0xedd65f3a, 1 | BRF_PRG | BRF_ESS }, // 2 + { "sj4.h4", 0x1000, 0xf4481192, 1 | BRF_PRG | BRF_ESS }, // 3 + { "sj5.j4", 0x1000, 0x1bff7d05, 1 | BRF_PRG | BRF_ESS }, // 4 + { "sj6.k4", 0x1000, 0x21793edf, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "sj9.f7", 0x1000, 0xff2011c7, 2 | BRF_GRA }, // 6 Characters + { "sj0.h7", 0x1000, 0xf097babb, 2 | BRF_GRA }, // 7 + + { "sj8.l7", 0x1000, 0xb7f105b6, 3 | BRF_GRA }, // 8 Sprites + { "sj7.m7", 0x1000, 0x1cdb03a8, 3 | BRF_GRA }, // 9 + + { "10-2.k1", 0x0020, 0xcbbd9dd1, 4 | BRF_GRA }, // 10 Color PROMs + { "10-1.f4", 0x0020, 0x5b16fbd2, 4 | BRF_GRA }, // 11 + { "10-3.c4", 0x0020, 0x27fa3a50, 4 | BRF_OPT }, // 12 +}; + +STD_ROM_PICK(snapjack) +STD_ROM_FN(snapjack) + +struct BurnDriver BurnDrvSnapjack = { + "snapjack", NULL, NULL, NULL, "1982", + "Snap Jack\0", NULL, "Universal", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, snapjackRomInfo, snapjackRomName, NULL, NULL, LadybugInputInfo, SnapjackDIPInfo, + LadybugInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, + 240, 196, 4, 3 +}; + + +// Cosmic Avenger + +static struct BurnRomInfo cavengerRomDesc[] = { + { "1.c4", 0x1000, 0x9e0cc781, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "2.d4", 0x1000, 0x5ce5b950, 1 | BRF_PRG | BRF_ESS }, // 1 + { "3.e4", 0x1000, 0xbc28218d, 1 | BRF_PRG | BRF_ESS }, // 2 + { "4.h4", 0x1000, 0x2b32e9f5, 1 | BRF_PRG | BRF_ESS }, // 3 + { "5.j4", 0x1000, 0xd117153e, 1 | BRF_PRG | BRF_ESS }, // 4 + { "6.k4", 0x1000, 0xc7d366cb, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "9.f7", 0x1000, 0x63357785, 2 | BRF_GRA }, // 6 Characters + { "0.h7", 0x1000, 0x52ad1133, 2 | BRF_GRA }, // 7 + + { "8.l7", 0x1000, 0xb022bf2d, 3 | BRF_GRA }, // 8 Sprites + + { "10-2.k1", 0x0020, 0x42a24dd5, 4 | BRF_GRA }, // 9 Color PROMs + { "10-1.f4", 0x0020, 0xd736b8de, 4 | BRF_GRA }, // 10 + { "10-3.c4", 0x0020, 0x27fa3a50, 4 | BRF_OPT }, // 11 +}; + +STD_ROM_PICK(cavenger) +STD_ROM_FN(cavenger) + +static INT32 CavengerInit() +{ + return DrvInit(1); +} + +struct BurnDriver BurnDrvCavenger = { + "cavenger", NULL, NULL, NULL, "1981", + "Cosmic Avenger\0", NULL, "Universal", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, cavengerRomInfo, cavengerRomName, NULL, NULL, LadybugInputInfo, CavengerDIPInfo, + CavengerInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, + 240, 196, 4, 3 +}; + + +// Dorodon (set 1) + +static struct BurnRomInfo dorodonRomDesc[] = { + { "dorodon.0", 0x2000, 0x460aaf26, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "dorodon.1", 0x2000, 0xd2451eb6, 1 | BRF_PRG | BRF_ESS }, // 1 + { "dorodon.2", 0x2000, 0xd3c6ee6c, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "dorodon.5", 0x1000, 0x5eee2b85, 2 | BRF_GRA }, // 3 Characters + { "dorodon.6", 0x1000, 0x395ac25a, 2 | BRF_GRA }, // 4 + + { "dorodon.4", 0x1000, 0xd70bb50a, 3 | BRF_GRA }, // 5 Sprites + { "dorodon.3", 0x1000, 0xe44e59e6, 3 | BRF_GRA }, // 6 + + { "dorodon.bp4", 0x0100, 0xf865c135, 4 | BRF_PRG | BRF_ESS }, // 7 Protection PROMs + { "dorodon.bp3", 0x0100, 0x47b2f0bb, 4 | BRF_PRG | BRF_ESS }, // 8 + + { "dorodon.bp0", 0x0020, 0x8fcf0bc8, 5 | BRF_GRA }, // 9 Color PROMs + { "dorodon.bp1", 0x0020, 0x3f209be4, 5 | BRF_GRA }, // 10 + { "dorodon.bp2", 0x0020, 0x27fa3a50, 5 | BRF_OPT }, // 11 +}; + +STD_ROM_PICK(dorodon) +STD_ROM_FN(dorodon) + +static INT32 DorodonInit() +{ + return DrvInit(2); +} + +struct BurnDriver BurnDrvDorodon = { + "dorodon", NULL, NULL, NULL, "1982", + "Dorodon (set 1)\0", NULL, "Falcon", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, dorodonRomInfo, dorodonRomName, NULL, NULL, LadybugInputInfo, DorodonDIPInfo, + DorodonInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, + 196, 240, 3, 4 +}; + + +// Dorodon (set 2) + +static struct BurnRomInfo dorodon2RomDesc[] = { + { "1.3fg", 0x2000, 0x4d05d6f8, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "2.3h", 0x2000, 0x27b43b09, 1 | BRF_PRG | BRF_ESS }, // 1 + { "3.3k", 0x2000, 0x38d2f295, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "6.6a", 0x1000, 0x2a2d8b9c, 2 | BRF_GRA }, // 3 Characters + { "7.6bc", 0x1000, 0xd14f95fa, 2 | BRF_GRA }, // 4 + + { "5.3t", 0x1000, 0x54c04f58, 3 | BRF_GRA }, // 5 Sprites + { "4.3r", 0x1000, 0x1ebb6493, 3 | BRF_GRA }, // 6 + + { "dorodon.bp4", 0x0100, 0xf865c135, 4 | BRF_PRG | BRF_ESS }, // 7 Protection PROMs + { "dorodon.bp3", 0x0100, 0x47b2f0bb, 4 | BRF_PRG | BRF_ESS }, // 8 + + { "dorodon.bp0", 0x0020, 0x8fcf0bc8, 5 | BRF_GRA }, // 9 Color PROMs + { "dorodon.bp1", 0x0020, 0x3f209be4, 5 | BRF_GRA }, // 10 + { "dorodon.bp2", 0x0020, 0x27fa3a50, 5 | BRF_OPT }, // 11 +}; + +STD_ROM_PICK(dorodon2) +STD_ROM_FN(dorodon2) + +struct BurnDriver BurnDrvDorodon2 = { + "dorodon2", "dorodon", NULL, NULL, "1982", + "Dorodon (set 2)\0", NULL, "Falcon", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, dorodon2RomInfo, dorodon2RomName, NULL, NULL, LadybugInputInfo, DorodonDIPInfo, + DorodonInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60, + 196, 240, 3, 4 +}; + + +// Space Raider + +static struct BurnRomInfo sraiderRomDesc[] = { + { "sraid3.r4", 0x2000, 0x0f389774, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "sraid2.n4", 0x2000, 0x38a48db0, 1 | BRF_PRG | BRF_ESS }, // 1 + { "sraid1.m4", 0x2000, 0x2f302a4e, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "sraid-s4.h6", 0x2000, 0x57173a12, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + { "sraid-s5.j6", 0x2000, 0x5a459179, 2 | BRF_PRG | BRF_ESS }, // 4 + { "sraid-s6.l6", 0x2000, 0xea3aa25d, 2 | BRF_PRG | BRF_ESS }, // 5 + + { "sraid-s0.k6", 0x1000, 0xa0373909, 3 | BRF_GRA }, // 6 Characters + { "sraids11.l6", 0x1000, 0xba22d949, 3 | BRF_GRA }, // 7 + + { "sraid-s7.m2", 0x1000, 0x299f8e07, 4 | BRF_GRA }, // 8 Sprites + { "sraid-s8.n2", 0x1000, 0x57ba8888, 4 | BRF_GRA }, // 9 + + { "sraid-s9.f6", 0x1000, 0x2380b90f, 5 | BRF_GRA }, // 10 Grid Tiles + + { "srpr10-1.a2", 0x0020, 0x121fdb99, 6 | BRF_GRA }, // 11 Color PROMs + { "srpr10-2.l3", 0x0020, 0x88b67e70, 6 | BRF_GRA }, // 12 + { "srpr10-3.c1", 0x0020, 0x27fa3a50, 6 | BRF_OPT }, // 13 +}; + +STD_ROM_PICK(sraider) +STD_ROM_FN(sraider) + +struct BurnDriver BurnDrvSraider = { + "sraider", NULL, NULL, NULL, "1982", + "Space Raider\0", NULL, "Universal", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, sraiderRomInfo, sraiderRomName, NULL, NULL, SraiderInputInfo, SraiderDIPInfo, + SraiderInit, DrvExit, SraiderFrame, SraiderDraw, DrvScan, &DrvRecalc, 0x82, + 196, 240, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_lwings.cpp b/src/burn/drv/pre90s/d_lwings.cpp index 99b801e27..1a4255649 100644 --- a/src/burn/drv/pre90s/d_lwings.cpp +++ b/src/burn/drv/pre90s/d_lwings.cpp @@ -1,2238 +1,2235 @@ -// FB Alpha "Legendary Wings" driver module -// Based on MAME driver by Paul Leaman - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2203.h" -#include "msm5205.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvZ80ROM2; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvTileMap; -static UINT8 *DrvGfxMask; -static UINT32 *DrvPalette; -static UINT32 *Palette; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvFgRAM; -static UINT8 *DrvBgRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf; -static UINT8 *ScrollX; -static UINT8 *ScrollY; -static UINT8 DrvRecalc; - -static UINT8 DrvReset; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDip[2]; -static UINT8 DrvInp[3]; - -static UINT8 interrupt_enable; -static UINT8 soundlatch; -static UINT8 soundlatch2; -static UINT8 flipscreen; -static UINT8 DrvZ80Bank; - -static UINT8 avengers_param[4]; -static UINT32 avengers_palette_pen; -static UINT8 avengers_soundlatch2; -static UINT8 avengers_soundstate; - -static UINT8 trojan_bg2_scrollx; -static UINT8 trojan_bg2_image; - -static INT32 avengers = 0; -static INT32 MSM5205InUse = 0; - -static INT32 nCyclesTotal[3]; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo LwingsDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfe, NULL }, - {0x12, 0xff, 0xff, 0xfe, NULL }, - - {0 , 0xfe, 0 , 2, "Flip_Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x11, 0x01, 0x0c, 0x0c, "3" }, - {0x11, 0x01, 0x0c, 0x04, "4" }, - {0x11, 0x01, 0x0c, 0x08, "5" }, - {0x11, 0x01, 0x0c, 0x00, "6" }, - - {0 , 0xfe, 0 , 4, "Coin_B" }, - {0x11, 0x01, 0x30, 0x00, "4C_1C" }, - {0x11, 0x01, 0x30, 0x20, "3C_1C" }, - {0x11, 0x01, 0x30, 0x10, "2C_1C" }, - {0x11, 0x01, 0x30, 0x30, "1C_1C" }, - - {0 , 0xfe, 0 , 4, "Coin_A" }, - {0x11, 0x01, 0xc0, 0xc0, "1C_1C" }, - {0x11, 0x01, 0xc0, 0x00, "2C_4C" }, - {0x11, 0x01, 0xc0, 0x40, "1C_2C" }, - {0x11, 0x01, 0xc0, 0x80, "1C_3C" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x06, 0x02, "Easy" }, - {0x12, 0x01, 0x06, 0x06, "Medium" }, - {0x12, 0x01, 0x06, 0x04, "Hard" }, - {0x12, 0x01, 0x06, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo_Sounds" }, - {0x12, 0x01, 0x08, 0x00, "Off" }, - {0x12, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Allow_Continue" }, - {0x12, 0x01, 0x10, 0x00, "No" }, - {0x12, 0x01, 0x10, 0x10, "Yes" }, - - {0 , 0xfe, 0 , 8, "Bonus_Life" }, - {0x12, 0x01, 0xe0, 0xe0, "20000 and every 50000"}, - {0x12, 0x01, 0xe0, 0x60, "20000 and every 60000"}, - {0x12, 0x01, 0xe0, 0xa0, "20000 and every 70000"}, - {0x12, 0x01, 0xe0, 0x20, "30000 and every 60000"}, - {0x12, 0x01, 0xe0, 0xc0, "30000 and every 70000"}, - {0x12, 0x01, 0xe0, 0x40, "30000 and every 80000"}, - {0x12, 0x01, 0xe0, 0x80, "40000 and every 100000"}, - {0x12, 0x01, 0xe0, 0x00, "None" }, -}; - -STDDIPINFO(Lwings) - -static struct BurnDIPInfo LwingsbDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfe, NULL }, - {0x12, 0xff, 0xff, 0xfe, NULL }, - - {0 , 0xfe, 0 , 2, "Flip_Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x11, 0x01, 0x0c, 0x0c, "2" }, - {0x11, 0x01, 0x0c, 0x04, "3" }, - {0x11, 0x01, 0x0c, 0x08, "4" }, - {0x11, 0x01, 0x0c, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Coin_B" }, - {0x11, 0x01, 0x30, 0x00, "4C_1C" }, - {0x11, 0x01, 0x30, 0x20, "3C_1C" }, - {0x11, 0x01, 0x30, 0x10, "2C_1C" }, - {0x11, 0x01, 0x30, 0x30, "1C_1C" }, - - {0 , 0xfe, 0 , 4, "Coin_A" }, - {0x11, 0x01, 0xc0, 0xc0, "1C_1C" }, - {0x11, 0x01, 0xc0, 0x00, "2C_4C" }, - {0x11, 0x01, 0xc0, 0x40, "1C_2C" }, - {0x11, 0x01, 0xc0, 0x80, "1C_3C" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x06, 0x02, "Easy" }, - {0x12, 0x01, 0x06, 0x06, "Medium" }, - {0x12, 0x01, 0x06, 0x04, "Hard" }, - {0x12, 0x01, 0x06, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo_Sounds" }, - {0x12, 0x01, 0x08, 0x00, "Off" }, - {0x12, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Allow_Continue" }, - {0x12, 0x01, 0x10, 0x00, "No" }, - {0x12, 0x01, 0x10, 0x10, "Yes" }, - - {0 , 0xfe, 0 , 8, "Bonus_Life" }, - {0x12, 0x01, 0xe0, 0xe0, "20000 and every 50000" }, - {0x12, 0x01, 0xe0, 0x60, "20000 and every 60000" }, - {0x12, 0x01, 0xe0, 0xa0, "20000 and every 70000" }, - {0x12, 0x01, 0xe0, 0x20, "30000 and every 60000" }, - {0x12, 0x01, 0xe0, 0xc0, "30000 and every 70000" }, - {0x12, 0x01, 0xe0, 0x40, "30000 and every 80000" }, - {0x12, 0x01, 0xe0, 0x80, "40000 and every 100000" }, - {0x12, 0x01, 0xe0, 0x00, "None" }, -}; - -STDDIPINFO(Lwingsb) - -static struct BurnDIPInfo SectionzDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x3f, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip_Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x11, 0x01, 0x0c, 0x04, "2" }, - {0x11, 0x01, 0x0c, 0x0c, "3" }, - {0x11, 0x01, 0x0c, 0x08, "4" }, - {0x11, 0x01, 0x0c, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Coin_A" }, - {0x11, 0x01, 0x30, 0x00, "4C_1C" }, - {0x11, 0x01, 0x30, 0x20, "3C_1C" }, - {0x11, 0x01, 0x30, 0x10, "2C_1C" }, - {0x11, 0x01, 0x30, 0x30, "1C_1C" }, - - {0 , 0xfe, 0 , 4, "Coin_B" }, - {0x11, 0x01, 0xc0, 0x00, "2C_1C" }, - {0x11, 0x01, 0xc0, 0xc0, "1C_1C" }, - {0x11, 0x01, 0xc0, 0x40, "1C_2C" }, - {0x11, 0x01, 0xc0, 0x80, "1C_3C" }, - - {0 , 0xfe, 0 , 2, "Allow_Continue" }, - {0x12, 0x01, 0x01, 0x00, "No" }, - {0x12, 0x01, 0x01, 0x01, "Yes" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x06, 0x02, "Easy" }, - {0x12, 0x01, 0x06, 0x06, "Normal" }, - {0x12, 0x01, 0x06, 0x04, "Hard" }, - {0x12, 0x01, 0x06, 0x00, "Very_Hard" }, - - {0 , 0xfe, 0 , 8, "Bonus_Life" }, - {0x12, 0x01, 0x38, 0x38, "20000 50000" }, - {0x12, 0x01, 0x38, 0x18, "20000 60000" }, - {0x12, 0x01, 0x38, 0x28, "20000 70000" }, - {0x12, 0x01, 0x38, 0x08, "30000 60000" }, - {0x12, 0x01, 0x38, 0x30, "30000 70000" }, - {0x12, 0x01, 0x38, 0x10, "30000 80000" }, - {0x12, 0x01, 0x38, 0x20, "40000 100000" }, - {0x12, 0x01, 0x38, 0x00, "None" }, - - {0 , 0xfe, 0 , 3, "Cabinet" }, - {0x12, 0x01, 0xc0, 0x00, "Upright One Player" }, - {0x12, 0x01, 0xc0, 0x40, "Upright Two Players" }, - {0x12, 0x01, 0xc0, 0xc0, "Cocktail" }, -}; - -STDDIPINFO(Sectionz) - -static struct BurnDIPInfo TrojanlsDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x1c, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 3, "Cabinet" }, - {0x11, 0x01, 0x03, 0x00, "Upright 1 Player" }, - {0x11, 0x01, 0x03, 0x02, "Upright 2 Players" }, - {0x11, 0x01, 0x03, 0x03, "Cocktail" }, - - {0 , 0xfe, 0 , 8, "Bonus_Life" }, - {0x11, 0x01, 0x1c, 0x10, "20000 60000" }, - {0x11, 0x01, 0x1c, 0x0c, "20000 70000" }, - {0x11, 0x01, 0x1c, 0x08, "20000 80000" }, - {0x11, 0x01, 0x1c, 0x1c, "30000 60000" }, - {0x11, 0x01, 0x1c, 0x18, "30000 70000" }, - {0x11, 0x01, 0x1c, 0x14, "30000 80000" }, - {0x11, 0x01, 0x1c, 0x04, "40000 80000" }, - {0x11, 0x01, 0x1c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4, "Coin_A" }, - {0x12, 0x01, 0x03, 0x00, "2C_1C" }, - {0x12, 0x01, 0x03, 0x03, "1C_1C" }, - {0x12, 0x01, 0x03, 0x02, "1C_2C" }, - {0x12, 0x01, 0x03, 0x01, "1C_3C" }, - - {0 , 0xfe, 0 , 4, "Coin_B" }, - {0x12, 0x01, 0x0c, 0x00, "4C_1C" }, - {0x12, 0x01, 0x0c, 0x04, "3C_1C" }, - {0x12, 0x01, 0x0c, 0x08, "2C_1C" }, - {0x12, 0x01, 0x0c, 0x0c, "1C_1C" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x30, 0x20, "2" }, - {0x12, 0x01, 0x30, 0x30, "3" }, - {0x12, 0x01, 0x30, 0x10, "4" }, - {0x12, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Flip_Screen" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Allow_Continue" }, - {0x12, 0x01, 0x80, 0x00, "No" }, - {0x12, 0x01, 0x80, 0x80, "Yes" }, -}; - -STDDIPINFO(Trojanls) - -static struct BurnDIPInfo TrojanDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfc, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 3, "Cabinet" }, - {0x11, 0x01, 0x03, 0x00, "Upright 1 Player" }, - {0x11, 0x01, 0x03, 0x02, "Upright 2 Players" }, - {0x11, 0x01, 0x03, 0x03, "Cocktail" }, - - {0 , 0xfe, 0 , 8, "Bonus_Life" }, - {0x11, 0x01, 0x1c, 0x10, "20000 60000" }, - {0x11, 0x01, 0x1c, 0x0c, "20000 70000" }, - {0x11, 0x01, 0x1c, 0x08, "20000 80000" }, - {0x11, 0x01, 0x1c, 0x1c, "30000 60000" }, - {0x11, 0x01, 0x1c, 0x18, "30000 70000" }, - {0x11, 0x01, 0x1c, 0x14, "30000 80000" }, - {0x11, 0x01, 0x1c, 0x04, "40000 80000" }, - {0x11, 0x01, 0x1c, 0x00, "None" }, - - {0 , 0xfe, 0 , 6, "Starting Level" }, - {0x11, 0x01, 0xe0, 0xe0, "1" }, - {0x11, 0x01, 0xe0, 0xc0, "2" }, - {0x11, 0x01, 0xe0, 0xa0, "3" }, - {0x11, 0x01, 0xe0, 0x80, "4" }, - {0x11, 0x01, 0xe0, 0x60, "5" }, - {0x11, 0x01, 0xe0, 0x40, "6" }, - - {0 , 0xfe, 0 , 4, "Coin_A" }, - {0x12, 0x01, 0x03, 0x00, "2C_1C" }, - {0x12, 0x01, 0x03, 0x03, "1C_1C" }, - {0x12, 0x01, 0x03, 0x02, "1C_2C" }, - {0x12, 0x01, 0x03, 0x01, "1C_3C" }, - - {0 , 0xfe, 0 , 4, "Coin_B" }, - {0x12, 0x01, 0x0c, 0x00, "4C_1C" }, - {0x12, 0x01, 0x0c, 0x04, "3C_1C" }, - {0x12, 0x01, 0x0c, 0x08, "2C_1C" }, - {0x12, 0x01, 0x0c, 0x0c, "1C_1C" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x30, 0x20, "2" }, - {0x12, 0x01, 0x30, 0x30, "3" }, - {0x12, 0x01, 0x30, 0x10, "4" }, - {0x12, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Flip_Screen" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Allow_Continue" }, - {0x12, 0x01, 0x80, 0x00, "No" }, - {0x12, 0x01, 0x80, 0x80, "Yes" }, -}; - -STDDIPINFO(Trojan) - -static struct BurnDIPInfo AvengersDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip_Screen" }, - {0x12, 0x01, 0x02, 0x02, "Off" }, - {0x12, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin_B" }, - {0x12, 0x01, 0x1c, 0x00, "4C_1C" }, - {0x12, 0x01, 0x1c, 0x10, "3C_1C" }, - {0x12, 0x01, 0x1c, 0x08, "2C_1C" }, - {0x12, 0x01, 0x1c, 0x1c, "1C_1C" }, - {0x12, 0x01, 0x1c, 0x0c, "1C_2C" }, - {0x12, 0x01, 0x1c, 0x14, "1C_3C" }, - {0x12, 0x01, 0x1c, 0x04, "1C_4C" }, - {0x12, 0x01, 0x1c, 0x18, "1C_6C" }, - - {0 , 0xfe, 0 , 8, "Coin_A" }, - {0x12, 0x01, 0xe0, 0x00, "4C_1C" }, - {0x12, 0x01, 0xe0, 0x80, "3C_1C" }, - {0x12, 0x01, 0xe0, 0x40, "2C_1C" }, - {0x12, 0x01, 0xe0, 0xe0, "1C_1C" }, - {0x12, 0x01, 0xe0, 0x60, "1C_2C" }, - {0x12, 0x01, 0xe0, 0xa0, "1C_3C" }, - {0x12, 0x01, 0xe0, 0x20, "1C_4C" }, - {0x12, 0x01, 0xe0, 0xc0, "1C_6C" }, - - {0 , 0xfe, 0 , 2, "Allow_Continue" }, - {0x11, 0x01, 0x01, 0x00, "No" }, - {0x11, 0x01, 0x01, 0x01, "Yes" }, - - {0 , 0xfe, 0 , 2, "Demo_Sounds" }, - {0x11, 0x01, 0x02, 0x00, "Off" }, - {0x11, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x11, 0x01, 0x0c, 0x04, "Easy" }, - {0x11, 0x01, 0x0c, 0x0c, "Normal" }, - {0x11, 0x01, 0x0c, 0x08, "Hard" }, - {0x11, 0x01, 0x0c, 0x00, "Very_Hard" }, - - {0 , 0xfe, 0 , 4, "Bonus_Life" }, - {0x11, 0x01, 0x30, 0x30, "20k 60k" }, - {0x11, 0x01, 0x30, 0x10, "20k 70k" }, - {0x11, 0x01, 0x30, 0x20, "20k 80k" }, - {0x11, 0x01, 0x30, 0x00, "30k 80k" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x11, 0x01, 0xc0, 0xc0, "3" }, - {0x11, 0x01, 0xc0, 0x40, "4" }, - {0x11, 0x01, 0xc0, 0x80, "5" }, - {0x11, 0x01, 0xc0, 0x00, "6" }, -}; - -STDDIPINFO(Avengers) - - - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x020000; - DrvZ80ROM1 = Next; Next += 0x008000; - DrvZ80ROM2 = Next; Next += 0x010000; - - DrvTileMap = Next; Next += 0x008000; - - DrvGfxROM0 = Next; Next += 0x020000; - DrvGfxROM1 = Next; Next += 0x080000; - DrvGfxROM2 = Next; Next += 0x080000; - DrvGfxROM3 = Next; Next += 0x020000; - - DrvGfxMask = Next; Next += 0x000020; - - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x002000; - DrvZ80RAM1 = Next; Next += 0x000800; - DrvPalRAM = Next; Next += 0x000800; - DrvFgRAM = Next; Next += 0x000800; - DrvBgRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x000200; - DrvSprBuf = Next; Next += 0x000200; - - Palette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - ScrollX = Next; Next += 0x000002; - ScrollY = Next; Next += 0x000002; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -// Avengers protection code ripped directly from MAME -static void avengers_protection_w(UINT8 data) -{ - INT32 pc = ZetPc(-1); - - if (pc == 0x2eeb) - { - avengers_param[0] = data; - } - else if (pc == 0x2f09) - { - avengers_param[1] = data; - } - else if (pc == 0x2f26) - { - avengers_param[2] = data; - } - else if (pc == 0x2f43) - { - avengers_param[3] = data; - } - else if (pc == 0x0445) - { - avengers_soundstate = 0x80; - soundlatch = data; - } -} - -static INT32 avengers_fetch_paldata() -{ - static const char pal_data[] = - // page 1: 0x03,0x02,0x01,0x00 - "0000000000000000" "A65486A6364676D6" "C764C777676778A7" "A574E5E5C5756AE5" - "0000000000000000" "F51785D505159405" "A637B6A636269636" "F45744E424348824" - "0000000000000000" "A33263B303330203" "4454848454440454" "A27242C232523632" - "0000000000000000" "1253327202421102" "3386437373631373" "41A331A161715461" - "0000000000000000" "1341715000711203" "4442635191622293" "5143D48383D37186" - "0000000000000000" "2432423000412305" "6633343302333305" "7234A565A5A4A2A8" - "0000000000000000" "46232422A02234A7" "88241624A21454A7" "A3256747A665D3AA" - "0000000000000000" "070406020003050B" "0A05090504050508" "05060A090806040C" - - // page2: 0x07,0x06,0x05,0x04 - "0000000000000000" "2472030503230534" "6392633B23433B53" "0392846454346423" - "0000000000000000" "1313052405050423" "3223754805354832" "323346A38686A332" - "0000000000000000" "72190723070723D2" "81394776070776D1" "A15929F25959F2F1" - "0000000000000000" "650706411A2A1168" "770737C43A3A3466" "87071F013C0C3175" - "0000000000000000" "2001402727302020" "4403048F4A484344" "4A050B074E0E4440" - "0000000000000000" "3003800C35683130" "5304035C587C5453" "5607080C5B265550" - "0000000000000000" "4801D00043854245" "6C020038669A6569" "6604050A69446764" - "0000000000000000" "0504000001030504" "0A05090504060307" "04090D0507010403" - - // page3: 0x0b,0x0a,0x09,0x08 - "0000000000000000" "685A586937F777F7" "988A797A67A7A7A7" "B8CA898DC737F787" - "0000000000000000" "4738A61705150505" "8797672835250535" "7777072A25350525" - "0000000000000000" "3525642404340404" "6554453554440454" "5544053634540434" - "0000000000000000" "2301923203430303" "4333834383630373" "3324034473730363" - "0000000000000000" "3130304000762005" "5352525291614193" "6463635483D06581" - "0000000000000000" "4241415100483107" "6463631302335304" "76757415A5A077A3" - "0000000000000000" "53525282A02A43AA" "76747424A31565A5" "88888536A66089A4" - "0000000000000000" "05040304000D050C" "0806050604070707" "0A0A060808000C06" - - // page4: 0x0f,0x0e,0x0d,0x0c - "0000000000000000" "3470365956342935" "5590578997554958" "73C078A8C573687A" - "0000000000000000" "5355650685030604" "2427362686042607" "010A070584010508" - "0000000000000000" "0208432454022403" "737A243455733406" "000D050353000307" - "0000000000000000" "000A023233003202" "424C134234424204" "000F241132001105" - "0000000000000000" "3031113030300030" "5152215252512051" "7273337374723272" - "0000000000000000" "4141214041411041" "6263326363623162" "8385448585834383" - "0000000000000000" "5153225152512051" "7375437475734273" "9598559697946495" - "0000000000000000" "0205020303020102" "0407040606040304" "060A060809060506" - - // page5: 0x13,0x12,0x11,0x10 - "0000000000000000" "4151D141D3D177F7" "5454C44482C4A7A7" "0404D45491D4F787" - "0000000000000000" "0303032374230505" "9696962673560535" "0505054502850525" - "0000000000000000" "0303030355030404" "7777770754470454" "0606060603760434" - "0000000000000000" "0505053547050303" "4949492945390373" "0808083804580363" - "0000000000000000" "0B0C444023442005" "3D3F333433334193" "0000043504046581" - "0000000000000000" "0809565085863107" "0B6A352374455304" "00700644050677A3" - "0000000000000000" "06073879C8C843AA" "09492739A58765A5" "0050084A060889A4" - "0000000000000000" "05060B070B0B050C" "0707090707090707" "00000B08070B0C06" - - // page6: 0x17,0x16,0x15,0x14 - "0000000000000000" "0034308021620053" "0034417042512542" "0034526064502E31" - "0000000000000000" "0106412032733060" "11A6522053628350" "22A6632072620D42" - "0000000000000000" "1308223052242080" "2478233071235170" "3578243090230960" - "0000000000000000" "2111334333331404" "3353324232324807" "45B5314131310837" - "0000000000000000" "3232445444445302" "445443534343B725" "567642524242B745" - "0000000000000000" "4343556555550201" "5575546454540524" "6787536353537554" - "0000000000000000" "6474667676660100" "7696657575650423" "88A8647474645473" - "0000000000000000" "0001070701050004" "0003060603040303" "0005050505040302"; - - INT32 bank = avengers_palette_pen/64; - INT32 offs = avengers_palette_pen%64; - INT32 page = bank/4; // 0..7 - INT32 base = (3-(bank&3)); // 0..3 - INT32 row = offs&0xf; // 0..15 - INT32 col = offs/16 + base*4; // 0..15 - INT32 digit0 = pal_data[page*256*2 + (31-row*2)*16+col]; - INT32 digit1 = pal_data[page*256*2 + (30-row*2)*16+col]; - INT32 result; - - if( digit0>='A' ) digit0 += 10 - 'A'; else digit0 -= '0'; - if( digit1>='A' ) digit1 += 10 - 'A'; else digit1 -= '0'; - result = digit0 * 16 + digit1; - - if( (avengers_palette_pen&0x3f)!=0x3f ) avengers_palette_pen++; - - return result; -} - -static UINT8 avengers_protection_r() -{ - static const INT32 xpos[8] = { 10, 7, 0, -7, -10, -7, 0, 7 }; - static const INT32 ypos[8] = { 0, 7, 10, 7, 0, -7, -10, -7 }; - INT32 best_dist = 0; - INT32 best_dir = 0; - INT32 x,y; - INT32 dx,dy,dist,dir; - - if(ZetPc(-1) == 0x7c7 ) - { - // palette data - return avengers_fetch_paldata(); - } - - // int to Angle Function - // - // Input: two cartesian points - // Output: direction code (north,northeast,east,...) - // - x = avengers_param[0] - avengers_param[2]; - y = avengers_param[1] - avengers_param[3]; - for( dir=0; dir<8; dir++ ) - { - dx = xpos[dir]-x; - dy = ypos[dir]-y; - dist = dx*dx+dy*dy; - if( dist < best_dist || dir==0 ) - { - best_dir = dir; - best_dist = dist; - } - } - return best_dir<<5; -} - - - -UINT8 __fastcall lwings_main_read(UINT16 address) -{ - switch (address) - { - case 0xf808: - case 0xf809: - case 0xf80a: - return DrvInp[address - 0xf808]; - - case 0xf80b: - case 0xf80c: - return DrvDip[address - 0xf80b]; - - case 0xf80d: - return avengers_protection_r(); - } - - return 0; -} - -static void lwings_bankswitch_w(UINT8 data) -{ - DrvZ80Bank = data; - - INT32 bankaddress = 0x10000 + ((data >> 1) & 3) * 0x4000; - - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + bankaddress); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + bankaddress); -} - -void __fastcall lwings_main_write(UINT16 address, UINT8 data) -{ - if ((address & 0xf800) == 0xf000) { - DrvPalRAM[address & 0x7ff] = data; - - UINT8 r, g, b; - UINT16 coldata = DrvPalRAM[(address & 0x3ff) | 0x400] | (DrvPalRAM[address & 0x3ff] << 8); - - r = (coldata >> 8) & 0xf0; - g = (coldata >> 4) & 0xf0; - b = (coldata >> 0) & 0xf0; - - r |= r >> 4; - g |= g >> 4; - b |= b >> 4; - - Palette[address & 0x3ff] = (r << 16) | (g << 8) | b; - DrvPalette[address & 0x3ff] = BurnHighCol(r, g, b, 0); - - return; - } - - // hack - if (avengers && (address & 0xfff8) == 0xf808) address += 0x10; - - switch (address) - { - case 0xf800: - case 0xf801: - case 0xf808: - case 0xf809: - ScrollX[address & 1] = data; - return; - - case 0xf802: - case 0xf803: - case 0xf80a: - case 0xf80b: - ScrollY[address & 1] = data; - return; - - case 0xf804: - trojan_bg2_scrollx = data; - return; - - case 0xf805: - trojan_bg2_image = data; - return; - - case 0xf80c: - soundlatch = data; - return; - - case 0xf80d: - soundlatch2 = data; - return; - - case (0xf80e + 0x10): - case 0xf80e: - lwings_bankswitch_w(data); - - flipscreen = ~data & 0x01; - - interrupt_enable = data & 0x08; - return; - - case (0xf809 + 0x10): - avengers_protection_w(data); - return; - - case (0xf80c + 0x10): - avengers_palette_pen = data << 6; - return; - - case (0xf80d + 0x10): - soundlatch2 = data; - return; - } -} - -void __fastcall lwings_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe000: - case 0xe001: - case 0xe002: - case 0xe003: - BurnYM2203Write((address & 2) >> 1, address & 1, data); - return; - - case 0xe006: - avengers_soundlatch2 = data; - return; - } -} - -UINT8 __fastcall lwings_sound_read(UINT16 address) -{ - switch (address) - { - case 0xc800: - return soundlatch; - - case 0xe006: - UINT8 Data = avengers_soundlatch2 | avengers_soundstate; - avengers_soundstate = 0; - return Data; - } - - return 0; -} - -void __fastcall trojan_adpcm_out(UINT16 port, UINT8 data) -{ - if ((port & 0xff) == 0x01) { - MSM5205ResetWrite(0, (data >> 7) & 1); - MSM5205DataWrite(0, data); - MSM5205VCLKWrite(0, 1); - MSM5205VCLKWrite(0, 0); - } -} - -UINT8 __fastcall trojan_adpcm_in(UINT16 port) -{ - port &= 0xff; - - UINT8 ret = 0; - - if (port == 0x00) { - ret = soundlatch2; - } - - return ret; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - if (i == 0) lwings_bankswitch_w(0); - ZetClose(); - } - - if (MSM5205InUse) { - ZetOpen(2); - ZetReset(); - ZetClose(); - } - - BurnYM2203Reset(); - - if (MSM5205InUse) MSM5205Reset(); - - trojan_bg2_scrollx = 0; - trojan_bg2_image = 0; - - memset(avengers_param, 0, 4); - avengers_palette_pen = 0; - - avengers_soundlatch2 = 0; - avengers_soundstate = 0; - - DrvZ80Bank = 0; - flipscreen = 0; - interrupt_enable = 0; - soundlatch = 0; - soundlatch2 = 0; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[2] = { 0x000000, 0x000004 }; - INT32 Plane1[4] = { 0x080004, 0x080000, 0x000004, 0x000000 }; - INT32 Plane1a[4] = { 0x100004, 0x100000, 0x000004, 0x000000 }; - INT32 Plane2[4] = { 0x180000, 0x100000, 0x080000, 0x000000 }; - INT32 Plane3[4] = { 0x040000, 0x040004, 0x000000, 0x000004 }; - - // sprite, char - INT32 XOffs0[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; - INT32 YOffs0[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; - - // background - INT32 XOffs1[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; - INT32 YOffs1[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x08000); - - GfxDecode(0x0800, 2, 8, 8, Plane0, XOffs0, YOffs0, 0x080, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x40000); - - GfxDecode(0x0800, 4, 16, 16, Plane2, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x40000); - - if (DrvTileMap != NULL) { - GfxDecode(0x0800, 4, 16, 16, Plane1a, XOffs0, YOffs0, 0x200, tmp, DrvGfxROM2); - - memcpy (tmp, DrvGfxROM3, 0x10000); - - GfxDecode(0x0200, 4, 16, 16, Plane3, XOffs0, YOffs0, 0x200, tmp, DrvGfxROM3); - } else { - GfxDecode(0x0400, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x200, tmp, DrvGfxROM2); - } - - BurnFree (tmp); - - return 0; -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); -} - -inline static INT32 DrvMSM5205SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)((double)ZetTotalCycles() * nSoundRate / (nCyclesTotal[0] * 60)); -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3000000; -} - -static void lwings_main_cpu_init() -{ - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - // 8000 - bfff banked - ZetMapArea(0xc000, 0xddff, 0, DrvZ80RAM0); - ZetMapArea(0xc000, 0xddff, 1, DrvZ80RAM0); - ZetMapArea(0xc000, 0xddff, 2, DrvZ80RAM0); - - ZetMapArea(0xde00, 0xdfff, 0, DrvSprRAM); - ZetMapArea(0xde00, 0xdfff, 1, DrvSprRAM); - ZetMapArea(0xde00, 0xdfff, 2, DrvSprRAM); - - ZetMapArea(0xe000, 0xe7ff, 0, DrvFgRAM); - ZetMapArea(0xe000, 0xe7ff, 1, DrvFgRAM); - ZetMapArea(0xe000, 0xe7ff, 2, DrvFgRAM); - - ZetMapArea(0xe800, 0xefff, 0, DrvBgRAM); - ZetMapArea(0xe800, 0xefff, 1, DrvBgRAM); - ZetMapArea(0xe800, 0xefff, 2, DrvBgRAM); - - ZetMapArea(0xf000, 0xf7ff, 0, DrvPalRAM); -// ZetMapArea(0xf000, 0xf7ff, 1, DrvPalRAM); // write handler - ZetMapArea(0xf000, 0xf7ff, 2, DrvPalRAM); - ZetSetReadHandler(lwings_main_read); - ZetSetWriteHandler(lwings_main_write); - ZetMemEnd(); - ZetClose(); -} - -static void lwings_sound_init() -{ - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM1); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM1); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM1); - ZetSetReadHandler(lwings_sound_read); - ZetSetWriteHandler(lwings_sound_write); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - DrvTileMap = NULL; - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x18000, 2, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 4, 1)) return 1; - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x8000, i + 5, 1)) return 1; - } - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvGfxROM2 + i * 0x8000, i + 13, 1)) return 1; - } - - DrvGfxDecode(); - } - - ZetInit(0); - lwings_main_cpu_init(); - - ZetInit(1); - lwings_sound_init(); - - GenericTilesInit(); - - nCyclesTotal[0] = 6000000 / 60; - nCyclesTotal[1] = 3000000 / 60; - nCyclesTotal[2] = 0; - - DrvDoReset(); - - return 0; -} - -static INT32 TrojanInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x18000, 2, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM2 + 0x00000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 1)) return 1; - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x8000, i + 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + i * 0x8000, i + 14, 1)) return 1; - } - - if (BurnLoadRom(DrvGfxROM3 + 0x0000, 22, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x8000, 23, 1)) return 1; - - if (BurnLoadRom(DrvTileMap, 24, 1)) return 1; - - DrvGfxDecode(); - - { - for (INT32 i = 0; i < 32; i++) { - DrvGfxMask[i] = (0xf07f0001 & (1 << i)) ? 1 : 0; - } - } - } - - ZetInit(0); - lwings_main_cpu_init(); - - ZetInit(1); - lwings_sound_init(); - - ZetInit(2); - ZetOpen(2); - ZetMapArea(0x0000, 0xffff, 0, DrvZ80ROM2); - ZetMapArea(0x0000, 0xffff, 2, DrvZ80ROM2); - ZetSetInHandler(trojan_adpcm_in); - ZetSetOutHandler(trojan_adpcm_out); - ZetMemEnd(); - ZetClose(); - - MSM5205Init(0, DrvMSM5205SynchroniseStream, 455000, NULL, MSM5205_SEX_4B, 1); - MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - MSM5205InUse = 1; - - GenericTilesInit(); - - nCyclesTotal[0] = 3000000 / 60; - nCyclesTotal[1] = 3000000 / 60; - nCyclesTotal[2] = 3000000 / 60; - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - BurnYM2203Exit(); - - BurnFree (AllMem); - - avengers = 0; - MSM5205InUse = 0; - - return 0; -} - -static INT32 TrojanExit() -{ - MSM5205Exit(); - return DrvExit(); -} - -static void draw_foreground(INT32 colbase) -{ - for (INT32 offs = 0x20; offs < 0x3e0; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - INT32 color = DrvFgRAM[offs | 0x400]; - INT32 code = DrvFgRAM[offs] | ((color & 0xc0) << 2); - - INT32 flipx = color & 0x10; - INT32 flipy = color & 0x20; - - color &= 0x0f; - - sy -= 8; - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 2, 0x03, colbase, DrvGfxROM0); - } else { - Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 2, 0x03, colbase, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 2, 0x03, colbase, DrvGfxROM0); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 2, 0x03, colbase, DrvGfxROM0); - } - } - } -} - -static void draw_background() -{ - INT32 scrollx = (ScrollX[0] | (ScrollX[1] << 8)) & 0x1ff; - INT32 scrolly = (ScrollY[0] | (ScrollY[1] << 8)) & 0x1ff; - - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 sy = (offs & 0x1f) << 4; - INT32 sx = (offs >> 5) << 4; - sy -= 8; - - sx -= scrollx; - sy -= scrolly; - if (sx < -15) sx += 512; - if (sy < -15) sy += 512; - - if (sy < -15 || sx < -15 || sy >= nScreenHeight || sx >= nScreenWidth) - continue; - - INT32 color = DrvBgRAM[offs | 0x400]; - INT32 code = DrvBgRAM[offs] | (color & 0xe0) << 3;; - - INT32 flipx = color & 0x08; - INT32 flipy = color & 0x10; - - color &= 0x07; - - if (flipy) { - if (flipx) { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM1); - } else { - Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM1); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM1); - } - } - } -} - -static void lwings_draw_sprites() -{ - for (INT32 offs = 0x200 - 4; offs >= 0; offs -= 4) - { - INT32 sx = DrvSprBuf[offs + 3] - 0x100 * (DrvSprBuf[offs + 1] & 0x01); - INT32 sy = DrvSprBuf[offs + 2]; - - if (sy && sx) - { - INT32 code,color,flipx,flipy; - - if (sy > 0xf8) sy-=0x100; - - code = DrvSprBuf[offs] | ((DrvSprBuf[offs + 1] & 0xc0) << 2); - color = (DrvSprBuf[offs + 1] & 0x38) >> 3; - flipx = DrvSprBuf[offs + 1] & 0x02; - flipy = DrvSprBuf[offs + 1] & 0x04; - - color += 0x18; - - sy -= 8; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); - } - } - } - } -} - - -static void draw_16x16_with_mask(INT32 sx, INT32 sy, INT32 code, INT32 color, UINT8 *gfxbase, UINT8 *mask, INT32 flipx, INT32 flipy) -{ - UINT8 *src = gfxbase + (code << 8); - - color = (color << 4) | 0x100; - - if (flipy) { - src += 0xf0; - - if (flipx) { - for (INT32 y = 15; y >= 0; y--, src-=16) - { - INT32 yy = sy + y; - if (yy < 0) break; - if (yy >= nScreenHeight) continue; - - for (INT32 x = 15; x >= 0; x--) - { - INT32 xx = sx + x; - if (xx < 0) break; - if (xx >= nScreenWidth) continue; - - INT32 o = color | src[15-x]; - if (mask[src[15-x]]) continue; - - pTransDraw[(yy * nScreenWidth) + xx] = o; - } - } - } else { - for (INT32 y = 15; y >= 0; y--, src-=16) - { - INT32 yy = sy + y; - if (yy < 0) break; - if (yy >= nScreenHeight) continue; - - for (INT32 x = 0; x < 16; x++) - { - INT32 xx = sx + x; - if (xx < 0) continue; - if (xx >= nScreenWidth) break; - - INT32 o = color | src[x]; - if (mask[src[x]]) continue; - - pTransDraw[(yy * nScreenWidth) + xx] = o; - } - } - } - } else { - if (flipx) { - for (INT32 y = 0; y < 16; y++, src+=16) - { - INT32 yy = sy + y; - if (yy < 0) continue; - if (yy >= nScreenHeight) break; - - for (INT32 x = 15; x >= 0; x--) - { - INT32 xx = sx + x; - if (xx < 0) break; - if (xx >= nScreenWidth) continue; - - INT32 o = color | src[15-x]; - if (mask[src[15-x]]) continue; - - pTransDraw[(yy * nScreenWidth) + xx] = o; - } - } - } else { - for (INT32 y = 0; y < 16; y++, src+=16) - { - INT32 yy = sy + y; - if (yy < 0) continue; - if (yy >= nScreenHeight) break; - - for (INT32 x = 0; x < 16; x++) - { - INT32 xx = sx + x; - if (xx < 0) continue; - if (xx >= nScreenWidth) break; - - INT32 o = color | src[x]; - if (mask[src[x]]) continue; - - pTransDraw[(yy * nScreenWidth) + xx] = o; - } - } - } - } -} - -static void trojan_draw_background(INT32 priority) -{ - INT32 scrollx = (ScrollX[0] | (ScrollX[1] << 8)) & 0x1ff; - INT32 scrolly = (ScrollY[0] | (ScrollY[1] << 8)) & 0x1ff; - - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 color = DrvBgRAM[offs | 0x400]; - if (priority && ((~color >> 3) & 1)) continue; - - INT32 sy = (offs & 0x1f) << 4; - INT32 sx = (offs >> 5) << 4; - sy -= 8; - - sx -= scrollx; - sy -= scrolly; - if (sx < -15) sx += 512; - if (sy < -15) sy += 512; - - if (sy < -15 || sx < -15 || sy >= nScreenHeight || sx >= nScreenWidth) - continue; - - INT32 code = DrvBgRAM[offs] | ((color & 0xe0) << 3); - INT32 flipx = color & 0x10; - INT32 flipy = 0; - - color &= 0x07; - - if (avengers) color ^= 6; - - draw_16x16_with_mask(sx, sy, code, color, DrvGfxROM1, DrvGfxMask + priority * 16, flipx, flipy); -/* - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x00, 0x100, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x00, 0x100, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x00, 0x100, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0x00, 0x100, DrvGfxROM1); - } - } -*/ - } -} - -static void trojan_draw_background2() -{ - for (INT32 offs = 0; offs < 32 * 16; offs++) - { - INT32 sx = (offs & 0x1f) << 4; - INT32 sy = (offs >> 5) << 4; - - sx -= trojan_bg2_scrollx; - if (sx < -15) sx += 512; - sy -= 8; - - if (sy < -15 || sx < -15 || sy >= nScreenHeight || sx >= nScreenWidth) - continue; - - INT32 offset = ((((offs << 6) & 0x7800) | ((offs << 1) & 0x3e)) + (trojan_bg2_image << 5)) & 0x7fff; - - INT32 color = DrvTileMap[offset + 1]; - INT32 code = DrvTileMap[offset + 0] | ((color & 0x80) << 1); - INT32 flipx = color & 0x10; - INT32 flipy = color & 0x20; - - color &= 7; - - if (flipy) { - if (flipx) { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM3); - } else { - Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM3); - } - } else { - if (flipx) { - Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM3); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM3); - } - } - } -} - -static void trojan_draw_sprites() -{ - for (INT32 offs = 0x180 - 4; offs >= 0; offs -= 4) - { - INT32 sx = DrvSprBuf[offs + 3] - 0x100 * (DrvSprBuf[offs + 1] & 0x01); - INT32 sy = DrvSprBuf[offs + 2]; - - if (sy && sx) - { - INT32 flipx, flipy; - - if (sy > 0xf8) sy-=0x100; - - INT32 color = DrvSprBuf[offs + 1]; - INT32 code = DrvSprBuf[offs] | ((color & 0x20) << 4) | ((color & 0x40) << 2) | ((color & 0x80) << 3); - - if (avengers) - { - flipx = 0; - flipy = ~color & 0x10; - } - else - { - flipx = color & 0x10; - flipy = 1; - } - - color = ((color >> 1) & 7) + 0x28; - - sy -= 8; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); - } - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - if (DrvTileMap == NULL) { - draw_background(); - lwings_draw_sprites(); - draw_foreground(0x200); - } else { - trojan_draw_background2(); - trojan_draw_background(0); - trojan_draw_sprites(); - trojan_draw_background(1); - draw_foreground(0x300); - } - - if (flipscreen) { - UINT16 *ptr = pTransDraw + (nScreenWidth * nScreenHeight) - 1; - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight / 2; i++, ptr--) - { - INT32 n = pTransDraw[i]; - pTransDraw[i] = *ptr; - *ptr = n; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInp, 0xff, 3); - - for (INT32 i = 0; i < 8; i++) { - DrvInp[0] ^= (DrvJoy1[i] & 1) << i; - DrvInp[1] ^= (DrvJoy2[i] & 1) << i; - DrvInp[2] ^= (DrvJoy3[i] & 1) << i; - } - - if ((DrvInp[1] & 0x03) == 0) DrvInp[1] |= 0x03; - if ((DrvInp[1] & 0x0c) == 0) DrvInp[1] |= 0x0c; - if ((DrvInp[2] & 0x03) == 0) DrvInp[2] |= 0x03; - if ((DrvInp[2] & 0x0c) == 0) DrvInp[2] |= 0x0c; - } - - INT32 nInterleave; - INT32 MSMIRQSlice[67]; - - if (MSM5205InUse) { - nInterleave = MSM5205CalcInterleave(0, 6000000); - - for (INT32 i = 0; i < 67; i++) { - MSMIRQSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 68)); - } - } else { - nInterleave = 16; - } - - INT32 nCyclesDone[3] = { 0, 0, 0 }; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (interrupt_enable && i == (nInterleave - 1)) { - if (avengers & 1) { - ZetNmi(); - } else { - ZetSetVector(0xd7); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - } - if (MSM5205InUse) MSM5205Update(); - ZetClose(); - - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - if ((i % (nInterleave / 4)) == ((nInterleave / 4) - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - if (MSM5205InUse) { - nCurrentCPU = 2; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - for (INT32 j = 0; j < 67; j++) { - if (i == MSMIRQSlice[j]) { - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - nCyclesDone[nCurrentCPU] += ZetRun(1000); - } - } - ZetClose(); - } - } - - ZetOpen(1); - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - if (MSM5205InUse) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - memcpy (DrvSprBuf, DrvSprRAM, 0x200); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029692; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - if (MSM5205InUse) MSM5205Scan(nAction, pnMin); - - SCAN_VAR(interrupt_enable); - SCAN_VAR(soundlatch); - SCAN_VAR(soundlatch2); - SCAN_VAR(flipscreen); - SCAN_VAR(DrvZ80Bank); - - SCAN_VAR(*((UINT32*)avengers_param)); - SCAN_VAR(avengers_palette_pen); - SCAN_VAR(avengers_soundlatch2); - SCAN_VAR(avengers_soundstate); - SCAN_VAR(trojan_bg2_scrollx); - SCAN_VAR(trojan_bg2_image); - } - - ZetOpen(0); - lwings_bankswitch_w(DrvZ80Bank); - ZetClose(); - - return 0; -} - - -// Section Z (set 1) - -static struct BurnRomInfo sectionzRomDesc[] = { - { "6c_sz01.bin", 0x8000, 0x69585125, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "7c_sz02.bin", 0x8000, 0x22f161b8, 1 | BRF_PRG | BRF_ESS }, // 1 - { "9c_sz03.bin", 0x8000, 0x4c7111ed, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "11e_sz04.bin", 0x8000, 0xa6073566, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "9h_sz05.bin", 0x4000, 0x3173ba2e, 4 | BRF_GRA }, // 4 Characters - - { "3e_sz14.bin", 0x8000, 0x63782e30, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles - { "1e_sz08.bin", 0x8000, 0xd57d9f13, 5 | BRF_GRA }, // 6 - { "3d_sz13.bin", 0x8000, 0x1b3d4d7f, 5 | BRF_GRA }, // 7 - { "1d_sz07.bin", 0x8000, 0xf5b3a29f, 5 | BRF_GRA }, // 8 - { "3b_sz12.bin", 0x8000, 0x11d47dfd, 5 | BRF_GRA }, // 9 - { "1b_sz06.bin", 0x8000, 0xdf703b68, 5 | BRF_GRA }, // 10 - { "3f_sz15.bin", 0x8000, 0x36bb9bf7, 5 | BRF_GRA }, // 11 - { "1f_sz09.bin", 0x8000, 0xda8f06c9, 5 | BRF_GRA }, // 12 - - { "3j_sz17.bin", 0x8000, 0x8df7b24a, 6 | BRF_GRA }, // 13 Sprites - { "1j_sz11.bin", 0x8000, 0x685d4c54, 6 | BRF_GRA }, // 14 - { "3h_sz16.bin", 0x8000, 0x500ff2bb, 6 | BRF_GRA }, // 15 - { "1h_sz10.bin", 0x8000, 0x00b3d244, 6 | BRF_GRA }, // 16 - - { "mb7114e.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) -}; - -STD_ROM_PICK(sectionz) -STD_ROM_FN(sectionz) - -struct BurnDriver BurnDrvSectionz = { - "sectionz", NULL, NULL, NULL, "1985", - "Section Z (set 1)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_HORSHOOT, 0, - NULL, sectionzRomInfo, sectionzRomName, NULL, NULL, DrvInputInfo, SectionzDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 240, 4, 3 -}; - - -// Section Z (set 2) - -static struct BurnRomInfo sctionzaRomDesc[] = { - { "sz-01a.bin", 0x8000, 0x98df49fd, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "7c_sz02.bin", 0x8000, 0x22f161b8, 1 | BRF_PRG | BRF_ESS }, // 1 - { "sz-03j.bin", 0x8000, 0x94547abf, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "11e_sz04.bin", 0x8000, 0xa6073566, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "9h_sz05.bin", 0x4000, 0x3173ba2e, 4 | BRF_GRA }, // 4 Characters - - { "3e_sz14.bin", 0x8000, 0x63782e30, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles - { "1e_sz08.bin", 0x8000, 0xd57d9f13, 5 | BRF_GRA }, // 6 - { "3d_sz13.bin", 0x8000, 0x1b3d4d7f, 5 | BRF_GRA }, // 7 - { "1d_sz07.bin", 0x8000, 0xf5b3a29f, 5 | BRF_GRA }, // 8 - { "3b_sz12.bin", 0x8000, 0x11d47dfd, 5 | BRF_GRA }, // 9 - { "1b_sz06.bin", 0x8000, 0xdf703b68, 5 | BRF_GRA }, // 10 - { "3f_sz15.bin", 0x8000, 0x36bb9bf7, 5 | BRF_GRA }, // 11 - { "1f_sz09.bin", 0x8000, 0xda8f06c9, 5 | BRF_GRA }, // 12 - - { "3j_sz17.bin", 0x8000, 0x8df7b24a, 6 | BRF_GRA }, // 13 Sprites - { "1j_sz11.bin", 0x8000, 0x685d4c54, 6 | BRF_GRA }, // 14 - { "3h_sz16.bin", 0x8000, 0x500ff2bb, 6 | BRF_GRA }, // 15 - { "1h_sz10.bin", 0x8000, 0x00b3d244, 6 | BRF_GRA }, // 16 - - { "mb7114e.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) -}; - -STD_ROM_PICK(sctionza) -STD_ROM_FN(sctionza) - -struct BurnDriver BurnDrvSctionza = { - "sectionza", "sectionz", NULL, NULL, "1985", - "Section Z (set 2)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_HORSHOOT, 0, - NULL, sctionzaRomInfo, sctionzaRomName, NULL, NULL, DrvInputInfo, SectionzDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 240, 4, 3 -}; - - -// Legendary Wings (US set 1) - -static struct BurnRomInfo lwingsRomDesc[] = { - { "6c_lw01.bin", 0x8000, 0xb55a7f60, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "7c_lw02.bin", 0x8000, 0xa5efbb1b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "9c_lw03.bin", 0x8000, 0xec5cc201, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "11e_lw04.bin", 0x8000, 0xa20337a2, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "9h_lw05.bin", 0x4000, 0x091d923c, 4 | BRF_GRA }, // 4 Characters - - { "3e_lw14.bin", 0x8000, 0x5436392c, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles - { "1e_lw08.bin", 0x8000, 0xb491bbbb, 5 | BRF_GRA }, // 6 - { "3d_lw13.bin", 0x8000, 0xfdd1908a, 5 | BRF_GRA }, // 7 - { "1d_lw07.bin", 0x8000, 0x5c73d406, 5 | BRF_GRA }, // 8 - { "3b_lw12.bin", 0x8000, 0x32e17b3c, 5 | BRF_GRA }, // 9 - { "1b_lw06.bin", 0x8000, 0x52e533c1, 5 | BRF_GRA }, // 10 - { "3f_lw15.bin", 0x8000, 0x99e134ba, 5 | BRF_GRA }, // 11 - { "1f_lw09.bin", 0x8000, 0xc8f28777, 5 | BRF_GRA }, // 12 - - { "3j_lw17.bin", 0x8000, 0x5ed1bc9b, 6 | BRF_GRA }, // 13 Sprites - { "1j_lw11.bin", 0x8000, 0x2a0790d6, 6 | BRF_GRA }, // 14 - { "3h_lw16.bin", 0x8000, 0xe8834006, 6 | BRF_GRA }, // 15 - { "1h_lw10.bin", 0x8000, 0xb693f5a5, 6 | BRF_GRA }, // 16 - - { "63s141.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) -}; - -STD_ROM_PICK(lwings) -STD_ROM_FN(lwings) - -struct BurnDriver BurnDrvLwings = { - "lwings", NULL, NULL, NULL, "1986", - "Legendary Wings (US set 1)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, lwingsRomInfo, lwingsRomName, NULL, NULL, DrvInputInfo, LwingsDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 256, 3, 4 -}; - - -// Legendary Wings (US set 2) - -static struct BurnRomInfo lwings2RomDesc[] = { - { "u13-l", 0x8000, 0x3069c01c, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "u14-k", 0x8000, 0x5d91c828, 1 | BRF_PRG | BRF_ESS }, // 1 - { "9c_lw03.bin", 0x8000, 0xec5cc201, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "11e_lw04.bin", 0x8000, 0xa20337a2, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "9h_lw05.bin", 0x4000, 0x091d923c, 4 | BRF_GRA }, // 4 Characters - - { "b_03e.rom", 0x8000, 0x176e3027, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles - { "b_01e.rom", 0x8000, 0xf5d25623, 5 | BRF_GRA }, // 6 - { "b_03d.rom", 0x8000, 0x001caa35, 5 | BRF_GRA }, // 7 - { "b_01d.rom", 0x8000, 0x0ba008c3, 5 | BRF_GRA }, // 8 - { "b_03b.rom", 0x8000, 0x4f8182e9, 5 | BRF_GRA }, // 9 - { "b_01b.rom", 0x8000, 0xf1617374, 5 | BRF_GRA }, // 10 - { "b_03f.rom", 0x8000, 0x9b374dcc, 5 | BRF_GRA }, // 11 - { "b_01f.rom", 0x8000, 0x23654e0a, 5 | BRF_GRA }, // 12 - - { "b_03j.rom", 0x8000, 0x8f3c763a, 6 | BRF_GRA }, // 13 Sprites - { "b_01j.rom", 0x8000, 0x7cc90a1d, 6 | BRF_GRA }, // 14 - { "b_03h.rom", 0x8000, 0x7d58f532, 6 | BRF_GRA }, // 15 - { "b_01h.rom", 0x8000, 0x3e396eda, 6 | BRF_GRA }, // 16 - - { "63s141.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) -}; - -STD_ROM_PICK(lwings2) -STD_ROM_FN(lwings2) - -struct BurnDriver BurnDrvLwings2 = { - "lwings2", "lwings", NULL, NULL, "1986", - "Legendary Wings (US set 2)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, lwings2RomInfo, lwings2RomName, NULL, NULL, DrvInputInfo, LwingsDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 256, 3, 4 -}; - - -// Ares no Tsubasa (Japan) - -static struct BurnRomInfo lwingsjpRomDesc[] = { - { "a_06c.rom", 0x8000, 0x2068a738, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "a_07c.rom", 0x8000, 0xd6a2edc4, 1 | BRF_PRG | BRF_ESS }, // 1 - { "9c_lw03.bin", 0x8000, 0xec5cc201, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "11e_lw04.bin", 0x8000, 0xa20337a2, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "9h_lw05.bin", 0x4000, 0x091d923c, 4 | BRF_GRA }, // 4 Characters - - { "b_03e.rom", 0x8000, 0x176e3027, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles - { "b_01e.rom", 0x8000, 0xf5d25623, 5 | BRF_GRA }, // 6 - { "b_03d.rom", 0x8000, 0x001caa35, 5 | BRF_GRA }, // 7 - { "b_01d.rom", 0x8000, 0x0ba008c3, 5 | BRF_GRA }, // 8 - { "b_03b.rom", 0x8000, 0x4f8182e9, 5 | BRF_GRA }, // 9 - { "b_01b.rom", 0x8000, 0xf1617374, 5 | BRF_GRA }, // 10 - { "b_03f.rom", 0x8000, 0x9b374dcc, 5 | BRF_GRA }, // 11 - { "b_01f.rom", 0x8000, 0x23654e0a, 5 | BRF_GRA }, // 12 - - { "b_03j.rom", 0x8000, 0x8f3c763a, 6 | BRF_GRA }, // 13 Sprites - { "b_01j.rom", 0x8000, 0x7cc90a1d, 6 | BRF_GRA }, // 14 - { "b_03h.rom", 0x8000, 0x7d58f532, 6 | BRF_GRA }, // 15 - { "b_01h.rom", 0x8000, 0x3e396eda, 6 | BRF_GRA }, // 16 - - { "63s141.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) -}; - -STD_ROM_PICK(lwingsjp) -STD_ROM_FN(lwingsjp) - -struct BurnDriver BurnDrvLwingsjp = { - "lwingsj", "lwings", NULL, NULL, "1986", - "Ares no Tsubasa (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, lwingsjpRomInfo, lwingsjpRomName, NULL, NULL, DrvInputInfo, LwingsDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 256, 3, 4 -}; - - -// Legendary Wings (bootleg) - -static struct BurnRomInfo lwingsbRomDesc[] = { - { "ic17.bin", 0x8000, 0xfe8a8823, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "ic18.bin", 0x8000, 0x2a00cde8, 1 | BRF_PRG | BRF_ESS }, // 1 - { "ic19.bin", 0x8000, 0xec5cc201, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "ic37.bin", 0x8000, 0xa20337a2, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "ic60.bin", 0x4000, 0x091d923c, 4 | BRF_GRA }, // 4 Characters - - { "ic50.bin", 0x8000, 0x5436392c, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles - { "ic49.bin", 0x8000, 0xffdbdd69, 5 | BRF_GRA }, // 6 - { "ic26.bin", 0x8000, 0xfdd1908a, 5 | BRF_GRA }, // 7 - { "ic25.bin", 0x8000, 0x5c73d406, 5 | BRF_GRA }, // 8 - { "ic2.bin", 0x8000, 0x32e17b3c, 5 | BRF_GRA }, // 9 - { "ic1.bin", 0x8000, 0x52e533c1, 5 | BRF_GRA }, // 10 - { "ic63.bin", 0x8000, 0x99e134ba, 5 | BRF_GRA }, // 11 - { "ic62.bin", 0x8000, 0xc8f28777, 5 | BRF_GRA }, // 12 - - { "ic99.bin", 0x8000, 0x163946da, 6 | BRF_GRA }, // 13 Sprites - { "ic98.bin", 0x8000, 0x7cc90a1d, 6 | BRF_GRA }, // 14 - { "ic87.bin", 0x8000, 0xbca275ac, 6 | BRF_GRA }, // 15 - { "ic86.bin", 0x8000, 0x3e396eda, 6 | BRF_GRA }, // 16 - - { "63s141.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) -}; - -STD_ROM_PICK(lwingsb) -STD_ROM_FN(lwingsb) - -struct BurnDriver BurnDrvLwingsb = { - "lwingsb", "lwings", NULL, NULL, "1986", - "Legendary Wings (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, lwingsbRomInfo, lwingsbRomName, NULL, NULL, DrvInputInfo, LwingsbDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 256, 3, 4 -}; - - -// Trojan (US set 1) - -static struct BurnRomInfo trojanRomDesc[] = { - { "t4.10n", 0x8000, 0xc1bbeb4e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "t6.13n", 0x8000, 0xd49592ef, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tb05.12n", 0x8000, 0x9273b264, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "tb02.15h", 0x8000, 0x21154797, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "tb01.6d", 0x4000, 0x1c0f91b2, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code - - { "tb03.8k", 0x4000, 0x581a2b4c, 4 | BRF_GRA }, // 5 Characters - - { "tb13.6b", 0x8000, 0x285a052b, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles - { "tb09.6a", 0x8000, 0xaeb693f7, 5 | BRF_GRA }, // 7 - { "tb12.4b", 0x8000, 0xdfb0fe5c, 5 | BRF_GRA }, // 8 - { "tb08.4a", 0x8000, 0xd3a4c9d1, 5 | BRF_GRA }, // 9 - { "tb11.3b", 0x8000, 0x00f0f4fd, 5 | BRF_GRA }, // 10 - { "tb07.3a", 0x8000, 0xdff2ee02, 5 | BRF_GRA }, // 11 - { "tb14.8b", 0x8000, 0x14bfac18, 5 | BRF_GRA }, // 12 - { "tb10.8a", 0x8000, 0x71ba8a6d, 5 | BRF_GRA }, // 13 - - { "tb18.7l", 0x8000, 0x862c4713, 6 | BRF_GRA }, // 14 Sprites - { "tb16.3l", 0x8000, 0xd86f8cbd, 6 | BRF_GRA }, // 15 - { "tb17.5l", 0x8000, 0x12a73b3f, 6 | BRF_GRA }, // 16 - { "tb15.2l", 0x8000, 0xbb1a2769, 6 | BRF_GRA }, // 17 - { "tb22.7n", 0x8000, 0x39daafd4, 6 | BRF_GRA }, // 18 - { "tb20.3n", 0x8000, 0x94615d2a, 6 | BRF_GRA }, // 19 - { "tb21.5n", 0x8000, 0x66c642bd, 6 | BRF_GRA }, // 20 - { "tb19.2n", 0x8000, 0x81d5ab36, 6 | BRF_GRA }, // 21 - - { "tb25.15n", 0x8000, 0x6e38c6fa, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles - { "tb24.13n", 0x8000, 0x14fc6cf2, 7 | BRF_GRA }, // 23 - - { "tb23.9n", 0x8000, 0xeda13c0e, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map - - { "tbp24s10.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) - { "mb7114e.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 -}; - -STD_ROM_PICK(trojan) -STD_ROM_FN(trojan) - -struct BurnDriver BurnDrvTrojan = { - "trojan", NULL, NULL, NULL, "1986", - "Trojan (US set 1)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, - NULL, trojanRomInfo, trojanRomName, NULL, NULL, DrvInputInfo, TrojanlsDIPInfo, - TrojanInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 240, 4, 3 -}; - - -// Trojan (US set 2) - -static struct BurnRomInfo trojanaRomDesc[] = { - { "tb4.10n", 0x8000, 0x0113a551, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "tb6.13n", 0x8000, 0xaa127a5b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tb05.12n", 0x8000, 0x9273b264, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "tb02.15h", 0x8000, 0x21154797, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "tb01.6d", 0x4000, 0x1c0f91b2, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code - - { "tb03.8k", 0x4000, 0x581a2b4c, 4 | BRF_GRA }, // 5 Characters - - { "tb13.6b", 0x8000, 0x285a052b, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles - { "tb09.6a", 0x8000, 0xaeb693f7, 5 | BRF_GRA }, // 7 - { "tb12.4b", 0x8000, 0xdfb0fe5c, 5 | BRF_GRA }, // 8 - { "tb08.4a", 0x8000, 0xd3a4c9d1, 5 | BRF_GRA }, // 9 - { "tb11.3b", 0x8000, 0x00f0f4fd, 5 | BRF_GRA }, // 10 - { "tb07.3a", 0x8000, 0xdff2ee02, 5 | BRF_GRA }, // 11 - { "tb14.8b", 0x8000, 0x14bfac18, 5 | BRF_GRA }, // 12 - { "tb10.8a", 0x8000, 0x71ba8a6d, 5 | BRF_GRA }, // 13 - - { "tb18.7l", 0x8000, 0x862c4713, 6 | BRF_GRA }, // 14 Sprites - { "tb16.3l", 0x8000, 0xd86f8cbd, 6 | BRF_GRA }, // 15 - { "tb17.5l", 0x8000, 0x12a73b3f, 6 | BRF_GRA }, // 16 - { "tb15.2l", 0x8000, 0xbb1a2769, 6 | BRF_GRA }, // 17 - { "tb22.7n", 0x8000, 0x39daafd4, 6 | BRF_GRA }, // 18 - { "tb20.3n", 0x8000, 0x94615d2a, 6 | BRF_GRA }, // 19 - { "tb21.5n", 0x8000, 0x66c642bd, 6 | BRF_GRA }, // 20 - { "tb19.2n", 0x8000, 0x81d5ab36, 6 | BRF_GRA }, // 21 - - { "tb25.15n", 0x8000, 0x6e38c6fa, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles - { "tb24.13n", 0x8000, 0x14fc6cf2, 7 | BRF_GRA }, // 23 - - { "tb23.9n", 0x8000, 0xeda13c0e, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map - - { "tbp24s10.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) - { "mb7114e.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 -}; - -STD_ROM_PICK(trojana) -STD_ROM_FN(trojana) - -struct BurnDriver BurnDrvTrojana = { - "trojana", "trojan", NULL, NULL, "1986", - "Trojan (US set 2)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, - NULL, trojanaRomInfo, trojanaRomName, NULL, NULL, DrvInputInfo, TrojanlsDIPInfo, - TrojanInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 240, 4, 3 -}; - - -// Trojan (Romstar) - -static struct BurnRomInfo trojanrRomDesc[] = { - { "tb04.10n", 0x8000, 0x92670f27, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "tb06.13n", 0x8000, 0xa4951173, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tb05.12n", 0x8000, 0x9273b264, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "tb02.15h", 0x8000, 0x21154797, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "tb01.6d", 0x4000, 0x1c0f91b2, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code - - { "tb03.8k", 0x4000, 0x581a2b4c, 4 | BRF_GRA }, // 5 Characters - - { "tb13.6b", 0x8000, 0x285a052b, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles - { "tb09.6a", 0x8000, 0xaeb693f7, 5 | BRF_GRA }, // 7 - { "tb12.4b", 0x8000, 0xdfb0fe5c, 5 | BRF_GRA }, // 8 - { "tb08.4a", 0x8000, 0xd3a4c9d1, 5 | BRF_GRA }, // 9 - { "tb11.3b", 0x8000, 0x00f0f4fd, 5 | BRF_GRA }, // 10 - { "tb07.3a", 0x8000, 0xdff2ee02, 5 | BRF_GRA }, // 11 - { "tb14.8b", 0x8000, 0x14bfac18, 5 | BRF_GRA }, // 12 - { "tb10.8a", 0x8000, 0x71ba8a6d, 5 | BRF_GRA }, // 13 - - { "tb18.7l", 0x8000, 0x862c4713, 6 | BRF_GRA }, // 14 Sprites - { "tb16.3l", 0x8000, 0xd86f8cbd, 6 | BRF_GRA }, // 15 - { "tb17.5l", 0x8000, 0x12a73b3f, 6 | BRF_GRA }, // 16 - { "tb15.2l", 0x8000, 0xbb1a2769, 6 | BRF_GRA }, // 17 - { "tb22.7n", 0x8000, 0x39daafd4, 6 | BRF_GRA }, // 18 - { "tb20.3n", 0x8000, 0x94615d2a, 6 | BRF_GRA }, // 19 - { "tb21.5n", 0x8000, 0x66c642bd, 6 | BRF_GRA }, // 20 - { "tb19.2n", 0x8000, 0x81d5ab36, 6 | BRF_GRA }, // 21 - - { "tb25.15n", 0x8000, 0x6e38c6fa, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles - { "tb24.13n", 0x8000, 0x14fc6cf2, 7 | BRF_GRA }, // 23 - - { "tb23.9n", 0x8000, 0xeda13c0e, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map - - { "tbp24s10.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) - { "mb7114e.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 -}; - -STD_ROM_PICK(trojanr) -STD_ROM_FN(trojanr) - -struct BurnDriver BurnDrvTrojanr = { - "trojanr", "trojan", NULL, NULL, "1986", - "Trojan (Romstar)\0", NULL, "Capcom (Romstar license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, - NULL, trojanrRomInfo, trojanrRomName, NULL, NULL, DrvInputInfo, TrojanDIPInfo, - TrojanInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 240, 4, 3 -}; - - -// Tatakai no Banka (Japan) - -static struct BurnRomInfo trojanjRomDesc[] = { - { "troj-04.10n", 0x8000, 0x0b5a7f49, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "troj-06.13n", 0x8000, 0xdee6ed92, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tb05.12n", 0x8000, 0x9273b264, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "tb02.15h", 0x8000, 0x21154797, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "tb01.6d", 0x4000, 0x1c0f91b2, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code - - { "tb03.8k", 0x4000, 0x581a2b4c, 4 | BRF_GRA }, // 5 Characters - - { "tb13.6b", 0x8000, 0x285a052b, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles - { "tb09.6a", 0x8000, 0xaeb693f7, 5 | BRF_GRA }, // 7 - { "tb12.4b", 0x8000, 0xdfb0fe5c, 5 | BRF_GRA }, // 8 - { "tb08.4a", 0x8000, 0xd3a4c9d1, 5 | BRF_GRA }, // 9 - { "tb11.3b", 0x8000, 0x00f0f4fd, 5 | BRF_GRA }, // 10 - { "tb07.3a", 0x8000, 0xdff2ee02, 5 | BRF_GRA }, // 11 - { "tb14.8b", 0x8000, 0x14bfac18, 5 | BRF_GRA }, // 12 - { "tb10.8a", 0x8000, 0x71ba8a6d, 5 | BRF_GRA }, // 13 - - { "tb18.7l", 0x8000, 0x862c4713, 6 | BRF_GRA }, // 14 Sprites - { "tb16.3l", 0x8000, 0xd86f8cbd, 6 | BRF_GRA }, // 15 - { "tb17.5l", 0x8000, 0x12a73b3f, 6 | BRF_GRA }, // 16 - { "tb15.2l", 0x8000, 0xbb1a2769, 6 | BRF_GRA }, // 17 - { "tb22.7n", 0x8000, 0x39daafd4, 6 | BRF_GRA }, // 18 - { "tb20.3n", 0x8000, 0x94615d2a, 6 | BRF_GRA }, // 19 - { "tb21.5n", 0x8000, 0x66c642bd, 6 | BRF_GRA }, // 20 - { "tb19.2n", 0x8000, 0x81d5ab36, 6 | BRF_GRA }, // 21 - - { "tb25.15n", 0x8000, 0x6e38c6fa, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles - { "tb24.13n", 0x8000, 0x14fc6cf2, 7 | BRF_GRA }, // 23 - - { "tb23.9n", 0x8000, 0xeda13c0e, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map - - { "tbp24s10.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) - { "mb7114e.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 -}; - -STD_ROM_PICK(trojanj) -STD_ROM_FN(trojanj) - -struct BurnDriver BurnDrvTrojanj = { - "trojanj", "trojan", NULL, NULL, "1986", - "Tatakai no Banka (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, - NULL, trojanjRomInfo, trojanjRomName, NULL, NULL, DrvInputInfo, TrojanDIPInfo, - TrojanInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 240, 4, 3 -}; - - -// Avengers (US set 1) - -static struct BurnRomInfo avengersRomDesc[] = { - { "04.10n", 0x8000, 0xa94aadcc, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "06.13n", 0x8000, 0x39cd80bd, 1 | BRF_PRG | BRF_ESS }, // 1 - { "05.12n", 0x8000, 0x06b1cec9, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "02.15h", 0x8000, 0x107a2e17, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "01.6d", 0x8000, 0xc1e5d258, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code - - { "03.8k", 0x8000, 0xefb5883e, 4 | BRF_GRA }, // 5 Characters - - { "13.6b", 0x8000, 0x9b5ff305, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles - { "09.6a", 0x8000, 0x08323355, 5 | BRF_GRA }, // 7 - { "12.4b", 0x8000, 0x6d5261ba, 5 | BRF_GRA }, // 8 - { "08.4a", 0x8000, 0xa13d9f54, 5 | BRF_GRA }, // 9 - { "11.3b", 0x8000, 0xa2911d8b, 5 | BRF_GRA }, // 10 - { "07.3a", 0x8000, 0xcde78d32, 5 | BRF_GRA }, // 11 - { "14.8b", 0x8000, 0x44ac2671, 5 | BRF_GRA }, // 12 - { "10.8a", 0x8000, 0xb1a717cb, 5 | BRF_GRA }, // 13 - - { "18.7l", 0x8000, 0x3c876a17, 6 | BRF_GRA }, // 14 Sprites - { "16.3l", 0x8000, 0x4b1ff3ac, 6 | BRF_GRA }, // 15 - { "17.5l", 0x8000, 0x4eb543ef, 6 | BRF_GRA }, // 16 - { "15.2l", 0x8000, 0x8041de7f, 6 | BRF_GRA }, // 17 - { "22.7n", 0x8000, 0xbdaa8b22, 6 | BRF_GRA }, // 18 - { "20.3n", 0x8000, 0x566e3059, 6 | BRF_GRA }, // 19 - { "21.5n", 0x8000, 0x301059aa, 6 | BRF_GRA }, // 20 - { "19.2n", 0x8000, 0xa00485ec, 6 | BRF_GRA }, // 21 - - { "25.15n", 0x8000, 0x230d9e30, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles - { "24.13n", 0x8000, 0xa6354024, 7 | BRF_GRA }, // 23 - - { "23.9n", 0x8000, 0xc0a93ef6, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map - - { "tbb_2bpr.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) - { "tbb_1bpr.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 -}; - -STD_ROM_PICK(avengers) -STD_ROM_FN(avengers) - -static INT32 AvengersInit() -{ - avengers = 1; - - return TrojanInit(); -} - -struct BurnDriver BurnDrvAvengers = { - "avengers", NULL, NULL, NULL, "1987", - "Avengers (US set 1)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT, 0, - NULL, avengersRomInfo, avengersRomName, NULL, NULL, DrvInputInfo, AvengersDIPInfo, - AvengersInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 256, 3, 4 -}; - - -// Avengers (US set 2) - -static struct BurnRomInfo avenger2RomDesc[] = { - { "avg4.bin", 0x8000, 0x0fea7ac5, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "av_06a.13n", 0x8000, 0x491a712c, 1 | BRF_PRG | BRF_ESS }, // 1 - { "av_05.12n", 0x8000, 0x9a214b42, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "02.15h", 0x8000, 0x107a2e17, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "01.6d", 0x8000, 0xc1e5d258, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code - - { "03.8k", 0x8000, 0xefb5883e, 4 | BRF_GRA }, // 5 Characters - - { "13.6b", 0x8000, 0x9b5ff305, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles - { "09.6a", 0x8000, 0x08323355, 5 | BRF_GRA }, // 7 - { "12.4b", 0x8000, 0x6d5261ba, 5 | BRF_GRA }, // 8 - { "08.4a", 0x8000, 0xa13d9f54, 5 | BRF_GRA }, // 9 - { "11.3b", 0x8000, 0xa2911d8b, 5 | BRF_GRA }, // 10 - { "07.3a", 0x8000, 0xcde78d32, 5 | BRF_GRA }, // 11 - { "14.8b", 0x8000, 0x44ac2671, 5 | BRF_GRA }, // 12 - { "10.8a", 0x8000, 0xb1a717cb, 5 | BRF_GRA }, // 13 - - { "18.7l", 0x8000, 0x3c876a17, 6 | BRF_GRA }, // 14 Sprites - { "16.3l", 0x8000, 0x4b1ff3ac, 6 | BRF_GRA }, // 15 - { "17.5l", 0x8000, 0x4eb543ef, 6 | BRF_GRA }, // 16 - { "15.2l", 0x8000, 0x8041de7f, 6 | BRF_GRA }, // 17 - { "22.7n", 0x8000, 0xbdaa8b22, 6 | BRF_GRA }, // 18 - { "20.3n", 0x8000, 0x566e3059, 6 | BRF_GRA }, // 19 - { "21.5n", 0x8000, 0x301059aa, 6 | BRF_GRA }, // 20 - { "19.2n", 0x8000, 0xa00485ec, 6 | BRF_GRA }, // 21 - - { "25.15n", 0x8000, 0x230d9e30, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles - { "24.13n", 0x8000, 0xa6354024, 7 | BRF_GRA }, // 23 - - { "23.9n", 0x8000, 0xc0a93ef6, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map - - { "tbb_2bpr.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) - { "tbb_1bpr.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 -}; - -STD_ROM_PICK(avenger2) -STD_ROM_FN(avenger2) - -struct BurnDriver BurnDrvAvenger2 = { - "avengers2", "avengers", NULL, NULL, "1987", - "Avengers (US set 2)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT, 0, - NULL, avenger2RomInfo, avenger2RomName, NULL, NULL, DrvInputInfo, AvengersDIPInfo, - AvengersInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 256, 3, 4 -}; - - -// Hissatsu Buraiken (Japan) - -static struct BurnRomInfo buraikenRomDesc[] = { - { "av_04a.10n", 0x8000, 0x361fc614, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "av_06a.13n", 0x8000, 0x491a712c, 1 | BRF_PRG | BRF_ESS }, // 1 - { "av_05.12n", 0x8000, 0x9a214b42, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "02.15h", 0x8000, 0x107a2e17, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "01.6d", 0x8000, 0xc1e5d258, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code - - { "03.8k", 0x8000, 0xefb5883e, 4 | BRF_GRA }, // 5 Characters - - { "13.6b", 0x8000, 0x9b5ff305, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles - { "09.6a", 0x8000, 0x08323355, 5 | BRF_GRA }, // 7 - { "12.4b", 0x8000, 0x6d5261ba, 5 | BRF_GRA }, // 8 - { "08.4a", 0x8000, 0xa13d9f54, 5 | BRF_GRA }, // 9 - { "11.3b", 0x8000, 0xa2911d8b, 5 | BRF_GRA }, // 10 - { "07.3a", 0x8000, 0xcde78d32, 5 | BRF_GRA }, // 11 - { "14.8b", 0x8000, 0x44ac2671, 5 | BRF_GRA }, // 12 - { "10.8a", 0x8000, 0xb1a717cb, 5 | BRF_GRA }, // 13 - - { "18.7l", 0x8000, 0x3c876a17, 6 | BRF_GRA }, // 14 Sprites - { "16.3l", 0x8000, 0x4b1ff3ac, 6 | BRF_GRA }, // 15 - { "17.5l", 0x8000, 0x4eb543ef, 6 | BRF_GRA }, // 16 - { "15.2l", 0x8000, 0x8041de7f, 6 | BRF_GRA }, // 17 - { "22.7n", 0x8000, 0xbdaa8b22, 6 | BRF_GRA }, // 18 - { "20.3n", 0x8000, 0x566e3059, 6 | BRF_GRA }, // 19 - { "21.5n", 0x8000, 0x301059aa, 6 | BRF_GRA }, // 20 - { "19.2n", 0x8000, 0xa00485ec, 6 | BRF_GRA }, // 21 - - { "av_25.15n", 0x8000, 0x88a505a7, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles - { "av_24.13n", 0x8000, 0x1f4463c8, 7 | BRF_GRA }, // 23 - - { "23.9n", 0x8000, 0xc0a93ef6, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map - - { "tbb_2bpr.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) - { "tbb_1bpr.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 -}; - -STD_ROM_PICK(buraiken) -STD_ROM_FN(buraiken) - -struct BurnDriver BurnDrvBuraiken = { - "buraiken", "avengers", NULL, NULL, "1987", - "Hissatsu Buraiken (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT, 0, - NULL, buraikenRomInfo, buraikenRomName, NULL, NULL, DrvInputInfo, AvengersDIPInfo, - AvengersInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 256, 3, 4 -}; +// FB Alpha "Legendary Wings" driver module +// Based on MAME driver by Paul Leaman + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2203.h" +#include "msm5205.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvZ80ROM2; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvTileMap; +static UINT8 *DrvGfxMask; +static UINT32 *DrvPalette; +static UINT32 *Palette; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvFgRAM; +static UINT8 *DrvBgRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf; +static UINT8 *ScrollX; +static UINT8 *ScrollY; +static UINT8 DrvRecalc; + +static UINT8 DrvReset; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDip[2]; +static UINT8 DrvInp[3]; + +static UINT8 interrupt_enable; +static UINT8 soundlatch; +static UINT8 soundlatch2; +static UINT8 flipscreen; +static UINT8 DrvZ80Bank; + +static UINT8 avengers_param[4]; +static UINT32 avengers_palette_pen; +static UINT8 avengers_soundlatch2; +static UINT8 avengers_soundstate; + +static UINT8 trojan_bg2_scrollx; +static UINT8 trojan_bg2_image; + +static INT32 avengers = 0; +static INT32 MSM5205InUse = 0; + +static INT32 nCyclesTotal[3]; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo LwingsDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfe, NULL }, + {0x12, 0xff, 0xff, 0xfe, NULL }, + + {0 , 0xfe, 0 , 2, "Flip_Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x11, 0x01, 0x0c, 0x0c, "3" }, + {0x11, 0x01, 0x0c, 0x04, "4" }, + {0x11, 0x01, 0x0c, 0x08, "5" }, + {0x11, 0x01, 0x0c, 0x00, "6" }, + + {0 , 0xfe, 0 , 4, "Coin_B" }, + {0x11, 0x01, 0x30, 0x00, "4C_1C" }, + {0x11, 0x01, 0x30, 0x20, "3C_1C" }, + {0x11, 0x01, 0x30, 0x10, "2C_1C" }, + {0x11, 0x01, 0x30, 0x30, "1C_1C" }, + + {0 , 0xfe, 0 , 4, "Coin_A" }, + {0x11, 0x01, 0xc0, 0xc0, "1C_1C" }, + {0x11, 0x01, 0xc0, 0x00, "2C_4C" }, + {0x11, 0x01, 0xc0, 0x40, "1C_2C" }, + {0x11, 0x01, 0xc0, 0x80, "1C_3C" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x06, 0x02, "Easy" }, + {0x12, 0x01, 0x06, 0x06, "Medium" }, + {0x12, 0x01, 0x06, 0x04, "Hard" }, + {0x12, 0x01, 0x06, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo_Sounds" }, + {0x12, 0x01, 0x08, 0x00, "Off" }, + {0x12, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Allow_Continue" }, + {0x12, 0x01, 0x10, 0x00, "No" }, + {0x12, 0x01, 0x10, 0x10, "Yes" }, + + {0 , 0xfe, 0 , 8, "Bonus_Life" }, + {0x12, 0x01, 0xe0, 0xe0, "20000 and every 50000"}, + {0x12, 0x01, 0xe0, 0x60, "20000 and every 60000"}, + {0x12, 0x01, 0xe0, 0xa0, "20000 and every 70000"}, + {0x12, 0x01, 0xe0, 0x20, "30000 and every 60000"}, + {0x12, 0x01, 0xe0, 0xc0, "30000 and every 70000"}, + {0x12, 0x01, 0xe0, 0x40, "30000 and every 80000"}, + {0x12, 0x01, 0xe0, 0x80, "40000 and every 100000"}, + {0x12, 0x01, 0xe0, 0x00, "None" }, +}; + +STDDIPINFO(Lwings) + +static struct BurnDIPInfo LwingsbDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfe, NULL }, + {0x12, 0xff, 0xff, 0xfe, NULL }, + + {0 , 0xfe, 0 , 2, "Flip_Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x11, 0x01, 0x0c, 0x0c, "2" }, + {0x11, 0x01, 0x0c, 0x04, "3" }, + {0x11, 0x01, 0x0c, 0x08, "4" }, + {0x11, 0x01, 0x0c, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Coin_B" }, + {0x11, 0x01, 0x30, 0x00, "4C_1C" }, + {0x11, 0x01, 0x30, 0x20, "3C_1C" }, + {0x11, 0x01, 0x30, 0x10, "2C_1C" }, + {0x11, 0x01, 0x30, 0x30, "1C_1C" }, + + {0 , 0xfe, 0 , 4, "Coin_A" }, + {0x11, 0x01, 0xc0, 0xc0, "1C_1C" }, + {0x11, 0x01, 0xc0, 0x00, "2C_4C" }, + {0x11, 0x01, 0xc0, 0x40, "1C_2C" }, + {0x11, 0x01, 0xc0, 0x80, "1C_3C" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x06, 0x02, "Easy" }, + {0x12, 0x01, 0x06, 0x06, "Medium" }, + {0x12, 0x01, 0x06, 0x04, "Hard" }, + {0x12, 0x01, 0x06, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo_Sounds" }, + {0x12, 0x01, 0x08, 0x00, "Off" }, + {0x12, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Allow_Continue" }, + {0x12, 0x01, 0x10, 0x00, "No" }, + {0x12, 0x01, 0x10, 0x10, "Yes" }, + + {0 , 0xfe, 0 , 8, "Bonus_Life" }, + {0x12, 0x01, 0xe0, 0xe0, "20000 and every 50000" }, + {0x12, 0x01, 0xe0, 0x60, "20000 and every 60000" }, + {0x12, 0x01, 0xe0, 0xa0, "20000 and every 70000" }, + {0x12, 0x01, 0xe0, 0x20, "30000 and every 60000" }, + {0x12, 0x01, 0xe0, 0xc0, "30000 and every 70000" }, + {0x12, 0x01, 0xe0, 0x40, "30000 and every 80000" }, + {0x12, 0x01, 0xe0, 0x80, "40000 and every 100000" }, + {0x12, 0x01, 0xe0, 0x00, "None" }, +}; + +STDDIPINFO(Lwingsb) + +static struct BurnDIPInfo SectionzDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x3f, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip_Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x11, 0x01, 0x0c, 0x04, "2" }, + {0x11, 0x01, 0x0c, 0x0c, "3" }, + {0x11, 0x01, 0x0c, 0x08, "4" }, + {0x11, 0x01, 0x0c, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Coin_A" }, + {0x11, 0x01, 0x30, 0x00, "4C_1C" }, + {0x11, 0x01, 0x30, 0x20, "3C_1C" }, + {0x11, 0x01, 0x30, 0x10, "2C_1C" }, + {0x11, 0x01, 0x30, 0x30, "1C_1C" }, + + {0 , 0xfe, 0 , 4, "Coin_B" }, + {0x11, 0x01, 0xc0, 0x00, "2C_1C" }, + {0x11, 0x01, 0xc0, 0xc0, "1C_1C" }, + {0x11, 0x01, 0xc0, 0x40, "1C_2C" }, + {0x11, 0x01, 0xc0, 0x80, "1C_3C" }, + + {0 , 0xfe, 0 , 2, "Allow_Continue" }, + {0x12, 0x01, 0x01, 0x00, "No" }, + {0x12, 0x01, 0x01, 0x01, "Yes" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x06, 0x02, "Easy" }, + {0x12, 0x01, 0x06, 0x06, "Normal" }, + {0x12, 0x01, 0x06, 0x04, "Hard" }, + {0x12, 0x01, 0x06, 0x00, "Very_Hard" }, + + {0 , 0xfe, 0 , 8, "Bonus_Life" }, + {0x12, 0x01, 0x38, 0x38, "20000 50000" }, + {0x12, 0x01, 0x38, 0x18, "20000 60000" }, + {0x12, 0x01, 0x38, 0x28, "20000 70000" }, + {0x12, 0x01, 0x38, 0x08, "30000 60000" }, + {0x12, 0x01, 0x38, 0x30, "30000 70000" }, + {0x12, 0x01, 0x38, 0x10, "30000 80000" }, + {0x12, 0x01, 0x38, 0x20, "40000 100000" }, + {0x12, 0x01, 0x38, 0x00, "None" }, + + {0 , 0xfe, 0 , 3, "Cabinet" }, + {0x12, 0x01, 0xc0, 0x00, "Upright One Player" }, + {0x12, 0x01, 0xc0, 0x40, "Upright Two Players" }, + {0x12, 0x01, 0xc0, 0xc0, "Cocktail" }, +}; + +STDDIPINFO(Sectionz) + +static struct BurnDIPInfo TrojanlsDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x1c, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 3, "Cabinet" }, + {0x11, 0x01, 0x03, 0x00, "Upright 1 Player" }, + {0x11, 0x01, 0x03, 0x02, "Upright 2 Players" }, + {0x11, 0x01, 0x03, 0x03, "Cocktail" }, + + {0 , 0xfe, 0 , 8, "Bonus_Life" }, + {0x11, 0x01, 0x1c, 0x10, "20000 60000" }, + {0x11, 0x01, 0x1c, 0x0c, "20000 70000" }, + {0x11, 0x01, 0x1c, 0x08, "20000 80000" }, + {0x11, 0x01, 0x1c, 0x1c, "30000 60000" }, + {0x11, 0x01, 0x1c, 0x18, "30000 70000" }, + {0x11, 0x01, 0x1c, 0x14, "30000 80000" }, + {0x11, 0x01, 0x1c, 0x04, "40000 80000" }, + {0x11, 0x01, 0x1c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4, "Coin_A" }, + {0x12, 0x01, 0x03, 0x00, "2C_1C" }, + {0x12, 0x01, 0x03, 0x03, "1C_1C" }, + {0x12, 0x01, 0x03, 0x02, "1C_2C" }, + {0x12, 0x01, 0x03, 0x01, "1C_3C" }, + + {0 , 0xfe, 0 , 4, "Coin_B" }, + {0x12, 0x01, 0x0c, 0x00, "4C_1C" }, + {0x12, 0x01, 0x0c, 0x04, "3C_1C" }, + {0x12, 0x01, 0x0c, 0x08, "2C_1C" }, + {0x12, 0x01, 0x0c, 0x0c, "1C_1C" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x30, 0x20, "2" }, + {0x12, 0x01, 0x30, 0x30, "3" }, + {0x12, 0x01, 0x30, 0x10, "4" }, + {0x12, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Flip_Screen" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Allow_Continue" }, + {0x12, 0x01, 0x80, 0x00, "No" }, + {0x12, 0x01, 0x80, 0x80, "Yes" }, +}; + +STDDIPINFO(Trojanls) + +static struct BurnDIPInfo TrojanDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfc, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 3, "Cabinet" }, + {0x11, 0x01, 0x03, 0x00, "Upright 1 Player" }, + {0x11, 0x01, 0x03, 0x02, "Upright 2 Players" }, + {0x11, 0x01, 0x03, 0x03, "Cocktail" }, + + {0 , 0xfe, 0 , 8, "Bonus_Life" }, + {0x11, 0x01, 0x1c, 0x10, "20000 60000" }, + {0x11, 0x01, 0x1c, 0x0c, "20000 70000" }, + {0x11, 0x01, 0x1c, 0x08, "20000 80000" }, + {0x11, 0x01, 0x1c, 0x1c, "30000 60000" }, + {0x11, 0x01, 0x1c, 0x18, "30000 70000" }, + {0x11, 0x01, 0x1c, 0x14, "30000 80000" }, + {0x11, 0x01, 0x1c, 0x04, "40000 80000" }, + {0x11, 0x01, 0x1c, 0x00, "None" }, + + {0 , 0xfe, 0 , 6, "Starting Level" }, + {0x11, 0x01, 0xe0, 0xe0, "1" }, + {0x11, 0x01, 0xe0, 0xc0, "2" }, + {0x11, 0x01, 0xe0, 0xa0, "3" }, + {0x11, 0x01, 0xe0, 0x80, "4" }, + {0x11, 0x01, 0xe0, 0x60, "5" }, + {0x11, 0x01, 0xe0, 0x40, "6" }, + + {0 , 0xfe, 0 , 4, "Coin_A" }, + {0x12, 0x01, 0x03, 0x00, "2C_1C" }, + {0x12, 0x01, 0x03, 0x03, "1C_1C" }, + {0x12, 0x01, 0x03, 0x02, "1C_2C" }, + {0x12, 0x01, 0x03, 0x01, "1C_3C" }, + + {0 , 0xfe, 0 , 4, "Coin_B" }, + {0x12, 0x01, 0x0c, 0x00, "4C_1C" }, + {0x12, 0x01, 0x0c, 0x04, "3C_1C" }, + {0x12, 0x01, 0x0c, 0x08, "2C_1C" }, + {0x12, 0x01, 0x0c, 0x0c, "1C_1C" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x30, 0x20, "2" }, + {0x12, 0x01, 0x30, 0x30, "3" }, + {0x12, 0x01, 0x30, 0x10, "4" }, + {0x12, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Flip_Screen" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Allow_Continue" }, + {0x12, 0x01, 0x80, 0x00, "No" }, + {0x12, 0x01, 0x80, 0x80, "Yes" }, +}; + +STDDIPINFO(Trojan) + +static struct BurnDIPInfo AvengersDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip_Screen" }, + {0x12, 0x01, 0x02, 0x02, "Off" }, + {0x12, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin_B" }, + {0x12, 0x01, 0x1c, 0x00, "4C_1C" }, + {0x12, 0x01, 0x1c, 0x10, "3C_1C" }, + {0x12, 0x01, 0x1c, 0x08, "2C_1C" }, + {0x12, 0x01, 0x1c, 0x1c, "1C_1C" }, + {0x12, 0x01, 0x1c, 0x0c, "1C_2C" }, + {0x12, 0x01, 0x1c, 0x14, "1C_3C" }, + {0x12, 0x01, 0x1c, 0x04, "1C_4C" }, + {0x12, 0x01, 0x1c, 0x18, "1C_6C" }, + + {0 , 0xfe, 0 , 8, "Coin_A" }, + {0x12, 0x01, 0xe0, 0x00, "4C_1C" }, + {0x12, 0x01, 0xe0, 0x80, "3C_1C" }, + {0x12, 0x01, 0xe0, 0x40, "2C_1C" }, + {0x12, 0x01, 0xe0, 0xe0, "1C_1C" }, + {0x12, 0x01, 0xe0, 0x60, "1C_2C" }, + {0x12, 0x01, 0xe0, 0xa0, "1C_3C" }, + {0x12, 0x01, 0xe0, 0x20, "1C_4C" }, + {0x12, 0x01, 0xe0, 0xc0, "1C_6C" }, + + {0 , 0xfe, 0 , 2, "Allow_Continue" }, + {0x11, 0x01, 0x01, 0x00, "No" }, + {0x11, 0x01, 0x01, 0x01, "Yes" }, + + {0 , 0xfe, 0 , 2, "Demo_Sounds" }, + {0x11, 0x01, 0x02, 0x00, "Off" }, + {0x11, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x11, 0x01, 0x0c, 0x04, "Easy" }, + {0x11, 0x01, 0x0c, 0x0c, "Normal" }, + {0x11, 0x01, 0x0c, 0x08, "Hard" }, + {0x11, 0x01, 0x0c, 0x00, "Very_Hard" }, + + {0 , 0xfe, 0 , 4, "Bonus_Life" }, + {0x11, 0x01, 0x30, 0x30, "20k 60k" }, + {0x11, 0x01, 0x30, 0x10, "20k 70k" }, + {0x11, 0x01, 0x30, 0x20, "20k 80k" }, + {0x11, 0x01, 0x30, 0x00, "30k 80k" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x11, 0x01, 0xc0, 0xc0, "3" }, + {0x11, 0x01, 0xc0, 0x40, "4" }, + {0x11, 0x01, 0xc0, 0x80, "5" }, + {0x11, 0x01, 0xc0, 0x00, "6" }, +}; + +STDDIPINFO(Avengers) + + + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x020000; + DrvZ80ROM1 = Next; Next += 0x008000; + DrvZ80ROM2 = Next; Next += 0x010000; + + DrvTileMap = Next; Next += 0x008000; + + DrvGfxROM0 = Next; Next += 0x020000; + DrvGfxROM1 = Next; Next += 0x080000; + DrvGfxROM2 = Next; Next += 0x080000; + DrvGfxROM3 = Next; Next += 0x020000; + + DrvGfxMask = Next; Next += 0x000020; + + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x002000; + DrvZ80RAM1 = Next; Next += 0x000800; + DrvPalRAM = Next; Next += 0x000800; + DrvFgRAM = Next; Next += 0x000800; + DrvBgRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x000200; + DrvSprBuf = Next; Next += 0x000200; + + Palette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + ScrollX = Next; Next += 0x000002; + ScrollY = Next; Next += 0x000002; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +// Avengers protection code ripped directly from MAME +static void avengers_protection_w(UINT8 data) +{ + INT32 pc = ZetPc(-1); + + if (pc == 0x2eeb) + { + avengers_param[0] = data; + } + else if (pc == 0x2f09) + { + avengers_param[1] = data; + } + else if (pc == 0x2f26) + { + avengers_param[2] = data; + } + else if (pc == 0x2f43) + { + avengers_param[3] = data; + } + else if (pc == 0x0445) + { + avengers_soundstate = 0x80; + soundlatch = data; + } +} + +static INT32 avengers_fetch_paldata() +{ + static const char pal_data[] = + // page 1: 0x03,0x02,0x01,0x00 + "0000000000000000" "A65486A6364676D6" "C764C777676778A7" "A574E5E5C5756AE5" + "0000000000000000" "F51785D505159405" "A637B6A636269636" "F45744E424348824" + "0000000000000000" "A33263B303330203" "4454848454440454" "A27242C232523632" + "0000000000000000" "1253327202421102" "3386437373631373" "41A331A161715461" + "0000000000000000" "1341715000711203" "4442635191622293" "5143D48383D37186" + "0000000000000000" "2432423000412305" "6633343302333305" "7234A565A5A4A2A8" + "0000000000000000" "46232422A02234A7" "88241624A21454A7" "A3256747A665D3AA" + "0000000000000000" "070406020003050B" "0A05090504050508" "05060A090806040C" + + // page2: 0x07,0x06,0x05,0x04 + "0000000000000000" "2472030503230534" "6392633B23433B53" "0392846454346423" + "0000000000000000" "1313052405050423" "3223754805354832" "323346A38686A332" + "0000000000000000" "72190723070723D2" "81394776070776D1" "A15929F25959F2F1" + "0000000000000000" "650706411A2A1168" "770737C43A3A3466" "87071F013C0C3175" + "0000000000000000" "2001402727302020" "4403048F4A484344" "4A050B074E0E4440" + "0000000000000000" "3003800C35683130" "5304035C587C5453" "5607080C5B265550" + "0000000000000000" "4801D00043854245" "6C020038669A6569" "6604050A69446764" + "0000000000000000" "0504000001030504" "0A05090504060307" "04090D0507010403" + + // page3: 0x0b,0x0a,0x09,0x08 + "0000000000000000" "685A586937F777F7" "988A797A67A7A7A7" "B8CA898DC737F787" + "0000000000000000" "4738A61705150505" "8797672835250535" "7777072A25350525" + "0000000000000000" "3525642404340404" "6554453554440454" "5544053634540434" + "0000000000000000" "2301923203430303" "4333834383630373" "3324034473730363" + "0000000000000000" "3130304000762005" "5352525291614193" "6463635483D06581" + "0000000000000000" "4241415100483107" "6463631302335304" "76757415A5A077A3" + "0000000000000000" "53525282A02A43AA" "76747424A31565A5" "88888536A66089A4" + "0000000000000000" "05040304000D050C" "0806050604070707" "0A0A060808000C06" + + // page4: 0x0f,0x0e,0x0d,0x0c + "0000000000000000" "3470365956342935" "5590578997554958" "73C078A8C573687A" + "0000000000000000" "5355650685030604" "2427362686042607" "010A070584010508" + "0000000000000000" "0208432454022403" "737A243455733406" "000D050353000307" + "0000000000000000" "000A023233003202" "424C134234424204" "000F241132001105" + "0000000000000000" "3031113030300030" "5152215252512051" "7273337374723272" + "0000000000000000" "4141214041411041" "6263326363623162" "8385448585834383" + "0000000000000000" "5153225152512051" "7375437475734273" "9598559697946495" + "0000000000000000" "0205020303020102" "0407040606040304" "060A060809060506" + + // page5: 0x13,0x12,0x11,0x10 + "0000000000000000" "4151D141D3D177F7" "5454C44482C4A7A7" "0404D45491D4F787" + "0000000000000000" "0303032374230505" "9696962673560535" "0505054502850525" + "0000000000000000" "0303030355030404" "7777770754470454" "0606060603760434" + "0000000000000000" "0505053547050303" "4949492945390373" "0808083804580363" + "0000000000000000" "0B0C444023442005" "3D3F333433334193" "0000043504046581" + "0000000000000000" "0809565085863107" "0B6A352374455304" "00700644050677A3" + "0000000000000000" "06073879C8C843AA" "09492739A58765A5" "0050084A060889A4" + "0000000000000000" "05060B070B0B050C" "0707090707090707" "00000B08070B0C06" + + // page6: 0x17,0x16,0x15,0x14 + "0000000000000000" "0034308021620053" "0034417042512542" "0034526064502E31" + "0000000000000000" "0106412032733060" "11A6522053628350" "22A6632072620D42" + "0000000000000000" "1308223052242080" "2478233071235170" "3578243090230960" + "0000000000000000" "2111334333331404" "3353324232324807" "45B5314131310837" + "0000000000000000" "3232445444445302" "445443534343B725" "567642524242B745" + "0000000000000000" "4343556555550201" "5575546454540524" "6787536353537554" + "0000000000000000" "6474667676660100" "7696657575650423" "88A8647474645473" + "0000000000000000" "0001070701050004" "0003060603040303" "0005050505040302"; + + INT32 bank = avengers_palette_pen/64; + INT32 offs = avengers_palette_pen%64; + INT32 page = bank/4; // 0..7 + INT32 base = (3-(bank&3)); // 0..3 + INT32 row = offs&0xf; // 0..15 + INT32 col = offs/16 + base*4; // 0..15 + INT32 digit0 = pal_data[page*256*2 + (31-row*2)*16+col]; + INT32 digit1 = pal_data[page*256*2 + (30-row*2)*16+col]; + INT32 result; + + if( digit0>='A' ) digit0 += 10 - 'A'; else digit0 -= '0'; + if( digit1>='A' ) digit1 += 10 - 'A'; else digit1 -= '0'; + result = digit0 * 16 + digit1; + + if( (avengers_palette_pen&0x3f)!=0x3f ) avengers_palette_pen++; + + return result; +} + +static UINT8 avengers_protection_r() +{ + static const INT32 xpos[8] = { 10, 7, 0, -7, -10, -7, 0, 7 }; + static const INT32 ypos[8] = { 0, 7, 10, 7, 0, -7, -10, -7 }; + INT32 best_dist = 0; + INT32 best_dir = 0; + INT32 x,y; + INT32 dx,dy,dist,dir; + + if(ZetPc(-1) == 0x7c7 ) + { + // palette data + return avengers_fetch_paldata(); + } + + // int to Angle Function + // + // Input: two cartesian points + // Output: direction code (north,northeast,east,...) + // + x = avengers_param[0] - avengers_param[2]; + y = avengers_param[1] - avengers_param[3]; + for( dir=0; dir<8; dir++ ) + { + dx = xpos[dir]-x; + dy = ypos[dir]-y; + dist = dx*dx+dy*dy; + if( dist < best_dist || dir==0 ) + { + best_dir = dir; + best_dist = dist; + } + } + return best_dir<<5; +} + + + +UINT8 __fastcall lwings_main_read(UINT16 address) +{ + switch (address) + { + case 0xf808: + case 0xf809: + case 0xf80a: + return DrvInp[address - 0xf808]; + + case 0xf80b: + case 0xf80c: + return DrvDip[address - 0xf80b]; + + case 0xf80d: + return avengers_protection_r(); + } + + return 0; +} + +static void lwings_bankswitch_w(UINT8 data) +{ + DrvZ80Bank = data; + + INT32 bankaddress = 0x10000 + ((data >> 1) & 3) * 0x4000; + + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + bankaddress); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + bankaddress); +} + +void __fastcall lwings_main_write(UINT16 address, UINT8 data) +{ + if ((address & 0xf800) == 0xf000) { + DrvPalRAM[address & 0x7ff] = data; + + UINT8 r, g, b; + UINT16 coldata = DrvPalRAM[(address & 0x3ff) | 0x400] | (DrvPalRAM[address & 0x3ff] << 8); + + r = (coldata >> 8) & 0xf0; + g = (coldata >> 4) & 0xf0; + b = (coldata >> 0) & 0xf0; + + r |= r >> 4; + g |= g >> 4; + b |= b >> 4; + + Palette[address & 0x3ff] = (r << 16) | (g << 8) | b; + DrvPalette[address & 0x3ff] = BurnHighCol(r, g, b, 0); + + return; + } + + // hack + if (avengers && (address & 0xfff8) == 0xf808) address += 0x10; + + switch (address) + { + case 0xf800: + case 0xf801: + case 0xf808: + case 0xf809: + ScrollX[address & 1] = data; + return; + + case 0xf802: + case 0xf803: + case 0xf80a: + case 0xf80b: + ScrollY[address & 1] = data; + return; + + case 0xf804: + trojan_bg2_scrollx = data; + return; + + case 0xf805: + trojan_bg2_image = data; + return; + + case 0xf80c: + soundlatch = data; + return; + + case 0xf80d: + soundlatch2 = data; + return; + + case (0xf80e + 0x10): + case 0xf80e: + lwings_bankswitch_w(data); + + flipscreen = ~data & 0x01; + + interrupt_enable = data & 0x08; + return; + + case (0xf809 + 0x10): + avengers_protection_w(data); + return; + + case (0xf80c + 0x10): + avengers_palette_pen = data << 6; + return; + + case (0xf80d + 0x10): + soundlatch2 = data; + return; + } +} + +void __fastcall lwings_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe000: + case 0xe001: + case 0xe002: + case 0xe003: + BurnYM2203Write((address & 2) >> 1, address & 1, data); + return; + + case 0xe006: + avengers_soundlatch2 = data; + return; + } +} + +UINT8 __fastcall lwings_sound_read(UINT16 address) +{ + switch (address) + { + case 0xc800: + return soundlatch; + + case 0xe006: + UINT8 Data = avengers_soundlatch2 | avengers_soundstate; + avengers_soundstate = 0; + return Data; + } + + return 0; +} + +void __fastcall trojan_adpcm_out(UINT16 port, UINT8 data) +{ + if ((port & 0xff) == 0x01) { + MSM5205ResetWrite(0, (data >> 7) & 1); + MSM5205DataWrite(0, data); + MSM5205VCLKWrite(0, 1); + MSM5205VCLKWrite(0, 0); + } +} + +UINT8 __fastcall trojan_adpcm_in(UINT16 port) +{ + port &= 0xff; + + UINT8 ret = 0; + + if (port == 0x00) { + ret = soundlatch2; + } + + return ret; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + if (i == 0) lwings_bankswitch_w(0); + ZetClose(); + } + + if (MSM5205InUse) { + ZetOpen(2); + ZetReset(); + ZetClose(); + } + + BurnYM2203Reset(); + + if (MSM5205InUse) MSM5205Reset(); + + trojan_bg2_scrollx = 0; + trojan_bg2_image = 0; + + memset(avengers_param, 0, 4); + avengers_palette_pen = 0; + + avengers_soundlatch2 = 0; + avengers_soundstate = 0; + + DrvZ80Bank = 0; + flipscreen = 0; + interrupt_enable = 0; + soundlatch = 0; + soundlatch2 = 0; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[2] = { 0x000000, 0x000004 }; + INT32 Plane1[4] = { 0x080004, 0x080000, 0x000004, 0x000000 }; + INT32 Plane1a[4] = { 0x100004, 0x100000, 0x000004, 0x000000 }; + INT32 Plane2[4] = { 0x180000, 0x100000, 0x080000, 0x000000 }; + INT32 Plane3[4] = { 0x040000, 0x040004, 0x000000, 0x000004 }; + + // sprite, char + INT32 XOffs0[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; + INT32 YOffs0[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; + + // background + INT32 XOffs1[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; + INT32 YOffs1[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x08000); + + GfxDecode(0x0800, 2, 8, 8, Plane0, XOffs0, YOffs0, 0x080, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x40000); + + GfxDecode(0x0800, 4, 16, 16, Plane2, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x40000); + + if (DrvTileMap != NULL) { + GfxDecode(0x0800, 4, 16, 16, Plane1a, XOffs0, YOffs0, 0x200, tmp, DrvGfxROM2); + + memcpy (tmp, DrvGfxROM3, 0x10000); + + GfxDecode(0x0200, 4, 16, 16, Plane3, XOffs0, YOffs0, 0x200, tmp, DrvGfxROM3); + } else { + GfxDecode(0x0400, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x200, tmp, DrvGfxROM2); + } + + BurnFree (tmp); + + return 0; +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); +} + +inline static INT32 DrvMSM5205SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)((double)ZetTotalCycles() * nSoundRate / (nCyclesTotal[0] * 60)); +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3000000; +} + +static void lwings_main_cpu_init() +{ + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + // 8000 - bfff banked + ZetMapArea(0xc000, 0xddff, 0, DrvZ80RAM0); + ZetMapArea(0xc000, 0xddff, 1, DrvZ80RAM0); + ZetMapArea(0xc000, 0xddff, 2, DrvZ80RAM0); + + ZetMapArea(0xde00, 0xdfff, 0, DrvSprRAM); + ZetMapArea(0xde00, 0xdfff, 1, DrvSprRAM); + ZetMapArea(0xde00, 0xdfff, 2, DrvSprRAM); + + ZetMapArea(0xe000, 0xe7ff, 0, DrvFgRAM); + ZetMapArea(0xe000, 0xe7ff, 1, DrvFgRAM); + ZetMapArea(0xe000, 0xe7ff, 2, DrvFgRAM); + + ZetMapArea(0xe800, 0xefff, 0, DrvBgRAM); + ZetMapArea(0xe800, 0xefff, 1, DrvBgRAM); + ZetMapArea(0xe800, 0xefff, 2, DrvBgRAM); + + ZetMapArea(0xf000, 0xf7ff, 0, DrvPalRAM); +// ZetMapArea(0xf000, 0xf7ff, 1, DrvPalRAM); // write handler + ZetMapArea(0xf000, 0xf7ff, 2, DrvPalRAM); + ZetSetReadHandler(lwings_main_read); + ZetSetWriteHandler(lwings_main_write); + ZetClose(); +} + +static void lwings_sound_init() +{ + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM1); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM1); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM1); + ZetSetReadHandler(lwings_sound_read); + ZetSetWriteHandler(lwings_sound_write); + ZetClose(); + + BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + DrvTileMap = NULL; + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x18000, 2, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 4, 1)) return 1; + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x8000, i + 5, 1)) return 1; + } + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvGfxROM2 + i * 0x8000, i + 13, 1)) return 1; + } + + DrvGfxDecode(); + } + + ZetInit(0); + lwings_main_cpu_init(); + + ZetInit(1); + lwings_sound_init(); + + GenericTilesInit(); + + nCyclesTotal[0] = 6000000 / 60; + nCyclesTotal[1] = 3000000 / 60; + nCyclesTotal[2] = 0; + + DrvDoReset(); + + return 0; +} + +static INT32 TrojanInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x18000, 2, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM2 + 0x00000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 1)) return 1; + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x8000, i + 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + i * 0x8000, i + 14, 1)) return 1; + } + + if (BurnLoadRom(DrvGfxROM3 + 0x0000, 22, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x8000, 23, 1)) return 1; + + if (BurnLoadRom(DrvTileMap, 24, 1)) return 1; + + DrvGfxDecode(); + + { + for (INT32 i = 0; i < 32; i++) { + DrvGfxMask[i] = (0xf07f0001 & (1 << i)) ? 1 : 0; + } + } + } + + ZetInit(0); + lwings_main_cpu_init(); + + ZetInit(1); + lwings_sound_init(); + + ZetInit(2); + ZetOpen(2); + ZetMapArea(0x0000, 0xffff, 0, DrvZ80ROM2); + ZetMapArea(0x0000, 0xffff, 2, DrvZ80ROM2); + ZetSetInHandler(trojan_adpcm_in); + ZetSetOutHandler(trojan_adpcm_out); + ZetClose(); + + MSM5205Init(0, DrvMSM5205SynchroniseStream, 455000, NULL, MSM5205_SEX_4B, 1); + MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + MSM5205InUse = 1; + + GenericTilesInit(); + + nCyclesTotal[0] = 3000000 / 60; + nCyclesTotal[1] = 3000000 / 60; + nCyclesTotal[2] = 3000000 / 60; + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + BurnYM2203Exit(); + + BurnFree (AllMem); + + avengers = 0; + MSM5205InUse = 0; + + return 0; +} + +static INT32 TrojanExit() +{ + MSM5205Exit(); + return DrvExit(); +} + +static void draw_foreground(INT32 colbase) +{ + for (INT32 offs = 0x20; offs < 0x3e0; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + INT32 color = DrvFgRAM[offs | 0x400]; + INT32 code = DrvFgRAM[offs] | ((color & 0xc0) << 2); + + INT32 flipx = color & 0x10; + INT32 flipy = color & 0x20; + + color &= 0x0f; + + sy -= 8; + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 2, 0x03, colbase, DrvGfxROM0); + } else { + Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 2, 0x03, colbase, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 2, 0x03, colbase, DrvGfxROM0); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 2, 0x03, colbase, DrvGfxROM0); + } + } + } +} + +static void draw_background() +{ + INT32 scrollx = (ScrollX[0] | (ScrollX[1] << 8)) & 0x1ff; + INT32 scrolly = (ScrollY[0] | (ScrollY[1] << 8)) & 0x1ff; + + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 sy = (offs & 0x1f) << 4; + INT32 sx = (offs >> 5) << 4; + sy -= 8; + + sx -= scrollx; + sy -= scrolly; + if (sx < -15) sx += 512; + if (sy < -15) sy += 512; + + if (sy < -15 || sx < -15 || sy >= nScreenHeight || sx >= nScreenWidth) + continue; + + INT32 color = DrvBgRAM[offs | 0x400]; + INT32 code = DrvBgRAM[offs] | (color & 0xe0) << 3;; + + INT32 flipx = color & 0x08; + INT32 flipy = color & 0x10; + + color &= 0x07; + + if (flipy) { + if (flipx) { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM1); + } else { + Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM1); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM1); + } + } + } +} + +static void lwings_draw_sprites() +{ + for (INT32 offs = 0x200 - 4; offs >= 0; offs -= 4) + { + INT32 sx = DrvSprBuf[offs + 3] - 0x100 * (DrvSprBuf[offs + 1] & 0x01); + INT32 sy = DrvSprBuf[offs + 2]; + + if (sy && sx) + { + INT32 code,color,flipx,flipy; + + if (sy > 0xf8) sy-=0x100; + + code = DrvSprBuf[offs] | ((DrvSprBuf[offs + 1] & 0xc0) << 2); + color = (DrvSprBuf[offs + 1] & 0x38) >> 3; + flipx = DrvSprBuf[offs + 1] & 0x02; + flipy = DrvSprBuf[offs + 1] & 0x04; + + color += 0x18; + + sy -= 8; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); + } + } + } + } +} + + +static void draw_16x16_with_mask(INT32 sx, INT32 sy, INT32 code, INT32 color, UINT8 *gfxbase, UINT8 *mask, INT32 flipx, INT32 flipy) +{ + UINT8 *src = gfxbase + (code << 8); + + color = (color << 4) | 0x100; + + if (flipy) { + src += 0xf0; + + if (flipx) { + for (INT32 y = 15; y >= 0; y--, src-=16) + { + INT32 yy = sy + y; + if (yy < 0) break; + if (yy >= nScreenHeight) continue; + + for (INT32 x = 15; x >= 0; x--) + { + INT32 xx = sx + x; + if (xx < 0) break; + if (xx >= nScreenWidth) continue; + + INT32 o = color | src[15-x]; + if (mask[src[15-x]]) continue; + + pTransDraw[(yy * nScreenWidth) + xx] = o; + } + } + } else { + for (INT32 y = 15; y >= 0; y--, src-=16) + { + INT32 yy = sy + y; + if (yy < 0) break; + if (yy >= nScreenHeight) continue; + + for (INT32 x = 0; x < 16; x++) + { + INT32 xx = sx + x; + if (xx < 0) continue; + if (xx >= nScreenWidth) break; + + INT32 o = color | src[x]; + if (mask[src[x]]) continue; + + pTransDraw[(yy * nScreenWidth) + xx] = o; + } + } + } + } else { + if (flipx) { + for (INT32 y = 0; y < 16; y++, src+=16) + { + INT32 yy = sy + y; + if (yy < 0) continue; + if (yy >= nScreenHeight) break; + + for (INT32 x = 15; x >= 0; x--) + { + INT32 xx = sx + x; + if (xx < 0) break; + if (xx >= nScreenWidth) continue; + + INT32 o = color | src[15-x]; + if (mask[src[15-x]]) continue; + + pTransDraw[(yy * nScreenWidth) + xx] = o; + } + } + } else { + for (INT32 y = 0; y < 16; y++, src+=16) + { + INT32 yy = sy + y; + if (yy < 0) continue; + if (yy >= nScreenHeight) break; + + for (INT32 x = 0; x < 16; x++) + { + INT32 xx = sx + x; + if (xx < 0) continue; + if (xx >= nScreenWidth) break; + + INT32 o = color | src[x]; + if (mask[src[x]]) continue; + + pTransDraw[(yy * nScreenWidth) + xx] = o; + } + } + } + } +} + +static void trojan_draw_background(INT32 priority) +{ + INT32 scrollx = (ScrollX[0] | (ScrollX[1] << 8)) & 0x1ff; + INT32 scrolly = (ScrollY[0] | (ScrollY[1] << 8)) & 0x1ff; + + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 color = DrvBgRAM[offs | 0x400]; + if (priority && ((~color >> 3) & 1)) continue; + + INT32 sy = (offs & 0x1f) << 4; + INT32 sx = (offs >> 5) << 4; + sy -= 8; + + sx -= scrollx; + sy -= scrolly; + if (sx < -15) sx += 512; + if (sy < -15) sy += 512; + + if (sy < -15 || sx < -15 || sy >= nScreenHeight || sx >= nScreenWidth) + continue; + + INT32 code = DrvBgRAM[offs] | ((color & 0xe0) << 3); + INT32 flipx = color & 0x10; + INT32 flipy = 0; + + color &= 0x07; + + if (avengers) color ^= 6; + + draw_16x16_with_mask(sx, sy, code, color, DrvGfxROM1, DrvGfxMask + priority * 16, flipx, flipy); +/* + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x00, 0x100, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x00, 0x100, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x00, 0x100, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0x00, 0x100, DrvGfxROM1); + } + } +*/ + } +} + +static void trojan_draw_background2() +{ + for (INT32 offs = 0; offs < 32 * 16; offs++) + { + INT32 sx = (offs & 0x1f) << 4; + INT32 sy = (offs >> 5) << 4; + + sx -= trojan_bg2_scrollx; + if (sx < -15) sx += 512; + sy -= 8; + + if (sy < -15 || sx < -15 || sy >= nScreenHeight || sx >= nScreenWidth) + continue; + + INT32 offset = ((((offs << 6) & 0x7800) | ((offs << 1) & 0x3e)) + (trojan_bg2_image << 5)) & 0x7fff; + + INT32 color = DrvTileMap[offset + 1]; + INT32 code = DrvTileMap[offset + 0] | ((color & 0x80) << 1); + INT32 flipx = color & 0x10; + INT32 flipy = color & 0x20; + + color &= 7; + + if (flipy) { + if (flipx) { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM3); + } else { + Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM3); + } + } else { + if (flipx) { + Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM3); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM3); + } + } + } +} + +static void trojan_draw_sprites() +{ + for (INT32 offs = 0x180 - 4; offs >= 0; offs -= 4) + { + INT32 sx = DrvSprBuf[offs + 3] - 0x100 * (DrvSprBuf[offs + 1] & 0x01); + INT32 sy = DrvSprBuf[offs + 2]; + + if (sy && sx) + { + INT32 flipx, flipy; + + if (sy > 0xf8) sy-=0x100; + + INT32 color = DrvSprBuf[offs + 1]; + INT32 code = DrvSprBuf[offs] | ((color & 0x20) << 4) | ((color & 0x40) << 2) | ((color & 0x80) << 3); + + if (avengers) + { + flipx = 0; + flipy = ~color & 0x10; + } + else + { + flipx = color & 0x10; + flipy = 1; + } + + color = ((color >> 1) & 7) + 0x28; + + sy -= 8; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0, DrvGfxROM2); + } + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + if (DrvTileMap == NULL) { + draw_background(); + lwings_draw_sprites(); + draw_foreground(0x200); + } else { + trojan_draw_background2(); + trojan_draw_background(0); + trojan_draw_sprites(); + trojan_draw_background(1); + draw_foreground(0x300); + } + + if (flipscreen) { + UINT16 *ptr = pTransDraw + (nScreenWidth * nScreenHeight) - 1; + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight / 2; i++, ptr--) + { + INT32 n = pTransDraw[i]; + pTransDraw[i] = *ptr; + *ptr = n; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInp, 0xff, 3); + + for (INT32 i = 0; i < 8; i++) { + DrvInp[0] ^= (DrvJoy1[i] & 1) << i; + DrvInp[1] ^= (DrvJoy2[i] & 1) << i; + DrvInp[2] ^= (DrvJoy3[i] & 1) << i; + } + + if ((DrvInp[1] & 0x03) == 0) DrvInp[1] |= 0x03; + if ((DrvInp[1] & 0x0c) == 0) DrvInp[1] |= 0x0c; + if ((DrvInp[2] & 0x03) == 0) DrvInp[2] |= 0x03; + if ((DrvInp[2] & 0x0c) == 0) DrvInp[2] |= 0x0c; + } + + INT32 nInterleave; + INT32 MSMIRQSlice[67]; + + if (MSM5205InUse) { + nInterleave = MSM5205CalcInterleave(0, 6000000); + + for (INT32 i = 0; i < 67; i++) { + MSMIRQSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 68)); + } + } else { + nInterleave = 16; + } + + INT32 nCyclesDone[3] = { 0, 0, 0 }; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (interrupt_enable && i == (nInterleave - 1)) { + if (avengers & 1) { + ZetNmi(); + } else { + ZetSetVector(0xd7); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + } + if (MSM5205InUse) MSM5205Update(); + ZetClose(); + + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + if ((i % (nInterleave / 4)) == ((nInterleave / 4) - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + if (MSM5205InUse) { + nCurrentCPU = 2; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + for (INT32 j = 0; j < 67; j++) { + if (i == MSMIRQSlice[j]) { + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + nCyclesDone[nCurrentCPU] += ZetRun(1000); + } + } + ZetClose(); + } + } + + ZetOpen(1); + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + if (MSM5205InUse) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + memcpy (DrvSprBuf, DrvSprRAM, 0x200); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029692; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + if (MSM5205InUse) MSM5205Scan(nAction, pnMin); + + SCAN_VAR(interrupt_enable); + SCAN_VAR(soundlatch); + SCAN_VAR(soundlatch2); + SCAN_VAR(flipscreen); + SCAN_VAR(DrvZ80Bank); + + SCAN_VAR(*((UINT32*)avengers_param)); + SCAN_VAR(avengers_palette_pen); + SCAN_VAR(avengers_soundlatch2); + SCAN_VAR(avengers_soundstate); + SCAN_VAR(trojan_bg2_scrollx); + SCAN_VAR(trojan_bg2_image); + } + + ZetOpen(0); + lwings_bankswitch_w(DrvZ80Bank); + ZetClose(); + + return 0; +} + + +// Section Z (set 1) + +static struct BurnRomInfo sectionzRomDesc[] = { + { "6c_sz01.bin", 0x8000, 0x69585125, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "7c_sz02.bin", 0x8000, 0x22f161b8, 1 | BRF_PRG | BRF_ESS }, // 1 + { "9c_sz03.bin", 0x8000, 0x4c7111ed, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "11e_sz04.bin", 0x8000, 0xa6073566, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "9h_sz05.bin", 0x4000, 0x3173ba2e, 4 | BRF_GRA }, // 4 Characters + + { "3e_sz14.bin", 0x8000, 0x63782e30, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles + { "1e_sz08.bin", 0x8000, 0xd57d9f13, 5 | BRF_GRA }, // 6 + { "3d_sz13.bin", 0x8000, 0x1b3d4d7f, 5 | BRF_GRA }, // 7 + { "1d_sz07.bin", 0x8000, 0xf5b3a29f, 5 | BRF_GRA }, // 8 + { "3b_sz12.bin", 0x8000, 0x11d47dfd, 5 | BRF_GRA }, // 9 + { "1b_sz06.bin", 0x8000, 0xdf703b68, 5 | BRF_GRA }, // 10 + { "3f_sz15.bin", 0x8000, 0x36bb9bf7, 5 | BRF_GRA }, // 11 + { "1f_sz09.bin", 0x8000, 0xda8f06c9, 5 | BRF_GRA }, // 12 + + { "3j_sz17.bin", 0x8000, 0x8df7b24a, 6 | BRF_GRA }, // 13 Sprites + { "1j_sz11.bin", 0x8000, 0x685d4c54, 6 | BRF_GRA }, // 14 + { "3h_sz16.bin", 0x8000, 0x500ff2bb, 6 | BRF_GRA }, // 15 + { "1h_sz10.bin", 0x8000, 0x00b3d244, 6 | BRF_GRA }, // 16 + + { "mb7114e.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) +}; + +STD_ROM_PICK(sectionz) +STD_ROM_FN(sectionz) + +struct BurnDriver BurnDrvSectionz = { + "sectionz", NULL, NULL, NULL, "1985", + "Section Z (set 1)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_HORSHOOT, 0, + NULL, sectionzRomInfo, sectionzRomName, NULL, NULL, DrvInputInfo, SectionzDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 240, 4, 3 +}; + + +// Section Z (set 2) + +static struct BurnRomInfo sctionzaRomDesc[] = { + { "sz-01a.bin", 0x8000, 0x98df49fd, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "7c_sz02.bin", 0x8000, 0x22f161b8, 1 | BRF_PRG | BRF_ESS }, // 1 + { "sz-03j.bin", 0x8000, 0x94547abf, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "11e_sz04.bin", 0x8000, 0xa6073566, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "9h_sz05.bin", 0x4000, 0x3173ba2e, 4 | BRF_GRA }, // 4 Characters + + { "3e_sz14.bin", 0x8000, 0x63782e30, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles + { "1e_sz08.bin", 0x8000, 0xd57d9f13, 5 | BRF_GRA }, // 6 + { "3d_sz13.bin", 0x8000, 0x1b3d4d7f, 5 | BRF_GRA }, // 7 + { "1d_sz07.bin", 0x8000, 0xf5b3a29f, 5 | BRF_GRA }, // 8 + { "3b_sz12.bin", 0x8000, 0x11d47dfd, 5 | BRF_GRA }, // 9 + { "1b_sz06.bin", 0x8000, 0xdf703b68, 5 | BRF_GRA }, // 10 + { "3f_sz15.bin", 0x8000, 0x36bb9bf7, 5 | BRF_GRA }, // 11 + { "1f_sz09.bin", 0x8000, 0xda8f06c9, 5 | BRF_GRA }, // 12 + + { "3j_sz17.bin", 0x8000, 0x8df7b24a, 6 | BRF_GRA }, // 13 Sprites + { "1j_sz11.bin", 0x8000, 0x685d4c54, 6 | BRF_GRA }, // 14 + { "3h_sz16.bin", 0x8000, 0x500ff2bb, 6 | BRF_GRA }, // 15 + { "1h_sz10.bin", 0x8000, 0x00b3d244, 6 | BRF_GRA }, // 16 + + { "mb7114e.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) +}; + +STD_ROM_PICK(sctionza) +STD_ROM_FN(sctionza) + +struct BurnDriver BurnDrvSctionza = { + "sectionza", "sectionz", NULL, NULL, "1985", + "Section Z (set 2)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_HORSHOOT, 0, + NULL, sctionzaRomInfo, sctionzaRomName, NULL, NULL, DrvInputInfo, SectionzDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 240, 4, 3 +}; + + +// Legendary Wings (US set 1) + +static struct BurnRomInfo lwingsRomDesc[] = { + { "6c_lw01.bin", 0x8000, 0xb55a7f60, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "7c_lw02.bin", 0x8000, 0xa5efbb1b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "9c_lw03.bin", 0x8000, 0xec5cc201, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "11e_lw04.bin", 0x8000, 0xa20337a2, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "9h_lw05.bin", 0x4000, 0x091d923c, 4 | BRF_GRA }, // 4 Characters + + { "3e_lw14.bin", 0x8000, 0x5436392c, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles + { "1e_lw08.bin", 0x8000, 0xb491bbbb, 5 | BRF_GRA }, // 6 + { "3d_lw13.bin", 0x8000, 0xfdd1908a, 5 | BRF_GRA }, // 7 + { "1d_lw07.bin", 0x8000, 0x5c73d406, 5 | BRF_GRA }, // 8 + { "3b_lw12.bin", 0x8000, 0x32e17b3c, 5 | BRF_GRA }, // 9 + { "1b_lw06.bin", 0x8000, 0x52e533c1, 5 | BRF_GRA }, // 10 + { "3f_lw15.bin", 0x8000, 0x99e134ba, 5 | BRF_GRA }, // 11 + { "1f_lw09.bin", 0x8000, 0xc8f28777, 5 | BRF_GRA }, // 12 + + { "3j_lw17.bin", 0x8000, 0x5ed1bc9b, 6 | BRF_GRA }, // 13 Sprites + { "1j_lw11.bin", 0x8000, 0x2a0790d6, 6 | BRF_GRA }, // 14 + { "3h_lw16.bin", 0x8000, 0xe8834006, 6 | BRF_GRA }, // 15 + { "1h_lw10.bin", 0x8000, 0xb693f5a5, 6 | BRF_GRA }, // 16 + + { "63s141.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) +}; + +STD_ROM_PICK(lwings) +STD_ROM_FN(lwings) + +struct BurnDriver BurnDrvLwings = { + "lwings", NULL, NULL, NULL, "1986", + "Legendary Wings (US set 1)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, lwingsRomInfo, lwingsRomName, NULL, NULL, DrvInputInfo, LwingsDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 256, 3, 4 +}; + + +// Legendary Wings (US set 2) + +static struct BurnRomInfo lwings2RomDesc[] = { + { "u13-l", 0x8000, 0x3069c01c, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "u14-k", 0x8000, 0x5d91c828, 1 | BRF_PRG | BRF_ESS }, // 1 + { "9c_lw03.bin", 0x8000, 0xec5cc201, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "11e_lw04.bin", 0x8000, 0xa20337a2, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "9h_lw05.bin", 0x4000, 0x091d923c, 4 | BRF_GRA }, // 4 Characters + + { "b_03e.rom", 0x8000, 0x176e3027, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles + { "b_01e.rom", 0x8000, 0xf5d25623, 5 | BRF_GRA }, // 6 + { "b_03d.rom", 0x8000, 0x001caa35, 5 | BRF_GRA }, // 7 + { "b_01d.rom", 0x8000, 0x0ba008c3, 5 | BRF_GRA }, // 8 + { "b_03b.rom", 0x8000, 0x4f8182e9, 5 | BRF_GRA }, // 9 + { "b_01b.rom", 0x8000, 0xf1617374, 5 | BRF_GRA }, // 10 + { "b_03f.rom", 0x8000, 0x9b374dcc, 5 | BRF_GRA }, // 11 + { "b_01f.rom", 0x8000, 0x23654e0a, 5 | BRF_GRA }, // 12 + + { "b_03j.rom", 0x8000, 0x8f3c763a, 6 | BRF_GRA }, // 13 Sprites + { "b_01j.rom", 0x8000, 0x7cc90a1d, 6 | BRF_GRA }, // 14 + { "b_03h.rom", 0x8000, 0x7d58f532, 6 | BRF_GRA }, // 15 + { "b_01h.rom", 0x8000, 0x3e396eda, 6 | BRF_GRA }, // 16 + + { "63s141.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) +}; + +STD_ROM_PICK(lwings2) +STD_ROM_FN(lwings2) + +struct BurnDriver BurnDrvLwings2 = { + "lwings2", "lwings", NULL, NULL, "1986", + "Legendary Wings (US set 2)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, lwings2RomInfo, lwings2RomName, NULL, NULL, DrvInputInfo, LwingsDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 256, 3, 4 +}; + + +// Ares no Tsubasa (Japan) + +static struct BurnRomInfo lwingsjpRomDesc[] = { + { "a_06c.rom", 0x8000, 0x2068a738, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "a_07c.rom", 0x8000, 0xd6a2edc4, 1 | BRF_PRG | BRF_ESS }, // 1 + { "9c_lw03.bin", 0x8000, 0xec5cc201, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "11e_lw04.bin", 0x8000, 0xa20337a2, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "9h_lw05.bin", 0x4000, 0x091d923c, 4 | BRF_GRA }, // 4 Characters + + { "b_03e.rom", 0x8000, 0x176e3027, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles + { "b_01e.rom", 0x8000, 0xf5d25623, 5 | BRF_GRA }, // 6 + { "b_03d.rom", 0x8000, 0x001caa35, 5 | BRF_GRA }, // 7 + { "b_01d.rom", 0x8000, 0x0ba008c3, 5 | BRF_GRA }, // 8 + { "b_03b.rom", 0x8000, 0x4f8182e9, 5 | BRF_GRA }, // 9 + { "b_01b.rom", 0x8000, 0xf1617374, 5 | BRF_GRA }, // 10 + { "b_03f.rom", 0x8000, 0x9b374dcc, 5 | BRF_GRA }, // 11 + { "b_01f.rom", 0x8000, 0x23654e0a, 5 | BRF_GRA }, // 12 + + { "b_03j.rom", 0x8000, 0x8f3c763a, 6 | BRF_GRA }, // 13 Sprites + { "b_01j.rom", 0x8000, 0x7cc90a1d, 6 | BRF_GRA }, // 14 + { "b_03h.rom", 0x8000, 0x7d58f532, 6 | BRF_GRA }, // 15 + { "b_01h.rom", 0x8000, 0x3e396eda, 6 | BRF_GRA }, // 16 + + { "63s141.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) +}; + +STD_ROM_PICK(lwingsjp) +STD_ROM_FN(lwingsjp) + +struct BurnDriver BurnDrvLwingsjp = { + "lwingsj", "lwings", NULL, NULL, "1986", + "Ares no Tsubasa (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, lwingsjpRomInfo, lwingsjpRomName, NULL, NULL, DrvInputInfo, LwingsDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 256, 3, 4 +}; + + +// Legendary Wings (bootleg) + +static struct BurnRomInfo lwingsbRomDesc[] = { + { "ic17.bin", 0x8000, 0xfe8a8823, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "ic18.bin", 0x8000, 0x2a00cde8, 1 | BRF_PRG | BRF_ESS }, // 1 + { "ic19.bin", 0x8000, 0xec5cc201, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "ic37.bin", 0x8000, 0xa20337a2, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "ic60.bin", 0x4000, 0x091d923c, 4 | BRF_GRA }, // 4 Characters + + { "ic50.bin", 0x8000, 0x5436392c, 5 | BRF_GRA }, // 5 Background Layer 1 Tiles + { "ic49.bin", 0x8000, 0xffdbdd69, 5 | BRF_GRA }, // 6 + { "ic26.bin", 0x8000, 0xfdd1908a, 5 | BRF_GRA }, // 7 + { "ic25.bin", 0x8000, 0x5c73d406, 5 | BRF_GRA }, // 8 + { "ic2.bin", 0x8000, 0x32e17b3c, 5 | BRF_GRA }, // 9 + { "ic1.bin", 0x8000, 0x52e533c1, 5 | BRF_GRA }, // 10 + { "ic63.bin", 0x8000, 0x99e134ba, 5 | BRF_GRA }, // 11 + { "ic62.bin", 0x8000, 0xc8f28777, 5 | BRF_GRA }, // 12 + + { "ic99.bin", 0x8000, 0x163946da, 6 | BRF_GRA }, // 13 Sprites + { "ic98.bin", 0x8000, 0x7cc90a1d, 6 | BRF_GRA }, // 14 + { "ic87.bin", 0x8000, 0xbca275ac, 6 | BRF_GRA }, // 15 + { "ic86.bin", 0x8000, 0x3e396eda, 6 | BRF_GRA }, // 16 + + { "63s141.15g", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 17 Proms (not used) +}; + +STD_ROM_PICK(lwingsb) +STD_ROM_FN(lwingsb) + +struct BurnDriver BurnDrvLwingsb = { + "lwingsb", "lwings", NULL, NULL, "1986", + "Legendary Wings (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, lwingsbRomInfo, lwingsbRomName, NULL, NULL, DrvInputInfo, LwingsbDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 256, 3, 4 +}; + + +// Trojan (US set 1) + +static struct BurnRomInfo trojanRomDesc[] = { + { "t4.10n", 0x8000, 0xc1bbeb4e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "t6.13n", 0x8000, 0xd49592ef, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tb05.12n", 0x8000, 0x9273b264, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "tb02.15h", 0x8000, 0x21154797, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "tb01.6d", 0x4000, 0x1c0f91b2, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code + + { "tb03.8k", 0x4000, 0x581a2b4c, 4 | BRF_GRA }, // 5 Characters + + { "tb13.6b", 0x8000, 0x285a052b, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles + { "tb09.6a", 0x8000, 0xaeb693f7, 5 | BRF_GRA }, // 7 + { "tb12.4b", 0x8000, 0xdfb0fe5c, 5 | BRF_GRA }, // 8 + { "tb08.4a", 0x8000, 0xd3a4c9d1, 5 | BRF_GRA }, // 9 + { "tb11.3b", 0x8000, 0x00f0f4fd, 5 | BRF_GRA }, // 10 + { "tb07.3a", 0x8000, 0xdff2ee02, 5 | BRF_GRA }, // 11 + { "tb14.8b", 0x8000, 0x14bfac18, 5 | BRF_GRA }, // 12 + { "tb10.8a", 0x8000, 0x71ba8a6d, 5 | BRF_GRA }, // 13 + + { "tb18.7l", 0x8000, 0x862c4713, 6 | BRF_GRA }, // 14 Sprites + { "tb16.3l", 0x8000, 0xd86f8cbd, 6 | BRF_GRA }, // 15 + { "tb17.5l", 0x8000, 0x12a73b3f, 6 | BRF_GRA }, // 16 + { "tb15.2l", 0x8000, 0xbb1a2769, 6 | BRF_GRA }, // 17 + { "tb22.7n", 0x8000, 0x39daafd4, 6 | BRF_GRA }, // 18 + { "tb20.3n", 0x8000, 0x94615d2a, 6 | BRF_GRA }, // 19 + { "tb21.5n", 0x8000, 0x66c642bd, 6 | BRF_GRA }, // 20 + { "tb19.2n", 0x8000, 0x81d5ab36, 6 | BRF_GRA }, // 21 + + { "tb25.15n", 0x8000, 0x6e38c6fa, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles + { "tb24.13n", 0x8000, 0x14fc6cf2, 7 | BRF_GRA }, // 23 + + { "tb23.9n", 0x8000, 0xeda13c0e, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map + + { "tbp24s10.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) + { "mb7114e.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 +}; + +STD_ROM_PICK(trojan) +STD_ROM_FN(trojan) + +struct BurnDriver BurnDrvTrojan = { + "trojan", NULL, NULL, NULL, "1986", + "Trojan (US set 1)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, + NULL, trojanRomInfo, trojanRomName, NULL, NULL, DrvInputInfo, TrojanlsDIPInfo, + TrojanInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 240, 4, 3 +}; + + +// Trojan (US set 2) + +static struct BurnRomInfo trojanaRomDesc[] = { + { "tb4.10n", 0x8000, 0x0113a551, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "tb6.13n", 0x8000, 0xaa127a5b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tb05.12n", 0x8000, 0x9273b264, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "tb02.15h", 0x8000, 0x21154797, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "tb01.6d", 0x4000, 0x1c0f91b2, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code + + { "tb03.8k", 0x4000, 0x581a2b4c, 4 | BRF_GRA }, // 5 Characters + + { "tb13.6b", 0x8000, 0x285a052b, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles + { "tb09.6a", 0x8000, 0xaeb693f7, 5 | BRF_GRA }, // 7 + { "tb12.4b", 0x8000, 0xdfb0fe5c, 5 | BRF_GRA }, // 8 + { "tb08.4a", 0x8000, 0xd3a4c9d1, 5 | BRF_GRA }, // 9 + { "tb11.3b", 0x8000, 0x00f0f4fd, 5 | BRF_GRA }, // 10 + { "tb07.3a", 0x8000, 0xdff2ee02, 5 | BRF_GRA }, // 11 + { "tb14.8b", 0x8000, 0x14bfac18, 5 | BRF_GRA }, // 12 + { "tb10.8a", 0x8000, 0x71ba8a6d, 5 | BRF_GRA }, // 13 + + { "tb18.7l", 0x8000, 0x862c4713, 6 | BRF_GRA }, // 14 Sprites + { "tb16.3l", 0x8000, 0xd86f8cbd, 6 | BRF_GRA }, // 15 + { "tb17.5l", 0x8000, 0x12a73b3f, 6 | BRF_GRA }, // 16 + { "tb15.2l", 0x8000, 0xbb1a2769, 6 | BRF_GRA }, // 17 + { "tb22.7n", 0x8000, 0x39daafd4, 6 | BRF_GRA }, // 18 + { "tb20.3n", 0x8000, 0x94615d2a, 6 | BRF_GRA }, // 19 + { "tb21.5n", 0x8000, 0x66c642bd, 6 | BRF_GRA }, // 20 + { "tb19.2n", 0x8000, 0x81d5ab36, 6 | BRF_GRA }, // 21 + + { "tb25.15n", 0x8000, 0x6e38c6fa, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles + { "tb24.13n", 0x8000, 0x14fc6cf2, 7 | BRF_GRA }, // 23 + + { "tb23.9n", 0x8000, 0xeda13c0e, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map + + { "tbp24s10.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) + { "mb7114e.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 +}; + +STD_ROM_PICK(trojana) +STD_ROM_FN(trojana) + +struct BurnDriver BurnDrvTrojana = { + "trojana", "trojan", NULL, NULL, "1986", + "Trojan (US set 2)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, + NULL, trojanaRomInfo, trojanaRomName, NULL, NULL, DrvInputInfo, TrojanlsDIPInfo, + TrojanInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 240, 4, 3 +}; + + +// Trojan (Romstar) + +static struct BurnRomInfo trojanrRomDesc[] = { + { "tb04.10n", 0x8000, 0x92670f27, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "tb06.13n", 0x8000, 0xa4951173, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tb05.12n", 0x8000, 0x9273b264, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "tb02.15h", 0x8000, 0x21154797, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "tb01.6d", 0x4000, 0x1c0f91b2, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code + + { "tb03.8k", 0x4000, 0x581a2b4c, 4 | BRF_GRA }, // 5 Characters + + { "tb13.6b", 0x8000, 0x285a052b, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles + { "tb09.6a", 0x8000, 0xaeb693f7, 5 | BRF_GRA }, // 7 + { "tb12.4b", 0x8000, 0xdfb0fe5c, 5 | BRF_GRA }, // 8 + { "tb08.4a", 0x8000, 0xd3a4c9d1, 5 | BRF_GRA }, // 9 + { "tb11.3b", 0x8000, 0x00f0f4fd, 5 | BRF_GRA }, // 10 + { "tb07.3a", 0x8000, 0xdff2ee02, 5 | BRF_GRA }, // 11 + { "tb14.8b", 0x8000, 0x14bfac18, 5 | BRF_GRA }, // 12 + { "tb10.8a", 0x8000, 0x71ba8a6d, 5 | BRF_GRA }, // 13 + + { "tb18.7l", 0x8000, 0x862c4713, 6 | BRF_GRA }, // 14 Sprites + { "tb16.3l", 0x8000, 0xd86f8cbd, 6 | BRF_GRA }, // 15 + { "tb17.5l", 0x8000, 0x12a73b3f, 6 | BRF_GRA }, // 16 + { "tb15.2l", 0x8000, 0xbb1a2769, 6 | BRF_GRA }, // 17 + { "tb22.7n", 0x8000, 0x39daafd4, 6 | BRF_GRA }, // 18 + { "tb20.3n", 0x8000, 0x94615d2a, 6 | BRF_GRA }, // 19 + { "tb21.5n", 0x8000, 0x66c642bd, 6 | BRF_GRA }, // 20 + { "tb19.2n", 0x8000, 0x81d5ab36, 6 | BRF_GRA }, // 21 + + { "tb25.15n", 0x8000, 0x6e38c6fa, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles + { "tb24.13n", 0x8000, 0x14fc6cf2, 7 | BRF_GRA }, // 23 + + { "tb23.9n", 0x8000, 0xeda13c0e, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map + + { "tbp24s10.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) + { "mb7114e.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 +}; + +STD_ROM_PICK(trojanr) +STD_ROM_FN(trojanr) + +struct BurnDriver BurnDrvTrojanr = { + "trojanr", "trojan", NULL, NULL, "1986", + "Trojan (Romstar)\0", NULL, "Capcom (Romstar license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, + NULL, trojanrRomInfo, trojanrRomName, NULL, NULL, DrvInputInfo, TrojanDIPInfo, + TrojanInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 240, 4, 3 +}; + + +// Tatakai no Banka (Japan) + +static struct BurnRomInfo trojanjRomDesc[] = { + { "troj-04.10n", 0x8000, 0x0b5a7f49, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "troj-06.13n", 0x8000, 0xdee6ed92, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tb05.12n", 0x8000, 0x9273b264, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "tb02.15h", 0x8000, 0x21154797, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "tb01.6d", 0x4000, 0x1c0f91b2, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code + + { "tb03.8k", 0x4000, 0x581a2b4c, 4 | BRF_GRA }, // 5 Characters + + { "tb13.6b", 0x8000, 0x285a052b, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles + { "tb09.6a", 0x8000, 0xaeb693f7, 5 | BRF_GRA }, // 7 + { "tb12.4b", 0x8000, 0xdfb0fe5c, 5 | BRF_GRA }, // 8 + { "tb08.4a", 0x8000, 0xd3a4c9d1, 5 | BRF_GRA }, // 9 + { "tb11.3b", 0x8000, 0x00f0f4fd, 5 | BRF_GRA }, // 10 + { "tb07.3a", 0x8000, 0xdff2ee02, 5 | BRF_GRA }, // 11 + { "tb14.8b", 0x8000, 0x14bfac18, 5 | BRF_GRA }, // 12 + { "tb10.8a", 0x8000, 0x71ba8a6d, 5 | BRF_GRA }, // 13 + + { "tb18.7l", 0x8000, 0x862c4713, 6 | BRF_GRA }, // 14 Sprites + { "tb16.3l", 0x8000, 0xd86f8cbd, 6 | BRF_GRA }, // 15 + { "tb17.5l", 0x8000, 0x12a73b3f, 6 | BRF_GRA }, // 16 + { "tb15.2l", 0x8000, 0xbb1a2769, 6 | BRF_GRA }, // 17 + { "tb22.7n", 0x8000, 0x39daafd4, 6 | BRF_GRA }, // 18 + { "tb20.3n", 0x8000, 0x94615d2a, 6 | BRF_GRA }, // 19 + { "tb21.5n", 0x8000, 0x66c642bd, 6 | BRF_GRA }, // 20 + { "tb19.2n", 0x8000, 0x81d5ab36, 6 | BRF_GRA }, // 21 + + { "tb25.15n", 0x8000, 0x6e38c6fa, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles + { "tb24.13n", 0x8000, 0x14fc6cf2, 7 | BRF_GRA }, // 23 + + { "tb23.9n", 0x8000, 0xeda13c0e, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map + + { "tbp24s10.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) + { "mb7114e.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 +}; + +STD_ROM_PICK(trojanj) +STD_ROM_FN(trojanj) + +struct BurnDriver BurnDrvTrojanj = { + "trojanj", "trojan", NULL, NULL, "1986", + "Tatakai no Banka (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_PLATFORM | GBF_SCRFIGHT, 0, + NULL, trojanjRomInfo, trojanjRomName, NULL, NULL, DrvInputInfo, TrojanDIPInfo, + TrojanInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 240, 4, 3 +}; + + +// Avengers (US set 1) + +static struct BurnRomInfo avengersRomDesc[] = { + { "04.10n", 0x8000, 0xa94aadcc, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "06.13n", 0x8000, 0x39cd80bd, 1 | BRF_PRG | BRF_ESS }, // 1 + { "05.12n", 0x8000, 0x06b1cec9, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "02.15h", 0x8000, 0x107a2e17, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "01.6d", 0x8000, 0xc1e5d258, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code + + { "03.8k", 0x8000, 0xefb5883e, 4 | BRF_GRA }, // 5 Characters + + { "13.6b", 0x8000, 0x9b5ff305, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles + { "09.6a", 0x8000, 0x08323355, 5 | BRF_GRA }, // 7 + { "12.4b", 0x8000, 0x6d5261ba, 5 | BRF_GRA }, // 8 + { "08.4a", 0x8000, 0xa13d9f54, 5 | BRF_GRA }, // 9 + { "11.3b", 0x8000, 0xa2911d8b, 5 | BRF_GRA }, // 10 + { "07.3a", 0x8000, 0xcde78d32, 5 | BRF_GRA }, // 11 + { "14.8b", 0x8000, 0x44ac2671, 5 | BRF_GRA }, // 12 + { "10.8a", 0x8000, 0xb1a717cb, 5 | BRF_GRA }, // 13 + + { "18.7l", 0x8000, 0x3c876a17, 6 | BRF_GRA }, // 14 Sprites + { "16.3l", 0x8000, 0x4b1ff3ac, 6 | BRF_GRA }, // 15 + { "17.5l", 0x8000, 0x4eb543ef, 6 | BRF_GRA }, // 16 + { "15.2l", 0x8000, 0x8041de7f, 6 | BRF_GRA }, // 17 + { "22.7n", 0x8000, 0xbdaa8b22, 6 | BRF_GRA }, // 18 + { "20.3n", 0x8000, 0x566e3059, 6 | BRF_GRA }, // 19 + { "21.5n", 0x8000, 0x301059aa, 6 | BRF_GRA }, // 20 + { "19.2n", 0x8000, 0xa00485ec, 6 | BRF_GRA }, // 21 + + { "25.15n", 0x8000, 0x230d9e30, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles + { "24.13n", 0x8000, 0xa6354024, 7 | BRF_GRA }, // 23 + + { "23.9n", 0x8000, 0xc0a93ef6, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map + + { "tbb_2bpr.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) + { "tbb_1bpr.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 +}; + +STD_ROM_PICK(avengers) +STD_ROM_FN(avengers) + +static INT32 AvengersInit() +{ + avengers = 1; + + return TrojanInit(); +} + +struct BurnDriver BurnDrvAvengers = { + "avengers", NULL, NULL, NULL, "1987", + "Avengers (US set 1)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT, 0, + NULL, avengersRomInfo, avengersRomName, NULL, NULL, DrvInputInfo, AvengersDIPInfo, + AvengersInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 256, 3, 4 +}; + + +// Avengers (US set 2) + +static struct BurnRomInfo avenger2RomDesc[] = { + { "avg4.bin", 0x8000, 0x0fea7ac5, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "av_06a.13n", 0x8000, 0x491a712c, 1 | BRF_PRG | BRF_ESS }, // 1 + { "av_05.12n", 0x8000, 0x9a214b42, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "02.15h", 0x8000, 0x107a2e17, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "01.6d", 0x8000, 0xc1e5d258, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code + + { "03.8k", 0x8000, 0xefb5883e, 4 | BRF_GRA }, // 5 Characters + + { "13.6b", 0x8000, 0x9b5ff305, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles + { "09.6a", 0x8000, 0x08323355, 5 | BRF_GRA }, // 7 + { "12.4b", 0x8000, 0x6d5261ba, 5 | BRF_GRA }, // 8 + { "08.4a", 0x8000, 0xa13d9f54, 5 | BRF_GRA }, // 9 + { "11.3b", 0x8000, 0xa2911d8b, 5 | BRF_GRA }, // 10 + { "07.3a", 0x8000, 0xcde78d32, 5 | BRF_GRA }, // 11 + { "14.8b", 0x8000, 0x44ac2671, 5 | BRF_GRA }, // 12 + { "10.8a", 0x8000, 0xb1a717cb, 5 | BRF_GRA }, // 13 + + { "18.7l", 0x8000, 0x3c876a17, 6 | BRF_GRA }, // 14 Sprites + { "16.3l", 0x8000, 0x4b1ff3ac, 6 | BRF_GRA }, // 15 + { "17.5l", 0x8000, 0x4eb543ef, 6 | BRF_GRA }, // 16 + { "15.2l", 0x8000, 0x8041de7f, 6 | BRF_GRA }, // 17 + { "22.7n", 0x8000, 0xbdaa8b22, 6 | BRF_GRA }, // 18 + { "20.3n", 0x8000, 0x566e3059, 6 | BRF_GRA }, // 19 + { "21.5n", 0x8000, 0x301059aa, 6 | BRF_GRA }, // 20 + { "19.2n", 0x8000, 0xa00485ec, 6 | BRF_GRA }, // 21 + + { "25.15n", 0x8000, 0x230d9e30, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles + { "24.13n", 0x8000, 0xa6354024, 7 | BRF_GRA }, // 23 + + { "23.9n", 0x8000, 0xc0a93ef6, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map + + { "tbb_2bpr.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) + { "tbb_1bpr.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 +}; + +STD_ROM_PICK(avenger2) +STD_ROM_FN(avenger2) + +struct BurnDriver BurnDrvAvenger2 = { + "avengers2", "avengers", NULL, NULL, "1987", + "Avengers (US set 2)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT, 0, + NULL, avenger2RomInfo, avenger2RomName, NULL, NULL, DrvInputInfo, AvengersDIPInfo, + AvengersInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 256, 3, 4 +}; + + +// Hissatsu Buraiken (Japan) + +static struct BurnRomInfo buraikenRomDesc[] = { + { "av_04a.10n", 0x8000, 0x361fc614, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "av_06a.13n", 0x8000, 0x491a712c, 1 | BRF_PRG | BRF_ESS }, // 1 + { "av_05.12n", 0x8000, 0x9a214b42, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "02.15h", 0x8000, 0x107a2e17, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "01.6d", 0x8000, 0xc1e5d258, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code + + { "03.8k", 0x8000, 0xefb5883e, 4 | BRF_GRA }, // 5 Characters + + { "13.6b", 0x8000, 0x9b5ff305, 5 | BRF_GRA }, // 6 Background Layer 1 Tiles + { "09.6a", 0x8000, 0x08323355, 5 | BRF_GRA }, // 7 + { "12.4b", 0x8000, 0x6d5261ba, 5 | BRF_GRA }, // 8 + { "08.4a", 0x8000, 0xa13d9f54, 5 | BRF_GRA }, // 9 + { "11.3b", 0x8000, 0xa2911d8b, 5 | BRF_GRA }, // 10 + { "07.3a", 0x8000, 0xcde78d32, 5 | BRF_GRA }, // 11 + { "14.8b", 0x8000, 0x44ac2671, 5 | BRF_GRA }, // 12 + { "10.8a", 0x8000, 0xb1a717cb, 5 | BRF_GRA }, // 13 + + { "18.7l", 0x8000, 0x3c876a17, 6 | BRF_GRA }, // 14 Sprites + { "16.3l", 0x8000, 0x4b1ff3ac, 6 | BRF_GRA }, // 15 + { "17.5l", 0x8000, 0x4eb543ef, 6 | BRF_GRA }, // 16 + { "15.2l", 0x8000, 0x8041de7f, 6 | BRF_GRA }, // 17 + { "22.7n", 0x8000, 0xbdaa8b22, 6 | BRF_GRA }, // 18 + { "20.3n", 0x8000, 0x566e3059, 6 | BRF_GRA }, // 19 + { "21.5n", 0x8000, 0x301059aa, 6 | BRF_GRA }, // 20 + { "19.2n", 0x8000, 0xa00485ec, 6 | BRF_GRA }, // 21 + + { "av_25.15n", 0x8000, 0x88a505a7, 7 | BRF_GRA }, // 22 Background Layer 2 Tiles + { "av_24.13n", 0x8000, 0x1f4463c8, 7 | BRF_GRA }, // 23 + + { "23.9n", 0x8000, 0xc0a93ef6, 8 | BRF_GRA }, // 24 Background Layer 2 Tile Map + + { "tbb_2bpr.7j", 0x0100, 0xd96bcc98, 0 | BRF_OPT }, // 25 Proms (not used) + { "tbb_1bpr.1e", 0x0100, 0x5052fa9d, 0 | BRF_OPT }, // 26 +}; + +STD_ROM_PICK(buraiken) +STD_ROM_FN(buraiken) + +struct BurnDriver BurnDrvBuraiken = { + "buraiken", "avengers", NULL, NULL, "1987", + "Hissatsu Buraiken (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT, 0, + NULL, buraikenRomInfo, buraikenRomName, NULL, NULL, DrvInputInfo, AvengersDIPInfo, + AvengersInit, TrojanExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_madgear.cpp b/src/burn/drv/pre90s/d_madgear.cpp index 6d378367f..741d2fa5c 100644 --- a/src/burn/drv/pre90s/d_madgear.cpp +++ b/src/burn/drv/pre90s/d_madgear.cpp @@ -1,1942 +1,1938 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2203.h" -#include "msm6295.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[3] = {0, 0, 0}; -static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Drv68KRom = NULL; -static UINT8 *Drv68KRam = NULL; -static UINT8 *DrvZ80Rom = NULL; -static UINT8 *DrvZ80Ram = NULL; -static UINT8 *DrvVideoRam = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvSpriteRamBuffer = NULL; -static UINT8 *DrvPaletteRam = NULL; -static UINT8 *DrvScroll1Ram = NULL; -static UINT8 *DrvScroll2Ram = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvBgTiles = NULL; -static UINT8 *DrvFgTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT16 DrvFgScrollX; -static UINT16 DrvFgScrollY; -static UINT16 DrvBgScrollX; -static UINT16 DrvBgScrollY; -static UINT8 DrvSpritePriMask; -static UINT8 DrvSpriteFlipYMask; -static UINT8 DrvZ80RomBank; -static UINT8 DrvSoundLatch; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 up" }, - {"Down" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 fire 1" }, - - {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort2 + 7, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo LastduelInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 up" }, - {"Down" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 down" }, - {"Left" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort2 + 5, "service" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort2 + 3, "diag" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Lastduel) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - } - - // Clear Opposites - DrvClearOpposites(&DrvInput[0]); - DrvClearOpposites(&DrvInput[1]); -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x10, 0x01, 0x80, 0x80, "Off" }, - {0x10, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Allow continue" }, - {0x11, 0x01, 0x01, 0x00, "No" }, - {0x11, 0x01, 0x01, 0x01, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x0c, 0x08, "Easy" }, - {0x11, 0x01, 0x0c, 0x0c, "Normal" }, - {0x11, 0x01, 0x0c, 0x04, "Difficult" }, - {0x11, 0x01, 0x0c, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 3 , "Cabinet" }, - {0x11, 0x01, 0x30, 0x30, "Upright (One Player)" }, - {0x11, 0x01, 0x30, 0x00, "Upright (Two Players)" }, - {0x11, 0x01, 0x30, 0x10, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x40, 0x00, "Off" }, - {0x11, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Background Music" }, - {0x11, 0x01, 0x80, 0x00, "Off" }, - {0x11, 0x01, 0x80, 0x80, "On" }, - - // Dip3 - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x12, 0x01, 0xf0, 0x20, "6 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x40, "5 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x50, "4 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x70, "3 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x10, "8 Coins 3 Plays" }, - {0x12, 0x01, 0xf0, 0x90, "2 Coins 1 Play" }, - {0x12, 0x01, 0xf0, 0x30, "5 Coins 3 Plays" }, - {0x12, 0x01, 0xf0, 0x60, "3 Coins 2 Plays" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 3 Plays" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Plays" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Plays" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Plays" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Plays" }, - {0x12, 0x01, 0xf0, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 15 , "Coin B" }, - {0x12, 0x01, 0x0f, 0x02, "6 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x04, "5 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x05, "4 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x07, "3 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x01, "8 Coins 3 Plays" }, - {0x12, 0x01, 0x0f, 0x09, "2 Coins 1 Play" }, - {0x12, 0x01, 0x0f, 0x03, "5 Coins 3 Plays" }, - {0x12, 0x01, 0x0f, 0x06, "3 Coins 2 Plays" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, -}; - -STDDIPINFO(Drv) - -static struct BurnDIPInfo LastduelDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "4 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x08, "3 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x10, "2 Coins 1 Play" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, - {0x13, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, - {0x13, 0x01, 0x38, 0x18, "1 Coin 6 Plays" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Normal" }, - {0x14, 0x01, 0x03, 0x01, "Difficult" }, - {0x14, 0x01, 0x03, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x20, "20000, 60000, 80000" }, - {0x14, 0x01, 0x30, 0x30, "30000, 80000, 80000" }, - {0x14, 0x01, 0x30, 0x10, "40000, 80000, 80000" }, - {0x14, 0x01, 0x30, 0x00, "40000, 80000, 100000" }, - - // Dip3 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x03, 0x03, "3" }, - {0x15, 0x01, 0x03, 0x02, "4" }, - {0x15, 0x01, 0x03, 0x01, "6" }, - {0x15, 0x01, 0x03, 0x00, "8" }, - - {0 , 0xfe, 0 , 2 , "Type" }, - {0x15, 0x01, 0x04, 0x04, "Car" }, - {0x15, 0x01, 0x04, 0x00, "Plane" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x20, 0x00, "Off" }, - {0x15, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow continue" }, - {0x15, 0x01, 0x40, 0x00, "No" }, - {0x15, 0x01, 0x40, 0x40, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - -}; - -STDDIPINFO(Lastduel) - -static struct BurnRomInfo DrvRomDesc[] = { - { "mg_04.8b", 0x20000, 0xb112257d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "mg_03.7b", 0x20000, 0xb2672465, BRF_ESS | BRF_PRG }, // 1 - { "mg_02.6b", 0x20000, 0x9f5ebe16, BRF_ESS | BRF_PRG }, // 2 - { "mg_01.5b", 0x20000, 0x1cea2af0, BRF_ESS | BRF_PRG }, // 3 - - { "mg_05.14j", 0x10000, 0x2fbfc945, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "mg_06.10k", 0x08000, 0x382ee59b, BRF_GRA }, // 5 Characters - - { "ls-12.7l", 0x40000, 0x6c1b2c6c, BRF_GRA }, // 6 BG Tiles - - { "ls-11.2l", 0x80000, 0x6bf81c64, BRF_GRA }, // 7 FG Tiles - - { "mg_m11.rom0", 0x10000, 0xee319a64, BRF_GRA }, // 8 Sprites - { "mg_m07.rom2", 0x10000, 0xe5c0b211, BRF_GRA }, // 9 - { "mg_m12.rom1", 0x10000, 0x887ef120, BRF_GRA }, // 10 - { "mg_m08.rom3", 0x10000, 0x59709aa3, BRF_GRA }, // 11 - { "mg_m13.rom0", 0x10000, 0xeae07db4, BRF_GRA }, // 12 - { "mg_m09.rom2", 0x10000, 0x40ee83eb, BRF_GRA }, // 13 - { "mg_m14.rom1", 0x10000, 0x21e5424c, BRF_GRA }, // 14 - { "mg_m10.rom3", 0x10000, 0xb64afb54, BRF_GRA }, // 15 - - { "ls-06.10e", 0x20000, 0x88d39a5b, BRF_SND }, // 16 Samples - { "ls-05.12e", 0x20000, 0xb06e03b5, BRF_SND }, // 17 - - { "29.14k", 0x00100, 0x7f862e1e, BRF_GRA }, // 18 PROM (Priority) -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo DrvjRomDesc[] = { - { "mdj_04.8b", 0x20000, 0x9ebbebb1, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "mdj_03.7b", 0x20000, 0xa5579c2d, BRF_ESS | BRF_PRG }, // 1 - { "mg_02.6b", 0x20000, 0x9f5ebe16, BRF_ESS | BRF_PRG }, // 2 - { "mg_01.5b", 0x20000, 0x1cea2af0, BRF_ESS | BRF_PRG }, // 3 - - { "mg_05.14j", 0x10000, 0x2fbfc945, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "mg_06.10k", 0x08000, 0x382ee59b, BRF_GRA }, // 5 Characters - - { "ls-12.7l", 0x40000, 0x6c1b2c6c, BRF_GRA }, // 6 BG Tiles - - { "ls-11.2l", 0x80000, 0x6bf81c64, BRF_GRA }, // 7 FG Tiles - - { "mg_m11.rom0", 0x10000, 0xee319a64, BRF_GRA }, // 8 Sprites - { "mg_m07.rom2", 0x10000, 0xe5c0b211, BRF_GRA }, // 9 - { "mg_m12.rom1", 0x10000, 0x887ef120, BRF_GRA }, // 10 - { "mg_m08.rom3", 0x10000, 0x59709aa3, BRF_GRA }, // 11 - { "mg_m13.rom0", 0x10000, 0xeae07db4, BRF_GRA }, // 12 - { "mg_m09.rom2", 0x10000, 0x40ee83eb, BRF_GRA }, // 13 - { "mg_m14.rom1", 0x10000, 0x21e5424c, BRF_GRA }, // 14 - { "mg_m10.rom3", 0x10000, 0xb64afb54, BRF_GRA }, // 15 - - { "ls-06.10e", 0x20000, 0x88d39a5b, BRF_SND }, // 16 Samples - { "ls-05.12e", 0x20000, 0xb06e03b5, BRF_SND }, // 17 - - { "29.14k", 0x00100, 0x7f862e1e, BRF_GRA }, // 18 PROM (Priority) -}; - -STD_ROM_PICK(Drvj) -STD_ROM_FN(Drvj) - -static struct BurnRomInfo DrvuRomDesc[] = { - { "mdu_04.8b", 0x20000, 0x7f7f8329, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "mdu_03.7b", 0x20000, 0x11fa542f, BRF_ESS | BRF_PRG }, // 1 - { "mde_02.6b", 0x20000, 0x9f5ebe16, BRF_ESS | BRF_PRG }, // 2 - { "mde_01.5b", 0x20000, 0x1cea2af0, BRF_ESS | BRF_PRG }, // 3 - - { "mde_05.14j", 0x10000, 0x2fbfc945, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "mdu_06.10k", 0x08000, 0x54bfdc02, BRF_GRA }, // 5 Characters - - { "ls-12.7l", 0x40000, 0x6c1b2c6c, BRF_GRA }, // 6 BG Tiles - - { "ls-11.2l", 0x80000, 0x6bf81c64, BRF_GRA }, // 7 FG Tiles - - { "11.rom0", 0x10000, 0xee319a64, BRF_GRA }, // 8 Sprites - { "07u.rom2", 0x10000, 0x7152b212, BRF_GRA }, // 9 - { "12.rom1", 0x10000, 0x887ef120, BRF_GRA }, // 10 - { "08u.rom3", 0x10000, 0x72e5d525, BRF_GRA }, // 11 - { "13.rom0", 0x10000, 0xeae07db4, BRF_GRA }, // 12 - { "09u.rom2", 0x10000, 0x7b5175cb, BRF_GRA }, // 13 - { "14.rom1", 0x10000, 0x21e5424c, BRF_GRA }, // 14 - { "10u.rom3", 0x10000, 0x6db7ca64, BRF_GRA }, // 15 - - { "ls-06.10e", 0x20000, 0x88d39a5b, BRF_SND }, // 16 Samples - { "ls-05.12e", 0x20000, 0xb06e03b5, BRF_SND }, // 17 - - { "29.14k", 0x00100, 0x7f862e1e, BRF_GRA }, // 18 PROM (Priority) -}; - -STD_ROM_PICK(Drvu) -STD_ROM_FN(Drvu) - -static struct BurnRomInfo Ledstrm2RomDesc[] = { - { "lsu-04.8b", 0x20000, 0x56a2f079, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "lsu-03.7b", 0x20000, 0x9b6408c0, BRF_ESS | BRF_PRG }, // 1 - { "ls-02.6b", 0x20000, 0x05c0285e, BRF_ESS | BRF_PRG }, // 2 - { "ls-01.5b", 0x20000, 0x8bf934dd, BRF_ESS | BRF_PRG }, // 3 - - { "ls-07.14j", 0x10000, 0x98af7838, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "ls-08.10k", 0x08000, 0x8803cf49, BRF_GRA }, // 5 Characters - - { "ls-12.7l", 0x40000, 0x6c1b2c6c, BRF_GRA }, // 6 BG Tiles - - { "ls-11.2l", 0x80000, 0x6bf81c64, BRF_GRA }, // 7 FG Tiles - - { "ls-09.5a", 0x40000, 0x80875e1d, BRF_GRA }, // 8 Sprites - { "ls-10.13a", 0x40000, 0xc5993f93, BRF_GRA }, // 9 - - { "ls-06.10e", 0x20000, 0x88d39a5b, BRF_SND }, // 10 Samples - { "ls-05.12e", 0x20000, 0xb06e03b5, BRF_SND }, // 11 - - { "29.14k", 0x00100, 0x7f862e1e, BRF_GRA }, // 12 PROM (Priority) -}; - -STD_ROM_PICK(Ledstrm2) -STD_ROM_FN(Ledstrm2) - -static struct BurnRomInfo LastduelRomDesc[] = { - { "ldu_06b.13k", 0x20000, 0x0e71acaf, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ldu_05b.12k", 0x20000, 0x47a85bea, BRF_ESS | BRF_PRG }, // 1 - { "ldu_04b.11k", 0x10000, 0xaa4bf001, BRF_ESS | BRF_PRG }, // 2 - { "ldu_03b.9k", 0x10000, 0xbbaac8ab, BRF_ESS | BRF_PRG }, // 3 - - { "ld_02.16h", 0x10000, 0x91834d0c, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "ld_01.12f", 0x08000, 0xad3c6f87, BRF_GRA }, // 5 Characters - - { "ld-15.6p", 0x20000, 0xd977a175, BRF_GRA }, // 6 BG Tiles - { "ld-13.6m", 0x20000, 0xbc25729f, BRF_GRA }, // 7 - - { "ld-14.15n", 0x80000, 0xd0653739, BRF_GRA }, // 8 FG Tiles - - { "ld-11.12b", 0x20000, 0x49d4dbbd, BRF_GRA }, // 9 Sprites - { "ld-09.12a", 0x20000, 0x6efadb74, BRF_GRA }, // 10 - { "ld-12.17b", 0x20000, 0x313e5338, BRF_GRA }, // 11 - { "ld-10.17a", 0x20000, 0xb8d3b2e3, BRF_GRA }, // 12 - - { "ld.3d", 0x00100, 0x729a1ddc, BRF_GRA }, // 13 PROM (Priority) -}; - -STD_ROM_PICK(Lastduel) -STD_ROM_FN(Lastduel) - -static struct BurnRomInfo LastdueloRomDesc[] = { - { "ldu_06.13k", 0x20000, 0x4228a00b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ldu_05.12k", 0x20000, 0x7260434f, BRF_ESS | BRF_PRG }, // 1 - { "ldu_04.11k", 0x10000, 0x429fb964, BRF_ESS | BRF_PRG }, // 2 - { "ldu_03.9k", 0x10000, 0x5aa4df72, BRF_ESS | BRF_PRG }, // 3 - - { "ld_02.16h", 0x10000, 0x91834d0c, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "ld_01.12f", 0x08000, 0xad3c6f87, BRF_GRA }, // 5 Characters - - { "ld-15.6p", 0x20000, 0xd977a175, BRF_GRA }, // 6 BG Tiles - { "ld-13.6m", 0x20000, 0xbc25729f, BRF_GRA }, // 7 - - { "ld-14.15n", 0x80000, 0xd0653739, BRF_GRA }, // 8 FG Tiles - - { "ld-11.12b", 0x20000, 0x49d4dbbd, BRF_GRA }, // 9 Sprites - { "ld-09.12a", 0x20000, 0x6efadb74, BRF_GRA }, // 10 - { "ld-12.17b", 0x20000, 0x313e5338, BRF_GRA }, // 11 - { "ld-10.17a", 0x20000, 0xb8d3b2e3, BRF_GRA }, // 12 - - { "ld.3d", 0x00100, 0x729a1ddc, BRF_GRA }, // 13 PROM (Priority) -}; - -STD_ROM_PICK(Lastduelo) -STD_ROM_FN(Lastduelo) - -static struct BurnRomInfo LastdueljRomDesc[] = { - { "ld_06.13k", 0x20000, 0x58a9e12b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ld_05.12k", 0x20000, 0x14685d78, BRF_ESS | BRF_PRG }, // 1 - { "ld_04.11k", 0x10000, 0xaa4bf001, BRF_ESS | BRF_PRG }, // 2 - { "ld_03.9k", 0x10000, 0xbbaac8ab, BRF_ESS | BRF_PRG }, // 3 - - { "ld_02.16h", 0x10000, 0x91834d0c, BRF_ESS | BRF_PRG }, // 4 Z80 Program - - { "ld_01.12f", 0x08000, 0xad3c6f87, BRF_GRA }, // 5 Characters - - { "ld-15.6p", 0x20000, 0xd977a175, BRF_GRA }, // 6 BG Tiles - { "ld-13.6m", 0x20000, 0xbc25729f, BRF_GRA }, // 7 - - { "ld-14.15n", 0x80000, 0xd0653739, BRF_GRA }, // 8 FG Tiles - - { "ld-11.12b", 0x20000, 0x49d4dbbd, BRF_GRA }, // 9 Sprites - { "ld-09.12a", 0x20000, 0x6efadb74, BRF_GRA }, // 10 - { "ld-12.17b", 0x20000, 0x313e5338, BRF_GRA }, // 11 - { "ld-10.17a", 0x20000, 0xb8d3b2e3, BRF_GRA }, // 12 - - { "ld.3d", 0x00100, 0x729a1ddc, BRF_GRA }, // 13 PROM (Priority) -}; - -STD_ROM_PICK(Lastduelj) -STD_ROM_FN(Lastduelj) - -static struct BurnRomInfo LastduelbRomDesc[] = { - { "ld_08.bin", 0x10000, 0x43811a96, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ld_07.bin", 0x10000, 0x63c30946, BRF_ESS | BRF_PRG }, // 1 - { "ld_04.bin", 0x10000, 0x46a4e0f8, BRF_ESS | BRF_PRG }, // 2 - { "ld_03.bin", 0x10000, 0x8d5f204a, BRF_ESS | BRF_PRG }, // 3 - { "ldu-04.rom", 0x10000, 0x429fb964, BRF_ESS | BRF_PRG }, // 4 - { "ldu-03.rom", 0x10000, 0x5aa4df72, BRF_ESS | BRF_PRG }, // 5 - - { "ld_02.bin", 0x10000, 0x91834d0c, BRF_ESS | BRF_PRG }, // 6 Z80 Program - - { "ld_01.bin", 0x08000, 0xad3c6f87, BRF_GRA }, // 7 Characters - - { "ld_17.bin", 0x10000, 0x7188bfdd, BRF_GRA }, // 8 BG Tiles - { "ld_18.bin", 0x10000, 0xa62af66a, BRF_GRA }, // 9 - { "ld_19.bin", 0x10000, 0x4b762e50, BRF_GRA }, // 10 - { "ld_20.bin", 0x10000, 0xb140188e, BRF_GRA }, // 11 - - { "ld_28.bin", 0x10000, 0x06778248, BRF_GRA }, // 12 FG Tiles - { "ld_27.bin", 0x10000, 0x48c78675, BRF_GRA }, // 13 - { "ld_26.bin", 0x10000, 0xb0edac81, BRF_GRA }, // 14 - { "ld_25.bin", 0x10000, 0xc541ae9a, BRF_GRA }, // 15 - { "ld_24.bin", 0x10000, 0x66eac4df, BRF_GRA }, // 16 - { "ld_23.bin", 0x10000, 0xd817332c, BRF_GRA }, // 17 - { "ld_22.bin", 0x10000, 0xf80f8812, BRF_GRA }, // 18 - { "ld_21.bin", 0x10000, 0xb74f0c0e, BRF_GRA }, // 19 - - { "ld_09.bin", 0x10000, 0xf8fd5243, BRF_GRA }, // 20 Sprites - { "ld_10.bin", 0x10000, 0xb49ad746, BRF_GRA }, // 21 - { "ld_11.bin", 0x10000, 0x1a0d180e, BRF_GRA }, // 22 - { "ld_12.bin", 0x10000, 0xb2745e26, BRF_GRA }, // 23 - { "ld_15.bin", 0x10000, 0x96b13bbc, BRF_GRA }, // 24 - { "ld_16.bin", 0x10000, 0x9d80f7e6, BRF_GRA }, // 25 - { "ld_13.bin", 0x10000, 0xa1a598ac, BRF_GRA }, // 26 - { "ld_14.bin", 0x10000, 0xedf515cc, BRF_GRA }, // 27 - - { "ld.3d", 0x00100, 0x729a1ddc, BRF_GRA }, // 28 PROM (Priority) -}; - -STD_ROM_PICK(Lastduelb) -STD_ROM_FN(Lastduelb) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x80000; - DrvZ80Rom = Next; Next += 0x10000; - MSM6295ROM = Next; Next += 0x40000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x20000; - DrvZ80Ram = Next; Next += 0x00800; - DrvSpriteRam = Next; Next += 0x00800; - DrvSpriteRamBuffer = Next; Next += 0x00800; - DrvVideoRam = Next; Next += 0x02000; - DrvPaletteRam = Next; Next += 0x00800; - DrvScroll1Ram = Next; Next += 0x04000; - DrvScroll2Ram = Next; Next += 0x08000; - - RamEnd = Next; - - DrvChars = Next; Next += 0x0800 * 8 * 8; - DrvBgTiles = Next; Next += 0x0800 * 16 * 16; - DrvFgTiles = Next; Next += 0x1000 * 16 * 16; - DrvSprites = Next; Next += 0x1000 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - - DrvFgScrollX = 0; - DrvFgScrollY = 0; - DrvBgScrollX = 0; - DrvBgScrollY = 0; - DrvZ80RomBank = 0; - DrvSoundLatch = 0; - - return 0; -} - -static INT32 MadgearDoReset() -{ - DrvDoReset(); - - MSM6295Reset(0); - - return 0; -} - -UINT8 __fastcall Madgear68KReadByte(UINT32 a) -{ - switch (a) { - case 0xfc4000: { - return DrvDip[0]; - } - - case 0xfc4001: { - return DrvDip[1]; - } - - case 0xfc4002: { - return DrvDip[2]; - } - - case 0xfc4004: { - return 0xff - DrvInput[0]; - } - - case 0xfc4005: { - return 0xff - DrvInput[1]; - } - - case 0xfc4006: { - return 0xff - DrvInput[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Madgear68KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0xfc4000: { - // flip - return; - } - - case 0xfc4002: { - DrvSoundLatch = d & 0xff; - return; - } - - case 0xfd0000: { - DrvFgScrollY = d & 0x1ff; - return; - } - - case 0xfd0002: { - DrvFgScrollX = d & 0x3ff; - return; - } - - case 0xfd0004: { - DrvBgScrollY = d & 0x1ff; - return; - } - - case 0xfd0006: { - DrvBgScrollX = d & 0x3ff; - return; - } - - case 0xfd0008: - case 0xfd000e: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall MadgearZ80Read(UINT16 a) -{ - switch (a) { - case 0xf000: { - return BurnYM2203Read(0, 0); - } - - case 0xf002: { - return BurnYM2203Read(1, 0); - } - - case 0xf006: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall MadgearZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xf000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0xf001: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0xf002: { - BurnYM2203Write(1, 0, d); - return; - } - - case 0xf003: { - BurnYM2203Write(1, 1, d); - return; - } - - case 0xf004: { - MSM6295Command(0, d); - return; - } - - case 0xf00a: { - DrvZ80RomBank = d & 1; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x8000 + DrvZ80RomBank * 0x4000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x8000 + DrvZ80RomBank * 0x4000 ); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -void __fastcall Lastduel68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xfc4001: { - // flip - return; - } - - case 0xfc4003: { - DrvSoundLatch = d & 0xff; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Lastduel68KReadWord(UINT32 a) -{ - switch (a) { - case 0xfc4000: { - return 0xffff - ((DrvInput[1] << 8) | DrvInput[0]); - } - - case 0xfc4002: { - return 0xffff - DrvInput[2]; - } - - case 0xfc4004: { - return (DrvDip[1] << 8) | DrvDip[0]; - } - - case 0xfc4006: { - return DrvDip[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read Word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Lastduel68KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0xfc0000: - case 0xfc0002: { - // NOP - return; - } - - case 0xfc8000: { - DrvFgScrollY = d & 0x1ff; - return; - } - - case 0xfc8002: { - DrvFgScrollX = d & 0x3ff; - return; - } - - case 0xfc8004: { - DrvBgScrollY = d & 0x1ff; - return; - } - - case 0xfc8006: { - DrvBgScrollX = d & 0x3ff; - return; - } - - case 0xfc8008: - case 0xfc800e: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall LastduelZ80Read(UINT16 a) -{ - switch (a) { - case 0xe800: { - return BurnYM2203Read(0, 0); - } - - case 0xf000: { - return BurnYM2203Read(1, 0); - } - - case 0xf800: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall LastduelZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe800: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0xe801: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0xf000: { - BurnYM2203Write(1, 0, d); - return; - } - - case 0xf001: { - BurnYM2203Write(1, 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -inline static void DrvYM2203IRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3579545; -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3579545; -} - -static INT32 CharPlaneOffsets[2] = { 4, 0 }; -static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; -static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; -static INT32 BgTilePlaneOffsets[4] = { 12, 8, 4, 0 }; -static INT32 FgTilePlaneOffsets[4] = { 4, 12, 0, 8 }; -static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 16, 17, 18, 19, 512, 513, 514, 515, 528, 529, 530, 531 }; -static INT32 TileYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; -static INT32 SpritePlaneOffsets[4] = { 0, 0x100000, 0x200000, 0x300000 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; - -static INT32 DrvInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x40001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x40000, 3, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the bg tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvBgTiles); - - // Load and decode the fg tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, FgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvFgTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x70000, 15, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); - - // Load the samples - nRet = BurnLoadRom(MSM6295ROM + 0x00000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROM + 0x20000, 17, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvSpriteRam , 0xfc1800, 0xfc1fff, SM_RAM); - SekMapMemory(DrvVideoRam , 0xfc8000, 0xfc9fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0xfcc000, 0xfcc7ff, SM_RAM); - SekMapMemory(DrvScroll1Ram , 0xfd4000, 0xfd7fff, SM_RAM); - SekMapMemory(DrvScroll2Ram , 0xfd8000, 0xfdffff, SM_RAM); - SekMapMemory(Drv68KRam , 0xff0000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, Madgear68KWriteWord); - SekSetReadByteHandler(0, Madgear68KReadByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(MadgearZ80Read); - ZetSetWriteHandler(MadgearZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x8000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x8000 ); - ZetMapArea(0xd000, 0xd7ff, 0, DrvZ80Ram ); - ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80Ram ); - ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - DrvSpritePriMask = 0x10; - DrvSpriteFlipYMask = 0x80; - - BurnYM2203Init(2, 3579545, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3579545); - BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 7575, 1); - MSM6295SetRoute(0, 0.98, BURN_SND_ROUTE_BOTH); - - // Reset the driver - MadgearDoReset(); - - return 0; -} - -static INT32 Ledstrm2Init() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x40001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x40000, 3, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the bg tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvBgTiles); - - // Load and decode the fg tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, FgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvFgTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 9, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); - - // Load the samples - nRet = BurnLoadRom(MSM6295ROM + 0x00000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROM + 0x20000, 11, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvSpriteRam , 0xfc1800, 0xfc1fff, SM_RAM); - SekMapMemory(DrvVideoRam , 0xfc8000, 0xfc9fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0xfcc000, 0xfcc7ff, SM_RAM); - SekMapMemory(DrvScroll1Ram , 0xfd4000, 0xfd7fff, SM_RAM); - SekMapMemory(DrvScroll2Ram , 0xfd8000, 0xfdffff, SM_RAM); - SekMapMemory(Drv68KRam , 0xff0000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, Madgear68KWriteWord); - SekSetReadByteHandler(0, Madgear68KReadByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(MadgearZ80Read); - ZetSetWriteHandler(MadgearZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x8000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x8000 ); - ZetMapArea(0xd000, 0xd7ff, 0, DrvZ80Ram ); - ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80Ram ); - ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - DrvSpritePriMask = 0x10; - DrvSpriteFlipYMask = 0x80; - - BurnYM2203Init(2, 3579545, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3579545); - BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 7575, 1); - MSM6295SetRoute(0, 0.98, BURN_SND_ROUTE_BOTH); - - // Reset the driver - MadgearDoReset(); - - return 0; -} - -static INT32 LastduelInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x40001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x40000, 3, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the bg tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00001, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 2); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvBgTiles); - - // Load and decode the fg tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvFgTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 12, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(DrvSpriteRam , 0xfc0800, 0xfc0fff, SM_RAM); - SekMapMemory(DrvVideoRam , 0xfcc000, 0xfcdfff, SM_RAM); - SekMapMemory(DrvScroll1Ram , 0xfd0000, 0xfd3fff, SM_RAM); - SekMapMemory(DrvScroll2Ram , 0xfd4000, 0xfd7fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0xfd8000, 0xfd87ff, SM_RAM); - SekMapMemory(Drv68KRam , 0xfe0000, 0xffffff, SM_RAM); - SekSetReadWordHandler(0, Lastduel68KReadWord); - SekSetWriteWordHandler(0, Lastduel68KWriteWord); - SekSetWriteByteHandler(0, Lastduel68KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(LastduelZ80Read); - ZetSetWriteHandler(LastduelZ80Write); - ZetMapArea(0x0000, 0xdfff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xdfff, 2, DrvZ80Rom ); - ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - DrvSpritePriMask = 0x00; - DrvSpriteFlipYMask = 0x40; - - BurnYM2203Init(2, 3579545, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3579545); - BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 LastduelbInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x20001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x20000, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x40001, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x40000, 5, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(DrvZ80Rom, 6, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - // Load and decode the bg tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00001, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20001, 9, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 11, 2); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvBgTiles); - - // Load and decode the fg tiles - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00001, 12, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20001, 14, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 15, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40001, 16, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 17, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60001, 18, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 19, 2); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvFgTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x70000, 27, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(DrvSpriteRam , 0xfc0800, 0xfc0fff, SM_RAM); - SekMapMemory(DrvVideoRam , 0xfcc000, 0xfcdfff, SM_RAM); - SekMapMemory(DrvScroll1Ram , 0xfd0000, 0xfd3fff, SM_RAM); - SekMapMemory(DrvScroll2Ram , 0xfd4000, 0xfd7fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0xfd8000, 0xfd87ff, SM_RAM); - SekMapMemory(Drv68KRam , 0xfe0000, 0xffffff, SM_RAM); - SekSetReadWordHandler(0, Lastduel68KReadWord); - SekSetWriteWordHandler(0, Lastduel68KWriteWord); - SekSetWriteByteHandler(0, Lastduel68KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(LastduelZ80Read); - ZetSetWriteHandler(LastduelZ80Write); - ZetMapArea(0x0000, 0xdfff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xdfff, 2, DrvZ80Rom ); - ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80Ram ); - ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - DrvSpritePriMask = 0x00; - DrvSpriteFlipYMask = 0x40; - - BurnYM2203Init(2, 3579545, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); - BurnTimerAttachZet(3579545); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - SekExit(); - ZetExit(); - - BurnYM2203Exit(); - - GenericTilesExit(); - - DrvFgScrollX = 0; - DrvFgScrollY = 0; - DrvBgScrollX = 0; - DrvBgScrollY = 0; - DrvSpritePriMask = 0; - DrvSpriteFlipYMask = 0; - DrvZ80RomBank = 0; - DrvSoundLatch = 0; - - BurnFree(Mem); - - return 0; -} - -static INT32 MadgearExit() -{ - MSM6295Exit(0); - return DrvExit(); -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - static const UINT8 ztable[16] = { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11 }; - INT32 i, r, g, b; - - i = ztable[(nColour >> 0) & 15]; - r = ((nColour >> 12) & 15) * i; - g = ((nColour >> 8) & 15) * i; - b = ((nColour >> 4) & 15) * i; - - return BurnHighCol(r, g, b, 0); -} - -static void DrvCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x800; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } -} - -static void DrvRenderBgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex, Flip, xFlip, yFlip; - - UINT16 *VideoRam = (UINT16*)DrvScroll2Ram; - - for (mx = 0; mx < 32; mx++) { - for (my = 0; my < 64; my++) { - TileIndex = (my * 32) + mx; - Code = VideoRam[TileIndex] & 0x1fff; - Colour = VideoRam[TileIndex + 0x800]; - Flip = (Colour & 0x60) >> 5; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - Colour &= 0x0f; - - y = 16 * mx; - x = 16 * my; - - x -= DrvBgScrollX; - y -= DrvBgScrollY; - if (x < -16) x += 1024; - if (y < -16) y += 512; - x -= 64; - y -= 8; - - if (x > 16 && x < 368 && y > 16 && y < 224) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } else { - Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } else { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } else { - Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } - } - } - } - } -} - -static void DrvRenderFgLayer(INT32 Priority) -{ - INT32 mx, my, Code, Colour, x, y, TileIndex, Split, Flip, xFlip, yFlip; - - UINT16 *VideoRam = (UINT16*)DrvScroll1Ram; - - for (mx = 0; mx < 32; mx++) { - for (my = 0; my < 64; my++) { - TileIndex = (my * 32) + mx; - Code = VideoRam[TileIndex] & 0x1fff; - Colour = VideoRam[TileIndex + 0x800]; - Flip = (Colour & 0x60) >> 5; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - Split = (Colour & 0x10) >> 4; - Colour &= 0x0f; - - if (Split != Priority) continue; - - y = 16 * mx; - x = 16 * my; - - x -= DrvFgScrollX; - y -= DrvFgScrollY; - if (x < -16) x += 1024; - if (y < -16) y += 512; - x -= 64; - y -= 8; - - if (x > 16 && x < 368 && y > 16 && y < 224) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); - } - } - } - } - } -} - -static void LastduelRenderBgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0, Flip, xFlip, yFlip; - - UINT16 *VideoRam = (UINT16*)DrvScroll2Ram; - - for (my = 0; my < 64; my++) { - for (mx = 0; mx < 64; mx++) { - Code = VideoRam[2 * TileIndex] & 0x1fff; - Colour = VideoRam[2 * TileIndex + 1]; - Flip = (Colour & 0x60) >> 5; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - Colour &= 0x0f; - - x = 16 * mx; - y = 16 * my; - - x -= DrvBgScrollX; - y -= DrvBgScrollY; - if (x < -16) x += 1024; - if (y < -16) y += 1024; - x -= 64; - y -= 8; - - if (x > 16 && x < 368 && y > 16 && y < 224) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } else { - Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } else { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } else { - Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); - } - } - } - - TileIndex++; - } - } -} - -static void LastduelRenderFgLayer(INT32 Priority) -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0, Split, Flip, xFlip, yFlip; - - UINT16 *VideoRam = (UINT16*)DrvScroll1Ram; - - for (my = 0; my < 64; my++) { - for (mx = 0; mx < 64; mx++) { - Code = VideoRam[2 * TileIndex] & 0x1fff; - Colour = VideoRam[2 * TileIndex + 1]; - Flip = (Colour & 0x60) >> 5; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - Split = (Colour & 0x80) >> 7; - Colour &= 0x0f; - - if (Split != Priority) continue; - - x = 16 * mx; - y = 16 * my; - - x -= DrvFgScrollX; - y -= DrvFgScrollY; - if (x < -16) x += 1024; - if (y < -16) y += 1024; - x -= 64; - y -= 8; - - if (x > 16 && x < 368 && y > 16 && y < 224) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); - } - } - } - - TileIndex++; - } - } -} - -static void DrvRenderSprites(INT32 Priority) -{ - INT32 Offset; - UINT16 *SpriteRam = (UINT16*)DrvSpriteRamBuffer; - - for (Offset = 0x400 - 4; Offset >= 0; Offset -= 4) { - INT32 Attr, sy, sx, xFlip, yFlip, Code, Colour; - - Attr = SpriteRam[Offset + 1]; - if (DrvSpritePriMask) { - if (Priority == 1 && (Attr & DrvSpritePriMask)) continue; - if (Priority == 0 && !(Attr & DrvSpritePriMask)) continue; - } - - Code = SpriteRam[Offset] & 0xfff; - sx = SpriteRam[Offset + 3] & 0x1ff; - sy = SpriteRam[Offset + 2] & 0x1ff; - if (sy > 0x100) sy -= 0x200; - - xFlip = Attr & 0x20; - yFlip = Attr & DrvSpriteFlipYMask; - Colour = Attr & 0x0f; - - sx -= 64; - sy -= 8; - - if (sx > 16 && sx < 368 && sy > 16 && sy < 224) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); - } else { - Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); - } - } - } - } -} - -static void DrvRenderCharLayer() -{ - INT32 mx, my, Code, Colour, x, y, yFlip, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvVideoRam; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - yFlip = 0; - Code = VideoRam[TileIndex]; - Colour = Code >> 12; - if (Code & 0x800) yFlip = 1; - Code &= 0x7ff; - - x = 8 * mx; - y = 8 * my; - - x -= 64; - y -= 8; - - if (x > 0 && x < 376 && y > 8 && y < 232) { - if (yFlip) { - Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 2, 3, 0x300, DrvChars); - } else { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 3, 0x300, DrvChars); - } - } else { - if (yFlip) { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x300, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x300, DrvChars); - } - } - - TileIndex++; - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - DrvRenderBgLayer(); - DrvRenderFgLayer(0); - DrvRenderSprites(0); - DrvRenderFgLayer(1); - DrvRenderSprites(1); - DrvRenderCharLayer(); - BurnTransferCopy(DrvPalette); -} - -static void LastduelDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - LastduelRenderBgLayer(); - LastduelRenderFgLayer(0); - DrvRenderSprites(0); - LastduelRenderFgLayer(1); - DrvRenderCharLayer(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 100; - - if (DrvReset) MadgearDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 10000000 / 60; - nCyclesTotal[1] = 3579545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 33 || i == 66) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - SekClose(); - - ZetOpen(0); - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) DrvDraw(); - - SekOpen(0); - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - SekClose(); - - memcpy(DrvSpriteRamBuffer, DrvSpriteRam, 0x800); - - return 0; -} - -static INT32 LastduelFrame() -{ - INT32 nInterleave = 100; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 10000000 / 60; - nCyclesTotal[1] = 3579545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 33 || i == 66) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - ZetOpen(0); - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) LastduelDraw(); - - SekOpen(0); - SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - SekClose(); - - memcpy(DrvSpriteRamBuffer, DrvSpriteRam, 0x800); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029672; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); // Scan Z80 - BurnYM2203Scan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(DrvZ80RomBank); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(DrvFgScrollX); - SCAN_VAR(DrvFgScrollY); - SCAN_VAR(DrvBgScrollX); - SCAN_VAR(DrvBgScrollY); - SCAN_VAR(DrvDip); - SCAN_VAR(DrvInput); - } - - return 0; -} - -static INT32 MadgearScan(INT32 nAction, INT32 *pnMin) -{ - INT32 i = DrvScan(nAction, pnMin); - - if (i == 0) { - if (nAction & ACB_DRIVER_DATA) { - MSM6295Scan(0, nAction); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x8000 + DrvZ80RomBank * 0x4000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x8000 + DrvZ80RomBank * 0x4000 ); - ZetClose(); - } - } - - return i; -} - -struct BurnDriver BurnDrvLastduel = { - "lastduel", NULL, NULL, NULL, "1988", - "Last Duel (US New Ver.)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, LastduelRomInfo, LastduelRomName, NULL, NULL, LastduelInputInfo, LastduelDIPInfo, - LastduelInit, DrvExit, LastduelFrame, NULL, DrvScan, - NULL, 0x800, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvLastduelo = { - "lastduelo", "lastduel", NULL, NULL, "1988", - "Last Duel (US Old Ver.)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, LastdueloRomInfo, LastdueloRomName, NULL, NULL, LastduelInputInfo, LastduelDIPInfo, - LastduelInit, DrvExit, LastduelFrame, NULL, DrvScan, - NULL, 0x800, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvLastduelj = { - "lastduelj", "lastduel", NULL, NULL, "1988", - "Last Duel (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, LastdueljRomInfo, LastdueljRomName, NULL, NULL, LastduelInputInfo, LastduelDIPInfo, - LastduelInit, DrvExit, LastduelFrame, NULL, DrvScan, - NULL, 0x800, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvLsstduelb = { - "lastduelb", "lastduel", NULL, NULL, "1988", - "Last Duel (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, LastduelbRomInfo, LastduelbRomName, NULL, NULL, LastduelInputInfo, LastduelDIPInfo, - LastduelbInit, DrvExit, LastduelFrame, NULL, DrvScan, - NULL, 0x800, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvMadgear = { - "madgear", NULL, NULL, NULL, "1989", - "Mad Gear (US)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, - NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, MadgearExit, DrvFrame, NULL, MadgearScan, - NULL, 0x800, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvMadgearj = { - "madgearj", "madgear", NULL, NULL, "1989", - "Mad Gear (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, - NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, MadgearExit, DrvFrame, NULL, MadgearScan, - NULL, 0x800, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvMadgearu = { - "ledstorm", "madgear", NULL, NULL, "1988", - "Led Storm (US)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, - NULL, DrvuRomInfo, DrvuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, MadgearExit, DrvFrame, NULL, MadgearScan, - NULL, 0x800, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvLedstrm2 = { - "ledstorm2", "madgear", NULL, NULL, "1988", - "Led Storm Rally 2011 (US)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, - NULL, Ledstrm2RomInfo, Ledstrm2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - Ledstrm2Init, MadgearExit, DrvFrame, NULL, MadgearScan, - NULL, 0x800, 240, 384, 3, 4 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2203.h" +#include "msm6295.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[3] = {0, 0, 0}; +static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Drv68KRom = NULL; +static UINT8 *Drv68KRam = NULL; +static UINT8 *DrvZ80Rom = NULL; +static UINT8 *DrvZ80Ram = NULL; +static UINT8 *DrvVideoRam = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvSpriteRamBuffer = NULL; +static UINT8 *DrvPaletteRam = NULL; +static UINT8 *DrvScroll1Ram = NULL; +static UINT8 *DrvScroll2Ram = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvBgTiles = NULL; +static UINT8 *DrvFgTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT16 DrvFgScrollX; +static UINT16 DrvFgScrollY; +static UINT16 DrvBgScrollX; +static UINT16 DrvBgScrollY; +static UINT8 DrvSpritePriMask; +static UINT8 DrvSpriteFlipYMask; +static UINT8 DrvZ80RomBank; +static UINT8 DrvSoundLatch; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 up" }, + {"Down" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 fire 1" }, + + {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort2 + 7, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo LastduelInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 up" }, + {"Down" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 down" }, + {"Left" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort2 + 5, "service" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort2 + 3, "diag" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Lastduel) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + } + + // Clear Opposites + DrvClearOpposites(&DrvInput[0]); + DrvClearOpposites(&DrvInput[1]); +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x10, 0x01, 0x80, 0x80, "Off" }, + {0x10, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Allow continue" }, + {0x11, 0x01, 0x01, 0x00, "No" }, + {0x11, 0x01, 0x01, 0x01, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x0c, 0x08, "Easy" }, + {0x11, 0x01, 0x0c, 0x0c, "Normal" }, + {0x11, 0x01, 0x0c, 0x04, "Difficult" }, + {0x11, 0x01, 0x0c, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 3 , "Cabinet" }, + {0x11, 0x01, 0x30, 0x30, "Upright (One Player)" }, + {0x11, 0x01, 0x30, 0x00, "Upright (Two Players)" }, + {0x11, 0x01, 0x30, 0x10, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x40, 0x00, "Off" }, + {0x11, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Background Music" }, + {0x11, 0x01, 0x80, 0x00, "Off" }, + {0x11, 0x01, 0x80, 0x80, "On" }, + + // Dip3 + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x12, 0x01, 0xf0, 0x20, "6 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x40, "5 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x50, "4 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x70, "3 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x10, "8 Coins 3 Plays" }, + {0x12, 0x01, 0xf0, 0x90, "2 Coins 1 Play" }, + {0x12, 0x01, 0xf0, 0x30, "5 Coins 3 Plays" }, + {0x12, 0x01, 0xf0, 0x60, "3 Coins 2 Plays" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 3 Plays" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Plays" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Plays" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Plays" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Plays" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Plays" }, + {0x12, 0x01, 0xf0, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 15 , "Coin B" }, + {0x12, 0x01, 0x0f, 0x02, "6 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x04, "5 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x05, "4 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x07, "3 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x01, "8 Coins 3 Plays" }, + {0x12, 0x01, 0x0f, 0x09, "2 Coins 1 Play" }, + {0x12, 0x01, 0x0f, 0x03, "5 Coins 3 Plays" }, + {0x12, 0x01, 0x0f, 0x06, "3 Coins 2 Plays" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Plays" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Plays" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Plays" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Plays" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Plays" }, +}; + +STDDIPINFO(Drv) + +static struct BurnDIPInfo LastduelDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "4 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x08, "3 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x10, "2 Coins 1 Play" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, + {0x13, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, + {0x13, 0x01, 0x38, 0x18, "1 Coin 6 Plays" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Normal" }, + {0x14, 0x01, 0x03, 0x01, "Difficult" }, + {0x14, 0x01, 0x03, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x20, "20000, 60000, 80000" }, + {0x14, 0x01, 0x30, 0x30, "30000, 80000, 80000" }, + {0x14, 0x01, 0x30, 0x10, "40000, 80000, 80000" }, + {0x14, 0x01, 0x30, 0x00, "40000, 80000, 100000" }, + + // Dip3 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x03, 0x03, "3" }, + {0x15, 0x01, 0x03, 0x02, "4" }, + {0x15, 0x01, 0x03, 0x01, "6" }, + {0x15, 0x01, 0x03, 0x00, "8" }, + + {0 , 0xfe, 0 , 2 , "Type" }, + {0x15, 0x01, 0x04, 0x04, "Car" }, + {0x15, 0x01, 0x04, 0x00, "Plane" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x20, 0x00, "Off" }, + {0x15, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow continue" }, + {0x15, 0x01, 0x40, 0x00, "No" }, + {0x15, 0x01, 0x40, 0x40, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + +}; + +STDDIPINFO(Lastduel) + +static struct BurnRomInfo DrvRomDesc[] = { + { "mg_04.8b", 0x20000, 0xb112257d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "mg_03.7b", 0x20000, 0xb2672465, BRF_ESS | BRF_PRG }, // 1 + { "mg_02.6b", 0x20000, 0x9f5ebe16, BRF_ESS | BRF_PRG }, // 2 + { "mg_01.5b", 0x20000, 0x1cea2af0, BRF_ESS | BRF_PRG }, // 3 + + { "mg_05.14j", 0x10000, 0x2fbfc945, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "mg_06.10k", 0x08000, 0x382ee59b, BRF_GRA }, // 5 Characters + + { "ls-12.7l", 0x40000, 0x6c1b2c6c, BRF_GRA }, // 6 BG Tiles + + { "ls-11.2l", 0x80000, 0x6bf81c64, BRF_GRA }, // 7 FG Tiles + + { "mg_m11.rom0", 0x10000, 0xee319a64, BRF_GRA }, // 8 Sprites + { "mg_m07.rom2", 0x10000, 0xe5c0b211, BRF_GRA }, // 9 + { "mg_m12.rom1", 0x10000, 0x887ef120, BRF_GRA }, // 10 + { "mg_m08.rom3", 0x10000, 0x59709aa3, BRF_GRA }, // 11 + { "mg_m13.rom0", 0x10000, 0xeae07db4, BRF_GRA }, // 12 + { "mg_m09.rom2", 0x10000, 0x40ee83eb, BRF_GRA }, // 13 + { "mg_m14.rom1", 0x10000, 0x21e5424c, BRF_GRA }, // 14 + { "mg_m10.rom3", 0x10000, 0xb64afb54, BRF_GRA }, // 15 + + { "ls-06.10e", 0x20000, 0x88d39a5b, BRF_SND }, // 16 Samples + { "ls-05.12e", 0x20000, 0xb06e03b5, BRF_SND }, // 17 + + { "29.14k", 0x00100, 0x7f862e1e, BRF_GRA }, // 18 PROM (Priority) +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo DrvjRomDesc[] = { + { "mdj_04.8b", 0x20000, 0x9ebbebb1, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "mdj_03.7b", 0x20000, 0xa5579c2d, BRF_ESS | BRF_PRG }, // 1 + { "mg_02.6b", 0x20000, 0x9f5ebe16, BRF_ESS | BRF_PRG }, // 2 + { "mg_01.5b", 0x20000, 0x1cea2af0, BRF_ESS | BRF_PRG }, // 3 + + { "mg_05.14j", 0x10000, 0x2fbfc945, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "mg_06.10k", 0x08000, 0x382ee59b, BRF_GRA }, // 5 Characters + + { "ls-12.7l", 0x40000, 0x6c1b2c6c, BRF_GRA }, // 6 BG Tiles + + { "ls-11.2l", 0x80000, 0x6bf81c64, BRF_GRA }, // 7 FG Tiles + + { "mg_m11.rom0", 0x10000, 0xee319a64, BRF_GRA }, // 8 Sprites + { "mg_m07.rom2", 0x10000, 0xe5c0b211, BRF_GRA }, // 9 + { "mg_m12.rom1", 0x10000, 0x887ef120, BRF_GRA }, // 10 + { "mg_m08.rom3", 0x10000, 0x59709aa3, BRF_GRA }, // 11 + { "mg_m13.rom0", 0x10000, 0xeae07db4, BRF_GRA }, // 12 + { "mg_m09.rom2", 0x10000, 0x40ee83eb, BRF_GRA }, // 13 + { "mg_m14.rom1", 0x10000, 0x21e5424c, BRF_GRA }, // 14 + { "mg_m10.rom3", 0x10000, 0xb64afb54, BRF_GRA }, // 15 + + { "ls-06.10e", 0x20000, 0x88d39a5b, BRF_SND }, // 16 Samples + { "ls-05.12e", 0x20000, 0xb06e03b5, BRF_SND }, // 17 + + { "29.14k", 0x00100, 0x7f862e1e, BRF_GRA }, // 18 PROM (Priority) +}; + +STD_ROM_PICK(Drvj) +STD_ROM_FN(Drvj) + +static struct BurnRomInfo DrvuRomDesc[] = { + { "mdu_04.8b", 0x20000, 0x7f7f8329, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "mdu_03.7b", 0x20000, 0x11fa542f, BRF_ESS | BRF_PRG }, // 1 + { "mde_02.6b", 0x20000, 0x9f5ebe16, BRF_ESS | BRF_PRG }, // 2 + { "mde_01.5b", 0x20000, 0x1cea2af0, BRF_ESS | BRF_PRG }, // 3 + + { "mde_05.14j", 0x10000, 0x2fbfc945, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "mdu_06.10k", 0x08000, 0x54bfdc02, BRF_GRA }, // 5 Characters + + { "ls-12.7l", 0x40000, 0x6c1b2c6c, BRF_GRA }, // 6 BG Tiles + + { "ls-11.2l", 0x80000, 0x6bf81c64, BRF_GRA }, // 7 FG Tiles + + { "11.rom0", 0x10000, 0xee319a64, BRF_GRA }, // 8 Sprites + { "07u.rom2", 0x10000, 0x7152b212, BRF_GRA }, // 9 + { "12.rom1", 0x10000, 0x887ef120, BRF_GRA }, // 10 + { "08u.rom3", 0x10000, 0x72e5d525, BRF_GRA }, // 11 + { "13.rom0", 0x10000, 0xeae07db4, BRF_GRA }, // 12 + { "09u.rom2", 0x10000, 0x7b5175cb, BRF_GRA }, // 13 + { "14.rom1", 0x10000, 0x21e5424c, BRF_GRA }, // 14 + { "10u.rom3", 0x10000, 0x6db7ca64, BRF_GRA }, // 15 + + { "ls-06.10e", 0x20000, 0x88d39a5b, BRF_SND }, // 16 Samples + { "ls-05.12e", 0x20000, 0xb06e03b5, BRF_SND }, // 17 + + { "29.14k", 0x00100, 0x7f862e1e, BRF_GRA }, // 18 PROM (Priority) +}; + +STD_ROM_PICK(Drvu) +STD_ROM_FN(Drvu) + +static struct BurnRomInfo Ledstrm2RomDesc[] = { + { "lsu-04.8b", 0x20000, 0x56a2f079, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "lsu-03.7b", 0x20000, 0x9b6408c0, BRF_ESS | BRF_PRG }, // 1 + { "ls-02.6b", 0x20000, 0x05c0285e, BRF_ESS | BRF_PRG }, // 2 + { "ls-01.5b", 0x20000, 0x8bf934dd, BRF_ESS | BRF_PRG }, // 3 + + { "ls-07.14j", 0x10000, 0x98af7838, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "ls-08.10k", 0x08000, 0x8803cf49, BRF_GRA }, // 5 Characters + + { "ls-12.7l", 0x40000, 0x6c1b2c6c, BRF_GRA }, // 6 BG Tiles + + { "ls-11.2l", 0x80000, 0x6bf81c64, BRF_GRA }, // 7 FG Tiles + + { "ls-09.5a", 0x40000, 0x80875e1d, BRF_GRA }, // 8 Sprites + { "ls-10.13a", 0x40000, 0xc5993f93, BRF_GRA }, // 9 + + { "ls-06.10e", 0x20000, 0x88d39a5b, BRF_SND }, // 10 Samples + { "ls-05.12e", 0x20000, 0xb06e03b5, BRF_SND }, // 11 + + { "29.14k", 0x00100, 0x7f862e1e, BRF_GRA }, // 12 PROM (Priority) +}; + +STD_ROM_PICK(Ledstrm2) +STD_ROM_FN(Ledstrm2) + +static struct BurnRomInfo LastduelRomDesc[] = { + { "ldu_06b.13k", 0x20000, 0x0e71acaf, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ldu_05b.12k", 0x20000, 0x47a85bea, BRF_ESS | BRF_PRG }, // 1 + { "ldu_04b.11k", 0x10000, 0xaa4bf001, BRF_ESS | BRF_PRG }, // 2 + { "ldu_03b.9k", 0x10000, 0xbbaac8ab, BRF_ESS | BRF_PRG }, // 3 + + { "ld_02.16h", 0x10000, 0x91834d0c, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "ld_01.12f", 0x08000, 0xad3c6f87, BRF_GRA }, // 5 Characters + + { "ld-15.6p", 0x20000, 0xd977a175, BRF_GRA }, // 6 BG Tiles + { "ld-13.6m", 0x20000, 0xbc25729f, BRF_GRA }, // 7 + + { "ld-14.15n", 0x80000, 0xd0653739, BRF_GRA }, // 8 FG Tiles + + { "ld-11.12b", 0x20000, 0x49d4dbbd, BRF_GRA }, // 9 Sprites + { "ld-09.12a", 0x20000, 0x6efadb74, BRF_GRA }, // 10 + { "ld-12.17b", 0x20000, 0x313e5338, BRF_GRA }, // 11 + { "ld-10.17a", 0x20000, 0xb8d3b2e3, BRF_GRA }, // 12 + + { "ld.3d", 0x00100, 0x729a1ddc, BRF_GRA }, // 13 PROM (Priority) +}; + +STD_ROM_PICK(Lastduel) +STD_ROM_FN(Lastduel) + +static struct BurnRomInfo LastdueloRomDesc[] = { + { "ldu_06.13k", 0x20000, 0x4228a00b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ldu_05.12k", 0x20000, 0x7260434f, BRF_ESS | BRF_PRG }, // 1 + { "ldu_04.11k", 0x10000, 0x429fb964, BRF_ESS | BRF_PRG }, // 2 + { "ldu_03.9k", 0x10000, 0x5aa4df72, BRF_ESS | BRF_PRG }, // 3 + + { "ld_02.16h", 0x10000, 0x91834d0c, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "ld_01.12f", 0x08000, 0xad3c6f87, BRF_GRA }, // 5 Characters + + { "ld-15.6p", 0x20000, 0xd977a175, BRF_GRA }, // 6 BG Tiles + { "ld-13.6m", 0x20000, 0xbc25729f, BRF_GRA }, // 7 + + { "ld-14.15n", 0x80000, 0xd0653739, BRF_GRA }, // 8 FG Tiles + + { "ld-11.12b", 0x20000, 0x49d4dbbd, BRF_GRA }, // 9 Sprites + { "ld-09.12a", 0x20000, 0x6efadb74, BRF_GRA }, // 10 + { "ld-12.17b", 0x20000, 0x313e5338, BRF_GRA }, // 11 + { "ld-10.17a", 0x20000, 0xb8d3b2e3, BRF_GRA }, // 12 + + { "ld.3d", 0x00100, 0x729a1ddc, BRF_GRA }, // 13 PROM (Priority) +}; + +STD_ROM_PICK(Lastduelo) +STD_ROM_FN(Lastduelo) + +static struct BurnRomInfo LastdueljRomDesc[] = { + { "ld_06.13k", 0x20000, 0x58a9e12b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ld_05.12k", 0x20000, 0x14685d78, BRF_ESS | BRF_PRG }, // 1 + { "ld_04.11k", 0x10000, 0xaa4bf001, BRF_ESS | BRF_PRG }, // 2 + { "ld_03.9k", 0x10000, 0xbbaac8ab, BRF_ESS | BRF_PRG }, // 3 + + { "ld_02.16h", 0x10000, 0x91834d0c, BRF_ESS | BRF_PRG }, // 4 Z80 Program + + { "ld_01.12f", 0x08000, 0xad3c6f87, BRF_GRA }, // 5 Characters + + { "ld-15.6p", 0x20000, 0xd977a175, BRF_GRA }, // 6 BG Tiles + { "ld-13.6m", 0x20000, 0xbc25729f, BRF_GRA }, // 7 + + { "ld-14.15n", 0x80000, 0xd0653739, BRF_GRA }, // 8 FG Tiles + + { "ld-11.12b", 0x20000, 0x49d4dbbd, BRF_GRA }, // 9 Sprites + { "ld-09.12a", 0x20000, 0x6efadb74, BRF_GRA }, // 10 + { "ld-12.17b", 0x20000, 0x313e5338, BRF_GRA }, // 11 + { "ld-10.17a", 0x20000, 0xb8d3b2e3, BRF_GRA }, // 12 + + { "ld.3d", 0x00100, 0x729a1ddc, BRF_GRA }, // 13 PROM (Priority) +}; + +STD_ROM_PICK(Lastduelj) +STD_ROM_FN(Lastduelj) + +static struct BurnRomInfo LastduelbRomDesc[] = { + { "ld_08.bin", 0x10000, 0x43811a96, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ld_07.bin", 0x10000, 0x63c30946, BRF_ESS | BRF_PRG }, // 1 + { "ld_04.bin", 0x10000, 0x46a4e0f8, BRF_ESS | BRF_PRG }, // 2 + { "ld_03.bin", 0x10000, 0x8d5f204a, BRF_ESS | BRF_PRG }, // 3 + { "ldu-04.rom", 0x10000, 0x429fb964, BRF_ESS | BRF_PRG }, // 4 + { "ldu-03.rom", 0x10000, 0x5aa4df72, BRF_ESS | BRF_PRG }, // 5 + + { "ld_02.bin", 0x10000, 0x91834d0c, BRF_ESS | BRF_PRG }, // 6 Z80 Program + + { "ld_01.bin", 0x08000, 0xad3c6f87, BRF_GRA }, // 7 Characters + + { "ld_17.bin", 0x10000, 0x7188bfdd, BRF_GRA }, // 8 BG Tiles + { "ld_18.bin", 0x10000, 0xa62af66a, BRF_GRA }, // 9 + { "ld_19.bin", 0x10000, 0x4b762e50, BRF_GRA }, // 10 + { "ld_20.bin", 0x10000, 0xb140188e, BRF_GRA }, // 11 + + { "ld_28.bin", 0x10000, 0x06778248, BRF_GRA }, // 12 FG Tiles + { "ld_27.bin", 0x10000, 0x48c78675, BRF_GRA }, // 13 + { "ld_26.bin", 0x10000, 0xb0edac81, BRF_GRA }, // 14 + { "ld_25.bin", 0x10000, 0xc541ae9a, BRF_GRA }, // 15 + { "ld_24.bin", 0x10000, 0x66eac4df, BRF_GRA }, // 16 + { "ld_23.bin", 0x10000, 0xd817332c, BRF_GRA }, // 17 + { "ld_22.bin", 0x10000, 0xf80f8812, BRF_GRA }, // 18 + { "ld_21.bin", 0x10000, 0xb74f0c0e, BRF_GRA }, // 19 + + { "ld_09.bin", 0x10000, 0xf8fd5243, BRF_GRA }, // 20 Sprites + { "ld_10.bin", 0x10000, 0xb49ad746, BRF_GRA }, // 21 + { "ld_11.bin", 0x10000, 0x1a0d180e, BRF_GRA }, // 22 + { "ld_12.bin", 0x10000, 0xb2745e26, BRF_GRA }, // 23 + { "ld_15.bin", 0x10000, 0x96b13bbc, BRF_GRA }, // 24 + { "ld_16.bin", 0x10000, 0x9d80f7e6, BRF_GRA }, // 25 + { "ld_13.bin", 0x10000, 0xa1a598ac, BRF_GRA }, // 26 + { "ld_14.bin", 0x10000, 0xedf515cc, BRF_GRA }, // 27 + + { "ld.3d", 0x00100, 0x729a1ddc, BRF_GRA }, // 28 PROM (Priority) +}; + +STD_ROM_PICK(Lastduelb) +STD_ROM_FN(Lastduelb) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x80000; + DrvZ80Rom = Next; Next += 0x10000; + MSM6295ROM = Next; Next += 0x40000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x20000; + DrvZ80Ram = Next; Next += 0x00800; + DrvSpriteRam = Next; Next += 0x00800; + DrvSpriteRamBuffer = Next; Next += 0x00800; + DrvVideoRam = Next; Next += 0x02000; + DrvPaletteRam = Next; Next += 0x00800; + DrvScroll1Ram = Next; Next += 0x04000; + DrvScroll2Ram = Next; Next += 0x08000; + + RamEnd = Next; + + DrvChars = Next; Next += 0x0800 * 8 * 8; + DrvBgTiles = Next; Next += 0x0800 * 16 * 16; + DrvFgTiles = Next; Next += 0x1000 * 16 * 16; + DrvSprites = Next; Next += 0x1000 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + + DrvFgScrollX = 0; + DrvFgScrollY = 0; + DrvBgScrollX = 0; + DrvBgScrollY = 0; + DrvZ80RomBank = 0; + DrvSoundLatch = 0; + + return 0; +} + +static INT32 MadgearDoReset() +{ + DrvDoReset(); + + MSM6295Reset(0); + + return 0; +} + +UINT8 __fastcall Madgear68KReadByte(UINT32 a) +{ + switch (a) { + case 0xfc4000: { + return DrvDip[0]; + } + + case 0xfc4001: { + return DrvDip[1]; + } + + case 0xfc4002: { + return DrvDip[2]; + } + + case 0xfc4004: { + return 0xff - DrvInput[0]; + } + + case 0xfc4005: { + return 0xff - DrvInput[1]; + } + + case 0xfc4006: { + return 0xff - DrvInput[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Madgear68KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0xfc4000: { + // flip + return; + } + + case 0xfc4002: { + DrvSoundLatch = d & 0xff; + return; + } + + case 0xfd0000: { + DrvFgScrollY = d & 0x1ff; + return; + } + + case 0xfd0002: { + DrvFgScrollX = d & 0x3ff; + return; + } + + case 0xfd0004: { + DrvBgScrollY = d & 0x1ff; + return; + } + + case 0xfd0006: { + DrvBgScrollX = d & 0x3ff; + return; + } + + case 0xfd0008: + case 0xfd000e: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall MadgearZ80Read(UINT16 a) +{ + switch (a) { + case 0xf000: { + return BurnYM2203Read(0, 0); + } + + case 0xf002: { + return BurnYM2203Read(1, 0); + } + + case 0xf006: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall MadgearZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xf000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0xf001: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0xf002: { + BurnYM2203Write(1, 0, d); + return; + } + + case 0xf003: { + BurnYM2203Write(1, 1, d); + return; + } + + case 0xf004: { + MSM6295Command(0, d); + return; + } + + case 0xf00a: { + DrvZ80RomBank = d & 1; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x8000 + DrvZ80RomBank * 0x4000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x8000 + DrvZ80RomBank * 0x4000 ); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +void __fastcall Lastduel68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xfc4001: { + // flip + return; + } + + case 0xfc4003: { + DrvSoundLatch = d & 0xff; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Lastduel68KReadWord(UINT32 a) +{ + switch (a) { + case 0xfc4000: { + return 0xffff - ((DrvInput[1] << 8) | DrvInput[0]); + } + + case 0xfc4002: { + return 0xffff - DrvInput[2]; + } + + case 0xfc4004: { + return (DrvDip[1] << 8) | DrvDip[0]; + } + + case 0xfc4006: { + return DrvDip[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read Word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Lastduel68KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0xfc0000: + case 0xfc0002: { + // NOP + return; + } + + case 0xfc8000: { + DrvFgScrollY = d & 0x1ff; + return; + } + + case 0xfc8002: { + DrvFgScrollX = d & 0x3ff; + return; + } + + case 0xfc8004: { + DrvBgScrollY = d & 0x1ff; + return; + } + + case 0xfc8006: { + DrvBgScrollX = d & 0x3ff; + return; + } + + case 0xfc8008: + case 0xfc800e: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall LastduelZ80Read(UINT16 a) +{ + switch (a) { + case 0xe800: { + return BurnYM2203Read(0, 0); + } + + case 0xf000: { + return BurnYM2203Read(1, 0); + } + + case 0xf800: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall LastduelZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe800: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0xe801: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0xf000: { + BurnYM2203Write(1, 0, d); + return; + } + + case 0xf001: { + BurnYM2203Write(1, 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +inline static void DrvYM2203IRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3579545; +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3579545; +} + +static INT32 CharPlaneOffsets[2] = { 4, 0 }; +static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; +static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; +static INT32 BgTilePlaneOffsets[4] = { 12, 8, 4, 0 }; +static INT32 FgTilePlaneOffsets[4] = { 4, 12, 0, 8 }; +static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 16, 17, 18, 19, 512, 513, 514, 515, 528, 529, 530, 531 }; +static INT32 TileYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; +static INT32 SpritePlaneOffsets[4] = { 0, 0x100000, 0x200000, 0x300000 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; + +static INT32 DrvInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x40001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x40000, 3, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the bg tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvBgTiles); + + // Load and decode the fg tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, FgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvFgTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x70000, 15, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); + + // Load the samples + nRet = BurnLoadRom(MSM6295ROM + 0x00000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROM + 0x20000, 17, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvSpriteRam , 0xfc1800, 0xfc1fff, SM_RAM); + SekMapMemory(DrvVideoRam , 0xfc8000, 0xfc9fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0xfcc000, 0xfcc7ff, SM_RAM); + SekMapMemory(DrvScroll1Ram , 0xfd4000, 0xfd7fff, SM_RAM); + SekMapMemory(DrvScroll2Ram , 0xfd8000, 0xfdffff, SM_RAM); + SekMapMemory(Drv68KRam , 0xff0000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, Madgear68KWriteWord); + SekSetReadByteHandler(0, Madgear68KReadByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(MadgearZ80Read); + ZetSetWriteHandler(MadgearZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x8000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x8000 ); + ZetMapArea(0xd000, 0xd7ff, 0, DrvZ80Ram ); + ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80Ram ); + ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80Ram ); + ZetClose(); + + GenericTilesInit(); + DrvSpritePriMask = 0x10; + DrvSpriteFlipYMask = 0x80; + + BurnYM2203Init(2, 3579545, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3579545); + BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 7575, 1); + MSM6295SetRoute(0, 0.98, BURN_SND_ROUTE_BOTH); + + // Reset the driver + MadgearDoReset(); + + return 0; +} + +static INT32 Ledstrm2Init() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x40001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x40000, 3, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the bg tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvBgTiles); + + // Load and decode the fg tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, FgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvFgTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 9, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); + + // Load the samples + nRet = BurnLoadRom(MSM6295ROM + 0x00000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROM + 0x20000, 11, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvSpriteRam , 0xfc1800, 0xfc1fff, SM_RAM); + SekMapMemory(DrvVideoRam , 0xfc8000, 0xfc9fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0xfcc000, 0xfcc7ff, SM_RAM); + SekMapMemory(DrvScroll1Ram , 0xfd4000, 0xfd7fff, SM_RAM); + SekMapMemory(DrvScroll2Ram , 0xfd8000, 0xfdffff, SM_RAM); + SekMapMemory(Drv68KRam , 0xff0000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, Madgear68KWriteWord); + SekSetReadByteHandler(0, Madgear68KReadByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(MadgearZ80Read); + ZetSetWriteHandler(MadgearZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x8000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x8000 ); + ZetMapArea(0xd000, 0xd7ff, 0, DrvZ80Ram ); + ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80Ram ); + ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80Ram ); + ZetClose(); + + GenericTilesInit(); + DrvSpritePriMask = 0x10; + DrvSpriteFlipYMask = 0x80; + + BurnYM2203Init(2, 3579545, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3579545); + BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 7575, 1); + MSM6295SetRoute(0, 0.98, BURN_SND_ROUTE_BOTH); + + // Reset the driver + MadgearDoReset(); + + return 0; +} + +static INT32 LastduelInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x40001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x40000, 3, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the bg tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00001, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 2); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvBgTiles); + + // Load and decode the fg tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvFgTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 12, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(DrvSpriteRam , 0xfc0800, 0xfc0fff, SM_RAM); + SekMapMemory(DrvVideoRam , 0xfcc000, 0xfcdfff, SM_RAM); + SekMapMemory(DrvScroll1Ram , 0xfd0000, 0xfd3fff, SM_RAM); + SekMapMemory(DrvScroll2Ram , 0xfd4000, 0xfd7fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0xfd8000, 0xfd87ff, SM_RAM); + SekMapMemory(Drv68KRam , 0xfe0000, 0xffffff, SM_RAM); + SekSetReadWordHandler(0, Lastduel68KReadWord); + SekSetWriteWordHandler(0, Lastduel68KWriteWord); + SekSetWriteByteHandler(0, Lastduel68KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(LastduelZ80Read); + ZetSetWriteHandler(LastduelZ80Write); + ZetMapArea(0x0000, 0xdfff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xdfff, 2, DrvZ80Rom ); + ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80Ram ); + ZetClose(); + + GenericTilesInit(); + DrvSpritePriMask = 0x00; + DrvSpriteFlipYMask = 0x40; + + BurnYM2203Init(2, 3579545, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3579545); + BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 LastduelbInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x20001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x20000, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x40001, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x40000, 5, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(DrvZ80Rom, 6, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + // Load and decode the bg tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00001, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20001, 9, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 11, 2); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvBgTiles); + + // Load and decode the fg tiles + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00001, 12, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20001, 14, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 15, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40001, 16, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 17, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60001, 18, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 19, 2); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, BgTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvFgTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x70000, 27, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(DrvSpriteRam , 0xfc0800, 0xfc0fff, SM_RAM); + SekMapMemory(DrvVideoRam , 0xfcc000, 0xfcdfff, SM_RAM); + SekMapMemory(DrvScroll1Ram , 0xfd0000, 0xfd3fff, SM_RAM); + SekMapMemory(DrvScroll2Ram , 0xfd4000, 0xfd7fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0xfd8000, 0xfd87ff, SM_RAM); + SekMapMemory(Drv68KRam , 0xfe0000, 0xffffff, SM_RAM); + SekSetReadWordHandler(0, Lastduel68KReadWord); + SekSetWriteWordHandler(0, Lastduel68KWriteWord); + SekSetWriteByteHandler(0, Lastduel68KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(LastduelZ80Read); + ZetSetWriteHandler(LastduelZ80Write); + ZetMapArea(0x0000, 0xdfff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xdfff, 2, DrvZ80Rom ); + ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80Ram ); + ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80Ram ); + ZetClose(); + + GenericTilesInit(); + DrvSpritePriMask = 0x00; + DrvSpriteFlipYMask = 0x40; + + BurnYM2203Init(2, 3579545, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); + BurnTimerAttachZet(3579545); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + SekExit(); + ZetExit(); + + BurnYM2203Exit(); + + GenericTilesExit(); + + DrvFgScrollX = 0; + DrvFgScrollY = 0; + DrvBgScrollX = 0; + DrvBgScrollY = 0; + DrvSpritePriMask = 0; + DrvSpriteFlipYMask = 0; + DrvZ80RomBank = 0; + DrvSoundLatch = 0; + + BurnFree(Mem); + + return 0; +} + +static INT32 MadgearExit() +{ + MSM6295Exit(0); + return DrvExit(); +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + static const UINT8 ztable[16] = { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11 }; + INT32 i, r, g, b; + + i = ztable[(nColour >> 0) & 15]; + r = ((nColour >> 12) & 15) * i; + g = ((nColour >> 8) & 15) * i; + b = ((nColour >> 4) & 15) * i; + + return BurnHighCol(r, g, b, 0); +} + +static void DrvCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x800; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } +} + +static void DrvRenderBgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex, Flip, xFlip, yFlip; + + UINT16 *VideoRam = (UINT16*)DrvScroll2Ram; + + for (mx = 0; mx < 32; mx++) { + for (my = 0; my < 64; my++) { + TileIndex = (my * 32) + mx; + Code = VideoRam[TileIndex] & 0x1fff; + Colour = VideoRam[TileIndex + 0x800]; + Flip = (Colour & 0x60) >> 5; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + Colour &= 0x0f; + + y = 16 * mx; + x = 16 * my; + + x -= DrvBgScrollX; + y -= DrvBgScrollY; + if (x < -16) x += 1024; + if (y < -16) y += 512; + x -= 64; + y -= 8; + + if (x > 16 && x < 368 && y > 16 && y < 224) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } else { + Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } else { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } else { + Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } + } + } + } + } +} + +static void DrvRenderFgLayer(INT32 Priority) +{ + INT32 mx, my, Code, Colour, x, y, TileIndex, Split, Flip, xFlip, yFlip; + + UINT16 *VideoRam = (UINT16*)DrvScroll1Ram; + + for (mx = 0; mx < 32; mx++) { + for (my = 0; my < 64; my++) { + TileIndex = (my * 32) + mx; + Code = VideoRam[TileIndex] & 0x1fff; + Colour = VideoRam[TileIndex + 0x800]; + Flip = (Colour & 0x60) >> 5; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + Split = (Colour & 0x10) >> 4; + Colour &= 0x0f; + + if (Split != Priority) continue; + + y = 16 * mx; + x = 16 * my; + + x -= DrvFgScrollX; + y -= DrvFgScrollY; + if (x < -16) x += 1024; + if (y < -16) y += 512; + x -= 64; + y -= 8; + + if (x > 16 && x < 368 && y > 16 && y < 224) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); + } else { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x100, DrvFgTiles); + } + } + } + } + } +} + +static void LastduelRenderBgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0, Flip, xFlip, yFlip; + + UINT16 *VideoRam = (UINT16*)DrvScroll2Ram; + + for (my = 0; my < 64; my++) { + for (mx = 0; mx < 64; mx++) { + Code = VideoRam[2 * TileIndex] & 0x1fff; + Colour = VideoRam[2 * TileIndex + 1]; + Flip = (Colour & 0x60) >> 5; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + Colour &= 0x0f; + + x = 16 * mx; + y = 16 * my; + + x -= DrvBgScrollX; + y -= DrvBgScrollY; + if (x < -16) x += 1024; + if (y < -16) y += 1024; + x -= 64; + y -= 8; + + if (x > 16 && x < 368 && y > 16 && y < 224) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } else { + Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } else { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } else { + Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvBgTiles); + } + } + } + + TileIndex++; + } + } +} + +static void LastduelRenderFgLayer(INT32 Priority) +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0, Split, Flip, xFlip, yFlip; + + UINT16 *VideoRam = (UINT16*)DrvScroll1Ram; + + for (my = 0; my < 64; my++) { + for (mx = 0; mx < 64; mx++) { + Code = VideoRam[2 * TileIndex] & 0x1fff; + Colour = VideoRam[2 * TileIndex + 1]; + Flip = (Colour & 0x60) >> 5; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + Split = (Colour & 0x80) >> 7; + Colour &= 0x0f; + + if (Split != Priority) continue; + + x = 16 * mx; + y = 16 * my; + + x -= DrvFgScrollX; + y -= DrvFgScrollY; + if (x < -16) x += 1024; + if (y < -16) y += 1024; + x -= 64; + y -= 8; + + if (x > 16 && x < 368 && y > 16 && y < 224) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); + } else { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x100, DrvFgTiles); + } + } + } + + TileIndex++; + } + } +} + +static void DrvRenderSprites(INT32 Priority) +{ + INT32 Offset; + UINT16 *SpriteRam = (UINT16*)DrvSpriteRamBuffer; + + for (Offset = 0x400 - 4; Offset >= 0; Offset -= 4) { + INT32 Attr, sy, sx, xFlip, yFlip, Code, Colour; + + Attr = SpriteRam[Offset + 1]; + if (DrvSpritePriMask) { + if (Priority == 1 && (Attr & DrvSpritePriMask)) continue; + if (Priority == 0 && !(Attr & DrvSpritePriMask)) continue; + } + + Code = SpriteRam[Offset] & 0xfff; + sx = SpriteRam[Offset + 3] & 0x1ff; + sy = SpriteRam[Offset + 2] & 0x1ff; + if (sy > 0x100) sy -= 0x200; + + xFlip = Attr & 0x20; + yFlip = Attr & DrvSpriteFlipYMask; + Colour = Attr & 0x0f; + + sx -= 64; + sy -= 8; + + if (sx > 16 && sx < 368 && sy > 16 && sy < 224) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); + } else { + Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0x0f, 0x200, DrvSprites); + } + } + } + } +} + +static void DrvRenderCharLayer() +{ + INT32 mx, my, Code, Colour, x, y, yFlip, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvVideoRam; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + yFlip = 0; + Code = VideoRam[TileIndex]; + Colour = Code >> 12; + if (Code & 0x800) yFlip = 1; + Code &= 0x7ff; + + x = 8 * mx; + y = 8 * my; + + x -= 64; + y -= 8; + + if (x > 0 && x < 376 && y > 8 && y < 232) { + if (yFlip) { + Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 2, 3, 0x300, DrvChars); + } else { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 3, 0x300, DrvChars); + } + } else { + if (yFlip) { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x300, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 3, 0x300, DrvChars); + } + } + + TileIndex++; + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + DrvRenderBgLayer(); + DrvRenderFgLayer(0); + DrvRenderSprites(0); + DrvRenderFgLayer(1); + DrvRenderSprites(1); + DrvRenderCharLayer(); + BurnTransferCopy(DrvPalette); +} + +static void LastduelDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + LastduelRenderBgLayer(); + LastduelRenderFgLayer(0); + DrvRenderSprites(0); + LastduelRenderFgLayer(1); + DrvRenderCharLayer(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 100; + + if (DrvReset) MadgearDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 10000000 / 60; + nCyclesTotal[1] = 3579545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 33 || i == 66) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + SekClose(); + + ZetOpen(0); + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) DrvDraw(); + + SekOpen(0); + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + SekClose(); + + memcpy(DrvSpriteRamBuffer, DrvSpriteRam, 0x800); + + return 0; +} + +static INT32 LastduelFrame() +{ + INT32 nInterleave = 100; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 10000000 / 60; + nCyclesTotal[1] = 3579545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 33 || i == 66) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + ZetOpen(0); + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) LastduelDraw(); + + SekOpen(0); + SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + SekClose(); + + memcpy(DrvSpriteRamBuffer, DrvSpriteRam, 0x800); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029672; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); // Scan Z80 + BurnYM2203Scan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(DrvZ80RomBank); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(DrvFgScrollX); + SCAN_VAR(DrvFgScrollY); + SCAN_VAR(DrvBgScrollX); + SCAN_VAR(DrvBgScrollY); + SCAN_VAR(DrvDip); + SCAN_VAR(DrvInput); + } + + return 0; +} + +static INT32 MadgearScan(INT32 nAction, INT32 *pnMin) +{ + INT32 i = DrvScan(nAction, pnMin); + + if (i == 0) { + if (nAction & ACB_DRIVER_DATA) { + MSM6295Scan(0, nAction); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x8000 + DrvZ80RomBank * 0x4000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x8000 + DrvZ80RomBank * 0x4000 ); + ZetClose(); + } + } + + return i; +} + +struct BurnDriver BurnDrvLastduel = { + "lastduel", NULL, NULL, NULL, "1988", + "Last Duel (US New Ver.)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, LastduelRomInfo, LastduelRomName, NULL, NULL, LastduelInputInfo, LastduelDIPInfo, + LastduelInit, DrvExit, LastduelFrame, NULL, DrvScan, + NULL, 0x800, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvLastduelo = { + "lastduelo", "lastduel", NULL, NULL, "1988", + "Last Duel (US Old Ver.)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, LastdueloRomInfo, LastdueloRomName, NULL, NULL, LastduelInputInfo, LastduelDIPInfo, + LastduelInit, DrvExit, LastduelFrame, NULL, DrvScan, + NULL, 0x800, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvLastduelj = { + "lastduelj", "lastduel", NULL, NULL, "1988", + "Last Duel (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, LastdueljRomInfo, LastdueljRomName, NULL, NULL, LastduelInputInfo, LastduelDIPInfo, + LastduelInit, DrvExit, LastduelFrame, NULL, DrvScan, + NULL, 0x800, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvLsstduelb = { + "lastduelb", "lastduel", NULL, NULL, "1988", + "Last Duel (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, LastduelbRomInfo, LastduelbRomName, NULL, NULL, LastduelInputInfo, LastduelDIPInfo, + LastduelbInit, DrvExit, LastduelFrame, NULL, DrvScan, + NULL, 0x800, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvMadgear = { + "madgear", NULL, NULL, NULL, "1989", + "Mad Gear (US)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, + NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, MadgearExit, DrvFrame, NULL, MadgearScan, + NULL, 0x800, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvMadgearj = { + "madgearj", "madgear", NULL, NULL, "1989", + "Mad Gear (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, + NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, MadgearExit, DrvFrame, NULL, MadgearScan, + NULL, 0x800, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvMadgearu = { + "ledstorm", "madgear", NULL, NULL, "1988", + "Led Storm (US)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, + NULL, DrvuRomInfo, DrvuRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, MadgearExit, DrvFrame, NULL, MadgearScan, + NULL, 0x800, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvLedstrm2 = { + "ledstorm2", "madgear", NULL, NULL, "1988", + "Led Storm Rally 2011 (US)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, + NULL, Ledstrm2RomInfo, Ledstrm2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + Ledstrm2Init, MadgearExit, DrvFrame, NULL, MadgearScan, + NULL, 0x800, 240, 384, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_marineb.cpp b/src/burn/drv/pre90s/d_marineb.cpp index 81c303802..441b1eb4b 100644 --- a/src/burn/drv/pre90s/d_marineb.cpp +++ b/src/burn/drv/pre90s/d_marineb.cpp @@ -1,839 +1,838 @@ -// Based on original MAME driver writen by Zsolt Vasvari - - -#include "tiles_generic.h" -#include "z80_intf.h" - -#include "driver.h" -extern "C" { - #include "ay8910.h" -} - -enum { SPRINGER = 0, MARINEB }; - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *RamStart; -static UINT8 *RamEnd; -static UINT32 *TempPalette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalcPalette; - -static UINT8 DrvInputPort0[8]; -static UINT8 DrvInputPort1[8]; -static UINT8 DrvInputPort2[8]; -static UINT8 DrvDip; -static UINT8 DrvInput[3]; -static UINT8 DrvReset; - -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvColPROM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvColRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; - -static UINT8 DrvPaletteBank; -static UINT8 DrvColumnScroll; -static UINT8 ActiveLowFlipscreen; -static UINT8 DrvFlipScreenY; -static UINT8 DrvFlipScreenX; -static INT32 DrvInterruptEnable; -static INT32 hardware; - -static INT16 *pAY8910Buffer[3]; - - - -static struct BurnInputInfo MarinebInputList[] = -{ - - {"P1 Coin" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 right" }, - {"P1 Fire" , BIT_DIGITAL , DrvInputPort2 + 4, "p1 fire 1" }, - - {"P2 Start" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 right" }, - {"P2 Fire" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip" , BIT_DIPSWITCH, &DrvDip , "dip" }, - -}; - -STDINPUTINFO(Marineb) - -static struct BurnDIPInfo MarinebDIPList[]= -{ - {0x0E, 0xFF, 0xFF, 0x40, NULL }, - - {0 , 0xFE, 0 , 4, "Lives" }, - {0x0E, 0x01, 0x03, 0x00, "3" }, - {0x0E, 0x01, 0x03, 0x01, "4" }, - {0x0E, 0x01, 0x03, 0x02, "5" }, - {0x0E, 0x01, 0x03, 0x03, "6" }, - - {0 , 0xFE, 0 , 2, "Coinage" }, - {0x0E, 0x01, 0x1C, 0x00, "1 Coin 1 Credit" }, - {0x0E, 0x01, 0x1C, 0x1C, "Free Play" }, - - {0 , 0xFE, 0 , 2, "Bonus Life" }, - {0x0E, 0x01, 0x20, 0x00, "20000 50000" }, - {0x0E, 0x01, 0x20, 0x20, "40000 70000" }, - - {0 , 0xFE, 0 , 2, "Cabinet" }, - {0x0E, 0x01, 0x40, 0x40, "Upright" }, - {0x0E, 0x01, 0x40, 0x00, "Cocktail" }, - -}; - -STDDIPINFO(Marineb) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x10000; - DrvColPROM = Next; Next += 0x200; - DrvGfxROM0 = Next; Next += 512 * 8 * 8; - DrvGfxROM1 = Next; Next += 64 * 16 * 16; - DrvGfxROM2 = Next; Next += 64 * 32 * 32; - - TempPalette = (UINT32*)Next; Next += 0x100 * sizeof(UINT32); // calculate one time - DrvPalette = (UINT32*)Next; Next += 0x100 * sizeof(UINT32); - - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - RamStart = Next; - - DrvZ80RAM = Next; Next += 0x800; - DrvVidRAM = Next; Next += 0x400; - DrvSprRAM = Next; Next += 0x100; - DrvColRAM = Next; Next += 0x400; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static void CleanAndInitStuff() -{ - DrvPaletteBank = 0; - DrvColumnScroll = 0; - DrvFlipScreenY = 0; - DrvFlipScreenX = 0; - DrvInterruptEnable = 0; - hardware = 0; - ActiveLowFlipscreen = 0; - - memset(DrvInputPort0, 0, 8); - memset(DrvInputPort1, 0, 8); - memset(DrvInputPort2, 0, 8); - memset(DrvInput, 0, 3); - - DrvDip = 0; - DrvReset = 0; -} - - -UINT8 __fastcall marineb_read(UINT16 address) -{ - switch (address) { - case 0xa800: - return DrvInput[0]; - - case 0xa000: - return DrvInput[1]; - - case 0xb000: - return DrvDip; - - case 0xb800: - return DrvInput[2]; - } - - return 0; -} - - -void __fastcall marineb_write(UINT16 address, UINT8 data) -{ - switch (address) { - - case 0x9800: - DrvColumnScroll = data; - return; - - case 0x9a00: - DrvPaletteBank = (DrvPaletteBank & 0x02) | (data & 0x01); - return; - - case 0x9c00: - DrvPaletteBank = (DrvPaletteBank & 0x01) | ((data & 0x01) << 1); - return; - - - case 0xa000: - DrvInterruptEnable = data; - return; - - case 0xa001: - DrvFlipScreenY = data ^ ActiveLowFlipscreen; - return; - - case 0xa002: - DrvFlipScreenX = data ^ ActiveLowFlipscreen; - return; - } -} - -void __fastcall marineb_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xFF) { - case 0x08: - case 0x09: - AY8910Write(0, port & 1, data); - break; - } -} - -static INT32 DrvDoReset() -{ - memset (RamStart, 0, RamEnd - RamStart); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - - DrvPaletteBank = 0; - DrvColumnScroll = 0; - DrvFlipScreenY = 0; - DrvFlipScreenX = 0; - DrvInterruptEnable = 0; - - return 0; -} - -static void DrvCreatePalette() -{ - for (INT32 i = 0; i < 256; i++) - { - INT32 bit0, bit1, bit2, r, g, b; - - // Red - bit0 = (DrvColPROM[i] >> 0) & 0x01; - bit1 = (DrvColPROM[i] >> 1) & 0x01; - bit2 = (DrvColPROM[i] >> 2) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - // Green - bit0 = (DrvColPROM[i] >> 3) & 0x01; - bit1 = (DrvColPROM[i + 256] >> 0) & 0x01; - bit2 = (DrvColPROM[i + 256] >> 1) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - // Blue - bit0 = 0; - bit1 = (DrvColPROM[i + 256] >> 2) & 0x01; - bit2 = (DrvColPROM[i + 256] >> 3) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - TempPalette[i] = (r << 16) | (g << 8) | (b << 0); - } -} - - -static INT32 MarinebCharPlane[2] = { 0, 4 }; -static INT32 MarinebCharXOffs[8] = { 0, 1, 2, 3, 64, 65, 66, 67 }; -static INT32 MarinebCharYOffs[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; - -static INT32 MarinebSmallSpriteCharPlane[2] = { 0, 65536 }; -static INT32 MarinebSmallSpriteXOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; -static INT32 MarinebSmallSpriteYOffs[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; - -static INT32 MarinebBigSpriteCharPlane[2] = { 0, 65536 }; -static INT32 MarinebBigSpriteXOffs[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71, 256, 257, 258, 259, 260, 261, 262, 263, 320, 321, 322, 323, 324, 325, 326, 327 }; -static INT32 MarinebBigSpriteYOffs[32] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184, 512, 520, 528, 536, 544, 552, 560, 568, 640, 648, 656, 664, 672, 680, 688, 696 }; - - -static INT32 MarinebLoadRoms() -{ - // Load roms - - // Z80 - for (INT32 i = 0; i < 5; i++) { - if (BurnLoadRom(DrvZ80ROM + (i * 0x1000), i, 1)) return 1; - } - - UINT8 *tmp = (UINT8*)BurnMalloc(0x4000); - if (tmp == NULL) return 1; - - // Chars - memset(tmp, 0, 0x2000); - if (BurnLoadRom(tmp, 5, 1)) return 1; - GfxDecode(0x200, 2, 8, 8, MarinebCharPlane, MarinebCharXOffs, MarinebCharYOffs, 0x80, tmp, DrvGfxROM0); - - // Sprites - memset(tmp, 0, 0x4000); - if (BurnLoadRom(tmp, 6, 1)) return 1; - if (BurnLoadRom(tmp + 0x2000, 7, 1)) return 1; - - // Small Sprites - GfxDecode(0x40, 2, 16, 16, MarinebSmallSpriteCharPlane, MarinebSmallSpriteXOffs, MarinebSmallSpriteYOffs, 0x100, tmp, DrvGfxROM1); - - // Big Sprites - GfxDecode(0x40, 2, 32, 32, MarinebBigSpriteCharPlane, MarinebBigSpriteXOffs, MarinebBigSpriteYOffs, 0x400, tmp, DrvGfxROM2); - - BurnFree(tmp); - - // ColorRoms - if (BurnLoadRom(DrvColPROM, 8, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x100, 9, 1)) return 1; - - return 0; -} - -static INT32 SpringerLoadRoms() -{ - // Load roms - - // Z80 - for (INT32 i = 0; i < 5; i++) { - if (BurnLoadRom(DrvZ80ROM + (i * 0x1000), i, 1)) return 1; - } - - UINT8 *tmp = (UINT8*)BurnMalloc(0x4000); - if (tmp == NULL) return 1; - - // Chars - memset(tmp, 0, 0x4000); - if (BurnLoadRom(tmp, 5, 1)) return 1; - if (BurnLoadRom(tmp + 0x1000, 6, 1)) return 1; - - GfxDecode(0x200, 2, 8, 8, MarinebCharPlane, MarinebCharXOffs, MarinebCharYOffs, 0x80, tmp, DrvGfxROM0); - - memset(tmp, 0, 0x4000); - if (BurnLoadRom(tmp, 7, 1)) return 1; - if (BurnLoadRom(tmp + 0x2000, 8, 1)) return 1; - - // Small Sprites - GfxDecode(0x40, 2, 16, 16, MarinebSmallSpriteCharPlane, MarinebSmallSpriteXOffs, MarinebSmallSpriteYOffs, 0x100, tmp, DrvGfxROM1); - // Big Sprites - GfxDecode(0x40, 2, 32, 32, MarinebBigSpriteCharPlane, MarinebBigSpriteXOffs, MarinebBigSpriteYOffs, 0x400, tmp, DrvGfxROM2); - - BurnFree(tmp); - - // ColorRoms - if (BurnLoadRom(DrvColPROM, 9, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x100, 10, 1)) return 1; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - switch(hardware) { - case MARINEB: - MarinebLoadRoms(); - break; - case SPRINGER: - SpringerLoadRoms(); - break; - } - - DrvCreatePalette(); - - ZetInit(0); - ZetOpen(0); - - ZetMapArea (0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea (0x0000, 0x7fff, 2, DrvZ80ROM); - - ZetMapArea (0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea (0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea (0x8000, 0x87ff, 2, DrvZ80RAM); - - ZetMapArea (0x8800, 0x8bff, 0, DrvVidRAM); - ZetMapArea (0x8800, 0x8bff, 1, DrvVidRAM); - ZetMapArea (0x8800, 0x8bff, 2, DrvVidRAM); - - ZetMapArea (0x8c00, 0x8c3f, 0, DrvSprRAM); - ZetMapArea (0x8c00, 0x8c3f, 1, DrvSprRAM); - ZetMapArea (0x8c00, 0x8c3f, 2, DrvSprRAM); - - ZetMapArea (0x9000, 0x93ff, 0, DrvColRAM); - ZetMapArea (0x9000, 0x93ff, 1, DrvColRAM); - ZetMapArea (0x9000, 0x93ff, 2, DrvColRAM); - - ZetSetReadHandler(marineb_read); - ZetSetWriteHandler(marineb_write); - ZetSetOutHandler(marineb_write_port); - - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - DrvDoReset(); - - return 0; - -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - ZetExit(); - AY8910Exit(0); - - BurnFree (AllMem); - - CleanAndInitStuff(); - - return 0; -} - -static void RenderMarinebBg() -{ - INT32 TileIndex = 0; - - for (INT32 my = 0; my < 32; my++) { - for (INT32 mx = 0; mx < 32; mx++) { - - TileIndex = (my * 32) + mx; - - INT32 code = DrvVidRAM[TileIndex]; - INT32 color = DrvColRAM[TileIndex]; - - code |= ((color & 0xc0) << 2); - - color &= 0x0f; - color |= DrvPaletteBank << 4; - - INT32 flipx = (color >> 4) & 0x02; - INT32 flipy = (color >> 4) & 0x01; - - INT32 x = mx << 3; - INT32 y = my << 3; - - // stuff from 192 to 256 does not scroll - if ((x >> 3) < 24) { - y -= DrvColumnScroll; - if (y < -7) y += 256; - } - - y -= 16; - - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); - } else { - Render8x8Tile_FlipY_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_FlipX_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); - } - } - } - } -} - - -static void RenderSpringerBg() -{ - INT32 TileIndex = 0; - - for (INT32 my = 0; my < 32; my++) { - for (INT32 mx = 0; mx < 32; mx++) { - - TileIndex = (my * 32) + mx; - - INT32 code = DrvVidRAM[TileIndex]; - INT32 color = DrvColRAM[TileIndex]; - - code |= ((color & 0xc0) << 2); - - color &= 0x0f; - color |= DrvPaletteBank << 4; - - INT32 flipx = (color >> 4) & 0x02; - INT32 flipy = (color >> 4) & 0x01; - - INT32 x = mx << 3; - INT32 y = my << 3; - - y -= 16; // remove garbage on left side - - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); - } else { - Render8x8Tile_FlipY_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_FlipX_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); - } - } - } - } -} - -static void MarinebDrawSprites() -{ - // Render Tiles - RenderMarinebBg(); - - for (INT32 offs = 0x0f; offs >= 0; offs--) { - - INT32 gfx, sx, sy, code, color, flipx, flipy, offs2; - - if ((offs == 0) || (offs == 2)) - continue; - - if (offs < 8) { - offs2 = 0x0018 + offs; - } else { - offs2 = 0x03d8 - 8 + offs; - } - - code = DrvVidRAM[offs2]; - sx = DrvVidRAM[offs2 + 0x20]; - sy = DrvColRAM[offs2]; - color = (DrvColRAM[offs2 + 0x20] & 0x0f) + 16 * DrvPaletteBank; - flipx = code & 0x02; - flipy = !(code & 0x01); - - if (offs < 4) { - gfx = 2; - code = (code >> 4) | ((code & 0x0c) << 2); - } else { - gfx = 1; - code >>= 2; - } - - if (!DrvFlipScreenY) { - - if (gfx == 1) { - sy = 256 - 16 - sy; - } else { - sy = 256 - 32 - sy; - } - flipy = !flipy; - } - - if (DrvFlipScreenX) { - sx++; - } - - sy -= 16; // proper alignement - - // Small Sprites - if (gfx == 1) { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } - } - // Big sprites - } else { - if (flipy) { - if (flipx) { - Render32x32Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } else { - Render32x32Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } - } else { - if (flipx) { - Render32x32Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } else { - Render32x32Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } - } - } - } -} - -static void SpringerDrawSprites() -{ - // Render Tiles - RenderSpringerBg(); - - for (INT32 offs = 0x0f; offs >= 0; offs--) - { - INT32 gfx, sx, sy, code, color, flipx, flipy, offs2; - - if ((offs == 0) || (offs == 2)) - continue; - - offs2 = 0x0010 + offs; - - code = DrvVidRAM[offs2]; - sx = 240 - DrvVidRAM[offs2 + 0x20]; - sy = DrvColRAM[offs2]; - color = (DrvColRAM[offs2 + 0x20] & 0x0f) + 16 * DrvPaletteBank; - flipx = !(code & 0x02); - flipy = !(code & 0x01); - - if (offs < 4) - { - sx -= 0x10; - gfx = 2; - code = (code >> 4) | ((code & 0x0c) << 2); - } - else - { - gfx = 1; - code >>= 2; - } - - if (!DrvFlipScreenY) { - - if (gfx == 1) { - sy = 256 - 16 - sy; - } else { - sy = 256 - 32 - sy; - } - flipy = !flipy; - } - - if (!DrvFlipScreenX) - { - sx--; - } - - sy -= 16; // proper alignement - - // Small Sprites - if (gfx == 1) { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); - } - } - // Big Sprites - } else { - if (flipy) { - if (flipx) { - Render32x32Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } else { - Render32x32Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } - } else { - if (flipx) { - Render32x32Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } else { - Render32x32Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); - } - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalcPalette) { - for (INT32 i = 0; i < 256; i++) { - UINT32 tmp = TempPalette[i]; - // Recalc Colors - DrvPalette[i] = BurnHighCol((tmp >> 16) & 0xFF, (tmp >> 8) & 0xFF, tmp & 0xFF, 0); - } - DrvRecalcPalette = 0; - } - - switch(hardware) { - case MARINEB: - MarinebDrawSprites(); - break; - - case SPRINGER: - SpringerDrawSprites(); - break; - } - - BurnTransferCopy(DrvPalette); - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - DrvInput[0] = DrvInput[1] = DrvInput[2] = 0; - - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - } - - ZetOpen(0); - ZetRun(3072000 / 60); - - if (DrvInterruptEnable) ZetNmi(); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029708; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - AY8910Scan(nAction, pnMin); - } - - - return 0; -} - -static INT32 MarinebInit() -{ - CleanAndInitStuff(); - hardware = MARINEB; - - return DrvInit(); -} - -static INT32 SpringerInit() -{ - CleanAndInitStuff(); - - ActiveLowFlipscreen = 1; - hardware = SPRINGER; - - return DrvInit(); -} - -// Marine Boy - -static struct BurnRomInfo MarinebRomDesc[] = { - - { "marineb.1", 0x1000, 0x661d6540, BRF_ESS | BRF_PRG }, // 0 maincpu - { "marineb.2", 0x1000, 0x922da17f, BRF_ESS | BRF_PRG }, // 1 - { "marineb.3", 0x1000, 0x820a235b, BRF_ESS | BRF_PRG }, // 2 - { "marineb.4", 0x1000, 0xa157a283, BRF_ESS | BRF_PRG }, // 3 - { "marineb.5", 0x1000, 0x9ffff9c0, BRF_ESS | BRF_PRG }, // 4 - - { "marineb.6", 0x2000, 0xee53ec2e, BRF_GRA }, // 5 gfx1 - - { "marineb.8", 0x2000, 0xdc8bc46c, BRF_GRA }, // 6 gfx2 - { "marineb.7", 0x2000, 0x9d2e19ab, BRF_GRA }, // 7 - - { "marineb.1b", 0x100, 0xf32d9472, BRF_GRA }, // 8 proms - { "marineb.1c", 0x100, 0x93c69d3e, BRF_GRA }, // 9 -}; - -STD_ROM_PICK(Marineb) -STD_ROM_FN(Marineb) - -struct BurnDriver BurnDrvMarineb = { - "marineb", NULL, NULL, NULL, "1982", - "Marine Boy\0", NULL, "Orca", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, 0, 0, - NULL, MarinebRomInfo, MarinebRomName, NULL, NULL, MarinebInputInfo, MarinebDIPInfo, - MarinebInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalcPalette, 0x100, 256, 224, 4, 3 -}; - -// Springer - -static struct BurnRomInfo SpringerRomDesc[] = { - - { "springer.1", 0x1000, 0x0794103a, BRF_ESS | BRF_PRG }, // 0 maincpu - { "springer.2", 0x1000, 0xf4aecd9a, BRF_ESS | BRF_PRG }, // 1 - { "springer.3", 0x1000, 0x2f452371, BRF_ESS | BRF_PRG }, // 2 - { "springer.4", 0x1000, 0x859d1bf5, BRF_ESS | BRF_PRG }, // 3 - { "springer.5", 0x1000, 0x72adbbe3, BRF_ESS | BRF_PRG }, // 4 - - { "springer.6", 0x1000, 0x6a961833, BRF_GRA }, // 5 gfx1 - { "springer.7", 0x1000, 0x95ab8fc0, BRF_GRA }, // 6 - - { "springer.8", 0x1000, 0xa54bafdc, BRF_GRA }, // 7 gfx2 - { "springer.9", 0x1000, 0xfa302775, BRF_GRA }, // 8 - - { "1b.vid", 0x100, 0xa2f935aa, BRF_GRA }, // 9 proms - { "1c.vid", 0x100, 0xb95421f4, BRF_GRA }, // 10 -}; - -STD_ROM_PICK(Springer) -STD_ROM_FN(Springer) - -struct BurnDriver BurnDrvSpringer = { - "springer", NULL, NULL, NULL, "1982", - "Springer\0", NULL, "Orca", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, 0, 0, - NULL, SpringerRomInfo, SpringerRomName, NULL, NULL, MarinebInputInfo, MarinebDIPInfo, - SpringerInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalcPalette, 0x100, 224, 256, 3, 4 -}; - +// Based on original MAME driver writen by Zsolt Vasvari + + +#include "tiles_generic.h" +#include "z80_intf.h" + +#include "driver.h" +extern "C" { + #include "ay8910.h" +} + +enum { SPRINGER = 0, MARINEB }; + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *RamStart; +static UINT8 *RamEnd; +static UINT32 *TempPalette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalcPalette; + +static UINT8 DrvInputPort0[8]; +static UINT8 DrvInputPort1[8]; +static UINT8 DrvInputPort2[8]; +static UINT8 DrvDip; +static UINT8 DrvInput[3]; +static UINT8 DrvReset; + +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvColPROM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvColRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; + +static UINT8 DrvPaletteBank; +static UINT8 DrvColumnScroll; +static UINT8 ActiveLowFlipscreen; +static UINT8 DrvFlipScreenY; +static UINT8 DrvFlipScreenX; +static INT32 DrvInterruptEnable; +static INT32 hardware; + +static INT16 *pAY8910Buffer[3]; + + + +static struct BurnInputInfo MarinebInputList[] = +{ + + {"P1 Coin" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 right" }, + {"P1 Fire" , BIT_DIGITAL , DrvInputPort2 + 4, "p1 fire 1" }, + + {"P2 Start" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 right" }, + {"P2 Fire" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip" , BIT_DIPSWITCH, &DrvDip , "dip" }, + +}; + +STDINPUTINFO(Marineb) + +static struct BurnDIPInfo MarinebDIPList[]= +{ + {0x0E, 0xFF, 0xFF, 0x40, NULL }, + + {0 , 0xFE, 0 , 4, "Lives" }, + {0x0E, 0x01, 0x03, 0x00, "3" }, + {0x0E, 0x01, 0x03, 0x01, "4" }, + {0x0E, 0x01, 0x03, 0x02, "5" }, + {0x0E, 0x01, 0x03, 0x03, "6" }, + + {0 , 0xFE, 0 , 2, "Coinage" }, + {0x0E, 0x01, 0x1C, 0x00, "1 Coin 1 Credit" }, + {0x0E, 0x01, 0x1C, 0x1C, "Free Play" }, + + {0 , 0xFE, 0 , 2, "Bonus Life" }, + {0x0E, 0x01, 0x20, 0x00, "20000 50000" }, + {0x0E, 0x01, 0x20, 0x20, "40000 70000" }, + + {0 , 0xFE, 0 , 2, "Cabinet" }, + {0x0E, 0x01, 0x40, 0x40, "Upright" }, + {0x0E, 0x01, 0x40, 0x00, "Cocktail" }, + +}; + +STDDIPINFO(Marineb) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x10000; + DrvColPROM = Next; Next += 0x200; + DrvGfxROM0 = Next; Next += 512 * 8 * 8; + DrvGfxROM1 = Next; Next += 64 * 16 * 16; + DrvGfxROM2 = Next; Next += 64 * 32 * 32; + + TempPalette = (UINT32*)Next; Next += 0x100 * sizeof(UINT32); // calculate one time + DrvPalette = (UINT32*)Next; Next += 0x100 * sizeof(UINT32); + + pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + RamStart = Next; + + DrvZ80RAM = Next; Next += 0x800; + DrvVidRAM = Next; Next += 0x400; + DrvSprRAM = Next; Next += 0x100; + DrvColRAM = Next; Next += 0x400; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static void CleanAndInitStuff() +{ + DrvPaletteBank = 0; + DrvColumnScroll = 0; + DrvFlipScreenY = 0; + DrvFlipScreenX = 0; + DrvInterruptEnable = 0; + hardware = 0; + ActiveLowFlipscreen = 0; + + memset(DrvInputPort0, 0, 8); + memset(DrvInputPort1, 0, 8); + memset(DrvInputPort2, 0, 8); + memset(DrvInput, 0, 3); + + DrvDip = 0; + DrvReset = 0; +} + + +UINT8 __fastcall marineb_read(UINT16 address) +{ + switch (address) { + case 0xa800: + return DrvInput[0]; + + case 0xa000: + return DrvInput[1]; + + case 0xb000: + return DrvDip; + + case 0xb800: + return DrvInput[2]; + } + + return 0; +} + + +void __fastcall marineb_write(UINT16 address, UINT8 data) +{ + switch (address) { + + case 0x9800: + DrvColumnScroll = data; + return; + + case 0x9a00: + DrvPaletteBank = (DrvPaletteBank & 0x02) | (data & 0x01); + return; + + case 0x9c00: + DrvPaletteBank = (DrvPaletteBank & 0x01) | ((data & 0x01) << 1); + return; + + + case 0xa000: + DrvInterruptEnable = data; + return; + + case 0xa001: + DrvFlipScreenY = data ^ ActiveLowFlipscreen; + return; + + case 0xa002: + DrvFlipScreenX = data ^ ActiveLowFlipscreen; + return; + } +} + +void __fastcall marineb_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xFF) { + case 0x08: + case 0x09: + AY8910Write(0, port & 1, data); + break; + } +} + +static INT32 DrvDoReset() +{ + memset (RamStart, 0, RamEnd - RamStart); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + + DrvPaletteBank = 0; + DrvColumnScroll = 0; + DrvFlipScreenY = 0; + DrvFlipScreenX = 0; + DrvInterruptEnable = 0; + + return 0; +} + +static void DrvCreatePalette() +{ + for (INT32 i = 0; i < 256; i++) + { + INT32 bit0, bit1, bit2, r, g, b; + + // Red + bit0 = (DrvColPROM[i] >> 0) & 0x01; + bit1 = (DrvColPROM[i] >> 1) & 0x01; + bit2 = (DrvColPROM[i] >> 2) & 0x01; + r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + // Green + bit0 = (DrvColPROM[i] >> 3) & 0x01; + bit1 = (DrvColPROM[i + 256] >> 0) & 0x01; + bit2 = (DrvColPROM[i + 256] >> 1) & 0x01; + g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + // Blue + bit0 = 0; + bit1 = (DrvColPROM[i + 256] >> 2) & 0x01; + bit2 = (DrvColPROM[i + 256] >> 3) & 0x01; + b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + TempPalette[i] = (r << 16) | (g << 8) | (b << 0); + } +} + + +static INT32 MarinebCharPlane[2] = { 0, 4 }; +static INT32 MarinebCharXOffs[8] = { 0, 1, 2, 3, 64, 65, 66, 67 }; +static INT32 MarinebCharYOffs[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; + +static INT32 MarinebSmallSpriteCharPlane[2] = { 0, 65536 }; +static INT32 MarinebSmallSpriteXOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; +static INT32 MarinebSmallSpriteYOffs[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; + +static INT32 MarinebBigSpriteCharPlane[2] = { 0, 65536 }; +static INT32 MarinebBigSpriteXOffs[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71, 256, 257, 258, 259, 260, 261, 262, 263, 320, 321, 322, 323, 324, 325, 326, 327 }; +static INT32 MarinebBigSpriteYOffs[32] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184, 512, 520, 528, 536, 544, 552, 560, 568, 640, 648, 656, 664, 672, 680, 688, 696 }; + + +static INT32 MarinebLoadRoms() +{ + // Load roms + + // Z80 + for (INT32 i = 0; i < 5; i++) { + if (BurnLoadRom(DrvZ80ROM + (i * 0x1000), i, 1)) return 1; + } + + UINT8 *tmp = (UINT8*)BurnMalloc(0x4000); + if (tmp == NULL) return 1; + + // Chars + memset(tmp, 0, 0x2000); + if (BurnLoadRom(tmp, 5, 1)) return 1; + GfxDecode(0x200, 2, 8, 8, MarinebCharPlane, MarinebCharXOffs, MarinebCharYOffs, 0x80, tmp, DrvGfxROM0); + + // Sprites + memset(tmp, 0, 0x4000); + if (BurnLoadRom(tmp, 6, 1)) return 1; + if (BurnLoadRom(tmp + 0x2000, 7, 1)) return 1; + + // Small Sprites + GfxDecode(0x40, 2, 16, 16, MarinebSmallSpriteCharPlane, MarinebSmallSpriteXOffs, MarinebSmallSpriteYOffs, 0x100, tmp, DrvGfxROM1); + + // Big Sprites + GfxDecode(0x40, 2, 32, 32, MarinebBigSpriteCharPlane, MarinebBigSpriteXOffs, MarinebBigSpriteYOffs, 0x400, tmp, DrvGfxROM2); + + BurnFree(tmp); + + // ColorRoms + if (BurnLoadRom(DrvColPROM, 8, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x100, 9, 1)) return 1; + + return 0; +} + +static INT32 SpringerLoadRoms() +{ + // Load roms + + // Z80 + for (INT32 i = 0; i < 5; i++) { + if (BurnLoadRom(DrvZ80ROM + (i * 0x1000), i, 1)) return 1; + } + + UINT8 *tmp = (UINT8*)BurnMalloc(0x4000); + if (tmp == NULL) return 1; + + // Chars + memset(tmp, 0, 0x4000); + if (BurnLoadRom(tmp, 5, 1)) return 1; + if (BurnLoadRom(tmp + 0x1000, 6, 1)) return 1; + + GfxDecode(0x200, 2, 8, 8, MarinebCharPlane, MarinebCharXOffs, MarinebCharYOffs, 0x80, tmp, DrvGfxROM0); + + memset(tmp, 0, 0x4000); + if (BurnLoadRom(tmp, 7, 1)) return 1; + if (BurnLoadRom(tmp + 0x2000, 8, 1)) return 1; + + // Small Sprites + GfxDecode(0x40, 2, 16, 16, MarinebSmallSpriteCharPlane, MarinebSmallSpriteXOffs, MarinebSmallSpriteYOffs, 0x100, tmp, DrvGfxROM1); + // Big Sprites + GfxDecode(0x40, 2, 32, 32, MarinebBigSpriteCharPlane, MarinebBigSpriteXOffs, MarinebBigSpriteYOffs, 0x400, tmp, DrvGfxROM2); + + BurnFree(tmp); + + // ColorRoms + if (BurnLoadRom(DrvColPROM, 9, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x100, 10, 1)) return 1; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + switch(hardware) { + case MARINEB: + MarinebLoadRoms(); + break; + case SPRINGER: + SpringerLoadRoms(); + break; + } + + DrvCreatePalette(); + + ZetInit(0); + ZetOpen(0); + + ZetMapArea (0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea (0x0000, 0x7fff, 2, DrvZ80ROM); + + ZetMapArea (0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea (0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea (0x8000, 0x87ff, 2, DrvZ80RAM); + + ZetMapArea (0x8800, 0x8bff, 0, DrvVidRAM); + ZetMapArea (0x8800, 0x8bff, 1, DrvVidRAM); + ZetMapArea (0x8800, 0x8bff, 2, DrvVidRAM); + + ZetMapArea (0x8c00, 0x8c3f, 0, DrvSprRAM); + ZetMapArea (0x8c00, 0x8c3f, 1, DrvSprRAM); + ZetMapArea (0x8c00, 0x8c3f, 2, DrvSprRAM); + + ZetMapArea (0x9000, 0x93ff, 0, DrvColRAM); + ZetMapArea (0x9000, 0x93ff, 1, DrvColRAM); + ZetMapArea (0x9000, 0x93ff, 2, DrvColRAM); + + ZetSetReadHandler(marineb_read); + ZetSetWriteHandler(marineb_write); + ZetSetOutHandler(marineb_write_port); + + ZetClose(); + + AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + DrvDoReset(); + + return 0; + +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + ZetExit(); + AY8910Exit(0); + + BurnFree (AllMem); + + CleanAndInitStuff(); + + return 0; +} + +static void RenderMarinebBg() +{ + INT32 TileIndex = 0; + + for (INT32 my = 0; my < 32; my++) { + for (INT32 mx = 0; mx < 32; mx++) { + + TileIndex = (my * 32) + mx; + + INT32 code = DrvVidRAM[TileIndex]; + INT32 color = DrvColRAM[TileIndex]; + + code |= ((color & 0xc0) << 2); + + color &= 0x0f; + color |= DrvPaletteBank << 4; + + INT32 flipx = (color >> 4) & 0x02; + INT32 flipy = (color >> 4) & 0x01; + + INT32 x = mx << 3; + INT32 y = my << 3; + + // stuff from 192 to 256 does not scroll + if ((x >> 3) < 24) { + y -= DrvColumnScroll; + if (y < -7) y += 256; + } + + y -= 16; + + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); + } else { + Render8x8Tile_FlipY_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_FlipX_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); + } + } + } + } +} + + +static void RenderSpringerBg() +{ + INT32 TileIndex = 0; + + for (INT32 my = 0; my < 32; my++) { + for (INT32 mx = 0; mx < 32; mx++) { + + TileIndex = (my * 32) + mx; + + INT32 code = DrvVidRAM[TileIndex]; + INT32 color = DrvColRAM[TileIndex]; + + code |= ((color & 0xc0) << 2); + + color &= 0x0f; + color |= DrvPaletteBank << 4; + + INT32 flipx = (color >> 4) & 0x02; + INT32 flipy = (color >> 4) & 0x01; + + INT32 x = mx << 3; + INT32 y = my << 3; + + y -= 16; // remove garbage on left side + + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); + } else { + Render8x8Tile_FlipY_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_FlipX_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, x, y, color, 2, 0, DrvGfxROM0); + } + } + } + } +} + +static void MarinebDrawSprites() +{ + // Render Tiles + RenderMarinebBg(); + + for (INT32 offs = 0x0f; offs >= 0; offs--) { + + INT32 gfx, sx, sy, code, color, flipx, flipy, offs2; + + if ((offs == 0) || (offs == 2)) + continue; + + if (offs < 8) { + offs2 = 0x0018 + offs; + } else { + offs2 = 0x03d8 - 8 + offs; + } + + code = DrvVidRAM[offs2]; + sx = DrvVidRAM[offs2 + 0x20]; + sy = DrvColRAM[offs2]; + color = (DrvColRAM[offs2 + 0x20] & 0x0f) + 16 * DrvPaletteBank; + flipx = code & 0x02; + flipy = !(code & 0x01); + + if (offs < 4) { + gfx = 2; + code = (code >> 4) | ((code & 0x0c) << 2); + } else { + gfx = 1; + code >>= 2; + } + + if (!DrvFlipScreenY) { + + if (gfx == 1) { + sy = 256 - 16 - sy; + } else { + sy = 256 - 32 - sy; + } + flipy = !flipy; + } + + if (DrvFlipScreenX) { + sx++; + } + + sy -= 16; // proper alignement + + // Small Sprites + if (gfx == 1) { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } + } + // Big sprites + } else { + if (flipy) { + if (flipx) { + Render32x32Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } else { + Render32x32Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } + } else { + if (flipx) { + Render32x32Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } else { + Render32x32Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } + } + } + } +} + +static void SpringerDrawSprites() +{ + // Render Tiles + RenderSpringerBg(); + + for (INT32 offs = 0x0f; offs >= 0; offs--) + { + INT32 gfx, sx, sy, code, color, flipx, flipy, offs2; + + if ((offs == 0) || (offs == 2)) + continue; + + offs2 = 0x0010 + offs; + + code = DrvVidRAM[offs2]; + sx = 240 - DrvVidRAM[offs2 + 0x20]; + sy = DrvColRAM[offs2]; + color = (DrvColRAM[offs2 + 0x20] & 0x0f) + 16 * DrvPaletteBank; + flipx = !(code & 0x02); + flipy = !(code & 0x01); + + if (offs < 4) + { + sx -= 0x10; + gfx = 2; + code = (code >> 4) | ((code & 0x0c) << 2); + } + else + { + gfx = 1; + code >>= 2; + } + + if (!DrvFlipScreenY) { + + if (gfx == 1) { + sy = 256 - 16 - sy; + } else { + sy = 256 - 32 - sy; + } + flipy = !flipy; + } + + if (!DrvFlipScreenX) + { + sx--; + } + + sy -= 16; // proper alignement + + // Small Sprites + if (gfx == 1) { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM1); + } + } + // Big Sprites + } else { + if (flipy) { + if (flipx) { + Render32x32Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } else { + Render32x32Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } + } else { + if (flipx) { + Render32x32Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } else { + Render32x32Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 0, 0, DrvGfxROM2); + } + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalcPalette) { + for (INT32 i = 0; i < 256; i++) { + UINT32 tmp = TempPalette[i]; + // Recalc Colors + DrvPalette[i] = BurnHighCol((tmp >> 16) & 0xFF, (tmp >> 8) & 0xFF, tmp & 0xFF, 0); + } + DrvRecalcPalette = 0; + } + + switch(hardware) { + case MARINEB: + MarinebDrawSprites(); + break; + + case SPRINGER: + SpringerDrawSprites(); + break; + } + + BurnTransferCopy(DrvPalette); + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + DrvInput[0] = DrvInput[1] = DrvInput[2] = 0; + + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + } + + ZetOpen(0); + ZetRun(3072000 / 60); + + if (DrvInterruptEnable) ZetNmi(); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029708; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + AY8910Scan(nAction, pnMin); + } + + + return 0; +} + +static INT32 MarinebInit() +{ + CleanAndInitStuff(); + hardware = MARINEB; + + return DrvInit(); +} + +static INT32 SpringerInit() +{ + CleanAndInitStuff(); + + ActiveLowFlipscreen = 1; + hardware = SPRINGER; + + return DrvInit(); +} + +// Marine Boy + +static struct BurnRomInfo MarinebRomDesc[] = { + + { "marineb.1", 0x1000, 0x661d6540, BRF_ESS | BRF_PRG }, // 0 maincpu + { "marineb.2", 0x1000, 0x922da17f, BRF_ESS | BRF_PRG }, // 1 + { "marineb.3", 0x1000, 0x820a235b, BRF_ESS | BRF_PRG }, // 2 + { "marineb.4", 0x1000, 0xa157a283, BRF_ESS | BRF_PRG }, // 3 + { "marineb.5", 0x1000, 0x9ffff9c0, BRF_ESS | BRF_PRG }, // 4 + + { "marineb.6", 0x2000, 0xee53ec2e, BRF_GRA }, // 5 gfx1 + + { "marineb.8", 0x2000, 0xdc8bc46c, BRF_GRA }, // 6 gfx2 + { "marineb.7", 0x2000, 0x9d2e19ab, BRF_GRA }, // 7 + + { "marineb.1b", 0x100, 0xf32d9472, BRF_GRA }, // 8 proms + { "marineb.1c", 0x100, 0x93c69d3e, BRF_GRA }, // 9 +}; + +STD_ROM_PICK(Marineb) +STD_ROM_FN(Marineb) + +struct BurnDriver BurnDrvMarineb = { + "marineb", NULL, NULL, NULL, "1982", + "Marine Boy\0", NULL, "Orca", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, 0, 0, + NULL, MarinebRomInfo, MarinebRomName, NULL, NULL, MarinebInputInfo, MarinebDIPInfo, + MarinebInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalcPalette, 0x100, 256, 224, 4, 3 +}; + +// Springer + +static struct BurnRomInfo SpringerRomDesc[] = { + + { "springer.1", 0x1000, 0x0794103a, BRF_ESS | BRF_PRG }, // 0 maincpu + { "springer.2", 0x1000, 0xf4aecd9a, BRF_ESS | BRF_PRG }, // 1 + { "springer.3", 0x1000, 0x2f452371, BRF_ESS | BRF_PRG }, // 2 + { "springer.4", 0x1000, 0x859d1bf5, BRF_ESS | BRF_PRG }, // 3 + { "springer.5", 0x1000, 0x72adbbe3, BRF_ESS | BRF_PRG }, // 4 + + { "springer.6", 0x1000, 0x6a961833, BRF_GRA }, // 5 gfx1 + { "springer.7", 0x1000, 0x95ab8fc0, BRF_GRA }, // 6 + + { "springer.8", 0x1000, 0xa54bafdc, BRF_GRA }, // 7 gfx2 + { "springer.9", 0x1000, 0xfa302775, BRF_GRA }, // 8 + + { "1b.vid", 0x100, 0xa2f935aa, BRF_GRA }, // 9 proms + { "1c.vid", 0x100, 0xb95421f4, BRF_GRA }, // 10 +}; + +STD_ROM_PICK(Springer) +STD_ROM_FN(Springer) + +struct BurnDriver BurnDrvSpringer = { + "springer", NULL, NULL, NULL, "1982", + "Springer\0", NULL, "Orca", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, 0, 0, + NULL, SpringerRomInfo, SpringerRomName, NULL, NULL, MarinebInputInfo, MarinebDIPInfo, + SpringerInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalcPalette, 0x100, 224, 256, 3, 4 +}; + diff --git a/src/burn/drv/pre90s/d_markham.cpp b/src/burn/drv/pre90s/d_markham.cpp index 28e0e5b2a..5a04295e6 100644 --- a/src/burn/drv/pre90s/d_markham.cpp +++ b/src/burn/drv/pre90s/d_markham.cpp @@ -1,535 +1,533 @@ - // FB Alpha Markham driver module -// Based on MAME driver by Uki - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "sn76496.h" - -static UINT8 *AllMem; -static UINT8 *AllRam; -static UINT8 *MemEnd; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvColPROM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvVidRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvShareRAM; - -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *scroll; - -static UINT8 flipscreen; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo MarkhamInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 7, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Markham) - -static struct BurnDIPInfo MarkhamDIPList[]= -{ - {0x12, 0xff, 0xff, 0x02, NULL }, - {0x13, 0xff, 0xff, 0x7e, NULL }, - {0x14, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x12, 0x01, 0x01, 0x00, "3" }, - {0x12, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x02, 0x02, "Upright" }, - {0x12, 0x01, 0x02, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x12, 0x01, 0x04, 0x00, "Off" }, - {0x12, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Chutes" }, - {0x12, 0x01, 0x08, 0x00, "Individual" }, - {0x12, 0x01, 0x08, 0x08, "Common" }, - - {0 , 0xfe, 0 , 16, "Coin1 / Coin2" }, - {0x12, 0x01, 0xf0, 0x00, "1C 1C / 1C 1C" }, - {0x12, 0x01, 0xf0, 0x10, "2C 1C / 2C 1C" }, - {0x12, 0x01, 0xf0, 0x20, "2C 1C / 1C 3C" }, - {0x12, 0x01, 0xf0, 0x30, "1C 1C / 1C 2C" }, - {0x12, 0x01, 0xf0, 0x40, "1C 1C / 1C 3C" }, - {0x12, 0x01, 0xf0, 0x50, "1C 1C / 1C 4C" }, - {0x12, 0x01, 0xf0, 0x60, "1C 1C / 1C 5C" }, - {0x12, 0x01, 0xf0, 0x70, "1C 1C / 1C 6C" }, - {0x12, 0x01, 0xf0, 0x80, "1C 2C / 1C 2C" }, - {0x12, 0x01, 0xf0, 0x90, "1C 2C / 1C 4C" }, - {0x12, 0x01, 0xf0, 0xa0, "1C 2C / 1C 5C" }, - {0x12, 0x01, 0xf0, 0xb0, "1C 2C / 1C 10C" }, - {0x12, 0x01, 0xf0, 0xc0, "1C 2C / 1C 11C" }, - {0x12, 0x01, 0xf0, 0xd0, "1C 2C / 1C 12C" }, - {0x12, 0x01, 0xf0, 0xe0, "1C 2C / 1C 6C" }, - {0x12, 0x01, 0xf0, 0xf0, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x03, 0x00, "None" }, - {0x13, 0x01, 0x03, 0x01, "20000" }, - {0x13, 0x01, 0x03, 0x02, "20000, Every 50000" }, - {0x13, 0x01, 0x03, 0x03, "20000, Every 80000" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x04, 0x00, "Off" }, - {0x13, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x13, 0x01, 0x80, 0x00, "Off" }, - {0x13, 0x01, 0x80, 0x80, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x10, 0x00, "Off" }, - {0x14, 0x01, 0x10, 0x10, "On" }, -}; - -STDDIPINFO(Markham) - -void __fastcall markham_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe00c: - scroll[0] = data; - return; - - case 0xe00d: - scroll[1] = data; - return; - - case 0xe00e: - flipscreen = data & 1; - return; - } -} - -UINT8 __fastcall markham_main_read(UINT16 address) -{ - switch (address) - { - case 0xe000: - return DrvDips[1]; - - case 0xe001: - return DrvDips[0]; - - case 0xe002: - return DrvInputs[0]; - - case 0xe003: - return DrvInputs[1]; - - case 0xe005: - return (DrvInputs[2] & ~0x10) | (DrvDips[2] & 0x10); - } - - return 0; -} - -void __fastcall markham_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc000: - SN76496Write(0, data); - return; - - case 0xc001: - SN76496Write(1, data); - return; - } -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - flipscreen = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x006000; - DrvZ80ROM1 = Next; Next += 0x006000; - - DrvGfxROM0 = Next; Next += 0x010000; - DrvGfxROM1 = Next; Next += 0x010000; - - DrvColPROM = Next; Next += 0x000700; - - Palette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x000800; - DrvVidRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x000800; - DrvShareRAM = Next; Next += 0x000800; - - scroll = Next; Next += 0x000002; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[3] = { 0x00000, 0x10000, 0x20000 }; - INT32 XOffs[16] = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80 }; - INT32 YOffs[16] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x6000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x6000); - - GfxDecode(0x0100, 3, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x6000); - - GfxDecode(0x0400, 3, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0; i < 0x100; i++) - { - INT32 r = DrvColPROM[i + 0x000] & 0x0f; - INT32 g = DrvColPROM[i + 0x100] & 0x0f; - INT32 b = DrvColPROM[i + 0x200] & 0x0f; - - DrvPalette[i] = (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | (b << 0); - } - - for (INT32 i = 0; i < 0x400; i++) { - Palette[i] = DrvPalette[DrvColPROM[0x300 + i]]; - } - - DrvRecalc = 1; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x04000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x02000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x04000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x02000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x04000, 10, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00000, 11, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00100, 12, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00200, 13, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00300, 14, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00500, 15, 1)) return 1; - - DrvGfxDecode(); - DrvPaletteInit(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM0); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM0); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM0); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM0); - ZetMapArea(0xc800, 0xcfff, 0, DrvSprRAM); - ZetMapArea(0xc800, 0xcfff, 1, DrvSprRAM); - ZetMapArea(0xc800, 0xcfff, 2, DrvSprRAM); - ZetMapArea(0xd000, 0xd7ff, 0, DrvVidRAM); - ZetMapArea(0xd000, 0xd7ff, 1, DrvVidRAM); - ZetMapArea(0xd000, 0xd7ff, 2, DrvVidRAM); - ZetMapArea(0xd800, 0xdfff, 0, DrvShareRAM); - ZetMapArea(0xd800, 0xdfff, 1, DrvShareRAM); - ZetMapArea(0xd800, 0xdfff, 2, DrvShareRAM); - ZetSetWriteHandler(markham_main_write); - ZetSetReadHandler(markham_main_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM1); - ZetMapArea(0x8000, 0x87ff, 0, DrvShareRAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvShareRAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvShareRAM); - ZetSetWriteHandler(markham_sound_write); - ZetMemEnd(); - ZetClose(); - - SN76496Init(0, 4000000, 0); - SN76496Init(1, 4000000, 1); - SN76496SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 0.75, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - - SN76496Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_background_layer() -{ - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs >> 5) << 3; - INT32 sy = (offs & 0x1f) << 3; - - if (sy >= 32 && sy < 128) sx -= scroll[0]; - if (sy >= 128 && sy < 256) sx -= scroll[1]; - - if (sx < -7) sx += 256; - - INT32 attr = DrvVidRAM[offs * 2 + 0]; - INT32 code = DrvVidRAM[offs * 2 + 1] | ((attr & 0x60) << 3); - INT32 color = (attr & 0x1f) | ((attr & 0x80) >> 2); - - if (flipscreen) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, (248 - sx) - 8, (248 - sy) - 16, color, 3, 0x200, DrvGfxROM1); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx - 8, sy - 16, color, 3, 0x200, DrvGfxROM1); - } - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0x60; offs < 0x100; offs +=4) - { - INT32 sy = DrvSprRAM[offs + 0]; - INT32 code = DrvSprRAM[offs + 1]; - INT32 color = DrvSprRAM[offs + 2] & 0x3f; - INT32 sx = DrvSprRAM[offs + 3]; - - if (flipscreen) { - sx = (240 - sx) & 0xff; - } else { - sx = (sx - 2) & 0xff; - sy = 240 - sy; - } - - if (sx > 248) sx -= 256; - - RenderTileTranstab(pTransDraw, DrvGfxROM0, code, color << 3, 0, sx - 8, sy - 16, flipscreen, flipscreen, 16, 16, DrvColPROM + 0x300); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - INT32 d = Palette[i]; - DrvPalette[i] = BurnHighCol(d >> 16, (d >> 8) & 0xff, d & 0xff, 0); - } - DrvRecalc = 0; - } - - draw_background_layer(); - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - memset (DrvInputs, 0, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { 4000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = nCyclesTotal[0] / nInterleave; - - ZetOpen(0); - nCyclesDone[0] += ZetRun(nSegment); - if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - ZetOpen(1); - nCyclesDone[1] += ZetRun(nSegment); - if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - } - - if (pBurnSoundOut) { - SN76496Update(0, pBurnSoundOut, nBurnSoundLen); - SN76496Update(1, pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029707; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - SCAN_VAR(flipscreen); - } - - return 0; -} - - -// Markham - -static struct BurnRomInfo markhamRomDesc[] = { - { "tv3.9", 0x2000, 0x59391637, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "tvg4.10", 0x2000, 0x1837bcce, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tvg5.11", 0x2000, 0x651da602, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "tvg1.5", 0x2000, 0xc5299766, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - { "tvg2.6", 0x2000, 0xb216300a, 2 | BRF_PRG | BRF_ESS }, // 4 - - { "tvg6.84", 0x2000, 0xab933ae5, 3 | BRF_GRA }, // 5 Sprites - { "tvg7.85", 0x2000, 0xce8edda7, 3 | BRF_GRA }, // 6 - { "tvg8.86", 0x2000, 0x74d1536a, 3 | BRF_GRA }, // 7 - - { "tvg9.87", 0x2000, 0x42168675, 4 | BRF_GRA }, // 8 Tiles - { "tvg10.88", 0x2000, 0xfa9feb67, 4 | BRF_GRA }, // 9 - { "tvg11.89", 0x2000, 0x71f3dd49, 4 | BRF_GRA }, // 10 - - { "14-3.99", 0x0100, 0x89d09126, 5 | BRF_GRA }, // 11 Color PROMs - { "14-4.100", 0x0100, 0xe1cafe6c, 5 | BRF_GRA }, // 12 - { "14-5.101", 0x0100, 0x2d444fa6, 5 | BRF_GRA }, // 13 - { "14-1.61", 0x0200, 0x3ad8306d, 5 | BRF_GRA }, // 14 - { "14-2.115", 0x0200, 0x12a4f1ff, 5 | BRF_GRA }, // 15 -}; - -STD_ROM_PICK(markham) -STD_ROM_FN(markham) - -struct BurnDriver BurnDrvMarkham = { - "markham", NULL, NULL, NULL, "1983", - "Markham\0", NULL, "Sun Electronics", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, markhamRomInfo, markhamRomName, NULL, NULL, MarkhamInputInfo, MarkhamDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 224, 4, 3 -}; + // FB Alpha Markham driver module +// Based on MAME driver by Uki + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "sn76496.h" + +static UINT8 *AllMem; +static UINT8 *AllRam; +static UINT8 *MemEnd; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvColPROM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvVidRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvShareRAM; + +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *scroll; + +static UINT8 flipscreen; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo MarkhamInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 7, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Markham) + +static struct BurnDIPInfo MarkhamDIPList[]= +{ + {0x12, 0xff, 0xff, 0x02, NULL }, + {0x13, 0xff, 0xff, 0x7e, NULL }, + {0x14, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x12, 0x01, 0x01, 0x00, "3" }, + {0x12, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x02, 0x02, "Upright" }, + {0x12, 0x01, 0x02, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x12, 0x01, 0x04, 0x00, "Off" }, + {0x12, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Chutes" }, + {0x12, 0x01, 0x08, 0x00, "Individual" }, + {0x12, 0x01, 0x08, 0x08, "Common" }, + + {0 , 0xfe, 0 , 16, "Coin1 / Coin2" }, + {0x12, 0x01, 0xf0, 0x00, "1C 1C / 1C 1C" }, + {0x12, 0x01, 0xf0, 0x10, "2C 1C / 2C 1C" }, + {0x12, 0x01, 0xf0, 0x20, "2C 1C / 1C 3C" }, + {0x12, 0x01, 0xf0, 0x30, "1C 1C / 1C 2C" }, + {0x12, 0x01, 0xf0, 0x40, "1C 1C / 1C 3C" }, + {0x12, 0x01, 0xf0, 0x50, "1C 1C / 1C 4C" }, + {0x12, 0x01, 0xf0, 0x60, "1C 1C / 1C 5C" }, + {0x12, 0x01, 0xf0, 0x70, "1C 1C / 1C 6C" }, + {0x12, 0x01, 0xf0, 0x80, "1C 2C / 1C 2C" }, + {0x12, 0x01, 0xf0, 0x90, "1C 2C / 1C 4C" }, + {0x12, 0x01, 0xf0, 0xa0, "1C 2C / 1C 5C" }, + {0x12, 0x01, 0xf0, 0xb0, "1C 2C / 1C 10C" }, + {0x12, 0x01, 0xf0, 0xc0, "1C 2C / 1C 11C" }, + {0x12, 0x01, 0xf0, 0xd0, "1C 2C / 1C 12C" }, + {0x12, 0x01, 0xf0, 0xe0, "1C 2C / 1C 6C" }, + {0x12, 0x01, 0xf0, 0xf0, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x03, 0x00, "None" }, + {0x13, 0x01, 0x03, 0x01, "20000" }, + {0x13, 0x01, 0x03, 0x02, "20000, Every 50000" }, + {0x13, 0x01, 0x03, 0x03, "20000, Every 80000" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x04, 0x00, "Off" }, + {0x13, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x13, 0x01, 0x80, 0x00, "Off" }, + {0x13, 0x01, 0x80, 0x80, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x10, 0x00, "Off" }, + {0x14, 0x01, 0x10, 0x10, "On" }, +}; + +STDDIPINFO(Markham) + +void __fastcall markham_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe00c: + scroll[0] = data; + return; + + case 0xe00d: + scroll[1] = data; + return; + + case 0xe00e: + flipscreen = data & 1; + return; + } +} + +UINT8 __fastcall markham_main_read(UINT16 address) +{ + switch (address) + { + case 0xe000: + return DrvDips[1]; + + case 0xe001: + return DrvDips[0]; + + case 0xe002: + return DrvInputs[0]; + + case 0xe003: + return DrvInputs[1]; + + case 0xe005: + return (DrvInputs[2] & ~0x10) | (DrvDips[2] & 0x10); + } + + return 0; +} + +void __fastcall markham_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc000: + SN76496Write(0, data); + return; + + case 0xc001: + SN76496Write(1, data); + return; + } +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + flipscreen = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x006000; + DrvZ80ROM1 = Next; Next += 0x006000; + + DrvGfxROM0 = Next; Next += 0x010000; + DrvGfxROM1 = Next; Next += 0x010000; + + DrvColPROM = Next; Next += 0x000700; + + Palette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x000800; + DrvVidRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x000800; + DrvShareRAM = Next; Next += 0x000800; + + scroll = Next; Next += 0x000002; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[3] = { 0x00000, 0x10000, 0x20000 }; + INT32 XOffs[16] = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80 }; + INT32 YOffs[16] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x6000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x6000); + + GfxDecode(0x0100, 3, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x6000); + + GfxDecode(0x0400, 3, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0; i < 0x100; i++) + { + INT32 r = DrvColPROM[i + 0x000] & 0x0f; + INT32 g = DrvColPROM[i + 0x100] & 0x0f; + INT32 b = DrvColPROM[i + 0x200] & 0x0f; + + DrvPalette[i] = (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | (b << 0); + } + + for (INT32 i = 0; i < 0x400; i++) { + Palette[i] = DrvPalette[DrvColPROM[0x300 + i]]; + } + + DrvRecalc = 1; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x04000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x02000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x04000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x02000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x04000, 10, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00000, 11, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00100, 12, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00200, 13, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00300, 14, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00500, 15, 1)) return 1; + + DrvGfxDecode(); + DrvPaletteInit(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM0); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM0); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM0); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM0); + ZetMapArea(0xc800, 0xcfff, 0, DrvSprRAM); + ZetMapArea(0xc800, 0xcfff, 1, DrvSprRAM); + ZetMapArea(0xc800, 0xcfff, 2, DrvSprRAM); + ZetMapArea(0xd000, 0xd7ff, 0, DrvVidRAM); + ZetMapArea(0xd000, 0xd7ff, 1, DrvVidRAM); + ZetMapArea(0xd000, 0xd7ff, 2, DrvVidRAM); + ZetMapArea(0xd800, 0xdfff, 0, DrvShareRAM); + ZetMapArea(0xd800, 0xdfff, 1, DrvShareRAM); + ZetMapArea(0xd800, 0xdfff, 2, DrvShareRAM); + ZetSetWriteHandler(markham_main_write); + ZetSetReadHandler(markham_main_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM1); + ZetMapArea(0x8000, 0x87ff, 0, DrvShareRAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvShareRAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvShareRAM); + ZetSetWriteHandler(markham_sound_write); + ZetClose(); + + SN76496Init(0, 4000000, 0); + SN76496Init(1, 4000000, 1); + SN76496SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 0.75, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + + SN76496Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_background_layer() +{ + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs >> 5) << 3; + INT32 sy = (offs & 0x1f) << 3; + + if (sy >= 32 && sy < 128) sx -= scroll[0]; + if (sy >= 128 && sy < 256) sx -= scroll[1]; + + if (sx < -7) sx += 256; + + INT32 attr = DrvVidRAM[offs * 2 + 0]; + INT32 code = DrvVidRAM[offs * 2 + 1] | ((attr & 0x60) << 3); + INT32 color = (attr & 0x1f) | ((attr & 0x80) >> 2); + + if (flipscreen) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, (248 - sx) - 8, (248 - sy) - 16, color, 3, 0x200, DrvGfxROM1); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx - 8, sy - 16, color, 3, 0x200, DrvGfxROM1); + } + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0x60; offs < 0x100; offs +=4) + { + INT32 sy = DrvSprRAM[offs + 0]; + INT32 code = DrvSprRAM[offs + 1]; + INT32 color = DrvSprRAM[offs + 2] & 0x3f; + INT32 sx = DrvSprRAM[offs + 3]; + + if (flipscreen) { + sx = (240 - sx) & 0xff; + } else { + sx = (sx - 2) & 0xff; + sy = 240 - sy; + } + + if (sx > 248) sx -= 256; + + RenderTileTranstab(pTransDraw, DrvGfxROM0, code, color << 3, 0, sx - 8, sy - 16, flipscreen, flipscreen, 16, 16, DrvColPROM + 0x300); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + INT32 d = Palette[i]; + DrvPalette[i] = BurnHighCol(d >> 16, (d >> 8) & 0xff, d & 0xff, 0); + } + DrvRecalc = 0; + } + + draw_background_layer(); + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + memset (DrvInputs, 0, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { 4000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = nCyclesTotal[0] / nInterleave; + + ZetOpen(0); + nCyclesDone[0] += ZetRun(nSegment); + if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + ZetOpen(1); + nCyclesDone[1] += ZetRun(nSegment); + if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + } + + if (pBurnSoundOut) { + SN76496Update(0, pBurnSoundOut, nBurnSoundLen); + SN76496Update(1, pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029707; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + SCAN_VAR(flipscreen); + } + + return 0; +} + + +// Markham + +static struct BurnRomInfo markhamRomDesc[] = { + { "tv3.9", 0x2000, 0x59391637, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "tvg4.10", 0x2000, 0x1837bcce, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tvg5.11", 0x2000, 0x651da602, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "tvg1.5", 0x2000, 0xc5299766, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + { "tvg2.6", 0x2000, 0xb216300a, 2 | BRF_PRG | BRF_ESS }, // 4 + + { "tvg6.84", 0x2000, 0xab933ae5, 3 | BRF_GRA }, // 5 Sprites + { "tvg7.85", 0x2000, 0xce8edda7, 3 | BRF_GRA }, // 6 + { "tvg8.86", 0x2000, 0x74d1536a, 3 | BRF_GRA }, // 7 + + { "tvg9.87", 0x2000, 0x42168675, 4 | BRF_GRA }, // 8 Tiles + { "tvg10.88", 0x2000, 0xfa9feb67, 4 | BRF_GRA }, // 9 + { "tvg11.89", 0x2000, 0x71f3dd49, 4 | BRF_GRA }, // 10 + + { "14-3.99", 0x0100, 0x89d09126, 5 | BRF_GRA }, // 11 Color PROMs + { "14-4.100", 0x0100, 0xe1cafe6c, 5 | BRF_GRA }, // 12 + { "14-5.101", 0x0100, 0x2d444fa6, 5 | BRF_GRA }, // 13 + { "14-1.61", 0x0200, 0x3ad8306d, 5 | BRF_GRA }, // 14 + { "14-2.115", 0x0200, 0x12a4f1ff, 5 | BRF_GRA }, // 15 +}; + +STD_ROM_PICK(markham) +STD_ROM_FN(markham) + +struct BurnDriver BurnDrvMarkham = { + "markham", NULL, NULL, NULL, "1983", + "Markham\0", NULL, "Sun Electronics", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, markhamRomInfo, markhamRomName, NULL, NULL, MarkhamInputInfo, MarkhamDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_meijinsn.cpp b/src/burn/drv/pre90s/d_meijinsn.cpp index 844dc5d80..d046bb86c 100644 --- a/src/burn/drv/pre90s/d_meijinsn.cpp +++ b/src/burn/drv/pre90s/d_meijinsn.cpp @@ -1,535 +1,534 @@ -// FB Alpha Meijinsen Driver Module -// Based on MAME driver by Tomasz Slanina - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvColPROM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; - -static INT16 *pAY8910Buffer[3]; - -static UINT16 DrvInputs[3]; -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvReset; -static UINT8 DrvDips; - -static INT32 credits; -static INT32 mcu_latch; -static INT32 deposits1; -static INT32 deposits2; - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"Coin 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - - {"Start 1", BIT_DIGITAL, DrvJoy1 + 8, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"Start 2", BIT_DIGITAL, DrvJoy1 + 9, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 15, "Service" }, - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip Switches", BIT_DIPSWITCH, &DrvDips, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[] = -{ - {0x12, 0xFF, 0xFF, 0x08, NULL }, - - {0, 0xFE, 0, 8, "Game time (actual game)" }, - {0x12, 0x01, 0x07, 0x07, "01:00" }, - {0x12, 0x01, 0x07, 0x06, "02:00" }, - {0x12, 0x01, 0x07, 0x05, "03:00" }, - {0x12, 0x01, 0x07, 0x04, "04:00" }, - {0x12, 0x01, 0x07, 0x03, "05:00" }, - {0x12, 0x01, 0x07, 0x02, "10:00" }, - {0x12, 0x01, 0x07, 0x01, "20:00" }, - {0x12, 0x01, 0x07, 0x00, "00:30" }, - - {0, 0xFE, 0, 2, "Coinage" }, - {0x12, 0x01, 0x08, 0x08, "A 1C/1C B 1C/5C" }, - {0x12, 0x01, 0x08, 0x00, "A 1C/2C B 2C/1C" }, - - {0, 0xFE, 0, 2, "2 Player" }, - {0x12, 0x01, 0x10, 0x00, "1C" }, - {0x12, 0x01, 0x10, 0x10, "2C" }, - - {0, 0xFE, 0, 2, "Game time (tsumeshougi)" }, - {0x12, 0x01, 0x20, 0x20, "01:00" }, - {0x12, 0x01, 0x20, 0x00, "02:00" }, -}; - -STDDIPINFO(Drv) - -static UINT8 alpha_mcu_r(UINT8 offset) -{ - static const UINT8 coinage1[2][2] = {{1,1}, {1,2}}; - static const UINT8 coinage2[2][2] = {{1,5}, {2,1}}; - - UINT16 source = SekReadWord(0x180e00 + offset); - - switch (offset) - { - case 0x00: - SekWriteWord(0x180e00, (source & 0xff00) | DrvDips); - return 0; - - case 0x44: - SekWriteWord(0x180e44, (source & 0xff00) | credits); - return 0; - - case 0x52: - credits = 0; - if ((DrvInputs[2] & 0x3) == 0) - mcu_latch = 0; - - SekWriteWord(0x180e52, (source & 0xff00) | 0x22); - - if ((DrvInputs[2] & 0x1) == 0x1 && !mcu_latch) - { - SekWriteWord(0x180e44, (source & 0xff00) | 0x00); - mcu_latch = 1; - - INT32 coinvalue = (~DrvDips >> 3) & 1; - - deposits1++; - if (deposits1 == coinage1[coinvalue][0]) - { - credits = coinage1[coinvalue][1]; - deposits1 = 0; - } - else - credits = 0; - } - else if ((DrvInputs[2] & 0x2) == 0x2 && !mcu_latch) - { - SekWriteWord(0x180e44, (source & 0xff00) | 0x00); - mcu_latch = 1; - - INT32 coinvalue = (~DrvDips >> 3) & 1; - - deposits2++; - if (deposits2 == coinage2[coinvalue][0]) - { - credits = coinage2[coinvalue][1]; - deposits2 = 0; - } - else - credits = 0; - } - - return 0; - } - - return 0; -} - -UINT8 __fastcall meijinsn_read_byte(UINT32 address) -{ - if ((address & ~0xff) == 0x080e00) { - return alpha_mcu_r(address & 0xfe); - } - - switch (address) - { - case 0x1a0000: - return DrvInputs[0] >> 8; - - case 0x1a0001: - return DrvInputs[0] >> 0; - - case 0x1c0000: - return DrvInputs[1] >> 8; - } - - return 0; -} - -void __fastcall meijinsn_write_byte(UINT32 address, UINT8 data) -{ - if (address == 0x1a0001) { - *soundlatch = data; - return; - } -} - -UINT8 __fastcall meijinsn_in_port(UINT16 port) -{ - if ((port & 0xff) == 0x01) { - return AY8910Read(0); - } - - return 0; -} - -void __fastcall meijinsn_out_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - AY8910Write(0, port & 1, data); - break; - - case 0x02: - *soundlatch = 0; - break; - } -} - -static UINT8 ay8910_port_a_r(UINT32) -{ - return *soundlatch; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - - credits = 0; - mcu_latch = 0; - deposits1 = 0; - deposits2 = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x008000; - - DrvColPROM = Next; Next += 0x000020; - - DrvPalette = (UINT32*)Next; Next += 0x0010 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x002000; - DrvZ80RAM = Next; Next += 0x000800; - DrvVidRAM = Next; Next += 0x008000; - - soundlatch = Next; Next += 0x000001; - - RamEnd = Next; - - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0; i < 0x10; i++) - { - INT32 bit0 = (DrvColPROM[i] >> 0) & 0x01; - INT32 bit1 = (DrvColPROM[i] >> 1) & 0x01; - INT32 bit2 = (DrvColPROM[i] >> 2) & 0x01; - - INT32 r = ((bit0 * 4169) + (bit1 * 7304) + (bit2 * 14025)) / 100; - - bit0 = (DrvColPROM[i] >> 3) & 0x01; - bit1 = (DrvColPROM[i] >> 4) & 0x01; - bit2 = (DrvColPROM[i] >> 5) & 0x01; - - INT32 g = ((bit0 * 4169) + (bit1 * 7304) + (bit2 * 14025)) / 100; - - bit0 = (DrvColPROM[i] >> 6) & 0x01; - bit1 = (DrvColPROM[i] >> 7) & 0x01; - - INT32 b = ((bit0 * 8322) + (bit1 * 15980)) / 100; - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - UINT8 *tmp = BurnMalloc(0x10000); - - if (BurnLoadRom(tmp + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(tmp + 0x000000, 1, 2)) return 1; - - memcpy (Drv68KROM + 0x000000, tmp + 0x000000, 0x008000); - memcpy (Drv68KROM + 0x020000, tmp + 0x008000, 0x008000); - - if (BurnLoadRom(tmp + 0x000001, 2, 2)) return 1; - if (BurnLoadRom(tmp + 0x000000, 3, 2)) return 1; - - memcpy (Drv68KROM + 0x008000, tmp + 0x000000, 0x008000); - memcpy (Drv68KROM + 0x028000, tmp + 0x008000, 0x008000); - - if (BurnLoadRom(tmp + 0x000001, 4, 2)) return 1; - if (BurnLoadRom(tmp + 0x000000, 5, 2)) return 1; - - memcpy (Drv68KROM + 0x010000, tmp + 0x000000, 0x008000); - memcpy (Drv68KROM + 0x030000, tmp + 0x008000, 0x008000); - - if (BurnLoadRom(tmp + 0x000001, 6, 2)) return 1; - if (BurnLoadRom(tmp + 0x000000, 7, 2)) return 1; - - memcpy (Drv68KROM + 0x018000, tmp + 0x000000, 0x008000); - memcpy (Drv68KROM + 0x038000, tmp + 0x008000, 0x008000); - - BurnFree (tmp); - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 8, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x04000, 9, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x000, 10, 1)) return 1; - - DrvPaletteInit(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvVidRAM, 0x100000, 0x107fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x180000, 0x181fff, SM_RAM); - SekSetWriteByteHandler(0, meijinsn_write_byte); - SekSetReadByteHandler(0, meijinsn_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetOutHandler(meijinsn_out_port); - ZetSetInHandler(meijinsn_in_port); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 2000000, nBurnSoundRate, &ay8910_port_a_r, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.75, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - SekExit(); - ZetExit(); - AY8910Exit(0); - - BurnFree(AllMem); - - return 0; -} - -static void draw_layer() -{ - UINT16 *vram = (UINT16*)DrvVidRAM; - - for (INT32 i = 0; i < 0x4000; i++) - { - INT32 sx = (i >> 6) & 0xfc; - INT32 sy = i & 0xff; - - if (sy < 16 || sy > 239 || sx < 12 || sx > 240) continue; - - sx -= 12; - sy -= 16; - - INT32 data = vram[i]; - - for (INT32 x = 0; x < 4; x++, data >>= 1) - { - pTransDraw[sy * 232 + sx + (x ^ 3)] = (data & 1) | ((data >> 3) & 2) | ((data >> 6) & 4) | ((data >> 9) & 8); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvPaletteInit(); - DrvRecalc = 0; - } - - draw_layer(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0, 3 * sizeof(INT16)); - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - INT32 nInterleave = 160; - INT32 nCyclesSegment; - INT32 nCyclesTotal[2] = { 9000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext; - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[0]; - nCyclesDone[0] += SekRun(nCyclesSegment); - if (i == 0) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - if (i == 159) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - nNext = (i + 1) * nCyclesTotal[1] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[1]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[1] += nCyclesSegment; - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - - ZetClose(); - SekClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - AY8910Scan(nAction, pnMin); - - SCAN_VAR(mcu_latch); - SCAN_VAR(deposits1); - SCAN_VAR(deposits2); - SCAN_VAR(credits); - } - - return 0; -} - - -// Meijinsen - -static struct BurnRomInfo meijinsnRomDesc[] = { - { "p1", 0x08000, 0x8c9697a3, BRF_PRG | BRF_ESS }, // 0 M68000 Code - { "p2", 0x08000, 0xf7da3535, BRF_PRG | BRF_ESS }, // 1 - { "p3", 0x08000, 0x0af0b266, BRF_PRG | BRF_ESS }, // 2 - { "p4", 0x08000, 0xaab159c5, BRF_PRG | BRF_ESS }, // 3 - { "p5", 0x08000, 0x0ed10a47, BRF_PRG | BRF_ESS }, // 4 - { "p6", 0x08000, 0x60b58755, BRF_PRG | BRF_ESS }, // 5 - { "p7", 0x08000, 0x604c76f1, BRF_PRG | BRF_ESS }, // 6 - { "p8", 0x08000, 0xe3eaef19, BRF_PRG | BRF_ESS }, // 7 - - { "p9", 0x04000, 0xaedfefdf, BRF_PRG | BRF_ESS }, // 8 Z80 Code - { "p10", 0x04000, 0x93b4d764, BRF_PRG | BRF_ESS }, // 9 - - { "clr", 0x00020, 0x7b95b5a7, BRF_GRA }, // 10 Color Prom -}; - -STD_ROM_PICK(meijinsn) -STD_ROM_FN(meijinsn) - -struct BurnDriver BurnDrvMeijinsn = { - "meijinsn", NULL, NULL, NULL, "1986", - "Meijinsen\0", NULL, "SNK Electronics corp.", "Miscellaneous", - L"\u540D\u4EBA\u6226\0Meijinsen\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, - NULL, meijinsnRomInfo, meijinsnRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10, - 232, 224, 4, 3 -}; +// FB Alpha Meijinsen Driver Module +// Based on MAME driver by Tomasz Slanina + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvColPROM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; + +static INT16 *pAY8910Buffer[3]; + +static UINT16 DrvInputs[3]; +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvReset; +static UINT8 DrvDips; + +static INT32 credits; +static INT32 mcu_latch; +static INT32 deposits1; +static INT32 deposits2; + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"Coin 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + + {"Start 1", BIT_DIGITAL, DrvJoy1 + 8, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"Start 2", BIT_DIGITAL, DrvJoy1 + 9, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 15, "Service" }, + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip Switches", BIT_DIPSWITCH, &DrvDips, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[] = +{ + {0x12, 0xFF, 0xFF, 0x08, NULL }, + + {0, 0xFE, 0, 8, "Game time (actual game)" }, + {0x12, 0x01, 0x07, 0x07, "01:00" }, + {0x12, 0x01, 0x07, 0x06, "02:00" }, + {0x12, 0x01, 0x07, 0x05, "03:00" }, + {0x12, 0x01, 0x07, 0x04, "04:00" }, + {0x12, 0x01, 0x07, 0x03, "05:00" }, + {0x12, 0x01, 0x07, 0x02, "10:00" }, + {0x12, 0x01, 0x07, 0x01, "20:00" }, + {0x12, 0x01, 0x07, 0x00, "00:30" }, + + {0, 0xFE, 0, 2, "Coinage" }, + {0x12, 0x01, 0x08, 0x08, "A 1C/1C B 1C/5C" }, + {0x12, 0x01, 0x08, 0x00, "A 1C/2C B 2C/1C" }, + + {0, 0xFE, 0, 2, "2 Player" }, + {0x12, 0x01, 0x10, 0x00, "1C" }, + {0x12, 0x01, 0x10, 0x10, "2C" }, + + {0, 0xFE, 0, 2, "Game time (tsumeshougi)" }, + {0x12, 0x01, 0x20, 0x20, "01:00" }, + {0x12, 0x01, 0x20, 0x00, "02:00" }, +}; + +STDDIPINFO(Drv) + +static UINT8 alpha_mcu_r(UINT8 offset) +{ + static const UINT8 coinage1[2][2] = {{1,1}, {1,2}}; + static const UINT8 coinage2[2][2] = {{1,5}, {2,1}}; + + UINT16 source = SekReadWord(0x180e00 + offset); + + switch (offset) + { + case 0x00: + SekWriteWord(0x180e00, (source & 0xff00) | DrvDips); + return 0; + + case 0x44: + SekWriteWord(0x180e44, (source & 0xff00) | credits); + return 0; + + case 0x52: + credits = 0; + if ((DrvInputs[2] & 0x3) == 0) + mcu_latch = 0; + + SekWriteWord(0x180e52, (source & 0xff00) | 0x22); + + if ((DrvInputs[2] & 0x1) == 0x1 && !mcu_latch) + { + SekWriteWord(0x180e44, (source & 0xff00) | 0x00); + mcu_latch = 1; + + INT32 coinvalue = (~DrvDips >> 3) & 1; + + deposits1++; + if (deposits1 == coinage1[coinvalue][0]) + { + credits = coinage1[coinvalue][1]; + deposits1 = 0; + } + else + credits = 0; + } + else if ((DrvInputs[2] & 0x2) == 0x2 && !mcu_latch) + { + SekWriteWord(0x180e44, (source & 0xff00) | 0x00); + mcu_latch = 1; + + INT32 coinvalue = (~DrvDips >> 3) & 1; + + deposits2++; + if (deposits2 == coinage2[coinvalue][0]) + { + credits = coinage2[coinvalue][1]; + deposits2 = 0; + } + else + credits = 0; + } + + return 0; + } + + return 0; +} + +UINT8 __fastcall meijinsn_read_byte(UINT32 address) +{ + if ((address & ~0xff) == 0x080e00) { + return alpha_mcu_r(address & 0xfe); + } + + switch (address) + { + case 0x1a0000: + return DrvInputs[0] >> 8; + + case 0x1a0001: + return DrvInputs[0] >> 0; + + case 0x1c0000: + return DrvInputs[1] >> 8; + } + + return 0; +} + +void __fastcall meijinsn_write_byte(UINT32 address, UINT8 data) +{ + if (address == 0x1a0001) { + *soundlatch = data; + return; + } +} + +UINT8 __fastcall meijinsn_in_port(UINT16 port) +{ + if ((port & 0xff) == 0x01) { + return AY8910Read(0); + } + + return 0; +} + +void __fastcall meijinsn_out_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + AY8910Write(0, port & 1, data); + break; + + case 0x02: + *soundlatch = 0; + break; + } +} + +static UINT8 ay8910_port_a_r(UINT32) +{ + return *soundlatch; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + + credits = 0; + mcu_latch = 0; + deposits1 = 0; + deposits2 = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x008000; + + DrvColPROM = Next; Next += 0x000020; + + DrvPalette = (UINT32*)Next; Next += 0x0010 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x002000; + DrvZ80RAM = Next; Next += 0x000800; + DrvVidRAM = Next; Next += 0x008000; + + soundlatch = Next; Next += 0x000001; + + RamEnd = Next; + + pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0; i < 0x10; i++) + { + INT32 bit0 = (DrvColPROM[i] >> 0) & 0x01; + INT32 bit1 = (DrvColPROM[i] >> 1) & 0x01; + INT32 bit2 = (DrvColPROM[i] >> 2) & 0x01; + + INT32 r = ((bit0 * 4169) + (bit1 * 7304) + (bit2 * 14025)) / 100; + + bit0 = (DrvColPROM[i] >> 3) & 0x01; + bit1 = (DrvColPROM[i] >> 4) & 0x01; + bit2 = (DrvColPROM[i] >> 5) & 0x01; + + INT32 g = ((bit0 * 4169) + (bit1 * 7304) + (bit2 * 14025)) / 100; + + bit0 = (DrvColPROM[i] >> 6) & 0x01; + bit1 = (DrvColPROM[i] >> 7) & 0x01; + + INT32 b = ((bit0 * 8322) + (bit1 * 15980)) / 100; + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + UINT8 *tmp = BurnMalloc(0x10000); + + if (BurnLoadRom(tmp + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(tmp + 0x000000, 1, 2)) return 1; + + memcpy (Drv68KROM + 0x000000, tmp + 0x000000, 0x008000); + memcpy (Drv68KROM + 0x020000, tmp + 0x008000, 0x008000); + + if (BurnLoadRom(tmp + 0x000001, 2, 2)) return 1; + if (BurnLoadRom(tmp + 0x000000, 3, 2)) return 1; + + memcpy (Drv68KROM + 0x008000, tmp + 0x000000, 0x008000); + memcpy (Drv68KROM + 0x028000, tmp + 0x008000, 0x008000); + + if (BurnLoadRom(tmp + 0x000001, 4, 2)) return 1; + if (BurnLoadRom(tmp + 0x000000, 5, 2)) return 1; + + memcpy (Drv68KROM + 0x010000, tmp + 0x000000, 0x008000); + memcpy (Drv68KROM + 0x030000, tmp + 0x008000, 0x008000); + + if (BurnLoadRom(tmp + 0x000001, 6, 2)) return 1; + if (BurnLoadRom(tmp + 0x000000, 7, 2)) return 1; + + memcpy (Drv68KROM + 0x018000, tmp + 0x000000, 0x008000); + memcpy (Drv68KROM + 0x038000, tmp + 0x008000, 0x008000); + + BurnFree (tmp); + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 8, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x04000, 9, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x000, 10, 1)) return 1; + + DrvPaletteInit(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvVidRAM, 0x100000, 0x107fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x180000, 0x181fff, SM_RAM); + SekSetWriteByteHandler(0, meijinsn_write_byte); + SekSetReadByteHandler(0, meijinsn_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetOutHandler(meijinsn_out_port); + ZetSetInHandler(meijinsn_in_port); + ZetClose(); + + AY8910Init(0, 2000000, nBurnSoundRate, &ay8910_port_a_r, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.75, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + SekExit(); + ZetExit(); + AY8910Exit(0); + + BurnFree(AllMem); + + return 0; +} + +static void draw_layer() +{ + UINT16 *vram = (UINT16*)DrvVidRAM; + + for (INT32 i = 0; i < 0x4000; i++) + { + INT32 sx = (i >> 6) & 0xfc; + INT32 sy = i & 0xff; + + if (sy < 16 || sy > 239 || sx < 12 || sx > 240) continue; + + sx -= 12; + sy -= 16; + + INT32 data = vram[i]; + + for (INT32 x = 0; x < 4; x++, data >>= 1) + { + pTransDraw[sy * 232 + sx + (x ^ 3)] = (data & 1) | ((data >> 3) & 2) | ((data >> 6) & 4) | ((data >> 9) & 8); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvPaletteInit(); + DrvRecalc = 0; + } + + draw_layer(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0, 3 * sizeof(INT16)); + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + INT32 nInterleave = 160; + INT32 nCyclesSegment; + INT32 nCyclesTotal[2] = { 9000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext; + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[0]; + nCyclesDone[0] += SekRun(nCyclesSegment); + if (i == 0) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + if (i == 159) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + nNext = (i + 1) * nCyclesTotal[1] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[1]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[1] += nCyclesSegment; + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + + ZetClose(); + SekClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + AY8910Scan(nAction, pnMin); + + SCAN_VAR(mcu_latch); + SCAN_VAR(deposits1); + SCAN_VAR(deposits2); + SCAN_VAR(credits); + } + + return 0; +} + + +// Meijinsen + +static struct BurnRomInfo meijinsnRomDesc[] = { + { "p1", 0x08000, 0x8c9697a3, BRF_PRG | BRF_ESS }, // 0 M68000 Code + { "p2", 0x08000, 0xf7da3535, BRF_PRG | BRF_ESS }, // 1 + { "p3", 0x08000, 0x0af0b266, BRF_PRG | BRF_ESS }, // 2 + { "p4", 0x08000, 0xaab159c5, BRF_PRG | BRF_ESS }, // 3 + { "p5", 0x08000, 0x0ed10a47, BRF_PRG | BRF_ESS }, // 4 + { "p6", 0x08000, 0x60b58755, BRF_PRG | BRF_ESS }, // 5 + { "p7", 0x08000, 0x604c76f1, BRF_PRG | BRF_ESS }, // 6 + { "p8", 0x08000, 0xe3eaef19, BRF_PRG | BRF_ESS }, // 7 + + { "p9", 0x04000, 0xaedfefdf, BRF_PRG | BRF_ESS }, // 8 Z80 Code + { "p10", 0x04000, 0x93b4d764, BRF_PRG | BRF_ESS }, // 9 + + { "clr", 0x00020, 0x7b95b5a7, BRF_GRA }, // 10 Color Prom +}; + +STD_ROM_PICK(meijinsn) +STD_ROM_FN(meijinsn) + +struct BurnDriver BurnDrvMeijinsn = { + "meijinsn", NULL, NULL, NULL, "1986", + "Meijinsen\0", NULL, "SNK Electronics corp.", "Miscellaneous", + L"\u540D\u4EBA\u6226\0Meijinsen\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, + NULL, meijinsnRomInfo, meijinsnRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10, + 232, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_mitchell.cpp b/src/burn/drv/pre90s/d_mitchell.cpp index 7cc3ac302..d73205f43 100644 --- a/src/burn/drv/pre90s/d_mitchell.cpp +++ b/src/burn/drv/pre90s/d_mitchell.cpp @@ -1,3263 +1,3258 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "eeprom.h" -#include "burn_ym2413.h" -#include "msm6295.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort4[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort5[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort6[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort7[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort8[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort9[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort10[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort11[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[12] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static UINT8 DrvDip[2] = {0, 0}; -static UINT8 DrvReset = 0; -static INT16 DrvDial1 = 0; -static INT16 DrvDial2 = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *DrvZ80Rom = NULL; -static UINT8 *DrvZ80Code = NULL; -static UINT8 *DrvZ80Rom2 = NULL; -static UINT8 *DrvSoundRom = NULL; -static UINT8 *DrvZ80Ram = NULL; -static UINT8 *DrvZ80Ram2 = NULL; -static UINT8 *DrvPaletteRam = NULL; -static UINT8 *DrvAttrRam = NULL; -static UINT8 *DrvVideoRam = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static UINT8 DrvRomBank; -static UINT8 DrvPaletteRamBank; -static UINT8 DrvOkiBank; -static UINT8 DrvFlipScreen; -static UINT8 DrvVideoBank; -static UINT8 DrvInput5Toggle; -static UINT8 DrvPort5Kludge; -static INT32 DrvTileMask; -static UINT8 DrvHasEEPROM; -static INT32 DrvNumColours; -static INT32 DrvNVRamSize; -static INT32 DrvNVRamAddress; -static UINT8 DrvDialSelected; -static INT32 DrvDial[2]; -static UINT8 DrvSoundLatch; - -static UINT8 DrvInputType; -static INT32 DrvMahjongKeyMatrix; - -#define DRV_INPUT_TYPE_MAHJONG 1 -#define DRV_INPUT_TYPE_BLOCK 2 - -static struct BurnInputInfo MgakuenInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort7 + 2, "p2 start" }, - - {"P1 A" , BIT_DIGITAL , DrvInputPort1 + 7, "mah a" }, - {"P1 B" , BIT_DIGITAL , DrvInputPort2 + 7, "mah b" }, - {"P1 C" , BIT_DIGITAL , DrvInputPort4 + 7, "mah c" }, - {"P1 D" , BIT_DIGITAL , DrvInputPort5 + 7, "mah d" }, - {"P1 E" , BIT_DIGITAL , DrvInputPort1 + 6, "mah e" }, - {"P1 F" , BIT_DIGITAL , DrvInputPort2 + 6, "mah f" }, - {"P1 G" , BIT_DIGITAL , DrvInputPort4 + 6, "mah g" }, - {"P1 H" , BIT_DIGITAL , DrvInputPort5 + 6, "mah h" }, - {"P1 I" , BIT_DIGITAL , DrvInputPort1 + 5, "mah i" }, - {"P1 J" , BIT_DIGITAL , DrvInputPort2 + 5, "mah j" }, - {"P1 K" , BIT_DIGITAL , DrvInputPort4 + 5, "mah k" }, - {"P1 L" , BIT_DIGITAL , DrvInputPort5 + 5, "mah l" }, - {"P1 M" , BIT_DIGITAL , DrvInputPort1 + 4, "mah m" }, - {"P1 N" , BIT_DIGITAL , DrvInputPort2 + 4, "mah n" }, - {"P1 Pon" , BIT_DIGITAL , DrvInputPort5 + 4, "mah pon" }, - {"P1 Chi" , BIT_DIGITAL , DrvInputPort4 + 4, "mah chi" }, - {"P1 Kan" , BIT_DIGITAL , DrvInputPort1 + 3, "mah kan" }, - {"P1 Ron" , BIT_DIGITAL , DrvInputPort4 + 3, "mah ron" }, - {"P1 Reach" , BIT_DIGITAL , DrvInputPort2 + 3, "mah reach" }, - {"P1 Flip Flop" , BIT_DIGITAL , DrvInputPort6 + 4, "mah ff" }, - - {"P2 A" , BIT_DIGITAL , DrvInputPort7 + 7, "mah a" }, - {"P2 B" , BIT_DIGITAL , DrvInputPort8 + 7, "mah b" }, - {"P2 C" , BIT_DIGITAL , DrvInputPort9 + 7, "mah c" }, - {"P2 D" , BIT_DIGITAL , DrvInputPort10 + 7, "mah d" }, - {"P2 E" , BIT_DIGITAL , DrvInputPort7 + 6, "mah e" }, - {"P2 F" , BIT_DIGITAL , DrvInputPort8 + 6, "mah f" }, - {"P2 G" , BIT_DIGITAL , DrvInputPort9 + 6, "mah g" }, - {"P2 H" , BIT_DIGITAL , DrvInputPort10 + 6, "mah h" }, - {"P2 I" , BIT_DIGITAL , DrvInputPort7 + 5, "mah i" }, - {"P2 J" , BIT_DIGITAL , DrvInputPort8 + 5, "mah j" }, - {"P2 K" , BIT_DIGITAL , DrvInputPort9 + 5, "mah k" }, - {"P2 L" , BIT_DIGITAL , DrvInputPort10 + 5, "mah l" }, - {"P2 M" , BIT_DIGITAL , DrvInputPort7 + 4, "mah m" }, - {"P2 N" , BIT_DIGITAL , DrvInputPort2 + 4, "mah n" }, - {"P2 Pon" , BIT_DIGITAL , DrvInputPort10 + 4, "mah pon" }, - {"P2 Chi" , BIT_DIGITAL , DrvInputPort9 + 4, "mah chi" }, - {"P2 Kan" , BIT_DIGITAL , DrvInputPort7 + 3, "mah kan" }, - {"P2 Ron" , BIT_DIGITAL , DrvInputPort9 + 3, "mah ron" }, - {"P2 Reach" , BIT_DIGITAL , DrvInputPort8 + 3, "mah reach" }, - {"P2 Flip Flop" , BIT_DIGITAL , DrvInputPort11 + 4, "mah ff" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Mgakuen) - -static struct BurnInputInfo MarukinInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort7 + 2, "p2 start" }, - - {"P1 A" , BIT_DIGITAL , DrvInputPort1 + 7, "mah a" }, - {"P1 B" , BIT_DIGITAL , DrvInputPort2 + 7, "mah b" }, - {"P1 C" , BIT_DIGITAL , DrvInputPort4 + 7, "mah c" }, - {"P1 D" , BIT_DIGITAL , DrvInputPort5 + 7, "mah d" }, - {"P1 E" , BIT_DIGITAL , DrvInputPort1 + 6, "mah e" }, - {"P1 F" , BIT_DIGITAL , DrvInputPort2 + 6, "mah f" }, - {"P1 G" , BIT_DIGITAL , DrvInputPort4 + 6, "mah g" }, - {"P1 H" , BIT_DIGITAL , DrvInputPort5 + 6, "mah h" }, - {"P1 I" , BIT_DIGITAL , DrvInputPort1 + 5, "mah i" }, - {"P1 J" , BIT_DIGITAL , DrvInputPort2 + 5, "mah j" }, - {"P1 K" , BIT_DIGITAL , DrvInputPort4 + 5, "mah k" }, - {"P1 L" , BIT_DIGITAL , DrvInputPort5 + 5, "mah l" }, - {"P1 M" , BIT_DIGITAL , DrvInputPort1 + 4, "mah m" }, - {"P1 N" , BIT_DIGITAL , DrvInputPort2 + 4, "mah n" }, - {"P1 Pon" , BIT_DIGITAL , DrvInputPort5 + 4, "mah pon" }, - {"P1 Chi" , BIT_DIGITAL , DrvInputPort4 + 4, "mah chi" }, - {"P1 Kan" , BIT_DIGITAL , DrvInputPort1 + 3, "mah kan" }, - {"P1 Ron" , BIT_DIGITAL , DrvInputPort4 + 3, "mah ron" }, - {"P1 Reach" , BIT_DIGITAL , DrvInputPort2 + 3, "mah reach" }, - {"P1 Flip Flop" , BIT_DIGITAL , DrvInputPort6 + 4, "mah ff" }, - - {"P2 A" , BIT_DIGITAL , DrvInputPort7 + 7, "mah a" }, - {"P2 B" , BIT_DIGITAL , DrvInputPort8 + 7, "mah b" }, - {"P2 C" , BIT_DIGITAL , DrvInputPort9 + 7, "mah c" }, - {"P2 D" , BIT_DIGITAL , DrvInputPort10 + 7, "mah d" }, - {"P2 E" , BIT_DIGITAL , DrvInputPort7 + 6, "mah e" }, - {"P2 F" , BIT_DIGITAL , DrvInputPort8 + 6, "mah f" }, - {"P2 G" , BIT_DIGITAL , DrvInputPort9 + 6, "mah g" }, - {"P2 H" , BIT_DIGITAL , DrvInputPort10 + 6, "mah h" }, - {"P2 I" , BIT_DIGITAL , DrvInputPort7 + 5, "mah i" }, - {"P2 J" , BIT_DIGITAL , DrvInputPort8 + 5, "mah j" }, - {"P2 K" , BIT_DIGITAL , DrvInputPort9 + 5, "mah k" }, - {"P2 L" , BIT_DIGITAL , DrvInputPort10 + 5, "mah l" }, - {"P2 M" , BIT_DIGITAL , DrvInputPort7 + 4, "mah m" }, - {"P2 N" , BIT_DIGITAL , DrvInputPort2 + 4, "mah n" }, - {"P2 Pon" , BIT_DIGITAL , DrvInputPort10 + 4, "mah pon" }, - {"P2 Chi" , BIT_DIGITAL , DrvInputPort9 + 4, "mah chi" }, - {"P2 Kan" , BIT_DIGITAL , DrvInputPort7 + 3, "mah kan" }, - {"P2 Ron" , BIT_DIGITAL , DrvInputPort9 + 3, "mah ron" }, - {"P2 Reach" , BIT_DIGITAL , DrvInputPort8 + 3, "mah reach" }, - {"P2 Flip Flop" , BIT_DIGITAL , DrvInputPort11 + 4, "mah ff" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, -}; - -STDINPUTINFO(Marukin) - -static struct BurnInputInfo PkladiesInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort7 + 2, "p2 start" }, - - {"P1 A" , BIT_DIGITAL , DrvInputPort1 + 7, "mah a" }, - {"P1 B" , BIT_DIGITAL , DrvInputPort2 + 7, "mah b" }, - {"P1 C" , BIT_DIGITAL , DrvInputPort4 + 7, "mah c" }, - {"P1 D" , BIT_DIGITAL , DrvInputPort5 + 7, "mah d" }, - {"P1 E" , BIT_DIGITAL , DrvInputPort1 + 6, "mah e" }, - {"P1 Deal" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 1" }, - {"P1 Cancel" , BIT_DIGITAL , DrvInputPort2 + 5, "p1 fire 2" }, - {"P1 Flip" , BIT_DIGITAL , DrvInputPort4 + 5, "p1 fire 3" }, - - {"P2 A" , BIT_DIGITAL , DrvInputPort7 + 7, "mah a" }, - {"P2 B" , BIT_DIGITAL , DrvInputPort8 + 7, "mah b" }, - {"P2 C" , BIT_DIGITAL , DrvInputPort9 + 7, "mah c" }, - {"P2 D" , BIT_DIGITAL , DrvInputPort10 + 7, "mah d" }, - {"P2 E" , BIT_DIGITAL , DrvInputPort7 + 6, "mah e" }, - {"P2 Deal" , BIT_DIGITAL , DrvInputPort7 + 5, "p2 fire 1" }, - {"P2 Cancel" , BIT_DIGITAL , DrvInputPort8 + 5, "p2 fire 2" }, - {"P2 Flip" , BIT_DIGITAL , DrvInputPort9 + 5, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 0, "service" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, -}; - -STDINPUTINFO(Pkladies) - -static struct BurnInputInfo PangInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, -}; - -STDINPUTINFO(Pang) - -static struct BurnInputInfo Qtono1InputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 start" }, - - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 4" }, - - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 4" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, -}; - -STDINPUTINFO(Qtono1) - -static struct BurnInputInfo MstworldInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, -}; - -STDINPUTINFO(Mstworld) - -static struct BurnInputInfo BlockInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , DrvInputPort11 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort11 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, - - {"P2 Left" , BIT_DIGITAL , DrvInputPort11 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort11 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, -}; - -STDINPUTINFO(Block) - -static struct BurnInputInfo BlockjoyInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, - - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, - {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, -}; - -STDINPUTINFO(Blockjoy) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x30) == 0x30) { - *nJoystickInputs &= ~0x30; - } - if ((*nJoystickInputs & 0xc0) == 0xc0) { - *nJoystickInputs &= ~0xc0; - } -} - -static inline void DrvMakeInputs() -{ - for (INT32 i = 0; i < 12; i++) DrvInput[i] = 0x00; - - for (INT32 i = 0; i < 8; i++) { - DrvInput[ 0] |= (DrvInputPort0[ i] & 1) << i; - DrvInput[ 1] |= (DrvInputPort1[ i] & 1) << i; - DrvInput[ 2] |= (DrvInputPort2[ i] & 1) << i; - DrvInput[ 3] |= (DrvInputPort3[ i] & 1) << i; - DrvInput[ 4] |= (DrvInputPort4[ i] & 1) << i; - DrvInput[ 5] |= (DrvInputPort5[ i] & 1) << i; - DrvInput[ 6] |= (DrvInputPort6[ i] & 1) << i; - DrvInput[ 7] |= (DrvInputPort7[ i] & 1) << i; - DrvInput[ 8] |= (DrvInputPort8[ i] & 1) << i; - DrvInput[ 9] |= (DrvInputPort9[ i] & 1) << i; - DrvInput[10] |= (DrvInputPort10[i] & 1) << i; - DrvInput[11] |= (DrvInputPort11[i] & 1) << i; - } - - if (DrvInputType == DRV_INPUT_TYPE_BLOCK) { - if (DrvInputPort11[0]) DrvDial1 -= 0x04; - if (DrvInputPort11[1]) DrvDial1 += 0x04; - if (DrvDial1 >= 0x100) DrvDial1 = 0; - if (DrvDial1 < 0) DrvDial1 = 0xfc; - - if (DrvInputPort11[2]) DrvDial2 -= 0x04; - if (DrvInputPort11[3]) DrvDial2 += 0x04; - if (DrvDial2 >= 0x100) DrvDial2 = 0; - if (DrvDial2 < 0) DrvDial2 = 0xfc; - } else { - if (DrvInputType != DRV_INPUT_TYPE_MAHJONG) { - DrvClearOpposites(&DrvInput[1]); - DrvClearOpposites(&DrvInput[2]); - } - } -} - -static struct BurnDIPInfo MgakuenDIPList[]= -{ - // Default Values - {0x2c, 0xff, 0xff, 0xef, NULL }, - {0x2d, 0xff, 0xff, 0x8f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x2c, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, - {0x2c, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, - {0x2c, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, - {0x2c, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x2c, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x2c, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x2c, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - {0x2c, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, - - {0 , 0xfe, 0 , 2 , "Rules" }, - {0x2c, 0x01, 0x08, 0x08, "Kantou" }, - {0x2c, 0x01, 0x08, 0x00, "Kansai" }, - - {0 , 0xfe, 0 , 2 , "Harness Type" }, - {0x2c, 0x01, 0x10, 0x10, "Generic" }, - {0x2c, 0x01, 0x10, 0x00, "Royal Mahjong" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x2c, 0x01, 0x20, 0x20, "Off" }, - {0x2c, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x2c, 0x01, 0x40, 0x40, "Off" }, - {0x2c, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x2c, 0x01, 0x80, 0x80, "Off" }, - {0x2c, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Player 1 Skill" }, - {0x2d, 0x01, 0x03, 0x03, "Weak" }, - {0x2d, 0x01, 0x03, 0x02, "Normal" }, - {0x2d, 0x01, 0x03, 0x01, "Strong" }, - {0x2d, 0x01, 0x03, 0x00, "Very Strong" }, - - {0 , 0xfe, 0 , 4 , "Player 2 Skill" }, - {0x2d, 0x01, 0x0c, 0x0c, "Weak" }, - {0x2d, 0x01, 0x0c, 0x08, "Normal" }, - {0x2d, 0x01, 0x0c, 0x04, "Strong" }, - {0x2d, 0x01, 0x0c, 0x00, "Very Strong" }, - - {0 , 0xfe, 0 , 2 , "Music" }, - {0x2d, 0x01, 0x10, 0x10, "Off" }, - {0x2d, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x2d, 0x01, 0x20, 0x20, "Off" }, - {0x2d, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Help Mode" }, - {0x2d, 0x01, 0x40, 0x40, "Off" }, - {0x2d, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(Mgakuen) - -static struct BurnDIPInfo MstworldDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xb0, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x15, 0x01, 0x07, 0x03, "A 1C/4P B 1C/4P" }, - {0x15, 0x01, 0x07, 0x02, "A 1C/3P B 1C/3P" }, - {0x15, 0x01, 0x07, 0x01, "A 1C/2P B 1C/2P" }, - {0x15, 0x01, 0x07, 0x00, "A 1C/1P B 1C/4P" }, - {0x15, 0x01, 0x07, 0x04, "A 2C/1P B 1C/2P" }, - {0x15, 0x01, 0x07, 0x05, "A 2C/1P B 1C/3P" }, - {0x15, 0x01, 0x07, 0x06, "A 3C/1P B 1C/2P" }, - {0x15, 0x01, 0x07, 0x07, "A 4C/1P B 1C/1P" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x18, 0x00, "1" }, - {0x15, 0x01, 0x18, 0x08, "2" }, - {0x15, 0x01, 0x18, 0x10, "3" }, - {0x15, 0x01, 0x18, 0x18, "4" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x60, 0x00, "Easy" }, - {0x15, 0x01, 0x60, 0x20, "Normal" }, - {0x15, 0x01, 0x60, 0x40, "Hard" }, - {0x15, 0x01, 0x60, 0x60, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x00, "Off" }, - {0x15, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Mstworld) - -static struct BurnRomInfo MgakuenRomDesc[] = { - { "mg-1.1j", 0x08000, 0xbf02ea6b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "mg-2.1l", 0x20000, 0x64141b0c, BRF_ESS | BRF_PRG }, // 1 - - { "mg-1.13h", 0x80000, 0xfd6a0805, BRF_GRA }, // 2 Characters - { "mg-2.14h", 0x80000, 0xe26e871e, BRF_GRA }, // 3 - { "mg-3.16h", 0x80000, 0xdd781d9a, BRF_GRA }, // 4 - { "mg-4.17h", 0x80000, 0x97afcc79, BRF_GRA }, // 5 - - { "mg-6.4l", 0x20000, 0x34594e62, BRF_GRA }, // 6 Sprites - { "mg-7.6l", 0x20000, 0xf304c806, BRF_GRA }, // 7 - - { "mg-5.1c", 0x80000, 0x170332f1, BRF_SND }, // 8 Samples -}; - -STD_ROM_PICK(Mgakuen) -STD_ROM_FN(Mgakuen) - -static struct BurnRomInfo SeventoitsuRomDesc[] = { - { "mc01.1j", 0x08000, 0x0bebe45f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "mc02.1l", 0x20000, 0x375378b0, BRF_ESS | BRF_PRG }, // 1 - - { "mg-1.13h", 0x80000, 0xfd6a0805, BRF_GRA }, // 2 Characters - { "mg-2.14h", 0x80000, 0xe26e871e, BRF_GRA }, // 3 - { "mg-3.16h", 0x80000, 0xdd781d9a, BRF_GRA }, // 4 - { "mg-4.17h", 0x80000, 0x97afcc79, BRF_GRA }, // 5 - - { "mc06.4l", 0x20000, 0x0ef83926, BRF_GRA }, // 6 Sprites - { "mc07.6l", 0x20000, 0x59f9ffb1, BRF_GRA }, // 7 - - { "mg-5.1c", 0x80000, 0x170332f1, BRF_SND }, // 8 Samples -}; - -STD_ROM_PICK(Seventoitsu) -STD_ROM_FN(Seventoitsu) - -static struct BurnRomInfo Mgakuen2RomDesc[] = { - { "mg2-xf.1j", 0x08000, 0xc8165d2d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "mg2-y.1l", 0x20000, 0x75bbcc14, BRF_ESS | BRF_PRG }, // 1 - { "mg2-z.3l", 0x20000, 0xbfdba961, BRF_ESS | BRF_PRG }, // 2 - - { "mg2-a.13h", 0x80000, 0x31a0c55e, BRF_GRA }, // 3 Characters - { "mg2-b.14h", 0x80000, 0xc18488fa, BRF_GRA }, // 4 - { "mg2-c.16h", 0x80000, 0x9425b364, BRF_GRA }, // 5 - { "mg2-d.17h", 0x80000, 0x6cc9eeba, BRF_GRA }, // 6 - - { "mg2-f.4l", 0x20000, 0x3172c9fe, BRF_GRA }, // 7 Sprites - { "mg2-g.6l", 0x20000, 0x19b8b61c, BRF_GRA }, // 8 - - { "mg2-e.1c", 0x80000, 0x70fd0809, BRF_SND }, // 9 Samples -}; - -STD_ROM_PICK(Mgakuen2) -STD_ROM_FN(Mgakuen2) - -static struct BurnRomInfo PkladiesRomDesc[] = { - { "pko-prg1.14f", 0x08000, 0x86585a94, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "pko-prg2.15f", 0x10000, 0x86cbe82d, BRF_ESS | BRF_PRG }, // 1 - - { "pko-001.8h", 0x80000, 0x1ead5d9b, BRF_GRA }, // 2 Characters - { "pko-003.8j", 0x80000, 0x339ab4e6, BRF_GRA }, // 3 - { "pko-002.9h", 0x80000, 0x1cf02586, BRF_GRA }, // 4 - { "pko-004.9j", 0x80000, 0x09ccb442, BRF_GRA }, // 5 - - { "pko-chr1.2j", 0x20000, 0x31ce33cd, BRF_GRA }, // 6 Sprites - { "pko-chr2.3j", 0x20000, 0xad7e055f, BRF_GRA }, // 7 - - { "pko-voi1.2d", 0x20000, 0x07e0f531, BRF_SND }, // 8 Samples - { "pko-voi2.3d", 0x20000, 0x18398bf6, BRF_SND }, // 9 -}; - -STD_ROM_PICK(Pkladies) -STD_ROM_FN(Pkladies) - -static struct BurnRomInfo PkladieslRomDesc[] = { - { "pk05.14f", 0x08000, 0xea1740a6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "pk06.15f", 0x20000, 0x3078ff5e, BRF_ESS | BRF_PRG }, // 1 - - { "pko-001.8h", 0x80000, 0x1ead5d9b, BRF_GRA }, // 2 Characters - { "pko-003.8j", 0x80000, 0x339ab4e6, BRF_GRA }, // 3 - { "pko-002.9h", 0x80000, 0x1cf02586, BRF_GRA }, // 4 - { "pko-004.9j", 0x80000, 0x09ccb442, BRF_GRA }, // 5 - - { "pko-chr1.2j", 0x20000, 0x31ce33cd, BRF_GRA }, // 6 Sprites - { "pko-chr2.3j", 0x20000, 0xad7e055f, BRF_GRA }, // 7 - - { "pko-voi1.2d", 0x20000, 0x07e0f531, BRF_SND }, // 8 Samples - { "pko-voi2.3d", 0x20000, 0x18398bf6, BRF_SND }, // 9 -}; - -STD_ROM_PICK(Pkladiesl) -STD_ROM_FN(Pkladiesl) - -static struct BurnRomInfo PkladieslaRomDesc[] = { - { "05.14f", 0x08000, 0xfa18e16a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "06.15f", 0x10000, 0xa2fb7646, BRF_ESS | BRF_PRG }, // 1 - - { "pko-001.8h", 0x80000, 0x1ead5d9b, BRF_GRA }, // 2 Characters - { "pko-003.8j", 0x80000, 0x339ab4e6, BRF_GRA }, // 3 - { "pko-002.9h", 0x80000, 0x1cf02586, BRF_GRA }, // 4 - { "pko-004.9j", 0x80000, 0x09ccb442, BRF_GRA }, // 5 - - { "pko-chr1.2j", 0x20000, 0x31ce33cd, BRF_GRA }, // 6 Sprites - { "pko-chr2.3j", 0x20000, 0xad7e055f, BRF_GRA }, // 7 - - { "pko-voi1.2d", 0x20000, 0x07e0f531, BRF_SND }, // 8 Samples - { "pko-voi2.3d", 0x20000, 0x18398bf6, BRF_SND }, // 9 -}; - -STD_ROM_PICK(Pkladiesla) -STD_ROM_FN(Pkladiesla) - -static struct BurnRomInfo DokabenRomDesc[] = { - { "db06.11h", 0x08000, 0x413e0886, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "db07.13h", 0x20000, 0x8bdcf49e, BRF_ESS | BRF_PRG }, // 1 - { "db08.14h", 0x20000, 0x1643bdd9, BRF_ESS | BRF_PRG }, // 2 - - { "db02.1e", 0x20000, 0x9aa8470c, BRF_GRA }, // 3 Characters - { "db03.2e", 0x20000, 0x3324e43d, BRF_GRA }, // 4 - { "db04.1g", 0x20000, 0xc0c5b6c2, BRF_GRA }, // 5 - { "db05.2g", 0x20000, 0xd2ab25f2, BRF_GRA }, // 6 - - { "db10.2k", 0x20000, 0x9e70f7ae, BRF_GRA }, // 7 Sprites - { "db09.1k", 0x20000, 0x2d9263f7, BRF_GRA }, // 8 - - { "db01.1d", 0x20000, 0x62fa6b81, BRF_SND }, // 9 Samples -}; - -STD_ROM_PICK(Dokaben) -STD_ROM_FN(Dokaben) - -static struct BurnRomInfo PangRomDesc[] = { - { "pang6.bin", 0x08000, 0x68be52cd, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "pang7.bin", 0x20000, 0x4a2e70f6, BRF_ESS | BRF_PRG }, // 1 - - { "pang_09.bin", 0x20000, 0x3a5883f5, BRF_GRA }, // 2 Characters - { "bb3.bin", 0x20000, 0x79a8ed08, BRF_GRA }, // 3 - { "pang_11.bin", 0x20000, 0x166a16ae, BRF_GRA }, // 4 - { "bb5.bin", 0x20000, 0x2fb3db6c, BRF_GRA }, // 5 - - { "bb10.bin", 0x20000, 0xfdba4f6e, BRF_GRA }, // 6 Sprites - { "bb9.bin", 0x20000, 0x39f47a63, BRF_GRA }, // 7 - - { "bb1.bin", 0x20000, 0xc52e5b8e, BRF_SND }, // 8 Samples -}; - -STD_ROM_PICK(Pang) -STD_ROM_FN(Pang) - -static struct BurnRomInfo BbrosRomDesc[] = { - { "bb6.bin", 0x08000, 0xa3041ca4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bb7.bin", 0x20000, 0x09231c68, BRF_ESS | BRF_PRG }, // 1 - - { "bb2.bin", 0x20000, 0x62f29992, BRF_GRA }, // 2 Characters - { "bb3.bin", 0x20000, 0x79a8ed08, BRF_GRA }, // 3 - { "bb4.bin", 0x20000, 0xf705aa89, BRF_GRA }, // 4 - { "bb5.bin", 0x20000, 0x2fb3db6c, BRF_GRA }, // 5 - - { "bb10.bin", 0x20000, 0xfdba4f6e, BRF_GRA }, // 6 Sprites - { "bb9.bin", 0x20000, 0x39f47a63, BRF_GRA }, // 7 - - { "bb1.bin", 0x20000, 0xc52e5b8e, BRF_SND }, // 8 Samples -}; - -STD_ROM_PICK(Bbros) -STD_ROM_FN(Bbros) - -static struct BurnRomInfo PompingwRomDesc[] = { - { "pwj_06.11h", 0x08000, 0x4a0a6426, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "pwj_07.13h", 0x20000, 0xa9402420, BRF_ESS | BRF_PRG }, // 1 - - { "pw_02.1e", 0x20000, 0x4b5992e4, BRF_GRA }, // 2 Characters - { "bb3.bin", 0x20000, 0x79a8ed08, BRF_GRA }, // 3 - { "pwj_04.1g", 0x20000, 0x01e49081, BRF_GRA }, // 4 - { "bb5.bin", 0x20000, 0x2fb3db6c, BRF_GRA }, // 5 - - { "bb10.bin", 0x20000, 0xfdba4f6e, BRF_GRA }, // 6 Sprites - { "bb9.bin", 0x20000, 0x39f47a63, BRF_GRA }, // 7 - - { "bb1.bin", 0x20000, 0xc52e5b8e, BRF_SND }, // 8 Samples -}; - -STD_ROM_PICK(Pompingw) -STD_ROM_FN(Pompingw) - -static struct BurnRomInfo PangbRomDesc[] = { - { "pang_04.bin", 0x10000, 0xf68f88a5, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "pang_02.bin", 0x20000, 0x3f15bb61, BRF_ESS | BRF_PRG }, // 1 - { "pang_03.bin", 0x20000, 0x0c8477ae, BRF_ESS | BRF_PRG }, // 2 - - { "pang_09.bin", 0x20000, 0x3a5883f5, BRF_GRA }, // 3 Characters - { "bb3.bin", 0x20000, 0x79a8ed08, BRF_GRA }, // 4 - { "pang_11.bin", 0x20000, 0x166a16ae, BRF_GRA }, // 5 - { "bb5.bin", 0x20000, 0x2fb3db6c, BRF_GRA }, // 6 - - { "bb10.bin", 0x20000, 0xfdba4f6e, BRF_GRA }, // 7 Sprites - { "bb9.bin", 0x20000, 0x39f47a63, BRF_GRA }, // 8 - - { "bb1.bin", 0x20000, 0xc52e5b8e, BRF_SND }, // 9 Samples -}; - -STD_ROM_PICK(Pangb) -STD_ROM_FN(Pangb) - -static struct BurnRomInfo PangboldRomDesc[] = { - { "4.6l", 0x10000, 0xf68f88a5, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "2.3l", 0x20000, 0x3f15bb61, BRF_ESS | BRF_PRG }, // 1 - { "3.5l", 0x20000, 0xce6375e4, BRF_ESS | BRF_PRG }, // 2 - - { "9.10o", 0x20000, 0x3a5883f5, BRF_GRA }, // 3 Characters - { "10.14o", 0x20000, 0x79a8ed08, BRF_GRA }, // 4 - { "11.17j", 0x20000, 0x166a16ae, BRF_GRA }, // 5 - { "12.20j", 0x20000, 0x2fb3db6c, BRF_GRA }, // 6 - - { "8.7o", 0x10000, 0xf3188aa1, BRF_GRA }, // 7 Sprites - { "7.5o", 0x10000, 0x011da14b, BRF_GRA }, // 8 - { "6.3o", 0x10000, 0x0e25e797, BRF_GRA }, // 9 - { "5.1o", 0x10000, 0x6daa4e27, BRF_GRA }, // 10 - - { "1.1a", 0x10000, 0xb6463907, BRF_SND }, // 11 Samples -}; - -STD_ROM_PICK(Pangbold) -STD_ROM_FN(Pangbold) - -static struct BurnRomInfo CworldRomDesc[] = { - { "cw05.bin", 0x08000, 0xd3c1723d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "cw06.bin", 0x20000, 0xd71ed4a3, BRF_ESS | BRF_PRG }, // 1 - { "cw07.bin", 0x20000, 0xd419ce08, BRF_ESS | BRF_PRG }, // 2 - - { "cw08.bin", 0x20000, 0x6c80da3c, BRF_GRA }, // 3 Characters - { "cw09.bin", 0x20000, 0x7607da71, BRF_GRA }, // 4 - { "cw10.bin", 0x20000, 0x6f0e639f, BRF_GRA }, // 5 - { "cw11.bin", 0x20000, 0x130bd7c0, BRF_GRA }, // 6 - { "cw18.bin", 0x20000, 0xbe6ee0c9, BRF_GRA }, // 7 - { "cw19.bin", 0x20000, 0x51fc5532, BRF_GRA }, // 8 - { "cw20.bin", 0x20000, 0x58381d58, BRF_GRA }, // 9 - { "cw21.bin", 0x20000, 0x910cc753, BRF_GRA }, // 10 - - { "cw16.bin", 0x20000, 0xf90217d1, BRF_GRA }, // 11 Sprites - { "cw17.bin", 0x20000, 0xc953c702, BRF_GRA }, // 12 - - { "cw01.bin", 0x20000, 0xf4368f5b, BRF_SND }, // 13 Samples -}; - -STD_ROM_PICK(Cworld) -STD_ROM_FN(Cworld) - -static struct BurnRomInfo HatenaRomDesc[] = { - { "q2-05.rom", 0x08000, 0x66c9e1da, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "q2-06.rom", 0x20000, 0x5fc39916, BRF_ESS | BRF_PRG }, // 1 - { "q2-07.rom", 0x20000, 0xec6d5e5e, BRF_ESS | BRF_PRG }, // 2 - - { "q2-08.rom", 0x20000, 0x6c80da3c, BRF_GRA }, // 3 Characters - { "q2-09.rom", 0x20000, 0xabe3e15c, BRF_GRA }, // 4 - { "q2-10.rom", 0x20000, 0x6963450d, BRF_GRA }, // 5 - { "q2-11.rom", 0x20000, 0x1e319fa2, BRF_GRA }, // 6 - { "q2-18.rom", 0x20000, 0xbe6ee0c9, BRF_GRA }, // 7 - { "q2-19.rom", 0x20000, 0x70300445, BRF_GRA }, // 8 - { "q2-20.rom", 0x20000, 0x21a6ff42, BRF_GRA }, // 9 - { "q2-21.rom", 0x20000, 0x076280c9, BRF_GRA }, // 10 - - { "q2-16.rom", 0x20000, 0xec19b2f0, BRF_GRA }, // 11 Sprites - { "q2-17.rom", 0x20000, 0xecd69d92, BRF_GRA }, // 12 - - { "q2-01.rom", 0x20000, 0x149e7a89, BRF_SND }, // 13 Samples -}; - -STD_ROM_PICK(Hatena) -STD_ROM_FN(Hatena) - -static struct BurnRomInfo SpangRomDesc[] = { - { "spe_06.rom", 0x08000, 0x1af106fb, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "spe_07.rom", 0x20000, 0x208b5f54, BRF_ESS | BRF_PRG }, // 1 - { "spe_08.rom", 0x20000, 0x2bc03ade, BRF_ESS | BRF_PRG }, // 2 - - { "spe_02.rom", 0x20000, 0x63c9dfd2, BRF_GRA }, // 3 Characters - { "03.f2", 0x20000, 0x3ae28bc1, BRF_GRA }, // 4 - { "spe_04.rom", 0x20000, 0x9d7b225b, BRF_GRA }, // 5 - { "05.g2", 0x20000, 0x4a060884, BRF_GRA }, // 6 - - { "spj10_2k.bin", 0x20000, 0xeedd0ade, BRF_GRA }, // 7 Sprites - { "spj09_1k.bin", 0x20000, 0x04b41b75, BRF_GRA }, // 8 - - { "spe_01.rom", 0x20000, 0x2d19c133, BRF_SND }, // 9 Samples - - { "eeprom-spang.bin", 0x80, 0xdeae1291, BRF_PRG }, -}; - -STD_ROM_PICK(Spang) -STD_ROM_FN(Spang) - -static struct BurnRomInfo SpangjRomDesc[] = { - { "spj_11h.bin", 0x08000, 0x1a548b0b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "spj7_13h.bin", 0x20000, 0x14c2b765, BRF_ESS | BRF_PRG }, // 1 - { "spj8_14h.bin", 0x20000, 0x4be4e5b7, BRF_ESS | BRF_PRG }, // 2 - - { "spj02_1e.bin", 0x20000, 0x419f69d7, BRF_GRA }, // 3 Characters - { "03.f2", 0x20000, 0x3ae28bc1, BRF_GRA }, // 4 - { "spj04_1g.bin", 0x20000, 0x6870506f, BRF_GRA }, // 5 - { "05.g2", 0x20000, 0x4a060884, BRF_GRA }, // 6 - - { "spj10_2k.bin", 0x20000, 0xeedd0ade, BRF_GRA }, // 7 Sprites - { "spj09_1k.bin", 0x20000, 0x04b41b75, BRF_GRA }, // 8 - - { "01.d1", 0x20000, 0xb96ea126, BRF_SND }, // 9 Samples - - { "eeprom-spangj.bin",0x80, 0x237c00eb, BRF_PRG }, -}; - -STD_ROM_PICK(Spangj) -STD_ROM_FN(Spangj) - -static struct BurnRomInfo SbbrosRomDesc[] = { - { "06.j12", 0x08000, 0x292eee6a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "07.j13", 0x20000, 0xf46b698d, BRF_ESS | BRF_PRG }, // 1 - { "08.j14", 0x20000, 0xa75e7fbe, BRF_ESS | BRF_PRG }, // 2 - - { "02.f1", 0x20000, 0x0c22ffc6, BRF_GRA }, // 3 Characters - { "03.f2", 0x20000, 0x3ae28bc1, BRF_GRA }, // 4 - { "04.g2", 0x20000, 0xbb3dee5b, BRF_GRA }, // 5 - { "05.g2", 0x20000, 0x4a060884, BRF_GRA }, // 6 - - { "10.l2", 0x20000, 0xd6675d8f, BRF_GRA }, // 7 Sprites - { "09.l1", 0x20000, 0x8f678bc8, BRF_GRA }, // 8 - - { "01.d1", 0x20000, 0xb96ea126, BRF_SND }, // 9 Samples - - { "eeprom-sbbros.bin",0x80, 0xed69d3cd, BRF_PRG }, -}; - -STD_ROM_PICK(Sbbros) -STD_ROM_FN(Sbbros) - -static struct BurnRomInfo MstworldRomDesc[] = { - { "mw-1.rom", 0x80000, 0xc4e51fb4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - - { "mw-2.rom", 0x08000, 0x12c4fea9, BRF_ESS | BRF_PRG }, // 1 Z80 #2 Program Code - - { "mw-4.rom", 0x20000, 0x28a3af15, BRF_GRA }, // 2 Characters - { "mw-5.rom", 0x20000, 0xffdf7e9f, BRF_GRA }, // 3 - { "mw-6.rom", 0x20000, 0x1ed773a3, BRF_GRA }, // 4 - { "mw-7.rom", 0x20000, 0x8eb7525c, BRF_GRA }, // 5 - - { "mw-8.rom", 0x20000, 0xb9b92a3c, BRF_GRA }, // 6 Sprites - { "mw-9.rom", 0x20000, 0x75fc3375, BRF_GRA }, // 7 - - { "mw-3.rom", 0x80000, 0x110c6a68, BRF_SND }, // 8 Samples -}; - -STD_ROM_PICK(Mstworld) -STD_ROM_FN(Mstworld) - -static struct BurnRomInfo MarukinRomDesc[] = { - { "mg3-01.9d", 0x08000, 0x04357973, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "mg3-02.10d", 0x20000, 0x50d08da0, BRF_ESS | BRF_PRG }, // 1 - - { "mg3-a.3k", 0x80000, 0x420f1de7, BRF_GRA }, // 2 Characters - { "mg3-b.4k", 0x80000, 0xd8de13fa, BRF_GRA }, // 3 - { "mg3-c.6k", 0x80000, 0xfbeb66e8, BRF_GRA }, // 4 - { "mg3-d.7k", 0x80000, 0x8f6bd831, BRF_GRA }, // 5 - - { "mg3-05.2g", 0x20000, 0x7a738d2d, BRF_GRA }, // 6 Sprites - { "mg3-04.1g", 0x20000, 0x56f30515, BRF_GRA }, // 7 - - { "mg3-e.1d", 0x80000, 0x106c2fa9, BRF_SND }, // 8 Samples -}; - -STD_ROM_PICK(Marukin) -STD_ROM_FN(Marukin) - -static struct BurnRomInfo Qtono1RomDesc[] = { - { "q3-05.rom", 0x08000, 0x1dd0a344, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "q3-06.rom", 0x20000, 0xbd6a2110, BRF_ESS | BRF_PRG }, // 1 - { "q3-07.rom", 0x20000, 0x61e53c4f, BRF_ESS | BRF_PRG }, // 2 - - { "q3-08.rom", 0x20000, 0x1533b978, BRF_GRA }, // 3 Characters - { "q3-09.rom", 0x20000, 0xa32db2f2, BRF_GRA }, // 4 - { "q3-10.rom", 0x20000, 0xed681aa8, BRF_GRA }, // 5 - { "q3-11.rom", 0x20000, 0x38b2fd10, BRF_GRA }, // 6 - { "q3-18.rom", 0x20000, 0x9e4292ac, BRF_GRA }, // 7 - { "q3-19.rom", 0x20000, 0xb7f6d40f, BRF_GRA }, // 8 - { "q3-20.rom", 0x20000, 0x6cd7f38d, BRF_GRA }, // 9 - { "q3-21.rom", 0x20000, 0xb4aa6b4b, BRF_GRA }, // 10 - - { "q3-16.rom", 0x20000, 0x863d6836, BRF_GRA }, // 11 Sprites - { "q3-17.rom", 0x20000, 0x459bf59c, BRF_GRA }, // 12 - - { "q3-01.rom", 0x20000, 0x6c1be591, BRF_SND }, // 13 Samples -}; - -STD_ROM_PICK(Qtono1) -STD_ROM_FN(Qtono1) - -static struct BurnRomInfo QsangokuRomDesc[] = { - { "q4-05c.rom", 0x08000, 0xe1d010b4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "q4-06.rom", 0x20000, 0xa0301849, BRF_ESS | BRF_PRG }, // 1 - { "q4-07.rom", 0x20000, 0x2941ef5b, BRF_ESS | BRF_PRG }, // 2 - - { "q4-08.rom", 0x20000, 0xdc84c6cb, BRF_GRA }, // 3 Characters - { "q4-09.rom", 0x20000, 0xcbb6234c, BRF_GRA }, // 4 - { "q4-10.rom", 0x20000, 0xc20a27a8, BRF_GRA }, // 5 - { "q4-11.rom", 0x20000, 0x4ff66aed, BRF_GRA }, // 6 - { "q4-18.rom", 0x20000, 0xca3acea5, BRF_GRA }, // 7 - { "q4-19.rom", 0x20000, 0x1fd92b7d, BRF_GRA }, // 8 - { "q4-20.rom", 0x20000, 0xb02dc6a1, BRF_GRA }, // 9 - { "q4-21.rom", 0x20000, 0x432b1dc1, BRF_GRA }, // 10 - - { "q4-16.rom", 0x20000, 0x77342320, BRF_GRA }, // 11 Sprites - { "q4-17.rom", 0x20000, 0x1275c436, BRF_GRA }, // 12 - - { "q4-01.rom", 0x20000, 0x5d0d07d8, BRF_SND }, // 13 Samples -}; - -STD_ROM_PICK(Qsangoku) -STD_ROM_FN(Qsangoku) - -static struct BurnRomInfo BlockRomDesc[] = { - { "ble_05.rom", 0x08000, 0xc12e7f4c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ble_06.rom", 0x20000, 0xcdb13d55, BRF_ESS | BRF_PRG }, // 1 - { "ble_07.rom", 0x20000, 0x1d114f13, BRF_ESS | BRF_PRG }, // 2 - - { "bl_08.rom", 0x20000, 0xaa0f4ff1, BRF_GRA }, // 3 Characters - { "bl_09.rom", 0x20000, 0x6fa8c186, BRF_GRA }, // 4 - { "bl_18.rom", 0x20000, 0xc0acafaf, BRF_GRA }, // 5 - { "bl_19.rom", 0x20000, 0x1ae942f5, BRF_GRA }, // 6 - - { "bl_16.rom", 0x20000, 0xfadcaff7, BRF_GRA }, // 7 Sprites - { "bl_17.rom", 0x20000, 0x5f8cab42, BRF_GRA }, // 8 - - { "bl_01.rom", 0x20000, 0xc2ec2abb, BRF_SND }, // 9 Samples -}; - -STD_ROM_PICK(Block) -STD_ROM_FN(Block) - -static struct BurnRomInfo BlockjRomDesc[] = { - { "blj_05.rom", 0x08000, 0x3b55969a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ble_06.rom", 0x20000, 0xcdb13d55, BRF_ESS | BRF_PRG }, // 1 - { "blj_07.rom", 0x20000, 0x1723883c, BRF_ESS | BRF_PRG }, // 2 - - { "bl_08.rom", 0x20000, 0xaa0f4ff1, BRF_GRA }, // 3 Characters - { "bl_09.rom", 0x20000, 0x6fa8c186, BRF_GRA }, // 4 - { "bl_18.rom", 0x20000, 0xc0acafaf, BRF_GRA }, // 5 - { "bl_19.rom", 0x20000, 0x1ae942f5, BRF_GRA }, // 6 - - { "bl_16.rom", 0x20000, 0xfadcaff7, BRF_GRA }, // 7 Sprites - { "bl_17.rom", 0x20000, 0x5f8cab42, BRF_GRA }, // 8 - - { "bl_01.rom", 0x20000, 0xc2ec2abb, BRF_SND }, // 9 Samples -}; - -STD_ROM_PICK(Blockj) -STD_ROM_FN(Blockj) - -static struct BurnRomInfo BlockjoyRomDesc[] = { - { "ble_05.bin", 0x08000, 0xfa2a4536, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "blf_06.bin", 0x20000, 0xe114ebde, BRF_ESS | BRF_PRG }, // 1 - { "ble_07.rom", 0x20000, 0x1d114f13, BRF_ESS | BRF_PRG }, // 2 - - { "bl_08.rom", 0x20000, 0xaa0f4ff1, BRF_GRA }, // 3 Characters - { "bl_09.rom", 0x20000, 0x6fa8c186, BRF_GRA }, // 4 - { "bl_18.rom", 0x20000, 0xc0acafaf, BRF_GRA }, // 5 - { "bl_19.rom", 0x20000, 0x1ae942f5, BRF_GRA }, // 6 - - { "bl_16.rom", 0x20000, 0xfadcaff7, BRF_GRA }, // 7 Sprites - { "bl_17.rom", 0x20000, 0x5f8cab42, BRF_GRA }, // 8 - - { "bl_01.rom", 0x20000, 0xc2ec2abb, BRF_SND }, // 9 Samples -}; - -STD_ROM_PICK(Blockjoy) -STD_ROM_FN(Blockjoy) - -static struct BurnRomInfo BlockblRomDesc[] = { - { "m7.l6", 0x10000, 0x3b576fd9, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "m5.l3", 0x40000, 0x7c988bb7, BRF_ESS | BRF_PRG }, // 1 - { "m6.l5", 0x20000, 0x5768d8eb, BRF_ESS | BRF_PRG }, // 2 - - { "m12.o10", 0x20000, 0x963154d9, BRF_GRA }, // 3 Characters - { "m13.o14", 0x20000, 0x069480bb, BRF_GRA }, // 4 - { "m4.j17", 0x20000, 0x9e3b6f4f, BRF_GRA }, // 5 - { "m3.j20", 0x20000, 0x629d58fe, BRF_GRA }, // 6 - - { "m11.o7", 0x10000, 0x255180a5, BRF_GRA }, // 7 Sprites - { "m10.o5", 0x10000, 0x3201c088, BRF_GRA }, // 8 - { "m9.o3", 0x10000, 0x29357fe4, BRF_GRA }, // 9 - { "m8.o2", 0x10000, 0xabd665d1, BRF_GRA }, // 10 - - { "bl_01.rom", 0x20000, 0xc2ec2abb, BRF_SND }, // 11 Samples -}; - -STD_ROM_PICK(Blockbl) -STD_ROM_FN(Blockbl) - -static const eeprom_interface MitchellEEPROMIntf = -{ - 6, - 16, - "0110", - "0101", - "0111", - 0, - 0, - 0, - 0 -}; - -static INT32 MgakuenMemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom = Next; Next += 0x50000; - MSM6295ROM = Next; Next += 0x40000; - DrvSoundRom = Next; Next += 0x80000; - - RamStart = Next; - - DrvZ80Ram = Next; Next += 0x01000; - DrvPaletteRam = Next; Next += 0x00800; - DrvAttrRam = Next; Next += 0x00800; - DrvVideoRam = Next; Next += 0x01000; - DrvSpriteRam = Next; Next += 0x01000; - - RamEnd = Next; - - DrvChars = Next; Next += 0x10000 * 8 * 8; - DrvSprites = Next; Next += 0x00800 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 PangMemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom = Next; Next += 0x50000; - DrvZ80Code = Next; Next += 0x50000; - DrvSoundRom = Next; Next += 0x20000; - - RamStart = Next; - - DrvZ80Ram = Next; Next += 0x02000; - DrvPaletteRam = Next; Next += 0x01000; - DrvAttrRam = Next; Next += 0x00800; - DrvVideoRam = Next; Next += 0x01000; - DrvSpriteRam = Next; Next += 0x01000; - - RamEnd = Next; - - DrvChars = Next; Next += 0x8000 * 8 * 8; - DrvSprites = Next; Next += 0x0800 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 MahjongMemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom = Next; Next += 0x50000; - DrvZ80Code = Next; Next += 0x50000; - MSM6295ROM = Next; Next += 0x40000; - DrvSoundRom = Next; Next += 0x80000; - - RamStart = Next; - - DrvZ80Ram = Next; Next += 0x02000; - DrvPaletteRam = Next; Next += 0x01000; - DrvAttrRam = Next; Next += 0x00800; - DrvVideoRam = Next; Next += 0x01000; - DrvSpriteRam = Next; Next += 0x01000; - - RamEnd = Next; - - DrvChars = Next; Next += 0x10000 * 8 * 8; - DrvSprites = Next; Next += 0x00800 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 MstworldMemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom = Next; Next += 0x50000; - DrvZ80Code = Next; Next += 0x50000; - DrvZ80Rom2 = Next; Next += 0x08000; - MSM6295ROM = Next; Next += 0x40000; - DrvSoundRom = Next; Next += 0x100000; - - RamStart = Next; - - DrvZ80Ram = Next; Next += 0x02000; - DrvZ80Ram2 = Next; Next += 0x00800; - DrvPaletteRam = Next; Next += 0x01000; - DrvAttrRam = Next; Next += 0x00800; - DrvVideoRam = Next; Next += 0x01000; - DrvSpriteRam = Next; Next += 0x01000; - - RamEnd = Next; - - DrvChars = Next; Next += 0x4000 * 8 * 8; - DrvSprites = Next; Next += 0x0800 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - ZetOpen(0); - DrvRomBank = 0; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - if (DrvHasEEPROM) { - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - } else { - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - } - ZetReset(); - ZetClose(); - - BurnYM2413Reset(); - MSM6295Reset(0); - - if (DrvHasEEPROM) EEPROMReset(); - - DrvPaletteRamBank = 0; - DrvVideoBank = 0; - DrvDialSelected = 0; - - return 0; -} - -static INT32 MstworldDoReset() -{ - ZetOpen(0); - DrvRomBank = 0; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - - DrvPaletteRamBank = 0; - DrvVideoBank = 0; - DrvSoundLatch = 0; - - return 0; -} - -static UINT8 BlockDialRead(INT32 Offset) -{ - static INT32 Dir[2]; - - if (DrvDialSelected) { - INT32 Delta; - - Delta = ((Offset ? DrvDial2 : DrvDial1) - DrvDial[Offset]) & 0xff; - if (Delta & 0x80) { - Delta = (-Delta) & 0xff; - if (Dir[Offset]) { - Dir[Offset] = 0; - Delta = 0; - } - } else { - if (Delta > 0) { - if (Dir[Offset] == 0) { - Dir[Offset] = 1; - Delta = 0; - } - } - } - - if (Delta > 0x3f) Delta = 0x3f; - - return Delta << 2; - } else { - INT32 Res = (0xff - DrvInput[Offset + 1]) & 0xf7; - if (Dir[Offset]) Res |= 0x08; - - return Res; - } -} - -UINT8 __fastcall MitchellZ80Read(UINT16 a) -{ - if (a >= 0xc000 && a <= 0xc7ff) { - return DrvPaletteRam[(a - 0xc000) + (DrvPaletteRamBank ? 0x800 : 0x000)]; - } - - if (a >= 0xd000 && a <= 0xdfff) { - INT32 Offset = a - 0xd000; - if (DrvVideoBank) { - return DrvSpriteRam[Offset]; - } else { - return DrvVideoRam[Offset]; - } - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall MitchellZ80Write(UINT16 a, UINT8 d) -{ - if (a >= 0xc000 && a <= 0xc7ff) { - DrvPaletteRam[(a - 0xc000) + (DrvPaletteRamBank ? 0x800 : 0x000)] = d; - return; - } - - if (a >= 0xd000 && a <= 0xdfff) { - INT32 Offset = a - 0xd000; - if (DrvVideoBank) { - DrvSpriteRam[Offset] = d; - } else { - DrvVideoRam[Offset] = d; - } - return; - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall MitchellZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return 0xff - DrvInput[0]; - } - - case 0x01: { - switch (DrvInputType) { - case DRV_INPUT_TYPE_MAHJONG: { - if (DrvMahjongKeyMatrix & (0x80 >> 0)) return 0xff - DrvInput[1]; - if (DrvMahjongKeyMatrix & (0x80 >> 1)) return 0xff - DrvInput[2]; - if (DrvMahjongKeyMatrix & (0x80 >> 2)) return 0xff - DrvInput[4]; - if (DrvMahjongKeyMatrix & (0x80 >> 3)) return 0xff - DrvInput[5]; - if (DrvMahjongKeyMatrix & (0x80 >> 4)) return 0xff - DrvInput[6]; - } - - case DRV_INPUT_TYPE_BLOCK: { - return BlockDialRead(0); - } - } - - return 0xff - DrvInput[1]; - } - - case 0x02: { - switch (DrvInputType) { - case DRV_INPUT_TYPE_MAHJONG: { - if (DrvMahjongKeyMatrix & (0x80 >> 0)) return 0xff - DrvInput[7]; - if (DrvMahjongKeyMatrix & (0x80 >> 1)) return 0xff - DrvInput[8]; - if (DrvMahjongKeyMatrix & (0x80 >> 2)) return 0xff - DrvInput[9]; - if (DrvMahjongKeyMatrix & (0x80 >> 3)) return 0xff - DrvInput[10]; - if (DrvMahjongKeyMatrix & (0x80 >> 4)) return 0xff - DrvInput[11]; - } - - case DRV_INPUT_TYPE_BLOCK: { - return BlockDialRead(1); - } - } - - return 0xff - DrvInput[2]; - } - - case 0x03: { - return DrvDip[0]; - } - - case 0x04: { - return DrvDip[1]; - } - - case 0x05: { - INT32 Bit = DrvHasEEPROM ? (EEPROMRead() & 0x01) << 7 : 0x80; - if (DrvInput5Toggle) { - Bit |= 0x01; - } else { - Bit |= 0x08; - } - - if (DrvPort5Kludge) Bit ^= 0x08; - - return ((0xff - DrvInput[3]) & 0x76) | Bit; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0xff; -} - -void __fastcall MitchellZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - DrvFlipScreen = d & 0x04; - if (DrvOkiBank != (d & 0x10)) { - DrvOkiBank = d & 0x10; - if (DrvOkiBank) { - memcpy(MSM6295ROM, DrvSoundRom + 0x40000, 0x40000); - } else { - memcpy(MSM6295ROM, DrvSoundRom + 0x00000, 0x40000); - } - } - DrvPaletteRamBank = d & 0x20; - return; - } - - case 0x01: { - switch (DrvInputType) { - case DRV_INPUT_TYPE_MAHJONG: { - DrvMahjongKeyMatrix = d; - return; - } - - case DRV_INPUT_TYPE_BLOCK: { - if (d == 0x08) { - DrvDial[0] = DrvDial1; - DrvDial[1] = DrvDial2; - } else { - if (d == 0x80) { - DrvDialSelected = 0; - } else { - DrvDialSelected = 1; - } - } - return; - } - } - - return; - } - - case 0x02: { - DrvRomBank = d & 0x0f; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - if (DrvHasEEPROM) { - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - } else { - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - } - return; - } - - case 0x03: { - BurnYM2413Write(1, d); - return; - } - - case 0x04: { - BurnYM2413Write(0, d); - return; - } - - case 0x05: { - MSM6295Command(0, d); - return; - } - - case 0x06:{ - // nop - return; - } - - case 0x07: { - DrvVideoBank = d; - return; - } - - case 0x08 :{ - if (DrvHasEEPROM) EEPROMSetCSLine(d ? 0 : 1); - return; - } - - case 0x10 :{ - if (DrvHasEEPROM) EEPROMSetClockLine(d ? 0 : 1); - return; - } - - case 0x18 :{ - if (DrvHasEEPROM) EEPROMWriteBit(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall MstworldZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return 0xff - DrvInput[0]; - } - - case 0x01: { - return 0xfe - DrvInput[1]; - } - - case 0x02: { - return 0xfe - DrvInput[2]; - } - - case 0x03: { - return DrvDip[0]; - } - - case 0x05: { - return 0xff - DrvInput[3]; - } - - case 0x06: { - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0xff; -} - -void __fastcall MstworldZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - DrvFlipScreen = d & 0x04; - DrvPaletteRamBank = d & 0x20; - return; - } - - case 0x02: { - DrvRomBank = d & 0x0f; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - return; - } - - case 0x03: { - DrvSoundLatch = d; - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(0); - } - - case 0x06: { - // nop - return; - } - - case 0x07: { - DrvVideoBank = d & 0x01; - return; - } - - case 0x08: - case 0x10: - case 0x18: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall MstworldSoundZ80Read(UINT16 a) -{ - switch (a) { - case 0x9800: { - return MSM6295ReadStatus(0); - } - - case 0xa000: { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall MstworldSoundZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x9000: { - DrvOkiBank = d & 0x03; - memcpy(MSM6295ROM, DrvSoundRom + (DrvOkiBank * 0x40000), 0x40000); - return; - } - - case 0x9800: { - MSM6295Command(0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); - } - } -} - -// Kabuki - we use the module from the CPS-1 Q-Sound games -extern void kabuki_decode(UINT8 *src, UINT8 *dest_op, UINT8 *dest_data, INT32 base_addr, INT32 length, INT32 swap_key1, INT32 swap_key2, INT32 addr_key, INT32 xor_key); - -static void mitchell_decode(INT32 swap_key1, INT32 swap_key2, INT32 addr_key, INT32 xor_key) -{ - UINT8 *rom = DrvZ80Rom; - UINT8 *decrypt = DrvZ80Code; - INT32 numbanks = (0x50000 - 0x10000) / 0x4000; - INT32 i; - - kabuki_decode(rom, decrypt, rom, 0x0000, 0x8000, swap_key1, swap_key2, addr_key, xor_key); - - rom += 0x10000; - decrypt += 0x10000; - for (i = 0; i < numbanks; i++) - kabuki_decode(rom + i * 0x4000,decrypt + i * 0x4000, rom + i * 0x4000, 0x8000, 0x4000, swap_key1, swap_key2, addr_key, xor_key); -} - -static void mgakuen2_decode() { mitchell_decode(0x76543210, 0x01234567, 0xaa55, 0xa5); } -static void pang_decode() { mitchell_decode(0x01234567, 0x76543210, 0x6548, 0x24); } -static void cworld_decode() { mitchell_decode(0x04152637, 0x40516273, 0x5751, 0x43); } -static void hatena_decode() { mitchell_decode(0x45670123, 0x45670123, 0x5751, 0x43); } -static void spang_decode() { mitchell_decode(0x45670123, 0x45670123, 0x5852, 0x43); } -static void spangj_decode() { mitchell_decode(0x45123670, 0x67012345, 0x55aa, 0x5a); } -static void sbbros_decode() { mitchell_decode(0x45670123, 0x45670123, 0x2130, 0x12); } -static void marukin_decode() { mitchell_decode(0x54321076, 0x54321076, 0x4854, 0x4f); } -static void qtono1_decode() { mitchell_decode(0x12345670, 0x12345670, 0x1111, 0x11); } -static void qsangoku_decode() { mitchell_decode(0x23456701, 0x23456701, 0x1828, 0x18); } -static void block_decode() { mitchell_decode(0x02461357, 0x64207531, 0x0002, 0x01); } - -static INT32 CharPlaneOffsets[4] = { 0x400004, 0x400000, 4, 0 }; -static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; -static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; -static INT32 MahjongCharPlaneOffsets[4] = { 12, 8, 4, 0 }; -static INT32 MahjongCharXOffsets[8] = { 0, 1, 2, 3, 16, 17, 18, 19 }; -static INT32 MahjongCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 SpritePlaneOffsets[4] = { 0x100004, 0x100000, 4, 0 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; -static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; -static INT32 MstworldCharPlaneOffsets[4] = { 0x200000, 0x300000, 0, 0x100000 }; -static INT32 MstworldCharXOffsets[8] = { 7, 6, 5, 4, 3, 2, 1, 0 }; -static INT32 MstworldCharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 MstworldSpritePlaneOffsets[4] = { 4, 0, 0x100004, 0x100000 }; -static INT32 MstworldSpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; -static INT32 MstworldSpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; - -static void MitchellMachineInit() -{ - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(MitchellZ80Read); - ZetSetWriteHandler(MitchellZ80Write); - ZetSetInHandler(MitchellZ80PortRead); - ZetSetOutHandler(MitchellZ80PortWrite); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom + 0x00000 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Code + 0x00000, DrvZ80Rom + 0x00000); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000, DrvZ80Rom + 0x10000); - ZetMapArea(0xc800, 0xcfff, 0, DrvAttrRam ); - ZetMapArea(0xc800, 0xcfff, 1, DrvAttrRam ); - ZetMapArea(0xc800, 0xcfff, 2, DrvAttrRam ); - ZetMapArea(0xe000, 0xffff, 0, DrvZ80Ram ); - ZetMapArea(0xe000, 0xffff, 1, DrvZ80Ram ); - ZetMapArea(0xe000, 0xffff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - BurnYM2413Init(4000000); - BurnYM2413SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - MSM6295Init(0, 1000000 / 132, 1); - MSM6295SetRoute(0, 0.30, BURN_SND_ROUTE_BOTH); - MSM6295ROM = DrvSoundRom; - - EEPROMInit(&MitchellEEPROMIntf); - DrvHasEEPROM = 1; - - GenericTilesInit(); - - DrvTileMask = 0x7fff; - DrvNumColours = 0x800; -} - -static void MahjongMachineInit() -{ - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(MitchellZ80Read); - ZetSetWriteHandler(MitchellZ80Write); - ZetSetInHandler(MitchellZ80PortRead); - ZetSetOutHandler(MitchellZ80PortWrite); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom + 0x00000 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Code + 0x00000, DrvZ80Rom + 0x00000); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000, DrvZ80Rom + 0x10000); - ZetMapArea(0xc800, 0xcfff, 0, DrvAttrRam ); - ZetMapArea(0xc800, 0xcfff, 1, DrvAttrRam ); - ZetMapArea(0xc800, 0xcfff, 2, DrvAttrRam ); - ZetMapArea(0xe000, 0xffff, 0, DrvZ80Ram ); - ZetMapArea(0xe000, 0xffff, 1, DrvZ80Ram ); - ZetMapArea(0xe000, 0xffff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - BurnYM2413Init(4000000); - BurnYM2413SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - MSM6295Init(0, 990000 / 132, 1); - MSM6295SetRoute(0, 0.30, BURN_SND_ROUTE_BOTH); - memcpy(MSM6295ROM, DrvSoundRom, 0x40000); - - EEPROMInit(&MitchellEEPROMIntf); - DrvHasEEPROM = 1; - - GenericTilesInit(); - - DrvTileMask = 0xffff; - DrvNumColours = 0x800; -} - -static INT32 MgakuenInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - MgakuenMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MgakuenMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x200000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x010000, 1, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x180000, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x10000, 4, 8, 8, MahjongCharPlaneOffsets, MahjongCharXOffsets, MahjongCharYOffsets, 0x100, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x020000, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x00800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x000000, 8, 1); if (nRet != 0) return 1; - - ZetInit(0); - ZetOpen(0); - ZetSetInHandler(MitchellZ80PortRead); - ZetSetOutHandler(MitchellZ80PortWrite); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom + 0x00000); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom + 0x00000); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x10000); - ZetMapArea(0xc000, 0xc7ff, 0, DrvPaletteRam ); - ZetMapArea(0xc000, 0xc7ff, 1, DrvPaletteRam ); - ZetMapArea(0xc000, 0xc7ff, 2, DrvPaletteRam ); - ZetMapArea(0xc800, 0xcfff, 0, DrvAttrRam ); - ZetMapArea(0xc800, 0xcfff, 1, DrvAttrRam ); - ZetMapArea(0xc800, 0xcfff, 2, DrvAttrRam ); - ZetMapArea(0xd000, 0xdfff, 0, DrvVideoRam ); - ZetMapArea(0xd000, 0xdfff, 1, DrvVideoRam ); - ZetMapArea(0xd000, 0xdfff, 2, DrvVideoRam ); - ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram ); - ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram ); - ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram ); - ZetMapArea(0xf000, 0xffff, 0, DrvSpriteRam ); - ZetMapArea(0xf000, 0xffff, 1, DrvSpriteRam ); - ZetMapArea(0xf000, 0xffff, 2, DrvSpriteRam ); - ZetMemEnd(); - ZetClose(); - - BurnYM2413Init(4000000); - BurnYM2413SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - MSM6295Init(0, 990000 / 132, 1); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - memcpy(MSM6295ROM, DrvSoundRom, 0x40000); - - GenericTilesInit(); - - DrvTileMask = 0xffff; - DrvNumColours = 0x400; - DrvHasEEPROM = 0; - - DrvInputType = DRV_INPUT_TYPE_MAHJONG; - - DrvDoReset(); - - return 0; -} - -static INT32 Mgakuen2Init() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - MahjongMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MahjongMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x200000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x010000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x030000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x180000, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x10000, 4, 8, 8, MahjongCharPlaneOffsets, MahjongCharXOffsets, MahjongCharYOffsets, 0x100, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x020000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x00800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x000000, 9, 1); if (nRet != 0) return 1; - - mgakuen2_decode(); - - MahjongMachineInit(); - - DrvInputType = DRV_INPUT_TYPE_MAHJONG; - - DrvPort5Kludge = 1; - - DrvDoReset(); - - return 0; -} - -static INT32 PkladiesInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - MahjongMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MahjongMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x200000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x010000, 1, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100001, 5, 2); if (nRet != 0) return 1; - GfxDecode(0x10000, 4, 8, 8, MahjongCharPlaneOffsets, MahjongCharXOffsets, MahjongCharYOffsets, 0x100, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x020000, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x00800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x000000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvSoundRom + 0x020000, 9, 1); if (nRet != 0) return 1; - - mgakuen2_decode(); - - MahjongMachineInit(); - - DrvInputType = DRV_INPUT_TYPE_MAHJONG; - - DrvDoReset(); - - return 0; -} - -static INT32 DokabenInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; - - mgakuen2_decode(); - - MitchellMachineInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 PangInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 8, 1); if (nRet != 0) return 1; - - pang_decode(); - - MitchellMachineInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 PangbInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Code + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Code + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 2, 1); if (nRet != 0) return 1; - memcpy(DrvZ80Rom + 0x0000, DrvZ80Code + 0x8000, 0x8000); - memset(DrvZ80Code + 0x8000, 0, 0x8000); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; - - MitchellMachineInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 PangboldInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Code + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Code + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 2, 1); if (nRet != 0) return 1; - memcpy(DrvZ80Rom + 0x0000, DrvZ80Code + 0x8000, 0x8000); - memset(DrvZ80Code + 0x8000, 0, 0x8000); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 11, 1); if (nRet != 0) return 1; - - MitchellMachineInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 CworldInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xc0000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xe0000, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 12, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1; - - cworld_decode(); - - MitchellMachineInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 HatenaInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xc0000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xe0000, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 12, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1; - - hatena_decode(); - - MitchellMachineInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 SpangInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; - - spang_decode(); - - MitchellMachineInit(); - - if (!EEPROMAvailable()) EEPROMFill(DrvTempRom, 0, 128); - - BurnFree(DrvTempRom); - - DrvNVRamSize = 0x0080; - DrvNVRamAddress = 0x0000; - - DrvDoReset(); - - return 0; -} - -static INT32 SpangjInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; - - spangj_decode(); - - MitchellMachineInit(); - - if (!EEPROMAvailable()) EEPROMFill(DrvTempRom, 0, 128); - - BurnFree(DrvTempRom); - - DrvNVRamSize = 0x0080; - DrvNVRamAddress = 0x0000; - - DrvDoReset(); - - return 0; -} - -static INT32 SbbrosInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; - - sbbros_decode(); - - MitchellMachineInit(); - - if (!EEPROMAvailable()) EEPROMFill(DrvTempRom, 0, 128); - - BurnFree(DrvTempRom); - - DrvNVRamSize = 0x0080; - DrvNVRamAddress = 0x0000; - - DrvDoReset(); - - return 0; -} - -static INT32 MstworldInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - MstworldMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MstworldMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 1, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0x00, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 5, 1); if (nRet != 0) return 1; - for (INT32 i = 0; i < 0x80000; i++) DrvTempRom[i] ^= 0xff; - GfxDecode(0x4000, 4, 8, 8, MstworldCharPlaneOffsets, MstworldCharXOffsets, MstworldCharYOffsets, 0x40, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0x00, 0x80000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; - for (INT32 i = 0; i < 0x40000; i++) DrvTempRom[i] ^= 0xff; - GfxDecode(0x0800, 4, 16, 16, MstworldSpritePlaneOffsets, MstworldSpriteXOffsets, MstworldSpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - memcpy(DrvSoundRom + 0x000000, DrvTempRom + 0x000000, 0x20000); - memcpy(DrvSoundRom + 0x020000, DrvTempRom + 0x000000, 0x20000); - memcpy(DrvSoundRom + 0x040000, DrvTempRom + 0x000000, 0x20000); - memcpy(DrvSoundRom + 0x060000, DrvTempRom + 0x020000, 0x20000); - memcpy(DrvSoundRom + 0x080000, DrvTempRom + 0x000000, 0x20000); - memcpy(DrvSoundRom + 0x0a0000, DrvTempRom + 0x040000, 0x20000); - memcpy(DrvSoundRom + 0x0c0000, DrvTempRom + 0x000000, 0x20000); - memcpy(DrvSoundRom + 0x0e0000, DrvTempRom + 0x060000, 0x20000); - - static const INT32 tablebank[] = { - 0, 0, - 1, 1, - -1, -1, - -1, -1, - 10, 4, - 5, 13, - 7, 17, - 21, 2, - 18, 9, - 15, 3, - 6, 11, - 19, 8, - -1, -1, - -1, -1, - -1, -1, - -1, -1, - 20, 20, - 14, 14, - 16, 16, - 12, 12, - }; - - memcpy(DrvTempRom, DrvZ80Rom, 0x80000); - for (INT32 x = 0; x < 40; x += 2) { - if (tablebank[x] != -1) { - memcpy(&DrvZ80Rom[(x / 2) * 0x4000], &DrvTempRom[tablebank[x] * 0x4000], 0x4000); - memcpy(&DrvZ80Code[(x / 2) * 0x4000], &DrvTempRom[tablebank[x + 1] * 0x4000], 0x4000); - } - } - - BurnFree(DrvTempRom); - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(MitchellZ80Read); - ZetSetWriteHandler(MitchellZ80Write); - ZetSetInHandler(MstworldZ80PortRead); - ZetSetOutHandler(MstworldZ80PortWrite); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom + 0x00000 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Code + 0x00000, DrvZ80Rom + 0x00000); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000, DrvZ80Rom + 0x10000); - ZetMapArea(0xc800, 0xcfff, 0, DrvAttrRam ); - ZetMapArea(0xc800, 0xcfff, 1, DrvAttrRam ); - ZetMapArea(0xc800, 0xcfff, 2, DrvAttrRam ); - ZetMapArea(0xe000, 0xffff, 0, DrvZ80Ram ); - ZetMapArea(0xe000, 0xffff, 1, DrvZ80Ram ); - ZetMapArea(0xe000, 0xffff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(MstworldSoundZ80Read); - ZetSetWriteHandler(MstworldSoundZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram2); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram2); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram2); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 990000 / 132, 0); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - memcpy(MSM6295ROM, DrvSoundRom, 0x40000); - - DrvHasEEPROM = 0; - - GenericTilesInit(); - - DrvTileMask = 0x3fff; - DrvNumColours = 0x800; - - MstworldDoReset(); - - return 0; -} - -static INT32 MarukinInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - MahjongMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MahjongMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x200000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x010000, 1, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x180000, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x10000, 4, 8, 8, MahjongCharPlaneOffsets, MahjongCharXOffsets, MahjongCharYOffsets, 0x100, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x020000, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x00800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x000000, 8, 1); if (nRet != 0) return 1; - - marukin_decode(); - - MahjongMachineInit(); - - DrvInputType = DRV_INPUT_TYPE_MAHJONG; - - DrvDoReset(); - - return 0; -} - -static INT32 Qtono1Init() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xc0000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xe0000, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 12, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1; - - qtono1_decode(); - - MitchellMachineInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 QsangokuInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xc0000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xe0000, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 12, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1; - - qsangoku_decode(); - - MitchellMachineInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 BlockInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; - - block_decode(); - - MitchellMachineInit(); - - DrvInputType = DRV_INPUT_TYPE_BLOCK; - - DrvNVRamSize = 0x0080; - DrvNVRamAddress = 0x1f80; - - DrvDoReset(); - - return 0; -} - -static INT32 BlockjoyInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; - - block_decode(); - - MitchellMachineInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 BlockblInit() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - PangMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - PangMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - nRet = BurnLoadRom(DrvZ80Code + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Code + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; - memcpy(DrvZ80Rom + 0x00000, DrvZ80Code + 0x08000, 0x08000); - memset(DrvZ80Code + 0x08000, 0, 0x08000); - memcpy(DrvZ80Rom + 0x10000, DrvZ80Code + 0x30000, 0x20000); - memset(DrvZ80Code + 0x30000, 0, 0x20000); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0xff, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - BurnFree(DrvTempRom); - - nRet = BurnLoadRom(DrvSoundRom + 0x00000, 11, 1); if (nRet != 0) return 1; - - MitchellMachineInit(); - - DrvInputType = DRV_INPUT_TYPE_BLOCK; - - DrvNVRamSize = 0x0080; - DrvNVRamAddress = 0x1f80; - - DrvDoReset(); - - return 0; -} - -static INT32 CommonExit() -{ - ZetExit(); - - MSM6295Exit(0); - if (DrvHasEEPROM) EEPROMExit(); - - GenericTilesExit(); - - BurnFree(Mem); - - DrvRomBank = 0; - DrvPaletteRamBank = 0; - DrvOkiBank = 0; - DrvFlipScreen = 0; - DrvVideoBank = 0; - DrvInputType = 0; - DrvMahjongKeyMatrix = 0; - DrvTileMask = 0; - DrvInput5Toggle = 0; - DrvPort5Kludge = 0; - DrvHasEEPROM = 0; - DrvNumColours = 0; - DrvNVRamSize = 0; - DrvNVRamAddress = 0; - DrvDialSelected = 0; - DrvSoundLatch = 0; - - return 0; -} - -static INT32 DrvExit() -{ - BurnYM2413Exit(); - - return CommonExit(); -} - -static inline UINT8 pal4bit(UINT8 bits) -{ - bits &= 0x0f; - return (bits << 4) | bits; -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(nColour >> 8); - g = pal4bit(nColour >> 4); - b = pal4bit(nColour >> 0); - - return BurnHighCol(r, g, b, 0); -} - -static void DrvCalcPalette() -{ - for (INT32 i = 0; i < DrvNumColours * 2; i += 2) { - INT32 Val = DrvPaletteRam[i & ~1] + (DrvPaletteRam[i | 1] << 8); - - DrvPalette[i >> 1] = CalcCol(Val); - } -} - -static void DrvRenderBgLayer() -{ - INT32 mx, my, Code, Attr, Colour, x, y, TileIndex = 0, xFlip; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = DrvAttrRam[TileIndex]; - Code = DrvVideoRam[(2 * TileIndex) + 0] + (DrvVideoRam[(2 * TileIndex) + 1] << 8); - Colour = Attr & (DrvNumColours == 0x800 ? 0x7f : 0x3f); - xFlip = (Attr & 0x80); - - x = 8 * mx; - y = 8 * my; - - if (DrvFlipScreen) { - x = 504 - x; - y = 248 - y; - xFlip = !xFlip; - } - - x -= 64; - y -= 8; - - Code &= DrvTileMask; - - if (DrvFlipScreen) { - if (x > 8 && x < (nScreenWidth - 8) && y > 8 && y < (nScreenHeight - 8)) { - if (xFlip) { - Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); - } else { - Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); - } - } else { - if (xFlip) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); - } - } - } else { - if (x > 8 && x < (nScreenWidth - 8) && y > 8 && y < (nScreenHeight - 8)) { - if (xFlip) { - Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); - } else { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); - } - } else { - if (xFlip) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); - } - } - } - - TileIndex++; - } - } -} - -static void DrvRenderSpriteLayer() -{ - INT32 sx, sy; - - for (INT32 Offset = 0x1000 - 0x40; Offset >= 0; Offset -= 0x20) { - INT32 Code = DrvSpriteRam[Offset + 0]; - INT32 Attr = DrvSpriteRam[Offset + 1]; - INT32 Colour = Attr & 0x0f; - sx = DrvSpriteRam[Offset + 3] + ((Attr & 0x10) << 4); - sy = ((DrvSpriteRam[Offset + 2] + 8) & 0xff) - 8; - Code += (Attr & 0xe0) << 3; - - if (DrvFlipScreen) { - sx = 496 - sx; - sy = 240 - sy; - } - - sx -= 64; - sy -= 8; - - if (DrvFlipScreen) { - if (sx > 16 && sx < (nScreenWidth - 16) && sy > 16 && sy < (nScreenHeight - 16)) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 15, 0, DrvSprites); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 15, 0, DrvSprites); - } - } else { - if (sx > 16 && sx < (nScreenWidth - 16) && sy > 16 && sy < (nScreenHeight - 16)) { - Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 15, 0, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 15, 0, DrvSprites); - } - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - DrvRenderBgLayer(); - DrvRenderSpriteLayer(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 8000000 / 60; - nCyclesDone[0] = 0; - - DrvInput5Toggle = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 4) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nCyclesDone[nCurrentCPU] += ZetRun(500); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } - if (i == 7) DrvInput5Toggle = 1; - if (i == 9) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nCyclesDone[nCurrentCPU] += ZetRun(500); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2413Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2413Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 MstworldFrame() -{ - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - - if (DrvReset) MstworldDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 24000000 / 60; - nCyclesTotal[1] = 6000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 9) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nCyclesDone[nCurrentCPU] += ZetRun(500); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } - ZetClose(); - - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029707; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_NVRAM && DrvNVRamSize) { - memset(&ba, 0, sizeof(ba)); - ba.Data = DrvZ80Ram + DrvNVRamAddress; - ba.nLen = DrvNVRamSize; - ba.szName = "NVRam"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - BurnYM2413Scan(nAction); - MSM6295Scan(0, nAction); - - if (DrvHasEEPROM) EEPROMScan(nAction, pnMin); - - SCAN_VAR(nCyclesDone[0]); - SCAN_VAR(nCyclesDone[1]); - SCAN_VAR(DrvRomBank); - SCAN_VAR(DrvPaletteRamBank); - SCAN_VAR(DrvOkiBank); - SCAN_VAR(DrvFlipScreen); - SCAN_VAR(DrvVideoBank); - SCAN_VAR(DrvInput5Toggle); - SCAN_VAR(DrvDialSelected); - SCAN_VAR(DrvDial[0]); - SCAN_VAR(DrvDial[1]); - SCAN_VAR(DrvDial1); - SCAN_VAR(DrvDial2); - SCAN_VAR(DrvMahjongKeyMatrix); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - if (DrvHasEEPROM) { - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - } else { - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - } - ZetClose(); - - if (DrvOkiBank) { - memcpy(MSM6295ROM, DrvSoundRom + 0x40000, 0x40000); - } - } - - return 0; -} - -static INT32 MstworldScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029707; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - MSM6295Scan(0, nAction); - - SCAN_VAR(nCyclesDone[0]); - SCAN_VAR(nCyclesDone[1]); - SCAN_VAR(DrvRomBank); - SCAN_VAR(DrvPaletteRamBank); - SCAN_VAR(DrvOkiBank); - SCAN_VAR(DrvFlipScreen); - SCAN_VAR(DrvVideoBank); - SCAN_VAR(DrvSoundLatch); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); - ZetClose(); - - memcpy(MSM6295ROM, DrvSoundRom + (DrvOkiBank * 0x40000), 0x40000); - } - - return 0; -} - -struct BurnDriver BurnDrvMgakuen = { - "mgakuen", NULL, NULL, NULL, "1988", - "Mahjong Gakuen\0", NULL, "Yuga", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, - NULL, MgakuenRomInfo, MgakuenRomName, NULL, NULL, MgakuenInputInfo, MgakuenDIPInfo, - MgakuenInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x400, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSeventoitsu = { - "7toitsu", "mgakuen", NULL, NULL, "1988", - "Chi-Toitsu\0", NULL, "Yuga", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, - NULL, SeventoitsuRomInfo, SeventoitsuRomName, NULL, NULL, MgakuenInputInfo, MgakuenDIPInfo, - MgakuenInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x400, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvMgakuen2 = { - "mgakuen2", NULL, NULL, NULL, "1989", - "Mahjong Gakuen 2 Gakuen-chou no Fukushuu\0", NULL, "Face", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, - NULL, Mgakuen2RomInfo, Mgakuen2RomName, NULL, NULL, MarukinInputInfo, NULL, - Mgakuen2Init, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPkladies = { - "pkladies", NULL, NULL, NULL, "1989", - "Poker Ladies\0", NULL, "Mitchell", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, - NULL, PkladiesRomInfo, PkladiesRomName, NULL, NULL, PkladiesInputInfo, NULL, - PkladiesInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPkladiesl = { - "pkladiesl", "pkladies", NULL, NULL, "1989", - "Poker Ladies (Leprechaun ver. 510)\0", NULL, "Leprechaun", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, - NULL, PkladieslRomInfo, PkladieslRomName, NULL, NULL, PkladiesInputInfo, NULL, - PkladiesInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPkladiesla = { - "pkladiesla", "pkladies", NULL, NULL, "1989", - "Poker Ladies (Leprechaun ver. 401)\0", NULL, "Leprechaun", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, - NULL, PkladieslaRomInfo, PkladieslaRomName, NULL, NULL, PkladiesInputInfo, NULL, - PkladiesInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDokaben = { - "dokaben", NULL, NULL, NULL, "1989", - "Dokaben (Japan)\0", NULL, "Dokaben", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0, - NULL, DokabenRomInfo, DokabenRomName, NULL, NULL, PangInputInfo, NULL, - DokabenInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPang = { - "pang", NULL, NULL, NULL, "1989", - "Pang (World)\0", NULL, "Mitchell", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, - NULL, PangRomInfo, PangRomName, NULL, NULL, PangInputInfo, NULL, - PangInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvBbros = { - "bbros", "pang", NULL, NULL, "1989", - "Buster Bros. (US)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, - NULL, BbrosRomInfo, BbrosRomName, NULL, NULL, PangInputInfo, NULL, - PangInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPompingw = { - "pompingw", "pang", NULL, NULL, "1989", - "Pomping World (Japan)\0", NULL, "Mitchell", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, - NULL, PompingwRomInfo, PompingwRomName, NULL, NULL, PangInputInfo, NULL, - PangInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPangb = { - "pangb", "pang", NULL, NULL, "1989", - "Pang (bootleg, set 1)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, - NULL, PangbRomInfo, PangbRomName, NULL, NULL, PangInputInfo, NULL, - PangbInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPangbold = { - "pangbold", "pang", NULL, NULL, "1989", - "Pang (bootleg, set 2)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, - NULL, PangboldRomInfo, PangboldRomName, NULL, NULL, PangInputInfo, NULL, - PangboldInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvCworld = { - "cworld", NULL, NULL, NULL, "1990", - "Capcom World (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, - NULL, CworldRomInfo, CworldRomName, NULL, NULL, Qtono1InputInfo, NULL, - CworldInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvHatena = { - "hatena", NULL, NULL, NULL, "1990", - "Adventure Quiz 2 Hatena Hatena no Dai-Bouken (Japan 900228)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, - NULL, HatenaRomInfo, HatenaRomName, NULL, NULL, Qtono1InputInfo, NULL, - HatenaInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSpang = { - "spang", NULL, NULL, NULL, "1990", - "Super Pang (World 900914)\0", NULL, "Mitchell", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, SpangRomInfo, SpangRomName, NULL, NULL, PangInputInfo, NULL, - SpangInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSpangj = { - "spangj", "spang", NULL, NULL, "1990", - "Super Pang (Japan 901023)\0", NULL, "Mitchell", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, SpangjRomInfo, SpangjRomName, NULL, NULL, PangInputInfo, NULL, - SpangjInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSbbros = { - "sbbros", "spang", NULL, NULL, "1990", - "Super Buster Bros. (US 901001)\0", NULL, "Mitchell + Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, SbbrosRomInfo, SbbrosRomName, NULL, NULL, PangInputInfo, NULL, - SbbrosInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvMstworld = { - "mstworld", NULL, NULL, NULL, "1994", - "Monsters World\0", NULL, "TCH", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, MstworldRomInfo, MstworldRomName, NULL, NULL, MstworldInputInfo, MstworldDIPInfo, - MstworldInit, CommonExit, MstworldFrame, NULL, MstworldScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvMarukin = { - "marukin", NULL, NULL, NULL, "1990", - "Super Marukin-Ban (Japan 901017)\0", NULL, "Yuga", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAHJONG, 0, - NULL, MarukinRomInfo, MarukinRomName, NULL, NULL, MarukinInputInfo, NULL, - MarukinInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvQtono1 = { - "qtono1", NULL, NULL, NULL, "1991", - "Quiz Tonosama no Yabou (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, - NULL, Qtono1RomInfo, Qtono1RomName, NULL, NULL, Qtono1InputInfo, NULL, - Qtono1Init, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvQsangoku = { - "qsangoku", NULL, NULL, NULL, "1991", - "Quiz Sangokushi (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, - NULL, QsangokuRomInfo, QsangokuRomName, NULL, NULL, Qtono1InputInfo, NULL, - QsangokuInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvBlock = { - "block", NULL, NULL, NULL, "1991", - "Block Block (World 910910)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_BREAKOUT, 0, - NULL, BlockRomInfo, BlockRomName, NULL, NULL, BlockInputInfo, NULL, - BlockInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvBlockj = { - "blockj", "block", NULL, NULL, "1991", - "Block Block (Japan 910910)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_BREAKOUT, 0, - NULL, BlockjRomInfo, BlockjRomName, NULL, NULL, BlockInputInfo, NULL, - BlockInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvBlockjoy = { - "blockjoy", "block", NULL, NULL, "1991", - "Block Block (World 911116 Joystick)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_BREAKOUT, 0, - NULL, BlockjoyRomInfo, BlockjoyRomName, NULL, NULL, BlockjoyInputInfo, NULL, - BlockjoyInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 240, 384, 3, 4 -}; - -struct BurnDriver BurnDrvBlockbl = { - "blockbl", "block", NULL, NULL, "1991", - "Block Block (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_BREAKOUT, 0, - NULL, BlockblRomInfo, BlockblRomName, NULL, NULL, BlockInputInfo, NULL, - BlockblInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 240, 384, 3, 4 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "eeprom.h" +#include "burn_ym2413.h" +#include "msm6295.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort4[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort5[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort6[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort7[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort8[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort9[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort10[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort11[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[12] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static UINT8 DrvDip[2] = {0, 0}; +static UINT8 DrvReset = 0; +static INT16 DrvDial1 = 0; +static INT16 DrvDial2 = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *DrvZ80Rom = NULL; +static UINT8 *DrvZ80Code = NULL; +static UINT8 *DrvZ80Rom2 = NULL; +static UINT8 *DrvSoundRom = NULL; +static UINT8 *DrvZ80Ram = NULL; +static UINT8 *DrvZ80Ram2 = NULL; +static UINT8 *DrvPaletteRam = NULL; +static UINT8 *DrvAttrRam = NULL; +static UINT8 *DrvVideoRam = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static UINT8 DrvRomBank; +static UINT8 DrvPaletteRamBank; +static UINT8 DrvOkiBank; +static UINT8 DrvFlipScreen; +static UINT8 DrvVideoBank; +static UINT8 DrvInput5Toggle; +static UINT8 DrvPort5Kludge; +static INT32 DrvTileMask; +static UINT8 DrvHasEEPROM; +static INT32 DrvNumColours; +static INT32 DrvNVRamSize; +static INT32 DrvNVRamAddress; +static UINT8 DrvDialSelected; +static INT32 DrvDial[2]; +static UINT8 DrvSoundLatch; + +static UINT8 DrvInputType; +static INT32 DrvMahjongKeyMatrix; + +#define DRV_INPUT_TYPE_MAHJONG 1 +#define DRV_INPUT_TYPE_BLOCK 2 + +static struct BurnInputInfo MgakuenInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort7 + 2, "p2 start" }, + + {"P1 A" , BIT_DIGITAL , DrvInputPort1 + 7, "mah a" }, + {"P1 B" , BIT_DIGITAL , DrvInputPort2 + 7, "mah b" }, + {"P1 C" , BIT_DIGITAL , DrvInputPort4 + 7, "mah c" }, + {"P1 D" , BIT_DIGITAL , DrvInputPort5 + 7, "mah d" }, + {"P1 E" , BIT_DIGITAL , DrvInputPort1 + 6, "mah e" }, + {"P1 F" , BIT_DIGITAL , DrvInputPort2 + 6, "mah f" }, + {"P1 G" , BIT_DIGITAL , DrvInputPort4 + 6, "mah g" }, + {"P1 H" , BIT_DIGITAL , DrvInputPort5 + 6, "mah h" }, + {"P1 I" , BIT_DIGITAL , DrvInputPort1 + 5, "mah i" }, + {"P1 J" , BIT_DIGITAL , DrvInputPort2 + 5, "mah j" }, + {"P1 K" , BIT_DIGITAL , DrvInputPort4 + 5, "mah k" }, + {"P1 L" , BIT_DIGITAL , DrvInputPort5 + 5, "mah l" }, + {"P1 M" , BIT_DIGITAL , DrvInputPort1 + 4, "mah m" }, + {"P1 N" , BIT_DIGITAL , DrvInputPort2 + 4, "mah n" }, + {"P1 Pon" , BIT_DIGITAL , DrvInputPort5 + 4, "mah pon" }, + {"P1 Chi" , BIT_DIGITAL , DrvInputPort4 + 4, "mah chi" }, + {"P1 Kan" , BIT_DIGITAL , DrvInputPort1 + 3, "mah kan" }, + {"P1 Ron" , BIT_DIGITAL , DrvInputPort4 + 3, "mah ron" }, + {"P1 Reach" , BIT_DIGITAL , DrvInputPort2 + 3, "mah reach" }, + {"P1 Flip Flop" , BIT_DIGITAL , DrvInputPort6 + 4, "mah ff" }, + + {"P2 A" , BIT_DIGITAL , DrvInputPort7 + 7, "mah a" }, + {"P2 B" , BIT_DIGITAL , DrvInputPort8 + 7, "mah b" }, + {"P2 C" , BIT_DIGITAL , DrvInputPort9 + 7, "mah c" }, + {"P2 D" , BIT_DIGITAL , DrvInputPort10 + 7, "mah d" }, + {"P2 E" , BIT_DIGITAL , DrvInputPort7 + 6, "mah e" }, + {"P2 F" , BIT_DIGITAL , DrvInputPort8 + 6, "mah f" }, + {"P2 G" , BIT_DIGITAL , DrvInputPort9 + 6, "mah g" }, + {"P2 H" , BIT_DIGITAL , DrvInputPort10 + 6, "mah h" }, + {"P2 I" , BIT_DIGITAL , DrvInputPort7 + 5, "mah i" }, + {"P2 J" , BIT_DIGITAL , DrvInputPort8 + 5, "mah j" }, + {"P2 K" , BIT_DIGITAL , DrvInputPort9 + 5, "mah k" }, + {"P2 L" , BIT_DIGITAL , DrvInputPort10 + 5, "mah l" }, + {"P2 M" , BIT_DIGITAL , DrvInputPort7 + 4, "mah m" }, + {"P2 N" , BIT_DIGITAL , DrvInputPort2 + 4, "mah n" }, + {"P2 Pon" , BIT_DIGITAL , DrvInputPort10 + 4, "mah pon" }, + {"P2 Chi" , BIT_DIGITAL , DrvInputPort9 + 4, "mah chi" }, + {"P2 Kan" , BIT_DIGITAL , DrvInputPort7 + 3, "mah kan" }, + {"P2 Ron" , BIT_DIGITAL , DrvInputPort9 + 3, "mah ron" }, + {"P2 Reach" , BIT_DIGITAL , DrvInputPort8 + 3, "mah reach" }, + {"P2 Flip Flop" , BIT_DIGITAL , DrvInputPort11 + 4, "mah ff" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Mgakuen) + +static struct BurnInputInfo MarukinInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort7 + 2, "p2 start" }, + + {"P1 A" , BIT_DIGITAL , DrvInputPort1 + 7, "mah a" }, + {"P1 B" , BIT_DIGITAL , DrvInputPort2 + 7, "mah b" }, + {"P1 C" , BIT_DIGITAL , DrvInputPort4 + 7, "mah c" }, + {"P1 D" , BIT_DIGITAL , DrvInputPort5 + 7, "mah d" }, + {"P1 E" , BIT_DIGITAL , DrvInputPort1 + 6, "mah e" }, + {"P1 F" , BIT_DIGITAL , DrvInputPort2 + 6, "mah f" }, + {"P1 G" , BIT_DIGITAL , DrvInputPort4 + 6, "mah g" }, + {"P1 H" , BIT_DIGITAL , DrvInputPort5 + 6, "mah h" }, + {"P1 I" , BIT_DIGITAL , DrvInputPort1 + 5, "mah i" }, + {"P1 J" , BIT_DIGITAL , DrvInputPort2 + 5, "mah j" }, + {"P1 K" , BIT_DIGITAL , DrvInputPort4 + 5, "mah k" }, + {"P1 L" , BIT_DIGITAL , DrvInputPort5 + 5, "mah l" }, + {"P1 M" , BIT_DIGITAL , DrvInputPort1 + 4, "mah m" }, + {"P1 N" , BIT_DIGITAL , DrvInputPort2 + 4, "mah n" }, + {"P1 Pon" , BIT_DIGITAL , DrvInputPort5 + 4, "mah pon" }, + {"P1 Chi" , BIT_DIGITAL , DrvInputPort4 + 4, "mah chi" }, + {"P1 Kan" , BIT_DIGITAL , DrvInputPort1 + 3, "mah kan" }, + {"P1 Ron" , BIT_DIGITAL , DrvInputPort4 + 3, "mah ron" }, + {"P1 Reach" , BIT_DIGITAL , DrvInputPort2 + 3, "mah reach" }, + {"P1 Flip Flop" , BIT_DIGITAL , DrvInputPort6 + 4, "mah ff" }, + + {"P2 A" , BIT_DIGITAL , DrvInputPort7 + 7, "mah a" }, + {"P2 B" , BIT_DIGITAL , DrvInputPort8 + 7, "mah b" }, + {"P2 C" , BIT_DIGITAL , DrvInputPort9 + 7, "mah c" }, + {"P2 D" , BIT_DIGITAL , DrvInputPort10 + 7, "mah d" }, + {"P2 E" , BIT_DIGITAL , DrvInputPort7 + 6, "mah e" }, + {"P2 F" , BIT_DIGITAL , DrvInputPort8 + 6, "mah f" }, + {"P2 G" , BIT_DIGITAL , DrvInputPort9 + 6, "mah g" }, + {"P2 H" , BIT_DIGITAL , DrvInputPort10 + 6, "mah h" }, + {"P2 I" , BIT_DIGITAL , DrvInputPort7 + 5, "mah i" }, + {"P2 J" , BIT_DIGITAL , DrvInputPort8 + 5, "mah j" }, + {"P2 K" , BIT_DIGITAL , DrvInputPort9 + 5, "mah k" }, + {"P2 L" , BIT_DIGITAL , DrvInputPort10 + 5, "mah l" }, + {"P2 M" , BIT_DIGITAL , DrvInputPort7 + 4, "mah m" }, + {"P2 N" , BIT_DIGITAL , DrvInputPort2 + 4, "mah n" }, + {"P2 Pon" , BIT_DIGITAL , DrvInputPort10 + 4, "mah pon" }, + {"P2 Chi" , BIT_DIGITAL , DrvInputPort9 + 4, "mah chi" }, + {"P2 Kan" , BIT_DIGITAL , DrvInputPort7 + 3, "mah kan" }, + {"P2 Ron" , BIT_DIGITAL , DrvInputPort9 + 3, "mah ron" }, + {"P2 Reach" , BIT_DIGITAL , DrvInputPort8 + 3, "mah reach" }, + {"P2 Flip Flop" , BIT_DIGITAL , DrvInputPort11 + 4, "mah ff" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, +}; + +STDINPUTINFO(Marukin) + +static struct BurnInputInfo PkladiesInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort7 + 2, "p2 start" }, + + {"P1 A" , BIT_DIGITAL , DrvInputPort1 + 7, "mah a" }, + {"P1 B" , BIT_DIGITAL , DrvInputPort2 + 7, "mah b" }, + {"P1 C" , BIT_DIGITAL , DrvInputPort4 + 7, "mah c" }, + {"P1 D" , BIT_DIGITAL , DrvInputPort5 + 7, "mah d" }, + {"P1 E" , BIT_DIGITAL , DrvInputPort1 + 6, "mah e" }, + {"P1 Deal" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 1" }, + {"P1 Cancel" , BIT_DIGITAL , DrvInputPort2 + 5, "p1 fire 2" }, + {"P1 Flip" , BIT_DIGITAL , DrvInputPort4 + 5, "p1 fire 3" }, + + {"P2 A" , BIT_DIGITAL , DrvInputPort7 + 7, "mah a" }, + {"P2 B" , BIT_DIGITAL , DrvInputPort8 + 7, "mah b" }, + {"P2 C" , BIT_DIGITAL , DrvInputPort9 + 7, "mah c" }, + {"P2 D" , BIT_DIGITAL , DrvInputPort10 + 7, "mah d" }, + {"P2 E" , BIT_DIGITAL , DrvInputPort7 + 6, "mah e" }, + {"P2 Deal" , BIT_DIGITAL , DrvInputPort7 + 5, "p2 fire 1" }, + {"P2 Cancel" , BIT_DIGITAL , DrvInputPort8 + 5, "p2 fire 2" }, + {"P2 Flip" , BIT_DIGITAL , DrvInputPort9 + 5, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 0, "service" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, +}; + +STDINPUTINFO(Pkladies) + +static struct BurnInputInfo PangInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, +}; + +STDINPUTINFO(Pang) + +static struct BurnInputInfo Qtono1InputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 start" }, + + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 4" }, + + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 4" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, +}; + +STDINPUTINFO(Qtono1) + +static struct BurnInputInfo MstworldInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 3, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 2, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, +}; + +STDINPUTINFO(Mstworld) + +static struct BurnInputInfo BlockInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , DrvInputPort11 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort11 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, + + {"P2 Left" , BIT_DIGITAL , DrvInputPort11 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort11 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, +}; + +STDINPUTINFO(Block) + +static struct BurnInputInfo BlockjoyInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort0 + 1, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 fire 1" }, + + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 6, "service" }, + {"Diagnostics" , BIT_DIGITAL , DrvInputPort3 + 1, "diag" }, +}; + +STDINPUTINFO(Blockjoy) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x30) == 0x30) { + *nJoystickInputs &= ~0x30; + } + if ((*nJoystickInputs & 0xc0) == 0xc0) { + *nJoystickInputs &= ~0xc0; + } +} + +static inline void DrvMakeInputs() +{ + for (INT32 i = 0; i < 12; i++) DrvInput[i] = 0x00; + + for (INT32 i = 0; i < 8; i++) { + DrvInput[ 0] |= (DrvInputPort0[ i] & 1) << i; + DrvInput[ 1] |= (DrvInputPort1[ i] & 1) << i; + DrvInput[ 2] |= (DrvInputPort2[ i] & 1) << i; + DrvInput[ 3] |= (DrvInputPort3[ i] & 1) << i; + DrvInput[ 4] |= (DrvInputPort4[ i] & 1) << i; + DrvInput[ 5] |= (DrvInputPort5[ i] & 1) << i; + DrvInput[ 6] |= (DrvInputPort6[ i] & 1) << i; + DrvInput[ 7] |= (DrvInputPort7[ i] & 1) << i; + DrvInput[ 8] |= (DrvInputPort8[ i] & 1) << i; + DrvInput[ 9] |= (DrvInputPort9[ i] & 1) << i; + DrvInput[10] |= (DrvInputPort10[i] & 1) << i; + DrvInput[11] |= (DrvInputPort11[i] & 1) << i; + } + + if (DrvInputType == DRV_INPUT_TYPE_BLOCK) { + if (DrvInputPort11[0]) DrvDial1 -= 0x04; + if (DrvInputPort11[1]) DrvDial1 += 0x04; + if (DrvDial1 >= 0x100) DrvDial1 = 0; + if (DrvDial1 < 0) DrvDial1 = 0xfc; + + if (DrvInputPort11[2]) DrvDial2 -= 0x04; + if (DrvInputPort11[3]) DrvDial2 += 0x04; + if (DrvDial2 >= 0x100) DrvDial2 = 0; + if (DrvDial2 < 0) DrvDial2 = 0xfc; + } else { + if (DrvInputType != DRV_INPUT_TYPE_MAHJONG) { + DrvClearOpposites(&DrvInput[1]); + DrvClearOpposites(&DrvInput[2]); + } + } +} + +static struct BurnDIPInfo MgakuenDIPList[]= +{ + // Default Values + {0x2c, 0xff, 0xff, 0xef, NULL }, + {0x2d, 0xff, 0xff, 0x8f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x2c, 0x01, 0x07, 0x00, "4 Coins 1 Play" }, + {0x2c, 0x01, 0x07, 0x01, "3 Coins 1 Play" }, + {0x2c, 0x01, 0x07, 0x02, "2 Coins 1 Play" }, + {0x2c, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x2c, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x2c, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x2c, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + {0x2c, 0x01, 0x07, 0x03, "1 Coin 6 Plays" }, + + {0 , 0xfe, 0 , 2 , "Rules" }, + {0x2c, 0x01, 0x08, 0x08, "Kantou" }, + {0x2c, 0x01, 0x08, 0x00, "Kansai" }, + + {0 , 0xfe, 0 , 2 , "Harness Type" }, + {0x2c, 0x01, 0x10, 0x10, "Generic" }, + {0x2c, 0x01, 0x10, 0x00, "Royal Mahjong" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x2c, 0x01, 0x20, 0x20, "Off" }, + {0x2c, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x2c, 0x01, 0x40, 0x40, "Off" }, + {0x2c, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x2c, 0x01, 0x80, 0x80, "Off" }, + {0x2c, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Player 1 Skill" }, + {0x2d, 0x01, 0x03, 0x03, "Weak" }, + {0x2d, 0x01, 0x03, 0x02, "Normal" }, + {0x2d, 0x01, 0x03, 0x01, "Strong" }, + {0x2d, 0x01, 0x03, 0x00, "Very Strong" }, + + {0 , 0xfe, 0 , 4 , "Player 2 Skill" }, + {0x2d, 0x01, 0x0c, 0x0c, "Weak" }, + {0x2d, 0x01, 0x0c, 0x08, "Normal" }, + {0x2d, 0x01, 0x0c, 0x04, "Strong" }, + {0x2d, 0x01, 0x0c, 0x00, "Very Strong" }, + + {0 , 0xfe, 0 , 2 , "Music" }, + {0x2d, 0x01, 0x10, 0x10, "Off" }, + {0x2d, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x2d, 0x01, 0x20, 0x20, "Off" }, + {0x2d, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Help Mode" }, + {0x2d, 0x01, 0x40, 0x40, "Off" }, + {0x2d, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(Mgakuen) + +static struct BurnDIPInfo MstworldDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xb0, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x15, 0x01, 0x07, 0x03, "A 1C/4P B 1C/4P" }, + {0x15, 0x01, 0x07, 0x02, "A 1C/3P B 1C/3P" }, + {0x15, 0x01, 0x07, 0x01, "A 1C/2P B 1C/2P" }, + {0x15, 0x01, 0x07, 0x00, "A 1C/1P B 1C/4P" }, + {0x15, 0x01, 0x07, 0x04, "A 2C/1P B 1C/2P" }, + {0x15, 0x01, 0x07, 0x05, "A 2C/1P B 1C/3P" }, + {0x15, 0x01, 0x07, 0x06, "A 3C/1P B 1C/2P" }, + {0x15, 0x01, 0x07, 0x07, "A 4C/1P B 1C/1P" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x18, 0x00, "1" }, + {0x15, 0x01, 0x18, 0x08, "2" }, + {0x15, 0x01, 0x18, 0x10, "3" }, + {0x15, 0x01, 0x18, 0x18, "4" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x60, 0x00, "Easy" }, + {0x15, 0x01, 0x60, 0x20, "Normal" }, + {0x15, 0x01, 0x60, 0x40, "Hard" }, + {0x15, 0x01, 0x60, 0x60, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x00, "Off" }, + {0x15, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Mstworld) + +static struct BurnRomInfo MgakuenRomDesc[] = { + { "mg-1.1j", 0x08000, 0xbf02ea6b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "mg-2.1l", 0x20000, 0x64141b0c, BRF_ESS | BRF_PRG }, // 1 + + { "mg-1.13h", 0x80000, 0xfd6a0805, BRF_GRA }, // 2 Characters + { "mg-2.14h", 0x80000, 0xe26e871e, BRF_GRA }, // 3 + { "mg-3.16h", 0x80000, 0xdd781d9a, BRF_GRA }, // 4 + { "mg-4.17h", 0x80000, 0x97afcc79, BRF_GRA }, // 5 + + { "mg-6.4l", 0x20000, 0x34594e62, BRF_GRA }, // 6 Sprites + { "mg-7.6l", 0x20000, 0xf304c806, BRF_GRA }, // 7 + + { "mg-5.1c", 0x80000, 0x170332f1, BRF_SND }, // 8 Samples +}; + +STD_ROM_PICK(Mgakuen) +STD_ROM_FN(Mgakuen) + +static struct BurnRomInfo SeventoitsuRomDesc[] = { + { "mc01.1j", 0x08000, 0x0bebe45f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "mc02.1l", 0x20000, 0x375378b0, BRF_ESS | BRF_PRG }, // 1 + + { "mg-1.13h", 0x80000, 0xfd6a0805, BRF_GRA }, // 2 Characters + { "mg-2.14h", 0x80000, 0xe26e871e, BRF_GRA }, // 3 + { "mg-3.16h", 0x80000, 0xdd781d9a, BRF_GRA }, // 4 + { "mg-4.17h", 0x80000, 0x97afcc79, BRF_GRA }, // 5 + + { "mc06.4l", 0x20000, 0x0ef83926, BRF_GRA }, // 6 Sprites + { "mc07.6l", 0x20000, 0x59f9ffb1, BRF_GRA }, // 7 + + { "mg-5.1c", 0x80000, 0x170332f1, BRF_SND }, // 8 Samples +}; + +STD_ROM_PICK(Seventoitsu) +STD_ROM_FN(Seventoitsu) + +static struct BurnRomInfo Mgakuen2RomDesc[] = { + { "mg2-xf.1j", 0x08000, 0xc8165d2d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "mg2-y.1l", 0x20000, 0x75bbcc14, BRF_ESS | BRF_PRG }, // 1 + { "mg2-z.3l", 0x20000, 0xbfdba961, BRF_ESS | BRF_PRG }, // 2 + + { "mg2-a.13h", 0x80000, 0x31a0c55e, BRF_GRA }, // 3 Characters + { "mg2-b.14h", 0x80000, 0xc18488fa, BRF_GRA }, // 4 + { "mg2-c.16h", 0x80000, 0x9425b364, BRF_GRA }, // 5 + { "mg2-d.17h", 0x80000, 0x6cc9eeba, BRF_GRA }, // 6 + + { "mg2-f.4l", 0x20000, 0x3172c9fe, BRF_GRA }, // 7 Sprites + { "mg2-g.6l", 0x20000, 0x19b8b61c, BRF_GRA }, // 8 + + { "mg2-e.1c", 0x80000, 0x70fd0809, BRF_SND }, // 9 Samples +}; + +STD_ROM_PICK(Mgakuen2) +STD_ROM_FN(Mgakuen2) + +static struct BurnRomInfo PkladiesRomDesc[] = { + { "pko-prg1.14f", 0x08000, 0x86585a94, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "pko-prg2.15f", 0x10000, 0x86cbe82d, BRF_ESS | BRF_PRG }, // 1 + + { "pko-001.8h", 0x80000, 0x1ead5d9b, BRF_GRA }, // 2 Characters + { "pko-003.8j", 0x80000, 0x339ab4e6, BRF_GRA }, // 3 + { "pko-002.9h", 0x80000, 0x1cf02586, BRF_GRA }, // 4 + { "pko-004.9j", 0x80000, 0x09ccb442, BRF_GRA }, // 5 + + { "pko-chr1.2j", 0x20000, 0x31ce33cd, BRF_GRA }, // 6 Sprites + { "pko-chr2.3j", 0x20000, 0xad7e055f, BRF_GRA }, // 7 + + { "pko-voi1.2d", 0x20000, 0x07e0f531, BRF_SND }, // 8 Samples + { "pko-voi2.3d", 0x20000, 0x18398bf6, BRF_SND }, // 9 +}; + +STD_ROM_PICK(Pkladies) +STD_ROM_FN(Pkladies) + +static struct BurnRomInfo PkladieslRomDesc[] = { + { "pk05.14f", 0x08000, 0xea1740a6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "pk06.15f", 0x20000, 0x3078ff5e, BRF_ESS | BRF_PRG }, // 1 + + { "pko-001.8h", 0x80000, 0x1ead5d9b, BRF_GRA }, // 2 Characters + { "pko-003.8j", 0x80000, 0x339ab4e6, BRF_GRA }, // 3 + { "pko-002.9h", 0x80000, 0x1cf02586, BRF_GRA }, // 4 + { "pko-004.9j", 0x80000, 0x09ccb442, BRF_GRA }, // 5 + + { "pko-chr1.2j", 0x20000, 0x31ce33cd, BRF_GRA }, // 6 Sprites + { "pko-chr2.3j", 0x20000, 0xad7e055f, BRF_GRA }, // 7 + + { "pko-voi1.2d", 0x20000, 0x07e0f531, BRF_SND }, // 8 Samples + { "pko-voi2.3d", 0x20000, 0x18398bf6, BRF_SND }, // 9 +}; + +STD_ROM_PICK(Pkladiesl) +STD_ROM_FN(Pkladiesl) + +static struct BurnRomInfo PkladieslaRomDesc[] = { + { "05.14f", 0x08000, 0xfa18e16a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "06.15f", 0x10000, 0xa2fb7646, BRF_ESS | BRF_PRG }, // 1 + + { "pko-001.8h", 0x80000, 0x1ead5d9b, BRF_GRA }, // 2 Characters + { "pko-003.8j", 0x80000, 0x339ab4e6, BRF_GRA }, // 3 + { "pko-002.9h", 0x80000, 0x1cf02586, BRF_GRA }, // 4 + { "pko-004.9j", 0x80000, 0x09ccb442, BRF_GRA }, // 5 + + { "pko-chr1.2j", 0x20000, 0x31ce33cd, BRF_GRA }, // 6 Sprites + { "pko-chr2.3j", 0x20000, 0xad7e055f, BRF_GRA }, // 7 + + { "pko-voi1.2d", 0x20000, 0x07e0f531, BRF_SND }, // 8 Samples + { "pko-voi2.3d", 0x20000, 0x18398bf6, BRF_SND }, // 9 +}; + +STD_ROM_PICK(Pkladiesla) +STD_ROM_FN(Pkladiesla) + +static struct BurnRomInfo DokabenRomDesc[] = { + { "db06.11h", 0x08000, 0x413e0886, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "db07.13h", 0x20000, 0x8bdcf49e, BRF_ESS | BRF_PRG }, // 1 + { "db08.14h", 0x20000, 0x1643bdd9, BRF_ESS | BRF_PRG }, // 2 + + { "db02.1e", 0x20000, 0x9aa8470c, BRF_GRA }, // 3 Characters + { "db03.2e", 0x20000, 0x3324e43d, BRF_GRA }, // 4 + { "db04.1g", 0x20000, 0xc0c5b6c2, BRF_GRA }, // 5 + { "db05.2g", 0x20000, 0xd2ab25f2, BRF_GRA }, // 6 + + { "db10.2k", 0x20000, 0x9e70f7ae, BRF_GRA }, // 7 Sprites + { "db09.1k", 0x20000, 0x2d9263f7, BRF_GRA }, // 8 + + { "db01.1d", 0x20000, 0x62fa6b81, BRF_SND }, // 9 Samples +}; + +STD_ROM_PICK(Dokaben) +STD_ROM_FN(Dokaben) + +static struct BurnRomInfo PangRomDesc[] = { + { "pang6.bin", 0x08000, 0x68be52cd, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "pang7.bin", 0x20000, 0x4a2e70f6, BRF_ESS | BRF_PRG }, // 1 + + { "pang_09.bin", 0x20000, 0x3a5883f5, BRF_GRA }, // 2 Characters + { "bb3.bin", 0x20000, 0x79a8ed08, BRF_GRA }, // 3 + { "pang_11.bin", 0x20000, 0x166a16ae, BRF_GRA }, // 4 + { "bb5.bin", 0x20000, 0x2fb3db6c, BRF_GRA }, // 5 + + { "bb10.bin", 0x20000, 0xfdba4f6e, BRF_GRA }, // 6 Sprites + { "bb9.bin", 0x20000, 0x39f47a63, BRF_GRA }, // 7 + + { "bb1.bin", 0x20000, 0xc52e5b8e, BRF_SND }, // 8 Samples +}; + +STD_ROM_PICK(Pang) +STD_ROM_FN(Pang) + +static struct BurnRomInfo BbrosRomDesc[] = { + { "bb6.bin", 0x08000, 0xa3041ca4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bb7.bin", 0x20000, 0x09231c68, BRF_ESS | BRF_PRG }, // 1 + + { "bb2.bin", 0x20000, 0x62f29992, BRF_GRA }, // 2 Characters + { "bb3.bin", 0x20000, 0x79a8ed08, BRF_GRA }, // 3 + { "bb4.bin", 0x20000, 0xf705aa89, BRF_GRA }, // 4 + { "bb5.bin", 0x20000, 0x2fb3db6c, BRF_GRA }, // 5 + + { "bb10.bin", 0x20000, 0xfdba4f6e, BRF_GRA }, // 6 Sprites + { "bb9.bin", 0x20000, 0x39f47a63, BRF_GRA }, // 7 + + { "bb1.bin", 0x20000, 0xc52e5b8e, BRF_SND }, // 8 Samples +}; + +STD_ROM_PICK(Bbros) +STD_ROM_FN(Bbros) + +static struct BurnRomInfo PompingwRomDesc[] = { + { "pwj_06.11h", 0x08000, 0x4a0a6426, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "pwj_07.13h", 0x20000, 0xa9402420, BRF_ESS | BRF_PRG }, // 1 + + { "pw_02.1e", 0x20000, 0x4b5992e4, BRF_GRA }, // 2 Characters + { "bb3.bin", 0x20000, 0x79a8ed08, BRF_GRA }, // 3 + { "pwj_04.1g", 0x20000, 0x01e49081, BRF_GRA }, // 4 + { "bb5.bin", 0x20000, 0x2fb3db6c, BRF_GRA }, // 5 + + { "bb10.bin", 0x20000, 0xfdba4f6e, BRF_GRA }, // 6 Sprites + { "bb9.bin", 0x20000, 0x39f47a63, BRF_GRA }, // 7 + + { "bb1.bin", 0x20000, 0xc52e5b8e, BRF_SND }, // 8 Samples +}; + +STD_ROM_PICK(Pompingw) +STD_ROM_FN(Pompingw) + +static struct BurnRomInfo PangbRomDesc[] = { + { "pang_04.bin", 0x10000, 0xf68f88a5, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "pang_02.bin", 0x20000, 0x3f15bb61, BRF_ESS | BRF_PRG }, // 1 + { "pang_03.bin", 0x20000, 0x0c8477ae, BRF_ESS | BRF_PRG }, // 2 + + { "pang_09.bin", 0x20000, 0x3a5883f5, BRF_GRA }, // 3 Characters + { "bb3.bin", 0x20000, 0x79a8ed08, BRF_GRA }, // 4 + { "pang_11.bin", 0x20000, 0x166a16ae, BRF_GRA }, // 5 + { "bb5.bin", 0x20000, 0x2fb3db6c, BRF_GRA }, // 6 + + { "bb10.bin", 0x20000, 0xfdba4f6e, BRF_GRA }, // 7 Sprites + { "bb9.bin", 0x20000, 0x39f47a63, BRF_GRA }, // 8 + + { "bb1.bin", 0x20000, 0xc52e5b8e, BRF_SND }, // 9 Samples +}; + +STD_ROM_PICK(Pangb) +STD_ROM_FN(Pangb) + +static struct BurnRomInfo PangboldRomDesc[] = { + { "4.6l", 0x10000, 0xf68f88a5, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "2.3l", 0x20000, 0x3f15bb61, BRF_ESS | BRF_PRG }, // 1 + { "3.5l", 0x20000, 0xce6375e4, BRF_ESS | BRF_PRG }, // 2 + + { "9.10o", 0x20000, 0x3a5883f5, BRF_GRA }, // 3 Characters + { "10.14o", 0x20000, 0x79a8ed08, BRF_GRA }, // 4 + { "11.17j", 0x20000, 0x166a16ae, BRF_GRA }, // 5 + { "12.20j", 0x20000, 0x2fb3db6c, BRF_GRA }, // 6 + + { "8.7o", 0x10000, 0xf3188aa1, BRF_GRA }, // 7 Sprites + { "7.5o", 0x10000, 0x011da14b, BRF_GRA }, // 8 + { "6.3o", 0x10000, 0x0e25e797, BRF_GRA }, // 9 + { "5.1o", 0x10000, 0x6daa4e27, BRF_GRA }, // 10 + + { "1.1a", 0x10000, 0xb6463907, BRF_SND }, // 11 Samples +}; + +STD_ROM_PICK(Pangbold) +STD_ROM_FN(Pangbold) + +static struct BurnRomInfo CworldRomDesc[] = { + { "cw05.bin", 0x08000, 0xd3c1723d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "cw06.bin", 0x20000, 0xd71ed4a3, BRF_ESS | BRF_PRG }, // 1 + { "cw07.bin", 0x20000, 0xd419ce08, BRF_ESS | BRF_PRG }, // 2 + + { "cw08.bin", 0x20000, 0x6c80da3c, BRF_GRA }, // 3 Characters + { "cw09.bin", 0x20000, 0x7607da71, BRF_GRA }, // 4 + { "cw10.bin", 0x20000, 0x6f0e639f, BRF_GRA }, // 5 + { "cw11.bin", 0x20000, 0x130bd7c0, BRF_GRA }, // 6 + { "cw18.bin", 0x20000, 0xbe6ee0c9, BRF_GRA }, // 7 + { "cw19.bin", 0x20000, 0x51fc5532, BRF_GRA }, // 8 + { "cw20.bin", 0x20000, 0x58381d58, BRF_GRA }, // 9 + { "cw21.bin", 0x20000, 0x910cc753, BRF_GRA }, // 10 + + { "cw16.bin", 0x20000, 0xf90217d1, BRF_GRA }, // 11 Sprites + { "cw17.bin", 0x20000, 0xc953c702, BRF_GRA }, // 12 + + { "cw01.bin", 0x20000, 0xf4368f5b, BRF_SND }, // 13 Samples +}; + +STD_ROM_PICK(Cworld) +STD_ROM_FN(Cworld) + +static struct BurnRomInfo HatenaRomDesc[] = { + { "q2-05.rom", 0x08000, 0x66c9e1da, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "q2-06.rom", 0x20000, 0x5fc39916, BRF_ESS | BRF_PRG }, // 1 + { "q2-07.rom", 0x20000, 0xec6d5e5e, BRF_ESS | BRF_PRG }, // 2 + + { "q2-08.rom", 0x20000, 0x6c80da3c, BRF_GRA }, // 3 Characters + { "q2-09.rom", 0x20000, 0xabe3e15c, BRF_GRA }, // 4 + { "q2-10.rom", 0x20000, 0x6963450d, BRF_GRA }, // 5 + { "q2-11.rom", 0x20000, 0x1e319fa2, BRF_GRA }, // 6 + { "q2-18.rom", 0x20000, 0xbe6ee0c9, BRF_GRA }, // 7 + { "q2-19.rom", 0x20000, 0x70300445, BRF_GRA }, // 8 + { "q2-20.rom", 0x20000, 0x21a6ff42, BRF_GRA }, // 9 + { "q2-21.rom", 0x20000, 0x076280c9, BRF_GRA }, // 10 + + { "q2-16.rom", 0x20000, 0xec19b2f0, BRF_GRA }, // 11 Sprites + { "q2-17.rom", 0x20000, 0xecd69d92, BRF_GRA }, // 12 + + { "q2-01.rom", 0x20000, 0x149e7a89, BRF_SND }, // 13 Samples +}; + +STD_ROM_PICK(Hatena) +STD_ROM_FN(Hatena) + +static struct BurnRomInfo SpangRomDesc[] = { + { "spe_06.rom", 0x08000, 0x1af106fb, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "spe_07.rom", 0x20000, 0x208b5f54, BRF_ESS | BRF_PRG }, // 1 + { "spe_08.rom", 0x20000, 0x2bc03ade, BRF_ESS | BRF_PRG }, // 2 + + { "spe_02.rom", 0x20000, 0x63c9dfd2, BRF_GRA }, // 3 Characters + { "03.f2", 0x20000, 0x3ae28bc1, BRF_GRA }, // 4 + { "spe_04.rom", 0x20000, 0x9d7b225b, BRF_GRA }, // 5 + { "05.g2", 0x20000, 0x4a060884, BRF_GRA }, // 6 + + { "spj10_2k.bin", 0x20000, 0xeedd0ade, BRF_GRA }, // 7 Sprites + { "spj09_1k.bin", 0x20000, 0x04b41b75, BRF_GRA }, // 8 + + { "spe_01.rom", 0x20000, 0x2d19c133, BRF_SND }, // 9 Samples + + { "eeprom-spang.bin", 0x80, 0xdeae1291, BRF_PRG }, +}; + +STD_ROM_PICK(Spang) +STD_ROM_FN(Spang) + +static struct BurnRomInfo SpangjRomDesc[] = { + { "spj_11h.bin", 0x08000, 0x1a548b0b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "spj7_13h.bin", 0x20000, 0x14c2b765, BRF_ESS | BRF_PRG }, // 1 + { "spj8_14h.bin", 0x20000, 0x4be4e5b7, BRF_ESS | BRF_PRG }, // 2 + + { "spj02_1e.bin", 0x20000, 0x419f69d7, BRF_GRA }, // 3 Characters + { "03.f2", 0x20000, 0x3ae28bc1, BRF_GRA }, // 4 + { "spj04_1g.bin", 0x20000, 0x6870506f, BRF_GRA }, // 5 + { "05.g2", 0x20000, 0x4a060884, BRF_GRA }, // 6 + + { "spj10_2k.bin", 0x20000, 0xeedd0ade, BRF_GRA }, // 7 Sprites + { "spj09_1k.bin", 0x20000, 0x04b41b75, BRF_GRA }, // 8 + + { "01.d1", 0x20000, 0xb96ea126, BRF_SND }, // 9 Samples + + { "eeprom-spangj.bin",0x80, 0x237c00eb, BRF_PRG }, +}; + +STD_ROM_PICK(Spangj) +STD_ROM_FN(Spangj) + +static struct BurnRomInfo SbbrosRomDesc[] = { + { "06.j12", 0x08000, 0x292eee6a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "07.j13", 0x20000, 0xf46b698d, BRF_ESS | BRF_PRG }, // 1 + { "08.j14", 0x20000, 0xa75e7fbe, BRF_ESS | BRF_PRG }, // 2 + + { "02.f1", 0x20000, 0x0c22ffc6, BRF_GRA }, // 3 Characters + { "03.f2", 0x20000, 0x3ae28bc1, BRF_GRA }, // 4 + { "04.g2", 0x20000, 0xbb3dee5b, BRF_GRA }, // 5 + { "05.g2", 0x20000, 0x4a060884, BRF_GRA }, // 6 + + { "10.l2", 0x20000, 0xd6675d8f, BRF_GRA }, // 7 Sprites + { "09.l1", 0x20000, 0x8f678bc8, BRF_GRA }, // 8 + + { "01.d1", 0x20000, 0xb96ea126, BRF_SND }, // 9 Samples + + { "eeprom-sbbros.bin",0x80, 0xed69d3cd, BRF_PRG }, +}; + +STD_ROM_PICK(Sbbros) +STD_ROM_FN(Sbbros) + +static struct BurnRomInfo MstworldRomDesc[] = { + { "mw-1.rom", 0x80000, 0xc4e51fb4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + + { "mw-2.rom", 0x08000, 0x12c4fea9, BRF_ESS | BRF_PRG }, // 1 Z80 #2 Program Code + + { "mw-4.rom", 0x20000, 0x28a3af15, BRF_GRA }, // 2 Characters + { "mw-5.rom", 0x20000, 0xffdf7e9f, BRF_GRA }, // 3 + { "mw-6.rom", 0x20000, 0x1ed773a3, BRF_GRA }, // 4 + { "mw-7.rom", 0x20000, 0x8eb7525c, BRF_GRA }, // 5 + + { "mw-8.rom", 0x20000, 0xb9b92a3c, BRF_GRA }, // 6 Sprites + { "mw-9.rom", 0x20000, 0x75fc3375, BRF_GRA }, // 7 + + { "mw-3.rom", 0x80000, 0x110c6a68, BRF_SND }, // 8 Samples +}; + +STD_ROM_PICK(Mstworld) +STD_ROM_FN(Mstworld) + +static struct BurnRomInfo MarukinRomDesc[] = { + { "mg3-01.9d", 0x08000, 0x04357973, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "mg3-02.10d", 0x20000, 0x50d08da0, BRF_ESS | BRF_PRG }, // 1 + + { "mg3-a.3k", 0x80000, 0x420f1de7, BRF_GRA }, // 2 Characters + { "mg3-b.4k", 0x80000, 0xd8de13fa, BRF_GRA }, // 3 + { "mg3-c.6k", 0x80000, 0xfbeb66e8, BRF_GRA }, // 4 + { "mg3-d.7k", 0x80000, 0x8f6bd831, BRF_GRA }, // 5 + + { "mg3-05.2g", 0x20000, 0x7a738d2d, BRF_GRA }, // 6 Sprites + { "mg3-04.1g", 0x20000, 0x56f30515, BRF_GRA }, // 7 + + { "mg3-e.1d", 0x80000, 0x106c2fa9, BRF_SND }, // 8 Samples +}; + +STD_ROM_PICK(Marukin) +STD_ROM_FN(Marukin) + +static struct BurnRomInfo Qtono1RomDesc[] = { + { "q3-05.rom", 0x08000, 0x1dd0a344, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "q3-06.rom", 0x20000, 0xbd6a2110, BRF_ESS | BRF_PRG }, // 1 + { "q3-07.rom", 0x20000, 0x61e53c4f, BRF_ESS | BRF_PRG }, // 2 + + { "q3-08.rom", 0x20000, 0x1533b978, BRF_GRA }, // 3 Characters + { "q3-09.rom", 0x20000, 0xa32db2f2, BRF_GRA }, // 4 + { "q3-10.rom", 0x20000, 0xed681aa8, BRF_GRA }, // 5 + { "q3-11.rom", 0x20000, 0x38b2fd10, BRF_GRA }, // 6 + { "q3-18.rom", 0x20000, 0x9e4292ac, BRF_GRA }, // 7 + { "q3-19.rom", 0x20000, 0xb7f6d40f, BRF_GRA }, // 8 + { "q3-20.rom", 0x20000, 0x6cd7f38d, BRF_GRA }, // 9 + { "q3-21.rom", 0x20000, 0xb4aa6b4b, BRF_GRA }, // 10 + + { "q3-16.rom", 0x20000, 0x863d6836, BRF_GRA }, // 11 Sprites + { "q3-17.rom", 0x20000, 0x459bf59c, BRF_GRA }, // 12 + + { "q3-01.rom", 0x20000, 0x6c1be591, BRF_SND }, // 13 Samples +}; + +STD_ROM_PICK(Qtono1) +STD_ROM_FN(Qtono1) + +static struct BurnRomInfo QsangokuRomDesc[] = { + { "q4-05c.rom", 0x08000, 0xe1d010b4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "q4-06.rom", 0x20000, 0xa0301849, BRF_ESS | BRF_PRG }, // 1 + { "q4-07.rom", 0x20000, 0x2941ef5b, BRF_ESS | BRF_PRG }, // 2 + + { "q4-08.rom", 0x20000, 0xdc84c6cb, BRF_GRA }, // 3 Characters + { "q4-09.rom", 0x20000, 0xcbb6234c, BRF_GRA }, // 4 + { "q4-10.rom", 0x20000, 0xc20a27a8, BRF_GRA }, // 5 + { "q4-11.rom", 0x20000, 0x4ff66aed, BRF_GRA }, // 6 + { "q4-18.rom", 0x20000, 0xca3acea5, BRF_GRA }, // 7 + { "q4-19.rom", 0x20000, 0x1fd92b7d, BRF_GRA }, // 8 + { "q4-20.rom", 0x20000, 0xb02dc6a1, BRF_GRA }, // 9 + { "q4-21.rom", 0x20000, 0x432b1dc1, BRF_GRA }, // 10 + + { "q4-16.rom", 0x20000, 0x77342320, BRF_GRA }, // 11 Sprites + { "q4-17.rom", 0x20000, 0x1275c436, BRF_GRA }, // 12 + + { "q4-01.rom", 0x20000, 0x5d0d07d8, BRF_SND }, // 13 Samples +}; + +STD_ROM_PICK(Qsangoku) +STD_ROM_FN(Qsangoku) + +static struct BurnRomInfo BlockRomDesc[] = { + { "ble_05.rom", 0x08000, 0xc12e7f4c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ble_06.rom", 0x20000, 0xcdb13d55, BRF_ESS | BRF_PRG }, // 1 + { "ble_07.rom", 0x20000, 0x1d114f13, BRF_ESS | BRF_PRG }, // 2 + + { "bl_08.rom", 0x20000, 0xaa0f4ff1, BRF_GRA }, // 3 Characters + { "bl_09.rom", 0x20000, 0x6fa8c186, BRF_GRA }, // 4 + { "bl_18.rom", 0x20000, 0xc0acafaf, BRF_GRA }, // 5 + { "bl_19.rom", 0x20000, 0x1ae942f5, BRF_GRA }, // 6 + + { "bl_16.rom", 0x20000, 0xfadcaff7, BRF_GRA }, // 7 Sprites + { "bl_17.rom", 0x20000, 0x5f8cab42, BRF_GRA }, // 8 + + { "bl_01.rom", 0x20000, 0xc2ec2abb, BRF_SND }, // 9 Samples +}; + +STD_ROM_PICK(Block) +STD_ROM_FN(Block) + +static struct BurnRomInfo BlockjRomDesc[] = { + { "blj_05.rom", 0x08000, 0x3b55969a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ble_06.rom", 0x20000, 0xcdb13d55, BRF_ESS | BRF_PRG }, // 1 + { "blj_07.rom", 0x20000, 0x1723883c, BRF_ESS | BRF_PRG }, // 2 + + { "bl_08.rom", 0x20000, 0xaa0f4ff1, BRF_GRA }, // 3 Characters + { "bl_09.rom", 0x20000, 0x6fa8c186, BRF_GRA }, // 4 + { "bl_18.rom", 0x20000, 0xc0acafaf, BRF_GRA }, // 5 + { "bl_19.rom", 0x20000, 0x1ae942f5, BRF_GRA }, // 6 + + { "bl_16.rom", 0x20000, 0xfadcaff7, BRF_GRA }, // 7 Sprites + { "bl_17.rom", 0x20000, 0x5f8cab42, BRF_GRA }, // 8 + + { "bl_01.rom", 0x20000, 0xc2ec2abb, BRF_SND }, // 9 Samples +}; + +STD_ROM_PICK(Blockj) +STD_ROM_FN(Blockj) + +static struct BurnRomInfo BlockjoyRomDesc[] = { + { "ble_05.bin", 0x08000, 0xfa2a4536, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "blf_06.bin", 0x20000, 0xe114ebde, BRF_ESS | BRF_PRG }, // 1 + { "ble_07.rom", 0x20000, 0x1d114f13, BRF_ESS | BRF_PRG }, // 2 + + { "bl_08.rom", 0x20000, 0xaa0f4ff1, BRF_GRA }, // 3 Characters + { "bl_09.rom", 0x20000, 0x6fa8c186, BRF_GRA }, // 4 + { "bl_18.rom", 0x20000, 0xc0acafaf, BRF_GRA }, // 5 + { "bl_19.rom", 0x20000, 0x1ae942f5, BRF_GRA }, // 6 + + { "bl_16.rom", 0x20000, 0xfadcaff7, BRF_GRA }, // 7 Sprites + { "bl_17.rom", 0x20000, 0x5f8cab42, BRF_GRA }, // 8 + + { "bl_01.rom", 0x20000, 0xc2ec2abb, BRF_SND }, // 9 Samples +}; + +STD_ROM_PICK(Blockjoy) +STD_ROM_FN(Blockjoy) + +static struct BurnRomInfo BlockblRomDesc[] = { + { "m7.l6", 0x10000, 0x3b576fd9, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "m5.l3", 0x40000, 0x7c988bb7, BRF_ESS | BRF_PRG }, // 1 + { "m6.l5", 0x20000, 0x5768d8eb, BRF_ESS | BRF_PRG }, // 2 + + { "m12.o10", 0x20000, 0x963154d9, BRF_GRA }, // 3 Characters + { "m13.o14", 0x20000, 0x069480bb, BRF_GRA }, // 4 + { "m4.j17", 0x20000, 0x9e3b6f4f, BRF_GRA }, // 5 + { "m3.j20", 0x20000, 0x629d58fe, BRF_GRA }, // 6 + + { "m11.o7", 0x10000, 0x255180a5, BRF_GRA }, // 7 Sprites + { "m10.o5", 0x10000, 0x3201c088, BRF_GRA }, // 8 + { "m9.o3", 0x10000, 0x29357fe4, BRF_GRA }, // 9 + { "m8.o2", 0x10000, 0xabd665d1, BRF_GRA }, // 10 + + { "bl_01.rom", 0x20000, 0xc2ec2abb, BRF_SND }, // 11 Samples +}; + +STD_ROM_PICK(Blockbl) +STD_ROM_FN(Blockbl) + +static const eeprom_interface MitchellEEPROMIntf = +{ + 6, + 16, + "0110", + "0101", + "0111", + 0, + 0, + 0, + 0 +}; + +static INT32 MgakuenMemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom = Next; Next += 0x50000; + MSM6295ROM = Next; Next += 0x40000; + DrvSoundRom = Next; Next += 0x80000; + + RamStart = Next; + + DrvZ80Ram = Next; Next += 0x01000; + DrvPaletteRam = Next; Next += 0x00800; + DrvAttrRam = Next; Next += 0x00800; + DrvVideoRam = Next; Next += 0x01000; + DrvSpriteRam = Next; Next += 0x01000; + + RamEnd = Next; + + DrvChars = Next; Next += 0x10000 * 8 * 8; + DrvSprites = Next; Next += 0x00800 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 PangMemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom = Next; Next += 0x50000; + DrvZ80Code = Next; Next += 0x50000; + DrvSoundRom = Next; Next += 0x20000; + + RamStart = Next; + + DrvZ80Ram = Next; Next += 0x02000; + DrvPaletteRam = Next; Next += 0x01000; + DrvAttrRam = Next; Next += 0x00800; + DrvVideoRam = Next; Next += 0x01000; + DrvSpriteRam = Next; Next += 0x01000; + + RamEnd = Next; + + DrvChars = Next; Next += 0x8000 * 8 * 8; + DrvSprites = Next; Next += 0x0800 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 MahjongMemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom = Next; Next += 0x50000; + DrvZ80Code = Next; Next += 0x50000; + MSM6295ROM = Next; Next += 0x40000; + DrvSoundRom = Next; Next += 0x80000; + + RamStart = Next; + + DrvZ80Ram = Next; Next += 0x02000; + DrvPaletteRam = Next; Next += 0x01000; + DrvAttrRam = Next; Next += 0x00800; + DrvVideoRam = Next; Next += 0x01000; + DrvSpriteRam = Next; Next += 0x01000; + + RamEnd = Next; + + DrvChars = Next; Next += 0x10000 * 8 * 8; + DrvSprites = Next; Next += 0x00800 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 MstworldMemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom = Next; Next += 0x50000; + DrvZ80Code = Next; Next += 0x50000; + DrvZ80Rom2 = Next; Next += 0x08000; + MSM6295ROM = Next; Next += 0x40000; + DrvSoundRom = Next; Next += 0x100000; + + RamStart = Next; + + DrvZ80Ram = Next; Next += 0x02000; + DrvZ80Ram2 = Next; Next += 0x00800; + DrvPaletteRam = Next; Next += 0x01000; + DrvAttrRam = Next; Next += 0x00800; + DrvVideoRam = Next; Next += 0x01000; + DrvSpriteRam = Next; Next += 0x01000; + + RamEnd = Next; + + DrvChars = Next; Next += 0x4000 * 8 * 8; + DrvSprites = Next; Next += 0x0800 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + ZetOpen(0); + DrvRomBank = 0; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + if (DrvHasEEPROM) { + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + } else { + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + } + ZetReset(); + ZetClose(); + + BurnYM2413Reset(); + MSM6295Reset(0); + + if (DrvHasEEPROM) EEPROMReset(); + + DrvPaletteRamBank = 0; + DrvVideoBank = 0; + DrvDialSelected = 0; + + return 0; +} + +static INT32 MstworldDoReset() +{ + ZetOpen(0); + DrvRomBank = 0; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + + DrvPaletteRamBank = 0; + DrvVideoBank = 0; + DrvSoundLatch = 0; + + return 0; +} + +static UINT8 BlockDialRead(INT32 Offset) +{ + static INT32 Dir[2]; + + if (DrvDialSelected) { + INT32 Delta; + + Delta = ((Offset ? DrvDial2 : DrvDial1) - DrvDial[Offset]) & 0xff; + if (Delta & 0x80) { + Delta = (-Delta) & 0xff; + if (Dir[Offset]) { + Dir[Offset] = 0; + Delta = 0; + } + } else { + if (Delta > 0) { + if (Dir[Offset] == 0) { + Dir[Offset] = 1; + Delta = 0; + } + } + } + + if (Delta > 0x3f) Delta = 0x3f; + + return Delta << 2; + } else { + INT32 Res = (0xff - DrvInput[Offset + 1]) & 0xf7; + if (Dir[Offset]) Res |= 0x08; + + return Res; + } +} + +UINT8 __fastcall MitchellZ80Read(UINT16 a) +{ + if (a >= 0xc000 && a <= 0xc7ff) { + return DrvPaletteRam[(a - 0xc000) + (DrvPaletteRamBank ? 0x800 : 0x000)]; + } + + if (a >= 0xd000 && a <= 0xdfff) { + INT32 Offset = a - 0xd000; + if (DrvVideoBank) { + return DrvSpriteRam[Offset]; + } else { + return DrvVideoRam[Offset]; + } + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall MitchellZ80Write(UINT16 a, UINT8 d) +{ + if (a >= 0xc000 && a <= 0xc7ff) { + DrvPaletteRam[(a - 0xc000) + (DrvPaletteRamBank ? 0x800 : 0x000)] = d; + return; + } + + if (a >= 0xd000 && a <= 0xdfff) { + INT32 Offset = a - 0xd000; + if (DrvVideoBank) { + DrvSpriteRam[Offset] = d; + } else { + DrvVideoRam[Offset] = d; + } + return; + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall MitchellZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return 0xff - DrvInput[0]; + } + + case 0x01: { + switch (DrvInputType) { + case DRV_INPUT_TYPE_MAHJONG: { + if (DrvMahjongKeyMatrix & (0x80 >> 0)) return 0xff - DrvInput[1]; + if (DrvMahjongKeyMatrix & (0x80 >> 1)) return 0xff - DrvInput[2]; + if (DrvMahjongKeyMatrix & (0x80 >> 2)) return 0xff - DrvInput[4]; + if (DrvMahjongKeyMatrix & (0x80 >> 3)) return 0xff - DrvInput[5]; + if (DrvMahjongKeyMatrix & (0x80 >> 4)) return 0xff - DrvInput[6]; + } + + case DRV_INPUT_TYPE_BLOCK: { + return BlockDialRead(0); + } + } + + return 0xff - DrvInput[1]; + } + + case 0x02: { + switch (DrvInputType) { + case DRV_INPUT_TYPE_MAHJONG: { + if (DrvMahjongKeyMatrix & (0x80 >> 0)) return 0xff - DrvInput[7]; + if (DrvMahjongKeyMatrix & (0x80 >> 1)) return 0xff - DrvInput[8]; + if (DrvMahjongKeyMatrix & (0x80 >> 2)) return 0xff - DrvInput[9]; + if (DrvMahjongKeyMatrix & (0x80 >> 3)) return 0xff - DrvInput[10]; + if (DrvMahjongKeyMatrix & (0x80 >> 4)) return 0xff - DrvInput[11]; + } + + case DRV_INPUT_TYPE_BLOCK: { + return BlockDialRead(1); + } + } + + return 0xff - DrvInput[2]; + } + + case 0x03: { + return DrvDip[0]; + } + + case 0x04: { + return DrvDip[1]; + } + + case 0x05: { + INT32 Bit = DrvHasEEPROM ? (EEPROMRead() & 0x01) << 7 : 0x80; + if (DrvInput5Toggle) { + Bit |= 0x01; + } else { + Bit |= 0x08; + } + + if (DrvPort5Kludge) Bit ^= 0x08; + + return ((0xff - DrvInput[3]) & 0x76) | Bit; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0xff; +} + +void __fastcall MitchellZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + DrvFlipScreen = d & 0x04; + if (DrvOkiBank != (d & 0x10)) { + DrvOkiBank = d & 0x10; + if (DrvOkiBank) { + memcpy(MSM6295ROM, DrvSoundRom + 0x40000, 0x40000); + } else { + memcpy(MSM6295ROM, DrvSoundRom + 0x00000, 0x40000); + } + } + DrvPaletteRamBank = d & 0x20; + return; + } + + case 0x01: { + switch (DrvInputType) { + case DRV_INPUT_TYPE_MAHJONG: { + DrvMahjongKeyMatrix = d; + return; + } + + case DRV_INPUT_TYPE_BLOCK: { + if (d == 0x08) { + DrvDial[0] = DrvDial1; + DrvDial[1] = DrvDial2; + } else { + if (d == 0x80) { + DrvDialSelected = 0; + } else { + DrvDialSelected = 1; + } + } + return; + } + } + + return; + } + + case 0x02: { + DrvRomBank = d & 0x0f; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + if (DrvHasEEPROM) { + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + } else { + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + } + return; + } + + case 0x03: { + BurnYM2413Write(1, d); + return; + } + + case 0x04: { + BurnYM2413Write(0, d); + return; + } + + case 0x05: { + MSM6295Command(0, d); + return; + } + + case 0x06:{ + // nop + return; + } + + case 0x07: { + DrvVideoBank = d; + return; + } + + case 0x08 :{ + if (DrvHasEEPROM) EEPROMSetCSLine(d ? 0 : 1); + return; + } + + case 0x10 :{ + if (DrvHasEEPROM) EEPROMSetClockLine(d ? 0 : 1); + return; + } + + case 0x18 :{ + if (DrvHasEEPROM) EEPROMWriteBit(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall MstworldZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return 0xff - DrvInput[0]; + } + + case 0x01: { + return 0xfe - DrvInput[1]; + } + + case 0x02: { + return 0xfe - DrvInput[2]; + } + + case 0x03: { + return DrvDip[0]; + } + + case 0x05: { + return 0xff - DrvInput[3]; + } + + case 0x06: { + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0xff; +} + +void __fastcall MstworldZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + DrvFlipScreen = d & 0x04; + DrvPaletteRamBank = d & 0x20; + return; + } + + case 0x02: { + DrvRomBank = d & 0x0f; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + return; + } + + case 0x03: { + DrvSoundLatch = d; + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(0); + } + + case 0x06: { + // nop + return; + } + + case 0x07: { + DrvVideoBank = d & 0x01; + return; + } + + case 0x08: + case 0x10: + case 0x18: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall MstworldSoundZ80Read(UINT16 a) +{ + switch (a) { + case 0x9800: { + return MSM6295ReadStatus(0); + } + + case 0xa000: { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall MstworldSoundZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x9000: { + DrvOkiBank = d & 0x03; + memcpy(MSM6295ROM, DrvSoundRom + (DrvOkiBank * 0x40000), 0x40000); + return; + } + + case 0x9800: { + MSM6295Command(0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); + } + } +} + +// Kabuki - we use the module from the CPS-1 Q-Sound games +extern void kabuki_decode(UINT8 *src, UINT8 *dest_op, UINT8 *dest_data, INT32 base_addr, INT32 length, INT32 swap_key1, INT32 swap_key2, INT32 addr_key, INT32 xor_key); + +static void mitchell_decode(INT32 swap_key1, INT32 swap_key2, INT32 addr_key, INT32 xor_key) +{ + UINT8 *rom = DrvZ80Rom; + UINT8 *decrypt = DrvZ80Code; + INT32 numbanks = (0x50000 - 0x10000) / 0x4000; + INT32 i; + + kabuki_decode(rom, decrypt, rom, 0x0000, 0x8000, swap_key1, swap_key2, addr_key, xor_key); + + rom += 0x10000; + decrypt += 0x10000; + for (i = 0; i < numbanks; i++) + kabuki_decode(rom + i * 0x4000,decrypt + i * 0x4000, rom + i * 0x4000, 0x8000, 0x4000, swap_key1, swap_key2, addr_key, xor_key); +} + +static void mgakuen2_decode() { mitchell_decode(0x76543210, 0x01234567, 0xaa55, 0xa5); } +static void pang_decode() { mitchell_decode(0x01234567, 0x76543210, 0x6548, 0x24); } +static void cworld_decode() { mitchell_decode(0x04152637, 0x40516273, 0x5751, 0x43); } +static void hatena_decode() { mitchell_decode(0x45670123, 0x45670123, 0x5751, 0x43); } +static void spang_decode() { mitchell_decode(0x45670123, 0x45670123, 0x5852, 0x43); } +static void spangj_decode() { mitchell_decode(0x45123670, 0x67012345, 0x55aa, 0x5a); } +static void sbbros_decode() { mitchell_decode(0x45670123, 0x45670123, 0x2130, 0x12); } +static void marukin_decode() { mitchell_decode(0x54321076, 0x54321076, 0x4854, 0x4f); } +static void qtono1_decode() { mitchell_decode(0x12345670, 0x12345670, 0x1111, 0x11); } +static void qsangoku_decode() { mitchell_decode(0x23456701, 0x23456701, 0x1828, 0x18); } +static void block_decode() { mitchell_decode(0x02461357, 0x64207531, 0x0002, 0x01); } + +static INT32 CharPlaneOffsets[4] = { 0x400004, 0x400000, 4, 0 }; +static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 }; +static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; +static INT32 MahjongCharPlaneOffsets[4] = { 12, 8, 4, 0 }; +static INT32 MahjongCharXOffsets[8] = { 0, 1, 2, 3, 16, 17, 18, 19 }; +static INT32 MahjongCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 SpritePlaneOffsets[4] = { 0x100004, 0x100000, 4, 0 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; +static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; +static INT32 MstworldCharPlaneOffsets[4] = { 0x200000, 0x300000, 0, 0x100000 }; +static INT32 MstworldCharXOffsets[8] = { 7, 6, 5, 4, 3, 2, 1, 0 }; +static INT32 MstworldCharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 MstworldSpritePlaneOffsets[4] = { 4, 0, 0x100004, 0x100000 }; +static INT32 MstworldSpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; +static INT32 MstworldSpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; + +static void MitchellMachineInit() +{ + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(MitchellZ80Read); + ZetSetWriteHandler(MitchellZ80Write); + ZetSetInHandler(MitchellZ80PortRead); + ZetSetOutHandler(MitchellZ80PortWrite); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom + 0x00000 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Code + 0x00000, DrvZ80Rom + 0x00000); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000, DrvZ80Rom + 0x10000); + ZetMapArea(0xc800, 0xcfff, 0, DrvAttrRam ); + ZetMapArea(0xc800, 0xcfff, 1, DrvAttrRam ); + ZetMapArea(0xc800, 0xcfff, 2, DrvAttrRam ); + ZetMapArea(0xe000, 0xffff, 0, DrvZ80Ram ); + ZetMapArea(0xe000, 0xffff, 1, DrvZ80Ram ); + ZetMapArea(0xe000, 0xffff, 2, DrvZ80Ram ); + ZetClose(); + + BurnYM2413Init(4000000); + BurnYM2413SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + MSM6295Init(0, 1000000 / 132, 1); + MSM6295SetRoute(0, 0.30, BURN_SND_ROUTE_BOTH); + MSM6295ROM = DrvSoundRom; + + EEPROMInit(&MitchellEEPROMIntf); + DrvHasEEPROM = 1; + + GenericTilesInit(); + + DrvTileMask = 0x7fff; + DrvNumColours = 0x800; +} + +static void MahjongMachineInit() +{ + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(MitchellZ80Read); + ZetSetWriteHandler(MitchellZ80Write); + ZetSetInHandler(MitchellZ80PortRead); + ZetSetOutHandler(MitchellZ80PortWrite); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom + 0x00000 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Code + 0x00000, DrvZ80Rom + 0x00000); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000, DrvZ80Rom + 0x10000); + ZetMapArea(0xc800, 0xcfff, 0, DrvAttrRam ); + ZetMapArea(0xc800, 0xcfff, 1, DrvAttrRam ); + ZetMapArea(0xc800, 0xcfff, 2, DrvAttrRam ); + ZetMapArea(0xe000, 0xffff, 0, DrvZ80Ram ); + ZetMapArea(0xe000, 0xffff, 1, DrvZ80Ram ); + ZetMapArea(0xe000, 0xffff, 2, DrvZ80Ram ); + ZetClose(); + + BurnYM2413Init(4000000); + BurnYM2413SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + MSM6295Init(0, 990000 / 132, 1); + MSM6295SetRoute(0, 0.30, BURN_SND_ROUTE_BOTH); + memcpy(MSM6295ROM, DrvSoundRom, 0x40000); + + EEPROMInit(&MitchellEEPROMIntf); + DrvHasEEPROM = 1; + + GenericTilesInit(); + + DrvTileMask = 0xffff; + DrvNumColours = 0x800; +} + +static INT32 MgakuenInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + MgakuenMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MgakuenMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x200000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x010000, 1, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x180000, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x10000, 4, 8, 8, MahjongCharPlaneOffsets, MahjongCharXOffsets, MahjongCharYOffsets, 0x100, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x020000, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x00800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x000000, 8, 1); if (nRet != 0) return 1; + + ZetInit(0); + ZetOpen(0); + ZetSetInHandler(MitchellZ80PortRead); + ZetSetOutHandler(MitchellZ80PortWrite); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom + 0x00000); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom + 0x00000); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x10000); + ZetMapArea(0xc000, 0xc7ff, 0, DrvPaletteRam ); + ZetMapArea(0xc000, 0xc7ff, 1, DrvPaletteRam ); + ZetMapArea(0xc000, 0xc7ff, 2, DrvPaletteRam ); + ZetMapArea(0xc800, 0xcfff, 0, DrvAttrRam ); + ZetMapArea(0xc800, 0xcfff, 1, DrvAttrRam ); + ZetMapArea(0xc800, 0xcfff, 2, DrvAttrRam ); + ZetMapArea(0xd000, 0xdfff, 0, DrvVideoRam ); + ZetMapArea(0xd000, 0xdfff, 1, DrvVideoRam ); + ZetMapArea(0xd000, 0xdfff, 2, DrvVideoRam ); + ZetMapArea(0xe000, 0xefff, 0, DrvZ80Ram ); + ZetMapArea(0xe000, 0xefff, 1, DrvZ80Ram ); + ZetMapArea(0xe000, 0xefff, 2, DrvZ80Ram ); + ZetMapArea(0xf000, 0xffff, 0, DrvSpriteRam ); + ZetMapArea(0xf000, 0xffff, 1, DrvSpriteRam ); + ZetMapArea(0xf000, 0xffff, 2, DrvSpriteRam ); + ZetClose(); + + BurnYM2413Init(4000000); + BurnYM2413SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + MSM6295Init(0, 990000 / 132, 1); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + memcpy(MSM6295ROM, DrvSoundRom, 0x40000); + + GenericTilesInit(); + + DrvTileMask = 0xffff; + DrvNumColours = 0x400; + DrvHasEEPROM = 0; + + DrvInputType = DRV_INPUT_TYPE_MAHJONG; + + DrvDoReset(); + + return 0; +} + +static INT32 Mgakuen2Init() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + MahjongMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MahjongMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x200000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x010000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x030000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x180000, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x10000, 4, 8, 8, MahjongCharPlaneOffsets, MahjongCharXOffsets, MahjongCharYOffsets, 0x100, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x020000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x00800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x000000, 9, 1); if (nRet != 0) return 1; + + mgakuen2_decode(); + + MahjongMachineInit(); + + DrvInputType = DRV_INPUT_TYPE_MAHJONG; + + DrvPort5Kludge = 1; + + DrvDoReset(); + + return 0; +} + +static INT32 PkladiesInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + MahjongMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MahjongMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x200000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x010000, 1, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100001, 5, 2); if (nRet != 0) return 1; + GfxDecode(0x10000, 4, 8, 8, MahjongCharPlaneOffsets, MahjongCharXOffsets, MahjongCharYOffsets, 0x100, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x020000, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x00800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x000000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvSoundRom + 0x020000, 9, 1); if (nRet != 0) return 1; + + mgakuen2_decode(); + + MahjongMachineInit(); + + DrvInputType = DRV_INPUT_TYPE_MAHJONG; + + DrvDoReset(); + + return 0; +} + +static INT32 DokabenInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; + + mgakuen2_decode(); + + MitchellMachineInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 PangInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 8, 1); if (nRet != 0) return 1; + + pang_decode(); + + MitchellMachineInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 PangbInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Code + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Code + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 2, 1); if (nRet != 0) return 1; + memcpy(DrvZ80Rom + 0x0000, DrvZ80Code + 0x8000, 0x8000); + memset(DrvZ80Code + 0x8000, 0, 0x8000); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; + + MitchellMachineInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 PangboldInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Code + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Code + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 2, 1); if (nRet != 0) return 1; + memcpy(DrvZ80Rom + 0x0000, DrvZ80Code + 0x8000, 0x8000); + memset(DrvZ80Code + 0x8000, 0, 0x8000); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 11, 1); if (nRet != 0) return 1; + + MitchellMachineInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 CworldInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xc0000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xe0000, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 12, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1; + + cworld_decode(); + + MitchellMachineInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 HatenaInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xc0000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xe0000, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 12, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1; + + hatena_decode(); + + MitchellMachineInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 SpangInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; + + spang_decode(); + + MitchellMachineInit(); + + if (!EEPROMAvailable()) EEPROMFill(DrvTempRom, 0, 128); + + BurnFree(DrvTempRom); + + DrvNVRamSize = 0x0080; + DrvNVRamAddress = 0x0000; + + DrvDoReset(); + + return 0; +} + +static INT32 SpangjInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; + + spangj_decode(); + + MitchellMachineInit(); + + if (!EEPROMAvailable()) EEPROMFill(DrvTempRom, 0, 128); + + BurnFree(DrvTempRom); + + DrvNVRamSize = 0x0080; + DrvNVRamAddress = 0x0000; + + DrvDoReset(); + + return 0; +} + +static INT32 SbbrosInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; + + sbbros_decode(); + + MitchellMachineInit(); + + if (!EEPROMAvailable()) EEPROMFill(DrvTempRom, 0, 128); + + BurnFree(DrvTempRom); + + DrvNVRamSize = 0x0080; + DrvNVRamAddress = 0x0000; + + DrvDoReset(); + + return 0; +} + +static INT32 MstworldInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + MstworldMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MstworldMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 1, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0x00, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 5, 1); if (nRet != 0) return 1; + for (INT32 i = 0; i < 0x80000; i++) DrvTempRom[i] ^= 0xff; + GfxDecode(0x4000, 4, 8, 8, MstworldCharPlaneOffsets, MstworldCharXOffsets, MstworldCharYOffsets, 0x40, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0x00, 0x80000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; + for (INT32 i = 0; i < 0x40000; i++) DrvTempRom[i] ^= 0xff; + GfxDecode(0x0800, 4, 16, 16, MstworldSpritePlaneOffsets, MstworldSpriteXOffsets, MstworldSpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + memcpy(DrvSoundRom + 0x000000, DrvTempRom + 0x000000, 0x20000); + memcpy(DrvSoundRom + 0x020000, DrvTempRom + 0x000000, 0x20000); + memcpy(DrvSoundRom + 0x040000, DrvTempRom + 0x000000, 0x20000); + memcpy(DrvSoundRom + 0x060000, DrvTempRom + 0x020000, 0x20000); + memcpy(DrvSoundRom + 0x080000, DrvTempRom + 0x000000, 0x20000); + memcpy(DrvSoundRom + 0x0a0000, DrvTempRom + 0x040000, 0x20000); + memcpy(DrvSoundRom + 0x0c0000, DrvTempRom + 0x000000, 0x20000); + memcpy(DrvSoundRom + 0x0e0000, DrvTempRom + 0x060000, 0x20000); + + static const INT32 tablebank[] = { + 0, 0, + 1, 1, + -1, -1, + -1, -1, + 10, 4, + 5, 13, + 7, 17, + 21, 2, + 18, 9, + 15, 3, + 6, 11, + 19, 8, + -1, -1, + -1, -1, + -1, -1, + -1, -1, + 20, 20, + 14, 14, + 16, 16, + 12, 12, + }; + + memcpy(DrvTempRom, DrvZ80Rom, 0x80000); + for (INT32 x = 0; x < 40; x += 2) { + if (tablebank[x] != -1) { + memcpy(&DrvZ80Rom[(x / 2) * 0x4000], &DrvTempRom[tablebank[x] * 0x4000], 0x4000); + memcpy(&DrvZ80Code[(x / 2) * 0x4000], &DrvTempRom[tablebank[x + 1] * 0x4000], 0x4000); + } + } + + BurnFree(DrvTempRom); + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(MitchellZ80Read); + ZetSetWriteHandler(MitchellZ80Write); + ZetSetInHandler(MstworldZ80PortRead); + ZetSetOutHandler(MstworldZ80PortWrite); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom + 0x00000 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Code + 0x00000, DrvZ80Rom + 0x00000); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000, DrvZ80Rom + 0x10000); + ZetMapArea(0xc800, 0xcfff, 0, DrvAttrRam ); + ZetMapArea(0xc800, 0xcfff, 1, DrvAttrRam ); + ZetMapArea(0xc800, 0xcfff, 2, DrvAttrRam ); + ZetMapArea(0xe000, 0xffff, 0, DrvZ80Ram ); + ZetMapArea(0xe000, 0xffff, 1, DrvZ80Ram ); + ZetMapArea(0xe000, 0xffff, 2, DrvZ80Ram ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(MstworldSoundZ80Read); + ZetSetWriteHandler(MstworldSoundZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram2); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram2); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram2); + ZetClose(); + + MSM6295Init(0, 990000 / 132, 0); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + memcpy(MSM6295ROM, DrvSoundRom, 0x40000); + + DrvHasEEPROM = 0; + + GenericTilesInit(); + + DrvTileMask = 0x3fff; + DrvNumColours = 0x800; + + MstworldDoReset(); + + return 0; +} + +static INT32 MarukinInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + MahjongMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MahjongMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x200000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x010000, 1, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x180000, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x10000, 4, 8, 8, MahjongCharPlaneOffsets, MahjongCharXOffsets, MahjongCharYOffsets, 0x100, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x020000, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x00800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x000000, 8, 1); if (nRet != 0) return 1; + + marukin_decode(); + + MahjongMachineInit(); + + DrvInputType = DRV_INPUT_TYPE_MAHJONG; + + DrvDoReset(); + + return 0; +} + +static INT32 Qtono1Init() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xc0000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xe0000, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 12, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1; + + qtono1_decode(); + + MitchellMachineInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 QsangokuInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xc0000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xe0000, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 12, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1; + + qsangoku_decode(); + + MitchellMachineInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 BlockInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; + + block_decode(); + + MitchellMachineInit(); + + DrvInputType = DRV_INPUT_TYPE_BLOCK; + + DrvNVRamSize = 0x0080; + DrvNVRamAddress = 0x1f80; + + DrvDoReset(); + + return 0; +} + +static INT32 BlockjoyInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Rom + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 8, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1; + + block_decode(); + + MitchellMachineInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 BlockblInit() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + PangMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + PangMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + nRet = BurnLoadRom(DrvZ80Code + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Code + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x30000, 2, 1); if (nRet != 0) return 1; + memcpy(DrvZ80Rom + 0x00000, DrvZ80Code + 0x08000, 0x08000); + memset(DrvZ80Code + 0x08000, 0, 0x08000); + memcpy(DrvZ80Rom + 0x10000, DrvZ80Code + 0x30000, 0x20000); + memset(DrvZ80Code + 0x30000, 0, 0x20000); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x80000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0xa0000, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x8000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0xff, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + BurnFree(DrvTempRom); + + nRet = BurnLoadRom(DrvSoundRom + 0x00000, 11, 1); if (nRet != 0) return 1; + + MitchellMachineInit(); + + DrvInputType = DRV_INPUT_TYPE_BLOCK; + + DrvNVRamSize = 0x0080; + DrvNVRamAddress = 0x1f80; + + DrvDoReset(); + + return 0; +} + +static INT32 CommonExit() +{ + ZetExit(); + + MSM6295Exit(0); + if (DrvHasEEPROM) EEPROMExit(); + + GenericTilesExit(); + + BurnFree(Mem); + + DrvRomBank = 0; + DrvPaletteRamBank = 0; + DrvOkiBank = 0; + DrvFlipScreen = 0; + DrvVideoBank = 0; + DrvInputType = 0; + DrvMahjongKeyMatrix = 0; + DrvTileMask = 0; + DrvInput5Toggle = 0; + DrvPort5Kludge = 0; + DrvHasEEPROM = 0; + DrvNumColours = 0; + DrvNVRamSize = 0; + DrvNVRamAddress = 0; + DrvDialSelected = 0; + DrvSoundLatch = 0; + + return 0; +} + +static INT32 DrvExit() +{ + BurnYM2413Exit(); + + return CommonExit(); +} + +static inline UINT8 pal4bit(UINT8 bits) +{ + bits &= 0x0f; + return (bits << 4) | bits; +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(nColour >> 8); + g = pal4bit(nColour >> 4); + b = pal4bit(nColour >> 0); + + return BurnHighCol(r, g, b, 0); +} + +static void DrvCalcPalette() +{ + for (INT32 i = 0; i < DrvNumColours * 2; i += 2) { + INT32 Val = DrvPaletteRam[i & ~1] + (DrvPaletteRam[i | 1] << 8); + + DrvPalette[i >> 1] = CalcCol(Val); + } +} + +static void DrvRenderBgLayer() +{ + INT32 mx, my, Code, Attr, Colour, x, y, TileIndex = 0, xFlip; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = DrvAttrRam[TileIndex]; + Code = DrvVideoRam[(2 * TileIndex) + 0] + (DrvVideoRam[(2 * TileIndex) + 1] << 8); + Colour = Attr & (DrvNumColours == 0x800 ? 0x7f : 0x3f); + xFlip = (Attr & 0x80); + + x = 8 * mx; + y = 8 * my; + + if (DrvFlipScreen) { + x = 504 - x; + y = 248 - y; + xFlip = !xFlip; + } + + x -= 64; + y -= 8; + + Code &= DrvTileMask; + + if (DrvFlipScreen) { + if (x > 8 && x < (nScreenWidth - 8) && y > 8 && y < (nScreenHeight - 8)) { + if (xFlip) { + Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); + } else { + Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); + } + } else { + if (xFlip) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); + } + } + } else { + if (x > 8 && x < (nScreenWidth - 8) && y > 8 && y < (nScreenHeight - 8)) { + if (xFlip) { + Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); + } else { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); + } + } else { + if (xFlip) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 0, DrvChars); + } + } + } + + TileIndex++; + } + } +} + +static void DrvRenderSpriteLayer() +{ + INT32 sx, sy; + + for (INT32 Offset = 0x1000 - 0x40; Offset >= 0; Offset -= 0x20) { + INT32 Code = DrvSpriteRam[Offset + 0]; + INT32 Attr = DrvSpriteRam[Offset + 1]; + INT32 Colour = Attr & 0x0f; + sx = DrvSpriteRam[Offset + 3] + ((Attr & 0x10) << 4); + sy = ((DrvSpriteRam[Offset + 2] + 8) & 0xff) - 8; + Code += (Attr & 0xe0) << 3; + + if (DrvFlipScreen) { + sx = 496 - sx; + sy = 240 - sy; + } + + sx -= 64; + sy -= 8; + + if (DrvFlipScreen) { + if (sx > 16 && sx < (nScreenWidth - 16) && sy > 16 && sy < (nScreenHeight - 16)) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 15, 0, DrvSprites); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 15, 0, DrvSprites); + } + } else { + if (sx > 16 && sx < (nScreenWidth - 16) && sy > 16 && sy < (nScreenHeight - 16)) { + Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 15, 0, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 15, 0, DrvSprites); + } + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + DrvRenderBgLayer(); + DrvRenderSpriteLayer(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 8000000 / 60; + nCyclesDone[0] = 0; + + DrvInput5Toggle = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 4) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nCyclesDone[nCurrentCPU] += ZetRun(500); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } + if (i == 7) DrvInput5Toggle = 1; + if (i == 9) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nCyclesDone[nCurrentCPU] += ZetRun(500); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2413Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2413Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 MstworldFrame() +{ + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + + if (DrvReset) MstworldDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 24000000 / 60; + nCyclesTotal[1] = 6000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 9) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nCyclesDone[nCurrentCPU] += ZetRun(500); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } + ZetClose(); + + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029707; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_NVRAM && DrvNVRamSize) { + memset(&ba, 0, sizeof(ba)); + ba.Data = DrvZ80Ram + DrvNVRamAddress; + ba.nLen = DrvNVRamSize; + ba.szName = "NVRam"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + BurnYM2413Scan(nAction); + MSM6295Scan(0, nAction); + + if (DrvHasEEPROM) EEPROMScan(nAction, pnMin); + + SCAN_VAR(nCyclesDone[0]); + SCAN_VAR(nCyclesDone[1]); + SCAN_VAR(DrvRomBank); + SCAN_VAR(DrvPaletteRamBank); + SCAN_VAR(DrvOkiBank); + SCAN_VAR(DrvFlipScreen); + SCAN_VAR(DrvVideoBank); + SCAN_VAR(DrvInput5Toggle); + SCAN_VAR(DrvDialSelected); + SCAN_VAR(DrvDial[0]); + SCAN_VAR(DrvDial[1]); + SCAN_VAR(DrvDial1); + SCAN_VAR(DrvDial2); + SCAN_VAR(DrvMahjongKeyMatrix); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + if (DrvHasEEPROM) { + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + } else { + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + } + ZetClose(); + + if (DrvOkiBank) { + memcpy(MSM6295ROM, DrvSoundRom + 0x40000, 0x40000); + } + } + + return 0; +} + +static INT32 MstworldScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029707; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + MSM6295Scan(0, nAction); + + SCAN_VAR(nCyclesDone[0]); + SCAN_VAR(nCyclesDone[1]); + SCAN_VAR(DrvRomBank); + SCAN_VAR(DrvPaletteRamBank); + SCAN_VAR(DrvOkiBank); + SCAN_VAR(DrvFlipScreen); + SCAN_VAR(DrvVideoBank); + SCAN_VAR(DrvSoundLatch); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Code + 0x10000 + (DrvRomBank * 0x4000), DrvZ80Rom + 0x10000 + (DrvRomBank * 0x4000)); + ZetClose(); + + memcpy(MSM6295ROM, DrvSoundRom + (DrvOkiBank * 0x40000), 0x40000); + } + + return 0; +} + +struct BurnDriver BurnDrvMgakuen = { + "mgakuen", NULL, NULL, NULL, "1988", + "Mahjong Gakuen\0", NULL, "Yuga", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, + NULL, MgakuenRomInfo, MgakuenRomName, NULL, NULL, MgakuenInputInfo, MgakuenDIPInfo, + MgakuenInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x400, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSeventoitsu = { + "7toitsu", "mgakuen", NULL, NULL, "1988", + "Chi-Toitsu\0", NULL, "Yuga", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, + NULL, SeventoitsuRomInfo, SeventoitsuRomName, NULL, NULL, MgakuenInputInfo, MgakuenDIPInfo, + MgakuenInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x400, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvMgakuen2 = { + "mgakuen2", NULL, NULL, NULL, "1989", + "Mahjong Gakuen 2 Gakuen-chou no Fukushuu\0", NULL, "Face", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, + NULL, Mgakuen2RomInfo, Mgakuen2RomName, NULL, NULL, MarukinInputInfo, NULL, + Mgakuen2Init, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPkladies = { + "pkladies", NULL, NULL, NULL, "1989", + "Poker Ladies\0", NULL, "Mitchell", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, + NULL, PkladiesRomInfo, PkladiesRomName, NULL, NULL, PkladiesInputInfo, NULL, + PkladiesInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPkladiesl = { + "pkladiesl", "pkladies", NULL, NULL, "1989", + "Poker Ladies (Leprechaun ver. 510)\0", NULL, "Leprechaun", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, + NULL, PkladieslRomInfo, PkladieslRomName, NULL, NULL, PkladiesInputInfo, NULL, + PkladiesInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPkladiesla = { + "pkladiesla", "pkladies", NULL, NULL, "1989", + "Poker Ladies (Leprechaun ver. 401)\0", NULL, "Leprechaun", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, + NULL, PkladieslaRomInfo, PkladieslaRomName, NULL, NULL, PkladiesInputInfo, NULL, + PkladiesInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDokaben = { + "dokaben", NULL, NULL, NULL, "1989", + "Dokaben (Japan)\0", NULL, "Dokaben", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0, + NULL, DokabenRomInfo, DokabenRomName, NULL, NULL, PangInputInfo, NULL, + DokabenInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPang = { + "pang", NULL, NULL, NULL, "1989", + "Pang (World)\0", NULL, "Mitchell", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, + NULL, PangRomInfo, PangRomName, NULL, NULL, PangInputInfo, NULL, + PangInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvBbros = { + "bbros", "pang", NULL, NULL, "1989", + "Buster Bros. (US)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, + NULL, BbrosRomInfo, BbrosRomName, NULL, NULL, PangInputInfo, NULL, + PangInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPompingw = { + "pompingw", "pang", NULL, NULL, "1989", + "Pomping World (Japan)\0", NULL, "Mitchell", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, + NULL, PompingwRomInfo, PompingwRomName, NULL, NULL, PangInputInfo, NULL, + PangInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPangb = { + "pangb", "pang", NULL, NULL, "1989", + "Pang (bootleg, set 1)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, + NULL, PangbRomInfo, PangbRomName, NULL, NULL, PangInputInfo, NULL, + PangbInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPangbold = { + "pangbold", "pang", NULL, NULL, "1989", + "Pang (bootleg, set 2)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, + NULL, PangboldRomInfo, PangboldRomName, NULL, NULL, PangInputInfo, NULL, + PangboldInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvCworld = { + "cworld", NULL, NULL, NULL, "1990", + "Capcom World (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, + NULL, CworldRomInfo, CworldRomName, NULL, NULL, Qtono1InputInfo, NULL, + CworldInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvHatena = { + "hatena", NULL, NULL, NULL, "1990", + "Adventure Quiz 2 Hatena Hatena no Dai-Bouken (Japan 900228)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, + NULL, HatenaRomInfo, HatenaRomName, NULL, NULL, Qtono1InputInfo, NULL, + HatenaInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSpang = { + "spang", NULL, NULL, NULL, "1990", + "Super Pang (World 900914)\0", NULL, "Mitchell", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, SpangRomInfo, SpangRomName, NULL, NULL, PangInputInfo, NULL, + SpangInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSpangj = { + "spangj", "spang", NULL, NULL, "1990", + "Super Pang (Japan 901023)\0", NULL, "Mitchell", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, SpangjRomInfo, SpangjRomName, NULL, NULL, PangInputInfo, NULL, + SpangjInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSbbros = { + "sbbros", "spang", NULL, NULL, "1990", + "Super Buster Bros. (US 901001)\0", NULL, "Mitchell + Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, SbbrosRomInfo, SbbrosRomName, NULL, NULL, PangInputInfo, NULL, + SbbrosInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvMstworld = { + "mstworld", NULL, NULL, NULL, "1994", + "Monsters World\0", NULL, "TCH", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, MstworldRomInfo, MstworldRomName, NULL, NULL, MstworldInputInfo, MstworldDIPInfo, + MstworldInit, CommonExit, MstworldFrame, NULL, MstworldScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvMarukin = { + "marukin", NULL, NULL, NULL, "1990", + "Super Marukin-Ban (Japan 901017)\0", NULL, "Yuga", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAHJONG, 0, + NULL, MarukinRomInfo, MarukinRomName, NULL, NULL, MarukinInputInfo, NULL, + MarukinInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvQtono1 = { + "qtono1", NULL, NULL, NULL, "1991", + "Quiz Tonosama no Yabou (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, + NULL, Qtono1RomInfo, Qtono1RomName, NULL, NULL, Qtono1InputInfo, NULL, + Qtono1Init, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvQsangoku = { + "qsangoku", NULL, NULL, NULL, "1991", + "Quiz Sangokushi (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, + NULL, QsangokuRomInfo, QsangokuRomName, NULL, NULL, Qtono1InputInfo, NULL, + QsangokuInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvBlock = { + "block", NULL, NULL, NULL, "1991", + "Block Block (World 910910)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_BREAKOUT, 0, + NULL, BlockRomInfo, BlockRomName, NULL, NULL, BlockInputInfo, NULL, + BlockInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvBlockj = { + "blockj", "block", NULL, NULL, "1991", + "Block Block (Japan 910910)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_BREAKOUT, 0, + NULL, BlockjRomInfo, BlockjRomName, NULL, NULL, BlockInputInfo, NULL, + BlockInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvBlockjoy = { + "blockjoy", "block", NULL, NULL, "1991", + "Block Block (World 911116 Joystick)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_BREAKOUT, 0, + NULL, BlockjoyRomInfo, BlockjoyRomName, NULL, NULL, BlockjoyInputInfo, NULL, + BlockjoyInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 240, 384, 3, 4 +}; + +struct BurnDriver BurnDrvBlockbl = { + "blockbl", "block", NULL, NULL, "1991", + "Block Block (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_BREAKOUT, 0, + NULL, BlockblRomInfo, BlockblRomName, NULL, NULL, BlockInputInfo, NULL, + BlockblInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 240, 384, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_momoko.cpp b/src/burn/drv/pre90s/d_momoko.cpp index d167a4857..b7bba3e1a 100644 --- a/src/burn/drv/pre90s/d_momoko.cpp +++ b/src/burn/drv/pre90s/d_momoko.cpp @@ -482,7 +482,6 @@ static INT32 DrvInit() ZetMapArea(0xe000, 0xe3ff, 2, DrvVidRAM); ZetSetWriteHandler(momoko_main_write); ZetSetReadHandler(momoko_main_read); - ZetMemEnd(); ZetClose(); ZetInit(1); @@ -494,7 +493,6 @@ static INT32 DrvInit() ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); ZetSetWriteHandler(momoko_sound_write); ZetSetReadHandler(momoko_sound_read); - ZetMemEnd(); ZetClose(); BurnYM2203Init(2, 1250000, NULL, DrvSynchroniseStream, DrvGetTime, 0); diff --git a/src/burn/drv/pre90s/d_mrdo.cpp b/src/burn/drv/pre90s/d_mrdo.cpp index 331b11a2b..12e64d3ee 100644 --- a/src/burn/drv/pre90s/d_mrdo.cpp +++ b/src/burn/drv/pre90s/d_mrdo.cpp @@ -1,764 +1,763 @@ -// FB Alpha Mr. Do! driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "sn76496.h" - -static UINT8 *Mem, *Rom, *Gfx0, *Gfx1, *Gfx2, *Prom; -static UINT8 DrvJoy1[8], DrvJoy2[8], DrvReset, DrvDips[2]; -static INT32 *Palette; - -static INT32 flipscreen, scroll_x, scroll_y; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy2 + 6, "p1 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 5, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 3, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 2, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, - - {"P2 Coin" , BIT_DIGITAL , DrvJoy2 + 7, "p2 coin" }, - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 6, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down", }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, - - {"Tilt" , BIT_DIGITAL , DrvJoy1 + 7, "tilt" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip 1" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip 2" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0xdf, NULL }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x10, 0x01, 0x03, 0x03, "Easy" }, - {0x10, 0x01, 0x03, 0x02, "Medium" }, - {0x10, 0x01, 0x03, 0x01, "Hard" }, - {0x10, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Rack Test (cheat)" }, - {0x10, 0x01, 0x04, 0x04, "Off" }, - {0x10, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Special" }, - {0x10, 0x01, 0x08, 0x08, "Easy" }, - {0x10, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Extra" }, - {0x10, 0x01, 0x10, 0x10, "Easy" }, - {0x10, 0x01, 0x10, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x20, 0x00, "Upright" }, - {0x10, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0xc0, 0x00, "2" }, - {0x10, 0x01, 0xc0, 0xc0, "3" }, - {0x10, 0x01, 0xc0, 0x80, "4" }, - {0x10, 0x01, 0xc0, 0x40, "5" }, - - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 11 , "Coin B" }, - {0x11, 0x01, 0x0f, 0x06, "4C_1C" }, - {0x11, 0x01, 0x0f, 0x08, "3C_1C" }, - {0x11, 0x01, 0x0f, 0x0a, "2C_1C" }, - {0x11, 0x01, 0x0f, 0x07, "3C_2C" }, - {0x11, 0x01, 0x0f, 0x0f, "1C_1C" }, - {0x11, 0x01, 0x0f, 0x09, "2C_3C" }, - {0x11, 0x01, 0x0f, 0x0e, "1C_2C" }, - {0x11, 0x01, 0x0f, 0x0d, "1C_3C" }, - {0x11, 0x01, 0x0f, 0x0c, "1C_4C" }, - {0x11, 0x01, 0x0f, 0x0b, "1C_5C" }, - {0x11, 0x01, 0x0f, 0x00, "Free_Play" }, - - {0 , 0xfe, 0 , 11 , "Coin A" }, - {0x11, 0x01, 0xf0, 0x60, "4C_1C" }, - {0x11, 0x01, 0xf0, 0x80, "3C_1C" }, - {0x11, 0x01, 0xf0, 0xa0, "2C_1C" }, - {0x11, 0x01, 0xf0, 0x70, "3C_2C" }, - {0x11, 0x01, 0xf0, 0xf0, "1C_1C" }, - {0x11, 0x01, 0xf0, 0x90, "2C_3C" }, - {0x11, 0x01, 0xf0, 0xe0, "1C_2C" }, - {0x11, 0x01, 0xf0, 0xd0, "1C_3C" }, - {0x11, 0x01, 0xf0, 0xc0, "1C_4C" }, - {0x11, 0x01, 0xf0, 0xb0, "1C_5C" }, - {0x11, 0x01, 0xf0, 0x00, "Free_Play" }, -}; - -STDDIPINFO(Drv) - -void __fastcall mrdo_write(UINT16 address, UINT8 data) -{ - if ((address & 0xf000) == 0xf000) address &= 0xf800; - - switch (address) - { - case 0x9800: - flipscreen = data & 1; - break; - - case 0x9801: - SN76496Write(0, data); - - case 0x9802: - SN76496Write(1, data); - break; - - case 0xf000: - scroll_x = data; - break; - - case 0xf800: - scroll_y = data ^ (flipscreen ? 0xff : 0); - break; - } -} - -UINT8 __fastcall mrdo_read(UINT16 address) -{ - UINT8 ret = 0xff; - - switch (address) - { - case 0x9803: // Protection - return Rom[ZetHL(-1)]; - - case 0xa000: - { - for (INT32 i = 0; i < 8; i++) ret ^= DrvJoy1[i] << i; - return ret; - } - - case 0xa001: - { - for (INT32 i = 0; i < 8; i++) ret ^= DrvJoy2[i] << i; - return ret; - } - - case 0xa002: - return DrvDips[0]; - - case 0xa003: - return DrvDips[1]; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (Rom + 0x8000, 0, 0x8000); - - flipscreen = 0; - scroll_x = scroll_y = 0; - - ZetOpen(0); - ZetReset(); - ZetClose(); - - return 0; -} - -static void mrdo_palette_init() -{ - INT32 weight[16]; - - for (INT32 i = 0x0f; i >= 0; i--) - { - float par = 0, pot = 0; - - if (i & 1) par += 1.0/150; - if (i & 2) par += 1.0/120; - if (i & 4) par += 1.0/100; - if (i & 8) par += 1.0/75; - if (par) - { - par = 1 / par; - pot = 200 / (200 + par) - 0.2f; - } - else pot = 0; - - weight[i] = (INT32)(0xff * pot / 0.684615); - } - - for (INT32 i = 0; i < 0x100; i++) - { - INT32 a1,a2; - INT32 bits0, bits2; - INT32 r, g, b; - - a1 = ((i >> 3) & 0x1c) + (i & 0x03) + 32; - a2 = ((i >> 0) & 0x1c) + (i & 0x03); - - bits0 = (Prom[a1] >> 0) & 0x03; - bits2 = (Prom[a2] >> 0) & 0x03; - r = weight[bits0 + (bits2 << 2)]; - - bits0 = (Prom[a1] >> 2) & 0x03; - bits2 = (Prom[a2] >> 2) & 0x03; - g = weight[bits0 + (bits2 << 2)]; - - bits0 = (Prom[a1] >> 4) & 0x03; - bits2 = (Prom[a2] >> 4) & 0x03; - b = weight[bits0 + (bits2 << 2)]; - - Palette[i] = (r << 16) | (g << 8) | b; - } - - for (INT32 i = 0; i < 0x40; i++) - { - UINT8 ctbl = Prom[0x40 + (i & 0x1f)] >> ((i & 0x20) >> 3); - - Palette[0x100 + i] = Palette[ctbl & 0x0f]; - } -} - -static void mrdo_gfx_decode() -{ - static INT32 CharPlane[2] = { 0, 0x8000 }; - static INT32 CharXOffs[8] = { 7, 6, 5, 4, 3, 2, 1, 0 }; - static INT32 CharYOffs[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; - - static INT32 SpriPlane[2] = { 4, 0 }; - static INT32 SpriXOffs[16] = { 3, 2, 1, 0, 11, 10, 9, 8, 19, 18, 17, 16, 27, 26, 25, 24 }; - static INT32 SpriYOffs[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x2000); - if (!tmp) return; - - memcpy (tmp, Gfx0, 0x2000); - - GfxDecode(0x200, 2, 8, 8, CharPlane, CharXOffs, CharYOffs, 0x040, tmp, Gfx0); - - memcpy (tmp, Gfx1, 0x2000); - - GfxDecode(0x200, 2, 8, 8, CharPlane, CharXOffs, CharYOffs, 0x040, tmp, Gfx1); - - memcpy (tmp, Gfx2, 0x2000); - - GfxDecode(0x080, 2, 16, 16, SpriPlane, SpriXOffs, SpriYOffs, 0x200, tmp, Gfx2); - - BurnFree (tmp); -} - -static INT32 DrvInit() -{ - Mem = (UINT8*)BurnMalloc(0x10000 + 0x8000 + 0x8000 + 0x8000 + 0x80 + 0x500); - if (!Mem) return 1; - - Rom = Mem + 0x00000; - Gfx0 = Mem + 0x10000; - Gfx1 = Mem + 0x18000; - Gfx2 = Mem + 0x20000; - Prom = Mem + 0x28000; - Palette = (INT32*)(Mem + 0x28080); - - { - for (INT32 i = 0; i < 4; i++) { - if(BurnLoadRom(Rom + i * 0x2000, 0 + i, 1)) return 1; - if(BurnLoadRom(Prom + i * 0x0020, 10 + i, 1)) return 1; - } - - for (INT32 i = 0; i < 2; i++) { - if(BurnLoadRom(Gfx0 + i * 0x1000, 4 + i, 1)) return 1; - if(BurnLoadRom(Gfx1 + i * 0x1000, 6 + i, 1)) return 1; - if(BurnLoadRom(Gfx2 + i * 0x1000, 8 + i, 1)) return 1; - } - - mrdo_palette_init(); - mrdo_gfx_decode(); - } - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(mrdo_read); - ZetSetWriteHandler(mrdo_write); - ZetMapArea(0x0000, 0x7fff, 0, Rom + 0x0000); - ZetMapArea(0x0000, 0x7fff, 2, Rom + 0x0000); - ZetMapArea(0x8000, 0x8fff, 0, Rom + 0x8000); - ZetMapArea(0x8000, 0x8fff, 1, Rom + 0x8000); - ZetMapArea(0x9000, 0x90ff, 1, Rom + 0x9000); - ZetMapArea(0xe000, 0xefff, 0, Rom + 0xe000); - ZetMapArea(0xe000, 0xefff, 1, Rom + 0xe000); - ZetMapArea(0xe000, 0xefff, 2, Rom + 0xe000); - ZetMemEnd(); - ZetClose(); - - BurnSetRefreshRate(5000000.0/312/262); - - SN76489Init(0, 4000000, 0); - SN76489Init(1, 4000000, 1); - SN76496SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - - SN76496Exit(); - - BurnFree (Mem); - - Mem = Rom = Gfx0 = Gfx1 = Gfx2 = Prom = NULL; - Palette = NULL; - - flipscreen = scroll_x = scroll_y = 0; - - return 0; -} - -static void draw_sprites() -{ - for (INT32 offs = 0x100 - 4; offs >= 0; offs -= 4) - { - if (Rom[0x9001 + offs]) - { - INT32 sx = Rom[0x9003 + offs]; - INT32 sy = Rom[0x9001 + offs] ^ 0xff; - - INT32 code = Rom[0x9000 + offs] & 0x7f; - INT32 color = ((Rom[0x9002 + offs] & 0x0f) << 2) | 0x100; - - INT32 flipx = Rom[0x9002 + offs] & 0x10; - INT32 flipy = Rom[0x9002 + offs] & 0x20; - - UINT8 *src = Gfx2 + (code << 8); - - sx -= 8; - sy -= 32; - - if (flipy) - { - for (INT32 y = sy + 15; y >= sy; y--) - { - if (flipx) - { - for (INT32 x = sx + 15; x >= sx; x--, src++) - { - if (y < 0 || x < 0 || y > 191 || x > 239) continue; - if (!*src) continue; - - INT32 pxl = Palette[color | *src]; - - PutPix(pBurnDraw + ((y * 240) + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } else { - for (INT32 x = sx; x < sx + 16; x++, src++) - { - if (y < 0 || x < 0 || y > 191 || x > 239) continue; - if (!*src) continue; - - INT32 pxl = Palette[color | *src]; - - PutPix(pBurnDraw + ((y * 240) + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } - } - } else { - for (INT32 y = sy; y < sy + 16; y++) - { - if (flipx) - { - for (INT32 x = sx + 15; x >= sx; x--, src++) - { - if (y < 0 || x < 0 || y > 191 || x > 239) continue; - if (!*src) continue; - - INT32 pxl = Palette[color | *src]; - - PutPix(pBurnDraw + ((y * 240) + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } else { - for (INT32 x = sx; x < sx + 16; x++, src++) - { - if (y < 0 || x < 0 || y > 191 || x > 239) continue; - if (!*src) continue; - - INT32 pxl = Palette[color | *src]; - - PutPix(pBurnDraw + ((y * 240) + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } - } - } - } - } -} - -static void draw_8x8_tiles(UINT8 *vram, UINT8 *gfx_base, INT32 scrollx, INT32 scrolly) -{ - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 2) & 0xf8; - - INT32 code = vram[0x400 + offs] | ((vram[offs] & 0x80) << 1); - INT32 color = (vram[offs] & 0x3f) << 2; - INT32 forcelayer0 = vram[offs] & 0x40; - - UINT8 *src = gfx_base + (code << 6); - - sx = (UINT8)(sx - scrollx); - sy = (UINT8)(sy - scrolly); - - sx -= 8; - sy -= 32; - - for (INT32 y = sy; y < sy + 8; y++) - { - for (INT32 x = sx; x < sx + 8; x++, src++) - { - if (x < 0 || y < 0 || x > 239 || y > 191) continue; - - INT32 pxl = Palette[color | *src]; - if (!*src && !forcelayer0) continue; - - INT32 pos = y * 240 + x; - if (flipscreen) pos = (192 - y) * 240 + (240 - x); - - PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } - } -} - -static INT32 DrvDraw() -{ - memset (pBurnDraw, 0, 240 * 191 * nBurnBpp); - - draw_8x8_tiles(Rom + 0x8000, Gfx1, scroll_x, scroll_y); - draw_8x8_tiles(Rom + 0x8800, Gfx0, 0, 0); - draw_sprites(); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetOpen(0); - ZetRun(4000000 / 60); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - if (pBurnSoundOut) { - SN76496Update(0, pBurnSoundOut, nBurnSoundLen); - SN76496Update(1, pBurnSoundOut, nBurnSoundLen); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = Rom + 0x8000; - ba.nLen = 0x8000; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - SCAN_VAR(flipscreen); - SCAN_VAR(scroll_x); - SCAN_VAR(scroll_y); - } - - return 0; -} - - -// Mr. Do! - -static struct BurnRomInfo mrdoRomDesc[] = { - { "a4-01.bin", 0x2000, 0x03dcfba2, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "c4-02.bin", 0x2000, 0x0ecdd39c, 1 | BRF_ESS | BRF_PRG }, // 1 - { "e4-03.bin", 0x2000, 0x358f5dc2, 1 | BRF_ESS | BRF_PRG }, // 2 - { "f4-04.bin", 0x2000, 0xf4190cfc, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "s8-09.bin", 0x1000, 0xaa80c5b6, 2 | BRF_GRA }, // 4 FG Tiles - { "u8-10.bin", 0x1000, 0xd20ec85b, 2 | BRF_GRA }, // 5 - - { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles - { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 - - { "h5-05.bin", 0x1000, 0xe1218cc5, 4 | BRF_GRA }, // 8 Sprite Tiles - { "k5-06.bin", 0x1000, 0xb1f68b04, 4 | BRF_GRA }, // 9 - - { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) - { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) - { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table - { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) -}; - -STD_ROM_PICK(mrdo) -STD_ROM_FN(mrdo) - -struct BurnDriver BurnDrvmrdo = { - "mrdo", NULL, NULL, NULL, "1982", - "Mr. Do!\0", NULL, "Universal", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, mrdoRomInfo, mrdoRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, - 192, 240, 3, 4 -}; - - -// Mr. Do! (Taito license) - -static struct BurnRomInfo mrdotRomDesc[] = { - { "d1", 0x2000, 0x3dcd9359, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "d2", 0x2000, 0x710058d8, 1 | BRF_ESS | BRF_PRG }, // 1 - { "d3", 0x2000, 0x467d12d8, 1 | BRF_ESS | BRF_PRG }, // 2 - { "d4", 0x2000, 0xfce9afeb, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "d9", 0x1000, 0xde4cfe66, 2 | BRF_GRA }, // 4 FG Tiles - { "d10", 0x1000, 0xa6c2f38b, 2 | BRF_GRA }, // 5 - - { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles - { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 - - { "h5-05.bin", 0x1000, 0xe1218cc5, 4 | BRF_GRA }, // 8 Sprite Tiles - { "k5-06.bin", 0x1000, 0xb1f68b04, 4 | BRF_GRA }, // 9 - - { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) - { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) - { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table - { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) -}; - -STD_ROM_PICK(mrdot) -STD_ROM_FN(mrdot) - -struct BurnDriver BurnDrvmrdot = { - "mrdot", "mrdo", NULL, NULL, "1982", - "Mr. Do! (Taito license)\0", NULL, "Universal (Taito license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, mrdotRomInfo, mrdotRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, - 192, 240, 3, 4 -}; - -// Mr. Do! (bugfixed) - -static struct BurnRomInfo mrdofixRomDesc[] = { - { "d1", 0x2000, 0x3dcd9359, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "d2", 0x2000, 0x710058d8, 1 | BRF_ESS | BRF_PRG }, // 1 - { "dofix.d3", 0x2000, 0x3a7d039b, 1 | BRF_ESS | BRF_PRG }, // 2 - { "dofix.d4", 0x2000, 0x32db845f, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "d9", 0x1000, 0xde4cfe66, 2 | BRF_GRA }, // 4 FG Tiles - { "d10", 0x1000, 0xa6c2f38b, 2 | BRF_GRA }, // 5 - - { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles - { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 - - { "h5-05.bin", 0x1000, 0xe1218cc5, 4 | BRF_GRA }, // 8 Sprite Tiles - { "k5-06.bin", 0x1000, 0xb1f68b04, 4 | BRF_GRA }, // 9 - - { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) - { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) - { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table - { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) -}; - -STD_ROM_PICK(mrdofix) -STD_ROM_FN(mrdofix) - -struct BurnDriver BurnDrvmrdofix = { - "mrdofix", "mrdo", NULL, NULL, "1982", - "Mr. Do! (bugfixed)\0", NULL, "Universal (Taito license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, mrdofixRomInfo, mrdofixRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, - 192, 240, 3, 4 -}; - - -// Mr. Lo! - -static struct BurnRomInfo mrloRomDesc[] = { - { "mrlo01.bin", 0x2000, 0x6f455e7d, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "d2", 0x2000, 0x710058d8, 1 | BRF_ESS | BRF_PRG }, // 1 - { "dofix.d3", 0x2000, 0x3a7d039b, 1 | BRF_ESS | BRF_PRG }, // 2 - { "mrlo04.bin", 0x2000, 0x49c10274, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "mrlo09.bin", 0x1000, 0xfdb60d0d, 2 | BRF_GRA }, // 4 FG Tiles - { "mrlo10.bin", 0x1000, 0x0492c10e, 2 | BRF_GRA }, // 5 - - { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles - { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 - - { "h5-05.bin", 0x1000, 0xe1218cc5, 4 | BRF_GRA }, // 8 Sprite Tiles - { "k5-06.bin", 0x1000, 0xb1f68b04, 4 | BRF_GRA }, // 9 - - { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) - { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) - { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table - { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) -}; - -STD_ROM_PICK(mrlo) -STD_ROM_FN(mrlo) - -struct BurnDriver BurnDrvmrlo = { - "mrlo", "mrdo", NULL, NULL, "1982", - "Mr. Lo!\0", NULL, "Bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, mrloRomInfo, mrloRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, - 192, 240, 3, 4 -}; - - -// Mr. Du! - -static struct BurnRomInfo mrduRomDesc[] = { - { "d1", 0x2000, 0x3dcd9359, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "d2", 0x2000, 0x710058d8, 1 | BRF_ESS | BRF_PRG }, // 1 - { "d3", 0x2000, 0x467d12d8, 1 | BRF_ESS | BRF_PRG }, // 2 - { "du4.bin", 0x2000, 0x893bc218, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "du9.bin", 0x1000, 0x4090dcdc, 2 | BRF_GRA }, // 4 FG Tiles - { "du10.bin", 0x1000, 0x1e63ab69, 2 | BRF_GRA }, // 5 - - { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles - { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 - - { "h5-05.bin", 0x1000, 0xe1218cc5, 4 | BRF_GRA }, // 8 Sprite Tiles - { "k5-06.bin", 0x1000, 0xb1f68b04, 4 | BRF_GRA }, // 9 - - { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) - { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) - { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table - { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) -}; - -STD_ROM_PICK(mrdu) -STD_ROM_FN(mrdu) - -struct BurnDriver BurnDrvmrdu = { - "mrdu", "mrdo", NULL, NULL, "1982", - "Mr. Du!\0", NULL, "Bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, mrduRomInfo, mrduRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, - 192, 240, 3, 4 -}; - - -// Mr. Do! (prototype) - -static struct BurnRomInfo mrdoyRomDesc[] = { - { "dosnow.1", 0x2000, 0xd3454e2c, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "dosnow.2", 0x2000, 0x5120a6b2, 1 | BRF_ESS | BRF_PRG }, // 1 - { "dosnow.3", 0x2000, 0x96416dbe, 1 | BRF_ESS | BRF_PRG }, // 2 - { "dosnow.4", 0x2000, 0xc05051b6, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "dosnow.9", 0x1000, 0x85d16217, 2 | BRF_GRA }, // 4 FG Tiles - { "dosnow.10", 0x1000, 0x61a7f54b, 2 | BRF_GRA }, // 5 - - { "dosnow.8", 0x1000, 0x2bd1239a, 3 | BRF_GRA }, // 6 BG Tiles - { "dosnow.7", 0x1000, 0xac8ffddf, 3 | BRF_GRA }, // 7 - - { "dosnow.5", 0x1000, 0x7662d828, 4 | BRF_GRA }, // 8 Sprite Tiles - { "dosnow.6", 0x1000, 0x413f88d1, 4 | BRF_GRA }, // 9 - - { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) - { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) - { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table - { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) -}; - -STD_ROM_PICK(mrdoy) -STD_ROM_FN(mrdoy) - -struct BurnDriver BurnDrvmrdoy = { - "mrdoy", "mrdo", NULL, NULL, "1982", - "Mr. Do! (prototype)\0", NULL, "Universal", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_PROTOTYPE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, mrdoyRomInfo, mrdoyRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, - 192, 240, 3, 4 -}; - - -// Yankee DO! - -static struct BurnRomInfo yankeedoRomDesc[] = { - { "a4-01.bin", 0x2000, 0x03dcfba2, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "yd_d2.c4", 0x2000, 0x7c9d7ce0, 1 | BRF_ESS | BRF_PRG }, // 1 - { "e4-03.bin", 0x2000, 0x358f5dc2, 1 | BRF_ESS | BRF_PRG }, // 2 - { "f4-04.bin", 0x2000, 0xf4190cfc, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "s8-09.bin", 0x1000, 0xaa80c5b6, 2 | BRF_GRA }, // 4 FG Tiles - { "u8-10.bin", 0x1000, 0xd20ec85b, 2 | BRF_GRA }, // 5 - - { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles - { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 - - { "yd_d5.h5", 0x1000, 0xf530b79b, 4 | BRF_GRA }, // 8 Sprite Tiles - { "yd_d6.k5", 0x1000, 0x790579aa, 4 | BRF_GRA }, // 9 - - { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) - { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) - { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table - { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) -}; - -STD_ROM_PICK(yankeedo) -STD_ROM_FN(yankeedo) - -struct BurnDriver BurnDrvyankeedo = { - "yankeedo", "mrdo", NULL, NULL, "1982", - "Yankee DO!\0", NULL, "hack", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, yankeedoRomInfo, yankeedoRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, - 192, 240, 3, 4 -}; - +// FB Alpha Mr. Do! driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "sn76496.h" + +static UINT8 *Mem, *Rom, *Gfx0, *Gfx1, *Gfx2, *Prom; +static UINT8 DrvJoy1[8], DrvJoy2[8], DrvReset, DrvDips[2]; +static INT32 *Palette; + +static INT32 flipscreen, scroll_x, scroll_y; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy2 + 6, "p1 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 5, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 3, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 2, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, + + {"P2 Coin" , BIT_DIGITAL , DrvJoy2 + 7, "p2 coin" }, + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 6, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down", }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 2, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, + + {"Tilt" , BIT_DIGITAL , DrvJoy1 + 7, "tilt" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip 1" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip 2" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0xdf, NULL }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x10, 0x01, 0x03, 0x03, "Easy" }, + {0x10, 0x01, 0x03, 0x02, "Medium" }, + {0x10, 0x01, 0x03, 0x01, "Hard" }, + {0x10, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Rack Test (cheat)" }, + {0x10, 0x01, 0x04, 0x04, "Off" }, + {0x10, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Special" }, + {0x10, 0x01, 0x08, 0x08, "Easy" }, + {0x10, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Extra" }, + {0x10, 0x01, 0x10, 0x10, "Easy" }, + {0x10, 0x01, 0x10, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x20, 0x00, "Upright" }, + {0x10, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0xc0, 0x00, "2" }, + {0x10, 0x01, 0xc0, 0xc0, "3" }, + {0x10, 0x01, 0xc0, 0x80, "4" }, + {0x10, 0x01, 0xc0, 0x40, "5" }, + + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 11 , "Coin B" }, + {0x11, 0x01, 0x0f, 0x06, "4C_1C" }, + {0x11, 0x01, 0x0f, 0x08, "3C_1C" }, + {0x11, 0x01, 0x0f, 0x0a, "2C_1C" }, + {0x11, 0x01, 0x0f, 0x07, "3C_2C" }, + {0x11, 0x01, 0x0f, 0x0f, "1C_1C" }, + {0x11, 0x01, 0x0f, 0x09, "2C_3C" }, + {0x11, 0x01, 0x0f, 0x0e, "1C_2C" }, + {0x11, 0x01, 0x0f, 0x0d, "1C_3C" }, + {0x11, 0x01, 0x0f, 0x0c, "1C_4C" }, + {0x11, 0x01, 0x0f, 0x0b, "1C_5C" }, + {0x11, 0x01, 0x0f, 0x00, "Free_Play" }, + + {0 , 0xfe, 0 , 11 , "Coin A" }, + {0x11, 0x01, 0xf0, 0x60, "4C_1C" }, + {0x11, 0x01, 0xf0, 0x80, "3C_1C" }, + {0x11, 0x01, 0xf0, 0xa0, "2C_1C" }, + {0x11, 0x01, 0xf0, 0x70, "3C_2C" }, + {0x11, 0x01, 0xf0, 0xf0, "1C_1C" }, + {0x11, 0x01, 0xf0, 0x90, "2C_3C" }, + {0x11, 0x01, 0xf0, 0xe0, "1C_2C" }, + {0x11, 0x01, 0xf0, 0xd0, "1C_3C" }, + {0x11, 0x01, 0xf0, 0xc0, "1C_4C" }, + {0x11, 0x01, 0xf0, 0xb0, "1C_5C" }, + {0x11, 0x01, 0xf0, 0x00, "Free_Play" }, +}; + +STDDIPINFO(Drv) + +void __fastcall mrdo_write(UINT16 address, UINT8 data) +{ + if ((address & 0xf000) == 0xf000) address &= 0xf800; + + switch (address) + { + case 0x9800: + flipscreen = data & 1; + break; + + case 0x9801: + SN76496Write(0, data); + + case 0x9802: + SN76496Write(1, data); + break; + + case 0xf000: + scroll_x = data; + break; + + case 0xf800: + scroll_y = data ^ (flipscreen ? 0xff : 0); + break; + } +} + +UINT8 __fastcall mrdo_read(UINT16 address) +{ + UINT8 ret = 0xff; + + switch (address) + { + case 0x9803: // Protection + return Rom[ZetHL(-1)]; + + case 0xa000: + { + for (INT32 i = 0; i < 8; i++) ret ^= DrvJoy1[i] << i; + return ret; + } + + case 0xa001: + { + for (INT32 i = 0; i < 8; i++) ret ^= DrvJoy2[i] << i; + return ret; + } + + case 0xa002: + return DrvDips[0]; + + case 0xa003: + return DrvDips[1]; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (Rom + 0x8000, 0, 0x8000); + + flipscreen = 0; + scroll_x = scroll_y = 0; + + ZetOpen(0); + ZetReset(); + ZetClose(); + + return 0; +} + +static void mrdo_palette_init() +{ + INT32 weight[16]; + + for (INT32 i = 0x0f; i >= 0; i--) + { + float par = 0, pot = 0; + + if (i & 1) par += 1.0/150; + if (i & 2) par += 1.0/120; + if (i & 4) par += 1.0/100; + if (i & 8) par += 1.0/75; + if (par) + { + par = 1 / par; + pot = 200 / (200 + par) - 0.2f; + } + else pot = 0; + + weight[i] = (INT32)(0xff * pot / 0.684615); + } + + for (INT32 i = 0; i < 0x100; i++) + { + INT32 a1,a2; + INT32 bits0, bits2; + INT32 r, g, b; + + a1 = ((i >> 3) & 0x1c) + (i & 0x03) + 32; + a2 = ((i >> 0) & 0x1c) + (i & 0x03); + + bits0 = (Prom[a1] >> 0) & 0x03; + bits2 = (Prom[a2] >> 0) & 0x03; + r = weight[bits0 + (bits2 << 2)]; + + bits0 = (Prom[a1] >> 2) & 0x03; + bits2 = (Prom[a2] >> 2) & 0x03; + g = weight[bits0 + (bits2 << 2)]; + + bits0 = (Prom[a1] >> 4) & 0x03; + bits2 = (Prom[a2] >> 4) & 0x03; + b = weight[bits0 + (bits2 << 2)]; + + Palette[i] = (r << 16) | (g << 8) | b; + } + + for (INT32 i = 0; i < 0x40; i++) + { + UINT8 ctbl = Prom[0x40 + (i & 0x1f)] >> ((i & 0x20) >> 3); + + Palette[0x100 + i] = Palette[ctbl & 0x0f]; + } +} + +static void mrdo_gfx_decode() +{ + static INT32 CharPlane[2] = { 0, 0x8000 }; + static INT32 CharXOffs[8] = { 7, 6, 5, 4, 3, 2, 1, 0 }; + static INT32 CharYOffs[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; + + static INT32 SpriPlane[2] = { 4, 0 }; + static INT32 SpriXOffs[16] = { 3, 2, 1, 0, 11, 10, 9, 8, 19, 18, 17, 16, 27, 26, 25, 24 }; + static INT32 SpriYOffs[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x2000); + if (!tmp) return; + + memcpy (tmp, Gfx0, 0x2000); + + GfxDecode(0x200, 2, 8, 8, CharPlane, CharXOffs, CharYOffs, 0x040, tmp, Gfx0); + + memcpy (tmp, Gfx1, 0x2000); + + GfxDecode(0x200, 2, 8, 8, CharPlane, CharXOffs, CharYOffs, 0x040, tmp, Gfx1); + + memcpy (tmp, Gfx2, 0x2000); + + GfxDecode(0x080, 2, 16, 16, SpriPlane, SpriXOffs, SpriYOffs, 0x200, tmp, Gfx2); + + BurnFree (tmp); +} + +static INT32 DrvInit() +{ + Mem = (UINT8*)BurnMalloc(0x10000 + 0x8000 + 0x8000 + 0x8000 + 0x80 + 0x500); + if (!Mem) return 1; + + Rom = Mem + 0x00000; + Gfx0 = Mem + 0x10000; + Gfx1 = Mem + 0x18000; + Gfx2 = Mem + 0x20000; + Prom = Mem + 0x28000; + Palette = (INT32*)(Mem + 0x28080); + + { + for (INT32 i = 0; i < 4; i++) { + if(BurnLoadRom(Rom + i * 0x2000, 0 + i, 1)) return 1; + if(BurnLoadRom(Prom + i * 0x0020, 10 + i, 1)) return 1; + } + + for (INT32 i = 0; i < 2; i++) { + if(BurnLoadRom(Gfx0 + i * 0x1000, 4 + i, 1)) return 1; + if(BurnLoadRom(Gfx1 + i * 0x1000, 6 + i, 1)) return 1; + if(BurnLoadRom(Gfx2 + i * 0x1000, 8 + i, 1)) return 1; + } + + mrdo_palette_init(); + mrdo_gfx_decode(); + } + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(mrdo_read); + ZetSetWriteHandler(mrdo_write); + ZetMapArea(0x0000, 0x7fff, 0, Rom + 0x0000); + ZetMapArea(0x0000, 0x7fff, 2, Rom + 0x0000); + ZetMapArea(0x8000, 0x8fff, 0, Rom + 0x8000); + ZetMapArea(0x8000, 0x8fff, 1, Rom + 0x8000); + ZetMapArea(0x9000, 0x90ff, 1, Rom + 0x9000); + ZetMapArea(0xe000, 0xefff, 0, Rom + 0xe000); + ZetMapArea(0xe000, 0xefff, 1, Rom + 0xe000); + ZetMapArea(0xe000, 0xefff, 2, Rom + 0xe000); + ZetClose(); + + BurnSetRefreshRate(5000000.0/312/262); + + SN76489Init(0, 4000000, 0); + SN76489Init(1, 4000000, 1); + SN76496SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + + SN76496Exit(); + + BurnFree (Mem); + + Mem = Rom = Gfx0 = Gfx1 = Gfx2 = Prom = NULL; + Palette = NULL; + + flipscreen = scroll_x = scroll_y = 0; + + return 0; +} + +static void draw_sprites() +{ + for (INT32 offs = 0x100 - 4; offs >= 0; offs -= 4) + { + if (Rom[0x9001 + offs]) + { + INT32 sx = Rom[0x9003 + offs]; + INT32 sy = Rom[0x9001 + offs] ^ 0xff; + + INT32 code = Rom[0x9000 + offs] & 0x7f; + INT32 color = ((Rom[0x9002 + offs] & 0x0f) << 2) | 0x100; + + INT32 flipx = Rom[0x9002 + offs] & 0x10; + INT32 flipy = Rom[0x9002 + offs] & 0x20; + + UINT8 *src = Gfx2 + (code << 8); + + sx -= 8; + sy -= 32; + + if (flipy) + { + for (INT32 y = sy + 15; y >= sy; y--) + { + if (flipx) + { + for (INT32 x = sx + 15; x >= sx; x--, src++) + { + if (y < 0 || x < 0 || y > 191 || x > 239) continue; + if (!*src) continue; + + INT32 pxl = Palette[color | *src]; + + PutPix(pBurnDraw + ((y * 240) + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } else { + for (INT32 x = sx; x < sx + 16; x++, src++) + { + if (y < 0 || x < 0 || y > 191 || x > 239) continue; + if (!*src) continue; + + INT32 pxl = Palette[color | *src]; + + PutPix(pBurnDraw + ((y * 240) + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } + } + } else { + for (INT32 y = sy; y < sy + 16; y++) + { + if (flipx) + { + for (INT32 x = sx + 15; x >= sx; x--, src++) + { + if (y < 0 || x < 0 || y > 191 || x > 239) continue; + if (!*src) continue; + + INT32 pxl = Palette[color | *src]; + + PutPix(pBurnDraw + ((y * 240) + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } else { + for (INT32 x = sx; x < sx + 16; x++, src++) + { + if (y < 0 || x < 0 || y > 191 || x > 239) continue; + if (!*src) continue; + + INT32 pxl = Palette[color | *src]; + + PutPix(pBurnDraw + ((y * 240) + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } + } + } + } + } +} + +static void draw_8x8_tiles(UINT8 *vram, UINT8 *gfx_base, INT32 scrollx, INT32 scrolly) +{ + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 2) & 0xf8; + + INT32 code = vram[0x400 + offs] | ((vram[offs] & 0x80) << 1); + INT32 color = (vram[offs] & 0x3f) << 2; + INT32 forcelayer0 = vram[offs] & 0x40; + + UINT8 *src = gfx_base + (code << 6); + + sx = (UINT8)(sx - scrollx); + sy = (UINT8)(sy - scrolly); + + sx -= 8; + sy -= 32; + + for (INT32 y = sy; y < sy + 8; y++) + { + for (INT32 x = sx; x < sx + 8; x++, src++) + { + if (x < 0 || y < 0 || x > 239 || y > 191) continue; + + INT32 pxl = Palette[color | *src]; + if (!*src && !forcelayer0) continue; + + INT32 pos = y * 240 + x; + if (flipscreen) pos = (192 - y) * 240 + (240 - x); + + PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } + } +} + +static INT32 DrvDraw() +{ + memset (pBurnDraw, 0, 240 * 191 * nBurnBpp); + + draw_8x8_tiles(Rom + 0x8000, Gfx1, scroll_x, scroll_y); + draw_8x8_tiles(Rom + 0x8800, Gfx0, 0, 0); + draw_sprites(); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetOpen(0); + ZetRun(4000000 / 60); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + if (pBurnSoundOut) { + SN76496Update(0, pBurnSoundOut, nBurnSoundLen); + SN76496Update(1, pBurnSoundOut, nBurnSoundLen); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = Rom + 0x8000; + ba.nLen = 0x8000; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + SCAN_VAR(flipscreen); + SCAN_VAR(scroll_x); + SCAN_VAR(scroll_y); + } + + return 0; +} + + +// Mr. Do! + +static struct BurnRomInfo mrdoRomDesc[] = { + { "a4-01.bin", 0x2000, 0x03dcfba2, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "c4-02.bin", 0x2000, 0x0ecdd39c, 1 | BRF_ESS | BRF_PRG }, // 1 + { "e4-03.bin", 0x2000, 0x358f5dc2, 1 | BRF_ESS | BRF_PRG }, // 2 + { "f4-04.bin", 0x2000, 0xf4190cfc, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "s8-09.bin", 0x1000, 0xaa80c5b6, 2 | BRF_GRA }, // 4 FG Tiles + { "u8-10.bin", 0x1000, 0xd20ec85b, 2 | BRF_GRA }, // 5 + + { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles + { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 + + { "h5-05.bin", 0x1000, 0xe1218cc5, 4 | BRF_GRA }, // 8 Sprite Tiles + { "k5-06.bin", 0x1000, 0xb1f68b04, 4 | BRF_GRA }, // 9 + + { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) + { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) + { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table + { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) +}; + +STD_ROM_PICK(mrdo) +STD_ROM_FN(mrdo) + +struct BurnDriver BurnDrvmrdo = { + "mrdo", NULL, NULL, NULL, "1982", + "Mr. Do!\0", NULL, "Universal", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, mrdoRomInfo, mrdoRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, + 192, 240, 3, 4 +}; + + +// Mr. Do! (Taito license) + +static struct BurnRomInfo mrdotRomDesc[] = { + { "d1", 0x2000, 0x3dcd9359, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "d2", 0x2000, 0x710058d8, 1 | BRF_ESS | BRF_PRG }, // 1 + { "d3", 0x2000, 0x467d12d8, 1 | BRF_ESS | BRF_PRG }, // 2 + { "d4", 0x2000, 0xfce9afeb, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "d9", 0x1000, 0xde4cfe66, 2 | BRF_GRA }, // 4 FG Tiles + { "d10", 0x1000, 0xa6c2f38b, 2 | BRF_GRA }, // 5 + + { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles + { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 + + { "h5-05.bin", 0x1000, 0xe1218cc5, 4 | BRF_GRA }, // 8 Sprite Tiles + { "k5-06.bin", 0x1000, 0xb1f68b04, 4 | BRF_GRA }, // 9 + + { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) + { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) + { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table + { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) +}; + +STD_ROM_PICK(mrdot) +STD_ROM_FN(mrdot) + +struct BurnDriver BurnDrvmrdot = { + "mrdot", "mrdo", NULL, NULL, "1982", + "Mr. Do! (Taito license)\0", NULL, "Universal (Taito license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, mrdotRomInfo, mrdotRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, + 192, 240, 3, 4 +}; + +// Mr. Do! (bugfixed) + +static struct BurnRomInfo mrdofixRomDesc[] = { + { "d1", 0x2000, 0x3dcd9359, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "d2", 0x2000, 0x710058d8, 1 | BRF_ESS | BRF_PRG }, // 1 + { "dofix.d3", 0x2000, 0x3a7d039b, 1 | BRF_ESS | BRF_PRG }, // 2 + { "dofix.d4", 0x2000, 0x32db845f, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "d9", 0x1000, 0xde4cfe66, 2 | BRF_GRA }, // 4 FG Tiles + { "d10", 0x1000, 0xa6c2f38b, 2 | BRF_GRA }, // 5 + + { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles + { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 + + { "h5-05.bin", 0x1000, 0xe1218cc5, 4 | BRF_GRA }, // 8 Sprite Tiles + { "k5-06.bin", 0x1000, 0xb1f68b04, 4 | BRF_GRA }, // 9 + + { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) + { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) + { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table + { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) +}; + +STD_ROM_PICK(mrdofix) +STD_ROM_FN(mrdofix) + +struct BurnDriver BurnDrvmrdofix = { + "mrdofix", "mrdo", NULL, NULL, "1982", + "Mr. Do! (bugfixed)\0", NULL, "Universal (Taito license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, mrdofixRomInfo, mrdofixRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, + 192, 240, 3, 4 +}; + + +// Mr. Lo! + +static struct BurnRomInfo mrloRomDesc[] = { + { "mrlo01.bin", 0x2000, 0x6f455e7d, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "d2", 0x2000, 0x710058d8, 1 | BRF_ESS | BRF_PRG }, // 1 + { "dofix.d3", 0x2000, 0x3a7d039b, 1 | BRF_ESS | BRF_PRG }, // 2 + { "mrlo04.bin", 0x2000, 0x49c10274, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "mrlo09.bin", 0x1000, 0xfdb60d0d, 2 | BRF_GRA }, // 4 FG Tiles + { "mrlo10.bin", 0x1000, 0x0492c10e, 2 | BRF_GRA }, // 5 + + { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles + { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 + + { "h5-05.bin", 0x1000, 0xe1218cc5, 4 | BRF_GRA }, // 8 Sprite Tiles + { "k5-06.bin", 0x1000, 0xb1f68b04, 4 | BRF_GRA }, // 9 + + { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) + { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) + { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table + { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) +}; + +STD_ROM_PICK(mrlo) +STD_ROM_FN(mrlo) + +struct BurnDriver BurnDrvmrlo = { + "mrlo", "mrdo", NULL, NULL, "1982", + "Mr. Lo!\0", NULL, "Bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, mrloRomInfo, mrloRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, + 192, 240, 3, 4 +}; + + +// Mr. Du! + +static struct BurnRomInfo mrduRomDesc[] = { + { "d1", 0x2000, 0x3dcd9359, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "d2", 0x2000, 0x710058d8, 1 | BRF_ESS | BRF_PRG }, // 1 + { "d3", 0x2000, 0x467d12d8, 1 | BRF_ESS | BRF_PRG }, // 2 + { "du4.bin", 0x2000, 0x893bc218, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "du9.bin", 0x1000, 0x4090dcdc, 2 | BRF_GRA }, // 4 FG Tiles + { "du10.bin", 0x1000, 0x1e63ab69, 2 | BRF_GRA }, // 5 + + { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles + { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 + + { "h5-05.bin", 0x1000, 0xe1218cc5, 4 | BRF_GRA }, // 8 Sprite Tiles + { "k5-06.bin", 0x1000, 0xb1f68b04, 4 | BRF_GRA }, // 9 + + { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) + { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) + { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table + { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) +}; + +STD_ROM_PICK(mrdu) +STD_ROM_FN(mrdu) + +struct BurnDriver BurnDrvmrdu = { + "mrdu", "mrdo", NULL, NULL, "1982", + "Mr. Du!\0", NULL, "Bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, mrduRomInfo, mrduRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, + 192, 240, 3, 4 +}; + + +// Mr. Do! (prototype) + +static struct BurnRomInfo mrdoyRomDesc[] = { + { "dosnow.1", 0x2000, 0xd3454e2c, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "dosnow.2", 0x2000, 0x5120a6b2, 1 | BRF_ESS | BRF_PRG }, // 1 + { "dosnow.3", 0x2000, 0x96416dbe, 1 | BRF_ESS | BRF_PRG }, // 2 + { "dosnow.4", 0x2000, 0xc05051b6, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "dosnow.9", 0x1000, 0x85d16217, 2 | BRF_GRA }, // 4 FG Tiles + { "dosnow.10", 0x1000, 0x61a7f54b, 2 | BRF_GRA }, // 5 + + { "dosnow.8", 0x1000, 0x2bd1239a, 3 | BRF_GRA }, // 6 BG Tiles + { "dosnow.7", 0x1000, 0xac8ffddf, 3 | BRF_GRA }, // 7 + + { "dosnow.5", 0x1000, 0x7662d828, 4 | BRF_GRA }, // 8 Sprite Tiles + { "dosnow.6", 0x1000, 0x413f88d1, 4 | BRF_GRA }, // 9 + + { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) + { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) + { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table + { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) +}; + +STD_ROM_PICK(mrdoy) +STD_ROM_FN(mrdoy) + +struct BurnDriver BurnDrvmrdoy = { + "mrdoy", "mrdo", NULL, NULL, "1982", + "Mr. Do! (prototype)\0", NULL, "Universal", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_PROTOTYPE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, mrdoyRomInfo, mrdoyRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, + 192, 240, 3, 4 +}; + + +// Yankee DO! + +static struct BurnRomInfo yankeedoRomDesc[] = { + { "a4-01.bin", 0x2000, 0x03dcfba2, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "yd_d2.c4", 0x2000, 0x7c9d7ce0, 1 | BRF_ESS | BRF_PRG }, // 1 + { "e4-03.bin", 0x2000, 0x358f5dc2, 1 | BRF_ESS | BRF_PRG }, // 2 + { "f4-04.bin", 0x2000, 0xf4190cfc, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "s8-09.bin", 0x1000, 0xaa80c5b6, 2 | BRF_GRA }, // 4 FG Tiles + { "u8-10.bin", 0x1000, 0xd20ec85b, 2 | BRF_GRA }, // 5 + + { "r8-08.bin", 0x1000, 0xdbdc9ffa, 3 | BRF_GRA }, // 6 BG Tiles + { "n8-07.bin", 0x1000, 0x4b9973db, 3 | BRF_GRA }, // 7 + + { "yd_d5.h5", 0x1000, 0xf530b79b, 4 | BRF_GRA }, // 8 Sprite Tiles + { "yd_d6.k5", 0x1000, 0x790579aa, 4 | BRF_GRA }, // 9 + + { "u02--2.bin", 0x0020, 0x238a65d7, 5 | BRF_GRA }, // 10 Palette (high bits) + { "t02--3.bin", 0x0020, 0xae263dc0, 5 | BRF_GRA }, // 11 Palette (low bits) + { "f10--1.bin", 0x0020, 0x16ee4ca2, 5 | BRF_GRA }, // 12 Sprite color lookup table + { "j10--4.bin", 0x0020, 0xff7fe284, 5 | BRF_GRA }, // 13 Timing (not used) +}; + +STD_ROM_PICK(yankeedo) +STD_ROM_FN(yankeedo) + +struct BurnDriver BurnDrvyankeedo = { + "yankeedo", "mrdo", NULL, NULL, "1982", + "Yankee DO!\0", NULL, "hack", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, yankeedoRomInfo, yankeedoRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x140, + 192, 240, 3, 4 +}; + diff --git a/src/burn/drv/pre90s/d_mrflea.cpp b/src/burn/drv/pre90s/d_mrflea.cpp index 3d559e924..ff2942486 100644 --- a/src/burn/drv/pre90s/d_mrflea.cpp +++ b/src/burn/drv/pre90s/d_mrflea.cpp @@ -1,606 +1,604 @@ -// FB Alpha Amazing Adventures of Mr. F. Lea driver module -// Based on MAME driver by Phil Stroffolino - -#include "burnint.h" -#include "z80_intf.h" -#include "bitswap.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *Mem, *Rom0, *Rom1, *Ram, *Gfx0, *Gfx1; -static INT32 *Palette; -static UINT8 DrvJoy1[8], DrvJoy2[8], DrvDips[2], DrvReset; - -static INT16 *pFMBuffer, *pAY8910Buffer[9]; - -static INT32 mrflea_io; -static INT32 mrflea_main; -static INT32 mrflea_status; -static INT32 mrflea_select[4]; -static UINT8 mrflea_gfx_bank; - -static struct BurnInputInfo DrvInputList[] = { - {"Start 1" , BIT_DIGITAL , DrvJoy1 + 3, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvJoy1 + 2, "p2 start" }, - {"P1 Coin" , BIT_DIGITAL , DrvJoy2 + 2, "p1 coin" }, - - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 4, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 5, "p1 left" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 6, "p1 up", }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 7, "p1 down", }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 1, "p1 fire 1"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips+0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips+1, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x09, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Bonus" }, - {0x09, 0x01, 0x03, 0x03, "A" }, - {0x09, 0x01, 0x03, 0x02, "B" }, - {0x09, 0x01, 0x03, 0x01, "C" }, - {0x09, 0x01, 0x03, 0x00, "D" }, - - // Default Values - {0x0a, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0a, 0x01, 0x03, 0x02, "2C 1C" }, - {0x0a, 0x01, 0x03, 0x03, "1C 1C" }, - {0x0a, 0x01, 0x03, 0x00, "2C 3C" }, - {0x0a, 0x01, 0x03, 0x01, "1C 2C" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0a, 0x01, 0x0c, 0x0c, "3" }, - {0x0a, 0x01, 0x0c, 0x08, "4" }, - {0x0a, 0x01, 0x0c, 0x04, "5" }, - {0x0a, 0x01, 0x0c, 0x00, "7" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0a, 0x01, 0x30, 0x30, "Easy" }, - {0x0a, 0x01, 0x30, 0x20, "Medium" }, - {0x0a, 0x01, 0x30, 0x10, "Hard" }, - {0x0a, 0x01, 0x30, 0x00, "Hardest" }, -}; - -STDDIPINFO(Drv) - -void __fastcall mrflea_write(UINT16 a, UINT8 d) -{ - if (a >= 0xe000 && a <= 0xe7ff) // video ram - { - Ram[0xe000 + (a & 0x3ff)] = d; - Ram[0xe400 + (a & 0x3ff)] = (a >> 10) & 1; - return; - } - - if (a >= 0xe800 && a <= 0xe83f) // palette ram - { - Ram[a] = d; - - Palette[(a >> 1) & 0x1f] = ((Ram[a | 1] & 0x0f) | (Ram[a | 1] << 4)) << 16; - Palette[(a >> 1) & 0x1f] |= ((Ram[a &~1] & 0xf0) | (Ram[a &~1] >> 4)) << 8; - Palette[(a >> 1) & 0x1f] |= ((Ram[a &~1] & 0x0f) | (Ram[a &~1] << 4)) << 0; - - return; - } - - if (a >= 0xec00 && a <= 0xecff) // sprite ram - { - if (a & 2) { // tile number - Ram[a | 1] = a & 1; - a &= 0xfffe; - } - - Ram[a] = d; - - return; - } -} - - -void __fastcall mrflea_out_port(UINT16 a, UINT8 data) -{ - switch (a & 0xff) - { - case 0x00: // watchdog? - case 0x43: - break; - - case 0x40: - { - mrflea_status |= 0x08; - mrflea_io = data; - - ZetClose(); - ZetOpen(1); - ZetRaiseIrq(0); - ZetClose(); - ZetOpen(0); - } - break; - - case 0x60: - mrflea_gfx_bank = data; - break; - } -} - -UINT8 __fastcall mrflea_in_port(UINT16 a) -{ - switch (a & 0xff) - { - case 0x41: - mrflea_status &= ~0x01; - return mrflea_main; - - break; - - case 0x42: - return (mrflea_status ^ 0x08); - break; - } - - return 0; -} - -void __fastcall mrflea_cpu1_out_port(UINT16 a, UINT8 data) -{ - switch (a & 0xff) - { - case 0x00: // watchdog - case 0x10: - case 0x11: - case 0x23: - break; - - case 0x21: - mrflea_status |= 0x01; - mrflea_main = data; - break; - - case 0x40: - AY8910Write(0, 0, mrflea_select[0]); - AY8910Write(0, 1, data); - break; - - case 0x42: - break; - - case 0x44: - AY8910Write(1, 0, mrflea_select[2]); - AY8910Write(1, 1, data); - break; - - case 0x46: - AY8910Write(2, 0, mrflea_select[3]); - AY8910Write(2, 1, data); - break; - - case 0x41: - case 0x43: - case 0x45: - case 0x47: - mrflea_select[(a >> 1) & 3] = data; - break; - } -} - -UINT8 __fastcall mrflea_cpu1_in_port(UINT16 a) -{ - UINT8 ret = 0; - - switch (a & 0xff) - { - case 0x10: - if (mrflea_status & 0x08) return 0x00; - return 0x01; - break; - - case 0x20: - mrflea_status &= ~0x08; - return mrflea_io; - - case 0x22: - return (mrflea_status ^ 0x01); - - case 0x40: - if (mrflea_select[0] == 0x0f) { - for (INT32 i = 0; i < 8; i++) { - ret |= DrvJoy1[i] << i; - } - return ~ret; - } - if (mrflea_select[0] == 0x0e) { - for (INT32 i = 0; i < 8; i++) { - ret |= DrvJoy2[i] << i; - } - return ~ret; - } - return 0; - - case 0x44: - if (mrflea_select[2] == 0x0f) return 0xff; - if (mrflea_select[2] == 0x0e) return 0xff; - return 0; - - case 0x42: - case 0x46: - return 0; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - memset (Ram, 0, 0x10000); - - memset (mrflea_select, 0, sizeof(INT32) * 4); - - mrflea_io = 0; - mrflea_main = 0; - mrflea_status = 0; - mrflea_gfx_bank = 0; - - DrvReset = 0; - - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - for (INT32 i = 0; i < 3; i++) { - AY8910Reset(i); - } - - return 0; -} - -static INT32 convert_gfx() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, Gfx0, 0x10000); - - for (INT32 i = 0; i < 0x20000; i++) // sprites - { - Gfx0[i^0x07] = ((tmp[0x0000 + (i >> 3)] >> (i & 7)) & 1) << 3; - Gfx0[i^0x07] |= ((tmp[0x4000 + (i >> 3)] >> (i & 7)) & 1) << 2; - Gfx0[i^0x07] |= ((tmp[0x8000 + (i >> 3)] >> (i & 7)) & 1) << 1; - Gfx0[i^0x07] |= ((tmp[0xc000 + (i >> 3)] >> (i & 7)) & 1); - } - - memcpy (tmp, Gfx1, 0x10000); - - for (INT32 i = 0; i < 0x20000; i+=2) // chars - { - Gfx1[i + 0] = (tmp[i>>1] >> 4) & 0x0f; - Gfx1[i + 1] = (tmp[i>>1] >> 0) & 0x0f; - } - - BurnFree (tmp); - - return 0; -} - - -static INT32 DrvInit() -{ - Mem = (UINT8*)BurnMalloc(0x70000 + (128 * sizeof(INT32))); - if (Mem == NULL) { - return 1; - } - - pFMBuffer = (INT16*)BurnMalloc(nBurnSoundLen * 9 * sizeof(INT16)); - if (pFMBuffer == NULL) { - return 1; - } - - memset (Mem, 0, 0x70080); - - Rom0 = Mem + 0x000000; - Rom1 = Mem + 0x010000; - Ram = Mem + 0x020000; - Gfx0 = Mem + 0x030000; - Gfx1 = Mem + 0x050000; - Palette = (INT32*)(Mem + 0x70000); - - { - for (INT32 i = 0; i < 6; i++) { - if (BurnLoadRom(Rom0 + i * 0x2000, i, 1)) return 1; - } - - if (BurnLoadRom(Rom1 + 0x0000, 6, 1)) return 1; - if (BurnLoadRom(Rom1 + 0x2000, 7, 1)) return 1; - if (BurnLoadRom(Rom1 + 0x3000, 8, 1)) return 1; - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(Gfx0 + i * 0x2000, i + 9, 1)) return 1; - if (BurnLoadRom(Gfx1 + i * 0x2000, i + 17, 1)) return 1; - } - - if (convert_gfx()) return 1; - } - - ZetInit(0); - ZetOpen(0); - ZetSetInHandler(mrflea_in_port); - ZetSetOutHandler(mrflea_out_port); - ZetSetWriteHandler(mrflea_write); - ZetMapArea(0x0000, 0xbfff, 0, Rom0 + 0x0000); - ZetMapArea(0x0000, 0xbfff, 2, Rom0 + 0x0000); - ZetMapArea(0xc000, 0xcfff, 0, Ram + 0xc000); - ZetMapArea(0xc000, 0xcfff, 1, Ram + 0xc000); - ZetMapArea(0xc000, 0xcfff, 2, Ram + 0xc000); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetInHandler(mrflea_cpu1_in_port); - ZetSetOutHandler(mrflea_cpu1_out_port); - ZetMapArea(0x0000, 0x3fff, 0, Rom1 + 0x0000); - ZetMapArea(0x0000, 0x3fff, 2, Rom1 + 0x0000); - ZetMapArea(0x8000, 0x80ff, 0, Ram + 0x8000); - ZetMapArea(0x8000, 0x80ff, 1, Ram + 0x8000); - ZetMapArea(0x8000, 0x80ff, 2, Ram + 0x8000); - ZetMapArea(0x9000, 0x905a, 0, Ram + 0x9000); - ZetMapArea(0x9000, 0x905a, 1, Ram + 0x9000); - ZetMapArea(0x9000, 0x905a, 2, Ram + 0x9000); - ZetMemEnd(); - ZetClose(); - - for (INT32 i = 0; i < 9; i++) - pAY8910Buffer[i] = pFMBuffer + nBurnSoundLen * i; - - AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(2, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(2, 0.25, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - AY8910Exit(0); - AY8910Exit(1); - AY8910Exit(2); - - BurnFree (Mem); - BurnFree (pFMBuffer); - - Rom0 = Rom1 = Ram = Gfx0 = Gfx1 = NULL; - - pFMBuffer = NULL; - for (INT32 i = 0; i < 9; i++) - pAY8910Buffer[i] = NULL; - - Palette = NULL; - - return 0; -} - - -static INT32 DrvDraw() -{ - INT32 base = ((mrflea_gfx_bank & 0x04) << 8) | ((mrflea_gfx_bank & 0x10) << 5); - - for (INT32 i = 0; i < 0x400; i++) - { - INT32 sy = (i >> 2) & 0xf8; - INT32 sx = (i << 3) & 0xf8; - - if (sy >= 0xf8) continue; - - INT32 code = base + Ram[0xe000 + i] + (Ram[0xe400 + i] << 8); - - UINT8 *src = Gfx1 + code * 64; - - for (INT32 y = sy; y < sy + 8; y++) - { - for (INT32 x = sx; x < sx + 8; x++, src++) - { - INT32 pxl = Palette[*src]; - - PutPix(pBurnDraw + ((y << 8) | x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } - } - - for (INT32 i = 0; i < 0x100; i+=4) - { - INT32 sx = Ram[0xec00 + i + 1]; - INT32 sy = Ram[0xec00 + i + 0] - 13; - - INT32 code = (Ram[0xec00 + i + 2] | (Ram[0xec00 + i + 3] << 8)) << 8; - - UINT8 *src = Gfx0 + code; - - for (INT32 y = sy; y < sy + 16; y++) - { - for (INT32 x = sx; x < sx + 16; x++, src++) - { - if (!*src || x >= 0xff || y >= 0xf8 || y < 0) continue; - - INT32 pxl = Palette[0x10|*src]; - - PutPix(pBurnDraw + ((y << 8) | x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } - } - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - INT32 nInterleave = 200; - INT32 nSoundBufferPos = 0; - - INT32 nCyclesSegment; - INT32 nCyclesDone[2], nCyclesTotal[2]; - - nCyclesTotal[0] = 4000000 / 60; - nCyclesTotal[1] = 6000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #0 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == (nInterleave - 1)) ZetRaiseIrq(0); - ZetClose(); - - // Run Z80 #1 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if ((mrflea_status&0x08) || i == (nInterleave - 1)) ZetRaiseIrq(0); - ZetClose(); - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = Ram; - ba.nLen = 0x10000; - ba.szName = "All Ram"; - BurnAcb(&ba); - - memset(&ba, 0, sizeof(ba)); - ba.Data = (UINT8*)Palette; - ba.nLen = 0x80 * sizeof(INT32); - ba.szName = "Palette"; - BurnAcb(&ba); - - ZetScan(nAction); // Scan Z80 - - AY8910Scan(nAction, pnMin); // Scan AY8910 - - // Scan critical driver variables - SCAN_VAR(mrflea_io); - SCAN_VAR(mrflea_main); - SCAN_VAR(mrflea_status); - SCAN_VAR(mrflea_gfx_bank); - SCAN_VAR(mrflea_select[0]); - SCAN_VAR(mrflea_select[1]); - SCAN_VAR(mrflea_select[2]); - SCAN_VAR(mrflea_select[3]); - } - - return 0; -} - - -// The Amazing Adventures of Mr. F. Lea - -static struct BurnRomInfo mrfleaRomDesc[] = { - { "cpu_d1", 0x2000, 0xd286217c, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 0 Code - { "cpu_d3", 0x2000, 0x95cf94bc, 1 | BRF_ESS | BRF_PRG }, // 1 - { "cpu_d5", 0x2000, 0x466ca77e, 1 | BRF_ESS | BRF_PRG }, // 2 - { "cpu_b1", 0x2000, 0x721477d6, 1 | BRF_ESS | BRF_PRG }, // 3 - { "cpu_b3", 0x2000, 0xf55b01e4, 1 | BRF_ESS | BRF_PRG }, // 4 - { "cpu_b5", 0x2000, 0x79f560aa, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "io_a11", 0x1000, 0x7a20c3ee, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 1 Code - { "io_c11", 0x1000, 0x8d26e0c8, 2 | BRF_ESS | BRF_PRG }, // 7 - { "io_d11", 0x1000, 0xabd9afc0, 2 | BRF_ESS | BRF_PRG }, // 8 - - { "vd_l10", 0x2000, 0x48b2adf9, 3 | BRF_GRA }, // 9 Sprites - { "vd_l11", 0x2000, 0x2ff168c0, 3 | BRF_GRA }, // 10 - { "vd_l6", 0x2000, 0x100158ca, 3 | BRF_GRA }, // 11 - { "vd_l7", 0x2000, 0x34501577, 3 | BRF_GRA }, // 12 - { "vd_j10", 0x2000, 0x3f29b8c3, 3 | BRF_GRA }, // 13 - { "vd_j11", 0x2000, 0x39380bea, 3 | BRF_GRA }, // 14 - { "vd_j6", 0x2000, 0x2b4b110e, 3 | BRF_GRA }, // 15 - { "vd_j7", 0x2000, 0x3a3c8b1e, 3 | BRF_GRA }, // 16 - - { "vd_k1", 0x2000, 0x7540e3a7, 4 | BRF_GRA }, // 17 Characters - { "vd_k2", 0x2000, 0x6c688219, 4 | BRF_GRA }, // 18 - { "vd_k3", 0x2000, 0x15e96f3c, 4 | BRF_GRA }, // 19 - { "vd_k4", 0x2000, 0xfe5100df, 4 | BRF_GRA }, // 20 - { "vd_l1", 0x2000, 0xd1e3d056, 4 | BRF_GRA }, // 21 - { "vd_l2", 0x2000, 0x4d7fb925, 4 | BRF_GRA }, // 22 - { "vd_l3", 0x2000, 0x6d81588a, 4 | BRF_GRA }, // 23 - { "vd_l4", 0x2000, 0x423735a5, 4 | BRF_GRA }, // 24 -}; - -STD_ROM_PICK(mrflea) -STD_ROM_FN(mrflea) - -struct BurnDriver BurnDrvmrflea = { - "mrflea", NULL, NULL, NULL, "1982", - "The Amazing Adventures of Mr. F. Lea\0", NULL, "Pacific Novelty", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, mrfleaRomInfo, mrfleaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x80, - 248, 256, 3, 4 -}; - +// FB Alpha Amazing Adventures of Mr. F. Lea driver module +// Based on MAME driver by Phil Stroffolino + +#include "burnint.h" +#include "z80_intf.h" +#include "bitswap.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *Mem, *Rom0, *Rom1, *Ram, *Gfx0, *Gfx1; +static INT32 *Palette; +static UINT8 DrvJoy1[8], DrvJoy2[8], DrvDips[2], DrvReset; + +static INT16 *pFMBuffer, *pAY8910Buffer[9]; + +static INT32 mrflea_io; +static INT32 mrflea_main; +static INT32 mrflea_status; +static INT32 mrflea_select[4]; +static UINT8 mrflea_gfx_bank; + +static struct BurnInputInfo DrvInputList[] = { + {"Start 1" , BIT_DIGITAL , DrvJoy1 + 3, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvJoy1 + 2, "p2 start" }, + {"P1 Coin" , BIT_DIGITAL , DrvJoy2 + 2, "p1 coin" }, + + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 4, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 5, "p1 left" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 6, "p1 up", }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 7, "p1 down", }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 1, "p1 fire 1"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips+0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips+1, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x09, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Bonus" }, + {0x09, 0x01, 0x03, 0x03, "A" }, + {0x09, 0x01, 0x03, 0x02, "B" }, + {0x09, 0x01, 0x03, 0x01, "C" }, + {0x09, 0x01, 0x03, 0x00, "D" }, + + // Default Values + {0x0a, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0a, 0x01, 0x03, 0x02, "2C 1C" }, + {0x0a, 0x01, 0x03, 0x03, "1C 1C" }, + {0x0a, 0x01, 0x03, 0x00, "2C 3C" }, + {0x0a, 0x01, 0x03, 0x01, "1C 2C" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0a, 0x01, 0x0c, 0x0c, "3" }, + {0x0a, 0x01, 0x0c, 0x08, "4" }, + {0x0a, 0x01, 0x0c, 0x04, "5" }, + {0x0a, 0x01, 0x0c, 0x00, "7" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0a, 0x01, 0x30, 0x30, "Easy" }, + {0x0a, 0x01, 0x30, 0x20, "Medium" }, + {0x0a, 0x01, 0x30, 0x10, "Hard" }, + {0x0a, 0x01, 0x30, 0x00, "Hardest" }, +}; + +STDDIPINFO(Drv) + +void __fastcall mrflea_write(UINT16 a, UINT8 d) +{ + if (a >= 0xe000 && a <= 0xe7ff) // video ram + { + Ram[0xe000 + (a & 0x3ff)] = d; + Ram[0xe400 + (a & 0x3ff)] = (a >> 10) & 1; + return; + } + + if (a >= 0xe800 && a <= 0xe83f) // palette ram + { + Ram[a] = d; + + Palette[(a >> 1) & 0x1f] = ((Ram[a | 1] & 0x0f) | (Ram[a | 1] << 4)) << 16; + Palette[(a >> 1) & 0x1f] |= ((Ram[a &~1] & 0xf0) | (Ram[a &~1] >> 4)) << 8; + Palette[(a >> 1) & 0x1f] |= ((Ram[a &~1] & 0x0f) | (Ram[a &~1] << 4)) << 0; + + return; + } + + if (a >= 0xec00 && a <= 0xecff) // sprite ram + { + if (a & 2) { // tile number + Ram[a | 1] = a & 1; + a &= 0xfffe; + } + + Ram[a] = d; + + return; + } +} + + +void __fastcall mrflea_out_port(UINT16 a, UINT8 data) +{ + switch (a & 0xff) + { + case 0x00: // watchdog? + case 0x43: + break; + + case 0x40: + { + mrflea_status |= 0x08; + mrflea_io = data; + + ZetClose(); + ZetOpen(1); + ZetRaiseIrq(0); + ZetClose(); + ZetOpen(0); + } + break; + + case 0x60: + mrflea_gfx_bank = data; + break; + } +} + +UINT8 __fastcall mrflea_in_port(UINT16 a) +{ + switch (a & 0xff) + { + case 0x41: + mrflea_status &= ~0x01; + return mrflea_main; + + break; + + case 0x42: + return (mrflea_status ^ 0x08); + break; + } + + return 0; +} + +void __fastcall mrflea_cpu1_out_port(UINT16 a, UINT8 data) +{ + switch (a & 0xff) + { + case 0x00: // watchdog + case 0x10: + case 0x11: + case 0x23: + break; + + case 0x21: + mrflea_status |= 0x01; + mrflea_main = data; + break; + + case 0x40: + AY8910Write(0, 0, mrflea_select[0]); + AY8910Write(0, 1, data); + break; + + case 0x42: + break; + + case 0x44: + AY8910Write(1, 0, mrflea_select[2]); + AY8910Write(1, 1, data); + break; + + case 0x46: + AY8910Write(2, 0, mrflea_select[3]); + AY8910Write(2, 1, data); + break; + + case 0x41: + case 0x43: + case 0x45: + case 0x47: + mrflea_select[(a >> 1) & 3] = data; + break; + } +} + +UINT8 __fastcall mrflea_cpu1_in_port(UINT16 a) +{ + UINT8 ret = 0; + + switch (a & 0xff) + { + case 0x10: + if (mrflea_status & 0x08) return 0x00; + return 0x01; + break; + + case 0x20: + mrflea_status &= ~0x08; + return mrflea_io; + + case 0x22: + return (mrflea_status ^ 0x01); + + case 0x40: + if (mrflea_select[0] == 0x0f) { + for (INT32 i = 0; i < 8; i++) { + ret |= DrvJoy1[i] << i; + } + return ~ret; + } + if (mrflea_select[0] == 0x0e) { + for (INT32 i = 0; i < 8; i++) { + ret |= DrvJoy2[i] << i; + } + return ~ret; + } + return 0; + + case 0x44: + if (mrflea_select[2] == 0x0f) return 0xff; + if (mrflea_select[2] == 0x0e) return 0xff; + return 0; + + case 0x42: + case 0x46: + return 0; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + memset (Ram, 0, 0x10000); + + memset (mrflea_select, 0, sizeof(INT32) * 4); + + mrflea_io = 0; + mrflea_main = 0; + mrflea_status = 0; + mrflea_gfx_bank = 0; + + DrvReset = 0; + + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + for (INT32 i = 0; i < 3; i++) { + AY8910Reset(i); + } + + return 0; +} + +static INT32 convert_gfx() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, Gfx0, 0x10000); + + for (INT32 i = 0; i < 0x20000; i++) // sprites + { + Gfx0[i^0x07] = ((tmp[0x0000 + (i >> 3)] >> (i & 7)) & 1) << 3; + Gfx0[i^0x07] |= ((tmp[0x4000 + (i >> 3)] >> (i & 7)) & 1) << 2; + Gfx0[i^0x07] |= ((tmp[0x8000 + (i >> 3)] >> (i & 7)) & 1) << 1; + Gfx0[i^0x07] |= ((tmp[0xc000 + (i >> 3)] >> (i & 7)) & 1); + } + + memcpy (tmp, Gfx1, 0x10000); + + for (INT32 i = 0; i < 0x20000; i+=2) // chars + { + Gfx1[i + 0] = (tmp[i>>1] >> 4) & 0x0f; + Gfx1[i + 1] = (tmp[i>>1] >> 0) & 0x0f; + } + + BurnFree (tmp); + + return 0; +} + + +static INT32 DrvInit() +{ + Mem = (UINT8*)BurnMalloc(0x70000 + (128 * sizeof(INT32))); + if (Mem == NULL) { + return 1; + } + + pFMBuffer = (INT16*)BurnMalloc(nBurnSoundLen * 9 * sizeof(INT16)); + if (pFMBuffer == NULL) { + return 1; + } + + memset (Mem, 0, 0x70080); + + Rom0 = Mem + 0x000000; + Rom1 = Mem + 0x010000; + Ram = Mem + 0x020000; + Gfx0 = Mem + 0x030000; + Gfx1 = Mem + 0x050000; + Palette = (INT32*)(Mem + 0x70000); + + { + for (INT32 i = 0; i < 6; i++) { + if (BurnLoadRom(Rom0 + i * 0x2000, i, 1)) return 1; + } + + if (BurnLoadRom(Rom1 + 0x0000, 6, 1)) return 1; + if (BurnLoadRom(Rom1 + 0x2000, 7, 1)) return 1; + if (BurnLoadRom(Rom1 + 0x3000, 8, 1)) return 1; + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(Gfx0 + i * 0x2000, i + 9, 1)) return 1; + if (BurnLoadRom(Gfx1 + i * 0x2000, i + 17, 1)) return 1; + } + + if (convert_gfx()) return 1; + } + + ZetInit(0); + ZetOpen(0); + ZetSetInHandler(mrflea_in_port); + ZetSetOutHandler(mrflea_out_port); + ZetSetWriteHandler(mrflea_write); + ZetMapArea(0x0000, 0xbfff, 0, Rom0 + 0x0000); + ZetMapArea(0x0000, 0xbfff, 2, Rom0 + 0x0000); + ZetMapArea(0xc000, 0xcfff, 0, Ram + 0xc000); + ZetMapArea(0xc000, 0xcfff, 1, Ram + 0xc000); + ZetMapArea(0xc000, 0xcfff, 2, Ram + 0xc000); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetInHandler(mrflea_cpu1_in_port); + ZetSetOutHandler(mrflea_cpu1_out_port); + ZetMapArea(0x0000, 0x3fff, 0, Rom1 + 0x0000); + ZetMapArea(0x0000, 0x3fff, 2, Rom1 + 0x0000); + ZetMapArea(0x8000, 0x80ff, 0, Ram + 0x8000); + ZetMapArea(0x8000, 0x80ff, 1, Ram + 0x8000); + ZetMapArea(0x8000, 0x80ff, 2, Ram + 0x8000); + ZetMapArea(0x9000, 0x905a, 0, Ram + 0x9000); + ZetMapArea(0x9000, 0x905a, 1, Ram + 0x9000); + ZetMapArea(0x9000, 0x905a, 2, Ram + 0x9000); + ZetClose(); + + for (INT32 i = 0; i < 9; i++) + pAY8910Buffer[i] = pFMBuffer + nBurnSoundLen * i; + + AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(2, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(2, 0.25, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + AY8910Exit(0); + AY8910Exit(1); + AY8910Exit(2); + + BurnFree (Mem); + BurnFree (pFMBuffer); + + Rom0 = Rom1 = Ram = Gfx0 = Gfx1 = NULL; + + pFMBuffer = NULL; + for (INT32 i = 0; i < 9; i++) + pAY8910Buffer[i] = NULL; + + Palette = NULL; + + return 0; +} + + +static INT32 DrvDraw() +{ + INT32 base = ((mrflea_gfx_bank & 0x04) << 8) | ((mrflea_gfx_bank & 0x10) << 5); + + for (INT32 i = 0; i < 0x400; i++) + { + INT32 sy = (i >> 2) & 0xf8; + INT32 sx = (i << 3) & 0xf8; + + if (sy >= 0xf8) continue; + + INT32 code = base + Ram[0xe000 + i] + (Ram[0xe400 + i] << 8); + + UINT8 *src = Gfx1 + code * 64; + + for (INT32 y = sy; y < sy + 8; y++) + { + for (INT32 x = sx; x < sx + 8; x++, src++) + { + INT32 pxl = Palette[*src]; + + PutPix(pBurnDraw + ((y << 8) | x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } + } + + for (INT32 i = 0; i < 0x100; i+=4) + { + INT32 sx = Ram[0xec00 + i + 1]; + INT32 sy = Ram[0xec00 + i + 0] - 13; + + INT32 code = (Ram[0xec00 + i + 2] | (Ram[0xec00 + i + 3] << 8)) << 8; + + UINT8 *src = Gfx0 + code; + + for (INT32 y = sy; y < sy + 16; y++) + { + for (INT32 x = sx; x < sx + 16; x++, src++) + { + if (!*src || x >= 0xff || y >= 0xf8 || y < 0) continue; + + INT32 pxl = Palette[0x10|*src]; + + PutPix(pBurnDraw + ((y << 8) | x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } + } + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + INT32 nInterleave = 200; + INT32 nSoundBufferPos = 0; + + INT32 nCyclesSegment; + INT32 nCyclesDone[2], nCyclesTotal[2]; + + nCyclesTotal[0] = 4000000 / 60; + nCyclesTotal[1] = 6000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #0 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == (nInterleave - 1)) ZetRaiseIrq(0); + ZetClose(); + + // Run Z80 #1 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if ((mrflea_status&0x08) || i == (nInterleave - 1)) ZetRaiseIrq(0); + ZetClose(); + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = Ram; + ba.nLen = 0x10000; + ba.szName = "All Ram"; + BurnAcb(&ba); + + memset(&ba, 0, sizeof(ba)); + ba.Data = (UINT8*)Palette; + ba.nLen = 0x80 * sizeof(INT32); + ba.szName = "Palette"; + BurnAcb(&ba); + + ZetScan(nAction); // Scan Z80 + + AY8910Scan(nAction, pnMin); // Scan AY8910 + + // Scan critical driver variables + SCAN_VAR(mrflea_io); + SCAN_VAR(mrflea_main); + SCAN_VAR(mrflea_status); + SCAN_VAR(mrflea_gfx_bank); + SCAN_VAR(mrflea_select[0]); + SCAN_VAR(mrflea_select[1]); + SCAN_VAR(mrflea_select[2]); + SCAN_VAR(mrflea_select[3]); + } + + return 0; +} + + +// The Amazing Adventures of Mr. F. Lea + +static struct BurnRomInfo mrfleaRomDesc[] = { + { "cpu_d1", 0x2000, 0xd286217c, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 0 Code + { "cpu_d3", 0x2000, 0x95cf94bc, 1 | BRF_ESS | BRF_PRG }, // 1 + { "cpu_d5", 0x2000, 0x466ca77e, 1 | BRF_ESS | BRF_PRG }, // 2 + { "cpu_b1", 0x2000, 0x721477d6, 1 | BRF_ESS | BRF_PRG }, // 3 + { "cpu_b3", 0x2000, 0xf55b01e4, 1 | BRF_ESS | BRF_PRG }, // 4 + { "cpu_b5", 0x2000, 0x79f560aa, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "io_a11", 0x1000, 0x7a20c3ee, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 1 Code + { "io_c11", 0x1000, 0x8d26e0c8, 2 | BRF_ESS | BRF_PRG }, // 7 + { "io_d11", 0x1000, 0xabd9afc0, 2 | BRF_ESS | BRF_PRG }, // 8 + + { "vd_l10", 0x2000, 0x48b2adf9, 3 | BRF_GRA }, // 9 Sprites + { "vd_l11", 0x2000, 0x2ff168c0, 3 | BRF_GRA }, // 10 + { "vd_l6", 0x2000, 0x100158ca, 3 | BRF_GRA }, // 11 + { "vd_l7", 0x2000, 0x34501577, 3 | BRF_GRA }, // 12 + { "vd_j10", 0x2000, 0x3f29b8c3, 3 | BRF_GRA }, // 13 + { "vd_j11", 0x2000, 0x39380bea, 3 | BRF_GRA }, // 14 + { "vd_j6", 0x2000, 0x2b4b110e, 3 | BRF_GRA }, // 15 + { "vd_j7", 0x2000, 0x3a3c8b1e, 3 | BRF_GRA }, // 16 + + { "vd_k1", 0x2000, 0x7540e3a7, 4 | BRF_GRA }, // 17 Characters + { "vd_k2", 0x2000, 0x6c688219, 4 | BRF_GRA }, // 18 + { "vd_k3", 0x2000, 0x15e96f3c, 4 | BRF_GRA }, // 19 + { "vd_k4", 0x2000, 0xfe5100df, 4 | BRF_GRA }, // 20 + { "vd_l1", 0x2000, 0xd1e3d056, 4 | BRF_GRA }, // 21 + { "vd_l2", 0x2000, 0x4d7fb925, 4 | BRF_GRA }, // 22 + { "vd_l3", 0x2000, 0x6d81588a, 4 | BRF_GRA }, // 23 + { "vd_l4", 0x2000, 0x423735a5, 4 | BRF_GRA }, // 24 +}; + +STD_ROM_PICK(mrflea) +STD_ROM_FN(mrflea) + +struct BurnDriver BurnDrvmrflea = { + "mrflea", NULL, NULL, NULL, "1982", + "The Amazing Adventures of Mr. F. Lea\0", NULL, "Pacific Novelty", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 1, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, mrfleaRomInfo, mrfleaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x80, + 248, 256, 3, 4 +}; + diff --git a/src/burn/drv/pre90s/d_pacman.cpp b/src/burn/drv/pre90s/d_pacman.cpp index a7d530625..d6413ab24 100644 --- a/src/burn/drv/pre90s/d_pacman.cpp +++ b/src/burn/drv/pre90s/d_pacman.cpp @@ -1,6368 +1,6367 @@ -// FB Alpha Puckman module -// Based on MAME driver by Nicola Salmoria and many others - -// Fix Shoot the Bull inputs - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "bitswap.h" -#include "sn76496.h" -#include "namco_snd.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvQROM; -static UINT8 *DrvGfxROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvColRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprRAM2; -static UINT8 *DrvColPROM; -static UINT8 *DrvTransTable; - -static INT16 *pAY8910Buffer[3]; -static UINT32 *Palette; -static UINT8 DrvRecalc; - -static UINT8 DrvReset; -static UINT8 DrvJoy1[8] = {0,0,0,0,0,0,0,0}; -static UINT8 DrvJoy2[8] = {0,0,0,0,0,0,0,0}; -static UINT8 DrvInputs[2] = {0,0}; -static UINT8 DrvDips[4] = {0,0,0,0}; -static INT16 DrvAxis[2] = { 0, 0 }; -static INT16 nAnalogAxis[2] = {0,0}; -static UINT8 nCharAxis[2] = {0,0}; - -enum { PACMAN=0, MSPACMAN, CANNONBP, MAKETRAX, PIRANHA, VANVAN, NMOUSE, DREMSHPR, - MSCHAMP, BIGBUCKS, ROCKTRV2, ALIBABA, CRUSHS, SHOOTBUL, BIRDIY, EPOS, PENGO }; - -static INT32 game_select; -static INT32 acitya = 0; - -static UINT8 *flipscreen; - -static INT32 interrupt_mode; -static INT32 interrupt_mask; - -static UINT8 colortablebank; -static UINT8 palettebank; -static UINT8 spritebank; -static UINT8 charbank; -static INT32 nPacBank; - -static INT32 alibaba_mystery; -static UINT8 *rocktrv2_prot_data; -static INT8 epos_hardware_counter; -static UINT8 mschamp_counter; -static UINT8 cannonb_bit_to_read; - -static UINT32 watchdog; - -//------------------------------------------------------------------------------------------------------ - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, - - {"Dip Switches 1 ", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo lizwizInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 4, "diag"}, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 6, "tilt"}, - - {"Dip Switches 1 ", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, -}; - -STDINPUTINFO(lizwiz) - -static struct BurnInputInfo PengoInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip D", BIT_DIPSWITCH, DrvDips + 3, "dip"}, -}; - -STDINPUTINFO(Pengo) - -static struct BurnInputInfo mschampInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, - {"Coin 3", BIT_DIGITAL, DrvJoy1 + 7, "p3 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, -}; - -STDINPUTINFO(mschamp) - -static struct BurnInputInfo eyesInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 6, "tilt"}, - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(eyes) - -static struct BurnInputInfo theglobpInputList[] = { - {"Coin", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 2"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 7, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, - - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, -}; - -STDINPUTINFO(theglobp) - -static struct BurnInputInfo ponpokoInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, - - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 3, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(ponpoko) - -static struct BurnInputInfo vanvanInputList[] = { - {"Coin", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, - - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(vanvan) - -static struct BurnInputInfo vanvankInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin"}, - - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(vanvank) - -static struct BurnInputInfo cannonbpInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(cannonbp) - -static struct BurnInputInfo rocktrv2InputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - - {"Tilt", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 3, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(rocktrv2) - -static struct BurnInputInfo bigbucksInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, - - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, -}; - -STDINPUTINFO(bigbucks) - -static struct BurnInputInfo woodpekInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, - - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(woodpek) - -static struct BurnInputInfo acityaInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 3"}, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 4"}, - {"P1 Button 5", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 5"}, - {"P1 Button 6", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 6"}, - - {"Service Mode 1", BIT_DIGITAL, DrvJoy1 + 4, "diag"}, - {"Service Mode 2", BIT_DIGITAL, DrvJoy2 + 4, "diag"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, -}; - -STDINPUTINFO(acitya) - -static struct BurnInputInfo bwcasinoInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 3"}, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 4"}, - {"P1 Button 5", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 5"}, - {"P1 Button 6", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 6"}, - - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 3"}, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 4"}, - {"P2 Button 5", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 5"}, - {"P2 Button 6", BIT_DIGITAL, DrvJoy1 + 7, "p2 fire 6"}, - - {"Service Mode ", BIT_DIGITAL, DrvJoy1 + 4, "diag"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, -}; - -STDINPUTINFO(bwcasino) - -static struct BurnInputInfo dremshprInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire "}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, -}; - -STDINPUTINFO(dremshpr) - -static struct BurnInputInfo alibabaInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, -}; - -STDINPUTINFO(alibaba) - -static struct BurnInputInfo jumpshotInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, - - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(jumpshot) - -static struct BurnInputInfo korosukeInputList[] = { - {"Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin"}, - {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, - - {"Dip Switches 1 ", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, -}; - -STDINPUTINFO(korosuke) - -#define A(a, b, c, d) { a, b, (UINT8*)(c), d } - -static struct BurnInputInfo shootbulInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, - {"Coin 3", BIT_DIGITAL, DrvJoy1 + 7, "p3 coin"}, - {"Start", BIT_DIGITAL, DrvJoy2 + 6, "p1 start"}, - - A("P1 X Axis", BIT_ANALOG_REL, DrvAxis + 0, "mouse x-axis"), - A("P1 Y Axis", BIT_ANALOG_REL, DrvAxis + 1, "mouse y-axis"), - - {"P1 Button A", BIT_DIGITAL, DrvJoy2 + 5, "mouse button 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - - {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(shootbul) - -#undef A - - -static struct BurnDIPInfo DrvDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xc9, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, - {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, - {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, - {0x0e, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x0c, 0x00, "1" }, - {0x0e, 0x01, 0x0c, 0x04, "2" }, - {0x0e, 0x01, 0x0c, 0x08, "3" }, - {0x0e, 0x01, 0x0c, 0x0c, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x30, 0x00, "10000" }, - {0x0e, 0x01, 0x30, 0x10, "15000" }, - {0x0e, 0x01, 0x30, 0x20, "20000" }, - {0x0e, 0x01, 0x30, 0x30, "None" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0e, 0x01, 0x40, 0x40, "Normal" }, - {0x0e, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Ghost Names" }, - {0x0e, 0x01, 0x80, 0x80, "Normal" }, - {0x0e, 0x01, 0x80, 0x00, "Alternate" }, - - {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, - {0x0f, 0x01, 0x10, 0x10, "Off" }, - {0x0f, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x80, "Upright" }, - {0x10, 0x01, 0x80, 0x00, "Cocktail" }, -}; - -STDDIPINFO(Drv) - -static struct BurnDIPInfo PengoDIPList[]= -{ - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xb0, NULL }, - {0x12, 0xff, 0xff, 0xcc, NULL }, - - {0 , 0xfe, 0 , 1, "Service Mode" }, - {0x10, 0x01, 0x10, 0x10, "Off" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x11, 0x01, 0x01, 0x00, "30000" }, - {0x11, 0x01, 0x01, 0x01, "50000" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x11, 0x01, 0x04, 0x00, "Upright" }, - {0x11, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x11, 0x01, 0x18, 0x18, "2" }, - {0x11, 0x01, 0x18, 0x10, "3" }, - {0x11, 0x01, 0x18, 0x08, "4" }, - {0x11, 0x01, 0x18, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Rack Test (Cheat)" }, - {0x11, 0x01, 0x20, 0x20, "Off" }, - {0x11, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x11, 0x01, 0xc0, 0xc0, "Easy" }, - {0x11, 0x01, 0xc0, 0x80, "Medium" }, - {0x11, 0x01, 0xc0, 0x40, "Hard" }, - {0x11, 0x01, 0xc0, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x00, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x0f, 0x04, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "2 Coins/1 Credit 5/3" }, - {0x12, 0x01, 0x0f, 0x05, "2 Coins/1 Credit 4/3" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin/1 Credit 5/6" }, - {0x12, 0x01, 0x0f, 0x03, "1 Coin/1 Credit 4/5" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin/1 Credit 2/3" }, - {0x12, 0x01, 0x0f, 0x02, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "1 Coin/2 Credits 5/11" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin/2 Credits 4/9" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x12, 0x01, 0xf0, 0x00, "4 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0x40, "2 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "2 Coins/1 Credit 5/3" }, - {0x12, 0x01, 0xf0, 0x50, "2 Coins/1 Credit 4/3" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin/1 Credit 5/6" }, - {0x12, 0x01, 0xf0, 0x30, "1 Coin/1 Credit 4/5" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin/1 Credit 2/3" }, - {0x12, 0x01, 0xf0, 0x20, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "1 Coin/2 Credits 5/11" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin/2 Credits 4/9" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "1 Coin 6 Credits" }, -}; - -STDDIPINFO(Pengo) - -static struct BurnDIPInfo mspacmanDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xc9, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, - {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, - {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, - {0x0e, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x0c, 0x00, "1" }, - {0x0e, 0x01, 0x0c, 0x04, "2" }, - {0x0e, 0x01, 0x0c, 0x08, "3" }, - {0x0e, 0x01, 0x0c, 0x0c, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x30, 0x00, "10000" }, - {0x0e, 0x01, 0x30, 0x10, "15000" }, - {0x0e, 0x01, 0x30, 0x20, "20000" }, - {0x0e, 0x01, 0x30, 0x30, "None" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0e, 0x01, 0x40, 0x40, "Normal" }, - {0x0e, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, - {0x0f, 0x01, 0x10, 0x10, "Off" }, - {0x0f, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x80, "Upright" }, - {0x10, 0x01, 0x80, 0x00, "Cocktail" }, -}; - -STDDIPINFO(mspacman) - -static struct BurnDIPInfo mschampDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xc9, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, - {0x0f, 0x01, 0x10, 0x10, "Off" }, - {0x0f, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x80, "Upright" }, - {0x10, 0x01, 0x80, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, - {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, - {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, - {0x0e, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x0c, 0x00, "1" }, - {0x0e, 0x01, 0x0c, 0x04, "2" }, - {0x0e, 0x01, 0x0c, 0x08, "3" }, - {0x0e, 0x01, 0x0c, 0x0c, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x30, 0x00, "10000" }, - {0x0e, 0x01, 0x30, 0x10, "15000" }, - {0x0e, 0x01, 0x30, 0x20, "20000" }, - {0x0e, 0x01, 0x30, 0x30, "None" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0e, 0x01, 0x40, 0x40, "Normal" }, - {0x0e, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Game" }, - {0x11, 0x01, 0x01, 0x01, "Champion Edition" }, - {0x11, 0x01, 0x01, 0x00, "Super Zola Pac Gal" }, -}; - -STDDIPINFO(mschamp) - -static struct BurnDIPInfo maketraxDIPList[]= -{ - {0x0e, 0xff, 0x3f, 0x31, NULL }, - {0x0f, 0xff, 0xff, 0xef, NULL }, - {0x10, 0xff, 0x6f, 0x6f, NULL }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x10, 0x00, "Upright" }, - {0x0f, 0x01, 0x10, 0x10, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, - {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, - {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, - {0x0e, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x0c, 0x00, "3" }, - {0x0e, 0x01, 0x0c, 0x04, "4" }, - {0x0e, 0x01, 0x0c, 0x08, "5" }, - {0x0e, 0x01, 0x0c, 0x0c, "6" }, - - {0 , 0xfe, 0 , 2 , "First Pattern" }, - {0x0e, 0x01, 0x30, 0x10, "Easy" }, - {0x0e, 0x01, 0x30, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Teleport Holes" }, - {0x0e, 0x01, 0x20, 0x20, "Off" }, - {0x0e, 0x01, 0x20, 0x00, "On" }, -}; - -STDDIPINFO(maketrax) - -static struct BurnDIPInfo mbrushDIPList[]= -{ - {0x0e, 0xff, 0xff, 0x39, NULL }, - {0x0f, 0xff, 0xff, 0xef, NULL }, - {0x10, 0xff, 0xff, 0x6f, NULL }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x10, 0x00, "Upright" }, - {0x0f, 0x01, 0x10, 0x10, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, - {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, - {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, - {0x0e, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x0c, 0x00, "1" }, - {0x0e, 0x01, 0x0c, 0x04, "2" }, - {0x0e, 0x01, 0x0c, 0x08, "3" }, - {0x0e, 0x01, 0x0c, 0x0c, "4" }, -}; - -STDDIPINFO(mbrush) - -static struct BurnDIPInfo crushsDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xff, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 2 , "Teleport Holes" }, - {0x0f, 0x01, 0x10, 0x10, "Off" }, - {0x0f, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x11, 0x01, 0x0f, 0x08, "2C 1C" }, - {0x11, 0x01, 0x0f, 0x09, "2C 2C" }, - {0x11, 0x01, 0x0f, 0x00, "1C 1C" }, - {0x11, 0x01, 0x0f, 0x0a, "2C 3C" }, - {0x11, 0x01, 0x0f, 0x0b, "2C 4C" }, - {0x11, 0x01, 0x0f, 0x01, "2C 2C" }, - {0x11, 0x01, 0x0f, 0x0c, "1C 5C" }, - {0x11, 0x01, 0x0f, 0x0d, "2C 6C" }, - {0x11, 0x01, 0x0f, 0x02, "1C 3C" }, - {0x11, 0x01, 0x0f, 0x0e, "2C 7C" }, - {0x11, 0x01, 0x0f, 0x0f, "2C 8C" }, - {0x11, 0x01, 0x0f, 0x03, "1C 4C" }, - {0x11, 0x01, 0x0f, 0x04, "1C 5C" }, - {0x11, 0x01, 0x0f, 0x05, "1C 6C" }, - {0x11, 0x01, 0x0f, 0x06, "1C 7C" }, - {0x11, 0x01, 0x0f, 0x07, "1C 8C" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x11, 0x01, 0xf0, 0x80, "2C 1C" }, - {0x11, 0x01, 0xf0, 0x90, "2C 2C" }, - {0x11, 0x01, 0xf0, 0x00, "1C 1C" }, - {0x11, 0x01, 0xf0, 0xa0, "2C 3C" }, - {0x11, 0x01, 0xf0, 0xb0, "2C 4C" }, - {0x11, 0x01, 0xf0, 0x10, "2C 2C" }, - {0x11, 0x01, 0xf0, 0xc0, "1C 5C" }, - {0x11, 0x01, 0xf0, 0xd0, "2C 6C" }, - {0x11, 0x01, 0xf0, 0x20, "1C 3C" }, - {0x11, 0x01, 0xf0, 0xe0, "2C 7C" }, - {0x11, 0x01, 0xf0, 0xf0, "2C 8C" }, - {0x11, 0x01, 0xf0, 0x30, "1C 4C" }, - {0x11, 0x01, 0xf0, 0x40, "1C 5C" }, - {0x11, 0x01, 0xf0, 0x50, "1C 6C" }, - {0x11, 0x01, 0xf0, 0x60, "1C 7C" }, - {0x11, 0x01, 0xf0, 0x70, "1C 8C" }, -}; - -STDDIPINFO(crushs) - -static struct BurnDIPInfo ponpokoDIPList[]= -{ - {0x10, 0xff, 0xff, 0xd1, NULL }, - {0x11, 0xff, 0xff, 0xb1, NULL }, - {0x12, 0xff, 0xff, 0xe0, NULL }, - {0x13, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x10, 0x01, 0x03, 0x00, "10000" }, - {0x10, 0x01, 0x03, 0x01, "30000" }, - {0x10, 0x01, 0x03, 0x02, "50000" }, - {0x10, 0x01, 0x03, 0x03, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x30, 0x00, "2" }, - {0x10, 0x01, 0x30, 0x10, "3" }, - {0x10, 0x01, 0x30, 0x20, "4" }, - {0x10, 0x01, 0x30, 0x30, "5" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x40, 0x40, "Upright" }, - {0x10, 0x01, 0x40, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 16 , "Coinage" }, - {0x11, 0x01, 0x0f, 0x04, "A 3/1 B 3/1" }, - {0x11, 0x01, 0x0f, 0x0e, "A 3/1 B 1/2" }, - {0x11, 0x01, 0x0f, 0x0f, "A 3/1 B 1/4" }, - {0x11, 0x01, 0x0f, 0x02, "A 2/1 B 2/1" }, - {0x11, 0x01, 0x0f, 0x0d, "A 2/1 B 1/1" }, - {0x11, 0x01, 0x0f, 0x07, "A 2/1 B 1/3" }, - {0x11, 0x01, 0x0f, 0x0b, "A 2/1 B 1/5" }, - {0x11, 0x01, 0x0f, 0x0c, "A 2/1 B 1/6" }, - {0x11, 0x01, 0x0f, 0x01, "A 1/1 B 1/1" }, - {0x11, 0x01, 0x0f, 0x06, "A 1/1 B 4/5" }, - {0x11, 0x01, 0x0f, 0x05, "A 1/1 B 2/3" }, - {0x11, 0x01, 0x0f, 0x0a, "A 1/1 B 1/3" }, - {0x11, 0x01, 0x0f, 0x08, "A 1/1 B 1/5" }, - {0x11, 0x01, 0x0f, 0x09, "A 1/1 B 1/6" }, - {0x11, 0x01, 0x0f, 0x03, "A 1/2 B 1/2" }, - {0x11, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x40, 0x40, "Off" }, - {0x11, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(ponpoko) - -static struct BurnDIPInfo bwcasinoDIPList[]= -{ - {0x0f, 0xff, 0xff, 0x7f, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x80, 0x00, "Upright" }, - {0x0f, 0x01, 0x80, 0x80, "Cocktail" }, - - {0 , 0xfe, 0 , 16 , "Hands Per Game" }, - {0x10, 0x01, 0x1e, 0x1e, "3" }, - {0x10, 0x01, 0x1e, 0x1c, "4" }, - {0x10, 0x01, 0x1e, 0x1a, "5" }, - {0x10, 0x01, 0x1e, 0x18, "6" }, - {0x10, 0x01, 0x1e, 0x16, "7" }, - {0x10, 0x01, 0x1e, 0x14, "8" }, - {0x10, 0x01, 0x1e, 0x12, "9" }, - {0x10, 0x01, 0x1e, 0x10, "10" }, - {0x10, 0x01, 0x1e, 0x0e, "11" }, - {0x10, 0x01, 0x1e, 0x0c, "12" }, - {0x10, 0x01, 0x1e, 0x0a, "13" }, - {0x10, 0x01, 0x1e, 0x07, "14" }, - {0x10, 0x01, 0x1e, 0x06, "15" }, - {0x10, 0x01, 0x1e, 0x04, "16" }, - {0x10, 0x01, 0x1e, 0x02, "17" }, - {0x10, 0x01, 0x1e, 0x00, "18" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x10, 0x01, 0x20, 0x20, "Off" }, - {0x10, 0x01, 0x20, 0x00, "On" }, -}; - -STDDIPINFO(bwcasino) - -static struct BurnDIPInfo acityaDIPList[]= -{ - {0x0a, 0xff, 0xff, 0xff, NULL }, - {0x0b, 0xff, 0xff, 0xff, NULL }, - {0x0c, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16 , "Hands Per Game" }, - {0x0b, 0x01, 0x1e, 0x1e, "3" }, - {0x0b, 0x01, 0x1e, 0x1c, "4" }, - {0x0b, 0x01, 0x1e, 0x1a, "5" }, - {0x0b, 0x01, 0x1e, 0x18, "6" }, - {0x0b, 0x01, 0x1e, 0x16, "7" }, - {0x0b, 0x01, 0x1e, 0x14, "8" }, - {0x0b, 0x01, 0x1e, 0x12, "9" }, - {0x0b, 0x01, 0x1e, 0x10, "10" }, - {0x0b, 0x01, 0x1e, 0x0e, "11" }, - {0x0b, 0x01, 0x1e, 0x0c, "12" }, - {0x0b, 0x01, 0x1e, 0x0a, "13" }, - {0x0b, 0x01, 0x1e, 0x07, "14" }, - {0x0b, 0x01, 0x1e, 0x06, "15" }, - {0x0b, 0x01, 0x1e, 0x04, "16" }, - {0x0b, 0x01, 0x1e, 0x02, "17" }, - {0x0b, 0x01, 0x1e, 0x00, "18" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x20, 0x20, "Off" }, - {0x0b, 0x01, 0x20, 0x00, "On" }, -}; - -STDDIPINFO(acitya) - -static struct BurnDIPInfo eyesDIPList[]= -{ - {0x10, 0xff, 0xff, 0xfb, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x10, 0x01, 0x03, 0x01, "2C 1C" }, - {0x10, 0x01, 0x03, 0x03, "1C 1C" }, - {0x10, 0x01, 0x03, 0x02, "1C 2C" }, - {0x10, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x0c, 0x0c, "2" }, - {0x10, 0x01, 0x0c, 0x08, "3" }, - {0x10, 0x01, 0x0c, 0x04, "4" }, - {0x10, 0x01, 0x0c, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x10, 0x01, 0x30, 0x30, "50000" }, - {0x10, 0x01, 0x30, 0x20, "75000" }, - {0x10, 0x01, 0x30, 0x10, "100000" }, - {0x10, 0x01, 0x30, 0x00, "125000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x40, 0x40, "Upright" }, - {0x10, 0x01, 0x40, 0x00, "Cocktail" }, -}; - -STDDIPINFO(eyes) - -static struct BurnDIPInfo mrtntDIPList[]= -{ - {0x10, 0xff, 0xff, 0xfb, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x10, 0x01, 0x03, 0x01, "2C 1C" }, - {0x10, 0x01, 0x03, 0x03, "1C 1C" }, - {0x10, 0x01, 0x03, 0x02, "1C 2C" }, - {0x10, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x0c, 0x0c, "2" }, - {0x10, 0x01, 0x0c, 0x08, "3" }, - {0x10, 0x01, 0x0c, 0x04, "4" }, - {0x10, 0x01, 0x0c, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x10, 0x01, 0x30, 0x30, "75000" }, - {0x10, 0x01, 0x30, 0x20, "100000" }, - {0x10, 0x01, 0x30, 0x10, "125000" }, - {0x10, 0x01, 0x30, 0x00, "150000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x40, 0x40, "Upright" }, - {0x10, 0x01, 0x40, 0x00, "Cocktail" }, -}; - -STDDIPINFO(mrtnt) - -static struct BurnDIPInfo alibabaDIPList[]= -{ - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xd9, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, - {0x0f, 0x01, 0x10, 0x10, "Off" }, - {0x0f, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x80, "Upright" }, - {0x10, 0x01, 0x80, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x11, 0x01, 0x03, 0x03, "2C 1C" }, - {0x11, 0x01, 0x03, 0x01, "1C 1C" }, - {0x11, 0x01, 0x03, 0x02, "1C 2C" }, - {0x11, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x0c, 0x00, "1" }, - {0x11, 0x01, 0x0c, 0x04, "2" }, - {0x11, 0x01, 0x0c, 0x08, "3" }, - {0x11, 0x01, 0x0c, 0x0c, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x11, 0x01, 0x30, 0x00, "10000" }, - {0x11, 0x01, 0x30, 0x10, "15000" }, - {0x11, 0x01, 0x30, 0x20, "20000" }, - {0x11, 0x01, 0x30, 0x30, "None" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x11, 0x01, 0x40, 0x40, "Normal" }, - {0x11, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(alibaba) - -static struct BurnDIPInfo theglobpDIPList[]= -{ - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x80, 0x80, "Upright" }, - {0x0f, 0x01, 0x80, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x03, 0x03, "3" }, - {0x10, 0x01, 0x03, 0x02, "4" }, - {0x10, 0x01, 0x03, 0x01, "5" }, - {0x10, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x10, 0x01, 0x1c, 0x1c, "Easiest" }, - {0x10, 0x01, 0x1c, 0x18, "Very Easy" }, - {0x10, 0x01, 0x1c, 0x14, "Easy" }, - {0x10, 0x01, 0x1c, 0x10, "Normal" }, - {0x10, 0x01, 0x1c, 0x0c, "Difficult" }, - {0x10, 0x01, 0x1c, 0x08, "Very Difficult" }, - {0x10, 0x01, 0x1c, 0x04, "Very Hard" }, - {0x10, 0x01, 0x1c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x10, 0x01, 0x20, 0x20, "Off" }, - {0x10, 0x01, 0x20, 0x00, "On" }, -}; - -STDDIPINFO(theglobp) - -static struct BurnDIPInfo woodpekDIPList[]= -{ - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xc1, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, - {0x10, 0x01, 0x10, 0x10, "Off" }, - {0x10, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x11, 0x01, 0x03, 0x03, "2C 1C" }, - {0x11, 0x01, 0x03, 0x01, "1C 1C" }, - {0x11, 0x01, 0x03, 0x02, "1C 2C" }, - {0x11, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x0c, 0x00, "3" }, - {0x11, 0x01, 0x0c, 0x04, "4" }, - {0x11, 0x01, 0x0c, 0x08, "5" }, - {0x11, 0x01, 0x0c, 0x0c, "6" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x11, 0x01, 0x30, 0x00, "5000" }, - {0x11, 0x01, 0x30, 0x10, "10000" }, - {0x11, 0x01, 0x30, 0x20, "15000" }, - {0x11, 0x01, 0x30, 0x30, "None" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x40, 0x40, "Upright" }, - {0x11, 0x01, 0x40, 0x00, "Cocktail" }, -}; - -STDDIPINFO(woodpek) - -static struct BurnDIPInfo lizwizDIPList[]= -{ - {0x11, 0xff, 0xff, 0xfb, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x11, 0x01, 0x03, 0x01, "2C 1C" }, - {0x11, 0x01, 0x03, 0x03, "1C 1C" }, - {0x11, 0x01, 0x03, 0x02, "1C 2C" }, - {0x11, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x0c, 0x00, "5" }, - {0x11, 0x01, 0x0c, 0x04, "4" }, - {0x11, 0x01, 0x0c, 0x08, "3" }, - {0x11, 0x01, 0x0c, 0x0c, "2" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x11, 0x01, 0x30, 0x00, "75000" }, - {0x11, 0x01, 0x30, 0x10, "100000" }, - {0x11, 0x01, 0x30, 0x20, "125000" }, - {0x11, 0x01, 0x30, 0x30, "150000" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x11, 0x01, 0x40, 0x40, "Normal" }, - {0x11, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(lizwiz) - -static struct BurnDIPInfo vanvanDIPList[]= -{ - {0x0f, 0xff, 0xff, 0xda, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x01, 0x00, "Upright" }, - {0x0f, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip screen" }, - {0x0f, 0x01, 0x02, 0x02, "Off" }, - {0x0f, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0f, 0x01, 0x0c, 0x08, "20k and 100k" }, - {0x0f, 0x01, 0x0c, 0x04, "40k and 140k" }, - {0x0f, 0x01, 0x0c, 0x00, "70k and 200k" }, - {0x0f, 0x01, 0x0c, 0x0c, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x30, 0x30, "1" }, - {0x0f, 0x01, 0x30, 0x20, "2" }, - {0x0f, 0x01, 0x30, 0x10, "3" }, - {0x0f, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0f, 0x01, 0xc0, 0x00, "2c_1c" }, - {0x0f, 0x01, 0xc0, 0xc0, "1C_1C" }, - {0x0f, 0x01, 0xc0, 0x80, "1c_2C" }, - {0x0f, 0x01, 0xc0, 0x40, "1C_3C" }, -}; - -STDDIPINFO(vanvan) - -static struct BurnDIPInfo nmouseDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xc9, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, - {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, - {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, - {0x0e, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x0c, 0x00, "1" }, - {0x0e, 0x01, 0x0c, 0x04, "2" }, - {0x0e, 0x01, 0x0c, 0x08, "3" }, - {0x0e, 0x01, 0x0c, 0x0c, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x30, 0x00, "5000" }, - {0x0e, 0x01, 0x30, 0x10, "10000" }, - {0x0e, 0x01, 0x30, 0x20, "15000" }, - {0x0e, 0x01, 0x30, 0x30, "None" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0e, 0x01, 0x40, 0x40, "Normal" }, - {0x0e, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, - {0x0f, 0x01, 0x10, 0x10, "Off" }, - {0x0f, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x80, "Upright" }, - {0x10, 0x01, 0x80, 0x00, "Cocktail" }, -}; - -STDDIPINFO(nmouse) - -static struct BurnDIPInfo jumpshotDIPList[]= -{ - {0x10, 0xff, 0xff, 0xf1, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 3 , "Time" }, - {0x10, 0x01, 0x03, 0x02, "2 Minutes" }, - {0x10, 0x01, 0x03, 0x03, "3 Minutes" }, - {0x10, 0x01, 0x03, 0x01, "4 Minutes" }, - - {0 , 0xfe, 0 , 4 , "Player Skin Tone" }, - {0x10, 0x01, 0x04, 0x04, "Lighter" }, - {0x10, 0x01, 0x04, 0x00, "Darker" }, - - {0 , 0xfe, 0 , 4 , "Player Skin Tone" }, - {0x10, 0x01, 0x08, 0x08, "Lighter" }, - {0x10, 0x01, 0x08, 0x00, "Darker" }, - - {0 , 0xfe, 0 , 2 , "Free play" }, - {0x10, 0x01, 0x10, 0x10, "Off" }, - {0x10, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "2 Players Game" }, - {0x10, 0x01, 0x20, 0x20, "1 Credit" }, - {0x10, 0x01, 0x20, 0x00, "2 Credits" }, -}; - -STDDIPINFO(jumpshot) - -static struct BurnDIPInfo jumpshtpDIPList[]= -{ - {0x10, 0xff, 0xff, 0xf1, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 3 , "Time" }, - {0x10, 0x01, 0x03, 0x02, "Short" }, - {0x10, 0x01, 0x03, 0x03, "Average" }, - {0x10, 0x01, 0x03, 0x01, "Above Average" }, - - {0 , 0xfe, 0 , 4 , "Player Skin Tone" }, - {0x10, 0x01, 0x04, 0x04, "Lighter" }, - {0x10, 0x01, 0x04, 0x00, "Darker" }, - - {0 , 0xfe, 0 , 4 , "Player Skin Tone" }, - {0x10, 0x01, 0x08, 0x08, "Lighter" }, - {0x10, 0x01, 0x08, 0x00, "Darker" }, - - {0 , 0xfe, 0 , 2 , "Free play" }, - {0x10, 0x01, 0x10, 0x10, "Off" }, - {0x10, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "2 Players Game" }, - {0x10, 0x01, 0x20, 0x20, "1 Credit" }, - {0x10, 0x01, 0x20, 0x00, "2 Credits" }, -}; - -STDDIPINFO(jumpshtp) - -static struct BurnDIPInfo dremshprDIPList[]= -{ - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xfe, NULL }, - {0x0f, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x01, 0x01, "Upright" }, - {0x0f, 0x01, 0x01, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x20, 0x20, "Off" }, - {0x0f, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0f, 0x01, 0x0c, 0x08, "30000" }, - {0x0f, 0x01, 0x0c, 0x04, "50000" }, - {0x0f, 0x01, 0x0c, 0x00, "70000" }, - {0x0f, 0x01, 0x0c, 0x0c, "none" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x30, 0x30, "3" }, - {0x0f, 0x01, 0x30, 0x20, "4" }, - {0x0f, 0x01, 0x30, 0x10, "5" }, - {0x0f, 0x01, 0x30, 0x00, "6" }, - - {0 , 0xfe, 0, 4, "Coinage" }, - {0x0f, 0x01, 0xc0, 0x00, "2C 1C" }, - {0x0f, 0x01, 0xc0, 0xc0, "1C 1C" }, - {0x0f, 0x01, 0xc0, 0x80, "1C 2C" }, - {0x0f, 0x01, 0xc0, 0x40, "1C 3C" }, -}; - -STDDIPINFO(dremshpr) - -static struct BurnDIPInfo cannonbpDIPList[]= -{ - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Display" }, - {0x0f, 0x01, 0x03, 0x03, "Scores and Progression Bars" }, - {0x0f, 0x01, 0x03, 0x01, "Scores only" }, - {0x0f, 0x01, 0x03, 0x02, "Progression Bars only" }, - {0x0f, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x04, 0x04, "Upright" }, - {0x0f, 0x01, 0x04, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x18, 0x00, "3" }, - {0x0f, 0x01, 0x18, 0x08, "4" }, - {0x0f, 0x01, 0x18, 0x10, "5" }, - {0x0f, 0x01, 0x18, 0x18, "6" }, -}; - -STDDIPINFO(cannonbp) - -static struct BurnDIPInfo rocktrv2DIPList[]= -{ - {0x0e, 0xff, 0x3f, 0x33, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, - {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, - {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, - {0x0e, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8 , "Questions Per Game" }, - {0x0e, 0x01, 0x1c, 0x1c, "2" }, - {0x0e, 0x01, 0x1c, 0x18, "3" }, - {0x0e, 0x01, 0x1c, 0x14, "4" }, - {0x0e, 0x01, 0x1c, 0x10, "5" }, - {0x0e, 0x01, 0x1c, 0x0c, "6" }, - {0x0e, 0x01, 0x1c, 0x08, "7" }, - {0x0e, 0x01, 0x1c, 0x04, "8" }, - {0x0e, 0x01, 0x1c, 0x00, "9" }, - - {0 , 0xfe, 0 , 4 , "Clock Speed" }, - {0x0e, 0x01, 0x60, 0x60, "Beginner" }, - {0x0e, 0x01, 0x60, 0x40, "Intermediate" }, - {0x0e, 0x01, 0x60, 0x20, "Professional" }, - {0x0e, 0x01, 0x60, 0x00, "Super - Pro" }, - - {0 , 0xfe, 0 , 2 , "Freeze Image" }, - {0x0e, 0x01, 0x80, 0x80, "Off" }, - {0x0e, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Mode" }, - {0x0f, 0x01, 0x01, 0x01, "Amusement" }, - {0x0f, 0x01, 0x01, 0x00, "Credit" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x02, 0x02, "Upright" }, - {0x0f, 0x01, 0x02, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "K.O. Switch" }, - {0x0f, 0x01, 0x04, 0x04, "Auto" }, - {0x0f, 0x01, 0x04, 0x00, "Manual" }, - - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x0f, 0x01, 0x70, 0x70, "10000" }, - {0x0f, 0x01, 0x70, 0x60, "17500" }, - {0x0f, 0x01, 0x70, 0x50, "25000" }, - {0x0f, 0x01, 0x70, 0x40, "32500" }, - {0x0f, 0x01, 0x70, 0x30, "40000" }, - {0x0f, 0x01, 0x70, 0x20, "47500" }, - {0x0f, 0x01, 0x70, 0x10, "55000" }, - {0x0f, 0x01, 0x70, 0x00, "62500" }, - - {0 , 0xfe, 0 , 2 , "Music" }, - {0x0f, 0x01, 0x80, 0x80, "On" }, - {0x0f, 0x01, 0x80, 0x00, "Off" }, -}; - -STDDIPINFO(rocktrv2) - -static struct BurnDIPInfo bigbucksDIPList[]= -{ - {0x0c, 0xff, 0xff, 0xff, NULL }, - {0x0d, 0xff, 0xff, 0xff, NULL }, - {0x0e, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Enable Adult Affairs Category" }, - {0x0c, 0x01, 0x10, 0x00, "Off" }, - {0x0c, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Time to bet / answer" }, - {0x0d, 0x01, 0x01, 0x00, "15 sec. / 10 sec." }, - {0x0d, 0x01, 0x01, 0x01, "20 sec. / 15 sec." }, - - {0 , 0xfe, 0 , 2 , "Continue if player busts"}, - {0x0d, 0x01, 0x02, 0x00, "Off" }, - {0x0d, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Show correct answer" }, - {0x0d, 0x01, 0x04, 0x00, "Off" }, - {0x0d, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x08, 0x00, "Off" }, - {0x0d, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0d, 0x01, 0x10, 0x00, "2C 1C" }, - {0x0d, 0x01, 0x10, 0x10, "1C 1C" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x20, 0x20, "Upright" }, - {0x0d, 0x01, 0x20, 0x00, "Cocktail" }, -}; - -STDDIPINFO(bigbucks) - -static struct BurnDIPInfo korosukeDIPList[]= -{ - {0x0f, 0xff, 0x3f, 0x31, NULL }, - {0x10, 0xff, 0xff, 0xef, NULL }, - {0x11, 0xff, 0x6f, 0x6f, NULL }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x10, 0x00, "Upright" }, - {0x10, 0x01, 0x10, 0x10, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0f, 0x01, 0x03, 0x03, "2C 1C" }, - {0x0f, 0x01, 0x03, 0x01, "1C 1C" }, - {0x0f, 0x01, 0x03, 0x02, "1C 2C" }, - {0x0f, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x0c, 0x00, "3" }, - {0x0f, 0x01, 0x0c, 0x04, "4" }, - {0x0f, 0x01, 0x0c, 0x08, "5" }, - {0x0f, 0x01, 0x0c, 0x0c, "6" }, - - {0 , 0xfe, 0 , 2 , "First Pattern" }, - {0x0f, 0x01, 0x30, 0x10, "Easy" }, - {0x0f, 0x01, 0x30, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Teleport Holes" }, - {0x0f, 0x01, 0x20, 0x20, "Off" }, - {0x0f, 0x01, 0x20, 0x00, "On" }, -}; - -STDDIPINFO(korosuke) - -static struct BurnDIPInfo shootbulDIPList[]= -{ - {0x08, 0xff, 0xff, 0xff, NULL }, - {0x09, 0xff, 0xff, 0xe0, NULL }, - {0x0A, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 5 , "Time" }, - {0x08, 0x01, 0x03, 0x01, "Short" }, - {0x08, 0x01, 0x03, 0x07, "Average" }, - {0x08, 0x01, 0x03, 0x03, "Long" }, - {0x08, 0x01, 0x03, 0x05, "Longer" }, - {0x08, 0x01, 0x03, 0x06, "Longest" }, - - {0 , 0xfe, 0 , 2 , "Title Page Sounds" }, - {0x08, 0x01, 0x08, 0x00, "Off" }, - {0x08, 0x01, 0x08, 0x08, "On" }, -}; - -STDDIPINFO(shootbul) - -//------------------------------------------------------------------------------------------------------ - -static void mschamp_set_bank() -{ - nPacBank = DrvDips[3] & 1; - - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM + 0x0000 + (nPacBank * 0x08000)); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM + 0x0000 + (nPacBank * 0x08000)); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x4000 + (nPacBank * 0x08000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x4000 + (nPacBank * 0x08000)); -} - -static void epos_hardware_set_bank(INT32 nBank) -{ - nPacBank = nBank & 3; - - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM + 0x10000 + (nPacBank * 0x04000)); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM + 0x10000 + (nPacBank * 0x04000)); -} - -static UINT8 cannonbp_protection_r(UINT16 offset) -{ - switch (offset) - { - case 0x0004: - cannonb_bit_to_read = 7; - case 0x0000: - case 0x0003: - case 0x0012: - case 0x0105: - return 0x00; - - case 0x0001: - if (ZetPc(-1) == 0x2b97) - return ((0x46 >> (cannonb_bit_to_read--)) & 1) << 7; - else - return 0xff; - - case 0x0107: - return 0x40; - } - - return 0; -} - -static UINT8 epos_hardware_decrypt_rom(UINT16 offset) -{ - if (offset & 0x01) - { - epos_hardware_counter = epos_hardware_counter - 1; - if (epos_hardware_counter < 0) - epos_hardware_counter = 0x0f; - } - else - { - epos_hardware_counter = (epos_hardware_counter + 1) & 0x0f; - } - - if (epos_hardware_counter >= 0x08 && epos_hardware_counter <= 0x0b) { - epos_hardware_set_bank(epos_hardware_counter); - } - - return 0; -} - -static UINT8 maketrax_special_port2_r(UINT16 offset) // and korosuke -{ - INT32 data = DrvDips[2]; - INT32 pc = ZetPc(-1); - - if (pc == 0x1973 || pc == 0x2389 || pc == 0x196e || pc == 0x2387) return data | 0x40; - - switch (offset) - { - case 0x01: - case 0x04: data |= 0x40; break; - case 0x05: data |= 0xc0; break; - - default: data &= 0x3f; break; - } - - return data; -} - -static UINT8 maketrax_special_port3_r(UINT16 offset) -{ - INT32 pc = ZetPc(-1); - - if (pc == 0x040e || pc == 0x0445) return 0x20; - if (pc == 0x115e || pc == 0x3ae2 || pc == 0x115b || pc == 0x3ae6) return 0x00; - - switch (offset) - { - case 0x00: return 0x1f; - case 0x09: return 0x30; - case 0x0c: return 0x00; - - default: return 0x20; - } -} - -UINT8 __fastcall pacman_read(UINT16 a) -{ - switch (game_select) - { - case ALIBABA: - { - if (a == 0x50c0) return rand() & 0xff; - if (a == 0x50c1) { - alibaba_mystery++; - return (alibaba_mystery >> 10) & 1; - } - } - break; - - case CANNONBP: - { - if ((a & 0xf000) == 0x3000) return cannonbp_protection_r(a & 0xfff); - } - break; - - case MAKETRAX: - { - if ((a & 0xffc0) == 0x5080) return maketrax_special_port2_r(a & 0x3f); - if ((a & 0xffc0) == 0x50c0) return maketrax_special_port3_r(a & 0x3f); - } - break; - - case CRUSHS: - { - if (a == 0x5080) return DrvInputs[1]; - } - break; - - case ROCKTRV2: - { - if ((a & 0xfff0) == 0x5fe0) return (rocktrv2_prot_data[(a >> 2) & 3] >> 4); - - if (a == 0x5fff) return DrvDips[3]; - - if ((a & 0x8000) == 0x8000) return DrvQROM[(a & 0x7fff) | (nPacBank * 0x8000)]; - } - break; - } - - switch (a & ~0x003f) - { - case 0x5000: return DrvInputs[0]; - case 0x5040: return DrvInputs[1]; - case 0x5080: return DrvDips[2]; - case 0x50c0: return DrvDips[3]; - } - - if ((a & 0xfc00) == 0x4800) return 0xbf; - - return 0; -} - -void __fastcall pacman_write(UINT16 a, UINT8 d) -{ - switch (game_select) - { - case BIRDIY: - { - if ((a & 0xffe0) == 0x5080) a -= 0x0040; - if ((a & 0xfff0) == 0x50a0) a -= 0x0040; - if (a == 0x5000) return; - if (a == 0x5001) interrupt_mask = d & 1; - } - break; - - case ALIBABA: - { - if (a == 0x50c2) { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - interrupt_mask = d; - return; - } - - if ((a & 0xfff0) == 0x5040) { - NamcoSoundWrite((a & 0x0f) | 0x00, d); - return; - } - - if ((a & 0xfff0) == 0x5060) { - NamcoSoundWrite((a & 0x0f) | 0x10, d); - return; - } - - if ((a & 0xfff0) == 0x5050) { - DrvSprRAM2[a & 0x0f] = d; - return; - } - - if (a == 0x5000) { - watchdog = 0; - return; - } - } - break; - - case ROCKTRV2: - { - if ((a & 0xfffc) == 0x5fe0) { - rocktrv2_prot_data[a & 3] = d; - return; - } - - if (a == 0x5ff0) { - nPacBank = d; - return; - } - } - break; - - case VANVAN: - { - if (a == 0x5001) { - for (INT32 i = 0; i < 0x100; i++) { - if (DrvColPROM[0x100 + i] == 0) { - Palette[i] = (d & 1) ? BurnHighCol(0xaa, 0xaa, 0xaa, 0) : 0; - } - } - return; - } - } - break; - - case BIGBUCKS: - if (a == 0x6000) { - nPacBank = d; - return; - } - break; - } - - if ((a & 0xffe0) == 0x5040) { - NamcoSoundWrite(a & 0x1f, d); - return; - } - - if ((a & 0xfff0) == 0x5060) { - DrvSprRAM2[a & 0x0f] = d; - return; - } - - switch (a) - { - case 0x5000: - interrupt_mask = d & 1; - break; - - case 0x5001: - // pacman_sound_enable_w - break; - - case 0x5003: - *flipscreen = d & 1; - break; - - case 0x5002:// nop - case 0x5007:// coin counter - break; - - case 0x50c0: - watchdog = 0; - break; - } -} - -UINT8 __fastcall pacman_in_port(UINT16 a) -{ - if (game_select == BIGBUCKS) { - return DrvQROM[(nPacBank << 16) | (a ^ 0xffff)]; - } - - a &= 0xff; - - switch (game_select) - { - case CRUSHS: - if (a == 1) return DrvDips[3]; - if (a == 2) return DrvDips[2]; - return 0; - - case EPOS: - return epos_hardware_decrypt_rom(a); - - case MSCHAMP: - if (a == 0) return mschamp_counter++; - return 0; - } - - return 0; -} - -void __fastcall pacman_out_port(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (game_select) - { - case CRUSHS: - if (a == 0 || a == 1) { - AY8910Write(0, ~a & 1, d); - } - return; - - case DREMSHPR: - if (a == 6 || a == 7) { - AY8910Write(0, ~a & 1, d); - } - return; - - case VANVAN: - if (a == 1 || a == 2) { - SN76496Write(a - 1, d); - } - return; - - case PIRANHA: - if (a == 0) { - if (d == 0xfa) d = 0x78; - interrupt_mode = d; - } - return; - - case NMOUSE: - if (a == 0) { - if (d == 0xbf) d = 0x3c; - if (d == 0xc6) d = 0x40; - interrupt_mode = d; - } - return; - } - - if (a == 0) // pacman & clones only - { - interrupt_mode = d; - ZetSetVector(d); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -UINT8 __fastcall mspacman_read(UINT16 a) -{ - if ((a < 0x4000) || (a >= 0x8000 && a <= 0xbfff)) - { - if ((a >= 0x0038 && a <= 0x003f) | - (a >= 0x03b0 && a <= 0x03b7) | - (a >= 0x1600 && a <= 0x1607) | - (a >= 0x2120 && a <= 0x2127) | - (a >= 0x3ff0 && a <= 0x3ff7) | - (a >= 0x8000 && a <= 0x8007) | - (a >= 0x97f0 && a <= 0x97f7)) - { - nPacBank = 0; - } - - if (a >= 0x3ff8 && a <= 0x3fff) { - nPacBank = 1; - } - - return DrvZ80ROM[(nPacBank << 16) + a]; - } - - if ((a & 0xfc00) == 0x4800) return 0xbf; // unmapped read - - if ((a & 0xff00) == 0x5000) a &= ~0x003f; - - switch (a) - { - case 0x5000: return DrvInputs[0]; - case 0x5040: return DrvInputs[1]; - case 0x5080: return DrvDips[2]; - case 0x50c0: return DrvDips[3]; - } - - return 0; -} - -void __fastcall mspacman_write(UINT16 a, UINT8 d) -{ - if ((a >= 0x0038 && a <= 0x003f) | - (a >= 0x03b0 && a <= 0x03b7) | - (a >= 0x1600 && a <= 0x1607) | - (a >= 0x2120 && a <= 0x2127) | - (a >= 0x3ff0 && a <= 0x3ff7) | - (a >= 0x8000 && a <= 0x8007) | - (a >= 0x97f0 && a <= 0x97f7)) - { - nPacBank = 0; - } - - if (a >= 0x3ff8 && a <= 0x3fff) { - nPacBank = 1; - } - - if ((a & 0xffe0) == 0x5040) { - NamcoSoundWrite(a & 0x1f, d); - return; - } - - if ((a & 0xfff0) == 0x5060) { - DrvSprRAM2[a & 0x0f] = d; - return; - } - - switch (a) - { - case 0x5000: - interrupt_mask = d & 1; - break; - - case 0x5001: - // pacman_sound_enable_w - break; - - case 0x5003: - *flipscreen = d & 1; - break; - - case 0x5002: // nop - case 0x5004: - case 0x5005: // leds - case 0x5006: // coin lockout - case 0x5007: // coin counter - case 0x5080: // nop - return; - - case 0x50c0: - watchdog = 0; - break; - } -} - -void __fastcall pengo_write(UINT16 a, UINT8 d) -{ - if ((a & 0xffe0) == 0x9000) { - NamcoSoundWrite(a & 0x1f, d); - return; - } - - if ((a & 0xfff0) == 0x9020) { - DrvSprRAM2[a & 0x0f] = d; - return; - } - - switch (a) - { - case 0x9040: - interrupt_mask = d & 1; - return; - - case 0x9042: - palettebank = d; - return; - - case 0x9043: - *flipscreen = d & 1; - return; - - case 0x9044: - case 0x9045: // coin counter - return; - - case 0x9046: - colortablebank = d; - return; - - case 0x9047: - charbank = d & 1; - spritebank = d & 1; - return; - - case 0x9070: - watchdog = 0; - return; - } -} - -UINT8 __fastcall pengo_read(UINT16 a) -{ - switch (a & ~0x003f) - { - case 0x9000: return DrvDips[3]; - case 0x9040: return DrvDips[2]; - case 0x9080: return DrvInputs[1]; - case 0x90c0: return DrvInputs[0]; - } - - return 0; -} - -//------------------------------------------------------------------------------------------------------ - -static INT32 DrvDoReset(INT32 clear_ram) -{ - if (clear_ram) { - memset (AllRam, 0, RamEnd - AllRam); - } - - watchdog = 0; - nPacBank = 0; - - ZetOpen(0); - ZetReset(); - - switch (game_select) - { - case EPOS: - epos_hardware_counter = 0x0A + acitya; - epos_hardware_set_bank(epos_hardware_counter); - break; - - case MSCHAMP: - mschamp_set_bank(); - break; - } - - ZetClose(); - - AY8910Reset(0); - - mschamp_counter = 0; - cannonb_bit_to_read = 0; - alibaba_mystery = 0; - - interrupt_mode = 0; - interrupt_mask = 0; - colortablebank = 0; - palettebank = 0; - spritebank = 0; - charbank = 0; - - return 0; -} - -static void DrvTransTableInit() -{ - for (INT32 i = 0; i < 0x100; i++) { - DrvTransTable[i] = (DrvColPROM[(i & 0xff) + 0x100] & 0x0f) ? 1 : 0; - } -} - -static void pacman_palette_init() -{ - UINT32 t_pal[32]; - - for (INT32 i = 0; i < 32; i++) - { - INT32 bit0 = (DrvColPROM[i] >> 0) & 0x01; - INT32 bit1 = (DrvColPROM[i] >> 1) & 0x01; - INT32 bit2 = (DrvColPROM[i] >> 2) & 0x01; - UINT8 r = (bit0 * 33) + (bit1 * 71) + (bit2 * 151); - - bit0 = (DrvColPROM[i] >> 3) & 0x01; - bit1 = (DrvColPROM[i] >> 4) & 0x01; - bit2 = (DrvColPROM[i] >> 5) & 0x01; - UINT8 g = (bit0 * 33) + (bit1 * 71) + (bit2 * 151); - - bit0 = (DrvColPROM[i] >> 6) & 0x01; - bit1 = (DrvColPROM[i] >> 7) & 0x01; - UINT8 b = (bit0 * 81) + (bit1 * 174); - - t_pal[i] = BurnHighCol(r, g, b, 0); - } - - for (INT32 i = 0; i < 256; i++) - { - UINT8 ctabentry = DrvColPROM[i + 0x100] & 0x0f; - - Palette[0x000 + i] = t_pal[ctabentry + 0x00]; - Palette[0x100 + i] = t_pal[ctabentry + 0x10]; - } - - DrvRecalc = 1; -} - -static void convert_gfx() -{ - static INT32 PlaneOffsets[2] = { 0, 4 }; - static INT32 CharXOffsets[8] = { 64, 65, 66, 67, 0, 1, 2, 3 }; - static INT32 SpriXOffsets[16] = { 8*8, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3, 0, 1, 2, 3 }; - static INT32 YOffsets[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 }; - - INT32 size = (game_select == PENGO) ? 0x2000 : 0x1000; - - UINT8 *tmp = (UINT8*)BurnMalloc( size * 2 ); - - if (tmp) - { - memcpy (tmp, DrvGfxROM, size * 2); - - GfxDecode(((size * 4) / 0x040), 2, 8, 8, PlaneOffsets, CharXOffsets + 0, YOffsets, 0x080, tmp, DrvGfxROM + 0x0000); - GfxDecode(((size * 4) / 0x100), 2, 16, 16, PlaneOffsets, SpriXOffsets + 0, YOffsets, 0x200, tmp + size, DrvGfxROM + 0x8000); - } - - BurnFree (tmp); -} - -static INT32 pacman_load() -{ - char* pRomName; - struct BurnRomInfo ri; - - INT32 pOffset = 0; - UINT8 *gLoad = DrvGfxROM; - UINT8 *cLoad = DrvColPROM; - UINT8 *sLoad = NamcoSoundProm; - UINT8 *qLoad = DrvQROM; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & 7) == 1) { - if (BurnLoadRom(DrvZ80ROM + pOffset, i, 1)) return 1; - - if (game_select == MSPACMAN) { - pOffset += 0x1000; - } else { - pOffset += ri.nLen; - } - - if (pOffset == 0x4000 && game_select != PENGO) { - pOffset = 0x8000; - } - - continue; - } - - if ((ri.nType & 7) == 2) { - if (BurnLoadRom(gLoad, i, 1)) return 1; - gLoad += ri.nLen; - - continue; - } - - if ((ri.nType & 7) == 3) { - if (BurnLoadRom(cLoad, i, 1)) return 1; - cLoad += 0x100; - - continue; - } - - if ((ri.nType & 7) == 4) { - if (BurnLoadRom(sLoad, i, 1)) return 1; - sLoad += 0x100; - - continue; - } - - if ((ri.nType & 7) == 7) { - if (BurnLoadRom(qLoad, i, 1)) return 1; - qLoad += ri.nLen; - - continue; - } - } - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x020000; - - DrvQROM = Next; - if (game_select == BIGBUCKS) Next += 0x060000; - if (game_select == ROCKTRV2) Next += 0x040000; - - DrvGfxROM = Next; Next += 0x010000; - - DrvColPROM = Next; Next += 0x000500; - NamcoSoundProm = Next; Next += 0x000200; - - DrvTransTable = Next; Next += 0x000200; - - Palette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x001000; - - DrvSprRAM = DrvZ80RAM + ((game_select == ALIBABA) ? 0x6f0 : 0x7f0); - DrvSprRAM2 = Next; Next += 0x000010; - - DrvColRAM = Next; Next += 0x000400; - DrvVidRAM = Next; Next += 0x000400; - - rocktrv2_prot_data = Next; Next += 0x000004; - - flipscreen = Next; Next += 0x000001; - - RamEnd = Next; - - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static void StandardMap() -{ - for (INT32 i = 0; i <= 0x8000; i += 0x8000)// mirror - { - ZetMapArea(0x0000 + i, 0x3fff + i, 0, DrvZ80ROM); - ZetMapArea(0x0000 + i, 0x3fff + i, 2, DrvZ80ROM); - - for (INT32 j = 0; j <= 0x2000; j+= 0x2000) // mirrors - { - ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 0, DrvVidRAM); - ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 1, DrvVidRAM); - ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 2, DrvVidRAM); - ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 0, DrvColRAM); - ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 1, DrvColRAM); - ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 2, DrvColRAM); - ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 0, DrvZ80RAM + 0x0400); - ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 1, DrvZ80RAM + 0x0400); - ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 2, DrvZ80RAM + 0x0400); - } - } - - ZetSetWriteHandler(pacman_write); - ZetSetReadHandler(pacman_read); - ZetSetOutHandler(pacman_out_port); - ZetSetInHandler(pacman_in_port); -} - -static void CannonbpMap() -{ - for (INT32 i = 0; i <= 0x8000; i += 0x8000) { // mirror - - ZetMapArea(0x0000 + i, 0x2fff + i, 0, DrvZ80ROM); - ZetMapArea(0x0000 + i, 0x2fff + i, 2, DrvZ80ROM); - - for (INT32 j = 0; j <= 0x2000; j+= 0x2000) { // mirrors - ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 0, DrvVidRAM); - ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 1, DrvVidRAM); - ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 2, DrvVidRAM); - ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 0, DrvColRAM); - ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 1, DrvColRAM); - ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 2, DrvColRAM); - ZetMapArea(0x4800 + i + j, 0x4bff + i + j, 0, DrvZ80RAM + 0x0000); - ZetMapArea(0x4800 + i + j, 0x4bff + i + j, 1, DrvZ80RAM + 0x0000); - ZetMapArea(0x4800 + i + j, 0x4bff + i + j, 2, DrvZ80RAM + 0x0000); - ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 0, DrvZ80RAM + 0x0400); - ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 1, DrvZ80RAM + 0x0400); - ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 2, DrvZ80RAM + 0x0400); - } - } - - ZetSetWriteHandler(pacman_write); - ZetSetReadHandler(pacman_read); - ZetSetOutHandler(pacman_out_port); - ZetSetInHandler(pacman_in_port); -} - -static void DremshprMap() // and vanvan -{ - CannonbpMap(); - - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x8000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x8000); -} - -static void WoodpekMap() -{ - StandardMap(); - - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x8000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x8000); -} - -static void Rocktrv2Map() -{ - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM); - ZetMapArea(0x4000, 0x43ff, 0, DrvVidRAM); - ZetMapArea(0x4000, 0x43ff, 1, DrvVidRAM); - ZetMapArea(0x4000, 0x43ff, 2, DrvVidRAM); - ZetMapArea(0x4400, 0x47ff, 0, DrvColRAM); - ZetMapArea(0x4400, 0x47ff, 1, DrvColRAM); - ZetMapArea(0x4400, 0x47ff, 2, DrvColRAM); - ZetMapArea(0x4c00, 0x4fff, 0, DrvZ80RAM + 0x0400); - ZetMapArea(0x4c00, 0x4fff, 1, DrvZ80RAM + 0x0400); - ZetMapArea(0x4c00, 0x4fff, 2, DrvZ80RAM + 0x0400); - - ZetMapArea(0x6000, 0x7fff, 0, DrvZ80ROM + 0x8000); - ZetMapArea(0x6000, 0x7fff, 2, DrvZ80ROM + 0x8000); - - ZetSetWriteHandler(pacman_write); - ZetSetReadHandler(pacman_read); - ZetSetOutHandler(pacman_out_port); - ZetSetInHandler(pacman_in_port); -} - -static void BigbucksMap() -{ - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM); - ZetMapArea(0x4000, 0x43ff, 0, DrvVidRAM); - ZetMapArea(0x4000, 0x43ff, 1, DrvVidRAM); - ZetMapArea(0x4000, 0x43ff, 2, DrvVidRAM); - ZetMapArea(0x4400, 0x47ff, 0, DrvColRAM); - ZetMapArea(0x4400, 0x47ff, 1, DrvColRAM); - ZetMapArea(0x4400, 0x47ff, 2, DrvColRAM); - ZetMapArea(0x4c00, 0x4fff, 0, DrvZ80RAM + 0x0400); - ZetMapArea(0x4c00, 0x4fff, 1, DrvZ80RAM + 0x0400); - ZetMapArea(0x4c00, 0x4fff, 2, DrvZ80RAM + 0x0400); - - ZetMapArea(0x8000, 0x9fff, 0, DrvZ80ROM + 0x8000); - ZetMapArea(0x8000, 0x9fff, 2, DrvZ80ROM + 0x8000); - - ZetSetWriteHandler(pacman_write); - ZetSetReadHandler(pacman_read); - ZetSetOutHandler(pacman_out_port); - ZetSetInHandler(pacman_in_port); -} - -static void AlibabaMap() -{ - StandardMap(); - - ZetMapArea(0x8000, 0x8fff, 0, DrvZ80ROM + 0x8000); - ZetMapArea(0x8000, 0x8fff, 2, DrvZ80ROM + 0x8000); - - for (INT32 i = 0; i < 0x1000; i+= 0x400) { - ZetMapArea(0x9000 + i, 0x93ff + i, 0, DrvZ80RAM + 0x0000); - ZetMapArea(0x9000 + i, 0x93ff + i, 1, DrvZ80RAM + 0x0000); - ZetMapArea(0x9000 + i, 0x93ff + i, 2, DrvZ80RAM + 0x0000); - } - - for (INT32 i = 0x0000; i < 0x2000; i += 0x0800) { - ZetMapArea(0xa000 + i, 0xa7ff + i, 0, DrvZ80ROM + 0xa000); - ZetMapArea(0xa000 + i, 0xa7ff + i, 2, DrvZ80ROM + 0xa000); - } -} - -static void PengoMap() -{ - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); -// ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM + 0x8000, DrvZ80ROM); - ZetMapArea(0x8000, 0x83ff, 0, DrvVidRAM); - ZetMapArea(0x8000, 0x83ff, 1, DrvVidRAM); - ZetMapArea(0x8000, 0x83ff, 2, DrvVidRAM); - ZetMapArea(0x8400, 0x87ff, 0, DrvColRAM); - ZetMapArea(0x8400, 0x87ff, 1, DrvColRAM); - ZetMapArea(0x8400, 0x87ff, 2, DrvColRAM); - ZetMapArea(0x8800, 0x8fff, 0, DrvZ80RAM); - ZetMapArea(0x8800, 0x8fff, 1, DrvZ80RAM); - ZetMapArea(0x8800, 0x8fff, 2, DrvZ80RAM); - - ZetSetWriteHandler(pengo_write); - ZetSetReadHandler(pengo_read); -} - -static void MspacmanMap() -{ - for (INT32 i = 0; i <= 0x8000; i += 0x8000)// mirror - { - for (INT32 j = 0; j <= 0x2000; j+= 0x2000) // mirrors - { - ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 0, DrvVidRAM); - ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 1, DrvVidRAM); - ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 2, DrvVidRAM); - ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 0, DrvColRAM); - ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 1, DrvColRAM); - ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 2, DrvColRAM); - ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 0, DrvZ80RAM + 0x0400); - ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 1, DrvZ80RAM + 0x0400); - ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 2, DrvZ80RAM + 0x0400); - } - } - - ZetSetWriteHandler(mspacman_write); - ZetSetReadHandler(mspacman_read); - ZetSetOutHandler(pacman_out_port); -} - -static INT32 DrvInit(void (*mapCallback)(), void (*pInitCallback)(), INT32 select) -{ - game_select = select; - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (pacman_load()) return 1; - - if (pInitCallback) { - pInitCallback(); - } - - convert_gfx(); - pacman_palette_init(); - DrvTransTableInit(); - - ZetInit(0); - ZetOpen(0); - mapCallback(); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 1789750, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.75, BURN_SND_ROUTE_BOTH); - if (game_select == DREMSHPR) AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - - SN76496Init(0, 1789750, 0); - SN76496Init(1, 1789750, 1); - SN76496SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 0.75, BURN_SND_ROUTE_BOTH); - - NamcoSoundInit(18432000 / 6 / 32, 3); - NacmoSoundSetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(1); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - - AY8910Exit(0); - SN76496Exit(); - NamcoSoundExit(); - - game_select = PACMAN; - acitya = 0; - - nPacBank = -1; - - BurnFree (AllMem); - - return 0; -} - -static void DrawBackground() -{ - for (INT32 offs = 0; offs < 36 * 28; offs++) - { - INT32 sx = (offs % 36); - INT32 sy = offs / 36; - - INT32 row = sy + 2; - INT32 col = sx - 2; - - INT32 ofst; - - if (col & 0x20) - ofst = row + ((col & 0x1f) << 5); - else - ofst = col + (row << 5); - - INT32 code = (charbank << 8) | DrvVidRAM[ofst]; - INT32 color = (DrvColRAM[ofst] & 0x1f) | (colortablebank << 5) | (palettebank << 6); - - if (*flipscreen) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, (272 - (sx * 8)) + 8, (224 - (sy * 8)) - 8, color, 2, 0, DrvGfxROM); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx * 8, sy * 8, color, 2, 0, DrvGfxROM); - } - } -} - -static void DrawSprites() -{ - for (INT32 offs = 0x10 - 2;offs >= 0;offs -= 2) - { - INT32 code = (DrvSprRAM[offs] >> 2) | (spritebank << 6); - INT32 color = (DrvSprRAM[offs + 1] & 0x1f ) | (colortablebank << 5) | (palettebank << 6); - - INT32 sx = DrvSprRAM2[offs + 1]; - INT32 sy = DrvSprRAM2[offs]; - INT32 flipx = DrvSprRAM [offs] & 1; - INT32 flipy = DrvSprRAM [offs] & 2; - - if (*flipscreen) { - sy = (240 - sy) - 8; - sx += 8; - flipy = !flipy; - flipx = !flipx; - } else { - sx = 272 - sx; - sy = sy - 31; - } - - RenderTileTranstab(pTransDraw, DrvGfxROM + 0x8000, code, color << 2, 0, sx, sy, flipx, flipy, 16, 16, DrvTransTable); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - pacman_palette_init(); - DrvRecalc = 0; - } - - DrawBackground(); - DrawSprites(); - - BurnTransferCopy(Palette); - - return 0; -} - -static INT32 DrvFrame() -{ - watchdog++; - if (watchdog >= 16) { - bprintf (0, _T("watchdog triggered\n")); - DrvDoReset(0); - } - - if (DrvReset) { - DrvDoReset(1); - } - - { - memset (DrvInputs, 0, 2); - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - - if (!acitya && game_select != SHOOTBUL) { - if ((DrvInputs[0] & 6) == 6) DrvInputs[0] &= ~0x06; - if ((DrvInputs[0] & 9) == 9) DrvInputs[0] &= ~0x09; - if ((DrvInputs[1] & 6) == 6) DrvInputs[1] &= ~0x06; - if ((DrvInputs[1] & 9) == 9) DrvInputs[1] &= ~0x09; - } - - DrvInputs[0] ^= DrvDips[0]; - DrvInputs[1] ^= DrvDips[1]; - - nAnalogAxis[0] -= DrvAxis[0]; - nAnalogAxis[1] -= DrvAxis[1]; - - nCharAxis[0] = (DrvAxis[0] >> 12) & 0x0f; - nCharAxis[1] = (DrvAxis[1] >> 12) & 0x0f; - - if (game_select == SHOOTBUL) { - DrvInputs[0] ^= nCharAxis[0]; - DrvInputs[1] ^= nCharAxis[1]; - } - } - - ZetOpen(0); - - INT32 nInterleave = nBurnSoundLen; - INT32 nSoundBufferPos = 0; - - INT32 nCyclesTotal = (18432000 / 6) / 60; - INT32 nCyclesDone = 0; - INT32 nCyclesSegment; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext; - - nNext = (i + 1) * nCyclesTotal / nInterleave; - nCyclesSegment = nNext - nCyclesDone; - nCyclesDone += ZetRun(nCyclesSegment); - - if (game_select == BIGBUCKS) { - INT32 nInterleaveIRQFire = nBurnSoundLen / 20; - for (INT32 j = 0; j < 20; j++) { - if (i == (nInterleaveIRQFire * j) - 1) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - } else { - if (game_select == DREMSHPR || game_select == VANVAN) { - if (i == (nInterleave - 1)) ZetNmi(); - } else { - if (i == (nInterleave - 1) && interrupt_mask) { - ZetSetVector(interrupt_mode); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - if (game_select == DREMSHPR || game_select == CRUSHS) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } else { - if (game_select == VANVAN) { - SN76496Update(0, pSoundBuf, nSegmentLength); - SN76496Update(1, pSoundBuf, nSegmentLength); - } else { - NamcoSoundUpdate(pSoundBuf, nSegmentLength); - } - } - } - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - if (game_select == DREMSHPR || game_select == CRUSHS) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } else { - if (game_select == VANVAN) { - SN76496Update(0, pSoundBuf, nSegmentLength); - SN76496Update(1, pSoundBuf, nSegmentLength); - } else { - NamcoSoundUpdate(pSoundBuf, nSegmentLength); - } - } - } - } - - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -//------------------------------------------------------------------------------------------------------ - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029693; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - NamcoSoundScan(nAction, pnMin); - AY8910Scan(nAction, pnMin); - SN76496Scan(nAction, pnMin); - - SCAN_VAR(nPacBank); - - SCAN_VAR(interrupt_mode); - SCAN_VAR(interrupt_mask); - - SCAN_VAR(colortablebank); - SCAN_VAR(palettebank); - SCAN_VAR(spritebank); - SCAN_VAR(charbank); - - SCAN_VAR(alibaba_mystery); - SCAN_VAR(epos_hardware_counter); - SCAN_VAR(mschamp_counter); - SCAN_VAR(cannonb_bit_to_read); - } - - if (nAction & ACB_WRITE) { - if (game_select == MSCHAMP) { - mschamp_set_bank(); - } - - if (game_select == EPOS) { - epos_hardware_set_bank(nPacBank); - } - } - - return 0; -} - - -//------------------------------------------------------------------------------------------------------ - - -// PuckMan (Japan set 1, Probably Bootleg) - -static struct BurnRomInfo puckmanRomDesc[] = { - { "namcopac.6e", 0x1000, 0xfee263b3, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "namcopac.6f", 0x1000, 0x39d1fc83, 1 | BRF_ESS | BRF_PRG }, // 1 - { "namcopac.6h", 0x1000, 0x02083b03, 1 | BRF_ESS | BRF_PRG }, // 2 - { "namcopac.6j", 0x1000, 0x7a36fe55, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics - { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(puckman) -STD_ROM_FN(puckman) - -static INT32 puckmanInit() -{ - return DrvInit(StandardMap, NULL, PACMAN); -} - -struct BurnDriver BurnDrvpuckman = { - "puckman", NULL, NULL, NULL, "1980", - "PuckMan (Japan set 1, Probably Bootleg)\0", NULL, "Namco", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, puckmanRomInfo, puckmanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// PuckMan (Japan set 1 with speedup hack) - -static struct BurnRomInfo puckmanfRomDesc[] = { - { "namcopac.6e", 0x1000, 0xfee263b3, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "nampfast.6f", 0x1000, 0x51b38db9, 1 | BRF_ESS | BRF_PRG }, // 1 - { "namcopac.6h", 0x1000, 0x02083b03, 1 | BRF_ESS | BRF_PRG }, // 2 - { "namcopac.6j", 0x1000, 0x7a36fe55, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics - { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(puckmanf) -STD_ROM_FN(puckmanf) - -struct BurnDriver BurnDrvpuckmanf = { - "puckmanf", "puckman", NULL, NULL, "1980", - "PuckMan (Japan set 1 with speedup hack)\0", NULL, "Namco", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, puckmanfRomInfo, puckmanfRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// PuckMan (Japan set 3) - -static struct BurnRomInfo puckmodRomDesc[] = { - { "namcopac.6e", 0x1000, 0xfee263b3, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "namcopac.6f", 0x1000, 0x39d1fc83, 1 | BRF_ESS | BRF_PRG }, // 1 - { "namcopac.6h", 0x1000, 0x02083b03, 1 | BRF_ESS | BRF_PRG }, // 2 - { "npacmod.6j", 0x1000, 0x7d98d5f5, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics - { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(puckmod) -STD_ROM_FN(puckmod) - -struct BurnDriver BurnDrvpuckmod = { - "puckmod", "puckman", NULL, NULL, "1981", - "PuckMan (Japan set 3)\0", NULL, "Namco", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, puckmodRomInfo, puckmodRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// PuckMan (Japan set 2) - -static struct BurnRomInfo puckmanaRomDesc[] = { - { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 - { "prg7", 0x0800, 0xb6289b26, 1 | BRF_ESS | BRF_PRG }, // 3 - { "prg8", 0x0800, 0x17a88c13, 1 | BRF_ESS | BRF_PRG }, // 4 - - { "chg1", 0x0800, 0x2066a0b7, 2 | BRF_GRA }, // 5 Graphics - { "chg2", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 6 - { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 7 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(puckmana) -STD_ROM_FN(puckmana) - -struct BurnDriver BurnDrvpuckmana = { - "puckmana", "puckman", NULL, NULL, "1981", - "PuckMan (Japan set 2)\0", NULL, "Namco", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, puckmanaRomInfo, puckmanaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pac-Man (Midway) - -static struct BurnRomInfo pacmanRomDesc[] = { - { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics - { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(pacman) -STD_ROM_FN(pacman) - -struct BurnDriver BurnDrvpacman = { - "pacman", "puckman", NULL, NULL, "1980", - "Pac-Man (Midway)\0", NULL, "[Namco] (Midway license)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pacmanRomInfo, pacmanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pac-Man (Midway, with speedup hack) - -static struct BurnRomInfo pacmanfRomDesc[] = { - { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacfast.6f", 0x1000, 0x720dc3ee, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics - { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(pacmanf) -STD_ROM_FN(pacmanf) - -struct BurnDriver BurnDrvpacmanf = { - "pacmanf", "puckman", NULL, NULL, "1980", - "Pac-Man (Midway, with speedup hack)\0", NULL, "[Namco] (Midway license)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pacmanfRomInfo, pacmanfRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Hangly-Man (set 1) - -static struct BurnRomInfo hanglyRomDesc[] = { - { "hangly.6e", 0x1000, 0x5fe8610a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "hangly.6f", 0x1000, 0x73726586, 1 | BRF_ESS | BRF_PRG }, // 1 - { "hangly.6h", 0x1000, 0x4e7ef99f, 1 | BRF_ESS | BRF_PRG }, // 2 - { "hangly.6j", 0x1000, 0x7f4147e6, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics - { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(hangly) -STD_ROM_FN(hangly) - -struct BurnDriver BurnDrvhangly = { - "hangly", "puckman", NULL, NULL, "1981", - "Hangly-Man (set 1)\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, hanglyRomInfo, hanglyRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Hangly-Man (set 2) - -static struct BurnRomInfo hangly2RomDesc[] = { - { "hangly.6e", 0x1000, 0x5fe8610a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "hangly2.6f", 0x0800, 0x5ba228bb, 1 | BRF_ESS | BRF_PRG }, // 1 - { "hangly2.6m", 0x0800, 0xbaf5461e, 1 | BRF_ESS | BRF_PRG }, // 2 - { "hangly.6h", 0x1000, 0x4e7ef99f, 1 | BRF_ESS | BRF_PRG }, // 3 - { "hangly2.6j", 0x0800, 0x51305374, 1 | BRF_ESS | BRF_PRG }, // 4 - { "hangly2.6p", 0x0800, 0x427c9d4d, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "pacmanh.5e", 0x1000, 0x299fb17a, 2 | BRF_GRA }, // 6 Graphics - { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 7 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(hangly2) -STD_ROM_FN(hangly2) - -struct BurnDriver BurnDrvhangly2 = { - "hangly2", "puckman", NULL, NULL, "1981", - "Hangly-Man (set 2)\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, hangly2RomInfo, hangly2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Hangly-Man (set 3) - -static struct BurnRomInfo hangly3RomDesc[] = { - { "hm1.6e", 0x0800, 0x9d027c4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "hm5.6k", 0x0800, 0x194c7189, 1 | BRF_ESS | BRF_PRG }, // 1 - { "hangly2.6f", 0x0800, 0x5ba228bb, 1 | BRF_ESS | BRF_PRG }, // 2 - { "hangly2.6m", 0x0800, 0xbaf5461e, 1 | BRF_ESS | BRF_PRG }, // 3 - { "hm3.6h", 0x0800, 0x08419c4a, 1 | BRF_ESS | BRF_PRG }, // 4 - { "hm7.6n", 0x0800, 0xab74b51f, 1 | BRF_ESS | BRF_PRG }, // 5 - { "hm4.6j", 0x0800, 0x5039b082, 1 | BRF_ESS | BRF_PRG }, // 6 - { "hm8.6p", 0x0800, 0x931770d7, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "hm9.5e", 0x0800, 0x5f4be3cc, 2 | BRF_GRA }, // 8 Graphics - { "hm11.5h", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 9 - { "hm10.5f", 0x0800, 0x9e39323a, 2 | BRF_GRA }, // 10 - { "hm12.5j", 0x0800, 0x1b1d9096, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(hangly3) -STD_ROM_FN(hangly3) - -struct BurnDriver BurnDrvhangly3 = { - "hangly3", "puckman", NULL, NULL, "1981", - "Hangly-Man (set 3)\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, hangly3RomInfo, hangly3RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Popeye Man - -static struct BurnRomInfo popeyemanRomDesc[] = { - { "pop1.6e", 0x0800, 0x9d027c4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pop5.6k", 0x0800, 0x194c7189, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pop2.6f", 0x0800, 0x5ba228bb, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pop6.6m", 0x0800, 0xbaf5461e, 1 | BRF_ESS | BRF_PRG }, // 3 - { "pop3.6h", 0x0800, 0x08419c4a, 1 | BRF_ESS | BRF_PRG }, // 4 - { "pop7.6n", 0x0800, 0xab74b51f, 1 | BRF_ESS | BRF_PRG }, // 5 - { "pop4.6j", 0x0800, 0x5039b082, 1 | BRF_ESS | BRF_PRG }, // 6 - { "pop8.6p", 0x0800, 0x931770d7, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "pop9.5e", 0x0800, 0xb569c4c1, 2 | BRF_GRA }, // 8 Graphics - { "pop11.5h", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 9 - { "pop10.5f", 0x0800, 0x014fb5a4, 2 | BRF_GRA }, // 10 - { "pop12.5j", 0x0800, 0x21b91c64, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(popeyeman) -STD_ROM_FN(popeyeman) - -struct BurnDriver BurnDrvpopeyeman = { - "popeyeman", "puckman", NULL, NULL, "1981", - "Popeye-Man\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, popeyemanRomInfo, popeyemanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Crock-Man - -static struct BurnRomInfo crockmanRomDesc[] = { - { "p1.6e", 0x0800, 0x2c0fa0ab, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "p5.6k", 0x0800, 0xafeca2f1, 1 | BRF_ESS | BRF_PRG }, // 1 - { "p2.6f", 0x0800, 0x7d177853, 1 | BRF_ESS | BRF_PRG }, // 2 - { "p6.6m", 0x0800, 0xd3e8914c, 1 | BRF_ESS | BRF_PRG }, // 3 - { "p3.6h", 0x0800, 0x9045a44c, 1 | BRF_ESS | BRF_PRG }, // 4 - { "p7.6n", 0x0800, 0x93f344c5, 1 | BRF_ESS | BRF_PRG }, // 5 - { "p4.6j", 0x0800, 0xbed4a077, 1 | BRF_ESS | BRF_PRG }, // 6 - { "p8.6p", 0x0800, 0x800be41e, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "p9.5e", 0x0800, 0xa10218c4, 2 | BRF_GRA }, // 8 Graphics - { "p11.5h", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 9 - { "p10.5f", 0x0800, 0x9e39323a, 2 | BRF_GRA }, // 10 - { "p12.5j", 0x0800, 0x1b1d9096, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(crockman) -STD_ROM_FN(crockman) - -struct BurnDriver BurnDrvcrockman = { - "crockman", "puckman", NULL, NULL, "1980", - "Crock-Man (bootleg, Rene-Pierre)\0", NULL, "bootleg (Rene-Pierre)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, crockmanRomInfo, crockmanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pac-Man (Midway, harder) - -static struct BurnRomInfo pacmodRomDesc[] = { - { "pacmanh.6e", 0x1000, 0x3b2ec270, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacmanh.6h", 0x1000, 0x18811780, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pacmanh.6j", 0x1000, 0x5c96a733, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pacmanh.5e", 0x1000, 0x299fb17a, 2 | BRF_GRA }, // 4 Graphics - { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(pacmod) -STD_ROM_FN(pacmod) - -struct BurnDriver BurnDrvpacmod = { - "pacmod", "puckman", NULL, NULL, "1981", - "Pac-Man (Midway, harder)\0", NULL, "[Namco] (Midway license)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pacmodRomInfo, pacmodRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Puckman (Falcom?) - -static struct BurnRomInfo puckmanhRomDesc[] = { - { "pm01.6e", 0x1000, 0x5fe8610a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pm02.6f", 0x1000, 0x61d38c6c, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pm03.6h", 0x1000, 0x4e7ef99f, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pm04.6j", 0x1000, 0x8939ddd2, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pm9.5e", 0x0800, 0x2229ab07, 2 | BRF_GRA }, // 4 Graphics - { "pm11.5h", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 5 - { "pm10.5f", 0x0800, 0x9e39323a, 2 | BRF_GRA }, // 6 - { "pm12.5j", 0x0800, 0x1b1d9096, 2 | BRF_GRA }, // 7 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(puckmanh) -STD_ROM_FN(puckmanh) - -struct BurnDriver BurnDrvpuckmanh = { - "puckmanh", "puckman", NULL, NULL, "1981", - "Puckman (Falcom?)\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, puckmanhRomInfo, puckmanhRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// New Puck-X - -static struct BurnRomInfo newpuckxRomDesc[] = { - { "puckman.6e", 0x1000, 0xa8ae23c5, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 - { "puckman.6h", 0x1000, 0x197443f8, 1 | BRF_ESS | BRF_PRG }, // 2 - { "puckman.6j", 0x1000, 0x2e64a3ba, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics - { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(newpuckx) -STD_ROM_FN(newpuckx) - -struct BurnDriver BurnDrvnewpuckx = { - "newpuckx", "puckman", NULL, NULL, "1980", - "New Puck-X\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, newpuckxRomInfo, newpuckxRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pac-Man (Hearts) - -static struct BurnRomInfo pacheartRomDesc[] = { - { "pacheart1.6e", 0x0800, 0xd844b679, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacheart.pg2", 0x0800, 0xb9152a38, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacheart2.6f", 0x0800, 0x7d177853, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pacheart.pg4", 0x0800, 0x842d6574, 1 | BRF_ESS | BRF_PRG }, // 3 - { "pacheart3.6h", 0x0800, 0x9045a44c, 1 | BRF_ESS | BRF_PRG }, // 4 - { "pacheart7.6n", 0x0800, 0x888f3c3e, 1 | BRF_ESS | BRF_PRG }, // 5 - { "pacheart.pg7", 0x0800, 0xf5265c10, 1 | BRF_ESS | BRF_PRG }, // 6 - { "pacheart.pg8", 0x0800, 0x1a21a381, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "pacheart.ch1", 0x0800, 0xc62bbabf, 2 | BRF_GRA }, // 8 Graphics - { "chg2", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 9 - { "pacheart.ch3", 0x0800, 0xca8c184c, 2 | BRF_GRA }, // 10 - { "pacheart.ch4", 0x0800, 0x1b1d9096, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(pacheart) -STD_ROM_FN(pacheart) - -struct BurnDriver BurnDrvpacheart = { - "pacheart", "puckman", NULL, NULL, "1981", - "Pac-Man (Hearts)\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pacheartRomInfo, pacheartRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Joyman - -static struct BurnRomInfo joymanRomDesc[] = { - { "joy1.6e", 0x0800, 0xd844b679, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "joy5.6k", 0x0800, 0xab9c8f29, 1 | BRF_ESS | BRF_PRG }, // 1 - { "joy2.6f", 0x0800, 0x7d177853, 1 | BRF_ESS | BRF_PRG }, // 2 - { "joy6.6m", 0x0800, 0xb3c8d32e, 1 | BRF_ESS | BRF_PRG }, // 3 - { "joy3.6h", 0x0800, 0x9045a44c, 1 | BRF_ESS | BRF_PRG }, // 4 - { "joy7.6n", 0x0800, 0x888f3c3e, 1 | BRF_ESS | BRF_PRG }, // 5 - { "joy4.6j", 0x0800, 0x00b553f8, 1 | BRF_ESS | BRF_PRG }, // 6 - { "joy8.6p", 0x0800, 0x5d5ce992, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "joy9.5e", 0x0800, 0x39b557bc, 2 | BRF_GRA }, // 8 Graphics - { "joy11.5h", 0x0800, 0x33e0289e, 2 | BRF_GRA }, // 9 - { "joy10.5f", 0x0800, 0x338771a6, 2 | BRF_GRA }, // 10 - { "joy12.5j", 0x0800, 0xf4f0add5, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(joyman) -STD_ROM_FN(joyman) - -struct BurnDriver BurnDrvjoyman = { - "joyman", "puckman", NULL, NULL, "1982", - "Joyman\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, joymanRomInfo, joymanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Buccaneer - -static struct BurnRomInfo bucanerRomDesc[] = { - { "buc1.6e", 0x0800, 0x2c0fa0ab, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "buc5.6k", 0x0800, 0xafeca2f1, 1 | BRF_ESS | BRF_PRG }, // 1 - { "buc2.6f", 0x0800, 0x6b53ada9, 1 | BRF_ESS | BRF_PRG }, // 2 - { "buc6.6m", 0x0800, 0x35f3ca84, 1 | BRF_ESS | BRF_PRG }, // 3 - { "buc3.6h", 0x0800, 0x9045a44c, 1 | BRF_ESS | BRF_PRG }, // 4 - { "buc7.6n", 0x0800, 0x888f3c3e, 1 | BRF_ESS | BRF_PRG }, // 5 - { "buc4.6j", 0x0800, 0x292de161, 1 | BRF_ESS | BRF_PRG }, // 6 - { "buc8.6p", 0x0800, 0x884af858, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "buc9.5e", 0x0800, 0x4060c077, 2 | BRF_GRA }, // 8 Graphics - { "buc11.5h", 0x0800, 0xe3861283, 2 | BRF_GRA }, // 9 - { "buc10.5f", 0x0800, 0x09f66dec, 2 | BRF_GRA }, // 10 - { "buc12.5j", 0x0800, 0x653314e7, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(bucaner) -STD_ROM_FN(bucaner) - -struct BurnDriver BurnDrvbucaner = { - "bucaner", "puckman", NULL, NULL, "19??", - "Buccaneer\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, bucanerRomInfo, bucanerRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Caterpillar Pacman Hack - -static struct BurnRomInfo ctrpllrpRomDesc[] = { - { "c1.bin", 0x0800, 0x9d027c4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "c5.bin", 0x0800, 0xf39846d3, 1 | BRF_ESS | BRF_PRG }, // 1 - { "c2.bin", 0x0800, 0xafa149a8, 1 | BRF_ESS | BRF_PRG }, // 2 - { "c6.bin", 0x0800, 0xbaf5461e, 1 | BRF_ESS | BRF_PRG }, // 3 - { "c3.bin", 0x0800, 0x6bb282a1, 1 | BRF_ESS | BRF_PRG }, // 4 - { "c7.bin", 0x0800, 0xfa2140f5, 1 | BRF_ESS | BRF_PRG }, // 5 - { "c4.bin", 0x0800, 0x86c91e0e, 1 | BRF_ESS | BRF_PRG }, // 6 - { "c8.bin", 0x0800, 0x3d28134e, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "c9.bin", 0x0800, 0x1c4617be, 2 | BRF_GRA }, // 8 Graphics - { "c11.bin", 0x0800, 0x46f72fef, 2 | BRF_GRA }, // 9 - { "c10.bin", 0x0800, 0xba9ec199, 2 | BRF_GRA }, // 10 - { "c12.bin", 0x0800, 0x41c09655, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(ctrpllrp) -STD_ROM_FN(ctrpllrp) - -struct BurnDriver BurnDrvctrpllrp = { - "ctrpllrp", "puckman", NULL, NULL, "1982", - "Caterpillar Pacman Hack\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, ctrpllrpRomInfo, ctrpllrpRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pac-Man Plus - -static struct BurnRomInfo pacplusRomDesc[] = { - { "pacplus.6e", 0x1000, 0xd611ef68, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacplus.6f", 0x1000, 0xc7207556, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacplus.6h", 0x1000, 0xae379430, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pacplus.6j", 0x1000, 0x5a6dff7b, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pacplus.5e", 0x1000, 0x022c35da, 2 | BRF_GRA }, // 4 Graphics - { "pacplus.5f", 0x1000, 0x4de65cdd, 2 | BRF_GRA }, // 5 - - { "pacplus.7f", 0x0020, 0x063dd53a, 3 | BRF_GRA }, // 6 Color Proms - { "pacplus.4a", 0x0100, 0xe271a166, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(pacplus) -STD_ROM_FN(pacplus) - -static UINT8 pacplus_decrypt(INT32 addr, UINT8 e) -{ - static const UINT8 swap_xor_table[6][9] = - { - { 7,6,5,4,3,2,1,0, 0x00 }, - { 7,6,5,4,3,2,1,0, 0x28 }, - { 6,1,3,2,5,7,0,4, 0x96 }, - { 6,1,5,2,3,7,0,4, 0xbe }, - { 0,3,7,6,4,2,1,5, 0xd5 }, - { 0,3,4,6,7,2,1,5, 0xdd } - }; - - static const INT32 picktable[32] = - { - 0,2,4,2,4,0,4,2,2,0,2,2,4,0,4,2, - 2,2,4,0,4,2,4,0,0,4,0,4,4,2,4,2 - }; - - INT32 method = picktable[(addr & 0x001) | ((addr & 0x004) >> 1) | ((addr & 0x020) >> 3) | ((addr & 0x080) >> 4) | ((addr & 0x200) >> 5)]; - - if (addr & 0x800) method ^= 1; - - const UINT8 *tbl = swap_xor_table[method]; - - return BITSWAP08(e,tbl[0],tbl[1],tbl[2],tbl[3],tbl[4],tbl[5],tbl[6],tbl[7]) ^ tbl[8]; -} - -void pacplus_decode() -{ - for (INT32 i = 0; i < 0x4000; i++) - { - DrvZ80ROM[i] = pacplus_decrypt(i, DrvZ80ROM[i]); - } -} - -static INT32 pacplusInit() -{ - return DrvInit(StandardMap, pacplus_decode, PACMAN); -} - -struct BurnDriver BurnDrvpacplus = { - "pacplus", NULL, NULL, NULL, "1982", - "Pac-Man Plus\0", NULL, "[Namco] (Midway license)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pacplusRomInfo, pacplusRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - pacplusInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Newpuc2 - -static struct BurnRomInfo newpuc2RomDesc[] = { - { "6e.cpu", 0x0800, 0x69496a98, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "6k.cpu", 0x0800, 0x158fc01c, 1 | BRF_ESS | BRF_PRG }, // 1 - { "6f.cpu", 0x0800, 0x7d177853, 1 | BRF_ESS | BRF_PRG }, // 2 - { "6m.cpu", 0x0800, 0x70810ccf, 1 | BRF_ESS | BRF_PRG }, // 3 - { "6h.cpu", 0x0800, 0x81719de8, 1 | BRF_ESS | BRF_PRG }, // 4 - { "6n.cpu", 0x0800, 0x3f250c58, 1 | BRF_ESS | BRF_PRG }, // 5 - { "6j.cpu", 0x0800, 0xe6675736, 1 | BRF_ESS | BRF_PRG }, // 6 - { "6p.cpu", 0x0800, 0x1f81e765, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "5e.cpu", 0x0800, 0x2066a0b7, 2 | BRF_GRA }, // 8 Graphics - { "5h.cpu", 0x0800, 0x777c70d3, 2 | BRF_GRA }, // 9 - { "5f.cpu", 0x0800, 0xca8c184c, 2 | BRF_GRA }, // 10 - { "5j.cpu", 0x0800, 0x7dc75a81, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(newpuc2) -STD_ROM_FN(newpuc2) - -struct BurnDriver BurnDrvnewpuc2 = { - "newpuc2", "puckman", NULL, NULL, "1980", - "Newpuc2\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, newpuc2RomInfo, newpuc2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Newpuc2b - -static struct BurnRomInfo newpuc2bRomDesc[] = { - { "np2b1.bin", 0x0800, 0x9d027c4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "6k.cpu", 0x0800, 0x158fc01c, 1 | BRF_ESS | BRF_PRG }, // 1 - { "6f.cpu", 0x0800, 0x7d177853, 1 | BRF_ESS | BRF_PRG }, // 2 - { "6m.cpu", 0x0800, 0x70810ccf, 1 | BRF_ESS | BRF_PRG }, // 3 - { "np2b3.bin", 0x0800, 0xf5e4b2b1, 1 | BRF_ESS | BRF_PRG }, // 4 - { "6n.cpu", 0x0800, 0x3f250c58, 1 | BRF_ESS | BRF_PRG }, // 5 - { "np2b4.bin", 0x0800, 0xf068e009, 1 | BRF_ESS | BRF_PRG }, // 6 - { "np2b8.bin", 0x0800, 0x1fadcc2f, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "5e.cpu", 0x0800, 0x2066a0b7, 2 | BRF_GRA }, // 8 Graphics - { "5h.cpu", 0x0800, 0x777c70d3, 2 | BRF_GRA }, // 9 - { "5f.cpu", 0x0800, 0xca8c184c, 2 | BRF_GRA }, // 10 - { "5j.cpu", 0x0800, 0x7dc75a81, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Prom - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(newpuc2b) -STD_ROM_FN(newpuc2b) - -struct BurnDriver BurnDrvnewpuc2b = { - "newpuc2b", "puckman", NULL, NULL, "1980", - "Newpuc2b\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, newpuc2bRomInfo, newpuc2bRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// MS Pacman - -static struct BurnRomInfo mspacmanRomDesc[] = { - { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 - { "u5", 0x0800, 0xf45fbbcd, 1 | BRF_ESS | BRF_PRG }, // 4 - { "u6", 0x1000, 0xa90e7000, 1 | BRF_ESS | BRF_PRG }, // 5 - { "u7", 0x1000, 0xc82cd714, 1 | BRF_ESS | BRF_PRG }, // 6 - - { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 7 Graphics - { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 8 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Prom - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 10 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 11 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 12 Timing Prom (not used) -}; - -STD_ROM_PICK(mspacman) -STD_ROM_FN(mspacman) - -static void MspacmanDecode() -{ -#define ADD0SWAP(x) BITSWAP16(x,15,14,13,12,11,3,7,9,10,8,6,5,4,2,1,0) -#define ADD1SWAP(x) BITSWAP16(x,15,14,13,12,11,8,7,5,9,10,6,3,4,2,1,0) -#define DATASWAP(x) BITSWAP08(x,0,4,5,7,6,3,2,1) - - static const UINT16 tab[10 * 8] = { // even is dst, odd is src - 0x0410, 0x8008, 0x08E0, 0x81D8, 0x0A30, 0x8118, 0x0BD0, 0x80D8, - 0x0C20, 0x8120, 0x0E58, 0x8168, 0x0EA8, 0x8198, 0x1000, 0x8020, - 0x1008, 0x8010, 0x1288, 0x8098, 0x1348, 0x8048, 0x1688, 0x8088, - 0x16B0, 0x8188, 0x16D8, 0x80C8, 0x16F8, 0x81C8, 0x19A8, 0x80A8, - 0x19B8, 0x81A8, 0x2060, 0x8148, 0x2108, 0x8018, 0x21A0, 0x81A0, - 0x2298, 0x80A0, 0x23E0, 0x80E8, 0x2418, 0x8000, 0x2448, 0x8058, - 0x2470, 0x8140, 0x2488, 0x8080, 0x24B0, 0x8180, 0x24D8, 0x80C0, - 0x24F8, 0x81C0, 0x2748, 0x8050, 0x2780, 0x8090, 0x27B8, 0x8190, - 0x2800, 0x8028, 0x2B20, 0x8100, 0x2B30, 0x8110, 0x2BF0, 0x81D0, - 0x2CC0, 0x80D0, 0x2CD8, 0x80E0, 0x2CF0, 0x81E0, 0x2D60, 0x8160 - }; - - memcpy (DrvZ80ROM + 0x0b000, DrvZ80ROM + 0x0a000, 0x01000); - memcpy (DrvZ80ROM + 0x10000, DrvZ80ROM + 0x00000, 0x03000); - - for (INT32 i = 0; i < 0x1000; i++) - { - DrvZ80ROM[0x13000+i] = DATASWAP(DrvZ80ROM[0xb000+ADD0SWAP(i)]); - } - - for (INT32 i = 0; i < 0x800; i++) - { - DrvZ80ROM[0x18000+i] = DATASWAP(DrvZ80ROM[0x8000+ADD1SWAP(i)]); - DrvZ80ROM[0x18800+i] = DATASWAP(DrvZ80ROM[0x9800+ADD0SWAP(i)]); - DrvZ80ROM[0x19000+i] = DATASWAP(DrvZ80ROM[0x9000+ADD0SWAP(i)]); - DrvZ80ROM[0x19800+i] = DrvZ80ROM[0x1800+i]; - } - - memcpy (DrvZ80ROM + 0x1a000, DrvZ80ROM + 0x02000, 0x2000); - - for (INT32 i = 0; i < 80; i+=2) { // apply patches - memcpy (DrvZ80ROM + 0x10000 + tab[i], DrvZ80ROM + 0x10000 + tab[i+1], 8); - } - - memcpy (DrvZ80ROM + 0x8000, DrvZ80ROM, 0x4000); -} - -static INT32 mspacmanInit() -{ - return DrvInit(MspacmanMap, MspacmanDecode, MSPACMAN); -} - -struct BurnDriver BurnDrvmspacman = { - "mspacman", NULL, NULL, NULL, "1980", - "MS Pacman\0", NULL, "Namco", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, mspacmanRomInfo, mspacmanRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - mspacmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Ms. Pac-Man (with speedup hack) - -static struct BurnRomInfo mspacmnfRomDesc[] = { - { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacfast.6f", 0x1000, 0x720dc3ee, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 - { "u5", 0x0800, 0xf45fbbcd, 1 | BRF_ESS | BRF_PRG }, // 4 - { "u6", 0x1000, 0xa90e7000, 1 | BRF_ESS | BRF_PRG }, // 5 - { "u7", 0x1000, 0xc82cd714, 1 | BRF_ESS | BRF_PRG }, // 6 - - { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 7 Graphics - { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 8 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(mspacmnf) -STD_ROM_FN(mspacmnf) - -struct BurnDriver BurnDrvmspacmnf = { - "mspacmnf", "mspacman", NULL, NULL, "1980", - "Ms. Pac-Man (with speedup hack)\0", NULL, "Midway", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, mspacmnfRomInfo, mspacmnfRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - mspacmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Ms. Pac Attack - -static struct BurnRomInfo mspacmatRomDesc[] = { - { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 - { "u5", 0x0800, 0xf45fbbcd, 1 | BRF_ESS | BRF_PRG }, // 4 - { "u6pacatk", 0x1000, 0xf6d83f4d, 1 | BRF_ESS | BRF_PRG }, // 5 - { "u7", 0x1000, 0xc82cd714, 1 | BRF_ESS | BRF_PRG }, // 6 - - { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 7 Graphics - { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 8 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Prom - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 10 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 11 - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 12 Sound Prom (not used) -}; - -STD_ROM_PICK(mspacmat) -STD_ROM_FN(mspacmat) - -struct BurnDriver BurnDrvmspacmat = { - "mspacmat", "mspacman", NULL, NULL, "1980", - "Ms. Pac Attack\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, mspacmatRomInfo, mspacmatRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - mspacmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Ms. Pac-Man Heart Burn - -static struct BurnRomInfo msheartbRomDesc[] = { - { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 - { "u5", 0x0800, 0xf45fbbcd, 1 | BRF_ESS | BRF_PRG }, // 4 - { "u6", 0x1000, 0xa90e7000, 1 | BRF_ESS | BRF_PRG }, // 5 - { "u7", 0x1000, 0xc82cd714, 1 | BRF_ESS | BRF_PRG }, // 6 - - { "5e", 0x1000, 0x5431d4c4, 2 | BRF_GRA }, // 7 Graphics - { "5f", 0x1000, 0xceb50654, 2 | BRF_GRA }, // 8 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Prom - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 10 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 11 - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 12 Sound Prom (not used) -}; - -STD_ROM_PICK(msheartb) -STD_ROM_FN(msheartb) - -struct BurnDriver BurnDrvmsheartb = { - "msheartb", "mspacman", NULL, NULL, "1980", - "Ms. Pac-Man Heart Burn\0", NULL, "hack (Two-Bit Score)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, msheartbRomInfo, msheartbRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - mspacmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// MS Pacman (bootleg) - -static struct BurnRomInfo mspacmabRomDesc[] = { - { "boot1", 0x1000, 0xd16b31b7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "boot2", 0x1000, 0x0d32de5e, 1 | BRF_ESS | BRF_PRG }, // 1 - { "boot3", 0x1000, 0x1821ee0b, 1 | BRF_ESS | BRF_PRG }, // 2 - { "boot4", 0x1000, 0x165a9dd8, 1 | BRF_ESS | BRF_PRG }, // 3 - { "boot5", 0x1000, 0x8c3e6de6, 1 | BRF_ESS | BRF_PRG }, // 4 - { "boot6", 0x1000, 0x368cb165, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 6 Graphics - { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 7 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(mspacmab) -STD_ROM_FN(mspacmab) - -static INT32 mspacmanbInit() -{ - return DrvInit(MspacmanMap, NULL, PACMAN); -} - -struct BurnDriver BurnDrvmspacmab = { - "mspacmab", "mspacman", NULL, NULL, "1981", - "MS Pacman (bootleg)\0", NULL, "Namco", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, mspacmabRomInfo, mspacmabRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - mspacmanbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Ms. Pac-Man (bootleg, encrypted) - -static struct BurnRomInfo mspacmbeRomDesc[] = { - { "boot1", 0x1000, 0xd16b31b7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "2.bin", 0x1000, 0x04e6c486, 1 | BRF_ESS | BRF_PRG }, // 1 - { "boot3", 0x1000, 0x1821ee0b, 1 | BRF_ESS | BRF_PRG }, // 2 - { "boot4", 0x1000, 0x165a9dd8, 1 | BRF_ESS | BRF_PRG }, // 3 - { "boot5", 0x1000, 0x8c3e6de6, 1 | BRF_ESS | BRF_PRG }, // 4 - { "6.bin", 0x1000, 0x206a9623, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 6 Graphics - { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 7 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(mspacmbe) -STD_ROM_FN(mspacmbe) - -static void mspacmbe_decode() -{ - for(INT32 i = 0x1000; i < 0x2000; i+=4) - { - if (!(i & 8)) - { - INT32 t = DrvZ80ROM[i+1]; - DrvZ80ROM[i+1] = DrvZ80ROM[i+2]; - DrvZ80ROM[i+2] = t; - }; - } -} - -static INT32 mspacmbeInit() -{ - return DrvInit(MspacmanMap, mspacmbe_decode, PACMAN); -} - -struct BurnDriver BurnDrvmspacmbe = { - "mspacmbe", "mspacman", NULL, NULL, "1981", - "Ms. Pac-Man (bootleg, encrypted)\0", NULL, "bootleg", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, mspacmbeRomInfo, mspacmbeRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - mspacmbeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pac-Gal - -static struct BurnRomInfo pacgalRomDesc[] = { - { "boot1", 0x1000, 0xd16b31b7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "boot2", 0x1000, 0x0d32de5e, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pacman.7fh", 0x1000, 0x513f4d5c, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pacman.7hj", 0x1000, 0x70694c8e, 1 | BRF_ESS | BRF_PRG }, // 3 - { "boot5", 0x1000, 0x8c3e6de6, 1 | BRF_ESS | BRF_PRG }, // 4 - { "boot6", 0x1000, 0x368cb165, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 6 Graphics - { "pacman.5ef", 0x0800, 0x65a3ee71, 2 | BRF_GRA }, // 7 - { "pacman.5hj", 0x0800, 0x50c7477d, 2 | BRF_GRA }, // 8 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Proms - { "82s129.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 10 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 11 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 12 Timing Prom (not used) -}; - -STD_ROM_PICK(pacgal) -STD_ROM_FN(pacgal) - -struct BurnDriver BurnDrvpacgal = { - "pacgal", "mspacman", NULL, NULL, "1981", - "Pac-Gal\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pacgalRomInfo, pacgalRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - mspacmanbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Ms. Pac-Man Plus - -static struct BurnRomInfo mspacplsRomDesc[] = { - { "boot1", 0x1000, 0xd16b31b7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "mspacatk.2", 0x1000, 0x0af09d31, 1 | BRF_ESS | BRF_PRG }, // 1 - { "boot3", 0x1000, 0x1821ee0b, 1 | BRF_ESS | BRF_PRG }, // 2 - { "boot4", 0x1000, 0x165a9dd8, 1 | BRF_ESS | BRF_PRG }, // 3 - { "mspacatk.5", 0x1000, 0xe6e06954, 1 | BRF_ESS | BRF_PRG }, // 4 - { "mspacatk.6", 0x1000, 0x3b5db308, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 6 Graphics - { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 7 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(mspacpls) -STD_ROM_FN(mspacpls) - -struct BurnDriver BurnDrvmspacpls = { - "mspacpls", "mspacman", NULL, NULL, "1981", - "Ms. Pac-Man Plus\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, mspacplsRomInfo, mspacplsRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - mspacmanbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Ms. Pacman Champion Edition / Zola-Puc Gal - -static struct BurnRomInfo mschampRomDesc[] = { - { "9fg.bin", 0x10000, 0x04dba113, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - - { "8e.bin", 0x2000, 0x17435f53, 2 | BRF_GRA }, // 1 Graphics - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 2 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 3 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 4 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 5 Timing Prom (not used)) ) -}; - -STD_ROM_PICK(mschamp) -STD_ROM_FN(mschamp) - -static void mschampCallback() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x1000); - - memcpy (tmp + 0x0000, DrvGfxROM + 0x0800, 0x1000); - memcpy (DrvGfxROM + 0x1000, tmp + 0x0000, 0x0800); - memcpy (DrvGfxROM + 0x0800, tmp + 0x0800, 0x0800); - - BurnFree(tmp); -} - -static INT32 mschampInit() -{ - return DrvInit(WoodpekMap, mschampCallback, MSCHAMP); -} - -struct BurnDriver BurnDrvmschamp = { - "mschamp", "mspacman", NULL, NULL, "1995", - "Ms. Pacman Champion Edition / Zola-Puc Gal\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, mschampRomInfo, mschampRomName, NULL, NULL, mschampInputInfo, mschampDIPInfo, - mschampInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Ms. Pacman Champion Edition / Super Zola Pac Gal - -static struct BurnRomInfo mschampsRomDesc[] = { - { "pm4.bin", 0x10000, 0x7d6b6303, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - - { "pm5.bin", 0x2000, 0x7fe6b9e2, 2 | BRF_GRA }, // 1 Graphics - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 2 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 3 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 4 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 5 Timing Prom (not used)) ) -}; - -STD_ROM_PICK(mschamps) -STD_ROM_FN(mschamps) - -struct BurnDriver BurnDrvmschamps = { - "mschamps", "mspacman", NULL, NULL, "1995", - "Ms. Pacman Champion Edition / Super Zola Pac Gal\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, mschampsRomInfo, mschampsRomName, NULL, NULL, mschampInputInfo, mschampDIPInfo, - mschampInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Crush Roller (Kural Samno) - -static struct BurnRomInfo crushRomDesc[] = { - { "crushkrl.6e", 0x1000, 0xa8dd8f54, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "crushkrl.6f", 0x1000, 0x91387299, 1 | BRF_ESS | BRF_PRG }, // 1 - { "crushkrl.6h", 0x1000, 0xd4455f27, 1 | BRF_ESS | BRF_PRG }, // 2 - { "crushkrl.6j", 0x1000, 0xd59fc251, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "maketrax.5e", 0x1000, 0x91bad2da, 2 | BRF_GRA }, // 4 Graphics - { "maketrax.5f", 0x1000, 0xaea79f55, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Prom - { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(crush) -STD_ROM_FN(crush) - -static void maketraxCallback() -{ - DrvZ80ROM[0x0224] = 0x00; - DrvZ80ROM[0x0225] = 0x00; - DrvZ80ROM[0x0226] = 0x00; - DrvZ80ROM[0x022D] = 0x00; - DrvZ80ROM[0x022F] = 0x00; - DrvZ80ROM[0x023C] = 0x00; - DrvZ80ROM[0x023D] = 0x00; - DrvZ80ROM[0x023E] = 0x00; - DrvZ80ROM[0x0415] = 0xc9; - DrvZ80ROM[0x0428] = 0xC6; - DrvZ80ROM[0x0429] = 0x12; - DrvZ80ROM[0x115E] = 0xC9; - DrvZ80ROM[0x1481] = 0x28; - DrvZ80ROM[0x1492] = 0x20; - DrvZ80ROM[0x14A5] = 0xC8; - DrvZ80ROM[0x1978] = 0x18; - DrvZ80ROM[0x1C9F] = 0xA7; - DrvZ80ROM[0x1CA0] = 0xC9; - DrvZ80ROM[0x238e] = 0xc9; - DrvZ80ROM[0x3AE5] = 0x3E; - DrvZ80ROM[0x3AE7] = 0xFE; - DrvZ80ROM[0x3AE8] = 0x3F; - DrvZ80ROM[0x3AE9] = 0xC9; -} - -static INT32 crushInit() -{ - return DrvInit(StandardMap, maketraxCallback, PACMAN); -} - -struct BurnDriver BurnDrvcrush = { - "crush", NULL, NULL, NULL, "1981", - "Crush Roller (Kural Samno)\0", NULL, "Kural Samno Electric", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, crushRomInfo, crushRomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, - crushInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Crush Roller (bootleg) - -static struct BurnRomInfo crushblRomDesc[] = { - { "cr1.bin", 0x1000, 0xe2e84cd1, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "cr2.bin", 0x1000, 0xec020e6f, 1 | BRF_ESS | BRF_PRG }, // 1 - { "cr3.bin", 0x1000, 0xd4455f27, 1 | BRF_ESS | BRF_PRG }, // 2 - { "cr4.bin", 0x1000, 0x9936ae06, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "maketrax.5e", 0x1000, 0x91bad2da, 2 | BRF_GRA }, // 4 Graphics - { "maketrax.5f", 0x1000, 0xaea79f55, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Prom - { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(crushbl) -STD_ROM_FN(crushbl) - -struct BurnDriver BurnDrvcrushbl = { - "crushbl", "crush", NULL, NULL, "1981", - "Crush Roller (bootleg)\0", NULL, "Kural Samno Electric", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, crushblRomInfo, crushblRomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Crush Roller (bootleg?) - -static struct BurnRomInfo crushbl2RomDesc[] = { - { "cr5.7d", 0x1000, 0x4954d51d, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "cr6.7e", 0x1000, 0x27eb4299, 1 | BRF_ESS | BRF_PRG }, // 1 - { "cr7.7h", 0x1000, 0xd297108e, 1 | BRF_ESS | BRF_PRG }, // 2 - { "cr8.7j", 0x1000, 0xbcc40eaf, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "cr1.5e", 0x0800, 0xc7617198, 2 | BRF_GRA }, // 4 Graphics - { "cr3.5h", 0x0800, 0xc15b6967, 2 | BRF_GRA }, // 5 - { "cr2.5f", 0x0800, 0xd5bc5cb8, 2 | BRF_GRA }, // 6 - { "cr4.5j", 0x0800, 0xd35d1caf, 2 | BRF_GRA }, // 7 - - { "74s288.8a", 0x0020, 0xff344446, 3 | BRF_GRA }, // 8 Color Prom - { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 9 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(crushbl2) -STD_ROM_FN(crushbl2) - -struct BurnDriver BurnDrvcrushbl2 = { - "crushbl2", "crush", NULL, NULL, "1981", - "Crush Roller (bootleg?)\0", NULL, "bootleg", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, crushbl2RomInfo, crushbl2RomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Crush Roller (Kural Esco - bootleg?) - -static struct BurnRomInfo crush2RomDesc[] = { - { "tp1", 0x0800, 0xf276592e, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "tp5a", 0x0800, 0x3d302abe, 1 | BRF_ESS | BRF_PRG }, // 1 - { "tp2", 0x0800, 0x25f42e70, 1 | BRF_ESS | BRF_PRG }, // 2 - { "tp6", 0x0800, 0x98279cbe, 1 | BRF_ESS | BRF_PRG }, // 3 - { "tp3", 0x0800, 0x8377b4cb, 1 | BRF_ESS | BRF_PRG }, // 4 - { "tp7", 0x0800, 0xd8e76c8c, 1 | BRF_ESS | BRF_PRG }, // 5 - { "tp4", 0x0800, 0x90b28fa3, 1 | BRF_ESS | BRF_PRG }, // 6 - { "tp8", 0x0800, 0x10854e1b, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "tpa", 0x0800, 0xc7617198, 2 | BRF_GRA }, // 8 Graphics - { "tpc", 0x0800, 0xe129d76a, 2 | BRF_GRA }, // 9 - { "tpb", 0x0800, 0xd1899f05, 2 | BRF_GRA }, // 10 - { "tpd", 0x0800, 0xd35d1caf, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(crush2) -STD_ROM_FN(crush2) - -struct BurnDriver BurnDrvcrush2 = { - "crush2", "crush", NULL, NULL, "1981", - "Crush Roller (Kural Esco - bootleg?)\0", NULL, "Kural Esco Electric", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, crush2RomInfo, crush2RomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Crush Roller (Kural - bootleg?) - -static struct BurnRomInfo crush3RomDesc[] = { - { "unkmol.4e", 0x0800, 0x49150ddf, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "unkmol.6e", 0x0800, 0x21f47e17, 1 | BRF_ESS | BRF_PRG }, // 1 - { "unkmol.4f", 0x0800, 0x9b6dd592, 1 | BRF_ESS | BRF_PRG }, // 2 - { "unkmol.6f", 0x0800, 0x755c1452, 1 | BRF_ESS | BRF_PRG }, // 3 - { "unkmol.4h", 0x0800, 0xed30a312, 1 | BRF_ESS | BRF_PRG }, // 4 - { "unkmol.6h", 0x0800, 0xfe4bb0eb, 1 | BRF_ESS | BRF_PRG }, // 5 - { "unkmol.4j", 0x0800, 0x072b91c9, 1 | BRF_ESS | BRF_PRG }, // 6 - { "unkmol.6j", 0x0800, 0x66fba07d, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "unkmol.5e", 0x0800, 0x338880a0, 2 | BRF_GRA }, // 8 Graphics - { "unkmol.5h", 0x0800, 0x4ce9c81f, 2 | BRF_GRA }, // 9 - { "unkmol.5f", 0x0800, 0x752e3780, 2 | BRF_GRA }, // 10 - { "unkmol.5j", 0x0800, 0x6e00d2ac, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(crush3) -STD_ROM_FN(crush3) - -static void eyes_gfx_decode(UINT8 *src) -{ - UINT8 buf[8]; - - for (INT32 i = 0; i < 8; i++) { - buf[i] = BITSWAP08(src[((i & 1) << 2) | ((i & 4) >> 2) | (i & 2)],7,4,5,6,3,2,1,0); - } - - memcpy (src, buf, 8); -} - -static void eyes_decode() -{ - for (INT32 i = 0; i < 0x4000; i++) - DrvZ80ROM[i] = BITSWAP08(DrvZ80ROM[i],7,6,3,4,5,2,1,0); - - for (INT32 i = 0;i < 0x2000; i += 8) - eyes_gfx_decode(DrvGfxROM + i); -} - -static INT32 crush3Init() -{ - return DrvInit(StandardMap, eyes_decode, PACMAN); -} - -struct BurnDriver BurnDrvcrush3 = { - "crush3", "crush", NULL, NULL, "1981", - "Crush Roller (Kural - bootleg?)\0", NULL, "Kural Electric", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, crush3RomInfo, crush3RomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, - crush3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Crush Roller (Kural TWT) - -static struct BurnRomInfo crush4RomDesc[] = { - { "crtwt.2", 0x10000, 0xadbd21f7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code (banked) - - { "crtwt.1", 0x4000, 0x4250a9ea, 2 | BRF_GRA }, // 1 Graphics - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 2 Color Proms - { "82s129.bin", 0x0100, 0x2bc5d339, 3 | BRF_GRA }, // 3 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 4 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 5 Timing Prom (not used) -}; - -STD_ROM_PICK(crush4) -STD_ROM_FN(crush4) - -static void crush4Callback() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x4000); - - memcpy (tmp + 0x0000, DrvGfxROM + 0x0000, 0x04000); - memcpy (DrvGfxROM + 0x1000, tmp + 0x0800, 0x00800); - memcpy (DrvGfxROM + 0x0800, tmp + 0x1000, 0x00800); - memcpy (DrvGfxROM + 0x3000, tmp + 0x2800, 0x00800); - memcpy (DrvGfxROM + 0x2800, tmp + 0x3000, 0x00800); - - memcpy (DrvZ80ROM + 0x00000, DrvZ80ROM + 0x08000, 0x04000); - memcpy (DrvZ80ROM + 0x08000, DrvZ80ROM + 0x0c000, 0x04000); - memset (DrvZ80ROM + 0x0c000, 0, 0x4000); - - BurnFree (tmp); -} - -static INT32 crush4Init() -{ - return DrvInit(StandardMap, crush4Callback, PACMAN); -} - -struct BurnDriver BurnDrvcrush4 = { - "crush4", "crush", NULL, NULL, "1981", - "Crush Roller (Kural TWT)\0", NULL, "Kural TWT", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, crush4RomInfo, crush4RomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, - crush4Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Paint Roller - -static struct BurnRomInfo paintrlrRomDesc[] = { - { "paintrlr.1", 0x0800, 0x556d20b5, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "paintrlr.5", 0x0800, 0x4598a965, 1 | BRF_ESS | BRF_PRG }, // 1 - { "paintrlr.2", 0x0800, 0x2da29c81, 1 | BRF_ESS | BRF_PRG }, // 2 - { "paintrlr.6", 0x0800, 0x1f561c54, 1 | BRF_ESS | BRF_PRG }, // 3 - { "paintrlr.3", 0x0800, 0xe695b785, 1 | BRF_ESS | BRF_PRG }, // 4 - { "paintrlr.7", 0x0800, 0x00e6eec0, 1 | BRF_ESS | BRF_PRG }, // 5 - { "paintrlr.4", 0x0800, 0x0fd5884b, 1 | BRF_ESS | BRF_PRG }, // 6 - { "paintrlr.8", 0x0800, 0x4900114a, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "tpa", 0x0800, 0xc7617198, 2 | BRF_GRA }, // 8 Graphics - { "mbrush.5h", 0x0800, 0xc15b6967, 2 | BRF_GRA }, // 9 - { "mbrush.5f", 0x0800, 0xd5bc5cb8, 2 | BRF_GRA }, // 10 - { "tpd", 0x0800, 0xd35d1caf, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (unused) -}; - -STD_ROM_PICK(paintrlr) -STD_ROM_FN(paintrlr) - -struct BurnDriver BurnDrvpaintrlr = { - "paintrlr", "crush", NULL, NULL, "1981", - "Paint Roller\0", NULL, "bootleg", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, paintrlrRomInfo, paintrlrRomName, NULL, NULL, DrvInputInfo, mbrushDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Crush Roller (Sidam bootleg) - -static struct BurnRomInfo crushsRomDesc[] = { - { "11105-0.0j", 0x1000, 0xdd425429, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "11105-1.1j", 0x1000, 0xf9d89eef, 1 | BRF_ESS | BRF_PRG }, // 1 - { "11105-2.2j", 0x1000, 0x40c23a27, 1 | BRF_ESS | BRF_PRG }, // 2 - { "11105-3.3j", 0x1000, 0x5802644f, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "11105-4.4j", 0x1000, 0x91bad2da, 2 | BRF_GRA }, // 4 Graphics - { "11105-5.5j", 0x1000, 0xb5c14376, 2 | BRF_GRA }, // 5 - - { "74s288.8a", 0x0020, 0xff344446, 3 | BRF_GRA }, // 6 Color Proms - { "24s10.6b", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 - - // uses AY8910 -}; - -STD_ROM_PICK(crushs) -STD_ROM_FN(crushs) - -static INT32 crushsInit() -{ - return DrvInit(StandardMap, NULL, CRUSHS); -} - -struct BurnDriver BurnDrvcrushs = { - "crushs", "crush", NULL, NULL, "19??", - "Crush Roller (Sidam bootleg)\0", NULL, "[Kural] (Sidam bootleg)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, crushsRomInfo, crushsRomName, NULL, NULL, DrvInputInfo, crushsDIPInfo, - crushsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Make Trax (set 1) - -static struct BurnRomInfo maketraxRomDesc[] = { - { "maketrax.6e", 0x1000, 0x0150fb4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "maketrax.6f", 0x1000, 0x77531691, 1 | BRF_ESS | BRF_PRG }, // 1 - { "maketrax.6h", 0x1000, 0xa2cdc51e, 1 | BRF_ESS | BRF_PRG }, // 2 - { "maketrax.6j", 0x1000, 0x0b4b5e0a, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "maketrax.5e", 0x1000, 0x91bad2da, 2 | BRF_GRA }, // 4 Graphics - { "maketrax.5f", 0x1000, 0xaea79f55, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(maketrax) -STD_ROM_FN(maketrax) - -static INT32 maketraxInit() -{ - return DrvInit(StandardMap, maketraxCallback, MAKETRAX); -} - -struct BurnDriver BurnDrvmaketrax = { - "maketrax", "crush", NULL, NULL, "1981", - "Make Trax (set 1)\0", NULL, "[Kural] (Williams license)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, maketraxRomInfo, maketraxRomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, - maketraxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Make Trax (set 2) - -static struct BurnRomInfo maketrxbRomDesc[] = { - { "maketrax.6e", 0x1000, 0x0150fb4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "maketrax.6f", 0x1000, 0x77531691, 1 | BRF_ESS | BRF_PRG }, // 1 - { "maketrxb.6h", 0x1000, 0x6ad342c9, 1 | BRF_ESS | BRF_PRG }, // 2 - { "maketrxb.6j", 0x1000, 0xbe27f729, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "maketrax.5e", 0x1000, 0x91bad2da, 2 | BRF_GRA }, // 4 Graphics - { "maketrax.5f", 0x1000, 0xaea79f55, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(maketrxb) -STD_ROM_FN(maketrxb) - -struct BurnDriver BurnDrvmaketrxb = { - "maketrxb", "crush", NULL, NULL, "1981", - "Make Trax (set 2)\0", NULL, "[Kural] (Williams license)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, maketrxbRomInfo, maketrxbRomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, - maketraxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Magic Brush - -static struct BurnRomInfo mbrushRomDesc[] = { - { "mbrush.6e", 0x1000, 0x750fbff7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "mbrush.6f", 0x1000, 0x27eb4299, 1 | BRF_ESS | BRF_PRG }, // 1 - { "mbrush.6h", 0x1000, 0xd297108e, 1 | BRF_ESS | BRF_PRG }, // 2 - { "mbrush.6j", 0x1000, 0x6fd719d0, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "tpa", 0x0800, 0xc7617198, 2 | BRF_GRA }, // 4 Graphics - { "mbrush.5h", 0x0800, 0xc15b6967, 2 | BRF_GRA }, // 5 - { "mbrush.5f", 0x0800, 0xd5bc5cb8, 2 | BRF_GRA }, // 6 - { "tpd", 0x0800, 0xd35d1caf, 2 | BRF_GRA }, // 7 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms - { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 9 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(mbrush) -STD_ROM_FN(mbrush) - -static void mbrushCallback() -{ - DrvZ80ROM[0x3AE2] = 0x3E; - DrvZ80ROM[0x3AE3] = 0x00; - DrvZ80ROM[0x3AE4] = 0x00; -} - -static INT32 mbrushInit() -{ - return DrvInit(StandardMap, mbrushCallback, PACMAN); -} - -struct BurnDriver BurnDrvmbrush = { - "mbrush", "crush", NULL, NULL, "1981", - "Magic Brush\0", NULL, "bootleg", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, mbrushRomInfo, mbrushRomName, NULL, NULL, DrvInputInfo, mbrushDIPInfo, - mbrushInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Korosuke Roller - -static struct BurnRomInfo korosukeRomDesc[] = { - { "kr.6e", 0x1000, 0x69f6e2da, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "kr.6f", 0x1000, 0xabf34d23, 1 | BRF_ESS | BRF_PRG }, // 1 - { "kr.6h", 0x1000, 0x76a2e2e2, 1 | BRF_ESS | BRF_PRG }, // 2 - { "kr.6j", 0x1000, 0x33e0e3bb, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "kr.5e", 0x1000, 0xe0380be8, 2 | BRF_GRA }, // 4 Graphics - { "kr.5f", 0x1000, 0x63fec9ee, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(korosuke) -STD_ROM_FN(korosuke) - -static void korosukeCallback() -{ - DrvZ80ROM[0x0233] = 0x00; - DrvZ80ROM[0x0234] = 0x00; - DrvZ80ROM[0x0235] = 0x00; - DrvZ80ROM[0x023c] = 0x00; - DrvZ80ROM[0x023e] = 0x00; - DrvZ80ROM[0x024b] = 0x00; - DrvZ80ROM[0x024c] = 0x00; - DrvZ80ROM[0x024d] = 0x00; - DrvZ80ROM[0x044c] = 0xc9; - DrvZ80ROM[0x115B] = 0xC9; - DrvZ80ROM[0x1AE9] = 0x18; - DrvZ80ROM[0x1CA7] = 0xA7; - DrvZ80ROM[0x1CA8] = 0xC9; - DrvZ80ROM[0x238c] = 0xc9; - DrvZ80ROM[0x3AE9] = 0x3E; - DrvZ80ROM[0x3AEB] = 0xFE; - DrvZ80ROM[0x3AEC] = 0x3F; - DrvZ80ROM[0x3AEE] = 0xC9; - DrvZ80ROM[0x045d] = 0xC6; - DrvZ80ROM[0x045e] = 0x12; - DrvZ80ROM[0x1481] = 0x28; - DrvZ80ROM[0x1492] = 0x20; - DrvZ80ROM[0x14A5] = 0xC8; -} - -static INT32 korosukeInit() -{ - return DrvInit(StandardMap, korosukeCallback, MAKETRAX); -} - -struct BurnDriver BurnDrvkorosuke = { - "korosuke", "crush", NULL, NULL, "1981", - "Korosuke Roller\0", NULL, "Kural Electric", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, korosukeRomInfo, korosukeRomName, NULL, NULL, korosukeInputInfo, korosukeDIPInfo, - korosukeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Eyes (Digitrex Techstar) - -static struct BurnRomInfo eyesRomDesc[] = { - { "d7", 0x1000, 0x3b09ac89, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "e7", 0x1000, 0x97096855, 1 | BRF_ESS | BRF_PRG }, // 1 - { "f7", 0x1000, 0x731e294e, 1 | BRF_ESS | BRF_PRG }, // 2 - { "h7", 0x1000, 0x22f7a719, 1 | BRF_ESS | BRF_PRG }, // 4 - - { "d5", 0x1000, 0xd6af0030, 2 | BRF_GRA }, // 5 Graphics - { "e5", 0x1000, 0xa42b5201, 2 | BRF_GRA }, // 6 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 7 Color Proms - { "82s129.4a", 0x0100, 0xd8d78829, 3 | BRF_GRA }, // 8 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 9 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 10 Timing Prom (not used) -}; - -STD_ROM_PICK(eyes) -STD_ROM_FN(eyes) - -static INT32 eyesInit() -{ - return DrvInit(StandardMap, eyes_decode, PACMAN); -} - -struct BurnDriver BurnDrveyes = { - "eyes", NULL, NULL, NULL, "1982", - "Eyes (Digitrex Techstar)\0", NULL, "Digitrex Techstar (Rock-ola license)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, eyesRomInfo, eyesRomName, NULL, NULL, eyesInputInfo, eyesDIPInfo, - eyesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Eyes (Techstar) - -static struct BurnRomInfo eyes2RomDesc[] = { - { "g38201.7d", 0x1000, 0x2cda7185, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "g38202.7e", 0x1000, 0xb9fe4f59, 1 | BRF_ESS | BRF_PRG }, // 1 - { "g38203.7f", 0x1000, 0xd618ba66, 1 | BRF_ESS | BRF_PRG }, // 2 - { "g38204.7h", 0x1000, 0xcf038276, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "g38205.5d", 0x1000, 0x03b1b4c7, 2 | BRF_GRA }, // 4 Graphics - { "g38206.5e", 0x1000, 0xa42b5201, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "82s129.4a", 0x0100, 0xd8d78829, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(eyes2) -STD_ROM_FN(eyes2) - -struct BurnDriver BurnDrveyes2 = { - "eyes2", "eyes", NULL, NULL, "1982", - "Eyes (Techstar)\0", NULL, "Techstar (Rock-ola license)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, eyes2RomInfo, eyes2RomName, NULL, NULL, eyesInputInfo, eyesDIPInfo, - eyesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Eyes (bootleg set 1) - -static struct BurnRomInfo eyesbRomDesc[] = { - { "1.bin", 0x0800, 0x339d279a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "5.bin", 0x0800, 0x1b68a61d, 1 | BRF_ESS | BRF_PRG }, // 1 - { "2.bin", 0x0800, 0xd4f9aaf8, 1 | BRF_ESS | BRF_PRG }, // 2 - { "6.bin", 0x0800, 0x6b41bb80, 1 | BRF_ESS | BRF_PRG }, // 3 - { "3.bin", 0x0800, 0x748e0e48, 1 | BRF_ESS | BRF_PRG }, // 4 - { "7.bin", 0x0800, 0x7b7f4a74, 1 | BRF_ESS | BRF_PRG }, // 5 - { "4.bin", 0x0800, 0x367a3884, 1 | BRF_ESS | BRF_PRG }, // 6 - { "8.bin", 0x0800, 0x2baaadae, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "9.bin", 0x0800, 0x342c0653, 2 | BRF_GRA }, // 8 Graphics - { "11.bin", 0x0800, 0xaaa7a537, 2 | BRF_GRA }, // 9 - { "10.bin", 0x0800, 0xb247b82c, 2 | BRF_GRA }, // 10 - { "12.bin", 0x0800, 0x99af4b30, 2 | BRF_GRA }, // 11 - - { "7051.bin", 0x0020, 0x0dad2ccb, 3 | BRF_GRA }, // 12 Color Proms - { "7051-3.bin", 0x0100, 0xd8d78829, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "7051-2.bin", 0x0100, 0x77245b66, 4 | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(eyesb) -STD_ROM_FN(eyesb) - -struct BurnDriver BurnDrveyesb = { - "eyesb", "eyes", NULL, NULL, "1982", - "Eyes (bootleg set 1)\0", NULL, "bootleg", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, eyesbRomInfo, eyesbRomName, NULL, NULL, eyesInputInfo, eyesDIPInfo, - eyesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Eyes (bootleg set 2, decrypted) - -static struct BurnRomInfo eyeszacbRomDesc[] = { - { "zacb_1.bin", 0x0800, 0xa4a9d7a0, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "zacb_5.bin", 0x0800, 0xc32b3f73, 1 | BRF_ESS | BRF_PRG }, // 1 - { "zacb_2.bin", 0x0800, 0x195b9473, 1 | BRF_ESS | BRF_PRG }, // 2 - { "zacb_6.bin", 0x0800, 0x292886cb, 1 | BRF_ESS | BRF_PRG }, // 3 - { "zacb_3.bin", 0x0800, 0xff94b015, 1 | BRF_ESS | BRF_PRG }, // 4 - { "zacb_7.bin", 0x0800, 0x9271c58c, 1 | BRF_ESS | BRF_PRG }, // 5 - { "zacb_4.bin", 0x0800, 0x965cf32b, 1 | BRF_ESS | BRF_PRG }, // 6 - { "zacb_8.bin", 0x0800, 0xc254e92e, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "x.bin", 0x0800, 0x59dce22e, 2 | BRF_GRA }, // 8 Graphics - { "c.bin", 0x0800, 0xaaa7a537, 2 | BRF_GRA }, // 9 - { "b.bin", 0x0800, 0x1969792b, 2 | BRF_GRA }, // 10 - { "p.bin", 0x0800, 0x99af4b30, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "82s129.4a", 0x0100, 0xd8d78829, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) - - { "zacb_11.bin", 0x0800, 0x69c1602a, 0 | BRF_PRG }, // 16 (Not used) -}; - -STD_ROM_PICK(eyeszacb) -STD_ROM_FN(eyeszacb) - -struct BurnDriver BurnDrveyeszac = { - "eyeszacb", "eyes", NULL, NULL, "1982", - "Eyes (bootleg set 2, decrypted)\0", NULL, "bootleg", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, eyeszacbRomInfo, eyeszacbRomName, NULL, NULL, eyesInputInfo, eyesDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Mr. TNT - -static struct BurnRomInfo mrtntRomDesc[] = { - { "tnt.1", 0x1000, 0x0e836586, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "tnt.2", 0x1000, 0x779c4c5b, 1 | BRF_ESS | BRF_PRG }, // 1 - { "tnt.3", 0x1000, 0xad6fc688, 1 | BRF_ESS | BRF_PRG }, // 2 - { "tnt.4", 0x1000, 0xd77557b3, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "tnt.5", 0x1000, 0x3038cc0e, 2 | BRF_GRA }, // 4 Graphics - { "tnt.6", 0x1000, 0x97634d8b, 2 | BRF_GRA }, // 5 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 7 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 8 Timing Prom (not used) -}; - -STD_ROM_PICK(mrtnt) -STD_ROM_FN(mrtnt) - -struct BurnDriver BurnDrvmrtnt = { - "mrtnt", NULL, NULL, NULL, "1982", - "Mr. TNT\0", NULL, "Telko", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, mrtntRomInfo, mrtntRomName, NULL, NULL, eyesInputInfo, mrtntDIPInfo, - eyesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Gorkans - -static struct BurnRomInfo gorkansRomDesc[] = { - { "gorkans8.rom", 0x0800, 0x55100b18, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "gorkans4.rom", 0x0800, 0xb5c604bf, 1 | BRF_ESS | BRF_PRG }, // 1 - { "gorkans7.rom", 0x0800, 0xb8c6def4, 1 | BRF_ESS | BRF_PRG }, // 2 - { "gorkans3.rom", 0x0800, 0x4602c840, 1 | BRF_ESS | BRF_PRG }, // 3 - { "gorkans6.rom", 0x0800, 0x21412a62, 1 | BRF_ESS | BRF_PRG }, // 4 - { "gorkans2.rom", 0x0800, 0xa013310b, 1 | BRF_ESS | BRF_PRG }, // 5 - { "gorkans5.rom", 0x0800, 0x122969b2, 1 | BRF_ESS | BRF_PRG }, // 6 - { "gorkans1.rom", 0x0800, 0xf2524b11, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "gorkgfx4.rom", 0x0800, 0x39cd0dbc, 2 | BRF_GRA }, // 8 Graphics - { "gorkgfx2.rom", 0x0800, 0x33d52535, 2 | BRF_GRA }, // 9 - { "gorkgfx3.rom", 0x0800, 0x4b6b7970, 2 | BRF_GRA }, // 10 - { "gorkgfx1.rom", 0x0800, 0xed70bb3c, 2 | BRF_GRA }, // 11 - - { "gorkprom.4", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "gorkprom.1", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "gorkprom.3", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "gorkprom.2", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(gorkans) -STD_ROM_FN(gorkans) - -struct BurnDriver BurnDrvgorkans = { - "gorkans", "mrtnt", NULL, NULL, "1983", - "Gorkans\0", NULL, "Techstar", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, gorkansRomInfo, gorkansRomName, NULL, NULL, eyesInputInfo, mrtntDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Eggor - -static struct BurnRomInfo eggorRomDesc[] = { - { "1.bin", 0x0800, 0x818ed154, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "5.bin", 0x0800, 0xa4b21d93, 1 | BRF_ESS | BRF_PRG }, // 1 - { "2.bin", 0x0800, 0x5d7a23ed, 1 | BRF_ESS | BRF_PRG }, // 2 - { "6.bin", 0x0800, 0xe9dbca8d, 1 | BRF_ESS | BRF_PRG }, // 3 - { "3.bin", 0x0800, 0x4318ab85, 1 | BRF_ESS | BRF_PRG }, // 4 - { "7.bin", 0x0800, 0x03214d7f, 1 | BRF_ESS | BRF_PRG }, // 5 - { "4.bin", 0x0800, 0xdc805be4, 1 | BRF_ESS | BRF_PRG }, // 6 - { "8.bin", 0x0800, 0xf9ae204b, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "9.bin", 0x0800, 0x96ad8626, 2 | BRF_GRA }, // 8 Graphics - { "11.bin", 0x0800, 0xcc324017, 2 | BRF_GRA }, // 9 - { "10.bin", 0x0800, 0x7c97f513, 2 | BRF_GRA }, // 10 - { "12.bin", 0x0800, 0x2e930602, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(eggor) -STD_ROM_FN(eggor) - -struct BurnDriver BurnDrveggor = { - "eggor", NULL, NULL, NULL, "1982", - "Eggor\0", NULL, "Telko", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, eggorRomInfo, eggorRomName, NULL, NULL, eyesInputInfo, mrtntDIPInfo, - eyesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - - -// Piranha - -static struct BurnRomInfo piranhaRomDesc[] = { - { "pir1.bin", 0x0800, 0x69a3e6ea, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pir5.bin", 0x0800, 0x245e753f, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pir2.bin", 0x0800, 0x62cb6954, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pir6.bin", 0x0800, 0xcb0700bc, 1 | BRF_ESS | BRF_PRG }, // 3 - { "pir3.bin", 0x0800, 0x843fbfe5, 1 | BRF_ESS | BRF_PRG }, // 4 - { "pir7.bin", 0x0800, 0x73084d5e, 1 | BRF_ESS | BRF_PRG }, // 5 - { "pir4.bin", 0x0800, 0x4cdf6704, 1 | BRF_ESS | BRF_PRG }, // 6 - { "pir8.bin", 0x0800, 0xb86fedb3, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "pir9.bin", 0x0800, 0x0f19eb28, 2 | BRF_GRA }, // 8 Graphics - { "pir11.bin", 0x0800, 0x5f8bdabe, 2 | BRF_GRA }, // 9 - { "pir10.bin", 0x0800, 0xd19399fb, 2 | BRF_GRA }, // 10 - { "pir12.bin", 0x0800, 0xcfb4403d, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Prom - { "piranha.4a", 0x0100, 0x08c9447b, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(piranha) -STD_ROM_FN(piranha) - -static INT32 piranhaInit() -{ - return DrvInit(StandardMap, eyes_decode, PIRANHA); -} - -struct BurnDriver BurnDrvpiranha = { - "piranha", "puckman", NULL, NULL, "1981", - "Piranha\0", NULL, "GL (US Billiards License)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, piranhaRomInfo, piranhaRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - piranhaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Piranha (older) - -static struct BurnRomInfo piranhaoRomDesc[] = { - { "p1.bin", 0x0800, 0xc6ce1bfc, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "p5.bin", 0x0800, 0xa2655a33, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pir2.bin", 0x0800, 0x62cb6954, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pir6.bin", 0x0800, 0xcb0700bc, 1 | BRF_ESS | BRF_PRG }, // 3 - { "pir3.bin", 0x0800, 0x843fbfe5, 1 | BRF_ESS | BRF_PRG }, // 4 - { "pir7.bin", 0x0800, 0x73084d5e, 1 | BRF_ESS | BRF_PRG }, // 5 - { "p4.bin", 0x0800, 0x9363a4d1, 1 | BRF_ESS | BRF_PRG }, // 6 - { "p8.bin", 0x0800, 0x2769979c, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "p9.bin", 0x0800, 0x94eb7563, 2 | BRF_GRA }, // 8 Graphics - { "p11.bin", 0x0800, 0xa3606973, 2 | BRF_GRA }, // 9 - { "p10.bin", 0x0800, 0x84165a2c, 2 | BRF_GRA }, // 10 - { "p12.bin", 0x0800, 0x2699ba9e, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "piranha.4a", 0x0100, 0x08c9447b, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(piranhao) -STD_ROM_FN(piranhao) - -struct BurnDriver BurnDrvpiranhao = { - "piranhao", "puckman", NULL, NULL, "1981", - "Piranha (older)\0", NULL, "GL (US Billiards License)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, piranhaoRomInfo, piranhaoRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - piranhaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Piranha (hack) - -static struct BurnRomInfo piranhahRomDesc[] = { - { "pr1.cpu", 0x1000, 0xbc5ad024, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 - { "pr3.cpu", 0x1000, 0x473c379d, 1 | BRF_ESS | BRF_PRG }, // 2 - { "pr4.cpu", 0x1000, 0x63fbf895, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "pr5.cpu", 0x0800, 0x3fc4030c, 2 | BRF_GRA }, // 4 Graphics - { "pr7.cpu", 0x0800, 0x30b9a010, 2 | BRF_GRA }, // 5 - { "pr6.cpu", 0x0800, 0xf3e9c9d5, 2 | BRF_GRA }, // 6 - { "pr8.cpu", 0x0800, 0x133d720d, 2 | BRF_GRA }, // 7 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Prom - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(piranhah) -STD_ROM_FN(piranhah) - -struct BurnDriver BurnDrvpiranhah = { - "piranhah", "puckman", NULL, NULL, "1981", - "Piranha (hack)\0", NULL, "hack", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, piranhahRomInfo, piranhahRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Abscam - -static struct BurnRomInfo abscamRomDesc[] = { - { "as0.bin", 0x0800, 0x0b102302, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "as4.bin", 0x0800, 0x3116a8ec, 1 | BRF_ESS | BRF_PRG }, // 1 - { "as1.bin", 0x0800, 0xbc0281e0, 1 | BRF_ESS | BRF_PRG }, // 2 - { "as5.bin", 0x0800, 0x428ee2e8, 1 | BRF_ESS | BRF_PRG }, // 3 - { "as2.bin", 0x0800, 0xe05d46ad, 1 | BRF_ESS | BRF_PRG }, // 4 - { "as6.bin", 0x0800, 0x3ae9a8cb, 1 | BRF_ESS | BRF_PRG }, // 5 - { "as3.bin", 0x0800, 0xb39eb940, 1 | BRF_ESS | BRF_PRG }, // 6 - { "as7.bin", 0x0800, 0x16cf1c67, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "as8.bin", 0x0800, 0x61daabe5, 2 | BRF_GRA }, // 8 Graphics - { "as10.bin", 0x0800, 0x81d50c98, 2 | BRF_GRA }, // 9 - { "as9.bin", 0x0800, 0xa3bd1613, 2 | BRF_GRA }, // 10 - { "as11.bin", 0x0800, 0x9d802b68, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "as4a.bin", 0x0100, 0x1605b324, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(abscam) -STD_ROM_FN(abscam) - -struct BurnDriver BurnDrvabscam = { - "abscam", "puckman", NULL, NULL, "1981", - "Abscam\0", NULL, "GL (US Billiards License)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, abscamRomInfo, abscamRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, - piranhaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Jump Shot - -static struct BurnRomInfo jumpshotRomDesc[] = { - { "6e", 0x1000, 0xf00def9a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "6f", 0x1000, 0xf70deae2, 1 | BRF_ESS | BRF_PRG }, // 1 - { "6h", 0x1000, 0x894d6f68, 1 | BRF_ESS | BRF_PRG }, // 2 - { "6j", 0x1000, 0xf15a108a, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "5e", 0x1000, 0xd9fa90f5, 2 | BRF_GRA }, // 4 Graphics - { "5f", 0x1000, 0x2ec711c1, 2 | BRF_GRA }, // 5 - - { "prom.7f", 0x0020, 0x872b42f3, 3 | BRF_GRA }, // 6 Color Prom - { "prom.4a", 0x0100, 0x0399f39f, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(jumpshot) -STD_ROM_FN(jumpshot) - -static UINT8 jumpshot_decrypt(INT32 addr, UINT8 e) -{ - static const UINT8 swap_xor_table[6][9] = { - { 7,6,5,4,3,2,1,0, 0x00 }, - { 7,6,3,4,5,2,1,0, 0x20 }, - { 5,0,4,3,7,1,2,6, 0xa4 }, - { 5,0,4,3,7,1,2,6, 0x8c }, - { 2,3,1,7,4,6,0,5, 0x6e }, - { 2,3,4,7,1,6,0,5, 0x4e } - }; - - static const INT32 picktable[32] = { - 0,2,4,4,4,2,0,2,2,0,2,4,4,2,0,2, - 5,3,5,1,5,3,5,3,1,5,1,5,5,3,5,3 - }; - - INT32 method = picktable[(addr & 0x001) | ((addr & 0x004) >> 1) | ((addr & 0x020) >> 3) | ((addr & 0x080) >> 4) |((addr & 0x200) >> 5)]; - - if ((addr & 0x800) == 0x800) - method ^= 1; - - const UINT8 *tbl = swap_xor_table[method]; - return BITSWAP08(e,tbl[0],tbl[1],tbl[2],tbl[3],tbl[4],tbl[5],tbl[6],tbl[7]) ^ tbl[8]; -} - -static void jumpshot_decode() -{ - for (INT32 i = 0; i < 0x4000; i++) { - DrvZ80ROM[i] = jumpshot_decrypt(i, DrvZ80ROM[i]); - } -} - -static INT32 jumpshotInit() -{ - return DrvInit(StandardMap, jumpshot_decode, PACMAN); -} - -struct BurnDriver BurnDrvjumpshot = { - "jumpshot", NULL, NULL, NULL, "1985", - "Jump Shot\0", NULL, "Bally Midway", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_SPORTSMISC, 0, - NULL, jumpshotRomInfo, jumpshotRomName, NULL, NULL, jumpshotInputInfo, jumpshotDIPInfo, - jumpshotInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Jump Shot Engineering Sample - -static struct BurnRomInfo jumpshotpRomDesc[] = { - { "js6e.bin", 0x1000, 0xacc5e15e, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "js6f.bin", 0x1000, 0x62b48ba4, 1 | BRF_ESS | BRF_PRG }, // 1 - { "js6h.bin", 0x1000, 0x7c9b5e30, 1 | BRF_ESS | BRF_PRG }, // 2 - { "js6j.bin", 0x1000, 0x9f0c39f6, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "5e", 0x1000, 0xd9fa90f5, 2 | BRF_GRA }, // 4 Graphics - { "5f", 0x1000, 0x2ec711c1, 2 | BRF_GRA }, // 5 - - { "prom.7f", 0x0020, 0x872b42f3, 3 | BRF_GRA }, // 6 Color Proms - { "prom.4a", 0x0100, 0x0399f39f, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(jumpshotp) -STD_ROM_FN(jumpshotp) - -struct BurnDriver BurnDrvjumpshotp = { - "jumpshotp", "jumpshot", NULL, NULL, "1985", - "Jump Shot Engineering Sample\0", NULL, "Bally Midway", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_SPORTSMISC, 0, - NULL, jumpshotpRomInfo, jumpshotpRomName, NULL, NULL, jumpshotInputInfo, jumpshtpDIPInfo, - jumpshotInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Shoot the Bull - -static struct BurnRomInfo shootbulRomDesc[] = { - { "sb6e.cpu", 0x1000, 0x25daa5e9, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "sb6f.cpu", 0x1000, 0x92144044, 1 | BRF_ESS | BRF_PRG }, // 1 - { "sb6h.cpu", 0x1000, 0x43b7f99d, 1 | BRF_ESS | BRF_PRG }, // 2 - { "sb6j.cpu", 0x1000, 0xbc4d3bbf, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "sb5e.cpu", 0x1000, 0x07c6c5aa, 2 | BRF_GRA }, // 4 Graphics - { "sb5f.cpu", 0x1000, 0xeaec6837, 2 | BRF_GRA }, // 5 - - { "7f.rom", 0x0020, 0xec578b98, 3 | BRF_GRA }, // 6 Color Proms - { "4a.rom", 0x0100, 0x81a6b30f, 3 | BRF_GRA }, // 7 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(shootbul) -STD_ROM_FN(shootbul) - -static INT32 shootbulInit() -{ - return DrvInit(StandardMap, jumpshot_decode, SHOOTBUL); -} - -struct BurnDriverD BurnDrvshootbul = { - "shootbul", NULL, NULL, NULL, "1985", - "Shoot the Bull\0", "Analog inputs not hooked up", "Bally Midway", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_SPORTSMISC, 0, - NULL, shootbulRomInfo, shootbulRomName, NULL, NULL, shootbulInputInfo, shootbulDIPInfo, - shootbulInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Cannon Ball (Pacman Hardware) - -static struct BurnRomInfo cannonbpRomDesc[] = { - { "n1-6e", 0x0800, 0xc68878c7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "n2-6k", 0x0800, 0xff3951a5, 1 | BRF_ESS | BRF_PRG }, // 1 - { "n3-6f", 0x0800, 0x2329079d, 1 | BRF_ESS | BRF_PRG }, // 2 - { "n4-6m", 0x0800, 0xfcc57ecb, 1 | BRF_ESS | BRF_PRG }, // 3 - { "n5-6h", 0x0800, 0x52846c9d, 1 | BRF_ESS | BRF_PRG }, // 4 - { "n6-6n", 0x0800, 0x59e890dd, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "z1-5e", 0x0800, 0x125779e0, 2 | BRF_GRA }, // 6 Graphics - { "z3-5h", 0x0800, 0x78f866c0, 2 | BRF_GRA }, // 7 - { "z2-5f", 0x0800, 0xfbd2c99d, 2 | BRF_GRA }, // 8 - { "z4-5j", 0x0800, 0x8734c904, 2 | BRF_GRA }, // 9 - - { "colorprom_1", 0x0020, 0x08f8ae7e, 3 | BRF_GRA }, // 10 Color Proms - { "colorprom_2", 0x0100, 0x359a15dc, 3 | BRF_GRA }, // 11 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 12 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom (not used) -}; - -STD_ROM_PICK(cannonbp) -STD_ROM_FN(cannonbp) - -static INT32 cannonbpInit() -{ - return DrvInit(CannonbpMap, NULL, CANNONBP); -} - -struct BurnDriver BurnDrvcannonbp = { - "cannonbp", NULL, NULL, NULL, "198?", - "Cannon Ball (Pacman Hardware)\0", "wrong colors", "Novomatic", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_BREAKOUT, 0, - NULL, cannonbpRomInfo, cannonbpRomName, NULL, NULL, cannonbpInputInfo, cannonbpDIPInfo, - cannonbpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Woodpecker (set 1) - -static struct BurnRomInfo woodpeckRomDesc[] = { - { "f.bin", 0x1000, 0x37ea66ca, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "i.bin", 0x1000, 0xcd115dba, 1 | BRF_ESS | BRF_PRG }, // 1 - { "e.bin", 0x1000, 0xd40b2321, 1 | BRF_ESS | BRF_PRG }, // 2 - { "g.bin", 0x1000, 0x024092f4, 1 | BRF_ESS | BRF_PRG }, // 3 - { "h.bin", 0x1000, 0x18ef0fc8, 1 | BRF_ESS | BRF_PRG }, // 4 - - { "a.5e", 0x0800, 0x15a87f62, 2 | BRF_GRA }, // 5 Graphics - { "c.5h", 0x0800, 0xab4abd88, 2 | BRF_GRA }, // 6 - { "b.5f", 0x0800, 0x5b9ba95b, 2 | BRF_GRA }, // 7 - { "d.5j", 0x0800, 0xd7b80a45, 2 | BRF_GRA }, // 8 - - { "pr.8h", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Prom - { "pr.4a", 0x0100, 0xd8772167, 3 | BRF_GRA }, // 10 - - { "pr.1k", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 11 Sound Prom - { "pr.3k", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 12 Timing Prom (not used) -}; - -STD_ROM_PICK(woodpeck) -STD_ROM_FN(woodpeck) - -static void woodpeckCallback() -{ - memcpy (DrvZ80ROM + 0xb000, DrvZ80ROM + 0x8000, 0x1000); - memcpy (DrvZ80ROM + 0x8000, DrvZ80ROM + 0x1000, 0x3000); - - memset (DrvZ80ROM + 0x1000, 0, 0x3000); - - for (INT32 i = 0; i < 0x2000; i += 8) - eyes_gfx_decode(DrvGfxROM + i); -} - -static INT32 woodpeckInit() -{ - return DrvInit(WoodpekMap, woodpeckCallback, PACMAN); -} - -struct BurnDriver BurnDrvwoodpeck = { - "woodpeck", NULL, NULL, NULL, "1981", - "Woodpecker (set 1)\0", NULL, "Amenip (Palcom Queen River)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, - NULL, woodpeckRomInfo, woodpeckRomName, NULL, NULL, woodpekInputInfo, woodpekDIPInfo, - woodpeckInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Woodpecker (set 2) - -static struct BurnRomInfo woodpekaRomDesc[] = { - { "0", 0x1000, 0xb5ee8bca, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "1", 0x1000, 0xc5ec2de6, 1 | BRF_PRG | BRF_ESS }, // 1 - { "2", 0x1000, 0x07ea534e, 1 | BRF_PRG | BRF_ESS }, // 2 - { "3", 0x1000, 0xa3a3253a, 1 | BRF_PRG | BRF_ESS }, // 3 - { "4", 0x1000, 0x6c50546b, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "10.5f", 0x1000, 0x0bf52102, 2 | BRF_GRA }, // 5 Graphics - { "11.5h", 0x1000, 0x0ed8def8, 2 | BRF_GRA }, // 6 - - { "pr.8h", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 7 Color Proms - { "pr.4a", 0x0100, 0xd8772167, 3 | BRF_GRA }, // 8 - - { "pr.1k", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 9 - { "pr.3k", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 10 Timing Prom (not used) -}; - -STD_ROM_PICK(woodpeka) -STD_ROM_FN(woodpeka) - -struct BurnDriver BurnDrvwoodpeka = { - "woodpeca", "woodpeck", NULL, NULL, "1981", - "Woodpecker (set 2)\0", NULL, "Amenip (Palcom Queen River)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, - NULL, woodpekaRomInfo, woodpekaRomName, NULL, NULL, woodpekInputInfo, woodpekDIPInfo, - woodpeckInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Lizard Wizard - -static struct BurnRomInfo lizwizRomDesc[] = { - { "6e.cpu", 0x1000, 0x32bc1990, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "6f.cpu", 0x1000, 0xef24b414, 1 | BRF_ESS | BRF_PRG }, // 1 - { "6h.cpu", 0x1000, 0x30bed83d, 1 | BRF_ESS | BRF_PRG }, // 2 - { "6j.cpu", 0x1000, 0xdd09baeb, 1 | BRF_ESS | BRF_PRG }, // 3 - { "wiza", 0x1000, 0xf6dea3a6, 1 | BRF_ESS | BRF_PRG }, // 4 - { "wizb", 0x1000, 0xf27fb5a8, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "5e.cpu", 0x1000, 0x45059e73, 2 | BRF_GRA }, // 6 Graphics - { "5f.cpu", 0x1000, 0xd2469717, 2 | BRF_GRA }, // 7 - - { "7f.cpu", 0x0020, 0x7549a947, 3 | BRF_GRA }, // 8 Color Proms - { "4a.cpu", 0x0100, 0x5fdca536, 3 | BRF_GRA }, // 9 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) -}; - -STD_ROM_PICK(lizwiz) -STD_ROM_FN(lizwiz) - -static INT32 lizwizInit() -{ - return DrvInit(WoodpekMap, NULL, PACMAN); -} - -struct BurnDriver BurnDrvlizwiz = { - "lizwiz", NULL, NULL, NULL, "1985", - "Lizard Wizard\0", NULL, "Techstar (Sunn license)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_SHOOT, 0, - NULL, lizwizRomInfo, lizwizRomName, NULL, NULL, lizwizInputInfo, lizwizDIPInfo, - lizwizInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Ponpoko - -static struct BurnRomInfo ponpokoRomDesc[] = { - { "ppokoj1.bin", 0x1000, 0xffa3c004, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ppokoj2.bin", 0x1000, 0x4a496866, 1 | BRF_ESS | BRF_PRG }, // 1 - { "ppokoj3.bin", 0x1000, 0x17da6ca3, 1 | BRF_ESS | BRF_PRG }, // 2 - { "ppokoj4.bin", 0x1000, 0x9d39a565, 1 | BRF_ESS | BRF_PRG }, // 3 - { "ppoko5.bin", 0x1000, 0x54ca3d7d, 1 | BRF_ESS | BRF_PRG }, // 4 - { "ppoko6.bin", 0x1000, 0x3055c7e0, 1 | BRF_ESS | BRF_PRG }, // 5 - { "ppoko7.bin", 0x1000, 0x3cbe47ca, 1 | BRF_ESS | BRF_PRG }, // 6 - { "ppokoj8.bin", 0x1000, 0x04b63fc6, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "ppoko9.bin", 0x1000, 0xb73e1a06, 2 | BRF_GRA }, // 8 Graphics - { "ppoko10.bin", 0x1000, 0x62069b5d, 2 | BRF_GRA }, // 9 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 10 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 11 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 12 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom (not used) -}; - -STD_ROM_PICK(ponpoko) -STD_ROM_FN(ponpoko) - -static void ponpoko_decode() -{ - for (INT32 i = 0; i < 0x1000; i += 0x10) // Characters - { - for (INT32 j = 0; j < 8; j++) - { - INT32 t = DrvGfxROM[i+j+0x08]; - DrvGfxROM[i+j+0x08] = DrvGfxROM[i+j+0x00]; - DrvGfxROM[i+j+0x00] = t; - } - } - - for (INT32 i = 0x1000; i < 0x2000; i += 0x20) // Sprites - { - for (INT32 j = 0; j < 8; j++) - { - INT32 t = DrvGfxROM[i+j+0x18]; - DrvGfxROM[i+j+0x18] = DrvGfxROM[i+j+0x10]; - DrvGfxROM[i+j+0x10] = DrvGfxROM[i+j+0x08]; - DrvGfxROM[i+j+0x08] = DrvGfxROM[i+j+0x00]; - DrvGfxROM[i+j+0x00] = t; - } - } -} - -static INT32 ponpokoInit() -{ - return DrvInit(WoodpekMap, ponpoko_decode, PACMAN); -} - -struct BurnDriver BurnDrvponpoko = { - "ponpoko", NULL, NULL, NULL, "1982", - "Ponpoko\0", NULL, "Sigma Enterprises Inc.", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, - NULL, ponpokoRomInfo, ponpokoRomName, NULL, NULL, ponpokoInputInfo, ponpokoDIPInfo, - ponpokoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 288, 224, 4, 3 -}; - - -// Ponpoko (Venture Line) - -static struct BurnRomInfo ponpokovRomDesc[] = { - { "ppoko1.bin", 0x1000, 0x49077667, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ppoko2.bin", 0x1000, 0x5101781a, 1 | BRF_ESS | BRF_PRG }, // 1 - { "ppoko3.bin", 0x1000, 0xd790ed22, 1 | BRF_ESS | BRF_PRG }, // 2 - { "ppoko4.bin", 0x1000, 0x4e449069, 1 | BRF_ESS | BRF_PRG }, // 3 - { "ppoko5.bin", 0x1000, 0x54ca3d7d, 1 | BRF_ESS | BRF_PRG }, // 4 - { "ppoko6.bin", 0x1000, 0x3055c7e0, 1 | BRF_ESS | BRF_PRG }, // 5 - { "ppoko7.bin", 0x1000, 0x3cbe47ca, 1 | BRF_ESS | BRF_PRG }, // 6 - { "ppoko8.bin", 0x1000, 0xb39be27d, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "ppoko9.bin", 0x1000, 0xb73e1a06, 2 | BRF_GRA }, // 8 Graphics - { "ppoko10.bin", 0x1000, 0x62069b5d, 2 | BRF_GRA }, // 9 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 10 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 11 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 12 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom (not used) -}; - -STD_ROM_PICK(ponpokov) -STD_ROM_FN(ponpokov) - -struct BurnDriver BurnDrvponpokov = { - "ponpokov", "ponpoko", NULL, NULL, "1982", - "Ponpoko (Venture Line)\0", NULL, "Sigma Enterprises Inc. (Venture Line license)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, - NULL, ponpokovRomInfo, ponpokovRomName, NULL, NULL, ponpokoInputInfo, ponpokoDIPInfo, - ponpokoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 288, 224, 4, 3 -}; - - -// The Glob (Pac-Man hardware) - -static struct BurnRomInfo theglobpRomDesc[] = { - { "glob.u2", 0x2000, 0x829d0bea, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "glob.u3", 0x2000, 0x31de6628, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "glob.5e", 0x1000, 0x53688260, 2 | BRF_GRA }, // 2 Graphics - { "glob.5f", 0x1000, 0x051f59c7, 2 | BRF_GRA }, // 3 - - { "glob.7f", 0x0020, 0x1f617527, 3 | BRF_GRA }, // 4 Color Proms - { "glob.4a", 0x0100, 0x28faa769, 3 | BRF_GRA }, // 5 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 6 Sound Prom - { "82s126.3m" , 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 7 Timing Prom (not used) -}; - -STD_ROM_PICK(theglobp) -STD_ROM_FN(theglobp) - -static void theglobp_decrypt() -{ - for (INT32 i = 0; i < 0x4000; i++) { - DrvZ80ROM[0x10000 + i] = BITSWAP08(DrvZ80ROM[i] ^ 0xfc, 3, 7, 0, 6, 4, 1, 2, 5); - DrvZ80ROM[0x14000 + i] = BITSWAP08(DrvZ80ROM[i] ^ 0xf6, 1, 7, 0, 3, 4, 6, 2, 5); - DrvZ80ROM[0x18000 + i] = BITSWAP08(DrvZ80ROM[i] ^ 0x7d, 3, 0, 4, 6, 7, 1, 2, 5); - DrvZ80ROM[0x1c000 + i] = BITSWAP08(DrvZ80ROM[i] ^ 0x77, 1, 0, 4, 3, 7, 6, 2, 5); - } -} - -static INT32 theglobpInit() -{ - return DrvInit(StandardMap, theglobp_decrypt, EPOS); -} - -struct BurnDriver BurnDrvtheglobp = { - "theglobp", "suprglob", NULL, NULL, "1983", - "The Glob (Pac-Man hardware)\0", NULL, "Epos Corporation", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, - NULL, theglobpRomInfo, theglobpRomName, NULL, NULL, theglobpInputInfo, theglobpDIPInfo, - theglobpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Super Glob (Pac-Man hardware) - -static struct BurnRomInfo sprglobpRomDesc[] = { - { "glob.u2", 0x2000, 0x829d0bea, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "glob.u3", 0x2000, 0x31de6628, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "5e_2532.dat", 0x1000, 0x1aa16109, 2 | BRF_GRA }, // 2 Graphics - { "5f_2532.dat", 0x1000, 0xafe72a89, 2 | BRF_GRA }, // 3 - - { "glob.7f", 0x0020, 0x1f617527, 3 | BRF_GRA }, // 4 Color Prom - { "glob.4a", 0x0100, 0x28faa769, 3 | BRF_GRA }, // 5 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 6 Sound Prom - { "82s126.3m" , 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 7 Timing Prom (not used) -}; - -STD_ROM_PICK(sprglobp) -STD_ROM_FN(sprglobp) - -struct BurnDriver BurnDrvsprglobp = { - "sprglobp", "suprglob", NULL, NULL, "1983", - "Super Glob (Pac-Man hardware)\0", NULL, "Epos Corporation", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, - NULL, sprglobpRomInfo, sprglobpRomName, NULL, NULL, theglobpInputInfo, theglobpDIPInfo, - theglobpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Super Glob (Pac-Man hardware) German - -static struct BurnRomInfo sprglbpgRomDesc[] = { - { "ic8.1", 0x1000, 0xa2df2073, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ic7.2", 0x1000, 0x3d2c22d9, 1 | BRF_ESS | BRF_PRG }, // 1 - { "ic15.3", 0x1000, 0xa252047f, 1 | BRF_ESS | BRF_PRG }, // 2 - { "ic14.4", 0x1000, 0x7efa81f1, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "ic92.5", 0x2000, 0xE54F484D, 2 | BRF_GRA }, // 4 Graphics - - { "ic78.prm", 0x0020, 0x1f617527, 3 | BRF_GRA }, // 5 Color Prom - { "ic88.prm", 0x0100, 0x28faa769, 3 | BRF_GRA }, // 6 - - { "ic51.prm", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 7 Sound Prom - { "ic70.prm" , 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 8 Timing Prom (not used) -}; - -STD_ROM_PICK(sprglbpg) -STD_ROM_FN(sprglbpg) - -struct BurnDriver BurnDrvsprglbpg = { - "sprglbpg", "suprglob", NULL, NULL, "1983", - "Super Glob (Pac-Man hardware) German\0", NULL, "bootleg", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, - NULL, sprglbpgRomInfo, sprglbpgRomName, NULL, NULL, theglobpInputInfo, theglobpDIPInfo, - puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Beastie Feastie - -static struct BurnRomInfo beastfRomDesc[] = { - { "bf-u2.bin", 0x2000, 0x3afc517b, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "bf-u3.bin", 0x2000, 0x8dbd76d0, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "beastf.5e", 0x1000, 0x5654dc34, 2 | BRF_GRA }, // 2 Graphics - { "beastf.5f", 0x1000, 0x1b30ca61, 2 | BRF_GRA }, // 3 - - { "glob.7f", 0x0020, 0x1f617527, 3 | BRF_GRA }, // 4 Color Proms - { "glob.4a", 0x0100, 0x28faa769, 3 | BRF_GRA }, // 5 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 6 Sound Prom - { "82s126.3m" , 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 7 Timing Prom (not used) -}; - -STD_ROM_PICK(beastf) -STD_ROM_FN(beastf) - -struct BurnDriver BurnDrvbeastf = { - "beastf", "suprglob", NULL, NULL, "1984", - "Beastie Feastie\0", NULL, "Epos Corporation", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, - NULL, beastfRomInfo, beastfRomName, NULL, NULL, theglobpInputInfo, theglobpDIPInfo, - theglobpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Van-Van Car - -static struct BurnRomInfo vanvanRomDesc[] = { - { "van-1.50", 0x1000, 0xcf1b2df0, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "van-2.51", 0x1000, 0xdf58e1cb, 1 | BRF_ESS | BRF_PRG }, // 1 - { "van-3.52", 0x1000, 0x15571e24, 1 | BRF_ESS | BRF_PRG }, // 2 - { "van-4.53", 0x1000, 0xb724cbe0, 1 | BRF_ESS | BRF_PRG }, // 3 - { "van-5.39", 0x1000, 0xdb67414c, 1 | BRF_ESS | BRF_PRG }, // 4 - - { "van-20.18", 0x1000, 0x60efbe66, 2 | BRF_GRA }, // 5 Graphics - { "van-21.19", 0x1000, 0x5dd53723, 2 | BRF_GRA }, // 6 - - { "6331-1.6", 0x0020, 0xce1d9503, 3 | BRF_GRA }, // 7 Color Proms - { "6301-1.37", 0x0100, 0x4b803d9f, 3 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(vanvan) -STD_ROM_FN(vanvan) - -static void vanvanCallback() -{ - memcpy (DrvZ80ROM + 0x9000, DrvZ80ROM + 0x8000, 0x1000); - memcpy (DrvZ80ROM + 0xa000, DrvZ80ROM + 0x8000, 0x1000); - memcpy (DrvZ80ROM + 0xb000, DrvZ80ROM + 0x8000, 0x1000); -} - -static INT32 vanvanInit() -{ - return DrvInit(DremshprMap, vanvanCallback, VANVAN); -} - -struct BurnDriver BurnDrvvanvan = { - "vanvan", NULL, NULL, NULL, "1983", - "Van-Van Car\0", NULL, "Sanritsu", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, vanvanRomInfo, vanvanRomName, NULL, NULL, vanvanInputInfo, vanvanDIPInfo, - vanvanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Van-Van Car (Karateco) - -static struct BurnRomInfo vanvankRomDesc[] = { - { "van1.bin", 0x1000, 0x00f48295, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "van-2.51", 0x1000, 0xdf58e1cb, 1 | BRF_ESS | BRF_PRG }, // 1 - { "van-3.52", 0x1000, 0x15571e24, 1 | BRF_ESS | BRF_PRG }, // 2 - { "van4.bin", 0x1000, 0xf8b37ed5, 1 | BRF_ESS | BRF_PRG }, // 3 - { "van5.bin", 0x1000, 0xb8c1e089, 1 | BRF_ESS | BRF_PRG }, // 4 - - { "van-20.18", 0x1000, 0x60efbe66, 2 | BRF_GRA }, // 5 Graphics - { "van-21.19", 0x1000, 0x5dd53723, 2 | BRF_GRA }, // 6 - - { "6331-1.6", 0x0020, 0xce1d9503, 3 | BRF_GRA }, // 7 Color Proms - { "6301-1.37", 0x0100, 0x4b803d9f, 3 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(vanvank) -STD_ROM_FN(vanvank) - -struct BurnDriver BurnDrvvanvank = { - "vanvank", "vanvan", NULL, NULL, "1983", - "Van-Van Car (Karateco)\0", NULL, "Karateco", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, vanvankRomInfo, vanvankRomName, NULL, NULL, vanvankInputInfo, vanvanDIPInfo, - vanvanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Van-Van Car (set 3) - -static struct BurnRomInfo vanvanbRomDesc[] = { - { "vv1.bin", 0x1000, 0xcf1b2df0, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "vv2.bin", 0x1000, 0x80eca6a5, 1 | BRF_ESS | BRF_PRG }, // 1 - { "vv3.bin", 0x1000, 0x15571e24, 1 | BRF_ESS | BRF_PRG }, // 2 - { "vv4.bin", 0x1000, 0xb1f04006, 1 | BRF_ESS | BRF_PRG }, // 3 - { "vv5.bin", 0x1000, 0xdb67414c, 1 | BRF_ESS | BRF_PRG }, // 4 - - { "vv20.bin", 0x1000, 0xeb56cb51, 2 | BRF_GRA }, // 5 Graphics - { "vv21.bin", 0x1000, 0x5dd53723, 2 | BRF_GRA }, // 6 - - { "6331-1.6", 0x0020, 0xce1d9503, 3 | BRF_GRA }, // 7 Color Proms - { "6301-1.37", 0x0100, 0x4b803d9f, 3 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(vanvanb) -STD_ROM_FN(vanvanb) - -struct BurnDriver BurnDrvvanvanb = { - "vanvanb", "vanvan", NULL, NULL, "1983", - "Van-Van Car (set 3)\0", NULL, "Karateco", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, vanvanbRomInfo, vanvanbRomName, NULL, NULL, vanvankInputInfo, vanvanDIPInfo, - vanvanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Naughty Mouse (set 1) - -static struct BurnRomInfo nmouseRomDesc[] = { - { "naumouse.d7", 0x0800, 0xe447ecfa, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "naumouse.d6", 0x0800, 0x2e6f13d9, 1 | BRF_ESS | BRF_PRG }, // 1 - { "naumouse.e7", 0x0800, 0x44a80f97, 1 | BRF_ESS | BRF_PRG }, // 2 - { "naumouse.e6", 0x0800, 0x9c7a46bd, 1 | BRF_ESS | BRF_PRG }, // 3 - { "naumouse.h7", 0x0800, 0x5bc94c5d, 1 | BRF_ESS | BRF_PRG }, // 4 - { "naumouse.h6", 0x0800, 0x1af29e22, 1 | BRF_ESS | BRF_PRG }, // 5 - { "naumouse.j7", 0x0800, 0xcc3be185, 1 | BRF_ESS | BRF_PRG }, // 6 - { "naumouse.j6", 0x0800, 0x66b3e5dc, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "naumouse.d5", 0x0800, 0x2ea7cc3f, 2 | BRF_GRA }, // 8 Graphics - { "naumouse.h5", 0x0800, 0x0511fcea, 2 | BRF_GRA }, // 9 - { "naumouse.e5", 0x0800, 0xf5a627cd, 2 | BRF_GRA }, // 10 - { "naumouse.j5", 0x0800, 0x65f2580e, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "naumouse.a4", 0x0100, 0xd8772167, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(nmouse) -STD_ROM_FN(nmouse) - -static INT32 nmouseInit() -{ - return DrvInit(StandardMap, eyes_decode, NMOUSE); -} - -struct BurnDriver BurnDrvnmouse = { - "nmouse", NULL, NULL, NULL, "1981", - "Naughty Mouse (set 1)\0", NULL, "Amenip (Palcom Queen River)", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, - NULL, nmouseRomInfo, nmouseRomName, NULL, NULL, DrvInputInfo, nmouseDIPInfo, - nmouseInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Naughty Mouse (set 2) - -static struct BurnRomInfo nmousebRomDesc[] = { - { "naumouse.d7", 0x0800, 0xe447ecfa, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "naumouse.d6", 0x0800, 0x2e6f13d9, 1 | BRF_ESS | BRF_PRG }, // 1 - { "naumouse.e7", 0x0800, 0x44a80f97, 1 | BRF_ESS | BRF_PRG }, // 2 - { "naumouse.e6", 0x0800, 0x9c7a46bd, 1 | BRF_ESS | BRF_PRG }, // 3 - { "snatch2.bin", 0x0800, 0x405aa389, 1 | BRF_ESS | BRF_PRG }, // 4 - { "snatch6.bin", 0x0800, 0xf58e7df4, 1 | BRF_ESS | BRF_PRG }, // 5 - { "snatch3.bin", 0x0800, 0x06fb18ec, 1 | BRF_ESS | BRF_PRG }, // 6 - { "snatch7.bin", 0x0800, 0xd187b82b, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "naumouse.d5", 0x0800, 0x2ea7cc3f, 2 | BRF_GRA }, // 8 Graphics - { "naumouse.h5", 0x0800, 0x0511fcea, 2 | BRF_GRA }, // 9 - { "naumouse.e5", 0x0800, 0xf5a627cd, 2 | BRF_GRA }, // 10 - { "snatch11.bin", 0x0800, 0x330230a5, 2 | BRF_GRA }, // 11 - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms - { "naumouse.a4", 0x0100, 0xd8772167, 3 | BRF_GRA }, // 13 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) -}; - -STD_ROM_PICK(nmouseb) -STD_ROM_FN(nmouseb) - -struct BurnDriver BurnDrvnmouseb = { - "nmouseb", "nmouse", NULL, NULL, "1981", - "Naughty Mouse (set 2)\0", NULL, "Amenip Nova Games Ltd.", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, - NULL, nmousebRomInfo, nmousebRomName, NULL, NULL, DrvInputInfo, nmouseDIPInfo, - nmouseInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Dream Shopper - -static struct BurnRomInfo dremshprRomDesc[] = { - { "red_1.50", 0x1000, 0x830c6361, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "red_2.51", 0x1000, 0xd22551cc, 1 | BRF_ESS | BRF_PRG }, // 1 - { "red_3.52", 0x1000, 0x0713a34a, 1 | BRF_ESS | BRF_PRG }, // 2 - { "red_4.53", 0x1000, 0xf38bcaaa, 1 | BRF_ESS | BRF_PRG }, // 3 - { "red_5.39", 0x1000, 0x6a382267, 1 | BRF_ESS | BRF_PRG }, // 4 - { "red_6.40", 0x1000, 0x4cf8b121, 1 | BRF_ESS | BRF_PRG }, // 5 - { "red_7.41", 0x1000, 0xbd4fc4ba, 1 | BRF_ESS | BRF_PRG }, // 6 - - { "red-20.18", 0x1000, 0x2d6698dc, 2 | BRF_GRA }, // 7 Graphics - { "red-21.19", 0x1000, 0x38c9ce9b, 2 | BRF_GRA }, // 8 - - { "6331-1.6", 0x0020, 0xce1d9503, 3 | BRF_GRA }, // 9 Color Proms - { "6301-1.37", 0x0100, 0x39d6fb5c, 3 | BRF_GRA }, // 10 - - // Uses AY8910 -}; - -STD_ROM_PICK(dremshpr) -STD_ROM_FN(dremshpr) - -static INT32 dremshprInit() -{ - return DrvInit(DremshprMap, NULL, DREMSHPR); -} - -struct BurnDriver BurnDrvdremshpr = { - "dremshpr", NULL, NULL, NULL, "1982", - "Dream Shopper\0", NULL, "Sanritsu", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_PUZZLE, 0, - NULL, dremshprRomInfo, dremshprRomName, NULL, NULL, dremshprInputInfo, dremshprDIPInfo, - dremshprInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Boardwalk Casino - -static struct BurnRomInfo bwcasinoRomDesc[] = { - { "bwc_u2.bin", 0x2000, 0xe2eea868, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "bwc_u3.bin", 0x2000, 0xa935571e, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "bwc_5e.bin", 0x1000, 0xe334c01e, 2 | BRF_GRA }, // 2 Graphics - - { "aca_7f.bin", 0x0020, 0x133bb744, 3 | BRF_GRA }, // 3 Color Proms - { "aca_4a.bin", 0x0100, 0x8e29208f, 3 | BRF_GRA }, // 4 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 5 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 6 Timing Prom (not used) -}; - -STD_ROM_PICK(bwcasino) -STD_ROM_FN(bwcasino) - -static void acitya_decode() -{ - for (INT32 i = 0; i < 0x4000; i++) { - DrvZ80ROM[i + 0x10000] = BITSWAP08(DrvZ80ROM[i] ^ 0xb5, 1, 6, 7, 3, 4, 0, 2, 5); - DrvZ80ROM[i + 0x14000] = BITSWAP08(DrvZ80ROM[i] ^ 0xa7, 7, 6, 1, 3, 4, 0, 2, 5); - DrvZ80ROM[i + 0x18000] = BITSWAP08(DrvZ80ROM[i] ^ 0xfc, 1, 0, 7, 6, 4, 3, 2, 5); - DrvZ80ROM[i + 0x1c000] = BITSWAP08(DrvZ80ROM[i] ^ 0xee, 7, 0, 1, 6, 4, 3, 2, 5); - } -} - -static INT32 acityaInit() -{ - acitya = 1; - - return DrvInit(StandardMap, acitya_decode, EPOS); -} - -struct BurnDriver BurnDrvbwcasino = { - "bwcasino", NULL, NULL, NULL, "1983", - "Boardwalk Casino\0", NULL, "EPOS Corporation", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_CASINO, 0, - NULL, bwcasinoRomInfo, bwcasinoRomName, NULL, NULL, bwcasinoInputInfo, bwcasinoDIPInfo, - acityaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Atlantic City Action - -static struct BurnRomInfo acityaRomDesc[] = { - { "aca_u2.bin", 0x2000, 0x261c2fdc, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "aca_u3.bin", 0x2000, 0x05fab4ca, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "aca_5e.bin", 0x1000, 0x7f2dd2c9, 2 | BRF_GRA }, // 2 Graphics - - { "aca_7f.bin", 0x0020, 0x133bb744, 3 | BRF_GRA }, // 3 Color Proms - { "aca_4a.bin", 0x0100, 0x8e29208f, 3 | BRF_GRA }, // 4 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 5 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 6 Timing Prom (not used) -}; - -STD_ROM_PICK(acitya) -STD_ROM_FN(acitya) - -struct BurnDriver BurnDrvacitya = { - "acitya", "bwcasino", NULL, NULL, "1983", - "Atlantic City Action\0", NULL, "EPOS Corporation", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_CASINO, 0, - NULL, acityaRomInfo, acityaRomName, NULL, NULL, acityaInputInfo, acityaDIPInfo, - acityaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Big Bucks - -static struct BurnRomInfo bigbucksRomDesc[] = { - { "p.rom", 0x4000, 0xeea6c1c9, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "m.rom", 0x2000, 0xbb8f7363, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "5e.cpu", 0x1000, 0x18442c37, 2 | BRF_GRA }, // 2 Graphics - - { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 3 Color Proms - { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 4 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 5 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 6 Timing Prom - - { "rom1.rom", 0x8000, 0x90b7785f, 7 | BRF_PRG | BRF_ESS }, // 7 Question Roms - { "rom2.rom", 0x8000, 0x60172d77, 7 | BRF_PRG | BRF_ESS }, // 8 - { "rom3.rom", 0x8000, 0xa2207320, 7 | BRF_PRG | BRF_ESS }, // 9 - { "rom4.rom", 0x8000, 0x5a74c1f9, 7 | BRF_PRG | BRF_ESS }, // 10 - { "rom5.rom", 0x8000, 0x93bc1080, 7 | BRF_PRG | BRF_ESS }, // 11 - { "rom6.rom", 0x8000, 0xeea2423f, 7 | BRF_PRG | BRF_ESS }, // 12 - { "rom7.rom", 0x8000, 0x96694055, 7 | BRF_PRG | BRF_ESS }, // 13 - { "rom8.rom", 0x8000, 0xe68ebf8e, 7 | BRF_PRG | BRF_ESS }, // 14 - { "rom9.rom", 0x8000, 0xfd20921d, 7 | BRF_PRG | BRF_ESS }, // 15 - { "rom10.rom", 0x8000, 0x5091b951, 7 | BRF_PRG | BRF_ESS }, // 16 - { "rom11.rom", 0x8000, 0x705128db, 7 | BRF_PRG | BRF_ESS }, // 17 - { "rom12.rom", 0x8000, 0x74c776e7, 7 | BRF_PRG | BRF_ESS }, // 18 -}; - -STD_ROM_PICK(bigbucks) -STD_ROM_FN(bigbucks) - -static INT32 bigbucksInit() -{ - return DrvInit(BigbucksMap, NULL, BIGBUCKS); -} - -struct BurnDriver BurnDrvbigbucks = { - "bigbucks", NULL, NULL, NULL, "1986", - "Big Bucks\0", NULL, "Dynasoft Inc.", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_QUIZ, 0, - NULL, bigbucksRomInfo, bigbucksRomName, NULL, NULL, bigbucksInputInfo, bigbucksDIPInfo, - bigbucksInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// MTV Rock-N-Roll Trivia (Part 2) - -static struct BurnRomInfo rocktrv2RomDesc[] = { - { "1.aux", 0x4000, 0xd182947b, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "2.aux", 0x2000, 0x27a7461d, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "5e.cpu", 0x1000, 0x0a6cc43b, 2 | BRF_GRA }, // 2 Graphics - - { "7f.cpu", 0x0020, 0x7549a947, 3 | BRF_GRA }, // 3 Color Proms - { "4a.cpu", 0x0100, 0xddd5d88e, 3 | BRF_GRA }, // 4 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 5 Sound Prom - { "82s126.3m" , 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 6 Timing Prom (not used) - - { "3.aux", 0x4000, 0x5b117ca6, 7 | BRF_PRG | BRF_ESS }, // 7 Question Roms - { "4.aux", 0x4000, 0x81bfd4c3, 7 | BRF_PRG | BRF_ESS }, // 8 - { "5.aux", 0x4000, 0xe976423c, 7 | BRF_PRG | BRF_ESS }, // 9 - { "6.aux", 0x4000, 0x425946bf, 7 | BRF_PRG | BRF_ESS }, // 10 - { "7.aux", 0x4000, 0x7056fc8f, 7 | BRF_PRG | BRF_ESS }, // 11 - { "8.aux", 0x4000, 0x8b86464f, 7 | BRF_PRG | BRF_ESS }, // 12 - { "9.aux", 0x4000, 0x17d8eba4, 7 | BRF_PRG | BRF_ESS }, // 13 - { "10.aux", 0x4000, 0x398c8eb4, 7 | BRF_PRG | BRF_ESS }, // 14 - { "11.aux", 0x4000, 0x7f376424, 7 | BRF_PRG | BRF_ESS }, // 15 - { "12.aux", 0x4000, 0x8d5bbf81, 7 | BRF_PRG | BRF_ESS }, // 16 - { "13.aux", 0x4000, 0x99fe2c21, 7 | BRF_PRG | BRF_ESS }, // 17 - { "14.aux", 0x4000, 0xdf4cf5e7, 7 | BRF_PRG | BRF_ESS }, // 18 - { "15.aux", 0x4000, 0x2a32de26, 7 | BRF_PRG | BRF_ESS }, // 19 - { "16.aux", 0x4000, 0xfcd42187, 7 | BRF_PRG | BRF_ESS }, // 20 - { "17.aux", 0x4000, 0x24d5c388, 7 | BRF_PRG | BRF_ESS }, // 21 - { "18.aux", 0x4000, 0xfeb195fd, 7 | BRF_PRG | BRF_ESS }, // 22 -}; - -STD_ROM_PICK(rocktrv2) -STD_ROM_FN(rocktrv2) - -static void rocktrv2Callback() -{ - DrvZ80ROM[0x9ffe] = 0xa7; - DrvZ80ROM[0x9fee] = 0x6d; -} - -static INT32 rocktrv2Init() -{ - return DrvInit(Rocktrv2Map, rocktrv2Callback, ROCKTRV2); -} - -struct BurnDriver BurnDrvrocktrv2 = { - "rocktrv2", NULL, NULL, NULL, "1986", - "MTV Rock-N-Roll Trivia (Part 2)\0", NULL, "Triumph Software Inc.", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_QUIZ, 0, - NULL, rocktrv2RomInfo, rocktrv2RomName, NULL, NULL, rocktrv2InputInfo, rocktrv2DIPInfo, - rocktrv2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Ali Baba and 40 Thieves - -static struct BurnRomInfo alibabaRomDesc[] = { - { "6e", 0x1000, 0x38d701aa, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "6f", 0x1000, 0x3d0e35f3, 1 | BRF_ESS | BRF_PRG }, // 1 - { "6h", 0x1000, 0x823bee89, 1 | BRF_ESS | BRF_PRG }, // 2 - { "6k", 0x1000, 0x474d032f, 1 | BRF_ESS | BRF_PRG }, // 3 - { "6l", 0x1000, 0x5ab315c1, 1 | BRF_ESS | BRF_PRG }, // 4 - { "6m", 0x0800, 0x438d0357, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "5e", 0x0800, 0x85bcb8f8, 2 | BRF_GRA }, // 6 Graphics - { "5h", 0x0800, 0x38e50862, 2 | BRF_GRA }, // 7 - { "5f", 0x0800, 0xb5715c86, 2 | BRF_GRA }, // 8 - { "5k", 0x0800, 0x713086b3, 2 | BRF_GRA }, // 9 - - { "82s123.e7", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 10 Color Proms - { "82s129.a4", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 11 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 12 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom - - { "ab7.bin", 0x0800, 0x52294ef5, 0 | BRF_OPT }, // 14 Mystery Rom? (1st & 2nd halves identical) -}; - -STD_ROM_PICK(alibaba) -STD_ROM_FN(alibaba) - -static void alibabaCallback() -{ - memcpy (DrvZ80ROM + 0xa000, DrvZ80ROM + 0x9000, 0x0800); - memset (DrvZ80ROM + 0x9000, 0, 0x800); -} - -static INT32 alibabaInit() -{ - return DrvInit(AlibabaMap, alibabaCallback, ALIBABA); -} - -struct BurnDriver BurnDrvalibaba = { - "alibaba", NULL, NULL, NULL, "1982", - "Ali Baba and 40 Thieves\0", NULL, "Sega", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, alibabaRomInfo, alibabaRomName, NULL, NULL, alibabaInputInfo, alibabaDIPInfo, - alibabaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Mustafa and 40 Thieves (bootleg) - -static struct BurnRomInfo alibababRomDesc[] = { - { "6e", 0x1000, 0x38d701aa, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "6f", 0x1000, 0x3d0e35f3, 1 | BRF_ESS | BRF_PRG }, // 1 - { "6h", 0x1000, 0x823bee89, 1 | BRF_ESS | BRF_PRG }, // 2 - { "6k", 0x1000, 0x474d032f, 1 | BRF_ESS | BRF_PRG }, // 3 - { "ab5.bin", 0x1000, 0xae2f4aac, 1 | BRF_ESS | BRF_PRG }, // 4 - { "6m", 0x0800, 0x438d0357, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "5e", 0x0800, 0x85bcb8f8, 2 | BRF_GRA }, // 6 Graphics - { "5h", 0x0800, 0x38e50862, 2 | BRF_GRA }, // 7 - { "5f", 0x0800, 0xb5715c86, 2 | BRF_GRA }, // 8 - { "5k", 0x0800, 0x713086b3, 2 | BRF_GRA }, // 9 - - { "82s123.e7", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 10 Color Proms - { "82s129.a4", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 11 - - { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 12 Sound Prom - { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom - - { "ab7.bin", 0x0800, 0x52294ef5, 0 | BRF_OPT }, // 14 Mystery Rom? (1st & 2nd halves identical) -}; - -STD_ROM_PICK(alibabab) -STD_ROM_FN(alibabab) - -struct BurnDriver BurnDrvalibabab = { - "alibabab", "alibaba", NULL, NULL, "1982", - "Mustafa and 40 Thieves (bootleg)\0", NULL, "bootleg", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, alibababRomInfo, alibababRomName, NULL, NULL, alibabaInputInfo, alibabaDIPInfo, - alibabaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Birdiy - -static struct BurnRomInfo birdiyRomDesc[] = { - { "a6.6a", 0x1000, 0x3a58f8ad, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "c6.6c", 0x1000, 0xfec61ea2, 1 | BRF_ESS | BRF_PRG }, // 1 - { "a4.4a", 0x1000, 0x3392783b, 1 | BRF_ESS | BRF_PRG }, // 2 - { "c4.4c", 0x1000, 0x2391d83d, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "c1.1c", 0x1000, 0x8f6bf54f, 2 | BRF_GRA }, // 4 Graphics - { "c3.3c", 0x1000, 0x10b55440, 2 | BRF_GRA }, // 5 - - { "n82s123n.10n", 0x0020, 0xff344446, 3 | BRF_GRA }, // 6 Color Proms - { "n82s129n.9m", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 - - { "n82s129n.4k", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom - { "n82s129n.6l", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) -}; - -STD_ROM_PICK(birdiy) -STD_ROM_FN(birdiy) - -static INT32 birdiyInit() -{ - return DrvInit(StandardMap, NULL, BIRDIY); -} - -struct BurnDriver BurnDrvbirdiy = { - "birdiy", NULL, NULL, NULL, "1982", - "Birdiy\0", NULL, "Mama Top", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, birdiyRomInfo, birdiyRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - birdiyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pengo (set 1 rev c) - -static struct BurnRomInfo pengoRomDesc[] = { - { "ep1689c.8", 0x1000, 0xf37066a8, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ep1690b.7", 0x1000, 0xbaf48143, 1 | BRF_ESS | BRF_PRG }, // 1 - { "ep1691b.15", 0x1000, 0xadf0eba0, 1 | BRF_ESS | BRF_PRG }, // 2 - { "ep1692b.14", 0x1000, 0xa086d60f, 1 | BRF_ESS | BRF_PRG }, // 3 - { "ep1693b.21", 0x1000, 0xb72084ec, 1 | BRF_ESS | BRF_PRG }, // 4 - { "ep1694b.20", 0x1000, 0x94194a89, 1 | BRF_ESS | BRF_PRG }, // 5 - { "ep5118b.32", 0x1000, 0xaf7b12c4, 1 | BRF_ESS | BRF_PRG }, // 6 - { "ep5119c.31", 0x1000, 0x933950fe, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "ep1640.92", 0x2000, 0xd7eec6cd, 2 | BRF_GRA }, // 8 Graphics - { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 9 - - { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 10 Color Proms - { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 11 - - { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 12 Sound Prom - { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom -}; - -STD_ROM_PICK(pengo) -STD_ROM_FN(pengo) - -static void PengoDecode() -{ - static const UINT8 convtable[32][4] = - { - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, - { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x80,0xa8,0x88 }, - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, - { 0x08,0x28,0x88,0xa8 }, { 0xa0,0x80,0xa8,0x88 }, - { 0x08,0x00,0x88,0x80 }, { 0x28,0xa8,0x08,0x88 }, - { 0xa0,0x80,0x20,0x00 }, { 0x08,0x00,0x88,0x80 }, - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, - { 0xa0,0x80,0x20,0x00 }, { 0x00,0x08,0x20,0x28 }, - { 0x88,0x80,0x08,0x00 }, { 0xa0,0x80,0x20,0x00 }, - { 0x88,0x80,0x08,0x00 }, { 0x00,0x08,0x20,0x28 }, - { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, - { 0x08,0x00,0x88,0x80 }, { 0x88,0x80,0x08,0x00 }, - { 0x00,0x08,0x20,0x28 }, { 0x88,0x80,0x08,0x00 }, - { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, - { 0x08,0x00,0x88,0x80 }, { 0xa0,0x80,0x20,0x00 } - }; - - UINT8 *decrypted = DrvZ80ROM + 0x8000; - - for (INT32 A = 0x0000;A < 0x8000;A++) - { - INT32 xorval = 0; - UINT8 src = DrvZ80ROM[A]; - - INT32 row = (A & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2) + (((A >> 12) & 1) << 3); - - INT32 col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1); - - if (src & 0x80) - { - col = 3 - col; - xorval = 0xa8; - } - - decrypted[A] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval); - DrvZ80ROM[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval); - - if (convtable[2*row][col] == 0xff) decrypted[A] = 0xee; - if (convtable[2*row+1][col] == 0xff) DrvZ80ROM[A] = 0xee; - } -} - -static void PengoGraphicsReorder() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x2000); - - memcpy (tmp + 0x0000, DrvGfxROM + 0x2000, 0x1000); - memcpy (tmp + 0x1000, DrvGfxROM + 0x1000, 0x1000); - memcpy (DrvGfxROM + 0x1000, tmp + 0x0000, 0x2000); - - BurnFree (tmp); -} - -static void PengoCallback() -{ - PengoDecode(); - - PengoGraphicsReorder(); -} - -static INT32 pengoInit() -{ - return DrvInit(PengoMap, PengoCallback, PENGO); -} - -struct BurnDriver BurnDrvpengo = { - "pengo", NULL, NULL, NULL, "1982", - "Pengo (set 1 rev c)\0", NULL, "Sega", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pengoRomInfo, pengoRomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, - pengoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pengo (set 2) - -static struct BurnRomInfo pengo2RomDesc[] = { - { "ic8.2", 0x1000, 0xe4924b7b, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ic7.2", 0x1000, 0x72e7775d, 1 | BRF_ESS | BRF_PRG }, // 1 - { "ic15.2", 0x1000, 0x7410ef1e, 1 | BRF_ESS | BRF_PRG }, // 2 - { "ic14.2", 0x1000, 0x55b3f379, 1 | BRF_ESS | BRF_PRG }, // 3 - { "ep1693b.21", 0x1000, 0xb72084ec, 1 | BRF_ESS | BRF_PRG }, // 4 - { "ic20.2", 0x1000, 0x770570cf, 1 | BRF_ESS | BRF_PRG }, // 5 - { "ep5118b.32", 0x1000, 0xaf7b12c4, 1 | BRF_ESS | BRF_PRG }, // 6 - { "ic31.2", 0x1000, 0x669555c1, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "ep1640.92", 0x2000, 0xd7eec6cd, 2 | BRF_GRA }, // 8 Graphics - { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 9 - - { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 10 Color Proms - { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 11 - - { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 12 Sound Prom - { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom -}; - -STD_ROM_PICK(pengo2) -STD_ROM_FN(pengo2) - -struct BurnDriver BurnDrvpengo2 = { - "pengo2", "pengo", NULL, NULL, "1982", - "Pengo (set 2)\0", NULL, "Sega", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pengo2RomInfo, pengo2RomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, - pengoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pengo (set 2 not encrypted) - -static struct BurnRomInfo pengo2uRomDesc[] = { - { "epr5128.u8", 0x1000, 0x3dfeb20e, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "epr5129.u7", 0x1000, 0x1db341bd, 1 | BRF_ESS | BRF_PRG }, // 1 - { "epr5130.u15", 0x1000, 0x7c2842d5, 1 | BRF_ESS | BRF_PRG }, // 2 - { "epr5131.u14", 0x1000, 0x6e3c1f2f, 1 | BRF_ESS | BRF_PRG }, // 3 - { "ep5124.21", 0x1000, 0x95f354ff, 1 | BRF_ESS | BRF_PRG }, // 4 - { "epr5133.u20", 0x1000, 0x0fdb04b8, 1 | BRF_ESS | BRF_PRG }, // 5 - { "ep5126.32", 0x1000, 0xe5920728, 1 | BRF_ESS | BRF_PRG }, // 6 - { "epr5135.u31", 0x1000, 0x13de47ed, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "ep1640.92", 0x2000, 0xd7eec6cd, 2 | BRF_GRA }, // 8 Graphics - { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 9 - - { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 10 Color Proms - { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 11 - - { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 12 Sound Prom - { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom -}; - -STD_ROM_PICK(pengo2u) -STD_ROM_FN(pengo2u) - -static void PengouCallback() -{ - memcpy (DrvZ80ROM + 0x8000, DrvZ80ROM, 0x8000); - - PengoGraphicsReorder(); -} - -static INT32 pengouInit() -{ - return DrvInit(PengoMap, PengouCallback, PENGO); -} - -struct BurnDriver BurnDrvpengo2u = { - "pengo2u", "pengo", NULL, NULL, "1982", - "Pengo (set 2 not encrypted)\0", NULL, "Sega", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pengo2uRomInfo, pengo2uRomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, - pengouInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pengo (set 3 not encrypted) - -static struct BurnRomInfo pengo3uRomDesc[] = { - { "ep5120.8", 0x1000, 0xf01afb60, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ep5121.7", 0x1000, 0x2eb38353, 1 | BRF_ESS | BRF_PRG }, // 1 - { "ep5122.15", 0x1000, 0xc33400d7, 1 | BRF_ESS | BRF_PRG }, // 2 - { "ep5123.14", 0x1000, 0x6a85c6a2, 1 | BRF_ESS | BRF_PRG }, // 3 - { "ep5124.21", 0x1000, 0x95f354ff, 1 | BRF_ESS | BRF_PRG }, // 4 - { "ep5125.20", 0x1000, 0x1a42310f, 1 | BRF_ESS | BRF_PRG }, // 5 - { "ep5126.32", 0x1000, 0xe5920728, 1 | BRF_ESS | BRF_PRG }, // 6 - { "ep5127.31", 0x1000, 0xa7d3d1d6, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "ep1640.92", 0x2000, 0xd7eec6cd, 2 | BRF_GRA }, // 8 Graphics - { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 9 - - { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 10 Color Proms - { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 11 - - { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 12 Sound Prom - { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom -}; - -STD_ROM_PICK(pengo3u) -STD_ROM_FN(pengo3u) - -struct BurnDriver BurnDrvpengo3u = { - "pengo3u", "pengo", NULL, NULL, "1982", - "Pengo (set 3 not encrypted)\0", NULL, "Sega", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pengo3uRomInfo, pengo3uRomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, - pengouInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pengo (set 4) - -static struct BurnRomInfo pengo4RomDesc[] = { - { "ep1738.8", 0x1000, 0x68ba25ea, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ep1739.7", 0x1000, 0x41e7b5b3, 1 | BRF_ESS | BRF_PRG }, // 1 - { "ep1740.15", 0x1000, 0x27f05f59, 1 | BRF_ESS | BRF_PRG }, // 2 - { "ep1741.14", 0x1000, 0x27d93ec1, 1 | BRF_ESS | BRF_PRG }, // 3 - { "ep1742.21", 0x1000, 0xb72084ec, 1 | BRF_ESS | BRF_PRG }, // 4 - { "ep1743.20", 0x1000, 0x770570cf, 1 | BRF_ESS | BRF_PRG }, // 5 - { "ep1744.32", 0x1000, 0xaf7b12c4, 1 | BRF_ESS | BRF_PRG }, // 6 - { "ep1745.31", 0x1000, 0x507e18b9, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "ep1640.92", 0x2000, 0xd7eec6cd, 2 | BRF_GRA }, // 8 Graphics - { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 9 - - { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 10 Color Proms - { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 11 - - { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 12 Sound Prom - { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom -}; - -STD_ROM_PICK(pengo4) -STD_ROM_FN(pengo4) - -struct BurnDriver BurnDrvpengo4 = { - "pengo4", "pengo", NULL, NULL, "1982", - "Pengo (set 4)\0", NULL, "Sega", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pengo4RomInfo, pengo4RomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, - pengoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Pengo (bootleg) - -static struct BurnRomInfo pengobRomDesc[] = { - { "1", 0x2000, 0xe04064db, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "2", 0x2000, 0x75752424, 1 | BRF_ESS | BRF_PRG }, // 1 - { "021_pn03.bin", 0x1000, 0x7824e3ef, 1 | BRF_ESS | BRF_PRG }, // 2 - { "020_pn07.bin", 0x1000, 0x377b9663, 1 | BRF_ESS | BRF_PRG }, // 3 - { "032_pn04.bin", 0x1000, 0xbfde44c1, 1 | BRF_ESS | BRF_PRG }, // 4 - { "031_pn08.bin", 0x1000, 0x64e8c30d, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "5", 0x2000, 0x1232437b, 2 | BRF_GRA }, // 6 Graphics - { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 7 - - { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 8 Color Proms - { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 9 - - { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 10 Sound Prom - { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom -}; - -STD_ROM_PICK(pengob) -STD_ROM_FN(pengob) - -static void PentaDecode() -{ - static const UINT8 data_xortable[2][8] = - { - { 0xa0,0x82,0x28,0x0a,0x82,0xa0,0x0a,0x28 }, - { 0x88,0x0a,0x82,0x00,0x88,0x0a,0x82,0x00 } - }; - - static const UINT8 opcode_xortable[8][8] = - { - { 0x02,0x08,0x2a,0x20,0x20,0x2a,0x08,0x02 }, - { 0x88,0x88,0x00,0x00,0x88,0x88,0x00,0x00 }, - { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 }, - { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 }, - { 0x2a,0x08,0x2a,0x08,0x8a,0xa8,0x8a,0xa8 }, - { 0x2a,0x08,0x2a,0x08,0x8a,0xa8,0x8a,0xa8 }, - { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 }, - { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 } - }; - - UINT8 *decrypt = DrvZ80ROM + 0x8000; - - for (INT32 A = 0; A < 0x8000; A++) - { - UINT8 src = DrvZ80ROM[A]; - - INT32 i = A & 1; - - INT32 j = ((src >> 1) & 1) + (((src >> 3) & 1) << 1) + (((src >> 5) & 1) << 2); - - if (src & 0x80) j = 7 - j; - - DrvZ80ROM[A] = src ^ data_xortable[i][j]; - - i = ((A >> 4) & 1) + (((A >> 8) & 1) << 1) + (((A >> 12) & 1) << 2); - - decrypt[A] = src ^ opcode_xortable[i][j]; - } -} - -static void PengobCallback() -{ - PentaDecode(); - - PengoGraphicsReorder(); -} - -static INT32 pengobInit() -{ - return DrvInit(PengoMap, PengobCallback, PENGO); -} - -struct BurnDriver BurnDrvpengob = { - "pengob", "pengo", NULL, NULL, "1982", - "Pengo (bootleg)\0", NULL, "Bootleg", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pengobRomInfo, pengobRomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, - pengobInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - -// Penta - -static struct BurnRomInfo pentaRomDesc[] = { - { "008_pn01.bin", 0x1000, 0x22f328df, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "007_pn05.bin", 0x1000, 0x15bbc7d3, 1 | BRF_ESS | BRF_PRG }, // 1 - { "015_pn02.bin", 0x1000, 0xde82b74a, 1 | BRF_ESS | BRF_PRG }, // 2 - { "014_pn06.bin", 0x1000, 0x160f3836, 1 | BRF_ESS | BRF_PRG }, // 3 - { "021_pn03.bin", 0x1000, 0x7824e3ef, 1 | BRF_ESS | BRF_PRG }, // 4 - { "020_pn07.bin", 0x1000, 0x377b9663, 1 | BRF_ESS | BRF_PRG }, // 5 - { "032_pn04.bin", 0x1000, 0xbfde44c1, 1 | BRF_ESS | BRF_PRG }, // 6 - { "031_pn08.bin", 0x1000, 0x64e8c30d, 1 | BRF_ESS | BRF_PRG }, // 7 - - { "092_pn09.bin", 0x2000, 0x6afeba9d, 2 | BRF_GRA }, // 6 Graphics - { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 7 - - { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 8 Color Proms - { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 9 - - { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 10 Sound Prom - { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom -}; - -STD_ROM_PICK(penta) -STD_ROM_FN(penta) - -struct BurnDriver BurnDrvpenta = { - "penta", "pengo", NULL, NULL, "1982", - "Penta\0", NULL, "Bootleg", "Pac-man", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, - NULL, pentaRomInfo, pentaRomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, - pengobInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 288, 3, 4 -}; - - +// FB Alpha Puckman module +// Based on MAME driver by Nicola Salmoria and many others + +// Fix Shoot the Bull inputs + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "bitswap.h" +#include "sn76496.h" +#include "namco_snd.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvQROM; +static UINT8 *DrvGfxROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvColRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprRAM2; +static UINT8 *DrvColPROM; +static UINT8 *DrvTransTable; + +static INT16 *pAY8910Buffer[3]; +static UINT32 *Palette; +static UINT8 DrvRecalc; + +static UINT8 DrvReset; +static UINT8 DrvJoy1[8] = {0,0,0,0,0,0,0,0}; +static UINT8 DrvJoy2[8] = {0,0,0,0,0,0,0,0}; +static UINT8 DrvInputs[2] = {0,0}; +static UINT8 DrvDips[4] = {0,0,0,0}; +static INT16 DrvAxis[2] = { 0, 0 }; +static INT16 nAnalogAxis[2] = {0,0}; +static UINT8 nCharAxis[2] = {0,0}; + +enum { PACMAN=0, MSPACMAN, CANNONBP, MAKETRAX, PIRANHA, VANVAN, NMOUSE, DREMSHPR, + MSCHAMP, BIGBUCKS, ROCKTRV2, ALIBABA, CRUSHS, SHOOTBUL, BIRDIY, EPOS, PENGO }; + +static INT32 game_select; +static INT32 acitya = 0; + +static UINT8 *flipscreen; + +static INT32 interrupt_mode; +static INT32 interrupt_mask; + +static UINT8 colortablebank; +static UINT8 palettebank; +static UINT8 spritebank; +static UINT8 charbank; +static INT32 nPacBank; + +static INT32 alibaba_mystery; +static UINT8 *rocktrv2_prot_data; +static INT8 epos_hardware_counter; +static UINT8 mschamp_counter; +static UINT8 cannonb_bit_to_read; + +static UINT32 watchdog; + +//------------------------------------------------------------------------------------------------------ + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, + + {"Dip Switches 1 ", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo lizwizInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 4, "diag"}, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 6, "tilt"}, + + {"Dip Switches 1 ", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, +}; + +STDINPUTINFO(lizwiz) + +static struct BurnInputInfo PengoInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip D", BIT_DIPSWITCH, DrvDips + 3, "dip"}, +}; + +STDINPUTINFO(Pengo) + +static struct BurnInputInfo mschampInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, + {"Coin 3", BIT_DIGITAL, DrvJoy1 + 7, "p3 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, +}; + +STDINPUTINFO(mschamp) + +static struct BurnInputInfo eyesInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 6, "tilt"}, + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(eyes) + +static struct BurnInputInfo theglobpInputList[] = { + {"Coin", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 2"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 7, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, + + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, +}; + +STDINPUTINFO(theglobp) + +static struct BurnInputInfo ponpokoInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, + + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 3, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(ponpoko) + +static struct BurnInputInfo vanvanInputList[] = { + {"Coin", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, + + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(vanvan) + +static struct BurnInputInfo vanvankInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin"}, + + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(vanvank) + +static struct BurnInputInfo cannonbpInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(cannonbp) + +static struct BurnInputInfo rocktrv2InputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + + {"Tilt", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 3, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(rocktrv2) + +static struct BurnInputInfo bigbucksInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, + + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, +}; + +STDINPUTINFO(bigbucks) + +static struct BurnInputInfo woodpekInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, + + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(woodpek) + +static struct BurnInputInfo acityaInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 3"}, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 4"}, + {"P1 Button 5", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 5"}, + {"P1 Button 6", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 6"}, + + {"Service Mode 1", BIT_DIGITAL, DrvJoy1 + 4, "diag"}, + {"Service Mode 2", BIT_DIGITAL, DrvJoy2 + 4, "diag"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, +}; + +STDINPUTINFO(acitya) + +static struct BurnInputInfo bwcasinoInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 3"}, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 4"}, + {"P1 Button 5", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 5"}, + {"P1 Button 6", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 6"}, + + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 3"}, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 4"}, + {"P2 Button 5", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 5"}, + {"P2 Button 6", BIT_DIGITAL, DrvJoy1 + 7, "p2 fire 6"}, + + {"Service Mode ", BIT_DIGITAL, DrvJoy1 + 4, "diag"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 0, "dip"}, +}; + +STDINPUTINFO(bwcasino) + +static struct BurnInputInfo dremshprInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire "}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, +}; + +STDINPUTINFO(dremshpr) + +static struct BurnInputInfo alibabaInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, +}; + +STDINPUTINFO(alibaba) + +static struct BurnInputInfo jumpshotInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, + + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(jumpshot) + +static struct BurnInputInfo korosukeInputList[] = { + {"Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin"}, + {"Start 1", BIT_DIGITAL, DrvJoy2 + 5, "p1 start"}, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag"}, + + {"Dip Switches 1 ", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip Switches 4", BIT_DIPSWITCH, DrvDips + 3, "dip"}, +}; + +STDINPUTINFO(korosuke) + +#define A(a, b, c, d) { a, b, (UINT8*)(c), d } + +static struct BurnInputInfo shootbulInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin"}, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 6, "p2 coin"}, + {"Coin 3", BIT_DIGITAL, DrvJoy1 + 7, "p3 coin"}, + {"Start", BIT_DIGITAL, DrvJoy2 + 6, "p1 start"}, + + A("P1 X Axis", BIT_ANALOG_REL, DrvAxis + 0, "mouse x-axis"), + A("P1 Y Axis", BIT_ANALOG_REL, DrvAxis + 1, "mouse y-axis"), + + {"P1 Button A", BIT_DIGITAL, DrvJoy2 + 5, "mouse button 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + + {"Dip Switches 1", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip Switches 2", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip Switches 3", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(shootbul) + +#undef A + + +static struct BurnDIPInfo DrvDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xc9, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, + {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, + {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, + {0x0e, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x0c, 0x00, "1" }, + {0x0e, 0x01, 0x0c, 0x04, "2" }, + {0x0e, 0x01, 0x0c, 0x08, "3" }, + {0x0e, 0x01, 0x0c, 0x0c, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x30, 0x00, "10000" }, + {0x0e, 0x01, 0x30, 0x10, "15000" }, + {0x0e, 0x01, 0x30, 0x20, "20000" }, + {0x0e, 0x01, 0x30, 0x30, "None" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0e, 0x01, 0x40, 0x40, "Normal" }, + {0x0e, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Ghost Names" }, + {0x0e, 0x01, 0x80, 0x80, "Normal" }, + {0x0e, 0x01, 0x80, 0x00, "Alternate" }, + + {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, + {0x0f, 0x01, 0x10, 0x10, "Off" }, + {0x0f, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x80, "Upright" }, + {0x10, 0x01, 0x80, 0x00, "Cocktail" }, +}; + +STDDIPINFO(Drv) + +static struct BurnDIPInfo PengoDIPList[]= +{ + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xb0, NULL }, + {0x12, 0xff, 0xff, 0xcc, NULL }, + + {0 , 0xfe, 0 , 1, "Service Mode" }, + {0x10, 0x01, 0x10, 0x10, "Off" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x11, 0x01, 0x01, 0x00, "30000" }, + {0x11, 0x01, 0x01, 0x01, "50000" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x11, 0x01, 0x04, 0x00, "Upright" }, + {0x11, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x11, 0x01, 0x18, 0x18, "2" }, + {0x11, 0x01, 0x18, 0x10, "3" }, + {0x11, 0x01, 0x18, 0x08, "4" }, + {0x11, 0x01, 0x18, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Rack Test (Cheat)" }, + {0x11, 0x01, 0x20, 0x20, "Off" }, + {0x11, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x11, 0x01, 0xc0, 0xc0, "Easy" }, + {0x11, 0x01, 0xc0, 0x80, "Medium" }, + {0x11, 0x01, 0xc0, 0x40, "Hard" }, + {0x11, 0x01, 0xc0, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x00, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x0f, 0x04, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "2 Coins/1 Credit 5/3" }, + {0x12, 0x01, 0x0f, 0x05, "2 Coins/1 Credit 4/3" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin/1 Credit 5/6" }, + {0x12, 0x01, 0x0f, 0x03, "1 Coin/1 Credit 4/5" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin/1 Credit 2/3" }, + {0x12, 0x01, 0x0f, 0x02, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "1 Coin/2 Credits 5/11" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin/2 Credits 4/9" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x12, 0x01, 0xf0, 0x00, "4 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0x40, "2 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "2 Coins/1 Credit 5/3" }, + {0x12, 0x01, 0xf0, 0x50, "2 Coins/1 Credit 4/3" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin/1 Credit 5/6" }, + {0x12, 0x01, 0xf0, 0x30, "1 Coin/1 Credit 4/5" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin/1 Credit 2/3" }, + {0x12, 0x01, 0xf0, 0x20, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "1 Coin/2 Credits 5/11" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin/2 Credits 4/9" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "1 Coin 6 Credits" }, +}; + +STDDIPINFO(Pengo) + +static struct BurnDIPInfo mspacmanDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xc9, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, + {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, + {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, + {0x0e, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x0c, 0x00, "1" }, + {0x0e, 0x01, 0x0c, 0x04, "2" }, + {0x0e, 0x01, 0x0c, 0x08, "3" }, + {0x0e, 0x01, 0x0c, 0x0c, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x30, 0x00, "10000" }, + {0x0e, 0x01, 0x30, 0x10, "15000" }, + {0x0e, 0x01, 0x30, 0x20, "20000" }, + {0x0e, 0x01, 0x30, 0x30, "None" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0e, 0x01, 0x40, 0x40, "Normal" }, + {0x0e, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, + {0x0f, 0x01, 0x10, 0x10, "Off" }, + {0x0f, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x80, "Upright" }, + {0x10, 0x01, 0x80, 0x00, "Cocktail" }, +}; + +STDDIPINFO(mspacman) + +static struct BurnDIPInfo mschampDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xc9, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, + {0x0f, 0x01, 0x10, 0x10, "Off" }, + {0x0f, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x80, "Upright" }, + {0x10, 0x01, 0x80, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, + {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, + {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, + {0x0e, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x0c, 0x00, "1" }, + {0x0e, 0x01, 0x0c, 0x04, "2" }, + {0x0e, 0x01, 0x0c, 0x08, "3" }, + {0x0e, 0x01, 0x0c, 0x0c, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x30, 0x00, "10000" }, + {0x0e, 0x01, 0x30, 0x10, "15000" }, + {0x0e, 0x01, 0x30, 0x20, "20000" }, + {0x0e, 0x01, 0x30, 0x30, "None" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0e, 0x01, 0x40, 0x40, "Normal" }, + {0x0e, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Game" }, + {0x11, 0x01, 0x01, 0x01, "Champion Edition" }, + {0x11, 0x01, 0x01, 0x00, "Super Zola Pac Gal" }, +}; + +STDDIPINFO(mschamp) + +static struct BurnDIPInfo maketraxDIPList[]= +{ + {0x0e, 0xff, 0x3f, 0x31, NULL }, + {0x0f, 0xff, 0xff, 0xef, NULL }, + {0x10, 0xff, 0x6f, 0x6f, NULL }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x10, 0x00, "Upright" }, + {0x0f, 0x01, 0x10, 0x10, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, + {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, + {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, + {0x0e, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x0c, 0x00, "3" }, + {0x0e, 0x01, 0x0c, 0x04, "4" }, + {0x0e, 0x01, 0x0c, 0x08, "5" }, + {0x0e, 0x01, 0x0c, 0x0c, "6" }, + + {0 , 0xfe, 0 , 2 , "First Pattern" }, + {0x0e, 0x01, 0x30, 0x10, "Easy" }, + {0x0e, 0x01, 0x30, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Teleport Holes" }, + {0x0e, 0x01, 0x20, 0x20, "Off" }, + {0x0e, 0x01, 0x20, 0x00, "On" }, +}; + +STDDIPINFO(maketrax) + +static struct BurnDIPInfo mbrushDIPList[]= +{ + {0x0e, 0xff, 0xff, 0x39, NULL }, + {0x0f, 0xff, 0xff, 0xef, NULL }, + {0x10, 0xff, 0xff, 0x6f, NULL }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x10, 0x00, "Upright" }, + {0x0f, 0x01, 0x10, 0x10, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, + {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, + {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, + {0x0e, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x0c, 0x00, "1" }, + {0x0e, 0x01, 0x0c, 0x04, "2" }, + {0x0e, 0x01, 0x0c, 0x08, "3" }, + {0x0e, 0x01, 0x0c, 0x0c, "4" }, +}; + +STDDIPINFO(mbrush) + +static struct BurnDIPInfo crushsDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xff, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 2 , "Teleport Holes" }, + {0x0f, 0x01, 0x10, 0x10, "Off" }, + {0x0f, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x11, 0x01, 0x0f, 0x08, "2C 1C" }, + {0x11, 0x01, 0x0f, 0x09, "2C 2C" }, + {0x11, 0x01, 0x0f, 0x00, "1C 1C" }, + {0x11, 0x01, 0x0f, 0x0a, "2C 3C" }, + {0x11, 0x01, 0x0f, 0x0b, "2C 4C" }, + {0x11, 0x01, 0x0f, 0x01, "2C 2C" }, + {0x11, 0x01, 0x0f, 0x0c, "1C 5C" }, + {0x11, 0x01, 0x0f, 0x0d, "2C 6C" }, + {0x11, 0x01, 0x0f, 0x02, "1C 3C" }, + {0x11, 0x01, 0x0f, 0x0e, "2C 7C" }, + {0x11, 0x01, 0x0f, 0x0f, "2C 8C" }, + {0x11, 0x01, 0x0f, 0x03, "1C 4C" }, + {0x11, 0x01, 0x0f, 0x04, "1C 5C" }, + {0x11, 0x01, 0x0f, 0x05, "1C 6C" }, + {0x11, 0x01, 0x0f, 0x06, "1C 7C" }, + {0x11, 0x01, 0x0f, 0x07, "1C 8C" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x11, 0x01, 0xf0, 0x80, "2C 1C" }, + {0x11, 0x01, 0xf0, 0x90, "2C 2C" }, + {0x11, 0x01, 0xf0, 0x00, "1C 1C" }, + {0x11, 0x01, 0xf0, 0xa0, "2C 3C" }, + {0x11, 0x01, 0xf0, 0xb0, "2C 4C" }, + {0x11, 0x01, 0xf0, 0x10, "2C 2C" }, + {0x11, 0x01, 0xf0, 0xc0, "1C 5C" }, + {0x11, 0x01, 0xf0, 0xd0, "2C 6C" }, + {0x11, 0x01, 0xf0, 0x20, "1C 3C" }, + {0x11, 0x01, 0xf0, 0xe0, "2C 7C" }, + {0x11, 0x01, 0xf0, 0xf0, "2C 8C" }, + {0x11, 0x01, 0xf0, 0x30, "1C 4C" }, + {0x11, 0x01, 0xf0, 0x40, "1C 5C" }, + {0x11, 0x01, 0xf0, 0x50, "1C 6C" }, + {0x11, 0x01, 0xf0, 0x60, "1C 7C" }, + {0x11, 0x01, 0xf0, 0x70, "1C 8C" }, +}; + +STDDIPINFO(crushs) + +static struct BurnDIPInfo ponpokoDIPList[]= +{ + {0x10, 0xff, 0xff, 0xd1, NULL }, + {0x11, 0xff, 0xff, 0xb1, NULL }, + {0x12, 0xff, 0xff, 0xe0, NULL }, + {0x13, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x10, 0x01, 0x03, 0x00, "10000" }, + {0x10, 0x01, 0x03, 0x01, "30000" }, + {0x10, 0x01, 0x03, 0x02, "50000" }, + {0x10, 0x01, 0x03, 0x03, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x30, 0x00, "2" }, + {0x10, 0x01, 0x30, 0x10, "3" }, + {0x10, 0x01, 0x30, 0x20, "4" }, + {0x10, 0x01, 0x30, 0x30, "5" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x40, 0x40, "Upright" }, + {0x10, 0x01, 0x40, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 16 , "Coinage" }, + {0x11, 0x01, 0x0f, 0x04, "A 3/1 B 3/1" }, + {0x11, 0x01, 0x0f, 0x0e, "A 3/1 B 1/2" }, + {0x11, 0x01, 0x0f, 0x0f, "A 3/1 B 1/4" }, + {0x11, 0x01, 0x0f, 0x02, "A 2/1 B 2/1" }, + {0x11, 0x01, 0x0f, 0x0d, "A 2/1 B 1/1" }, + {0x11, 0x01, 0x0f, 0x07, "A 2/1 B 1/3" }, + {0x11, 0x01, 0x0f, 0x0b, "A 2/1 B 1/5" }, + {0x11, 0x01, 0x0f, 0x0c, "A 2/1 B 1/6" }, + {0x11, 0x01, 0x0f, 0x01, "A 1/1 B 1/1" }, + {0x11, 0x01, 0x0f, 0x06, "A 1/1 B 4/5" }, + {0x11, 0x01, 0x0f, 0x05, "A 1/1 B 2/3" }, + {0x11, 0x01, 0x0f, 0x0a, "A 1/1 B 1/3" }, + {0x11, 0x01, 0x0f, 0x08, "A 1/1 B 1/5" }, + {0x11, 0x01, 0x0f, 0x09, "A 1/1 B 1/6" }, + {0x11, 0x01, 0x0f, 0x03, "A 1/2 B 1/2" }, + {0x11, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x40, 0x40, "Off" }, + {0x11, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(ponpoko) + +static struct BurnDIPInfo bwcasinoDIPList[]= +{ + {0x0f, 0xff, 0xff, 0x7f, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x80, 0x00, "Upright" }, + {0x0f, 0x01, 0x80, 0x80, "Cocktail" }, + + {0 , 0xfe, 0 , 16 , "Hands Per Game" }, + {0x10, 0x01, 0x1e, 0x1e, "3" }, + {0x10, 0x01, 0x1e, 0x1c, "4" }, + {0x10, 0x01, 0x1e, 0x1a, "5" }, + {0x10, 0x01, 0x1e, 0x18, "6" }, + {0x10, 0x01, 0x1e, 0x16, "7" }, + {0x10, 0x01, 0x1e, 0x14, "8" }, + {0x10, 0x01, 0x1e, 0x12, "9" }, + {0x10, 0x01, 0x1e, 0x10, "10" }, + {0x10, 0x01, 0x1e, 0x0e, "11" }, + {0x10, 0x01, 0x1e, 0x0c, "12" }, + {0x10, 0x01, 0x1e, 0x0a, "13" }, + {0x10, 0x01, 0x1e, 0x07, "14" }, + {0x10, 0x01, 0x1e, 0x06, "15" }, + {0x10, 0x01, 0x1e, 0x04, "16" }, + {0x10, 0x01, 0x1e, 0x02, "17" }, + {0x10, 0x01, 0x1e, 0x00, "18" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x10, 0x01, 0x20, 0x20, "Off" }, + {0x10, 0x01, 0x20, 0x00, "On" }, +}; + +STDDIPINFO(bwcasino) + +static struct BurnDIPInfo acityaDIPList[]= +{ + {0x0a, 0xff, 0xff, 0xff, NULL }, + {0x0b, 0xff, 0xff, 0xff, NULL }, + {0x0c, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16 , "Hands Per Game" }, + {0x0b, 0x01, 0x1e, 0x1e, "3" }, + {0x0b, 0x01, 0x1e, 0x1c, "4" }, + {0x0b, 0x01, 0x1e, 0x1a, "5" }, + {0x0b, 0x01, 0x1e, 0x18, "6" }, + {0x0b, 0x01, 0x1e, 0x16, "7" }, + {0x0b, 0x01, 0x1e, 0x14, "8" }, + {0x0b, 0x01, 0x1e, 0x12, "9" }, + {0x0b, 0x01, 0x1e, 0x10, "10" }, + {0x0b, 0x01, 0x1e, 0x0e, "11" }, + {0x0b, 0x01, 0x1e, 0x0c, "12" }, + {0x0b, 0x01, 0x1e, 0x0a, "13" }, + {0x0b, 0x01, 0x1e, 0x07, "14" }, + {0x0b, 0x01, 0x1e, 0x06, "15" }, + {0x0b, 0x01, 0x1e, 0x04, "16" }, + {0x0b, 0x01, 0x1e, 0x02, "17" }, + {0x0b, 0x01, 0x1e, 0x00, "18" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x20, 0x20, "Off" }, + {0x0b, 0x01, 0x20, 0x00, "On" }, +}; + +STDDIPINFO(acitya) + +static struct BurnDIPInfo eyesDIPList[]= +{ + {0x10, 0xff, 0xff, 0xfb, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x10, 0x01, 0x03, 0x01, "2C 1C" }, + {0x10, 0x01, 0x03, 0x03, "1C 1C" }, + {0x10, 0x01, 0x03, 0x02, "1C 2C" }, + {0x10, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x0c, 0x0c, "2" }, + {0x10, 0x01, 0x0c, 0x08, "3" }, + {0x10, 0x01, 0x0c, 0x04, "4" }, + {0x10, 0x01, 0x0c, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x10, 0x01, 0x30, 0x30, "50000" }, + {0x10, 0x01, 0x30, 0x20, "75000" }, + {0x10, 0x01, 0x30, 0x10, "100000" }, + {0x10, 0x01, 0x30, 0x00, "125000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x40, 0x40, "Upright" }, + {0x10, 0x01, 0x40, 0x00, "Cocktail" }, +}; + +STDDIPINFO(eyes) + +static struct BurnDIPInfo mrtntDIPList[]= +{ + {0x10, 0xff, 0xff, 0xfb, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x10, 0x01, 0x03, 0x01, "2C 1C" }, + {0x10, 0x01, 0x03, 0x03, "1C 1C" }, + {0x10, 0x01, 0x03, 0x02, "1C 2C" }, + {0x10, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x0c, 0x0c, "2" }, + {0x10, 0x01, 0x0c, 0x08, "3" }, + {0x10, 0x01, 0x0c, 0x04, "4" }, + {0x10, 0x01, 0x0c, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x10, 0x01, 0x30, 0x30, "75000" }, + {0x10, 0x01, 0x30, 0x20, "100000" }, + {0x10, 0x01, 0x30, 0x10, "125000" }, + {0x10, 0x01, 0x30, 0x00, "150000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x40, 0x40, "Upright" }, + {0x10, 0x01, 0x40, 0x00, "Cocktail" }, +}; + +STDDIPINFO(mrtnt) + +static struct BurnDIPInfo alibabaDIPList[]= +{ + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xd9, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, + {0x0f, 0x01, 0x10, 0x10, "Off" }, + {0x0f, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x80, "Upright" }, + {0x10, 0x01, 0x80, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x11, 0x01, 0x03, 0x03, "2C 1C" }, + {0x11, 0x01, 0x03, 0x01, "1C 1C" }, + {0x11, 0x01, 0x03, 0x02, "1C 2C" }, + {0x11, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x0c, 0x00, "1" }, + {0x11, 0x01, 0x0c, 0x04, "2" }, + {0x11, 0x01, 0x0c, 0x08, "3" }, + {0x11, 0x01, 0x0c, 0x0c, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x11, 0x01, 0x30, 0x00, "10000" }, + {0x11, 0x01, 0x30, 0x10, "15000" }, + {0x11, 0x01, 0x30, 0x20, "20000" }, + {0x11, 0x01, 0x30, 0x30, "None" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x11, 0x01, 0x40, 0x40, "Normal" }, + {0x11, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(alibaba) + +static struct BurnDIPInfo theglobpDIPList[]= +{ + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x80, 0x80, "Upright" }, + {0x0f, 0x01, 0x80, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x03, 0x03, "3" }, + {0x10, 0x01, 0x03, 0x02, "4" }, + {0x10, 0x01, 0x03, 0x01, "5" }, + {0x10, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x10, 0x01, 0x1c, 0x1c, "Easiest" }, + {0x10, 0x01, 0x1c, 0x18, "Very Easy" }, + {0x10, 0x01, 0x1c, 0x14, "Easy" }, + {0x10, 0x01, 0x1c, 0x10, "Normal" }, + {0x10, 0x01, 0x1c, 0x0c, "Difficult" }, + {0x10, 0x01, 0x1c, 0x08, "Very Difficult" }, + {0x10, 0x01, 0x1c, 0x04, "Very Hard" }, + {0x10, 0x01, 0x1c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x10, 0x01, 0x20, 0x20, "Off" }, + {0x10, 0x01, 0x20, 0x00, "On" }, +}; + +STDDIPINFO(theglobp) + +static struct BurnDIPInfo woodpekDIPList[]= +{ + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xc1, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, + {0x10, 0x01, 0x10, 0x10, "Off" }, + {0x10, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x11, 0x01, 0x03, 0x03, "2C 1C" }, + {0x11, 0x01, 0x03, 0x01, "1C 1C" }, + {0x11, 0x01, 0x03, 0x02, "1C 2C" }, + {0x11, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x0c, 0x00, "3" }, + {0x11, 0x01, 0x0c, 0x04, "4" }, + {0x11, 0x01, 0x0c, 0x08, "5" }, + {0x11, 0x01, 0x0c, 0x0c, "6" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x11, 0x01, 0x30, 0x00, "5000" }, + {0x11, 0x01, 0x30, 0x10, "10000" }, + {0x11, 0x01, 0x30, 0x20, "15000" }, + {0x11, 0x01, 0x30, 0x30, "None" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x40, 0x40, "Upright" }, + {0x11, 0x01, 0x40, 0x00, "Cocktail" }, +}; + +STDDIPINFO(woodpek) + +static struct BurnDIPInfo lizwizDIPList[]= +{ + {0x11, 0xff, 0xff, 0xfb, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x11, 0x01, 0x03, 0x01, "2C 1C" }, + {0x11, 0x01, 0x03, 0x03, "1C 1C" }, + {0x11, 0x01, 0x03, 0x02, "1C 2C" }, + {0x11, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x0c, 0x00, "5" }, + {0x11, 0x01, 0x0c, 0x04, "4" }, + {0x11, 0x01, 0x0c, 0x08, "3" }, + {0x11, 0x01, 0x0c, 0x0c, "2" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x11, 0x01, 0x30, 0x00, "75000" }, + {0x11, 0x01, 0x30, 0x10, "100000" }, + {0x11, 0x01, 0x30, 0x20, "125000" }, + {0x11, 0x01, 0x30, 0x30, "150000" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x11, 0x01, 0x40, 0x40, "Normal" }, + {0x11, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(lizwiz) + +static struct BurnDIPInfo vanvanDIPList[]= +{ + {0x0f, 0xff, 0xff, 0xda, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x01, 0x00, "Upright" }, + {0x0f, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip screen" }, + {0x0f, 0x01, 0x02, 0x02, "Off" }, + {0x0f, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0f, 0x01, 0x0c, 0x08, "20k and 100k" }, + {0x0f, 0x01, 0x0c, 0x04, "40k and 140k" }, + {0x0f, 0x01, 0x0c, 0x00, "70k and 200k" }, + {0x0f, 0x01, 0x0c, 0x0c, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x30, 0x30, "1" }, + {0x0f, 0x01, 0x30, 0x20, "2" }, + {0x0f, 0x01, 0x30, 0x10, "3" }, + {0x0f, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0f, 0x01, 0xc0, 0x00, "2c_1c" }, + {0x0f, 0x01, 0xc0, 0xc0, "1C_1C" }, + {0x0f, 0x01, 0xc0, 0x80, "1c_2C" }, + {0x0f, 0x01, 0xc0, 0x40, "1C_3C" }, +}; + +STDDIPINFO(vanvan) + +static struct BurnDIPInfo nmouseDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xc9, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, + {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, + {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, + {0x0e, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x0c, 0x00, "1" }, + {0x0e, 0x01, 0x0c, 0x04, "2" }, + {0x0e, 0x01, 0x0c, 0x08, "3" }, + {0x0e, 0x01, 0x0c, 0x0c, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x30, 0x00, "5000" }, + {0x0e, 0x01, 0x30, 0x10, "10000" }, + {0x0e, 0x01, 0x30, 0x20, "15000" }, + {0x0e, 0x01, 0x30, 0x30, "None" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0e, 0x01, 0x40, 0x40, "Normal" }, + {0x0e, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Rack Test (Cheat)" }, + {0x0f, 0x01, 0x10, 0x10, "Off" }, + {0x0f, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x80, "Upright" }, + {0x10, 0x01, 0x80, 0x00, "Cocktail" }, +}; + +STDDIPINFO(nmouse) + +static struct BurnDIPInfo jumpshotDIPList[]= +{ + {0x10, 0xff, 0xff, 0xf1, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 3 , "Time" }, + {0x10, 0x01, 0x03, 0x02, "2 Minutes" }, + {0x10, 0x01, 0x03, 0x03, "3 Minutes" }, + {0x10, 0x01, 0x03, 0x01, "4 Minutes" }, + + {0 , 0xfe, 0 , 4 , "Player Skin Tone" }, + {0x10, 0x01, 0x04, 0x04, "Lighter" }, + {0x10, 0x01, 0x04, 0x00, "Darker" }, + + {0 , 0xfe, 0 , 4 , "Player Skin Tone" }, + {0x10, 0x01, 0x08, 0x08, "Lighter" }, + {0x10, 0x01, 0x08, 0x00, "Darker" }, + + {0 , 0xfe, 0 , 2 , "Free play" }, + {0x10, 0x01, 0x10, 0x10, "Off" }, + {0x10, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "2 Players Game" }, + {0x10, 0x01, 0x20, 0x20, "1 Credit" }, + {0x10, 0x01, 0x20, 0x00, "2 Credits" }, +}; + +STDDIPINFO(jumpshot) + +static struct BurnDIPInfo jumpshtpDIPList[]= +{ + {0x10, 0xff, 0xff, 0xf1, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 3 , "Time" }, + {0x10, 0x01, 0x03, 0x02, "Short" }, + {0x10, 0x01, 0x03, 0x03, "Average" }, + {0x10, 0x01, 0x03, 0x01, "Above Average" }, + + {0 , 0xfe, 0 , 4 , "Player Skin Tone" }, + {0x10, 0x01, 0x04, 0x04, "Lighter" }, + {0x10, 0x01, 0x04, 0x00, "Darker" }, + + {0 , 0xfe, 0 , 4 , "Player Skin Tone" }, + {0x10, 0x01, 0x08, 0x08, "Lighter" }, + {0x10, 0x01, 0x08, 0x00, "Darker" }, + + {0 , 0xfe, 0 , 2 , "Free play" }, + {0x10, 0x01, 0x10, 0x10, "Off" }, + {0x10, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "2 Players Game" }, + {0x10, 0x01, 0x20, 0x20, "1 Credit" }, + {0x10, 0x01, 0x20, 0x00, "2 Credits" }, +}; + +STDDIPINFO(jumpshtp) + +static struct BurnDIPInfo dremshprDIPList[]= +{ + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xfe, NULL }, + {0x0f, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x01, 0x01, "Upright" }, + {0x0f, 0x01, 0x01, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x20, 0x20, "Off" }, + {0x0f, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0f, 0x01, 0x0c, 0x08, "30000" }, + {0x0f, 0x01, 0x0c, 0x04, "50000" }, + {0x0f, 0x01, 0x0c, 0x00, "70000" }, + {0x0f, 0x01, 0x0c, 0x0c, "none" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x30, 0x30, "3" }, + {0x0f, 0x01, 0x30, 0x20, "4" }, + {0x0f, 0x01, 0x30, 0x10, "5" }, + {0x0f, 0x01, 0x30, 0x00, "6" }, + + {0 , 0xfe, 0, 4, "Coinage" }, + {0x0f, 0x01, 0xc0, 0x00, "2C 1C" }, + {0x0f, 0x01, 0xc0, 0xc0, "1C 1C" }, + {0x0f, 0x01, 0xc0, 0x80, "1C 2C" }, + {0x0f, 0x01, 0xc0, 0x40, "1C 3C" }, +}; + +STDDIPINFO(dremshpr) + +static struct BurnDIPInfo cannonbpDIPList[]= +{ + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Display" }, + {0x0f, 0x01, 0x03, 0x03, "Scores and Progression Bars" }, + {0x0f, 0x01, 0x03, 0x01, "Scores only" }, + {0x0f, 0x01, 0x03, 0x02, "Progression Bars only" }, + {0x0f, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x04, 0x04, "Upright" }, + {0x0f, 0x01, 0x04, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x18, 0x00, "3" }, + {0x0f, 0x01, 0x18, 0x08, "4" }, + {0x0f, 0x01, 0x18, 0x10, "5" }, + {0x0f, 0x01, 0x18, 0x18, "6" }, +}; + +STDDIPINFO(cannonbp) + +static struct BurnDIPInfo rocktrv2DIPList[]= +{ + {0x0e, 0xff, 0x3f, 0x33, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0e, 0x01, 0x03, 0x03, "2C 1C" }, + {0x0e, 0x01, 0x03, 0x01, "1C 1C" }, + {0x0e, 0x01, 0x03, 0x02, "1C 2C" }, + {0x0e, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8 , "Questions Per Game" }, + {0x0e, 0x01, 0x1c, 0x1c, "2" }, + {0x0e, 0x01, 0x1c, 0x18, "3" }, + {0x0e, 0x01, 0x1c, 0x14, "4" }, + {0x0e, 0x01, 0x1c, 0x10, "5" }, + {0x0e, 0x01, 0x1c, 0x0c, "6" }, + {0x0e, 0x01, 0x1c, 0x08, "7" }, + {0x0e, 0x01, 0x1c, 0x04, "8" }, + {0x0e, 0x01, 0x1c, 0x00, "9" }, + + {0 , 0xfe, 0 , 4 , "Clock Speed" }, + {0x0e, 0x01, 0x60, 0x60, "Beginner" }, + {0x0e, 0x01, 0x60, 0x40, "Intermediate" }, + {0x0e, 0x01, 0x60, 0x20, "Professional" }, + {0x0e, 0x01, 0x60, 0x00, "Super - Pro" }, + + {0 , 0xfe, 0 , 2 , "Freeze Image" }, + {0x0e, 0x01, 0x80, 0x80, "Off" }, + {0x0e, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Mode" }, + {0x0f, 0x01, 0x01, 0x01, "Amusement" }, + {0x0f, 0x01, 0x01, 0x00, "Credit" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x02, 0x02, "Upright" }, + {0x0f, 0x01, 0x02, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "K.O. Switch" }, + {0x0f, 0x01, 0x04, 0x04, "Auto" }, + {0x0f, 0x01, 0x04, 0x00, "Manual" }, + + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x0f, 0x01, 0x70, 0x70, "10000" }, + {0x0f, 0x01, 0x70, 0x60, "17500" }, + {0x0f, 0x01, 0x70, 0x50, "25000" }, + {0x0f, 0x01, 0x70, 0x40, "32500" }, + {0x0f, 0x01, 0x70, 0x30, "40000" }, + {0x0f, 0x01, 0x70, 0x20, "47500" }, + {0x0f, 0x01, 0x70, 0x10, "55000" }, + {0x0f, 0x01, 0x70, 0x00, "62500" }, + + {0 , 0xfe, 0 , 2 , "Music" }, + {0x0f, 0x01, 0x80, 0x80, "On" }, + {0x0f, 0x01, 0x80, 0x00, "Off" }, +}; + +STDDIPINFO(rocktrv2) + +static struct BurnDIPInfo bigbucksDIPList[]= +{ + {0x0c, 0xff, 0xff, 0xff, NULL }, + {0x0d, 0xff, 0xff, 0xff, NULL }, + {0x0e, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Enable Adult Affairs Category" }, + {0x0c, 0x01, 0x10, 0x00, "Off" }, + {0x0c, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Time to bet / answer" }, + {0x0d, 0x01, 0x01, 0x00, "15 sec. / 10 sec." }, + {0x0d, 0x01, 0x01, 0x01, "20 sec. / 15 sec." }, + + {0 , 0xfe, 0 , 2 , "Continue if player busts"}, + {0x0d, 0x01, 0x02, 0x00, "Off" }, + {0x0d, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Show correct answer" }, + {0x0d, 0x01, 0x04, 0x00, "Off" }, + {0x0d, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x08, 0x00, "Off" }, + {0x0d, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0d, 0x01, 0x10, 0x00, "2C 1C" }, + {0x0d, 0x01, 0x10, 0x10, "1C 1C" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x20, 0x20, "Upright" }, + {0x0d, 0x01, 0x20, 0x00, "Cocktail" }, +}; + +STDDIPINFO(bigbucks) + +static struct BurnDIPInfo korosukeDIPList[]= +{ + {0x0f, 0xff, 0x3f, 0x31, NULL }, + {0x10, 0xff, 0xff, 0xef, NULL }, + {0x11, 0xff, 0x6f, 0x6f, NULL }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x10, 0x00, "Upright" }, + {0x10, 0x01, 0x10, 0x10, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0f, 0x01, 0x03, 0x03, "2C 1C" }, + {0x0f, 0x01, 0x03, 0x01, "1C 1C" }, + {0x0f, 0x01, 0x03, 0x02, "1C 2C" }, + {0x0f, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x0c, 0x00, "3" }, + {0x0f, 0x01, 0x0c, 0x04, "4" }, + {0x0f, 0x01, 0x0c, 0x08, "5" }, + {0x0f, 0x01, 0x0c, 0x0c, "6" }, + + {0 , 0xfe, 0 , 2 , "First Pattern" }, + {0x0f, 0x01, 0x30, 0x10, "Easy" }, + {0x0f, 0x01, 0x30, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Teleport Holes" }, + {0x0f, 0x01, 0x20, 0x20, "Off" }, + {0x0f, 0x01, 0x20, 0x00, "On" }, +}; + +STDDIPINFO(korosuke) + +static struct BurnDIPInfo shootbulDIPList[]= +{ + {0x08, 0xff, 0xff, 0xff, NULL }, + {0x09, 0xff, 0xff, 0xe0, NULL }, + {0x0A, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 5 , "Time" }, + {0x08, 0x01, 0x03, 0x01, "Short" }, + {0x08, 0x01, 0x03, 0x07, "Average" }, + {0x08, 0x01, 0x03, 0x03, "Long" }, + {0x08, 0x01, 0x03, 0x05, "Longer" }, + {0x08, 0x01, 0x03, 0x06, "Longest" }, + + {0 , 0xfe, 0 , 2 , "Title Page Sounds" }, + {0x08, 0x01, 0x08, 0x00, "Off" }, + {0x08, 0x01, 0x08, 0x08, "On" }, +}; + +STDDIPINFO(shootbul) + +//------------------------------------------------------------------------------------------------------ + +static void mschamp_set_bank() +{ + nPacBank = DrvDips[3] & 1; + + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM + 0x0000 + (nPacBank * 0x08000)); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM + 0x0000 + (nPacBank * 0x08000)); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x4000 + (nPacBank * 0x08000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x4000 + (nPacBank * 0x08000)); +} + +static void epos_hardware_set_bank(INT32 nBank) +{ + nPacBank = nBank & 3; + + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM + 0x10000 + (nPacBank * 0x04000)); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM + 0x10000 + (nPacBank * 0x04000)); +} + +static UINT8 cannonbp_protection_r(UINT16 offset) +{ + switch (offset) + { + case 0x0004: + cannonb_bit_to_read = 7; + case 0x0000: + case 0x0003: + case 0x0012: + case 0x0105: + return 0x00; + + case 0x0001: + if (ZetPc(-1) == 0x2b97) + return ((0x46 >> (cannonb_bit_to_read--)) & 1) << 7; + else + return 0xff; + + case 0x0107: + return 0x40; + } + + return 0; +} + +static UINT8 epos_hardware_decrypt_rom(UINT16 offset) +{ + if (offset & 0x01) + { + epos_hardware_counter = epos_hardware_counter - 1; + if (epos_hardware_counter < 0) + epos_hardware_counter = 0x0f; + } + else + { + epos_hardware_counter = (epos_hardware_counter + 1) & 0x0f; + } + + if (epos_hardware_counter >= 0x08 && epos_hardware_counter <= 0x0b) { + epos_hardware_set_bank(epos_hardware_counter); + } + + return 0; +} + +static UINT8 maketrax_special_port2_r(UINT16 offset) // and korosuke +{ + INT32 data = DrvDips[2]; + INT32 pc = ZetPc(-1); + + if (pc == 0x1973 || pc == 0x2389 || pc == 0x196e || pc == 0x2387) return data | 0x40; + + switch (offset) + { + case 0x01: + case 0x04: data |= 0x40; break; + case 0x05: data |= 0xc0; break; + + default: data &= 0x3f; break; + } + + return data; +} + +static UINT8 maketrax_special_port3_r(UINT16 offset) +{ + INT32 pc = ZetPc(-1); + + if (pc == 0x040e || pc == 0x0445) return 0x20; + if (pc == 0x115e || pc == 0x3ae2 || pc == 0x115b || pc == 0x3ae6) return 0x00; + + switch (offset) + { + case 0x00: return 0x1f; + case 0x09: return 0x30; + case 0x0c: return 0x00; + + default: return 0x20; + } +} + +UINT8 __fastcall pacman_read(UINT16 a) +{ + switch (game_select) + { + case ALIBABA: + { + if (a == 0x50c0) return rand() & 0xff; + if (a == 0x50c1) { + alibaba_mystery++; + return (alibaba_mystery >> 10) & 1; + } + } + break; + + case CANNONBP: + { + if ((a & 0xf000) == 0x3000) return cannonbp_protection_r(a & 0xfff); + } + break; + + case MAKETRAX: + { + if ((a & 0xffc0) == 0x5080) return maketrax_special_port2_r(a & 0x3f); + if ((a & 0xffc0) == 0x50c0) return maketrax_special_port3_r(a & 0x3f); + } + break; + + case CRUSHS: + { + if (a == 0x5080) return DrvInputs[1]; + } + break; + + case ROCKTRV2: + { + if ((a & 0xfff0) == 0x5fe0) return (rocktrv2_prot_data[(a >> 2) & 3] >> 4); + + if (a == 0x5fff) return DrvDips[3]; + + if ((a & 0x8000) == 0x8000) return DrvQROM[(a & 0x7fff) | (nPacBank * 0x8000)]; + } + break; + } + + switch (a & ~0x003f) + { + case 0x5000: return DrvInputs[0]; + case 0x5040: return DrvInputs[1]; + case 0x5080: return DrvDips[2]; + case 0x50c0: return DrvDips[3]; + } + + if ((a & 0xfc00) == 0x4800) return 0xbf; + + return 0; +} + +void __fastcall pacman_write(UINT16 a, UINT8 d) +{ + switch (game_select) + { + case BIRDIY: + { + if ((a & 0xffe0) == 0x5080) a -= 0x0040; + if ((a & 0xfff0) == 0x50a0) a -= 0x0040; + if (a == 0x5000) return; + if (a == 0x5001) interrupt_mask = d & 1; + } + break; + + case ALIBABA: + { + if (a == 0x50c2) { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + interrupt_mask = d; + return; + } + + if ((a & 0xfff0) == 0x5040) { + NamcoSoundWrite((a & 0x0f) | 0x00, d); + return; + } + + if ((a & 0xfff0) == 0x5060) { + NamcoSoundWrite((a & 0x0f) | 0x10, d); + return; + } + + if ((a & 0xfff0) == 0x5050) { + DrvSprRAM2[a & 0x0f] = d; + return; + } + + if (a == 0x5000) { + watchdog = 0; + return; + } + } + break; + + case ROCKTRV2: + { + if ((a & 0xfffc) == 0x5fe0) { + rocktrv2_prot_data[a & 3] = d; + return; + } + + if (a == 0x5ff0) { + nPacBank = d; + return; + } + } + break; + + case VANVAN: + { + if (a == 0x5001) { + for (INT32 i = 0; i < 0x100; i++) { + if (DrvColPROM[0x100 + i] == 0) { + Palette[i] = (d & 1) ? BurnHighCol(0xaa, 0xaa, 0xaa, 0) : 0; + } + } + return; + } + } + break; + + case BIGBUCKS: + if (a == 0x6000) { + nPacBank = d; + return; + } + break; + } + + if ((a & 0xffe0) == 0x5040) { + NamcoSoundWrite(a & 0x1f, d); + return; + } + + if ((a & 0xfff0) == 0x5060) { + DrvSprRAM2[a & 0x0f] = d; + return; + } + + switch (a) + { + case 0x5000: + interrupt_mask = d & 1; + break; + + case 0x5001: + // pacman_sound_enable_w + break; + + case 0x5003: + *flipscreen = d & 1; + break; + + case 0x5002:// nop + case 0x5007:// coin counter + break; + + case 0x50c0: + watchdog = 0; + break; + } +} + +UINT8 __fastcall pacman_in_port(UINT16 a) +{ + if (game_select == BIGBUCKS) { + return DrvQROM[(nPacBank << 16) | (a ^ 0xffff)]; + } + + a &= 0xff; + + switch (game_select) + { + case CRUSHS: + if (a == 1) return DrvDips[3]; + if (a == 2) return DrvDips[2]; + return 0; + + case EPOS: + return epos_hardware_decrypt_rom(a); + + case MSCHAMP: + if (a == 0) return mschamp_counter++; + return 0; + } + + return 0; +} + +void __fastcall pacman_out_port(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (game_select) + { + case CRUSHS: + if (a == 0 || a == 1) { + AY8910Write(0, ~a & 1, d); + } + return; + + case DREMSHPR: + if (a == 6 || a == 7) { + AY8910Write(0, ~a & 1, d); + } + return; + + case VANVAN: + if (a == 1 || a == 2) { + SN76496Write(a - 1, d); + } + return; + + case PIRANHA: + if (a == 0) { + if (d == 0xfa) d = 0x78; + interrupt_mode = d; + } + return; + + case NMOUSE: + if (a == 0) { + if (d == 0xbf) d = 0x3c; + if (d == 0xc6) d = 0x40; + interrupt_mode = d; + } + return; + } + + if (a == 0) // pacman & clones only + { + interrupt_mode = d; + ZetSetVector(d); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +UINT8 __fastcall mspacman_read(UINT16 a) +{ + if ((a < 0x4000) || (a >= 0x8000 && a <= 0xbfff)) + { + if ((a >= 0x0038 && a <= 0x003f) | + (a >= 0x03b0 && a <= 0x03b7) | + (a >= 0x1600 && a <= 0x1607) | + (a >= 0x2120 && a <= 0x2127) | + (a >= 0x3ff0 && a <= 0x3ff7) | + (a >= 0x8000 && a <= 0x8007) | + (a >= 0x97f0 && a <= 0x97f7)) + { + nPacBank = 0; + } + + if (a >= 0x3ff8 && a <= 0x3fff) { + nPacBank = 1; + } + + return DrvZ80ROM[(nPacBank << 16) + a]; + } + + if ((a & 0xfc00) == 0x4800) return 0xbf; // unmapped read + + if ((a & 0xff00) == 0x5000) a &= ~0x003f; + + switch (a) + { + case 0x5000: return DrvInputs[0]; + case 0x5040: return DrvInputs[1]; + case 0x5080: return DrvDips[2]; + case 0x50c0: return DrvDips[3]; + } + + return 0; +} + +void __fastcall mspacman_write(UINT16 a, UINT8 d) +{ + if ((a >= 0x0038 && a <= 0x003f) | + (a >= 0x03b0 && a <= 0x03b7) | + (a >= 0x1600 && a <= 0x1607) | + (a >= 0x2120 && a <= 0x2127) | + (a >= 0x3ff0 && a <= 0x3ff7) | + (a >= 0x8000 && a <= 0x8007) | + (a >= 0x97f0 && a <= 0x97f7)) + { + nPacBank = 0; + } + + if (a >= 0x3ff8 && a <= 0x3fff) { + nPacBank = 1; + } + + if ((a & 0xffe0) == 0x5040) { + NamcoSoundWrite(a & 0x1f, d); + return; + } + + if ((a & 0xfff0) == 0x5060) { + DrvSprRAM2[a & 0x0f] = d; + return; + } + + switch (a) + { + case 0x5000: + interrupt_mask = d & 1; + break; + + case 0x5001: + // pacman_sound_enable_w + break; + + case 0x5003: + *flipscreen = d & 1; + break; + + case 0x5002: // nop + case 0x5004: + case 0x5005: // leds + case 0x5006: // coin lockout + case 0x5007: // coin counter + case 0x5080: // nop + return; + + case 0x50c0: + watchdog = 0; + break; + } +} + +void __fastcall pengo_write(UINT16 a, UINT8 d) +{ + if ((a & 0xffe0) == 0x9000) { + NamcoSoundWrite(a & 0x1f, d); + return; + } + + if ((a & 0xfff0) == 0x9020) { + DrvSprRAM2[a & 0x0f] = d; + return; + } + + switch (a) + { + case 0x9040: + interrupt_mask = d & 1; + return; + + case 0x9042: + palettebank = d; + return; + + case 0x9043: + *flipscreen = d & 1; + return; + + case 0x9044: + case 0x9045: // coin counter + return; + + case 0x9046: + colortablebank = d; + return; + + case 0x9047: + charbank = d & 1; + spritebank = d & 1; + return; + + case 0x9070: + watchdog = 0; + return; + } +} + +UINT8 __fastcall pengo_read(UINT16 a) +{ + switch (a & ~0x003f) + { + case 0x9000: return DrvDips[3]; + case 0x9040: return DrvDips[2]; + case 0x9080: return DrvInputs[1]; + case 0x90c0: return DrvInputs[0]; + } + + return 0; +} + +//------------------------------------------------------------------------------------------------------ + +static INT32 DrvDoReset(INT32 clear_ram) +{ + if (clear_ram) { + memset (AllRam, 0, RamEnd - AllRam); + } + + watchdog = 0; + nPacBank = 0; + + ZetOpen(0); + ZetReset(); + + switch (game_select) + { + case EPOS: + epos_hardware_counter = 0x0A + acitya; + epos_hardware_set_bank(epos_hardware_counter); + break; + + case MSCHAMP: + mschamp_set_bank(); + break; + } + + ZetClose(); + + AY8910Reset(0); + + mschamp_counter = 0; + cannonb_bit_to_read = 0; + alibaba_mystery = 0; + + interrupt_mode = 0; + interrupt_mask = 0; + colortablebank = 0; + palettebank = 0; + spritebank = 0; + charbank = 0; + + return 0; +} + +static void DrvTransTableInit() +{ + for (INT32 i = 0; i < 0x100; i++) { + DrvTransTable[i] = (DrvColPROM[(i & 0xff) + 0x100] & 0x0f) ? 1 : 0; + } +} + +static void pacman_palette_init() +{ + UINT32 t_pal[32]; + + for (INT32 i = 0; i < 32; i++) + { + INT32 bit0 = (DrvColPROM[i] >> 0) & 0x01; + INT32 bit1 = (DrvColPROM[i] >> 1) & 0x01; + INT32 bit2 = (DrvColPROM[i] >> 2) & 0x01; + UINT8 r = (bit0 * 33) + (bit1 * 71) + (bit2 * 151); + + bit0 = (DrvColPROM[i] >> 3) & 0x01; + bit1 = (DrvColPROM[i] >> 4) & 0x01; + bit2 = (DrvColPROM[i] >> 5) & 0x01; + UINT8 g = (bit0 * 33) + (bit1 * 71) + (bit2 * 151); + + bit0 = (DrvColPROM[i] >> 6) & 0x01; + bit1 = (DrvColPROM[i] >> 7) & 0x01; + UINT8 b = (bit0 * 81) + (bit1 * 174); + + t_pal[i] = BurnHighCol(r, g, b, 0); + } + + for (INT32 i = 0; i < 256; i++) + { + UINT8 ctabentry = DrvColPROM[i + 0x100] & 0x0f; + + Palette[0x000 + i] = t_pal[ctabentry + 0x00]; + Palette[0x100 + i] = t_pal[ctabentry + 0x10]; + } + + DrvRecalc = 1; +} + +static void convert_gfx() +{ + static INT32 PlaneOffsets[2] = { 0, 4 }; + static INT32 CharXOffsets[8] = { 64, 65, 66, 67, 0, 1, 2, 3 }; + static INT32 SpriXOffsets[16] = { 8*8, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3, 0, 1, 2, 3 }; + static INT32 YOffsets[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 }; + + INT32 size = (game_select == PENGO) ? 0x2000 : 0x1000; + + UINT8 *tmp = (UINT8*)BurnMalloc( size * 2 ); + + if (tmp) + { + memcpy (tmp, DrvGfxROM, size * 2); + + GfxDecode(((size * 4) / 0x040), 2, 8, 8, PlaneOffsets, CharXOffsets + 0, YOffsets, 0x080, tmp, DrvGfxROM + 0x0000); + GfxDecode(((size * 4) / 0x100), 2, 16, 16, PlaneOffsets, SpriXOffsets + 0, YOffsets, 0x200, tmp + size, DrvGfxROM + 0x8000); + } + + BurnFree (tmp); +} + +static INT32 pacman_load() +{ + char* pRomName; + struct BurnRomInfo ri; + + INT32 pOffset = 0; + UINT8 *gLoad = DrvGfxROM; + UINT8 *cLoad = DrvColPROM; + UINT8 *sLoad = NamcoSoundProm; + UINT8 *qLoad = DrvQROM; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & 7) == 1) { + if (BurnLoadRom(DrvZ80ROM + pOffset, i, 1)) return 1; + + if (game_select == MSPACMAN) { + pOffset += 0x1000; + } else { + pOffset += ri.nLen; + } + + if (pOffset == 0x4000 && game_select != PENGO) { + pOffset = 0x8000; + } + + continue; + } + + if ((ri.nType & 7) == 2) { + if (BurnLoadRom(gLoad, i, 1)) return 1; + gLoad += ri.nLen; + + continue; + } + + if ((ri.nType & 7) == 3) { + if (BurnLoadRom(cLoad, i, 1)) return 1; + cLoad += 0x100; + + continue; + } + + if ((ri.nType & 7) == 4) { + if (BurnLoadRom(sLoad, i, 1)) return 1; + sLoad += 0x100; + + continue; + } + + if ((ri.nType & 7) == 7) { + if (BurnLoadRom(qLoad, i, 1)) return 1; + qLoad += ri.nLen; + + continue; + } + } + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x020000; + + DrvQROM = Next; + if (game_select == BIGBUCKS) Next += 0x060000; + if (game_select == ROCKTRV2) Next += 0x040000; + + DrvGfxROM = Next; Next += 0x010000; + + DrvColPROM = Next; Next += 0x000500; + NamcoSoundProm = Next; Next += 0x000200; + + DrvTransTable = Next; Next += 0x000200; + + Palette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x001000; + + DrvSprRAM = DrvZ80RAM + ((game_select == ALIBABA) ? 0x6f0 : 0x7f0); + DrvSprRAM2 = Next; Next += 0x000010; + + DrvColRAM = Next; Next += 0x000400; + DrvVidRAM = Next; Next += 0x000400; + + rocktrv2_prot_data = Next; Next += 0x000004; + + flipscreen = Next; Next += 0x000001; + + RamEnd = Next; + + pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static void StandardMap() +{ + for (INT32 i = 0; i <= 0x8000; i += 0x8000)// mirror + { + ZetMapArea(0x0000 + i, 0x3fff + i, 0, DrvZ80ROM); + ZetMapArea(0x0000 + i, 0x3fff + i, 2, DrvZ80ROM); + + for (INT32 j = 0; j <= 0x2000; j+= 0x2000) // mirrors + { + ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 0, DrvVidRAM); + ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 1, DrvVidRAM); + ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 2, DrvVidRAM); + ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 0, DrvColRAM); + ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 1, DrvColRAM); + ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 2, DrvColRAM); + ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 0, DrvZ80RAM + 0x0400); + ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 1, DrvZ80RAM + 0x0400); + ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 2, DrvZ80RAM + 0x0400); + } + } + + ZetSetWriteHandler(pacman_write); + ZetSetReadHandler(pacman_read); + ZetSetOutHandler(pacman_out_port); + ZetSetInHandler(pacman_in_port); +} + +static void CannonbpMap() +{ + for (INT32 i = 0; i <= 0x8000; i += 0x8000) { // mirror + + ZetMapArea(0x0000 + i, 0x2fff + i, 0, DrvZ80ROM); + ZetMapArea(0x0000 + i, 0x2fff + i, 2, DrvZ80ROM); + + for (INT32 j = 0; j <= 0x2000; j+= 0x2000) { // mirrors + ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 0, DrvVidRAM); + ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 1, DrvVidRAM); + ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 2, DrvVidRAM); + ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 0, DrvColRAM); + ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 1, DrvColRAM); + ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 2, DrvColRAM); + ZetMapArea(0x4800 + i + j, 0x4bff + i + j, 0, DrvZ80RAM + 0x0000); + ZetMapArea(0x4800 + i + j, 0x4bff + i + j, 1, DrvZ80RAM + 0x0000); + ZetMapArea(0x4800 + i + j, 0x4bff + i + j, 2, DrvZ80RAM + 0x0000); + ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 0, DrvZ80RAM + 0x0400); + ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 1, DrvZ80RAM + 0x0400); + ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 2, DrvZ80RAM + 0x0400); + } + } + + ZetSetWriteHandler(pacman_write); + ZetSetReadHandler(pacman_read); + ZetSetOutHandler(pacman_out_port); + ZetSetInHandler(pacman_in_port); +} + +static void DremshprMap() // and vanvan +{ + CannonbpMap(); + + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x8000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x8000); +} + +static void WoodpekMap() +{ + StandardMap(); + + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x8000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x8000); +} + +static void Rocktrv2Map() +{ + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM); + ZetMapArea(0x4000, 0x43ff, 0, DrvVidRAM); + ZetMapArea(0x4000, 0x43ff, 1, DrvVidRAM); + ZetMapArea(0x4000, 0x43ff, 2, DrvVidRAM); + ZetMapArea(0x4400, 0x47ff, 0, DrvColRAM); + ZetMapArea(0x4400, 0x47ff, 1, DrvColRAM); + ZetMapArea(0x4400, 0x47ff, 2, DrvColRAM); + ZetMapArea(0x4c00, 0x4fff, 0, DrvZ80RAM + 0x0400); + ZetMapArea(0x4c00, 0x4fff, 1, DrvZ80RAM + 0x0400); + ZetMapArea(0x4c00, 0x4fff, 2, DrvZ80RAM + 0x0400); + + ZetMapArea(0x6000, 0x7fff, 0, DrvZ80ROM + 0x8000); + ZetMapArea(0x6000, 0x7fff, 2, DrvZ80ROM + 0x8000); + + ZetSetWriteHandler(pacman_write); + ZetSetReadHandler(pacman_read); + ZetSetOutHandler(pacman_out_port); + ZetSetInHandler(pacman_in_port); +} + +static void BigbucksMap() +{ + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM); + ZetMapArea(0x4000, 0x43ff, 0, DrvVidRAM); + ZetMapArea(0x4000, 0x43ff, 1, DrvVidRAM); + ZetMapArea(0x4000, 0x43ff, 2, DrvVidRAM); + ZetMapArea(0x4400, 0x47ff, 0, DrvColRAM); + ZetMapArea(0x4400, 0x47ff, 1, DrvColRAM); + ZetMapArea(0x4400, 0x47ff, 2, DrvColRAM); + ZetMapArea(0x4c00, 0x4fff, 0, DrvZ80RAM + 0x0400); + ZetMapArea(0x4c00, 0x4fff, 1, DrvZ80RAM + 0x0400); + ZetMapArea(0x4c00, 0x4fff, 2, DrvZ80RAM + 0x0400); + + ZetMapArea(0x8000, 0x9fff, 0, DrvZ80ROM + 0x8000); + ZetMapArea(0x8000, 0x9fff, 2, DrvZ80ROM + 0x8000); + + ZetSetWriteHandler(pacman_write); + ZetSetReadHandler(pacman_read); + ZetSetOutHandler(pacman_out_port); + ZetSetInHandler(pacman_in_port); +} + +static void AlibabaMap() +{ + StandardMap(); + + ZetMapArea(0x8000, 0x8fff, 0, DrvZ80ROM + 0x8000); + ZetMapArea(0x8000, 0x8fff, 2, DrvZ80ROM + 0x8000); + + for (INT32 i = 0; i < 0x1000; i+= 0x400) { + ZetMapArea(0x9000 + i, 0x93ff + i, 0, DrvZ80RAM + 0x0000); + ZetMapArea(0x9000 + i, 0x93ff + i, 1, DrvZ80RAM + 0x0000); + ZetMapArea(0x9000 + i, 0x93ff + i, 2, DrvZ80RAM + 0x0000); + } + + for (INT32 i = 0x0000; i < 0x2000; i += 0x0800) { + ZetMapArea(0xa000 + i, 0xa7ff + i, 0, DrvZ80ROM + 0xa000); + ZetMapArea(0xa000 + i, 0xa7ff + i, 2, DrvZ80ROM + 0xa000); + } +} + +static void PengoMap() +{ + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); +// ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM + 0x8000, DrvZ80ROM); + ZetMapArea(0x8000, 0x83ff, 0, DrvVidRAM); + ZetMapArea(0x8000, 0x83ff, 1, DrvVidRAM); + ZetMapArea(0x8000, 0x83ff, 2, DrvVidRAM); + ZetMapArea(0x8400, 0x87ff, 0, DrvColRAM); + ZetMapArea(0x8400, 0x87ff, 1, DrvColRAM); + ZetMapArea(0x8400, 0x87ff, 2, DrvColRAM); + ZetMapArea(0x8800, 0x8fff, 0, DrvZ80RAM); + ZetMapArea(0x8800, 0x8fff, 1, DrvZ80RAM); + ZetMapArea(0x8800, 0x8fff, 2, DrvZ80RAM); + + ZetSetWriteHandler(pengo_write); + ZetSetReadHandler(pengo_read); +} + +static void MspacmanMap() +{ + for (INT32 i = 0; i <= 0x8000; i += 0x8000)// mirror + { + for (INT32 j = 0; j <= 0x2000; j+= 0x2000) // mirrors + { + ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 0, DrvVidRAM); + ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 1, DrvVidRAM); + ZetMapArea(0x4000 + i + j, 0x43ff + i + j, 2, DrvVidRAM); + ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 0, DrvColRAM); + ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 1, DrvColRAM); + ZetMapArea(0x4400 + i + j, 0x47ff + i + j, 2, DrvColRAM); + ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 0, DrvZ80RAM + 0x0400); + ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 1, DrvZ80RAM + 0x0400); + ZetMapArea(0x4c00 + i + j, 0x4fff + i + j, 2, DrvZ80RAM + 0x0400); + } + } + + ZetSetWriteHandler(mspacman_write); + ZetSetReadHandler(mspacman_read); + ZetSetOutHandler(pacman_out_port); +} + +static INT32 DrvInit(void (*mapCallback)(), void (*pInitCallback)(), INT32 select) +{ + game_select = select; + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (pacman_load()) return 1; + + if (pInitCallback) { + pInitCallback(); + } + + convert_gfx(); + pacman_palette_init(); + DrvTransTableInit(); + + ZetInit(0); + ZetOpen(0); + mapCallback(); + ZetClose(); + + AY8910Init(0, 1789750, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.75, BURN_SND_ROUTE_BOTH); + if (game_select == DREMSHPR) AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + + SN76496Init(0, 1789750, 0); + SN76496Init(1, 1789750, 1); + SN76496SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 0.75, BURN_SND_ROUTE_BOTH); + + NamcoSoundInit(18432000 / 6 / 32, 3); + NacmoSoundSetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(1); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + + AY8910Exit(0); + SN76496Exit(); + NamcoSoundExit(); + + game_select = PACMAN; + acitya = 0; + + nPacBank = -1; + + BurnFree (AllMem); + + return 0; +} + +static void DrawBackground() +{ + for (INT32 offs = 0; offs < 36 * 28; offs++) + { + INT32 sx = (offs % 36); + INT32 sy = offs / 36; + + INT32 row = sy + 2; + INT32 col = sx - 2; + + INT32 ofst; + + if (col & 0x20) + ofst = row + ((col & 0x1f) << 5); + else + ofst = col + (row << 5); + + INT32 code = (charbank << 8) | DrvVidRAM[ofst]; + INT32 color = (DrvColRAM[ofst] & 0x1f) | (colortablebank << 5) | (palettebank << 6); + + if (*flipscreen) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, (272 - (sx * 8)) + 8, (224 - (sy * 8)) - 8, color, 2, 0, DrvGfxROM); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx * 8, sy * 8, color, 2, 0, DrvGfxROM); + } + } +} + +static void DrawSprites() +{ + for (INT32 offs = 0x10 - 2;offs >= 0;offs -= 2) + { + INT32 code = (DrvSprRAM[offs] >> 2) | (spritebank << 6); + INT32 color = (DrvSprRAM[offs + 1] & 0x1f ) | (colortablebank << 5) | (palettebank << 6); + + INT32 sx = DrvSprRAM2[offs + 1]; + INT32 sy = DrvSprRAM2[offs]; + INT32 flipx = DrvSprRAM [offs] & 1; + INT32 flipy = DrvSprRAM [offs] & 2; + + if (*flipscreen) { + sy = (240 - sy) - 8; + sx += 8; + flipy = !flipy; + flipx = !flipx; + } else { + sx = 272 - sx; + sy = sy - 31; + } + + RenderTileTranstab(pTransDraw, DrvGfxROM + 0x8000, code, color << 2, 0, sx, sy, flipx, flipy, 16, 16, DrvTransTable); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + pacman_palette_init(); + DrvRecalc = 0; + } + + DrawBackground(); + DrawSprites(); + + BurnTransferCopy(Palette); + + return 0; +} + +static INT32 DrvFrame() +{ + watchdog++; + if (watchdog >= 16) { + bprintf (0, _T("watchdog triggered\n")); + DrvDoReset(0); + } + + if (DrvReset) { + DrvDoReset(1); + } + + { + memset (DrvInputs, 0, 2); + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + + if (!acitya && game_select != SHOOTBUL) { + if ((DrvInputs[0] & 6) == 6) DrvInputs[0] &= ~0x06; + if ((DrvInputs[0] & 9) == 9) DrvInputs[0] &= ~0x09; + if ((DrvInputs[1] & 6) == 6) DrvInputs[1] &= ~0x06; + if ((DrvInputs[1] & 9) == 9) DrvInputs[1] &= ~0x09; + } + + DrvInputs[0] ^= DrvDips[0]; + DrvInputs[1] ^= DrvDips[1]; + + nAnalogAxis[0] -= DrvAxis[0]; + nAnalogAxis[1] -= DrvAxis[1]; + + nCharAxis[0] = (DrvAxis[0] >> 12) & 0x0f; + nCharAxis[1] = (DrvAxis[1] >> 12) & 0x0f; + + if (game_select == SHOOTBUL) { + DrvInputs[0] ^= nCharAxis[0]; + DrvInputs[1] ^= nCharAxis[1]; + } + } + + ZetOpen(0); + + INT32 nInterleave = nBurnSoundLen; + INT32 nSoundBufferPos = 0; + + INT32 nCyclesTotal = (18432000 / 6) / 60; + INT32 nCyclesDone = 0; + INT32 nCyclesSegment; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext; + + nNext = (i + 1) * nCyclesTotal / nInterleave; + nCyclesSegment = nNext - nCyclesDone; + nCyclesDone += ZetRun(nCyclesSegment); + + if (game_select == BIGBUCKS) { + INT32 nInterleaveIRQFire = nBurnSoundLen / 20; + for (INT32 j = 0; j < 20; j++) { + if (i == (nInterleaveIRQFire * j) - 1) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + } else { + if (game_select == DREMSHPR || game_select == VANVAN) { + if (i == (nInterleave - 1)) ZetNmi(); + } else { + if (i == (nInterleave - 1) && interrupt_mask) { + ZetSetVector(interrupt_mode); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + if (game_select == DREMSHPR || game_select == CRUSHS) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } else { + if (game_select == VANVAN) { + SN76496Update(0, pSoundBuf, nSegmentLength); + SN76496Update(1, pSoundBuf, nSegmentLength); + } else { + NamcoSoundUpdate(pSoundBuf, nSegmentLength); + } + } + } + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + if (game_select == DREMSHPR || game_select == CRUSHS) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } else { + if (game_select == VANVAN) { + SN76496Update(0, pSoundBuf, nSegmentLength); + SN76496Update(1, pSoundBuf, nSegmentLength); + } else { + NamcoSoundUpdate(pSoundBuf, nSegmentLength); + } + } + } + } + + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +//------------------------------------------------------------------------------------------------------ + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029693; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + NamcoSoundScan(nAction, pnMin); + AY8910Scan(nAction, pnMin); + SN76496Scan(nAction, pnMin); + + SCAN_VAR(nPacBank); + + SCAN_VAR(interrupt_mode); + SCAN_VAR(interrupt_mask); + + SCAN_VAR(colortablebank); + SCAN_VAR(palettebank); + SCAN_VAR(spritebank); + SCAN_VAR(charbank); + + SCAN_VAR(alibaba_mystery); + SCAN_VAR(epos_hardware_counter); + SCAN_VAR(mschamp_counter); + SCAN_VAR(cannonb_bit_to_read); + } + + if (nAction & ACB_WRITE) { + if (game_select == MSCHAMP) { + mschamp_set_bank(); + } + + if (game_select == EPOS) { + epos_hardware_set_bank(nPacBank); + } + } + + return 0; +} + + +//------------------------------------------------------------------------------------------------------ + + +// PuckMan (Japan set 1, Probably Bootleg) + +static struct BurnRomInfo puckmanRomDesc[] = { + { "namcopac.6e", 0x1000, 0xfee263b3, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "namcopac.6f", 0x1000, 0x39d1fc83, 1 | BRF_ESS | BRF_PRG }, // 1 + { "namcopac.6h", 0x1000, 0x02083b03, 1 | BRF_ESS | BRF_PRG }, // 2 + { "namcopac.6j", 0x1000, 0x7a36fe55, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics + { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(puckman) +STD_ROM_FN(puckman) + +static INT32 puckmanInit() +{ + return DrvInit(StandardMap, NULL, PACMAN); +} + +struct BurnDriver BurnDrvpuckman = { + "puckman", NULL, NULL, NULL, "1980", + "PuckMan (Japan set 1, Probably Bootleg)\0", NULL, "Namco", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, puckmanRomInfo, puckmanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// PuckMan (Japan set 1 with speedup hack) + +static struct BurnRomInfo puckmanfRomDesc[] = { + { "namcopac.6e", 0x1000, 0xfee263b3, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "nampfast.6f", 0x1000, 0x51b38db9, 1 | BRF_ESS | BRF_PRG }, // 1 + { "namcopac.6h", 0x1000, 0x02083b03, 1 | BRF_ESS | BRF_PRG }, // 2 + { "namcopac.6j", 0x1000, 0x7a36fe55, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics + { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(puckmanf) +STD_ROM_FN(puckmanf) + +struct BurnDriver BurnDrvpuckmanf = { + "puckmanf", "puckman", NULL, NULL, "1980", + "PuckMan (Japan set 1 with speedup hack)\0", NULL, "Namco", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, puckmanfRomInfo, puckmanfRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// PuckMan (Japan set 3) + +static struct BurnRomInfo puckmodRomDesc[] = { + { "namcopac.6e", 0x1000, 0xfee263b3, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "namcopac.6f", 0x1000, 0x39d1fc83, 1 | BRF_ESS | BRF_PRG }, // 1 + { "namcopac.6h", 0x1000, 0x02083b03, 1 | BRF_ESS | BRF_PRG }, // 2 + { "npacmod.6j", 0x1000, 0x7d98d5f5, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics + { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(puckmod) +STD_ROM_FN(puckmod) + +struct BurnDriver BurnDrvpuckmod = { + "puckmod", "puckman", NULL, NULL, "1981", + "PuckMan (Japan set 3)\0", NULL, "Namco", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, puckmodRomInfo, puckmodRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// PuckMan (Japan set 2) + +static struct BurnRomInfo puckmanaRomDesc[] = { + { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 + { "prg7", 0x0800, 0xb6289b26, 1 | BRF_ESS | BRF_PRG }, // 3 + { "prg8", 0x0800, 0x17a88c13, 1 | BRF_ESS | BRF_PRG }, // 4 + + { "chg1", 0x0800, 0x2066a0b7, 2 | BRF_GRA }, // 5 Graphics + { "chg2", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 6 + { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 7 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(puckmana) +STD_ROM_FN(puckmana) + +struct BurnDriver BurnDrvpuckmana = { + "puckmana", "puckman", NULL, NULL, "1981", + "PuckMan (Japan set 2)\0", NULL, "Namco", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, puckmanaRomInfo, puckmanaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pac-Man (Midway) + +static struct BurnRomInfo pacmanRomDesc[] = { + { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics + { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(pacman) +STD_ROM_FN(pacman) + +struct BurnDriver BurnDrvpacman = { + "pacman", "puckman", NULL, NULL, "1980", + "Pac-Man (Midway)\0", NULL, "[Namco] (Midway license)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pacmanRomInfo, pacmanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pac-Man (Midway, with speedup hack) + +static struct BurnRomInfo pacmanfRomDesc[] = { + { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacfast.6f", 0x1000, 0x720dc3ee, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics + { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(pacmanf) +STD_ROM_FN(pacmanf) + +struct BurnDriver BurnDrvpacmanf = { + "pacmanf", "puckman", NULL, NULL, "1980", + "Pac-Man (Midway, with speedup hack)\0", NULL, "[Namco] (Midway license)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pacmanfRomInfo, pacmanfRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Hangly-Man (set 1) + +static struct BurnRomInfo hanglyRomDesc[] = { + { "hangly.6e", 0x1000, 0x5fe8610a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "hangly.6f", 0x1000, 0x73726586, 1 | BRF_ESS | BRF_PRG }, // 1 + { "hangly.6h", 0x1000, 0x4e7ef99f, 1 | BRF_ESS | BRF_PRG }, // 2 + { "hangly.6j", 0x1000, 0x7f4147e6, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics + { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(hangly) +STD_ROM_FN(hangly) + +struct BurnDriver BurnDrvhangly = { + "hangly", "puckman", NULL, NULL, "1981", + "Hangly-Man (set 1)\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, hanglyRomInfo, hanglyRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Hangly-Man (set 2) + +static struct BurnRomInfo hangly2RomDesc[] = { + { "hangly.6e", 0x1000, 0x5fe8610a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "hangly2.6f", 0x0800, 0x5ba228bb, 1 | BRF_ESS | BRF_PRG }, // 1 + { "hangly2.6m", 0x0800, 0xbaf5461e, 1 | BRF_ESS | BRF_PRG }, // 2 + { "hangly.6h", 0x1000, 0x4e7ef99f, 1 | BRF_ESS | BRF_PRG }, // 3 + { "hangly2.6j", 0x0800, 0x51305374, 1 | BRF_ESS | BRF_PRG }, // 4 + { "hangly2.6p", 0x0800, 0x427c9d4d, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "pacmanh.5e", 0x1000, 0x299fb17a, 2 | BRF_GRA }, // 6 Graphics + { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 7 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(hangly2) +STD_ROM_FN(hangly2) + +struct BurnDriver BurnDrvhangly2 = { + "hangly2", "puckman", NULL, NULL, "1981", + "Hangly-Man (set 2)\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, hangly2RomInfo, hangly2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Hangly-Man (set 3) + +static struct BurnRomInfo hangly3RomDesc[] = { + { "hm1.6e", 0x0800, 0x9d027c4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "hm5.6k", 0x0800, 0x194c7189, 1 | BRF_ESS | BRF_PRG }, // 1 + { "hangly2.6f", 0x0800, 0x5ba228bb, 1 | BRF_ESS | BRF_PRG }, // 2 + { "hangly2.6m", 0x0800, 0xbaf5461e, 1 | BRF_ESS | BRF_PRG }, // 3 + { "hm3.6h", 0x0800, 0x08419c4a, 1 | BRF_ESS | BRF_PRG }, // 4 + { "hm7.6n", 0x0800, 0xab74b51f, 1 | BRF_ESS | BRF_PRG }, // 5 + { "hm4.6j", 0x0800, 0x5039b082, 1 | BRF_ESS | BRF_PRG }, // 6 + { "hm8.6p", 0x0800, 0x931770d7, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "hm9.5e", 0x0800, 0x5f4be3cc, 2 | BRF_GRA }, // 8 Graphics + { "hm11.5h", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 9 + { "hm10.5f", 0x0800, 0x9e39323a, 2 | BRF_GRA }, // 10 + { "hm12.5j", 0x0800, 0x1b1d9096, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(hangly3) +STD_ROM_FN(hangly3) + +struct BurnDriver BurnDrvhangly3 = { + "hangly3", "puckman", NULL, NULL, "1981", + "Hangly-Man (set 3)\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, hangly3RomInfo, hangly3RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Popeye Man + +static struct BurnRomInfo popeyemanRomDesc[] = { + { "pop1.6e", 0x0800, 0x9d027c4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pop5.6k", 0x0800, 0x194c7189, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pop2.6f", 0x0800, 0x5ba228bb, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pop6.6m", 0x0800, 0xbaf5461e, 1 | BRF_ESS | BRF_PRG }, // 3 + { "pop3.6h", 0x0800, 0x08419c4a, 1 | BRF_ESS | BRF_PRG }, // 4 + { "pop7.6n", 0x0800, 0xab74b51f, 1 | BRF_ESS | BRF_PRG }, // 5 + { "pop4.6j", 0x0800, 0x5039b082, 1 | BRF_ESS | BRF_PRG }, // 6 + { "pop8.6p", 0x0800, 0x931770d7, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "pop9.5e", 0x0800, 0xb569c4c1, 2 | BRF_GRA }, // 8 Graphics + { "pop11.5h", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 9 + { "pop10.5f", 0x0800, 0x014fb5a4, 2 | BRF_GRA }, // 10 + { "pop12.5j", 0x0800, 0x21b91c64, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(popeyeman) +STD_ROM_FN(popeyeman) + +struct BurnDriver BurnDrvpopeyeman = { + "popeyeman", "puckman", NULL, NULL, "1981", + "Popeye-Man\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HACK, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, popeyemanRomInfo, popeyemanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Crock-Man + +static struct BurnRomInfo crockmanRomDesc[] = { + { "p1.6e", 0x0800, 0x2c0fa0ab, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "p5.6k", 0x0800, 0xafeca2f1, 1 | BRF_ESS | BRF_PRG }, // 1 + { "p2.6f", 0x0800, 0x7d177853, 1 | BRF_ESS | BRF_PRG }, // 2 + { "p6.6m", 0x0800, 0xd3e8914c, 1 | BRF_ESS | BRF_PRG }, // 3 + { "p3.6h", 0x0800, 0x9045a44c, 1 | BRF_ESS | BRF_PRG }, // 4 + { "p7.6n", 0x0800, 0x93f344c5, 1 | BRF_ESS | BRF_PRG }, // 5 + { "p4.6j", 0x0800, 0xbed4a077, 1 | BRF_ESS | BRF_PRG }, // 6 + { "p8.6p", 0x0800, 0x800be41e, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "p9.5e", 0x0800, 0xa10218c4, 2 | BRF_GRA }, // 8 Graphics + { "p11.5h", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 9 + { "p10.5f", 0x0800, 0x9e39323a, 2 | BRF_GRA }, // 10 + { "p12.5j", 0x0800, 0x1b1d9096, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(crockman) +STD_ROM_FN(crockman) + +struct BurnDriver BurnDrvcrockman = { + "crockman", "puckman", NULL, NULL, "1980", + "Crock-Man (bootleg, Rene-Pierre)\0", NULL, "bootleg (Rene-Pierre)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, crockmanRomInfo, crockmanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pac-Man (Midway, harder) + +static struct BurnRomInfo pacmodRomDesc[] = { + { "pacmanh.6e", 0x1000, 0x3b2ec270, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacmanh.6h", 0x1000, 0x18811780, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pacmanh.6j", 0x1000, 0x5c96a733, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pacmanh.5e", 0x1000, 0x299fb17a, 2 | BRF_GRA }, // 4 Graphics + { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(pacmod) +STD_ROM_FN(pacmod) + +struct BurnDriver BurnDrvpacmod = { + "pacmod", "puckman", NULL, NULL, "1981", + "Pac-Man (Midway, harder)\0", NULL, "[Namco] (Midway license)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pacmodRomInfo, pacmodRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Puckman (Falcom?) + +static struct BurnRomInfo puckmanhRomDesc[] = { + { "pm01.6e", 0x1000, 0x5fe8610a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pm02.6f", 0x1000, 0x61d38c6c, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pm03.6h", 0x1000, 0x4e7ef99f, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pm04.6j", 0x1000, 0x8939ddd2, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pm9.5e", 0x0800, 0x2229ab07, 2 | BRF_GRA }, // 4 Graphics + { "pm11.5h", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 5 + { "pm10.5f", 0x0800, 0x9e39323a, 2 | BRF_GRA }, // 6 + { "pm12.5j", 0x0800, 0x1b1d9096, 2 | BRF_GRA }, // 7 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(puckmanh) +STD_ROM_FN(puckmanh) + +struct BurnDriver BurnDrvpuckmanh = { + "puckmanh", "puckman", NULL, NULL, "1981", + "Puckman (Falcom?)\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, puckmanhRomInfo, puckmanhRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// New Puck-X + +static struct BurnRomInfo newpuckxRomDesc[] = { + { "puckman.6e", 0x1000, 0xa8ae23c5, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 + { "puckman.6h", 0x1000, 0x197443f8, 1 | BRF_ESS | BRF_PRG }, // 2 + { "puckman.6j", 0x1000, 0x2e64a3ba, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pacman.5e", 0x1000, 0x0c944964, 2 | BRF_GRA }, // 4 Graphics + { "pacman.5f", 0x1000, 0x958fedf9, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(newpuckx) +STD_ROM_FN(newpuckx) + +struct BurnDriver BurnDrvnewpuckx = { + "newpuckx", "puckman", NULL, NULL, "1980", + "New Puck-X\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, newpuckxRomInfo, newpuckxRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pac-Man (Hearts) + +static struct BurnRomInfo pacheartRomDesc[] = { + { "pacheart1.6e", 0x0800, 0xd844b679, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacheart.pg2", 0x0800, 0xb9152a38, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacheart2.6f", 0x0800, 0x7d177853, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pacheart.pg4", 0x0800, 0x842d6574, 1 | BRF_ESS | BRF_PRG }, // 3 + { "pacheart3.6h", 0x0800, 0x9045a44c, 1 | BRF_ESS | BRF_PRG }, // 4 + { "pacheart7.6n", 0x0800, 0x888f3c3e, 1 | BRF_ESS | BRF_PRG }, // 5 + { "pacheart.pg7", 0x0800, 0xf5265c10, 1 | BRF_ESS | BRF_PRG }, // 6 + { "pacheart.pg8", 0x0800, 0x1a21a381, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "pacheart.ch1", 0x0800, 0xc62bbabf, 2 | BRF_GRA }, // 8 Graphics + { "chg2", 0x0800, 0x3591b89d, 2 | BRF_GRA }, // 9 + { "pacheart.ch3", 0x0800, 0xca8c184c, 2 | BRF_GRA }, // 10 + { "pacheart.ch4", 0x0800, 0x1b1d9096, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(pacheart) +STD_ROM_FN(pacheart) + +struct BurnDriver BurnDrvpacheart = { + "pacheart", "puckman", NULL, NULL, "1981", + "Pac-Man (Hearts)\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pacheartRomInfo, pacheartRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Joyman + +static struct BurnRomInfo joymanRomDesc[] = { + { "joy1.6e", 0x0800, 0xd844b679, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "joy5.6k", 0x0800, 0xab9c8f29, 1 | BRF_ESS | BRF_PRG }, // 1 + { "joy2.6f", 0x0800, 0x7d177853, 1 | BRF_ESS | BRF_PRG }, // 2 + { "joy6.6m", 0x0800, 0xb3c8d32e, 1 | BRF_ESS | BRF_PRG }, // 3 + { "joy3.6h", 0x0800, 0x9045a44c, 1 | BRF_ESS | BRF_PRG }, // 4 + { "joy7.6n", 0x0800, 0x888f3c3e, 1 | BRF_ESS | BRF_PRG }, // 5 + { "joy4.6j", 0x0800, 0x00b553f8, 1 | BRF_ESS | BRF_PRG }, // 6 + { "joy8.6p", 0x0800, 0x5d5ce992, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "joy9.5e", 0x0800, 0x39b557bc, 2 | BRF_GRA }, // 8 Graphics + { "joy11.5h", 0x0800, 0x33e0289e, 2 | BRF_GRA }, // 9 + { "joy10.5f", 0x0800, 0x338771a6, 2 | BRF_GRA }, // 10 + { "joy12.5j", 0x0800, 0xf4f0add5, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(joyman) +STD_ROM_FN(joyman) + +struct BurnDriver BurnDrvjoyman = { + "joyman", "puckman", NULL, NULL, "1982", + "Joyman\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, joymanRomInfo, joymanRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Buccaneer + +static struct BurnRomInfo bucanerRomDesc[] = { + { "buc1.6e", 0x0800, 0x2c0fa0ab, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "buc5.6k", 0x0800, 0xafeca2f1, 1 | BRF_ESS | BRF_PRG }, // 1 + { "buc2.6f", 0x0800, 0x6b53ada9, 1 | BRF_ESS | BRF_PRG }, // 2 + { "buc6.6m", 0x0800, 0x35f3ca84, 1 | BRF_ESS | BRF_PRG }, // 3 + { "buc3.6h", 0x0800, 0x9045a44c, 1 | BRF_ESS | BRF_PRG }, // 4 + { "buc7.6n", 0x0800, 0x888f3c3e, 1 | BRF_ESS | BRF_PRG }, // 5 + { "buc4.6j", 0x0800, 0x292de161, 1 | BRF_ESS | BRF_PRG }, // 6 + { "buc8.6p", 0x0800, 0x884af858, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "buc9.5e", 0x0800, 0x4060c077, 2 | BRF_GRA }, // 8 Graphics + { "buc11.5h", 0x0800, 0xe3861283, 2 | BRF_GRA }, // 9 + { "buc10.5f", 0x0800, 0x09f66dec, 2 | BRF_GRA }, // 10 + { "buc12.5j", 0x0800, 0x653314e7, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(bucaner) +STD_ROM_FN(bucaner) + +struct BurnDriver BurnDrvbucaner = { + "bucaner", "puckman", NULL, NULL, "19??", + "Buccaneer\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, bucanerRomInfo, bucanerRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Caterpillar Pacman Hack + +static struct BurnRomInfo ctrpllrpRomDesc[] = { + { "c1.bin", 0x0800, 0x9d027c4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "c5.bin", 0x0800, 0xf39846d3, 1 | BRF_ESS | BRF_PRG }, // 1 + { "c2.bin", 0x0800, 0xafa149a8, 1 | BRF_ESS | BRF_PRG }, // 2 + { "c6.bin", 0x0800, 0xbaf5461e, 1 | BRF_ESS | BRF_PRG }, // 3 + { "c3.bin", 0x0800, 0x6bb282a1, 1 | BRF_ESS | BRF_PRG }, // 4 + { "c7.bin", 0x0800, 0xfa2140f5, 1 | BRF_ESS | BRF_PRG }, // 5 + { "c4.bin", 0x0800, 0x86c91e0e, 1 | BRF_ESS | BRF_PRG }, // 6 + { "c8.bin", 0x0800, 0x3d28134e, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "c9.bin", 0x0800, 0x1c4617be, 2 | BRF_GRA }, // 8 Graphics + { "c11.bin", 0x0800, 0x46f72fef, 2 | BRF_GRA }, // 9 + { "c10.bin", 0x0800, 0xba9ec199, 2 | BRF_GRA }, // 10 + { "c12.bin", 0x0800, 0x41c09655, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(ctrpllrp) +STD_ROM_FN(ctrpllrp) + +struct BurnDriver BurnDrvctrpllrp = { + "ctrpllrp", "puckman", NULL, NULL, "1982", + "Caterpillar Pacman Hack\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, ctrpllrpRomInfo, ctrpllrpRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pac-Man Plus + +static struct BurnRomInfo pacplusRomDesc[] = { + { "pacplus.6e", 0x1000, 0xd611ef68, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacplus.6f", 0x1000, 0xc7207556, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacplus.6h", 0x1000, 0xae379430, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pacplus.6j", 0x1000, 0x5a6dff7b, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pacplus.5e", 0x1000, 0x022c35da, 2 | BRF_GRA }, // 4 Graphics + { "pacplus.5f", 0x1000, 0x4de65cdd, 2 | BRF_GRA }, // 5 + + { "pacplus.7f", 0x0020, 0x063dd53a, 3 | BRF_GRA }, // 6 Color Proms + { "pacplus.4a", 0x0100, 0xe271a166, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(pacplus) +STD_ROM_FN(pacplus) + +static UINT8 pacplus_decrypt(INT32 addr, UINT8 e) +{ + static const UINT8 swap_xor_table[6][9] = + { + { 7,6,5,4,3,2,1,0, 0x00 }, + { 7,6,5,4,3,2,1,0, 0x28 }, + { 6,1,3,2,5,7,0,4, 0x96 }, + { 6,1,5,2,3,7,0,4, 0xbe }, + { 0,3,7,6,4,2,1,5, 0xd5 }, + { 0,3,4,6,7,2,1,5, 0xdd } + }; + + static const INT32 picktable[32] = + { + 0,2,4,2,4,0,4,2,2,0,2,2,4,0,4,2, + 2,2,4,0,4,2,4,0,0,4,0,4,4,2,4,2 + }; + + INT32 method = picktable[(addr & 0x001) | ((addr & 0x004) >> 1) | ((addr & 0x020) >> 3) | ((addr & 0x080) >> 4) | ((addr & 0x200) >> 5)]; + + if (addr & 0x800) method ^= 1; + + const UINT8 *tbl = swap_xor_table[method]; + + return BITSWAP08(e,tbl[0],tbl[1],tbl[2],tbl[3],tbl[4],tbl[5],tbl[6],tbl[7]) ^ tbl[8]; +} + +void pacplus_decode() +{ + for (INT32 i = 0; i < 0x4000; i++) + { + DrvZ80ROM[i] = pacplus_decrypt(i, DrvZ80ROM[i]); + } +} + +static INT32 pacplusInit() +{ + return DrvInit(StandardMap, pacplus_decode, PACMAN); +} + +struct BurnDriver BurnDrvpacplus = { + "pacplus", NULL, NULL, NULL, "1982", + "Pac-Man Plus\0", NULL, "[Namco] (Midway license)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pacplusRomInfo, pacplusRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + pacplusInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Newpuc2 + +static struct BurnRomInfo newpuc2RomDesc[] = { + { "6e.cpu", 0x0800, 0x69496a98, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "6k.cpu", 0x0800, 0x158fc01c, 1 | BRF_ESS | BRF_PRG }, // 1 + { "6f.cpu", 0x0800, 0x7d177853, 1 | BRF_ESS | BRF_PRG }, // 2 + { "6m.cpu", 0x0800, 0x70810ccf, 1 | BRF_ESS | BRF_PRG }, // 3 + { "6h.cpu", 0x0800, 0x81719de8, 1 | BRF_ESS | BRF_PRG }, // 4 + { "6n.cpu", 0x0800, 0x3f250c58, 1 | BRF_ESS | BRF_PRG }, // 5 + { "6j.cpu", 0x0800, 0xe6675736, 1 | BRF_ESS | BRF_PRG }, // 6 + { "6p.cpu", 0x0800, 0x1f81e765, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "5e.cpu", 0x0800, 0x2066a0b7, 2 | BRF_GRA }, // 8 Graphics + { "5h.cpu", 0x0800, 0x777c70d3, 2 | BRF_GRA }, // 9 + { "5f.cpu", 0x0800, 0xca8c184c, 2 | BRF_GRA }, // 10 + { "5j.cpu", 0x0800, 0x7dc75a81, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(newpuc2) +STD_ROM_FN(newpuc2) + +struct BurnDriver BurnDrvnewpuc2 = { + "newpuc2", "puckman", NULL, NULL, "1980", + "Newpuc2\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, newpuc2RomInfo, newpuc2RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Newpuc2b + +static struct BurnRomInfo newpuc2bRomDesc[] = { + { "np2b1.bin", 0x0800, 0x9d027c4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "6k.cpu", 0x0800, 0x158fc01c, 1 | BRF_ESS | BRF_PRG }, // 1 + { "6f.cpu", 0x0800, 0x7d177853, 1 | BRF_ESS | BRF_PRG }, // 2 + { "6m.cpu", 0x0800, 0x70810ccf, 1 | BRF_ESS | BRF_PRG }, // 3 + { "np2b3.bin", 0x0800, 0xf5e4b2b1, 1 | BRF_ESS | BRF_PRG }, // 4 + { "6n.cpu", 0x0800, 0x3f250c58, 1 | BRF_ESS | BRF_PRG }, // 5 + { "np2b4.bin", 0x0800, 0xf068e009, 1 | BRF_ESS | BRF_PRG }, // 6 + { "np2b8.bin", 0x0800, 0x1fadcc2f, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "5e.cpu", 0x0800, 0x2066a0b7, 2 | BRF_GRA }, // 8 Graphics + { "5h.cpu", 0x0800, 0x777c70d3, 2 | BRF_GRA }, // 9 + { "5f.cpu", 0x0800, 0xca8c184c, 2 | BRF_GRA }, // 10 + { "5j.cpu", 0x0800, 0x7dc75a81, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Prom + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(newpuc2b) +STD_ROM_FN(newpuc2b) + +struct BurnDriver BurnDrvnewpuc2b = { + "newpuc2b", "puckman", NULL, NULL, "1980", + "Newpuc2b\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, newpuc2bRomInfo, newpuc2bRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// MS Pacman + +static struct BurnRomInfo mspacmanRomDesc[] = { + { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 + { "u5", 0x0800, 0xf45fbbcd, 1 | BRF_ESS | BRF_PRG }, // 4 + { "u6", 0x1000, 0xa90e7000, 1 | BRF_ESS | BRF_PRG }, // 5 + { "u7", 0x1000, 0xc82cd714, 1 | BRF_ESS | BRF_PRG }, // 6 + + { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 7 Graphics + { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 8 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Prom + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 10 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 11 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 12 Timing Prom (not used) +}; + +STD_ROM_PICK(mspacman) +STD_ROM_FN(mspacman) + +static void MspacmanDecode() +{ +#define ADD0SWAP(x) BITSWAP16(x,15,14,13,12,11,3,7,9,10,8,6,5,4,2,1,0) +#define ADD1SWAP(x) BITSWAP16(x,15,14,13,12,11,8,7,5,9,10,6,3,4,2,1,0) +#define DATASWAP(x) BITSWAP08(x,0,4,5,7,6,3,2,1) + + static const UINT16 tab[10 * 8] = { // even is dst, odd is src + 0x0410, 0x8008, 0x08E0, 0x81D8, 0x0A30, 0x8118, 0x0BD0, 0x80D8, + 0x0C20, 0x8120, 0x0E58, 0x8168, 0x0EA8, 0x8198, 0x1000, 0x8020, + 0x1008, 0x8010, 0x1288, 0x8098, 0x1348, 0x8048, 0x1688, 0x8088, + 0x16B0, 0x8188, 0x16D8, 0x80C8, 0x16F8, 0x81C8, 0x19A8, 0x80A8, + 0x19B8, 0x81A8, 0x2060, 0x8148, 0x2108, 0x8018, 0x21A0, 0x81A0, + 0x2298, 0x80A0, 0x23E0, 0x80E8, 0x2418, 0x8000, 0x2448, 0x8058, + 0x2470, 0x8140, 0x2488, 0x8080, 0x24B0, 0x8180, 0x24D8, 0x80C0, + 0x24F8, 0x81C0, 0x2748, 0x8050, 0x2780, 0x8090, 0x27B8, 0x8190, + 0x2800, 0x8028, 0x2B20, 0x8100, 0x2B30, 0x8110, 0x2BF0, 0x81D0, + 0x2CC0, 0x80D0, 0x2CD8, 0x80E0, 0x2CF0, 0x81E0, 0x2D60, 0x8160 + }; + + memcpy (DrvZ80ROM + 0x0b000, DrvZ80ROM + 0x0a000, 0x01000); + memcpy (DrvZ80ROM + 0x10000, DrvZ80ROM + 0x00000, 0x03000); + + for (INT32 i = 0; i < 0x1000; i++) + { + DrvZ80ROM[0x13000+i] = DATASWAP(DrvZ80ROM[0xb000+ADD0SWAP(i)]); + } + + for (INT32 i = 0; i < 0x800; i++) + { + DrvZ80ROM[0x18000+i] = DATASWAP(DrvZ80ROM[0x8000+ADD1SWAP(i)]); + DrvZ80ROM[0x18800+i] = DATASWAP(DrvZ80ROM[0x9800+ADD0SWAP(i)]); + DrvZ80ROM[0x19000+i] = DATASWAP(DrvZ80ROM[0x9000+ADD0SWAP(i)]); + DrvZ80ROM[0x19800+i] = DrvZ80ROM[0x1800+i]; + } + + memcpy (DrvZ80ROM + 0x1a000, DrvZ80ROM + 0x02000, 0x2000); + + for (INT32 i = 0; i < 80; i+=2) { // apply patches + memcpy (DrvZ80ROM + 0x10000 + tab[i], DrvZ80ROM + 0x10000 + tab[i+1], 8); + } + + memcpy (DrvZ80ROM + 0x8000, DrvZ80ROM, 0x4000); +} + +static INT32 mspacmanInit() +{ + return DrvInit(MspacmanMap, MspacmanDecode, MSPACMAN); +} + +struct BurnDriver BurnDrvmspacman = { + "mspacman", NULL, NULL, NULL, "1980", + "MS Pacman\0", NULL, "Namco", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, mspacmanRomInfo, mspacmanRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + mspacmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Ms. Pac-Man (with speedup hack) + +static struct BurnRomInfo mspacmnfRomDesc[] = { + { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacfast.6f", 0x1000, 0x720dc3ee, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 + { "u5", 0x0800, 0xf45fbbcd, 1 | BRF_ESS | BRF_PRG }, // 4 + { "u6", 0x1000, 0xa90e7000, 1 | BRF_ESS | BRF_PRG }, // 5 + { "u7", 0x1000, 0xc82cd714, 1 | BRF_ESS | BRF_PRG }, // 6 + + { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 7 Graphics + { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 8 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(mspacmnf) +STD_ROM_FN(mspacmnf) + +struct BurnDriver BurnDrvmspacmnf = { + "mspacmnf", "mspacman", NULL, NULL, "1980", + "Ms. Pac-Man (with speedup hack)\0", NULL, "Midway", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, mspacmnfRomInfo, mspacmnfRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + mspacmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Ms. Pac Attack + +static struct BurnRomInfo mspacmatRomDesc[] = { + { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 + { "u5", 0x0800, 0xf45fbbcd, 1 | BRF_ESS | BRF_PRG }, // 4 + { "u6pacatk", 0x1000, 0xf6d83f4d, 1 | BRF_ESS | BRF_PRG }, // 5 + { "u7", 0x1000, 0xc82cd714, 1 | BRF_ESS | BRF_PRG }, // 6 + + { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 7 Graphics + { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 8 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Prom + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 10 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 11 + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 12 Sound Prom (not used) +}; + +STD_ROM_PICK(mspacmat) +STD_ROM_FN(mspacmat) + +struct BurnDriver BurnDrvmspacmat = { + "mspacmat", "mspacman", NULL, NULL, "1980", + "Ms. Pac Attack\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, mspacmatRomInfo, mspacmatRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + mspacmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Ms. Pac-Man Heart Burn + +static struct BurnRomInfo msheartbRomDesc[] = { + { "pacman.6e", 0x1000, 0xc1e6ab10, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacman.6h", 0x1000, 0xbcdd1beb, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pacman.6j", 0x1000, 0x817d94e3, 1 | BRF_ESS | BRF_PRG }, // 3 + { "u5", 0x0800, 0xf45fbbcd, 1 | BRF_ESS | BRF_PRG }, // 4 + { "u6", 0x1000, 0xa90e7000, 1 | BRF_ESS | BRF_PRG }, // 5 + { "u7", 0x1000, 0xc82cd714, 1 | BRF_ESS | BRF_PRG }, // 6 + + { "5e", 0x1000, 0x5431d4c4, 2 | BRF_GRA }, // 7 Graphics + { "5f", 0x1000, 0xceb50654, 2 | BRF_GRA }, // 8 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Prom + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 10 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 11 + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 12 Sound Prom (not used) +}; + +STD_ROM_PICK(msheartb) +STD_ROM_FN(msheartb) + +struct BurnDriver BurnDrvmsheartb = { + "msheartb", "mspacman", NULL, NULL, "1980", + "Ms. Pac-Man Heart Burn\0", NULL, "hack (Two-Bit Score)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, msheartbRomInfo, msheartbRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + mspacmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// MS Pacman (bootleg) + +static struct BurnRomInfo mspacmabRomDesc[] = { + { "boot1", 0x1000, 0xd16b31b7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "boot2", 0x1000, 0x0d32de5e, 1 | BRF_ESS | BRF_PRG }, // 1 + { "boot3", 0x1000, 0x1821ee0b, 1 | BRF_ESS | BRF_PRG }, // 2 + { "boot4", 0x1000, 0x165a9dd8, 1 | BRF_ESS | BRF_PRG }, // 3 + { "boot5", 0x1000, 0x8c3e6de6, 1 | BRF_ESS | BRF_PRG }, // 4 + { "boot6", 0x1000, 0x368cb165, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 6 Graphics + { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 7 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(mspacmab) +STD_ROM_FN(mspacmab) + +static INT32 mspacmanbInit() +{ + return DrvInit(MspacmanMap, NULL, PACMAN); +} + +struct BurnDriver BurnDrvmspacmab = { + "mspacmab", "mspacman", NULL, NULL, "1981", + "MS Pacman (bootleg)\0", NULL, "Namco", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, mspacmabRomInfo, mspacmabRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + mspacmanbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Ms. Pac-Man (bootleg, encrypted) + +static struct BurnRomInfo mspacmbeRomDesc[] = { + { "boot1", 0x1000, 0xd16b31b7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "2.bin", 0x1000, 0x04e6c486, 1 | BRF_ESS | BRF_PRG }, // 1 + { "boot3", 0x1000, 0x1821ee0b, 1 | BRF_ESS | BRF_PRG }, // 2 + { "boot4", 0x1000, 0x165a9dd8, 1 | BRF_ESS | BRF_PRG }, // 3 + { "boot5", 0x1000, 0x8c3e6de6, 1 | BRF_ESS | BRF_PRG }, // 4 + { "6.bin", 0x1000, 0x206a9623, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 6 Graphics + { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 7 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(mspacmbe) +STD_ROM_FN(mspacmbe) + +static void mspacmbe_decode() +{ + for(INT32 i = 0x1000; i < 0x2000; i+=4) + { + if (!(i & 8)) + { + INT32 t = DrvZ80ROM[i+1]; + DrvZ80ROM[i+1] = DrvZ80ROM[i+2]; + DrvZ80ROM[i+2] = t; + }; + } +} + +static INT32 mspacmbeInit() +{ + return DrvInit(MspacmanMap, mspacmbe_decode, PACMAN); +} + +struct BurnDriver BurnDrvmspacmbe = { + "mspacmbe", "mspacman", NULL, NULL, "1981", + "Ms. Pac-Man (bootleg, encrypted)\0", NULL, "bootleg", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, mspacmbeRomInfo, mspacmbeRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + mspacmbeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pac-Gal + +static struct BurnRomInfo pacgalRomDesc[] = { + { "boot1", 0x1000, 0xd16b31b7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "boot2", 0x1000, 0x0d32de5e, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pacman.7fh", 0x1000, 0x513f4d5c, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pacman.7hj", 0x1000, 0x70694c8e, 1 | BRF_ESS | BRF_PRG }, // 3 + { "boot5", 0x1000, 0x8c3e6de6, 1 | BRF_ESS | BRF_PRG }, // 4 + { "boot6", 0x1000, 0x368cb165, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 6 Graphics + { "pacman.5ef", 0x0800, 0x65a3ee71, 2 | BRF_GRA }, // 7 + { "pacman.5hj", 0x0800, 0x50c7477d, 2 | BRF_GRA }, // 8 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Proms + { "82s129.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 10 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 11 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 12 Timing Prom (not used) +}; + +STD_ROM_PICK(pacgal) +STD_ROM_FN(pacgal) + +struct BurnDriver BurnDrvpacgal = { + "pacgal", "mspacman", NULL, NULL, "1981", + "Pac-Gal\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pacgalRomInfo, pacgalRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + mspacmanbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Ms. Pac-Man Plus + +static struct BurnRomInfo mspacplsRomDesc[] = { + { "boot1", 0x1000, 0xd16b31b7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "mspacatk.2", 0x1000, 0x0af09d31, 1 | BRF_ESS | BRF_PRG }, // 1 + { "boot3", 0x1000, 0x1821ee0b, 1 | BRF_ESS | BRF_PRG }, // 2 + { "boot4", 0x1000, 0x165a9dd8, 1 | BRF_ESS | BRF_PRG }, // 3 + { "mspacatk.5", 0x1000, 0xe6e06954, 1 | BRF_ESS | BRF_PRG }, // 4 + { "mspacatk.6", 0x1000, 0x3b5db308, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "5e", 0x1000, 0x5c281d01, 2 | BRF_GRA }, // 6 Graphics + { "5f", 0x1000, 0x615af909, 2 | BRF_GRA }, // 7 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(mspacpls) +STD_ROM_FN(mspacpls) + +struct BurnDriver BurnDrvmspacpls = { + "mspacpls", "mspacman", NULL, NULL, "1981", + "Ms. Pac-Man Plus\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, mspacplsRomInfo, mspacplsRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + mspacmanbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Ms. Pacman Champion Edition / Zola-Puc Gal + +static struct BurnRomInfo mschampRomDesc[] = { + { "9fg.bin", 0x10000, 0x04dba113, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + + { "8e.bin", 0x2000, 0x17435f53, 2 | BRF_GRA }, // 1 Graphics + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 2 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 3 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 4 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 5 Timing Prom (not used)) ) +}; + +STD_ROM_PICK(mschamp) +STD_ROM_FN(mschamp) + +static void mschampCallback() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x1000); + + memcpy (tmp + 0x0000, DrvGfxROM + 0x0800, 0x1000); + memcpy (DrvGfxROM + 0x1000, tmp + 0x0000, 0x0800); + memcpy (DrvGfxROM + 0x0800, tmp + 0x0800, 0x0800); + + BurnFree(tmp); +} + +static INT32 mschampInit() +{ + return DrvInit(WoodpekMap, mschampCallback, MSCHAMP); +} + +struct BurnDriver BurnDrvmschamp = { + "mschamp", "mspacman", NULL, NULL, "1995", + "Ms. Pacman Champion Edition / Zola-Puc Gal\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, mschampRomInfo, mschampRomName, NULL, NULL, mschampInputInfo, mschampDIPInfo, + mschampInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Ms. Pacman Champion Edition / Super Zola Pac Gal + +static struct BurnRomInfo mschampsRomDesc[] = { + { "pm4.bin", 0x10000, 0x7d6b6303, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + + { "pm5.bin", 0x2000, 0x7fe6b9e2, 2 | BRF_GRA }, // 1 Graphics + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 2 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 3 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 4 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 5 Timing Prom (not used)) ) +}; + +STD_ROM_PICK(mschamps) +STD_ROM_FN(mschamps) + +struct BurnDriver BurnDrvmschamps = { + "mschamps", "mspacman", NULL, NULL, "1995", + "Ms. Pacman Champion Edition / Super Zola Pac Gal\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, mschampsRomInfo, mschampsRomName, NULL, NULL, mschampInputInfo, mschampDIPInfo, + mschampInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Crush Roller (Kural Samno) + +static struct BurnRomInfo crushRomDesc[] = { + { "crushkrl.6e", 0x1000, 0xa8dd8f54, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "crushkrl.6f", 0x1000, 0x91387299, 1 | BRF_ESS | BRF_PRG }, // 1 + { "crushkrl.6h", 0x1000, 0xd4455f27, 1 | BRF_ESS | BRF_PRG }, // 2 + { "crushkrl.6j", 0x1000, 0xd59fc251, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "maketrax.5e", 0x1000, 0x91bad2da, 2 | BRF_GRA }, // 4 Graphics + { "maketrax.5f", 0x1000, 0xaea79f55, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Prom + { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(crush) +STD_ROM_FN(crush) + +static void maketraxCallback() +{ + DrvZ80ROM[0x0224] = 0x00; + DrvZ80ROM[0x0225] = 0x00; + DrvZ80ROM[0x0226] = 0x00; + DrvZ80ROM[0x022D] = 0x00; + DrvZ80ROM[0x022F] = 0x00; + DrvZ80ROM[0x023C] = 0x00; + DrvZ80ROM[0x023D] = 0x00; + DrvZ80ROM[0x023E] = 0x00; + DrvZ80ROM[0x0415] = 0xc9; + DrvZ80ROM[0x0428] = 0xC6; + DrvZ80ROM[0x0429] = 0x12; + DrvZ80ROM[0x115E] = 0xC9; + DrvZ80ROM[0x1481] = 0x28; + DrvZ80ROM[0x1492] = 0x20; + DrvZ80ROM[0x14A5] = 0xC8; + DrvZ80ROM[0x1978] = 0x18; + DrvZ80ROM[0x1C9F] = 0xA7; + DrvZ80ROM[0x1CA0] = 0xC9; + DrvZ80ROM[0x238e] = 0xc9; + DrvZ80ROM[0x3AE5] = 0x3E; + DrvZ80ROM[0x3AE7] = 0xFE; + DrvZ80ROM[0x3AE8] = 0x3F; + DrvZ80ROM[0x3AE9] = 0xC9; +} + +static INT32 crushInit() +{ + return DrvInit(StandardMap, maketraxCallback, PACMAN); +} + +struct BurnDriver BurnDrvcrush = { + "crush", NULL, NULL, NULL, "1981", + "Crush Roller (Kural Samno)\0", NULL, "Kural Samno Electric", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, crushRomInfo, crushRomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, + crushInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Crush Roller (bootleg) + +static struct BurnRomInfo crushblRomDesc[] = { + { "cr1.bin", 0x1000, 0xe2e84cd1, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "cr2.bin", 0x1000, 0xec020e6f, 1 | BRF_ESS | BRF_PRG }, // 1 + { "cr3.bin", 0x1000, 0xd4455f27, 1 | BRF_ESS | BRF_PRG }, // 2 + { "cr4.bin", 0x1000, 0x9936ae06, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "maketrax.5e", 0x1000, 0x91bad2da, 2 | BRF_GRA }, // 4 Graphics + { "maketrax.5f", 0x1000, 0xaea79f55, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Prom + { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(crushbl) +STD_ROM_FN(crushbl) + +struct BurnDriver BurnDrvcrushbl = { + "crushbl", "crush", NULL, NULL, "1981", + "Crush Roller (bootleg)\0", NULL, "Kural Samno Electric", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, crushblRomInfo, crushblRomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Crush Roller (bootleg?) + +static struct BurnRomInfo crushbl2RomDesc[] = { + { "cr5.7d", 0x1000, 0x4954d51d, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "cr6.7e", 0x1000, 0x27eb4299, 1 | BRF_ESS | BRF_PRG }, // 1 + { "cr7.7h", 0x1000, 0xd297108e, 1 | BRF_ESS | BRF_PRG }, // 2 + { "cr8.7j", 0x1000, 0xbcc40eaf, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "cr1.5e", 0x0800, 0xc7617198, 2 | BRF_GRA }, // 4 Graphics + { "cr3.5h", 0x0800, 0xc15b6967, 2 | BRF_GRA }, // 5 + { "cr2.5f", 0x0800, 0xd5bc5cb8, 2 | BRF_GRA }, // 6 + { "cr4.5j", 0x0800, 0xd35d1caf, 2 | BRF_GRA }, // 7 + + { "74s288.8a", 0x0020, 0xff344446, 3 | BRF_GRA }, // 8 Color Prom + { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 9 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(crushbl2) +STD_ROM_FN(crushbl2) + +struct BurnDriver BurnDrvcrushbl2 = { + "crushbl2", "crush", NULL, NULL, "1981", + "Crush Roller (bootleg?)\0", NULL, "bootleg", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, crushbl2RomInfo, crushbl2RomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Crush Roller (Kural Esco - bootleg?) + +static struct BurnRomInfo crush2RomDesc[] = { + { "tp1", 0x0800, 0xf276592e, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "tp5a", 0x0800, 0x3d302abe, 1 | BRF_ESS | BRF_PRG }, // 1 + { "tp2", 0x0800, 0x25f42e70, 1 | BRF_ESS | BRF_PRG }, // 2 + { "tp6", 0x0800, 0x98279cbe, 1 | BRF_ESS | BRF_PRG }, // 3 + { "tp3", 0x0800, 0x8377b4cb, 1 | BRF_ESS | BRF_PRG }, // 4 + { "tp7", 0x0800, 0xd8e76c8c, 1 | BRF_ESS | BRF_PRG }, // 5 + { "tp4", 0x0800, 0x90b28fa3, 1 | BRF_ESS | BRF_PRG }, // 6 + { "tp8", 0x0800, 0x10854e1b, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "tpa", 0x0800, 0xc7617198, 2 | BRF_GRA }, // 8 Graphics + { "tpc", 0x0800, 0xe129d76a, 2 | BRF_GRA }, // 9 + { "tpb", 0x0800, 0xd1899f05, 2 | BRF_GRA }, // 10 + { "tpd", 0x0800, 0xd35d1caf, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(crush2) +STD_ROM_FN(crush2) + +struct BurnDriver BurnDrvcrush2 = { + "crush2", "crush", NULL, NULL, "1981", + "Crush Roller (Kural Esco - bootleg?)\0", NULL, "Kural Esco Electric", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, crush2RomInfo, crush2RomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Crush Roller (Kural - bootleg?) + +static struct BurnRomInfo crush3RomDesc[] = { + { "unkmol.4e", 0x0800, 0x49150ddf, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "unkmol.6e", 0x0800, 0x21f47e17, 1 | BRF_ESS | BRF_PRG }, // 1 + { "unkmol.4f", 0x0800, 0x9b6dd592, 1 | BRF_ESS | BRF_PRG }, // 2 + { "unkmol.6f", 0x0800, 0x755c1452, 1 | BRF_ESS | BRF_PRG }, // 3 + { "unkmol.4h", 0x0800, 0xed30a312, 1 | BRF_ESS | BRF_PRG }, // 4 + { "unkmol.6h", 0x0800, 0xfe4bb0eb, 1 | BRF_ESS | BRF_PRG }, // 5 + { "unkmol.4j", 0x0800, 0x072b91c9, 1 | BRF_ESS | BRF_PRG }, // 6 + { "unkmol.6j", 0x0800, 0x66fba07d, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "unkmol.5e", 0x0800, 0x338880a0, 2 | BRF_GRA }, // 8 Graphics + { "unkmol.5h", 0x0800, 0x4ce9c81f, 2 | BRF_GRA }, // 9 + { "unkmol.5f", 0x0800, 0x752e3780, 2 | BRF_GRA }, // 10 + { "unkmol.5j", 0x0800, 0x6e00d2ac, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(crush3) +STD_ROM_FN(crush3) + +static void eyes_gfx_decode(UINT8 *src) +{ + UINT8 buf[8]; + + for (INT32 i = 0; i < 8; i++) { + buf[i] = BITSWAP08(src[((i & 1) << 2) | ((i & 4) >> 2) | (i & 2)],7,4,5,6,3,2,1,0); + } + + memcpy (src, buf, 8); +} + +static void eyes_decode() +{ + for (INT32 i = 0; i < 0x4000; i++) + DrvZ80ROM[i] = BITSWAP08(DrvZ80ROM[i],7,6,3,4,5,2,1,0); + + for (INT32 i = 0;i < 0x2000; i += 8) + eyes_gfx_decode(DrvGfxROM + i); +} + +static INT32 crush3Init() +{ + return DrvInit(StandardMap, eyes_decode, PACMAN); +} + +struct BurnDriver BurnDrvcrush3 = { + "crush3", "crush", NULL, NULL, "1981", + "Crush Roller (Kural - bootleg?)\0", NULL, "Kural Electric", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, crush3RomInfo, crush3RomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, + crush3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Crush Roller (Kural TWT) + +static struct BurnRomInfo crush4RomDesc[] = { + { "crtwt.2", 0x10000, 0xadbd21f7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code (banked) + + { "crtwt.1", 0x4000, 0x4250a9ea, 2 | BRF_GRA }, // 1 Graphics + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 2 Color Proms + { "82s129.bin", 0x0100, 0x2bc5d339, 3 | BRF_GRA }, // 3 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 4 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 5 Timing Prom (not used) +}; + +STD_ROM_PICK(crush4) +STD_ROM_FN(crush4) + +static void crush4Callback() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x4000); + + memcpy (tmp + 0x0000, DrvGfxROM + 0x0000, 0x04000); + memcpy (DrvGfxROM + 0x1000, tmp + 0x0800, 0x00800); + memcpy (DrvGfxROM + 0x0800, tmp + 0x1000, 0x00800); + memcpy (DrvGfxROM + 0x3000, tmp + 0x2800, 0x00800); + memcpy (DrvGfxROM + 0x2800, tmp + 0x3000, 0x00800); + + memcpy (DrvZ80ROM + 0x00000, DrvZ80ROM + 0x08000, 0x04000); + memcpy (DrvZ80ROM + 0x08000, DrvZ80ROM + 0x0c000, 0x04000); + memset (DrvZ80ROM + 0x0c000, 0, 0x4000); + + BurnFree (tmp); +} + +static INT32 crush4Init() +{ + return DrvInit(StandardMap, crush4Callback, PACMAN); +} + +struct BurnDriver BurnDrvcrush4 = { + "crush4", "crush", NULL, NULL, "1981", + "Crush Roller (Kural TWT)\0", NULL, "Kural TWT", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, crush4RomInfo, crush4RomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, + crush4Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Paint Roller + +static struct BurnRomInfo paintrlrRomDesc[] = { + { "paintrlr.1", 0x0800, 0x556d20b5, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "paintrlr.5", 0x0800, 0x4598a965, 1 | BRF_ESS | BRF_PRG }, // 1 + { "paintrlr.2", 0x0800, 0x2da29c81, 1 | BRF_ESS | BRF_PRG }, // 2 + { "paintrlr.6", 0x0800, 0x1f561c54, 1 | BRF_ESS | BRF_PRG }, // 3 + { "paintrlr.3", 0x0800, 0xe695b785, 1 | BRF_ESS | BRF_PRG }, // 4 + { "paintrlr.7", 0x0800, 0x00e6eec0, 1 | BRF_ESS | BRF_PRG }, // 5 + { "paintrlr.4", 0x0800, 0x0fd5884b, 1 | BRF_ESS | BRF_PRG }, // 6 + { "paintrlr.8", 0x0800, 0x4900114a, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "tpa", 0x0800, 0xc7617198, 2 | BRF_GRA }, // 8 Graphics + { "mbrush.5h", 0x0800, 0xc15b6967, 2 | BRF_GRA }, // 9 + { "mbrush.5f", 0x0800, 0xd5bc5cb8, 2 | BRF_GRA }, // 10 + { "tpd", 0x0800, 0xd35d1caf, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (unused) +}; + +STD_ROM_PICK(paintrlr) +STD_ROM_FN(paintrlr) + +struct BurnDriver BurnDrvpaintrlr = { + "paintrlr", "crush", NULL, NULL, "1981", + "Paint Roller\0", NULL, "bootleg", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, paintrlrRomInfo, paintrlrRomName, NULL, NULL, DrvInputInfo, mbrushDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Crush Roller (Sidam bootleg) + +static struct BurnRomInfo crushsRomDesc[] = { + { "11105-0.0j", 0x1000, 0xdd425429, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "11105-1.1j", 0x1000, 0xf9d89eef, 1 | BRF_ESS | BRF_PRG }, // 1 + { "11105-2.2j", 0x1000, 0x40c23a27, 1 | BRF_ESS | BRF_PRG }, // 2 + { "11105-3.3j", 0x1000, 0x5802644f, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "11105-4.4j", 0x1000, 0x91bad2da, 2 | BRF_GRA }, // 4 Graphics + { "11105-5.5j", 0x1000, 0xb5c14376, 2 | BRF_GRA }, // 5 + + { "74s288.8a", 0x0020, 0xff344446, 3 | BRF_GRA }, // 6 Color Proms + { "24s10.6b", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 + + // uses AY8910 +}; + +STD_ROM_PICK(crushs) +STD_ROM_FN(crushs) + +static INT32 crushsInit() +{ + return DrvInit(StandardMap, NULL, CRUSHS); +} + +struct BurnDriver BurnDrvcrushs = { + "crushs", "crush", NULL, NULL, "19??", + "Crush Roller (Sidam bootleg)\0", NULL, "[Kural] (Sidam bootleg)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, crushsRomInfo, crushsRomName, NULL, NULL, DrvInputInfo, crushsDIPInfo, + crushsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Make Trax (set 1) + +static struct BurnRomInfo maketraxRomDesc[] = { + { "maketrax.6e", 0x1000, 0x0150fb4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "maketrax.6f", 0x1000, 0x77531691, 1 | BRF_ESS | BRF_PRG }, // 1 + { "maketrax.6h", 0x1000, 0xa2cdc51e, 1 | BRF_ESS | BRF_PRG }, // 2 + { "maketrax.6j", 0x1000, 0x0b4b5e0a, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "maketrax.5e", 0x1000, 0x91bad2da, 2 | BRF_GRA }, // 4 Graphics + { "maketrax.5f", 0x1000, 0xaea79f55, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(maketrax) +STD_ROM_FN(maketrax) + +static INT32 maketraxInit() +{ + return DrvInit(StandardMap, maketraxCallback, MAKETRAX); +} + +struct BurnDriver BurnDrvmaketrax = { + "maketrax", "crush", NULL, NULL, "1981", + "Make Trax (set 1)\0", NULL, "[Kural] (Williams license)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, maketraxRomInfo, maketraxRomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, + maketraxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Make Trax (set 2) + +static struct BurnRomInfo maketrxbRomDesc[] = { + { "maketrax.6e", 0x1000, 0x0150fb4a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "maketrax.6f", 0x1000, 0x77531691, 1 | BRF_ESS | BRF_PRG }, // 1 + { "maketrxb.6h", 0x1000, 0x6ad342c9, 1 | BRF_ESS | BRF_PRG }, // 2 + { "maketrxb.6j", 0x1000, 0xbe27f729, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "maketrax.5e", 0x1000, 0x91bad2da, 2 | BRF_GRA }, // 4 Graphics + { "maketrax.5f", 0x1000, 0xaea79f55, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(maketrxb) +STD_ROM_FN(maketrxb) + +struct BurnDriver BurnDrvmaketrxb = { + "maketrxb", "crush", NULL, NULL, "1981", + "Make Trax (set 2)\0", NULL, "[Kural] (Williams license)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, maketrxbRomInfo, maketrxbRomName, NULL, NULL, DrvInputInfo, maketraxDIPInfo, + maketraxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Magic Brush + +static struct BurnRomInfo mbrushRomDesc[] = { + { "mbrush.6e", 0x1000, 0x750fbff7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "mbrush.6f", 0x1000, 0x27eb4299, 1 | BRF_ESS | BRF_PRG }, // 1 + { "mbrush.6h", 0x1000, 0xd297108e, 1 | BRF_ESS | BRF_PRG }, // 2 + { "mbrush.6j", 0x1000, 0x6fd719d0, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "tpa", 0x0800, 0xc7617198, 2 | BRF_GRA }, // 4 Graphics + { "mbrush.5h", 0x0800, 0xc15b6967, 2 | BRF_GRA }, // 5 + { "mbrush.5f", 0x0800, 0xd5bc5cb8, 2 | BRF_GRA }, // 6 + { "tpd", 0x0800, 0xd35d1caf, 2 | BRF_GRA }, // 7 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Proms + { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 9 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(mbrush) +STD_ROM_FN(mbrush) + +static void mbrushCallback() +{ + DrvZ80ROM[0x3AE2] = 0x3E; + DrvZ80ROM[0x3AE3] = 0x00; + DrvZ80ROM[0x3AE4] = 0x00; +} + +static INT32 mbrushInit() +{ + return DrvInit(StandardMap, mbrushCallback, PACMAN); +} + +struct BurnDriver BurnDrvmbrush = { + "mbrush", "crush", NULL, NULL, "1981", + "Magic Brush\0", NULL, "bootleg", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, mbrushRomInfo, mbrushRomName, NULL, NULL, DrvInputInfo, mbrushDIPInfo, + mbrushInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Korosuke Roller + +static struct BurnRomInfo korosukeRomDesc[] = { + { "kr.6e", 0x1000, 0x69f6e2da, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "kr.6f", 0x1000, 0xabf34d23, 1 | BRF_ESS | BRF_PRG }, // 1 + { "kr.6h", 0x1000, 0x76a2e2e2, 1 | BRF_ESS | BRF_PRG }, // 2 + { "kr.6j", 0x1000, 0x33e0e3bb, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "kr.5e", 0x1000, 0xe0380be8, 2 | BRF_GRA }, // 4 Graphics + { "kr.5f", 0x1000, 0x63fec9ee, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "2s140.4a", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(korosuke) +STD_ROM_FN(korosuke) + +static void korosukeCallback() +{ + DrvZ80ROM[0x0233] = 0x00; + DrvZ80ROM[0x0234] = 0x00; + DrvZ80ROM[0x0235] = 0x00; + DrvZ80ROM[0x023c] = 0x00; + DrvZ80ROM[0x023e] = 0x00; + DrvZ80ROM[0x024b] = 0x00; + DrvZ80ROM[0x024c] = 0x00; + DrvZ80ROM[0x024d] = 0x00; + DrvZ80ROM[0x044c] = 0xc9; + DrvZ80ROM[0x115B] = 0xC9; + DrvZ80ROM[0x1AE9] = 0x18; + DrvZ80ROM[0x1CA7] = 0xA7; + DrvZ80ROM[0x1CA8] = 0xC9; + DrvZ80ROM[0x238c] = 0xc9; + DrvZ80ROM[0x3AE9] = 0x3E; + DrvZ80ROM[0x3AEB] = 0xFE; + DrvZ80ROM[0x3AEC] = 0x3F; + DrvZ80ROM[0x3AEE] = 0xC9; + DrvZ80ROM[0x045d] = 0xC6; + DrvZ80ROM[0x045e] = 0x12; + DrvZ80ROM[0x1481] = 0x28; + DrvZ80ROM[0x1492] = 0x20; + DrvZ80ROM[0x14A5] = 0xC8; +} + +static INT32 korosukeInit() +{ + return DrvInit(StandardMap, korosukeCallback, MAKETRAX); +} + +struct BurnDriver BurnDrvkorosuke = { + "korosuke", "crush", NULL, NULL, "1981", + "Korosuke Roller\0", NULL, "Kural Electric", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, korosukeRomInfo, korosukeRomName, NULL, NULL, korosukeInputInfo, korosukeDIPInfo, + korosukeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Eyes (Digitrex Techstar) + +static struct BurnRomInfo eyesRomDesc[] = { + { "d7", 0x1000, 0x3b09ac89, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "e7", 0x1000, 0x97096855, 1 | BRF_ESS | BRF_PRG }, // 1 + { "f7", 0x1000, 0x731e294e, 1 | BRF_ESS | BRF_PRG }, // 2 + { "h7", 0x1000, 0x22f7a719, 1 | BRF_ESS | BRF_PRG }, // 4 + + { "d5", 0x1000, 0xd6af0030, 2 | BRF_GRA }, // 5 Graphics + { "e5", 0x1000, 0xa42b5201, 2 | BRF_GRA }, // 6 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 7 Color Proms + { "82s129.4a", 0x0100, 0xd8d78829, 3 | BRF_GRA }, // 8 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 9 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 10 Timing Prom (not used) +}; + +STD_ROM_PICK(eyes) +STD_ROM_FN(eyes) + +static INT32 eyesInit() +{ + return DrvInit(StandardMap, eyes_decode, PACMAN); +} + +struct BurnDriver BurnDrveyes = { + "eyes", NULL, NULL, NULL, "1982", + "Eyes (Digitrex Techstar)\0", NULL, "Digitrex Techstar (Rock-ola license)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, eyesRomInfo, eyesRomName, NULL, NULL, eyesInputInfo, eyesDIPInfo, + eyesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Eyes (Techstar) + +static struct BurnRomInfo eyes2RomDesc[] = { + { "g38201.7d", 0x1000, 0x2cda7185, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "g38202.7e", 0x1000, 0xb9fe4f59, 1 | BRF_ESS | BRF_PRG }, // 1 + { "g38203.7f", 0x1000, 0xd618ba66, 1 | BRF_ESS | BRF_PRG }, // 2 + { "g38204.7h", 0x1000, 0xcf038276, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "g38205.5d", 0x1000, 0x03b1b4c7, 2 | BRF_GRA }, // 4 Graphics + { "g38206.5e", 0x1000, 0xa42b5201, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "82s129.4a", 0x0100, 0xd8d78829, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(eyes2) +STD_ROM_FN(eyes2) + +struct BurnDriver BurnDrveyes2 = { + "eyes2", "eyes", NULL, NULL, "1982", + "Eyes (Techstar)\0", NULL, "Techstar (Rock-ola license)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, eyes2RomInfo, eyes2RomName, NULL, NULL, eyesInputInfo, eyesDIPInfo, + eyesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Eyes (bootleg set 1) + +static struct BurnRomInfo eyesbRomDesc[] = { + { "1.bin", 0x0800, 0x339d279a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "5.bin", 0x0800, 0x1b68a61d, 1 | BRF_ESS | BRF_PRG }, // 1 + { "2.bin", 0x0800, 0xd4f9aaf8, 1 | BRF_ESS | BRF_PRG }, // 2 + { "6.bin", 0x0800, 0x6b41bb80, 1 | BRF_ESS | BRF_PRG }, // 3 + { "3.bin", 0x0800, 0x748e0e48, 1 | BRF_ESS | BRF_PRG }, // 4 + { "7.bin", 0x0800, 0x7b7f4a74, 1 | BRF_ESS | BRF_PRG }, // 5 + { "4.bin", 0x0800, 0x367a3884, 1 | BRF_ESS | BRF_PRG }, // 6 + { "8.bin", 0x0800, 0x2baaadae, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "9.bin", 0x0800, 0x342c0653, 2 | BRF_GRA }, // 8 Graphics + { "11.bin", 0x0800, 0xaaa7a537, 2 | BRF_GRA }, // 9 + { "10.bin", 0x0800, 0xb247b82c, 2 | BRF_GRA }, // 10 + { "12.bin", 0x0800, 0x99af4b30, 2 | BRF_GRA }, // 11 + + { "7051.bin", 0x0020, 0x0dad2ccb, 3 | BRF_GRA }, // 12 Color Proms + { "7051-3.bin", 0x0100, 0xd8d78829, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "7051-2.bin", 0x0100, 0x77245b66, 4 | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(eyesb) +STD_ROM_FN(eyesb) + +struct BurnDriver BurnDrveyesb = { + "eyesb", "eyes", NULL, NULL, "1982", + "Eyes (bootleg set 1)\0", NULL, "bootleg", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, eyesbRomInfo, eyesbRomName, NULL, NULL, eyesInputInfo, eyesDIPInfo, + eyesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Eyes (bootleg set 2, decrypted) + +static struct BurnRomInfo eyeszacbRomDesc[] = { + { "zacb_1.bin", 0x0800, 0xa4a9d7a0, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "zacb_5.bin", 0x0800, 0xc32b3f73, 1 | BRF_ESS | BRF_PRG }, // 1 + { "zacb_2.bin", 0x0800, 0x195b9473, 1 | BRF_ESS | BRF_PRG }, // 2 + { "zacb_6.bin", 0x0800, 0x292886cb, 1 | BRF_ESS | BRF_PRG }, // 3 + { "zacb_3.bin", 0x0800, 0xff94b015, 1 | BRF_ESS | BRF_PRG }, // 4 + { "zacb_7.bin", 0x0800, 0x9271c58c, 1 | BRF_ESS | BRF_PRG }, // 5 + { "zacb_4.bin", 0x0800, 0x965cf32b, 1 | BRF_ESS | BRF_PRG }, // 6 + { "zacb_8.bin", 0x0800, 0xc254e92e, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "x.bin", 0x0800, 0x59dce22e, 2 | BRF_GRA }, // 8 Graphics + { "c.bin", 0x0800, 0xaaa7a537, 2 | BRF_GRA }, // 9 + { "b.bin", 0x0800, 0x1969792b, 2 | BRF_GRA }, // 10 + { "p.bin", 0x0800, 0x99af4b30, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "82s129.4a", 0x0100, 0xd8d78829, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) + + { "zacb_11.bin", 0x0800, 0x69c1602a, 0 | BRF_PRG }, // 16 (Not used) +}; + +STD_ROM_PICK(eyeszacb) +STD_ROM_FN(eyeszacb) + +struct BurnDriver BurnDrveyeszac = { + "eyeszacb", "eyes", NULL, NULL, "1982", + "Eyes (bootleg set 2, decrypted)\0", NULL, "bootleg", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, eyeszacbRomInfo, eyeszacbRomName, NULL, NULL, eyesInputInfo, eyesDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Mr. TNT + +static struct BurnRomInfo mrtntRomDesc[] = { + { "tnt.1", 0x1000, 0x0e836586, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "tnt.2", 0x1000, 0x779c4c5b, 1 | BRF_ESS | BRF_PRG }, // 1 + { "tnt.3", 0x1000, 0xad6fc688, 1 | BRF_ESS | BRF_PRG }, // 2 + { "tnt.4", 0x1000, 0xd77557b3, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "tnt.5", 0x1000, 0x3038cc0e, 2 | BRF_GRA }, // 4 Graphics + { "tnt.6", 0x1000, 0x97634d8b, 2 | BRF_GRA }, // 5 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 6 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 7 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 8 Timing Prom (not used) +}; + +STD_ROM_PICK(mrtnt) +STD_ROM_FN(mrtnt) + +struct BurnDriver BurnDrvmrtnt = { + "mrtnt", NULL, NULL, NULL, "1982", + "Mr. TNT\0", NULL, "Telko", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, mrtntRomInfo, mrtntRomName, NULL, NULL, eyesInputInfo, mrtntDIPInfo, + eyesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Gorkans + +static struct BurnRomInfo gorkansRomDesc[] = { + { "gorkans8.rom", 0x0800, 0x55100b18, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "gorkans4.rom", 0x0800, 0xb5c604bf, 1 | BRF_ESS | BRF_PRG }, // 1 + { "gorkans7.rom", 0x0800, 0xb8c6def4, 1 | BRF_ESS | BRF_PRG }, // 2 + { "gorkans3.rom", 0x0800, 0x4602c840, 1 | BRF_ESS | BRF_PRG }, // 3 + { "gorkans6.rom", 0x0800, 0x21412a62, 1 | BRF_ESS | BRF_PRG }, // 4 + { "gorkans2.rom", 0x0800, 0xa013310b, 1 | BRF_ESS | BRF_PRG }, // 5 + { "gorkans5.rom", 0x0800, 0x122969b2, 1 | BRF_ESS | BRF_PRG }, // 6 + { "gorkans1.rom", 0x0800, 0xf2524b11, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "gorkgfx4.rom", 0x0800, 0x39cd0dbc, 2 | BRF_GRA }, // 8 Graphics + { "gorkgfx2.rom", 0x0800, 0x33d52535, 2 | BRF_GRA }, // 9 + { "gorkgfx3.rom", 0x0800, 0x4b6b7970, 2 | BRF_GRA }, // 10 + { "gorkgfx1.rom", 0x0800, 0xed70bb3c, 2 | BRF_GRA }, // 11 + + { "gorkprom.4", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "gorkprom.1", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "gorkprom.3", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "gorkprom.2", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(gorkans) +STD_ROM_FN(gorkans) + +struct BurnDriver BurnDrvgorkans = { + "gorkans", "mrtnt", NULL, NULL, "1983", + "Gorkans\0", NULL, "Techstar", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, gorkansRomInfo, gorkansRomName, NULL, NULL, eyesInputInfo, mrtntDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Eggor + +static struct BurnRomInfo eggorRomDesc[] = { + { "1.bin", 0x0800, 0x818ed154, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "5.bin", 0x0800, 0xa4b21d93, 1 | BRF_ESS | BRF_PRG }, // 1 + { "2.bin", 0x0800, 0x5d7a23ed, 1 | BRF_ESS | BRF_PRG }, // 2 + { "6.bin", 0x0800, 0xe9dbca8d, 1 | BRF_ESS | BRF_PRG }, // 3 + { "3.bin", 0x0800, 0x4318ab85, 1 | BRF_ESS | BRF_PRG }, // 4 + { "7.bin", 0x0800, 0x03214d7f, 1 | BRF_ESS | BRF_PRG }, // 5 + { "4.bin", 0x0800, 0xdc805be4, 1 | BRF_ESS | BRF_PRG }, // 6 + { "8.bin", 0x0800, 0xf9ae204b, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "9.bin", 0x0800, 0x96ad8626, 2 | BRF_GRA }, // 8 Graphics + { "11.bin", 0x0800, 0xcc324017, 2 | BRF_GRA }, // 9 + { "10.bin", 0x0800, 0x7c97f513, 2 | BRF_GRA }, // 10 + { "12.bin", 0x0800, 0x2e930602, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(eggor) +STD_ROM_FN(eggor) + +struct BurnDriver BurnDrveggor = { + "eggor", NULL, NULL, NULL, "1982", + "Eggor\0", NULL, "Telko", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, eggorRomInfo, eggorRomName, NULL, NULL, eyesInputInfo, mrtntDIPInfo, + eyesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + + +// Piranha + +static struct BurnRomInfo piranhaRomDesc[] = { + { "pir1.bin", 0x0800, 0x69a3e6ea, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pir5.bin", 0x0800, 0x245e753f, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pir2.bin", 0x0800, 0x62cb6954, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pir6.bin", 0x0800, 0xcb0700bc, 1 | BRF_ESS | BRF_PRG }, // 3 + { "pir3.bin", 0x0800, 0x843fbfe5, 1 | BRF_ESS | BRF_PRG }, // 4 + { "pir7.bin", 0x0800, 0x73084d5e, 1 | BRF_ESS | BRF_PRG }, // 5 + { "pir4.bin", 0x0800, 0x4cdf6704, 1 | BRF_ESS | BRF_PRG }, // 6 + { "pir8.bin", 0x0800, 0xb86fedb3, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "pir9.bin", 0x0800, 0x0f19eb28, 2 | BRF_GRA }, // 8 Graphics + { "pir11.bin", 0x0800, 0x5f8bdabe, 2 | BRF_GRA }, // 9 + { "pir10.bin", 0x0800, 0xd19399fb, 2 | BRF_GRA }, // 10 + { "pir12.bin", 0x0800, 0xcfb4403d, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Prom + { "piranha.4a", 0x0100, 0x08c9447b, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(piranha) +STD_ROM_FN(piranha) + +static INT32 piranhaInit() +{ + return DrvInit(StandardMap, eyes_decode, PIRANHA); +} + +struct BurnDriver BurnDrvpiranha = { + "piranha", "puckman", NULL, NULL, "1981", + "Piranha\0", NULL, "GL (US Billiards License)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, piranhaRomInfo, piranhaRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + piranhaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Piranha (older) + +static struct BurnRomInfo piranhaoRomDesc[] = { + { "p1.bin", 0x0800, 0xc6ce1bfc, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "p5.bin", 0x0800, 0xa2655a33, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pir2.bin", 0x0800, 0x62cb6954, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pir6.bin", 0x0800, 0xcb0700bc, 1 | BRF_ESS | BRF_PRG }, // 3 + { "pir3.bin", 0x0800, 0x843fbfe5, 1 | BRF_ESS | BRF_PRG }, // 4 + { "pir7.bin", 0x0800, 0x73084d5e, 1 | BRF_ESS | BRF_PRG }, // 5 + { "p4.bin", 0x0800, 0x9363a4d1, 1 | BRF_ESS | BRF_PRG }, // 6 + { "p8.bin", 0x0800, 0x2769979c, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "p9.bin", 0x0800, 0x94eb7563, 2 | BRF_GRA }, // 8 Graphics + { "p11.bin", 0x0800, 0xa3606973, 2 | BRF_GRA }, // 9 + { "p10.bin", 0x0800, 0x84165a2c, 2 | BRF_GRA }, // 10 + { "p12.bin", 0x0800, 0x2699ba9e, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "piranha.4a", 0x0100, 0x08c9447b, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(piranhao) +STD_ROM_FN(piranhao) + +struct BurnDriver BurnDrvpiranhao = { + "piranhao", "puckman", NULL, NULL, "1981", + "Piranha (older)\0", NULL, "GL (US Billiards License)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, piranhaoRomInfo, piranhaoRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + piranhaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Piranha (hack) + +static struct BurnRomInfo piranhahRomDesc[] = { + { "pr1.cpu", 0x1000, 0xbc5ad024, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "pacman.6f", 0x1000, 0x1a6fb2d4, 1 | BRF_ESS | BRF_PRG }, // 1 + { "pr3.cpu", 0x1000, 0x473c379d, 1 | BRF_ESS | BRF_PRG }, // 2 + { "pr4.cpu", 0x1000, 0x63fbf895, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "pr5.cpu", 0x0800, 0x3fc4030c, 2 | BRF_GRA }, // 4 Graphics + { "pr7.cpu", 0x0800, 0x30b9a010, 2 | BRF_GRA }, // 5 + { "pr6.cpu", 0x0800, 0xf3e9c9d5, 2 | BRF_GRA }, // 6 + { "pr8.cpu", 0x0800, 0x133d720d, 2 | BRF_GRA }, // 7 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 8 Color Prom + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 9 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(piranhah) +STD_ROM_FN(piranhah) + +struct BurnDriver BurnDrvpiranhah = { + "piranhah", "puckman", NULL, NULL, "1981", + "Piranha (hack)\0", NULL, "hack", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, piranhahRomInfo, piranhahRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Abscam + +static struct BurnRomInfo abscamRomDesc[] = { + { "as0.bin", 0x0800, 0x0b102302, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "as4.bin", 0x0800, 0x3116a8ec, 1 | BRF_ESS | BRF_PRG }, // 1 + { "as1.bin", 0x0800, 0xbc0281e0, 1 | BRF_ESS | BRF_PRG }, // 2 + { "as5.bin", 0x0800, 0x428ee2e8, 1 | BRF_ESS | BRF_PRG }, // 3 + { "as2.bin", 0x0800, 0xe05d46ad, 1 | BRF_ESS | BRF_PRG }, // 4 + { "as6.bin", 0x0800, 0x3ae9a8cb, 1 | BRF_ESS | BRF_PRG }, // 5 + { "as3.bin", 0x0800, 0xb39eb940, 1 | BRF_ESS | BRF_PRG }, // 6 + { "as7.bin", 0x0800, 0x16cf1c67, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "as8.bin", 0x0800, 0x61daabe5, 2 | BRF_GRA }, // 8 Graphics + { "as10.bin", 0x0800, 0x81d50c98, 2 | BRF_GRA }, // 9 + { "as9.bin", 0x0800, 0xa3bd1613, 2 | BRF_GRA }, // 10 + { "as11.bin", 0x0800, 0x9d802b68, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "as4a.bin", 0x0100, 0x1605b324, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(abscam) +STD_ROM_FN(abscam) + +struct BurnDriver BurnDrvabscam = { + "abscam", "puckman", NULL, NULL, "1981", + "Abscam\0", NULL, "GL (US Billiards License)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, abscamRomInfo, abscamRomName, NULL, NULL, DrvInputInfo, mspacmanDIPInfo, + piranhaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Jump Shot + +static struct BurnRomInfo jumpshotRomDesc[] = { + { "6e", 0x1000, 0xf00def9a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "6f", 0x1000, 0xf70deae2, 1 | BRF_ESS | BRF_PRG }, // 1 + { "6h", 0x1000, 0x894d6f68, 1 | BRF_ESS | BRF_PRG }, // 2 + { "6j", 0x1000, 0xf15a108a, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "5e", 0x1000, 0xd9fa90f5, 2 | BRF_GRA }, // 4 Graphics + { "5f", 0x1000, 0x2ec711c1, 2 | BRF_GRA }, // 5 + + { "prom.7f", 0x0020, 0x872b42f3, 3 | BRF_GRA }, // 6 Color Prom + { "prom.4a", 0x0100, 0x0399f39f, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(jumpshot) +STD_ROM_FN(jumpshot) + +static UINT8 jumpshot_decrypt(INT32 addr, UINT8 e) +{ + static const UINT8 swap_xor_table[6][9] = { + { 7,6,5,4,3,2,1,0, 0x00 }, + { 7,6,3,4,5,2,1,0, 0x20 }, + { 5,0,4,3,7,1,2,6, 0xa4 }, + { 5,0,4,3,7,1,2,6, 0x8c }, + { 2,3,1,7,4,6,0,5, 0x6e }, + { 2,3,4,7,1,6,0,5, 0x4e } + }; + + static const INT32 picktable[32] = { + 0,2,4,4,4,2,0,2,2,0,2,4,4,2,0,2, + 5,3,5,1,5,3,5,3,1,5,1,5,5,3,5,3 + }; + + INT32 method = picktable[(addr & 0x001) | ((addr & 0x004) >> 1) | ((addr & 0x020) >> 3) | ((addr & 0x080) >> 4) |((addr & 0x200) >> 5)]; + + if ((addr & 0x800) == 0x800) + method ^= 1; + + const UINT8 *tbl = swap_xor_table[method]; + return BITSWAP08(e,tbl[0],tbl[1],tbl[2],tbl[3],tbl[4],tbl[5],tbl[6],tbl[7]) ^ tbl[8]; +} + +static void jumpshot_decode() +{ + for (INT32 i = 0; i < 0x4000; i++) { + DrvZ80ROM[i] = jumpshot_decrypt(i, DrvZ80ROM[i]); + } +} + +static INT32 jumpshotInit() +{ + return DrvInit(StandardMap, jumpshot_decode, PACMAN); +} + +struct BurnDriver BurnDrvjumpshot = { + "jumpshot", NULL, NULL, NULL, "1985", + "Jump Shot\0", NULL, "Bally Midway", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_SPORTSMISC, 0, + NULL, jumpshotRomInfo, jumpshotRomName, NULL, NULL, jumpshotInputInfo, jumpshotDIPInfo, + jumpshotInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Jump Shot Engineering Sample + +static struct BurnRomInfo jumpshotpRomDesc[] = { + { "js6e.bin", 0x1000, 0xacc5e15e, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "js6f.bin", 0x1000, 0x62b48ba4, 1 | BRF_ESS | BRF_PRG }, // 1 + { "js6h.bin", 0x1000, 0x7c9b5e30, 1 | BRF_ESS | BRF_PRG }, // 2 + { "js6j.bin", 0x1000, 0x9f0c39f6, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "5e", 0x1000, 0xd9fa90f5, 2 | BRF_GRA }, // 4 Graphics + { "5f", 0x1000, 0x2ec711c1, 2 | BRF_GRA }, // 5 + + { "prom.7f", 0x0020, 0x872b42f3, 3 | BRF_GRA }, // 6 Color Proms + { "prom.4a", 0x0100, 0x0399f39f, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(jumpshotp) +STD_ROM_FN(jumpshotp) + +struct BurnDriver BurnDrvjumpshotp = { + "jumpshotp", "jumpshot", NULL, NULL, "1985", + "Jump Shot Engineering Sample\0", NULL, "Bally Midway", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_SPORTSMISC, 0, + NULL, jumpshotpRomInfo, jumpshotpRomName, NULL, NULL, jumpshotInputInfo, jumpshtpDIPInfo, + jumpshotInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Shoot the Bull + +static struct BurnRomInfo shootbulRomDesc[] = { + { "sb6e.cpu", 0x1000, 0x25daa5e9, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "sb6f.cpu", 0x1000, 0x92144044, 1 | BRF_ESS | BRF_PRG }, // 1 + { "sb6h.cpu", 0x1000, 0x43b7f99d, 1 | BRF_ESS | BRF_PRG }, // 2 + { "sb6j.cpu", 0x1000, 0xbc4d3bbf, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "sb5e.cpu", 0x1000, 0x07c6c5aa, 2 | BRF_GRA }, // 4 Graphics + { "sb5f.cpu", 0x1000, 0xeaec6837, 2 | BRF_GRA }, // 5 + + { "7f.rom", 0x0020, 0xec578b98, 3 | BRF_GRA }, // 6 Color Proms + { "4a.rom", 0x0100, 0x81a6b30f, 3 | BRF_GRA }, // 7 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(shootbul) +STD_ROM_FN(shootbul) + +static INT32 shootbulInit() +{ + return DrvInit(StandardMap, jumpshot_decode, SHOOTBUL); +} + +struct BurnDriverD BurnDrvshootbul = { + "shootbul", NULL, NULL, NULL, "1985", + "Shoot the Bull\0", "Analog inputs not hooked up", "Bally Midway", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_SPORTSMISC, 0, + NULL, shootbulRomInfo, shootbulRomName, NULL, NULL, shootbulInputInfo, shootbulDIPInfo, + shootbulInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Cannon Ball (Pacman Hardware) + +static struct BurnRomInfo cannonbpRomDesc[] = { + { "n1-6e", 0x0800, 0xc68878c7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "n2-6k", 0x0800, 0xff3951a5, 1 | BRF_ESS | BRF_PRG }, // 1 + { "n3-6f", 0x0800, 0x2329079d, 1 | BRF_ESS | BRF_PRG }, // 2 + { "n4-6m", 0x0800, 0xfcc57ecb, 1 | BRF_ESS | BRF_PRG }, // 3 + { "n5-6h", 0x0800, 0x52846c9d, 1 | BRF_ESS | BRF_PRG }, // 4 + { "n6-6n", 0x0800, 0x59e890dd, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "z1-5e", 0x0800, 0x125779e0, 2 | BRF_GRA }, // 6 Graphics + { "z3-5h", 0x0800, 0x78f866c0, 2 | BRF_GRA }, // 7 + { "z2-5f", 0x0800, 0xfbd2c99d, 2 | BRF_GRA }, // 8 + { "z4-5j", 0x0800, 0x8734c904, 2 | BRF_GRA }, // 9 + + { "colorprom_1", 0x0020, 0x08f8ae7e, 3 | BRF_GRA }, // 10 Color Proms + { "colorprom_2", 0x0100, 0x359a15dc, 3 | BRF_GRA }, // 11 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 12 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom (not used) +}; + +STD_ROM_PICK(cannonbp) +STD_ROM_FN(cannonbp) + +static INT32 cannonbpInit() +{ + return DrvInit(CannonbpMap, NULL, CANNONBP); +} + +struct BurnDriver BurnDrvcannonbp = { + "cannonbp", NULL, NULL, NULL, "198?", + "Cannon Ball (Pacman Hardware)\0", "wrong colors", "Novomatic", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_BREAKOUT, 0, + NULL, cannonbpRomInfo, cannonbpRomName, NULL, NULL, cannonbpInputInfo, cannonbpDIPInfo, + cannonbpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Woodpecker (set 1) + +static struct BurnRomInfo woodpeckRomDesc[] = { + { "f.bin", 0x1000, 0x37ea66ca, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "i.bin", 0x1000, 0xcd115dba, 1 | BRF_ESS | BRF_PRG }, // 1 + { "e.bin", 0x1000, 0xd40b2321, 1 | BRF_ESS | BRF_PRG }, // 2 + { "g.bin", 0x1000, 0x024092f4, 1 | BRF_ESS | BRF_PRG }, // 3 + { "h.bin", 0x1000, 0x18ef0fc8, 1 | BRF_ESS | BRF_PRG }, // 4 + + { "a.5e", 0x0800, 0x15a87f62, 2 | BRF_GRA }, // 5 Graphics + { "c.5h", 0x0800, 0xab4abd88, 2 | BRF_GRA }, // 6 + { "b.5f", 0x0800, 0x5b9ba95b, 2 | BRF_GRA }, // 7 + { "d.5j", 0x0800, 0xd7b80a45, 2 | BRF_GRA }, // 8 + + { "pr.8h", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 9 Color Prom + { "pr.4a", 0x0100, 0xd8772167, 3 | BRF_GRA }, // 10 + + { "pr.1k", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 11 Sound Prom + { "pr.3k", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 12 Timing Prom (not used) +}; + +STD_ROM_PICK(woodpeck) +STD_ROM_FN(woodpeck) + +static void woodpeckCallback() +{ + memcpy (DrvZ80ROM + 0xb000, DrvZ80ROM + 0x8000, 0x1000); + memcpy (DrvZ80ROM + 0x8000, DrvZ80ROM + 0x1000, 0x3000); + + memset (DrvZ80ROM + 0x1000, 0, 0x3000); + + for (INT32 i = 0; i < 0x2000; i += 8) + eyes_gfx_decode(DrvGfxROM + i); +} + +static INT32 woodpeckInit() +{ + return DrvInit(WoodpekMap, woodpeckCallback, PACMAN); +} + +struct BurnDriver BurnDrvwoodpeck = { + "woodpeck", NULL, NULL, NULL, "1981", + "Woodpecker (set 1)\0", NULL, "Amenip (Palcom Queen River)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, + NULL, woodpeckRomInfo, woodpeckRomName, NULL, NULL, woodpekInputInfo, woodpekDIPInfo, + woodpeckInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Woodpecker (set 2) + +static struct BurnRomInfo woodpekaRomDesc[] = { + { "0", 0x1000, 0xb5ee8bca, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "1", 0x1000, 0xc5ec2de6, 1 | BRF_PRG | BRF_ESS }, // 1 + { "2", 0x1000, 0x07ea534e, 1 | BRF_PRG | BRF_ESS }, // 2 + { "3", 0x1000, 0xa3a3253a, 1 | BRF_PRG | BRF_ESS }, // 3 + { "4", 0x1000, 0x6c50546b, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "10.5f", 0x1000, 0x0bf52102, 2 | BRF_GRA }, // 5 Graphics + { "11.5h", 0x1000, 0x0ed8def8, 2 | BRF_GRA }, // 6 + + { "pr.8h", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 7 Color Proms + { "pr.4a", 0x0100, 0xd8772167, 3 | BRF_GRA }, // 8 + + { "pr.1k", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 9 + { "pr.3k", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 10 Timing Prom (not used) +}; + +STD_ROM_PICK(woodpeka) +STD_ROM_FN(woodpeka) + +struct BurnDriver BurnDrvwoodpeka = { + "woodpeca", "woodpeck", NULL, NULL, "1981", + "Woodpecker (set 2)\0", NULL, "Amenip (Palcom Queen River)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, + NULL, woodpekaRomInfo, woodpekaRomName, NULL, NULL, woodpekInputInfo, woodpekDIPInfo, + woodpeckInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Lizard Wizard + +static struct BurnRomInfo lizwizRomDesc[] = { + { "6e.cpu", 0x1000, 0x32bc1990, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "6f.cpu", 0x1000, 0xef24b414, 1 | BRF_ESS | BRF_PRG }, // 1 + { "6h.cpu", 0x1000, 0x30bed83d, 1 | BRF_ESS | BRF_PRG }, // 2 + { "6j.cpu", 0x1000, 0xdd09baeb, 1 | BRF_ESS | BRF_PRG }, // 3 + { "wiza", 0x1000, 0xf6dea3a6, 1 | BRF_ESS | BRF_PRG }, // 4 + { "wizb", 0x1000, 0xf27fb5a8, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "5e.cpu", 0x1000, 0x45059e73, 2 | BRF_GRA }, // 6 Graphics + { "5f.cpu", 0x1000, 0xd2469717, 2 | BRF_GRA }, // 7 + + { "7f.cpu", 0x0020, 0x7549a947, 3 | BRF_GRA }, // 8 Color Proms + { "4a.cpu", 0x0100, 0x5fdca536, 3 | BRF_GRA }, // 9 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 10 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom (not used) +}; + +STD_ROM_PICK(lizwiz) +STD_ROM_FN(lizwiz) + +static INT32 lizwizInit() +{ + return DrvInit(WoodpekMap, NULL, PACMAN); +} + +struct BurnDriver BurnDrvlizwiz = { + "lizwiz", NULL, NULL, NULL, "1985", + "Lizard Wizard\0", NULL, "Techstar (Sunn license)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_SHOOT, 0, + NULL, lizwizRomInfo, lizwizRomName, NULL, NULL, lizwizInputInfo, lizwizDIPInfo, + lizwizInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Ponpoko + +static struct BurnRomInfo ponpokoRomDesc[] = { + { "ppokoj1.bin", 0x1000, 0xffa3c004, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ppokoj2.bin", 0x1000, 0x4a496866, 1 | BRF_ESS | BRF_PRG }, // 1 + { "ppokoj3.bin", 0x1000, 0x17da6ca3, 1 | BRF_ESS | BRF_PRG }, // 2 + { "ppokoj4.bin", 0x1000, 0x9d39a565, 1 | BRF_ESS | BRF_PRG }, // 3 + { "ppoko5.bin", 0x1000, 0x54ca3d7d, 1 | BRF_ESS | BRF_PRG }, // 4 + { "ppoko6.bin", 0x1000, 0x3055c7e0, 1 | BRF_ESS | BRF_PRG }, // 5 + { "ppoko7.bin", 0x1000, 0x3cbe47ca, 1 | BRF_ESS | BRF_PRG }, // 6 + { "ppokoj8.bin", 0x1000, 0x04b63fc6, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "ppoko9.bin", 0x1000, 0xb73e1a06, 2 | BRF_GRA }, // 8 Graphics + { "ppoko10.bin", 0x1000, 0x62069b5d, 2 | BRF_GRA }, // 9 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 10 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 11 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 12 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom (not used) +}; + +STD_ROM_PICK(ponpoko) +STD_ROM_FN(ponpoko) + +static void ponpoko_decode() +{ + for (INT32 i = 0; i < 0x1000; i += 0x10) // Characters + { + for (INT32 j = 0; j < 8; j++) + { + INT32 t = DrvGfxROM[i+j+0x08]; + DrvGfxROM[i+j+0x08] = DrvGfxROM[i+j+0x00]; + DrvGfxROM[i+j+0x00] = t; + } + } + + for (INT32 i = 0x1000; i < 0x2000; i += 0x20) // Sprites + { + for (INT32 j = 0; j < 8; j++) + { + INT32 t = DrvGfxROM[i+j+0x18]; + DrvGfxROM[i+j+0x18] = DrvGfxROM[i+j+0x10]; + DrvGfxROM[i+j+0x10] = DrvGfxROM[i+j+0x08]; + DrvGfxROM[i+j+0x08] = DrvGfxROM[i+j+0x00]; + DrvGfxROM[i+j+0x00] = t; + } + } +} + +static INT32 ponpokoInit() +{ + return DrvInit(WoodpekMap, ponpoko_decode, PACMAN); +} + +struct BurnDriver BurnDrvponpoko = { + "ponpoko", NULL, NULL, NULL, "1982", + "Ponpoko\0", NULL, "Sigma Enterprises Inc.", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, + NULL, ponpokoRomInfo, ponpokoRomName, NULL, NULL, ponpokoInputInfo, ponpokoDIPInfo, + ponpokoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 288, 224, 4, 3 +}; + + +// Ponpoko (Venture Line) + +static struct BurnRomInfo ponpokovRomDesc[] = { + { "ppoko1.bin", 0x1000, 0x49077667, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ppoko2.bin", 0x1000, 0x5101781a, 1 | BRF_ESS | BRF_PRG }, // 1 + { "ppoko3.bin", 0x1000, 0xd790ed22, 1 | BRF_ESS | BRF_PRG }, // 2 + { "ppoko4.bin", 0x1000, 0x4e449069, 1 | BRF_ESS | BRF_PRG }, // 3 + { "ppoko5.bin", 0x1000, 0x54ca3d7d, 1 | BRF_ESS | BRF_PRG }, // 4 + { "ppoko6.bin", 0x1000, 0x3055c7e0, 1 | BRF_ESS | BRF_PRG }, // 5 + { "ppoko7.bin", 0x1000, 0x3cbe47ca, 1 | BRF_ESS | BRF_PRG }, // 6 + { "ppoko8.bin", 0x1000, 0xb39be27d, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "ppoko9.bin", 0x1000, 0xb73e1a06, 2 | BRF_GRA }, // 8 Graphics + { "ppoko10.bin", 0x1000, 0x62069b5d, 2 | BRF_GRA }, // 9 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 10 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 11 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 12 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom (not used) +}; + +STD_ROM_PICK(ponpokov) +STD_ROM_FN(ponpokov) + +struct BurnDriver BurnDrvponpokov = { + "ponpokov", "ponpoko", NULL, NULL, "1982", + "Ponpoko (Venture Line)\0", NULL, "Sigma Enterprises Inc. (Venture Line license)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, + NULL, ponpokovRomInfo, ponpokovRomName, NULL, NULL, ponpokoInputInfo, ponpokoDIPInfo, + ponpokoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 288, 224, 4, 3 +}; + + +// The Glob (Pac-Man hardware) + +static struct BurnRomInfo theglobpRomDesc[] = { + { "glob.u2", 0x2000, 0x829d0bea, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "glob.u3", 0x2000, 0x31de6628, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "glob.5e", 0x1000, 0x53688260, 2 | BRF_GRA }, // 2 Graphics + { "glob.5f", 0x1000, 0x051f59c7, 2 | BRF_GRA }, // 3 + + { "glob.7f", 0x0020, 0x1f617527, 3 | BRF_GRA }, // 4 Color Proms + { "glob.4a", 0x0100, 0x28faa769, 3 | BRF_GRA }, // 5 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 6 Sound Prom + { "82s126.3m" , 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 7 Timing Prom (not used) +}; + +STD_ROM_PICK(theglobp) +STD_ROM_FN(theglobp) + +static void theglobp_decrypt() +{ + for (INT32 i = 0; i < 0x4000; i++) { + DrvZ80ROM[0x10000 + i] = BITSWAP08(DrvZ80ROM[i] ^ 0xfc, 3, 7, 0, 6, 4, 1, 2, 5); + DrvZ80ROM[0x14000 + i] = BITSWAP08(DrvZ80ROM[i] ^ 0xf6, 1, 7, 0, 3, 4, 6, 2, 5); + DrvZ80ROM[0x18000 + i] = BITSWAP08(DrvZ80ROM[i] ^ 0x7d, 3, 0, 4, 6, 7, 1, 2, 5); + DrvZ80ROM[0x1c000 + i] = BITSWAP08(DrvZ80ROM[i] ^ 0x77, 1, 0, 4, 3, 7, 6, 2, 5); + } +} + +static INT32 theglobpInit() +{ + return DrvInit(StandardMap, theglobp_decrypt, EPOS); +} + +struct BurnDriver BurnDrvtheglobp = { + "theglobp", "suprglob", NULL, NULL, "1983", + "The Glob (Pac-Man hardware)\0", NULL, "Epos Corporation", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, + NULL, theglobpRomInfo, theglobpRomName, NULL, NULL, theglobpInputInfo, theglobpDIPInfo, + theglobpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Super Glob (Pac-Man hardware) + +static struct BurnRomInfo sprglobpRomDesc[] = { + { "glob.u2", 0x2000, 0x829d0bea, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "glob.u3", 0x2000, 0x31de6628, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "5e_2532.dat", 0x1000, 0x1aa16109, 2 | BRF_GRA }, // 2 Graphics + { "5f_2532.dat", 0x1000, 0xafe72a89, 2 | BRF_GRA }, // 3 + + { "glob.7f", 0x0020, 0x1f617527, 3 | BRF_GRA }, // 4 Color Prom + { "glob.4a", 0x0100, 0x28faa769, 3 | BRF_GRA }, // 5 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 6 Sound Prom + { "82s126.3m" , 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 7 Timing Prom (not used) +}; + +STD_ROM_PICK(sprglobp) +STD_ROM_FN(sprglobp) + +struct BurnDriver BurnDrvsprglobp = { + "sprglobp", "suprglob", NULL, NULL, "1983", + "Super Glob (Pac-Man hardware)\0", NULL, "Epos Corporation", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, + NULL, sprglobpRomInfo, sprglobpRomName, NULL, NULL, theglobpInputInfo, theglobpDIPInfo, + theglobpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Super Glob (Pac-Man hardware) German + +static struct BurnRomInfo sprglbpgRomDesc[] = { + { "ic8.1", 0x1000, 0xa2df2073, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ic7.2", 0x1000, 0x3d2c22d9, 1 | BRF_ESS | BRF_PRG }, // 1 + { "ic15.3", 0x1000, 0xa252047f, 1 | BRF_ESS | BRF_PRG }, // 2 + { "ic14.4", 0x1000, 0x7efa81f1, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "ic92.5", 0x2000, 0xE54F484D, 2 | BRF_GRA }, // 4 Graphics + + { "ic78.prm", 0x0020, 0x1f617527, 3 | BRF_GRA }, // 5 Color Prom + { "ic88.prm", 0x0100, 0x28faa769, 3 | BRF_GRA }, // 6 + + { "ic51.prm", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 7 Sound Prom + { "ic70.prm" , 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 8 Timing Prom (not used) +}; + +STD_ROM_PICK(sprglbpg) +STD_ROM_FN(sprglbpg) + +struct BurnDriver BurnDrvsprglbpg = { + "sprglbpg", "suprglob", NULL, NULL, "1983", + "Super Glob (Pac-Man hardware) German\0", NULL, "bootleg", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, + NULL, sprglbpgRomInfo, sprglbpgRomName, NULL, NULL, theglobpInputInfo, theglobpDIPInfo, + puckmanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Beastie Feastie + +static struct BurnRomInfo beastfRomDesc[] = { + { "bf-u2.bin", 0x2000, 0x3afc517b, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "bf-u3.bin", 0x2000, 0x8dbd76d0, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "beastf.5e", 0x1000, 0x5654dc34, 2 | BRF_GRA }, // 2 Graphics + { "beastf.5f", 0x1000, 0x1b30ca61, 2 | BRF_GRA }, // 3 + + { "glob.7f", 0x0020, 0x1f617527, 3 | BRF_GRA }, // 4 Color Proms + { "glob.4a", 0x0100, 0x28faa769, 3 | BRF_GRA }, // 5 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 6 Sound Prom + { "82s126.3m" , 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 7 Timing Prom (not used) +}; + +STD_ROM_PICK(beastf) +STD_ROM_FN(beastf) + +struct BurnDriver BurnDrvbeastf = { + "beastf", "suprglob", NULL, NULL, "1984", + "Beastie Feastie\0", NULL, "Epos Corporation", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, + NULL, beastfRomInfo, beastfRomName, NULL, NULL, theglobpInputInfo, theglobpDIPInfo, + theglobpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Van-Van Car + +static struct BurnRomInfo vanvanRomDesc[] = { + { "van-1.50", 0x1000, 0xcf1b2df0, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "van-2.51", 0x1000, 0xdf58e1cb, 1 | BRF_ESS | BRF_PRG }, // 1 + { "van-3.52", 0x1000, 0x15571e24, 1 | BRF_ESS | BRF_PRG }, // 2 + { "van-4.53", 0x1000, 0xb724cbe0, 1 | BRF_ESS | BRF_PRG }, // 3 + { "van-5.39", 0x1000, 0xdb67414c, 1 | BRF_ESS | BRF_PRG }, // 4 + + { "van-20.18", 0x1000, 0x60efbe66, 2 | BRF_GRA }, // 5 Graphics + { "van-21.19", 0x1000, 0x5dd53723, 2 | BRF_GRA }, // 6 + + { "6331-1.6", 0x0020, 0xce1d9503, 3 | BRF_GRA }, // 7 Color Proms + { "6301-1.37", 0x0100, 0x4b803d9f, 3 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(vanvan) +STD_ROM_FN(vanvan) + +static void vanvanCallback() +{ + memcpy (DrvZ80ROM + 0x9000, DrvZ80ROM + 0x8000, 0x1000); + memcpy (DrvZ80ROM + 0xa000, DrvZ80ROM + 0x8000, 0x1000); + memcpy (DrvZ80ROM + 0xb000, DrvZ80ROM + 0x8000, 0x1000); +} + +static INT32 vanvanInit() +{ + return DrvInit(DremshprMap, vanvanCallback, VANVAN); +} + +struct BurnDriver BurnDrvvanvan = { + "vanvan", NULL, NULL, NULL, "1983", + "Van-Van Car\0", NULL, "Sanritsu", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, vanvanRomInfo, vanvanRomName, NULL, NULL, vanvanInputInfo, vanvanDIPInfo, + vanvanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Van-Van Car (Karateco) + +static struct BurnRomInfo vanvankRomDesc[] = { + { "van1.bin", 0x1000, 0x00f48295, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "van-2.51", 0x1000, 0xdf58e1cb, 1 | BRF_ESS | BRF_PRG }, // 1 + { "van-3.52", 0x1000, 0x15571e24, 1 | BRF_ESS | BRF_PRG }, // 2 + { "van4.bin", 0x1000, 0xf8b37ed5, 1 | BRF_ESS | BRF_PRG }, // 3 + { "van5.bin", 0x1000, 0xb8c1e089, 1 | BRF_ESS | BRF_PRG }, // 4 + + { "van-20.18", 0x1000, 0x60efbe66, 2 | BRF_GRA }, // 5 Graphics + { "van-21.19", 0x1000, 0x5dd53723, 2 | BRF_GRA }, // 6 + + { "6331-1.6", 0x0020, 0xce1d9503, 3 | BRF_GRA }, // 7 Color Proms + { "6301-1.37", 0x0100, 0x4b803d9f, 3 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(vanvank) +STD_ROM_FN(vanvank) + +struct BurnDriver BurnDrvvanvank = { + "vanvank", "vanvan", NULL, NULL, "1983", + "Van-Van Car (Karateco)\0", NULL, "Karateco", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, vanvankRomInfo, vanvankRomName, NULL, NULL, vanvankInputInfo, vanvanDIPInfo, + vanvanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Van-Van Car (set 3) + +static struct BurnRomInfo vanvanbRomDesc[] = { + { "vv1.bin", 0x1000, 0xcf1b2df0, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "vv2.bin", 0x1000, 0x80eca6a5, 1 | BRF_ESS | BRF_PRG }, // 1 + { "vv3.bin", 0x1000, 0x15571e24, 1 | BRF_ESS | BRF_PRG }, // 2 + { "vv4.bin", 0x1000, 0xb1f04006, 1 | BRF_ESS | BRF_PRG }, // 3 + { "vv5.bin", 0x1000, 0xdb67414c, 1 | BRF_ESS | BRF_PRG }, // 4 + + { "vv20.bin", 0x1000, 0xeb56cb51, 2 | BRF_GRA }, // 5 Graphics + { "vv21.bin", 0x1000, 0x5dd53723, 2 | BRF_GRA }, // 6 + + { "6331-1.6", 0x0020, 0xce1d9503, 3 | BRF_GRA }, // 7 Color Proms + { "6301-1.37", 0x0100, 0x4b803d9f, 3 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(vanvanb) +STD_ROM_FN(vanvanb) + +struct BurnDriver BurnDrvvanvanb = { + "vanvanb", "vanvan", NULL, NULL, "1983", + "Van-Van Car (set 3)\0", NULL, "Karateco", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, vanvanbRomInfo, vanvanbRomName, NULL, NULL, vanvankInputInfo, vanvanDIPInfo, + vanvanInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Naughty Mouse (set 1) + +static struct BurnRomInfo nmouseRomDesc[] = { + { "naumouse.d7", 0x0800, 0xe447ecfa, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "naumouse.d6", 0x0800, 0x2e6f13d9, 1 | BRF_ESS | BRF_PRG }, // 1 + { "naumouse.e7", 0x0800, 0x44a80f97, 1 | BRF_ESS | BRF_PRG }, // 2 + { "naumouse.e6", 0x0800, 0x9c7a46bd, 1 | BRF_ESS | BRF_PRG }, // 3 + { "naumouse.h7", 0x0800, 0x5bc94c5d, 1 | BRF_ESS | BRF_PRG }, // 4 + { "naumouse.h6", 0x0800, 0x1af29e22, 1 | BRF_ESS | BRF_PRG }, // 5 + { "naumouse.j7", 0x0800, 0xcc3be185, 1 | BRF_ESS | BRF_PRG }, // 6 + { "naumouse.j6", 0x0800, 0x66b3e5dc, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "naumouse.d5", 0x0800, 0x2ea7cc3f, 2 | BRF_GRA }, // 8 Graphics + { "naumouse.h5", 0x0800, 0x0511fcea, 2 | BRF_GRA }, // 9 + { "naumouse.e5", 0x0800, 0xf5a627cd, 2 | BRF_GRA }, // 10 + { "naumouse.j5", 0x0800, 0x65f2580e, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "naumouse.a4", 0x0100, 0xd8772167, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(nmouse) +STD_ROM_FN(nmouse) + +static INT32 nmouseInit() +{ + return DrvInit(StandardMap, eyes_decode, NMOUSE); +} + +struct BurnDriver BurnDrvnmouse = { + "nmouse", NULL, NULL, NULL, "1981", + "Naughty Mouse (set 1)\0", NULL, "Amenip (Palcom Queen River)", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, + NULL, nmouseRomInfo, nmouseRomName, NULL, NULL, DrvInputInfo, nmouseDIPInfo, + nmouseInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Naughty Mouse (set 2) + +static struct BurnRomInfo nmousebRomDesc[] = { + { "naumouse.d7", 0x0800, 0xe447ecfa, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "naumouse.d6", 0x0800, 0x2e6f13d9, 1 | BRF_ESS | BRF_PRG }, // 1 + { "naumouse.e7", 0x0800, 0x44a80f97, 1 | BRF_ESS | BRF_PRG }, // 2 + { "naumouse.e6", 0x0800, 0x9c7a46bd, 1 | BRF_ESS | BRF_PRG }, // 3 + { "snatch2.bin", 0x0800, 0x405aa389, 1 | BRF_ESS | BRF_PRG }, // 4 + { "snatch6.bin", 0x0800, 0xf58e7df4, 1 | BRF_ESS | BRF_PRG }, // 5 + { "snatch3.bin", 0x0800, 0x06fb18ec, 1 | BRF_ESS | BRF_PRG }, // 6 + { "snatch7.bin", 0x0800, 0xd187b82b, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "naumouse.d5", 0x0800, 0x2ea7cc3f, 2 | BRF_GRA }, // 8 Graphics + { "naumouse.h5", 0x0800, 0x0511fcea, 2 | BRF_GRA }, // 9 + { "naumouse.e5", 0x0800, 0xf5a627cd, 2 | BRF_GRA }, // 10 + { "snatch11.bin", 0x0800, 0x330230a5, 2 | BRF_GRA }, // 11 + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 12 Color Proms + { "naumouse.a4", 0x0100, 0xd8772167, 3 | BRF_GRA }, // 13 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 14 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 15 Timing Prom (not used) +}; + +STD_ROM_PICK(nmouseb) +STD_ROM_FN(nmouseb) + +struct BurnDriver BurnDrvnmouseb = { + "nmouseb", "nmouse", NULL, NULL, "1981", + "Naughty Mouse (set 2)\0", NULL, "Amenip Nova Games Ltd.", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_PLATFORM, 0, + NULL, nmousebRomInfo, nmousebRomName, NULL, NULL, DrvInputInfo, nmouseDIPInfo, + nmouseInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Dream Shopper + +static struct BurnRomInfo dremshprRomDesc[] = { + { "red_1.50", 0x1000, 0x830c6361, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "red_2.51", 0x1000, 0xd22551cc, 1 | BRF_ESS | BRF_PRG }, // 1 + { "red_3.52", 0x1000, 0x0713a34a, 1 | BRF_ESS | BRF_PRG }, // 2 + { "red_4.53", 0x1000, 0xf38bcaaa, 1 | BRF_ESS | BRF_PRG }, // 3 + { "red_5.39", 0x1000, 0x6a382267, 1 | BRF_ESS | BRF_PRG }, // 4 + { "red_6.40", 0x1000, 0x4cf8b121, 1 | BRF_ESS | BRF_PRG }, // 5 + { "red_7.41", 0x1000, 0xbd4fc4ba, 1 | BRF_ESS | BRF_PRG }, // 6 + + { "red-20.18", 0x1000, 0x2d6698dc, 2 | BRF_GRA }, // 7 Graphics + { "red-21.19", 0x1000, 0x38c9ce9b, 2 | BRF_GRA }, // 8 + + { "6331-1.6", 0x0020, 0xce1d9503, 3 | BRF_GRA }, // 9 Color Proms + { "6301-1.37", 0x0100, 0x39d6fb5c, 3 | BRF_GRA }, // 10 + + // Uses AY8910 +}; + +STD_ROM_PICK(dremshpr) +STD_ROM_FN(dremshpr) + +static INT32 dremshprInit() +{ + return DrvInit(DremshprMap, NULL, DREMSHPR); +} + +struct BurnDriver BurnDrvdremshpr = { + "dremshpr", NULL, NULL, NULL, "1982", + "Dream Shopper\0", NULL, "Sanritsu", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_PUZZLE, 0, + NULL, dremshprRomInfo, dremshprRomName, NULL, NULL, dremshprInputInfo, dremshprDIPInfo, + dremshprInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Boardwalk Casino + +static struct BurnRomInfo bwcasinoRomDesc[] = { + { "bwc_u2.bin", 0x2000, 0xe2eea868, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "bwc_u3.bin", 0x2000, 0xa935571e, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "bwc_5e.bin", 0x1000, 0xe334c01e, 2 | BRF_GRA }, // 2 Graphics + + { "aca_7f.bin", 0x0020, 0x133bb744, 3 | BRF_GRA }, // 3 Color Proms + { "aca_4a.bin", 0x0100, 0x8e29208f, 3 | BRF_GRA }, // 4 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 5 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 6 Timing Prom (not used) +}; + +STD_ROM_PICK(bwcasino) +STD_ROM_FN(bwcasino) + +static void acitya_decode() +{ + for (INT32 i = 0; i < 0x4000; i++) { + DrvZ80ROM[i + 0x10000] = BITSWAP08(DrvZ80ROM[i] ^ 0xb5, 1, 6, 7, 3, 4, 0, 2, 5); + DrvZ80ROM[i + 0x14000] = BITSWAP08(DrvZ80ROM[i] ^ 0xa7, 7, 6, 1, 3, 4, 0, 2, 5); + DrvZ80ROM[i + 0x18000] = BITSWAP08(DrvZ80ROM[i] ^ 0xfc, 1, 0, 7, 6, 4, 3, 2, 5); + DrvZ80ROM[i + 0x1c000] = BITSWAP08(DrvZ80ROM[i] ^ 0xee, 7, 0, 1, 6, 4, 3, 2, 5); + } +} + +static INT32 acityaInit() +{ + acitya = 1; + + return DrvInit(StandardMap, acitya_decode, EPOS); +} + +struct BurnDriver BurnDrvbwcasino = { + "bwcasino", NULL, NULL, NULL, "1983", + "Boardwalk Casino\0", NULL, "EPOS Corporation", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_CASINO, 0, + NULL, bwcasinoRomInfo, bwcasinoRomName, NULL, NULL, bwcasinoInputInfo, bwcasinoDIPInfo, + acityaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Atlantic City Action + +static struct BurnRomInfo acityaRomDesc[] = { + { "aca_u2.bin", 0x2000, 0x261c2fdc, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "aca_u3.bin", 0x2000, 0x05fab4ca, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "aca_5e.bin", 0x1000, 0x7f2dd2c9, 2 | BRF_GRA }, // 2 Graphics + + { "aca_7f.bin", 0x0020, 0x133bb744, 3 | BRF_GRA }, // 3 Color Proms + { "aca_4a.bin", 0x0100, 0x8e29208f, 3 | BRF_GRA }, // 4 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 5 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 6 Timing Prom (not used) +}; + +STD_ROM_PICK(acitya) +STD_ROM_FN(acitya) + +struct BurnDriver BurnDrvacitya = { + "acitya", "bwcasino", NULL, NULL, "1983", + "Atlantic City Action\0", NULL, "EPOS Corporation", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_CASINO, 0, + NULL, acityaRomInfo, acityaRomName, NULL, NULL, acityaInputInfo, acityaDIPInfo, + acityaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Big Bucks + +static struct BurnRomInfo bigbucksRomDesc[] = { + { "p.rom", 0x4000, 0xeea6c1c9, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "m.rom", 0x2000, 0xbb8f7363, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "5e.cpu", 0x1000, 0x18442c37, 2 | BRF_GRA }, // 2 Graphics + + { "82s123.7f", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 3 Color Proms + { "82s126.4a", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 4 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 5 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 6 Timing Prom + + { "rom1.rom", 0x8000, 0x90b7785f, 7 | BRF_PRG | BRF_ESS }, // 7 Question Roms + { "rom2.rom", 0x8000, 0x60172d77, 7 | BRF_PRG | BRF_ESS }, // 8 + { "rom3.rom", 0x8000, 0xa2207320, 7 | BRF_PRG | BRF_ESS }, // 9 + { "rom4.rom", 0x8000, 0x5a74c1f9, 7 | BRF_PRG | BRF_ESS }, // 10 + { "rom5.rom", 0x8000, 0x93bc1080, 7 | BRF_PRG | BRF_ESS }, // 11 + { "rom6.rom", 0x8000, 0xeea2423f, 7 | BRF_PRG | BRF_ESS }, // 12 + { "rom7.rom", 0x8000, 0x96694055, 7 | BRF_PRG | BRF_ESS }, // 13 + { "rom8.rom", 0x8000, 0xe68ebf8e, 7 | BRF_PRG | BRF_ESS }, // 14 + { "rom9.rom", 0x8000, 0xfd20921d, 7 | BRF_PRG | BRF_ESS }, // 15 + { "rom10.rom", 0x8000, 0x5091b951, 7 | BRF_PRG | BRF_ESS }, // 16 + { "rom11.rom", 0x8000, 0x705128db, 7 | BRF_PRG | BRF_ESS }, // 17 + { "rom12.rom", 0x8000, 0x74c776e7, 7 | BRF_PRG | BRF_ESS }, // 18 +}; + +STD_ROM_PICK(bigbucks) +STD_ROM_FN(bigbucks) + +static INT32 bigbucksInit() +{ + return DrvInit(BigbucksMap, NULL, BIGBUCKS); +} + +struct BurnDriver BurnDrvbigbucks = { + "bigbucks", NULL, NULL, NULL, "1986", + "Big Bucks\0", NULL, "Dynasoft Inc.", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_QUIZ, 0, + NULL, bigbucksRomInfo, bigbucksRomName, NULL, NULL, bigbucksInputInfo, bigbucksDIPInfo, + bigbucksInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// MTV Rock-N-Roll Trivia (Part 2) + +static struct BurnRomInfo rocktrv2RomDesc[] = { + { "1.aux", 0x4000, 0xd182947b, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "2.aux", 0x2000, 0x27a7461d, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "5e.cpu", 0x1000, 0x0a6cc43b, 2 | BRF_GRA }, // 2 Graphics + + { "7f.cpu", 0x0020, 0x7549a947, 3 | BRF_GRA }, // 3 Color Proms + { "4a.cpu", 0x0100, 0xddd5d88e, 3 | BRF_GRA }, // 4 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 5 Sound Prom + { "82s126.3m" , 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 6 Timing Prom (not used) + + { "3.aux", 0x4000, 0x5b117ca6, 7 | BRF_PRG | BRF_ESS }, // 7 Question Roms + { "4.aux", 0x4000, 0x81bfd4c3, 7 | BRF_PRG | BRF_ESS }, // 8 + { "5.aux", 0x4000, 0xe976423c, 7 | BRF_PRG | BRF_ESS }, // 9 + { "6.aux", 0x4000, 0x425946bf, 7 | BRF_PRG | BRF_ESS }, // 10 + { "7.aux", 0x4000, 0x7056fc8f, 7 | BRF_PRG | BRF_ESS }, // 11 + { "8.aux", 0x4000, 0x8b86464f, 7 | BRF_PRG | BRF_ESS }, // 12 + { "9.aux", 0x4000, 0x17d8eba4, 7 | BRF_PRG | BRF_ESS }, // 13 + { "10.aux", 0x4000, 0x398c8eb4, 7 | BRF_PRG | BRF_ESS }, // 14 + { "11.aux", 0x4000, 0x7f376424, 7 | BRF_PRG | BRF_ESS }, // 15 + { "12.aux", 0x4000, 0x8d5bbf81, 7 | BRF_PRG | BRF_ESS }, // 16 + { "13.aux", 0x4000, 0x99fe2c21, 7 | BRF_PRG | BRF_ESS }, // 17 + { "14.aux", 0x4000, 0xdf4cf5e7, 7 | BRF_PRG | BRF_ESS }, // 18 + { "15.aux", 0x4000, 0x2a32de26, 7 | BRF_PRG | BRF_ESS }, // 19 + { "16.aux", 0x4000, 0xfcd42187, 7 | BRF_PRG | BRF_ESS }, // 20 + { "17.aux", 0x4000, 0x24d5c388, 7 | BRF_PRG | BRF_ESS }, // 21 + { "18.aux", 0x4000, 0xfeb195fd, 7 | BRF_PRG | BRF_ESS }, // 22 +}; + +STD_ROM_PICK(rocktrv2) +STD_ROM_FN(rocktrv2) + +static void rocktrv2Callback() +{ + DrvZ80ROM[0x9ffe] = 0xa7; + DrvZ80ROM[0x9fee] = 0x6d; +} + +static INT32 rocktrv2Init() +{ + return DrvInit(Rocktrv2Map, rocktrv2Callback, ROCKTRV2); +} + +struct BurnDriver BurnDrvrocktrv2 = { + "rocktrv2", NULL, NULL, NULL, "1986", + "MTV Rock-N-Roll Trivia (Part 2)\0", NULL, "Triumph Software Inc.", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_QUIZ, 0, + NULL, rocktrv2RomInfo, rocktrv2RomName, NULL, NULL, rocktrv2InputInfo, rocktrv2DIPInfo, + rocktrv2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Ali Baba and 40 Thieves + +static struct BurnRomInfo alibabaRomDesc[] = { + { "6e", 0x1000, 0x38d701aa, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "6f", 0x1000, 0x3d0e35f3, 1 | BRF_ESS | BRF_PRG }, // 1 + { "6h", 0x1000, 0x823bee89, 1 | BRF_ESS | BRF_PRG }, // 2 + { "6k", 0x1000, 0x474d032f, 1 | BRF_ESS | BRF_PRG }, // 3 + { "6l", 0x1000, 0x5ab315c1, 1 | BRF_ESS | BRF_PRG }, // 4 + { "6m", 0x0800, 0x438d0357, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "5e", 0x0800, 0x85bcb8f8, 2 | BRF_GRA }, // 6 Graphics + { "5h", 0x0800, 0x38e50862, 2 | BRF_GRA }, // 7 + { "5f", 0x0800, 0xb5715c86, 2 | BRF_GRA }, // 8 + { "5k", 0x0800, 0x713086b3, 2 | BRF_GRA }, // 9 + + { "82s123.e7", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 10 Color Proms + { "82s129.a4", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 11 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 12 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom + + { "ab7.bin", 0x0800, 0x52294ef5, 0 | BRF_OPT }, // 14 Mystery Rom? (1st & 2nd halves identical) +}; + +STD_ROM_PICK(alibaba) +STD_ROM_FN(alibaba) + +static void alibabaCallback() +{ + memcpy (DrvZ80ROM + 0xa000, DrvZ80ROM + 0x9000, 0x0800); + memset (DrvZ80ROM + 0x9000, 0, 0x800); +} + +static INT32 alibabaInit() +{ + return DrvInit(AlibabaMap, alibabaCallback, ALIBABA); +} + +struct BurnDriver BurnDrvalibaba = { + "alibaba", NULL, NULL, NULL, "1982", + "Ali Baba and 40 Thieves\0", NULL, "Sega", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, alibabaRomInfo, alibabaRomName, NULL, NULL, alibabaInputInfo, alibabaDIPInfo, + alibabaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Mustafa and 40 Thieves (bootleg) + +static struct BurnRomInfo alibababRomDesc[] = { + { "6e", 0x1000, 0x38d701aa, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "6f", 0x1000, 0x3d0e35f3, 1 | BRF_ESS | BRF_PRG }, // 1 + { "6h", 0x1000, 0x823bee89, 1 | BRF_ESS | BRF_PRG }, // 2 + { "6k", 0x1000, 0x474d032f, 1 | BRF_ESS | BRF_PRG }, // 3 + { "ab5.bin", 0x1000, 0xae2f4aac, 1 | BRF_ESS | BRF_PRG }, // 4 + { "6m", 0x0800, 0x438d0357, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "5e", 0x0800, 0x85bcb8f8, 2 | BRF_GRA }, // 6 Graphics + { "5h", 0x0800, 0x38e50862, 2 | BRF_GRA }, // 7 + { "5f", 0x0800, 0xb5715c86, 2 | BRF_GRA }, // 8 + { "5k", 0x0800, 0x713086b3, 2 | BRF_GRA }, // 9 + + { "82s123.e7", 0x0020, 0x2fc650bd, 3 | BRF_GRA }, // 10 Color Proms + { "82s129.a4", 0x0100, 0x3eb3a8e4, 3 | BRF_GRA }, // 11 + + { "82s126.1m", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 12 Sound Prom + { "82s126.3m", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom + + { "ab7.bin", 0x0800, 0x52294ef5, 0 | BRF_OPT }, // 14 Mystery Rom? (1st & 2nd halves identical) +}; + +STD_ROM_PICK(alibabab) +STD_ROM_FN(alibabab) + +struct BurnDriver BurnDrvalibabab = { + "alibabab", "alibaba", NULL, NULL, "1982", + "Mustafa and 40 Thieves (bootleg)\0", NULL, "bootleg", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, alibababRomInfo, alibababRomName, NULL, NULL, alibabaInputInfo, alibabaDIPInfo, + alibabaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Birdiy + +static struct BurnRomInfo birdiyRomDesc[] = { + { "a6.6a", 0x1000, 0x3a58f8ad, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "c6.6c", 0x1000, 0xfec61ea2, 1 | BRF_ESS | BRF_PRG }, // 1 + { "a4.4a", 0x1000, 0x3392783b, 1 | BRF_ESS | BRF_PRG }, // 2 + { "c4.4c", 0x1000, 0x2391d83d, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "c1.1c", 0x1000, 0x8f6bf54f, 2 | BRF_GRA }, // 4 Graphics + { "c3.3c", 0x1000, 0x10b55440, 2 | BRF_GRA }, // 5 + + { "n82s123n.10n", 0x0020, 0xff344446, 3 | BRF_GRA }, // 6 Color Proms + { "n82s129n.9m", 0x0100, 0x63efb927, 3 | BRF_GRA }, // 7 + + { "n82s129n.4k", 0x0100, 0xa9cc86bf, 4 | BRF_SND }, // 8 Sound Prom + { "n82s129n.6l", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 9 Timing Prom (not used) +}; + +STD_ROM_PICK(birdiy) +STD_ROM_FN(birdiy) + +static INT32 birdiyInit() +{ + return DrvInit(StandardMap, NULL, BIRDIY); +} + +struct BurnDriver BurnDrvbirdiy = { + "birdiy", NULL, NULL, NULL, "1982", + "Birdiy\0", NULL, "Mama Top", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, birdiyRomInfo, birdiyRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + birdiyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pengo (set 1 rev c) + +static struct BurnRomInfo pengoRomDesc[] = { + { "ep1689c.8", 0x1000, 0xf37066a8, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ep1690b.7", 0x1000, 0xbaf48143, 1 | BRF_ESS | BRF_PRG }, // 1 + { "ep1691b.15", 0x1000, 0xadf0eba0, 1 | BRF_ESS | BRF_PRG }, // 2 + { "ep1692b.14", 0x1000, 0xa086d60f, 1 | BRF_ESS | BRF_PRG }, // 3 + { "ep1693b.21", 0x1000, 0xb72084ec, 1 | BRF_ESS | BRF_PRG }, // 4 + { "ep1694b.20", 0x1000, 0x94194a89, 1 | BRF_ESS | BRF_PRG }, // 5 + { "ep5118b.32", 0x1000, 0xaf7b12c4, 1 | BRF_ESS | BRF_PRG }, // 6 + { "ep5119c.31", 0x1000, 0x933950fe, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "ep1640.92", 0x2000, 0xd7eec6cd, 2 | BRF_GRA }, // 8 Graphics + { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 9 + + { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 10 Color Proms + { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 11 + + { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 12 Sound Prom + { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom +}; + +STD_ROM_PICK(pengo) +STD_ROM_FN(pengo) + +static void PengoDecode() +{ + static const UINT8 convtable[32][4] = + { + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x80,0xa8,0x88 }, + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, + { 0x08,0x28,0x88,0xa8 }, { 0xa0,0x80,0xa8,0x88 }, + { 0x08,0x00,0x88,0x80 }, { 0x28,0xa8,0x08,0x88 }, + { 0xa0,0x80,0x20,0x00 }, { 0x08,0x00,0x88,0x80 }, + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, + { 0xa0,0x80,0x20,0x00 }, { 0x00,0x08,0x20,0x28 }, + { 0x88,0x80,0x08,0x00 }, { 0xa0,0x80,0x20,0x00 }, + { 0x88,0x80,0x08,0x00 }, { 0x00,0x08,0x20,0x28 }, + { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, + { 0x08,0x00,0x88,0x80 }, { 0x88,0x80,0x08,0x00 }, + { 0x00,0x08,0x20,0x28 }, { 0x88,0x80,0x08,0x00 }, + { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, + { 0x08,0x00,0x88,0x80 }, { 0xa0,0x80,0x20,0x00 } + }; + + UINT8 *decrypted = DrvZ80ROM + 0x8000; + + for (INT32 A = 0x0000;A < 0x8000;A++) + { + INT32 xorval = 0; + UINT8 src = DrvZ80ROM[A]; + + INT32 row = (A & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2) + (((A >> 12) & 1) << 3); + + INT32 col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1); + + if (src & 0x80) + { + col = 3 - col; + xorval = 0xa8; + } + + decrypted[A] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval); + DrvZ80ROM[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval); + + if (convtable[2*row][col] == 0xff) decrypted[A] = 0xee; + if (convtable[2*row+1][col] == 0xff) DrvZ80ROM[A] = 0xee; + } +} + +static void PengoGraphicsReorder() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x2000); + + memcpy (tmp + 0x0000, DrvGfxROM + 0x2000, 0x1000); + memcpy (tmp + 0x1000, DrvGfxROM + 0x1000, 0x1000); + memcpy (DrvGfxROM + 0x1000, tmp + 0x0000, 0x2000); + + BurnFree (tmp); +} + +static void PengoCallback() +{ + PengoDecode(); + + PengoGraphicsReorder(); +} + +static INT32 pengoInit() +{ + return DrvInit(PengoMap, PengoCallback, PENGO); +} + +struct BurnDriver BurnDrvpengo = { + "pengo", NULL, NULL, NULL, "1982", + "Pengo (set 1 rev c)\0", NULL, "Sega", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pengoRomInfo, pengoRomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, + pengoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pengo (set 2) + +static struct BurnRomInfo pengo2RomDesc[] = { + { "ic8.2", 0x1000, 0xe4924b7b, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ic7.2", 0x1000, 0x72e7775d, 1 | BRF_ESS | BRF_PRG }, // 1 + { "ic15.2", 0x1000, 0x7410ef1e, 1 | BRF_ESS | BRF_PRG }, // 2 + { "ic14.2", 0x1000, 0x55b3f379, 1 | BRF_ESS | BRF_PRG }, // 3 + { "ep1693b.21", 0x1000, 0xb72084ec, 1 | BRF_ESS | BRF_PRG }, // 4 + { "ic20.2", 0x1000, 0x770570cf, 1 | BRF_ESS | BRF_PRG }, // 5 + { "ep5118b.32", 0x1000, 0xaf7b12c4, 1 | BRF_ESS | BRF_PRG }, // 6 + { "ic31.2", 0x1000, 0x669555c1, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "ep1640.92", 0x2000, 0xd7eec6cd, 2 | BRF_GRA }, // 8 Graphics + { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 9 + + { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 10 Color Proms + { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 11 + + { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 12 Sound Prom + { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom +}; + +STD_ROM_PICK(pengo2) +STD_ROM_FN(pengo2) + +struct BurnDriver BurnDrvpengo2 = { + "pengo2", "pengo", NULL, NULL, "1982", + "Pengo (set 2)\0", NULL, "Sega", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pengo2RomInfo, pengo2RomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, + pengoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pengo (set 2 not encrypted) + +static struct BurnRomInfo pengo2uRomDesc[] = { + { "epr5128.u8", 0x1000, 0x3dfeb20e, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "epr5129.u7", 0x1000, 0x1db341bd, 1 | BRF_ESS | BRF_PRG }, // 1 + { "epr5130.u15", 0x1000, 0x7c2842d5, 1 | BRF_ESS | BRF_PRG }, // 2 + { "epr5131.u14", 0x1000, 0x6e3c1f2f, 1 | BRF_ESS | BRF_PRG }, // 3 + { "ep5124.21", 0x1000, 0x95f354ff, 1 | BRF_ESS | BRF_PRG }, // 4 + { "epr5133.u20", 0x1000, 0x0fdb04b8, 1 | BRF_ESS | BRF_PRG }, // 5 + { "ep5126.32", 0x1000, 0xe5920728, 1 | BRF_ESS | BRF_PRG }, // 6 + { "epr5135.u31", 0x1000, 0x13de47ed, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "ep1640.92", 0x2000, 0xd7eec6cd, 2 | BRF_GRA }, // 8 Graphics + { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 9 + + { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 10 Color Proms + { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 11 + + { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 12 Sound Prom + { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom +}; + +STD_ROM_PICK(pengo2u) +STD_ROM_FN(pengo2u) + +static void PengouCallback() +{ + memcpy (DrvZ80ROM + 0x8000, DrvZ80ROM, 0x8000); + + PengoGraphicsReorder(); +} + +static INT32 pengouInit() +{ + return DrvInit(PengoMap, PengouCallback, PENGO); +} + +struct BurnDriver BurnDrvpengo2u = { + "pengo2u", "pengo", NULL, NULL, "1982", + "Pengo (set 2 not encrypted)\0", NULL, "Sega", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pengo2uRomInfo, pengo2uRomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, + pengouInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pengo (set 3 not encrypted) + +static struct BurnRomInfo pengo3uRomDesc[] = { + { "ep5120.8", 0x1000, 0xf01afb60, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ep5121.7", 0x1000, 0x2eb38353, 1 | BRF_ESS | BRF_PRG }, // 1 + { "ep5122.15", 0x1000, 0xc33400d7, 1 | BRF_ESS | BRF_PRG }, // 2 + { "ep5123.14", 0x1000, 0x6a85c6a2, 1 | BRF_ESS | BRF_PRG }, // 3 + { "ep5124.21", 0x1000, 0x95f354ff, 1 | BRF_ESS | BRF_PRG }, // 4 + { "ep5125.20", 0x1000, 0x1a42310f, 1 | BRF_ESS | BRF_PRG }, // 5 + { "ep5126.32", 0x1000, 0xe5920728, 1 | BRF_ESS | BRF_PRG }, // 6 + { "ep5127.31", 0x1000, 0xa7d3d1d6, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "ep1640.92", 0x2000, 0xd7eec6cd, 2 | BRF_GRA }, // 8 Graphics + { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 9 + + { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 10 Color Proms + { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 11 + + { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 12 Sound Prom + { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom +}; + +STD_ROM_PICK(pengo3u) +STD_ROM_FN(pengo3u) + +struct BurnDriver BurnDrvpengo3u = { + "pengo3u", "pengo", NULL, NULL, "1982", + "Pengo (set 3 not encrypted)\0", NULL, "Sega", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pengo3uRomInfo, pengo3uRomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, + pengouInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pengo (set 4) + +static struct BurnRomInfo pengo4RomDesc[] = { + { "ep1738.8", 0x1000, 0x68ba25ea, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ep1739.7", 0x1000, 0x41e7b5b3, 1 | BRF_ESS | BRF_PRG }, // 1 + { "ep1740.15", 0x1000, 0x27f05f59, 1 | BRF_ESS | BRF_PRG }, // 2 + { "ep1741.14", 0x1000, 0x27d93ec1, 1 | BRF_ESS | BRF_PRG }, // 3 + { "ep1742.21", 0x1000, 0xb72084ec, 1 | BRF_ESS | BRF_PRG }, // 4 + { "ep1743.20", 0x1000, 0x770570cf, 1 | BRF_ESS | BRF_PRG }, // 5 + { "ep1744.32", 0x1000, 0xaf7b12c4, 1 | BRF_ESS | BRF_PRG }, // 6 + { "ep1745.31", 0x1000, 0x507e18b9, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "ep1640.92", 0x2000, 0xd7eec6cd, 2 | BRF_GRA }, // 8 Graphics + { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 9 + + { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 10 Color Proms + { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 11 + + { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 12 Sound Prom + { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 13 Timing Prom +}; + +STD_ROM_PICK(pengo4) +STD_ROM_FN(pengo4) + +struct BurnDriver BurnDrvpengo4 = { + "pengo4", "pengo", NULL, NULL, "1982", + "Pengo (set 4)\0", NULL, "Sega", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pengo4RomInfo, pengo4RomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, + pengoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Pengo (bootleg) + +static struct BurnRomInfo pengobRomDesc[] = { + { "1", 0x2000, 0xe04064db, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "2", 0x2000, 0x75752424, 1 | BRF_ESS | BRF_PRG }, // 1 + { "021_pn03.bin", 0x1000, 0x7824e3ef, 1 | BRF_ESS | BRF_PRG }, // 2 + { "020_pn07.bin", 0x1000, 0x377b9663, 1 | BRF_ESS | BRF_PRG }, // 3 + { "032_pn04.bin", 0x1000, 0xbfde44c1, 1 | BRF_ESS | BRF_PRG }, // 4 + { "031_pn08.bin", 0x1000, 0x64e8c30d, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "5", 0x2000, 0x1232437b, 2 | BRF_GRA }, // 6 Graphics + { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 7 + + { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 8 Color Proms + { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 9 + + { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 10 Sound Prom + { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom +}; + +STD_ROM_PICK(pengob) +STD_ROM_FN(pengob) + +static void PentaDecode() +{ + static const UINT8 data_xortable[2][8] = + { + { 0xa0,0x82,0x28,0x0a,0x82,0xa0,0x0a,0x28 }, + { 0x88,0x0a,0x82,0x00,0x88,0x0a,0x82,0x00 } + }; + + static const UINT8 opcode_xortable[8][8] = + { + { 0x02,0x08,0x2a,0x20,0x20,0x2a,0x08,0x02 }, + { 0x88,0x88,0x00,0x00,0x88,0x88,0x00,0x00 }, + { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 }, + { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 }, + { 0x2a,0x08,0x2a,0x08,0x8a,0xa8,0x8a,0xa8 }, + { 0x2a,0x08,0x2a,0x08,0x8a,0xa8,0x8a,0xa8 }, + { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 }, + { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 } + }; + + UINT8 *decrypt = DrvZ80ROM + 0x8000; + + for (INT32 A = 0; A < 0x8000; A++) + { + UINT8 src = DrvZ80ROM[A]; + + INT32 i = A & 1; + + INT32 j = ((src >> 1) & 1) + (((src >> 3) & 1) << 1) + (((src >> 5) & 1) << 2); + + if (src & 0x80) j = 7 - j; + + DrvZ80ROM[A] = src ^ data_xortable[i][j]; + + i = ((A >> 4) & 1) + (((A >> 8) & 1) << 1) + (((A >> 12) & 1) << 2); + + decrypt[A] = src ^ opcode_xortable[i][j]; + } +} + +static void PengobCallback() +{ + PentaDecode(); + + PengoGraphicsReorder(); +} + +static INT32 pengobInit() +{ + return DrvInit(PengoMap, PengobCallback, PENGO); +} + +struct BurnDriver BurnDrvpengob = { + "pengob", "pengo", NULL, NULL, "1982", + "Pengo (bootleg)\0", NULL, "Bootleg", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pengobRomInfo, pengobRomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, + pengobInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + +// Penta + +static struct BurnRomInfo pentaRomDesc[] = { + { "008_pn01.bin", 0x1000, 0x22f328df, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "007_pn05.bin", 0x1000, 0x15bbc7d3, 1 | BRF_ESS | BRF_PRG }, // 1 + { "015_pn02.bin", 0x1000, 0xde82b74a, 1 | BRF_ESS | BRF_PRG }, // 2 + { "014_pn06.bin", 0x1000, 0x160f3836, 1 | BRF_ESS | BRF_PRG }, // 3 + { "021_pn03.bin", 0x1000, 0x7824e3ef, 1 | BRF_ESS | BRF_PRG }, // 4 + { "020_pn07.bin", 0x1000, 0x377b9663, 1 | BRF_ESS | BRF_PRG }, // 5 + { "032_pn04.bin", 0x1000, 0xbfde44c1, 1 | BRF_ESS | BRF_PRG }, // 6 + { "031_pn08.bin", 0x1000, 0x64e8c30d, 1 | BRF_ESS | BRF_PRG }, // 7 + + { "092_pn09.bin", 0x2000, 0x6afeba9d, 2 | BRF_GRA }, // 6 Graphics + { "ep1695.105", 0x2000, 0x5bfd26e9, 2 | BRF_GRA }, // 7 + + { "pr1633.78", 0x0020, 0x3a5844ec, 3 | BRF_GRA }, // 8 Color Proms + { "pr1634.88", 0x0400, 0x766b139b, 3 | BRF_GRA }, // 9 + + { "pr1635.51", 0x0100, 0xc29dea27, 4 | BRF_SND }, // 10 Sound Prom + { "pr1636.70", 0x0100, 0x77245b66, 0 | BRF_SND | BRF_OPT }, // 11 Timing Prom +}; + +STD_ROM_PICK(penta) +STD_ROM_FN(penta) + +struct BurnDriver BurnDrvpenta = { + "penta", "pengo", NULL, NULL, "1982", + "Penta\0", NULL, "Bootleg", "Pac-man", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PACMAN, GBF_MAZE, 0, + NULL, pentaRomInfo, pentaRomName, NULL, NULL, PengoInputInfo, PengoDIPInfo, + pengobInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 288, 3, 4 +}; + + diff --git a/src/burn/drv/pre90s/d_pkunwar.cpp b/src/burn/drv/pre90s/d_pkunwar.cpp index 0e0dd7741..a61261b1c 100644 --- a/src/burn/drv/pre90s/d_pkunwar.cpp +++ b/src/burn/drv/pre90s/d_pkunwar.cpp @@ -1,609 +1,608 @@ -// FB Alpha Penguin-Kun Wars Driver Module -// Based on MAME Driver by David Haywood and Phil Stroffolino - -#include "tiles_generic.h" -#include "z80_intf.h" - -#include "driver.h" -extern "C" { - #include "ay8910.h" -} - - -static UINT8 DrvJoy1[8], DrvJoy2[8], DrvDips, DrvReset; -static INT16 *pAY8910Buffer[6], *pFMBuffer = NULL; -static UINT8 *Mem, *Rom, *Gfx0, *Gfx1; -static INT32 *Palette; - -static INT32 flipscreen, vblank; - - -//------------------------------------------------------------------------------------------------- -// Input Handlers - - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy2 + 7, "p1 coin" }, - {"P1 start" , BIT_DIGITAL , DrvJoy1 + 5, "p1 start" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 2, "p1 fire 1"}, - - {"P2 start" , BIT_DIGITAL , DrvJoy2 + 5, "p2 start" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 2, "p2 fire 1"}, - - {"Service Mode", BIT_DIGITAL, DrvJoy2 + 6, "diag" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, &DrvDips , "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0b, 0x01, 0x03, 0x00, "3C 1C" }, - {0x0b, 0x01, 0x03, 0x02, "2C 1C" }, - {0x0b, 0x01, 0x03, 0x03, "1C 1C" }, - {0x0b, 0x01, 0x03, 0x01, "1C 2C" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x04, 0x00, "Upright" }, - {0x0b, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0b, 0x01, 0x30, 0x10, "Easy" }, - {0x0b, 0x01, 0x30, 0x30, "Medium" }, - {0x0b, 0x01, 0x30, 0x20, "Hard" }, - {0x0b, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Flip screen" }, - {0x0b, 0x01, 0x40, 0x40, "Off" }, - {0x0b, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x0b, 0x01, 0x80, 0x80, "Off" }, - {0x0b, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Drv) - - -//------------------------------------------------------------------------------------------------- -// Memory Handlers - - -UINT8 __fastcall pkunwar_read(UINT16 address) -{ - switch (address) - { - case 0xa001: - return AY8910Read(0); - break; - - case 0xa003: - return AY8910Read(1); - break; - } - - return 0; -} - -void __fastcall pkunwar_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xa000: - AY8910Write(0, 0, data); - break; - - case 0xa001: - AY8910Write(0, 1, data); - break; - - case 0xa002: - AY8910Write(1, 0, data); - break; - - case 0xa003: - AY8910Write(1, 1, data); - break; - } -} - -void __fastcall pkunwar_out(UINT16 address, UINT8 data) -{ - address &= 0xff; - - if (address == 0) flipscreen = data & 1; -} - - -//------------------------------------------------------------------------------------------------- -// AY8910 Ports - - -static UINT8 pkunwar_port_0(UINT32) -{ - UINT8 ret = 0x7f | (vblank ^= 0x80); - - for (INT32 i = 0; i < 8; i++) { - ret ^= DrvJoy1[i] << i; - } - - return ret; -} - -static UINT8 pkunwar_port_1(UINT32) -{ - UINT8 ret = 0xff; - - for (INT32 i = 0; i < 8; i++) { - ret ^= DrvJoy2[i] << i; - } - - return ret; -} - -static UINT8 pkunwar_port_2(UINT32) -{ - return 0xff; -} - -static UINT8 pkunwar_port_3(UINT32) -{ - return DrvDips; -} - - -//------------------------------------------------------------------------------------------------- -// Initialization Routines - - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (Rom + 0x8000, 0, 0x1000); - memset (Rom + 0xc000, 0, 0x0800); - - flipscreen = 0; - - ZetOpen(0); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - AY8910Reset(1); - - return 0; -} - -static void pkunwar_palette_init(UINT8 *Prom) -{ - for (INT32 i = 0; i < 0x200; i++) - { - INT32 entry; - INT32 intensity,r,g,b; - - if ((i & 0xf) == 1) - { - entry = ((i & 0xf0) >> 4) | ((i & 0x100) >> 4); - } - else - { - entry = ((i & 0x0f) >> 0) | ((i & 0x100) >> 4); - } - - intensity = Prom[entry] & 0x03; - - r = (((Prom[entry] >> 0) & 0x0c) | intensity) * 0x11; - g = (((Prom[entry] >> 2) & 0x0c) | intensity) * 0x11; - b = (((Prom[entry] >> 4) & 0x0c) | intensity) * 0x11; - - Palette[i] = (r << 16) | (g << 8) | b; - } -} - -static void pkunwar_gfx_decode(UINT8 *Gfx) -{ - static INT32 PlaneOffsets[4] = { 0, 1, 2, 3 }; - - static INT32 XOffsets[16] = { - 0x00000, 0x00004, 0x40000, 0x40004, 0x00008, 0x0000c, 0x40008, 0x4000c, - 0x00080, 0x00084, 0x40080, 0x40084, 0x00088, 0x0008c, 0x40088, 0x4008c - }; - - static INT32 YOffsets[16] = { - 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, - 0x100, 0x110, 0x120, 0x130, 0x140, 0x150, 0x160, 0x170 - }; - - GfxDecode(0x800, 4, 8, 8, PlaneOffsets, XOffsets, YOffsets, 0x080, Gfx, Gfx0); - GfxDecode(0x200, 4, 16, 16, PlaneOffsets, XOffsets, YOffsets, 0x200, Gfx, Gfx1); -} - -static INT32 LoadRoms() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); - if (tmp == NULL) { - return 1; - } - - if (BurnLoadRom(Rom + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(Rom + 0x4000, 1, 1)) return 1; - if (BurnLoadRom(Rom + 0xe000, 2, 1)) return 1; - - if (BurnLoadRom(Gfx0 + 0x0000, 3, 1)) return 1; - if (BurnLoadRom(Gfx0 + 0x4000, 4, 1)) return 1; - if (BurnLoadRom(Gfx0 + 0x8000, 5, 1)) return 1; - if (BurnLoadRom(Gfx0 + 0xc000, 6, 1)) return 1; - - for (INT32 i = 0; i < 8; i++) { - INT32 j = ((i & 1) << 2) | ((i >> 1) & 3); - memcpy (tmp + j * 0x2000, Gfx0 + i * 0x2000, 0x2000); - } - - pkunwar_gfx_decode(tmp); - - if (BurnLoadRom(tmp + 0x0000, 7, 1)) return 1; - - pkunwar_palette_init(tmp); - - BurnFree(tmp); - - return 0; -} - -static INT32 DrvInit() -{ - Mem = (UINT8*)BurnMalloc(0x10000 + (0x20000 * 2) + (0x200 * sizeof(INT32))); - if (Mem == NULL) { - return 1; - } - - pFMBuffer = (INT16 *)BurnMalloc (nBurnSoundLen * 6 * sizeof(INT16)); - if (pFMBuffer == NULL) { - return 1; - } - - Rom = Mem + 0x00000; - Gfx0 = Mem + 0x10000; - Gfx1 = Mem + 0x30000; - Palette = (INT32*)(Mem + 0x40000); - - if (LoadRoms()) return 1; - - ZetInit(0); - ZetOpen(0); - ZetSetOutHandler(pkunwar_out); - ZetSetReadHandler(pkunwar_read); - ZetSetWriteHandler(pkunwar_write); - ZetMapArea(0x0000, 0x7fff, 0, Rom + 0x00000); - ZetMapArea(0x0000, 0x7fff, 2, Rom + 0x00000); - ZetMapArea(0x8000, 0x8fff, 0, Rom + 0x08000); - ZetMapArea(0x8000, 0x8fff, 1, Rom + 0x08000); - ZetMapArea(0xc000, 0xc7ff, 0, Rom + 0x0c000); - ZetMapArea(0xc000, 0xc7ff, 1, Rom + 0x0c000); - ZetMapArea(0xc000, 0xc7ff, 2, Rom + 0x0c000); - ZetMapArea(0xe000, 0xffff, 0, Rom + 0x0e000); - ZetMapArea(0xe000, 0xffff, 2, Rom + 0x0e000); - ZetMemEnd(); - ZetClose(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - - AY8910Init(0, 1500000, nBurnSoundRate, &pkunwar_port_0, &pkunwar_port_1, NULL, NULL); - AY8910Init(1, 1500000, nBurnSoundRate, &pkunwar_port_2, &pkunwar_port_3, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - AY8910Exit(0); - AY8910Exit(1); - - BurnFree (pFMBuffer); - BurnFree (Mem); - - Rom = Gfx0 = Gfx1 = Mem = NULL; - Palette = NULL; - - vblank = flipscreen = 0; - - return 0; -} - - -//------------------------------------------------------------------------------------------------- -// Drawing Routines - - -static INT32 DrawChars(INT32 priority) -{ - INT32 offs; - - for (offs = 0x3c0 - 1;offs >= 0x40;offs--) - { - if (Rom[0x8c00 + offs] & 0x08 || !priority) - { - INT32 sx,sy,num,color,pxl,pos; - - sx = (offs & 0x1f) << 3; - sy = (offs >> 2) & 0xf8; - - if (sy < 32 || sy > 223) continue; - sy -= 32; - - num = Rom[0x8800 + offs] | ((Rom[0x8c00 + offs] & 7) << 8); - color = 0x100 | (Rom[0x8c00 + offs] & 0xf0); - - UINT8 *src = Gfx0 + (num << 6); - - for (INT32 y = sy; y < sy + 8; y++) - { - for (INT32 x = sx; x < sx + 8; x++, src++) - { - if (!*src && priority) continue; - - pxl = Palette[color | *src]; - - if (flipscreen) - pos = ((191 - y) << 8) | (~x & 0xff); - else - pos = (y << 8) | (x & 0xff); - - PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } - } - } - - return 0; -} - -static INT32 DrvDraw() -{ - INT32 offs; - - DrawChars(0); - - for (offs = 0;offs < 0x800;offs += 32) - { - INT32 sx,sy,flipx,flipy,num,color,pxl,pos; - - sx = Rom[0x8001 + offs]; - sy = Rom[0x8002 + offs]; - - if (sy < 16 || sy > 223) continue; - sy -= 32; - - flipx = Rom[0x8000 + offs] & 0x01; - flipy = Rom[0x8000 + offs] & 0x02; - - num = ((Rom[0x8000 + offs] & 0xfc) >> 2) + ((Rom[0x8003 + offs] & 7) << 6); - color = Rom[0x8003 + offs] & 0xf0; - - UINT8 *src = Gfx1 + (num << 8); - - if (flipy) - { - for (INT32 y = sy + 15; y >= sy; y--) - { - if (flipx) - { - for (INT32 x = sx + 15; x >= sx; x--, src++) - { - if (y > 191 || y < 0 || !*src) continue; - - pxl = Palette[color | *src]; - - if (flipscreen) - pos = ((191 - y) << 8) | (~x & 0xff); - else - pos = (y << 8) | (x & 0xff); - - PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } else { - for (INT32 x = sx; x < sx + 16; x++, src++) - { - if (y > 191 || y < 0 || !*src) continue; - - pxl = Palette[color | *src]; - - if (flipscreen) - pos = ((191 - y) << 8) | (~x & 0xff); - else - pos = (y << 8) | (x & 0xff); - - PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } - } - } else { - for (INT32 y = sy; y < sy + 16; y++) - { - if (flipx) - { - for (INT32 x = sx + 15; x >= sx; x--, src++) - { - if (y > 191 || y < 0 || !*src) continue; - - pxl = Palette[color | *src]; - - if (flipscreen) - pos = ((191 - y) << 8) | (~x & 0xff); - else - pos = (y << 8) | (x & 0xff); - - PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } else { - for (INT32 x = sx; x < sx + 16; x++, src++) - { - if (y > 191 || y < 0 || !*src) continue; - - pxl = Palette[color | *src]; - - if (flipscreen) - pos = ((191 - y) << 8) | (~x & 0xff); - else - pos = (y << 8) | (x & 0xff); - - PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); - } - } - } - } - } - - DrawChars(1); - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - vblank = 0; - - ZetOpen(0); - ZetRun(3000000 / 60); - ZetRaiseIrq(0); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - -//------------------------------------------------------------------------------------------------- -// Save State - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = Rom + 0x8000; - ba.nLen = 0x1000; - ba.szName = "Video Ram"; - BurnAcb(&ba); - - ba.Data = Rom + 0xc000; - ba.nLen = 0x0800; - ba.szName = "Work Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - AY8910Scan(nAction, pnMin); - - SCAN_VAR(flipscreen); - } - - return 0; -} - - -//------------------------------------------------------------------------------------------------- -// Game drivers - - -// Penguin-Kun Wars (US) - -static struct BurnRomInfo pkunwarRomDesc[] = { - { "pkwar.01r", 0x4000, 0xce2d2c7b, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "pkwar.02r", 0x4000, 0xabc1f661, 1 | BRF_PRG | BRF_ESS }, // 1 - { "pkwar.03r", 0x2000, 0x56faebea, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "pkwar.01y", 0x4000, 0x428d3b92, 2 | BRF_GRA }, // 3 Graphics - { "pkwar.02y", 0x4000, 0xce1da7bc, 2 | BRF_GRA }, // 4 - { "pkwar.03y", 0x4000, 0x63204400, 2 | BRF_GRA }, // 5 - { "pkwar.04y", 0x4000, 0x061dfca8, 2 | BRF_GRA }, // 6 - - { "pkwar.col", 0x0020, 0xaf0fc5e2, 3 | BRF_GRA }, // 7 Color Prom -}; - -STD_ROM_PICK(pkunwar) -STD_ROM_FN(pkunwar) - -struct BurnDriver BurnDrvpkunwar = { - "pkunwar", NULL, NULL, NULL, "1985", - "Penguin-Kun Wars (US)\0", NULL, "UPL", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0, - NULL, pkunwarRomInfo, pkunwarRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x200, - 256, 192, 4, 3 -}; - - -// Penguin-Kun Wars (Japan) - -static struct BurnRomInfo pkunwarjRomDesc[] = { - { "pgunwar.6", 0x4000, 0x357f3ef3, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code - { "pgunwar.5", 0x4000, 0x0092e49e, 1 | BRF_PRG | BRF_ESS }, // 1 - { "pkwar.03r", 0x2000, 0x56faebea, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "pkwar.01y", 0x4000, 0x428d3b92, 2 | BRF_GRA }, // 3 Graphics - { "pkwar.02y", 0x4000, 0xce1da7bc, 2 | BRF_GRA }, // 4 - { "pgunwar.2", 0x4000, 0xa2a43443, 2 | BRF_GRA }, // 5 - { "pkwar.04y", 0x4000, 0x061dfca8, 2 | BRF_GRA }, // 6 - - { "pkwar.col", 0x0020, 0xaf0fc5e2, 3 | BRF_GRA }, // 7 Color Prom -}; - -STD_ROM_PICK(pkunwarj) -STD_ROM_FN(pkunwarj) - -struct BurnDriver BurnDrvpkunwarj = { - "pkunwarj", "pkunwar", NULL, NULL, "1985", - "Penguin-Kun Wars (Japan)\0", NULL, "UPL", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0, - NULL, pkunwarjRomInfo, pkunwarjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x200, - 256, 192, 4, 3 -}; - +// FB Alpha Penguin-Kun Wars Driver Module +// Based on MAME Driver by David Haywood and Phil Stroffolino + +#include "tiles_generic.h" +#include "z80_intf.h" + +#include "driver.h" +extern "C" { + #include "ay8910.h" +} + + +static UINT8 DrvJoy1[8], DrvJoy2[8], DrvDips, DrvReset; +static INT16 *pAY8910Buffer[6], *pFMBuffer = NULL; +static UINT8 *Mem, *Rom, *Gfx0, *Gfx1; +static INT32 *Palette; + +static INT32 flipscreen, vblank; + + +//------------------------------------------------------------------------------------------------- +// Input Handlers + + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy2 + 7, "p1 coin" }, + {"P1 start" , BIT_DIGITAL , DrvJoy1 + 5, "p1 start" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 2, "p1 fire 1"}, + + {"P2 start" , BIT_DIGITAL , DrvJoy2 + 5, "p2 start" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 2, "p2 fire 1"}, + + {"Service Mode", BIT_DIGITAL, DrvJoy2 + 6, "diag" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, &DrvDips , "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0b, 0x01, 0x03, 0x00, "3C 1C" }, + {0x0b, 0x01, 0x03, 0x02, "2C 1C" }, + {0x0b, 0x01, 0x03, 0x03, "1C 1C" }, + {0x0b, 0x01, 0x03, 0x01, "1C 2C" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x04, 0x00, "Upright" }, + {0x0b, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0b, 0x01, 0x30, 0x10, "Easy" }, + {0x0b, 0x01, 0x30, 0x30, "Medium" }, + {0x0b, 0x01, 0x30, 0x20, "Hard" }, + {0x0b, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Flip screen" }, + {0x0b, 0x01, 0x40, 0x40, "Off" }, + {0x0b, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x0b, 0x01, 0x80, 0x80, "Off" }, + {0x0b, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Drv) + + +//------------------------------------------------------------------------------------------------- +// Memory Handlers + + +UINT8 __fastcall pkunwar_read(UINT16 address) +{ + switch (address) + { + case 0xa001: + return AY8910Read(0); + break; + + case 0xa003: + return AY8910Read(1); + break; + } + + return 0; +} + +void __fastcall pkunwar_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xa000: + AY8910Write(0, 0, data); + break; + + case 0xa001: + AY8910Write(0, 1, data); + break; + + case 0xa002: + AY8910Write(1, 0, data); + break; + + case 0xa003: + AY8910Write(1, 1, data); + break; + } +} + +void __fastcall pkunwar_out(UINT16 address, UINT8 data) +{ + address &= 0xff; + + if (address == 0) flipscreen = data & 1; +} + + +//------------------------------------------------------------------------------------------------- +// AY8910 Ports + + +static UINT8 pkunwar_port_0(UINT32) +{ + UINT8 ret = 0x7f | (vblank ^= 0x80); + + for (INT32 i = 0; i < 8; i++) { + ret ^= DrvJoy1[i] << i; + } + + return ret; +} + +static UINT8 pkunwar_port_1(UINT32) +{ + UINT8 ret = 0xff; + + for (INT32 i = 0; i < 8; i++) { + ret ^= DrvJoy2[i] << i; + } + + return ret; +} + +static UINT8 pkunwar_port_2(UINT32) +{ + return 0xff; +} + +static UINT8 pkunwar_port_3(UINT32) +{ + return DrvDips; +} + + +//------------------------------------------------------------------------------------------------- +// Initialization Routines + + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (Rom + 0x8000, 0, 0x1000); + memset (Rom + 0xc000, 0, 0x0800); + + flipscreen = 0; + + ZetOpen(0); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + AY8910Reset(1); + + return 0; +} + +static void pkunwar_palette_init(UINT8 *Prom) +{ + for (INT32 i = 0; i < 0x200; i++) + { + INT32 entry; + INT32 intensity,r,g,b; + + if ((i & 0xf) == 1) + { + entry = ((i & 0xf0) >> 4) | ((i & 0x100) >> 4); + } + else + { + entry = ((i & 0x0f) >> 0) | ((i & 0x100) >> 4); + } + + intensity = Prom[entry] & 0x03; + + r = (((Prom[entry] >> 0) & 0x0c) | intensity) * 0x11; + g = (((Prom[entry] >> 2) & 0x0c) | intensity) * 0x11; + b = (((Prom[entry] >> 4) & 0x0c) | intensity) * 0x11; + + Palette[i] = (r << 16) | (g << 8) | b; + } +} + +static void pkunwar_gfx_decode(UINT8 *Gfx) +{ + static INT32 PlaneOffsets[4] = { 0, 1, 2, 3 }; + + static INT32 XOffsets[16] = { + 0x00000, 0x00004, 0x40000, 0x40004, 0x00008, 0x0000c, 0x40008, 0x4000c, + 0x00080, 0x00084, 0x40080, 0x40084, 0x00088, 0x0008c, 0x40088, 0x4008c + }; + + static INT32 YOffsets[16] = { + 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, + 0x100, 0x110, 0x120, 0x130, 0x140, 0x150, 0x160, 0x170 + }; + + GfxDecode(0x800, 4, 8, 8, PlaneOffsets, XOffsets, YOffsets, 0x080, Gfx, Gfx0); + GfxDecode(0x200, 4, 16, 16, PlaneOffsets, XOffsets, YOffsets, 0x200, Gfx, Gfx1); +} + +static INT32 LoadRoms() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); + if (tmp == NULL) { + return 1; + } + + if (BurnLoadRom(Rom + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(Rom + 0x4000, 1, 1)) return 1; + if (BurnLoadRom(Rom + 0xe000, 2, 1)) return 1; + + if (BurnLoadRom(Gfx0 + 0x0000, 3, 1)) return 1; + if (BurnLoadRom(Gfx0 + 0x4000, 4, 1)) return 1; + if (BurnLoadRom(Gfx0 + 0x8000, 5, 1)) return 1; + if (BurnLoadRom(Gfx0 + 0xc000, 6, 1)) return 1; + + for (INT32 i = 0; i < 8; i++) { + INT32 j = ((i & 1) << 2) | ((i >> 1) & 3); + memcpy (tmp + j * 0x2000, Gfx0 + i * 0x2000, 0x2000); + } + + pkunwar_gfx_decode(tmp); + + if (BurnLoadRom(tmp + 0x0000, 7, 1)) return 1; + + pkunwar_palette_init(tmp); + + BurnFree(tmp); + + return 0; +} + +static INT32 DrvInit() +{ + Mem = (UINT8*)BurnMalloc(0x10000 + (0x20000 * 2) + (0x200 * sizeof(INT32))); + if (Mem == NULL) { + return 1; + } + + pFMBuffer = (INT16 *)BurnMalloc (nBurnSoundLen * 6 * sizeof(INT16)); + if (pFMBuffer == NULL) { + return 1; + } + + Rom = Mem + 0x00000; + Gfx0 = Mem + 0x10000; + Gfx1 = Mem + 0x30000; + Palette = (INT32*)(Mem + 0x40000); + + if (LoadRoms()) return 1; + + ZetInit(0); + ZetOpen(0); + ZetSetOutHandler(pkunwar_out); + ZetSetReadHandler(pkunwar_read); + ZetSetWriteHandler(pkunwar_write); + ZetMapArea(0x0000, 0x7fff, 0, Rom + 0x00000); + ZetMapArea(0x0000, 0x7fff, 2, Rom + 0x00000); + ZetMapArea(0x8000, 0x8fff, 0, Rom + 0x08000); + ZetMapArea(0x8000, 0x8fff, 1, Rom + 0x08000); + ZetMapArea(0xc000, 0xc7ff, 0, Rom + 0x0c000); + ZetMapArea(0xc000, 0xc7ff, 1, Rom + 0x0c000); + ZetMapArea(0xc000, 0xc7ff, 2, Rom + 0x0c000); + ZetMapArea(0xe000, 0xffff, 0, Rom + 0x0e000); + ZetMapArea(0xe000, 0xffff, 2, Rom + 0x0e000); + ZetClose(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + + AY8910Init(0, 1500000, nBurnSoundRate, &pkunwar_port_0, &pkunwar_port_1, NULL, NULL); + AY8910Init(1, 1500000, nBurnSoundRate, &pkunwar_port_2, &pkunwar_port_3, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + AY8910Exit(0); + AY8910Exit(1); + + BurnFree (pFMBuffer); + BurnFree (Mem); + + Rom = Gfx0 = Gfx1 = Mem = NULL; + Palette = NULL; + + vblank = flipscreen = 0; + + return 0; +} + + +//------------------------------------------------------------------------------------------------- +// Drawing Routines + + +static INT32 DrawChars(INT32 priority) +{ + INT32 offs; + + for (offs = 0x3c0 - 1;offs >= 0x40;offs--) + { + if (Rom[0x8c00 + offs] & 0x08 || !priority) + { + INT32 sx,sy,num,color,pxl,pos; + + sx = (offs & 0x1f) << 3; + sy = (offs >> 2) & 0xf8; + + if (sy < 32 || sy > 223) continue; + sy -= 32; + + num = Rom[0x8800 + offs] | ((Rom[0x8c00 + offs] & 7) << 8); + color = 0x100 | (Rom[0x8c00 + offs] & 0xf0); + + UINT8 *src = Gfx0 + (num << 6); + + for (INT32 y = sy; y < sy + 8; y++) + { + for (INT32 x = sx; x < sx + 8; x++, src++) + { + if (!*src && priority) continue; + + pxl = Palette[color | *src]; + + if (flipscreen) + pos = ((191 - y) << 8) | (~x & 0xff); + else + pos = (y << 8) | (x & 0xff); + + PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } + } + } + + return 0; +} + +static INT32 DrvDraw() +{ + INT32 offs; + + DrawChars(0); + + for (offs = 0;offs < 0x800;offs += 32) + { + INT32 sx,sy,flipx,flipy,num,color,pxl,pos; + + sx = Rom[0x8001 + offs]; + sy = Rom[0x8002 + offs]; + + if (sy < 16 || sy > 223) continue; + sy -= 32; + + flipx = Rom[0x8000 + offs] & 0x01; + flipy = Rom[0x8000 + offs] & 0x02; + + num = ((Rom[0x8000 + offs] & 0xfc) >> 2) + ((Rom[0x8003 + offs] & 7) << 6); + color = Rom[0x8003 + offs] & 0xf0; + + UINT8 *src = Gfx1 + (num << 8); + + if (flipy) + { + for (INT32 y = sy + 15; y >= sy; y--) + { + if (flipx) + { + for (INT32 x = sx + 15; x >= sx; x--, src++) + { + if (y > 191 || y < 0 || !*src) continue; + + pxl = Palette[color | *src]; + + if (flipscreen) + pos = ((191 - y) << 8) | (~x & 0xff); + else + pos = (y << 8) | (x & 0xff); + + PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } else { + for (INT32 x = sx; x < sx + 16; x++, src++) + { + if (y > 191 || y < 0 || !*src) continue; + + pxl = Palette[color | *src]; + + if (flipscreen) + pos = ((191 - y) << 8) | (~x & 0xff); + else + pos = (y << 8) | (x & 0xff); + + PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } + } + } else { + for (INT32 y = sy; y < sy + 16; y++) + { + if (flipx) + { + for (INT32 x = sx + 15; x >= sx; x--, src++) + { + if (y > 191 || y < 0 || !*src) continue; + + pxl = Palette[color | *src]; + + if (flipscreen) + pos = ((191 - y) << 8) | (~x & 0xff); + else + pos = (y << 8) | (x & 0xff); + + PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } else { + for (INT32 x = sx; x < sx + 16; x++, src++) + { + if (y > 191 || y < 0 || !*src) continue; + + pxl = Palette[color | *src]; + + if (flipscreen) + pos = ((191 - y) << 8) | (~x & 0xff); + else + pos = (y << 8) | (x & 0xff); + + PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); + } + } + } + } + } + + DrawChars(1); + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + vblank = 0; + + ZetOpen(0); + ZetRun(3000000 / 60); + ZetRaiseIrq(0); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + +//------------------------------------------------------------------------------------------------- +// Save State + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = Rom + 0x8000; + ba.nLen = 0x1000; + ba.szName = "Video Ram"; + BurnAcb(&ba); + + ba.Data = Rom + 0xc000; + ba.nLen = 0x0800; + ba.szName = "Work Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + AY8910Scan(nAction, pnMin); + + SCAN_VAR(flipscreen); + } + + return 0; +} + + +//------------------------------------------------------------------------------------------------- +// Game drivers + + +// Penguin-Kun Wars (US) + +static struct BurnRomInfo pkunwarRomDesc[] = { + { "pkwar.01r", 0x4000, 0xce2d2c7b, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "pkwar.02r", 0x4000, 0xabc1f661, 1 | BRF_PRG | BRF_ESS }, // 1 + { "pkwar.03r", 0x2000, 0x56faebea, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "pkwar.01y", 0x4000, 0x428d3b92, 2 | BRF_GRA }, // 3 Graphics + { "pkwar.02y", 0x4000, 0xce1da7bc, 2 | BRF_GRA }, // 4 + { "pkwar.03y", 0x4000, 0x63204400, 2 | BRF_GRA }, // 5 + { "pkwar.04y", 0x4000, 0x061dfca8, 2 | BRF_GRA }, // 6 + + { "pkwar.col", 0x0020, 0xaf0fc5e2, 3 | BRF_GRA }, // 7 Color Prom +}; + +STD_ROM_PICK(pkunwar) +STD_ROM_FN(pkunwar) + +struct BurnDriver BurnDrvpkunwar = { + "pkunwar", NULL, NULL, NULL, "1985", + "Penguin-Kun Wars (US)\0", NULL, "UPL", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0, + NULL, pkunwarRomInfo, pkunwarRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x200, + 256, 192, 4, 3 +}; + + +// Penguin-Kun Wars (Japan) + +static struct BurnRomInfo pkunwarjRomDesc[] = { + { "pgunwar.6", 0x4000, 0x357f3ef3, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 Code + { "pgunwar.5", 0x4000, 0x0092e49e, 1 | BRF_PRG | BRF_ESS }, // 1 + { "pkwar.03r", 0x2000, 0x56faebea, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "pkwar.01y", 0x4000, 0x428d3b92, 2 | BRF_GRA }, // 3 Graphics + { "pkwar.02y", 0x4000, 0xce1da7bc, 2 | BRF_GRA }, // 4 + { "pgunwar.2", 0x4000, 0xa2a43443, 2 | BRF_GRA }, // 5 + { "pkwar.04y", 0x4000, 0x061dfca8, 2 | BRF_GRA }, // 6 + + { "pkwar.col", 0x0020, 0xaf0fc5e2, 3 | BRF_GRA }, // 7 Color Prom +}; + +STD_ROM_PICK(pkunwarj) +STD_ROM_FN(pkunwarj) + +struct BurnDriver BurnDrvpkunwarj = { + "pkunwarj", "pkunwar", NULL, NULL, "1985", + "Penguin-Kun Wars (Japan)\0", NULL, "UPL", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0, + NULL, pkunwarjRomInfo, pkunwarjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x200, + 256, 192, 4, 3 +}; + diff --git a/src/burn/drv/pre90s/d_prehisle.cpp b/src/burn/drv/pre90s/d_prehisle.cpp index ead5a5039..42c2c3cd9 100644 --- a/src/burn/drv/pre90s/d_prehisle.cpp +++ b/src/burn/drv/pre90s/d_prehisle.cpp @@ -1,890 +1,889 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "upd7759.h" - -// Input Related Variables -static UINT8 PrehisleInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 PrehisleInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 PrehisleInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 PrehisleDip[2] = {0, 0}; -static UINT8 PrehisleInput[3] = {0x00, 0x00, 0x00}; -static UINT8 PrehisleReset = 0; - -// Memory Holders -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *PrehisleRom = NULL; -static UINT8 *PrehisleZ80Rom = NULL; -static UINT8 *PrehisleTileMapRom = NULL; -static UINT8 *PrehisleADPCMSamples = NULL; -static UINT8 *PrehisleRam = NULL; -static UINT8 *PrehisleVideoRam = NULL; -static UINT8 *PrehisleSpriteRam = NULL; -static UINT8 *PrehisleVideo2Ram = NULL; -static UINT8 *PrehislePaletteRam = NULL; -static UINT8 *PrehisleZ80Ram = NULL; -static UINT32 *PrehislePalette = NULL; -static UINT8 *PrehisleTextTiles = NULL; -static UINT8 *PrehisleSprites = NULL; -static UINT8 *PrehisleBack1Tiles = NULL; -static UINT8 *PrehisleBack2Tiles = NULL; -static UINT8 *PrehisleTempGfx = NULL; - -// Misc Variables, system control values, etc. -static INT32 ControlsInvert; -static UINT16 VidControl[7]; -static INT32 SoundLatch; - -// CPU Interleave Variables -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -// Dip Switch and Input Definitions -static struct BurnInputInfo PrehisleInputList[] = { - {"Coin 1" , BIT_DIGITAL , PrehisleInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , PrehisleInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , PrehisleInputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , PrehisleInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , PrehisleInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , PrehisleInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , PrehisleInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , PrehisleInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , PrehisleInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , PrehisleInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , PrehisleInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , PrehisleInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , PrehisleInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , PrehisleInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , PrehisleInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , PrehisleInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , PrehisleInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , PrehisleInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &PrehisleReset , "reset" }, - {"Service" , BIT_DIGITAL , PrehisleInputPort2 + 2, "service" }, - {"Diagnostics" , BIT_DIGITAL , PrehisleInputPort2 + 3, "diag" }, - {"Tilt" , BIT_DIGITAL , PrehisleInputPort2 + 4, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, PrehisleDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, PrehisleDip + 1 , "dip" }, -}; - -STDINPUTINFO(Prehisle) - -inline void PrehisleClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -inline void PrehisleMakeInputs() -{ - // Reset Inputs - PrehisleInput[0] = PrehisleInput[1] = PrehisleInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - PrehisleInput[0] |= (PrehisleInputPort0[i] & 1) << i; - PrehisleInput[1] |= (PrehisleInputPort1[i] & 1) << i; - PrehisleInput[2] |= (PrehisleInputPort2[i] & 1) << i; - } - - // Clear Opposites - PrehisleClearOpposites(&PrehisleInput[0]); - PrehisleClearOpposites(&PrehisleInput[1]); -} - -static struct BurnDIPInfo PrehisleDIPList[]= -{ - // Default Values - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Display" }, - {0x16, 0x01, 0x01, 0x01, "Normal" }, - {0x16, 0x01, 0x01, 0x00, "Inverse" }, - - {0 , 0xfe, 0 , 2 , "Level Select" }, - {0x16, 0x01, 0x02, 0x02, "Off" }, - {0x16, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Bonus" }, - {0x16, 0x01, 0x04, 0x04, "2nd" }, - {0x16, 0x01, 0x04, 0x00, "Every" }, - -// {0 , 0xfe, 0 , 2 , "Unknown" }, -// {0x16, 0x01, 0x08, 0x08, "Off" }, -// {0x16, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x16, 0x01, 0x30, 0x30, "A 1-1 B 1-1" }, - {0x16, 0x01, 0x30, 0x20, "A 2-1 B 1-2" }, - {0x16, 0x01, 0x30, 0x10, "A 3-1 B 1-3" }, - {0x16, 0x01, 0x30, 0x00, "A 4-1 B 1-4" }, - - {0 , 0xfe, 0 , 4 , "Hero" }, - {0x16, 0x01, 0xc0, 0x80, "2" }, - {0x16, 0x01, 0xc0, 0xc0, "3" }, - {0x16, 0x01, 0xc0, 0x40, "4" }, - {0x16, 0x01, 0xc0, 0x00, "5" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Level" }, - {0x17, 0x01, 0x03, 0x02, "1 (Easy)" }, - {0x17, 0x01, 0x03, 0x03, "2 (Standard)" }, - {0x17, 0x01, 0x03, 0x01, "3 (Middle)" }, - {0x17, 0x01, 0x03, 0x00, "4 (Difficult)" }, - - {0 , 0xfe, 0 , 4 , "Game Mode" }, - {0x17, 0x01, 0x0c, 0x08, "Demo Sound Off" }, - {0x17, 0x01, 0x0c, 0x0c, "Demo Sound On" }, - {0x17, 0x01, 0x0c, 0x00, "Stop Video" }, - {0x17, 0x01, 0x0c, 0x04, "Never Finish" }, - - {0 , 0xfe, 0 , 4 , "Bonus 1st/2nd" }, - {0x17, 0x01, 0x30, 0x30, "100000/200000" }, - {0x17, 0x01, 0x30, 0x20, "150000/300000" }, - {0x17, 0x01, 0x30, 0x10, "300000/500000" }, - {0x17, 0x01, 0x30, 0x00, "No Bonus" }, - - {0 , 0xfe, 0 , 2 , "Continue" }, - {0x17, 0x01, 0x40, 0x00, "Off" }, - {0x17, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Prehisle) - -// Rom Definitions -static struct BurnRomInfo PrehisleRomDesc[] = { - { "gt-e2.2h", 0x20000, 0x7083245a, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "gt-e3.3h", 0x20000, 0x6d8cdf58, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "gt15.b15", 0x08000, 0xac652412, BRF_GRA }, // 2 Text Layer Tiles - { "pi8914.b14", 0x40000, 0x207d6187, BRF_GRA }, // 3 Background2 Layer Tiles - { "pi8916.h16", 0x40000, 0x7cffe0f6, BRF_GRA }, // 4 Background1 Layer Tiles - { "pi8910.k14", 0x80000, 0x5a101b0b, BRF_GRA }, // 5 Sprite Layer Tiles - { "gt5.5", 0x20000, 0x3d3ab273, BRF_GRA }, // 6 Sprite Layer Tiles - { "gt11.11", 0x10000, 0xb4f0fcf0, BRF_GRA }, // 7 Background 2 TileMap - - { "gt1.1", 0x10000, 0x80a4c093, BRF_SND }, // 8 Z80 Program Code - - { "gt4.4", 0x20000, 0x85dfb9ec, BRF_SND }, // 9 ADPCM Samples -}; - - -STD_ROM_PICK(Prehisle) -STD_ROM_FN(Prehisle) - -static struct BurnRomInfo PrehisluRomDesc[] = { - { "gt-u2.2h", 0x20000, 0xa14f49bb, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "gt-u3.3h", 0x20000, 0xf165757e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "gt15.b15", 0x08000, 0xac652412, BRF_GRA }, // 2 Text Layer Tiles - { "pi8914.b14", 0x40000, 0x207d6187, BRF_GRA }, // 3 Background2 Layer Tiles - { "pi8916.h16", 0x40000, 0x7cffe0f6, BRF_GRA }, // 4 Background1 Layer Tiles - { "pi8910.k14", 0x80000, 0x5a101b0b, BRF_GRA }, // 5 Sprite Layer Tiles - { "gt5.5", 0x20000, 0x3d3ab273, BRF_GRA }, // 6 Sprite Layer Tiles - { "gt11.11", 0x10000, 0xb4f0fcf0, BRF_GRA }, // 7 Background 2 TileMap - - { "gt1.1", 0x10000, 0x80a4c093, BRF_SND }, // 8 Z80 Program Code - - { "gt4.4", 0x20000, 0x85dfb9ec, BRF_SND }, // 9 ADPCM Samples -}; - - -STD_ROM_PICK(Prehislu) -STD_ROM_FN(Prehislu) - -static struct BurnRomInfo PrehislkRomDesc[] = { - { "gt-k2.2h", 0x20000, 0xf2d3544d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "gt-k3.3h", 0x20000, 0xebf7439b, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "gt15.b15", 0x08000, 0xac652412, BRF_GRA }, // 2 Text Layer Tiles - { "pi8914.b14", 0x40000, 0x207d6187, BRF_GRA }, // 3 Background2 Layer Tiles - { "pi8916.h16", 0x40000, 0x7cffe0f6, BRF_GRA }, // 4 Background1 Layer Tiles - { "pi8910.k14", 0x80000, 0x5a101b0b, BRF_GRA }, // 5 Sprite Layer Tiles - { "gt5.5", 0x20000, 0x3d3ab273, BRF_GRA }, // 6 Sprite Layer Tiles - { "gt11.11", 0x10000, 0xb4f0fcf0, BRF_GRA }, // 7 Background 2 TileMap - - { "gt1.1", 0x10000, 0x80a4c093, BRF_SND }, // 8 Z80 Program Code - - { "gt4.4", 0x20000, 0x85dfb9ec, BRF_SND }, // 9 ADPCM Samples -}; - - -STD_ROM_PICK(Prehislk) -STD_ROM_FN(Prehislk) - -static struct BurnRomInfo GensitouRomDesc[] = { - { "gt-j2.2h", 0x20000, 0xa2da0b6b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "gt-j3.3h", 0x20000, 0xc1a0ae8e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "gt15.b15", 0x08000, 0xac652412, BRF_GRA }, // 2 Text Layer Tiles - { "pi8914.b14", 0x40000, 0x207d6187, BRF_GRA }, // 3 Background2 Layer Tiles - { "pi8916.h16", 0x40000, 0x7cffe0f6, BRF_GRA }, // 4 Background1 Layer Tiles - { "pi8910.k14", 0x80000, 0x5a101b0b, BRF_GRA }, // 5 Sprite Layer Tiles - { "gt5.5", 0x20000, 0x3d3ab273, BRF_GRA }, // 6 Sprite Layer Tiles - { "gt11.11", 0x10000, 0xb4f0fcf0, BRF_GRA }, // 7 Background 2 TileMap - - { "gt1.1", 0x10000, 0x80a4c093, BRF_SND }, // 8 Z80 Program Code - - { "gt4.4", 0x20000, 0x85dfb9ec, BRF_SND }, // 9 ADPCM Samples -}; - - -STD_ROM_PICK(Gensitou) -STD_ROM_FN(Gensitou) - -// Misc Driver Functions and Memory Handlers -INT32 PrehisleDoReset() -{ - ControlsInvert = 0; - SoundLatch = 0; - VidControl[0] = VidControl[1] = VidControl[2] = VidControl[3] = VidControl[4] = VidControl[5] = VidControl[6] = 0; - - SekOpen(0); - SekReset(); - SekClose(); - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - UPD7759Reset(); - - return 0; -} - -// ---------------------------------------------------------------------------- -// Callbacks for the FM chip - -static void prehisleFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 prehisleSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -// VBlank - -inline UINT16 PrehisleVBlankRegister() -{ - INT32 nCycles = SekTotalCycles(); - - // 262 == approximate number of scanlines on an arcade monitor - if (nCycles >= (262 - 16) * ((9000000 / 60) / 262)) { - return 0x80; - } else { - if (nCycles < (262 - 210 - 16) * ((9000000 / 60) / 262)) { - return 0x80; - } - } - - return 0x00; -} - -UINT16 __fastcall PrehisleReadWord(UINT32 a) -{ - switch (a) { - case 0x0e0010: { - return 0xff - PrehisleInput[1]; - } - - case 0x0e0020: { - return 0xff - PrehisleInput[2]; - } - - case 0x0e0040: { - return 0xff - (PrehisleInput[0] ^ ControlsInvert); - } - - case 0x0e0042: { - return PrehisleDip[0]; - } - - case 0x0e0044: { - return PrehisleDip[1] + PrehisleVBlankRegister(); - } - } - - return 0; -} - -void __fastcall PrehisleWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x0f0000: { - VidControl[0] = d; - return; - } - - case 0x0f0010: { - VidControl[1] = d; - return; - } - - case 0x0f0020: { - VidControl[2] = d; - return; - } - - case 0x0f0030: { - VidControl[3] = d; - return; - } - - case 0x0f0046: { - ControlsInvert = d ? 0xff : 0x00; - return; - } - - case 0x0f0050: { - VidControl[4] = d; - return; - } - - case 0x0f0052: { - VidControl[5] = d; - return; - } - - case 0x0f0060: { - VidControl[6] = d; - return; - } - - case 0x0f0070: { - SoundLatch = d & 0xff; - ZetNmi(); - return; - } - } -} - -UINT8 __fastcall PrehisleZ80PortRead(UINT16 a) -{ - a &= 0xff; - switch (a) { - case 0x00: { - return BurnYM3812Read(0); - } - } - - return 0; -} - -void __fastcall PrehisleZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - switch (a) { - case 0x00: { - BurnYM3812Write(0, d); - return; - } - - case 0x20: { - BurnYM3812Write(1, d); - return; - } - - case 0x40: { - UPD7759PortWrite(0,d); - UPD7759StartWrite(0,0); - UPD7759StartWrite(0,1); - return; - } - - case 0x80: { - UPD7759ResetWrite(0,d); - return; - } - } -} - -UINT8 __fastcall PrehisleZ80Read(UINT16 a) -{ - switch (a) { - case 0xf800: { - return SoundLatch; - } - } - - return 0; -} - -// Function to Allocate and Index required memory -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - PrehisleRom = Next; Next += 0x40000; - PrehisleZ80Rom = Next; Next += 0x10000; - PrehisleTileMapRom = Next; Next += 0x10000; - PrehisleADPCMSamples = Next; Next += 0x20000; - - RamStart = Next; - - PrehisleRam = Next; Next += 0x04000; - PrehisleVideoRam = Next; Next += 0x00800; - PrehisleSpriteRam = Next; Next += 0x00800; - PrehisleVideo2Ram = Next; Next += 0x04000; - PrehislePaletteRam = Next; Next += 0x00800; - PrehisleZ80Ram = Next; Next += 0x00800; - - RamEnd = Next; - - PrehisleTextTiles = Next; Next += (1024 * 8 * 8); - PrehisleSprites = Next; Next += (5120 * 16 * 16); - PrehisleBack1Tiles = Next; Next += (2048 * 16 * 16); - PrehisleBack2Tiles = Next; Next += (2048 * 16 * 16); - PrehislePalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 CharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; -static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 TileXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 512, 516, 520, 524, 528, 532, 536, 540 }; -static INT32 TileYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; - -// Driver Init and Exit Functions -INT32 PrehisleInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - PrehisleTempGfx = (UINT8*)BurnMalloc(0xa0000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(PrehisleRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(PrehisleRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and decode Text Tiles rom - memset(PrehisleTempGfx, 0, 0xa0000); - nRet = BurnLoadRom(PrehisleTempGfx, 2, 1); if (nRet != 0) return 1; - GfxDecode(1024, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, PrehisleTempGfx, PrehisleTextTiles); - - // Load and decode Background2 Tile rom - memset(PrehisleTempGfx, 0, 0xa0000); - nRet = BurnLoadRom(PrehisleTempGfx, 3, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, PrehisleTempGfx, PrehisleBack2Tiles); - - // Load and decode Background1 Tile rom - memset(PrehisleTempGfx, 0, 0xa0000); - nRet = BurnLoadRom(PrehisleTempGfx, 4, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, PrehisleTempGfx, PrehisleBack1Tiles); - - // Load and decode Sprite roms - memset(PrehisleTempGfx, 0, 0xa0000); - nRet = BurnLoadRom(PrehisleTempGfx + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(PrehisleTempGfx + 0x80000, 6, 1); if (nRet != 0) return 1; - GfxDecode(5120, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, PrehisleTempGfx, PrehisleSprites); - - BurnFree(PrehisleTempGfx); - - // Load Background2 Tilemap rom - nRet = BurnLoadRom(PrehisleTileMapRom, 7, 1); if (nRet != 0) return 1; - - // Load Z80 Program rom - nRet = BurnLoadRom(PrehisleZ80Rom, 8, 1); if (nRet != 0) return 1; - - // Load ADPCM Samples - nRet = BurnLoadRom(PrehisleADPCMSamples, 9, 1); if (nRet != 0) return 1; - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(PrehisleRom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(PrehisleRam , 0x070000, 0x073fff, SM_RAM); - SekMapMemory(PrehisleVideoRam , 0x090000, 0x0907ff, SM_RAM); - SekMapMemory(PrehisleSpriteRam , 0x0a0000, 0x0a07ff, SM_RAM); - SekMapMemory(PrehisleVideo2Ram , 0x0b0000, 0x0b3fff, SM_RAM); - SekMapMemory(PrehislePaletteRam, 0x0d0000, 0x0d07ff, SM_RAM); - SekSetReadWordHandler(0, PrehisleReadWord); - SekSetWriteWordHandler(0, PrehisleWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, PrehisleZ80Rom); - ZetMapArea(0x0000, 0xefff, 2, PrehisleZ80Rom); - ZetMapArea(0xf000, 0xf7ff, 0, PrehisleZ80Ram); - ZetMapArea(0xf000, 0xf7ff, 1, PrehisleZ80Ram); - ZetMapArea(0xf000, 0xf7ff, 2, PrehisleZ80Ram); - ZetMemEnd(); - ZetSetReadHandler(PrehisleZ80Read); - ZetSetInHandler(PrehisleZ80PortRead); - ZetSetOutHandler(PrehisleZ80PortWrite); - ZetClose(); - - BurnYM3812Init(4000000, &prehisleFMIRQHandler, &prehisleSynchroniseStream, 0); - BurnTimerAttachZetYM3812(4000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - UPD7759Init(0, UPD7759_STANDARD_CLOCK, PrehisleADPCMSamples); - UPD7759SetRoute(0, 0.90, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - PrehisleDoReset(); - - return 0; -} - -INT32 PrehisleExit() -{ - BurnYM3812Exit(); - UPD7759Exit(); - - SekExit(); - ZetExit(); - - GenericTilesExit(); - - BurnFree(Mem); - - return 0; -} - -// Graphics Emulation -void PrehisleRenderBack2TileLayer() -{ - INT32 TileBase, mx, my, Tile, Colour, Scrollx, Scrolly, x, y, Flipx; - - TileBase = ((VidControl[3] >> 4) & 0x3ff) * 32; - TileBase &= 0x7fff; - Scrollx = -(VidControl[3] & 0x0f); - Scrolly = -VidControl[2]; - - for (mx = 0; mx < 17; mx++) { - for (my = 0; my < 32; my++) { - Tile = (PrehisleTileMapRom[2 * TileBase + 0] << 8) + PrehisleTileMapRom[2 * TileBase + 1]; - Colour = Tile >> 12; - Flipx = Tile & 0x800; - x = 16 * mx + Scrollx; - y = (16 * my + Scrolly) & 0x1ff; - y -= 16; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - if (!Flipx) { - Render16x16Tile(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 768, PrehisleBack2Tiles); - } else { - Render16x16Tile_FlipX(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 768, PrehisleBack2Tiles); - } - } else { - if (!Flipx) { - Render16x16Tile_Clip(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 768, PrehisleBack2Tiles); - } else { - Render16x16Tile_FlipX_Clip(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 768, PrehisleBack2Tiles); - } - } - - TileBase ++; - if (TileBase == 0x8000) TileBase = 0; - } - } -} - -void PrehisleRenderBack1TileLayer() -{ - INT32 TileBase, mx, my, Tile, Colour, Scrollx, Scrolly, x, y, Flipy; - - TileBase = ((VidControl[1] >> 4) & 0xff) * 32; - TileBase &= 0x1fff; - Scrollx = -(VidControl[1] & 0x0f); - Scrolly = -VidControl[0]; - - for (mx = 0; mx < 17; mx++) { - for (my = 0; my < 32; my++) { - Tile = (PrehisleVideo2Ram[2 * TileBase + 1] << 8) + PrehisleVideo2Ram[2 * TileBase + 0]; - Colour = Tile >> 12; - Flipy = Tile & 0x800; - x = 16 * mx + Scrollx; - y = (16 * my + Scrolly) & 0x1ff; - y -= 16; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - if (!Flipy) { - Render16x16Tile_Mask(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 0x0f, 512, PrehisleBack1Tiles); - } else { - Render16x16Tile_Mask_FlipY(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 0x0f, 512, PrehisleBack1Tiles); - } - } else { - if (!Flipy) { - Render16x16Tile_Mask_Clip(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 0x0f, 512, PrehisleBack1Tiles); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 0x0f, 512, PrehisleBack1Tiles); - } - } - - TileBase ++; - if (TileBase == 0x2000) TileBase = 0; - } - } -} - -void PrehisleRenderSpriteLayer() -{ - INT32 offs; - - for (offs = 0; offs < 0x800; offs += 8) { - INT32 x, y, Sprite, Colour, Flipx, Flipy; - - y = (PrehisleSpriteRam[offs + 1] << 8) + PrehisleSpriteRam[offs + 0]; - if (y > 254) continue; - y -= 16; - x = (PrehisleSpriteRam[offs + 3] << 8) + PrehisleSpriteRam[offs + 2]; - if (x & 0x200) x = -(0xff - (x & 0xff)); - if (x > 256) continue; - - Sprite = (PrehisleSpriteRam[offs + 5] << 8) + PrehisleSpriteRam[offs + 4]; - Colour = ((PrehisleSpriteRam[offs + 7] << 8) + PrehisleSpriteRam[offs + 6]) >> 12; - Flipy = Sprite & 0x8000; - Flipx = Sprite & 0x4000; - Sprite &= 0x1fff; - if (Sprite > 0x13ff) Sprite = 0x13ff; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - if (!Flipy) { - if (!Flipx) { - Render16x16Tile_Mask(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); - } - } else { - if (!Flipx) { - Render16x16Tile_Mask_FlipY(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); - } else { - Render16x16Tile_Mask_FlipXY(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); - } - } - } else { - if (!Flipy) { - if (!Flipx) { - Render16x16Tile_Mask_Clip(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); - } - } else { - if (!Flipx) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); - } - } - } - } -} - -void PrehisleRenderTextLayer() -{ - INT32 offs, mx, my, Colour, Tile, x, y; - - mx = -1; - my = 0; - for (offs = 0x000; offs < 0x800; offs+=2) { - mx++; - if (mx == 32) { - mx = 0; - my++; - } - Tile = (PrehisleVideoRam[offs + 1] << 8) + PrehisleVideoRam[offs + 0]; - Colour = Tile >> 12; - x = 8 * mx; - y = 8 * my; - y -= 16; - - if (x > 7 && x < 248 && y > 7 && y < 216) { - Render8x8Tile_Mask(pTransDraw, Tile & 0xfff, x, y, Colour, 4, 0x0f, 0, PrehisleTextTiles); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Tile & 0xfff, x, y, Colour, 4, 0x0f, 0, PrehisleTextTiles); - } - } -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour >> 12) & 0x0f; - g = (nColour >> 8) & 0x0f; - b = (nColour >> 4) & 0x0f; - - r = (r << 4) | r; - g = (g << 4) | g; - b = (b << 4) | b; - - return BurnHighCol(r, g, b, 0); -} - -INT32 PrehisleCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)PrehislePaletteRam, pd = PrehislePalette; i < 0x800; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } - - return 0; -} - -void PrehisleDraw() -{ - PrehisleCalcPalette(); - PrehisleRenderBack2TileLayer(); - PrehisleRenderBack1TileLayer(); - PrehisleRenderSpriteLayer(); - PrehisleRenderTextLayer(); - BurnTransferCopy(PrehislePalette); -} - -// Frame Function -INT32 PrehisleFrame() -{ - INT32 nInterleave = 1; - - if (PrehisleReset) PrehisleDoReset(); - - PrehisleMakeInputs(); - - nCyclesTotal[0] = 9000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekOpen(0); - ZetOpen(0); - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - UPD7759Update(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) PrehisleDraw(); - - return 0; -} - -// Scan RAM -static INT32 PrehisleScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029521; - } - - if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); // Scan 68000 - ZetScan(nAction); // Scan Z80 - - BurnYM3812Scan(nAction, pnMin); - UPD7759Scan(0, nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(PrehisleInput); - SCAN_VAR(PrehisleDip); - SCAN_VAR(ControlsInvert); - SCAN_VAR(VidControl); - SCAN_VAR(nCyclesDone); - } - - return 0; -} - -// Driver Declarations -struct BurnDriver BurnDrvPrehisle = { - "prehisle", NULL, NULL, NULL, "1989", - "Prehistoric Isle in 1930 (World)\0", NULL, "SNK", "Prehistoric Isle (SNK)", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, PrehisleRomInfo, PrehisleRomName, NULL, NULL, PrehisleInputInfo, PrehisleDIPInfo, - PrehisleInit, PrehisleExit, PrehisleFrame, NULL, PrehisleScan, - NULL, 0x800, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPrehislu = { - "prehisleu", "prehisle", NULL, NULL, "1989", - "Prehistoric Isle in 1930 (US)\0", NULL, "SNK of America", "Prehistoric Isle (SNK)", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, PrehisluRomInfo, PrehisluRomName, NULL, NULL, PrehisleInputInfo, PrehisleDIPInfo, - PrehisleInit, PrehisleExit, PrehisleFrame, NULL, PrehisleScan, - NULL, 0x800, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPrehislk = { - "prehislek", "prehisle", NULL, NULL, "1989", - "Prehistoric Isle in 1930 (Korea)\0", NULL, "SNK (Victor license)", "Prehistoric Isle (SNK)", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, PrehislkRomInfo, PrehislkRomName, NULL, NULL, PrehisleInputInfo, PrehisleDIPInfo, - PrehisleInit, PrehisleExit, PrehisleFrame, NULL, PrehisleScan, - NULL, 0x800, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGensitou = { - "gensitou", "prehisle", NULL, NULL, "1989", - "Genshi-Tou 1930's (Japan)\0", NULL, "SNK", "Prehistoric Isle (SNK)", - L"Genshi-Tou 1930's (Japan)\0\u539F\u59CB\u5CF6 1930's\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, GensitouRomInfo, GensitouRomName, NULL, NULL, PrehisleInputInfo, PrehisleDIPInfo, - PrehisleInit, PrehisleExit, PrehisleFrame, NULL, PrehisleScan, - NULL, 0x800, 256, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "upd7759.h" + +// Input Related Variables +static UINT8 PrehisleInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 PrehisleInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 PrehisleInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 PrehisleDip[2] = {0, 0}; +static UINT8 PrehisleInput[3] = {0x00, 0x00, 0x00}; +static UINT8 PrehisleReset = 0; + +// Memory Holders +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *PrehisleRom = NULL; +static UINT8 *PrehisleZ80Rom = NULL; +static UINT8 *PrehisleTileMapRom = NULL; +static UINT8 *PrehisleADPCMSamples = NULL; +static UINT8 *PrehisleRam = NULL; +static UINT8 *PrehisleVideoRam = NULL; +static UINT8 *PrehisleSpriteRam = NULL; +static UINT8 *PrehisleVideo2Ram = NULL; +static UINT8 *PrehislePaletteRam = NULL; +static UINT8 *PrehisleZ80Ram = NULL; +static UINT32 *PrehislePalette = NULL; +static UINT8 *PrehisleTextTiles = NULL; +static UINT8 *PrehisleSprites = NULL; +static UINT8 *PrehisleBack1Tiles = NULL; +static UINT8 *PrehisleBack2Tiles = NULL; +static UINT8 *PrehisleTempGfx = NULL; + +// Misc Variables, system control values, etc. +static INT32 ControlsInvert; +static UINT16 VidControl[7]; +static INT32 SoundLatch; + +// CPU Interleave Variables +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +// Dip Switch and Input Definitions +static struct BurnInputInfo PrehisleInputList[] = { + {"Coin 1" , BIT_DIGITAL , PrehisleInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , PrehisleInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , PrehisleInputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , PrehisleInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , PrehisleInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , PrehisleInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , PrehisleInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , PrehisleInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , PrehisleInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , PrehisleInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , PrehisleInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , PrehisleInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , PrehisleInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , PrehisleInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , PrehisleInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , PrehisleInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , PrehisleInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , PrehisleInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &PrehisleReset , "reset" }, + {"Service" , BIT_DIGITAL , PrehisleInputPort2 + 2, "service" }, + {"Diagnostics" , BIT_DIGITAL , PrehisleInputPort2 + 3, "diag" }, + {"Tilt" , BIT_DIGITAL , PrehisleInputPort2 + 4, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, PrehisleDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, PrehisleDip + 1 , "dip" }, +}; + +STDINPUTINFO(Prehisle) + +inline void PrehisleClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +inline void PrehisleMakeInputs() +{ + // Reset Inputs + PrehisleInput[0] = PrehisleInput[1] = PrehisleInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + PrehisleInput[0] |= (PrehisleInputPort0[i] & 1) << i; + PrehisleInput[1] |= (PrehisleInputPort1[i] & 1) << i; + PrehisleInput[2] |= (PrehisleInputPort2[i] & 1) << i; + } + + // Clear Opposites + PrehisleClearOpposites(&PrehisleInput[0]); + PrehisleClearOpposites(&PrehisleInput[1]); +} + +static struct BurnDIPInfo PrehisleDIPList[]= +{ + // Default Values + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Display" }, + {0x16, 0x01, 0x01, 0x01, "Normal" }, + {0x16, 0x01, 0x01, 0x00, "Inverse" }, + + {0 , 0xfe, 0 , 2 , "Level Select" }, + {0x16, 0x01, 0x02, 0x02, "Off" }, + {0x16, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Bonus" }, + {0x16, 0x01, 0x04, 0x04, "2nd" }, + {0x16, 0x01, 0x04, 0x00, "Every" }, + +// {0 , 0xfe, 0 , 2 , "Unknown" }, +// {0x16, 0x01, 0x08, 0x08, "Off" }, +// {0x16, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x16, 0x01, 0x30, 0x30, "A 1-1 B 1-1" }, + {0x16, 0x01, 0x30, 0x20, "A 2-1 B 1-2" }, + {0x16, 0x01, 0x30, 0x10, "A 3-1 B 1-3" }, + {0x16, 0x01, 0x30, 0x00, "A 4-1 B 1-4" }, + + {0 , 0xfe, 0 , 4 , "Hero" }, + {0x16, 0x01, 0xc0, 0x80, "2" }, + {0x16, 0x01, 0xc0, 0xc0, "3" }, + {0x16, 0x01, 0xc0, 0x40, "4" }, + {0x16, 0x01, 0xc0, 0x00, "5" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Level" }, + {0x17, 0x01, 0x03, 0x02, "1 (Easy)" }, + {0x17, 0x01, 0x03, 0x03, "2 (Standard)" }, + {0x17, 0x01, 0x03, 0x01, "3 (Middle)" }, + {0x17, 0x01, 0x03, 0x00, "4 (Difficult)" }, + + {0 , 0xfe, 0 , 4 , "Game Mode" }, + {0x17, 0x01, 0x0c, 0x08, "Demo Sound Off" }, + {0x17, 0x01, 0x0c, 0x0c, "Demo Sound On" }, + {0x17, 0x01, 0x0c, 0x00, "Stop Video" }, + {0x17, 0x01, 0x0c, 0x04, "Never Finish" }, + + {0 , 0xfe, 0 , 4 , "Bonus 1st/2nd" }, + {0x17, 0x01, 0x30, 0x30, "100000/200000" }, + {0x17, 0x01, 0x30, 0x20, "150000/300000" }, + {0x17, 0x01, 0x30, 0x10, "300000/500000" }, + {0x17, 0x01, 0x30, 0x00, "No Bonus" }, + + {0 , 0xfe, 0 , 2 , "Continue" }, + {0x17, 0x01, 0x40, 0x00, "Off" }, + {0x17, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Prehisle) + +// Rom Definitions +static struct BurnRomInfo PrehisleRomDesc[] = { + { "gt-e2.2h", 0x20000, 0x7083245a, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "gt-e3.3h", 0x20000, 0x6d8cdf58, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "gt15.b15", 0x08000, 0xac652412, BRF_GRA }, // 2 Text Layer Tiles + { "pi8914.b14", 0x40000, 0x207d6187, BRF_GRA }, // 3 Background2 Layer Tiles + { "pi8916.h16", 0x40000, 0x7cffe0f6, BRF_GRA }, // 4 Background1 Layer Tiles + { "pi8910.k14", 0x80000, 0x5a101b0b, BRF_GRA }, // 5 Sprite Layer Tiles + { "gt5.5", 0x20000, 0x3d3ab273, BRF_GRA }, // 6 Sprite Layer Tiles + { "gt11.11", 0x10000, 0xb4f0fcf0, BRF_GRA }, // 7 Background 2 TileMap + + { "gt1.1", 0x10000, 0x80a4c093, BRF_SND }, // 8 Z80 Program Code + + { "gt4.4", 0x20000, 0x85dfb9ec, BRF_SND }, // 9 ADPCM Samples +}; + + +STD_ROM_PICK(Prehisle) +STD_ROM_FN(Prehisle) + +static struct BurnRomInfo PrehisluRomDesc[] = { + { "gt-u2.2h", 0x20000, 0xa14f49bb, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "gt-u3.3h", 0x20000, 0xf165757e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "gt15.b15", 0x08000, 0xac652412, BRF_GRA }, // 2 Text Layer Tiles + { "pi8914.b14", 0x40000, 0x207d6187, BRF_GRA }, // 3 Background2 Layer Tiles + { "pi8916.h16", 0x40000, 0x7cffe0f6, BRF_GRA }, // 4 Background1 Layer Tiles + { "pi8910.k14", 0x80000, 0x5a101b0b, BRF_GRA }, // 5 Sprite Layer Tiles + { "gt5.5", 0x20000, 0x3d3ab273, BRF_GRA }, // 6 Sprite Layer Tiles + { "gt11.11", 0x10000, 0xb4f0fcf0, BRF_GRA }, // 7 Background 2 TileMap + + { "gt1.1", 0x10000, 0x80a4c093, BRF_SND }, // 8 Z80 Program Code + + { "gt4.4", 0x20000, 0x85dfb9ec, BRF_SND }, // 9 ADPCM Samples +}; + + +STD_ROM_PICK(Prehislu) +STD_ROM_FN(Prehislu) + +static struct BurnRomInfo PrehislkRomDesc[] = { + { "gt-k2.2h", 0x20000, 0xf2d3544d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "gt-k3.3h", 0x20000, 0xebf7439b, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "gt15.b15", 0x08000, 0xac652412, BRF_GRA }, // 2 Text Layer Tiles + { "pi8914.b14", 0x40000, 0x207d6187, BRF_GRA }, // 3 Background2 Layer Tiles + { "pi8916.h16", 0x40000, 0x7cffe0f6, BRF_GRA }, // 4 Background1 Layer Tiles + { "pi8910.k14", 0x80000, 0x5a101b0b, BRF_GRA }, // 5 Sprite Layer Tiles + { "gt5.5", 0x20000, 0x3d3ab273, BRF_GRA }, // 6 Sprite Layer Tiles + { "gt11.11", 0x10000, 0xb4f0fcf0, BRF_GRA }, // 7 Background 2 TileMap + + { "gt1.1", 0x10000, 0x80a4c093, BRF_SND }, // 8 Z80 Program Code + + { "gt4.4", 0x20000, 0x85dfb9ec, BRF_SND }, // 9 ADPCM Samples +}; + + +STD_ROM_PICK(Prehislk) +STD_ROM_FN(Prehislk) + +static struct BurnRomInfo GensitouRomDesc[] = { + { "gt-j2.2h", 0x20000, 0xa2da0b6b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "gt-j3.3h", 0x20000, 0xc1a0ae8e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "gt15.b15", 0x08000, 0xac652412, BRF_GRA }, // 2 Text Layer Tiles + { "pi8914.b14", 0x40000, 0x207d6187, BRF_GRA }, // 3 Background2 Layer Tiles + { "pi8916.h16", 0x40000, 0x7cffe0f6, BRF_GRA }, // 4 Background1 Layer Tiles + { "pi8910.k14", 0x80000, 0x5a101b0b, BRF_GRA }, // 5 Sprite Layer Tiles + { "gt5.5", 0x20000, 0x3d3ab273, BRF_GRA }, // 6 Sprite Layer Tiles + { "gt11.11", 0x10000, 0xb4f0fcf0, BRF_GRA }, // 7 Background 2 TileMap + + { "gt1.1", 0x10000, 0x80a4c093, BRF_SND }, // 8 Z80 Program Code + + { "gt4.4", 0x20000, 0x85dfb9ec, BRF_SND }, // 9 ADPCM Samples +}; + + +STD_ROM_PICK(Gensitou) +STD_ROM_FN(Gensitou) + +// Misc Driver Functions and Memory Handlers +INT32 PrehisleDoReset() +{ + ControlsInvert = 0; + SoundLatch = 0; + VidControl[0] = VidControl[1] = VidControl[2] = VidControl[3] = VidControl[4] = VidControl[5] = VidControl[6] = 0; + + SekOpen(0); + SekReset(); + SekClose(); + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + UPD7759Reset(); + + return 0; +} + +// ---------------------------------------------------------------------------- +// Callbacks for the FM chip + +static void prehisleFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 prehisleSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +// VBlank + +inline UINT16 PrehisleVBlankRegister() +{ + INT32 nCycles = SekTotalCycles(); + + // 262 == approximate number of scanlines on an arcade monitor + if (nCycles >= (262 - 16) * ((9000000 / 60) / 262)) { + return 0x80; + } else { + if (nCycles < (262 - 210 - 16) * ((9000000 / 60) / 262)) { + return 0x80; + } + } + + return 0x00; +} + +UINT16 __fastcall PrehisleReadWord(UINT32 a) +{ + switch (a) { + case 0x0e0010: { + return 0xff - PrehisleInput[1]; + } + + case 0x0e0020: { + return 0xff - PrehisleInput[2]; + } + + case 0x0e0040: { + return 0xff - (PrehisleInput[0] ^ ControlsInvert); + } + + case 0x0e0042: { + return PrehisleDip[0]; + } + + case 0x0e0044: { + return PrehisleDip[1] + PrehisleVBlankRegister(); + } + } + + return 0; +} + +void __fastcall PrehisleWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x0f0000: { + VidControl[0] = d; + return; + } + + case 0x0f0010: { + VidControl[1] = d; + return; + } + + case 0x0f0020: { + VidControl[2] = d; + return; + } + + case 0x0f0030: { + VidControl[3] = d; + return; + } + + case 0x0f0046: { + ControlsInvert = d ? 0xff : 0x00; + return; + } + + case 0x0f0050: { + VidControl[4] = d; + return; + } + + case 0x0f0052: { + VidControl[5] = d; + return; + } + + case 0x0f0060: { + VidControl[6] = d; + return; + } + + case 0x0f0070: { + SoundLatch = d & 0xff; + ZetNmi(); + return; + } + } +} + +UINT8 __fastcall PrehisleZ80PortRead(UINT16 a) +{ + a &= 0xff; + switch (a) { + case 0x00: { + return BurnYM3812Read(0); + } + } + + return 0; +} + +void __fastcall PrehisleZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + switch (a) { + case 0x00: { + BurnYM3812Write(0, d); + return; + } + + case 0x20: { + BurnYM3812Write(1, d); + return; + } + + case 0x40: { + UPD7759PortWrite(0,d); + UPD7759StartWrite(0,0); + UPD7759StartWrite(0,1); + return; + } + + case 0x80: { + UPD7759ResetWrite(0,d); + return; + } + } +} + +UINT8 __fastcall PrehisleZ80Read(UINT16 a) +{ + switch (a) { + case 0xf800: { + return SoundLatch; + } + } + + return 0; +} + +// Function to Allocate and Index required memory +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + PrehisleRom = Next; Next += 0x40000; + PrehisleZ80Rom = Next; Next += 0x10000; + PrehisleTileMapRom = Next; Next += 0x10000; + PrehisleADPCMSamples = Next; Next += 0x20000; + + RamStart = Next; + + PrehisleRam = Next; Next += 0x04000; + PrehisleVideoRam = Next; Next += 0x00800; + PrehisleSpriteRam = Next; Next += 0x00800; + PrehisleVideo2Ram = Next; Next += 0x04000; + PrehislePaletteRam = Next; Next += 0x00800; + PrehisleZ80Ram = Next; Next += 0x00800; + + RamEnd = Next; + + PrehisleTextTiles = Next; Next += (1024 * 8 * 8); + PrehisleSprites = Next; Next += (5120 * 16 * 16); + PrehisleBack1Tiles = Next; Next += (2048 * 16 * 16); + PrehisleBack2Tiles = Next; Next += (2048 * 16 * 16); + PrehislePalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 CharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; +static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 TileXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 512, 516, 520, 524, 528, 532, 536, 540 }; +static INT32 TileYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; + +// Driver Init and Exit Functions +INT32 PrehisleInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + PrehisleTempGfx = (UINT8*)BurnMalloc(0xa0000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(PrehisleRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(PrehisleRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and decode Text Tiles rom + memset(PrehisleTempGfx, 0, 0xa0000); + nRet = BurnLoadRom(PrehisleTempGfx, 2, 1); if (nRet != 0) return 1; + GfxDecode(1024, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, PrehisleTempGfx, PrehisleTextTiles); + + // Load and decode Background2 Tile rom + memset(PrehisleTempGfx, 0, 0xa0000); + nRet = BurnLoadRom(PrehisleTempGfx, 3, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, PrehisleTempGfx, PrehisleBack2Tiles); + + // Load and decode Background1 Tile rom + memset(PrehisleTempGfx, 0, 0xa0000); + nRet = BurnLoadRom(PrehisleTempGfx, 4, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, PrehisleTempGfx, PrehisleBack1Tiles); + + // Load and decode Sprite roms + memset(PrehisleTempGfx, 0, 0xa0000); + nRet = BurnLoadRom(PrehisleTempGfx + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(PrehisleTempGfx + 0x80000, 6, 1); if (nRet != 0) return 1; + GfxDecode(5120, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, PrehisleTempGfx, PrehisleSprites); + + BurnFree(PrehisleTempGfx); + + // Load Background2 Tilemap rom + nRet = BurnLoadRom(PrehisleTileMapRom, 7, 1); if (nRet != 0) return 1; + + // Load Z80 Program rom + nRet = BurnLoadRom(PrehisleZ80Rom, 8, 1); if (nRet != 0) return 1; + + // Load ADPCM Samples + nRet = BurnLoadRom(PrehisleADPCMSamples, 9, 1); if (nRet != 0) return 1; + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(PrehisleRom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(PrehisleRam , 0x070000, 0x073fff, SM_RAM); + SekMapMemory(PrehisleVideoRam , 0x090000, 0x0907ff, SM_RAM); + SekMapMemory(PrehisleSpriteRam , 0x0a0000, 0x0a07ff, SM_RAM); + SekMapMemory(PrehisleVideo2Ram , 0x0b0000, 0x0b3fff, SM_RAM); + SekMapMemory(PrehislePaletteRam, 0x0d0000, 0x0d07ff, SM_RAM); + SekSetReadWordHandler(0, PrehisleReadWord); + SekSetWriteWordHandler(0, PrehisleWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, PrehisleZ80Rom); + ZetMapArea(0x0000, 0xefff, 2, PrehisleZ80Rom); + ZetMapArea(0xf000, 0xf7ff, 0, PrehisleZ80Ram); + ZetMapArea(0xf000, 0xf7ff, 1, PrehisleZ80Ram); + ZetMapArea(0xf000, 0xf7ff, 2, PrehisleZ80Ram); + ZetSetReadHandler(PrehisleZ80Read); + ZetSetInHandler(PrehisleZ80PortRead); + ZetSetOutHandler(PrehisleZ80PortWrite); + ZetClose(); + + BurnYM3812Init(4000000, &prehisleFMIRQHandler, &prehisleSynchroniseStream, 0); + BurnTimerAttachZetYM3812(4000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + UPD7759Init(0, UPD7759_STANDARD_CLOCK, PrehisleADPCMSamples); + UPD7759SetRoute(0, 0.90, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + PrehisleDoReset(); + + return 0; +} + +INT32 PrehisleExit() +{ + BurnYM3812Exit(); + UPD7759Exit(); + + SekExit(); + ZetExit(); + + GenericTilesExit(); + + BurnFree(Mem); + + return 0; +} + +// Graphics Emulation +void PrehisleRenderBack2TileLayer() +{ + INT32 TileBase, mx, my, Tile, Colour, Scrollx, Scrolly, x, y, Flipx; + + TileBase = ((VidControl[3] >> 4) & 0x3ff) * 32; + TileBase &= 0x7fff; + Scrollx = -(VidControl[3] & 0x0f); + Scrolly = -VidControl[2]; + + for (mx = 0; mx < 17; mx++) { + for (my = 0; my < 32; my++) { + Tile = (PrehisleTileMapRom[2 * TileBase + 0] << 8) + PrehisleTileMapRom[2 * TileBase + 1]; + Colour = Tile >> 12; + Flipx = Tile & 0x800; + x = 16 * mx + Scrollx; + y = (16 * my + Scrolly) & 0x1ff; + y -= 16; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + if (!Flipx) { + Render16x16Tile(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 768, PrehisleBack2Tiles); + } else { + Render16x16Tile_FlipX(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 768, PrehisleBack2Tiles); + } + } else { + if (!Flipx) { + Render16x16Tile_Clip(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 768, PrehisleBack2Tiles); + } else { + Render16x16Tile_FlipX_Clip(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 768, PrehisleBack2Tiles); + } + } + + TileBase ++; + if (TileBase == 0x8000) TileBase = 0; + } + } +} + +void PrehisleRenderBack1TileLayer() +{ + INT32 TileBase, mx, my, Tile, Colour, Scrollx, Scrolly, x, y, Flipy; + + TileBase = ((VidControl[1] >> 4) & 0xff) * 32; + TileBase &= 0x1fff; + Scrollx = -(VidControl[1] & 0x0f); + Scrolly = -VidControl[0]; + + for (mx = 0; mx < 17; mx++) { + for (my = 0; my < 32; my++) { + Tile = (PrehisleVideo2Ram[2 * TileBase + 1] << 8) + PrehisleVideo2Ram[2 * TileBase + 0]; + Colour = Tile >> 12; + Flipy = Tile & 0x800; + x = 16 * mx + Scrollx; + y = (16 * my + Scrolly) & 0x1ff; + y -= 16; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + if (!Flipy) { + Render16x16Tile_Mask(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 0x0f, 512, PrehisleBack1Tiles); + } else { + Render16x16Tile_Mask_FlipY(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 0x0f, 512, PrehisleBack1Tiles); + } + } else { + if (!Flipy) { + Render16x16Tile_Mask_Clip(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 0x0f, 512, PrehisleBack1Tiles); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile & 0x7ff, x, y, Colour, 4, 0x0f, 512, PrehisleBack1Tiles); + } + } + + TileBase ++; + if (TileBase == 0x2000) TileBase = 0; + } + } +} + +void PrehisleRenderSpriteLayer() +{ + INT32 offs; + + for (offs = 0; offs < 0x800; offs += 8) { + INT32 x, y, Sprite, Colour, Flipx, Flipy; + + y = (PrehisleSpriteRam[offs + 1] << 8) + PrehisleSpriteRam[offs + 0]; + if (y > 254) continue; + y -= 16; + x = (PrehisleSpriteRam[offs + 3] << 8) + PrehisleSpriteRam[offs + 2]; + if (x & 0x200) x = -(0xff - (x & 0xff)); + if (x > 256) continue; + + Sprite = (PrehisleSpriteRam[offs + 5] << 8) + PrehisleSpriteRam[offs + 4]; + Colour = ((PrehisleSpriteRam[offs + 7] << 8) + PrehisleSpriteRam[offs + 6]) >> 12; + Flipy = Sprite & 0x8000; + Flipx = Sprite & 0x4000; + Sprite &= 0x1fff; + if (Sprite > 0x13ff) Sprite = 0x13ff; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + if (!Flipy) { + if (!Flipx) { + Render16x16Tile_Mask(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); + } + } else { + if (!Flipx) { + Render16x16Tile_Mask_FlipY(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); + } else { + Render16x16Tile_Mask_FlipXY(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); + } + } + } else { + if (!Flipy) { + if (!Flipx) { + Render16x16Tile_Mask_Clip(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); + } + } else { + if (!Flipx) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Sprite, x, y, Colour, 4, 0x0f, 256, PrehisleSprites); + } + } + } + } +} + +void PrehisleRenderTextLayer() +{ + INT32 offs, mx, my, Colour, Tile, x, y; + + mx = -1; + my = 0; + for (offs = 0x000; offs < 0x800; offs+=2) { + mx++; + if (mx == 32) { + mx = 0; + my++; + } + Tile = (PrehisleVideoRam[offs + 1] << 8) + PrehisleVideoRam[offs + 0]; + Colour = Tile >> 12; + x = 8 * mx; + y = 8 * my; + y -= 16; + + if (x > 7 && x < 248 && y > 7 && y < 216) { + Render8x8Tile_Mask(pTransDraw, Tile & 0xfff, x, y, Colour, 4, 0x0f, 0, PrehisleTextTiles); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Tile & 0xfff, x, y, Colour, 4, 0x0f, 0, PrehisleTextTiles); + } + } +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour >> 12) & 0x0f; + g = (nColour >> 8) & 0x0f; + b = (nColour >> 4) & 0x0f; + + r = (r << 4) | r; + g = (g << 4) | g; + b = (b << 4) | b; + + return BurnHighCol(r, g, b, 0); +} + +INT32 PrehisleCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)PrehislePaletteRam, pd = PrehislePalette; i < 0x800; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } + + return 0; +} + +void PrehisleDraw() +{ + PrehisleCalcPalette(); + PrehisleRenderBack2TileLayer(); + PrehisleRenderBack1TileLayer(); + PrehisleRenderSpriteLayer(); + PrehisleRenderTextLayer(); + BurnTransferCopy(PrehislePalette); +} + +// Frame Function +INT32 PrehisleFrame() +{ + INT32 nInterleave = 1; + + if (PrehisleReset) PrehisleDoReset(); + + PrehisleMakeInputs(); + + nCyclesTotal[0] = 9000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekOpen(0); + ZetOpen(0); + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + UPD7759Update(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) PrehisleDraw(); + + return 0; +} + +// Scan RAM +static INT32 PrehisleScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029521; + } + + if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); // Scan 68000 + ZetScan(nAction); // Scan Z80 + + BurnYM3812Scan(nAction, pnMin); + UPD7759Scan(0, nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(PrehisleInput); + SCAN_VAR(PrehisleDip); + SCAN_VAR(ControlsInvert); + SCAN_VAR(VidControl); + SCAN_VAR(nCyclesDone); + } + + return 0; +} + +// Driver Declarations +struct BurnDriver BurnDrvPrehisle = { + "prehisle", NULL, NULL, NULL, "1989", + "Prehistoric Isle in 1930 (World)\0", NULL, "SNK", "Prehistoric Isle (SNK)", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, PrehisleRomInfo, PrehisleRomName, NULL, NULL, PrehisleInputInfo, PrehisleDIPInfo, + PrehisleInit, PrehisleExit, PrehisleFrame, NULL, PrehisleScan, + NULL, 0x800, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPrehislu = { + "prehisleu", "prehisle", NULL, NULL, "1989", + "Prehistoric Isle in 1930 (US)\0", NULL, "SNK of America", "Prehistoric Isle (SNK)", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, PrehisluRomInfo, PrehisluRomName, NULL, NULL, PrehisleInputInfo, PrehisleDIPInfo, + PrehisleInit, PrehisleExit, PrehisleFrame, NULL, PrehisleScan, + NULL, 0x800, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPrehislk = { + "prehislek", "prehisle", NULL, NULL, "1989", + "Prehistoric Isle in 1930 (Korea)\0", NULL, "SNK (Victor license)", "Prehistoric Isle (SNK)", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, PrehislkRomInfo, PrehislkRomName, NULL, NULL, PrehisleInputInfo, PrehisleDIPInfo, + PrehisleInit, PrehisleExit, PrehisleFrame, NULL, PrehisleScan, + NULL, 0x800, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGensitou = { + "gensitou", "prehisle", NULL, NULL, "1989", + "Genshi-Tou 1930's (Japan)\0", NULL, "SNK", "Prehistoric Isle (SNK)", + L"Genshi-Tou 1930's (Japan)\0\u539F\u59CB\u5CF6 1930's\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, GensitouRomInfo, GensitouRomName, NULL, NULL, PrehisleInputInfo, PrehisleDIPInfo, + PrehisleInit, PrehisleExit, PrehisleFrame, NULL, PrehisleScan, + NULL, 0x800, 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_quizo.cpp b/src/burn/drv/pre90s/d_quizo.cpp index e77ede68f..cc99df46f 100644 --- a/src/burn/drv/pre90s/d_quizo.cpp +++ b/src/burn/drv/pre90s/d_quizo.cpp @@ -1,365 +1,364 @@ -// FB Alpha Quiz Olympic driver module -// Based on MAME driver by Tomasz Slanina - -#include "burnint.h" -#include "z80_intf.h" - -#include "driver.h" -extern "C" { -#include "ay8910.h" -} -#include "bitswap.h" - -static UINT8 *Mem, *Rom, *Prom, *RomBank, *VideoRam, *framebuffer; -static UINT8 DrvJoy[8], DrvDips, DrvReset; -static UINT32 *Palette; -static UINT8 port60 = 0, port70 = 0, dirty = 0; - -static INT16* pAY8910Buffer[3]; -static INT16 *pFMBuffer = NULL; - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy + 0, "p1 coin" }, - {"Coin 2", BIT_DIGITAL, DrvJoy + 1, "p1 coin2" }, - {"Start 1", BIT_DIGITAL, DrvJoy + 2, "p1 start" }, - - {"P1 Button 1", BIT_DIGITAL, DrvJoy + 3, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy + 4, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy + 5, "p1 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Tilt", BIT_DIGITAL, DrvJoy + 6, "tilt" }, - {"Dip Switches", BIT_DIPSWITCH, &DrvDips, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[] = -{ - // Defaults - {0x08, 0xFF, 0xFF, 0x40, NULL}, - - {0, 0xFE, 0, 2, "Test mode"}, - {0x08, 0x01, 0x08, 0x00, "Off"}, - {0x08, 0x01, 0x08, 0x08, "On"}, - {0, 0xFE, 0, 2, "Show the answer"}, // look the star - {0x08, 0x01, 0x10, 0x00, "Off"}, - {0x08, 0x01, 0x10, 0x10, "On"}, - {0, 0xFE, 0, 2, "Coin A"}, - {0x08, 0x01, 0x40, 0x00, "2 coins 1 credit"}, - {0x08, 0x01, 0x40, 0x40, "1 coin 1 credit"}, -}; - -STDDIPINFO(Drv) - - -static void quizo_palette_init() -{ - INT32 i; UINT8 *color_prom = Prom; - - for (i = 0;i < 16;i++) - { - INT32 bit0,bit1,bit2,r,g,b; - - bit0 = 0; - bit1 = (*color_prom >> 0) & 0x01; - bit2 = (*color_prom >> 1) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (*color_prom >> 2) & 0x01; - bit1 = (*color_prom >> 3) & 0x01; - bit2 = (*color_prom >> 4) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (*color_prom >> 5) & 0x01; - bit1 = (*color_prom >> 6) & 0x01; - bit2 = (*color_prom >> 7) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - Palette[i] = (r << 16) | (g << 8) | b; - color_prom++; - } -} - - -static INT32 DrvDraw() -{ - INT32 x,y; - UINT32 *src = (UINT32 *)framebuffer; - - if(dirty) - { - for(y=0;y<200;y++) - { - for(x=0;x<80;x++) - { - INT32 data=VideoRam[y*80+x]; - INT32 data1=VideoRam[y*80+x+0x4000]; - INT32 pix; - - pix=(data&1)|(((data>>4)&1)<<1)|((data1&1)<<2)|(((data1>>4)&1)<<3); - src[((x*4+3) + (y * 320))] = Palette[pix&15]; - data>>=1; - data1>>=1; - pix=(data&1)|(((data>>4)&1)<<1)|((data1&1)<<2)|(((data1>>4)&1)<<3); - src[((x*4+2) + (y * 320))] = Palette[pix&15]; - data>>=1; - data1>>=1; - pix=(data&1)|(((data>>4)&1)<<1)|((data1&1)<<2)|(((data1>>4)&1)<<3); - src[((x*4+1) + (y * 320))] = Palette[pix&15]; - data>>=1; - data1>>=1; - pix=(data&1)|(((data>>4)&1)<<1)|((data1&1)<<2)|(((data1>>4)&1)<<3); - src[((x*4+0) + (y * 320))] = Palette[pix&15]; - } - } - } - dirty = 0; - - for (x = 0; x < 320 * 200; x++) { - PutPix(pBurnDraw + x * nBurnBpp, BurnHighCol(src[x]>>16, src[x]>>8, src[x], 0)); - } - - return 0; -} - - -void port60_w(UINT16, UINT8 data) -{ - static const UINT8 rombankLookup[]={ 2, 3, 4, 4, 4, 4, 4, 5, 0, 1}; - - if (data > 9) - { - data=0; - } - - port60 = data; - - ZetMapArea(0x8000, 0xbfff, 0, RomBank + rombankLookup[data] * 0x4000); - ZetMapArea(0x8000, 0xbfff, 2, RomBank + rombankLookup[data] * 0x4000); -} - -void __fastcall quizo_write(UINT16 a, UINT8 data) -{ - if (a >= 0xc000) { - INT32 bank = (port70 & 8) ? 1 : 0; - VideoRam[(a & 0x3fff) + bank * 0x4000] = data; - dirty=1; - return; - } -} - -void __fastcall quizo_out_port(UINT16 a, UINT8 d) -{ - switch (a & 0xff) - { - case 0x50: - AY8910Write(0, 0, d); - break; - - case 0x51: - AY8910Write(0, 1, d); - break; - - case 0x60: - port60_w(0, d); - break; - - case 0x70: - port70 = d; - break; - } -} - -UINT8 __fastcall quizo_in_port(UINT16 a) -{ - switch (a & 0xff) - { - case 0x00: // input port 0 - return (DrvJoy[0] | (DrvJoy[1] << 2) | (DrvJoy[6] << 3) | (DrvJoy[2] << 4)) ^ 0x18; - - case 0x10: // input port 1 - return (DrvJoy[3] | (DrvJoy[4] << 1) | (DrvJoy[5] << 2)) ^ 0xff; - - case 0x40: // input port 2 - return DrvDips; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - dirty = 1; - port70 = port60 = 0; - - DrvReset = 0; - - ZetOpen(0); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - - memset (Rom + 0x4000, 0, 0x0400); - memset (VideoRam, 0, 0x8000); - memset (framebuffer, 0, 320 * 200 * 4); - - return 0; -} - - -static INT32 DrvInit() -{ - Mem = (UINT8*)BurnMalloc(0x30000 + 0x20 + (0x10 * sizeof(INT32)) + 0x3e800); - if (Mem == NULL) { - return 1; - } - - pFMBuffer = (INT16 *)BurnMalloc (nBurnSoundLen * 3 * sizeof(INT16)); - if (pFMBuffer == NULL) { - return 1; - } - - Rom = Mem + 0x00000; - RomBank = Mem + 0x10000; - VideoRam = Mem + 0x28000; - Prom = Mem + 0x30000; - Palette = (UINT32*)(Mem + 0x30020); - framebuffer = Mem + 0x30060; - - if (BurnLoadRom(Rom, 0, 1)) return 1; - memcpy (Rom, Rom + 0x4000, 0x4000); - - if (BurnLoadRom(RomBank + 0x00000, 1, 1)) return 1; - if (BurnLoadRom(RomBank + 0x08000, 2, 1)) return 1; - if (BurnLoadRom(RomBank + 0x10000, 3, 1)) return 1; - - if (BurnLoadRom(Prom, 4, 1)) return 1; - - quizo_palette_init(); - - ZetInit(0); - ZetOpen(0); - ZetSetWriteHandler(quizo_write); - ZetSetInHandler(quizo_in_port); - ZetSetOutHandler(quizo_out_port); - ZetMapArea(0x0000, 0x3fff, 0, Rom + 0x0000); - ZetMapArea(0x0000, 0x3fff, 2, Rom + 0x0000); - ZetMapArea(0x4000, 0x47ff, 0, Rom + 0x4000); - ZetMapArea(0x4000, 0x47ff, 1, Rom + 0x4000); - ZetMemEnd(); - ZetClose(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - - AY8910Init(0, 1342329, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) DrvDoReset(); - - ZetOpen(0); - ZetRun(4000000 / 60); - ZetRaiseIrq(1); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) DrvDraw(); - - return 0; -} - - -static INT32 DrvExit() -{ - BurnFree (Mem); - BurnFree (pFMBuffer); - - Mem = Rom = Prom = RomBank = VideoRam = framebuffer = NULL; - Palette = NULL; - pFMBuffer = NULL; - AY8910Exit(0); - ZetExit(); - - return 0; -} - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = VideoRam; - ba.nLen = 0x08000; - ba.szName = "Video Ram"; - BurnAcb(&ba); - - ba.Data = Rom + 0x4000; - ba.nLen = 0x00400; - ba.szName = "Main Ram"; - BurnAcb(&ba); - - ba.Data = framebuffer; - ba.nLen = 320 * 200 * 4; - ba.szName = "Main Ram"; - BurnAcb(&ba); - - ZetScan(nAction); // Scan Z80 - AY8910Scan(nAction, pnMin); // Scan AY8910 - - // Scan critical driver variables - SCAN_VAR(port60); - SCAN_VAR(port70); - SCAN_VAR(dirty); - - port60_w(0, port60); - } - - return 0; -} - - -// Quiz Olympic - -static struct BurnRomInfo quizoRomDesc[] = { - { "rom1", 0x8000, 0x6731735f, BRF_ESS | BRF_PRG }, // 0 Z80 code - - { "rom2", 0x8000, 0xa700eb30, BRF_ESS | BRF_PRG }, // 1 Z80 code banks - { "rom3", 0x8000, 0xd344f97e, BRF_ESS | BRF_PRG }, // 2 - { "rom4", 0x8000, 0xab1eb174, BRF_ESS | BRF_PRG }, // 3 - - { "82s123", 0x0020, 0xc3f15914, BRF_GRA }, // 4 Color Prom -}; - -STD_ROM_PICK(quizo) -STD_ROM_FN(quizo) - -struct BurnDriver BurnDrvQuizo = { - "quizo", NULL, NULL, NULL, "1985", - "Quiz Olympic\0", NULL, "Seoul Coin Corp.", "Miscellaneous", - L"\uD034\uC988\uC62C\uB9BC\uD53D\0Quiz Olympic\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 1, HARDWARE_MISC_PRE90S, GBF_QUIZ, 0, - NULL, quizoRomInfo, quizoRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, NULL, 0x10, - 320, 200, 4, 3 -}; - +// FB Alpha Quiz Olympic driver module +// Based on MAME driver by Tomasz Slanina + +#include "burnint.h" +#include "z80_intf.h" + +#include "driver.h" +extern "C" { +#include "ay8910.h" +} +#include "bitswap.h" + +static UINT8 *Mem, *Rom, *Prom, *RomBank, *VideoRam, *framebuffer; +static UINT8 DrvJoy[8], DrvDips, DrvReset; +static UINT32 *Palette; +static UINT8 port60 = 0, port70 = 0, dirty = 0; + +static INT16* pAY8910Buffer[3]; +static INT16 *pFMBuffer = NULL; + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy + 0, "p1 coin" }, + {"Coin 2", BIT_DIGITAL, DrvJoy + 1, "p1 coin2" }, + {"Start 1", BIT_DIGITAL, DrvJoy + 2, "p1 start" }, + + {"P1 Button 1", BIT_DIGITAL, DrvJoy + 3, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy + 4, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy + 5, "p1 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Tilt", BIT_DIGITAL, DrvJoy + 6, "tilt" }, + {"Dip Switches", BIT_DIPSWITCH, &DrvDips, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[] = +{ + // Defaults + {0x08, 0xFF, 0xFF, 0x40, NULL}, + + {0, 0xFE, 0, 2, "Test mode"}, + {0x08, 0x01, 0x08, 0x00, "Off"}, + {0x08, 0x01, 0x08, 0x08, "On"}, + {0, 0xFE, 0, 2, "Show the answer"}, // look the star + {0x08, 0x01, 0x10, 0x00, "Off"}, + {0x08, 0x01, 0x10, 0x10, "On"}, + {0, 0xFE, 0, 2, "Coin A"}, + {0x08, 0x01, 0x40, 0x00, "2 coins 1 credit"}, + {0x08, 0x01, 0x40, 0x40, "1 coin 1 credit"}, +}; + +STDDIPINFO(Drv) + + +static void quizo_palette_init() +{ + INT32 i; UINT8 *color_prom = Prom; + + for (i = 0;i < 16;i++) + { + INT32 bit0,bit1,bit2,r,g,b; + + bit0 = 0; + bit1 = (*color_prom >> 0) & 0x01; + bit2 = (*color_prom >> 1) & 0x01; + b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (*color_prom >> 2) & 0x01; + bit1 = (*color_prom >> 3) & 0x01; + bit2 = (*color_prom >> 4) & 0x01; + g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (*color_prom >> 5) & 0x01; + bit1 = (*color_prom >> 6) & 0x01; + bit2 = (*color_prom >> 7) & 0x01; + r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + Palette[i] = (r << 16) | (g << 8) | b; + color_prom++; + } +} + + +static INT32 DrvDraw() +{ + INT32 x,y; + UINT32 *src = (UINT32 *)framebuffer; + + if(dirty) + { + for(y=0;y<200;y++) + { + for(x=0;x<80;x++) + { + INT32 data=VideoRam[y*80+x]; + INT32 data1=VideoRam[y*80+x+0x4000]; + INT32 pix; + + pix=(data&1)|(((data>>4)&1)<<1)|((data1&1)<<2)|(((data1>>4)&1)<<3); + src[((x*4+3) + (y * 320))] = Palette[pix&15]; + data>>=1; + data1>>=1; + pix=(data&1)|(((data>>4)&1)<<1)|((data1&1)<<2)|(((data1>>4)&1)<<3); + src[((x*4+2) + (y * 320))] = Palette[pix&15]; + data>>=1; + data1>>=1; + pix=(data&1)|(((data>>4)&1)<<1)|((data1&1)<<2)|(((data1>>4)&1)<<3); + src[((x*4+1) + (y * 320))] = Palette[pix&15]; + data>>=1; + data1>>=1; + pix=(data&1)|(((data>>4)&1)<<1)|((data1&1)<<2)|(((data1>>4)&1)<<3); + src[((x*4+0) + (y * 320))] = Palette[pix&15]; + } + } + } + dirty = 0; + + for (x = 0; x < 320 * 200; x++) { + PutPix(pBurnDraw + x * nBurnBpp, BurnHighCol(src[x]>>16, src[x]>>8, src[x], 0)); + } + + return 0; +} + + +void port60_w(UINT16, UINT8 data) +{ + static const UINT8 rombankLookup[]={ 2, 3, 4, 4, 4, 4, 4, 5, 0, 1}; + + if (data > 9) + { + data=0; + } + + port60 = data; + + ZetMapArea(0x8000, 0xbfff, 0, RomBank + rombankLookup[data] * 0x4000); + ZetMapArea(0x8000, 0xbfff, 2, RomBank + rombankLookup[data] * 0x4000); +} + +void __fastcall quizo_write(UINT16 a, UINT8 data) +{ + if (a >= 0xc000) { + INT32 bank = (port70 & 8) ? 1 : 0; + VideoRam[(a & 0x3fff) + bank * 0x4000] = data; + dirty=1; + return; + } +} + +void __fastcall quizo_out_port(UINT16 a, UINT8 d) +{ + switch (a & 0xff) + { + case 0x50: + AY8910Write(0, 0, d); + break; + + case 0x51: + AY8910Write(0, 1, d); + break; + + case 0x60: + port60_w(0, d); + break; + + case 0x70: + port70 = d; + break; + } +} + +UINT8 __fastcall quizo_in_port(UINT16 a) +{ + switch (a & 0xff) + { + case 0x00: // input port 0 + return (DrvJoy[0] | (DrvJoy[1] << 2) | (DrvJoy[6] << 3) | (DrvJoy[2] << 4)) ^ 0x18; + + case 0x10: // input port 1 + return (DrvJoy[3] | (DrvJoy[4] << 1) | (DrvJoy[5] << 2)) ^ 0xff; + + case 0x40: // input port 2 + return DrvDips; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + dirty = 1; + port70 = port60 = 0; + + DrvReset = 0; + + ZetOpen(0); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + + memset (Rom + 0x4000, 0, 0x0400); + memset (VideoRam, 0, 0x8000); + memset (framebuffer, 0, 320 * 200 * 4); + + return 0; +} + + +static INT32 DrvInit() +{ + Mem = (UINT8*)BurnMalloc(0x30000 + 0x20 + (0x10 * sizeof(INT32)) + 0x3e800); + if (Mem == NULL) { + return 1; + } + + pFMBuffer = (INT16 *)BurnMalloc (nBurnSoundLen * 3 * sizeof(INT16)); + if (pFMBuffer == NULL) { + return 1; + } + + Rom = Mem + 0x00000; + RomBank = Mem + 0x10000; + VideoRam = Mem + 0x28000; + Prom = Mem + 0x30000; + Palette = (UINT32*)(Mem + 0x30020); + framebuffer = Mem + 0x30060; + + if (BurnLoadRom(Rom, 0, 1)) return 1; + memcpy (Rom, Rom + 0x4000, 0x4000); + + if (BurnLoadRom(RomBank + 0x00000, 1, 1)) return 1; + if (BurnLoadRom(RomBank + 0x08000, 2, 1)) return 1; + if (BurnLoadRom(RomBank + 0x10000, 3, 1)) return 1; + + if (BurnLoadRom(Prom, 4, 1)) return 1; + + quizo_palette_init(); + + ZetInit(0); + ZetOpen(0); + ZetSetWriteHandler(quizo_write); + ZetSetInHandler(quizo_in_port); + ZetSetOutHandler(quizo_out_port); + ZetMapArea(0x0000, 0x3fff, 0, Rom + 0x0000); + ZetMapArea(0x0000, 0x3fff, 2, Rom + 0x0000); + ZetMapArea(0x4000, 0x47ff, 0, Rom + 0x4000); + ZetMapArea(0x4000, 0x47ff, 1, Rom + 0x4000); + ZetClose(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + + AY8910Init(0, 1342329, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) DrvDoReset(); + + ZetOpen(0); + ZetRun(4000000 / 60); + ZetRaiseIrq(1); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) DrvDraw(); + + return 0; +} + + +static INT32 DrvExit() +{ + BurnFree (Mem); + BurnFree (pFMBuffer); + + Mem = Rom = Prom = RomBank = VideoRam = framebuffer = NULL; + Palette = NULL; + pFMBuffer = NULL; + AY8910Exit(0); + ZetExit(); + + return 0; +} + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = VideoRam; + ba.nLen = 0x08000; + ba.szName = "Video Ram"; + BurnAcb(&ba); + + ba.Data = Rom + 0x4000; + ba.nLen = 0x00400; + ba.szName = "Main Ram"; + BurnAcb(&ba); + + ba.Data = framebuffer; + ba.nLen = 320 * 200 * 4; + ba.szName = "Main Ram"; + BurnAcb(&ba); + + ZetScan(nAction); // Scan Z80 + AY8910Scan(nAction, pnMin); // Scan AY8910 + + // Scan critical driver variables + SCAN_VAR(port60); + SCAN_VAR(port70); + SCAN_VAR(dirty); + + port60_w(0, port60); + } + + return 0; +} + + +// Quiz Olympic + +static struct BurnRomInfo quizoRomDesc[] = { + { "rom1", 0x8000, 0x6731735f, BRF_ESS | BRF_PRG }, // 0 Z80 code + + { "rom2", 0x8000, 0xa700eb30, BRF_ESS | BRF_PRG }, // 1 Z80 code banks + { "rom3", 0x8000, 0xd344f97e, BRF_ESS | BRF_PRG }, // 2 + { "rom4", 0x8000, 0xab1eb174, BRF_ESS | BRF_PRG }, // 3 + + { "82s123", 0x0020, 0xc3f15914, BRF_GRA }, // 4 Color Prom +}; + +STD_ROM_PICK(quizo) +STD_ROM_FN(quizo) + +struct BurnDriver BurnDrvQuizo = { + "quizo", NULL, NULL, NULL, "1985", + "Quiz Olympic\0", NULL, "Seoul Coin Corp.", "Miscellaneous", + L"\uD034\uC988\uC62C\uB9BC\uD53D\0Quiz Olympic\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 1, HARDWARE_MISC_PRE90S, GBF_QUIZ, 0, + NULL, quizoRomInfo, quizoRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, NULL, 0x10, + 320, 200, 4, 3 +}; + diff --git a/src/burn/drv/pre90s/d_rallyx.cpp b/src/burn/drv/pre90s/d_rallyx.cpp index aca56201b..1377defde 100644 --- a/src/burn/drv/pre90s/d_rallyx.cpp +++ b/src/burn/drv/pre90s/d_rallyx.cpp @@ -1,1544 +1,1542 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "namco_snd.h" -#include "samples.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[2] = {0, 0}; -static UINT8 DrvInput[3] = {0, 0, 0}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *DrvZ80Rom1 = NULL; -static UINT8 *DrvZ80Rom2 = NULL; -static UINT8 *DrvZ80Ram1 = NULL; -static UINT8 *DrvZ80Ram2 = NULL; -static UINT8 *DrvVideoRam = NULL; -static UINT8 *DrvRadarAttrRam = NULL; -static UINT8 *DrvPromPalette = NULL; -static UINT8 *DrvPromLookup = NULL; -static UINT8 *DrvPromVidLayout = NULL; -static UINT8 *DrvPromVidTiming = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvDots = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT8 DrvCPUFireIRQ; -static UINT8 DrvCPUIRQVector; -static UINT8 xScroll; -static UINT8 yScroll; -static UINT8 DrvLastBang; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo DrvInputList[] = -{ - { "Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - { "Start 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 start" }, - { "Coin 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 coin" }, - { "Start 2" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 start" }, - - { "Up" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 up" }, - { "Down" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 down" }, - { "Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - { "Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - { "Fire 1" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 fire 1" }, - - { "Up (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 up" }, - { "Down (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 down" }, - { "Left (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - { "Right (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - { "Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 fire 1" }, - - { "Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - { "Service" , BIT_DIGITAL , DrvInputPort0 + 0, "service" }, - { "Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - { "Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo JunglerInputList[] = -{ - { "Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, - { "Start 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 start" }, - { "Coin 2" , BIT_DIGITAL , DrvInputPort0 + 6, "p2 coin" }, - { "Start 2" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 start" }, - - { "Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - { "Down" , BIT_DIGITAL , DrvInputPort2 + 7, "p1 down" }, - { "Left" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 left" }, - { "Right" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 right" }, - { "Fire 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 fire 1" }, - - { "Up (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - { "Down (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - { "Left (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 left" }, - { "Right (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 right" }, - { "Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 fire 1" }, - - { "Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - { "Service" , BIT_DIGITAL , DrvInputPort0 + 2, "service" }, - { "Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, -}; - -STDINPUTINFO(Jungler) - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = 0xff; - DrvInput[1] = 0xfe; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] -= (DrvInputPort0[i] & 1) << i; - DrvInput[1] -= (DrvInputPort1[i] & 1) << i; - } -} - -static inline void JunglerMakeInputs() -{ - // Reset Inputs - DrvInput[0] = 0xff; - DrvInput[1] = 0xff; - DrvInput[2] = 0xff; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] -= (DrvInputPort0[i] & 1) << i; - DrvInput[1] -= (DrvInputPort1[i] & 1) << i; - DrvInput[2] -= (DrvInputPort1[i] & 1) << i; - } -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x01, NULL }, - {0x11, 0xff, 0xff, 0xcb, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x01, 0x00, "Cocktail" }, - {0x10, 0x01, 0x01, 0x01, "Upright" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, // This is conditional on difficulty - {0x11, 0x01, 0x06, 0x02, "15000" }, - {0x11, 0x01, 0x06, 0x04, "30000" }, - {0x11, 0x01, 0x06, 0x06, "40000" }, - {0x11, 0x01, 0x06, 0x00, "None" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x11, 0x01, 0x38, 0x10, "1 Car, Medium" }, - {0x11, 0x01, 0x38, 0x28, "1 Car, Hard" }, - {0x11, 0x01, 0x38, 0x00, "2 Cars, Easy" }, - {0x11, 0x01, 0x38, 0x18, "2 Cars, Medium" }, - {0x11, 0x01, 0x38, 0x30, "2 Cars, Hard" }, - {0x11, 0x01, 0x38, 0x08, "3 Cars, Easy" }, - {0x11, 0x01, 0x38, 0x20, "3 Cars, Medium" }, - {0x11, 0x01, 0x38, 0x38, "3 Cars, Hard" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - {0x11, 0x01, 0xc0, 0x00, "Freeplay" }, -}; - -STDDIPINFO(Drv) - -static struct BurnDIPInfo JunglerDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0xbf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x10, 0x01, 0x07, 0x01, "4 Coins 1 Play" }, - {0x10, 0x01, 0x07, 0x02, "3 Coins 1 Play" }, - {0x10, 0x01, 0x07, 0x03, "2 Coins 1 Play" }, - {0x10, 0x01, 0x07, 0x00, "4 Coins 3 Plays" }, - {0x10, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, - {0x10, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, - {0x10, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, - {0x10, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x10, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, - {0x10, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, - {0x10, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, - {0x10, 0x01, 0x38, 0x00, "4 Coins 3 Plays" }, - {0x10, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, - {0x10, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, - {0x10, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, - {0x10, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x40, 0x40, "Cocktail" }, - {0x10, 0x01, 0x40, 0x00, "Upright" }, - - {0 , 0xfe, 0 , 2 , "Test Mode (255 lives)" }, - {0x10, 0x01, 0x80, 0x80, "Off" }, - {0x10, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Jungler) - -static struct BurnRomInfo RallyxRomDesc[] = { - { "1b", 0x01000, 0x5882700d, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "rallyxn.1e", 0x01000, 0xed1eba2b, BRF_ESS | BRF_PRG }, // 1 - { "rallyxn.1h", 0x01000, 0x4f98dd1c, BRF_ESS | BRF_PRG }, // 2 - { "rallyxn.1k", 0x01000, 0x9aacccf0, BRF_ESS | BRF_PRG }, // 3 - - { "8e", 0x01000, 0x277c1de5, BRF_GRA }, // 4 Characters & Sprites - - { "rx1-6.8m", 0x00100, 0x3c16f62c, BRF_GRA }, // 5 Dots - - { "rx1-1.11n", 0x00020, 0xc7865434, BRF_GRA }, // 6 Palette PROM - { "rx1-7.8p", 0x00100, 0x834d4fda, BRF_GRA }, // 7 Lookup PROM - { "rx1-2.4n", 0x00020, 0x8f574815, BRF_GRA }, // 8 Video Layout PROM - { "rx1-3.7k", 0x00020, 0xb8861096, BRF_GRA }, // 9 Video Timing PROM - - { "rx1-5.3p", 0x00100, 0x4bad7017, BRF_SND }, // 10 Sound PROMs - { "rx1-4.2m", 0x00100, 0x77245b66, BRF_SND }, // 11 -}; - -STD_ROM_PICK(Rallyx) -STD_ROM_FN(Rallyx) - -static struct BurnRomInfo RallyxaRomDesc[] = { - { "rx1_prg_1.1b", 0x00800, 0xef9238db, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "rx1_prg_2.1c", 0x00800, 0x7cbeb656, BRF_ESS | BRF_PRG }, // 1 - { "rx1_prg_3.1d", 0x00800, 0x334b1042, BRF_ESS | BRF_PRG }, // 2 - { "rx1_prg_4.1e", 0x00800, 0xd6618add, BRF_ESS | BRF_PRG }, // 3 - { "rx1_prg_5.bin", 0x00800, 0x3d69f24e, BRF_ESS | BRF_PRG }, // 4 - { "rx1_prg_6.bin", 0x00800, 0xe9740f16, BRF_ESS | BRF_PRG }, // 5 - { "rx1_prg_7.1k", 0x00800, 0x843109f2, BRF_ESS | BRF_PRG }, // 6 - { "rx1_prg_8.1l", 0x00800, 0x9b846ec9, BRF_ESS | BRF_PRG }, // 7 - - { "rx1_chg_1.8e", 0x00800, 0x1fff38a4, BRF_GRA }, // 8 Characters & Sprites - { "rx1_chg_2.8d", 0x00800, 0x68dff552, BRF_GRA }, // 9 - - { "rx1-6.8m", 0x00100, 0x3c16f62c, BRF_GRA }, // 10 Dots - - { "rx1-1.11n", 0x00020, 0xc7865434, BRF_GRA }, // 11 Palette PROM - { "rx1-7.8p", 0x00100, 0x834d4fda, BRF_GRA }, // 12 Lookup PROM - { "rx1-2.4n", 0x00020, 0x8f574815, BRF_GRA }, // 13 Video Layout PROM - { "rx1-3.7k", 0x00020, 0xb8861096, BRF_GRA }, // 14 Video Timing PROM - - { "rx1-5.3p", 0x00100, 0x4bad7017, BRF_SND }, // 15 Sound PROMs - { "rx1-4.2m", 0x00100, 0x77245b66, BRF_SND }, // 16 -}; - -STD_ROM_PICK(Rallyxa) -STD_ROM_FN(Rallyxa) - -static struct BurnRomInfo RallyxmRomDesc[] = { - { "1b", 0x01000, 0x5882700d, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "1e", 0x01000, 0x786585ec, BRF_ESS | BRF_PRG }, // 1 - { "1h", 0x01000, 0x110d7dcd, BRF_ESS | BRF_PRG }, // 2 - { "1k", 0x01000, 0x473ab447, BRF_ESS | BRF_PRG }, // 3 - - { "8e", 0x01000, 0x277c1de5, BRF_GRA }, // 4 Characters & Sprites - - { "rx1-6.8m", 0x00100, 0x3c16f62c, BRF_GRA }, // 5 Dots - - { "rx1-1.11n", 0x00020, 0xc7865434, BRF_GRA }, // 6 Palette PROM - { "rx1-7.8p", 0x00100, 0x834d4fda, BRF_GRA }, // 7 Lookup PROM - { "rx1-2.4n", 0x00020, 0x8f574815, BRF_GRA }, // 8 Video Layout PROM - { "rx1-3.7k", 0x00020, 0xb8861096, BRF_GRA }, // 9 Video Timing PROM - - { "rx1-5.3p", 0x00100, 0x4bad7017, BRF_SND }, // 10 Sound PROMs - { "rx1-4.2m", 0x00100, 0x77245b66, BRF_SND }, // 11 -}; - -STD_ROM_PICK(Rallyxm) -STD_ROM_FN(Rallyxm) - -static struct BurnRomInfo NrallyxRomDesc[] = { - { "nrx_prg1.1d", 0x01000, 0xba7de9fc, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - { "nrx_prg2.1e", 0x01000, 0xeedfccae, BRF_ESS | BRF_PRG }, // 1 - { "nrx_prg3.1k", 0x01000, 0xb4d5d34a, BRF_ESS | BRF_PRG }, // 2 - { "nrx_prg4.1l", 0x01000, 0x7da5496d, BRF_ESS | BRF_PRG }, // 3 - - { "nrx_chg1.8e", 0x00800, 0x1fff38a4, BRF_GRA }, // 4 Characters & Sprites - { "nrx_chg2.8d", 0x00800, 0x85d9fffd, BRF_GRA }, // 5 - - { "rx1-6.8m", 0x00100, 0x3c16f62c, BRF_GRA }, // 6 Dots - - { "nrx1-1.11n", 0x00020, 0xa0a49017, BRF_GRA }, // 7 Palette PROM - { "nrx1-7.8p", 0x00100, 0x4e46f485, BRF_GRA }, // 8 Lookup PROM - { "rx1-2.4n", 0x00020, 0x8f574815, BRF_GRA }, // 9 Video Layout PROM - { "rx1-3.7k", 0x00020, 0xb8861096, BRF_GRA }, // 10 Video Timing PROM - - { "rx1-5.3p", 0x00100, 0x4bad7017, BRF_SND }, // 11 Sound PROMs - { "rx1-4.2m", 0x00100, 0x77245b66, BRF_SND }, // 12 -}; - -STD_ROM_PICK(Nrallyx) -STD_ROM_FN(Nrallyx) - - - - -static struct BurnRomInfo JunglerRomDesc[] = { - { "jungr1", 0x01000, 0x5bd6ad15, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code #1 - { "jungr2", 0x01000, 0xdc99f1e3, BRF_ESS | BRF_PRG }, // 1 - { "jungr3", 0x01000, 0x3dcc03da, BRF_ESS | BRF_PRG }, // 2 - { "jungr4", 0x01000, 0xf92e9940, BRF_ESS | BRF_PRG }, // 3 - - { "1b", 0x01000, 0xf86999c3, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code #2 - - { "5k", 0x00800, 0x924262bf, BRF_GRA }, // 5 Characters & Sprites - { "5m", 0x00800, 0x131a08ac, BRF_GRA }, // 6 - - { "82s129.10g", 0x00100, 0xc59c51b7, BRF_GRA }, // 7 Dots - - { "18s030.8b", 0x00020, 0x55a7e6d1, BRF_GRA }, // 8 Palette PROM - { "tbp24s10.9d", 0x00100, 0xd223f7b8, BRF_GRA }, // 9 Lookup PROM - { "18s030.7a", 0x00020, 0x8f574815, BRF_GRA }, // 10 Video Layout PROM - { "6331-1.10a", 0x00020, 0xb8861096, BRF_GRA }, // 11 Video Timing PROM -}; - -STD_ROM_PICK(Jungler) -STD_ROM_FN(Jungler) - -static struct BurnSampleInfo RallyxSampleDesc[] = { -#if !defined (ROM_VERIFY) - { "bang.wav", SAMPLE_NOLOOP }, -#else - { "bang", SAMPLE_NOLOOP }, -#endif - { "", 0 } -}; - -STD_SAMPLE_PICK(Rallyx) -STD_SAMPLE_FN(Rallyx) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom1 = Next; Next += 0x04000; - DrvPromPalette = Next; Next += 0x00020; - DrvPromLookup = Next; Next += 0x00100; - DrvPromVidLayout = Next; Next += 0x00020; - DrvPromVidTiming = Next; Next += 0x00020; - NamcoSoundProm = Next; Next += 0x00100; - - RamStart = Next; - - DrvZ80Ram1 = Next; Next += 0x00800; - DrvVideoRam = Next; Next += 0x01000; - DrvRadarAttrRam = Next; Next += 0x00010; - - RamEnd = Next; - - DrvChars = Next; Next += 0x100 * 8 * 8; - DrvSprites = Next; Next += 0x040 * 16 * 16; - DrvDots = Next; Next += 0x008 * 4 * 4; - DrvPalette = (UINT32*)Next; Next += 260 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 JunglerMemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom1 = Next; Next += 0x08000; - DrvZ80Rom2 = Next; Next += 0x02000; - DrvPromPalette = Next; Next += 0x00020; - DrvPromLookup = Next; Next += 0x00100; - DrvPromVidLayout = Next; Next += 0x00020; - DrvPromVidTiming = Next; Next += 0x00020; - - RamStart = Next; - - DrvZ80Ram1 = Next; Next += 0x00800; - DrvZ80Ram2 = Next; Next += 0x00400; - DrvVideoRam = Next; Next += 0x01000; - DrvRadarAttrRam = Next; Next += 0x00010; - - RamEnd = Next; - - DrvChars = Next; Next += 0x100 * 8 * 8; - DrvSprites = Next; Next += 0x040 * 16 * 16; - DrvDots = Next; Next += 0x008 * 4 * 4; - DrvPalette = (UINT32*)Next; Next += 324 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnSampleReset(); - - DrvCPUFireIRQ = 0; - DrvCPUIRQVector = 0; - xScroll = 0; - yScroll = 0; - DrvLastBang = 0; - - return 0; -} - -static INT32 JunglerDoReset() -{ - ZetOpen(0); - ZetReset(); - ZetClose(); - - DrvCPUFireIRQ = 0; - DrvCPUIRQVector = 0; - xScroll = 0; - yScroll = 0; - - return 0; -} - -UINT8 __fastcall RallyxZ80ProgRead(UINT16 a) -{ - switch (a) { - case 0xa000: { - return DrvInput[0]; - } - - case 0xa080: { - return DrvInput[1] | DrvDip[0]; - } - - case 0xa100: { - return DrvDip[1]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read %04x\n"), a); - } - } - - return 0; -} - -void __fastcall RallyxZ80ProgWrite(UINT16 a, UINT8 d) -{ - if (a >= 0xa100 && a <= 0xa11f) { NamcoSoundWrite(a - 0xa100, d); return; } - - switch (a) { - case 0xa080: { - // watchdog write - return; - } - - case 0xa130: { - xScroll = d; - return; - } - - case 0xa140: { - yScroll = d; - return; - } - - case 0xa170: { - // NOP - return; - } - - case 0xa180: { - UINT8 Bit = d & 0x01; - if (Bit == 0 && DrvLastBang != 0) { - BurnSamplePlay(0); - } - DrvLastBang = Bit; - return; - } - - case 0xa181: { - DrvCPUFireIRQ = d & 0x01; - if (!DrvCPUFireIRQ) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return; - } - - case 0xa182: { - // sound on - return; - } - - case 0xa183: { - // flip screen !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - return; - } - - case 0xa184: { - // lamp - return; - } - - case 0xa185: { - // lamp - return; - } - - case 0xa186: { - // coin lockout - return; - } - - case 0xa187: { - // coin counter - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write %04x, %02x\n"), a, d); - } - } -} - -UINT8 __fastcall RallyxZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall RallyxZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - DrvCPUIRQVector = d; - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall JunglerZ80ProgRead1(UINT16 a) -{ - switch (a) { - case 0xa000: { - return DrvInput[0]; - } - - case 0xa080: { - return DrvInput[1]; - } - - case 0xa100: { - return DrvInput[2]; - } - - case 0xa180: { - return DrvDip[0]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read %04x\n"), a); - } - } - - return 0; -} - -void __fastcall JunglerZ80ProgWrite1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xa080: { - // watchdog write - return; - } - - case 0xa130: { - xScroll = d; - return; - } - - case 0xa140: { - yScroll = d; - return; - } - - case 0xa181: { - DrvCPUFireIRQ = d & 0x01; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write %04x, %02x\n"), a, d); - } - } -} - -UINT8 __fastcall JunglerZ80PortRead1(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall JunglerZ80PortWrite1(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall JunglerZ80ProgRead2(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read %04x\n"), a); - } - } - - return 0; -} - -void __fastcall JunglerZ80ProgWrite2(UINT16 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Write %04x, %02x\n"), a, d); - } - } -} - -UINT8 __fastcall JunglerZ80PortRead2(UINT16 a) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall JunglerZ80PortWrite2(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); - } - } -} - -static INT32 CharPlaneOffsets[2] = { 0, 4 }; -static INT32 CharXOffsets[8] = { 64, 65, 66, 67, 0, 1, 2, 3 }; -static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 JunglerCharPlaneOffsets[2] = { 4, 0 }; -static INT32 SpritePlaneOffsets[2] = { 0, 4 }; -static INT32 SpriteXOffsets[16] = { 64, 65, 66, 67, 128, 129, 130, 131, 192, 193, 194, 195, 0, 1, 2, 3 }; -static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 256, 264, 272, 280, 288, 296, 304, 312 }; -static INT32 JunglerSpritePlaneOffsets[2] = { 4, 0 }; -static INT32 JunglerSpriteXOffsets[16] = { 64, 65, 66, 67, 0, 1, 2, 3, 192, 193, 194, 195, 128, 129, 130, 131 }; -static INT32 DotPlaneOffsets[2] = { 6, 7 }; -static INT32 DotXOffsets[4] = { 0, 8, 16, 24 }; -static INT32 DotYOffsets[4] = { 0, 32, 64, 96 }; - -static void MachineInit() -{ - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(RallyxZ80ProgRead); - ZetSetWriteHandler(RallyxZ80ProgWrite); - ZetSetInHandler(RallyxZ80PortRead); - ZetSetOutHandler(RallyxZ80PortWrite); - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom1); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom1); - ZetMapArea(0x8000, 0x8fff, 0, DrvVideoRam); - ZetMapArea(0x8000, 0x8fff, 1, DrvVideoRam); - ZetMapArea(0x8000, 0x8fff, 2, DrvVideoRam); - ZetMapArea(0x9800, 0x9fff, 0, DrvZ80Ram1); - ZetMapArea(0x9800, 0x9fff, 1, DrvZ80Ram1); - ZetMapArea(0x9800, 0x9fff, 2, DrvZ80Ram1); - ZetMapArea(0xa000, 0xa00f, 1, DrvRadarAttrRam); - ZetMemEnd(); - ZetClose(); - - NamcoSoundInit(18432000 / 6 / 32, 3); - NacmoSoundSetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - BurnSampleInit(0); - BurnSampleSetAllRoutesAllSamples(0.80, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); -} - -static void JunglerMachineInit() -{ - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(JunglerZ80ProgRead1); - ZetSetWriteHandler(JunglerZ80ProgWrite1); - ZetSetInHandler(JunglerZ80PortRead1); - ZetSetOutHandler(JunglerZ80PortWrite1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1); - ZetMapArea(0x8000, 0x8fff, 0, DrvVideoRam); - ZetMapArea(0x8000, 0x8fff, 1, DrvVideoRam); - ZetMapArea(0x8000, 0x8fff, 2, DrvVideoRam); - ZetMapArea(0x9800, 0x9fff, 0, DrvZ80Ram1); - ZetMapArea(0x9800, 0x9fff, 1, DrvZ80Ram1); - ZetMapArea(0x9800, 0x9fff, 2, DrvZ80Ram1); - ZetMapArea(0xa000, 0xa00f, 1, DrvRadarAttrRam); - ZetMapArea(0xa030, 0xa03f, 1, DrvRadarAttrRam); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - // not used? - - GenericTilesInit(); - - JunglerDoReset(); -} - -static INT32 DrvInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x01000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x01000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x02000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x03000, 3, 1); if (nRet != 0) return 1; - - // Load and decode the chars and sprites - nRet = BurnLoadRom(DrvTempRom, 4, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(0x40, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the dots - memset(DrvTempRom, 0, 0x1000); - nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x08, 2, 4, 4, DotPlaneOffsets, DotXOffsets, DotYOffsets, 0x80, DrvTempRom, DrvDots); - - // Load the PROMs - nRet = BurnLoadRom(DrvPromPalette, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromLookup, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromVidLayout, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromVidTiming, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(NamcoSoundProm, 10, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - MachineInit(); - - return 0; -} - -static INT32 DrvaInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x01000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00800, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x01000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x01800, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x02000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x02800, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x03000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x03800, 7, 1); if (nRet != 0) return 1; - - // Load and decode the chars and sprites - nRet = BurnLoadRom(DrvTempRom + 0x0000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0800, 9, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(0x40, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the dots - memset(DrvTempRom, 0, 0x1000); - nRet = BurnLoadRom(DrvTempRom, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x08, 2, 4, 4, DotPlaneOffsets, DotXOffsets, DotYOffsets, 0x80, DrvTempRom, DrvDots); - - // Load the PROMs - nRet = BurnLoadRom(DrvPromPalette, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromLookup, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromVidLayout, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromVidTiming, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(NamcoSoundProm, 15, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - MachineInit(); - - return 0; -} - -static INT32 NrallyxInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x01000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvTempRom, 0, 1); if (nRet != 0) return 1; - memcpy(DrvZ80Rom1 + 0x0000, DrvTempRom + 0x0000, 0x800); - memcpy(DrvZ80Rom1 + 0x1000, DrvTempRom + 0x0800, 0x800); - nRet = BurnLoadRom(DrvTempRom, 1, 1); if (nRet != 0) return 1; - memcpy(DrvZ80Rom1 + 0x0800, DrvTempRom + 0x0000, 0x800); - memcpy(DrvZ80Rom1 + 0x1800, DrvTempRom + 0x0800, 0x800); - nRet = BurnLoadRom(DrvTempRom, 2, 1); if (nRet != 0) return 1; - memcpy(DrvZ80Rom1 + 0x2000, DrvTempRom + 0x0000, 0x800); - memcpy(DrvZ80Rom1 + 0x3000, DrvTempRom + 0x0800, 0x800); - nRet = BurnLoadRom(DrvTempRom, 3, 1); if (nRet != 0) return 1; - memcpy(DrvZ80Rom1 + 0x2800, DrvTempRom + 0x0000, 0x800); - memcpy(DrvZ80Rom1 + 0x3800, DrvTempRom + 0x0800, 0x800); - - // Load and decode the chars and sprites - memset(DrvTempRom, 0, 0x1000); - nRet = BurnLoadRom(DrvTempRom + 0x0000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0800, 5, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(0x40, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the dots - memset(DrvTempRom, 0, 0x1000); - nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x08, 2, 4, 4, DotPlaneOffsets, DotXOffsets, DotYOffsets, 0x80, DrvTempRom, DrvDots); - - // Load the PROMs - nRet = BurnLoadRom(DrvPromPalette, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromLookup, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromVidLayout, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromVidTiming, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(NamcoSoundProm, 11, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - MachineInit(); - - return 0; -} - -static INT32 JunglerInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - JunglerMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - JunglerMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x01000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x01000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x02000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x03000, 3, 1); if (nRet != 0) return 1; - - // Load Z80 Sound Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the chars and sprites - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x00800, 6, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 2, 8, 8, JunglerCharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(0x40, 2, 16, 16, JunglerSpritePlaneOffsets, JunglerSpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load and decode the dots - memset(DrvTempRom, 0, 0x1000); - nRet = BurnLoadRom(DrvTempRom, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x08, 2, 4, 4, DotPlaneOffsets, DotXOffsets, DotYOffsets, 0x80, DrvTempRom, DrvDots); - - // Load the PROMs - nRet = BurnLoadRom(DrvPromPalette, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromLookup, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromVidLayout, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvPromVidTiming, 11, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - JunglerMachineInit(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - NamcoSoundExit(); - BurnSampleExit(); - ZetExit(); - - BurnFree(Mem); - - DrvCPUFireIRQ = 0; - DrvCPUIRQVector = 0; - xScroll = 0; - yScroll = 0; - DrvLastBang = 0; - - return 0; -} - -#define MAX_NETS 3 -#define MAX_RES_PER_NET 18 -#define Combine2Weights(tab,w0,w1) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1)) + 0.5)) -#define Combine3Weights(tab,w0,w1,w2) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2)) + 0.5)) - -static double ComputeResistorWeights(INT32 MinVal, INT32 MaxVal, double Scaler, INT32 Count1, const INT32 *Resistances1, double *Weights1, INT32 PullDown1, INT32 PullUp1, INT32 Count2, const INT32 *Resistances2, double *Weights2, INT32 PullDown2, INT32 PullUp2, INT32 Count3, const INT32 *Resistances3, double *Weights3, INT32 PullDown3, INT32 PullUp3) -{ - INT32 NetworksNum; - - INT32 ResCount[MAX_NETS]; - double r[MAX_NETS][MAX_RES_PER_NET]; - double w[MAX_NETS][MAX_RES_PER_NET]; - double ws[MAX_NETS][MAX_RES_PER_NET]; - INT32 r_pd[MAX_NETS]; - INT32 r_pu[MAX_NETS]; - - double MaxOut[MAX_NETS]; - double *Out[MAX_NETS]; - - INT32 i, j, n; - double Scale; - double Max; - - NetworksNum = 0; - for (n = 0; n < MAX_NETS; n++) { - INT32 Count, pd, pu; - const INT32 *Resistances; - double *Weights; - - switch (n) { - case 0: { - Count = Count1; - Resistances = Resistances1; - Weights = Weights1; - pd = PullDown1; - pu = PullUp1; - break; - } - - case 1: { - Count = Count2; - Resistances = Resistances2; - Weights = Weights2; - pd = PullDown2; - pu = PullUp2; - break; - } - - case 2: - default: { - Count = Count3; - Resistances = Resistances3; - Weights = Weights3; - pd = PullDown3; - pu = PullUp3; - break; - } - } - - if (Count > 0) { - ResCount[NetworksNum] = Count; - for (i = 0; i < Count; i++) { - r[NetworksNum][i] = 1.0 * Resistances[i]; - } - Out[NetworksNum] = Weights; - r_pd[NetworksNum] = pd; - r_pu[NetworksNum] = pu; - NetworksNum++; - } - } - - for (i = 0; i < NetworksNum; i++) { - double R0, R1, Vout, Dst; - - for (n = 0; n < ResCount[i]; n++) { - R0 = (r_pd[i] == 0) ? 1.0 / 1e12 : 1.0 / r_pd[i]; - R1 = (r_pu[i] == 0) ? 1.0 / 1e12 : 1.0 / r_pu[i]; - - for (j = 0; j < ResCount[i]; j++) { - if (j == n) { - if (r[i][j] != 0.0) R1 += 1.0 / r[i][j]; - } else { - if (r[i][j] != 0.0) R0 += 1.0 / r[i][j]; - } - } - - R0 = 1.0/R0; - R1 = 1.0/R1; - Vout = (MaxVal - MinVal) * R0 / (R1 + R0) + MinVal; - - Dst = (Vout < MinVal) ? MinVal : (Vout > MaxVal) ? MaxVal : Vout; - - w[i][n] = Dst; - } - } - - j = 0; - Max = 0.0; - for (i = 0; i < NetworksNum; i++) { - double Sum = 0.0; - - for (n = 0; n < ResCount[i]; n++) Sum += w[i][n]; - - MaxOut[i] = Sum; - if (Max < Sum) { - Max = Sum; - j = i; - } - } - - if (Scaler < 0.0) { - Scale = ((double)MaxVal) / MaxOut[j]; - } else { - Scale = Scaler; - } - - for (i = 0; i < NetworksNum; i++) { - for (n = 0; n < ResCount[i]; n++) { - ws[i][n] = w[i][n] * Scale; - (Out[i])[n] = ws[i][n]; - } - } - - return Scale; - -} - -static void DrvCalcPalette() -{ - static const INT32 ResistancesRG[3] = { 1000, 470, 220 }; - static const INT32 ResistancesB[2] = { 470, 220 }; - double rWeights[3], gWeights[3], bWeights[2]; - UINT32 Palette[32]; - UINT32 i; - - ComputeResistorWeights(0, 255, -1.0, 3, &ResistancesRG[0], rWeights, 0, 0, 3, &ResistancesRG[0], gWeights, 0, 0, 2, &ResistancesB[0], bWeights, 1000, 0); - - for (i = 0; i < 32; i++) { - INT32 Bit0, Bit1, Bit2; - INT32 r, g, b; - - Bit0 = (DrvPromPalette[i] >> 0) & 0x01; - Bit1 = (DrvPromPalette[i] >> 1) & 0x01; - Bit2 = (DrvPromPalette[i] >> 2) & 0x01; - r = Combine3Weights(rWeights, Bit0, Bit1, Bit2); - - /* green component */ - Bit0 = (DrvPromPalette[i] >> 3) & 0x01; - Bit1 = (DrvPromPalette[i] >> 4) & 0x01; - Bit2 = (DrvPromPalette[i] >> 5) & 0x01; - g = Combine3Weights(gWeights, Bit0, Bit1, Bit2); - - /* blue component */ - Bit0 = (DrvPromPalette[i] >> 6) & 0x01; - Bit1 = (DrvPromPalette[i] >> 7) & 0x01; - b = Combine2Weights(bWeights, Bit0, Bit1); - - Palette[i] = BurnHighCol(r, g, b, 0); - } - - for (i = 0; i < 256; i++) { - UINT8 PaletteEntry = DrvPromLookup[i] & 0x0f; - DrvPalette[i] = Palette[PaletteEntry]; - } - - for (i = 256; i < 260; i++) { - DrvPalette[i] = Palette[(i - 0x100) | 0x10]; - } -} - -#undef MAX_NETS -#undef MAX_RES_PER_NET -#undef Combine2Weights -#undef Combine3Weights - -static void DrvRenderBgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0, Flip, xFlip, yFlip; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Code = DrvVideoRam[TileIndex + 0x400 + 0x000]; - Colour = DrvVideoRam[TileIndex + 0x400 + 0x800]; - Flip = ((Colour >> 6) & 0x03) ^ 1; - xFlip = Flip & 0x01; - yFlip = Flip & 0x02; - Colour &= 0x3f; - - x = 8 * mx; - y = 8 * my; - - x -= xScroll; - y -= yScroll; - - x += 3; - y -= 16; - - if (x < -8) x += 256; - if (x > 247) x -= 256; - if (y < -8) y += 256; - - if (x < 224) { - if (x > 8 && x < 280 && y > 8 && y < 216) { - if (xFlip) { - if (yFlip) { - Render8x8Tile_FlipXY(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } else { - Render8x8Tile_FlipX(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } - } else { - if (yFlip) { - Render8x8Tile_FlipY(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } else { - Render8x8Tile(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render8x8Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } else { - Render8x8Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } - } else { - if (yFlip) { - Render8x8Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } else { - Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } - } - } - } - - TileIndex++; - } - } -} - -static void DrvRenderFgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex, Flip, xFlip, yFlip; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 8; mx++) { - TileIndex = mx + (my << 5); - Code = DrvVideoRam[TileIndex + 0x000 + 0x000]; - Colour = DrvVideoRam[TileIndex + 0x000 + 0x800]; - Flip = ((Colour >> 6) & 0x03) ^ 1; - xFlip = Flip & 0x01; - yFlip = Flip & 0x02; - Colour &= 0x3f; - - x = 8 * mx; - y = 8 * my; - - y -= 16; - - x -= 32; - if (x < 0) x += 64; - - x += 224; - - if (x > 8 && x < 280 && y > 8 && y < 216) { - if (xFlip) { - if (yFlip) { - Render8x8Tile_FlipXY(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } else { - Render8x8Tile_FlipX(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } - } else { - if (yFlip) { - Render8x8Tile_FlipY(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } else { - Render8x8Tile(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render8x8Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } else { - Render8x8Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } - } else { - if (yFlip) { - Render8x8Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } else { - Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); - } - } - } - } - } -} - -static void DrvRenderSprites(INT32 Displacement) -{ - UINT32 SpriteRamBase = 0x14; - UINT8 *SpriteRam = DrvVideoRam; - UINT8 *SpriteRam2 = DrvVideoRam + 0x800; - - for (UINT32 Offs = 0x20 - 2; Offs >= SpriteRamBase; Offs -= 2) { - INT32 sx = SpriteRam[Offs + 1] + ((SpriteRam2[Offs + 1] & 0x80) << 1) - Displacement; - INT32 sy = 241 - SpriteRam2[Offs] - Displacement; - INT32 Colour = SpriteRam2[Offs + 1] & 0x3f; - INT32 xFlip = SpriteRam[Offs] & 1; - INT32 yFlip = SpriteRam[Offs] & 2; - INT32 Code = (SpriteRam[Offs] & 0xfc) >> 2; - -// if (flip_screen_get(machine)) -// sx -= 2 * displacement; - - - sy -= 16; - - if (sx > 16 && sx < 272 && sy > 16 && sy < 208) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); - } - } - } - } -} - -static void DrvRenderBullets() -{ - UINT32 SpriteRamBase = 0x14; - UINT8 *RadarX = DrvVideoRam + 0x020; - UINT8 *RadarY = DrvVideoRam + 0x820; - - for (UINT32 Offs = SpriteRamBase; Offs < 0x20; Offs++) { - INT32 x, y, Code; - - x = RadarX[Offs] + ((~DrvRadarAttrRam[Offs & 0x0f] & 0x01) << 8); - y = 253 - RadarY[Offs]; - Code = ((DrvRadarAttrRam[Offs & 0x0f] & 0x0e) >> 1) ^ 0x07; - - y -= 16; - -// if (flip_screen_get(machine)) -// x -= 3; - -// if (transpen) -// drawgfx_transpen(bitmap,cliprect,machine->gfx[2], -// ((state->radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, -// 0, -// 0,0, -// x,y, -// 3); -// else -// drawgfx_transtable(bitmap,cliprect,machine->gfx[2], -// ((state->radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, -// 0, -// 0,0, -// x,y, -/// state->drawmode_table,machine->shadow_table); - - RenderCustomTile_Mask_Clip(pTransDraw, 4, 4, Code, x, y, 0, 2, 3, 0x100, DrvDots); - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - DrvRenderBgLayer(); - DrvRenderSprites(1); - DrvRenderFgLayer(); - DrvRenderBullets(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = nBurnSoundLen; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - INT32 nSoundBufferPos = 0; - - nCyclesTotal[0] = (18432000 / 6) / 60; - nCyclesDone[0] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == (nInterleave - 1) && DrvCPUFireIRQ) { - ZetSetVector(DrvCPUIRQVector); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - NamcoSoundUpdate(pSoundBuf, nSegmentLength); - BurnSampleRender(pSoundBuf, nSegmentLength); - } - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - NamcoSoundUpdate(pSoundBuf, nSegmentLength); - BurnSampleRender(pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 JunglerFrame() -{ - INT32 nInterleave = 10; - - if (DrvReset) JunglerDoReset(); - - JunglerMakeInputs(); - -// INT32 nSoundBufferPos = 0; - - nCyclesTotal[0] = (18432000 / 6) / 60; - nCyclesTotal[1] = (14318180 / 8) / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == (nInterleave - 1) && DrvCPUFireIRQ) { - ZetNmi(); - } - ZetClose(); - -/* if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - NamcoSoundUpdate(pSoundBuf, nSegmentLength); - BurnSampleRender(pSoundBuf, nSegmentLength); - } - nSoundBufferPos += nSegmentLength; - }*/ - } - -/* if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - NamcoSoundUpdate(pSoundBuf, nSegmentLength); - BurnSampleRender(pSoundBuf, nSegmentLength); - } - }*/ - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029708; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); // Scan Z80 - NamcoSoundScan(nAction, pnMin); - } - - return 0; -} - -struct BurnDriver BurnDrvRallyx = { - "rallyx", NULL, NULL, "rallyx", "1980", - "Rally X (32k Ver.?))\0", NULL, "Namco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, RallyxRomInfo, RallyxRomName, RallyxSampleInfo, RallyxSampleName, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 260, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvRallyxa = { - "rallyxa", "rallyx", NULL, "rallyx", "1980", - "Rally X\0", NULL, "Namco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, RallyxaRomInfo, RallyxaRomName, RallyxSampleInfo, RallyxSampleName, DrvInputInfo, DrvDIPInfo, - DrvaInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 260, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvRallyxm = { - "rallyxm", "rallyx", NULL, "rallyx", "1980", - "Rally X (Midway)\0", NULL, "Namco (Midway License)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, RallyxmRomInfo, RallyxmRomName, RallyxSampleInfo, RallyxSampleName, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 260, 288, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNrallyx = { - "nrallyx", NULL, NULL, "rallyx", "1981", - "New Rally X\0", NULL, "Namco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, NrallyxRomInfo, NrallyxRomName, RallyxSampleInfo, RallyxSampleName, DrvInputInfo, DrvDIPInfo, - NrallyxInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 260, 288, 224, 4, 3 -}; - - - -struct BurnDriverD BurnDrvJungler = { - "jungler", NULL, NULL, NULL, "1981", - "Jungler\0", NULL, "Konami", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, JunglerRomInfo, JunglerRomName, NULL, NULL, JunglerInputInfo, JunglerDIPInfo, - JunglerInit, DrvExit, JunglerFrame, NULL, DrvScan, - NULL, 324, 224, 288, 3, 4 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "namco_snd.h" +#include "samples.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[2] = {0, 0}; +static UINT8 DrvInput[3] = {0, 0, 0}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *DrvZ80Rom1 = NULL; +static UINT8 *DrvZ80Rom2 = NULL; +static UINT8 *DrvZ80Ram1 = NULL; +static UINT8 *DrvZ80Ram2 = NULL; +static UINT8 *DrvVideoRam = NULL; +static UINT8 *DrvRadarAttrRam = NULL; +static UINT8 *DrvPromPalette = NULL; +static UINT8 *DrvPromLookup = NULL; +static UINT8 *DrvPromVidLayout = NULL; +static UINT8 *DrvPromVidTiming = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvDots = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT8 DrvCPUFireIRQ; +static UINT8 DrvCPUIRQVector; +static UINT8 xScroll; +static UINT8 yScroll; +static UINT8 DrvLastBang; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo DrvInputList[] = +{ + { "Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + { "Start 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 start" }, + { "Coin 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 coin" }, + { "Start 2" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 start" }, + + { "Up" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 up" }, + { "Down" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 down" }, + { "Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + { "Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + { "Fire 1" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 fire 1" }, + + { "Up (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 up" }, + { "Down (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 down" }, + { "Left (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + { "Right (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + { "Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 fire 1" }, + + { "Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + { "Service" , BIT_DIGITAL , DrvInputPort0 + 0, "service" }, + { "Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + { "Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo JunglerInputList[] = +{ + { "Coin 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 coin" }, + { "Start 1" , BIT_DIGITAL , DrvInputPort1 + 7, "p1 start" }, + { "Coin 2" , BIT_DIGITAL , DrvInputPort0 + 6, "p2 coin" }, + { "Start 2" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 start" }, + + { "Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + { "Down" , BIT_DIGITAL , DrvInputPort2 + 7, "p1 down" }, + { "Left" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 left" }, + { "Right" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 right" }, + { "Fire 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 fire 1" }, + + { "Up (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + { "Down (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + { "Left (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 left" }, + { "Right (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 right" }, + { "Fire 1 (Cocktail)" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 fire 1" }, + + { "Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + { "Service" , BIT_DIGITAL , DrvInputPort0 + 2, "service" }, + { "Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, +}; + +STDINPUTINFO(Jungler) + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = 0xff; + DrvInput[1] = 0xfe; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] -= (DrvInputPort0[i] & 1) << i; + DrvInput[1] -= (DrvInputPort1[i] & 1) << i; + } +} + +static inline void JunglerMakeInputs() +{ + // Reset Inputs + DrvInput[0] = 0xff; + DrvInput[1] = 0xff; + DrvInput[2] = 0xff; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] -= (DrvInputPort0[i] & 1) << i; + DrvInput[1] -= (DrvInputPort1[i] & 1) << i; + DrvInput[2] -= (DrvInputPort1[i] & 1) << i; + } +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x01, NULL }, + {0x11, 0xff, 0xff, 0xcb, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x01, 0x00, "Cocktail" }, + {0x10, 0x01, 0x01, 0x01, "Upright" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, // This is conditional on difficulty + {0x11, 0x01, 0x06, 0x02, "15000" }, + {0x11, 0x01, 0x06, 0x04, "30000" }, + {0x11, 0x01, 0x06, 0x06, "40000" }, + {0x11, 0x01, 0x06, 0x00, "None" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x11, 0x01, 0x38, 0x10, "1 Car, Medium" }, + {0x11, 0x01, 0x38, 0x28, "1 Car, Hard" }, + {0x11, 0x01, 0x38, 0x00, "2 Cars, Easy" }, + {0x11, 0x01, 0x38, 0x18, "2 Cars, Medium" }, + {0x11, 0x01, 0x38, 0x30, "2 Cars, Hard" }, + {0x11, 0x01, 0x38, 0x08, "3 Cars, Easy" }, + {0x11, 0x01, 0x38, 0x20, "3 Cars, Medium" }, + {0x11, 0x01, 0x38, 0x38, "3 Cars, Hard" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + {0x11, 0x01, 0xc0, 0x00, "Freeplay" }, +}; + +STDDIPINFO(Drv) + +static struct BurnDIPInfo JunglerDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0xbf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x10, 0x01, 0x07, 0x01, "4 Coins 1 Play" }, + {0x10, 0x01, 0x07, 0x02, "3 Coins 1 Play" }, + {0x10, 0x01, 0x07, 0x03, "2 Coins 1 Play" }, + {0x10, 0x01, 0x07, 0x00, "4 Coins 3 Plays" }, + {0x10, 0x01, 0x07, 0x07, "1 Coin 1 Play" }, + {0x10, 0x01, 0x07, 0x06, "1 Coin 2 Plays" }, + {0x10, 0x01, 0x07, 0x05, "1 Coin 3 Plays" }, + {0x10, 0x01, 0x07, 0x04, "1 Coin 4 Plays" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x10, 0x01, 0x38, 0x08, "4 Coins 1 Play" }, + {0x10, 0x01, 0x38, 0x10, "3 Coins 1 Play" }, + {0x10, 0x01, 0x38, 0x18, "2 Coins 1 Play" }, + {0x10, 0x01, 0x38, 0x00, "4 Coins 3 Plays" }, + {0x10, 0x01, 0x38, 0x38, "1 Coin 1 Play" }, + {0x10, 0x01, 0x38, 0x30, "1 Coin 2 Plays" }, + {0x10, 0x01, 0x38, 0x28, "1 Coin 3 Plays" }, + {0x10, 0x01, 0x38, 0x20, "1 Coin 4 Plays" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x40, 0x40, "Cocktail" }, + {0x10, 0x01, 0x40, 0x00, "Upright" }, + + {0 , 0xfe, 0 , 2 , "Test Mode (255 lives)" }, + {0x10, 0x01, 0x80, 0x80, "Off" }, + {0x10, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Jungler) + +static struct BurnRomInfo RallyxRomDesc[] = { + { "1b", 0x01000, 0x5882700d, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "rallyxn.1e", 0x01000, 0xed1eba2b, BRF_ESS | BRF_PRG }, // 1 + { "rallyxn.1h", 0x01000, 0x4f98dd1c, BRF_ESS | BRF_PRG }, // 2 + { "rallyxn.1k", 0x01000, 0x9aacccf0, BRF_ESS | BRF_PRG }, // 3 + + { "8e", 0x01000, 0x277c1de5, BRF_GRA }, // 4 Characters & Sprites + + { "rx1-6.8m", 0x00100, 0x3c16f62c, BRF_GRA }, // 5 Dots + + { "rx1-1.11n", 0x00020, 0xc7865434, BRF_GRA }, // 6 Palette PROM + { "rx1-7.8p", 0x00100, 0x834d4fda, BRF_GRA }, // 7 Lookup PROM + { "rx1-2.4n", 0x00020, 0x8f574815, BRF_GRA }, // 8 Video Layout PROM + { "rx1-3.7k", 0x00020, 0xb8861096, BRF_GRA }, // 9 Video Timing PROM + + { "rx1-5.3p", 0x00100, 0x4bad7017, BRF_SND }, // 10 Sound PROMs + { "rx1-4.2m", 0x00100, 0x77245b66, BRF_SND }, // 11 +}; + +STD_ROM_PICK(Rallyx) +STD_ROM_FN(Rallyx) + +static struct BurnRomInfo RallyxaRomDesc[] = { + { "rx1_prg_1.1b", 0x00800, 0xef9238db, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "rx1_prg_2.1c", 0x00800, 0x7cbeb656, BRF_ESS | BRF_PRG }, // 1 + { "rx1_prg_3.1d", 0x00800, 0x334b1042, BRF_ESS | BRF_PRG }, // 2 + { "rx1_prg_4.1e", 0x00800, 0xd6618add, BRF_ESS | BRF_PRG }, // 3 + { "rx1_prg_5.bin", 0x00800, 0x3d69f24e, BRF_ESS | BRF_PRG }, // 4 + { "rx1_prg_6.bin", 0x00800, 0xe9740f16, BRF_ESS | BRF_PRG }, // 5 + { "rx1_prg_7.1k", 0x00800, 0x843109f2, BRF_ESS | BRF_PRG }, // 6 + { "rx1_prg_8.1l", 0x00800, 0x9b846ec9, BRF_ESS | BRF_PRG }, // 7 + + { "rx1_chg_1.8e", 0x00800, 0x1fff38a4, BRF_GRA }, // 8 Characters & Sprites + { "rx1_chg_2.8d", 0x00800, 0x68dff552, BRF_GRA }, // 9 + + { "rx1-6.8m", 0x00100, 0x3c16f62c, BRF_GRA }, // 10 Dots + + { "rx1-1.11n", 0x00020, 0xc7865434, BRF_GRA }, // 11 Palette PROM + { "rx1-7.8p", 0x00100, 0x834d4fda, BRF_GRA }, // 12 Lookup PROM + { "rx1-2.4n", 0x00020, 0x8f574815, BRF_GRA }, // 13 Video Layout PROM + { "rx1-3.7k", 0x00020, 0xb8861096, BRF_GRA }, // 14 Video Timing PROM + + { "rx1-5.3p", 0x00100, 0x4bad7017, BRF_SND }, // 15 Sound PROMs + { "rx1-4.2m", 0x00100, 0x77245b66, BRF_SND }, // 16 +}; + +STD_ROM_PICK(Rallyxa) +STD_ROM_FN(Rallyxa) + +static struct BurnRomInfo RallyxmRomDesc[] = { + { "1b", 0x01000, 0x5882700d, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "1e", 0x01000, 0x786585ec, BRF_ESS | BRF_PRG }, // 1 + { "1h", 0x01000, 0x110d7dcd, BRF_ESS | BRF_PRG }, // 2 + { "1k", 0x01000, 0x473ab447, BRF_ESS | BRF_PRG }, // 3 + + { "8e", 0x01000, 0x277c1de5, BRF_GRA }, // 4 Characters & Sprites + + { "rx1-6.8m", 0x00100, 0x3c16f62c, BRF_GRA }, // 5 Dots + + { "rx1-1.11n", 0x00020, 0xc7865434, BRF_GRA }, // 6 Palette PROM + { "rx1-7.8p", 0x00100, 0x834d4fda, BRF_GRA }, // 7 Lookup PROM + { "rx1-2.4n", 0x00020, 0x8f574815, BRF_GRA }, // 8 Video Layout PROM + { "rx1-3.7k", 0x00020, 0xb8861096, BRF_GRA }, // 9 Video Timing PROM + + { "rx1-5.3p", 0x00100, 0x4bad7017, BRF_SND }, // 10 Sound PROMs + { "rx1-4.2m", 0x00100, 0x77245b66, BRF_SND }, // 11 +}; + +STD_ROM_PICK(Rallyxm) +STD_ROM_FN(Rallyxm) + +static struct BurnRomInfo NrallyxRomDesc[] = { + { "nrx_prg1.1d", 0x01000, 0xba7de9fc, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + { "nrx_prg2.1e", 0x01000, 0xeedfccae, BRF_ESS | BRF_PRG }, // 1 + { "nrx_prg3.1k", 0x01000, 0xb4d5d34a, BRF_ESS | BRF_PRG }, // 2 + { "nrx_prg4.1l", 0x01000, 0x7da5496d, BRF_ESS | BRF_PRG }, // 3 + + { "nrx_chg1.8e", 0x00800, 0x1fff38a4, BRF_GRA }, // 4 Characters & Sprites + { "nrx_chg2.8d", 0x00800, 0x85d9fffd, BRF_GRA }, // 5 + + { "rx1-6.8m", 0x00100, 0x3c16f62c, BRF_GRA }, // 6 Dots + + { "nrx1-1.11n", 0x00020, 0xa0a49017, BRF_GRA }, // 7 Palette PROM + { "nrx1-7.8p", 0x00100, 0x4e46f485, BRF_GRA }, // 8 Lookup PROM + { "rx1-2.4n", 0x00020, 0x8f574815, BRF_GRA }, // 9 Video Layout PROM + { "rx1-3.7k", 0x00020, 0xb8861096, BRF_GRA }, // 10 Video Timing PROM + + { "rx1-5.3p", 0x00100, 0x4bad7017, BRF_SND }, // 11 Sound PROMs + { "rx1-4.2m", 0x00100, 0x77245b66, BRF_SND }, // 12 +}; + +STD_ROM_PICK(Nrallyx) +STD_ROM_FN(Nrallyx) + + + + +static struct BurnRomInfo JunglerRomDesc[] = { + { "jungr1", 0x01000, 0x5bd6ad15, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code #1 + { "jungr2", 0x01000, 0xdc99f1e3, BRF_ESS | BRF_PRG }, // 1 + { "jungr3", 0x01000, 0x3dcc03da, BRF_ESS | BRF_PRG }, // 2 + { "jungr4", 0x01000, 0xf92e9940, BRF_ESS | BRF_PRG }, // 3 + + { "1b", 0x01000, 0xf86999c3, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code #2 + + { "5k", 0x00800, 0x924262bf, BRF_GRA }, // 5 Characters & Sprites + { "5m", 0x00800, 0x131a08ac, BRF_GRA }, // 6 + + { "82s129.10g", 0x00100, 0xc59c51b7, BRF_GRA }, // 7 Dots + + { "18s030.8b", 0x00020, 0x55a7e6d1, BRF_GRA }, // 8 Palette PROM + { "tbp24s10.9d", 0x00100, 0xd223f7b8, BRF_GRA }, // 9 Lookup PROM + { "18s030.7a", 0x00020, 0x8f574815, BRF_GRA }, // 10 Video Layout PROM + { "6331-1.10a", 0x00020, 0xb8861096, BRF_GRA }, // 11 Video Timing PROM +}; + +STD_ROM_PICK(Jungler) +STD_ROM_FN(Jungler) + +static struct BurnSampleInfo RallyxSampleDesc[] = { +#if !defined (ROM_VERIFY) + { "bang.wav", SAMPLE_NOLOOP }, +#else + { "bang", SAMPLE_NOLOOP }, +#endif + { "", 0 } +}; + +STD_SAMPLE_PICK(Rallyx) +STD_SAMPLE_FN(Rallyx) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom1 = Next; Next += 0x04000; + DrvPromPalette = Next; Next += 0x00020; + DrvPromLookup = Next; Next += 0x00100; + DrvPromVidLayout = Next; Next += 0x00020; + DrvPromVidTiming = Next; Next += 0x00020; + NamcoSoundProm = Next; Next += 0x00100; + + RamStart = Next; + + DrvZ80Ram1 = Next; Next += 0x00800; + DrvVideoRam = Next; Next += 0x01000; + DrvRadarAttrRam = Next; Next += 0x00010; + + RamEnd = Next; + + DrvChars = Next; Next += 0x100 * 8 * 8; + DrvSprites = Next; Next += 0x040 * 16 * 16; + DrvDots = Next; Next += 0x008 * 4 * 4; + DrvPalette = (UINT32*)Next; Next += 260 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 JunglerMemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom1 = Next; Next += 0x08000; + DrvZ80Rom2 = Next; Next += 0x02000; + DrvPromPalette = Next; Next += 0x00020; + DrvPromLookup = Next; Next += 0x00100; + DrvPromVidLayout = Next; Next += 0x00020; + DrvPromVidTiming = Next; Next += 0x00020; + + RamStart = Next; + + DrvZ80Ram1 = Next; Next += 0x00800; + DrvZ80Ram2 = Next; Next += 0x00400; + DrvVideoRam = Next; Next += 0x01000; + DrvRadarAttrRam = Next; Next += 0x00010; + + RamEnd = Next; + + DrvChars = Next; Next += 0x100 * 8 * 8; + DrvSprites = Next; Next += 0x040 * 16 * 16; + DrvDots = Next; Next += 0x008 * 4 * 4; + DrvPalette = (UINT32*)Next; Next += 324 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnSampleReset(); + + DrvCPUFireIRQ = 0; + DrvCPUIRQVector = 0; + xScroll = 0; + yScroll = 0; + DrvLastBang = 0; + + return 0; +} + +static INT32 JunglerDoReset() +{ + ZetOpen(0); + ZetReset(); + ZetClose(); + + DrvCPUFireIRQ = 0; + DrvCPUIRQVector = 0; + xScroll = 0; + yScroll = 0; + + return 0; +} + +UINT8 __fastcall RallyxZ80ProgRead(UINT16 a) +{ + switch (a) { + case 0xa000: { + return DrvInput[0]; + } + + case 0xa080: { + return DrvInput[1] | DrvDip[0]; + } + + case 0xa100: { + return DrvDip[1]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read %04x\n"), a); + } + } + + return 0; +} + +void __fastcall RallyxZ80ProgWrite(UINT16 a, UINT8 d) +{ + if (a >= 0xa100 && a <= 0xa11f) { NamcoSoundWrite(a - 0xa100, d); return; } + + switch (a) { + case 0xa080: { + // watchdog write + return; + } + + case 0xa130: { + xScroll = d; + return; + } + + case 0xa140: { + yScroll = d; + return; + } + + case 0xa170: { + // NOP + return; + } + + case 0xa180: { + UINT8 Bit = d & 0x01; + if (Bit == 0 && DrvLastBang != 0) { + BurnSamplePlay(0); + } + DrvLastBang = Bit; + return; + } + + case 0xa181: { + DrvCPUFireIRQ = d & 0x01; + if (!DrvCPUFireIRQ) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return; + } + + case 0xa182: { + // sound on + return; + } + + case 0xa183: { + // flip screen !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + return; + } + + case 0xa184: { + // lamp + return; + } + + case 0xa185: { + // lamp + return; + } + + case 0xa186: { + // coin lockout + return; + } + + case 0xa187: { + // coin counter + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write %04x, %02x\n"), a, d); + } + } +} + +UINT8 __fastcall RallyxZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall RallyxZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + DrvCPUIRQVector = d; + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall JunglerZ80ProgRead1(UINT16 a) +{ + switch (a) { + case 0xa000: { + return DrvInput[0]; + } + + case 0xa080: { + return DrvInput[1]; + } + + case 0xa100: { + return DrvInput[2]; + } + + case 0xa180: { + return DrvDip[0]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read %04x\n"), a); + } + } + + return 0; +} + +void __fastcall JunglerZ80ProgWrite1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xa080: { + // watchdog write + return; + } + + case 0xa130: { + xScroll = d; + return; + } + + case 0xa140: { + yScroll = d; + return; + } + + case 0xa181: { + DrvCPUFireIRQ = d & 0x01; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write %04x, %02x\n"), a, d); + } + } +} + +UINT8 __fastcall JunglerZ80PortRead1(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall JunglerZ80PortWrite1(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall JunglerZ80ProgRead2(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read %04x\n"), a); + } + } + + return 0; +} + +void __fastcall JunglerZ80ProgWrite2(UINT16 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Write %04x, %02x\n"), a, d); + } + } +} + +UINT8 __fastcall JunglerZ80PortRead2(UINT16 a) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall JunglerZ80PortWrite2(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); + } + } +} + +static INT32 CharPlaneOffsets[2] = { 0, 4 }; +static INT32 CharXOffsets[8] = { 64, 65, 66, 67, 0, 1, 2, 3 }; +static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 JunglerCharPlaneOffsets[2] = { 4, 0 }; +static INT32 SpritePlaneOffsets[2] = { 0, 4 }; +static INT32 SpriteXOffsets[16] = { 64, 65, 66, 67, 128, 129, 130, 131, 192, 193, 194, 195, 0, 1, 2, 3 }; +static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 256, 264, 272, 280, 288, 296, 304, 312 }; +static INT32 JunglerSpritePlaneOffsets[2] = { 4, 0 }; +static INT32 JunglerSpriteXOffsets[16] = { 64, 65, 66, 67, 0, 1, 2, 3, 192, 193, 194, 195, 128, 129, 130, 131 }; +static INT32 DotPlaneOffsets[2] = { 6, 7 }; +static INT32 DotXOffsets[4] = { 0, 8, 16, 24 }; +static INT32 DotYOffsets[4] = { 0, 32, 64, 96 }; + +static void MachineInit() +{ + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(RallyxZ80ProgRead); + ZetSetWriteHandler(RallyxZ80ProgWrite); + ZetSetInHandler(RallyxZ80PortRead); + ZetSetOutHandler(RallyxZ80PortWrite); + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80Rom1); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80Rom1); + ZetMapArea(0x8000, 0x8fff, 0, DrvVideoRam); + ZetMapArea(0x8000, 0x8fff, 1, DrvVideoRam); + ZetMapArea(0x8000, 0x8fff, 2, DrvVideoRam); + ZetMapArea(0x9800, 0x9fff, 0, DrvZ80Ram1); + ZetMapArea(0x9800, 0x9fff, 1, DrvZ80Ram1); + ZetMapArea(0x9800, 0x9fff, 2, DrvZ80Ram1); + ZetMapArea(0xa000, 0xa00f, 1, DrvRadarAttrRam); + ZetClose(); + + NamcoSoundInit(18432000 / 6 / 32, 3); + NacmoSoundSetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + BurnSampleInit(0); + BurnSampleSetAllRoutesAllSamples(0.80, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); +} + +static void JunglerMachineInit() +{ + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(JunglerZ80ProgRead1); + ZetSetWriteHandler(JunglerZ80ProgWrite1); + ZetSetInHandler(JunglerZ80PortRead1); + ZetSetOutHandler(JunglerZ80PortWrite1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1); + ZetMapArea(0x8000, 0x8fff, 0, DrvVideoRam); + ZetMapArea(0x8000, 0x8fff, 1, DrvVideoRam); + ZetMapArea(0x8000, 0x8fff, 2, DrvVideoRam); + ZetMapArea(0x9800, 0x9fff, 0, DrvZ80Ram1); + ZetMapArea(0x9800, 0x9fff, 1, DrvZ80Ram1); + ZetMapArea(0x9800, 0x9fff, 2, DrvZ80Ram1); + ZetMapArea(0xa000, 0xa00f, 1, DrvRadarAttrRam); + ZetMapArea(0xa030, 0xa03f, 1, DrvRadarAttrRam); + ZetClose(); + + ZetInit(1); + // not used? + + GenericTilesInit(); + + JunglerDoReset(); +} + +static INT32 DrvInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x01000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x01000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x02000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x03000, 3, 1); if (nRet != 0) return 1; + + // Load and decode the chars and sprites + nRet = BurnLoadRom(DrvTempRom, 4, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(0x40, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the dots + memset(DrvTempRom, 0, 0x1000); + nRet = BurnLoadRom(DrvTempRom, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x08, 2, 4, 4, DotPlaneOffsets, DotXOffsets, DotYOffsets, 0x80, DrvTempRom, DrvDots); + + // Load the PROMs + nRet = BurnLoadRom(DrvPromPalette, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromLookup, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromVidLayout, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromVidTiming, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(NamcoSoundProm, 10, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + MachineInit(); + + return 0; +} + +static INT32 DrvaInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x01000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00800, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x01000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x01800, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x02000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x02800, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x03000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x03800, 7, 1); if (nRet != 0) return 1; + + // Load and decode the chars and sprites + nRet = BurnLoadRom(DrvTempRom + 0x0000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0800, 9, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(0x40, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the dots + memset(DrvTempRom, 0, 0x1000); + nRet = BurnLoadRom(DrvTempRom, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x08, 2, 4, 4, DotPlaneOffsets, DotXOffsets, DotYOffsets, 0x80, DrvTempRom, DrvDots); + + // Load the PROMs + nRet = BurnLoadRom(DrvPromPalette, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromLookup, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromVidLayout, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromVidTiming, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(NamcoSoundProm, 15, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + MachineInit(); + + return 0; +} + +static INT32 NrallyxInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x01000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvTempRom, 0, 1); if (nRet != 0) return 1; + memcpy(DrvZ80Rom1 + 0x0000, DrvTempRom + 0x0000, 0x800); + memcpy(DrvZ80Rom1 + 0x1000, DrvTempRom + 0x0800, 0x800); + nRet = BurnLoadRom(DrvTempRom, 1, 1); if (nRet != 0) return 1; + memcpy(DrvZ80Rom1 + 0x0800, DrvTempRom + 0x0000, 0x800); + memcpy(DrvZ80Rom1 + 0x1800, DrvTempRom + 0x0800, 0x800); + nRet = BurnLoadRom(DrvTempRom, 2, 1); if (nRet != 0) return 1; + memcpy(DrvZ80Rom1 + 0x2000, DrvTempRom + 0x0000, 0x800); + memcpy(DrvZ80Rom1 + 0x3000, DrvTempRom + 0x0800, 0x800); + nRet = BurnLoadRom(DrvTempRom, 3, 1); if (nRet != 0) return 1; + memcpy(DrvZ80Rom1 + 0x2800, DrvTempRom + 0x0000, 0x800); + memcpy(DrvZ80Rom1 + 0x3800, DrvTempRom + 0x0800, 0x800); + + // Load and decode the chars and sprites + memset(DrvTempRom, 0, 0x1000); + nRet = BurnLoadRom(DrvTempRom + 0x0000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0800, 5, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 2, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(0x40, 2, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the dots + memset(DrvTempRom, 0, 0x1000); + nRet = BurnLoadRom(DrvTempRom, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x08, 2, 4, 4, DotPlaneOffsets, DotXOffsets, DotYOffsets, 0x80, DrvTempRom, DrvDots); + + // Load the PROMs + nRet = BurnLoadRom(DrvPromPalette, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromLookup, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromVidLayout, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromVidTiming, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(NamcoSoundProm, 11, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + MachineInit(); + + return 0; +} + +static INT32 JunglerInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + JunglerMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + JunglerMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x01000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x01000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x02000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x03000, 3, 1); if (nRet != 0) return 1; + + // Load Z80 Sound Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the chars and sprites + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x00800, 6, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 2, 8, 8, JunglerCharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(0x40, 2, 16, 16, JunglerSpritePlaneOffsets, JunglerSpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load and decode the dots + memset(DrvTempRom, 0, 0x1000); + nRet = BurnLoadRom(DrvTempRom, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x08, 2, 4, 4, DotPlaneOffsets, DotXOffsets, DotYOffsets, 0x80, DrvTempRom, DrvDots); + + // Load the PROMs + nRet = BurnLoadRom(DrvPromPalette, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromLookup, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromVidLayout, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvPromVidTiming, 11, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + JunglerMachineInit(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + NamcoSoundExit(); + BurnSampleExit(); + ZetExit(); + + BurnFree(Mem); + + DrvCPUFireIRQ = 0; + DrvCPUIRQVector = 0; + xScroll = 0; + yScroll = 0; + DrvLastBang = 0; + + return 0; +} + +#define MAX_NETS 3 +#define MAX_RES_PER_NET 18 +#define Combine2Weights(tab,w0,w1) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1)) + 0.5)) +#define Combine3Weights(tab,w0,w1,w2) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2)) + 0.5)) + +static double ComputeResistorWeights(INT32 MinVal, INT32 MaxVal, double Scaler, INT32 Count1, const INT32 *Resistances1, double *Weights1, INT32 PullDown1, INT32 PullUp1, INT32 Count2, const INT32 *Resistances2, double *Weights2, INT32 PullDown2, INT32 PullUp2, INT32 Count3, const INT32 *Resistances3, double *Weights3, INT32 PullDown3, INT32 PullUp3) +{ + INT32 NetworksNum; + + INT32 ResCount[MAX_NETS]; + double r[MAX_NETS][MAX_RES_PER_NET]; + double w[MAX_NETS][MAX_RES_PER_NET]; + double ws[MAX_NETS][MAX_RES_PER_NET]; + INT32 r_pd[MAX_NETS]; + INT32 r_pu[MAX_NETS]; + + double MaxOut[MAX_NETS]; + double *Out[MAX_NETS]; + + INT32 i, j, n; + double Scale; + double Max; + + NetworksNum = 0; + for (n = 0; n < MAX_NETS; n++) { + INT32 Count, pd, pu; + const INT32 *Resistances; + double *Weights; + + switch (n) { + case 0: { + Count = Count1; + Resistances = Resistances1; + Weights = Weights1; + pd = PullDown1; + pu = PullUp1; + break; + } + + case 1: { + Count = Count2; + Resistances = Resistances2; + Weights = Weights2; + pd = PullDown2; + pu = PullUp2; + break; + } + + case 2: + default: { + Count = Count3; + Resistances = Resistances3; + Weights = Weights3; + pd = PullDown3; + pu = PullUp3; + break; + } + } + + if (Count > 0) { + ResCount[NetworksNum] = Count; + for (i = 0; i < Count; i++) { + r[NetworksNum][i] = 1.0 * Resistances[i]; + } + Out[NetworksNum] = Weights; + r_pd[NetworksNum] = pd; + r_pu[NetworksNum] = pu; + NetworksNum++; + } + } + + for (i = 0; i < NetworksNum; i++) { + double R0, R1, Vout, Dst; + + for (n = 0; n < ResCount[i]; n++) { + R0 = (r_pd[i] == 0) ? 1.0 / 1e12 : 1.0 / r_pd[i]; + R1 = (r_pu[i] == 0) ? 1.0 / 1e12 : 1.0 / r_pu[i]; + + for (j = 0; j < ResCount[i]; j++) { + if (j == n) { + if (r[i][j] != 0.0) R1 += 1.0 / r[i][j]; + } else { + if (r[i][j] != 0.0) R0 += 1.0 / r[i][j]; + } + } + + R0 = 1.0/R0; + R1 = 1.0/R1; + Vout = (MaxVal - MinVal) * R0 / (R1 + R0) + MinVal; + + Dst = (Vout < MinVal) ? MinVal : (Vout > MaxVal) ? MaxVal : Vout; + + w[i][n] = Dst; + } + } + + j = 0; + Max = 0.0; + for (i = 0; i < NetworksNum; i++) { + double Sum = 0.0; + + for (n = 0; n < ResCount[i]; n++) Sum += w[i][n]; + + MaxOut[i] = Sum; + if (Max < Sum) { + Max = Sum; + j = i; + } + } + + if (Scaler < 0.0) { + Scale = ((double)MaxVal) / MaxOut[j]; + } else { + Scale = Scaler; + } + + for (i = 0; i < NetworksNum; i++) { + for (n = 0; n < ResCount[i]; n++) { + ws[i][n] = w[i][n] * Scale; + (Out[i])[n] = ws[i][n]; + } + } + + return Scale; + +} + +static void DrvCalcPalette() +{ + static const INT32 ResistancesRG[3] = { 1000, 470, 220 }; + static const INT32 ResistancesB[2] = { 470, 220 }; + double rWeights[3], gWeights[3], bWeights[2]; + UINT32 Palette[32]; + UINT32 i; + + ComputeResistorWeights(0, 255, -1.0, 3, &ResistancesRG[0], rWeights, 0, 0, 3, &ResistancesRG[0], gWeights, 0, 0, 2, &ResistancesB[0], bWeights, 1000, 0); + + for (i = 0; i < 32; i++) { + INT32 Bit0, Bit1, Bit2; + INT32 r, g, b; + + Bit0 = (DrvPromPalette[i] >> 0) & 0x01; + Bit1 = (DrvPromPalette[i] >> 1) & 0x01; + Bit2 = (DrvPromPalette[i] >> 2) & 0x01; + r = Combine3Weights(rWeights, Bit0, Bit1, Bit2); + + /* green component */ + Bit0 = (DrvPromPalette[i] >> 3) & 0x01; + Bit1 = (DrvPromPalette[i] >> 4) & 0x01; + Bit2 = (DrvPromPalette[i] >> 5) & 0x01; + g = Combine3Weights(gWeights, Bit0, Bit1, Bit2); + + /* blue component */ + Bit0 = (DrvPromPalette[i] >> 6) & 0x01; + Bit1 = (DrvPromPalette[i] >> 7) & 0x01; + b = Combine2Weights(bWeights, Bit0, Bit1); + + Palette[i] = BurnHighCol(r, g, b, 0); + } + + for (i = 0; i < 256; i++) { + UINT8 PaletteEntry = DrvPromLookup[i] & 0x0f; + DrvPalette[i] = Palette[PaletteEntry]; + } + + for (i = 256; i < 260; i++) { + DrvPalette[i] = Palette[(i - 0x100) | 0x10]; + } +} + +#undef MAX_NETS +#undef MAX_RES_PER_NET +#undef Combine2Weights +#undef Combine3Weights + +static void DrvRenderBgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0, Flip, xFlip, yFlip; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Code = DrvVideoRam[TileIndex + 0x400 + 0x000]; + Colour = DrvVideoRam[TileIndex + 0x400 + 0x800]; + Flip = ((Colour >> 6) & 0x03) ^ 1; + xFlip = Flip & 0x01; + yFlip = Flip & 0x02; + Colour &= 0x3f; + + x = 8 * mx; + y = 8 * my; + + x -= xScroll; + y -= yScroll; + + x += 3; + y -= 16; + + if (x < -8) x += 256; + if (x > 247) x -= 256; + if (y < -8) y += 256; + + if (x < 224) { + if (x > 8 && x < 280 && y > 8 && y < 216) { + if (xFlip) { + if (yFlip) { + Render8x8Tile_FlipXY(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } else { + Render8x8Tile_FlipX(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } + } else { + if (yFlip) { + Render8x8Tile_FlipY(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } else { + Render8x8Tile(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render8x8Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } else { + Render8x8Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } + } else { + if (yFlip) { + Render8x8Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } else { + Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } + } + } + } + + TileIndex++; + } + } +} + +static void DrvRenderFgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex, Flip, xFlip, yFlip; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 8; mx++) { + TileIndex = mx + (my << 5); + Code = DrvVideoRam[TileIndex + 0x000 + 0x000]; + Colour = DrvVideoRam[TileIndex + 0x000 + 0x800]; + Flip = ((Colour >> 6) & 0x03) ^ 1; + xFlip = Flip & 0x01; + yFlip = Flip & 0x02; + Colour &= 0x3f; + + x = 8 * mx; + y = 8 * my; + + y -= 16; + + x -= 32; + if (x < 0) x += 64; + + x += 224; + + if (x > 8 && x < 280 && y > 8 && y < 216) { + if (xFlip) { + if (yFlip) { + Render8x8Tile_FlipXY(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } else { + Render8x8Tile_FlipX(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } + } else { + if (yFlip) { + Render8x8Tile_FlipY(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } else { + Render8x8Tile(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render8x8Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } else { + Render8x8Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } + } else { + if (yFlip) { + Render8x8Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } else { + Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 2, 0, DrvChars); + } + } + } + } + } +} + +static void DrvRenderSprites(INT32 Displacement) +{ + UINT32 SpriteRamBase = 0x14; + UINT8 *SpriteRam = DrvVideoRam; + UINT8 *SpriteRam2 = DrvVideoRam + 0x800; + + for (UINT32 Offs = 0x20 - 2; Offs >= SpriteRamBase; Offs -= 2) { + INT32 sx = SpriteRam[Offs + 1] + ((SpriteRam2[Offs + 1] & 0x80) << 1) - Displacement; + INT32 sy = 241 - SpriteRam2[Offs] - Displacement; + INT32 Colour = SpriteRam2[Offs + 1] & 0x3f; + INT32 xFlip = SpriteRam[Offs] & 1; + INT32 yFlip = SpriteRam[Offs] & 2; + INT32 Code = (SpriteRam[Offs] & 0xfc) >> 2; + +// if (flip_screen_get(machine)) +// sx -= 2 * displacement; + + + sy -= 16; + + if (sx > 16 && sx < 272 && sy > 16 && sy < 208) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 2, 0, 0, DrvSprites); + } + } + } + } +} + +static void DrvRenderBullets() +{ + UINT32 SpriteRamBase = 0x14; + UINT8 *RadarX = DrvVideoRam + 0x020; + UINT8 *RadarY = DrvVideoRam + 0x820; + + for (UINT32 Offs = SpriteRamBase; Offs < 0x20; Offs++) { + INT32 x, y, Code; + + x = RadarX[Offs] + ((~DrvRadarAttrRam[Offs & 0x0f] & 0x01) << 8); + y = 253 - RadarY[Offs]; + Code = ((DrvRadarAttrRam[Offs & 0x0f] & 0x0e) >> 1) ^ 0x07; + + y -= 16; + +// if (flip_screen_get(machine)) +// x -= 3; + +// if (transpen) +// drawgfx_transpen(bitmap,cliprect,machine->gfx[2], +// ((state->radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, +// 0, +// 0,0, +// x,y, +// 3); +// else +// drawgfx_transtable(bitmap,cliprect,machine->gfx[2], +// ((state->radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, +// 0, +// 0,0, +// x,y, +/// state->drawmode_table,machine->shadow_table); + + RenderCustomTile_Mask_Clip(pTransDraw, 4, 4, Code, x, y, 0, 2, 3, 0x100, DrvDots); + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + DrvRenderBgLayer(); + DrvRenderSprites(1); + DrvRenderFgLayer(); + DrvRenderBullets(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = nBurnSoundLen; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + INT32 nSoundBufferPos = 0; + + nCyclesTotal[0] = (18432000 / 6) / 60; + nCyclesDone[0] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == (nInterleave - 1) && DrvCPUFireIRQ) { + ZetSetVector(DrvCPUIRQVector); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + NamcoSoundUpdate(pSoundBuf, nSegmentLength); + BurnSampleRender(pSoundBuf, nSegmentLength); + } + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + NamcoSoundUpdate(pSoundBuf, nSegmentLength); + BurnSampleRender(pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 JunglerFrame() +{ + INT32 nInterleave = 10; + + if (DrvReset) JunglerDoReset(); + + JunglerMakeInputs(); + +// INT32 nSoundBufferPos = 0; + + nCyclesTotal[0] = (18432000 / 6) / 60; + nCyclesTotal[1] = (14318180 / 8) / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == (nInterleave - 1) && DrvCPUFireIRQ) { + ZetNmi(); + } + ZetClose(); + +/* if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + NamcoSoundUpdate(pSoundBuf, nSegmentLength); + BurnSampleRender(pSoundBuf, nSegmentLength); + } + nSoundBufferPos += nSegmentLength; + }*/ + } + +/* if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + NamcoSoundUpdate(pSoundBuf, nSegmentLength); + BurnSampleRender(pSoundBuf, nSegmentLength); + } + }*/ + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029708; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); // Scan Z80 + NamcoSoundScan(nAction, pnMin); + } + + return 0; +} + +struct BurnDriver BurnDrvRallyx = { + "rallyx", NULL, NULL, "rallyx", "1980", + "Rally X (32k Ver.?))\0", NULL, "Namco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, RallyxRomInfo, RallyxRomName, RallyxSampleInfo, RallyxSampleName, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 260, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvRallyxa = { + "rallyxa", "rallyx", NULL, "rallyx", "1980", + "Rally X\0", NULL, "Namco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, RallyxaRomInfo, RallyxaRomName, RallyxSampleInfo, RallyxSampleName, DrvInputInfo, DrvDIPInfo, + DrvaInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 260, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvRallyxm = { + "rallyxm", "rallyx", NULL, "rallyx", "1980", + "Rally X (Midway)\0", NULL, "Namco (Midway License)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, RallyxmRomInfo, RallyxmRomName, RallyxSampleInfo, RallyxSampleName, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 260, 288, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNrallyx = { + "nrallyx", NULL, NULL, "rallyx", "1981", + "New Rally X\0", NULL, "Namco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, NrallyxRomInfo, NrallyxRomName, RallyxSampleInfo, RallyxSampleName, DrvInputInfo, DrvDIPInfo, + NrallyxInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 260, 288, 224, 4, 3 +}; + + + +struct BurnDriverD BurnDrvJungler = { + "jungler", NULL, NULL, NULL, "1981", + "Jungler\0", NULL, "Konami", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, JunglerRomInfo, JunglerRomName, NULL, NULL, JunglerInputInfo, JunglerDIPInfo, + JunglerInit, DrvExit, JunglerFrame, NULL, DrvScan, + NULL, 324, 224, 288, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_route16.cpp b/src/burn/drv/pre90s/d_route16.cpp index 12af407a0..137b5bcb5 100644 --- a/src/burn/drv/pre90s/d_route16.cpp +++ b/src/burn/drv/pre90s/d_route16.cpp @@ -1,1069 +1,1067 @@ -// FB Alpha Route 16 driver module -// Based on code by Zsolt Vasvari - -#include "burnint.h" -#include "z80_intf.h" -#include "driver.h" -#include "dac.h" -extern "C" { -#include "ay8910.h" -} - -//------------------------------------------------------------------------------------------------ - -static INT32 draw_type; -static UINT8 *Mem = NULL; -static UINT8 *Rom0, *Rom1, *Prom; - -static UINT8 flipscreen, palette_1, palette_2, ttmahjng_port_select; -static INT32 speakres_vrx; - -static INT16 *pAY8910Buffer[3]; -static INT16 *pFMBuffer = NULL; - -static UINT8 DrvJoy1[24], DrvJoy2[8], Dips, DrvReset; - -//------------------------------------------------------------------------------------------------ - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p1 start" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 2, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 4, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 5, "p1 down", }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 1"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 0, "p2 start" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p2 right" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 4, "p2 down", }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 1"}, - - {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag" }, - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, &Dips , "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo mahjongInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 1, "p1 start"}, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 2, "p2 start"}, - {"A", BIT_DIGITAL, DrvJoy1 + 3, "mah a"}, - {"E", BIT_DIGITAL, DrvJoy1 + 4, "mah e"}, - {"I", BIT_DIGITAL, DrvJoy1 + 5, "mah i"}, - {"M", BIT_DIGITAL, DrvJoy1 + 6, "mah m"}, - {"Kan", BIT_DIGITAL, DrvJoy1 + 7, "mah kan"}, - {"B", BIT_DIGITAL, DrvJoy1 + 8, "mah b"}, - {"F", BIT_DIGITAL, DrvJoy1 + 9, "mah f"}, - {"J", BIT_DIGITAL, DrvJoy1 + 10, "mah j"}, - {"N", BIT_DIGITAL, DrvJoy1 + 11, "mah n"}, - {"Reach", BIT_DIGITAL, DrvJoy1 + 12, "mah reach"}, - {"C", BIT_DIGITAL, DrvJoy1 + 13, "mah c"}, - {"G", BIT_DIGITAL, DrvJoy1 + 14, "mah g"}, - {"K", BIT_DIGITAL, DrvJoy1 + 15, "mah k"}, - {"Chi", BIT_DIGITAL, DrvJoy1 + 16, "mah chi"}, - {"Ron", BIT_DIGITAL, DrvJoy1 + 17, "mah ron"}, - {"D", BIT_DIGITAL, DrvJoy1 + 18, "mah d"}, - {"H", BIT_DIGITAL, DrvJoy1 + 19, "mah h"}, - {"L", BIT_DIGITAL, DrvJoy1 + 20, "mah l"}, - {"Pon", BIT_DIGITAL, DrvJoy1 + 21, "mah pon"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, -}; - -STDINPUTINFO(mahjong) - - - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x20, NULL }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0f, 0x01, 0x01, 0x00, "3" }, - {0x0f, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 3 , "Coinage" }, - {0x0f, 0x01, 0x18, 0x08, "2C_1C" }, - {0x0f, 0x01, 0x18, 0x00, "1C_1C" }, - {0x0f, 0x01, 0x18, 0x18, "1C_2C" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x20, 0x20, "Upright" }, - {0x0f, 0x01, 0x20, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x40, 0x00, "Off" }, - {0x0f, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x80, 0x00, "Off" }, - {0x0f, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Drv) - -static struct BurnDIPInfo stratvoxDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x20, NULL }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0f, 0x01, 0x01, 0x00, "3" }, - {0x0f, 0x01, 0x01, 0x01, "5" }, - - {0 , 0xfe, 0 , 2 , "Replenish Astronauts" }, - {0x0f, 0x01, 0x02, 0x00, "No" }, - {0x0f, 0x01, 0x02, 0x02, "Yes" }, - - {0 , 0xfe, 0 , 4 , "2 Attackers At Wave" }, - {0x0f, 0x01, 0x0c, 0x00, "2" }, - {0x0f, 0x01, 0x0c, 0x04, "3" }, - {0x0f, 0x01, 0x0c, 0x08, "4" }, - {0x0f, 0x01, 0x0c, 0x0c, "5" }, - - {0 , 0xfe, 0 , 3 , "Astronauts Kidnapped" }, - {0x0f, 0x01, 0x10, 0x00, "Less Often" }, - {0x0f, 0x01, 0x10, 0x10, "More Often" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x20, 0x20, "Upright" }, - {0x0f, 0x01, 0x20, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x40, 0x00, "Off" }, - {0x0f, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x80, 0x00, "Off" }, - {0x0f, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(stratvox) - -static struct BurnDIPInfo speakresDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x20, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x03, 0x00, "3" }, - {0x0f, 0x01, 0x03, 0x01, "4" }, - {0x0f, 0x01, 0x03, 0x02, "5" }, - {0x0f, 0x01, 0x03, 0x03, "6" }, - - {0 , 0xfe, 0 , 4 , "2 Attackers At Wave" }, - {0x0f, 0x01, 0x0c, 0x00, "2" }, - {0x0f, 0x01, 0x0c, 0x04, "3" }, - {0x0f, 0x01, 0x0c, 0x08, "4" }, - {0x0f, 0x01, 0x0c, 0x0c, "5" }, - - {0 , 0xfe, 0 , 3 , "Bonus Life" }, - {0x0f, 0x01, 0x10, 0x00, "5000" }, - {0x0f, 0x01, 0x10, 0x10, "8000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x20, 0x20, "Upright" }, - {0x0f, 0x01, 0x20, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x40, 0x00, "Off" }, - {0x0f, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x80, 0x00, "Off" }, - {0x0f, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(speakres) - - -//------------------------------------------------------------------------------------------------ - -static UINT8 ttmahjng_input_port_matrix_r() -{ - UINT8 ret = 0; - - switch (ttmahjng_port_select) - { - case 1: { - for (INT32 i = 0; i < 5; i++) ret |= DrvJoy1[ 3 + i] << i; - ret |= DrvJoy1[1] << 5; - } - break; - case 2: { - for (INT32 i = 0; i < 5; i++) ret |= DrvJoy1[ 8 + i] << i; - ret |= DrvJoy1[2] << 5; - } - break; - case 4: { - for (INT32 i = 0; i < 5; i++) ret |= DrvJoy1[13 + i] << i; - } - break; - case 8: { - for (INT32 i = 0; i < 4; i++) ret |= DrvJoy1[18 + i] << i; - } - break; - default: break; - } - - return ~ret; -} - - -UINT8 __fastcall route16_cpu0_read(UINT16 offset) -{ - UINT8 nRet = 0; - - switch (offset) - { - case 0x4800: - return Dips; - - case 0x5000: - { - if (draw_type == 1) { // ttmahjng - nRet = (DrvJoy1[0] << 7) ^ 0xff; - } else { - if (DrvJoy1[2]) nRet |= 0x01; - if (DrvJoy1[3]) nRet |= 0x02; - if (DrvJoy1[4]) nRet |= 0x04; - if (DrvJoy1[5]) nRet |= 0x08; - if (DrvJoy1[6]) nRet |= 0x10; - if (DrvJoy1[7]) nRet |= 0x40; // service mode - if (DrvJoy1[0]) nRet |= 0x80; // coin - } - return nRet; - } - - - case 0x5800: - { - if (draw_type == 1) { // ttmahjng - nRet = ttmahjng_input_port_matrix_r(); - } else { - if (DrvJoy2[1]) nRet |= 0x01; - if (DrvJoy2[2]) nRet |= 0x02; - if (DrvJoy2[3]) nRet |= 0x04; - if (DrvJoy2[4]) nRet |= 0x08; - if (DrvJoy2[5]) nRet |= 0x10; - if (DrvJoy2[0]) nRet |= 0x40; // start 2 - if (DrvJoy1[1]) nRet |= 0x80; // start 1 - } - - return nRet; - } - - case 0x6000: // speakres - { - INT32 bit2=4, bit1=2, bit0=1; - - // just using a counter, the constants are the number of reads - // before going low, each read is 40 cycles apart. the constants - // were chosen based on the startup tests and for vr0=vr2 - speakres_vrx++; - if(speakres_vrx>0x300) bit0=0; /* VR0 100k ohm - speech */ - if(speakres_vrx>0x200) bit1=0; /* VR1 50k ohm - main volume */ - if(speakres_vrx>0x300) bit2=0; /* VR2 100k ohm - explosion */ - - return 0xf8|bit2|bit1|bit0; - } - - case 0x6400: // routex - { - if (ZetPc(-1) == 0x2f) - return 0xfb; - else - return 0; - } - } - - return 0; -} - - -void __fastcall route16_cpu0_write(UINT16 offset, UINT8 data) -{ - if (offset >= 0x4000 && offset < 0x4400) { - Rom0[offset] = data; - - // 4313-4319 are used in Route 16 as triggers to wake the other CPU - if (offset >= 0x4313 && offset <= 0x4319 && data == 0xff) - { - // Let the other CPU run - // cpu_yield(); - ZetRunEnd(); // Correct? - } - - return; - } - - switch (offset) - { - case 0x2800: // stratvox - DACWrite(0, data); - break; - - case 0x4800: - palette_1 = data & 0x1f; - break; - - case 0x5000: - palette_2 = data & 0x1f; - flipscreen = (data >> 5) & 0x01; - break; - - case 0x5800: // speakres, ttmahjng - ttmahjng_port_select = data; - speakres_vrx = 0; - break; - - case 0x6800: // ttmahjng - AY8910Write(0, 1, data); - break; - - case 0x6900: // ttmahjng - AY8910Write(0, 0, data); - break; - } -} - -void __fastcall route16_cpu0_out(UINT16 offset, UINT8 data) -{ - switch (offset & 0x1ff) - { - case 0x000: - AY8910Write(0, 1, data); - break; - - case 0x100: - AY8910Write(0, 0, data); - break; - } -} - - -static INT32 GetRoms() -{ - char* pRomName; - struct BurnRomInfo ri; - UINT8 *Rom0Load = Rom0; - UINT8 *Rom1Load = Rom1; - UINT8 *PromLoad = Prom; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & 7) == 1) { - if (BurnLoadRom(Rom0Load, i, 1)) return 1; - Rom0Load += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 2) { - if (BurnLoadRom(Rom1Load, i, 1)) return 1; - Rom1Load += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 3) { - if (BurnLoadRom(PromLoad, i, 1)) return 1; - PromLoad += ri.nLen; - continue; - } - } - - return 0; -} - - -static INT32 DrvDoReset() -{ - flipscreen = palette_1 = palette_2 = ttmahjng_port_select = 0; - speakres_vrx = 0; - - DrvReset = 0; - - memset (Rom0 + 0x4000, 0, 0xc000); // Shared & video ram - memset (Rom1 + 0x8000, 0, 0x4000); - - ZetOpen(0); - ZetReset(); - ZetClose(); - ZetOpen(1); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - - return 0; -} - -void stratvox_sn76477_write(UINT32, UINT32) -{ - -} - -static INT32 DrvSyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (2500000.000 / (nBurnFPS / 100.000)))); -} - -static INT32 DrvInit() -{ - Mem = (UINT8*)BurnMalloc(0x10000 + 0x10000 + 0x200); - if (Mem == NULL) { - return 1; - } - - pFMBuffer = (INT16 *)BurnMalloc (nBurnSoundLen * 3 * sizeof(INT16)); - if (pFMBuffer == NULL) { - return 1; - } - - Rom0 = Mem + 0x00000; - Rom1 = Mem + 0x10000; - Prom = Mem + 0x20000; - - // Load Roms - if (GetRoms()) return 1; - - ZetInit(0); - ZetOpen(0); - ZetSetOutHandler(route16_cpu0_out); - ZetSetReadHandler(route16_cpu0_read); - ZetSetWriteHandler(route16_cpu0_write); - ZetMapArea (0x0000, 0x3fff, 0, Rom0 + 0x0000); // ROM - ZetMapArea (0x0000, 0x3fff, 2, Rom0 + 0x0000); - ZetMapArea (0x4000, 0x43ff, 0, Rom0 + 0x4000); // Read Shared RAM - ZetMapArea (0x8000, 0xbfff, 0, Rom0 + 0x8000); // Video RAM - ZetMapArea (0x8000, 0xbfff, 1, Rom0 + 0x8000); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetWriteHandler(route16_cpu0_write); - ZetMapArea (0x0000, 0x1fff, 0, Rom1 + 0x0000); // ROM - ZetMapArea (0x0000, 0x1fff, 2, Rom1 + 0x0000); - ZetMapArea (0x4000, 0x43ff, 0, Rom0 + 0x4000); // Read Shared RAM - ZetMapArea (0x8000, 0xbfff, 0, Rom1 + 0x8000); // Video RAM - ZetMapArea (0x8000, 0xbfff, 1, Rom1 + 0x8000); - ZetMemEnd(); - ZetClose(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - - AY8910Init(0, 1250000, nBurnSoundRate, NULL, NULL, &stratvox_sn76477_write, NULL); - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - - DACInit(0, 0, 1, DrvSyncDAC); - DACSetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - - -static INT32 DrvExit() -{ - DACExit(); - ZetExit(); - AY8910Exit(0); - - BurnFree (Mem); - BurnFree (pFMBuffer); - - draw_type = 0; - - pFMBuffer = NULL; - Mem = NULL; - Rom0 = Rom1 = Prom = NULL; - pAY8910Buffer[0] = pAY8910Buffer[1] = pAY8910Buffer[2] = NULL; - - return 0; -} - - -//------------------------------------------------------------------------------------------------ -// Drawing functions - -static inline UINT32 route16_make_pen(UINT8 color) -{ - UINT32 ret = 0; - if (color & 1) ret |= 0x00ff0000; - if (color & 2) ret |= 0x0000ff00; - if (color & 4) ret |= 0x000000ff; - return ret; -} - - -static inline UINT32 ttmajng_make_pen(UINT8 color) -{ - UINT32 ret = 0; - if (color & 4) ret |= 0x00ff0000; - if (color & 2) ret |= 0x0000ff00; - if (color & 1) ret |= 0x000000ff; - return ret; -} - - -static INT32 DrvDraw() -{ - UINT8 *prom1 = Prom + 0x0000; - UINT8 *prom2 = Prom + 0x0100; - - for (INT32 offs = 0; offs < 0x4000; offs++) - { - UINT8 y = offs >> 6; - UINT8 x = offs << 2; - - UINT8 d1 = Rom0[0x8000 + offs]; - UINT8 d2 = Rom1[0x8000 + offs]; - - for (INT32 i = 0; i < 4; i++) - { - UINT8 color1, color2; - - // stratvox & ttmahjng - if (draw_type) { - color1 = prom1[(palette_1 << 2) | ((d1 >> 3) & 2) | (d1 & 1)]; - color2 = prom2[(((d1 << 3) & 0x80) | ((d1 << 7) & 0x80)) | (palette_2 << 2) | ((d2 >> 3) & 2) | (d2 & 1)]; - } else { - color1 = prom1[((palette_1 << 6) & 0x80) | (palette_1 << 2) | ((d1 >> 3) & 0x02) | ((d1 >> 0) & 0x01)]; - color2 = prom2[((palette_2 << 6) & 0x80) | (((color1 << 6) & 0x80) | ((color1 << 7) & 0x80)) | (palette_2 << 2) | ((d2 >> 3) & 2) | (d2 & 1)]; - } - - UINT8 final_color = color1 | color2; - - UINT32 pen; - if (draw_type == 1) { - pen = ttmajng_make_pen(final_color); - } else { - pen = route16_make_pen(final_color); - } - - if (flipscreen) - PutPix(pBurnDraw + ((x << 8) | (y ^ 0xff)) * nBurnBpp, BurnHighCol(pen>>16, pen>>8, pen, 0)); - else - PutPix(pBurnDraw + (((x ^ 0xff) << 8) | y) * nBurnBpp, BurnHighCol(pen>>16, pen>>8, pen, 0)); - - x += 1; - d1 >>= 1; - d2 >>= 1; - } - } - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 100; - - INT32 DACIRQFireSlice[48]; - for (INT32 i = 0; i < 48; i++) { - DACIRQFireSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 49)); - } - - INT32 nCyclesSegment; - INT32 nCyclesDone[2], nCyclesTotal[2]; - - nCyclesTotal[0] = 2500000 / 60; - nCyclesTotal[1] = 2500000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #0 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i+1 == nInterleave) ZetRaiseIrq(1); - ZetClose(); - - // Run Z80 #1 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (draw_type == 3) { // space echo - for (INT32 j = 0; j < 48; j++) { - if (i == DACIRQFireSlice[j]) { - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - } - } - ZetClose(); - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - -//------------------------------------------------------------------------------------------------ -// Savestates - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = Rom0 + 0x4000; - ba.nLen = 0x0400; - ba.szName = "Shared RAM"; - BurnAcb(&ba); - - memset(&ba, 0, sizeof(ba)); - ba.Data = Rom0 + 0x8000; - ba.nLen = 0x4000; - ba.szName = "Cpu0 Video RAM"; - BurnAcb(&ba); - - memset(&ba, 0, sizeof(ba)); - ba.Data = Rom1 + 0x8000; - ba.nLen = 0x4000; - ba.szName = "Cpu1 Video RAM"; - BurnAcb(&ba); - - ZetScan(nAction); // Scan Z80 - AY8910Scan(nAction, pnMin); // Scan AY8910 - - // Scan critical driver variables - SCAN_VAR(flipscreen); - SCAN_VAR(palette_1); - SCAN_VAR(palette_2); - SCAN_VAR(ttmahjng_port_select); - SCAN_VAR(speakres_vrx); - } - - return 0; -} - - -//------------------------------------------------------------------------------------------------ -// Drivers - - -// Route 16 - -static struct BurnRomInfo route16RomDesc[] = { - { "route16.a0", 0x0800, 0x8f9101bd, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code - { "route16.a1", 0x0800, 0x389bc077, 1 | BRF_ESS | BRF_PRG }, // 1 - { "route16.a2", 0x0800, 0x1065a468, 1 | BRF_ESS | BRF_PRG }, // 2 - { "route16.a3", 0x0800, 0x0b1987f3, 1 | BRF_ESS | BRF_PRG }, // 3 - { "route16.a4", 0x0800, 0xf67d853a, 1 | BRF_ESS | BRF_PRG }, // 4 - { "route16.a5", 0x0800, 0xd85cf758, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "route16.b0", 0x0800, 0x0f9588a7, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code - { "route16.b1", 0x0800, 0x2b326cf9, 2 | BRF_ESS | BRF_PRG }, // 7 - { "route16.b2", 0x0800, 0x529cad13, 2 | BRF_ESS | BRF_PRG }, // 8 - { "route16.b3", 0x0800, 0x3bd8b899, 2 | BRF_ESS | BRF_PRG }, // 9 - - { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 10 Graphics - { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(route16) -STD_ROM_FN(route16) - -static INT32 route16Init() -{ - INT32 nRet; - - draw_type = 0; - - nRet = DrvInit(); - - if (nRet == 0) - { - // Patch protection - Rom0[0x00e9] = 0x3a; - Rom0[0x0754] = 0xc3; - Rom0[0x0755] = 0x63; - Rom0[0x0756] = 0x07; - } - - return nRet; -} - -struct BurnDriver BurnDrvroute16 = { - "route16", NULL, NULL, NULL, "1981", - "Route 16\0", NULL, "Tehkan/Sun (Centuri license)", "Route 16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, route16RomInfo, route16RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - route16Init, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, - 256, 256, 3, 4 -}; - - -// Route 16 (set 2) - -static struct BurnRomInfo route16aRomDesc[] = { - { "vg-54", 0x0800, 0x0c966319, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code - { "vg-55", 0x0800, 0xa6a8c212, 1 | BRF_ESS | BRF_PRG }, // 1 - { "vg-56", 0x0800, 0x5c74406a, 1 | BRF_ESS | BRF_PRG }, // 2 - { "vg-57", 0x0800, 0x313e68ab, 1 | BRF_ESS | BRF_PRG }, // 3 - { "vg-58", 0x0800, 0x40824e3c, 1 | BRF_ESS | BRF_PRG }, // 4 - { "vg-59", 0x0800, 0x9313d2c2, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "route16.b0", 0x0800, 0x0f9588a7, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code - { "vg-61", 0x0800, 0xb216c88c, 2 | BRF_ESS | BRF_PRG }, // 7 - { "route16.b2", 0x0800, 0x529cad13, 2 | BRF_ESS | BRF_PRG }, // 8 - { "route16.b3", 0x0800, 0x3bd8b899, 2 | BRF_ESS | BRF_PRG }, // 9 - - { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 10 Graphics - { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(route16a) -STD_ROM_FN(route16a) - -static INT32 route16aInit() -{ - INT32 nRet; - - draw_type = 0; - - nRet = DrvInit(); - - if (nRet == 0) - { - // Patch protection - Rom0[0x00e9] = 0x3a; - - Rom0[0x0105] = 0x00; // jp nz,$4109 (nirvana) - NOP's in route16 - Rom0[0x0106] = 0x00; - Rom0[0x0107] = 0x00; - - Rom0[0x0731] = 0x00; // jp nz,$4238 (nirvana) - Rom0[0x0732] = 0x00; - Rom0[0x0733] = 0x00; - - Rom0[0x0747] = 0xc3; - Rom0[0x0748] = 0x56; - Rom0[0x0749] = 0x07; - } - - return nRet; -} - -struct BurnDriver BurnDrvroute16a = { - "route16a", "route16", NULL, NULL, "1981", - "Route 16 (set 2)\0", NULL, "Tehkan/Sun (Centuri license)", "Route 16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, route16aRomInfo, route16aRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - route16aInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, - 256, 256, 3, 4 -}; - - -// Route 16 (bootleg) - -static struct BurnRomInfo route16bRomDesc[] = { - { "rt16.0", 0x0800, 0xb1f0f636, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code - { "rt16.1", 0x0800, 0x3ec52fe5, 1 | BRF_ESS | BRF_PRG }, // 1 - { "rt16.2", 0x0800, 0xa8e92871, 1 | BRF_ESS | BRF_PRG }, // 2 - { "rt16.3", 0x0800, 0xa0fc9fc5, 1 | BRF_ESS | BRF_PRG }, // 3 - { "rt16.4", 0x0800, 0x6dcaf8c4, 1 | BRF_ESS | BRF_PRG }, // 4 - { "rt16.5", 0x0800, 0x63d7b05b, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "rt16.6", 0x0800, 0xfef605f3, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code - { "rt16.7", 0x0800, 0xd0d6c189, 2 | BRF_ESS | BRF_PRG }, // 7 - { "rt16.8", 0x0800, 0xdefc5797, 2 | BRF_ESS | BRF_PRG }, // 8 - { "rt16.9", 0x0800, 0x88d94a66, 2 | BRF_ESS | BRF_PRG }, // 9 - - { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 10 Graphics - { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(route16b) -STD_ROM_FN(route16b) - -static INT32 route16bInit() -{ - draw_type = 0; - - return DrvInit(); -} - -struct BurnDriver BurnDrvroute16b = { - "route16b", "route16", NULL, NULL, "1981", - "Route 16 (bootleg)\0", NULL, "bootleg", "Route 16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, route16bRomInfo, route16bRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - route16Init, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, - 256, 256, 3, 4 -}; - - -// Route X (bootleg) - -static struct BurnRomInfo routexRomDesc[] = { - { "routex01.a0", 0x0800, 0x99b500e7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code - { "rt16.1", 0x0800, 0x3ec52fe5, 1 | BRF_ESS | BRF_PRG }, // 1 - { "rt16.2", 0x0800, 0xa8e92871, 1 | BRF_ESS | BRF_PRG }, // 2 - { "rt16.3", 0x0800, 0xa0fc9fc5, 1 | BRF_ESS | BRF_PRG }, // 3 - { "routex05.a4", 0x0800, 0x2fef7653, 1 | BRF_ESS | BRF_PRG }, // 4 - { "routex06.a5", 0x0800, 0xa39ef648, 1 | BRF_ESS | BRF_PRG }, // 5 - { "routex07.a6", 0x0800, 0x89f80c1c, 1 | BRF_ESS | BRF_PRG }, // 6 - - { "routex11.b0", 0x0800, 0xb51edd1d, 2 | BRF_ESS | BRF_PRG }, // 7 Z80 #1 Code - { "rt16.7", 0x0800, 0xd0d6c189, 2 | BRF_ESS | BRF_PRG }, // 8 - { "rt16.8", 0x0800, 0xdefc5797, 2 | BRF_ESS | BRF_PRG }, // 9 - { "rt16.9", 0x0800, 0x88d94a66, 2 | BRF_ESS | BRF_PRG }, // 10 - - { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 11 Graphics - { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(routex) -STD_ROM_FN(routex) - -struct BurnDriver BurnDrvroutex = { - "routex", "route16", NULL, NULL, "1981", - "Route X (bootleg)\0", NULL, "bootleg", "Route 16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, - NULL, routexRomInfo, routexRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - route16bInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, - 256, 256, 3, 4 -}; - - -// Speak & Rescue - -static struct BurnRomInfo speakresRomDesc[] = { - { "speakres.1", 0x0800, 0x6026e4ea, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code - { "speakres.2", 0x0800, 0x93f0d4da, 1 | BRF_ESS | BRF_PRG }, // 1 - { "speakres.3", 0x0800, 0xa3874304, 1 | BRF_ESS | BRF_PRG }, // 2 - { "speakres.4", 0x0800, 0xf484be3a, 1 | BRF_ESS | BRF_PRG }, // 3 - { "speakres.5", 0x0800, 0x61b12a67, 1 | BRF_ESS | BRF_PRG }, // 4 - { "speakres.6", 0x0800, 0x220e0ab2, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "speakres.7", 0x0800, 0xd417be13, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code - { "speakres.8", 0x0800, 0x52485d60, 2 | BRF_ESS | BRF_PRG }, // 7 - - { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 8 Graphics - { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(speakres) -STD_ROM_FN(speakres) - -static INT32 speakresInit() -{ - draw_type = 2; - - return DrvInit(); -} - -struct BurnDriver BurnDrvspeakres = { - "speakres", NULL, NULL, NULL, "1980", - "Speak & Rescue\0", NULL, "Sun Electronics", "Route 16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, speakresRomInfo, speakresRomName, NULL, NULL, DrvInputInfo, speakresDIPInfo, - speakresInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, - 256, 256, 3, 4 -}; - - -// Stratovox - -static struct BurnRomInfo stratvoxRomDesc[] = { - { "ls01.bin", 0x0800, 0xbf4d582e, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code - { "ls02.bin", 0x0800, 0x16739dd4, 1 | BRF_ESS | BRF_PRG }, // 1 - { "ls03.bin", 0x0800, 0x083c28de, 1 | BRF_ESS | BRF_PRG }, // 2 - { "ls04.bin", 0x0800, 0xb0927e3b, 1 | BRF_ESS | BRF_PRG }, // 3 - { "ls05.bin", 0x0800, 0xccd25c4e, 1 | BRF_ESS | BRF_PRG }, // 4 - { "ls06.bin", 0x0800, 0x07a907a7, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "ls07.bin", 0x0800, 0x4d333985, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code - { "ls08.bin", 0x0800, 0x35b753fc, 2 | BRF_ESS | BRF_PRG }, // 7 - - { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 8 Graphics - { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(stratvox) -STD_ROM_FN(stratvox) - -struct BurnDriver BurnDrvstratvox = { - "stratvox", "speakres", NULL, NULL, "1980", - "Stratovox\0", NULL, "[Sun Electronics] (Taito license)", "Route 16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, stratvoxRomInfo, stratvoxRomName, NULL, NULL, DrvInputInfo, stratvoxDIPInfo, - speakresInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, - 256, 256, 3, 4 -}; - - -// Stratovox (bootleg) - -static struct BurnRomInfo stratvobRomDesc[] = { - { "j0-1", 0x0800, 0x93c78274, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code - { "j0-2", 0x0800, 0x93b2b02d, 1 | BRF_ESS | BRF_PRG }, // 1 - { "j0-3", 0x0800, 0x655facb5, 1 | BRF_ESS | BRF_PRG }, // 2 - { "j0-4", 0x0800, 0xb0927e3b, 1 | BRF_ESS | BRF_PRG }, // 3 - { "j0-5", 0x0800, 0x9d2178d9, 1 | BRF_ESS | BRF_PRG }, // 4 - { "j0-6", 0x0800, 0x79118ffc, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "b0-a", 0x0800, 0x4d333985, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code - { "j0-a", 0x0800, 0x3416a830, 2 | BRF_ESS | BRF_PRG }, // 7 - - { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 8 Graphics - { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(stratvob) -STD_ROM_FN(stratvob) - -struct BurnDriver BurnDrvstratvob = { - "stratvoxb", "speakres", NULL, NULL, "1980", - "Stratovox (bootleg)\0", NULL, "bootleg", "Route 16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, stratvobRomInfo, stratvobRomName, NULL, NULL, DrvInputInfo, stratvoxDIPInfo, - speakresInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, - 256, 256, 3, 4 -}; - - -// Space Echo (bootleg) - -static struct BurnRomInfo spacechoRomDesc[] = { - { "rom.a0", 0x0800, 0x40d74dce, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code - { "rom.a1", 0x0800, 0xa5f0a34f, 1 | BRF_ESS | BRF_PRG }, // 1 - { "rom.a2", 0x0800, 0xcbbb3acb, 1 | BRF_ESS | BRF_PRG }, // 2 - { "rom.a3", 0x0800, 0x311050ca, 1 | BRF_ESS | BRF_PRG }, // 3 - { "rom.a4", 0x0800, 0x28943803, 1 | BRF_ESS | BRF_PRG }, // 4 - { "rom.a5", 0x0800, 0x851c9f28, 1 | BRF_ESS | BRF_PRG }, // 5 - - { "rom.b0", 0x0800, 0xdb45689d, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code - { "rom.b2", 0x0800, 0x1e074157, 2 | BRF_ESS | BRF_PRG }, // 7 - { "rom.b3", 0x0800, 0xd50a8b20, 2 | BRF_ESS | BRF_PRG }, // 8 - - { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 9 Graphics - { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(spacecho) -STD_ROM_FN(spacecho) - -static INT32 spacechoInit() -{ - INT32 nRet; - - draw_type = 3; - - nRet = DrvInit(); - - memcpy (Rom1 + 0x1000, Rom1 + 0x800, 0x1000); - - return nRet; -} - -struct BurnDriver BurnDrvspacecho = { - "spacecho", "speakres", NULL, NULL, "1980", - "Space Echo (bootleg)\0", NULL, "bootleg", "Route 16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, spacechoRomInfo, spacechoRomName, NULL, NULL, DrvInputInfo, stratvoxDIPInfo, - spacechoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, - 256, 256, 3, 4 -}; - - -// Mahjong - -static struct BurnRomInfo ttmahjngRomDesc[] = { - { "ju04", 0x1000, 0xfe7c693a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code - { "ju05", 0x1000, 0x985723d3, 1 | BRF_ESS | BRF_PRG }, // 1 - { "ju06", 0x1000, 0x2cd69bc8, 1 | BRF_ESS | BRF_PRG }, // 2 - { "ju07", 0x1000, 0x30e8ec63, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "ju01", 0x0800, 0x0f05ca3c, 2 | BRF_ESS | BRF_PRG }, // 4 Z80 #1 Code - { "ju02", 0x0800, 0xc1ffeceb, 2 | BRF_ESS | BRF_PRG }, // 5 - { "ju08", 0x0800, 0x2dcc76b5, 2 | BRF_ESS | BRF_PRG }, // 6 - - { "ju03", 0x0100, 0x27d47624, 3 | BRF_GRA }, // 7 Graphics - { "ju09", 0x0100, 0x27d47624, 3 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(ttmahjng) -STD_ROM_FN(ttmahjng) - -static INT32 ttmahjngInit() -{ - draw_type = 1; - - return DrvInit(); -} - -struct BurnDriver BurnDrvttmahjng = { - "ttmahjng", NULL, NULL, NULL, "1980", - "Mahjong\0", NULL, "Taito", "Route 16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, - NULL, ttmahjngRomInfo, ttmahjngRomName, NULL, NULL, mahjongInputInfo, NULL, - ttmahjngInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, - 256, 256, 4, 3 -}; - - +// FB Alpha Route 16 driver module +// Based on code by Zsolt Vasvari + +#include "burnint.h" +#include "z80_intf.h" +#include "driver.h" +#include "dac.h" +extern "C" { +#include "ay8910.h" +} + +//------------------------------------------------------------------------------------------------ + +static INT32 draw_type; +static UINT8 *Mem = NULL; +static UINT8 *Rom0, *Rom1, *Prom; + +static UINT8 flipscreen, palette_1, palette_2, ttmahjng_port_select; +static INT32 speakres_vrx; + +static INT16 *pAY8910Buffer[3]; +static INT16 *pFMBuffer = NULL; + +static UINT8 DrvJoy1[24], DrvJoy2[8], Dips, DrvReset; + +//------------------------------------------------------------------------------------------------ + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p1 start" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 2, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 4, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 5, "p1 down", }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 1"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 0, "p2 start" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p2 right" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 4, "p2 down", }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 1"}, + + {"Service Mode", BIT_DIGITAL, DrvJoy1 + 7, "diag" }, + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, &Dips , "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo mahjongInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 1, "p1 start"}, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 2, "p2 start"}, + {"A", BIT_DIGITAL, DrvJoy1 + 3, "mah a"}, + {"E", BIT_DIGITAL, DrvJoy1 + 4, "mah e"}, + {"I", BIT_DIGITAL, DrvJoy1 + 5, "mah i"}, + {"M", BIT_DIGITAL, DrvJoy1 + 6, "mah m"}, + {"Kan", BIT_DIGITAL, DrvJoy1 + 7, "mah kan"}, + {"B", BIT_DIGITAL, DrvJoy1 + 8, "mah b"}, + {"F", BIT_DIGITAL, DrvJoy1 + 9, "mah f"}, + {"J", BIT_DIGITAL, DrvJoy1 + 10, "mah j"}, + {"N", BIT_DIGITAL, DrvJoy1 + 11, "mah n"}, + {"Reach", BIT_DIGITAL, DrvJoy1 + 12, "mah reach"}, + {"C", BIT_DIGITAL, DrvJoy1 + 13, "mah c"}, + {"G", BIT_DIGITAL, DrvJoy1 + 14, "mah g"}, + {"K", BIT_DIGITAL, DrvJoy1 + 15, "mah k"}, + {"Chi", BIT_DIGITAL, DrvJoy1 + 16, "mah chi"}, + {"Ron", BIT_DIGITAL, DrvJoy1 + 17, "mah ron"}, + {"D", BIT_DIGITAL, DrvJoy1 + 18, "mah d"}, + {"H", BIT_DIGITAL, DrvJoy1 + 19, "mah h"}, + {"L", BIT_DIGITAL, DrvJoy1 + 20, "mah l"}, + {"Pon", BIT_DIGITAL, DrvJoy1 + 21, "mah pon"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, +}; + +STDINPUTINFO(mahjong) + + + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x20, NULL }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0f, 0x01, 0x01, 0x00, "3" }, + {0x0f, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 3 , "Coinage" }, + {0x0f, 0x01, 0x18, 0x08, "2C_1C" }, + {0x0f, 0x01, 0x18, 0x00, "1C_1C" }, + {0x0f, 0x01, 0x18, 0x18, "1C_2C" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x20, 0x20, "Upright" }, + {0x0f, 0x01, 0x20, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x40, 0x00, "Off" }, + {0x0f, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x80, 0x00, "Off" }, + {0x0f, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Drv) + +static struct BurnDIPInfo stratvoxDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x20, NULL }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0f, 0x01, 0x01, 0x00, "3" }, + {0x0f, 0x01, 0x01, 0x01, "5" }, + + {0 , 0xfe, 0 , 2 , "Replenish Astronauts" }, + {0x0f, 0x01, 0x02, 0x00, "No" }, + {0x0f, 0x01, 0x02, 0x02, "Yes" }, + + {0 , 0xfe, 0 , 4 , "2 Attackers At Wave" }, + {0x0f, 0x01, 0x0c, 0x00, "2" }, + {0x0f, 0x01, 0x0c, 0x04, "3" }, + {0x0f, 0x01, 0x0c, 0x08, "4" }, + {0x0f, 0x01, 0x0c, 0x0c, "5" }, + + {0 , 0xfe, 0 , 3 , "Astronauts Kidnapped" }, + {0x0f, 0x01, 0x10, 0x00, "Less Often" }, + {0x0f, 0x01, 0x10, 0x10, "More Often" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x20, 0x20, "Upright" }, + {0x0f, 0x01, 0x20, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x40, 0x00, "Off" }, + {0x0f, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x80, 0x00, "Off" }, + {0x0f, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(stratvox) + +static struct BurnDIPInfo speakresDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x20, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x03, 0x00, "3" }, + {0x0f, 0x01, 0x03, 0x01, "4" }, + {0x0f, 0x01, 0x03, 0x02, "5" }, + {0x0f, 0x01, 0x03, 0x03, "6" }, + + {0 , 0xfe, 0 , 4 , "2 Attackers At Wave" }, + {0x0f, 0x01, 0x0c, 0x00, "2" }, + {0x0f, 0x01, 0x0c, 0x04, "3" }, + {0x0f, 0x01, 0x0c, 0x08, "4" }, + {0x0f, 0x01, 0x0c, 0x0c, "5" }, + + {0 , 0xfe, 0 , 3 , "Bonus Life" }, + {0x0f, 0x01, 0x10, 0x00, "5000" }, + {0x0f, 0x01, 0x10, 0x10, "8000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x20, 0x20, "Upright" }, + {0x0f, 0x01, 0x20, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x40, 0x00, "Off" }, + {0x0f, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x80, 0x00, "Off" }, + {0x0f, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(speakres) + + +//------------------------------------------------------------------------------------------------ + +static UINT8 ttmahjng_input_port_matrix_r() +{ + UINT8 ret = 0; + + switch (ttmahjng_port_select) + { + case 1: { + for (INT32 i = 0; i < 5; i++) ret |= DrvJoy1[ 3 + i] << i; + ret |= DrvJoy1[1] << 5; + } + break; + case 2: { + for (INT32 i = 0; i < 5; i++) ret |= DrvJoy1[ 8 + i] << i; + ret |= DrvJoy1[2] << 5; + } + break; + case 4: { + for (INT32 i = 0; i < 5; i++) ret |= DrvJoy1[13 + i] << i; + } + break; + case 8: { + for (INT32 i = 0; i < 4; i++) ret |= DrvJoy1[18 + i] << i; + } + break; + default: break; + } + + return ~ret; +} + + +UINT8 __fastcall route16_cpu0_read(UINT16 offset) +{ + UINT8 nRet = 0; + + switch (offset) + { + case 0x4800: + return Dips; + + case 0x5000: + { + if (draw_type == 1) { // ttmahjng + nRet = (DrvJoy1[0] << 7) ^ 0xff; + } else { + if (DrvJoy1[2]) nRet |= 0x01; + if (DrvJoy1[3]) nRet |= 0x02; + if (DrvJoy1[4]) nRet |= 0x04; + if (DrvJoy1[5]) nRet |= 0x08; + if (DrvJoy1[6]) nRet |= 0x10; + if (DrvJoy1[7]) nRet |= 0x40; // service mode + if (DrvJoy1[0]) nRet |= 0x80; // coin + } + return nRet; + } + + + case 0x5800: + { + if (draw_type == 1) { // ttmahjng + nRet = ttmahjng_input_port_matrix_r(); + } else { + if (DrvJoy2[1]) nRet |= 0x01; + if (DrvJoy2[2]) nRet |= 0x02; + if (DrvJoy2[3]) nRet |= 0x04; + if (DrvJoy2[4]) nRet |= 0x08; + if (DrvJoy2[5]) nRet |= 0x10; + if (DrvJoy2[0]) nRet |= 0x40; // start 2 + if (DrvJoy1[1]) nRet |= 0x80; // start 1 + } + + return nRet; + } + + case 0x6000: // speakres + { + INT32 bit2=4, bit1=2, bit0=1; + + // just using a counter, the constants are the number of reads + // before going low, each read is 40 cycles apart. the constants + // were chosen based on the startup tests and for vr0=vr2 + speakres_vrx++; + if(speakres_vrx>0x300) bit0=0; /* VR0 100k ohm - speech */ + if(speakres_vrx>0x200) bit1=0; /* VR1 50k ohm - main volume */ + if(speakres_vrx>0x300) bit2=0; /* VR2 100k ohm - explosion */ + + return 0xf8|bit2|bit1|bit0; + } + + case 0x6400: // routex + { + if (ZetPc(-1) == 0x2f) + return 0xfb; + else + return 0; + } + } + + return 0; +} + + +void __fastcall route16_cpu0_write(UINT16 offset, UINT8 data) +{ + if (offset >= 0x4000 && offset < 0x4400) { + Rom0[offset] = data; + + // 4313-4319 are used in Route 16 as triggers to wake the other CPU + if (offset >= 0x4313 && offset <= 0x4319 && data == 0xff) + { + // Let the other CPU run + // cpu_yield(); + ZetRunEnd(); // Correct? + } + + return; + } + + switch (offset) + { + case 0x2800: // stratvox + DACWrite(0, data); + break; + + case 0x4800: + palette_1 = data & 0x1f; + break; + + case 0x5000: + palette_2 = data & 0x1f; + flipscreen = (data >> 5) & 0x01; + break; + + case 0x5800: // speakres, ttmahjng + ttmahjng_port_select = data; + speakres_vrx = 0; + break; + + case 0x6800: // ttmahjng + AY8910Write(0, 1, data); + break; + + case 0x6900: // ttmahjng + AY8910Write(0, 0, data); + break; + } +} + +void __fastcall route16_cpu0_out(UINT16 offset, UINT8 data) +{ + switch (offset & 0x1ff) + { + case 0x000: + AY8910Write(0, 1, data); + break; + + case 0x100: + AY8910Write(0, 0, data); + break; + } +} + + +static INT32 GetRoms() +{ + char* pRomName; + struct BurnRomInfo ri; + UINT8 *Rom0Load = Rom0; + UINT8 *Rom1Load = Rom1; + UINT8 *PromLoad = Prom; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & 7) == 1) { + if (BurnLoadRom(Rom0Load, i, 1)) return 1; + Rom0Load += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 2) { + if (BurnLoadRom(Rom1Load, i, 1)) return 1; + Rom1Load += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 3) { + if (BurnLoadRom(PromLoad, i, 1)) return 1; + PromLoad += ri.nLen; + continue; + } + } + + return 0; +} + + +static INT32 DrvDoReset() +{ + flipscreen = palette_1 = palette_2 = ttmahjng_port_select = 0; + speakres_vrx = 0; + + DrvReset = 0; + + memset (Rom0 + 0x4000, 0, 0xc000); // Shared & video ram + memset (Rom1 + 0x8000, 0, 0x4000); + + ZetOpen(0); + ZetReset(); + ZetClose(); + ZetOpen(1); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + + return 0; +} + +void stratvox_sn76477_write(UINT32, UINT32) +{ + +} + +static INT32 DrvSyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (2500000.000 / (nBurnFPS / 100.000)))); +} + +static INT32 DrvInit() +{ + Mem = (UINT8*)BurnMalloc(0x10000 + 0x10000 + 0x200); + if (Mem == NULL) { + return 1; + } + + pFMBuffer = (INT16 *)BurnMalloc (nBurnSoundLen * 3 * sizeof(INT16)); + if (pFMBuffer == NULL) { + return 1; + } + + Rom0 = Mem + 0x00000; + Rom1 = Mem + 0x10000; + Prom = Mem + 0x20000; + + // Load Roms + if (GetRoms()) return 1; + + ZetInit(0); + ZetOpen(0); + ZetSetOutHandler(route16_cpu0_out); + ZetSetReadHandler(route16_cpu0_read); + ZetSetWriteHandler(route16_cpu0_write); + ZetMapArea (0x0000, 0x3fff, 0, Rom0 + 0x0000); // ROM + ZetMapArea (0x0000, 0x3fff, 2, Rom0 + 0x0000); + ZetMapArea (0x4000, 0x43ff, 0, Rom0 + 0x4000); // Read Shared RAM + ZetMapArea (0x8000, 0xbfff, 0, Rom0 + 0x8000); // Video RAM + ZetMapArea (0x8000, 0xbfff, 1, Rom0 + 0x8000); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetWriteHandler(route16_cpu0_write); + ZetMapArea (0x0000, 0x1fff, 0, Rom1 + 0x0000); // ROM + ZetMapArea (0x0000, 0x1fff, 2, Rom1 + 0x0000); + ZetMapArea (0x4000, 0x43ff, 0, Rom0 + 0x4000); // Read Shared RAM + ZetMapArea (0x8000, 0xbfff, 0, Rom1 + 0x8000); // Video RAM + ZetMapArea (0x8000, 0xbfff, 1, Rom1 + 0x8000); + ZetClose(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + + AY8910Init(0, 1250000, nBurnSoundRate, NULL, NULL, &stratvox_sn76477_write, NULL); + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + + DACInit(0, 0, 1, DrvSyncDAC); + DACSetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + + +static INT32 DrvExit() +{ + DACExit(); + ZetExit(); + AY8910Exit(0); + + BurnFree (Mem); + BurnFree (pFMBuffer); + + draw_type = 0; + + pFMBuffer = NULL; + Mem = NULL; + Rom0 = Rom1 = Prom = NULL; + pAY8910Buffer[0] = pAY8910Buffer[1] = pAY8910Buffer[2] = NULL; + + return 0; +} + + +//------------------------------------------------------------------------------------------------ +// Drawing functions + +static inline UINT32 route16_make_pen(UINT8 color) +{ + UINT32 ret = 0; + if (color & 1) ret |= 0x00ff0000; + if (color & 2) ret |= 0x0000ff00; + if (color & 4) ret |= 0x000000ff; + return ret; +} + + +static inline UINT32 ttmajng_make_pen(UINT8 color) +{ + UINT32 ret = 0; + if (color & 4) ret |= 0x00ff0000; + if (color & 2) ret |= 0x0000ff00; + if (color & 1) ret |= 0x000000ff; + return ret; +} + + +static INT32 DrvDraw() +{ + UINT8 *prom1 = Prom + 0x0000; + UINT8 *prom2 = Prom + 0x0100; + + for (INT32 offs = 0; offs < 0x4000; offs++) + { + UINT8 y = offs >> 6; + UINT8 x = offs << 2; + + UINT8 d1 = Rom0[0x8000 + offs]; + UINT8 d2 = Rom1[0x8000 + offs]; + + for (INT32 i = 0; i < 4; i++) + { + UINT8 color1, color2; + + // stratvox & ttmahjng + if (draw_type) { + color1 = prom1[(palette_1 << 2) | ((d1 >> 3) & 2) | (d1 & 1)]; + color2 = prom2[(((d1 << 3) & 0x80) | ((d1 << 7) & 0x80)) | (palette_2 << 2) | ((d2 >> 3) & 2) | (d2 & 1)]; + } else { + color1 = prom1[((palette_1 << 6) & 0x80) | (palette_1 << 2) | ((d1 >> 3) & 0x02) | ((d1 >> 0) & 0x01)]; + color2 = prom2[((palette_2 << 6) & 0x80) | (((color1 << 6) & 0x80) | ((color1 << 7) & 0x80)) | (palette_2 << 2) | ((d2 >> 3) & 2) | (d2 & 1)]; + } + + UINT8 final_color = color1 | color2; + + UINT32 pen; + if (draw_type == 1) { + pen = ttmajng_make_pen(final_color); + } else { + pen = route16_make_pen(final_color); + } + + if (flipscreen) + PutPix(pBurnDraw + ((x << 8) | (y ^ 0xff)) * nBurnBpp, BurnHighCol(pen>>16, pen>>8, pen, 0)); + else + PutPix(pBurnDraw + (((x ^ 0xff) << 8) | y) * nBurnBpp, BurnHighCol(pen>>16, pen>>8, pen, 0)); + + x += 1; + d1 >>= 1; + d2 >>= 1; + } + } + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 100; + + INT32 DACIRQFireSlice[48]; + for (INT32 i = 0; i < 48; i++) { + DACIRQFireSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 49)); + } + + INT32 nCyclesSegment; + INT32 nCyclesDone[2], nCyclesTotal[2]; + + nCyclesTotal[0] = 2500000 / 60; + nCyclesTotal[1] = 2500000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #0 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i+1 == nInterleave) ZetRaiseIrq(1); + ZetClose(); + + // Run Z80 #1 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (draw_type == 3) { // space echo + for (INT32 j = 0; j < 48; j++) { + if (i == DACIRQFireSlice[j]) { + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + } + } + ZetClose(); + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + +//------------------------------------------------------------------------------------------------ +// Savestates + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = Rom0 + 0x4000; + ba.nLen = 0x0400; + ba.szName = "Shared RAM"; + BurnAcb(&ba); + + memset(&ba, 0, sizeof(ba)); + ba.Data = Rom0 + 0x8000; + ba.nLen = 0x4000; + ba.szName = "Cpu0 Video RAM"; + BurnAcb(&ba); + + memset(&ba, 0, sizeof(ba)); + ba.Data = Rom1 + 0x8000; + ba.nLen = 0x4000; + ba.szName = "Cpu1 Video RAM"; + BurnAcb(&ba); + + ZetScan(nAction); // Scan Z80 + AY8910Scan(nAction, pnMin); // Scan AY8910 + + // Scan critical driver variables + SCAN_VAR(flipscreen); + SCAN_VAR(palette_1); + SCAN_VAR(palette_2); + SCAN_VAR(ttmahjng_port_select); + SCAN_VAR(speakres_vrx); + } + + return 0; +} + + +//------------------------------------------------------------------------------------------------ +// Drivers + + +// Route 16 + +static struct BurnRomInfo route16RomDesc[] = { + { "route16.a0", 0x0800, 0x8f9101bd, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code + { "route16.a1", 0x0800, 0x389bc077, 1 | BRF_ESS | BRF_PRG }, // 1 + { "route16.a2", 0x0800, 0x1065a468, 1 | BRF_ESS | BRF_PRG }, // 2 + { "route16.a3", 0x0800, 0x0b1987f3, 1 | BRF_ESS | BRF_PRG }, // 3 + { "route16.a4", 0x0800, 0xf67d853a, 1 | BRF_ESS | BRF_PRG }, // 4 + { "route16.a5", 0x0800, 0xd85cf758, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "route16.b0", 0x0800, 0x0f9588a7, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code + { "route16.b1", 0x0800, 0x2b326cf9, 2 | BRF_ESS | BRF_PRG }, // 7 + { "route16.b2", 0x0800, 0x529cad13, 2 | BRF_ESS | BRF_PRG }, // 8 + { "route16.b3", 0x0800, 0x3bd8b899, 2 | BRF_ESS | BRF_PRG }, // 9 + + { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 10 Graphics + { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(route16) +STD_ROM_FN(route16) + +static INT32 route16Init() +{ + INT32 nRet; + + draw_type = 0; + + nRet = DrvInit(); + + if (nRet == 0) + { + // Patch protection + Rom0[0x00e9] = 0x3a; + Rom0[0x0754] = 0xc3; + Rom0[0x0755] = 0x63; + Rom0[0x0756] = 0x07; + } + + return nRet; +} + +struct BurnDriver BurnDrvroute16 = { + "route16", NULL, NULL, NULL, "1981", + "Route 16\0", NULL, "Tehkan/Sun (Centuri license)", "Route 16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, route16RomInfo, route16RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + route16Init, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, + 256, 256, 3, 4 +}; + + +// Route 16 (set 2) + +static struct BurnRomInfo route16aRomDesc[] = { + { "vg-54", 0x0800, 0x0c966319, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code + { "vg-55", 0x0800, 0xa6a8c212, 1 | BRF_ESS | BRF_PRG }, // 1 + { "vg-56", 0x0800, 0x5c74406a, 1 | BRF_ESS | BRF_PRG }, // 2 + { "vg-57", 0x0800, 0x313e68ab, 1 | BRF_ESS | BRF_PRG }, // 3 + { "vg-58", 0x0800, 0x40824e3c, 1 | BRF_ESS | BRF_PRG }, // 4 + { "vg-59", 0x0800, 0x9313d2c2, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "route16.b0", 0x0800, 0x0f9588a7, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code + { "vg-61", 0x0800, 0xb216c88c, 2 | BRF_ESS | BRF_PRG }, // 7 + { "route16.b2", 0x0800, 0x529cad13, 2 | BRF_ESS | BRF_PRG }, // 8 + { "route16.b3", 0x0800, 0x3bd8b899, 2 | BRF_ESS | BRF_PRG }, // 9 + + { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 10 Graphics + { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(route16a) +STD_ROM_FN(route16a) + +static INT32 route16aInit() +{ + INT32 nRet; + + draw_type = 0; + + nRet = DrvInit(); + + if (nRet == 0) + { + // Patch protection + Rom0[0x00e9] = 0x3a; + + Rom0[0x0105] = 0x00; // jp nz,$4109 (nirvana) - NOP's in route16 + Rom0[0x0106] = 0x00; + Rom0[0x0107] = 0x00; + + Rom0[0x0731] = 0x00; // jp nz,$4238 (nirvana) + Rom0[0x0732] = 0x00; + Rom0[0x0733] = 0x00; + + Rom0[0x0747] = 0xc3; + Rom0[0x0748] = 0x56; + Rom0[0x0749] = 0x07; + } + + return nRet; +} + +struct BurnDriver BurnDrvroute16a = { + "route16a", "route16", NULL, NULL, "1981", + "Route 16 (set 2)\0", NULL, "Tehkan/Sun (Centuri license)", "Route 16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, route16aRomInfo, route16aRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + route16aInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, + 256, 256, 3, 4 +}; + + +// Route 16 (bootleg) + +static struct BurnRomInfo route16bRomDesc[] = { + { "rt16.0", 0x0800, 0xb1f0f636, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code + { "rt16.1", 0x0800, 0x3ec52fe5, 1 | BRF_ESS | BRF_PRG }, // 1 + { "rt16.2", 0x0800, 0xa8e92871, 1 | BRF_ESS | BRF_PRG }, // 2 + { "rt16.3", 0x0800, 0xa0fc9fc5, 1 | BRF_ESS | BRF_PRG }, // 3 + { "rt16.4", 0x0800, 0x6dcaf8c4, 1 | BRF_ESS | BRF_PRG }, // 4 + { "rt16.5", 0x0800, 0x63d7b05b, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "rt16.6", 0x0800, 0xfef605f3, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code + { "rt16.7", 0x0800, 0xd0d6c189, 2 | BRF_ESS | BRF_PRG }, // 7 + { "rt16.8", 0x0800, 0xdefc5797, 2 | BRF_ESS | BRF_PRG }, // 8 + { "rt16.9", 0x0800, 0x88d94a66, 2 | BRF_ESS | BRF_PRG }, // 9 + + { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 10 Graphics + { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(route16b) +STD_ROM_FN(route16b) + +static INT32 route16bInit() +{ + draw_type = 0; + + return DrvInit(); +} + +struct BurnDriver BurnDrvroute16b = { + "route16b", "route16", NULL, NULL, "1981", + "Route 16 (bootleg)\0", NULL, "bootleg", "Route 16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, route16bRomInfo, route16bRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + route16Init, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, + 256, 256, 3, 4 +}; + + +// Route X (bootleg) + +static struct BurnRomInfo routexRomDesc[] = { + { "routex01.a0", 0x0800, 0x99b500e7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code + { "rt16.1", 0x0800, 0x3ec52fe5, 1 | BRF_ESS | BRF_PRG }, // 1 + { "rt16.2", 0x0800, 0xa8e92871, 1 | BRF_ESS | BRF_PRG }, // 2 + { "rt16.3", 0x0800, 0xa0fc9fc5, 1 | BRF_ESS | BRF_PRG }, // 3 + { "routex05.a4", 0x0800, 0x2fef7653, 1 | BRF_ESS | BRF_PRG }, // 4 + { "routex06.a5", 0x0800, 0xa39ef648, 1 | BRF_ESS | BRF_PRG }, // 5 + { "routex07.a6", 0x0800, 0x89f80c1c, 1 | BRF_ESS | BRF_PRG }, // 6 + + { "routex11.b0", 0x0800, 0xb51edd1d, 2 | BRF_ESS | BRF_PRG }, // 7 Z80 #1 Code + { "rt16.7", 0x0800, 0xd0d6c189, 2 | BRF_ESS | BRF_PRG }, // 8 + { "rt16.8", 0x0800, 0xdefc5797, 2 | BRF_ESS | BRF_PRG }, // 9 + { "rt16.9", 0x0800, 0x88d94a66, 2 | BRF_ESS | BRF_PRG }, // 10 + + { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 11 Graphics + { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(routex) +STD_ROM_FN(routex) + +struct BurnDriver BurnDrvroutex = { + "routex", "route16", NULL, NULL, "1981", + "Route X (bootleg)\0", NULL, "bootleg", "Route 16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0, + NULL, routexRomInfo, routexRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + route16bInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, + 256, 256, 3, 4 +}; + + +// Speak & Rescue + +static struct BurnRomInfo speakresRomDesc[] = { + { "speakres.1", 0x0800, 0x6026e4ea, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code + { "speakres.2", 0x0800, 0x93f0d4da, 1 | BRF_ESS | BRF_PRG }, // 1 + { "speakres.3", 0x0800, 0xa3874304, 1 | BRF_ESS | BRF_PRG }, // 2 + { "speakres.4", 0x0800, 0xf484be3a, 1 | BRF_ESS | BRF_PRG }, // 3 + { "speakres.5", 0x0800, 0x61b12a67, 1 | BRF_ESS | BRF_PRG }, // 4 + { "speakres.6", 0x0800, 0x220e0ab2, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "speakres.7", 0x0800, 0xd417be13, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code + { "speakres.8", 0x0800, 0x52485d60, 2 | BRF_ESS | BRF_PRG }, // 7 + + { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 8 Graphics + { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(speakres) +STD_ROM_FN(speakres) + +static INT32 speakresInit() +{ + draw_type = 2; + + return DrvInit(); +} + +struct BurnDriver BurnDrvspeakres = { + "speakres", NULL, NULL, NULL, "1980", + "Speak & Rescue\0", NULL, "Sun Electronics", "Route 16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, speakresRomInfo, speakresRomName, NULL, NULL, DrvInputInfo, speakresDIPInfo, + speakresInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, + 256, 256, 3, 4 +}; + + +// Stratovox + +static struct BurnRomInfo stratvoxRomDesc[] = { + { "ls01.bin", 0x0800, 0xbf4d582e, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code + { "ls02.bin", 0x0800, 0x16739dd4, 1 | BRF_ESS | BRF_PRG }, // 1 + { "ls03.bin", 0x0800, 0x083c28de, 1 | BRF_ESS | BRF_PRG }, // 2 + { "ls04.bin", 0x0800, 0xb0927e3b, 1 | BRF_ESS | BRF_PRG }, // 3 + { "ls05.bin", 0x0800, 0xccd25c4e, 1 | BRF_ESS | BRF_PRG }, // 4 + { "ls06.bin", 0x0800, 0x07a907a7, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "ls07.bin", 0x0800, 0x4d333985, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code + { "ls08.bin", 0x0800, 0x35b753fc, 2 | BRF_ESS | BRF_PRG }, // 7 + + { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 8 Graphics + { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(stratvox) +STD_ROM_FN(stratvox) + +struct BurnDriver BurnDrvstratvox = { + "stratvox", "speakres", NULL, NULL, "1980", + "Stratovox\0", NULL, "[Sun Electronics] (Taito license)", "Route 16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, stratvoxRomInfo, stratvoxRomName, NULL, NULL, DrvInputInfo, stratvoxDIPInfo, + speakresInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, + 256, 256, 3, 4 +}; + + +// Stratovox (bootleg) + +static struct BurnRomInfo stratvobRomDesc[] = { + { "j0-1", 0x0800, 0x93c78274, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code + { "j0-2", 0x0800, 0x93b2b02d, 1 | BRF_ESS | BRF_PRG }, // 1 + { "j0-3", 0x0800, 0x655facb5, 1 | BRF_ESS | BRF_PRG }, // 2 + { "j0-4", 0x0800, 0xb0927e3b, 1 | BRF_ESS | BRF_PRG }, // 3 + { "j0-5", 0x0800, 0x9d2178d9, 1 | BRF_ESS | BRF_PRG }, // 4 + { "j0-6", 0x0800, 0x79118ffc, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "b0-a", 0x0800, 0x4d333985, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code + { "j0-a", 0x0800, 0x3416a830, 2 | BRF_ESS | BRF_PRG }, // 7 + + { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 8 Graphics + { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(stratvob) +STD_ROM_FN(stratvob) + +struct BurnDriver BurnDrvstratvob = { + "stratvoxb", "speakres", NULL, NULL, "1980", + "Stratovox (bootleg)\0", NULL, "bootleg", "Route 16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, stratvobRomInfo, stratvobRomName, NULL, NULL, DrvInputInfo, stratvoxDIPInfo, + speakresInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, + 256, 256, 3, 4 +}; + + +// Space Echo (bootleg) + +static struct BurnRomInfo spacechoRomDesc[] = { + { "rom.a0", 0x0800, 0x40d74dce, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code + { "rom.a1", 0x0800, 0xa5f0a34f, 1 | BRF_ESS | BRF_PRG }, // 1 + { "rom.a2", 0x0800, 0xcbbb3acb, 1 | BRF_ESS | BRF_PRG }, // 2 + { "rom.a3", 0x0800, 0x311050ca, 1 | BRF_ESS | BRF_PRG }, // 3 + { "rom.a4", 0x0800, 0x28943803, 1 | BRF_ESS | BRF_PRG }, // 4 + { "rom.a5", 0x0800, 0x851c9f28, 1 | BRF_ESS | BRF_PRG }, // 5 + + { "rom.b0", 0x0800, 0xdb45689d, 2 | BRF_ESS | BRF_PRG }, // 6 Z80 #1 Code + { "rom.b2", 0x0800, 0x1e074157, 2 | BRF_ESS | BRF_PRG }, // 7 + { "rom.b3", 0x0800, 0xd50a8b20, 2 | BRF_ESS | BRF_PRG }, // 8 + + { "im5623.f10", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 9 Graphics + { "im5623.f12", 0x0100, 0x08793ef7, 3 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(spacecho) +STD_ROM_FN(spacecho) + +static INT32 spacechoInit() +{ + INT32 nRet; + + draw_type = 3; + + nRet = DrvInit(); + + memcpy (Rom1 + 0x1000, Rom1 + 0x800, 0x1000); + + return nRet; +} + +struct BurnDriver BurnDrvspacecho = { + "spacecho", "speakres", NULL, NULL, "1980", + "Space Echo (bootleg)\0", NULL, "bootleg", "Route 16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, spacechoRomInfo, spacechoRomName, NULL, NULL, DrvInputInfo, stratvoxDIPInfo, + spacechoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, + 256, 256, 3, 4 +}; + + +// Mahjong + +static struct BurnRomInfo ttmahjngRomDesc[] = { + { "ju04", 0x1000, 0xfe7c693a, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code + { "ju05", 0x1000, 0x985723d3, 1 | BRF_ESS | BRF_PRG }, // 1 + { "ju06", 0x1000, 0x2cd69bc8, 1 | BRF_ESS | BRF_PRG }, // 2 + { "ju07", 0x1000, 0x30e8ec63, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "ju01", 0x0800, 0x0f05ca3c, 2 | BRF_ESS | BRF_PRG }, // 4 Z80 #1 Code + { "ju02", 0x0800, 0xc1ffeceb, 2 | BRF_ESS | BRF_PRG }, // 5 + { "ju08", 0x0800, 0x2dcc76b5, 2 | BRF_ESS | BRF_PRG }, // 6 + + { "ju03", 0x0100, 0x27d47624, 3 | BRF_GRA }, // 7 Graphics + { "ju09", 0x0100, 0x27d47624, 3 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(ttmahjng) +STD_ROM_FN(ttmahjng) + +static INT32 ttmahjngInit() +{ + draw_type = 1; + + return DrvInit(); +} + +struct BurnDriver BurnDrvttmahjng = { + "ttmahjng", NULL, NULL, NULL, "1980", + "Mahjong\0", NULL, "Taito", "Route 16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_MAHJONG, 0, + NULL, ttmahjngRomInfo, ttmahjngRomName, NULL, NULL, mahjongInputInfo, NULL, + ttmahjngInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, + 256, 256, 4, 3 +}; + + diff --git a/src/burn/drv/pre90s/d_rpunch.cpp b/src/burn/drv/pre90s/d_rpunch.cpp index 0be30f462..3296007d4 100644 --- a/src/burn/drv/pre90s/d_rpunch.cpp +++ b/src/burn/drv/pre90s/d_rpunch.cpp @@ -569,7 +569,6 @@ static INT32 DrvInit(INT32 (*pRomLoadCallback)(), INT32 game) ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); ZetSetWriteHandler(rpunch_sound_write); ZetSetReadHandler(rpunch_sound_read); - ZetMemEnd(); ZetClose(); BurnYM2151Init(4000000); diff --git a/src/burn/drv/pre90s/d_sf.cpp b/src/burn/drv/pre90s/d_sf.cpp index 27bfcbabe..453d654e2 100644 --- a/src/burn/drv/pre90s/d_sf.cpp +++ b/src/burn/drv/pre90s/d_sf.cpp @@ -1,1727 +1,1725 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm5205.h" - -static UINT8 *Mem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68kRom; -static UINT8 *DrvZ80Rom0; -static UINT8 *DrvZ80Rom1; -static UINT8 *Drv68kPalRam; -static UINT8 *Drv68kVidRam; -static UINT8 *Drv68kRam; -static UINT8 *DrvZ80Ram0; -static UINT8 *Gfx0; -static UINT8 *Gfx1; -static UINT8 *Gfx2; -static UINT8 *Gfx3; -static UINT8 *Gfx4; -static UINT8 *Gfx1Trans; -static UINT8 *Gfx3Trans; -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvJoy4[16]; -static UINT8 DrvJoy5[16]; -static UINT8 DrvDips[ 4]; -static UINT8 DrvReset; -static UINT16 DrvInputs[8]; - -static INT32 version; - -static INT32 sf_fg_scroll_x; -static INT32 sf_bg_scroll_x; - -static INT32 soundlatch; -static INT32 flipscreen; - -static INT32 sf_active; -static INT32 sound2_bank; - -static struct BurnInputInfo SfInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy3 + 3, "p1 up", }, - {"P1 Down", BIT_DIGITAL, DrvJoy3 + 2, "p1 down", }, - {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy4 + 1, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy4 + 2, "p1 fire 3"}, - {"P1 Button 4" , BIT_DIGITAL , DrvJoy4 + 8, "p1 fire 4"}, - {"P1 Button 5" , BIT_DIGITAL , DrvJoy4 + 9, "p1 fire 5"}, - {"P1 Button 6" , BIT_DIGITAL , DrvJoy4 + 10, "p1 fire 6"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 11, "p2 up", }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 10, "p2 down", }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 9, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 8, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy5 + 0, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy5 + 1, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy5 + 2, "p2 fire 3"}, - {"P2 Button 4" , BIT_DIGITAL , DrvJoy5 + 8, "p2 fire 4"}, - {"P2 Button 5" , BIT_DIGITAL , DrvJoy5 + 9, "p2 fire 5"}, - {"P2 Button 6" , BIT_DIGITAL , DrvJoy5 + 10, "p2 fire 6"}, - - {"Service" , BIT_DIGITAL , DrvJoy1 + 2, "service" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, - {"Dip 4", BIT_DIPSWITCH, DrvDips + 3, "dip" }, -}; - -STDINPUTINFO(Sf) - -static struct BurnInputInfo SfjpInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy3 + 3, "p1 up", }, - {"P1 Down", BIT_DIGITAL, DrvJoy3 + 2, "p1 down", }, - {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 8, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 9, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 10, "p1 fire 3"}, - {"P1 Button 4" , BIT_DIGITAL , DrvJoy3 + 12, "p1 fire 4"}, - {"P1 Button 5" , BIT_DIGITAL , DrvJoy3 + 13, "p1 fire 5"}, - {"P1 Button 6" , BIT_DIGITAL , DrvJoy3 + 14, "p1 fire 6"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy4 + 3, "p1 up", }, - {"P2 Down", BIT_DIGITAL, DrvJoy4 + 2, "p2 down", }, - {"P2 Left" , BIT_DIGITAL , DrvJoy4 + 1, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy4 + 0, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 8, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 9, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy4 + 10, "p2 fire 3"}, - {"P2 Button 4" , BIT_DIGITAL , DrvJoy4 + 12, "p2 fire 4"}, - {"P2 Button 5" , BIT_DIGITAL , DrvJoy4 + 13, "p2 fire 5"}, - {"P2 Button 6" , BIT_DIGITAL , DrvJoy4 + 14, "p2 fire 6"}, - - {"Service" , BIT_DIGITAL , DrvJoy1 + 2, "service" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, - {"Dip 4", BIT_DIPSWITCH, DrvDips + 3, "dip" }, -}; - -STDINPUTINFO(Sfjp) - -static struct BurnInputInfo SfusInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy3 + 3, "p1 up", }, - {"P1 Down", BIT_DIGITAL, DrvJoy3 + 2, "p1 down", }, - {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy2 + 9, "p1 fire 3"}, - {"P1 Button 4" , BIT_DIGITAL , DrvJoy3 + 6, "p1 fire 4"}, - {"P1 Button 5" , BIT_DIGITAL , DrvJoy3 + 7, "p1 fire 5"}, - {"P1 Button 6" , BIT_DIGITAL , DrvJoy2 + 2, "p1 fire 6"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 11, "p1 up", }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 10, "p2 down", }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 9, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 8, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 12, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 13, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 10, "p2 fire 3"}, - {"P2 Button 4" , BIT_DIGITAL , DrvJoy3 + 14, "p2 fire 4"}, - {"P2 Button 5" , BIT_DIGITAL , DrvJoy3 + 15, "p2 fire 5"}, - {"P2 Button 6" , BIT_DIGITAL , DrvJoy2 + 8, "p2 fire 6"}, - - {"Service" , BIT_DIGITAL , DrvJoy1 + 2, "service" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, - {"Dip 4", BIT_DIPSWITCH, DrvDips + 3, "dip" }, -}; - -STDINPUTINFO(Sfus) - -static struct BurnDIPInfo SfDIPList[]= -{ - {0x1a, 0xff, 0xff, 0xff, NULL }, - {0x1b, 0xff, 0xff, 0xff, NULL }, - {0x1c, 0xff, 0xff, 0xf8, NULL }, - {0x1d, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 2 , "Attract Music" }, - {0x1a, 0x01, 0x02, 0x00, "Off" }, - {0x1a, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Speed" }, - {0x1a, 0x01, 0x10, 0x00, "Slow" }, - {0x1a, 0x01, 0x10, 0x10, "Normal" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x1a, 0x01, 0x20, 0x20, "Off" }, - {0x1a, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x1a, 0x01, 0x40, 0x40, "Off" }, - {0x1a, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x1b, 0x01, 0x07, 0x00, "4 Coins 1 Credit" }, - {0x1b, 0x01, 0x07, 0x01, "3 Coins 1 Credit" }, - {0x1b, 0x01, 0x07, 0x02, "2 Coins 1 Credit" }, - {0x1b, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, - {0x1b, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x1b, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x1b, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x1b, 0x01, 0x07, 0x03, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x1b, 0x01, 0x38, 0x00, "4 Coins 1 Credit" }, - {0x1b, 0x01, 0x38, 0x08, "3 Coins 1 Credit" }, - {0x1b, 0x01, 0x38, 0x10, "2 Coins 1 Credit" }, - {0x1b, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, - {0x1b, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x1b, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x1b, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x1b, 0x01, 0x38, 0x18, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 6 , "Buy-in max stage" }, - {0x1c, 0x01, 0x38, 0x38, "5th" }, - {0x1c, 0x01, 0x38, 0x30, "4th" }, - {0x1c, 0x01, 0x38, 0x28, "3rd" }, - {0x1c, 0x01, 0x38, 0x20, "2nd" }, - {0x1c, 0x01, 0x38, 0x18, "1st" }, - {0x1c, 0x01, 0x38, 0x08, "No buy-in" }, - - {0 , 0xfe, 0 , 2 , "Number of start countries" }, - {0x1c, 0x01, 0x40, 0x40, "4" }, - {0x1c, 0x01, 0x40, 0x00, "2" }, - - {0 , 0xfe, 0 , 6 , "Continuation max stage" }, - {0x1d, 0x01, 0x07, 0x07, "5th" }, - {0x1d, 0x01, 0x07, 0x06, "4th" }, - {0x1d, 0x01, 0x07, 0x05, "3rd" }, - {0x1d, 0x01, 0x07, 0x04, "2nd" }, - {0x1d, 0x01, 0x07, 0x03, "1st" }, - {0x1d, 0x01, 0x07, 0x02, "No continuation" }, - - {0 , 0xfe, 0 , 4 , "Round time" }, - {0x1d, 0x01, 0x18, 0x18, "100" }, - {0x1d, 0x01, 0x18, 0x10, "150" }, - {0x1d, 0x01, 0x18, 0x08, "200" }, - {0x1d, 0x01, 0x18, 0x00, "250" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x1d, 0x01, 0x60, 0x60, "Normal" }, - {0x1d, 0x01, 0x60, 0x40, "Easy" }, - {0x1d, 0x01, 0x60, 0x20, "Difficult" }, - {0x1d, 0x01, 0x60, 0x00, "Very difficult" }, -}; - -STDDIPINFO(Sf) - -static struct BurnDIPInfo SfusDIPList[]= -{ - {0x1a, 0xff, 0xff, 0xff, NULL }, - {0x1b, 0xff, 0xff, 0xff, NULL }, - {0x1c, 0xff, 0xff, 0xf8, NULL }, - {0x1d, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x1a, 0x01, 0x01, 0x01, "Off" }, - {0x1a, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Attract Music" }, - {0x1a, 0x01, 0x02, 0x00, "Off" }, - {0x1a, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Speed" }, - {0x1a, 0x01, 0x10, 0x00, "Slow" }, - {0x1a, 0x01, 0x10, 0x10, "Normal" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x1a, 0x01, 0x20, 0x20, "Off" }, - {0x1a, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x1a, 0x01, 0x40, 0x40, "Off" }, - {0x1a, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x1b, 0x01, 0x07, 0x00, "4 Coins 1 Credit" }, - {0x1b, 0x01, 0x07, 0x01, "3 Coins 1 Credit" }, - {0x1b, 0x01, 0x07, 0x02, "2 Coins 1 Credit" }, - {0x1b, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, - {0x1b, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x1b, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x1b, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x1b, 0x01, 0x07, 0x03, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x1b, 0x01, 0x38, 0x00, "4 Coins 1 Credit" }, - {0x1b, 0x01, 0x38, 0x08, "3 Coins 1 Credit" }, - {0x1b, 0x01, 0x38, 0x10, "2 Coins 1 Credit" }, - {0x1b, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, - {0x1b, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x1b, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x1b, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x1b, 0x01, 0x38, 0x18, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 6 , "Buy-in max stage" }, - {0x1c, 0x01, 0x38, 0x38, "5th" }, - {0x1c, 0x01, 0x38, 0x30, "4th" }, - {0x1c, 0x01, 0x38, 0x28, "3rd" }, - {0x1c, 0x01, 0x38, 0x20, "2nd" }, - {0x1c, 0x01, 0x38, 0x18, "1st" }, - {0x1c, 0x01, 0x38, 0x08, "No buy-in" }, - - {0 , 0xfe, 0 , 2 , "Number of start countries" }, - {0x1c, 0x01, 0x40, 0x00, "4" }, - {0x1c, 0x01, 0x40, 0x40, "2" }, - - {0 , 0xfe, 0 , 6 , "Continuation max stage" }, - {0x1d, 0x01, 0x07, 0x07, "5th" }, - {0x1d, 0x01, 0x07, 0x06, "4th" }, - {0x1d, 0x01, 0x07, 0x05, "3rd" }, - {0x1d, 0x01, 0x07, 0x04, "2nd" }, - {0x1d, 0x01, 0x07, 0x03, "1st" }, - {0x1d, 0x01, 0x07, 0x02, "No continuation" }, - - {0 , 0xfe, 0 , 4 , "Round time" }, - {0x1d, 0x01, 0x18, 0x18, "100" }, - {0x1d, 0x01, 0x18, 0x10, "150" }, - {0x1d, 0x01, 0x18, 0x08, "200" }, - {0x1d, 0x01, 0x18, 0x00, "250" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x1d, 0x01, 0x60, 0x60, "Normal" }, - {0x1d, 0x01, 0x60, 0x40, "Easy" }, - {0x1d, 0x01, 0x60, 0x20, "Difficult" }, - {0x1d, 0x01, 0x60, 0x00, "Very difficult" }, -}; - -STDDIPINFO(Sfus) - -static void protection_w() -{ - static const INT32 maplist[4][10] = { - { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 }, - { 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 }, - { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 }, - { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 } - }; - INT32 map; - - map = maplist[SekReadByte(0xffc006)][(SekReadByte(0xffc003)<<1) + (SekReadWord(0xffc004)>>8)]; - - switch (SekReadByte(0xffc684)) - { - case 1: - { - INT32 base; - - base = 0x1b6e8+0x300e*map; - - SekWriteLong(0xffc01c, 0x16bfc+0x270*map); - SekWriteLong(0xffc020, base+0x80); - SekWriteLong(0xffc024, base); - SekWriteLong(0xffc028, base+0x86); - SekWriteLong(0xffc02c, base+0x8e); - SekWriteLong(0xffc030, base+0x20e); - SekWriteLong(0xffc034, base+0x30e); - SekWriteLong(0xffc038, base+0x38e); - SekWriteLong(0xffc03c, base+0x40e); - SekWriteLong(0xffc040, base+0x80e); - SekWriteLong(0xffc044, base+0xc0e); - SekWriteLong(0xffc048, base+0x180e); - SekWriteLong(0xffc04c, base+0x240e); - SekWriteLong(0xffc050, 0x19548+0x60*map); - SekWriteLong(0xffc054, 0x19578+0x60*map); - break; - } - - case 2: - { - static const INT32 delta1[10] = { - 0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80 - }; - static const INT32 delta2[10] = { - 0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80 - }; - - INT32 d1 = delta1[map] + 0xc0; - INT32 d2 = delta2[map]; - - SekWriteWord(0xffc680, d1); - SekWriteWord(0xffc682, d2); - SekWriteWord(0xffc00c, 0xc0); - SekWriteWord(0xffc00e, 0); - - sf_fg_scroll_x = d1; - sf_bg_scroll_x = d2; - - break; - } - - case 4: - { - INT32 pos = SekReadByte(0xffc010); - pos = (pos+1) & 3; - SekWriteByte(0xffc010, pos); - - if(!pos) { - INT32 d1 = SekReadWord(0xffc682); - INT32 off = SekReadWord(0xffc00e); - if(off!=512) { - off++; - d1++; - } else { - off = 0; - d1 -= 512; - } - SekWriteWord(0xffc682, d1); - SekWriteWord(0xffc00e, off); - - sf_bg_scroll_x = d1; - } - break; - } - } -} - -static inline void write_palette(UINT16 data, INT32 offset) -{ - INT32 r = (data >> 8) & 0x0f; - INT32 g = (data >> 4) & 0x0f; - INT32 b = (data >> 0) & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - Palette[offset] = (r << 16) | (g << 8) | b; - DrvPalette[offset] = BurnHighCol(r, g, b, 0); -} - -void __fastcall sf_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfff800) == 0xb00000) { - UINT16 *pal = (UINT16*)(Drv68kPalRam + (address & 0x7ff)); - - *pal = data; - - write_palette(*pal, (address >> 1) & 0x3ff); - - return; - } - - switch (address) - { - case 0xc00010: - return; - - case 0xc00014: - sf_fg_scroll_x = data; - return; - - case 0xc00018: - sf_bg_scroll_x = data; - return; - - case 0xc0001c: - { - soundlatch = data & 0xff; - - ZetOpen(0); - ZetNmi(); - ZetClose(); - } - return; - - case 0xc0001e: - if (version == 3) { - protection_w(); - } - return; - } -} - -void __fastcall sf_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0xc0001b: - { - sf_active = data & 0xff; - flipscreen = data & 0x04; - } - return; - } -} - -UINT16 __fastcall sf_read_word(UINT32 address) -{ - switch (address) - { - case 0xc00000: - return DrvInputs[3]; - - case 0xc00002: - return DrvInputs[4]; - - case 0xc00004: - return DrvInputs[5]; - - case 0xc00006: - return DrvInputs[6]; - - case 0xc00008: - return DrvInputs[0]; - - case 0xc0000a: - return DrvInputs[1]; - - case 0xc0000c: - return DrvInputs[2]; - - case 0xc0000e: - return 0xffff; - } - - return 0; -} - -UINT8 __fastcall sf_read_byte(UINT32 address) -{ - switch (address) - { - case 0xc00000: - case 0xc00001: - return DrvInputs[3] >> ((~address & 1) << 3); - - case 0xc00002: - case 0xc00003: - return DrvInputs[4] >> ((~address & 1) << 3); - - case 0xc00004: - case 0xc00005: - return DrvInputs[5] >> ((~address & 1) << 3); - - case 0xc00006: - case 0xc00007: - return DrvInputs[6] >> ((~address & 1) << 3); - - case 0xc00008: - case 0xc00009: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0xc0000a: - case 0xc0000b: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0xc0000c: - case 0xc0000d: - return DrvInputs[2] >> ((~address & 1) << 3); - - case 0xc0000e: - case 0xc0000f: - return 0xff; - } - - return 0; -} - -void __fastcall sf_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe000: - BurnYM2151SelectRegister(data); - return; - - case 0xe001: - BurnYM2151WriteRegister(data); - return; - } -} - -UINT8 __fastcall sf_sound_read(UINT16 address) -{ - switch (address) - { - case 0xc800: - return soundlatch; - - case 0xe001: - return BurnYM2151ReadStatus(); - } - - return 0; -} - -static void sound2_bank_w(INT32 data) -{ - sound2_bank = (data + 1) << 15; - - ZetMapArea(0x8000, 0xffff, 0, DrvZ80Rom1 + sound2_bank); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80Rom1 + sound2_bank); -} - -void __fastcall sf_sound2_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - MSM5205ResetWrite(0, data & 0x80); - MSM5205DataWrite(0, data); - MSM5205VCLKWrite(0, 1); - MSM5205VCLKWrite(0, 0); - return; - - case 0x01: - MSM5205ResetWrite(1, data & 0x80); - MSM5205DataWrite(1, data); - MSM5205VCLKWrite(1, 1); - MSM5205VCLKWrite(1, 0); - return; - - case 0x02: - sound2_bank_w(data); - return; - } -} - -UINT8 __fastcall sf_sound2_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x01: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return soundlatch; - } - - return 0; -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(double)ZetTotalCycles() * nSoundRate / 3579545; -} - -static INT32 DrvGfxDecode() -{ - static INT32 Gfx0Planes[4] = { 4, 0, 0x200004, 0x200000 }; - static INT32 Gfx1Planes[4] = { 4, 0, 0x400004, 0x400000 }; - static INT32 Gfx2Planes[4] = { 4, 0, 0x700004, 0x700000 }; - static INT32 Gfx3Planes[2] = { 4, 0 }; - - static INT32 GfxXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; - static INT32 GfxYOffsets[16] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, - 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x1C0000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, Gfx0, 0x080000); - - GfxDecode(0x1000, 4, 16, 16, Gfx0Planes, GfxXOffsets, GfxYOffsets, 0x200, tmp, Gfx0); - - memcpy (tmp, Gfx1, 0x100000); - - GfxDecode(0x2000, 4, 16, 16, Gfx1Planes, GfxXOffsets, GfxYOffsets, 0x200, tmp, Gfx1); - - memcpy (tmp, Gfx2, 0x1c0000); - - GfxDecode(0x3800, 4, 16, 16, Gfx2Planes, GfxXOffsets, GfxYOffsets, 0x200, tmp, Gfx2); - - memcpy (tmp, Gfx3, 0x004000); - - GfxDecode(0x0400, 2, 8, 8, Gfx3Planes, GfxXOffsets, GfxYOffsets, 0x080, tmp, Gfx3); - - memset (Gfx1Trans, 1, 0x2000); - for (INT32 i = 0; i < 0x2000 * 0x100; i++) { - if (Gfx1[i] != 15) Gfx1Trans[i/0x100] = 0; - } - - memset (Gfx3Trans, 1, 0x400); - for (INT32 i = 0; i < 0x400 * 0x40; i++) { - if (Gfx3[i] != 3) Gfx3Trans[i/0x40] = 0; - } - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - sf_fg_scroll_x = 0; - sf_bg_scroll_x = 0; - - soundlatch = 0; - flipscreen = 0; - - sf_active = 0; - - sound2_bank = 0; - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - MSM5205Reset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68kRom = Next; Next += 0x060000; - DrvZ80Rom0 = Next; Next += 0x008000; - DrvZ80Rom1 = Next; Next += 0x040000; - - Gfx0 = Next; Next += 0x100000; - Gfx1 = Next; Next += 0x200000; - Gfx1Trans = Next; Next += 0x002000; - Gfx2 = Next; Next += 0x380000; - Gfx3 = Next; Next += 0x010000; - Gfx3Trans = Next; Next += 0x000400; - Gfx4 = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x00401 * sizeof(UINT32); - - AllRam = Next; - - Drv68kPalRam = Next; Next += 0x000800; - Drv68kVidRam = Next; Next += 0x001000; - Drv68kRam = Next; Next += 0x008000; - - DrvZ80Ram0 = Next; Next += 0x000800; - - Palette = (UINT32*)Next; Next += 0x00401 * sizeof(UINT32); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -void sfYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvInit(INT32 initver) -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - if (initver == 4) - { - if (BurnLoadRom(Drv68kRom + 1, 0, 2)) return 1; - if (BurnLoadRom(Drv68kRom + 0, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80Rom0, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80Rom1, 3, 1)) return 1; - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(Gfx0 + i * 0x20000, i + 4, 1)) return 1; - } - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(Gfx1 + i * 0x20000, i + 8, 1)) return 1; - } - - for (INT32 i = 0; i < 6; i++) { - if (BurnLoadRom(Gfx2 + 0x00000 + i * 0x10000, i + 16, 1)) return 1; - if (BurnLoadRom(Gfx2 + 0xe0000 + i * 0x10000, i + 22, 1)) return 1; - } - - if (BurnLoadRom(Gfx3, 28, 1)) return 1; - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(Gfx4 + i * 0x10000, i + 29, 1)) return 1; - } - } else { - for (INT32 i = 0; i < 6; i+=2) { - if (BurnLoadRom(Drv68kRom + 1 + i * 0x10000, i + 0, 2)) return 1; - if (BurnLoadRom(Drv68kRom + 0 + i * 0x10000, i + 1, 2)) return 1; - } - - if (BurnLoadRom(DrvZ80Rom0, 6, 1)) return 1; - - if (BurnLoadRom(DrvZ80Rom1 + 0x00000, 7, 1)) return 1; - if (BurnLoadRom(DrvZ80Rom1 + 0x20000, 8, 1)) return 1; - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(Gfx0 + i * 0x20000, i + 9, 1)) return 1; - } - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(Gfx1 + i * 0x20000, i + 13, 1)) return 1; - } - - for (INT32 i = 0; i < 14; i++) { - if (BurnLoadRom(Gfx2 + i * 0x20000, i + 21, 1)) return 1; - } - - if (BurnLoadRom(Gfx3, 35, 1)) return 1; - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(Gfx4 + i * 0x10000, i + 36, 1)) return 1; - } - } - - if (DrvGfxDecode()) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68kRom, 0x000000, 0x04ffff, SM_ROM); - SekMapMemory(Drv68kVidRam, 0x800000, 0x800fff, SM_RAM); - SekMapMemory(Drv68kRam, 0xff8000, 0xffffff, SM_RAM); - SekSetWriteByteHandler(0, sf_write_byte); - SekSetWriteWordHandler(0, sf_write_word); - SekSetReadByteHandler(0, sf_read_byte); - SekSetReadWordHandler(0, sf_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom0); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram0); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram0); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram0); - ZetSetWriteHandler(sf_sound_write); - ZetSetReadHandler(sf_sound_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1); - ZetSetOutHandler(sf_sound2_out); - ZetSetInHandler(sf_sound2_in); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&sfYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.60, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.60, BURN_SND_ROUTE_RIGHT); - - MSM5205Init(0, DrvSynchroniseStream, 384000, NULL, MSM5205_SEX_4B, 1); - MSM5205Init(1, DrvSynchroniseStream, 384000, NULL, MSM5205_SEX_4B, 1); - MSM5205SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - MSM5205SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - version = initver; - - Palette[0x400] = 0xff00ff; - - return 0; -} - -static INT32 DrvExit() -{ - BurnYM2151Exit(); - SekExit(); - ZetExit(); - - MSM5205Exit(); - - version = 0; - - GenericTilesExit(); - - BurnFree (Mem); - - sf_fg_scroll_x = 0; - sf_bg_scroll_x = 0; - - soundlatch = 0; - flipscreen = 0; - - sf_active = 0; - sound2_bank = 0; - - return 0; -} - -static void draw_background() -{ - UINT8 *base = Gfx4 + ((sf_bg_scroll_x >> 4) << 5); - - for (INT32 offs = 0; offs < 0x200; offs++, base += 2) - { - INT32 sx = (offs & 0x1f0) - (sf_bg_scroll_x & 0x0f); - INT32 sy = (offs << 4) & 0xf0; - - if (sx < 49 || sx >= 448 || sy < 16 || sy > 239) continue; - - INT32 attr = base[0x10000]; - INT32 color = base[0x00000]; - INT32 code = (base[0x10001] << 8) | base[1]; - - INT32 flipx = attr & 1; - INT32 flipy = attr & 2; - - if (flipscreen) { - flipx = !flipx; - flipy = !flipy; - sx = ((sx + (sf_bg_scroll_x & 0x0f)) ^ 0x1f0) + (sf_bg_scroll_x & 0x0f); - sy ^= 0xf0; - } - - sx -= 64; - sy -= 16; - - if (flipy) { - if (flipx) { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } else { - Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } - } else { - if (flipx) { - Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); - } - } - } -} - -static void draw_foreground() -{ - UINT8 *base = 0x20000 + Gfx4 + ((sf_fg_scroll_x >> 4) << 5); - - for (INT32 offs = 0; offs < 0x200; offs++, base += 2) - { - INT32 sx = (offs & 0x1f0) - (sf_fg_scroll_x & 0x0f); - INT32 sy = (offs << 4) & 0xf0; - - if (sx < 49 || sx >= 448 || sy < 16 || sy > 239) continue; - - INT32 code = (base[0x10001] << 8) | base[1]; - if (Gfx1Trans[code]) continue; - - INT32 attr = base[0x10000]; - INT32 color = base[0x00000]; - - INT32 flipx = attr & 1; - INT32 flipy = attr & 2; - - if (flipscreen) { - flipx = !flipx; - flipy = !flipy; - sx = ((sx + (sf_fg_scroll_x & 0x0f)) ^ 0x1f0) + (sf_fg_scroll_x & 0x0f); - sy ^= 0xf0; - } - - sx -= 64; - sy -= 16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, Gfx1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, Gfx1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, Gfx1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, Gfx1); - } - } - } -} - -static void draw_characters() -{ - UINT16 *fg_ram = (UINT16*)(Drv68kVidRam); - - for (INT32 offs = 0x100 / 2; offs < 0x0f00 / 2; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - if (sx < 64 || sx > 447) continue; - - INT32 attr = BURN_ENDIAN_SWAP_INT16(fg_ram[offs]); - INT32 code = attr & 0x3ff; - if (Gfx3Trans[code]) continue; - - INT32 color = attr >> 12; - - INT32 flipx = attr & 0x400; - INT32 flipy = attr & 0x800; - - if (flipscreen) { - flipx = !flipx; - flipy = !flipy; - sx ^= 0x1f8; - sy ^= 0x0f8; - } - - sx -= 64; - sy -= 16; - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 2, 3, 0x300, Gfx3); - } else { - Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 2, 3, 0x300, Gfx3); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 2, 3, 0x300, Gfx3); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 2, 3, 0x300, Gfx3); - } - } - } -} - -static inline INT32 sf_invert(INT32 nb) -{ - static const INT32 delta[4] = {0x00, 0x18, 0x18, 0x00}; - return nb ^ delta[(nb >> 3) & 3]; -} - -static void draw_sprites() -{ - UINT16 *sf_objectram = (UINT16*)(Drv68kRam + 0x6000); - - for (INT32 offs = 0x1000-0x20;offs >= 0;offs -= 0x20) - { - INT32 c = BURN_ENDIAN_SWAP_INT16(sf_objectram[offs]); - INT32 attr = BURN_ENDIAN_SWAP_INT16(sf_objectram[offs+1]); - INT32 sy = BURN_ENDIAN_SWAP_INT16(sf_objectram[offs+2]); - INT32 sx = BURN_ENDIAN_SWAP_INT16(sf_objectram[offs+3]); - INT32 color = attr & 0x000f; - INT32 flipx = attr & 0x0100; - INT32 flipy = attr & 0x0200; - - if (attr & 0x400) // large sprite - { - INT32 c1,c2,c3,c4,t; - - if (flipscreen) - { - sx = 480 - sx; - sy = 224 - sy; - flipx = !flipx; - flipy = !flipy; - } - - if (sy > 239 || sx < 33 || sx > 447) continue; - - sx -= 64; - sy -= 16; - - c1 = c; - c2 = c+1; - c3 = c+16; - c4 = c+17; - - if (flipx) - { - t = c1; c1 = c2; c2 = t; - t = c3; c3 = c4; c4 = t; - } - if (flipy) - { - t = c1; c1 = c3; c3 = t; - t = c2; c2 = c4; c4 = t; - } - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sf_invert(c1), sx , sy , color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sf_invert(c2), sx + 16, sy , color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sf_invert(c3), sx , sy + 16, color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sf_invert(c4), sx + 16, sy + 16, color, 4, 15, 0x200, Gfx2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sf_invert(c1), sx , sy , color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sf_invert(c2), sx + 16, sy , color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sf_invert(c3), sx , sy + 16, color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sf_invert(c4), sx + 16, sy + 16, color, 4, 15, 0x200, Gfx2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sf_invert(c1), sx , sy , color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sf_invert(c2), sx + 16, sy , color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sf_invert(c3), sx , sy + 16, color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sf_invert(c4), sx + 16, sy + 16, color, 4, 15, 0x200, Gfx2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, sf_invert(c1), sx , sy , color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_Clip(pTransDraw, sf_invert(c2), sx + 16, sy , color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_Clip(pTransDraw, sf_invert(c3), sx , sy + 16, color, 4, 15, 0x200, Gfx2); - Render16x16Tile_Mask_Clip(pTransDraw, sf_invert(c4), sx + 16, sy + 16, color, 4, 15, 0x200, Gfx2); - } - } - } - else - { - if (flipscreen) - { - sx = 496 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - if (sy < 1 || sy > 239 || sx < 49 || sx > 447) continue; - - sx -= 64; - sy -= 16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sf_invert(c), sx, sy, color, 4, 15, 0x200, Gfx2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sf_invert(c), sx, sy, color, 4, 15, 0x200, Gfx2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sf_invert(c), sx, sy, color, 4, 15, 0x200, Gfx2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, sf_invert(c), sx, sy, color, 4, 15, 0x200, Gfx2); - } - } - } - } -} - - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x401; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - if (nBurnLayer & 8) { - if (sf_active & 0x20) - draw_background(); - else - memset (pTransDraw, 0, nScreenWidth * nScreenHeight * sizeof(INT16)); - } else { - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) - pTransDraw[i] = 0x0400; // point to magenta - } - - if (sf_active & 0x40 && nBurnLayer & 4) - draw_foreground(); - - if (sf_active & 0x80 && nBurnLayer & 1) - draw_sprites(); - - if (sf_active & 0x08 && nBurnLayer & 2) - draw_characters(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static void DrvMakeInputs() -{ - DrvInputs[0] = (DrvDips[0] << 8) | DrvDips[1]; - DrvInputs[1] = (DrvDips[2] << 4) | DrvDips[3] | 0xf800; - - DrvInputs[2] = 0xff7f; - DrvInputs[3] = 0xffff; - DrvInputs[4] = 0xffff; - DrvInputs[5] = 0xffff; - DrvInputs[6] = 0xffff; - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[2] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[5] ^= (DrvJoy4[i] & 1) << i; - } - - // clear opposites - { - if (!(DrvInputs[4] & 0x0003)) DrvInputs[4] |= 0x0003; // p1 left/right - if (!(DrvInputs[4] & 0x000c)) DrvInputs[4] |= 0x000c; // p1 up/down - if (!(DrvInputs[4] & 0x0300)) DrvInputs[4] |= 0x0300; // p2 left/right - if (!(DrvInputs[4] & 0x0c00)) DrvInputs[4] |= 0x0c00; // p2 up/down - } - - // World & prototype -- simulate analogue buttons - if (version == 1 || version == 4) - { - static const INT32 scale[8] = { 0x00, 0x60, 0xe0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }; - - INT32 t = (DrvJoy4[0] & 1) | ((DrvJoy4[1] & 1) << 1) | ((DrvJoy4[2] & 1) << 2); - DrvInputs[5] = scale[t]; - t = (DrvJoy5[0] & 1) | ((DrvJoy5[1] & 1) << 1) | ((DrvJoy5[2] & 1) << 2); - DrvInputs[5] |= scale[t] << 8; - - t = (DrvJoy4[8] & 1) | ((DrvJoy4[9] & 1) << 1) | ((DrvJoy4[10] & 1) << 2); - DrvInputs[6] = scale[t]; - - t = (DrvJoy5[8] & 1) | ((DrvJoy5[9] & 1) << 1) | ((DrvJoy5[10] & 1) << 2); - DrvInputs[6] |= scale[t] << 8; - } -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - SekNewFrame(); - ZetNewFrame(); - - DrvMakeInputs(); - - INT32 nSoundBufferPos = 0; - INT32 nInterleave = (133 * 2) / 3; // sample cpu irqs - INT32 nCyclesTotal[3]; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - INT32 nNext[3] = { 0, 0, 0 }; - - nCyclesTotal[0] = (INT32)((INT64)8000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = (INT32)((INT64)3579545 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[2] = 3579545 / 60; //(INT32)((INT64)3579545 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - nNext[0] += nCyclesTotal[0] / nInterleave; - nCyclesDone[0] += SekRun(nNext[0] - nCyclesDone[0]); - - ZetOpen(0); - nNext[1] += nCyclesTotal[1] / nInterleave; - nCyclesDone[1] += ZetRun(nNext[1] - nCyclesDone[1]); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - - nSoundBufferPos += nSegmentLength; - } - - ZetClose(); - - ZetOpen(1); - nNext[2] += nCyclesTotal[2] / nInterleave; - nCyclesDone[2] += ZetRun(nNext[2] - nCyclesDone[2]); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - } - - SekSetIRQLine((version == 4) ? 6 : 1, SEK_IRQSTATUS_AUTO); - - SekClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - } - - ZetOpen(1); - if ((nCyclesTotal[2] - nCyclesDone[2]) > 0) { - ZetRun(nCyclesTotal[2] - nCyclesDone[2]); - } - - MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - MSM5205Render(1, pBurnSoundOut, nBurnSoundLen); - ZetClose(); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - MSM5205Scan(nAction, pnMin); - BurnYM2151Scan(nAction); - - SCAN_VAR(sf_fg_scroll_x); - SCAN_VAR(sf_bg_scroll_x); - SCAN_VAR(soundlatch); - SCAN_VAR(flipscreen); - SCAN_VAR(sf_active); - SCAN_VAR(sound2_bank); - } - - if (nAction & ACB_WRITE) { - ZetOpen(1); - sound2_bank_w(sound2_bank); - ZetClose(); - } - - return 0; -} - - -// Street Fighter (World) - -static struct BurnRomInfo sfRomDesc[] = { - { "sfe-19", 0x10000, 0x8346c3ca, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "sfe-22", 0x10000, 0x3a4bfaa8, 1 | BRF_PRG | BRF_ESS }, // 1 - { "sfe-20", 0x10000, 0xb40e67ee, 1 | BRF_PRG | BRF_ESS }, // 2 - { "sfe-23", 0x10000, 0x477c3d5b, 1 | BRF_PRG | BRF_ESS }, // 3 - { "sfe-21", 0x10000, 0x2547192b, 1 | BRF_PRG | BRF_ESS }, // 4 - { "sfe-24", 0x10000, 0x79680f4e, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "sf-02.bin", 0x08000, 0x4a9ac534, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 #0 Code - - { "sfu-00", 0x20000, 0xa7cce903, 3 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code - { "sf-01.bin", 0x20000, 0x86e0f0d5, 3 | BRF_PRG | BRF_ESS }, // 8 - - { "sf-39.bin", 0x20000, 0xcee3d292, 4 | BRF_GRA }, // 9 Background Tiles - { "sf-38.bin", 0x20000, 0x2ea99676, 4 | BRF_GRA }, // 10 - { "sf-41.bin", 0x20000, 0xe0280495, 4 | BRF_GRA }, // 11 - { "sf-40.bin", 0x20000, 0xc70b30de, 4 | BRF_GRA }, // 12 - - { "sf-25.bin", 0x20000, 0x7f23042e, 5 | BRF_GRA }, // 13 More tiles? - { "sf-28.bin", 0x20000, 0x92f8b91c, 5 | BRF_GRA }, // 14 - { "sf-30.bin", 0x20000, 0xb1399856, 5 | BRF_GRA }, // 15 - { "sf-34.bin", 0x20000, 0x96b6ae2e, 5 | BRF_GRA }, // 16 - { "sf-26.bin", 0x20000, 0x54ede9f5, 5 | BRF_GRA }, // 17 - { "sf-29.bin", 0x20000, 0xf0649a67, 5 | BRF_GRA }, // 18 - { "sf-31.bin", 0x20000, 0x8f4dd71a, 5 | BRF_GRA }, // 19 - { "sf-35.bin", 0x20000, 0x70c00fb4, 5 | BRF_GRA }, // 20 - - { "sf-15.bin", 0x20000, 0xfc0113db, 6 | BRF_GRA }, // 21 Sprites - { "sf-16.bin", 0x20000, 0x82e4a6d3, 6 | BRF_GRA }, // 22 - { "sf-11.bin", 0x20000, 0xe112df1b, 6 | BRF_GRA }, // 23 - { "sf-12.bin", 0x20000, 0x42d52299, 6 | BRF_GRA }, // 24 - { "sf-07.bin", 0x20000, 0x49f340d9, 6 | BRF_GRA }, // 25 - { "sf-08.bin", 0x20000, 0x95ece9b1, 6 | BRF_GRA }, // 26 - { "sf-03.bin", 0x20000, 0x5ca05781, 6 | BRF_GRA }, // 27 - { "sf-17.bin", 0x20000, 0x69fac48e, 6 | BRF_GRA }, // 28 - { "sf-18.bin", 0x20000, 0x71cfd18d, 6 | BRF_GRA }, // 29 - { "sf-13.bin", 0x20000, 0xfa2eb24b, 6 | BRF_GRA }, // 30 - { "sf-14.bin", 0x20000, 0xad955c95, 6 | BRF_GRA }, // 31 - { "sf-09.bin", 0x20000, 0x41b73a31, 6 | BRF_GRA }, // 32 - { "sf-10.bin", 0x20000, 0x91c41c50, 6 | BRF_GRA }, // 33 - { "sf-05.bin", 0x20000, 0x538c7cbe, 6 | BRF_GRA }, // 34 - - { "sf-27.bin", 0x04000, 0x2b09b36d, 7 | BRF_GRA }, // 35 Characters - - { "sf-37.bin", 0x10000, 0x23d09d3d, 8 | BRF_GRA }, // 36 Tilemaps - { "sf-36.bin", 0x10000, 0xea16df6c, 8 | BRF_GRA }, // 37 - { "sf-32.bin", 0x10000, 0x72df2bd9, 8 | BRF_GRA }, // 38 - { "sf-33.bin", 0x10000, 0x3e99d3d5, 8 | BRF_GRA }, // 39 - - { "mb7114h.12k", 0x0100, 0x75af3553, 0 | BRF_OPT }, // 40 Proms - { "mb7114h.11h", 0x0100, 0xc0e56586, 0 | BRF_OPT }, // 41 - { "mb7114h.12j", 0x0100, 0x4c734b64, 0 | BRF_OPT }, // 42 - { "mmi-7603.13h",0x0020, 0x06bcda53, 0 | BRF_OPT }, // 43 -}; - -STD_ROM_PICK(sf) -STD_ROM_FN(sf) - -static INT32 SfInit() -{ - return DrvInit(1); -} - -struct BurnDriver BurnDrvsf = { - "sf", NULL, NULL, NULL, "1987", - "Street Fighter (World)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_VSFIGHT, FBF_SF, - NULL, sfRomInfo, sfRomName, NULL, NULL, SfInputInfo, SfDIPInfo, - SfInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x401, 384, 224, 4, 3 -}; - - - -// Street Fighter (US set 1) - -static struct BurnRomInfo sfuRomDesc[] = { - { "sfd-19", 0x10000, 0xfaaf6255, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "sfd-22", 0x10000, 0xe1fe3519, 1 | BRF_PRG | BRF_ESS }, // 1 - { "sfd-20", 0x10000, 0x44b915bd, 1 | BRF_PRG | BRF_ESS }, // 2 - { "sfd-23", 0x10000, 0x79c43ff8, 1 | BRF_PRG | BRF_ESS }, // 3 - { "sfd-21", 0x10000, 0xe8db799b, 1 | BRF_PRG | BRF_ESS }, // 4 - { "sfd-24", 0x10000, 0x466a3440, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "sf-02.bin", 0x08000, 0x4a9ac534, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 #0 Code - - { "sfu-00", 0x20000, 0xa7cce903, 3 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code - { "sf-01.bin", 0x20000, 0x86e0f0d5, 3 | BRF_PRG | BRF_ESS }, // 8 - - { "sf-39.bin", 0x20000, 0xcee3d292, 4 | BRF_GRA }, // 9 Background Tiles - { "sf-38.bin", 0x20000, 0x2ea99676, 4 | BRF_GRA }, // 10 - { "sf-41.bin", 0x20000, 0xe0280495, 4 | BRF_GRA }, // 11 - { "sf-40.bin", 0x20000, 0xc70b30de, 4 | BRF_GRA }, // 12 - - { "sf-25.bin", 0x20000, 0x7f23042e, 5 | BRF_GRA }, // 13 Foreground Tiles - { "sf-28.bin", 0x20000, 0x92f8b91c, 5 | BRF_GRA }, // 14 - { "sf-30.bin", 0x20000, 0xb1399856, 5 | BRF_GRA }, // 15 - { "sf-34.bin", 0x20000, 0x96b6ae2e, 5 | BRF_GRA }, // 16 - { "sf-26.bin", 0x20000, 0x54ede9f5, 5 | BRF_GRA }, // 17 - { "sf-29.bin", 0x20000, 0xf0649a67, 5 | BRF_GRA }, // 18 - { "sf-31.bin", 0x20000, 0x8f4dd71a, 5 | BRF_GRA }, // 19 - { "sf-35.bin", 0x20000, 0x70c00fb4, 5 | BRF_GRA }, // 20 - - { "sf-15.bin", 0x20000, 0xfc0113db, 6 | BRF_GRA }, // 21 Sprites - { "sf-16.bin", 0x20000, 0x82e4a6d3, 6 | BRF_GRA }, // 22 - { "sf-11.bin", 0x20000, 0xe112df1b, 6 | BRF_GRA }, // 23 - { "sf-12.bin", 0x20000, 0x42d52299, 6 | BRF_GRA }, // 24 - { "sf-07.bin", 0x20000, 0x49f340d9, 6 | BRF_GRA }, // 25 - { "sf-08.bin", 0x20000, 0x95ece9b1, 6 | BRF_GRA }, // 26 - { "sf-03.bin", 0x20000, 0x5ca05781, 6 | BRF_GRA }, // 27 - { "sf-17.bin", 0x20000, 0x69fac48e, 6 | BRF_GRA }, // 28 - { "sf-18.bin", 0x20000, 0x71cfd18d, 6 | BRF_GRA }, // 29 - { "sf-13.bin", 0x20000, 0xfa2eb24b, 6 | BRF_GRA }, // 30 - { "sf-14.bin", 0x20000, 0xad955c95, 6 | BRF_GRA }, // 31 - { "sf-09.bin", 0x20000, 0x41b73a31, 6 | BRF_GRA }, // 32 - { "sf-10.bin", 0x20000, 0x91c41c50, 6 | BRF_GRA }, // 33 - { "sf-05.bin", 0x20000, 0x538c7cbe, 6 | BRF_GRA }, // 34 - - { "sf-27.bin", 0x04000, 0x2b09b36d, 7 | BRF_GRA }, // 35 Characters - - { "sf-37.bin", 0x10000, 0x23d09d3d, 8 | BRF_GRA }, // 36 Tilemaps - { "sf-36.bin", 0x10000, 0xea16df6c, 8 | BRF_GRA }, // 37 - { "sf-32.bin", 0x10000, 0x72df2bd9, 8 | BRF_GRA }, // 38 - { "sf-33.bin", 0x10000, 0x3e99d3d5, 8 | BRF_GRA }, // 39 - - { "mb7114h.12k", 0x0100, 0x75af3553, 0 | BRF_OPT }, // 40 Proms - { "mb7114h.11h", 0x0100, 0xc0e56586, 0 | BRF_OPT }, // 41 - { "mb7114h.12j", 0x0100, 0x4c734b64, 0 | BRF_OPT }, // 42 - { "mmi-7603.13h",0x0020, 0x06bcda53, 0 | BRF_OPT }, // 43 -}; - -STD_ROM_PICK(sfu) -STD_ROM_FN(sfu) - -static INT32 SfusInit() -{ - return DrvInit(2); -} - -struct BurnDriver BurnDrvsfu = { - "sfu", "sf", NULL, NULL, "1987", - "Street Fighter (US set 1)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_VSFIGHT, FBF_SF, - NULL, sfuRomInfo, sfuRomName, NULL, NULL, SfusInputInfo, SfusDIPInfo, - SfusInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x401, 384, 224, 4, 3 -}; - - -// Street Fighter (US set 2) - -static struct BurnRomInfo sfuaRomDesc[] = { - { "sfs19u.1a", 0x10000, 0xc8e41c49, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "sfs22u.1b", 0x10000, 0x667e9309, 1 | BRF_PRG | BRF_ESS }, // 1 - { "sfs20u.2a", 0x10000, 0x303065bf, 1 | BRF_PRG | BRF_ESS }, // 2 - { "sfs23u.2b", 0x10000, 0xde6927a3, 1 | BRF_PRG | BRF_ESS }, // 3 - { "sfs21u.3a", 0x10000, 0x004a418b, 1 | BRF_PRG | BRF_ESS }, // 4 - { "sfs24u.3b", 0x10000, 0x2b4545ff, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "sf-02.bin", 0x08000, 0x4a9ac534, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 #0 Code - - { "sfu-00", 0x20000, 0xa7cce903, 3 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code - { "sf-01.bin", 0x20000, 0x86e0f0d5, 3 | BRF_PRG | BRF_ESS }, // 8 - - { "sf-39.bin", 0x20000, 0xcee3d292, 4 | BRF_GRA }, // 9 Background Tiles - { "sf-38.bin", 0x20000, 0x2ea99676, 4 | BRF_GRA }, // 10 - { "sf-41.bin", 0x20000, 0xe0280495, 4 | BRF_GRA }, // 11 - { "sf-40.bin", 0x20000, 0xc70b30de, 4 | BRF_GRA }, // 12 - - { "sf-25.bin", 0x20000, 0x7f23042e, 5 | BRF_GRA }, // 13 Foreground Tiles - { "sf-28.bin", 0x20000, 0x92f8b91c, 5 | BRF_GRA }, // 14 - { "sf-30.bin", 0x20000, 0xb1399856, 5 | BRF_GRA }, // 15 - { "sf-34.bin", 0x20000, 0x96b6ae2e, 5 | BRF_GRA }, // 16 - { "sf-26.bin", 0x20000, 0x54ede9f5, 5 | BRF_GRA }, // 17 - { "sf-29.bin", 0x20000, 0xf0649a67, 5 | BRF_GRA }, // 18 - { "sf-31.bin", 0x20000, 0x8f4dd71a, 5 | BRF_GRA }, // 19 - { "sf-35.bin", 0x20000, 0x70c00fb4, 5 | BRF_GRA }, // 20 - - { "sf-15.bin", 0x20000, 0xfc0113db, 6 | BRF_GRA }, // 21 Sprites - { "sf-16.bin", 0x20000, 0x82e4a6d3, 6 | BRF_GRA }, // 22 - { "sf-11.bin", 0x20000, 0xe112df1b, 6 | BRF_GRA }, // 23 - { "sf-12.bin", 0x20000, 0x42d52299, 6 | BRF_GRA }, // 24 - { "sf-07.bin", 0x20000, 0x49f340d9, 6 | BRF_GRA }, // 25 - { "sf-08.bin", 0x20000, 0x95ece9b1, 6 | BRF_GRA }, // 26 - { "sf-03.bin", 0x20000, 0x5ca05781, 6 | BRF_GRA }, // 27 - { "sf-17.bin", 0x20000, 0x69fac48e, 6 | BRF_GRA }, // 28 - { "sf-18.bin", 0x20000, 0x71cfd18d, 6 | BRF_GRA }, // 29 - { "sf-13.bin", 0x20000, 0xfa2eb24b, 6 | BRF_GRA }, // 30 - { "sf-14.bin", 0x20000, 0xad955c95, 6 | BRF_GRA }, // 31 - { "sf-09.bin", 0x20000, 0x41b73a31, 6 | BRF_GRA }, // 32 - { "sf-10.bin", 0x20000, 0x91c41c50, 6 | BRF_GRA }, // 33 - { "sf-05.bin", 0x20000, 0x538c7cbe, 6 | BRF_GRA }, // 34 - - { "sf-27.bin", 0x04000, 0x2b09b36d, 7 | BRF_GRA }, // 35 Characters - - { "sf-37.bin", 0x10000, 0x23d09d3d, 8 | BRF_GRA }, // 36 Tilemaps - { "sf-36.bin", 0x10000, 0xea16df6c, 8 | BRF_GRA }, // 37 - { "sf-32.bin", 0x10000, 0x72df2bd9, 8 | BRF_GRA }, // 38 - { "sf-33.bin", 0x10000, 0x3e99d3d5, 8 | BRF_GRA }, // 39 - - { "sfb05.bin", 0x0100, 0x864199ad, 0 | BRF_OPT }, // 40 Proms - { "sfb00.bin", 0x0100, 0xbd3f8c5d, 0 | BRF_OPT }, // 41 - { "mb7114h.12j", 0x0100, 0x4c734b64, 0 | BRF_OPT }, // 42 - { "mmi-7603.13h",0x0020, 0x06bcda53, 0 | BRF_OPT }, // 43 - - { "i8751.bin", 0x00800, 0x00000000, 0 | BRF_NODUMP }, -}; - -STD_ROM_PICK(sfua) -STD_ROM_FN(sfua) - -static INT32 SfuaInit() -{ - return DrvInit(3); -} - -struct BurnDriver BurnDrvsfua = { - "sfua", "sf", NULL, NULL, "1987", - "Street Fighter (US set 2)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_VSFIGHT, FBF_SF, - NULL, sfuaRomInfo, sfuaRomName, NULL, NULL, SfjpInputInfo, SfusDIPInfo, - SfuaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x401, 384, 224, 4, 3 -}; - - -// Street Fighter (Japan) - -static struct BurnRomInfo sfjpRomDesc[] = { - { "sf-19.bin", 0x10000, 0x116027d7, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "sf-22.bin", 0x10000, 0xd3cbd09e, 1 | BRF_PRG | BRF_ESS }, // 1 - { "sf-20.bin", 0x10000, 0xfe07e83f, 1 | BRF_PRG | BRF_ESS }, // 2 - { "sf-23.bin", 0x10000, 0x1e435d33, 1 | BRF_PRG | BRF_ESS }, // 3 - { "sf-21.bin", 0x10000, 0xe086bc4c, 1 | BRF_PRG | BRF_ESS }, // 4 - { "sf-24.bin", 0x10000, 0x13a6696b, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "sf-02.bin", 0x08000, 0x4a9ac534, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 #0 Code - - { "sf-00.bin", 0x20000, 0x4b733845, 3 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code - { "sf-01.bin", 0x20000, 0x86e0f0d5, 3 | BRF_PRG | BRF_ESS }, // 8 - - { "sf-39.bin", 0x20000, 0xcee3d292, 4 | BRF_GRA }, // 9 Background Tiles - { "sf-38.bin", 0x20000, 0x2ea99676, 4 | BRF_GRA }, // 10 - { "sf-41.bin", 0x20000, 0xe0280495, 4 | BRF_GRA }, // 11 - { "sf-40.bin", 0x20000, 0xc70b30de, 4 | BRF_GRA }, // 12 - - { "sf-25.bin", 0x20000, 0x7f23042e, 5 | BRF_GRA }, // 13 Foreground Tiles - { "sf-28.bin", 0x20000, 0x92f8b91c, 5 | BRF_GRA }, // 14 - { "sf-30.bin", 0x20000, 0xb1399856, 5 | BRF_GRA }, // 15 - { "sf-34.bin", 0x20000, 0x96b6ae2e, 5 | BRF_GRA }, // 16 - { "sf-26.bin", 0x20000, 0x54ede9f5, 5 | BRF_GRA }, // 17 - { "sf-29.bin", 0x20000, 0xf0649a67, 5 | BRF_GRA }, // 18 - { "sf-31.bin", 0x20000, 0x8f4dd71a, 5 | BRF_GRA }, // 19 - { "sf-35.bin", 0x20000, 0x70c00fb4, 5 | BRF_GRA }, // 20 - - { "sf-15.bin", 0x20000, 0xfc0113db, 6 | BRF_GRA }, // 21 Sprites - { "sf-16.bin", 0x20000, 0x82e4a6d3, 6 | BRF_GRA }, // 22 - { "sf-11.bin", 0x20000, 0xe112df1b, 6 | BRF_GRA }, // 23 - { "sf-12.bin", 0x20000, 0x42d52299, 6 | BRF_GRA }, // 24 - { "sf-07.bin", 0x20000, 0x49f340d9, 6 | BRF_GRA }, // 25 - { "sf-08.bin", 0x20000, 0x95ece9b1, 6 | BRF_GRA }, // 26 - { "sf-03.bin", 0x20000, 0x5ca05781, 6 | BRF_GRA }, // 27 - { "sf-17.bin", 0x20000, 0x69fac48e, 6 | BRF_GRA }, // 28 - { "sf-18.bin", 0x20000, 0x71cfd18d, 6 | BRF_GRA }, // 29 - { "sf-13.bin", 0x20000, 0xfa2eb24b, 6 | BRF_GRA }, // 30 - { "sf-14.bin", 0x20000, 0xad955c95, 6 | BRF_GRA }, // 31 - { "sf-09.bin", 0x20000, 0x41b73a31, 6 | BRF_GRA }, // 32 - { "sf-10.bin", 0x20000, 0x91c41c50, 6 | BRF_GRA }, // 33 - { "sf-05.bin", 0x20000, 0x538c7cbe, 6 | BRF_GRA }, // 34 - - { "sf-27.bin", 0x04000, 0x2b09b36d, 7 | BRF_GRA }, // 35 Characters - - { "sf-37.bin", 0x10000, 0x23d09d3d, 8 | BRF_GRA }, // 36 Tilemaps - { "sf-36.bin", 0x10000, 0xea16df6c, 8 | BRF_GRA }, // 37 - { "sf-32.bin", 0x10000, 0x72df2bd9, 8 | BRF_GRA }, // 38 - { "sf-33.bin", 0x10000, 0x3e99d3d5, 8 | BRF_GRA }, // 39 - - { "sfb05.bin", 0x0100, 0x864199ad, 0 | BRF_OPT }, // 40 Proms - { "sfb00.bin", 0x0100, 0xbd3f8c5d, 0 | BRF_OPT }, // 41 - { "mb7114h.12j", 0x0100, 0x4c734b64, 0 | BRF_OPT }, // 42 - { "mmi-7603.13h",0x0020, 0x06bcda53, 0 | BRF_OPT }, // 43 - - { "68705.bin", 0x00800, 0x00000000, 0 | BRF_NODUMP }, -}; - -STD_ROM_PICK(sfjp) -STD_ROM_FN(sfjp) - -static INT32 SfjpInit() -{ - return DrvInit(3); -} - -struct BurnDriver BurnDrvsfjp = { - "sfj", "sf", NULL, NULL, "1987", - "Street Fighter (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_VSFIGHT, FBF_SF, - NULL, sfjpRomInfo, sfjpRomName, NULL, NULL, SfjpInputInfo, SfusDIPInfo, - SfjpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x401, 384, 224, 4, 3 -}; - - -// Street Fighter (Prototype) - -static struct BurnRomInfo sfpRomDesc[] = { - { "prg8.2a", 0x20000, 0xd48d06a3, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "prg0.2c", 0x20000, 0xe8606c1a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "sound.9j", 0x08000, 0x43cd32ae, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #0 Code - - { "voice.1g", 0x10000, 0x3f23c180, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "bkchr.2k", 0x20000, 0xe4d47aca, 4 | BRF_GRA }, // 4 Background Tiles - { "bkchr.1k", 0x20000, 0x5a1cbc1b, 4 | BRF_GRA }, // 5 - { "bkchr.4k", 0x20000, 0xc351bd48, 4 | BRF_GRA }, // 6 - { "bkchr.3k", 0x20000, 0x6bb2b050, 4 | BRF_GRA }, // 7 - - { "mchr.1d", 0x20000, 0xab06a60b, 5 | BRF_GRA }, // 8 Foreground Tiles - { "mchr.1e", 0x20000, 0xd221387d, 5 | BRF_GRA }, // 9 - { "mchr.1g", 0x20000, 0x1e4c1712, 5 | BRF_GRA }, // 10 - { "mchr.1h", 0x20000, 0xa381f529, 5 | BRF_GRA }, // 11 - { "mchr.2d", 0x20000, 0xe52303c4, 5 | BRF_GRA }, // 12 - { "mchr.2e", 0x20000, 0x23b9a6a1, 5 | BRF_GRA }, // 13 - { "mchr.2g", 0x20000, 0x1283ac09, 5 | BRF_GRA }, // 14 - { "mchr.2h", 0x20000, 0xcc6bf05c, 5 | BRF_GRA }, // 15 - - { "b1m.bin", 0x10000, 0x64758232, 6 | BRF_GRA }, // 16 Sprites - { "b2m.bin", 0x10000, 0xd958f5ad, 6 | BRF_GRA }, // 17 - { "b1k.bin", 0x10000, 0xe766f5fe, 6 | BRF_GRA }, // 18 - { "b2k.bin", 0x10000, 0xe71572d3, 6 | BRF_GRA }, // 19 - { "b1h.bin", 0x10000, 0x8494f38c, 6 | BRF_GRA }, // 20 - { "b2h.bin", 0x10000, 0x1fc5f049, 6 | BRF_GRA }, // 21 - { "b3m.bin", 0x10000, 0xd136802e, 6 | BRF_GRA }, // 22 - { "b4m.bin", 0x10000, 0xb4fa85d3, 6 | BRF_GRA }, // 23 - { "b3k.bin", 0x10000, 0x40e11cc8, 6 | BRF_GRA }, // 24 - { "b4k.bin", 0x10000, 0x5ca9716e, 6 | BRF_GRA }, // 25 - { "b3h.bin", 0x10000, 0x8c3d9173, 6 | BRF_GRA }, // 26 - { "b4h.bin", 0x10000, 0xa2df66f8, 6 | BRF_GRA }, // 27 - - { "vram.4d", 0x04000, 0xbfadfb32, 7 | BRF_GRA }, // 28 Characters - - { "bks1j10.5h", 0x10000, 0x4934aacd, 8 | BRF_GRA }, // 29 Tilemaps - { "bks1j18.3h", 0x10000, 0x551ffc88, 8 | BRF_GRA }, // 30 - { "ms1j10.3g", 0x10000, 0xf92958b8, 8 | BRF_GRA }, // 31 - { "ms1j18.5g", 0x10000, 0x89e35dc1, 8 | BRF_GRA }, // 32 - - { "sfb05.bin", 0x0100, 0x864199ad, 0 | BRF_OPT }, // 33 Proms - { "sfb00.bin", 0x0100, 0xbd3f8c5d, 0 | BRF_OPT }, // 34 - { "mb7114h.12j", 0x0100, 0x4c734b64, 0 | BRF_OPT }, // 35 - { "mmi-7603.13h", 0x0020, 0x06bcda53, 0 | BRF_OPT }, // 36 -}; - -STD_ROM_PICK(sfp) -STD_ROM_FN(sfp) - -static INT32 SfpInit() -{ - return DrvInit(4); -} - -struct BurnDriver BurnDrvsfp = { - "sfp", "sf", NULL, NULL, "1987", - "Street Fighter (Prototype)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_PROTOTYPE, 2, HARWARE_CAPCOM_MISC, GBF_VSFIGHT, FBF_SF, - NULL, sfpRomInfo, sfpRomName, NULL, NULL, SfInputInfo, SfDIPInfo, - SfpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x401, 384, 224, 4, 3 -}; - +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm5205.h" + +static UINT8 *Mem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68kRom; +static UINT8 *DrvZ80Rom0; +static UINT8 *DrvZ80Rom1; +static UINT8 *Drv68kPalRam; +static UINT8 *Drv68kVidRam; +static UINT8 *Drv68kRam; +static UINT8 *DrvZ80Ram0; +static UINT8 *Gfx0; +static UINT8 *Gfx1; +static UINT8 *Gfx2; +static UINT8 *Gfx3; +static UINT8 *Gfx4; +static UINT8 *Gfx1Trans; +static UINT8 *Gfx3Trans; +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvJoy4[16]; +static UINT8 DrvJoy5[16]; +static UINT8 DrvDips[ 4]; +static UINT8 DrvReset; +static UINT16 DrvInputs[8]; + +static INT32 version; + +static INT32 sf_fg_scroll_x; +static INT32 sf_bg_scroll_x; + +static INT32 soundlatch; +static INT32 flipscreen; + +static INT32 sf_active; +static INT32 sound2_bank; + +static struct BurnInputInfo SfInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy3 + 3, "p1 up", }, + {"P1 Down", BIT_DIGITAL, DrvJoy3 + 2, "p1 down", }, + {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy4 + 1, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy4 + 2, "p1 fire 3"}, + {"P1 Button 4" , BIT_DIGITAL , DrvJoy4 + 8, "p1 fire 4"}, + {"P1 Button 5" , BIT_DIGITAL , DrvJoy4 + 9, "p1 fire 5"}, + {"P1 Button 6" , BIT_DIGITAL , DrvJoy4 + 10, "p1 fire 6"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 11, "p2 up", }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 10, "p2 down", }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 9, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 8, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy5 + 0, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy5 + 1, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy5 + 2, "p2 fire 3"}, + {"P2 Button 4" , BIT_DIGITAL , DrvJoy5 + 8, "p2 fire 4"}, + {"P2 Button 5" , BIT_DIGITAL , DrvJoy5 + 9, "p2 fire 5"}, + {"P2 Button 6" , BIT_DIGITAL , DrvJoy5 + 10, "p2 fire 6"}, + + {"Service" , BIT_DIGITAL , DrvJoy1 + 2, "service" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, + {"Dip 4", BIT_DIPSWITCH, DrvDips + 3, "dip" }, +}; + +STDINPUTINFO(Sf) + +static struct BurnInputInfo SfjpInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy3 + 3, "p1 up", }, + {"P1 Down", BIT_DIGITAL, DrvJoy3 + 2, "p1 down", }, + {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 8, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 9, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 10, "p1 fire 3"}, + {"P1 Button 4" , BIT_DIGITAL , DrvJoy3 + 12, "p1 fire 4"}, + {"P1 Button 5" , BIT_DIGITAL , DrvJoy3 + 13, "p1 fire 5"}, + {"P1 Button 6" , BIT_DIGITAL , DrvJoy3 + 14, "p1 fire 6"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy4 + 3, "p1 up", }, + {"P2 Down", BIT_DIGITAL, DrvJoy4 + 2, "p2 down", }, + {"P2 Left" , BIT_DIGITAL , DrvJoy4 + 1, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy4 + 0, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 8, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 9, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy4 + 10, "p2 fire 3"}, + {"P2 Button 4" , BIT_DIGITAL , DrvJoy4 + 12, "p2 fire 4"}, + {"P2 Button 5" , BIT_DIGITAL , DrvJoy4 + 13, "p2 fire 5"}, + {"P2 Button 6" , BIT_DIGITAL , DrvJoy4 + 14, "p2 fire 6"}, + + {"Service" , BIT_DIGITAL , DrvJoy1 + 2, "service" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, + {"Dip 4", BIT_DIPSWITCH, DrvDips + 3, "dip" }, +}; + +STDINPUTINFO(Sfjp) + +static struct BurnInputInfo SfusInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy3 + 3, "p1 up", }, + {"P1 Down", BIT_DIGITAL, DrvJoy3 + 2, "p1 down", }, + {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy2 + 9, "p1 fire 3"}, + {"P1 Button 4" , BIT_DIGITAL , DrvJoy3 + 6, "p1 fire 4"}, + {"P1 Button 5" , BIT_DIGITAL , DrvJoy3 + 7, "p1 fire 5"}, + {"P1 Button 6" , BIT_DIGITAL , DrvJoy2 + 2, "p1 fire 6"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 11, "p1 up", }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 10, "p2 down", }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 9, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 8, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 12, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 13, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 10, "p2 fire 3"}, + {"P2 Button 4" , BIT_DIGITAL , DrvJoy3 + 14, "p2 fire 4"}, + {"P2 Button 5" , BIT_DIGITAL , DrvJoy3 + 15, "p2 fire 5"}, + {"P2 Button 6" , BIT_DIGITAL , DrvJoy2 + 8, "p2 fire 6"}, + + {"Service" , BIT_DIGITAL , DrvJoy1 + 2, "service" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, + {"Dip 4", BIT_DIPSWITCH, DrvDips + 3, "dip" }, +}; + +STDINPUTINFO(Sfus) + +static struct BurnDIPInfo SfDIPList[]= +{ + {0x1a, 0xff, 0xff, 0xff, NULL }, + {0x1b, 0xff, 0xff, 0xff, NULL }, + {0x1c, 0xff, 0xff, 0xf8, NULL }, + {0x1d, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 2 , "Attract Music" }, + {0x1a, 0x01, 0x02, 0x00, "Off" }, + {0x1a, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Speed" }, + {0x1a, 0x01, 0x10, 0x00, "Slow" }, + {0x1a, 0x01, 0x10, 0x10, "Normal" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x1a, 0x01, 0x20, 0x20, "Off" }, + {0x1a, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x1a, 0x01, 0x40, 0x40, "Off" }, + {0x1a, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x1b, 0x01, 0x07, 0x00, "4 Coins 1 Credit" }, + {0x1b, 0x01, 0x07, 0x01, "3 Coins 1 Credit" }, + {0x1b, 0x01, 0x07, 0x02, "2 Coins 1 Credit" }, + {0x1b, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, + {0x1b, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x1b, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x1b, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x1b, 0x01, 0x07, 0x03, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x1b, 0x01, 0x38, 0x00, "4 Coins 1 Credit" }, + {0x1b, 0x01, 0x38, 0x08, "3 Coins 1 Credit" }, + {0x1b, 0x01, 0x38, 0x10, "2 Coins 1 Credit" }, + {0x1b, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, + {0x1b, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x1b, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x1b, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x1b, 0x01, 0x38, 0x18, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 6 , "Buy-in max stage" }, + {0x1c, 0x01, 0x38, 0x38, "5th" }, + {0x1c, 0x01, 0x38, 0x30, "4th" }, + {0x1c, 0x01, 0x38, 0x28, "3rd" }, + {0x1c, 0x01, 0x38, 0x20, "2nd" }, + {0x1c, 0x01, 0x38, 0x18, "1st" }, + {0x1c, 0x01, 0x38, 0x08, "No buy-in" }, + + {0 , 0xfe, 0 , 2 , "Number of start countries" }, + {0x1c, 0x01, 0x40, 0x40, "4" }, + {0x1c, 0x01, 0x40, 0x00, "2" }, + + {0 , 0xfe, 0 , 6 , "Continuation max stage" }, + {0x1d, 0x01, 0x07, 0x07, "5th" }, + {0x1d, 0x01, 0x07, 0x06, "4th" }, + {0x1d, 0x01, 0x07, 0x05, "3rd" }, + {0x1d, 0x01, 0x07, 0x04, "2nd" }, + {0x1d, 0x01, 0x07, 0x03, "1st" }, + {0x1d, 0x01, 0x07, 0x02, "No continuation" }, + + {0 , 0xfe, 0 , 4 , "Round time" }, + {0x1d, 0x01, 0x18, 0x18, "100" }, + {0x1d, 0x01, 0x18, 0x10, "150" }, + {0x1d, 0x01, 0x18, 0x08, "200" }, + {0x1d, 0x01, 0x18, 0x00, "250" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x1d, 0x01, 0x60, 0x60, "Normal" }, + {0x1d, 0x01, 0x60, 0x40, "Easy" }, + {0x1d, 0x01, 0x60, 0x20, "Difficult" }, + {0x1d, 0x01, 0x60, 0x00, "Very difficult" }, +}; + +STDDIPINFO(Sf) + +static struct BurnDIPInfo SfusDIPList[]= +{ + {0x1a, 0xff, 0xff, 0xff, NULL }, + {0x1b, 0xff, 0xff, 0xff, NULL }, + {0x1c, 0xff, 0xff, 0xf8, NULL }, + {0x1d, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x1a, 0x01, 0x01, 0x01, "Off" }, + {0x1a, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Attract Music" }, + {0x1a, 0x01, 0x02, 0x00, "Off" }, + {0x1a, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Speed" }, + {0x1a, 0x01, 0x10, 0x00, "Slow" }, + {0x1a, 0x01, 0x10, 0x10, "Normal" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x1a, 0x01, 0x20, 0x20, "Off" }, + {0x1a, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x1a, 0x01, 0x40, 0x40, "Off" }, + {0x1a, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x1b, 0x01, 0x07, 0x00, "4 Coins 1 Credit" }, + {0x1b, 0x01, 0x07, 0x01, "3 Coins 1 Credit" }, + {0x1b, 0x01, 0x07, 0x02, "2 Coins 1 Credit" }, + {0x1b, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, + {0x1b, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x1b, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x1b, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x1b, 0x01, 0x07, 0x03, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x1b, 0x01, 0x38, 0x00, "4 Coins 1 Credit" }, + {0x1b, 0x01, 0x38, 0x08, "3 Coins 1 Credit" }, + {0x1b, 0x01, 0x38, 0x10, "2 Coins 1 Credit" }, + {0x1b, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, + {0x1b, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x1b, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x1b, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x1b, 0x01, 0x38, 0x18, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 6 , "Buy-in max stage" }, + {0x1c, 0x01, 0x38, 0x38, "5th" }, + {0x1c, 0x01, 0x38, 0x30, "4th" }, + {0x1c, 0x01, 0x38, 0x28, "3rd" }, + {0x1c, 0x01, 0x38, 0x20, "2nd" }, + {0x1c, 0x01, 0x38, 0x18, "1st" }, + {0x1c, 0x01, 0x38, 0x08, "No buy-in" }, + + {0 , 0xfe, 0 , 2 , "Number of start countries" }, + {0x1c, 0x01, 0x40, 0x00, "4" }, + {0x1c, 0x01, 0x40, 0x40, "2" }, + + {0 , 0xfe, 0 , 6 , "Continuation max stage" }, + {0x1d, 0x01, 0x07, 0x07, "5th" }, + {0x1d, 0x01, 0x07, 0x06, "4th" }, + {0x1d, 0x01, 0x07, 0x05, "3rd" }, + {0x1d, 0x01, 0x07, 0x04, "2nd" }, + {0x1d, 0x01, 0x07, 0x03, "1st" }, + {0x1d, 0x01, 0x07, 0x02, "No continuation" }, + + {0 , 0xfe, 0 , 4 , "Round time" }, + {0x1d, 0x01, 0x18, 0x18, "100" }, + {0x1d, 0x01, 0x18, 0x10, "150" }, + {0x1d, 0x01, 0x18, 0x08, "200" }, + {0x1d, 0x01, 0x18, 0x00, "250" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x1d, 0x01, 0x60, 0x60, "Normal" }, + {0x1d, 0x01, 0x60, 0x40, "Easy" }, + {0x1d, 0x01, 0x60, 0x20, "Difficult" }, + {0x1d, 0x01, 0x60, 0x00, "Very difficult" }, +}; + +STDDIPINFO(Sfus) + +static void protection_w() +{ + static const INT32 maplist[4][10] = { + { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 }, + { 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 }, + { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 }, + { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 } + }; + INT32 map; + + map = maplist[SekReadByte(0xffc006)][(SekReadByte(0xffc003)<<1) + (SekReadWord(0xffc004)>>8)]; + + switch (SekReadByte(0xffc684)) + { + case 1: + { + INT32 base; + + base = 0x1b6e8+0x300e*map; + + SekWriteLong(0xffc01c, 0x16bfc+0x270*map); + SekWriteLong(0xffc020, base+0x80); + SekWriteLong(0xffc024, base); + SekWriteLong(0xffc028, base+0x86); + SekWriteLong(0xffc02c, base+0x8e); + SekWriteLong(0xffc030, base+0x20e); + SekWriteLong(0xffc034, base+0x30e); + SekWriteLong(0xffc038, base+0x38e); + SekWriteLong(0xffc03c, base+0x40e); + SekWriteLong(0xffc040, base+0x80e); + SekWriteLong(0xffc044, base+0xc0e); + SekWriteLong(0xffc048, base+0x180e); + SekWriteLong(0xffc04c, base+0x240e); + SekWriteLong(0xffc050, 0x19548+0x60*map); + SekWriteLong(0xffc054, 0x19578+0x60*map); + break; + } + + case 2: + { + static const INT32 delta1[10] = { + 0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80 + }; + static const INT32 delta2[10] = { + 0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80 + }; + + INT32 d1 = delta1[map] + 0xc0; + INT32 d2 = delta2[map]; + + SekWriteWord(0xffc680, d1); + SekWriteWord(0xffc682, d2); + SekWriteWord(0xffc00c, 0xc0); + SekWriteWord(0xffc00e, 0); + + sf_fg_scroll_x = d1; + sf_bg_scroll_x = d2; + + break; + } + + case 4: + { + INT32 pos = SekReadByte(0xffc010); + pos = (pos+1) & 3; + SekWriteByte(0xffc010, pos); + + if(!pos) { + INT32 d1 = SekReadWord(0xffc682); + INT32 off = SekReadWord(0xffc00e); + if(off!=512) { + off++; + d1++; + } else { + off = 0; + d1 -= 512; + } + SekWriteWord(0xffc682, d1); + SekWriteWord(0xffc00e, off); + + sf_bg_scroll_x = d1; + } + break; + } + } +} + +static inline void write_palette(UINT16 data, INT32 offset) +{ + INT32 r = (data >> 8) & 0x0f; + INT32 g = (data >> 4) & 0x0f; + INT32 b = (data >> 0) & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + Palette[offset] = (r << 16) | (g << 8) | b; + DrvPalette[offset] = BurnHighCol(r, g, b, 0); +} + +void __fastcall sf_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfff800) == 0xb00000) { + UINT16 *pal = (UINT16*)(Drv68kPalRam + (address & 0x7ff)); + + *pal = data; + + write_palette(*pal, (address >> 1) & 0x3ff); + + return; + } + + switch (address) + { + case 0xc00010: + return; + + case 0xc00014: + sf_fg_scroll_x = data; + return; + + case 0xc00018: + sf_bg_scroll_x = data; + return; + + case 0xc0001c: + { + soundlatch = data & 0xff; + + ZetOpen(0); + ZetNmi(); + ZetClose(); + } + return; + + case 0xc0001e: + if (version == 3) { + protection_w(); + } + return; + } +} + +void __fastcall sf_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0xc0001b: + { + sf_active = data & 0xff; + flipscreen = data & 0x04; + } + return; + } +} + +UINT16 __fastcall sf_read_word(UINT32 address) +{ + switch (address) + { + case 0xc00000: + return DrvInputs[3]; + + case 0xc00002: + return DrvInputs[4]; + + case 0xc00004: + return DrvInputs[5]; + + case 0xc00006: + return DrvInputs[6]; + + case 0xc00008: + return DrvInputs[0]; + + case 0xc0000a: + return DrvInputs[1]; + + case 0xc0000c: + return DrvInputs[2]; + + case 0xc0000e: + return 0xffff; + } + + return 0; +} + +UINT8 __fastcall sf_read_byte(UINT32 address) +{ + switch (address) + { + case 0xc00000: + case 0xc00001: + return DrvInputs[3] >> ((~address & 1) << 3); + + case 0xc00002: + case 0xc00003: + return DrvInputs[4] >> ((~address & 1) << 3); + + case 0xc00004: + case 0xc00005: + return DrvInputs[5] >> ((~address & 1) << 3); + + case 0xc00006: + case 0xc00007: + return DrvInputs[6] >> ((~address & 1) << 3); + + case 0xc00008: + case 0xc00009: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0xc0000a: + case 0xc0000b: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0xc0000c: + case 0xc0000d: + return DrvInputs[2] >> ((~address & 1) << 3); + + case 0xc0000e: + case 0xc0000f: + return 0xff; + } + + return 0; +} + +void __fastcall sf_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe000: + BurnYM2151SelectRegister(data); + return; + + case 0xe001: + BurnYM2151WriteRegister(data); + return; + } +} + +UINT8 __fastcall sf_sound_read(UINT16 address) +{ + switch (address) + { + case 0xc800: + return soundlatch; + + case 0xe001: + return BurnYM2151ReadStatus(); + } + + return 0; +} + +static void sound2_bank_w(INT32 data) +{ + sound2_bank = (data + 1) << 15; + + ZetMapArea(0x8000, 0xffff, 0, DrvZ80Rom1 + sound2_bank); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80Rom1 + sound2_bank); +} + +void __fastcall sf_sound2_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + MSM5205ResetWrite(0, data & 0x80); + MSM5205DataWrite(0, data); + MSM5205VCLKWrite(0, 1); + MSM5205VCLKWrite(0, 0); + return; + + case 0x01: + MSM5205ResetWrite(1, data & 0x80); + MSM5205DataWrite(1, data); + MSM5205VCLKWrite(1, 1); + MSM5205VCLKWrite(1, 0); + return; + + case 0x02: + sound2_bank_w(data); + return; + } +} + +UINT8 __fastcall sf_sound2_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x01: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return soundlatch; + } + + return 0; +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(double)ZetTotalCycles() * nSoundRate / 3579545; +} + +static INT32 DrvGfxDecode() +{ + static INT32 Gfx0Planes[4] = { 4, 0, 0x200004, 0x200000 }; + static INT32 Gfx1Planes[4] = { 4, 0, 0x400004, 0x400000 }; + static INT32 Gfx2Planes[4] = { 4, 0, 0x700004, 0x700000 }; + static INT32 Gfx3Planes[2] = { 4, 0 }; + + static INT32 GfxXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 }; + static INT32 GfxYOffsets[16] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, + 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x1C0000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, Gfx0, 0x080000); + + GfxDecode(0x1000, 4, 16, 16, Gfx0Planes, GfxXOffsets, GfxYOffsets, 0x200, tmp, Gfx0); + + memcpy (tmp, Gfx1, 0x100000); + + GfxDecode(0x2000, 4, 16, 16, Gfx1Planes, GfxXOffsets, GfxYOffsets, 0x200, tmp, Gfx1); + + memcpy (tmp, Gfx2, 0x1c0000); + + GfxDecode(0x3800, 4, 16, 16, Gfx2Planes, GfxXOffsets, GfxYOffsets, 0x200, tmp, Gfx2); + + memcpy (tmp, Gfx3, 0x004000); + + GfxDecode(0x0400, 2, 8, 8, Gfx3Planes, GfxXOffsets, GfxYOffsets, 0x080, tmp, Gfx3); + + memset (Gfx1Trans, 1, 0x2000); + for (INT32 i = 0; i < 0x2000 * 0x100; i++) { + if (Gfx1[i] != 15) Gfx1Trans[i/0x100] = 0; + } + + memset (Gfx3Trans, 1, 0x400); + for (INT32 i = 0; i < 0x400 * 0x40; i++) { + if (Gfx3[i] != 3) Gfx3Trans[i/0x40] = 0; + } + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + sf_fg_scroll_x = 0; + sf_bg_scroll_x = 0; + + soundlatch = 0; + flipscreen = 0; + + sf_active = 0; + + sound2_bank = 0; + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + MSM5205Reset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68kRom = Next; Next += 0x060000; + DrvZ80Rom0 = Next; Next += 0x008000; + DrvZ80Rom1 = Next; Next += 0x040000; + + Gfx0 = Next; Next += 0x100000; + Gfx1 = Next; Next += 0x200000; + Gfx1Trans = Next; Next += 0x002000; + Gfx2 = Next; Next += 0x380000; + Gfx3 = Next; Next += 0x010000; + Gfx3Trans = Next; Next += 0x000400; + Gfx4 = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x00401 * sizeof(UINT32); + + AllRam = Next; + + Drv68kPalRam = Next; Next += 0x000800; + Drv68kVidRam = Next; Next += 0x001000; + Drv68kRam = Next; Next += 0x008000; + + DrvZ80Ram0 = Next; Next += 0x000800; + + Palette = (UINT32*)Next; Next += 0x00401 * sizeof(UINT32); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +void sfYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvInit(INT32 initver) +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + if (initver == 4) + { + if (BurnLoadRom(Drv68kRom + 1, 0, 2)) return 1; + if (BurnLoadRom(Drv68kRom + 0, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80Rom0, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80Rom1, 3, 1)) return 1; + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(Gfx0 + i * 0x20000, i + 4, 1)) return 1; + } + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(Gfx1 + i * 0x20000, i + 8, 1)) return 1; + } + + for (INT32 i = 0; i < 6; i++) { + if (BurnLoadRom(Gfx2 + 0x00000 + i * 0x10000, i + 16, 1)) return 1; + if (BurnLoadRom(Gfx2 + 0xe0000 + i * 0x10000, i + 22, 1)) return 1; + } + + if (BurnLoadRom(Gfx3, 28, 1)) return 1; + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(Gfx4 + i * 0x10000, i + 29, 1)) return 1; + } + } else { + for (INT32 i = 0; i < 6; i+=2) { + if (BurnLoadRom(Drv68kRom + 1 + i * 0x10000, i + 0, 2)) return 1; + if (BurnLoadRom(Drv68kRom + 0 + i * 0x10000, i + 1, 2)) return 1; + } + + if (BurnLoadRom(DrvZ80Rom0, 6, 1)) return 1; + + if (BurnLoadRom(DrvZ80Rom1 + 0x00000, 7, 1)) return 1; + if (BurnLoadRom(DrvZ80Rom1 + 0x20000, 8, 1)) return 1; + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(Gfx0 + i * 0x20000, i + 9, 1)) return 1; + } + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(Gfx1 + i * 0x20000, i + 13, 1)) return 1; + } + + for (INT32 i = 0; i < 14; i++) { + if (BurnLoadRom(Gfx2 + i * 0x20000, i + 21, 1)) return 1; + } + + if (BurnLoadRom(Gfx3, 35, 1)) return 1; + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(Gfx4 + i * 0x10000, i + 36, 1)) return 1; + } + } + + if (DrvGfxDecode()) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68kRom, 0x000000, 0x04ffff, SM_ROM); + SekMapMemory(Drv68kVidRam, 0x800000, 0x800fff, SM_RAM); + SekMapMemory(Drv68kRam, 0xff8000, 0xffffff, SM_RAM); + SekSetWriteByteHandler(0, sf_write_byte); + SekSetWriteWordHandler(0, sf_write_word); + SekSetReadByteHandler(0, sf_read_byte); + SekSetReadWordHandler(0, sf_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom0); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram0); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram0); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram0); + ZetSetWriteHandler(sf_sound_write); + ZetSetReadHandler(sf_sound_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1); + ZetSetOutHandler(sf_sound2_out); + ZetSetInHandler(sf_sound2_in); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&sfYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.60, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.60, BURN_SND_ROUTE_RIGHT); + + MSM5205Init(0, DrvSynchroniseStream, 384000, NULL, MSM5205_SEX_4B, 1); + MSM5205Init(1, DrvSynchroniseStream, 384000, NULL, MSM5205_SEX_4B, 1); + MSM5205SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + MSM5205SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + version = initver; + + Palette[0x400] = 0xff00ff; + + return 0; +} + +static INT32 DrvExit() +{ + BurnYM2151Exit(); + SekExit(); + ZetExit(); + + MSM5205Exit(); + + version = 0; + + GenericTilesExit(); + + BurnFree (Mem); + + sf_fg_scroll_x = 0; + sf_bg_scroll_x = 0; + + soundlatch = 0; + flipscreen = 0; + + sf_active = 0; + sound2_bank = 0; + + return 0; +} + +static void draw_background() +{ + UINT8 *base = Gfx4 + ((sf_bg_scroll_x >> 4) << 5); + + for (INT32 offs = 0; offs < 0x200; offs++, base += 2) + { + INT32 sx = (offs & 0x1f0) - (sf_bg_scroll_x & 0x0f); + INT32 sy = (offs << 4) & 0xf0; + + if (sx < 49 || sx >= 448 || sy < 16 || sy > 239) continue; + + INT32 attr = base[0x10000]; + INT32 color = base[0x00000]; + INT32 code = (base[0x10001] << 8) | base[1]; + + INT32 flipx = attr & 1; + INT32 flipy = attr & 2; + + if (flipscreen) { + flipx = !flipx; + flipy = !flipy; + sx = ((sx + (sf_bg_scroll_x & 0x0f)) ^ 0x1f0) + (sf_bg_scroll_x & 0x0f); + sy ^= 0xf0; + } + + sx -= 64; + sy -= 16; + + if (flipy) { + if (flipx) { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } else { + Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } + } else { + if (flipx) { + Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx0); + } + } + } +} + +static void draw_foreground() +{ + UINT8 *base = 0x20000 + Gfx4 + ((sf_fg_scroll_x >> 4) << 5); + + for (INT32 offs = 0; offs < 0x200; offs++, base += 2) + { + INT32 sx = (offs & 0x1f0) - (sf_fg_scroll_x & 0x0f); + INT32 sy = (offs << 4) & 0xf0; + + if (sx < 49 || sx >= 448 || sy < 16 || sy > 239) continue; + + INT32 code = (base[0x10001] << 8) | base[1]; + if (Gfx1Trans[code]) continue; + + INT32 attr = base[0x10000]; + INT32 color = base[0x00000]; + + INT32 flipx = attr & 1; + INT32 flipy = attr & 2; + + if (flipscreen) { + flipx = !flipx; + flipy = !flipy; + sx = ((sx + (sf_fg_scroll_x & 0x0f)) ^ 0x1f0) + (sf_fg_scroll_x & 0x0f); + sy ^= 0xf0; + } + + sx -= 64; + sy -= 16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, Gfx1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, Gfx1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, Gfx1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x100, Gfx1); + } + } + } +} + +static void draw_characters() +{ + UINT16 *fg_ram = (UINT16*)(Drv68kVidRam); + + for (INT32 offs = 0x100 / 2; offs < 0x0f00 / 2; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + if (sx < 64 || sx > 447) continue; + + INT32 attr = BURN_ENDIAN_SWAP_INT16(fg_ram[offs]); + INT32 code = attr & 0x3ff; + if (Gfx3Trans[code]) continue; + + INT32 color = attr >> 12; + + INT32 flipx = attr & 0x400; + INT32 flipy = attr & 0x800; + + if (flipscreen) { + flipx = !flipx; + flipy = !flipy; + sx ^= 0x1f8; + sy ^= 0x0f8; + } + + sx -= 64; + sy -= 16; + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 2, 3, 0x300, Gfx3); + } else { + Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 2, 3, 0x300, Gfx3); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 2, 3, 0x300, Gfx3); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 2, 3, 0x300, Gfx3); + } + } + } +} + +static inline INT32 sf_invert(INT32 nb) +{ + static const INT32 delta[4] = {0x00, 0x18, 0x18, 0x00}; + return nb ^ delta[(nb >> 3) & 3]; +} + +static void draw_sprites() +{ + UINT16 *sf_objectram = (UINT16*)(Drv68kRam + 0x6000); + + for (INT32 offs = 0x1000-0x20;offs >= 0;offs -= 0x20) + { + INT32 c = BURN_ENDIAN_SWAP_INT16(sf_objectram[offs]); + INT32 attr = BURN_ENDIAN_SWAP_INT16(sf_objectram[offs+1]); + INT32 sy = BURN_ENDIAN_SWAP_INT16(sf_objectram[offs+2]); + INT32 sx = BURN_ENDIAN_SWAP_INT16(sf_objectram[offs+3]); + INT32 color = attr & 0x000f; + INT32 flipx = attr & 0x0100; + INT32 flipy = attr & 0x0200; + + if (attr & 0x400) // large sprite + { + INT32 c1,c2,c3,c4,t; + + if (flipscreen) + { + sx = 480 - sx; + sy = 224 - sy; + flipx = !flipx; + flipy = !flipy; + } + + if (sy > 239 || sx < 33 || sx > 447) continue; + + sx -= 64; + sy -= 16; + + c1 = c; + c2 = c+1; + c3 = c+16; + c4 = c+17; + + if (flipx) + { + t = c1; c1 = c2; c2 = t; + t = c3; c3 = c4; c4 = t; + } + if (flipy) + { + t = c1; c1 = c3; c3 = t; + t = c2; c2 = c4; c4 = t; + } + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sf_invert(c1), sx , sy , color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sf_invert(c2), sx + 16, sy , color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sf_invert(c3), sx , sy + 16, color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sf_invert(c4), sx + 16, sy + 16, color, 4, 15, 0x200, Gfx2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sf_invert(c1), sx , sy , color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sf_invert(c2), sx + 16, sy , color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sf_invert(c3), sx , sy + 16, color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sf_invert(c4), sx + 16, sy + 16, color, 4, 15, 0x200, Gfx2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sf_invert(c1), sx , sy , color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sf_invert(c2), sx + 16, sy , color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sf_invert(c3), sx , sy + 16, color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sf_invert(c4), sx + 16, sy + 16, color, 4, 15, 0x200, Gfx2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, sf_invert(c1), sx , sy , color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_Clip(pTransDraw, sf_invert(c2), sx + 16, sy , color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_Clip(pTransDraw, sf_invert(c3), sx , sy + 16, color, 4, 15, 0x200, Gfx2); + Render16x16Tile_Mask_Clip(pTransDraw, sf_invert(c4), sx + 16, sy + 16, color, 4, 15, 0x200, Gfx2); + } + } + } + else + { + if (flipscreen) + { + sx = 496 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + if (sy < 1 || sy > 239 || sx < 49 || sx > 447) continue; + + sx -= 64; + sy -= 16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sf_invert(c), sx, sy, color, 4, 15, 0x200, Gfx2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sf_invert(c), sx, sy, color, 4, 15, 0x200, Gfx2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sf_invert(c), sx, sy, color, 4, 15, 0x200, Gfx2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, sf_invert(c), sx, sy, color, 4, 15, 0x200, Gfx2); + } + } + } + } +} + + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x401; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + if (nBurnLayer & 8) { + if (sf_active & 0x20) + draw_background(); + else + memset (pTransDraw, 0, nScreenWidth * nScreenHeight * sizeof(INT16)); + } else { + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) + pTransDraw[i] = 0x0400; // point to magenta + } + + if (sf_active & 0x40 && nBurnLayer & 4) + draw_foreground(); + + if (sf_active & 0x80 && nBurnLayer & 1) + draw_sprites(); + + if (sf_active & 0x08 && nBurnLayer & 2) + draw_characters(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static void DrvMakeInputs() +{ + DrvInputs[0] = (DrvDips[0] << 8) | DrvDips[1]; + DrvInputs[1] = (DrvDips[2] << 4) | DrvDips[3] | 0xf800; + + DrvInputs[2] = 0xff7f; + DrvInputs[3] = 0xffff; + DrvInputs[4] = 0xffff; + DrvInputs[5] = 0xffff; + DrvInputs[6] = 0xffff; + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[2] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[5] ^= (DrvJoy4[i] & 1) << i; + } + + // clear opposites + { + if (!(DrvInputs[4] & 0x0003)) DrvInputs[4] |= 0x0003; // p1 left/right + if (!(DrvInputs[4] & 0x000c)) DrvInputs[4] |= 0x000c; // p1 up/down + if (!(DrvInputs[4] & 0x0300)) DrvInputs[4] |= 0x0300; // p2 left/right + if (!(DrvInputs[4] & 0x0c00)) DrvInputs[4] |= 0x0c00; // p2 up/down + } + + // World & prototype -- simulate analogue buttons + if (version == 1 || version == 4) + { + static const INT32 scale[8] = { 0x00, 0x60, 0xe0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }; + + INT32 t = (DrvJoy4[0] & 1) | ((DrvJoy4[1] & 1) << 1) | ((DrvJoy4[2] & 1) << 2); + DrvInputs[5] = scale[t]; + t = (DrvJoy5[0] & 1) | ((DrvJoy5[1] & 1) << 1) | ((DrvJoy5[2] & 1) << 2); + DrvInputs[5] |= scale[t] << 8; + + t = (DrvJoy4[8] & 1) | ((DrvJoy4[9] & 1) << 1) | ((DrvJoy4[10] & 1) << 2); + DrvInputs[6] = scale[t]; + + t = (DrvJoy5[8] & 1) | ((DrvJoy5[9] & 1) << 1) | ((DrvJoy5[10] & 1) << 2); + DrvInputs[6] |= scale[t] << 8; + } +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + SekNewFrame(); + ZetNewFrame(); + + DrvMakeInputs(); + + INT32 nSoundBufferPos = 0; + INT32 nInterleave = (133 * 2) / 3; // sample cpu irqs + INT32 nCyclesTotal[3]; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + INT32 nNext[3] = { 0, 0, 0 }; + + nCyclesTotal[0] = (INT32)((INT64)8000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = (INT32)((INT64)3579545 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[2] = 3579545 / 60; //(INT32)((INT64)3579545 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + nNext[0] += nCyclesTotal[0] / nInterleave; + nCyclesDone[0] += SekRun(nNext[0] - nCyclesDone[0]); + + ZetOpen(0); + nNext[1] += nCyclesTotal[1] / nInterleave; + nCyclesDone[1] += ZetRun(nNext[1] - nCyclesDone[1]); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + + nSoundBufferPos += nSegmentLength; + } + + ZetClose(); + + ZetOpen(1); + nNext[2] += nCyclesTotal[2] / nInterleave; + nCyclesDone[2] += ZetRun(nNext[2] - nCyclesDone[2]); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + } + + SekSetIRQLine((version == 4) ? 6 : 1, SEK_IRQSTATUS_AUTO); + + SekClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + } + + ZetOpen(1); + if ((nCyclesTotal[2] - nCyclesDone[2]) > 0) { + ZetRun(nCyclesTotal[2] - nCyclesDone[2]); + } + + MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + MSM5205Render(1, pBurnSoundOut, nBurnSoundLen); + ZetClose(); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + MSM5205Scan(nAction, pnMin); + BurnYM2151Scan(nAction); + + SCAN_VAR(sf_fg_scroll_x); + SCAN_VAR(sf_bg_scroll_x); + SCAN_VAR(soundlatch); + SCAN_VAR(flipscreen); + SCAN_VAR(sf_active); + SCAN_VAR(sound2_bank); + } + + if (nAction & ACB_WRITE) { + ZetOpen(1); + sound2_bank_w(sound2_bank); + ZetClose(); + } + + return 0; +} + + +// Street Fighter (World) + +static struct BurnRomInfo sfRomDesc[] = { + { "sfe-19", 0x10000, 0x8346c3ca, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "sfe-22", 0x10000, 0x3a4bfaa8, 1 | BRF_PRG | BRF_ESS }, // 1 + { "sfe-20", 0x10000, 0xb40e67ee, 1 | BRF_PRG | BRF_ESS }, // 2 + { "sfe-23", 0x10000, 0x477c3d5b, 1 | BRF_PRG | BRF_ESS }, // 3 + { "sfe-21", 0x10000, 0x2547192b, 1 | BRF_PRG | BRF_ESS }, // 4 + { "sfe-24", 0x10000, 0x79680f4e, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "sf-02.bin", 0x08000, 0x4a9ac534, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 #0 Code + + { "sfu-00", 0x20000, 0xa7cce903, 3 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code + { "sf-01.bin", 0x20000, 0x86e0f0d5, 3 | BRF_PRG | BRF_ESS }, // 8 + + { "sf-39.bin", 0x20000, 0xcee3d292, 4 | BRF_GRA }, // 9 Background Tiles + { "sf-38.bin", 0x20000, 0x2ea99676, 4 | BRF_GRA }, // 10 + { "sf-41.bin", 0x20000, 0xe0280495, 4 | BRF_GRA }, // 11 + { "sf-40.bin", 0x20000, 0xc70b30de, 4 | BRF_GRA }, // 12 + + { "sf-25.bin", 0x20000, 0x7f23042e, 5 | BRF_GRA }, // 13 More tiles? + { "sf-28.bin", 0x20000, 0x92f8b91c, 5 | BRF_GRA }, // 14 + { "sf-30.bin", 0x20000, 0xb1399856, 5 | BRF_GRA }, // 15 + { "sf-34.bin", 0x20000, 0x96b6ae2e, 5 | BRF_GRA }, // 16 + { "sf-26.bin", 0x20000, 0x54ede9f5, 5 | BRF_GRA }, // 17 + { "sf-29.bin", 0x20000, 0xf0649a67, 5 | BRF_GRA }, // 18 + { "sf-31.bin", 0x20000, 0x8f4dd71a, 5 | BRF_GRA }, // 19 + { "sf-35.bin", 0x20000, 0x70c00fb4, 5 | BRF_GRA }, // 20 + + { "sf-15.bin", 0x20000, 0xfc0113db, 6 | BRF_GRA }, // 21 Sprites + { "sf-16.bin", 0x20000, 0x82e4a6d3, 6 | BRF_GRA }, // 22 + { "sf-11.bin", 0x20000, 0xe112df1b, 6 | BRF_GRA }, // 23 + { "sf-12.bin", 0x20000, 0x42d52299, 6 | BRF_GRA }, // 24 + { "sf-07.bin", 0x20000, 0x49f340d9, 6 | BRF_GRA }, // 25 + { "sf-08.bin", 0x20000, 0x95ece9b1, 6 | BRF_GRA }, // 26 + { "sf-03.bin", 0x20000, 0x5ca05781, 6 | BRF_GRA }, // 27 + { "sf-17.bin", 0x20000, 0x69fac48e, 6 | BRF_GRA }, // 28 + { "sf-18.bin", 0x20000, 0x71cfd18d, 6 | BRF_GRA }, // 29 + { "sf-13.bin", 0x20000, 0xfa2eb24b, 6 | BRF_GRA }, // 30 + { "sf-14.bin", 0x20000, 0xad955c95, 6 | BRF_GRA }, // 31 + { "sf-09.bin", 0x20000, 0x41b73a31, 6 | BRF_GRA }, // 32 + { "sf-10.bin", 0x20000, 0x91c41c50, 6 | BRF_GRA }, // 33 + { "sf-05.bin", 0x20000, 0x538c7cbe, 6 | BRF_GRA }, // 34 + + { "sf-27.bin", 0x04000, 0x2b09b36d, 7 | BRF_GRA }, // 35 Characters + + { "sf-37.bin", 0x10000, 0x23d09d3d, 8 | BRF_GRA }, // 36 Tilemaps + { "sf-36.bin", 0x10000, 0xea16df6c, 8 | BRF_GRA }, // 37 + { "sf-32.bin", 0x10000, 0x72df2bd9, 8 | BRF_GRA }, // 38 + { "sf-33.bin", 0x10000, 0x3e99d3d5, 8 | BRF_GRA }, // 39 + + { "mb7114h.12k", 0x0100, 0x75af3553, 0 | BRF_OPT }, // 40 Proms + { "mb7114h.11h", 0x0100, 0xc0e56586, 0 | BRF_OPT }, // 41 + { "mb7114h.12j", 0x0100, 0x4c734b64, 0 | BRF_OPT }, // 42 + { "mmi-7603.13h",0x0020, 0x06bcda53, 0 | BRF_OPT }, // 43 +}; + +STD_ROM_PICK(sf) +STD_ROM_FN(sf) + +static INT32 SfInit() +{ + return DrvInit(1); +} + +struct BurnDriver BurnDrvsf = { + "sf", NULL, NULL, NULL, "1987", + "Street Fighter (World)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_VSFIGHT, FBF_SF, + NULL, sfRomInfo, sfRomName, NULL, NULL, SfInputInfo, SfDIPInfo, + SfInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x401, 384, 224, 4, 3 +}; + + + +// Street Fighter (US set 1) + +static struct BurnRomInfo sfuRomDesc[] = { + { "sfd-19", 0x10000, 0xfaaf6255, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "sfd-22", 0x10000, 0xe1fe3519, 1 | BRF_PRG | BRF_ESS }, // 1 + { "sfd-20", 0x10000, 0x44b915bd, 1 | BRF_PRG | BRF_ESS }, // 2 + { "sfd-23", 0x10000, 0x79c43ff8, 1 | BRF_PRG | BRF_ESS }, // 3 + { "sfd-21", 0x10000, 0xe8db799b, 1 | BRF_PRG | BRF_ESS }, // 4 + { "sfd-24", 0x10000, 0x466a3440, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "sf-02.bin", 0x08000, 0x4a9ac534, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 #0 Code + + { "sfu-00", 0x20000, 0xa7cce903, 3 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code + { "sf-01.bin", 0x20000, 0x86e0f0d5, 3 | BRF_PRG | BRF_ESS }, // 8 + + { "sf-39.bin", 0x20000, 0xcee3d292, 4 | BRF_GRA }, // 9 Background Tiles + { "sf-38.bin", 0x20000, 0x2ea99676, 4 | BRF_GRA }, // 10 + { "sf-41.bin", 0x20000, 0xe0280495, 4 | BRF_GRA }, // 11 + { "sf-40.bin", 0x20000, 0xc70b30de, 4 | BRF_GRA }, // 12 + + { "sf-25.bin", 0x20000, 0x7f23042e, 5 | BRF_GRA }, // 13 Foreground Tiles + { "sf-28.bin", 0x20000, 0x92f8b91c, 5 | BRF_GRA }, // 14 + { "sf-30.bin", 0x20000, 0xb1399856, 5 | BRF_GRA }, // 15 + { "sf-34.bin", 0x20000, 0x96b6ae2e, 5 | BRF_GRA }, // 16 + { "sf-26.bin", 0x20000, 0x54ede9f5, 5 | BRF_GRA }, // 17 + { "sf-29.bin", 0x20000, 0xf0649a67, 5 | BRF_GRA }, // 18 + { "sf-31.bin", 0x20000, 0x8f4dd71a, 5 | BRF_GRA }, // 19 + { "sf-35.bin", 0x20000, 0x70c00fb4, 5 | BRF_GRA }, // 20 + + { "sf-15.bin", 0x20000, 0xfc0113db, 6 | BRF_GRA }, // 21 Sprites + { "sf-16.bin", 0x20000, 0x82e4a6d3, 6 | BRF_GRA }, // 22 + { "sf-11.bin", 0x20000, 0xe112df1b, 6 | BRF_GRA }, // 23 + { "sf-12.bin", 0x20000, 0x42d52299, 6 | BRF_GRA }, // 24 + { "sf-07.bin", 0x20000, 0x49f340d9, 6 | BRF_GRA }, // 25 + { "sf-08.bin", 0x20000, 0x95ece9b1, 6 | BRF_GRA }, // 26 + { "sf-03.bin", 0x20000, 0x5ca05781, 6 | BRF_GRA }, // 27 + { "sf-17.bin", 0x20000, 0x69fac48e, 6 | BRF_GRA }, // 28 + { "sf-18.bin", 0x20000, 0x71cfd18d, 6 | BRF_GRA }, // 29 + { "sf-13.bin", 0x20000, 0xfa2eb24b, 6 | BRF_GRA }, // 30 + { "sf-14.bin", 0x20000, 0xad955c95, 6 | BRF_GRA }, // 31 + { "sf-09.bin", 0x20000, 0x41b73a31, 6 | BRF_GRA }, // 32 + { "sf-10.bin", 0x20000, 0x91c41c50, 6 | BRF_GRA }, // 33 + { "sf-05.bin", 0x20000, 0x538c7cbe, 6 | BRF_GRA }, // 34 + + { "sf-27.bin", 0x04000, 0x2b09b36d, 7 | BRF_GRA }, // 35 Characters + + { "sf-37.bin", 0x10000, 0x23d09d3d, 8 | BRF_GRA }, // 36 Tilemaps + { "sf-36.bin", 0x10000, 0xea16df6c, 8 | BRF_GRA }, // 37 + { "sf-32.bin", 0x10000, 0x72df2bd9, 8 | BRF_GRA }, // 38 + { "sf-33.bin", 0x10000, 0x3e99d3d5, 8 | BRF_GRA }, // 39 + + { "mb7114h.12k", 0x0100, 0x75af3553, 0 | BRF_OPT }, // 40 Proms + { "mb7114h.11h", 0x0100, 0xc0e56586, 0 | BRF_OPT }, // 41 + { "mb7114h.12j", 0x0100, 0x4c734b64, 0 | BRF_OPT }, // 42 + { "mmi-7603.13h",0x0020, 0x06bcda53, 0 | BRF_OPT }, // 43 +}; + +STD_ROM_PICK(sfu) +STD_ROM_FN(sfu) + +static INT32 SfusInit() +{ + return DrvInit(2); +} + +struct BurnDriver BurnDrvsfu = { + "sfu", "sf", NULL, NULL, "1987", + "Street Fighter (US set 1)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_VSFIGHT, FBF_SF, + NULL, sfuRomInfo, sfuRomName, NULL, NULL, SfusInputInfo, SfusDIPInfo, + SfusInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x401, 384, 224, 4, 3 +}; + + +// Street Fighter (US set 2) + +static struct BurnRomInfo sfuaRomDesc[] = { + { "sfs19u.1a", 0x10000, 0xc8e41c49, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "sfs22u.1b", 0x10000, 0x667e9309, 1 | BRF_PRG | BRF_ESS }, // 1 + { "sfs20u.2a", 0x10000, 0x303065bf, 1 | BRF_PRG | BRF_ESS }, // 2 + { "sfs23u.2b", 0x10000, 0xde6927a3, 1 | BRF_PRG | BRF_ESS }, // 3 + { "sfs21u.3a", 0x10000, 0x004a418b, 1 | BRF_PRG | BRF_ESS }, // 4 + { "sfs24u.3b", 0x10000, 0x2b4545ff, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "sf-02.bin", 0x08000, 0x4a9ac534, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 #0 Code + + { "sfu-00", 0x20000, 0xa7cce903, 3 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code + { "sf-01.bin", 0x20000, 0x86e0f0d5, 3 | BRF_PRG | BRF_ESS }, // 8 + + { "sf-39.bin", 0x20000, 0xcee3d292, 4 | BRF_GRA }, // 9 Background Tiles + { "sf-38.bin", 0x20000, 0x2ea99676, 4 | BRF_GRA }, // 10 + { "sf-41.bin", 0x20000, 0xe0280495, 4 | BRF_GRA }, // 11 + { "sf-40.bin", 0x20000, 0xc70b30de, 4 | BRF_GRA }, // 12 + + { "sf-25.bin", 0x20000, 0x7f23042e, 5 | BRF_GRA }, // 13 Foreground Tiles + { "sf-28.bin", 0x20000, 0x92f8b91c, 5 | BRF_GRA }, // 14 + { "sf-30.bin", 0x20000, 0xb1399856, 5 | BRF_GRA }, // 15 + { "sf-34.bin", 0x20000, 0x96b6ae2e, 5 | BRF_GRA }, // 16 + { "sf-26.bin", 0x20000, 0x54ede9f5, 5 | BRF_GRA }, // 17 + { "sf-29.bin", 0x20000, 0xf0649a67, 5 | BRF_GRA }, // 18 + { "sf-31.bin", 0x20000, 0x8f4dd71a, 5 | BRF_GRA }, // 19 + { "sf-35.bin", 0x20000, 0x70c00fb4, 5 | BRF_GRA }, // 20 + + { "sf-15.bin", 0x20000, 0xfc0113db, 6 | BRF_GRA }, // 21 Sprites + { "sf-16.bin", 0x20000, 0x82e4a6d3, 6 | BRF_GRA }, // 22 + { "sf-11.bin", 0x20000, 0xe112df1b, 6 | BRF_GRA }, // 23 + { "sf-12.bin", 0x20000, 0x42d52299, 6 | BRF_GRA }, // 24 + { "sf-07.bin", 0x20000, 0x49f340d9, 6 | BRF_GRA }, // 25 + { "sf-08.bin", 0x20000, 0x95ece9b1, 6 | BRF_GRA }, // 26 + { "sf-03.bin", 0x20000, 0x5ca05781, 6 | BRF_GRA }, // 27 + { "sf-17.bin", 0x20000, 0x69fac48e, 6 | BRF_GRA }, // 28 + { "sf-18.bin", 0x20000, 0x71cfd18d, 6 | BRF_GRA }, // 29 + { "sf-13.bin", 0x20000, 0xfa2eb24b, 6 | BRF_GRA }, // 30 + { "sf-14.bin", 0x20000, 0xad955c95, 6 | BRF_GRA }, // 31 + { "sf-09.bin", 0x20000, 0x41b73a31, 6 | BRF_GRA }, // 32 + { "sf-10.bin", 0x20000, 0x91c41c50, 6 | BRF_GRA }, // 33 + { "sf-05.bin", 0x20000, 0x538c7cbe, 6 | BRF_GRA }, // 34 + + { "sf-27.bin", 0x04000, 0x2b09b36d, 7 | BRF_GRA }, // 35 Characters + + { "sf-37.bin", 0x10000, 0x23d09d3d, 8 | BRF_GRA }, // 36 Tilemaps + { "sf-36.bin", 0x10000, 0xea16df6c, 8 | BRF_GRA }, // 37 + { "sf-32.bin", 0x10000, 0x72df2bd9, 8 | BRF_GRA }, // 38 + { "sf-33.bin", 0x10000, 0x3e99d3d5, 8 | BRF_GRA }, // 39 + + { "sfb05.bin", 0x0100, 0x864199ad, 0 | BRF_OPT }, // 40 Proms + { "sfb00.bin", 0x0100, 0xbd3f8c5d, 0 | BRF_OPT }, // 41 + { "mb7114h.12j", 0x0100, 0x4c734b64, 0 | BRF_OPT }, // 42 + { "mmi-7603.13h",0x0020, 0x06bcda53, 0 | BRF_OPT }, // 43 + + { "i8751.bin", 0x00800, 0x00000000, 0 | BRF_NODUMP }, +}; + +STD_ROM_PICK(sfua) +STD_ROM_FN(sfua) + +static INT32 SfuaInit() +{ + return DrvInit(3); +} + +struct BurnDriver BurnDrvsfua = { + "sfua", "sf", NULL, NULL, "1987", + "Street Fighter (US set 2)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_VSFIGHT, FBF_SF, + NULL, sfuaRomInfo, sfuaRomName, NULL, NULL, SfjpInputInfo, SfusDIPInfo, + SfuaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x401, 384, 224, 4, 3 +}; + + +// Street Fighter (Japan) + +static struct BurnRomInfo sfjpRomDesc[] = { + { "sf-19.bin", 0x10000, 0x116027d7, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "sf-22.bin", 0x10000, 0xd3cbd09e, 1 | BRF_PRG | BRF_ESS }, // 1 + { "sf-20.bin", 0x10000, 0xfe07e83f, 1 | BRF_PRG | BRF_ESS }, // 2 + { "sf-23.bin", 0x10000, 0x1e435d33, 1 | BRF_PRG | BRF_ESS }, // 3 + { "sf-21.bin", 0x10000, 0xe086bc4c, 1 | BRF_PRG | BRF_ESS }, // 4 + { "sf-24.bin", 0x10000, 0x13a6696b, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "sf-02.bin", 0x08000, 0x4a9ac534, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 #0 Code + + { "sf-00.bin", 0x20000, 0x4b733845, 3 | BRF_PRG | BRF_ESS }, // 7 Z80 #1 Code + { "sf-01.bin", 0x20000, 0x86e0f0d5, 3 | BRF_PRG | BRF_ESS }, // 8 + + { "sf-39.bin", 0x20000, 0xcee3d292, 4 | BRF_GRA }, // 9 Background Tiles + { "sf-38.bin", 0x20000, 0x2ea99676, 4 | BRF_GRA }, // 10 + { "sf-41.bin", 0x20000, 0xe0280495, 4 | BRF_GRA }, // 11 + { "sf-40.bin", 0x20000, 0xc70b30de, 4 | BRF_GRA }, // 12 + + { "sf-25.bin", 0x20000, 0x7f23042e, 5 | BRF_GRA }, // 13 Foreground Tiles + { "sf-28.bin", 0x20000, 0x92f8b91c, 5 | BRF_GRA }, // 14 + { "sf-30.bin", 0x20000, 0xb1399856, 5 | BRF_GRA }, // 15 + { "sf-34.bin", 0x20000, 0x96b6ae2e, 5 | BRF_GRA }, // 16 + { "sf-26.bin", 0x20000, 0x54ede9f5, 5 | BRF_GRA }, // 17 + { "sf-29.bin", 0x20000, 0xf0649a67, 5 | BRF_GRA }, // 18 + { "sf-31.bin", 0x20000, 0x8f4dd71a, 5 | BRF_GRA }, // 19 + { "sf-35.bin", 0x20000, 0x70c00fb4, 5 | BRF_GRA }, // 20 + + { "sf-15.bin", 0x20000, 0xfc0113db, 6 | BRF_GRA }, // 21 Sprites + { "sf-16.bin", 0x20000, 0x82e4a6d3, 6 | BRF_GRA }, // 22 + { "sf-11.bin", 0x20000, 0xe112df1b, 6 | BRF_GRA }, // 23 + { "sf-12.bin", 0x20000, 0x42d52299, 6 | BRF_GRA }, // 24 + { "sf-07.bin", 0x20000, 0x49f340d9, 6 | BRF_GRA }, // 25 + { "sf-08.bin", 0x20000, 0x95ece9b1, 6 | BRF_GRA }, // 26 + { "sf-03.bin", 0x20000, 0x5ca05781, 6 | BRF_GRA }, // 27 + { "sf-17.bin", 0x20000, 0x69fac48e, 6 | BRF_GRA }, // 28 + { "sf-18.bin", 0x20000, 0x71cfd18d, 6 | BRF_GRA }, // 29 + { "sf-13.bin", 0x20000, 0xfa2eb24b, 6 | BRF_GRA }, // 30 + { "sf-14.bin", 0x20000, 0xad955c95, 6 | BRF_GRA }, // 31 + { "sf-09.bin", 0x20000, 0x41b73a31, 6 | BRF_GRA }, // 32 + { "sf-10.bin", 0x20000, 0x91c41c50, 6 | BRF_GRA }, // 33 + { "sf-05.bin", 0x20000, 0x538c7cbe, 6 | BRF_GRA }, // 34 + + { "sf-27.bin", 0x04000, 0x2b09b36d, 7 | BRF_GRA }, // 35 Characters + + { "sf-37.bin", 0x10000, 0x23d09d3d, 8 | BRF_GRA }, // 36 Tilemaps + { "sf-36.bin", 0x10000, 0xea16df6c, 8 | BRF_GRA }, // 37 + { "sf-32.bin", 0x10000, 0x72df2bd9, 8 | BRF_GRA }, // 38 + { "sf-33.bin", 0x10000, 0x3e99d3d5, 8 | BRF_GRA }, // 39 + + { "sfb05.bin", 0x0100, 0x864199ad, 0 | BRF_OPT }, // 40 Proms + { "sfb00.bin", 0x0100, 0xbd3f8c5d, 0 | BRF_OPT }, // 41 + { "mb7114h.12j", 0x0100, 0x4c734b64, 0 | BRF_OPT }, // 42 + { "mmi-7603.13h",0x0020, 0x06bcda53, 0 | BRF_OPT }, // 43 + + { "68705.bin", 0x00800, 0x00000000, 0 | BRF_NODUMP }, +}; + +STD_ROM_PICK(sfjp) +STD_ROM_FN(sfjp) + +static INT32 SfjpInit() +{ + return DrvInit(3); +} + +struct BurnDriver BurnDrvsfjp = { + "sfj", "sf", NULL, NULL, "1987", + "Street Fighter (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_VSFIGHT, FBF_SF, + NULL, sfjpRomInfo, sfjpRomName, NULL, NULL, SfjpInputInfo, SfusDIPInfo, + SfjpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x401, 384, 224, 4, 3 +}; + + +// Street Fighter (Prototype) + +static struct BurnRomInfo sfpRomDesc[] = { + { "prg8.2a", 0x20000, 0xd48d06a3, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "prg0.2c", 0x20000, 0xe8606c1a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "sound.9j", 0x08000, 0x43cd32ae, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #0 Code + + { "voice.1g", 0x10000, 0x3f23c180, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "bkchr.2k", 0x20000, 0xe4d47aca, 4 | BRF_GRA }, // 4 Background Tiles + { "bkchr.1k", 0x20000, 0x5a1cbc1b, 4 | BRF_GRA }, // 5 + { "bkchr.4k", 0x20000, 0xc351bd48, 4 | BRF_GRA }, // 6 + { "bkchr.3k", 0x20000, 0x6bb2b050, 4 | BRF_GRA }, // 7 + + { "mchr.1d", 0x20000, 0xab06a60b, 5 | BRF_GRA }, // 8 Foreground Tiles + { "mchr.1e", 0x20000, 0xd221387d, 5 | BRF_GRA }, // 9 + { "mchr.1g", 0x20000, 0x1e4c1712, 5 | BRF_GRA }, // 10 + { "mchr.1h", 0x20000, 0xa381f529, 5 | BRF_GRA }, // 11 + { "mchr.2d", 0x20000, 0xe52303c4, 5 | BRF_GRA }, // 12 + { "mchr.2e", 0x20000, 0x23b9a6a1, 5 | BRF_GRA }, // 13 + { "mchr.2g", 0x20000, 0x1283ac09, 5 | BRF_GRA }, // 14 + { "mchr.2h", 0x20000, 0xcc6bf05c, 5 | BRF_GRA }, // 15 + + { "b1m.bin", 0x10000, 0x64758232, 6 | BRF_GRA }, // 16 Sprites + { "b2m.bin", 0x10000, 0xd958f5ad, 6 | BRF_GRA }, // 17 + { "b1k.bin", 0x10000, 0xe766f5fe, 6 | BRF_GRA }, // 18 + { "b2k.bin", 0x10000, 0xe71572d3, 6 | BRF_GRA }, // 19 + { "b1h.bin", 0x10000, 0x8494f38c, 6 | BRF_GRA }, // 20 + { "b2h.bin", 0x10000, 0x1fc5f049, 6 | BRF_GRA }, // 21 + { "b3m.bin", 0x10000, 0xd136802e, 6 | BRF_GRA }, // 22 + { "b4m.bin", 0x10000, 0xb4fa85d3, 6 | BRF_GRA }, // 23 + { "b3k.bin", 0x10000, 0x40e11cc8, 6 | BRF_GRA }, // 24 + { "b4k.bin", 0x10000, 0x5ca9716e, 6 | BRF_GRA }, // 25 + { "b3h.bin", 0x10000, 0x8c3d9173, 6 | BRF_GRA }, // 26 + { "b4h.bin", 0x10000, 0xa2df66f8, 6 | BRF_GRA }, // 27 + + { "vram.4d", 0x04000, 0xbfadfb32, 7 | BRF_GRA }, // 28 Characters + + { "bks1j10.5h", 0x10000, 0x4934aacd, 8 | BRF_GRA }, // 29 Tilemaps + { "bks1j18.3h", 0x10000, 0x551ffc88, 8 | BRF_GRA }, // 30 + { "ms1j10.3g", 0x10000, 0xf92958b8, 8 | BRF_GRA }, // 31 + { "ms1j18.5g", 0x10000, 0x89e35dc1, 8 | BRF_GRA }, // 32 + + { "sfb05.bin", 0x0100, 0x864199ad, 0 | BRF_OPT }, // 33 Proms + { "sfb00.bin", 0x0100, 0xbd3f8c5d, 0 | BRF_OPT }, // 34 + { "mb7114h.12j", 0x0100, 0x4c734b64, 0 | BRF_OPT }, // 35 + { "mmi-7603.13h", 0x0020, 0x06bcda53, 0 | BRF_OPT }, // 36 +}; + +STD_ROM_PICK(sfp) +STD_ROM_FN(sfp) + +static INT32 SfpInit() +{ + return DrvInit(4); +} + +struct BurnDriver BurnDrvsfp = { + "sfp", "sf", NULL, NULL, "1987", + "Street Fighter (Prototype)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_PROTOTYPE, 2, HARWARE_CAPCOM_MISC, GBF_VSFIGHT, FBF_SF, + NULL, sfpRomInfo, sfpRomName, NULL, NULL, SfInputInfo, SfDIPInfo, + SfpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x401, 384, 224, 4, 3 +}; + diff --git a/src/burn/drv/pre90s/d_skyfox.cpp b/src/burn/drv/pre90s/d_skyfox.cpp index 9441324c3..dcefc37d8 100644 --- a/src/burn/drv/pre90s/d_skyfox.cpp +++ b/src/burn/drv/pre90s/d_skyfox.cpp @@ -1,628 +1,626 @@ -// FB Alpha Skyfox Driver Module -// Based on MAME driver by Luca Elia - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2203.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvColPROM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvVidRegs; -static UINT32 *DrvPalette; -static UINT32 *Palette; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[1]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[1]; -static UINT8 DrvReset; - -static UINT8 *soundlatch; -static UINT8 *DrvBgCtrl; -static INT32 *DrvBgPos; - -static INT32 vblank; - -static struct BurnInputInfo SkyfoxInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 6, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Skyfox) - -static struct BurnDIPInfo SkyfoxDIPList[]= -{ - {0x09, 0xff, 0xff, 0x6f, NULL }, - {0x0a, 0xff, 0xff, 0xf0, NULL }, - {0x0b, 0xff, 0xff, 0xfa, NULL }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x09, 0x01, 0x18, 0x00, "20K" }, - {0x09, 0x01, 0x18, 0x08, "30K" }, - {0x09, 0x01, 0x18, 0x10, "40K" }, - {0x09, 0x01, 0x18, 0x18, "50K" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x09, 0x01, 0x20, 0x20, "Medium" }, - {0x09, 0x01, 0x20, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x09, 0x01, 0x40, 0x40, "Off" }, - {0x09, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x09, 0x01, 0x80, 0x00, "Upright" }, - {0x09, 0x01, 0x80, 0x80, "Cocktail" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x0a, 0x01, 0x0e, 0x0e, "5 Coins 1 Credits" }, - {0x0a, 0x01, 0x0e, 0x0a, "4 Coins 1 Credits" }, - {0x0a, 0x01, 0x0e, 0x06, "3 Coins 1 Credits" }, - {0x0a, 0x01, 0x0e, 0x02, "2 Coins 1 Credits" }, - {0x0a, 0x01, 0x0e, 0x00, "1 Coin 1 Credits" }, - {0x0a, 0x01, 0x0e, 0x04, "1 Coin 2 Credits" }, - {0x0a, 0x01, 0x0e, 0x08, "1 Coin 3 Credits" }, - {0x0a, 0x01, 0x0e, 0x0c, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 6, "Lives" }, - {0x0b, 0x01, 0x07, 0x00, "1" }, - {0x0b, 0x01, 0x07, 0x01, "2" }, - {0x0b, 0x01, 0x07, 0x02, "3" }, - {0x0b, 0x01, 0x07, 0x03, "4" }, - {0x0b, 0x01, 0x07, 0x04, "5" }, - {0x0b, 0x01, 0x07, 0x07, "Infinite (Cheat)" }, -}; - -STDDIPINFO(Skyfox) - -void __fastcall skyfox_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe008: - case 0xe009: - case 0xe00a: - case 0xe00b: - case 0xe00c: - case 0xe00d: - case 0xe00e: - case 0xe00f: - DrvVidRegs[address & 7] = data; - return; - } -} - -UINT8 __fastcall skyfox_read(UINT16 address) -{ - switch (address) - { - case 0xe000: - return DrvInputs[0]; - - case 0xe001: - return DrvDips[0]; - - case 0xe002: - return DrvDips[1] | vblank; - - case 0xf001: - return DrvDips[2]; - } - - return 0; -} - -void __fastcall skyfox_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xa000: - case 0xa001: - BurnYM2203Write(0, address & 1, data); - return; - - case 0xc000: - case 0xc001: - BurnYM2203Write(1, address & 1, data); - return; - } -} - -UINT8 __fastcall skyfox_sound_read(UINT16 address) -{ - switch (address) - { - case 0xa001: - return BurnYM2203Read(0, 0); - - case 0xb000: - return *soundlatch; - } - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x010000; - DrvZ80ROM1 = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x060000; - DrvGfxROM1 = Next; Next += 0x008000; - - DrvColPROM = Next; Next += 0x000300; - - DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); - Palette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x001000; - DrvZ80RAM1 = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x001000; - - DrvVidRegs = Next; - DrvBgCtrl = Next; - soundlatch = Next + 1; Next += 0x000008; - - DrvBgPos = (INT32*)Next; Next += 0x00001 * sizeof(INT32); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void DrvGfxDecode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x60000); - - for (INT32 i = 0; i < 0x60000; i++) { - tmp[i] = DrvGfxROM0[(i&~0x3ff) | (i&7) | (((i>>3)&7)<<5) | (((i>>6)&3)<<3) | (i&0x300)]; - } - - memcpy (DrvGfxROM0, tmp, 0x60000); - - BurnFree (tmp); -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0; i < 256; i++) - { - INT32 bit0,bit1,bit2,bit3,r,g,b; - - bit0 = (DrvColPROM[i] >> 0) & 0x01; - bit1 = (DrvColPROM[i] >> 1) & 0x01; - bit2 = (DrvColPROM[i] >> 2) & 0x01; - bit3 = (DrvColPROM[i] >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvColPROM[i + 256] >> 0) & 0x01; - bit1 = (DrvColPROM[i + 256] >> 1) & 0x01; - bit2 = (DrvColPROM[i + 256] >> 2) & 0x01; - bit3 = (DrvColPROM[i + 256] >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvColPROM[i + 2*256] >> 0) & 0x01; - bit1 = (DrvColPROM[i + 2*256] >> 1) & 0x01; - bit2 = (DrvColPROM[i + 2*256] >> 2) & 0x01; - bit3 = (DrvColPROM[i + 2*256] >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - Palette[i] = (r << 16) | (g << 8) | b; - } - - for (INT32 i = 0; i < 256; i++) - { - Palette[i | 0x100] = (i << 16) | (i << 8) | i; - } -} - -static INT32 DrvDoReset() -{ - memset(AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - - return 0; -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 1748000; -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 1748000.0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x08000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x10000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x20000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x30000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x40000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x50000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 9, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00000, 10, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00100, 11, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00200, 12, 1)) return 1; - - DrvPaletteInit(); - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0xbfff, 1, DrvZ80ROM0); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); - ZetMapArea(0xc000, 0xcfff, 0, DrvZ80RAM0); - ZetMapArea(0xc000, 0xcfff, 1, DrvZ80RAM0); - ZetMapArea(0xc000, 0xcfff, 2, DrvZ80RAM0); - ZetMapArea(0xd000, 0xdfff, 0, DrvSprRAM); - ZetMapArea(0xd000, 0xdfff, 1, DrvSprRAM); - ZetMapArea(0xd000, 0xdfff, 2, DrvSprRAM); - ZetSetWriteHandler(skyfox_write); - ZetSetReadHandler(skyfox_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); - ZetSetWriteHandler(skyfox_sound_write); - ZetSetReadHandler(skyfox_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 1748000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(1748000); - BurnYM2203SetAllRoutes(0, 0.80, BURN_SND_ROUTE_BOTH); - BurnYM2203SetAllRoutes(1, 0.80, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - BurnYM2203Exit(); - GenericTilesExit(); - ZetExit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_sprites() -{ - INT32 shift = (*DrvBgCtrl & 0x80) ? (4-1) : 4; - - for (INT32 offs = 0; offs < 0x400; offs += 4) - { - INT32 xstart, ystart, xend, yend; - INT32 xinc, yinc, dx, dy; - INT32 low_code, n; - - INT32 y = DrvSprRAM[offs + 0]; - INT32 x = DrvSprRAM[offs + 1]; - INT32 code = DrvSprRAM[offs + 2] | (DrvSprRAM[offs+3] << 8); - INT32 flipx = code & 0x02; - INT32 flipy = code & 0x04; - - x = (x << 1) | (code & 1); - - INT32 high_code = ((code >> 4) & 0x7f0) + ((code & 0x8000) >> shift); - - switch (code & 0x88) - { - case 0x88: n = 4; low_code = 0; break; - case 0x08: n = 2; low_code = ((code & 0x20) >> 2) + ((code & 0x10) >> 3); break; - default: n = 1; low_code = (code >> 4) & 0x0f; break; - } - - if (*DrvBgCtrl & 1) - { - x = ((nScreenWidth-1) - x - ((n - 1) << 3)) + 88; - y = ((nScreenHeight-1) - y - ((n - 1) << 3)) + 8; - flipx = !flipx; - flipy = !flipy; - } else { - x -= 0x60; - y -= 0x10; - } - - if (flipx) { xstart = n-1; xend = -1; xinc = -1; } - else { xstart = 0; xend = n; xinc = +1; } - - if (flipy) { ystart = n-1; yend = -1; yinc = -1; } - else { ystart = 0; yend = n; yinc = +1; } - - code = low_code + high_code; - - for (dy = ystart; dy != yend; dy += yinc) - { - INT32 sy = y + (dy << 3); - - for (dx = xstart; dx != xend; dx += xinc) - { - INT32 sx = x + (dx << 3); - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code++, sx, sy, 0, 8, 0xff, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code++, sx, sy, 0, 8, 0xff, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code++,sx, sy, 0, 8, 0xff, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code++, sx, sy, 0, 8, 0xff, 0, DrvGfxROM0); - } - } - } - - code += n & 2; - } - } -} - -static void draw_background() -{ - INT32 pos = (*DrvBgPos >> 4) & 0x3ff; - - for (INT32 i = 0; i < 0x1000; i++) - { - INT32 offs = ((*DrvBgCtrl << 9) & 0x6000) + (i << 1); - INT32 attr = DrvGfxROM1[offs]; - INT32 x = (DrvGfxROM1[offs + 1] << 1) + (i & 1) + pos + ((i & 8) << 6); - INT32 y = ((i >> 4) << 3) | (i & 7); - INT32 pen = (attr & 0x7f) | 0x100; - - if (*DrvBgCtrl & 1) - { - x = 0x400 - (x & 0x3ff); - y = 0x100 - (y & 0x0ff); - } - - for (INT32 j = 0; j <= ((attr & 0x80) ? 0 : 3); j++) - { - INT32 sx = ((((j >> 0) & 1) + x) & 0x1ff) - 0x60; - INT32 sy = ((((j >> 1) & 1) + y) & 0x0ff) - 0x10; - - if (sx < 0 || sy < 0 || sx >= nScreenWidth || sy >= nScreenHeight) continue; - - pTransDraw[sy * nScreenWidth + sx] = pen; - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x200; i++) { - INT32 p = Palette[i]; - DrvPalette[i] = BurnHighCol(p >> 16, p >> 8, p, 0); - } - } - - for (INT32 offs = 0; offs < nScreenWidth * nScreenHeight; offs++) { - pTransDraw[offs] = 0x00ff; - } - - draw_background(); - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - *DrvBgPos += (*DrvBgCtrl >> 1) & 7; - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = 0xff; - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - } - } - - ZetNewFrame(); - vblank = 0; - - INT32 nCycleSegment; - INT32 nInterleave = 256; - INT32 nCyclesTotal[2] = { 4000000 / 60, 1748000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - if (i == 8 || i == 248) vblank ^= 1; - - nCycleSegment = nCyclesTotal[0] / nInterleave; - - ZetOpen(0); - nCyclesDone[0] += ZetRun(nCycleSegment); - if (i == (nInterleave-1) && DrvJoy2[0]) ZetNmi(); - ZetClose(); - - nCycleSegment = nCyclesTotal[1] / nInterleave; - - ZetOpen(1); - //nCyclesDone[1] += ZetRun(nCycleSegment); - BurnTimerUpdate(i * nCycleSegment); - ZetClose(); - } - - ZetOpen(1); - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - if (nAction & ACB_VOLATILE) { - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All RAM"; - BurnAcb(&ba); - - ZetScan(nAction); - BurnYM2203Scan(nAction, pnMin); - } - - return 0; -} - - -// Sky Fox - -static struct BurnRomInfo skyfoxRomDesc[] = { - { "skyfox1.bin", 0x08000, 0xb4d4bb6f, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "skyfox2.bin", 0x08000, 0xe15e0263, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "skyfox9.bin", 0x08000, 0x0b283bf5, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "skyfox3.bin", 0x10000, 0x3a17a929, 3 | BRF_GRA }, // 3 Sprites - { "skyfox4.bin", 0x10000, 0x358053bb, 3 | BRF_GRA }, // 4 - { "skyfox5.bin", 0x10000, 0xc1215a6e, 3 | BRF_GRA }, // 5 - { "skyfox6.bin", 0x10000, 0xcc37e15d, 3 | BRF_GRA }, // 6 - { "skyfox7.bin", 0x10000, 0xfa2ab5b4, 3 | BRF_GRA }, // 7 - { "skyfox8.bin", 0x10000, 0x0e3edc49, 3 | BRF_GRA }, // 8 - - { "skyfox10.bin", 0x08000, 0x19f58f9c, 4 | BRF_GRA }, // 9 Starfield - - { "sfoxrprm.bin", 0x00100, 0x79913c7f, 5 | BRF_GRA }, // 10 Color Proms - { "sfoxgprm.bin", 0x00100, 0xfb73d434, 5 | BRF_GRA }, // 11 - { "sfoxbprm.bin", 0x00100, 0x60d2ab41, 5 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(skyfox) -STD_ROM_FN(skyfox) - -struct BurnDriver BurnDrvSkyfox = { - "skyfox", NULL, NULL, NULL, "1987", - "Sky Fox\0", NULL, "Jaleco (Nichibutsu USA license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 1, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, skyfoxRomInfo, skyfoxRomName, NULL, NULL, SkyfoxInputInfo, SkyfoxDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 320, 3, 4 -}; - - -// Exerizer (Japan) (bootleg) - -static struct BurnRomInfo exerizrbRomDesc[] = { - { "1-a", 0x08000, 0x5df72a5d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "skyfox2.bin", 0x08000, 0xe15e0263, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "skyfox9.bin", 0x08000, 0x0b283bf5, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "1-c", 0x10000, 0x450e9381, 3 | BRF_GRA }, // 3 Sprites - { "skyfox4.bin", 0x10000, 0x358053bb, 3 | BRF_GRA }, // 4 - { "1-e", 0x10000, 0x50a38c60, 3 | BRF_GRA }, // 5 - { "skyfox6.bin", 0x10000, 0xcc37e15d, 3 | BRF_GRA }, // 6 - { "1-g", 0x10000, 0xc9bbfe5c, 3 | BRF_GRA }, // 7 - { "skyfox8.bin", 0x10000, 0x0e3edc49, 3 | BRF_GRA }, // 8 - - { "skyfox10.bin", 0x08000, 0x19f58f9c, 4 | BRF_GRA }, // 9 Starfield - - { "sfoxrprm.bin", 0x00100, 0x79913c7f, 5 | BRF_GRA }, // 10 Color Proms - { "sfoxgprm.bin", 0x00100, 0xfb73d434, 5 | BRF_GRA }, // 11 - { "sfoxbprm.bin", 0x00100, 0x60d2ab41, 5 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(exerizrb) -STD_ROM_FN(exerizrb) - -struct BurnDriver BurnDrvExerizrb = { - "exerizerb", "skyfox", NULL, NULL, "1987", - "Exerizer (Japan) (bootleg)\0", NULL, "Jaleco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 1, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, exerizrbRomInfo, exerizrbRomName, NULL, NULL, SkyfoxInputInfo, SkyfoxDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 224, 320, 3, 4 -}; +// FB Alpha Skyfox Driver Module +// Based on MAME driver by Luca Elia + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2203.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvColPROM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvVidRegs; +static UINT32 *DrvPalette; +static UINT32 *Palette; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[1]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[1]; +static UINT8 DrvReset; + +static UINT8 *soundlatch; +static UINT8 *DrvBgCtrl; +static INT32 *DrvBgPos; + +static INT32 vblank; + +static struct BurnInputInfo SkyfoxInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 6, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Skyfox) + +static struct BurnDIPInfo SkyfoxDIPList[]= +{ + {0x09, 0xff, 0xff, 0x6f, NULL }, + {0x0a, 0xff, 0xff, 0xf0, NULL }, + {0x0b, 0xff, 0xff, 0xfa, NULL }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x09, 0x01, 0x18, 0x00, "20K" }, + {0x09, 0x01, 0x18, 0x08, "30K" }, + {0x09, 0x01, 0x18, 0x10, "40K" }, + {0x09, 0x01, 0x18, 0x18, "50K" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x09, 0x01, 0x20, 0x20, "Medium" }, + {0x09, 0x01, 0x20, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x09, 0x01, 0x40, 0x40, "Off" }, + {0x09, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x09, 0x01, 0x80, 0x00, "Upright" }, + {0x09, 0x01, 0x80, 0x80, "Cocktail" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x0a, 0x01, 0x0e, 0x0e, "5 Coins 1 Credits" }, + {0x0a, 0x01, 0x0e, 0x0a, "4 Coins 1 Credits" }, + {0x0a, 0x01, 0x0e, 0x06, "3 Coins 1 Credits" }, + {0x0a, 0x01, 0x0e, 0x02, "2 Coins 1 Credits" }, + {0x0a, 0x01, 0x0e, 0x00, "1 Coin 1 Credits" }, + {0x0a, 0x01, 0x0e, 0x04, "1 Coin 2 Credits" }, + {0x0a, 0x01, 0x0e, 0x08, "1 Coin 3 Credits" }, + {0x0a, 0x01, 0x0e, 0x0c, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 6, "Lives" }, + {0x0b, 0x01, 0x07, 0x00, "1" }, + {0x0b, 0x01, 0x07, 0x01, "2" }, + {0x0b, 0x01, 0x07, 0x02, "3" }, + {0x0b, 0x01, 0x07, 0x03, "4" }, + {0x0b, 0x01, 0x07, 0x04, "5" }, + {0x0b, 0x01, 0x07, 0x07, "Infinite (Cheat)" }, +}; + +STDDIPINFO(Skyfox) + +void __fastcall skyfox_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe008: + case 0xe009: + case 0xe00a: + case 0xe00b: + case 0xe00c: + case 0xe00d: + case 0xe00e: + case 0xe00f: + DrvVidRegs[address & 7] = data; + return; + } +} + +UINT8 __fastcall skyfox_read(UINT16 address) +{ + switch (address) + { + case 0xe000: + return DrvInputs[0]; + + case 0xe001: + return DrvDips[0]; + + case 0xe002: + return DrvDips[1] | vblank; + + case 0xf001: + return DrvDips[2]; + } + + return 0; +} + +void __fastcall skyfox_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xa000: + case 0xa001: + BurnYM2203Write(0, address & 1, data); + return; + + case 0xc000: + case 0xc001: + BurnYM2203Write(1, address & 1, data); + return; + } +} + +UINT8 __fastcall skyfox_sound_read(UINT16 address) +{ + switch (address) + { + case 0xa001: + return BurnYM2203Read(0, 0); + + case 0xb000: + return *soundlatch; + } + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x010000; + DrvZ80ROM1 = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x060000; + DrvGfxROM1 = Next; Next += 0x008000; + + DrvColPROM = Next; Next += 0x000300; + + DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); + Palette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x001000; + DrvZ80RAM1 = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x001000; + + DrvVidRegs = Next; + DrvBgCtrl = Next; + soundlatch = Next + 1; Next += 0x000008; + + DrvBgPos = (INT32*)Next; Next += 0x00001 * sizeof(INT32); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void DrvGfxDecode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x60000); + + for (INT32 i = 0; i < 0x60000; i++) { + tmp[i] = DrvGfxROM0[(i&~0x3ff) | (i&7) | (((i>>3)&7)<<5) | (((i>>6)&3)<<3) | (i&0x300)]; + } + + memcpy (DrvGfxROM0, tmp, 0x60000); + + BurnFree (tmp); +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0; i < 256; i++) + { + INT32 bit0,bit1,bit2,bit3,r,g,b; + + bit0 = (DrvColPROM[i] >> 0) & 0x01; + bit1 = (DrvColPROM[i] >> 1) & 0x01; + bit2 = (DrvColPROM[i] >> 2) & 0x01; + bit3 = (DrvColPROM[i] >> 3) & 0x01; + r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvColPROM[i + 256] >> 0) & 0x01; + bit1 = (DrvColPROM[i + 256] >> 1) & 0x01; + bit2 = (DrvColPROM[i + 256] >> 2) & 0x01; + bit3 = (DrvColPROM[i + 256] >> 3) & 0x01; + g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvColPROM[i + 2*256] >> 0) & 0x01; + bit1 = (DrvColPROM[i + 2*256] >> 1) & 0x01; + bit2 = (DrvColPROM[i + 2*256] >> 2) & 0x01; + bit3 = (DrvColPROM[i + 2*256] >> 3) & 0x01; + b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + Palette[i] = (r << 16) | (g << 8) | b; + } + + for (INT32 i = 0; i < 256; i++) + { + Palette[i | 0x100] = (i << 16) | (i << 8) | i; + } +} + +static INT32 DrvDoReset() +{ + memset(AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + + return 0; +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 1748000; +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 1748000.0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x08000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x10000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x20000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x30000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x40000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x50000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 9, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00000, 10, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00100, 11, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00200, 12, 1)) return 1; + + DrvPaletteInit(); + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0xbfff, 1, DrvZ80ROM0); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); + ZetMapArea(0xc000, 0xcfff, 0, DrvZ80RAM0); + ZetMapArea(0xc000, 0xcfff, 1, DrvZ80RAM0); + ZetMapArea(0xc000, 0xcfff, 2, DrvZ80RAM0); + ZetMapArea(0xd000, 0xdfff, 0, DrvSprRAM); + ZetMapArea(0xd000, 0xdfff, 1, DrvSprRAM); + ZetMapArea(0xd000, 0xdfff, 2, DrvSprRAM); + ZetSetWriteHandler(skyfox_write); + ZetSetReadHandler(skyfox_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); + ZetSetWriteHandler(skyfox_sound_write); + ZetSetReadHandler(skyfox_sound_read); + ZetClose(); + + BurnYM2203Init(2, 1748000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(1748000); + BurnYM2203SetAllRoutes(0, 0.80, BURN_SND_ROUTE_BOTH); + BurnYM2203SetAllRoutes(1, 0.80, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + BurnYM2203Exit(); + GenericTilesExit(); + ZetExit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_sprites() +{ + INT32 shift = (*DrvBgCtrl & 0x80) ? (4-1) : 4; + + for (INT32 offs = 0; offs < 0x400; offs += 4) + { + INT32 xstart, ystart, xend, yend; + INT32 xinc, yinc, dx, dy; + INT32 low_code, n; + + INT32 y = DrvSprRAM[offs + 0]; + INT32 x = DrvSprRAM[offs + 1]; + INT32 code = DrvSprRAM[offs + 2] | (DrvSprRAM[offs+3] << 8); + INT32 flipx = code & 0x02; + INT32 flipy = code & 0x04; + + x = (x << 1) | (code & 1); + + INT32 high_code = ((code >> 4) & 0x7f0) + ((code & 0x8000) >> shift); + + switch (code & 0x88) + { + case 0x88: n = 4; low_code = 0; break; + case 0x08: n = 2; low_code = ((code & 0x20) >> 2) + ((code & 0x10) >> 3); break; + default: n = 1; low_code = (code >> 4) & 0x0f; break; + } + + if (*DrvBgCtrl & 1) + { + x = ((nScreenWidth-1) - x - ((n - 1) << 3)) + 88; + y = ((nScreenHeight-1) - y - ((n - 1) << 3)) + 8; + flipx = !flipx; + flipy = !flipy; + } else { + x -= 0x60; + y -= 0x10; + } + + if (flipx) { xstart = n-1; xend = -1; xinc = -1; } + else { xstart = 0; xend = n; xinc = +1; } + + if (flipy) { ystart = n-1; yend = -1; yinc = -1; } + else { ystart = 0; yend = n; yinc = +1; } + + code = low_code + high_code; + + for (dy = ystart; dy != yend; dy += yinc) + { + INT32 sy = y + (dy << 3); + + for (dx = xstart; dx != xend; dx += xinc) + { + INT32 sx = x + (dx << 3); + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code++, sx, sy, 0, 8, 0xff, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code++, sx, sy, 0, 8, 0xff, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code++,sx, sy, 0, 8, 0xff, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code++, sx, sy, 0, 8, 0xff, 0, DrvGfxROM0); + } + } + } + + code += n & 2; + } + } +} + +static void draw_background() +{ + INT32 pos = (*DrvBgPos >> 4) & 0x3ff; + + for (INT32 i = 0; i < 0x1000; i++) + { + INT32 offs = ((*DrvBgCtrl << 9) & 0x6000) + (i << 1); + INT32 attr = DrvGfxROM1[offs]; + INT32 x = (DrvGfxROM1[offs + 1] << 1) + (i & 1) + pos + ((i & 8) << 6); + INT32 y = ((i >> 4) << 3) | (i & 7); + INT32 pen = (attr & 0x7f) | 0x100; + + if (*DrvBgCtrl & 1) + { + x = 0x400 - (x & 0x3ff); + y = 0x100 - (y & 0x0ff); + } + + for (INT32 j = 0; j <= ((attr & 0x80) ? 0 : 3); j++) + { + INT32 sx = ((((j >> 0) & 1) + x) & 0x1ff) - 0x60; + INT32 sy = ((((j >> 1) & 1) + y) & 0x0ff) - 0x10; + + if (sx < 0 || sy < 0 || sx >= nScreenWidth || sy >= nScreenHeight) continue; + + pTransDraw[sy * nScreenWidth + sx] = pen; + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x200; i++) { + INT32 p = Palette[i]; + DrvPalette[i] = BurnHighCol(p >> 16, p >> 8, p, 0); + } + } + + for (INT32 offs = 0; offs < nScreenWidth * nScreenHeight; offs++) { + pTransDraw[offs] = 0x00ff; + } + + draw_background(); + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + *DrvBgPos += (*DrvBgCtrl >> 1) & 7; + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = 0xff; + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + } + } + + ZetNewFrame(); + vblank = 0; + + INT32 nCycleSegment; + INT32 nInterleave = 256; + INT32 nCyclesTotal[2] = { 4000000 / 60, 1748000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + if (i == 8 || i == 248) vblank ^= 1; + + nCycleSegment = nCyclesTotal[0] / nInterleave; + + ZetOpen(0); + nCyclesDone[0] += ZetRun(nCycleSegment); + if (i == (nInterleave-1) && DrvJoy2[0]) ZetNmi(); + ZetClose(); + + nCycleSegment = nCyclesTotal[1] / nInterleave; + + ZetOpen(1); + //nCyclesDone[1] += ZetRun(nCycleSegment); + BurnTimerUpdate(i * nCycleSegment); + ZetClose(); + } + + ZetOpen(1); + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + if (nAction & ACB_VOLATILE) { + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All RAM"; + BurnAcb(&ba); + + ZetScan(nAction); + BurnYM2203Scan(nAction, pnMin); + } + + return 0; +} + + +// Sky Fox + +static struct BurnRomInfo skyfoxRomDesc[] = { + { "skyfox1.bin", 0x08000, 0xb4d4bb6f, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "skyfox2.bin", 0x08000, 0xe15e0263, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "skyfox9.bin", 0x08000, 0x0b283bf5, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "skyfox3.bin", 0x10000, 0x3a17a929, 3 | BRF_GRA }, // 3 Sprites + { "skyfox4.bin", 0x10000, 0x358053bb, 3 | BRF_GRA }, // 4 + { "skyfox5.bin", 0x10000, 0xc1215a6e, 3 | BRF_GRA }, // 5 + { "skyfox6.bin", 0x10000, 0xcc37e15d, 3 | BRF_GRA }, // 6 + { "skyfox7.bin", 0x10000, 0xfa2ab5b4, 3 | BRF_GRA }, // 7 + { "skyfox8.bin", 0x10000, 0x0e3edc49, 3 | BRF_GRA }, // 8 + + { "skyfox10.bin", 0x08000, 0x19f58f9c, 4 | BRF_GRA }, // 9 Starfield + + { "sfoxrprm.bin", 0x00100, 0x79913c7f, 5 | BRF_GRA }, // 10 Color Proms + { "sfoxgprm.bin", 0x00100, 0xfb73d434, 5 | BRF_GRA }, // 11 + { "sfoxbprm.bin", 0x00100, 0x60d2ab41, 5 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(skyfox) +STD_ROM_FN(skyfox) + +struct BurnDriver BurnDrvSkyfox = { + "skyfox", NULL, NULL, NULL, "1987", + "Sky Fox\0", NULL, "Jaleco (Nichibutsu USA license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 1, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, skyfoxRomInfo, skyfoxRomName, NULL, NULL, SkyfoxInputInfo, SkyfoxDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 320, 3, 4 +}; + + +// Exerizer (Japan) (bootleg) + +static struct BurnRomInfo exerizrbRomDesc[] = { + { "1-a", 0x08000, 0x5df72a5d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "skyfox2.bin", 0x08000, 0xe15e0263, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "skyfox9.bin", 0x08000, 0x0b283bf5, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "1-c", 0x10000, 0x450e9381, 3 | BRF_GRA }, // 3 Sprites + { "skyfox4.bin", 0x10000, 0x358053bb, 3 | BRF_GRA }, // 4 + { "1-e", 0x10000, 0x50a38c60, 3 | BRF_GRA }, // 5 + { "skyfox6.bin", 0x10000, 0xcc37e15d, 3 | BRF_GRA }, // 6 + { "1-g", 0x10000, 0xc9bbfe5c, 3 | BRF_GRA }, // 7 + { "skyfox8.bin", 0x10000, 0x0e3edc49, 3 | BRF_GRA }, // 8 + + { "skyfox10.bin", 0x08000, 0x19f58f9c, 4 | BRF_GRA }, // 9 Starfield + + { "sfoxrprm.bin", 0x00100, 0x79913c7f, 5 | BRF_GRA }, // 10 Color Proms + { "sfoxgprm.bin", 0x00100, 0xfb73d434, 5 | BRF_GRA }, // 11 + { "sfoxbprm.bin", 0x00100, 0x60d2ab41, 5 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(exerizrb) +STD_ROM_FN(exerizrb) + +struct BurnDriver BurnDrvExerizrb = { + "exerizerb", "skyfox", NULL, NULL, "1987", + "Exerizer (Japan) (bootleg)\0", NULL, "Jaleco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 1, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, exerizrbRomInfo, exerizrbRomName, NULL, NULL, SkyfoxInputInfo, SkyfoxDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 224, 320, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_snk68.cpp b/src/burn/drv/pre90s/d_snk68.cpp index 8578d9f51..0a122ff95 100644 --- a/src/burn/drv/pre90s/d_snk68.cpp +++ b/src/burn/drv/pre90s/d_snk68.cpp @@ -1,1882 +1,1881 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "upd7759.h" - -// To Do: -// Analog Inputs -// Fix savestates (crash due to snd?) - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvInputs[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; -static UINT32 nAnalogAxis[2] = {0,0}; -static UINT16 DrvAxis[2]; - -static INT32 Rotary1 = 0; -static INT32 Rotary1OldVal = 0; -static INT32 Rotary2 = 0; -static INT32 Rotary2OldVal = 0; - -static UINT8 *Mem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KRom; -static UINT8 *Drv68KRomBank; -static UINT8 *DrvZ80Rom; -static UINT8 *Drv68KRam; -static UINT8 *DrvVidRam; -static UINT8 *DrvSprRam; -static UINT8 *DrvPalRam; -static UINT8 *DrvZ80Ram; -static UINT8 *DrvGfx0; -static UINT8 *DrvGfx0Trans; -static UINT8 *DrvGfx1; -static UINT8 *DrvSnd0; - -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static INT32 game_select; - -static INT32 invert_controls; -static INT32 soundlatch; -static INT32 flipscreen; -static INT32 sprite_flip; -static INT32 pow_charbase; - -#define A(a, b, c, d) { a, b, (UINT8*)(c), d } - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up", }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down", }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up", }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down", }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 3"}, - - {"Service 1", BIT_DIGITAL, DrvJoy3 + 0, "service" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo IkariInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up", }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down", }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 3"}, - - A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 z-axis"), - - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up", }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down", }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 3"}, - - A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 1, "p2 z-axis"), - - {"Service 1", BIT_DIGITAL, DrvJoy3 + 0, "service" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Ikari) - - -static struct BurnDIPInfo PowDIPList[]= -{ - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x14, 0x01, 0x03, 0x00, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x03, 0x03, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x14, 0x01, 0x0c, 0x0c, "4 Coins 1 Credit" }, - {0x14, 0x01, 0x0c, 0x04, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x0c, 0x00, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x14, 0x01, 0x10, 0x00, "2" }, - {0x14, 0x01, 0x10, 0x10, "3" }, - - {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, - {0x14, 0x01, 0x14, 0x00, "1st & 2nd only" }, - {0x14, 0x01, 0x14, 0x14, "1st & every 2nd" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x14, 0x01, 0x40, 0x00, "English" }, - {0x14, 0x01, 0x40, 0x40, "Japanese" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x80, 0x00, "Off" }, - {0x14, 0x01, 0x80, 0x80, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x01, 0x00, "Off" }, - {0x15, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x02, 0x02, "No" }, - {0x15, 0x01, 0x02, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x15, 0x01, 0x0c, 0x00, "20k 50k" }, - {0x15, 0x01, 0x0c, 0x08, "40k 100k" }, - {0x15, 0x01, 0x0c, 0x04, "60k 150k" }, - {0x15, 0x01, 0x0c, 0x0c, "None" }, - - {0 , 0xfe, 0 , 4 , "Game Mode" }, - {0x15, 0x01, 0x30, 0x00, "Demo Sounds On" }, - {0x15, 0x01, 0x30, 0x14, "Demo Sounds Off" }, - {0x15, 0x01, 0x30, 0x30, "Freeze" }, - {0x15, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0xc0, 0x80, "Easy" }, - {0x15, 0x01, 0xc0, 0x00, "Normal" }, - {0x15, 0x01, 0xc0, 0x40, "Hard" }, - {0x15, 0x01, 0xc0, 0xc0, "Hardest" }, -}; - -STDDIPINFO(Pow) - - -static struct BurnDIPInfo PowjDIPList[]= -{ - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x14, 0x01, 0x03, 0x00, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x03, 0x03, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x14, 0x01, 0x0c, 0x0c, "4 Coins 1 Credit" }, - {0x14, 0x01, 0x0c, 0x04, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x0c, 0x00, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x14, 0x01, 0x10, 0x00, "2" }, - {0x14, 0x01, 0x10, 0x10, "3" }, - - {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, - {0x14, 0x01, 0x14, 0x00, "1st & 2nd only" }, - {0x14, 0x01, 0x14, 0x14, "1st & every 2nd" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x80, 0x00, "Off" }, - {0x14, 0x01, 0x80, 0x80, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x01, 0x00, "Off" }, - {0x15, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x02, 0x02, "No" }, - {0x15, 0x01, 0x02, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x15, 0x01, 0x0c, 0x00, "20k 50k" }, - {0x15, 0x01, 0x0c, 0x08, "40k 100k" }, - {0x15, 0x01, 0x0c, 0x04, "60k 150k" }, - {0x15, 0x01, 0x0c, 0x0c, "None" }, - - {0 , 0xfe, 0 , 4 , "Game Mode" }, - {0x15, 0x01, 0x30, 0x00, "Demo Sounds On" }, - {0x15, 0x01, 0x30, 0x14, "Demo Sounds Off" }, - {0x15, 0x01, 0x30, 0x30, "Freeze" }, - {0x15, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0xc0, 0x80, "Easy" }, - {0x15, 0x01, 0xc0, 0x00, "Normal" }, - {0x15, 0x01, 0xc0, 0x40, "Hard" }, - {0x15, 0x01, 0xc0, 0xc0, "Hardest" }, -}; - -STDDIPINFO(Powj) - -static struct BurnDIPInfo StreetsmDIPList[]= -{ - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x03, 0x02, "1" }, - {0x14, 0x01, 0x03, 0x00, "2" }, - {0x14, 0x01, 0x03, 0x01, "3" }, - {0x14, 0x01, 0x03, 0x03, "4" }, - - {0 , 0xfe, 0 , 4 , "Coin A & B" }, - {0x14, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x0c, 0x00, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0c, 0x0c, "Free Play" }, - - {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, - {0x14, 0x01, 0x14, 0x00, "1st & 2nd only" }, - {0x14, 0x01, 0x14, 0x14, "1st & every 2nd" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x80, 0x00, "Off" }, - {0x14, 0x01, 0x80, 0x80, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x01, 0x00, "Off" }, - {0x15, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x02, 0x02, "No" }, - {0x15, 0x01, 0x02, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x15, 0x01, 0x0c, 0x00, "200k 400k" }, - {0x15, 0x01, 0x0c, 0x08, "400k 500k" }, - {0x15, 0x01, 0x0c, 0x04, "600k 800k" }, - {0x15, 0x01, 0x0c, 0x0c, "None" }, - - {0 , 0xfe, 0 , 4 , "Game Mode" }, - {0x15, 0x01, 0x30, 0x14, "Demo Sounds Off" }, - {0x15, 0x01, 0x30, 0x00, "Demo Sounds On" }, - {0x15, 0x01, 0x30, 0x30, "Freeze" }, - {0x15, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0xc0, 0x80, "Easy" }, - {0x15, 0x01, 0xc0, 0x00, "Normal" }, - {0x15, 0x01, 0xc0, 0x40, "Hard" }, - {0x15, 0x01, 0xc0, 0xc0, "Hardest" }, -}; - -STDDIPINFO(Streetsm) - -static struct BurnDIPInfo StreetsjDIPList[]= -{ - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x03, 0x02, "1" }, - {0x14, 0x01, 0x03, 0x00, "2" }, - {0x14, 0x01, 0x03, 0x01, "3" }, - {0x14, 0x01, 0x03, 0x03, "4" }, - - {0 , 0xfe, 0 , 4 , "Coin A & B" }, - {0x14, 0x01, 0x0c, 0x0c, "A 4/1 B 1/4" }, - {0x14, 0x01, 0x0c, 0x04, "A 3/1 B 1/3" }, - {0x14, 0x01, 0x0c, 0x08, "A 2/1 B 1/2" }, - {0x14, 0x01, 0x0c, 0x00, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, - {0x14, 0x01, 0x14, 0x00, "1st & 2nd only" }, - {0x14, 0x01, 0x14, 0x14, "1st & every 2nd" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x80, 0x00, "Off" }, - {0x14, 0x01, 0x80, 0x80, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x01, 0x00, "Off" }, - {0x15, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x02, 0x02, "No" }, - {0x15, 0x01, 0x02, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x15, 0x01, 0x0c, 0x00, "200k 400k" }, - {0x15, 0x01, 0x0c, 0x08, "400k 500k" }, - {0x15, 0x01, 0x0c, 0x04, "600k 800k" }, - {0x15, 0x01, 0x0c, 0x0c, "None" }, - - {0 , 0xfe, 0 , 4 , "Game Mode" }, - {0x15, 0x01, 0x30, 0x14, "Demo Sounds Off" }, - {0x15, 0x01, 0x30, 0x00, "Demo Sounds On" }, - {0x15, 0x01, 0x30, 0x30, "Freeze" }, - {0x15, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0xc0, 0x80, "Easy" }, - {0x15, 0x01, 0xc0, 0x00, "Normal" }, - {0x15, 0x01, 0xc0, 0x40, "Hard" }, - {0x15, 0x01, 0xc0, 0xc0, "Hardest" }, -}; - -STDDIPINFO(Streetsj) - -static struct BurnDIPInfo SarDIPList[]= -{ - {0x16, 0xff, 0xff, 0x00, NULL }, - {0x17, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 2 , "Joystick" }, - {0x16, 0x01, 0x01, 0x00, "Rotary" }, - {0x16, 0x01, 0x01, 0x01, "Standard" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x0c, 0x08, "2" }, - {0x16, 0x01, 0x0c, 0x00, "3" }, - {0x16, 0x01, 0x0c, 0x04, "4" }, - {0x16, 0x01, 0x0c, 0x0c, "5" }, - - {0 , 0xfe, 0 , 4 , "Coin A & B" }, - {0x16, 0x01, 0x30, 0x16, "2 Coins 1 Credit" }, - {0x16, 0x01, 0x30, 0x00, "1 Coin 1 Credit" }, - {0x16, 0x01, 0x30, 0x10, "1 Coin 2 Credits" }, - {0x16, 0x01, 0x30, 0x30, "Free Play" }, - - {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, - {0x16, 0x01, 0x40, 0x00, "1st & 2nd only" }, - {0x16, 0x01, 0x40, 0x40, "1st & every 2nd" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x16, 0x01, 0x80, 0x00, "Off" }, - {0x16, 0x01, 0x80, 0x80, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x17, 0x01, 0x01, 0x00, "Off" }, - {0x17, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x17, 0x01, 0x02, 0x02, "No" }, - {0x17, 0x01, 0x02, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x17, 0x01, 0x0c, 0x00, "50k 200k" }, - {0x17, 0x01, 0x0c, 0x08, "70k 270k" }, - {0x17, 0x01, 0x0c, 0x04, "90k 350k" }, - {0x17, 0x01, 0x0c, 0x0c, "None" }, - - {0 , 0xfe, 0 , 4 , "Game Mode" }, - {0x17, 0x01, 0x30, 0x16, "Demo Sounds Off" }, - {0x17, 0x01, 0x30, 0x00, "Demo Sounds On" }, - {0x17, 0x01, 0x30, 0x30, "Freeze" }, - {0x17, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x17, 0x01, 0xc0, 0x80, "Easy" }, - {0x17, 0x01, 0xc0, 0x00, "Normal" }, - {0x17, 0x01, 0xc0, 0x40, "Hard" }, - {0x17, 0x01, 0xc0, 0xc0, "Hardest" }, -}; - -STDDIPINFO(Sar) - -static struct BurnDIPInfo IkariDIPList[]= -{ - {0x16, 0xff, 0xff, 0x00, NULL }, - {0x17, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x00, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x03, "5" }, - - {0 , 0xfe, 0 , 4 , "Coin A & B" }, - {0x16, 0x01, 0x0c, 0x08, "First 2C_1C, then 1C_1C"}, - {0x16, 0x01, 0x0c, 0x00, "1 Coin 1 Credit" }, - {0x16, 0x01, 0x0c, 0x04, "First 1C_2C, then 1C_1C"}, - {0x16, 0x01, 0x0c, 0x0c, "Free Play" }, - - {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, - {0x16, 0x01, 0x16, 0x00, "1st & 2nd only" }, - {0x16, 0x01, 0x16, 0x16, "1st & every 2nd" }, - - {0 , 0xfe, 0 , 2 , "Blood" }, - {0x16, 0x01, 0x40, 0x40, "Off" }, - {0x16, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x16, 0x01, 0x80, 0x00, "Off" }, - {0x16, 0x01, 0x80, 0x80, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x17, 0x01, 0x01, 0x00, "Off" }, - {0x17, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x17, 0x01, 0x02, 0x02, "No" }, - {0x17, 0x01, 0x02, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x17, 0x01, 0x0c, 0x00, "20k 50k" }, - {0x17, 0x01, 0x0c, 0x08, "40k 100k" }, - {0x17, 0x01, 0x0c, 0x04, "60k 150k" }, - {0x17, 0x01, 0x0c, 0x0c, "None" }, - - {0 , 0xfe, 0 , 4 , "Game Mode" }, - {0x17, 0x01, 0x30, 0x16, "Demo Sounds Off" }, - {0x17, 0x01, 0x30, 0x00, "Demo Sounds On" }, - {0x17, 0x01, 0x30, 0x30, "Freeze" }, - {0x17, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x17, 0x01, 0xc0, 0x00, "Easy" }, - {0x17, 0x01, 0xc0, 0x80, "Normal" }, - {0x17, 0x01, 0xc0, 0x40, "Hard" }, - {0x17, 0x01, 0xc0, 0xc0, "Hardest" }, -}; - -STDDIPINFO(Ikari) - - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - DrvRecalc = 1; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - UPD7759Reset(); - - soundlatch = 0; - flipscreen = 0; - sprite_flip = 0; - pow_charbase = 0; - invert_controls = 0; - - nAnalogAxis[1] = 0; - nAnalogAxis[0] = 0; - - return 0; -} - -void pow_paletteram16_word_w(UINT32 address) -{ - INT32 r,g,b; - UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRam + (address & 0x0ffe)))); - - r = ((data >> 7) & 0x1e) | ((data >> 14) & 0x01); - g = ((data >> 3) & 0x1e) | ((data >> 13) & 0x01); - b = ((data << 1) & 0x1e) | ((data >> 12) & 0x01); - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - Palette[(address >> 1) & 0x7ff] = (r << 16) | (g << 8) | b; - DrvPalette[(address >> 1) & 0x7ff] = BurnHighCol(r, g, b, 0); -} - -void __fastcall pow_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xffff8000) == 0x100000 && game_select & 1) { - if (!(address & 2)) - data |= 0xff00; - - *((UINT16 *)(DrvSprRam + (address & 0x7fff))) = BURN_ENDIAN_SWAP_INT16(data); - - return; - } - - if ((address & 0xfffff000) == 0x400000) { - *((UINT16 *)(DrvPalRam + (address & 0x0ffe))) = BURN_ENDIAN_SWAP_INT16(data); - - pow_paletteram16_word_w(address); - - return; - } -} - -void __fastcall pow_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xffff8000) == 0x100000 && game_select == 1) { - if ((address & 3) == 3) data = 0xff; - - DrvSprRam[address & 0x7fff] = data; - - return; - } - - if ((address & 0xfffff000) == 0x400000) { - DrvPalRam[address & 0x0fff] = data; - - pow_paletteram16_word_w(address); - - return; - } - - switch (address) - { - case 0x080000: - soundlatch = data; - ZetNmi(); - return; - - case 0x080007: - invert_controls = ((data & 0xff) == 0x07) ? 0xff : 0x00; - return; - - case 0x0c0001: - flipscreen = data & 8; - sprite_flip = data & 4; - pow_charbase = (data & 0x70) << 4; - return; - } -} - - -UINT16 __fastcall pow_read_word(UINT32 address) -{ - bprintf (PRINT_NORMAL, _T("read %x, w\n"), address); - - return 0; -} - -UINT8 __fastcall pow_read_byte(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[1]; - - case 0x080001: - return DrvInputs[0]; - - case 0x0c0000: - case 0x0c0001: - return DrvInputs[2]; - - case 0x0e0000: - case 0x0e0001: - case 0x0e8000: - case 0x0e8001: - return 0xff; - - case 0x0f0000: - case 0x0f0001: - return DrvDips[0]; - - case 0x0f0008: - case 0x0f0009: - return DrvDips[1]; - } - - return 0; -} - -UINT8 __fastcall sar_read_byte(UINT32 address) -{ - switch (address) - { - case 0x080001: - case 0x080003: - case 0x080005: - return DrvInputs[(address >> 1) & 3] ^ invert_controls; - - case 0x0c0000: { - INT32 RetVal = Rotary1; - RetVal = (~(1 << RetVal)) & 0xff; - return (UINT8)RetVal; - } - - case 0x0c8000: { - INT32 RetVal = Rotary2; - RetVal = (~(1 << RetVal)) & 0xff; - return (UINT8)RetVal; - } - - case 0x0d0000: { - INT32 RetVal = 0xff; - - if (Rotary1 == 8) RetVal -= 0x01; - if (Rotary1 == 9) RetVal -= 0x02; - if (Rotary1 == 10) RetVal -= 0x04; - if (Rotary1 == 11) RetVal -= 0x08; - - if (Rotary2 == 8) RetVal -= 0x10; - if (Rotary2 == 9) RetVal -= 0x20; - if (Rotary2 == 10) RetVal -= 0x40; - if (Rotary2 == 11) RetVal -= 0x80; - return (UINT8)RetVal; - } - - case 0x0f0000: - case 0x0f0001: - return DrvDips[0]; - - case 0x0f0008: - case 0x0f0009: - return DrvDips[1]; - - case 0x0f8000: - return 1; - } - - return 0; -} - -void __fastcall pow_sound_write(UINT16, UINT8) -{ -} - -void __fastcall pow_sound_out(UINT16 address, UINT8 data) -{ - switch (address & 0xff) - { - case 0x00: - case 0x20: - BurnYM3812Write((address >> 5) & 1, data); - return; - - case 0x40: - UPD7759PortWrite(0, data); - UPD7759StartWrite(0, 0); - UPD7759StartWrite(0, 1); - return; - - case 0x80: - UPD7759ResetWrite(0, data); - return; - } - -} - -UINT8 __fastcall pow_sound_read(UINT16 address) -{ - if (address == 0xf800) return soundlatch; - - return 0; -} - -UINT8 __fastcall pow_sound_in(UINT16 address) -{ - address &= 0xff; - - if (address == 0x0000) return BurnYM3812Read(0); - - return 0; -} - -static void powFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 powSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static INT32 DrvGfxDecode(INT32 *spriPlanes, INT32 *spriXOffs, INT32 *spriYOffs, INT32 modulo) -{ - static INT32 tilePlanes[4] = { 0x00000, 0x00004, 0x40000, 0x40004 }; - static INT32 tileXOffs[8] = { 0x43, 0x42, 0x41, 0x40, 0x03, 0x02, 0x01, 0x00 }; - static INT32 tileYOffs[8] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x300000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfx0, 0x010000); - - GfxDecode(0x0800, 4, 8, 8, tilePlanes, tileXOffs, tileYOffs, 0x0080, tmp, DrvGfx0); - - memcpy (tmp, DrvGfx1, 0x300000); - - GfxDecode(0x6000, 4, 16, 16, spriPlanes, spriXOffs, spriYOffs, modulo, tmp, DrvGfx1); - - BurnFree (tmp); - - memset (DrvGfx0Trans, 1, 0x800); - for (INT32 i = 0; i < 0x20000; i++) { - if (DrvGfx0[i]) { - DrvGfx0Trans[i>>6] = 0; - i|=0x3f; - } - } - - return 0; -} - -static INT32 PowGfxDecode() -{ - static INT32 spriPlanes[4] = { 0x000000, 0x400000, 0x800000, 0xc00000 }; - static INT32 spriXOffs[16] = { 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80, - 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }; - static INT32 spriYOffs[16] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, - 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78 }; - - return DrvGfxDecode(spriPlanes, spriXOffs, spriYOffs, 0x100); -} - -static INT32 SarGfxDecode() -{ - static INT32 spriPlanes[4] = { 0x000000, 0x000008,0xc00000, 0xc00008 }; - static INT32 spriXOffs[16] = { 0x107, 0x106, 0x105, 0x104, 0x103, 0x102, 0x101, 0x100, - 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000 }; - static INT32 spriYOffs[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, - 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0 }; - - return DrvGfxDecode(spriPlanes, spriXOffs, spriYOffs, 0x200); -} - -static INT32 IkariGfxDecode() -{ - static INT32 spriPlanes[4] = { 0xa00000, 0x000000, 0x500000, 0xf00000 }; - static INT32 spriXOffs[16] = { 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80, - 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }; - static INT32 spriYOffs[16] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, - 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78 }; - - return DrvGfxDecode(spriPlanes, spriXOffs, spriYOffs, 0x100); -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x040000; - Drv68KRomBank = Next; Next += 0x040000; - DrvZ80Rom = Next; Next += 0x010000; - - DrvGfx0 = Next; Next += 0x020000; - DrvGfx1 = Next; Next += 0x600000; - - DrvGfx0Trans = Next; Next += 0x000800; - - DrvSnd0 = Next; Next += 0x020000; - - AllRam = Next; - - Drv68KRam = Next; Next += 0x004000; - DrvVidRam = Next; Next += 0x001000; - DrvSprRam = Next; Next += 0x008000; - DrvPalRam = Next; Next += 0x001000; - - DrvZ80Ram = Next; Next += 0x000800; - - Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - - RamEnd = Next; - - DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - - -static void pow_map_68k() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRam, 0x040000, 0x043fff, SM_RAM); - SekMapMemory(DrvVidRam, 0x100000, 0x100fff, SM_RAM); // video ram - SekMapMemory(DrvSprRam, 0x200000, 0x207fff, SM_RAM); // sprite ram - SekMapMemory(DrvPalRam, 0x400000, 0x400fff, SM_ROM); // palette ram - SekSetWriteByteHandler(0, pow_write_byte); - SekSetWriteWordHandler(0, pow_write_word); - SekSetReadByteHandler(0, pow_read_byte); - SekSetReadWordHandler(0, pow_read_word); - SekClose(); -} - -static void sar_map_68k() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRam, 0x040000, 0x043fff, SM_RAM); - SekMapMemory(DrvSprRam, 0x100000, 0x107fff, SM_ROM); // sprite ram - SekMapMemory(DrvVidRam, 0x200000, 0x200fff, SM_RAM); // video ram - SekMapMemory(DrvVidRam, 0x201000, 0x201fff, SM_WRITE); // video ram mirror - SekMapMemory(Drv68KRomBank, 0x300000, 0x33ffff, SM_ROM); // extra rom - SekMapMemory(DrvPalRam, 0x400000, 0x400fff, SM_ROM); // palette ram - SekSetWriteByteHandler(0, pow_write_byte); - SekSetWriteWordHandler(0, pow_write_word); - SekSetReadByteHandler(0, sar_read_byte); - SekSetReadWordHandler(0, pow_read_word); - SekClose(); -} - - -static INT32 DrvGetRoms() -{ - char* pRomName; - struct BurnRomInfo ri; - UINT8 *LoadP0 = Drv68KRom; - UINT8 *LoadP1 = DrvZ80Rom; - UINT8 *LoadG0 = DrvGfx0; - UINT8 *LoadG1 = DrvGfx1; - UINT8 *LoadS0 = DrvSnd0; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & 7) == 1) { - if (BurnLoadRom(LoadP0 + 1, i + 0, 2)) return 1; - if (BurnLoadRom(LoadP0 + 0, i + 1, 2)) return 1; - LoadP0 += ri.nLen * 2; - i++; - continue; - } - - if ((ri.nType & 7) == 2) { - if (BurnLoadRom(LoadP1, i, 1)) return 1; - LoadP1 += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 3) { - if (BurnLoadRom(LoadG0, i, 1)) return 1; - LoadG0 += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 4) { - if (BurnLoadRom(LoadG1, i, 1)) return 1; - LoadG1 += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 5) { - if (BurnLoadRom(LoadS0, i, 1)) return 1; - LoadS0 += ri.nLen; - continue; - } - } - - return 0; -} - -static INT32 DrvInit(INT32 game) -{ - game_select = game; - - Mem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - if (DrvGetRoms()) return 1; - - switch (game_select) - { - case 0: // Pow - if (PowGfxDecode()) return 1; - pow_map_68k(); - break; - - case 1: // searchar - if (SarGfxDecode()) return 1; - sar_map_68k(); - break; - - case 2: // streets - if (SarGfxDecode()) return 1; - pow_map_68k(); - break; - - case 3: // ikari - if (IkariGfxDecode()) return 1; - sar_map_68k(); - break; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram); - ZetSetWriteHandler(pow_sound_write); - ZetSetReadHandler(pow_sound_read); - ZetSetInHandler(pow_sound_in); - ZetSetOutHandler(pow_sound_out); - ZetMemEnd(); - ZetClose(); - - BurnYM3812Init(4000000, &powFMIRQHandler, &powSynchroniseStream, 0); - BurnTimerAttachZetYM3812(4000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvSnd0); - UPD7759SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - BurnYM3812Exit(); - UPD7759Exit(); - - GenericTilesExit(); - SekExit(); - ZetExit(); - - BurnFree (Mem); - - game_select = 0; - - return 0; -} - - -static void pow_sprites(INT32 j, INT32 pos) -{ - INT32 offs,mx,my,color,tile,fx,fy,i; - - UINT16 *spriteram16 = (UINT16*)(DrvSprRam); - - for (offs = pos; offs < pos+0x800; offs += 0x80 ) - { - mx=(BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+4+(4*j))>>1])&0xff)<<4; - my=BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+6+(4*j))>>1]); - mx=mx+(my>>12); - mx=((mx+16)&0x1ff)-16; - - mx=((mx+0x100)&0x1ff)-0x100; - my=((my+0x100)&0x1ff)-0x100; - - my=0x200 - my; - my-=0x200; - - if (flipscreen) { - mx=240-mx; - my=240-my; - } - - my -= 16; - - for (i = 0; i < 0x80; i+=4) - { - color = BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+i+(0x1000*j)+0x1000)>>1])&0x7f; - - if (color) - { - tile=BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+2+i+(0x1000*j)+0x1000)>>1]); - fy=tile&0x8000; - fx=tile&0x4000; - tile&=0x3fff; - - if (flipscreen) { - if (fx) fx=0; else fx=1; - if (fy) fy=0; else fy=1; - } - - if (mx > -16 && mx < 256 && my > -16 && my < 224) { - if (fy) { - if (fx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); - } - } else { - if (fx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); - } - } - } - } - - if (flipscreen) { - my-=16; - if (my < -0x100) my+=0x200; - } - else { - my+=16; - if (my > 0x100) my-=0x200; - } - } - } -} - -static void sar_sprites(INT32 j, INT32 z, INT32 pos) -{ - INT32 offs,mx,my,color,tile,fx,fy,i; - - UINT16 *spriteram16 = (UINT16*)(DrvSprRam); - - for (offs = pos; offs < pos+0x800 ; offs += 0x80 ) - { - mx=BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+j)>>1]); - my=BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+j+2)>>1]); - - mx=mx<<4; - mx=mx|((my>>12)&0xf); - my=my&0x1ff; - - mx=(mx+0x100)&0x1ff; - my=(my+0x100)&0x1ff; - mx-=0x100; - my-=0x100; - my=0x200 - my; - my-=0x200; - - if (flipscreen) { - mx=240-mx; - my=240-my; - } - - my -= 16; - - for (i = 0; i < 0x80; i += 4) - { - color = BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+i+z)>>1]) & 0x7f; - - if (color) - { - tile = BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+2+i+z)>>1]); - - if (sprite_flip) { - fx=0; - fy=tile&0x8000; - } else { - fy=0; - fx=tile&0x8000; - } - - if (flipscreen) { - if (fx) fx=0; else fx=1; - if (fy) fy=0; else fy=1; - } - - tile&=0x7fff; - if (tile>0x5fff) break; - - if (mx > -16 && mx < 256 && my > -16 && my < 224) { - if (fy) { - if (fx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); - } - } else { - if (fx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); - } - } - } - } - - if (flipscreen) { - my-=16; - if (my < -0x100) my+=0x200; - } - else { - my+=16; - if (my > 0x100) my-=0x200; - } - } - } -} - -static void pow_foreground() -{ - UINT16 *vidram = (UINT16*)DrvVidRam; - - for (INT32 offs = 0; offs < 0x1000 / 2; offs+=2) - { - INT32 sy = (offs << 2) & 0xf8; - INT32 sx = (offs >> 3) & 0xf8; - - if (flipscreen) { - sy ^= 0xf8; - sx ^= 0xf8; - } - - if (sy < 16 || sy > 239) continue; - sy -= 16; - - INT32 code = (BURN_ENDIAN_SWAP_INT16(vidram[offs | 0]) & 0xff) | pow_charbase; - INT32 color = BURN_ENDIAN_SWAP_INT16(vidram[offs | 1]) & 0x0f; - - if (DrvGfx0Trans[code]) continue; - - if (flipscreen) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfx0); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfx0); - } - } -} - -static void sar_foreground() -{ - UINT16 *vidram = (UINT16*)DrvVidRam; - - for (INT32 offs = 0; offs < 0x1000 / 2; offs+=2) - { - INT32 sy = (offs << 2) & 0xf8; - INT32 sx = (offs >> 3) & 0xf8; - - if (flipscreen) { - sy ^= 0xf8; - sx ^= 0xf8; - } - - if (sy < 16 || sy > 239) continue; - sy -= 16; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vidram[offs]); - INT32 color = code >> 12; - - // kludge for bad tile (ikari) - if (code == 0x80ff) { - code = 0x02ca; - color = 0x07; - } - - code &= 0x0fff; - - if (DrvGfx0Trans[code]) continue; - - if (flipscreen) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfx0); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfx0); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x800; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - for (INT32 offs = 0; offs < nScreenHeight * nScreenWidth; offs++) { - pTransDraw[offs] = 0x7ff; - } - - if (!game_select) { - pow_sprites(1, 0x000); - pow_sprites(1, 0x800); - pow_sprites(2, 0x000); - pow_sprites(2, 0x800); - pow_sprites(0, 0x000); - pow_sprites(0, 0x800); - } else { - sar_sprites(8, 0x2000, 0x000); - sar_sprites(8, 0x2000, 0x800); - sar_sprites(12,0x3000, 0x000); - sar_sprites(12,0x3000, 0x800); - sar_sprites(4, 0x1000, 0x000); - sar_sprites(4, 0x1000, 0x800); - } - - if (game_select & 1) { - sar_foreground(); - } else { - pow_foreground(); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= DrvJoy1[i] << i; - DrvInputs[1] ^= DrvJoy2[i] << i; - DrvInputs[2] ^= DrvJoy3[i] << i; - } - - nAnalogAxis[0] -= DrvAxis[0]; - DrvInputs[6] = (~nAnalogAxis[0] >> 8) & 0xfe; - - nAnalogAxis[1] -= DrvAxis[1]; - DrvInputs[7] = (~nAnalogAxis[1] >> 8) & 0xfe; - } - - if (game_select == 1 || game_select == 3) { - if ((DrvInputs[6] >> 4) < Rotary1OldVal) { - Rotary1++; - } - - if ((DrvInputs[6] >> 4) > Rotary1OldVal) { - Rotary1--; - } - Rotary1OldVal = DrvInputs[6] >> 4; - if (Rotary1 > 11) Rotary1 = 0; - if (Rotary1 < 0) Rotary1 = 11; - - if ((DrvInputs[7] >> 4) < Rotary2OldVal) { - Rotary2++; - } - - if ((DrvInputs[7] >> 4) > Rotary2OldVal) { - Rotary2--; - } - Rotary2OldVal = DrvInputs[7] >> 4; - if (Rotary2 > 11) Rotary2 = 0; - if (Rotary2 < 0) Rotary2 = 11; - } - - INT32 nTotalCycles[2] = { ((game_select == 1) ? 9000000 : 10000000) / 60, 4000000 / 60 }; - - SekOpen(0); - ZetOpen(0); - - SekNewFrame(); - ZetNewFrame(); - - SekRun(nTotalCycles[0]); - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrameYM3812(nTotalCycles[1]); - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - UPD7759Update(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029682; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - if (nAction & ACB_WRITE) - DrvRecalc = 1; - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM3812Scan(nAction, pnMin); - UPD7759Scan(0, nAction, pnMin); - - SCAN_VAR(invert_controls); - SCAN_VAR(soundlatch); - SCAN_VAR(flipscreen); - SCAN_VAR(sprite_flip); - SCAN_VAR(pow_charbase); - SCAN_VAR(nAnalogAxis[0]); - SCAN_VAR(nAnalogAxis[1]); - SCAN_VAR(Rotary1); - SCAN_VAR(Rotary1OldVal); - SCAN_VAR(Rotary2); - SCAN_VAR(Rotary2OldVal); - } - - return 0; -} - - -// P.O.W. - Prisoners of War (US version 1) - -static struct BurnRomInfo powRomDesc[] = { - { "dg1ver1.j14", 0x20000, 0x8e71a8af, 1 | BRF_PRG }, // 0 68k COde - { "dg2ver1.l14", 0x20000, 0x4287affc, 1 | BRF_PRG }, // 1 - - { "dg8.e25", 0x10000, 0xd1d61da3, 2 | BRF_PRG }, // 2 Z80 Code - - { "dg9.l25", 0x08000, 0xdf864a08, 3 | BRF_GRA }, // 3 Characters - { "dg10.m25", 0x08000, 0x9e470d53, 3 | BRF_GRA }, // 4 - - { "snk880.11a", 0x20000, 0xe70fd906, 4 | BRF_GRA }, // 5 Sprites - { "snk880.12a", 0x20000, 0x628b1aed, 4 | BRF_GRA }, // 6 - { "snk880.13a", 0x20000, 0x19dc8868, 4 | BRF_GRA }, // 7 - { "snk880.14a", 0x20000, 0x47cd498b, 4 | BRF_GRA }, // 8 - { "snk880.15a", 0x20000, 0x7a90e957, 4 | BRF_GRA }, // 9 - { "snk880.16a", 0x20000, 0xe40a6c13, 4 | BRF_GRA }, // 10 - { "snk880.17a", 0x20000, 0xc7931cc2, 4 | BRF_GRA }, // 11 - { "snk880.18a", 0x20000, 0xeed72232, 4 | BRF_GRA }, // 12 - { "snk880.19a", 0x20000, 0x1775b8dd, 4 | BRF_GRA }, // 13 - { "snk880.20a", 0x20000, 0xf8e752ec, 4 | BRF_GRA }, // 14 - { "snk880.21a", 0x20000, 0x27e9fffe, 4 | BRF_GRA }, // 15 - { "snk880.22a", 0x20000, 0xaa9c00d8, 4 | BRF_GRA }, // 16 - { "snk880.23a", 0x20000, 0xadb6ad68, 4 | BRF_GRA }, // 17 - { "snk880.24a", 0x20000, 0xdd41865a, 4 | BRF_GRA }, // 18 - { "snk880.25a", 0x20000, 0x055759ad, 4 | BRF_GRA }, // 19 - { "snk880.26a", 0x20000, 0x9bc261c5, 4 | BRF_GRA }, // 20 - - { "dg7.d20", 0x10000, 0xaba9a9d3, 5 | BRF_SND }, // 21 upd7759 samples - - { "pal20l10.a6", 0x000cc, 0xc3d9e729, 0 | BRF_OPT }, // 22 pld -}; - -STD_ROM_PICK(pow) -STD_ROM_FN(pow) - -static INT32 powInit() -{ - return DrvInit(0); -} - -struct BurnDriver BurnDrvpow = { - "pow", NULL, NULL, NULL, "1988", - "P.O.W. - Prisoners of War (US version 1)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, powRomInfo, powRomName, NULL, NULL, DrvInputInfo, PowDIPInfo, - powInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 256, 224, 4, 3 -}; - - -// Datsugoku - Prisoners of War (Japan) - -static struct BurnRomInfo powjRomDesc[] = { - { "1-2", 0x20000, 0x2f17bfb0, 1 | BRF_PRG }, // 0 68k Code - { "2-2", 0x20000, 0xbaa32354, 1 | BRF_PRG }, // 1 - - { "dg8.e25", 0x10000, 0xd1d61da3, 2 | BRF_PRG }, // 2 Z80 Code - - { "dg9.l25", 0x08000, 0xdf864a08, 3 | BRF_GRA }, // 3 Characters - { "dg10.m25", 0x08000, 0x9e470d53, 3 | BRF_GRA }, // 4 - - { "snk880.11a", 0x20000, 0xe70fd906, 4 | BRF_GRA }, // 5 Sprites - { "snk880.12a", 0x20000, 0x628b1aed, 4 | BRF_GRA }, // 6 - { "snk880.13a", 0x20000, 0x19dc8868, 4 | BRF_GRA }, // 7 - { "snk880.14a", 0x20000, 0x47cd498b, 4 | BRF_GRA }, // 8 - { "snk880.15a", 0x20000, 0x7a90e957, 4 | BRF_GRA }, // 9 - { "snk880.16a", 0x20000, 0xe40a6c13, 4 | BRF_GRA }, // 10 - { "snk880.17a", 0x20000, 0xc7931cc2, 4 | BRF_GRA }, // 11 - { "snk880.18a", 0x20000, 0xeed72232, 4 | BRF_GRA }, // 12 - { "snk880.19a", 0x20000, 0x1775b8dd, 4 | BRF_GRA }, // 13 - { "snk880.20a", 0x20000, 0xf8e752ec, 4 | BRF_GRA }, // 14 - { "snk880.21a", 0x20000, 0x27e9fffe, 4 | BRF_GRA }, // 15 - { "snk880.22a", 0x20000, 0xaa9c00d8, 4 | BRF_GRA }, // 16 - { "snk880.23a", 0x20000, 0xadb6ad68, 4 | BRF_GRA }, // 17 - { "snk880.24a", 0x20000, 0xdd41865a, 4 | BRF_GRA }, // 18 - { "snk880.25a", 0x20000, 0x055759ad, 4 | BRF_GRA }, // 19 - { "snk880.26a", 0x20000, 0x9bc261c5, 4 | BRF_GRA }, // 20 - - { "dg7.d20", 0x10000, 0xaba9a9d3, 5 | BRF_SND }, // 21 upd7759 samples - - { "pal20l10.a6", 0x000cc, 0xc3d9e729, 0 | BRF_OPT }, // 22 pld -}; - -STD_ROM_PICK(powj) -STD_ROM_FN(powj) - -struct BurnDriver BurnDrvpowj = { - "powj", "pow", NULL, NULL, "1988", - "Datsugoku - Prisoners of War (Japan)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, powjRomInfo, powjRomName, NULL, NULL, DrvInputInfo, PowjDIPInfo, - powInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 256, 224, 4, 3 -}; - - -// SAR - Search And Rescue (World) - -static struct BurnRomInfo searcharRomDesc[] = { - { "bhw.2", 0x20000, 0xe1430138, 1 | BRF_PRG }, // 0 68k Code - { "bhw.3", 0x20000, 0xee1f9374, 1 | BRF_PRG }, // 1 - { "bhw.1", 0x20000, 0x62b60066, 1 | BRF_PRG }, // 2 - { "bhw.4", 0x20000, 0x16d8525c, 1 | BRF_PRG }, // 3 - - { "bh.5", 0x10000, 0x53e2fa76, 2 | BRF_PRG }, // 4 Z80 Code - - { "bh.7", 0x08000, 0xb0f1b049, 3 | BRF_GRA }, // 5 Characters - { "bh.8", 0x08000, 0x174ddba7, 3 | BRF_GRA }, // 6 - - { "bh.c1", 0x80000, 0x1fb8f0ae, 4 | BRF_GRA }, // 7 Sprites - { "bh.c3", 0x80000, 0xfd8bc407, 4 | BRF_GRA }, // 8 - { "bh.c5", 0x80000, 0x1d30acc3, 4 | BRF_GRA }, // 9 - { "bh.c2", 0x80000, 0x7c803767, 4 | BRF_GRA }, // 10 - { "bh.c4", 0x80000, 0xeede7c43, 4 | BRF_GRA }, // 11 - { "bh.c6", 0x80000, 0x9f785cd9, 4 | BRF_GRA }, // 12 - - { "bh.v1", 0x20000, 0x07a6114b, 5 | BRF_SND }, // 13 upd7759 samples -}; - -STD_ROM_PICK(searchar) -STD_ROM_FN(searchar) - -static INT32 searcharInit() -{ - return DrvInit(1); -} - -struct BurnDriver BurnDrvsearchar = { - "searchar", NULL, NULL, NULL, "1989", - "SAR - Search And Rescue (World)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, searcharRomInfo, searcharRomName, NULL, NULL, IkariInputInfo, SarDIPInfo, - searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 224, 256, 3, 4 -}; - - -// SAR - Search And Rescue (US) - -static struct BurnRomInfo sercharuRomDesc[] = { - { "bh.2", 0x20000, 0xc852e2e2, 1 | BRF_PRG }, // 0 68k Code - { "bh.3", 0x20000, 0xbc04a4a1, 1 | BRF_PRG }, // 1 - { "bh.1", 0x20000, 0xba9ca70b, 1 | BRF_PRG }, // 2 - { "bh.4", 0x20000, 0xeabc5ddf, 1 | BRF_PRG }, // 3 - - { "bh.5", 0x10000, 0x53e2fa76, 2 | BRF_PRG }, // 4 Z80 Code - - { "bh.7", 0x08000, 0xb0f1b049, 3 | BRF_GRA }, // 5 Characters - { "bh.8", 0x08000, 0x174ddba7, 3 | BRF_GRA }, // 6 - - { "bh.c1", 0x80000, 0x1fb8f0ae, 4 | BRF_GRA }, // 7 Sprites - { "bh.c3", 0x80000, 0xfd8bc407, 4 | BRF_GRA }, // 8 - { "bh.c5", 0x80000, 0x1d30acc3, 4 | BRF_GRA }, // 9 - { "bh.c2", 0x80000, 0x7c803767, 4 | BRF_GRA }, // 10 - { "bh.c4", 0x80000, 0xeede7c43, 4 | BRF_GRA }, // 11 - { "bh.c6", 0x80000, 0x9f785cd9, 4 | BRF_GRA }, // 12 - - { "bh.v1", 0x20000, 0x07a6114b, 5 | BRF_SND }, // 13 upd7759 samples -}; - -STD_ROM_PICK(sercharu) -STD_ROM_FN(sercharu) - -struct BurnDriver BurnDrvsercharu = { - "searcharu", "searchar", NULL, NULL, "1989", - "SAR - Search And Rescue (US)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, sercharuRomInfo, sercharuRomName, NULL, NULL, IkariInputInfo, SarDIPInfo, - searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 224, 256, 3, 4 -}; - - -// SAR - Search And Rescue (Japan) - -static struct BurnRomInfo sercharjRomDesc[] = { - { "bh2ver3j.9c", 0x20000, 0x7ef7b172, 1 | BRF_PRG }, // 0 68k Code - { "bh3ver3j.10c",0x20000, 0x3fdea793, 1 | BRF_PRG }, // 1 - { "bhw.1", 0x20000, 0x62b60066, 1 | BRF_PRG }, // 2 - { "bhw.4", 0x20000, 0x16d8525c, 1 | BRF_PRG }, // 3 - - { "bh.5", 0x10000, 0x53e2fa76, 2 | BRF_PRG }, // 4 Z80 Code - - { "bh.7", 0x08000, 0xb0f1b049, 3 | BRF_GRA }, // 5 Characters - { "bh.8", 0x08000, 0x174ddba7, 3 | BRF_GRA }, // 6 - - { "bh.c1", 0x80000, 0x1fb8f0ae, 4 | BRF_GRA }, // 7 Sprites - { "bh.c3", 0x80000, 0xfd8bc407, 4 | BRF_GRA }, // 8 - { "bh.c5", 0x80000, 0x1d30acc3, 4 | BRF_GRA }, // 9 - { "bh.c2", 0x80000, 0x7c803767, 4 | BRF_GRA }, // 10 - { "bh.c4", 0x80000, 0xeede7c43, 4 | BRF_GRA }, // 11 - { "bh.c6", 0x80000, 0x9f785cd9, 4 | BRF_GRA }, // 12 - - { "bh.v1", 0x20000, 0x07a6114b, 5 | BRF_SND }, // 13 upd7759 samples -}; - -STD_ROM_PICK(sercharj) -STD_ROM_FN(sercharj) - -struct BurnDriver BurnDrvsercharj = { - "searcharj", "searchar", NULL, NULL, "1989", - "SAR - Search And Rescue (Japan)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, sercharjRomInfo, sercharjRomName, NULL, NULL, IkariInputInfo, SarDIPInfo, - searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 224, 256, 3, 4 -}; - - - -// Street Smart (US version 2) - -static struct BurnRomInfo streetsmRomDesc[] = { - { "s2-1ver2.14h", 0x20000, 0x655f4773, 1 | BRF_PRG }, // 0 68k Code - { "s2-2ver2.14k", 0x20000, 0xefae4823, 1 | BRF_PRG }, // 1 - - { "s2-5.16c", 0x10000, 0xca4b171e, 2 | BRF_PRG }, // 2 Z80 Code - - { "s2-9.25l", 0x08000, 0x09b6ac67, 3 | BRF_GRA }, // 3 Characters - { "s2-10.25m", 0x08000, 0x89e4ee6f, 3 | BRF_GRA }, // 4 - - { "stsmart.900", 0x80000, 0xa8279a7e, 4 | BRF_GRA }, // 5 Sprites - { "stsmart.902", 0x80000, 0x2f021aa1, 4 | BRF_GRA }, // 6 - { "stsmart.904", 0x80000, 0x167346f7, 4 | BRF_GRA }, // 7 - { "stsmart.901", 0x80000, 0xc305af12, 4 | BRF_GRA }, // 8 - { "stsmart.903", 0x80000, 0x73c16d35, 4 | BRF_GRA }, // 9 - { "stsmart.905", 0x80000, 0xa5beb4e2, 4 | BRF_GRA }, // 10 - - { "s2-6.18d", 0x20000, 0x47db1605, 5 | BRF_SND }, // 11 upd7759 samples - - { "pl20l10a.1n", 0x000cc, 0x00000000, 0 | BRF_NODUMP }, /* PAL is read protected */ -}; - -STD_ROM_PICK(streetsm) -STD_ROM_FN(streetsm) - -static INT32 streetsmInit() -{ - return DrvInit(2); -} - -struct BurnDriver BurnDrvstreetsm = { - "streetsm", NULL, NULL, NULL, "1989", - "Street Smart (US version 2)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_VSFIGHT, 0, - NULL, streetsmRomInfo, streetsmRomName, NULL, NULL, DrvInputInfo, StreetsmDIPInfo, - streetsmInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 256, 224, 4, 3 -}; - - -// Street Smart (US version 1) - -static struct BurnRomInfo streets1RomDesc[] = { - { "s2-1ver1.9c", 0x20000, 0xb59354c5, 1 | BRF_PRG }, // 0 68k Code - { "s2-2ver1.10c", 0x20000, 0xe448b68b, 1 | BRF_PRG }, // 1 - - { "s2-5.16c", 0x10000, 0xca4b171e, 2 | BRF_PRG }, // 2 Z80 Code - - { "s2-7.15l", 0x08000, 0x22bedfe5, 3 | BRF_GRA }, // 3 Characters - { "s2-8.15m", 0x08000, 0x6a1c70ab, 3 | BRF_GRA }, // 4 - - { "stsmart.900", 0x80000, 0xa8279a7e, 4 | BRF_GRA }, // 5 Sprites - { "stsmart.902", 0x80000, 0x2f021aa1, 4 | BRF_GRA }, // 6 - { "stsmart.904", 0x80000, 0x167346f7, 4 | BRF_GRA }, // 7 - { "stsmart.901", 0x80000, 0xc305af12, 4 | BRF_GRA }, // 8 - { "stsmart.903", 0x80000, 0x73c16d35, 4 | BRF_GRA }, // 9 - { "stsmart.905", 0x80000, 0xa5beb4e2, 4 | BRF_GRA }, // 10 - - { "s2-6.18d", 0x20000, 0x47db1605, 5 | BRF_SND }, // 11 upd7759 samples -}; - -STD_ROM_PICK(streets1) -STD_ROM_FN(streets1) - -struct BurnDriver BurnDrvstreets1 = { - "streetsm1", "streetsm", NULL, NULL, "1989", - "Street Smart (US version 1)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_VSFIGHT, 0, - NULL, streets1RomInfo, streets1RomName, NULL, NULL, DrvInputInfo, StreetsmDIPInfo, - searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 256, 224, 4, 3 -}; - - -// Street Smart (World version 1) - -static struct BurnRomInfo streetswRomDesc[] = { - { "s-smart1.bin", 0x20000, 0xa1f5ceab, 1 | BRF_PRG }, // 0 68k Code - { "s-smart2.bin", 0x20000, 0x263f615d, 1 | BRF_PRG }, // 1 - - { "s2-5.16c", 0x10000, 0xca4b171e, 2 | BRF_PRG }, // 2 Z80 Code - - { "s2-7.15l", 0x08000, 0x22bedfe5, 3 | BRF_GRA }, // 3 Characters - { "s2-8.15m", 0x08000, 0x6a1c70ab, 3 | BRF_GRA }, // 4 - - { "stsmart.900", 0x80000, 0xa8279a7e, 4 | BRF_GRA }, // 5 Sprites - { "stsmart.902", 0x80000, 0x2f021aa1, 4 | BRF_GRA }, // 6 - { "stsmart.904", 0x80000, 0x167346f7, 4 | BRF_GRA }, // 7 - { "stsmart.901", 0x80000, 0xc305af12, 4 | BRF_GRA }, // 8 - { "stsmart.903", 0x80000, 0x73c16d35, 4 | BRF_GRA }, // 9 - { "stsmart.905", 0x80000, 0xa5beb4e2, 4 | BRF_GRA }, // 10 - - { "s2-6.18d", 0x20000, 0x47db1605, 5 | BRF_SND }, // 11 upd7759 samples -}; - -STD_ROM_PICK(streetsw) -STD_ROM_FN(streetsw) - -struct BurnDriver BurnDrvstreetsw = { - "streetsmw", "streetsm", NULL, NULL, "1989", - "Street Smart (World version 1)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_VSFIGHT, 0, - NULL, streetswRomInfo, streetswRomName, NULL, NULL, DrvInputInfo, StreetsjDIPInfo, - searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 256, 224, 4, 3 -}; - - -// Street Smart (Japan version 1) - -static struct BurnRomInfo streetsjRomDesc[] = { - { "s2v1j_01.bin", 0x20000, 0xf031413c, 1 | BRF_PRG }, // 0 68k Code - { "s2v1j_02.bin", 0x20000, 0xe403a40b, 1 | BRF_PRG }, // 1 - - { "s2-5.16c", 0x10000, 0xca4b171e, 2 | BRF_PRG }, // 2 Z80 Code - - { "s2-7.15l", 0x08000, 0x22bedfe5, 3 | BRF_GRA }, // 3 Characters - { "s2-8.15m", 0x08000, 0x6a1c70ab, 3 | BRF_GRA }, // 4 - - { "stsmart.900", 0x80000, 0xa8279a7e, 4 | BRF_GRA }, // 5 Sprites - { "stsmart.902", 0x80000, 0x2f021aa1, 4 | BRF_GRA }, // 6 - { "stsmart.904", 0x80000, 0x167346f7, 4 | BRF_GRA }, // 7 - { "stsmart.901", 0x80000, 0xc305af12, 4 | BRF_GRA }, // 8 - { "stsmart.903", 0x80000, 0x73c16d35, 4 | BRF_GRA }, // 9 - { "stsmart.905", 0x80000, 0xa5beb4e2, 4 | BRF_GRA }, // 10 - - { "s2-6.18d", 0x20000, 0x47db1605, 5 | BRF_SND }, // 11 upd7759 samples -}; - -STD_ROM_PICK(streetsj) -STD_ROM_FN(streetsj) - -struct BurnDriver BurnDrvstreetsj = { - "streetsmj", "streetsm", NULL, NULL, "1989", - "Street Smart (Japan version 1)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_VSFIGHT, 0, - NULL, streetsjRomInfo, streetsjRomName, NULL, NULL, DrvInputInfo, StreetsjDIPInfo, - searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 256, 224, 4, 3 -}; - -// Ikari III - The Rescue (8-Way Joystick) - -static struct BurnRomInfo ikari3RomDesc[] = { - { "ik3-2-ver1.c10", 0x20000, 0x1bae8023, 1 | BRF_PRG }, // 0 68k Code - { "ik3-3-ver1.c9", 0x20000, 0x10e38b66, 1 | BRF_PRG }, // 1 - { "ik3-1.c8", 0x10000, 0x47e4d256, 1 | BRF_PRG }, // 2 - { "ik3-4.c12", 0x10000, 0xa43af6b5, 1 | BRF_PRG }, // 3 - - { "ik3-5.bin", 0x10000, 0xce6706fc, 2 | BRF_PRG }, // 4 Z80 Code - - { "ik3-7.bin", 0x08000, 0x0b4804df, 3 | BRF_GRA }, // 5 Characters - { "ik3-8.bin", 0x08000, 0x10ab4e50, 3 | BRF_GRA }, // 6 - - { "ik3-13.bin", 0x20000, 0x9a56bd32, 4 | BRF_GRA }, // 7 Sprites - { "ik3-12.bin", 0x20000, 0x0ce6a10a, 4 | BRF_GRA }, // 8 - { "ik3-11.bin", 0x20000, 0xe4e2be43, 4 | BRF_GRA }, // 9 - { "ik3-10.bin", 0x20000, 0xac222372, 4 | BRF_GRA }, // 10 - { "ik3-9.bin", 0x20000, 0xc33971c2, 4 | BRF_GRA }, // 11 - { "ik3-14.bin", 0x20000, 0x453bea77, 4 | BRF_GRA }, // 12 - { "ik3-15.bin", 0x20000, 0x781a81fc, 4 | BRF_GRA }, // 13 - { "ik3-16.bin", 0x20000, 0x80ba400b, 4 | BRF_GRA }, // 14 - { "ik3-17.bin", 0x20000, 0x0cc3ce4a, 4 | BRF_GRA }, // 15 - { "ik3-18.bin", 0x20000, 0xba106245, 4 | BRF_GRA }, // 16 - { "ik3-23.bin", 0x20000, 0xd0fd5c77, 4 | BRF_GRA }, // 17 - { "ik3-22.bin", 0x20000, 0x4878d883, 4 | BRF_GRA }, // 18 - { "ik3-21.bin", 0x20000, 0x50d0fbf0, 4 | BRF_GRA }, // 19 - { "ik3-20.bin", 0x20000, 0x9a851efc, 4 | BRF_GRA }, // 20 - { "ik3-19.bin", 0x20000, 0x4ebdba89, 4 | BRF_GRA }, // 21 - { "ik3-24.bin", 0x20000, 0xe9b26d68, 4 | BRF_GRA }, // 22 - { "ik3-25.bin", 0x20000, 0x073b03f1, 4 | BRF_GRA }, // 23 - { "ik3-26.bin", 0x20000, 0x9c613561, 4 | BRF_GRA }, // 24 - { "ik3-27.bin", 0x20000, 0x16dd227e, 4 | BRF_GRA }, // 25 - { "ik3-28.bin", 0x20000, 0x711715ae, 4 | BRF_GRA }, // 26 - - { "ik3-6.bin", 0x20000, 0x59d256a4, 5 | BRF_SND }, // 27 upd7759 samples -}; - -STD_ROM_PICK(ikari3) -STD_ROM_FN(ikari3) - -static INT32 ikari3Init() -{ - return DrvInit(3); -} - -struct BurnDriver BurnDrvikari3 = { - "ikari3", NULL, NULL, NULL, "1989", - "Ikari III - The Rescue (8-Way Joystick)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, ikari3RomInfo, ikari3RomName, NULL, NULL, IkariInputInfo, IkariDIPInfo, - ikari3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 256, 224, 4, 3 -}; - -// Ikari III - The Rescue (US, Rotary Joystick) - -static struct BurnRomInfo ikari3uRomDesc[] = { - { "ik3-2.c10", 0x20000, 0xa7b34dcd, 1 | BRF_PRG }, // 0 68k Code - { "ik3-3.c9", 0x20000, 0x50f2b83d, 1 | BRF_PRG }, // 1 - { "ik3-1.c8", 0x10000, 0x47e4d256, 1 | BRF_PRG }, // 2 - { "ik3-4.c12", 0x10000, 0xa43af6b5, 1 | BRF_PRG }, // 3 - - { "ik3-5.bin", 0x10000, 0xce6706fc, 2 | BRF_PRG }, // 4 Z80 Code - - { "ik3-7.bin", 0x08000, 0x0b4804df, 3 | BRF_GRA }, // 5 Characters - { "ik3-8.bin", 0x08000, 0x10ab4e50, 3 | BRF_GRA }, // 6 - - { "ik3-13.bin", 0x20000, 0x9a56bd32, 4 | BRF_GRA }, // 7 Sprites - { "ik3-12.bin", 0x20000, 0x0ce6a10a, 4 | BRF_GRA }, // 8 - { "ik3-11.bin", 0x20000, 0xe4e2be43, 4 | BRF_GRA }, // 9 - { "ik3-10.bin", 0x20000, 0xac222372, 4 | BRF_GRA }, // 10 - { "ik3-9.bin", 0x20000, 0xc33971c2, 4 | BRF_GRA }, // 11 - { "ik3-14.bin", 0x20000, 0x453bea77, 4 | BRF_GRA }, // 12 - { "ik3-15.bin", 0x20000, 0x781a81fc, 4 | BRF_GRA }, // 13 - { "ik3-16.bin", 0x20000, 0x80ba400b, 4 | BRF_GRA }, // 14 - { "ik3-17.bin", 0x20000, 0x0cc3ce4a, 4 | BRF_GRA }, // 15 - { "ik3-18.bin", 0x20000, 0xba106245, 4 | BRF_GRA }, // 16 - { "ik3-23.bin", 0x20000, 0xd0fd5c77, 4 | BRF_GRA }, // 17 - { "ik3-22.bin", 0x20000, 0x4878d883, 4 | BRF_GRA }, // 18 - { "ik3-21.bin", 0x20000, 0x50d0fbf0, 4 | BRF_GRA }, // 19 - { "ik3-20.bin", 0x20000, 0x9a851efc, 4 | BRF_GRA }, // 20 - { "ik3-19.bin", 0x20000, 0x4ebdba89, 4 | BRF_GRA }, // 21 - { "ik3-24.bin", 0x20000, 0xe9b26d68, 4 | BRF_GRA }, // 22 - { "ik3-25.bin", 0x20000, 0x073b03f1, 4 | BRF_GRA }, // 23 - { "ik3-26.bin", 0x20000, 0x9c613561, 4 | BRF_GRA }, // 24 - { "ik3-27.bin", 0x20000, 0x16dd227e, 4 | BRF_GRA }, // 25 - { "ik3-28.bin", 0x20000, 0x711715ae, 4 | BRF_GRA }, // 26 - - { "ik3-6.bin", 0x20000, 0x59d256a4, 5 | BRF_SND }, // 27 upd7759 samples -}; - -STD_ROM_PICK(ikari3u) -STD_ROM_FN(ikari3u) - -struct BurnDriver BurnDrvikari3u = { - "ikari3u", "ikari3", NULL, NULL, "1989", - "Ikari III - The Rescue (US, Rotary Joystick)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, ikari3uRomInfo, ikari3uRomName, NULL, NULL, IkariInputInfo, IkariDIPInfo, - ikari3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 256, 224, 4, 3 -}; - -// Ikari Three - The Rescue (Japan, Rotary Joystick) - -static struct BurnRomInfo ikari3jRomDesc[] = { - { "ik3-2-j.c10", 0x20000, 0x7b1b4be4, 1 | BRF_PRG }, // 0 68k Code - { "ik3-3-j.c9", 0x20000, 0x8e6e2aa9, 1 | BRF_PRG }, // 1 - { "ik3-1.c8", 0x10000, 0x47e4d256, 1 | BRF_PRG }, // 2 - { "ik3-4.c12", 0x10000, 0xa43af6b5, 1 | BRF_PRG }, // 3 - - { "ik3-5.bin", 0x10000, 0xce6706fc, 2 | BRF_PRG }, // 4 Z80 Code - - { "ik3-7.bin", 0x08000, 0x0b4804df, 3 | BRF_GRA }, // 5 Characters - { "ik3-8.bin", 0x08000, 0x10ab4e50, 3 | BRF_GRA }, // 6 - - { "ik3-13.bin", 0x20000, 0x9a56bd32, 4 | BRF_GRA }, // 7 Sprites - { "ik3-12.bin", 0x20000, 0x0ce6a10a, 4 | BRF_GRA }, // 8 - { "ik3-11.bin", 0x20000, 0xe4e2be43, 4 | BRF_GRA }, // 9 - { "ik3-10.bin", 0x20000, 0xac222372, 4 | BRF_GRA }, // 10 - { "ik3-9.bin", 0x20000, 0xc33971c2, 4 | BRF_GRA }, // 11 - { "ik3-14.bin", 0x20000, 0x453bea77, 4 | BRF_GRA }, // 12 - { "ik3-15.bin", 0x20000, 0x781a81fc, 4 | BRF_GRA }, // 13 - { "ik3-16.bin", 0x20000, 0x80ba400b, 4 | BRF_GRA }, // 14 - { "ik3-17.bin", 0x20000, 0x0cc3ce4a, 4 | BRF_GRA }, // 15 - { "ik3-18.bin", 0x20000, 0xba106245, 4 | BRF_GRA }, // 16 - { "ik3-23.bin", 0x20000, 0xd0fd5c77, 4 | BRF_GRA }, // 17 - { "ik3-22.bin", 0x20000, 0x4878d883, 4 | BRF_GRA }, // 18 - { "ik3-21.bin", 0x20000, 0x50d0fbf0, 4 | BRF_GRA }, // 19 - { "ik3-20.bin", 0x20000, 0x9a851efc, 4 | BRF_GRA }, // 20 - { "ik3-19.bin", 0x20000, 0x4ebdba89, 4 | BRF_GRA }, // 21 - { "ik3-24.bin", 0x20000, 0xe9b26d68, 4 | BRF_GRA }, // 22 - { "ik3-25.bin", 0x20000, 0x073b03f1, 4 | BRF_GRA }, // 23 - { "ik3-26.bin", 0x20000, 0x9c613561, 4 | BRF_GRA }, // 24 - { "ik3-27.bin", 0x20000, 0x16dd227e, 4 | BRF_GRA }, // 25 - { "ik3-28.bin", 0x20000, 0x711715ae, 4 | BRF_GRA }, // 26 - - { "ik3-6.bin", 0x20000, 0x59d256a4, 5 | BRF_SND }, // 27 upd7759 samples -}; - -STD_ROM_PICK(ikari3j) -STD_ROM_FN(ikari3j) - -struct BurnDriver BurnDrvikari3j = { - "ikari3j", "ikari3", NULL, NULL, "1989", - "Ikari Three - The Rescue (Japan, Rotary Joystick)\0", NULL, "SNK", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, - NULL, ikari3jRomInfo, ikari3jRomName, NULL, NULL, IkariInputInfo, IkariDIPInfo, - ikari3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x800, 256, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "upd7759.h" + +// To Do: +// Analog Inputs +// Fix savestates (crash due to snd?) + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvInputs[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; +static UINT32 nAnalogAxis[2] = {0,0}; +static UINT16 DrvAxis[2]; + +static INT32 Rotary1 = 0; +static INT32 Rotary1OldVal = 0; +static INT32 Rotary2 = 0; +static INT32 Rotary2OldVal = 0; + +static UINT8 *Mem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KRom; +static UINT8 *Drv68KRomBank; +static UINT8 *DrvZ80Rom; +static UINT8 *Drv68KRam; +static UINT8 *DrvVidRam; +static UINT8 *DrvSprRam; +static UINT8 *DrvPalRam; +static UINT8 *DrvZ80Ram; +static UINT8 *DrvGfx0; +static UINT8 *DrvGfx0Trans; +static UINT8 *DrvGfx1; +static UINT8 *DrvSnd0; + +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static INT32 game_select; + +static INT32 invert_controls; +static INT32 soundlatch; +static INT32 flipscreen; +static INT32 sprite_flip; +static INT32 pow_charbase; + +#define A(a, b, c, d) { a, b, (UINT8*)(c), d } + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up", }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down", }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up", }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down", }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 3"}, + + {"Service 1", BIT_DIGITAL, DrvJoy3 + 0, "service" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo IkariInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up", }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down", }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 3"}, + + A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 z-axis"), + + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up", }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down", }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 3"}, + + A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 1, "p2 z-axis"), + + {"Service 1", BIT_DIGITAL, DrvJoy3 + 0, "service" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Ikari) + + +static struct BurnDIPInfo PowDIPList[]= +{ + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x14, 0x01, 0x03, 0x00, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x03, 0x03, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x14, 0x01, 0x0c, 0x0c, "4 Coins 1 Credit" }, + {0x14, 0x01, 0x0c, 0x04, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x0c, 0x00, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x14, 0x01, 0x10, 0x00, "2" }, + {0x14, 0x01, 0x10, 0x10, "3" }, + + {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, + {0x14, 0x01, 0x14, 0x00, "1st & 2nd only" }, + {0x14, 0x01, 0x14, 0x14, "1st & every 2nd" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x14, 0x01, 0x40, 0x00, "English" }, + {0x14, 0x01, 0x40, 0x40, "Japanese" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x80, 0x00, "Off" }, + {0x14, 0x01, 0x80, 0x80, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x01, 0x00, "Off" }, + {0x15, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x02, 0x02, "No" }, + {0x15, 0x01, 0x02, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x15, 0x01, 0x0c, 0x00, "20k 50k" }, + {0x15, 0x01, 0x0c, 0x08, "40k 100k" }, + {0x15, 0x01, 0x0c, 0x04, "60k 150k" }, + {0x15, 0x01, 0x0c, 0x0c, "None" }, + + {0 , 0xfe, 0 , 4 , "Game Mode" }, + {0x15, 0x01, 0x30, 0x00, "Demo Sounds On" }, + {0x15, 0x01, 0x30, 0x14, "Demo Sounds Off" }, + {0x15, 0x01, 0x30, 0x30, "Freeze" }, + {0x15, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0xc0, 0x80, "Easy" }, + {0x15, 0x01, 0xc0, 0x00, "Normal" }, + {0x15, 0x01, 0xc0, 0x40, "Hard" }, + {0x15, 0x01, 0xc0, 0xc0, "Hardest" }, +}; + +STDDIPINFO(Pow) + + +static struct BurnDIPInfo PowjDIPList[]= +{ + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x14, 0x01, 0x03, 0x00, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x03, 0x03, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x14, 0x01, 0x0c, 0x0c, "4 Coins 1 Credit" }, + {0x14, 0x01, 0x0c, 0x04, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x0c, 0x00, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x14, 0x01, 0x10, 0x00, "2" }, + {0x14, 0x01, 0x10, 0x10, "3" }, + + {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, + {0x14, 0x01, 0x14, 0x00, "1st & 2nd only" }, + {0x14, 0x01, 0x14, 0x14, "1st & every 2nd" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x80, 0x00, "Off" }, + {0x14, 0x01, 0x80, 0x80, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x01, 0x00, "Off" }, + {0x15, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x02, 0x02, "No" }, + {0x15, 0x01, 0x02, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x15, 0x01, 0x0c, 0x00, "20k 50k" }, + {0x15, 0x01, 0x0c, 0x08, "40k 100k" }, + {0x15, 0x01, 0x0c, 0x04, "60k 150k" }, + {0x15, 0x01, 0x0c, 0x0c, "None" }, + + {0 , 0xfe, 0 , 4 , "Game Mode" }, + {0x15, 0x01, 0x30, 0x00, "Demo Sounds On" }, + {0x15, 0x01, 0x30, 0x14, "Demo Sounds Off" }, + {0x15, 0x01, 0x30, 0x30, "Freeze" }, + {0x15, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0xc0, 0x80, "Easy" }, + {0x15, 0x01, 0xc0, 0x00, "Normal" }, + {0x15, 0x01, 0xc0, 0x40, "Hard" }, + {0x15, 0x01, 0xc0, 0xc0, "Hardest" }, +}; + +STDDIPINFO(Powj) + +static struct BurnDIPInfo StreetsmDIPList[]= +{ + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x03, 0x02, "1" }, + {0x14, 0x01, 0x03, 0x00, "2" }, + {0x14, 0x01, 0x03, 0x01, "3" }, + {0x14, 0x01, 0x03, 0x03, "4" }, + + {0 , 0xfe, 0 , 4 , "Coin A & B" }, + {0x14, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x0c, 0x00, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0c, 0x0c, "Free Play" }, + + {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, + {0x14, 0x01, 0x14, 0x00, "1st & 2nd only" }, + {0x14, 0x01, 0x14, 0x14, "1st & every 2nd" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x80, 0x00, "Off" }, + {0x14, 0x01, 0x80, 0x80, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x01, 0x00, "Off" }, + {0x15, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x02, 0x02, "No" }, + {0x15, 0x01, 0x02, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x15, 0x01, 0x0c, 0x00, "200k 400k" }, + {0x15, 0x01, 0x0c, 0x08, "400k 500k" }, + {0x15, 0x01, 0x0c, 0x04, "600k 800k" }, + {0x15, 0x01, 0x0c, 0x0c, "None" }, + + {0 , 0xfe, 0 , 4 , "Game Mode" }, + {0x15, 0x01, 0x30, 0x14, "Demo Sounds Off" }, + {0x15, 0x01, 0x30, 0x00, "Demo Sounds On" }, + {0x15, 0x01, 0x30, 0x30, "Freeze" }, + {0x15, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0xc0, 0x80, "Easy" }, + {0x15, 0x01, 0xc0, 0x00, "Normal" }, + {0x15, 0x01, 0xc0, 0x40, "Hard" }, + {0x15, 0x01, 0xc0, 0xc0, "Hardest" }, +}; + +STDDIPINFO(Streetsm) + +static struct BurnDIPInfo StreetsjDIPList[]= +{ + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x03, 0x02, "1" }, + {0x14, 0x01, 0x03, 0x00, "2" }, + {0x14, 0x01, 0x03, 0x01, "3" }, + {0x14, 0x01, 0x03, 0x03, "4" }, + + {0 , 0xfe, 0 , 4 , "Coin A & B" }, + {0x14, 0x01, 0x0c, 0x0c, "A 4/1 B 1/4" }, + {0x14, 0x01, 0x0c, 0x04, "A 3/1 B 1/3" }, + {0x14, 0x01, 0x0c, 0x08, "A 2/1 B 1/2" }, + {0x14, 0x01, 0x0c, 0x00, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, + {0x14, 0x01, 0x14, 0x00, "1st & 2nd only" }, + {0x14, 0x01, 0x14, 0x14, "1st & every 2nd" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x80, 0x00, "Off" }, + {0x14, 0x01, 0x80, 0x80, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x01, 0x00, "Off" }, + {0x15, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x02, 0x02, "No" }, + {0x15, 0x01, 0x02, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x15, 0x01, 0x0c, 0x00, "200k 400k" }, + {0x15, 0x01, 0x0c, 0x08, "400k 500k" }, + {0x15, 0x01, 0x0c, 0x04, "600k 800k" }, + {0x15, 0x01, 0x0c, 0x0c, "None" }, + + {0 , 0xfe, 0 , 4 , "Game Mode" }, + {0x15, 0x01, 0x30, 0x14, "Demo Sounds Off" }, + {0x15, 0x01, 0x30, 0x00, "Demo Sounds On" }, + {0x15, 0x01, 0x30, 0x30, "Freeze" }, + {0x15, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0xc0, 0x80, "Easy" }, + {0x15, 0x01, 0xc0, 0x00, "Normal" }, + {0x15, 0x01, 0xc0, 0x40, "Hard" }, + {0x15, 0x01, 0xc0, 0xc0, "Hardest" }, +}; + +STDDIPINFO(Streetsj) + +static struct BurnDIPInfo SarDIPList[]= +{ + {0x16, 0xff, 0xff, 0x00, NULL }, + {0x17, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 2 , "Joystick" }, + {0x16, 0x01, 0x01, 0x00, "Rotary" }, + {0x16, 0x01, 0x01, 0x01, "Standard" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x0c, 0x08, "2" }, + {0x16, 0x01, 0x0c, 0x00, "3" }, + {0x16, 0x01, 0x0c, 0x04, "4" }, + {0x16, 0x01, 0x0c, 0x0c, "5" }, + + {0 , 0xfe, 0 , 4 , "Coin A & B" }, + {0x16, 0x01, 0x30, 0x16, "2 Coins 1 Credit" }, + {0x16, 0x01, 0x30, 0x00, "1 Coin 1 Credit" }, + {0x16, 0x01, 0x30, 0x10, "1 Coin 2 Credits" }, + {0x16, 0x01, 0x30, 0x30, "Free Play" }, + + {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, + {0x16, 0x01, 0x40, 0x00, "1st & 2nd only" }, + {0x16, 0x01, 0x40, 0x40, "1st & every 2nd" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x16, 0x01, 0x80, 0x00, "Off" }, + {0x16, 0x01, 0x80, 0x80, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x17, 0x01, 0x01, 0x00, "Off" }, + {0x17, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x17, 0x01, 0x02, 0x02, "No" }, + {0x17, 0x01, 0x02, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x17, 0x01, 0x0c, 0x00, "50k 200k" }, + {0x17, 0x01, 0x0c, 0x08, "70k 270k" }, + {0x17, 0x01, 0x0c, 0x04, "90k 350k" }, + {0x17, 0x01, 0x0c, 0x0c, "None" }, + + {0 , 0xfe, 0 , 4 , "Game Mode" }, + {0x17, 0x01, 0x30, 0x16, "Demo Sounds Off" }, + {0x17, 0x01, 0x30, 0x00, "Demo Sounds On" }, + {0x17, 0x01, 0x30, 0x30, "Freeze" }, + {0x17, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x17, 0x01, 0xc0, 0x80, "Easy" }, + {0x17, 0x01, 0xc0, 0x00, "Normal" }, + {0x17, 0x01, 0xc0, 0x40, "Hard" }, + {0x17, 0x01, 0xc0, 0xc0, "Hardest" }, +}; + +STDDIPINFO(Sar) + +static struct BurnDIPInfo IkariDIPList[]= +{ + {0x16, 0xff, 0xff, 0x00, NULL }, + {0x17, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x00, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x03, "5" }, + + {0 , 0xfe, 0 , 4 , "Coin A & B" }, + {0x16, 0x01, 0x0c, 0x08, "First 2C_1C, then 1C_1C"}, + {0x16, 0x01, 0x0c, 0x00, "1 Coin 1 Credit" }, + {0x16, 0x01, 0x0c, 0x04, "First 1C_2C, then 1C_1C"}, + {0x16, 0x01, 0x0c, 0x0c, "Free Play" }, + + {0 , 0xfe, 0 , 2 , "Bonus Ocurrence" }, + {0x16, 0x01, 0x16, 0x00, "1st & 2nd only" }, + {0x16, 0x01, 0x16, 0x16, "1st & every 2nd" }, + + {0 , 0xfe, 0 , 2 , "Blood" }, + {0x16, 0x01, 0x40, 0x40, "Off" }, + {0x16, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x16, 0x01, 0x80, 0x00, "Off" }, + {0x16, 0x01, 0x80, 0x80, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x17, 0x01, 0x01, 0x00, "Off" }, + {0x17, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x17, 0x01, 0x02, 0x02, "No" }, + {0x17, 0x01, 0x02, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x17, 0x01, 0x0c, 0x00, "20k 50k" }, + {0x17, 0x01, 0x0c, 0x08, "40k 100k" }, + {0x17, 0x01, 0x0c, 0x04, "60k 150k" }, + {0x17, 0x01, 0x0c, 0x0c, "None" }, + + {0 , 0xfe, 0 , 4 , "Game Mode" }, + {0x17, 0x01, 0x30, 0x16, "Demo Sounds Off" }, + {0x17, 0x01, 0x30, 0x00, "Demo Sounds On" }, + {0x17, 0x01, 0x30, 0x30, "Freeze" }, + {0x17, 0x01, 0x30, 0x10, "Infinite Lives (Cheat)" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x17, 0x01, 0xc0, 0x00, "Easy" }, + {0x17, 0x01, 0xc0, 0x80, "Normal" }, + {0x17, 0x01, 0xc0, 0x40, "Hard" }, + {0x17, 0x01, 0xc0, 0xc0, "Hardest" }, +}; + +STDDIPINFO(Ikari) + + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + DrvRecalc = 1; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + UPD7759Reset(); + + soundlatch = 0; + flipscreen = 0; + sprite_flip = 0; + pow_charbase = 0; + invert_controls = 0; + + nAnalogAxis[1] = 0; + nAnalogAxis[0] = 0; + + return 0; +} + +void pow_paletteram16_word_w(UINT32 address) +{ + INT32 r,g,b; + UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRam + (address & 0x0ffe)))); + + r = ((data >> 7) & 0x1e) | ((data >> 14) & 0x01); + g = ((data >> 3) & 0x1e) | ((data >> 13) & 0x01); + b = ((data << 1) & 0x1e) | ((data >> 12) & 0x01); + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + Palette[(address >> 1) & 0x7ff] = (r << 16) | (g << 8) | b; + DrvPalette[(address >> 1) & 0x7ff] = BurnHighCol(r, g, b, 0); +} + +void __fastcall pow_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xffff8000) == 0x100000 && game_select & 1) { + if (!(address & 2)) + data |= 0xff00; + + *((UINT16 *)(DrvSprRam + (address & 0x7fff))) = BURN_ENDIAN_SWAP_INT16(data); + + return; + } + + if ((address & 0xfffff000) == 0x400000) { + *((UINT16 *)(DrvPalRam + (address & 0x0ffe))) = BURN_ENDIAN_SWAP_INT16(data); + + pow_paletteram16_word_w(address); + + return; + } +} + +void __fastcall pow_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xffff8000) == 0x100000 && game_select == 1) { + if ((address & 3) == 3) data = 0xff; + + DrvSprRam[address & 0x7fff] = data; + + return; + } + + if ((address & 0xfffff000) == 0x400000) { + DrvPalRam[address & 0x0fff] = data; + + pow_paletteram16_word_w(address); + + return; + } + + switch (address) + { + case 0x080000: + soundlatch = data; + ZetNmi(); + return; + + case 0x080007: + invert_controls = ((data & 0xff) == 0x07) ? 0xff : 0x00; + return; + + case 0x0c0001: + flipscreen = data & 8; + sprite_flip = data & 4; + pow_charbase = (data & 0x70) << 4; + return; + } +} + + +UINT16 __fastcall pow_read_word(UINT32 address) +{ + bprintf (PRINT_NORMAL, _T("read %x, w\n"), address); + + return 0; +} + +UINT8 __fastcall pow_read_byte(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[1]; + + case 0x080001: + return DrvInputs[0]; + + case 0x0c0000: + case 0x0c0001: + return DrvInputs[2]; + + case 0x0e0000: + case 0x0e0001: + case 0x0e8000: + case 0x0e8001: + return 0xff; + + case 0x0f0000: + case 0x0f0001: + return DrvDips[0]; + + case 0x0f0008: + case 0x0f0009: + return DrvDips[1]; + } + + return 0; +} + +UINT8 __fastcall sar_read_byte(UINT32 address) +{ + switch (address) + { + case 0x080001: + case 0x080003: + case 0x080005: + return DrvInputs[(address >> 1) & 3] ^ invert_controls; + + case 0x0c0000: { + INT32 RetVal = Rotary1; + RetVal = (~(1 << RetVal)) & 0xff; + return (UINT8)RetVal; + } + + case 0x0c8000: { + INT32 RetVal = Rotary2; + RetVal = (~(1 << RetVal)) & 0xff; + return (UINT8)RetVal; + } + + case 0x0d0000: { + INT32 RetVal = 0xff; + + if (Rotary1 == 8) RetVal -= 0x01; + if (Rotary1 == 9) RetVal -= 0x02; + if (Rotary1 == 10) RetVal -= 0x04; + if (Rotary1 == 11) RetVal -= 0x08; + + if (Rotary2 == 8) RetVal -= 0x10; + if (Rotary2 == 9) RetVal -= 0x20; + if (Rotary2 == 10) RetVal -= 0x40; + if (Rotary2 == 11) RetVal -= 0x80; + return (UINT8)RetVal; + } + + case 0x0f0000: + case 0x0f0001: + return DrvDips[0]; + + case 0x0f0008: + case 0x0f0009: + return DrvDips[1]; + + case 0x0f8000: + return 1; + } + + return 0; +} + +void __fastcall pow_sound_write(UINT16, UINT8) +{ +} + +void __fastcall pow_sound_out(UINT16 address, UINT8 data) +{ + switch (address & 0xff) + { + case 0x00: + case 0x20: + BurnYM3812Write((address >> 5) & 1, data); + return; + + case 0x40: + UPD7759PortWrite(0, data); + UPD7759StartWrite(0, 0); + UPD7759StartWrite(0, 1); + return; + + case 0x80: + UPD7759ResetWrite(0, data); + return; + } + +} + +UINT8 __fastcall pow_sound_read(UINT16 address) +{ + if (address == 0xf800) return soundlatch; + + return 0; +} + +UINT8 __fastcall pow_sound_in(UINT16 address) +{ + address &= 0xff; + + if (address == 0x0000) return BurnYM3812Read(0); + + return 0; +} + +static void powFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 powSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static INT32 DrvGfxDecode(INT32 *spriPlanes, INT32 *spriXOffs, INT32 *spriYOffs, INT32 modulo) +{ + static INT32 tilePlanes[4] = { 0x00000, 0x00004, 0x40000, 0x40004 }; + static INT32 tileXOffs[8] = { 0x43, 0x42, 0x41, 0x40, 0x03, 0x02, 0x01, 0x00 }; + static INT32 tileYOffs[8] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x300000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfx0, 0x010000); + + GfxDecode(0x0800, 4, 8, 8, tilePlanes, tileXOffs, tileYOffs, 0x0080, tmp, DrvGfx0); + + memcpy (tmp, DrvGfx1, 0x300000); + + GfxDecode(0x6000, 4, 16, 16, spriPlanes, spriXOffs, spriYOffs, modulo, tmp, DrvGfx1); + + BurnFree (tmp); + + memset (DrvGfx0Trans, 1, 0x800); + for (INT32 i = 0; i < 0x20000; i++) { + if (DrvGfx0[i]) { + DrvGfx0Trans[i>>6] = 0; + i|=0x3f; + } + } + + return 0; +} + +static INT32 PowGfxDecode() +{ + static INT32 spriPlanes[4] = { 0x000000, 0x400000, 0x800000, 0xc00000 }; + static INT32 spriXOffs[16] = { 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80, + 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }; + static INT32 spriYOffs[16] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, + 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78 }; + + return DrvGfxDecode(spriPlanes, spriXOffs, spriYOffs, 0x100); +} + +static INT32 SarGfxDecode() +{ + static INT32 spriPlanes[4] = { 0x000000, 0x000008,0xc00000, 0xc00008 }; + static INT32 spriXOffs[16] = { 0x107, 0x106, 0x105, 0x104, 0x103, 0x102, 0x101, 0x100, + 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000 }; + static INT32 spriYOffs[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, + 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0 }; + + return DrvGfxDecode(spriPlanes, spriXOffs, spriYOffs, 0x200); +} + +static INT32 IkariGfxDecode() +{ + static INT32 spriPlanes[4] = { 0xa00000, 0x000000, 0x500000, 0xf00000 }; + static INT32 spriXOffs[16] = { 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80, + 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }; + static INT32 spriYOffs[16] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, + 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78 }; + + return DrvGfxDecode(spriPlanes, spriXOffs, spriYOffs, 0x100); +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x040000; + Drv68KRomBank = Next; Next += 0x040000; + DrvZ80Rom = Next; Next += 0x010000; + + DrvGfx0 = Next; Next += 0x020000; + DrvGfx1 = Next; Next += 0x600000; + + DrvGfx0Trans = Next; Next += 0x000800; + + DrvSnd0 = Next; Next += 0x020000; + + AllRam = Next; + + Drv68KRam = Next; Next += 0x004000; + DrvVidRam = Next; Next += 0x001000; + DrvSprRam = Next; Next += 0x008000; + DrvPalRam = Next; Next += 0x001000; + + DrvZ80Ram = Next; Next += 0x000800; + + Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + + RamEnd = Next; + + DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + + +static void pow_map_68k() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRam, 0x040000, 0x043fff, SM_RAM); + SekMapMemory(DrvVidRam, 0x100000, 0x100fff, SM_RAM); // video ram + SekMapMemory(DrvSprRam, 0x200000, 0x207fff, SM_RAM); // sprite ram + SekMapMemory(DrvPalRam, 0x400000, 0x400fff, SM_ROM); // palette ram + SekSetWriteByteHandler(0, pow_write_byte); + SekSetWriteWordHandler(0, pow_write_word); + SekSetReadByteHandler(0, pow_read_byte); + SekSetReadWordHandler(0, pow_read_word); + SekClose(); +} + +static void sar_map_68k() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRam, 0x040000, 0x043fff, SM_RAM); + SekMapMemory(DrvSprRam, 0x100000, 0x107fff, SM_ROM); // sprite ram + SekMapMemory(DrvVidRam, 0x200000, 0x200fff, SM_RAM); // video ram + SekMapMemory(DrvVidRam, 0x201000, 0x201fff, SM_WRITE); // video ram mirror + SekMapMemory(Drv68KRomBank, 0x300000, 0x33ffff, SM_ROM); // extra rom + SekMapMemory(DrvPalRam, 0x400000, 0x400fff, SM_ROM); // palette ram + SekSetWriteByteHandler(0, pow_write_byte); + SekSetWriteWordHandler(0, pow_write_word); + SekSetReadByteHandler(0, sar_read_byte); + SekSetReadWordHandler(0, pow_read_word); + SekClose(); +} + + +static INT32 DrvGetRoms() +{ + char* pRomName; + struct BurnRomInfo ri; + UINT8 *LoadP0 = Drv68KRom; + UINT8 *LoadP1 = DrvZ80Rom; + UINT8 *LoadG0 = DrvGfx0; + UINT8 *LoadG1 = DrvGfx1; + UINT8 *LoadS0 = DrvSnd0; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & 7) == 1) { + if (BurnLoadRom(LoadP0 + 1, i + 0, 2)) return 1; + if (BurnLoadRom(LoadP0 + 0, i + 1, 2)) return 1; + LoadP0 += ri.nLen * 2; + i++; + continue; + } + + if ((ri.nType & 7) == 2) { + if (BurnLoadRom(LoadP1, i, 1)) return 1; + LoadP1 += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 3) { + if (BurnLoadRom(LoadG0, i, 1)) return 1; + LoadG0 += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 4) { + if (BurnLoadRom(LoadG1, i, 1)) return 1; + LoadG1 += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 5) { + if (BurnLoadRom(LoadS0, i, 1)) return 1; + LoadS0 += ri.nLen; + continue; + } + } + + return 0; +} + +static INT32 DrvInit(INT32 game) +{ + game_select = game; + + Mem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + if (DrvGetRoms()) return 1; + + switch (game_select) + { + case 0: // Pow + if (PowGfxDecode()) return 1; + pow_map_68k(); + break; + + case 1: // searchar + if (SarGfxDecode()) return 1; + sar_map_68k(); + break; + + case 2: // streets + if (SarGfxDecode()) return 1; + pow_map_68k(); + break; + + case 3: // ikari + if (IkariGfxDecode()) return 1; + sar_map_68k(); + break; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram); + ZetSetWriteHandler(pow_sound_write); + ZetSetReadHandler(pow_sound_read); + ZetSetInHandler(pow_sound_in); + ZetSetOutHandler(pow_sound_out); + ZetClose(); + + BurnYM3812Init(4000000, &powFMIRQHandler, &powSynchroniseStream, 0); + BurnTimerAttachZetYM3812(4000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvSnd0); + UPD7759SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + BurnYM3812Exit(); + UPD7759Exit(); + + GenericTilesExit(); + SekExit(); + ZetExit(); + + BurnFree (Mem); + + game_select = 0; + + return 0; +} + + +static void pow_sprites(INT32 j, INT32 pos) +{ + INT32 offs,mx,my,color,tile,fx,fy,i; + + UINT16 *spriteram16 = (UINT16*)(DrvSprRam); + + for (offs = pos; offs < pos+0x800; offs += 0x80 ) + { + mx=(BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+4+(4*j))>>1])&0xff)<<4; + my=BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+6+(4*j))>>1]); + mx=mx+(my>>12); + mx=((mx+16)&0x1ff)-16; + + mx=((mx+0x100)&0x1ff)-0x100; + my=((my+0x100)&0x1ff)-0x100; + + my=0x200 - my; + my-=0x200; + + if (flipscreen) { + mx=240-mx; + my=240-my; + } + + my -= 16; + + for (i = 0; i < 0x80; i+=4) + { + color = BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+i+(0x1000*j)+0x1000)>>1])&0x7f; + + if (color) + { + tile=BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+2+i+(0x1000*j)+0x1000)>>1]); + fy=tile&0x8000; + fx=tile&0x4000; + tile&=0x3fff; + + if (flipscreen) { + if (fx) fx=0; else fx=1; + if (fy) fy=0; else fy=1; + } + + if (mx > -16 && mx < 256 && my > -16 && my < 224) { + if (fy) { + if (fx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); + } + } else { + if (fx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); + } + } + } + } + + if (flipscreen) { + my-=16; + if (my < -0x100) my+=0x200; + } + else { + my+=16; + if (my > 0x100) my-=0x200; + } + } + } +} + +static void sar_sprites(INT32 j, INT32 z, INT32 pos) +{ + INT32 offs,mx,my,color,tile,fx,fy,i; + + UINT16 *spriteram16 = (UINT16*)(DrvSprRam); + + for (offs = pos; offs < pos+0x800 ; offs += 0x80 ) + { + mx=BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+j)>>1]); + my=BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+j+2)>>1]); + + mx=mx<<4; + mx=mx|((my>>12)&0xf); + my=my&0x1ff; + + mx=(mx+0x100)&0x1ff; + my=(my+0x100)&0x1ff; + mx-=0x100; + my-=0x100; + my=0x200 - my; + my-=0x200; + + if (flipscreen) { + mx=240-mx; + my=240-my; + } + + my -= 16; + + for (i = 0; i < 0x80; i += 4) + { + color = BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+i+z)>>1]) & 0x7f; + + if (color) + { + tile = BURN_ENDIAN_SWAP_INT16(spriteram16[(offs+2+i+z)>>1]); + + if (sprite_flip) { + fx=0; + fy=tile&0x8000; + } else { + fy=0; + fx=tile&0x8000; + } + + if (flipscreen) { + if (fx) fx=0; else fx=1; + if (fy) fy=0; else fy=1; + } + + tile&=0x7fff; + if (tile>0x5fff) break; + + if (mx > -16 && mx < 256 && my > -16 && my < 224) { + if (fy) { + if (fx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); + } + } else { + if (fx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, tile, mx, my, color, 4, 0, 0, DrvGfx1); + } + } + } + } + + if (flipscreen) { + my-=16; + if (my < -0x100) my+=0x200; + } + else { + my+=16; + if (my > 0x100) my-=0x200; + } + } + } +} + +static void pow_foreground() +{ + UINT16 *vidram = (UINT16*)DrvVidRam; + + for (INT32 offs = 0; offs < 0x1000 / 2; offs+=2) + { + INT32 sy = (offs << 2) & 0xf8; + INT32 sx = (offs >> 3) & 0xf8; + + if (flipscreen) { + sy ^= 0xf8; + sx ^= 0xf8; + } + + if (sy < 16 || sy > 239) continue; + sy -= 16; + + INT32 code = (BURN_ENDIAN_SWAP_INT16(vidram[offs | 0]) & 0xff) | pow_charbase; + INT32 color = BURN_ENDIAN_SWAP_INT16(vidram[offs | 1]) & 0x0f; + + if (DrvGfx0Trans[code]) continue; + + if (flipscreen) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfx0); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfx0); + } + } +} + +static void sar_foreground() +{ + UINT16 *vidram = (UINT16*)DrvVidRam; + + for (INT32 offs = 0; offs < 0x1000 / 2; offs+=2) + { + INT32 sy = (offs << 2) & 0xf8; + INT32 sx = (offs >> 3) & 0xf8; + + if (flipscreen) { + sy ^= 0xf8; + sx ^= 0xf8; + } + + if (sy < 16 || sy > 239) continue; + sy -= 16; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vidram[offs]); + INT32 color = code >> 12; + + // kludge for bad tile (ikari) + if (code == 0x80ff) { + code = 0x02ca; + color = 0x07; + } + + code &= 0x0fff; + + if (DrvGfx0Trans[code]) continue; + + if (flipscreen) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfx0); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfx0); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x800; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + for (INT32 offs = 0; offs < nScreenHeight * nScreenWidth; offs++) { + pTransDraw[offs] = 0x7ff; + } + + if (!game_select) { + pow_sprites(1, 0x000); + pow_sprites(1, 0x800); + pow_sprites(2, 0x000); + pow_sprites(2, 0x800); + pow_sprites(0, 0x000); + pow_sprites(0, 0x800); + } else { + sar_sprites(8, 0x2000, 0x000); + sar_sprites(8, 0x2000, 0x800); + sar_sprites(12,0x3000, 0x000); + sar_sprites(12,0x3000, 0x800); + sar_sprites(4, 0x1000, 0x000); + sar_sprites(4, 0x1000, 0x800); + } + + if (game_select & 1) { + sar_foreground(); + } else { + pow_foreground(); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= DrvJoy1[i] << i; + DrvInputs[1] ^= DrvJoy2[i] << i; + DrvInputs[2] ^= DrvJoy3[i] << i; + } + + nAnalogAxis[0] -= DrvAxis[0]; + DrvInputs[6] = (~nAnalogAxis[0] >> 8) & 0xfe; + + nAnalogAxis[1] -= DrvAxis[1]; + DrvInputs[7] = (~nAnalogAxis[1] >> 8) & 0xfe; + } + + if (game_select == 1 || game_select == 3) { + if ((DrvInputs[6] >> 4) < Rotary1OldVal) { + Rotary1++; + } + + if ((DrvInputs[6] >> 4) > Rotary1OldVal) { + Rotary1--; + } + Rotary1OldVal = DrvInputs[6] >> 4; + if (Rotary1 > 11) Rotary1 = 0; + if (Rotary1 < 0) Rotary1 = 11; + + if ((DrvInputs[7] >> 4) < Rotary2OldVal) { + Rotary2++; + } + + if ((DrvInputs[7] >> 4) > Rotary2OldVal) { + Rotary2--; + } + Rotary2OldVal = DrvInputs[7] >> 4; + if (Rotary2 > 11) Rotary2 = 0; + if (Rotary2 < 0) Rotary2 = 11; + } + + INT32 nTotalCycles[2] = { ((game_select == 1) ? 9000000 : 10000000) / 60, 4000000 / 60 }; + + SekOpen(0); + ZetOpen(0); + + SekNewFrame(); + ZetNewFrame(); + + SekRun(nTotalCycles[0]); + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrameYM3812(nTotalCycles[1]); + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + UPD7759Update(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029682; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + if (nAction & ACB_WRITE) + DrvRecalc = 1; + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM3812Scan(nAction, pnMin); + UPD7759Scan(0, nAction, pnMin); + + SCAN_VAR(invert_controls); + SCAN_VAR(soundlatch); + SCAN_VAR(flipscreen); + SCAN_VAR(sprite_flip); + SCAN_VAR(pow_charbase); + SCAN_VAR(nAnalogAxis[0]); + SCAN_VAR(nAnalogAxis[1]); + SCAN_VAR(Rotary1); + SCAN_VAR(Rotary1OldVal); + SCAN_VAR(Rotary2); + SCAN_VAR(Rotary2OldVal); + } + + return 0; +} + + +// P.O.W. - Prisoners of War (US version 1) + +static struct BurnRomInfo powRomDesc[] = { + { "dg1ver1.j14", 0x20000, 0x8e71a8af, 1 | BRF_PRG }, // 0 68k COde + { "dg2ver1.l14", 0x20000, 0x4287affc, 1 | BRF_PRG }, // 1 + + { "dg8.e25", 0x10000, 0xd1d61da3, 2 | BRF_PRG }, // 2 Z80 Code + + { "dg9.l25", 0x08000, 0xdf864a08, 3 | BRF_GRA }, // 3 Characters + { "dg10.m25", 0x08000, 0x9e470d53, 3 | BRF_GRA }, // 4 + + { "snk880.11a", 0x20000, 0xe70fd906, 4 | BRF_GRA }, // 5 Sprites + { "snk880.12a", 0x20000, 0x628b1aed, 4 | BRF_GRA }, // 6 + { "snk880.13a", 0x20000, 0x19dc8868, 4 | BRF_GRA }, // 7 + { "snk880.14a", 0x20000, 0x47cd498b, 4 | BRF_GRA }, // 8 + { "snk880.15a", 0x20000, 0x7a90e957, 4 | BRF_GRA }, // 9 + { "snk880.16a", 0x20000, 0xe40a6c13, 4 | BRF_GRA }, // 10 + { "snk880.17a", 0x20000, 0xc7931cc2, 4 | BRF_GRA }, // 11 + { "snk880.18a", 0x20000, 0xeed72232, 4 | BRF_GRA }, // 12 + { "snk880.19a", 0x20000, 0x1775b8dd, 4 | BRF_GRA }, // 13 + { "snk880.20a", 0x20000, 0xf8e752ec, 4 | BRF_GRA }, // 14 + { "snk880.21a", 0x20000, 0x27e9fffe, 4 | BRF_GRA }, // 15 + { "snk880.22a", 0x20000, 0xaa9c00d8, 4 | BRF_GRA }, // 16 + { "snk880.23a", 0x20000, 0xadb6ad68, 4 | BRF_GRA }, // 17 + { "snk880.24a", 0x20000, 0xdd41865a, 4 | BRF_GRA }, // 18 + { "snk880.25a", 0x20000, 0x055759ad, 4 | BRF_GRA }, // 19 + { "snk880.26a", 0x20000, 0x9bc261c5, 4 | BRF_GRA }, // 20 + + { "dg7.d20", 0x10000, 0xaba9a9d3, 5 | BRF_SND }, // 21 upd7759 samples + + { "pal20l10.a6", 0x000cc, 0xc3d9e729, 0 | BRF_OPT }, // 22 pld +}; + +STD_ROM_PICK(pow) +STD_ROM_FN(pow) + +static INT32 powInit() +{ + return DrvInit(0); +} + +struct BurnDriver BurnDrvpow = { + "pow", NULL, NULL, NULL, "1988", + "P.O.W. - Prisoners of War (US version 1)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, powRomInfo, powRomName, NULL, NULL, DrvInputInfo, PowDIPInfo, + powInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 256, 224, 4, 3 +}; + + +// Datsugoku - Prisoners of War (Japan) + +static struct BurnRomInfo powjRomDesc[] = { + { "1-2", 0x20000, 0x2f17bfb0, 1 | BRF_PRG }, // 0 68k Code + { "2-2", 0x20000, 0xbaa32354, 1 | BRF_PRG }, // 1 + + { "dg8.e25", 0x10000, 0xd1d61da3, 2 | BRF_PRG }, // 2 Z80 Code + + { "dg9.l25", 0x08000, 0xdf864a08, 3 | BRF_GRA }, // 3 Characters + { "dg10.m25", 0x08000, 0x9e470d53, 3 | BRF_GRA }, // 4 + + { "snk880.11a", 0x20000, 0xe70fd906, 4 | BRF_GRA }, // 5 Sprites + { "snk880.12a", 0x20000, 0x628b1aed, 4 | BRF_GRA }, // 6 + { "snk880.13a", 0x20000, 0x19dc8868, 4 | BRF_GRA }, // 7 + { "snk880.14a", 0x20000, 0x47cd498b, 4 | BRF_GRA }, // 8 + { "snk880.15a", 0x20000, 0x7a90e957, 4 | BRF_GRA }, // 9 + { "snk880.16a", 0x20000, 0xe40a6c13, 4 | BRF_GRA }, // 10 + { "snk880.17a", 0x20000, 0xc7931cc2, 4 | BRF_GRA }, // 11 + { "snk880.18a", 0x20000, 0xeed72232, 4 | BRF_GRA }, // 12 + { "snk880.19a", 0x20000, 0x1775b8dd, 4 | BRF_GRA }, // 13 + { "snk880.20a", 0x20000, 0xf8e752ec, 4 | BRF_GRA }, // 14 + { "snk880.21a", 0x20000, 0x27e9fffe, 4 | BRF_GRA }, // 15 + { "snk880.22a", 0x20000, 0xaa9c00d8, 4 | BRF_GRA }, // 16 + { "snk880.23a", 0x20000, 0xadb6ad68, 4 | BRF_GRA }, // 17 + { "snk880.24a", 0x20000, 0xdd41865a, 4 | BRF_GRA }, // 18 + { "snk880.25a", 0x20000, 0x055759ad, 4 | BRF_GRA }, // 19 + { "snk880.26a", 0x20000, 0x9bc261c5, 4 | BRF_GRA }, // 20 + + { "dg7.d20", 0x10000, 0xaba9a9d3, 5 | BRF_SND }, // 21 upd7759 samples + + { "pal20l10.a6", 0x000cc, 0xc3d9e729, 0 | BRF_OPT }, // 22 pld +}; + +STD_ROM_PICK(powj) +STD_ROM_FN(powj) + +struct BurnDriver BurnDrvpowj = { + "powj", "pow", NULL, NULL, "1988", + "Datsugoku - Prisoners of War (Japan)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, powjRomInfo, powjRomName, NULL, NULL, DrvInputInfo, PowjDIPInfo, + powInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 256, 224, 4, 3 +}; + + +// SAR - Search And Rescue (World) + +static struct BurnRomInfo searcharRomDesc[] = { + { "bhw.2", 0x20000, 0xe1430138, 1 | BRF_PRG }, // 0 68k Code + { "bhw.3", 0x20000, 0xee1f9374, 1 | BRF_PRG }, // 1 + { "bhw.1", 0x20000, 0x62b60066, 1 | BRF_PRG }, // 2 + { "bhw.4", 0x20000, 0x16d8525c, 1 | BRF_PRG }, // 3 + + { "bh.5", 0x10000, 0x53e2fa76, 2 | BRF_PRG }, // 4 Z80 Code + + { "bh.7", 0x08000, 0xb0f1b049, 3 | BRF_GRA }, // 5 Characters + { "bh.8", 0x08000, 0x174ddba7, 3 | BRF_GRA }, // 6 + + { "bh.c1", 0x80000, 0x1fb8f0ae, 4 | BRF_GRA }, // 7 Sprites + { "bh.c3", 0x80000, 0xfd8bc407, 4 | BRF_GRA }, // 8 + { "bh.c5", 0x80000, 0x1d30acc3, 4 | BRF_GRA }, // 9 + { "bh.c2", 0x80000, 0x7c803767, 4 | BRF_GRA }, // 10 + { "bh.c4", 0x80000, 0xeede7c43, 4 | BRF_GRA }, // 11 + { "bh.c6", 0x80000, 0x9f785cd9, 4 | BRF_GRA }, // 12 + + { "bh.v1", 0x20000, 0x07a6114b, 5 | BRF_SND }, // 13 upd7759 samples +}; + +STD_ROM_PICK(searchar) +STD_ROM_FN(searchar) + +static INT32 searcharInit() +{ + return DrvInit(1); +} + +struct BurnDriver BurnDrvsearchar = { + "searchar", NULL, NULL, NULL, "1989", + "SAR - Search And Rescue (World)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, searcharRomInfo, searcharRomName, NULL, NULL, IkariInputInfo, SarDIPInfo, + searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 224, 256, 3, 4 +}; + + +// SAR - Search And Rescue (US) + +static struct BurnRomInfo sercharuRomDesc[] = { + { "bh.2", 0x20000, 0xc852e2e2, 1 | BRF_PRG }, // 0 68k Code + { "bh.3", 0x20000, 0xbc04a4a1, 1 | BRF_PRG }, // 1 + { "bh.1", 0x20000, 0xba9ca70b, 1 | BRF_PRG }, // 2 + { "bh.4", 0x20000, 0xeabc5ddf, 1 | BRF_PRG }, // 3 + + { "bh.5", 0x10000, 0x53e2fa76, 2 | BRF_PRG }, // 4 Z80 Code + + { "bh.7", 0x08000, 0xb0f1b049, 3 | BRF_GRA }, // 5 Characters + { "bh.8", 0x08000, 0x174ddba7, 3 | BRF_GRA }, // 6 + + { "bh.c1", 0x80000, 0x1fb8f0ae, 4 | BRF_GRA }, // 7 Sprites + { "bh.c3", 0x80000, 0xfd8bc407, 4 | BRF_GRA }, // 8 + { "bh.c5", 0x80000, 0x1d30acc3, 4 | BRF_GRA }, // 9 + { "bh.c2", 0x80000, 0x7c803767, 4 | BRF_GRA }, // 10 + { "bh.c4", 0x80000, 0xeede7c43, 4 | BRF_GRA }, // 11 + { "bh.c6", 0x80000, 0x9f785cd9, 4 | BRF_GRA }, // 12 + + { "bh.v1", 0x20000, 0x07a6114b, 5 | BRF_SND }, // 13 upd7759 samples +}; + +STD_ROM_PICK(sercharu) +STD_ROM_FN(sercharu) + +struct BurnDriver BurnDrvsercharu = { + "searcharu", "searchar", NULL, NULL, "1989", + "SAR - Search And Rescue (US)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, sercharuRomInfo, sercharuRomName, NULL, NULL, IkariInputInfo, SarDIPInfo, + searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 224, 256, 3, 4 +}; + + +// SAR - Search And Rescue (Japan) + +static struct BurnRomInfo sercharjRomDesc[] = { + { "bh2ver3j.9c", 0x20000, 0x7ef7b172, 1 | BRF_PRG }, // 0 68k Code + { "bh3ver3j.10c",0x20000, 0x3fdea793, 1 | BRF_PRG }, // 1 + { "bhw.1", 0x20000, 0x62b60066, 1 | BRF_PRG }, // 2 + { "bhw.4", 0x20000, 0x16d8525c, 1 | BRF_PRG }, // 3 + + { "bh.5", 0x10000, 0x53e2fa76, 2 | BRF_PRG }, // 4 Z80 Code + + { "bh.7", 0x08000, 0xb0f1b049, 3 | BRF_GRA }, // 5 Characters + { "bh.8", 0x08000, 0x174ddba7, 3 | BRF_GRA }, // 6 + + { "bh.c1", 0x80000, 0x1fb8f0ae, 4 | BRF_GRA }, // 7 Sprites + { "bh.c3", 0x80000, 0xfd8bc407, 4 | BRF_GRA }, // 8 + { "bh.c5", 0x80000, 0x1d30acc3, 4 | BRF_GRA }, // 9 + { "bh.c2", 0x80000, 0x7c803767, 4 | BRF_GRA }, // 10 + { "bh.c4", 0x80000, 0xeede7c43, 4 | BRF_GRA }, // 11 + { "bh.c6", 0x80000, 0x9f785cd9, 4 | BRF_GRA }, // 12 + + { "bh.v1", 0x20000, 0x07a6114b, 5 | BRF_SND }, // 13 upd7759 samples +}; + +STD_ROM_PICK(sercharj) +STD_ROM_FN(sercharj) + +struct BurnDriver BurnDrvsercharj = { + "searcharj", "searchar", NULL, NULL, "1989", + "SAR - Search And Rescue (Japan)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, sercharjRomInfo, sercharjRomName, NULL, NULL, IkariInputInfo, SarDIPInfo, + searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 224, 256, 3, 4 +}; + + + +// Street Smart (US version 2) + +static struct BurnRomInfo streetsmRomDesc[] = { + { "s2-1ver2.14h", 0x20000, 0x655f4773, 1 | BRF_PRG }, // 0 68k Code + { "s2-2ver2.14k", 0x20000, 0xefae4823, 1 | BRF_PRG }, // 1 + + { "s2-5.16c", 0x10000, 0xca4b171e, 2 | BRF_PRG }, // 2 Z80 Code + + { "s2-9.25l", 0x08000, 0x09b6ac67, 3 | BRF_GRA }, // 3 Characters + { "s2-10.25m", 0x08000, 0x89e4ee6f, 3 | BRF_GRA }, // 4 + + { "stsmart.900", 0x80000, 0xa8279a7e, 4 | BRF_GRA }, // 5 Sprites + { "stsmart.902", 0x80000, 0x2f021aa1, 4 | BRF_GRA }, // 6 + { "stsmart.904", 0x80000, 0x167346f7, 4 | BRF_GRA }, // 7 + { "stsmart.901", 0x80000, 0xc305af12, 4 | BRF_GRA }, // 8 + { "stsmart.903", 0x80000, 0x73c16d35, 4 | BRF_GRA }, // 9 + { "stsmart.905", 0x80000, 0xa5beb4e2, 4 | BRF_GRA }, // 10 + + { "s2-6.18d", 0x20000, 0x47db1605, 5 | BRF_SND }, // 11 upd7759 samples + + { "pl20l10a.1n", 0x000cc, 0x00000000, 0 | BRF_NODUMP }, /* PAL is read protected */ +}; + +STD_ROM_PICK(streetsm) +STD_ROM_FN(streetsm) + +static INT32 streetsmInit() +{ + return DrvInit(2); +} + +struct BurnDriver BurnDrvstreetsm = { + "streetsm", NULL, NULL, NULL, "1989", + "Street Smart (US version 2)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_VSFIGHT, 0, + NULL, streetsmRomInfo, streetsmRomName, NULL, NULL, DrvInputInfo, StreetsmDIPInfo, + streetsmInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 256, 224, 4, 3 +}; + + +// Street Smart (US version 1) + +static struct BurnRomInfo streets1RomDesc[] = { + { "s2-1ver1.9c", 0x20000, 0xb59354c5, 1 | BRF_PRG }, // 0 68k Code + { "s2-2ver1.10c", 0x20000, 0xe448b68b, 1 | BRF_PRG }, // 1 + + { "s2-5.16c", 0x10000, 0xca4b171e, 2 | BRF_PRG }, // 2 Z80 Code + + { "s2-7.15l", 0x08000, 0x22bedfe5, 3 | BRF_GRA }, // 3 Characters + { "s2-8.15m", 0x08000, 0x6a1c70ab, 3 | BRF_GRA }, // 4 + + { "stsmart.900", 0x80000, 0xa8279a7e, 4 | BRF_GRA }, // 5 Sprites + { "stsmart.902", 0x80000, 0x2f021aa1, 4 | BRF_GRA }, // 6 + { "stsmart.904", 0x80000, 0x167346f7, 4 | BRF_GRA }, // 7 + { "stsmart.901", 0x80000, 0xc305af12, 4 | BRF_GRA }, // 8 + { "stsmart.903", 0x80000, 0x73c16d35, 4 | BRF_GRA }, // 9 + { "stsmart.905", 0x80000, 0xa5beb4e2, 4 | BRF_GRA }, // 10 + + { "s2-6.18d", 0x20000, 0x47db1605, 5 | BRF_SND }, // 11 upd7759 samples +}; + +STD_ROM_PICK(streets1) +STD_ROM_FN(streets1) + +struct BurnDriver BurnDrvstreets1 = { + "streetsm1", "streetsm", NULL, NULL, "1989", + "Street Smart (US version 1)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_VSFIGHT, 0, + NULL, streets1RomInfo, streets1RomName, NULL, NULL, DrvInputInfo, StreetsmDIPInfo, + searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 256, 224, 4, 3 +}; + + +// Street Smart (World version 1) + +static struct BurnRomInfo streetswRomDesc[] = { + { "s-smart1.bin", 0x20000, 0xa1f5ceab, 1 | BRF_PRG }, // 0 68k Code + { "s-smart2.bin", 0x20000, 0x263f615d, 1 | BRF_PRG }, // 1 + + { "s2-5.16c", 0x10000, 0xca4b171e, 2 | BRF_PRG }, // 2 Z80 Code + + { "s2-7.15l", 0x08000, 0x22bedfe5, 3 | BRF_GRA }, // 3 Characters + { "s2-8.15m", 0x08000, 0x6a1c70ab, 3 | BRF_GRA }, // 4 + + { "stsmart.900", 0x80000, 0xa8279a7e, 4 | BRF_GRA }, // 5 Sprites + { "stsmart.902", 0x80000, 0x2f021aa1, 4 | BRF_GRA }, // 6 + { "stsmart.904", 0x80000, 0x167346f7, 4 | BRF_GRA }, // 7 + { "stsmart.901", 0x80000, 0xc305af12, 4 | BRF_GRA }, // 8 + { "stsmart.903", 0x80000, 0x73c16d35, 4 | BRF_GRA }, // 9 + { "stsmart.905", 0x80000, 0xa5beb4e2, 4 | BRF_GRA }, // 10 + + { "s2-6.18d", 0x20000, 0x47db1605, 5 | BRF_SND }, // 11 upd7759 samples +}; + +STD_ROM_PICK(streetsw) +STD_ROM_FN(streetsw) + +struct BurnDriver BurnDrvstreetsw = { + "streetsmw", "streetsm", NULL, NULL, "1989", + "Street Smart (World version 1)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_VSFIGHT, 0, + NULL, streetswRomInfo, streetswRomName, NULL, NULL, DrvInputInfo, StreetsjDIPInfo, + searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 256, 224, 4, 3 +}; + + +// Street Smart (Japan version 1) + +static struct BurnRomInfo streetsjRomDesc[] = { + { "s2v1j_01.bin", 0x20000, 0xf031413c, 1 | BRF_PRG }, // 0 68k Code + { "s2v1j_02.bin", 0x20000, 0xe403a40b, 1 | BRF_PRG }, // 1 + + { "s2-5.16c", 0x10000, 0xca4b171e, 2 | BRF_PRG }, // 2 Z80 Code + + { "s2-7.15l", 0x08000, 0x22bedfe5, 3 | BRF_GRA }, // 3 Characters + { "s2-8.15m", 0x08000, 0x6a1c70ab, 3 | BRF_GRA }, // 4 + + { "stsmart.900", 0x80000, 0xa8279a7e, 4 | BRF_GRA }, // 5 Sprites + { "stsmart.902", 0x80000, 0x2f021aa1, 4 | BRF_GRA }, // 6 + { "stsmart.904", 0x80000, 0x167346f7, 4 | BRF_GRA }, // 7 + { "stsmart.901", 0x80000, 0xc305af12, 4 | BRF_GRA }, // 8 + { "stsmart.903", 0x80000, 0x73c16d35, 4 | BRF_GRA }, // 9 + { "stsmart.905", 0x80000, 0xa5beb4e2, 4 | BRF_GRA }, // 10 + + { "s2-6.18d", 0x20000, 0x47db1605, 5 | BRF_SND }, // 11 upd7759 samples +}; + +STD_ROM_PICK(streetsj) +STD_ROM_FN(streetsj) + +struct BurnDriver BurnDrvstreetsj = { + "streetsmj", "streetsm", NULL, NULL, "1989", + "Street Smart (Japan version 1)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_VSFIGHT, 0, + NULL, streetsjRomInfo, streetsjRomName, NULL, NULL, DrvInputInfo, StreetsjDIPInfo, + searcharInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 256, 224, 4, 3 +}; + +// Ikari III - The Rescue (8-Way Joystick) + +static struct BurnRomInfo ikari3RomDesc[] = { + { "ik3-2-ver1.c10", 0x20000, 0x1bae8023, 1 | BRF_PRG }, // 0 68k Code + { "ik3-3-ver1.c9", 0x20000, 0x10e38b66, 1 | BRF_PRG }, // 1 + { "ik3-1.c8", 0x10000, 0x47e4d256, 1 | BRF_PRG }, // 2 + { "ik3-4.c12", 0x10000, 0xa43af6b5, 1 | BRF_PRG }, // 3 + + { "ik3-5.bin", 0x10000, 0xce6706fc, 2 | BRF_PRG }, // 4 Z80 Code + + { "ik3-7.bin", 0x08000, 0x0b4804df, 3 | BRF_GRA }, // 5 Characters + { "ik3-8.bin", 0x08000, 0x10ab4e50, 3 | BRF_GRA }, // 6 + + { "ik3-13.bin", 0x20000, 0x9a56bd32, 4 | BRF_GRA }, // 7 Sprites + { "ik3-12.bin", 0x20000, 0x0ce6a10a, 4 | BRF_GRA }, // 8 + { "ik3-11.bin", 0x20000, 0xe4e2be43, 4 | BRF_GRA }, // 9 + { "ik3-10.bin", 0x20000, 0xac222372, 4 | BRF_GRA }, // 10 + { "ik3-9.bin", 0x20000, 0xc33971c2, 4 | BRF_GRA }, // 11 + { "ik3-14.bin", 0x20000, 0x453bea77, 4 | BRF_GRA }, // 12 + { "ik3-15.bin", 0x20000, 0x781a81fc, 4 | BRF_GRA }, // 13 + { "ik3-16.bin", 0x20000, 0x80ba400b, 4 | BRF_GRA }, // 14 + { "ik3-17.bin", 0x20000, 0x0cc3ce4a, 4 | BRF_GRA }, // 15 + { "ik3-18.bin", 0x20000, 0xba106245, 4 | BRF_GRA }, // 16 + { "ik3-23.bin", 0x20000, 0xd0fd5c77, 4 | BRF_GRA }, // 17 + { "ik3-22.bin", 0x20000, 0x4878d883, 4 | BRF_GRA }, // 18 + { "ik3-21.bin", 0x20000, 0x50d0fbf0, 4 | BRF_GRA }, // 19 + { "ik3-20.bin", 0x20000, 0x9a851efc, 4 | BRF_GRA }, // 20 + { "ik3-19.bin", 0x20000, 0x4ebdba89, 4 | BRF_GRA }, // 21 + { "ik3-24.bin", 0x20000, 0xe9b26d68, 4 | BRF_GRA }, // 22 + { "ik3-25.bin", 0x20000, 0x073b03f1, 4 | BRF_GRA }, // 23 + { "ik3-26.bin", 0x20000, 0x9c613561, 4 | BRF_GRA }, // 24 + { "ik3-27.bin", 0x20000, 0x16dd227e, 4 | BRF_GRA }, // 25 + { "ik3-28.bin", 0x20000, 0x711715ae, 4 | BRF_GRA }, // 26 + + { "ik3-6.bin", 0x20000, 0x59d256a4, 5 | BRF_SND }, // 27 upd7759 samples +}; + +STD_ROM_PICK(ikari3) +STD_ROM_FN(ikari3) + +static INT32 ikari3Init() +{ + return DrvInit(3); +} + +struct BurnDriver BurnDrvikari3 = { + "ikari3", NULL, NULL, NULL, "1989", + "Ikari III - The Rescue (8-Way Joystick)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, ikari3RomInfo, ikari3RomName, NULL, NULL, IkariInputInfo, IkariDIPInfo, + ikari3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 256, 224, 4, 3 +}; + +// Ikari III - The Rescue (US, Rotary Joystick) + +static struct BurnRomInfo ikari3uRomDesc[] = { + { "ik3-2.c10", 0x20000, 0xa7b34dcd, 1 | BRF_PRG }, // 0 68k Code + { "ik3-3.c9", 0x20000, 0x50f2b83d, 1 | BRF_PRG }, // 1 + { "ik3-1.c8", 0x10000, 0x47e4d256, 1 | BRF_PRG }, // 2 + { "ik3-4.c12", 0x10000, 0xa43af6b5, 1 | BRF_PRG }, // 3 + + { "ik3-5.bin", 0x10000, 0xce6706fc, 2 | BRF_PRG }, // 4 Z80 Code + + { "ik3-7.bin", 0x08000, 0x0b4804df, 3 | BRF_GRA }, // 5 Characters + { "ik3-8.bin", 0x08000, 0x10ab4e50, 3 | BRF_GRA }, // 6 + + { "ik3-13.bin", 0x20000, 0x9a56bd32, 4 | BRF_GRA }, // 7 Sprites + { "ik3-12.bin", 0x20000, 0x0ce6a10a, 4 | BRF_GRA }, // 8 + { "ik3-11.bin", 0x20000, 0xe4e2be43, 4 | BRF_GRA }, // 9 + { "ik3-10.bin", 0x20000, 0xac222372, 4 | BRF_GRA }, // 10 + { "ik3-9.bin", 0x20000, 0xc33971c2, 4 | BRF_GRA }, // 11 + { "ik3-14.bin", 0x20000, 0x453bea77, 4 | BRF_GRA }, // 12 + { "ik3-15.bin", 0x20000, 0x781a81fc, 4 | BRF_GRA }, // 13 + { "ik3-16.bin", 0x20000, 0x80ba400b, 4 | BRF_GRA }, // 14 + { "ik3-17.bin", 0x20000, 0x0cc3ce4a, 4 | BRF_GRA }, // 15 + { "ik3-18.bin", 0x20000, 0xba106245, 4 | BRF_GRA }, // 16 + { "ik3-23.bin", 0x20000, 0xd0fd5c77, 4 | BRF_GRA }, // 17 + { "ik3-22.bin", 0x20000, 0x4878d883, 4 | BRF_GRA }, // 18 + { "ik3-21.bin", 0x20000, 0x50d0fbf0, 4 | BRF_GRA }, // 19 + { "ik3-20.bin", 0x20000, 0x9a851efc, 4 | BRF_GRA }, // 20 + { "ik3-19.bin", 0x20000, 0x4ebdba89, 4 | BRF_GRA }, // 21 + { "ik3-24.bin", 0x20000, 0xe9b26d68, 4 | BRF_GRA }, // 22 + { "ik3-25.bin", 0x20000, 0x073b03f1, 4 | BRF_GRA }, // 23 + { "ik3-26.bin", 0x20000, 0x9c613561, 4 | BRF_GRA }, // 24 + { "ik3-27.bin", 0x20000, 0x16dd227e, 4 | BRF_GRA }, // 25 + { "ik3-28.bin", 0x20000, 0x711715ae, 4 | BRF_GRA }, // 26 + + { "ik3-6.bin", 0x20000, 0x59d256a4, 5 | BRF_SND }, // 27 upd7759 samples +}; + +STD_ROM_PICK(ikari3u) +STD_ROM_FN(ikari3u) + +struct BurnDriver BurnDrvikari3u = { + "ikari3u", "ikari3", NULL, NULL, "1989", + "Ikari III - The Rescue (US, Rotary Joystick)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, ikari3uRomInfo, ikari3uRomName, NULL, NULL, IkariInputInfo, IkariDIPInfo, + ikari3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 256, 224, 4, 3 +}; + +// Ikari Three - The Rescue (Japan, Rotary Joystick) + +static struct BurnRomInfo ikari3jRomDesc[] = { + { "ik3-2-j.c10", 0x20000, 0x7b1b4be4, 1 | BRF_PRG }, // 0 68k Code + { "ik3-3-j.c9", 0x20000, 0x8e6e2aa9, 1 | BRF_PRG }, // 1 + { "ik3-1.c8", 0x10000, 0x47e4d256, 1 | BRF_PRG }, // 2 + { "ik3-4.c12", 0x10000, 0xa43af6b5, 1 | BRF_PRG }, // 3 + + { "ik3-5.bin", 0x10000, 0xce6706fc, 2 | BRF_PRG }, // 4 Z80 Code + + { "ik3-7.bin", 0x08000, 0x0b4804df, 3 | BRF_GRA }, // 5 Characters + { "ik3-8.bin", 0x08000, 0x10ab4e50, 3 | BRF_GRA }, // 6 + + { "ik3-13.bin", 0x20000, 0x9a56bd32, 4 | BRF_GRA }, // 7 Sprites + { "ik3-12.bin", 0x20000, 0x0ce6a10a, 4 | BRF_GRA }, // 8 + { "ik3-11.bin", 0x20000, 0xe4e2be43, 4 | BRF_GRA }, // 9 + { "ik3-10.bin", 0x20000, 0xac222372, 4 | BRF_GRA }, // 10 + { "ik3-9.bin", 0x20000, 0xc33971c2, 4 | BRF_GRA }, // 11 + { "ik3-14.bin", 0x20000, 0x453bea77, 4 | BRF_GRA }, // 12 + { "ik3-15.bin", 0x20000, 0x781a81fc, 4 | BRF_GRA }, // 13 + { "ik3-16.bin", 0x20000, 0x80ba400b, 4 | BRF_GRA }, // 14 + { "ik3-17.bin", 0x20000, 0x0cc3ce4a, 4 | BRF_GRA }, // 15 + { "ik3-18.bin", 0x20000, 0xba106245, 4 | BRF_GRA }, // 16 + { "ik3-23.bin", 0x20000, 0xd0fd5c77, 4 | BRF_GRA }, // 17 + { "ik3-22.bin", 0x20000, 0x4878d883, 4 | BRF_GRA }, // 18 + { "ik3-21.bin", 0x20000, 0x50d0fbf0, 4 | BRF_GRA }, // 19 + { "ik3-20.bin", 0x20000, 0x9a851efc, 4 | BRF_GRA }, // 20 + { "ik3-19.bin", 0x20000, 0x4ebdba89, 4 | BRF_GRA }, // 21 + { "ik3-24.bin", 0x20000, 0xe9b26d68, 4 | BRF_GRA }, // 22 + { "ik3-25.bin", 0x20000, 0x073b03f1, 4 | BRF_GRA }, // 23 + { "ik3-26.bin", 0x20000, 0x9c613561, 4 | BRF_GRA }, // 24 + { "ik3-27.bin", 0x20000, 0x16dd227e, 4 | BRF_GRA }, // 25 + { "ik3-28.bin", 0x20000, 0x711715ae, 4 | BRF_GRA }, // 26 + + { "ik3-6.bin", 0x20000, 0x59d256a4, 5 | BRF_SND }, // 27 upd7759 samples +}; + +STD_ROM_PICK(ikari3j) +STD_ROM_FN(ikari3j) + +struct BurnDriver BurnDrvikari3j = { + "ikari3j", "ikari3", NULL, NULL, "1989", + "Ikari Three - The Rescue (Japan, Rotary Joystick)\0", NULL, "SNK", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0, + NULL, ikari3jRomInfo, ikari3jRomName, NULL, NULL, IkariInputInfo, IkariDIPInfo, + ikari3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x800, 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_solomon.cpp b/src/burn/drv/pre90s/d_solomon.cpp index dbb7b6271..e1a16be3c 100644 --- a/src/burn/drv/pre90s/d_solomon.cpp +++ b/src/burn/drv/pre90s/d_solomon.cpp @@ -1,784 +1,782 @@ -#include "tiles_generic.h" -#include "z80_intf.h" - -#include "driver.h" -extern "C" { - #include "ay8910.h" -} - -static UINT8 SolomonInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 SolomonInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 SolomonInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 SolomonDip[2] = {0, 0}; -static UINT8 SolomonInput[3] = {0x00, 0x00, 0x00}; -static UINT8 SolomonReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *SolomonZ80Rom1 = NULL; -static UINT8 *SolomonZ80Rom2 = NULL; -static UINT8 *SolomonZ80Ram1 = NULL; -static UINT8 *SolomonZ80Ram2 = NULL; -static UINT8 *SolomonColourRam = NULL; -static UINT8 *SolomonVideoRam = NULL; -static UINT8 *SolomonBgColourRam = NULL; -static UINT8 *SolomonBgVideoRam = NULL; -static UINT8 *SolomonSpriteRam = NULL; -static UINT8 *SolomonPaletteRam = NULL; -static UINT32 *SolomonPalette = NULL; -static UINT8 *SolomonBgTiles = NULL; -static UINT8 *SolomonFgTiles = NULL; -static UINT8 *SolomonSprites = NULL; -static UINT8 *SolomonTempRom = NULL; - -static INT32 SolomonIrqFire = 0; - -static INT32 SolomonFlipScreen = 0; - -static INT32 SolomonSoundLatch = 0; -static INT16* pFMBuffer; -static INT16* pAY8910Buffer[9]; - - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo SolomonInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , SolomonInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , SolomonInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , SolomonInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , SolomonInputPort2 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , SolomonInputPort0 + 2, "p1 up" }, - {"Down" , BIT_DIGITAL , SolomonInputPort0 + 3, "p1 down" }, - {"Left" , BIT_DIGITAL , SolomonInputPort0 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , SolomonInputPort0 + 0, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , SolomonInputPort0 + 5, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , SolomonInputPort0 + 4, "p1 fire 2" }, - - {"Up (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 2, "p2 up" }, - {"Down (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 3, "p2 down" }, - {"Left (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 1, "p2 left" }, - {"Right (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 0, "p2 right" }, - {"Fire 1 (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 5, "p2 fire 1" }, - {"Fire 2 (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 4, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &SolomonReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, SolomonDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, SolomonDip + 1 , "dip" }, -}; - -STDINPUTINFO(Solomon) - -inline void SolomonClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -inline void SolomonMakeInputs() -{ - // Reset Inputs - SolomonInput[0] = SolomonInput[1] = SolomonInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - SolomonInput[0] |= (SolomonInputPort0[i] & 1) << i; - SolomonInput[1] |= (SolomonInputPort1[i] & 1) << i; - SolomonInput[2] |= (SolomonInputPort2[i] & 1) << i; - } - - // Clear Opposites - SolomonClearOpposites(&SolomonInput[0]); - SolomonClearOpposites(&SolomonInput[1]); -} - -static struct BurnDIPInfo SolomonDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x02, NULL }, - {0x12, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x02, 0x02, "Upright" }, - {0x11, 0x01, 0x02, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x0c, 0x0c, "2" }, - {0x11, 0x01, 0x0c, 0x00, "3" }, - {0x11, 0x01, 0x0c, 0x08, "4" }, - {0x11, 0x01, 0x0c, 0x04, "5" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0xc0, 0x80, "2 Coins 1 Play" }, - {0x11, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - {0x11, 0x01, 0xc0, 0x40, "1 Coin 2 Play" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 3 Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0x30, 0x20, "2 Coins 1 Play" }, - {0x11, 0x01, 0x30, 0x00, "1 Coin 1 Play" }, - {0x11, 0x01, 0x30, 0x10, "1 Coin 2 Play" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 3 Play" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x00, "Normal" }, - {0x12, 0x01, 0x03, 0x01, "Harder" }, - {0x12, 0x01, 0x03, 0x03, "Difficult" }, - - {0 , 0xfe, 0 , 4 , "Timer Speed" }, - {0x12, 0x01, 0x0c, 0x08, "Slow" }, - {0x12, 0x01, 0x0c, 0x00, "Normal" }, - {0x12, 0x01, 0x0c, 0x04, "Faster" }, - {0x12, 0x01, 0x0c, 0x0c, "Fastest" }, - - {0 , 0xfe, 0 , 2 , "Extra" }, - {0x12, 0x01, 0x10, 0x00, "Normal" }, - {0x12, 0x01, 0x10, 0x10, "Difficult" }, - - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x12, 0x01, 0xe0, 0x00, "30k 200k 500k" }, - {0x12, 0x01, 0xe0, 0x80, "100k 300k 800k" }, - {0x12, 0x01, 0xe0, 0x40, "30k 200k" }, - {0x12, 0x01, 0xe0, 0xc0, "100k 300k" }, - {0x12, 0x01, 0xe0, 0x20, "30k" }, - {0x12, 0x01, 0xe0, 0xa0, "100k" }, - {0x12, 0x01, 0xe0, 0x60, "200k" }, - {0x12, 0x01, 0xe0, 0xe0, "None" }, -}; - -STDDIPINFO(Solomon) - -static struct BurnRomInfo SolomonRomDesc[] = { - { "6.3f", 0x04000, 0x645eb0f3, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "7.3h", 0x08000, 0x1bf5c482, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "8.3jk", 0x08000, 0x0a6cdefc, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "1.3jk", 0x04000, 0xfa6e562e, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "12.3t", 0x08000, 0xb371291c, BRF_GRA }, // 4 Characters - { "11.3r", 0x08000, 0x6f94d2af, BRF_GRA }, // 5 Characters - { "10.3p", 0x08000, 0x8310c2a1, BRF_GRA }, // 6 Characters - { "9.3m", 0x08000, 0xab7e6c42, BRF_GRA }, // 7 Characters - { "2.5lm", 0x04000, 0x80fa2be3, BRF_GRA }, // 8 Sprites - { "3.6lm", 0x04000, 0x236106b4, BRF_GRA }, // 9 Sprites - { "4.7lm", 0x04000, 0x088fe5d9, BRF_GRA }, // 10 Sprites - { "5.8lm", 0x04000, 0x8366232a, BRF_GRA }, // 11 Sprites -}; - - -STD_ROM_PICK(Solomon) -STD_ROM_FN(Solomon) - -static struct BurnRomInfo SolomonjRomDesc[] = { - { "slmn_06.bin", 0x04000, 0xe4d421ff, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "slmn_07.bin", 0x08000, 0xd52d7e38, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "slmn_08.bin", 0x01000, 0xb924d162, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "slmn_01.bin", 0x04000, 0xfa6e562e, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "slmn_12.bin", 0x08000, 0xaa26dfcb, BRF_GRA }, // 4 Characters - { "slmn_11.bin", 0x08000, 0x6f94d2af, BRF_GRA }, // 5 Characters - { "slmn_10.bin", 0x08000, 0x8310c2a1, BRF_GRA }, // 6 Characters - { "slmn_09.bin", 0x08000, 0xab7e6c42, BRF_GRA }, // 7 Characters - { "slmn_02.bin", 0x04000, 0x80fa2be3, BRF_GRA }, // 8 Sprites - { "slmn_03.bin", 0x04000, 0x236106b4, BRF_GRA }, // 9 Sprites - { "slmn_04.bin", 0x04000, 0x088fe5d9, BRF_GRA }, // 10 Sprites - { "slmn_05.bin", 0x04000, 0x8366232a, BRF_GRA }, // 11 Sprites -}; - - -STD_ROM_PICK(Solomonj) -STD_ROM_FN(Solomonj) - -INT32 SolomonDoReset() -{ - SolomonIrqFire = 0; - SolomonFlipScreen = 0; - SolomonSoundLatch = 0; - - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - for (INT32 i = 0; i < 3; i++) { - AY8910Reset(i); - } - - return 0; -} - -UINT8 __fastcall SolomonRead1(UINT16 a) -{ - switch (a) { - case 0xe600: { - return SolomonInput[0]; - } - - case 0xe601: { - return SolomonInput[1]; - } - - case 0xe602: { - return SolomonInput[2]; - } - - case 0xe604: { - return SolomonDip[0]; - } - - case 0xe605: { - return SolomonDip[1]; - } - } - - return 0; -} - -void __fastcall SolomonWrite1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe600: { - SolomonIrqFire = d; - return; - } - - case 0xe604: { - SolomonFlipScreen = d & 1; - return; - } - - case 0xe800: { - SolomonSoundLatch = d; - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - return; - } - } -} - -UINT8 __fastcall SolomonRead2(UINT16 a) -{ - switch (a) { - case 0x8000: { - return SolomonSoundLatch; - } - } - - return 0; -} - -void __fastcall SolomonPortWrite2(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x10: { - AY8910Write(0, 0, d); - return; - } - - case 0x11: { - AY8910Write(0, 1, d); - return; - } - - case 0x20: { - AY8910Write(1, 0, d); - return; - } - - case 0x21: { - AY8910Write(1, 1, d); - return; - } - - case 0x30: { - AY8910Write(2, 0, d); - return; - } - - case 0x31: { - AY8910Write(2, 1, d); - return; - } - } -} - -static INT32 SolomonMemIndex() -{ - UINT8 *Next; Next = Mem; - - SolomonZ80Rom1 = Next; Next += 0x10000; - SolomonZ80Rom2 = Next; Next += 0x04000; - - RamStart = Next; - - SolomonZ80Ram1 = Next; Next += 0x01000; - SolomonZ80Ram2 = Next; Next += 0x00800; - SolomonColourRam = Next; Next += 0x00400; - SolomonVideoRam = Next; Next += 0x00400; - SolomonBgColourRam = Next; Next += 0x00400; - SolomonBgVideoRam = Next; Next += 0x00400; - SolomonSpriteRam = Next; Next += 0x00080; - SolomonPaletteRam = Next; Next += 0x00200; - - RamEnd = Next; - - SolomonBgTiles = Next; Next += 2048 * 8 * 8; - SolomonFgTiles = Next; Next += 2048 * 8 * 8; - SolomonSprites = Next; Next += 2048 * 8 * 8; - pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 9 * sizeof(INT16); - SolomonPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 TileXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; -static INT32 TileYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 SpritePlaneOffsets[4] = { 0, 131072, 262144, 393216 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; -static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; - -INT32 SolomonInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - SolomonMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - SolomonMemIndex(); - - SolomonTempRom = (UINT8 *)BurnMalloc(0x10000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(SolomonZ80Rom1, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(SolomonTempRom, 1, 1); if (nRet != 0) return 1; - memcpy(SolomonZ80Rom1 + 0x4000, SolomonTempRom + 0x4000, 0x4000); - memcpy(SolomonZ80Rom1 + 0x8000, SolomonTempRom + 0x0000, 0x4000); - memset(SolomonTempRom, 0, 0x10000); - nRet = BurnLoadRom(SolomonTempRom, 2, 1); if (nRet != 0) return 1; - memcpy(SolomonZ80Rom1 + 0xf000, SolomonTempRom, 0x1000); - - // Load Z80 #2 Program Rom - nRet = BurnLoadRom(SolomonZ80Rom2, 3, 1); if (nRet != 0) return 1; - - // Load and decode Bg Tiles - memset(SolomonTempRom, 0, 0x10000); - nRet = BurnLoadRom(SolomonTempRom + 0x0000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(SolomonTempRom + 0x8000, 7, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, SolomonTempRom, SolomonBgTiles); - - // Load and decode Fg Tiles - memset(SolomonTempRom, 0, 0x10000); - nRet = BurnLoadRom(SolomonTempRom + 0x0000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(SolomonTempRom + 0x8000, 5, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, SolomonTempRom, SolomonFgTiles); - - // Load and decode Sprite Tiles - memset(SolomonTempRom, 0, 0x10000); - nRet = BurnLoadRom(SolomonTempRom + 0x0000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(SolomonTempRom + 0x4000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(SolomonTempRom + 0x8000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(SolomonTempRom + 0xc000, 11, 1); if (nRet != 0) return 1; -// SolomonDecodeSprites(SolomonSprites, 2048, 0x0000, 0x4000, 0x8000, 0xc000); - GfxDecode(512, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, SolomonTempRom, SolomonSprites); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(SolomonRead1); - ZetSetWriteHandler(SolomonWrite1); - ZetMapArea(0x0000, 0xbfff, 0, SolomonZ80Rom1 ); - ZetMapArea(0x0000, 0xbfff, 2, SolomonZ80Rom1 ); - ZetMapArea(0xc000, 0xcfff, 0, SolomonZ80Ram1 ); - ZetMapArea(0xc000, 0xcfff, 1, SolomonZ80Ram1 ); - ZetMapArea(0xc000, 0xcfff, 2, SolomonZ80Ram1 ); - ZetMapArea(0xd000, 0xd3ff, 0, SolomonColourRam ); - ZetMapArea(0xd000, 0xd3ff, 1, SolomonColourRam ); - ZetMapArea(0xd000, 0xd3ff, 2, SolomonColourRam ); - ZetMapArea(0xd400, 0xd7ff, 0, SolomonVideoRam ); - ZetMapArea(0xd400, 0xd7ff, 1, SolomonVideoRam ); - ZetMapArea(0xd400, 0xd7ff, 2, SolomonVideoRam ); - ZetMapArea(0xd800, 0xdbff, 0, SolomonBgColourRam ); - ZetMapArea(0xd800, 0xdbff, 1, SolomonBgColourRam ); - ZetMapArea(0xd800, 0xdbff, 2, SolomonBgColourRam ); - ZetMapArea(0xdc00, 0xdfff, 0, SolomonBgVideoRam ); - ZetMapArea(0xdc00, 0xdfff, 1, SolomonBgVideoRam ); - ZetMapArea(0xdc00, 0xdfff, 2, SolomonBgVideoRam ); - ZetMapArea(0xe000, 0xe07f, 0, SolomonSpriteRam ); - ZetMapArea(0xe000, 0xe07f, 1, SolomonSpriteRam ); - ZetMapArea(0xe000, 0xe07f, 2, SolomonSpriteRam ); - ZetMapArea(0xe400, 0xe5ff, 0, SolomonPaletteRam ); - ZetMapArea(0xe400, 0xe5ff, 1, SolomonPaletteRam ); - ZetMapArea(0xe400, 0xe5ff, 2, SolomonPaletteRam ); - ZetMapArea(0xf000, 0xffff, 0, SolomonZ80Rom1 + 0xf000); - ZetMapArea(0xf000, 0xffff, 2, SolomonZ80Rom1 + 0xf000); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(SolomonRead2); - ZetSetOutHandler(SolomonPortWrite2); - ZetMapArea(0x0000, 0x3fff, 0, SolomonZ80Rom2 ); - ZetMapArea(0x0000, 0x3fff, 2, SolomonZ80Rom2 ); - ZetMapArea(0x4000, 0x47ff, 0, SolomonZ80Ram2 ); - ZetMapArea(0x4000, 0x47ff, 1, SolomonZ80Ram2 ); - ZetMapArea(0x4000, 0x47ff, 2, SolomonZ80Ram2 ); - ZetMemEnd(); - ZetClose(); - - BurnFree(SolomonTempRom); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - pAY8910Buffer[6] = pFMBuffer + nBurnSoundLen * 6; - pAY8910Buffer[7] = pFMBuffer + nBurnSoundLen * 7; - pAY8910Buffer[8] = pFMBuffer + nBurnSoundLen * 8; - - AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(2, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.12, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.12, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(2, 0.12, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - SolomonDoReset(); - - return 0; -} - -INT32 SolomonExit() -{ - ZetExit(); - - for (INT32 i = 0; i < 3; i++) { - AY8910Exit(i); - } - - GenericTilesExit(); - - BurnFree(Mem); - - return 0; -} - -void SolomonRenderBgLayer() -{ - for (INT32 Offs = 0; Offs < 0x400; Offs++) { - INT32 sx, sy, Attr, Code, Colour, FlipX, FlipY; - - sx = (Offs % 32); - sy = (Offs / 32); - Attr = SolomonBgColourRam[Offs]; - Code = SolomonBgVideoRam[Offs] + 256 * (Attr & 0x07); - Colour = (Attr & 0x70) >> 4; - FlipX = Attr & 0x80; - FlipY = Attr & 0x08; - - if (SolomonFlipScreen) { - sx = 31 - sx; - sy = 31 - sy; - FlipX = !FlipX; - FlipY = !FlipY; - } - - sx *= 8; - sy *= 8; - sy -= 16; - - if (sx >= 0 && sx < 247 && sy >= 0 && sy < 215) { - if (!FlipY) { - if (!FlipX) { - Render8x8Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); - } else { - Render8x8Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); - } - } else { - if (!FlipX) { - Render8x8Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); - } else { - Render8x8Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); - } - } - } else { - if (!FlipY) { - if (!FlipX) { - Render8x8Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); - } else { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); - } - } else { - if (!FlipX) { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); - } else { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); - } - } - } - } -} - -void SolomonRenderFgLayer() -{ - for (INT32 Offs = 0x400 - 1; Offs >= 0; Offs--) { - INT32 sx, sy, Code, Colour; - - sx = (Offs % 32); - sy = (Offs / 32); - Code = SolomonVideoRam[Offs] + 256 * (SolomonColourRam[Offs] & 0x07); - Colour = (SolomonColourRam[Offs] & 0x70) >> 4; - - if (SolomonFlipScreen) { - sx = 31 - sx; - sy = 31 - sy; - } - - sx *= 8; - sy *= 8; - sy -= 16; - - if (sx >= 0 && sx < 247 && sy >= 0 && sy < 215) { - if (!SolomonFlipScreen) { - Render8x8Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonFgTiles); - } else { - Render8x8Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonFgTiles); - } - } else { - if (!SolomonFlipScreen) { - Render8x8Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonFgTiles); - } else { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonFgTiles); - } - } - } -} - -void SolomonRenderSpriteLayer() -{ - for (INT32 Offs = 0x80 - 4; Offs >= 0; Offs -= 4) { - INT32 sx, sy, Attr, Code, Colour, FlipX, FlipY; - - sx = SolomonSpriteRam[Offs + 3]; - sy = 241 - SolomonSpriteRam[Offs + 2]; - Attr = SolomonSpriteRam[Offs + 1]; - Code = SolomonSpriteRam[Offs] + 16 * (Attr & 0x10); - Colour = (Attr & 0x0e) >> 1; - FlipX = Attr & 0x40; - FlipY = Attr & 0x80; - - if (SolomonFlipScreen & 1) { - sx = 240 - sx; - sy = 240 - sy; - FlipX = !FlipX; - FlipY = !FlipY; - } - - sy -= 16; - - if (sx >= 0 && sx < 239 && sy >= 0 && sy < 207) { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); - } else { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); - } - } - } else { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); - } - } - } - } -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour >> 0) & 0x0f; - g = (nColour >> 4) & 0x0f; - b = (nColour >> 8) & 0x0f; - - r = (r << 4) | r; - g = (g << 4) | g; - b = (b << 4) | b; - - return BurnHighCol(r, g, b, 0); -} - -INT32 SolomonCalcPalette() -{ - for (INT32 i = 0; i < 0x200; i++) { - SolomonPalette[i / 2] = CalcCol(SolomonPaletteRam[i & ~1] | (SolomonPaletteRam[i | 1] << 8)); - } - - return 0; -} - -void SolomonDraw() -{ - BurnTransferClear(); - SolomonCalcPalette(); - SolomonRenderBgLayer(); - SolomonRenderFgLayer(); - SolomonRenderSpriteLayer(); - BurnTransferCopy(SolomonPalette); -} - -INT32 SolomonFrame() -{ - INT32 nInterleave = 2; - INT32 nSoundBufferPos = 0; - - if (SolomonReset) SolomonDoReset(); - - SolomonMakeInputs(); - - nCyclesTotal[0] = 4000000 / 60; - nCyclesTotal[1] = 3072000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 1) if(SolomonIrqFire) ZetNmi(); - ZetClose(); - - // Run Z80 #2 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetRaiseIrq(0); - ZetClose(); - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - - if (pBurnDraw) SolomonDraw(); - - return 0; -} - -static INT32 SolomonScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x02945; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); // Scan Z80 - - // Scan critical driver variables - SCAN_VAR(SolomonIrqFire); - SCAN_VAR(SolomonFlipScreen); - SCAN_VAR(SolomonSoundLatch); - SCAN_VAR(SolomonInput); - SCAN_VAR(SolomonDip); - } - - return 0; -} - -struct BurnDriver BurnDrvSolomon = { - "solomon", NULL, NULL, NULL, "1986", - "Solomon's Key (US)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, - NULL, SolomonRomInfo, SolomonRomName, NULL, NULL, SolomonInputInfo, SolomonDIPInfo, - SolomonInit, SolomonExit, SolomonFrame, NULL, SolomonScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSolomonj = { - "solomonj", "solomon", NULL, NULL, "1986", - "Solomon's Key (Japan)\0", NULL, "Tecmo", "Miscellaneous", - L"Solomon's Key (Japan)\0Solomon's Key \u30BD\u30ED\u30E2\u30F3\u306E\u9375\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, - NULL, SolomonjRomInfo, SolomonjRomName, NULL, NULL, SolomonInputInfo, SolomonDIPInfo, - SolomonInit, SolomonExit, SolomonFrame, NULL, SolomonScan, - NULL, 0x200, 256, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "z80_intf.h" + +#include "driver.h" +extern "C" { + #include "ay8910.h" +} + +static UINT8 SolomonInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 SolomonInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 SolomonInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 SolomonDip[2] = {0, 0}; +static UINT8 SolomonInput[3] = {0x00, 0x00, 0x00}; +static UINT8 SolomonReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *SolomonZ80Rom1 = NULL; +static UINT8 *SolomonZ80Rom2 = NULL; +static UINT8 *SolomonZ80Ram1 = NULL; +static UINT8 *SolomonZ80Ram2 = NULL; +static UINT8 *SolomonColourRam = NULL; +static UINT8 *SolomonVideoRam = NULL; +static UINT8 *SolomonBgColourRam = NULL; +static UINT8 *SolomonBgVideoRam = NULL; +static UINT8 *SolomonSpriteRam = NULL; +static UINT8 *SolomonPaletteRam = NULL; +static UINT32 *SolomonPalette = NULL; +static UINT8 *SolomonBgTiles = NULL; +static UINT8 *SolomonFgTiles = NULL; +static UINT8 *SolomonSprites = NULL; +static UINT8 *SolomonTempRom = NULL; + +static INT32 SolomonIrqFire = 0; + +static INT32 SolomonFlipScreen = 0; + +static INT32 SolomonSoundLatch = 0; +static INT16* pFMBuffer; +static INT16* pAY8910Buffer[9]; + + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo SolomonInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , SolomonInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , SolomonInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , SolomonInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , SolomonInputPort2 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , SolomonInputPort0 + 2, "p1 up" }, + {"Down" , BIT_DIGITAL , SolomonInputPort0 + 3, "p1 down" }, + {"Left" , BIT_DIGITAL , SolomonInputPort0 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , SolomonInputPort0 + 0, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , SolomonInputPort0 + 5, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , SolomonInputPort0 + 4, "p1 fire 2" }, + + {"Up (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 2, "p2 up" }, + {"Down (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 3, "p2 down" }, + {"Left (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 1, "p2 left" }, + {"Right (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 0, "p2 right" }, + {"Fire 1 (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 5, "p2 fire 1" }, + {"Fire 2 (Cocktail)" , BIT_DIGITAL , SolomonInputPort1 + 4, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &SolomonReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, SolomonDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, SolomonDip + 1 , "dip" }, +}; + +STDINPUTINFO(Solomon) + +inline void SolomonClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +inline void SolomonMakeInputs() +{ + // Reset Inputs + SolomonInput[0] = SolomonInput[1] = SolomonInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + SolomonInput[0] |= (SolomonInputPort0[i] & 1) << i; + SolomonInput[1] |= (SolomonInputPort1[i] & 1) << i; + SolomonInput[2] |= (SolomonInputPort2[i] & 1) << i; + } + + // Clear Opposites + SolomonClearOpposites(&SolomonInput[0]); + SolomonClearOpposites(&SolomonInput[1]); +} + +static struct BurnDIPInfo SolomonDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x02, NULL }, + {0x12, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x02, 0x02, "Upright" }, + {0x11, 0x01, 0x02, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x0c, 0x0c, "2" }, + {0x11, 0x01, 0x0c, 0x00, "3" }, + {0x11, 0x01, 0x0c, 0x08, "4" }, + {0x11, 0x01, 0x0c, 0x04, "5" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0xc0, 0x80, "2 Coins 1 Play" }, + {0x11, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + {0x11, 0x01, 0xc0, 0x40, "1 Coin 2 Play" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 3 Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0x30, 0x20, "2 Coins 1 Play" }, + {0x11, 0x01, 0x30, 0x00, "1 Coin 1 Play" }, + {0x11, 0x01, 0x30, 0x10, "1 Coin 2 Play" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 3 Play" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x00, "Normal" }, + {0x12, 0x01, 0x03, 0x01, "Harder" }, + {0x12, 0x01, 0x03, 0x03, "Difficult" }, + + {0 , 0xfe, 0 , 4 , "Timer Speed" }, + {0x12, 0x01, 0x0c, 0x08, "Slow" }, + {0x12, 0x01, 0x0c, 0x00, "Normal" }, + {0x12, 0x01, 0x0c, 0x04, "Faster" }, + {0x12, 0x01, 0x0c, 0x0c, "Fastest" }, + + {0 , 0xfe, 0 , 2 , "Extra" }, + {0x12, 0x01, 0x10, 0x00, "Normal" }, + {0x12, 0x01, 0x10, 0x10, "Difficult" }, + + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x12, 0x01, 0xe0, 0x00, "30k 200k 500k" }, + {0x12, 0x01, 0xe0, 0x80, "100k 300k 800k" }, + {0x12, 0x01, 0xe0, 0x40, "30k 200k" }, + {0x12, 0x01, 0xe0, 0xc0, "100k 300k" }, + {0x12, 0x01, 0xe0, 0x20, "30k" }, + {0x12, 0x01, 0xe0, 0xa0, "100k" }, + {0x12, 0x01, 0xe0, 0x60, "200k" }, + {0x12, 0x01, 0xe0, 0xe0, "None" }, +}; + +STDDIPINFO(Solomon) + +static struct BurnRomInfo SolomonRomDesc[] = { + { "6.3f", 0x04000, 0x645eb0f3, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "7.3h", 0x08000, 0x1bf5c482, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "8.3jk", 0x08000, 0x0a6cdefc, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "1.3jk", 0x04000, 0xfa6e562e, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "12.3t", 0x08000, 0xb371291c, BRF_GRA }, // 4 Characters + { "11.3r", 0x08000, 0x6f94d2af, BRF_GRA }, // 5 Characters + { "10.3p", 0x08000, 0x8310c2a1, BRF_GRA }, // 6 Characters + { "9.3m", 0x08000, 0xab7e6c42, BRF_GRA }, // 7 Characters + { "2.5lm", 0x04000, 0x80fa2be3, BRF_GRA }, // 8 Sprites + { "3.6lm", 0x04000, 0x236106b4, BRF_GRA }, // 9 Sprites + { "4.7lm", 0x04000, 0x088fe5d9, BRF_GRA }, // 10 Sprites + { "5.8lm", 0x04000, 0x8366232a, BRF_GRA }, // 11 Sprites +}; + + +STD_ROM_PICK(Solomon) +STD_ROM_FN(Solomon) + +static struct BurnRomInfo SolomonjRomDesc[] = { + { "slmn_06.bin", 0x04000, 0xe4d421ff, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "slmn_07.bin", 0x08000, 0xd52d7e38, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "slmn_08.bin", 0x01000, 0xb924d162, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "slmn_01.bin", 0x04000, 0xfa6e562e, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "slmn_12.bin", 0x08000, 0xaa26dfcb, BRF_GRA }, // 4 Characters + { "slmn_11.bin", 0x08000, 0x6f94d2af, BRF_GRA }, // 5 Characters + { "slmn_10.bin", 0x08000, 0x8310c2a1, BRF_GRA }, // 6 Characters + { "slmn_09.bin", 0x08000, 0xab7e6c42, BRF_GRA }, // 7 Characters + { "slmn_02.bin", 0x04000, 0x80fa2be3, BRF_GRA }, // 8 Sprites + { "slmn_03.bin", 0x04000, 0x236106b4, BRF_GRA }, // 9 Sprites + { "slmn_04.bin", 0x04000, 0x088fe5d9, BRF_GRA }, // 10 Sprites + { "slmn_05.bin", 0x04000, 0x8366232a, BRF_GRA }, // 11 Sprites +}; + + +STD_ROM_PICK(Solomonj) +STD_ROM_FN(Solomonj) + +INT32 SolomonDoReset() +{ + SolomonIrqFire = 0; + SolomonFlipScreen = 0; + SolomonSoundLatch = 0; + + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + for (INT32 i = 0; i < 3; i++) { + AY8910Reset(i); + } + + return 0; +} + +UINT8 __fastcall SolomonRead1(UINT16 a) +{ + switch (a) { + case 0xe600: { + return SolomonInput[0]; + } + + case 0xe601: { + return SolomonInput[1]; + } + + case 0xe602: { + return SolomonInput[2]; + } + + case 0xe604: { + return SolomonDip[0]; + } + + case 0xe605: { + return SolomonDip[1]; + } + } + + return 0; +} + +void __fastcall SolomonWrite1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe600: { + SolomonIrqFire = d; + return; + } + + case 0xe604: { + SolomonFlipScreen = d & 1; + return; + } + + case 0xe800: { + SolomonSoundLatch = d; + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + return; + } + } +} + +UINT8 __fastcall SolomonRead2(UINT16 a) +{ + switch (a) { + case 0x8000: { + return SolomonSoundLatch; + } + } + + return 0; +} + +void __fastcall SolomonPortWrite2(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x10: { + AY8910Write(0, 0, d); + return; + } + + case 0x11: { + AY8910Write(0, 1, d); + return; + } + + case 0x20: { + AY8910Write(1, 0, d); + return; + } + + case 0x21: { + AY8910Write(1, 1, d); + return; + } + + case 0x30: { + AY8910Write(2, 0, d); + return; + } + + case 0x31: { + AY8910Write(2, 1, d); + return; + } + } +} + +static INT32 SolomonMemIndex() +{ + UINT8 *Next; Next = Mem; + + SolomonZ80Rom1 = Next; Next += 0x10000; + SolomonZ80Rom2 = Next; Next += 0x04000; + + RamStart = Next; + + SolomonZ80Ram1 = Next; Next += 0x01000; + SolomonZ80Ram2 = Next; Next += 0x00800; + SolomonColourRam = Next; Next += 0x00400; + SolomonVideoRam = Next; Next += 0x00400; + SolomonBgColourRam = Next; Next += 0x00400; + SolomonBgVideoRam = Next; Next += 0x00400; + SolomonSpriteRam = Next; Next += 0x00080; + SolomonPaletteRam = Next; Next += 0x00200; + + RamEnd = Next; + + SolomonBgTiles = Next; Next += 2048 * 8 * 8; + SolomonFgTiles = Next; Next += 2048 * 8 * 8; + SolomonSprites = Next; Next += 2048 * 8 * 8; + pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 9 * sizeof(INT16); + SolomonPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 TileXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; +static INT32 TileYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 SpritePlaneOffsets[4] = { 0, 131072, 262144, 393216 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; +static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; + +INT32 SolomonInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + SolomonMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + SolomonMemIndex(); + + SolomonTempRom = (UINT8 *)BurnMalloc(0x10000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(SolomonZ80Rom1, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(SolomonTempRom, 1, 1); if (nRet != 0) return 1; + memcpy(SolomonZ80Rom1 + 0x4000, SolomonTempRom + 0x4000, 0x4000); + memcpy(SolomonZ80Rom1 + 0x8000, SolomonTempRom + 0x0000, 0x4000); + memset(SolomonTempRom, 0, 0x10000); + nRet = BurnLoadRom(SolomonTempRom, 2, 1); if (nRet != 0) return 1; + memcpy(SolomonZ80Rom1 + 0xf000, SolomonTempRom, 0x1000); + + // Load Z80 #2 Program Rom + nRet = BurnLoadRom(SolomonZ80Rom2, 3, 1); if (nRet != 0) return 1; + + // Load and decode Bg Tiles + memset(SolomonTempRom, 0, 0x10000); + nRet = BurnLoadRom(SolomonTempRom + 0x0000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(SolomonTempRom + 0x8000, 7, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, SolomonTempRom, SolomonBgTiles); + + // Load and decode Fg Tiles + memset(SolomonTempRom, 0, 0x10000); + nRet = BurnLoadRom(SolomonTempRom + 0x0000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(SolomonTempRom + 0x8000, 5, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, SolomonTempRom, SolomonFgTiles); + + // Load and decode Sprite Tiles + memset(SolomonTempRom, 0, 0x10000); + nRet = BurnLoadRom(SolomonTempRom + 0x0000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(SolomonTempRom + 0x4000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(SolomonTempRom + 0x8000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(SolomonTempRom + 0xc000, 11, 1); if (nRet != 0) return 1; +// SolomonDecodeSprites(SolomonSprites, 2048, 0x0000, 0x4000, 0x8000, 0xc000); + GfxDecode(512, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, SolomonTempRom, SolomonSprites); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(SolomonRead1); + ZetSetWriteHandler(SolomonWrite1); + ZetMapArea(0x0000, 0xbfff, 0, SolomonZ80Rom1 ); + ZetMapArea(0x0000, 0xbfff, 2, SolomonZ80Rom1 ); + ZetMapArea(0xc000, 0xcfff, 0, SolomonZ80Ram1 ); + ZetMapArea(0xc000, 0xcfff, 1, SolomonZ80Ram1 ); + ZetMapArea(0xc000, 0xcfff, 2, SolomonZ80Ram1 ); + ZetMapArea(0xd000, 0xd3ff, 0, SolomonColourRam ); + ZetMapArea(0xd000, 0xd3ff, 1, SolomonColourRam ); + ZetMapArea(0xd000, 0xd3ff, 2, SolomonColourRam ); + ZetMapArea(0xd400, 0xd7ff, 0, SolomonVideoRam ); + ZetMapArea(0xd400, 0xd7ff, 1, SolomonVideoRam ); + ZetMapArea(0xd400, 0xd7ff, 2, SolomonVideoRam ); + ZetMapArea(0xd800, 0xdbff, 0, SolomonBgColourRam ); + ZetMapArea(0xd800, 0xdbff, 1, SolomonBgColourRam ); + ZetMapArea(0xd800, 0xdbff, 2, SolomonBgColourRam ); + ZetMapArea(0xdc00, 0xdfff, 0, SolomonBgVideoRam ); + ZetMapArea(0xdc00, 0xdfff, 1, SolomonBgVideoRam ); + ZetMapArea(0xdc00, 0xdfff, 2, SolomonBgVideoRam ); + ZetMapArea(0xe000, 0xe07f, 0, SolomonSpriteRam ); + ZetMapArea(0xe000, 0xe07f, 1, SolomonSpriteRam ); + ZetMapArea(0xe000, 0xe07f, 2, SolomonSpriteRam ); + ZetMapArea(0xe400, 0xe5ff, 0, SolomonPaletteRam ); + ZetMapArea(0xe400, 0xe5ff, 1, SolomonPaletteRam ); + ZetMapArea(0xe400, 0xe5ff, 2, SolomonPaletteRam ); + ZetMapArea(0xf000, 0xffff, 0, SolomonZ80Rom1 + 0xf000); + ZetMapArea(0xf000, 0xffff, 2, SolomonZ80Rom1 + 0xf000); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(SolomonRead2); + ZetSetOutHandler(SolomonPortWrite2); + ZetMapArea(0x0000, 0x3fff, 0, SolomonZ80Rom2 ); + ZetMapArea(0x0000, 0x3fff, 2, SolomonZ80Rom2 ); + ZetMapArea(0x4000, 0x47ff, 0, SolomonZ80Ram2 ); + ZetMapArea(0x4000, 0x47ff, 1, SolomonZ80Ram2 ); + ZetMapArea(0x4000, 0x47ff, 2, SolomonZ80Ram2 ); + ZetClose(); + + BurnFree(SolomonTempRom); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + pAY8910Buffer[6] = pFMBuffer + nBurnSoundLen * 6; + pAY8910Buffer[7] = pFMBuffer + nBurnSoundLen * 7; + pAY8910Buffer[8] = pFMBuffer + nBurnSoundLen * 8; + + AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(2, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.12, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.12, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(2, 0.12, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + SolomonDoReset(); + + return 0; +} + +INT32 SolomonExit() +{ + ZetExit(); + + for (INT32 i = 0; i < 3; i++) { + AY8910Exit(i); + } + + GenericTilesExit(); + + BurnFree(Mem); + + return 0; +} + +void SolomonRenderBgLayer() +{ + for (INT32 Offs = 0; Offs < 0x400; Offs++) { + INT32 sx, sy, Attr, Code, Colour, FlipX, FlipY; + + sx = (Offs % 32); + sy = (Offs / 32); + Attr = SolomonBgColourRam[Offs]; + Code = SolomonBgVideoRam[Offs] + 256 * (Attr & 0x07); + Colour = (Attr & 0x70) >> 4; + FlipX = Attr & 0x80; + FlipY = Attr & 0x08; + + if (SolomonFlipScreen) { + sx = 31 - sx; + sy = 31 - sy; + FlipX = !FlipX; + FlipY = !FlipY; + } + + sx *= 8; + sy *= 8; + sy -= 16; + + if (sx >= 0 && sx < 247 && sy >= 0 && sy < 215) { + if (!FlipY) { + if (!FlipX) { + Render8x8Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); + } else { + Render8x8Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); + } + } else { + if (!FlipX) { + Render8x8Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); + } else { + Render8x8Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); + } + } + } else { + if (!FlipY) { + if (!FlipX) { + Render8x8Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); + } else { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); + } + } else { + if (!FlipX) { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); + } else { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 128, SolomonBgTiles); + } + } + } + } +} + +void SolomonRenderFgLayer() +{ + for (INT32 Offs = 0x400 - 1; Offs >= 0; Offs--) { + INT32 sx, sy, Code, Colour; + + sx = (Offs % 32); + sy = (Offs / 32); + Code = SolomonVideoRam[Offs] + 256 * (SolomonColourRam[Offs] & 0x07); + Colour = (SolomonColourRam[Offs] & 0x70) >> 4; + + if (SolomonFlipScreen) { + sx = 31 - sx; + sy = 31 - sy; + } + + sx *= 8; + sy *= 8; + sy -= 16; + + if (sx >= 0 && sx < 247 && sy >= 0 && sy < 215) { + if (!SolomonFlipScreen) { + Render8x8Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonFgTiles); + } else { + Render8x8Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonFgTiles); + } + } else { + if (!SolomonFlipScreen) { + Render8x8Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonFgTiles); + } else { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonFgTiles); + } + } + } +} + +void SolomonRenderSpriteLayer() +{ + for (INT32 Offs = 0x80 - 4; Offs >= 0; Offs -= 4) { + INT32 sx, sy, Attr, Code, Colour, FlipX, FlipY; + + sx = SolomonSpriteRam[Offs + 3]; + sy = 241 - SolomonSpriteRam[Offs + 2]; + Attr = SolomonSpriteRam[Offs + 1]; + Code = SolomonSpriteRam[Offs] + 16 * (Attr & 0x10); + Colour = (Attr & 0x0e) >> 1; + FlipX = Attr & 0x40; + FlipY = Attr & 0x80; + + if (SolomonFlipScreen & 1) { + sx = 240 - sx; + sy = 240 - sy; + FlipX = !FlipX; + FlipY = !FlipY; + } + + sy -= 16; + + if (sx >= 0 && sx < 239 && sy >= 0 && sy < 207) { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); + } else { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); + } + } + } else { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, SolomonSprites); + } + } + } + } +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour >> 0) & 0x0f; + g = (nColour >> 4) & 0x0f; + b = (nColour >> 8) & 0x0f; + + r = (r << 4) | r; + g = (g << 4) | g; + b = (b << 4) | b; + + return BurnHighCol(r, g, b, 0); +} + +INT32 SolomonCalcPalette() +{ + for (INT32 i = 0; i < 0x200; i++) { + SolomonPalette[i / 2] = CalcCol(SolomonPaletteRam[i & ~1] | (SolomonPaletteRam[i | 1] << 8)); + } + + return 0; +} + +void SolomonDraw() +{ + BurnTransferClear(); + SolomonCalcPalette(); + SolomonRenderBgLayer(); + SolomonRenderFgLayer(); + SolomonRenderSpriteLayer(); + BurnTransferCopy(SolomonPalette); +} + +INT32 SolomonFrame() +{ + INT32 nInterleave = 2; + INT32 nSoundBufferPos = 0; + + if (SolomonReset) SolomonDoReset(); + + SolomonMakeInputs(); + + nCyclesTotal[0] = 4000000 / 60; + nCyclesTotal[1] = 3072000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 1) if(SolomonIrqFire) ZetNmi(); + ZetClose(); + + // Run Z80 #2 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetRaiseIrq(0); + ZetClose(); + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + + if (pBurnDraw) SolomonDraw(); + + return 0; +} + +static INT32 SolomonScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x02945; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); // Scan Z80 + + // Scan critical driver variables + SCAN_VAR(SolomonIrqFire); + SCAN_VAR(SolomonFlipScreen); + SCAN_VAR(SolomonSoundLatch); + SCAN_VAR(SolomonInput); + SCAN_VAR(SolomonDip); + } + + return 0; +} + +struct BurnDriver BurnDrvSolomon = { + "solomon", NULL, NULL, NULL, "1986", + "Solomon's Key (US)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, + NULL, SolomonRomInfo, SolomonRomName, NULL, NULL, SolomonInputInfo, SolomonDIPInfo, + SolomonInit, SolomonExit, SolomonFrame, NULL, SolomonScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSolomonj = { + "solomonj", "solomon", NULL, NULL, "1986", + "Solomon's Key (Japan)\0", NULL, "Tecmo", "Miscellaneous", + L"Solomon's Key (Japan)\0Solomon's Key \u30BD\u30ED\u30E2\u30F3\u306E\u9375\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0, + NULL, SolomonjRomInfo, SolomonjRomName, NULL, NULL, SolomonInputInfo, SolomonDIPInfo, + SolomonInit, SolomonExit, SolomonFrame, NULL, SolomonScan, + NULL, 0x200, 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_srumbler.cpp b/src/burn/drv/pre90s/d_srumbler.cpp index b5663bd78..51e3113a9 100644 --- a/src/burn/drv/pre90s/d_srumbler.cpp +++ b/src/burn/drv/pre90s/d_srumbler.cpp @@ -1,837 +1,836 @@ -// FB Alpha The Speed Rumbler driver module -// Based on MAME driver by Paul Leaman - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "m6809_intf.h" -#include "burn_ym2203.h" - -static UINT8 *AllMem; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *DrvM6809ROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvPROM; -static UINT8 *DrvM6809RAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf; -static UINT8 *DrvBgRAM; -static UINT8 *DrvFgRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *DrvBank; -static UINT8 *DrvScroll; -static UINT8 *flipscreen; -static UINT8 *soundlatch; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo SrumblerInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Srumbler) - -static struct BurnDIPInfo SrumblerDIPList[]= -{ - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x73, NULL }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credits" }, - {0x11, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, - {0x11, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, - {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x07, 0x03, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credits" }, - {0x11, 0x01, 0x38, 0x08, "3 Coins 1 Credits" }, - {0x11, 0x01, 0x38, 0x10, "2 Coins 1 Credits" }, - {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x38, 0x18, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x11, 0x01, 0x40, 0x40, "Off" }, - {0x11, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x04, 0x00, "Upright" }, - {0x12, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x12, 0x01, 0x18, 0x18, "20k 70k and every 70k"}, - {0x12, 0x01, 0x18, 0x10, "30k 80k and every 80k"}, - {0x12, 0x01, 0x18, 0x08, "20k 80k" }, - {0x12, 0x01, 0x18, 0x00, "30k 80k" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x60, 0x40, "Easy" }, - {0x12, 0x01, 0x60, 0x60, "Normal" }, - {0x12, 0x01, 0x60, 0x20, "Difficult" }, - {0x12, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x12, 0x01, 0x80, 0x00, "No" }, - {0x12, 0x01, 0x80, 0x80, "Yes" }, -}; - -STDDIPINFO(Srumbler) - -static void bankswitch(INT32 data) -{ - DrvBank[0] = data; - - for (INT32 i = 0x05; i < 0x10; i++) - { - INT32 bank = DrvPROM[(data & 0xf0) | i] | DrvPROM[0x100 | ((data & 0x0f) << 4) | i]; - - M6809MapMemory(DrvM6809ROM + bank * 0x1000, 0x1000 * i, 0x1000 * i + 0x0fff, M6809_ROM); - } -} - -void srumbler_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x4008: - bankswitch(data); - return; - - case 0x4009: - *flipscreen = data & 1; - return; - - case 0x400a: - case 0x400b: - case 0x400c: - case 0x400d: - DrvScroll[address - 0x400a] = data; - return; - - case 0x400e: - *soundlatch = data; - return; - } -} - -UINT8 srumbler_main_read(UINT16 address) -{ - switch (address) - { - case 0x4008: - return DrvInputs[0]; - - case 0x4009: - return DrvInputs[1]; - - case 0x400a: - return DrvInputs[2]; - - case 0x400b: - return DrvDips[0]; - - case 0x400c: - return DrvDips[1]; - } - - return 0; -} - -void __fastcall srumbler_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8000: - case 0x8001: - BurnYM2203Write(0, address & 1, data); - return; - - case 0xa000: - case 0xa001: - BurnYM2203Write(1, address & 1, data); - return; - } -} - -UINT8 __fastcall srumbler_sound_read(UINT16 address) -{ - if (address == 0xe000) { - return *soundlatch; - } - - return 0; -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3000000; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - M6809Open(0); - bankswitch(0); - M6809Reset(); - M6809Close(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvM6809ROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x020000; - DrvGfxROM1 = Next; Next += 0x080000; - DrvGfxROM2 = Next; Next += 0x080000; - - DrvPROM = Next; Next += 0x000200; - - DrvPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); - - AllRam = Next; - - DrvM6809RAM = Next; Next += 0x001e00; - DrvSprRAM = Next; Next += 0x000200; - DrvSprBuf = Next; Next += 0x000200; - - DrvBgRAM = Next; Next += 0x002000; - DrvFgRAM = Next; Next += 0x001000; - DrvPalRAM = Next; Next += 0x000400; - - DrvZ80RAM = Next; Next += 0x000800; - - DrvBank = Next; Next += 0x000001; - DrvScroll = Next; Next += 0x000004; - - flipscreen = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[2] = { 0x000004, 0x000000 }; - INT32 Plane1[4] = { 0x100004, 0x100000, 0x000004, 0x000000 }; - INT32 Plane2[4] = { 0x180000, 0x100000, 0x080000, 0x000000 }; - INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, - 0x100, 0x101, 0x102, 0x103, 0x108, 0x109, 0x10a, 0x10b }; - INT32 XOffs1[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087 }; - INT32 YOffs0[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, - 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0 }; - INT32 YOffs1[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, - 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x08000); - - GfxDecode(0x400, 2, 8, 8, Plane0, XOffs0, YOffs0, 0x080, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x40000); - - GfxDecode(0x800, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x200, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x40000); - - GfxDecode(0x800, 4, 16, 16, Plane2, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM2); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvM6809ROM + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvM6809ROM + 0x08000, 1, 1)) return 1; - if (BurnLoadRom(DrvM6809ROM + 0x10000, 2, 1)) return 1; - if (BurnLoadRom(DrvM6809ROM + 0x18000, 3, 1)) return 1; - if (BurnLoadRom(DrvM6809ROM + 0x20000, 4, 1)) return 1; - if (BurnLoadRom(DrvM6809ROM + 0x28000, 5, 1)) return 1; - if (BurnLoadRom(DrvM6809ROM + 0x30000, 6, 1)) return 1; - if (BurnLoadRom(DrvM6809ROM + 0x38000, 7, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x08000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x10000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x18000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x20000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x28000, 15, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x30000, 16, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x38000, 17, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 18, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x08000, 19, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x10000, 20, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x18000, 21, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x20000, 22, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x28000, 23, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x30000, 24, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x38000, 25, 1)) return 1; - - if (BurnLoadRom(DrvPROM + 0x00000, 26, 1)) return 1; - if (BurnLoadRom(DrvPROM + 0x00100, 27, 1)) return 1; - - for (INT32 i = 0; i < 0x100; i++) { - DrvPROM[i + 0x000] = (DrvPROM[i] & 0x03) << 4; - DrvPROM[i + 0x100] &= 0x0f; - } - - DrvGfxDecode(); - } - - M6809Init(1); - M6809Open(0); - M6809MapMemory(DrvM6809RAM, 0x0000, 0x1dff, M6809_RAM); - M6809MapMemory(DrvSprRAM, 0x1e00, 0x1fff, M6809_RAM); - M6809MapMemory(DrvBgRAM, 0x2000, 0x3fff, M6809_RAM); - M6809MapMemory(DrvFgRAM, 0x5000, 0x5fff, M6809_WRITE); - M6809MapMemory(DrvPalRAM, 0x7000, 0x73ff, M6809_WRITE); - M6809SetReadHandler(srumbler_main_read); - M6809SetWriteHandler(srumbler_main_write); - M6809Close(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(srumbler_sound_write); - ZetSetReadHandler(srumbler_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 4000000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.30, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.30, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.10, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - M6809Exit(); - ZetExit(); - - BurnYM2203Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_background_layer(INT32 type) -{ - INT32 scrollx = ((DrvScroll[1] << 8) | DrvScroll[0]) & 0x3ff; - INT32 scrolly = ((DrvScroll[3] << 8) | DrvScroll[2]) & 0x3ff; - - INT32 masks[4] = { 0xffff, 0x0000, 0x07ff, 0xf800 }; // 0, 1 - INT32 mask = masks[type]; - - for (INT32 offs = 0; offs < 64 * 64; offs++) - { - INT32 sy = (offs & 0x3f) << 4; - INT32 sx = (offs >> 6) << 4; - - sy -= scrolly + 8; - if (sy < -15) sy += 1024; - sx -= scrollx + 80; - if (sx < -15) sx += 1024; - - if (sy >= nScreenHeight || sx >= nScreenWidth) continue; - - INT32 attr = DrvBgRAM[offs * 2 + 0]; - INT32 code = DrvBgRAM[offs * 2 + 1] | ((attr & 0x07) << 8); - INT32 color = attr >> 5; - INT32 flipy = attr & 0x08; - - INT32 group = (attr & 0x10) >> 4; - if ((type >> 1) != group) continue; - - { - color = (color << 4) + 0x80; - if (flipy) flipy = 0xf0; - UINT8 *src = DrvGfxROM1 + (code << 8); - UINT16 *dst; - - if (*flipscreen) { - flipy ^= 0xff; - sx = 336 - sx; - sy = 224 - sy; - } - - for (INT32 y = 0; y < 16; y++, sy++) { - if (sy < 0 || sy >= nScreenHeight) continue; - - dst = pTransDraw + sy * nScreenWidth; - - for (INT32 x = 0; x < 16; x++, sx++) { - if (sx < 0 || sx >= nScreenWidth) continue; - - INT32 pxl = src[((y << 4) | x) ^ flipy]; - - if (mask & (1 << pxl)) continue; - - dst[sx] = pxl | color; - } - - sx -= 16; - } - } - } -} - -static void draw_foreground_layer(INT32 priority) -{ - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sy = (offs & 0x1f) << 3; - INT32 sx = (offs >> 5) << 3; - - sx -= 80; - sy -= 8; - - if (sx < -15 || sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 attr = DrvFgRAM[offs * 2 + 0]; - - INT32 code = DrvFgRAM[offs * 2 + 1] | ((attr & 0x03) << 8); - INT32 color = (attr & 0x3c) >> 2; - INT32 prio = (attr & 0x40) >> 6; - - if (prio != priority) continue; - - if (*flipscreen) { - sx = 344 - sx; - sy = 232 - sy; - - if (priority) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0x1c0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx - 80, sy, color, 2, 3, 0x1c0, DrvGfxROM0); - } - } else { - if (priority) { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 2, 0x1c0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 3, 0x1c0, DrvGfxROM0); - } - } - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0x200-4; offs >= 0; offs -= 4) - { - INT32 attr = DrvSprBuf[offs + 1]; - INT32 code = DrvSprBuf[offs + 0] | ((attr & 0xe0) << 3); - INT32 sy = DrvSprBuf[offs + 2]; - INT32 sx = DrvSprBuf[offs + 3] | ((attr & 0x01) << 8); - INT32 color = (attr & 0x1c) >> 2; - INT32 flipy = (attr & 0x02); - INT32 flipx = 0; - - if (*flipscreen) - { - sx = 496 - sx; - sy = 240 - sy; - flipy ^= 2; - flipx = 1; - } - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx - 80, sy - 8, color, 4, 15, 0x100, DrvGfxROM2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx - 80, sy - 8, color, 4, 15, 0x100, DrvGfxROM2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx - 80, sy - 8, color, 4, 15, 0x100, DrvGfxROM2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx - 80, sy - 8, color, 4, 15, 0x100, DrvGfxROM2); - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - UINT8 r,g,b; - for (INT32 i = 0; i < 0x400; i+=2) { - INT32 d = DrvPalRAM[i + 1] | (DrvPalRAM[i + 0] << 8); - - r = (d >> 12); - g = (d >> 8) & 0x0f; - b = (d >> 4) & 0x0f; - - DrvPalette[i >> 1] = BurnHighCol((r << 4) | r, (g << 4) | g, (b << 4) | b, 0); - } - } - - if (nSpriteEnable & 1) draw_background_layer(1); // opaque - else BurnTransferClear(); - - if (nBurnLayer & 2) draw_background_layer(3); - if (nBurnLayer & 4) draw_foreground_layer(0); - - draw_sprites(); - - if (nBurnLayer & 1) draw_background_layer(2); - if (nBurnLayer & 8) draw_foreground_layer(1); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - INT32 nInterleave = 4; - INT32 nCyclesTotal[2] = { 1500000 / 60, 3000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - M6809Open(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - nCyclesDone[0] += M6809Run(nCyclesTotal[0] / nInterleave); - if (i == (nInterleave / 2) - 1) M6809SetIRQLine(1, M6809_IRQSTATUS_AUTO); - if (i == (nInterleave / 1) - 1) M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); - - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - ZetRaiseIrq(0); - } - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - - ZetClose(); - M6809Close(); - - if (pBurnDraw) { - DrvDraw(); - } - - memcpy (DrvSprBuf, DrvSprRAM, 0x200); - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029706; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - M6809Scan(nAction); - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - } - - { - M6809Open(0); - bankswitch(DrvBank[0]); - M6809Close(); - } - - return 0; -} - - -// The Speed Rumbler (set 1) - -static struct BurnRomInfo srumblerRomDesc[] = { - { "14e_sr04.bin", 0x8000, 0xa68ce89c, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code - { "13e_sr03.bin", 0x8000, 0x87bda812, 1 | BRF_PRG | BRF_ESS }, // 1 - { "12e_sr02.bin", 0x8000, 0xd8609cca, 1 | BRF_PRG | BRF_ESS }, // 2 - { "11e_sr01.bin", 0x8000, 0x27ec4776, 1 | BRF_PRG | BRF_ESS }, // 3 - { "14f_sr09.bin", 0x8000, 0x2146101d, 1 | BRF_PRG | BRF_ESS }, // 4 - { "13f_sr08.bin", 0x8000, 0x838369a6, 1 | BRF_PRG | BRF_ESS }, // 5 - { "12f_sr07.bin", 0x8000, 0xde785076, 1 | BRF_PRG | BRF_ESS }, // 6 - { "11f_sr06.bin", 0x8000, 0xa70f4fd4, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "2f_sr05.bin", 0x8000, 0x0177cebe, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "6g_sr10.bin", 0x4000, 0xadabe271, 3 | BRF_GRA }, // 9 Characters - - { "11a_sr11.bin", 0x8000, 0x5fa042ba, 4 | BRF_GRA }, // 10 Tiles - { "13a_sr12.bin", 0x8000, 0xa2db64af, 4 | BRF_GRA }, // 11 - { "14a_sr13.bin", 0x8000, 0xf1df5499, 4 | BRF_GRA }, // 12 - { "15a_sr14.bin", 0x8000, 0xb22b31b3, 4 | BRF_GRA }, // 13 - { "11c_sr15.bin", 0x8000, 0xca3a3af3, 4 | BRF_GRA }, // 14 - { "13c_sr16.bin", 0x8000, 0xc49a4a11, 4 | BRF_GRA }, // 15 - { "14c_sr17.bin", 0x8000, 0xaa80aaab, 4 | BRF_GRA }, // 16 - { "15c_sr18.bin", 0x8000, 0xce67868e, 4 | BRF_GRA }, // 17 - - { "15e_sr20.bin", 0x8000, 0x3924c861, 5 | BRF_GRA }, // 18 Sprites - { "14e_sr19.bin", 0x8000, 0xff8f9129, 5 | BRF_GRA }, // 19 - { "15f_sr22.bin", 0x8000, 0xab64161c, 5 | BRF_GRA }, // 20 - { "14f_sr21.bin", 0x8000, 0xfd64bcd1, 5 | BRF_GRA }, // 21 - { "15h_sr24.bin", 0x8000, 0xc972af3e, 5 | BRF_GRA }, // 22 - { "14h_sr23.bin", 0x8000, 0x8c9abf57, 5 | BRF_GRA }, // 23 - { "15j_sr26.bin", 0x8000, 0xd4f1732f, 5 | BRF_GRA }, // 24 - { "14j_sr25.bin", 0x8000, 0xd2a4ea4f, 5 | BRF_GRA }, // 25 - - { "63s141.12a", 0x0100, 0x8421786f, 6 | BRF_PRG | BRF_ESS }, // 26 Rom Bank Proms - { "63s141.13a", 0x0100, 0x6048583f, 6 | BRF_PRG | BRF_ESS }, // 27 - - { "63s141.8j", 0x0100, 0x1a89a7ff, 0 | BRF_OPT }, // 28 Priority Prom -}; - -STD_ROM_PICK(srumbler) -STD_ROM_FN(srumbler) - -struct BurnDriver BurnDrvSrumbler = { - "srumbler", NULL, NULL, NULL, "1986", - "The Speed Rumbler (set 1)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_SHOOT, 0, - NULL, srumblerRomInfo, srumblerRomName, NULL, NULL, SrumblerInputInfo, SrumblerDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x200, 240, 352, 3, 4 -}; - - -// The Speed Rumbler (set 2) - -static struct BurnRomInfo srumblr2RomDesc[] = { - { "14e_sr04.bin", 0x8000, 0xa68ce89c, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code - { "rc03.13e", 0x8000, 0xe82f78d4, 1 | BRF_PRG | BRF_ESS }, // 1 - { "rc02.12e", 0x8000, 0x009a62d8, 1 | BRF_PRG | BRF_ESS }, // 2 - { "rc01.11e", 0x8000, 0x2ac48d1d, 1 | BRF_PRG | BRF_ESS }, // 3 - { "rc09.14f", 0x8000, 0x64f23e72, 1 | BRF_PRG | BRF_ESS }, // 4 - { "rc08.13f", 0x8000, 0x74c71007, 1 | BRF_PRG | BRF_ESS }, // 5 - { "12f_sr07.bin", 0x8000, 0xde785076, 1 | BRF_PRG | BRF_ESS }, // 6 - { "11f_sr06.bin", 0x8000, 0xa70f4fd4, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "rc05.2f", 0x8000, 0xea04fa07, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "6g_sr10.bin", 0x4000, 0xadabe271, 3 | BRF_GRA }, // 9 Characters - - { "11a_sr11.bin", 0x8000, 0x5fa042ba, 4 | BRF_GRA }, // 10 Tiles - { "13a_sr12.bin", 0x8000, 0xa2db64af, 4 | BRF_GRA }, // 11 - { "14a_sr13.bin", 0x8000, 0xf1df5499, 4 | BRF_GRA }, // 12 - { "15a_sr14.bin", 0x8000, 0xb22b31b3, 4 | BRF_GRA }, // 13 - { "11c_sr15.bin", 0x8000, 0xca3a3af3, 4 | BRF_GRA }, // 14 - { "13c_sr16.bin", 0x8000, 0xc49a4a11, 4 | BRF_GRA }, // 15 - { "14c_sr17.bin", 0x8000, 0xaa80aaab, 4 | BRF_GRA }, // 16 - { "15c_sr18.bin", 0x8000, 0xce67868e, 4 | BRF_GRA }, // 17 - - { "15e_sr20.bin", 0x8000, 0x3924c861, 5 | BRF_GRA }, // 18 Sprites - { "14e_sr19.bin", 0x8000, 0xff8f9129, 5 | BRF_GRA }, // 19 - { "15f_sr22.bin", 0x8000, 0xab64161c, 5 | BRF_GRA }, // 20 - { "14f_sr21.bin", 0x8000, 0xfd64bcd1, 5 | BRF_GRA }, // 21 - { "15h_sr24.bin", 0x8000, 0xc972af3e, 5 | BRF_GRA }, // 22 - { "14h_sr23.bin", 0x8000, 0x8c9abf57, 5 | BRF_GRA }, // 23 - { "15j_sr26.bin", 0x8000, 0xd4f1732f, 5 | BRF_GRA }, // 24 - { "14j_sr25.bin", 0x8000, 0xd2a4ea4f, 5 | BRF_GRA }, // 25 - - { "63s141.12a", 0x0100, 0x8421786f, 6 | BRF_PRG | BRF_ESS }, // 26 Rom Bank Proms - { "63s141.13a", 0x0100, 0x6048583f, 6 | BRF_PRG | BRF_ESS }, // 27 - - { "63s141.8j", 0x0100, 0x1a89a7ff, 0 | BRF_OPT }, // 28 Priority Prom -}; - -STD_ROM_PICK(srumblr2) -STD_ROM_FN(srumblr2) - -struct BurnDriver BurnDrvSrumblr2 = { - "srumbler2", "srumbler", NULL, NULL, "1986", - "The Speed Rumbler (set 2)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_SHOOT, 0, - NULL, srumblr2RomInfo, srumblr2RomName, NULL, NULL, SrumblerInputInfo, SrumblerDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x200, 240, 352, 3, 4 -}; - - -// Rush & Crash (Japan) - -static struct BurnRomInfo rushcrshRomDesc[] = { - { "14e_sr04.bin", 0x8000, 0xa68ce89c, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code - { "rc03.bin", 0x8000, 0xa49c9be0, 1 | BRF_PRG | BRF_ESS }, // 1 - { "rc02.12e", 0x8000, 0x009a62d8, 1 | BRF_PRG | BRF_ESS }, // 2 - { "rc01.11e", 0x8000, 0x2ac48d1d, 1 | BRF_PRG | BRF_ESS }, // 3 - { "rc09.14f", 0x8000, 0x64f23e72, 1 | BRF_PRG | BRF_ESS }, // 4 - { "rc08.bin", 0x8000, 0x2c25874b, 1 | BRF_PRG | BRF_ESS }, // 5 - { "12f_sr07.bin", 0x8000, 0xde785076, 1 | BRF_PRG | BRF_ESS }, // 6 - { "11f_sr06.bin", 0x8000, 0xa70f4fd4, 1 | BRF_PRG | BRF_ESS }, // 7 - - { "rc05.2f", 0x8000, 0xea04fa07, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 Code - - { "rc10.bin", 0x4000, 0x0a3c0b0d, 3 | BRF_GRA }, // 9 Characters - - { "11a_sr11.bin", 0x8000, 0x5fa042ba, 4 | BRF_GRA }, // 10 Tiles - { "13a_sr12.bin", 0x8000, 0xa2db64af, 4 | BRF_GRA }, // 11 - { "14a_sr13.bin", 0x8000, 0xf1df5499, 4 | BRF_GRA }, // 12 - { "15a_sr14.bin", 0x8000, 0xb22b31b3, 4 | BRF_GRA }, // 13 - { "11c_sr15.bin", 0x8000, 0xca3a3af3, 4 | BRF_GRA }, // 14 - { "13c_sr16.bin", 0x8000, 0xc49a4a11, 4 | BRF_GRA }, // 15 - { "14c_sr17.bin", 0x8000, 0xaa80aaab, 4 | BRF_GRA }, // 16 - { "15c_sr18.bin", 0x8000, 0xce67868e, 4 | BRF_GRA }, // 17 - - { "15e_sr20.bin", 0x8000, 0x3924c861, 5 | BRF_GRA }, // 18 Sprites - { "14e_sr19.bin", 0x8000, 0xff8f9129, 5 | BRF_GRA }, // 19 - { "15f_sr22.bin", 0x8000, 0xab64161c, 5 | BRF_GRA }, // 20 - { "14f_sr21.bin", 0x8000, 0xfd64bcd1, 5 | BRF_GRA }, // 21 - { "15h_sr24.bin", 0x8000, 0xc972af3e, 5 | BRF_GRA }, // 22 - { "14h_sr23.bin", 0x8000, 0x8c9abf57, 5 | BRF_GRA }, // 23 - { "15j_sr26.bin", 0x8000, 0xd4f1732f, 5 | BRF_GRA }, // 24 - { "14j_sr25.bin", 0x8000, 0xd2a4ea4f, 5 | BRF_GRA }, // 25 - - { "63s141.12a", 0x0100, 0x8421786f, 6 | BRF_PRG | BRF_ESS }, // 26 Rom Bank Proms - { "63s141.13a", 0x0100, 0x6048583f, 6 | BRF_PRG | BRF_ESS }, // 27 - - { "63s141.8j", 0x0100, 0x1a89a7ff, 0 | BRF_OPT }, // 28 Priority Prom -}; - -STD_ROM_PICK(rushcrsh) -STD_ROM_FN(rushcrsh) - -struct BurnDriver BurnDrvRushcrsh = { - "rushcrsh", "srumbler", NULL, NULL, "1986", - "Rush & Crash (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_SHOOT, 0, - NULL, rushcrshRomInfo, rushcrshRomName, NULL, NULL, SrumblerInputInfo, SrumblerDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x200, 240, 352, 3, 4 -}; - +// FB Alpha The Speed Rumbler driver module +// Based on MAME driver by Paul Leaman + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "m6809_intf.h" +#include "burn_ym2203.h" + +static UINT8 *AllMem; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *DrvM6809ROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvPROM; +static UINT8 *DrvM6809RAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf; +static UINT8 *DrvBgRAM; +static UINT8 *DrvFgRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *DrvBank; +static UINT8 *DrvScroll; +static UINT8 *flipscreen; +static UINT8 *soundlatch; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo SrumblerInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Srumbler) + +static struct BurnDIPInfo SrumblerDIPList[]= +{ + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x73, NULL }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credits" }, + {0x11, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, + {0x11, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, + {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x07, 0x03, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credits" }, + {0x11, 0x01, 0x38, 0x08, "3 Coins 1 Credits" }, + {0x11, 0x01, 0x38, 0x10, "2 Coins 1 Credits" }, + {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x38, 0x18, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x11, 0x01, 0x40, 0x40, "Off" }, + {0x11, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x04, 0x00, "Upright" }, + {0x12, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x12, 0x01, 0x18, 0x18, "20k 70k and every 70k"}, + {0x12, 0x01, 0x18, 0x10, "30k 80k and every 80k"}, + {0x12, 0x01, 0x18, 0x08, "20k 80k" }, + {0x12, 0x01, 0x18, 0x00, "30k 80k" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x60, 0x40, "Easy" }, + {0x12, 0x01, 0x60, 0x60, "Normal" }, + {0x12, 0x01, 0x60, 0x20, "Difficult" }, + {0x12, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x12, 0x01, 0x80, 0x00, "No" }, + {0x12, 0x01, 0x80, 0x80, "Yes" }, +}; + +STDDIPINFO(Srumbler) + +static void bankswitch(INT32 data) +{ + DrvBank[0] = data; + + for (INT32 i = 0x05; i < 0x10; i++) + { + INT32 bank = DrvPROM[(data & 0xf0) | i] | DrvPROM[0x100 | ((data & 0x0f) << 4) | i]; + + M6809MapMemory(DrvM6809ROM + bank * 0x1000, 0x1000 * i, 0x1000 * i + 0x0fff, M6809_ROM); + } +} + +void srumbler_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x4008: + bankswitch(data); + return; + + case 0x4009: + *flipscreen = data & 1; + return; + + case 0x400a: + case 0x400b: + case 0x400c: + case 0x400d: + DrvScroll[address - 0x400a] = data; + return; + + case 0x400e: + *soundlatch = data; + return; + } +} + +UINT8 srumbler_main_read(UINT16 address) +{ + switch (address) + { + case 0x4008: + return DrvInputs[0]; + + case 0x4009: + return DrvInputs[1]; + + case 0x400a: + return DrvInputs[2]; + + case 0x400b: + return DrvDips[0]; + + case 0x400c: + return DrvDips[1]; + } + + return 0; +} + +void __fastcall srumbler_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8000: + case 0x8001: + BurnYM2203Write(0, address & 1, data); + return; + + case 0xa000: + case 0xa001: + BurnYM2203Write(1, address & 1, data); + return; + } +} + +UINT8 __fastcall srumbler_sound_read(UINT16 address) +{ + if (address == 0xe000) { + return *soundlatch; + } + + return 0; +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3000000; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + M6809Open(0); + bankswitch(0); + M6809Reset(); + M6809Close(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvM6809ROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x020000; + DrvGfxROM1 = Next; Next += 0x080000; + DrvGfxROM2 = Next; Next += 0x080000; + + DrvPROM = Next; Next += 0x000200; + + DrvPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); + + AllRam = Next; + + DrvM6809RAM = Next; Next += 0x001e00; + DrvSprRAM = Next; Next += 0x000200; + DrvSprBuf = Next; Next += 0x000200; + + DrvBgRAM = Next; Next += 0x002000; + DrvFgRAM = Next; Next += 0x001000; + DrvPalRAM = Next; Next += 0x000400; + + DrvZ80RAM = Next; Next += 0x000800; + + DrvBank = Next; Next += 0x000001; + DrvScroll = Next; Next += 0x000004; + + flipscreen = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[2] = { 0x000004, 0x000000 }; + INT32 Plane1[4] = { 0x100004, 0x100000, 0x000004, 0x000000 }; + INT32 Plane2[4] = { 0x180000, 0x100000, 0x080000, 0x000000 }; + INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, + 0x100, 0x101, 0x102, 0x103, 0x108, 0x109, 0x10a, 0x10b }; + INT32 XOffs1[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087 }; + INT32 YOffs0[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, + 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0 }; + INT32 YOffs1[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, + 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x08000); + + GfxDecode(0x400, 2, 8, 8, Plane0, XOffs0, YOffs0, 0x080, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x40000); + + GfxDecode(0x800, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x200, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x40000); + + GfxDecode(0x800, 4, 16, 16, Plane2, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM2); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvM6809ROM + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvM6809ROM + 0x08000, 1, 1)) return 1; + if (BurnLoadRom(DrvM6809ROM + 0x10000, 2, 1)) return 1; + if (BurnLoadRom(DrvM6809ROM + 0x18000, 3, 1)) return 1; + if (BurnLoadRom(DrvM6809ROM + 0x20000, 4, 1)) return 1; + if (BurnLoadRom(DrvM6809ROM + 0x28000, 5, 1)) return 1; + if (BurnLoadRom(DrvM6809ROM + 0x30000, 6, 1)) return 1; + if (BurnLoadRom(DrvM6809ROM + 0x38000, 7, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x08000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x10000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x18000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x20000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x28000, 15, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x30000, 16, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x38000, 17, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 18, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x08000, 19, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x10000, 20, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x18000, 21, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x20000, 22, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x28000, 23, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x30000, 24, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x38000, 25, 1)) return 1; + + if (BurnLoadRom(DrvPROM + 0x00000, 26, 1)) return 1; + if (BurnLoadRom(DrvPROM + 0x00100, 27, 1)) return 1; + + for (INT32 i = 0; i < 0x100; i++) { + DrvPROM[i + 0x000] = (DrvPROM[i] & 0x03) << 4; + DrvPROM[i + 0x100] &= 0x0f; + } + + DrvGfxDecode(); + } + + M6809Init(1); + M6809Open(0); + M6809MapMemory(DrvM6809RAM, 0x0000, 0x1dff, M6809_RAM); + M6809MapMemory(DrvSprRAM, 0x1e00, 0x1fff, M6809_RAM); + M6809MapMemory(DrvBgRAM, 0x2000, 0x3fff, M6809_RAM); + M6809MapMemory(DrvFgRAM, 0x5000, 0x5fff, M6809_WRITE); + M6809MapMemory(DrvPalRAM, 0x7000, 0x73ff, M6809_WRITE); + M6809SetReadHandler(srumbler_main_read); + M6809SetWriteHandler(srumbler_main_write); + M6809Close(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(srumbler_sound_write); + ZetSetReadHandler(srumbler_sound_read); + ZetClose(); + + BurnYM2203Init(2, 4000000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.30, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.30, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.10, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + M6809Exit(); + ZetExit(); + + BurnYM2203Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_background_layer(INT32 type) +{ + INT32 scrollx = ((DrvScroll[1] << 8) | DrvScroll[0]) & 0x3ff; + INT32 scrolly = ((DrvScroll[3] << 8) | DrvScroll[2]) & 0x3ff; + + INT32 masks[4] = { 0xffff, 0x0000, 0x07ff, 0xf800 }; // 0, 1 + INT32 mask = masks[type]; + + for (INT32 offs = 0; offs < 64 * 64; offs++) + { + INT32 sy = (offs & 0x3f) << 4; + INT32 sx = (offs >> 6) << 4; + + sy -= scrolly + 8; + if (sy < -15) sy += 1024; + sx -= scrollx + 80; + if (sx < -15) sx += 1024; + + if (sy >= nScreenHeight || sx >= nScreenWidth) continue; + + INT32 attr = DrvBgRAM[offs * 2 + 0]; + INT32 code = DrvBgRAM[offs * 2 + 1] | ((attr & 0x07) << 8); + INT32 color = attr >> 5; + INT32 flipy = attr & 0x08; + + INT32 group = (attr & 0x10) >> 4; + if ((type >> 1) != group) continue; + + { + color = (color << 4) + 0x80; + if (flipy) flipy = 0xf0; + UINT8 *src = DrvGfxROM1 + (code << 8); + UINT16 *dst; + + if (*flipscreen) { + flipy ^= 0xff; + sx = 336 - sx; + sy = 224 - sy; + } + + for (INT32 y = 0; y < 16; y++, sy++) { + if (sy < 0 || sy >= nScreenHeight) continue; + + dst = pTransDraw + sy * nScreenWidth; + + for (INT32 x = 0; x < 16; x++, sx++) { + if (sx < 0 || sx >= nScreenWidth) continue; + + INT32 pxl = src[((y << 4) | x) ^ flipy]; + + if (mask & (1 << pxl)) continue; + + dst[sx] = pxl | color; + } + + sx -= 16; + } + } + } +} + +static void draw_foreground_layer(INT32 priority) +{ + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sy = (offs & 0x1f) << 3; + INT32 sx = (offs >> 5) << 3; + + sx -= 80; + sy -= 8; + + if (sx < -15 || sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 attr = DrvFgRAM[offs * 2 + 0]; + + INT32 code = DrvFgRAM[offs * 2 + 1] | ((attr & 0x03) << 8); + INT32 color = (attr & 0x3c) >> 2; + INT32 prio = (attr & 0x40) >> 6; + + if (prio != priority) continue; + + if (*flipscreen) { + sx = 344 - sx; + sy = 232 - sy; + + if (priority) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 2, 0x1c0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx - 80, sy, color, 2, 3, 0x1c0, DrvGfxROM0); + } + } else { + if (priority) { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 2, 0x1c0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 2, 3, 0x1c0, DrvGfxROM0); + } + } + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0x200-4; offs >= 0; offs -= 4) + { + INT32 attr = DrvSprBuf[offs + 1]; + INT32 code = DrvSprBuf[offs + 0] | ((attr & 0xe0) << 3); + INT32 sy = DrvSprBuf[offs + 2]; + INT32 sx = DrvSprBuf[offs + 3] | ((attr & 0x01) << 8); + INT32 color = (attr & 0x1c) >> 2; + INT32 flipy = (attr & 0x02); + INT32 flipx = 0; + + if (*flipscreen) + { + sx = 496 - sx; + sy = 240 - sy; + flipy ^= 2; + flipx = 1; + } + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx - 80, sy - 8, color, 4, 15, 0x100, DrvGfxROM2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx - 80, sy - 8, color, 4, 15, 0x100, DrvGfxROM2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx - 80, sy - 8, color, 4, 15, 0x100, DrvGfxROM2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx - 80, sy - 8, color, 4, 15, 0x100, DrvGfxROM2); + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + UINT8 r,g,b; + for (INT32 i = 0; i < 0x400; i+=2) { + INT32 d = DrvPalRAM[i + 1] | (DrvPalRAM[i + 0] << 8); + + r = (d >> 12); + g = (d >> 8) & 0x0f; + b = (d >> 4) & 0x0f; + + DrvPalette[i >> 1] = BurnHighCol((r << 4) | r, (g << 4) | g, (b << 4) | b, 0); + } + } + + if (nSpriteEnable & 1) draw_background_layer(1); // opaque + else BurnTransferClear(); + + if (nBurnLayer & 2) draw_background_layer(3); + if (nBurnLayer & 4) draw_foreground_layer(0); + + draw_sprites(); + + if (nBurnLayer & 1) draw_background_layer(2); + if (nBurnLayer & 8) draw_foreground_layer(1); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + INT32 nInterleave = 4; + INT32 nCyclesTotal[2] = { 1500000 / 60, 3000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + M6809Open(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + nCyclesDone[0] += M6809Run(nCyclesTotal[0] / nInterleave); + if (i == (nInterleave / 2) - 1) M6809SetIRQLine(1, M6809_IRQSTATUS_AUTO); + if (i == (nInterleave / 1) - 1) M6809SetIRQLine(0, M6809_IRQSTATUS_AUTO); + + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + ZetRaiseIrq(0); + } + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + + ZetClose(); + M6809Close(); + + if (pBurnDraw) { + DrvDraw(); + } + + memcpy (DrvSprBuf, DrvSprRAM, 0x200); + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029706; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + M6809Scan(nAction); + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + } + + { + M6809Open(0); + bankswitch(DrvBank[0]); + M6809Close(); + } + + return 0; +} + + +// The Speed Rumbler (set 1) + +static struct BurnRomInfo srumblerRomDesc[] = { + { "14e_sr04.bin", 0x8000, 0xa68ce89c, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code + { "13e_sr03.bin", 0x8000, 0x87bda812, 1 | BRF_PRG | BRF_ESS }, // 1 + { "12e_sr02.bin", 0x8000, 0xd8609cca, 1 | BRF_PRG | BRF_ESS }, // 2 + { "11e_sr01.bin", 0x8000, 0x27ec4776, 1 | BRF_PRG | BRF_ESS }, // 3 + { "14f_sr09.bin", 0x8000, 0x2146101d, 1 | BRF_PRG | BRF_ESS }, // 4 + { "13f_sr08.bin", 0x8000, 0x838369a6, 1 | BRF_PRG | BRF_ESS }, // 5 + { "12f_sr07.bin", 0x8000, 0xde785076, 1 | BRF_PRG | BRF_ESS }, // 6 + { "11f_sr06.bin", 0x8000, 0xa70f4fd4, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "2f_sr05.bin", 0x8000, 0x0177cebe, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "6g_sr10.bin", 0x4000, 0xadabe271, 3 | BRF_GRA }, // 9 Characters + + { "11a_sr11.bin", 0x8000, 0x5fa042ba, 4 | BRF_GRA }, // 10 Tiles + { "13a_sr12.bin", 0x8000, 0xa2db64af, 4 | BRF_GRA }, // 11 + { "14a_sr13.bin", 0x8000, 0xf1df5499, 4 | BRF_GRA }, // 12 + { "15a_sr14.bin", 0x8000, 0xb22b31b3, 4 | BRF_GRA }, // 13 + { "11c_sr15.bin", 0x8000, 0xca3a3af3, 4 | BRF_GRA }, // 14 + { "13c_sr16.bin", 0x8000, 0xc49a4a11, 4 | BRF_GRA }, // 15 + { "14c_sr17.bin", 0x8000, 0xaa80aaab, 4 | BRF_GRA }, // 16 + { "15c_sr18.bin", 0x8000, 0xce67868e, 4 | BRF_GRA }, // 17 + + { "15e_sr20.bin", 0x8000, 0x3924c861, 5 | BRF_GRA }, // 18 Sprites + { "14e_sr19.bin", 0x8000, 0xff8f9129, 5 | BRF_GRA }, // 19 + { "15f_sr22.bin", 0x8000, 0xab64161c, 5 | BRF_GRA }, // 20 + { "14f_sr21.bin", 0x8000, 0xfd64bcd1, 5 | BRF_GRA }, // 21 + { "15h_sr24.bin", 0x8000, 0xc972af3e, 5 | BRF_GRA }, // 22 + { "14h_sr23.bin", 0x8000, 0x8c9abf57, 5 | BRF_GRA }, // 23 + { "15j_sr26.bin", 0x8000, 0xd4f1732f, 5 | BRF_GRA }, // 24 + { "14j_sr25.bin", 0x8000, 0xd2a4ea4f, 5 | BRF_GRA }, // 25 + + { "63s141.12a", 0x0100, 0x8421786f, 6 | BRF_PRG | BRF_ESS }, // 26 Rom Bank Proms + { "63s141.13a", 0x0100, 0x6048583f, 6 | BRF_PRG | BRF_ESS }, // 27 + + { "63s141.8j", 0x0100, 0x1a89a7ff, 0 | BRF_OPT }, // 28 Priority Prom +}; + +STD_ROM_PICK(srumbler) +STD_ROM_FN(srumbler) + +struct BurnDriver BurnDrvSrumbler = { + "srumbler", NULL, NULL, NULL, "1986", + "The Speed Rumbler (set 1)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_SHOOT, 0, + NULL, srumblerRomInfo, srumblerRomName, NULL, NULL, SrumblerInputInfo, SrumblerDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x200, 240, 352, 3, 4 +}; + + +// The Speed Rumbler (set 2) + +static struct BurnRomInfo srumblr2RomDesc[] = { + { "14e_sr04.bin", 0x8000, 0xa68ce89c, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code + { "rc03.13e", 0x8000, 0xe82f78d4, 1 | BRF_PRG | BRF_ESS }, // 1 + { "rc02.12e", 0x8000, 0x009a62d8, 1 | BRF_PRG | BRF_ESS }, // 2 + { "rc01.11e", 0x8000, 0x2ac48d1d, 1 | BRF_PRG | BRF_ESS }, // 3 + { "rc09.14f", 0x8000, 0x64f23e72, 1 | BRF_PRG | BRF_ESS }, // 4 + { "rc08.13f", 0x8000, 0x74c71007, 1 | BRF_PRG | BRF_ESS }, // 5 + { "12f_sr07.bin", 0x8000, 0xde785076, 1 | BRF_PRG | BRF_ESS }, // 6 + { "11f_sr06.bin", 0x8000, 0xa70f4fd4, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "rc05.2f", 0x8000, 0xea04fa07, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "6g_sr10.bin", 0x4000, 0xadabe271, 3 | BRF_GRA }, // 9 Characters + + { "11a_sr11.bin", 0x8000, 0x5fa042ba, 4 | BRF_GRA }, // 10 Tiles + { "13a_sr12.bin", 0x8000, 0xa2db64af, 4 | BRF_GRA }, // 11 + { "14a_sr13.bin", 0x8000, 0xf1df5499, 4 | BRF_GRA }, // 12 + { "15a_sr14.bin", 0x8000, 0xb22b31b3, 4 | BRF_GRA }, // 13 + { "11c_sr15.bin", 0x8000, 0xca3a3af3, 4 | BRF_GRA }, // 14 + { "13c_sr16.bin", 0x8000, 0xc49a4a11, 4 | BRF_GRA }, // 15 + { "14c_sr17.bin", 0x8000, 0xaa80aaab, 4 | BRF_GRA }, // 16 + { "15c_sr18.bin", 0x8000, 0xce67868e, 4 | BRF_GRA }, // 17 + + { "15e_sr20.bin", 0x8000, 0x3924c861, 5 | BRF_GRA }, // 18 Sprites + { "14e_sr19.bin", 0x8000, 0xff8f9129, 5 | BRF_GRA }, // 19 + { "15f_sr22.bin", 0x8000, 0xab64161c, 5 | BRF_GRA }, // 20 + { "14f_sr21.bin", 0x8000, 0xfd64bcd1, 5 | BRF_GRA }, // 21 + { "15h_sr24.bin", 0x8000, 0xc972af3e, 5 | BRF_GRA }, // 22 + { "14h_sr23.bin", 0x8000, 0x8c9abf57, 5 | BRF_GRA }, // 23 + { "15j_sr26.bin", 0x8000, 0xd4f1732f, 5 | BRF_GRA }, // 24 + { "14j_sr25.bin", 0x8000, 0xd2a4ea4f, 5 | BRF_GRA }, // 25 + + { "63s141.12a", 0x0100, 0x8421786f, 6 | BRF_PRG | BRF_ESS }, // 26 Rom Bank Proms + { "63s141.13a", 0x0100, 0x6048583f, 6 | BRF_PRG | BRF_ESS }, // 27 + + { "63s141.8j", 0x0100, 0x1a89a7ff, 0 | BRF_OPT }, // 28 Priority Prom +}; + +STD_ROM_PICK(srumblr2) +STD_ROM_FN(srumblr2) + +struct BurnDriver BurnDrvSrumblr2 = { + "srumbler2", "srumbler", NULL, NULL, "1986", + "The Speed Rumbler (set 2)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_SHOOT, 0, + NULL, srumblr2RomInfo, srumblr2RomName, NULL, NULL, SrumblerInputInfo, SrumblerDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x200, 240, 352, 3, 4 +}; + + +// Rush & Crash (Japan) + +static struct BurnRomInfo rushcrshRomDesc[] = { + { "14e_sr04.bin", 0x8000, 0xa68ce89c, 1 | BRF_PRG | BRF_ESS }, // 0 M6809 Code + { "rc03.bin", 0x8000, 0xa49c9be0, 1 | BRF_PRG | BRF_ESS }, // 1 + { "rc02.12e", 0x8000, 0x009a62d8, 1 | BRF_PRG | BRF_ESS }, // 2 + { "rc01.11e", 0x8000, 0x2ac48d1d, 1 | BRF_PRG | BRF_ESS }, // 3 + { "rc09.14f", 0x8000, 0x64f23e72, 1 | BRF_PRG | BRF_ESS }, // 4 + { "rc08.bin", 0x8000, 0x2c25874b, 1 | BRF_PRG | BRF_ESS }, // 5 + { "12f_sr07.bin", 0x8000, 0xde785076, 1 | BRF_PRG | BRF_ESS }, // 6 + { "11f_sr06.bin", 0x8000, 0xa70f4fd4, 1 | BRF_PRG | BRF_ESS }, // 7 + + { "rc05.2f", 0x8000, 0xea04fa07, 2 | BRF_PRG | BRF_ESS }, // 8 Z80 Code + + { "rc10.bin", 0x4000, 0x0a3c0b0d, 3 | BRF_GRA }, // 9 Characters + + { "11a_sr11.bin", 0x8000, 0x5fa042ba, 4 | BRF_GRA }, // 10 Tiles + { "13a_sr12.bin", 0x8000, 0xa2db64af, 4 | BRF_GRA }, // 11 + { "14a_sr13.bin", 0x8000, 0xf1df5499, 4 | BRF_GRA }, // 12 + { "15a_sr14.bin", 0x8000, 0xb22b31b3, 4 | BRF_GRA }, // 13 + { "11c_sr15.bin", 0x8000, 0xca3a3af3, 4 | BRF_GRA }, // 14 + { "13c_sr16.bin", 0x8000, 0xc49a4a11, 4 | BRF_GRA }, // 15 + { "14c_sr17.bin", 0x8000, 0xaa80aaab, 4 | BRF_GRA }, // 16 + { "15c_sr18.bin", 0x8000, 0xce67868e, 4 | BRF_GRA }, // 17 + + { "15e_sr20.bin", 0x8000, 0x3924c861, 5 | BRF_GRA }, // 18 Sprites + { "14e_sr19.bin", 0x8000, 0xff8f9129, 5 | BRF_GRA }, // 19 + { "15f_sr22.bin", 0x8000, 0xab64161c, 5 | BRF_GRA }, // 20 + { "14f_sr21.bin", 0x8000, 0xfd64bcd1, 5 | BRF_GRA }, // 21 + { "15h_sr24.bin", 0x8000, 0xc972af3e, 5 | BRF_GRA }, // 22 + { "14h_sr23.bin", 0x8000, 0x8c9abf57, 5 | BRF_GRA }, // 23 + { "15j_sr26.bin", 0x8000, 0xd4f1732f, 5 | BRF_GRA }, // 24 + { "14j_sr25.bin", 0x8000, 0xd2a4ea4f, 5 | BRF_GRA }, // 25 + + { "63s141.12a", 0x0100, 0x8421786f, 6 | BRF_PRG | BRF_ESS }, // 26 Rom Bank Proms + { "63s141.13a", 0x0100, 0x6048583f, 6 | BRF_PRG | BRF_ESS }, // 27 + + { "63s141.8j", 0x0100, 0x1a89a7ff, 0 | BRF_OPT }, // 28 Priority Prom +}; + +STD_ROM_PICK(rushcrsh) +STD_ROM_FN(rushcrsh) + +struct BurnDriver BurnDrvRushcrsh = { + "rushcrsh", "srumbler", NULL, NULL, "1986", + "Rush & Crash (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_SHOOT, 0, + NULL, rushcrshRomInfo, rushcrshRomName, NULL, NULL, SrumblerInputInfo, SrumblerDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x200, 240, 352, 3, 4 +}; + diff --git a/src/burn/drv/pre90s/d_tecmo.cpp b/src/burn/drv/pre90s/d_tecmo.cpp index 04b2892c4..340afdfa5 100644 --- a/src/burn/drv/pre90s/d_tecmo.cpp +++ b/src/burn/drv/pre90s/d_tecmo.cpp @@ -1,1657 +1,1651 @@ -// FB Alpha Tecmo driver Module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "msm5205.h" - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvJoy6[8]; -static UINT8 DrvJoy11[8]; -static UINT8 DrvReset; -static UINT8 DrvInputs[11]; - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvSndROM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvTextRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvForeRAM; -static UINT8 *DrvBackRAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT16 *DrvBgScroll; -static UINT16 *DrvFgScroll; - -static INT32 tecmo_video_type; - -static UINT32 adpcm_pos; -static UINT32 adpcm_end; -static UINT32 adpcm_size; -static INT32 adpcm_data; -static UINT8 DrvHasADPCM; - -static UINT32 DrvZ80Bank; -static UINT8 soundlatch; -static UINT8 flipscreen; -static UINT8 DrvEnableNmi; - -static struct BurnInputInfo RygarInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy5 + 3, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy5 + 2, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy5 + 1, "p1 start" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, - {"P1 Down", BIT_DIGITAL , DrvJoy1 + 2, "p1 down", }, - {"P1 Up", BIT_DIGITAL , DrvJoy1 + 3, "p1 up", }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 1, "p1 fire 2"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy5 + 0, "p2 start" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down", }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up", }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 2"}, - - {"Service", BIT_DIGITAL , DrvJoy2 + 2, "diag" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvInputs + 6, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvInputs + 7, "dip" }, - {"Dip 3", BIT_DIPSWITCH, DrvInputs + 8, "dip" }, - {"Dip 4", BIT_DIPSWITCH, DrvInputs + 9, "dip" }, -}; - -STDINPUTINFO(Rygar) - -static struct BurnInputInfo BackfirtInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy6 + 2, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy6 + 3, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy6 + 1, "p1 start" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, - {"P1 Down", BIT_DIGITAL , DrvJoy1 + 2, "p1 down", }, - {"P1 Up", BIT_DIGITAL , DrvJoy1 + 3, "p1 up", }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 1, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy2 + 2, "p1 fire 3"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy6 + 0, "p2 start" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down", }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up", }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy4 + 2, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvInputs + 6, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvInputs + 7, "dip" }, - {"Dip 3", BIT_DIPSWITCH, DrvInputs + 8, "dip" }, - {"Dip 4", BIT_DIPSWITCH, DrvInputs + 9, "dip" }, -}; - -STDINPUTINFO(Backfirt) - -static struct BurnInputInfo GeminiInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy6 + 2, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy6 + 3, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy6 + 0, "p1 start" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, - {"P1 Down", BIT_DIGITAL , DrvJoy1 + 2, "p1 down", }, - {"P1 Up", BIT_DIGITAL , DrvJoy1 + 3, "p1 up", }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 1, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 2"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy6 + 1, "p2 start" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down", }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up", }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvInputs + 6, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvInputs + 7, "dip" }, - {"Dip 3", BIT_DIPSWITCH, DrvInputs + 8, "dip" }, - {"Dip 4", BIT_DIPSWITCH, DrvInputs + 9, "dip" }, -}; - -STDINPUTINFO(Gemini) - -static struct BurnInputInfo SilkwormInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy11 + 2, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy11 + 3, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy11 + 0, "p1 start" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, - {"P1 Down", BIT_DIGITAL , DrvJoy1 + 2, "p1 down", }, - {"P1 Up", BIT_DIGITAL , DrvJoy1 + 3, "p1 up", }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 1, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy2 + 2, "p1 fire 3"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy11 + 1, "p2 start" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down", }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up", }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy4 + 2, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvInputs + 6, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvInputs + 7, "dip" }, - {"Dip 3", BIT_DIPSWITCH, DrvInputs + 8, "dip" }, - {"Dip 4", BIT_DIPSWITCH, DrvInputs + 9, "dip" }, - -}; - -STDINPUTINFO(Silkworm) - -static struct BurnDIPInfo RygarDIPList[]= -{ - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x00, NULL }, - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0x00, NULL }, - - {0x12, 0xfe, 0, 4, "Coin A" }, - {0x12, 0x01, 0x03, 0x01, "2C 1C" }, - {0x12, 0x01, 0x03, 0x00, "1C 1C" }, - {0x12, 0x01, 0x03, 0x02, "1C 2C" }, - {0x12, 0x01, 0x03, 0x03, "1C 3C" }, - - {0x12, 0xfe, 0, 4, "Coin B" }, - {0x12, 0x01, 0x0C, 0x04, "2C 1C" }, - {0x12, 0x01, 0x0C, 0x00, "1C 1C" }, - {0x12, 0x01, 0x0C, 0x08, "1C 2C" }, - {0x12, 0x01, 0x0C, 0x0C, "1C 3C" }, - - {0x13, 0xfe, 0, 4, "Lives" }, - {0x13, 0x01, 0x03, 0x03, "2" }, - {0x13, 0x01, 0x03, 0x00, "3" }, - {0x13, 0x01, 0x03, 0x01, "4" }, - {0x13, 0x01, 0x03, 0x02, "5" }, - - {0x13, 0xfe, 0, 2, "Cabinet" }, - {0x13, 0x01, 0x04, 0x04, "Upright" }, - {0x13, 0x01, 0x04, 0x00, "Cocktail" }, - - {0x14, 0xfe, 0, 4, "Bonus Life" }, - {0x14, 0x01, 0x03, 0x00, "50000 200000 500000" }, - {0x14, 0x01, 0x03, 0x01, "100000 300000 600000" }, - {0x14, 0x01, 0x03, 0x02, "200000 500000" }, - {0x14, 0x01, 0x03, 0x03, "100000" }, - - {0x15, 0xfe, 0, 4, "Difficulty" }, - {0x15, 0x01, 0x03, 0x00, "Easy" }, - {0x15, 0x01, 0x03, 0x01, "Normal" }, - {0x15, 0x01, 0x03, 0x02, "Hard" }, - {0x15, 0x01, 0x03, 0x03, "Hardest" }, - - {0x15, 0xfe, 0, 2, "2P Can Start Anytime" }, - {0x15, 0x01, 0x04, 0x00, "No" }, - {0x15, 0x01, 0x04, 0x04, "Yes" }, - - {0x15, 0xfe, 0, 2, "Allow Continue" }, - {0x15, 0x01, 0x08, 0x00, "No" }, - {0x15, 0x01, 0x08, 0x08, "Yes" }, -}; - -STDDIPINFO(Rygar) - -static struct BurnDIPInfo GeminiDIPList[]= -{ - {0x11, 0xff, 0xff, 0x00, NULL }, - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x00, NULL }, - {0x14, 0xff, 0xff, 0x00, NULL }, - - {0x11, 0xfe, 0, 8, "Coin A" }, - {0x11, 0x01, 0x07, 0x06, "2C 1C" }, - {0x11, 0x01, 0x07, 0x00, "1C 1C" }, - {0x11, 0x01, 0x07, 0x07, "2C 3C" }, - {0x11, 0x01, 0x07, 0x01, "1C 2C" }, - {0x11, 0x01, 0x07, 0x02, "1C 3C" }, - {0x11, 0x01, 0x07, 0x03, "1C 4C" }, - {0x11, 0x01, 0x07, 0x04, "1C 5C" }, - {0x11, 0x01, 0x07, 0x05, "1C 6C" }, - - {0x11, 0xfe, 0, 2, "Final Round Continuation" }, - {0x11, 0x01, 0x08, 0x00, "Round 6" }, - {0x11, 0x01, 0x08, 0x08, "Round 7" }, - - {0x12, 0xfe, 0, 8, "Coin B" }, - {0x12, 0x01, 0x07, 0x06, "2C 1C" }, - {0x12, 0x01, 0x07, 0x00, "1C 1C" }, - {0x12, 0x01, 0x07, 0x07, "2C 3C" }, - {0x12, 0x01, 0x07, 0x01, "1C 2C" }, - {0x12, 0x01, 0x07, 0x02, "1C 3C" }, - {0x12, 0x01, 0x07, 0x03, "1C 4C" }, - {0x12, 0x01, 0x07, 0x04, "1C 5C" }, - {0x12, 0x01, 0x07, 0x05, "1C 6C" }, - - {0x12, 0xfe, 0, 2, "Buy in During Final Round" }, - {0x12, 0x01, 0x08, 0x00, "No" }, - {0x12, 0x01, 0x08, 0x08, "Yes" }, - - {0x13, 0xfe, 0, 4, "Lives" }, - {0x13, 0x01, 0x03, 0x03, "2" }, - {0x13, 0x01, 0x03, 0x00, "3" }, - {0x13, 0x01, 0x03, 0x01, "4" }, - {0x13, 0x01, 0x03, 0x02, "5" }, - - {0x13, 0xfe, 0, 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x00, "Easy" }, - {0x13, 0x01, 0x0c, 0x04, "Normal" }, - {0x13, 0x01, 0x0c, 0x08, "Hard" }, - {0x13, 0x01, 0x0c, 0x0c, "Hardest" }, - - {0x14, 0xfe, 0, 8, "Bonus Life" }, - {0x14, 0x01, 0x07, 0x00, "50000 200000" }, - {0x14, 0x01, 0x07, 0x01, "50000 300000" }, - {0x14, 0x01, 0x07, 0x02, "100000 500000" }, - {0x14, 0x01, 0x07, 0x03, "50000" }, - {0x14, 0x01, 0x07, 0x04, "100000" }, - {0x14, 0x01, 0x07, 0x05, "200000" }, - {0x14, 0x01, 0x07, 0x06, "300000" }, - {0x14, 0x01, 0x07, 0x07, "None" }, - - {0x14, 0xfe, 0, 2, "Demo Sounds" }, - {0x14, 0x01, 0x08, 0x08, "Off" }, - {0x14, 0x01, 0x08, 0x00, "On" }, -}; - -STDDIPINFO(Gemini) - -static struct BurnDIPInfo SilkwormDIPList[]= -{ - {0x13, 0xff, 0xff, 0x00, NULL }, - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0x00, NULL }, - {0x16, 0xff, 0xff, 0x00, NULL }, - - {0x13, 0xfe, 0, 4, "Coin A" }, - {0x13, 0x01, 0x3, 0x01, "2C 1C" }, - {0x13, 0x01, 0x3, 0x00, "1C 1C" }, - {0x13, 0x01, 0x3, 0x02, "1C 2C" }, - {0x13, 0x01, 0x3, 0x03, "1C 3C" }, - - {0x13, 0xfe, 0, 4, "Coin B" }, - {0x13, 0x01, 0xC, 0x04, "2C 1C" }, - {0x13, 0x01, 0xC, 0x00, "1C 1C" }, - {0x13, 0x01, 0xC, 0x08, "1C 2C" }, - {0x13, 0x01, 0xC, 0x0C, "1C 3C" }, - - {0x14, 0xfe, 0, 4 , "Lives" }, - {0x14, 0x01, 0x3, 0x03, "2" }, - {0x14, 0x01, 0x3, 0x00, "3" }, - {0x14, 0x01, 0x3, 0x01, "4" }, - {0x14, 0x01, 0x3, 0x02, "5" }, - - {0x14, 0xfe, 0, 2 , "Demo Sounds" }, - {0x14, 0x01, 0x8, 0x00, "Off" }, - {0x14, 0x01, 0x8, 0x08, "On" }, - - {0x15, 0xfe, 0, 8, "Bonus Life" }, - {0x15, 0x01, 0x7, 0x00, "50000 200000 500000" }, - {0x15, 0x01, 0x7, 0x01, "100000 300000 800000" }, - {0x15, 0x01, 0x7, 0x02, "50000 200000" }, - {0x15, 0x01, 0x7, 0x03, "100000 300000" }, - {0x15, 0x01, 0x7, 0x04, "50000" }, - {0x15, 0x01, 0x7, 0x05, "100000" }, - {0x15, 0x01, 0x7, 0x06, "200000" }, - {0x15, 0x01, 0x7, 0x07, "None" }, - - {0x16, 0xfe, 0, 6, "Difficulty" }, - {0x16, 0x01, 0x7, 0x00, "0" }, - {0x16, 0x01, 0x7, 0x01, "1" }, - {0x16, 0x01, 0x7, 0x02, "2" }, - {0x16, 0x01, 0x7, 0x03, "3" }, - {0x16, 0x01, 0x7, 0x04, "4" }, - {0x16, 0x01, 0x7, 0x05, "5" }, - - {0x16, 0xfe, 0, 2, "Allow Continue" }, - {0x16, 0x01, 0x8, 0x08, "No" }, - {0x16, 0x01, 0x8, 0x00, "Yes" }, -}; - -STDDIPINFO(Silkworm) - -static struct BurnDIPInfo BackfirtDIPList[]= -{ - {0x13, 0xff, 0xff, 0x00, NULL }, - {0x14, 0xff, 0xff, 0x10, NULL }, - {0x15, 0xff, 0xff, 0x00, NULL }, - {0x16, 0xff, 0xff, 0x00, NULL }, - - {0x13, 0xfe, 0, 4, "Coin A" }, - {0x13, 0x01, 0x3, 0x00, "1C 1C" }, - {0x13, 0x01, 0x3, 0x01, "1C 2C" }, - {0x13, 0x01, 0x3, 0x02, "1C 3C" }, - {0x13, 0x01, 0x3, 0x03, "1C 6C" }, - - {0x13, 0xfe, 0, 4, "Coin B" }, - {0x13, 0x01, 0xC, 0x04, "2C 1C" }, - {0x13, 0x01, 0xC, 0x00, "1C 1C" }, - {0x13, 0x01, 0xC, 0x08, "1C 2C" }, - {0x13, 0x01, 0xC, 0x0C, "1C 3C" }, - - {0x14, 0xfe, 0, 2, "Cabinet" }, - {0x14, 0x01, 0x10, 0x10, "Upright" }, - {0x14, 0x01, 0x10, 0x00, "Cocktail" }, - - {0x15, 0xfe, 0, 8, "Bonus Life" }, - {0x15, 0x01, 0x07, 0x00, "50000 200000 500000" }, - {0x15, 0x01, 0x07, 0x01, "100000 300000 800000" }, - {0x15, 0x01, 0x07, 0x02, "50000 200000" }, - {0x15, 0x01, 0x07, 0x03, "100000 300000" }, - {0x15, 0x01, 0x07, 0x04, "50000" }, - {0x15, 0x01, 0x07, 0x05, "100000" }, - {0x15, 0x01, 0x07, 0x06, "200000" }, - {0x15, 0x01, 0x07, 0x07, "None" }, - - // not verified - {0x15, 0xfe, 0, 6, "Difficulty" }, - {0x15, 0x01, 0x38, 0x00, "0" }, - {0x15, 0x01, 0x38, 0x08, "1" }, - {0x15, 0x01, 0x38, 0x10, "2" }, - {0x15, 0x01, 0x38, 0x18, "3" }, - {0x15, 0x01, 0x38, 0x20, "4" }, - {0x15, 0x01, 0x38, 0x28, "5" }, - - {0x16, 0xfe, 0, 2, "Allow Continue" }, - {0x16, 0x01, 0x04, 0x04, "No" }, - {0x16, 0x01, 0x04, 0x00, "Yes" }, - - {0x16, 0xfe, 0, 2, "Invincibility (Cheat)" }, - {0x16, 0x01, 0x08, 0x08, "No" }, - {0x16, 0x01, 0x08, 0x00, "Yes" }, -}; - -STDDIPINFO(Backfirt) - -UINT8 __fastcall rygar_main_read(UINT16 address) -{ - switch (address) - { - case 0xf800: - case 0xf801: - case 0xf802: - case 0xf803: - case 0xf804: - case 0xf805: - case 0xf806: - case 0xf807: - case 0xf808: - case 0xf809: - return DrvInputs[address & 0x0f]; - - case 0xf80f: - return DrvInputs[10]; - } - - return 0; -} - -static void bankswitch_w(INT32 data) -{ - DrvZ80Bank = 0x10000 + ((data & 0xf8) << 8); - - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80ROM0 + DrvZ80Bank); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80ROM0 + DrvZ80Bank); -} - -static inline void palette_write(INT32 offset) -{ - UINT16 data; - UINT8 r,g,b; - - data = *((UINT16*)(DrvPalRAM + (offset & ~1))); - - #ifdef LSB_FIRST - data = (data << 8) | (data >> 8); -#endif - - r = (data >> 4) & 0x0f; - g = (data >> 0) & 0x0f; - b = (data >> 8) & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - DrvPalette[offset >> 1] = BurnHighCol(r, g, b, 0); -} - -void __fastcall rygar_main_write(UINT16 address, UINT8 data) -{ - if ((address & 0xf000) == 0xe000) { - DrvPalRAM[address & 0x7ff] = data; - palette_write(address & 0x7ff); - return; - } - - switch (address) - { - case 0xf800: - DrvFgScroll[0] = (DrvFgScroll[0] & 0xff00) | data; - return; - - case 0xf801: - DrvFgScroll[0] = (DrvFgScroll[0] & 0x00ff) | (data << 8); - return; - - case 0xf802: - DrvFgScroll[1] = data; - return; - - case 0xf803: - DrvBgScroll[0] = (DrvBgScroll[0] & 0xff00) | data; - return; - - case 0xf804: - DrvBgScroll[0] = (DrvBgScroll[0] & 0x00ff) | (data << 8); - return; - - case 0xf805: - DrvBgScroll[1] = data; - return; - - case 0xf806: - soundlatch = data; - DrvEnableNmi = 1; - return; - - case 0xf807: - flipscreen = data & 1; - return; - - case 0xf808: - bankswitch_w(data); - return; - - case 0xf80b: - // watchdog reset - return; - } - - return; -} - -UINT8 __fastcall rygar_sound_read(UINT16 address) -{ - switch (address) - { - case 0xc000: - return soundlatch; - } - - return 0; -} - -void __fastcall rygar_sound_write(UINT16 address, UINT8 data) -{ - if ((address & 0xff80) == 0x2000) { - DrvZ80ROM1[address] = data; - return; - } - - switch (address) - { - case 0x8000: - case 0xa000: - BurnYM3812Write(0, data); - return; - - case 0x8001: - case 0xa001: - BurnYM3812Write(1, data); - return; - - case 0xc000: - if (DrvHasADPCM) { - adpcm_pos = data << 8; - MSM5205ResetWrite(0, 0); - } - return; - - case 0xc400: - case 0xd000: - adpcm_end = (data + 1) << 8; - return; - - case 0xc800: - case 0xe000: - if (DrvHasADPCM) { - MSM5205SetRoute(0, (data & 0x0f) / 15, BURN_SND_ROUTE_BOTH); - } - return; - - case 0xf000: - return; - } - - return; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x20000; - DrvZ80ROM1 = Next; Next += 0x08000; - - DrvSndROM = Next; Next += adpcm_size; - - DrvGfxROM0 = Next; Next += 0x10000; - DrvGfxROM1 = Next; Next += 0x80000; - DrvGfxROM2 = Next; Next += 0x80000; - DrvGfxROM3 = Next; Next += 0x80000; - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x01000; - DrvZ80RAM1 = Next; Next += 0x00800; - - DrvPalRAM = Next; Next += 0x00800; - DrvTextRAM = Next; Next += 0x00800; - DrvBackRAM = Next; Next += 0x00400; - DrvForeRAM = Next; Next += 0x00400; - DrvSprRAM = Next; Next += 0x00800; - - DrvBgScroll = (UINT16*)Next; Next += 0x00002 * sizeof(UINT16); - DrvFgScroll = (UINT16*)Next; Next += 0x00002 * sizeof(UINT16); - - DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); - if (tmp == NULL) { - return 1; - } - - static INT32 Planes[4] = { - 0x000, 0x001, 0x002, 0x003 - }; - - static INT32 XOffs[16] = { - 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, - 0x100, 0x104, 0x108, 0x10c, 0x110, 0x114, 0x118, 0x11c - }; - - static INT32 YOffs[16] = { - 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 - }; - - memcpy (tmp, DrvGfxROM0, 0x08000); - - GfxDecode(0x0400, 4, 8, 8, Planes, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x40000); - - GfxDecode(0x2000, 4, 8, 8, Planes, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x40000); - - GfxDecode(0x0800, 4, 16, 16, Planes, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); - - memcpy (tmp, DrvGfxROM3, 0x40000); - - GfxDecode(0x0800, 4, 16, 16, Planes, XOffs, YOffs, 0x400, tmp, DrvGfxROM3); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - bankswitch_w(0); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - if (DrvHasADPCM) MSM5205Reset(); - BurnYM3812Reset(); - - if (tecmo_video_type) { - memset (DrvZ80ROM1 + 0x2000, 0, 0x80); - } - - soundlatch = 0; - flipscreen = 0; - - adpcm_pos = 0; - adpcm_end = 0; - adpcm_data = -1; - - return 0; -} - -static void TecmoFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 TecmoSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(double)ZetTotalCycles() * nSoundRate / 4000000; -} - -static void TecmoMSM5205Vck() -{ - if (adpcm_pos >= adpcm_end || adpcm_pos >= adpcm_size) { - MSM5205ResetWrite(0, 1); - } else { - if (adpcm_data != -1) { - MSM5205DataWrite(0, adpcm_data & 0x0f); - adpcm_data = -1; - } else { - adpcm_data = DrvSndROM[adpcm_pos++ & (adpcm_size - 1)]; - MSM5205DataWrite(0, adpcm_data >> 4); - } - } -} - -static INT32 RygarInit() -{ - tecmo_video_type = 0; - DrvHasADPCM = 1; - adpcm_size = 0x4000; - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); - ZetMapArea(0xc000, 0xcfff, 0, DrvZ80RAM0); - ZetMapArea(0xc000, 0xcfff, 1, DrvZ80RAM0); - ZetMapArea(0xc000, 0xcfff, 2, DrvZ80RAM0); - ZetMapArea(0xd000, 0xd7ff, 0, DrvTextRAM); - ZetMapArea(0xd000, 0xd7ff, 1, DrvTextRAM); - ZetMapArea(0xd800, 0xdbff, 0, DrvForeRAM); - ZetMapArea(0xd800, 0xdbff, 1, DrvForeRAM); - ZetMapArea(0xdc00, 0xdfff, 0, DrvBackRAM); - ZetMapArea(0xdc00, 0xdfff, 1, DrvBackRAM); - ZetMapArea(0xe000, 0xe7ff, 0, DrvSprRAM); - ZetMapArea(0xe000, 0xe7ff, 1, DrvSprRAM); - ZetMapArea(0xe800, 0xefff, 0, DrvPalRAM); - ZetSetWriteHandler(rygar_main_write); - ZetSetReadHandler(rygar_main_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM1); - ZetMapArea(0x4000, 0x47ff, 0, DrvZ80RAM1); - ZetMapArea(0x4000, 0x47ff, 1, DrvZ80RAM1); - ZetMapArea(0x4000, 0x47ff, 2, DrvZ80RAM1); - ZetSetWriteHandler(rygar_sound_write); - ZetSetReadHandler(rygar_sound_read); - ZetMemEnd(); - ZetClose(); - - { - for (INT32 i = 0; i < 3; i++) { - if (BurnLoadRom(DrvZ80ROM0 + i * 0x8000, i + 0, 1)) return 1; - } - - if (BurnLoadRom(DrvZ80ROM1, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 4, 1)) return 1; - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x8000, i + 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + i * 0x8000, i + 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + i * 0x8000, i + 13, 1)) return 1; - } - - if (BurnLoadRom(DrvSndROM, 17, 1)) return 1; - - DrvGfxDecode(); - } - - BurnYM3812Init(4000000, &TecmoFMIRQHandler, &TecmoSynchroniseStream, 0); - BurnTimerAttachZetYM3812(4000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - MSM5205Init(0, TecmoSynchroniseStream, 400000, TecmoMSM5205Vck, MSM5205_S48_4B, 1); - MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - - -static INT32 SilkwormInit() -{ - tecmo_video_type = 1; - DrvHasADPCM = 1; - adpcm_size = 0x8000; - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); - ZetMapArea(0xc000, 0xc3ff, 0, DrvBackRAM); - ZetMapArea(0xc000, 0xc3ff, 1, DrvBackRAM); - ZetMapArea(0xc400, 0xc7ff, 0, DrvForeRAM); - ZetMapArea(0xc400, 0xc7ff, 1, DrvForeRAM); - ZetMapArea(0xc800, 0xcfff, 0, DrvTextRAM); - ZetMapArea(0xc800, 0xcfff, 1, DrvTextRAM); - ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM0); - ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM0); - ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe7ff, 0, DrvSprRAM); - ZetMapArea(0xe000, 0xe7ff, 1, DrvSprRAM); - ZetMapArea(0xe800, 0xefff, 0, DrvPalRAM); - ZetSetWriteHandler(rygar_main_write); - ZetSetReadHandler(rygar_main_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); - ZetSetWriteHandler(rygar_sound_write); - ZetSetReadHandler(rygar_sound_read); - ZetMemEnd(); - ZetClose(); - - { - for (INT32 i = 0; i < 2; i++) { - if (BurnLoadRom(DrvZ80ROM0 + i * 0x10000, i + 0, 1)) return 1; - } - - if (BurnLoadRom(DrvZ80ROM1, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 3, 1)) return 1; - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x10000, i + 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + i * 0x10000, i + 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + i * 0x10000, i + 12, 1)) return 1; - } - - if (BurnLoadRom(DrvSndROM, 16, 1)) return 1; - - DrvGfxDecode(); - } - - BurnYM3812Init(4000000, &TecmoFMIRQHandler, &TecmoSynchroniseStream, 0); - BurnTimerAttachZetYM3812(4000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - MSM5205Init(0, TecmoSynchroniseStream, 400000, TecmoMSM5205Vck, MSM5205_S48_4B, 1); - MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 GeminiInit() -{ - tecmo_video_type = 2; - DrvHasADPCM = 1; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "backfirt")) DrvHasADPCM = 0; - if (DrvHasADPCM) adpcm_size = 0x8000; - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); - ZetMapArea(0xc000, 0xcfff, 0, DrvZ80RAM0); - ZetMapArea(0xc000, 0xcfff, 1, DrvZ80RAM0); - ZetMapArea(0xc000, 0xcfff, 2, DrvZ80RAM0); - ZetMapArea(0xd000, 0xd7ff, 0, DrvTextRAM); - ZetMapArea(0xd000, 0xd7ff, 1, DrvTextRAM); - ZetMapArea(0xd800, 0xdbff, 0, DrvForeRAM); - ZetMapArea(0xd800, 0xdbff, 1, DrvForeRAM); - ZetMapArea(0xdc00, 0xdfff, 0, DrvBackRAM); - ZetMapArea(0xdc00, 0xdfff, 1, DrvBackRAM); - ZetMapArea(0xe000, 0xe7ff, 0, DrvPalRAM); - ZetMapArea(0xe800, 0xefff, 0, DrvSprRAM); - ZetMapArea(0xe800, 0xefff, 1, DrvSprRAM); - ZetSetWriteHandler(rygar_main_write); - ZetSetReadHandler(rygar_main_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); - ZetSetWriteHandler(rygar_sound_write); - ZetSetReadHandler(rygar_sound_read); - ZetMemEnd(); - ZetClose(); - - { - for (INT32 i = 0; i < 2; i++) { - if (BurnLoadRom(DrvZ80ROM0 + i * 0x10000, i + 0, 1)) return 1; - } - - if (BurnLoadRom(DrvZ80ROM1, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 3, 1)) return 1; - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x10000, i + 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + i * 0x10000, i + 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + i * 0x10000, i + 12, 1)) return 1; - } - - BurnLoadRom(DrvSndROM, 16, 1); - - DrvGfxDecode(); - } - - BurnYM3812Init(4000000, &TecmoFMIRQHandler, &TecmoSynchroniseStream, 0); - BurnTimerAttachZetYM3812(4000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - if (DrvHasADPCM) { - MSM5205Init(0, TecmoSynchroniseStream, 400000, TecmoMSM5205Vck, MSM5205_S48_4B, 1); - MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - } - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - if (DrvHasADPCM) MSM5205Exit(); - BurnYM3812Exit(); - - GenericTilesExit(); - - ZetExit(); - - BurnFree (AllMem); - - DrvHasADPCM = 0; - - return 0; -} - -static inline INT32 calc_sprite_offset(INT32 code, INT32 x, INT32 y) -{ - INT32 ofst = 0; - if (x & 0x001) ofst |= 0x01; - if (y & 0x001) ofst |= 0x02; - if (x & 0x002) ofst |= 0x04; - if (y & 0x002) ofst |= 0x08; - if (x & 0x004) ofst |= 0x10; - if (y & 0x004) ofst |= 0x20; - - return (ofst + code) & 0x1fff; -} - -static void draw_sprites(INT32 priority) -{ - for (INT32 offs = 0; offs < 0x800; offs += 8) - { - INT32 flags = DrvSprRAM[offs+3]; - if (priority != (flags >> 6)) continue; - - INT32 bank = DrvSprRAM[offs+0]; - - if (bank & 4) - { - INT32 which = DrvSprRAM[offs+1]; - INT32 code, xpos, ypos, flipx, flipy, x, y; - INT32 size = DrvSprRAM[offs + 2] & 3; - - if (tecmo_video_type) - code = which + ((bank & 0xf8) << 5); - else - code = which + ((bank & 0xf0) << 4); - - code &= ~((1 << (size << 1)) - 1); - size = 1 << size; - - xpos = DrvSprRAM[offs + 5] - ((flags & 0x10) << 4); - ypos = DrvSprRAM[offs + 4] - ((flags & 0x20) << 3); - flipx = bank & 1; - flipy = bank & 2; - - for (y = 0; y < size; y++) - { - for (x = 0; x < size; x++) - { - INT32 sx = xpos + ((flipx ? (size - 1 - x) : x) << 3); - INT32 sy = ypos + ((flipy ? (size - 1 - y) : y) << 3); - sy -= 16; - - if (sy < -7 || sx < -7 || sx > 255 || sy > 223) continue; - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1); - } - } - } - } - } - } -} - -static INT32 draw_layer(UINT8 *vidram, UINT8 *gfx_base, INT32 paloffs, UINT16 *scroll) -{ - for (INT32 offs = 0; offs < 32 * 16; offs++) - { - INT32 sx = (offs & 0x1f) << 4; - INT32 sy = (offs >> 5) << 4; - - sx -= scroll[0] & 0x1ff; - - if (flipscreen) { - sx += 48 + 256; - } else { - sx -= 48; - } - - if (sx < -15) sx += 0x200; - if (sx > 511) sx -= 0x200; - sy -= scroll[1] + 16; - if (sy < -15) sy += 0x100; - - if (sx > nScreenWidth || sy > nScreenHeight) continue; - - UINT8 color = vidram[0x200 | offs]; - INT32 code = vidram[offs]; - - if (tecmo_video_type == 2) { - color = (color << 4) | (color >> 4); - } - - code |= ((color & 7) << 8); - color >>= 4; - - if (sx < 0 || sy < 0 || sx > nScreenWidth - 16 || sy > nScreenHeight - 16) { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, paloffs, gfx_base); - } else { - Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, paloffs, gfx_base); - } - } - - return 0; -} - -static void draw_text_layer() -{ - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - INT32 color = DrvTextRAM[offs | 0x400]; - - INT32 code = DrvTextRAM[offs] | ((color & 3) << 8); - - color >>= 4; - - if (sy < 16 || sy > 239) continue; - - Render8x8Tile_Mask(pTransDraw, code, sx, sy-16, color, 4, 0, 0x100, DrvGfxROM0); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x800; i+=2) { - palette_write(i); - } - DrvRecalc = 0; - } - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x100; - } - - draw_sprites(3); - - draw_layer(DrvBackRAM, DrvGfxROM3, 0x300, DrvBgScroll); - - draw_sprites(2); - - draw_layer(DrvForeRAM, DrvGfxROM2, 0x200, DrvFgScroll); - - draw_sprites(1); - draw_sprites(0); - - draw_text_layer(); - - if (flipscreen) { - INT32 nSize = (nScreenWidth * nScreenHeight) - 1; - for (INT32 i = 0; i < nSize >> 1; i++) { - INT32 n = pTransDraw[i]; - pTransDraw[i] = pTransDraw[nSize - i]; - pTransDraw[nSize - i] = n; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0, 6); - DrvInputs[10] = 0; - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[ 0] ^= DrvJoy1[i] << i; - DrvInputs[ 1] ^= DrvJoy2[i] << i; - DrvInputs[ 2] ^= DrvJoy3[i] << i; - DrvInputs[ 3] ^= DrvJoy4[i] << i; - DrvInputs[ 4] ^= DrvJoy5[i] << i; - DrvInputs[ 5] ^= DrvJoy6[i] << i; - DrvInputs[10] ^= DrvJoy11[i] << i; - } - } - - ZetNewFrame(); - - INT32 nSegment; - INT32 nInterleave = 10; - if (DrvHasADPCM) nInterleave = MSM5205CalcInterleave(0, 4000000); - INT32 nTotalCycles[2] = { 6000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); - - ZetOpen(0); - nCyclesDone[0] += ZetRun(nSegment); - if (i == (nInterleave-1)) ZetRaiseIrq(0); - ZetClose(); - - ZetOpen(1); - if (DrvEnableNmi) { - ZetNmi(); - DrvEnableNmi = 0; - } - BurnTimerUpdateYM3812(i * (nTotalCycles[1] / nInterleave)); - if (DrvHasADPCM) MSM5205Update(); - ZetClose(); - } - - ZetOpen(1); - if (pBurnSoundOut) { - BurnTimerEndFrameYM3812(nTotalCycles[1]); - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - if (DrvHasADPCM) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029622; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ba.Data = DrvZ80ROM1 + 0x2000; - ba.nLen = 0x80; - ba.szName = "Sound Z80 RAM"; - BurnAcb(&ba); - - ZetScan(nAction); - BurnYM3812Scan(nAction, pnMin); - if (DrvHasADPCM) MSM5205Scan(nAction, pnMin); - - SCAN_VAR(flipscreen); - SCAN_VAR(soundlatch); - SCAN_VAR(DrvZ80Bank); - - SCAN_VAR(adpcm_pos); - SCAN_VAR(adpcm_end); - } - - ZetOpen(0); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80ROM0 + DrvZ80Bank); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80ROM0 + DrvZ80Bank); - ZetClose(); - - return 0; -} - - -// Rygar (US set 1) - -static struct BurnRomInfo rygarRomDesc[] = { - { "5.5p", 0x08000, 0x062cd55d, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code - { "cpu_5m.bin", 0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "cpu_5j.bin", 0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "cpu_4h.bin", 0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, // 3 - Z80 Code - - { "cpu_8k.bin", 0x08000, 0x4d482fb6, 3 | BRF_GRA }, // 4 - Characters - - { "vid_6k.bin", 0x08000, 0xaba6db9e, 4 | BRF_GRA }, // 5 - Sprites - { "vid_6j.bin", 0x08000, 0xae1f2ed6, 4 | BRF_GRA }, // 6 - { "vid_6h.bin", 0x08000, 0x46d9e7df, 4 | BRF_GRA }, // 7 - { "vid_6g.bin", 0x08000, 0x45839c9a, 4 | BRF_GRA }, // 8 - - { "vid_6p.bin", 0x08000, 0x9eae5f8e, 5 | BRF_GRA }, // 9 - Foreground Tiles - { "vid_6o.bin", 0x08000, 0x5a10a396, 5 | BRF_GRA }, // 10 - { "vid_6n.bin", 0x08000, 0x7b12cf3f, 5 | BRF_GRA }, // 11 - { "vid_6l.bin", 0x08000, 0x3cea7eaa, 5 | BRF_GRA }, // 12 - - { "vid_6f.bin", 0x08000, 0x9840edd8, 6 | BRF_GRA }, // 13 - Background Tiles - { "vid_6e.bin", 0x08000, 0xff65e074, 6 | BRF_GRA }, // 14 - { "vid_6c.bin", 0x08000, 0x89868c85, 6 | BRF_GRA }, // 15 - { "vid_6b.bin", 0x08000, 0x35389a7b, 6 | BRF_GRA }, // 16 - - { "cpu_1f.bin", 0x04000, 0x3cc98c5a, 7 | BRF_SND }, // 17 - Samples -}; - -STD_ROM_PICK(rygar) -STD_ROM_FN(rygar) - -struct BurnDriver BurnDrvRygar = { - "rygar", NULL, NULL, NULL, "1986", - "Rygar (US set 1)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, rygarRomInfo, rygarRomName, NULL, NULL, RygarInputInfo, RygarDIPInfo, - RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Rygar (US set 2) - -static struct BurnRomInfo rygar2RomDesc[] = { - { "5p.bin", 0x08000, 0x151ffc0b, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code - { "cpu_5m.bin", 0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "cpu_5j.bin", 0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "cpu_4h.bin", 0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, // 3 - Z80 Code - - { "cpu_8k.bin", 0x08000, 0x4d482fb6, 3 | BRF_GRA }, // 4 - Characters - - { "vid_6k.bin", 0x08000, 0xaba6db9e, 4 | BRF_GRA }, // 5 - Sprites - { "vid_6j.bin", 0x08000, 0xae1f2ed6, 4 | BRF_GRA }, // 6 - { "vid_6h.bin", 0x08000, 0x46d9e7df, 4 | BRF_GRA }, // 7 - { "vid_6g.bin", 0x08000, 0x45839c9a, 4 | BRF_GRA }, // 8 - - { "vid_6p.bin", 0x08000, 0x9eae5f8e, 5 | BRF_GRA }, // 9 - Foreground Tiles - { "vid_6o.bin", 0x08000, 0x5a10a396, 5 | BRF_GRA }, // 10 - { "vid_6n.bin", 0x08000, 0x7b12cf3f, 5 | BRF_GRA }, // 11 - { "vid_6l.bin", 0x08000, 0x3cea7eaa, 5 | BRF_GRA }, // 12 - - { "vid_6f.bin", 0x08000, 0x9840edd8, 6 | BRF_GRA }, // 13 - Background Tiles - { "vid_6e.bin", 0x08000, 0xff65e074, 6 | BRF_GRA }, // 14 - { "vid_6c.bin", 0x08000, 0x89868c85, 6 | BRF_GRA }, // 15 - { "vid_6b.bin", 0x08000, 0x35389a7b, 6 | BRF_GRA }, // 16 - - { "cpu_1f.bin", 0x04000, 0x3cc98c5a, 7 | BRF_SND }, // 17 - Samples -}; - -STD_ROM_PICK(rygar2) -STD_ROM_FN(rygar2) - -struct BurnDriver BurnDrvRygar2 = { - "rygar2", "rygar", NULL, NULL, "1986", - "Rygar (US set 2)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, rygar2RomInfo, rygar2RomName, NULL, NULL, RygarInputInfo, RygarDIPInfo, - RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Rygar (US set 3, old version) - -static struct BurnRomInfo rygar3RomDesc[] = { - { "cpu_5p.bin", 0x08000, 0xe79c054a, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code - { "cpu_5m.bin", 0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "cpu_5j.bin", 0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "cpu_4h.bin", 0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, // 3 - Z80 Code - - { "cpu_8k.bin", 0x08000, 0x4d482fb6, 3 | BRF_GRA }, // 4 - Characters - - { "vid_6k.bin", 0x08000, 0xaba6db9e, 4 | BRF_GRA }, // 5 - Sprites - { "vid_6j.bin", 0x08000, 0xae1f2ed6, 4 | BRF_GRA }, // 6 - { "vid_6h.bin", 0x08000, 0x46d9e7df, 4 | BRF_GRA }, // 7 - { "vid_6g.bin", 0x08000, 0x45839c9a, 4 | BRF_GRA }, // 8 - - { "vid_6p.bin", 0x08000, 0x9eae5f8e, 5 | BRF_GRA }, // 9 - Foreground Tiles - { "vid_6o.bin", 0x08000, 0x5a10a396, 5 | BRF_GRA }, // 10 - { "vid_6n.bin", 0x08000, 0x7b12cf3f, 5 | BRF_GRA }, // 11 - { "vid_6l.bin", 0x08000, 0x3cea7eaa, 5 | BRF_GRA }, // 12 - - { "vid_6f.bin", 0x08000, 0x9840edd8, 6 | BRF_GRA }, // 13 - Background Tiles - { "vid_6e.bin", 0x08000, 0xff65e074, 6 | BRF_GRA }, // 14 - { "vid_6c.bin", 0x08000, 0x89868c85, 6 | BRF_GRA }, // 15 - { "vid_6b.bin", 0x08000, 0x35389a7b, 6 | BRF_GRA }, // 16 - - { "cpu_1f.bin", 0x04000, 0x3cc98c5a, 7 | BRF_SND }, // 17 - Samples -}; - -STD_ROM_PICK(rygar3) -STD_ROM_FN(rygar3) - -struct BurnDriver BurnDrvRygar3 = { - "rygar3", "rygar", NULL, NULL, "1986", - "Rygar (US set 3, old version)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, rygar3RomInfo, rygar3RomName, NULL, NULL, RygarInputInfo, RygarDIPInfo, - RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Argus no Senshi (Japan) - -static struct BurnRomInfo rygarjRomDesc[] = { - { "cpuj_5p.bin",0x08000, 0xb39698ba, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code - { "cpuj_5m.bin",0x04000, 0x3f180979, 1 | BRF_PRG | BRF_ESS }, // 1 - { "cpuj_5j.bin",0x08000, 0x69e44e8f, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "cpu_4h.bin", 0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, // 3 - Z80 Code - - { "cpuj_8k.bin",0x08000, 0x45047707, 3 | BRF_GRA }, // 4 - Characters - - { "vid_6k.bin", 0x08000, 0xaba6db9e, 4 | BRF_GRA }, // 5 - Sprites - { "vid_6j.bin", 0x08000, 0xae1f2ed6, 4 | BRF_GRA }, // 6 - { "vid_6h.bin", 0x08000, 0x46d9e7df, 4 | BRF_GRA }, // 7 - { "vid_6g.bin", 0x08000, 0x45839c9a, 4 | BRF_GRA }, // 8 - - { "vid_6p.bin", 0x08000, 0x9eae5f8e, 5 | BRF_GRA }, // 9 - Foreground Tiles - { "vid_6o.bin", 0x08000, 0x5a10a396, 5 | BRF_GRA }, // 10 - { "vid_6n.bin", 0x08000, 0x7b12cf3f, 5 | BRF_GRA }, // 11 - { "vid_6l.bin", 0x08000, 0x3cea7eaa, 5 | BRF_GRA }, // 12 - - { "vid_6f.bin", 0x08000, 0x9840edd8, 6 | BRF_GRA }, // 13 - Background Tiles - { "vid_6e.bin", 0x08000, 0xff65e074, 6 | BRF_GRA }, // 14 - { "vid_6c.bin", 0x08000, 0x89868c85, 6 | BRF_GRA }, // 15 - { "vid_6b.bin", 0x08000, 0x35389a7b, 6 | BRF_GRA }, // 16 - - { "cpu_1f.bin", 0x04000, 0x3cc98c5a, 7 | BRF_SND }, // 17 - Samples -}; - -STD_ROM_PICK(rygarj) -STD_ROM_FN(rygarj) - -struct BurnDriver BurnDrvRygarj = { - "rygarj", "rygar", NULL, NULL, "1986", - "Argus no Senshi (Japan)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, rygarjRomInfo, rygarjRomName, NULL, NULL, RygarInputInfo, RygarDIPInfo, - RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -static struct BurnRomInfo rygarbRomDesc[] = { - { "5.u64", 0x08000, 0x0e13e0e4, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code - { "4.u63", 0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, // 1 - { "3.u61", 0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "2.u72", 0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, // 3 - Z80 Code - - { "6.u19", 0x08000, 0x4d482fb6, 3 | BRF_GRA }, // 4 - Characters - - { "11.u82", 0x08000, 0xaba6db9e, 4 | BRF_GRA }, // 5 - Sprites - { "12.u81", 0x08000, 0xae1f2ed6, 4 | BRF_GRA }, // 6 - { "13.u80", 0x08000, 0x46d9e7df, 4 | BRF_GRA }, // 7 - { "14.u79", 0x08000, 0x45839c9a, 4 | BRF_GRA }, // 8 - - { "7.u86", 0x08000, 0x9eae5f8e, 5 | BRF_GRA }, // 9 - Foreground Tiles - { "8.u85", 0x08000, 0x5a10a396, 5 | BRF_GRA }, // 10 - { "9.u84", 0x08000, 0x7b12cf3f, 5 | BRF_GRA }, // 11 - { "10.u83", 0x08000, 0x3cea7eaa, 5 | BRF_GRA }, // 12 - - { "15.u78", 0x08000, 0x9840edd8, 6 | BRF_GRA }, // 13 - Background Tiles - { "16.u77", 0x08000, 0xff65e074, 6 | BRF_GRA }, // 14 - { "17.u76", 0x08000, 0x89868c85, 6 | BRF_GRA }, // 15 - { "18.u75", 0x08000, 0x35389a7b, 6 | BRF_GRA }, // 16 - - { "1.u102", 0x04000, 0x3cc98c5a, 7 | BRF_SND }, // 17 - Samples -}; - -STD_ROM_PICK(rygarb) -STD_ROM_FN(rygarb) - -struct BurnDriver BurnDrvRygarb = { - "rygarb", "rygar", NULL, NULL, "1986", - "Rygar (US, bootleg)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, - NULL, rygarbRomInfo, rygarbRomName, NULL, NULL, RygarInputInfo, RygarDIPInfo, - RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Silk Worm (set 1) - -static struct BurnRomInfo silkwormRomDesc[] = { - { "silkworm.4", 0x10000, 0xa5277cce, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code - { "silkworm.5", 0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "silkworm.3", 0x08000, 0xb589f587, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "silkworm.2", 0x08000, 0xe80a1cd9, 3 | BRF_GRA }, // 3 - Characters - - { "silkworm.6", 0x10000, 0x1138d159, 4 | BRF_GRA }, // 4 - Sprites - { "silkworm.7", 0x10000, 0xd96214f7, 4 | BRF_GRA }, // 5 - { "silkworm.8", 0x10000, 0x0494b38e, 4 | BRF_GRA }, // 6 - { "silkworm.9", 0x10000, 0x8ce3cdf5, 4 | BRF_GRA }, // 7 - - { "silkworm.10", 0x10000, 0x8c7138bb, 5 | BRF_GRA }, // 8 - Foreground Tiles - { "silkworm.11", 0x10000, 0x6c03c476, 5 | BRF_GRA }, // 9 - { "silkworm.12", 0x10000, 0xbb0f568f, 5 | BRF_GRA }, // 10 - { "silkworm.13", 0x10000, 0x773ad0a4, 5 | BRF_GRA }, // 11 - - { "silkworm.14", 0x10000, 0x409df64b, 6 | BRF_GRA }, // 12 - Background Tiles - { "silkworm.15", 0x10000, 0x6e4052c9, 6 | BRF_GRA }, // 13 - { "silkworm.16", 0x10000, 0x9292ed63, 6 | BRF_GRA }, // 14 - { "silkworm.17", 0x10000, 0x3fa4563d, 6 | BRF_GRA }, // 15 - - { "silkworm.1", 0x08000, 0x5b553644, 7 | BRF_SND }, // 16 - Samples -}; - -STD_ROM_PICK(silkworm) -STD_ROM_FN(silkworm) - -struct BurnDriver BurnDrvSilkworm = { - "silkworm", NULL, NULL, NULL, "1988", - "Silk Worm\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, silkwormRomInfo, silkwormRomName, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo, - SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Silk Worm (set 1) - -static struct BurnRomInfo silkwrmjRomDesc[] = { - { "silkwormj.4", 0x10000, 0x6df3df22, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code - { "silkworm.5", 0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "silkwormj.3", 0x08000, 0xb79848d0, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "silkworm.2", 0x08000, 0xe80a1cd9, 3 | BRF_GRA }, // 3 - Characters - - { "silkworm.6", 0x10000, 0x1138d159, 4 | BRF_GRA }, // 4 - Sprites - { "silkworm.7", 0x10000, 0xd96214f7, 4 | BRF_GRA }, // 5 - { "silkworm.8", 0x10000, 0x0494b38e, 4 | BRF_GRA }, // 6 - { "silkworm.9", 0x10000, 0x8ce3cdf5, 4 | BRF_GRA }, // 7 - - { "silkworm.10", 0x10000, 0x8c7138bb, 5 | BRF_GRA }, // 8 - Foreground Tiles - { "silkworm.11", 0x10000, 0x6c03c476, 5 | BRF_GRA }, // 9 - { "silkworm.12", 0x10000, 0xbb0f568f, 5 | BRF_GRA }, // 10 - { "silkworm.13", 0x10000, 0x773ad0a4, 5 | BRF_GRA }, // 11 - - { "silkworm.14", 0x10000, 0x409df64b, 6 | BRF_GRA }, // 12 - Background Tiles - { "silkworm.15", 0x10000, 0x6e4052c9, 6 | BRF_GRA }, // 13 - { "silkworm.16", 0x10000, 0x9292ed63, 6 | BRF_GRA }, // 14 - { "silkworm.17", 0x10000, 0x3fa4563d, 6 | BRF_GRA }, // 15 - - { "silkworm.1", 0x08000, 0x5b553644, 7 | BRF_SND }, // 16 - Samples -}; - -STD_ROM_PICK(silkwrmj) -STD_ROM_FN(silkwrmj) - -struct BurnDriver BurnDrvSilkwrmj = { - "silkwormj", "silkworm", NULL, NULL, "1988", - "Silk Worm (Japan)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, silkwrmjRomInfo, silkwrmjRomName, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo, - SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - -// Silk Worm (bootleg) - -static struct BurnRomInfo silkwormbRomDesc[] = { - { "e3.4", 0x10000, 0x3d86fd58, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code - { "e4.5", 0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "e2.3", 0x08000, 0xb7a3fb80, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "e1.2", 0x08000, 0xe80a1cd9, 3 | BRF_GRA }, // 3 - Characters - - { "e5.6", 0x10000, 0x1138d159, 4 | BRF_GRA }, // 4 - Sprites - { "e6.7", 0x10000, 0xd96214f7, 4 | BRF_GRA }, // 5 - { "e7.8", 0x10000, 0x0494b38e, 4 | BRF_GRA }, // 6 - { "e8.9", 0x10000, 0x8ce3cdf5, 4 | BRF_GRA }, // 7 - - { "e9.10", 0x10000, 0x8c7138bb, 5 | BRF_GRA }, // 8 - Foreground Tiles - { "e10.11", 0x08000, 0xc0c4687d, 5 | BRF_GRA }, // 9 - { "e11.12", 0x10000, 0xbb0f568f, 5 | BRF_GRA }, // 10 - { "e12.13", 0x08000, 0xfc472811, 5 | BRF_GRA }, // 11 - - { "e13.14", 0x10000, 0x409df64b, 6 | BRF_GRA }, // 12 - Background Tiles - { "e14.15", 0x08000, 0xb02acdb6, 6 | BRF_GRA }, // 13 - { "e15.16", 0x08000, 0xcaf7b25e, 6 | BRF_GRA }, // 14 - { "e16.17", 0x08000, 0x7ec93873, 6 | BRF_GRA }, // 15 - -}; - -STD_ROM_PICK(silkwormb) -STD_ROM_FN(silkwormb) - -struct BurnDriver BurnDrvSilkwormb = { - "silkwormb", "silkworm", NULL, NULL, "1988", - "Silk Worm (bootleg)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, silkwormbRomInfo, silkwormbRomName, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo, - SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - -// Back Fire (Tecmo) (Japan, Bootleg, Prototype?) - -static struct BurnRomInfo backfirtRomDesc[] = { - { "b5-e3.bin", 0x10000, 0x0ab3bd4d, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code - { "b4-f3.bin", 0x10000, 0x150B6949, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b2-e10.bin", 0x08000, 0x9b2ac54f, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "b3-c10.bin", 0x08000, 0x08ce729f, 3 | BRF_GRA }, // 3 - Characters - - { "b6-c2.bin", 0x10000, 0xc8c25e45, 4 | BRF_GRA }, // 4 - Sprites - { "b7-d2.bin", 0x10000, 0x25fb6a57, 4 | BRF_GRA }, // 5 - { "b8-e2.bin", 0x10000, 0x6bccac4e, 4 | BRF_GRA }, // 6 - { "b9-h2.bin", 0x10000, 0x566a99b8, 4 | BRF_GRA }, // 7 - - { "b13-p1.bin", 0x10000, 0x8c7138bb, 5 | BRF_GRA }, // 8 - Foreground Tiles - { "b12-p2.bin", 0x10000, 0x6c03c476, 5 | BRF_GRA }, // 9 - { "b11-p2.bin", 0x10000, 0x0bc84b4b, 5 | BRF_GRA }, // 10 - { "b10-p3.bin", 0x10000, 0xec149ec3, 5 | BRF_GRA }, // 11 - - { "b17-s1.bin", 0x10000, 0x409df64b, 6 | BRF_GRA }, // 12 - Background Tiles - { "b16-s2.bin", 0x10000, 0x6e4052c9, 6 | BRF_GRA }, // 13 - { "b15-s2.bin", 0x10000, 0x2b6cc20e, 6 | BRF_GRA }, // 14 - { "b14-s3.bin", 0x08000, 0x4d29637a, 6 | BRF_GRA }, // 15 -}; - -STD_ROM_PICK(backfirt) -STD_ROM_FN(backfirt) - -struct BurnDriver BurnDrvbackfirt = { - "backfirt", NULL, NULL, NULL, "1988", - "Back Fire (Tecmo) (Japan, Bootleg, Prototype?)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, - NULL, backfirtRomInfo, backfirtRomName, NULL, NULL, BackfirtInputInfo, BackfirtDIPInfo, - GeminiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; - - -// Gemini Wing - -static struct BurnRomInfo geminiRomDesc[] = { - { "gw04-5s.rom", 0x10000, 0xff9de855, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code - { "gw05-6s.rom", 0x10000, 0x5a6947a9, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "gw03-5h.rom", 0x08000, 0x9bc79596, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "gw02-3h.rom", 0x08000, 0x7acc8d35, 3 | BRF_GRA }, // 3 - Characters - - { "gw06-1c.rom", 0x10000, 0x4ea51631, 4 | BRF_GRA }, // 4 - Sprites - { "gw07-1d.rom", 0x10000, 0xda42637e, 4 | BRF_GRA }, // 5 - { "gw08-1f.rom", 0x10000, 0x0b4e8d70, 4 | BRF_GRA }, // 6 - { "gw09-1h.rom", 0x10000, 0xb65c5e4c, 4 | BRF_GRA }, // 7 - - { "gw10-1n.rom", 0x10000, 0x5e84cd4f, 5 | BRF_GRA }, // 8 - Foreground Tiles - { "gw11-2na.rom", 0x10000, 0x08b458e1, 5 | BRF_GRA }, // 9 - { "gw12-2nb.rom", 0x10000, 0x229c9714, 5 | BRF_GRA }, // 10 - { "gw13-3n.rom", 0x10000, 0xc5dfaf47, 5 | BRF_GRA }, // 11 - - { "gw14-1r.rom", 0x10000, 0x9c10e5b5, 6 | BRF_GRA }, // 12 - Background Tiles - { "gw15-2ra.rom", 0x10000, 0x4cd18cfa, 6 | BRF_GRA }, // 13 - { "gw16-2rb.rom", 0x10000, 0xf911c7be, 6 | BRF_GRA }, // 14 - { "gw17-3r.rom", 0x10000, 0x79a9ce25, 6 | BRF_GRA }, // 15 - - { "gw01-6a.rom", 0x08000, 0xd78afa05, 7 | BRF_SND }, // 16 - Samples -}; - -STD_ROM_PICK(gemini) -STD_ROM_FN(gemini) - -struct BurnDriver BurnDrvGemini = { - "gemini", NULL, NULL, NULL, "1987", - "Gemini Wing\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, geminiRomInfo, geminiRomName, NULL, NULL, GeminiInputInfo, GeminiDIPInfo, - GeminiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 224, 256, 3, 4 -}; +// FB Alpha Tecmo driver Module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "msm5205.h" + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvJoy6[8]; +static UINT8 DrvJoy11[8]; +static UINT8 DrvReset; +static UINT8 DrvInputs[11]; + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvSndROM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvTextRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvForeRAM; +static UINT8 *DrvBackRAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT16 *DrvBgScroll; +static UINT16 *DrvFgScroll; + +static INT32 tecmo_video_type; + +static UINT32 adpcm_pos; +static UINT32 adpcm_end; +static UINT32 adpcm_size; +static INT32 adpcm_data; +static UINT8 DrvHasADPCM; + +static UINT32 DrvZ80Bank; +static UINT8 soundlatch; +static UINT8 flipscreen; +static UINT8 DrvEnableNmi; + +static struct BurnInputInfo RygarInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy5 + 3, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy5 + 2, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy5 + 1, "p1 start" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, + {"P1 Down", BIT_DIGITAL , DrvJoy1 + 2, "p1 down", }, + {"P1 Up", BIT_DIGITAL , DrvJoy1 + 3, "p1 up", }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 1, "p1 fire 2"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy5 + 0, "p2 start" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down", }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up", }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 2"}, + + {"Service", BIT_DIGITAL , DrvJoy2 + 2, "diag" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvInputs + 6, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvInputs + 7, "dip" }, + {"Dip 3", BIT_DIPSWITCH, DrvInputs + 8, "dip" }, + {"Dip 4", BIT_DIPSWITCH, DrvInputs + 9, "dip" }, +}; + +STDINPUTINFO(Rygar) + +static struct BurnInputInfo BackfirtInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy6 + 2, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy6 + 3, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy6 + 1, "p1 start" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, + {"P1 Down", BIT_DIGITAL , DrvJoy1 + 2, "p1 down", }, + {"P1 Up", BIT_DIGITAL , DrvJoy1 + 3, "p1 up", }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 1, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy2 + 2, "p1 fire 3"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy6 + 0, "p2 start" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down", }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up", }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy4 + 2, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvInputs + 6, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvInputs + 7, "dip" }, + {"Dip 3", BIT_DIPSWITCH, DrvInputs + 8, "dip" }, + {"Dip 4", BIT_DIPSWITCH, DrvInputs + 9, "dip" }, +}; + +STDINPUTINFO(Backfirt) + +static struct BurnInputInfo GeminiInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy6 + 2, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy6 + 3, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy6 + 0, "p1 start" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, + {"P1 Down", BIT_DIGITAL , DrvJoy1 + 2, "p1 down", }, + {"P1 Up", BIT_DIGITAL , DrvJoy1 + 3, "p1 up", }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 1, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 2"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy6 + 1, "p2 start" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down", }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up", }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvInputs + 6, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvInputs + 7, "dip" }, + {"Dip 3", BIT_DIPSWITCH, DrvInputs + 8, "dip" }, + {"Dip 4", BIT_DIPSWITCH, DrvInputs + 9, "dip" }, +}; + +STDINPUTINFO(Gemini) + +static struct BurnInputInfo SilkwormInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy11 + 2, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy11 + 3, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy11 + 0, "p1 start" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, + {"P1 Down", BIT_DIGITAL , DrvJoy1 + 2, "p1 down", }, + {"P1 Up", BIT_DIGITAL , DrvJoy1 + 3, "p1 up", }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 1, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy2 + 2, "p1 fire 3"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy11 + 1, "p2 start" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down", }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up", }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy4 + 1, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy4 + 0, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy4 + 2, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvInputs + 6, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvInputs + 7, "dip" }, + {"Dip 3", BIT_DIPSWITCH, DrvInputs + 8, "dip" }, + {"Dip 4", BIT_DIPSWITCH, DrvInputs + 9, "dip" }, + +}; + +STDINPUTINFO(Silkworm) + +static struct BurnDIPInfo RygarDIPList[]= +{ + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x00, NULL }, + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0x00, NULL }, + + {0x12, 0xfe, 0, 4, "Coin A" }, + {0x12, 0x01, 0x03, 0x01, "2C 1C" }, + {0x12, 0x01, 0x03, 0x00, "1C 1C" }, + {0x12, 0x01, 0x03, 0x02, "1C 2C" }, + {0x12, 0x01, 0x03, 0x03, "1C 3C" }, + + {0x12, 0xfe, 0, 4, "Coin B" }, + {0x12, 0x01, 0x0C, 0x04, "2C 1C" }, + {0x12, 0x01, 0x0C, 0x00, "1C 1C" }, + {0x12, 0x01, 0x0C, 0x08, "1C 2C" }, + {0x12, 0x01, 0x0C, 0x0C, "1C 3C" }, + + {0x13, 0xfe, 0, 4, "Lives" }, + {0x13, 0x01, 0x03, 0x03, "2" }, + {0x13, 0x01, 0x03, 0x00, "3" }, + {0x13, 0x01, 0x03, 0x01, "4" }, + {0x13, 0x01, 0x03, 0x02, "5" }, + + {0x13, 0xfe, 0, 2, "Cabinet" }, + {0x13, 0x01, 0x04, 0x04, "Upright" }, + {0x13, 0x01, 0x04, 0x00, "Cocktail" }, + + {0x14, 0xfe, 0, 4, "Bonus Life" }, + {0x14, 0x01, 0x03, 0x00, "50000 200000 500000" }, + {0x14, 0x01, 0x03, 0x01, "100000 300000 600000" }, + {0x14, 0x01, 0x03, 0x02, "200000 500000" }, + {0x14, 0x01, 0x03, 0x03, "100000" }, + + {0x15, 0xfe, 0, 4, "Difficulty" }, + {0x15, 0x01, 0x03, 0x00, "Easy" }, + {0x15, 0x01, 0x03, 0x01, "Normal" }, + {0x15, 0x01, 0x03, 0x02, "Hard" }, + {0x15, 0x01, 0x03, 0x03, "Hardest" }, + + {0x15, 0xfe, 0, 2, "2P Can Start Anytime" }, + {0x15, 0x01, 0x04, 0x00, "No" }, + {0x15, 0x01, 0x04, 0x04, "Yes" }, + + {0x15, 0xfe, 0, 2, "Allow Continue" }, + {0x15, 0x01, 0x08, 0x00, "No" }, + {0x15, 0x01, 0x08, 0x08, "Yes" }, +}; + +STDDIPINFO(Rygar) + +static struct BurnDIPInfo GeminiDIPList[]= +{ + {0x11, 0xff, 0xff, 0x00, NULL }, + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x00, NULL }, + {0x14, 0xff, 0xff, 0x00, NULL }, + + {0x11, 0xfe, 0, 8, "Coin A" }, + {0x11, 0x01, 0x07, 0x06, "2C 1C" }, + {0x11, 0x01, 0x07, 0x00, "1C 1C" }, + {0x11, 0x01, 0x07, 0x07, "2C 3C" }, + {0x11, 0x01, 0x07, 0x01, "1C 2C" }, + {0x11, 0x01, 0x07, 0x02, "1C 3C" }, + {0x11, 0x01, 0x07, 0x03, "1C 4C" }, + {0x11, 0x01, 0x07, 0x04, "1C 5C" }, + {0x11, 0x01, 0x07, 0x05, "1C 6C" }, + + {0x11, 0xfe, 0, 2, "Final Round Continuation" }, + {0x11, 0x01, 0x08, 0x00, "Round 6" }, + {0x11, 0x01, 0x08, 0x08, "Round 7" }, + + {0x12, 0xfe, 0, 8, "Coin B" }, + {0x12, 0x01, 0x07, 0x06, "2C 1C" }, + {0x12, 0x01, 0x07, 0x00, "1C 1C" }, + {0x12, 0x01, 0x07, 0x07, "2C 3C" }, + {0x12, 0x01, 0x07, 0x01, "1C 2C" }, + {0x12, 0x01, 0x07, 0x02, "1C 3C" }, + {0x12, 0x01, 0x07, 0x03, "1C 4C" }, + {0x12, 0x01, 0x07, 0x04, "1C 5C" }, + {0x12, 0x01, 0x07, 0x05, "1C 6C" }, + + {0x12, 0xfe, 0, 2, "Buy in During Final Round" }, + {0x12, 0x01, 0x08, 0x00, "No" }, + {0x12, 0x01, 0x08, 0x08, "Yes" }, + + {0x13, 0xfe, 0, 4, "Lives" }, + {0x13, 0x01, 0x03, 0x03, "2" }, + {0x13, 0x01, 0x03, 0x00, "3" }, + {0x13, 0x01, 0x03, 0x01, "4" }, + {0x13, 0x01, 0x03, 0x02, "5" }, + + {0x13, 0xfe, 0, 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x00, "Easy" }, + {0x13, 0x01, 0x0c, 0x04, "Normal" }, + {0x13, 0x01, 0x0c, 0x08, "Hard" }, + {0x13, 0x01, 0x0c, 0x0c, "Hardest" }, + + {0x14, 0xfe, 0, 8, "Bonus Life" }, + {0x14, 0x01, 0x07, 0x00, "50000 200000" }, + {0x14, 0x01, 0x07, 0x01, "50000 300000" }, + {0x14, 0x01, 0x07, 0x02, "100000 500000" }, + {0x14, 0x01, 0x07, 0x03, "50000" }, + {0x14, 0x01, 0x07, 0x04, "100000" }, + {0x14, 0x01, 0x07, 0x05, "200000" }, + {0x14, 0x01, 0x07, 0x06, "300000" }, + {0x14, 0x01, 0x07, 0x07, "None" }, + + {0x14, 0xfe, 0, 2, "Demo Sounds" }, + {0x14, 0x01, 0x08, 0x08, "Off" }, + {0x14, 0x01, 0x08, 0x00, "On" }, +}; + +STDDIPINFO(Gemini) + +static struct BurnDIPInfo SilkwormDIPList[]= +{ + {0x13, 0xff, 0xff, 0x00, NULL }, + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0x00, NULL }, + {0x16, 0xff, 0xff, 0x00, NULL }, + + {0x13, 0xfe, 0, 4, "Coin A" }, + {0x13, 0x01, 0x3, 0x01, "2C 1C" }, + {0x13, 0x01, 0x3, 0x00, "1C 1C" }, + {0x13, 0x01, 0x3, 0x02, "1C 2C" }, + {0x13, 0x01, 0x3, 0x03, "1C 3C" }, + + {0x13, 0xfe, 0, 4, "Coin B" }, + {0x13, 0x01, 0xC, 0x04, "2C 1C" }, + {0x13, 0x01, 0xC, 0x00, "1C 1C" }, + {0x13, 0x01, 0xC, 0x08, "1C 2C" }, + {0x13, 0x01, 0xC, 0x0C, "1C 3C" }, + + {0x14, 0xfe, 0, 4 , "Lives" }, + {0x14, 0x01, 0x3, 0x03, "2" }, + {0x14, 0x01, 0x3, 0x00, "3" }, + {0x14, 0x01, 0x3, 0x01, "4" }, + {0x14, 0x01, 0x3, 0x02, "5" }, + + {0x14, 0xfe, 0, 2 , "Demo Sounds" }, + {0x14, 0x01, 0x8, 0x00, "Off" }, + {0x14, 0x01, 0x8, 0x08, "On" }, + + {0x15, 0xfe, 0, 8, "Bonus Life" }, + {0x15, 0x01, 0x7, 0x00, "50000 200000 500000" }, + {0x15, 0x01, 0x7, 0x01, "100000 300000 800000" }, + {0x15, 0x01, 0x7, 0x02, "50000 200000" }, + {0x15, 0x01, 0x7, 0x03, "100000 300000" }, + {0x15, 0x01, 0x7, 0x04, "50000" }, + {0x15, 0x01, 0x7, 0x05, "100000" }, + {0x15, 0x01, 0x7, 0x06, "200000" }, + {0x15, 0x01, 0x7, 0x07, "None" }, + + {0x16, 0xfe, 0, 6, "Difficulty" }, + {0x16, 0x01, 0x7, 0x00, "0" }, + {0x16, 0x01, 0x7, 0x01, "1" }, + {0x16, 0x01, 0x7, 0x02, "2" }, + {0x16, 0x01, 0x7, 0x03, "3" }, + {0x16, 0x01, 0x7, 0x04, "4" }, + {0x16, 0x01, 0x7, 0x05, "5" }, + + {0x16, 0xfe, 0, 2, "Allow Continue" }, + {0x16, 0x01, 0x8, 0x08, "No" }, + {0x16, 0x01, 0x8, 0x00, "Yes" }, +}; + +STDDIPINFO(Silkworm) + +static struct BurnDIPInfo BackfirtDIPList[]= +{ + {0x13, 0xff, 0xff, 0x00, NULL }, + {0x14, 0xff, 0xff, 0x10, NULL }, + {0x15, 0xff, 0xff, 0x00, NULL }, + {0x16, 0xff, 0xff, 0x00, NULL }, + + {0x13, 0xfe, 0, 4, "Coin A" }, + {0x13, 0x01, 0x3, 0x00, "1C 1C" }, + {0x13, 0x01, 0x3, 0x01, "1C 2C" }, + {0x13, 0x01, 0x3, 0x02, "1C 3C" }, + {0x13, 0x01, 0x3, 0x03, "1C 6C" }, + + {0x13, 0xfe, 0, 4, "Coin B" }, + {0x13, 0x01, 0xC, 0x04, "2C 1C" }, + {0x13, 0x01, 0xC, 0x00, "1C 1C" }, + {0x13, 0x01, 0xC, 0x08, "1C 2C" }, + {0x13, 0x01, 0xC, 0x0C, "1C 3C" }, + + {0x14, 0xfe, 0, 2, "Cabinet" }, + {0x14, 0x01, 0x10, 0x10, "Upright" }, + {0x14, 0x01, 0x10, 0x00, "Cocktail" }, + + {0x15, 0xfe, 0, 8, "Bonus Life" }, + {0x15, 0x01, 0x07, 0x00, "50000 200000 500000" }, + {0x15, 0x01, 0x07, 0x01, "100000 300000 800000" }, + {0x15, 0x01, 0x07, 0x02, "50000 200000" }, + {0x15, 0x01, 0x07, 0x03, "100000 300000" }, + {0x15, 0x01, 0x07, 0x04, "50000" }, + {0x15, 0x01, 0x07, 0x05, "100000" }, + {0x15, 0x01, 0x07, 0x06, "200000" }, + {0x15, 0x01, 0x07, 0x07, "None" }, + + // not verified + {0x15, 0xfe, 0, 6, "Difficulty" }, + {0x15, 0x01, 0x38, 0x00, "0" }, + {0x15, 0x01, 0x38, 0x08, "1" }, + {0x15, 0x01, 0x38, 0x10, "2" }, + {0x15, 0x01, 0x38, 0x18, "3" }, + {0x15, 0x01, 0x38, 0x20, "4" }, + {0x15, 0x01, 0x38, 0x28, "5" }, + + {0x16, 0xfe, 0, 2, "Allow Continue" }, + {0x16, 0x01, 0x04, 0x04, "No" }, + {0x16, 0x01, 0x04, 0x00, "Yes" }, + + {0x16, 0xfe, 0, 2, "Invincibility (Cheat)" }, + {0x16, 0x01, 0x08, 0x08, "No" }, + {0x16, 0x01, 0x08, 0x00, "Yes" }, +}; + +STDDIPINFO(Backfirt) + +UINT8 __fastcall rygar_main_read(UINT16 address) +{ + switch (address) + { + case 0xf800: + case 0xf801: + case 0xf802: + case 0xf803: + case 0xf804: + case 0xf805: + case 0xf806: + case 0xf807: + case 0xf808: + case 0xf809: + return DrvInputs[address & 0x0f]; + + case 0xf80f: + return DrvInputs[10]; + } + + return 0; +} + +static void bankswitch_w(INT32 data) +{ + DrvZ80Bank = 0x10000 + ((data & 0xf8) << 8); + + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80ROM0 + DrvZ80Bank); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80ROM0 + DrvZ80Bank); +} + +static inline void palette_write(INT32 offset) +{ + UINT16 data; + UINT8 r,g,b; + + data = *((UINT16*)(DrvPalRAM + (offset & ~1))); + + #ifdef LSB_FIRST + data = (data << 8) | (data >> 8); +#endif + + r = (data >> 4) & 0x0f; + g = (data >> 0) & 0x0f; + b = (data >> 8) & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + DrvPalette[offset >> 1] = BurnHighCol(r, g, b, 0); +} + +void __fastcall rygar_main_write(UINT16 address, UINT8 data) +{ + if ((address & 0xf000) == 0xe000) { + DrvPalRAM[address & 0x7ff] = data; + palette_write(address & 0x7ff); + return; + } + + switch (address) + { + case 0xf800: + DrvFgScroll[0] = (DrvFgScroll[0] & 0xff00) | data; + return; + + case 0xf801: + DrvFgScroll[0] = (DrvFgScroll[0] & 0x00ff) | (data << 8); + return; + + case 0xf802: + DrvFgScroll[1] = data; + return; + + case 0xf803: + DrvBgScroll[0] = (DrvBgScroll[0] & 0xff00) | data; + return; + + case 0xf804: + DrvBgScroll[0] = (DrvBgScroll[0] & 0x00ff) | (data << 8); + return; + + case 0xf805: + DrvBgScroll[1] = data; + return; + + case 0xf806: + soundlatch = data; + DrvEnableNmi = 1; + return; + + case 0xf807: + flipscreen = data & 1; + return; + + case 0xf808: + bankswitch_w(data); + return; + + case 0xf80b: + // watchdog reset + return; + } + + return; +} + +UINT8 __fastcall rygar_sound_read(UINT16 address) +{ + switch (address) + { + case 0xc000: + return soundlatch; + } + + return 0; +} + +void __fastcall rygar_sound_write(UINT16 address, UINT8 data) +{ + if ((address & 0xff80) == 0x2000) { + DrvZ80ROM1[address] = data; + return; + } + + switch (address) + { + case 0x8000: + case 0xa000: + BurnYM3812Write(0, data); + return; + + case 0x8001: + case 0xa001: + BurnYM3812Write(1, data); + return; + + case 0xc000: + if (DrvHasADPCM) { + adpcm_pos = data << 8; + MSM5205ResetWrite(0, 0); + } + return; + + case 0xc400: + case 0xd000: + adpcm_end = (data + 1) << 8; + return; + + case 0xc800: + case 0xe000: + if (DrvHasADPCM) { + MSM5205SetRoute(0, (data & 0x0f) / 15, BURN_SND_ROUTE_BOTH); + } + return; + + case 0xf000: + return; + } + + return; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x20000; + DrvZ80ROM1 = Next; Next += 0x08000; + + DrvSndROM = Next; Next += adpcm_size; + + DrvGfxROM0 = Next; Next += 0x10000; + DrvGfxROM1 = Next; Next += 0x80000; + DrvGfxROM2 = Next; Next += 0x80000; + DrvGfxROM3 = Next; Next += 0x80000; + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x01000; + DrvZ80RAM1 = Next; Next += 0x00800; + + DrvPalRAM = Next; Next += 0x00800; + DrvTextRAM = Next; Next += 0x00800; + DrvBackRAM = Next; Next += 0x00400; + DrvForeRAM = Next; Next += 0x00400; + DrvSprRAM = Next; Next += 0x00800; + + DrvBgScroll = (UINT16*)Next; Next += 0x00002 * sizeof(UINT16); + DrvFgScroll = (UINT16*)Next; Next += 0x00002 * sizeof(UINT16); + + DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); + if (tmp == NULL) { + return 1; + } + + static INT32 Planes[4] = { + 0x000, 0x001, 0x002, 0x003 + }; + + static INT32 XOffs[16] = { + 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, + 0x100, 0x104, 0x108, 0x10c, 0x110, 0x114, 0x118, 0x11c + }; + + static INT32 YOffs[16] = { + 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 + }; + + memcpy (tmp, DrvGfxROM0, 0x08000); + + GfxDecode(0x0400, 4, 8, 8, Planes, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x40000); + + GfxDecode(0x2000, 4, 8, 8, Planes, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x40000); + + GfxDecode(0x0800, 4, 16, 16, Planes, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); + + memcpy (tmp, DrvGfxROM3, 0x40000); + + GfxDecode(0x0800, 4, 16, 16, Planes, XOffs, YOffs, 0x400, tmp, DrvGfxROM3); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + bankswitch_w(0); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + if (DrvHasADPCM) MSM5205Reset(); + BurnYM3812Reset(); + + if (tecmo_video_type) { + memset (DrvZ80ROM1 + 0x2000, 0, 0x80); + } + + soundlatch = 0; + flipscreen = 0; + + adpcm_pos = 0; + adpcm_end = 0; + adpcm_data = -1; + + return 0; +} + +static void TecmoFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 TecmoSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(double)ZetTotalCycles() * nSoundRate / 4000000; +} + +static void TecmoMSM5205Vck() +{ + if (adpcm_pos >= adpcm_end || adpcm_pos >= adpcm_size) { + MSM5205ResetWrite(0, 1); + } else { + if (adpcm_data != -1) { + MSM5205DataWrite(0, adpcm_data & 0x0f); + adpcm_data = -1; + } else { + adpcm_data = DrvSndROM[adpcm_pos++ & (adpcm_size - 1)]; + MSM5205DataWrite(0, adpcm_data >> 4); + } + } +} + +static INT32 RygarInit() +{ + tecmo_video_type = 0; + DrvHasADPCM = 1; + adpcm_size = 0x4000; + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); + ZetMapArea(0xc000, 0xcfff, 0, DrvZ80RAM0); + ZetMapArea(0xc000, 0xcfff, 1, DrvZ80RAM0); + ZetMapArea(0xc000, 0xcfff, 2, DrvZ80RAM0); + ZetMapArea(0xd000, 0xd7ff, 0, DrvTextRAM); + ZetMapArea(0xd000, 0xd7ff, 1, DrvTextRAM); + ZetMapArea(0xd800, 0xdbff, 0, DrvForeRAM); + ZetMapArea(0xd800, 0xdbff, 1, DrvForeRAM); + ZetMapArea(0xdc00, 0xdfff, 0, DrvBackRAM); + ZetMapArea(0xdc00, 0xdfff, 1, DrvBackRAM); + ZetMapArea(0xe000, 0xe7ff, 0, DrvSprRAM); + ZetMapArea(0xe000, 0xe7ff, 1, DrvSprRAM); + ZetMapArea(0xe800, 0xefff, 0, DrvPalRAM); + ZetSetWriteHandler(rygar_main_write); + ZetSetReadHandler(rygar_main_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM1); + ZetMapArea(0x4000, 0x47ff, 0, DrvZ80RAM1); + ZetMapArea(0x4000, 0x47ff, 1, DrvZ80RAM1); + ZetMapArea(0x4000, 0x47ff, 2, DrvZ80RAM1); + ZetSetWriteHandler(rygar_sound_write); + ZetSetReadHandler(rygar_sound_read); + ZetClose(); + + { + for (INT32 i = 0; i < 3; i++) { + if (BurnLoadRom(DrvZ80ROM0 + i * 0x8000, i + 0, 1)) return 1; + } + + if (BurnLoadRom(DrvZ80ROM1, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 4, 1)) return 1; + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x8000, i + 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + i * 0x8000, i + 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + i * 0x8000, i + 13, 1)) return 1; + } + + if (BurnLoadRom(DrvSndROM, 17, 1)) return 1; + + DrvGfxDecode(); + } + + BurnYM3812Init(4000000, &TecmoFMIRQHandler, &TecmoSynchroniseStream, 0); + BurnTimerAttachZetYM3812(4000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + MSM5205Init(0, TecmoSynchroniseStream, 400000, TecmoMSM5205Vck, MSM5205_S48_4B, 1); + MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + + +static INT32 SilkwormInit() +{ + tecmo_video_type = 1; + DrvHasADPCM = 1; + adpcm_size = 0x8000; + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); + ZetMapArea(0xc000, 0xc3ff, 0, DrvBackRAM); + ZetMapArea(0xc000, 0xc3ff, 1, DrvBackRAM); + ZetMapArea(0xc400, 0xc7ff, 0, DrvForeRAM); + ZetMapArea(0xc400, 0xc7ff, 1, DrvForeRAM); + ZetMapArea(0xc800, 0xcfff, 0, DrvTextRAM); + ZetMapArea(0xc800, 0xcfff, 1, DrvTextRAM); + ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM0); + ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM0); + ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe7ff, 0, DrvSprRAM); + ZetMapArea(0xe000, 0xe7ff, 1, DrvSprRAM); + ZetMapArea(0xe800, 0xefff, 0, DrvPalRAM); + ZetSetWriteHandler(rygar_main_write); + ZetSetReadHandler(rygar_main_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); + ZetSetWriteHandler(rygar_sound_write); + ZetSetReadHandler(rygar_sound_read); + ZetClose(); + + { + for (INT32 i = 0; i < 2; i++) { + if (BurnLoadRom(DrvZ80ROM0 + i * 0x10000, i + 0, 1)) return 1; + } + + if (BurnLoadRom(DrvZ80ROM1, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 3, 1)) return 1; + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x10000, i + 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + i * 0x10000, i + 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + i * 0x10000, i + 12, 1)) return 1; + } + + if (BurnLoadRom(DrvSndROM, 16, 1)) return 1; + + DrvGfxDecode(); + } + + BurnYM3812Init(4000000, &TecmoFMIRQHandler, &TecmoSynchroniseStream, 0); + BurnTimerAttachZetYM3812(4000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + MSM5205Init(0, TecmoSynchroniseStream, 400000, TecmoMSM5205Vck, MSM5205_S48_4B, 1); + MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 GeminiInit() +{ + tecmo_video_type = 2; + DrvHasADPCM = 1; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "backfirt")) DrvHasADPCM = 0; + if (DrvHasADPCM) adpcm_size = 0x8000; + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); + ZetMapArea(0xc000, 0xcfff, 0, DrvZ80RAM0); + ZetMapArea(0xc000, 0xcfff, 1, DrvZ80RAM0); + ZetMapArea(0xc000, 0xcfff, 2, DrvZ80RAM0); + ZetMapArea(0xd000, 0xd7ff, 0, DrvTextRAM); + ZetMapArea(0xd000, 0xd7ff, 1, DrvTextRAM); + ZetMapArea(0xd800, 0xdbff, 0, DrvForeRAM); + ZetMapArea(0xd800, 0xdbff, 1, DrvForeRAM); + ZetMapArea(0xdc00, 0xdfff, 0, DrvBackRAM); + ZetMapArea(0xdc00, 0xdfff, 1, DrvBackRAM); + ZetMapArea(0xe000, 0xe7ff, 0, DrvPalRAM); + ZetMapArea(0xe800, 0xefff, 0, DrvSprRAM); + ZetMapArea(0xe800, 0xefff, 1, DrvSprRAM); + ZetSetWriteHandler(rygar_main_write); + ZetSetReadHandler(rygar_main_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); + ZetSetWriteHandler(rygar_sound_write); + ZetSetReadHandler(rygar_sound_read); + ZetClose(); + + { + for (INT32 i = 0; i < 2; i++) { + if (BurnLoadRom(DrvZ80ROM0 + i * 0x10000, i + 0, 1)) return 1; + } + + if (BurnLoadRom(DrvZ80ROM1, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 3, 1)) return 1; + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x10000, i + 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + i * 0x10000, i + 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + i * 0x10000, i + 12, 1)) return 1; + } + + BurnLoadRom(DrvSndROM, 16, 1); + + DrvGfxDecode(); + } + + BurnYM3812Init(4000000, &TecmoFMIRQHandler, &TecmoSynchroniseStream, 0); + BurnTimerAttachZetYM3812(4000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + if (DrvHasADPCM) { + MSM5205Init(0, TecmoSynchroniseStream, 400000, TecmoMSM5205Vck, MSM5205_S48_4B, 1); + MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + } + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + if (DrvHasADPCM) MSM5205Exit(); + BurnYM3812Exit(); + + GenericTilesExit(); + + ZetExit(); + + BurnFree (AllMem); + + DrvHasADPCM = 0; + + return 0; +} + +static inline INT32 calc_sprite_offset(INT32 code, INT32 x, INT32 y) +{ + INT32 ofst = 0; + if (x & 0x001) ofst |= 0x01; + if (y & 0x001) ofst |= 0x02; + if (x & 0x002) ofst |= 0x04; + if (y & 0x002) ofst |= 0x08; + if (x & 0x004) ofst |= 0x10; + if (y & 0x004) ofst |= 0x20; + + return (ofst + code) & 0x1fff; +} + +static void draw_sprites(INT32 priority) +{ + for (INT32 offs = 0; offs < 0x800; offs += 8) + { + INT32 flags = DrvSprRAM[offs+3]; + if (priority != (flags >> 6)) continue; + + INT32 bank = DrvSprRAM[offs+0]; + + if (bank & 4) + { + INT32 which = DrvSprRAM[offs+1]; + INT32 code, xpos, ypos, flipx, flipy, x, y; + INT32 size = DrvSprRAM[offs + 2] & 3; + + if (tecmo_video_type) + code = which + ((bank & 0xf8) << 5); + else + code = which + ((bank & 0xf0) << 4); + + code &= ~((1 << (size << 1)) - 1); + size = 1 << size; + + xpos = DrvSprRAM[offs + 5] - ((flags & 0x10) << 4); + ypos = DrvSprRAM[offs + 4] - ((flags & 0x20) << 3); + flipx = bank & 1; + flipy = bank & 2; + + for (y = 0; y < size; y++) + { + for (x = 0; x < size; x++) + { + INT32 sx = xpos + ((flipx ? (size - 1 - x) : x) << 3); + INT32 sy = ypos + ((flipy ? (size - 1 - y) : y) << 3); + sy -= 16; + + if (sy < -7 || sx < -7 || sx > 255 || sy > 223) continue; + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1); + } + } + } + } + } + } +} + +static INT32 draw_layer(UINT8 *vidram, UINT8 *gfx_base, INT32 paloffs, UINT16 *scroll) +{ + for (INT32 offs = 0; offs < 32 * 16; offs++) + { + INT32 sx = (offs & 0x1f) << 4; + INT32 sy = (offs >> 5) << 4; + + sx -= scroll[0] & 0x1ff; + + if (flipscreen) { + sx += 48 + 256; + } else { + sx -= 48; + } + + if (sx < -15) sx += 0x200; + if (sx > 511) sx -= 0x200; + sy -= scroll[1] + 16; + if (sy < -15) sy += 0x100; + + if (sx > nScreenWidth || sy > nScreenHeight) continue; + + UINT8 color = vidram[0x200 | offs]; + INT32 code = vidram[offs]; + + if (tecmo_video_type == 2) { + color = (color << 4) | (color >> 4); + } + + code |= ((color & 7) << 8); + color >>= 4; + + if (sx < 0 || sy < 0 || sx > nScreenWidth - 16 || sy > nScreenHeight - 16) { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, paloffs, gfx_base); + } else { + Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, paloffs, gfx_base); + } + } + + return 0; +} + +static void draw_text_layer() +{ + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + INT32 color = DrvTextRAM[offs | 0x400]; + + INT32 code = DrvTextRAM[offs] | ((color & 3) << 8); + + color >>= 4; + + if (sy < 16 || sy > 239) continue; + + Render8x8Tile_Mask(pTransDraw, code, sx, sy-16, color, 4, 0, 0x100, DrvGfxROM0); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x800; i+=2) { + palette_write(i); + } + DrvRecalc = 0; + } + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x100; + } + + draw_sprites(3); + + draw_layer(DrvBackRAM, DrvGfxROM3, 0x300, DrvBgScroll); + + draw_sprites(2); + + draw_layer(DrvForeRAM, DrvGfxROM2, 0x200, DrvFgScroll); + + draw_sprites(1); + draw_sprites(0); + + draw_text_layer(); + + if (flipscreen) { + INT32 nSize = (nScreenWidth * nScreenHeight) - 1; + for (INT32 i = 0; i < nSize >> 1; i++) { + INT32 n = pTransDraw[i]; + pTransDraw[i] = pTransDraw[nSize - i]; + pTransDraw[nSize - i] = n; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0, 6); + DrvInputs[10] = 0; + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[ 0] ^= DrvJoy1[i] << i; + DrvInputs[ 1] ^= DrvJoy2[i] << i; + DrvInputs[ 2] ^= DrvJoy3[i] << i; + DrvInputs[ 3] ^= DrvJoy4[i] << i; + DrvInputs[ 4] ^= DrvJoy5[i] << i; + DrvInputs[ 5] ^= DrvJoy6[i] << i; + DrvInputs[10] ^= DrvJoy11[i] << i; + } + } + + ZetNewFrame(); + + INT32 nSegment; + INT32 nInterleave = 10; + if (DrvHasADPCM) nInterleave = MSM5205CalcInterleave(0, 4000000); + INT32 nTotalCycles[2] = { 6000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); + + ZetOpen(0); + nCyclesDone[0] += ZetRun(nSegment); + if (i == (nInterleave-1)) ZetRaiseIrq(0); + ZetClose(); + + ZetOpen(1); + if (DrvEnableNmi) { + ZetNmi(); + DrvEnableNmi = 0; + } + BurnTimerUpdateYM3812(i * (nTotalCycles[1] / nInterleave)); + if (DrvHasADPCM) MSM5205Update(); + ZetClose(); + } + + ZetOpen(1); + if (pBurnSoundOut) { + BurnTimerEndFrameYM3812(nTotalCycles[1]); + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + if (DrvHasADPCM) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029622; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ba.Data = DrvZ80ROM1 + 0x2000; + ba.nLen = 0x80; + ba.szName = "Sound Z80 RAM"; + BurnAcb(&ba); + + ZetScan(nAction); + BurnYM3812Scan(nAction, pnMin); + if (DrvHasADPCM) MSM5205Scan(nAction, pnMin); + + SCAN_VAR(flipscreen); + SCAN_VAR(soundlatch); + SCAN_VAR(DrvZ80Bank); + + SCAN_VAR(adpcm_pos); + SCAN_VAR(adpcm_end); + } + + ZetOpen(0); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80ROM0 + DrvZ80Bank); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80ROM0 + DrvZ80Bank); + ZetClose(); + + return 0; +} + + +// Rygar (US set 1) + +static struct BurnRomInfo rygarRomDesc[] = { + { "5.5p", 0x08000, 0x062cd55d, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code + { "cpu_5m.bin", 0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "cpu_5j.bin", 0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "cpu_4h.bin", 0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, // 3 - Z80 Code + + { "cpu_8k.bin", 0x08000, 0x4d482fb6, 3 | BRF_GRA }, // 4 - Characters + + { "vid_6k.bin", 0x08000, 0xaba6db9e, 4 | BRF_GRA }, // 5 - Sprites + { "vid_6j.bin", 0x08000, 0xae1f2ed6, 4 | BRF_GRA }, // 6 + { "vid_6h.bin", 0x08000, 0x46d9e7df, 4 | BRF_GRA }, // 7 + { "vid_6g.bin", 0x08000, 0x45839c9a, 4 | BRF_GRA }, // 8 + + { "vid_6p.bin", 0x08000, 0x9eae5f8e, 5 | BRF_GRA }, // 9 - Foreground Tiles + { "vid_6o.bin", 0x08000, 0x5a10a396, 5 | BRF_GRA }, // 10 + { "vid_6n.bin", 0x08000, 0x7b12cf3f, 5 | BRF_GRA }, // 11 + { "vid_6l.bin", 0x08000, 0x3cea7eaa, 5 | BRF_GRA }, // 12 + + { "vid_6f.bin", 0x08000, 0x9840edd8, 6 | BRF_GRA }, // 13 - Background Tiles + { "vid_6e.bin", 0x08000, 0xff65e074, 6 | BRF_GRA }, // 14 + { "vid_6c.bin", 0x08000, 0x89868c85, 6 | BRF_GRA }, // 15 + { "vid_6b.bin", 0x08000, 0x35389a7b, 6 | BRF_GRA }, // 16 + + { "cpu_1f.bin", 0x04000, 0x3cc98c5a, 7 | BRF_SND }, // 17 - Samples +}; + +STD_ROM_PICK(rygar) +STD_ROM_FN(rygar) + +struct BurnDriver BurnDrvRygar = { + "rygar", NULL, NULL, NULL, "1986", + "Rygar (US set 1)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, rygarRomInfo, rygarRomName, NULL, NULL, RygarInputInfo, RygarDIPInfo, + RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Rygar (US set 2) + +static struct BurnRomInfo rygar2RomDesc[] = { + { "5p.bin", 0x08000, 0x151ffc0b, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code + { "cpu_5m.bin", 0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "cpu_5j.bin", 0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "cpu_4h.bin", 0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, // 3 - Z80 Code + + { "cpu_8k.bin", 0x08000, 0x4d482fb6, 3 | BRF_GRA }, // 4 - Characters + + { "vid_6k.bin", 0x08000, 0xaba6db9e, 4 | BRF_GRA }, // 5 - Sprites + { "vid_6j.bin", 0x08000, 0xae1f2ed6, 4 | BRF_GRA }, // 6 + { "vid_6h.bin", 0x08000, 0x46d9e7df, 4 | BRF_GRA }, // 7 + { "vid_6g.bin", 0x08000, 0x45839c9a, 4 | BRF_GRA }, // 8 + + { "vid_6p.bin", 0x08000, 0x9eae5f8e, 5 | BRF_GRA }, // 9 - Foreground Tiles + { "vid_6o.bin", 0x08000, 0x5a10a396, 5 | BRF_GRA }, // 10 + { "vid_6n.bin", 0x08000, 0x7b12cf3f, 5 | BRF_GRA }, // 11 + { "vid_6l.bin", 0x08000, 0x3cea7eaa, 5 | BRF_GRA }, // 12 + + { "vid_6f.bin", 0x08000, 0x9840edd8, 6 | BRF_GRA }, // 13 - Background Tiles + { "vid_6e.bin", 0x08000, 0xff65e074, 6 | BRF_GRA }, // 14 + { "vid_6c.bin", 0x08000, 0x89868c85, 6 | BRF_GRA }, // 15 + { "vid_6b.bin", 0x08000, 0x35389a7b, 6 | BRF_GRA }, // 16 + + { "cpu_1f.bin", 0x04000, 0x3cc98c5a, 7 | BRF_SND }, // 17 - Samples +}; + +STD_ROM_PICK(rygar2) +STD_ROM_FN(rygar2) + +struct BurnDriver BurnDrvRygar2 = { + "rygar2", "rygar", NULL, NULL, "1986", + "Rygar (US set 2)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, rygar2RomInfo, rygar2RomName, NULL, NULL, RygarInputInfo, RygarDIPInfo, + RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Rygar (US set 3, old version) + +static struct BurnRomInfo rygar3RomDesc[] = { + { "cpu_5p.bin", 0x08000, 0xe79c054a, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code + { "cpu_5m.bin", 0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "cpu_5j.bin", 0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "cpu_4h.bin", 0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, // 3 - Z80 Code + + { "cpu_8k.bin", 0x08000, 0x4d482fb6, 3 | BRF_GRA }, // 4 - Characters + + { "vid_6k.bin", 0x08000, 0xaba6db9e, 4 | BRF_GRA }, // 5 - Sprites + { "vid_6j.bin", 0x08000, 0xae1f2ed6, 4 | BRF_GRA }, // 6 + { "vid_6h.bin", 0x08000, 0x46d9e7df, 4 | BRF_GRA }, // 7 + { "vid_6g.bin", 0x08000, 0x45839c9a, 4 | BRF_GRA }, // 8 + + { "vid_6p.bin", 0x08000, 0x9eae5f8e, 5 | BRF_GRA }, // 9 - Foreground Tiles + { "vid_6o.bin", 0x08000, 0x5a10a396, 5 | BRF_GRA }, // 10 + { "vid_6n.bin", 0x08000, 0x7b12cf3f, 5 | BRF_GRA }, // 11 + { "vid_6l.bin", 0x08000, 0x3cea7eaa, 5 | BRF_GRA }, // 12 + + { "vid_6f.bin", 0x08000, 0x9840edd8, 6 | BRF_GRA }, // 13 - Background Tiles + { "vid_6e.bin", 0x08000, 0xff65e074, 6 | BRF_GRA }, // 14 + { "vid_6c.bin", 0x08000, 0x89868c85, 6 | BRF_GRA }, // 15 + { "vid_6b.bin", 0x08000, 0x35389a7b, 6 | BRF_GRA }, // 16 + + { "cpu_1f.bin", 0x04000, 0x3cc98c5a, 7 | BRF_SND }, // 17 - Samples +}; + +STD_ROM_PICK(rygar3) +STD_ROM_FN(rygar3) + +struct BurnDriver BurnDrvRygar3 = { + "rygar3", "rygar", NULL, NULL, "1986", + "Rygar (US set 3, old version)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, rygar3RomInfo, rygar3RomName, NULL, NULL, RygarInputInfo, RygarDIPInfo, + RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Argus no Senshi (Japan) + +static struct BurnRomInfo rygarjRomDesc[] = { + { "cpuj_5p.bin",0x08000, 0xb39698ba, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code + { "cpuj_5m.bin",0x04000, 0x3f180979, 1 | BRF_PRG | BRF_ESS }, // 1 + { "cpuj_5j.bin",0x08000, 0x69e44e8f, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "cpu_4h.bin", 0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, // 3 - Z80 Code + + { "cpuj_8k.bin",0x08000, 0x45047707, 3 | BRF_GRA }, // 4 - Characters + + { "vid_6k.bin", 0x08000, 0xaba6db9e, 4 | BRF_GRA }, // 5 - Sprites + { "vid_6j.bin", 0x08000, 0xae1f2ed6, 4 | BRF_GRA }, // 6 + { "vid_6h.bin", 0x08000, 0x46d9e7df, 4 | BRF_GRA }, // 7 + { "vid_6g.bin", 0x08000, 0x45839c9a, 4 | BRF_GRA }, // 8 + + { "vid_6p.bin", 0x08000, 0x9eae5f8e, 5 | BRF_GRA }, // 9 - Foreground Tiles + { "vid_6o.bin", 0x08000, 0x5a10a396, 5 | BRF_GRA }, // 10 + { "vid_6n.bin", 0x08000, 0x7b12cf3f, 5 | BRF_GRA }, // 11 + { "vid_6l.bin", 0x08000, 0x3cea7eaa, 5 | BRF_GRA }, // 12 + + { "vid_6f.bin", 0x08000, 0x9840edd8, 6 | BRF_GRA }, // 13 - Background Tiles + { "vid_6e.bin", 0x08000, 0xff65e074, 6 | BRF_GRA }, // 14 + { "vid_6c.bin", 0x08000, 0x89868c85, 6 | BRF_GRA }, // 15 + { "vid_6b.bin", 0x08000, 0x35389a7b, 6 | BRF_GRA }, // 16 + + { "cpu_1f.bin", 0x04000, 0x3cc98c5a, 7 | BRF_SND }, // 17 - Samples +}; + +STD_ROM_PICK(rygarj) +STD_ROM_FN(rygarj) + +struct BurnDriver BurnDrvRygarj = { + "rygarj", "rygar", NULL, NULL, "1986", + "Argus no Senshi (Japan)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, rygarjRomInfo, rygarjRomName, NULL, NULL, RygarInputInfo, RygarDIPInfo, + RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +static struct BurnRomInfo rygarbRomDesc[] = { + { "5.u64", 0x08000, 0x0e13e0e4, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code + { "4.u63", 0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, // 1 + { "3.u61", 0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "2.u72", 0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, // 3 - Z80 Code + + { "6.u19", 0x08000, 0x4d482fb6, 3 | BRF_GRA }, // 4 - Characters + + { "11.u82", 0x08000, 0xaba6db9e, 4 | BRF_GRA }, // 5 - Sprites + { "12.u81", 0x08000, 0xae1f2ed6, 4 | BRF_GRA }, // 6 + { "13.u80", 0x08000, 0x46d9e7df, 4 | BRF_GRA }, // 7 + { "14.u79", 0x08000, 0x45839c9a, 4 | BRF_GRA }, // 8 + + { "7.u86", 0x08000, 0x9eae5f8e, 5 | BRF_GRA }, // 9 - Foreground Tiles + { "8.u85", 0x08000, 0x5a10a396, 5 | BRF_GRA }, // 10 + { "9.u84", 0x08000, 0x7b12cf3f, 5 | BRF_GRA }, // 11 + { "10.u83", 0x08000, 0x3cea7eaa, 5 | BRF_GRA }, // 12 + + { "15.u78", 0x08000, 0x9840edd8, 6 | BRF_GRA }, // 13 - Background Tiles + { "16.u77", 0x08000, 0xff65e074, 6 | BRF_GRA }, // 14 + { "17.u76", 0x08000, 0x89868c85, 6 | BRF_GRA }, // 15 + { "18.u75", 0x08000, 0x35389a7b, 6 | BRF_GRA }, // 16 + + { "1.u102", 0x04000, 0x3cc98c5a, 7 | BRF_SND }, // 17 - Samples +}; + +STD_ROM_PICK(rygarb) +STD_ROM_FN(rygarb) + +struct BurnDriver BurnDrvRygarb = { + "rygarb", "rygar", NULL, NULL, "1986", + "Rygar (US, bootleg)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0, + NULL, rygarbRomInfo, rygarbRomName, NULL, NULL, RygarInputInfo, RygarDIPInfo, + RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Silk Worm (set 1) + +static struct BurnRomInfo silkwormRomDesc[] = { + { "silkworm.4", 0x10000, 0xa5277cce, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code + { "silkworm.5", 0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "silkworm.3", 0x08000, 0xb589f587, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "silkworm.2", 0x08000, 0xe80a1cd9, 3 | BRF_GRA }, // 3 - Characters + + { "silkworm.6", 0x10000, 0x1138d159, 4 | BRF_GRA }, // 4 - Sprites + { "silkworm.7", 0x10000, 0xd96214f7, 4 | BRF_GRA }, // 5 + { "silkworm.8", 0x10000, 0x0494b38e, 4 | BRF_GRA }, // 6 + { "silkworm.9", 0x10000, 0x8ce3cdf5, 4 | BRF_GRA }, // 7 + + { "silkworm.10", 0x10000, 0x8c7138bb, 5 | BRF_GRA }, // 8 - Foreground Tiles + { "silkworm.11", 0x10000, 0x6c03c476, 5 | BRF_GRA }, // 9 + { "silkworm.12", 0x10000, 0xbb0f568f, 5 | BRF_GRA }, // 10 + { "silkworm.13", 0x10000, 0x773ad0a4, 5 | BRF_GRA }, // 11 + + { "silkworm.14", 0x10000, 0x409df64b, 6 | BRF_GRA }, // 12 - Background Tiles + { "silkworm.15", 0x10000, 0x6e4052c9, 6 | BRF_GRA }, // 13 + { "silkworm.16", 0x10000, 0x9292ed63, 6 | BRF_GRA }, // 14 + { "silkworm.17", 0x10000, 0x3fa4563d, 6 | BRF_GRA }, // 15 + + { "silkworm.1", 0x08000, 0x5b553644, 7 | BRF_SND }, // 16 - Samples +}; + +STD_ROM_PICK(silkworm) +STD_ROM_FN(silkworm) + +struct BurnDriver BurnDrvSilkworm = { + "silkworm", NULL, NULL, NULL, "1988", + "Silk Worm\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, silkwormRomInfo, silkwormRomName, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo, + SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Silk Worm (set 1) + +static struct BurnRomInfo silkwrmjRomDesc[] = { + { "silkwormj.4", 0x10000, 0x6df3df22, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code + { "silkworm.5", 0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "silkwormj.3", 0x08000, 0xb79848d0, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "silkworm.2", 0x08000, 0xe80a1cd9, 3 | BRF_GRA }, // 3 - Characters + + { "silkworm.6", 0x10000, 0x1138d159, 4 | BRF_GRA }, // 4 - Sprites + { "silkworm.7", 0x10000, 0xd96214f7, 4 | BRF_GRA }, // 5 + { "silkworm.8", 0x10000, 0x0494b38e, 4 | BRF_GRA }, // 6 + { "silkworm.9", 0x10000, 0x8ce3cdf5, 4 | BRF_GRA }, // 7 + + { "silkworm.10", 0x10000, 0x8c7138bb, 5 | BRF_GRA }, // 8 - Foreground Tiles + { "silkworm.11", 0x10000, 0x6c03c476, 5 | BRF_GRA }, // 9 + { "silkworm.12", 0x10000, 0xbb0f568f, 5 | BRF_GRA }, // 10 + { "silkworm.13", 0x10000, 0x773ad0a4, 5 | BRF_GRA }, // 11 + + { "silkworm.14", 0x10000, 0x409df64b, 6 | BRF_GRA }, // 12 - Background Tiles + { "silkworm.15", 0x10000, 0x6e4052c9, 6 | BRF_GRA }, // 13 + { "silkworm.16", 0x10000, 0x9292ed63, 6 | BRF_GRA }, // 14 + { "silkworm.17", 0x10000, 0x3fa4563d, 6 | BRF_GRA }, // 15 + + { "silkworm.1", 0x08000, 0x5b553644, 7 | BRF_SND }, // 16 - Samples +}; + +STD_ROM_PICK(silkwrmj) +STD_ROM_FN(silkwrmj) + +struct BurnDriver BurnDrvSilkwrmj = { + "silkwormj", "silkworm", NULL, NULL, "1988", + "Silk Worm (Japan)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, silkwrmjRomInfo, silkwrmjRomName, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo, + SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + +// Silk Worm (bootleg) + +static struct BurnRomInfo silkwormbRomDesc[] = { + { "e3.4", 0x10000, 0x3d86fd58, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code + { "e4.5", 0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "e2.3", 0x08000, 0xb7a3fb80, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "e1.2", 0x08000, 0xe80a1cd9, 3 | BRF_GRA }, // 3 - Characters + + { "e5.6", 0x10000, 0x1138d159, 4 | BRF_GRA }, // 4 - Sprites + { "e6.7", 0x10000, 0xd96214f7, 4 | BRF_GRA }, // 5 + { "e7.8", 0x10000, 0x0494b38e, 4 | BRF_GRA }, // 6 + { "e8.9", 0x10000, 0x8ce3cdf5, 4 | BRF_GRA }, // 7 + + { "e9.10", 0x10000, 0x8c7138bb, 5 | BRF_GRA }, // 8 - Foreground Tiles + { "e10.11", 0x08000, 0xc0c4687d, 5 | BRF_GRA }, // 9 + { "e11.12", 0x10000, 0xbb0f568f, 5 | BRF_GRA }, // 10 + { "e12.13", 0x08000, 0xfc472811, 5 | BRF_GRA }, // 11 + + { "e13.14", 0x10000, 0x409df64b, 6 | BRF_GRA }, // 12 - Background Tiles + { "e14.15", 0x08000, 0xb02acdb6, 6 | BRF_GRA }, // 13 + { "e15.16", 0x08000, 0xcaf7b25e, 6 | BRF_GRA }, // 14 + { "e16.17", 0x08000, 0x7ec93873, 6 | BRF_GRA }, // 15 + +}; + +STD_ROM_PICK(silkwormb) +STD_ROM_FN(silkwormb) + +struct BurnDriver BurnDrvSilkwormb = { + "silkwormb", "silkworm", NULL, NULL, "1988", + "Silk Worm (bootleg)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, silkwormbRomInfo, silkwormbRomName, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo, + SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + +// Back Fire (Tecmo) (Japan, Bootleg, Prototype?) + +static struct BurnRomInfo backfirtRomDesc[] = { + { "b5-e3.bin", 0x10000, 0x0ab3bd4d, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code + { "b4-f3.bin", 0x10000, 0x150B6949, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b2-e10.bin", 0x08000, 0x9b2ac54f, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "b3-c10.bin", 0x08000, 0x08ce729f, 3 | BRF_GRA }, // 3 - Characters + + { "b6-c2.bin", 0x10000, 0xc8c25e45, 4 | BRF_GRA }, // 4 - Sprites + { "b7-d2.bin", 0x10000, 0x25fb6a57, 4 | BRF_GRA }, // 5 + { "b8-e2.bin", 0x10000, 0x6bccac4e, 4 | BRF_GRA }, // 6 + { "b9-h2.bin", 0x10000, 0x566a99b8, 4 | BRF_GRA }, // 7 + + { "b13-p1.bin", 0x10000, 0x8c7138bb, 5 | BRF_GRA }, // 8 - Foreground Tiles + { "b12-p2.bin", 0x10000, 0x6c03c476, 5 | BRF_GRA }, // 9 + { "b11-p2.bin", 0x10000, 0x0bc84b4b, 5 | BRF_GRA }, // 10 + { "b10-p3.bin", 0x10000, 0xec149ec3, 5 | BRF_GRA }, // 11 + + { "b17-s1.bin", 0x10000, 0x409df64b, 6 | BRF_GRA }, // 12 - Background Tiles + { "b16-s2.bin", 0x10000, 0x6e4052c9, 6 | BRF_GRA }, // 13 + { "b15-s2.bin", 0x10000, 0x2b6cc20e, 6 | BRF_GRA }, // 14 + { "b14-s3.bin", 0x08000, 0x4d29637a, 6 | BRF_GRA }, // 15 +}; + +STD_ROM_PICK(backfirt) +STD_ROM_FN(backfirt) + +struct BurnDriver BurnDrvbackfirt = { + "backfirt", NULL, NULL, NULL, "1988", + "Back Fire (Tecmo) (Japan, Bootleg, Prototype?)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0, + NULL, backfirtRomInfo, backfirtRomName, NULL, NULL, BackfirtInputInfo, BackfirtDIPInfo, + GeminiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; + + +// Gemini Wing + +static struct BurnRomInfo geminiRomDesc[] = { + { "gw04-5s.rom", 0x10000, 0xff9de855, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code + { "gw05-6s.rom", 0x10000, 0x5a6947a9, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "gw03-5h.rom", 0x08000, 0x9bc79596, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "gw02-3h.rom", 0x08000, 0x7acc8d35, 3 | BRF_GRA }, // 3 - Characters + + { "gw06-1c.rom", 0x10000, 0x4ea51631, 4 | BRF_GRA }, // 4 - Sprites + { "gw07-1d.rom", 0x10000, 0xda42637e, 4 | BRF_GRA }, // 5 + { "gw08-1f.rom", 0x10000, 0x0b4e8d70, 4 | BRF_GRA }, // 6 + { "gw09-1h.rom", 0x10000, 0xb65c5e4c, 4 | BRF_GRA }, // 7 + + { "gw10-1n.rom", 0x10000, 0x5e84cd4f, 5 | BRF_GRA }, // 8 - Foreground Tiles + { "gw11-2na.rom", 0x10000, 0x08b458e1, 5 | BRF_GRA }, // 9 + { "gw12-2nb.rom", 0x10000, 0x229c9714, 5 | BRF_GRA }, // 10 + { "gw13-3n.rom", 0x10000, 0xc5dfaf47, 5 | BRF_GRA }, // 11 + + { "gw14-1r.rom", 0x10000, 0x9c10e5b5, 6 | BRF_GRA }, // 12 - Background Tiles + { "gw15-2ra.rom", 0x10000, 0x4cd18cfa, 6 | BRF_GRA }, // 13 + { "gw16-2rb.rom", 0x10000, 0xf911c7be, 6 | BRF_GRA }, // 14 + { "gw17-3r.rom", 0x10000, 0x79a9ce25, 6 | BRF_GRA }, // 15 + + { "gw01-6a.rom", 0x08000, 0xd78afa05, 7 | BRF_SND }, // 16 - Samples +}; + +STD_ROM_PICK(gemini) +STD_ROM_FN(gemini) + +struct BurnDriver BurnDrvGemini = { + "gemini", NULL, NULL, NULL, "1987", + "Gemini Wing\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, geminiRomInfo, geminiRomName, NULL, NULL, GeminiInputInfo, GeminiDIPInfo, + GeminiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 224, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_terracre.cpp b/src/burn/drv/pre90s/d_terracre.cpp index a23b89203..019105ee2 100644 --- a/src/burn/drv/pre90s/d_terracre.cpp +++ b/src/burn/drv/pre90s/d_terracre.cpp @@ -1,1911 +1,1909 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym3526.h" -#include "burn_ym2203.h" -#include "dac.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[3] = {0, 0, 0}; -static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Drv68KRom = NULL; -static UINT8 *DrvZ80Rom = NULL; -static UINT8 *Drv68KRam = NULL; -static UINT8 *DrvZ80Ram = NULL; -static UINT8 *DrvProms = NULL; -static UINT8 *DrvSpritePalBank = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvBgVideoRam = NULL; -static UINT8 *DrvFgVideoRam = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT8 DrvRecalcPal = 0; -static UINT16 DrvScrollX = 0; -static UINT16 DrvScrollY = 0; -static UINT16 DrvDisableBg = 0; -static UINT16 DrvFlipScreen = 0; -static UINT8 DrvSoundLatch = 0; - -static UINT8 AmazonProtCmd; -static UINT8 AmazonProtReg[6]; - -static UINT8 DrvUseYM2203 = 0; -static UINT8 DrvIsHorekid = 0; -static UINT16 *AmazonProtDataPtr = NULL; - -typedef INT32 (*TerracreLoadRomsType)(); -static TerracreLoadRomsType LoadRomsFunction; - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort2 + 4, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo AmazonInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 1, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort2 + 4, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Amazon) - -static struct BurnInputInfo HorekidInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort2 + 4, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, -}; - -STDINPUTINFO(Horekid) - -static inline void DrvMakeInputs() -{ - DrvInput[0] = DrvInput[1] = 0xff; - DrvInput[2] = 0xdf; - - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] -= (DrvInputPort0[i] & 1) << i; - DrvInput[1] -= (DrvInputPort1[i] & 1) << i; - DrvInput[2] -= (DrvInputPort2[i] & 1) << i; - } -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0x20, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x0c, 0x0c, "20k then every 60k" }, - {0x13, 0x01, 0x0c, 0x08, "30k then every 70k" }, - {0x13, 0x01, 0x0c, 0x04, "40k then every 80k" }, - {0x13, 0x01, 0x0c, 0x00, "50k then every 90k" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x10, 0x00, "Off" }, - {0x13, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x20, 0x00, "Upright" }, - {0x13, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x14, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x14, 0x01, 0x0c, 0x00, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x0c, 0x04, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x0c, 0x0c, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0c, 0x08, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x10, 0x10, "Easy" }, - {0x14, 0x01, 0x10, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Complete Invulnerability"}, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Base Ship Invulnerability"}, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Drv) - -static struct BurnDIPInfo AmazonDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0x20, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x0c, 0x0c, "20k then every 40k" }, - {0x13, 0x01, 0x0c, 0x08, "50k then every 40k" }, - {0x13, 0x01, 0x0c, 0x04, "20k then every 70k" }, - {0x13, 0x01, 0x0c, 0x00, "50k then every 70k" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x10, 0x00, "Off" }, - {0x13, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x20, 0x00, "Upright" }, - {0x13, 0x01, 0x20, 0x20, "Cocktail" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x14, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x14, 0x01, 0x0c, 0x00, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x0c, 0x08, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x0c, 0x04, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x0c, 0x0c, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x10, 0x10, "Easy" }, - {0x14, 0x01, 0x10, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Level" }, - {0x14, 0x01, 0x40, 0x40, "Low" }, - {0x14, 0x01, 0x40, 0x00, "High" }, - - {0 , 0xfe, 0 , 2 , "Sprite Test" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Amazon) - -static struct BurnDIPInfo HorekidDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0x20, NULL }, - {0x13, 0xff, 0xff, 0xef, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "6" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x0c, 0x0c, "20k then every 60k" }, - {0x13, 0x01, 0x0c, 0x08, "50k then every 60k" }, - {0x13, 0x01, 0x0c, 0x04, "20k then every 90k" }, - {0x13, 0x01, 0x0c, 0x00, "50k then every 90k" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x20, 0x00, "Upright" }, - {0x13, 0x01, 0x20, 0x20, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0xc0, 0xc0, "Easy" }, - {0x13, 0x01, 0xc0, 0x80, "Normal" }, - {0x13, 0x01, 0xc0, 0x40, "Hard" }, - {0x13, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x14, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x03, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x14, 0x01, 0x0c, 0x04, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Debug Mode" }, - {0x14, 0x01, 0xc0, 0xc0, "Off" }, - {0x14, 0x01, 0xc0, 0x80, "On" }, -}; - -STDDIPINFO(Horekid) - -static struct BurnRomInfo DrvRomDesc[] = { - { "bk1_1.4b", 0x08000, 0x60932770, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "bk1_3.4d", 0x08000, 0xcb36240e, BRF_ESS | BRF_PRG }, // 1 - { "bk1_2.6b", 0x08000, 0x539352f2, BRF_ESS | BRF_PRG }, // 2 - { "bk1_4.6d", 0x08000, 0x19387586, BRF_ESS | BRF_PRG }, // 3 - - { "bk2_11.15b", 0x04000, 0x604c3b11, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code - { "bk2_12.17b", 0x04000, 0xaffc898d, BRF_ESS | BRF_PRG }, // 5 - { "bk2_13.18b", 0x04000, 0x302dc0ab, BRF_ESS | BRF_PRG }, // 6 - - { "bk2_14.16g", 0x02000, 0x591a3804, BRF_GRA }, // 7 Chars - - { "bk1_5.15f", 0x08000, 0x984a597f, BRF_GRA }, // 8 Tiles - { "bk1_6.17f", 0x08000, 0x30e297ff, BRF_GRA }, // 9 - - { "bk2_7.6e", 0x04000, 0xbcf7740b, BRF_GRA }, // 10 Sprites - { "bk2_8.7e", 0x04000, 0xa70b565c, BRF_GRA }, // 11 - { "bk2_9.6g", 0x04000, 0x4a9ec3e6, BRF_GRA }, // 12 - { "bk2_10.7g", 0x04000, 0x450749fc, BRF_GRA }, // 13 - - { "bk1_3.10f", 0x00100, 0xce07c544, BRF_GRA }, // 14 PROMs - { "bk1_2.11f", 0x00100, 0x566d323a, BRF_GRA }, // 15 - { "bk1_1.12f", 0x00100, 0x7ea63946, BRF_GRA }, // 16 - { "bk2_4.2g", 0x00100, 0x08609bad, BRF_GRA }, // 17 - - { "bk2_5.4e", 0x00100, 0x2c43991f, BRF_GRA }, // 18 Sprite Palette Bank -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo DrvoRomDesc[] = { - { "1a_4b.rom", 0x04000, 0x76f17479, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "1a_4d.rom", 0x04000, 0x8119f06e, BRF_ESS | BRF_PRG }, // 1 - { "1a_6b.rom", 0x04000, 0xba4b5822, BRF_ESS | BRF_PRG }, // 2 - { "1a_6d.rom", 0x04000, 0xca4852f6, BRF_ESS | BRF_PRG }, // 3 - { "1a_7b.rom", 0x04000, 0xd0771bba, BRF_ESS | BRF_PRG }, // 4 - { "1a_7d.rom", 0x04000, 0x029d59d9, BRF_ESS | BRF_PRG }, // 5 - { "1a_9b.rom", 0x04000, 0x69227b56, BRF_ESS | BRF_PRG }, // 6 - { "1a_9d.rom", 0x04000, 0x5a672942, BRF_ESS | BRF_PRG }, // 7 - - { "2a_15b.rom", 0x04000, 0x604c3b11, BRF_ESS | BRF_PRG }, // 8 Z80 Program Code - { "2a_17b.rom", 0x04000, 0xaffc898d, BRF_ESS | BRF_PRG }, // 9 - { "2a_18b.rom", 0x04000, 0x302dc0ab, BRF_ESS | BRF_PRG }, // 10 - - { "2a_16b.rom", 0x02000, 0x591a3804, BRF_GRA }, // 11 Chars - - { "1a_15f.rom", 0x08000, 0x984a597f, BRF_GRA }, // 12 Tiles - { "1a_17f.rom", 0x08000, 0x30e297ff, BRF_GRA }, // 13 - - { "2a_6e.rom", 0x04000, 0xbcf7740b, BRF_GRA }, // 14 Sprites - { "2a_7e.rom", 0x04000, 0xa70b565c, BRF_GRA }, // 15 - { "2a_6g.rom", 0x04000, 0x4a9ec3e6, BRF_GRA }, // 16 - { "2a_7g.rom", 0x04000, 0x450749fc, BRF_GRA }, // 17 - - { "tc1a_10f.bin", 0x00100, 0xce07c544, BRF_GRA }, // 18 PROMs - { "tc1a_11f.bin", 0x00100, 0x566d323a, BRF_GRA }, // 19 - { "tc1a_12f.bin", 0x00100, 0x7ea63946, BRF_GRA }, // 20 - { "tc2a_2g.bin", 0x00100, 0x08609bad, BRF_GRA }, // 21 - - { "tc2a_4e.bin", 0x00100, 0x2c43991f, BRF_GRA }, // 22 Sprite Palette Bank -}; - -STD_ROM_PICK(Drvo) -STD_ROM_FN(Drvo) - -static struct BurnRomInfo DrvaRomDesc[] = { - { "1a_4b.rom", 0x04000, 0x76f17479, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "1a_4d.rom", 0x04000, 0x8119f06e, BRF_ESS | BRF_PRG }, // 1 - { "1a_6b.rom", 0x04000, 0xba4b5822, BRF_ESS | BRF_PRG }, // 2 - { "1a_6d.rom", 0x04000, 0xca4852f6, BRF_ESS | BRF_PRG }, // 3 - { "1a_7b.rom", 0x04000, 0xd0771bba, BRF_ESS | BRF_PRG }, // 4 - { "1a_7d.rom", 0x04000, 0x029d59d9, BRF_ESS | BRF_PRG }, // 5 - { "1a_9b.rom", 0x04000, 0x69227b56, BRF_ESS | BRF_PRG }, // 6 - { "1a_9d.rom", 0x04000, 0x5a672942, BRF_ESS | BRF_PRG }, // 7 - - { "2a_15b.rom", 0x04000, 0x604c3b11, BRF_ESS | BRF_PRG }, // 8 Z80 Program Code - { "dg.12", 0x04000, 0x9e9b3808, BRF_ESS | BRF_PRG }, // 9 - { "2a_18b.rom", 0x04000, 0x302dc0ab, BRF_ESS | BRF_PRG }, // 10 - - { "2a_16b.rom", 0x02000, 0x591a3804, BRF_GRA }, // 11 Chars - - { "1a_15f.rom", 0x08000, 0x984a597f, BRF_GRA }, // 12 Tiles - { "1a_17f.rom", 0x08000, 0x30e297ff, BRF_GRA }, // 13 - - { "2a_6e.rom", 0x04000, 0xbcf7740b, BRF_GRA }, // 14 Sprites - { "2a_7e.rom", 0x04000, 0xa70b565c, BRF_GRA }, // 15 - { "2a_6g.rom", 0x04000, 0x4a9ec3e6, BRF_GRA }, // 16 - { "2a_7g.rom", 0x04000, 0x450749fc, BRF_GRA }, // 17 - - { "tc1a_10f.bin", 0x00100, 0xce07c544, BRF_GRA }, // 18 PROMs - { "tc1a_11f.bin", 0x00100, 0x566d323a, BRF_GRA }, // 19 - { "tc1a_12f.bin", 0x00100, 0x7ea63946, BRF_GRA }, // 20 - { "tc2a_2g.bin", 0x00100, 0x08609bad, BRF_GRA }, // 21 - - { "tc2a_4e.bin", 0x00100, 0x2c43991f, BRF_GRA }, // 22 Sprite Palette Bank -}; - -STD_ROM_PICK(Drva) -STD_ROM_FN(Drva) - -static struct BurnRomInfo DrvnRomDesc[] = { - { "1a_4b.rom", 0x04000, 0x76f17479, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "1a_4d.rom", 0x04000, 0x8119f06e, BRF_ESS | BRF_PRG }, // 1 - { "1a_6b.rom", 0x04000, 0xba4b5822, BRF_ESS | BRF_PRG }, // 2 - { "1a_6d.rom", 0x04000, 0xca4852f6, BRF_ESS | BRF_PRG }, // 3 - { "1a_7b.rom", 0x04000, 0xd0771bba, BRF_ESS | BRF_PRG }, // 4 - { "1a_7d.rom", 0x04000, 0x029d59d9, BRF_ESS | BRF_PRG }, // 5 - { "1a_9b.rom", 0x04000, 0x69227b56, BRF_ESS | BRF_PRG }, // 6 - { "1a_9d.rom", 0x04000, 0x5a672942, BRF_ESS | BRF_PRG }, // 7 - - { "tc2a_15b.bin", 0x04000, 0x790ddfa9, BRF_ESS | BRF_PRG }, // 8 Z80 Program Code - { "tc2a_17b.bin", 0x04000, 0xd4531113, BRF_ESS | BRF_PRG }, // 9 - - { "2a_16b.rom", 0x02000, 0x591a3804, BRF_GRA }, // 10 Chars - - { "1a_15f.rom", 0x08000, 0x984a597f, BRF_GRA }, // 11 Tiles - { "1a_17f.rom", 0x08000, 0x30e297ff, BRF_GRA }, // 12 - - { "2a_6e.rom", 0x04000, 0xbcf7740b, BRF_GRA }, // 13 Sprites - { "2a_7e.rom", 0x04000, 0xa70b565c, BRF_GRA }, // 14 - { "2a_6g.rom", 0x04000, 0x4a9ec3e6, BRF_GRA }, // 15 - { "2a_7g.rom", 0x04000, 0x450749fc, BRF_GRA }, // 16 - - { "tc1a_10f.bin", 0x00100, 0xce07c544, BRF_GRA }, // 17 PROMs - { "tc1a_11f.bin", 0x00100, 0x566d323a, BRF_GRA }, // 18 - { "tc1a_12f.bin", 0x00100, 0x7ea63946, BRF_GRA }, // 19 - { "tc2a_2g.bin", 0x00100, 0x08609bad, BRF_GRA }, // 20 - - { "tc2a_4e.bin", 0x00100, 0x2c43991f, BRF_GRA }, // 21 Sprite Palette Bank -}; - -STD_ROM_PICK(Drvn) -STD_ROM_FN(Drvn) - -static struct BurnRomInfo AmazonRomDesc[] = { - { "11.4d", 0x08000, 0x6c7f85c5, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "9.4b", 0x08000, 0xe1b7a989, BRF_ESS | BRF_PRG }, // 1 - { "12.6d", 0x08000, 0x4de8a3ee, BRF_ESS | BRF_PRG }, // 2 - { "10.6b", 0x08000, 0xd86bad81, BRF_ESS | BRF_PRG }, // 3 - - { "1.15b", 0x04000, 0x55a8b5e7, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code - { "2.17b", 0x04000, 0x427a7cca, BRF_ESS | BRF_PRG }, // 5 - { "3.18b", 0x04000, 0xb8cceaf7, BRF_ESS | BRF_PRG }, // 6 - - { "8.16g", 0x02000, 0x0cec8644, BRF_GRA }, // 7 Chars - - { "13.15f", 0x08000, 0x415ff4d9, BRF_GRA }, // 8 Tiles - { "14.17f", 0x08000, 0x492b5c48, BRF_GRA }, // 9 - { "15.18f", 0x08000, 0xb1ac0b9d, BRF_GRA }, // 10 - - { "4.6e", 0x04000, 0xf77ced7a, BRF_GRA }, // 11 Sprites - { "5.7e", 0x04000, 0x16ef1465, BRF_GRA }, // 12 - { "6.6g", 0x04000, 0x936ec941, BRF_GRA }, // 13 - { "7.7g", 0x04000, 0x66dd718e, BRF_GRA }, // 14 - - { "clr.10f", 0x00100, 0x6440b341, BRF_GRA }, // 15 PROMs - { "clr.11f", 0x00100, 0x271e947f, BRF_GRA }, // 16 - { "clr.12f", 0x00100, 0x7d38621b, BRF_GRA }, // 17 - { "2g", 0x00100, 0x44ca16b9, BRF_GRA }, // 18 - - { "4e", 0x00100, 0x035f2c7b, BRF_GRA }, // 19 Sprite Palette Bank - - { "16.18g", 0x02000, 0x1d8d592b, BRF_OPT }, // 20 Unknown -}; - -STD_ROM_PICK(Amazon) -STD_ROM_FN(Amazon) - -static struct BurnRomInfo AmatelasRomDesc[] = { - { "a11.4d", 0x08000, 0x3d226d0b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "a9.4b", 0x08000, 0xe2a0d21d, BRF_ESS | BRF_PRG }, // 1 - { "a12.6d", 0x08000, 0xe6607c51, BRF_ESS | BRF_PRG }, // 2 - { "a10.6b", 0x08000, 0xdbc1f1b4, BRF_ESS | BRF_PRG }, // 3 - - { "1.15b", 0x04000, 0x55a8b5e7, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code - { "2.17b", 0x04000, 0x427a7cca, BRF_ESS | BRF_PRG }, // 5 - { "3.18b", 0x04000, 0xb8cceaf7, BRF_ESS | BRF_PRG }, // 6 - - { "a8.16g", 0x02000, 0xaeba2102, BRF_GRA }, // 7 Chars - - { "13.15f", 0x08000, 0x415ff4d9, BRF_GRA }, // 8 Tiles - { "14.17f", 0x08000, 0x492b5c48, BRF_GRA }, // 9 - { "15.18f", 0x08000, 0xb1ac0b9d, BRF_GRA }, // 10 - - { "4.6e", 0x04000, 0xf77ced7a, BRF_GRA }, // 11 Sprites - { "a5.7e", 0x04000, 0x5fbf9a16, BRF_GRA }, // 12 - { "6.6g", 0x04000, 0x936ec941, BRF_GRA }, // 13 - { "7.7g", 0x04000, 0x66dd718e, BRF_GRA }, // 14 - - { "clr.10f", 0x00100, 0x6440b341, BRF_GRA }, // 15 PROMs - { "clr.11f", 0x00100, 0x271e947f, BRF_GRA }, // 16 - { "clr.12f", 0x00100, 0x7d38621b, BRF_GRA }, // 17 - { "2g", 0x00100, 0x44ca16b9, BRF_GRA }, // 18 - - { "4e", 0x00100, 0x035f2c7b, BRF_GRA }, // 19 Sprite Palette Bank - - { "16.18g", 0x02000, 0x1d8d592b, BRF_OPT }, // 20 Unknown -}; - -STD_ROM_PICK(Amatelas) -STD_ROM_FN(Amatelas) - -static struct BurnRomInfo HorekidRomDesc[] = { - { "horekid.03", 0x08000, 0x90ec840f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "horekid.01", 0x08000, 0xa282faf8, BRF_ESS | BRF_PRG }, // 1 - { "horekid.04", 0x08000, 0x375c0c50, BRF_ESS | BRF_PRG }, // 2 - { "horekid.02", 0x08000, 0xee7d52bb, BRF_ESS | BRF_PRG }, // 3 - - { "horekid.09", 0x04000, 0x49cd3b81, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code - { "horekid.10", 0x04000, 0xc1eaa938, BRF_ESS | BRF_PRG }, // 5 - { "horekid.11", 0x04000, 0x0a2bc702, BRF_ESS | BRF_PRG }, // 6 - - { "horekid.16", 0x02000, 0x104b77cc, BRF_GRA }, // 7 Chars - - { "horekid.05", 0x08000, 0xda25ae10, BRF_GRA }, // 8 Tiles - { "horekid.06", 0x08000, 0x616e4321, BRF_GRA }, // 9 - { "horekid.07", 0x08000, 0x8c7d2be2, BRF_GRA }, // 10 - { "horekid.08", 0x08000, 0xa0066b02, BRF_GRA }, // 11 - - { "horekid.12", 0x08000, 0xa3caa07a, BRF_GRA }, // 12 Sprites - { "horekid.13", 0x08000, 0x0e48ff8e, BRF_GRA }, // 13 - { "horekid.14", 0x08000, 0xe300747a, BRF_GRA }, // 14 - { "horekid.15", 0x08000, 0x51105741, BRF_GRA }, // 15 - - { "kid_prom.10f", 0x00100, 0xca13ce23, BRF_GRA }, // 16 PROMs - { "kid_prom.11f", 0x00100, 0xfb44285a, BRF_GRA }, // 17 - { "kid_prom.12f", 0x00100, 0x40d41237, BRF_GRA }, // 18 - { "kid_prom.2g", 0x00100, 0x4b9be0ed, BRF_GRA }, // 19 - - { "kid_prom.4e", 0x00100, 0xe4fb54ee, BRF_GRA }, // 20 Sprite Palette Bank - - { "horekid.17", 0x02000, 0x1d8d592b, BRF_OPT }, // 21 Unknown -}; - -STD_ROM_PICK(Horekid) -STD_ROM_FN(Horekid) - -static struct BurnRomInfo HorekidbRomDesc[] = { - { "knhhd5", 0x08000, 0x786619c7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "knhhd7", 0x08000, 0x3bbb475b, BRF_ESS | BRF_PRG }, // 1 - { "horekid.04", 0x08000, 0x375c0c50, BRF_ESS | BRF_PRG }, // 2 - { "horekid.02", 0x08000, 0xee7d52bb, BRF_ESS | BRF_PRG }, // 3 - - { "horekid.09", 0x04000, 0x49cd3b81, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code - { "horekid.10", 0x04000, 0xc1eaa938, BRF_ESS | BRF_PRG }, // 5 - { "horekid.11", 0x04000, 0x0a2bc702, BRF_ESS | BRF_PRG }, // 6 - - { "horekid.16", 0x02000, 0x104b77cc, BRF_GRA }, // 7 Chars - - { "horekid.05", 0x08000, 0xda25ae10, BRF_GRA }, // 8 Tiles - { "horekid.06", 0x08000, 0x616e4321, BRF_GRA }, // 9 - { "horekid.07", 0x08000, 0x8c7d2be2, BRF_GRA }, // 10 - { "horekid.08", 0x08000, 0xa0066b02, BRF_GRA }, // 11 - - { "horekid.12", 0x08000, 0xa3caa07a, BRF_GRA }, // 12 Sprites - { "horekid.13", 0x08000, 0x0e48ff8e, BRF_GRA }, // 13 - { "horekid.14", 0x08000, 0xe300747a, BRF_GRA }, // 14 - { "horekid.15", 0x08000, 0x51105741, BRF_GRA }, // 15 - - { "kid_prom.10f", 0x00100, 0xca13ce23, BRF_GRA }, // 16 PROMs - { "kid_prom.11f", 0x00100, 0xfb44285a, BRF_GRA }, // 17 - { "kid_prom.12f", 0x00100, 0x40d41237, BRF_GRA }, // 18 - { "kid_prom.2g", 0x00100, 0x4b9be0ed, BRF_GRA }, // 19 - - { "kid_prom.4e", 0x00100, 0xe4fb54ee, BRF_GRA }, // 20 Sprite Palette Bank - - { "horekid.17", 0x02000, 0x1d8d592b, BRF_OPT }, // 21 Unknown -}; - -STD_ROM_PICK(Horekidb) -STD_ROM_FN(Horekidb) - -static struct BurnRomInfo BoobhackRomDesc[] = { - { "1-c.bin", 0x08000, 0x786619c7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "1-b.bin", 0x08000, 0x3bbb475b, BRF_ESS | BRF_PRG }, // 1 - { "1-d.bin", 0x08000, 0x375c0c50, BRF_ESS | BRF_PRG }, // 2 - { "1-a.bin", 0x08000, 0xee7d52bb, BRF_ESS | BRF_PRG }, // 3 - - { "1-i.bin", 0x04000, 0x49cd3b81, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code - { "1-j.bin", 0x04000, 0xc1eaa938, BRF_ESS | BRF_PRG }, // 5 - { "1-k.bin", 0x04000, 0x0a2bc702, BRF_ESS | BRF_PRG }, // 6 - - { "1-p.bin", 0x02000, 0x104b77cc, BRF_GRA }, // 7 Chars - - { "1-e.bin", 0x08000, 0xda25ae10, BRF_GRA }, // 8 Tiles - { "1-f.bin", 0x08000, 0x616e4321, BRF_GRA }, // 9 - { "1-g.bin", 0x08000, 0x8c7d2be2, BRF_GRA }, // 10 - { "1-h.bin", 0x08000, 0xa0066b02, BRF_GRA }, // 11 - - { "1-l.bin", 0x08000, 0xa3caa07a, BRF_GRA }, // 12 Sprites - { "1-m.bin", 0x08000, 0x15b6cbdf, BRF_GRA }, // 13 - { "1-n.bin", 0x08000, 0xe300747a, BRF_GRA }, // 14 - { "1-o.bin", 0x08000, 0xcddc6a6c, BRF_GRA }, // 15 - - { "kid_prom.10f", 0x00100, 0xca13ce23, BRF_GRA }, // 16 PROMs - { "kid_prom.11f", 0x00100, 0xfb44285a, BRF_GRA }, // 17 - { "kid_prom.12f", 0x00100, 0x40d41237, BRF_GRA }, // 18 - { "kid_prom.2g", 0x00100, 0x4b9be0ed, BRF_GRA }, // 19 - - { "kid_prom.4e", 0x00100, 0xe4fb54ee, BRF_GRA }, // 20 Sprite Palette Bank -}; - -STD_ROM_PICK(Boobhack) -STD_ROM_FN(Boobhack) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x020000; - DrvZ80Rom = Next; Next += 0x00c000; - DrvProms = Next; Next += 0x000400; - DrvSpritePalBank = Next; Next += 0x000100; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x001000; - DrvSpriteRam = Next; Next += 0x002000; - DrvBgVideoRam = Next; Next += 0x001000; - DrvFgVideoRam = Next; Next += 0x001000; - DrvZ80Ram = Next; Next += 0x001000; - - RamEnd = Next; - - DrvChars = Next; Next += 0x100 * 8 * 8; - DrvTiles = Next; Next += 0x400 * 16 * 16; - DrvSprites = Next; Next += 0x400 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x1110 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - if (DrvUseYM2203) { - BurnYM2203Reset(); - } else { - BurnYM3526Reset(); - } - ZetClose(); - - DACReset(); - - DrvScrollX = 0; - DrvScrollY = 0; - DrvDisableBg = 0; - DrvFlipScreen = 0; - DrvSoundLatch = 0; - AmazonProtCmd = 0; - memset(AmazonProtReg, 0, 6); - - return 0; -} - -UINT8 __fastcall Terracre68KReadByte(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Terracre68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Terracre68KReadWord(UINT32 a) -{ - switch (a) { - case 0x024000: { - return DrvInput[0]; - } - - case 0x024002: { - return DrvInput[1]; - } - - case 0x024004: { - return (DrvInput[2] | DrvDip[0]) << 8; - } - - case 0x024006: { - return (DrvDip[2] << 8) | DrvDip[1]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Terracre68KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x026000: { - DrvFlipScreen = d; - return; - } - - case 0x026002: { - DrvScrollX = d & 0x3ff; - DrvDisableBg = (d & 0x2000) ? 1 : 0; - return; - } - - case 0x026004: { - DrvScrollY = d & 0x1ff; - return; - } - - case 0x02600a: { - // ??? - return; - } - - case 0x02600c: { - DrvSoundLatch = ((d & 0x7f) << 1) | 1; - return; - } - - case 0x02600e: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Amazon68KReadByte(UINT32 a) -{ - switch (a) { - case 0x070001: { - INT32 Offset = AmazonProtReg[2]; - if (Offset <= 0x56) { - UINT16 Data; - Data = AmazonProtDataPtr[Offset >> 1]; - if (Offset & 0x01) return Data & 0xff; - return Data >> 8; - } - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Amazon68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x070001: { - if (AmazonProtCmd >= 32 && AmazonProtCmd <= 0x37) { - AmazonProtReg[AmazonProtCmd - 0x32] = d; - } - return; - } - - case 0x070003: { - AmazonProtCmd = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Amazon68KReadWord(UINT32 a) -{ - switch (a) { - case 0x044000: { - if (DrvIsHorekid) { - return (DrvDip[2] << 8) | DrvDip[1]; - } - return DrvInput[0]; - } - - case 0x044002: { - if (DrvIsHorekid) { - return (DrvInput[2] | DrvDip[0]) << 8; - } - return DrvInput[1]; - } - - case 0x044004: { - if (DrvIsHorekid) { - return DrvInput[1]; - } - return (DrvInput[2] | DrvDip[0]) << 8; - } - - case 0x044006: { - if (DrvIsHorekid) { - return DrvInput[0]; - } - return (DrvDip[2] << 8) | DrvDip[1]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Amazon68KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x046000: { - DrvFlipScreen = d; - return; - } - - case 0x046002: { - DrvScrollX = d & 0x3ff; - DrvDisableBg = (d & 0x2000) ? 1 : 0; - return; - } - - case 0x046004: { - DrvScrollY = d & 0x1ff; - return; - } - - case 0x04600a: { - // ??? - return; - } - - case 0x04600c: { - DrvSoundLatch = ((d & 0x7f) << 1) | 1; - return; - } - - case 0x04600e: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall TerracreZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x04: { - DrvSoundLatch = 0; - return 0; - } - - case 0x06: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall TerracreZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - BurnYM3526Write(0, d); - return; - } - - case 0x01: { - BurnYM3526Write(1, d); - return; - } - - case 0x02: { - DACSignedWrite(0, d); - return; - } - - case 0x03: { - DACSignedWrite(1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -void __fastcall TerracreYM2203Z80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0x01: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0x02: { - DACSignedWrite(0, d); - return; - } - - case 0x03: { - DACSignedWrite(1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); - } - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000; -} - -static INT32 TerracreSyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (4000000.0000 / (nBurnFPS / 100.0000)))); -} - -static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 CharXOffsets[8] = { 4, 0, 12, 8, 20, 16, 28, 24 }; -static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 TileXOffsets[16] = { 4, 0, 12, 8, 20, 16, 28, 24, 36, 32, 44, 40, 52, 48, 60, 56 }; -static INT32 TileYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; -static INT32 SpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 SpriteXOffsets[16] = { 4, 0, RGN_FRAC(0x10000,1,2)+4,RGN_FRAC(0x10000,1,2)+0, 12, 8, RGN_FRAC(0x10000,1,2)+12, RGN_FRAC(0x10000,1,2)+8, 20, 16, RGN_FRAC(0x10000,1,2)+20, RGN_FRAC(0x10000,1,2)+16, 28, 24, RGN_FRAC(0x10000,1,2)+28, RGN_FRAC(0x10000,1,2)+24 }; -static INT32 HorekidSpriteXOffsets[16] = { 4, 0, RGN_FRAC(0x20000,1,2)+4,RGN_FRAC(0x20000,1,2)+0, 12, 8, RGN_FRAC(0x20000,1,2)+12, RGN_FRAC(0x20000,1,2)+8, 20, 16, RGN_FRAC(0x20000,1,2)+20, RGN_FRAC(0x20000,1,2)+16, 28, 24, RGN_FRAC(0x20000,1,2)+28, RGN_FRAC(0x20000,1,2)+24 }; -static INT32 SpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; - -static INT32 DrvInit() -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - if (LoadRomsFunction()) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x01ffff, SM_ROM); - SekMapMemory(DrvSpriteRam , 0x020000, 0x021fff, SM_RAM); - SekMapMemory(DrvBgVideoRam , 0x022000, 0x022fff, SM_RAM); -// SekMapMemory(Drv68KRam , 0x023000, 0x023fff, SM_RAM); - SekMapMemory(DrvFgVideoRam , 0x028000, 0x0287ff, SM_RAM); - SekSetReadWordHandler(0, Terracre68KReadWord); - SekSetWriteWordHandler(0, Terracre68KWriteWord); - SekSetReadByteHandler(0, Terracre68KReadByte); - SekSetWriteByteHandler(0, Terracre68KWriteByte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetSetInHandler(TerracreZ80PortRead); - if (DrvUseYM2203) { - ZetSetOutHandler(TerracreYM2203Z80PortWrite); - } else { - ZetSetOutHandler(TerracreZ80PortWrite); - } - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom); - ZetMapArea(0xc000, 0xcfff, 0, DrvZ80Ram); - ZetMapArea(0xc000, 0xcfff, 1, DrvZ80Ram); - ZetMapArea(0xc000, 0xcfff, 2, DrvZ80Ram); - ZetMemEnd(); - ZetClose(); - - if (DrvUseYM2203) { - BurnYM2203Init(1, 4000000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); - } else { - BurnYM3526Init(4000000, NULL, &DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3526(4000000); - BurnYM3526SetRoute(BURN_SND_YM3526_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - } - - DACInit(0, 0, 1, TerracreSyncDAC); - DACInit(1, 0, 1, TerracreSyncDAC); - DACSetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - DACSetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvRecalcPal = 1; - - DrvDoReset(); - - return 0; -} - -static INT32 DrvAmazonInit() -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - if (LoadRomsFunction()) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x01ffff, SM_ROM); - SekMapMemory(DrvSpriteRam , 0x040000, 0x040fff, SM_RAM); - SekMapMemory(DrvBgVideoRam , 0x042000, 0x042fff, SM_RAM); - SekMapMemory(DrvFgVideoRam , 0x050000, 0x050fff, SM_RAM); - SekSetReadWordHandler(0, Amazon68KReadWord); - SekSetWriteWordHandler(0, Amazon68KWriteWord); - SekSetReadByteHandler(0, Amazon68KReadByte); - SekSetWriteByteHandler(0, Amazon68KWriteByte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetSetInHandler(TerracreZ80PortRead); - ZetSetOutHandler(TerracreZ80PortWrite); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom); - ZetMapArea(0xc000, 0xcfff, 0, DrvZ80Ram); - ZetMapArea(0xc000, 0xcfff, 1, DrvZ80Ram); - ZetMapArea(0xc000, 0xcfff, 2, DrvZ80Ram); - ZetMemEnd(); - ZetClose(); - - BurnYM3526Init(4000000, NULL, &DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3526(4000000); - BurnYM3526SetRoute(BURN_SND_YM3526_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - DACInit(0, 0, 1, TerracreSyncDAC); - DACInit(1, 0, 1, TerracreSyncDAC); - DACSetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - DACSetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvRecalcPal = 1; - - DrvDoReset(); - - return 0; -} - -static INT32 TerracreLoadRoms() -{ - INT32 nRet; - - DrvTempRom = (UINT8 *)BurnMalloc(0x10000); - - nRet = BurnLoadRom(Drv68KRom + 0x000000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000001, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x010000, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x010001, 3, 2); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x004000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x008000, 6, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 9, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvTiles); - - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c000, 13, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - nRet = BurnLoadRom(DrvProms + 0x00000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00100, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00200, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00300, 17, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvSpritePalBank , 18, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 TerracreoLoadRoms() -{ - INT32 nRet; - - DrvTempRom = (UINT8 *)BurnMalloc(0x10000); - - nRet = BurnLoadRom(Drv68KRom + 0x000000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000001, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x008000, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x008001, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x010000, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x010001, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x018000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x018001, 7, 2); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x004000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x008000, 10, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 13, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvTiles); - - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c000, 17, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - nRet = BurnLoadRom(DrvProms + 0x00000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00100, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00200, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00300, 21, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvSpritePalBank , 22, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 TerracrenLoadRoms() -{ - INT32 nRet; - - DrvTempRom = (UINT8 *)BurnMalloc(0x10000); - - nRet = BurnLoadRom(Drv68KRom + 0x000000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000001, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x008000, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x008001, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x010000, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x010001, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x018000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x018001, 7, 2); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x004000, 9, 1); if (nRet != 0) return 1; - memset(DrvZ80Rom + 0x8000, 0xff, 0x4000); - - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 12, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvTiles); - - memset(DrvTempRom, 0, 0x10000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c000, 16, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - nRet = BurnLoadRom(DrvProms + 0x00000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00100, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00200, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00300, 20, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvSpritePalBank , 21, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 AmazonLoadRoms() -{ - INT32 nRet; - - DrvTempRom = (UINT8 *)BurnMalloc(0x20000); - - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x010001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x010000, 3, 2); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x004000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x008000, 6, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0, 0x20000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0, 0x20000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 10, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvTiles); - - memset(DrvTempRom, 0, 0x20000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x04000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c000, 14, 1); if (nRet != 0) return 1; - GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - nRet = BurnLoadRom(DrvProms + 0x00000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00100, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00200, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00300, 18, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvSpritePalBank , 19, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 HorekidLoadRoms() -{ - INT32 nRet; - - DrvTempRom = (UINT8 *)BurnMalloc(0x20000); - - nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x010001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x010000, 3, 2); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x004000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom + 0x008000, 6, 1); if (nRet != 0) return 1; - - memset(DrvTempRom, 0, 0x20000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - GfxDecode(0x100, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - memset(DrvTempRom, 0, 0x20000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x18000, 11, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvTiles); - - memset(DrvTempRom, 0, 0x20000); - nRet = BurnLoadRom(DrvTempRom + 0x00000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x18000, 15, 1); if (nRet != 0) return 1; - GfxDecode(0x400, 4, 16, 16, SpritePlaneOffsets, HorekidSpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - nRet = BurnLoadRom(DrvProms + 0x00000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00100, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00200, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvProms + 0x00300, 19, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(DrvSpritePalBank , 20, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static UINT16 AmazonProtData[] = { - 0x0000, 0x5000, 0x5341, 0x4b45, 0x5349, 0x4755, 0x5245, - 0x0000, 0x4000, 0x0e4b, 0x4154, 0x5544, 0x4f4e, 0x0e0e, - 0x0000, 0x3000, 0x414e, 0x4b41, 0x4b45, 0x5544, 0x4f4e, - 0x0000, 0x2000, 0x0e0e, 0x4b49, 0x5455, 0x4e45, 0x0e0e, - 0x0000, 0x1000, 0x0e4b, 0x414b, 0x4553, 0x4f42, 0x410e, - - 0x4ef9, 0x0000, 0x62fa, 0x0000, 0x4ef9, 0x0000, 0x805E, 0x0000, 0xc800 -}; - -static UINT16 AmatelasProtData[] = { - 0x0000, 0x5000, 0x5341, 0x4b45, 0x5349, 0x4755, 0x5245, - 0x0000, 0x4000, 0x0e4b, 0x4154, 0x5544, 0x4f4e, 0x0e0e, - 0x0000, 0x3000, 0x414e, 0x4b41, 0x4b45, 0x5544, 0x4f4e, - 0x0000, 0x2000, 0x0e0e, 0x4b49, 0x5455, 0x4e45, 0x0e0e, - 0x0000, 0x1000, 0x0e4b, 0x414b, 0x4553, 0x4f42, 0x410e, - - 0x4ef9, 0x0000, 0x632e, 0x0000, 0x4ef9, 0x0000, 0x80C2, 0x0000, 0x6100 -}; - -static UINT16 HorekidProtData[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - - 0x4e75, 0x4e75, 0x4e75, 0x4e75, 0x4e75, 0x4e75, 0x4e75, 0x4e75, 0x1800 -}; - -static INT32 TerracreInit() -{ - LoadRomsFunction = TerracreLoadRoms; - - return DrvInit(); -} - -static INT32 TerracreoInit() -{ - LoadRomsFunction = TerracreoLoadRoms; - - return DrvInit(); -} - -static INT32 TerracrenInit() -{ - LoadRomsFunction = TerracrenLoadRoms; - DrvUseYM2203 = 1; - - return DrvInit(); -} - -static INT32 AmazonInit() -{ - LoadRomsFunction = AmazonLoadRoms; - AmazonProtDataPtr = AmazonProtData; - - return DrvAmazonInit(); -} - -static INT32 AmatelasInit() -{ - LoadRomsFunction = AmazonLoadRoms; - AmazonProtDataPtr = AmatelasProtData; - - return DrvAmazonInit(); -} - -static INT32 HorekidInit() -{ - LoadRomsFunction = HorekidLoadRoms; - AmazonProtDataPtr = HorekidProtData; - DrvIsHorekid = 1; - - return DrvAmazonInit(); -} - -static INT32 DrvExit() -{ - SekExit(); - ZetExit(); - - if (DrvUseYM2203) { - BurnYM2203Exit(); - } else { - BurnYM3526Exit(); - } - DACExit(); - - GenericTilesExit(); - - BurnFree(Mem); - - DrvScrollX = 0; - DrvScrollY = 0; - DrvDisableBg = 0; - DrvFlipScreen = 0; - DrvSoundLatch = 0; - AmazonProtCmd = 0; - memset(AmazonProtReg, 0, 6); - - DrvUseYM2203 = 0; - DrvIsHorekid = 0; - - LoadRomsFunction = NULL; - AmazonProtDataPtr = NULL; - - return 0; -} - -static inline UINT8 pal4bit(UINT8 bits) -{ - bits &= 0x0f; - return (bits << 4) | bits; -} - -static void DrvCalcPalette() -{ - UINT32 PalLookup[0x100]; - INT32 i; - - for (i = 0; i < 0x100; i++) { - INT32 r = pal4bit(DrvProms[i + 0x000]); - INT32 g = pal4bit(DrvProms[i + 0x100]); - INT32 b = pal4bit(DrvProms[i + 0x200]); - - PalLookup[i] = BurnHighCol(r, g, b, 0); - } - - for (i = 0; i < 0x10; i++) { - DrvPalette[i] = PalLookup[i]; - } - - for (i = 0; i < 0x100; i++) { - UINT8 ctabentry; - - if (i & 0x08) { - ctabentry = 0xc0 | (i & 0x0f) | ((i & 0xc0) >> 2); - } else { - ctabentry = 0xc0 | (i & 0x0f) | ((i & 0x30) >> 0); - } - - DrvPalette[0x10 + i] = PalLookup[ctabentry]; - } - - for (i = 0; i < 0x1000; i++) { - UINT8 ctabentry; - INT32 i_swapped = ((i & 0x0f) << 8) | ((i & 0xff0) >> 4); - - if (i & 0x80) { - ctabentry = 0x80 | ((i & 0x0c) << 2) | (DrvProms[0x300 + (i >> 4)] & 0x0f); - } else { - ctabentry = 0x80 | ((i & 0x03) << 4) | (DrvProms[0x300 + (i >> 4)] & 0x0f); - } - - DrvPalette[0x110 + i_swapped] = PalLookup[ctabentry]; - } - - DrvRecalcPal = 0; -} - -static void DrvRenderBgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex; - - UINT16 *VideoRam = (UINT16*)DrvBgVideoRam; - - for (mx = 0; mx < 32; mx++) { - for (my = 0; my < 64; my++) { - TileIndex = (my * 32) + mx; - Code = VideoRam[TileIndex]; - Colour = (Code >> 11) + (0x10 >> 4); - Code &= 0x3ff; - - y = 16 * mx; - x = 16 * my; - - x -= DrvScrollX; - y -= DrvScrollY; - if (x < -16) x += 1024; - if (y < -16) y += 512; - - if (DrvFlipScreen) { - x = 240 - x; - y = 240 - y; - } - - y -= 16; - - if (DrvFlipScreen) { - if (x > 16 && x < 240 && y > 16 && y < 208) { - Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, DrvTiles); - } else { - Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvTiles); - } - } else { - if (x > 16 && x < 240 && y > 16 && y < 208) { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvTiles); - } - } - } - } -} - -static void DrvRenderFgLayer() -{ - INT32 mx, my, Code, x, y, TileIndex; - - UINT16 *VideoRam = (UINT16*)DrvFgVideoRam; - - for (mx = 0; mx < 32; mx++) { - for (my = 0; my < 64; my++) { - TileIndex = (my * 32) + mx; - Code = VideoRam[TileIndex] & 0xff; - - y = 8 * mx; - x = 8 * my; - - if (DrvFlipScreen) { - x = 248 - x; - y = 248 - y; - } - - y -= 16; - - if (DrvFlipScreen) { - if (x > 8 && x < 248 && y > 8 && y < 216) { - Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, 0, 4, 0x0f, 0, DrvChars); - } else { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, 0, 4, 0x0f, 0, DrvChars); - } - } else { - if (x > 8 && x < 248 && y > 8 && y < 216) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, 0, 4, 0x0f, 0, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, 0, 4, 0x0f, 0, DrvChars); - } - } - } - } -} - -static void DrawSprites() -{ - UINT16 *pSource = (UINT16*)DrvSpriteRam; - INT32 TransparentPen = 0x00; - if (DrvIsHorekid) TransparentPen = 0x0f; - - for (INT32 i = 0; i < 0x200; i += 8) { - INT32 Tile = pSource[1] & 0xff; - INT32 Attrs = pSource[2]; - INT32 xFlip = Attrs & 0x04; - INT32 yFlip = Attrs & 0x08; - INT32 Colour = (Attrs & 0xf0) >> 4; - INT32 sx = (pSource[3] & 0xff) - 0x80 + 256 * (Attrs & 1); - INT32 sy = 240 - (pSource[0] & 0xff); - - if (DrvIsHorekid) { - INT32 Bank; - - if (Attrs & 0x02) Tile |= 0x200; - if (Attrs & 0x10) Tile |= 0x100; - - Bank = (Tile & 0xfc) >> 1; - if (Tile & 0x200) Bank |= 0x80; - if (Tile & 0x100) Bank |= 0x01; - - Colour &= 0xe; - Colour += 16 * (DrvSpritePalBank[Bank] & 0x0f); - } else { - if (Attrs & 0x02) Tile |= 0x100; - Colour += 16 * (DrvSpritePalBank[(Tile >> 1) & 0xff] & 0x0f); - } - - Colour += (0x110) >> 4; - - if (DrvFlipScreen) { - sx = 240 - sx; - sy = 240 - sy; - xFlip = !xFlip; - yFlip = !yFlip; - } - - sy -= 16; - - if (sx > 16 && sx < 240 && sy > 16 && sy < 208) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); - } else { - Render16x16Tile_Mask(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); - } - } - } - - pSource += 4; - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - if (DrvRecalcPal) DrvCalcPalette(); - if (nBurnLayer & 0x01 && !DrvDisableBg) DrvRenderBgLayer(); - if (nSpriteEnable & 0x01) DrawSprites(); - if (nBurnLayer & 0x02) DrvRenderFgLayer(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nCyclesTotal[2] = { 8000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - INT32 nInterleave = 100; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - INT32 Z80IRQSlice[9]; - for (INT32 i = 0; i < 9; i++) { - Z80IRQSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 10)); - } - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - SekClose(); - - nCurrentCPU = 1; - ZetOpen(0); - if (DrvUseYM2203) { -#if 0 - // The sound cpu fails to read the latches if we run this here - BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); -#endif - } else { - BurnTimerUpdateYM3526(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - } - for (INT32 j = 0; j < 9; j++) { - if (i == Z80IRQSlice[j]) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - nCyclesDone[1] += ZetRun(4000); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } - } - ZetClose(); - } - - ZetOpen(0); - if (DrvUseYM2203) { - BurnTimerEndFrame(nCyclesTotal[1]); - } else { - BurnTimerEndFrameYM3526(nCyclesTotal[1]); - } - if (pBurnSoundOut) { - if (DrvUseYM2203) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - } else { - BurnYM3526Update(pBurnSoundOut, nBurnSoundLen); - } - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029719; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - if (DrvUseYM2203) { - BurnYM2203Scan(nAction, pnMin); - } else { - BurnYM3526Scan(nAction, pnMin); - } - - DACScan(nAction, pnMin); - - SCAN_VAR(DrvScrollX); - SCAN_VAR(DrvScrollY); - SCAN_VAR(DrvDisableBg); - SCAN_VAR(DrvFlipScreen); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(AmazonProtCmd); - SCAN_VAR(AmazonProtReg); - - if (nAction & ACB_WRITE) { - DrvRecalcPal = 1; - } - } - - return 0; -} - -struct BurnDriver BurnDrvTerracre = { - "terracre", NULL, NULL, NULL, "1985", - "Terra Cresta (YM3526 set 1)\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - TerracreInit, DrvExit, DrvFrame, NULL, DrvScan, - &DrvRecalcPal, 0x1110, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTerracreo = { - "terracreo", "terracre", NULL, NULL, "1985", - "Terra Cresta (YM3526 set 2)\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, DrvoRomInfo, DrvoRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - TerracreoInit, DrvExit, DrvFrame, NULL, DrvScan, - &DrvRecalcPal, 0x1110, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTerracrea = { - "terracrea", "terracre", NULL, NULL, "1985", - "Terra Cresta (YM3526 set 3)\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, DrvaRomInfo, DrvaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - TerracreoInit, DrvExit, DrvFrame, NULL, DrvScan, - &DrvRecalcPal, 0x1110, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTerracren = { - "terracren", "terracre", NULL, NULL, "1985", - "Terra Cresta (YM2203)\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, DrvnRomInfo, DrvnRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - TerracrenInit, DrvExit, DrvFrame, NULL, DrvScan, - &DrvRecalcPal, 0x1110, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAmazon = { - "amazon", NULL, NULL, NULL, "1986", - "Soldier Girl Amazon\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, AmazonRomInfo, AmazonRomName, NULL, NULL, AmazonInputInfo, AmazonDIPInfo, - AmazonInit, DrvExit, DrvFrame, NULL, DrvScan, - &DrvRecalcPal, 0x1110, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvAmatelas = { - "amatelas", "amazon", NULL, NULL, "1986", - "Sei Senshi Amatelass\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, AmatelasRomInfo, AmatelasRomName, NULL, NULL, AmazonInputInfo, AmazonDIPInfo, - AmatelasInit, DrvExit, DrvFrame, NULL, DrvScan, - &DrvRecalcPal, 0x1110, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHorekid = { - "horekid", NULL, NULL, NULL, "1987", - "Kid no Hore Hore Daisakusen\0", NULL, "Nichibutsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, HorekidRomInfo, HorekidRomName, NULL, NULL, HorekidInputInfo, HorekidDIPInfo, - HorekidInit, DrvExit, DrvFrame, NULL, DrvScan, - &DrvRecalcPal, 0x1110, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHorekidb = { - "horekidb", "horekid", NULL, NULL, "1987", - "Kid no Hore Hore Daisakusen (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, HorekidbRomInfo, HorekidbRomName, NULL, NULL, HorekidInputInfo, HorekidDIPInfo, - HorekidInit, DrvExit, DrvFrame, NULL, DrvScan, - &DrvRecalcPal, 0x1110, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvBoobhack = { - "boobhack", "horekid", NULL, NULL, "1987", - "Booby Kids (Italian manufactured graphic hack / bootleg of Kid no Hore Hore Daisakusen (bootleg))\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, BoobhackRomInfo, BoobhackRomName, NULL, NULL, HorekidInputInfo, HorekidDIPInfo, - HorekidInit, DrvExit, DrvFrame, NULL, DrvScan, - &DrvRecalcPal, 0x1110, 224, 256, 3, 4 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym3526.h" +#include "burn_ym2203.h" +#include "dac.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[3] = {0, 0, 0}; +static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Drv68KRom = NULL; +static UINT8 *DrvZ80Rom = NULL; +static UINT8 *Drv68KRam = NULL; +static UINT8 *DrvZ80Ram = NULL; +static UINT8 *DrvProms = NULL; +static UINT8 *DrvSpritePalBank = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvBgVideoRam = NULL; +static UINT8 *DrvFgVideoRam = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT8 DrvRecalcPal = 0; +static UINT16 DrvScrollX = 0; +static UINT16 DrvScrollY = 0; +static UINT16 DrvDisableBg = 0; +static UINT16 DrvFlipScreen = 0; +static UINT8 DrvSoundLatch = 0; + +static UINT8 AmazonProtCmd; +static UINT8 AmazonProtReg[6]; + +static UINT8 DrvUseYM2203 = 0; +static UINT8 DrvIsHorekid = 0; +static UINT16 *AmazonProtDataPtr = NULL; + +typedef INT32 (*TerracreLoadRomsType)(); +static TerracreLoadRomsType LoadRomsFunction; + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort2 + 4, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo AmazonInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 1, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort2 + 4, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Amazon) + +static struct BurnInputInfo HorekidInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort2 + 4, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, +}; + +STDINPUTINFO(Horekid) + +static inline void DrvMakeInputs() +{ + DrvInput[0] = DrvInput[1] = 0xff; + DrvInput[2] = 0xdf; + + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] -= (DrvInputPort0[i] & 1) << i; + DrvInput[1] -= (DrvInputPort1[i] & 1) << i; + DrvInput[2] -= (DrvInputPort2[i] & 1) << i; + } +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0x20, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x0c, 0x0c, "20k then every 60k" }, + {0x13, 0x01, 0x0c, 0x08, "30k then every 70k" }, + {0x13, 0x01, 0x0c, 0x04, "40k then every 80k" }, + {0x13, 0x01, 0x0c, 0x00, "50k then every 90k" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x10, 0x00, "Off" }, + {0x13, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x20, 0x00, "Upright" }, + {0x13, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x14, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x14, 0x01, 0x0c, 0x00, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x0c, 0x04, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x0c, 0x0c, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0c, 0x08, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x10, 0x10, "Easy" }, + {0x14, 0x01, 0x10, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Complete Invulnerability"}, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Base Ship Invulnerability"}, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Drv) + +static struct BurnDIPInfo AmazonDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0x20, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x0c, 0x0c, "20k then every 40k" }, + {0x13, 0x01, 0x0c, 0x08, "50k then every 40k" }, + {0x13, 0x01, 0x0c, 0x04, "20k then every 70k" }, + {0x13, 0x01, 0x0c, 0x00, "50k then every 70k" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x10, 0x00, "Off" }, + {0x13, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x20, 0x00, "Upright" }, + {0x13, 0x01, 0x20, 0x20, "Cocktail" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x14, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x14, 0x01, 0x0c, 0x00, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x0c, 0x08, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x0c, 0x04, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x0c, 0x0c, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x10, 0x10, "Easy" }, + {0x14, 0x01, 0x10, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Level" }, + {0x14, 0x01, 0x40, 0x40, "Low" }, + {0x14, 0x01, 0x40, 0x00, "High" }, + + {0 , 0xfe, 0 , 2 , "Sprite Test" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Amazon) + +static struct BurnDIPInfo HorekidDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0x20, NULL }, + {0x13, 0xff, 0xff, 0xef, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "6" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x0c, 0x0c, "20k then every 60k" }, + {0x13, 0x01, 0x0c, 0x08, "50k then every 60k" }, + {0x13, 0x01, 0x0c, 0x04, "20k then every 90k" }, + {0x13, 0x01, 0x0c, 0x00, "50k then every 90k" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x20, 0x00, "Upright" }, + {0x13, 0x01, 0x20, 0x20, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0xc0, 0xc0, "Easy" }, + {0x13, 0x01, 0xc0, 0x80, "Normal" }, + {0x13, 0x01, 0xc0, 0x40, "Hard" }, + {0x13, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x14, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x03, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x14, 0x01, 0x0c, 0x04, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Debug Mode" }, + {0x14, 0x01, 0xc0, 0xc0, "Off" }, + {0x14, 0x01, 0xc0, 0x80, "On" }, +}; + +STDDIPINFO(Horekid) + +static struct BurnRomInfo DrvRomDesc[] = { + { "bk1_1.4b", 0x08000, 0x60932770, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "bk1_3.4d", 0x08000, 0xcb36240e, BRF_ESS | BRF_PRG }, // 1 + { "bk1_2.6b", 0x08000, 0x539352f2, BRF_ESS | BRF_PRG }, // 2 + { "bk1_4.6d", 0x08000, 0x19387586, BRF_ESS | BRF_PRG }, // 3 + + { "bk2_11.15b", 0x04000, 0x604c3b11, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code + { "bk2_12.17b", 0x04000, 0xaffc898d, BRF_ESS | BRF_PRG }, // 5 + { "bk2_13.18b", 0x04000, 0x302dc0ab, BRF_ESS | BRF_PRG }, // 6 + + { "bk2_14.16g", 0x02000, 0x591a3804, BRF_GRA }, // 7 Chars + + { "bk1_5.15f", 0x08000, 0x984a597f, BRF_GRA }, // 8 Tiles + { "bk1_6.17f", 0x08000, 0x30e297ff, BRF_GRA }, // 9 + + { "bk2_7.6e", 0x04000, 0xbcf7740b, BRF_GRA }, // 10 Sprites + { "bk2_8.7e", 0x04000, 0xa70b565c, BRF_GRA }, // 11 + { "bk2_9.6g", 0x04000, 0x4a9ec3e6, BRF_GRA }, // 12 + { "bk2_10.7g", 0x04000, 0x450749fc, BRF_GRA }, // 13 + + { "bk1_3.10f", 0x00100, 0xce07c544, BRF_GRA }, // 14 PROMs + { "bk1_2.11f", 0x00100, 0x566d323a, BRF_GRA }, // 15 + { "bk1_1.12f", 0x00100, 0x7ea63946, BRF_GRA }, // 16 + { "bk2_4.2g", 0x00100, 0x08609bad, BRF_GRA }, // 17 + + { "bk2_5.4e", 0x00100, 0x2c43991f, BRF_GRA }, // 18 Sprite Palette Bank +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo DrvoRomDesc[] = { + { "1a_4b.rom", 0x04000, 0x76f17479, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "1a_4d.rom", 0x04000, 0x8119f06e, BRF_ESS | BRF_PRG }, // 1 + { "1a_6b.rom", 0x04000, 0xba4b5822, BRF_ESS | BRF_PRG }, // 2 + { "1a_6d.rom", 0x04000, 0xca4852f6, BRF_ESS | BRF_PRG }, // 3 + { "1a_7b.rom", 0x04000, 0xd0771bba, BRF_ESS | BRF_PRG }, // 4 + { "1a_7d.rom", 0x04000, 0x029d59d9, BRF_ESS | BRF_PRG }, // 5 + { "1a_9b.rom", 0x04000, 0x69227b56, BRF_ESS | BRF_PRG }, // 6 + { "1a_9d.rom", 0x04000, 0x5a672942, BRF_ESS | BRF_PRG }, // 7 + + { "2a_15b.rom", 0x04000, 0x604c3b11, BRF_ESS | BRF_PRG }, // 8 Z80 Program Code + { "2a_17b.rom", 0x04000, 0xaffc898d, BRF_ESS | BRF_PRG }, // 9 + { "2a_18b.rom", 0x04000, 0x302dc0ab, BRF_ESS | BRF_PRG }, // 10 + + { "2a_16b.rom", 0x02000, 0x591a3804, BRF_GRA }, // 11 Chars + + { "1a_15f.rom", 0x08000, 0x984a597f, BRF_GRA }, // 12 Tiles + { "1a_17f.rom", 0x08000, 0x30e297ff, BRF_GRA }, // 13 + + { "2a_6e.rom", 0x04000, 0xbcf7740b, BRF_GRA }, // 14 Sprites + { "2a_7e.rom", 0x04000, 0xa70b565c, BRF_GRA }, // 15 + { "2a_6g.rom", 0x04000, 0x4a9ec3e6, BRF_GRA }, // 16 + { "2a_7g.rom", 0x04000, 0x450749fc, BRF_GRA }, // 17 + + { "tc1a_10f.bin", 0x00100, 0xce07c544, BRF_GRA }, // 18 PROMs + { "tc1a_11f.bin", 0x00100, 0x566d323a, BRF_GRA }, // 19 + { "tc1a_12f.bin", 0x00100, 0x7ea63946, BRF_GRA }, // 20 + { "tc2a_2g.bin", 0x00100, 0x08609bad, BRF_GRA }, // 21 + + { "tc2a_4e.bin", 0x00100, 0x2c43991f, BRF_GRA }, // 22 Sprite Palette Bank +}; + +STD_ROM_PICK(Drvo) +STD_ROM_FN(Drvo) + +static struct BurnRomInfo DrvaRomDesc[] = { + { "1a_4b.rom", 0x04000, 0x76f17479, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "1a_4d.rom", 0x04000, 0x8119f06e, BRF_ESS | BRF_PRG }, // 1 + { "1a_6b.rom", 0x04000, 0xba4b5822, BRF_ESS | BRF_PRG }, // 2 + { "1a_6d.rom", 0x04000, 0xca4852f6, BRF_ESS | BRF_PRG }, // 3 + { "1a_7b.rom", 0x04000, 0xd0771bba, BRF_ESS | BRF_PRG }, // 4 + { "1a_7d.rom", 0x04000, 0x029d59d9, BRF_ESS | BRF_PRG }, // 5 + { "1a_9b.rom", 0x04000, 0x69227b56, BRF_ESS | BRF_PRG }, // 6 + { "1a_9d.rom", 0x04000, 0x5a672942, BRF_ESS | BRF_PRG }, // 7 + + { "2a_15b.rom", 0x04000, 0x604c3b11, BRF_ESS | BRF_PRG }, // 8 Z80 Program Code + { "dg.12", 0x04000, 0x9e9b3808, BRF_ESS | BRF_PRG }, // 9 + { "2a_18b.rom", 0x04000, 0x302dc0ab, BRF_ESS | BRF_PRG }, // 10 + + { "2a_16b.rom", 0x02000, 0x591a3804, BRF_GRA }, // 11 Chars + + { "1a_15f.rom", 0x08000, 0x984a597f, BRF_GRA }, // 12 Tiles + { "1a_17f.rom", 0x08000, 0x30e297ff, BRF_GRA }, // 13 + + { "2a_6e.rom", 0x04000, 0xbcf7740b, BRF_GRA }, // 14 Sprites + { "2a_7e.rom", 0x04000, 0xa70b565c, BRF_GRA }, // 15 + { "2a_6g.rom", 0x04000, 0x4a9ec3e6, BRF_GRA }, // 16 + { "2a_7g.rom", 0x04000, 0x450749fc, BRF_GRA }, // 17 + + { "tc1a_10f.bin", 0x00100, 0xce07c544, BRF_GRA }, // 18 PROMs + { "tc1a_11f.bin", 0x00100, 0x566d323a, BRF_GRA }, // 19 + { "tc1a_12f.bin", 0x00100, 0x7ea63946, BRF_GRA }, // 20 + { "tc2a_2g.bin", 0x00100, 0x08609bad, BRF_GRA }, // 21 + + { "tc2a_4e.bin", 0x00100, 0x2c43991f, BRF_GRA }, // 22 Sprite Palette Bank +}; + +STD_ROM_PICK(Drva) +STD_ROM_FN(Drva) + +static struct BurnRomInfo DrvnRomDesc[] = { + { "1a_4b.rom", 0x04000, 0x76f17479, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "1a_4d.rom", 0x04000, 0x8119f06e, BRF_ESS | BRF_PRG }, // 1 + { "1a_6b.rom", 0x04000, 0xba4b5822, BRF_ESS | BRF_PRG }, // 2 + { "1a_6d.rom", 0x04000, 0xca4852f6, BRF_ESS | BRF_PRG }, // 3 + { "1a_7b.rom", 0x04000, 0xd0771bba, BRF_ESS | BRF_PRG }, // 4 + { "1a_7d.rom", 0x04000, 0x029d59d9, BRF_ESS | BRF_PRG }, // 5 + { "1a_9b.rom", 0x04000, 0x69227b56, BRF_ESS | BRF_PRG }, // 6 + { "1a_9d.rom", 0x04000, 0x5a672942, BRF_ESS | BRF_PRG }, // 7 + + { "tc2a_15b.bin", 0x04000, 0x790ddfa9, BRF_ESS | BRF_PRG }, // 8 Z80 Program Code + { "tc2a_17b.bin", 0x04000, 0xd4531113, BRF_ESS | BRF_PRG }, // 9 + + { "2a_16b.rom", 0x02000, 0x591a3804, BRF_GRA }, // 10 Chars + + { "1a_15f.rom", 0x08000, 0x984a597f, BRF_GRA }, // 11 Tiles + { "1a_17f.rom", 0x08000, 0x30e297ff, BRF_GRA }, // 12 + + { "2a_6e.rom", 0x04000, 0xbcf7740b, BRF_GRA }, // 13 Sprites + { "2a_7e.rom", 0x04000, 0xa70b565c, BRF_GRA }, // 14 + { "2a_6g.rom", 0x04000, 0x4a9ec3e6, BRF_GRA }, // 15 + { "2a_7g.rom", 0x04000, 0x450749fc, BRF_GRA }, // 16 + + { "tc1a_10f.bin", 0x00100, 0xce07c544, BRF_GRA }, // 17 PROMs + { "tc1a_11f.bin", 0x00100, 0x566d323a, BRF_GRA }, // 18 + { "tc1a_12f.bin", 0x00100, 0x7ea63946, BRF_GRA }, // 19 + { "tc2a_2g.bin", 0x00100, 0x08609bad, BRF_GRA }, // 20 + + { "tc2a_4e.bin", 0x00100, 0x2c43991f, BRF_GRA }, // 21 Sprite Palette Bank +}; + +STD_ROM_PICK(Drvn) +STD_ROM_FN(Drvn) + +static struct BurnRomInfo AmazonRomDesc[] = { + { "11.4d", 0x08000, 0x6c7f85c5, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "9.4b", 0x08000, 0xe1b7a989, BRF_ESS | BRF_PRG }, // 1 + { "12.6d", 0x08000, 0x4de8a3ee, BRF_ESS | BRF_PRG }, // 2 + { "10.6b", 0x08000, 0xd86bad81, BRF_ESS | BRF_PRG }, // 3 + + { "1.15b", 0x04000, 0x55a8b5e7, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code + { "2.17b", 0x04000, 0x427a7cca, BRF_ESS | BRF_PRG }, // 5 + { "3.18b", 0x04000, 0xb8cceaf7, BRF_ESS | BRF_PRG }, // 6 + + { "8.16g", 0x02000, 0x0cec8644, BRF_GRA }, // 7 Chars + + { "13.15f", 0x08000, 0x415ff4d9, BRF_GRA }, // 8 Tiles + { "14.17f", 0x08000, 0x492b5c48, BRF_GRA }, // 9 + { "15.18f", 0x08000, 0xb1ac0b9d, BRF_GRA }, // 10 + + { "4.6e", 0x04000, 0xf77ced7a, BRF_GRA }, // 11 Sprites + { "5.7e", 0x04000, 0x16ef1465, BRF_GRA }, // 12 + { "6.6g", 0x04000, 0x936ec941, BRF_GRA }, // 13 + { "7.7g", 0x04000, 0x66dd718e, BRF_GRA }, // 14 + + { "clr.10f", 0x00100, 0x6440b341, BRF_GRA }, // 15 PROMs + { "clr.11f", 0x00100, 0x271e947f, BRF_GRA }, // 16 + { "clr.12f", 0x00100, 0x7d38621b, BRF_GRA }, // 17 + { "2g", 0x00100, 0x44ca16b9, BRF_GRA }, // 18 + + { "4e", 0x00100, 0x035f2c7b, BRF_GRA }, // 19 Sprite Palette Bank + + { "16.18g", 0x02000, 0x1d8d592b, BRF_OPT }, // 20 Unknown +}; + +STD_ROM_PICK(Amazon) +STD_ROM_FN(Amazon) + +static struct BurnRomInfo AmatelasRomDesc[] = { + { "a11.4d", 0x08000, 0x3d226d0b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "a9.4b", 0x08000, 0xe2a0d21d, BRF_ESS | BRF_PRG }, // 1 + { "a12.6d", 0x08000, 0xe6607c51, BRF_ESS | BRF_PRG }, // 2 + { "a10.6b", 0x08000, 0xdbc1f1b4, BRF_ESS | BRF_PRG }, // 3 + + { "1.15b", 0x04000, 0x55a8b5e7, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code + { "2.17b", 0x04000, 0x427a7cca, BRF_ESS | BRF_PRG }, // 5 + { "3.18b", 0x04000, 0xb8cceaf7, BRF_ESS | BRF_PRG }, // 6 + + { "a8.16g", 0x02000, 0xaeba2102, BRF_GRA }, // 7 Chars + + { "13.15f", 0x08000, 0x415ff4d9, BRF_GRA }, // 8 Tiles + { "14.17f", 0x08000, 0x492b5c48, BRF_GRA }, // 9 + { "15.18f", 0x08000, 0xb1ac0b9d, BRF_GRA }, // 10 + + { "4.6e", 0x04000, 0xf77ced7a, BRF_GRA }, // 11 Sprites + { "a5.7e", 0x04000, 0x5fbf9a16, BRF_GRA }, // 12 + { "6.6g", 0x04000, 0x936ec941, BRF_GRA }, // 13 + { "7.7g", 0x04000, 0x66dd718e, BRF_GRA }, // 14 + + { "clr.10f", 0x00100, 0x6440b341, BRF_GRA }, // 15 PROMs + { "clr.11f", 0x00100, 0x271e947f, BRF_GRA }, // 16 + { "clr.12f", 0x00100, 0x7d38621b, BRF_GRA }, // 17 + { "2g", 0x00100, 0x44ca16b9, BRF_GRA }, // 18 + + { "4e", 0x00100, 0x035f2c7b, BRF_GRA }, // 19 Sprite Palette Bank + + { "16.18g", 0x02000, 0x1d8d592b, BRF_OPT }, // 20 Unknown +}; + +STD_ROM_PICK(Amatelas) +STD_ROM_FN(Amatelas) + +static struct BurnRomInfo HorekidRomDesc[] = { + { "horekid.03", 0x08000, 0x90ec840f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "horekid.01", 0x08000, 0xa282faf8, BRF_ESS | BRF_PRG }, // 1 + { "horekid.04", 0x08000, 0x375c0c50, BRF_ESS | BRF_PRG }, // 2 + { "horekid.02", 0x08000, 0xee7d52bb, BRF_ESS | BRF_PRG }, // 3 + + { "horekid.09", 0x04000, 0x49cd3b81, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code + { "horekid.10", 0x04000, 0xc1eaa938, BRF_ESS | BRF_PRG }, // 5 + { "horekid.11", 0x04000, 0x0a2bc702, BRF_ESS | BRF_PRG }, // 6 + + { "horekid.16", 0x02000, 0x104b77cc, BRF_GRA }, // 7 Chars + + { "horekid.05", 0x08000, 0xda25ae10, BRF_GRA }, // 8 Tiles + { "horekid.06", 0x08000, 0x616e4321, BRF_GRA }, // 9 + { "horekid.07", 0x08000, 0x8c7d2be2, BRF_GRA }, // 10 + { "horekid.08", 0x08000, 0xa0066b02, BRF_GRA }, // 11 + + { "horekid.12", 0x08000, 0xa3caa07a, BRF_GRA }, // 12 Sprites + { "horekid.13", 0x08000, 0x0e48ff8e, BRF_GRA }, // 13 + { "horekid.14", 0x08000, 0xe300747a, BRF_GRA }, // 14 + { "horekid.15", 0x08000, 0x51105741, BRF_GRA }, // 15 + + { "kid_prom.10f", 0x00100, 0xca13ce23, BRF_GRA }, // 16 PROMs + { "kid_prom.11f", 0x00100, 0xfb44285a, BRF_GRA }, // 17 + { "kid_prom.12f", 0x00100, 0x40d41237, BRF_GRA }, // 18 + { "kid_prom.2g", 0x00100, 0x4b9be0ed, BRF_GRA }, // 19 + + { "kid_prom.4e", 0x00100, 0xe4fb54ee, BRF_GRA }, // 20 Sprite Palette Bank + + { "horekid.17", 0x02000, 0x1d8d592b, BRF_OPT }, // 21 Unknown +}; + +STD_ROM_PICK(Horekid) +STD_ROM_FN(Horekid) + +static struct BurnRomInfo HorekidbRomDesc[] = { + { "knhhd5", 0x08000, 0x786619c7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "knhhd7", 0x08000, 0x3bbb475b, BRF_ESS | BRF_PRG }, // 1 + { "horekid.04", 0x08000, 0x375c0c50, BRF_ESS | BRF_PRG }, // 2 + { "horekid.02", 0x08000, 0xee7d52bb, BRF_ESS | BRF_PRG }, // 3 + + { "horekid.09", 0x04000, 0x49cd3b81, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code + { "horekid.10", 0x04000, 0xc1eaa938, BRF_ESS | BRF_PRG }, // 5 + { "horekid.11", 0x04000, 0x0a2bc702, BRF_ESS | BRF_PRG }, // 6 + + { "horekid.16", 0x02000, 0x104b77cc, BRF_GRA }, // 7 Chars + + { "horekid.05", 0x08000, 0xda25ae10, BRF_GRA }, // 8 Tiles + { "horekid.06", 0x08000, 0x616e4321, BRF_GRA }, // 9 + { "horekid.07", 0x08000, 0x8c7d2be2, BRF_GRA }, // 10 + { "horekid.08", 0x08000, 0xa0066b02, BRF_GRA }, // 11 + + { "horekid.12", 0x08000, 0xa3caa07a, BRF_GRA }, // 12 Sprites + { "horekid.13", 0x08000, 0x0e48ff8e, BRF_GRA }, // 13 + { "horekid.14", 0x08000, 0xe300747a, BRF_GRA }, // 14 + { "horekid.15", 0x08000, 0x51105741, BRF_GRA }, // 15 + + { "kid_prom.10f", 0x00100, 0xca13ce23, BRF_GRA }, // 16 PROMs + { "kid_prom.11f", 0x00100, 0xfb44285a, BRF_GRA }, // 17 + { "kid_prom.12f", 0x00100, 0x40d41237, BRF_GRA }, // 18 + { "kid_prom.2g", 0x00100, 0x4b9be0ed, BRF_GRA }, // 19 + + { "kid_prom.4e", 0x00100, 0xe4fb54ee, BRF_GRA }, // 20 Sprite Palette Bank + + { "horekid.17", 0x02000, 0x1d8d592b, BRF_OPT }, // 21 Unknown +}; + +STD_ROM_PICK(Horekidb) +STD_ROM_FN(Horekidb) + +static struct BurnRomInfo BoobhackRomDesc[] = { + { "1-c.bin", 0x08000, 0x786619c7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "1-b.bin", 0x08000, 0x3bbb475b, BRF_ESS | BRF_PRG }, // 1 + { "1-d.bin", 0x08000, 0x375c0c50, BRF_ESS | BRF_PRG }, // 2 + { "1-a.bin", 0x08000, 0xee7d52bb, BRF_ESS | BRF_PRG }, // 3 + + { "1-i.bin", 0x04000, 0x49cd3b81, BRF_ESS | BRF_PRG }, // 4 Z80 Program Code + { "1-j.bin", 0x04000, 0xc1eaa938, BRF_ESS | BRF_PRG }, // 5 + { "1-k.bin", 0x04000, 0x0a2bc702, BRF_ESS | BRF_PRG }, // 6 + + { "1-p.bin", 0x02000, 0x104b77cc, BRF_GRA }, // 7 Chars + + { "1-e.bin", 0x08000, 0xda25ae10, BRF_GRA }, // 8 Tiles + { "1-f.bin", 0x08000, 0x616e4321, BRF_GRA }, // 9 + { "1-g.bin", 0x08000, 0x8c7d2be2, BRF_GRA }, // 10 + { "1-h.bin", 0x08000, 0xa0066b02, BRF_GRA }, // 11 + + { "1-l.bin", 0x08000, 0xa3caa07a, BRF_GRA }, // 12 Sprites + { "1-m.bin", 0x08000, 0x15b6cbdf, BRF_GRA }, // 13 + { "1-n.bin", 0x08000, 0xe300747a, BRF_GRA }, // 14 + { "1-o.bin", 0x08000, 0xcddc6a6c, BRF_GRA }, // 15 + + { "kid_prom.10f", 0x00100, 0xca13ce23, BRF_GRA }, // 16 PROMs + { "kid_prom.11f", 0x00100, 0xfb44285a, BRF_GRA }, // 17 + { "kid_prom.12f", 0x00100, 0x40d41237, BRF_GRA }, // 18 + { "kid_prom.2g", 0x00100, 0x4b9be0ed, BRF_GRA }, // 19 + + { "kid_prom.4e", 0x00100, 0xe4fb54ee, BRF_GRA }, // 20 Sprite Palette Bank +}; + +STD_ROM_PICK(Boobhack) +STD_ROM_FN(Boobhack) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x020000; + DrvZ80Rom = Next; Next += 0x00c000; + DrvProms = Next; Next += 0x000400; + DrvSpritePalBank = Next; Next += 0x000100; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x001000; + DrvSpriteRam = Next; Next += 0x002000; + DrvBgVideoRam = Next; Next += 0x001000; + DrvFgVideoRam = Next; Next += 0x001000; + DrvZ80Ram = Next; Next += 0x001000; + + RamEnd = Next; + + DrvChars = Next; Next += 0x100 * 8 * 8; + DrvTiles = Next; Next += 0x400 * 16 * 16; + DrvSprites = Next; Next += 0x400 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x1110 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + if (DrvUseYM2203) { + BurnYM2203Reset(); + } else { + BurnYM3526Reset(); + } + ZetClose(); + + DACReset(); + + DrvScrollX = 0; + DrvScrollY = 0; + DrvDisableBg = 0; + DrvFlipScreen = 0; + DrvSoundLatch = 0; + AmazonProtCmd = 0; + memset(AmazonProtReg, 0, 6); + + return 0; +} + +UINT8 __fastcall Terracre68KReadByte(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Terracre68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Terracre68KReadWord(UINT32 a) +{ + switch (a) { + case 0x024000: { + return DrvInput[0]; + } + + case 0x024002: { + return DrvInput[1]; + } + + case 0x024004: { + return (DrvInput[2] | DrvDip[0]) << 8; + } + + case 0x024006: { + return (DrvDip[2] << 8) | DrvDip[1]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Terracre68KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x026000: { + DrvFlipScreen = d; + return; + } + + case 0x026002: { + DrvScrollX = d & 0x3ff; + DrvDisableBg = (d & 0x2000) ? 1 : 0; + return; + } + + case 0x026004: { + DrvScrollY = d & 0x1ff; + return; + } + + case 0x02600a: { + // ??? + return; + } + + case 0x02600c: { + DrvSoundLatch = ((d & 0x7f) << 1) | 1; + return; + } + + case 0x02600e: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Amazon68KReadByte(UINT32 a) +{ + switch (a) { + case 0x070001: { + INT32 Offset = AmazonProtReg[2]; + if (Offset <= 0x56) { + UINT16 Data; + Data = AmazonProtDataPtr[Offset >> 1]; + if (Offset & 0x01) return Data & 0xff; + return Data >> 8; + } + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Amazon68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x070001: { + if (AmazonProtCmd >= 32 && AmazonProtCmd <= 0x37) { + AmazonProtReg[AmazonProtCmd - 0x32] = d; + } + return; + } + + case 0x070003: { + AmazonProtCmd = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Amazon68KReadWord(UINT32 a) +{ + switch (a) { + case 0x044000: { + if (DrvIsHorekid) { + return (DrvDip[2] << 8) | DrvDip[1]; + } + return DrvInput[0]; + } + + case 0x044002: { + if (DrvIsHorekid) { + return (DrvInput[2] | DrvDip[0]) << 8; + } + return DrvInput[1]; + } + + case 0x044004: { + if (DrvIsHorekid) { + return DrvInput[1]; + } + return (DrvInput[2] | DrvDip[0]) << 8; + } + + case 0x044006: { + if (DrvIsHorekid) { + return DrvInput[0]; + } + return (DrvDip[2] << 8) | DrvDip[1]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Amazon68KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x046000: { + DrvFlipScreen = d; + return; + } + + case 0x046002: { + DrvScrollX = d & 0x3ff; + DrvDisableBg = (d & 0x2000) ? 1 : 0; + return; + } + + case 0x046004: { + DrvScrollY = d & 0x1ff; + return; + } + + case 0x04600a: { + // ??? + return; + } + + case 0x04600c: { + DrvSoundLatch = ((d & 0x7f) << 1) | 1; + return; + } + + case 0x04600e: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall TerracreZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x04: { + DrvSoundLatch = 0; + return 0; + } + + case 0x06: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall TerracreZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + BurnYM3526Write(0, d); + return; + } + + case 0x01: { + BurnYM3526Write(1, d); + return; + } + + case 0x02: { + DACSignedWrite(0, d); + return; + } + + case 0x03: { + DACSignedWrite(1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +void __fastcall TerracreYM2203Z80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0x01: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0x02: { + DACSignedWrite(0, d); + return; + } + + case 0x03: { + DACSignedWrite(1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Port Write => %02X, %02X\n"), a, d); + } + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000; +} + +static INT32 TerracreSyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (4000000.0000 / (nBurnFPS / 100.0000)))); +} + +static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 CharXOffsets[8] = { 4, 0, 12, 8, 20, 16, 28, 24 }; +static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 TileXOffsets[16] = { 4, 0, 12, 8, 20, 16, 28, 24, 36, 32, 44, 40, 52, 48, 60, 56 }; +static INT32 TileYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; +static INT32 SpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 SpriteXOffsets[16] = { 4, 0, RGN_FRAC(0x10000,1,2)+4,RGN_FRAC(0x10000,1,2)+0, 12, 8, RGN_FRAC(0x10000,1,2)+12, RGN_FRAC(0x10000,1,2)+8, 20, 16, RGN_FRAC(0x10000,1,2)+20, RGN_FRAC(0x10000,1,2)+16, 28, 24, RGN_FRAC(0x10000,1,2)+28, RGN_FRAC(0x10000,1,2)+24 }; +static INT32 HorekidSpriteXOffsets[16] = { 4, 0, RGN_FRAC(0x20000,1,2)+4,RGN_FRAC(0x20000,1,2)+0, 12, 8, RGN_FRAC(0x20000,1,2)+12, RGN_FRAC(0x20000,1,2)+8, 20, 16, RGN_FRAC(0x20000,1,2)+20, RGN_FRAC(0x20000,1,2)+16, 28, 24, RGN_FRAC(0x20000,1,2)+28, RGN_FRAC(0x20000,1,2)+24 }; +static INT32 SpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; + +static INT32 DrvInit() +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + if (LoadRomsFunction()) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x01ffff, SM_ROM); + SekMapMemory(DrvSpriteRam , 0x020000, 0x021fff, SM_RAM); + SekMapMemory(DrvBgVideoRam , 0x022000, 0x022fff, SM_RAM); +// SekMapMemory(Drv68KRam , 0x023000, 0x023fff, SM_RAM); + SekMapMemory(DrvFgVideoRam , 0x028000, 0x0287ff, SM_RAM); + SekSetReadWordHandler(0, Terracre68KReadWord); + SekSetWriteWordHandler(0, Terracre68KWriteWord); + SekSetReadByteHandler(0, Terracre68KReadByte); + SekSetWriteByteHandler(0, Terracre68KWriteByte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetSetInHandler(TerracreZ80PortRead); + if (DrvUseYM2203) { + ZetSetOutHandler(TerracreYM2203Z80PortWrite); + } else { + ZetSetOutHandler(TerracreZ80PortWrite); + } + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom); + ZetMapArea(0xc000, 0xcfff, 0, DrvZ80Ram); + ZetMapArea(0xc000, 0xcfff, 1, DrvZ80Ram); + ZetMapArea(0xc000, 0xcfff, 2, DrvZ80Ram); + ZetClose(); + + if (DrvUseYM2203) { + BurnYM2203Init(1, 4000000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); + } else { + BurnYM3526Init(4000000, NULL, &DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3526(4000000); + BurnYM3526SetRoute(BURN_SND_YM3526_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + } + + DACInit(0, 0, 1, TerracreSyncDAC); + DACInit(1, 0, 1, TerracreSyncDAC); + DACSetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + DACSetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvRecalcPal = 1; + + DrvDoReset(); + + return 0; +} + +static INT32 DrvAmazonInit() +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + if (LoadRomsFunction()) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x01ffff, SM_ROM); + SekMapMemory(DrvSpriteRam , 0x040000, 0x040fff, SM_RAM); + SekMapMemory(DrvBgVideoRam , 0x042000, 0x042fff, SM_RAM); + SekMapMemory(DrvFgVideoRam , 0x050000, 0x050fff, SM_RAM); + SekSetReadWordHandler(0, Amazon68KReadWord); + SekSetWriteWordHandler(0, Amazon68KWriteWord); + SekSetReadByteHandler(0, Amazon68KReadByte); + SekSetWriteByteHandler(0, Amazon68KWriteByte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetSetInHandler(TerracreZ80PortRead); + ZetSetOutHandler(TerracreZ80PortWrite); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom); + ZetMapArea(0xc000, 0xcfff, 0, DrvZ80Ram); + ZetMapArea(0xc000, 0xcfff, 1, DrvZ80Ram); + ZetMapArea(0xc000, 0xcfff, 2, DrvZ80Ram); + ZetClose(); + + BurnYM3526Init(4000000, NULL, &DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3526(4000000); + BurnYM3526SetRoute(BURN_SND_YM3526_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + DACInit(0, 0, 1, TerracreSyncDAC); + DACInit(1, 0, 1, TerracreSyncDAC); + DACSetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + DACSetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvRecalcPal = 1; + + DrvDoReset(); + + return 0; +} + +static INT32 TerracreLoadRoms() +{ + INT32 nRet; + + DrvTempRom = (UINT8 *)BurnMalloc(0x10000); + + nRet = BurnLoadRom(Drv68KRom + 0x000000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000001, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x010000, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x010001, 3, 2); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x004000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x008000, 6, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 9, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvTiles); + + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c000, 13, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + nRet = BurnLoadRom(DrvProms + 0x00000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00100, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00200, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00300, 17, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvSpritePalBank , 18, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 TerracreoLoadRoms() +{ + INT32 nRet; + + DrvTempRom = (UINT8 *)BurnMalloc(0x10000); + + nRet = BurnLoadRom(Drv68KRom + 0x000000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000001, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x008000, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x008001, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x010000, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x010001, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x018000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x018001, 7, 2); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x004000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x008000, 10, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 13, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvTiles); + + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c000, 17, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + nRet = BurnLoadRom(DrvProms + 0x00000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00100, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00200, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00300, 21, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvSpritePalBank , 22, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 TerracrenLoadRoms() +{ + INT32 nRet; + + DrvTempRom = (UINT8 *)BurnMalloc(0x10000); + + nRet = BurnLoadRom(Drv68KRom + 0x000000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000001, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x008000, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x008001, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x010000, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x010001, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x018000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x018001, 7, 2); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x004000, 9, 1); if (nRet != 0) return 1; + memset(DrvZ80Rom + 0x8000, 0xff, 0x4000); + + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 12, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvTiles); + + memset(DrvTempRom, 0, 0x10000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c000, 16, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + nRet = BurnLoadRom(DrvProms + 0x00000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00100, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00200, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00300, 20, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvSpritePalBank , 21, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 AmazonLoadRoms() +{ + INT32 nRet; + + DrvTempRom = (UINT8 *)BurnMalloc(0x20000); + + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x010001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x010000, 3, 2); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x004000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x008000, 6, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0, 0x20000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0, 0x20000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 10, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvTiles); + + memset(DrvTempRom, 0, 0x20000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x04000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c000, 14, 1); if (nRet != 0) return 1; + GfxDecode(0x200, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + nRet = BurnLoadRom(DrvProms + 0x00000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00100, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00200, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00300, 18, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvSpritePalBank , 19, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 HorekidLoadRoms() +{ + INT32 nRet; + + DrvTempRom = (UINT8 *)BurnMalloc(0x20000); + + nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x010001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x010000, 3, 2); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvZ80Rom + 0x000000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x004000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom + 0x008000, 6, 1); if (nRet != 0) return 1; + + memset(DrvTempRom, 0, 0x20000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + GfxDecode(0x100, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + memset(DrvTempRom, 0, 0x20000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x18000, 11, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, DrvTempRom, DrvTiles); + + memset(DrvTempRom, 0, 0x20000); + nRet = BurnLoadRom(DrvTempRom + 0x00000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x18000, 15, 1); if (nRet != 0) return 1; + GfxDecode(0x400, 4, 16, 16, SpritePlaneOffsets, HorekidSpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + nRet = BurnLoadRom(DrvProms + 0x00000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00100, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00200, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvProms + 0x00300, 19, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(DrvSpritePalBank , 20, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static UINT16 AmazonProtData[] = { + 0x0000, 0x5000, 0x5341, 0x4b45, 0x5349, 0x4755, 0x5245, + 0x0000, 0x4000, 0x0e4b, 0x4154, 0x5544, 0x4f4e, 0x0e0e, + 0x0000, 0x3000, 0x414e, 0x4b41, 0x4b45, 0x5544, 0x4f4e, + 0x0000, 0x2000, 0x0e0e, 0x4b49, 0x5455, 0x4e45, 0x0e0e, + 0x0000, 0x1000, 0x0e4b, 0x414b, 0x4553, 0x4f42, 0x410e, + + 0x4ef9, 0x0000, 0x62fa, 0x0000, 0x4ef9, 0x0000, 0x805E, 0x0000, 0xc800 +}; + +static UINT16 AmatelasProtData[] = { + 0x0000, 0x5000, 0x5341, 0x4b45, 0x5349, 0x4755, 0x5245, + 0x0000, 0x4000, 0x0e4b, 0x4154, 0x5544, 0x4f4e, 0x0e0e, + 0x0000, 0x3000, 0x414e, 0x4b41, 0x4b45, 0x5544, 0x4f4e, + 0x0000, 0x2000, 0x0e0e, 0x4b49, 0x5455, 0x4e45, 0x0e0e, + 0x0000, 0x1000, 0x0e4b, 0x414b, 0x4553, 0x4f42, 0x410e, + + 0x4ef9, 0x0000, 0x632e, 0x0000, 0x4ef9, 0x0000, 0x80C2, 0x0000, 0x6100 +}; + +static UINT16 HorekidProtData[] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + + 0x4e75, 0x4e75, 0x4e75, 0x4e75, 0x4e75, 0x4e75, 0x4e75, 0x4e75, 0x1800 +}; + +static INT32 TerracreInit() +{ + LoadRomsFunction = TerracreLoadRoms; + + return DrvInit(); +} + +static INT32 TerracreoInit() +{ + LoadRomsFunction = TerracreoLoadRoms; + + return DrvInit(); +} + +static INT32 TerracrenInit() +{ + LoadRomsFunction = TerracrenLoadRoms; + DrvUseYM2203 = 1; + + return DrvInit(); +} + +static INT32 AmazonInit() +{ + LoadRomsFunction = AmazonLoadRoms; + AmazonProtDataPtr = AmazonProtData; + + return DrvAmazonInit(); +} + +static INT32 AmatelasInit() +{ + LoadRomsFunction = AmazonLoadRoms; + AmazonProtDataPtr = AmatelasProtData; + + return DrvAmazonInit(); +} + +static INT32 HorekidInit() +{ + LoadRomsFunction = HorekidLoadRoms; + AmazonProtDataPtr = HorekidProtData; + DrvIsHorekid = 1; + + return DrvAmazonInit(); +} + +static INT32 DrvExit() +{ + SekExit(); + ZetExit(); + + if (DrvUseYM2203) { + BurnYM2203Exit(); + } else { + BurnYM3526Exit(); + } + DACExit(); + + GenericTilesExit(); + + BurnFree(Mem); + + DrvScrollX = 0; + DrvScrollY = 0; + DrvDisableBg = 0; + DrvFlipScreen = 0; + DrvSoundLatch = 0; + AmazonProtCmd = 0; + memset(AmazonProtReg, 0, 6); + + DrvUseYM2203 = 0; + DrvIsHorekid = 0; + + LoadRomsFunction = NULL; + AmazonProtDataPtr = NULL; + + return 0; +} + +static inline UINT8 pal4bit(UINT8 bits) +{ + bits &= 0x0f; + return (bits << 4) | bits; +} + +static void DrvCalcPalette() +{ + UINT32 PalLookup[0x100]; + INT32 i; + + for (i = 0; i < 0x100; i++) { + INT32 r = pal4bit(DrvProms[i + 0x000]); + INT32 g = pal4bit(DrvProms[i + 0x100]); + INT32 b = pal4bit(DrvProms[i + 0x200]); + + PalLookup[i] = BurnHighCol(r, g, b, 0); + } + + for (i = 0; i < 0x10; i++) { + DrvPalette[i] = PalLookup[i]; + } + + for (i = 0; i < 0x100; i++) { + UINT8 ctabentry; + + if (i & 0x08) { + ctabentry = 0xc0 | (i & 0x0f) | ((i & 0xc0) >> 2); + } else { + ctabentry = 0xc0 | (i & 0x0f) | ((i & 0x30) >> 0); + } + + DrvPalette[0x10 + i] = PalLookup[ctabentry]; + } + + for (i = 0; i < 0x1000; i++) { + UINT8 ctabentry; + INT32 i_swapped = ((i & 0x0f) << 8) | ((i & 0xff0) >> 4); + + if (i & 0x80) { + ctabentry = 0x80 | ((i & 0x0c) << 2) | (DrvProms[0x300 + (i >> 4)] & 0x0f); + } else { + ctabentry = 0x80 | ((i & 0x03) << 4) | (DrvProms[0x300 + (i >> 4)] & 0x0f); + } + + DrvPalette[0x110 + i_swapped] = PalLookup[ctabentry]; + } + + DrvRecalcPal = 0; +} + +static void DrvRenderBgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex; + + UINT16 *VideoRam = (UINT16*)DrvBgVideoRam; + + for (mx = 0; mx < 32; mx++) { + for (my = 0; my < 64; my++) { + TileIndex = (my * 32) + mx; + Code = VideoRam[TileIndex]; + Colour = (Code >> 11) + (0x10 >> 4); + Code &= 0x3ff; + + y = 16 * mx; + x = 16 * my; + + x -= DrvScrollX; + y -= DrvScrollY; + if (x < -16) x += 1024; + if (y < -16) y += 512; + + if (DrvFlipScreen) { + x = 240 - x; + y = 240 - y; + } + + y -= 16; + + if (DrvFlipScreen) { + if (x > 16 && x < 240 && y > 16 && y < 208) { + Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, DrvTiles); + } else { + Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvTiles); + } + } else { + if (x > 16 && x < 240 && y > 16 && y < 208) { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, DrvTiles); + } + } + } + } +} + +static void DrvRenderFgLayer() +{ + INT32 mx, my, Code, x, y, TileIndex; + + UINT16 *VideoRam = (UINT16*)DrvFgVideoRam; + + for (mx = 0; mx < 32; mx++) { + for (my = 0; my < 64; my++) { + TileIndex = (my * 32) + mx; + Code = VideoRam[TileIndex] & 0xff; + + y = 8 * mx; + x = 8 * my; + + if (DrvFlipScreen) { + x = 248 - x; + y = 248 - y; + } + + y -= 16; + + if (DrvFlipScreen) { + if (x > 8 && x < 248 && y > 8 && y < 216) { + Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, 0, 4, 0x0f, 0, DrvChars); + } else { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, 0, 4, 0x0f, 0, DrvChars); + } + } else { + if (x > 8 && x < 248 && y > 8 && y < 216) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, 0, 4, 0x0f, 0, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, 0, 4, 0x0f, 0, DrvChars); + } + } + } + } +} + +static void DrawSprites() +{ + UINT16 *pSource = (UINT16*)DrvSpriteRam; + INT32 TransparentPen = 0x00; + if (DrvIsHorekid) TransparentPen = 0x0f; + + for (INT32 i = 0; i < 0x200; i += 8) { + INT32 Tile = pSource[1] & 0xff; + INT32 Attrs = pSource[2]; + INT32 xFlip = Attrs & 0x04; + INT32 yFlip = Attrs & 0x08; + INT32 Colour = (Attrs & 0xf0) >> 4; + INT32 sx = (pSource[3] & 0xff) - 0x80 + 256 * (Attrs & 1); + INT32 sy = 240 - (pSource[0] & 0xff); + + if (DrvIsHorekid) { + INT32 Bank; + + if (Attrs & 0x02) Tile |= 0x200; + if (Attrs & 0x10) Tile |= 0x100; + + Bank = (Tile & 0xfc) >> 1; + if (Tile & 0x200) Bank |= 0x80; + if (Tile & 0x100) Bank |= 0x01; + + Colour &= 0xe; + Colour += 16 * (DrvSpritePalBank[Bank] & 0x0f); + } else { + if (Attrs & 0x02) Tile |= 0x100; + Colour += 16 * (DrvSpritePalBank[(Tile >> 1) & 0xff] & 0x0f); + } + + Colour += (0x110) >> 4; + + if (DrvFlipScreen) { + sx = 240 - sx; + sy = 240 - sy; + xFlip = !xFlip; + yFlip = !yFlip; + } + + sy -= 16; + + if (sx > 16 && sx < 240 && sy > 16 && sy < 208) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); + } else { + Render16x16Tile_Mask(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Tile, sx, sy, Colour, 4, TransparentPen, 0, DrvSprites); + } + } + } + + pSource += 4; + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + if (DrvRecalcPal) DrvCalcPalette(); + if (nBurnLayer & 0x01 && !DrvDisableBg) DrvRenderBgLayer(); + if (nSpriteEnable & 0x01) DrawSprites(); + if (nBurnLayer & 0x02) DrvRenderFgLayer(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nCyclesTotal[2] = { 8000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + INT32 nInterleave = 100; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + INT32 Z80IRQSlice[9]; + for (INT32 i = 0; i < 9; i++) { + Z80IRQSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 10)); + } + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + SekClose(); + + nCurrentCPU = 1; + ZetOpen(0); + if (DrvUseYM2203) { +#if 0 + // The sound cpu fails to read the latches if we run this here + BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); +#endif + } else { + BurnTimerUpdateYM3526(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + } + for (INT32 j = 0; j < 9; j++) { + if (i == Z80IRQSlice[j]) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + nCyclesDone[1] += ZetRun(4000); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } + } + ZetClose(); + } + + ZetOpen(0); + if (DrvUseYM2203) { + BurnTimerEndFrame(nCyclesTotal[1]); + } else { + BurnTimerEndFrameYM3526(nCyclesTotal[1]); + } + if (pBurnSoundOut) { + if (DrvUseYM2203) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + } else { + BurnYM3526Update(pBurnSoundOut, nBurnSoundLen); + } + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029719; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + if (DrvUseYM2203) { + BurnYM2203Scan(nAction, pnMin); + } else { + BurnYM3526Scan(nAction, pnMin); + } + + DACScan(nAction, pnMin); + + SCAN_VAR(DrvScrollX); + SCAN_VAR(DrvScrollY); + SCAN_VAR(DrvDisableBg); + SCAN_VAR(DrvFlipScreen); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(AmazonProtCmd); + SCAN_VAR(AmazonProtReg); + + if (nAction & ACB_WRITE) { + DrvRecalcPal = 1; + } + } + + return 0; +} + +struct BurnDriver BurnDrvTerracre = { + "terracre", NULL, NULL, NULL, "1985", + "Terra Cresta (YM3526 set 1)\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + TerracreInit, DrvExit, DrvFrame, NULL, DrvScan, + &DrvRecalcPal, 0x1110, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTerracreo = { + "terracreo", "terracre", NULL, NULL, "1985", + "Terra Cresta (YM3526 set 2)\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, DrvoRomInfo, DrvoRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + TerracreoInit, DrvExit, DrvFrame, NULL, DrvScan, + &DrvRecalcPal, 0x1110, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTerracrea = { + "terracrea", "terracre", NULL, NULL, "1985", + "Terra Cresta (YM3526 set 3)\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, DrvaRomInfo, DrvaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + TerracreoInit, DrvExit, DrvFrame, NULL, DrvScan, + &DrvRecalcPal, 0x1110, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTerracren = { + "terracren", "terracre", NULL, NULL, "1985", + "Terra Cresta (YM2203)\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, DrvnRomInfo, DrvnRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + TerracrenInit, DrvExit, DrvFrame, NULL, DrvScan, + &DrvRecalcPal, 0x1110, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAmazon = { + "amazon", NULL, NULL, NULL, "1986", + "Soldier Girl Amazon\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, AmazonRomInfo, AmazonRomName, NULL, NULL, AmazonInputInfo, AmazonDIPInfo, + AmazonInit, DrvExit, DrvFrame, NULL, DrvScan, + &DrvRecalcPal, 0x1110, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvAmatelas = { + "amatelas", "amazon", NULL, NULL, "1986", + "Sei Senshi Amatelass\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, AmatelasRomInfo, AmatelasRomName, NULL, NULL, AmazonInputInfo, AmazonDIPInfo, + AmatelasInit, DrvExit, DrvFrame, NULL, DrvScan, + &DrvRecalcPal, 0x1110, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHorekid = { + "horekid", NULL, NULL, NULL, "1987", + "Kid no Hore Hore Daisakusen\0", NULL, "Nichibutsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, HorekidRomInfo, HorekidRomName, NULL, NULL, HorekidInputInfo, HorekidDIPInfo, + HorekidInit, DrvExit, DrvFrame, NULL, DrvScan, + &DrvRecalcPal, 0x1110, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHorekidb = { + "horekidb", "horekid", NULL, NULL, "1987", + "Kid no Hore Hore Daisakusen (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, HorekidbRomInfo, HorekidbRomName, NULL, NULL, HorekidInputInfo, HorekidDIPInfo, + HorekidInit, DrvExit, DrvFrame, NULL, DrvScan, + &DrvRecalcPal, 0x1110, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvBoobhack = { + "boobhack", "horekid", NULL, NULL, "1987", + "Booby Kids (Italian manufactured graphic hack / bootleg of Kid no Hore Hore Daisakusen (bootleg))\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, BoobhackRomInfo, BoobhackRomName, NULL, NULL, HorekidInputInfo, HorekidDIPInfo, + HorekidInit, DrvExit, DrvFrame, NULL, DrvScan, + &DrvRecalcPal, 0x1110, 224, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_tigeroad.cpp b/src/burn/drv/pre90s/d_tigeroad.cpp index ba61dc2d7..2ef307da0 100644 --- a/src/burn/drv/pre90s/d_tigeroad.cpp +++ b/src/burn/drv/pre90s/d_tigeroad.cpp @@ -1,1434 +1,1432 @@ -// FB Alpha Tiger Road driver module -// Based on MAME driver by Phil Stroffolino -// F1 Dream protection code by Eric Hustvedt - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2203.h" -#include "msm5205.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvSndROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf; -static UINT8 *DrvVidRAM; -static UINT8 *DrvScrollRAM; -static UINT32 *DrvPalette; -static UINT8 *DrvTransMask; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDip[2]; -static UINT8 DrvReset; -static UINT16 DrvInputs[2]; - -static UINT8 *soundlatch; -static UINT8 *soundlatch2; -static UINT8 *flipscreen; -static UINT8 *bgcharbank; -static UINT8 *coin_lockout; - -static INT32 nF1dream = 0; -static INT32 toramich = 0; - -static struct BurnInputInfo TigeroadInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 14, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 8, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 15, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 9, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 11, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 10, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 9, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 8, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, -}; - -STDINPUTINFO(Tigeroad) - -static struct BurnDIPInfo TigeroadDIPList[] = -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x01, "3 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x02, "2 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, - {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, - {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, - {0x11, 0x01, 0x07, 0x04, "1 Coin 4 Credits " }, - {0x11, 0x01, 0x07, 0x03, "1 Coin 6 Credits " }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x08, "3 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x10, "2 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits " }, - {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits " }, - {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits " }, - {0x11, 0x01, 0x38, 0x20, "1 Coin 4 Credits " }, - {0x11, 0x01, 0x38, 0x18, "1 Coin 6 Credits " }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x11, 0x01, 0x40, 0x00, "On" }, - {0x11, 0x01, 0x40, 0x40, "Off" }, - - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x04, 0x00, "Upright" }, - {0x12, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x12, 0x01, 0x18, 0x18, "20000 70000 70000" }, - {0x12, 0x01, 0x18, 0x10, "20000 80000 80000" }, - {0x12, 0x01, 0x18, 0x08, "30000 80000 80000" }, - {0x12, 0x01, 0x18, 0x00, "30000 90000 90000" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x60, 0x20, "Very_Easy" }, - {0x12, 0x01, 0x60, 0x40, "Easy" }, - {0x12, 0x01, 0x60, 0x60, "Normal" }, - {0x12, 0x01, 0x60, 0x00, "Difficult" }, - - {0 , 0xfe, 0 , 2, "Allow_Continue" }, - {0x12, 0x01, 0x80, 0x00, "No" }, - {0x12, 0x01, 0x80, 0x80, "Yes" }, -}; - -STDDIPINFO(Tigeroad) - -static struct BurnDIPInfo ToramichDIPList[] = -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x01, "3 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x02, "2 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, - {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, - {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, - {0x11, 0x01, 0x07, 0x04, "1 Coin 4 Credits " }, - {0x11, 0x01, 0x07, 0x03, "1 Coin 6 Credits " }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x08, "3 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x10, "2 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits " }, - {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits " }, - {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits " }, - {0x11, 0x01, 0x38, 0x20, "1 Coin 4 Credits " }, - {0x11, 0x01, 0x38, 0x18, "1 Coin 6 Credits " }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x11, 0x01, 0x40, 0x00, "On" }, - {0x11, 0x01, 0x40, 0x40, "Off" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x04, 0x00, "Upright" }, - {0x12, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x12, 0x01, 0x08, 0x08, "20000 70000 70000" }, - {0x12, 0x01, 0x08, 0x00, "20000 80000 80000" }, - - {0 , 0xfe, 0 , 2, "Allow Level Select" }, - {0x12, 0x01, 0x10, 0x10, "No" }, - {0x12, 0x01, 0x10, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x60, 0x40, "Easy" }, - {0x12, 0x01, 0x60, 0x60, "Normal" }, - {0x12, 0x01, 0x60, 0x20, "Difficult" }, - {0x12, 0x01, 0x60, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x12, 0x01, 0x80, 0x00, "No" }, - {0x12, 0x01, 0x80, 0x80, "Yes" }, -}; - -STDDIPINFO(Toramich) - -static struct BurnDIPInfo F1dreamDIPList[] = -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xbb, NULL }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x01, "3 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x02, "2 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, - {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, - {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, - {0x11, 0x01, 0x07, 0x04, "1 Coin 4 Credits " }, - {0x11, 0x01, 0x07, 0x03, "1 Coin 6 Credits " }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x08, "3 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x10, "2 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits " }, - {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits " }, - {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits " }, - {0x11, 0x01, 0x38, 0x20, "1 Coin 4 Credits " }, - {0x11, 0x01, 0x38, 0x18, "1 Coin 6 Credits " }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x11, 0x01, 0x40, 0x00, "On" }, - {0x11, 0x01, 0x40, 0x40, "Off" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - {0x12, 0x01, 0x03, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x04, 0x00, "Upright" }, - {0x12, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "F1 Up Point" }, - {0x12, 0x01, 0x18, 0x18, "12" }, - {0x12, 0x01, 0x18, 0x10, "16" }, - {0x12, 0x01, 0x18, 0x08, "18" }, - {0x12, 0x01, 0x18, 0x00, "20" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x12, 0x01, 0x20, 0x20, "Normal" }, - {0x12, 0x01, 0x20, 0x00, "Difficult" }, - - {0 , 0xfe, 0 , 2, "Version" }, - {0x12, 0x01, 0x40, 0x00, "International" }, - {0x12, 0x01, 0x40, 0x40, "Japan" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x12, 0x01, 0x80, 0x00, "No" }, - {0x12, 0x01, 0x80, 0x80, "Yes" }, -}; - -STDDIPINFO(F1dream) - -static void palette_write(INT32 offset) -{ - UINT16 data = *((UINT16 *)(DrvPalRAM + offset + 0x200)); - - UINT8 r,g,b; - - r = (data >> 8) & 0x0f; - g = (data >> 4) & 0x0f; - b = (data >> 0) & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - DrvPalette[offset / 2] = BurnHighCol(r, g, b, 0); -} - -static const UINT16 f1dream_613ea_lookup[16] = { -0x0052, 0x0031, 0x00a7, 0x0043, 0x0007, 0x008a, 0x00b1, 0x0066, 0x009f, 0x00cc, 0x0009, 0x004d, 0x0033, 0x0028, 0x00d0, 0x0025}; - -static const UINT16 f1dream_613eb_lookup[256] = { -0x0001, 0x00b5, 0x00b6, 0x00b6, 0x00b6, 0x00b6, 0x00b6, 0x00b6, 0x00b7, 0x0001, 0x00b8, 0x002f, 0x002f, 0x002f, 0x002f, 0x00b9, -0x00aa, 0x0031, 0x00ab, 0x00ab, 0x00ab, 0x00ac, 0x00ad, 0x00ad, 0x00ae, 0x00af, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x0091, -0x009c, 0x009d, 0x009e, 0x009f, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x009b, 0x0091, -0x00bc, 0x0092, 0x000b, 0x0009, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0073, 0x0001, 0x0098, 0x0099, 0x009a, 0x009b, 0x0091, -0x00bc, 0x007b, 0x000b, 0x0008, 0x0087, 0x0088, 0x0089, 0x008a, 0x007f, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, -0x00bd, 0x007b, 0x000b, 0x0007, 0x007c, 0x007d, 0x007e, 0x0001, 0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, -0x00bc, 0x0070, 0x000b, 0x0006, 0x0071, 0x0072, 0x0073, 0x0001, 0x0074, 0x000d, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, -0x00bc, 0x00ba, 0x000a, 0x0005, 0x0065, 0x0066, 0x0067, 0x0068, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, -0x00bc, 0x0059, 0x0001, 0x0004, 0x005a, 0x005b, 0x0001, 0x005c, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, -0x0014, 0x004d, 0x0001, 0x0003, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0001, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, -0x0014, 0x0043, 0x0001, 0x0002, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00bb, 0x004a, 0x004b, 0x004c, 0x0001, 0x0001, -0x0014, 0x002b, 0x0001, 0x0038, 0x0039, 0x003a, 0x003b, 0x0031, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, 0x0001, -0x0014, 0x002d, 0x0001, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0001, 0x0014, 0x0037, 0x0001, -0x0014, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x0001, 0x0001, 0x0001, 0x002a, 0x002b, 0x002c, -0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001e, 0x001e, 0x001e, 0x001f, 0x0020, -0x000c, 0x000d, 0x000e, 0x0001, 0x000f, 0x0010, 0x0011, 0x0012, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x0013 }; - -static const UINT16 f1dream_17b74_lookup[128] = { -0x0003, 0x0040, 0x0005, 0x0080, 0x0003, 0x0080, 0x0005, 0x00a0, 0x0003, 0x0040, 0x0005, 0x00c0, 0x0003, 0x0080, 0x0005, 0x00e0, -0x0003, 0x0040, 0x0006, 0x0000, 0x0003, 0x0080, 0x0006, 0x0020, 0x0003, 0x0040, 0x0006, 0x0040, 0x0003, 0x0080, 0x0006, 0x0060, -0x0000, 0x00a0, 0x0009, 0x00e0, 0x0000, 0x00e0, 0x000a, 0x0000, 0x0000, 0x00a0, 0x000a, 0x0020, 0x0000, 0x00e0, 0x000a, 0x0040, -0x0000, 0x00a0, 0x000a, 0x0060, 0x0000, 0x00e0, 0x000a, 0x0080, 0x0000, 0x00a0, 0x000a, 0x00a0, 0x0000, 0x00e0, 0x000a, 0x00c0, -0x0003, 0x0040, 0x0005, 0x0080, 0x0003, 0x0080, 0x0005, 0x00a0, 0x0003, 0x0040, 0x0005, 0x00c0, 0x0003, 0x0080, 0x0005, 0x00e0, -0x0003, 0x0040, 0x0006, 0x0000, 0x0003, 0x0080, 0x0006, 0x0020, 0x0003, 0x0040, 0x0006, 0x0040, 0x0003, 0x0080, 0x0006, 0x0060, -0x0000, 0x00a0, 0x0009, 0x00e0, 0x0000, 0x00e0, 0x000a, 0x0000, 0x0000, 0x00a0, 0x000a, 0x0020, 0x0000, 0x00e0, 0x000a, 0x0040, -0x0000, 0x00a0, 0x000a, 0x0060, 0x0000, 0x00e0, 0x000a, 0x0080, 0x0000, 0x00a0, 0x000a, 0x00a0, 0x0000, 0x00e0, 0x000a, 0x00c0 }; - -static const UINT16 f1dream_2450_lookup[32] = { -0x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0, 0x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0, -0x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0, 0x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0 }; - -static void f1dream_protection_w() -{ - INT32 indx; - INT32 value = 255; - INT32 prevpc = SekGetPC(0)-8; - UINT16* ram16 = (UINT16*)Drv68KRAM; - - if (prevpc == 0x244c) - { - indx = ram16[0x3ff0/2]; - ram16[0x3fe6/2] = f1dream_2450_lookup[indx]; - ram16[0x3fe8/2] = f1dream_2450_lookup[++indx]; - ram16[0x3fea/2] = f1dream_2450_lookup[++indx]; - ram16[0x3fec/2] = f1dream_2450_lookup[++indx]; - } - else if (prevpc == 0x613a) - { - if (ram16[0x3ff6/2] < 15) - { - indx = f1dream_613ea_lookup[ram16[0x3ff6/2]] - ram16[0x3ff4/2]; - if (indx > 255) - { - indx <<= 4; - indx += ram16[0x3ff6/2] & 0x00ff; - value = f1dream_613eb_lookup[indx]; - } - } - - ram16[0x3ff2/2] = value; - } - else if (prevpc == 0x17b70) - { - if (ram16[0x3ff0/2] >= 0x04) indx = 128; - else if (ram16[0x3ff0/2] > 0x02) indx = 96; - else if (ram16[0x3ff0/2] == 0x02) indx = 64; - else if (ram16[0x3ff0/2] == 0x01) indx = 32; - else indx = 0; - - indx += ram16[0x3fee/2]; - if (indx < 128) - { - ram16[0x3fe6/2] = f1dream_17b74_lookup[indx]; - ram16[0x3fe8/2] = f1dream_17b74_lookup[++indx]; - ram16[0x3fea/2] = f1dream_17b74_lookup[++indx]; - ram16[0x3fec/2] = f1dream_17b74_lookup[++indx]; - } - else - { - ram16[0x3fe6/2] = 0x00ff; - ram16[0x3fe8/2] = 0x00ff; - ram16[0x3fea/2] = 0x00ff; - ram16[0x3fec/2] = 0x00ff; - } - } - else if ((prevpc == 0x27f8) || (prevpc == 0x511a) || (prevpc == 0x5142) || (prevpc == 0x516a)) - { - *soundlatch = ram16[0x3ffc/2] & 0xff; - } -} - -void __fastcall tigeroad_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0xfe4000: - *flipscreen = data & 0x02; - *bgcharbank = (data & 0x04) >> 2; - *coin_lockout = (~data & 0x30) << 1; - return; - - case 0xfe4002: - if (nF1dream) { - f1dream_protection_w(); - } else { - *soundlatch = data; - } - return; - } -} - -void __fastcall tigeroad_write_word(UINT32 address, UINT16 data) -{ - if (address >= 0xff8200 && address <= 0xff867f) { - *((UINT16*)(DrvPalRAM + (address - 0xff8000))) = data; - - palette_write(address - 0xff8200); - - return; - } - - switch (address) - { - case 0xfe8000: - case 0xfe8002: - *((UINT16 *)(DrvScrollRAM + (address & 2))) = data; - return; - - case 0xfe800e: - // watchdog - return; - } -} - -UINT8 __fastcall tigeroad_read_byte(UINT32 address) -{ - switch (address) - { - case 0xfe4000: - case 0xfe4001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0xfe4002: - case 0xfe4003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0xfe4004: - case 0xfe4005: - return DrvDip[~address & 1]; - } - - return 0; -} - -UINT16 __fastcall tigeroad_read_word(UINT32 address) -{ - switch (address) - { - case 0xfe4000: - return DrvInputs[0]; - - case 0xfe4002: - return DrvInputs[1]; - - case 0xfe4004: - return ((DrvDip[1] << 8) | DrvDip[0]); - } - - return 0; -} - -void __fastcall tigeroad_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8000: - BurnYM2203Write(0, 0, data); - return; - - case 0x8001: - BurnYM2203Write(0, 1, data); - return; - - case 0xa000: - BurnYM2203Write(1, 0, data); - return; - - case 0xa001: - BurnYM2203Write(1, 1, data); - return; - } -} - -void __fastcall tigeroad_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x7f: - *soundlatch2 = data; - return; - } -} - -UINT8 __fastcall tigeroad_sound_read(UINT16 address) -{ - switch (address) - { - case 0x8000: - return BurnYM2203Read(0, 0); - - case 0xa000: - return BurnYM2203Read(1, 0); - - case 0xe000: - return *soundlatch; - } - - return 0; -} - -void __fastcall tigeroad_sample_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x01: - SekOpen(0); - MSM5205ResetWrite(0, (data >> 7) & 1); - MSM5205DataWrite(0, data); - MSM5205VCLKWrite(0, 1); - MSM5205VCLKWrite(0, 0); - SekClose(); - return; - } -} - -UINT8 __fastcall tigeroad_sample_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return *soundlatch2; - } - - return 0; -} - -static void TigeroadIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 TigeroadSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3579545; -} - -static double TigeroadGetTime() -{ - return (double)ZetTotalCycles() / 3579545; -} - -inline static INT32 DrvMSM5205SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)((double)SekTotalCycles() * nSoundRate / 10000000); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - - if (toramich) { - ZetOpen(1); - ZetReset(); - ZetClose(); - - MSM5205Reset(); - } - - if (pBurnSoundOut) { // fix ym2203 junk.. - memset (pBurnSoundOut, 0, nBurnSoundLen); - } - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x008000; - DrvSndROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x020000; - DrvGfxROM1 = Next; Next += 0x200000; - DrvGfxROM2 = Next; Next += 0x100000; - DrvGfxROM3 = Next; Next += 0x008000; - - DrvPalette = (UINT32*)Next; Next += 0x0240 * sizeof(UINT32); - - DrvTransMask = Next; Next += 0x000010; - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x004000; - DrvPalRAM = Next; Next += 0x000800; - DrvVidRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x001400; - DrvSprBuf = Next; Next += 0x000500; - - DrvZ80RAM = Next; Next += 0x000800; - - DrvScrollRAM = Next; Next += 0x000004; - - soundlatch = Next; Next += 0x000001; - soundlatch2 = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - bgcharbank = Next; Next += 0x000001; - coin_lockout = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { ((0x20000 * 8) * 4) + 4, ((0x20000 * 8) * 4) + 0, 4, 0 }; - INT32 XOffs0[32] = { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3, - 64*8+0, 64*8+1, 64*8+2, 64*8+3, 64*8+8+0, 64*8+8+1, 64*8+8+2, 64*8+8+3, - 2*64*8+0, 2*64*8+1, 2*64*8+2, 2*64*8+3, 2*64*8+8+0, 2*64*8+8+1, 2*64*8+8+2, 2*64*8+8+3, - 3*64*8+0, 3*64*8+1, 3*64*8+2, 3*64*8+3, 3*64*8+8+0, 3*64*8+8+1, 3*64*8+8+2, 3*64*8+8+3 }; - INT32 YOffs0[32] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, - 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16, - 16*16, 17*16, 18*16, 19*16, 20*16, 21*16, 22*16, 23*16, - 24*16, 25*16, 26*16, 27*16, 28*16, 29*16, 30*16, 31*16 }; - - INT32 Plane1[4] = { (0x20000*8)*3, (0x20000*8)*2, (0x20000*8)*1, (0x20000*8)*0 }; - INT32 XOffs1[16] = { 0, 1, 2, 3, 4, 5, 6, 7, - 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 }; - INT32 YOffs1[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }; - - - UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x008000); - - GfxDecode(0x0800, 2, 8, 8, Plane0 + 2, XOffs0, YOffs0, 0x080, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x100000); - - GfxDecode(0x0800, 4, 32, 32, Plane0 + 0, XOffs0, YOffs0, 0x800, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x080000); - - GfxDecode(0x1000, 4, 16, 16, Plane1 + 0, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM2); - - for (INT32 i = 0; i < 16; i++) { - DrvTransMask[i] = (0xfe00 >> i) & 1; - } - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit(INT32 (*pInitCallback)()) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (pInitCallback()) return 1; - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvSprRAM, 0xfe0800, 0xfe1bff, SM_RAM); - SekMapMemory(DrvVidRAM, 0xfec000, 0xfec7ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xff8000, 0xff87ff, SM_ROM); - SekMapMemory(Drv68KRAM, 0xffc000, 0xffffff, SM_RAM); - SekSetWriteByteHandler(0, tigeroad_write_byte); - SekSetWriteWordHandler(0, tigeroad_write_word); - SekSetReadByteHandler(0, tigeroad_read_byte); - SekSetReadWordHandler(0, tigeroad_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(tigeroad_sound_write); - ZetSetReadHandler(tigeroad_sound_read); - ZetSetOutHandler(tigeroad_sound_out); - ZetMemEnd(); - ZetClose(); - - if (toramich) { - ZetInit(1); - - ZetOpen(1); - ZetMapArea(0x0000, 0xffff, 0, DrvSndROM); - ZetMapArea(0x0000, 0xffff, 2, DrvSndROM); - ZetSetOutHandler(tigeroad_sample_out); - ZetSetInHandler(tigeroad_sample_in); - ZetMemEnd(); - ZetClose(); - } - - BurnYM2203Init(2, 3579545, &TigeroadIRQHandler, TigeroadSynchroniseStream, TigeroadGetTime, 0); - BurnTimerAttachZet(3579545); - BurnYM2203SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - BurnYM2203SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - - if (toramich) { - MSM5205Init(0, DrvMSM5205SynchroniseStream, 384000, NULL, MSM5205_SEX_4B, 1); - MSM5205SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - } - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - BurnYM2203Exit(); - if (toramich) MSM5205Exit(); - - GenericTilesExit(); - - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - nF1dream = 0; - toramich = 0; - - return 0; -} - -static void draw_sprites() -{ - UINT16 *source = (UINT16*)DrvSprBuf; - - for (INT32 offs = (0x500 - 8) / 2; offs >= 0; offs -=4) - { - INT32 tile_number = source[offs + 0]; - - if (tile_number != 0xfff) { - INT32 attr = source[offs + 1]; - INT32 sy = source[offs + 2] & 0x1ff; - INT32 sx = source[offs + 3] & 0x1ff; - - INT32 flipx = attr & 0x02; - INT32 flipy = attr & 0x01; - INT32 color = (attr >> 2) & 0x0f; - - if (sx > 0x100) sx -= 0x200; - if (sy > 0x100) sy -= 0x200; - - if (*flipscreen) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - sy = (240 - sy) - 16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, tile_number, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, tile_number, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, tile_number, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, tile_number, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); - } - } - } - } -} - -static void draw_32x32_mask_tile(INT32 sx, INT32 sy, INT32 code, INT32 color, INT32 flipx, INT32 flipy) -{ - UINT8 *src = DrvGfxROM1 + (code * 0x400) + (flipy * 0x3e0); - UINT16 *dst; - - INT32 increment = flipy ? -32 : 32; - - for (INT32 y = 0; y < 32; y++, sy++) - { - if (sy >= nScreenHeight) break; - - if (sy >= 0) - { - dst = pTransDraw + (sy * nScreenWidth); - - if (flipx) { - for (INT32 x = 31; x >= 0; x--) - { - if ((sx+x) < 0 || (sx+x) >= nScreenWidth) continue; - - if (DrvTransMask[src[x^0x1f]]) - dst[sx+x] = src[x^0x1f] | color; - } - } else { - for (INT32 x = 0; x < 32; x++) - { - if ((sx+x) < 0 || (sx+x) >= nScreenWidth) continue; - - if (DrvTransMask[src[x]]) - dst[sx+x] = src[x] | color; - } - } - } - - src += increment; - } -} - -static void draw_background(INT32 priority) -{ - INT32 scrollx = *((UINT16*)(DrvScrollRAM + 0)); - INT32 scrolly = *((UINT16*)(DrvScrollRAM + 2)); - - scrollx &= 0xfff; - - scrolly = 0 - scrolly; - scrolly -= 0x100; - scrolly &= 0xfff; - - for (INT32 y = 0; y < 8+1; y++) - { - for (INT32 x = 0; x < 8+1; x++) - { - INT32 sx = x + (scrollx >> 5); - INT32 sy = y + (scrolly >> 5); - - INT32 ofst = ((sx & 7) << 1) + (((127 - sy) & 7) << 4) + ((sx >> 3) << 7) + (((127 - sy) >> 3) << 11); - - INT32 attr = DrvGfxROM3[ofst + 1]; - INT32 prio = attr & 0x10; - if (priority && !prio) continue; - - INT32 data = DrvGfxROM3[ofst]; - INT32 code = data + ((attr & 0xc0) << 2) + (*bgcharbank << 10); - INT32 color = attr & 0x0f; - INT32 flipx = attr & 0x20; - INT32 flipy = 0; - - sx = (x << 5) - (scrollx & 0x1f); - sy = (y << 5) - (scrolly & 0x1f); - - if (*flipscreen) { - flipx ^= 0x20; - flipy ^= 1; - - sx = 224 - sx; - sy = 224 - sy; - } - - if (!priority) { - if (flipy) { - if (flipx) { - Render32x32Tile_FlipXY_Clip(pTransDraw, code, sx, sy - 16, color, 4, 0, DrvGfxROM1); - } else { - Render32x32Tile_FlipY_Clip(pTransDraw, code, sx, sy - 16, color, 4, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render32x32Tile_FlipX_Clip(pTransDraw, code, sx, sy - 16, color, 4, 0, DrvGfxROM1); - } else { - Render32x32Tile_Clip(pTransDraw, code, sx, sy - 16, color, 4, 0, DrvGfxROM1); - } - } - } else { - draw_32x32_mask_tile(sx, sy - 16, code, color << 4, flipx, flipy); - } - } - } -} - -static void draw_text_layer() -{ - UINT16 *vram = (UINT16*)DrvVidRAM; - - for (INT32 offs = 0x40; offs < 0x3c0; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - INT32 data = vram[offs]; - INT32 attr = data >> 8; - INT32 code = (data & 0xff) + ((attr & 0xc0) << 2) + ((attr & 0x20) << 5); - if (code == 0x400) continue; - - INT32 color = attr & 0x0f; - INT32 flipx = attr & 0x10; - INT32 flipy = 0; - - if (*flipscreen) { - sx ^= 0xf8; - sy ^= 0xf8; - flipx ^= 0x10; - flipy ^= 0x01; - } - - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy - 16, color, 2, 3, 0x200, DrvGfxROM0); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy - 16, color, 2, 3, 0x200, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx - 16, sy, color, 2, 3, 0x200, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy - 16, color, 2, 3, 0x200, DrvGfxROM0); - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x240 * 2; i+=2) { - palette_write(i); - } - } - - memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); - - draw_background(0); - draw_sprites(); - draw_background(1); - draw_text_layer(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = ~0; - DrvInputs[1] = ~0; - - for (INT32 i = 0; i < 16; i++) - { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - - DrvInputs[1] |= *coin_lockout << 8; - } - - INT32 nCyclesTotal[3] = { 10000000 / 60, 3579545 / 60, 3579545 / 60 }; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - - SekNewFrame(); - ZetNewFrame(); - - INT32 nInterleave = 10; - INT32 MSMIRQSlice[67]; - - if (toramich) { - nInterleave = MSM5205CalcInterleave(0, 10000000); - - for (INT32 i = 0; i < 67; i++) { - MSMIRQSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 68)); - } - } - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - if (toramich) MSM5205Update(); - SekClose(); - - ZetOpen(0); - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - ZetClose(); - - if (toramich) { - nCurrentCPU = 2; - ZetOpen(1); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - for (INT32 j = 0; j < 67; j++) { - if (i == MSMIRQSlice[j]) { - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - nCyclesDone[nCurrentCPU] += ZetRun(1000); - } - } - ZetClose(); - } - } - - ZetOpen(0); - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - if (toramich) { - SekOpen(0); - MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - SekClose(); - } - } - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - memcpy (DrvSprBuf, DrvSprRAM, 0x500); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029698; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - } - - return 0; -} - - -// Tiger Road (US) - -static struct BurnRomInfo tigeroadRomDesc[] = { - { "tru02.bin", 0x20000, 0x8d283a95, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tru04.bin", 0x20000, 0x72e2ef20, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "tru05.bin", 0x08000, 0xf9a7c9bf, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "tr01.bin", 0x08000, 0x74a9f08c, 3 | BRF_GRA }, // 3 Character Tiles - - { "tr-01a.bin", 0x20000, 0xa8aa2e59, 4 | BRF_GRA }, // 4 Background Tiles - { "tr-04a.bin", 0x20000, 0x8863a63c, 4 | BRF_GRA }, // 5 - { "tr-02a.bin", 0x20000, 0x1a2c5f89, 4 | BRF_GRA }, // 6 - { "tr05.bin", 0x20000, 0x5bf453b3, 4 | BRF_GRA }, // 7 - { "tr-03a.bin", 0x20000, 0x1e0537ea, 4 | BRF_GRA }, // 8 - { "tr-06a.bin", 0x20000, 0xb636c23a, 4 | BRF_GRA }, // 9 - { "tr-07a.bin", 0x20000, 0x5f907d4d, 4 | BRF_GRA }, // 10 - { "tr08.bin", 0x20000, 0xadee35e2, 4 | BRF_GRA }, // 11 - - { "tr-09a.bin", 0x20000, 0x3d98ad1e, 5 | BRF_GRA }, // 12 Sprites - { "tr-10a.bin", 0x20000, 0x8f6f03d7, 5 | BRF_GRA }, // 13 - { "tr-11a.bin", 0x20000, 0xcd9152e5, 5 | BRF_GRA }, // 14 - { "tr-12a.bin", 0x20000, 0x7d8a99d0, 5 | BRF_GRA }, // 15 - - { "tr13.bin", 0x08000, 0xa79be1eb, 6 | BRF_GRA }, // 16 Background Tilemaps - - { "trprom.bin", 0x00100, 0xec80ae36, 7 | BRF_GRA | BRF_OPT }, // 17 Priority Proms (unused) -}; - -STD_ROM_PICK(tigeroad) -STD_ROM_FN(tigeroad) - -static INT32 TigeroadLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x20000, 4 + i, 1)) return 1; - } - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvGfxROM2 + i * 0x20000, 12 + i, 1)) return 1; - } - - if (BurnLoadRom(DrvGfxROM3 + 0x00000, 16, 1)) return 1; - - if (toramich) if (BurnLoadRom(DrvSndROM + 0x000000, 18, 1)) return 1; - - return 0; -} - -static INT32 TigeroadInit() -{ - return DrvInit(TigeroadLoadRoms); -} - -struct BurnDriver BurnDrvTigeroad = { - "tigeroad", NULL, NULL, NULL, "1987", - "Tiger Road (US)\0", NULL, "Capcom (Romstar license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT | GBF_PLATFORM, 0, - NULL, tigeroadRomInfo, tigeroadRomName, NULL, NULL, TigeroadInputInfo, TigeroadDIPInfo, - TigeroadInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, - 256, 224, 4, 3 -}; - - -// Tora e no Michi (Japan) - -static struct BurnRomInfo toramichRomDesc[] = { - { "tr_02.bin", 0x20000, 0xb54723b1, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tr_04.bin", 0x20000, 0xab432479, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "tr_05.bin", 0x08000, 0x3ebe6e62, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "tr01.bin", 0x08000, 0x74a9f08c, 3 | BRF_GRA }, // 3 Character Tiles - - { "tr-01a.bin", 0x20000, 0xa8aa2e59, 4 | BRF_GRA }, // 4 Background Tiles - { "tr-04a.bin", 0x20000, 0x8863a63c, 4 | BRF_GRA }, // 5 - { "tr-02a.bin", 0x20000, 0x1a2c5f89, 4 | BRF_GRA }, // 6 - { "tr05.bin", 0x20000, 0x5bf453b3, 4 | BRF_GRA }, // 7 - { "tr-03a.bin", 0x20000, 0x1e0537ea, 4 | BRF_GRA }, // 8 - { "tr-06a.bin", 0x20000, 0xb636c23a, 4 | BRF_GRA }, // 9 - { "tr-07a.bin", 0x20000, 0x5f907d4d, 4 | BRF_GRA }, // 10 - { "tr08.bin", 0x20000, 0xadee35e2, 4 | BRF_GRA }, // 11 - - { "tr-09a.bin", 0x20000, 0x3d98ad1e, 5 | BRF_GRA }, // 12 Sprites - { "tr-10a.bin", 0x20000, 0x8f6f03d7, 5 | BRF_GRA }, // 13 - { "tr-11a.bin", 0x20000, 0xcd9152e5, 5 | BRF_GRA }, // 14 - { "tr-12a.bin", 0x20000, 0x7d8a99d0, 5 | BRF_GRA }, // 15 - - { "tr13.bin", 0x08000, 0xa79be1eb, 6 | BRF_GRA }, // 16 Background Tilemaps - - { "trprom.bin", 0x00100, 0xec80ae36, 7 | BRF_GRA | BRF_OPT }, // 17 Priority Proms (unused) - - { "tr_03.bin", 0x10000, 0xea1807ef, 8 | BRF_PRG | BRF_ESS }, // 18 Sample Z80 Code -}; - -STD_ROM_PICK(toramich) -STD_ROM_FN(toramich) - -static INT32 ToramichInit() -{ - toramich = 1; - - return DrvInit(TigeroadLoadRoms); -} - -struct BurnDriver BurnDrvToramich = { - "toramich", "tigeroad", NULL, NULL, "1987", - "Tora e no Michi (Japan)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT | GBF_PLATFORM, 0, - NULL, toramichRomInfo, toramichRomName, NULL, NULL, TigeroadInputInfo, ToramichDIPInfo, - ToramichInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, - 256, 224, 4, 3 -}; - - -// Tiger Road (US bootleg) - -static struct BurnRomInfo tigerodbRomDesc[] = { - { "tgrroad.3", 0x10000, 0x14c87e07, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tgrroad.5", 0x10000, 0x0904254c, 1 | BRF_PRG | BRF_ESS }, // 1 - { "tgrroad.2", 0x10000, 0xcedb1f46, 1 | BRF_PRG | BRF_ESS }, // 2 - { "tgrroad.4", 0x10000, 0xe117f0b1, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "tru05.bin", 0x08000, 0xf9a7c9bf, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "tr01.bin", 0x08000, 0x74a9f08c, 3 | BRF_GRA }, // 5 Character Tiles - - { "tr-01a.bin", 0x20000, 0xa8aa2e59, 4 | BRF_GRA }, // 6 Background Tiles - { "tr-04a.bin", 0x20000, 0x8863a63c, 4 | BRF_GRA }, // 7 - { "tr-02a.bin", 0x20000, 0x1a2c5f89, 4 | BRF_GRA }, // 8 - { "tr05.bin", 0x20000, 0x5bf453b3, 4 | BRF_GRA }, // 9 - { "tr-03a.bin", 0x20000, 0x1e0537ea, 4 | BRF_GRA }, // 10 - { "tr-06a.bin", 0x20000, 0xb636c23a, 4 | BRF_GRA }, // 11 - { "tr-07a.bin", 0x20000, 0x5f907d4d, 4 | BRF_GRA }, // 12 - { "tgrroad.17", 0x10000, 0x3f7539cc, 4 | BRF_GRA }, // 13 - { "tgrroad.18", 0x10000, 0xe2e053cb, 4 | BRF_GRA }, // 14 - - { "tr-09a.bin", 0x20000, 0x3d98ad1e, 5 | BRF_GRA }, // 15 Sprites - { "tr-10a.bin", 0x20000, 0x8f6f03d7, 5 | BRF_GRA }, // 16 - { "tr-11a.bin", 0x20000, 0xcd9152e5, 5 | BRF_GRA }, // 17 - { "tr-12a.bin", 0x20000, 0x7d8a99d0, 5 | BRF_GRA }, // 18 - - { "tr13.bin", 0x08000, 0xa79be1eb, 6 | BRF_GRA }, // 19 Background Tilemaps - - { "trprom.bin", 0x00100, 0xec80ae36, 7 | BRF_GRA | BRF_OPT }, // 20 Priority Proms (unused) -}; - -STD_ROM_PICK(tigerodb) -STD_ROM_FN(tigerodb) - -static INT32 TigerodbLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 1)) return 1; - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x20000, 6 + i, 1)) return 1; - } - - if (BurnLoadRom(DrvGfxROM1 + 0xf0000, 14, 1)) return 1; - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvGfxROM2 + i * 0x20000, 15 + i, 1)) return 1; - } - - if (BurnLoadRom(DrvGfxROM3 + 0x00000, 19, 1)) return 1; - - return 0; -} - -static INT32 TigerodbInit() -{ - return DrvInit(TigerodbLoadRoms); -} - -struct BurnDriver BurnDrvTigerodb = { - "tigeroadb", "tigeroad", NULL, NULL, "1987", - "Tiger Road (US bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT | GBF_PLATFORM, 0, - NULL, tigerodbRomInfo, tigerodbRomName, NULL, NULL, TigeroadInputInfo, TigeroadDIPInfo, - TigerodbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, - 256, 224, 4, 3 -}; - - -// F-1 Dream - -static struct BurnRomInfo f1dreamRomDesc[] = { - { "06j_02.bin", 0x20000, 0x3c2ec697, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "06k_03.bin", 0x20000, 0x85ebad91, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "12k_04.bin", 0x08000, 0x4b9a7524, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "10d_01.bin", 0x08000, 0x361caf00, 3 | BRF_GRA }, // 3 Character Tiles - - { "03f_12.bin", 0x10000, 0xbc13e43c, 4 | BRF_GRA }, // 4 Background Tiles - { "01f_10.bin", 0x10000, 0xf7617ad9, 4 | BRF_GRA }, // 5 - { "03h_14.bin", 0x10000, 0xe33cd438, 4 | BRF_GRA }, // 6 - { "02f_11.bin", 0x10000, 0x4aa49cd7, 4 | BRF_GRA }, // 7 - { "17f_09.bin", 0x10000, 0xca622155, 4 | BRF_GRA }, // 8 - { "02h_13.bin", 0x10000, 0x2a63961e, 4 | BRF_GRA }, // 9 - - { "03b_06.bin", 0x10000, 0x5e54e391, 5 | BRF_GRA }, // 10 Sprites - { "02b_05.bin", 0x10000, 0xcdd119fd, 5 | BRF_GRA }, // 11 - { "03d_08.bin", 0x10000, 0x811f2e22, 5 | BRF_GRA }, // 12 - { "02d_07.bin", 0x10000, 0xaa9a1233, 5 | BRF_GRA }, // 13 - - { "07l_15.bin", 0x08000, 0x978758b7, 6 | BRF_GRA }, // 14 Background Tilemaps - - { "09e_tr.bin", 0x00100, 0xec80ae36, 7 | BRF_GRA | BRF_OPT }, // 15 Priority Proms (unused) - - { "c8751h-88", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(f1dream) -STD_ROM_FN(f1dream) - -static INT32 F1dreamLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; - - for (INT32 i = 0; i < 3; i++) { - if (BurnLoadRom(DrvGfxROM1 + 0x00000 + i * 0x10000, 4 + i, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x80000 + i * 0x10000, 7 + i, 1)) return 1; - } - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvGfxROM2 + i * 0x20000, 10 + i, 1)) return 1; - } - - if (BurnLoadRom(DrvGfxROM3 + 0x00000, 14, 1)) return 1; - - return 0; -} - -static INT32 F1dreamInit() -{ - nF1dream = 1; - - return DrvInit(F1dreamLoadRoms); -} - -struct BurnDriver BurnDrvF1dream = { - "f1dream", NULL, NULL, NULL, "1988", - "F-1 Dream\0", NULL, "Capcom (Romstar license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, - NULL, f1dreamRomInfo, f1dreamRomName, NULL, NULL, TigeroadInputInfo, F1dreamDIPInfo, - F1dreamInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, - 256, 224, 4, 3 -}; - - -// F-1 Dream (bootleg) - -static struct BurnRomInfo f1dreambRomDesc[] = { - { "f1d_04.bin", 0x10000, 0x903febad, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "f1d_05.bin", 0x10000, 0x666fa2a7, 1 | BRF_PRG | BRF_ESS }, // 1 - { "f1d_02.bin", 0x10000, 0x98973c4c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "f1d_03.bin", 0x10000, 0x3d21c78a, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "12k_04.bin", 0x08000, 0x4b9a7524, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "10d_01.bin", 0x08000, 0x361caf00, 3 | BRF_GRA }, // 5 Character Tiles - - { "03f_12.bin", 0x10000, 0xbc13e43c, 4 | BRF_GRA }, // 6 Background Tiles - { "01f_10.bin", 0x10000, 0xf7617ad9, 4 | BRF_GRA }, // 7 - { "03h_14.bin", 0x10000, 0xe33cd438, 4 | BRF_GRA }, // 8 - { "02f_11.bin", 0x10000, 0x4aa49cd7, 4 | BRF_GRA }, // 9 - { "17f_09.bin", 0x10000, 0xca622155, 4 | BRF_GRA }, // 10 - { "02h_13.bin", 0x10000, 0x2a63961e, 4 | BRF_GRA }, // 11 - - { "03b_06.bin", 0x10000, 0x5e54e391, 5 | BRF_GRA }, // 12 Sprites - { "02b_05.bin", 0x10000, 0xcdd119fd, 5 | BRF_GRA }, // 13 - { "03d_08.bin", 0x10000, 0x811f2e22, 5 | BRF_GRA }, // 14 - { "02d_07.bin", 0x10000, 0xaa9a1233, 5 | BRF_GRA }, // 15 - - { "07l_15.bin", 0x08000, 0x978758b7, 6 | BRF_GRA }, // 16 Background Tilemaps - - { "09e_tr.bin", 0x00100, 0xec80ae36, 7 | BRF_GRA | BRF_OPT }, // 17 Priority Proms (unused) -}; - -STD_ROM_PICK(f1dreamb) -STD_ROM_FN(f1dreamb) - -static INT32 F1dreambLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 1)) return 1; - - for (INT32 i = 0; i < 3; i++) { - if (BurnLoadRom(DrvGfxROM1 + 0x00000 + i * 0x10000, 6 + i, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x80000 + i * 0x10000, 9 + i, 1)) return 1; - } - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvGfxROM2 + i * 0x20000, 12 + i, 1)) return 1; - } - - if (BurnLoadRom(DrvGfxROM3 + 0x00000, 16, 1)) return 1; - - return 0; -} - -static INT32 F1dreambInit() -{ - return DrvInit(F1dreambLoadRoms); -} - -struct BurnDriver BurnDrvF1dreamb = { - "f1dreamb", "f1dream", NULL, NULL, "1988", - "F-1 Dream (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, - NULL, f1dreambRomInfo, f1dreambRomName, NULL, NULL, TigeroadInputInfo, F1dreamDIPInfo, - F1dreambInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, - 256, 224, 4, 3 -}; +// FB Alpha Tiger Road driver module +// Based on MAME driver by Phil Stroffolino +// F1 Dream protection code by Eric Hustvedt + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2203.h" +#include "msm5205.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvSndROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf; +static UINT8 *DrvVidRAM; +static UINT8 *DrvScrollRAM; +static UINT32 *DrvPalette; +static UINT8 *DrvTransMask; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDip[2]; +static UINT8 DrvReset; +static UINT16 DrvInputs[2]; + +static UINT8 *soundlatch; +static UINT8 *soundlatch2; +static UINT8 *flipscreen; +static UINT8 *bgcharbank; +static UINT8 *coin_lockout; + +static INT32 nF1dream = 0; +static INT32 toramich = 0; + +static struct BurnInputInfo TigeroadInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 14, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 8, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 15, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 9, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 11, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 10, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 9, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 8, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, +}; + +STDINPUTINFO(Tigeroad) + +static struct BurnDIPInfo TigeroadDIPList[] = +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x01, "3 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x02, "2 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, + {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, + {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, + {0x11, 0x01, 0x07, 0x04, "1 Coin 4 Credits " }, + {0x11, 0x01, 0x07, 0x03, "1 Coin 6 Credits " }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x08, "3 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x10, "2 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits " }, + {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits " }, + {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits " }, + {0x11, 0x01, 0x38, 0x20, "1 Coin 4 Credits " }, + {0x11, 0x01, 0x38, 0x18, "1 Coin 6 Credits " }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x11, 0x01, 0x40, 0x00, "On" }, + {0x11, 0x01, 0x40, 0x40, "Off" }, + + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x04, 0x00, "Upright" }, + {0x12, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x12, 0x01, 0x18, 0x18, "20000 70000 70000" }, + {0x12, 0x01, 0x18, 0x10, "20000 80000 80000" }, + {0x12, 0x01, 0x18, 0x08, "30000 80000 80000" }, + {0x12, 0x01, 0x18, 0x00, "30000 90000 90000" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x60, 0x20, "Very_Easy" }, + {0x12, 0x01, 0x60, 0x40, "Easy" }, + {0x12, 0x01, 0x60, 0x60, "Normal" }, + {0x12, 0x01, 0x60, 0x00, "Difficult" }, + + {0 , 0xfe, 0 , 2, "Allow_Continue" }, + {0x12, 0x01, 0x80, 0x00, "No" }, + {0x12, 0x01, 0x80, 0x80, "Yes" }, +}; + +STDDIPINFO(Tigeroad) + +static struct BurnDIPInfo ToramichDIPList[] = +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x01, "3 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x02, "2 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, + {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, + {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, + {0x11, 0x01, 0x07, 0x04, "1 Coin 4 Credits " }, + {0x11, 0x01, 0x07, 0x03, "1 Coin 6 Credits " }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x08, "3 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x10, "2 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits " }, + {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits " }, + {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits " }, + {0x11, 0x01, 0x38, 0x20, "1 Coin 4 Credits " }, + {0x11, 0x01, 0x38, 0x18, "1 Coin 6 Credits " }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x11, 0x01, 0x40, 0x00, "On" }, + {0x11, 0x01, 0x40, 0x40, "Off" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x04, 0x00, "Upright" }, + {0x12, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x12, 0x01, 0x08, 0x08, "20000 70000 70000" }, + {0x12, 0x01, 0x08, 0x00, "20000 80000 80000" }, + + {0 , 0xfe, 0 , 2, "Allow Level Select" }, + {0x12, 0x01, 0x10, 0x10, "No" }, + {0x12, 0x01, 0x10, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x60, 0x40, "Easy" }, + {0x12, 0x01, 0x60, 0x60, "Normal" }, + {0x12, 0x01, 0x60, 0x20, "Difficult" }, + {0x12, 0x01, 0x60, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x12, 0x01, 0x80, 0x00, "No" }, + {0x12, 0x01, 0x80, 0x80, "Yes" }, +}; + +STDDIPINFO(Toramich) + +static struct BurnDIPInfo F1dreamDIPList[] = +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xbb, NULL }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x01, "3 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x02, "2 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, + {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, + {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, + {0x11, 0x01, 0x07, 0x04, "1 Coin 4 Credits " }, + {0x11, 0x01, 0x07, 0x03, "1 Coin 6 Credits " }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x08, "3 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x10, "2 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits " }, + {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits " }, + {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits " }, + {0x11, 0x01, 0x38, 0x20, "1 Coin 4 Credits " }, + {0x11, 0x01, 0x38, 0x18, "1 Coin 6 Credits " }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x11, 0x01, 0x40, 0x00, "On" }, + {0x11, 0x01, 0x40, 0x40, "Off" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + {0x12, 0x01, 0x03, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x04, 0x00, "Upright" }, + {0x12, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "F1 Up Point" }, + {0x12, 0x01, 0x18, 0x18, "12" }, + {0x12, 0x01, 0x18, 0x10, "16" }, + {0x12, 0x01, 0x18, 0x08, "18" }, + {0x12, 0x01, 0x18, 0x00, "20" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x12, 0x01, 0x20, 0x20, "Normal" }, + {0x12, 0x01, 0x20, 0x00, "Difficult" }, + + {0 , 0xfe, 0 , 2, "Version" }, + {0x12, 0x01, 0x40, 0x00, "International" }, + {0x12, 0x01, 0x40, 0x40, "Japan" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x12, 0x01, 0x80, 0x00, "No" }, + {0x12, 0x01, 0x80, 0x80, "Yes" }, +}; + +STDDIPINFO(F1dream) + +static void palette_write(INT32 offset) +{ + UINT16 data = *((UINT16 *)(DrvPalRAM + offset + 0x200)); + + UINT8 r,g,b; + + r = (data >> 8) & 0x0f; + g = (data >> 4) & 0x0f; + b = (data >> 0) & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + DrvPalette[offset / 2] = BurnHighCol(r, g, b, 0); +} + +static const UINT16 f1dream_613ea_lookup[16] = { +0x0052, 0x0031, 0x00a7, 0x0043, 0x0007, 0x008a, 0x00b1, 0x0066, 0x009f, 0x00cc, 0x0009, 0x004d, 0x0033, 0x0028, 0x00d0, 0x0025}; + +static const UINT16 f1dream_613eb_lookup[256] = { +0x0001, 0x00b5, 0x00b6, 0x00b6, 0x00b6, 0x00b6, 0x00b6, 0x00b6, 0x00b7, 0x0001, 0x00b8, 0x002f, 0x002f, 0x002f, 0x002f, 0x00b9, +0x00aa, 0x0031, 0x00ab, 0x00ab, 0x00ab, 0x00ac, 0x00ad, 0x00ad, 0x00ae, 0x00af, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x0091, +0x009c, 0x009d, 0x009e, 0x009f, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x009b, 0x0091, +0x00bc, 0x0092, 0x000b, 0x0009, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0073, 0x0001, 0x0098, 0x0099, 0x009a, 0x009b, 0x0091, +0x00bc, 0x007b, 0x000b, 0x0008, 0x0087, 0x0088, 0x0089, 0x008a, 0x007f, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, +0x00bd, 0x007b, 0x000b, 0x0007, 0x007c, 0x007d, 0x007e, 0x0001, 0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, +0x00bc, 0x0070, 0x000b, 0x0006, 0x0071, 0x0072, 0x0073, 0x0001, 0x0074, 0x000d, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, +0x00bc, 0x00ba, 0x000a, 0x0005, 0x0065, 0x0066, 0x0067, 0x0068, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, +0x00bc, 0x0059, 0x0001, 0x0004, 0x005a, 0x005b, 0x0001, 0x005c, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, +0x0014, 0x004d, 0x0001, 0x0003, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0001, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, +0x0014, 0x0043, 0x0001, 0x0002, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00bb, 0x004a, 0x004b, 0x004c, 0x0001, 0x0001, +0x0014, 0x002b, 0x0001, 0x0038, 0x0039, 0x003a, 0x003b, 0x0031, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, 0x0001, +0x0014, 0x002d, 0x0001, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0001, 0x0014, 0x0037, 0x0001, +0x0014, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x0001, 0x0001, 0x0001, 0x002a, 0x002b, 0x002c, +0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001e, 0x001e, 0x001e, 0x001f, 0x0020, +0x000c, 0x000d, 0x000e, 0x0001, 0x000f, 0x0010, 0x0011, 0x0012, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x0013 }; + +static const UINT16 f1dream_17b74_lookup[128] = { +0x0003, 0x0040, 0x0005, 0x0080, 0x0003, 0x0080, 0x0005, 0x00a0, 0x0003, 0x0040, 0x0005, 0x00c0, 0x0003, 0x0080, 0x0005, 0x00e0, +0x0003, 0x0040, 0x0006, 0x0000, 0x0003, 0x0080, 0x0006, 0x0020, 0x0003, 0x0040, 0x0006, 0x0040, 0x0003, 0x0080, 0x0006, 0x0060, +0x0000, 0x00a0, 0x0009, 0x00e0, 0x0000, 0x00e0, 0x000a, 0x0000, 0x0000, 0x00a0, 0x000a, 0x0020, 0x0000, 0x00e0, 0x000a, 0x0040, +0x0000, 0x00a0, 0x000a, 0x0060, 0x0000, 0x00e0, 0x000a, 0x0080, 0x0000, 0x00a0, 0x000a, 0x00a0, 0x0000, 0x00e0, 0x000a, 0x00c0, +0x0003, 0x0040, 0x0005, 0x0080, 0x0003, 0x0080, 0x0005, 0x00a0, 0x0003, 0x0040, 0x0005, 0x00c0, 0x0003, 0x0080, 0x0005, 0x00e0, +0x0003, 0x0040, 0x0006, 0x0000, 0x0003, 0x0080, 0x0006, 0x0020, 0x0003, 0x0040, 0x0006, 0x0040, 0x0003, 0x0080, 0x0006, 0x0060, +0x0000, 0x00a0, 0x0009, 0x00e0, 0x0000, 0x00e0, 0x000a, 0x0000, 0x0000, 0x00a0, 0x000a, 0x0020, 0x0000, 0x00e0, 0x000a, 0x0040, +0x0000, 0x00a0, 0x000a, 0x0060, 0x0000, 0x00e0, 0x000a, 0x0080, 0x0000, 0x00a0, 0x000a, 0x00a0, 0x0000, 0x00e0, 0x000a, 0x00c0 }; + +static const UINT16 f1dream_2450_lookup[32] = { +0x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0, 0x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0, +0x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0, 0x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0 }; + +static void f1dream_protection_w() +{ + INT32 indx; + INT32 value = 255; + INT32 prevpc = SekGetPC(0)-8; + UINT16* ram16 = (UINT16*)Drv68KRAM; + + if (prevpc == 0x244c) + { + indx = ram16[0x3ff0/2]; + ram16[0x3fe6/2] = f1dream_2450_lookup[indx]; + ram16[0x3fe8/2] = f1dream_2450_lookup[++indx]; + ram16[0x3fea/2] = f1dream_2450_lookup[++indx]; + ram16[0x3fec/2] = f1dream_2450_lookup[++indx]; + } + else if (prevpc == 0x613a) + { + if (ram16[0x3ff6/2] < 15) + { + indx = f1dream_613ea_lookup[ram16[0x3ff6/2]] - ram16[0x3ff4/2]; + if (indx > 255) + { + indx <<= 4; + indx += ram16[0x3ff6/2] & 0x00ff; + value = f1dream_613eb_lookup[indx]; + } + } + + ram16[0x3ff2/2] = value; + } + else if (prevpc == 0x17b70) + { + if (ram16[0x3ff0/2] >= 0x04) indx = 128; + else if (ram16[0x3ff0/2] > 0x02) indx = 96; + else if (ram16[0x3ff0/2] == 0x02) indx = 64; + else if (ram16[0x3ff0/2] == 0x01) indx = 32; + else indx = 0; + + indx += ram16[0x3fee/2]; + if (indx < 128) + { + ram16[0x3fe6/2] = f1dream_17b74_lookup[indx]; + ram16[0x3fe8/2] = f1dream_17b74_lookup[++indx]; + ram16[0x3fea/2] = f1dream_17b74_lookup[++indx]; + ram16[0x3fec/2] = f1dream_17b74_lookup[++indx]; + } + else + { + ram16[0x3fe6/2] = 0x00ff; + ram16[0x3fe8/2] = 0x00ff; + ram16[0x3fea/2] = 0x00ff; + ram16[0x3fec/2] = 0x00ff; + } + } + else if ((prevpc == 0x27f8) || (prevpc == 0x511a) || (prevpc == 0x5142) || (prevpc == 0x516a)) + { + *soundlatch = ram16[0x3ffc/2] & 0xff; + } +} + +void __fastcall tigeroad_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0xfe4000: + *flipscreen = data & 0x02; + *bgcharbank = (data & 0x04) >> 2; + *coin_lockout = (~data & 0x30) << 1; + return; + + case 0xfe4002: + if (nF1dream) { + f1dream_protection_w(); + } else { + *soundlatch = data; + } + return; + } +} + +void __fastcall tigeroad_write_word(UINT32 address, UINT16 data) +{ + if (address >= 0xff8200 && address <= 0xff867f) { + *((UINT16*)(DrvPalRAM + (address - 0xff8000))) = data; + + palette_write(address - 0xff8200); + + return; + } + + switch (address) + { + case 0xfe8000: + case 0xfe8002: + *((UINT16 *)(DrvScrollRAM + (address & 2))) = data; + return; + + case 0xfe800e: + // watchdog + return; + } +} + +UINT8 __fastcall tigeroad_read_byte(UINT32 address) +{ + switch (address) + { + case 0xfe4000: + case 0xfe4001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0xfe4002: + case 0xfe4003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0xfe4004: + case 0xfe4005: + return DrvDip[~address & 1]; + } + + return 0; +} + +UINT16 __fastcall tigeroad_read_word(UINT32 address) +{ + switch (address) + { + case 0xfe4000: + return DrvInputs[0]; + + case 0xfe4002: + return DrvInputs[1]; + + case 0xfe4004: + return ((DrvDip[1] << 8) | DrvDip[0]); + } + + return 0; +} + +void __fastcall tigeroad_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8000: + BurnYM2203Write(0, 0, data); + return; + + case 0x8001: + BurnYM2203Write(0, 1, data); + return; + + case 0xa000: + BurnYM2203Write(1, 0, data); + return; + + case 0xa001: + BurnYM2203Write(1, 1, data); + return; + } +} + +void __fastcall tigeroad_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x7f: + *soundlatch2 = data; + return; + } +} + +UINT8 __fastcall tigeroad_sound_read(UINT16 address) +{ + switch (address) + { + case 0x8000: + return BurnYM2203Read(0, 0); + + case 0xa000: + return BurnYM2203Read(1, 0); + + case 0xe000: + return *soundlatch; + } + + return 0; +} + +void __fastcall tigeroad_sample_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x01: + SekOpen(0); + MSM5205ResetWrite(0, (data >> 7) & 1); + MSM5205DataWrite(0, data); + MSM5205VCLKWrite(0, 1); + MSM5205VCLKWrite(0, 0); + SekClose(); + return; + } +} + +UINT8 __fastcall tigeroad_sample_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return *soundlatch2; + } + + return 0; +} + +static void TigeroadIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 TigeroadSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3579545; +} + +static double TigeroadGetTime() +{ + return (double)ZetTotalCycles() / 3579545; +} + +inline static INT32 DrvMSM5205SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)((double)SekTotalCycles() * nSoundRate / 10000000); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + + if (toramich) { + ZetOpen(1); + ZetReset(); + ZetClose(); + + MSM5205Reset(); + } + + if (pBurnSoundOut) { // fix ym2203 junk.. + memset (pBurnSoundOut, 0, nBurnSoundLen); + } + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x008000; + DrvSndROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x020000; + DrvGfxROM1 = Next; Next += 0x200000; + DrvGfxROM2 = Next; Next += 0x100000; + DrvGfxROM3 = Next; Next += 0x008000; + + DrvPalette = (UINT32*)Next; Next += 0x0240 * sizeof(UINT32); + + DrvTransMask = Next; Next += 0x000010; + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x004000; + DrvPalRAM = Next; Next += 0x000800; + DrvVidRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x001400; + DrvSprBuf = Next; Next += 0x000500; + + DrvZ80RAM = Next; Next += 0x000800; + + DrvScrollRAM = Next; Next += 0x000004; + + soundlatch = Next; Next += 0x000001; + soundlatch2 = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + bgcharbank = Next; Next += 0x000001; + coin_lockout = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { ((0x20000 * 8) * 4) + 4, ((0x20000 * 8) * 4) + 0, 4, 0 }; + INT32 XOffs0[32] = { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3, + 64*8+0, 64*8+1, 64*8+2, 64*8+3, 64*8+8+0, 64*8+8+1, 64*8+8+2, 64*8+8+3, + 2*64*8+0, 2*64*8+1, 2*64*8+2, 2*64*8+3, 2*64*8+8+0, 2*64*8+8+1, 2*64*8+8+2, 2*64*8+8+3, + 3*64*8+0, 3*64*8+1, 3*64*8+2, 3*64*8+3, 3*64*8+8+0, 3*64*8+8+1, 3*64*8+8+2, 3*64*8+8+3 }; + INT32 YOffs0[32] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, + 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16, + 16*16, 17*16, 18*16, 19*16, 20*16, 21*16, 22*16, 23*16, + 24*16, 25*16, 26*16, 27*16, 28*16, 29*16, 30*16, 31*16 }; + + INT32 Plane1[4] = { (0x20000*8)*3, (0x20000*8)*2, (0x20000*8)*1, (0x20000*8)*0 }; + INT32 XOffs1[16] = { 0, 1, 2, 3, 4, 5, 6, 7, + 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 }; + INT32 YOffs1[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, + 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }; + + + UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x008000); + + GfxDecode(0x0800, 2, 8, 8, Plane0 + 2, XOffs0, YOffs0, 0x080, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x100000); + + GfxDecode(0x0800, 4, 32, 32, Plane0 + 0, XOffs0, YOffs0, 0x800, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x080000); + + GfxDecode(0x1000, 4, 16, 16, Plane1 + 0, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM2); + + for (INT32 i = 0; i < 16; i++) { + DrvTransMask[i] = (0xfe00 >> i) & 1; + } + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit(INT32 (*pInitCallback)()) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (pInitCallback()) return 1; + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvSprRAM, 0xfe0800, 0xfe1bff, SM_RAM); + SekMapMemory(DrvVidRAM, 0xfec000, 0xfec7ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xff8000, 0xff87ff, SM_ROM); + SekMapMemory(Drv68KRAM, 0xffc000, 0xffffff, SM_RAM); + SekSetWriteByteHandler(0, tigeroad_write_byte); + SekSetWriteWordHandler(0, tigeroad_write_word); + SekSetReadByteHandler(0, tigeroad_read_byte); + SekSetReadWordHandler(0, tigeroad_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(tigeroad_sound_write); + ZetSetReadHandler(tigeroad_sound_read); + ZetSetOutHandler(tigeroad_sound_out); + ZetClose(); + + if (toramich) { + ZetInit(1); + + ZetOpen(1); + ZetMapArea(0x0000, 0xffff, 0, DrvSndROM); + ZetMapArea(0x0000, 0xffff, 2, DrvSndROM); + ZetSetOutHandler(tigeroad_sample_out); + ZetSetInHandler(tigeroad_sample_in); + ZetClose(); + } + + BurnYM2203Init(2, 3579545, &TigeroadIRQHandler, TigeroadSynchroniseStream, TigeroadGetTime, 0); + BurnTimerAttachZet(3579545); + BurnYM2203SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + BurnYM2203SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + + if (toramich) { + MSM5205Init(0, DrvMSM5205SynchroniseStream, 384000, NULL, MSM5205_SEX_4B, 1); + MSM5205SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + } + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + BurnYM2203Exit(); + if (toramich) MSM5205Exit(); + + GenericTilesExit(); + + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + nF1dream = 0; + toramich = 0; + + return 0; +} + +static void draw_sprites() +{ + UINT16 *source = (UINT16*)DrvSprBuf; + + for (INT32 offs = (0x500 - 8) / 2; offs >= 0; offs -=4) + { + INT32 tile_number = source[offs + 0]; + + if (tile_number != 0xfff) { + INT32 attr = source[offs + 1]; + INT32 sy = source[offs + 2] & 0x1ff; + INT32 sx = source[offs + 3] & 0x1ff; + + INT32 flipx = attr & 0x02; + INT32 flipy = attr & 0x01; + INT32 color = (attr >> 2) & 0x0f; + + if (sx > 0x100) sx -= 0x200; + if (sy > 0x100) sy -= 0x200; + + if (*flipscreen) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + sy = (240 - sy) - 16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, tile_number, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, tile_number, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, tile_number, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, tile_number, sx, sy, color, 4, 15, 0x100, DrvGfxROM2); + } + } + } + } +} + +static void draw_32x32_mask_tile(INT32 sx, INT32 sy, INT32 code, INT32 color, INT32 flipx, INT32 flipy) +{ + UINT8 *src = DrvGfxROM1 + (code * 0x400) + (flipy * 0x3e0); + UINT16 *dst; + + INT32 increment = flipy ? -32 : 32; + + for (INT32 y = 0; y < 32; y++, sy++) + { + if (sy >= nScreenHeight) break; + + if (sy >= 0) + { + dst = pTransDraw + (sy * nScreenWidth); + + if (flipx) { + for (INT32 x = 31; x >= 0; x--) + { + if ((sx+x) < 0 || (sx+x) >= nScreenWidth) continue; + + if (DrvTransMask[src[x^0x1f]]) + dst[sx+x] = src[x^0x1f] | color; + } + } else { + for (INT32 x = 0; x < 32; x++) + { + if ((sx+x) < 0 || (sx+x) >= nScreenWidth) continue; + + if (DrvTransMask[src[x]]) + dst[sx+x] = src[x] | color; + } + } + } + + src += increment; + } +} + +static void draw_background(INT32 priority) +{ + INT32 scrollx = *((UINT16*)(DrvScrollRAM + 0)); + INT32 scrolly = *((UINT16*)(DrvScrollRAM + 2)); + + scrollx &= 0xfff; + + scrolly = 0 - scrolly; + scrolly -= 0x100; + scrolly &= 0xfff; + + for (INT32 y = 0; y < 8+1; y++) + { + for (INT32 x = 0; x < 8+1; x++) + { + INT32 sx = x + (scrollx >> 5); + INT32 sy = y + (scrolly >> 5); + + INT32 ofst = ((sx & 7) << 1) + (((127 - sy) & 7) << 4) + ((sx >> 3) << 7) + (((127 - sy) >> 3) << 11); + + INT32 attr = DrvGfxROM3[ofst + 1]; + INT32 prio = attr & 0x10; + if (priority && !prio) continue; + + INT32 data = DrvGfxROM3[ofst]; + INT32 code = data + ((attr & 0xc0) << 2) + (*bgcharbank << 10); + INT32 color = attr & 0x0f; + INT32 flipx = attr & 0x20; + INT32 flipy = 0; + + sx = (x << 5) - (scrollx & 0x1f); + sy = (y << 5) - (scrolly & 0x1f); + + if (*flipscreen) { + flipx ^= 0x20; + flipy ^= 1; + + sx = 224 - sx; + sy = 224 - sy; + } + + if (!priority) { + if (flipy) { + if (flipx) { + Render32x32Tile_FlipXY_Clip(pTransDraw, code, sx, sy - 16, color, 4, 0, DrvGfxROM1); + } else { + Render32x32Tile_FlipY_Clip(pTransDraw, code, sx, sy - 16, color, 4, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render32x32Tile_FlipX_Clip(pTransDraw, code, sx, sy - 16, color, 4, 0, DrvGfxROM1); + } else { + Render32x32Tile_Clip(pTransDraw, code, sx, sy - 16, color, 4, 0, DrvGfxROM1); + } + } + } else { + draw_32x32_mask_tile(sx, sy - 16, code, color << 4, flipx, flipy); + } + } + } +} + +static void draw_text_layer() +{ + UINT16 *vram = (UINT16*)DrvVidRAM; + + for (INT32 offs = 0x40; offs < 0x3c0; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + INT32 data = vram[offs]; + INT32 attr = data >> 8; + INT32 code = (data & 0xff) + ((attr & 0xc0) << 2) + ((attr & 0x20) << 5); + if (code == 0x400) continue; + + INT32 color = attr & 0x0f; + INT32 flipx = attr & 0x10; + INT32 flipy = 0; + + if (*flipscreen) { + sx ^= 0xf8; + sy ^= 0xf8; + flipx ^= 0x10; + flipy ^= 0x01; + } + + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy - 16, color, 2, 3, 0x200, DrvGfxROM0); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy - 16, color, 2, 3, 0x200, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx - 16, sy, color, 2, 3, 0x200, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy - 16, color, 2, 3, 0x200, DrvGfxROM0); + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x240 * 2; i+=2) { + palette_write(i); + } + } + + memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); + + draw_background(0); + draw_sprites(); + draw_background(1); + draw_text_layer(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = ~0; + DrvInputs[1] = ~0; + + for (INT32 i = 0; i < 16; i++) + { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + + DrvInputs[1] |= *coin_lockout << 8; + } + + INT32 nCyclesTotal[3] = { 10000000 / 60, 3579545 / 60, 3579545 / 60 }; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + + SekNewFrame(); + ZetNewFrame(); + + INT32 nInterleave = 10; + INT32 MSMIRQSlice[67]; + + if (toramich) { + nInterleave = MSM5205CalcInterleave(0, 10000000); + + for (INT32 i = 0; i < 67; i++) { + MSMIRQSlice[i] = (INT32)((double)((nInterleave * (i + 1)) / 68)); + } + } + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + if (toramich) MSM5205Update(); + SekClose(); + + ZetOpen(0); + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + ZetClose(); + + if (toramich) { + nCurrentCPU = 2; + ZetOpen(1); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + for (INT32 j = 0; j < 67; j++) { + if (i == MSMIRQSlice[j]) { + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + nCyclesDone[nCurrentCPU] += ZetRun(1000); + } + } + ZetClose(); + } + } + + ZetOpen(0); + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + if (toramich) { + SekOpen(0); + MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + SekClose(); + } + } + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + memcpy (DrvSprBuf, DrvSprRAM, 0x500); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029698; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + } + + return 0; +} + + +// Tiger Road (US) + +static struct BurnRomInfo tigeroadRomDesc[] = { + { "tru02.bin", 0x20000, 0x8d283a95, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tru04.bin", 0x20000, 0x72e2ef20, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "tru05.bin", 0x08000, 0xf9a7c9bf, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "tr01.bin", 0x08000, 0x74a9f08c, 3 | BRF_GRA }, // 3 Character Tiles + + { "tr-01a.bin", 0x20000, 0xa8aa2e59, 4 | BRF_GRA }, // 4 Background Tiles + { "tr-04a.bin", 0x20000, 0x8863a63c, 4 | BRF_GRA }, // 5 + { "tr-02a.bin", 0x20000, 0x1a2c5f89, 4 | BRF_GRA }, // 6 + { "tr05.bin", 0x20000, 0x5bf453b3, 4 | BRF_GRA }, // 7 + { "tr-03a.bin", 0x20000, 0x1e0537ea, 4 | BRF_GRA }, // 8 + { "tr-06a.bin", 0x20000, 0xb636c23a, 4 | BRF_GRA }, // 9 + { "tr-07a.bin", 0x20000, 0x5f907d4d, 4 | BRF_GRA }, // 10 + { "tr08.bin", 0x20000, 0xadee35e2, 4 | BRF_GRA }, // 11 + + { "tr-09a.bin", 0x20000, 0x3d98ad1e, 5 | BRF_GRA }, // 12 Sprites + { "tr-10a.bin", 0x20000, 0x8f6f03d7, 5 | BRF_GRA }, // 13 + { "tr-11a.bin", 0x20000, 0xcd9152e5, 5 | BRF_GRA }, // 14 + { "tr-12a.bin", 0x20000, 0x7d8a99d0, 5 | BRF_GRA }, // 15 + + { "tr13.bin", 0x08000, 0xa79be1eb, 6 | BRF_GRA }, // 16 Background Tilemaps + + { "trprom.bin", 0x00100, 0xec80ae36, 7 | BRF_GRA | BRF_OPT }, // 17 Priority Proms (unused) +}; + +STD_ROM_PICK(tigeroad) +STD_ROM_FN(tigeroad) + +static INT32 TigeroadLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x20000, 4 + i, 1)) return 1; + } + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvGfxROM2 + i * 0x20000, 12 + i, 1)) return 1; + } + + if (BurnLoadRom(DrvGfxROM3 + 0x00000, 16, 1)) return 1; + + if (toramich) if (BurnLoadRom(DrvSndROM + 0x000000, 18, 1)) return 1; + + return 0; +} + +static INT32 TigeroadInit() +{ + return DrvInit(TigeroadLoadRoms); +} + +struct BurnDriver BurnDrvTigeroad = { + "tigeroad", NULL, NULL, NULL, "1987", + "Tiger Road (US)\0", NULL, "Capcom (Romstar license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT | GBF_PLATFORM, 0, + NULL, tigeroadRomInfo, tigeroadRomName, NULL, NULL, TigeroadInputInfo, TigeroadDIPInfo, + TigeroadInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, + 256, 224, 4, 3 +}; + + +// Tora e no Michi (Japan) + +static struct BurnRomInfo toramichRomDesc[] = { + { "tr_02.bin", 0x20000, 0xb54723b1, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tr_04.bin", 0x20000, 0xab432479, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "tr_05.bin", 0x08000, 0x3ebe6e62, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "tr01.bin", 0x08000, 0x74a9f08c, 3 | BRF_GRA }, // 3 Character Tiles + + { "tr-01a.bin", 0x20000, 0xa8aa2e59, 4 | BRF_GRA }, // 4 Background Tiles + { "tr-04a.bin", 0x20000, 0x8863a63c, 4 | BRF_GRA }, // 5 + { "tr-02a.bin", 0x20000, 0x1a2c5f89, 4 | BRF_GRA }, // 6 + { "tr05.bin", 0x20000, 0x5bf453b3, 4 | BRF_GRA }, // 7 + { "tr-03a.bin", 0x20000, 0x1e0537ea, 4 | BRF_GRA }, // 8 + { "tr-06a.bin", 0x20000, 0xb636c23a, 4 | BRF_GRA }, // 9 + { "tr-07a.bin", 0x20000, 0x5f907d4d, 4 | BRF_GRA }, // 10 + { "tr08.bin", 0x20000, 0xadee35e2, 4 | BRF_GRA }, // 11 + + { "tr-09a.bin", 0x20000, 0x3d98ad1e, 5 | BRF_GRA }, // 12 Sprites + { "tr-10a.bin", 0x20000, 0x8f6f03d7, 5 | BRF_GRA }, // 13 + { "tr-11a.bin", 0x20000, 0xcd9152e5, 5 | BRF_GRA }, // 14 + { "tr-12a.bin", 0x20000, 0x7d8a99d0, 5 | BRF_GRA }, // 15 + + { "tr13.bin", 0x08000, 0xa79be1eb, 6 | BRF_GRA }, // 16 Background Tilemaps + + { "trprom.bin", 0x00100, 0xec80ae36, 7 | BRF_GRA | BRF_OPT }, // 17 Priority Proms (unused) + + { "tr_03.bin", 0x10000, 0xea1807ef, 8 | BRF_PRG | BRF_ESS }, // 18 Sample Z80 Code +}; + +STD_ROM_PICK(toramich) +STD_ROM_FN(toramich) + +static INT32 ToramichInit() +{ + toramich = 1; + + return DrvInit(TigeroadLoadRoms); +} + +struct BurnDriver BurnDrvToramich = { + "toramich", "tigeroad", NULL, NULL, "1987", + "Tora e no Michi (Japan)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT | GBF_PLATFORM, 0, + NULL, toramichRomInfo, toramichRomName, NULL, NULL, TigeroadInputInfo, ToramichDIPInfo, + ToramichInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, + 256, 224, 4, 3 +}; + + +// Tiger Road (US bootleg) + +static struct BurnRomInfo tigerodbRomDesc[] = { + { "tgrroad.3", 0x10000, 0x14c87e07, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tgrroad.5", 0x10000, 0x0904254c, 1 | BRF_PRG | BRF_ESS }, // 1 + { "tgrroad.2", 0x10000, 0xcedb1f46, 1 | BRF_PRG | BRF_ESS }, // 2 + { "tgrroad.4", 0x10000, 0xe117f0b1, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "tru05.bin", 0x08000, 0xf9a7c9bf, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "tr01.bin", 0x08000, 0x74a9f08c, 3 | BRF_GRA }, // 5 Character Tiles + + { "tr-01a.bin", 0x20000, 0xa8aa2e59, 4 | BRF_GRA }, // 6 Background Tiles + { "tr-04a.bin", 0x20000, 0x8863a63c, 4 | BRF_GRA }, // 7 + { "tr-02a.bin", 0x20000, 0x1a2c5f89, 4 | BRF_GRA }, // 8 + { "tr05.bin", 0x20000, 0x5bf453b3, 4 | BRF_GRA }, // 9 + { "tr-03a.bin", 0x20000, 0x1e0537ea, 4 | BRF_GRA }, // 10 + { "tr-06a.bin", 0x20000, 0xb636c23a, 4 | BRF_GRA }, // 11 + { "tr-07a.bin", 0x20000, 0x5f907d4d, 4 | BRF_GRA }, // 12 + { "tgrroad.17", 0x10000, 0x3f7539cc, 4 | BRF_GRA }, // 13 + { "tgrroad.18", 0x10000, 0xe2e053cb, 4 | BRF_GRA }, // 14 + + { "tr-09a.bin", 0x20000, 0x3d98ad1e, 5 | BRF_GRA }, // 15 Sprites + { "tr-10a.bin", 0x20000, 0x8f6f03d7, 5 | BRF_GRA }, // 16 + { "tr-11a.bin", 0x20000, 0xcd9152e5, 5 | BRF_GRA }, // 17 + { "tr-12a.bin", 0x20000, 0x7d8a99d0, 5 | BRF_GRA }, // 18 + + { "tr13.bin", 0x08000, 0xa79be1eb, 6 | BRF_GRA }, // 19 Background Tilemaps + + { "trprom.bin", 0x00100, 0xec80ae36, 7 | BRF_GRA | BRF_OPT }, // 20 Priority Proms (unused) +}; + +STD_ROM_PICK(tigerodb) +STD_ROM_FN(tigerodb) + +static INT32 TigerodbLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 1)) return 1; + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x20000, 6 + i, 1)) return 1; + } + + if (BurnLoadRom(DrvGfxROM1 + 0xf0000, 14, 1)) return 1; + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvGfxROM2 + i * 0x20000, 15 + i, 1)) return 1; + } + + if (BurnLoadRom(DrvGfxROM3 + 0x00000, 19, 1)) return 1; + + return 0; +} + +static INT32 TigerodbInit() +{ + return DrvInit(TigerodbLoadRoms); +} + +struct BurnDriver BurnDrvTigerodb = { + "tigeroadb", "tigeroad", NULL, NULL, "1987", + "Tiger Road (US bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_SCRFIGHT | GBF_PLATFORM, 0, + NULL, tigerodbRomInfo, tigerodbRomName, NULL, NULL, TigeroadInputInfo, TigeroadDIPInfo, + TigerodbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, + 256, 224, 4, 3 +}; + + +// F-1 Dream + +static struct BurnRomInfo f1dreamRomDesc[] = { + { "06j_02.bin", 0x20000, 0x3c2ec697, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "06k_03.bin", 0x20000, 0x85ebad91, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "12k_04.bin", 0x08000, 0x4b9a7524, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "10d_01.bin", 0x08000, 0x361caf00, 3 | BRF_GRA }, // 3 Character Tiles + + { "03f_12.bin", 0x10000, 0xbc13e43c, 4 | BRF_GRA }, // 4 Background Tiles + { "01f_10.bin", 0x10000, 0xf7617ad9, 4 | BRF_GRA }, // 5 + { "03h_14.bin", 0x10000, 0xe33cd438, 4 | BRF_GRA }, // 6 + { "02f_11.bin", 0x10000, 0x4aa49cd7, 4 | BRF_GRA }, // 7 + { "17f_09.bin", 0x10000, 0xca622155, 4 | BRF_GRA }, // 8 + { "02h_13.bin", 0x10000, 0x2a63961e, 4 | BRF_GRA }, // 9 + + { "03b_06.bin", 0x10000, 0x5e54e391, 5 | BRF_GRA }, // 10 Sprites + { "02b_05.bin", 0x10000, 0xcdd119fd, 5 | BRF_GRA }, // 11 + { "03d_08.bin", 0x10000, 0x811f2e22, 5 | BRF_GRA }, // 12 + { "02d_07.bin", 0x10000, 0xaa9a1233, 5 | BRF_GRA }, // 13 + + { "07l_15.bin", 0x08000, 0x978758b7, 6 | BRF_GRA }, // 14 Background Tilemaps + + { "09e_tr.bin", 0x00100, 0xec80ae36, 7 | BRF_GRA | BRF_OPT }, // 15 Priority Proms (unused) + + { "c8751h-88", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(f1dream) +STD_ROM_FN(f1dream) + +static INT32 F1dreamLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; + + for (INT32 i = 0; i < 3; i++) { + if (BurnLoadRom(DrvGfxROM1 + 0x00000 + i * 0x10000, 4 + i, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x80000 + i * 0x10000, 7 + i, 1)) return 1; + } + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvGfxROM2 + i * 0x20000, 10 + i, 1)) return 1; + } + + if (BurnLoadRom(DrvGfxROM3 + 0x00000, 14, 1)) return 1; + + return 0; +} + +static INT32 F1dreamInit() +{ + nF1dream = 1; + + return DrvInit(F1dreamLoadRoms); +} + +struct BurnDriver BurnDrvF1dream = { + "f1dream", NULL, NULL, NULL, "1988", + "F-1 Dream\0", NULL, "Capcom (Romstar license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, + NULL, f1dreamRomInfo, f1dreamRomName, NULL, NULL, TigeroadInputInfo, F1dreamDIPInfo, + F1dreamInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, + 256, 224, 4, 3 +}; + + +// F-1 Dream (bootleg) + +static struct BurnRomInfo f1dreambRomDesc[] = { + { "f1d_04.bin", 0x10000, 0x903febad, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "f1d_05.bin", 0x10000, 0x666fa2a7, 1 | BRF_PRG | BRF_ESS }, // 1 + { "f1d_02.bin", 0x10000, 0x98973c4c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "f1d_03.bin", 0x10000, 0x3d21c78a, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "12k_04.bin", 0x08000, 0x4b9a7524, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "10d_01.bin", 0x08000, 0x361caf00, 3 | BRF_GRA }, // 5 Character Tiles + + { "03f_12.bin", 0x10000, 0xbc13e43c, 4 | BRF_GRA }, // 6 Background Tiles + { "01f_10.bin", 0x10000, 0xf7617ad9, 4 | BRF_GRA }, // 7 + { "03h_14.bin", 0x10000, 0xe33cd438, 4 | BRF_GRA }, // 8 + { "02f_11.bin", 0x10000, 0x4aa49cd7, 4 | BRF_GRA }, // 9 + { "17f_09.bin", 0x10000, 0xca622155, 4 | BRF_GRA }, // 10 + { "02h_13.bin", 0x10000, 0x2a63961e, 4 | BRF_GRA }, // 11 + + { "03b_06.bin", 0x10000, 0x5e54e391, 5 | BRF_GRA }, // 12 Sprites + { "02b_05.bin", 0x10000, 0xcdd119fd, 5 | BRF_GRA }, // 13 + { "03d_08.bin", 0x10000, 0x811f2e22, 5 | BRF_GRA }, // 14 + { "02d_07.bin", 0x10000, 0xaa9a1233, 5 | BRF_GRA }, // 15 + + { "07l_15.bin", 0x08000, 0x978758b7, 6 | BRF_GRA }, // 16 Background Tilemaps + + { "09e_tr.bin", 0x00100, 0xec80ae36, 7 | BRF_GRA | BRF_OPT }, // 17 Priority Proms (unused) +}; + +STD_ROM_PICK(f1dreamb) +STD_ROM_FN(f1dreamb) + +static INT32 F1dreambLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x020000, 3, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 1)) return 1; + + for (INT32 i = 0; i < 3; i++) { + if (BurnLoadRom(DrvGfxROM1 + 0x00000 + i * 0x10000, 6 + i, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x80000 + i * 0x10000, 9 + i, 1)) return 1; + } + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvGfxROM2 + i * 0x20000, 12 + i, 1)) return 1; + } + + if (BurnLoadRom(DrvGfxROM3 + 0x00000, 16, 1)) return 1; + + return 0; +} + +static INT32 F1dreambInit() +{ + return DrvInit(F1dreambLoadRoms); +} + +struct BurnDriver BurnDrvF1dreamb = { + "f1dreamb", "f1dream", NULL, NULL, "1988", + "F-1 Dream (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARWARE_CAPCOM_MISC, GBF_RACING, 0, + NULL, f1dreambRomInfo, f1dreambRomName, NULL, NULL, TigeroadInputInfo, F1dreamDIPInfo, + F1dreambInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, + 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_toki.cpp b/src/burn/drv/pre90s/d_toki.cpp index 9527d826e..68973515e 100644 --- a/src/burn/drv/pre90s/d_toki.cpp +++ b/src/burn/drv/pre90s/d_toki.cpp @@ -1,2042 +1,2039 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "msm6295.h" -#include "msm5205.h" -#include "bitswap.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80DecROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf; -static UINT8 *DrvBg1RAM; -static UINT8 *DrvBg2RAM; -static UINT8 *DrvFgRAM; -static UINT8 *DrvScrollRAM; - -static UINT8 DrvReset; -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[2]; -static UINT8 DrvDips[2]; -static UINT16 DrvInps[2]; - -static UINT32 *DrvPalette; -static UINT32 *Palette; - -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; - -static UINT8 main2sub[2],sub2main[2]; -static INT32 main2sub_pending,sub2main_pending; - -static INT32 is_bootleg = 0; - -static UINT8 TokibMSM5205Next = 0; -static UINT8 TokibMSM5205Toggle = 0; - -static INT32 nCyclesTotal[2] = { 10000000 / 60, 3579545 / 60 }; - -static struct BurnInputInfo TokiInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 3, "p1 start"}, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 4, "p2 start"}, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(Toki) - -static struct BurnDIPInfo TokiDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xdf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 20, "Coinage" }, - {0x12, 0x01, 0x1f, 0x15, "6 Coins 1 Credits " }, - {0x12, 0x01, 0x1f, 0x17, "5 Coins 1 Credits " }, - {0x12, 0x01, 0x1f, 0x19, "4 Coins 1 Credits " }, - {0x12, 0x01, 0x1f, 0x1b, "3 Coins 1 Credits " }, - {0x12, 0x01, 0x1f, 0x03, "8 Coins 3 Credits " }, - {0x12, 0x01, 0x1f, 0x1d, "2 Coins 1 Credits " }, - {0x12, 0x01, 0x1f, 0x05, "5 Coins 3 Credits " }, - {0x12, 0x01, 0x1f, 0x07, "3 Coins 2 Credits " }, - {0x12, 0x01, 0x1f, 0x1f, "1 Coin 1 Credits " }, - {0x12, 0x01, 0x1f, 0x09, "2 Coins 3 Credits " }, - {0x12, 0x01, 0x1f, 0x13, "1 Coin 2 Credits " }, - {0x12, 0x01, 0x1f, 0x11, "1 Coin 3 Credits " }, - {0x12, 0x01, 0x1f, 0x0f, "1 Coin 4 Credits " }, - {0x12, 0x01, 0x1f, 0x0d, "1 Coin 5 Credits " }, - {0x12, 0x01, 0x1f, 0x0b, "1 Coin 6 Credits " }, - {0x12, 0x01, 0x1f, 0x1e, "A 1/1 B 1/2" }, - {0x12, 0x01, 0x1f, 0x14, "A 2/1 B 1/3" }, - {0x12, 0x01, 0x1f, 0x0a, "A 3/1 B 1/5" }, - {0x12, 0x01, 0x1f, 0x00, "A 5/1 B 1/6" }, - {0x12, 0x01, 0x1f, 0x01, "Free_Play" }, - - {0 , 0xfe, 0 , 2, "Joysticks" }, - {0x12, 0x01, 0x20, 0x20, "1" }, - {0x12, 0x01, 0x20, 0x00, "2" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x40, 0x40, "Upright" }, - {0x12, 0x01, 0x40, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip_Screen" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x02, "2" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "Infinite (Cheat)" }, - - {0 , 0xfe, 0 , 4, "Bonus_Life" }, - {0x13, 0x01, 0x0c, 0x08, "50000 150000" }, - {0x13, 0x01, 0x0c, 0x00, "70000 140000 210000" }, - {0x13, 0x01, 0x0c, 0x0c, "70000" }, - {0x13, 0x01, 0x0c, 0x04, "100000 200000" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x30, 0x20, "Easy" }, - {0x13, 0x01, 0x30, 0x30, "Medium" }, - {0x13, 0x01, 0x30, 0x10, "Hard" }, - {0x13, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Allow_Continue" }, - {0x13, 0x01, 0x40, 0x00, "No" }, - {0x13, 0x01, 0x40, 0x40, "Yes" }, - - {0 , 0xfe, 0 , 2, "Demo_Sounds" }, - {0x13, 0x01, 0x80, 0x00, "Off" }, - {0x13, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Toki) - -static struct BurnInputInfo TokibInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 3, "p1 start"}, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 4, "p2 start"}, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, -}; - -STDINPUTINFO(Tokib) - - -static struct BurnDIPInfo TokibDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xdf, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 20, "Coinage" }, - {0x12, 0x01, 0x1f, 0x15, "6 Coins 1 Credits " }, - {0x12, 0x01, 0x1f, 0x17, "5 Coins 1 Credits " }, - {0x12, 0x01, 0x1f, 0x19, "4 Coins 1 Credits " }, - {0x12, 0x01, 0x1f, 0x1b, "3 Coins 1 Credits " }, - {0x12, 0x01, 0x1f, 0x03, "8 Coins 3 Credits " }, - {0x12, 0x01, 0x1f, 0x1d, "2 Coins 1 Credits " }, - {0x12, 0x01, 0x1f, 0x05, "5 Coins 3 Credits " }, - {0x12, 0x01, 0x1f, 0x07, "3 Coins 2 Credits " }, - {0x12, 0x01, 0x1f, 0x1f, "1 Coin 1 Credits " }, - {0x12, 0x01, 0x1f, 0x09, "2 Coins 3 Credits " }, - {0x12, 0x01, 0x1f, 0x13, "1 Coin 2 Credits " }, - {0x12, 0x01, 0x1f, 0x11, "1 Coin 3 Credits " }, - {0x12, 0x01, 0x1f, 0x0f, "1 Coin 4 Credits " }, - {0x12, 0x01, 0x1f, 0x0d, "1 Coin 5 Credits " }, - {0x12, 0x01, 0x1f, 0x0b, "1 Coin 6 Credits " }, - {0x12, 0x01, 0x1f, 0x1e, "A 1/1 B 1/2" }, - {0x12, 0x01, 0x1f, 0x14, "A 2/1 B 1/3" }, - {0x12, 0x01, 0x1f, 0x0a, "A 3/1 B 1/5" }, - {0x12, 0x01, 0x1f, 0x00, "A 5/1 B 1/6" }, - {0x12, 0x01, 0x1f, 0x01, "Free_Play" }, - - {0 , 0xfe, 0 , 2, "Joysticks" }, - {0x12, 0x01, 0x20, 0x20, "1" }, - {0x12, 0x01, 0x20, 0x00, "2" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x40, 0x40, "Upright" }, - {0x12, 0x01, 0x40, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip_Screen" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x02, "2" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - {0x13, 0x01, 0x03, 0x00, "Infinite (Cheat)" }, - - {0 , 0xfe, 0 , 4, "Bonus_Life" }, - {0x13, 0x01, 0x0c, 0x08, "50000 150000" }, - {0x13, 0x01, 0x0c, 0x00, "70000 140000 210000" }, - {0x13, 0x01, 0x0c, 0x0c, "70000" }, - {0x13, 0x01, 0x0c, 0x04, "100000 200000" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x30, 0x20, "Easy" }, - {0x13, 0x01, 0x30, 0x30, "Medium" }, - {0x13, 0x01, 0x30, 0x10, "Hard" }, - {0x13, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Allow_Continue" }, - {0x13, 0x01, 0x40, 0x00, "No" }, - {0x13, 0x01, 0x40, 0x40, "Yes" }, - - {0 , 0xfe, 0 , 2, "Demo_Sounds" }, - {0x13, 0x01, 0x80, 0x00, "Off" }, - {0x13, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Tokib) - -static void palette_write(INT32 offset) -{ - UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset))); - - UINT8 r, g, b; - -// 4b4g4r handler - - r = (data & 0x0f); - r |= r << 4; - - g = (data & 0xf0); - g |= g >> 4; - - b = (data >> 8) & 0x0f; - b |= b << 4; - - Palette[offset >> 1] = (r << 16) | (g << 8) | b; - DrvPalette[offset >> 1] = BurnHighCol(r, g, b, 0); -} - -enum -{ - VECTOR_INIT, - RST10_ASSERT, - RST10_CLEAR, - RST18_ASSERT, - RST18_CLEAR -}; - -static void update_irq_lines(INT32 param) -{ - static INT32 irq1,irq2; - - switch(param) - { - case VECTOR_INIT: - irq1 = irq2 = 0xff; - break; - - case RST10_ASSERT: - irq1 = 0xd7; - break; - - case RST10_CLEAR: - irq1 = 0xff; - break; - - case RST18_ASSERT: - irq2 = 0xdf; - break; - - case RST18_CLEAR: - irq2 = 0xff; - break; - } - - if ((irq1 & irq2) == 0xff) { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } else { - if (irq2 == 0xdf) { // this shouldn't be required - Raiden needs it too though??? - ZetSetVector(irq1 & irq2); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } - } -} - -UINT8 seibu_main_word_r(INT32 offset) -{ - offset = (offset >> 1) & 7; - - switch (offset) - { - case 2: - case 3: - return sub2main[offset-2]; - case 5: - return main2sub_pending ? 1 : 0; - default: - return 0xff; - } -} - -void seibu_main_word_w(INT32 offset, UINT8 data) -{ - offset = (offset >> 1) & 7; - - switch (offset) - { - case 0: - case 1: - main2sub[offset] = data; - break; - case 4: - if (!is_bootleg) update_irq_lines(RST18_ASSERT); - break; - case 6: - /* just a guess */ - sub2main_pending = 0; - main2sub_pending = 1; - break; - default: - break; - } -} - -void __fastcall tokib_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xff800) == 0x6e000) { - DrvPalRAM[address & 0x7ff] = data; - - palette_write(address & 0x7fe); - - return; - } - - if (address >= 0x7180e && address <= 0x71e45) { - address ^= 1; - if (is_bootleg) DrvSprRAM[address & 0x7ff] = data; - return; - } - - if (address >= 0xa0000 && address <= 0xa0057) { - if (!is_bootleg)DrvScrollRAM[address & 0x3ff] = data; - return; - } - - switch (address) - { - case 0x71000: - case 0x71001: - // nop - return; - - - case 0x75000: - case 0x75001: { - *soundlatch = data & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - - case 0x75004: - case 0x75005: - case 0x75006: - case 0x75007: - case 0x75008: - case 0x75009: - case 0x7500a: - case 0x7500b: - if (is_bootleg) DrvScrollRAM[address-0x75004] = data; - return; - - case 0x80000: - case 0x80001: - case 0x80002: - case 0x80003: - case 0x80004: - case 0x80005: - case 0x80006: - case 0x80007: - case 0x80008: - case 0x80009: - case 0x8000a: - case 0x8000b: - case 0x8000c: - case 0x8000d: { - seibu_main_word_w(address, data); - return; - } - } -} - -void __fastcall tokib_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xff800) == 0x6e000) { - *((UINT16*)(DrvPalRAM + (address & 0x7fe))) = BURN_ENDIAN_SWAP_INT16(data); - - palette_write(address & 0x7fe); - - return; - } - - if (address >= 0x7180e && address <= 0x71e45) { - if (is_bootleg)*((UINT16*)(DrvSprRAM + (address & 0x7fe))) = BURN_ENDIAN_SWAP_INT16(data); - return; - } - - if (address >= 0xa0000 && address <= 0xa0057) { - if (!is_bootleg)*((UINT16*)(DrvScrollRAM + (address & 0x3fe))) = BURN_ENDIAN_SWAP_INT16(data); - return; - } - - switch (address) - { - case 0x71000: - // nop - return; - - - case 0x75000: { - *soundlatch = data & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - - case 0x75004: - case 0x75006: - case 0x75008: - case 0x7500a: - if (is_bootleg)*((UINT16*)(DrvScrollRAM + (address - 0x75004))) = BURN_ENDIAN_SWAP_INT16(data); - return; - - - case 0x80000: - case 0x80001: - case 0x80002: - case 0x80003: - case 0x80004: - case 0x80005: - case 0x80006: - case 0x80007: - case 0x80008: - case 0x80009: - case 0x8000a: - case 0x8000b: - case 0x8000c: - case 0x8000d: { - seibu_main_word_w(address, data); - return; - } - -// AM_RANGE(0x080000, 0x08000d) AM_READWRITE(seibu_main_word_r, seibu_main_word_w) - - } -} - -UINT8 __fastcall tokib_read_byte(UINT32 address) -{ - switch (address) - { - case 0x72000: - case 0x72001: - return 0;// watchdog reset - - case 0x80000: - case 0x80001: - case 0x80002: - case 0x80003: - case 0x80004: - case 0x80005: - case 0x80006: - case 0x80007: - case 0x80008: - case 0x80009: - case 0x8000a: - case 0x8000b: - case 0x8000c: - case 0x8000d: { - return seibu_main_word_r(address); - } - - case 0xc0000: - case 0xc0001: - return DrvDips[~address & 1]; - - case 0xc0002: return DrvInps[0] >> 8; - case 0xc0003: return DrvInps[0] & 0xff; - - case 0xc0004: return DrvInps[1] >> 8; - case 0xc0005: return DrvInps[1] & 0xff; - - case 0xc000e: - case 0xc000f: - return 0xff; - } - - return 0; -} - -UINT16 __fastcall tokib_read_word(UINT32 address) -{ - switch (address) - { - case 0x72000: - return 0;// watchdog reset - - case 0x80000: - case 0x80001: - case 0x80002: - case 0x80003: - case 0x80004: - case 0x80005: - case 0x80006: - case 0x80007: - case 0x80008: - case 0x80009: - case 0x8000a: - case 0x8000b: - case 0x8000c: - case 0x8000d: { - return seibu_main_word_r(address); - } - - case 0xc0000: - return (DrvDips[1] << 8) | (DrvDips[0]); - - case 0xc0002: - return DrvInps[0]; - - case 0xc0004: - return DrvInps[1]; - - case 0xc000e: - return 0xffff; - } - - return 0; -} - - -static void seibu_z80_bank(INT32 bank) -{ - INT32 nBank = bank & 1; - - ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + 0x10000 + nBank * 0x8000); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + 0x10000 + nBank * 0x8000); -} - -void __fastcall toki_seibu_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x4000: - main2sub_pending = 0; - sub2main_pending = 1; - return; - - case 0x4001: - update_irq_lines(VECTOR_INIT); - return; - - case 0x4002: - //seibu_rst10_ack_w - unused - return; - - case 0x4003: - update_irq_lines(RST18_CLEAR); - return; - - case 0x4007: - seibu_z80_bank(data); - return; - - case 0x4008: - BurnYM3812Write(0, data); - return; - - - case 0x4009: - BurnYM3812Write(1, data); - return; - - case 0x4018: - case 0x4019: - sub2main[address & 1] = data; - return; - - - case 0x401b: - //seibu_coin_w - return; - - - case 0x6000: - MSM6295Command(0, data); - return; - } - - bprintf (PRINT_NORMAL, _T("%4.4x, %2.2x\n"), address, data); -} - -UINT8 __fastcall toki_seibu_sound_read(UINT16 address) -{ - switch (address) - { - case 0x4008: - return BurnYM3812Read(0); - - case 0x4010: - case 0x4011: - return main2sub[address & 1]; - - case 0x4012: - return sub2main_pending ? 1 : 0; - - case 0x4013: - return (DrvJoy3[1] << 1) | DrvJoy3[0]; // COIN - - case 0x6000: - return MSM6295ReadStatus(0); - } - - bprintf (PRINT_NORMAL, _T("%4.4x,\n"), address); - - return 0; -} - -static void toki_adpcm_control_w(INT32 data) -{ - INT32 bankaddress = data & 1; - - UINT8 *RAM = DrvZ80ROM + 0x8000 + bankaddress * 0x4000; - - - /* the code writes either 2 or 3 in the bottom two bits */ -// bankaddress = 0x10000 + (data & 0x01) * 0x4000; -// memory_set_bankptr(1,&RAM[bankaddress]); - - ZetMapArea(0x8000, 0xbfff, 0, RAM); - ZetMapArea(0x8000, 0xbfff, 2, RAM); - - - MSM5205ResetWrite(0, data & 0x08); -} - - -void __fastcall tokib_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe000: - toki_adpcm_control_w(data); - return; - - case 0xe400: - TokibMSM5205Next = data; - return; - - case 0xec00: - case 0xec08: - BurnYM3812Write(0, data); - return; - - case 0xec01: - case 0xec09: - BurnYM3812Write(1, data); - return; - } -} - -UINT8 __fastcall tokib_sound_read(UINT16 address) -{ - switch (address) - { - case 0xec00: - return BurnYM3812Read(0); - - case 0xf800: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - if (!is_bootleg) update_irq_lines(VECTOR_INIT); - ZetClose(); - - BurnYM3812Reset(); - if (!is_bootleg) MSM6295Reset(0); - - return 0; -} - -static INT32 TokibDoReset() -{ - TokibMSM5205Next = 0; - TokibMSM5205Toggle = 0; - - MSM5205Reset(); - - return DrvDoReset(); -} - - -static void tokib_rom_decode() -{ - UINT8 *temp = (UINT8*)malloc(65536 * 2); - INT32 i, offs, len; - UINT8 *rom; - - /* invert the sprite data in the ROMs */ - len = 0x100000; - rom = DrvGfxROM1; - for (i = 0; i < len; i++) - rom[i] ^= 0xff; - - /* merge background tile graphics together */ - len = 0x080000; - rom = DrvGfxROM2; - for (offs = 0; offs < len; offs += 0x20000) - { - UINT8 *base = &rom[offs]; - memcpy (temp, base, 65536 * 2); - for (i = 0; i < 16; i++) - { - memcpy (&base[0x00000 + i * 0x800], &temp[0x0000 + i * 0x2000], 0x800); - memcpy (&base[0x10000 + i * 0x800], &temp[0x0800 + i * 0x2000], 0x800); - memcpy (&base[0x08000 + i * 0x800], &temp[0x1000 + i * 0x2000], 0x800); - memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800); - } - } - len = 0x080000; - rom = DrvGfxROM3; - for (offs = 0; offs < len; offs += 0x20000) - { - UINT8 *base = &rom[offs]; - memcpy (temp, base, 65536 * 2); - for (i = 0; i < 16; i++) - { - memcpy (&base[0x00000 + i * 0x800], &temp[0x0000 + i * 0x2000], 0x800); - memcpy (&base[0x10000 + i * 0x800], &temp[0x0800 + i * 0x2000], 0x800); - memcpy (&base[0x08000 + i * 0x800], &temp[0x1000 + i * 0x2000], 0x800); - memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800); - } - } - - if (temp) { - free (temp); - temp = NULL; - } -} - - - - - - - -static INT32 TokibGfxDecode() -{ - INT32 Plane0[4] = { 4096*8*8*3, 4096*8*8*2, 4096*8*8*1, 4096*8*8*0 }; // char - INT32 Plane1[4] = { 8192*16*16*3,8192*16*16*2,8192*16*16*1,8192*16*16*0 }; // spr - INT32 Plane2[4] = { 4096*16*16*3,4096*16*16*2,4096*16*16*1,4096*16*16*0 }; // tile -// char & spr - INT32 XOffs0[16] = { 0, 1, 2, 3, 4, 5, 6, 7, - 128+0, 128+1, 128+2, 128+3, 128+4, 128+5, 128+6, 128+7 }; - INT32 YOffs0[16] = { 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120 }; - -// tiles - INT32 XOffs1[16] = { 0, 1, 2, 3, 4, 5, 6, 7, - 0x8000*8+0, 0x8000*8+1, 0x8000*8+2, 0x8000*8+3, 0x8000*8+4, - 0x8000*8+5, 0x8000*8+6, 0x8000*8+7 }; - - INT32 YOffs1[32] = { 0,8,16,24,32,40,48,56, - 0x10000*8+ 0, 0x10000*8+ 8, 0x10000*8+16, 0x10000*8+24, 0x10000*8+32, - 0x10000*8+40, 0x10000*8+48, 0x10000*8+56 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x020000); - - GfxDecode(4096, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x040, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x100000); - - GfxDecode(8192, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x100, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x080000); - - GfxDecode(4096, 4, 16, 16, Plane2, XOffs1, YOffs1, 0x040, tmp, DrvGfxROM2); - - memcpy (tmp, DrvGfxROM3, 0x080000); - - GfxDecode(4096, 4, 16, 16, Plane2, XOffs1, YOffs1, 0x040, tmp, DrvGfxROM3); - - BurnFree (tmp); - - return 0; -} - - - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x060000; - - DrvZ80ROM = Next; Next += 0x020000; - DrvZ80DecROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x040000; - DrvGfxROM1 = Next; Next += 0x200000; - DrvGfxROM2 = Next; Next += 0x100000; - DrvGfxROM3 = Next; Next += 0x100000; - - DrvSndROM = Next; Next += 0x020000; - - DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); - - AllRam = Next; - - DrvBg1RAM = Next; Next += 0x000800; - DrvBg2RAM = Next; Next += 0x000800; - DrvFgRAM = Next; Next += 0x000800; - Drv68KRAM = Next; Next += 0x00e000; - DrvZ80RAM = Next; Next += 0x000800; - DrvPalRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x000800; - DrvSprBuf = Next; Next += 0x000800; - - DrvScrollRAM = Next; Next += 0x000060 + 0x3b0; // + buffer space - - soundlatch = Next; Next += 0x000001; - - Palette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3579545; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - update_irq_lines(RST10_ASSERT); - } else { - update_irq_lines(RST10_CLEAR); - } -} - -inline static INT32 TokibSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)((double)ZetTotalCycles() * nSoundRate / 4000000); -} - -static void toki_adpcm_int() -{ - MSM5205DataWrite(0, TokibMSM5205Next); - TokibMSM5205Next >>= 4; - - TokibMSM5205Toggle ^= 1; - if (TokibMSM5205Toggle) ZetNmi(); -} - -static INT32 TokibInit() -{ - is_bootleg = 1; - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; - - for (INT32 i = 0; i < 4; i++) - if (BurnLoadRom(DrvGfxROM0 + i * 0x8000, 5 + i, 1)) return 1; - - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x20000, 9 + i, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + i * 0x10000, 17 + i, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + i * 0x10000, 25 + i, 1)) return 1; - } - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 4, 1)) return 1; - - tokib_rom_decode(); - - TokibGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x060000, 0x06dfff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x06e000, 0x06e7ff, SM_ROM); // 4b4g4r handler - SekMapMemory(DrvBg1RAM, 0x06e800, 0x06efff, SM_RAM); - SekMapMemory(DrvBg2RAM, 0x06f000, 0x06f7ff, SM_RAM); - SekMapMemory(DrvFgRAM, 0x06f800, 0x06ffff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x071800, 0x0718ff, SM_ROM); // allow writes to 0x7180e - 0x71e45 - SekSetWriteByteHandler(0, tokib_write_byte); - SekSetWriteWordHandler(0, tokib_write_word); - SekSetReadByteHandler(0, tokib_read_byte); - SekSetReadWordHandler(0, tokib_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x8000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x8000); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(tokib_sound_write); - ZetSetReadHandler(tokib_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM3812Init(3579545, NULL, &TokibSynchroniseStream, 0); - BurnTimerAttachZetYM3812(3579545); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - MSM5205Init(0, TokibSynchroniseStream, 384000, toki_adpcm_int, MSM5205_S96_4B, 1); - MSM5205SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - TokibDoReset(); - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 4096*16*8+0, 4096*16*8+4, 0, 4 }; // char - INT32 Plane1[4] = { 2*4, 3*4, 0*4, 1*4 }; // spr, tile - INT32 XOffs0[8] = { 3, 2, 1, 0, 8+3, 8+2, 8+1, 8+0 }; // char - INT32 YOffs0[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }; - -// tiles - INT32 XOffs1[16] = { 3, 2, 1, 0, 16+3, 16+2, 16+1, 16+0, - 64*8+3, 64*8+2, 64*8+1, 64*8+0, 64*8+16+3, 64*8+16+2, 64*8+16+1, 64*8+16+0 }; - - INT32 YOffs1[32] = { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, - 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x020000); - - GfxDecode(4096, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x080, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x100000); - - GfxDecode(8192, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x080000); - - GfxDecode(4096, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, tmp, DrvGfxROM2); - - memcpy (tmp, DrvGfxROM3, 0x080000); - - GfxDecode(4096, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, tmp, DrvGfxROM3); - - BurnFree (tmp); - - return 0; -} - -static UINT8 decrypt_data(INT32 a,INT32 src) -{ - if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; - if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; - if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; - if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; - if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; - - if (BIT(a,13) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,3,2,0,1); - if (BIT(a, 8) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,2,3,1,0); - - return src; -} - -static UINT8 decrypt_opcode(INT32 a,INT32 src) -{ - if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; - if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; - if (~BIT(a,13) & BIT(a,12)) src ^= 0x20; - if (~BIT(a,6) & BIT(a,1)) src ^= 0x10; - if (~BIT(a,12) & BIT(a,2)) src ^= 0x08; - if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; - if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; - if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; - - if (BIT(a,13) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,3,2,0,1); - if (BIT(a, 8) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,2,3,1,0); - if (BIT(a,12) & BIT(a,9)) src = BITSWAP08(src,7,6,4,5,3,2,1,0); - if (BIT(a,11) & ~BIT(a,6)) src = BITSWAP08(src,6,7,5,4,3,2,1,0); - - return src; -} - -static void seibu_sound_decrypt(INT32 length) -{ - UINT8 *decrypt = DrvZ80DecROM; - UINT8 *rom = DrvZ80ROM; - INT32 i; - - for (i = 0;i < length;i++) - { - UINT8 src = rom[i]; - - rom[i] = decrypt_data(i,src); - decrypt[i] = decrypt_opcode(i,src); - } -} - -static INT32 DrvInit() -{ - is_bootleg = 0; - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x10000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x10000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x80000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x00000, 11, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x00000, 12, 1)) return 1; - - seibu_sound_decrypt(0x2000); - - DrvGfxDecode(); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x060000, 0x06d7ff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x06d800, 0x06dfff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x06e000, 0x06e7ff, SM_ROM); // 4b4g4r handler - SekMapMemory(DrvBg1RAM, 0x06e800, 0x06efff, SM_RAM); - SekMapMemory(DrvBg2RAM, 0x06f000, 0x06f7ff, SM_RAM); - SekMapMemory(DrvFgRAM, 0x06f800, 0x06ffff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x0a0000, 0x0a0057, SM_ROM); // a03ff - SekSetWriteByteHandler(0, tokib_write_byte); - SekSetWriteWordHandler(0, tokib_write_word); - SekSetReadByteHandler(0, tokib_read_byte); - SekSetReadWordHandler(0, tokib_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x1fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x1fff, 2, DrvZ80DecROM, DrvZ80ROM ); - ZetMapArea(0x2000, 0x27ff, 0, DrvZ80RAM); - ZetMapArea(0x2000, 0x27ff, 1, DrvZ80RAM); - ZetMapArea(0x2000, 0x27ff, 2, DrvZ80RAM); - ZetSetWriteHandler(toki_seibu_sound_write); - ZetSetReadHandler(toki_seibu_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM3812Init(3579545, &DrvFMIRQHandler, &DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3812(3579545); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 1000000 / 132, 1); - MSM6295SetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); - MSM6295ROM = DrvSndROM; - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 JujubaInit() -{ - is_bootleg = 0; - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (BurnLoadRom(Drv68KROM + 0x20001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x20000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x40000, 5, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 6, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x10000, 7, 1)) return 1; - memcpy(DrvZ80ROM, DrvZ80ROM + 0x2000, 0x6000); - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x10000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x00001, 11, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x40000, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x40001, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x80000, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x80001, 15, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0xc0000, 16, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0xc0001, 17, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00001, 18, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x20001, 19, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x40001, 20, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x60001, 21, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 22, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x20000, 23, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x40000, 24, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x60000, 25, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x00001, 26, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x20001, 27, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x40001, 28, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x60001, 29, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x00000, 30, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x20000, 31, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x40000, 32, 2)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x60000, 33, 2)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x00000, 34, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x10000, 35, 1)) return 1; - - UINT16 *PrgRom = (UINT16*)Drv68KROM; - for (INT32 i = 0; i < 0x30000; i++) { - PrgRom[i] = BITSWAP16(PrgRom[i], 15, 12, 13, 14, 11, 10, 9, 8, 7, 6, 5, 3, 4, 2, 1, 0); - } - - UINT8 *Decrypt = DrvZ80DecROM; - UINT8 *Rom = DrvZ80ROM; - memcpy(Decrypt, Rom, 0x2000); - for (INT32 i = 0;i < 0x2000; i++) { - UINT8 Src = Decrypt[i]; - Rom[i] = Src ^ 0x55; - } - - DrvGfxDecode(); - - UINT8 *Temp = (UINT8*)BurnMalloc(0x20000); - memcpy(Temp, DrvSndROM, 0x20000); - for (INT32 i = 0; i < 0x20000; i++ ) { - DrvSndROM[i] = Temp[BITSWAP24(i, 23, 22, 21, 20, 19, 18, 17, 16, 13, 14, 15, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)]; - } - BurnFree(Temp); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x060000, 0x06d7ff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x06d800, 0x06dfff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x06e000, 0x06e7ff, SM_ROM); // 4b4g4r handler - SekMapMemory(DrvBg1RAM, 0x06e800, 0x06efff, SM_RAM); - SekMapMemory(DrvBg2RAM, 0x06f000, 0x06f7ff, SM_RAM); - SekMapMemory(DrvFgRAM, 0x06f800, 0x06ffff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x0a0000, 0x0a0057, SM_ROM); // a03ff - SekSetWriteByteHandler(0, tokib_write_byte); - SekSetWriteWordHandler(0, tokib_write_word); - SekSetReadByteHandler(0, tokib_read_byte); - SekSetReadWordHandler(0, tokib_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x1fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x1fff, 2, DrvZ80DecROM, DrvZ80ROM ); - ZetMapArea(0x2000, 0x27ff, 0, DrvZ80RAM); - ZetMapArea(0x2000, 0x27ff, 1, DrvZ80RAM); - ZetMapArea(0x2000, 0x27ff, 2, DrvZ80RAM); - ZetSetWriteHandler(toki_seibu_sound_write); - ZetSetReadHandler(toki_seibu_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM3812Init(3579545, &DrvFMIRQHandler, &DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3812(3579545); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 1000000 / 132, 1); - MSM6295SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); - MSM6295ROM = DrvSndROM; - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM3812Exit(); - if (is_bootleg) { - MSM5205Exit(); - } else { - MSM6295Exit(0); - } - - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - TokibMSM5205Next = 0; - TokibMSM5205Toggle = 0; - is_bootleg = 0; - - return 0; -} - -static void draw_text_layer() -{ - UINT16 *vram = (UINT16*)DrvFgRAM; - - for (INT32 offs = 0x040; offs < 0x3c0; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - sy -= 16; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); - INT32 color = code >> 12; - code &= 0xfff; - - if (code == 0) continue; - - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0x0f, 0x100, DrvGfxROM0); - } -} - -static void draw_bg_layer(UINT8 *vidsrc, UINT8 *gfxbase, INT32 transp, INT32 gfxoffs, INT32 scrollx, INT32 scrolly) -{ - UINT16 *vram = (UINT16*)vidsrc; - - scrollx &= 0x1ff; - scrolly &= 0x1ff; - - for (INT32 offs = 0; offs < 0x800 / 2; offs++) - { - INT32 sx = (offs & 0x1f) << 4; - INT32 sy = (offs >> 5) << 4; - - sx -= scrollx; - if (sx < -15) sx += 0x200; - sy -= scrolly; - if (sy < -15) sy += 0x200; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); - INT32 color = code >> 12; - - if (transp) { - Render16x16Tile_Mask_Clip(pTransDraw, code & 0xfff, sx, sy, color, 4, 0x0f, gfxoffs, gfxbase); - } else { - Render16x16Tile_Clip(pTransDraw, code & 0xfff, sx, sy, color, 4, gfxoffs, gfxbase); - } - } -} - -static void draw_bg_layer_by_line(UINT8 *vidsrc, UINT8 *gfxbase, INT32 transp, INT32 gfxoffs, INT32 scrollx, INT32 scrolly, INT32 line) -{ - UINT8 *src; - UINT16 *vram = (UINT16*)vidsrc; - - INT32 starty = line + scrolly; - if (starty > 0x1ff) starty -= 0x200; - starty = (starty & 0x1f0) << 1; - - for (INT32 offs = starty; offs < starty + 0x20; offs++) - { - INT32 sx = (offs & 0x1f) << 4; - INT32 sy = (offs >> 5) << 4; - - sx -= scrollx; - if (sx < -15) sx += 0x200; - sy -= scrolly; - if (sy < -15) sy += 0x200; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); - INT32 color = ((code >> 8) & 0xf0) | gfxoffs; - - if (sx < -15 || sx >= nScreenWidth) continue; - src = gfxbase + ((code & 0xfff) << 8) + ((line - sy) << 4); - - sy = line * nScreenWidth; - - if (transp) { - for (INT32 x = 0; x < 16; x++, sx++) { - if (src[x] != 0x0f && sx >= 0 && sx < nScreenWidth) { - pTransDraw[sy + sx] = color | src[x]; - } - } - } else { - for (INT32 x = 0; x < 16; x++, sx++) { - if (sx >= 0 && sx < nScreenWidth) { - pTransDraw[sy + sx] = color | src[x]; - } - } - } - } -} - -static void tokib_draw_sprites() -{ - INT32 x,y,code,flipx,color,offs; - UINT16 *sprite_buffer = (UINT16*)(DrvSprBuf + 0xe); - UINT16 *sprite_word; - - for (offs = 0;offs < 0x642 / 2;offs += 4) - { - sprite_word = &sprite_buffer[offs]; - - if (BURN_ENDIAN_SWAP_INT16(sprite_word[0]) == 0xf100) - break; - - if (BURN_ENDIAN_SWAP_INT16(sprite_word[2])) - { - x = BURN_ENDIAN_SWAP_INT16(sprite_word[3]) & 0x1ff; - if (x > 256) - x -= 512; - - y = BURN_ENDIAN_SWAP_INT16(sprite_word[0]) & 0x1ff; - if (y > 256) - y = (512-y)+240; - else - y = 240-y; - - flipx = BURN_ENDIAN_SWAP_INT16(sprite_word[1]) & 0x4000; - code = BURN_ENDIAN_SWAP_INT16(sprite_word[1]) & 0x1fff; - color = BURN_ENDIAN_SWAP_INT16(sprite_word[2]) >> 12; - - y-=1+16; - - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); - } - } - } -} - - -static void toki_draw_sprites() -{ - INT32 x,y,xoffs,yoffs,code,flipx,flipy,color,offs; - UINT16 *sprite_buffer = (UINT16*)DrvSprBuf; - UINT16 *sprite_word; - - for (offs = (0x800/2)-4;offs >= 0;offs -= 4) - { - sprite_word = &sprite_buffer[offs]; - - if ((BURN_ENDIAN_SWAP_INT16(sprite_word[2]) != 0xf000) && (BURN_ENDIAN_SWAP_INT16(sprite_word[0]) != 0xffff)) - { - xoffs = (BURN_ENDIAN_SWAP_INT16(sprite_word[0]) &0xf0); - x = (BURN_ENDIAN_SWAP_INT16(sprite_word[2]) + xoffs) & 0x1ff; - if (x > 256) - x -= 512; - - yoffs = (BURN_ENDIAN_SWAP_INT16(sprite_word[0]) &0xf) << 4; - y = (BURN_ENDIAN_SWAP_INT16(sprite_word[3]) + yoffs) & 0x1ff; - if (y > 256) - y -= 512; - - color = BURN_ENDIAN_SWAP_INT16(sprite_word[1]) >> 12; - flipx = BURN_ENDIAN_SWAP_INT16(sprite_word[0]) & 0x100; - flipy = 0; - code = (BURN_ENDIAN_SWAP_INT16(sprite_word[1]) & 0xfff) + ((BURN_ENDIAN_SWAP_INT16(sprite_word[2]) & 0x8000) >> 3); - - if (0) { // flipscreen - x=240-x; - y=240-y; - if (flipx) flipx=0; else flipx=1; - flipy=1; - } - - y-=16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); - } - } - } - } -} - - -static INT32 TokibDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - UINT16 *scrollram = (UINT16 *)DrvScrollRAM; - - if (BURN_ENDIAN_SWAP_INT16(scrollram[3]) & 0x2000) { - draw_bg_layer(DrvBg1RAM, DrvGfxROM2, 0, 0x200, BURN_ENDIAN_SWAP_INT16(scrollram[1])-0x103, BURN_ENDIAN_SWAP_INT16(scrollram[0])+1+16); - draw_bg_layer(DrvBg2RAM, DrvGfxROM3, 1, 0x300, BURN_ENDIAN_SWAP_INT16(scrollram[3])-0x101, BURN_ENDIAN_SWAP_INT16(scrollram[2])+1+16); - } else { - draw_bg_layer(DrvBg2RAM, DrvGfxROM3, 0, 0x300, BURN_ENDIAN_SWAP_INT16(scrollram[3])-0x101, BURN_ENDIAN_SWAP_INT16(scrollram[2])+1+16); - draw_bg_layer(DrvBg1RAM, DrvGfxROM2, 1, 0x200, BURN_ENDIAN_SWAP_INT16(scrollram[1])-0x103, BURN_ENDIAN_SWAP_INT16(scrollram[0])+1+16); - } - - tokib_draw_sprites(); - - draw_text_layer(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -void assemble_inputs(UINT16 in0base, UINT16 in1base) -{ - DrvInps[0] = in0base; - DrvInps[1] = in1base; - - for (INT32 i = 0; i < 16; i++) { - DrvInps[0] ^= (DrvJoy1[i] & 1) << i; - DrvInps[1] ^= (DrvJoy2[i] & 1) << i; - } -} - -static INT32 TokibFrame() -{ - if (DrvReset) { - TokibDoReset(); - } - - INT32 nInterleave = MSM5205CalcInterleave(0, 4000000); - - SekNewFrame(); - ZetNewFrame(); - - assemble_inputs(0x3f3f, 0xff1f); - - INT32 nCyclesToDo[2] = { 10000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - SekClose(); - - ZetOpen(0); - BurnTimerUpdateYM3812(i * (nCyclesToDo[1] / nInterleave)); - MSM5205Update(); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrameYM3812(nCyclesToDo[1]); - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - if (pBurnDraw) { - TokibDraw(); - } - - memcpy (DrvSprBuf, DrvSprRAM, 0x800); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - UINT16 *scrollram = (UINT16*)DrvScrollRAM; - INT32 bgscrolly,bgscrollx,fgscrolly,fgscrollx; - - bgscrollx = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x06]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x06]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x05]) & 0x10) << 4); - bgscrolly = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0e]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0e]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0d]) & 0x10) << 4); - - fgscrollx = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x16]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x16]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x15]) & 0x10) << 4); - fgscrolly = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1e]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1e]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1d]) & 0x10) << 4); - - if (~nBurnLayer & 1) memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); - - if (BURN_ENDIAN_SWAP_INT16(scrollram[0x28]) & 0x0100) { - if (nBurnLayer & 1) draw_bg_layer(DrvBg1RAM, DrvGfxROM2, 0, 0x200, bgscrollx, bgscrolly+16); - if (nBurnLayer & 2) draw_bg_layer(DrvBg2RAM, DrvGfxROM3, 1, 0x300, fgscrollx, fgscrolly+16); - } else { - if (nBurnLayer & 2) draw_bg_layer(DrvBg2RAM, DrvGfxROM3, 0, 0x300, fgscrollx, fgscrolly+16); - if (nBurnLayer & 1) draw_bg_layer(DrvBg1RAM, DrvGfxROM2, 1, 0x200, bgscrollx, bgscrolly+16); - } -#if 0 - flip_screen_set((toki_scrollram16[0x28]&0x8000)==0); - -#endif - - toki_draw_sprites(); - - draw_text_layer(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrawByLine(INT32 line) -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - UINT16 *scrollram = (UINT16*)DrvScrollRAM; - INT32 bgscrolly,bgscrollx,fgscrolly,fgscrollx; - - bgscrollx = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x06]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x06]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x05]) & 0x10) << 4); - bgscrolly = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0e]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0e]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0d]) & 0x10) << 4); - - fgscrollx = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x16]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x16]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x15]) & 0x10) << 4); - fgscrolly = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1e]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1e]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1d]) & 0x10) << 4); - - //memset (pTransDraw + line * 2, 0, nScreenWidth * 2); - if (~nBurnLayer & 1) memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); - - if (BURN_ENDIAN_SWAP_INT16(scrollram[0x28]) & 0x0100) { - if (nBurnLayer & 1) draw_bg_layer_by_line(DrvBg1RAM, DrvGfxROM2, 0, 0x200, bgscrollx, bgscrolly+16, line); - if (nBurnLayer & 2) draw_bg_layer_by_line(DrvBg2RAM, DrvGfxROM3, 1, 0x300, fgscrollx, fgscrolly+16, line); - } else { - if (nBurnLayer & 2) draw_bg_layer_by_line(DrvBg2RAM, DrvGfxROM3, 0, 0x300, fgscrollx, fgscrolly+16, line); - if (nBurnLayer & 1) draw_bg_layer_by_line(DrvBg1RAM, DrvGfxROM2, 1, 0x200, bgscrollx, bgscrolly+16, line); - } - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - SekNewFrame(); - ZetNewFrame(); - - assemble_inputs(0xffff, 0xffff); - - INT32 nInterleave = 256 * 2; - INT32 nCycleSegment; - nCyclesTotal[0] = 10000000 / 60; - nCyclesTotal[1] = 3579545 / 60 ; - INT32 nCyclesDone[2] = { 0, 0 }; - - - SekOpen(0); - ZetOpen(0); -//bprintf (PRINT_NORMAL, _T("before run\n")); - - for (INT32 i = 0; i < nInterleave; i++) - { - nCycleSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); - nCyclesDone[0] += SekRun(nCycleSegment); - - BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); - - INT32 scanline = i >> 1; - - if (pTransDraw && scanline > 15 && scanline < 240 && !(i&1)) { - DrawByLine(scanline-16); - } - } - - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - - ZetClose(); - SekClose(); -//bprintf (PRINT_NORMAL, _T("before sprites\n")); - if (pBurnDraw) { - toki_draw_sprites(); - - draw_text_layer(); - - BurnTransferCopy(DrvPalette); - } - - if (pBurnSoundOut) { - ZetOpen(0); - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - memcpy (DrvSprBuf, DrvSprRAM, 0x800); -//bprintf (PRINT_NORMAL, _T("end\n")); - - return 0; -} - - -// Toki (World set 1) - -static struct BurnRomInfo tokiRomDesc[] = { - { "l10_6.bin", 0x20000, 0x94015d91, 1 }, // 0 main - { "k10_4e.bin", 0x20000, 0x531bd3ef, 1 }, // 1 - { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 - { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 - - { "tokijp.008", 0x02000, 0x6c87c4c5, 2 }, // 4 audio - { "tokijp.007", 0x10000, 0xa67969c4, 2 }, // 5 - - { "tokijp.001", 0x10000, 0x8aa964a2, 3 }, // 6 gfx1 - { "tokijp.002", 0x10000, 0x86e87e48, 3 }, // 7 - - { "toki.ob1", 0x80000, 0xa27a80ba, 4 }, // 8 gfx2 - { "toki.ob2", 0x80000, 0xfa687718, 4 }, // 9 - - { "toki.bk1", 0x80000, 0xfdaa5f4b, 5 }, // 10 gfx3 - - { "toki.bk2", 0x80000, 0xd86ac664, 6 }, // 11 gfx4 - - { "tokijp.009", 0x20000, 0xae7a6b8b, 7 }, // 12 oki -}; - -STD_ROM_PICK(toki) -STD_ROM_FN(toki) - -struct BurnDriver BurnDrvToki = { - "toki", NULL, NULL, NULL, "1989", - "Toki (World set 1)\0", NULL, "Tad", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, tokiRomInfo, tokiRomName, NULL, NULL, TokiInputInfo, TokiDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Toki (World set 2) - -static struct BurnRomInfo tokiaRomDesc[] = { - { "tokijp.006", 0x20000, 0x03d726b1, 1 }, // 0 main - { "4c.10k", 0x20000, 0xb2c345c5, 1 }, // 1 - { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 - { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 - - { "tokijp.008", 0x02000, 0x6c87c4c5, 2 }, // 4 audio - { "tokijp.007", 0x10000, 0xa67969c4, 2 }, // 5 - - { "tokijp.001", 0x10000, 0x8aa964a2, 3 }, // 6 gfx1 - { "tokijp.002", 0x10000, 0x86e87e48, 3 }, // 7 - - { "toki.ob1", 0x80000, 0xa27a80ba, 4 }, // 8 gfx2 - { "toki.ob2", 0x80000, 0xfa687718, 4 }, // 9 - - { "toki.bk1", 0x80000, 0xfdaa5f4b, 5 }, // 10 gfx3 - - { "toki.bk2", 0x80000, 0xd86ac664, 6 }, // 11 gfx4 - - { "tokijp.009", 0x20000, 0xae7a6b8b, 7 }, // 12 oki -}; - -STD_ROM_PICK(tokia) -STD_ROM_FN(tokia) - -struct BurnDriver BurnDrvTokia = { - "tokia", "toki", NULL, NULL, "1989", - "Toki (World set 2)\0", NULL, "Tad", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, tokiaRomInfo, tokiaRomName, NULL, NULL, TokiInputInfo, TokiDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Toki (US) - -static struct BurnRomInfo tokiuRomDesc[] = { - { "6b.10m", 0x20000, 0x3674d9fe, 1 }, // 0 main - { "14.10k", 0x20000, 0xbfdd48af, 1 }, // 1 - { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 - { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 - - { "tokijp.008", 0x02000, 0x6c87c4c5, 2 }, // 4 audio - { "tokijp.007", 0x10000, 0xa67969c4, 2 }, // 5 - - { "tokijp.001", 0x10000, 0x8aa964a2, 3 }, // 6 gfx1 - { "tokijp.002", 0x10000, 0x86e87e48, 3 }, // 7 - - { "toki.ob1", 0x80000, 0xa27a80ba, 4 }, // 8 gfx2 - { "toki.ob2", 0x80000, 0xfa687718, 4 }, // 9 - - { "toki.bk1", 0x80000, 0xfdaa5f4b, 5 }, // 10 gfx3 - - { "toki.bk2", 0x80000, 0xd86ac664, 6 }, // 11 gfx4 - - { "tokijp.009", 0x20000, 0xae7a6b8b, 7 }, // 12 oki -}; - -STD_ROM_PICK(tokiu) -STD_ROM_FN(tokiu) - -struct BurnDriver BurnDrvTokiu = { - "tokiu", "toki", NULL, NULL, "1989", - "Toki (US)\0", NULL, "Tad (Fabtek license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, tokiuRomInfo, tokiuRomName, NULL, NULL, TokiInputInfo, TokiDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// JuJu Densetsu (Japan) - -static struct BurnRomInfo jujuRomDesc[] = { - { "tokijp.006", 0x20000, 0x03d726b1, 1 }, // 0 main - { "tokijp.004", 0x20000, 0x54a45e12, 1 }, // 1 - { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 - { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 - - { "tokijp.008", 0x02000, 0x6c87c4c5, 2 }, // 4 audio - { "tokijp.007", 0x10000, 0xa67969c4, 2 }, // 5 - - { "tokijp.001", 0x10000, 0x8aa964a2, 3 }, // 6 gfx1 - { "tokijp.002", 0x10000, 0x86e87e48, 3 }, // 7 - - { "toki.ob1", 0x80000, 0xa27a80ba, 4 }, // 8 gfx2 - { "toki.ob2", 0x80000, 0xfa687718, 4 }, // 9 - - { "toki.bk1", 0x80000, 0xfdaa5f4b, 5 }, // 10 gfx3 - - { "toki.bk2", 0x80000, 0xd86ac664, 6 }, // 11 gfx4 - - { "tokijp.009", 0x20000, 0xae7a6b8b, 7 }, // 12 oki -}; - -STD_ROM_PICK(juju) -STD_ROM_FN(juju) - -struct BurnDriver BurnDrvJuju = { - "juju", "toki", NULL, NULL, "1989", - "JuJu Densetsu (Japan)\0", NULL, "Tad", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, jujuRomInfo, jujuRomName, NULL, NULL, TokiInputInfo, TokiDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// JuJu Densetsu (Playmark bootleg) - -static struct BurnRomInfo jujubRomDesc[] = { - { "jujub_playmark.e3", 0x20000, 0xb50c73ec, 1 }, // 0 main - { "jujub_playmark.e5", 0x20000, 0xb2812942, 1 }, // 1 - { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 - { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 - - { "toki.e1", 0x10000, 0x2832ef75, 2 }, // 4 audio - - { "toki.e21", 0x08000, 0xbb8cacbd, 3 }, // 5 gfx1 - { "toki.e13", 0x08000, 0x052ad275, 3 }, // 6 - { "toki.e22", 0x08000, 0x04dcdc21, 3 }, // 7 - { "toki.e7", 0x08000, 0x70729106, 3 }, // 8 - - { "toki.e26", 0x20000, 0xa8ba71fc, 4 }, // 9 gfx2 - { "toki.e28", 0x20000, 0x29784948, 4 }, // 10 - { "toki.e34", 0x20000, 0xe5f6e19b, 4 }, // 11 - { "toki.e36", 0x20000, 0x96e8db8b, 4 }, // 12 - { "toki.e30", 0x20000, 0x770d2b1b, 4 }, // 13 - { "toki.e32", 0x20000, 0xc289d246, 4 }, // 14 - { "toki.e38", 0x20000, 0x87f4e7fb, 4 }, // 15 - { "toki.e40", 0x20000, 0x96e87350, 4 }, // 16 - - { "toki.e23", 0x10000, 0xfeb13d35, 5 }, // 17 gfx3 - { "toki.e24", 0x10000, 0x5b365637, 5 }, // 18 - { "toki.e15", 0x10000, 0x617c32e6, 5 }, // 19 - { "toki.e16", 0x10000, 0x2a11c0f0, 5 }, // 20 - { "toki.e17", 0x10000, 0xfbc3d456, 5 }, // 21 - { "toki.e18", 0x10000, 0x4c2a72e1, 5 }, // 22 - { "toki.e8", 0x10000, 0x46a1b821, 5 }, // 23 - { "toki.e9", 0x10000, 0x82ce27f6, 5 }, // 24 - - { "toki.e25", 0x10000, 0x63026cad, 6 }, // 25 gfx4 - { "toki.e20", 0x10000, 0xa7f2ce26, 6 }, // 26 - { "toki.e11", 0x10000, 0x48989aa0, 6 }, // 27 - { "toki.e12", 0x10000, 0xc2ad9342, 6 }, // 28 - { "toki.e19", 0x10000, 0x6cd22b18, 6 }, // 29 - { "toki.e14", 0x10000, 0x859e313a, 6 }, // 30 - { "toki.e10", 0x10000, 0xe15c1d0f, 6 }, // 31 - { "toki.e6", 0x10000, 0x6f4b878a, 6 }, // 32 -}; - -STD_ROM_PICK(jujub) -STD_ROM_FN(jujub) - -struct BurnDriver BurnDrvJujub = { - "jujub", "toki", NULL, NULL, "1989", - "JuJu Densetsu (Playmark bootleg)\0", NULL, "bootleg (Playmark)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, jujubRomInfo, jujubRomName, NULL, NULL, TokibInputInfo, TokibDIPInfo, - TokibInit, DrvExit, TokibFrame, TokibDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// JuJu Densetsu (Japan, bootleg) - -static struct BurnRomInfo jujubaRomDesc[] = { - { "8.19g", 0x10000, 0x208fb08a, 1 }, // 0 main - { "5.19e", 0x10000, 0x722e5183, 1 }, // 1 - { "9.20g", 0x10000, 0xcb82cc33, 1 }, // 2 - { "6.20e", 0x10000, 0x826ab39d, 1 }, // 3 - { "10.21g", 0x10000, 0x6c7a3ffe, 1 }, // 4 - { "7.21e", 0x10000, 0xb0628230, 1 }, // 5 - - { "3.9c", 0x08000, 0x808f5e44, 2 }, // 6 audio - { "4.11c", 0x10000, 0xa67969c4, 2 }, // 7 - - { "5.19h", 0x10000, 0x8aa964a2, 3 }, // 8 gfx1 - { "6.20h", 0x10000, 0x86e87e48, 3 }, // 9 - - { "1.17d", 0x20000, 0xa027bd8e, 4 }, // 10 gfx2 - { "27.17b", 0x20000, 0x43a767ea, 4 }, // 11 - { "2.18d", 0x20000, 0x1aecc9d8, 4 }, // 12 - { "28.18b", 0x20000, 0xd65c0c6d, 4 }, // 13 - { "3.20d", 0x20000, 0xcedaccaf, 4 }, // 14 - { "29.20b", 0x20000, 0x013f539b, 4 }, // 15 - { "4.21d", 0x20000, 0x6a8e6e22, 4 }, // 16 - { "30.21b", 0x20000, 0x25d9a16c, 4 }, // 17 - - { "11.1j", 0x10000, 0x6ad15560, 5 }, // 18 gfx3 - { "12.2j", 0x10000, 0x68534844, 5 }, // 19 - { "13.4j", 0x10000, 0xf271be5a, 5 }, // 20 - { "14.5j", 0x10000, 0x5d4c187a, 5 }, // 21 - { "19.1l", 0x10000, 0x10afdf03, 5 }, // 22 - { "20.2l", 0x10000, 0x2dc54f41, 5 }, // 23 - { "21.4l", 0x10000, 0x946862a3, 5 }, // 24 - { "22.5l", 0x10000, 0xb45f5608, 5 }, // 25 - - { "15.18j", 0x10000, 0xcb8b1d31, 6 }, // 26 gfx4 - { "16.19j", 0x10000, 0x81594e0a, 6 }, // 27 - { "17.20j", 0x10000, 0x4acd44ce, 6 }, // 28 - { "18.21j", 0x10000, 0x25cfe9c3, 6 }, // 29 - { "23.18l", 0x10000, 0x06c8d622, 6 }, // 30 - { "24.19l", 0x10000, 0x362a0506, 6 }, // 31 - { "25.20l", 0x10000, 0xbe064c4b, 6 }, // 32 - { "26.21l", 0x10000, 0xf8b5b38d, 6 }, // 33 - - { "1.6a", 0x10000, 0x377153ad, 7 }, // 34 oki - { "2.7a", 0x10000, 0x093ca15d, 7 }, // 35 -}; - -STD_ROM_PICK(jujuba) -STD_ROM_FN(jujuba) - -struct BurnDriver BurnDrvJujuba = { - "jujuba", "toki", NULL, NULL, "1989", - "JuJu Densetsu (Japan, bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, jujubaRomInfo, jujubaRomName, NULL, NULL, TokiInputInfo, TokiDIPInfo, - JujubaInit, DrvExit, DrvFrame, DrvDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - -// Toki (Datsu bootleg) - -static struct BurnRomInfo tokibRomDesc[] = { - { "toki.e3", 0x20000, 0xae9b3da4, 1 }, // 0 main - { "toki.e5", 0x20000, 0x66a5a1d6, 1 }, // 1 - { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 - { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 - - { "toki.e1", 0x10000, 0x2832ef75, 2 }, // 4 audio - - { "toki.e21", 0x08000, 0xbb8cacbd, 3 }, // 5 gfx1 - { "toki.e13", 0x08000, 0x052ad275, 3 }, // 6 - { "toki.e22", 0x08000, 0x04dcdc21, 3 }, // 7 - { "toki.e7", 0x08000, 0x70729106, 3 }, // 8 - - { "toki.e26", 0x20000, 0xa8ba71fc, 4 }, // 9 gfx2 - { "toki.e28", 0x20000, 0x29784948, 4 }, // 10 - { "toki.e34", 0x20000, 0xe5f6e19b, 4 }, // 11 - { "toki.e36", 0x20000, 0x96e8db8b, 4 }, // 12 - { "toki.e30", 0x20000, 0x770d2b1b, 4 }, // 13 - { "toki.e32", 0x20000, 0xc289d246, 4 }, // 14 - { "toki.e38", 0x20000, 0x87f4e7fb, 4 }, // 15 - { "toki.e40", 0x20000, 0x96e87350, 4 }, // 16 - - { "toki.e23", 0x10000, 0xfeb13d35, 5 }, // 17 gfx3 - { "toki.e24", 0x10000, 0x5b365637, 5 }, // 18 - { "toki.e15", 0x10000, 0x617c32e6, 5 }, // 19 - { "toki.e16", 0x10000, 0x2a11c0f0, 5 }, // 20 - { "toki.e17", 0x10000, 0xfbc3d456, 5 }, // 21 - { "toki.e18", 0x10000, 0x4c2a72e1, 5 }, // 22 - { "toki.e8", 0x10000, 0x46a1b821, 5 }, // 23 - { "toki.e9", 0x10000, 0x82ce27f6, 5 }, // 24 - - { "toki.e25", 0x10000, 0x63026cad, 6 }, // 25 gfx4 - { "toki.e20", 0x10000, 0xa7f2ce26, 6 }, // 26 - { "toki.e11", 0x10000, 0x48989aa0, 6 }, // 27 - { "toki.e12", 0x10000, 0xc2ad9342, 6 }, // 28 - { "toki.e19", 0x10000, 0x6cd22b18, 6 }, // 29 - { "toki.e14", 0x10000, 0x859e313a, 6 }, // 30 - { "toki.e10", 0x10000, 0xe15c1d0f, 6 }, // 31 - { "toki.e6", 0x10000, 0x6f4b878a, 6 }, // 32 -}; - -STD_ROM_PICK(tokib) -STD_ROM_FN(tokib) - -struct BurnDriver BurnDrvTokib = { - "tokib", "toki", NULL, NULL, "1989", - "Toki (bootleg)\0", NULL, "bootleg (Datsu)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, - NULL, tokibRomInfo, tokibRomName, NULL, NULL, TokibInputInfo, TokibDIPInfo, - TokibInit, DrvExit, TokibFrame, TokibDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "msm6295.h" +#include "msm5205.h" +#include "bitswap.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80DecROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf; +static UINT8 *DrvBg1RAM; +static UINT8 *DrvBg2RAM; +static UINT8 *DrvFgRAM; +static UINT8 *DrvScrollRAM; + +static UINT8 DrvReset; +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[2]; +static UINT8 DrvDips[2]; +static UINT16 DrvInps[2]; + +static UINT32 *DrvPalette; +static UINT32 *Palette; + +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; + +static UINT8 main2sub[2],sub2main[2]; +static INT32 main2sub_pending,sub2main_pending; + +static INT32 is_bootleg = 0; + +static UINT8 TokibMSM5205Next = 0; +static UINT8 TokibMSM5205Toggle = 0; + +static INT32 nCyclesTotal[2] = { 10000000 / 60, 3579545 / 60 }; + +static struct BurnInputInfo TokiInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 3, "p1 start"}, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 4, "p2 start"}, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(Toki) + +static struct BurnDIPInfo TokiDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xdf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 20, "Coinage" }, + {0x12, 0x01, 0x1f, 0x15, "6 Coins 1 Credits " }, + {0x12, 0x01, 0x1f, 0x17, "5 Coins 1 Credits " }, + {0x12, 0x01, 0x1f, 0x19, "4 Coins 1 Credits " }, + {0x12, 0x01, 0x1f, 0x1b, "3 Coins 1 Credits " }, + {0x12, 0x01, 0x1f, 0x03, "8 Coins 3 Credits " }, + {0x12, 0x01, 0x1f, 0x1d, "2 Coins 1 Credits " }, + {0x12, 0x01, 0x1f, 0x05, "5 Coins 3 Credits " }, + {0x12, 0x01, 0x1f, 0x07, "3 Coins 2 Credits " }, + {0x12, 0x01, 0x1f, 0x1f, "1 Coin 1 Credits " }, + {0x12, 0x01, 0x1f, 0x09, "2 Coins 3 Credits " }, + {0x12, 0x01, 0x1f, 0x13, "1 Coin 2 Credits " }, + {0x12, 0x01, 0x1f, 0x11, "1 Coin 3 Credits " }, + {0x12, 0x01, 0x1f, 0x0f, "1 Coin 4 Credits " }, + {0x12, 0x01, 0x1f, 0x0d, "1 Coin 5 Credits " }, + {0x12, 0x01, 0x1f, 0x0b, "1 Coin 6 Credits " }, + {0x12, 0x01, 0x1f, 0x1e, "A 1/1 B 1/2" }, + {0x12, 0x01, 0x1f, 0x14, "A 2/1 B 1/3" }, + {0x12, 0x01, 0x1f, 0x0a, "A 3/1 B 1/5" }, + {0x12, 0x01, 0x1f, 0x00, "A 5/1 B 1/6" }, + {0x12, 0x01, 0x1f, 0x01, "Free_Play" }, + + {0 , 0xfe, 0 , 2, "Joysticks" }, + {0x12, 0x01, 0x20, 0x20, "1" }, + {0x12, 0x01, 0x20, 0x00, "2" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x40, 0x40, "Upright" }, + {0x12, 0x01, 0x40, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip_Screen" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x02, "2" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "Infinite (Cheat)" }, + + {0 , 0xfe, 0 , 4, "Bonus_Life" }, + {0x13, 0x01, 0x0c, 0x08, "50000 150000" }, + {0x13, 0x01, 0x0c, 0x00, "70000 140000 210000" }, + {0x13, 0x01, 0x0c, 0x0c, "70000" }, + {0x13, 0x01, 0x0c, 0x04, "100000 200000" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x30, 0x20, "Easy" }, + {0x13, 0x01, 0x30, 0x30, "Medium" }, + {0x13, 0x01, 0x30, 0x10, "Hard" }, + {0x13, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Allow_Continue" }, + {0x13, 0x01, 0x40, 0x00, "No" }, + {0x13, 0x01, 0x40, 0x40, "Yes" }, + + {0 , 0xfe, 0 , 2, "Demo_Sounds" }, + {0x13, 0x01, 0x80, 0x00, "Off" }, + {0x13, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Toki) + +static struct BurnInputInfo TokibInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 3, "p1 start"}, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 4, "p2 start"}, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, +}; + +STDINPUTINFO(Tokib) + + +static struct BurnDIPInfo TokibDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xdf, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 20, "Coinage" }, + {0x12, 0x01, 0x1f, 0x15, "6 Coins 1 Credits " }, + {0x12, 0x01, 0x1f, 0x17, "5 Coins 1 Credits " }, + {0x12, 0x01, 0x1f, 0x19, "4 Coins 1 Credits " }, + {0x12, 0x01, 0x1f, 0x1b, "3 Coins 1 Credits " }, + {0x12, 0x01, 0x1f, 0x03, "8 Coins 3 Credits " }, + {0x12, 0x01, 0x1f, 0x1d, "2 Coins 1 Credits " }, + {0x12, 0x01, 0x1f, 0x05, "5 Coins 3 Credits " }, + {0x12, 0x01, 0x1f, 0x07, "3 Coins 2 Credits " }, + {0x12, 0x01, 0x1f, 0x1f, "1 Coin 1 Credits " }, + {0x12, 0x01, 0x1f, 0x09, "2 Coins 3 Credits " }, + {0x12, 0x01, 0x1f, 0x13, "1 Coin 2 Credits " }, + {0x12, 0x01, 0x1f, 0x11, "1 Coin 3 Credits " }, + {0x12, 0x01, 0x1f, 0x0f, "1 Coin 4 Credits " }, + {0x12, 0x01, 0x1f, 0x0d, "1 Coin 5 Credits " }, + {0x12, 0x01, 0x1f, 0x0b, "1 Coin 6 Credits " }, + {0x12, 0x01, 0x1f, 0x1e, "A 1/1 B 1/2" }, + {0x12, 0x01, 0x1f, 0x14, "A 2/1 B 1/3" }, + {0x12, 0x01, 0x1f, 0x0a, "A 3/1 B 1/5" }, + {0x12, 0x01, 0x1f, 0x00, "A 5/1 B 1/6" }, + {0x12, 0x01, 0x1f, 0x01, "Free_Play" }, + + {0 , 0xfe, 0 , 2, "Joysticks" }, + {0x12, 0x01, 0x20, 0x20, "1" }, + {0x12, 0x01, 0x20, 0x00, "2" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x40, 0x40, "Upright" }, + {0x12, 0x01, 0x40, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip_Screen" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x02, "2" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + {0x13, 0x01, 0x03, 0x00, "Infinite (Cheat)" }, + + {0 , 0xfe, 0 , 4, "Bonus_Life" }, + {0x13, 0x01, 0x0c, 0x08, "50000 150000" }, + {0x13, 0x01, 0x0c, 0x00, "70000 140000 210000" }, + {0x13, 0x01, 0x0c, 0x0c, "70000" }, + {0x13, 0x01, 0x0c, 0x04, "100000 200000" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x30, 0x20, "Easy" }, + {0x13, 0x01, 0x30, 0x30, "Medium" }, + {0x13, 0x01, 0x30, 0x10, "Hard" }, + {0x13, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Allow_Continue" }, + {0x13, 0x01, 0x40, 0x00, "No" }, + {0x13, 0x01, 0x40, 0x40, "Yes" }, + + {0 , 0xfe, 0 , 2, "Demo_Sounds" }, + {0x13, 0x01, 0x80, 0x00, "Off" }, + {0x13, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Tokib) + +static void palette_write(INT32 offset) +{ + UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset))); + + UINT8 r, g, b; + +// 4b4g4r handler + + r = (data & 0x0f); + r |= r << 4; + + g = (data & 0xf0); + g |= g >> 4; + + b = (data >> 8) & 0x0f; + b |= b << 4; + + Palette[offset >> 1] = (r << 16) | (g << 8) | b; + DrvPalette[offset >> 1] = BurnHighCol(r, g, b, 0); +} + +enum +{ + VECTOR_INIT, + RST10_ASSERT, + RST10_CLEAR, + RST18_ASSERT, + RST18_CLEAR +}; + +static void update_irq_lines(INT32 param) +{ + static INT32 irq1,irq2; + + switch(param) + { + case VECTOR_INIT: + irq1 = irq2 = 0xff; + break; + + case RST10_ASSERT: + irq1 = 0xd7; + break; + + case RST10_CLEAR: + irq1 = 0xff; + break; + + case RST18_ASSERT: + irq2 = 0xdf; + break; + + case RST18_CLEAR: + irq2 = 0xff; + break; + } + + if ((irq1 & irq2) == 0xff) { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } else { + if (irq2 == 0xdf) { // this shouldn't be required - Raiden needs it too though??? + ZetSetVector(irq1 & irq2); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } + } +} + +UINT8 seibu_main_word_r(INT32 offset) +{ + offset = (offset >> 1) & 7; + + switch (offset) + { + case 2: + case 3: + return sub2main[offset-2]; + case 5: + return main2sub_pending ? 1 : 0; + default: + return 0xff; + } +} + +void seibu_main_word_w(INT32 offset, UINT8 data) +{ + offset = (offset >> 1) & 7; + + switch (offset) + { + case 0: + case 1: + main2sub[offset] = data; + break; + case 4: + if (!is_bootleg) update_irq_lines(RST18_ASSERT); + break; + case 6: + /* just a guess */ + sub2main_pending = 0; + main2sub_pending = 1; + break; + default: + break; + } +} + +void __fastcall tokib_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xff800) == 0x6e000) { + DrvPalRAM[address & 0x7ff] = data; + + palette_write(address & 0x7fe); + + return; + } + + if (address >= 0x7180e && address <= 0x71e45) { + address ^= 1; + if (is_bootleg) DrvSprRAM[address & 0x7ff] = data; + return; + } + + if (address >= 0xa0000 && address <= 0xa0057) { + if (!is_bootleg)DrvScrollRAM[address & 0x3ff] = data; + return; + } + + switch (address) + { + case 0x71000: + case 0x71001: + // nop + return; + + + case 0x75000: + case 0x75001: { + *soundlatch = data & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + + case 0x75004: + case 0x75005: + case 0x75006: + case 0x75007: + case 0x75008: + case 0x75009: + case 0x7500a: + case 0x7500b: + if (is_bootleg) DrvScrollRAM[address-0x75004] = data; + return; + + case 0x80000: + case 0x80001: + case 0x80002: + case 0x80003: + case 0x80004: + case 0x80005: + case 0x80006: + case 0x80007: + case 0x80008: + case 0x80009: + case 0x8000a: + case 0x8000b: + case 0x8000c: + case 0x8000d: { + seibu_main_word_w(address, data); + return; + } + } +} + +void __fastcall tokib_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xff800) == 0x6e000) { + *((UINT16*)(DrvPalRAM + (address & 0x7fe))) = BURN_ENDIAN_SWAP_INT16(data); + + palette_write(address & 0x7fe); + + return; + } + + if (address >= 0x7180e && address <= 0x71e45) { + if (is_bootleg)*((UINT16*)(DrvSprRAM + (address & 0x7fe))) = BURN_ENDIAN_SWAP_INT16(data); + return; + } + + if (address >= 0xa0000 && address <= 0xa0057) { + if (!is_bootleg)*((UINT16*)(DrvScrollRAM + (address & 0x3fe))) = BURN_ENDIAN_SWAP_INT16(data); + return; + } + + switch (address) + { + case 0x71000: + // nop + return; + + + case 0x75000: { + *soundlatch = data & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + + case 0x75004: + case 0x75006: + case 0x75008: + case 0x7500a: + if (is_bootleg)*((UINT16*)(DrvScrollRAM + (address - 0x75004))) = BURN_ENDIAN_SWAP_INT16(data); + return; + + + case 0x80000: + case 0x80001: + case 0x80002: + case 0x80003: + case 0x80004: + case 0x80005: + case 0x80006: + case 0x80007: + case 0x80008: + case 0x80009: + case 0x8000a: + case 0x8000b: + case 0x8000c: + case 0x8000d: { + seibu_main_word_w(address, data); + return; + } + +// AM_RANGE(0x080000, 0x08000d) AM_READWRITE(seibu_main_word_r, seibu_main_word_w) + + } +} + +UINT8 __fastcall tokib_read_byte(UINT32 address) +{ + switch (address) + { + case 0x72000: + case 0x72001: + return 0;// watchdog reset + + case 0x80000: + case 0x80001: + case 0x80002: + case 0x80003: + case 0x80004: + case 0x80005: + case 0x80006: + case 0x80007: + case 0x80008: + case 0x80009: + case 0x8000a: + case 0x8000b: + case 0x8000c: + case 0x8000d: { + return seibu_main_word_r(address); + } + + case 0xc0000: + case 0xc0001: + return DrvDips[~address & 1]; + + case 0xc0002: return DrvInps[0] >> 8; + case 0xc0003: return DrvInps[0] & 0xff; + + case 0xc0004: return DrvInps[1] >> 8; + case 0xc0005: return DrvInps[1] & 0xff; + + case 0xc000e: + case 0xc000f: + return 0xff; + } + + return 0; +} + +UINT16 __fastcall tokib_read_word(UINT32 address) +{ + switch (address) + { + case 0x72000: + return 0;// watchdog reset + + case 0x80000: + case 0x80001: + case 0x80002: + case 0x80003: + case 0x80004: + case 0x80005: + case 0x80006: + case 0x80007: + case 0x80008: + case 0x80009: + case 0x8000a: + case 0x8000b: + case 0x8000c: + case 0x8000d: { + return seibu_main_word_r(address); + } + + case 0xc0000: + return (DrvDips[1] << 8) | (DrvDips[0]); + + case 0xc0002: + return DrvInps[0]; + + case 0xc0004: + return DrvInps[1]; + + case 0xc000e: + return 0xffff; + } + + return 0; +} + + +static void seibu_z80_bank(INT32 bank) +{ + INT32 nBank = bank & 1; + + ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + 0x10000 + nBank * 0x8000); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + 0x10000 + nBank * 0x8000); +} + +void __fastcall toki_seibu_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x4000: + main2sub_pending = 0; + sub2main_pending = 1; + return; + + case 0x4001: + update_irq_lines(VECTOR_INIT); + return; + + case 0x4002: + //seibu_rst10_ack_w - unused + return; + + case 0x4003: + update_irq_lines(RST18_CLEAR); + return; + + case 0x4007: + seibu_z80_bank(data); + return; + + case 0x4008: + BurnYM3812Write(0, data); + return; + + + case 0x4009: + BurnYM3812Write(1, data); + return; + + case 0x4018: + case 0x4019: + sub2main[address & 1] = data; + return; + + + case 0x401b: + //seibu_coin_w + return; + + + case 0x6000: + MSM6295Command(0, data); + return; + } + + bprintf (PRINT_NORMAL, _T("%4.4x, %2.2x\n"), address, data); +} + +UINT8 __fastcall toki_seibu_sound_read(UINT16 address) +{ + switch (address) + { + case 0x4008: + return BurnYM3812Read(0); + + case 0x4010: + case 0x4011: + return main2sub[address & 1]; + + case 0x4012: + return sub2main_pending ? 1 : 0; + + case 0x4013: + return (DrvJoy3[1] << 1) | DrvJoy3[0]; // COIN + + case 0x6000: + return MSM6295ReadStatus(0); + } + + bprintf (PRINT_NORMAL, _T("%4.4x,\n"), address); + + return 0; +} + +static void toki_adpcm_control_w(INT32 data) +{ + INT32 bankaddress = data & 1; + + UINT8 *RAM = DrvZ80ROM + 0x8000 + bankaddress * 0x4000; + + + /* the code writes either 2 or 3 in the bottom two bits */ +// bankaddress = 0x10000 + (data & 0x01) * 0x4000; +// memory_set_bankptr(1,&RAM[bankaddress]); + + ZetMapArea(0x8000, 0xbfff, 0, RAM); + ZetMapArea(0x8000, 0xbfff, 2, RAM); + + + MSM5205ResetWrite(0, data & 0x08); +} + + +void __fastcall tokib_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe000: + toki_adpcm_control_w(data); + return; + + case 0xe400: + TokibMSM5205Next = data; + return; + + case 0xec00: + case 0xec08: + BurnYM3812Write(0, data); + return; + + case 0xec01: + case 0xec09: + BurnYM3812Write(1, data); + return; + } +} + +UINT8 __fastcall tokib_sound_read(UINT16 address) +{ + switch (address) + { + case 0xec00: + return BurnYM3812Read(0); + + case 0xf800: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + if (!is_bootleg) update_irq_lines(VECTOR_INIT); + ZetClose(); + + BurnYM3812Reset(); + if (!is_bootleg) MSM6295Reset(0); + + return 0; +} + +static INT32 TokibDoReset() +{ + TokibMSM5205Next = 0; + TokibMSM5205Toggle = 0; + + MSM5205Reset(); + + return DrvDoReset(); +} + + +static void tokib_rom_decode() +{ + UINT8 *temp = (UINT8*)malloc(65536 * 2); + INT32 i, offs, len; + UINT8 *rom; + + /* invert the sprite data in the ROMs */ + len = 0x100000; + rom = DrvGfxROM1; + for (i = 0; i < len; i++) + rom[i] ^= 0xff; + + /* merge background tile graphics together */ + len = 0x080000; + rom = DrvGfxROM2; + for (offs = 0; offs < len; offs += 0x20000) + { + UINT8 *base = &rom[offs]; + memcpy (temp, base, 65536 * 2); + for (i = 0; i < 16; i++) + { + memcpy (&base[0x00000 + i * 0x800], &temp[0x0000 + i * 0x2000], 0x800); + memcpy (&base[0x10000 + i * 0x800], &temp[0x0800 + i * 0x2000], 0x800); + memcpy (&base[0x08000 + i * 0x800], &temp[0x1000 + i * 0x2000], 0x800); + memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800); + } + } + len = 0x080000; + rom = DrvGfxROM3; + for (offs = 0; offs < len; offs += 0x20000) + { + UINT8 *base = &rom[offs]; + memcpy (temp, base, 65536 * 2); + for (i = 0; i < 16; i++) + { + memcpy (&base[0x00000 + i * 0x800], &temp[0x0000 + i * 0x2000], 0x800); + memcpy (&base[0x10000 + i * 0x800], &temp[0x0800 + i * 0x2000], 0x800); + memcpy (&base[0x08000 + i * 0x800], &temp[0x1000 + i * 0x2000], 0x800); + memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800); + } + } + + if (temp) { + free (temp); + temp = NULL; + } +} + + + + + + + +static INT32 TokibGfxDecode() +{ + INT32 Plane0[4] = { 4096*8*8*3, 4096*8*8*2, 4096*8*8*1, 4096*8*8*0 }; // char + INT32 Plane1[4] = { 8192*16*16*3,8192*16*16*2,8192*16*16*1,8192*16*16*0 }; // spr + INT32 Plane2[4] = { 4096*16*16*3,4096*16*16*2,4096*16*16*1,4096*16*16*0 }; // tile +// char & spr + INT32 XOffs0[16] = { 0, 1, 2, 3, 4, 5, 6, 7, + 128+0, 128+1, 128+2, 128+3, 128+4, 128+5, 128+6, 128+7 }; + INT32 YOffs0[16] = { 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120 }; + +// tiles + INT32 XOffs1[16] = { 0, 1, 2, 3, 4, 5, 6, 7, + 0x8000*8+0, 0x8000*8+1, 0x8000*8+2, 0x8000*8+3, 0x8000*8+4, + 0x8000*8+5, 0x8000*8+6, 0x8000*8+7 }; + + INT32 YOffs1[32] = { 0,8,16,24,32,40,48,56, + 0x10000*8+ 0, 0x10000*8+ 8, 0x10000*8+16, 0x10000*8+24, 0x10000*8+32, + 0x10000*8+40, 0x10000*8+48, 0x10000*8+56 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x020000); + + GfxDecode(4096, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x040, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x100000); + + GfxDecode(8192, 4, 16, 16, Plane1, XOffs0, YOffs0, 0x100, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x080000); + + GfxDecode(4096, 4, 16, 16, Plane2, XOffs1, YOffs1, 0x040, tmp, DrvGfxROM2); + + memcpy (tmp, DrvGfxROM3, 0x080000); + + GfxDecode(4096, 4, 16, 16, Plane2, XOffs1, YOffs1, 0x040, tmp, DrvGfxROM3); + + BurnFree (tmp); + + return 0; +} + + + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x060000; + + DrvZ80ROM = Next; Next += 0x020000; + DrvZ80DecROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x040000; + DrvGfxROM1 = Next; Next += 0x200000; + DrvGfxROM2 = Next; Next += 0x100000; + DrvGfxROM3 = Next; Next += 0x100000; + + DrvSndROM = Next; Next += 0x020000; + + DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); + + AllRam = Next; + + DrvBg1RAM = Next; Next += 0x000800; + DrvBg2RAM = Next; Next += 0x000800; + DrvFgRAM = Next; Next += 0x000800; + Drv68KRAM = Next; Next += 0x00e000; + DrvZ80RAM = Next; Next += 0x000800; + DrvPalRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x000800; + DrvSprBuf = Next; Next += 0x000800; + + DrvScrollRAM = Next; Next += 0x000060 + 0x3b0; // + buffer space + + soundlatch = Next; Next += 0x000001; + + Palette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3579545; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + update_irq_lines(RST10_ASSERT); + } else { + update_irq_lines(RST10_CLEAR); + } +} + +inline static INT32 TokibSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)((double)ZetTotalCycles() * nSoundRate / 4000000); +} + +static void toki_adpcm_int() +{ + MSM5205DataWrite(0, TokibMSM5205Next); + TokibMSM5205Next >>= 4; + + TokibMSM5205Toggle ^= 1; + if (TokibMSM5205Toggle) ZetNmi(); +} + +static INT32 TokibInit() +{ + is_bootleg = 1; + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; + + for (INT32 i = 0; i < 4; i++) + if (BurnLoadRom(DrvGfxROM0 + i * 0x8000, 5 + i, 1)) return 1; + + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x20000, 9 + i, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + i * 0x10000, 17 + i, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + i * 0x10000, 25 + i, 1)) return 1; + } + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 4, 1)) return 1; + + tokib_rom_decode(); + + TokibGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x060000, 0x06dfff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x06e000, 0x06e7ff, SM_ROM); // 4b4g4r handler + SekMapMemory(DrvBg1RAM, 0x06e800, 0x06efff, SM_RAM); + SekMapMemory(DrvBg2RAM, 0x06f000, 0x06f7ff, SM_RAM); + SekMapMemory(DrvFgRAM, 0x06f800, 0x06ffff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x071800, 0x0718ff, SM_ROM); // allow writes to 0x7180e - 0x71e45 + SekSetWriteByteHandler(0, tokib_write_byte); + SekSetWriteWordHandler(0, tokib_write_word); + SekSetReadByteHandler(0, tokib_read_byte); + SekSetReadWordHandler(0, tokib_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x8000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x8000); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(tokib_sound_write); + ZetSetReadHandler(tokib_sound_read); + ZetClose(); + + BurnYM3812Init(3579545, NULL, &TokibSynchroniseStream, 0); + BurnTimerAttachZetYM3812(3579545); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + MSM5205Init(0, TokibSynchroniseStream, 384000, toki_adpcm_int, MSM5205_S96_4B, 1); + MSM5205SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + TokibDoReset(); + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 4096*16*8+0, 4096*16*8+4, 0, 4 }; // char + INT32 Plane1[4] = { 2*4, 3*4, 0*4, 1*4 }; // spr, tile + INT32 XOffs0[8] = { 3, 2, 1, 0, 8+3, 8+2, 8+1, 8+0 }; // char + INT32 YOffs0[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }; + +// tiles + INT32 XOffs1[16] = { 3, 2, 1, 0, 16+3, 16+2, 16+1, 16+0, + 64*8+3, 64*8+2, 64*8+1, 64*8+0, 64*8+16+3, 64*8+16+2, 64*8+16+1, 64*8+16+0 }; + + INT32 YOffs1[32] = { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, + 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x020000); + + GfxDecode(4096, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x080, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x100000); + + GfxDecode(8192, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x080000); + + GfxDecode(4096, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, tmp, DrvGfxROM2); + + memcpy (tmp, DrvGfxROM3, 0x080000); + + GfxDecode(4096, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x400, tmp, DrvGfxROM3); + + BurnFree (tmp); + + return 0; +} + +static UINT8 decrypt_data(INT32 a,INT32 src) +{ + if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; + if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; + if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; + if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; + if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; + + if (BIT(a,13) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,3,2,0,1); + if (BIT(a, 8) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,2,3,1,0); + + return src; +} + +static UINT8 decrypt_opcode(INT32 a,INT32 src) +{ + if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; + if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; + if (~BIT(a,13) & BIT(a,12)) src ^= 0x20; + if (~BIT(a,6) & BIT(a,1)) src ^= 0x10; + if (~BIT(a,12) & BIT(a,2)) src ^= 0x08; + if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; + if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; + if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; + + if (BIT(a,13) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,3,2,0,1); + if (BIT(a, 8) & BIT(a,4)) src = BITSWAP08(src,7,6,5,4,2,3,1,0); + if (BIT(a,12) & BIT(a,9)) src = BITSWAP08(src,7,6,4,5,3,2,1,0); + if (BIT(a,11) & ~BIT(a,6)) src = BITSWAP08(src,6,7,5,4,3,2,1,0); + + return src; +} + +static void seibu_sound_decrypt(INT32 length) +{ + UINT8 *decrypt = DrvZ80DecROM; + UINT8 *rom = DrvZ80ROM; + INT32 i; + + for (i = 0;i < length;i++) + { + UINT8 src = rom[i]; + + rom[i] = decrypt_data(i,src); + decrypt[i] = decrypt_opcode(i,src); + } +} + +static INT32 DrvInit() +{ + is_bootleg = 0; + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40000, 3, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x10000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x10000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x80000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x00000, 11, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x00000, 12, 1)) return 1; + + seibu_sound_decrypt(0x2000); + + DrvGfxDecode(); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x060000, 0x06d7ff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x06d800, 0x06dfff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x06e000, 0x06e7ff, SM_ROM); // 4b4g4r handler + SekMapMemory(DrvBg1RAM, 0x06e800, 0x06efff, SM_RAM); + SekMapMemory(DrvBg2RAM, 0x06f000, 0x06f7ff, SM_RAM); + SekMapMemory(DrvFgRAM, 0x06f800, 0x06ffff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x0a0000, 0x0a0057, SM_ROM); // a03ff + SekSetWriteByteHandler(0, tokib_write_byte); + SekSetWriteWordHandler(0, tokib_write_word); + SekSetReadByteHandler(0, tokib_read_byte); + SekSetReadWordHandler(0, tokib_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x1fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x1fff, 2, DrvZ80DecROM, DrvZ80ROM ); + ZetMapArea(0x2000, 0x27ff, 0, DrvZ80RAM); + ZetMapArea(0x2000, 0x27ff, 1, DrvZ80RAM); + ZetMapArea(0x2000, 0x27ff, 2, DrvZ80RAM); + ZetSetWriteHandler(toki_seibu_sound_write); + ZetSetReadHandler(toki_seibu_sound_read); + ZetClose(); + + BurnYM3812Init(3579545, &DrvFMIRQHandler, &DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3812(3579545); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 1000000 / 132, 1); + MSM6295SetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); + MSM6295ROM = DrvSndROM; + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 JujubaInit() +{ + is_bootleg = 0; + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (BurnLoadRom(Drv68KROM + 0x20001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x20000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x40000, 5, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 6, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x10000, 7, 1)) return 1; + memcpy(DrvZ80ROM, DrvZ80ROM + 0x2000, 0x6000); + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x10000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x00001, 11, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x40000, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x40001, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x80000, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x80001, 15, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0xc0000, 16, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0xc0001, 17, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00001, 18, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x20001, 19, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x40001, 20, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x60001, 21, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 22, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x20000, 23, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x40000, 24, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x60000, 25, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x00001, 26, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x20001, 27, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x40001, 28, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x60001, 29, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x00000, 30, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x20000, 31, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x40000, 32, 2)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x60000, 33, 2)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x00000, 34, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x10000, 35, 1)) return 1; + + UINT16 *PrgRom = (UINT16*)Drv68KROM; + for (INT32 i = 0; i < 0x30000; i++) { + PrgRom[i] = BITSWAP16(PrgRom[i], 15, 12, 13, 14, 11, 10, 9, 8, 7, 6, 5, 3, 4, 2, 1, 0); + } + + UINT8 *Decrypt = DrvZ80DecROM; + UINT8 *Rom = DrvZ80ROM; + memcpy(Decrypt, Rom, 0x2000); + for (INT32 i = 0;i < 0x2000; i++) { + UINT8 Src = Decrypt[i]; + Rom[i] = Src ^ 0x55; + } + + DrvGfxDecode(); + + UINT8 *Temp = (UINT8*)BurnMalloc(0x20000); + memcpy(Temp, DrvSndROM, 0x20000); + for (INT32 i = 0; i < 0x20000; i++ ) { + DrvSndROM[i] = Temp[BITSWAP24(i, 23, 22, 21, 20, 19, 18, 17, 16, 13, 14, 15, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)]; + } + BurnFree(Temp); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x060000, 0x06d7ff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x06d800, 0x06dfff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x06e000, 0x06e7ff, SM_ROM); // 4b4g4r handler + SekMapMemory(DrvBg1RAM, 0x06e800, 0x06efff, SM_RAM); + SekMapMemory(DrvBg2RAM, 0x06f000, 0x06f7ff, SM_RAM); + SekMapMemory(DrvFgRAM, 0x06f800, 0x06ffff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x0a0000, 0x0a0057, SM_ROM); // a03ff + SekSetWriteByteHandler(0, tokib_write_byte); + SekSetWriteWordHandler(0, tokib_write_word); + SekSetReadByteHandler(0, tokib_read_byte); + SekSetReadWordHandler(0, tokib_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x1fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x1fff, 2, DrvZ80DecROM, DrvZ80ROM ); + ZetMapArea(0x2000, 0x27ff, 0, DrvZ80RAM); + ZetMapArea(0x2000, 0x27ff, 1, DrvZ80RAM); + ZetMapArea(0x2000, 0x27ff, 2, DrvZ80RAM); + ZetSetWriteHandler(toki_seibu_sound_write); + ZetSetReadHandler(toki_seibu_sound_read); + ZetClose(); + + BurnYM3812Init(3579545, &DrvFMIRQHandler, &DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3812(3579545); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 1000000 / 132, 1); + MSM6295SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); + MSM6295ROM = DrvSndROM; + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM3812Exit(); + if (is_bootleg) { + MSM5205Exit(); + } else { + MSM6295Exit(0); + } + + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + TokibMSM5205Next = 0; + TokibMSM5205Toggle = 0; + is_bootleg = 0; + + return 0; +} + +static void draw_text_layer() +{ + UINT16 *vram = (UINT16*)DrvFgRAM; + + for (INT32 offs = 0x040; offs < 0x3c0; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + sy -= 16; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); + INT32 color = code >> 12; + code &= 0xfff; + + if (code == 0) continue; + + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0x0f, 0x100, DrvGfxROM0); + } +} + +static void draw_bg_layer(UINT8 *vidsrc, UINT8 *gfxbase, INT32 transp, INT32 gfxoffs, INT32 scrollx, INT32 scrolly) +{ + UINT16 *vram = (UINT16*)vidsrc; + + scrollx &= 0x1ff; + scrolly &= 0x1ff; + + for (INT32 offs = 0; offs < 0x800 / 2; offs++) + { + INT32 sx = (offs & 0x1f) << 4; + INT32 sy = (offs >> 5) << 4; + + sx -= scrollx; + if (sx < -15) sx += 0x200; + sy -= scrolly; + if (sy < -15) sy += 0x200; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); + INT32 color = code >> 12; + + if (transp) { + Render16x16Tile_Mask_Clip(pTransDraw, code & 0xfff, sx, sy, color, 4, 0x0f, gfxoffs, gfxbase); + } else { + Render16x16Tile_Clip(pTransDraw, code & 0xfff, sx, sy, color, 4, gfxoffs, gfxbase); + } + } +} + +static void draw_bg_layer_by_line(UINT8 *vidsrc, UINT8 *gfxbase, INT32 transp, INT32 gfxoffs, INT32 scrollx, INT32 scrolly, INT32 line) +{ + UINT8 *src; + UINT16 *vram = (UINT16*)vidsrc; + + INT32 starty = line + scrolly; + if (starty > 0x1ff) starty -= 0x200; + starty = (starty & 0x1f0) << 1; + + for (INT32 offs = starty; offs < starty + 0x20; offs++) + { + INT32 sx = (offs & 0x1f) << 4; + INT32 sy = (offs >> 5) << 4; + + sx -= scrollx; + if (sx < -15) sx += 0x200; + sy -= scrolly; + if (sy < -15) sy += 0x200; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); + INT32 color = ((code >> 8) & 0xf0) | gfxoffs; + + if (sx < -15 || sx >= nScreenWidth) continue; + src = gfxbase + ((code & 0xfff) << 8) + ((line - sy) << 4); + + sy = line * nScreenWidth; + + if (transp) { + for (INT32 x = 0; x < 16; x++, sx++) { + if (src[x] != 0x0f && sx >= 0 && sx < nScreenWidth) { + pTransDraw[sy + sx] = color | src[x]; + } + } + } else { + for (INT32 x = 0; x < 16; x++, sx++) { + if (sx >= 0 && sx < nScreenWidth) { + pTransDraw[sy + sx] = color | src[x]; + } + } + } + } +} + +static void tokib_draw_sprites() +{ + INT32 x,y,code,flipx,color,offs; + UINT16 *sprite_buffer = (UINT16*)(DrvSprBuf + 0xe); + UINT16 *sprite_word; + + for (offs = 0;offs < 0x642 / 2;offs += 4) + { + sprite_word = &sprite_buffer[offs]; + + if (BURN_ENDIAN_SWAP_INT16(sprite_word[0]) == 0xf100) + break; + + if (BURN_ENDIAN_SWAP_INT16(sprite_word[2])) + { + x = BURN_ENDIAN_SWAP_INT16(sprite_word[3]) & 0x1ff; + if (x > 256) + x -= 512; + + y = BURN_ENDIAN_SWAP_INT16(sprite_word[0]) & 0x1ff; + if (y > 256) + y = (512-y)+240; + else + y = 240-y; + + flipx = BURN_ENDIAN_SWAP_INT16(sprite_word[1]) & 0x4000; + code = BURN_ENDIAN_SWAP_INT16(sprite_word[1]) & 0x1fff; + color = BURN_ENDIAN_SWAP_INT16(sprite_word[2]) >> 12; + + y-=1+16; + + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); + } + } + } +} + + +static void toki_draw_sprites() +{ + INT32 x,y,xoffs,yoffs,code,flipx,flipy,color,offs; + UINT16 *sprite_buffer = (UINT16*)DrvSprBuf; + UINT16 *sprite_word; + + for (offs = (0x800/2)-4;offs >= 0;offs -= 4) + { + sprite_word = &sprite_buffer[offs]; + + if ((BURN_ENDIAN_SWAP_INT16(sprite_word[2]) != 0xf000) && (BURN_ENDIAN_SWAP_INT16(sprite_word[0]) != 0xffff)) + { + xoffs = (BURN_ENDIAN_SWAP_INT16(sprite_word[0]) &0xf0); + x = (BURN_ENDIAN_SWAP_INT16(sprite_word[2]) + xoffs) & 0x1ff; + if (x > 256) + x -= 512; + + yoffs = (BURN_ENDIAN_SWAP_INT16(sprite_word[0]) &0xf) << 4; + y = (BURN_ENDIAN_SWAP_INT16(sprite_word[3]) + yoffs) & 0x1ff; + if (y > 256) + y -= 512; + + color = BURN_ENDIAN_SWAP_INT16(sprite_word[1]) >> 12; + flipx = BURN_ENDIAN_SWAP_INT16(sprite_word[0]) & 0x100; + flipy = 0; + code = (BURN_ENDIAN_SWAP_INT16(sprite_word[1]) & 0xfff) + ((BURN_ENDIAN_SWAP_INT16(sprite_word[2]) & 0x8000) >> 3); + + if (0) { // flipscreen + x=240-x; + y=240-y; + if (flipx) flipx=0; else flipx=1; + flipy=1; + } + + y-=16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, color, 4, 0x0f, 0, DrvGfxROM1); + } + } + } + } +} + + +static INT32 TokibDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + UINT16 *scrollram = (UINT16 *)DrvScrollRAM; + + if (BURN_ENDIAN_SWAP_INT16(scrollram[3]) & 0x2000) { + draw_bg_layer(DrvBg1RAM, DrvGfxROM2, 0, 0x200, BURN_ENDIAN_SWAP_INT16(scrollram[1])-0x103, BURN_ENDIAN_SWAP_INT16(scrollram[0])+1+16); + draw_bg_layer(DrvBg2RAM, DrvGfxROM3, 1, 0x300, BURN_ENDIAN_SWAP_INT16(scrollram[3])-0x101, BURN_ENDIAN_SWAP_INT16(scrollram[2])+1+16); + } else { + draw_bg_layer(DrvBg2RAM, DrvGfxROM3, 0, 0x300, BURN_ENDIAN_SWAP_INT16(scrollram[3])-0x101, BURN_ENDIAN_SWAP_INT16(scrollram[2])+1+16); + draw_bg_layer(DrvBg1RAM, DrvGfxROM2, 1, 0x200, BURN_ENDIAN_SWAP_INT16(scrollram[1])-0x103, BURN_ENDIAN_SWAP_INT16(scrollram[0])+1+16); + } + + tokib_draw_sprites(); + + draw_text_layer(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +void assemble_inputs(UINT16 in0base, UINT16 in1base) +{ + DrvInps[0] = in0base; + DrvInps[1] = in1base; + + for (INT32 i = 0; i < 16; i++) { + DrvInps[0] ^= (DrvJoy1[i] & 1) << i; + DrvInps[1] ^= (DrvJoy2[i] & 1) << i; + } +} + +static INT32 TokibFrame() +{ + if (DrvReset) { + TokibDoReset(); + } + + INT32 nInterleave = MSM5205CalcInterleave(0, 4000000); + + SekNewFrame(); + ZetNewFrame(); + + assemble_inputs(0x3f3f, 0xff1f); + + INT32 nCyclesToDo[2] = { 10000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesToDo[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + SekClose(); + + ZetOpen(0); + BurnTimerUpdateYM3812(i * (nCyclesToDo[1] / nInterleave)); + MSM5205Update(); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrameYM3812(nCyclesToDo[1]); + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + if (pBurnDraw) { + TokibDraw(); + } + + memcpy (DrvSprBuf, DrvSprRAM, 0x800); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + UINT16 *scrollram = (UINT16*)DrvScrollRAM; + INT32 bgscrolly,bgscrollx,fgscrolly,fgscrollx; + + bgscrollx = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x06]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x06]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x05]) & 0x10) << 4); + bgscrolly = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0e]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0e]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0d]) & 0x10) << 4); + + fgscrollx = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x16]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x16]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x15]) & 0x10) << 4); + fgscrolly = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1e]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1e]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1d]) & 0x10) << 4); + + if (~nBurnLayer & 1) memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); + + if (BURN_ENDIAN_SWAP_INT16(scrollram[0x28]) & 0x0100) { + if (nBurnLayer & 1) draw_bg_layer(DrvBg1RAM, DrvGfxROM2, 0, 0x200, bgscrollx, bgscrolly+16); + if (nBurnLayer & 2) draw_bg_layer(DrvBg2RAM, DrvGfxROM3, 1, 0x300, fgscrollx, fgscrolly+16); + } else { + if (nBurnLayer & 2) draw_bg_layer(DrvBg2RAM, DrvGfxROM3, 0, 0x300, fgscrollx, fgscrolly+16); + if (nBurnLayer & 1) draw_bg_layer(DrvBg1RAM, DrvGfxROM2, 1, 0x200, bgscrollx, bgscrolly+16); + } +#if 0 + flip_screen_set((toki_scrollram16[0x28]&0x8000)==0); + +#endif + + toki_draw_sprites(); + + draw_text_layer(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrawByLine(INT32 line) +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + UINT16 *scrollram = (UINT16*)DrvScrollRAM; + INT32 bgscrolly,bgscrollx,fgscrolly,fgscrollx; + + bgscrollx = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x06]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x06]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x05]) & 0x10) << 4); + bgscrolly = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0e]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0e]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x0d]) & 0x10) << 4); + + fgscrollx = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x16]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x16]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x15]) & 0x10) << 4); + fgscrolly = ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1e]) & 0x7f) << 1) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1e]) & 0x80) >> 7) | ((BURN_ENDIAN_SWAP_INT16(scrollram[0x1d]) & 0x10) << 4); + + //memset (pTransDraw + line * 2, 0, nScreenWidth * 2); + if (~nBurnLayer & 1) memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); + + if (BURN_ENDIAN_SWAP_INT16(scrollram[0x28]) & 0x0100) { + if (nBurnLayer & 1) draw_bg_layer_by_line(DrvBg1RAM, DrvGfxROM2, 0, 0x200, bgscrollx, bgscrolly+16, line); + if (nBurnLayer & 2) draw_bg_layer_by_line(DrvBg2RAM, DrvGfxROM3, 1, 0x300, fgscrollx, fgscrolly+16, line); + } else { + if (nBurnLayer & 2) draw_bg_layer_by_line(DrvBg2RAM, DrvGfxROM3, 0, 0x300, fgscrollx, fgscrolly+16, line); + if (nBurnLayer & 1) draw_bg_layer_by_line(DrvBg1RAM, DrvGfxROM2, 1, 0x200, bgscrollx, bgscrolly+16, line); + } + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + SekNewFrame(); + ZetNewFrame(); + + assemble_inputs(0xffff, 0xffff); + + INT32 nInterleave = 256 * 2; + INT32 nCycleSegment; + nCyclesTotal[0] = 10000000 / 60; + nCyclesTotal[1] = 3579545 / 60 ; + INT32 nCyclesDone[2] = { 0, 0 }; + + + SekOpen(0); + ZetOpen(0); +//bprintf (PRINT_NORMAL, _T("before run\n")); + + for (INT32 i = 0; i < nInterleave; i++) + { + nCycleSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); + nCyclesDone[0] += SekRun(nCycleSegment); + + BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); + + INT32 scanline = i >> 1; + + if (pTransDraw && scanline > 15 && scanline < 240 && !(i&1)) { + DrawByLine(scanline-16); + } + } + + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + + ZetClose(); + SekClose(); +//bprintf (PRINT_NORMAL, _T("before sprites\n")); + if (pBurnDraw) { + toki_draw_sprites(); + + draw_text_layer(); + + BurnTransferCopy(DrvPalette); + } + + if (pBurnSoundOut) { + ZetOpen(0); + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + memcpy (DrvSprBuf, DrvSprRAM, 0x800); +//bprintf (PRINT_NORMAL, _T("end\n")); + + return 0; +} + + +// Toki (World set 1) + +static struct BurnRomInfo tokiRomDesc[] = { + { "l10_6.bin", 0x20000, 0x94015d91, 1 }, // 0 main + { "k10_4e.bin", 0x20000, 0x531bd3ef, 1 }, // 1 + { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 + { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 + + { "tokijp.008", 0x02000, 0x6c87c4c5, 2 }, // 4 audio + { "tokijp.007", 0x10000, 0xa67969c4, 2 }, // 5 + + { "tokijp.001", 0x10000, 0x8aa964a2, 3 }, // 6 gfx1 + { "tokijp.002", 0x10000, 0x86e87e48, 3 }, // 7 + + { "toki.ob1", 0x80000, 0xa27a80ba, 4 }, // 8 gfx2 + { "toki.ob2", 0x80000, 0xfa687718, 4 }, // 9 + + { "toki.bk1", 0x80000, 0xfdaa5f4b, 5 }, // 10 gfx3 + + { "toki.bk2", 0x80000, 0xd86ac664, 6 }, // 11 gfx4 + + { "tokijp.009", 0x20000, 0xae7a6b8b, 7 }, // 12 oki +}; + +STD_ROM_PICK(toki) +STD_ROM_FN(toki) + +struct BurnDriver BurnDrvToki = { + "toki", NULL, NULL, NULL, "1989", + "Toki (World set 1)\0", NULL, "Tad", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, tokiRomInfo, tokiRomName, NULL, NULL, TokiInputInfo, TokiDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Toki (World set 2) + +static struct BurnRomInfo tokiaRomDesc[] = { + { "tokijp.006", 0x20000, 0x03d726b1, 1 }, // 0 main + { "4c.10k", 0x20000, 0xb2c345c5, 1 }, // 1 + { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 + { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 + + { "tokijp.008", 0x02000, 0x6c87c4c5, 2 }, // 4 audio + { "tokijp.007", 0x10000, 0xa67969c4, 2 }, // 5 + + { "tokijp.001", 0x10000, 0x8aa964a2, 3 }, // 6 gfx1 + { "tokijp.002", 0x10000, 0x86e87e48, 3 }, // 7 + + { "toki.ob1", 0x80000, 0xa27a80ba, 4 }, // 8 gfx2 + { "toki.ob2", 0x80000, 0xfa687718, 4 }, // 9 + + { "toki.bk1", 0x80000, 0xfdaa5f4b, 5 }, // 10 gfx3 + + { "toki.bk2", 0x80000, 0xd86ac664, 6 }, // 11 gfx4 + + { "tokijp.009", 0x20000, 0xae7a6b8b, 7 }, // 12 oki +}; + +STD_ROM_PICK(tokia) +STD_ROM_FN(tokia) + +struct BurnDriver BurnDrvTokia = { + "tokia", "toki", NULL, NULL, "1989", + "Toki (World set 2)\0", NULL, "Tad", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, tokiaRomInfo, tokiaRomName, NULL, NULL, TokiInputInfo, TokiDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Toki (US) + +static struct BurnRomInfo tokiuRomDesc[] = { + { "6b.10m", 0x20000, 0x3674d9fe, 1 }, // 0 main + { "14.10k", 0x20000, 0xbfdd48af, 1 }, // 1 + { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 + { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 + + { "tokijp.008", 0x02000, 0x6c87c4c5, 2 }, // 4 audio + { "tokijp.007", 0x10000, 0xa67969c4, 2 }, // 5 + + { "tokijp.001", 0x10000, 0x8aa964a2, 3 }, // 6 gfx1 + { "tokijp.002", 0x10000, 0x86e87e48, 3 }, // 7 + + { "toki.ob1", 0x80000, 0xa27a80ba, 4 }, // 8 gfx2 + { "toki.ob2", 0x80000, 0xfa687718, 4 }, // 9 + + { "toki.bk1", 0x80000, 0xfdaa5f4b, 5 }, // 10 gfx3 + + { "toki.bk2", 0x80000, 0xd86ac664, 6 }, // 11 gfx4 + + { "tokijp.009", 0x20000, 0xae7a6b8b, 7 }, // 12 oki +}; + +STD_ROM_PICK(tokiu) +STD_ROM_FN(tokiu) + +struct BurnDriver BurnDrvTokiu = { + "tokiu", "toki", NULL, NULL, "1989", + "Toki (US)\0", NULL, "Tad (Fabtek license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, tokiuRomInfo, tokiuRomName, NULL, NULL, TokiInputInfo, TokiDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// JuJu Densetsu (Japan) + +static struct BurnRomInfo jujuRomDesc[] = { + { "tokijp.006", 0x20000, 0x03d726b1, 1 }, // 0 main + { "tokijp.004", 0x20000, 0x54a45e12, 1 }, // 1 + { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 + { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 + + { "tokijp.008", 0x02000, 0x6c87c4c5, 2 }, // 4 audio + { "tokijp.007", 0x10000, 0xa67969c4, 2 }, // 5 + + { "tokijp.001", 0x10000, 0x8aa964a2, 3 }, // 6 gfx1 + { "tokijp.002", 0x10000, 0x86e87e48, 3 }, // 7 + + { "toki.ob1", 0x80000, 0xa27a80ba, 4 }, // 8 gfx2 + { "toki.ob2", 0x80000, 0xfa687718, 4 }, // 9 + + { "toki.bk1", 0x80000, 0xfdaa5f4b, 5 }, // 10 gfx3 + + { "toki.bk2", 0x80000, 0xd86ac664, 6 }, // 11 gfx4 + + { "tokijp.009", 0x20000, 0xae7a6b8b, 7 }, // 12 oki +}; + +STD_ROM_PICK(juju) +STD_ROM_FN(juju) + +struct BurnDriver BurnDrvJuju = { + "juju", "toki", NULL, NULL, "1989", + "JuJu Densetsu (Japan)\0", NULL, "Tad", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, jujuRomInfo, jujuRomName, NULL, NULL, TokiInputInfo, TokiDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// JuJu Densetsu (Playmark bootleg) + +static struct BurnRomInfo jujubRomDesc[] = { + { "jujub_playmark.e3", 0x20000, 0xb50c73ec, 1 }, // 0 main + { "jujub_playmark.e5", 0x20000, 0xb2812942, 1 }, // 1 + { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 + { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 + + { "toki.e1", 0x10000, 0x2832ef75, 2 }, // 4 audio + + { "toki.e21", 0x08000, 0xbb8cacbd, 3 }, // 5 gfx1 + { "toki.e13", 0x08000, 0x052ad275, 3 }, // 6 + { "toki.e22", 0x08000, 0x04dcdc21, 3 }, // 7 + { "toki.e7", 0x08000, 0x70729106, 3 }, // 8 + + { "toki.e26", 0x20000, 0xa8ba71fc, 4 }, // 9 gfx2 + { "toki.e28", 0x20000, 0x29784948, 4 }, // 10 + { "toki.e34", 0x20000, 0xe5f6e19b, 4 }, // 11 + { "toki.e36", 0x20000, 0x96e8db8b, 4 }, // 12 + { "toki.e30", 0x20000, 0x770d2b1b, 4 }, // 13 + { "toki.e32", 0x20000, 0xc289d246, 4 }, // 14 + { "toki.e38", 0x20000, 0x87f4e7fb, 4 }, // 15 + { "toki.e40", 0x20000, 0x96e87350, 4 }, // 16 + + { "toki.e23", 0x10000, 0xfeb13d35, 5 }, // 17 gfx3 + { "toki.e24", 0x10000, 0x5b365637, 5 }, // 18 + { "toki.e15", 0x10000, 0x617c32e6, 5 }, // 19 + { "toki.e16", 0x10000, 0x2a11c0f0, 5 }, // 20 + { "toki.e17", 0x10000, 0xfbc3d456, 5 }, // 21 + { "toki.e18", 0x10000, 0x4c2a72e1, 5 }, // 22 + { "toki.e8", 0x10000, 0x46a1b821, 5 }, // 23 + { "toki.e9", 0x10000, 0x82ce27f6, 5 }, // 24 + + { "toki.e25", 0x10000, 0x63026cad, 6 }, // 25 gfx4 + { "toki.e20", 0x10000, 0xa7f2ce26, 6 }, // 26 + { "toki.e11", 0x10000, 0x48989aa0, 6 }, // 27 + { "toki.e12", 0x10000, 0xc2ad9342, 6 }, // 28 + { "toki.e19", 0x10000, 0x6cd22b18, 6 }, // 29 + { "toki.e14", 0x10000, 0x859e313a, 6 }, // 30 + { "toki.e10", 0x10000, 0xe15c1d0f, 6 }, // 31 + { "toki.e6", 0x10000, 0x6f4b878a, 6 }, // 32 +}; + +STD_ROM_PICK(jujub) +STD_ROM_FN(jujub) + +struct BurnDriver BurnDrvJujub = { + "jujub", "toki", NULL, NULL, "1989", + "JuJu Densetsu (Playmark bootleg)\0", NULL, "bootleg (Playmark)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, jujubRomInfo, jujubRomName, NULL, NULL, TokibInputInfo, TokibDIPInfo, + TokibInit, DrvExit, TokibFrame, TokibDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// JuJu Densetsu (Japan, bootleg) + +static struct BurnRomInfo jujubaRomDesc[] = { + { "8.19g", 0x10000, 0x208fb08a, 1 }, // 0 main + { "5.19e", 0x10000, 0x722e5183, 1 }, // 1 + { "9.20g", 0x10000, 0xcb82cc33, 1 }, // 2 + { "6.20e", 0x10000, 0x826ab39d, 1 }, // 3 + { "10.21g", 0x10000, 0x6c7a3ffe, 1 }, // 4 + { "7.21e", 0x10000, 0xb0628230, 1 }, // 5 + + { "3.9c", 0x08000, 0x808f5e44, 2 }, // 6 audio + { "4.11c", 0x10000, 0xa67969c4, 2 }, // 7 + + { "5.19h", 0x10000, 0x8aa964a2, 3 }, // 8 gfx1 + { "6.20h", 0x10000, 0x86e87e48, 3 }, // 9 + + { "1.17d", 0x20000, 0xa027bd8e, 4 }, // 10 gfx2 + { "27.17b", 0x20000, 0x43a767ea, 4 }, // 11 + { "2.18d", 0x20000, 0x1aecc9d8, 4 }, // 12 + { "28.18b", 0x20000, 0xd65c0c6d, 4 }, // 13 + { "3.20d", 0x20000, 0xcedaccaf, 4 }, // 14 + { "29.20b", 0x20000, 0x013f539b, 4 }, // 15 + { "4.21d", 0x20000, 0x6a8e6e22, 4 }, // 16 + { "30.21b", 0x20000, 0x25d9a16c, 4 }, // 17 + + { "11.1j", 0x10000, 0x6ad15560, 5 }, // 18 gfx3 + { "12.2j", 0x10000, 0x68534844, 5 }, // 19 + { "13.4j", 0x10000, 0xf271be5a, 5 }, // 20 + { "14.5j", 0x10000, 0x5d4c187a, 5 }, // 21 + { "19.1l", 0x10000, 0x10afdf03, 5 }, // 22 + { "20.2l", 0x10000, 0x2dc54f41, 5 }, // 23 + { "21.4l", 0x10000, 0x946862a3, 5 }, // 24 + { "22.5l", 0x10000, 0xb45f5608, 5 }, // 25 + + { "15.18j", 0x10000, 0xcb8b1d31, 6 }, // 26 gfx4 + { "16.19j", 0x10000, 0x81594e0a, 6 }, // 27 + { "17.20j", 0x10000, 0x4acd44ce, 6 }, // 28 + { "18.21j", 0x10000, 0x25cfe9c3, 6 }, // 29 + { "23.18l", 0x10000, 0x06c8d622, 6 }, // 30 + { "24.19l", 0x10000, 0x362a0506, 6 }, // 31 + { "25.20l", 0x10000, 0xbe064c4b, 6 }, // 32 + { "26.21l", 0x10000, 0xf8b5b38d, 6 }, // 33 + + { "1.6a", 0x10000, 0x377153ad, 7 }, // 34 oki + { "2.7a", 0x10000, 0x093ca15d, 7 }, // 35 +}; + +STD_ROM_PICK(jujuba) +STD_ROM_FN(jujuba) + +struct BurnDriver BurnDrvJujuba = { + "jujuba", "toki", NULL, NULL, "1989", + "JuJu Densetsu (Japan, bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, jujubaRomInfo, jujubaRomName, NULL, NULL, TokiInputInfo, TokiDIPInfo, + JujubaInit, DrvExit, DrvFrame, DrvDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + +// Toki (Datsu bootleg) + +static struct BurnRomInfo tokibRomDesc[] = { + { "toki.e3", 0x20000, 0xae9b3da4, 1 }, // 0 main + { "toki.e5", 0x20000, 0x66a5a1d6, 1 }, // 1 + { "tokijp.005", 0x10000, 0xd6a82808, 1 }, // 2 + { "tokijp.003", 0x10000, 0xa01a5b10, 1 }, // 3 + + { "toki.e1", 0x10000, 0x2832ef75, 2 }, // 4 audio + + { "toki.e21", 0x08000, 0xbb8cacbd, 3 }, // 5 gfx1 + { "toki.e13", 0x08000, 0x052ad275, 3 }, // 6 + { "toki.e22", 0x08000, 0x04dcdc21, 3 }, // 7 + { "toki.e7", 0x08000, 0x70729106, 3 }, // 8 + + { "toki.e26", 0x20000, 0xa8ba71fc, 4 }, // 9 gfx2 + { "toki.e28", 0x20000, 0x29784948, 4 }, // 10 + { "toki.e34", 0x20000, 0xe5f6e19b, 4 }, // 11 + { "toki.e36", 0x20000, 0x96e8db8b, 4 }, // 12 + { "toki.e30", 0x20000, 0x770d2b1b, 4 }, // 13 + { "toki.e32", 0x20000, 0xc289d246, 4 }, // 14 + { "toki.e38", 0x20000, 0x87f4e7fb, 4 }, // 15 + { "toki.e40", 0x20000, 0x96e87350, 4 }, // 16 + + { "toki.e23", 0x10000, 0xfeb13d35, 5 }, // 17 gfx3 + { "toki.e24", 0x10000, 0x5b365637, 5 }, // 18 + { "toki.e15", 0x10000, 0x617c32e6, 5 }, // 19 + { "toki.e16", 0x10000, 0x2a11c0f0, 5 }, // 20 + { "toki.e17", 0x10000, 0xfbc3d456, 5 }, // 21 + { "toki.e18", 0x10000, 0x4c2a72e1, 5 }, // 22 + { "toki.e8", 0x10000, 0x46a1b821, 5 }, // 23 + { "toki.e9", 0x10000, 0x82ce27f6, 5 }, // 24 + + { "toki.e25", 0x10000, 0x63026cad, 6 }, // 25 gfx4 + { "toki.e20", 0x10000, 0xa7f2ce26, 6 }, // 26 + { "toki.e11", 0x10000, 0x48989aa0, 6 }, // 27 + { "toki.e12", 0x10000, 0xc2ad9342, 6 }, // 28 + { "toki.e19", 0x10000, 0x6cd22b18, 6 }, // 29 + { "toki.e14", 0x10000, 0x859e313a, 6 }, // 30 + { "toki.e10", 0x10000, 0xe15c1d0f, 6 }, // 31 + { "toki.e6", 0x10000, 0x6f4b878a, 6 }, // 32 +}; + +STD_ROM_PICK(tokib) +STD_ROM_FN(tokib) + +struct BurnDriver BurnDrvTokib = { + "tokib", "toki", NULL, NULL, "1989", + "Toki (bootleg)\0", NULL, "bootleg (Datsu)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0, + NULL, tokibRomInfo, tokibRomName, NULL, NULL, TokibInputInfo, TokibDIPInfo, + TokibInit, DrvExit, TokibFrame, TokibDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + diff --git a/src/burn/drv/pre90s/d_vulgus.cpp b/src/burn/drv/pre90s/d_vulgus.cpp index 11fa72839..82d4f8eac 100644 --- a/src/burn/drv/pre90s/d_vulgus.cpp +++ b/src/burn/drv/pre90s/d_vulgus.cpp @@ -1,801 +1,799 @@ -// FB Alpha Vulgus drive module -// Based on MAME driver by Mirko Buffoni - -// To do: flip screen - -#include "tiles_generic.h" -#include "z80_intf.h" - -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *Mem, *MemEnd, *Rom0, *Rom1, *Gfx0, *Gfx1, *Gfx2, *Prom; -static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvDips[2], DrvReset; -static INT16 *pAY8910Buffer[6], *pFMBuffer = NULL; -static UINT32 *DrvPalette, *Palette; -static UINT8 DrvRecalc; - -static INT32 vulgus_soundlatch; -static INT32 vulgus_scroll[2]; -static INT32 vulgus_palette_bank; -static INT32 vulgus_flipscreen; - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 7, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 6, "p2 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, - - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p2 right" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p2 left" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 2"}, - - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip 1" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip 2" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x03, 0x01, "1" }, - {0x11, 0x01, 0x03, 0x02, "2" }, - {0x11, 0x01, 0x03, 0x03, "3" }, - {0x11, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 7 , "Coin B" }, - {0x11, 0x01, 0x1c, 0x10, "5 Coins 1 Play" }, - {0x11, 0x01, 0x1c, 0x08, "4 Coins 1 Play" }, - {0x11, 0x01, 0x1c, 0x18, "3 Coins 1 Play" }, - {0x11, 0x01, 0x1c, 0x04, "2 Coins 1 Play" }, - {0x11, 0x01, 0x1c, 0x1c, "1 Coin 1 Play" }, - {0x11, 0x01, 0x1c, 0x0c, "1 Coin 2 Plays" }, - {0x11, 0x01, 0x1c, 0x14, "1 Coin 3 Plays" }, -// {0x11, 0x01, 0x1c, 0x00, "Invalid" }, - - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x11, 0x01, 0xe0, 0x80, "5 Coins 1 Play" }, - {0x11, 0x01, 0xe0, 0x40, "4 Coins 1 Play" }, - {0x11, 0x01, 0xe0, 0xc0, "3 Coins 1 Play" }, - {0x11, 0x01, 0xe0, 0x20, "2 Coins 1 Play" }, - {0x11, 0x01, 0xe0, 0xe0, "1 Coin 1 Play" }, - {0x11, 0x01, 0xe0, 0x60, "1 Coin 2 Plays" }, - {0x11, 0x01, 0xe0, 0xa0, "1 Coin 3 Plays" }, - {0x11, 0x01, 0xe0, 0x00, "Freeplay" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty?" }, - {0x12, 0x01, 0x03, 0x02, "Easy?" }, - {0x12, 0x01, 0x03, 0x03, "Normal?" }, - {0x12, 0x01, 0x03, 0x01, "Hard?" }, - {0x12, 0x01, 0x03, 0x00, "Hardest?" }, - - {0 , 0xfe, 0 , 2 , "Demo Music" }, - {0x12, 0x01, 0x04, 0x00, "Off" }, - {0x12, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x08, 0x00, "Off" }, - {0x12, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x12, 0x01, 0x70, 0x30, "10000 50000" }, - {0x12, 0x01, 0x70, 0x50, "10000 60000" }, - {0x12, 0x01, 0x70, 0x10, "10000 70000" }, - {0x12, 0x01, 0x70, 0x70, "20000 60000" }, - {0x12, 0x01, 0x70, 0x60, "20000 70000" }, - {0x12, 0x01, 0x70, 0x20, "20000 80000" }, - {0x12, 0x01, 0x70, 0x40, "30000 70000" }, - {0x12, 0x01, 0x70, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x80, 0x00, "Upright" }, - {0x12, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(Drv) - -void __fastcall vulgus_write_main(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc800: - vulgus_soundlatch = data; - break; - - case 0xc802: - case 0xc803: - vulgus_scroll[address & 1] = (vulgus_scroll[address & 1] & 0xff00) | data; - break; - - case 0xc804: - vulgus_flipscreen = data >> 7; - break; - - case 0xc805: - vulgus_palette_bank = data & 3; - break; - - case 0xc902: - case 0xc903: - vulgus_scroll[address & 1] = (vulgus_scroll[address & 1] & 0x00ff) | (data << 8); - break; - } -} - -UINT8 __fastcall vulgus_read_main(UINT16 address) -{ - UINT8 ret; - - switch (address) - { - case 0xc000: - { - ret = 0xff; - - for (INT32 i = 0; i < 8; i++) ret ^= DrvJoy1[i] << i; - - return ret; - } - - case 0xc001: - { - ret = 0xff; - - for (INT32 i = 0; i < 5; i++) ret ^= DrvJoy2[i] << i; - - return ret; - } - - case 0xc002: - { - ret = 0xff; - - for (INT32 i = 0; i < 5; i++) ret ^= DrvJoy3[i] << i; - - return ret; - } - - case 0xc003: - return DrvDips[0]; - - case 0xc004: - return DrvDips[1]; - } - - return 0; -} - -void __fastcall vulgus_write_sound(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8000: - case 0x8001: - case 0xc000: - case 0xc001: - AY8910Write((address >> 14) & 1, address & 1, data); - break; - } -} - -UINT8 __fastcall vulgus_read_sound(UINT16 address) -{ - switch (address) - { - case 0x6000: - return vulgus_soundlatch; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - vulgus_flipscreen = 0; - vulgus_soundlatch = 0; - vulgus_palette_bank = 0; - - vulgus_scroll[0] = 0; - vulgus_scroll[1] = 0; - - memset (Rom0 + 0xcc00, 0, 0x2400); - memset (Rom1 + 0x4000, 0, 0x0800); - - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - - AY8910Reset(i); - } - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Rom0 = Next; Next += 0x10000; - Rom1 = Next; Next += 0x05000; - Gfx0 = Next; Next += 0x08000; - Gfx1 = Next; Next += 0x20000; - Gfx2 = Next; Next += 0x10000; - Prom = Next; Next += 0x00600; - - Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - - pFMBuffer = (INT16*)Next; Next += (nBurnSoundLen * 6 * sizeof(INT16)); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvPaletteInit() -{ - UINT32 *tmp = (UINT32*)BurnMalloc(0x100 * sizeof(UINT32)); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 256; i++) - { - INT32 bit0,bit1,bit2,bit3,r,g,b; - - bit0 = (Prom[ 0 + i] >> 0) & 0x01; - bit1 = (Prom[ 0 + i] >> 1) & 0x01; - bit2 = (Prom[ 0 + i] >> 2) & 0x01; - bit3 = (Prom[ 0 + i] >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (Prom[256 + i] >> 0) & 0x01; - bit1 = (Prom[256 + i] >> 1) & 0x01; - bit2 = (Prom[256 + i] >> 2) & 0x01; - bit3 = (Prom[256 + i] >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (Prom[512 + i] >> 0) & 0x01; - bit1 = (Prom[512 + i] >> 1) & 0x01; - bit2 = (Prom[512 + i] >> 2) & 0x01; - bit3 = (Prom[512 + i] >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - tmp[i] = (r << 16) | (g << 8) | b; - } - - for (INT32 i = 0; i < 0x100; i++) { - Palette[i] = tmp[32 + Prom[0x300 + i]]; - } - - for (INT32 i = 0; i < 0x100; i++) { - Palette[0x100 + i] = tmp[16 + Prom[0x400 + i]]; - } - - for (INT32 i = 0; i < 0x100; i++) { - Palette[0x400 + i] = tmp[Prom[0x500 + i] + 0x00]; - Palette[0x500 + i] = tmp[Prom[0x500 + i] + 0x40]; - Palette[0x600 + i] = tmp[Prom[0x500 + i] + 0x80]; - Palette[0x700 + i] = tmp[Prom[0x500 + i] + 0xc0]; - } - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvGfxDecode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0xc000); - if (tmp == NULL) { - return 1; - } - - static INT32 SpriPlanes[4] = { 0x20004, 0x20000, 0x00004, 0x00000 }; - static INT32 SpriXOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, - 0x100, 0x101, 0x102, 0x103, 0x108, 0x109, 0x10a, 0x10b }; - static INT32 SpriYOffs[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, - 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0 }; - - static INT32 TilePlanes[3] = { 0x00000, 0x20000, 0x40000 }; - static INT32 TileXOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087 }; - static INT32 TileYOffs[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, - 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; - - memcpy (tmp, Gfx0, 0x2000); - - GfxDecode(0x200, 2, 8, 8, SpriPlanes + 2, SpriXOffs, SpriYOffs, 0x080, tmp, Gfx0); - - memcpy (tmp, Gfx1, 0xc000); - - GfxDecode(0x200, 3, 16, 16, TilePlanes + 0, TileXOffs, TileYOffs, 0x100, tmp, Gfx1); - - memcpy (tmp, Gfx2, 0x8000); - - GfxDecode(0x100, 4, 16, 16, SpriPlanes + 0, SpriXOffs, SpriYOffs, 0x200, tmp, Gfx2); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - for (INT32 i = 0; i < 6; i++) { - pAY8910Buffer[i] = pFMBuffer + nBurnSoundLen * i; - } - - { - for (INT32 i = 0; i < 5; i++) { - if (BurnLoadRom(Rom0 + i * 0x2000, i + 0, 1)) return 1; - } - - if (BurnLoadRom(Rom1 + 0x0000, 5, 1)) return 1; - if (BurnLoadRom(Gfx0 + 0x0000, 6, 1)) return 1; - - for (INT32 i = 0; i < 6; i++) { - if (BurnLoadRom(Gfx1 + i * 0x2000, i + 7, 1)) return 1; - } - - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(Gfx2 + i * 0x2000, i + 13, 1)) return 1; - } - - for (INT32 i = 0; i < 6; i++) { - if (BurnLoadRom(Prom + i * 0x0100, i + 17, 1)) return 1; - } - - if (DrvPaletteInit()) return 1; - if (DrvGfxDecode()) return 1; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x9fff, 0, Rom0 + 0x0000); - ZetMapArea(0x0000, 0x9fff, 2, Rom0 + 0x0000); - ZetMapArea(0xcc00, 0xccff, 0, Rom0 + 0xcc00); - ZetMapArea(0xcc00, 0xccff, 1, Rom0 + 0xcc00); - ZetMapArea(0xd000, 0xdfff, 0, Rom0 + 0xd000); - ZetMapArea(0xd000, 0xdfff, 1, Rom0 + 0xd000); - ZetMapArea(0xe000, 0xefff, 0, Rom0 + 0xe000); - ZetMapArea(0xe000, 0xefff, 1, Rom0 + 0xe000); - ZetMapArea(0xe000, 0xefff, 2, Rom0 + 0xe000); - ZetSetWriteHandler(vulgus_write_main); - ZetSetReadHandler(vulgus_read_main); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x1fff, 0, Rom1 + 0x0000); - ZetMapArea(0x0000, 0x1fff, 2, Rom1 + 0x0000); - ZetMapArea(0x4000, 0x47ff, 0, Rom1 + 0x4000); - ZetMapArea(0x4000, 0x47ff, 1, Rom1 + 0x4000); - ZetMapArea(0x4000, 0x47ff, 2, Rom1 + 0x4000); - ZetSetWriteHandler(vulgus_write_sound); - ZetSetReadHandler(vulgus_read_sound); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - AY8910Exit(0); - AY8910Exit(1); - GenericTilesExit(); - - BurnFree (Mem); - - Mem = MemEnd = Rom0 = Rom1 = NULL; - Gfx0 = Gfx1 = Gfx2 = Prom = NULL; - pFMBuffer = NULL; - - for (INT32 i = 0; i < 6; i++) { - pAY8910Buffer[i] = NULL; - } - - DrvPalette = Palette = NULL; - - DrvRecalc = 0; - - vulgus_soundlatch = 0; - vulgus_scroll[0] = vulgus_scroll[1] = 0; - vulgus_palette_bank = 0; - vulgus_flipscreen = 0; - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x800; i++) { - INT32 color = Palette[i]; - DrvPalette[i] = BurnHighCol(color >> 16, color >> 8, color, 0); - } - } - - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 sx, sy, color, code, flipx, flipy; - - sx = (offs >> 1) & 0x1f0; - sy = (offs << 4) & 0x1f0; - - sx -= vulgus_scroll[1]; - sy -= vulgus_scroll[0]; - - if (sx < -15) sx += 0x200; // wrap - if (sy < -15) sy += 0x200; - - color = Rom0[0xdc00 + offs]; - code = Rom0[0xd800 + offs] | ((color & 0x80) << 1); - - flipx = color & 0x20; - flipy = color & 0x40; - - color = (color & 0x1f) | (vulgus_palette_bank << 5); - - sy -= 0x10; - - if (flipy) { - if (flipx) { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 3, 0x400, Gfx1); - } else { - Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 3, 0x400, Gfx1); - } - } else { - if (flipx) { - Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 3, 0x400, Gfx1); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 3, 0x400, Gfx1); - } - } - } - - for (INT32 offs = 0x7c; offs >= 0; offs -= 4) - { - INT32 code, i, color, sx, sy; - - code = Rom0[0xcc00 + offs]; - color = Rom0[0xcc01 + offs] & 0x0f; - sx = Rom0[0xcc03 + offs]; - sy = Rom0[0xcc02 + offs]; - - sy -= 0x10; - - i = Rom0[0xcc01 + offs] >> 6; - if (i == 2) i = 3; - - for (; i >= 0; i--) { - INT32 ssy = sy + (i << 4); - Render16x16Tile_Mask_Clip(pTransDraw, code + i, sx, ssy, color, 4, 0x0f, 0x100, Gfx2); - if (ssy > 240) { // wrap - Render16x16Tile_Mask_Clip(pTransDraw, code + i, sx, ssy - 256, color, 4, 0x0f, 0x100, Gfx2); - } - } - } - - for (INT32 offs = 0x40; offs < 0x3c0; offs++) - { - INT32 sx, sy, color, code; - - color = Rom0[0xd400 + offs]; - code = Rom0[0xd000 + offs] | ((color & 0x80) << 1); - - if (code == 0x20) continue; - - UINT8 *src = Gfx0 + (code << 6); - - color = (color & 0x3f) << 2; - - sx = (offs << 3) & 0xf8; - sy = (offs >> 2) & 0xf8; - - sy -= 0x10; - - for (INT32 y = sy; y < sy + 8; y++) { - for (INT32 x = sx; x < sx + 8; x++, src++) { - INT32 pxl = color | *src; - if (Prom[0x300 | pxl] == 0x0f) continue; - pTransDraw[(y << 8) | x] = pxl; - } - } - } - - if (vulgus_flipscreen) { - INT32 nSize = (nScreenWidth * nScreenHeight) - 1; - for (INT32 i = 0; i < nSize >> 1; i++) { - INT32 n = pTransDraw[i]; - pTransDraw[i] = pTransDraw[nSize - i]; - pTransDraw[nSize - i] = n; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - INT32 nInterleave = 8; - INT32 nSoundBufferPos = 0; - INT32 nCycles[2] = { 4000000 / 60, 3000000 / 60 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - ZetOpen(0); - nCycles[0] -= ZetRun(nCycles[0] / (nInterleave - i)); - if (i == ((nInterleave / 2) - 1)) { - ZetSetVector(0xd7); - ZetRaiseIrq(0); - } - if (i == ( nInterleave - 1)) { - ZetSetVector(0xcf); - ZetRaiseIrq(0); - } - ZetClose(); - - ZetOpen(1); - nCycles[1] -= ZetRun(nCycles[1] / (nInterleave - i)); - ZetRaiseIrq(0); - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = Rom0 + 0xcc00; - ba.nLen = 0x2400; - ba.szName = "All CPU #0 Ram"; - BurnAcb(&ba); - - ba.Data = Rom1 + 0x4000; - ba.nLen = 0x0800; - ba.szName = "All CPU #1 Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - AY8910Scan(nAction, pnMin); - - SCAN_VAR(vulgus_flipscreen); - SCAN_VAR(vulgus_soundlatch); - SCAN_VAR(vulgus_palette_bank); - SCAN_VAR(vulgus_scroll[0]); - SCAN_VAR(vulgus_scroll[1]); - } - - return 0; -} - - -// Vulgus (set 1) - -static struct BurnRomInfo vulgusRomDesc[] = { - { "vulgus.002", 0x2000, 0xe49d6c5d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "vulgus.003", 0x2000, 0x51acef76, 1 | BRF_PRG | BRF_ESS }, // 1 - { "vulgus.004", 0x2000, 0x489e7f60, 1 | BRF_PRG | BRF_ESS }, // 2 - { "vulgus.005", 0x2000, 0xde3a24a8, 1 | BRF_PRG | BRF_ESS }, // 3 - { "1-8n.bin", 0x2000, 0x6ca5ca41, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "1-11c.bin", 0x2000, 0x3bd2acf4, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 #1 Code - - { "1-3d.bin", 0x2000, 0x8bc5d7a5, 3 | BRF_GRA }, // 6 Foreground Tiles - - { "2-2a.bin", 0x2000, 0xe10aaca1, 4 | BRF_GRA }, // 7 Background Tiles - { "2-3a.bin", 0x2000, 0x8da520da, 4 | BRF_GRA }, // 8 - { "2-4a.bin", 0x2000, 0x206a13f1, 4 | BRF_GRA }, // 9 - { "2-5a.bin", 0x2000, 0xb6d81984, 4 | BRF_GRA }, // 10 - { "2-6a.bin", 0x2000, 0x5a26b38f, 4 | BRF_GRA }, // 11 - { "2-7a.bin", 0x2000, 0x1e1ca773, 4 | BRF_GRA }, // 12 - - { "2-2n.bin", 0x2000, 0x6db1b10d, 5 | BRF_GRA }, // 13 Sprites - { "2-3n.bin", 0x2000, 0x5d8c34ec, 5 | BRF_GRA }, // 14 - { "2-4n.bin", 0x2000, 0x0071a2e3, 5 | BRF_GRA }, // 15 - { "2-5n.bin", 0x2000, 0x4023a1ec, 5 | BRF_GRA }, // 16 - - { "e8.bin", 0x0100, 0x06a83606, 6 | BRF_GRA }, // 17 Color Proms - { "e9.bin", 0x0100, 0xbeacf13c, 6 | BRF_GRA }, // 18 - { "e10.bin", 0x0100, 0xde1fb621, 6 | BRF_GRA }, // 19 - { "d1.bin", 0x0100, 0x7179080d, 6 | BRF_GRA }, // 20 - { "j2.bin", 0x0100, 0xd0842029, 6 | BRF_GRA }, // 21 - { "c9.bin", 0x0100, 0x7a1f0bd6, 6 | BRF_GRA }, // 22 - - { "82s126.9k", 0x0100, 0x32b10521, 0 | BRF_OPT }, // 23 Misc. Proms - { "82s129.8n", 0x0100, 0x4921635c, 0 | BRF_OPT }, // 24 -}; - -STD_ROM_PICK(vulgus) -STD_ROM_FN(vulgus) - -struct BurnDriver BurnDrvvulgus = { - "vulgus", NULL, NULL, NULL, "1984", - "Vulgus (set 1)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, vulgusRomInfo, vulgusRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 224, 256, 3, 4 -}; - - -// Vulgus (set 2) - -static struct BurnRomInfo vulgusaRomDesc[] = { - { "v2", 0x2000, 0x3e18ff62, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "v3", 0x2000, 0xb4650d82, 1 | BRF_PRG | BRF_ESS }, // 1 - { "v4", 0x2000, 0x5b26355c, 1 | BRF_PRG | BRF_ESS }, // 2 - { "v5", 0x2000, 0x4ca7f10e, 1 | BRF_PRG | BRF_ESS }, // 3 - { "1-8n.bin", 0x2000, 0x6ca5ca41, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "1-11c.bin", 0x2000, 0x3bd2acf4, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 #1 Code - - { "1-3d.bin", 0x2000, 0x8bc5d7a5, 3 | BRF_GRA }, // 6 Foreground Tiles - - { "2-2a.bin", 0x2000, 0xe10aaca1, 4 | BRF_GRA }, // 7 Background Tiles - { "2-3a.bin", 0x2000, 0x8da520da, 4 | BRF_GRA }, // 8 - { "2-4a.bin", 0x2000, 0x206a13f1, 4 | BRF_GRA }, // 9 - { "2-5a.bin", 0x2000, 0xb6d81984, 4 | BRF_GRA }, // 10 - { "2-6a.bin", 0x2000, 0x5a26b38f, 4 | BRF_GRA }, // 11 - { "2-7a.bin", 0x2000, 0x1e1ca773, 4 | BRF_GRA }, // 12 - - { "2-2n.bin", 0x2000, 0x6db1b10d, 5 | BRF_GRA }, // 13 Sprites - { "2-3n.bin", 0x2000, 0x5d8c34ec, 5 | BRF_GRA }, // 14 - { "2-4n.bin", 0x2000, 0x0071a2e3, 5 | BRF_GRA }, // 15 - { "2-5n.bin", 0x2000, 0x4023a1ec, 5 | BRF_GRA }, // 16 - - { "e8.bin", 0x0100, 0x06a83606, 6 | BRF_GRA }, // 17 Color Proms - { "e9.bin", 0x0100, 0xbeacf13c, 6 | BRF_GRA }, // 18 - { "e10.bin", 0x0100, 0xde1fb621, 6 | BRF_GRA }, // 19 - { "d1.bin", 0x0100, 0x7179080d, 6 | BRF_GRA }, // 20 - { "j2.bin", 0x0100, 0xd0842029, 6 | BRF_GRA }, // 21 - { "c9.bin", 0x0100, 0x7a1f0bd6, 6 | BRF_GRA }, // 22 - - { "82s126.9k", 0x0100, 0x32b10521, 0 | BRF_OPT }, // 23 Misc. Proms - { "82s129.8n", 0x0100, 0x4921635c, 0 | BRF_OPT }, // 24 -}; - -STD_ROM_PICK(vulgusa) -STD_ROM_FN(vulgusa) - -struct BurnDriver BurnDrvvulgusa = { - "vulgusa", "vulgus", NULL, NULL, "1984", - "Vulgus (set 2)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, vulgusaRomInfo, vulgusaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 224, 256, 3, 4 -}; - - -// Vulgus (Japan) - -static struct BurnRomInfo vulgusjRomDesc[] = { - { "1-4n.bin", 0x2000, 0xfe5a5ca5, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "1-5n.bin", 0x2000, 0x847e437f, 1 | BRF_PRG | BRF_ESS }, // 1 - { "1-6n.bin", 0x2000, 0x4666c436, 1 | BRF_PRG | BRF_ESS }, // 2 - { "1-7n.bin", 0x2000, 0xff2097f9, 1 | BRF_PRG | BRF_ESS }, // 3 - { "1-8n.bin", 0x2000, 0x6ca5ca41, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "1-11c.bin", 0x2000, 0x3bd2acf4, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 #1 Code - - { "1-3d.bin", 0x2000, 0x8bc5d7a5, 3 | BRF_GRA }, // 6 Foreground Tiles - - { "2-2a.bin", 0x2000, 0xe10aaca1, 4 | BRF_GRA }, // 7 Background Tiles - { "2-3a.bin", 0x2000, 0x8da520da, 4 | BRF_GRA }, // 8 - { "2-4a.bin", 0x2000, 0x206a13f1, 4 | BRF_GRA }, // 9 - { "2-5a.bin", 0x2000, 0xb6d81984, 4 | BRF_GRA }, // 10 - { "2-6a.bin", 0x2000, 0x5a26b38f, 4 | BRF_GRA }, // 11 - { "2-7a.bin", 0x2000, 0x1e1ca773, 4 | BRF_GRA }, // 12 - - { "2-2n.bin", 0x2000, 0x6db1b10d, 5 | BRF_GRA }, // 13 Sprites - { "2-3n.bin", 0x2000, 0x5d8c34ec, 5 | BRF_GRA }, // 14 - { "2-4n.bin", 0x2000, 0x0071a2e3, 5 | BRF_GRA }, // 15 - { "2-5n.bin", 0x2000, 0x4023a1ec, 5 | BRF_GRA }, // 16 - - { "e8.bin", 0x0100, 0x06a83606, 6 | BRF_GRA }, // 17 Color Proms - { "e9.bin", 0x0100, 0xbeacf13c, 6 | BRF_GRA }, // 18 - { "e10.bin", 0x0100, 0xde1fb621, 6 | BRF_GRA }, // 19 - { "d1.bin", 0x0100, 0x7179080d, 6 | BRF_GRA }, // 20 - { "j2.bin", 0x0100, 0xd0842029, 6 | BRF_GRA }, // 21 - { "c9.bin", 0x0100, 0x7a1f0bd6, 6 | BRF_GRA }, // 22 - - { "82s126.9k", 0x0100, 0x32b10521, 0 | BRF_OPT }, // 23 Misc. Proms - { "82s129.8n", 0x0100, 0x4921635c, 0 | BRF_OPT }, // 24 -}; - -STD_ROM_PICK(vulgusj) -STD_ROM_FN(vulgusj) - -struct BurnDriver BurnDrvvulgusj = { - "vulgusj", "vulgus", NULL, NULL, "1984", - "Vulgus (Japan?)\0", NULL, "Capcom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, - NULL, vulgusjRomInfo, vulgusjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 224, 256, 3, 4 -}; +// FB Alpha Vulgus drive module +// Based on MAME driver by Mirko Buffoni + +// To do: flip screen + +#include "tiles_generic.h" +#include "z80_intf.h" + +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *Mem, *MemEnd, *Rom0, *Rom1, *Gfx0, *Gfx1, *Gfx2, *Prom; +static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvDips[2], DrvReset; +static INT16 *pAY8910Buffer[6], *pFMBuffer = NULL; +static UINT32 *DrvPalette, *Palette; +static UINT8 DrvRecalc; + +static INT32 vulgus_soundlatch; +static INT32 vulgus_scroll[2]; +static INT32 vulgus_palette_bank; +static INT32 vulgus_flipscreen; + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 7, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 6, "p2 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, + + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 0, "p2 right" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 1, "p2 left" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 2"}, + + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip 1" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip 2" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x03, 0x01, "1" }, + {0x11, 0x01, 0x03, 0x02, "2" }, + {0x11, 0x01, 0x03, 0x03, "3" }, + {0x11, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 7 , "Coin B" }, + {0x11, 0x01, 0x1c, 0x10, "5 Coins 1 Play" }, + {0x11, 0x01, 0x1c, 0x08, "4 Coins 1 Play" }, + {0x11, 0x01, 0x1c, 0x18, "3 Coins 1 Play" }, + {0x11, 0x01, 0x1c, 0x04, "2 Coins 1 Play" }, + {0x11, 0x01, 0x1c, 0x1c, "1 Coin 1 Play" }, + {0x11, 0x01, 0x1c, 0x0c, "1 Coin 2 Plays" }, + {0x11, 0x01, 0x1c, 0x14, "1 Coin 3 Plays" }, +// {0x11, 0x01, 0x1c, 0x00, "Invalid" }, + + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x11, 0x01, 0xe0, 0x80, "5 Coins 1 Play" }, + {0x11, 0x01, 0xe0, 0x40, "4 Coins 1 Play" }, + {0x11, 0x01, 0xe0, 0xc0, "3 Coins 1 Play" }, + {0x11, 0x01, 0xe0, 0x20, "2 Coins 1 Play" }, + {0x11, 0x01, 0xe0, 0xe0, "1 Coin 1 Play" }, + {0x11, 0x01, 0xe0, 0x60, "1 Coin 2 Plays" }, + {0x11, 0x01, 0xe0, 0xa0, "1 Coin 3 Plays" }, + {0x11, 0x01, 0xe0, 0x00, "Freeplay" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty?" }, + {0x12, 0x01, 0x03, 0x02, "Easy?" }, + {0x12, 0x01, 0x03, 0x03, "Normal?" }, + {0x12, 0x01, 0x03, 0x01, "Hard?" }, + {0x12, 0x01, 0x03, 0x00, "Hardest?" }, + + {0 , 0xfe, 0 , 2 , "Demo Music" }, + {0x12, 0x01, 0x04, 0x00, "Off" }, + {0x12, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x08, 0x00, "Off" }, + {0x12, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x12, 0x01, 0x70, 0x30, "10000 50000" }, + {0x12, 0x01, 0x70, 0x50, "10000 60000" }, + {0x12, 0x01, 0x70, 0x10, "10000 70000" }, + {0x12, 0x01, 0x70, 0x70, "20000 60000" }, + {0x12, 0x01, 0x70, 0x60, "20000 70000" }, + {0x12, 0x01, 0x70, 0x20, "20000 80000" }, + {0x12, 0x01, 0x70, 0x40, "30000 70000" }, + {0x12, 0x01, 0x70, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x80, 0x00, "Upright" }, + {0x12, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(Drv) + +void __fastcall vulgus_write_main(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc800: + vulgus_soundlatch = data; + break; + + case 0xc802: + case 0xc803: + vulgus_scroll[address & 1] = (vulgus_scroll[address & 1] & 0xff00) | data; + break; + + case 0xc804: + vulgus_flipscreen = data >> 7; + break; + + case 0xc805: + vulgus_palette_bank = data & 3; + break; + + case 0xc902: + case 0xc903: + vulgus_scroll[address & 1] = (vulgus_scroll[address & 1] & 0x00ff) | (data << 8); + break; + } +} + +UINT8 __fastcall vulgus_read_main(UINT16 address) +{ + UINT8 ret; + + switch (address) + { + case 0xc000: + { + ret = 0xff; + + for (INT32 i = 0; i < 8; i++) ret ^= DrvJoy1[i] << i; + + return ret; + } + + case 0xc001: + { + ret = 0xff; + + for (INT32 i = 0; i < 5; i++) ret ^= DrvJoy2[i] << i; + + return ret; + } + + case 0xc002: + { + ret = 0xff; + + for (INT32 i = 0; i < 5; i++) ret ^= DrvJoy3[i] << i; + + return ret; + } + + case 0xc003: + return DrvDips[0]; + + case 0xc004: + return DrvDips[1]; + } + + return 0; +} + +void __fastcall vulgus_write_sound(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8000: + case 0x8001: + case 0xc000: + case 0xc001: + AY8910Write((address >> 14) & 1, address & 1, data); + break; + } +} + +UINT8 __fastcall vulgus_read_sound(UINT16 address) +{ + switch (address) + { + case 0x6000: + return vulgus_soundlatch; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + vulgus_flipscreen = 0; + vulgus_soundlatch = 0; + vulgus_palette_bank = 0; + + vulgus_scroll[0] = 0; + vulgus_scroll[1] = 0; + + memset (Rom0 + 0xcc00, 0, 0x2400); + memset (Rom1 + 0x4000, 0, 0x0800); + + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + + AY8910Reset(i); + } + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Rom0 = Next; Next += 0x10000; + Rom1 = Next; Next += 0x05000; + Gfx0 = Next; Next += 0x08000; + Gfx1 = Next; Next += 0x20000; + Gfx2 = Next; Next += 0x10000; + Prom = Next; Next += 0x00600; + + Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + + pFMBuffer = (INT16*)Next; Next += (nBurnSoundLen * 6 * sizeof(INT16)); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvPaletteInit() +{ + UINT32 *tmp = (UINT32*)BurnMalloc(0x100 * sizeof(UINT32)); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 256; i++) + { + INT32 bit0,bit1,bit2,bit3,r,g,b; + + bit0 = (Prom[ 0 + i] >> 0) & 0x01; + bit1 = (Prom[ 0 + i] >> 1) & 0x01; + bit2 = (Prom[ 0 + i] >> 2) & 0x01; + bit3 = (Prom[ 0 + i] >> 3) & 0x01; + r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (Prom[256 + i] >> 0) & 0x01; + bit1 = (Prom[256 + i] >> 1) & 0x01; + bit2 = (Prom[256 + i] >> 2) & 0x01; + bit3 = (Prom[256 + i] >> 3) & 0x01; + g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (Prom[512 + i] >> 0) & 0x01; + bit1 = (Prom[512 + i] >> 1) & 0x01; + bit2 = (Prom[512 + i] >> 2) & 0x01; + bit3 = (Prom[512 + i] >> 3) & 0x01; + b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + tmp[i] = (r << 16) | (g << 8) | b; + } + + for (INT32 i = 0; i < 0x100; i++) { + Palette[i] = tmp[32 + Prom[0x300 + i]]; + } + + for (INT32 i = 0; i < 0x100; i++) { + Palette[0x100 + i] = tmp[16 + Prom[0x400 + i]]; + } + + for (INT32 i = 0; i < 0x100; i++) { + Palette[0x400 + i] = tmp[Prom[0x500 + i] + 0x00]; + Palette[0x500 + i] = tmp[Prom[0x500 + i] + 0x40]; + Palette[0x600 + i] = tmp[Prom[0x500 + i] + 0x80]; + Palette[0x700 + i] = tmp[Prom[0x500 + i] + 0xc0]; + } + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvGfxDecode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0xc000); + if (tmp == NULL) { + return 1; + } + + static INT32 SpriPlanes[4] = { 0x20004, 0x20000, 0x00004, 0x00000 }; + static INT32 SpriXOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, + 0x100, 0x101, 0x102, 0x103, 0x108, 0x109, 0x10a, 0x10b }; + static INT32 SpriYOffs[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, + 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0 }; + + static INT32 TilePlanes[3] = { 0x00000, 0x20000, 0x40000 }; + static INT32 TileXOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087 }; + static INT32 TileYOffs[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, + 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; + + memcpy (tmp, Gfx0, 0x2000); + + GfxDecode(0x200, 2, 8, 8, SpriPlanes + 2, SpriXOffs, SpriYOffs, 0x080, tmp, Gfx0); + + memcpy (tmp, Gfx1, 0xc000); + + GfxDecode(0x200, 3, 16, 16, TilePlanes + 0, TileXOffs, TileYOffs, 0x100, tmp, Gfx1); + + memcpy (tmp, Gfx2, 0x8000); + + GfxDecode(0x100, 4, 16, 16, SpriPlanes + 0, SpriXOffs, SpriYOffs, 0x200, tmp, Gfx2); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + for (INT32 i = 0; i < 6; i++) { + pAY8910Buffer[i] = pFMBuffer + nBurnSoundLen * i; + } + + { + for (INT32 i = 0; i < 5; i++) { + if (BurnLoadRom(Rom0 + i * 0x2000, i + 0, 1)) return 1; + } + + if (BurnLoadRom(Rom1 + 0x0000, 5, 1)) return 1; + if (BurnLoadRom(Gfx0 + 0x0000, 6, 1)) return 1; + + for (INT32 i = 0; i < 6; i++) { + if (BurnLoadRom(Gfx1 + i * 0x2000, i + 7, 1)) return 1; + } + + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(Gfx2 + i * 0x2000, i + 13, 1)) return 1; + } + + for (INT32 i = 0; i < 6; i++) { + if (BurnLoadRom(Prom + i * 0x0100, i + 17, 1)) return 1; + } + + if (DrvPaletteInit()) return 1; + if (DrvGfxDecode()) return 1; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x9fff, 0, Rom0 + 0x0000); + ZetMapArea(0x0000, 0x9fff, 2, Rom0 + 0x0000); + ZetMapArea(0xcc00, 0xccff, 0, Rom0 + 0xcc00); + ZetMapArea(0xcc00, 0xccff, 1, Rom0 + 0xcc00); + ZetMapArea(0xd000, 0xdfff, 0, Rom0 + 0xd000); + ZetMapArea(0xd000, 0xdfff, 1, Rom0 + 0xd000); + ZetMapArea(0xe000, 0xefff, 0, Rom0 + 0xe000); + ZetMapArea(0xe000, 0xefff, 1, Rom0 + 0xe000); + ZetMapArea(0xe000, 0xefff, 2, Rom0 + 0xe000); + ZetSetWriteHandler(vulgus_write_main); + ZetSetReadHandler(vulgus_read_main); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x1fff, 0, Rom1 + 0x0000); + ZetMapArea(0x0000, 0x1fff, 2, Rom1 + 0x0000); + ZetMapArea(0x4000, 0x47ff, 0, Rom1 + 0x4000); + ZetMapArea(0x4000, 0x47ff, 1, Rom1 + 0x4000); + ZetMapArea(0x4000, 0x47ff, 2, Rom1 + 0x4000); + ZetSetWriteHandler(vulgus_write_sound); + ZetSetReadHandler(vulgus_read_sound); + ZetClose(); + + AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 1500000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + AY8910Exit(0); + AY8910Exit(1); + GenericTilesExit(); + + BurnFree (Mem); + + Mem = MemEnd = Rom0 = Rom1 = NULL; + Gfx0 = Gfx1 = Gfx2 = Prom = NULL; + pFMBuffer = NULL; + + for (INT32 i = 0; i < 6; i++) { + pAY8910Buffer[i] = NULL; + } + + DrvPalette = Palette = NULL; + + DrvRecalc = 0; + + vulgus_soundlatch = 0; + vulgus_scroll[0] = vulgus_scroll[1] = 0; + vulgus_palette_bank = 0; + vulgus_flipscreen = 0; + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x800; i++) { + INT32 color = Palette[i]; + DrvPalette[i] = BurnHighCol(color >> 16, color >> 8, color, 0); + } + } + + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 sx, sy, color, code, flipx, flipy; + + sx = (offs >> 1) & 0x1f0; + sy = (offs << 4) & 0x1f0; + + sx -= vulgus_scroll[1]; + sy -= vulgus_scroll[0]; + + if (sx < -15) sx += 0x200; // wrap + if (sy < -15) sy += 0x200; + + color = Rom0[0xdc00 + offs]; + code = Rom0[0xd800 + offs] | ((color & 0x80) << 1); + + flipx = color & 0x20; + flipy = color & 0x40; + + color = (color & 0x1f) | (vulgus_palette_bank << 5); + + sy -= 0x10; + + if (flipy) { + if (flipx) { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 3, 0x400, Gfx1); + } else { + Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 3, 0x400, Gfx1); + } + } else { + if (flipx) { + Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 3, 0x400, Gfx1); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 3, 0x400, Gfx1); + } + } + } + + for (INT32 offs = 0x7c; offs >= 0; offs -= 4) + { + INT32 code, i, color, sx, sy; + + code = Rom0[0xcc00 + offs]; + color = Rom0[0xcc01 + offs] & 0x0f; + sx = Rom0[0xcc03 + offs]; + sy = Rom0[0xcc02 + offs]; + + sy -= 0x10; + + i = Rom0[0xcc01 + offs] >> 6; + if (i == 2) i = 3; + + for (; i >= 0; i--) { + INT32 ssy = sy + (i << 4); + Render16x16Tile_Mask_Clip(pTransDraw, code + i, sx, ssy, color, 4, 0x0f, 0x100, Gfx2); + if (ssy > 240) { // wrap + Render16x16Tile_Mask_Clip(pTransDraw, code + i, sx, ssy - 256, color, 4, 0x0f, 0x100, Gfx2); + } + } + } + + for (INT32 offs = 0x40; offs < 0x3c0; offs++) + { + INT32 sx, sy, color, code; + + color = Rom0[0xd400 + offs]; + code = Rom0[0xd000 + offs] | ((color & 0x80) << 1); + + if (code == 0x20) continue; + + UINT8 *src = Gfx0 + (code << 6); + + color = (color & 0x3f) << 2; + + sx = (offs << 3) & 0xf8; + sy = (offs >> 2) & 0xf8; + + sy -= 0x10; + + for (INT32 y = sy; y < sy + 8; y++) { + for (INT32 x = sx; x < sx + 8; x++, src++) { + INT32 pxl = color | *src; + if (Prom[0x300 | pxl] == 0x0f) continue; + pTransDraw[(y << 8) | x] = pxl; + } + } + } + + if (vulgus_flipscreen) { + INT32 nSize = (nScreenWidth * nScreenHeight) - 1; + for (INT32 i = 0; i < nSize >> 1; i++) { + INT32 n = pTransDraw[i]; + pTransDraw[i] = pTransDraw[nSize - i]; + pTransDraw[nSize - i] = n; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + INT32 nInterleave = 8; + INT32 nSoundBufferPos = 0; + INT32 nCycles[2] = { 4000000 / 60, 3000000 / 60 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + ZetOpen(0); + nCycles[0] -= ZetRun(nCycles[0] / (nInterleave - i)); + if (i == ((nInterleave / 2) - 1)) { + ZetSetVector(0xd7); + ZetRaiseIrq(0); + } + if (i == ( nInterleave - 1)) { + ZetSetVector(0xcf); + ZetRaiseIrq(0); + } + ZetClose(); + + ZetOpen(1); + nCycles[1] -= ZetRun(nCycles[1] / (nInterleave - i)); + ZetRaiseIrq(0); + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = Rom0 + 0xcc00; + ba.nLen = 0x2400; + ba.szName = "All CPU #0 Ram"; + BurnAcb(&ba); + + ba.Data = Rom1 + 0x4000; + ba.nLen = 0x0800; + ba.szName = "All CPU #1 Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + AY8910Scan(nAction, pnMin); + + SCAN_VAR(vulgus_flipscreen); + SCAN_VAR(vulgus_soundlatch); + SCAN_VAR(vulgus_palette_bank); + SCAN_VAR(vulgus_scroll[0]); + SCAN_VAR(vulgus_scroll[1]); + } + + return 0; +} + + +// Vulgus (set 1) + +static struct BurnRomInfo vulgusRomDesc[] = { + { "vulgus.002", 0x2000, 0xe49d6c5d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "vulgus.003", 0x2000, 0x51acef76, 1 | BRF_PRG | BRF_ESS }, // 1 + { "vulgus.004", 0x2000, 0x489e7f60, 1 | BRF_PRG | BRF_ESS }, // 2 + { "vulgus.005", 0x2000, 0xde3a24a8, 1 | BRF_PRG | BRF_ESS }, // 3 + { "1-8n.bin", 0x2000, 0x6ca5ca41, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "1-11c.bin", 0x2000, 0x3bd2acf4, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 #1 Code + + { "1-3d.bin", 0x2000, 0x8bc5d7a5, 3 | BRF_GRA }, // 6 Foreground Tiles + + { "2-2a.bin", 0x2000, 0xe10aaca1, 4 | BRF_GRA }, // 7 Background Tiles + { "2-3a.bin", 0x2000, 0x8da520da, 4 | BRF_GRA }, // 8 + { "2-4a.bin", 0x2000, 0x206a13f1, 4 | BRF_GRA }, // 9 + { "2-5a.bin", 0x2000, 0xb6d81984, 4 | BRF_GRA }, // 10 + { "2-6a.bin", 0x2000, 0x5a26b38f, 4 | BRF_GRA }, // 11 + { "2-7a.bin", 0x2000, 0x1e1ca773, 4 | BRF_GRA }, // 12 + + { "2-2n.bin", 0x2000, 0x6db1b10d, 5 | BRF_GRA }, // 13 Sprites + { "2-3n.bin", 0x2000, 0x5d8c34ec, 5 | BRF_GRA }, // 14 + { "2-4n.bin", 0x2000, 0x0071a2e3, 5 | BRF_GRA }, // 15 + { "2-5n.bin", 0x2000, 0x4023a1ec, 5 | BRF_GRA }, // 16 + + { "e8.bin", 0x0100, 0x06a83606, 6 | BRF_GRA }, // 17 Color Proms + { "e9.bin", 0x0100, 0xbeacf13c, 6 | BRF_GRA }, // 18 + { "e10.bin", 0x0100, 0xde1fb621, 6 | BRF_GRA }, // 19 + { "d1.bin", 0x0100, 0x7179080d, 6 | BRF_GRA }, // 20 + { "j2.bin", 0x0100, 0xd0842029, 6 | BRF_GRA }, // 21 + { "c9.bin", 0x0100, 0x7a1f0bd6, 6 | BRF_GRA }, // 22 + + { "82s126.9k", 0x0100, 0x32b10521, 0 | BRF_OPT }, // 23 Misc. Proms + { "82s129.8n", 0x0100, 0x4921635c, 0 | BRF_OPT }, // 24 +}; + +STD_ROM_PICK(vulgus) +STD_ROM_FN(vulgus) + +struct BurnDriver BurnDrvvulgus = { + "vulgus", NULL, NULL, NULL, "1984", + "Vulgus (set 1)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, vulgusRomInfo, vulgusRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 224, 256, 3, 4 +}; + + +// Vulgus (set 2) + +static struct BurnRomInfo vulgusaRomDesc[] = { + { "v2", 0x2000, 0x3e18ff62, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "v3", 0x2000, 0xb4650d82, 1 | BRF_PRG | BRF_ESS }, // 1 + { "v4", 0x2000, 0x5b26355c, 1 | BRF_PRG | BRF_ESS }, // 2 + { "v5", 0x2000, 0x4ca7f10e, 1 | BRF_PRG | BRF_ESS }, // 3 + { "1-8n.bin", 0x2000, 0x6ca5ca41, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "1-11c.bin", 0x2000, 0x3bd2acf4, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 #1 Code + + { "1-3d.bin", 0x2000, 0x8bc5d7a5, 3 | BRF_GRA }, // 6 Foreground Tiles + + { "2-2a.bin", 0x2000, 0xe10aaca1, 4 | BRF_GRA }, // 7 Background Tiles + { "2-3a.bin", 0x2000, 0x8da520da, 4 | BRF_GRA }, // 8 + { "2-4a.bin", 0x2000, 0x206a13f1, 4 | BRF_GRA }, // 9 + { "2-5a.bin", 0x2000, 0xb6d81984, 4 | BRF_GRA }, // 10 + { "2-6a.bin", 0x2000, 0x5a26b38f, 4 | BRF_GRA }, // 11 + { "2-7a.bin", 0x2000, 0x1e1ca773, 4 | BRF_GRA }, // 12 + + { "2-2n.bin", 0x2000, 0x6db1b10d, 5 | BRF_GRA }, // 13 Sprites + { "2-3n.bin", 0x2000, 0x5d8c34ec, 5 | BRF_GRA }, // 14 + { "2-4n.bin", 0x2000, 0x0071a2e3, 5 | BRF_GRA }, // 15 + { "2-5n.bin", 0x2000, 0x4023a1ec, 5 | BRF_GRA }, // 16 + + { "e8.bin", 0x0100, 0x06a83606, 6 | BRF_GRA }, // 17 Color Proms + { "e9.bin", 0x0100, 0xbeacf13c, 6 | BRF_GRA }, // 18 + { "e10.bin", 0x0100, 0xde1fb621, 6 | BRF_GRA }, // 19 + { "d1.bin", 0x0100, 0x7179080d, 6 | BRF_GRA }, // 20 + { "j2.bin", 0x0100, 0xd0842029, 6 | BRF_GRA }, // 21 + { "c9.bin", 0x0100, 0x7a1f0bd6, 6 | BRF_GRA }, // 22 + + { "82s126.9k", 0x0100, 0x32b10521, 0 | BRF_OPT }, // 23 Misc. Proms + { "82s129.8n", 0x0100, 0x4921635c, 0 | BRF_OPT }, // 24 +}; + +STD_ROM_PICK(vulgusa) +STD_ROM_FN(vulgusa) + +struct BurnDriver BurnDrvvulgusa = { + "vulgusa", "vulgus", NULL, NULL, "1984", + "Vulgus (set 2)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, vulgusaRomInfo, vulgusaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 224, 256, 3, 4 +}; + + +// Vulgus (Japan) + +static struct BurnRomInfo vulgusjRomDesc[] = { + { "1-4n.bin", 0x2000, 0xfe5a5ca5, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "1-5n.bin", 0x2000, 0x847e437f, 1 | BRF_PRG | BRF_ESS }, // 1 + { "1-6n.bin", 0x2000, 0x4666c436, 1 | BRF_PRG | BRF_ESS }, // 2 + { "1-7n.bin", 0x2000, 0xff2097f9, 1 | BRF_PRG | BRF_ESS }, // 3 + { "1-8n.bin", 0x2000, 0x6ca5ca41, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "1-11c.bin", 0x2000, 0x3bd2acf4, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 #1 Code + + { "1-3d.bin", 0x2000, 0x8bc5d7a5, 3 | BRF_GRA }, // 6 Foreground Tiles + + { "2-2a.bin", 0x2000, 0xe10aaca1, 4 | BRF_GRA }, // 7 Background Tiles + { "2-3a.bin", 0x2000, 0x8da520da, 4 | BRF_GRA }, // 8 + { "2-4a.bin", 0x2000, 0x206a13f1, 4 | BRF_GRA }, // 9 + { "2-5a.bin", 0x2000, 0xb6d81984, 4 | BRF_GRA }, // 10 + { "2-6a.bin", 0x2000, 0x5a26b38f, 4 | BRF_GRA }, // 11 + { "2-7a.bin", 0x2000, 0x1e1ca773, 4 | BRF_GRA }, // 12 + + { "2-2n.bin", 0x2000, 0x6db1b10d, 5 | BRF_GRA }, // 13 Sprites + { "2-3n.bin", 0x2000, 0x5d8c34ec, 5 | BRF_GRA }, // 14 + { "2-4n.bin", 0x2000, 0x0071a2e3, 5 | BRF_GRA }, // 15 + { "2-5n.bin", 0x2000, 0x4023a1ec, 5 | BRF_GRA }, // 16 + + { "e8.bin", 0x0100, 0x06a83606, 6 | BRF_GRA }, // 17 Color Proms + { "e9.bin", 0x0100, 0xbeacf13c, 6 | BRF_GRA }, // 18 + { "e10.bin", 0x0100, 0xde1fb621, 6 | BRF_GRA }, // 19 + { "d1.bin", 0x0100, 0x7179080d, 6 | BRF_GRA }, // 20 + { "j2.bin", 0x0100, 0xd0842029, 6 | BRF_GRA }, // 21 + { "c9.bin", 0x0100, 0x7a1f0bd6, 6 | BRF_GRA }, // 22 + + { "82s126.9k", 0x0100, 0x32b10521, 0 | BRF_OPT }, // 23 Misc. Proms + { "82s129.8n", 0x0100, 0x4921635c, 0 | BRF_OPT }, // 24 +}; + +STD_ROM_PICK(vulgusj) +STD_ROM_FN(vulgusj) + +struct BurnDriver BurnDrvvulgusj = { + "vulgusj", "vulgus", NULL, NULL, "1984", + "Vulgus (Japan?)\0", NULL, "Capcom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARWARE_CAPCOM_MISC, GBF_VERSHOOT, 0, + NULL, vulgusjRomInfo, vulgusjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 224, 256, 3, 4 +}; diff --git a/src/burn/drv/pre90s/d_wallc.cpp b/src/burn/drv/pre90s/d_wallc.cpp index 1a01eeff3..788adfcdf 100644 --- a/src/burn/drv/pre90s/d_wallc.cpp +++ b/src/burn/drv/pre90s/d_wallc.cpp @@ -1,474 +1,473 @@ -// FB Alpha Wall Crash driver module -// Based on MAME driver by Jarek Burczynski - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "bitswap.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM; -static UINT8 *DrvColPROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvVidRAM; -static UINT32 *Palette; -static UINT32 *DrvPalette; - -static INT16 *pAY8910Buffer[3]; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvDips[2]; -static UINT16 DrvAxis[1]; -static UINT8 DrvInputs[2]; -static UINT8 DrvReset; -static UINT32 nAnalogAxis; - -#define A(a, b, c, d) { a, b, (UINT8*)(c), d } - -static struct BurnInputInfo WallcInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, - {"Coin 3", BIT_DIGITAL, DrvJoy1 + 6, "p3 coin" }, - {"Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 2" }, - - A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 x-axis"), - - {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Wallc) - -static struct BurnDIPInfo WallcDIPList[]= -{ - {0x09, 0xff, 0xff, 0x61, NULL }, - {0x0a, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x09, 0x01, 0x03, 0x03, "5" }, - {0x09, 0x01, 0x03, 0x02, "4" }, - {0x09, 0x01, 0x03, 0x01, "3" }, - {0x09, 0x01, 0x03, 0x00, "2" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x09, 0x01, 0x0c, 0x0c, "100K/200K/400K/800K" }, - {0x09, 0x01, 0x0c, 0x08, "80K/160K/320K/640K" }, - {0x09, 0x01, 0x0c, 0x04, "60K/120K/240K/480K" }, - {0x09, 0x01, 0x0c, 0x00, "Off" }, - - {0 , 0xfe, 0 , 2 , "Curve Effect" }, - {0x09, 0x01, 0x10, 0x10, "Normal" }, - {0x09, 0x01, 0x10, 0x00, "More" }, - - {0 , 0xfe, 0 , 4 , "Timer Speed" }, - {0x09, 0x01, 0x60, 0x60, "Slow" }, - {0x09, 0x01, 0x60, 0x40, "Normal" }, - {0x09, 0x01, 0x60, 0x20, "Fast" }, - {0x09, 0x01, 0x60, 0x00, "Super Fast" }, - - {0 , 0xfe, 0 , 2 , "Service" }, - {0x09, 0x01, 0x80, 0x80, "Free Play and Level Select" }, - {0x09, 0x01, 0x80, 0x00, "Normal" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0a, 0x01, 0x03, 0x03, "2C 1C" }, - {0x0a, 0x01, 0x03, 0x00, "1C 1C" }, - {0x0a, 0x01, 0x03, 0x01, "1C 2C" }, - {0x0a, 0x01, 0x03, 0x02, "1C 5C" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0a, 0x01, 0x0c, 0x0c, "2C 1C" }, - {0x0a, 0x01, 0x0c, 0x00, "1C 1C" }, - {0x0a, 0x01, 0x0c, 0x04, "1C 2C" }, - {0x0a, 0x01, 0x0c, 0x08, "1C 5C" }, - - {0 , 0xfe, 0 , 4 , "Coin C" }, - {0x0a, 0x01, 0x30, 0x30, "2C 1C" }, - {0x0a, 0x01, 0x30, 0x00, "1C 1C" }, - {0x0a, 0x01, 0x30, 0x10, "1C 2C" }, - {0x0a, 0x01, 0x30, 0x20, "1C 5C" }, -}; - -STDDIPINFO(Wallc) - -void __fastcall wallc_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xb500: - AY8910Write(0, 0, data); - break; - - case 0xb600: - AY8910Write(0, 1, data); - break; - } -} - -UINT8 __fastcall wallc_read(UINT16 address) -{ - switch (address) - { - case 0xb000: - return DrvDips[0]; - - case 0xb200: - return DrvInputs[0]; - - case 0xb400: - return DrvInputs[1]; - - case 0xb600: - return DrvDips[1]; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - nAnalogAxis = 0; - - memset(AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[3] = { 0x04000, 0x0c000, 0x14000 }; - INT32 XOffs[8] = { 7, 6, 5, 4, 3, 2, 1, 0 }; - INT32 YOffs[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x3000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM, 0x3000); - - GfxDecode(0x0100, 3, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM); - - BurnFree (tmp); - - return 0; -} - -static void DrvPaletteInit() -{ - for (INT32 i = 8; i < 16; i++) - { - INT32 bit0,bit1,bit7,r,g,b; - - bit0 = (DrvColPROM[i] >> 5) & 0x01; - bit1 = (DrvColPROM[i] >> 6) & 0x01; - r = ((77 * bit1) + (115 * bit0)) + 1; - - bit0 = (DrvColPROM[i] >> 2) & 0x01; - bit1 = (DrvColPROM[i] >> 3) & 0x01; - g = ((77 * bit1) + (115 * bit0)) + 1; - - bit0 = (DrvColPROM[i] >> 0) & 0x01; - bit1 = (DrvColPROM[i] >> 1) & 0x01; - bit7 = (DrvColPROM[i] >> 7) & 0x01; - b = ((54 * bit7) + (84 * bit1) + (115 * bit0)); - - Palette[i-8] = (r << 16) | (g << 8) | b; - } -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x008000; - - DrvGfxROM = Next; Next += 0x004000; - - DrvColPROM = Next; Next += 0x000020; - - Palette = (UINT32*)Next; Next += 0x0008 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x0008 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x000400; - DrvVidRAM = Next; Next += 0x000400; - - RamEnd = Next; - - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit(INT32 incr) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x0000 + incr, 2, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x1000 + incr, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x2000 + incr, 4, 1)) return 1; - - if (BurnLoadRom(DrvColPROM, 5, 1)) return 1; - - DrvPaletteInit(); - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x83ff, 0, DrvVidRAM); - ZetMapArea(0x8000, 0x83ff, 1, DrvVidRAM); - ZetMapArea(0x8000, 0x83ff, 2, DrvVidRAM); - ZetMapArea(0x8400, 0x87ff, 0, DrvVidRAM); - ZetMapArea(0x8400, 0x87ff, 1, DrvVidRAM); - ZetMapArea(0x8400, 0x87ff, 2, DrvVidRAM); - ZetMapArea(0x8800, 0x8bff, 0, DrvVidRAM); - ZetMapArea(0x8800, 0x8bff, 1, DrvVidRAM); - ZetMapArea(0x8800, 0x8bff, 2, DrvVidRAM); - ZetMapArea(0x8c00, 0x8fff, 0, DrvVidRAM); - ZetMapArea(0x8c00, 0x8fff, 1, DrvVidRAM); - ZetMapArea(0x8c00, 0x8fff, 2, DrvVidRAM); - ZetMapArea(0xa000, 0xa3ff, 0, DrvZ80RAM); - ZetMapArea(0xa000, 0xa3ff, 1, DrvZ80RAM); - ZetMapArea(0xa000, 0xa3ff, 2, DrvZ80RAM); - ZetSetWriteHandler(wallc_write); - ZetSetReadHandler(wallc_read); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 1536000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - ZetExit(); - AY8910Exit(0); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 8; i++) { - INT32 d = Palette[i]; - DrvPalette[i] = BurnHighCol(d >> 16, (d >> 8) & 0xff, d & 0xff, 0); - } - } - - for (INT32 offs = 0; offs < 0x400; offs ++) - { - INT32 sy = (~offs & 0x1f) << 3; - INT32 sx = ( offs >> 5) << 3; - INT32 code = DrvVidRAM[offs]; - - Render8x8Tile(pTransDraw, code, sx, sy, 0, 0, 0, DrvGfxROM); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = 0xff; - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - } - - nAnalogAxis -= DrvAxis[0]; - DrvInputs[1] = nAnalogAxis >> 8; - } - - ZetOpen(0); -// ZetRun(3072000 / 60); -// ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetRun(3000000 / 60); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetRun(72000 / 60); - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - AY8910Scan(nAction, pnMin); - - SCAN_VAR(nAnalogAxis); - } - - return 0; -} - - -// Wall Crash (set 1) - -static struct BurnRomInfo wallcRomDesc[] = { - { "wac05.h7", 0x2000, 0xab6e472e, 0 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "wac1-52.h6", 0x2000, 0x988eaa6d, 0 | BRF_ESS | BRF_PRG }, // 1 - - { "wc1.e3", 0x1000, 0xca5c4b53, 1 | BRF_GRA }, // 2 Graphics - { "wc2.e2", 0x1000, 0xb7f52a59, 1 | BRF_GRA }, // 3 - { "wc3.e1", 0x1000, 0xf6854b3a, 1 | BRF_GRA }, // 4 - - { "74s288.c2", 0x0020, 0x83e3e293, 2 | BRF_GRA }, // 5 Color Prom -}; - -STD_ROM_PICK(wallc) -STD_ROM_FN(wallc) - -static void wallcDecode() -{ - for (INT32 i = 0; i < 0x4000; i++) { - DrvZ80ROM[i] = BITSWAP08(DrvZ80ROM[i] ^ 0xaa, 4,2,6,0,7,1,3,5); - } -} - -static INT32 wallcInit() -{ - INT32 nRet = DrvInit(0); - - if (nRet == 0) { - wallcDecode(); - } - - return nRet; -} - -struct BurnDriver BurnDrvWallc = { - "wallc", NULL, NULL, NULL, "1984", - "Wall Crash (set 1)\0", NULL, "Midcoin", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 1, HARDWARE_MISC_PRE90S, GBF_BREAKOUT, 0, - NULL, wallcRomInfo, wallcRomName, NULL, NULL, WallcInputInfo, WallcDIPInfo, - wallcInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x08, - 256, 256, 4, 3 -}; - - -// Wall Crash (set 2) - -static struct BurnRomInfo wallcaRomDesc[] = { - { "rom4.rom", 0x2000, 0xce43af1b, 0 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "rom5.rom", 0x2000, 0xb789a705, 0 | BRF_ESS | BRF_PRG }, // 1 - - { "rom3.rom", 0x0800, 0x6634db73, 1 | BRF_GRA }, // 2 Graphics - { "rom2.rom", 0x0800, 0x79f49c2c, 1 | BRF_GRA }, // 3 - { "rom1.rom", 0x0800, 0x3884fd4f, 1 | BRF_GRA }, // 4 - - { "74s288.c2", 0x0020, 0x83e3e293, 2 | BRF_GRA }, // 5 Color Prom -}; - -STD_ROM_PICK(wallca) -STD_ROM_FN(wallca) - -static void wallcaDecode() -{ - for (INT32 i = 0; i < 0x4000; i++) { - if (i & 0x100) { - DrvZ80ROM[i] = BITSWAP08(DrvZ80ROM[i] ^ 0x4a, 4,7,1,3,2,0,5,6); - } else { - DrvZ80ROM[i] = BITSWAP08(DrvZ80ROM[i] ^ 0xa5, 0,2,3,6,1,5,7,4); - } - } -} - -static INT32 wallcaInit() -{ - INT32 nRet = DrvInit(0x800); - - if (nRet == 0) { - wallcaDecode(); - } - - return nRet; -} - -struct BurnDriver BurnDrvWallca = { - "wallca", "wallc", NULL, NULL, "1984", - "Wall Crash (set 2)\0", NULL, "Midcoin", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 1, HARDWARE_MISC_PRE90S, GBF_BREAKOUT, 0, - NULL, wallcaRomInfo, wallcaRomName, NULL, NULL, WallcInputInfo, WallcDIPInfo, - wallcaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x08, - 256, 256, 4, 3 -}; +// FB Alpha Wall Crash driver module +// Based on MAME driver by Jarek Burczynski + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "bitswap.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM; +static UINT8 *DrvColPROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvVidRAM; +static UINT32 *Palette; +static UINT32 *DrvPalette; + +static INT16 *pAY8910Buffer[3]; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvDips[2]; +static UINT16 DrvAxis[1]; +static UINT8 DrvInputs[2]; +static UINT8 DrvReset; +static UINT32 nAnalogAxis; + +#define A(a, b, c, d) { a, b, (UINT8*)(c), d } + +static struct BurnInputInfo WallcInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, + {"Coin 3", BIT_DIGITAL, DrvJoy1 + 6, "p3 coin" }, + {"Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 2" }, + + A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 x-axis"), + + {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Wallc) + +static struct BurnDIPInfo WallcDIPList[]= +{ + {0x09, 0xff, 0xff, 0x61, NULL }, + {0x0a, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x09, 0x01, 0x03, 0x03, "5" }, + {0x09, 0x01, 0x03, 0x02, "4" }, + {0x09, 0x01, 0x03, 0x01, "3" }, + {0x09, 0x01, 0x03, 0x00, "2" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x09, 0x01, 0x0c, 0x0c, "100K/200K/400K/800K" }, + {0x09, 0x01, 0x0c, 0x08, "80K/160K/320K/640K" }, + {0x09, 0x01, 0x0c, 0x04, "60K/120K/240K/480K" }, + {0x09, 0x01, 0x0c, 0x00, "Off" }, + + {0 , 0xfe, 0 , 2 , "Curve Effect" }, + {0x09, 0x01, 0x10, 0x10, "Normal" }, + {0x09, 0x01, 0x10, 0x00, "More" }, + + {0 , 0xfe, 0 , 4 , "Timer Speed" }, + {0x09, 0x01, 0x60, 0x60, "Slow" }, + {0x09, 0x01, 0x60, 0x40, "Normal" }, + {0x09, 0x01, 0x60, 0x20, "Fast" }, + {0x09, 0x01, 0x60, 0x00, "Super Fast" }, + + {0 , 0xfe, 0 , 2 , "Service" }, + {0x09, 0x01, 0x80, 0x80, "Free Play and Level Select" }, + {0x09, 0x01, 0x80, 0x00, "Normal" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0a, 0x01, 0x03, 0x03, "2C 1C" }, + {0x0a, 0x01, 0x03, 0x00, "1C 1C" }, + {0x0a, 0x01, 0x03, 0x01, "1C 2C" }, + {0x0a, 0x01, 0x03, 0x02, "1C 5C" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0a, 0x01, 0x0c, 0x0c, "2C 1C" }, + {0x0a, 0x01, 0x0c, 0x00, "1C 1C" }, + {0x0a, 0x01, 0x0c, 0x04, "1C 2C" }, + {0x0a, 0x01, 0x0c, 0x08, "1C 5C" }, + + {0 , 0xfe, 0 , 4 , "Coin C" }, + {0x0a, 0x01, 0x30, 0x30, "2C 1C" }, + {0x0a, 0x01, 0x30, 0x00, "1C 1C" }, + {0x0a, 0x01, 0x30, 0x10, "1C 2C" }, + {0x0a, 0x01, 0x30, 0x20, "1C 5C" }, +}; + +STDDIPINFO(Wallc) + +void __fastcall wallc_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xb500: + AY8910Write(0, 0, data); + break; + + case 0xb600: + AY8910Write(0, 1, data); + break; + } +} + +UINT8 __fastcall wallc_read(UINT16 address) +{ + switch (address) + { + case 0xb000: + return DrvDips[0]; + + case 0xb200: + return DrvInputs[0]; + + case 0xb400: + return DrvInputs[1]; + + case 0xb600: + return DrvDips[1]; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + nAnalogAxis = 0; + + memset(AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[3] = { 0x04000, 0x0c000, 0x14000 }; + INT32 XOffs[8] = { 7, 6, 5, 4, 3, 2, 1, 0 }; + INT32 YOffs[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x3000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM, 0x3000); + + GfxDecode(0x0100, 3, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM); + + BurnFree (tmp); + + return 0; +} + +static void DrvPaletteInit() +{ + for (INT32 i = 8; i < 16; i++) + { + INT32 bit0,bit1,bit7,r,g,b; + + bit0 = (DrvColPROM[i] >> 5) & 0x01; + bit1 = (DrvColPROM[i] >> 6) & 0x01; + r = ((77 * bit1) + (115 * bit0)) + 1; + + bit0 = (DrvColPROM[i] >> 2) & 0x01; + bit1 = (DrvColPROM[i] >> 3) & 0x01; + g = ((77 * bit1) + (115 * bit0)) + 1; + + bit0 = (DrvColPROM[i] >> 0) & 0x01; + bit1 = (DrvColPROM[i] >> 1) & 0x01; + bit7 = (DrvColPROM[i] >> 7) & 0x01; + b = ((54 * bit7) + (84 * bit1) + (115 * bit0)); + + Palette[i-8] = (r << 16) | (g << 8) | b; + } +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x008000; + + DrvGfxROM = Next; Next += 0x004000; + + DrvColPROM = Next; Next += 0x000020; + + Palette = (UINT32*)Next; Next += 0x0008 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x0008 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x000400; + DrvVidRAM = Next; Next += 0x000400; + + RamEnd = Next; + + pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit(INT32 incr) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x0000 + incr, 2, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x1000 + incr, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x2000 + incr, 4, 1)) return 1; + + if (BurnLoadRom(DrvColPROM, 5, 1)) return 1; + + DrvPaletteInit(); + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x83ff, 0, DrvVidRAM); + ZetMapArea(0x8000, 0x83ff, 1, DrvVidRAM); + ZetMapArea(0x8000, 0x83ff, 2, DrvVidRAM); + ZetMapArea(0x8400, 0x87ff, 0, DrvVidRAM); + ZetMapArea(0x8400, 0x87ff, 1, DrvVidRAM); + ZetMapArea(0x8400, 0x87ff, 2, DrvVidRAM); + ZetMapArea(0x8800, 0x8bff, 0, DrvVidRAM); + ZetMapArea(0x8800, 0x8bff, 1, DrvVidRAM); + ZetMapArea(0x8800, 0x8bff, 2, DrvVidRAM); + ZetMapArea(0x8c00, 0x8fff, 0, DrvVidRAM); + ZetMapArea(0x8c00, 0x8fff, 1, DrvVidRAM); + ZetMapArea(0x8c00, 0x8fff, 2, DrvVidRAM); + ZetMapArea(0xa000, 0xa3ff, 0, DrvZ80RAM); + ZetMapArea(0xa000, 0xa3ff, 1, DrvZ80RAM); + ZetMapArea(0xa000, 0xa3ff, 2, DrvZ80RAM); + ZetSetWriteHandler(wallc_write); + ZetSetReadHandler(wallc_read); + ZetClose(); + + AY8910Init(0, 1536000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + ZetExit(); + AY8910Exit(0); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 8; i++) { + INT32 d = Palette[i]; + DrvPalette[i] = BurnHighCol(d >> 16, (d >> 8) & 0xff, d & 0xff, 0); + } + } + + for (INT32 offs = 0; offs < 0x400; offs ++) + { + INT32 sy = (~offs & 0x1f) << 3; + INT32 sx = ( offs >> 5) << 3; + INT32 code = DrvVidRAM[offs]; + + Render8x8Tile(pTransDraw, code, sx, sy, 0, 0, 0, DrvGfxROM); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = 0xff; + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + } + + nAnalogAxis -= DrvAxis[0]; + DrvInputs[1] = nAnalogAxis >> 8; + } + + ZetOpen(0); +// ZetRun(3072000 / 60); +// ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetRun(3000000 / 60); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetRun(72000 / 60); + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + AY8910Scan(nAction, pnMin); + + SCAN_VAR(nAnalogAxis); + } + + return 0; +} + + +// Wall Crash (set 1) + +static struct BurnRomInfo wallcRomDesc[] = { + { "wac05.h7", 0x2000, 0xab6e472e, 0 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "wac1-52.h6", 0x2000, 0x988eaa6d, 0 | BRF_ESS | BRF_PRG }, // 1 + + { "wc1.e3", 0x1000, 0xca5c4b53, 1 | BRF_GRA }, // 2 Graphics + { "wc2.e2", 0x1000, 0xb7f52a59, 1 | BRF_GRA }, // 3 + { "wc3.e1", 0x1000, 0xf6854b3a, 1 | BRF_GRA }, // 4 + + { "74s288.c2", 0x0020, 0x83e3e293, 2 | BRF_GRA }, // 5 Color Prom +}; + +STD_ROM_PICK(wallc) +STD_ROM_FN(wallc) + +static void wallcDecode() +{ + for (INT32 i = 0; i < 0x4000; i++) { + DrvZ80ROM[i] = BITSWAP08(DrvZ80ROM[i] ^ 0xaa, 4,2,6,0,7,1,3,5); + } +} + +static INT32 wallcInit() +{ + INT32 nRet = DrvInit(0); + + if (nRet == 0) { + wallcDecode(); + } + + return nRet; +} + +struct BurnDriver BurnDrvWallc = { + "wallc", NULL, NULL, NULL, "1984", + "Wall Crash (set 1)\0", NULL, "Midcoin", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 1, HARDWARE_MISC_PRE90S, GBF_BREAKOUT, 0, + NULL, wallcRomInfo, wallcRomName, NULL, NULL, WallcInputInfo, WallcDIPInfo, + wallcInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x08, + 256, 256, 4, 3 +}; + + +// Wall Crash (set 2) + +static struct BurnRomInfo wallcaRomDesc[] = { + { "rom4.rom", 0x2000, 0xce43af1b, 0 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "rom5.rom", 0x2000, 0xb789a705, 0 | BRF_ESS | BRF_PRG }, // 1 + + { "rom3.rom", 0x0800, 0x6634db73, 1 | BRF_GRA }, // 2 Graphics + { "rom2.rom", 0x0800, 0x79f49c2c, 1 | BRF_GRA }, // 3 + { "rom1.rom", 0x0800, 0x3884fd4f, 1 | BRF_GRA }, // 4 + + { "74s288.c2", 0x0020, 0x83e3e293, 2 | BRF_GRA }, // 5 Color Prom +}; + +STD_ROM_PICK(wallca) +STD_ROM_FN(wallca) + +static void wallcaDecode() +{ + for (INT32 i = 0; i < 0x4000; i++) { + if (i & 0x100) { + DrvZ80ROM[i] = BITSWAP08(DrvZ80ROM[i] ^ 0x4a, 4,7,1,3,2,0,5,6); + } else { + DrvZ80ROM[i] = BITSWAP08(DrvZ80ROM[i] ^ 0xa5, 0,2,3,6,1,5,7,4); + } + } +} + +static INT32 wallcaInit() +{ + INT32 nRet = DrvInit(0x800); + + if (nRet == 0) { + wallcaDecode(); + } + + return nRet; +} + +struct BurnDriver BurnDrvWallca = { + "wallca", "wallc", NULL, NULL, "1984", + "Wall Crash (set 2)\0", NULL, "Midcoin", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 1, HARDWARE_MISC_PRE90S, GBF_BREAKOUT, 0, + NULL, wallcaRomInfo, wallcaRomName, NULL, NULL, WallcInputInfo, WallcDIPInfo, + wallcaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x08, + 256, 256, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_wc90.cpp b/src/burn/drv/pre90s/d_wc90.cpp index faf0629bf..146dd2829 100644 --- a/src/burn/drv/pre90s/d_wc90.cpp +++ b/src/burn/drv/pre90s/d_wc90.cpp @@ -1,1301 +1,1298 @@ -// FB Alpha - World Cup '90 driver - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2608.h" - -static UINT8 Wc90InputPort0[6] = {0, 0, 0, 0, 0, 0}; -static UINT8 Wc90InputPort1[6] = {0, 0, 0, 0, 0, 0}; -static UINT8 Wc90InputPort2[6] = {0, 0, 0, 0, 0, 0}; -static UINT8 Wc90Dip[2] = {0, 0}; -static UINT8 Wc90Input[3] = {0x00, 0x00, 0x00}; -static UINT8 Wc90Reset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Wc90Z80Rom1 = NULL; -static UINT8 *Wc90Z80Rom2 = NULL; -static UINT8 *Wc90Z80Rom3 = NULL; -static UINT8 *Wc90Z80Ram1 = NULL; -static UINT8 *Wc90Z80Ram2 = NULL; -static UINT8 *Wc90Z80Ram3 = NULL; -static UINT8 *Wc90FgVideoRam = NULL; -static UINT8 *Wc90BgVideoRam = NULL; -static UINT8 *Wc90TextVideoRam = NULL; -static UINT8 *Wc90SpriteRam = NULL; -static UINT8 *Wc90PaletteRam = NULL; -static UINT8 *Wc90SharedRam = NULL; -static UINT32 *Wc90Palette = NULL; -static UINT8 *Wc90CharTiles = NULL; -static UINT8 *Wc90BgTiles = NULL; -static UINT8 *Wc90FgTiles = NULL; -static UINT8 *Wc90Sprites = NULL; -static UINT8 *Wc90TempGfx = NULL; -static UINT8 *Wc90YM2608Rom = NULL; - -static INT32 Wc90Scroll0YLo; -static INT32 Wc90Scroll0YHi; -static INT32 Wc90Scroll0XLo; -static INT32 Wc90Scroll0XHi; -static INT32 Wc90Scroll1YLo; -static INT32 Wc90Scroll1YHi; -static INT32 Wc90Scroll1XLo; -static INT32 Wc90Scroll1XHi; -static INT32 Wc90Scroll2YLo; -static INT32 Wc90Scroll2YHi; -static INT32 Wc90Scroll2XLo; -static INT32 Wc90Scroll2XHi; - -static INT32 Wc90SoundLatch = 0; - -static INT32 Wc90Z80BankAddress1; -static INT32 Wc90Z80BankAddress2; - -static INT32 nCyclesDone[3], nCyclesTotal[3]; -static INT32 nCyclesSegment; - -static INT32 nTileType; - -static struct BurnInputInfo Wc90InputList[] = { - {"Coin 1" , BIT_DIGITAL , Wc90InputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , Wc90InputPort2 + 2, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , Wc90InputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , Wc90InputPort2 + 3, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , Wc90InputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , Wc90InputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , Wc90InputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , Wc90InputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , Wc90InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , Wc90InputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , Wc90InputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , Wc90InputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , Wc90InputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , Wc90InputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , Wc90InputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , Wc90InputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &Wc90Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, Wc90Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, Wc90Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Wc90) - -inline static void Wc90ClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -inline static void Wc90MakeInputs() -{ - Wc90Input[0] = Wc90Input[1] = 0x00; - Wc90Input[2] = 0x03; - - for (INT32 i = 0; i < 6; i++) { - Wc90Input[0] |= (Wc90InputPort0[i] & 1) << i; - Wc90Input[1] |= (Wc90InputPort1[i] & 1) << i; - } - - if (Wc90InputPort2[0]) Wc90Input[2] -= 0x01; - if (Wc90InputPort2[1]) Wc90Input[2] -= 0x02; - if (Wc90InputPort2[2]) Wc90Input[2] |= 0x04; - if (Wc90InputPort2[3]) Wc90Input[2] |= 0x08; - - Wc90ClearOpposites(&Wc90Input[0]); - Wc90ClearOpposites(&Wc90Input[1]); -} - -static struct BurnDIPInfo Wc90DIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 16 , "Coinage" }, - {0x11, 0x01, 0x0f, 0x00, "10 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x08, " 9 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x04, " 8 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x0c, " 7 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x02, " 6 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x0a, " 5 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x06, " 4 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x0e, " 3 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x01, " 2 Coins 3 Credits" }, - {0x11, 0x01, 0x0f, 0x09, " 2 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x0f, " 1 Coin 1 Credit" }, - {0x11, 0x01, 0x0f, 0x07, " 1 Coin 2 Credits" }, - {0x11, 0x01, 0x0f, 0x0b, " 1 Coin 3 Credits" }, - {0x11, 0x01, 0x0f, 0x03, " 1 Coin 4 Credits" }, - {0x11, 0x01, 0x0f, 0x0d, " 1 Coin 5 Credits" }, - {0x11, 0x01, 0x0f, 0x05, " 1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x30, 0x30, "Easy" }, - {0x11, 0x01, 0x30, 0x10, "Normal" }, - {0x11, 0x01, 0x30, 0x20, "Hard" }, - {0x11, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Countdown Speed" }, - {0x11, 0x01, 0x40, 0x40, "Normal" }, - {0x11, 0x01, 0x40, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x80, 0x00, "Off" }, - {0x11, 0x01, 0x80, 0x80, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "1 Player Game Time" }, - {0x12, 0x01, 0x03, 0x01, "1:00" }, - {0x12, 0x01, 0x03, 0x02, "1:30" }, - {0x12, 0x01, 0x03, 0x03, "2:00" }, - {0x12, 0x01, 0x03, 0x00, "2:30" }, - - {0 , 0xfe, 0 , 8 , "2 Players Game Time" }, - {0x12, 0x01, 0x1c, 0x0c, "1:00" }, - {0x12, 0x01, 0x1c, 0x14, "1:30" }, - {0x12, 0x01, 0x1c, 0x04, "2:00" }, - {0x12, 0x01, 0x1c, 0x18, "2:30" }, - {0x12, 0x01, 0x1c, 0x1c, "3:00" }, - {0x12, 0x01, 0x1c, 0x08, "3:30" }, - {0x12, 0x01, 0x1c, 0x10, "4:00" }, - {0x12, 0x01, 0x1c, 0x00, "5:00" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x12, 0x01, 0x80, 0x00, "English" }, - {0x12, 0x01, 0x80, 0x80, "Japanese" }, -}; - -STDDIPINFO(Wc90) - -static struct BurnRomInfo Wc90RomDesc[] = { - { "ic87_01.bin", 0x08000, 0x4a1affbc, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ic95_02.bin", 0x10000, 0x847d439c, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "ic67_04.bin", 0x10000, 0xdc6eaf00, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - { "ic56_03.bin", 0x10000, 0x1ac02b3b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "ic54_05.bin", 0x10000, 0x27c348b3, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code - - { "ic85_07v.bin", 0x10000, 0xc5219426, BRF_GRA }, // 5 Characters - { "ic86_08v.bin", 0x20000, 0x8fa1a1ff, BRF_GRA }, // 6 Fg Tiles - { "ic90_09v.bin", 0x20000, 0x99f8841c, BRF_GRA }, // 7 Fg Tiles - { "ic87_10v.bin", 0x20000, 0x8232093d, BRF_GRA }, // 8 Bg Tiles - { "ic91_11v.bin", 0x20000, 0x188d3789, BRF_GRA }, // 9 Bg Tiles - { "ic50_12v.bin", 0x20000, 0xda1fe922, BRF_GRA }, // 10 Sprites - { "ic54_13v.bin", 0x20000, 0x9ad03c2c, BRF_GRA }, // 11 Sprites - { "ic60_14v.bin", 0x20000, 0x499dfb1b, BRF_GRA }, // 12 Sprites - { "ic65_15v.bin", 0x20000, 0xd8ea5c81, BRF_GRA }, // 13 Sprites - - { "ic82_06.bin", 0x20000, 0x2fd692ed, BRF_SND }, // 14 ADPCM Samples -}; - -STD_ROM_PICK(Wc90) -STD_ROM_FN(Wc90) - -static struct BurnRomInfo Wc90aRomDesc[] = { - { "wc90-1.bin", 0x08000, 0xd1804e1a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ic95_02.bin", 0x10000, 0x847d439c, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "ic67_04.bin", 0x10000, 0xdc6eaf00, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - { "ic56_03.bin", 0x10000, 0x1ac02b3b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "ic54_05.bin", 0x10000, 0x27c348b3, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code - - { "ic85_07v.bin", 0x10000, 0xc5219426, BRF_GRA }, // 5 Characters - { "ic86_08v.bin", 0x20000, 0x8fa1a1ff, BRF_GRA }, // 6 Fg Tiles - { "ic90_09v.bin", 0x20000, 0x99f8841c, BRF_GRA }, // 7 Fg Tiles - { "ic87_10v.bin", 0x20000, 0x8232093d, BRF_GRA }, // 8 Bg Tiles - { "ic91_11v.bin", 0x20000, 0x188d3789, BRF_GRA }, // 9 Bg Tiles - { "ic50_12v.bin", 0x20000, 0xda1fe922, BRF_GRA }, // 10 Sprites - { "ic54_13v.bin", 0x20000, 0x9ad03c2c, BRF_GRA }, // 11 Sprites - { "ic60_14v.bin", 0x20000, 0x499dfb1b, BRF_GRA }, // 12 Sprites - { "ic65_15v.bin", 0x20000, 0xd8ea5c81, BRF_GRA }, // 13 Sprites - - { "ic82_06.bin", 0x20000, 0x2fd692ed, BRF_SND }, // 14 ADPCM Samples -}; - -STD_ROM_PICK(Wc90a) -STD_ROM_FN(Wc90a) - -static struct BurnRomInfo Wc90bRomDesc[] = { - { "ic87-1b.bin", 0x08000, 0xd024a971, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ic95_02.bin", 0x10000, 0x847d439c, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "ic67_04.bin", 0x10000, 0xdc6eaf00, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - { "ic56_03.bin", 0x10000, 0x1ac02b3b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "ic54_05.bin", 0x10000, 0x27c348b3, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code - - { "ic85_07v.bin", 0x10000, 0xc5219426, BRF_GRA }, // 5 Characters - { "ic86_08v.bin", 0x20000, 0x8fa1a1ff, BRF_GRA }, // 6 Fg Tiles - { "ic90_09v.bin", 0x20000, 0x99f8841c, BRF_GRA }, // 7 Fg Tiles - { "ic87_10v.bin", 0x20000, 0x8232093d, BRF_GRA }, // 8 Bg Tiles - { "ic91_11v.bin", 0x20000, 0x188d3789, BRF_GRA }, // 9 Bg Tiles - { "ic50_12v.bin", 0x20000, 0xda1fe922, BRF_GRA }, // 10 Sprites - { "ic54_13v.bin", 0x20000, 0x9ad03c2c, BRF_GRA }, // 11 Sprites - { "ic60_14v.bin", 0x20000, 0x499dfb1b, BRF_GRA }, // 12 Sprites - { "ic65_15v.bin", 0x20000, 0xd8ea5c81, BRF_GRA }, // 13 Sprites - - { "ic82_06.bin", 0x20000, 0x2fd692ed, BRF_SND }, // 14 ADPCM Samples -}; - -STD_ROM_PICK(Wc90b) -STD_ROM_FN(Wc90b) - -static struct BurnRomInfo Wc90tRomDesc[] = { - { "wc90a-1.bin", 0x08000, 0xb6f51a68, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "wc90a-2.bin", 0x10000, 0xc50f2a98, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "ic67_04.bin", 0x10000, 0xdc6eaf00, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - { "wc90a-3.bin", 0x10000, 0x8c7a9542, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "ic54_05.bin", 0x10000, 0x27c348b3, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code - - { "ic85_07v.bin", 0x10000, 0xc5219426, BRF_GRA }, // 5 Characters - { "ic86_08v.bin", 0x20000, 0x8fa1a1ff, BRF_GRA }, // 6 Fg Tiles - { "ic90_09v.bin", 0x20000, 0x99f8841c, BRF_GRA }, // 7 Fg Tiles - { "ic87_10v.bin", 0x20000, 0x8232093d, BRF_GRA }, // 8 Bg Tiles - { "ic91_11v.bin", 0x20000, 0x188d3789, BRF_GRA }, // 9 Bg Tiles - { "ic50_12v.bin", 0x20000, 0xda1fe922, BRF_GRA }, // 10 Sprites - { "ic54_13v.bin", 0x20000, 0x9ad03c2c, BRF_GRA }, // 11 Sprites - { "ic60_14v.bin", 0x20000, 0x499dfb1b, BRF_GRA }, // 12 Sprites - { "ic65_15v.bin", 0x20000, 0xd8ea5c81, BRF_GRA }, // 13 Sprites - - { "ic82_06.bin", 0x20000, 0x2fd692ed, BRF_SND }, // 14 ADPCM Samples -}; - -STD_ROM_PICK(Wc90t) -STD_ROM_FN(Wc90t) - -static INT32 Wc90DoReset() -{ - Wc90Scroll0XLo = Wc90Scroll0XHi = Wc90Scroll0YLo = Wc90Scroll0YHi = 0; - Wc90Scroll1XLo = Wc90Scroll1XHi = Wc90Scroll1YLo = Wc90Scroll1YHi = 0; - Wc90Scroll2XLo = Wc90Scroll2XHi = Wc90Scroll2YLo = Wc90Scroll2YHi = 0; - - Wc90SoundLatch = 0; - - for (INT32 i = 0; i < 3; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - BurnYM2608Reset(); - - HiscoreReset(); - - return 0; -} - -static void wc90FMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static inline void wc90SendSoundCommand(INT32 nCommand) -{ - Wc90SoundLatch = nCommand; - - ZetClose(); - - ZetOpen(2); - ZetNmi(); - ZetClose(); - - ZetOpen(0); -} - -static INT32 wc90SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double wc90GetTime() -{ - return (double)ZetTotalCycles() / 4000000; -} - -UINT8 __fastcall Wc90Read1(UINT16 a) -{ - switch (a) { - case 0xfc00: { - return 0xff - Wc90Input[0]; - } - - case 0xfc02: { - return 0xff - Wc90Input[1]; - } - - case 0xfc05: { - return 0xff - Wc90Input[2]; - } - - case 0xfc06: { - return Wc90Dip[0]; - } - - case 0xfc07: { - return Wc90Dip[1]; - } - } - - return 0; -} - -void __fastcall Wc90Write1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xfc02: { - Wc90Scroll0YLo = d; - return; - } - - case 0xfc03: { - Wc90Scroll0YHi = d; - return; - } - - case 0xfc06: { - Wc90Scroll0XLo = d; - return; - } - - case 0xfc07: { - Wc90Scroll0XHi = d; - return; - } - - case 0xfc22: { - Wc90Scroll1YLo = d; - return; - } - - case 0xfc23: { - Wc90Scroll1YHi = d; - return; - } - - case 0xfc26: { - Wc90Scroll1XLo = d; - return; - } - - case 0xfc27: { - Wc90Scroll1XHi = d; - return; - } - - case 0xfc42: { - Wc90Scroll2YLo = d; - return; - } - - case 0xfc43: { - Wc90Scroll2YHi = d; - return; - } - - case 0xfc46: { - Wc90Scroll2XLo = d; - return; - } - - case 0xfc47: { - Wc90Scroll2XHi = d; - return; - } - - case 0xfcc0: { - wc90SendSoundCommand(d); - return; - } - - case 0xfce0: { - Wc90Z80BankAddress1 = 0x10000 + ((d & 0xf8) << 8); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom1 + Wc90Z80BankAddress1); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom1 + Wc90Z80BankAddress1); - return; - } - } -} - -void __fastcall Wc90Write2(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xfc00: { - Wc90Z80BankAddress2 = 0x10000 + ((d & 0xf8) << 8); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom2 + Wc90Z80BankAddress2); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom2 + Wc90Z80BankAddress2); - return; - } - } -} - -UINT8 __fastcall Wc90Read3(UINT16 a) -{ - switch (a) { - case 0xf800: { - return BurnYM2608Read(0); - } - - case 0xf802: { - return BurnYM2608Read(2); - } - - case 0xfc10: { - return Wc90SoundLatch; - } - } - - return 0; -} - -void __fastcall Wc90Write3(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xf800: { - BurnYM2608Write(0, d); - return; - } - - case 0xf801: { - BurnYM2608Write(1, d); - return; - } - - case 0xf802: { - BurnYM2608Write(2, d); - return; - } - - case 0xf803: { - BurnYM2608Write(3, d); - return; - } - } -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Wc90Z80Rom1 = Next; Next += 0x20000; - Wc90Z80Rom2 = Next; Next += 0x20000; - Wc90Z80Rom3 = Next; Next += 0x10000; - Wc90YM2608Rom = Next; Next += 0x20000; - - RamStart = Next; - - Wc90Z80Ram1 = Next; Next += 0x04000; - Wc90Z80Ram2 = Next; Next += 0x01800; - Wc90Z80Ram3 = Next; Next += 0x00800; - Wc90FgVideoRam = Next; Next += 0x01000; - Wc90BgVideoRam = Next; Next += 0x01000; - Wc90TextVideoRam = Next; Next += 0x01000; - Wc90SpriteRam = Next; Next += 0x00800; - Wc90PaletteRam = Next; Next += 0x00800; - Wc90SharedRam = Next; Next += 0x00400; - - RamEnd = Next; - - Wc90CharTiles = Next; Next += (2048 * 8 * 8); - Wc90BgTiles = Next; Next += (2048 * 16 * 16); - Wc90FgTiles = Next; Next += (2048 * 16 * 16); - Wc90Sprites = Next; Next += (4096 * 16 * 16); - Wc90Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static void Wc90RenderBgLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = Wc90BgVideoRam[TileIndex]; - Code = Wc90BgVideoRam[TileIndex + 0x800] + 256 * ((Attr & 3) + ((Attr >> 1) & 4)); - Colour = Attr >> 4; - - x = 16 * mx; - y = 16 * my; - - x -= Wc90Scroll2XLo + 256 * Wc90Scroll2XHi; - y -= Wc90Scroll2YLo + 256 * Wc90Scroll2YHi; - - x &= 0x3ff; - y &= 0x1ff; - - y -= 16; - if (x > 968) x -= 1024; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 768, Wc90BgTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 768, Wc90BgTiles); - } - - TileIndex++; - } - } -} - -static void Wc90tRenderBgLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = Wc90BgVideoRam[TileIndex]; - Code = Wc90BgVideoRam[TileIndex + 0x800] + 256 * (Attr & 7); - Colour = Attr >> 4; - - x = 16 * mx; - y = 16 * my; - - x -= Wc90Scroll2XLo + 256 * Wc90Scroll2XHi; - y -= Wc90Scroll2YLo + 256 * Wc90Scroll2YHi; - - x &= 0x3ff; - y &= 0x1ff; - - y -= 16; - if (x > 968) x -= 1024; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 768, Wc90BgTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 768, Wc90BgTiles); - } - - TileIndex++; - } - } -} - -static void Wc90RenderFgLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = Wc90FgVideoRam[TileIndex]; - Code = Wc90FgVideoRam[TileIndex + 0x800] + 256 * ((Attr & 3) + ((Attr >> 1) & 4)); - Colour = Attr >> 4; - - x = 16 * mx; - y = 16 * my; - - x -= Wc90Scroll1XLo + 256 * Wc90Scroll1XHi; - y -= Wc90Scroll1YLo + 256 * Wc90Scroll1YHi; - - x &= 0x3ff; - y &= 0x1ff; - - y -= 16; - if (x > 968) x -= 1024; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512, Wc90FgTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512, Wc90FgTiles); - } - - TileIndex++; - } - } -} - -static void Wc90tRenderFgLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = Wc90FgVideoRam[TileIndex]; - Code = Wc90FgVideoRam[TileIndex + 0x800] + 256 * (Attr & 7); - Colour = Attr >> 4; - - x = 16 * mx; - y = 16 * my; - - x -= Wc90Scroll1XLo + 256 * Wc90Scroll1XHi; - y -= Wc90Scroll1YLo + 256 * Wc90Scroll1YHi; - - x &= 0x3ff; - y &= 0x1ff; - - y -= 16; - if (x > 968) x -= 1024; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512, Wc90FgTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512, Wc90FgTiles); - } - - TileIndex++; - } - } -} - -static void Wc90RenderCharLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Code = Wc90TextVideoRam[TileIndex + 0x800] + ((Wc90TextVideoRam[TileIndex] & 0x07) << 8); - Colour = Wc90TextVideoRam[TileIndex] >> 4; - - x = 8 * mx; - y = 8 * my; - - x -= Wc90Scroll0XLo + 256 * Wc90Scroll0XHi; - y -= Wc90Scroll0YLo + 256 * Wc90Scroll0YHi; - - x &= 0x1ff; - y &= 0x0ff; - - y -= 16; - - if (x > 7 && x < 248 && y > 7 && y < 216) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, Wc90CharTiles); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, Wc90CharTiles); - } - - TileIndex++; - } - } -} - -static void Wc90RenderSprite(INT32 Code, INT32 Colour, INT32 FlipX, INT32 FlipY, INT32 x, INT32 y) -{ - if (x > 15 && x < 240 && y > 15 && y < 208) { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); - } else { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); - } - } - } else { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); - } - } - } -} - -static const char p32x32[4][4] = { - { 0, 1, 2, 3 }, - { 1, 0, 3, 2 }, - { 2, 3, 0, 1 }, - { 3, 2, 1, 0 } -}; - -static const char p32x64[4][8] = { - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 5, 4, 7, 6, 1, 0, 3, 2 }, - { 2, 3, 0, 1, 6, 7, 4, 5 }, - { 7, 6, 5, 4, 3, 2, 1, 0 } -}; - -static const char p64x32[4][8] = { - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 1, 0, 3, 2, 5, 4, 7, 6 }, - { 6, 7, 4, 5, 2, 3, 0, 1 }, - { 7, 6, 5, 4, 3, 2, 1, 0 } -}; - -static const char p64x64[4][16] = { - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, - { 5, 4, 7, 6, 1, 0, 3, 2, 13, 12, 15, 14, 9, 8, 11, 10 }, - { 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5 }, - { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 } -}; - -static void drawsprite_16x16(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) -{ - Wc90RenderSprite(Code, Attr >> 4, Bank & 1, Bank & 2, x, y); -} - -static void drawsprite_16x32(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) -{ - if (Bank & 2) { - Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); - Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - } else { - Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); - } -} - -static void drawsprite_16x64(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) -{ - if (Bank & 2) { - Wc90RenderSprite(Code + 3, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 48); - Wc90RenderSprite(Code + 2, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 32); - Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); - Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - } else { - Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); - Wc90RenderSprite(Code + 2, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 32); - Wc90RenderSprite(Code + 3, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 48); - } -} - -static void drawsprite_32x16(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) -{ - if (Bank & 1) { - Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); - Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - } else { - Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); - } -} - -static void drawsprite_32x32(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) -{ - const char *p = p32x32[Bank & 3]; - - Wc90RenderSprite(Code + p[0], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - Wc90RenderSprite(Code + p[1], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); - Wc90RenderSprite(Code + p[2], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); - Wc90RenderSprite(Code + p[3], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 16); -} - -static void drawsprite_32x64(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) -{ - const char *p = p32x64[Bank & 3]; - - Wc90RenderSprite(Code + p[0], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - Wc90RenderSprite(Code + p[1], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); - Wc90RenderSprite(Code + p[2], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); - Wc90RenderSprite(Code + p[3], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 16); - Wc90RenderSprite(Code + p[4], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 32); - Wc90RenderSprite(Code + p[5], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 32); - Wc90RenderSprite(Code + p[6], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 48); - Wc90RenderSprite(Code + p[7], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 48); -} - -static void drawsprite_64x16(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) -{ - if (Bank & 1) { - Wc90RenderSprite(Code + 3, Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 0); - Wc90RenderSprite(Code + 2, Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 0); - Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); - Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - } else { - Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); - Wc90RenderSprite(Code + 2, Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 0); - Wc90RenderSprite(Code + 3, Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 0); - } -} - -static void drawsprite_64x32(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) -{ - const char *p = p64x32[Bank & 3]; - - Wc90RenderSprite(Code + p[0], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - Wc90RenderSprite(Code + p[1], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); - Wc90RenderSprite(Code + p[2], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); - Wc90RenderSprite(Code + p[3], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 16); - Wc90RenderSprite(Code + p[4], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 0); - Wc90RenderSprite(Code + p[5], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 0); - Wc90RenderSprite(Code + p[6], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 16); - Wc90RenderSprite(Code + p[7], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 16); -} - -static void drawsprite_64x64(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) -{ - const char *p = p64x64[Bank & 3]; - - Wc90RenderSprite(Code + p[ 0], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); - Wc90RenderSprite(Code + p[ 1], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); - Wc90RenderSprite(Code + p[ 2], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); - Wc90RenderSprite(Code + p[ 3], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 16); - Wc90RenderSprite(Code + p[ 4], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 0); - Wc90RenderSprite(Code + p[ 5], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 0); - Wc90RenderSprite(Code + p[ 6], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 16); - Wc90RenderSprite(Code + p[ 7], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 16); - Wc90RenderSprite(Code + p[ 8], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 32); - Wc90RenderSprite(Code + p[ 9], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 32); - Wc90RenderSprite(Code + p[10], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 48); - Wc90RenderSprite(Code + p[11], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 48); - Wc90RenderSprite(Code + p[12], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 32); - Wc90RenderSprite(Code + p[13], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 32); - Wc90RenderSprite(Code + p[14], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 48); - Wc90RenderSprite(Code + p[15], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 48); -} - -static void drawsprite_invalid(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) { -#ifdef FBA_DEBUG - bprintf(PRINT_NORMAL, _T("8 Pixel Size not Supported! %X, %d, %d, %X, %X\n"), Code, x, y, Bank, Attr); -#else - (void)Code; (void)x; (void)y; (void)Bank; (void)Attr; -#endif -} - -typedef void (*drawsprites_procdef)(int, int, int, int, int); - -static drawsprites_procdef drawsprites_proc[16] = { - drawsprite_invalid, /* 0000 = 08x08 */ - drawsprite_invalid, /* 0001 = 16x08 */ - drawsprite_invalid, /* 0010 = 32x08 */ - drawsprite_invalid, /* 0011 = 64x08 */ - drawsprite_invalid, /* 0100 = 08x16 */ - drawsprite_16x16, /* 0101 = 16x16 */ - drawsprite_32x16, /* 0110 = 32x16 */ - drawsprite_64x16, /* 0111 = 64x16 */ - drawsprite_invalid, /* 1000 = 08x32 */ - drawsprite_16x32, /* 1001 = 16x32 */ - drawsprite_32x32, /* 1010 = 32x32 */ - drawsprite_64x32, /* 1011 = 64x32 */ - drawsprite_invalid, /* 1100 = 08x64 */ - drawsprite_16x64, /* 1101 = 16x64 */ - drawsprite_32x64, /* 1110 = 32x64 */ - drawsprite_64x64 /* 1111 = 64x64 */ -}; - -static void Wc90RenderSprites(INT32 Priority) -{ - INT32 Code, Attr, x, y; - - for (INT32 Offs = 0; Offs < 0x800; Offs += 16) { - INT32 Bank = Wc90SpriteRam[Offs + 0]; - - if ((Bank >> 4) == Priority) { - if (Bank & 4) { - Code = (Wc90SpriteRam[Offs + 2] >> 2) + (Wc90SpriteRam[Offs + 3] << 6); - - x = Wc90SpriteRam[Offs + 8] + ((Wc90SpriteRam[Offs + 9] & 3) << 8); - y = Wc90SpriteRam[Offs + 6] + ((Wc90SpriteRam[Offs + 7] & 1) << 8); - - if (x >= 0x300) x -= 0x400; - - y -= 16; - - Attr = Wc90SpriteRam[Offs + 4]; - (*(drawsprites_proc[Attr & 0x0f]))(Code, x, y, Bank, Attr); - } - } - } -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour >> 4) & 0x0f; - g = (nColour >> 0) & 0x0f; - b = (nColour >> 8) & 0x0f; - - r = (r << 4) | r; - g = (g << 4) | g; - b = (b << 4) | b; - - return BurnHighCol(r, g, b, 0); -} - -static INT32 Wc90CalcPalette() -{ - INT32 i; - - for (i = 0; i < 0x800; i++) { - Wc90Palette[i / 2] = CalcCol(Wc90PaletteRam[i | 1] | (Wc90PaletteRam[i & ~1] << 8)); - } - - return 0; -} - -static void Wc90Draw() -{ - Wc90CalcPalette(); - Wc90RenderBgLayer(); - Wc90RenderSprites(2); - Wc90RenderFgLayer(); - Wc90RenderSprites(1); - Wc90RenderCharLayer(); - Wc90RenderSprites(0); - BurnTransferCopy(Wc90Palette); -} - -static void Wc90tDraw() -{ - Wc90CalcPalette(); - Wc90tRenderBgLayer(); - Wc90RenderSprites(2); - Wc90tRenderFgLayer(); - Wc90RenderSprites(1); - Wc90RenderCharLayer(); - Wc90RenderSprites(0); - BurnTransferCopy(Wc90Palette); -} - -typedef void (*drawscreen_procdef)(void); - -static drawscreen_procdef drawscreen_proc[2] = { - Wc90Draw, - Wc90tDraw, -}; - -static INT32 Wc90Frame() -{ - INT32 nInterleave = 262; - - if (Wc90Reset) Wc90DoReset(); - - Wc90MakeInputs(); - - nCyclesTotal[0] = (INT32)((INT64)8000000 * nBurnCPUSpeedAdjust / (0x0100 * 59.17)); - nCyclesTotal[1] = (INT32)((INT64)8000000 * nBurnCPUSpeedAdjust / (0x0100 * 59.17)); - nCyclesTotal[2] = (INT32)(double)(4000000 / 59.17); - - nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext, nCurrentCPU; - - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 261) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 261) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - nCurrentCPU = 2; - ZetOpen(nCurrentCPU); - BurnTimerUpdate(i * (nCyclesTotal[2] / nInterleave)); - ZetClose(); - } - - ZetOpen(2); - BurnTimerEndFrame(nCyclesTotal[2]); - if (pBurnSoundOut) { - BurnYM2608Update(pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - if (pBurnDraw) (*(drawscreen_proc[nTileType]))(); - - return 0; -} - -static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 CharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; -static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 TileXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; -static INT32 TileYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; -static INT32 SpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 SpriteXOffsets[16] = { 0, 4, 0x200000, 0x200004, 8, 12, 0x200008, 0x20000c, 128, 132, 0x200080, 0x200084, 136, 140, 0x200088, 0x20008c }; -static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 256, 272, 288, 304, 320, 336, 352, 368 }; - -static INT32 Wc90Init() -{ - INT32 nRet = 0, nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - Wc90TempGfx = (UINT8*)BurnMalloc(0x80000); - if (Wc90TempGfx == NULL) return 1; - - nRet = BurnLoadRom(Wc90Z80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90Z80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(Wc90Z80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90Z80Rom2 + 0x10000, 3, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(Wc90Z80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; - - memset(Wc90TempGfx, 0, 0x80000); - nRet = BurnLoadRom(Wc90TempGfx + 0x00000, 5, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, Wc90TempGfx, Wc90CharTiles); - - memset(Wc90TempGfx, 0, 0x80000); - nRet = BurnLoadRom(Wc90TempGfx + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90TempGfx + 0x20000, 7, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, Wc90TempGfx, Wc90FgTiles); - - memset(Wc90TempGfx, 0, 0x80000); - nRet = BurnLoadRom(Wc90TempGfx + 0x00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90TempGfx + 0x20000, 9, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, Wc90TempGfx, Wc90BgTiles); - - memset(Wc90TempGfx, 0, 0x80000); - nRet = BurnLoadRom(Wc90TempGfx + 0x00000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90TempGfx + 0x20000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90TempGfx + 0x40000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90TempGfx + 0x60000, 13, 1); if (nRet != 0) return 1; - GfxDecode(4096, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, Wc90TempGfx, Wc90Sprites); - - BurnFree(Wc90TempGfx); - - nRet = BurnLoadRom(Wc90YM2608Rom, 14, 1); if (nRet !=0) return 1; - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Wc90Read1); - ZetSetWriteHandler(Wc90Write1); - ZetMapArea(0x0000, 0x7fff, 0, Wc90Z80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, Wc90Z80Rom1 ); - ZetMapArea(0x8000, 0x9fff, 0, Wc90Z80Ram1 + 0x00000); - ZetMapArea(0x8000, 0x9fff, 1, Wc90Z80Ram1 + 0x00000); - ZetMapArea(0x8000, 0x9fff, 2, Wc90Z80Ram1 + 0x00000); - ZetMapArea(0xa000, 0xafff, 0, Wc90FgVideoRam ); - ZetMapArea(0xa000, 0xafff, 1, Wc90FgVideoRam ); - ZetMapArea(0xa000, 0xafff, 2, Wc90FgVideoRam ); - ZetMapArea(0xb000, 0xbfff, 0, Wc90Z80Ram1 + 0x02000); - ZetMapArea(0xb000, 0xbfff, 1, Wc90Z80Ram1 + 0x02000); - ZetMapArea(0xb000, 0xbfff, 2, Wc90Z80Ram1 + 0x02000); - ZetMapArea(0xc000, 0xcfff, 0, Wc90BgVideoRam ); - ZetMapArea(0xc000, 0xcfff, 1, Wc90BgVideoRam ); - ZetMapArea(0xc000, 0xcfff, 2, Wc90BgVideoRam ); - ZetMapArea(0xd000, 0xdfff, 0, Wc90Z80Ram1 + 0x03000); - ZetMapArea(0xd000, 0xdfff, 1, Wc90Z80Ram1 + 0x03000); - ZetMapArea(0xd000, 0xdfff, 2, Wc90Z80Ram1 + 0x03000); - ZetMapArea(0xe000, 0xefff, 0, Wc90TextVideoRam ); - ZetMapArea(0xe000, 0xefff, 1, Wc90TextVideoRam ); - ZetMapArea(0xe000, 0xefff, 2, Wc90TextVideoRam ); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom1 + 0x10000); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom1 + 0x10000); - ZetMapArea(0xf800, 0xfbff, 0, Wc90SharedRam ); - ZetMapArea(0xf800, 0xfbff, 1, Wc90SharedRam ); - ZetMapArea(0xf800, 0xfbff, 2, Wc90SharedRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetWriteHandler(Wc90Write2); - ZetMapArea(0x0000, 0xbfff, 0, Wc90Z80Rom2 ); - ZetMapArea(0x0000, 0xbfff, 2, Wc90Z80Rom2 ); - ZetMapArea(0xc000, 0xcfff, 0, Wc90Z80Ram2 + 0x00000); - ZetMapArea(0xc000, 0xcfff, 1, Wc90Z80Ram2 + 0x00000); - ZetMapArea(0xc000, 0xcfff, 2, Wc90Z80Ram2 + 0x00000); - ZetMapArea(0xd000, 0xd7ff, 0, Wc90SpriteRam ); - ZetMapArea(0xd000, 0xd7ff, 1, Wc90SpriteRam ); - ZetMapArea(0xd000, 0xd7ff, 2, Wc90SpriteRam ); - ZetMapArea(0xd800, 0xdfff, 0, Wc90Z80Ram2 + 0x01000); - ZetMapArea(0xd800, 0xdfff, 1, Wc90Z80Ram2 + 0x01000); - ZetMapArea(0xd800, 0xdfff, 2, Wc90Z80Ram2 + 0x01000); - ZetMapArea(0xe000, 0xe7ff, 0, Wc90PaletteRam ); - ZetMapArea(0xe000, 0xe7ff, 1, Wc90PaletteRam ); - ZetMapArea(0xe000, 0xe7ff, 2, Wc90PaletteRam ); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom2 + 0x10000); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom2 + 0x10000); - ZetMapArea(0xf800, 0xfbff, 0, Wc90SharedRam ); - ZetMapArea(0xf800, 0xfbff, 1, Wc90SharedRam ); - ZetMapArea(0xf800, 0xfbff, 2, Wc90SharedRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(2); - ZetOpen(2); - ZetSetReadHandler(Wc90Read3); - ZetSetWriteHandler(Wc90Write3); - ZetMapArea(0x0000, 0xbfff, 0, Wc90Z80Rom3 ); - ZetMapArea(0x0000, 0xbfff, 2, Wc90Z80Rom3 ); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Ram3 ); - ZetMapArea(0xf000, 0xf7ff, 1, Wc90Z80Ram3 ); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Ram3 ); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - - BurnSetRefreshRate(59.17); - - INT32 Wc90YM2608RomSize = 0x20000; - BurnYM2608Init(8000000, Wc90YM2608Rom, &Wc90YM2608RomSize, &wc90FMIRQHandler, wc90SynchroniseStream, wc90GetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2608SetRoute(BURN_SND_YM2608_YM2608_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2608SetRoute(BURN_SND_YM2608_YM2608_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2608SetRoute(BURN_SND_YM2608_AY8910_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); - - Wc90DoReset(); - - return 0; -} - -static INT32 Wc90tInit() -{ - nTileType = 1; - - return Wc90Init(); -} - -static INT32 Wc90Exit() -{ - ZetExit(); - GenericTilesExit(); - BurnYM2608Exit(); - - BurnFree(Mem); - - Wc90Scroll0YLo = 0; - Wc90Scroll0YHi = 0; - Wc90Scroll0XLo = 0; - Wc90Scroll0XHi = 0; - Wc90Scroll1YLo = 0; - Wc90Scroll1YHi = 0; - Wc90Scroll1XLo = 0; - Wc90Scroll1XHi = 0; - Wc90Scroll2YLo = 0; - Wc90Scroll2YHi = 0; - Wc90Scroll2XLo = 0; - Wc90Scroll2XHi = 0; - Wc90SoundLatch = 0; - - nTileType = 0; - - return 0; -} - -static INT32 Wc90Scan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029721; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - - BurnYM2608Scan(nAction, pnMin); - - SCAN_VAR(Wc90SoundLatch); - SCAN_VAR(Wc90Input); - SCAN_VAR(Wc90Dip); - SCAN_VAR(Wc90Scroll0YLo); - SCAN_VAR(Wc90Scroll0YHi); - SCAN_VAR(Wc90Scroll0XLo); - SCAN_VAR(Wc90Scroll0XHi); - SCAN_VAR(Wc90Scroll1YLo); - SCAN_VAR(Wc90Scroll1YHi); - SCAN_VAR(Wc90Scroll1XLo); - SCAN_VAR(Wc90Scroll1XHi); - SCAN_VAR(Wc90Scroll2YLo); - SCAN_VAR(Wc90Scroll2YHi); - SCAN_VAR(Wc90Scroll2XLo); - SCAN_VAR(Wc90Scroll2XHi); - SCAN_VAR(Wc90Z80BankAddress1); - SCAN_VAR(Wc90Z80BankAddress2); - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom1 + Wc90Z80BankAddress1); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom1 + Wc90Z80BankAddress1); - ZetClose(); - - ZetOpen(1); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom2 + Wc90Z80BankAddress2); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom2 + Wc90Z80BankAddress2); - ZetClose(); - } - } - - return 0; -} - -struct BurnDriver BurnDrvWc90 = { - "wc90", NULL, NULL, NULL, "1989", - "World Cup '90 (World)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, - NULL, Wc90RomInfo, Wc90RomName, NULL, NULL, Wc90InputInfo, Wc90DIPInfo, - Wc90Init, Wc90Exit, Wc90Frame, NULL, Wc90Scan, - NULL, 0x400, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWc90a = { - "wc90a", "wc90", NULL, NULL, "1989", - "World Cup '90 (Euro set 1)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, - NULL, Wc90aRomInfo, Wc90aRomName, NULL, NULL, Wc90InputInfo, Wc90DIPInfo, - Wc90Init, Wc90Exit, Wc90Frame, NULL, Wc90Scan, - NULL, 0x400, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWc90b = { - "wc90b", "wc90", NULL, NULL, "1989", - "World Cup '90 (Euro set 2)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, - NULL, Wc90bRomInfo, Wc90bRomName, NULL, NULL, Wc90InputInfo, Wc90DIPInfo, - Wc90Init, Wc90Exit, Wc90Frame, NULL, Wc90Scan, - NULL, 0x400, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWc90t = { - "wc90t", "wc90", NULL, NULL, "1989", - "World Cup '90 (trackball)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, - NULL, Wc90tRomInfo, Wc90tRomName, NULL, NULL, Wc90InputInfo, Wc90DIPInfo, - Wc90tInit, Wc90Exit, Wc90Frame, NULL, Wc90Scan, - NULL, 0x400, 256, 224, 4, 3 -}; +// FB Alpha - World Cup '90 driver + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2608.h" + +static UINT8 Wc90InputPort0[6] = {0, 0, 0, 0, 0, 0}; +static UINT8 Wc90InputPort1[6] = {0, 0, 0, 0, 0, 0}; +static UINT8 Wc90InputPort2[6] = {0, 0, 0, 0, 0, 0}; +static UINT8 Wc90Dip[2] = {0, 0}; +static UINT8 Wc90Input[3] = {0x00, 0x00, 0x00}; +static UINT8 Wc90Reset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Wc90Z80Rom1 = NULL; +static UINT8 *Wc90Z80Rom2 = NULL; +static UINT8 *Wc90Z80Rom3 = NULL; +static UINT8 *Wc90Z80Ram1 = NULL; +static UINT8 *Wc90Z80Ram2 = NULL; +static UINT8 *Wc90Z80Ram3 = NULL; +static UINT8 *Wc90FgVideoRam = NULL; +static UINT8 *Wc90BgVideoRam = NULL; +static UINT8 *Wc90TextVideoRam = NULL; +static UINT8 *Wc90SpriteRam = NULL; +static UINT8 *Wc90PaletteRam = NULL; +static UINT8 *Wc90SharedRam = NULL; +static UINT32 *Wc90Palette = NULL; +static UINT8 *Wc90CharTiles = NULL; +static UINT8 *Wc90BgTiles = NULL; +static UINT8 *Wc90FgTiles = NULL; +static UINT8 *Wc90Sprites = NULL; +static UINT8 *Wc90TempGfx = NULL; +static UINT8 *Wc90YM2608Rom = NULL; + +static INT32 Wc90Scroll0YLo; +static INT32 Wc90Scroll0YHi; +static INT32 Wc90Scroll0XLo; +static INT32 Wc90Scroll0XHi; +static INT32 Wc90Scroll1YLo; +static INT32 Wc90Scroll1YHi; +static INT32 Wc90Scroll1XLo; +static INT32 Wc90Scroll1XHi; +static INT32 Wc90Scroll2YLo; +static INT32 Wc90Scroll2YHi; +static INT32 Wc90Scroll2XLo; +static INT32 Wc90Scroll2XHi; + +static INT32 Wc90SoundLatch = 0; + +static INT32 Wc90Z80BankAddress1; +static INT32 Wc90Z80BankAddress2; + +static INT32 nCyclesDone[3], nCyclesTotal[3]; +static INT32 nCyclesSegment; + +static INT32 nTileType; + +static struct BurnInputInfo Wc90InputList[] = { + {"Coin 1" , BIT_DIGITAL , Wc90InputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , Wc90InputPort2 + 2, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , Wc90InputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , Wc90InputPort2 + 3, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , Wc90InputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , Wc90InputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , Wc90InputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , Wc90InputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , Wc90InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , Wc90InputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , Wc90InputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , Wc90InputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , Wc90InputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , Wc90InputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , Wc90InputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , Wc90InputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &Wc90Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, Wc90Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, Wc90Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Wc90) + +inline static void Wc90ClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +inline static void Wc90MakeInputs() +{ + Wc90Input[0] = Wc90Input[1] = 0x00; + Wc90Input[2] = 0x03; + + for (INT32 i = 0; i < 6; i++) { + Wc90Input[0] |= (Wc90InputPort0[i] & 1) << i; + Wc90Input[1] |= (Wc90InputPort1[i] & 1) << i; + } + + if (Wc90InputPort2[0]) Wc90Input[2] -= 0x01; + if (Wc90InputPort2[1]) Wc90Input[2] -= 0x02; + if (Wc90InputPort2[2]) Wc90Input[2] |= 0x04; + if (Wc90InputPort2[3]) Wc90Input[2] |= 0x08; + + Wc90ClearOpposites(&Wc90Input[0]); + Wc90ClearOpposites(&Wc90Input[1]); +} + +static struct BurnDIPInfo Wc90DIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 16 , "Coinage" }, + {0x11, 0x01, 0x0f, 0x00, "10 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x08, " 9 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x04, " 8 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x0c, " 7 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x02, " 6 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x0a, " 5 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x06, " 4 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x0e, " 3 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x01, " 2 Coins 3 Credits" }, + {0x11, 0x01, 0x0f, 0x09, " 2 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x0f, " 1 Coin 1 Credit" }, + {0x11, 0x01, 0x0f, 0x07, " 1 Coin 2 Credits" }, + {0x11, 0x01, 0x0f, 0x0b, " 1 Coin 3 Credits" }, + {0x11, 0x01, 0x0f, 0x03, " 1 Coin 4 Credits" }, + {0x11, 0x01, 0x0f, 0x0d, " 1 Coin 5 Credits" }, + {0x11, 0x01, 0x0f, 0x05, " 1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x30, 0x30, "Easy" }, + {0x11, 0x01, 0x30, 0x10, "Normal" }, + {0x11, 0x01, 0x30, 0x20, "Hard" }, + {0x11, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Countdown Speed" }, + {0x11, 0x01, 0x40, 0x40, "Normal" }, + {0x11, 0x01, 0x40, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x80, 0x00, "Off" }, + {0x11, 0x01, 0x80, 0x80, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "1 Player Game Time" }, + {0x12, 0x01, 0x03, 0x01, "1:00" }, + {0x12, 0x01, 0x03, 0x02, "1:30" }, + {0x12, 0x01, 0x03, 0x03, "2:00" }, + {0x12, 0x01, 0x03, 0x00, "2:30" }, + + {0 , 0xfe, 0 , 8 , "2 Players Game Time" }, + {0x12, 0x01, 0x1c, 0x0c, "1:00" }, + {0x12, 0x01, 0x1c, 0x14, "1:30" }, + {0x12, 0x01, 0x1c, 0x04, "2:00" }, + {0x12, 0x01, 0x1c, 0x18, "2:30" }, + {0x12, 0x01, 0x1c, 0x1c, "3:00" }, + {0x12, 0x01, 0x1c, 0x08, "3:30" }, + {0x12, 0x01, 0x1c, 0x10, "4:00" }, + {0x12, 0x01, 0x1c, 0x00, "5:00" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x12, 0x01, 0x80, 0x00, "English" }, + {0x12, 0x01, 0x80, 0x80, "Japanese" }, +}; + +STDDIPINFO(Wc90) + +static struct BurnRomInfo Wc90RomDesc[] = { + { "ic87_01.bin", 0x08000, 0x4a1affbc, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ic95_02.bin", 0x10000, 0x847d439c, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "ic67_04.bin", 0x10000, 0xdc6eaf00, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + { "ic56_03.bin", 0x10000, 0x1ac02b3b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "ic54_05.bin", 0x10000, 0x27c348b3, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code + + { "ic85_07v.bin", 0x10000, 0xc5219426, BRF_GRA }, // 5 Characters + { "ic86_08v.bin", 0x20000, 0x8fa1a1ff, BRF_GRA }, // 6 Fg Tiles + { "ic90_09v.bin", 0x20000, 0x99f8841c, BRF_GRA }, // 7 Fg Tiles + { "ic87_10v.bin", 0x20000, 0x8232093d, BRF_GRA }, // 8 Bg Tiles + { "ic91_11v.bin", 0x20000, 0x188d3789, BRF_GRA }, // 9 Bg Tiles + { "ic50_12v.bin", 0x20000, 0xda1fe922, BRF_GRA }, // 10 Sprites + { "ic54_13v.bin", 0x20000, 0x9ad03c2c, BRF_GRA }, // 11 Sprites + { "ic60_14v.bin", 0x20000, 0x499dfb1b, BRF_GRA }, // 12 Sprites + { "ic65_15v.bin", 0x20000, 0xd8ea5c81, BRF_GRA }, // 13 Sprites + + { "ic82_06.bin", 0x20000, 0x2fd692ed, BRF_SND }, // 14 ADPCM Samples +}; + +STD_ROM_PICK(Wc90) +STD_ROM_FN(Wc90) + +static struct BurnRomInfo Wc90aRomDesc[] = { + { "wc90-1.bin", 0x08000, 0xd1804e1a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ic95_02.bin", 0x10000, 0x847d439c, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "ic67_04.bin", 0x10000, 0xdc6eaf00, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + { "ic56_03.bin", 0x10000, 0x1ac02b3b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "ic54_05.bin", 0x10000, 0x27c348b3, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code + + { "ic85_07v.bin", 0x10000, 0xc5219426, BRF_GRA }, // 5 Characters + { "ic86_08v.bin", 0x20000, 0x8fa1a1ff, BRF_GRA }, // 6 Fg Tiles + { "ic90_09v.bin", 0x20000, 0x99f8841c, BRF_GRA }, // 7 Fg Tiles + { "ic87_10v.bin", 0x20000, 0x8232093d, BRF_GRA }, // 8 Bg Tiles + { "ic91_11v.bin", 0x20000, 0x188d3789, BRF_GRA }, // 9 Bg Tiles + { "ic50_12v.bin", 0x20000, 0xda1fe922, BRF_GRA }, // 10 Sprites + { "ic54_13v.bin", 0x20000, 0x9ad03c2c, BRF_GRA }, // 11 Sprites + { "ic60_14v.bin", 0x20000, 0x499dfb1b, BRF_GRA }, // 12 Sprites + { "ic65_15v.bin", 0x20000, 0xd8ea5c81, BRF_GRA }, // 13 Sprites + + { "ic82_06.bin", 0x20000, 0x2fd692ed, BRF_SND }, // 14 ADPCM Samples +}; + +STD_ROM_PICK(Wc90a) +STD_ROM_FN(Wc90a) + +static struct BurnRomInfo Wc90bRomDesc[] = { + { "ic87-1b.bin", 0x08000, 0xd024a971, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ic95_02.bin", 0x10000, 0x847d439c, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "ic67_04.bin", 0x10000, 0xdc6eaf00, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + { "ic56_03.bin", 0x10000, 0x1ac02b3b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "ic54_05.bin", 0x10000, 0x27c348b3, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code + + { "ic85_07v.bin", 0x10000, 0xc5219426, BRF_GRA }, // 5 Characters + { "ic86_08v.bin", 0x20000, 0x8fa1a1ff, BRF_GRA }, // 6 Fg Tiles + { "ic90_09v.bin", 0x20000, 0x99f8841c, BRF_GRA }, // 7 Fg Tiles + { "ic87_10v.bin", 0x20000, 0x8232093d, BRF_GRA }, // 8 Bg Tiles + { "ic91_11v.bin", 0x20000, 0x188d3789, BRF_GRA }, // 9 Bg Tiles + { "ic50_12v.bin", 0x20000, 0xda1fe922, BRF_GRA }, // 10 Sprites + { "ic54_13v.bin", 0x20000, 0x9ad03c2c, BRF_GRA }, // 11 Sprites + { "ic60_14v.bin", 0x20000, 0x499dfb1b, BRF_GRA }, // 12 Sprites + { "ic65_15v.bin", 0x20000, 0xd8ea5c81, BRF_GRA }, // 13 Sprites + + { "ic82_06.bin", 0x20000, 0x2fd692ed, BRF_SND }, // 14 ADPCM Samples +}; + +STD_ROM_PICK(Wc90b) +STD_ROM_FN(Wc90b) + +static struct BurnRomInfo Wc90tRomDesc[] = { + { "wc90a-1.bin", 0x08000, 0xb6f51a68, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "wc90a-2.bin", 0x10000, 0xc50f2a98, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "ic67_04.bin", 0x10000, 0xdc6eaf00, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + { "wc90a-3.bin", 0x10000, 0x8c7a9542, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "ic54_05.bin", 0x10000, 0x27c348b3, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code + + { "ic85_07v.bin", 0x10000, 0xc5219426, BRF_GRA }, // 5 Characters + { "ic86_08v.bin", 0x20000, 0x8fa1a1ff, BRF_GRA }, // 6 Fg Tiles + { "ic90_09v.bin", 0x20000, 0x99f8841c, BRF_GRA }, // 7 Fg Tiles + { "ic87_10v.bin", 0x20000, 0x8232093d, BRF_GRA }, // 8 Bg Tiles + { "ic91_11v.bin", 0x20000, 0x188d3789, BRF_GRA }, // 9 Bg Tiles + { "ic50_12v.bin", 0x20000, 0xda1fe922, BRF_GRA }, // 10 Sprites + { "ic54_13v.bin", 0x20000, 0x9ad03c2c, BRF_GRA }, // 11 Sprites + { "ic60_14v.bin", 0x20000, 0x499dfb1b, BRF_GRA }, // 12 Sprites + { "ic65_15v.bin", 0x20000, 0xd8ea5c81, BRF_GRA }, // 13 Sprites + + { "ic82_06.bin", 0x20000, 0x2fd692ed, BRF_SND }, // 14 ADPCM Samples +}; + +STD_ROM_PICK(Wc90t) +STD_ROM_FN(Wc90t) + +static INT32 Wc90DoReset() +{ + Wc90Scroll0XLo = Wc90Scroll0XHi = Wc90Scroll0YLo = Wc90Scroll0YHi = 0; + Wc90Scroll1XLo = Wc90Scroll1XHi = Wc90Scroll1YLo = Wc90Scroll1YHi = 0; + Wc90Scroll2XLo = Wc90Scroll2XHi = Wc90Scroll2YLo = Wc90Scroll2YHi = 0; + + Wc90SoundLatch = 0; + + for (INT32 i = 0; i < 3; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + BurnYM2608Reset(); + + HiscoreReset(); + + return 0; +} + +static void wc90FMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static inline void wc90SendSoundCommand(INT32 nCommand) +{ + Wc90SoundLatch = nCommand; + + ZetClose(); + + ZetOpen(2); + ZetNmi(); + ZetClose(); + + ZetOpen(0); +} + +static INT32 wc90SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double wc90GetTime() +{ + return (double)ZetTotalCycles() / 4000000; +} + +UINT8 __fastcall Wc90Read1(UINT16 a) +{ + switch (a) { + case 0xfc00: { + return 0xff - Wc90Input[0]; + } + + case 0xfc02: { + return 0xff - Wc90Input[1]; + } + + case 0xfc05: { + return 0xff - Wc90Input[2]; + } + + case 0xfc06: { + return Wc90Dip[0]; + } + + case 0xfc07: { + return Wc90Dip[1]; + } + } + + return 0; +} + +void __fastcall Wc90Write1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xfc02: { + Wc90Scroll0YLo = d; + return; + } + + case 0xfc03: { + Wc90Scroll0YHi = d; + return; + } + + case 0xfc06: { + Wc90Scroll0XLo = d; + return; + } + + case 0xfc07: { + Wc90Scroll0XHi = d; + return; + } + + case 0xfc22: { + Wc90Scroll1YLo = d; + return; + } + + case 0xfc23: { + Wc90Scroll1YHi = d; + return; + } + + case 0xfc26: { + Wc90Scroll1XLo = d; + return; + } + + case 0xfc27: { + Wc90Scroll1XHi = d; + return; + } + + case 0xfc42: { + Wc90Scroll2YLo = d; + return; + } + + case 0xfc43: { + Wc90Scroll2YHi = d; + return; + } + + case 0xfc46: { + Wc90Scroll2XLo = d; + return; + } + + case 0xfc47: { + Wc90Scroll2XHi = d; + return; + } + + case 0xfcc0: { + wc90SendSoundCommand(d); + return; + } + + case 0xfce0: { + Wc90Z80BankAddress1 = 0x10000 + ((d & 0xf8) << 8); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom1 + Wc90Z80BankAddress1); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom1 + Wc90Z80BankAddress1); + return; + } + } +} + +void __fastcall Wc90Write2(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xfc00: { + Wc90Z80BankAddress2 = 0x10000 + ((d & 0xf8) << 8); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom2 + Wc90Z80BankAddress2); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom2 + Wc90Z80BankAddress2); + return; + } + } +} + +UINT8 __fastcall Wc90Read3(UINT16 a) +{ + switch (a) { + case 0xf800: { + return BurnYM2608Read(0); + } + + case 0xf802: { + return BurnYM2608Read(2); + } + + case 0xfc10: { + return Wc90SoundLatch; + } + } + + return 0; +} + +void __fastcall Wc90Write3(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xf800: { + BurnYM2608Write(0, d); + return; + } + + case 0xf801: { + BurnYM2608Write(1, d); + return; + } + + case 0xf802: { + BurnYM2608Write(2, d); + return; + } + + case 0xf803: { + BurnYM2608Write(3, d); + return; + } + } +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Wc90Z80Rom1 = Next; Next += 0x20000; + Wc90Z80Rom2 = Next; Next += 0x20000; + Wc90Z80Rom3 = Next; Next += 0x10000; + Wc90YM2608Rom = Next; Next += 0x20000; + + RamStart = Next; + + Wc90Z80Ram1 = Next; Next += 0x04000; + Wc90Z80Ram2 = Next; Next += 0x01800; + Wc90Z80Ram3 = Next; Next += 0x00800; + Wc90FgVideoRam = Next; Next += 0x01000; + Wc90BgVideoRam = Next; Next += 0x01000; + Wc90TextVideoRam = Next; Next += 0x01000; + Wc90SpriteRam = Next; Next += 0x00800; + Wc90PaletteRam = Next; Next += 0x00800; + Wc90SharedRam = Next; Next += 0x00400; + + RamEnd = Next; + + Wc90CharTiles = Next; Next += (2048 * 8 * 8); + Wc90BgTiles = Next; Next += (2048 * 16 * 16); + Wc90FgTiles = Next; Next += (2048 * 16 * 16); + Wc90Sprites = Next; Next += (4096 * 16 * 16); + Wc90Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static void Wc90RenderBgLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = Wc90BgVideoRam[TileIndex]; + Code = Wc90BgVideoRam[TileIndex + 0x800] + 256 * ((Attr & 3) + ((Attr >> 1) & 4)); + Colour = Attr >> 4; + + x = 16 * mx; + y = 16 * my; + + x -= Wc90Scroll2XLo + 256 * Wc90Scroll2XHi; + y -= Wc90Scroll2YLo + 256 * Wc90Scroll2YHi; + + x &= 0x3ff; + y &= 0x1ff; + + y -= 16; + if (x > 968) x -= 1024; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 768, Wc90BgTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 768, Wc90BgTiles); + } + + TileIndex++; + } + } +} + +static void Wc90tRenderBgLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = Wc90BgVideoRam[TileIndex]; + Code = Wc90BgVideoRam[TileIndex + 0x800] + 256 * (Attr & 7); + Colour = Attr >> 4; + + x = 16 * mx; + y = 16 * my; + + x -= Wc90Scroll2XLo + 256 * Wc90Scroll2XHi; + y -= Wc90Scroll2YLo + 256 * Wc90Scroll2YHi; + + x &= 0x3ff; + y &= 0x1ff; + + y -= 16; + if (x > 968) x -= 1024; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 768, Wc90BgTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 768, Wc90BgTiles); + } + + TileIndex++; + } + } +} + +static void Wc90RenderFgLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = Wc90FgVideoRam[TileIndex]; + Code = Wc90FgVideoRam[TileIndex + 0x800] + 256 * ((Attr & 3) + ((Attr >> 1) & 4)); + Colour = Attr >> 4; + + x = 16 * mx; + y = 16 * my; + + x -= Wc90Scroll1XLo + 256 * Wc90Scroll1XHi; + y -= Wc90Scroll1YLo + 256 * Wc90Scroll1YHi; + + x &= 0x3ff; + y &= 0x1ff; + + y -= 16; + if (x > 968) x -= 1024; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512, Wc90FgTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512, Wc90FgTiles); + } + + TileIndex++; + } + } +} + +static void Wc90tRenderFgLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = Wc90FgVideoRam[TileIndex]; + Code = Wc90FgVideoRam[TileIndex + 0x800] + 256 * (Attr & 7); + Colour = Attr >> 4; + + x = 16 * mx; + y = 16 * my; + + x -= Wc90Scroll1XLo + 256 * Wc90Scroll1XHi; + y -= Wc90Scroll1YLo + 256 * Wc90Scroll1YHi; + + x &= 0x3ff; + y &= 0x1ff; + + y -= 16; + if (x > 968) x -= 1024; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512, Wc90FgTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512, Wc90FgTiles); + } + + TileIndex++; + } + } +} + +static void Wc90RenderCharLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Code = Wc90TextVideoRam[TileIndex + 0x800] + ((Wc90TextVideoRam[TileIndex] & 0x07) << 8); + Colour = Wc90TextVideoRam[TileIndex] >> 4; + + x = 8 * mx; + y = 8 * my; + + x -= Wc90Scroll0XLo + 256 * Wc90Scroll0XHi; + y -= Wc90Scroll0YLo + 256 * Wc90Scroll0YHi; + + x &= 0x1ff; + y &= 0x0ff; + + y -= 16; + + if (x > 7 && x < 248 && y > 7 && y < 216) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, Wc90CharTiles); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, Wc90CharTiles); + } + + TileIndex++; + } + } +} + +static void Wc90RenderSprite(INT32 Code, INT32 Colour, INT32 FlipX, INT32 FlipY, INT32 x, INT32 y) +{ + if (x > 15 && x < 240 && y > 15 && y < 208) { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); + } else { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); + } + } + } else { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, Wc90Sprites); + } + } + } +} + +static const char p32x32[4][4] = { + { 0, 1, 2, 3 }, + { 1, 0, 3, 2 }, + { 2, 3, 0, 1 }, + { 3, 2, 1, 0 } +}; + +static const char p32x64[4][8] = { + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 5, 4, 7, 6, 1, 0, 3, 2 }, + { 2, 3, 0, 1, 6, 7, 4, 5 }, + { 7, 6, 5, 4, 3, 2, 1, 0 } +}; + +static const char p64x32[4][8] = { + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 1, 0, 3, 2, 5, 4, 7, 6 }, + { 6, 7, 4, 5, 2, 3, 0, 1 }, + { 7, 6, 5, 4, 3, 2, 1, 0 } +}; + +static const char p64x64[4][16] = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + { 5, 4, 7, 6, 1, 0, 3, 2, 13, 12, 15, 14, 9, 8, 11, 10 }, + { 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5 }, + { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 } +}; + +static void drawsprite_16x16(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) +{ + Wc90RenderSprite(Code, Attr >> 4, Bank & 1, Bank & 2, x, y); +} + +static void drawsprite_16x32(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) +{ + if (Bank & 2) { + Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); + Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + } else { + Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); + } +} + +static void drawsprite_16x64(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) +{ + if (Bank & 2) { + Wc90RenderSprite(Code + 3, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 48); + Wc90RenderSprite(Code + 2, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 32); + Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); + Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + } else { + Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); + Wc90RenderSprite(Code + 2, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 32); + Wc90RenderSprite(Code + 3, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 48); + } +} + +static void drawsprite_32x16(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) +{ + if (Bank & 1) { + Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); + Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + } else { + Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); + } +} + +static void drawsprite_32x32(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) +{ + const char *p = p32x32[Bank & 3]; + + Wc90RenderSprite(Code + p[0], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + Wc90RenderSprite(Code + p[1], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); + Wc90RenderSprite(Code + p[2], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); + Wc90RenderSprite(Code + p[3], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 16); +} + +static void drawsprite_32x64(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) +{ + const char *p = p32x64[Bank & 3]; + + Wc90RenderSprite(Code + p[0], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + Wc90RenderSprite(Code + p[1], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); + Wc90RenderSprite(Code + p[2], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); + Wc90RenderSprite(Code + p[3], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 16); + Wc90RenderSprite(Code + p[4], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 32); + Wc90RenderSprite(Code + p[5], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 32); + Wc90RenderSprite(Code + p[6], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 48); + Wc90RenderSprite(Code + p[7], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 48); +} + +static void drawsprite_64x16(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) +{ + if (Bank & 1) { + Wc90RenderSprite(Code + 3, Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 0); + Wc90RenderSprite(Code + 2, Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 0); + Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); + Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + } else { + Wc90RenderSprite(Code + 0, Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + Wc90RenderSprite(Code + 1, Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); + Wc90RenderSprite(Code + 2, Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 0); + Wc90RenderSprite(Code + 3, Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 0); + } +} + +static void drawsprite_64x32(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) +{ + const char *p = p64x32[Bank & 3]; + + Wc90RenderSprite(Code + p[0], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + Wc90RenderSprite(Code + p[1], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); + Wc90RenderSprite(Code + p[2], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); + Wc90RenderSprite(Code + p[3], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 16); + Wc90RenderSprite(Code + p[4], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 0); + Wc90RenderSprite(Code + p[5], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 0); + Wc90RenderSprite(Code + p[6], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 16); + Wc90RenderSprite(Code + p[7], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 16); +} + +static void drawsprite_64x64(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) +{ + const char *p = p64x64[Bank & 3]; + + Wc90RenderSprite(Code + p[ 0], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 0); + Wc90RenderSprite(Code + p[ 1], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 0); + Wc90RenderSprite(Code + p[ 2], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 16); + Wc90RenderSprite(Code + p[ 3], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 16); + Wc90RenderSprite(Code + p[ 4], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 0); + Wc90RenderSprite(Code + p[ 5], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 0); + Wc90RenderSprite(Code + p[ 6], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 16); + Wc90RenderSprite(Code + p[ 7], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 16); + Wc90RenderSprite(Code + p[ 8], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 32); + Wc90RenderSprite(Code + p[ 9], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 32); + Wc90RenderSprite(Code + p[10], Attr >> 4, Bank & 1, Bank & 2, x + 0, y + 48); + Wc90RenderSprite(Code + p[11], Attr >> 4, Bank & 1, Bank & 2, x + 16, y + 48); + Wc90RenderSprite(Code + p[12], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 32); + Wc90RenderSprite(Code + p[13], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 32); + Wc90RenderSprite(Code + p[14], Attr >> 4, Bank & 1, Bank & 2, x + 32, y + 48); + Wc90RenderSprite(Code + p[15], Attr >> 4, Bank & 1, Bank & 2, x + 48, y + 48); +} + +static void drawsprite_invalid(INT32 Code, INT32 x, INT32 y, INT32 Bank, INT32 Attr) { +#ifdef FBA_DEBUG + bprintf(PRINT_NORMAL, _T("8 Pixel Size not Supported! %X, %d, %d, %X, %X\n"), Code, x, y, Bank, Attr); +#else + (void)Code; (void)x; (void)y; (void)Bank; (void)Attr; +#endif +} + +typedef void (*drawsprites_procdef)(int, int, int, int, int); + +static drawsprites_procdef drawsprites_proc[16] = { + drawsprite_invalid, /* 0000 = 08x08 */ + drawsprite_invalid, /* 0001 = 16x08 */ + drawsprite_invalid, /* 0010 = 32x08 */ + drawsprite_invalid, /* 0011 = 64x08 */ + drawsprite_invalid, /* 0100 = 08x16 */ + drawsprite_16x16, /* 0101 = 16x16 */ + drawsprite_32x16, /* 0110 = 32x16 */ + drawsprite_64x16, /* 0111 = 64x16 */ + drawsprite_invalid, /* 1000 = 08x32 */ + drawsprite_16x32, /* 1001 = 16x32 */ + drawsprite_32x32, /* 1010 = 32x32 */ + drawsprite_64x32, /* 1011 = 64x32 */ + drawsprite_invalid, /* 1100 = 08x64 */ + drawsprite_16x64, /* 1101 = 16x64 */ + drawsprite_32x64, /* 1110 = 32x64 */ + drawsprite_64x64 /* 1111 = 64x64 */ +}; + +static void Wc90RenderSprites(INT32 Priority) +{ + INT32 Code, Attr, x, y; + + for (INT32 Offs = 0; Offs < 0x800; Offs += 16) { + INT32 Bank = Wc90SpriteRam[Offs + 0]; + + if ((Bank >> 4) == Priority) { + if (Bank & 4) { + Code = (Wc90SpriteRam[Offs + 2] >> 2) + (Wc90SpriteRam[Offs + 3] << 6); + + x = Wc90SpriteRam[Offs + 8] + ((Wc90SpriteRam[Offs + 9] & 3) << 8); + y = Wc90SpriteRam[Offs + 6] + ((Wc90SpriteRam[Offs + 7] & 1) << 8); + + if (x >= 0x300) x -= 0x400; + + y -= 16; + + Attr = Wc90SpriteRam[Offs + 4]; + (*(drawsprites_proc[Attr & 0x0f]))(Code, x, y, Bank, Attr); + } + } + } +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour >> 4) & 0x0f; + g = (nColour >> 0) & 0x0f; + b = (nColour >> 8) & 0x0f; + + r = (r << 4) | r; + g = (g << 4) | g; + b = (b << 4) | b; + + return BurnHighCol(r, g, b, 0); +} + +static INT32 Wc90CalcPalette() +{ + INT32 i; + + for (i = 0; i < 0x800; i++) { + Wc90Palette[i / 2] = CalcCol(Wc90PaletteRam[i | 1] | (Wc90PaletteRam[i & ~1] << 8)); + } + + return 0; +} + +static void Wc90Draw() +{ + Wc90CalcPalette(); + Wc90RenderBgLayer(); + Wc90RenderSprites(2); + Wc90RenderFgLayer(); + Wc90RenderSprites(1); + Wc90RenderCharLayer(); + Wc90RenderSprites(0); + BurnTransferCopy(Wc90Palette); +} + +static void Wc90tDraw() +{ + Wc90CalcPalette(); + Wc90tRenderBgLayer(); + Wc90RenderSprites(2); + Wc90tRenderFgLayer(); + Wc90RenderSprites(1); + Wc90RenderCharLayer(); + Wc90RenderSprites(0); + BurnTransferCopy(Wc90Palette); +} + +typedef void (*drawscreen_procdef)(void); + +static drawscreen_procdef drawscreen_proc[2] = { + Wc90Draw, + Wc90tDraw, +}; + +static INT32 Wc90Frame() +{ + INT32 nInterleave = 262; + + if (Wc90Reset) Wc90DoReset(); + + Wc90MakeInputs(); + + nCyclesTotal[0] = (INT32)((INT64)8000000 * nBurnCPUSpeedAdjust / (0x0100 * 59.17)); + nCyclesTotal[1] = (INT32)((INT64)8000000 * nBurnCPUSpeedAdjust / (0x0100 * 59.17)); + nCyclesTotal[2] = (INT32)(double)(4000000 / 59.17); + + nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext, nCurrentCPU; + + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 261) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 261) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + nCurrentCPU = 2; + ZetOpen(nCurrentCPU); + BurnTimerUpdate(i * (nCyclesTotal[2] / nInterleave)); + ZetClose(); + } + + ZetOpen(2); + BurnTimerEndFrame(nCyclesTotal[2]); + if (pBurnSoundOut) { + BurnYM2608Update(pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + if (pBurnDraw) (*(drawscreen_proc[nTileType]))(); + + return 0; +} + +static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 CharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; +static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 TileXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; +static INT32 TileYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; +static INT32 SpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 SpriteXOffsets[16] = { 0, 4, 0x200000, 0x200004, 8, 12, 0x200008, 0x20000c, 128, 132, 0x200080, 0x200084, 136, 140, 0x200088, 0x20008c }; +static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 256, 272, 288, 304, 320, 336, 352, 368 }; + +static INT32 Wc90Init() +{ + INT32 nRet = 0, nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + Wc90TempGfx = (UINT8*)BurnMalloc(0x80000); + if (Wc90TempGfx == NULL) return 1; + + nRet = BurnLoadRom(Wc90Z80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90Z80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(Wc90Z80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90Z80Rom2 + 0x10000, 3, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(Wc90Z80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; + + memset(Wc90TempGfx, 0, 0x80000); + nRet = BurnLoadRom(Wc90TempGfx + 0x00000, 5, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, Wc90TempGfx, Wc90CharTiles); + + memset(Wc90TempGfx, 0, 0x80000); + nRet = BurnLoadRom(Wc90TempGfx + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90TempGfx + 0x20000, 7, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, Wc90TempGfx, Wc90FgTiles); + + memset(Wc90TempGfx, 0, 0x80000); + nRet = BurnLoadRom(Wc90TempGfx + 0x00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90TempGfx + 0x20000, 9, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, Wc90TempGfx, Wc90BgTiles); + + memset(Wc90TempGfx, 0, 0x80000); + nRet = BurnLoadRom(Wc90TempGfx + 0x00000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90TempGfx + 0x20000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90TempGfx + 0x40000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90TempGfx + 0x60000, 13, 1); if (nRet != 0) return 1; + GfxDecode(4096, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, Wc90TempGfx, Wc90Sprites); + + BurnFree(Wc90TempGfx); + + nRet = BurnLoadRom(Wc90YM2608Rom, 14, 1); if (nRet !=0) return 1; + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Wc90Read1); + ZetSetWriteHandler(Wc90Write1); + ZetMapArea(0x0000, 0x7fff, 0, Wc90Z80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, Wc90Z80Rom1 ); + ZetMapArea(0x8000, 0x9fff, 0, Wc90Z80Ram1 + 0x00000); + ZetMapArea(0x8000, 0x9fff, 1, Wc90Z80Ram1 + 0x00000); + ZetMapArea(0x8000, 0x9fff, 2, Wc90Z80Ram1 + 0x00000); + ZetMapArea(0xa000, 0xafff, 0, Wc90FgVideoRam ); + ZetMapArea(0xa000, 0xafff, 1, Wc90FgVideoRam ); + ZetMapArea(0xa000, 0xafff, 2, Wc90FgVideoRam ); + ZetMapArea(0xb000, 0xbfff, 0, Wc90Z80Ram1 + 0x02000); + ZetMapArea(0xb000, 0xbfff, 1, Wc90Z80Ram1 + 0x02000); + ZetMapArea(0xb000, 0xbfff, 2, Wc90Z80Ram1 + 0x02000); + ZetMapArea(0xc000, 0xcfff, 0, Wc90BgVideoRam ); + ZetMapArea(0xc000, 0xcfff, 1, Wc90BgVideoRam ); + ZetMapArea(0xc000, 0xcfff, 2, Wc90BgVideoRam ); + ZetMapArea(0xd000, 0xdfff, 0, Wc90Z80Ram1 + 0x03000); + ZetMapArea(0xd000, 0xdfff, 1, Wc90Z80Ram1 + 0x03000); + ZetMapArea(0xd000, 0xdfff, 2, Wc90Z80Ram1 + 0x03000); + ZetMapArea(0xe000, 0xefff, 0, Wc90TextVideoRam ); + ZetMapArea(0xe000, 0xefff, 1, Wc90TextVideoRam ); + ZetMapArea(0xe000, 0xefff, 2, Wc90TextVideoRam ); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom1 + 0x10000); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom1 + 0x10000); + ZetMapArea(0xf800, 0xfbff, 0, Wc90SharedRam ); + ZetMapArea(0xf800, 0xfbff, 1, Wc90SharedRam ); + ZetMapArea(0xf800, 0xfbff, 2, Wc90SharedRam ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetWriteHandler(Wc90Write2); + ZetMapArea(0x0000, 0xbfff, 0, Wc90Z80Rom2 ); + ZetMapArea(0x0000, 0xbfff, 2, Wc90Z80Rom2 ); + ZetMapArea(0xc000, 0xcfff, 0, Wc90Z80Ram2 + 0x00000); + ZetMapArea(0xc000, 0xcfff, 1, Wc90Z80Ram2 + 0x00000); + ZetMapArea(0xc000, 0xcfff, 2, Wc90Z80Ram2 + 0x00000); + ZetMapArea(0xd000, 0xd7ff, 0, Wc90SpriteRam ); + ZetMapArea(0xd000, 0xd7ff, 1, Wc90SpriteRam ); + ZetMapArea(0xd000, 0xd7ff, 2, Wc90SpriteRam ); + ZetMapArea(0xd800, 0xdfff, 0, Wc90Z80Ram2 + 0x01000); + ZetMapArea(0xd800, 0xdfff, 1, Wc90Z80Ram2 + 0x01000); + ZetMapArea(0xd800, 0xdfff, 2, Wc90Z80Ram2 + 0x01000); + ZetMapArea(0xe000, 0xe7ff, 0, Wc90PaletteRam ); + ZetMapArea(0xe000, 0xe7ff, 1, Wc90PaletteRam ); + ZetMapArea(0xe000, 0xe7ff, 2, Wc90PaletteRam ); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom2 + 0x10000); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom2 + 0x10000); + ZetMapArea(0xf800, 0xfbff, 0, Wc90SharedRam ); + ZetMapArea(0xf800, 0xfbff, 1, Wc90SharedRam ); + ZetMapArea(0xf800, 0xfbff, 2, Wc90SharedRam ); + ZetClose(); + + ZetInit(2); + ZetOpen(2); + ZetSetReadHandler(Wc90Read3); + ZetSetWriteHandler(Wc90Write3); + ZetMapArea(0x0000, 0xbfff, 0, Wc90Z80Rom3 ); + ZetMapArea(0x0000, 0xbfff, 2, Wc90Z80Rom3 ); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Ram3 ); + ZetMapArea(0xf000, 0xf7ff, 1, Wc90Z80Ram3 ); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Ram3 ); + ZetClose(); + + GenericTilesInit(); + + BurnSetRefreshRate(59.17); + + INT32 Wc90YM2608RomSize = 0x20000; + BurnYM2608Init(8000000, Wc90YM2608Rom, &Wc90YM2608RomSize, &wc90FMIRQHandler, wc90SynchroniseStream, wc90GetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2608SetRoute(BURN_SND_YM2608_YM2608_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2608SetRoute(BURN_SND_YM2608_YM2608_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2608SetRoute(BURN_SND_YM2608_AY8910_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); + + Wc90DoReset(); + + return 0; +} + +static INT32 Wc90tInit() +{ + nTileType = 1; + + return Wc90Init(); +} + +static INT32 Wc90Exit() +{ + ZetExit(); + GenericTilesExit(); + BurnYM2608Exit(); + + BurnFree(Mem); + + Wc90Scroll0YLo = 0; + Wc90Scroll0YHi = 0; + Wc90Scroll0XLo = 0; + Wc90Scroll0XHi = 0; + Wc90Scroll1YLo = 0; + Wc90Scroll1YHi = 0; + Wc90Scroll1XLo = 0; + Wc90Scroll1XHi = 0; + Wc90Scroll2YLo = 0; + Wc90Scroll2YHi = 0; + Wc90Scroll2XLo = 0; + Wc90Scroll2XHi = 0; + Wc90SoundLatch = 0; + + nTileType = 0; + + return 0; +} + +static INT32 Wc90Scan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029721; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + + BurnYM2608Scan(nAction, pnMin); + + SCAN_VAR(Wc90SoundLatch); + SCAN_VAR(Wc90Input); + SCAN_VAR(Wc90Dip); + SCAN_VAR(Wc90Scroll0YLo); + SCAN_VAR(Wc90Scroll0YHi); + SCAN_VAR(Wc90Scroll0XLo); + SCAN_VAR(Wc90Scroll0XHi); + SCAN_VAR(Wc90Scroll1YLo); + SCAN_VAR(Wc90Scroll1YHi); + SCAN_VAR(Wc90Scroll1XLo); + SCAN_VAR(Wc90Scroll1XHi); + SCAN_VAR(Wc90Scroll2YLo); + SCAN_VAR(Wc90Scroll2YHi); + SCAN_VAR(Wc90Scroll2XLo); + SCAN_VAR(Wc90Scroll2XHi); + SCAN_VAR(Wc90Z80BankAddress1); + SCAN_VAR(Wc90Z80BankAddress2); + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom1 + Wc90Z80BankAddress1); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom1 + Wc90Z80BankAddress1); + ZetClose(); + + ZetOpen(1); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90Z80Rom2 + Wc90Z80BankAddress2); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90Z80Rom2 + Wc90Z80BankAddress2); + ZetClose(); + } + } + + return 0; +} + +struct BurnDriver BurnDrvWc90 = { + "wc90", NULL, NULL, NULL, "1989", + "World Cup '90 (World)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, + NULL, Wc90RomInfo, Wc90RomName, NULL, NULL, Wc90InputInfo, Wc90DIPInfo, + Wc90Init, Wc90Exit, Wc90Frame, NULL, Wc90Scan, + NULL, 0x400, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWc90a = { + "wc90a", "wc90", NULL, NULL, "1989", + "World Cup '90 (Euro set 1)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, + NULL, Wc90aRomInfo, Wc90aRomName, NULL, NULL, Wc90InputInfo, Wc90DIPInfo, + Wc90Init, Wc90Exit, Wc90Frame, NULL, Wc90Scan, + NULL, 0x400, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWc90b = { + "wc90b", "wc90", NULL, NULL, "1989", + "World Cup '90 (Euro set 2)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, + NULL, Wc90bRomInfo, Wc90bRomName, NULL, NULL, Wc90InputInfo, Wc90DIPInfo, + Wc90Init, Wc90Exit, Wc90Frame, NULL, Wc90Scan, + NULL, 0x400, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWc90t = { + "wc90t", "wc90", NULL, NULL, "1989", + "World Cup '90 (trackball)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, + NULL, Wc90tRomInfo, Wc90tRomName, NULL, NULL, Wc90InputInfo, Wc90DIPInfo, + Wc90tInit, Wc90Exit, Wc90Frame, NULL, Wc90Scan, + NULL, 0x400, 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_wc90b.cpp b/src/burn/drv/pre90s/d_wc90b.cpp index cd00771c9..9c488e434 100644 --- a/src/burn/drv/pre90s/d_wc90b.cpp +++ b/src/burn/drv/pre90s/d_wc90b.cpp @@ -1,982 +1,979 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2203.h" -#include "msm5205.h" - -static UINT8 Wc90b1InputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 Wc90b1InputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 Wc90b1Dip[2] = {0, 0}; -static UINT8 Wc90b1Input[2] = {0x00, 0x00}; -static UINT8 Wc90b1Reset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Wc90b1Z80Rom1 = NULL; -static UINT8 *Wc90b1Z80Rom2 = NULL; -static UINT8 *Wc90b1Z80Rom3 = NULL; -static UINT8 *Wc90b1Z80Ram1 = NULL; -static UINT8 *Wc90b1Z80Ram2 = NULL; -static UINT8 *Wc90b1Z80Ram3 = NULL; -static UINT8 *Wc90b1FgVideoRam = NULL; -static UINT8 *Wc90b1BgVideoRam = NULL; -static UINT8 *Wc90b1TextVideoRam = NULL; -static UINT8 *Wc90b1SpriteRam = NULL; -static UINT8 *Wc90b1PaletteRam = NULL; -static UINT8 *Wc90b1SharedRam = NULL; -static UINT32 *Wc90b1Palette = NULL; -static UINT8 *Wc90b1CharTiles = NULL; -static UINT8 *Wc90b1Tiles = NULL; -static UINT8 *Wc90b1Sprites = NULL; -static UINT8 *Wc90b1TempGfx = NULL; - -static UINT8 Wc90b1Scroll0Y; -static UINT8 Wc90b1Scroll0X; -static UINT8 Wc90b1Scroll1Y; -static UINT8 Wc90b1Scroll1X; -static UINT8 Wc90b1ScrollXLo; - -static UINT8 Wc90b1SoundLatch = 0; -static INT32 Wc90b1MSM5205Next; - -static INT32 nCyclesDone[3], nCyclesTotal[3]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo Wc90b1InputList[] = { - {"Coin 1" , BIT_DIGITAL , Wc90b1InputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , Wc90b1InputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , Wc90b1InputPort1 + 7, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , Wc90b1InputPort1 + 6, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , Wc90b1InputPort0 + 3, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , Wc90b1InputPort0 + 2, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , Wc90b1InputPort0 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , Wc90b1InputPort0 + 0, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , Wc90b1InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , Wc90b1InputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , Wc90b1InputPort1 + 3, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , Wc90b1InputPort1 + 2, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , Wc90b1InputPort1 + 1, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , Wc90b1InputPort1 + 0, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , Wc90b1InputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , Wc90b1InputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &Wc90b1Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, Wc90b1Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, Wc90b1Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Wc90b1) - -inline static void Wc90b1ClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -inline static void Wc90b1MakeInputs() -{ - Wc90b1Input[0] = Wc90b1Input[1] = 0x00; - - for (INT32 i = 0; i < 8; i++) { - Wc90b1Input[0] |= (Wc90b1InputPort0[i] & 1) << i; - Wc90b1Input[1] |= (Wc90b1InputPort1[i] & 1) << i; - } - - Wc90b1ClearOpposites(&Wc90b1Input[0]); - Wc90b1ClearOpposites(&Wc90b1Input[1]); -} - -static struct BurnDIPInfo Wc90b1DIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 16 , "Coinage" }, - {0x11, 0x01, 0x0f, 0x00, "10 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x08, " 9 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x04, " 8 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x0c, " 7 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x02, " 6 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x0a, " 5 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x06, " 4 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x0e, " 3 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x01, " 2 Coins 3 Credits" }, - {0x11, 0x01, 0x0f, 0x09, " 2 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x0f, " 1 Coin 1 Credit" }, - {0x11, 0x01, 0x0f, 0x07, " 1 Coin 2 Credits" }, - {0x11, 0x01, 0x0f, 0x0b, " 1 Coin 3 Credits" }, - {0x11, 0x01, 0x0f, 0x03, " 1 Coin 4 Credits" }, - {0x11, 0x01, 0x0f, 0x0d, " 1 Coin 5 Credits" }, - {0x11, 0x01, 0x0f, 0x05, " 1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x30, 0x30, "Easy" }, - {0x11, 0x01, 0x30, 0x10, "Normal" }, - {0x11, 0x01, 0x30, 0x20, "Hard" }, - {0x11, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Countdown Speed" }, - {0x11, 0x01, 0x40, 0x40, "Normal" }, - {0x11, 0x01, 0x40, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x80, 0x00, "Off" }, - {0x11, 0x01, 0x80, 0x80, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "1 Player Game Time" }, - {0x12, 0x01, 0x03, 0x01, "1:00" }, - {0x12, 0x01, 0x03, 0x02, "1:30" }, - {0x12, 0x01, 0x03, 0x03, "2:00" }, - {0x12, 0x01, 0x03, 0x00, "2:30" }, - - {0 , 0xfe, 0 , 8 , "2 Players Game Time" }, - {0x12, 0x01, 0x1c, 0x0c, "1:00" }, - {0x12, 0x01, 0x1c, 0x14, "1:30" }, - {0x12, 0x01, 0x1c, 0x04, "2:00" }, - {0x12, 0x01, 0x1c, 0x18, "2:30" }, - {0x12, 0x01, 0x1c, 0x1c, "3:00" }, - {0x12, 0x01, 0x1c, 0x08, "3:30" }, - {0x12, 0x01, 0x1c, 0x10, "4:00" }, - {0x12, 0x01, 0x1c, 0x00, "5:00" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x12, 0x01, 0x80, 0x00, "English" }, - {0x12, 0x01, 0x80, 0x80, "Japanese" }, -}; - -STDDIPINFO(Wc90b1) - -static struct BurnRomInfo Wc90b1RomDesc[] = { - { "a02.bin", 0x10000, 0x192a03dd, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a03.bin", 0x10000, 0xf54ff17a, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "a04.bin", 0x10000, 0x3d535e2f, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - { "a05.bin", 0x10000, 0x9e421c4b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "a01.bin", 0x10000, 0x3d317622, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code - - { "a06.bin", 0x04000, 0x3b5387b7, BRF_GRA }, // 5 Characters - { "a08.bin", 0x04000, 0xc622a5a3, BRF_GRA }, // 6 Characters - { "a10.bin", 0x04000, 0x0923d9f6, BRF_GRA }, // 7 Characters - { "a20.bin", 0x04000, 0xb8dec83e, BRF_GRA }, // 8 Characters - { "a07.bin", 0x20000, 0x38c31817, BRF_GRA }, // 9 Fg Tiles - { "a09.bin", 0x20000, 0x32e39e29, BRF_GRA }, // 10 Fg Tiles - { "a11.bin", 0x20000, 0x5ccec796, BRF_GRA }, // 11 Bg Tiles - { "a21.bin", 0x20000, 0x0c54a091, BRF_GRA }, // 12 Bg Tiles - { "146_a12.bin", 0x10000, 0xd5a60096, BRF_GRA }, // 13 Sprites - { "147_a13.bin", 0x10000, 0x36bbf467, BRF_GRA }, // 14 Sprites - { "148_a14.bin", 0x10000, 0x26371c18, BRF_GRA }, // 15 Sprites - { "149_a15.bin", 0x10000, 0x75aa9b86, BRF_GRA }, // 16 Sprites - { "150_a16.bin", 0x10000, 0x0da825f9, BRF_GRA }, // 17 Sprites - { "151_a17.bin", 0x10000, 0x228429d8, BRF_GRA }, // 18 Sprites - { "152_a18.bin", 0x10000, 0x516b6c09, BRF_GRA }, // 19 Sprites - { "153_a19.bin", 0x10000, 0xf36390a9, BRF_GRA }, // 20 Sprites - - { "el_ic39_gal16v8_0.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 21 PLDs - { "el_ic44_gal16v8_1.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 22 PLDs - { "el_ic54_gal16v8_2.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 23 PLDs - { "el_ic100_gal16v8_3.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 24 PLDs - { "el_ic143_gal16v8_4.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 25 PLDs -}; - -STD_ROM_PICK(Wc90b1) -STD_ROM_FN(Wc90b1) - -static struct BurnRomInfo Wc90b2RomDesc[] = { - { "a02", 0x10000, 0x1e6e94c9, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a03.bin", 0x10000, 0xf54ff17a, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "a04.bin", 0x10000, 0x3d535e2f, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - { "a05.bin", 0x10000, 0x9e421c4b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "a01.bin", 0x10000, 0x3d317622, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code - - { "a06", 0x08000, 0x0c054481, BRF_GRA }, // 5 Characters - { "a08", 0x08000, 0xebb3eb48, BRF_GRA }, // 6 Characters - { "a10", 0x08000, 0xc0232af8, BRF_GRA }, // 7 Characters - { "a20", 0x08000, 0xa36e17fb, BRF_GRA }, // 8 Characters - { "a07.bin", 0x20000, 0x38c31817, BRF_GRA }, // 9 Fg Tiles - { "a09.bin", 0x20000, 0x32e39e29, BRF_GRA }, // 10 Fg Tiles - { "a11.bin", 0x20000, 0x5ccec796, BRF_GRA }, // 11 Bg Tiles - { "a21.bin", 0x20000, 0x0c54a091, BRF_GRA }, // 12 Bg Tiles - { "146_a12.bin", 0x10000, 0xd5a60096, BRF_GRA }, // 13 Sprites - { "147_a13", 0x10000, 0x5b16fd48, BRF_GRA }, // 14 Sprites - { "148_a14.bin", 0x10000, 0x26371c18, BRF_GRA }, // 15 Sprites - { "149_a15", 0x10000, 0xb2423962, BRF_GRA }, // 16 Sprites - { "150_a16.bin", 0x10000, 0x0da825f9, BRF_GRA }, // 17 Sprites - { "151_a17", 0x10000, 0xaf98778e, BRF_GRA }, // 18 Sprites - { "152_a18.bin", 0x10000, 0x516b6c09, BRF_GRA }, // 19 Sprites - { "153_a19", 0x10000, 0x8caa2745, BRF_GRA }, // 20 Sprites - - { "el_ic39_gal16v8_0.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 21 PLDs - { "el_ic44_gal16v8_1.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 22 PLDs - { "el_ic54_gal16v8_2.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 23 PLDs - { "el_ic100_gal16v8_3.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 24 PLDs - { "el_ic143_gal16v8_4.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 25 PLDs -}; - -STD_ROM_PICK(Wc90b2) -STD_ROM_FN(Wc90b2) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Wc90b1Z80Rom1 = Next; Next += 0x20000; - Wc90b1Z80Rom2 = Next; Next += 0x20000; - Wc90b1Z80Rom3 = Next; Next += 0x10000; - - RamStart = Next; - - Wc90b1Z80Ram1 = Next; Next += 0x04000; - Wc90b1Z80Ram2 = Next; Next += 0x01800; - Wc90b1Z80Ram3 = Next; Next += 0x00800; - Wc90b1FgVideoRam = Next; Next += 0x01000; - Wc90b1BgVideoRam = Next; Next += 0x01000; - Wc90b1TextVideoRam = Next; Next += 0x01000; - Wc90b1SpriteRam = Next; Next += 0x00800; - Wc90b1PaletteRam = Next; Next += 0x00800; - Wc90b1SharedRam = Next; Next += 0x00400; - - RamEnd = Next; - - Wc90b1CharTiles = Next; Next += (2048 * 8 * 8); - Wc90b1Tiles = Next; Next += (4096 * 16 * 16); - Wc90b1Sprites = Next; Next += (4096 * 16 * 16); - Wc90b1Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 Wc90b1DoReset() -{ - Wc90b1Scroll0X = Wc90b1Scroll0Y = 0; - Wc90b1Scroll1X = Wc90b1Scroll1Y = 0; - Wc90b1ScrollXLo = 0; - - Wc90b1SoundLatch = 0; - Wc90b1MSM5205Next = 0; - - for (INT32 i = 0; i < 3; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - BurnYM2203Reset(); - MSM5205Reset(); - -// HiscoreReset(); - - return 0; -} - -UINT8 __fastcall Wc90b1Read1(UINT16 a) -{ - switch (a) { - case 0xfd00: { - return 0xff - Wc90b1Input[0]; - } - - case 0xfd02: { - return 0xff - Wc90b1Input[1]; - } - - case 0xfd06: { - return Wc90b1Dip[0]; - } - - case 0xfd08: { - return Wc90b1Dip[1]; - } - - case 0xfd0c: { - // ??? - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall Wc90b1Write1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xfc00: { - INT32 BankAddress; - - BankAddress = 0x10000 + ((d & 0xf8) << 8); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90b1Z80Rom1 + BankAddress); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90b1Z80Rom1 + BankAddress); - return; - } - - case 0xfd00: { - Wc90b1SoundLatch = d; - ZetClose(); - ZetOpen(2); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(0); - return; - } - - case 0xfd04: { - Wc90b1Scroll0Y = d; - return; - } - - case 0xfd06: { - Wc90b1Scroll0X = d; - return; - } - - case 0xfd08: { - Wc90b1Scroll1Y = d; - return; - } - - case 0xfd0a: { - Wc90b1Scroll1X = d; - return; - } - - case 0xfd0e: { - Wc90b1ScrollXLo = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Wc90b1Read2(UINT16 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall Wc90b1Write2(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xfc00: { - INT32 BankAddress; - - BankAddress = 0x10000 + ((d & 0xf8) << 8); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90b1Z80Rom2 + BankAddress); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90b1Z80Rom2 + BankAddress); - return; - } - - case 0xfd0c: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Wc90b1Read3(UINT16 a) -{ - switch (a) { - case 0xe800: { - return BurnYM2203Read(0, 0); - } - - case 0xf800: { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return Wc90b1SoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #3 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall Wc90b1Write3(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe000: { - INT32 BankAddress; - - BankAddress = 0x8000 + ((d & 0x01) * 0x4000); - ZetMapArea(0x8000, 0xbfff, 0, Wc90b1Z80Rom3 + BankAddress); - ZetMapArea(0x8000, 0xbfff, 2, Wc90b1Z80Rom3 + BankAddress); - - MSM5205ResetWrite(0, d & 0x08); - return; - } - - case 0xe400: { - Wc90b1MSM5205Next = d; - return; - } - - case 0xe800: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0xe801: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0xec00: - case 0xec01: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #3 Write => %04X, %02X\n"), a, d); - } - } -} - -inline static INT32 Wc90b1SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(double)ZetTotalCycles() * nSoundRate / 5000000; -} - -inline static double Wc90b1GetTime() -{ - return (double)ZetTotalCycles() / 5000000; -} - -static void Wc90b1MSM5205Vck0() -{ - static INT32 Toggle = 0; - - Toggle ^= 1; - - if (Toggle) { - MSM5205DataWrite(0, (Wc90b1MSM5205Next & 0xf0) >> 4); - ZetNmi(); - } else { - MSM5205DataWrite(0, Wc90b1MSM5205Next & 0x0f); - } -} - -static INT32 CharPlaneOffsets[4] = { 0, 0x20000, 0x40000, 0x60000 }; -static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 TilePlaneOffsets[4] = { 0, 0x100000, 0x200000, 0x300000 }; -static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 0x8000, 0x8001, 0x8002, 0x8003, 0x8004, 0x8005, 0x8006, 0x8007 }; -static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 0x4000, 0x4008, 0x4010, 0x4018, 0x4020, 0x4028, 0x4030, 0x4038 }; -static INT32 SpritePlaneOffsets[4] = { 0x300000, 0x200000, 0x100000, 0 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; - -static INT32 Wc90b1Init() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - Wc90b1TempGfx = (UINT8*)BurnMalloc(0x80000); - if (Wc90b1TempGfx == NULL) return 1; - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(Wc90b1Z80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1Z80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(Wc90b1Z80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1Z80Rom2 + 0x10000, 3, 1); if (nRet != 0) return 1; - - // Load Z80 #3 Program Rom - nRet = BurnLoadRom(Wc90b1Z80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load and Decode Char Tile Roms - memset(Wc90b1TempGfx, 0, 0x80000); - nRet = BurnLoadRom(Wc90b1TempGfx + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x04000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x08000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x0c000, 8, 1); if (nRet != 0) return 1; - GfxDecode(2048, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, Wc90b1TempGfx, Wc90b1CharTiles); - - // Load and Decode Tile Roms - memset(Wc90b1TempGfx, 0, 0x80000); - nRet = BurnLoadRom(Wc90b1TempGfx + 0x00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x20000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x40000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x60000, 12, 1); if (nRet != 0) return 1; - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x00000, Wc90b1Tiles + ( 0 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x02000, Wc90b1Tiles + ( 1 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x04000, Wc90b1Tiles + ( 2 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x06000, Wc90b1Tiles + ( 3 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x08000, Wc90b1Tiles + ( 4 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x0a000, Wc90b1Tiles + ( 5 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x0c000, Wc90b1Tiles + ( 6 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x0e000, Wc90b1Tiles + ( 7 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x10000, Wc90b1Tiles + ( 8 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x12000, Wc90b1Tiles + ( 9 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x14000, Wc90b1Tiles + (10 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x16000, Wc90b1Tiles + (11 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x18000, Wc90b1Tiles + (12 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x1a000, Wc90b1Tiles + (13 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x1c000, Wc90b1Tiles + (14 * 256 * 16 * 16)); - GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x1e000, Wc90b1Tiles + (15 * 256 * 16 * 16)); - - // Load and Decode Sprite Roms - memset(Wc90b1TempGfx, 0, 0x80000); - nRet = BurnLoadRom(Wc90b1TempGfx + 0x00000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x10000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x20000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x30000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x40000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x50000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x60000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Wc90b1TempGfx + 0x70000, 20, 1); if (nRet != 0) return 1; - for (INT32 i = 0; i < 0x80000; i++) { - Wc90b1TempGfx[i] ^= 0xff; - } - GfxDecode(4096, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, Wc90b1TempGfx, Wc90b1Sprites); - - BurnFree(Wc90b1TempGfx); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Wc90b1Read1); - ZetSetWriteHandler(Wc90b1Write1); - ZetMapArea(0x0000, 0x7fff, 0, Wc90b1Z80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, Wc90b1Z80Rom1 ); - ZetMapArea(0x8000, 0x9fff, 0, Wc90b1Z80Ram1 + 0x00000); - ZetMapArea(0x8000, 0x9fff, 1, Wc90b1Z80Ram1 + 0x00000); - ZetMapArea(0x8000, 0x9fff, 2, Wc90b1Z80Ram1 + 0x00000); - ZetMapArea(0xa000, 0xafff, 0, Wc90b1FgVideoRam ); - ZetMapArea(0xa000, 0xafff, 1, Wc90b1FgVideoRam ); - ZetMapArea(0xa000, 0xafff, 2, Wc90b1FgVideoRam ); - ZetMapArea(0xc000, 0xcfff, 0, Wc90b1BgVideoRam ); - ZetMapArea(0xc000, 0xcfff, 1, Wc90b1BgVideoRam ); - ZetMapArea(0xc000, 0xcfff, 2, Wc90b1BgVideoRam ); - ZetMapArea(0xd000, 0xdfff, 0, Wc90b1Z80Ram1 + 0x03000); - ZetMapArea(0xd000, 0xdfff, 1, Wc90b1Z80Ram1 + 0x03000); - ZetMapArea(0xd000, 0xdfff, 2, Wc90b1Z80Ram1 + 0x03000); - ZetMapArea(0xe000, 0xefff, 0, Wc90b1TextVideoRam ); - ZetMapArea(0xe000, 0xefff, 1, Wc90b1TextVideoRam ); - ZetMapArea(0xe000, 0xefff, 2, Wc90b1TextVideoRam ); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90b1Z80Rom1 + 0x10000); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90b1Z80Rom1 + 0x10000); - ZetMapArea(0xf800, 0xfbff, 0, Wc90b1SharedRam ); - ZetMapArea(0xf800, 0xfbff, 1, Wc90b1SharedRam ); - ZetMapArea(0xf800, 0xfbff, 2, Wc90b1SharedRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(Wc90b1Read2); - ZetSetWriteHandler(Wc90b1Write2); - ZetMapArea(0x0000, 0xbfff, 0, Wc90b1Z80Rom2 ); - ZetMapArea(0x0000, 0xbfff, 2, Wc90b1Z80Rom2 ); - ZetMapArea(0xc000, 0xcfff, 0, Wc90b1Z80Ram2 + 0x00000); - ZetMapArea(0xc000, 0xcfff, 1, Wc90b1Z80Ram2 + 0x00000); - ZetMapArea(0xc000, 0xcfff, 2, Wc90b1Z80Ram2 + 0x00000); - ZetMapArea(0xd000, 0xd7ff, 0, Wc90b1SpriteRam ); - ZetMapArea(0xd000, 0xd7ff, 1, Wc90b1SpriteRam ); - ZetMapArea(0xd000, 0xd7ff, 2, Wc90b1SpriteRam ); - ZetMapArea(0xd800, 0xdfff, 0, Wc90b1Z80Ram2 + 0x01000); - ZetMapArea(0xd800, 0xdfff, 1, Wc90b1Z80Ram2 + 0x01000); - ZetMapArea(0xd800, 0xdfff, 2, Wc90b1Z80Ram2 + 0x01000); - ZetMapArea(0xe000, 0xe7ff, 0, Wc90b1PaletteRam ); - ZetMapArea(0xe000, 0xe7ff, 1, Wc90b1PaletteRam ); - ZetMapArea(0xe000, 0xe7ff, 2, Wc90b1PaletteRam ); - ZetMapArea(0xe800, 0xefff, 0, Wc90b1Z80Rom2 + 0x0e800); - ZetMapArea(0xe800, 0xefff, 2, Wc90b1Z80Rom2 + 0x0e800); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90b1Z80Rom2 + 0x10000); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90b1Z80Rom2 + 0x10000); - ZetMapArea(0xf800, 0xfbff, 0, Wc90b1SharedRam ); - ZetMapArea(0xf800, 0xfbff, 1, Wc90b1SharedRam ); - ZetMapArea(0xf800, 0xfbff, 2, Wc90b1SharedRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(2); - ZetOpen(2); - ZetSetReadHandler(Wc90b1Read3); - ZetSetWriteHandler(Wc90b1Write3); - ZetMapArea(0x0000, 0x7fff, 0, Wc90b1Z80Rom3 ); - ZetMapArea(0x0000, 0x7fff, 2, Wc90b1Z80Rom3 ); - ZetMapArea(0x8000, 0xbfff, 0, Wc90b1Z80Rom3 + 0x8000 ); - ZetMapArea(0x8000, 0xbfff, 2, Wc90b1Z80Rom3 + 0x8000 ); - ZetMapArea(0xf000, 0xf7ff, 0, Wc90b1Z80Ram3 ); - ZetMapArea(0xf000, 0xf7ff, 1, Wc90b1Z80Ram3 ); - ZetMapArea(0xf000, 0xf7ff, 2, Wc90b1Z80Ram3 ); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - - BurnYM2203Init(1, 1250000, NULL, Wc90b1SynchroniseStream, Wc90b1GetTime, 0); - BurnTimerAttachZet(5000000); - BurnYM2203SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); - - MSM5205Init(0, Wc90b1SynchroniseStream, 384000, Wc90b1MSM5205Vck0, MSM5205_S96_4B, 1); - MSM5205SetRoute(0, 0.30, BURN_SND_ROUTE_BOTH); - - Wc90b1DoReset(); - - return 0; -} - -static INT32 Wc90b1Exit() -{ - ZetExit(); - GenericTilesExit(); - BurnYM2203Exit(); - MSM5205Exit(); - - BurnFree(Mem); - - Wc90b1Scroll0X = Wc90b1Scroll0Y = 0; - Wc90b1Scroll1X = Wc90b1Scroll1Y = 0; - Wc90b1ScrollXLo = 0; - Wc90b1SoundLatch = 0; - Wc90b1MSM5205Next = 0; - - return 0; -} - -static void Wc90b1RenderBgLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = Wc90b1BgVideoRam[TileIndex]; - Code = Wc90b1BgVideoRam[TileIndex + 0x800]; - Colour = Attr >> 4; - - Code |= ((Attr & 3) + ((Attr >> 1) & 4)) * 256; - Code |= 2048; - - x = 16 * mx; - y = 16 * my; - - x -= 8 * (Wc90b1Scroll1X & 0x7f) + 256 - 4 + (Wc90b1ScrollXLo & 0x07); - y -= Wc90b1Scroll1Y + 1 + ((Wc90b1Scroll1X & 0x80) ? 256 : 0); - - x &= 0x3ff; - y &= 0x1ff; - - y -= 16; - if (x > 968) x -= 1024; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 768, Wc90b1Tiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 768, Wc90b1Tiles); - } - - TileIndex++; - } - } -} - -static void Wc90b1RenderFgLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = Wc90b1FgVideoRam[TileIndex]; - Code = Wc90b1FgVideoRam[TileIndex + 0x800]; - Colour = Attr >> 4; - - Code |= ((Attr & 3) + ((Attr >> 1) & 4)) * 256; - - x = 16 * mx; - y = 16 * my; - - x -= 8 * (Wc90b1Scroll0X & 0x7f) + 256 - 6 + ((Wc90b1ScrollXLo & 0x38) >> 3); - y -= Wc90b1Scroll0Y + 1 + ((Wc90b1Scroll0X & 0x80) ? 256 : 0); - - x &= 0x3ff; - y &= 0x1ff; - - y -= 16; - if (x > 968) x -= 1024; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 15, 512, Wc90b1Tiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 512, Wc90b1Tiles); - } - - TileIndex++; - } - } -} - -static void Wc90b1RenderCharLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Code = Wc90b1TextVideoRam[TileIndex + 0x800] + ((Wc90b1TextVideoRam[TileIndex] & 0x07) << 8); - Colour = Wc90b1TextVideoRam[TileIndex] >> 4; - - x = 8 * mx; - y = 8 * my; - - x &= 0x1ff; - y &= 0x0ff; - - y -= 16; - - if (x > 7 && x < 248 && y > 7 && y < 216) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 15, 256, Wc90b1CharTiles); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 256, Wc90b1CharTiles); - } - - TileIndex++; - } - } -} - -static void Wc90b1RenderSpriteLayer(INT32 Priority) -{ - INT32 Offset, sx, sy; - - for (Offset = 0x800 - 8; Offset >= 0; Offset -= 8) { - if ((~(Wc90b1SpriteRam[Offset + 3] >> 7) & 1) == Priority) { - INT32 Code = (Wc90b1SpriteRam[Offset + 3] & 0x3f) << 4; - INT32 Bank = Wc90b1SpriteRam[Offset + 0]; - INT32 Flags = Wc90b1SpriteRam[Offset + 4]; - INT32 xFlip = Bank & 0x01; - INT32 yFlip = Bank & 0x02; - - Code += (Bank & 0xf0) >> 4; - Code <<= 2; - Code += (Bank & 0x0f) >> 2; - - sx = Wc90b1SpriteRam[Offset + 2]; - if (!(Wc90b1SpriteRam[Offset + 3] & 0x40)) sx -= 0x100; - - sy = 240 - Wc90b1SpriteRam[Offset + 1]; - - sy -= 16; - - if (sx > 15 && sx < 240 && sy > 15 && sy < 208) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); - } else { - Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); - } - } - } - } - } -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour >> 0) & 0x0f; - g = (nColour >> 4) & 0x0f; - b = (nColour >> 8) & 0x0f; - - r = (r << 4) | r; - g = (g << 4) | g; - b = (b << 4) | b; - - return BurnHighCol(r, g, b, 0); -} - -static INT32 Wc90b1CalcPalette() -{ - INT32 i; - - for (i = 0; i < 0x800; i++) { - Wc90b1Palette[i / 2] = CalcCol(Wc90b1PaletteRam[i | 1] | (Wc90b1PaletteRam[i & ~1] << 8)); - } - - return 0; -} - -static void Wc90b1Draw() -{ - BurnTransferClear(); - Wc90b1CalcPalette(); - Wc90b1RenderBgLayer(); - Wc90b1RenderFgLayer(); - Wc90b1RenderSpriteLayer(1); - Wc90b1RenderCharLayer(); - Wc90b1RenderSpriteLayer(0); - BurnTransferCopy(Wc90b1Palette); -} - -static INT32 Wc90b1Frame() -{ - INT32 nInterleave = MSM5205CalcInterleave(0, 5000000); - INT32 nVBlankIRQFire = (INT32)((double)242 / 260 * nInterleave); - - if (Wc90b1Reset) Wc90b1DoReset(); - - Wc90b1MakeInputs(); - - nCyclesTotal[0] = (INT32)((INT64)7159090 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = (INT32)((INT64)7159090 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[2] = (INT32)(double)(5000000 / 60); - - nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext, nCurrentCPU; - - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == nVBlankIRQFire) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == nVBlankIRQFire + 1) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == nVBlankIRQFire) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == nVBlankIRQFire + 1) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - nCurrentCPU = 2; - ZetOpen(nCurrentCPU); - BurnTimerUpdate(i * (nCyclesTotal[2] / nInterleave)); - MSM5205Update(); - ZetClose(); - } - - ZetOpen(2); - BurnTimerEndFrame(nCyclesTotal[2]); - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - if (pBurnDraw) Wc90b1Draw(); - - return 0; -} - -static INT32 Wc90b1Scan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029709; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - - SCAN_VAR(Wc90b1SoundLatch); - SCAN_VAR(Wc90b1MSM5205Next); - SCAN_VAR(Wc90b1Input); - SCAN_VAR(Wc90b1Dip); - SCAN_VAR(Wc90b1Scroll0Y); - SCAN_VAR(Wc90b1Scroll0X); - SCAN_VAR(Wc90b1Scroll1Y); - SCAN_VAR(Wc90b1Scroll1X); - SCAN_VAR(Wc90b1ScrollXLo); - } - - return 0; -} - -struct BurnDriver BurnDrvWc90b1 = { - "wc90b1", "wc90", NULL, NULL, "1989", - "Euro League (Italian hack of Tecmo World Cup '90)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, - NULL, Wc90b1RomInfo, Wc90b1RomName, NULL, NULL, Wc90b1InputInfo, Wc90b1DIPInfo, - Wc90b1Init, Wc90b1Exit, Wc90b1Frame, NULL, Wc90b1Scan, - NULL, 0x400, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWc90b2 = { - "wc90b2", "wc90", NULL, NULL, "1989", - "World Cup '90 (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, - NULL, Wc90b2RomInfo, Wc90b2RomName, NULL, NULL, Wc90b1InputInfo, Wc90b1DIPInfo, - Wc90b1Init, Wc90b1Exit, Wc90b1Frame, NULL, Wc90b1Scan, - NULL, 0x400, 256, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2203.h" +#include "msm5205.h" + +static UINT8 Wc90b1InputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 Wc90b1InputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 Wc90b1Dip[2] = {0, 0}; +static UINT8 Wc90b1Input[2] = {0x00, 0x00}; +static UINT8 Wc90b1Reset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Wc90b1Z80Rom1 = NULL; +static UINT8 *Wc90b1Z80Rom2 = NULL; +static UINT8 *Wc90b1Z80Rom3 = NULL; +static UINT8 *Wc90b1Z80Ram1 = NULL; +static UINT8 *Wc90b1Z80Ram2 = NULL; +static UINT8 *Wc90b1Z80Ram3 = NULL; +static UINT8 *Wc90b1FgVideoRam = NULL; +static UINT8 *Wc90b1BgVideoRam = NULL; +static UINT8 *Wc90b1TextVideoRam = NULL; +static UINT8 *Wc90b1SpriteRam = NULL; +static UINT8 *Wc90b1PaletteRam = NULL; +static UINT8 *Wc90b1SharedRam = NULL; +static UINT32 *Wc90b1Palette = NULL; +static UINT8 *Wc90b1CharTiles = NULL; +static UINT8 *Wc90b1Tiles = NULL; +static UINT8 *Wc90b1Sprites = NULL; +static UINT8 *Wc90b1TempGfx = NULL; + +static UINT8 Wc90b1Scroll0Y; +static UINT8 Wc90b1Scroll0X; +static UINT8 Wc90b1Scroll1Y; +static UINT8 Wc90b1Scroll1X; +static UINT8 Wc90b1ScrollXLo; + +static UINT8 Wc90b1SoundLatch = 0; +static INT32 Wc90b1MSM5205Next; + +static INT32 nCyclesDone[3], nCyclesTotal[3]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo Wc90b1InputList[] = { + {"Coin 1" , BIT_DIGITAL , Wc90b1InputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , Wc90b1InputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , Wc90b1InputPort1 + 7, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , Wc90b1InputPort1 + 6, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , Wc90b1InputPort0 + 3, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , Wc90b1InputPort0 + 2, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , Wc90b1InputPort0 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , Wc90b1InputPort0 + 0, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , Wc90b1InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , Wc90b1InputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , Wc90b1InputPort1 + 3, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , Wc90b1InputPort1 + 2, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , Wc90b1InputPort1 + 1, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , Wc90b1InputPort1 + 0, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , Wc90b1InputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , Wc90b1InputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &Wc90b1Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, Wc90b1Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, Wc90b1Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Wc90b1) + +inline static void Wc90b1ClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +inline static void Wc90b1MakeInputs() +{ + Wc90b1Input[0] = Wc90b1Input[1] = 0x00; + + for (INT32 i = 0; i < 8; i++) { + Wc90b1Input[0] |= (Wc90b1InputPort0[i] & 1) << i; + Wc90b1Input[1] |= (Wc90b1InputPort1[i] & 1) << i; + } + + Wc90b1ClearOpposites(&Wc90b1Input[0]); + Wc90b1ClearOpposites(&Wc90b1Input[1]); +} + +static struct BurnDIPInfo Wc90b1DIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 16 , "Coinage" }, + {0x11, 0x01, 0x0f, 0x00, "10 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x08, " 9 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x04, " 8 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x0c, " 7 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x02, " 6 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x0a, " 5 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x06, " 4 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x0e, " 3 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x01, " 2 Coins 3 Credits" }, + {0x11, 0x01, 0x0f, 0x09, " 2 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x0f, " 1 Coin 1 Credit" }, + {0x11, 0x01, 0x0f, 0x07, " 1 Coin 2 Credits" }, + {0x11, 0x01, 0x0f, 0x0b, " 1 Coin 3 Credits" }, + {0x11, 0x01, 0x0f, 0x03, " 1 Coin 4 Credits" }, + {0x11, 0x01, 0x0f, 0x0d, " 1 Coin 5 Credits" }, + {0x11, 0x01, 0x0f, 0x05, " 1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x30, 0x30, "Easy" }, + {0x11, 0x01, 0x30, 0x10, "Normal" }, + {0x11, 0x01, 0x30, 0x20, "Hard" }, + {0x11, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Countdown Speed" }, + {0x11, 0x01, 0x40, 0x40, "Normal" }, + {0x11, 0x01, 0x40, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x80, 0x00, "Off" }, + {0x11, 0x01, 0x80, 0x80, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "1 Player Game Time" }, + {0x12, 0x01, 0x03, 0x01, "1:00" }, + {0x12, 0x01, 0x03, 0x02, "1:30" }, + {0x12, 0x01, 0x03, 0x03, "2:00" }, + {0x12, 0x01, 0x03, 0x00, "2:30" }, + + {0 , 0xfe, 0 , 8 , "2 Players Game Time" }, + {0x12, 0x01, 0x1c, 0x0c, "1:00" }, + {0x12, 0x01, 0x1c, 0x14, "1:30" }, + {0x12, 0x01, 0x1c, 0x04, "2:00" }, + {0x12, 0x01, 0x1c, 0x18, "2:30" }, + {0x12, 0x01, 0x1c, 0x1c, "3:00" }, + {0x12, 0x01, 0x1c, 0x08, "3:30" }, + {0x12, 0x01, 0x1c, 0x10, "4:00" }, + {0x12, 0x01, 0x1c, 0x00, "5:00" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x12, 0x01, 0x80, 0x00, "English" }, + {0x12, 0x01, 0x80, 0x80, "Japanese" }, +}; + +STDDIPINFO(Wc90b1) + +static struct BurnRomInfo Wc90b1RomDesc[] = { + { "a02.bin", 0x10000, 0x192a03dd, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a03.bin", 0x10000, 0xf54ff17a, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "a04.bin", 0x10000, 0x3d535e2f, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + { "a05.bin", 0x10000, 0x9e421c4b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "a01.bin", 0x10000, 0x3d317622, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code + + { "a06.bin", 0x04000, 0x3b5387b7, BRF_GRA }, // 5 Characters + { "a08.bin", 0x04000, 0xc622a5a3, BRF_GRA }, // 6 Characters + { "a10.bin", 0x04000, 0x0923d9f6, BRF_GRA }, // 7 Characters + { "a20.bin", 0x04000, 0xb8dec83e, BRF_GRA }, // 8 Characters + { "a07.bin", 0x20000, 0x38c31817, BRF_GRA }, // 9 Fg Tiles + { "a09.bin", 0x20000, 0x32e39e29, BRF_GRA }, // 10 Fg Tiles + { "a11.bin", 0x20000, 0x5ccec796, BRF_GRA }, // 11 Bg Tiles + { "a21.bin", 0x20000, 0x0c54a091, BRF_GRA }, // 12 Bg Tiles + { "146_a12.bin", 0x10000, 0xd5a60096, BRF_GRA }, // 13 Sprites + { "147_a13.bin", 0x10000, 0x36bbf467, BRF_GRA }, // 14 Sprites + { "148_a14.bin", 0x10000, 0x26371c18, BRF_GRA }, // 15 Sprites + { "149_a15.bin", 0x10000, 0x75aa9b86, BRF_GRA }, // 16 Sprites + { "150_a16.bin", 0x10000, 0x0da825f9, BRF_GRA }, // 17 Sprites + { "151_a17.bin", 0x10000, 0x228429d8, BRF_GRA }, // 18 Sprites + { "152_a18.bin", 0x10000, 0x516b6c09, BRF_GRA }, // 19 Sprites + { "153_a19.bin", 0x10000, 0xf36390a9, BRF_GRA }, // 20 Sprites + + { "el_ic39_gal16v8_0.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 21 PLDs + { "el_ic44_gal16v8_1.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 22 PLDs + { "el_ic54_gal16v8_2.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 23 PLDs + { "el_ic100_gal16v8_3.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 24 PLDs + { "el_ic143_gal16v8_4.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 25 PLDs +}; + +STD_ROM_PICK(Wc90b1) +STD_ROM_FN(Wc90b1) + +static struct BurnRomInfo Wc90b2RomDesc[] = { + { "a02", 0x10000, 0x1e6e94c9, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a03.bin", 0x10000, 0xf54ff17a, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "a04.bin", 0x10000, 0x3d535e2f, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + { "a05.bin", 0x10000, 0x9e421c4b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "a01.bin", 0x10000, 0x3d317622, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program Code + + { "a06", 0x08000, 0x0c054481, BRF_GRA }, // 5 Characters + { "a08", 0x08000, 0xebb3eb48, BRF_GRA }, // 6 Characters + { "a10", 0x08000, 0xc0232af8, BRF_GRA }, // 7 Characters + { "a20", 0x08000, 0xa36e17fb, BRF_GRA }, // 8 Characters + { "a07.bin", 0x20000, 0x38c31817, BRF_GRA }, // 9 Fg Tiles + { "a09.bin", 0x20000, 0x32e39e29, BRF_GRA }, // 10 Fg Tiles + { "a11.bin", 0x20000, 0x5ccec796, BRF_GRA }, // 11 Bg Tiles + { "a21.bin", 0x20000, 0x0c54a091, BRF_GRA }, // 12 Bg Tiles + { "146_a12.bin", 0x10000, 0xd5a60096, BRF_GRA }, // 13 Sprites + { "147_a13", 0x10000, 0x5b16fd48, BRF_GRA }, // 14 Sprites + { "148_a14.bin", 0x10000, 0x26371c18, BRF_GRA }, // 15 Sprites + { "149_a15", 0x10000, 0xb2423962, BRF_GRA }, // 16 Sprites + { "150_a16.bin", 0x10000, 0x0da825f9, BRF_GRA }, // 17 Sprites + { "151_a17", 0x10000, 0xaf98778e, BRF_GRA }, // 18 Sprites + { "152_a18.bin", 0x10000, 0x516b6c09, BRF_GRA }, // 19 Sprites + { "153_a19", 0x10000, 0x8caa2745, BRF_GRA }, // 20 Sprites + + { "el_ic39_gal16v8_0.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 21 PLDs + { "el_ic44_gal16v8_1.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 22 PLDs + { "el_ic54_gal16v8_2.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 23 PLDs + { "el_ic100_gal16v8_3.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 24 PLDs + { "el_ic143_gal16v8_4.bin", 0x00117, 0x00000000, BRF_OPT | BRF_NODUMP }, // 25 PLDs +}; + +STD_ROM_PICK(Wc90b2) +STD_ROM_FN(Wc90b2) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Wc90b1Z80Rom1 = Next; Next += 0x20000; + Wc90b1Z80Rom2 = Next; Next += 0x20000; + Wc90b1Z80Rom3 = Next; Next += 0x10000; + + RamStart = Next; + + Wc90b1Z80Ram1 = Next; Next += 0x04000; + Wc90b1Z80Ram2 = Next; Next += 0x01800; + Wc90b1Z80Ram3 = Next; Next += 0x00800; + Wc90b1FgVideoRam = Next; Next += 0x01000; + Wc90b1BgVideoRam = Next; Next += 0x01000; + Wc90b1TextVideoRam = Next; Next += 0x01000; + Wc90b1SpriteRam = Next; Next += 0x00800; + Wc90b1PaletteRam = Next; Next += 0x00800; + Wc90b1SharedRam = Next; Next += 0x00400; + + RamEnd = Next; + + Wc90b1CharTiles = Next; Next += (2048 * 8 * 8); + Wc90b1Tiles = Next; Next += (4096 * 16 * 16); + Wc90b1Sprites = Next; Next += (4096 * 16 * 16); + Wc90b1Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 Wc90b1DoReset() +{ + Wc90b1Scroll0X = Wc90b1Scroll0Y = 0; + Wc90b1Scroll1X = Wc90b1Scroll1Y = 0; + Wc90b1ScrollXLo = 0; + + Wc90b1SoundLatch = 0; + Wc90b1MSM5205Next = 0; + + for (INT32 i = 0; i < 3; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + BurnYM2203Reset(); + MSM5205Reset(); + +// HiscoreReset(); + + return 0; +} + +UINT8 __fastcall Wc90b1Read1(UINT16 a) +{ + switch (a) { + case 0xfd00: { + return 0xff - Wc90b1Input[0]; + } + + case 0xfd02: { + return 0xff - Wc90b1Input[1]; + } + + case 0xfd06: { + return Wc90b1Dip[0]; + } + + case 0xfd08: { + return Wc90b1Dip[1]; + } + + case 0xfd0c: { + // ??? + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall Wc90b1Write1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xfc00: { + INT32 BankAddress; + + BankAddress = 0x10000 + ((d & 0xf8) << 8); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90b1Z80Rom1 + BankAddress); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90b1Z80Rom1 + BankAddress); + return; + } + + case 0xfd00: { + Wc90b1SoundLatch = d; + ZetClose(); + ZetOpen(2); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(0); + return; + } + + case 0xfd04: { + Wc90b1Scroll0Y = d; + return; + } + + case 0xfd06: { + Wc90b1Scroll0X = d; + return; + } + + case 0xfd08: { + Wc90b1Scroll1Y = d; + return; + } + + case 0xfd0a: { + Wc90b1Scroll1X = d; + return; + } + + case 0xfd0e: { + Wc90b1ScrollXLo = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Wc90b1Read2(UINT16 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall Wc90b1Write2(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xfc00: { + INT32 BankAddress; + + BankAddress = 0x10000 + ((d & 0xf8) << 8); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90b1Z80Rom2 + BankAddress); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90b1Z80Rom2 + BankAddress); + return; + } + + case 0xfd0c: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Wc90b1Read3(UINT16 a) +{ + switch (a) { + case 0xe800: { + return BurnYM2203Read(0, 0); + } + + case 0xf800: { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return Wc90b1SoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #3 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall Wc90b1Write3(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe000: { + INT32 BankAddress; + + BankAddress = 0x8000 + ((d & 0x01) * 0x4000); + ZetMapArea(0x8000, 0xbfff, 0, Wc90b1Z80Rom3 + BankAddress); + ZetMapArea(0x8000, 0xbfff, 2, Wc90b1Z80Rom3 + BankAddress); + + MSM5205ResetWrite(0, d & 0x08); + return; + } + + case 0xe400: { + Wc90b1MSM5205Next = d; + return; + } + + case 0xe800: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0xe801: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0xec00: + case 0xec01: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #3 Write => %04X, %02X\n"), a, d); + } + } +} + +inline static INT32 Wc90b1SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(double)ZetTotalCycles() * nSoundRate / 5000000; +} + +inline static double Wc90b1GetTime() +{ + return (double)ZetTotalCycles() / 5000000; +} + +static void Wc90b1MSM5205Vck0() +{ + static INT32 Toggle = 0; + + Toggle ^= 1; + + if (Toggle) { + MSM5205DataWrite(0, (Wc90b1MSM5205Next & 0xf0) >> 4); + ZetNmi(); + } else { + MSM5205DataWrite(0, Wc90b1MSM5205Next & 0x0f); + } +} + +static INT32 CharPlaneOffsets[4] = { 0, 0x20000, 0x40000, 0x60000 }; +static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 TilePlaneOffsets[4] = { 0, 0x100000, 0x200000, 0x300000 }; +static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 0x8000, 0x8001, 0x8002, 0x8003, 0x8004, 0x8005, 0x8006, 0x8007 }; +static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 0x4000, 0x4008, 0x4010, 0x4018, 0x4020, 0x4028, 0x4030, 0x4038 }; +static INT32 SpritePlaneOffsets[4] = { 0x300000, 0x200000, 0x100000, 0 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; + +static INT32 Wc90b1Init() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + Wc90b1TempGfx = (UINT8*)BurnMalloc(0x80000); + if (Wc90b1TempGfx == NULL) return 1; + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(Wc90b1Z80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1Z80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(Wc90b1Z80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1Z80Rom2 + 0x10000, 3, 1); if (nRet != 0) return 1; + + // Load Z80 #3 Program Rom + nRet = BurnLoadRom(Wc90b1Z80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load and Decode Char Tile Roms + memset(Wc90b1TempGfx, 0, 0x80000); + nRet = BurnLoadRom(Wc90b1TempGfx + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x04000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x08000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x0c000, 8, 1); if (nRet != 0) return 1; + GfxDecode(2048, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, Wc90b1TempGfx, Wc90b1CharTiles); + + // Load and Decode Tile Roms + memset(Wc90b1TempGfx, 0, 0x80000); + nRet = BurnLoadRom(Wc90b1TempGfx + 0x00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x20000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x40000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x60000, 12, 1); if (nRet != 0) return 1; + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x00000, Wc90b1Tiles + ( 0 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x02000, Wc90b1Tiles + ( 1 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x04000, Wc90b1Tiles + ( 2 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x06000, Wc90b1Tiles + ( 3 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x08000, Wc90b1Tiles + ( 4 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x0a000, Wc90b1Tiles + ( 5 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x0c000, Wc90b1Tiles + ( 6 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x0e000, Wc90b1Tiles + ( 7 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x10000, Wc90b1Tiles + ( 8 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x12000, Wc90b1Tiles + ( 9 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x14000, Wc90b1Tiles + (10 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x16000, Wc90b1Tiles + (11 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x18000, Wc90b1Tiles + (12 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x1a000, Wc90b1Tiles + (13 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x1c000, Wc90b1Tiles + (14 * 256 * 16 * 16)); + GfxDecode(256, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, Wc90b1TempGfx + 0x1e000, Wc90b1Tiles + (15 * 256 * 16 * 16)); + + // Load and Decode Sprite Roms + memset(Wc90b1TempGfx, 0, 0x80000); + nRet = BurnLoadRom(Wc90b1TempGfx + 0x00000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x10000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x20000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x30000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x40000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x50000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x60000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Wc90b1TempGfx + 0x70000, 20, 1); if (nRet != 0) return 1; + for (INT32 i = 0; i < 0x80000; i++) { + Wc90b1TempGfx[i] ^= 0xff; + } + GfxDecode(4096, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, Wc90b1TempGfx, Wc90b1Sprites); + + BurnFree(Wc90b1TempGfx); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Wc90b1Read1); + ZetSetWriteHandler(Wc90b1Write1); + ZetMapArea(0x0000, 0x7fff, 0, Wc90b1Z80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, Wc90b1Z80Rom1 ); + ZetMapArea(0x8000, 0x9fff, 0, Wc90b1Z80Ram1 + 0x00000); + ZetMapArea(0x8000, 0x9fff, 1, Wc90b1Z80Ram1 + 0x00000); + ZetMapArea(0x8000, 0x9fff, 2, Wc90b1Z80Ram1 + 0x00000); + ZetMapArea(0xa000, 0xafff, 0, Wc90b1FgVideoRam ); + ZetMapArea(0xa000, 0xafff, 1, Wc90b1FgVideoRam ); + ZetMapArea(0xa000, 0xafff, 2, Wc90b1FgVideoRam ); + ZetMapArea(0xc000, 0xcfff, 0, Wc90b1BgVideoRam ); + ZetMapArea(0xc000, 0xcfff, 1, Wc90b1BgVideoRam ); + ZetMapArea(0xc000, 0xcfff, 2, Wc90b1BgVideoRam ); + ZetMapArea(0xd000, 0xdfff, 0, Wc90b1Z80Ram1 + 0x03000); + ZetMapArea(0xd000, 0xdfff, 1, Wc90b1Z80Ram1 + 0x03000); + ZetMapArea(0xd000, 0xdfff, 2, Wc90b1Z80Ram1 + 0x03000); + ZetMapArea(0xe000, 0xefff, 0, Wc90b1TextVideoRam ); + ZetMapArea(0xe000, 0xefff, 1, Wc90b1TextVideoRam ); + ZetMapArea(0xe000, 0xefff, 2, Wc90b1TextVideoRam ); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90b1Z80Rom1 + 0x10000); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90b1Z80Rom1 + 0x10000); + ZetMapArea(0xf800, 0xfbff, 0, Wc90b1SharedRam ); + ZetMapArea(0xf800, 0xfbff, 1, Wc90b1SharedRam ); + ZetMapArea(0xf800, 0xfbff, 2, Wc90b1SharedRam ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(Wc90b1Read2); + ZetSetWriteHandler(Wc90b1Write2); + ZetMapArea(0x0000, 0xbfff, 0, Wc90b1Z80Rom2 ); + ZetMapArea(0x0000, 0xbfff, 2, Wc90b1Z80Rom2 ); + ZetMapArea(0xc000, 0xcfff, 0, Wc90b1Z80Ram2 + 0x00000); + ZetMapArea(0xc000, 0xcfff, 1, Wc90b1Z80Ram2 + 0x00000); + ZetMapArea(0xc000, 0xcfff, 2, Wc90b1Z80Ram2 + 0x00000); + ZetMapArea(0xd000, 0xd7ff, 0, Wc90b1SpriteRam ); + ZetMapArea(0xd000, 0xd7ff, 1, Wc90b1SpriteRam ); + ZetMapArea(0xd000, 0xd7ff, 2, Wc90b1SpriteRam ); + ZetMapArea(0xd800, 0xdfff, 0, Wc90b1Z80Ram2 + 0x01000); + ZetMapArea(0xd800, 0xdfff, 1, Wc90b1Z80Ram2 + 0x01000); + ZetMapArea(0xd800, 0xdfff, 2, Wc90b1Z80Ram2 + 0x01000); + ZetMapArea(0xe000, 0xe7ff, 0, Wc90b1PaletteRam ); + ZetMapArea(0xe000, 0xe7ff, 1, Wc90b1PaletteRam ); + ZetMapArea(0xe000, 0xe7ff, 2, Wc90b1PaletteRam ); + ZetMapArea(0xe800, 0xefff, 0, Wc90b1Z80Rom2 + 0x0e800); + ZetMapArea(0xe800, 0xefff, 2, Wc90b1Z80Rom2 + 0x0e800); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90b1Z80Rom2 + 0x10000); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90b1Z80Rom2 + 0x10000); + ZetMapArea(0xf800, 0xfbff, 0, Wc90b1SharedRam ); + ZetMapArea(0xf800, 0xfbff, 1, Wc90b1SharedRam ); + ZetMapArea(0xf800, 0xfbff, 2, Wc90b1SharedRam ); + ZetClose(); + + ZetInit(2); + ZetOpen(2); + ZetSetReadHandler(Wc90b1Read3); + ZetSetWriteHandler(Wc90b1Write3); + ZetMapArea(0x0000, 0x7fff, 0, Wc90b1Z80Rom3 ); + ZetMapArea(0x0000, 0x7fff, 2, Wc90b1Z80Rom3 ); + ZetMapArea(0x8000, 0xbfff, 0, Wc90b1Z80Rom3 + 0x8000 ); + ZetMapArea(0x8000, 0xbfff, 2, Wc90b1Z80Rom3 + 0x8000 ); + ZetMapArea(0xf000, 0xf7ff, 0, Wc90b1Z80Ram3 ); + ZetMapArea(0xf000, 0xf7ff, 1, Wc90b1Z80Ram3 ); + ZetMapArea(0xf000, 0xf7ff, 2, Wc90b1Z80Ram3 ); + ZetClose(); + + GenericTilesInit(); + + BurnYM2203Init(1, 1250000, NULL, Wc90b1SynchroniseStream, Wc90b1GetTime, 0); + BurnTimerAttachZet(5000000); + BurnYM2203SetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH); + + MSM5205Init(0, Wc90b1SynchroniseStream, 384000, Wc90b1MSM5205Vck0, MSM5205_S96_4B, 1); + MSM5205SetRoute(0, 0.30, BURN_SND_ROUTE_BOTH); + + Wc90b1DoReset(); + + return 0; +} + +static INT32 Wc90b1Exit() +{ + ZetExit(); + GenericTilesExit(); + BurnYM2203Exit(); + MSM5205Exit(); + + BurnFree(Mem); + + Wc90b1Scroll0X = Wc90b1Scroll0Y = 0; + Wc90b1Scroll1X = Wc90b1Scroll1Y = 0; + Wc90b1ScrollXLo = 0; + Wc90b1SoundLatch = 0; + Wc90b1MSM5205Next = 0; + + return 0; +} + +static void Wc90b1RenderBgLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = Wc90b1BgVideoRam[TileIndex]; + Code = Wc90b1BgVideoRam[TileIndex + 0x800]; + Colour = Attr >> 4; + + Code |= ((Attr & 3) + ((Attr >> 1) & 4)) * 256; + Code |= 2048; + + x = 16 * mx; + y = 16 * my; + + x -= 8 * (Wc90b1Scroll1X & 0x7f) + 256 - 4 + (Wc90b1ScrollXLo & 0x07); + y -= Wc90b1Scroll1Y + 1 + ((Wc90b1Scroll1X & 0x80) ? 256 : 0); + + x &= 0x3ff; + y &= 0x1ff; + + y -= 16; + if (x > 968) x -= 1024; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 768, Wc90b1Tiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 768, Wc90b1Tiles); + } + + TileIndex++; + } + } +} + +static void Wc90b1RenderFgLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = Wc90b1FgVideoRam[TileIndex]; + Code = Wc90b1FgVideoRam[TileIndex + 0x800]; + Colour = Attr >> 4; + + Code |= ((Attr & 3) + ((Attr >> 1) & 4)) * 256; + + x = 16 * mx; + y = 16 * my; + + x -= 8 * (Wc90b1Scroll0X & 0x7f) + 256 - 6 + ((Wc90b1ScrollXLo & 0x38) >> 3); + y -= Wc90b1Scroll0Y + 1 + ((Wc90b1Scroll0X & 0x80) ? 256 : 0); + + x &= 0x3ff; + y &= 0x1ff; + + y -= 16; + if (x > 968) x -= 1024; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 15, 512, Wc90b1Tiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 512, Wc90b1Tiles); + } + + TileIndex++; + } + } +} + +static void Wc90b1RenderCharLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Code = Wc90b1TextVideoRam[TileIndex + 0x800] + ((Wc90b1TextVideoRam[TileIndex] & 0x07) << 8); + Colour = Wc90b1TextVideoRam[TileIndex] >> 4; + + x = 8 * mx; + y = 8 * my; + + x &= 0x1ff; + y &= 0x0ff; + + y -= 16; + + if (x > 7 && x < 248 && y > 7 && y < 216) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 15, 256, Wc90b1CharTiles); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 15, 256, Wc90b1CharTiles); + } + + TileIndex++; + } + } +} + +static void Wc90b1RenderSpriteLayer(INT32 Priority) +{ + INT32 Offset, sx, sy; + + for (Offset = 0x800 - 8; Offset >= 0; Offset -= 8) { + if ((~(Wc90b1SpriteRam[Offset + 3] >> 7) & 1) == Priority) { + INT32 Code = (Wc90b1SpriteRam[Offset + 3] & 0x3f) << 4; + INT32 Bank = Wc90b1SpriteRam[Offset + 0]; + INT32 Flags = Wc90b1SpriteRam[Offset + 4]; + INT32 xFlip = Bank & 0x01; + INT32 yFlip = Bank & 0x02; + + Code += (Bank & 0xf0) >> 4; + Code <<= 2; + Code += (Bank & 0x0f) >> 2; + + sx = Wc90b1SpriteRam[Offset + 2]; + if (!(Wc90b1SpriteRam[Offset + 3] & 0x40)) sx -= 0x100; + + sy = 240 - Wc90b1SpriteRam[Offset + 1]; + + sy -= 16; + + if (sx > 15 && sx < 240 && sy > 15 && sy < 208) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); + } else { + Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Flags >> 4, 4, 15, 0, Wc90b1Sprites); + } + } + } + } + } +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour >> 0) & 0x0f; + g = (nColour >> 4) & 0x0f; + b = (nColour >> 8) & 0x0f; + + r = (r << 4) | r; + g = (g << 4) | g; + b = (b << 4) | b; + + return BurnHighCol(r, g, b, 0); +} + +static INT32 Wc90b1CalcPalette() +{ + INT32 i; + + for (i = 0; i < 0x800; i++) { + Wc90b1Palette[i / 2] = CalcCol(Wc90b1PaletteRam[i | 1] | (Wc90b1PaletteRam[i & ~1] << 8)); + } + + return 0; +} + +static void Wc90b1Draw() +{ + BurnTransferClear(); + Wc90b1CalcPalette(); + Wc90b1RenderBgLayer(); + Wc90b1RenderFgLayer(); + Wc90b1RenderSpriteLayer(1); + Wc90b1RenderCharLayer(); + Wc90b1RenderSpriteLayer(0); + BurnTransferCopy(Wc90b1Palette); +} + +static INT32 Wc90b1Frame() +{ + INT32 nInterleave = MSM5205CalcInterleave(0, 5000000); + INT32 nVBlankIRQFire = (INT32)((double)242 / 260 * nInterleave); + + if (Wc90b1Reset) Wc90b1DoReset(); + + Wc90b1MakeInputs(); + + nCyclesTotal[0] = (INT32)((INT64)7159090 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = (INT32)((INT64)7159090 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[2] = (INT32)(double)(5000000 / 60); + + nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext, nCurrentCPU; + + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == nVBlankIRQFire) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == nVBlankIRQFire + 1) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == nVBlankIRQFire) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == nVBlankIRQFire + 1) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + nCurrentCPU = 2; + ZetOpen(nCurrentCPU); + BurnTimerUpdate(i * (nCyclesTotal[2] / nInterleave)); + MSM5205Update(); + ZetClose(); + } + + ZetOpen(2); + BurnTimerEndFrame(nCyclesTotal[2]); + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + if (pBurnDraw) Wc90b1Draw(); + + return 0; +} + +static INT32 Wc90b1Scan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029709; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + + SCAN_VAR(Wc90b1SoundLatch); + SCAN_VAR(Wc90b1MSM5205Next); + SCAN_VAR(Wc90b1Input); + SCAN_VAR(Wc90b1Dip); + SCAN_VAR(Wc90b1Scroll0Y); + SCAN_VAR(Wc90b1Scroll0X); + SCAN_VAR(Wc90b1Scroll1Y); + SCAN_VAR(Wc90b1Scroll1X); + SCAN_VAR(Wc90b1ScrollXLo); + } + + return 0; +} + +struct BurnDriver BurnDrvWc90b1 = { + "wc90b1", "wc90", NULL, NULL, "1989", + "Euro League (Italian hack of Tecmo World Cup '90)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, + NULL, Wc90b1RomInfo, Wc90b1RomName, NULL, NULL, Wc90b1InputInfo, Wc90b1DIPInfo, + Wc90b1Init, Wc90b1Exit, Wc90b1Frame, NULL, Wc90b1Scan, + NULL, 0x400, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWc90b2 = { + "wc90b2", "wc90", NULL, NULL, "1989", + "World Cup '90 (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSFOOTBALL, 0, + NULL, Wc90b2RomInfo, Wc90b2RomName, NULL, NULL, Wc90b1InputInfo, Wc90b1DIPInfo, + Wc90b1Init, Wc90b1Exit, Wc90b1Frame, NULL, Wc90b1Scan, + NULL, 0x400, 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pre90s/d_wwfsstar.cpp b/src/burn/drv/pre90s/d_wwfsstar.cpp index 4ba47dfe9..1b478ca64 100644 --- a/src/burn/drv/pre90s/d_wwfsstar.cpp +++ b/src/burn/drv/pre90s/d_wwfsstar.cpp @@ -1,1014 +1,1013 @@ -// FB Alpha WWF Superstars driver module -// Based on MAME driver by David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvFgRAM; -static UINT8 *DrvBgRAM; - -static UINT32 *DrvPalette; - -static UINT8 *soundlatch; -static UINT8 *flipscreen; -static UINT16 *scroll; - -static UINT16 DrvInputs[3]; -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; - -static INT32 vblank = 0; - -static struct BurnInputInfo WwfsstarInputList[] = { - {"Start 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"Start 2", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"Start 3", BIT_DIGITAL, DrvJoy2 + 6, "p3 start" }, - - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p1 coin" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"} , - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p2 coin" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 3, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Wwfsstar) - -static struct BurnDIPInfo WwfsstarDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0x07, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x01, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Normal" }, - {0x14, 0x01, 0x03, 0x02, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x04, 0x00, "Off" }, - {0x14, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2, "Super Techniques" }, - {0x14, 0x01, 0x08, 0x08, "Normal" }, - {0x14, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 4, "Time" }, - {0x14, 0x01, 0x30, 0x20, "+2:30" }, - {0x14, 0x01, 0x30, 0x30, "Default" }, - {0x14, 0x01, 0x30, 0x10, "-2:30" }, - {0x14, 0x01, 0x30, 0x00, "-5:00" }, - - {0 , 0xfe, 0 , 2, "Health For Winning" }, - {0x14, 0x01, 0x80, 0x80, "No" }, - {0x14, 0x01, 0x80, 0x00, "Yes" }, -}; - -STDDIPINFO(Wwfsstar) - -void __fastcall wwfsstar_main_write_byte(UINT32 , UINT8 ) -{ - -} - -void __fastcall wwfsstar_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x180000: - SekSetIRQLine(6, SEK_IRQSTATUS_NONE); - return; - - case 0x180002: - SekSetIRQLine(5, SEK_IRQSTATUS_NONE); - return; - - case 0x180004: - scroll[0] = data & 0x1ff; - return; - - case 0x180006: - scroll[1] = data & 0x1ff; - return; - - case 0x180008: - *soundlatch = data; - ZetNmi(); - return; - - case 0x18000a: - *flipscreen = data & 1; - return; - } -} - -UINT8 __fastcall wwfsstar_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x180003: - return DrvDips[1]; - - case 0x180004: - return DrvInputs[0] >> 8; - - case 0x180005: - return DrvInputs[0]; - - case 0x180006: - return DrvInputs[1] >> 8; - - case 0x180007: - return DrvInputs[1]; - - case 0x180008: - return DrvInputs[2] >> 8; - - case 0x180009: - return (DrvInputs[2] & 0xfe) | vblank; - } - - return 0; -} - -UINT16 __fastcall wwfsstar_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x180000: - return 0xff00 | DrvDips[0]; - - case 0x180002: - return 0xff00 | DrvDips[1]; - - case 0x180004: - return DrvInputs[0]; - - case 0x180006: - return DrvInputs[1]; - - case 0x180008: - return (DrvInputs[2] & 0xfffe) | vblank; - } - - return 0; -} - -void __fastcall wwfsstar_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8800: - BurnYM2151SelectRegister(data); - return; - - case 0x8801: - BurnYM2151WriteRegister(data); - return; - - case 0x9800: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall wwfsstar_sound_read(UINT16 address) -{ - switch (address) - { - case 0x8800: - case 0x8801: - return BurnYM2151ReadStatus(); - - case 0x9800: - return MSM6295ReadStatus(0); - - case 0xa000: - return *soundlatch; - } - - return 0; -} - -static void DrvYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - MSM6295Reset(0); - - vblank = 1; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x040000; - DrvGfxROM1 = Next; Next += 0x400000; - DrvGfxROM2 = Next; Next += 0x100000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x180 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x004000; - DrvZ80RAM = Next; Next += 0x000800; - - DrvSprRAM = Next; Next += 0x000400; - DrvPalRAM = Next; Next += 0x001000; - DrvFgRAM = Next; Next += 0x001000; - DrvBgRAM = Next; Next += 0x001000; - - soundlatch = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - - scroll = (UINT16*)Next; Next += 2 * sizeof(UINT16); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x000000, 0x000002, 0x000004, 0x000006 }; - INT32 Plane1[4] = { 0x800000, 0x800004, 0x000000, 0x000004 }; - INT32 Plane2[4] = { 0x200000, 0x200004, 0x000000, 0x000004 }; - - INT32 XOffs0[8] = { 0x001, 0x000, 0x041, 0x040, 0x081, 0x080, 0x0c1, 0x0c0 }; - INT32 YOffs[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, - 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; - INT32 XOffs1[16] = { 0x003, 0x002, 0x001, 0x000, 0x083, 0x082, 0x081, 0x080, - 0x103, 0x102, 0x101, 0x100, 0x183, 0x182, 0x181, 0x180 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x200000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x020000); - - GfxDecode(0x1000, 4, 8, 8, Plane0, XOffs0, YOffs, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x200000); - - GfxDecode(0x4000, 4, 16, 16, Plane1, XOffs1, YOffs, 0x200, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x080000); - - GfxDecode(0x1000, 4, 16, 16, Plane2, XOffs1, YOffs, 0x200, tmp, DrvGfxROM2); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (strcmp(BurnDrvGetTextA(DRV_NAME), "wwfsstara") == 0) { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x020000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x1c0000, 11, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x040000, 13, 1)) return 1; - } else { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x020000, 4, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x030000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x010000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x030000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x050000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x070000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 15, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x090000, 16, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0a0000, 17, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0b0000, 18, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 19, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0d0000, 20, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0e0000, 21, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0f0000, 22, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 23, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x110000, 24, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x120000, 25, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x130000, 26, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x140000, 27, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x150000, 28, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x160000, 29, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x170000, 30, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 31, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x190000, 32, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x1a0000, 33, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x1b0000, 34, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x1c0000, 35, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x1d0000, 36, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x1e0000, 37, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x1f0000, 38, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 39, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x010000, 40, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x020000, 41, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x030000, 42, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x040000, 43, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x050000, 44, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x060000, 45, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x070000, 46, 1)) return 1; - } - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvFgRAM, 0x080000, 0x080fff, SM_RAM); - SekMapMemory(DrvBgRAM, 0x0c0000, 0x0c0fff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x100000, 0x1003ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x140000, 0x140fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x1c0000, 0x1c3fff, SM_RAM); - SekSetReadWordHandler(0, wwfsstar_main_read_word); - SekSetReadByteHandler(0, wwfsstar_main_read_byte); - SekSetWriteWordHandler(0, wwfsstar_main_write_word); - SekSetWriteByteHandler(0, wwfsstar_main_write_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(wwfsstar_sound_write); - ZetSetReadHandler(wwfsstar_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT); - - MSM6295Init(0, 1056000 / 132, 1); - MSM6295SetRoute(0, 0.47, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - SekExit(); - ZetExit(); - - MSM6295Exit(0); - BurnYM2151Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_fg_layer() -{ - UINT16 *vram = (UINT16*)DrvFgRAM; - - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - INT32 attr = vram[(offs * 2) + 0]; - INT32 code = (vram[(offs * 2) + 1] & 0xff) | ((attr & 0x0f) << 8); - INT32 color = (attr & 0xf0) >> 4; - - if (*flipscreen) { - sy = (sy ^ 0xf8) - 16; - sx = sx ^ 0xf8; - - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } - } -} - -static void draw_bg_layer() -{ - UINT16 *vram = (UINT16*)DrvBgRAM; - - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 row = offs >> 5; - INT32 col = offs & 0x1f; - - INT32 sx = col << 4; - INT32 sy = row << 4; - - sx -= scroll[0]; - if (sx < -15) sx += 512; - sy -= scroll[1]; - if (sy < -15) sy += 512; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 ofst = (col & 0x0f) | ((row & 0x0f) << 4) | ((col & 0x10) << 4) | ((row & 0x10) << 5); - - INT32 attr = vram[(ofst * 2) + 0]; - INT32 code = (vram[(ofst * 2) + 1] & 0xff) | ((attr & 0x0f) << 8); - INT32 color = (attr & 0x70) >> 4; - INT32 flipx = attr & 0x80; - - if (*flipscreen) { - sy = (240 - sy) - 16; - sx = 240 - sx; - - if (flipx) { - Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, DrvGfxROM2); // 0 transparent? - } else { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, DrvGfxROM2); // 0 transparent? - } - } else { - if (flipx) { - Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, DrvGfxROM2); // 0 transparent? - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, DrvGfxROM2); // 0 transparent? - } - } - } -} - -static void draw_sprites() -{ - UINT16 *source = (UINT16*)DrvSprRAM; - UINT16 *finish = source + 0x3ff / 2; - - while (source < finish) - { - if (source[1] & 0x0001) - { - INT32 ypos = (source[0] & 0xff) | ((source[1] & 0x04) << 6); - INT32 xpos = (source[4] & 0xff) | ((source[1] & 0x08) << 5); - INT32 flipx = (source[2] & 0x80 ) >> 7; - INT32 flipy = (source[2] & 0x40 ) >> 6; - INT32 chain = (source[1] & 0x02 ) >> 1; - INT32 number = (source[3] & 0xff) | ((source[2] & 0x3f) << 8); - INT32 color = ((source[1] & 0xf0) + 0x80) >> 4; - - ypos = (((256 - ypos) & 0x1ff) - 16) ; - xpos = (((256 - xpos) & 0x1ff) - 16); - chain += 1; - number &= ~(chain - 1); - - if (*flipscreen) - { - flipy = !flipy; - flipx = !flipx; - ypos = 240 - ypos; - xpos = 240 - xpos; - ypos -= 16; - } - - for (INT32 count = 0; count < chain; count++) - { - INT32 yy = ypos; - - if (*flipscreen) { - if (flipy) { - yy += (16*(chain-1))-(16*count); - } else { - yy += 16 * count; - } - } else { - if (flipy) { - yy -= 16 * count; - } else { - yy -= (16*(chain-1))-(16*count); - } - } - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, number+count, xpos, yy, color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, number+count, xpos, yy, color, 4, 0, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, number+count, xpos, yy, color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, number+count, xpos, yy, color, 4, 0, 0, DrvGfxROM1); - } - } - } - } - - source+=5; - } -} - -static void DrvPaletteRecalculate() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x180; i++) { - r = (p[i] >> 0) & 0x0f; - b = (p[i] >> 8) & 0x0f; - g = (p[i] >> 4) & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static INT32 DrvDraw() -{ - DrvPaletteRecalculate(); - - draw_bg_layer(); - - draw_sprites(); - - draw_fg_layer(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static inline void interrupt(INT32 scanline) -{ - if (scanline == 0) vblank = 0; - if (scanline == (240-1)) vblank = 1; - if ((scanline & 0x0f) == 0) SekSetIRQLine(5, SEK_IRQSTATUS_ACK); - if (scanline == 240) SekSetIRQLine(6, SEK_IRQSTATUS_ACK); -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3 * sizeof(INT16)); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= DrvJoy1[i] << i; - DrvInputs[1] ^= DrvJoy2[i] << i; - DrvInputs[2] ^= DrvJoy3[i] << i; - } - } - - INT32 nInterleave = 256; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 10000000 / 60, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nSegment; - - nSegment = nCyclesTotal[0] / nInterleave; - nCyclesDone[0] += SekRun(nSegment); - if (i >= 8 && i <= 248) interrupt(i - 8); - - nSegment = nCyclesTotal[1] / nInterleave; - nCyclesDone[1] += ZetRun(nSegment); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0,pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0,pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029706; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - - SCAN_VAR(vblank); - } - - return 0; -} - - -// WWF Superstars (Europe) - -static struct BurnRomInfo wwfsstarRomDesc[] = { - { "24ac-0_j-1.34", 0x20000, 0xec8fd2c9, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "24ad-0_j-1.35", 0x20000, 0x54e614e4, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b.12", 0x08000, 0x1e44f8aa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "24a9.46", 0x20000, 0x703ff08f, 3 | BRF_SND }, // 3 oki - { "wwfs03.bin", 0x10000, 0x8a35a20e, 3 | BRF_SND }, // 4 - { "wwfs05.bin", 0x10000, 0x6df08962, 3 | BRF_SND }, // 5 - - { "24a4-0.58", 0x20000, 0xcb12ba40, 4 | BRF_GRA }, // 6 Characters - - { "wwfs39.bin", 0x10000, 0xd807b09a, 5 | BRF_GRA }, // 7 Sprites - { "wwfs38.bin", 0x10000, 0xd8ea94d3, 5 | BRF_GRA }, // 8 - { "wwfs37.bin", 0x10000, 0x5e8d7407, 5 | BRF_GRA }, // 9 - { "wwfs36.bin", 0x10000, 0x9005e942, 5 | BRF_GRA }, // 10 - { "wwfs43.bin", 0x10000, 0xaafc4a38, 5 | BRF_GRA }, // 11 - { "wwfs42.bin", 0x10000, 0xe48b88fb, 5 | BRF_GRA }, // 12 - { "wwfs41.bin", 0x10000, 0xed7f69d5, 5 | BRF_GRA }, // 13 - { "wwfs40.bin", 0x10000, 0x4d75fd89, 5 | BRF_GRA }, // 14 - { "wwfs19.bin", 0x10000, 0x7426d444, 5 | BRF_GRA }, // 15 - { "wwfs18.bin", 0x10000, 0xaf11ad2a, 5 | BRF_GRA }, // 16 - { "wwfs17.bin", 0x10000, 0xef12069f, 5 | BRF_GRA }, // 17 - { "wwfs16.bin", 0x10000, 0x08343e7f, 5 | BRF_GRA }, // 18 - { "wwfs15.bin", 0x10000, 0xaac5a928, 5 | BRF_GRA }, // 19 - { "wwfs14.bin", 0x10000, 0x67eb7bea, 5 | BRF_GRA }, // 20 - { "wwfs13.bin", 0x10000, 0x970b6e76, 5 | BRF_GRA }, // 21 - { "wwfs12.bin", 0x10000, 0x242caff5, 5 | BRF_GRA }, // 22 - { "wwfs27.bin", 0x10000, 0xf3eb8ab9, 5 | BRF_GRA }, // 23 - { "wwfs26.bin", 0x10000, 0x2ca91eaf, 5 | BRF_GRA }, // 24 - { "wwfs25.bin", 0x10000, 0xbbf69c6a, 5 | BRF_GRA }, // 25 - { "wwfs24.bin", 0x10000, 0x76b08bcd, 5 | BRF_GRA }, // 26 - { "wwfs23.bin", 0x10000, 0x681f5b5e, 5 | BRF_GRA }, // 27 - { "wwfs22.bin", 0x10000, 0x81fe1bf7, 5 | BRF_GRA }, // 28 - { "wwfs21.bin", 0x10000, 0xc52eee5e, 5 | BRF_GRA }, // 29 - { "wwfs20.bin", 0x10000, 0xb2a8050e, 5 | BRF_GRA }, // 30 - { "wwfs35.bin", 0x10000, 0x9d648d82, 5 | BRF_GRA }, // 31 - { "wwfs34.bin", 0x10000, 0x742a79db, 5 | BRF_GRA }, // 32 - { "wwfs33.bin", 0x10000, 0xf6923db6, 5 | BRF_GRA }, // 33 - { "wwfs32.bin", 0x10000, 0x9becd621, 5 | BRF_GRA }, // 34 - { "wwfs31.bin", 0x10000, 0xf94c74d5, 5 | BRF_GRA }, // 35 - { "wwfs30.bin", 0x10000, 0x94094518, 5 | BRF_GRA }, // 36 - { "wwfs29.bin", 0x10000, 0x7b5b9d83, 5 | BRF_GRA }, // 37 - { "wwfs28.bin", 0x10000, 0x70fda626, 5 | BRF_GRA }, // 38 - - { "wwfs51.bin", 0x10000, 0x51157385, 6 | BRF_GRA }, // 39 Tiles - { "wwfs50.bin", 0x10000, 0x7fc79df5, 6 | BRF_GRA }, // 40 - { "wwfs49.bin", 0x10000, 0xa14076b0, 6 | BRF_GRA }, // 41 - { "wwfs48.bin", 0x10000, 0x251372fd, 6 | BRF_GRA }, // 42 - { "wwfs47.bin", 0x10000, 0x6fd7b6ea, 6 | BRF_GRA }, // 43 - { "wwfs46.bin", 0x10000, 0x985e5180, 6 | BRF_GRA }, // 44 - { "wwfs45.bin", 0x10000, 0xb2fad792, 6 | BRF_GRA }, // 45 - { "wwfs44.bin", 0x10000, 0x4f965fa9, 6 | BRF_GRA }, // 46 -}; - -STD_ROM_PICK(wwfsstar) -STD_ROM_FN(wwfsstar) - -struct BurnDriver BurnDrvWwfsstar = { - "wwfsstar", NULL, NULL, NULL, "1989", - "WWF Superstars (Europe)\0", NULL, "Technos Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, - NULL, wwfsstarRomInfo, wwfsstarRomName, NULL, NULL, WwfsstarInputInfo, WwfsstarDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x180, - 256, 240, 4, 3 -}; - - -// WWF Superstars (US) - -static struct BurnRomInfo wwfsstaruRomDesc[] = { - { "24ac-04.34", 0x20000, 0xee9b850e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "24ad-04.35", 0x20000, 0x057c2eef, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b.12", 0x08000, 0x1e44f8aa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "24a9.46", 0x20000, 0x703ff08f, 3 | BRF_SND }, // 3 oki - { "wwfs03.bin", 0x10000, 0x8a35a20e, 3 | BRF_SND }, // 4 - { "wwfs05.bin", 0x10000, 0x6df08962, 3 | BRF_SND }, // 5 - - { "24a4-0.58", 0x20000, 0xcb12ba40, 4 | BRF_GRA }, // 6 Characters - - { "wwfs39.bin", 0x10000, 0xd807b09a, 5 | BRF_GRA }, // 7 Sprites - { "wwfs38.bin", 0x10000, 0xd8ea94d3, 5 | BRF_GRA }, // 8 - { "wwfs37.bin", 0x10000, 0x5e8d7407, 5 | BRF_GRA }, // 9 - { "wwfs36.bin", 0x10000, 0x9005e942, 5 | BRF_GRA }, // 10 - { "wwfs43.bin", 0x10000, 0xaafc4a38, 5 | BRF_GRA }, // 11 - { "wwfs42.bin", 0x10000, 0xe48b88fb, 5 | BRF_GRA }, // 12 - { "wwfs41.bin", 0x10000, 0xed7f69d5, 5 | BRF_GRA }, // 13 - { "wwfs40.bin", 0x10000, 0x4d75fd89, 5 | BRF_GRA }, // 14 - { "wwfs19.bin", 0x10000, 0x7426d444, 5 | BRF_GRA }, // 15 - { "wwfs18.bin", 0x10000, 0xaf11ad2a, 5 | BRF_GRA }, // 16 - { "wwfs17.bin", 0x10000, 0xef12069f, 5 | BRF_GRA }, // 17 - { "wwfs16.bin", 0x10000, 0x08343e7f, 5 | BRF_GRA }, // 18 - { "wwfs15.bin", 0x10000, 0xaac5a928, 5 | BRF_GRA }, // 19 - { "wwfs14.bin", 0x10000, 0x67eb7bea, 5 | BRF_GRA }, // 20 - { "wwfs13.bin", 0x10000, 0x970b6e76, 5 | BRF_GRA }, // 21 - { "wwfs12.bin", 0x10000, 0x242caff5, 5 | BRF_GRA }, // 22 - { "wwfs27.bin", 0x10000, 0xf3eb8ab9, 5 | BRF_GRA }, // 23 - { "wwfs26.bin", 0x10000, 0x2ca91eaf, 5 | BRF_GRA }, // 24 - { "wwfs25.bin", 0x10000, 0xbbf69c6a, 5 | BRF_GRA }, // 25 - { "wwfs24.bin", 0x10000, 0x76b08bcd, 5 | BRF_GRA }, // 26 - { "wwfs23.bin", 0x10000, 0x681f5b5e, 5 | BRF_GRA }, // 27 - { "wwfs22.bin", 0x10000, 0x81fe1bf7, 5 | BRF_GRA }, // 28 - { "wwfs21.bin", 0x10000, 0xc52eee5e, 5 | BRF_GRA }, // 29 - { "wwfs20.bin", 0x10000, 0xb2a8050e, 5 | BRF_GRA }, // 30 - { "wwfs35.bin", 0x10000, 0x9d648d82, 5 | BRF_GRA }, // 31 - { "wwfs34.bin", 0x10000, 0x742a79db, 5 | BRF_GRA }, // 32 - { "wwfs33.bin", 0x10000, 0xf6923db6, 5 | BRF_GRA }, // 33 - { "wwfs32.bin", 0x10000, 0x9becd621, 5 | BRF_GRA }, // 34 - { "wwfs31.bin", 0x10000, 0xf94c74d5, 5 | BRF_GRA }, // 35 - { "wwfs30.bin", 0x10000, 0x94094518, 5 | BRF_GRA }, // 36 - { "wwfs29.bin", 0x10000, 0x7b5b9d83, 5 | BRF_GRA }, // 37 - { "wwfs28.bin", 0x10000, 0x70fda626, 5 | BRF_GRA }, // 38 - - { "wwfs51.bin", 0x10000, 0x51157385, 6 | BRF_GRA }, // 39 Tiles - { "wwfs50.bin", 0x10000, 0x7fc79df5, 6 | BRF_GRA }, // 40 - { "wwfs49.bin", 0x10000, 0xa14076b0, 6 | BRF_GRA }, // 41 - { "wwfs48.bin", 0x10000, 0x251372fd, 6 | BRF_GRA }, // 42 - { "wwfs47.bin", 0x10000, 0x6fd7b6ea, 6 | BRF_GRA }, // 43 - { "wwfs46.bin", 0x10000, 0x985e5180, 6 | BRF_GRA }, // 44 - { "wwfs45.bin", 0x10000, 0xb2fad792, 6 | BRF_GRA }, // 45 - { "wwfs44.bin", 0x10000, 0x4f965fa9, 6 | BRF_GRA }, // 46 -}; - -STD_ROM_PICK(wwfsstaru) -STD_ROM_FN(wwfsstaru) - -struct BurnDriver BurnDrvWwfsstaru = { - "wwfsstaru", "wwfsstar", NULL, NULL, "1989", - "WWF Superstars (US)\0", NULL, "Technos Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, - NULL, wwfsstaruRomInfo, wwfsstaruRomName, NULL, NULL, WwfsstarInputInfo, WwfsstarDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x180, - 256, 240, 4, 3 -}; - - -// WWF Superstars (US, Newer) - -static struct BurnRomInfo wwfsstaraRomDesc[] = { - { "24ac-06.34", 0x20000, 0x924a50e4, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "24ad-07.35", 0x20000, 0x9a76a50e, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "24ab-0.12", 0x08000, 0x1e44f8aa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "24a9-0.46", 0x20000, 0x703ff08f, 3 | BRF_SND }, // 3 oki - { "24j8-0.45", 0x20000, 0x61138487, 3 | BRF_SND }, // 4 - - { "24aa-0.58", 0x20000, 0xcb12ba40, 4 | BRF_GRA }, // 5 Characters - - { "c951.114", 0x80000, 0xfa76d1f0, 5 | BRF_GRA }, // 6 Sprites - { "24j4-0.115", 0x40000, 0xc4a589a3, 5 | BRF_GRA }, // 7 - { "24j5-0.116", 0x40000, 0xd6bca436, 5 | BRF_GRA }, // 8 - { "c950.117", 0x80000, 0xcca5703d, 5 | BRF_GRA }, // 9 - { "24j2-0.118", 0x40000, 0xdc1b7600, 5 | BRF_GRA }, // 10 - { "24j3-0.119", 0x40000, 0x3ba12d43, 5 | BRF_GRA }, // 11 - - { "24j7-0.113", 0x40000, 0xe0a1909e, 6 | BRF_GRA }, // 12 Tiles - { "24j6-0.112", 0x40000, 0x77932ef8, 6 | BRF_GRA }, // 13 -}; - -STD_ROM_PICK(wwfsstara) -STD_ROM_FN(wwfsstara) - -struct BurnDriver BurnDrvWwfsstara = { - "wwfsstara", "wwfsstar", NULL, NULL, "1989", - "WWF Superstars (US, Newer)\0", NULL, "Technos Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, - NULL, wwfsstaraRomInfo, wwfsstaraRomName, NULL, NULL, WwfsstarInputInfo, WwfsstarDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x180, - 256, 240, 4, 3 -}; - - -// WWF Superstars (Japan) - -static struct BurnRomInfo wwfsstarjRomDesc[] = { - { "24ac-0_j-1_japan.34",0x20000, 0xf872e968, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "24ad-0_j-1_japan.35",0x20000, 0x00000000, 1 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 1 - - { "b.12", 0x08000, 0x1e44f8aa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "24a9.46", 0x20000, 0x703ff08f, 3 | BRF_SND }, // 3 oki - { "wwfs03.bin", 0x10000, 0x8a35a20e, 3 | BRF_SND }, // 4 - { "wwfs05.bin", 0x10000, 0x6df08962, 3 | BRF_SND }, // 5 - - { "24a4-0.58", 0x20000, 0xcb12ba40, 4 | BRF_GRA }, // 6 Characters - - { "wwfs39.bin", 0x10000, 0xd807b09a, 5 | BRF_GRA }, // 7 Sprites - { "wwfs38.bin", 0x10000, 0xd8ea94d3, 5 | BRF_GRA }, // 8 - { "wwfs37.bin", 0x10000, 0x5e8d7407, 5 | BRF_GRA }, // 9 - { "wwfs36.bin", 0x10000, 0x9005e942, 5 | BRF_GRA }, // 10 - { "wwfs43.bin", 0x10000, 0xaafc4a38, 5 | BRF_GRA }, // 11 - { "wwfs42.bin", 0x10000, 0xe48b88fb, 5 | BRF_GRA }, // 12 - { "wwfs41.bin", 0x10000, 0xed7f69d5, 5 | BRF_GRA }, // 13 - { "wwfs40.bin", 0x10000, 0x4d75fd89, 5 | BRF_GRA }, // 14 - { "wwfs19.bin", 0x10000, 0x7426d444, 5 | BRF_GRA }, // 15 - { "wwfs18.bin", 0x10000, 0xaf11ad2a, 5 | BRF_GRA }, // 16 - { "wwfs17.bin", 0x10000, 0xef12069f, 5 | BRF_GRA }, // 17 - { "wwfs16.bin", 0x10000, 0x08343e7f, 5 | BRF_GRA }, // 18 - { "wwfs15.bin", 0x10000, 0xaac5a928, 5 | BRF_GRA }, // 19 - { "wwfs14.bin", 0x10000, 0x67eb7bea, 5 | BRF_GRA }, // 20 - { "wwfs13.bin", 0x10000, 0x970b6e76, 5 | BRF_GRA }, // 21 - { "wwfs12.bin", 0x10000, 0x242caff5, 5 | BRF_GRA }, // 22 - { "wwfs27.bin", 0x10000, 0xf3eb8ab9, 5 | BRF_GRA }, // 23 - { "wwfs26.bin", 0x10000, 0x2ca91eaf, 5 | BRF_GRA }, // 24 - { "wwfs25.bin", 0x10000, 0xbbf69c6a, 5 | BRF_GRA }, // 25 - { "wwfs24.bin", 0x10000, 0x76b08bcd, 5 | BRF_GRA }, // 26 - { "wwfs23.bin", 0x10000, 0x681f5b5e, 5 | BRF_GRA }, // 27 - { "wwfs22.bin", 0x10000, 0x81fe1bf7, 5 | BRF_GRA }, // 28 - { "wwfs21.bin", 0x10000, 0xc52eee5e, 5 | BRF_GRA }, // 29 - { "wwfs20.bin", 0x10000, 0xb2a8050e, 5 | BRF_GRA }, // 30 - { "wwfs35.bin", 0x10000, 0x9d648d82, 5 | BRF_GRA }, // 31 - { "wwfs34.bin", 0x10000, 0x742a79db, 5 | BRF_GRA }, // 32 - { "wwfs33.bin", 0x10000, 0xf6923db6, 5 | BRF_GRA }, // 33 - { "wwfs32.bin", 0x10000, 0x9becd621, 5 | BRF_GRA }, // 34 - { "wwfs31.bin", 0x10000, 0xf94c74d5, 5 | BRF_GRA }, // 35 - { "wwfs30.bin", 0x10000, 0x94094518, 5 | BRF_GRA }, // 36 - { "wwfs29.bin", 0x10000, 0x7b5b9d83, 5 | BRF_GRA }, // 37 - { "wwfs28.bin", 0x10000, 0x70fda626, 5 | BRF_GRA }, // 38 - - { "wwfs51.bin", 0x10000, 0x51157385, 6 | BRF_GRA }, // 39 Tiles - { "wwfs50.bin", 0x10000, 0x7fc79df5, 6 | BRF_GRA }, // 40 - { "wwfs49.bin", 0x10000, 0xa14076b0, 6 | BRF_GRA }, // 41 - { "wwfs48.bin", 0x10000, 0x251372fd, 6 | BRF_GRA }, // 42 - { "wwfs47.bin", 0x10000, 0x6fd7b6ea, 6 | BRF_GRA }, // 43 - { "wwfs46.bin", 0x10000, 0x985e5180, 6 | BRF_GRA }, // 44 - { "wwfs45.bin", 0x10000, 0xb2fad792, 6 | BRF_GRA }, // 45 - { "wwfs44.bin", 0x10000, 0x4f965fa9, 6 | BRF_GRA }, // 46 -}; - -STD_ROM_PICK(wwfsstarj) -STD_ROM_FN(wwfsstarj) - -struct BurnDriverD BurnDrvWwfsstarj = { - "wwfsstarj", "wwfsstar", NULL, NULL, "1989", - "WWF Superstars (Japan)\0", "Missing program ROM", "Technos Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, - NULL, wwfsstarjRomInfo, wwfsstarjRomName, NULL, NULL, WwfsstarInputInfo, WwfsstarDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x180, - 256, 240, 4, 3 -}; +// FB Alpha WWF Superstars driver module +// Based on MAME driver by David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvFgRAM; +static UINT8 *DrvBgRAM; + +static UINT32 *DrvPalette; + +static UINT8 *soundlatch; +static UINT8 *flipscreen; +static UINT16 *scroll; + +static UINT16 DrvInputs[3]; +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; + +static INT32 vblank = 0; + +static struct BurnInputInfo WwfsstarInputList[] = { + {"Start 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"Start 2", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"Start 3", BIT_DIGITAL, DrvJoy2 + 6, "p3 start" }, + + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p1 coin" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"} , + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p2 coin" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 3, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Wwfsstar) + +static struct BurnDIPInfo WwfsstarDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0x07, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x01, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Normal" }, + {0x14, 0x01, 0x03, 0x02, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x04, 0x00, "Off" }, + {0x14, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2, "Super Techniques" }, + {0x14, 0x01, 0x08, 0x08, "Normal" }, + {0x14, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 4, "Time" }, + {0x14, 0x01, 0x30, 0x20, "+2:30" }, + {0x14, 0x01, 0x30, 0x30, "Default" }, + {0x14, 0x01, 0x30, 0x10, "-2:30" }, + {0x14, 0x01, 0x30, 0x00, "-5:00" }, + + {0 , 0xfe, 0 , 2, "Health For Winning" }, + {0x14, 0x01, 0x80, 0x80, "No" }, + {0x14, 0x01, 0x80, 0x00, "Yes" }, +}; + +STDDIPINFO(Wwfsstar) + +void __fastcall wwfsstar_main_write_byte(UINT32 , UINT8 ) +{ + +} + +void __fastcall wwfsstar_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x180000: + SekSetIRQLine(6, SEK_IRQSTATUS_NONE); + return; + + case 0x180002: + SekSetIRQLine(5, SEK_IRQSTATUS_NONE); + return; + + case 0x180004: + scroll[0] = data & 0x1ff; + return; + + case 0x180006: + scroll[1] = data & 0x1ff; + return; + + case 0x180008: + *soundlatch = data; + ZetNmi(); + return; + + case 0x18000a: + *flipscreen = data & 1; + return; + } +} + +UINT8 __fastcall wwfsstar_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x180003: + return DrvDips[1]; + + case 0x180004: + return DrvInputs[0] >> 8; + + case 0x180005: + return DrvInputs[0]; + + case 0x180006: + return DrvInputs[1] >> 8; + + case 0x180007: + return DrvInputs[1]; + + case 0x180008: + return DrvInputs[2] >> 8; + + case 0x180009: + return (DrvInputs[2] & 0xfe) | vblank; + } + + return 0; +} + +UINT16 __fastcall wwfsstar_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x180000: + return 0xff00 | DrvDips[0]; + + case 0x180002: + return 0xff00 | DrvDips[1]; + + case 0x180004: + return DrvInputs[0]; + + case 0x180006: + return DrvInputs[1]; + + case 0x180008: + return (DrvInputs[2] & 0xfffe) | vblank; + } + + return 0; +} + +void __fastcall wwfsstar_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8800: + BurnYM2151SelectRegister(data); + return; + + case 0x8801: + BurnYM2151WriteRegister(data); + return; + + case 0x9800: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall wwfsstar_sound_read(UINT16 address) +{ + switch (address) + { + case 0x8800: + case 0x8801: + return BurnYM2151ReadStatus(); + + case 0x9800: + return MSM6295ReadStatus(0); + + case 0xa000: + return *soundlatch; + } + + return 0; +} + +static void DrvYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + MSM6295Reset(0); + + vblank = 1; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x040000; + DrvGfxROM1 = Next; Next += 0x400000; + DrvGfxROM2 = Next; Next += 0x100000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x180 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x004000; + DrvZ80RAM = Next; Next += 0x000800; + + DrvSprRAM = Next; Next += 0x000400; + DrvPalRAM = Next; Next += 0x001000; + DrvFgRAM = Next; Next += 0x001000; + DrvBgRAM = Next; Next += 0x001000; + + soundlatch = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + + scroll = (UINT16*)Next; Next += 2 * sizeof(UINT16); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x000000, 0x000002, 0x000004, 0x000006 }; + INT32 Plane1[4] = { 0x800000, 0x800004, 0x000000, 0x000004 }; + INT32 Plane2[4] = { 0x200000, 0x200004, 0x000000, 0x000004 }; + + INT32 XOffs0[8] = { 0x001, 0x000, 0x041, 0x040, 0x081, 0x080, 0x0c1, 0x0c0 }; + INT32 YOffs[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, + 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; + INT32 XOffs1[16] = { 0x003, 0x002, 0x001, 0x000, 0x083, 0x082, 0x081, 0x080, + 0x103, 0x102, 0x101, 0x100, 0x183, 0x182, 0x181, 0x180 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x200000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x020000); + + GfxDecode(0x1000, 4, 8, 8, Plane0, XOffs0, YOffs, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x200000); + + GfxDecode(0x4000, 4, 16, 16, Plane1, XOffs1, YOffs, 0x200, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x080000); + + GfxDecode(0x1000, 4, 16, 16, Plane2, XOffs1, YOffs, 0x200, tmp, DrvGfxROM2); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (strcmp(BurnDrvGetTextA(DRV_NAME), "wwfsstara") == 0) { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x020000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x1c0000, 11, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x040000, 13, 1)) return 1; + } else { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x020000, 4, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x030000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x010000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x030000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x050000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x070000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 15, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x090000, 16, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0a0000, 17, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0b0000, 18, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 19, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0d0000, 20, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0e0000, 21, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0f0000, 22, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 23, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x110000, 24, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x120000, 25, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x130000, 26, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x140000, 27, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x150000, 28, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x160000, 29, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x170000, 30, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 31, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x190000, 32, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x1a0000, 33, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x1b0000, 34, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x1c0000, 35, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x1d0000, 36, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x1e0000, 37, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x1f0000, 38, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 39, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x010000, 40, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x020000, 41, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x030000, 42, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x040000, 43, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x050000, 44, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x060000, 45, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x070000, 46, 1)) return 1; + } + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvFgRAM, 0x080000, 0x080fff, SM_RAM); + SekMapMemory(DrvBgRAM, 0x0c0000, 0x0c0fff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x100000, 0x1003ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x140000, 0x140fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x1c0000, 0x1c3fff, SM_RAM); + SekSetReadWordHandler(0, wwfsstar_main_read_word); + SekSetReadByteHandler(0, wwfsstar_main_read_byte); + SekSetWriteWordHandler(0, wwfsstar_main_write_word); + SekSetWriteByteHandler(0, wwfsstar_main_write_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(wwfsstar_sound_write); + ZetSetReadHandler(wwfsstar_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT); + + MSM6295Init(0, 1056000 / 132, 1); + MSM6295SetRoute(0, 0.47, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + SekExit(); + ZetExit(); + + MSM6295Exit(0); + BurnYM2151Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_fg_layer() +{ + UINT16 *vram = (UINT16*)DrvFgRAM; + + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + INT32 attr = vram[(offs * 2) + 0]; + INT32 code = (vram[(offs * 2) + 1] & 0xff) | ((attr & 0x0f) << 8); + INT32 color = (attr & 0xf0) >> 4; + + if (*flipscreen) { + sy = (sy ^ 0xf8) - 16; + sx = sx ^ 0xf8; + + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } + } +} + +static void draw_bg_layer() +{ + UINT16 *vram = (UINT16*)DrvBgRAM; + + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 row = offs >> 5; + INT32 col = offs & 0x1f; + + INT32 sx = col << 4; + INT32 sy = row << 4; + + sx -= scroll[0]; + if (sx < -15) sx += 512; + sy -= scroll[1]; + if (sy < -15) sy += 512; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 ofst = (col & 0x0f) | ((row & 0x0f) << 4) | ((col & 0x10) << 4) | ((row & 0x10) << 5); + + INT32 attr = vram[(ofst * 2) + 0]; + INT32 code = (vram[(ofst * 2) + 1] & 0xff) | ((attr & 0x0f) << 8); + INT32 color = (attr & 0x70) >> 4; + INT32 flipx = attr & 0x80; + + if (*flipscreen) { + sy = (240 - sy) - 16; + sx = 240 - sx; + + if (flipx) { + Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, DrvGfxROM2); // 0 transparent? + } else { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, DrvGfxROM2); // 0 transparent? + } + } else { + if (flipx) { + Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, DrvGfxROM2); // 0 transparent? + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0x100, DrvGfxROM2); // 0 transparent? + } + } + } +} + +static void draw_sprites() +{ + UINT16 *source = (UINT16*)DrvSprRAM; + UINT16 *finish = source + 0x3ff / 2; + + while (source < finish) + { + if (source[1] & 0x0001) + { + INT32 ypos = (source[0] & 0xff) | ((source[1] & 0x04) << 6); + INT32 xpos = (source[4] & 0xff) | ((source[1] & 0x08) << 5); + INT32 flipx = (source[2] & 0x80 ) >> 7; + INT32 flipy = (source[2] & 0x40 ) >> 6; + INT32 chain = (source[1] & 0x02 ) >> 1; + INT32 number = (source[3] & 0xff) | ((source[2] & 0x3f) << 8); + INT32 color = ((source[1] & 0xf0) + 0x80) >> 4; + + ypos = (((256 - ypos) & 0x1ff) - 16) ; + xpos = (((256 - xpos) & 0x1ff) - 16); + chain += 1; + number &= ~(chain - 1); + + if (*flipscreen) + { + flipy = !flipy; + flipx = !flipx; + ypos = 240 - ypos; + xpos = 240 - xpos; + ypos -= 16; + } + + for (INT32 count = 0; count < chain; count++) + { + INT32 yy = ypos; + + if (*flipscreen) { + if (flipy) { + yy += (16*(chain-1))-(16*count); + } else { + yy += 16 * count; + } + } else { + if (flipy) { + yy -= 16 * count; + } else { + yy -= (16*(chain-1))-(16*count); + } + } + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, number+count, xpos, yy, color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, number+count, xpos, yy, color, 4, 0, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, number+count, xpos, yy, color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, number+count, xpos, yy, color, 4, 0, 0, DrvGfxROM1); + } + } + } + } + + source+=5; + } +} + +static void DrvPaletteRecalculate() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x180; i++) { + r = (p[i] >> 0) & 0x0f; + b = (p[i] >> 8) & 0x0f; + g = (p[i] >> 4) & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static INT32 DrvDraw() +{ + DrvPaletteRecalculate(); + + draw_bg_layer(); + + draw_sprites(); + + draw_fg_layer(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static inline void interrupt(INT32 scanline) +{ + if (scanline == 0) vblank = 0; + if (scanline == (240-1)) vblank = 1; + if ((scanline & 0x0f) == 0) SekSetIRQLine(5, SEK_IRQSTATUS_ACK); + if (scanline == 240) SekSetIRQLine(6, SEK_IRQSTATUS_ACK); +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3 * sizeof(INT16)); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= DrvJoy1[i] << i; + DrvInputs[1] ^= DrvJoy2[i] << i; + DrvInputs[2] ^= DrvJoy3[i] << i; + } + } + + INT32 nInterleave = 256; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 10000000 / 60, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nSegment; + + nSegment = nCyclesTotal[0] / nInterleave; + nCyclesDone[0] += SekRun(nSegment); + if (i >= 8 && i <= 248) interrupt(i - 8); + + nSegment = nCyclesTotal[1] / nInterleave; + nCyclesDone[1] += ZetRun(nSegment); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0,pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0,pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029706; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + + SCAN_VAR(vblank); + } + + return 0; +} + + +// WWF Superstars (Europe) + +static struct BurnRomInfo wwfsstarRomDesc[] = { + { "24ac-0_j-1.34", 0x20000, 0xec8fd2c9, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "24ad-0_j-1.35", 0x20000, 0x54e614e4, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b.12", 0x08000, 0x1e44f8aa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "24a9.46", 0x20000, 0x703ff08f, 3 | BRF_SND }, // 3 oki + { "wwfs03.bin", 0x10000, 0x8a35a20e, 3 | BRF_SND }, // 4 + { "wwfs05.bin", 0x10000, 0x6df08962, 3 | BRF_SND }, // 5 + + { "24a4-0.58", 0x20000, 0xcb12ba40, 4 | BRF_GRA }, // 6 Characters + + { "wwfs39.bin", 0x10000, 0xd807b09a, 5 | BRF_GRA }, // 7 Sprites + { "wwfs38.bin", 0x10000, 0xd8ea94d3, 5 | BRF_GRA }, // 8 + { "wwfs37.bin", 0x10000, 0x5e8d7407, 5 | BRF_GRA }, // 9 + { "wwfs36.bin", 0x10000, 0x9005e942, 5 | BRF_GRA }, // 10 + { "wwfs43.bin", 0x10000, 0xaafc4a38, 5 | BRF_GRA }, // 11 + { "wwfs42.bin", 0x10000, 0xe48b88fb, 5 | BRF_GRA }, // 12 + { "wwfs41.bin", 0x10000, 0xed7f69d5, 5 | BRF_GRA }, // 13 + { "wwfs40.bin", 0x10000, 0x4d75fd89, 5 | BRF_GRA }, // 14 + { "wwfs19.bin", 0x10000, 0x7426d444, 5 | BRF_GRA }, // 15 + { "wwfs18.bin", 0x10000, 0xaf11ad2a, 5 | BRF_GRA }, // 16 + { "wwfs17.bin", 0x10000, 0xef12069f, 5 | BRF_GRA }, // 17 + { "wwfs16.bin", 0x10000, 0x08343e7f, 5 | BRF_GRA }, // 18 + { "wwfs15.bin", 0x10000, 0xaac5a928, 5 | BRF_GRA }, // 19 + { "wwfs14.bin", 0x10000, 0x67eb7bea, 5 | BRF_GRA }, // 20 + { "wwfs13.bin", 0x10000, 0x970b6e76, 5 | BRF_GRA }, // 21 + { "wwfs12.bin", 0x10000, 0x242caff5, 5 | BRF_GRA }, // 22 + { "wwfs27.bin", 0x10000, 0xf3eb8ab9, 5 | BRF_GRA }, // 23 + { "wwfs26.bin", 0x10000, 0x2ca91eaf, 5 | BRF_GRA }, // 24 + { "wwfs25.bin", 0x10000, 0xbbf69c6a, 5 | BRF_GRA }, // 25 + { "wwfs24.bin", 0x10000, 0x76b08bcd, 5 | BRF_GRA }, // 26 + { "wwfs23.bin", 0x10000, 0x681f5b5e, 5 | BRF_GRA }, // 27 + { "wwfs22.bin", 0x10000, 0x81fe1bf7, 5 | BRF_GRA }, // 28 + { "wwfs21.bin", 0x10000, 0xc52eee5e, 5 | BRF_GRA }, // 29 + { "wwfs20.bin", 0x10000, 0xb2a8050e, 5 | BRF_GRA }, // 30 + { "wwfs35.bin", 0x10000, 0x9d648d82, 5 | BRF_GRA }, // 31 + { "wwfs34.bin", 0x10000, 0x742a79db, 5 | BRF_GRA }, // 32 + { "wwfs33.bin", 0x10000, 0xf6923db6, 5 | BRF_GRA }, // 33 + { "wwfs32.bin", 0x10000, 0x9becd621, 5 | BRF_GRA }, // 34 + { "wwfs31.bin", 0x10000, 0xf94c74d5, 5 | BRF_GRA }, // 35 + { "wwfs30.bin", 0x10000, 0x94094518, 5 | BRF_GRA }, // 36 + { "wwfs29.bin", 0x10000, 0x7b5b9d83, 5 | BRF_GRA }, // 37 + { "wwfs28.bin", 0x10000, 0x70fda626, 5 | BRF_GRA }, // 38 + + { "wwfs51.bin", 0x10000, 0x51157385, 6 | BRF_GRA }, // 39 Tiles + { "wwfs50.bin", 0x10000, 0x7fc79df5, 6 | BRF_GRA }, // 40 + { "wwfs49.bin", 0x10000, 0xa14076b0, 6 | BRF_GRA }, // 41 + { "wwfs48.bin", 0x10000, 0x251372fd, 6 | BRF_GRA }, // 42 + { "wwfs47.bin", 0x10000, 0x6fd7b6ea, 6 | BRF_GRA }, // 43 + { "wwfs46.bin", 0x10000, 0x985e5180, 6 | BRF_GRA }, // 44 + { "wwfs45.bin", 0x10000, 0xb2fad792, 6 | BRF_GRA }, // 45 + { "wwfs44.bin", 0x10000, 0x4f965fa9, 6 | BRF_GRA }, // 46 +}; + +STD_ROM_PICK(wwfsstar) +STD_ROM_FN(wwfsstar) + +struct BurnDriver BurnDrvWwfsstar = { + "wwfsstar", NULL, NULL, NULL, "1989", + "WWF Superstars (Europe)\0", NULL, "Technos Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, + NULL, wwfsstarRomInfo, wwfsstarRomName, NULL, NULL, WwfsstarInputInfo, WwfsstarDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x180, + 256, 240, 4, 3 +}; + + +// WWF Superstars (US) + +static struct BurnRomInfo wwfsstaruRomDesc[] = { + { "24ac-04.34", 0x20000, 0xee9b850e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "24ad-04.35", 0x20000, 0x057c2eef, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b.12", 0x08000, 0x1e44f8aa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "24a9.46", 0x20000, 0x703ff08f, 3 | BRF_SND }, // 3 oki + { "wwfs03.bin", 0x10000, 0x8a35a20e, 3 | BRF_SND }, // 4 + { "wwfs05.bin", 0x10000, 0x6df08962, 3 | BRF_SND }, // 5 + + { "24a4-0.58", 0x20000, 0xcb12ba40, 4 | BRF_GRA }, // 6 Characters + + { "wwfs39.bin", 0x10000, 0xd807b09a, 5 | BRF_GRA }, // 7 Sprites + { "wwfs38.bin", 0x10000, 0xd8ea94d3, 5 | BRF_GRA }, // 8 + { "wwfs37.bin", 0x10000, 0x5e8d7407, 5 | BRF_GRA }, // 9 + { "wwfs36.bin", 0x10000, 0x9005e942, 5 | BRF_GRA }, // 10 + { "wwfs43.bin", 0x10000, 0xaafc4a38, 5 | BRF_GRA }, // 11 + { "wwfs42.bin", 0x10000, 0xe48b88fb, 5 | BRF_GRA }, // 12 + { "wwfs41.bin", 0x10000, 0xed7f69d5, 5 | BRF_GRA }, // 13 + { "wwfs40.bin", 0x10000, 0x4d75fd89, 5 | BRF_GRA }, // 14 + { "wwfs19.bin", 0x10000, 0x7426d444, 5 | BRF_GRA }, // 15 + { "wwfs18.bin", 0x10000, 0xaf11ad2a, 5 | BRF_GRA }, // 16 + { "wwfs17.bin", 0x10000, 0xef12069f, 5 | BRF_GRA }, // 17 + { "wwfs16.bin", 0x10000, 0x08343e7f, 5 | BRF_GRA }, // 18 + { "wwfs15.bin", 0x10000, 0xaac5a928, 5 | BRF_GRA }, // 19 + { "wwfs14.bin", 0x10000, 0x67eb7bea, 5 | BRF_GRA }, // 20 + { "wwfs13.bin", 0x10000, 0x970b6e76, 5 | BRF_GRA }, // 21 + { "wwfs12.bin", 0x10000, 0x242caff5, 5 | BRF_GRA }, // 22 + { "wwfs27.bin", 0x10000, 0xf3eb8ab9, 5 | BRF_GRA }, // 23 + { "wwfs26.bin", 0x10000, 0x2ca91eaf, 5 | BRF_GRA }, // 24 + { "wwfs25.bin", 0x10000, 0xbbf69c6a, 5 | BRF_GRA }, // 25 + { "wwfs24.bin", 0x10000, 0x76b08bcd, 5 | BRF_GRA }, // 26 + { "wwfs23.bin", 0x10000, 0x681f5b5e, 5 | BRF_GRA }, // 27 + { "wwfs22.bin", 0x10000, 0x81fe1bf7, 5 | BRF_GRA }, // 28 + { "wwfs21.bin", 0x10000, 0xc52eee5e, 5 | BRF_GRA }, // 29 + { "wwfs20.bin", 0x10000, 0xb2a8050e, 5 | BRF_GRA }, // 30 + { "wwfs35.bin", 0x10000, 0x9d648d82, 5 | BRF_GRA }, // 31 + { "wwfs34.bin", 0x10000, 0x742a79db, 5 | BRF_GRA }, // 32 + { "wwfs33.bin", 0x10000, 0xf6923db6, 5 | BRF_GRA }, // 33 + { "wwfs32.bin", 0x10000, 0x9becd621, 5 | BRF_GRA }, // 34 + { "wwfs31.bin", 0x10000, 0xf94c74d5, 5 | BRF_GRA }, // 35 + { "wwfs30.bin", 0x10000, 0x94094518, 5 | BRF_GRA }, // 36 + { "wwfs29.bin", 0x10000, 0x7b5b9d83, 5 | BRF_GRA }, // 37 + { "wwfs28.bin", 0x10000, 0x70fda626, 5 | BRF_GRA }, // 38 + + { "wwfs51.bin", 0x10000, 0x51157385, 6 | BRF_GRA }, // 39 Tiles + { "wwfs50.bin", 0x10000, 0x7fc79df5, 6 | BRF_GRA }, // 40 + { "wwfs49.bin", 0x10000, 0xa14076b0, 6 | BRF_GRA }, // 41 + { "wwfs48.bin", 0x10000, 0x251372fd, 6 | BRF_GRA }, // 42 + { "wwfs47.bin", 0x10000, 0x6fd7b6ea, 6 | BRF_GRA }, // 43 + { "wwfs46.bin", 0x10000, 0x985e5180, 6 | BRF_GRA }, // 44 + { "wwfs45.bin", 0x10000, 0xb2fad792, 6 | BRF_GRA }, // 45 + { "wwfs44.bin", 0x10000, 0x4f965fa9, 6 | BRF_GRA }, // 46 +}; + +STD_ROM_PICK(wwfsstaru) +STD_ROM_FN(wwfsstaru) + +struct BurnDriver BurnDrvWwfsstaru = { + "wwfsstaru", "wwfsstar", NULL, NULL, "1989", + "WWF Superstars (US)\0", NULL, "Technos Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, + NULL, wwfsstaruRomInfo, wwfsstaruRomName, NULL, NULL, WwfsstarInputInfo, WwfsstarDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x180, + 256, 240, 4, 3 +}; + + +// WWF Superstars (US, Newer) + +static struct BurnRomInfo wwfsstaraRomDesc[] = { + { "24ac-06.34", 0x20000, 0x924a50e4, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "24ad-07.35", 0x20000, 0x9a76a50e, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "24ab-0.12", 0x08000, 0x1e44f8aa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "24a9-0.46", 0x20000, 0x703ff08f, 3 | BRF_SND }, // 3 oki + { "24j8-0.45", 0x20000, 0x61138487, 3 | BRF_SND }, // 4 + + { "24aa-0.58", 0x20000, 0xcb12ba40, 4 | BRF_GRA }, // 5 Characters + + { "c951.114", 0x80000, 0xfa76d1f0, 5 | BRF_GRA }, // 6 Sprites + { "24j4-0.115", 0x40000, 0xc4a589a3, 5 | BRF_GRA }, // 7 + { "24j5-0.116", 0x40000, 0xd6bca436, 5 | BRF_GRA }, // 8 + { "c950.117", 0x80000, 0xcca5703d, 5 | BRF_GRA }, // 9 + { "24j2-0.118", 0x40000, 0xdc1b7600, 5 | BRF_GRA }, // 10 + { "24j3-0.119", 0x40000, 0x3ba12d43, 5 | BRF_GRA }, // 11 + + { "24j7-0.113", 0x40000, 0xe0a1909e, 6 | BRF_GRA }, // 12 Tiles + { "24j6-0.112", 0x40000, 0x77932ef8, 6 | BRF_GRA }, // 13 +}; + +STD_ROM_PICK(wwfsstara) +STD_ROM_FN(wwfsstara) + +struct BurnDriver BurnDrvWwfsstara = { + "wwfsstara", "wwfsstar", NULL, NULL, "1989", + "WWF Superstars (US, Newer)\0", NULL, "Technos Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, + NULL, wwfsstaraRomInfo, wwfsstaraRomName, NULL, NULL, WwfsstarInputInfo, WwfsstarDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x180, + 256, 240, 4, 3 +}; + + +// WWF Superstars (Japan) + +static struct BurnRomInfo wwfsstarjRomDesc[] = { + { "24ac-0_j-1_japan.34",0x20000, 0xf872e968, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "24ad-0_j-1_japan.35",0x20000, 0x00000000, 1 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 1 + + { "b.12", 0x08000, 0x1e44f8aa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "24a9.46", 0x20000, 0x703ff08f, 3 | BRF_SND }, // 3 oki + { "wwfs03.bin", 0x10000, 0x8a35a20e, 3 | BRF_SND }, // 4 + { "wwfs05.bin", 0x10000, 0x6df08962, 3 | BRF_SND }, // 5 + + { "24a4-0.58", 0x20000, 0xcb12ba40, 4 | BRF_GRA }, // 6 Characters + + { "wwfs39.bin", 0x10000, 0xd807b09a, 5 | BRF_GRA }, // 7 Sprites + { "wwfs38.bin", 0x10000, 0xd8ea94d3, 5 | BRF_GRA }, // 8 + { "wwfs37.bin", 0x10000, 0x5e8d7407, 5 | BRF_GRA }, // 9 + { "wwfs36.bin", 0x10000, 0x9005e942, 5 | BRF_GRA }, // 10 + { "wwfs43.bin", 0x10000, 0xaafc4a38, 5 | BRF_GRA }, // 11 + { "wwfs42.bin", 0x10000, 0xe48b88fb, 5 | BRF_GRA }, // 12 + { "wwfs41.bin", 0x10000, 0xed7f69d5, 5 | BRF_GRA }, // 13 + { "wwfs40.bin", 0x10000, 0x4d75fd89, 5 | BRF_GRA }, // 14 + { "wwfs19.bin", 0x10000, 0x7426d444, 5 | BRF_GRA }, // 15 + { "wwfs18.bin", 0x10000, 0xaf11ad2a, 5 | BRF_GRA }, // 16 + { "wwfs17.bin", 0x10000, 0xef12069f, 5 | BRF_GRA }, // 17 + { "wwfs16.bin", 0x10000, 0x08343e7f, 5 | BRF_GRA }, // 18 + { "wwfs15.bin", 0x10000, 0xaac5a928, 5 | BRF_GRA }, // 19 + { "wwfs14.bin", 0x10000, 0x67eb7bea, 5 | BRF_GRA }, // 20 + { "wwfs13.bin", 0x10000, 0x970b6e76, 5 | BRF_GRA }, // 21 + { "wwfs12.bin", 0x10000, 0x242caff5, 5 | BRF_GRA }, // 22 + { "wwfs27.bin", 0x10000, 0xf3eb8ab9, 5 | BRF_GRA }, // 23 + { "wwfs26.bin", 0x10000, 0x2ca91eaf, 5 | BRF_GRA }, // 24 + { "wwfs25.bin", 0x10000, 0xbbf69c6a, 5 | BRF_GRA }, // 25 + { "wwfs24.bin", 0x10000, 0x76b08bcd, 5 | BRF_GRA }, // 26 + { "wwfs23.bin", 0x10000, 0x681f5b5e, 5 | BRF_GRA }, // 27 + { "wwfs22.bin", 0x10000, 0x81fe1bf7, 5 | BRF_GRA }, // 28 + { "wwfs21.bin", 0x10000, 0xc52eee5e, 5 | BRF_GRA }, // 29 + { "wwfs20.bin", 0x10000, 0xb2a8050e, 5 | BRF_GRA }, // 30 + { "wwfs35.bin", 0x10000, 0x9d648d82, 5 | BRF_GRA }, // 31 + { "wwfs34.bin", 0x10000, 0x742a79db, 5 | BRF_GRA }, // 32 + { "wwfs33.bin", 0x10000, 0xf6923db6, 5 | BRF_GRA }, // 33 + { "wwfs32.bin", 0x10000, 0x9becd621, 5 | BRF_GRA }, // 34 + { "wwfs31.bin", 0x10000, 0xf94c74d5, 5 | BRF_GRA }, // 35 + { "wwfs30.bin", 0x10000, 0x94094518, 5 | BRF_GRA }, // 36 + { "wwfs29.bin", 0x10000, 0x7b5b9d83, 5 | BRF_GRA }, // 37 + { "wwfs28.bin", 0x10000, 0x70fda626, 5 | BRF_GRA }, // 38 + + { "wwfs51.bin", 0x10000, 0x51157385, 6 | BRF_GRA }, // 39 Tiles + { "wwfs50.bin", 0x10000, 0x7fc79df5, 6 | BRF_GRA }, // 40 + { "wwfs49.bin", 0x10000, 0xa14076b0, 6 | BRF_GRA }, // 41 + { "wwfs48.bin", 0x10000, 0x251372fd, 6 | BRF_GRA }, // 42 + { "wwfs47.bin", 0x10000, 0x6fd7b6ea, 6 | BRF_GRA }, // 43 + { "wwfs46.bin", 0x10000, 0x985e5180, 6 | BRF_GRA }, // 44 + { "wwfs45.bin", 0x10000, 0xb2fad792, 6 | BRF_GRA }, // 45 + { "wwfs44.bin", 0x10000, 0x4f965fa9, 6 | BRF_GRA }, // 46 +}; + +STD_ROM_PICK(wwfsstarj) +STD_ROM_FN(wwfsstarj) + +struct BurnDriverD BurnDrvWwfsstarj = { + "wwfsstarj", "wwfsstar", NULL, NULL, "1989", + "WWF Superstars (Japan)\0", "Missing program ROM", "Technos Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, + NULL, wwfsstarjRomInfo, wwfsstarjRomName, NULL, NULL, WwfsstarInputInfo, WwfsstarDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x180, + 256, 240, 4, 3 +}; diff --git a/src/burn/drv/psikyo/d_psikyo.cpp b/src/burn/drv/psikyo/d_psikyo.cpp index 81ec74267..d9ed778ec 100644 --- a/src/burn/drv/psikyo/d_psikyo.cpp +++ b/src/burn/drv/psikyo/d_psikyo.cpp @@ -1,2437 +1,2434 @@ -// Psikyo MC68EC020 based hardware -#include "psikyo.h" -#include "burn_ym2610.h" -#include "burn_ymf278b.h" - -INT32 PsikyoHardwareVersion; - -static UINT8 DrvJoy1[8] = {0, }; -static UINT8 DrvJoy2[8] = {0, }; -static UINT8 DrvInp1[8] = {0, }; -static UINT8 DrvInp2[8] = {0, }; -static UINT16 DrvInput[4] = {0, }; - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Psikyo68KROM, *PsikyoZ80ROM; -static UINT8 *Psikyo68KRAM, *PsikyoZ80RAM; -static UINT8 *PsikyoSampleROM01, *PsikyoSampleROM02; - -static INT32 PsikyoSampleROM01Size, PsikyoSampleROM02Size; -static INT32 PsikyoTileROMSize, PsikyoSpriteROMSize; - -static UINT8 DrvReset = 0; -static UINT16 bVBlank; - -static INT32 nPsikyoZ80Bank; - -static INT32 nSoundlatch, nSoundlatchAck; - -static INT32 nCyclesDone[2]; -static INT32 nCyclesTotal[2]; -static INT32 nCyclesSegment; -static INT32 nCycles68KSync; - -static INT32 nPrevBurnCPUSpeedAdjust; - -static INT32 (*CheckSleep)(INT32); - -// ---------------------------------------------------------------------------- -// Input definitions - -static struct BurnInputInfo gunbirdInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvInp1 + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 7, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 6, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 4, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 5, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvInp1 + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 7, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 6, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 4, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 5, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Test", BIT_DIGITAL, DrvInp1 + 5, "diag"}, - {"Service", BIT_DIGITAL, DrvInp1 + 4, "service"}, -// {"Tilt", BIT_DIGITAL, DrvInp1 + 6, "tilt"}, - - {"Dip 1", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 2)) + 1, "dip"}, - {"Dip 2", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 2)) + 0, "dip"}, - {"Dip 3", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 3)) + 0, "dip"}, -}; - -STDINPUTINFO(gunbird) - -static struct BurnInputInfo btlkroadInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvInp1 + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 7, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 6, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 4, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 5, "p1 right"}, - {"P1 Weak punch", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1"}, - {"P1 Medium punch", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 2"}, - {"P1 Strong punch", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 3"}, - {"P1 Weak kick", BIT_DIGITAL, DrvInp2 + 7, "p1 fire 4"}, - {"P1 Medium kick", BIT_DIGITAL, DrvInp2 + 6, "p1 fire 5"}, - {"P1 Strong kick", BIT_DIGITAL, DrvInp2 + 5, "p1 fire 6"}, - - {"P2 Coin", BIT_DIGITAL, DrvInp1 + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 7, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 6, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 4, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 5, "p2 right"}, - {"P2 Weak punch", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1"}, - {"P2 Medium punch", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 2"}, - {"P2 Strong punch", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 3"}, - {"P2 Weak kick", BIT_DIGITAL, DrvInp2 + 3, "p2 fire 4"}, - {"P2 Medium kick", BIT_DIGITAL, DrvInp2 + 2, "p2 fire 5"}, - {"P2 Strong kick", BIT_DIGITAL, DrvInp2 + 1, "p2 fire 6"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Test", BIT_DIGITAL, DrvInp1 + 5, "diag"}, - {"Service", BIT_DIGITAL, DrvInp1 + 4, "service"}, -// {"Tilt", BIT_DIGITAL, DrvInp1 + 6, "tilt"}, - - {"Dip 1", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 2)) + 1, "dip"}, - {"Dip 2", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 2)) + 0, "dip"}, - {"Region", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 3)) + 0, "dip"}, - {"Debug Dip", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 3)) + 1, "dip"}, -}; - -STDINPUTINFO(btlkroad) - -static struct BurnDIPInfo samuraiaDIPList[] = { - // Defaults - {0x15, 0xFF, 0xFF, 0x00, NULL}, - {0x16, 0xFF, 0xFF, 0x02, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, "Coin slot"}, - {0x15, 0x82, 0x01, 0x00, "Same"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x01, 0x01, "Individual"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0, 0xFE, 0, 9, "Coin 1"}, - {0x15, 0x01, 0x0E, 0x00, "1 coin = 1 credit"}, - {0x15, 0x01, 0x0E, 0x02, "2 coins = 1 credit"}, - {0x15, 0x01, 0x0E, 0x04, "3 coins = 1 credit"}, - {0x15, 0x01, 0x0E, 0x08, "1 coin = 2 credits"}, - {0x15, 0x01, 0x0E, 0x06, "1 coin = 3 credits"}, - {0x15, 0x01, 0x0E, 0x0A, "1 coin = 4 credits"}, - {0x15, 0x01, 0x0E, 0x0C, "1 coin = 5 credits"}, - {0x15, 0x82, 0x0E, 0x0E, "1 coin = 6 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x01, 0xFF, 0xFF, "Free play"}, - {0, 0xFE, 0, 9, "Coin 2"}, - {0x15, 0x82, 0x70, 0x00, "1 coin = 1 credit"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x10, "2 coins = 1 credit"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x20, "3 coins = 1 credit"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x40, "1 coin = 2 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x30, "1 coin = 3 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x50, "1 coin = 4 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x60, "1 coin = 5 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x70, "1 coin = 6 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0xFF, 0xFF, "Free play"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0, 0xFE, 0, 2, "Continue coin"}, - {0x15, 0x82, 0x80, 0x00, "Normal mode"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x80, 0x80, "Continue mode"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - // DIP 2 - {0, 0xFE, 0, 2, "Screen reverse"}, - {0x16, 0x01, 0x01, 0x00, "Invert"}, - {0x16, 0x01, 0x01, 0x01, "Normal"}, - {0, 0xFE, 0, 2, "Demo sound"}, - {0x16, 0x01, 0x02, 0x00, "Off"}, - {0x16, 0x01, 0x02, 0x02, "On"}, - {0, 0xFE, 0, 4, "Difficulty"}, - {0x16, 0x01, 0x0C, 0x00, "Normal"}, - {0x16, 0x01, 0x0C, 0x04, "Easy"}, - {0x16, 0x01, 0x0C, 0x08, "Hard"}, - {0x16, 0x01, 0x0C, 0x0C, "Super hard"}, - {0, 0xFE, 0, 4, "Fighters"}, - {0x16, 0x01, 0x30, 0x00, "3"}, - {0x16, 0x01, 0x30, 0x10, "1"}, - {0x16, 0x01, 0x30, 0x20, "2"}, - {0x16, 0x01, 0x30, 0x30, "4"}, - {0, 0xFE, 0, 2, "Extend player"}, - {0x16, 0x01, 0x40, 0x00, "Every 400,000 points"}, - {0x16, 0x01, 0x40, 0x40, "Every 600,000 points"}, - {0, 0xFE, 0, 2, "Test mode"}, - {0x16, 0x01, 0x80, 0x00, "Off"}, - {0x16, 0x01, 0x80, 0x80, "On"}, -}; - -static struct BurnDIPInfo gunbirdDIPList[] = { - // Defaults - {0x15, 0xFF, 0xFF, 0x00, NULL}, - {0x16, 0xFF, 0xFF, 0x02, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, "Coin slot"}, - {0x15, 0x82, 0x01, 0x00, "Same"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x01, 0x01, "Individual"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0, 0xFE, 0, 9, "Coin 1"}, - {0x15, 0x01, 0x0E, 0x00, "1 coin = 1 credit"}, - {0x15, 0x01, 0x0E, 0x02, "2 coins = 1 credit"}, - {0x15, 0x01, 0x0E, 0x04, "3 coins = 1 credit"}, - {0x15, 0x01, 0x0E, 0x08, "1 coin = 2 credits"}, - {0x15, 0x01, 0x0E, 0x06, "1 coin = 3 credits"}, - {0x15, 0x01, 0x0E, 0x0A, "1 coin = 4 credits"}, - {0x15, 0x01, 0x0E, 0x0C, "1 coin = 5 credits"}, - {0x15, 0x82, 0x0E, 0x0E, "1 coin = 6 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x01, 0xFF, 0xFF, "Free play"}, - {0, 0xFE, 0, 9, "Coin 2"}, - {0x15, 0x82, 0x70, 0x00, "1 coin = 1 credit"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x10, "2 coins = 1 credit"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x20, "3 coins = 1 credit"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x40, "1 coin = 2 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x30, "1 coin = 3 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x50, "1 coin = 4 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x60, "1 coin = 5 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x70, "1 coin = 6 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0xFF, 0xFF, "Free play"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0, 0xFE, 0, 2, "Continue coin"}, - {0x15, 0x82, 0x80, 0x00, "Normal mode"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x80, 0x80, "Continue mode"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - // DIP 2 - {0, 0xFE, 0, 2, "Screen"}, - {0x16, 0x01, 0x01, 0x00, "Normal"}, - {0x16, 0x01, 0x01, 0x01, "Reverse"}, - {0, 0xFE, 0, 2, "Demo sound"}, - {0x16, 0x01, 0x02, 0x00, "Off"}, - {0x16, 0x01, 0x02, 0x02, "On"}, - {0, 0xFE, 0, 4, "Difficulty"}, - {0x16, 0x01, 0x0C, 0x00, "Normal"}, - {0x16, 0x01, 0x0C, 0x04, "Easy"}, - {0x16, 0x01, 0x0C, 0x08, "Difficult"}, - {0x16, 0x01, 0x0C, 0x0C, "More Difficult"}, - {0, 0xFE, 0, 4, "Number of fighters"}, - {0x16, 0x01, 0x30, 0x00, "3"}, - {0x16, 0x01, 0x30, 0x10, "1"}, - {0x16, 0x01, 0x30, 0x20, "2"}, - {0x16, 0x01, 0x30, 0x30, "4"}, - {0, 0xFE, 0, 2, "Extend fighters"}, - {0x16, 0x01, 0x40, 0x00, "Every 400,000 points"}, - {0x16, 0x01, 0x40, 0x40, "Every 600,000 points"}, - {0, 0xFE, 0, 2, "Test mode"}, - {0x16, 0x01, 0x80, 0x00, "Off"}, - {0x16, 0x01, 0x80, 0x80, "On"}, -}; - -static struct BurnDIPInfo btlkroadDIPList[] = { - // Defaults - {0x1B, 0xFF, 0xFF, 0x00, NULL}, - {0x1C, 0xFF, 0xFF, 0x02, NULL}, - {0x1D, 0xFF, 0xFF, 0x0F, NULL}, - {0x1E, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, "Coin slot"}, - {0x1B, 0x82, 0x01, 0x00, "Same"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x82, 0x01, 0x01, "Individual"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0, 0xFE, 0, 9, "Coin 1"}, - {0x1B, 0x01, 0x0E, 0x00, "1 coin = 1 credit"}, - {0x1B, 0x01, 0x0E, 0x02, "2 coins = 1 credit"}, - {0x1B, 0x01, 0x0E, 0x04, "3 coins = 1 credit"}, - {0x1B, 0x01, 0x0E, 0x08, "1 coin = 2 credits"}, - {0x1B, 0x01, 0x0E, 0x06, "1 coin = 3 credits"}, - {0x1B, 0x01, 0x0E, 0x0A, "1 coin = 4 credits"}, - {0x1B, 0x01, 0x0E, 0x0C, "1 coin = 5 credits"}, - {0x1B, 0x82, 0x0E, 0x0E, "1 coin = 6 credits"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x01, 0xFF, 0xFF, "Free play"}, - {0, 0xFE, 0, 9, "Coin 2"}, - {0x1B, 0x82, 0x70, 0x00, "1 coin = 1 credit"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x82, 0x70, 0x10, "2 coins = 1 credit"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x82, 0x70, 0x20, "3 coins = 1 credit"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x82, 0x70, 0x40, "1 coin = 2 credits"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x82, 0x70, 0x30, "1 coin = 3 credits"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x82, 0x70, 0x50, "1 coin = 4 credits"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x82, 0x70, 0x60, "1 coin = 5 credits"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x82, 0x70, 0x70, "1 coin = 6 credits"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x82, 0xFF, 0xFF, "Free play"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0, 0xFE, 0, 2, "Continue coin"}, - {0x1B, 0x82, 0x80, 0x00, "Normal mode"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - {0x1B, 0x82, 0x80, 0x80, "Continue mode"}, - {0x1B, 0x00, 0xFF, 0xFF, NULL}, - // DIP 2 - {0, 0xFE, 0, 2, NULL}, - {0x1C, 0x01, 0x01, 0x00, "Normal screen"}, - {0x1C, 0x01, 0x01, 0x01, "Invert screen"}, - {0, 0xFE, 0, 2, "Demo sounds"}, - {0x1C, 0x01, 0x02, 0x00, "Disabled"}, - {0x1C, 0x01, 0x02, 0x02, "Enabled"}, - {0, 0xFE, 0, 4, "Difficulty"}, - {0x1C, 0x01, 0x0C, 0x00, "Normal"}, - {0x1C, 0x01, 0x0C, 0x04, "Easy"}, - {0x1C, 0x01, 0x0C, 0x08, "Hard"}, - {0x1C, 0x01, 0x0C, 0x0C, "Hardest"}, - {0, 0xFE, 0, 2, "Enable debug dip"}, - {0x1C, 0x01, 0x40, 0x00, "Off"}, - {0x1C, 0x01, 0x40, 0x40, "On"}, - {0, 0xFE, 0, 2, "Test mode"}, - {0x1C, 0x01, 0x80, 0x00, "Off"}, - {0x1C, 0x01, 0x80, 0x80, "On"}, - - // Region - {0, 0xFE, 0, 6, "Region"}, - {0x1D, 0x01, 0xFF, 0x00, "Japan"}, - {0x1D, 0x01, 0xFF, 0x01, "USA / Canada (Jaleco license)"}, - {0x1D, 0x01, 0xFF, 0x03, "Korea"}, - {0x1D, 0x01, 0xFF, 0x05, "Hong Kong"}, - {0x1D, 0x01, 0xFF, 0x09, "Taiwan"}, - {0x1D, 0x01, 0xFF, 0x0F, "World"}, - - // Debug Dip - {0, 0xFE, 0, 2, "Debug test menu"}, - {0x1E, 0x82, 0x80, 0x00, "Off"}, - {0x1C, 0x00, 0x40, 0x00, NULL}, - {0x1E, 0x82, 0x80, 0x80, "On"}, - {0x1C, 0x00, 0x40, 0x00, NULL}, -}; - -static struct BurnDIPInfo s1945DIPList[] = { - // Defaults - {0x15, 0xFF, 0xFF, 0x00, NULL}, - {0x16, 0xFF, 0xFF, 0x02, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, "Coin slot"}, - {0x15, 0x01, 0x01, 0x00, "Same"}, - {0x15, 0x01, 0x01, 0x01, "Individual"}, - {0, 0xFE, 0, 8, "Coin 1"}, - {0x15, 0x01, 0x0E, 0x00, "1 coin = 1 credit"}, - {0x15, 0x01, 0x0E, 0x02, "2 coins = 1 credit"}, - {0x15, 0x01, 0x0E, 0x04, "3 coins = 1 credit"}, - {0x15, 0x01, 0x0E, 0x08, "1 coin = 2 credits"}, - {0x15, 0x01, 0x0E, 0x06, "1 coin = 3 credits"}, - {0x15, 0x01, 0x0E, 0x0A, "1 coin = 4 credits"}, - {0x15, 0x01, 0x0E, 0x0C, "1 coin = 5 credits"}, - {0x15, 0x82, 0x0E, 0x0E, "1 coin = 6 credits"}, - {0, 0xFE, 0, 8, "Coin 2"}, - {0x15, 0x01, 0x70, 0x00, "1 coin = 1 credit"}, - {0x15, 0x01, 0x70, 0x10, "2 coins = 1 credit"}, - {0x15, 0x01, 0x70, 0x20, "3 coins = 1 credit"}, - {0x15, 0x01, 0x70, 0x40, "1 coin = 2 credits"}, - {0x15, 0x01, 0x70, 0x30, "1 coin = 3 credits"}, - {0x15, 0x01, 0x70, 0x50, "1 coin = 4 credits"}, - {0x15, 0x01, 0x70, 0x60, "1 coin = 5 credits"}, - {0x15, 0x01, 0x70, 0x70, "1 coin = 6 credits"}, - {0, 0xFE, 0, 2, "Continue coin"}, - {0x15, 0x01, 0x80, 0x00, "Normal mode"}, - {0x15, 0x01, 0x80, 0x80, "Continue mode"}, - // DIP 2 - {0, 0xFE, 0, 2, "Screen"}, - {0x16, 0x01, 0x01, 0x00, "Normal"}, - {0x16, 0x01, 0x01, 0x01, "Reverse"}, - {0, 0xFE, 0, 2, "Demo sound"}, - {0x16, 0x01, 0x02, 0x00, "Off"}, - {0x16, 0x01, 0x02, 0x02, "On"}, - {0, 0xFE, 0, 4, "Difficulty"}, - {0x16, 0x01, 0x0C, 0x00, "Normal"}, - {0x16, 0x01, 0x0C, 0x04, "Easy"}, - {0x16, 0x01, 0x0C, 0x08, "Difficult"}, - {0x16, 0x01, 0x0C, 0x0C, "More Difficult"}, - {0, 0xFE, 0, 4, "Number of fighters"}, - {0x16, 0x01, 0x30, 0x00, "3"}, - {0x16, 0x01, 0x30, 0x10, "1"}, - {0x16, 0x01, 0x30, 0x20, "2"}, - {0x16, 0x01, 0x30, 0x30, "4"}, - {0, 0xFE, 0, 2, "Extend fighters"}, - {0x16, 0x01, 0x40, 0x00, "Every 600,000 points"}, - {0x16, 0x01, 0x40, 0x40, "Every 800,000 points"}, - {0, 0xFE, 0, 2, "Test mode"}, - {0x16, 0x01, 0x80, 0x00, "Off"}, - {0x16, 0x01, 0x80, 0x80, "On"}, -}; - -static struct BurnDIPInfo tengaiDIPList[] = { - // Defaults - {0x15, 0xFF, 0xFF, 0x00, NULL}, - {0x16, 0xFF, 0xFF, 0x02, NULL}, - {0x17, 0xFF, 0xFF, 0x0F, NULL}, - - {0, 0xFE, 0, 2, "Coin slot"}, - {0x15, 0x82, 0x01, 0x00, "Same"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x01, 0x01, "Individual"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0, 0xFE, 0, 9, "Coin 1"}, - {0x15, 0x01, 0x0E, 0x00, "1 coin = 1 credit"}, - {0x15, 0x01, 0x0E, 0x02, "2 coins = 1 credit"}, - {0x15, 0x01, 0x0E, 0x04, "3 coins = 1 credit"}, - {0x15, 0x01, 0x0E, 0x08, "1 coin = 2 credits"}, - {0x15, 0x01, 0x0E, 0x06, "1 coin = 3 credits"}, - {0x15, 0x01, 0x0E, 0x0A, "1 coin = 4 credits"}, - {0x15, 0x01, 0x0E, 0x0C, "1 coin = 5 credits"}, - {0x15, 0x82, 0x0E, 0x0E, "1 coin = 6 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x01, 0xFF, 0xFF, "Free play"}, - {0, 0xFE, 0, 9, "Coin 2"}, - {0x15, 0x82, 0x70, 0x00, "1 coin = 1 credit"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x10, "2 coins = 1 credit"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x20, "3 coins = 1 credit"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x40, "1 coin = 2 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x30, "1 coin = 3 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x50, "1 coin = 4 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x60, "1 coin = 5 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x70, 0x70, "1 coin = 6 credits"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0xFF, 0xFF, "Free play"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0, 0xFE, 0, 2, "Continue coin"}, - {0x15, 0x82, 0x80, 0x00, "Normal mode"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - {0x15, 0x82, 0x80, 0x80, "Continue mode"}, - {0x15, 0x00, 0xFF, 0xFF, NULL}, - // DIP 2 - {0, 0xFE, 0, 2, NULL}, - {0x16, 0x01, 0x01, 0x00, "Normal screen"}, - {0x16, 0x01, 0x01, 0x01, "Invert screen"}, - {0, 0xFE, 0, 2, "Demo sounds"}, - {0x16, 0x01, 0x02, 0x00, "Disabled"}, - {0x16, 0x01, 0x02, 0x02, "Enabled"}, - {0, 0xFE, 0, 4, "Difficulty"}, - {0x16, 0x01, 0x0C, 0x00, "Normal"}, - {0x16, 0x01, 0x0C, 0x04, "Easy"}, - {0x16, 0x01, 0x0C, 0x08, "Hard"}, - {0x16, 0x01, 0x0C, 0x0C, "Hardest"}, - {0, 0xFE, 0, 4, "Lives"}, - {0x16, 0x01, 0x30, 0x00, "3"}, - {0x16, 0x01, 0x30, 0x10, "1"}, - {0x16, 0x01, 0x30, 0x20, "2"}, - {0x16, 0x01, 0x30, 0x30, "4"}, - {0, 0xFE, 0, 2, "Bonus life"}, - {0x16, 0x01, 0x40, 0x00, "600K"}, - {0x16, 0x01, 0x40, 0x40, "800K"}, -}; - -static struct BurnDIPInfo NoRegionDIPList[] = { - // Defaults - {0x17, 0xFF, 0xFF, 0x00, NULL}, -}; - -static struct BurnDIPInfo samuraiaRegionDIPList[] = { - // Defaults - {0x17, 0xFF, 0xFF, 0x00, NULL}, - - // Region - {0, 0xFE, 0, 5, "Region"}, - {0x17, 0x01, 0xFF, 0x00, "World"}, - {0x17, 0x01, 0xFF, 0x10, "USA / Canada"}, - {0x17, 0x01, 0xFF, 0x20, "Korea"}, - {0x17, 0x01, 0xFF, 0x40, "Hong Kong"}, - {0x17, 0x01, 0xFF, 0x80, "Taiwan"}, -}; - -static struct BurnDIPInfo gunbirdRegionDIPList[] = { - // Defaults - {0x17, 0xFF, 0xFF, 0x00, NULL}, - - // Region - {0, 0xFE, 0, 5, "Region"}, - {0x17, 0x01, 0xFF, 0x00, "World"}, - {0x17, 0x01, 0xFF, 0x01, "USA / Canada"}, - {0x17, 0x01, 0xFF, 0x02, "Korea"}, - {0x17, 0x01, 0xFF, 0x04, "Hong Kong"}, - {0x17, 0x01, 0xFF, 0x08, "Taiwan"}, -}; - -static struct BurnDIPInfo s1945aRegionDIPList[] = { - // Defaults - {0x17, 0xFF, 0xFF, 0x01, NULL}, - - // Region - {0, 0xFE, 0, 2, "Region"}, - {0x17, 0x01, 0xFF, 0x00, "Japan"}, - {0x17, 0x01, 0xFF, 0x01, "World"}, -}; - -static struct BurnDIPInfo tengaiRegionDIPList[] = { - // Defaults - {0x17, 0xFF, 0xFF, 0x00, NULL}, - - // Region - {0, 0xFE, 0, 5, "Region"}, - {0x17, 0x01, 0xFF, 0x01, "U.S.A. & Canada"}, - {0x17, 0x01, 0xFF, 0x02, "Korea"}, - {0x17, 0x01, 0xFF, 0x04, "Hong Kong"}, - {0x17, 0x01, 0xFF, 0x08, "Taiwan"}, - {0x17, 0x01, 0xFF, 0x00, "World"}, -}; - -static struct BurnDIPInfo tengaijRegionDIPList[] = { - // Defaults - {0x17, 0xFF, 0xFF, 0x00, NULL}, - - // Region - {0, 0xFE, 0, 2, "Region"}, - {0x17, 0x01, 0xFF, 0x00, "Japan"}, - {0x17, 0x01, 0xFF, 0x0F, "World"}, -}; - -STDDIPINFOEXT(samuraia, samuraia, samuraiaRegion) -STDDIPINFOEXT(sngkace, samuraia, NoRegion) - -STDDIPINFO(btlkroad) - -STDDIPINFOEXT(gunbirdWorld, gunbird, gunbirdRegion) -STDDIPINFOEXT(gunbird, gunbird, NoRegion) - -STDDIPINFOEXT(s1945World, s1945, gunbirdRegion) -STDDIPINFOEXT(s1945, s1945, NoRegion) -STDDIPINFOEXT(s1945a, s1945, s1945aRegion) - -//STDDIPINFO(tengai) -STDDIPINFOEXT(tengai, tengai, tengaiRegion) -STDDIPINFOEXT(tengaij, tengai, tengaijRegion) - -// ---------------------------------------------------------------------------- -// Z80 banswitch - -static void samuraiaZ80SetBank(INT32 nBank) -{ - nBank &= 0x03; - if (nBank != nPsikyoZ80Bank) { - UINT8* nStartAddress = PsikyoZ80ROM + (nBank << 15); - ZetMapArea(0x8000, 0xFFFF, 0, nStartAddress); - ZetMapArea(0x8000, 0xFFFF, 2, nStartAddress); - - nPsikyoZ80Bank = nBank; - } - - return; -} - -static void gunbirdZ80SetBank(INT32 nBank) -{ - nBank &= 0x03; - if (nBank != nPsikyoZ80Bank) { - UINT8* nStartAddress = PsikyoZ80ROM + 0x00200 + (nBank << 15); - ZetMapArea(0x8200, 0xFFFF, 0, nStartAddress); - ZetMapArea(0x8200, 0xFFFF, 2, nStartAddress); - - nPsikyoZ80Bank = nBank; - } - - return; -} - -// ---------------------------------------------------------------------------- -// CPU synchronisation - -static inline void PsikyoSynchroniseZ80(INT32 nExtraCycles) -{ - INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]) + nExtraCycles; - - if (nCycles <= ZetTotalCycles()) { - return; - } - - nCycles68KSync = nCycles - nExtraCycles; - - BurnTimerUpdate(nCycles); -} - -// Callbacks for the FM chip - -static void PsikyoFMIRQHandler(INT32, INT32 nStatus) -{ -// bprintf(PRINT_NORMAL, _T(" - IRQ -> %i.\n"), nStatus); - - if (nStatus) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 PsikyoSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double PsikyoGetTime() -{ - return (double)ZetTotalCycles() / 4000000.0; -} - -// ---------------------------------------------------------------------------- -// Z80 I/O handlers - -UINT8 __fastcall samuraiaZ80In(UINT16 nAddress) -{ - switch (nAddress & 0xFF) { - case 0x00: - return BurnYM2610Read(0); - case 0x02: - return BurnYM2610Read(2); - case 0x08: // Read sound command -// bprintf(PRINT_NORMAL, _T(" - Sound command received (0x%02X).\n"), nSoundlatch); - return nSoundlatch; - -// default: { -// bprintf(PRINT_NORMAL, _T(" - Z80 read port 0x%04X.\n"), nAddress); -// } - } - - return 0; -} - -void __fastcall samuraiaZ80Out(UINT16 nAddress, UINT8 nValue) -{ - switch (nAddress & 0x0FF) { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - BurnYM2610Write(nAddress & 3, nValue); - break; - - case 0x04: - samuraiaZ80SetBank(nValue); - break; - - case 0x0C: // Write reply to sound commands -// bprintf(PRINT_NORMAL, _T(" - Sound reply sent (0x%02X).\n"), nValue); - - nSoundlatchAck = 1; - - break; - -// default: { -// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue); -// } - } -} - -UINT8 __fastcall gunbirdZ80In(UINT16 nAddress) -{ - switch (nAddress & 0xFF) { - case 0x04: -// bprintf(PRINT_NORMAL, _T(" read 0 %6i\n"), ZetTotalCycles()); - return BurnYM2610Read(0); - case 0x06: -// bprintf(PRINT_NORMAL, _T(" read 2 %6i\n"), ZetTotalCycles()); - return BurnYM2610Read(2); - case 0x08: // Read sound command -// bprintf(PRINT_NORMAL, _T(" - Sound command received (0x%02X).\n"), nSoundlatch); - return nSoundlatch; - -// default: { -// bprintf(PRINT_NORMAL, _T(" - Z80 read port 0x%04X.\n"), nAddress); -// } - } - - return 0; -} - -void __fastcall gunbirdZ80Out(UINT16 nAddress, UINT8 nValue) -{ - switch (nAddress & 0x0FF) { - case 0x00: - gunbirdZ80SetBank(nValue >> 4); - break; - case 0x04: - case 0x05: - case 0x06: - case 0x07: { - BurnYM2610Write(nAddress & 3, nValue); - break; - } - case 0x0C: // Write reply to sound commands -// bprintf(PRINT_NORMAL, _T(" - Sound reply sent (0x%02X).\n"), nValue); - - nSoundlatchAck = 1; - - break; - -// default: { -// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue); -// } - } -} - -UINT8 __fastcall tengaiZ80In(UINT16 nAddress) -{ - switch (nAddress & 0xFF) { - case 0x08: -// bprintf(PRINT_NORMAL, _T(" read 0 %6i\n"), ZetTotalCycles()); - return BurnYMF278BReadStatus(); - case 0x10: // Read sound command -// bprintf(PRINT_NORMAL, _T(" - Sound command received (0x%02X).\n"), nSoundlatch); - return nSoundlatch; - -// default: { -// bprintf(PRINT_NORMAL, _T(" - Z80 read port 0x%04X.\n"), nAddress); -// } - } - - return 0; -} - -void __fastcall tengaiZ80Out(UINT16 nAddress, UINT8 nValue) -{ - switch (nAddress & 0x0FF) { - case 0x00: - gunbirdZ80SetBank(nValue >> 4); - break; - case 0x08: - case 0x0A: - case 0x0C: { - BurnYMF278BSelectRegister((nAddress >> 1) & 3, nValue); - break; - } - case 0x09: - case 0x0B: - case 0x0D: { - BurnYMF278BWriteRegister((nAddress >> 1) & 3, nValue); - break; - } - case 0x18: // Write reply to sound commands -// bprintf(PRINT_NORMAL, _T(" - Sound reply sent (0x%02X).\n"), nValue); - - nSoundlatchAck = 1; - - break; - -// default: { -// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue); -// } - } -} - -// ---------------------------------------------------------------------------- -// 68K memory handlers - -static inline void SendSoundCommand(const INT8 nCommand) -{ -// bprintf(PRINT_NORMAL, _T(" - Sound command sent (0x%02X).\n"), nCommand); - - PsikyoSynchroniseZ80(0); - - nSoundlatch = nCommand; - nSoundlatchAck = 0; - - ZetNmi(); -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall samuraiaReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xC00000: // Joysticks - return ~DrvInput[0] >> 8; - case 0xC00001: - return ~DrvInput[0] & 0xFF; - case 0xC00004: // DIPs - return ~DrvInput[2] >> 8; - case 0xC00005: - return ~DrvInput[2] & 0xFF; - case 0xC00006: // Region - return ~DrvInput[3] >> 8; - case 0xC00007: - return ~DrvInput[3] & 0xFF; - case 0xC00008: { // Inputs / Sound CPU status - return ~DrvInput[1] >> 8; - case 0xC80009: -// bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); - PsikyoSynchroniseZ80(0); - if (!nSoundlatchAck) { - return ~DrvInput[1] & 0xFF; - } - return ~(DrvInput[1] | 0x80) & 0xFF; - } - case 0xC0000B: // VBlank - return ~bVBlank; - -// default: { -// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); -// } - } - return 0; -} - -UINT16 __fastcall samuraiaReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xC00000: // Joysticks - return ~DrvInput[0]; - case 0xC00004: // DIPs - return ~DrvInput[2]; - case 0xC00006: // - return ~DrvInput[3]; - case 0xC00008: { // Inputs / Sound CPU status -// bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); - PsikyoSynchroniseZ80(0); - if (!nSoundlatchAck) { - return ~DrvInput[1]; - } - return ~(DrvInput[1] | 0x80); - } - case 0xC0000A: // VBlank - return ~bVBlank; - - -// default: { -// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); -// } - } - return 0; -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall gunbirdReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xC00000: // Joysticks - return ~DrvInput[0] >> 8; - case 0xC00001: - return ~DrvInput[0] & 0xFF; - case 0xC00002: // Inputs / Sound CPU status - return ~DrvInput[1] >> 8; - case 0xC00003: -// bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); - PsikyoSynchroniseZ80(0); - if (!nSoundlatchAck) { - return ~DrvInput[1] & 0xFF; - } - return ~(DrvInput[1] | 0x80) & 0xFF; - case 0xC00004: // DIPs - return ~DrvInput[2] >> 8; - case 0xC00005: - return ~DrvInput[2] & 0xFF; - case 0xC00006: // Region / VBlank - return ~DrvInput[3] >> 8; - case 0xC00007: - return ~(DrvInput[3] | (bVBlank << 7)) & 0xFF; - -// default: { -// bprintf(PRINT_NORMAL, "Attempt to read byte value of location %x\n", sekAddress); -// } - } - return 0; -} - -UINT16 __fastcall gunbirdReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xC00000: // Joysticks - return ~DrvInput[0]; - case 0xC00002: { // Inputs / Sound CPU status - bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); - PsikyoSynchroniseZ80(0); - if (!nSoundlatchAck) { - return ~DrvInput[1]; - } - return ~(DrvInput[1] | 0x80); - } - case 0xC00004: // DIPs - return ~DrvInput[2]; - case 0xC00006: // Region / VBlank - return ~(DrvInput[3] | (bVBlank << 7)); - -// default: { -// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); -// } - } - return 0; -} - -void __fastcall gunbirdWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - case 0xC00011: // Sound latch - SendSoundCommand(byteValue); - break; - - default: { -// bprintf(PRINT_NORMAL, "Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } - } -} - -void __fastcall gunbirdWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - case 0xC00012: // Sound latch - SendSoundCommand(wordValue & 0xFF); - break; - -// default: { -// bprintf(PRINT_NORMAL, "Attempt to write word value %x to location %x\n", wordValue, sekAddress); -// } - } -} - -// ---------------------------------------------------------------------------- - -static UINT8 s1945_table[256] = { - 0x00, 0x00, 0x64, 0xae, 0x00, 0x00, 0x26, 0x2c, 0x00, 0x00, 0x2c, 0xda, 0x00, 0x00, 0x2c, 0xbc, - 0x00, 0x00, 0x2c, 0x9e, 0x00, 0x00, 0x2f, 0x0e, 0x00, 0x00, 0x31, 0x10, 0x00, 0x00, 0xc5, 0x1e, - 0x00, 0x00, 0x32, 0x90, 0x00, 0x00, 0xac, 0x5c, 0x00, 0x00, 0x2b, 0xc0 -}; - -static UINT8 s1945j_table[256] = { - 0x00, 0x00, 0x64, 0xb6, 0x00, 0x00, 0x26, 0x2c, 0x00, 0x00, 0x2c, 0xda, 0x00, 0x00, 0x2c, 0xbc, - 0x00, 0x00, 0x2c, 0x9e, 0x00, 0x00, 0x2f, 0x0e, 0x00, 0x00, 0x31, 0x10, 0x00, 0x00, 0xc5, 0x92, - 0x00, 0x00, 0x32, 0x90, 0x00, 0x00, 0xac, 0x64, 0x00, 0x00, 0x2b, 0xc0 -}; - -static UINT8 s1945a_table[256] = { - 0x00, 0x00, 0x64, 0xbe, 0x00, 0x00, 0x26, 0x2c, 0x00, 0x00, 0x2c, 0xda, 0x00, 0x00, 0x2c, 0xbc, - 0x00, 0x00, 0x2c, 0x9e, 0x00, 0x00, 0x2f, 0x0e, 0x00, 0x00, 0x31, 0x10, 0x00, 0x00, 0xc7, 0x2a, - 0x00, 0x00, 0x32, 0x90, 0x00, 0x00, 0xad, 0x4c, 0x00, 0x00, 0x2b, 0xc0 -}; - -static UINT8 s1945_mcu_direction, s1945_mcu_latch1, s1945_mcu_latch2, s1945_mcu_inlatch, s1945_mcu_index; -static UINT8 s1945_mcu_latching, s1945_mcu_mode, s1945_mcu_control, s1945_mcu_bctrl; -static const UINT8 *s1945_mcu_table; - -static INT32 TengaiMCUScan(INT32 nAction, INT32 *pnMin) -{ - if (pnMin) { // Return minimum compatible version - *pnMin = 0x020998; - } - - SCAN_VAR(s1945_mcu_direction); - SCAN_VAR(s1945_mcu_latch1); - SCAN_VAR(s1945_mcu_latch2); - SCAN_VAR(s1945_mcu_inlatch); - SCAN_VAR(s1945_mcu_index); - SCAN_VAR(s1945_mcu_latching); - SCAN_VAR(s1945_mcu_mode); - SCAN_VAR(s1945_mcu_control); - SCAN_VAR(s1945_mcu_bctrl); - - if (nAction & ACB_WRITE) { - PsikyoSetTileBank(1, (s1945_mcu_bctrl >> 6) & 3); - PsikyoSetTileBank(0, (s1945_mcu_bctrl >> 4) & 3); - } - - return 0; -} - -static void TengaiMCUInit(const UINT8 *mcu_table) -{ - s1945_mcu_direction = 0x00; - s1945_mcu_inlatch = 0xff; - s1945_mcu_latch1 = 0xff; - s1945_mcu_latch2 = 0xff; - s1945_mcu_latching = 0x5; - s1945_mcu_control = 0xff; - s1945_mcu_index = 0; - s1945_mcu_mode = 0; - s1945_mcu_table = mcu_table; - s1945_mcu_bctrl = 0x00; -} - -void tengaiMCUWrite(UINT32 offset, UINT8 data) -{ - switch (offset) { - case 0x06: - s1945_mcu_inlatch = data; - break; - case 0x07: - PsikyoSetTileBank(1, (data >> 6) & 3); - PsikyoSetTileBank(0, (data >> 4) & 3); - s1945_mcu_bctrl = data; - break; - case 0x08: - s1945_mcu_control = data; - break; - case 0x09: - s1945_mcu_direction = data; - break; - case 0x0b: - switch (data | (s1945_mcu_direction ? 0x100 : 0)) { - case 0x11c: - s1945_mcu_latching = 5; - s1945_mcu_index = s1945_mcu_inlatch; - break; - case 0x013: -// logerror("MCU: Table read index %02x\n", s1945_mcu_index); - s1945_mcu_latching = 1; - s1945_mcu_latch1 = s1945_mcu_table[s1945_mcu_index]; - break; - case 0x113: - s1945_mcu_mode = s1945_mcu_inlatch; - if(s1945_mcu_mode == 1) { - s1945_mcu_latching &= ~1; - s1945_mcu_latch2 = 0x55; - } else { - // Go figure. - s1945_mcu_latching &= ~1; - s1945_mcu_latching |= 2; - } - s1945_mcu_latching &= ~4; - s1945_mcu_latch1 = s1945_mcu_inlatch; - break; - case 0x010: - case 0x110: - s1945_mcu_latching |= 4; - break; - default: -// logerror("MCU: function %02x, direction %02x, latch1 %02x, latch2 %02x (%x)\n", data, s1945_mcu_direction, s1945_mcu_latch1, s1945_mcu_latch2, activecpu_get_pc()); - break; - } - break; -// default: -// logerror("MCU.w %x, %02x (%x)\n", offset, data, activecpu_get_pc()); - } -} - -UINT16 tengaiMCURead(UINT32 offset) -{ - switch (offset) { - case 0: { - UINT16 res; - if (s1945_mcu_control & 16) { - res = s1945_mcu_latching & 4 ? 0xff00 : s1945_mcu_latch1 << 8; - s1945_mcu_latching |= 4; - } else { - res = s1945_mcu_latching & 1 ? 0xff00 : s1945_mcu_latch2 << 8; - s1945_mcu_latching |= 1; - } - res |= s1945_mcu_bctrl & 0x00f0; - return res; - } - case 1: - return (s1945_mcu_latching << 8) | 0x0800; - } - - return 0; -} - -UINT8 __fastcall tengaiReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xC00000: // Joysticks - return ~DrvInput[0] >> 8; - case 0xC00001: - return ~DrvInput[0] & 0xFF; - case 0xC00002: // Inputs / Sound CPU status - return ~DrvInput[1] >> 8; - case 0xC00003: -// bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); - PsikyoSynchroniseZ80(0); - if (!nSoundlatchAck) { - return ~(DrvInput[1] | 0x04) & 0xFF; - } - return ~(DrvInput[1] | 0x84) & 0xFF; - case 0xC00004: // DIPs - return ~DrvInput[2] >> 8; - case 0xC00005: - return ~DrvInput[2] & 0xFF; - case 0xC00006: // Region / MCU - return tengaiMCURead(0) >> 8; - case 0xC00007: - return ((~DrvInput[3] & 0x0F) | tengaiMCURead(0)) & 0xFF; - case 0xC00008: // MCU - return tengaiMCURead(1) >> 8; - case 0xC00009: - return tengaiMCURead(1) & 0xFF; - -// default: { -// bprintf(PRINT_NORMAL, "Attempt to read byte value of location %x\n", sekAddress); -// } - } - return 0; -} - -UINT16 __fastcall tengaiReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xC00000: // Joysticks - return ~DrvInput[0]; - case 0xC00002: { // Inputs / Sound CPU status -// bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); - PsikyoSynchroniseZ80(0); - if (!nSoundlatchAck) { - return ~(DrvInput[1] | 0x04); - } - return ~(DrvInput[1] | 0x84); - } - case 0xC00004: // DIPs - return ~DrvInput[2]; - case 0xC00006: // Region / MCU - return (~DrvInput[3] & 0x0F) | tengaiMCURead(0); - case 0xC00008: // MCU - return tengaiMCURead(1); - -// default: { -// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); -// } - } - return 0; -} - -void __fastcall tengaiWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - case 0xC00004: - case 0xC00005: - case 0xC00006: - case 0xC00007: - case 0xC00008: - case 0xC00009: - case 0xC0000A: - case 0xC0000B: - tengaiMCUWrite(sekAddress & 0x0F, byteValue); - break; - - case 0xC00011: // Sound latch - SendSoundCommand(byteValue); - break; - - default: { -// bprintf(PRINT_NORMAL, "Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } - } -} - -void __fastcall tengaiWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - case 0xC00004: - case 0xC00005: - case 0xC00006: - case 0xC00007: - case 0xC00008: - case 0xC00009: - case 0xC0000A: - case 0xC0000B: - tengaiMCUWrite((sekAddress & 0x0F), wordValue >> 8); - tengaiMCUWrite((sekAddress & 0x0F) + 1, wordValue & 0xFF); - break; - - case 0xC00010: // Sound latch - SendSoundCommand(wordValue & 0xFF); - break; - -// default: { -// bprintf(PRINT_NORMAL, "Attempt to write word value %x to location %x\n", wordValue, sekAddress); -// } - } -} - -// ---------------------------------------------------------------------------- - -void __fastcall PsikyoWriteBytePalette(UINT32 sekAddress, UINT8 byteValue) -{ - PsikyoPalWriteByte(sekAddress & 0x1FFF, byteValue); -} - -void __fastcall PsikyoWriteWordPalette(UINT32 sekAddress, UINT16 wordValue) -{ - PsikyoPalWriteWord(sekAddress & 0x1FFF, wordValue); -} - -// ---------------------------------------------------------------------------- - -static INT32 DrvExit() -{ - switch (PsikyoHardwareVersion) { - case PSIKYO_HW_SAMURAIA: - case PSIKYO_HW_GUNBIRD: { - BurnYM2610Exit(); - break; - } - case PSIKYO_HW_S1945: - case PSIKYO_HW_TENGAI: { - BurnYMF278BExit(); - break; - } - } - - PsikyoSpriteExit(); - PsikyoTileExit(); - PsikyoPalExit(); - - SekExit(); - ZetExit(); - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDoReset() -{ - { - SekOpen(0); - SekReset(); - SekClose(); - } - - { - ZetOpen(0); - - nPsikyoZ80Bank = -1; - switch (PsikyoHardwareVersion) { - case PSIKYO_HW_SAMURAIA: { - samuraiaZ80SetBank(0); - break; - } - case PSIKYO_HW_GUNBIRD: - case PSIKYO_HW_S1945: - case PSIKYO_HW_TENGAI: { - gunbirdZ80SetBank(0); - break; - } - } - - ZetReset(); - - ZetClose(); - } - - switch (PsikyoHardwareVersion) { - case PSIKYO_HW_SAMURAIA: - case PSIKYO_HW_GUNBIRD: { - BurnYM2610Reset(); - break; - } - case PSIKYO_HW_S1945: - case PSIKYO_HW_TENGAI: { - BurnYMF278BReset(); - break; - } - } - - nSoundlatch = 0; - nSoundlatchAck = 1; - - nCyclesDone[0] = nCyclesDone[1] = 0; - - return 0; -} - -static INT32 DrvDraw() -{ - PsikyoPalUpdate(); - PsikyoTileRender(); - - return 0; -} - -static INT32 samuraiaCheckSleep(INT32) -{ - return 0; -} - -static INT32 gunbirdCheckSleep(INT32) -{ - return 0; -} - -static INT32 gunbirdjCheckSleep(INT32) -{ - return 0; -} - -static INT32 gunbirdkCheckSleep(INT32) -{ - return 0; -} - -static INT32 s1945jnCheckSleep(INT32) -{ - return 0; -} - -static INT32 psikyoCheckSleep(INT32) -{ -// bprintf(PRINT_NORMAL, "0x%06X\n", SekGetPC(-1)); - - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nCyclesVBlank; - INT32 nInterleave = 16; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x0000; // Joysticks - DrvInput[1] = 0x0000; - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << (i + 8); - DrvInput[0] |= (DrvJoy2[i] & 1) << (i + 0); - - DrvInput[1] |= (DrvInp1[i] & 1) << (i + 0); - DrvInput[1] |= (DrvInp2[i] & 1) << (i + 8); - } - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - - if (nPrevBurnCPUSpeedAdjust != nBurnCPUSpeedAdjust) { - // 68K CPU clock is 16MHz, modified by nBurnCPUSpeedAdjust - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (INT32)(256.0 * 15625.0 / 263.5)); - // Z80 CPU clock is always 4MHz - nCyclesTotal[1] = (INT32)(4000000.0 / (15625.0 / 263.5)); - - // 68K cycles executed each scanline - SekSetCyclesScanline((INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (256 * 15625))); - - nPrevBurnCPUSpeedAdjust = nBurnCPUSpeedAdjust; - } - - nCyclesVBlank = nCyclesTotal[0] * (INT32)(224.0 * 2.0) / (INT32)(263.5 * 2.0); - bVBlank = 0x01; - - ZetOpen(0); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - for (INT32 i = 1; i <= nInterleave; i++) { - - // Run 68000 - INT32 nNext = i * nCyclesTotal[0] / nInterleave; - - // See if we need to trigger the VBlank interrupt - if (bVBlank && nNext >= nCyclesVBlank) { - if (nCyclesDone[0] < nCyclesVBlank) { - nCyclesSegment = nCyclesVBlank - nCyclesDone[0]; - if (!CheckSleep(0)) { // See if this CPU is busywaiting - nCyclesDone[0] += SekRun(nCyclesSegment); - } else { - nCyclesDone[0] += SekIdle(nCyclesSegment); - } - } - - if (pBurnDraw != NULL) { - DrvDraw(); // Draw screen if needed - } - PsikyoSpriteBuffer(); - - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - bVBlank = 0x00; - } - - nCyclesSegment = nNext - nCyclesDone[0]; - if (!CheckSleep(0)) { // See if this CPU is busywaiting - nCyclesDone[0] += SekRun(nCyclesSegment); - } else { - nCyclesDone[0] += SekIdle(nCyclesSegment); - } - } - - switch (PsikyoHardwareVersion) { - case PSIKYO_HW_SAMURAIA: - case PSIKYO_HW_GUNBIRD: { - nCycles68KSync = SekTotalCycles(); - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - break; - } - case PSIKYO_HW_S1945: - case PSIKYO_HW_TENGAI: { - nCycles68KSync = SekTotalCycles(); - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYMF278BUpdate(nBurnSoundLen); - break; - } - default: { - ZetIdle(nCyclesTotal[1] - ZetTotalCycles()); - } - } - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; - - ZetClose(); - SekClose(); - - return 0; -} - -// ---------------------------------------------------------------------------- -// Loading - -static void Nibbleswap(UINT8* pData, INT32 nLen) -{ - for (INT32 i = nLen -2 ; i >= 0; i -= 2) { - UINT16 c = ((pData[i + 0] >> 4) | (pData[i + 0] << 8)) & 0x0F0F; - ((UINT16*)pData)[i + 0] = BURN_ENDIAN_SWAP_INT16(((pData[i + 1] >> 4) | (pData[i + 1] << 8))) & 0x0F0F; - ((UINT16*)pData)[i + 1] = BURN_ENDIAN_SWAP_INT16(c); - } - - return; -} - -static INT32 samuraiaLoadRoms() -{ - // Load 68000 ROM - UINT8* pTemp = (UINT8*)BurnMalloc(0x080000); - if (pTemp == NULL) { - return 1; - } - - BurnLoadRom(pTemp + 0x000000, 0, 1); - BurnLoadRom(pTemp + 0x040000, 1, 1); - - for (INT32 i = 0; i < 0x020000; i++) { - ((UINT16*)Psikyo68KROM)[2 * i + 0] = ((UINT16*)pTemp)[0x000000 + i]; - ((UINT16*)Psikyo68KROM)[2 * i + 1] = ((UINT16*)pTemp)[0x020000 + i]; - } - - BurnFree(pTemp); - - BurnLoadRom(PsikyoSpriteROM + 0x000000, 2, 1); - Nibbleswap(PsikyoSpriteROM, 0x200000); - - BurnLoadRom(PsikyoSpriteLUT, 3, 1); - - BurnLoadRom(PsikyoTileROM + 0x000000, 4, 1); - BurnLoadRom(PsikyoTileROM + 0x100000, 5, 1); - Nibbleswap(PsikyoTileROM, 0x200000); - - BurnLoadRom(PsikyoZ80ROM, 6, 1); - - BurnLoadRom(PsikyoSampleROM02, 7, 1); - - for (INT32 i = 0; i < 0x100000; i++) { - PsikyoSampleROM02[i] = ((PsikyoSampleROM02[i] & 0x80) >> 1) | ((PsikyoSampleROM02[i] & 0x40) << 1) | (PsikyoSampleROM02[i] & 0x3F); - } - - return 0; -} - -static INT32 gunbirdLoadRoms() -{ - // Load 68000 ROM - UINT8* pTemp = (UINT8*)BurnMalloc(0x100000); - if (pTemp == NULL) { - return 1; - } - - BurnLoadRom(pTemp + 0x000000, 0, 1); - BurnLoadRom(pTemp + 0x080000, 1, 1); - - for (INT32 i = 0; i < 0x040000; i++) { - ((UINT16*)Psikyo68KROM)[2 * i + 0] = ((UINT16*)pTemp)[0x000000 + i]; - ((UINT16*)Psikyo68KROM)[2 * i + 1] = ((UINT16*)pTemp)[0x040000 + i]; - } - - BurnFree(pTemp); - - BurnLoadRom(PsikyoSpriteROM + 0x000000, 2, 1); - BurnLoadRom(PsikyoSpriteROM + 0x200000, 3, 1); - BurnLoadRom(PsikyoSpriteROM + 0x400000, 4, 1); - if (PsikyoSpriteROMSize > 0x0C00000) { - BurnLoadRom(PsikyoSpriteROM + 0x600000, 5, 1); - } - Nibbleswap(PsikyoSpriteROM, PsikyoSpriteROMSize >> 1); - - BurnLoadRom(PsikyoSpriteLUT, 6, 1); - - BurnLoadRom(PsikyoTileROM, 7, 1); - Nibbleswap(PsikyoTileROM, 0x200000); - - BurnLoadRom(PsikyoZ80ROM, 8, 1); - - BurnLoadRom(PsikyoSampleROM01, 9, 1); - BurnLoadRom(PsikyoSampleROM02, 10, 1); - - return 0; -} - -static INT32 s1945LoadRoms() -{ - // Load 68000 ROM - UINT8* pTemp = (UINT8*)BurnMalloc(0x100000); - if (pTemp == NULL) { - return 1; - } - - BurnLoadRom(pTemp + 0x000000, 0, 1); - BurnLoadRom(pTemp + 0x080000, 1, 1); - - for (INT32 i = 0; i < 0x040000; i++) { - ((UINT16*)Psikyo68KROM)[2 * i + 0] = ((UINT16*)pTemp)[0x000000 + i]; - ((UINT16*)Psikyo68KROM)[2 * i + 1] = ((UINT16*)pTemp)[0x040000 + i]; - } - - BurnFree(pTemp); - - BurnLoadRom(PsikyoSpriteROM + 0x000000, 2, 1); - BurnLoadRom(PsikyoSpriteROM + 0x200000, 3, 1); - BurnLoadRom(PsikyoSpriteROM + 0x400000, 4, 1); - BurnLoadRom(PsikyoSpriteROM + 0x600000, 5, 1); - Nibbleswap(PsikyoSpriteROM, 0x800000); - - BurnLoadRom(PsikyoSpriteLUT, 6, 1); - - BurnLoadRom(PsikyoTileROM, 7, 1); - Nibbleswap(PsikyoTileROM, 0x200000); - - BurnLoadRom(PsikyoZ80ROM, 8, 1); - - BurnLoadRom(PsikyoSampleROM02, 9, 1); - - return 0; -} - -static void tengaiNibbleswap(UINT8* pData, INT32 nLen) -{ - for (INT32 i = nLen - 1; i >= 0; i--) { - ((UINT16*)pData)[i] = BURN_ENDIAN_SWAP_INT16(((pData[i] >> 4) | (pData[i] << 8))) & 0x0F0F; - } - - return; -} - -static INT32 tengaiLoadRoms() -{ - // Load 68000 ROM - UINT8* pTemp = (UINT8*)BurnMalloc(0x100000); - if (pTemp == NULL) { - return 1; - } - - BurnLoadRom(pTemp + 0x000000, 0, 1); - BurnLoadRom(pTemp + 0x080000, 1, 1); - - for (INT32 i = 0; i < 0x040000; i++) { - ((UINT16*)Psikyo68KROM)[2 * i + 0] = ((UINT16*)pTemp)[0x000000 + i]; - ((UINT16*)Psikyo68KROM)[2 * i + 1] = ((UINT16*)pTemp)[0x040000 + i]; - } - - BurnFree(pTemp); - - BurnLoadRom(PsikyoSpriteROM + 0x000000, 2, 1); - BurnLoadRom(PsikyoSpriteROM + 0x200000, 3, 1); - BurnLoadRom(PsikyoSpriteROM + 0x400000, 4, 1); - tengaiNibbleswap(PsikyoSpriteROM, 0x600000); - - BurnLoadRom(PsikyoSpriteLUT, 5, 1); - - BurnLoadRom(PsikyoTileROM, 6, 1); - tengaiNibbleswap(PsikyoTileROM, 0x400000); - - BurnLoadRom(PsikyoZ80ROM, 7, 1); - - BurnLoadRom(PsikyoSampleROM02 + 0x000000, 8, 1); - BurnLoadRom(PsikyoSampleROM02 + 0x200000, 9, 1); - - return 0; -} - -// ---------------------------------------------------------------------------- - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers - -static INT32 MemIndex() -{ - UINT8* Next; Next = Mem; - - Psikyo68KROM = Next; Next += 0x100000; // 68K program - PsikyoZ80ROM = Next; Next += 0x020000; // Z80 program - PsikyoSpriteROM = Next; Next += PsikyoSpriteROMSize; - PsikyoSpriteLUT = Next; Next += 0x040000; - PsikyoTileROM = Next; Next += PsikyoTileROMSize; - PsikyoSampleROM01 = Next; Next += PsikyoSampleROM01Size; - PsikyoSampleROM02 = Next; Next += PsikyoSampleROM02Size; - RamStart = Next; - Psikyo68KRAM = Next; Next += 0x020000; // 68K work RAM - if (PsikyoHardwareVersion == PSIKYO_HW_SAMURAIA) { - PsikyoZ80RAM = Next; Next += 0x000800; // Z80 work RAM - } else { - PsikyoZ80RAM = Next; Next += 0x000200; // Z80 work RAM - } - PsikyoTileRAM[0] = Next; Next += 0x002000; // Tile layer 0 - PsikyoTileRAM[1] = Next; Next += 0x002000; // Tile layer 1 - PsikyoTileRAM[2] = Next; Next += 0x004000; // Tile attribute RAM - PsikyoSpriteRAM = Next; Next += 0x002000; - PsikyoPalSrc = Next; Next += 0x002000; // palette - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - BurnSetRefreshRate(15625.0 / 263.5); - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "samuraia") || !strcmp(BurnDrvGetTextA(DRV_NAME), "sngkace")) { - PsikyoHardwareVersion = PSIKYO_HW_SAMURAIA; - - CheckSleep = samuraiaCheckSleep; - - PsikyoTileROMSize = 0x0400000; - PsikyoSpriteROMSize = 0x0400000; - - PsikyoSampleROM01Size = 0; - PsikyoSampleROM02Size = 0x100000; - - bPsikyoClearBackground = false; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gunbird") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gunbirdj") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gunbirdk") || !strcmp(BurnDrvGetTextA(DRV_NAME), "btlkroad") || !strcmp(BurnDrvGetTextA(DRV_NAME), "s1945jn")) { - PsikyoHardwareVersion = PSIKYO_HW_GUNBIRD; - - CheckSleep = psikyoCheckSleep; - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gunbird")) { - CheckSleep = gunbirdCheckSleep; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gunbirdj")) { - CheckSleep = gunbirdjCheckSleep; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gunbirdk")) { - CheckSleep = gunbirdkCheckSleep; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945jn")) { - CheckSleep = s1945jnCheckSleep; - } - - PsikyoTileROMSize = 0x0400000; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "btlkroad")) { - PsikyoSpriteROMSize = 0x0C00000; - } else { - PsikyoSpriteROMSize = 0x1000000; - } - - PsikyoSampleROM01Size = 0x080000; - PsikyoSampleROM02Size = 0x100000; - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945jn")) { - bPsikyoClearBackground = false; - } else { - bPsikyoClearBackground = true; - } - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945") || !strcmp(BurnDrvGetTextA(DRV_NAME), "s1945j") || !strcmp(BurnDrvGetTextA(DRV_NAME), "s1945k") || !strcmp(BurnDrvGetTextA(DRV_NAME), "s1945a")) { - PsikyoHardwareVersion = PSIKYO_HW_S1945; - - CheckSleep = psikyoCheckSleep; - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945j")) TengaiMCUInit(s1945j_table); - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945") || !strcmp(BurnDrvGetTextA(DRV_NAME), "s1945k")) TengaiMCUInit(s1945_table); - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945a")) TengaiMCUInit(s1945a_table); - - PsikyoTileROMSize = 0x0400000; - PsikyoSpriteROMSize = 0x1000000; - - PsikyoSampleROM01Size = 0; - PsikyoSampleROM02Size = 0x200000; - - bPsikyoClearBackground = false; - } - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "tengai") || !strcmp(BurnDrvGetTextA(DRV_NAME), "tengaij")) { - PsikyoHardwareVersion = PSIKYO_HW_TENGAI; - - CheckSleep = psikyoCheckSleep; - - TengaiMCUInit(s1945_table); - - PsikyoTileROMSize = 0x0800000; - PsikyoSpriteROMSize = 0x0C00000; - - PsikyoSampleROM01Size = 0; - PsikyoSampleROM02Size = 0x400000; - - bPsikyoClearBackground = false; - } - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - switch (PsikyoHardwareVersion) { - case PSIKYO_HW_SAMURAIA: { - if (samuraiaLoadRoms()) { - return 1; - } - break; - } - case PSIKYO_HW_GUNBIRD: { - if (gunbirdLoadRoms()) { - return 1; - } - break; - } - case PSIKYO_HW_S1945: { - if (s1945LoadRoms()) { - return 1; - } - break; - } - case PSIKYO_HW_TENGAI: { - if (tengaiLoadRoms()) { - return 1; - } - break; - } - } - - { - // 68EC020 setup - SekInit(0, 0x68EC020); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Psikyo68KROM, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(PsikyoSpriteRAM, 0x400000, 0x401FFF, SM_RAM); - SekMapMemory(PsikyoTileRAM[0], 0x800000, 0x801FFF, SM_RAM); - SekMapMemory(PsikyoTileRAM[1], 0x802000, 0x803FFF, SM_RAM); - SekMapMemory(PsikyoTileRAM[2], 0x804000, 0x807FFF, SM_RAM); - SekMapMemory(Psikyo68KRAM, 0xFE0000, 0xFFFFFF, SM_RAM); - - SekMapMemory(PsikyoPalSrc, 0x600000, 0x601FFF, SM_ROM); // Palette RAM (write goes through handler) - SekMapHandler(1, 0x600000, 0x601FFF, SM_WRITE); // - - switch (PsikyoHardwareVersion) { - case PSIKYO_HW_SAMURAIA: { - SekSetReadWordHandler(0, samuraiaReadWord); - SekSetReadByteHandler(0, samuraiaReadByte); - SekSetWriteWordHandler(0, gunbirdWriteWord); - SekSetWriteByteHandler(0, gunbirdWriteByte); - break; - } - case PSIKYO_HW_GUNBIRD: { - SekSetReadWordHandler(0, gunbirdReadWord); - SekSetReadByteHandler(0, gunbirdReadByte); - SekSetWriteWordHandler(0, gunbirdWriteWord); - SekSetWriteByteHandler(0, gunbirdWriteByte); - break; - } - case PSIKYO_HW_S1945: - case PSIKYO_HW_TENGAI: { - SekSetReadWordHandler(0, tengaiReadWord); - SekSetReadByteHandler(0, tengaiReadByte); - SekSetWriteWordHandler(0, tengaiWriteWord); - SekSetWriteByteHandler(0, tengaiWriteByte); - break; - } - } - - SekSetWriteWordHandler(1, PsikyoWriteWordPalette); - SekSetWriteByteHandler(1, PsikyoWriteBytePalette); - - SekClose(); - } - - { - // Z80 setup - ZetInit(0); - ZetOpen(0); - - switch (PsikyoHardwareVersion) { - case PSIKYO_HW_SAMURAIA: { - // fixed ROM - ZetMapArea(0x0000, 0x77FF, 0, PsikyoZ80ROM); - ZetMapArea(0x0000, 0x77FF, 2, PsikyoZ80ROM); - // Work RAM - ZetMapArea(0x7800, 0x7FFF, 0, PsikyoZ80RAM); - ZetMapArea(0x7800, 0x7FFF, 1, PsikyoZ80RAM); - ZetMapArea(0x7800, 0x7FFF, 2, PsikyoZ80RAM); - - ZetMemEnd(); - - ZetSetInHandler(samuraiaZ80In); - ZetSetOutHandler(samuraiaZ80Out); - break; - } - case PSIKYO_HW_GUNBIRD: { - // fixed ROM - ZetMapArea(0x0000, 0x7FFF, 0, PsikyoZ80ROM); - ZetMapArea(0x0000, 0x7FFF, 2, PsikyoZ80ROM); - // Work RAM - ZetMapArea(0x8000, 0x81FF, 0, PsikyoZ80RAM); - ZetMapArea(0x8000, 0x81FF, 1, PsikyoZ80RAM); - ZetMapArea(0x8000, 0x81FF, 2, PsikyoZ80RAM); - - ZetMemEnd(); - - ZetSetInHandler(gunbirdZ80In); - ZetSetOutHandler(gunbirdZ80Out); - break; - } - case PSIKYO_HW_S1945: - case PSIKYO_HW_TENGAI: { - // fixed ROM - ZetMapArea(0x0000, 0x7FFF, 0, PsikyoZ80ROM); - ZetMapArea(0x0000, 0x7FFF, 2, PsikyoZ80ROM); - // Work RAM - ZetMapArea(0x8000, 0x81FF, 0, PsikyoZ80RAM); - ZetMapArea(0x8000, 0x81FF, 1, PsikyoZ80RAM); - ZetMapArea(0x8000, 0x81FF, 2, PsikyoZ80RAM); - - ZetMemEnd(); - ZetSetInHandler(tengaiZ80In); - ZetSetOutHandler(tengaiZ80Out); - break; - } - } - - ZetClose(); - } - - PsikyoPalInit(); - - PsikyoTileInit(PsikyoTileROMSize); - PsikyoSpriteInit(PsikyoSpriteROMSize); - - switch (PsikyoHardwareVersion) { - case PSIKYO_HW_SAMURAIA: - case PSIKYO_HW_GUNBIRD: { - BurnYM2610Init(8000000, PsikyoSampleROM02, &PsikyoSampleROM02Size, PsikyoSampleROM01, &PsikyoSampleROM01Size, &PsikyoFMIRQHandler, PsikyoSynchroniseStream, PsikyoGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 1.20, BURN_SND_ROUTE_BOTH); - break; - } - case PSIKYO_HW_S1945: - case PSIKYO_HW_TENGAI: { - BurnYMF278BInit(0, PsikyoSampleROM02, &PsikyoFMIRQHandler, PsikyoSynchroniseStream); - BurnYMF278BSetRoute(BURN_SND_YMF278B_YMF278B_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYMF278BSetRoute(BURN_SND_YMF278B_YMF278B_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnTimerAttachZet(4000000); - break; - } - } - - nPrevBurnCPUSpeedAdjust = -1; - - DrvDoReset(); // Reset machine - - return 0; -} - -// ---------------------------------------------------------------------------- -// Savestates / scanning - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029521; - } - - if (nAction & ACB_MEMORY_ROM) { // Scan all memory, devices & variables - ba.Data = Psikyo68KROM; - ba.nLen = 0x00100000; - ba.nAddress = 0; - ba.szName = "68K ROM"; - BurnAcb(&ba); - - ba.Data = PsikyoZ80ROM; - ba.nLen = 0x00020000; - ba.nAddress = 0; - ba.szName = "Z80 ROM"; - BurnAcb(&ba); - } - - if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables - ba.Data = Psikyo68KRAM; - ba.nLen = 0x00020000; - ba.nAddress = 0; - ba.szName = "68K RAM"; - BurnAcb(&ba); - - ba.Data = PsikyoZ80RAM; - if (PsikyoHardwareVersion == PSIKYO_HW_SAMURAIA) { - ba.nLen = 0x0000800; - } else { - ba.nLen = 0x0000200; - } - ba.nAddress = 0; - ba.szName = "Z80 RAM"; - BurnAcb(&ba); - - ba.Data = PsikyoTileRAM[0]; - ba.nLen = 0x00002000; - ba.nAddress = 0; - ba.szName = "Tilemap 0"; - BurnAcb(&ba); - - ba.Data = PsikyoTileRAM[1]; - ba.nLen = 0x00002000; - ba.nAddress = 0; - ba.szName = "Tilemap 1"; - BurnAcb(&ba); - - ba.Data = PsikyoTileRAM[2]; - ba.nLen = 0x00004000; - ba.nAddress = 0; - ba.szName = "Tilemap attributes"; - BurnAcb(&ba); - - ba.Data = PsikyoSpriteRAM; - ba.nLen = 0x00002000; - ba.nAddress = 0; - ba.szName = "Sprite tables"; - BurnAcb(&ba); - - ba.Data = PsikyoPalSrc; - ba.nLen = 0x00002000; - ba.nAddress = 0; - ba.szName = "Palette"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - - SekScan(nAction); // Scan 68000 state - - ZetScan(nAction); // Scan Z80 state - - SCAN_VAR(nCyclesDone); - - SCAN_VAR(bVBlank); - - BurnYM2610Scan(nAction, pnMin); - - SCAN_VAR(nSoundlatch); SCAN_VAR(nSoundlatchAck); - - SCAN_VAR(nPsikyoZ80Bank); - - TengaiMCUScan(nAction, pnMin); - - if (nAction & ACB_WRITE) { - int nBank = nPsikyoZ80Bank; - nPsikyoZ80Bank = -1; - - switch (PsikyoHardwareVersion) { - case PSIKYO_HW_SAMURAIA: { - ZetOpen(0); - samuraiaZ80SetBank(nBank); - ZetClose(); - break; - } - case PSIKYO_HW_GUNBIRD: - case PSIKYO_HW_S1945: - case PSIKYO_HW_TENGAI: { - ZetOpen(0); - gunbirdZ80SetBank(nBank); - ZetClose(); - break; - } - } - - PsikyoRecalcPalette = 1; - } - } - - return 0; -} - -// ---------------------------------------------------------------------------- -// Rom information - -// Samurai Aces / Sengoku Ace - -static struct BurnRomInfo samuraiaRomDesc[] = { - { "4-u127.bin", 0x040000, 0x8C9911CA, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "5-u126.bin", 0x040000, 0xD20C3EF0, BRF_ESS | BRF_PRG }, // 1 - - { "u14.bin", 0x200000, 0x00A546CB, BRF_GRA }, // 2 Sprite data - - { "u11.bin", 0x040000, 0x11A04D91, BRF_GRA }, // 3 Sprite LUT - - { "u34.bin", 0x100000, 0xE6A75BD8, BRF_GRA }, // 4 Tile data - { "u35.bin", 0x100000, 0xC4CA0164, BRF_GRA }, // 5 - - { "3-u58.bin", 0x020000, 0x310F5C76, BRF_ESS | BRF_PRG }, // 6 CPU #1 code - - { "u68.bin", 0x100000, 0x9A7F6C34, BRF_SND }, // 7 YM2610 (delta-t) ADPCM data -}; - -STD_ROM_PICK(samuraia) -STD_ROM_FN(samuraia) - -static struct BurnRomInfo sngkaceRomDesc[] = { - { "1-u127.bin", 0x040000, 0x6C45B2F8, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "2-u126.bin", 0x040000, 0x845A6760, BRF_ESS | BRF_PRG }, // 1 - - { "u14.bin", 0x200000, 0x00A546CB, BRF_GRA }, // 2 Sprite data - - { "u11.bin", 0x040000, 0x11A04D91, BRF_GRA }, // 3 Sprite LUT - - { "u34.bin", 0x100000, 0xE6A75BD8, BRF_GRA }, // 4 Tile data - { "u35.bin", 0x100000, 0xC4CA0164, BRF_GRA }, // 5 - - { "3-u58.bin", 0x020000, 0x310F5C76, BRF_ESS | BRF_PRG }, // 6 CPU #1 code - - { "u68.bin", 0x100000, 0x9A7F6C34, BRF_SND }, // 7 YM2610 (delta-t) ADPCM data -}; - -STD_ROM_PICK(sngkace) -STD_ROM_FN(sngkace) - -struct BurnDriver BurnDrvSamuraiA = { - "samuraia", NULL, NULL, NULL, "1993", - "Samurai Aces (World)\0", NULL, "Psikyo / Banpresto", "Psikyo 68EC020", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, - NULL, samuraiaRomInfo, samuraiaRomName, NULL, NULL, gunbirdInputInfo, samuraiaDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvSngkAce = { - "sngkace", "samuraia", NULL, NULL, "1993", - "Sengoku Ace (Japan)\0", NULL, "Psikyo / Banpresto", "Psikyo 68EC020", - L"\u6226\u56FD\u30A8\u30FC\u30B9 (Japan)\0Sengoku Ace\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, - NULL, sngkaceRomInfo, sngkaceRomName, NULL, NULL, gunbirdInputInfo, sngkaceDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 224, 320, 3, 4 -}; - -// Gunbird - -static struct BurnRomInfo gunbirdRomDesc[] = { - { "4.u46", 0x040000, 0xB78EC99D, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "5.u39", 0x040000, 0x925F095D, BRF_ESS | BRF_PRG }, // 1 - - { "u14.bin", 0x200000, 0x7D7E8A00, BRF_GRA }, // 2 Sprite data - { "u24.bin", 0x200000, 0x5E3FFC9D, BRF_GRA }, // 3 - { "u15.bin", 0x200000, 0xA827BFB5, BRF_GRA }, // 4 - { "u25.bin", 0x100000, 0xEF652E0C, BRF_GRA }, // 5 - - { "u3.bin", 0x040000, 0x0905AEB2, BRF_GRA }, // 6 Sprite LUT - - { "u33.bin", 0x200000, 0x54494E6B, BRF_GRA }, // 7 Tile data - - { "3.u71", 0x020000, 0x2168E4BA, BRF_ESS | BRF_PRG }, // 8 CPU #1 code - - { "u64.bin", 0x080000, 0xE187ED4F, BRF_SND }, // 9 YM2610 ADPCM (delta-t) data - { "u56.bin", 0x100000, 0x9E07104D, BRF_SND }, // 10 YM2610 ADPCM data - - { "3020.u19", 0x000001, 0x00000000, BRF_OPT | BRF_NODUMP },// 11 - { "3021.u69", 0x000001, 0x00000000, BRF_OPT | BRF_NODUMP },// 12 -}; - -STD_ROM_PICK(gunbird) -STD_ROM_FN(gunbird) - -static struct BurnRomInfo gunbirdjRomDesc[] = { - { "1.u46", 0x040000, 0x474ABD69, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "2.u39", 0x040000, 0x3E3E661F, BRF_ESS | BRF_PRG }, // 1 - - { "u14.bin", 0x200000, 0x7D7E8A00, BRF_GRA }, // 2 Sprite data - { "u24.bin", 0x200000, 0x5E3FFC9D, BRF_GRA }, // 3 - { "u15.bin", 0x200000, 0xA827BFB5, BRF_GRA }, // 4 - { "u25.bin", 0x100000, 0xEF652E0C, BRF_GRA }, // 5 - - { "u3.bin", 0x040000, 0x0905AEB2, BRF_GRA }, // 6 Sprite LUT - - { "u33.bin", 0x200000, 0x54494E6B, BRF_GRA }, // 7 Tile data - - { "3.u71", 0x020000, 0x2168E4BA, BRF_ESS | BRF_PRG }, // 8 CPU #1 code - - { "u64.bin", 0x080000, 0xE187ED4F, BRF_SND }, // 9 YM2610 ADPCM (delta-t) data - { "u56.bin", 0x100000, 0x9E07104D, BRF_SND }, // 10 YM2610 ADPCM data -}; - -STD_ROM_PICK(gunbirdj) -STD_ROM_FN(gunbirdj) - -static struct BurnRomInfo gunbirdkRomDesc[] = { - { "1k.u46", 0x080000, 0x745CEE52, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "2k.u39", 0x080000, 0x669632FB, BRF_ESS | BRF_PRG }, // 1 - - { "u14.bin", 0x200000, 0x7D7E8A00, BRF_GRA }, // 2 Sprite data - { "u24.bin", 0x200000, 0x5E3FFC9D, BRF_GRA }, // 3 - { "u15.bin", 0x200000, 0xA827BFB5, BRF_GRA }, // 4 - { "u25.bin", 0x100000, 0xEF652E0C, BRF_GRA }, // 5 - - { "u3.bin", 0x040000, 0x0905AEB2, BRF_GRA }, // 6 Sprite LUT - - { "u33.bin", 0x200000, 0x54494E6B, BRF_GRA }, // 7 Tile data - - { "k3.u71", 0x020000, 0x11994055, BRF_ESS | BRF_PRG }, // 8 CPU #1 code - - { "u64.bin", 0x080000, 0xE187ED4F, BRF_SND }, // 9 YM2610 ADPCM (delta-t) data - { "u56.bin", 0x100000, 0x9E07104D, BRF_SND }, // 10 YM2610 ADPCM data -}; - -STD_ROM_PICK(gunbirdk) -STD_ROM_FN(gunbirdk) - -struct BurnDriver BurnDrvGunbird = { - "gunbird", NULL, NULL, NULL, "1994", - "Gunbird (World)\0", NULL, "Psikyo", "Psikyo 68EC020", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, - NULL, gunbirdRomInfo, gunbirdRomName, NULL, NULL, gunbirdInputInfo, gunbirdWorldDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvGunbirdj = { - "gunbirdj", "gunbird", NULL, NULL, "1994", - "Gunbird (Japan)\0", NULL, "Psikyo", "Psikyo 68EC020", - L"Gunbird (Japan)\0\u30AC\u30F3\u30D0\u30FC\u30C9\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, - NULL, gunbirdjRomInfo, gunbirdjRomName, NULL, NULL, gunbirdInputInfo, gunbirdDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvGunbirdk = { - "gunbirdk", "gunbird", NULL, NULL, "1994", - "Gunbird (Korea)\0", NULL, "Psikyo", "Psikyo 68EC020", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, - NULL, gunbirdkRomInfo, gunbirdkRomName, NULL, NULL, gunbirdInputInfo, gunbirdDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 224, 320, 3, 4 -}; - -// Battle K-Road - -static struct BurnRomInfo btlkroadRomDesc[] = { - { "4-u46.bin", 0x040000, 0x8a7a28b4, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "5-u39.bin", 0x040000, 0x933561fa, BRF_ESS | BRF_PRG }, // 1 - - { "u14.bin", 0x200000, 0x282D89C3, BRF_GRA }, // 2 Sprite data - { "u24.bin", 0x200000, 0xBBE9D3D1, BRF_GRA }, // 3 - { "u15.bin", 0x200000, 0xD4D1B07C, BRF_GRA }, // 4 - { "", 0, 0, 0 }, // 5 - - { "u3.bin", 0x040000, 0x30D541ED, BRF_GRA }, // 6 Sprite LUT - - { "u33.bin", 0x200000, 0x4C8577F1, BRF_GRA }, // 7 Tile data - - { "3-u71.bin", 0x020000, 0x22411FAB, BRF_ESS | BRF_PRG }, // 8 CPU #1 code - - { "u64.bin", 0x080000, 0x0F33049F, BRF_SND }, // 9 YM2610 ADPCM (delta-t) data - { "u56.bin", 0x100000, 0x51D73682, BRF_SND }, // 10 YM2610 ADPCM data - - { "tibpal16l8.u69", 260, 0x00000000, BRF_NODUMP }, // NO DUMP - { "tibpal16l8.u19", 260, 0x00000000, BRF_NODUMP }, // NO DUMP -}; - -STD_ROM_PICK(btlkroad) -STD_ROM_FN(btlkroad) - -struct BurnDriver BurnDrvBtlKRoad = { - "btlkroad", NULL, NULL, NULL, "1994", - "Battle K-Road\0", NULL, "Psikyo", "Psikyo 68EC020", - L"Battle K-Road\0Battle K-Road \u30D0\u30C8\u30EB\u30AF\u30ED\u30FC\u30C9\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VSFIGHT, 0, - NULL, btlkroadRomInfo, btlkroadRomName, NULL, NULL, btlkroadInputInfo, btlkroadDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 320, 224, 4, 3 -}; - -// Strikers 1945 (gunbird hardware) - -static struct BurnRomInfo s1945jnRomDesc[] = { - { "1-u46.bin", 0x080000, 0x45FA8086, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "2-u39.bin", 0x080000, 0x0152AB8C, BRF_ESS | BRF_PRG }, // 1 - - { "u20.bin", 0x200000, 0x28A27FEE, BRF_GRA }, // 2 Sprite data - { "u22.bin", 0x200000, 0xCA152A32, BRF_GRA }, // 3 - { "u21.bin", 0x200000, 0xC5d60EA9, BRF_GRA }, // 4 - { "u23.bin", 0x200000, 0x48710332, BRF_GRA }, // 5 - - { "u1.bin", 0x040000, 0xDEE22654, BRF_GRA }, // 6 Sprite LUT - - { "u34.bin", 0x200000, 0xAAF83E23, BRF_GRA }, // 7 Tile data - - { "3-u71.bin", 0x020000, 0xE3E366BD, BRF_ESS | BRF_PRG }, // 8 CPU #1 code - - { "u64.bin", 0x080000, 0xA44A4A9b, BRF_SND }, // 9 YM2610 ADPCM (delta-t) data - { "u56.bin", 0x100000, 0xFE1312C2, BRF_SND }, // 10 YM2610 ADPCM data -}; - -STD_ROM_PICK(s1945jn) -STD_ROM_FN(s1945jn) - -struct BurnDriver BurnDrvS1945jn = { - "s1945jn", "s1945", NULL, NULL, "1995", - "Strikers 1945 (Japan, unprotected)\0", NULL, "Psikyo", "Psikyo 68EC020", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, - NULL, s1945jnRomInfo, s1945jnRomName, NULL, NULL, gunbirdInputInfo, s1945DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 224, 320, 3, 4 -}; - -// Strikers 1945 - -static struct BurnRomInfo s1945RomDesc[] = { - { "2s.u40", 0x040000, 0x9B10062A, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "3s.u41", 0x040000, 0xF87E871A, BRF_ESS | BRF_PRG }, // 1 - - { "u20.bin", 0x200000, 0x28A27FEE, BRF_GRA }, // 2 Sprite data - { "u22.bin", 0x200000, 0xCA152A32, BRF_GRA }, // 3 - { "u21.bin", 0x200000, 0xC5d60EA9, BRF_GRA }, // 4 - { "u23.bin", 0x200000, 0x48710332, BRF_GRA }, // 5 - - { "u1.bin", 0x040000, 0xDEE22654, BRF_GRA }, // 6 Sprite LUT - - { "u34.bin", 0x200000, 0xAAF83E23, BRF_GRA }, // 7 Tile data - - { "3-u63.bin", 0x020000, 0x42D40AE1, BRF_ESS | BRF_PRG }, // 8 CPU #1 code - - { "u61.bin", 0x200000, 0xA839CF47, BRF_SND }, // 9 PCM data - - { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, -}; - -STD_ROM_PICK(s1945) -STD_ROM_FN(s1945) - -static struct BurnRomInfo s1945jRomDesc[] = { - { "1-u40.bin", 0x040000, 0xC00EB012, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "2-u41.bin", 0x040000, 0x3F5A134B, BRF_ESS | BRF_PRG }, // 1 - - { "u20.bin", 0x200000, 0x28A27FEE, BRF_GRA }, // 2 Sprite data - { "u22.bin", 0x200000, 0xCA152A32, BRF_GRA }, // 3 - { "u21.bin", 0x200000, 0xC5d60EA9, BRF_GRA }, // 4 - { "u23.bin", 0x200000, 0x48710332, BRF_GRA }, // 5 - - { "u1.bin", 0x040000, 0xDEE22654, BRF_GRA }, // 6 Sprite LUT - - { "u34.bin", 0x200000, 0xAAF83E23, BRF_GRA }, // 7 Tile data - - { "3-u63.bin", 0x020000, 0x42D40AE1, BRF_ESS | BRF_PRG }, // 8 CPU #1 code - - { "u61.bin", 0x200000, 0xA839CF47, BRF_SND }, // 9 PCM data - - { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, -}; - -STD_ROM_PICK(s1945j) -STD_ROM_FN(s1945j) - -static struct BurnRomInfo s1945kRomDesc[] = { - { "10.u40", 0x040000, 0x5a32af36, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "9.u41", 0x040000, 0x29cc6d7d, BRF_ESS | BRF_PRG }, // 1 - - { "u20.bin", 0x200000, 0x28A27FEE, BRF_GRA }, // 2 Sprite data - { "u22.bin", 0x200000, 0xCA152A32, BRF_GRA }, // 3 - { "u21.bin", 0x200000, 0xC5d60EA9, BRF_GRA }, // 4 - { "u23.bin", 0x200000, 0x48710332, BRF_GRA }, // 5 - - { "u1.bin", 0x040000, 0xDEE22654, BRF_GRA }, // 6 Sprite LUT - - { "u34.bin", 0x200000, 0xAAF83E23, BRF_GRA }, // 7 Tile data - - { "3-u63.bin", 0x020000, 0x42D40AE1, BRF_ESS | BRF_PRG }, // 8 CPU #1 code - - { "u61.bin", 0x200000, 0xA839CF47, BRF_SND }, // 9 PCM data - - { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, -}; - -STD_ROM_PICK(s1945k) -STD_ROM_FN(s1945k) - -static struct BurnRomInfo s1945aRomDesc[] = { - { "4-u40.bin", 0x040000, 0x29ffc217, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "5-u41.bin", 0x040000, 0xc3d3fb64, BRF_ESS | BRF_PRG }, // 1 - - { "u20.bin", 0x200000, 0x28A27FEE, BRF_GRA }, // 2 Sprite data - { "u22.bin", 0x200000, 0xCA152A32, BRF_GRA }, // 3 - { "u21.bin", 0x200000, 0xC5d60EA9, BRF_GRA }, // 4 - { "u23.bin", 0x200000, 0x48710332, BRF_GRA }, // 5 - - { "u1.bin", 0x040000, 0xDEE22654, BRF_GRA }, // 6 Sprite LUT - - { "u34.bin", 0x200000, 0xAAF83E23, BRF_GRA }, // 7 Tile data - - { "3-u63.bin", 0x020000, 0x42D40AE1, BRF_ESS | BRF_PRG }, // 8 CPU #1 code - - { "u61.bin", 0x200000, 0xA839CF47, BRF_SND }, // 9 PCM data - - { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, -}; - -STD_ROM_PICK(s1945a) -STD_ROM_FN(s1945a) - -struct BurnDriver BurnDrvS1945 = { - "s1945", NULL, NULL, NULL, "1995", - "Strikers 1945\0", NULL, "Psikyo", "Psikyo 68EC020", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, - NULL, s1945RomInfo, s1945RomName, NULL, NULL, gunbirdInputInfo, s1945WorldDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvS1945j = { - "s1945j", "s1945", NULL, NULL, "1995", - "Strikers 1945 (Japan)\0", NULL, "Psikyo", "Psikyo 68EC020", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, - NULL, s1945jRomInfo, s1945jRomName, NULL, NULL, gunbirdInputInfo, s1945DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvS1945k = { - "s1945k", "s1945", NULL, NULL, "1995", - "Strikers 1945 (Korea)\0", NULL, "Psikyo", "Psikyo 68EC020", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, - NULL, s1945kRomInfo, s1945kRomName, NULL, NULL, gunbirdInputInfo, s1945DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvS1945a = { - "s1945a", "s1945", NULL, NULL, "1995", - "Strikers 1945 (Alt)\0", NULL, "Psikyo", "Psikyo 68EC020", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, - NULL, s1945aRomInfo, s1945aRomName, NULL, NULL, gunbirdInputInfo, s1945aDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 224, 320, 3, 4 -}; - -// Tengai - -static struct BurnRomInfo tengaiRomDesc[] = { - { "5-u40.bin", 0x080000, 0x90088195, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "4-u41.bin", 0x080000, 0x0d53196c, BRF_ESS | BRF_PRG }, // 1 - - { "u20.bin", 0x200000, 0xED42EF73, BRF_GRA }, // 2 Sprite data - { "u22.bin", 0x200000, 0x8D21CAEE, BRF_GRA }, // 3 - { "u21.bin", 0x200000, 0xEFE34EED, BRF_GRA }, // 4 - - { "u1.bin", 0x040000, 0x681D7D55, BRF_GRA }, // 5 Sprite LUT - - { "u34.bin", 0x400000, 0x2A2E2EEB, BRF_GRA }, // 6 Tile data - - { "1-u63.bin", 0x020000, 0x2025E387, BRF_ESS | BRF_PRG }, // 7 CPU #1 code - - { "u61.bin", 0x200000, 0xA63633C5, BRF_SND }, // 8 PCM data - { "u62.bin", 0x200000, 0x3AD0C357, BRF_SND }, // 9 - - { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, -}; - -STD_ROM_PICK(tengai) -STD_ROM_FN(tengai) - -struct BurnDriver BurnDrvTengai = { - "tengai", NULL, NULL, NULL, "1996", - "Tengai (world)\0", NULL, "Psikyo", "Psikyo 68EC020", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_HORSHOOT, 0, - NULL, tengaiRomInfo, tengaiRomName, NULL, NULL, gunbirdInputInfo, tengaiDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 320, 224, 4, 3 -}; - -static struct BurnRomInfo tengaijRomDesc[] = { - { "2-u40.bin", 0x080000, 0xAB6FE58A, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "3-u41.bin", 0x080000, 0x02E42E39, BRF_ESS | BRF_PRG }, // 1 - - { "u20.bin", 0x200000, 0xED42EF73, BRF_GRA }, // 2 Sprite data - { "u22.bin", 0x200000, 0x8D21CAEE, BRF_GRA }, // 3 - { "u21.bin", 0x200000, 0xEFE34EED, BRF_GRA }, // 4 - - { "u1.bin", 0x040000, 0x681D7D55, BRF_GRA }, // 5 Sprite LUT - - { "u34.bin", 0x400000, 0x2A2E2EEB, BRF_GRA }, // 6 Tile data - - { "1-u63.bin", 0x020000, 0x2025E387, BRF_ESS | BRF_PRG }, // 7 CPU #1 code - - { "u61.bin", 0x200000, 0xA63633C5, BRF_SND }, // 8 PCM data - { "u62.bin", 0x200000, 0x3AD0C357, BRF_SND }, // 9 - - { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, -}; - -STD_ROM_PICK(tengaij) -STD_ROM_FN(tengaij) - -struct BurnDriver BurnDrvTengaij = { - "tengaij", "tengai", NULL, NULL, "1996", - "Tengai\0Sengoku Blade - sengoku ace episode II\0", NULL, "Psikyo", "Psikyo 68EC020", - L"Tengai\0\u6226\u56FD\u30D6\u30EC\u30FC\u30C9 - sengoku ace episode II\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_CLONE, 2, HARDWARE_PSIKYO, GBF_HORSHOOT, 0, - NULL, tengaijRomInfo, tengaijRomName, NULL, NULL, gunbirdInputInfo, tengaijDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, - 320, 224, 4, 3 -}; +// Psikyo MC68EC020 based hardware +#include "psikyo.h" +#include "burn_ym2610.h" +#include "burn_ymf278b.h" + +INT32 PsikyoHardwareVersion; + +static UINT8 DrvJoy1[8] = {0, }; +static UINT8 DrvJoy2[8] = {0, }; +static UINT8 DrvInp1[8] = {0, }; +static UINT8 DrvInp2[8] = {0, }; +static UINT16 DrvInput[4] = {0, }; + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Psikyo68KROM, *PsikyoZ80ROM; +static UINT8 *Psikyo68KRAM, *PsikyoZ80RAM; +static UINT8 *PsikyoSampleROM01, *PsikyoSampleROM02; + +static INT32 PsikyoSampleROM01Size, PsikyoSampleROM02Size; +static INT32 PsikyoTileROMSize, PsikyoSpriteROMSize; + +static UINT8 DrvReset = 0; +static UINT16 bVBlank; + +static INT32 nPsikyoZ80Bank; + +static INT32 nSoundlatch, nSoundlatchAck; + +static INT32 nCyclesDone[2]; +static INT32 nCyclesTotal[2]; +static INT32 nCyclesSegment; +static INT32 nCycles68KSync; + +static INT32 nPrevBurnCPUSpeedAdjust; + +static INT32 (*CheckSleep)(INT32); + +// ---------------------------------------------------------------------------- +// Input definitions + +static struct BurnInputInfo gunbirdInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvInp1 + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 7, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 6, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 4, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 5, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvInp1 + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 7, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 6, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 4, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 5, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Test", BIT_DIGITAL, DrvInp1 + 5, "diag"}, + {"Service", BIT_DIGITAL, DrvInp1 + 4, "service"}, +// {"Tilt", BIT_DIGITAL, DrvInp1 + 6, "tilt"}, + + {"Dip 1", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 2)) + 1, "dip"}, + {"Dip 2", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 2)) + 0, "dip"}, + {"Dip 3", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 3)) + 0, "dip"}, +}; + +STDINPUTINFO(gunbird) + +static struct BurnInputInfo btlkroadInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvInp1 + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 7, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 6, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 4, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 5, "p1 right"}, + {"P1 Weak punch", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1"}, + {"P1 Medium punch", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 2"}, + {"P1 Strong punch", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 3"}, + {"P1 Weak kick", BIT_DIGITAL, DrvInp2 + 7, "p1 fire 4"}, + {"P1 Medium kick", BIT_DIGITAL, DrvInp2 + 6, "p1 fire 5"}, + {"P1 Strong kick", BIT_DIGITAL, DrvInp2 + 5, "p1 fire 6"}, + + {"P2 Coin", BIT_DIGITAL, DrvInp1 + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 7, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 6, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 4, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 5, "p2 right"}, + {"P2 Weak punch", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1"}, + {"P2 Medium punch", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 2"}, + {"P2 Strong punch", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 3"}, + {"P2 Weak kick", BIT_DIGITAL, DrvInp2 + 3, "p2 fire 4"}, + {"P2 Medium kick", BIT_DIGITAL, DrvInp2 + 2, "p2 fire 5"}, + {"P2 Strong kick", BIT_DIGITAL, DrvInp2 + 1, "p2 fire 6"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Test", BIT_DIGITAL, DrvInp1 + 5, "diag"}, + {"Service", BIT_DIGITAL, DrvInp1 + 4, "service"}, +// {"Tilt", BIT_DIGITAL, DrvInp1 + 6, "tilt"}, + + {"Dip 1", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 2)) + 1, "dip"}, + {"Dip 2", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 2)) + 0, "dip"}, + {"Region", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 3)) + 0, "dip"}, + {"Debug Dip", BIT_DIPSWITCH, ((UINT8*)(DrvInput + 3)) + 1, "dip"}, +}; + +STDINPUTINFO(btlkroad) + +static struct BurnDIPInfo samuraiaDIPList[] = { + // Defaults + {0x15, 0xFF, 0xFF, 0x00, NULL}, + {0x16, 0xFF, 0xFF, 0x02, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, "Coin slot"}, + {0x15, 0x82, 0x01, 0x00, "Same"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x01, 0x01, "Individual"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0, 0xFE, 0, 9, "Coin 1"}, + {0x15, 0x01, 0x0E, 0x00, "1 coin = 1 credit"}, + {0x15, 0x01, 0x0E, 0x02, "2 coins = 1 credit"}, + {0x15, 0x01, 0x0E, 0x04, "3 coins = 1 credit"}, + {0x15, 0x01, 0x0E, 0x08, "1 coin = 2 credits"}, + {0x15, 0x01, 0x0E, 0x06, "1 coin = 3 credits"}, + {0x15, 0x01, 0x0E, 0x0A, "1 coin = 4 credits"}, + {0x15, 0x01, 0x0E, 0x0C, "1 coin = 5 credits"}, + {0x15, 0x82, 0x0E, 0x0E, "1 coin = 6 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x01, 0xFF, 0xFF, "Free play"}, + {0, 0xFE, 0, 9, "Coin 2"}, + {0x15, 0x82, 0x70, 0x00, "1 coin = 1 credit"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x10, "2 coins = 1 credit"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x20, "3 coins = 1 credit"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x40, "1 coin = 2 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x30, "1 coin = 3 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x50, "1 coin = 4 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x60, "1 coin = 5 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x70, "1 coin = 6 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0xFF, 0xFF, "Free play"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0, 0xFE, 0, 2, "Continue coin"}, + {0x15, 0x82, 0x80, 0x00, "Normal mode"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x80, 0x80, "Continue mode"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + // DIP 2 + {0, 0xFE, 0, 2, "Screen reverse"}, + {0x16, 0x01, 0x01, 0x00, "Invert"}, + {0x16, 0x01, 0x01, 0x01, "Normal"}, + {0, 0xFE, 0, 2, "Demo sound"}, + {0x16, 0x01, 0x02, 0x00, "Off"}, + {0x16, 0x01, 0x02, 0x02, "On"}, + {0, 0xFE, 0, 4, "Difficulty"}, + {0x16, 0x01, 0x0C, 0x00, "Normal"}, + {0x16, 0x01, 0x0C, 0x04, "Easy"}, + {0x16, 0x01, 0x0C, 0x08, "Hard"}, + {0x16, 0x01, 0x0C, 0x0C, "Super hard"}, + {0, 0xFE, 0, 4, "Fighters"}, + {0x16, 0x01, 0x30, 0x00, "3"}, + {0x16, 0x01, 0x30, 0x10, "1"}, + {0x16, 0x01, 0x30, 0x20, "2"}, + {0x16, 0x01, 0x30, 0x30, "4"}, + {0, 0xFE, 0, 2, "Extend player"}, + {0x16, 0x01, 0x40, 0x00, "Every 400,000 points"}, + {0x16, 0x01, 0x40, 0x40, "Every 600,000 points"}, + {0, 0xFE, 0, 2, "Test mode"}, + {0x16, 0x01, 0x80, 0x00, "Off"}, + {0x16, 0x01, 0x80, 0x80, "On"}, +}; + +static struct BurnDIPInfo gunbirdDIPList[] = { + // Defaults + {0x15, 0xFF, 0xFF, 0x00, NULL}, + {0x16, 0xFF, 0xFF, 0x02, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, "Coin slot"}, + {0x15, 0x82, 0x01, 0x00, "Same"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x01, 0x01, "Individual"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0, 0xFE, 0, 9, "Coin 1"}, + {0x15, 0x01, 0x0E, 0x00, "1 coin = 1 credit"}, + {0x15, 0x01, 0x0E, 0x02, "2 coins = 1 credit"}, + {0x15, 0x01, 0x0E, 0x04, "3 coins = 1 credit"}, + {0x15, 0x01, 0x0E, 0x08, "1 coin = 2 credits"}, + {0x15, 0x01, 0x0E, 0x06, "1 coin = 3 credits"}, + {0x15, 0x01, 0x0E, 0x0A, "1 coin = 4 credits"}, + {0x15, 0x01, 0x0E, 0x0C, "1 coin = 5 credits"}, + {0x15, 0x82, 0x0E, 0x0E, "1 coin = 6 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x01, 0xFF, 0xFF, "Free play"}, + {0, 0xFE, 0, 9, "Coin 2"}, + {0x15, 0x82, 0x70, 0x00, "1 coin = 1 credit"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x10, "2 coins = 1 credit"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x20, "3 coins = 1 credit"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x40, "1 coin = 2 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x30, "1 coin = 3 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x50, "1 coin = 4 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x60, "1 coin = 5 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x70, "1 coin = 6 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0xFF, 0xFF, "Free play"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0, 0xFE, 0, 2, "Continue coin"}, + {0x15, 0x82, 0x80, 0x00, "Normal mode"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x80, 0x80, "Continue mode"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + // DIP 2 + {0, 0xFE, 0, 2, "Screen"}, + {0x16, 0x01, 0x01, 0x00, "Normal"}, + {0x16, 0x01, 0x01, 0x01, "Reverse"}, + {0, 0xFE, 0, 2, "Demo sound"}, + {0x16, 0x01, 0x02, 0x00, "Off"}, + {0x16, 0x01, 0x02, 0x02, "On"}, + {0, 0xFE, 0, 4, "Difficulty"}, + {0x16, 0x01, 0x0C, 0x00, "Normal"}, + {0x16, 0x01, 0x0C, 0x04, "Easy"}, + {0x16, 0x01, 0x0C, 0x08, "Difficult"}, + {0x16, 0x01, 0x0C, 0x0C, "More Difficult"}, + {0, 0xFE, 0, 4, "Number of fighters"}, + {0x16, 0x01, 0x30, 0x00, "3"}, + {0x16, 0x01, 0x30, 0x10, "1"}, + {0x16, 0x01, 0x30, 0x20, "2"}, + {0x16, 0x01, 0x30, 0x30, "4"}, + {0, 0xFE, 0, 2, "Extend fighters"}, + {0x16, 0x01, 0x40, 0x00, "Every 400,000 points"}, + {0x16, 0x01, 0x40, 0x40, "Every 600,000 points"}, + {0, 0xFE, 0, 2, "Test mode"}, + {0x16, 0x01, 0x80, 0x00, "Off"}, + {0x16, 0x01, 0x80, 0x80, "On"}, +}; + +static struct BurnDIPInfo btlkroadDIPList[] = { + // Defaults + {0x1B, 0xFF, 0xFF, 0x00, NULL}, + {0x1C, 0xFF, 0xFF, 0x02, NULL}, + {0x1D, 0xFF, 0xFF, 0x0F, NULL}, + {0x1E, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, "Coin slot"}, + {0x1B, 0x82, 0x01, 0x00, "Same"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x82, 0x01, 0x01, "Individual"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0, 0xFE, 0, 9, "Coin 1"}, + {0x1B, 0x01, 0x0E, 0x00, "1 coin = 1 credit"}, + {0x1B, 0x01, 0x0E, 0x02, "2 coins = 1 credit"}, + {0x1B, 0x01, 0x0E, 0x04, "3 coins = 1 credit"}, + {0x1B, 0x01, 0x0E, 0x08, "1 coin = 2 credits"}, + {0x1B, 0x01, 0x0E, 0x06, "1 coin = 3 credits"}, + {0x1B, 0x01, 0x0E, 0x0A, "1 coin = 4 credits"}, + {0x1B, 0x01, 0x0E, 0x0C, "1 coin = 5 credits"}, + {0x1B, 0x82, 0x0E, 0x0E, "1 coin = 6 credits"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x01, 0xFF, 0xFF, "Free play"}, + {0, 0xFE, 0, 9, "Coin 2"}, + {0x1B, 0x82, 0x70, 0x00, "1 coin = 1 credit"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x82, 0x70, 0x10, "2 coins = 1 credit"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x82, 0x70, 0x20, "3 coins = 1 credit"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x82, 0x70, 0x40, "1 coin = 2 credits"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x82, 0x70, 0x30, "1 coin = 3 credits"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x82, 0x70, 0x50, "1 coin = 4 credits"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x82, 0x70, 0x60, "1 coin = 5 credits"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x82, 0x70, 0x70, "1 coin = 6 credits"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x82, 0xFF, 0xFF, "Free play"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0, 0xFE, 0, 2, "Continue coin"}, + {0x1B, 0x82, 0x80, 0x00, "Normal mode"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + {0x1B, 0x82, 0x80, 0x80, "Continue mode"}, + {0x1B, 0x00, 0xFF, 0xFF, NULL}, + // DIP 2 + {0, 0xFE, 0, 2, NULL}, + {0x1C, 0x01, 0x01, 0x00, "Normal screen"}, + {0x1C, 0x01, 0x01, 0x01, "Invert screen"}, + {0, 0xFE, 0, 2, "Demo sounds"}, + {0x1C, 0x01, 0x02, 0x00, "Disabled"}, + {0x1C, 0x01, 0x02, 0x02, "Enabled"}, + {0, 0xFE, 0, 4, "Difficulty"}, + {0x1C, 0x01, 0x0C, 0x00, "Normal"}, + {0x1C, 0x01, 0x0C, 0x04, "Easy"}, + {0x1C, 0x01, 0x0C, 0x08, "Hard"}, + {0x1C, 0x01, 0x0C, 0x0C, "Hardest"}, + {0, 0xFE, 0, 2, "Enable debug dip"}, + {0x1C, 0x01, 0x40, 0x00, "Off"}, + {0x1C, 0x01, 0x40, 0x40, "On"}, + {0, 0xFE, 0, 2, "Test mode"}, + {0x1C, 0x01, 0x80, 0x00, "Off"}, + {0x1C, 0x01, 0x80, 0x80, "On"}, + + // Region + {0, 0xFE, 0, 6, "Region"}, + {0x1D, 0x01, 0xFF, 0x00, "Japan"}, + {0x1D, 0x01, 0xFF, 0x01, "USA / Canada (Jaleco license)"}, + {0x1D, 0x01, 0xFF, 0x03, "Korea"}, + {0x1D, 0x01, 0xFF, 0x05, "Hong Kong"}, + {0x1D, 0x01, 0xFF, 0x09, "Taiwan"}, + {0x1D, 0x01, 0xFF, 0x0F, "World"}, + + // Debug Dip + {0, 0xFE, 0, 2, "Debug test menu"}, + {0x1E, 0x82, 0x80, 0x00, "Off"}, + {0x1C, 0x00, 0x40, 0x00, NULL}, + {0x1E, 0x82, 0x80, 0x80, "On"}, + {0x1C, 0x00, 0x40, 0x00, NULL}, +}; + +static struct BurnDIPInfo s1945DIPList[] = { + // Defaults + {0x15, 0xFF, 0xFF, 0x00, NULL}, + {0x16, 0xFF, 0xFF, 0x02, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, "Coin slot"}, + {0x15, 0x01, 0x01, 0x00, "Same"}, + {0x15, 0x01, 0x01, 0x01, "Individual"}, + {0, 0xFE, 0, 8, "Coin 1"}, + {0x15, 0x01, 0x0E, 0x00, "1 coin = 1 credit"}, + {0x15, 0x01, 0x0E, 0x02, "2 coins = 1 credit"}, + {0x15, 0x01, 0x0E, 0x04, "3 coins = 1 credit"}, + {0x15, 0x01, 0x0E, 0x08, "1 coin = 2 credits"}, + {0x15, 0x01, 0x0E, 0x06, "1 coin = 3 credits"}, + {0x15, 0x01, 0x0E, 0x0A, "1 coin = 4 credits"}, + {0x15, 0x01, 0x0E, 0x0C, "1 coin = 5 credits"}, + {0x15, 0x82, 0x0E, 0x0E, "1 coin = 6 credits"}, + {0, 0xFE, 0, 8, "Coin 2"}, + {0x15, 0x01, 0x70, 0x00, "1 coin = 1 credit"}, + {0x15, 0x01, 0x70, 0x10, "2 coins = 1 credit"}, + {0x15, 0x01, 0x70, 0x20, "3 coins = 1 credit"}, + {0x15, 0x01, 0x70, 0x40, "1 coin = 2 credits"}, + {0x15, 0x01, 0x70, 0x30, "1 coin = 3 credits"}, + {0x15, 0x01, 0x70, 0x50, "1 coin = 4 credits"}, + {0x15, 0x01, 0x70, 0x60, "1 coin = 5 credits"}, + {0x15, 0x01, 0x70, 0x70, "1 coin = 6 credits"}, + {0, 0xFE, 0, 2, "Continue coin"}, + {0x15, 0x01, 0x80, 0x00, "Normal mode"}, + {0x15, 0x01, 0x80, 0x80, "Continue mode"}, + // DIP 2 + {0, 0xFE, 0, 2, "Screen"}, + {0x16, 0x01, 0x01, 0x00, "Normal"}, + {0x16, 0x01, 0x01, 0x01, "Reverse"}, + {0, 0xFE, 0, 2, "Demo sound"}, + {0x16, 0x01, 0x02, 0x00, "Off"}, + {0x16, 0x01, 0x02, 0x02, "On"}, + {0, 0xFE, 0, 4, "Difficulty"}, + {0x16, 0x01, 0x0C, 0x00, "Normal"}, + {0x16, 0x01, 0x0C, 0x04, "Easy"}, + {0x16, 0x01, 0x0C, 0x08, "Difficult"}, + {0x16, 0x01, 0x0C, 0x0C, "More Difficult"}, + {0, 0xFE, 0, 4, "Number of fighters"}, + {0x16, 0x01, 0x30, 0x00, "3"}, + {0x16, 0x01, 0x30, 0x10, "1"}, + {0x16, 0x01, 0x30, 0x20, "2"}, + {0x16, 0x01, 0x30, 0x30, "4"}, + {0, 0xFE, 0, 2, "Extend fighters"}, + {0x16, 0x01, 0x40, 0x00, "Every 600,000 points"}, + {0x16, 0x01, 0x40, 0x40, "Every 800,000 points"}, + {0, 0xFE, 0, 2, "Test mode"}, + {0x16, 0x01, 0x80, 0x00, "Off"}, + {0x16, 0x01, 0x80, 0x80, "On"}, +}; + +static struct BurnDIPInfo tengaiDIPList[] = { + // Defaults + {0x15, 0xFF, 0xFF, 0x00, NULL}, + {0x16, 0xFF, 0xFF, 0x02, NULL}, + {0x17, 0xFF, 0xFF, 0x0F, NULL}, + + {0, 0xFE, 0, 2, "Coin slot"}, + {0x15, 0x82, 0x01, 0x00, "Same"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x01, 0x01, "Individual"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0, 0xFE, 0, 9, "Coin 1"}, + {0x15, 0x01, 0x0E, 0x00, "1 coin = 1 credit"}, + {0x15, 0x01, 0x0E, 0x02, "2 coins = 1 credit"}, + {0x15, 0x01, 0x0E, 0x04, "3 coins = 1 credit"}, + {0x15, 0x01, 0x0E, 0x08, "1 coin = 2 credits"}, + {0x15, 0x01, 0x0E, 0x06, "1 coin = 3 credits"}, + {0x15, 0x01, 0x0E, 0x0A, "1 coin = 4 credits"}, + {0x15, 0x01, 0x0E, 0x0C, "1 coin = 5 credits"}, + {0x15, 0x82, 0x0E, 0x0E, "1 coin = 6 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x01, 0xFF, 0xFF, "Free play"}, + {0, 0xFE, 0, 9, "Coin 2"}, + {0x15, 0x82, 0x70, 0x00, "1 coin = 1 credit"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x10, "2 coins = 1 credit"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x20, "3 coins = 1 credit"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x40, "1 coin = 2 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x30, "1 coin = 3 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x50, "1 coin = 4 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x60, "1 coin = 5 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x70, 0x70, "1 coin = 6 credits"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0xFF, 0xFF, "Free play"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0, 0xFE, 0, 2, "Continue coin"}, + {0x15, 0x82, 0x80, 0x00, "Normal mode"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + {0x15, 0x82, 0x80, 0x80, "Continue mode"}, + {0x15, 0x00, 0xFF, 0xFF, NULL}, + // DIP 2 + {0, 0xFE, 0, 2, NULL}, + {0x16, 0x01, 0x01, 0x00, "Normal screen"}, + {0x16, 0x01, 0x01, 0x01, "Invert screen"}, + {0, 0xFE, 0, 2, "Demo sounds"}, + {0x16, 0x01, 0x02, 0x00, "Disabled"}, + {0x16, 0x01, 0x02, 0x02, "Enabled"}, + {0, 0xFE, 0, 4, "Difficulty"}, + {0x16, 0x01, 0x0C, 0x00, "Normal"}, + {0x16, 0x01, 0x0C, 0x04, "Easy"}, + {0x16, 0x01, 0x0C, 0x08, "Hard"}, + {0x16, 0x01, 0x0C, 0x0C, "Hardest"}, + {0, 0xFE, 0, 4, "Lives"}, + {0x16, 0x01, 0x30, 0x00, "3"}, + {0x16, 0x01, 0x30, 0x10, "1"}, + {0x16, 0x01, 0x30, 0x20, "2"}, + {0x16, 0x01, 0x30, 0x30, "4"}, + {0, 0xFE, 0, 2, "Bonus life"}, + {0x16, 0x01, 0x40, 0x00, "600K"}, + {0x16, 0x01, 0x40, 0x40, "800K"}, +}; + +static struct BurnDIPInfo NoRegionDIPList[] = { + // Defaults + {0x17, 0xFF, 0xFF, 0x00, NULL}, +}; + +static struct BurnDIPInfo samuraiaRegionDIPList[] = { + // Defaults + {0x17, 0xFF, 0xFF, 0x00, NULL}, + + // Region + {0, 0xFE, 0, 5, "Region"}, + {0x17, 0x01, 0xFF, 0x00, "World"}, + {0x17, 0x01, 0xFF, 0x10, "USA / Canada"}, + {0x17, 0x01, 0xFF, 0x20, "Korea"}, + {0x17, 0x01, 0xFF, 0x40, "Hong Kong"}, + {0x17, 0x01, 0xFF, 0x80, "Taiwan"}, +}; + +static struct BurnDIPInfo gunbirdRegionDIPList[] = { + // Defaults + {0x17, 0xFF, 0xFF, 0x00, NULL}, + + // Region + {0, 0xFE, 0, 5, "Region"}, + {0x17, 0x01, 0xFF, 0x00, "World"}, + {0x17, 0x01, 0xFF, 0x01, "USA / Canada"}, + {0x17, 0x01, 0xFF, 0x02, "Korea"}, + {0x17, 0x01, 0xFF, 0x04, "Hong Kong"}, + {0x17, 0x01, 0xFF, 0x08, "Taiwan"}, +}; + +static struct BurnDIPInfo s1945aRegionDIPList[] = { + // Defaults + {0x17, 0xFF, 0xFF, 0x01, NULL}, + + // Region + {0, 0xFE, 0, 2, "Region"}, + {0x17, 0x01, 0xFF, 0x00, "Japan"}, + {0x17, 0x01, 0xFF, 0x01, "World"}, +}; + +static struct BurnDIPInfo tengaiRegionDIPList[] = { + // Defaults + {0x17, 0xFF, 0xFF, 0x00, NULL}, + + // Region + {0, 0xFE, 0, 5, "Region"}, + {0x17, 0x01, 0xFF, 0x01, "U.S.A. & Canada"}, + {0x17, 0x01, 0xFF, 0x02, "Korea"}, + {0x17, 0x01, 0xFF, 0x04, "Hong Kong"}, + {0x17, 0x01, 0xFF, 0x08, "Taiwan"}, + {0x17, 0x01, 0xFF, 0x00, "World"}, +}; + +static struct BurnDIPInfo tengaijRegionDIPList[] = { + // Defaults + {0x17, 0xFF, 0xFF, 0x00, NULL}, + + // Region + {0, 0xFE, 0, 2, "Region"}, + {0x17, 0x01, 0xFF, 0x00, "Japan"}, + {0x17, 0x01, 0xFF, 0x0F, "World"}, +}; + +STDDIPINFOEXT(samuraia, samuraia, samuraiaRegion) +STDDIPINFOEXT(sngkace, samuraia, NoRegion) + +STDDIPINFO(btlkroad) + +STDDIPINFOEXT(gunbirdWorld, gunbird, gunbirdRegion) +STDDIPINFOEXT(gunbird, gunbird, NoRegion) + +STDDIPINFOEXT(s1945World, s1945, gunbirdRegion) +STDDIPINFOEXT(s1945, s1945, NoRegion) +STDDIPINFOEXT(s1945a, s1945, s1945aRegion) + +//STDDIPINFO(tengai) +STDDIPINFOEXT(tengai, tengai, tengaiRegion) +STDDIPINFOEXT(tengaij, tengai, tengaijRegion) + +// ---------------------------------------------------------------------------- +// Z80 banswitch + +static void samuraiaZ80SetBank(INT32 nBank) +{ + nBank &= 0x03; + if (nBank != nPsikyoZ80Bank) { + UINT8* nStartAddress = PsikyoZ80ROM + (nBank << 15); + ZetMapArea(0x8000, 0xFFFF, 0, nStartAddress); + ZetMapArea(0x8000, 0xFFFF, 2, nStartAddress); + + nPsikyoZ80Bank = nBank; + } + + return; +} + +static void gunbirdZ80SetBank(INT32 nBank) +{ + nBank &= 0x03; + if (nBank != nPsikyoZ80Bank) { + UINT8* nStartAddress = PsikyoZ80ROM + 0x00200 + (nBank << 15); + ZetMapArea(0x8200, 0xFFFF, 0, nStartAddress); + ZetMapArea(0x8200, 0xFFFF, 2, nStartAddress); + + nPsikyoZ80Bank = nBank; + } + + return; +} + +// ---------------------------------------------------------------------------- +// CPU synchronisation + +static inline void PsikyoSynchroniseZ80(INT32 nExtraCycles) +{ + INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]) + nExtraCycles; + + if (nCycles <= ZetTotalCycles()) { + return; + } + + nCycles68KSync = nCycles - nExtraCycles; + + BurnTimerUpdate(nCycles); +} + +// Callbacks for the FM chip + +static void PsikyoFMIRQHandler(INT32, INT32 nStatus) +{ +// bprintf(PRINT_NORMAL, _T(" - IRQ -> %i.\n"), nStatus); + + if (nStatus) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 PsikyoSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double PsikyoGetTime() +{ + return (double)ZetTotalCycles() / 4000000.0; +} + +// ---------------------------------------------------------------------------- +// Z80 I/O handlers + +UINT8 __fastcall samuraiaZ80In(UINT16 nAddress) +{ + switch (nAddress & 0xFF) { + case 0x00: + return BurnYM2610Read(0); + case 0x02: + return BurnYM2610Read(2); + case 0x08: // Read sound command +// bprintf(PRINT_NORMAL, _T(" - Sound command received (0x%02X).\n"), nSoundlatch); + return nSoundlatch; + +// default: { +// bprintf(PRINT_NORMAL, _T(" - Z80 read port 0x%04X.\n"), nAddress); +// } + } + + return 0; +} + +void __fastcall samuraiaZ80Out(UINT16 nAddress, UINT8 nValue) +{ + switch (nAddress & 0x0FF) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + BurnYM2610Write(nAddress & 3, nValue); + break; + + case 0x04: + samuraiaZ80SetBank(nValue); + break; + + case 0x0C: // Write reply to sound commands +// bprintf(PRINT_NORMAL, _T(" - Sound reply sent (0x%02X).\n"), nValue); + + nSoundlatchAck = 1; + + break; + +// default: { +// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue); +// } + } +} + +UINT8 __fastcall gunbirdZ80In(UINT16 nAddress) +{ + switch (nAddress & 0xFF) { + case 0x04: +// bprintf(PRINT_NORMAL, _T(" read 0 %6i\n"), ZetTotalCycles()); + return BurnYM2610Read(0); + case 0x06: +// bprintf(PRINT_NORMAL, _T(" read 2 %6i\n"), ZetTotalCycles()); + return BurnYM2610Read(2); + case 0x08: // Read sound command +// bprintf(PRINT_NORMAL, _T(" - Sound command received (0x%02X).\n"), nSoundlatch); + return nSoundlatch; + +// default: { +// bprintf(PRINT_NORMAL, _T(" - Z80 read port 0x%04X.\n"), nAddress); +// } + } + + return 0; +} + +void __fastcall gunbirdZ80Out(UINT16 nAddress, UINT8 nValue) +{ + switch (nAddress & 0x0FF) { + case 0x00: + gunbirdZ80SetBank(nValue >> 4); + break; + case 0x04: + case 0x05: + case 0x06: + case 0x07: { + BurnYM2610Write(nAddress & 3, nValue); + break; + } + case 0x0C: // Write reply to sound commands +// bprintf(PRINT_NORMAL, _T(" - Sound reply sent (0x%02X).\n"), nValue); + + nSoundlatchAck = 1; + + break; + +// default: { +// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue); +// } + } +} + +UINT8 __fastcall tengaiZ80In(UINT16 nAddress) +{ + switch (nAddress & 0xFF) { + case 0x08: +// bprintf(PRINT_NORMAL, _T(" read 0 %6i\n"), ZetTotalCycles()); + return BurnYMF278BReadStatus(); + case 0x10: // Read sound command +// bprintf(PRINT_NORMAL, _T(" - Sound command received (0x%02X).\n"), nSoundlatch); + return nSoundlatch; + +// default: { +// bprintf(PRINT_NORMAL, _T(" - Z80 read port 0x%04X.\n"), nAddress); +// } + } + + return 0; +} + +void __fastcall tengaiZ80Out(UINT16 nAddress, UINT8 nValue) +{ + switch (nAddress & 0x0FF) { + case 0x00: + gunbirdZ80SetBank(nValue >> 4); + break; + case 0x08: + case 0x0A: + case 0x0C: { + BurnYMF278BSelectRegister((nAddress >> 1) & 3, nValue); + break; + } + case 0x09: + case 0x0B: + case 0x0D: { + BurnYMF278BWriteRegister((nAddress >> 1) & 3, nValue); + break; + } + case 0x18: // Write reply to sound commands +// bprintf(PRINT_NORMAL, _T(" - Sound reply sent (0x%02X).\n"), nValue); + + nSoundlatchAck = 1; + + break; + +// default: { +// bprintf(PRINT_NORMAL, _T(" - Z80 port 0x%04X -> 0x%02X.\n"), nAddress, nValue); +// } + } +} + +// ---------------------------------------------------------------------------- +// 68K memory handlers + +static inline void SendSoundCommand(const INT8 nCommand) +{ +// bprintf(PRINT_NORMAL, _T(" - Sound command sent (0x%02X).\n"), nCommand); + + PsikyoSynchroniseZ80(0); + + nSoundlatch = nCommand; + nSoundlatchAck = 0; + + ZetNmi(); +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall samuraiaReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xC00000: // Joysticks + return ~DrvInput[0] >> 8; + case 0xC00001: + return ~DrvInput[0] & 0xFF; + case 0xC00004: // DIPs + return ~DrvInput[2] >> 8; + case 0xC00005: + return ~DrvInput[2] & 0xFF; + case 0xC00006: // Region + return ~DrvInput[3] >> 8; + case 0xC00007: + return ~DrvInput[3] & 0xFF; + case 0xC00008: { // Inputs / Sound CPU status + return ~DrvInput[1] >> 8; + case 0xC80009: +// bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); + PsikyoSynchroniseZ80(0); + if (!nSoundlatchAck) { + return ~DrvInput[1] & 0xFF; + } + return ~(DrvInput[1] | 0x80) & 0xFF; + } + case 0xC0000B: // VBlank + return ~bVBlank; + +// default: { +// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); +// } + } + return 0; +} + +UINT16 __fastcall samuraiaReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xC00000: // Joysticks + return ~DrvInput[0]; + case 0xC00004: // DIPs + return ~DrvInput[2]; + case 0xC00006: // + return ~DrvInput[3]; + case 0xC00008: { // Inputs / Sound CPU status +// bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); + PsikyoSynchroniseZ80(0); + if (!nSoundlatchAck) { + return ~DrvInput[1]; + } + return ~(DrvInput[1] | 0x80); + } + case 0xC0000A: // VBlank + return ~bVBlank; + + +// default: { +// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); +// } + } + return 0; +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall gunbirdReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xC00000: // Joysticks + return ~DrvInput[0] >> 8; + case 0xC00001: + return ~DrvInput[0] & 0xFF; + case 0xC00002: // Inputs / Sound CPU status + return ~DrvInput[1] >> 8; + case 0xC00003: +// bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); + PsikyoSynchroniseZ80(0); + if (!nSoundlatchAck) { + return ~DrvInput[1] & 0xFF; + } + return ~(DrvInput[1] | 0x80) & 0xFF; + case 0xC00004: // DIPs + return ~DrvInput[2] >> 8; + case 0xC00005: + return ~DrvInput[2] & 0xFF; + case 0xC00006: // Region / VBlank + return ~DrvInput[3] >> 8; + case 0xC00007: + return ~(DrvInput[3] | (bVBlank << 7)) & 0xFF; + +// default: { +// bprintf(PRINT_NORMAL, "Attempt to read byte value of location %x\n", sekAddress); +// } + } + return 0; +} + +UINT16 __fastcall gunbirdReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xC00000: // Joysticks + return ~DrvInput[0]; + case 0xC00002: { // Inputs / Sound CPU status + bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); + PsikyoSynchroniseZ80(0); + if (!nSoundlatchAck) { + return ~DrvInput[1]; + } + return ~(DrvInput[1] | 0x80); + } + case 0xC00004: // DIPs + return ~DrvInput[2]; + case 0xC00006: // Region / VBlank + return ~(DrvInput[3] | (bVBlank << 7)); + +// default: { +// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); +// } + } + return 0; +} + +void __fastcall gunbirdWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + case 0xC00011: // Sound latch + SendSoundCommand(byteValue); + break; + + default: { +// bprintf(PRINT_NORMAL, "Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } + } +} + +void __fastcall gunbirdWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + case 0xC00012: // Sound latch + SendSoundCommand(wordValue & 0xFF); + break; + +// default: { +// bprintf(PRINT_NORMAL, "Attempt to write word value %x to location %x\n", wordValue, sekAddress); +// } + } +} + +// ---------------------------------------------------------------------------- + +static UINT8 s1945_table[256] = { + 0x00, 0x00, 0x64, 0xae, 0x00, 0x00, 0x26, 0x2c, 0x00, 0x00, 0x2c, 0xda, 0x00, 0x00, 0x2c, 0xbc, + 0x00, 0x00, 0x2c, 0x9e, 0x00, 0x00, 0x2f, 0x0e, 0x00, 0x00, 0x31, 0x10, 0x00, 0x00, 0xc5, 0x1e, + 0x00, 0x00, 0x32, 0x90, 0x00, 0x00, 0xac, 0x5c, 0x00, 0x00, 0x2b, 0xc0 +}; + +static UINT8 s1945j_table[256] = { + 0x00, 0x00, 0x64, 0xb6, 0x00, 0x00, 0x26, 0x2c, 0x00, 0x00, 0x2c, 0xda, 0x00, 0x00, 0x2c, 0xbc, + 0x00, 0x00, 0x2c, 0x9e, 0x00, 0x00, 0x2f, 0x0e, 0x00, 0x00, 0x31, 0x10, 0x00, 0x00, 0xc5, 0x92, + 0x00, 0x00, 0x32, 0x90, 0x00, 0x00, 0xac, 0x64, 0x00, 0x00, 0x2b, 0xc0 +}; + +static UINT8 s1945a_table[256] = { + 0x00, 0x00, 0x64, 0xbe, 0x00, 0x00, 0x26, 0x2c, 0x00, 0x00, 0x2c, 0xda, 0x00, 0x00, 0x2c, 0xbc, + 0x00, 0x00, 0x2c, 0x9e, 0x00, 0x00, 0x2f, 0x0e, 0x00, 0x00, 0x31, 0x10, 0x00, 0x00, 0xc7, 0x2a, + 0x00, 0x00, 0x32, 0x90, 0x00, 0x00, 0xad, 0x4c, 0x00, 0x00, 0x2b, 0xc0 +}; + +static UINT8 s1945_mcu_direction, s1945_mcu_latch1, s1945_mcu_latch2, s1945_mcu_inlatch, s1945_mcu_index; +static UINT8 s1945_mcu_latching, s1945_mcu_mode, s1945_mcu_control, s1945_mcu_bctrl; +static const UINT8 *s1945_mcu_table; + +static INT32 TengaiMCUScan(INT32 nAction, INT32 *pnMin) +{ + if (pnMin) { // Return minimum compatible version + *pnMin = 0x020998; + } + + SCAN_VAR(s1945_mcu_direction); + SCAN_VAR(s1945_mcu_latch1); + SCAN_VAR(s1945_mcu_latch2); + SCAN_VAR(s1945_mcu_inlatch); + SCAN_VAR(s1945_mcu_index); + SCAN_VAR(s1945_mcu_latching); + SCAN_VAR(s1945_mcu_mode); + SCAN_VAR(s1945_mcu_control); + SCAN_VAR(s1945_mcu_bctrl); + + if (nAction & ACB_WRITE) { + PsikyoSetTileBank(1, (s1945_mcu_bctrl >> 6) & 3); + PsikyoSetTileBank(0, (s1945_mcu_bctrl >> 4) & 3); + } + + return 0; +} + +static void TengaiMCUInit(const UINT8 *mcu_table) +{ + s1945_mcu_direction = 0x00; + s1945_mcu_inlatch = 0xff; + s1945_mcu_latch1 = 0xff; + s1945_mcu_latch2 = 0xff; + s1945_mcu_latching = 0x5; + s1945_mcu_control = 0xff; + s1945_mcu_index = 0; + s1945_mcu_mode = 0; + s1945_mcu_table = mcu_table; + s1945_mcu_bctrl = 0x00; +} + +void tengaiMCUWrite(UINT32 offset, UINT8 data) +{ + switch (offset) { + case 0x06: + s1945_mcu_inlatch = data; + break; + case 0x07: + PsikyoSetTileBank(1, (data >> 6) & 3); + PsikyoSetTileBank(0, (data >> 4) & 3); + s1945_mcu_bctrl = data; + break; + case 0x08: + s1945_mcu_control = data; + break; + case 0x09: + s1945_mcu_direction = data; + break; + case 0x0b: + switch (data | (s1945_mcu_direction ? 0x100 : 0)) { + case 0x11c: + s1945_mcu_latching = 5; + s1945_mcu_index = s1945_mcu_inlatch; + break; + case 0x013: +// logerror("MCU: Table read index %02x\n", s1945_mcu_index); + s1945_mcu_latching = 1; + s1945_mcu_latch1 = s1945_mcu_table[s1945_mcu_index]; + break; + case 0x113: + s1945_mcu_mode = s1945_mcu_inlatch; + if(s1945_mcu_mode == 1) { + s1945_mcu_latching &= ~1; + s1945_mcu_latch2 = 0x55; + } else { + // Go figure. + s1945_mcu_latching &= ~1; + s1945_mcu_latching |= 2; + } + s1945_mcu_latching &= ~4; + s1945_mcu_latch1 = s1945_mcu_inlatch; + break; + case 0x010: + case 0x110: + s1945_mcu_latching |= 4; + break; + default: +// logerror("MCU: function %02x, direction %02x, latch1 %02x, latch2 %02x (%x)\n", data, s1945_mcu_direction, s1945_mcu_latch1, s1945_mcu_latch2, activecpu_get_pc()); + break; + } + break; +// default: +// logerror("MCU.w %x, %02x (%x)\n", offset, data, activecpu_get_pc()); + } +} + +UINT16 tengaiMCURead(UINT32 offset) +{ + switch (offset) { + case 0: { + UINT16 res; + if (s1945_mcu_control & 16) { + res = s1945_mcu_latching & 4 ? 0xff00 : s1945_mcu_latch1 << 8; + s1945_mcu_latching |= 4; + } else { + res = s1945_mcu_latching & 1 ? 0xff00 : s1945_mcu_latch2 << 8; + s1945_mcu_latching |= 1; + } + res |= s1945_mcu_bctrl & 0x00f0; + return res; + } + case 1: + return (s1945_mcu_latching << 8) | 0x0800; + } + + return 0; +} + +UINT8 __fastcall tengaiReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xC00000: // Joysticks + return ~DrvInput[0] >> 8; + case 0xC00001: + return ~DrvInput[0] & 0xFF; + case 0xC00002: // Inputs / Sound CPU status + return ~DrvInput[1] >> 8; + case 0xC00003: +// bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); + PsikyoSynchroniseZ80(0); + if (!nSoundlatchAck) { + return ~(DrvInput[1] | 0x04) & 0xFF; + } + return ~(DrvInput[1] | 0x84) & 0xFF; + case 0xC00004: // DIPs + return ~DrvInput[2] >> 8; + case 0xC00005: + return ~DrvInput[2] & 0xFF; + case 0xC00006: // Region / MCU + return tengaiMCURead(0) >> 8; + case 0xC00007: + return ((~DrvInput[3] & 0x0F) | tengaiMCURead(0)) & 0xFF; + case 0xC00008: // MCU + return tengaiMCURead(1) >> 8; + case 0xC00009: + return tengaiMCURead(1) & 0xFF; + +// default: { +// bprintf(PRINT_NORMAL, "Attempt to read byte value of location %x\n", sekAddress); +// } + } + return 0; +} + +UINT16 __fastcall tengaiReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xC00000: // Joysticks + return ~DrvInput[0]; + case 0xC00002: { // Inputs / Sound CPU status +// bprintf(PRINT_NORMAL, _T(" - Sound reply read.\n")); + PsikyoSynchroniseZ80(0); + if (!nSoundlatchAck) { + return ~(DrvInput[1] | 0x04); + } + return ~(DrvInput[1] | 0x84); + } + case 0xC00004: // DIPs + return ~DrvInput[2]; + case 0xC00006: // Region / MCU + return (~DrvInput[3] & 0x0F) | tengaiMCURead(0); + case 0xC00008: // MCU + return tengaiMCURead(1); + +// default: { +// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); +// } + } + return 0; +} + +void __fastcall tengaiWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + case 0xC00004: + case 0xC00005: + case 0xC00006: + case 0xC00007: + case 0xC00008: + case 0xC00009: + case 0xC0000A: + case 0xC0000B: + tengaiMCUWrite(sekAddress & 0x0F, byteValue); + break; + + case 0xC00011: // Sound latch + SendSoundCommand(byteValue); + break; + + default: { +// bprintf(PRINT_NORMAL, "Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } + } +} + +void __fastcall tengaiWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + case 0xC00004: + case 0xC00005: + case 0xC00006: + case 0xC00007: + case 0xC00008: + case 0xC00009: + case 0xC0000A: + case 0xC0000B: + tengaiMCUWrite((sekAddress & 0x0F), wordValue >> 8); + tengaiMCUWrite((sekAddress & 0x0F) + 1, wordValue & 0xFF); + break; + + case 0xC00010: // Sound latch + SendSoundCommand(wordValue & 0xFF); + break; + +// default: { +// bprintf(PRINT_NORMAL, "Attempt to write word value %x to location %x\n", wordValue, sekAddress); +// } + } +} + +// ---------------------------------------------------------------------------- + +void __fastcall PsikyoWriteBytePalette(UINT32 sekAddress, UINT8 byteValue) +{ + PsikyoPalWriteByte(sekAddress & 0x1FFF, byteValue); +} + +void __fastcall PsikyoWriteWordPalette(UINT32 sekAddress, UINT16 wordValue) +{ + PsikyoPalWriteWord(sekAddress & 0x1FFF, wordValue); +} + +// ---------------------------------------------------------------------------- + +static INT32 DrvExit() +{ + switch (PsikyoHardwareVersion) { + case PSIKYO_HW_SAMURAIA: + case PSIKYO_HW_GUNBIRD: { + BurnYM2610Exit(); + break; + } + case PSIKYO_HW_S1945: + case PSIKYO_HW_TENGAI: { + BurnYMF278BExit(); + break; + } + } + + PsikyoSpriteExit(); + PsikyoTileExit(); + PsikyoPalExit(); + + SekExit(); + ZetExit(); + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDoReset() +{ + { + SekOpen(0); + SekReset(); + SekClose(); + } + + { + ZetOpen(0); + + nPsikyoZ80Bank = -1; + switch (PsikyoHardwareVersion) { + case PSIKYO_HW_SAMURAIA: { + samuraiaZ80SetBank(0); + break; + } + case PSIKYO_HW_GUNBIRD: + case PSIKYO_HW_S1945: + case PSIKYO_HW_TENGAI: { + gunbirdZ80SetBank(0); + break; + } + } + + ZetReset(); + + ZetClose(); + } + + switch (PsikyoHardwareVersion) { + case PSIKYO_HW_SAMURAIA: + case PSIKYO_HW_GUNBIRD: { + BurnYM2610Reset(); + break; + } + case PSIKYO_HW_S1945: + case PSIKYO_HW_TENGAI: { + BurnYMF278BReset(); + break; + } + } + + nSoundlatch = 0; + nSoundlatchAck = 1; + + nCyclesDone[0] = nCyclesDone[1] = 0; + + return 0; +} + +static INT32 DrvDraw() +{ + PsikyoPalUpdate(); + PsikyoTileRender(); + + return 0; +} + +static INT32 samuraiaCheckSleep(INT32) +{ + return 0; +} + +static INT32 gunbirdCheckSleep(INT32) +{ + return 0; +} + +static INT32 gunbirdjCheckSleep(INT32) +{ + return 0; +} + +static INT32 gunbirdkCheckSleep(INT32) +{ + return 0; +} + +static INT32 s1945jnCheckSleep(INT32) +{ + return 0; +} + +static INT32 psikyoCheckSleep(INT32) +{ +// bprintf(PRINT_NORMAL, "0x%06X\n", SekGetPC(-1)); + + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nCyclesVBlank; + INT32 nInterleave = 16; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x0000; // Joysticks + DrvInput[1] = 0x0000; + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << (i + 8); + DrvInput[0] |= (DrvJoy2[i] & 1) << (i + 0); + + DrvInput[1] |= (DrvInp1[i] & 1) << (i + 0); + DrvInput[1] |= (DrvInp2[i] & 1) << (i + 8); + } + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + + if (nPrevBurnCPUSpeedAdjust != nBurnCPUSpeedAdjust) { + // 68K CPU clock is 16MHz, modified by nBurnCPUSpeedAdjust + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (INT32)(256.0 * 15625.0 / 263.5)); + // Z80 CPU clock is always 4MHz + nCyclesTotal[1] = (INT32)(4000000.0 / (15625.0 / 263.5)); + + // 68K cycles executed each scanline + SekSetCyclesScanline((INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (256 * 15625))); + + nPrevBurnCPUSpeedAdjust = nBurnCPUSpeedAdjust; + } + + nCyclesVBlank = nCyclesTotal[0] * (INT32)(224.0 * 2.0) / (INT32)(263.5 * 2.0); + bVBlank = 0x01; + + ZetOpen(0); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + for (INT32 i = 1; i <= nInterleave; i++) { + + // Run 68000 + INT32 nNext = i * nCyclesTotal[0] / nInterleave; + + // See if we need to trigger the VBlank interrupt + if (bVBlank && nNext >= nCyclesVBlank) { + if (nCyclesDone[0] < nCyclesVBlank) { + nCyclesSegment = nCyclesVBlank - nCyclesDone[0]; + if (!CheckSleep(0)) { // See if this CPU is busywaiting + nCyclesDone[0] += SekRun(nCyclesSegment); + } else { + nCyclesDone[0] += SekIdle(nCyclesSegment); + } + } + + if (pBurnDraw != NULL) { + DrvDraw(); // Draw screen if needed + } + PsikyoSpriteBuffer(); + + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + bVBlank = 0x00; + } + + nCyclesSegment = nNext - nCyclesDone[0]; + if (!CheckSleep(0)) { // See if this CPU is busywaiting + nCyclesDone[0] += SekRun(nCyclesSegment); + } else { + nCyclesDone[0] += SekIdle(nCyclesSegment); + } + } + + switch (PsikyoHardwareVersion) { + case PSIKYO_HW_SAMURAIA: + case PSIKYO_HW_GUNBIRD: { + nCycles68KSync = SekTotalCycles(); + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + break; + } + case PSIKYO_HW_S1945: + case PSIKYO_HW_TENGAI: { + nCycles68KSync = SekTotalCycles(); + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYMF278BUpdate(nBurnSoundLen); + break; + } + default: { + ZetIdle(nCyclesTotal[1] - ZetTotalCycles()); + } + } + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; + + ZetClose(); + SekClose(); + + return 0; +} + +// ---------------------------------------------------------------------------- +// Loading + +static void Nibbleswap(UINT8* pData, INT32 nLen) +{ + for (INT32 i = nLen -2 ; i >= 0; i -= 2) { + UINT16 c = ((pData[i + 0] >> 4) | (pData[i + 0] << 8)) & 0x0F0F; + ((UINT16*)pData)[i + 0] = BURN_ENDIAN_SWAP_INT16(((pData[i + 1] >> 4) | (pData[i + 1] << 8))) & 0x0F0F; + ((UINT16*)pData)[i + 1] = BURN_ENDIAN_SWAP_INT16(c); + } + + return; +} + +static INT32 samuraiaLoadRoms() +{ + // Load 68000 ROM + UINT8* pTemp = (UINT8*)BurnMalloc(0x080000); + if (pTemp == NULL) { + return 1; + } + + BurnLoadRom(pTemp + 0x000000, 0, 1); + BurnLoadRom(pTemp + 0x040000, 1, 1); + + for (INT32 i = 0; i < 0x020000; i++) { + ((UINT16*)Psikyo68KROM)[2 * i + 0] = ((UINT16*)pTemp)[0x000000 + i]; + ((UINT16*)Psikyo68KROM)[2 * i + 1] = ((UINT16*)pTemp)[0x020000 + i]; + } + + BurnFree(pTemp); + + BurnLoadRom(PsikyoSpriteROM + 0x000000, 2, 1); + Nibbleswap(PsikyoSpriteROM, 0x200000); + + BurnLoadRom(PsikyoSpriteLUT, 3, 1); + + BurnLoadRom(PsikyoTileROM + 0x000000, 4, 1); + BurnLoadRom(PsikyoTileROM + 0x100000, 5, 1); + Nibbleswap(PsikyoTileROM, 0x200000); + + BurnLoadRom(PsikyoZ80ROM, 6, 1); + + BurnLoadRom(PsikyoSampleROM02, 7, 1); + + for (INT32 i = 0; i < 0x100000; i++) { + PsikyoSampleROM02[i] = ((PsikyoSampleROM02[i] & 0x80) >> 1) | ((PsikyoSampleROM02[i] & 0x40) << 1) | (PsikyoSampleROM02[i] & 0x3F); + } + + return 0; +} + +static INT32 gunbirdLoadRoms() +{ + // Load 68000 ROM + UINT8* pTemp = (UINT8*)BurnMalloc(0x100000); + if (pTemp == NULL) { + return 1; + } + + BurnLoadRom(pTemp + 0x000000, 0, 1); + BurnLoadRom(pTemp + 0x080000, 1, 1); + + for (INT32 i = 0; i < 0x040000; i++) { + ((UINT16*)Psikyo68KROM)[2 * i + 0] = ((UINT16*)pTemp)[0x000000 + i]; + ((UINT16*)Psikyo68KROM)[2 * i + 1] = ((UINT16*)pTemp)[0x040000 + i]; + } + + BurnFree(pTemp); + + BurnLoadRom(PsikyoSpriteROM + 0x000000, 2, 1); + BurnLoadRom(PsikyoSpriteROM + 0x200000, 3, 1); + BurnLoadRom(PsikyoSpriteROM + 0x400000, 4, 1); + if (PsikyoSpriteROMSize > 0x0C00000) { + BurnLoadRom(PsikyoSpriteROM + 0x600000, 5, 1); + } + Nibbleswap(PsikyoSpriteROM, PsikyoSpriteROMSize >> 1); + + BurnLoadRom(PsikyoSpriteLUT, 6, 1); + + BurnLoadRom(PsikyoTileROM, 7, 1); + Nibbleswap(PsikyoTileROM, 0x200000); + + BurnLoadRom(PsikyoZ80ROM, 8, 1); + + BurnLoadRom(PsikyoSampleROM01, 9, 1); + BurnLoadRom(PsikyoSampleROM02, 10, 1); + + return 0; +} + +static INT32 s1945LoadRoms() +{ + // Load 68000 ROM + UINT8* pTemp = (UINT8*)BurnMalloc(0x100000); + if (pTemp == NULL) { + return 1; + } + + BurnLoadRom(pTemp + 0x000000, 0, 1); + BurnLoadRom(pTemp + 0x080000, 1, 1); + + for (INT32 i = 0; i < 0x040000; i++) { + ((UINT16*)Psikyo68KROM)[2 * i + 0] = ((UINT16*)pTemp)[0x000000 + i]; + ((UINT16*)Psikyo68KROM)[2 * i + 1] = ((UINT16*)pTemp)[0x040000 + i]; + } + + BurnFree(pTemp); + + BurnLoadRom(PsikyoSpriteROM + 0x000000, 2, 1); + BurnLoadRom(PsikyoSpriteROM + 0x200000, 3, 1); + BurnLoadRom(PsikyoSpriteROM + 0x400000, 4, 1); + BurnLoadRom(PsikyoSpriteROM + 0x600000, 5, 1); + Nibbleswap(PsikyoSpriteROM, 0x800000); + + BurnLoadRom(PsikyoSpriteLUT, 6, 1); + + BurnLoadRom(PsikyoTileROM, 7, 1); + Nibbleswap(PsikyoTileROM, 0x200000); + + BurnLoadRom(PsikyoZ80ROM, 8, 1); + + BurnLoadRom(PsikyoSampleROM02, 9, 1); + + return 0; +} + +static void tengaiNibbleswap(UINT8* pData, INT32 nLen) +{ + for (INT32 i = nLen - 1; i >= 0; i--) { + ((UINT16*)pData)[i] = BURN_ENDIAN_SWAP_INT16(((pData[i] >> 4) | (pData[i] << 8))) & 0x0F0F; + } + + return; +} + +static INT32 tengaiLoadRoms() +{ + // Load 68000 ROM + UINT8* pTemp = (UINT8*)BurnMalloc(0x100000); + if (pTemp == NULL) { + return 1; + } + + BurnLoadRom(pTemp + 0x000000, 0, 1); + BurnLoadRom(pTemp + 0x080000, 1, 1); + + for (INT32 i = 0; i < 0x040000; i++) { + ((UINT16*)Psikyo68KROM)[2 * i + 0] = ((UINT16*)pTemp)[0x000000 + i]; + ((UINT16*)Psikyo68KROM)[2 * i + 1] = ((UINT16*)pTemp)[0x040000 + i]; + } + + BurnFree(pTemp); + + BurnLoadRom(PsikyoSpriteROM + 0x000000, 2, 1); + BurnLoadRom(PsikyoSpriteROM + 0x200000, 3, 1); + BurnLoadRom(PsikyoSpriteROM + 0x400000, 4, 1); + tengaiNibbleswap(PsikyoSpriteROM, 0x600000); + + BurnLoadRom(PsikyoSpriteLUT, 5, 1); + + BurnLoadRom(PsikyoTileROM, 6, 1); + tengaiNibbleswap(PsikyoTileROM, 0x400000); + + BurnLoadRom(PsikyoZ80ROM, 7, 1); + + BurnLoadRom(PsikyoSampleROM02 + 0x000000, 8, 1); + BurnLoadRom(PsikyoSampleROM02 + 0x200000, 9, 1); + + return 0; +} + +// ---------------------------------------------------------------------------- + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers + +static INT32 MemIndex() +{ + UINT8* Next; Next = Mem; + + Psikyo68KROM = Next; Next += 0x100000; // 68K program + PsikyoZ80ROM = Next; Next += 0x020000; // Z80 program + PsikyoSpriteROM = Next; Next += PsikyoSpriteROMSize; + PsikyoSpriteLUT = Next; Next += 0x040000; + PsikyoTileROM = Next; Next += PsikyoTileROMSize; + PsikyoSampleROM01 = Next; Next += PsikyoSampleROM01Size; + PsikyoSampleROM02 = Next; Next += PsikyoSampleROM02Size; + RamStart = Next; + Psikyo68KRAM = Next; Next += 0x020000; // 68K work RAM + if (PsikyoHardwareVersion == PSIKYO_HW_SAMURAIA) { + PsikyoZ80RAM = Next; Next += 0x000800; // Z80 work RAM + } else { + PsikyoZ80RAM = Next; Next += 0x000200; // Z80 work RAM + } + PsikyoTileRAM[0] = Next; Next += 0x002000; // Tile layer 0 + PsikyoTileRAM[1] = Next; Next += 0x002000; // Tile layer 1 + PsikyoTileRAM[2] = Next; Next += 0x004000; // Tile attribute RAM + PsikyoSpriteRAM = Next; Next += 0x002000; + PsikyoPalSrc = Next; Next += 0x002000; // palette + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + BurnSetRefreshRate(15625.0 / 263.5); + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "samuraia") || !strcmp(BurnDrvGetTextA(DRV_NAME), "sngkace")) { + PsikyoHardwareVersion = PSIKYO_HW_SAMURAIA; + + CheckSleep = samuraiaCheckSleep; + + PsikyoTileROMSize = 0x0400000; + PsikyoSpriteROMSize = 0x0400000; + + PsikyoSampleROM01Size = 0; + PsikyoSampleROM02Size = 0x100000; + + bPsikyoClearBackground = false; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gunbird") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gunbirdj") || !strcmp(BurnDrvGetTextA(DRV_NAME), "gunbirdk") || !strcmp(BurnDrvGetTextA(DRV_NAME), "btlkroad") || !strcmp(BurnDrvGetTextA(DRV_NAME), "s1945jn")) { + PsikyoHardwareVersion = PSIKYO_HW_GUNBIRD; + + CheckSleep = psikyoCheckSleep; + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gunbird")) { + CheckSleep = gunbirdCheckSleep; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gunbirdj")) { + CheckSleep = gunbirdjCheckSleep; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gunbirdk")) { + CheckSleep = gunbirdkCheckSleep; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945jn")) { + CheckSleep = s1945jnCheckSleep; + } + + PsikyoTileROMSize = 0x0400000; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "btlkroad")) { + PsikyoSpriteROMSize = 0x0C00000; + } else { + PsikyoSpriteROMSize = 0x1000000; + } + + PsikyoSampleROM01Size = 0x080000; + PsikyoSampleROM02Size = 0x100000; + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945jn")) { + bPsikyoClearBackground = false; + } else { + bPsikyoClearBackground = true; + } + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945") || !strcmp(BurnDrvGetTextA(DRV_NAME), "s1945j") || !strcmp(BurnDrvGetTextA(DRV_NAME), "s1945k") || !strcmp(BurnDrvGetTextA(DRV_NAME), "s1945a")) { + PsikyoHardwareVersion = PSIKYO_HW_S1945; + + CheckSleep = psikyoCheckSleep; + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945j")) TengaiMCUInit(s1945j_table); + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945") || !strcmp(BurnDrvGetTextA(DRV_NAME), "s1945k")) TengaiMCUInit(s1945_table); + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "s1945a")) TengaiMCUInit(s1945a_table); + + PsikyoTileROMSize = 0x0400000; + PsikyoSpriteROMSize = 0x1000000; + + PsikyoSampleROM01Size = 0; + PsikyoSampleROM02Size = 0x200000; + + bPsikyoClearBackground = false; + } + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "tengai") || !strcmp(BurnDrvGetTextA(DRV_NAME), "tengaij")) { + PsikyoHardwareVersion = PSIKYO_HW_TENGAI; + + CheckSleep = psikyoCheckSleep; + + TengaiMCUInit(s1945_table); + + PsikyoTileROMSize = 0x0800000; + PsikyoSpriteROMSize = 0x0C00000; + + PsikyoSampleROM01Size = 0; + PsikyoSampleROM02Size = 0x400000; + + bPsikyoClearBackground = false; + } + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + switch (PsikyoHardwareVersion) { + case PSIKYO_HW_SAMURAIA: { + if (samuraiaLoadRoms()) { + return 1; + } + break; + } + case PSIKYO_HW_GUNBIRD: { + if (gunbirdLoadRoms()) { + return 1; + } + break; + } + case PSIKYO_HW_S1945: { + if (s1945LoadRoms()) { + return 1; + } + break; + } + case PSIKYO_HW_TENGAI: { + if (tengaiLoadRoms()) { + return 1; + } + break; + } + } + + { + // 68EC020 setup + SekInit(0, 0x68EC020); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Psikyo68KROM, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(PsikyoSpriteRAM, 0x400000, 0x401FFF, SM_RAM); + SekMapMemory(PsikyoTileRAM[0], 0x800000, 0x801FFF, SM_RAM); + SekMapMemory(PsikyoTileRAM[1], 0x802000, 0x803FFF, SM_RAM); + SekMapMemory(PsikyoTileRAM[2], 0x804000, 0x807FFF, SM_RAM); + SekMapMemory(Psikyo68KRAM, 0xFE0000, 0xFFFFFF, SM_RAM); + + SekMapMemory(PsikyoPalSrc, 0x600000, 0x601FFF, SM_ROM); // Palette RAM (write goes through handler) + SekMapHandler(1, 0x600000, 0x601FFF, SM_WRITE); // + + switch (PsikyoHardwareVersion) { + case PSIKYO_HW_SAMURAIA: { + SekSetReadWordHandler(0, samuraiaReadWord); + SekSetReadByteHandler(0, samuraiaReadByte); + SekSetWriteWordHandler(0, gunbirdWriteWord); + SekSetWriteByteHandler(0, gunbirdWriteByte); + break; + } + case PSIKYO_HW_GUNBIRD: { + SekSetReadWordHandler(0, gunbirdReadWord); + SekSetReadByteHandler(0, gunbirdReadByte); + SekSetWriteWordHandler(0, gunbirdWriteWord); + SekSetWriteByteHandler(0, gunbirdWriteByte); + break; + } + case PSIKYO_HW_S1945: + case PSIKYO_HW_TENGAI: { + SekSetReadWordHandler(0, tengaiReadWord); + SekSetReadByteHandler(0, tengaiReadByte); + SekSetWriteWordHandler(0, tengaiWriteWord); + SekSetWriteByteHandler(0, tengaiWriteByte); + break; + } + } + + SekSetWriteWordHandler(1, PsikyoWriteWordPalette); + SekSetWriteByteHandler(1, PsikyoWriteBytePalette); + + SekClose(); + } + + { + // Z80 setup + ZetInit(0); + ZetOpen(0); + + switch (PsikyoHardwareVersion) { + case PSIKYO_HW_SAMURAIA: { + // fixed ROM + ZetMapArea(0x0000, 0x77FF, 0, PsikyoZ80ROM); + ZetMapArea(0x0000, 0x77FF, 2, PsikyoZ80ROM); + // Work RAM + ZetMapArea(0x7800, 0x7FFF, 0, PsikyoZ80RAM); + ZetMapArea(0x7800, 0x7FFF, 1, PsikyoZ80RAM); + ZetMapArea(0x7800, 0x7FFF, 2, PsikyoZ80RAM); + + + ZetSetInHandler(samuraiaZ80In); + ZetSetOutHandler(samuraiaZ80Out); + break; + } + case PSIKYO_HW_GUNBIRD: { + // fixed ROM + ZetMapArea(0x0000, 0x7FFF, 0, PsikyoZ80ROM); + ZetMapArea(0x0000, 0x7FFF, 2, PsikyoZ80ROM); + // Work RAM + ZetMapArea(0x8000, 0x81FF, 0, PsikyoZ80RAM); + ZetMapArea(0x8000, 0x81FF, 1, PsikyoZ80RAM); + ZetMapArea(0x8000, 0x81FF, 2, PsikyoZ80RAM); + + + ZetSetInHandler(gunbirdZ80In); + ZetSetOutHandler(gunbirdZ80Out); + break; + } + case PSIKYO_HW_S1945: + case PSIKYO_HW_TENGAI: { + // fixed ROM + ZetMapArea(0x0000, 0x7FFF, 0, PsikyoZ80ROM); + ZetMapArea(0x0000, 0x7FFF, 2, PsikyoZ80ROM); + // Work RAM + ZetMapArea(0x8000, 0x81FF, 0, PsikyoZ80RAM); + ZetMapArea(0x8000, 0x81FF, 1, PsikyoZ80RAM); + ZetMapArea(0x8000, 0x81FF, 2, PsikyoZ80RAM); + + ZetSetInHandler(tengaiZ80In); + ZetSetOutHandler(tengaiZ80Out); + break; + } + } + + ZetClose(); + } + + PsikyoPalInit(); + + PsikyoTileInit(PsikyoTileROMSize); + PsikyoSpriteInit(PsikyoSpriteROMSize); + + switch (PsikyoHardwareVersion) { + case PSIKYO_HW_SAMURAIA: + case PSIKYO_HW_GUNBIRD: { + BurnYM2610Init(8000000, PsikyoSampleROM02, &PsikyoSampleROM02Size, PsikyoSampleROM01, &PsikyoSampleROM01Size, &PsikyoFMIRQHandler, PsikyoSynchroniseStream, PsikyoGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 1.20, BURN_SND_ROUTE_BOTH); + break; + } + case PSIKYO_HW_S1945: + case PSIKYO_HW_TENGAI: { + BurnYMF278BInit(0, PsikyoSampleROM02, &PsikyoFMIRQHandler, PsikyoSynchroniseStream); + BurnYMF278BSetRoute(BURN_SND_YMF278B_YMF278B_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYMF278BSetRoute(BURN_SND_YMF278B_YMF278B_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnTimerAttachZet(4000000); + break; + } + } + + nPrevBurnCPUSpeedAdjust = -1; + + DrvDoReset(); // Reset machine + + return 0; +} + +// ---------------------------------------------------------------------------- +// Savestates / scanning + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029521; + } + + if (nAction & ACB_MEMORY_ROM) { // Scan all memory, devices & variables + ba.Data = Psikyo68KROM; + ba.nLen = 0x00100000; + ba.nAddress = 0; + ba.szName = "68K ROM"; + BurnAcb(&ba); + + ba.Data = PsikyoZ80ROM; + ba.nLen = 0x00020000; + ba.nAddress = 0; + ba.szName = "Z80 ROM"; + BurnAcb(&ba); + } + + if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables + ba.Data = Psikyo68KRAM; + ba.nLen = 0x00020000; + ba.nAddress = 0; + ba.szName = "68K RAM"; + BurnAcb(&ba); + + ba.Data = PsikyoZ80RAM; + if (PsikyoHardwareVersion == PSIKYO_HW_SAMURAIA) { + ba.nLen = 0x0000800; + } else { + ba.nLen = 0x0000200; + } + ba.nAddress = 0; + ba.szName = "Z80 RAM"; + BurnAcb(&ba); + + ba.Data = PsikyoTileRAM[0]; + ba.nLen = 0x00002000; + ba.nAddress = 0; + ba.szName = "Tilemap 0"; + BurnAcb(&ba); + + ba.Data = PsikyoTileRAM[1]; + ba.nLen = 0x00002000; + ba.nAddress = 0; + ba.szName = "Tilemap 1"; + BurnAcb(&ba); + + ba.Data = PsikyoTileRAM[2]; + ba.nLen = 0x00004000; + ba.nAddress = 0; + ba.szName = "Tilemap attributes"; + BurnAcb(&ba); + + ba.Data = PsikyoSpriteRAM; + ba.nLen = 0x00002000; + ba.nAddress = 0; + ba.szName = "Sprite tables"; + BurnAcb(&ba); + + ba.Data = PsikyoPalSrc; + ba.nLen = 0x00002000; + ba.nAddress = 0; + ba.szName = "Palette"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + + SekScan(nAction); // Scan 68000 state + + ZetScan(nAction); // Scan Z80 state + + SCAN_VAR(nCyclesDone); + + SCAN_VAR(bVBlank); + + BurnYM2610Scan(nAction, pnMin); + + SCAN_VAR(nSoundlatch); SCAN_VAR(nSoundlatchAck); + + SCAN_VAR(nPsikyoZ80Bank); + + TengaiMCUScan(nAction, pnMin); + + if (nAction & ACB_WRITE) { + int nBank = nPsikyoZ80Bank; + nPsikyoZ80Bank = -1; + + switch (PsikyoHardwareVersion) { + case PSIKYO_HW_SAMURAIA: { + ZetOpen(0); + samuraiaZ80SetBank(nBank); + ZetClose(); + break; + } + case PSIKYO_HW_GUNBIRD: + case PSIKYO_HW_S1945: + case PSIKYO_HW_TENGAI: { + ZetOpen(0); + gunbirdZ80SetBank(nBank); + ZetClose(); + break; + } + } + + PsikyoRecalcPalette = 1; + } + } + + return 0; +} + +// ---------------------------------------------------------------------------- +// Rom information + +// Samurai Aces / Sengoku Ace + +static struct BurnRomInfo samuraiaRomDesc[] = { + { "4-u127.bin", 0x040000, 0x8C9911CA, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "5-u126.bin", 0x040000, 0xD20C3EF0, BRF_ESS | BRF_PRG }, // 1 + + { "u14.bin", 0x200000, 0x00A546CB, BRF_GRA }, // 2 Sprite data + + { "u11.bin", 0x040000, 0x11A04D91, BRF_GRA }, // 3 Sprite LUT + + { "u34.bin", 0x100000, 0xE6A75BD8, BRF_GRA }, // 4 Tile data + { "u35.bin", 0x100000, 0xC4CA0164, BRF_GRA }, // 5 + + { "3-u58.bin", 0x020000, 0x310F5C76, BRF_ESS | BRF_PRG }, // 6 CPU #1 code + + { "u68.bin", 0x100000, 0x9A7F6C34, BRF_SND }, // 7 YM2610 (delta-t) ADPCM data +}; + +STD_ROM_PICK(samuraia) +STD_ROM_FN(samuraia) + +static struct BurnRomInfo sngkaceRomDesc[] = { + { "1-u127.bin", 0x040000, 0x6C45B2F8, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "2-u126.bin", 0x040000, 0x845A6760, BRF_ESS | BRF_PRG }, // 1 + + { "u14.bin", 0x200000, 0x00A546CB, BRF_GRA }, // 2 Sprite data + + { "u11.bin", 0x040000, 0x11A04D91, BRF_GRA }, // 3 Sprite LUT + + { "u34.bin", 0x100000, 0xE6A75BD8, BRF_GRA }, // 4 Tile data + { "u35.bin", 0x100000, 0xC4CA0164, BRF_GRA }, // 5 + + { "3-u58.bin", 0x020000, 0x310F5C76, BRF_ESS | BRF_PRG }, // 6 CPU #1 code + + { "u68.bin", 0x100000, 0x9A7F6C34, BRF_SND }, // 7 YM2610 (delta-t) ADPCM data +}; + +STD_ROM_PICK(sngkace) +STD_ROM_FN(sngkace) + +struct BurnDriver BurnDrvSamuraiA = { + "samuraia", NULL, NULL, NULL, "1993", + "Samurai Aces (World)\0", NULL, "Psikyo / Banpresto", "Psikyo 68EC020", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, + NULL, samuraiaRomInfo, samuraiaRomName, NULL, NULL, gunbirdInputInfo, samuraiaDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvSngkAce = { + "sngkace", "samuraia", NULL, NULL, "1993", + "Sengoku Ace (Japan)\0", NULL, "Psikyo / Banpresto", "Psikyo 68EC020", + L"\u6226\u56FD\u30A8\u30FC\u30B9 (Japan)\0Sengoku Ace\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, + NULL, sngkaceRomInfo, sngkaceRomName, NULL, NULL, gunbirdInputInfo, sngkaceDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 224, 320, 3, 4 +}; + +// Gunbird + +static struct BurnRomInfo gunbirdRomDesc[] = { + { "4.u46", 0x040000, 0xB78EC99D, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "5.u39", 0x040000, 0x925F095D, BRF_ESS | BRF_PRG }, // 1 + + { "u14.bin", 0x200000, 0x7D7E8A00, BRF_GRA }, // 2 Sprite data + { "u24.bin", 0x200000, 0x5E3FFC9D, BRF_GRA }, // 3 + { "u15.bin", 0x200000, 0xA827BFB5, BRF_GRA }, // 4 + { "u25.bin", 0x100000, 0xEF652E0C, BRF_GRA }, // 5 + + { "u3.bin", 0x040000, 0x0905AEB2, BRF_GRA }, // 6 Sprite LUT + + { "u33.bin", 0x200000, 0x54494E6B, BRF_GRA }, // 7 Tile data + + { "3.u71", 0x020000, 0x2168E4BA, BRF_ESS | BRF_PRG }, // 8 CPU #1 code + + { "u64.bin", 0x080000, 0xE187ED4F, BRF_SND }, // 9 YM2610 ADPCM (delta-t) data + { "u56.bin", 0x100000, 0x9E07104D, BRF_SND }, // 10 YM2610 ADPCM data + + { "3020.u19", 0x000001, 0x00000000, BRF_OPT | BRF_NODUMP },// 11 + { "3021.u69", 0x000001, 0x00000000, BRF_OPT | BRF_NODUMP },// 12 +}; + +STD_ROM_PICK(gunbird) +STD_ROM_FN(gunbird) + +static struct BurnRomInfo gunbirdjRomDesc[] = { + { "1.u46", 0x040000, 0x474ABD69, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "2.u39", 0x040000, 0x3E3E661F, BRF_ESS | BRF_PRG }, // 1 + + { "u14.bin", 0x200000, 0x7D7E8A00, BRF_GRA }, // 2 Sprite data + { "u24.bin", 0x200000, 0x5E3FFC9D, BRF_GRA }, // 3 + { "u15.bin", 0x200000, 0xA827BFB5, BRF_GRA }, // 4 + { "u25.bin", 0x100000, 0xEF652E0C, BRF_GRA }, // 5 + + { "u3.bin", 0x040000, 0x0905AEB2, BRF_GRA }, // 6 Sprite LUT + + { "u33.bin", 0x200000, 0x54494E6B, BRF_GRA }, // 7 Tile data + + { "3.u71", 0x020000, 0x2168E4BA, BRF_ESS | BRF_PRG }, // 8 CPU #1 code + + { "u64.bin", 0x080000, 0xE187ED4F, BRF_SND }, // 9 YM2610 ADPCM (delta-t) data + { "u56.bin", 0x100000, 0x9E07104D, BRF_SND }, // 10 YM2610 ADPCM data +}; + +STD_ROM_PICK(gunbirdj) +STD_ROM_FN(gunbirdj) + +static struct BurnRomInfo gunbirdkRomDesc[] = { + { "1k.u46", 0x080000, 0x745CEE52, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "2k.u39", 0x080000, 0x669632FB, BRF_ESS | BRF_PRG }, // 1 + + { "u14.bin", 0x200000, 0x7D7E8A00, BRF_GRA }, // 2 Sprite data + { "u24.bin", 0x200000, 0x5E3FFC9D, BRF_GRA }, // 3 + { "u15.bin", 0x200000, 0xA827BFB5, BRF_GRA }, // 4 + { "u25.bin", 0x100000, 0xEF652E0C, BRF_GRA }, // 5 + + { "u3.bin", 0x040000, 0x0905AEB2, BRF_GRA }, // 6 Sprite LUT + + { "u33.bin", 0x200000, 0x54494E6B, BRF_GRA }, // 7 Tile data + + { "k3.u71", 0x020000, 0x11994055, BRF_ESS | BRF_PRG }, // 8 CPU #1 code + + { "u64.bin", 0x080000, 0xE187ED4F, BRF_SND }, // 9 YM2610 ADPCM (delta-t) data + { "u56.bin", 0x100000, 0x9E07104D, BRF_SND }, // 10 YM2610 ADPCM data +}; + +STD_ROM_PICK(gunbirdk) +STD_ROM_FN(gunbirdk) + +struct BurnDriver BurnDrvGunbird = { + "gunbird", NULL, NULL, NULL, "1994", + "Gunbird (World)\0", NULL, "Psikyo", "Psikyo 68EC020", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, + NULL, gunbirdRomInfo, gunbirdRomName, NULL, NULL, gunbirdInputInfo, gunbirdWorldDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvGunbirdj = { + "gunbirdj", "gunbird", NULL, NULL, "1994", + "Gunbird (Japan)\0", NULL, "Psikyo", "Psikyo 68EC020", + L"Gunbird (Japan)\0\u30AC\u30F3\u30D0\u30FC\u30C9\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, + NULL, gunbirdjRomInfo, gunbirdjRomName, NULL, NULL, gunbirdInputInfo, gunbirdDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvGunbirdk = { + "gunbirdk", "gunbird", NULL, NULL, "1994", + "Gunbird (Korea)\0", NULL, "Psikyo", "Psikyo 68EC020", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, + NULL, gunbirdkRomInfo, gunbirdkRomName, NULL, NULL, gunbirdInputInfo, gunbirdDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 224, 320, 3, 4 +}; + +// Battle K-Road + +static struct BurnRomInfo btlkroadRomDesc[] = { + { "4-u46.bin", 0x040000, 0x8a7a28b4, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "5-u39.bin", 0x040000, 0x933561fa, BRF_ESS | BRF_PRG }, // 1 + + { "u14.bin", 0x200000, 0x282D89C3, BRF_GRA }, // 2 Sprite data + { "u24.bin", 0x200000, 0xBBE9D3D1, BRF_GRA }, // 3 + { "u15.bin", 0x200000, 0xD4D1B07C, BRF_GRA }, // 4 + { "", 0, 0, 0 }, // 5 + + { "u3.bin", 0x040000, 0x30D541ED, BRF_GRA }, // 6 Sprite LUT + + { "u33.bin", 0x200000, 0x4C8577F1, BRF_GRA }, // 7 Tile data + + { "3-u71.bin", 0x020000, 0x22411FAB, BRF_ESS | BRF_PRG }, // 8 CPU #1 code + + { "u64.bin", 0x080000, 0x0F33049F, BRF_SND }, // 9 YM2610 ADPCM (delta-t) data + { "u56.bin", 0x100000, 0x51D73682, BRF_SND }, // 10 YM2610 ADPCM data + + { "tibpal16l8.u69", 260, 0x00000000, BRF_NODUMP }, // NO DUMP + { "tibpal16l8.u19", 260, 0x00000000, BRF_NODUMP }, // NO DUMP +}; + +STD_ROM_PICK(btlkroad) +STD_ROM_FN(btlkroad) + +struct BurnDriver BurnDrvBtlKRoad = { + "btlkroad", NULL, NULL, NULL, "1994", + "Battle K-Road\0", NULL, "Psikyo", "Psikyo 68EC020", + L"Battle K-Road\0Battle K-Road \u30D0\u30C8\u30EB\u30AF\u30ED\u30FC\u30C9\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VSFIGHT, 0, + NULL, btlkroadRomInfo, btlkroadRomName, NULL, NULL, btlkroadInputInfo, btlkroadDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 320, 224, 4, 3 +}; + +// Strikers 1945 (gunbird hardware) + +static struct BurnRomInfo s1945jnRomDesc[] = { + { "1-u46.bin", 0x080000, 0x45FA8086, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "2-u39.bin", 0x080000, 0x0152AB8C, BRF_ESS | BRF_PRG }, // 1 + + { "u20.bin", 0x200000, 0x28A27FEE, BRF_GRA }, // 2 Sprite data + { "u22.bin", 0x200000, 0xCA152A32, BRF_GRA }, // 3 + { "u21.bin", 0x200000, 0xC5d60EA9, BRF_GRA }, // 4 + { "u23.bin", 0x200000, 0x48710332, BRF_GRA }, // 5 + + { "u1.bin", 0x040000, 0xDEE22654, BRF_GRA }, // 6 Sprite LUT + + { "u34.bin", 0x200000, 0xAAF83E23, BRF_GRA }, // 7 Tile data + + { "3-u71.bin", 0x020000, 0xE3E366BD, BRF_ESS | BRF_PRG }, // 8 CPU #1 code + + { "u64.bin", 0x080000, 0xA44A4A9b, BRF_SND }, // 9 YM2610 ADPCM (delta-t) data + { "u56.bin", 0x100000, 0xFE1312C2, BRF_SND }, // 10 YM2610 ADPCM data +}; + +STD_ROM_PICK(s1945jn) +STD_ROM_FN(s1945jn) + +struct BurnDriver BurnDrvS1945jn = { + "s1945jn", "s1945", NULL, NULL, "1995", + "Strikers 1945 (Japan, unprotected)\0", NULL, "Psikyo", "Psikyo 68EC020", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, + NULL, s1945jnRomInfo, s1945jnRomName, NULL, NULL, gunbirdInputInfo, s1945DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 224, 320, 3, 4 +}; + +// Strikers 1945 + +static struct BurnRomInfo s1945RomDesc[] = { + { "2s.u40", 0x040000, 0x9B10062A, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "3s.u41", 0x040000, 0xF87E871A, BRF_ESS | BRF_PRG }, // 1 + + { "u20.bin", 0x200000, 0x28A27FEE, BRF_GRA }, // 2 Sprite data + { "u22.bin", 0x200000, 0xCA152A32, BRF_GRA }, // 3 + { "u21.bin", 0x200000, 0xC5d60EA9, BRF_GRA }, // 4 + { "u23.bin", 0x200000, 0x48710332, BRF_GRA }, // 5 + + { "u1.bin", 0x040000, 0xDEE22654, BRF_GRA }, // 6 Sprite LUT + + { "u34.bin", 0x200000, 0xAAF83E23, BRF_GRA }, // 7 Tile data + + { "3-u63.bin", 0x020000, 0x42D40AE1, BRF_ESS | BRF_PRG }, // 8 CPU #1 code + + { "u61.bin", 0x200000, 0xA839CF47, BRF_SND }, // 9 PCM data + + { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, +}; + +STD_ROM_PICK(s1945) +STD_ROM_FN(s1945) + +static struct BurnRomInfo s1945jRomDesc[] = { + { "1-u40.bin", 0x040000, 0xC00EB012, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "2-u41.bin", 0x040000, 0x3F5A134B, BRF_ESS | BRF_PRG }, // 1 + + { "u20.bin", 0x200000, 0x28A27FEE, BRF_GRA }, // 2 Sprite data + { "u22.bin", 0x200000, 0xCA152A32, BRF_GRA }, // 3 + { "u21.bin", 0x200000, 0xC5d60EA9, BRF_GRA }, // 4 + { "u23.bin", 0x200000, 0x48710332, BRF_GRA }, // 5 + + { "u1.bin", 0x040000, 0xDEE22654, BRF_GRA }, // 6 Sprite LUT + + { "u34.bin", 0x200000, 0xAAF83E23, BRF_GRA }, // 7 Tile data + + { "3-u63.bin", 0x020000, 0x42D40AE1, BRF_ESS | BRF_PRG }, // 8 CPU #1 code + + { "u61.bin", 0x200000, 0xA839CF47, BRF_SND }, // 9 PCM data + + { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, +}; + +STD_ROM_PICK(s1945j) +STD_ROM_FN(s1945j) + +static struct BurnRomInfo s1945kRomDesc[] = { + { "10.u40", 0x040000, 0x5a32af36, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "9.u41", 0x040000, 0x29cc6d7d, BRF_ESS | BRF_PRG }, // 1 + + { "u20.bin", 0x200000, 0x28A27FEE, BRF_GRA }, // 2 Sprite data + { "u22.bin", 0x200000, 0xCA152A32, BRF_GRA }, // 3 + { "u21.bin", 0x200000, 0xC5d60EA9, BRF_GRA }, // 4 + { "u23.bin", 0x200000, 0x48710332, BRF_GRA }, // 5 + + { "u1.bin", 0x040000, 0xDEE22654, BRF_GRA }, // 6 Sprite LUT + + { "u34.bin", 0x200000, 0xAAF83E23, BRF_GRA }, // 7 Tile data + + { "3-u63.bin", 0x020000, 0x42D40AE1, BRF_ESS | BRF_PRG }, // 8 CPU #1 code + + { "u61.bin", 0x200000, 0xA839CF47, BRF_SND }, // 9 PCM data + + { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, +}; + +STD_ROM_PICK(s1945k) +STD_ROM_FN(s1945k) + +static struct BurnRomInfo s1945aRomDesc[] = { + { "4-u40.bin", 0x040000, 0x29ffc217, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "5-u41.bin", 0x040000, 0xc3d3fb64, BRF_ESS | BRF_PRG }, // 1 + + { "u20.bin", 0x200000, 0x28A27FEE, BRF_GRA }, // 2 Sprite data + { "u22.bin", 0x200000, 0xCA152A32, BRF_GRA }, // 3 + { "u21.bin", 0x200000, 0xC5d60EA9, BRF_GRA }, // 4 + { "u23.bin", 0x200000, 0x48710332, BRF_GRA }, // 5 + + { "u1.bin", 0x040000, 0xDEE22654, BRF_GRA }, // 6 Sprite LUT + + { "u34.bin", 0x200000, 0xAAF83E23, BRF_GRA }, // 7 Tile data + + { "3-u63.bin", 0x020000, 0x42D40AE1, BRF_ESS | BRF_PRG }, // 8 CPU #1 code + + { "u61.bin", 0x200000, 0xA839CF47, BRF_SND }, // 9 PCM data + + { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, +}; + +STD_ROM_PICK(s1945a) +STD_ROM_FN(s1945a) + +struct BurnDriver BurnDrvS1945 = { + "s1945", NULL, NULL, NULL, "1995", + "Strikers 1945\0", NULL, "Psikyo", "Psikyo 68EC020", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, + NULL, s1945RomInfo, s1945RomName, NULL, NULL, gunbirdInputInfo, s1945WorldDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvS1945j = { + "s1945j", "s1945", NULL, NULL, "1995", + "Strikers 1945 (Japan)\0", NULL, "Psikyo", "Psikyo 68EC020", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, + NULL, s1945jRomInfo, s1945jRomName, NULL, NULL, gunbirdInputInfo, s1945DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvS1945k = { + "s1945k", "s1945", NULL, NULL, "1995", + "Strikers 1945 (Korea)\0", NULL, "Psikyo", "Psikyo 68EC020", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, + NULL, s1945kRomInfo, s1945kRomName, NULL, NULL, gunbirdInputInfo, s1945DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvS1945a = { + "s1945a", "s1945", NULL, NULL, "1995", + "Strikers 1945 (Alt)\0", NULL, "Psikyo", "Psikyo 68EC020", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_VERSHOOT, 0, + NULL, s1945aRomInfo, s1945aRomName, NULL, NULL, gunbirdInputInfo, s1945aDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 224, 320, 3, 4 +}; + +// Tengai + +static struct BurnRomInfo tengaiRomDesc[] = { + { "5-u40.bin", 0x080000, 0x90088195, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "4-u41.bin", 0x080000, 0x0d53196c, BRF_ESS | BRF_PRG }, // 1 + + { "u20.bin", 0x200000, 0xED42EF73, BRF_GRA }, // 2 Sprite data + { "u22.bin", 0x200000, 0x8D21CAEE, BRF_GRA }, // 3 + { "u21.bin", 0x200000, 0xEFE34EED, BRF_GRA }, // 4 + + { "u1.bin", 0x040000, 0x681D7D55, BRF_GRA }, // 5 Sprite LUT + + { "u34.bin", 0x400000, 0x2A2E2EEB, BRF_GRA }, // 6 Tile data + + { "1-u63.bin", 0x020000, 0x2025E387, BRF_ESS | BRF_PRG }, // 7 CPU #1 code + + { "u61.bin", 0x200000, 0xA63633C5, BRF_SND }, // 8 PCM data + { "u62.bin", 0x200000, 0x3AD0C357, BRF_SND }, // 9 + + { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, +}; + +STD_ROM_PICK(tengai) +STD_ROM_FN(tengai) + +struct BurnDriver BurnDrvTengai = { + "tengai", NULL, NULL, NULL, "1996", + "Tengai (world)\0", NULL, "Psikyo", "Psikyo 68EC020", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_PSIKYO, GBF_HORSHOOT, 0, + NULL, tengaiRomInfo, tengaiRomName, NULL, NULL, gunbirdInputInfo, tengaiDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 320, 224, 4, 3 +}; + +static struct BurnRomInfo tengaijRomDesc[] = { + { "2-u40.bin", 0x080000, 0xAB6FE58A, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "3-u41.bin", 0x080000, 0x02E42E39, BRF_ESS | BRF_PRG }, // 1 + + { "u20.bin", 0x200000, 0xED42EF73, BRF_GRA }, // 2 Sprite data + { "u22.bin", 0x200000, 0x8D21CAEE, BRF_GRA }, // 3 + { "u21.bin", 0x200000, 0xEFE34EED, BRF_GRA }, // 4 + + { "u1.bin", 0x040000, 0x681D7D55, BRF_GRA }, // 5 Sprite LUT + + { "u34.bin", 0x400000, 0x2A2E2EEB, BRF_GRA }, // 6 Tile data + + { "1-u63.bin", 0x020000, 0x2025E387, BRF_ESS | BRF_PRG }, // 7 CPU #1 code + + { "u61.bin", 0x200000, 0xA63633C5, BRF_SND }, // 8 PCM data + { "u62.bin", 0x200000, 0x3AD0C357, BRF_SND }, // 9 + + { "4-u59.bin", 256, 0x00000000, BRF_NODUMP }, +}; + +STD_ROM_PICK(tengaij) +STD_ROM_FN(tengaij) + +struct BurnDriver BurnDrvTengaij = { + "tengaij", "tengai", NULL, NULL, "1996", + "Tengai\0Sengoku Blade - sengoku ace episode II\0", NULL, "Psikyo", "Psikyo 68EC020", + L"Tengai\0\u6226\u56FD\u30D6\u30EC\u30FC\u30C9 - sengoku ace episode II\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_CLONE, 2, HARDWARE_PSIKYO, GBF_HORSHOOT, 0, + NULL, tengaijRomInfo, tengaijRomName, NULL, NULL, gunbirdInputInfo, tengaijDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &PsikyoRecalcPalette, 0x1000, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_aerofgt.cpp b/src/burn/drv/pst90s/d_aerofgt.cpp index 70a88ab7e..2bf9536ba 100644 --- a/src/burn/drv/pst90s/d_aerofgt.cpp +++ b/src/burn/drv/pst90s/d_aerofgt.cpp @@ -1,4433 +1,4428 @@ -/* - * Aero Fighters driver for FB Alpha 0.2.96.71 - * Port by OopsWare. 2007 - * http://oopsware.googlepages.com - * http://oopsware.ys168.com - * - * 6.13.2007 - * Add driver Spinal Breakers (spinlbrk) - * - * 6.12.2007 - * Add driver Karate Blazers (karatblz) - * - * 6.11.2007 - * Add driver Turbo Force (turbofrc) - * - * 6.10.2007 - * Add BurnHighCol support, and add BDF_16BIT_ONLY into driver. thanks to KEV - * - */ - -#include "burnint.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2610.h" - -#define USE_BURN_HIGHCOL 1 - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy4[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - -static UINT8 DrvInput[10] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *RomZ80; -static UINT8 *RomBg; -static UINT8 *RomSpr1; -static UINT8 *RomSpr2; -static UINT8 *RomSnd1; -static UINT8 *RomSnd2; - -static UINT8 *RamPal; -static UINT16 *RamRaster; -static UINT16 *RamBg1V, *RamBg2V; -static UINT16 *RamSpr1; -static UINT16 *RamSpr2; -static UINT16 *RamSpr3; -static UINT8 *Ram01; -static UINT8 *RamZ80; - -//static INT32 nCyclesDone[2]; -static INT32 nCyclesTotal[2]; -//static INT32 nCyclesSegment; - -static UINT8 RamGfxBank[8]; - -static UINT16 *RamCurPal; -static UINT8 *DeRomBg; -static UINT8 *DeRomSpr1; -static UINT8 *DeRomSpr2; - -static UINT32 RamSpr1SizeMask; -static UINT32 RamSpr2SizeMask; -static UINT32 RomSpr1SizeMask; -static UINT32 RomSpr2SizeMask; - -static INT32 pending_command = 0; -static INT32 RomSndSize1, RomSndSize2; - -static UINT16 bg1scrollx, bg2scrollx; -static UINT16 bg1scrolly, bg2scrolly; - -static INT32 nAerofgtZ80Bank; -static UINT8 nSoundlatch; - -#if USE_BURN_HIGHCOL - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour & 0x001F) << 3; // Red - r |= r >> 5; - g = (nColour & 0x03E0) >> 2; // Green - g |= g >> 5; - b = (nColour & 0x7C00) >> 7; // Blue - b |= b >> 5; - - return BurnHighCol(b, g, r, 0); -} - -#else - -inline static UINT32 CalcCol(UINT16 nColour) -{ - return (nColour & 0x001F) | ((nColour & 0x7FE0) << 1); -} - -#endif - -static struct BurnInputInfo aerofgtInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 2, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 3, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - - {"P3 Coin", BIT_DIGITAL, DrvButton + 6, "p3 coin"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, -}; - -STDINPUTINFO(aerofgt) - -static struct BurnDIPInfo aerofgtDIPList[] = { - // Defaults - {0x12, 0xFF, 0xFF, 0x00, NULL}, - {0x13, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, "Coin Slot"}, - {0x12, 0x01, 0x01, 0x00, "Same"}, - {0x12, 0x01, 0x01, 0x01, "Individual"}, - {0, 0xFE, 0, 8, "Coin 1"}, - {0x12, 0x01, 0x0E, 0x00, "1 coin 1 credits"}, - {0x12, 0x01, 0x0E, 0x02, "2 coin 1 credits"}, - {0x12, 0x01, 0x0E, 0x04, "3 coin 1 credit"}, - {0x12, 0x01, 0x0E, 0x06, "1 coin 2 credits"}, - {0x12, 0x01, 0x0E, 0x08, "1 coins 3 credit"}, - {0x12, 0x01, 0x0E, 0x0A, "1 coins 4 credit"}, - {0x12, 0x01, 0x0E, 0x0C, "1 coins 5 credit"}, - {0x12, 0x01, 0x0E, 0x0E, "1 coins 6 credit"}, - {0, 0xFE, 0, 8, "Coin 2"}, - {0x12, 0x01, 0x70, 0x00, "1 coin 1 credits"}, - {0x12, 0x01, 0x70, 0x10, "2 coin 1 credits"}, - {0x12, 0x01, 0x70, 0x20, "3 coin 1 credit"}, - {0x12, 0x01, 0x70, 0x30, "1 coin 2 credits"}, - {0x12, 0x01, 0x70, 0x40, "1 coins 3 credit"}, - {0x12, 0x01, 0x70, 0x50, "1 coins 4 credit"}, - {0x12, 0x01, 0x70, 0x60, "1 coins 5 credit"}, - {0x12, 0x01, 0x70, 0x70, "1 coins 6 credit"}, - {0, 0xFE, 0, 2, "2 Coins to Start, 1 to Continue"}, - {0x12, 0x01, 0x80, 0x00, "Off"}, - {0x12, 0x01, 0x80, 0x80, "On"}, - - // DIP 2 - {0, 0xFE, 0, 2, "Screen flip"}, - {0x13, 0x01, 0x01, 0x00, "Off"}, - {0x13, 0x01, 0x01, 0x01, "On"}, - {0, 0xFE, 0, 2, "Demo sound"}, - {0x13, 0x01, 0x02, 0x00, "Off"}, - {0x13, 0x01, 0x02, 0x02, "On"}, - {0, 0xFE, 0, 4, "Difficulty"}, - {0x13, 0x01, 0x0C, 0x00, "Normal"}, - {0x13, 0x01, 0x0C, 0x04, "Easy"}, - {0x13, 0x01, 0x0C, 0x08, "Hard"}, - {0x13, 0x01, 0x0C, 0x0C, "Hardest"}, - {0, 0xFE, 0, 4, "Lives"}, - {0x13, 0x01, 0x30, 0x00, "3"}, - {0x13, 0x01, 0x30, 0x10, "1"}, - {0x13, 0x01, 0x30, 0x20, "2"}, - {0x13, 0x01, 0x30, 0x30, "4"}, - {0, 0xFE, 0, 2, "Bonus Life"}, - {0x13, 0x01, 0x40, 0x00, "200000"}, - {0x13, 0x01, 0x40, 0x40, "300000"}, - {0, 0xFE, 0, 2, "Service"}, - {0x13, 0x01, 0x80, 0x00, "Off"}, - {0x13, 0x01, 0x80, 0x80, "On"}, - -}; - -static struct BurnDIPInfo aerofgt_DIPList[] = { - {0x14, 0xFF, 0xFF, 0x0F, NULL}, - - // DIP 3 - {0, 0xFE, 0, 5, "Region"}, - {0x14, 0x01, 0x0F, 0x00, "USA"}, - {0x14, 0x01, 0x0F, 0x01, "Korea"}, - {0x14, 0x01, 0x0F, 0x02, "Hong Kong"}, - {0x14, 0x01, 0x0F, 0x04, "Taiwan"}, - {0x14, 0x01, 0x0F, 0x0F, "Any"}, -}; - -STDDIPINFOEXT(aerofgt, aerofgt, aerofgt_) - -// Rom information -static struct BurnRomInfo aerofgtRomDesc[] = { - { "1.u4", 0x080000, 0x6fdff0a2, BRF_ESS | BRF_PRG }, // 68000 code swapped - - { "538a54.124", 0x080000, 0x4d2c4df2, BRF_GRA }, // graphics - { "1538a54.124", 0x080000, 0x286d109e, BRF_GRA }, - - { "538a53.u9", 0x100000, 0x630d8e0b, BRF_GRA }, // - { "534g8f.u18", 0x080000, 0x76ce0926, BRF_GRA }, - - { "2.153", 0x020000, 0xa1ef64ec, BRF_ESS | BRF_PRG }, // Sound CPU - - { "it-19-01", 0x040000, 0x6d42723d, BRF_SND }, // samples - { "it-19-06", 0x100000, 0xcdbbdb1d, BRF_SND }, -}; - -STD_ROM_PICK(aerofgt) -STD_ROM_FN(aerofgt) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x080000; // 68000 ROM - RomZ80 = Next; Next += 0x030000; // Z80 ROM - RomBg = Next; Next += 0x200040; // Background, 1M 8x8x4bit decode to 2M + 64Byte safe - DeRomBg = RomBg + 0x000040; - RomSpr1 = Next; Next += 0x200000; // Sprite 1 , 1M 16x16x4bit decode to 2M + 256Byte safe - RomSpr2 = Next; Next += 0x100100; // Sprite 2 - - DeRomSpr1 = RomSpr1 + 0x000100; - DeRomSpr2 = RomSpr2 += 0x000100; - - RomSnd1 = Next; Next += 0x040000; // ADPCM data - RomSndSize1 = 0x040000; - RomSnd2 = Next; Next += 0x100000; // ADPCM data - RomSndSize2 = 0x100000; - RamStart = Next; - - RamPal = Next; Next += 0x000800; // 1024 of X1R5G5B5 Palette - RamRaster = (UINT16 *)Next; Next += 0x000800 * sizeof(UINT16); // 0x1b0000~0x1b07ff, Raster - // 0x1b0800~0x1b0801, NOP - // 0x1b0ff0~0x1b0fff, stack area during boot - RamBg1V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG1 Video Ram - RamBg2V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG2 Video Ram - RamSpr1 = (UINT16 *)Next; Next += 0x004000 * sizeof(UINT16); // Sprite 1 Ram - RamSpr2 = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // Sprite 2 Ram - Ram01 = Next; Next += 0x010000; // Work Ram - RamZ80 = Next; Next += 0x000800; // Z80 Ram 2K - - RamEnd = Next; - - RamCurPal = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // 1024 colors - - MemEnd = Next; - return 0; -} - -static void DecodeBg() -{ - for (INT32 c=0x8000-1; c>=0; c--) { - for (INT32 y=7; y>=0; y--) { - DeRomBg[(c * 64) + (y * 8) + 7] = RomBg[0x00002 + (y * 4) + (c * 32)] & 0x0f; - DeRomBg[(c * 64) + (y * 8) + 6] = RomBg[0x00002 + (y * 4) + (c * 32)] >> 4; - DeRomBg[(c * 64) + (y * 8) + 5] = RomBg[0x00003 + (y * 4) + (c * 32)] & 0x0f; - DeRomBg[(c * 64) + (y * 8) + 4] = RomBg[0x00003 + (y * 4) + (c * 32)] >> 4; - DeRomBg[(c * 64) + (y * 8) + 3] = RomBg[0x00000 + (y * 4) + (c * 32)] & 0x0f; - DeRomBg[(c * 64) + (y * 8) + 2] = RomBg[0x00000 + (y * 4) + (c * 32)] >> 4; - DeRomBg[(c * 64) + (y * 8) + 1] = RomBg[0x00001 + (y * 4) + (c * 32)] & 0x0f; - DeRomBg[(c * 64) + (y * 8) + 0] = RomBg[0x00001 + (y * 4) + (c * 32)] >> 4; - } - } -} - -static void DecodeSpr(UINT8 *d, UINT8 *s, INT32 cnt) -{ - for (INT32 c=cnt-1; c>=0; c--) - for (INT32 y=15; y>=0; y--) { - d[(c * 256) + (y * 16) + 15] = s[0x00006 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 14] = s[0x00006 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 13] = s[0x00007 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 12] = s[0x00007 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 11] = s[0x00004 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 10] = s[0x00004 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 9] = s[0x00005 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 8] = s[0x00005 + (y * 8) + (c * 128)] >> 4; - - d[(c * 256) + (y * 16) + 7] = s[0x00002 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 6] = s[0x00002 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 5] = s[0x00003 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 4] = s[0x00003 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 3] = s[0x00000 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 2] = s[0x00000 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 1] = s[0x00001 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 0] = s[0x00001 + (y * 8) + (c * 128)] >> 4; - } -} - -static INT32 LoadRoms() -{ - // Load 68000 ROM - if (BurnLoadRom(Rom01, 0, 1)) { - return 1; - } - - // Load Graphic - BurnLoadRom(RomBg, 1, 1); - BurnLoadRom(RomBg+0x80000, 2, 1); - DecodeBg(); - - BurnLoadRom(RomSpr1+0x000000, 3, 1); - BurnLoadRom(RomSpr1+0x100000, 4, 1); - DecodeSpr(DeRomSpr1, RomSpr1, 8192+4096); - - // Load Z80 ROM - if (BurnLoadRom(RomZ80+0x10000, 5, 1)) return 1; - memcpy(RomZ80, RomZ80+0x10000, 0x10000); - - BurnLoadRom(RomSnd1, 6, 1); - BurnLoadRom(RomSnd2, 7, 1); - - return 0; -} - -UINT8 __fastcall aerofgtReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xFFFFA1: - return ~DrvInput[0]; - case 0xFFFFA3: - return ~DrvInput[1]; - case 0xFFFFA5: - return ~DrvInput[2]; - case 0xFFFFA7: - return ~DrvInput[3]; - case 0xFFFFA9: - return ~DrvInput[4]; - case 0xFFFFAD: - //printf("read pending_command %d addr %08x\n", pending_command, sekAddress); - return pending_command; - case 0xFFFFAF: - return ~DrvInput[5]; -// default: -// printf("Attempt to read byte value of location %x\n", sekAddress); - } - return 0; -} - -/* -UINT16 __fastcall aerofgtReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - - - default: - printf("Attempt to read word value of location %x\n", sekAddress); - } - return 0; -} -*/ - -static void SoundCommand(UINT8 nCommand) -{ -// bprintf(PRINT_NORMAL, _T(" - Sound command sent (0x%02X).\n"), nCommand); - INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]); - if (nCycles <= ZetTotalCycles()) return; - - BurnTimerUpdate(nCycles); - - nSoundlatch = nCommand; - ZetNmi(); -} - -void __fastcall aerofgtWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if (( sekAddress & 0xFF0000 ) == 0x1A0000) { - sekAddress &= 0xFFFF; - if (sekAddress < 0x800) { - RamPal[sekAddress^1] = byteValue; - // palette byte write at boot self-test only ?! - // if (sekAddress & 1) - // RamCurPal[sekAddress>>1] = CalcCol( *((UINT16 *)&RamPal[sekAddress]) ); - } - return; - } - - switch (sekAddress) { - case 0xFFFFC1: - pending_command = 1; - SoundCommand(byteValue); - break; -/* - case 0xFFFFB9: - case 0xFFFFBB: - case 0xFFFFBD: - case 0xFFFFBF: - break; - case 0xFFFFAD: - // NOP - break; - default: - printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); -*/ - } -} - -void __fastcall aerofgtWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - if (( sekAddress & 0xFF0000 ) == 0x1A0000) { - sekAddress &= 0xFFFF; - if (sekAddress < 0x800) - *((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue); - RamCurPal[sekAddress>>1] = CalcCol( wordValue ); - return; - } - - switch (sekAddress) { - case 0xFFFF80: - RamGfxBank[0] = wordValue >> 0x08; - RamGfxBank[1] = wordValue & 0xFF; - break; - case 0xFFFF82: - RamGfxBank[2] = wordValue >> 0x08; - RamGfxBank[3] = wordValue & 0xFF; - break; - case 0xFFFF84: - RamGfxBank[4] = wordValue >> 0x08; - RamGfxBank[5] = wordValue & 0xFF; - break; - case 0xFFFF86: - RamGfxBank[6] = wordValue >> 0x08; - RamGfxBank[7] = wordValue & 0xFF; - break; - case 0xFFFF88: - bg1scrolly = wordValue; - break; - case 0xFFFF90: - bg2scrolly = wordValue; - break; -/* - case 0xFFFF40: - case 0xFFFF42: - case 0xFFFF44: - case 0xFFFF48: - case 0xFFFF4A: - case 0xFFFF4C: - case 0xFFFF50: - case 0xFFFF52: - case 0xFFFF60: - break; - default: - printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); -*/ - } -} - -static void aerofgtFMIRQHandler(INT32, INT32 nStatus) -{ -// bprintf(PRINT_NORMAL, _T(" - IRQ -> %i.\n"), nStatus); - if (nStatus) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 aerofgtSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double aerofgtGetTime() -{ - return (double)ZetTotalCycles() / 4000000.0; -} - -/* -static UINT8 __fastcall aerofgtZ80Read(UINT16 a) -{ - switch (a) { - - default: - printf("Z80 Attempt to read word value of location %04x\n", a); - } - return 0; -} - -static void __fastcall aerofgtZ80Write(UINT16 a,UINT8 v) -{ - switch (a) { - - default: - printf("Attempt to write word value %x to location %x\n", v, a); - } -} -*/ - -static void aerofgtSndBankSwitch(UINT8 v) -{ -/* - UINT8 *rom = memory_region(REGION_CPU2) + 0x10000; - memory_set_bankptr(1,rom + (data & 0x03) * 0x8000); -*/ - v &= 0x03; - if (v != nAerofgtZ80Bank) { - UINT8* nStartAddress = RomZ80 + 0x10000 + (v << 15); - ZetMapArea(0x8000, 0xFFFF, 0, nStartAddress); - ZetMapArea(0x8000, 0xFFFF, 2, nStartAddress); - nAerofgtZ80Bank = v; - } -} - -UINT8 __fastcall aerofgtZ80PortRead(UINT16 p) -{ - switch (p & 0xFF) { - case 0x00: - return BurnYM2610Read(0); - case 0x02: - return BurnYM2610Read(2); - case 0x0C: - return nSoundlatch; -// default: -// printf("Z80 Attempt to read port %04x\n", p); - } - return 0; -} - -void __fastcall aerofgtZ80PortWrite(UINT16 p, UINT8 v) -{ - switch (p & 0x0FF) { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - BurnYM2610Write(p & 3, v); - break; - case 0x04: - aerofgtSndBankSwitch(v); - break; - case 0x08: - pending_command = 0; - break; -// default: -// printf("Z80 Attempt to write %02x to port %04x\n", v, p); - } -} - - -static INT32 DrvDoReset() -{ - nAerofgtZ80Bank = -1; - - SekOpen(0); - //nIRQPending = 0; - SekSetIRQLine(0, SEK_IRQSTATUS_NONE); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - aerofgtSndBankSwitch(0); - ZetClose(); - BurnYM2610Reset(); - - memset(RamGfxBank, 0 , sizeof(RamGfxBank)); - - return 0; -} - -static INT32 aerofgtInit() -{ - Mem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)malloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); - - // Load the roms into memory - - if (LoadRoms()) { - return 1; - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(RamPal, 0x1A0000, 0x1A07FF, SM_ROM); // Palette - SekMapMemory((UINT8 *)RamRaster, - 0x1B0000, 0x1B0FFF, SM_RAM); // Raster / MRA_NOP / MRA_BANK7 - SekMapMemory((UINT8 *)RamBg1V, - 0x1B2000, 0x1B3FFF, SM_RAM); - SekMapMemory((UINT8 *)RamBg2V, - 0x1B4000, 0x1B5FFF, SM_RAM); - SekMapMemory((UINT8 *)RamSpr1, - 0x1C0000, 0x1C7FFF, SM_RAM); - SekMapMemory((UINT8 *)RamSpr2, - 0x1D0000, 0x1D1FFF, SM_RAM); - SekMapMemory(Ram01, 0xFEF000, 0xFFEFFF, SM_RAM); // 64K Work RAM - -// SekSetReadWordHandler(0, aerofgtReadWord); - SekSetReadByteHandler(0, aerofgtReadByte); - SekSetWriteWordHandler(0, aerofgtWriteWord); - SekSetWriteByteHandler(0, aerofgtWriteByte); - - SekClose(); - } - - { - ZetInit(0); - ZetOpen(0); - - ZetMapArea(0x0000, 0x77FF, 0, RomZ80); - ZetMapArea(0x0000, 0x77FF, 2, RomZ80); - - ZetMapArea(0x7800, 0x7FFF, 0, RamZ80); - ZetMapArea(0x7800, 0x7FFF, 1, RamZ80); - ZetMapArea(0x7800, 0x7FFF, 2, RamZ80); - - ZetMemEnd(); - - //ZetSetReadHandler(aerofgtZ80Read); - //ZetSetWriteHandler(aerofgtZ80Write); - ZetSetInHandler(aerofgtZ80PortRead); - ZetSetOutHandler(aerofgtZ80PortWrite); - - ZetClose(); - } - - BurnYM2610Init(8000000, RomSnd2, &RomSndSize2, RomSnd1, &RomSndSize1, &aerofgtFMIRQHandler, aerofgtSynchroniseStream, aerofgtGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); // Reset machine - return 0; -} - -static INT32 DrvExit() -{ - BurnYM2610Exit(); - - ZetExit(); - SekExit(); - - BurnFree(Mem); - - return 0; -} - - -static void drawgfxzoom(INT32 bank,UINT32 code,UINT32 color,INT32 flipx,INT32 flipy,INT32 sx,INT32 sy,INT32 scalex,INT32 scaley) -{ - if (!scalex || !scaley) return; - - UINT16 * p = (UINT16 *) pBurnDraw; - UINT8 * q; - UINT16 * pal; - - if (bank) { - q = DeRomSpr2 + (code) * 256; - pal = RamCurPal + 768; - } else { - q = DeRomSpr1 + (code) * 256; - pal = RamCurPal + 512; - } - - p += sy * 320 + sx; - - if (sx < 0 || sx >= 304 || sy < 0 || sy >= 208 ) { - - if ((sx <= -16) || (sx >= 320) || (sy <= -16) || (sy >= 224)) - return; - - if (flipy) { - - p += 320 * 15; - - if (flipx) { - - for (INT32 i=15;i>=0;i--) { - if (((sy+i)>=0) && ((sy+i)<224)) { - if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[15] | color]; - } - p -= 320; - q += 16; - } - - } else { - - for (INT32 i=15;i>=0;i--) { - if (((sy+i)>=0) && ((sy+i)<224)) { - if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[15] | color]; - } - p -= 320; - q += 16; - } - } - - } else { - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - if (((sy+i)>=0) && ((sy+i)<224)) { - if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[15] | color]; - } - p += 320; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - if (((sy+i)>=0) && ((sy+i)<224)) { - if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[15] | color]; - } - p += 320; - q += 16; - } - - } - - } - - return; - } - - if (flipy) { - - p += 320 * 15; - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15) p[ 0] = pal[ q[15] | color]; - - p -= 320; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15) p[10] = pal[ q[10] | color]; - if (q[11] != 15) p[11] = pal[ q[11] | color]; - if (q[12] != 15) p[12] = pal[ q[12] | color]; - if (q[13] != 15) p[13] = pal[ q[13] | color]; - if (q[14] != 15) p[14] = pal[ q[14] | color]; - if (q[15] != 15) p[15] = pal[ q[15] | color]; - - p -= 320; - q += 16; - } - } - - } else { - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15) p[ 0] = pal[ q[15] | color]; - - p += 320; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15) p[10] = pal[ q[10] | color]; - if (q[11] != 15) p[11] = pal[ q[11] | color]; - if (q[12] != 15) p[12] = pal[ q[12] | color]; - if (q[13] != 15) p[13] = pal[ q[13] | color]; - if (q[14] != 15) p[14] = pal[ q[14] | color]; - if (q[15] != 15) p[15] = pal[ q[15] | color]; - - p += 320; - q += 16; - } - - } - - } - -} - -static void aerofgt_drawsprites(INT32 priority) -{ - priority <<= 12; - INT32 offs = 0; - - while (offs < 0x0400 && (BURN_ENDIAN_SWAP_INT16(RamSpr2[offs]) & 0x8000) == 0) { - INT32 attr_start = (BURN_ENDIAN_SWAP_INT16(RamSpr2[offs]) & 0x03ff) * 4; - - /* is the way I handle priority correct? Or should I just check bit 13? */ - if ((BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x3000) == priority) { - INT32 map_start; - INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color; - - ox = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 1]) & 0x01ff; - xsize = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 1]) & 0x0e00) >> 9; - zoomx = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 1]) & 0xf000) >> 12; - oy = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 0]) & 0x01ff; - ysize = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 0]) & 0x0e00) >> 9; - zoomy = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 0]) & 0xf000) >> 12; - flipx = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x4000; - flipy = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x8000; - color = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x0f00) >> 4; - map_start = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 3]) & 0x3fff; - - ox += (xsize*zoomx+2)/4; - oy += (ysize*zoomy+2)/4; - - zoomx = 32 - zoomx; - zoomy = 32 - zoomy; - - for (y = 0;y <= ysize;y++) { - INT32 sx,sy; - - if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16; - else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16; - - for (x = 0;x <= xsize;x++) { - if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16; - else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16; - - //if (map_start < 0x2000) - INT32 code = BURN_ENDIAN_SWAP_INT16(RamSpr1[map_start]) & 0x1fff; - - drawgfxzoom(map_start&0x2000,code,color,flipx,flipy,sx,sy,zoomx<<11, zoomy<<11); - - map_start++; - } - } - } - offs++; - } -} - - -/* - * aerofgt Background Tile - * 16-bit tile code in RamBg1V and RamBg2V - * 0xE000 shr 13 is Color - * 0x1800 shr 11 is Gfx Bank - * 0x07FF shr 0 or Tile element index (low part) - * - */ - -static void TileBackground_1(UINT16 *bg, UINT16 *pal) -{ - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 64*64; offs++) { - mx++; - if (mx == 64) { - mx = 0; - my++; - } - - x = mx * 8 - BURN_ENDIAN_SWAP_INT16(RamRaster[0x0000]) + 18; - if (x <= -192) x += 512; - - y = my * 8 - (bg1scrolly & 0x1FF); - if (y <= (224-512)) y += 512; - - if ( x<=-8 || x>=320 || y<=-8 || y>= 224 ) - continue; - else - if ( x >=0 && x < 312 && y >= 0 && y < 216) { - - UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - - for (INT32 k=0;k<8;k++) { - p[0] = pal[ d[0] | c ]; - p[1] = pal[ d[1] | c ]; - p[2] = pal[ d[2] | c ]; - p[3] = pal[ d[3] | c ]; - p[4] = pal[ d[4] | c ]; - p[5] = pal[ d[5] | c ]; - p[6] = pal[ d[6] | c ]; - p[7] = pal[ d[7] | c ]; - - d += 8; - p += 320; - } - } else { - - UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - - for (INT32 k=0;k<8;k++) { - if ( (y+k)>=0 && (y+k)<224 ) { - if ((x + 0) >= 0 && (x + 0)<320) p[0] = pal[ d[0] | c ]; - if ((x + 1) >= 0 && (x + 1)<320) p[1] = pal[ d[1] | c ]; - if ((x + 2) >= 0 && (x + 2)<320) p[2] = pal[ d[2] | c ]; - if ((x + 3) >= 0 && (x + 3)<320) p[3] = pal[ d[3] | c ]; - if ((x + 4) >= 0 && (x + 4)<320) p[4] = pal[ d[4] | c ]; - if ((x + 5) >= 0 && (x + 5)<320) p[5] = pal[ d[5] | c ]; - if ((x + 6) >= 0 && (x + 6)<320) p[6] = pal[ d[6] | c ]; - if ((x + 7) >= 0 && (x + 7)<320) p[7] = pal[ d[7] | c ]; - } - d += 8; - p += 320; - } - - } - - } -} - -static void TileBackground_2(UINT16 *bg, UINT16 *pal) -{ - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 64*64; offs++) { - mx++; - if (mx == 64) { - mx = 0; - my++; - } - - x = mx * 8 - BURN_ENDIAN_SWAP_INT16(RamRaster[0x0200]) + 20; - if (x <= -192) x += 512; - - y = my * 8 - (bg2scrolly & 0x1FF); - if (y <= (224-512)) y += 512; - - if ( x<=-8 || x>=320 || y<=-8 || y>= 224 ) - continue; - else - if ( x >=0 && x < 312 && y >= 0 && y < 216) { - - UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - - for (INT32 k=0;k<8;k++) { - - if (d[0] != 15) p[0] = pal[ d[0] | c ]; - if (d[1] != 15) p[1] = pal[ d[1] | c ]; - if (d[2] != 15) p[2] = pal[ d[2] | c ]; - if (d[3] != 15) p[3] = pal[ d[3] | c ]; - if (d[4] != 15) p[4] = pal[ d[4] | c ]; - if (d[5] != 15) p[5] = pal[ d[5] | c ]; - if (d[6] != 15) p[6] = pal[ d[6] | c ]; - if (d[7] != 15) p[7] = pal[ d[7] | c ]; - - d += 8; - p += 320; - } - } else { - - UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - - for (INT32 k=0;k<8;k++) { - if ( (y+k)>=0 && (y+k)<224 ) { - if (d[0] != 15 && (x + 0) >= 0 && (x + 0)<320) p[0] = pal[ d[0] | c ]; - if (d[1] != 15 && (x + 1) >= 0 && (x + 1)<320) p[1] = pal[ d[1] | c ]; - if (d[2] != 15 && (x + 2) >= 0 && (x + 2)<320) p[2] = pal[ d[2] | c ]; - if (d[3] != 15 && (x + 3) >= 0 && (x + 3)<320) p[3] = pal[ d[3] | c ]; - if (d[4] != 15 && (x + 4) >= 0 && (x + 4)<320) p[4] = pal[ d[4] | c ]; - if (d[5] != 15 && (x + 5) >= 0 && (x + 5)<320) p[5] = pal[ d[5] | c ]; - if (d[6] != 15 && (x + 6) >= 0 && (x + 6)<320) p[6] = pal[ d[6] | c ]; - if (d[7] != 15 && (x + 7) >= 0 && (x + 7)<320) p[7] = pal[ d[7] | c ]; - } - d += 8; - p += 320; - } - - } - - } -} - -static INT32 DrvDraw() -{ - // background 1 - TileBackground_1(RamBg1V, RamCurPal); - - aerofgt_drawsprites(0); - aerofgt_drawsprites(1); - - // background 2 - TileBackground_2(RamBg2V, RamCurPal + 256); - - aerofgt_drawsprites(2); - aerofgt_drawsprites(3); - - return 0; -} - -static INT32 DrvFrame() -{ - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x00; // Joy1 - DrvInput[1] = 0x00; // Joy2 - DrvInput[2] = 0x00; // Buttons - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[2] |= (DrvButton[i] & 1) << i; - } - - SekNewFrame(); - ZetNewFrame(); - - nCyclesTotal[0] = 10000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - -// SekSetCyclesScanline(nCyclesTotal[0] / 262); - - SekOpen(0); - ZetOpen(0); - - SekRun(nCyclesTotal[0]); - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - - ZetClose(); - SekClose(); - - if (pBurnDraw) DrvDraw(); - - return 0; -} - - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029671; - } - - if (nAction & ACB_MEMORY_ROM) { // Scan all memory, devices & variables - // - } - - if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - if (nAction & ACB_WRITE) { - // update palette while loaded - UINT16* ps = (UINT16*) RamPal; - UINT16* pd = RamCurPal; - for (INT32 i=0; i<1024; i++, ps++, pd++) - *pd = CalcCol(*ps); - } - } - - if (nAction & ACB_DRIVER_DATA) { - - SekScan(nAction); // Scan 68000 state - - ZetOpen(0); - ZetScan(nAction); // Scan Z80 state - ZetClose(); - - SCAN_VAR(RamGfxBank); - SCAN_VAR(DrvInput); - - BurnYM2610Scan(nAction, pnMin); - SCAN_VAR(nSoundlatch); - SCAN_VAR(nAerofgtZ80Bank); - - if (nAction & ACB_WRITE) { - INT32 nBank = nAerofgtZ80Bank; - nAerofgtZ80Bank = -1; - aerofgtSndBankSwitch(nBank); - } - } - return 0; -} - -struct BurnDriver BurnDrvAerofgt = { - "aerofgt", NULL, NULL, NULL, "1992", - "Aero Fighters\0", NULL, "Video System Co.", "Video System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, FBF_SONICWI, - NULL, aerofgtRomInfo, aerofgtRomName, NULL, NULL, aerofgtInputInfo, aerofgtDIPInfo, - aerofgtInit,DrvExit,DrvFrame,DrvDraw,DrvScan, - NULL, 0x800, 224,320,3,4 -}; - -// ------------------------------------------------------ - -static struct BurnInputInfo turbofrcInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 2, "p1 start"}, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 3, "p2 start"}, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - - {"P3 Coin", BIT_DIGITAL, DrvButton + 7, "p3 start"}, - {"P3 Start", BIT_DIGITAL, DrvJoy3 + 7, "p3 start"}, - {"P3 Up", BIT_DIGITAL, DrvJoy3 + 0, "p3 up"}, - {"P3 Down", BIT_DIGITAL, DrvJoy3 + 1, "p3 down"}, - {"P3 Left", BIT_DIGITAL, DrvJoy3 + 2, "p3 left"}, - {"P3 Right", BIT_DIGITAL, DrvJoy3 + 3, "p3 right"}, - {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 4, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 5, "dip"}, -}; - -STDINPUTINFO(turbofrc) - -static struct BurnDIPInfo turbofrcDIPList[] = { - - // Defaults - {0x16, 0xFF, 0xFF, 0x00, NULL}, - {0x17, 0xFF, 0xFF, 0x06, NULL}, - - // DIP 1 - {0, 0xFE, 0, 8, "Coin 1"}, - {0x16, 0x01, 0x07, 0x00, "1 coins 1 credit"}, - {0x16, 0x01, 0x07, 0x01, "2 coins 1 credit"}, - {0x16, 0x01, 0x07, 0x02, "3 coins 1 credit"}, - {0x16, 0x01, 0x07, 0x03, "4 coins 1 credit"}, - {0x16, 0x01, 0x07, 0x04, "1 coin 2 credits"}, - {0x16, 0x01, 0x07, 0x05, "1 coin 3 credits"}, - {0x16, 0x01, 0x07, 0x06, "1 coin 5 credits"}, - {0x16, 0x01, 0x07, 0x07, "1 coin 6 credits"}, - {0, 0xFE, 0, 2, "2 Coins to Start, 1 to Continue"}, - {0x16, 0x01, 0x08, 0x00, "Off"}, - {0x16, 0x01, 0x08, 0x08, "On"}, - {0, 0xFE, 0, 2, "Coin Slot"}, - {0x16, 0x01, 0x10, 0x00, "Same"}, - {0x16, 0x01, 0x10, 0x10, "Individual"}, - {0, 0xFE, 0, 2, "Play Mode"}, - {0x16, 0x01, 0x20, 0x00, "2 Players"}, - {0x16, 0x01, 0x20, 0x20, "3 Players"}, - {0, 0xFE, 0, 2, "Demo_Sounds"}, - {0x16, 0x01, 0x40, 0x00, "Off"}, - {0x16, 0x01, 0x40, 0x40, "On"}, - {0, 0xFE, 0, 2, "Service"}, - {0x16, 0x01, 0x80, 0x00, "Off"}, - {0x16, 0x01, 0x80, 0x80, "On"}, - - // DIP 2 - {0, 0xFE, 0, 2, "Screen flip"}, - {0x17, 0x01, 0x01, 0x00, "Off"}, - {0x17, 0x01, 0x01, 0x01, "On"}, - {0, 0xFE, 0, 8, "Difficulty"}, - {0x17, 0x01, 0x0E, 0x00, "1 (Easiest)"}, - {0x17, 0x01, 0x0E, 0x02, "2"}, - {0x17, 0x01, 0x0E, 0x04, "3"}, - {0x17, 0x01, 0x0E, 0x06, "4 (Normal)"}, - {0x17, 0x01, 0x0E, 0x08, "5"}, - {0x17, 0x01, 0x0E, 0x0A, "6"}, - {0x17, 0x01, 0x0E, 0x0C, "7"}, - {0x17, 0x01, 0x0E, 0x0E, "8 (Hardest)"}, - {0, 0xFE, 0, 2, "Lives"}, - {0x17, 0x01, 0x10, 0x00, "3"}, - {0x17, 0x01, 0x10, 0x10, "2"}, - {0, 0xFE, 0, 2, "Bonus Life"}, - {0x17, 0x01, 0x20, 0x00, "300000"}, - {0x17, 0x01, 0x20, 0x20, "200000"}, - -}; - -STDDIPINFO(turbofrc) - -static struct BurnRomInfo turbofrcRomDesc[] = { - { "tfrc2.bin", 0x040000, 0x721300ee, BRF_ESS | BRF_PRG }, // 68000 code swapped - { "tfrc1.bin", 0x040000, 0x6cd5312b, BRF_ESS | BRF_PRG }, - { "tfrc3.bin", 0x040000, 0x63f50557, BRF_ESS | BRF_PRG }, - - { "tfrcu94.bin", 0x080000, 0xbaa53978, BRF_GRA }, // gfx1 - { "tfrcu95.bin", 0x020000, 0x71a6c573, BRF_GRA }, - - { "tfrcu105.bin", 0x080000, 0x4de4e59e, BRF_GRA }, // gfx2 - { "tfrcu106.bin", 0x020000, 0xc6479eb5, BRF_GRA }, - - { "tfrcu116.bin", 0x080000, 0xdf210f3b, BRF_GRA }, // gfx3 - { "tfrcu118.bin", 0x040000, 0xf61d1d79, BRF_GRA }, - { "tfrcu117.bin", 0x080000, 0xf70812fd, BRF_GRA }, - { "tfrcu119.bin", 0x040000, 0x474ea716, BRF_GRA }, - - { "tfrcu134.bin", 0x080000, 0x487330a2, BRF_GRA }, // gfx4 - { "tfrcu135.bin", 0x080000, 0x3a7e5b6d, BRF_GRA }, - - { "tfrcu166.bin", 0x020000, 0x2ca14a65, BRF_ESS | BRF_PRG }, // Sound CPU - - { "tfrcu180.bin", 0x020000, 0x39c7c7d5, BRF_SND }, // samples - { "tfrcu179.bin", 0x100000, 0x60ca0333, BRF_SND }, -}; - -STD_ROM_PICK(turbofrc) -STD_ROM_FN(turbofrc) - -UINT8 __fastcall turbofrcReadByte(UINT32 sekAddress) -{ - sekAddress &= 0x0FFFFF; - switch (sekAddress) { - case 0x0FF000: - return ~DrvInput[3]; - case 0x0FF001: - return ~DrvInput[0]; - case 0x0FF002: - return 0xFF; - case 0x0FF003: - return ~DrvInput[1]; - case 0x0FF004: - return ~DrvInput[5]; - case 0x0FF005: - return ~DrvInput[4]; - case 0x0FF007: - return pending_command; - case 0x0FF009: - return ~DrvInput[2]; -// default: -// printf("Attempt to read byte value of location %x\n", sekAddress); - } - return 0; -} - -/* -UINT16 __fastcall turbofrcReadWord(UINT32 sekAddress) -{ -// sekAddress &= 0x0FFFFF; -// switch (sekAddress) { - - -// default: -// printf("Attempt to read word value of location %x\n", sekAddress); -// } - return 0; -} -*/ - -void __fastcall turbofrcWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if (( sekAddress & 0x0FF000 ) == 0x0FE000) { - sekAddress &= 0x07FF; - RamPal[sekAddress^1] = byteValue; - // palette byte write at boot self-test only ?! - //if (sekAddress & 1) - // RamCurPal[sekAddress>>1] = CalcCol( *((UINT16 *)&RamPal[sekAddress & 0xFFE]) ); - return; - } - - sekAddress &= 0x0FFFFF; - - switch (sekAddress) { - - case 0x0FF00E: - pending_command = 1; - SoundCommand(byteValue); - break; -// default: -// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } -} - -void __fastcall turbofrcWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - if (( sekAddress & 0x0FF000 ) == 0x0FE000) { - sekAddress &= 0x07FE; - *((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue); - RamCurPal[sekAddress>>1] = CalcCol( wordValue ); - return; - } - - sekAddress &= 0x0FFFFF; - - switch (sekAddress) { - case 0x0FF002: - bg1scrolly = wordValue; - break; - case 0x0FF004: - bg2scrollx = wordValue; - break; - case 0x0FF006: - bg2scrolly = wordValue; - break; - - case 0x0FF008: - RamGfxBank[0] = (wordValue >> 0) & 0x0f; - RamGfxBank[1] = (wordValue >> 4) & 0x0f; - RamGfxBank[2] = (wordValue >> 8) & 0x0f; - RamGfxBank[3] = (wordValue >> 12) & 0x0f; - break; - case 0x0FF00A: - RamGfxBank[4] = (wordValue >> 0) & 0x0f; - RamGfxBank[5] = (wordValue >> 4) & 0x0f; - RamGfxBank[6] = (wordValue >> 8) & 0x0f; - RamGfxBank[7] = (wordValue >> 12) & 0x0f; - break; - case 0x0FF00C: - // NOP - break; -// default: -// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); - } -} - -UINT8 __fastcall turbofrcZ80PortRead(UINT16 p) -{ - switch (p & 0xFF) { - case 0x14: - return nSoundlatch; - case 0x18: - return BurnYM2610Read(0); - case 0x1A: - return BurnYM2610Read(2); -// default: -// printf("Z80 Attempt to read port %04x\n", p); - } - return 0; -} - -void __fastcall turbofrcZ80PortWrite(UINT16 p, UINT8 v) -{ - switch (p & 0x0FF) { - case 0x18: - case 0x19: - case 0x1A: - case 0x1B: - BurnYM2610Write((p - 0x18) & 3, v); - break; - case 0x00: - aerofgtSndBankSwitch(v); - break; - case 0x14: - pending_command = 0; - break; -// default: -// printf("Z80 Attempt to write %02x to port %04x\n", v, p); - } -} - -static INT32 turbofrcMemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x0C0000; // 68000 ROM - RomZ80 = Next; Next += 0x030000; // Z80 ROM - - RomBg = Next; Next += 0x280040; // - DeRomBg = RomBg + 0x000040; - - RomSpr1 = Next; Next += 0x400000; // Sprite 1 - RomSpr2 = Next; Next += 0x200100; // Sprite 2 - - DeRomSpr1 = RomSpr1 + 0x000100; - DeRomSpr2 = RomSpr2 += 0x000100; - - RomSnd1 = Next; Next += 0x020000; // ADPCM data - RomSndSize1 = 0x020000; - RomSnd2 = Next; Next += 0x100000; // ADPCM data - RomSndSize2 = 0x100000; - - RamStart = Next; - - RamBg1V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG1 Video Ram - RamBg2V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG2 Video Ram - RamSpr1 = (UINT16 *)Next; Next += 0x002000 * sizeof(UINT16); // Sprite 1 Ram - RamSpr2 = (UINT16 *)Next; Next += 0x002000 * sizeof(UINT16); // Sprite 2 Ram - RamSpr3 = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // Sprite 3 Ram - RamRaster = (UINT16 *)Next; Next += 0x000800 * sizeof(UINT16); // Raster Ram - - RamSpr1SizeMask = 0x1FFF; - RamSpr2SizeMask = 0x1FFF; - RomSpr1SizeMask = 0x3FFF; - RomSpr2SizeMask = 0x1FFF; - - Ram01 = Next; Next += 0x014000; // Work Ram - - RamPal = Next; Next += 0x000800; // 1024 of X1R5G5B5 Palette - RamZ80 = Next; Next += 0x000800; // Z80 Ram 2K - - RamEnd = Next; - - RamCurPal = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); - - MemEnd = Next; - return 0; -} - -static void pspikesDecodeBg(INT32 cnt) -{ - for (INT32 c=cnt-1; c>=0; c--) { - for (INT32 y=7; y>=0; y--) { - DeRomBg[(c * 64) + (y * 8) + 7] = RomBg[0x00003 + (y * 4) + (c * 32)] >> 4; - DeRomBg[(c * 64) + (y * 8) + 6] = RomBg[0x00003 + (y * 4) + (c * 32)] & 0x0f; - DeRomBg[(c * 64) + (y * 8) + 5] = RomBg[0x00002 + (y * 4) + (c * 32)] >> 4; - DeRomBg[(c * 64) + (y * 8) + 4] = RomBg[0x00002 + (y * 4) + (c * 32)] & 0x0f; - DeRomBg[(c * 64) + (y * 8) + 3] = RomBg[0x00001 + (y * 4) + (c * 32)] >> 4; - DeRomBg[(c * 64) + (y * 8) + 2] = RomBg[0x00001 + (y * 4) + (c * 32)] & 0x0f; - DeRomBg[(c * 64) + (y * 8) + 1] = RomBg[0x00000 + (y * 4) + (c * 32)] >> 4; - DeRomBg[(c * 64) + (y * 8) + 0] = RomBg[0x00000 + (y * 4) + (c * 32)] & 0x0f; - } - } -} - -static void pspikesDecodeSpr(UINT8 *d, UINT8 *s, INT32 cnt) -{ - for (INT32 c=cnt-1; c>=0; c--) - for (INT32 y=15; y>=0; y--) { - d[(c * 256) + (y * 16) + 15] = s[0x00007 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 14] = s[0x00007 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 13] = s[0x00005 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 12] = s[0x00005 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 11] = s[0x00006 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 10] = s[0x00006 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 9] = s[0x00004 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 8] = s[0x00004 + (y * 8) + (c * 128)] & 0x0f; - - d[(c * 256) + (y * 16) + 7] = s[0x00003 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 6] = s[0x00003 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 5] = s[0x00001 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 4] = s[0x00001 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 3] = s[0x00002 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 2] = s[0x00002 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 1] = s[0x00000 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 0] = s[0x00000 + (y * 8) + (c * 128)] & 0x0f; - } -} - - -static INT32 turbofrcInit() -{ - Mem = NULL; - turbofrcMemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - turbofrcMemIndex(); - - // Load 68000 ROM - if (BurnLoadRom(Rom01+0x00000, 0, 1)) return 1; - if (BurnLoadRom(Rom01+0x40000, 1, 1)) return 1; - if (BurnLoadRom(Rom01+0x80000, 2, 1)) return 1; - - // Load Graphic - BurnLoadRom(RomBg+0x000000, 3, 1); - BurnLoadRom(RomBg+0x080000, 4, 1); - BurnLoadRom(RomBg+0x0A0000, 5, 1); - BurnLoadRom(RomBg+0x120000, 6, 1); - pspikesDecodeBg(0x14000); - - BurnLoadRom(RomSpr1+0x000000, 7, 2); - BurnLoadRom(RomSpr1+0x000001, 9, 2); - BurnLoadRom(RomSpr1+0x100000, 8, 2); - BurnLoadRom(RomSpr1+0x100001, 10, 2); - BurnLoadRom(RomSpr1+0x200000, 11, 2); - BurnLoadRom(RomSpr1+0x200001, 12, 2); - pspikesDecodeSpr(DeRomSpr1, RomSpr1, 0x6000); - - // Load Z80 ROM - if (BurnLoadRom(RomZ80+0x10000, 13, 1)) return 1; - memcpy(RomZ80, RomZ80+0x10000, 0x10000); - - BurnLoadRom(RomSnd1, 14, 1); - BurnLoadRom(RomSnd2, 15, 1); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x0BFFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x0C0000, 0x0CFFFF, SM_RAM); // 64K Work RAM - SekMapMemory((UINT8 *)RamBg1V, - 0x0D0000, 0x0D1FFF, SM_RAM); - SekMapMemory((UINT8 *)RamBg2V, - 0x0D2000, 0x0D3FFF, SM_RAM); - SekMapMemory((UINT8 *)RamSpr1, - 0x0E0000, 0x0E3FFF, SM_RAM); - SekMapMemory((UINT8 *)RamSpr2, - 0x0E4000, 0x0E7FFF, SM_RAM); - SekMapMemory(Ram01+0x10000, 0x0F8000, 0x0FBFFF, SM_RAM); // Work RAM - SekMapMemory(Ram01+0x10000, 0xFF8000, 0xFFBFFF, SM_RAM); // Work RAM - SekMapMemory((UINT8 *)RamSpr3, - 0x0FC000, 0x0FC7FF, SM_RAM); - SekMapMemory((UINT8 *)RamSpr3, - 0xFFC000, 0xFFC7FF, SM_RAM); - SekMapMemory((UINT8 *)RamRaster, - 0x0FD000, 0x0FDFFF, SM_RAM); - SekMapMemory((UINT8 *)RamRaster, - 0xFFD000, 0xFFDFFF, SM_RAM); - SekMapMemory(RamPal, 0x0FE000, 0x0FE7FF, SM_ROM); // Palette - -// SekSetReadWordHandler(0, turbofrcReadWord); - SekSetReadByteHandler(0, turbofrcReadByte); - SekSetWriteWordHandler(0, turbofrcWriteWord); - SekSetWriteByteHandler(0, turbofrcWriteByte); - - SekClose(); - } - - { - ZetInit(0); - ZetOpen(0); - - ZetMapArea(0x0000, 0x77FF, 0, RomZ80); - ZetMapArea(0x0000, 0x77FF, 2, RomZ80); - - ZetMapArea(0x7800, 0x7FFF, 0, RamZ80); - ZetMapArea(0x7800, 0x7FFF, 1, RamZ80); - ZetMapArea(0x7800, 0x7FFF, 2, RamZ80); - - ZetMemEnd(); - - ZetSetInHandler(turbofrcZ80PortRead); - ZetSetOutHandler(turbofrcZ80PortWrite); - - ZetClose(); - } - - BurnYM2610Init(8000000, RomSnd2, &RomSndSize2, RomSnd1, &RomSndSize1, &aerofgtFMIRQHandler, aerofgtSynchroniseStream, aerofgtGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static void turbofrcTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) -{ - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 64*64; offs++) { - mx++; - if (mx == 64) { - mx = 0; - my++; - } - - x = mx * 8 - (BURN_ENDIAN_SWAP_INT16(RamRaster[7]) & 0x1FF) - 11; - if (x <= (352-512)) x += 512; - - y = my * 8 - (bg1scrolly & 0x1FF) - 2; - if (y <= (240-512)) y += 512; - - if ( x<=-8 || x>=352 || y<=-8 || y>= 240 ) - continue; - - else - if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; - - for (INT32 k=0;k<8;k++) { - p[0] = pal[ d[0] | c ]; - p[1] = pal[ d[1] | c ]; - p[2] = pal[ d[2] | c ]; - p[3] = pal[ d[3] | c ]; - p[4] = pal[ d[4] | c ]; - p[5] = pal[ d[5] | c ]; - p[6] = pal[ d[6] | c ]; - p[7] = pal[ d[7] | c ]; - - d += 8; - p += 352; - } - } else { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; - - for (INT32 k=0;k<8;k++) { - if ( (y+k)>=0 && (y+k)<240 ) { - if ((x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; - if ((x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; - if ((x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; - if ((x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; - if ((x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; - if ((x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; - if ((x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; - if ((x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; - } - d += 8; - p += 352; - } - - } - - } -} - -static void turbofrcTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) -{ - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 64*64; offs++) { - mx++; - if (mx == 64) { - mx = 0; - my++; - } - - x = mx * 8 - (bg2scrollx & 0x1FF) + 7; - if (x <= (352-512)) x += 512; - - y = my * 8 - (bg2scrolly & 0x1FF) - 2; - if (y <= (240-512)) y += 512; - - if ( x<=-8 || x>=352 || y<=-8 || y>= 240 ) - continue; - else - if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; - - for (INT32 k=0;k<8;k++) { - - if (d[0] != 15) p[0] = pal[ d[0] | c ]; - if (d[1] != 15) p[1] = pal[ d[1] | c ]; - if (d[2] != 15) p[2] = pal[ d[2] | c ]; - if (d[3] != 15) p[3] = pal[ d[3] | c ]; - if (d[4] != 15) p[4] = pal[ d[4] | c ]; - if (d[5] != 15) p[5] = pal[ d[5] | c ]; - if (d[6] != 15) p[6] = pal[ d[6] | c ]; - if (d[7] != 15) p[7] = pal[ d[7] | c ]; - - d += 8; - p += 352; - } - } else { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; - - for (INT32 k=0;k<8;k++) { - if ( (y+k)>=0 && (y+k)<240 ) { - if (d[0] != 15 && (x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; - if (d[1] != 15 && (x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; - if (d[2] != 15 && (x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; - if (d[3] != 15 && (x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; - if (d[4] != 15 && (x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; - if (d[5] != 15 && (x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; - if (d[6] != 15 && (x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; - if (d[7] != 15 && (x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; - } - d += 8; - p += 352; - } - - } - - } -} - -static void pdrawgfxzoom(INT32 bank,UINT32 code,UINT32 color,INT32 flipx,INT32 flipy,INT32 sx,INT32 sy,INT32 scalex,INT32 scaley) -{ - if (!scalex || !scaley) return; - - UINT16 * p = (UINT16 *) pBurnDraw; - UINT8 * q; - UINT16 * pal; - - if (bank) { - //if (code > RomSpr2SizeMask) - code &= RomSpr2SizeMask; - q = DeRomSpr2 + (code) * 256; - pal = RamCurPal + 768; - } else { - //if (code > RomSpr1SizeMask) - code &= RomSpr1SizeMask; - q = DeRomSpr1 + (code) * 256; - pal = RamCurPal + 512; - } - - p += sy * 352 + sx; - - if (sx < 0 || sx >= (352-16) || sy < 0 || sy >= (240-16) ) { - - if ((sx <= -16) || (sx >= 352) || (sy <= -16) || (sy >= 240)) - return; - - if (flipy) { - - p += 352 * 15; - - if (flipx) { - - for (INT32 i=15;i>=0;i--) { - if (((sy+i)>=0) && ((sy+i)<240)) { - if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<352)) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<352)) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<352)) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<352)) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<352)) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<352)) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<352)) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<352)) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<352)) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<352)) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<352)) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<352)) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<352)) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<352)) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<352)) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<352)) p[ 0] = pal[ q[15] | color]; - } - p -= 352; - q += 16; - } - - } else { - - for (INT32 i=15;i>=0;i--) { - if (((sy+i)>=0) && ((sy+i)<240)) { - if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<352)) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<352)) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<352)) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<352)) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<352)) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<352)) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<352)) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<352)) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<352)) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<352)) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<352)) p[10] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<352)) p[11] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<352)) p[12] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<352)) p[13] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<352)) p[14] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<352)) p[15] = pal[ q[15] | color]; - } - p -= 352; - q += 16; - } - } - - } else { - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - if (((sy+i)>=0) && ((sy+i)<240)) { - if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<352)) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<352)) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<352)) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<352)) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<352)) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<352)) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<352)) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<352)) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<352)) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<352)) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<352)) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<352)) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<352)) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<352)) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<352)) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<352)) p[ 0] = pal[ q[15] | color]; - } - p += 352; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - if (((sy+i)>=0) && ((sy+i)<240)) { - if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<352)) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<352)) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<352)) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<352)) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<352)) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<352)) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<352)) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<352)) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<352)) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<352)) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<352)) p[10] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<352)) p[11] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<352)) p[12] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<352)) p[13] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<352)) p[14] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<352)) p[15] = pal[ q[15] | color]; - } - p += 352; - q += 16; - } - - } - - } - - return; - } - - if (flipy) { - - p += 352 * 15; - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15) p[ 0] = pal[ q[15] | color]; - - p -= 352; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15) p[10] = pal[ q[10] | color]; - if (q[11] != 15) p[11] = pal[ q[11] | color]; - if (q[12] != 15) p[12] = pal[ q[12] | color]; - if (q[13] != 15) p[13] = pal[ q[13] | color]; - if (q[14] != 15) p[14] = pal[ q[14] | color]; - if (q[15] != 15) p[15] = pal[ q[15] | color]; - - p -= 352; - q += 16; - } - } - - } else { - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15) p[ 0] = pal[ q[15] | color]; - - p += 352; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15) p[10] = pal[ q[10] | color]; - if (q[11] != 15) p[11] = pal[ q[11] | color]; - if (q[12] != 15) p[12] = pal[ q[12] | color]; - if (q[13] != 15) p[13] = pal[ q[13] | color]; - if (q[14] != 15) p[14] = pal[ q[14] | color]; - if (q[15] != 15) p[15] = pal[ q[15] | color]; - - p += 352; - q += 16; - } - - } - - } - -} - -static void turbofrc_drawsprites(INT32 chip,INT32 chip_disabled_pri) -{ - INT32 attr_start,base,first; - - base = chip * 0x0200; - first = 4 * BURN_ENDIAN_SWAP_INT16(RamSpr3[0x1fe + base]); - - //for (attr_start = base + 0x0200-8;attr_start >= first + base;attr_start -= 4) { - for (attr_start = first + base; attr_start <= base + 0x0200-8; attr_start += 4) { - INT32 map_start; - INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color,pri; -// some other drivers still use this wrong table, they have to be upgraded -// INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; - - if (!(BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0080)) continue; - pri = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0010; - if ( chip_disabled_pri & !pri) continue; - if (!chip_disabled_pri & (pri>>4)) continue; - ox = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0x01ff; - xsize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0700) >> 8; - zoomx = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0xf000) >> 12; - oy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0x01ff; - ysize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x7000) >> 12; - zoomy = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0xf000) >> 12; - flipx = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0800; - flipy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x8000; - color = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x000f) << 4; // + 16 * spritepalettebank; - - map_start = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 3]); - -// aerofgt has this adjustment, but doing it here would break turbo force title screen -// ox += (xsize*zoomx+2)/4; -// oy += (ysize*zoomy+2)/4; - - zoomx = 32 - zoomx; - zoomy = 32 - zoomy; - - for (y = 0;y <= ysize;y++) { - INT32 sx,sy; - - if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16; - else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16; - - for (x = 0;x <= xsize;x++) { - INT32 code; - - if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16 - 8; - else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16 - 8; - - if (chip == 0) code = BURN_ENDIAN_SWAP_INT16(RamSpr1[map_start & RamSpr1SizeMask]); - else code = BURN_ENDIAN_SWAP_INT16(RamSpr2[map_start & RamSpr2SizeMask]); - - pdrawgfxzoom(chip,code,color,flipx,flipy,sx,sy,zoomx << 11, zoomy << 11); - - map_start++; - } - - if (xsize == 2) map_start += 1; - if (xsize == 4) map_start += 3; - if (xsize == 5) map_start += 2; - if (xsize == 6) map_start += 1; - } - } -} - -static INT32 turbofrcDraw() -{ - turbofrcTileBackground_1(RamBg1V, DeRomBg, RamCurPal); - turbofrcTileBackground_2(RamBg2V, DeRomBg + 0x140000, RamCurPal + 256); - -/* - // we use the priority buffer so sprites are drawn front to back - turbofrc_drawsprites(0,-1); //enemy - turbofrc_drawsprites(0, 0); //enemy - turbofrc_drawsprites(1,-1); //ship - turbofrc_drawsprites(1, 0); //intro -*/ - // in MAME it use a pri-buf control render to draw sprites from front to back - // i'm not use it, is right ??? - - turbofrc_drawsprites(0, 0); - turbofrc_drawsprites(0,-1); - turbofrc_drawsprites(1, 0); - turbofrc_drawsprites(1,-1); - - return 0; -} - -static INT32 turbofrcFrame() -{ - if (DrvReset) DrvDoReset(); - - // Compile digital inputs - // Compile digital inputs - DrvInput[0] = 0x00; // Joy1 - DrvInput[1] = 0x00; // Joy2 - DrvInput[2] = 0x00; // Joy3 - DrvInput[3] = 0x00; // Buttons - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[2] |= (DrvJoy3[i] & 1) << i; - DrvInput[3] |= (DrvButton[i] & 1) << i; - } - - SekNewFrame(); - ZetNewFrame(); - - nCyclesTotal[0] = 10000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - - SekOpen(0); - ZetOpen(0); - - SekRun(nCyclesTotal[0]); - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - - ZetClose(); - SekClose(); - - if (pBurnDraw) turbofrcDraw(); - - return 0; -} - -struct BurnDriver BurnDrvTurbofrc = { - "turbofrc", NULL, NULL, NULL, "1991", - "Turbo Force\0", NULL, "Video System Co.", "Video System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 3, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, turbofrcRomInfo, turbofrcRomName, NULL, NULL, turbofrcInputInfo, turbofrcDIPInfo, - turbofrcInit,DrvExit,turbofrcFrame,turbofrcDraw,DrvScan, - NULL, 0x800,240,352,3,4 -}; - - -// ------------------------------------------------------------ - -static struct BurnInputInfo karatblzInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 2, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 4"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 3, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 4"}, - - {"P3 Coin", BIT_DIGITAL, DrvButton + 4, "p3 coin"}, - {"P3 Start", BIT_DIGITAL, DrvButton + 6, "p3 start"}, - - {"P3 Up", BIT_DIGITAL, DrvJoy3 + 0, "p3 up"}, - {"P3 Down", BIT_DIGITAL, DrvJoy3 + 1, "p3 down"}, - {"P3 Left", BIT_DIGITAL, DrvJoy3 + 2, "p3 left"}, - {"P3 Right", BIT_DIGITAL, DrvJoy3 + 3, "p3 right"}, - {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1"}, - {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2"}, - {"P3 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p3 fire 3"}, - {"P3 Button 4", BIT_DIGITAL, DrvJoy3 + 7, "p3 fire 4"}, - - {"P4 Coin", BIT_DIGITAL, DrvButton + 5, "p4 coin"}, - {"P4 Start", BIT_DIGITAL, DrvButton + 7, "p4 start"}, - - {"P4 Up", BIT_DIGITAL, DrvJoy4 + 0, "p4 up"}, - {"P4 Down", BIT_DIGITAL, DrvJoy4 + 1, "p4 down"}, - {"P4 Left", BIT_DIGITAL, DrvJoy4 + 2, "p4 left"}, - {"P4 Right", BIT_DIGITAL, DrvJoy4 + 3, "p4 right"}, - {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p4 fire 1"}, - {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p4 fire 2"}, - {"P4 Button 3", BIT_DIGITAL, DrvJoy4 + 6, "p4 fire 3"}, - {"P4 Button 4", BIT_DIGITAL, DrvJoy4 + 7, "p4 fire 4"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 6, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 7, "dip"}, -}; - -STDINPUTINFO(karatblz) - -static struct BurnDIPInfo karatblzDIPList[] = { - - // Defaults - {0x29, 0xFF, 0xFF, 0x00, NULL}, - {0x2A, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 8, "Coinage"}, - {0x29, 0x01, 0x07, 0x00, "1 coin 1 credit"}, - {0x29, 0x01, 0x07, 0x01, "2 coins 1 credit"}, - {0x29, 0x01, 0x07, 0x02, "3 coins 1 credit"}, - {0x29, 0x01, 0x07, 0x03, "4 coins 1 credit"}, - {0x29, 0x01, 0x07, 0x04, "1 coin 2 credit"}, - {0x29, 0x01, 0x07, 0x05, "1 coin 3 credit"}, - {0x29, 0x01, 0x07, 0x06, "1 coin 5 credit"}, - {0x29, 0x01, 0x07, 0x07, "1 coin 6 credit"}, - {0, 0xFE, 0, 2, "2 Coins to Start, 1 to Continue"}, - {0x29, 0x01, 0x08, 0x00, "Off"}, - {0x29, 0x01, 0x08, 0x08, "On"}, - {0, 0xFE, 0, 2, "Lives"}, - {0x29, 0x01, 0x10, 0x00, "2"}, - {0x29, 0x01, 0x10, 0x10, "1"}, - {0, 0xFE, 0, 4, "Cabinet"}, - {0x29, 0x01, 0x60, 0x00, "2 Players"}, - {0x29, 0x01, 0x60, 0x20, "3 Players"}, - {0x29, 0x01, 0x60, 0x40, "4 Players"}, - {0x29, 0x01, 0x60, 0x60, "4 Players (Team)"}, - {0, 0xFE, 0, 2, "Coin Slot"}, - {0x29, 0x01, 0x80, 0x00, "Same"}, - {0x29, 0x01, 0x80, 0x80, "Individual"}, - - // DIP 2 - {0, 0xFE, 0, 2, "Unknown"}, - {0x2A, 0x01, 0x01, 0x00, "Off"}, - {0x2A, 0x01, 0x01, 0x01, "On"}, - {0, 0xFE, 0, 4, "Number of Enemies"}, - {0x2A, 0x01, 0x06, 0x00, "Normal"}, - {0x2A, 0x01, 0x06, 0x02, "Easy"}, - {0x2A, 0x01, 0x06, 0x04, "Hard"}, - {0x2A, 0x01, 0x06, 0x06, "Hardest"}, - {0, 0xFE, 0, 4, "Strength of Enemies"}, - {0x2A, 0x01, 0x18, 0x00, "Normal"}, - {0x2A, 0x01, 0x18, 0x08, "Easy"}, - {0x2A, 0x01, 0x18, 0x10, "Hard"}, - {0x2A, 0x01, 0x18, 0x18, "Hardest"}, - {0, 0xFE, 0, 2, "Freeze"}, - {0x2A, 0x01, 0x20, 0x00, "Off"}, - {0x2A, 0x01, 0x20, 0x20, "On"}, - {0, 0xFE, 0, 2, "Demo sound"}, - {0x2A, 0x01, 0x40, 0x00, "Off"}, - {0x2A, 0x01, 0x40, 0x40, "On"}, - {0, 0xFE, 0, 2, "Flip Screen"}, - {0x2A, 0x01, 0x80, 0x00, "Off"}, - {0x2A, 0x01, 0x80, 0x80, "On"}, -}; - -STDDIPINFO(karatblz) - -static struct BurnRomInfo karatblzRomDesc[] = { - { "rom2v3", 0x040000, 0x01f772e1, BRF_ESS | BRF_PRG }, // 68000 code swapped - { "1.u15", 0x040000, 0xd16ee21b, BRF_ESS | BRF_PRG }, - - { "gha.u55", 0x080000, 0x3e0cea91, BRF_GRA }, // gfx1 - { "gh9.u61", 0x080000, 0x5d1676bd, BRF_GRA }, // gfx2 - - { "u42", 0x100000, 0x65f0da84, BRF_GRA }, // gfx3 - { "3.u44", 0x020000, 0x34bdead2, BRF_GRA }, - { "u43", 0x100000, 0x7b349e5d, BRF_GRA }, - { "4.u45", 0x020000, 0xbe4d487d, BRF_GRA }, - - { "u59.ghb", 0x080000, 0x158c9cde, BRF_GRA }, // gfx4 - { "ghd.u60", 0x080000, 0x73180ae3, BRF_GRA }, - - { "5.u92", 0x020000, 0x97d67510, BRF_ESS | BRF_PRG }, // Sound CPU - - { "u105.gh8", 0x080000, 0x7a68cb1b, BRF_SND }, // samples - { "u104", 0x100000, 0x5795e884, BRF_SND }, -}; - -STD_ROM_PICK(karatblz) -STD_ROM_FN(karatblz) - -static struct BurnRomInfo karatbluRomDesc[] = { - { "2.u14", 0x040000, 0x202e6220, BRF_ESS | BRF_PRG }, // 68000 code swapped - { "1.u15", 0x040000, 0xd16ee21b, BRF_ESS | BRF_PRG }, - - { "gha.u55", 0x080000, 0x3e0cea91, BRF_GRA }, // gfx1 - { "gh9.u61", 0x080000, 0x5d1676bd, BRF_GRA }, // gfx2 - - { "u42", 0x100000, 0x65f0da84, BRF_GRA }, // gfx3 - { "3.u44", 0x020000, 0x34bdead2, BRF_GRA }, - { "u43", 0x100000, 0x7b349e5d, BRF_GRA }, - { "4.u45", 0x020000, 0xbe4d487d, BRF_GRA }, - - { "u59.ghb", 0x080000, 0x158c9cde, BRF_GRA }, // gfx4 - { "ghd.u60", 0x080000, 0x73180ae3, BRF_GRA }, - - { "5.u92", 0x020000, 0x97d67510, BRF_ESS | BRF_PRG }, // Sound CPU - - { "u105.gh8", 0x080000, 0x7a68cb1b, BRF_SND }, // samples - { "u104", 0x100000, 0x5795e884, BRF_SND }, -}; - -STD_ROM_PICK(karatblu) -STD_ROM_FN(karatblu) - -static struct BurnRomInfo karatbljRomDesc[] = { - { "2tecmo.u14", 0x040000, 0x57e52654, BRF_ESS | BRF_PRG }, // 68000 code swapped - { "1.u15", 0x040000, 0xd16ee21b, BRF_ESS | BRF_PRG }, - - { "gha.u55", 0x080000, 0x3e0cea91, BRF_GRA }, // gfx1 - { "gh9.u61", 0x080000, 0x5d1676bd, BRF_GRA }, // gfx2 - - { "u42", 0x100000, 0x65f0da84, BRF_GRA }, // gfx3 - { "3.u44", 0x020000, 0x34bdead2, BRF_GRA }, - { "u43", 0x100000, 0x7b349e5d, BRF_GRA }, - { "4.u45", 0x020000, 0xbe4d487d, BRF_GRA }, - - { "u59.ghb", 0x080000, 0x158c9cde, BRF_GRA }, // gfx4 - { "ghd.u60", 0x080000, 0x73180ae3, BRF_GRA }, - - { "5.u92", 0x020000, 0x97d67510, BRF_ESS | BRF_PRG }, // Sound CPU - - { "u105.gh8", 0x080000, 0x7a68cb1b, BRF_SND }, // samples - { "u104", 0x100000, 0x5795e884, BRF_SND }, -}; - -STD_ROM_PICK(karatblj) -STD_ROM_FN(karatblj) - -UINT8 __fastcall karatblzReadByte(UINT32 sekAddress) -{ - sekAddress &= 0x0FFFFF; - - switch (sekAddress) { - case 0x0FF000: - return ~DrvInput[4]; - case 0x0FF001: - return ~DrvInput[0]; - case 0x0FF002: - return 0xFF; - case 0x0FF003: - return ~DrvInput[1]; - case 0x0FF004: - return ~DrvInput[5]; - case 0x0FF005: - return ~DrvInput[2]; - case 0x0FF006: - return 0xFF; - case 0x0FF007: - return ~DrvInput[3]; - case 0x0FF008: - return ~DrvInput[7]; - case 0x0FF009: - return ~DrvInput[6]; - case 0x0FF00B: - return pending_command; - -// default: -// printf("Attempt to read byte value of location %x\n", sekAddress); - } - return 0; -} - -/* -UINT16 __fastcall karatblzReadWord(UINT32 sekAddress) -{ - sekAddress &= 0x0FFFFF; - - switch (sekAddress) { - - - default: - printf("Attempt to read word value of location %x\n", sekAddress); - } - return 0; -} -*/ - -void __fastcall karatblzWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - sekAddress &= 0x0FFFFF; - - switch (sekAddress) { - case 0x0FF000: - case 0x0FF401: - case 0x0FF403: - - break; - - case 0x0FF002: - //if (ACCESSING_MSB) { - // setbank(bg1_tilemap,0,(data & 0x0100) >> 8); - // setbank(bg2_tilemap,1,(data & 0x0800) >> 11); - //} - RamGfxBank[0] = (byteValue & 0x1); - RamGfxBank[1] = (byteValue & 0x8) >> 3; - break; - case 0x0FF007: - pending_command = 1; - SoundCommand(byteValue); - break; -// default: -// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } -} - -void __fastcall karatblzWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - if (( sekAddress & 0x0FF000 ) == 0x0FE000) { - sekAddress &= 0x07FF; - *((UINT16 *)&RamPal[sekAddress]) = wordValue; - RamCurPal[sekAddress>>1] = CalcCol( wordValue ); - return; - } - - sekAddress &= 0x0FFFFF; - - - switch (sekAddress) { - case 0x0ff008: - bg1scrollx = wordValue; - break; - case 0x0ff00A: - bg1scrolly = wordValue; - break; - case 0x0ff00C: - bg2scrollx = wordValue; - break; - case 0x0ff00E: - bg2scrolly = wordValue; - break; -// default: -// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); - } -} - -static INT32 karatblzMemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x080000; // 68000 ROM - RomZ80 = Next; Next += 0x030000; // Z80 ROM - - RomBg = Next; Next += 0x200040; // Background, 1M 8x8x4bit decode to 2M + 64Byte safe - DeRomBg = RomBg + 0x000040; - - RomSpr1 = Next; Next += 0x800000; // Sprite 1 , 1M 16x16x4bit decode to 2M + 256Byte safe - RomSpr2 = Next; Next += 0x200100; // Sprite 2 - - DeRomSpr1 = RomSpr1 + 0x000100; - DeRomSpr2 = RomSpr2 += 0x000100; - - RomSnd1 = Next; Next += 0x080000; // ADPCM data - RomSndSize1 = 0x080000; - RomSnd2 = Next; Next += 0x100000; // ADPCM data - RomSndSize2 = 0x100000; - - RamStart = Next; - - RamBg1V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG1 Video Ram - RamBg2V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG2 Video Ram - RamSpr1 = (UINT16 *)Next; Next += 0x008000 * sizeof(UINT16); // Sprite 1 Ram - RamSpr2 = (UINT16 *)Next; Next += 0x008000 * sizeof(UINT16); // Sprite 2 Ram - RamSpr3 = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // Sprite 3 Ram - Ram01 = Next; Next += 0x014000; // Work Ram 1 + Work Ram 1 - RamPal = Next; Next += 0x000800; // 1024 of X1R5G5B5 Palette - RamZ80 = Next; Next += 0x000800; // Z80 Ram 2K - - RamSpr1SizeMask = 0x7FFF; - RamSpr2SizeMask = 0x7FFF; - RomSpr1SizeMask = 0x7FFF; - RomSpr2SizeMask = 0x1FFF; - - RamEnd = Next; - - RamCurPal = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); - - MemEnd = Next; - return 0; -} - -static INT32 karatblzInit() -{ - Mem = NULL; - karatblzMemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - karatblzMemIndex(); - - // Load 68000 ROM - if (BurnLoadRom(Rom01+0x00000, 0, 1)) return 1; - if (BurnLoadRom(Rom01+0x40000, 1, 1)) return 1; - - // Load Graphic - BurnLoadRom(RomBg+0x00000, 2, 1); - BurnLoadRom(RomBg+0x80000, 3, 1); - pspikesDecodeBg(0x10000); - - BurnLoadRom(RomSpr1+0x000000, 4, 2); - BurnLoadRom(RomSpr1+0x000001, 6, 2); - BurnLoadRom(RomSpr1+0x200000, 5, 2); - BurnLoadRom(RomSpr1+0x200001, 7, 2); - BurnLoadRom(RomSpr1+0x400000, 8, 2); - BurnLoadRom(RomSpr1+0x400001, 9, 2); - pspikesDecodeSpr(DeRomSpr1, RomSpr1, 0xA000); - - // Load Z80 ROM - if (BurnLoadRom(RomZ80+0x10000, 10, 1)) return 1; - memcpy(RomZ80, RomZ80+0x10000, 0x10000); - - BurnLoadRom(RomSnd1, 11, 1); - BurnLoadRom(RomSnd2, 12, 1); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM - SekMapMemory((UINT8 *)RamBg1V, - 0x080000, 0x081FFF, SM_RAM); - SekMapMemory((UINT8 *)RamBg2V, - 0x082000, 0x083FFF, SM_RAM); - SekMapMemory((UINT8 *)RamSpr1, - 0x0A0000, 0x0AFFFF, SM_RAM); - SekMapMemory((UINT8 *)RamSpr2, - 0x0B0000, 0x0BFFFF, SM_RAM); - SekMapMemory(Ram01, 0x0C0000, 0x0CFFFF, SM_RAM); // 64K Work RAM - SekMapMemory(Ram01+0x10000, 0x0F8000, 0x0FBFFF, SM_RAM); // Work RAM - SekMapMemory(Ram01+0x10000, 0xFF8000, 0xFFBFFF, SM_RAM); // Work RAM - SekMapMemory((UINT8 *)RamSpr3, - 0x0FC000, 0x0FC7FF, SM_RAM); - SekMapMemory(RamPal, 0x0FE000, 0x0FE7FF, SM_ROM); // Palette - -// SekSetReadWordHandler(0, karatblzReadWord); - SekSetReadByteHandler(0, karatblzReadByte); - SekSetWriteWordHandler(0, karatblzWriteWord); - SekSetWriteByteHandler(0, karatblzWriteByte); - - SekClose(); - } - - { - ZetInit(0); - ZetOpen(0); - - ZetMapArea(0x0000, 0x77FF, 0, RomZ80); - ZetMapArea(0x0000, 0x77FF, 2, RomZ80); - - ZetMapArea(0x7800, 0x7FFF, 0, RamZ80); - ZetMapArea(0x7800, 0x7FFF, 1, RamZ80); - ZetMapArea(0x7800, 0x7FFF, 2, RamZ80); - - ZetMemEnd(); - - ZetSetInHandler(turbofrcZ80PortRead); - ZetSetOutHandler(turbofrcZ80PortWrite); - - ZetClose(); - } - - BurnYM2610Init(8000000, RomSnd2, &RomSndSize2, RomSnd1, &RomSndSize1, &aerofgtFMIRQHandler, aerofgtSynchroniseStream, aerofgtGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static void karatblzTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) -{ - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 64*64; offs++) { - mx++; - if (mx == 64) { - mx = 0; - my++; - } - - x = mx * 8 - (((INT16)bg1scrollx + 8)& 0x1FF); - if (x <= (352-512)) x += 512; - - y = my * 8 - (bg1scrolly & 0x1FF); - if (y <= (240-512)) y += 512; - - if ( x<=-8 || x>=352 || y<=-8 || y>= 240 ) - continue; - - else - if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[0] << 13 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; - - for (INT32 k=0;k<8;k++) { - p[0] = pal[ d[0] | c ]; - p[1] = pal[ d[1] | c ]; - p[2] = pal[ d[2] | c ]; - p[3] = pal[ d[3] | c ]; - p[4] = pal[ d[4] | c ]; - p[5] = pal[ d[5] | c ]; - p[6] = pal[ d[6] | c ]; - p[7] = pal[ d[7] | c ]; - - d += 8; - p += 352; - } - } else { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[0] << 13 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; - - for (INT32 k=0;k<8;k++) { - if ( (y+k)>=0 && (y+k)<240 ) { - if ((x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; - if ((x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; - if ((x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; - if ((x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; - if ((x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; - if ((x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; - if ((x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; - if ((x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; - } - d += 8; - p += 352; - } - - } - - } -} - -static void karatblzTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) -{ - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 64*64; offs++) { - mx++; - if (mx == 64) { - mx = 0; - my++; - } - - x = mx * 8 - ( ((INT16)bg2scrollx + 4) & 0x1FF); - if (x <= (352-512)) x += 512; - - y = my * 8 - (bg2scrolly & 0x1FF); - if (y <= (240-512)) y += 512; - - if ( x<=-8 || x>=352 || y<=-8 || y>= 240 ) - continue; - else - if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[1] << 13 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; - - for (INT32 k=0;k<8;k++) { - - if (d[0] != 15) p[0] = pal[ d[0] | c ]; - if (d[1] != 15) p[1] = pal[ d[1] | c ]; - if (d[2] != 15) p[2] = pal[ d[2] | c ]; - if (d[3] != 15) p[3] = pal[ d[3] | c ]; - if (d[4] != 15) p[4] = pal[ d[4] | c ]; - if (d[5] != 15) p[5] = pal[ d[5] | c ]; - if (d[6] != 15) p[6] = pal[ d[6] | c ]; - if (d[7] != 15) p[7] = pal[ d[7] | c ]; - - d += 8; - p += 352; - } - } else { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[1] << 13 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; - - for (INT32 k=0;k<8;k++) { - if ( (y+k)>=0 && (y+k)<240 ) { - if (d[0] != 15 && (x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; - if (d[1] != 15 && (x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; - if (d[2] != 15 && (x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; - if (d[3] != 15 && (x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; - if (d[4] != 15 && (x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; - if (d[5] != 15 && (x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; - if (d[6] != 15 && (x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; - if (d[7] != 15 && (x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; - } - d += 8; - p += 352; - } - - } - - } -} - -static INT32 karatblzDraw() -{ - karatblzTileBackground_1(RamBg1V, DeRomBg, RamCurPal); - karatblzTileBackground_2(RamBg2V, DeRomBg + 0x100000, RamCurPal + 256); - -/* - turbofrc_drawsprites(1,-1); - turbofrc_drawsprites(1, 0); - turbofrc_drawsprites(0,-1); - turbofrc_drawsprites(0, 0); -*/ - - turbofrc_drawsprites(0, 0); - turbofrc_drawsprites(0,-1); - turbofrc_drawsprites(1, 0); - turbofrc_drawsprites(1,-1); - - return 0; -} - -static INT32 karatblzFrame() -{ - if (DrvReset) DrvDoReset(); - - // Compile digital inputs - DrvInput[0] = 0x00; // Joy1 - DrvInput[1] = 0x00; // Joy2 - DrvInput[2] = 0x00; // Joy3 - DrvInput[3] = 0x00; // Joy4 - DrvInput[4] = 0x00; // Buttons1 - DrvInput[5] = 0x00; // Buttons2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[2] |= (DrvJoy3[i] & 1) << i; - DrvInput[3] |= (DrvJoy4[i] & 1) << i; - } - for (INT32 i = 0; i < 4; i++) { - DrvInput[4] |= (DrvButton[i] & 1) << i; - DrvInput[5] |= (DrvButton[i+4] & 1) << i; - } - - SekNewFrame(); - ZetNewFrame(); - - nCyclesTotal[0] = 10000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - - SekOpen(0); - ZetOpen(0); - - SekRun(nCyclesTotal[0]); - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - - ZetClose(); - SekClose(); - - if (pBurnDraw) karatblzDraw(); - - return 0; -} - -struct BurnDriver BurnDrvKaratblz = { - "karatblz", NULL, NULL, NULL, "1991", - "Karate Blazers (World?)\0", NULL, "Video System Co.", "Video System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY, 4, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, - NULL, karatblzRomInfo, karatblzRomName, NULL, NULL, karatblzInputInfo, karatblzDIPInfo, - karatblzInit,DrvExit,karatblzFrame,karatblzDraw,DrvScan, - NULL, 0x800,352,240,4,3 -}; - -struct BurnDriver BurnDrvKaratblu = { - "karatblzu", "karatblz", NULL, NULL, "1991", - "Karate Blazers (US)\0", NULL, "Video System Co.", "Video System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 4, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, - NULL, karatbluRomInfo, karatbluRomName, NULL, NULL, karatblzInputInfo, karatblzDIPInfo, - karatblzInit,DrvExit,karatblzFrame,karatblzDraw,DrvScan, - NULL, 0x800,352,240,4,3 -}; - -struct BurnDriver BurnDrvKaratblj = { - "karatblzj", "karatblz", NULL, NULL, "1991", - "Karate Blazers (Japan)\0", NULL, "Video System Co.", "Video System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 4, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, - NULL, karatbljRomInfo, karatbljRomName, NULL, NULL, karatblzInputInfo, karatblzDIPInfo, - karatblzInit,DrvExit,karatblzFrame,karatblzDraw,DrvScan, - NULL, 0x800,352,240,4,3 -}; - -// ----------------------------------------------------------- - -static struct BurnInputInfo spinlbrkInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 2, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 3, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, -}; - -STDINPUTINFO(spinlbrk) - -static struct BurnDIPInfo spinlbrkDIPList[] = { - - // Defaults - {0x13, 0xFF, 0xFF, 0x00, NULL}, - {0x14, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 16, "Coin A"}, - {0x13, 0x01, 0x0F, 0x00, "1-1C 1-2 HPs"}, - {0x13, 0x01, 0x0F, 0x01, "1-1-1-1C 1-1-1-2 HPs"}, - {0x13, 0x01, 0x0F, 0x02, "1-1-1-1-1C 1-1-1-1-2 HPs"}, - {0x13, 0x01, 0x0F, 0x03, "2-2C 1-2 HPs"}, - {0x13, 0x01, 0x0F, 0x04, "2-1-1C 1-1-1 HPs"}, - {0x13, 0x01, 0x0F, 0x05, "2 Credits 2 Health Packs"}, - {0x13, 0x01, 0x0F, 0x06, "5 Credits 1 Health Pack"}, - {0x13, 0x01, 0x0F, 0x07, "4 Credits 1 Health Pack"}, - {0x13, 0x01, 0x0F, 0x08, "3 Credits 1 Health Pack"}, - {0x13, 0x01, 0x0F, 0x09, "2 Credits 1 Health Pack"}, - {0x13, 0x01, 0x0F, 0x0A, "1 Credit 6 Health Packs"}, - {0x13, 0x01, 0x0F, 0x0B, "1 Credit 5 Health Packs"}, - {0x13, 0x01, 0x0F, 0x0C, "1 Credit 4 Health Packs"}, - {0x13, 0x01, 0x0F, 0x0D, "1 Credit 3 Health Packs"}, - {0x13, 0x01, 0x0F, 0x0E, "1 Credit 2 Health Packs"}, - {0x13, 0x01, 0x0F, 0x0F, "1 Credit 1 Health Pack"}, - {0, 0xFE, 0, 16, "Coin A"}, - {0x13, 0x01, 0xF0, 0x00, "1-1C 1-2 HPs"}, - {0x13, 0x01, 0xF0, 0x10, "1-1-1-1C 1-1-1-2 HPs"}, - {0x13, 0x01, 0xF0, 0x20, "1-1-1-1-1C 1-1-1-1-2 HPs"}, - {0x13, 0x01, 0xF0, 0x30, "2-2C 1-2 HPs"}, - {0x13, 0x01, 0xF0, 0x40, "2-1-1C 1-1-1 HPs"}, - {0x13, 0x01, 0xF0, 0x50, "2 Credits 2 Health Packs"}, - {0x13, 0x01, 0xF0, 0x60, "5 Credits 1 Health Pack"}, - {0x13, 0x01, 0xF0, 0x70, "4 Credits 1 Health Pack"}, - {0x13, 0x01, 0xF0, 0x80, "3 Credits 1 Health Pack"}, - {0x13, 0x01, 0xF0, 0x90, "2 Credits 1 Health Pack"}, - {0x13, 0x01, 0xF0, 0xA0, "1 Credit 6 Health Packs"}, - {0x13, 0x01, 0xF0, 0xB0, "1 Credit 5 Health Packs"}, - {0x13, 0x01, 0xF0, 0xC0, "1 Credit 4 Health Packs"}, - {0x13, 0x01, 0xF0, 0xD0, "1 Credit 3 Health Packs"}, - {0x13, 0x01, 0xF0, 0xE0, "1 Credit 2 Health Packs"}, - {0x13, 0x01, 0xF0, 0xF0, "1 Credit 1 Health Pack"}, - - // DIP 2 - {0, 0xFE, 0, 4, "Difficulty"}, - {0x14, 0x01, 0x03, 0x00, "Normal"}, - {0x14, 0x01, 0x03, 0x01, "Easy"}, - {0x14, 0x01, 0x03, 0x02, "Hard"}, - {0x14, 0x01, 0x03, 0x03, "Hardest"}, -}; - -static struct BurnDIPInfo spinlbrk_DIPList[] = { - - {0, 0xFE, 0, 2, "Coin Slot"}, - {0x14, 0x01, 0x04, 0x00, "Individuala"}, - {0x14, 0x01, 0x04, 0x04, "Same"}, - {0, 0xFE, 0, 2, "Flip Screen"}, - {0x14, 0x01, 0x08, 0x00, "Off"}, - {0x14, 0x01, 0x08, 0x08, "On"}, - - {0, 0xFE, 0, 2, "Lever Type"}, - {0x14, 0x01, 0x10, 0x00, "Digital"}, - {0x14, 0x01, 0x10, 0x10, "Analog"}, - {0, 0xFE, 0, 2, "Service"}, - {0x14, 0x01, 0x20, 0x00, "Off"}, - {0x14, 0x01, 0x20, 0x20, "On"}, - {0, 0xFE, 0, 2, "Health Pack"}, - {0x14, 0x01, 0x40, 0x00, "32 Hitpoints"}, - {0x14, 0x01, 0x40, 0x40, "40 Hitpoints"}, - {0, 0xFE, 0, 2, "Life Restoration"}, - {0x14, 0x01, 0x80, 0x00, "10 Points"}, - {0x14, 0x01, 0x80, 0x80, "5 Points"}, - -}; - -STDDIPINFOEXT(spinlbrk, spinlbrk, spinlbrk_) - -static struct BurnDIPInfo spinlbru_DIPList[] = { - - {0, 0xFE, 0, 2, "Coin Slot"}, - {0x14, 0x01, 0x04, 0x00, "Individuala"}, - {0x14, 0x01, 0x04, 0x04, "Same"}, - {0, 0xFE, 0, 2, "Flip Screen"}, - {0x14, 0x01, 0x08, 0x00, "Off"}, - {0x14, 0x01, 0x08, 0x08, "On"}, - - {0, 0xFE, 0, 2, "Lever Type"}, - {0x14, 0x01, 0x10, 0x00, "Digital"}, - {0x14, 0x01, 0x10, 0x10, "Analog"}, - {0, 0xFE, 0, 2, "Service"}, - {0x14, 0x01, 0x20, 0x00, "Off"}, - {0x14, 0x01, 0x20, 0x20, "On"}, - {0, 0xFE, 0, 2, "Health Pack"}, - {0x14, 0x01, 0x40, 0x00, "20 Hitpoints"}, - {0x14, 0x01, 0x40, 0x40, "32 Hitpoints"}, - {0, 0xFE, 0, 2, "Life Restoration"}, - {0x14, 0x01, 0x80, 0x00, "10 Points"}, - {0x14, 0x01, 0x80, 0x80, "5 Points"}, - -}; - -STDDIPINFOEXT(spinlbru, spinlbrk, spinlbru_) - -static struct BurnDIPInfo spinlbrj_DIPList[] = { - - {0, 0xFE, 0, 2, "Continue"}, - {0x14, 0x01, 0x04, 0x00, "Unlimited"}, - {0x14, 0x01, 0x04, 0x04, "6 Times"}, - {0, 0xFE, 0, 2, "Flip Screen"}, - {0x14, 0x01, 0x08, 0x00, "Off"}, - {0x14, 0x01, 0x08, 0x08, "On"}, - - {0, 0xFE, 0, 2, "Lever Type"}, - {0x14, 0x01, 0x10, 0x00, "Digital"}, - {0x14, 0x01, 0x10, 0x10, "Analog"}, - {0, 0xFE, 0, 2, "Service"}, - {0x14, 0x01, 0x20, 0x00, "Off"}, - {0x14, 0x01, 0x20, 0x20, "On"}, - {0, 0xFE, 0, 2, "Health Pack"}, - {0x14, 0x01, 0x40, 0x00, "32 Hitpoints"}, - {0x14, 0x01, 0x40, 0x40, "40 Hitpoints"}, - {0, 0xFE, 0, 2, "Life Restoration"}, - {0x14, 0x01, 0x80, 0x00, "10 Points"}, - {0x14, 0x01, 0x80, 0x80, "5 Points"}, - -}; - -STDDIPINFOEXT(spinlbrj, spinlbrk, spinlbrj_) - -static struct BurnRomInfo spinlbrkRomDesc[] = { - { "ic98", 0x010000, 0x36c2bf70, BRF_ESS | BRF_PRG }, // 68000 code swapped - { "ic104", 0x010000, 0x34a7e158, BRF_ESS | BRF_PRG }, - { "ic93", 0x010000, 0x726f4683, BRF_ESS | BRF_PRG }, - { "ic94", 0x010000, 0xc4385e03, BRF_ESS | BRF_PRG }, - - { "ic15", 0x080000, 0xe318cf3a, BRF_GRA }, // gfx 1 - { "ic9", 0x080000, 0xe071f674, BRF_GRA }, - - { "ic17", 0x080000, 0xa63d5a55, BRF_GRA }, // gfx 2 - { "ic11", 0x080000, 0x7dcc913d, BRF_GRA }, - { "ic16", 0x080000, 0x0d84af7f, BRF_GRA }, - - { "ic12", 0x080000, 0xd63fac4e, BRF_GRA }, // gfx 3 - { "ic18", 0x080000, 0x5a60444b, BRF_GRA }, - - { "ic14", 0x080000, 0x1befd0f3, BRF_GRA }, // gfx 4 - { "ic20", 0x080000, 0xc2f84a61, BRF_GRA }, - { "ic35", 0x080000, 0xeba8e1a3, BRF_GRA }, - { "ic40", 0x080000, 0x5ef5aa7e, BRF_GRA }, - - { "ic19", 0x010000, 0xdb24eeaa, BRF_GRA }, // gfx 5, hardcoded sprite maps - { "ic13", 0x010000, 0x97025bf4, BRF_GRA }, - - { "ic117", 0x008000, 0x625ada41, BRF_ESS | BRF_PRG }, // Sound CPU - { "ic118", 0x010000, 0x1025f024, BRF_ESS | BRF_PRG }, - - { "ic166", 0x080000, 0x6e0d063a, BRF_SND }, // samples - { "ic163", 0x080000, 0xe6621dfb, BRF_SND }, - - { "epl16p8bp.ic100", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "epl16p8bp.ic127", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "epl16p8bp.ic133", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "epl16p8bp.ic99", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "gal16v8a.ic114", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "gal16v8a.ic95", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(spinlbrk) -STD_ROM_FN(spinlbrk) - -static struct BurnRomInfo spinlbruRomDesc[] = { - { "ic98.u5", 0x010000, 0x3a0f7667, BRF_ESS | BRF_PRG }, // 68000 code swapped - { "ic104.u6", 0x010000, 0xa0e0af31, BRF_ESS | BRF_PRG }, - { "ic93.u4", 0x010000, 0x0cf73029, BRF_ESS | BRF_PRG }, - { "ic94.u3", 0x010000, 0x5cf7c426, BRF_ESS | BRF_PRG }, - - { "ic15", 0x080000, 0xe318cf3a, BRF_GRA }, // gfx 1 - { "ic9", 0x080000, 0xe071f674, BRF_GRA }, - - { "ic17", 0x080000, 0xa63d5a55, BRF_GRA }, // gfx 2 - { "ic11", 0x080000, 0x7dcc913d, BRF_GRA }, - { "ic16", 0x080000, 0x0d84af7f, BRF_GRA }, - - { "ic12", 0x080000, 0xd63fac4e, BRF_GRA }, // gfx 3 - { "ic18", 0x080000, 0x5a60444b, BRF_GRA }, - - { "ic14", 0x080000, 0x1befd0f3, BRF_GRA }, // gfx 4 - { "ic20", 0x080000, 0xc2f84a61, BRF_GRA }, - { "ic35", 0x080000, 0xeba8e1a3, BRF_GRA }, - { "ic40", 0x080000, 0x5ef5aa7e, BRF_GRA }, - - { "ic19", 0x010000, 0xdb24eeaa, BRF_GRA }, // gfx 5, hardcoded sprite maps - { "ic13", 0x010000, 0x97025bf4, BRF_GRA }, - - { "ic117", 0x008000, 0x625ada41, BRF_ESS | BRF_PRG }, // Sound CPU - { "ic118", 0x010000, 0x1025f024, BRF_ESS | BRF_PRG }, - - { "ic166", 0x080000, 0x6e0d063a, BRF_SND }, // samples - { "ic163", 0x080000, 0xe6621dfb, BRF_SND }, - - { "epl16p8bp.ic100", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "epl16p8bp.ic127", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "epl16p8bp.ic133", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "epl16p8bp.ic99", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "gal16v8a.ic114", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "gal16v8a.ic95", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(spinlbru) -STD_ROM_FN(spinlbru) - -static struct BurnRomInfo spinlbrjRomDesc[] = { - { "j5", 0x010000, 0x6a3d690e, BRF_ESS | BRF_PRG }, // 68000 code swapped - { "j6", 0x010000, 0x869593fa, BRF_ESS | BRF_PRG }, - { "j4", 0x010000, 0x33e33912, BRF_ESS | BRF_PRG }, - { "j3", 0x010000, 0x16ca61d0, BRF_ESS | BRF_PRG }, - - { "ic15", 0x080000, 0xe318cf3a, BRF_GRA }, // gfx 1 - { "ic9", 0x080000, 0xe071f674, BRF_GRA }, - - { "ic17", 0x080000, 0xa63d5a55, BRF_GRA }, // gfx 2 - { "ic11", 0x080000, 0x7dcc913d, BRF_GRA }, - { "ic16", 0x080000, 0x0d84af7f, BRF_GRA }, - - { "ic12", 0x080000, 0xd63fac4e, BRF_GRA }, // gfx 3 - { "ic18", 0x080000, 0x5a60444b, BRF_GRA }, - - { "ic14", 0x080000, 0x1befd0f3, BRF_GRA }, // gfx 4 - { "ic20", 0x080000, 0xc2f84a61, BRF_GRA }, - { "ic35", 0x080000, 0xeba8e1a3, BRF_GRA }, - { "ic40", 0x080000, 0x5ef5aa7e, BRF_GRA }, - - { "ic19", 0x010000, 0xdb24eeaa, BRF_GRA }, // gfx 5, hardcoded sprite maps - { "ic13", 0x010000, 0x97025bf4, BRF_GRA }, - - { "ic117", 0x008000, 0x625ada41, BRF_ESS | BRF_PRG }, // Sound CPU - { "ic118", 0x010000, 0x1025f024, BRF_ESS | BRF_PRG }, - - { "ic166", 0x080000, 0x6e0d063a, BRF_SND }, // samples - { "ic163", 0x080000, 0xe6621dfb, BRF_SND }, - - { "epl16p8bp.ic100", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "epl16p8bp.ic127", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "epl16p8bp.ic133", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "epl16p8bp.ic99", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "gal16v8a.ic114", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "gal16v8a.ic95", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(spinlbrj) -STD_ROM_FN(spinlbrj) - -/* -UINT8 __fastcall spinlbrkReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - - default: - printf("Attempt to read byte value of location %x\n", sekAddress); - } - return 0; -} -*/ - -UINT16 __fastcall spinlbrkReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0xFFF000: - return ~(DrvInput[0] | (DrvInput[2] << 8)); - case 0xFFF002: - return ~(DrvInput[1]); - case 0xFFF004: - return ~(DrvInput[3] | (DrvInput[4] << 8)); - -// default: -// printf("Attempt to read word value of location %x\n", sekAddress); - } - return 0; -} - - -void __fastcall spinlbrkWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - case 0xFFF401: - case 0xFFF403: - // NOP - break; - - case 0xFFF007: - pending_command = 1; - SoundCommand(byteValue); - break; - -// default: -// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } -} - -void __fastcall spinlbrkWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - - if (( sekAddress & 0xFFF000 ) == 0xFFE000) { - sekAddress &= 0x07FF; - *((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue); - RamCurPal[sekAddress>>1] = CalcCol( wordValue ); - return; - } - - switch (sekAddress) { - case 0xFFF000: - RamGfxBank[0] = (wordValue & 0x07); - RamGfxBank[1] = (wordValue & 0x38) >> 3; - break; - case 0xFFF002: - bg2scrollx = wordValue; - break; - case 0xFFF008: - // NOP - break; - -// default: -// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); - } -} - -static INT32 spinlbrkMemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x040000; // 68000 ROM - RomZ80 = Next; Next += 0x030000; // Z80 ROM - - RomBg = Next; Next += 0x500040; // Background, 2.5M 8x8x4bit - DeRomBg = RomBg + 0x000040; - - RomSpr1 = Next; Next += 0x200000; // Sprite 1 - RomSpr2 = Next; Next += 0x400100; // Sprite 2 - - DeRomSpr1 = RomSpr1 + 0x000100; - DeRomSpr2 = RomSpr2 += 0x000100; - - RomSnd2 = Next; Next += 0x100000; // ADPCM data - RomSnd1 = RomSnd2; - - RomSndSize1 = 0x100000; - RomSndSize2 = 0x100000; - - RamSpr2 = (UINT16 *)Next; Next += 0x010000 * sizeof(UINT16); // Sprite 2 Ram - RamSpr1 = (UINT16 *)Next; Next += 0x002000 * sizeof(UINT16); // Sprite 1 Ram - - RamStart = Next; - - RamBg1V = (UINT16 *)Next; Next += 0x000800 * sizeof(UINT16); // BG1 Video Ram - RamBg2V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG2 Video Ram - Ram01 = Next; Next += 0x004000; // Work Ram - RamSpr3 = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // Sprite 3 Ram - RamRaster = (UINT16 *)Next; Next += 0x000100 * sizeof(UINT16); // Raster - RamPal = Next; Next += 0x000800; // 1024 of X1R5G5B5 Palette - RamZ80 = Next; Next += 0x000800; // Z80 Ram 2K - - RamSpr1SizeMask = 0x1FFF; - RamSpr2SizeMask = 0xFFFF; - - RomSpr1SizeMask = 0x1FFF; - RomSpr2SizeMask = 0x3FFF; - - RamEnd = Next; - - RamCurPal = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); - - MemEnd = Next; - return 0; -} - -static INT32 spinlbrkInit() -{ - Mem = NULL; - spinlbrkMemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - spinlbrkMemIndex(); - - // Load 68000 ROM - if (BurnLoadRom(Rom01+0x00001, 0, 2)) return 1; - if (BurnLoadRom(Rom01+0x00000, 1, 2)) return 1; - if (BurnLoadRom(Rom01+0x20001, 2, 2)) return 1; - if (BurnLoadRom(Rom01+0x20000, 3, 2)) return 1; - - // Load Graphic - BurnLoadRom(RomBg+0x000000, 4, 1); - BurnLoadRom(RomBg+0x080000, 5, 1); - BurnLoadRom(RomBg+0x100000, 6, 1); - BurnLoadRom(RomBg+0x180000, 7, 1); - BurnLoadRom(RomBg+0x200000, 8, 1); - pspikesDecodeBg(0x14000); - - BurnLoadRom(RomSpr1+0x000000, 9, 2); - BurnLoadRom(RomSpr1+0x000001, 10, 2); - BurnLoadRom(RomSpr1+0x100000, 11, 2); - BurnLoadRom(RomSpr1+0x100001, 13, 2); - BurnLoadRom(RomSpr1+0x200000, 12, 2); - BurnLoadRom(RomSpr1+0x200001, 14, 2); - pspikesDecodeSpr(DeRomSpr1, RomSpr1, 0x6000); - - BurnLoadRom((UINT8 *)RamSpr2+0x000001, 15, 2); - BurnLoadRom((UINT8 *)RamSpr2+0x000000, 16, 2); - - // Load Z80 ROM - if (BurnLoadRom(RomZ80+0x00000, 17, 1)) return 1; - if (BurnLoadRom(RomZ80+0x08000, 18, 1)) return 1; - - BurnLoadRom(RomSnd2+0x00000, 19, 1); - BurnLoadRom(RomSnd2+0x80000, 20, 1); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x04FFFF, SM_ROM); // CPU 0 ROM - SekMapMemory((UINT8 *)RamBg1V, - 0x080000, 0x080FFF, SM_RAM); - SekMapMemory((UINT8 *)RamBg2V, - 0x082000, 0x083FFF, SM_RAM); - SekMapMemory(Ram01, 0xFF8000, 0xFFBFFF, SM_RAM); // Work RAM - SekMapMemory((UINT8 *)RamSpr3, - 0xFFC000, 0xFFC7FF, SM_RAM); - SekMapMemory((UINT8 *)RamRaster, - 0xFFD000, 0xFFD1FF, SM_RAM); - SekMapMemory(RamPal, 0xFFE000, 0xFFE7FF, SM_ROM); // Palette - - SekSetReadWordHandler(0, spinlbrkReadWord); -// SekSetReadByteHandler(0, spinlbrkReadByte); - SekSetWriteWordHandler(0, spinlbrkWriteWord); - SekSetWriteByteHandler(0, spinlbrkWriteByte); - - SekClose(); - } - - { - ZetInit(0); - ZetOpen(0); - - ZetMapArea(0x0000, 0x77FF, 0, RomZ80); - ZetMapArea(0x0000, 0x77FF, 2, RomZ80); - - ZetMapArea(0x7800, 0x7FFF, 0, RamZ80); - ZetMapArea(0x7800, 0x7FFF, 1, RamZ80); - ZetMapArea(0x7800, 0x7FFF, 2, RamZ80); - - ZetMemEnd(); - - ZetSetInHandler(turbofrcZ80PortRead); - ZetSetOutHandler(turbofrcZ80PortWrite); - - ZetClose(); - } - - BurnYM2610Init(8000000, RomSnd2, &RomSndSize2, RomSnd1, &RomSndSize1, &aerofgtFMIRQHandler, aerofgtSynchroniseStream, aerofgtGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - bg2scrollx = 0; // - - for (UINT16 i=0; i<0x2000;i++) - RamSpr1[i] = BURN_ENDIAN_SWAP_INT16(i); - - DrvDoReset(); - - return 0; -} - -static void spinlbrkTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) -{ - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 64*64; offs++) { - mx++; - if (mx == 64) { - mx = 0; - my++; - } - - x = mx * 8 - (BURN_ENDIAN_SWAP_INT16(RamRaster[my*8]) & 0x1FF); // + 8 - if (x <= (352-512)) x += 512; - - y = my * 8; - - if ( x<=-8 || x>=352 || y<=-8 || y>= 240 ) - continue; - - else - if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x0FFF) + ( RamGfxBank[0] << 12 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xF000) >> 8; - UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; - - for (INT32 k=0;k<8;k++) { - p[0] = pal[ d[0] | c ]; - p[1] = pal[ d[1] | c ]; - p[2] = pal[ d[2] | c ]; - p[3] = pal[ d[3] | c ]; - p[4] = pal[ d[4] | c ]; - p[5] = pal[ d[5] | c ]; - p[6] = pal[ d[6] | c ]; - p[7] = pal[ d[7] | c ]; - - d += 8; - p += 352; - } - } else { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x0FFF) + ( RamGfxBank[0] << 12 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xF000) >> 8; - UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; - - for (INT32 k=0;k<8;k++) { - if ( (y+k)>=0 && (y+k)<240 ) { - if ((x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; - if ((x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; - if ((x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; - if ((x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; - if ((x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; - if ((x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; - if ((x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; - if ((x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; - } - d += 8; - p += 352; - } - - } - - } -} - -static INT32 spinlbrkDraw() -{ - spinlbrkTileBackground_1(RamBg1V, DeRomBg, RamCurPal); - karatblzTileBackground_2(RamBg2V, DeRomBg + 0x200000, RamCurPal + 256); - - turbofrc_drawsprites(1,-1); // enemy(near far) - turbofrc_drawsprites(1, 0); // enemy(near) fense - turbofrc_drawsprites(0, 0); // avatar , post , bullet - turbofrc_drawsprites(0,-1); - -/* - UINT16 *ps = RamCurPal; - UINT16 *pd = (UINT16 *)pBurnDraw; - for (INT32 j=0;j<32;j++) { - for (INT32 i=0;i<32;i++) { - *pd = *ps; - pd ++; - ps ++; - } - pd += 352 - 32; - } -*/ - return 0; -} - -static INT32 spinlbrkFrame() -{ - if (DrvReset) DrvDoReset(); - - // Compile digital inputs - DrvInput[0] = 0x00; // Joy1 - DrvInput[1] = 0x00; // Joy2 - DrvInput[2] = 0x00; // Buttons - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[2] |= (DrvButton[i] & 1) << i; - } - - SekNewFrame(); - ZetNewFrame(); - - nCyclesTotal[0] = 10000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - - SekOpen(0); - ZetOpen(0); - - SekRun(nCyclesTotal[0]); - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - - ZetClose(); - SekClose(); - - if (pBurnDraw) spinlbrkDraw(); - - return 0; -} - -struct BurnDriver BurnDrvSpinlbrk = { - "spinlbrk", NULL, NULL, NULL, "1990", - "Spinal Breakers (World)\0", NULL, "V-System Co.", "V-System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0, - NULL, spinlbrkRomInfo, spinlbrkRomName, NULL, NULL, spinlbrkInputInfo, spinlbrkDIPInfo, - spinlbrkInit,DrvExit,spinlbrkFrame,spinlbrkDraw,DrvScan, - NULL, 0x800,352,240,4,3 -}; - -struct BurnDriver BurnDrvSpinlbru = { - "spinlbrku", "spinlbrk", NULL, NULL, "1990", - "Spinal Breakers (US)\0", NULL, "V-System Co.", "V-System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0, - NULL, spinlbruRomInfo, spinlbruRomName, NULL, NULL, spinlbrkInputInfo, spinlbruDIPInfo, - spinlbrkInit,DrvExit,spinlbrkFrame,spinlbrkDraw,DrvScan, - NULL, 0x800,352,240,4,3 -}; - -struct BurnDriver BurnDrvSpinlbrj = { - "spinlbrkj", "spinlbrk", NULL, NULL, "1990", - "Spinal Breakers (Japan)\0", NULL, "V-System Co.", "V-System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0, - NULL, spinlbrjRomInfo, spinlbrjRomName, NULL, NULL, spinlbrkInputInfo, spinlbrjDIPInfo, - spinlbrkInit,DrvExit,spinlbrkFrame,spinlbrkDraw,DrvScan, - NULL, 0x800,352,240,4,3 -}; - -// ------------------------------------------------------- - -static struct BurnDIPInfo aerofgtb_DIPList[] = { - - {0x14, 0xFF, 0xFF, 0x01, NULL}, - - // DIP 3 - {0, 0xFE, 0, 2, "Region"}, - {0x14, 0x01, 0x01, 0x00, "Taiwan"}, - {0x14, 0x01, 0x01, 0x01, "Japan"}, -}; - -STDDIPINFOEXT(aerofgtb, aerofgt, aerofgtb_) - -static struct BurnRomInfo aerofgtbRomDesc[] = { - { "v2", 0x040000, 0x5c9de9f0, BRF_ESS | BRF_PRG }, // 68000 code swapped - { "v1", 0x040000, 0x89c1dcf4, BRF_ESS | BRF_PRG }, // 68000 code swapped - - { "it-19-03", 0x080000, 0x85eba1a4, BRF_GRA }, // graphics - { "it-19-02", 0x080000, 0x4f57f8ba, BRF_GRA }, - - { "it-19-04", 0x080000, 0x3b329c1f, BRF_GRA }, // - { "it-19-05", 0x080000, 0x02b525af, BRF_GRA }, // - - { "g27", 0x040000, 0x4d89cbc8, BRF_GRA }, - { "g26", 0x040000, 0x8072c1d2, BRF_GRA }, - - { "v3", 0x020000, 0xcbb18cf4, BRF_ESS | BRF_PRG }, // Sound CPU - - { "it-19-01", 0x040000, 0x6d42723d, BRF_SND }, // samples - { "it-19-06", 0x100000, 0xcdbbdb1d, BRF_SND }, -}; - -STD_ROM_PICK(aerofgtb) -STD_ROM_FN(aerofgtb) - -static struct BurnRomInfo aerofgtcRomDesc[] = { - { "v2.149", 0x040000, 0xf187aec6, BRF_ESS | BRF_PRG }, // 68000 code swapped - { "v1.111", 0x040000, 0x9e684b19, BRF_ESS | BRF_PRG }, // 68000 code swapped - - { "it-19-03", 0x080000, 0x85eba1a4, BRF_GRA }, // graphics - { "it-19-02", 0x080000, 0x4f57f8ba, BRF_GRA }, - - { "it-19-04", 0x080000, 0x3b329c1f, BRF_GRA }, // - { "it-19-05", 0x080000, 0x02b525af, BRF_GRA }, // - - { "g27", 0x040000, 0x4d89cbc8, BRF_GRA }, - { "g26", 0x040000, 0x8072c1d2, BRF_GRA }, - - { "2.153", 0x020000, 0xa1ef64ec, BRF_ESS | BRF_PRG }, // Sound CPU - - { "it-19-01", 0x040000, 0x6d42723d, BRF_SND }, // samples - { "it-19-06", 0x100000, 0xcdbbdb1d, BRF_SND }, -}; - -STD_ROM_PICK(aerofgtc) -STD_ROM_FN(aerofgtc) - -static struct BurnRomInfo sonicwiRomDesc[] = { - { "2.149", 0x040000, 0x3d1b96ba, BRF_ESS | BRF_PRG }, // 68000 code swapped - { "1.111", 0x040000, 0xa3d09f94, BRF_ESS | BRF_PRG }, // 68000 code swapped - - { "it-19-03", 0x080000, 0x85eba1a4, BRF_GRA }, // graphics - { "it-19-02", 0x080000, 0x4f57f8ba, BRF_GRA }, - - { "it-19-04", 0x080000, 0x3b329c1f, BRF_GRA }, // - { "it-19-05", 0x080000, 0x02b525af, BRF_GRA }, // - - { "g27", 0x040000, 0x4d89cbc8, BRF_GRA }, - { "g26", 0x040000, 0x8072c1d2, BRF_GRA }, - - { "2.153", 0x020000, 0xa1ef64ec, BRF_ESS | BRF_PRG }, // Sound CPU - - { "it-19-01", 0x040000, 0x6d42723d, BRF_SND }, // samples - { "it-19-06", 0x100000, 0xcdbbdb1d, BRF_SND }, -}; - -STD_ROM_PICK(sonicwi) -STD_ROM_FN(sonicwi) - -UINT8 __fastcall aerofgtbReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x0FE000: - return ~DrvInput[2]; - case 0x0FE001: - return ~DrvInput[0]; - case 0x0FE002: - return 0xFF; - case 0x0FE003: - return ~DrvInput[1]; - case 0x0FE004: - return ~DrvInput[4]; - case 0x0FE005: - return ~DrvInput[3]; - case 0x0FE007: - return pending_command; - case 0x0FE009: - return ~DrvInput[5]; - - default: - printf("Attempt to read byte value of location %x\n", sekAddress); - } - return 0; -} - -UINT16 __fastcall aerofgtbReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - - - default: - printf("Attempt to read word value of location %x\n", sekAddress); - } - return 0; -} - -void __fastcall aerofgtbWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - if (( sekAddress & 0x0FF000 ) == 0x0FD000) { - sekAddress &= 0x07FF; - RamPal[sekAddress^1] = byteValue; - // palette byte write at boot self-test only ?! - //if (sekAddress & 1) - // RamCurPal[sekAddress>>1] = CalcCol( *((UINT16 *)&RamPal[sekAddress & 0xFFE]) ); - return; - } - - switch (sekAddress) { - case 0x0FE001: - case 0x0FE401: - case 0x0FE403: - // NOP - break; - - case 0x0FE00E: - pending_command = 1; - SoundCommand(byteValue); - break; - - default: - printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } -} - -void __fastcall aerofgtbWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - if (( sekAddress & 0x0FF000 ) == 0x0FD000) { - sekAddress &= 0x07FE; - *((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue); - RamCurPal[sekAddress>>1] = CalcCol( wordValue ); - return; - } - - switch (sekAddress) { - case 0x0FE002: - bg1scrolly = wordValue; - break; - case 0x0FE004: - bg2scrollx = wordValue; - break; - case 0x0FE006: - bg2scrolly = wordValue; - break; - case 0x0FE008: - RamGfxBank[0] = (wordValue >> 0) & 0x0f; - RamGfxBank[1] = (wordValue >> 4) & 0x0f; - RamGfxBank[2] = (wordValue >> 8) & 0x0f; - RamGfxBank[3] = (wordValue >> 12) & 0x0f; - break; - case 0x0FE00A: - RamGfxBank[4] = (wordValue >> 0) & 0x0f; - RamGfxBank[5] = (wordValue >> 4) & 0x0f; - RamGfxBank[6] = (wordValue >> 8) & 0x0f; - RamGfxBank[7] = (wordValue >> 12) & 0x0f; - break; - case 0x0FE00C: - // NOP - break; - - default: - printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); - } -} - -static INT32 aerofgtbMemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x080000; // 68000 ROM - RomZ80 = Next; Next += 0x030000; // Z80 ROM - RomBg = Next; Next += 0x200040; // Background, 1M 8x8x4bit decode to 2M + 64Byte safe - DeRomBg = RomBg + 0x000040; - RomSpr1 = Next; Next += 0x200000; // Sprite 1 , 1M 16x16x4bit decode to 2M + 256Byte safe - RomSpr2 = Next; Next += 0x100100; // Sprite 2 - - DeRomSpr1 = RomSpr1 + 0x000100; - DeRomSpr2 = RomSpr2 += 0x000100; - - RomSnd1 = Next; Next += 0x040000; // ADPCM data - RomSndSize1 = 0x040000; - RomSnd2 = Next; Next += 0x100000; // ADPCM data - RomSndSize2 = 0x100000; - - RamStart = Next; - - Ram01 = Next; Next += 0x014000; // Work Ram - RamBg1V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG1 Video Ram - RamBg2V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG2 Video Ram - RamSpr1 = (UINT16 *)Next; Next += 0x002000 * sizeof(UINT16); // Sprite 1 Ram - RamSpr2 = (UINT16 *)Next; Next += 0x002000 * sizeof(UINT16); // Sprite 2 Ram - RamSpr3 = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // Sprite 3 Ram - RamPal = Next; Next += 0x000800; // 1024 of X1R5G5B5 Palette - RamRaster = (UINT16 *)Next; Next += 0x000800 * sizeof(UINT16); // Raster - - RamSpr1SizeMask = 0x1FFF; - RamSpr2SizeMask = 0x1FFF; - RomSpr1SizeMask = 0x1FFF; - RomSpr2SizeMask = 0x0FFF; - - RamZ80 = Next; Next += 0x000800; // Z80 Ram 2K - - RamEnd = Next; - - RamCurPal = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // 1024 colors - - MemEnd = Next; - return 0; -} - -static void aerofgtbDecodeSpr(UINT8 *d, UINT8 *s, INT32 cnt) -{ - for (INT32 c=cnt-1; c>=0; c--) - for (INT32 y=15; y>=0; y--) { - d[(c * 256) + (y * 16) + 15] = s[0x00005 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 14] = s[0x00005 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 13] = s[0x00007 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 12] = s[0x00007 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 11] = s[0x00004 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 10] = s[0x00004 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 9] = s[0x00006 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 8] = s[0x00006 + (y * 8) + (c * 128)] & 0x0f; - - d[(c * 256) + (y * 16) + 7] = s[0x00001 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 6] = s[0x00001 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 5] = s[0x00003 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 4] = s[0x00003 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 3] = s[0x00000 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 2] = s[0x00000 + (y * 8) + (c * 128)] & 0x0f; - d[(c * 256) + (y * 16) + 1] = s[0x00002 + (y * 8) + (c * 128)] >> 4; - d[(c * 256) + (y * 16) + 0] = s[0x00002 + (y * 8) + (c * 128)] & 0x0f; - } -} - -static INT32 aerofgtbInit() -{ - Mem = NULL; - aerofgtbMemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - aerofgtbMemIndex(); - - // Load the roms into memory - // Load 68000 ROM - if (BurnLoadRom(Rom01 + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Rom01 + 0x00000, 1, 2)) return 1; - - // Load Graphic - BurnLoadRom(RomBg+0x00000, 2, 1); - BurnLoadRom(RomBg+0x80000, 3, 1); - pspikesDecodeBg(0x8000); - - BurnLoadRom(RomSpr1+0x000000, 4, 2); - BurnLoadRom(RomSpr1+0x000001, 5, 2); - BurnLoadRom(RomSpr1+0x100000, 6, 2); - BurnLoadRom(RomSpr1+0x100001, 7, 2); - aerofgtbDecodeSpr(DeRomSpr1, RomSpr1, 0x3000); - - // Load Z80 ROM - if (BurnLoadRom(RomZ80+0x10000, 8, 1)) return 1; - memcpy(RomZ80, RomZ80+0x10000, 0x10000); - - BurnLoadRom(RomSnd1, 9, 1); - BurnLoadRom(RomSnd2, 10, 1); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x0C0000, 0x0CFFFF, SM_RAM); // 64K Work RAM - SekMapMemory((UINT8 *)RamBg1V, - 0x0D0000, 0x0D1FFF, SM_RAM); - SekMapMemory((UINT8 *)RamBg2V, - 0x0D2000, 0x0D3FFF, SM_RAM); - SekMapMemory((UINT8 *)RamSpr1, - 0x0E0000, 0x0E3FFF, SM_RAM); - SekMapMemory((UINT8 *)RamSpr2, - 0x0E4000, 0x0E7FFF, SM_RAM); - SekMapMemory(Ram01+0x10000, 0x0F8000, 0x0FBFFF, SM_RAM); // Work RAM - SekMapMemory((UINT8 *)RamSpr3, - 0x0FC000, 0x0FC7FF, SM_RAM); - SekMapMemory(RamPal, 0x0FD000, 0x0FD7FF, SM_ROM); // Palette - SekMapMemory((UINT8 *)RamRaster, - 0x0FF000, 0x0FFFFF, SM_RAM); // Raster - - SekSetReadWordHandler(0, aerofgtbReadWord); - SekSetReadByteHandler(0, aerofgtbReadByte); - SekSetWriteWordHandler(0, aerofgtbWriteWord); - SekSetWriteByteHandler(0, aerofgtbWriteByte); - - SekClose(); - } - - { - ZetInit(0); - ZetOpen(0); - - ZetMapArea(0x0000, 0x77FF, 0, RomZ80); - ZetMapArea(0x0000, 0x77FF, 2, RomZ80); - - ZetMapArea(0x7800, 0x7FFF, 0, RamZ80); - ZetMapArea(0x7800, 0x7FFF, 1, RamZ80); - ZetMapArea(0x7800, 0x7FFF, 2, RamZ80); - - ZetMemEnd(); - - //ZetSetReadHandler(aerofgtZ80Read); - //ZetSetWriteHandler(aerofgtZ80Write); - ZetSetInHandler(aerofgtZ80PortRead); - ZetSetOutHandler(aerofgtZ80PortWrite); - - ZetClose(); - } - - BurnYM2610Init(8000000, RomSnd2, &RomSndSize2, RomSnd1, &RomSndSize1, &aerofgtFMIRQHandler, aerofgtSynchroniseStream, aerofgtGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); // Reset machine - return 0; -} - -static void aerofgtbTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) -{ - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 64*64; offs++) { - mx++; - if (mx == 64) { - mx = 0; - my++; - } - - x = mx * 8 - (BURN_ENDIAN_SWAP_INT16(RamRaster[7]) & 0x1FF); - if (x <= (320-512)) x += 512; - - y = my * 8 - (((INT16)bg1scrolly + 2) & 0x1FF); - if (y <= (224-512)) y += 512; - - if ( x<=-8 || x>=320 || y<=-8 || y>= 224 ) - continue; - - else - if ( x >=0 && x < (320-8) && y >= 0 && y < (224-8)) { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - - for (INT32 k=0;k<8;k++) { - p[0] = pal[ d[0] | c ]; - p[1] = pal[ d[1] | c ]; - p[2] = pal[ d[2] | c ]; - p[3] = pal[ d[3] | c ]; - p[4] = pal[ d[4] | c ]; - p[5] = pal[ d[5] | c ]; - p[6] = pal[ d[6] | c ]; - p[7] = pal[ d[7] | c ]; - - d += 8; - p += 320; - } - } else { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - - for (INT32 k=0;k<8;k++) { - if ( (y+k)>=0 && (y+k)<224 ) { - if ((x + 0) >= 0 && (x + 0)<320) p[0] = pal[ d[0] | c ]; - if ((x + 1) >= 0 && (x + 1)<320) p[1] = pal[ d[1] | c ]; - if ((x + 2) >= 0 && (x + 2)<320) p[2] = pal[ d[2] | c ]; - if ((x + 3) >= 0 && (x + 3)<320) p[3] = pal[ d[3] | c ]; - if ((x + 4) >= 0 && (x + 4)<320) p[4] = pal[ d[4] | c ]; - if ((x + 5) >= 0 && (x + 5)<320) p[5] = pal[ d[5] | c ]; - if ((x + 6) >= 0 && (x + 6)<320) p[6] = pal[ d[6] | c ]; - if ((x + 7) >= 0 && (x + 7)<320) p[7] = pal[ d[7] | c ]; - } - d += 8; - p += 320; - } - - } - - } -} - -static void aerofgtbTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) -{ - INT32 offs, mx, my, x, y; - //printf(" %5d%5d%5d%5d\n", (signed short)RamRaster[7],(signed short)bg1scrolly, (signed short)bg2scrollx,(signed short)bg2scrolly); - mx = -1; - my = 0; - for (offs = 0; offs < 64*64; offs++) { - mx++; - if (mx == 64) { - mx = 0; - my++; - } - - x = mx * 8 - (((INT16)bg2scrollx + 5) & 0x1FF); - if (x <= (320-512)) x += 512; - - y = my * 8 - (((INT16)bg2scrolly + 2) & 0x1FF); - if (y <= (224-512)) y += 512; - - if ( x<=-8 || x>=320 || y<=-8 || y>= 224 ) - continue; - else - if ( x >=0 && x < (320-8) && y >= 0 && y < (224-8)) { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - - for (INT32 k=0;k<8;k++) { - - if (d[0] != 15) p[0] = pal[ d[0] | c ]; - if (d[1] != 15) p[1] = pal[ d[1] | c ]; - if (d[2] != 15) p[2] = pal[ d[2] | c ]; - if (d[3] != 15) p[3] = pal[ d[3] | c ]; - if (d[4] != 15) p[4] = pal[ d[4] | c ]; - if (d[5] != 15) p[5] = pal[ d[5] | c ]; - if (d[6] != 15) p[6] = pal[ d[6] | c ]; - if (d[7] != 15) p[7] = pal[ d[7] | c ]; - - d += 8; - p += 320; - } - } else { - - UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; - UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - - for (INT32 k=0;k<8;k++) { - if ( (y+k)>=0 && (y+k)<224 ) { - if (d[0] != 15 && (x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; - if (d[1] != 15 && (x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; - if (d[2] != 15 && (x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; - if (d[3] != 15 && (x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; - if (d[4] != 15 && (x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; - if (d[5] != 15 && (x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; - if (d[6] != 15 && (x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; - if (d[7] != 15 && (x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; - } - d += 8; - p += 320; - } - - } - - } -} - -static void aerofgtb_pdrawgfxzoom(INT32 bank,UINT32 code,UINT32 color,INT32 flipx,INT32 flipy,INT32 sx,INT32 sy,INT32 scalex,INT32 scaley) -{ - if (!scalex || !scaley) return; - - UINT16 * p = (UINT16 *) pBurnDraw; - UINT8 * q; - UINT16 * pal; - - if (bank) { - //if (code > RomSpr2SizeMask) - code &= RomSpr2SizeMask; - q = DeRomSpr2 + (code) * 256; - pal = RamCurPal + 768; - } else { - //if (code > RomSpr1SizeMask) - code &= RomSpr1SizeMask; - q = DeRomSpr1 + (code) * 256; - pal = RamCurPal + 512; - } - - p += sy * 320 + sx; - - if (sx < 0 || sx >= (320-16) || sy < 0 || sy >= (224-16) ) { - - if ((sx <= -16) || (sx >= 320) || (sy <= -16) || (sy >= 224)) - return; - - if (flipy) { - - p += 320 * 15; - - if (flipx) { - - for (INT32 i=15;i>=0;i--) { - if (((sy+i)>=0) && ((sy+i)<224)) { - if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[15] | color]; - } - p -= 320; - q += 16; - } - - } else { - - for (INT32 i=15;i>=0;i--) { - if (((sy+i)>=0) && ((sy+i)<224)) { - if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[15] | color]; - } - p -= 320; - q += 16; - } - } - - } else { - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - if (((sy+i)>=0) && ((sy+i)<224)) { - if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[15] | color]; - } - p += 320; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - if (((sy+i)>=0) && ((sy+i)<224)) { - if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[10] | color]; - if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[11] | color]; - if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[12] | color]; - if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[13] | color]; - if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[14] | color]; - if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[15] | color]; - } - p += 320; - q += 16; - } - - } - - } - - return; - } - - if (flipy) { - - p += 320 * 15; - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15) p[ 0] = pal[ q[15] | color]; - - p -= 320; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15) p[10] = pal[ q[10] | color]; - if (q[11] != 15) p[11] = pal[ q[11] | color]; - if (q[12] != 15) p[12] = pal[ q[12] | color]; - if (q[13] != 15) p[13] = pal[ q[13] | color]; - if (q[14] != 15) p[14] = pal[ q[14] | color]; - if (q[15] != 15) p[15] = pal[ q[15] | color]; - - p -= 320; - q += 16; - } - } - - } else { - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; - if (q[10] != 15) p[ 5] = pal[ q[10] | color]; - if (q[11] != 15) p[ 4] = pal[ q[11] | color]; - if (q[12] != 15) p[ 3] = pal[ q[12] | color]; - if (q[13] != 15) p[ 2] = pal[ q[13] | color]; - if (q[14] != 15) p[ 1] = pal[ q[14] | color]; - if (q[15] != 15) p[ 0] = pal[ q[15] | color]; - - p += 320; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; - if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; - if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; - if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; - if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; - if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; - if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; - if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; - - if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; - if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; - if (q[10] != 15) p[10] = pal[ q[10] | color]; - if (q[11] != 15) p[11] = pal[ q[11] | color]; - if (q[12] != 15) p[12] = pal[ q[12] | color]; - if (q[13] != 15) p[13] = pal[ q[13] | color]; - if (q[14] != 15) p[14] = pal[ q[14] | color]; - if (q[15] != 15) p[15] = pal[ q[15] | color]; - - p += 320; - q += 16; - } - - } - - } - -} - -static void aerofgtb_drawsprites(INT32 chip,INT32 chip_disabled_pri) -{ - INT32 attr_start,base,first; - - base = chip * 0x0200; - first = 4 * BURN_ENDIAN_SWAP_INT16(RamSpr3[0x1fe + base]); - - //for (attr_start = base + 0x0200-8;attr_start >= first + base;attr_start -= 4) { - for (attr_start = first + base; attr_start <= base + 0x0200-8; attr_start += 4) { - INT32 map_start; - INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color,pri; -// some other drivers still use this wrong table, they have to be upgraded -// INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; - - if (!(BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0080)) continue; - pri = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0010; - if ( chip_disabled_pri & !pri) continue; - if (!chip_disabled_pri & (pri>>4)) continue; - ox = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0x01ff; - xsize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0700) >> 8; - zoomx = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0xf000) >> 12; - oy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0x01ff; - ysize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x7000) >> 12; - zoomy = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0xf000) >> 12; - flipx = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0800; - flipy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x8000; - color = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x000f) << 4; // + 16 * spritepalettebank; - - map_start = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 3]); - -// aerofgt has this adjustment, but doing it here would break turbo force title screen -// ox += (xsize*zoomx+2)/4; -// oy += (ysize*zoomy+2)/4; - - zoomx = 32 - zoomx; - zoomy = 32 - zoomy; - - for (y = 0;y <= ysize;y++) { - INT32 sx,sy; - - if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16 - 1; - else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16 - 1; - - for (x = 0;x <= xsize;x++) { - INT32 code; - - if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16 - 8; - else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16 - 8; - - if (chip == 0) code = BURN_ENDIAN_SWAP_INT16(RamSpr1[map_start & RamSpr1SizeMask]); - else code = BURN_ENDIAN_SWAP_INT16(RamSpr2[map_start & RamSpr2SizeMask]); - - aerofgtb_pdrawgfxzoom(chip,code,color,flipx,flipy,sx,sy,zoomx << 11, zoomy << 11); - - map_start++; - } - - if (xsize == 2) map_start += 1; - if (xsize == 4) map_start += 3; - if (xsize == 5) map_start += 2; - if (xsize == 6) map_start += 1; - } - } -} - -static INT32 aerofgtbDraw() -{ - aerofgtbTileBackground_1(RamBg1V, DeRomBg, RamCurPal); - aerofgtbTileBackground_2(RamBg2V, DeRomBg + 0x100000, RamCurPal + 256); - - aerofgtb_drawsprites(0, 0); - aerofgtb_drawsprites(0,-1); - aerofgtb_drawsprites(1, 0); - aerofgtb_drawsprites(1,-1); - - return 0; -} - -static INT32 aerofgtbFrame() -{ - if (DrvReset) DrvDoReset(); - - // Compile digital inputs - DrvInput[0] = 0x00; // Joy1 - DrvInput[1] = 0x00; // Joy2 - DrvInput[2] = 0x00; // Buttons - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[2] |= (DrvButton[i] & 1) << i; - } - - SekNewFrame(); - ZetNewFrame(); - - nCyclesTotal[0] = 10000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - - SekOpen(0); - ZetOpen(0); - - SekRun(nCyclesTotal[0]); - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrame(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - - ZetClose(); - SekClose(); - - if (pBurnDraw) aerofgtbDraw(); - - return 0; -} - -struct BurnDriver BurnDrvAerofgtb = { - "aerofgtb", "aerofgt", NULL, NULL, "1992", - "Aero Fighters (Turbo Force hardware set 1)\0", NULL, "Video System Co.", "Video System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, FBF_SONICWI, - NULL, aerofgtbRomInfo, aerofgtbRomName, NULL, NULL, aerofgtInputInfo, aerofgtbDIPInfo, - aerofgtbInit,DrvExit,aerofgtbFrame,aerofgtbDraw,DrvScan, - NULL, 0x800, 224,320,3,4 -}; - -struct BurnDriver BurnDrvAerofgtc = { - "aerofgtc", "aerofgt", NULL, NULL, "1992", - "Aero Fighters (Turbo Force hardware set 2)\0", NULL, "Video System Co.", "Video System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, FBF_SONICWI, - NULL, aerofgtcRomInfo, aerofgtcRomName, NULL, NULL, aerofgtInputInfo, aerofgtDIPInfo, - aerofgtbInit,DrvExit,aerofgtbFrame,aerofgtbDraw,DrvScan, - NULL, 0x800, 224,320,3,4 -}; - -struct BurnDriver BurnDrvSonicwi = { - "sonicwi", "aerofgt", NULL, NULL, "1992", - "Sonic Wings (Japan)\0", NULL, "Video System Co.", "Video System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, FBF_SONICWI, - NULL, sonicwiRomInfo, sonicwiRomName, NULL, NULL, aerofgtInputInfo, aerofgtDIPInfo, - aerofgtbInit,DrvExit,aerofgtbFrame,aerofgtbDraw,DrvScan, - NULL, 0x800, 224,320,3,4 -}; - +/* + * Aero Fighters driver for FB Alpha 0.2.96.71 + * Port by OopsWare. 2007 + * http://oopsware.googlepages.com + * http://oopsware.ys168.com + * + * 6.13.2007 + * Add driver Spinal Breakers (spinlbrk) + * + * 6.12.2007 + * Add driver Karate Blazers (karatblz) + * + * 6.11.2007 + * Add driver Turbo Force (turbofrc) + * + * 6.10.2007 + * Add BurnHighCol support, and add BDF_16BIT_ONLY into driver. thanks to KEV + * + */ + +#include "burnint.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2610.h" + +#define USE_BURN_HIGHCOL 1 + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy4[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + +static UINT8 DrvInput[10] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *RomZ80; +static UINT8 *RomBg; +static UINT8 *RomSpr1; +static UINT8 *RomSpr2; +static UINT8 *RomSnd1; +static UINT8 *RomSnd2; + +static UINT8 *RamPal; +static UINT16 *RamRaster; +static UINT16 *RamBg1V, *RamBg2V; +static UINT16 *RamSpr1; +static UINT16 *RamSpr2; +static UINT16 *RamSpr3; +static UINT8 *Ram01; +static UINT8 *RamZ80; + +//static INT32 nCyclesDone[2]; +static INT32 nCyclesTotal[2]; +//static INT32 nCyclesSegment; + +static UINT8 RamGfxBank[8]; + +static UINT16 *RamCurPal; +static UINT8 *DeRomBg; +static UINT8 *DeRomSpr1; +static UINT8 *DeRomSpr2; + +static UINT32 RamSpr1SizeMask; +static UINT32 RamSpr2SizeMask; +static UINT32 RomSpr1SizeMask; +static UINT32 RomSpr2SizeMask; + +static INT32 pending_command = 0; +static INT32 RomSndSize1, RomSndSize2; + +static UINT16 bg1scrollx, bg2scrollx; +static UINT16 bg1scrolly, bg2scrolly; + +static INT32 nAerofgtZ80Bank; +static UINT8 nSoundlatch; + +#if USE_BURN_HIGHCOL + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour & 0x001F) << 3; // Red + r |= r >> 5; + g = (nColour & 0x03E0) >> 2; // Green + g |= g >> 5; + b = (nColour & 0x7C00) >> 7; // Blue + b |= b >> 5; + + return BurnHighCol(b, g, r, 0); +} + +#else + +inline static UINT32 CalcCol(UINT16 nColour) +{ + return (nColour & 0x001F) | ((nColour & 0x7FE0) << 1); +} + +#endif + +static struct BurnInputInfo aerofgtInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 2, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 3, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + + {"P3 Coin", BIT_DIGITAL, DrvButton + 6, "p3 coin"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, +}; + +STDINPUTINFO(aerofgt) + +static struct BurnDIPInfo aerofgtDIPList[] = { + // Defaults + {0x12, 0xFF, 0xFF, 0x00, NULL}, + {0x13, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, "Coin Slot"}, + {0x12, 0x01, 0x01, 0x00, "Same"}, + {0x12, 0x01, 0x01, 0x01, "Individual"}, + {0, 0xFE, 0, 8, "Coin 1"}, + {0x12, 0x01, 0x0E, 0x00, "1 coin 1 credits"}, + {0x12, 0x01, 0x0E, 0x02, "2 coin 1 credits"}, + {0x12, 0x01, 0x0E, 0x04, "3 coin 1 credit"}, + {0x12, 0x01, 0x0E, 0x06, "1 coin 2 credits"}, + {0x12, 0x01, 0x0E, 0x08, "1 coins 3 credit"}, + {0x12, 0x01, 0x0E, 0x0A, "1 coins 4 credit"}, + {0x12, 0x01, 0x0E, 0x0C, "1 coins 5 credit"}, + {0x12, 0x01, 0x0E, 0x0E, "1 coins 6 credit"}, + {0, 0xFE, 0, 8, "Coin 2"}, + {0x12, 0x01, 0x70, 0x00, "1 coin 1 credits"}, + {0x12, 0x01, 0x70, 0x10, "2 coin 1 credits"}, + {0x12, 0x01, 0x70, 0x20, "3 coin 1 credit"}, + {0x12, 0x01, 0x70, 0x30, "1 coin 2 credits"}, + {0x12, 0x01, 0x70, 0x40, "1 coins 3 credit"}, + {0x12, 0x01, 0x70, 0x50, "1 coins 4 credit"}, + {0x12, 0x01, 0x70, 0x60, "1 coins 5 credit"}, + {0x12, 0x01, 0x70, 0x70, "1 coins 6 credit"}, + {0, 0xFE, 0, 2, "2 Coins to Start, 1 to Continue"}, + {0x12, 0x01, 0x80, 0x00, "Off"}, + {0x12, 0x01, 0x80, 0x80, "On"}, + + // DIP 2 + {0, 0xFE, 0, 2, "Screen flip"}, + {0x13, 0x01, 0x01, 0x00, "Off"}, + {0x13, 0x01, 0x01, 0x01, "On"}, + {0, 0xFE, 0, 2, "Demo sound"}, + {0x13, 0x01, 0x02, 0x00, "Off"}, + {0x13, 0x01, 0x02, 0x02, "On"}, + {0, 0xFE, 0, 4, "Difficulty"}, + {0x13, 0x01, 0x0C, 0x00, "Normal"}, + {0x13, 0x01, 0x0C, 0x04, "Easy"}, + {0x13, 0x01, 0x0C, 0x08, "Hard"}, + {0x13, 0x01, 0x0C, 0x0C, "Hardest"}, + {0, 0xFE, 0, 4, "Lives"}, + {0x13, 0x01, 0x30, 0x00, "3"}, + {0x13, 0x01, 0x30, 0x10, "1"}, + {0x13, 0x01, 0x30, 0x20, "2"}, + {0x13, 0x01, 0x30, 0x30, "4"}, + {0, 0xFE, 0, 2, "Bonus Life"}, + {0x13, 0x01, 0x40, 0x00, "200000"}, + {0x13, 0x01, 0x40, 0x40, "300000"}, + {0, 0xFE, 0, 2, "Service"}, + {0x13, 0x01, 0x80, 0x00, "Off"}, + {0x13, 0x01, 0x80, 0x80, "On"}, + +}; + +static struct BurnDIPInfo aerofgt_DIPList[] = { + {0x14, 0xFF, 0xFF, 0x0F, NULL}, + + // DIP 3 + {0, 0xFE, 0, 5, "Region"}, + {0x14, 0x01, 0x0F, 0x00, "USA"}, + {0x14, 0x01, 0x0F, 0x01, "Korea"}, + {0x14, 0x01, 0x0F, 0x02, "Hong Kong"}, + {0x14, 0x01, 0x0F, 0x04, "Taiwan"}, + {0x14, 0x01, 0x0F, 0x0F, "Any"}, +}; + +STDDIPINFOEXT(aerofgt, aerofgt, aerofgt_) + +// Rom information +static struct BurnRomInfo aerofgtRomDesc[] = { + { "1.u4", 0x080000, 0x6fdff0a2, BRF_ESS | BRF_PRG }, // 68000 code swapped + + { "538a54.124", 0x080000, 0x4d2c4df2, BRF_GRA }, // graphics + { "1538a54.124", 0x080000, 0x286d109e, BRF_GRA }, + + { "538a53.u9", 0x100000, 0x630d8e0b, BRF_GRA }, // + { "534g8f.u18", 0x080000, 0x76ce0926, BRF_GRA }, + + { "2.153", 0x020000, 0xa1ef64ec, BRF_ESS | BRF_PRG }, // Sound CPU + + { "it-19-01", 0x040000, 0x6d42723d, BRF_SND }, // samples + { "it-19-06", 0x100000, 0xcdbbdb1d, BRF_SND }, +}; + +STD_ROM_PICK(aerofgt) +STD_ROM_FN(aerofgt) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x080000; // 68000 ROM + RomZ80 = Next; Next += 0x030000; // Z80 ROM + RomBg = Next; Next += 0x200040; // Background, 1M 8x8x4bit decode to 2M + 64Byte safe + DeRomBg = RomBg + 0x000040; + RomSpr1 = Next; Next += 0x200000; // Sprite 1 , 1M 16x16x4bit decode to 2M + 256Byte safe + RomSpr2 = Next; Next += 0x100100; // Sprite 2 + + DeRomSpr1 = RomSpr1 + 0x000100; + DeRomSpr2 = RomSpr2 += 0x000100; + + RomSnd1 = Next; Next += 0x040000; // ADPCM data + RomSndSize1 = 0x040000; + RomSnd2 = Next; Next += 0x100000; // ADPCM data + RomSndSize2 = 0x100000; + RamStart = Next; + + RamPal = Next; Next += 0x000800; // 1024 of X1R5G5B5 Palette + RamRaster = (UINT16 *)Next; Next += 0x000800 * sizeof(UINT16); // 0x1b0000~0x1b07ff, Raster + // 0x1b0800~0x1b0801, NOP + // 0x1b0ff0~0x1b0fff, stack area during boot + RamBg1V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG1 Video Ram + RamBg2V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG2 Video Ram + RamSpr1 = (UINT16 *)Next; Next += 0x004000 * sizeof(UINT16); // Sprite 1 Ram + RamSpr2 = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // Sprite 2 Ram + Ram01 = Next; Next += 0x010000; // Work Ram + RamZ80 = Next; Next += 0x000800; // Z80 Ram 2K + + RamEnd = Next; + + RamCurPal = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // 1024 colors + + MemEnd = Next; + return 0; +} + +static void DecodeBg() +{ + for (INT32 c=0x8000-1; c>=0; c--) { + for (INT32 y=7; y>=0; y--) { + DeRomBg[(c * 64) + (y * 8) + 7] = RomBg[0x00002 + (y * 4) + (c * 32)] & 0x0f; + DeRomBg[(c * 64) + (y * 8) + 6] = RomBg[0x00002 + (y * 4) + (c * 32)] >> 4; + DeRomBg[(c * 64) + (y * 8) + 5] = RomBg[0x00003 + (y * 4) + (c * 32)] & 0x0f; + DeRomBg[(c * 64) + (y * 8) + 4] = RomBg[0x00003 + (y * 4) + (c * 32)] >> 4; + DeRomBg[(c * 64) + (y * 8) + 3] = RomBg[0x00000 + (y * 4) + (c * 32)] & 0x0f; + DeRomBg[(c * 64) + (y * 8) + 2] = RomBg[0x00000 + (y * 4) + (c * 32)] >> 4; + DeRomBg[(c * 64) + (y * 8) + 1] = RomBg[0x00001 + (y * 4) + (c * 32)] & 0x0f; + DeRomBg[(c * 64) + (y * 8) + 0] = RomBg[0x00001 + (y * 4) + (c * 32)] >> 4; + } + } +} + +static void DecodeSpr(UINT8 *d, UINT8 *s, INT32 cnt) +{ + for (INT32 c=cnt-1; c>=0; c--) + for (INT32 y=15; y>=0; y--) { + d[(c * 256) + (y * 16) + 15] = s[0x00006 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 14] = s[0x00006 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 13] = s[0x00007 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 12] = s[0x00007 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 11] = s[0x00004 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 10] = s[0x00004 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 9] = s[0x00005 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 8] = s[0x00005 + (y * 8) + (c * 128)] >> 4; + + d[(c * 256) + (y * 16) + 7] = s[0x00002 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 6] = s[0x00002 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 5] = s[0x00003 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 4] = s[0x00003 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 3] = s[0x00000 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 2] = s[0x00000 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 1] = s[0x00001 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 0] = s[0x00001 + (y * 8) + (c * 128)] >> 4; + } +} + +static INT32 LoadRoms() +{ + // Load 68000 ROM + if (BurnLoadRom(Rom01, 0, 1)) { + return 1; + } + + // Load Graphic + BurnLoadRom(RomBg, 1, 1); + BurnLoadRom(RomBg+0x80000, 2, 1); + DecodeBg(); + + BurnLoadRom(RomSpr1+0x000000, 3, 1); + BurnLoadRom(RomSpr1+0x100000, 4, 1); + DecodeSpr(DeRomSpr1, RomSpr1, 8192+4096); + + // Load Z80 ROM + if (BurnLoadRom(RomZ80+0x10000, 5, 1)) return 1; + memcpy(RomZ80, RomZ80+0x10000, 0x10000); + + BurnLoadRom(RomSnd1, 6, 1); + BurnLoadRom(RomSnd2, 7, 1); + + return 0; +} + +UINT8 __fastcall aerofgtReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xFFFFA1: + return ~DrvInput[0]; + case 0xFFFFA3: + return ~DrvInput[1]; + case 0xFFFFA5: + return ~DrvInput[2]; + case 0xFFFFA7: + return ~DrvInput[3]; + case 0xFFFFA9: + return ~DrvInput[4]; + case 0xFFFFAD: + //printf("read pending_command %d addr %08x\n", pending_command, sekAddress); + return pending_command; + case 0xFFFFAF: + return ~DrvInput[5]; +// default: +// printf("Attempt to read byte value of location %x\n", sekAddress); + } + return 0; +} + +/* +UINT16 __fastcall aerofgtReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + + + default: + printf("Attempt to read word value of location %x\n", sekAddress); + } + return 0; +} +*/ + +static void SoundCommand(UINT8 nCommand) +{ +// bprintf(PRINT_NORMAL, _T(" - Sound command sent (0x%02X).\n"), nCommand); + INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]); + if (nCycles <= ZetTotalCycles()) return; + + BurnTimerUpdate(nCycles); + + nSoundlatch = nCommand; + ZetNmi(); +} + +void __fastcall aerofgtWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if (( sekAddress & 0xFF0000 ) == 0x1A0000) { + sekAddress &= 0xFFFF; + if (sekAddress < 0x800) { + RamPal[sekAddress^1] = byteValue; + // palette byte write at boot self-test only ?! + // if (sekAddress & 1) + // RamCurPal[sekAddress>>1] = CalcCol( *((UINT16 *)&RamPal[sekAddress]) ); + } + return; + } + + switch (sekAddress) { + case 0xFFFFC1: + pending_command = 1; + SoundCommand(byteValue); + break; +/* + case 0xFFFFB9: + case 0xFFFFBB: + case 0xFFFFBD: + case 0xFFFFBF: + break; + case 0xFFFFAD: + // NOP + break; + default: + printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); +*/ + } +} + +void __fastcall aerofgtWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + if (( sekAddress & 0xFF0000 ) == 0x1A0000) { + sekAddress &= 0xFFFF; + if (sekAddress < 0x800) + *((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue); + RamCurPal[sekAddress>>1] = CalcCol( wordValue ); + return; + } + + switch (sekAddress) { + case 0xFFFF80: + RamGfxBank[0] = wordValue >> 0x08; + RamGfxBank[1] = wordValue & 0xFF; + break; + case 0xFFFF82: + RamGfxBank[2] = wordValue >> 0x08; + RamGfxBank[3] = wordValue & 0xFF; + break; + case 0xFFFF84: + RamGfxBank[4] = wordValue >> 0x08; + RamGfxBank[5] = wordValue & 0xFF; + break; + case 0xFFFF86: + RamGfxBank[6] = wordValue >> 0x08; + RamGfxBank[7] = wordValue & 0xFF; + break; + case 0xFFFF88: + bg1scrolly = wordValue; + break; + case 0xFFFF90: + bg2scrolly = wordValue; + break; +/* + case 0xFFFF40: + case 0xFFFF42: + case 0xFFFF44: + case 0xFFFF48: + case 0xFFFF4A: + case 0xFFFF4C: + case 0xFFFF50: + case 0xFFFF52: + case 0xFFFF60: + break; + default: + printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); +*/ + } +} + +static void aerofgtFMIRQHandler(INT32, INT32 nStatus) +{ +// bprintf(PRINT_NORMAL, _T(" - IRQ -> %i.\n"), nStatus); + if (nStatus) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 aerofgtSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double aerofgtGetTime() +{ + return (double)ZetTotalCycles() / 4000000.0; +} + +/* +static UINT8 __fastcall aerofgtZ80Read(UINT16 a) +{ + switch (a) { + + default: + printf("Z80 Attempt to read word value of location %04x\n", a); + } + return 0; +} + +static void __fastcall aerofgtZ80Write(UINT16 a,UINT8 v) +{ + switch (a) { + + default: + printf("Attempt to write word value %x to location %x\n", v, a); + } +} +*/ + +static void aerofgtSndBankSwitch(UINT8 v) +{ +/* + UINT8 *rom = memory_region(REGION_CPU2) + 0x10000; + memory_set_bankptr(1,rom + (data & 0x03) * 0x8000); +*/ + v &= 0x03; + if (v != nAerofgtZ80Bank) { + UINT8* nStartAddress = RomZ80 + 0x10000 + (v << 15); + ZetMapArea(0x8000, 0xFFFF, 0, nStartAddress); + ZetMapArea(0x8000, 0xFFFF, 2, nStartAddress); + nAerofgtZ80Bank = v; + } +} + +UINT8 __fastcall aerofgtZ80PortRead(UINT16 p) +{ + switch (p & 0xFF) { + case 0x00: + return BurnYM2610Read(0); + case 0x02: + return BurnYM2610Read(2); + case 0x0C: + return nSoundlatch; +// default: +// printf("Z80 Attempt to read port %04x\n", p); + } + return 0; +} + +void __fastcall aerofgtZ80PortWrite(UINT16 p, UINT8 v) +{ + switch (p & 0x0FF) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + BurnYM2610Write(p & 3, v); + break; + case 0x04: + aerofgtSndBankSwitch(v); + break; + case 0x08: + pending_command = 0; + break; +// default: +// printf("Z80 Attempt to write %02x to port %04x\n", v, p); + } +} + + +static INT32 DrvDoReset() +{ + nAerofgtZ80Bank = -1; + + SekOpen(0); + //nIRQPending = 0; + SekSetIRQLine(0, SEK_IRQSTATUS_NONE); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + aerofgtSndBankSwitch(0); + ZetClose(); + BurnYM2610Reset(); + + memset(RamGfxBank, 0 , sizeof(RamGfxBank)); + + return 0; +} + +static INT32 aerofgtInit() +{ + Mem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)malloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); + + // Load the roms into memory + + if (LoadRoms()) { + return 1; + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(RamPal, 0x1A0000, 0x1A07FF, SM_ROM); // Palette + SekMapMemory((UINT8 *)RamRaster, + 0x1B0000, 0x1B0FFF, SM_RAM); // Raster / MRA_NOP / MRA_BANK7 + SekMapMemory((UINT8 *)RamBg1V, + 0x1B2000, 0x1B3FFF, SM_RAM); + SekMapMemory((UINT8 *)RamBg2V, + 0x1B4000, 0x1B5FFF, SM_RAM); + SekMapMemory((UINT8 *)RamSpr1, + 0x1C0000, 0x1C7FFF, SM_RAM); + SekMapMemory((UINT8 *)RamSpr2, + 0x1D0000, 0x1D1FFF, SM_RAM); + SekMapMemory(Ram01, 0xFEF000, 0xFFEFFF, SM_RAM); // 64K Work RAM + +// SekSetReadWordHandler(0, aerofgtReadWord); + SekSetReadByteHandler(0, aerofgtReadByte); + SekSetWriteWordHandler(0, aerofgtWriteWord); + SekSetWriteByteHandler(0, aerofgtWriteByte); + + SekClose(); + } + + { + ZetInit(0); + ZetOpen(0); + + ZetMapArea(0x0000, 0x77FF, 0, RomZ80); + ZetMapArea(0x0000, 0x77FF, 2, RomZ80); + + ZetMapArea(0x7800, 0x7FFF, 0, RamZ80); + ZetMapArea(0x7800, 0x7FFF, 1, RamZ80); + ZetMapArea(0x7800, 0x7FFF, 2, RamZ80); + + + //ZetSetReadHandler(aerofgtZ80Read); + //ZetSetWriteHandler(aerofgtZ80Write); + ZetSetInHandler(aerofgtZ80PortRead); + ZetSetOutHandler(aerofgtZ80PortWrite); + + ZetClose(); + } + + BurnYM2610Init(8000000, RomSnd2, &RomSndSize2, RomSnd1, &RomSndSize1, &aerofgtFMIRQHandler, aerofgtSynchroniseStream, aerofgtGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); // Reset machine + return 0; +} + +static INT32 DrvExit() +{ + BurnYM2610Exit(); + + ZetExit(); + SekExit(); + + BurnFree(Mem); + + return 0; +} + + +static void drawgfxzoom(INT32 bank,UINT32 code,UINT32 color,INT32 flipx,INT32 flipy,INT32 sx,INT32 sy,INT32 scalex,INT32 scaley) +{ + if (!scalex || !scaley) return; + + UINT16 * p = (UINT16 *) pBurnDraw; + UINT8 * q; + UINT16 * pal; + + if (bank) { + q = DeRomSpr2 + (code) * 256; + pal = RamCurPal + 768; + } else { + q = DeRomSpr1 + (code) * 256; + pal = RamCurPal + 512; + } + + p += sy * 320 + sx; + + if (sx < 0 || sx >= 304 || sy < 0 || sy >= 208 ) { + + if ((sx <= -16) || (sx >= 320) || (sy <= -16) || (sy >= 224)) + return; + + if (flipy) { + + p += 320 * 15; + + if (flipx) { + + for (INT32 i=15;i>=0;i--) { + if (((sy+i)>=0) && ((sy+i)<224)) { + if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[15] | color]; + } + p -= 320; + q += 16; + } + + } else { + + for (INT32 i=15;i>=0;i--) { + if (((sy+i)>=0) && ((sy+i)<224)) { + if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[15] | color]; + } + p -= 320; + q += 16; + } + } + + } else { + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + if (((sy+i)>=0) && ((sy+i)<224)) { + if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[15] | color]; + } + p += 320; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + if (((sy+i)>=0) && ((sy+i)<224)) { + if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[15] | color]; + } + p += 320; + q += 16; + } + + } + + } + + return; + } + + if (flipy) { + + p += 320 * 15; + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15) p[ 0] = pal[ q[15] | color]; + + p -= 320; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15) p[10] = pal[ q[10] | color]; + if (q[11] != 15) p[11] = pal[ q[11] | color]; + if (q[12] != 15) p[12] = pal[ q[12] | color]; + if (q[13] != 15) p[13] = pal[ q[13] | color]; + if (q[14] != 15) p[14] = pal[ q[14] | color]; + if (q[15] != 15) p[15] = pal[ q[15] | color]; + + p -= 320; + q += 16; + } + } + + } else { + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15) p[ 0] = pal[ q[15] | color]; + + p += 320; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15) p[10] = pal[ q[10] | color]; + if (q[11] != 15) p[11] = pal[ q[11] | color]; + if (q[12] != 15) p[12] = pal[ q[12] | color]; + if (q[13] != 15) p[13] = pal[ q[13] | color]; + if (q[14] != 15) p[14] = pal[ q[14] | color]; + if (q[15] != 15) p[15] = pal[ q[15] | color]; + + p += 320; + q += 16; + } + + } + + } + +} + +static void aerofgt_drawsprites(INT32 priority) +{ + priority <<= 12; + INT32 offs = 0; + + while (offs < 0x0400 && (BURN_ENDIAN_SWAP_INT16(RamSpr2[offs]) & 0x8000) == 0) { + INT32 attr_start = (BURN_ENDIAN_SWAP_INT16(RamSpr2[offs]) & 0x03ff) * 4; + + /* is the way I handle priority correct? Or should I just check bit 13? */ + if ((BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x3000) == priority) { + INT32 map_start; + INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color; + + ox = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 1]) & 0x01ff; + xsize = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 1]) & 0x0e00) >> 9; + zoomx = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 1]) & 0xf000) >> 12; + oy = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 0]) & 0x01ff; + ysize = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 0]) & 0x0e00) >> 9; + zoomy = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 0]) & 0xf000) >> 12; + flipx = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x4000; + flipy = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x8000; + color = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x0f00) >> 4; + map_start = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 3]) & 0x3fff; + + ox += (xsize*zoomx+2)/4; + oy += (ysize*zoomy+2)/4; + + zoomx = 32 - zoomx; + zoomy = 32 - zoomy; + + for (y = 0;y <= ysize;y++) { + INT32 sx,sy; + + if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16; + else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16; + + for (x = 0;x <= xsize;x++) { + if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16; + else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16; + + //if (map_start < 0x2000) + INT32 code = BURN_ENDIAN_SWAP_INT16(RamSpr1[map_start]) & 0x1fff; + + drawgfxzoom(map_start&0x2000,code,color,flipx,flipy,sx,sy,zoomx<<11, zoomy<<11); + + map_start++; + } + } + } + offs++; + } +} + + +/* + * aerofgt Background Tile + * 16-bit tile code in RamBg1V and RamBg2V + * 0xE000 shr 13 is Color + * 0x1800 shr 11 is Gfx Bank + * 0x07FF shr 0 or Tile element index (low part) + * + */ + +static void TileBackground_1(UINT16 *bg, UINT16 *pal) +{ + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 64*64; offs++) { + mx++; + if (mx == 64) { + mx = 0; + my++; + } + + x = mx * 8 - BURN_ENDIAN_SWAP_INT16(RamRaster[0x0000]) + 18; + if (x <= -192) x += 512; + + y = my * 8 - (bg1scrolly & 0x1FF); + if (y <= (224-512)) y += 512; + + if ( x<=-8 || x>=320 || y<=-8 || y>= 224 ) + continue; + else + if ( x >=0 && x < 312 && y >= 0 && y < 216) { + + UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + + for (INT32 k=0;k<8;k++) { + p[0] = pal[ d[0] | c ]; + p[1] = pal[ d[1] | c ]; + p[2] = pal[ d[2] | c ]; + p[3] = pal[ d[3] | c ]; + p[4] = pal[ d[4] | c ]; + p[5] = pal[ d[5] | c ]; + p[6] = pal[ d[6] | c ]; + p[7] = pal[ d[7] | c ]; + + d += 8; + p += 320; + } + } else { + + UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + + for (INT32 k=0;k<8;k++) { + if ( (y+k)>=0 && (y+k)<224 ) { + if ((x + 0) >= 0 && (x + 0)<320) p[0] = pal[ d[0] | c ]; + if ((x + 1) >= 0 && (x + 1)<320) p[1] = pal[ d[1] | c ]; + if ((x + 2) >= 0 && (x + 2)<320) p[2] = pal[ d[2] | c ]; + if ((x + 3) >= 0 && (x + 3)<320) p[3] = pal[ d[3] | c ]; + if ((x + 4) >= 0 && (x + 4)<320) p[4] = pal[ d[4] | c ]; + if ((x + 5) >= 0 && (x + 5)<320) p[5] = pal[ d[5] | c ]; + if ((x + 6) >= 0 && (x + 6)<320) p[6] = pal[ d[6] | c ]; + if ((x + 7) >= 0 && (x + 7)<320) p[7] = pal[ d[7] | c ]; + } + d += 8; + p += 320; + } + + } + + } +} + +static void TileBackground_2(UINT16 *bg, UINT16 *pal) +{ + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 64*64; offs++) { + mx++; + if (mx == 64) { + mx = 0; + my++; + } + + x = mx * 8 - BURN_ENDIAN_SWAP_INT16(RamRaster[0x0200]) + 20; + if (x <= -192) x += 512; + + y = my * 8 - (bg2scrolly & 0x1FF); + if (y <= (224-512)) y += 512; + + if ( x<=-8 || x>=320 || y<=-8 || y>= 224 ) + continue; + else + if ( x >=0 && x < 312 && y >= 0 && y < 216) { + + UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + + for (INT32 k=0;k<8;k++) { + + if (d[0] != 15) p[0] = pal[ d[0] | c ]; + if (d[1] != 15) p[1] = pal[ d[1] | c ]; + if (d[2] != 15) p[2] = pal[ d[2] | c ]; + if (d[3] != 15) p[3] = pal[ d[3] | c ]; + if (d[4] != 15) p[4] = pal[ d[4] | c ]; + if (d[5] != 15) p[5] = pal[ d[5] | c ]; + if (d[6] != 15) p[6] = pal[ d[6] | c ]; + if (d[7] != 15) p[7] = pal[ d[7] | c ]; + + d += 8; + p += 320; + } + } else { + + UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + + for (INT32 k=0;k<8;k++) { + if ( (y+k)>=0 && (y+k)<224 ) { + if (d[0] != 15 && (x + 0) >= 0 && (x + 0)<320) p[0] = pal[ d[0] | c ]; + if (d[1] != 15 && (x + 1) >= 0 && (x + 1)<320) p[1] = pal[ d[1] | c ]; + if (d[2] != 15 && (x + 2) >= 0 && (x + 2)<320) p[2] = pal[ d[2] | c ]; + if (d[3] != 15 && (x + 3) >= 0 && (x + 3)<320) p[3] = pal[ d[3] | c ]; + if (d[4] != 15 && (x + 4) >= 0 && (x + 4)<320) p[4] = pal[ d[4] | c ]; + if (d[5] != 15 && (x + 5) >= 0 && (x + 5)<320) p[5] = pal[ d[5] | c ]; + if (d[6] != 15 && (x + 6) >= 0 && (x + 6)<320) p[6] = pal[ d[6] | c ]; + if (d[7] != 15 && (x + 7) >= 0 && (x + 7)<320) p[7] = pal[ d[7] | c ]; + } + d += 8; + p += 320; + } + + } + + } +} + +static INT32 DrvDraw() +{ + // background 1 + TileBackground_1(RamBg1V, RamCurPal); + + aerofgt_drawsprites(0); + aerofgt_drawsprites(1); + + // background 2 + TileBackground_2(RamBg2V, RamCurPal + 256); + + aerofgt_drawsprites(2); + aerofgt_drawsprites(3); + + return 0; +} + +static INT32 DrvFrame() +{ + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x00; // Joy1 + DrvInput[1] = 0x00; // Joy2 + DrvInput[2] = 0x00; // Buttons + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[2] |= (DrvButton[i] & 1) << i; + } + + SekNewFrame(); + ZetNewFrame(); + + nCyclesTotal[0] = 10000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + +// SekSetCyclesScanline(nCyclesTotal[0] / 262); + + SekOpen(0); + ZetOpen(0); + + SekRun(nCyclesTotal[0]); + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + + ZetClose(); + SekClose(); + + if (pBurnDraw) DrvDraw(); + + return 0; +} + + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029671; + } + + if (nAction & ACB_MEMORY_ROM) { // Scan all memory, devices & variables + // + } + + if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + if (nAction & ACB_WRITE) { + // update palette while loaded + UINT16* ps = (UINT16*) RamPal; + UINT16* pd = RamCurPal; + for (INT32 i=0; i<1024; i++, ps++, pd++) + *pd = CalcCol(*ps); + } + } + + if (nAction & ACB_DRIVER_DATA) { + + SekScan(nAction); // Scan 68000 state + + ZetOpen(0); + ZetScan(nAction); // Scan Z80 state + ZetClose(); + + SCAN_VAR(RamGfxBank); + SCAN_VAR(DrvInput); + + BurnYM2610Scan(nAction, pnMin); + SCAN_VAR(nSoundlatch); + SCAN_VAR(nAerofgtZ80Bank); + + if (nAction & ACB_WRITE) { + INT32 nBank = nAerofgtZ80Bank; + nAerofgtZ80Bank = -1; + aerofgtSndBankSwitch(nBank); + } + } + return 0; +} + +struct BurnDriver BurnDrvAerofgt = { + "aerofgt", NULL, NULL, NULL, "1992", + "Aero Fighters\0", NULL, "Video System Co.", "Video System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, FBF_SONICWI, + NULL, aerofgtRomInfo, aerofgtRomName, NULL, NULL, aerofgtInputInfo, aerofgtDIPInfo, + aerofgtInit,DrvExit,DrvFrame,DrvDraw,DrvScan, + NULL, 0x800, 224,320,3,4 +}; + +// ------------------------------------------------------ + +static struct BurnInputInfo turbofrcInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 2, "p1 start"}, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 3, "p2 start"}, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + + {"P3 Coin", BIT_DIGITAL, DrvButton + 7, "p3 start"}, + {"P3 Start", BIT_DIGITAL, DrvJoy3 + 7, "p3 start"}, + {"P3 Up", BIT_DIGITAL, DrvJoy3 + 0, "p3 up"}, + {"P3 Down", BIT_DIGITAL, DrvJoy3 + 1, "p3 down"}, + {"P3 Left", BIT_DIGITAL, DrvJoy3 + 2, "p3 left"}, + {"P3 Right", BIT_DIGITAL, DrvJoy3 + 3, "p3 right"}, + {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 4, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 5, "dip"}, +}; + +STDINPUTINFO(turbofrc) + +static struct BurnDIPInfo turbofrcDIPList[] = { + + // Defaults + {0x16, 0xFF, 0xFF, 0x00, NULL}, + {0x17, 0xFF, 0xFF, 0x06, NULL}, + + // DIP 1 + {0, 0xFE, 0, 8, "Coin 1"}, + {0x16, 0x01, 0x07, 0x00, "1 coins 1 credit"}, + {0x16, 0x01, 0x07, 0x01, "2 coins 1 credit"}, + {0x16, 0x01, 0x07, 0x02, "3 coins 1 credit"}, + {0x16, 0x01, 0x07, 0x03, "4 coins 1 credit"}, + {0x16, 0x01, 0x07, 0x04, "1 coin 2 credits"}, + {0x16, 0x01, 0x07, 0x05, "1 coin 3 credits"}, + {0x16, 0x01, 0x07, 0x06, "1 coin 5 credits"}, + {0x16, 0x01, 0x07, 0x07, "1 coin 6 credits"}, + {0, 0xFE, 0, 2, "2 Coins to Start, 1 to Continue"}, + {0x16, 0x01, 0x08, 0x00, "Off"}, + {0x16, 0x01, 0x08, 0x08, "On"}, + {0, 0xFE, 0, 2, "Coin Slot"}, + {0x16, 0x01, 0x10, 0x00, "Same"}, + {0x16, 0x01, 0x10, 0x10, "Individual"}, + {0, 0xFE, 0, 2, "Play Mode"}, + {0x16, 0x01, 0x20, 0x00, "2 Players"}, + {0x16, 0x01, 0x20, 0x20, "3 Players"}, + {0, 0xFE, 0, 2, "Demo_Sounds"}, + {0x16, 0x01, 0x40, 0x00, "Off"}, + {0x16, 0x01, 0x40, 0x40, "On"}, + {0, 0xFE, 0, 2, "Service"}, + {0x16, 0x01, 0x80, 0x00, "Off"}, + {0x16, 0x01, 0x80, 0x80, "On"}, + + // DIP 2 + {0, 0xFE, 0, 2, "Screen flip"}, + {0x17, 0x01, 0x01, 0x00, "Off"}, + {0x17, 0x01, 0x01, 0x01, "On"}, + {0, 0xFE, 0, 8, "Difficulty"}, + {0x17, 0x01, 0x0E, 0x00, "1 (Easiest)"}, + {0x17, 0x01, 0x0E, 0x02, "2"}, + {0x17, 0x01, 0x0E, 0x04, "3"}, + {0x17, 0x01, 0x0E, 0x06, "4 (Normal)"}, + {0x17, 0x01, 0x0E, 0x08, "5"}, + {0x17, 0x01, 0x0E, 0x0A, "6"}, + {0x17, 0x01, 0x0E, 0x0C, "7"}, + {0x17, 0x01, 0x0E, 0x0E, "8 (Hardest)"}, + {0, 0xFE, 0, 2, "Lives"}, + {0x17, 0x01, 0x10, 0x00, "3"}, + {0x17, 0x01, 0x10, 0x10, "2"}, + {0, 0xFE, 0, 2, "Bonus Life"}, + {0x17, 0x01, 0x20, 0x00, "300000"}, + {0x17, 0x01, 0x20, 0x20, "200000"}, + +}; + +STDDIPINFO(turbofrc) + +static struct BurnRomInfo turbofrcRomDesc[] = { + { "tfrc2.bin", 0x040000, 0x721300ee, BRF_ESS | BRF_PRG }, // 68000 code swapped + { "tfrc1.bin", 0x040000, 0x6cd5312b, BRF_ESS | BRF_PRG }, + { "tfrc3.bin", 0x040000, 0x63f50557, BRF_ESS | BRF_PRG }, + + { "tfrcu94.bin", 0x080000, 0xbaa53978, BRF_GRA }, // gfx1 + { "tfrcu95.bin", 0x020000, 0x71a6c573, BRF_GRA }, + + { "tfrcu105.bin", 0x080000, 0x4de4e59e, BRF_GRA }, // gfx2 + { "tfrcu106.bin", 0x020000, 0xc6479eb5, BRF_GRA }, + + { "tfrcu116.bin", 0x080000, 0xdf210f3b, BRF_GRA }, // gfx3 + { "tfrcu118.bin", 0x040000, 0xf61d1d79, BRF_GRA }, + { "tfrcu117.bin", 0x080000, 0xf70812fd, BRF_GRA }, + { "tfrcu119.bin", 0x040000, 0x474ea716, BRF_GRA }, + + { "tfrcu134.bin", 0x080000, 0x487330a2, BRF_GRA }, // gfx4 + { "tfrcu135.bin", 0x080000, 0x3a7e5b6d, BRF_GRA }, + + { "tfrcu166.bin", 0x020000, 0x2ca14a65, BRF_ESS | BRF_PRG }, // Sound CPU + + { "tfrcu180.bin", 0x020000, 0x39c7c7d5, BRF_SND }, // samples + { "tfrcu179.bin", 0x100000, 0x60ca0333, BRF_SND }, +}; + +STD_ROM_PICK(turbofrc) +STD_ROM_FN(turbofrc) + +UINT8 __fastcall turbofrcReadByte(UINT32 sekAddress) +{ + sekAddress &= 0x0FFFFF; + switch (sekAddress) { + case 0x0FF000: + return ~DrvInput[3]; + case 0x0FF001: + return ~DrvInput[0]; + case 0x0FF002: + return 0xFF; + case 0x0FF003: + return ~DrvInput[1]; + case 0x0FF004: + return ~DrvInput[5]; + case 0x0FF005: + return ~DrvInput[4]; + case 0x0FF007: + return pending_command; + case 0x0FF009: + return ~DrvInput[2]; +// default: +// printf("Attempt to read byte value of location %x\n", sekAddress); + } + return 0; +} + +/* +UINT16 __fastcall turbofrcReadWord(UINT32 sekAddress) +{ +// sekAddress &= 0x0FFFFF; +// switch (sekAddress) { + + +// default: +// printf("Attempt to read word value of location %x\n", sekAddress); +// } + return 0; +} +*/ + +void __fastcall turbofrcWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if (( sekAddress & 0x0FF000 ) == 0x0FE000) { + sekAddress &= 0x07FF; + RamPal[sekAddress^1] = byteValue; + // palette byte write at boot self-test only ?! + //if (sekAddress & 1) + // RamCurPal[sekAddress>>1] = CalcCol( *((UINT16 *)&RamPal[sekAddress & 0xFFE]) ); + return; + } + + sekAddress &= 0x0FFFFF; + + switch (sekAddress) { + + case 0x0FF00E: + pending_command = 1; + SoundCommand(byteValue); + break; +// default: +// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } +} + +void __fastcall turbofrcWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + if (( sekAddress & 0x0FF000 ) == 0x0FE000) { + sekAddress &= 0x07FE; + *((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue); + RamCurPal[sekAddress>>1] = CalcCol( wordValue ); + return; + } + + sekAddress &= 0x0FFFFF; + + switch (sekAddress) { + case 0x0FF002: + bg1scrolly = wordValue; + break; + case 0x0FF004: + bg2scrollx = wordValue; + break; + case 0x0FF006: + bg2scrolly = wordValue; + break; + + case 0x0FF008: + RamGfxBank[0] = (wordValue >> 0) & 0x0f; + RamGfxBank[1] = (wordValue >> 4) & 0x0f; + RamGfxBank[2] = (wordValue >> 8) & 0x0f; + RamGfxBank[3] = (wordValue >> 12) & 0x0f; + break; + case 0x0FF00A: + RamGfxBank[4] = (wordValue >> 0) & 0x0f; + RamGfxBank[5] = (wordValue >> 4) & 0x0f; + RamGfxBank[6] = (wordValue >> 8) & 0x0f; + RamGfxBank[7] = (wordValue >> 12) & 0x0f; + break; + case 0x0FF00C: + // NOP + break; +// default: +// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); + } +} + +UINT8 __fastcall turbofrcZ80PortRead(UINT16 p) +{ + switch (p & 0xFF) { + case 0x14: + return nSoundlatch; + case 0x18: + return BurnYM2610Read(0); + case 0x1A: + return BurnYM2610Read(2); +// default: +// printf("Z80 Attempt to read port %04x\n", p); + } + return 0; +} + +void __fastcall turbofrcZ80PortWrite(UINT16 p, UINT8 v) +{ + switch (p & 0x0FF) { + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + BurnYM2610Write((p - 0x18) & 3, v); + break; + case 0x00: + aerofgtSndBankSwitch(v); + break; + case 0x14: + pending_command = 0; + break; +// default: +// printf("Z80 Attempt to write %02x to port %04x\n", v, p); + } +} + +static INT32 turbofrcMemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x0C0000; // 68000 ROM + RomZ80 = Next; Next += 0x030000; // Z80 ROM + + RomBg = Next; Next += 0x280040; // + DeRomBg = RomBg + 0x000040; + + RomSpr1 = Next; Next += 0x400000; // Sprite 1 + RomSpr2 = Next; Next += 0x200100; // Sprite 2 + + DeRomSpr1 = RomSpr1 + 0x000100; + DeRomSpr2 = RomSpr2 += 0x000100; + + RomSnd1 = Next; Next += 0x020000; // ADPCM data + RomSndSize1 = 0x020000; + RomSnd2 = Next; Next += 0x100000; // ADPCM data + RomSndSize2 = 0x100000; + + RamStart = Next; + + RamBg1V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG1 Video Ram + RamBg2V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG2 Video Ram + RamSpr1 = (UINT16 *)Next; Next += 0x002000 * sizeof(UINT16); // Sprite 1 Ram + RamSpr2 = (UINT16 *)Next; Next += 0x002000 * sizeof(UINT16); // Sprite 2 Ram + RamSpr3 = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // Sprite 3 Ram + RamRaster = (UINT16 *)Next; Next += 0x000800 * sizeof(UINT16); // Raster Ram + + RamSpr1SizeMask = 0x1FFF; + RamSpr2SizeMask = 0x1FFF; + RomSpr1SizeMask = 0x3FFF; + RomSpr2SizeMask = 0x1FFF; + + Ram01 = Next; Next += 0x014000; // Work Ram + + RamPal = Next; Next += 0x000800; // 1024 of X1R5G5B5 Palette + RamZ80 = Next; Next += 0x000800; // Z80 Ram 2K + + RamEnd = Next; + + RamCurPal = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); + + MemEnd = Next; + return 0; +} + +static void pspikesDecodeBg(INT32 cnt) +{ + for (INT32 c=cnt-1; c>=0; c--) { + for (INT32 y=7; y>=0; y--) { + DeRomBg[(c * 64) + (y * 8) + 7] = RomBg[0x00003 + (y * 4) + (c * 32)] >> 4; + DeRomBg[(c * 64) + (y * 8) + 6] = RomBg[0x00003 + (y * 4) + (c * 32)] & 0x0f; + DeRomBg[(c * 64) + (y * 8) + 5] = RomBg[0x00002 + (y * 4) + (c * 32)] >> 4; + DeRomBg[(c * 64) + (y * 8) + 4] = RomBg[0x00002 + (y * 4) + (c * 32)] & 0x0f; + DeRomBg[(c * 64) + (y * 8) + 3] = RomBg[0x00001 + (y * 4) + (c * 32)] >> 4; + DeRomBg[(c * 64) + (y * 8) + 2] = RomBg[0x00001 + (y * 4) + (c * 32)] & 0x0f; + DeRomBg[(c * 64) + (y * 8) + 1] = RomBg[0x00000 + (y * 4) + (c * 32)] >> 4; + DeRomBg[(c * 64) + (y * 8) + 0] = RomBg[0x00000 + (y * 4) + (c * 32)] & 0x0f; + } + } +} + +static void pspikesDecodeSpr(UINT8 *d, UINT8 *s, INT32 cnt) +{ + for (INT32 c=cnt-1; c>=0; c--) + for (INT32 y=15; y>=0; y--) { + d[(c * 256) + (y * 16) + 15] = s[0x00007 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 14] = s[0x00007 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 13] = s[0x00005 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 12] = s[0x00005 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 11] = s[0x00006 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 10] = s[0x00006 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 9] = s[0x00004 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 8] = s[0x00004 + (y * 8) + (c * 128)] & 0x0f; + + d[(c * 256) + (y * 16) + 7] = s[0x00003 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 6] = s[0x00003 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 5] = s[0x00001 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 4] = s[0x00001 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 3] = s[0x00002 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 2] = s[0x00002 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 1] = s[0x00000 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 0] = s[0x00000 + (y * 8) + (c * 128)] & 0x0f; + } +} + + +static INT32 turbofrcInit() +{ + Mem = NULL; + turbofrcMemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + turbofrcMemIndex(); + + // Load 68000 ROM + if (BurnLoadRom(Rom01+0x00000, 0, 1)) return 1; + if (BurnLoadRom(Rom01+0x40000, 1, 1)) return 1; + if (BurnLoadRom(Rom01+0x80000, 2, 1)) return 1; + + // Load Graphic + BurnLoadRom(RomBg+0x000000, 3, 1); + BurnLoadRom(RomBg+0x080000, 4, 1); + BurnLoadRom(RomBg+0x0A0000, 5, 1); + BurnLoadRom(RomBg+0x120000, 6, 1); + pspikesDecodeBg(0x14000); + + BurnLoadRom(RomSpr1+0x000000, 7, 2); + BurnLoadRom(RomSpr1+0x000001, 9, 2); + BurnLoadRom(RomSpr1+0x100000, 8, 2); + BurnLoadRom(RomSpr1+0x100001, 10, 2); + BurnLoadRom(RomSpr1+0x200000, 11, 2); + BurnLoadRom(RomSpr1+0x200001, 12, 2); + pspikesDecodeSpr(DeRomSpr1, RomSpr1, 0x6000); + + // Load Z80 ROM + if (BurnLoadRom(RomZ80+0x10000, 13, 1)) return 1; + memcpy(RomZ80, RomZ80+0x10000, 0x10000); + + BurnLoadRom(RomSnd1, 14, 1); + BurnLoadRom(RomSnd2, 15, 1); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x0BFFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x0C0000, 0x0CFFFF, SM_RAM); // 64K Work RAM + SekMapMemory((UINT8 *)RamBg1V, + 0x0D0000, 0x0D1FFF, SM_RAM); + SekMapMemory((UINT8 *)RamBg2V, + 0x0D2000, 0x0D3FFF, SM_RAM); + SekMapMemory((UINT8 *)RamSpr1, + 0x0E0000, 0x0E3FFF, SM_RAM); + SekMapMemory((UINT8 *)RamSpr2, + 0x0E4000, 0x0E7FFF, SM_RAM); + SekMapMemory(Ram01+0x10000, 0x0F8000, 0x0FBFFF, SM_RAM); // Work RAM + SekMapMemory(Ram01+0x10000, 0xFF8000, 0xFFBFFF, SM_RAM); // Work RAM + SekMapMemory((UINT8 *)RamSpr3, + 0x0FC000, 0x0FC7FF, SM_RAM); + SekMapMemory((UINT8 *)RamSpr3, + 0xFFC000, 0xFFC7FF, SM_RAM); + SekMapMemory((UINT8 *)RamRaster, + 0x0FD000, 0x0FDFFF, SM_RAM); + SekMapMemory((UINT8 *)RamRaster, + 0xFFD000, 0xFFDFFF, SM_RAM); + SekMapMemory(RamPal, 0x0FE000, 0x0FE7FF, SM_ROM); // Palette + +// SekSetReadWordHandler(0, turbofrcReadWord); + SekSetReadByteHandler(0, turbofrcReadByte); + SekSetWriteWordHandler(0, turbofrcWriteWord); + SekSetWriteByteHandler(0, turbofrcWriteByte); + + SekClose(); + } + + { + ZetInit(0); + ZetOpen(0); + + ZetMapArea(0x0000, 0x77FF, 0, RomZ80); + ZetMapArea(0x0000, 0x77FF, 2, RomZ80); + + ZetMapArea(0x7800, 0x7FFF, 0, RamZ80); + ZetMapArea(0x7800, 0x7FFF, 1, RamZ80); + ZetMapArea(0x7800, 0x7FFF, 2, RamZ80); + + + ZetSetInHandler(turbofrcZ80PortRead); + ZetSetOutHandler(turbofrcZ80PortWrite); + + ZetClose(); + } + + BurnYM2610Init(8000000, RomSnd2, &RomSndSize2, RomSnd1, &RomSndSize1, &aerofgtFMIRQHandler, aerofgtSynchroniseStream, aerofgtGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static void turbofrcTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) +{ + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 64*64; offs++) { + mx++; + if (mx == 64) { + mx = 0; + my++; + } + + x = mx * 8 - (BURN_ENDIAN_SWAP_INT16(RamRaster[7]) & 0x1FF) - 11; + if (x <= (352-512)) x += 512; + + y = my * 8 - (bg1scrolly & 0x1FF) - 2; + if (y <= (240-512)) y += 512; + + if ( x<=-8 || x>=352 || y<=-8 || y>= 240 ) + continue; + + else + if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; + + for (INT32 k=0;k<8;k++) { + p[0] = pal[ d[0] | c ]; + p[1] = pal[ d[1] | c ]; + p[2] = pal[ d[2] | c ]; + p[3] = pal[ d[3] | c ]; + p[4] = pal[ d[4] | c ]; + p[5] = pal[ d[5] | c ]; + p[6] = pal[ d[6] | c ]; + p[7] = pal[ d[7] | c ]; + + d += 8; + p += 352; + } + } else { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; + + for (INT32 k=0;k<8;k++) { + if ( (y+k)>=0 && (y+k)<240 ) { + if ((x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; + if ((x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; + if ((x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; + if ((x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; + if ((x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; + if ((x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; + if ((x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; + if ((x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; + } + d += 8; + p += 352; + } + + } + + } +} + +static void turbofrcTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) +{ + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 64*64; offs++) { + mx++; + if (mx == 64) { + mx = 0; + my++; + } + + x = mx * 8 - (bg2scrollx & 0x1FF) + 7; + if (x <= (352-512)) x += 512; + + y = my * 8 - (bg2scrolly & 0x1FF) - 2; + if (y <= (240-512)) y += 512; + + if ( x<=-8 || x>=352 || y<=-8 || y>= 240 ) + continue; + else + if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; + + for (INT32 k=0;k<8;k++) { + + if (d[0] != 15) p[0] = pal[ d[0] | c ]; + if (d[1] != 15) p[1] = pal[ d[1] | c ]; + if (d[2] != 15) p[2] = pal[ d[2] | c ]; + if (d[3] != 15) p[3] = pal[ d[3] | c ]; + if (d[4] != 15) p[4] = pal[ d[4] | c ]; + if (d[5] != 15) p[5] = pal[ d[5] | c ]; + if (d[6] != 15) p[6] = pal[ d[6] | c ]; + if (d[7] != 15) p[7] = pal[ d[7] | c ]; + + d += 8; + p += 352; + } + } else { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; + + for (INT32 k=0;k<8;k++) { + if ( (y+k)>=0 && (y+k)<240 ) { + if (d[0] != 15 && (x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; + if (d[1] != 15 && (x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; + if (d[2] != 15 && (x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; + if (d[3] != 15 && (x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; + if (d[4] != 15 && (x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; + if (d[5] != 15 && (x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; + if (d[6] != 15 && (x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; + if (d[7] != 15 && (x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; + } + d += 8; + p += 352; + } + + } + + } +} + +static void pdrawgfxzoom(INT32 bank,UINT32 code,UINT32 color,INT32 flipx,INT32 flipy,INT32 sx,INT32 sy,INT32 scalex,INT32 scaley) +{ + if (!scalex || !scaley) return; + + UINT16 * p = (UINT16 *) pBurnDraw; + UINT8 * q; + UINT16 * pal; + + if (bank) { + //if (code > RomSpr2SizeMask) + code &= RomSpr2SizeMask; + q = DeRomSpr2 + (code) * 256; + pal = RamCurPal + 768; + } else { + //if (code > RomSpr1SizeMask) + code &= RomSpr1SizeMask; + q = DeRomSpr1 + (code) * 256; + pal = RamCurPal + 512; + } + + p += sy * 352 + sx; + + if (sx < 0 || sx >= (352-16) || sy < 0 || sy >= (240-16) ) { + + if ((sx <= -16) || (sx >= 352) || (sy <= -16) || (sy >= 240)) + return; + + if (flipy) { + + p += 352 * 15; + + if (flipx) { + + for (INT32 i=15;i>=0;i--) { + if (((sy+i)>=0) && ((sy+i)<240)) { + if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<352)) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<352)) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<352)) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<352)) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<352)) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<352)) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<352)) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<352)) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<352)) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<352)) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<352)) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<352)) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<352)) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<352)) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<352)) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<352)) p[ 0] = pal[ q[15] | color]; + } + p -= 352; + q += 16; + } + + } else { + + for (INT32 i=15;i>=0;i--) { + if (((sy+i)>=0) && ((sy+i)<240)) { + if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<352)) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<352)) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<352)) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<352)) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<352)) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<352)) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<352)) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<352)) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<352)) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<352)) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<352)) p[10] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<352)) p[11] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<352)) p[12] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<352)) p[13] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<352)) p[14] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<352)) p[15] = pal[ q[15] | color]; + } + p -= 352; + q += 16; + } + } + + } else { + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + if (((sy+i)>=0) && ((sy+i)<240)) { + if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<352)) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<352)) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<352)) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<352)) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<352)) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<352)) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<352)) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<352)) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<352)) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<352)) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<352)) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<352)) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<352)) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<352)) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<352)) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<352)) p[ 0] = pal[ q[15] | color]; + } + p += 352; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + if (((sy+i)>=0) && ((sy+i)<240)) { + if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<352)) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<352)) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<352)) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<352)) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<352)) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<352)) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<352)) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<352)) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<352)) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<352)) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<352)) p[10] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<352)) p[11] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<352)) p[12] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<352)) p[13] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<352)) p[14] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<352)) p[15] = pal[ q[15] | color]; + } + p += 352; + q += 16; + } + + } + + } + + return; + } + + if (flipy) { + + p += 352 * 15; + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15) p[ 0] = pal[ q[15] | color]; + + p -= 352; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15) p[10] = pal[ q[10] | color]; + if (q[11] != 15) p[11] = pal[ q[11] | color]; + if (q[12] != 15) p[12] = pal[ q[12] | color]; + if (q[13] != 15) p[13] = pal[ q[13] | color]; + if (q[14] != 15) p[14] = pal[ q[14] | color]; + if (q[15] != 15) p[15] = pal[ q[15] | color]; + + p -= 352; + q += 16; + } + } + + } else { + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15) p[ 0] = pal[ q[15] | color]; + + p += 352; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15) p[10] = pal[ q[10] | color]; + if (q[11] != 15) p[11] = pal[ q[11] | color]; + if (q[12] != 15) p[12] = pal[ q[12] | color]; + if (q[13] != 15) p[13] = pal[ q[13] | color]; + if (q[14] != 15) p[14] = pal[ q[14] | color]; + if (q[15] != 15) p[15] = pal[ q[15] | color]; + + p += 352; + q += 16; + } + + } + + } + +} + +static void turbofrc_drawsprites(INT32 chip,INT32 chip_disabled_pri) +{ + INT32 attr_start,base,first; + + base = chip * 0x0200; + first = 4 * BURN_ENDIAN_SWAP_INT16(RamSpr3[0x1fe + base]); + + //for (attr_start = base + 0x0200-8;attr_start >= first + base;attr_start -= 4) { + for (attr_start = first + base; attr_start <= base + 0x0200-8; attr_start += 4) { + INT32 map_start; + INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color,pri; +// some other drivers still use this wrong table, they have to be upgraded +// INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; + + if (!(BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0080)) continue; + pri = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0010; + if ( chip_disabled_pri & !pri) continue; + if (!chip_disabled_pri & (pri>>4)) continue; + ox = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0x01ff; + xsize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0700) >> 8; + zoomx = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0xf000) >> 12; + oy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0x01ff; + ysize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x7000) >> 12; + zoomy = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0xf000) >> 12; + flipx = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0800; + flipy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x8000; + color = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x000f) << 4; // + 16 * spritepalettebank; + + map_start = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 3]); + +// aerofgt has this adjustment, but doing it here would break turbo force title screen +// ox += (xsize*zoomx+2)/4; +// oy += (ysize*zoomy+2)/4; + + zoomx = 32 - zoomx; + zoomy = 32 - zoomy; + + for (y = 0;y <= ysize;y++) { + INT32 sx,sy; + + if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16; + else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16; + + for (x = 0;x <= xsize;x++) { + INT32 code; + + if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16 - 8; + else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16 - 8; + + if (chip == 0) code = BURN_ENDIAN_SWAP_INT16(RamSpr1[map_start & RamSpr1SizeMask]); + else code = BURN_ENDIAN_SWAP_INT16(RamSpr2[map_start & RamSpr2SizeMask]); + + pdrawgfxzoom(chip,code,color,flipx,flipy,sx,sy,zoomx << 11, zoomy << 11); + + map_start++; + } + + if (xsize == 2) map_start += 1; + if (xsize == 4) map_start += 3; + if (xsize == 5) map_start += 2; + if (xsize == 6) map_start += 1; + } + } +} + +static INT32 turbofrcDraw() +{ + turbofrcTileBackground_1(RamBg1V, DeRomBg, RamCurPal); + turbofrcTileBackground_2(RamBg2V, DeRomBg + 0x140000, RamCurPal + 256); + +/* + // we use the priority buffer so sprites are drawn front to back + turbofrc_drawsprites(0,-1); //enemy + turbofrc_drawsprites(0, 0); //enemy + turbofrc_drawsprites(1,-1); //ship + turbofrc_drawsprites(1, 0); //intro +*/ + // in MAME it use a pri-buf control render to draw sprites from front to back + // i'm not use it, is right ??? + + turbofrc_drawsprites(0, 0); + turbofrc_drawsprites(0,-1); + turbofrc_drawsprites(1, 0); + turbofrc_drawsprites(1,-1); + + return 0; +} + +static INT32 turbofrcFrame() +{ + if (DrvReset) DrvDoReset(); + + // Compile digital inputs + // Compile digital inputs + DrvInput[0] = 0x00; // Joy1 + DrvInput[1] = 0x00; // Joy2 + DrvInput[2] = 0x00; // Joy3 + DrvInput[3] = 0x00; // Buttons + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[2] |= (DrvJoy3[i] & 1) << i; + DrvInput[3] |= (DrvButton[i] & 1) << i; + } + + SekNewFrame(); + ZetNewFrame(); + + nCyclesTotal[0] = 10000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + + SekOpen(0); + ZetOpen(0); + + SekRun(nCyclesTotal[0]); + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + + ZetClose(); + SekClose(); + + if (pBurnDraw) turbofrcDraw(); + + return 0; +} + +struct BurnDriver BurnDrvTurbofrc = { + "turbofrc", NULL, NULL, NULL, "1991", + "Turbo Force\0", NULL, "Video System Co.", "Video System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 3, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, turbofrcRomInfo, turbofrcRomName, NULL, NULL, turbofrcInputInfo, turbofrcDIPInfo, + turbofrcInit,DrvExit,turbofrcFrame,turbofrcDraw,DrvScan, + NULL, 0x800,240,352,3,4 +}; + + +// ------------------------------------------------------------ + +static struct BurnInputInfo karatblzInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 2, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 4"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 3, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 4"}, + + {"P3 Coin", BIT_DIGITAL, DrvButton + 4, "p3 coin"}, + {"P3 Start", BIT_DIGITAL, DrvButton + 6, "p3 start"}, + + {"P3 Up", BIT_DIGITAL, DrvJoy3 + 0, "p3 up"}, + {"P3 Down", BIT_DIGITAL, DrvJoy3 + 1, "p3 down"}, + {"P3 Left", BIT_DIGITAL, DrvJoy3 + 2, "p3 left"}, + {"P3 Right", BIT_DIGITAL, DrvJoy3 + 3, "p3 right"}, + {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1"}, + {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2"}, + {"P3 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p3 fire 3"}, + {"P3 Button 4", BIT_DIGITAL, DrvJoy3 + 7, "p3 fire 4"}, + + {"P4 Coin", BIT_DIGITAL, DrvButton + 5, "p4 coin"}, + {"P4 Start", BIT_DIGITAL, DrvButton + 7, "p4 start"}, + + {"P4 Up", BIT_DIGITAL, DrvJoy4 + 0, "p4 up"}, + {"P4 Down", BIT_DIGITAL, DrvJoy4 + 1, "p4 down"}, + {"P4 Left", BIT_DIGITAL, DrvJoy4 + 2, "p4 left"}, + {"P4 Right", BIT_DIGITAL, DrvJoy4 + 3, "p4 right"}, + {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p4 fire 1"}, + {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p4 fire 2"}, + {"P4 Button 3", BIT_DIGITAL, DrvJoy4 + 6, "p4 fire 3"}, + {"P4 Button 4", BIT_DIGITAL, DrvJoy4 + 7, "p4 fire 4"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 6, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 7, "dip"}, +}; + +STDINPUTINFO(karatblz) + +static struct BurnDIPInfo karatblzDIPList[] = { + + // Defaults + {0x29, 0xFF, 0xFF, 0x00, NULL}, + {0x2A, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 8, "Coinage"}, + {0x29, 0x01, 0x07, 0x00, "1 coin 1 credit"}, + {0x29, 0x01, 0x07, 0x01, "2 coins 1 credit"}, + {0x29, 0x01, 0x07, 0x02, "3 coins 1 credit"}, + {0x29, 0x01, 0x07, 0x03, "4 coins 1 credit"}, + {0x29, 0x01, 0x07, 0x04, "1 coin 2 credit"}, + {0x29, 0x01, 0x07, 0x05, "1 coin 3 credit"}, + {0x29, 0x01, 0x07, 0x06, "1 coin 5 credit"}, + {0x29, 0x01, 0x07, 0x07, "1 coin 6 credit"}, + {0, 0xFE, 0, 2, "2 Coins to Start, 1 to Continue"}, + {0x29, 0x01, 0x08, 0x00, "Off"}, + {0x29, 0x01, 0x08, 0x08, "On"}, + {0, 0xFE, 0, 2, "Lives"}, + {0x29, 0x01, 0x10, 0x00, "2"}, + {0x29, 0x01, 0x10, 0x10, "1"}, + {0, 0xFE, 0, 4, "Cabinet"}, + {0x29, 0x01, 0x60, 0x00, "2 Players"}, + {0x29, 0x01, 0x60, 0x20, "3 Players"}, + {0x29, 0x01, 0x60, 0x40, "4 Players"}, + {0x29, 0x01, 0x60, 0x60, "4 Players (Team)"}, + {0, 0xFE, 0, 2, "Coin Slot"}, + {0x29, 0x01, 0x80, 0x00, "Same"}, + {0x29, 0x01, 0x80, 0x80, "Individual"}, + + // DIP 2 + {0, 0xFE, 0, 2, "Unknown"}, + {0x2A, 0x01, 0x01, 0x00, "Off"}, + {0x2A, 0x01, 0x01, 0x01, "On"}, + {0, 0xFE, 0, 4, "Number of Enemies"}, + {0x2A, 0x01, 0x06, 0x00, "Normal"}, + {0x2A, 0x01, 0x06, 0x02, "Easy"}, + {0x2A, 0x01, 0x06, 0x04, "Hard"}, + {0x2A, 0x01, 0x06, 0x06, "Hardest"}, + {0, 0xFE, 0, 4, "Strength of Enemies"}, + {0x2A, 0x01, 0x18, 0x00, "Normal"}, + {0x2A, 0x01, 0x18, 0x08, "Easy"}, + {0x2A, 0x01, 0x18, 0x10, "Hard"}, + {0x2A, 0x01, 0x18, 0x18, "Hardest"}, + {0, 0xFE, 0, 2, "Freeze"}, + {0x2A, 0x01, 0x20, 0x00, "Off"}, + {0x2A, 0x01, 0x20, 0x20, "On"}, + {0, 0xFE, 0, 2, "Demo sound"}, + {0x2A, 0x01, 0x40, 0x00, "Off"}, + {0x2A, 0x01, 0x40, 0x40, "On"}, + {0, 0xFE, 0, 2, "Flip Screen"}, + {0x2A, 0x01, 0x80, 0x00, "Off"}, + {0x2A, 0x01, 0x80, 0x80, "On"}, +}; + +STDDIPINFO(karatblz) + +static struct BurnRomInfo karatblzRomDesc[] = { + { "rom2v3", 0x040000, 0x01f772e1, BRF_ESS | BRF_PRG }, // 68000 code swapped + { "1.u15", 0x040000, 0xd16ee21b, BRF_ESS | BRF_PRG }, + + { "gha.u55", 0x080000, 0x3e0cea91, BRF_GRA }, // gfx1 + { "gh9.u61", 0x080000, 0x5d1676bd, BRF_GRA }, // gfx2 + + { "u42", 0x100000, 0x65f0da84, BRF_GRA }, // gfx3 + { "3.u44", 0x020000, 0x34bdead2, BRF_GRA }, + { "u43", 0x100000, 0x7b349e5d, BRF_GRA }, + { "4.u45", 0x020000, 0xbe4d487d, BRF_GRA }, + + { "u59.ghb", 0x080000, 0x158c9cde, BRF_GRA }, // gfx4 + { "ghd.u60", 0x080000, 0x73180ae3, BRF_GRA }, + + { "5.u92", 0x020000, 0x97d67510, BRF_ESS | BRF_PRG }, // Sound CPU + + { "u105.gh8", 0x080000, 0x7a68cb1b, BRF_SND }, // samples + { "u104", 0x100000, 0x5795e884, BRF_SND }, +}; + +STD_ROM_PICK(karatblz) +STD_ROM_FN(karatblz) + +static struct BurnRomInfo karatbluRomDesc[] = { + { "2.u14", 0x040000, 0x202e6220, BRF_ESS | BRF_PRG }, // 68000 code swapped + { "1.u15", 0x040000, 0xd16ee21b, BRF_ESS | BRF_PRG }, + + { "gha.u55", 0x080000, 0x3e0cea91, BRF_GRA }, // gfx1 + { "gh9.u61", 0x080000, 0x5d1676bd, BRF_GRA }, // gfx2 + + { "u42", 0x100000, 0x65f0da84, BRF_GRA }, // gfx3 + { "3.u44", 0x020000, 0x34bdead2, BRF_GRA }, + { "u43", 0x100000, 0x7b349e5d, BRF_GRA }, + { "4.u45", 0x020000, 0xbe4d487d, BRF_GRA }, + + { "u59.ghb", 0x080000, 0x158c9cde, BRF_GRA }, // gfx4 + { "ghd.u60", 0x080000, 0x73180ae3, BRF_GRA }, + + { "5.u92", 0x020000, 0x97d67510, BRF_ESS | BRF_PRG }, // Sound CPU + + { "u105.gh8", 0x080000, 0x7a68cb1b, BRF_SND }, // samples + { "u104", 0x100000, 0x5795e884, BRF_SND }, +}; + +STD_ROM_PICK(karatblu) +STD_ROM_FN(karatblu) + +static struct BurnRomInfo karatbljRomDesc[] = { + { "2tecmo.u14", 0x040000, 0x57e52654, BRF_ESS | BRF_PRG }, // 68000 code swapped + { "1.u15", 0x040000, 0xd16ee21b, BRF_ESS | BRF_PRG }, + + { "gha.u55", 0x080000, 0x3e0cea91, BRF_GRA }, // gfx1 + { "gh9.u61", 0x080000, 0x5d1676bd, BRF_GRA }, // gfx2 + + { "u42", 0x100000, 0x65f0da84, BRF_GRA }, // gfx3 + { "3.u44", 0x020000, 0x34bdead2, BRF_GRA }, + { "u43", 0x100000, 0x7b349e5d, BRF_GRA }, + { "4.u45", 0x020000, 0xbe4d487d, BRF_GRA }, + + { "u59.ghb", 0x080000, 0x158c9cde, BRF_GRA }, // gfx4 + { "ghd.u60", 0x080000, 0x73180ae3, BRF_GRA }, + + { "5.u92", 0x020000, 0x97d67510, BRF_ESS | BRF_PRG }, // Sound CPU + + { "u105.gh8", 0x080000, 0x7a68cb1b, BRF_SND }, // samples + { "u104", 0x100000, 0x5795e884, BRF_SND }, +}; + +STD_ROM_PICK(karatblj) +STD_ROM_FN(karatblj) + +UINT8 __fastcall karatblzReadByte(UINT32 sekAddress) +{ + sekAddress &= 0x0FFFFF; + + switch (sekAddress) { + case 0x0FF000: + return ~DrvInput[4]; + case 0x0FF001: + return ~DrvInput[0]; + case 0x0FF002: + return 0xFF; + case 0x0FF003: + return ~DrvInput[1]; + case 0x0FF004: + return ~DrvInput[5]; + case 0x0FF005: + return ~DrvInput[2]; + case 0x0FF006: + return 0xFF; + case 0x0FF007: + return ~DrvInput[3]; + case 0x0FF008: + return ~DrvInput[7]; + case 0x0FF009: + return ~DrvInput[6]; + case 0x0FF00B: + return pending_command; + +// default: +// printf("Attempt to read byte value of location %x\n", sekAddress); + } + return 0; +} + +/* +UINT16 __fastcall karatblzReadWord(UINT32 sekAddress) +{ + sekAddress &= 0x0FFFFF; + + switch (sekAddress) { + + + default: + printf("Attempt to read word value of location %x\n", sekAddress); + } + return 0; +} +*/ + +void __fastcall karatblzWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + sekAddress &= 0x0FFFFF; + + switch (sekAddress) { + case 0x0FF000: + case 0x0FF401: + case 0x0FF403: + + break; + + case 0x0FF002: + //if (ACCESSING_MSB) { + // setbank(bg1_tilemap,0,(data & 0x0100) >> 8); + // setbank(bg2_tilemap,1,(data & 0x0800) >> 11); + //} + RamGfxBank[0] = (byteValue & 0x1); + RamGfxBank[1] = (byteValue & 0x8) >> 3; + break; + case 0x0FF007: + pending_command = 1; + SoundCommand(byteValue); + break; +// default: +// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } +} + +void __fastcall karatblzWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + if (( sekAddress & 0x0FF000 ) == 0x0FE000) { + sekAddress &= 0x07FF; + *((UINT16 *)&RamPal[sekAddress]) = wordValue; + RamCurPal[sekAddress>>1] = CalcCol( wordValue ); + return; + } + + sekAddress &= 0x0FFFFF; + + + switch (sekAddress) { + case 0x0ff008: + bg1scrollx = wordValue; + break; + case 0x0ff00A: + bg1scrolly = wordValue; + break; + case 0x0ff00C: + bg2scrollx = wordValue; + break; + case 0x0ff00E: + bg2scrolly = wordValue; + break; +// default: +// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); + } +} + +static INT32 karatblzMemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x080000; // 68000 ROM + RomZ80 = Next; Next += 0x030000; // Z80 ROM + + RomBg = Next; Next += 0x200040; // Background, 1M 8x8x4bit decode to 2M + 64Byte safe + DeRomBg = RomBg + 0x000040; + + RomSpr1 = Next; Next += 0x800000; // Sprite 1 , 1M 16x16x4bit decode to 2M + 256Byte safe + RomSpr2 = Next; Next += 0x200100; // Sprite 2 + + DeRomSpr1 = RomSpr1 + 0x000100; + DeRomSpr2 = RomSpr2 += 0x000100; + + RomSnd1 = Next; Next += 0x080000; // ADPCM data + RomSndSize1 = 0x080000; + RomSnd2 = Next; Next += 0x100000; // ADPCM data + RomSndSize2 = 0x100000; + + RamStart = Next; + + RamBg1V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG1 Video Ram + RamBg2V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG2 Video Ram + RamSpr1 = (UINT16 *)Next; Next += 0x008000 * sizeof(UINT16); // Sprite 1 Ram + RamSpr2 = (UINT16 *)Next; Next += 0x008000 * sizeof(UINT16); // Sprite 2 Ram + RamSpr3 = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // Sprite 3 Ram + Ram01 = Next; Next += 0x014000; // Work Ram 1 + Work Ram 1 + RamPal = Next; Next += 0x000800; // 1024 of X1R5G5B5 Palette + RamZ80 = Next; Next += 0x000800; // Z80 Ram 2K + + RamSpr1SizeMask = 0x7FFF; + RamSpr2SizeMask = 0x7FFF; + RomSpr1SizeMask = 0x7FFF; + RomSpr2SizeMask = 0x1FFF; + + RamEnd = Next; + + RamCurPal = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); + + MemEnd = Next; + return 0; +} + +static INT32 karatblzInit() +{ + Mem = NULL; + karatblzMemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + karatblzMemIndex(); + + // Load 68000 ROM + if (BurnLoadRom(Rom01+0x00000, 0, 1)) return 1; + if (BurnLoadRom(Rom01+0x40000, 1, 1)) return 1; + + // Load Graphic + BurnLoadRom(RomBg+0x00000, 2, 1); + BurnLoadRom(RomBg+0x80000, 3, 1); + pspikesDecodeBg(0x10000); + + BurnLoadRom(RomSpr1+0x000000, 4, 2); + BurnLoadRom(RomSpr1+0x000001, 6, 2); + BurnLoadRom(RomSpr1+0x200000, 5, 2); + BurnLoadRom(RomSpr1+0x200001, 7, 2); + BurnLoadRom(RomSpr1+0x400000, 8, 2); + BurnLoadRom(RomSpr1+0x400001, 9, 2); + pspikesDecodeSpr(DeRomSpr1, RomSpr1, 0xA000); + + // Load Z80 ROM + if (BurnLoadRom(RomZ80+0x10000, 10, 1)) return 1; + memcpy(RomZ80, RomZ80+0x10000, 0x10000); + + BurnLoadRom(RomSnd1, 11, 1); + BurnLoadRom(RomSnd2, 12, 1); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM + SekMapMemory((UINT8 *)RamBg1V, + 0x080000, 0x081FFF, SM_RAM); + SekMapMemory((UINT8 *)RamBg2V, + 0x082000, 0x083FFF, SM_RAM); + SekMapMemory((UINT8 *)RamSpr1, + 0x0A0000, 0x0AFFFF, SM_RAM); + SekMapMemory((UINT8 *)RamSpr2, + 0x0B0000, 0x0BFFFF, SM_RAM); + SekMapMemory(Ram01, 0x0C0000, 0x0CFFFF, SM_RAM); // 64K Work RAM + SekMapMemory(Ram01+0x10000, 0x0F8000, 0x0FBFFF, SM_RAM); // Work RAM + SekMapMemory(Ram01+0x10000, 0xFF8000, 0xFFBFFF, SM_RAM); // Work RAM + SekMapMemory((UINT8 *)RamSpr3, + 0x0FC000, 0x0FC7FF, SM_RAM); + SekMapMemory(RamPal, 0x0FE000, 0x0FE7FF, SM_ROM); // Palette + +// SekSetReadWordHandler(0, karatblzReadWord); + SekSetReadByteHandler(0, karatblzReadByte); + SekSetWriteWordHandler(0, karatblzWriteWord); + SekSetWriteByteHandler(0, karatblzWriteByte); + + SekClose(); + } + + { + ZetInit(0); + ZetOpen(0); + + ZetMapArea(0x0000, 0x77FF, 0, RomZ80); + ZetMapArea(0x0000, 0x77FF, 2, RomZ80); + + ZetMapArea(0x7800, 0x7FFF, 0, RamZ80); + ZetMapArea(0x7800, 0x7FFF, 1, RamZ80); + ZetMapArea(0x7800, 0x7FFF, 2, RamZ80); + + + ZetSetInHandler(turbofrcZ80PortRead); + ZetSetOutHandler(turbofrcZ80PortWrite); + + ZetClose(); + } + + BurnYM2610Init(8000000, RomSnd2, &RomSndSize2, RomSnd1, &RomSndSize1, &aerofgtFMIRQHandler, aerofgtSynchroniseStream, aerofgtGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static void karatblzTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) +{ + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 64*64; offs++) { + mx++; + if (mx == 64) { + mx = 0; + my++; + } + + x = mx * 8 - (((INT16)bg1scrollx + 8)& 0x1FF); + if (x <= (352-512)) x += 512; + + y = my * 8 - (bg1scrolly & 0x1FF); + if (y <= (240-512)) y += 512; + + if ( x<=-8 || x>=352 || y<=-8 || y>= 240 ) + continue; + + else + if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[0] << 13 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; + + for (INT32 k=0;k<8;k++) { + p[0] = pal[ d[0] | c ]; + p[1] = pal[ d[1] | c ]; + p[2] = pal[ d[2] | c ]; + p[3] = pal[ d[3] | c ]; + p[4] = pal[ d[4] | c ]; + p[5] = pal[ d[5] | c ]; + p[6] = pal[ d[6] | c ]; + p[7] = pal[ d[7] | c ]; + + d += 8; + p += 352; + } + } else { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[0] << 13 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; + + for (INT32 k=0;k<8;k++) { + if ( (y+k)>=0 && (y+k)<240 ) { + if ((x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; + if ((x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; + if ((x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; + if ((x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; + if ((x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; + if ((x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; + if ((x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; + if ((x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; + } + d += 8; + p += 352; + } + + } + + } +} + +static void karatblzTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) +{ + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 64*64; offs++) { + mx++; + if (mx == 64) { + mx = 0; + my++; + } + + x = mx * 8 - ( ((INT16)bg2scrollx + 4) & 0x1FF); + if (x <= (352-512)) x += 512; + + y = my * 8 - (bg2scrolly & 0x1FF); + if (y <= (240-512)) y += 512; + + if ( x<=-8 || x>=352 || y<=-8 || y>= 240 ) + continue; + else + if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[1] << 13 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; + + for (INT32 k=0;k<8;k++) { + + if (d[0] != 15) p[0] = pal[ d[0] | c ]; + if (d[1] != 15) p[1] = pal[ d[1] | c ]; + if (d[2] != 15) p[2] = pal[ d[2] | c ]; + if (d[3] != 15) p[3] = pal[ d[3] | c ]; + if (d[4] != 15) p[4] = pal[ d[4] | c ]; + if (d[5] != 15) p[5] = pal[ d[5] | c ]; + if (d[6] != 15) p[6] = pal[ d[6] | c ]; + if (d[7] != 15) p[7] = pal[ d[7] | c ]; + + d += 8; + p += 352; + } + } else { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[1] << 13 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; + + for (INT32 k=0;k<8;k++) { + if ( (y+k)>=0 && (y+k)<240 ) { + if (d[0] != 15 && (x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; + if (d[1] != 15 && (x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; + if (d[2] != 15 && (x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; + if (d[3] != 15 && (x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; + if (d[4] != 15 && (x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; + if (d[5] != 15 && (x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; + if (d[6] != 15 && (x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; + if (d[7] != 15 && (x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; + } + d += 8; + p += 352; + } + + } + + } +} + +static INT32 karatblzDraw() +{ + karatblzTileBackground_1(RamBg1V, DeRomBg, RamCurPal); + karatblzTileBackground_2(RamBg2V, DeRomBg + 0x100000, RamCurPal + 256); + +/* + turbofrc_drawsprites(1,-1); + turbofrc_drawsprites(1, 0); + turbofrc_drawsprites(0,-1); + turbofrc_drawsprites(0, 0); +*/ + + turbofrc_drawsprites(0, 0); + turbofrc_drawsprites(0,-1); + turbofrc_drawsprites(1, 0); + turbofrc_drawsprites(1,-1); + + return 0; +} + +static INT32 karatblzFrame() +{ + if (DrvReset) DrvDoReset(); + + // Compile digital inputs + DrvInput[0] = 0x00; // Joy1 + DrvInput[1] = 0x00; // Joy2 + DrvInput[2] = 0x00; // Joy3 + DrvInput[3] = 0x00; // Joy4 + DrvInput[4] = 0x00; // Buttons1 + DrvInput[5] = 0x00; // Buttons2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[2] |= (DrvJoy3[i] & 1) << i; + DrvInput[3] |= (DrvJoy4[i] & 1) << i; + } + for (INT32 i = 0; i < 4; i++) { + DrvInput[4] |= (DrvButton[i] & 1) << i; + DrvInput[5] |= (DrvButton[i+4] & 1) << i; + } + + SekNewFrame(); + ZetNewFrame(); + + nCyclesTotal[0] = 10000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + + SekOpen(0); + ZetOpen(0); + + SekRun(nCyclesTotal[0]); + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + + ZetClose(); + SekClose(); + + if (pBurnDraw) karatblzDraw(); + + return 0; +} + +struct BurnDriver BurnDrvKaratblz = { + "karatblz", NULL, NULL, NULL, "1991", + "Karate Blazers (World?)\0", NULL, "Video System Co.", "Video System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY, 4, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, + NULL, karatblzRomInfo, karatblzRomName, NULL, NULL, karatblzInputInfo, karatblzDIPInfo, + karatblzInit,DrvExit,karatblzFrame,karatblzDraw,DrvScan, + NULL, 0x800,352,240,4,3 +}; + +struct BurnDriver BurnDrvKaratblu = { + "karatblzu", "karatblz", NULL, NULL, "1991", + "Karate Blazers (US)\0", NULL, "Video System Co.", "Video System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 4, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, + NULL, karatbluRomInfo, karatbluRomName, NULL, NULL, karatblzInputInfo, karatblzDIPInfo, + karatblzInit,DrvExit,karatblzFrame,karatblzDraw,DrvScan, + NULL, 0x800,352,240,4,3 +}; + +struct BurnDriver BurnDrvKaratblj = { + "karatblzj", "karatblz", NULL, NULL, "1991", + "Karate Blazers (Japan)\0", NULL, "Video System Co.", "Video System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 4, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, + NULL, karatbljRomInfo, karatbljRomName, NULL, NULL, karatblzInputInfo, karatblzDIPInfo, + karatblzInit,DrvExit,karatblzFrame,karatblzDraw,DrvScan, + NULL, 0x800,352,240,4,3 +}; + +// ----------------------------------------------------------- + +static struct BurnInputInfo spinlbrkInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 2, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 3, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, +}; + +STDINPUTINFO(spinlbrk) + +static struct BurnDIPInfo spinlbrkDIPList[] = { + + // Defaults + {0x13, 0xFF, 0xFF, 0x00, NULL}, + {0x14, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 16, "Coin A"}, + {0x13, 0x01, 0x0F, 0x00, "1-1C 1-2 HPs"}, + {0x13, 0x01, 0x0F, 0x01, "1-1-1-1C 1-1-1-2 HPs"}, + {0x13, 0x01, 0x0F, 0x02, "1-1-1-1-1C 1-1-1-1-2 HPs"}, + {0x13, 0x01, 0x0F, 0x03, "2-2C 1-2 HPs"}, + {0x13, 0x01, 0x0F, 0x04, "2-1-1C 1-1-1 HPs"}, + {0x13, 0x01, 0x0F, 0x05, "2 Credits 2 Health Packs"}, + {0x13, 0x01, 0x0F, 0x06, "5 Credits 1 Health Pack"}, + {0x13, 0x01, 0x0F, 0x07, "4 Credits 1 Health Pack"}, + {0x13, 0x01, 0x0F, 0x08, "3 Credits 1 Health Pack"}, + {0x13, 0x01, 0x0F, 0x09, "2 Credits 1 Health Pack"}, + {0x13, 0x01, 0x0F, 0x0A, "1 Credit 6 Health Packs"}, + {0x13, 0x01, 0x0F, 0x0B, "1 Credit 5 Health Packs"}, + {0x13, 0x01, 0x0F, 0x0C, "1 Credit 4 Health Packs"}, + {0x13, 0x01, 0x0F, 0x0D, "1 Credit 3 Health Packs"}, + {0x13, 0x01, 0x0F, 0x0E, "1 Credit 2 Health Packs"}, + {0x13, 0x01, 0x0F, 0x0F, "1 Credit 1 Health Pack"}, + {0, 0xFE, 0, 16, "Coin A"}, + {0x13, 0x01, 0xF0, 0x00, "1-1C 1-2 HPs"}, + {0x13, 0x01, 0xF0, 0x10, "1-1-1-1C 1-1-1-2 HPs"}, + {0x13, 0x01, 0xF0, 0x20, "1-1-1-1-1C 1-1-1-1-2 HPs"}, + {0x13, 0x01, 0xF0, 0x30, "2-2C 1-2 HPs"}, + {0x13, 0x01, 0xF0, 0x40, "2-1-1C 1-1-1 HPs"}, + {0x13, 0x01, 0xF0, 0x50, "2 Credits 2 Health Packs"}, + {0x13, 0x01, 0xF0, 0x60, "5 Credits 1 Health Pack"}, + {0x13, 0x01, 0xF0, 0x70, "4 Credits 1 Health Pack"}, + {0x13, 0x01, 0xF0, 0x80, "3 Credits 1 Health Pack"}, + {0x13, 0x01, 0xF0, 0x90, "2 Credits 1 Health Pack"}, + {0x13, 0x01, 0xF0, 0xA0, "1 Credit 6 Health Packs"}, + {0x13, 0x01, 0xF0, 0xB0, "1 Credit 5 Health Packs"}, + {0x13, 0x01, 0xF0, 0xC0, "1 Credit 4 Health Packs"}, + {0x13, 0x01, 0xF0, 0xD0, "1 Credit 3 Health Packs"}, + {0x13, 0x01, 0xF0, 0xE0, "1 Credit 2 Health Packs"}, + {0x13, 0x01, 0xF0, 0xF0, "1 Credit 1 Health Pack"}, + + // DIP 2 + {0, 0xFE, 0, 4, "Difficulty"}, + {0x14, 0x01, 0x03, 0x00, "Normal"}, + {0x14, 0x01, 0x03, 0x01, "Easy"}, + {0x14, 0x01, 0x03, 0x02, "Hard"}, + {0x14, 0x01, 0x03, 0x03, "Hardest"}, +}; + +static struct BurnDIPInfo spinlbrk_DIPList[] = { + + {0, 0xFE, 0, 2, "Coin Slot"}, + {0x14, 0x01, 0x04, 0x00, "Individuala"}, + {0x14, 0x01, 0x04, 0x04, "Same"}, + {0, 0xFE, 0, 2, "Flip Screen"}, + {0x14, 0x01, 0x08, 0x00, "Off"}, + {0x14, 0x01, 0x08, 0x08, "On"}, + + {0, 0xFE, 0, 2, "Lever Type"}, + {0x14, 0x01, 0x10, 0x00, "Digital"}, + {0x14, 0x01, 0x10, 0x10, "Analog"}, + {0, 0xFE, 0, 2, "Service"}, + {0x14, 0x01, 0x20, 0x00, "Off"}, + {0x14, 0x01, 0x20, 0x20, "On"}, + {0, 0xFE, 0, 2, "Health Pack"}, + {0x14, 0x01, 0x40, 0x00, "32 Hitpoints"}, + {0x14, 0x01, 0x40, 0x40, "40 Hitpoints"}, + {0, 0xFE, 0, 2, "Life Restoration"}, + {0x14, 0x01, 0x80, 0x00, "10 Points"}, + {0x14, 0x01, 0x80, 0x80, "5 Points"}, + +}; + +STDDIPINFOEXT(spinlbrk, spinlbrk, spinlbrk_) + +static struct BurnDIPInfo spinlbru_DIPList[] = { + + {0, 0xFE, 0, 2, "Coin Slot"}, + {0x14, 0x01, 0x04, 0x00, "Individuala"}, + {0x14, 0x01, 0x04, 0x04, "Same"}, + {0, 0xFE, 0, 2, "Flip Screen"}, + {0x14, 0x01, 0x08, 0x00, "Off"}, + {0x14, 0x01, 0x08, 0x08, "On"}, + + {0, 0xFE, 0, 2, "Lever Type"}, + {0x14, 0x01, 0x10, 0x00, "Digital"}, + {0x14, 0x01, 0x10, 0x10, "Analog"}, + {0, 0xFE, 0, 2, "Service"}, + {0x14, 0x01, 0x20, 0x00, "Off"}, + {0x14, 0x01, 0x20, 0x20, "On"}, + {0, 0xFE, 0, 2, "Health Pack"}, + {0x14, 0x01, 0x40, 0x00, "20 Hitpoints"}, + {0x14, 0x01, 0x40, 0x40, "32 Hitpoints"}, + {0, 0xFE, 0, 2, "Life Restoration"}, + {0x14, 0x01, 0x80, 0x00, "10 Points"}, + {0x14, 0x01, 0x80, 0x80, "5 Points"}, + +}; + +STDDIPINFOEXT(spinlbru, spinlbrk, spinlbru_) + +static struct BurnDIPInfo spinlbrj_DIPList[] = { + + {0, 0xFE, 0, 2, "Continue"}, + {0x14, 0x01, 0x04, 0x00, "Unlimited"}, + {0x14, 0x01, 0x04, 0x04, "6 Times"}, + {0, 0xFE, 0, 2, "Flip Screen"}, + {0x14, 0x01, 0x08, 0x00, "Off"}, + {0x14, 0x01, 0x08, 0x08, "On"}, + + {0, 0xFE, 0, 2, "Lever Type"}, + {0x14, 0x01, 0x10, 0x00, "Digital"}, + {0x14, 0x01, 0x10, 0x10, "Analog"}, + {0, 0xFE, 0, 2, "Service"}, + {0x14, 0x01, 0x20, 0x00, "Off"}, + {0x14, 0x01, 0x20, 0x20, "On"}, + {0, 0xFE, 0, 2, "Health Pack"}, + {0x14, 0x01, 0x40, 0x00, "32 Hitpoints"}, + {0x14, 0x01, 0x40, 0x40, "40 Hitpoints"}, + {0, 0xFE, 0, 2, "Life Restoration"}, + {0x14, 0x01, 0x80, 0x00, "10 Points"}, + {0x14, 0x01, 0x80, 0x80, "5 Points"}, + +}; + +STDDIPINFOEXT(spinlbrj, spinlbrk, spinlbrj_) + +static struct BurnRomInfo spinlbrkRomDesc[] = { + { "ic98", 0x010000, 0x36c2bf70, BRF_ESS | BRF_PRG }, // 68000 code swapped + { "ic104", 0x010000, 0x34a7e158, BRF_ESS | BRF_PRG }, + { "ic93", 0x010000, 0x726f4683, BRF_ESS | BRF_PRG }, + { "ic94", 0x010000, 0xc4385e03, BRF_ESS | BRF_PRG }, + + { "ic15", 0x080000, 0xe318cf3a, BRF_GRA }, // gfx 1 + { "ic9", 0x080000, 0xe071f674, BRF_GRA }, + + { "ic17", 0x080000, 0xa63d5a55, BRF_GRA }, // gfx 2 + { "ic11", 0x080000, 0x7dcc913d, BRF_GRA }, + { "ic16", 0x080000, 0x0d84af7f, BRF_GRA }, + + { "ic12", 0x080000, 0xd63fac4e, BRF_GRA }, // gfx 3 + { "ic18", 0x080000, 0x5a60444b, BRF_GRA }, + + { "ic14", 0x080000, 0x1befd0f3, BRF_GRA }, // gfx 4 + { "ic20", 0x080000, 0xc2f84a61, BRF_GRA }, + { "ic35", 0x080000, 0xeba8e1a3, BRF_GRA }, + { "ic40", 0x080000, 0x5ef5aa7e, BRF_GRA }, + + { "ic19", 0x010000, 0xdb24eeaa, BRF_GRA }, // gfx 5, hardcoded sprite maps + { "ic13", 0x010000, 0x97025bf4, BRF_GRA }, + + { "ic117", 0x008000, 0x625ada41, BRF_ESS | BRF_PRG }, // Sound CPU + { "ic118", 0x010000, 0x1025f024, BRF_ESS | BRF_PRG }, + + { "ic166", 0x080000, 0x6e0d063a, BRF_SND }, // samples + { "ic163", 0x080000, 0xe6621dfb, BRF_SND }, + + { "epl16p8bp.ic100", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "epl16p8bp.ic127", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "epl16p8bp.ic133", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "epl16p8bp.ic99", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "gal16v8a.ic114", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "gal16v8a.ic95", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(spinlbrk) +STD_ROM_FN(spinlbrk) + +static struct BurnRomInfo spinlbruRomDesc[] = { + { "ic98.u5", 0x010000, 0x3a0f7667, BRF_ESS | BRF_PRG }, // 68000 code swapped + { "ic104.u6", 0x010000, 0xa0e0af31, BRF_ESS | BRF_PRG }, + { "ic93.u4", 0x010000, 0x0cf73029, BRF_ESS | BRF_PRG }, + { "ic94.u3", 0x010000, 0x5cf7c426, BRF_ESS | BRF_PRG }, + + { "ic15", 0x080000, 0xe318cf3a, BRF_GRA }, // gfx 1 + { "ic9", 0x080000, 0xe071f674, BRF_GRA }, + + { "ic17", 0x080000, 0xa63d5a55, BRF_GRA }, // gfx 2 + { "ic11", 0x080000, 0x7dcc913d, BRF_GRA }, + { "ic16", 0x080000, 0x0d84af7f, BRF_GRA }, + + { "ic12", 0x080000, 0xd63fac4e, BRF_GRA }, // gfx 3 + { "ic18", 0x080000, 0x5a60444b, BRF_GRA }, + + { "ic14", 0x080000, 0x1befd0f3, BRF_GRA }, // gfx 4 + { "ic20", 0x080000, 0xc2f84a61, BRF_GRA }, + { "ic35", 0x080000, 0xeba8e1a3, BRF_GRA }, + { "ic40", 0x080000, 0x5ef5aa7e, BRF_GRA }, + + { "ic19", 0x010000, 0xdb24eeaa, BRF_GRA }, // gfx 5, hardcoded sprite maps + { "ic13", 0x010000, 0x97025bf4, BRF_GRA }, + + { "ic117", 0x008000, 0x625ada41, BRF_ESS | BRF_PRG }, // Sound CPU + { "ic118", 0x010000, 0x1025f024, BRF_ESS | BRF_PRG }, + + { "ic166", 0x080000, 0x6e0d063a, BRF_SND }, // samples + { "ic163", 0x080000, 0xe6621dfb, BRF_SND }, + + { "epl16p8bp.ic100", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "epl16p8bp.ic127", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "epl16p8bp.ic133", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "epl16p8bp.ic99", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "gal16v8a.ic114", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "gal16v8a.ic95", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(spinlbru) +STD_ROM_FN(spinlbru) + +static struct BurnRomInfo spinlbrjRomDesc[] = { + { "j5", 0x010000, 0x6a3d690e, BRF_ESS | BRF_PRG }, // 68000 code swapped + { "j6", 0x010000, 0x869593fa, BRF_ESS | BRF_PRG }, + { "j4", 0x010000, 0x33e33912, BRF_ESS | BRF_PRG }, + { "j3", 0x010000, 0x16ca61d0, BRF_ESS | BRF_PRG }, + + { "ic15", 0x080000, 0xe318cf3a, BRF_GRA }, // gfx 1 + { "ic9", 0x080000, 0xe071f674, BRF_GRA }, + + { "ic17", 0x080000, 0xa63d5a55, BRF_GRA }, // gfx 2 + { "ic11", 0x080000, 0x7dcc913d, BRF_GRA }, + { "ic16", 0x080000, 0x0d84af7f, BRF_GRA }, + + { "ic12", 0x080000, 0xd63fac4e, BRF_GRA }, // gfx 3 + { "ic18", 0x080000, 0x5a60444b, BRF_GRA }, + + { "ic14", 0x080000, 0x1befd0f3, BRF_GRA }, // gfx 4 + { "ic20", 0x080000, 0xc2f84a61, BRF_GRA }, + { "ic35", 0x080000, 0xeba8e1a3, BRF_GRA }, + { "ic40", 0x080000, 0x5ef5aa7e, BRF_GRA }, + + { "ic19", 0x010000, 0xdb24eeaa, BRF_GRA }, // gfx 5, hardcoded sprite maps + { "ic13", 0x010000, 0x97025bf4, BRF_GRA }, + + { "ic117", 0x008000, 0x625ada41, BRF_ESS | BRF_PRG }, // Sound CPU + { "ic118", 0x010000, 0x1025f024, BRF_ESS | BRF_PRG }, + + { "ic166", 0x080000, 0x6e0d063a, BRF_SND }, // samples + { "ic163", 0x080000, 0xe6621dfb, BRF_SND }, + + { "epl16p8bp.ic100", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "epl16p8bp.ic127", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "epl16p8bp.ic133", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "epl16p8bp.ic99", 263, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "gal16v8a.ic114", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "gal16v8a.ic95", 279, 0x00000000, BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(spinlbrj) +STD_ROM_FN(spinlbrj) + +/* +UINT8 __fastcall spinlbrkReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + + default: + printf("Attempt to read byte value of location %x\n", sekAddress); + } + return 0; +} +*/ + +UINT16 __fastcall spinlbrkReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0xFFF000: + return ~(DrvInput[0] | (DrvInput[2] << 8)); + case 0xFFF002: + return ~(DrvInput[1]); + case 0xFFF004: + return ~(DrvInput[3] | (DrvInput[4] << 8)); + +// default: +// printf("Attempt to read word value of location %x\n", sekAddress); + } + return 0; +} + + +void __fastcall spinlbrkWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + case 0xFFF401: + case 0xFFF403: + // NOP + break; + + case 0xFFF007: + pending_command = 1; + SoundCommand(byteValue); + break; + +// default: +// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } +} + +void __fastcall spinlbrkWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + + if (( sekAddress & 0xFFF000 ) == 0xFFE000) { + sekAddress &= 0x07FF; + *((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue); + RamCurPal[sekAddress>>1] = CalcCol( wordValue ); + return; + } + + switch (sekAddress) { + case 0xFFF000: + RamGfxBank[0] = (wordValue & 0x07); + RamGfxBank[1] = (wordValue & 0x38) >> 3; + break; + case 0xFFF002: + bg2scrollx = wordValue; + break; + case 0xFFF008: + // NOP + break; + +// default: +// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); + } +} + +static INT32 spinlbrkMemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x040000; // 68000 ROM + RomZ80 = Next; Next += 0x030000; // Z80 ROM + + RomBg = Next; Next += 0x500040; // Background, 2.5M 8x8x4bit + DeRomBg = RomBg + 0x000040; + + RomSpr1 = Next; Next += 0x200000; // Sprite 1 + RomSpr2 = Next; Next += 0x400100; // Sprite 2 + + DeRomSpr1 = RomSpr1 + 0x000100; + DeRomSpr2 = RomSpr2 += 0x000100; + + RomSnd2 = Next; Next += 0x100000; // ADPCM data + RomSnd1 = RomSnd2; + + RomSndSize1 = 0x100000; + RomSndSize2 = 0x100000; + + RamSpr2 = (UINT16 *)Next; Next += 0x010000 * sizeof(UINT16); // Sprite 2 Ram + RamSpr1 = (UINT16 *)Next; Next += 0x002000 * sizeof(UINT16); // Sprite 1 Ram + + RamStart = Next; + + RamBg1V = (UINT16 *)Next; Next += 0x000800 * sizeof(UINT16); // BG1 Video Ram + RamBg2V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG2 Video Ram + Ram01 = Next; Next += 0x004000; // Work Ram + RamSpr3 = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // Sprite 3 Ram + RamRaster = (UINT16 *)Next; Next += 0x000100 * sizeof(UINT16); // Raster + RamPal = Next; Next += 0x000800; // 1024 of X1R5G5B5 Palette + RamZ80 = Next; Next += 0x000800; // Z80 Ram 2K + + RamSpr1SizeMask = 0x1FFF; + RamSpr2SizeMask = 0xFFFF; + + RomSpr1SizeMask = 0x1FFF; + RomSpr2SizeMask = 0x3FFF; + + RamEnd = Next; + + RamCurPal = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); + + MemEnd = Next; + return 0; +} + +static INT32 spinlbrkInit() +{ + Mem = NULL; + spinlbrkMemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + spinlbrkMemIndex(); + + // Load 68000 ROM + if (BurnLoadRom(Rom01+0x00001, 0, 2)) return 1; + if (BurnLoadRom(Rom01+0x00000, 1, 2)) return 1; + if (BurnLoadRom(Rom01+0x20001, 2, 2)) return 1; + if (BurnLoadRom(Rom01+0x20000, 3, 2)) return 1; + + // Load Graphic + BurnLoadRom(RomBg+0x000000, 4, 1); + BurnLoadRom(RomBg+0x080000, 5, 1); + BurnLoadRom(RomBg+0x100000, 6, 1); + BurnLoadRom(RomBg+0x180000, 7, 1); + BurnLoadRom(RomBg+0x200000, 8, 1); + pspikesDecodeBg(0x14000); + + BurnLoadRom(RomSpr1+0x000000, 9, 2); + BurnLoadRom(RomSpr1+0x000001, 10, 2); + BurnLoadRom(RomSpr1+0x100000, 11, 2); + BurnLoadRom(RomSpr1+0x100001, 13, 2); + BurnLoadRom(RomSpr1+0x200000, 12, 2); + BurnLoadRom(RomSpr1+0x200001, 14, 2); + pspikesDecodeSpr(DeRomSpr1, RomSpr1, 0x6000); + + BurnLoadRom((UINT8 *)RamSpr2+0x000001, 15, 2); + BurnLoadRom((UINT8 *)RamSpr2+0x000000, 16, 2); + + // Load Z80 ROM + if (BurnLoadRom(RomZ80+0x00000, 17, 1)) return 1; + if (BurnLoadRom(RomZ80+0x08000, 18, 1)) return 1; + + BurnLoadRom(RomSnd2+0x00000, 19, 1); + BurnLoadRom(RomSnd2+0x80000, 20, 1); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x04FFFF, SM_ROM); // CPU 0 ROM + SekMapMemory((UINT8 *)RamBg1V, + 0x080000, 0x080FFF, SM_RAM); + SekMapMemory((UINT8 *)RamBg2V, + 0x082000, 0x083FFF, SM_RAM); + SekMapMemory(Ram01, 0xFF8000, 0xFFBFFF, SM_RAM); // Work RAM + SekMapMemory((UINT8 *)RamSpr3, + 0xFFC000, 0xFFC7FF, SM_RAM); + SekMapMemory((UINT8 *)RamRaster, + 0xFFD000, 0xFFD1FF, SM_RAM); + SekMapMemory(RamPal, 0xFFE000, 0xFFE7FF, SM_ROM); // Palette + + SekSetReadWordHandler(0, spinlbrkReadWord); +// SekSetReadByteHandler(0, spinlbrkReadByte); + SekSetWriteWordHandler(0, spinlbrkWriteWord); + SekSetWriteByteHandler(0, spinlbrkWriteByte); + + SekClose(); + } + + { + ZetInit(0); + ZetOpen(0); + + ZetMapArea(0x0000, 0x77FF, 0, RomZ80); + ZetMapArea(0x0000, 0x77FF, 2, RomZ80); + + ZetMapArea(0x7800, 0x7FFF, 0, RamZ80); + ZetMapArea(0x7800, 0x7FFF, 1, RamZ80); + ZetMapArea(0x7800, 0x7FFF, 2, RamZ80); + + + ZetSetInHandler(turbofrcZ80PortRead); + ZetSetOutHandler(turbofrcZ80PortWrite); + + ZetClose(); + } + + BurnYM2610Init(8000000, RomSnd2, &RomSndSize2, RomSnd1, &RomSndSize1, &aerofgtFMIRQHandler, aerofgtSynchroniseStream, aerofgtGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + bg2scrollx = 0; // + + for (UINT16 i=0; i<0x2000;i++) + RamSpr1[i] = BURN_ENDIAN_SWAP_INT16(i); + + DrvDoReset(); + + return 0; +} + +static void spinlbrkTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) +{ + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 64*64; offs++) { + mx++; + if (mx == 64) { + mx = 0; + my++; + } + + x = mx * 8 - (BURN_ENDIAN_SWAP_INT16(RamRaster[my*8]) & 0x1FF); // + 8 + if (x <= (352-512)) x += 512; + + y = my * 8; + + if ( x<=-8 || x>=352 || y<=-8 || y>= 240 ) + continue; + + else + if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x0FFF) + ( RamGfxBank[0] << 12 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xF000) >> 8; + UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; + + for (INT32 k=0;k<8;k++) { + p[0] = pal[ d[0] | c ]; + p[1] = pal[ d[1] | c ]; + p[2] = pal[ d[2] | c ]; + p[3] = pal[ d[3] | c ]; + p[4] = pal[ d[4] | c ]; + p[5] = pal[ d[5] | c ]; + p[6] = pal[ d[6] | c ]; + p[7] = pal[ d[7] | c ]; + + d += 8; + p += 352; + } + } else { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x0FFF) + ( RamGfxBank[0] << 12 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xF000) >> 8; + UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x; + + for (INT32 k=0;k<8;k++) { + if ( (y+k)>=0 && (y+k)<240 ) { + if ((x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; + if ((x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; + if ((x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; + if ((x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; + if ((x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; + if ((x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; + if ((x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; + if ((x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; + } + d += 8; + p += 352; + } + + } + + } +} + +static INT32 spinlbrkDraw() +{ + spinlbrkTileBackground_1(RamBg1V, DeRomBg, RamCurPal); + karatblzTileBackground_2(RamBg2V, DeRomBg + 0x200000, RamCurPal + 256); + + turbofrc_drawsprites(1,-1); // enemy(near far) + turbofrc_drawsprites(1, 0); // enemy(near) fense + turbofrc_drawsprites(0, 0); // avatar , post , bullet + turbofrc_drawsprites(0,-1); + +/* + UINT16 *ps = RamCurPal; + UINT16 *pd = (UINT16 *)pBurnDraw; + for (INT32 j=0;j<32;j++) { + for (INT32 i=0;i<32;i++) { + *pd = *ps; + pd ++; + ps ++; + } + pd += 352 - 32; + } +*/ + return 0; +} + +static INT32 spinlbrkFrame() +{ + if (DrvReset) DrvDoReset(); + + // Compile digital inputs + DrvInput[0] = 0x00; // Joy1 + DrvInput[1] = 0x00; // Joy2 + DrvInput[2] = 0x00; // Buttons + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[2] |= (DrvButton[i] & 1) << i; + } + + SekNewFrame(); + ZetNewFrame(); + + nCyclesTotal[0] = 10000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + + SekOpen(0); + ZetOpen(0); + + SekRun(nCyclesTotal[0]); + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + + ZetClose(); + SekClose(); + + if (pBurnDraw) spinlbrkDraw(); + + return 0; +} + +struct BurnDriver BurnDrvSpinlbrk = { + "spinlbrk", NULL, NULL, NULL, "1990", + "Spinal Breakers (World)\0", NULL, "V-System Co.", "V-System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0, + NULL, spinlbrkRomInfo, spinlbrkRomName, NULL, NULL, spinlbrkInputInfo, spinlbrkDIPInfo, + spinlbrkInit,DrvExit,spinlbrkFrame,spinlbrkDraw,DrvScan, + NULL, 0x800,352,240,4,3 +}; + +struct BurnDriver BurnDrvSpinlbru = { + "spinlbrku", "spinlbrk", NULL, NULL, "1990", + "Spinal Breakers (US)\0", NULL, "V-System Co.", "V-System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0, + NULL, spinlbruRomInfo, spinlbruRomName, NULL, NULL, spinlbrkInputInfo, spinlbruDIPInfo, + spinlbrkInit,DrvExit,spinlbrkFrame,spinlbrkDraw,DrvScan, + NULL, 0x800,352,240,4,3 +}; + +struct BurnDriver BurnDrvSpinlbrj = { + "spinlbrkj", "spinlbrk", NULL, NULL, "1990", + "Spinal Breakers (Japan)\0", NULL, "V-System Co.", "V-System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0, + NULL, spinlbrjRomInfo, spinlbrjRomName, NULL, NULL, spinlbrkInputInfo, spinlbrjDIPInfo, + spinlbrkInit,DrvExit,spinlbrkFrame,spinlbrkDraw,DrvScan, + NULL, 0x800,352,240,4,3 +}; + +// ------------------------------------------------------- + +static struct BurnDIPInfo aerofgtb_DIPList[] = { + + {0x14, 0xFF, 0xFF, 0x01, NULL}, + + // DIP 3 + {0, 0xFE, 0, 2, "Region"}, + {0x14, 0x01, 0x01, 0x00, "Taiwan"}, + {0x14, 0x01, 0x01, 0x01, "Japan"}, +}; + +STDDIPINFOEXT(aerofgtb, aerofgt, aerofgtb_) + +static struct BurnRomInfo aerofgtbRomDesc[] = { + { "v2", 0x040000, 0x5c9de9f0, BRF_ESS | BRF_PRG }, // 68000 code swapped + { "v1", 0x040000, 0x89c1dcf4, BRF_ESS | BRF_PRG }, // 68000 code swapped + + { "it-19-03", 0x080000, 0x85eba1a4, BRF_GRA }, // graphics + { "it-19-02", 0x080000, 0x4f57f8ba, BRF_GRA }, + + { "it-19-04", 0x080000, 0x3b329c1f, BRF_GRA }, // + { "it-19-05", 0x080000, 0x02b525af, BRF_GRA }, // + + { "g27", 0x040000, 0x4d89cbc8, BRF_GRA }, + { "g26", 0x040000, 0x8072c1d2, BRF_GRA }, + + { "v3", 0x020000, 0xcbb18cf4, BRF_ESS | BRF_PRG }, // Sound CPU + + { "it-19-01", 0x040000, 0x6d42723d, BRF_SND }, // samples + { "it-19-06", 0x100000, 0xcdbbdb1d, BRF_SND }, +}; + +STD_ROM_PICK(aerofgtb) +STD_ROM_FN(aerofgtb) + +static struct BurnRomInfo aerofgtcRomDesc[] = { + { "v2.149", 0x040000, 0xf187aec6, BRF_ESS | BRF_PRG }, // 68000 code swapped + { "v1.111", 0x040000, 0x9e684b19, BRF_ESS | BRF_PRG }, // 68000 code swapped + + { "it-19-03", 0x080000, 0x85eba1a4, BRF_GRA }, // graphics + { "it-19-02", 0x080000, 0x4f57f8ba, BRF_GRA }, + + { "it-19-04", 0x080000, 0x3b329c1f, BRF_GRA }, // + { "it-19-05", 0x080000, 0x02b525af, BRF_GRA }, // + + { "g27", 0x040000, 0x4d89cbc8, BRF_GRA }, + { "g26", 0x040000, 0x8072c1d2, BRF_GRA }, + + { "2.153", 0x020000, 0xa1ef64ec, BRF_ESS | BRF_PRG }, // Sound CPU + + { "it-19-01", 0x040000, 0x6d42723d, BRF_SND }, // samples + { "it-19-06", 0x100000, 0xcdbbdb1d, BRF_SND }, +}; + +STD_ROM_PICK(aerofgtc) +STD_ROM_FN(aerofgtc) + +static struct BurnRomInfo sonicwiRomDesc[] = { + { "2.149", 0x040000, 0x3d1b96ba, BRF_ESS | BRF_PRG }, // 68000 code swapped + { "1.111", 0x040000, 0xa3d09f94, BRF_ESS | BRF_PRG }, // 68000 code swapped + + { "it-19-03", 0x080000, 0x85eba1a4, BRF_GRA }, // graphics + { "it-19-02", 0x080000, 0x4f57f8ba, BRF_GRA }, + + { "it-19-04", 0x080000, 0x3b329c1f, BRF_GRA }, // + { "it-19-05", 0x080000, 0x02b525af, BRF_GRA }, // + + { "g27", 0x040000, 0x4d89cbc8, BRF_GRA }, + { "g26", 0x040000, 0x8072c1d2, BRF_GRA }, + + { "2.153", 0x020000, 0xa1ef64ec, BRF_ESS | BRF_PRG }, // Sound CPU + + { "it-19-01", 0x040000, 0x6d42723d, BRF_SND }, // samples + { "it-19-06", 0x100000, 0xcdbbdb1d, BRF_SND }, +}; + +STD_ROM_PICK(sonicwi) +STD_ROM_FN(sonicwi) + +UINT8 __fastcall aerofgtbReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x0FE000: + return ~DrvInput[2]; + case 0x0FE001: + return ~DrvInput[0]; + case 0x0FE002: + return 0xFF; + case 0x0FE003: + return ~DrvInput[1]; + case 0x0FE004: + return ~DrvInput[4]; + case 0x0FE005: + return ~DrvInput[3]; + case 0x0FE007: + return pending_command; + case 0x0FE009: + return ~DrvInput[5]; + + default: + printf("Attempt to read byte value of location %x\n", sekAddress); + } + return 0; +} + +UINT16 __fastcall aerofgtbReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + + + default: + printf("Attempt to read word value of location %x\n", sekAddress); + } + return 0; +} + +void __fastcall aerofgtbWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + if (( sekAddress & 0x0FF000 ) == 0x0FD000) { + sekAddress &= 0x07FF; + RamPal[sekAddress^1] = byteValue; + // palette byte write at boot self-test only ?! + //if (sekAddress & 1) + // RamCurPal[sekAddress>>1] = CalcCol( *((UINT16 *)&RamPal[sekAddress & 0xFFE]) ); + return; + } + + switch (sekAddress) { + case 0x0FE001: + case 0x0FE401: + case 0x0FE403: + // NOP + break; + + case 0x0FE00E: + pending_command = 1; + SoundCommand(byteValue); + break; + + default: + printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } +} + +void __fastcall aerofgtbWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + if (( sekAddress & 0x0FF000 ) == 0x0FD000) { + sekAddress &= 0x07FE; + *((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue); + RamCurPal[sekAddress>>1] = CalcCol( wordValue ); + return; + } + + switch (sekAddress) { + case 0x0FE002: + bg1scrolly = wordValue; + break; + case 0x0FE004: + bg2scrollx = wordValue; + break; + case 0x0FE006: + bg2scrolly = wordValue; + break; + case 0x0FE008: + RamGfxBank[0] = (wordValue >> 0) & 0x0f; + RamGfxBank[1] = (wordValue >> 4) & 0x0f; + RamGfxBank[2] = (wordValue >> 8) & 0x0f; + RamGfxBank[3] = (wordValue >> 12) & 0x0f; + break; + case 0x0FE00A: + RamGfxBank[4] = (wordValue >> 0) & 0x0f; + RamGfxBank[5] = (wordValue >> 4) & 0x0f; + RamGfxBank[6] = (wordValue >> 8) & 0x0f; + RamGfxBank[7] = (wordValue >> 12) & 0x0f; + break; + case 0x0FE00C: + // NOP + break; + + default: + printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); + } +} + +static INT32 aerofgtbMemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x080000; // 68000 ROM + RomZ80 = Next; Next += 0x030000; // Z80 ROM + RomBg = Next; Next += 0x200040; // Background, 1M 8x8x4bit decode to 2M + 64Byte safe + DeRomBg = RomBg + 0x000040; + RomSpr1 = Next; Next += 0x200000; // Sprite 1 , 1M 16x16x4bit decode to 2M + 256Byte safe + RomSpr2 = Next; Next += 0x100100; // Sprite 2 + + DeRomSpr1 = RomSpr1 + 0x000100; + DeRomSpr2 = RomSpr2 += 0x000100; + + RomSnd1 = Next; Next += 0x040000; // ADPCM data + RomSndSize1 = 0x040000; + RomSnd2 = Next; Next += 0x100000; // ADPCM data + RomSndSize2 = 0x100000; + + RamStart = Next; + + Ram01 = Next; Next += 0x014000; // Work Ram + RamBg1V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG1 Video Ram + RamBg2V = (UINT16 *)Next; Next += 0x001000 * sizeof(UINT16); // BG2 Video Ram + RamSpr1 = (UINT16 *)Next; Next += 0x002000 * sizeof(UINT16); // Sprite 1 Ram + RamSpr2 = (UINT16 *)Next; Next += 0x002000 * sizeof(UINT16); // Sprite 2 Ram + RamSpr3 = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // Sprite 3 Ram + RamPal = Next; Next += 0x000800; // 1024 of X1R5G5B5 Palette + RamRaster = (UINT16 *)Next; Next += 0x000800 * sizeof(UINT16); // Raster + + RamSpr1SizeMask = 0x1FFF; + RamSpr2SizeMask = 0x1FFF; + RomSpr1SizeMask = 0x1FFF; + RomSpr2SizeMask = 0x0FFF; + + RamZ80 = Next; Next += 0x000800; // Z80 Ram 2K + + RamEnd = Next; + + RamCurPal = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); // 1024 colors + + MemEnd = Next; + return 0; +} + +static void aerofgtbDecodeSpr(UINT8 *d, UINT8 *s, INT32 cnt) +{ + for (INT32 c=cnt-1; c>=0; c--) + for (INT32 y=15; y>=0; y--) { + d[(c * 256) + (y * 16) + 15] = s[0x00005 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 14] = s[0x00005 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 13] = s[0x00007 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 12] = s[0x00007 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 11] = s[0x00004 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 10] = s[0x00004 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 9] = s[0x00006 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 8] = s[0x00006 + (y * 8) + (c * 128)] & 0x0f; + + d[(c * 256) + (y * 16) + 7] = s[0x00001 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 6] = s[0x00001 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 5] = s[0x00003 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 4] = s[0x00003 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 3] = s[0x00000 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 2] = s[0x00000 + (y * 8) + (c * 128)] & 0x0f; + d[(c * 256) + (y * 16) + 1] = s[0x00002 + (y * 8) + (c * 128)] >> 4; + d[(c * 256) + (y * 16) + 0] = s[0x00002 + (y * 8) + (c * 128)] & 0x0f; + } +} + +static INT32 aerofgtbInit() +{ + Mem = NULL; + aerofgtbMemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + aerofgtbMemIndex(); + + // Load the roms into memory + // Load 68000 ROM + if (BurnLoadRom(Rom01 + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Rom01 + 0x00000, 1, 2)) return 1; + + // Load Graphic + BurnLoadRom(RomBg+0x00000, 2, 1); + BurnLoadRom(RomBg+0x80000, 3, 1); + pspikesDecodeBg(0x8000); + + BurnLoadRom(RomSpr1+0x000000, 4, 2); + BurnLoadRom(RomSpr1+0x000001, 5, 2); + BurnLoadRom(RomSpr1+0x100000, 6, 2); + BurnLoadRom(RomSpr1+0x100001, 7, 2); + aerofgtbDecodeSpr(DeRomSpr1, RomSpr1, 0x3000); + + // Load Z80 ROM + if (BurnLoadRom(RomZ80+0x10000, 8, 1)) return 1; + memcpy(RomZ80, RomZ80+0x10000, 0x10000); + + BurnLoadRom(RomSnd1, 9, 1); + BurnLoadRom(RomSnd2, 10, 1); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x0C0000, 0x0CFFFF, SM_RAM); // 64K Work RAM + SekMapMemory((UINT8 *)RamBg1V, + 0x0D0000, 0x0D1FFF, SM_RAM); + SekMapMemory((UINT8 *)RamBg2V, + 0x0D2000, 0x0D3FFF, SM_RAM); + SekMapMemory((UINT8 *)RamSpr1, + 0x0E0000, 0x0E3FFF, SM_RAM); + SekMapMemory((UINT8 *)RamSpr2, + 0x0E4000, 0x0E7FFF, SM_RAM); + SekMapMemory(Ram01+0x10000, 0x0F8000, 0x0FBFFF, SM_RAM); // Work RAM + SekMapMemory((UINT8 *)RamSpr3, + 0x0FC000, 0x0FC7FF, SM_RAM); + SekMapMemory(RamPal, 0x0FD000, 0x0FD7FF, SM_ROM); // Palette + SekMapMemory((UINT8 *)RamRaster, + 0x0FF000, 0x0FFFFF, SM_RAM); // Raster + + SekSetReadWordHandler(0, aerofgtbReadWord); + SekSetReadByteHandler(0, aerofgtbReadByte); + SekSetWriteWordHandler(0, aerofgtbWriteWord); + SekSetWriteByteHandler(0, aerofgtbWriteByte); + + SekClose(); + } + + { + ZetInit(0); + ZetOpen(0); + + ZetMapArea(0x0000, 0x77FF, 0, RomZ80); + ZetMapArea(0x0000, 0x77FF, 2, RomZ80); + + ZetMapArea(0x7800, 0x7FFF, 0, RamZ80); + ZetMapArea(0x7800, 0x7FFF, 1, RamZ80); + ZetMapArea(0x7800, 0x7FFF, 2, RamZ80); + + + //ZetSetReadHandler(aerofgtZ80Read); + //ZetSetWriteHandler(aerofgtZ80Write); + ZetSetInHandler(aerofgtZ80PortRead); + ZetSetOutHandler(aerofgtZ80PortWrite); + + ZetClose(); + } + + BurnYM2610Init(8000000, RomSnd2, &RomSndSize2, RomSnd1, &RomSndSize1, &aerofgtFMIRQHandler, aerofgtSynchroniseStream, aerofgtGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); // Reset machine + return 0; +} + +static void aerofgtbTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) +{ + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 64*64; offs++) { + mx++; + if (mx == 64) { + mx = 0; + my++; + } + + x = mx * 8 - (BURN_ENDIAN_SWAP_INT16(RamRaster[7]) & 0x1FF); + if (x <= (320-512)) x += 512; + + y = my * 8 - (((INT16)bg1scrolly + 2) & 0x1FF); + if (y <= (224-512)) y += 512; + + if ( x<=-8 || x>=320 || y<=-8 || y>= 224 ) + continue; + + else + if ( x >=0 && x < (320-8) && y >= 0 && y < (224-8)) { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + + for (INT32 k=0;k<8;k++) { + p[0] = pal[ d[0] | c ]; + p[1] = pal[ d[1] | c ]; + p[2] = pal[ d[2] | c ]; + p[3] = pal[ d[3] | c ]; + p[4] = pal[ d[4] | c ]; + p[5] = pal[ d[5] | c ]; + p[6] = pal[ d[6] | c ]; + p[7] = pal[ d[7] | c ]; + + d += 8; + p += 320; + } + } else { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + + for (INT32 k=0;k<8;k++) { + if ( (y+k)>=0 && (y+k)<224 ) { + if ((x + 0) >= 0 && (x + 0)<320) p[0] = pal[ d[0] | c ]; + if ((x + 1) >= 0 && (x + 1)<320) p[1] = pal[ d[1] | c ]; + if ((x + 2) >= 0 && (x + 2)<320) p[2] = pal[ d[2] | c ]; + if ((x + 3) >= 0 && (x + 3)<320) p[3] = pal[ d[3] | c ]; + if ((x + 4) >= 0 && (x + 4)<320) p[4] = pal[ d[4] | c ]; + if ((x + 5) >= 0 && (x + 5)<320) p[5] = pal[ d[5] | c ]; + if ((x + 6) >= 0 && (x + 6)<320) p[6] = pal[ d[6] | c ]; + if ((x + 7) >= 0 && (x + 7)<320) p[7] = pal[ d[7] | c ]; + } + d += 8; + p += 320; + } + + } + + } +} + +static void aerofgtbTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal) +{ + INT32 offs, mx, my, x, y; + //printf(" %5d%5d%5d%5d\n", (signed short)RamRaster[7],(signed short)bg1scrolly, (signed short)bg2scrollx,(signed short)bg2scrolly); + mx = -1; + my = 0; + for (offs = 0; offs < 64*64; offs++) { + mx++; + if (mx == 64) { + mx = 0; + my++; + } + + x = mx * 8 - (((INT16)bg2scrollx + 5) & 0x1FF); + if (x <= (320-512)) x += 512; + + y = my * 8 - (((INT16)bg2scrolly + 2) & 0x1FF); + if (y <= (224-512)) y += 512; + + if ( x<=-8 || x>=320 || y<=-8 || y>= 224 ) + continue; + else + if ( x >=0 && x < (320-8) && y >= 0 && y < (224-8)) { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + + for (INT32 k=0;k<8;k++) { + + if (d[0] != 15) p[0] = pal[ d[0] | c ]; + if (d[1] != 15) p[1] = pal[ d[1] | c ]; + if (d[2] != 15) p[2] = pal[ d[2] | c ]; + if (d[3] != 15) p[3] = pal[ d[3] | c ]; + if (d[4] != 15) p[4] = pal[ d[4] | c ]; + if (d[5] != 15) p[5] = pal[ d[5] | c ]; + if (d[6] != 15) p[6] = pal[ d[6] | c ]; + if (d[7] != 15) p[7] = pal[ d[7] | c ]; + + d += 8; + p += 320; + } + } else { + + UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64; + UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9; + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + + for (INT32 k=0;k<8;k++) { + if ( (y+k)>=0 && (y+k)<224 ) { + if (d[0] != 15 && (x + 0) >= 0 && (x + 0)<352) p[0] = pal[ d[0] | c ]; + if (d[1] != 15 && (x + 1) >= 0 && (x + 1)<352) p[1] = pal[ d[1] | c ]; + if (d[2] != 15 && (x + 2) >= 0 && (x + 2)<352) p[2] = pal[ d[2] | c ]; + if (d[3] != 15 && (x + 3) >= 0 && (x + 3)<352) p[3] = pal[ d[3] | c ]; + if (d[4] != 15 && (x + 4) >= 0 && (x + 4)<352) p[4] = pal[ d[4] | c ]; + if (d[5] != 15 && (x + 5) >= 0 && (x + 5)<352) p[5] = pal[ d[5] | c ]; + if (d[6] != 15 && (x + 6) >= 0 && (x + 6)<352) p[6] = pal[ d[6] | c ]; + if (d[7] != 15 && (x + 7) >= 0 && (x + 7)<352) p[7] = pal[ d[7] | c ]; + } + d += 8; + p += 320; + } + + } + + } +} + +static void aerofgtb_pdrawgfxzoom(INT32 bank,UINT32 code,UINT32 color,INT32 flipx,INT32 flipy,INT32 sx,INT32 sy,INT32 scalex,INT32 scaley) +{ + if (!scalex || !scaley) return; + + UINT16 * p = (UINT16 *) pBurnDraw; + UINT8 * q; + UINT16 * pal; + + if (bank) { + //if (code > RomSpr2SizeMask) + code &= RomSpr2SizeMask; + q = DeRomSpr2 + (code) * 256; + pal = RamCurPal + 768; + } else { + //if (code > RomSpr1SizeMask) + code &= RomSpr1SizeMask; + q = DeRomSpr1 + (code) * 256; + pal = RamCurPal + 512; + } + + p += sy * 320 + sx; + + if (sx < 0 || sx >= (320-16) || sy < 0 || sy >= (224-16) ) { + + if ((sx <= -16) || (sx >= 320) || (sy <= -16) || (sy >= 224)) + return; + + if (flipy) { + + p += 320 * 15; + + if (flipx) { + + for (INT32 i=15;i>=0;i--) { + if (((sy+i)>=0) && ((sy+i)<224)) { + if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[15] | color]; + } + p -= 320; + q += 16; + } + + } else { + + for (INT32 i=15;i>=0;i--) { + if (((sy+i)>=0) && ((sy+i)<224)) { + if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[15] | color]; + } + p -= 320; + q += 16; + } + } + + } else { + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + if (((sy+i)>=0) && ((sy+i)<224)) { + if (q[ 0] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[15] | color]; + } + p += 320; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + if (((sy+i)>=0) && ((sy+i)<224)) { + if (q[ 0] != 15 && ((sx + 0) >= 0) && ((sx + 0)<320)) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15 && ((sx + 1) >= 0) && ((sx + 1)<320)) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15 && ((sx + 2) >= 0) && ((sx + 2)<320)) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15 && ((sx + 3) >= 0) && ((sx + 3)<320)) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15 && ((sx + 4) >= 0) && ((sx + 4)<320)) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15 && ((sx + 5) >= 0) && ((sx + 5)<320)) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15 && ((sx + 6) >= 0) && ((sx + 6)<320)) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15 && ((sx + 7) >= 0) && ((sx + 7)<320)) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15 && ((sx + 8) >= 0) && ((sx + 8)<320)) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15 && ((sx + 9) >= 0) && ((sx + 9)<320)) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15 && ((sx + 10) >= 0) && ((sx + 10)<320)) p[10] = pal[ q[10] | color]; + if (q[11] != 15 && ((sx + 11) >= 0) && ((sx + 11)<320)) p[11] = pal[ q[11] | color]; + if (q[12] != 15 && ((sx + 12) >= 0) && ((sx + 12)<320)) p[12] = pal[ q[12] | color]; + if (q[13] != 15 && ((sx + 13) >= 0) && ((sx + 13)<320)) p[13] = pal[ q[13] | color]; + if (q[14] != 15 && ((sx + 14) >= 0) && ((sx + 14)<320)) p[14] = pal[ q[14] | color]; + if (q[15] != 15 && ((sx + 15) >= 0) && ((sx + 15)<320)) p[15] = pal[ q[15] | color]; + } + p += 320; + q += 16; + } + + } + + } + + return; + } + + if (flipy) { + + p += 320 * 15; + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15) p[ 0] = pal[ q[15] | color]; + + p -= 320; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15) p[10] = pal[ q[10] | color]; + if (q[11] != 15) p[11] = pal[ q[11] | color]; + if (q[12] != 15) p[12] = pal[ q[12] | color]; + if (q[13] != 15) p[13] = pal[ q[13] | color]; + if (q[14] != 15) p[14] = pal[ q[14] | color]; + if (q[15] != 15) p[15] = pal[ q[15] | color]; + + p -= 320; + q += 16; + } + } + + } else { + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[15] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[14] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[13] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[12] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[11] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[10] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 9] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 8] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 7] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 6] = pal[ q[ 9] | color]; + if (q[10] != 15) p[ 5] = pal[ q[10] | color]; + if (q[11] != 15) p[ 4] = pal[ q[11] | color]; + if (q[12] != 15) p[ 3] = pal[ q[12] | color]; + if (q[13] != 15) p[ 2] = pal[ q[13] | color]; + if (q[14] != 15) p[ 1] = pal[ q[14] | color]; + if (q[15] != 15) p[ 0] = pal[ q[15] | color]; + + p += 320; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + if (q[ 0] != 15) p[ 0] = pal[ q[ 0] | color]; + if (q[ 1] != 15) p[ 1] = pal[ q[ 1] | color]; + if (q[ 2] != 15) p[ 2] = pal[ q[ 2] | color]; + if (q[ 3] != 15) p[ 3] = pal[ q[ 3] | color]; + if (q[ 4] != 15) p[ 4] = pal[ q[ 4] | color]; + if (q[ 5] != 15) p[ 5] = pal[ q[ 5] | color]; + if (q[ 6] != 15) p[ 6] = pal[ q[ 6] | color]; + if (q[ 7] != 15) p[ 7] = pal[ q[ 7] | color]; + + if (q[ 8] != 15) p[ 8] = pal[ q[ 8] | color]; + if (q[ 9] != 15) p[ 9] = pal[ q[ 9] | color]; + if (q[10] != 15) p[10] = pal[ q[10] | color]; + if (q[11] != 15) p[11] = pal[ q[11] | color]; + if (q[12] != 15) p[12] = pal[ q[12] | color]; + if (q[13] != 15) p[13] = pal[ q[13] | color]; + if (q[14] != 15) p[14] = pal[ q[14] | color]; + if (q[15] != 15) p[15] = pal[ q[15] | color]; + + p += 320; + q += 16; + } + + } + + } + +} + +static void aerofgtb_drawsprites(INT32 chip,INT32 chip_disabled_pri) +{ + INT32 attr_start,base,first; + + base = chip * 0x0200; + first = 4 * BURN_ENDIAN_SWAP_INT16(RamSpr3[0x1fe + base]); + + //for (attr_start = base + 0x0200-8;attr_start >= first + base;attr_start -= 4) { + for (attr_start = first + base; attr_start <= base + 0x0200-8; attr_start += 4) { + INT32 map_start; + INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color,pri; +// some other drivers still use this wrong table, they have to be upgraded +// INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; + + if (!(BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0080)) continue; + pri = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0010; + if ( chip_disabled_pri & !pri) continue; + if (!chip_disabled_pri & (pri>>4)) continue; + ox = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0x01ff; + xsize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0700) >> 8; + zoomx = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0xf000) >> 12; + oy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0x01ff; + ysize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x7000) >> 12; + zoomy = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0xf000) >> 12; + flipx = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0800; + flipy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x8000; + color = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x000f) << 4; // + 16 * spritepalettebank; + + map_start = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 3]); + +// aerofgt has this adjustment, but doing it here would break turbo force title screen +// ox += (xsize*zoomx+2)/4; +// oy += (ysize*zoomy+2)/4; + + zoomx = 32 - zoomx; + zoomy = 32 - zoomy; + + for (y = 0;y <= ysize;y++) { + INT32 sx,sy; + + if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16 - 1; + else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16 - 1; + + for (x = 0;x <= xsize;x++) { + INT32 code; + + if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16 - 8; + else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16 - 8; + + if (chip == 0) code = BURN_ENDIAN_SWAP_INT16(RamSpr1[map_start & RamSpr1SizeMask]); + else code = BURN_ENDIAN_SWAP_INT16(RamSpr2[map_start & RamSpr2SizeMask]); + + aerofgtb_pdrawgfxzoom(chip,code,color,flipx,flipy,sx,sy,zoomx << 11, zoomy << 11); + + map_start++; + } + + if (xsize == 2) map_start += 1; + if (xsize == 4) map_start += 3; + if (xsize == 5) map_start += 2; + if (xsize == 6) map_start += 1; + } + } +} + +static INT32 aerofgtbDraw() +{ + aerofgtbTileBackground_1(RamBg1V, DeRomBg, RamCurPal); + aerofgtbTileBackground_2(RamBg2V, DeRomBg + 0x100000, RamCurPal + 256); + + aerofgtb_drawsprites(0, 0); + aerofgtb_drawsprites(0,-1); + aerofgtb_drawsprites(1, 0); + aerofgtb_drawsprites(1,-1); + + return 0; +} + +static INT32 aerofgtbFrame() +{ + if (DrvReset) DrvDoReset(); + + // Compile digital inputs + DrvInput[0] = 0x00; // Joy1 + DrvInput[1] = 0x00; // Joy2 + DrvInput[2] = 0x00; // Buttons + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[2] |= (DrvButton[i] & 1) << i; + } + + SekNewFrame(); + ZetNewFrame(); + + nCyclesTotal[0] = 10000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + + SekOpen(0); + ZetOpen(0); + + SekRun(nCyclesTotal[0]); + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrame(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + + ZetClose(); + SekClose(); + + if (pBurnDraw) aerofgtbDraw(); + + return 0; +} + +struct BurnDriver BurnDrvAerofgtb = { + "aerofgtb", "aerofgt", NULL, NULL, "1992", + "Aero Fighters (Turbo Force hardware set 1)\0", NULL, "Video System Co.", "Video System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, FBF_SONICWI, + NULL, aerofgtbRomInfo, aerofgtbRomName, NULL, NULL, aerofgtInputInfo, aerofgtbDIPInfo, + aerofgtbInit,DrvExit,aerofgtbFrame,aerofgtbDraw,DrvScan, + NULL, 0x800, 224,320,3,4 +}; + +struct BurnDriver BurnDrvAerofgtc = { + "aerofgtc", "aerofgt", NULL, NULL, "1992", + "Aero Fighters (Turbo Force hardware set 2)\0", NULL, "Video System Co.", "Video System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, FBF_SONICWI, + NULL, aerofgtcRomInfo, aerofgtcRomName, NULL, NULL, aerofgtInputInfo, aerofgtDIPInfo, + aerofgtbInit,DrvExit,aerofgtbFrame,aerofgtbDraw,DrvScan, + NULL, 0x800, 224,320,3,4 +}; + +struct BurnDriver BurnDrvSonicwi = { + "sonicwi", "aerofgt", NULL, NULL, "1992", + "Sonic Wings (Japan)\0", NULL, "Video System Co.", "Video System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_16BIT_ONLY, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, FBF_SONICWI, + NULL, sonicwiRomInfo, sonicwiRomName, NULL, NULL, aerofgtInputInfo, aerofgtDIPInfo, + aerofgtbInit,DrvExit,aerofgtbFrame,aerofgtbDraw,DrvScan, + NULL, 0x800, 224,320,3,4 +}; + diff --git a/src/burn/drv/pst90s/d_airbustr.cpp b/src/burn/drv/pst90s/d_airbustr.cpp index 0c1a3a1a6..d5fcb19e9 100644 --- a/src/burn/drv/pst90s/d_airbustr.cpp +++ b/src/burn/drv/pst90s/d_airbustr.cpp @@ -1,930 +1,927 @@ -// FB Alpha Air Buster: Trouble Specialty Raid Unit driver module -// Based on MAME driver by Luca Elia - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "msm6295.h" -#include "burn_ym2203.h" -#include "pandora.h" - -static UINT8 *AllMem; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvZ80ROM2; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvSndROM; -static UINT8 *DrvVidRAM0; -static UINT8 *DrvVidRAM1; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvZ80RAM2; -static UINT8 *DrvShareRAM; -static UINT8 *DrvDevRAM; -static UINT8 *DrvPandoraRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvPalRAM; - -static UINT32 *DrvPalette; - -static UINT8 *DrvScrollRegs; -static UINT8 *soundlatch; -static UINT8 *soundlatch2; -static UINT8 *sound_status; -static UINT8 *sound_status2; -static UINT8 *coin_lockout; -static UINT8 *flipscreen; - -static INT32 interrupt_vectors[2]; -static INT32 watchdog; -static INT32 is_bootleg; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo AirbustrInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 6, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Airbustr) - -static struct BurnDIPInfo AirbustrDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x02, 0x02, "Off" }, -// {0x12, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x04, 0x04, "Off" }, - {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x12, 0x01, 0x08, 0x08, "Mode 1" }, - {0x12, 0x01, 0x08, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x30, 0x10, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x30, 0x00, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x30, 0x10, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x30, 0x00, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0xc0, 0x80, "2 Coins 1 Credits" }, - {0x12, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xc0, 0x80, "2 Coins 1 Credits" }, - {0x12, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xc0, 0x40, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xc0, 0x00, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x03, 0x02, "Easy" }, - {0x13, 0x01, 0x03, 0x03, "Normal" }, - {0x13, 0x01, 0x03, 0x01, "Difficult" }, - {0x13, 0x01, 0x03, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x30, 0x30, "3" }, - {0x13, 0x01, 0x30, 0x20, "4" }, - {0x13, 0x01, 0x30, 0x10, "5" }, - {0x13, 0x01, 0x30, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Airbustr) - -static struct BurnDIPInfo AirbustjDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x02, 0x02, "Off" }, -// {0x12, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x04, 0x04, "Off" }, - {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x12, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x12, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x12, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x03, 0x02, "Easy" }, - {0x13, 0x01, 0x03, 0x03, "Normal" }, - {0x13, 0x01, 0x03, 0x01, "Difficult" }, - {0x13, 0x01, 0x03, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x30, 0x30, "3" }, - {0x13, 0x01, 0x30, 0x20, "4" }, - {0x13, 0x01, 0x30, 0x10, "5" }, - {0x13, 0x01, 0x30, 0x00, "7" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Airbustj) - -static inline void DrvRecalcPalette() -{ - UINT8 r,g,b; - - for (INT32 i = 0; i < 0x600; i+=2) { - INT32 d = DrvPalRAM[i + 1] * 256 + DrvPalRAM[i + 0]; - - r = (d >> 5) & 0x1f; - g = (d >> 10) & 0x1f; - b = (d >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i / 2] = BurnHighCol(r, g, b, 0); - } -} - -static void airbustr_bankswitch(UINT8 *rom, INT32 data) -{ - ZetMapArea(0x8000, 0xbfff, 0, rom + 0x4000 * (data & 0x07)); - ZetMapArea(0x8000, 0xbfff, 2, rom + 0x4000 * (data & 0x07)); -} - -void __fastcall airbustr_main_write(UINT16 address, UINT8 data) -{ - if ((address & 0xf000) == 0xc000) { // pandora - - DrvSprRAM[address & 0xfff] = data; - - address = (address & 0x800) | ((address & 0xff) << 3) | ((address & 0x700) >> 8); - - DrvPandoraRAM[address] = data; - - return; - } -} - -UINT8 __fastcall airbustr_main_read(UINT16 address) -{ - if ((address & 0xf000) == 0xe000) { - - INT32 offset = address & 0xfff; - switch (offset) - { - case 0xfe0: - watchdog = 180; - return 0; - - case 0xff2: - case 0xff3: - { - INT32 r = (DrvDevRAM[0xff0] + DrvDevRAM[0xff1] * 256) * (DrvDevRAM[0xff2] + DrvDevRAM[0xff3] * 256); - - if (offset & 1) return r >> 8; - return r; - } - - case 0xff4: - return rand(); - } - - return DrvDevRAM[offset]; - } - - return 0; -} - -void __fastcall airbustr_main_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - airbustr_bankswitch(DrvZ80ROM0, data); - return; - - case 0x01: - return; // nop - - case 0x02: - { - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - } - return; - } -} - -void __fastcall airbustr_sub_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - { - airbustr_bankswitch(DrvZ80ROM1, data); - - *flipscreen = data & 0x10; - - pandora_set_clear(data & 0x20); - } - return; - - case 0x02: // soundcommand_w - { - *soundlatch = data; - *sound_status = 1; - ZetClose(); - ZetOpen(2); - ZetNmi(); - ZetClose(); - ZetOpen(1); - } - return; - - case 0x04: - case 0x06: - case 0x08: - case 0x0a: - case 0x0c: - DrvScrollRegs[((port & 0x0f) - 0x04) / 2] = data; - return; - - case 0x28: - *coin_lockout = ~data & 0x0c; - // coINT32 counter also (0x03) - return; - - case 0x38: - return; // nop - } -} - -UINT8 __fastcall airbustr_sub_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x02: - *sound_status2 = 0; - return *soundlatch2; - - case 0x0e: - return (4 + *sound_status * 2 + (1 - *sound_status2)); - - case 0x20: - return DrvInputs[0]; - - case 0x22: - return DrvInputs[1]; - - case 0x24: - return DrvInputs[2] | *coin_lockout; - } - - return 0; -} - -void __fastcall airbustr_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - airbustr_bankswitch(DrvZ80ROM2, data); - return; - - case 0x02: - BurnYM2203Write(0, 0, data); - return; - - case 0x03: - BurnYM2203Write(0, 1, data); - return; - - case 0x04: - MSM6295Command(0, data); - return; - - case 0x06: - *soundlatch2 = data; - *sound_status2 = 1; - return; - } -} - -UINT8 __fastcall airbustr_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x02: - return BurnYM2203Read(0, 0); - - case 0x03: - return BurnYM2203Read(0, 1); - - case 0x04: - return MSM6295ReadStatus(0); - - case 0x06: - *sound_status = 0; - return *soundlatch; - } - - return 0; -} - -UINT8 DrvYM2203PortA(UINT32) -{ - return DrvDips[0]; -} - -UINT8 DrvYM2203PortB(UINT32) -{ - return DrvDips[1]; -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 6000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 6000000; -} - -static INT32 DrvDoReset(INT32 full_reset) -{ - if (full_reset) { - memset (AllRam, 0, RamEnd - AllRam); - } - -// UINT8 *rom[3] = { DrvZ80ROM0, DrvZ80ROM1, DrvZ80ROM2 }; - - for (INT32 i = 0; i < 3; i++) { - ZetOpen(i); - ZetReset(); -// if (full_reset) airbustr_bankswitch(rom[i], 2); - ZetClose(); - } - - MSM6295Reset(0); - ZetOpen(2); - BurnYM2203Reset(); - ZetClose(); - - interrupt_vectors[0] = 0xff; - interrupt_vectors[1] = 0xfd; - - watchdog = 180; - - srand(time(NULL)); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x020000; - DrvZ80ROM1 = Next; Next += 0x020000; - DrvZ80ROM2 = Next; Next += 0x020000; - - DrvGfxROM0 = Next; Next += 0x100000; - DrvGfxROM1 = Next; Next += 0x400000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - AllRam = Next; - - DrvVidRAM0 = Next; Next += 0x000800; - DrvVidRAM1 = Next; Next += 0x000800; - - DrvZ80RAM0 = Next; Next += 0x001000; - DrvZ80RAM1 = Next; Next += 0x001000; - DrvZ80RAM2 = Next; Next += 0x002000; - - DrvShareRAM = Next; Next += 0x001000; - DrvDevRAM = Next; Next += 0x001000; - - DrvPandoraRAM = Next; Next += 0x001000; - DrvSprRAM = Next; Next += 0x001000; - DrvPalRAM = Next; Next += 0x001000; - - DrvScrollRegs = Next; Next += 0x000006; - - soundlatch = Next; Next += 0x000001; - soundlatch2 = Next; Next += 0x000001; - sound_status = Next; Next += 0x000001; - sound_status2 = Next; Next += 0x000001; - - coin_lockout = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - static INT32 Plane[4] = { 0, 1, 2, 3 }; - static INT32 XOffs[16] = { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, - 0*4+32*8, 1*4+32*8, 2*4+32*8, 3*4+32*8, 4*4+32*8, 5*4+32*8, 6*4+32*8, 7*4+32*8 }; - static INT32 YOffs[16] = { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, - 0*32+64*8, 1*32+64*8, 2*32+64*8, 3*32+64*8, 4*32+64*8, 5*32+64*8, 6*32+64*8, 7*32+64*8 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x080000; i++) { - tmp[i] = (DrvGfxROM0[i] << 4) | (DrvGfxROM0[i] >> 4); - } - - GfxDecode(0x1000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x100000); - - GfxDecode(0x2000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - is_bootleg = BurnDrvGetFlags() & BDF_BOOTLEG; - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x000000, 0, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x000000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM2 + 0x000000, 2, 1)) return 1; - - if (is_bootleg) - { - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040001, 6, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 11, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 12, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x020000, 13, 1)) return 1; - } - else - { - // mcu... - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 6, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 7, 1)) return 1; - } - - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0xc000, 0xcfff, 0, DrvSprRAM); -// ZetMapArea(0xc000, 0xcfff, 1, DrvSprRAM); // handler - ZetMapArea(0xc000, 0xcfff, 2, DrvSprRAM); - ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM0); - ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM0); - ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM0); - if (is_bootleg) ZetMapArea(0xe000, 0xefff, 0, DrvDevRAM); - ZetMapArea(0xe000, 0xefff, 1, DrvDevRAM); - ZetMapArea(0xe000, 0xefff, 2, DrvDevRAM); - ZetMapArea(0xf000, 0xffff, 0, DrvShareRAM); - ZetMapArea(0xf000, 0xffff, 1, DrvShareRAM); - ZetMapArea(0xf000, 0xffff, 2, DrvShareRAM); - ZetSetWriteHandler(airbustr_main_write); - ZetSetReadHandler(airbustr_main_read); - ZetSetOutHandler(airbustr_main_out); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0xc000, 0xc7ff, 0, DrvVidRAM1); - ZetMapArea(0xc000, 0xc7ff, 1, DrvVidRAM1); - ZetMapArea(0xc000, 0xc7ff, 2, DrvVidRAM1); - ZetMapArea(0xc800, 0xcfff, 0, DrvVidRAM0); - ZetMapArea(0xc800, 0xcfff, 1, DrvVidRAM0); - ZetMapArea(0xc800, 0xcfff, 2, DrvVidRAM0); - ZetMapArea(0xd000, 0xdfff, 0, DrvPalRAM); - ZetMapArea(0xd000, 0xdfff, 1, DrvPalRAM); - ZetMapArea(0xd000, 0xdfff, 2, DrvPalRAM); - ZetMapArea(0xe000, 0xefff, 0, DrvZ80RAM1); - ZetMapArea(0xe000, 0xefff, 1, DrvZ80RAM1); - ZetMapArea(0xe000, 0xefff, 2, DrvZ80RAM1); - ZetMapArea(0xf000, 0xffff, 0, DrvShareRAM); - ZetMapArea(0xf000, 0xffff, 1, DrvShareRAM); - ZetMapArea(0xf000, 0xffff, 2, DrvShareRAM); - ZetSetOutHandler(airbustr_sub_out); - ZetSetInHandler(airbustr_sub_in); - ZetMemEnd(); - ZetClose(); - - ZetInit(2); - ZetOpen(2); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM2); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM2); - ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM2); - ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM2); - ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM2); - ZetSetOutHandler(airbustr_sound_out); - ZetSetInHandler(airbustr_sound_in); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(1, 3000000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnYM2203SetPorts(0, &DrvYM2203PortA, &DrvYM2203PortB, NULL, NULL); - BurnTimerAttachZet(6000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.25, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.25, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.25, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 3000000 / 132, 1); - MSM6295SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - pandora_init(DrvPandoraRAM, DrvGfxROM1, 0x200, 0, -16); - - DrvDoReset(1); - - return 0; -} - -static INT32 DrvExit() -{ - pandora_exit(); - - GenericTilesExit(); - - ZetExit(); - MSM6295Exit(0); - - BurnYM2203Exit(); - - BurnFree(AllMem); - - return 0; -} - -static void draw_layer(UINT8 *ram, INT32 r0, INT32 r1, INT32 r2, INT32 r3, INT32 t) -{ - INT32 scrollx = DrvScrollRegs[r0] + ((~DrvScrollRegs[4] << r1) & 0x100); - INT32 scrolly = DrvScrollRegs[r2] + ((~DrvScrollRegs[4] << r3) & 0x100) + 16; - - if (*flipscreen) { - scrollx = (scrollx + 0x06a) & 0x1ff; - scrolly = (scrolly + 0x1ff) & 0x1ff; - } else { - scrollx = (scrollx - 0x094) & 0x1ff; - scrolly = (scrolly - 0x100) & 0x1ff; - } - - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 4; - INT32 sy = (offs >> 5) << 4; - - sx -= scrollx; - if (sx < -15) sx += 512; - sy -= scrolly; - if (sy < -15) sy += 512; - - if (sx >= nScreenWidth) continue; - if (sy >= nScreenHeight) continue; - - INT32 attr = ram[offs + 0x400]; - INT32 code = ram[offs + 0x000] | ((attr & 0x0f) << 8); - - if (t) { - if (*flipscreen) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, 240 - sx, 240 - sy, attr >> 4, 4, 0, 0, DrvGfxROM0); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, attr >> 4, 4, 0, 0, DrvGfxROM0); - } - } else { - if (*flipscreen) { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, 240 - sx, 240 - sy, attr >> 4, 4, 0x100, DrvGfxROM0); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, attr >> 4, 4, 0x100, DrvGfxROM0); - } - } - } -} - -static INT32 DrvDraw() -{ - DrvRecalcPalette(); - - draw_layer(DrvVidRAM0, 3, 6, 2, 5, 0); - - draw_layer(DrvVidRAM1, 1, 8, 0, 7, 1); - - pandora_flipscreen = *flipscreen; - pandora_update(pTransDraw); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(1); - } - - if (watchdog == 0 && is_bootleg == 0) { - DrvDoReset(0); - } - watchdog--; - - ZetNewFrame(); - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - INT32 nInterleave = 100; - INT32 nCyclesTotal[3] = { 6000000 / 60, 6000000 / 60, 6000000 / 60 }; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) { - - INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - - ZetOpen(0); - nCyclesDone[0] += ZetRun(nSegment - nCyclesDone[0]); - if (i == 49 || i == 99) { - interrupt_vectors[0] ^= 2; - ZetSetVector(interrupt_vectors[0]); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - ZetClose(); - - ZetOpen(1); - nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); - if (i == 49 || i == 99) { - interrupt_vectors[1] ^= 2; - ZetSetVector(interrupt_vectors[1]); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - ZetClose(); - - ZetOpen(2); - BurnTimerUpdate(nCyclesDone[1] /*sync with sub cpu*/); - if (i == 99) { - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - ZetClose(); - } - - ZetOpen(2); - - BurnTimerEndFrame(nCyclesTotal[2]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - pandora_buffer_sprites(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029707; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - } - - return 0; -} - - -// Air Buster: Trouble Specialty Raid Unit (World) - -static struct BurnRomInfo airbustrRomDesc[] = { - { "pr12.h19", 0x20000, 0x91362eb2, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "pr13.l15", 0x20000, 0x13b2257b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "pr-21.bin", 0x20000, 0x6e0a5df0, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code - - { "i80c51", 0x01000, 0x00000000, 4 | BRF_NODUMP }, // 3 80c51 MCU - - { "pr-000.bin", 0x80000, 0x8ca68f0d, 5 | BRF_GRA }, // 4 Tiles - - { "pr-001.bin", 0x80000, 0x7e6cb377, 6 | BRF_GRA }, // 5 Sprites - { "pr-02.bin", 0x10000, 0x6bbd5e46, 6 | BRF_GRA }, // 6 - - { "pr-200.bin", 0x40000, 0xa4dd3390, 7 | BRF_SND }, // 7 OKI M6295 -}; - -STD_ROM_PICK(airbustr) -STD_ROM_FN(airbustr) - -struct BurnDriver BurnDrvAirbustr = { - "airbustr", NULL, NULL, NULL, "1990", - "Air Buster: Trouble Specialty Raid Unit (World)\0", NULL, "Kaneko (Namco license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KANEKO_MISC, GBF_MISC, 0, - NULL, airbustrRomInfo, airbustrRomName, NULL, NULL, AirbustrInputInfo, AirbustrDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x0300, - 256, 224, 4, 3 -}; - - -// Air Buster: Trouble Specialty Raid Unit (Japan) - -static struct BurnRomInfo airbustrjRomDesc[] = { - { "pr-14j.bin", 0x20000, 0x6b9805bd, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "pr-11j.bin", 0x20000, 0x85464124, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "pr-21.bin", 0x20000, 0x6e0a5df0, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code - - { "i80c51", 0x01000, 0x00000000, 4 | BRF_NODUMP }, // 3 80c51 MCU - - { "pr-000.bin", 0x80000, 0x8ca68f0d, 5 | BRF_GRA }, // 4 Tiles - - { "pr-001.bin", 0x80000, 0x7e6cb377, 6 | BRF_GRA }, // 5 Sprites - { "pr-02.bin", 0x10000, 0x6bbd5e46, 6 | BRF_GRA }, // 6 - - { "pr-200.bin", 0x40000, 0xa4dd3390, 7 | BRF_SND }, // 7 OKI M6295 -}; - -STD_ROM_PICK(airbustrj) -STD_ROM_FN(airbustrj) - -struct BurnDriver BurnDrvAirbustrj = { - "airbustrj", "airbustr", NULL, NULL, "1990", - "Air Buster: Trouble Specialty Raid Unit (Japan)\0", NULL, "Kaneko (Namco license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO_MISC, GBF_MISC, 0, - NULL, airbustrjRomInfo, airbustrjRomName, NULL, NULL, AirbustrInputInfo, AirbustjDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x0300, - 256, 224, 4, 3 -}; - - -// Air Buster: Trouble Specialty Raid Unit (bootleg) - -static struct BurnRomInfo airbustrbRomDesc[] = { - { "5.bin", 0x20000, 0x9e4216a2, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "1.bin", 0x20000, 0x85464124, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "2.bin", 0x20000, 0x6e0a5df0, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code - - { "7.bin", 0x20000, 0x2e3bf0a2, 4 | BRF_GRA }, // 3 Tiles - { "9.bin", 0x20000, 0x2c23c646, 4 | BRF_GRA }, // 4 - { "6.bin", 0x20000, 0x0d6cd470, 4 | BRF_GRA }, // 5 - { "8.bin", 0x20000, 0xb3372e51, 4 | BRF_GRA }, // 6 - - { "13.bin", 0x20000, 0x75dee86d, 5 | BRF_GRA }, // 7 Sprites - { "12.bin", 0x20000, 0xc98a8333, 5 | BRF_GRA }, // 8 - { "11.bin", 0x20000, 0x4e9baebd, 5 | BRF_GRA }, // 9 - { "10.bin", 0x20000, 0x63dc8cd8, 5 | BRF_GRA }, // 10 - { "14.bin", 0x10000, 0x6bbd5e46, 5 | BRF_GRA }, // 11 - - { "4.bin", 0x20000, 0x21d9bfe3, 6 | BRF_SND }, // 12 OKI M6295 - { "3.bin", 0x20000, 0x58cd19e2, 6 | BRF_SND }, // 13 -}; - -STD_ROM_PICK(airbustrb) -STD_ROM_FN(airbustrb) - -struct BurnDriver BurnDrvAirbustrb = { - "airbustrb", "airbustr", NULL, NULL, "1990", - "Air Buster: Trouble Specialty Raid Unit (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_KANEKO_MISC, GBF_MISC, 0, - NULL, airbustrbRomInfo, airbustrbRomName, NULL, NULL, AirbustrInputInfo, AirbustjDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x0300, - 256, 224, 4, 3 -}; +// FB Alpha Air Buster: Trouble Specialty Raid Unit driver module +// Based on MAME driver by Luca Elia + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "msm6295.h" +#include "burn_ym2203.h" +#include "pandora.h" + +static UINT8 *AllMem; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvZ80ROM2; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvSndROM; +static UINT8 *DrvVidRAM0; +static UINT8 *DrvVidRAM1; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvZ80RAM2; +static UINT8 *DrvShareRAM; +static UINT8 *DrvDevRAM; +static UINT8 *DrvPandoraRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvPalRAM; + +static UINT32 *DrvPalette; + +static UINT8 *DrvScrollRegs; +static UINT8 *soundlatch; +static UINT8 *soundlatch2; +static UINT8 *sound_status; +static UINT8 *sound_status2; +static UINT8 *coin_lockout; +static UINT8 *flipscreen; + +static INT32 interrupt_vectors[2]; +static INT32 watchdog; +static INT32 is_bootleg; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo AirbustrInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 6, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Airbustr) + +static struct BurnDIPInfo AirbustrDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x02, 0x02, "Off" }, +// {0x12, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x04, 0x04, "Off" }, + {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x12, 0x01, 0x08, 0x08, "Mode 1" }, + {0x12, 0x01, 0x08, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x30, 0x10, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x30, 0x00, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x30, 0x10, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x30, 0x00, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0xc0, 0x80, "2 Coins 1 Credits" }, + {0x12, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xc0, 0x80, "2 Coins 1 Credits" }, + {0x12, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xc0, 0x40, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xc0, 0x00, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x03, 0x02, "Easy" }, + {0x13, 0x01, 0x03, 0x03, "Normal" }, + {0x13, 0x01, 0x03, 0x01, "Difficult" }, + {0x13, 0x01, 0x03, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x30, 0x30, "3" }, + {0x13, 0x01, 0x30, 0x20, "4" }, + {0x13, 0x01, 0x30, 0x10, "5" }, + {0x13, 0x01, 0x30, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Airbustr) + +static struct BurnDIPInfo AirbustjDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x02, 0x02, "Off" }, +// {0x12, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x04, 0x04, "Off" }, + {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x12, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x12, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x12, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x03, 0x02, "Easy" }, + {0x13, 0x01, 0x03, 0x03, "Normal" }, + {0x13, 0x01, 0x03, 0x01, "Difficult" }, + {0x13, 0x01, 0x03, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x30, 0x30, "3" }, + {0x13, 0x01, 0x30, 0x20, "4" }, + {0x13, 0x01, 0x30, 0x10, "5" }, + {0x13, 0x01, 0x30, 0x00, "7" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Airbustj) + +static inline void DrvRecalcPalette() +{ + UINT8 r,g,b; + + for (INT32 i = 0; i < 0x600; i+=2) { + INT32 d = DrvPalRAM[i + 1] * 256 + DrvPalRAM[i + 0]; + + r = (d >> 5) & 0x1f; + g = (d >> 10) & 0x1f; + b = (d >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i / 2] = BurnHighCol(r, g, b, 0); + } +} + +static void airbustr_bankswitch(UINT8 *rom, INT32 data) +{ + ZetMapArea(0x8000, 0xbfff, 0, rom + 0x4000 * (data & 0x07)); + ZetMapArea(0x8000, 0xbfff, 2, rom + 0x4000 * (data & 0x07)); +} + +void __fastcall airbustr_main_write(UINT16 address, UINT8 data) +{ + if ((address & 0xf000) == 0xc000) { // pandora + + DrvSprRAM[address & 0xfff] = data; + + address = (address & 0x800) | ((address & 0xff) << 3) | ((address & 0x700) >> 8); + + DrvPandoraRAM[address] = data; + + return; + } +} + +UINT8 __fastcall airbustr_main_read(UINT16 address) +{ + if ((address & 0xf000) == 0xe000) { + + INT32 offset = address & 0xfff; + switch (offset) + { + case 0xfe0: + watchdog = 180; + return 0; + + case 0xff2: + case 0xff3: + { + INT32 r = (DrvDevRAM[0xff0] + DrvDevRAM[0xff1] * 256) * (DrvDevRAM[0xff2] + DrvDevRAM[0xff3] * 256); + + if (offset & 1) return r >> 8; + return r; + } + + case 0xff4: + return rand(); + } + + return DrvDevRAM[offset]; + } + + return 0; +} + +void __fastcall airbustr_main_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + airbustr_bankswitch(DrvZ80ROM0, data); + return; + + case 0x01: + return; // nop + + case 0x02: + { + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + } + return; + } +} + +void __fastcall airbustr_sub_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + { + airbustr_bankswitch(DrvZ80ROM1, data); + + *flipscreen = data & 0x10; + + pandora_set_clear(data & 0x20); + } + return; + + case 0x02: // soundcommand_w + { + *soundlatch = data; + *sound_status = 1; + ZetClose(); + ZetOpen(2); + ZetNmi(); + ZetClose(); + ZetOpen(1); + } + return; + + case 0x04: + case 0x06: + case 0x08: + case 0x0a: + case 0x0c: + DrvScrollRegs[((port & 0x0f) - 0x04) / 2] = data; + return; + + case 0x28: + *coin_lockout = ~data & 0x0c; + // coINT32 counter also (0x03) + return; + + case 0x38: + return; // nop + } +} + +UINT8 __fastcall airbustr_sub_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x02: + *sound_status2 = 0; + return *soundlatch2; + + case 0x0e: + return (4 + *sound_status * 2 + (1 - *sound_status2)); + + case 0x20: + return DrvInputs[0]; + + case 0x22: + return DrvInputs[1]; + + case 0x24: + return DrvInputs[2] | *coin_lockout; + } + + return 0; +} + +void __fastcall airbustr_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + airbustr_bankswitch(DrvZ80ROM2, data); + return; + + case 0x02: + BurnYM2203Write(0, 0, data); + return; + + case 0x03: + BurnYM2203Write(0, 1, data); + return; + + case 0x04: + MSM6295Command(0, data); + return; + + case 0x06: + *soundlatch2 = data; + *sound_status2 = 1; + return; + } +} + +UINT8 __fastcall airbustr_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x02: + return BurnYM2203Read(0, 0); + + case 0x03: + return BurnYM2203Read(0, 1); + + case 0x04: + return MSM6295ReadStatus(0); + + case 0x06: + *sound_status = 0; + return *soundlatch; + } + + return 0; +} + +UINT8 DrvYM2203PortA(UINT32) +{ + return DrvDips[0]; +} + +UINT8 DrvYM2203PortB(UINT32) +{ + return DrvDips[1]; +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 6000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 6000000; +} + +static INT32 DrvDoReset(INT32 full_reset) +{ + if (full_reset) { + memset (AllRam, 0, RamEnd - AllRam); + } + +// UINT8 *rom[3] = { DrvZ80ROM0, DrvZ80ROM1, DrvZ80ROM2 }; + + for (INT32 i = 0; i < 3; i++) { + ZetOpen(i); + ZetReset(); +// if (full_reset) airbustr_bankswitch(rom[i], 2); + ZetClose(); + } + + MSM6295Reset(0); + ZetOpen(2); + BurnYM2203Reset(); + ZetClose(); + + interrupt_vectors[0] = 0xff; + interrupt_vectors[1] = 0xfd; + + watchdog = 180; + + srand(time(NULL)); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x020000; + DrvZ80ROM1 = Next; Next += 0x020000; + DrvZ80ROM2 = Next; Next += 0x020000; + + DrvGfxROM0 = Next; Next += 0x100000; + DrvGfxROM1 = Next; Next += 0x400000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + AllRam = Next; + + DrvVidRAM0 = Next; Next += 0x000800; + DrvVidRAM1 = Next; Next += 0x000800; + + DrvZ80RAM0 = Next; Next += 0x001000; + DrvZ80RAM1 = Next; Next += 0x001000; + DrvZ80RAM2 = Next; Next += 0x002000; + + DrvShareRAM = Next; Next += 0x001000; + DrvDevRAM = Next; Next += 0x001000; + + DrvPandoraRAM = Next; Next += 0x001000; + DrvSprRAM = Next; Next += 0x001000; + DrvPalRAM = Next; Next += 0x001000; + + DrvScrollRegs = Next; Next += 0x000006; + + soundlatch = Next; Next += 0x000001; + soundlatch2 = Next; Next += 0x000001; + sound_status = Next; Next += 0x000001; + sound_status2 = Next; Next += 0x000001; + + coin_lockout = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + static INT32 Plane[4] = { 0, 1, 2, 3 }; + static INT32 XOffs[16] = { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, + 0*4+32*8, 1*4+32*8, 2*4+32*8, 3*4+32*8, 4*4+32*8, 5*4+32*8, 6*4+32*8, 7*4+32*8 }; + static INT32 YOffs[16] = { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, + 0*32+64*8, 1*32+64*8, 2*32+64*8, 3*32+64*8, 4*32+64*8, 5*32+64*8, 6*32+64*8, 7*32+64*8 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x080000; i++) { + tmp[i] = (DrvGfxROM0[i] << 4) | (DrvGfxROM0[i] >> 4); + } + + GfxDecode(0x1000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x100000); + + GfxDecode(0x2000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + is_bootleg = BurnDrvGetFlags() & BDF_BOOTLEG; + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x000000, 0, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x000000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM2 + 0x000000, 2, 1)) return 1; + + if (is_bootleg) + { + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040001, 6, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 11, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 12, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x020000, 13, 1)) return 1; + } + else + { + // mcu... + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 6, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 7, 1)) return 1; + } + + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0xc000, 0xcfff, 0, DrvSprRAM); +// ZetMapArea(0xc000, 0xcfff, 1, DrvSprRAM); // handler + ZetMapArea(0xc000, 0xcfff, 2, DrvSprRAM); + ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM0); + ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM0); + ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM0); + if (is_bootleg) ZetMapArea(0xe000, 0xefff, 0, DrvDevRAM); + ZetMapArea(0xe000, 0xefff, 1, DrvDevRAM); + ZetMapArea(0xe000, 0xefff, 2, DrvDevRAM); + ZetMapArea(0xf000, 0xffff, 0, DrvShareRAM); + ZetMapArea(0xf000, 0xffff, 1, DrvShareRAM); + ZetMapArea(0xf000, 0xffff, 2, DrvShareRAM); + ZetSetWriteHandler(airbustr_main_write); + ZetSetReadHandler(airbustr_main_read); + ZetSetOutHandler(airbustr_main_out); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0xc000, 0xc7ff, 0, DrvVidRAM1); + ZetMapArea(0xc000, 0xc7ff, 1, DrvVidRAM1); + ZetMapArea(0xc000, 0xc7ff, 2, DrvVidRAM1); + ZetMapArea(0xc800, 0xcfff, 0, DrvVidRAM0); + ZetMapArea(0xc800, 0xcfff, 1, DrvVidRAM0); + ZetMapArea(0xc800, 0xcfff, 2, DrvVidRAM0); + ZetMapArea(0xd000, 0xdfff, 0, DrvPalRAM); + ZetMapArea(0xd000, 0xdfff, 1, DrvPalRAM); + ZetMapArea(0xd000, 0xdfff, 2, DrvPalRAM); + ZetMapArea(0xe000, 0xefff, 0, DrvZ80RAM1); + ZetMapArea(0xe000, 0xefff, 1, DrvZ80RAM1); + ZetMapArea(0xe000, 0xefff, 2, DrvZ80RAM1); + ZetMapArea(0xf000, 0xffff, 0, DrvShareRAM); + ZetMapArea(0xf000, 0xffff, 1, DrvShareRAM); + ZetMapArea(0xf000, 0xffff, 2, DrvShareRAM); + ZetSetOutHandler(airbustr_sub_out); + ZetSetInHandler(airbustr_sub_in); + ZetClose(); + + ZetInit(2); + ZetOpen(2); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM2); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM2); + ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM2); + ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM2); + ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM2); + ZetSetOutHandler(airbustr_sound_out); + ZetSetInHandler(airbustr_sound_in); + ZetClose(); + + BurnYM2203Init(1, 3000000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnYM2203SetPorts(0, &DrvYM2203PortA, &DrvYM2203PortB, NULL, NULL); + BurnTimerAttachZet(6000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.25, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.25, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.25, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 3000000 / 132, 1); + MSM6295SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + pandora_init(DrvPandoraRAM, DrvGfxROM1, 0x200, 0, -16); + + DrvDoReset(1); + + return 0; +} + +static INT32 DrvExit() +{ + pandora_exit(); + + GenericTilesExit(); + + ZetExit(); + MSM6295Exit(0); + + BurnYM2203Exit(); + + BurnFree(AllMem); + + return 0; +} + +static void draw_layer(UINT8 *ram, INT32 r0, INT32 r1, INT32 r2, INT32 r3, INT32 t) +{ + INT32 scrollx = DrvScrollRegs[r0] + ((~DrvScrollRegs[4] << r1) & 0x100); + INT32 scrolly = DrvScrollRegs[r2] + ((~DrvScrollRegs[4] << r3) & 0x100) + 16; + + if (*flipscreen) { + scrollx = (scrollx + 0x06a) & 0x1ff; + scrolly = (scrolly + 0x1ff) & 0x1ff; + } else { + scrollx = (scrollx - 0x094) & 0x1ff; + scrolly = (scrolly - 0x100) & 0x1ff; + } + + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 4; + INT32 sy = (offs >> 5) << 4; + + sx -= scrollx; + if (sx < -15) sx += 512; + sy -= scrolly; + if (sy < -15) sy += 512; + + if (sx >= nScreenWidth) continue; + if (sy >= nScreenHeight) continue; + + INT32 attr = ram[offs + 0x400]; + INT32 code = ram[offs + 0x000] | ((attr & 0x0f) << 8); + + if (t) { + if (*flipscreen) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, 240 - sx, 240 - sy, attr >> 4, 4, 0, 0, DrvGfxROM0); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, attr >> 4, 4, 0, 0, DrvGfxROM0); + } + } else { + if (*flipscreen) { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, 240 - sx, 240 - sy, attr >> 4, 4, 0x100, DrvGfxROM0); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, attr >> 4, 4, 0x100, DrvGfxROM0); + } + } + } +} + +static INT32 DrvDraw() +{ + DrvRecalcPalette(); + + draw_layer(DrvVidRAM0, 3, 6, 2, 5, 0); + + draw_layer(DrvVidRAM1, 1, 8, 0, 7, 1); + + pandora_flipscreen = *flipscreen; + pandora_update(pTransDraw); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(1); + } + + if (watchdog == 0 && is_bootleg == 0) { + DrvDoReset(0); + } + watchdog--; + + ZetNewFrame(); + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + INT32 nInterleave = 100; + INT32 nCyclesTotal[3] = { 6000000 / 60, 6000000 / 60, 6000000 / 60 }; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) { + + INT32 nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + + ZetOpen(0); + nCyclesDone[0] += ZetRun(nSegment - nCyclesDone[0]); + if (i == 49 || i == 99) { + interrupt_vectors[0] ^= 2; + ZetSetVector(interrupt_vectors[0]); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + ZetClose(); + + ZetOpen(1); + nCyclesDone[1] += ZetRun(nSegment - nCyclesDone[1]); + if (i == 49 || i == 99) { + interrupt_vectors[1] ^= 2; + ZetSetVector(interrupt_vectors[1]); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + ZetClose(); + + ZetOpen(2); + BurnTimerUpdate(nCyclesDone[1] /*sync with sub cpu*/); + if (i == 99) { + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + ZetClose(); + } + + ZetOpen(2); + + BurnTimerEndFrame(nCyclesTotal[2]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + pandora_buffer_sprites(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029707; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + } + + return 0; +} + + +// Air Buster: Trouble Specialty Raid Unit (World) + +static struct BurnRomInfo airbustrRomDesc[] = { + { "pr12.h19", 0x20000, 0x91362eb2, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "pr13.l15", 0x20000, 0x13b2257b, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "pr-21.bin", 0x20000, 0x6e0a5df0, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code + + { "i80c51", 0x01000, 0x00000000, 4 | BRF_NODUMP }, // 3 80c51 MCU + + { "pr-000.bin", 0x80000, 0x8ca68f0d, 5 | BRF_GRA }, // 4 Tiles + + { "pr-001.bin", 0x80000, 0x7e6cb377, 6 | BRF_GRA }, // 5 Sprites + { "pr-02.bin", 0x10000, 0x6bbd5e46, 6 | BRF_GRA }, // 6 + + { "pr-200.bin", 0x40000, 0xa4dd3390, 7 | BRF_SND }, // 7 OKI M6295 +}; + +STD_ROM_PICK(airbustr) +STD_ROM_FN(airbustr) + +struct BurnDriver BurnDrvAirbustr = { + "airbustr", NULL, NULL, NULL, "1990", + "Air Buster: Trouble Specialty Raid Unit (World)\0", NULL, "Kaneko (Namco license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KANEKO_MISC, GBF_MISC, 0, + NULL, airbustrRomInfo, airbustrRomName, NULL, NULL, AirbustrInputInfo, AirbustrDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x0300, + 256, 224, 4, 3 +}; + + +// Air Buster: Trouble Specialty Raid Unit (Japan) + +static struct BurnRomInfo airbustrjRomDesc[] = { + { "pr-14j.bin", 0x20000, 0x6b9805bd, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "pr-11j.bin", 0x20000, 0x85464124, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "pr-21.bin", 0x20000, 0x6e0a5df0, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code + + { "i80c51", 0x01000, 0x00000000, 4 | BRF_NODUMP }, // 3 80c51 MCU + + { "pr-000.bin", 0x80000, 0x8ca68f0d, 5 | BRF_GRA }, // 4 Tiles + + { "pr-001.bin", 0x80000, 0x7e6cb377, 6 | BRF_GRA }, // 5 Sprites + { "pr-02.bin", 0x10000, 0x6bbd5e46, 6 | BRF_GRA }, // 6 + + { "pr-200.bin", 0x40000, 0xa4dd3390, 7 | BRF_SND }, // 7 OKI M6295 +}; + +STD_ROM_PICK(airbustrj) +STD_ROM_FN(airbustrj) + +struct BurnDriver BurnDrvAirbustrj = { + "airbustrj", "airbustr", NULL, NULL, "1990", + "Air Buster: Trouble Specialty Raid Unit (Japan)\0", NULL, "Kaneko (Namco license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO_MISC, GBF_MISC, 0, + NULL, airbustrjRomInfo, airbustrjRomName, NULL, NULL, AirbustrInputInfo, AirbustjDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x0300, + 256, 224, 4, 3 +}; + + +// Air Buster: Trouble Specialty Raid Unit (bootleg) + +static struct BurnRomInfo airbustrbRomDesc[] = { + { "5.bin", 0x20000, 0x9e4216a2, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "1.bin", 0x20000, 0x85464124, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "2.bin", 0x20000, 0x6e0a5df0, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code + + { "7.bin", 0x20000, 0x2e3bf0a2, 4 | BRF_GRA }, // 3 Tiles + { "9.bin", 0x20000, 0x2c23c646, 4 | BRF_GRA }, // 4 + { "6.bin", 0x20000, 0x0d6cd470, 4 | BRF_GRA }, // 5 + { "8.bin", 0x20000, 0xb3372e51, 4 | BRF_GRA }, // 6 + + { "13.bin", 0x20000, 0x75dee86d, 5 | BRF_GRA }, // 7 Sprites + { "12.bin", 0x20000, 0xc98a8333, 5 | BRF_GRA }, // 8 + { "11.bin", 0x20000, 0x4e9baebd, 5 | BRF_GRA }, // 9 + { "10.bin", 0x20000, 0x63dc8cd8, 5 | BRF_GRA }, // 10 + { "14.bin", 0x10000, 0x6bbd5e46, 5 | BRF_GRA }, // 11 + + { "4.bin", 0x20000, 0x21d9bfe3, 6 | BRF_SND }, // 12 OKI M6295 + { "3.bin", 0x20000, 0x58cd19e2, 6 | BRF_SND }, // 13 +}; + +STD_ROM_PICK(airbustrb) +STD_ROM_FN(airbustrb) + +struct BurnDriver BurnDrvAirbustrb = { + "airbustrb", "airbustr", NULL, NULL, "1990", + "Air Buster: Trouble Specialty Raid Unit (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_KANEKO_MISC, GBF_MISC, 0, + NULL, airbustrbRomInfo, airbustrbRomName, NULL, NULL, AirbustrInputInfo, AirbustjDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x0300, + 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_aquarium.cpp b/src/burn/drv/pst90s/d_aquarium.cpp index 369fe8672..776ff5088 100644 --- a/src/burn/drv/pst90s/d_aquarium.cpp +++ b/src/burn/drv/pst90s/d_aquarium.cpp @@ -1,770 +1,769 @@ -// FB Alpha Aquarium driver module -// Based on MAME driver by David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm6295.h" -#include "bitswap.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80Bank; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSndROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvPalRAM; -static UINT8 *DrvMidRAM; -static UINT8 *DrvBakRAM; -static UINT8 *DrvTxtRAM; -static UINT8 *DrvSprRAM; -static UINT16 *DrvScroll; -static UINT32 *DrvPalette; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[3]; -static UINT8 DrvReset; -static UINT16 DrvInputs[2]; - -static UINT8 *soundlatch; -static UINT8 *soundack; -static UINT8 *flipscreen; - -static struct BurnInputInfo AquariumInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 1, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 15, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 8, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 9, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 10, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 11, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 3, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Aquarium) - -static struct BurnDIPInfo AquariumDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Normal" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 3, "Winning Rounds (Player VS CPU)" }, - {0x12, 0x01, 0x0c, 0x0c, "1/1" }, - {0x12, 0x01, 0x0c, 0x08, "2/3" }, - {0x12, 0x01, 0x0c, 0x04, "3/5" }, - - {0 , 0xfe, 0 , 3, "Winning Rounds (Player VS Player)" }, - {0x12, 0x01, 0x30, 0x30, "1/1" }, - {0x12, 0x01, 0x30, 0x20, "2/3" }, - {0x12, 0x01, 0x30, 0x10, "3/5" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x13, 0x01, 0x07, 0x00, "5 Coins 1 Credits " }, - {0x13, 0x01, 0x07, 0x01, "4 Coins 1 Credits " }, - {0x13, 0x01, 0x07, 0x02, "3 Coins 1 Credits " }, - {0x13, 0x01, 0x07, 0x03, "2 Coins 1 Credits " }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Credits " }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x20, 0x00, "Off" }, - {0x13, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x14, 0x01, 0xff, 0x00, "Japanese" }, - {0x14, 0x01, 0xff, 0xff, "English" }, -}; - -STDDIPINFO(Aquarium) - -UINT8 __fastcall aquarium_read_byte(UINT32 address) -{ - switch (address) - { - case 0xd80080: - return DrvDips[1]; - - case 0xd80081: - return DrvDips[0]; - - case 0xd80086: - { - INT32 data = DrvInputs[1] | *soundack; - *soundack = 0; - return data; - } - } - - return 0; -} - -UINT16 __fastcall aquarium_read_word(UINT32 address) -{ - switch (address) - { - case 0xd80084: - return DrvInputs[0]; - } - - return 0; -} - -void __fastcall aquarium_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0xd8008b: - *soundlatch = data; - ZetNmi(); - return; - } -} - -void __fastcall aquarium_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0xd80014: - case 0xd80016: - case 0xd80018: - case 0xd8001a: - case 0xd8001c: - case 0xd8001e: - DrvScroll[(address - 0xd80014)/2] = data; - return; - - case 0xd80056: - *flipscreen = ~data & 1; // seems right? - return; - } -} - -static void sound_bankswitch(INT32 nBank) -{ - *DrvZ80Bank = nBank & 7; - - nBank = ((nBank & 7) + 1) * 0x8000; - - ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + nBank); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + nBank); -} - -void __fastcall aquarium_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - BurnYM2151SelectRegister(data); - return; - - case 0x01: - BurnYM2151WriteRegister(data); - return; - - case 0x02: - MSM6295Command(0, BITSWAP08(data, 0, 1, 2, 3, 4, 5, 6, 7)); - return; - - case 0x06: - *soundack = 0x80; - return; - - case 0x08: - sound_bankswitch(data); - return; - } -} - -UINT8 __fastcall aquarium_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x01: - return BurnYM2151ReadStatus(); - - case 0x02: - return BITSWAP08(MSM6295ReadStatus(0), 0, 1, 2, 3, 4, 5, 6, 7); - - case 0x04: - return *soundlatch; - } - - return 0; -} - -void aquariumYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM2151Reset(); - - Drv68KROM[0x000a5c] = DrvDips[2]; // set region (hack) - Drv68KROM[0x000a5d] = DrvDips[2]; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[5] = { 0x400000, 0, 1, 2, 3 }; - INT32 Plane2[4] = { 48, 16, 32, 0 }; - INT32 XOffs0[16] = { 8, 12, 0, 4, 24, 28, 16, 20, 40, 44, 32, 36, 56, 60, 48, 52 }; - INT32 XOffs2[16] = { 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7 }; - INT32 YOffs0[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; - INT32 YOffs1[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x100000); - - GfxDecode(0x1000, 5, 16, 16, Plane0 , XOffs0, YOffs0, 0x400, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x020000); - - GfxDecode(0x1000, 4, 8, 8, Plane0 + 1, XOffs0, YOffs1, 0x100, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x100000); - - GfxDecode(0x2000, 4, 16, 16, Plane2 , XOffs2, YOffs0, 0x400, tmp, DrvGfxROM2); - - memcpy (tmp, DrvGfxROM3, 0x100000); - - GfxDecode(0x1000, 5, 16, 16, Plane0 , XOffs0, YOffs0, 0x400, tmp, DrvGfxROM3); - - BurnFree (tmp); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x080000; - DrvZ80ROM = Next; Next += 0x040000; - - DrvGfxROM0 = Next; Next += 0x100000; - DrvGfxROM1 = Next; Next += 0x040000; - DrvGfxROM2 = Next; Next += 0x200000; - DrvGfxROM3 = Next; Next += 0x100000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x080000; - - DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x001000; - DrvMidRAM = Next; Next += 0x001000; - DrvBakRAM = Next; Next += 0x001000; - DrvTxtRAM = Next; Next += 0x002000; - DrvSprRAM = Next; Next += 0x002000; - - DrvZ80RAM = Next; Next += 0x000800; - - soundack = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - DrvZ80Bank = Next; Next += 0x000001; - - DrvScroll = (UINT16*)Next; Next += 0x000008 * sizeof(UINT16); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvLoad5bpp(UINT8 *gfx, INT32 num) -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x20000); - if (tmp == NULL) { - return 1; - } - - if (BurnLoadRom(tmp, num, 1)) return 1; - - for (INT32 len = 0; len < 0x020000; len++) - { - gfx[len*4+0] = ((tmp[len] & 0x20) << 2) | ((tmp[len] & 0x10) >> 1); - gfx[len*4+1] = ((tmp[len] & 0x80) << 0) | ((tmp[len] & 0x40) >> 3); - gfx[len*4+2] = ((tmp[len] & 0x02) << 6) | ((tmp[len] & 0x01) << 3); - gfx[len*4+3] = ((tmp[len] & 0x08) << 4) | ((tmp[len] & 0x04) << 1); - } - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM, 0, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0, 2, 1)) return 1; - if (DrvLoad5bpp(DrvGfxROM0 + 0x80000, 3 )) return 1; - - if (BurnLoadRom(DrvGfxROM1, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3, 6, 1)) return 1; - if (DrvLoad5bpp(DrvGfxROM3 + 0x80000, 7 )) return 1; - - if (BurnLoadRom(DrvSndROM, 8, 1)) return 1; - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvMidRAM, 0xc00000, 0xc00fff, SM_RAM); - SekMapMemory(DrvBakRAM, 0xc01000, 0xc01fff, SM_RAM); - SekMapMemory(DrvTxtRAM, 0xc02000, 0xc03fff, SM_RAM); - SekMapMemory(DrvSprRAM, 0xc80000, 0xc81fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xd00000, 0xd00fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xff0000, 0xffffff, SM_RAM); - SekSetWriteByteHandler(0, aquarium_write_byte); - SekSetWriteWordHandler(0, aquarium_write_word); - SekSetReadByteHandler(0, aquarium_read_byte); - SekSetReadWordHandler(0, aquarium_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM); - ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); - ZetSetOutHandler(aquarium_sound_out); - ZetSetInHandler(aquarium_sound_in); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 1122000 / 132, 1); - MSM6295SetRoute(0, 0.47, BURN_SND_ROUTE_BOTH); - - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&aquariumYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM2151Exit(); - MSM6295Exit(0); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - return 0; -} - -static inline void palette_write(INT32 offset) -{ - UINT8 r,g,b; - UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset))); - - r = ((data >> 11) & 0x1e) | ((data >> 3) & 0x01); - g = ((data >> 7) & 0x1e) | ((data >> 2) & 0x01); - b = ((data >> 3) & 0x1e) | ((data >> 1) & 0x01); - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); -} - -static void draw_bg_layer(UINT8 *src, UINT8 *gfx_base, INT32 scrollx, INT32 scrolly, INT32 transp, INT32 priority) -{ - UINT16 *vram = (UINT16*)src; - - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 color = BURN_ENDIAN_SWAP_INT16(vram[(offs * 2) + 1]); - INT32 prior = (color & 0x0020) >> 5; - if (prior != priority) continue; - - INT32 sx = (offs & 0x1f) << 4; - INT32 sy = (offs >> 5) << 4; - - sx -= scrollx + 16; - if (sx < -15) sx += 0x200; - sy -= scrolly + 16; - if (sy < -15) sy += 0x200; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 flipx = color & 0x0100; - INT32 flipy = color & 0x0200; - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2]) & 0x0fff; - - if (transp) { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0, 0x400, gfx_base); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0, 0x400, gfx_base); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0, 0x400, gfx_base); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0, 0x400, gfx_base); - } - } - } else { - if (flipy) { - if (flipx) { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0x400, gfx_base); - } else { - Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0x400, gfx_base); - } - } else { - if (flipx) { - Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0x400, gfx_base); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0x400, gfx_base); - } - } - } - } -} - -static void draw_tx_layer(INT32 scrollx, INT32 scrolly) -{ - UINT16 *vram = (UINT16*)DrvTxtRAM; - - for (INT32 offs = 0; offs < 64 * 64; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - sx -= scrollx + 16; - if (sx < -7) sx += 0x200; - sy -= scrolly + 16; - if (sy < -7) sy += 0x200; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0xfff; - INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs]) >> 12; - - if (sx >= nScreenWidth || sy >= nScreenHeight || code == 0) continue; - - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x200, DrvGfxROM1); - } -} - -static void draw_sprites() -{ - UINT16 *sram = (UINT16*)DrvSprRAM; - - for (INT32 offs = 0; offs < 0x0800; offs += 8) - { - INT32 code = (BURN_ENDIAN_SWAP_INT16(sram[offs+5]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(sram[offs+6]) & 0x3f) << 8); - - if (~BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x80) - { - INT32 x = (((BURN_ENDIAN_SWAP_INT16(sram[offs+0]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(sram[offs+1]) & 0x7f) << 8)) - ((BURN_ENDIAN_SWAP_INT16(sram[offs+1]) & 0x80) << 9)) - 16; - INT32 y = (((BURN_ENDIAN_SWAP_INT16(sram[offs+2]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(sram[offs+3]) & 0x7f) << 8)) - ((BURN_ENDIAN_SWAP_INT16(sram[offs+3]) & 0x80) << 9)) - 16; - - INT32 col = BURN_ENDIAN_SWAP_INT16(sram[offs+7]) & 0x0f; - INT32 chain = BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x07; - INT32 flipy = BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x10; - INT32 flipx = BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x20; - - if (~BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x08) { - if (flipy) y += chain << 4; - if (flipx) x += chain << 4; - } - - for (INT32 pos = chain; pos >= 0; pos--) - { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y, col, 4, 0, 0x300, DrvGfxROM2); - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y + 256, col, 4, 0, 0x300, DrvGfxROM2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y, col, 4, 0, 0x300, DrvGfxROM2); - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y + 256, col, 4, 0, 0x300, DrvGfxROM2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, col, 4, 0, 0x300, DrvGfxROM2); - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y + 256, col, 4, 0, 0x300, DrvGfxROM2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, col, 4, 0, 0x300, DrvGfxROM2); - Render16x16Tile_Mask_Clip(pTransDraw, code, x, y + 256, col, 4, 0, 0x300, DrvGfxROM2); - } - } - - code++; - - if (BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x08) - { - if (flipy) y -= 16; - else y += 16; - } - else - { - if (flipx) x -= 16; - else x += 16; - } - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x1000; i+=2) { - palette_write(i); - } - } - - draw_bg_layer(DrvBakRAM, DrvGfxROM3, DrvScroll[2] & 0x1ff, DrvScroll[3] & 0x1ff, 0, 0); - draw_bg_layer(DrvMidRAM, DrvGfxROM0, DrvScroll[0] & 0x1ff, DrvScroll[1] & 0x1ff, 1, 0); - - draw_sprites(); - - draw_bg_layer(DrvBakRAM, DrvGfxROM3, DrvScroll[2] & 0x1ff, DrvScroll[3] & 0x1ff, 1, 1); - draw_bg_layer(DrvMidRAM, DrvGfxROM0, DrvScroll[0] & 0x1ff, DrvScroll[1] & 0x1ff, 1, 1); - - draw_tx_layer(DrvScroll[4] & 0x1ff, DrvScroll[5] & 0x1ff); - - if (*flipscreen) { - INT32 len = nScreenWidth * nScreenHeight; - for (INT32 i = 0; i < len / 2; i++) { - INT32 t = pTransDraw[i + 0]; - pTransDraw[i + 0] = pTransDraw[len-(1+i)]; - pTransDraw[len-(1+i)] = t; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 4); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - DrvInputs[1] &= 0x7f; - } - - INT32 nSegment; - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 16000000 / 60, 6000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); - nCyclesDone[0] += SekRun(nSegment); - - nSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i); - nCyclesDone[1] += ZetRun(nSegment); - - if (pBurnSoundOut) { - nSegment = nBurnSoundLen / nInterleave; - - BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - - nSoundBufferPos += nSegment; - } - } - - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - nSegment = nBurnSoundLen - nSoundBufferPos; - if (nSegment > 0) { - BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029698; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - sound_bankswitch(*DrvZ80Bank); - ZetClose(); - } - - return 0; -} - - -// Aquarium (Japan) - -static struct BurnRomInfo aquariumRomDesc[] = { - { "aquar3", 0x080000, 0x344509a1, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - - { "aquar5", 0x040000, 0xfa555be1, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code - - { "aquar1", 0x080000, 0x575df6ac, 3 | BRF_GRA }, // 2 Midground Tiles - { "aquar6", 0x020000, 0x9065b146, 3 | BRF_GRA }, // 3 - - { "aquar2", 0x020000, 0xaa071b05, 4 | BRF_GRA }, // 6 Foreground Tiles - - { "aquarf1", 0x100000, 0x14758b3c, 5 | BRF_GRA }, // 7 Sprites - - { "aquar8", 0x080000, 0x915520c4, 6 | BRF_GRA }, // 4 Background Tiles - { "aquar7", 0x020000, 0xb96b2b82, 6 | BRF_GRA }, // 5 - - { "aquar4", 0x080000, 0x9a4af531, 7 | BRF_SND }, // 8 MSM6295 Samples -}; - -STD_ROM_PICK(aquarium) -STD_ROM_FN(aquarium) - -struct BurnDriver BurnDrvAquarium = { - "aquarium", NULL, NULL, NULL, "1996", - "Aquarium (Japan)\0", NULL, "Excellent System", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, aquariumRomInfo, aquariumRomName, NULL, NULL, AquariumInputInfo, AquariumDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 256, 4, 3 -}; +// FB Alpha Aquarium driver module +// Based on MAME driver by David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm6295.h" +#include "bitswap.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80Bank; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSndROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvPalRAM; +static UINT8 *DrvMidRAM; +static UINT8 *DrvBakRAM; +static UINT8 *DrvTxtRAM; +static UINT8 *DrvSprRAM; +static UINT16 *DrvScroll; +static UINT32 *DrvPalette; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[3]; +static UINT8 DrvReset; +static UINT16 DrvInputs[2]; + +static UINT8 *soundlatch; +static UINT8 *soundack; +static UINT8 *flipscreen; + +static struct BurnInputInfo AquariumInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 1, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 15, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 8, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 9, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 10, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 11, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 3, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Aquarium) + +static struct BurnDIPInfo AquariumDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Normal" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 3, "Winning Rounds (Player VS CPU)" }, + {0x12, 0x01, 0x0c, 0x0c, "1/1" }, + {0x12, 0x01, 0x0c, 0x08, "2/3" }, + {0x12, 0x01, 0x0c, 0x04, "3/5" }, + + {0 , 0xfe, 0 , 3, "Winning Rounds (Player VS Player)" }, + {0x12, 0x01, 0x30, 0x30, "1/1" }, + {0x12, 0x01, 0x30, 0x20, "2/3" }, + {0x12, 0x01, 0x30, 0x10, "3/5" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x13, 0x01, 0x07, 0x00, "5 Coins 1 Credits " }, + {0x13, 0x01, 0x07, 0x01, "4 Coins 1 Credits " }, + {0x13, 0x01, 0x07, 0x02, "3 Coins 1 Credits " }, + {0x13, 0x01, 0x07, 0x03, "2 Coins 1 Credits " }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Credits " }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x20, 0x00, "Off" }, + {0x13, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x14, 0x01, 0xff, 0x00, "Japanese" }, + {0x14, 0x01, 0xff, 0xff, "English" }, +}; + +STDDIPINFO(Aquarium) + +UINT8 __fastcall aquarium_read_byte(UINT32 address) +{ + switch (address) + { + case 0xd80080: + return DrvDips[1]; + + case 0xd80081: + return DrvDips[0]; + + case 0xd80086: + { + INT32 data = DrvInputs[1] | *soundack; + *soundack = 0; + return data; + } + } + + return 0; +} + +UINT16 __fastcall aquarium_read_word(UINT32 address) +{ + switch (address) + { + case 0xd80084: + return DrvInputs[0]; + } + + return 0; +} + +void __fastcall aquarium_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0xd8008b: + *soundlatch = data; + ZetNmi(); + return; + } +} + +void __fastcall aquarium_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0xd80014: + case 0xd80016: + case 0xd80018: + case 0xd8001a: + case 0xd8001c: + case 0xd8001e: + DrvScroll[(address - 0xd80014)/2] = data; + return; + + case 0xd80056: + *flipscreen = ~data & 1; // seems right? + return; + } +} + +static void sound_bankswitch(INT32 nBank) +{ + *DrvZ80Bank = nBank & 7; + + nBank = ((nBank & 7) + 1) * 0x8000; + + ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + nBank); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + nBank); +} + +void __fastcall aquarium_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + BurnYM2151SelectRegister(data); + return; + + case 0x01: + BurnYM2151WriteRegister(data); + return; + + case 0x02: + MSM6295Command(0, BITSWAP08(data, 0, 1, 2, 3, 4, 5, 6, 7)); + return; + + case 0x06: + *soundack = 0x80; + return; + + case 0x08: + sound_bankswitch(data); + return; + } +} + +UINT8 __fastcall aquarium_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x01: + return BurnYM2151ReadStatus(); + + case 0x02: + return BITSWAP08(MSM6295ReadStatus(0), 0, 1, 2, 3, 4, 5, 6, 7); + + case 0x04: + return *soundlatch; + } + + return 0; +} + +void aquariumYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM2151Reset(); + + Drv68KROM[0x000a5c] = DrvDips[2]; // set region (hack) + Drv68KROM[0x000a5d] = DrvDips[2]; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[5] = { 0x400000, 0, 1, 2, 3 }; + INT32 Plane2[4] = { 48, 16, 32, 0 }; + INT32 XOffs0[16] = { 8, 12, 0, 4, 24, 28, 16, 20, 40, 44, 32, 36, 56, 60, 48, 52 }; + INT32 XOffs2[16] = { 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7 }; + INT32 YOffs0[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; + INT32 YOffs1[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x100000); + + GfxDecode(0x1000, 5, 16, 16, Plane0 , XOffs0, YOffs0, 0x400, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x020000); + + GfxDecode(0x1000, 4, 8, 8, Plane0 + 1, XOffs0, YOffs1, 0x100, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x100000); + + GfxDecode(0x2000, 4, 16, 16, Plane2 , XOffs2, YOffs0, 0x400, tmp, DrvGfxROM2); + + memcpy (tmp, DrvGfxROM3, 0x100000); + + GfxDecode(0x1000, 5, 16, 16, Plane0 , XOffs0, YOffs0, 0x400, tmp, DrvGfxROM3); + + BurnFree (tmp); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x080000; + DrvZ80ROM = Next; Next += 0x040000; + + DrvGfxROM0 = Next; Next += 0x100000; + DrvGfxROM1 = Next; Next += 0x040000; + DrvGfxROM2 = Next; Next += 0x200000; + DrvGfxROM3 = Next; Next += 0x100000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x080000; + + DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x001000; + DrvMidRAM = Next; Next += 0x001000; + DrvBakRAM = Next; Next += 0x001000; + DrvTxtRAM = Next; Next += 0x002000; + DrvSprRAM = Next; Next += 0x002000; + + DrvZ80RAM = Next; Next += 0x000800; + + soundack = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + DrvZ80Bank = Next; Next += 0x000001; + + DrvScroll = (UINT16*)Next; Next += 0x000008 * sizeof(UINT16); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvLoad5bpp(UINT8 *gfx, INT32 num) +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x20000); + if (tmp == NULL) { + return 1; + } + + if (BurnLoadRom(tmp, num, 1)) return 1; + + for (INT32 len = 0; len < 0x020000; len++) + { + gfx[len*4+0] = ((tmp[len] & 0x20) << 2) | ((tmp[len] & 0x10) >> 1); + gfx[len*4+1] = ((tmp[len] & 0x80) << 0) | ((tmp[len] & 0x40) >> 3); + gfx[len*4+2] = ((tmp[len] & 0x02) << 6) | ((tmp[len] & 0x01) << 3); + gfx[len*4+3] = ((tmp[len] & 0x08) << 4) | ((tmp[len] & 0x04) << 1); + } + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM, 0, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0, 2, 1)) return 1; + if (DrvLoad5bpp(DrvGfxROM0 + 0x80000, 3 )) return 1; + + if (BurnLoadRom(DrvGfxROM1, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3, 6, 1)) return 1; + if (DrvLoad5bpp(DrvGfxROM3 + 0x80000, 7 )) return 1; + + if (BurnLoadRom(DrvSndROM, 8, 1)) return 1; + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvMidRAM, 0xc00000, 0xc00fff, SM_RAM); + SekMapMemory(DrvBakRAM, 0xc01000, 0xc01fff, SM_RAM); + SekMapMemory(DrvTxtRAM, 0xc02000, 0xc03fff, SM_RAM); + SekMapMemory(DrvSprRAM, 0xc80000, 0xc81fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xd00000, 0xd00fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xff0000, 0xffffff, SM_RAM); + SekSetWriteByteHandler(0, aquarium_write_byte); + SekSetWriteWordHandler(0, aquarium_write_word); + SekSetReadByteHandler(0, aquarium_read_byte); + SekSetReadWordHandler(0, aquarium_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM); + ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); + ZetSetOutHandler(aquarium_sound_out); + ZetSetInHandler(aquarium_sound_in); + ZetClose(); + + MSM6295Init(0, 1122000 / 132, 1); + MSM6295SetRoute(0, 0.47, BURN_SND_ROUTE_BOTH); + + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&aquariumYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM2151Exit(); + MSM6295Exit(0); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + return 0; +} + +static inline void palette_write(INT32 offset) +{ + UINT8 r,g,b; + UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset))); + + r = ((data >> 11) & 0x1e) | ((data >> 3) & 0x01); + g = ((data >> 7) & 0x1e) | ((data >> 2) & 0x01); + b = ((data >> 3) & 0x1e) | ((data >> 1) & 0x01); + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); +} + +static void draw_bg_layer(UINT8 *src, UINT8 *gfx_base, INT32 scrollx, INT32 scrolly, INT32 transp, INT32 priority) +{ + UINT16 *vram = (UINT16*)src; + + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 color = BURN_ENDIAN_SWAP_INT16(vram[(offs * 2) + 1]); + INT32 prior = (color & 0x0020) >> 5; + if (prior != priority) continue; + + INT32 sx = (offs & 0x1f) << 4; + INT32 sy = (offs >> 5) << 4; + + sx -= scrollx + 16; + if (sx < -15) sx += 0x200; + sy -= scrolly + 16; + if (sy < -15) sy += 0x200; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 flipx = color & 0x0100; + INT32 flipy = color & 0x0200; + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2]) & 0x0fff; + + if (transp) { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0, 0x400, gfx_base); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0, 0x400, gfx_base); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0, 0x400, gfx_base); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0, 0x400, gfx_base); + } + } + } else { + if (flipy) { + if (flipx) { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0x400, gfx_base); + } else { + Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0x400, gfx_base); + } + } else { + if (flipx) { + Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0x400, gfx_base); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color & 0x001f, 5, 0x400, gfx_base); + } + } + } + } +} + +static void draw_tx_layer(INT32 scrollx, INT32 scrolly) +{ + UINT16 *vram = (UINT16*)DrvTxtRAM; + + for (INT32 offs = 0; offs < 64 * 64; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + sx -= scrollx + 16; + if (sx < -7) sx += 0x200; + sy -= scrolly + 16; + if (sy < -7) sy += 0x200; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0xfff; + INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs]) >> 12; + + if (sx >= nScreenWidth || sy >= nScreenHeight || code == 0) continue; + + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0x200, DrvGfxROM1); + } +} + +static void draw_sprites() +{ + UINT16 *sram = (UINT16*)DrvSprRAM; + + for (INT32 offs = 0; offs < 0x0800; offs += 8) + { + INT32 code = (BURN_ENDIAN_SWAP_INT16(sram[offs+5]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(sram[offs+6]) & 0x3f) << 8); + + if (~BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x80) + { + INT32 x = (((BURN_ENDIAN_SWAP_INT16(sram[offs+0]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(sram[offs+1]) & 0x7f) << 8)) - ((BURN_ENDIAN_SWAP_INT16(sram[offs+1]) & 0x80) << 9)) - 16; + INT32 y = (((BURN_ENDIAN_SWAP_INT16(sram[offs+2]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(sram[offs+3]) & 0x7f) << 8)) - ((BURN_ENDIAN_SWAP_INT16(sram[offs+3]) & 0x80) << 9)) - 16; + + INT32 col = BURN_ENDIAN_SWAP_INT16(sram[offs+7]) & 0x0f; + INT32 chain = BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x07; + INT32 flipy = BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x10; + INT32 flipx = BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x20; + + if (~BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x08) { + if (flipy) y += chain << 4; + if (flipx) x += chain << 4; + } + + for (INT32 pos = chain; pos >= 0; pos--) + { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y, col, 4, 0, 0x300, DrvGfxROM2); + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y + 256, col, 4, 0, 0x300, DrvGfxROM2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y, col, 4, 0, 0x300, DrvGfxROM2); + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y + 256, col, 4, 0, 0x300, DrvGfxROM2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, col, 4, 0, 0x300, DrvGfxROM2); + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y + 256, col, 4, 0, 0x300, DrvGfxROM2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, col, 4, 0, 0x300, DrvGfxROM2); + Render16x16Tile_Mask_Clip(pTransDraw, code, x, y + 256, col, 4, 0, 0x300, DrvGfxROM2); + } + } + + code++; + + if (BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x08) + { + if (flipy) y -= 16; + else y += 16; + } + else + { + if (flipx) x -= 16; + else x += 16; + } + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x1000; i+=2) { + palette_write(i); + } + } + + draw_bg_layer(DrvBakRAM, DrvGfxROM3, DrvScroll[2] & 0x1ff, DrvScroll[3] & 0x1ff, 0, 0); + draw_bg_layer(DrvMidRAM, DrvGfxROM0, DrvScroll[0] & 0x1ff, DrvScroll[1] & 0x1ff, 1, 0); + + draw_sprites(); + + draw_bg_layer(DrvBakRAM, DrvGfxROM3, DrvScroll[2] & 0x1ff, DrvScroll[3] & 0x1ff, 1, 1); + draw_bg_layer(DrvMidRAM, DrvGfxROM0, DrvScroll[0] & 0x1ff, DrvScroll[1] & 0x1ff, 1, 1); + + draw_tx_layer(DrvScroll[4] & 0x1ff, DrvScroll[5] & 0x1ff); + + if (*flipscreen) { + INT32 len = nScreenWidth * nScreenHeight; + for (INT32 i = 0; i < len / 2; i++) { + INT32 t = pTransDraw[i + 0]; + pTransDraw[i + 0] = pTransDraw[len-(1+i)]; + pTransDraw[len-(1+i)] = t; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 4); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + DrvInputs[1] &= 0x7f; + } + + INT32 nSegment; + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 16000000 / 60, 6000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); + nCyclesDone[0] += SekRun(nSegment); + + nSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i); + nCyclesDone[1] += ZetRun(nSegment); + + if (pBurnSoundOut) { + nSegment = nBurnSoundLen / nInterleave; + + BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + + nSoundBufferPos += nSegment; + } + } + + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + nSegment = nBurnSoundLen - nSoundBufferPos; + if (nSegment > 0) { + BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029698; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + sound_bankswitch(*DrvZ80Bank); + ZetClose(); + } + + return 0; +} + + +// Aquarium (Japan) + +static struct BurnRomInfo aquariumRomDesc[] = { + { "aquar3", 0x080000, 0x344509a1, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + + { "aquar5", 0x040000, 0xfa555be1, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code + + { "aquar1", 0x080000, 0x575df6ac, 3 | BRF_GRA }, // 2 Midground Tiles + { "aquar6", 0x020000, 0x9065b146, 3 | BRF_GRA }, // 3 + + { "aquar2", 0x020000, 0xaa071b05, 4 | BRF_GRA }, // 6 Foreground Tiles + + { "aquarf1", 0x100000, 0x14758b3c, 5 | BRF_GRA }, // 7 Sprites + + { "aquar8", 0x080000, 0x915520c4, 6 | BRF_GRA }, // 4 Background Tiles + { "aquar7", 0x020000, 0xb96b2b82, 6 | BRF_GRA }, // 5 + + { "aquar4", 0x080000, 0x9a4af531, 7 | BRF_SND }, // 8 MSM6295 Samples +}; + +STD_ROM_PICK(aquarium) +STD_ROM_FN(aquarium) + +struct BurnDriver BurnDrvAquarium = { + "aquarium", NULL, NULL, NULL, "1996", + "Aquarium (Japan)\0", NULL, "Excellent System", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, aquariumRomInfo, aquariumRomName, NULL, NULL, AquariumInputInfo, AquariumDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 256, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_crospang.cpp b/src/burn/drv/pst90s/d_crospang.cpp index 58ca83a95..0c7caf78f 100644 --- a/src/burn/drv/pst90s/d_crospang.cpp +++ b/src/burn/drv/pst90s/d_crospang.cpp @@ -1,792 +1,791 @@ -// FB Alpha Cross Pang driver module -// Based on MAME driver by Pierpaolo Prazzoli and David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "msm6295.h" -#include "burn_ym3812.h" - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; -static UINT16 DrvInputs[3]; - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvSndROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvFgRAM; -static UINT8 *DrvBgRAM; -static UINT8 *DrvSprRAM; -static UINT32 *DrvPalette; - -static UINT8 *soundlatch; -static UINT8 *tile_bank; -static UINT16 *fg_scroll_x; -static UINT16 *fg_scroll_y; -static UINT16 *bg_scroll_x; -static UINT16 *bg_scroll_y; - -static UINT8 DrvRecalc; - -static INT32 bestri = 0; - -static struct BurnInputInfo CrospangInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 9, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 15, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Crospang) - -static struct BurnDIPInfo CrospangDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0x7e, NULL }, - {0x12, 0xff, 0xff, 0xf7, NULL }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x11, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x03, 0x02, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x03, 0x03, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2, "Number of Powers" }, - {0x11, 0x01, 0x20, 0x00, "1" }, - {0x11, 0x01, 0x20, 0x20, "2" }, - - {0 , 0xfe, 0 , 4, "Extra Balls" }, - {0x11, 0x01, 0xc0, 0xc0, "1" }, - {0x11, 0x01, 0xc0, 0x80, "2" }, - {0x11, 0x01, 0xc0, 0x40, "3" }, - {0x11, 0x01, 0xc0, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Minimum Balls per Row"}, - {0x12, 0x01, 0x18, 0x18, "3" }, - {0x12, 0x01, 0x18, 0x10, "4" }, - {0x12, 0x01, 0x18, 0x08, "5" }, - {0x12, 0x01, 0x18, 0x00, "6" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(Crospang) - -static struct BurnDIPInfo HeuksunDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfe, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x11, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x03, 0x02, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x03, 0x03, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Heuksun) - -static struct BurnDIPInfo BestriDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfb, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x11, 0x01, 0x06, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x06, 0x04, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x06, 0x02, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x06, 0x06, "1 Coin 2 Credits" }, -}; - -STDDIPINFO(Bestri) - -void __fastcall crospang_write_byte(UINT32 address, UINT8 data) -{ - if (bestri == 0) return; - - switch (address) - { - case 0x10000e: - *tile_bank = (data >> 2) & 0x0f; - return; - } -} - -void __fastcall crospang_write_word(UINT32 address, UINT16 data) -{ - if (bestri == 0) { - switch (address) - { - case 0x100002: - *fg_scroll_y = (data + 8) & 0x1ff; - return; - - case 0x100004: - *bg_scroll_x = (data + 4) & 0x1ff; - return; - - case 0x100006: - *bg_scroll_y = (data + 8) & 0x1ff; - return; - - case 0x100008: - *fg_scroll_x = (data + 0) & 0x1ff; - return; - - case 0x270000: - *soundlatch = data & 0xff; - return; - } - } else { - switch (address) - { - case 0x100004: - *fg_scroll_x = ((data ^ 0x0000) + 32) & 0x1ff; - return; - - case 0x100006: - *fg_scroll_y = ((data ^ 0xff54) + 7) & 0x1ff; - return; - - case 0x10000a: - *bg_scroll_y = ((data ^ 0xfeaa) + 7) & 0x1ff; - return; - - case 0x10000c: - *bg_scroll_x = ((data ^ 0x0000) - 60) & 0x1ff; - return; - - case 0x270000: - *soundlatch = data & 0xff; - return; - } - } -} - -UINT8 __fastcall crospang_read_byte(UINT32 address) -{ - switch (address) - { - case 0x280002: - return DrvInputs[1] >> 8; - } - - return 0; -} - -UINT16 __fastcall crospang_read_word(UINT32 address) -{ - switch (address) - { - case 0x280000: - case 0x280002: - case 0x280004: - return DrvInputs[(address >> 1) & 3]; - } - - return 0; -} - -void __fastcall crospang_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - BurnYM3812Write(0, data); - return; - - case 0x01: - BurnYM3812Write(1, data); - return; - - case 0x02: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall crospang_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return BurnYM3812Read(0); - - case 0x02: - return MSM6295ReadStatus(0); - - case 0x06: - return *soundlatch; - } - - return 0; -} - -inline static INT32 crospangSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(ZetTotalCycles() * nSoundRate / 3579545); -} - -void crospangYM3812IrqHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - MSM6295Reset(0); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x100000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x400000; - DrvGfxROM1 = Next; Next += 0x400000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x000800; - DrvFgRAM = Next; Next += 0x000800; - DrvBgRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - tile_bank = Next; Next += 0x000001; - - fg_scroll_x = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); - bg_scroll_x = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); - fg_scroll_y = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); - bg_scroll_y = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode(INT32 gfx0len, INT32 gfx1len, INT32 type) -{ - INT32 Plane0[4] = { ((gfx0len / 2) * 8) + 8, ((gfx0len / 2) * 8) + 0, 8, 0 }; - INT32 Plane1[4] = { ((gfx1len / 2) * 8) + 8, ((gfx1len / 2) * 8) + 0, 8, 0 }; - INT32 XOffs[16] = { 32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7, - 0, 1, 2, 3, 4, 5, 6, 7 }; - INT32 YOffs[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, - 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(((gfx0len - 1) | (gfx1len - 1)) + 1); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < gfx0len; i++) { // rearrange tiles a bit - INT32 k = (type) ? (((i & 0x40000) << 2) | ((i & 0x180000) >> 1) | (i & 0x3ffff)) : i; - tmp[k ^ (gfx0len/2) ^ 0x20] = DrvGfxROM0[i]; - } - - GfxDecode((gfx0len * 2) / (16 * 16), 4, 16, 16, Plane0, XOffs, YOffs, 0x200, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, gfx1len); - - GfxDecode((gfx1len * 2) / (16 * 16), 4, 16, 16, Plane1, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 crospangLoadRoms() -{ - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100001, 9, 2)) return 1; - - DrvGfxDecode(0x80000, 0x200000, 0); - - return 0; -} - -static INT32 heuksunLoadRoms() -{ - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080001, 9, 2)) return 1; - - DrvGfxDecode(0x200000, 0x100000, 1); - - return 0; -} - -static INT32 bestriLoadRoms() -{ - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100001, 7, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100001, 11, 2)) return 1; - - DrvGfxDecode(0x200000, 0x200000, 1); - - return 0; -} - -static INT32 DrvInit(INT32 (*pRomLoadCallback)()) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000000, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000001, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - if (BurnLoadRom(DrvSndROM, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 5, 2)) return 1; - - if (pRomLoadCallback) { - if (pRomLoadCallback()) return 1; - } - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(DrvFgRAM, 0x120000, 0x1207ff, SM_RAM); - SekMapMemory(DrvBgRAM, 0x122000, 0x1227ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x200000, 0x2005ff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x210000, 0x2107ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x320000, 0x32ffff, SM_RAM); // crospang, heuksun - SekMapMemory(Drv68KRAM, 0x3a0000, 0x3affff, SM_RAM); // bestri - SekSetWriteByteHandler(0, crospang_write_byte); - SekSetWriteWordHandler(0, crospang_write_word); - SekSetReadByteHandler(0, crospang_read_byte); - SekSetReadWordHandler(0, crospang_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); - ZetSetOutHandler(crospang_sound_out); - ZetSetInHandler(crospang_sound_in); - ZetMemEnd(); - ZetClose(); - - BurnYM3812Init(3579545, &crospangYM3812IrqHandler, crospangSynchroniseStream, 0); - BurnTimerAttachZetYM3812(3579545); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 1056000 / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM3812Exit(); - MSM6295Exit(0); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - bestri = 0; - - return 0; -} - -static void draw_layer(UINT8 *src, INT32 coloffs, INT32 scrollx, INT32 scrolly, INT32 transp) -{ - UINT16 *vram = (UINT16*)src; - - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 4; - INT32 sy = (offs >> 5) << 4; - - sx -= scrollx; - if (sx < -15) sx += 0x200; - sy -= scrolly; - if (sy < -15) sy += 0x200; - - if (sy >= nScreenHeight || sx >= nScreenWidth) continue; - - INT32 data = BURN_ENDIAN_SWAP_INT16(vram[offs]); - INT32 code = (data & 0xfff) + (*tile_bank << 12); - INT32 color = (data >> 12) + coloffs; - - if (transp) { - if (!(code&0xfff)) continue; - - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } - } -} - -static void draw_sprites() -{ - UINT16 *ram = (UINT16*)DrvSprRAM; - - for (INT32 offs = 0;offs < 0x400;offs += 4) - { - INT32 sprite = BURN_ENDIAN_SWAP_INT16(ram[offs + 1]) & 0x7fff; - if (!sprite) continue; - - INT32 y = BURN_ENDIAN_SWAP_INT16(ram[offs]); - if ((y & 0x1000) && (GetCurrentFrame() & 1)) continue; // flash - - INT32 x = BURN_ENDIAN_SWAP_INT16(ram[offs + 2]); - INT32 color = (x >>9) & 0xf; - - INT32 fx = y & 0x2000; - INT32 fy = y & 0x4000; - INT32 multi = (1 << ((y & 0x0600) >> 9)) - 1; - - x &= 0x01ff; - y &= 0x01ff; - if (x >= 320) x -= 512; - if (y >= 256) y -= 512; - y = (240 - y) - 7; - x = (304 - x) - 5; - - INT32 inc = -1; - - if (!fy) - { - sprite += multi; - inc = 1; - } - - while (multi >= 0) - { - if (fy) { - if (fx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); - } - } else { - if (fx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); - } - } - - multi--; - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - UINT8 r,g,b; - UINT16 *pal = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x300; i++) { - r = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 10) & 0x1f; - g = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 5) & 0x1f; - b = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } - } - - draw_layer(DrvBgRAM, 0x20, *bg_scroll_x, *bg_scroll_y, 0); - draw_layer(DrvFgRAM, 0x10, *fg_scroll_x, *fg_scroll_y, 1); - - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = DrvInputs[1] = 0xffff; - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - - DrvInputs[2] = (DrvDips[1] << 8) | DrvDips[0]; - } - - INT32 nTotalCycles[2] = { 7159090 / 60, 3579545 / 60 }; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - SekRun(nTotalCycles[0]); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - BurnTimerEndFrameYM3812(nTotalCycles[1]); - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029698; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM3812Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - } - - return 0; -} - - -// Cross Pang - -static struct BurnRomInfo crospangRomDesc[] = { - { "p1.bin", 0x20000, 0x0bcbbaad, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "p2.bin", 0x20000, 0x0947d204, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "s1.bin", 0x10000, 0xd61a224c, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "s2.bin", 0x20000, 0x9f9ecd22, 3 | BRF_SND }, // 3 Oki Samples - - { "rom1.bin", 0x40000, 0x905042bb, 4 | BRF_GRA }, // 4 Background Tiles - { "rom2.bin", 0x40000, 0xbc4381e9, 4 | BRF_GRA }, // 5 - - { "rom3.bin", 0x80000, 0xcc6e1fce, 5 | BRF_GRA }, // 6 Sprites - { "rom4.bin", 0x80000, 0x9a91d494, 5 | BRF_GRA }, // 7 - { "rom5.bin", 0x80000, 0x53a34dc5, 5 | BRF_GRA }, // 8 - { "rom6.bin", 0x80000, 0x9c633082, 5 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(crospang) -STD_ROM_FN(crospang) - -static INT32 crospangInit() -{ - return DrvInit(crospangLoadRoms); -} - -struct BurnDriver BurnDrvCrospang = { - "crospang", NULL, NULL, NULL, "1998", - "Cross Pang\0", NULL, "F2 System", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, crospangRomInfo, crospangRomName, NULL, NULL, CrospangInputInfo, CrospangDIPInfo, - crospangInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, - 320, 240, 4, 3 -}; - - -// Heuk Sun Baek Sa (Korea) - -static struct BurnRomInfo heuksunRomDesc[] = { - { "ua02.j3", 0x80000, 0xdb2b9c8e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ua03.j5", 0x80000, 0xde9f01e8, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "us02.r4", 0x10000, 0xc7cc05fa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "us08.u7", 0x40000, 0xae177589, 3 | BRF_SND }, // 3 Oki Samples - - { "uc07.t11", 0x80000, 0x4d1ed885, 4 | BRF_GRA }, // 4 Background Tiles - { "uc08.r11", 0x80000, 0x242cee69, 4 | BRF_GRA }, // 5 - - { "ud14.p11", 0x40000, 0x4fc2b574, 5 | BRF_GRA }, // 6 Sprites - { "ud15.m11", 0x40000, 0x1d6187a6, 5 | BRF_GRA }, // 7 - { "ud16.l11", 0x40000, 0xeabec43e, 5 | BRF_GRA }, // 8 - { "ud17.j11", 0x40000, 0xc6b04171, 5 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(heuksun) -STD_ROM_FN(heuksun) - -static INT32 heuksunInit() -{ - return DrvInit(heuksunLoadRoms); -} - -struct BurnDriver BurnDrvHeuksun = { - "heuksun", NULL, NULL, NULL, "199?", - "Heuk Sun Baek Sa (Korea)\0", NULL, "Oksan / F2 System", "Miscellaneous", - L"\uD751\uC120\uBC31\uC0AC (Korea)\0Heuk Sun Baek Sa\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MISC, 0, - NULL, heuksunRomInfo, heuksunRomName, NULL, NULL, CrospangInputInfo, HeuksunDIPInfo, - heuksunInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, - 320, 240, 4, 3 -}; - - -// Bestri (Korea) - -static struct BurnRomInfo bestriRomDesc[] = { - { "ua02.i3", 0x80000, 0x9e94023d, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ua03.i5", 0x80000, 0x08cfa8d8, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "us02.p3", 0x10000, 0xc7cc05fa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "us08.q7", 0x40000, 0x85d8f3de, 3 | BRF_SND }, // 3 Oki Samples - - { "uc07 p12", 0x80000, 0x3d299954, 4 | BRF_GRA }, // 4 Background Tiles - { "uc08.m12", 0x80000, 0x2fc0c30e, 4 | BRF_GRA }, // 5 - { "uc29.k12", 0x80000, 0x0260c321, 4 | BRF_GRA }, // 6 - { "uc28.n12", 0x80000, 0x9938be27, 4 | BRF_GRA }, // 7 - - { "ud14.j12", 0x80000, 0x141c696e, 5 | BRF_GRA }, // 8 Sprites - { "ud15.h12", 0x80000, 0x7c04adc0, 5 | BRF_GRA }, // 9 - { "ud16.g12", 0x80000, 0x3282ea76, 5 | BRF_GRA }, // 10 - { "ud17.e12", 0x80000, 0x3a3a3f1a, 5 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(bestri) -STD_ROM_FN(bestri) - -static INT32 bestriInit() -{ - bestri = 1; - - return DrvInit(bestriLoadRoms); -} - -struct BurnDriver BurnDrvBestri = { - "bestri", NULL, NULL, NULL, "1998", - "Bestri (Korea)\0", NULL, "F2 System", "Miscellaneous", - L"Bestri\0\uBCA0\uC2A4\uD2B8\uB77C\uC774 (Korea)\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, bestriRomInfo, bestriRomName, NULL, NULL, CrospangInputInfo, BestriDIPInfo, - bestriInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, - 320, 240, 4, 3 -}; +// FB Alpha Cross Pang driver module +// Based on MAME driver by Pierpaolo Prazzoli and David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "msm6295.h" +#include "burn_ym3812.h" + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; +static UINT16 DrvInputs[3]; + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvSndROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvFgRAM; +static UINT8 *DrvBgRAM; +static UINT8 *DrvSprRAM; +static UINT32 *DrvPalette; + +static UINT8 *soundlatch; +static UINT8 *tile_bank; +static UINT16 *fg_scroll_x; +static UINT16 *fg_scroll_y; +static UINT16 *bg_scroll_x; +static UINT16 *bg_scroll_y; + +static UINT8 DrvRecalc; + +static INT32 bestri = 0; + +static struct BurnInputInfo CrospangInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 9, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 15, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Crospang) + +static struct BurnDIPInfo CrospangDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0x7e, NULL }, + {0x12, 0xff, 0xff, 0xf7, NULL }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x11, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x03, 0x02, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x03, 0x03, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2, "Number of Powers" }, + {0x11, 0x01, 0x20, 0x00, "1" }, + {0x11, 0x01, 0x20, 0x20, "2" }, + + {0 , 0xfe, 0 , 4, "Extra Balls" }, + {0x11, 0x01, 0xc0, 0xc0, "1" }, + {0x11, 0x01, 0xc0, 0x80, "2" }, + {0x11, 0x01, 0xc0, 0x40, "3" }, + {0x11, 0x01, 0xc0, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Minimum Balls per Row"}, + {0x12, 0x01, 0x18, 0x18, "3" }, + {0x12, 0x01, 0x18, 0x10, "4" }, + {0x12, 0x01, 0x18, 0x08, "5" }, + {0x12, 0x01, 0x18, 0x00, "6" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(Crospang) + +static struct BurnDIPInfo HeuksunDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfe, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x11, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x03, 0x02, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x03, 0x03, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Heuksun) + +static struct BurnDIPInfo BestriDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfb, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x11, 0x01, 0x06, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x06, 0x04, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x06, 0x02, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x06, 0x06, "1 Coin 2 Credits" }, +}; + +STDDIPINFO(Bestri) + +void __fastcall crospang_write_byte(UINT32 address, UINT8 data) +{ + if (bestri == 0) return; + + switch (address) + { + case 0x10000e: + *tile_bank = (data >> 2) & 0x0f; + return; + } +} + +void __fastcall crospang_write_word(UINT32 address, UINT16 data) +{ + if (bestri == 0) { + switch (address) + { + case 0x100002: + *fg_scroll_y = (data + 8) & 0x1ff; + return; + + case 0x100004: + *bg_scroll_x = (data + 4) & 0x1ff; + return; + + case 0x100006: + *bg_scroll_y = (data + 8) & 0x1ff; + return; + + case 0x100008: + *fg_scroll_x = (data + 0) & 0x1ff; + return; + + case 0x270000: + *soundlatch = data & 0xff; + return; + } + } else { + switch (address) + { + case 0x100004: + *fg_scroll_x = ((data ^ 0x0000) + 32) & 0x1ff; + return; + + case 0x100006: + *fg_scroll_y = ((data ^ 0xff54) + 7) & 0x1ff; + return; + + case 0x10000a: + *bg_scroll_y = ((data ^ 0xfeaa) + 7) & 0x1ff; + return; + + case 0x10000c: + *bg_scroll_x = ((data ^ 0x0000) - 60) & 0x1ff; + return; + + case 0x270000: + *soundlatch = data & 0xff; + return; + } + } +} + +UINT8 __fastcall crospang_read_byte(UINT32 address) +{ + switch (address) + { + case 0x280002: + return DrvInputs[1] >> 8; + } + + return 0; +} + +UINT16 __fastcall crospang_read_word(UINT32 address) +{ + switch (address) + { + case 0x280000: + case 0x280002: + case 0x280004: + return DrvInputs[(address >> 1) & 3]; + } + + return 0; +} + +void __fastcall crospang_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + BurnYM3812Write(0, data); + return; + + case 0x01: + BurnYM3812Write(1, data); + return; + + case 0x02: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall crospang_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return BurnYM3812Read(0); + + case 0x02: + return MSM6295ReadStatus(0); + + case 0x06: + return *soundlatch; + } + + return 0; +} + +inline static INT32 crospangSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(ZetTotalCycles() * nSoundRate / 3579545); +} + +void crospangYM3812IrqHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + MSM6295Reset(0); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x100000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x400000; + DrvGfxROM1 = Next; Next += 0x400000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x000800; + DrvFgRAM = Next; Next += 0x000800; + DrvBgRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + tile_bank = Next; Next += 0x000001; + + fg_scroll_x = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); + bg_scroll_x = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); + fg_scroll_y = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); + bg_scroll_y = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode(INT32 gfx0len, INT32 gfx1len, INT32 type) +{ + INT32 Plane0[4] = { ((gfx0len / 2) * 8) + 8, ((gfx0len / 2) * 8) + 0, 8, 0 }; + INT32 Plane1[4] = { ((gfx1len / 2) * 8) + 8, ((gfx1len / 2) * 8) + 0, 8, 0 }; + INT32 XOffs[16] = { 32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7, + 0, 1, 2, 3, 4, 5, 6, 7 }; + INT32 YOffs[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, + 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(((gfx0len - 1) | (gfx1len - 1)) + 1); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < gfx0len; i++) { // rearrange tiles a bit + INT32 k = (type) ? (((i & 0x40000) << 2) | ((i & 0x180000) >> 1) | (i & 0x3ffff)) : i; + tmp[k ^ (gfx0len/2) ^ 0x20] = DrvGfxROM0[i]; + } + + GfxDecode((gfx0len * 2) / (16 * 16), 4, 16, 16, Plane0, XOffs, YOffs, 0x200, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, gfx1len); + + GfxDecode((gfx1len * 2) / (16 * 16), 4, 16, 16, Plane1, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 crospangLoadRoms() +{ + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100001, 9, 2)) return 1; + + DrvGfxDecode(0x80000, 0x200000, 0); + + return 0; +} + +static INT32 heuksunLoadRoms() +{ + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080001, 9, 2)) return 1; + + DrvGfxDecode(0x200000, 0x100000, 1); + + return 0; +} + +static INT32 bestriLoadRoms() +{ + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100001, 7, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100001, 11, 2)) return 1; + + DrvGfxDecode(0x200000, 0x200000, 1); + + return 0; +} + +static INT32 DrvInit(INT32 (*pRomLoadCallback)()) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000000, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000001, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + if (BurnLoadRom(DrvSndROM, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 5, 2)) return 1; + + if (pRomLoadCallback) { + if (pRomLoadCallback()) return 1; + } + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(DrvFgRAM, 0x120000, 0x1207ff, SM_RAM); + SekMapMemory(DrvBgRAM, 0x122000, 0x1227ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x200000, 0x2005ff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x210000, 0x2107ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x320000, 0x32ffff, SM_RAM); // crospang, heuksun + SekMapMemory(Drv68KRAM, 0x3a0000, 0x3affff, SM_RAM); // bestri + SekSetWriteByteHandler(0, crospang_write_byte); + SekSetWriteWordHandler(0, crospang_write_word); + SekSetReadByteHandler(0, crospang_read_byte); + SekSetReadWordHandler(0, crospang_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); + ZetSetOutHandler(crospang_sound_out); + ZetSetInHandler(crospang_sound_in); + ZetClose(); + + BurnYM3812Init(3579545, &crospangYM3812IrqHandler, crospangSynchroniseStream, 0); + BurnTimerAttachZetYM3812(3579545); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 1056000 / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM3812Exit(); + MSM6295Exit(0); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + bestri = 0; + + return 0; +} + +static void draw_layer(UINT8 *src, INT32 coloffs, INT32 scrollx, INT32 scrolly, INT32 transp) +{ + UINT16 *vram = (UINT16*)src; + + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 4; + INT32 sy = (offs >> 5) << 4; + + sx -= scrollx; + if (sx < -15) sx += 0x200; + sy -= scrolly; + if (sy < -15) sy += 0x200; + + if (sy >= nScreenHeight || sx >= nScreenWidth) continue; + + INT32 data = BURN_ENDIAN_SWAP_INT16(vram[offs]); + INT32 code = (data & 0xfff) + (*tile_bank << 12); + INT32 color = (data >> 12) + coloffs; + + if (transp) { + if (!(code&0xfff)) continue; + + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } + } +} + +static void draw_sprites() +{ + UINT16 *ram = (UINT16*)DrvSprRAM; + + for (INT32 offs = 0;offs < 0x400;offs += 4) + { + INT32 sprite = BURN_ENDIAN_SWAP_INT16(ram[offs + 1]) & 0x7fff; + if (!sprite) continue; + + INT32 y = BURN_ENDIAN_SWAP_INT16(ram[offs]); + if ((y & 0x1000) && (GetCurrentFrame() & 1)) continue; // flash + + INT32 x = BURN_ENDIAN_SWAP_INT16(ram[offs + 2]); + INT32 color = (x >>9) & 0xf; + + INT32 fx = y & 0x2000; + INT32 fy = y & 0x4000; + INT32 multi = (1 << ((y & 0x0600) >> 9)) - 1; + + x &= 0x01ff; + y &= 0x01ff; + if (x >= 320) x -= 512; + if (y >= 256) y -= 512; + y = (240 - y) - 7; + x = (304 - x) - 5; + + INT32 inc = -1; + + if (!fy) + { + sprite += multi; + inc = 1; + } + + while (multi >= 0) + { + if (fy) { + if (fx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); + } + } else { + if (fx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); + } + } + + multi--; + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + UINT8 r,g,b; + UINT16 *pal = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x300; i++) { + r = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 10) & 0x1f; + g = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 5) & 0x1f; + b = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } + } + + draw_layer(DrvBgRAM, 0x20, *bg_scroll_x, *bg_scroll_y, 0); + draw_layer(DrvFgRAM, 0x10, *fg_scroll_x, *fg_scroll_y, 1); + + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = DrvInputs[1] = 0xffff; + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + + DrvInputs[2] = (DrvDips[1] << 8) | DrvDips[0]; + } + + INT32 nTotalCycles[2] = { 7159090 / 60, 3579545 / 60 }; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + SekRun(nTotalCycles[0]); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + BurnTimerEndFrameYM3812(nTotalCycles[1]); + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029698; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM3812Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + } + + return 0; +} + + +// Cross Pang + +static struct BurnRomInfo crospangRomDesc[] = { + { "p1.bin", 0x20000, 0x0bcbbaad, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "p2.bin", 0x20000, 0x0947d204, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "s1.bin", 0x10000, 0xd61a224c, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "s2.bin", 0x20000, 0x9f9ecd22, 3 | BRF_SND }, // 3 Oki Samples + + { "rom1.bin", 0x40000, 0x905042bb, 4 | BRF_GRA }, // 4 Background Tiles + { "rom2.bin", 0x40000, 0xbc4381e9, 4 | BRF_GRA }, // 5 + + { "rom3.bin", 0x80000, 0xcc6e1fce, 5 | BRF_GRA }, // 6 Sprites + { "rom4.bin", 0x80000, 0x9a91d494, 5 | BRF_GRA }, // 7 + { "rom5.bin", 0x80000, 0x53a34dc5, 5 | BRF_GRA }, // 8 + { "rom6.bin", 0x80000, 0x9c633082, 5 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(crospang) +STD_ROM_FN(crospang) + +static INT32 crospangInit() +{ + return DrvInit(crospangLoadRoms); +} + +struct BurnDriver BurnDrvCrospang = { + "crospang", NULL, NULL, NULL, "1998", + "Cross Pang\0", NULL, "F2 System", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, crospangRomInfo, crospangRomName, NULL, NULL, CrospangInputInfo, CrospangDIPInfo, + crospangInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, + 320, 240, 4, 3 +}; + + +// Heuk Sun Baek Sa (Korea) + +static struct BurnRomInfo heuksunRomDesc[] = { + { "ua02.j3", 0x80000, 0xdb2b9c8e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ua03.j5", 0x80000, 0xde9f01e8, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "us02.r4", 0x10000, 0xc7cc05fa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "us08.u7", 0x40000, 0xae177589, 3 | BRF_SND }, // 3 Oki Samples + + { "uc07.t11", 0x80000, 0x4d1ed885, 4 | BRF_GRA }, // 4 Background Tiles + { "uc08.r11", 0x80000, 0x242cee69, 4 | BRF_GRA }, // 5 + + { "ud14.p11", 0x40000, 0x4fc2b574, 5 | BRF_GRA }, // 6 Sprites + { "ud15.m11", 0x40000, 0x1d6187a6, 5 | BRF_GRA }, // 7 + { "ud16.l11", 0x40000, 0xeabec43e, 5 | BRF_GRA }, // 8 + { "ud17.j11", 0x40000, 0xc6b04171, 5 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(heuksun) +STD_ROM_FN(heuksun) + +static INT32 heuksunInit() +{ + return DrvInit(heuksunLoadRoms); +} + +struct BurnDriver BurnDrvHeuksun = { + "heuksun", NULL, NULL, NULL, "199?", + "Heuk Sun Baek Sa (Korea)\0", NULL, "Oksan / F2 System", "Miscellaneous", + L"\uD751\uC120\uBC31\uC0AC (Korea)\0Heuk Sun Baek Sa\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MISC, 0, + NULL, heuksunRomInfo, heuksunRomName, NULL, NULL, CrospangInputInfo, HeuksunDIPInfo, + heuksunInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, + 320, 240, 4, 3 +}; + + +// Bestri (Korea) + +static struct BurnRomInfo bestriRomDesc[] = { + { "ua02.i3", 0x80000, 0x9e94023d, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ua03.i5", 0x80000, 0x08cfa8d8, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "us02.p3", 0x10000, 0xc7cc05fa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "us08.q7", 0x40000, 0x85d8f3de, 3 | BRF_SND }, // 3 Oki Samples + + { "uc07 p12", 0x80000, 0x3d299954, 4 | BRF_GRA }, // 4 Background Tiles + { "uc08.m12", 0x80000, 0x2fc0c30e, 4 | BRF_GRA }, // 5 + { "uc29.k12", 0x80000, 0x0260c321, 4 | BRF_GRA }, // 6 + { "uc28.n12", 0x80000, 0x9938be27, 4 | BRF_GRA }, // 7 + + { "ud14.j12", 0x80000, 0x141c696e, 5 | BRF_GRA }, // 8 Sprites + { "ud15.h12", 0x80000, 0x7c04adc0, 5 | BRF_GRA }, // 9 + { "ud16.g12", 0x80000, 0x3282ea76, 5 | BRF_GRA }, // 10 + { "ud17.e12", 0x80000, 0x3a3a3f1a, 5 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(bestri) +STD_ROM_FN(bestri) + +static INT32 bestriInit() +{ + bestri = 1; + + return DrvInit(bestriLoadRoms); +} + +struct BurnDriver BurnDrvBestri = { + "bestri", NULL, NULL, NULL, "1998", + "Bestri (Korea)\0", NULL, "F2 System", "Miscellaneous", + L"Bestri\0\uBCA0\uC2A4\uD2B8\uB77C\uC774 (Korea)\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, bestriRomInfo, bestriRomName, NULL, NULL, CrospangInputInfo, BestriDIPInfo, + bestriInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_crshrace.cpp b/src/burn/drv/pst90s/d_crshrace.cpp index 99d760a0e..2061f7d4d 100644 --- a/src/burn/drv/pst90s/d_crshrace.cpp +++ b/src/burn/drv/pst90s/d_crshrace.cpp @@ -1,892 +1,891 @@ -// FB Alpha Lethal Crash Race driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2610.h" - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvDips[4]; -static UINT16 DrvInputs[6]; -static UINT8 DrvReset; - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvVidRAM1; -static UINT8 *DrvVidRAM2; -static UINT8 *DrvSprRAM1; -static UINT8 *DrvSprRAM2; -static UINT8 *DrvSprBuf1a; -static UINT8 *DrvSprBuf2a; -static UINT8 *DrvSprBuf1b; -static UINT8 *DrvSprBuf2b; -static UINT8 *DrvZ80RAM; -static UINT16 *DrvGfxCtrl; -static UINT16 *DrvBgTmp; -static UINT32 *DrvPalette; - -static UINT8 DrvRecalc; - -static UINT8 *nSoundBank; -static UINT8 *pending_command; -static UINT8 *roz_bank; -static UINT8 *gfx_priority; -static UINT8 *soundlatch; -static UINT8 *flipscreen; - -static struct BurnInputInfo CrshraceInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 11, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 9, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 12, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"P3 Coin", BIT_DIGITAL, DrvJoy1 + 10, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, DrvJoy3 + 7, "p3 start" }, - {"P3 Up", BIT_DIGITAL, DrvJoy3 + 0, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy3 + 1, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy3 + 2, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy3 + 3, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p3 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 15, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 14, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, - {"Region", BIT_DIPSWITCH, DrvDips + 3, "dip" }, -}; - -STDINPUTINFO(Crshrace) - -static struct BurnDIPInfo CrshraceDIPList[]= -{ - {0x1e, 0xff, 0xff, 0xff, NULL }, - {0x1f, 0xff, 0xff, 0xff, NULL }, - {0x20, 0xff, 0xff, 0xff, NULL }, - {0x21, 0xff, 0xff, 0x01, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x1e, 0x01, 0x01, 0x01, "Off" }, -// {0x1e, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x1e, 0x01, 0x02, 0x00, "Off" }, - {0x1e, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x1e, 0x01, 0x04, 0x04, "Off" }, - {0x1e, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x1e, 0x01, 0x08, 0x08, "Off" }, - {0x1e, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x1e, 0x01, 0xc0, 0x80, "Easy" }, - {0x1e, 0x01, 0xc0, 0xc0, "Normal" }, - {0x1e, 0x01, 0xc0, 0x40, "Hard" }, - {0x1e, 0x01, 0xc0, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Coin Slot" }, - {0x1f, 0x01, 0x01, 0x01, "Same" }, - {0x1f, 0x01, 0x01, 0x00, "Individual" }, - - // Coinage condition: Coin Slot Individual - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x1f, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, - {0x1f, 0x00, 0x01, 0x00, NULL}, - {0x1f, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, - {0x1f, 0x00, 0x01, 0x00, NULL}, - {0x1f, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, - {0x1f, 0x00, 0x01, 0x00, NULL}, - {0x1f, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, - {0x1f, 0x00, 0x01, 0x00, NULL}, - {0x1f, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, - {0x1f, 0x00, 0x01, 0x00, NULL}, - {0x1f, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, - {0x1f, 0x00, 0x01, 0x00, NULL}, - {0x1f, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, - {0x1f, 0x00, 0x01, 0x00, NULL}, - {0x1f, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, - {0x1f, 0x00, 0x01, 0x00, NULL}, - - // Coin A condition: Coin Slot Same - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x1f, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - - // Coin B condition: Coin Slot Same - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x1f, 0x02, 0x70, 0x50, "3 Coins 1 Credit" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x70, 0x40, "1 Coin 2 Credits" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x70, 0x30, "1 Coin 3 Credits" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x70, 0x20, "1 Coin 4 Credits" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x70, 0x10, "1 Coin 5 Credits" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - {0x1f, 0x02, 0x70, 0x00, "1 Coin 6 Credits" }, - {0x1f, 0x00, 0x01, 0x01, NULL}, - - {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, - {0x1f, 0x01, 0x80, 0x80, "Off" }, - {0x1f, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Reset on P.O.S.T. Error" }, - {0x20, 0x01, 0x80, 0x00, "No" }, - {0x20, 0x01, 0x80, 0x80, "Yes" }, - - {0 , 0xfe, 0 , 5, "Country" }, - {0x21, 0x01, 0x0f, 0x01, "World" }, - {0x21, 0x01, 0x0f, 0x08, "USA & Canada" }, - {0x21, 0x01, 0x0f, 0x00, "Japan" }, - {0x21, 0x01, 0x0f, 0x02, "Korea" }, - {0x21, 0x01, 0x0f, 0x04, "Hong Kong & Taiwan" }, -}; - -STDDIPINFO(Crshrace) - -static void crshrace_drawtile(INT32 offset) -{ - INT32 sx = (offset & 0x3f) << 4; - INT32 sy = (offset >> 6) << 4; - - INT32 code = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRAM1 + (offset << 1)))); - INT32 color = code >> 12; - code = (code & 0xfff) | (*roz_bank << 12); - color = (color << 4) | 0x100; - - UINT8 *src = DrvGfxROM1 + (code << 8); - UINT16 *dst = DrvBgTmp + (sy << 10) + sx; - - for (INT32 y = 0; y < 16; y++) { - for (INT32 x = 0; x < 16; x++) { - INT32 pxl = *src++; - if (pxl == 0x0f) pxl = ~0; - - dst[x] = BURN_ENDIAN_SWAP_INT16(pxl | color); - } - dst += 1024; - } -} - -void __fastcall crshrace_write_word(UINT32 address, UINT16 data) -{ - if (address >= 0xfff020 && address <= 0xfff03f) { // K053936_0_ctrl - DrvGfxCtrl[(address & 0x1f)/2] = BURN_ENDIAN_SWAP_INT16(data); - return; - } - - if ((address & 0xfffe000) == 0xd00000) { - *((UINT16*)(DrvVidRAM1 + (address & 0x1ffe))) = BURN_ENDIAN_SWAP_INT16(data); - crshrace_drawtile((address & 0x1ffe)/2); - return; - } -} - -void __fastcall crshrace_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfffe000) == 0xd00000) { - DrvVidRAM1[(address & 0x1fff) ^ 1] = data; - crshrace_drawtile((address & 0x1ffe)/2); - return; - } - - switch (address) - { - case 0xffc001: - *roz_bank = data; - return; - - case 0xfff001: - *gfx_priority = data & 0xdf; - *flipscreen = data & 0x20; - return; - - case 0xfff009: - *pending_command = 1; - *soundlatch = data; - ZetNmi(); - return; - } -} - -UINT16 __fastcall crshrace_read_word(UINT32) -{ - return 0; -} - -UINT8 __fastcall crshrace_read_byte(UINT32 address) -{ - switch (address) - { - case 0xfff000: - return DrvInputs[0] >> 8; - - case 0xfff001: - return DrvInputs[0]; - - case 0xfff002: - return DrvInputs[1] >> 8; - - case 0xfff003: - return DrvInputs[1]; - - case 0xfff004: - return DrvDips[1]; - - case 0xfff005: - return DrvDips[0]; - - case 0xfff00b: - return DrvDips[2]; - - case 0xfff00f: - return DrvInputs[2]; - - case 0xfff006: - return DrvDips[3] | (*pending_command << 7); - } - - return 0; -} - -static void sound_bankswitch(INT32 bank) -{ - *nSoundBank = bank & 0x03; - INT32 nBank = (*nSoundBank & 0x03) << 15; - - ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + nBank); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + nBank); -} - -void __fastcall crshrace_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - sound_bankswitch(data); - return; - - case 0x04: - *pending_command = 0; - return; - - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - BurnYM2610Write(port & 3, data); - return; - } -} - -UINT8 __fastcall crshrace_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x04: - return *soundlatch; - - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - return BurnYM2610Read(port & 3); - } - - return 0; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000.0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x300000; - DrvZ80ROM = Next; Next += 0x020000; - - DrvGfxROM0 = Next; Next += 0x100000; - DrvGfxROM1 = Next; Next += 0x800000; - DrvGfxROM2 = Next; Next += 0x800000; - - DrvSndROM = Next; Next += 0x200000; - - DrvPalette = (UINT32 *)Next; Next += 0x000401 * sizeof(UINT32); - DrvBgTmp = (UINT16*)Next; Next += 0x100000 * sizeof(UINT16); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x001000; - DrvVidRAM1 = Next; Next += 0x002000; - DrvVidRAM2 = Next; Next += 0x001000; - - DrvSprRAM1 = Next; Next += 0x002000; - DrvSprRAM2 = Next; Next += 0x010000; - - DrvSprBuf1a = Next; Next += 0x002000; - DrvSprBuf2a = Next; Next += 0x010000; - DrvSprBuf1b = Next; Next += 0x002000; - DrvSprBuf2b = Next; Next += 0x010000; - - DrvZ80RAM = Next; Next += 0x000800; - - nSoundBank = Next; Next += 0x000001; - roz_bank = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - gfx_priority = Next; Next += 0x000001; - pending_command = Next; Next += 0x000001; - - DrvGfxCtrl = (UINT16*)Next; Next += 0x000010 * sizeof(UINT16); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - memset (DrvBgTmp, 0xff, 0x200000); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2610Reset(); - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[8] = { 0x000, 0x001, 0x002, 0x003 }; - INT32 XOffs[16] = { 0x004, 0x000, 0x00c, 0x008, 0x014, 0x010, 0x01c, 0x018, - 0x024, 0x020, 0x02c, 0x028, 0x034, 0x030, 0x03c, 0x038 }; - INT32 YOffs[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, - 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x400000); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x300000; i++) { - tmp[i^1] = (DrvGfxROM1[i] << 4) | (DrvGfxROM1[i] >> 4); - } - - GfxDecode(0x6000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x400000); - - GfxDecode(0x8000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x0000000, 0, 1)) return 1; - if (BurnLoadRom(Drv68KROM + 0x0100000, 1, 1)) return 1; - if (BurnLoadRom(Drv68KROM + 0x0200000, 2, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x200000, 9, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x0000000, 10, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x0100000, 11, 1)) return 1; - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Drv68KROM + 0x100000, 0x300000, 0x3fffff, SM_ROM); - SekMapMemory(Drv68KROM + 0x200000, 0x400000, 0x4fffff, SM_ROM); - SekMapMemory(Drv68KROM + 0x200000, 0x500000, 0x5fffff, SM_ROM); - SekMapMemory(DrvSprRAM2, 0xa00000, 0xa0ffff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0xd00000, 0xd01fff, SM_ROM); - SekMapMemory(DrvSprRAM1, 0xe00000, 0xe01fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xfe0000, 0xfeffff, SM_RAM); - SekMapMemory(DrvVidRAM2, 0xffd000, 0xffdfff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xffe000, 0xffefff, SM_RAM); - SekSetWriteWordHandler(0, crshrace_write_word); - SekSetWriteByteHandler(0, crshrace_write_byte); - SekSetReadWordHandler(0, crshrace_read_word); - SekSetReadByteHandler(0, crshrace_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x77ff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x77ff, 2, DrvZ80ROM); - ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); - ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + 0x10000); - ZetMapArea(0x8000, 0xffff, 1, DrvZ80ROM + 0x10000); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + 0x10000); - ZetSetOutHandler(crshrace_sound_out); - ZetSetInHandler(crshrace_sound_in); - ZetMemEnd(); - ZetClose(); - - INT32 DrvSndROMLen = 0x100000; - BurnYM2610Init(8000000, DrvSndROM + 0x100000, &DrvSndROMLen, DrvSndROM, &DrvSndROMLen, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM2610Exit(); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_sprites() -{ - INT32 offs = 0; - UINT16 *sprbuf1 = (UINT16*)DrvSprBuf1a; - UINT16 *sprbuf2 = (UINT16*)DrvSprBuf2a; - - static const INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; - - while (offs < 0x0400 && (BURN_ENDIAN_SWAP_INT16(sprbuf1[offs]) & 0x4000) == 0) - { - INT32 attr_start = 4 * (BURN_ENDIAN_SWAP_INT16(sprbuf1[offs++]) & 0x03ff); - - INT32 ox = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 1]) & 0x01ff; - INT32 xsize = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 1]) & 0x0e00) >> 9; - INT32 zoomx = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 1]) & 0xf000) >> 12; - INT32 oy = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 0]) & 0x01ff; - INT32 ysize = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 0]) & 0x0e00) >> 9; - INT32 zoomy = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 0]) & 0xf000) >> 12; - INT32 flipx = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x4000; - INT32 flipy = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x8000; - INT32 color = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x1f00) >> 8; - INT32 map_start = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 3]) & 0x7fff; - - zoomx = 16 - zoomtable[zoomx]/8; - zoomy = 16 - zoomtable[zoomy]/8; - - if (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x20ff) color = 1; // what?? mame_rand? why? - - for (INT32 y = 0;y <= ysize;y++) - { - INT32 sx,sy; - - if (flipy) sy = ((oy + zoomy * (ysize - y) + 16) & 0x1ff) - 16; - else sy = ((oy + zoomy * y + 16) & 0x1ff) - 16; - - for (INT32 x = 0;x <= xsize;x++) - { - if (flipx) - sx = ((ox + zoomx * (xsize - x) + 16) & 0x1ff) - 16; - else - sx = ((ox + zoomx * x + 16) & 0x1ff) - 16; - - INT32 code = BURN_ENDIAN_SWAP_INT16(sprbuf2[map_start & 0x7fff]) & 0x7fff; - map_start++; - - RenderZoomedTile(pTransDraw, DrvGfxROM2, code, (color << 4) | 0x200, 0x0f, sx, sy, flipx, flipy, 16, 16, zoomx << 12, zoomy << 12); - } - } - } -} - -static void draw_background() -{ - UINT16 *vram = (UINT16*)DrvVidRAM2; - - for (INT32 offs = 0; offs < 64*28; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - if (sx >= 320) continue; - - INT32 sy = (offs >> 6) << 3; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x3fff; - if (code == 0) continue; - - Render8x8Tile_Mask(pTransDraw, code, sx, sy, 0, 4, 0xff, 0, DrvGfxROM0); - } -} - -static inline void copy_roz(UINT32 startx, UINT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy) -{ - UINT16 *dst = pTransDraw; - UINT16 *src = DrvBgTmp; - - for (INT32 sy = 0; sy < nScreenHeight; sy++, startx+=incyx, starty+=incyy) - { - UINT32 cx = startx; - UINT32 cy = starty; - - for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++) - { - INT32 p = BURN_ENDIAN_SWAP_INT16(src[(((cy >> 16) & 0x3ff) * 1024) + ((cx >> 16) & 0x3ff)]); - - if (p != 0xffff) { - *dst = p; - } - } - } -} - -static void draw_foreground() -{ - UINT16 *ctrl = DrvGfxCtrl; - - UINT32 startx,starty; - INT32 incxx,incxy,incyx,incyy; - - startx = 256 * (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x00])); - starty = 256 * (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x01])); - incyx = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x02])); - incyy = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x03])); - incxx = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x04])); - incxy = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x05])); - - if (BURN_ENDIAN_SWAP_INT16(ctrl[0x06]) & 0x4000) { incyx *= 256; incyy *= 256; } - if (BURN_ENDIAN_SWAP_INT16(ctrl[0x06]) & 0x0040) { incxx *= 256; incxy *= 256; } - - startx -= -21 * incyx; - starty -= -21 * incyy; - - startx -= -48 * incxx; - starty -= -48 * incxy; - - copy_roz(startx << 5, starty << 5, incxx << 5, incxy << 5, incyx << 5, incyy << 5); -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x400; i++) { - r = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 0) & 0x1f; - g = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 10) & 0x1f; - b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 5) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } - DrvPalette[0x400] = 0; - } - - if (*gfx_priority & 0x04) - { - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x400; - } - - BurnTransferCopy(DrvPalette); - - return 0; - } - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x01ff; - } - - switch (*gfx_priority & 0xfb) - { - case 0x00: - draw_sprites(); - draw_background(); - draw_foreground(); - break; - - case 0x01: - case 0x02: - draw_background(); - draw_foreground(); - draw_sprites(); - break; - - default: - break; - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - SekNewFrame(); - ZetNewFrame(); - - { - memset (DrvInputs, 0xff, 6 * sizeof(UINT16)); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - DrvInputs[3] = (DrvDips[0]) | (DrvDips[1] << 8); - DrvInputs[4] = DrvDips[2]; - DrvInputs[5] = (DrvDips[3] << 8); - } - - INT32 nCyclesTotal[2] = { 16000000 / 60, 4000000 / 60 }; - - SekOpen(0); - ZetOpen(0); - - SekRun(nCyclesTotal[0]); - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - // double buffer sprites - memcpy (DrvSprBuf1b, DrvSprBuf1a, 0x002000); - memcpy (DrvSprBuf1a, DrvSprRAM1, 0x002000); - memcpy (DrvSprBuf2b, DrvSprBuf2a, 0x010000); - memcpy (DrvSprBuf2a, DrvSprRAM2, 0x010000); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029702; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2610Scan(nAction, pnMin); - } - - if (nAction & ACB_WRITE) { - for (INT32 i = 0; i < 0x1000; i++) { - crshrace_drawtile(i); - } - - ZetOpen(0); - sound_bankswitch(*nSoundBank); - ZetClose(); - } - - return 0; -} - - -// Lethal Crash Race (set 1) - -static struct BurnRomInfo crshraceRomDesc[] = { - { "1", 0x080000, 0x21e34fb7, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "w21", 0x100000, 0xa5df7325, 1 | BRF_PRG | BRF_ESS }, // 1 - { "w22", 0x100000, 0xfc9d666d, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "2", 0x020000, 0xe70a900f, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 Code - - { "h895", 0x100000, 0x36ad93c3, 3 | BRF_GRA }, // 4 Background Tiles - - { "w18", 0x100000, 0xb15df90d, 4 | BRF_GRA }, // 5 Foreground Tiles - { "w19", 0x100000, 0x28326b93, 4 | BRF_GRA }, // 6 - { "w20", 0x100000, 0xd4056ad1, 4 | BRF_GRA }, // 7 - - { "h897", 0x200000, 0xe3230128, 5 | BRF_GRA }, // 8 Sprites - { "h896", 0x200000, 0xfff60233, 5 | BRF_GRA }, // 9 - - { "h894", 0x100000, 0xd53300c1, 6 | BRF_SND }, // 10 YM2610 Samples - { "h893", 0x100000, 0x32513b63, 6 | BRF_SND }, // 11 -}; - -STD_ROM_PICK(crshrace) -STD_ROM_FN(crshrace) - -struct BurnDriver BurnDrvCrshrace = { - "crshrace", NULL, NULL, NULL, "1993", - "Lethal Crash Race (set 1)\0", NULL, "Video System Co.", "Miscellaneous", - L"Lethal Crash Race\0\u7206\u70C8 \u30AF\u30E9\u30C3\u30B7\u30E5 \u30EC\u30FC\u30B9 (set 1)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_RACING, 0, - NULL, crshraceRomInfo, crshraceRomName, NULL, NULL, CrshraceInputInfo, CrshraceDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x401, - 224, 320, 3, 4 -}; - - -// Lethal Crash Race (set 2) - -static struct BurnRomInfo crshrace2RomDesc[] = { - { "01-ic10.bin", 0x080000, 0xb284aacd, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "w21", 0x100000, 0xa5df7325, 1 | BRF_PRG | BRF_ESS }, // 1 - { "w22", 0x100000, 0xfc9d666d, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "2", 0x020000, 0xe70a900f, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 Code - - { "h895", 0x100000, 0x36ad93c3, 3 | BRF_GRA }, // 4 Background Tiles - - { "w18", 0x100000, 0xb15df90d, 4 | BRF_GRA }, // 5 Foreground Tiles - { "w19", 0x100000, 0x28326b93, 4 | BRF_GRA }, // 6 - { "w20", 0x100000, 0xd4056ad1, 4 | BRF_GRA }, // 7 - - { "h897", 0x200000, 0xe3230128, 5 | BRF_GRA }, // 8 Sprites - { "h896", 0x200000, 0xfff60233, 5 | BRF_GRA }, // 9 - - { "h894", 0x100000, 0xd53300c1, 6 | BRF_SND }, // 10 YM2610 Samples - { "h893", 0x100000, 0x32513b63, 6 | BRF_SND }, // 11 -}; - -STD_ROM_PICK(crshrace2) -STD_ROM_FN(crshrace2) - -struct BurnDriver BurnDrvCrshrace2 = { - "crshrace2", "crshrace", NULL, NULL, "1993", - "Lethal Crash Race (set 2)\0", NULL, "Video System Co.", "Miscellaneous", - L"Lethal Crash Race\0\u7206\u70C8 \u30AF\u30E9\u30C3\u30B7\u30E5 \u30EC\u30FC\u30B9 (set 2)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_RACING, 0, - NULL, crshrace2RomInfo, crshrace2RomName, NULL, NULL, CrshraceInputInfo, CrshraceDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x401, - 224, 320, 3, 4 -}; - +// FB Alpha Lethal Crash Race driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2610.h" + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvDips[4]; +static UINT16 DrvInputs[6]; +static UINT8 DrvReset; + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvVidRAM1; +static UINT8 *DrvVidRAM2; +static UINT8 *DrvSprRAM1; +static UINT8 *DrvSprRAM2; +static UINT8 *DrvSprBuf1a; +static UINT8 *DrvSprBuf2a; +static UINT8 *DrvSprBuf1b; +static UINT8 *DrvSprBuf2b; +static UINT8 *DrvZ80RAM; +static UINT16 *DrvGfxCtrl; +static UINT16 *DrvBgTmp; +static UINT32 *DrvPalette; + +static UINT8 DrvRecalc; + +static UINT8 *nSoundBank; +static UINT8 *pending_command; +static UINT8 *roz_bank; +static UINT8 *gfx_priority; +static UINT8 *soundlatch; +static UINT8 *flipscreen; + +static struct BurnInputInfo CrshraceInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 11, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 9, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 12, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"P3 Coin", BIT_DIGITAL, DrvJoy1 + 10, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, DrvJoy3 + 7, "p3 start" }, + {"P3 Up", BIT_DIGITAL, DrvJoy3 + 0, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy3 + 1, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy3 + 2, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy3 + 3, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p3 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 15, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 14, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, + {"Region", BIT_DIPSWITCH, DrvDips + 3, "dip" }, +}; + +STDINPUTINFO(Crshrace) + +static struct BurnDIPInfo CrshraceDIPList[]= +{ + {0x1e, 0xff, 0xff, 0xff, NULL }, + {0x1f, 0xff, 0xff, 0xff, NULL }, + {0x20, 0xff, 0xff, 0xff, NULL }, + {0x21, 0xff, 0xff, 0x01, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x1e, 0x01, 0x01, 0x01, "Off" }, +// {0x1e, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x1e, 0x01, 0x02, 0x00, "Off" }, + {0x1e, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x1e, 0x01, 0x04, 0x04, "Off" }, + {0x1e, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x1e, 0x01, 0x08, 0x08, "Off" }, + {0x1e, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x1e, 0x01, 0xc0, 0x80, "Easy" }, + {0x1e, 0x01, 0xc0, 0xc0, "Normal" }, + {0x1e, 0x01, 0xc0, 0x40, "Hard" }, + {0x1e, 0x01, 0xc0, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Coin Slot" }, + {0x1f, 0x01, 0x01, 0x01, "Same" }, + {0x1f, 0x01, 0x01, 0x00, "Individual" }, + + // Coinage condition: Coin Slot Individual + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x1f, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, + {0x1f, 0x00, 0x01, 0x00, NULL}, + {0x1f, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, + {0x1f, 0x00, 0x01, 0x00, NULL}, + {0x1f, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, + {0x1f, 0x00, 0x01, 0x00, NULL}, + {0x1f, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, + {0x1f, 0x00, 0x01, 0x00, NULL}, + {0x1f, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, + {0x1f, 0x00, 0x01, 0x00, NULL}, + {0x1f, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, + {0x1f, 0x00, 0x01, 0x00, NULL}, + {0x1f, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, + {0x1f, 0x00, 0x01, 0x00, NULL}, + {0x1f, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, + {0x1f, 0x00, 0x01, 0x00, NULL}, + + // Coin A condition: Coin Slot Same + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x1f, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + + // Coin B condition: Coin Slot Same + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x1f, 0x02, 0x70, 0x50, "3 Coins 1 Credit" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x70, 0x40, "1 Coin 2 Credits" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x70, 0x30, "1 Coin 3 Credits" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x70, 0x20, "1 Coin 4 Credits" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x70, 0x10, "1 Coin 5 Credits" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + {0x1f, 0x02, 0x70, 0x00, "1 Coin 6 Credits" }, + {0x1f, 0x00, 0x01, 0x01, NULL}, + + {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, + {0x1f, 0x01, 0x80, 0x80, "Off" }, + {0x1f, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Reset on P.O.S.T. Error" }, + {0x20, 0x01, 0x80, 0x00, "No" }, + {0x20, 0x01, 0x80, 0x80, "Yes" }, + + {0 , 0xfe, 0 , 5, "Country" }, + {0x21, 0x01, 0x0f, 0x01, "World" }, + {0x21, 0x01, 0x0f, 0x08, "USA & Canada" }, + {0x21, 0x01, 0x0f, 0x00, "Japan" }, + {0x21, 0x01, 0x0f, 0x02, "Korea" }, + {0x21, 0x01, 0x0f, 0x04, "Hong Kong & Taiwan" }, +}; + +STDDIPINFO(Crshrace) + +static void crshrace_drawtile(INT32 offset) +{ + INT32 sx = (offset & 0x3f) << 4; + INT32 sy = (offset >> 6) << 4; + + INT32 code = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRAM1 + (offset << 1)))); + INT32 color = code >> 12; + code = (code & 0xfff) | (*roz_bank << 12); + color = (color << 4) | 0x100; + + UINT8 *src = DrvGfxROM1 + (code << 8); + UINT16 *dst = DrvBgTmp + (sy << 10) + sx; + + for (INT32 y = 0; y < 16; y++) { + for (INT32 x = 0; x < 16; x++) { + INT32 pxl = *src++; + if (pxl == 0x0f) pxl = ~0; + + dst[x] = BURN_ENDIAN_SWAP_INT16(pxl | color); + } + dst += 1024; + } +} + +void __fastcall crshrace_write_word(UINT32 address, UINT16 data) +{ + if (address >= 0xfff020 && address <= 0xfff03f) { // K053936_0_ctrl + DrvGfxCtrl[(address & 0x1f)/2] = BURN_ENDIAN_SWAP_INT16(data); + return; + } + + if ((address & 0xfffe000) == 0xd00000) { + *((UINT16*)(DrvVidRAM1 + (address & 0x1ffe))) = BURN_ENDIAN_SWAP_INT16(data); + crshrace_drawtile((address & 0x1ffe)/2); + return; + } +} + +void __fastcall crshrace_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfffe000) == 0xd00000) { + DrvVidRAM1[(address & 0x1fff) ^ 1] = data; + crshrace_drawtile((address & 0x1ffe)/2); + return; + } + + switch (address) + { + case 0xffc001: + *roz_bank = data; + return; + + case 0xfff001: + *gfx_priority = data & 0xdf; + *flipscreen = data & 0x20; + return; + + case 0xfff009: + *pending_command = 1; + *soundlatch = data; + ZetNmi(); + return; + } +} + +UINT16 __fastcall crshrace_read_word(UINT32) +{ + return 0; +} + +UINT8 __fastcall crshrace_read_byte(UINT32 address) +{ + switch (address) + { + case 0xfff000: + return DrvInputs[0] >> 8; + + case 0xfff001: + return DrvInputs[0]; + + case 0xfff002: + return DrvInputs[1] >> 8; + + case 0xfff003: + return DrvInputs[1]; + + case 0xfff004: + return DrvDips[1]; + + case 0xfff005: + return DrvDips[0]; + + case 0xfff00b: + return DrvDips[2]; + + case 0xfff00f: + return DrvInputs[2]; + + case 0xfff006: + return DrvDips[3] | (*pending_command << 7); + } + + return 0; +} + +static void sound_bankswitch(INT32 bank) +{ + *nSoundBank = bank & 0x03; + INT32 nBank = (*nSoundBank & 0x03) << 15; + + ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + nBank); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + nBank); +} + +void __fastcall crshrace_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + sound_bankswitch(data); + return; + + case 0x04: + *pending_command = 0; + return; + + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + BurnYM2610Write(port & 3, data); + return; + } +} + +UINT8 __fastcall crshrace_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x04: + return *soundlatch; + + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + return BurnYM2610Read(port & 3); + } + + return 0; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000.0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x300000; + DrvZ80ROM = Next; Next += 0x020000; + + DrvGfxROM0 = Next; Next += 0x100000; + DrvGfxROM1 = Next; Next += 0x800000; + DrvGfxROM2 = Next; Next += 0x800000; + + DrvSndROM = Next; Next += 0x200000; + + DrvPalette = (UINT32 *)Next; Next += 0x000401 * sizeof(UINT32); + DrvBgTmp = (UINT16*)Next; Next += 0x100000 * sizeof(UINT16); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x001000; + DrvVidRAM1 = Next; Next += 0x002000; + DrvVidRAM2 = Next; Next += 0x001000; + + DrvSprRAM1 = Next; Next += 0x002000; + DrvSprRAM2 = Next; Next += 0x010000; + + DrvSprBuf1a = Next; Next += 0x002000; + DrvSprBuf2a = Next; Next += 0x010000; + DrvSprBuf1b = Next; Next += 0x002000; + DrvSprBuf2b = Next; Next += 0x010000; + + DrvZ80RAM = Next; Next += 0x000800; + + nSoundBank = Next; Next += 0x000001; + roz_bank = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + gfx_priority = Next; Next += 0x000001; + pending_command = Next; Next += 0x000001; + + DrvGfxCtrl = (UINT16*)Next; Next += 0x000010 * sizeof(UINT16); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + memset (DrvBgTmp, 0xff, 0x200000); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2610Reset(); + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[8] = { 0x000, 0x001, 0x002, 0x003 }; + INT32 XOffs[16] = { 0x004, 0x000, 0x00c, 0x008, 0x014, 0x010, 0x01c, 0x018, + 0x024, 0x020, 0x02c, 0x028, 0x034, 0x030, 0x03c, 0x038 }; + INT32 YOffs[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x400000); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x300000; i++) { + tmp[i^1] = (DrvGfxROM1[i] << 4) | (DrvGfxROM1[i] >> 4); + } + + GfxDecode(0x6000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x400000); + + GfxDecode(0x8000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x0000000, 0, 1)) return 1; + if (BurnLoadRom(Drv68KROM + 0x0100000, 1, 1)) return 1; + if (BurnLoadRom(Drv68KROM + 0x0200000, 2, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x200000, 9, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x0000000, 10, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x0100000, 11, 1)) return 1; + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Drv68KROM + 0x100000, 0x300000, 0x3fffff, SM_ROM); + SekMapMemory(Drv68KROM + 0x200000, 0x400000, 0x4fffff, SM_ROM); + SekMapMemory(Drv68KROM + 0x200000, 0x500000, 0x5fffff, SM_ROM); + SekMapMemory(DrvSprRAM2, 0xa00000, 0xa0ffff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0xd00000, 0xd01fff, SM_ROM); + SekMapMemory(DrvSprRAM1, 0xe00000, 0xe01fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xfe0000, 0xfeffff, SM_RAM); + SekMapMemory(DrvVidRAM2, 0xffd000, 0xffdfff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xffe000, 0xffefff, SM_RAM); + SekSetWriteWordHandler(0, crshrace_write_word); + SekSetWriteByteHandler(0, crshrace_write_byte); + SekSetReadWordHandler(0, crshrace_read_word); + SekSetReadByteHandler(0, crshrace_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x77ff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x77ff, 2, DrvZ80ROM); + ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); + ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + 0x10000); + ZetMapArea(0x8000, 0xffff, 1, DrvZ80ROM + 0x10000); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + 0x10000); + ZetSetOutHandler(crshrace_sound_out); + ZetSetInHandler(crshrace_sound_in); + ZetClose(); + + INT32 DrvSndROMLen = 0x100000; + BurnYM2610Init(8000000, DrvSndROM + 0x100000, &DrvSndROMLen, DrvSndROM, &DrvSndROMLen, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM2610Exit(); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_sprites() +{ + INT32 offs = 0; + UINT16 *sprbuf1 = (UINT16*)DrvSprBuf1a; + UINT16 *sprbuf2 = (UINT16*)DrvSprBuf2a; + + static const INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; + + while (offs < 0x0400 && (BURN_ENDIAN_SWAP_INT16(sprbuf1[offs]) & 0x4000) == 0) + { + INT32 attr_start = 4 * (BURN_ENDIAN_SWAP_INT16(sprbuf1[offs++]) & 0x03ff); + + INT32 ox = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 1]) & 0x01ff; + INT32 xsize = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 1]) & 0x0e00) >> 9; + INT32 zoomx = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 1]) & 0xf000) >> 12; + INT32 oy = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 0]) & 0x01ff; + INT32 ysize = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 0]) & 0x0e00) >> 9; + INT32 zoomy = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 0]) & 0xf000) >> 12; + INT32 flipx = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x4000; + INT32 flipy = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x8000; + INT32 color = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x1f00) >> 8; + INT32 map_start = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 3]) & 0x7fff; + + zoomx = 16 - zoomtable[zoomx]/8; + zoomy = 16 - zoomtable[zoomy]/8; + + if (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x20ff) color = 1; // what?? mame_rand? why? + + for (INT32 y = 0;y <= ysize;y++) + { + INT32 sx,sy; + + if (flipy) sy = ((oy + zoomy * (ysize - y) + 16) & 0x1ff) - 16; + else sy = ((oy + zoomy * y + 16) & 0x1ff) - 16; + + for (INT32 x = 0;x <= xsize;x++) + { + if (flipx) + sx = ((ox + zoomx * (xsize - x) + 16) & 0x1ff) - 16; + else + sx = ((ox + zoomx * x + 16) & 0x1ff) - 16; + + INT32 code = BURN_ENDIAN_SWAP_INT16(sprbuf2[map_start & 0x7fff]) & 0x7fff; + map_start++; + + RenderZoomedTile(pTransDraw, DrvGfxROM2, code, (color << 4) | 0x200, 0x0f, sx, sy, flipx, flipy, 16, 16, zoomx << 12, zoomy << 12); + } + } + } +} + +static void draw_background() +{ + UINT16 *vram = (UINT16*)DrvVidRAM2; + + for (INT32 offs = 0; offs < 64*28; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + if (sx >= 320) continue; + + INT32 sy = (offs >> 6) << 3; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x3fff; + if (code == 0) continue; + + Render8x8Tile_Mask(pTransDraw, code, sx, sy, 0, 4, 0xff, 0, DrvGfxROM0); + } +} + +static inline void copy_roz(UINT32 startx, UINT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy) +{ + UINT16 *dst = pTransDraw; + UINT16 *src = DrvBgTmp; + + for (INT32 sy = 0; sy < nScreenHeight; sy++, startx+=incyx, starty+=incyy) + { + UINT32 cx = startx; + UINT32 cy = starty; + + for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++) + { + INT32 p = BURN_ENDIAN_SWAP_INT16(src[(((cy >> 16) & 0x3ff) * 1024) + ((cx >> 16) & 0x3ff)]); + + if (p != 0xffff) { + *dst = p; + } + } + } +} + +static void draw_foreground() +{ + UINT16 *ctrl = DrvGfxCtrl; + + UINT32 startx,starty; + INT32 incxx,incxy,incyx,incyy; + + startx = 256 * (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x00])); + starty = 256 * (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x01])); + incyx = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x02])); + incyy = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x03])); + incxx = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x04])); + incxy = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x05])); + + if (BURN_ENDIAN_SWAP_INT16(ctrl[0x06]) & 0x4000) { incyx *= 256; incyy *= 256; } + if (BURN_ENDIAN_SWAP_INT16(ctrl[0x06]) & 0x0040) { incxx *= 256; incxy *= 256; } + + startx -= -21 * incyx; + starty -= -21 * incyy; + + startx -= -48 * incxx; + starty -= -48 * incxy; + + copy_roz(startx << 5, starty << 5, incxx << 5, incxy << 5, incyx << 5, incyy << 5); +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x400; i++) { + r = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 0) & 0x1f; + g = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 10) & 0x1f; + b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 5) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } + DrvPalette[0x400] = 0; + } + + if (*gfx_priority & 0x04) + { + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x400; + } + + BurnTransferCopy(DrvPalette); + + return 0; + } + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x01ff; + } + + switch (*gfx_priority & 0xfb) + { + case 0x00: + draw_sprites(); + draw_background(); + draw_foreground(); + break; + + case 0x01: + case 0x02: + draw_background(); + draw_foreground(); + draw_sprites(); + break; + + default: + break; + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + SekNewFrame(); + ZetNewFrame(); + + { + memset (DrvInputs, 0xff, 6 * sizeof(UINT16)); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + DrvInputs[3] = (DrvDips[0]) | (DrvDips[1] << 8); + DrvInputs[4] = DrvDips[2]; + DrvInputs[5] = (DrvDips[3] << 8); + } + + INT32 nCyclesTotal[2] = { 16000000 / 60, 4000000 / 60 }; + + SekOpen(0); + ZetOpen(0); + + SekRun(nCyclesTotal[0]); + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + // double buffer sprites + memcpy (DrvSprBuf1b, DrvSprBuf1a, 0x002000); + memcpy (DrvSprBuf1a, DrvSprRAM1, 0x002000); + memcpy (DrvSprBuf2b, DrvSprBuf2a, 0x010000); + memcpy (DrvSprBuf2a, DrvSprRAM2, 0x010000); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029702; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2610Scan(nAction, pnMin); + } + + if (nAction & ACB_WRITE) { + for (INT32 i = 0; i < 0x1000; i++) { + crshrace_drawtile(i); + } + + ZetOpen(0); + sound_bankswitch(*nSoundBank); + ZetClose(); + } + + return 0; +} + + +// Lethal Crash Race (set 1) + +static struct BurnRomInfo crshraceRomDesc[] = { + { "1", 0x080000, 0x21e34fb7, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "w21", 0x100000, 0xa5df7325, 1 | BRF_PRG | BRF_ESS }, // 1 + { "w22", 0x100000, 0xfc9d666d, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "2", 0x020000, 0xe70a900f, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 Code + + { "h895", 0x100000, 0x36ad93c3, 3 | BRF_GRA }, // 4 Background Tiles + + { "w18", 0x100000, 0xb15df90d, 4 | BRF_GRA }, // 5 Foreground Tiles + { "w19", 0x100000, 0x28326b93, 4 | BRF_GRA }, // 6 + { "w20", 0x100000, 0xd4056ad1, 4 | BRF_GRA }, // 7 + + { "h897", 0x200000, 0xe3230128, 5 | BRF_GRA }, // 8 Sprites + { "h896", 0x200000, 0xfff60233, 5 | BRF_GRA }, // 9 + + { "h894", 0x100000, 0xd53300c1, 6 | BRF_SND }, // 10 YM2610 Samples + { "h893", 0x100000, 0x32513b63, 6 | BRF_SND }, // 11 +}; + +STD_ROM_PICK(crshrace) +STD_ROM_FN(crshrace) + +struct BurnDriver BurnDrvCrshrace = { + "crshrace", NULL, NULL, NULL, "1993", + "Lethal Crash Race (set 1)\0", NULL, "Video System Co.", "Miscellaneous", + L"Lethal Crash Race\0\u7206\u70C8 \u30AF\u30E9\u30C3\u30B7\u30E5 \u30EC\u30FC\u30B9 (set 1)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_RACING, 0, + NULL, crshraceRomInfo, crshraceRomName, NULL, NULL, CrshraceInputInfo, CrshraceDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x401, + 224, 320, 3, 4 +}; + + +// Lethal Crash Race (set 2) + +static struct BurnRomInfo crshrace2RomDesc[] = { + { "01-ic10.bin", 0x080000, 0xb284aacd, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "w21", 0x100000, 0xa5df7325, 1 | BRF_PRG | BRF_ESS }, // 1 + { "w22", 0x100000, 0xfc9d666d, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "2", 0x020000, 0xe70a900f, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 Code + + { "h895", 0x100000, 0x36ad93c3, 3 | BRF_GRA }, // 4 Background Tiles + + { "w18", 0x100000, 0xb15df90d, 4 | BRF_GRA }, // 5 Foreground Tiles + { "w19", 0x100000, 0x28326b93, 4 | BRF_GRA }, // 6 + { "w20", 0x100000, 0xd4056ad1, 4 | BRF_GRA }, // 7 + + { "h897", 0x200000, 0xe3230128, 5 | BRF_GRA }, // 8 Sprites + { "h896", 0x200000, 0xfff60233, 5 | BRF_GRA }, // 9 + + { "h894", 0x100000, 0xd53300c1, 6 | BRF_SND }, // 10 YM2610 Samples + { "h893", 0x100000, 0x32513b63, 6 | BRF_SND }, // 11 +}; + +STD_ROM_PICK(crshrace2) +STD_ROM_FN(crshrace2) + +struct BurnDriver BurnDrvCrshrace2 = { + "crshrace2", "crshrace", NULL, NULL, "1993", + "Lethal Crash Race (set 2)\0", NULL, "Video System Co.", "Miscellaneous", + L"Lethal Crash Race\0\u7206\u70C8 \u30AF\u30E9\u30C3\u30B7\u30E5 \u30EC\u30FC\u30B9 (set 2)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_RACING, 0, + NULL, crshrace2RomInfo, crshrace2RomName, NULL, NULL, CrshraceInputInfo, CrshraceDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x401, + 224, 320, 3, 4 +}; + diff --git a/src/burn/drv/pst90s/d_ddragon3.cpp b/src/burn/drv/pst90s/d_ddragon3.cpp index 0b82f5058..1d8541bdb 100644 --- a/src/burn/drv/pst90s/d_ddragon3.cpp +++ b/src/burn/drv/pst90s/d_ddragon3.cpp @@ -1,2118 +1,2114 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm6295.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[4] = {0, 0, 0, 0}; -static UINT8 DrvInput[4] = {0x00, 0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Drv68KRom = NULL; -static UINT8 *Drv68KRam = NULL; -static UINT8 *DrvMSM6295ROMSrc = NULL; -static UINT8 *DrvFgVideoRam = NULL; -static UINT8 *DrvBgVideoRam = NULL; -static UINT8 *DrvZ80Rom = NULL; -static UINT8 *DrvZ80Ram = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvPaletteRam = NULL; -static UINT8 *DrvTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT16 DrvBgTileBase; -static UINT16 DrvBgScrollX; -static UINT16 DrvBgScrollY; -static UINT16 DrvFgScrollX; -static UINT16 DrvFgScrollY; -static UINT16 DrvVReg; -static UINT8 DrvSoundLatch; -static UINT8 DrvOkiBank; -static UINT8 DrvVBlank; - -typedef void (*Render)(); -static Render DrawFunction; -static void DrvDraw(); -static void CtribeDraw(); - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 start" }, - {"Start 3" , BIT_DIGITAL , DrvInputPort3 + 7, "p3 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 fire 3" }, - - {"P3 Up" , BIT_DIGITAL , DrvInputPort3 + 2, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , DrvInputPort3 + 3, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , DrvInputPort3 + 1, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , DrvInputPort3 + 0, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , DrvInputPort3 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , DrvInputPort3 + 5, "p3 fire 2" }, - {"P3 Fire 3" , BIT_DIGITAL , DrvInputPort3 + 6, "p3 fire 3" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort1 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, - {"Dip 4" , BIT_DIPSWITCH, DrvDip + 3 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = DrvInput[2] = DrvInput[3] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - DrvInput[3] |= (DrvInputPort3[i] & 1) << i; - } - - // Clear Opposites - DrvClearOpposites(&DrvInput[0]); - DrvClearOpposites(&DrvInput[2]); - DrvClearOpposites(&DrvInput[3]); -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x1c, 0xff, 0xff, 0xff, NULL }, - {0x1d, 0xff, 0xff, 0xff, NULL }, - {0x1e, 0xff, 0xff, 0xff, NULL }, - {0x1f, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x1c, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x1c, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x1c, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x1c, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Continue Discount" }, - {0x1c, 0x01, 0x10, 0x10, "Off" }, - {0x1c, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x1c, 0x01, 0x20, 0x00, "Off" }, - {0x1c, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x1c, 0x01, 0x40, 0x40, "Off" }, - {0x1c, 0x01, 0x40, 0x00, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x1d, 0x01, 0x03, 0x02, "Easy" }, - {0x1d, 0x01, 0x03, 0x03, "Normal" }, - {0x1d, 0x01, 0x03, 0x01, "Hard" }, - {0x1d, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Player vs Player Damage"}, - {0x1d, 0x01, 0x04, 0x04, "Off" }, - {0x1d, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Test Mode" }, - {0x1d, 0x01, 0x10, 0x10, "Off" }, - {0x1d, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Stage Clear Energy" }, - {0x1d, 0x01, 0x20, 0x00, "Off" }, - {0x1d, 0x01, 0x20, 0x20, "50" }, - - {0 , 0xfe, 0 , 2 , "Starting Energy" }, - {0x1d, 0x01, 0x40, 0x00, "200" }, - {0x1d, 0x01, 0x40, 0x40, "230" }, - - {0 , 0xfe, 0 , 2 , "Number of Players" }, - {0x1d, 0x01, 0x80, 0x80, "2" }, - {0x1d, 0x01, 0x80, 0x00, "3" }, -}; - -STDDIPINFO(Drv) - -static struct BurnDIPInfo DrvbDIPList[]= -{ - // Default Values - {0x1c, 0xff, 0xff, 0x10, NULL }, - {0x1d, 0xff, 0xff, 0xff, NULL }, - {0x1e, 0xff, 0xff, 0xff, NULL }, - {0x1f, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x1c, 0x01, 0x10, 0x10, "Off" }, - {0x1c, 0x01, 0x10, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x1d, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x1d, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x1d, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x1d, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Continue Discount" }, - {0x1d, 0x01, 0x10, 0x10, "Off" }, - {0x1d, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x1d, 0x01, 0x20, 0x00, "Off" }, - {0x1d, 0x01, 0x20, 0x20, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x1e, 0x01, 0x03, 0x02, "Easy" }, - {0x1e, 0x01, 0x03, 0x03, "Normal" }, - {0x1e, 0x01, 0x03, 0x01, "Hard" }, - {0x1e, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Player vs Player Damage"}, - {0x1e, 0x01, 0x04, 0x04, "Off" }, - {0x1e, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Test Mode" }, - {0x1e, 0x01, 0x10, 0x10, "Off" }, - {0x1e, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Stage Clear Energy" }, - {0x1e, 0x01, 0x20, 0x00, "Off" }, - {0x1e, 0x01, 0x20, 0x20, "50" }, - - // Dip 4 - {0 , 0xfe, 0 , 2 , "Starting Energy" }, - {0x1f, 0x01, 0x01, 0x00, "200" }, - {0x1f, 0x01, 0x01, 0x01, "230" }, - - {0 , 0xfe, 0 , 2 , "Number of Players" }, - {0x1f, 0x01, 0x02, 0x02, "2" }, - {0x1f, 0x01, 0x02, 0x00, "3" }, -}; - -STDDIPINFO(Drvb) - -static struct BurnDIPInfo CtribeDIPList[]= -{ - // Default Values - {0x1c, 0xff, 0xff, 0x10, NULL }, - {0x1d, 0xff, 0xff, 0xff, NULL }, - {0x1e, 0xff, 0xff, 0xff, NULL }, - {0x1f, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x1c, 0x01, 0x10, 0x10, "Off" }, - {0x1c, 0x01, 0x10, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x1d, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x1d, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x1d, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x1d, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Continue Discount" }, - {0x1d, 0x01, 0x10, 0x10, "Off" }, - {0x1d, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x1d, 0x01, 0x20, 0x00, "Off" }, - {0x1d, 0x01, 0x20, 0x20, "On" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x1e, 0x01, 0x03, 0x02, "Easy" }, - {0x1e, 0x01, 0x03, 0x03, "Normal" }, - {0x1e, 0x01, 0x03, 0x01, "Hard" }, - {0x1e, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Timer Speed" }, - {0x1e, 0x01, 0x04, 0x04, "Normal" }, - {0x1e, 0x01, 0x04, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "FBI Logo" }, - {0x1e, 0x01, 0x08, 0x00, "Off" }, - {0x1e, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2 , "Test Mode" }, - {0x1e, 0x01, 0x10, 0x10, "Off" }, - {0x1e, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Stage Clear Energy" }, - {0x1e, 0x01, 0x20, 0x20, "0" }, - {0x1e, 0x01, 0x20, 0x00, "50" }, - - // Dip 4 - {0 , 0xfe, 0 , 2 , "More Stage Clear Energy"}, - {0x1f, 0x01, 0x01, 0x01, "Off" }, - {0x1f, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Number of Players" }, - {0x1f, 0x01, 0x02, 0x02, "2" }, - {0x1f, 0x01, 0x02, 0x00, "3" }, -}; - -STDDIPINFO(Ctribe) - -static struct BurnRomInfo DrvRomDesc[] = { - { "30a14-0.ic78", 0x40000, 0xf42fe016, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "30a15-0.ic79", 0x20000, 0xad50e92c, BRF_ESS | BRF_PRG }, // 1 - - { "30a13-0.ic43", 0x10000, 0x1e974d9b, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "30j-7.ic4", 0x40000, 0x89d58d32, BRF_GRA }, // 3 Tiles - { "30j-6.ic5", 0x40000, 0x9bf1538e, BRF_GRA }, // 4 - { "30j-5.ic6", 0x40000, 0x8f671a62, BRF_GRA }, // 5 - { "30j-4.ic7", 0x40000, 0x0f74ea1c, BRF_GRA }, // 6 - - { "30j-3.ic9", 0x80000, 0xb3151871, BRF_GRA }, // 7 Sprites - { "30a12-0.ic8", 0x10000, 0x20d64bea, BRF_GRA }, // 8 - { "30j-2.ic11", 0x80000, 0x41c6fb08, BRF_GRA }, // 9 - { "30a11-0.ic10", 0x10000, 0x785d71b0, BRF_GRA }, // 10 - { "30j-1.ic13", 0x80000, 0x67a6f114, BRF_GRA }, // 11 - { "30a10-0.ic12", 0x10000, 0x15e43d12, BRF_GRA }, // 12 - { "30j-0.ic15", 0x80000, 0xf15dafbe, BRF_GRA }, // 13 - { "30a9-0.ic14", 0x10000, 0x5a47e7a4, BRF_GRA }, // 14 - - { "30j-8.ic73", 0x80000, 0xc3ad40f3, BRF_SND }, // 15 Samples - - { "mb7114h.ic38", 0x00100, 0x113c7443, BRF_GRA }, // 16 PROM -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo DrvjRomDesc[] = { - { "30j15.ic78", 0x40000, 0x40618cbc, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "30j14.ic79", 0x20000, 0x96827e80, BRF_ESS | BRF_PRG }, // 1 - - { "30j13.ic43", 0x10000, 0x1e974d9b, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "30j-7.ic4", 0x40000, 0x89d58d32, BRF_GRA }, // 3 Tiles - { "30j-6.ic5", 0x40000, 0x9bf1538e, BRF_GRA }, // 4 - { "30j-5.ic6", 0x40000, 0x8f671a62, BRF_GRA }, // 5 - { "30j-4.ic7", 0x40000, 0x0f74ea1c, BRF_GRA }, // 6 - - { "30j-3.ic9", 0x80000, 0xb3151871, BRF_GRA }, // 7 Sprites - { "30j12-0.ic8", 0x10000, 0x1e9290d7, BRF_GRA }, // 8 - { "30j-2.ic11", 0x80000, 0x41c6fb08, BRF_GRA }, // 9 - { "30j11-0.ic10", 0x10000, 0x99195b2a, BRF_GRA }, // 10 - { "30j-1.ic13", 0x80000, 0x67a6f114, BRF_GRA }, // 11 - { "30j10-0.ic12", 0x10000, 0xe3879b5d, BRF_GRA }, // 12 - { "30j-0.ic15", 0x80000, 0xf15dafbe, BRF_GRA }, // 13 - { "30j9-0.ic14", 0x10000, 0x2759ae84, BRF_GRA }, // 14 - - { "30j-8.ic73", 0x80000, 0xc3ad40f3, BRF_SND }, // 15 Samples - - { "mb7114h.ic38", 0x00100, 0x113c7443, BRF_GRA }, // 16 PROM -}; - -STD_ROM_PICK(Drvj) -STD_ROM_FN(Drvj) - -static struct BurnRomInfo DrvpRomDesc[] = { - { "30a14-0.ic80", 0x40000, 0xf42fe016, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "30a15-0.ic79", 0x20000, 0xad50e92c, BRF_ESS | BRF_PRG }, // 1 - - { "30a13-0.ic43", 0x10000, 0x1e974d9b, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "14.ic45", 0x20000, 0xb036a27b, BRF_GRA }, // 3 Tiles - { "15.ic46", 0x20000, 0x24d0bf41, BRF_GRA }, // 4 - { "30.ic13", 0x20000, 0x72fe2b16, BRF_GRA }, // 5 - { "31.ic14", 0x20000, 0xab48a0c8, BRF_GRA }, // 6 - { "23.ic29", 0x20000, 0x0768fedd, BRF_GRA }, // 7 - { "24.ic30", 0x20000, 0xec9db18a, BRF_GRA }, // 8 - { "21.ic25", 0x20000, 0x902744b9, BRF_GRA }, // 9 - { "22.ic26", 0x20000, 0x5b142d4d, BRF_GRA }, // 10 - - { "9.ic39", 0x20000, 0x726c49b7, BRF_GRA }, // 11 Sprites - { "10.ic40", 0x20000, 0x37a1c335, BRF_GRA }, // 12 - { "11.ic41", 0x20000, 0x2bcfe63c, BRF_GRA }, // 13 - { "12.ic42", 0x20000, 0xb864cf17, BRF_GRA }, // 14 - { "4.ic33", 0x20000, 0x8c71eb06, BRF_GRA }, // 15 - { "5.ic34", 0x20000, 0x3e134be9, BRF_GRA }, // 16 - { "6.ic35", 0x20000, 0xb4115ef0, BRF_GRA }, // 17 - { "7.ic36", 0x20000, 0x4639333d, BRF_GRA }, // 18 - { "16.ic19", 0x20000, 0x04420cc8, BRF_GRA }, // 19 - { "17.ic20", 0x20000, 0x33f97b2f, BRF_GRA }, // 20 - { "18.ic21", 0x20000, 0x0f9a8f2a, BRF_GRA }, // 21 - { "19.ic22", 0x20000, 0x15c91772, BRF_GRA }, // 22 - { "25.ic3", 0x20000, 0x894734b3, BRF_GRA }, // 23 - { "26.ic4", 0x20000, 0xcd504584, BRF_GRA }, // 24 - { "27.ic5", 0x20000, 0x38e8a9ad, BRF_GRA }, // 25 - { "28.ic6", 0x20000, 0x80c1cb74, BRF_GRA }, // 26 - { "30a12-0.ic43", 0x20000, 0x91da004c, BRF_GRA }, // 27 - { "30a11-0.ic37", 0x20000, 0x5f419232, BRF_GRA }, // 28 - { "30a10-0.ic23", 0x20000, 0x12f641ba, BRF_GRA }, // 29 - { "30a9-0.ic7", 0x20000, 0x9199a77b, BRF_GRA }, // 30 - - { "2.ic73", 0x40000, 0x3af21dbe, BRF_SND }, // 31 Samples - { "3.ic74", 0x40000, 0xc28b53cd, BRF_SND }, // 32 - - { "30.ic38", 0x00100, 0x113c7443, BRF_GRA }, // 33 PROM -}; - -STD_ROM_PICK(Drvp) -STD_ROM_FN(Drvp) - -static struct BurnRomInfo DrvbRomDesc[] = { - { "dd3.01", 0x20000, 0x68321d8b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "dd3.03", 0x20000, 0xbc05763b, BRF_ESS | BRF_PRG }, // 1 - { "dd3.02", 0x20000, 0x38d9ae75, BRF_ESS | BRF_PRG }, // 2 - - { "dd3.06", 0x10000, 0x1e974d9b, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "dd3.f", 0x40000, 0x89d58d32, BRF_GRA }, // 4 Tiles - { "dd3.e", 0x40000, 0x9bf1538e, BRF_GRA }, // 5 - { "dd3.b", 0x40000, 0x8f671a62, BRF_GRA }, // 6 - { "dd3.a", 0x40000, 0x0f74ea1c, BRF_GRA }, // 7 - - { "dd3.3e", 0x20000, 0x726c49b7, BRF_GRA }, // 8 Sprites - { "dd3.3d", 0x20000, 0x37a1c335, BRF_GRA }, // 9 - { "dd3.3c", 0x20000, 0x2bcfe63c, BRF_GRA }, // 10 - { "dd3.3b", 0x20000, 0xb864cf17, BRF_GRA }, // 11 - { "dd3.3a", 0x10000, 0x20d64bea, BRF_GRA }, // 12 - { "dd3.2e", 0x20000, 0x8c71eb06, BRF_GRA }, // 13 - { "dd3.2d", 0x20000, 0x3e134be9, BRF_GRA }, // 14 - { "dd3.2c", 0x20000, 0xb4115ef0, BRF_GRA }, // 15 - { "dd3.2b", 0x20000, 0x4639333d, BRF_GRA }, // 16 - { "dd3.2a", 0x10000, 0x785d71b0, BRF_GRA }, // 17 - { "dd3.1e", 0x20000, 0x04420cc8, BRF_GRA }, // 18 - { "dd3.1d", 0x20000, 0x33f97b2f, BRF_GRA }, // 19 - { "dd3.1c", 0x20000, 0x0f9a8f2a, BRF_GRA }, // 20 - { "dd3.1b", 0x20000, 0x15c91772, BRF_GRA }, // 21 - { "dd3.1a", 0x10000, 0x15e43d12, BRF_GRA }, // 22 - { "dd3.0e", 0x20000, 0x894734b3, BRF_GRA }, // 23 - { "dd3.0d", 0x20000, 0xcd504584, BRF_GRA }, // 24 - { "dd3.0c", 0x20000, 0x38e8a9ad, BRF_GRA }, // 25 - { "dd3.0b", 0x20000, 0x80c1cb74, BRF_GRA }, // 26 - { "dd3.0a", 0x10000, 0x5a47e7a4, BRF_GRA }, // 27 - - { "dd3.j7", 0x40000, 0x3af21dbe, BRF_SND }, // 28 Samples - { "dd3.j8", 0x40000, 0xc28b53cd, BRF_SND }, // 29 - - { "mb7114h.38", 0x00100, 0x113c7443, BRF_GRA }, // 30 PROM -}; - -STD_ROM_PICK(Drvb) -STD_ROM_FN(Drvb) - -static struct BurnRomInfo CtribeRomDesc[] = { - { "28a16-2.ic26", 0x20000, 0xc46b2e63, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "28a15-2.ic25", 0x20000, 0x3221c755, BRF_ESS | BRF_PRG }, // 1 - { "28j17-0.104", 0x10000, 0x8c2c6dbd, BRF_ESS | BRF_PRG }, // 2 - - { "28a10-0.ic89", 0x08000, 0x4346de13, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "28j7-0.ic11", 0x40000, 0xa8b773f1, BRF_GRA }, // 4 Tiles - { "28j6-0.ic13", 0x40000, 0x617530fc, BRF_GRA }, // 5 - { "28j5-0.ic12", 0x40000, 0xcef0a821, BRF_GRA }, // 6 - { "28j4-0.ic14", 0x40000, 0xb84fda09, BRF_GRA }, // 7 - - { "28j3-0.ic77", 0x80000, 0x1ac2a461, BRF_GRA }, // 8 Sprites - { "28a14-0.ic60", 0x10000, 0x972faddb, BRF_GRA }, // 9 - { "28j2-0.ic78", 0x80000, 0x8c796707, BRF_GRA }, // 10 - { "28a13-0.ic61", 0x10000, 0xeb3ab374, BRF_GRA }, // 11 - { "28j1-0.ic97", 0x80000, 0x1c9badbd, BRF_GRA }, // 12 - { "28a12-0.ic85", 0x10000, 0xc602ac97, BRF_GRA }, // 13 - { "28j0-0.ic98", 0x80000, 0xba73c49e, BRF_GRA }, // 14 - { "28a11-0.ic86", 0x10000, 0x4da1d8e5, BRF_GRA }, // 15 - - { "28j9-0.ic83", 0x20000, 0xf92a7f4a, BRF_SND }, // 16 Samples - { "28j8-0.ic82", 0x20000, 0x1a3a0b39, BRF_SND }, // 17 - - { "28.ic44", 0x00100, 0x964329ef, BRF_GRA }, // 18 PROM -}; - -STD_ROM_PICK(Ctribe) -STD_ROM_FN(Ctribe) - -static struct BurnRomInfo Ctribe1RomDesc[] = { - { "1_28a16-2.ic26",0x20000, 0xf00f8443, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "1_28a15-2.ic25",0x20000, 0xdd70079f, BRF_ESS | BRF_PRG }, // 1 - { "28j17-0.104", 0x10000, 0x8c2c6dbd, BRF_ESS | BRF_PRG }, // 2 - - { "28a10-0.ic89", 0x08000, 0x4346de13, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "28j7-0.ic11", 0x40000, 0xa8b773f1, BRF_GRA }, // 4 Tiles - { "28j6-0.ic13", 0x40000, 0x617530fc, BRF_GRA }, // 5 - { "28j5-0.ic12", 0x40000, 0xcef0a821, BRF_GRA }, // 6 - { "28j4-0.ic14", 0x40000, 0xb84fda09, BRF_GRA }, // 7 - - { "28j3-0.ic77", 0x80000, 0x1ac2a461, BRF_GRA }, // 8 Sprites - { "28a14-0.ic60", 0x10000, 0x972faddb, BRF_GRA }, // 9 - { "28j2-0.ic78", 0x80000, 0x8c796707, BRF_GRA }, // 10 - { "28a13-0.ic61", 0x10000, 0xeb3ab374, BRF_GRA }, // 11 - { "28j1-0.ic97", 0x80000, 0x1c9badbd, BRF_GRA }, // 12 - { "28a12-0.ic85", 0x10000, 0xc602ac97, BRF_GRA }, // 13 - { "28j0-0.ic98", 0x80000, 0xba73c49e, BRF_GRA }, // 14 - { "28a11-0.ic86", 0x10000, 0x4da1d8e5, BRF_GRA }, // 15 - - { "28j9-0.ic83", 0x20000, 0xf92a7f4a, BRF_SND }, // 16 Samples - { "28j8-0.ic82", 0x20000, 0x1a3a0b39, BRF_SND }, // 17 - - { "28.ic44", 0x00100, 0x964329ef, BRF_GRA }, // 18 PROM -}; - -STD_ROM_PICK(Ctribe1) -STD_ROM_FN(Ctribe1) - -static struct BurnRomInfo CtribejRomDesc[] = { - { "28j16-02.26", 0x20000, 0x658b8568, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "28j15-12.25", 0x20000, 0x50aac7e7, BRF_ESS | BRF_PRG }, // 1 - { "28j17-0.104", 0x10000, 0x8c2c6dbd, BRF_ESS | BRF_PRG }, // 2 - - { "28j10-0.89", 0x08000, 0x4346de13, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "28j7-0.ic11", 0x40000, 0xa8b773f1, BRF_GRA }, // 4 Tiles - { "28j6-0.ic13", 0x40000, 0x617530fc, BRF_GRA }, // 5 - { "28j5-0.ic12", 0x40000, 0xcef0a821, BRF_GRA }, // 6 - { "28j4-0.ic14", 0x40000, 0xb84fda09, BRF_GRA }, // 7 - - { "28j3-0.ic77", 0x80000, 0x1ac2a461, BRF_GRA }, // 8 Sprites - { "28j14-0.60", 0x10000, 0x6869050a, BRF_GRA }, // 9 - { "28j2-0.ic78", 0x80000, 0x8c796707, BRF_GRA }, // 10 - { "28j13-0.61", 0x10000, 0x8b8addea, BRF_GRA }, // 11 - { "28j1-0.ic97", 0x80000, 0x1c9badbd, BRF_GRA }, // 12 - { "28j12-0.85", 0x10000, 0x422b041c, BRF_GRA }, // 13 - { "28j0-0.ic98", 0x80000, 0xba73c49e, BRF_GRA }, // 14 - { "28j11-0.86", 0x10000, 0x4a391c5b, BRF_GRA }, // 15 - - { "28j9-0.ic83", 0x20000, 0xf92a7f4a, BRF_SND }, // 16 Samples - { "28j8-0.ic82", 0x20000, 0x1a3a0b39, BRF_SND }, // 17 - - { "28.ic44", 0x00100, 0x964329ef, BRF_GRA }, // 18 PROM -}; - -STD_ROM_PICK(Ctribej) -STD_ROM_FN(Ctribej) - -static struct BurnRomInfo CtribebRomDesc[] = { - { "ct_ep1.rom", 0x20000, 0x9cfa997f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ct_ep3.rom", 0x20000, 0x2ece8681, BRF_ESS | BRF_PRG }, // 1 - { "ct_ep2.rom", 0x10000, 0x8c2c6dbd, BRF_ESS | BRF_PRG }, // 2 - - { "ct_ep4.rom", 0x08000, 0x4346de13, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "ct_mr7.rom", 0x40000, 0xa8b773f1, BRF_GRA }, // 4 Tiles - { "ct_mr6.rom", 0x40000, 0x617530fc, BRF_GRA }, // 5 - { "ct_mr5.rom", 0x40000, 0xcef0a821, BRF_GRA }, // 6 - { "ct_mr4.rom", 0x40000, 0xb84fda09, BRF_GRA }, // 7 - - { "ct_mr3.rom", 0x80000, 0x1ac2a461, BRF_GRA }, // 8 Sprites - { "ct_ep5.rom", 0x10000, 0x972faddb, BRF_GRA }, // 9 - { "ct_mr2.rom", 0x80000, 0x8c796707, BRF_GRA }, // 10 - { "ct_ep6.rom", 0x10000, 0xeb3ab374, BRF_GRA }, // 11 - { "ct_mr1.rom", 0x80000, 0x1c9badbd, BRF_GRA }, // 12 - { "ct_ep7.rom", 0x10000, 0xc602ac97, BRF_GRA }, // 13 - { "ct_mr0.rom", 0x80000, 0xba73c49e, BRF_GRA }, // 14 - { "ct_ep8.rom", 0x10000, 0x4da1d8e5, BRF_GRA }, // 15 - - { "ct_mr8.rom", 0x40000, 0x9963a6be, BRF_SND }, // 16 Samples -}; - -STD_ROM_PICK(Ctribeb) -STD_ROM_FN(Ctribeb) - -static struct BurnRomInfo Ctribeb2RomDesc[] = { - { "1.bin", 0x20000, 0x9cfa997f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "3.bin", 0x20000, 0x2ece8681, BRF_ESS | BRF_PRG }, // 1 - { "2.bin", 0x10000, 0x8c2c6dbd, BRF_ESS | BRF_PRG }, // 2 - - { "6.bin", 0x10000, 0x0101df2d, BRF_ESS | BRF_PRG }, // 3 Z80 Program - - { "7.bin", 0x40000, 0xa8b773f1, BRF_GRA }, // 4 Tiles - { "8.bin", 0x40000, 0x617530fc, BRF_GRA }, // 5 - { "11.bin", 0x40000, 0xcef0a821, BRF_GRA }, // 6 - { "12.bin", 0x40000, 0xb84fda09, BRF_GRA }, // 7 - { "9.bin", 0x20000, 0x2719d7ce, BRF_GRA }, // 8 - { "10.bin", 0x20000, 0x753a4f53, BRF_GRA }, // 9 - { "13.bin", 0x20000, 0x59e01fe1, BRF_GRA }, // 10 - { "14.bin", 0x20000, 0xa69ab4f3, BRF_GRA }, // 11 - - { "34.bin", 0x20000, 0x5b498f0e, BRF_GRA }, // 12 Sprites - { "33.bin", 0x20000, 0x14d79049, BRF_GRA }, // 13 - { "32.bin", 0x20000, 0x9631ea23, BRF_GRA }, // 14 - { "31.bin", 0x20000, 0x0ca8d3b9, BRF_GRA }, // 15 - { "30.bin", 0x10000, 0x972faddb, BRF_GRA }, // 16 - { "29.bin", 0x20000, 0x479ae8ea, BRF_GRA }, // 17 - { "28.bin", 0x20000, 0x95598bbf, BRF_GRA }, // 18 - { "27.bin", 0x20000, 0x4a3d006d, BRF_GRA }, // 19 - { "26.bin", 0x20000, 0xaa34a3cb, BRF_GRA }, // 20 - { "25.bin", 0x10000, 0xeb3ab374, BRF_GRA }, // 21 - { "24.bin", 0x20000, 0xd60bbff0, BRF_GRA }, // 22 - { "23.bin", 0x20000, 0xd9595c47, BRF_GRA }, // 23 - { "22.bin", 0x20000, 0x5a19a911, BRF_GRA }, // 24 - { "21.bin", 0x20000, 0x071360f9, BRF_GRA }, // 25 - { "20.bin", 0x10000, 0xc602ac97, BRF_GRA }, // 26 - { "19.bin", 0x20000, 0x8d22736a, BRF_GRA }, // 27 - { "18.bin", 0x20000, 0x0f157822, BRF_GRA }, // 28 - { "17.bin", 0x20000, 0x7f48c824, BRF_GRA }, // 29 - { "16.bin", 0x20000, 0xcd1e9bd5, BRF_GRA }, // 30 - { "15.bin", 0x10000, 0x4da1d8e5, BRF_GRA }, // 31 - - { "5.bin", 0x20000, 0xf92a7f4a, BRF_SND }, // 32 Samples - { "4.bin", 0x20000, 0x1a3a0b39, BRF_SND }, // 33 -}; - -STD_ROM_PICK(Ctribeb2) -STD_ROM_FN(Ctribeb2) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x80000; - DrvZ80Rom = Next; Next += 0x10000; - MSM6295ROM = Next; Next += 0x40000; - DrvMSM6295ROMSrc = Next; Next += 0x80000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x04800; - DrvZ80Ram = Next; Next += 0x00800; - DrvFgVideoRam = Next; Next += 0x01000; - DrvSpriteRam = Next; Next += 0x01000; - DrvBgVideoRam = Next; Next += 0x00800; - DrvPaletteRam = Next; Next += 0x00600; - - RamEnd = Next; - - DrvTiles = Next; Next += 8192 * 16 * 16; - DrvSprites = Next; Next += 0x4800 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00600 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - MSM6295Reset(0); - - DrvBgTileBase = 0; - DrvBgScrollX = 0; - DrvBgScrollY = 0; - DrvFgScrollX = 0; - DrvFgScrollY = 0; - DrvVReg = 0; - DrvSoundLatch = 0; - DrvOkiBank = 0; - DrvVBlank = 0; - - return 0; -} - -UINT8 __fastcall Ddragon368KReadByte(UINT32 a) -{ - switch (a) { - case 0x100000: { - return 0xff - DrvInput[2]; - } - - case 0x100001: { - return 0xff - DrvInput[0]; - } - - case 0x100003: { - return 0xff - DrvInput[1]; - } - - case 0x100007: { - return 0xff - DrvInput[3]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ddragon368KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x100003: { - DrvSoundLatch = d; - ZetOpen(0); - ZetNmi(); - nCyclesDone[1] += ZetRun(100); - ZetClose(); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Ddragon368KReadWord(UINT32 a) -{ - switch (a) { - case 0x100002: { - return (0xff << 8) | (0xff - DrvInput[1]); - } - - case 0x100004: { - return (DrvDip[1] << 8) | DrvDip[0]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ddragon368KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x000004: - case 0x000006: { - // ??? - return; - } - - case 0x0c0000: { - DrvFgScrollX = d & 0x1ff; - return; - } - - case 0x0c0002: { - DrvFgScrollY = d & 0x1ff; - return; - } - - case 0x0c0004: { - DrvBgScrollX = d & 0x1ff; - return; - } - - case 0x0c0006: { - DrvBgScrollY = d & 0x1ff; - return; - } - - case 0x0c0008: { - return; - } - - case 0x0c000c: { - DrvBgTileBase = d & 0x1ff; - return; - } - - case 0x100000: { - DrvVReg = d; - return; - } - - case 0x100002: { - DrvSoundLatch = d; - ZetOpen(0); - ZetNmi(); - nCyclesDone[1] += ZetRun(100); - ZetClose(); - return; - } - - case 0x100004: - case 0x100006: - case 0x100008: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Ddragon3b68KReadByte(UINT32 a) -{ - switch (a) { - case 0x180000: { - return 0xef - DrvInput[1] + (DrvDip[0] & 0x10); - } - - case 0x180001: { - return 0xff - DrvInput[0]; - } - - case 0x180002: { - return DrvDip[1]; - } - - case 0x180003: { - return 0xff - DrvInput[2]; - } - - case 0x180005: { - return 0xff - DrvInput[3]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ddragon3b68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x140003: { - DrvSoundLatch = d; - ZetOpen(0); - ZetNmi(); - nCyclesDone[1] += ZetRun(100); - ZetClose(); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Ddragon3b68KReadWord(UINT32 a) -{ - switch (a) { - case 0x180000: { - return (((0xef - DrvInput[1]) + (DrvDip[0] & 0x10)) << 8) | (0xff - DrvInput[0]); - } - - case 0x180004: { - return (DrvDip[2] << 8) | (0xff - DrvInput[3]); - } - - case 0x180006: { - return (DrvDip[3] << 8) | 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ddragon3b68KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x000004: - case 0x000006: { - // ??? - return; - } - - case 0x0c0000: { - DrvFgScrollX = d & 0x1ff; - return; - } - - case 0x0c0002: { - DrvFgScrollY = d & 0x1ff; - return; - } - - case 0x0c0004: { - DrvBgScrollX = d & 0x1ff; - return; - } - - case 0x0c0006: { - DrvBgScrollY = d & 0x1ff; - return; - } - - case 0x0c0008: { - return; - } - - case 0x0c000c: { - DrvBgTileBase = d & 0x1ff; - return; - } - - case 0x140000: { - DrvVReg = d; - return; - } - - case 0x140002: { - DrvSoundLatch = d; - ZetOpen(0); - ZetNmi(); - nCyclesDone[1] += ZetRun(100); - ZetClose(); - return; - } - - case 0x140004: - case 0x140006: - case 0x140008: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Ddragon3Z80Read(UINT16 a) -{ - switch (a) { - case 0xc801: { - return BurnYM2151ReadStatus(); - } - - case 0xd800: { - return MSM6295ReadStatus(0); - } - - case 0xe000: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall Ddragon3Z80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xc800: { - BurnYM2151SelectRegister(d); - return; - } - - case 0xc801: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xd800: { - MSM6295Command(0, d); - return; - } - - case 0xe800: { - DrvOkiBank = d & 1; - memcpy(MSM6295ROM + 0x00000, DrvMSM6295ROMSrc + (0x40000 * DrvOkiBank), 0x40000); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Ctribeb68KReadByte(UINT32 a) -{ - switch (a) { - case 0x180000: { - if (DrvVBlank) return 0xe7 - DrvInput[1] + (DrvDip[0] & 0x10); - return 0xef - DrvInput[1] + (DrvDip[0] & 0x10); - } - - case 0x180001: { - return 0xff - DrvInput[0]; - } - - case 0x180003: { - return 0xff - DrvInput[2]; - } - - case 0x180004: { - return DrvDip[2]; - } - - case 0x180005: { - return 0xff - DrvInput[3]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ctribeb68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x0c000d: { - DrvBgTileBase = d; - return; - } - - case 0x140001: { - DrvVReg = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Ctribeb68KReadWord(UINT32 a) -{ - switch (a) { - case 0x180000: { - if (DrvVBlank) return ((0xe7 - DrvInput[1] + (DrvDip[0] & 0x10)) << 8) | (0xff - DrvInput[0]); - return ((0xef - DrvInput[1] + (DrvDip[0] & 0x10)) << 8) | (0xff - DrvInput[0]); - } - - case 0x180002: { - return (DrvDip[1] << 8) | (0xff - DrvInput[2]); - } - - case 0x180004: { - return (DrvDip[2] << 8) | (0xff - DrvInput[3]); - } - - case 0x180006: { - return (DrvDip[3] << 8) | 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ctribeb68KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x0c0000: { - DrvFgScrollX = d & 0x1ff; - return; - } - - case 0x0c0002: { - DrvFgScrollY = d & 0x1ff; - return; - } - - case 0x0c0004: { - DrvBgScrollX = d & 0x1ff; - return; - } - - case 0x0c0006: { - DrvBgScrollY = d & 0x1ff; - return; - } - - case 0x0c0008: { - return; - } - - case 0x0c000c: { - DrvBgTileBase = d & 0x1ff; - return; - } - - case 0x140000: { - DrvVReg = d; - return; - } - - case 0x140002: { - DrvSoundLatch = d & 0xff; - ZetOpen(0); - ZetNmi(); - nCyclesDone[1] += ZetRun(100); - ZetClose(); - return; - } - - case 0x140004: - case 0x140006: - case 0x140008: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall CtribeZ80Read(UINT16 a) -{ - switch (a) { - case 0x8801: { - return BurnYM2151ReadStatus(); - } - - case 0x9800: { - return MSM6295ReadStatus(0); - } - - case 0xa000: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall CtribeZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x8800: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x8801: { - BurnYM2151WriteRegister(d); - return; - } - - case 0x9800: { - MSM6295Command(0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 TilePlaneOffsets[4] = { 0, 0x200000, 0x400000, 0x600000 }; -static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; -static INT32 SpritePlaneOffsets[4] = { 0, 0x800000, 0x1000000, 0x1800000 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; - -static void DrvYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvInit() -{ - INT32 nRet = 0, nLen; - - BurnSetRefreshRate(57.0); - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x400000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x040000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c0000, 6, 1); if (nRet != 0) return 1; - GfxDecode(8192, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x400000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x180000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x280000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x380000, 14, 1); if (nRet != 0) return 1; - GfxDecode(0x4800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 15, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvFgVideoRam , 0x080000, 0x080fff, SM_RAM); - SekMapMemory(DrvBgVideoRam , 0x082000, 0x0827ff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x140000, 0x1405ff, SM_RAM); - SekMapMemory(DrvSpriteRam , 0x180000, 0x180fff, SM_RAM); - SekMapMemory(Drv68KRam , 0x1c0000, 0x1c3fff, SM_RAM); - SekSetReadWordHandler(0, Ddragon368KReadWord); - SekSetWriteWordHandler(0, Ddragon368KWriteWord); - SekSetReadByteHandler(0, Ddragon368KReadByte); - SekSetWriteByteHandler(0, Ddragon368KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Ddragon3Z80Read); - ZetSetWriteHandler(Ddragon3Z80Write); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom ); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 1000000 / 132, 1); - MSM6295SetRoute(0, 1.50, BURN_SND_ROUTE_BOTH); - - DrawFunction = DrvDraw; - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 DrvpInit() -{ - INT32 nRet = 0, nLen; - - BurnSetRefreshRate(57.0); - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x400000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x020000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x040000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x060000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0a0000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c0000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0e0000, 10, 1); if (nRet != 0) return 1; - GfxDecode(8192, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x400000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x020000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x040000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x060000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x120000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x140000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x160000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x220000, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x240000, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x260000, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300000, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x320000, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x340000, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x360000, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 27, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x180000, 28, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x280000, 29, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x380000, 30, 1); if (nRet != 0) return 1; - GfxDecode(0x4800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 31, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x40000, 32, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvFgVideoRam , 0x080000, 0x080fff, SM_RAM); - SekMapMemory(DrvBgVideoRam , 0x082000, 0x0827ff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x140000, 0x1405ff, SM_RAM); - SekMapMemory(DrvSpriteRam , 0x180000, 0x180fff, SM_RAM); - SekMapMemory(Drv68KRam , 0x1c0000, 0x1c3fff, SM_RAM); - SekSetReadWordHandler(0, Ddragon368KReadWord); - SekSetWriteWordHandler(0, Ddragon368KWriteWord); - SekSetReadByteHandler(0, Ddragon368KReadByte); - SekSetWriteByteHandler(0, Ddragon368KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Ddragon3Z80Read); - ZetSetWriteHandler(Ddragon3Z80Write); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom ); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 1000000 / 132, 1); - MSM6295SetRoute(0, 1.50, BURN_SND_ROUTE_BOTH); - - DrawFunction = DrvDraw; - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 DrvbInit() -{ - INT32 nRet = 0, nLen; - - BurnSetRefreshRate(57.0); - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x400000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00001, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x40000, 2, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 3, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x040000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c0000, 7, 1); if (nRet != 0) return 1; - GfxDecode(8192, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x400000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x020000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x040000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x060000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x120000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x140000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x160000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x180000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x220000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x240000, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x260000, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x280000, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300000, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x320000, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x340000, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x360000, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x380000, 27, 1); if (nRet != 0) return 1; - GfxDecode(0x4800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 28, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x40000, 29, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvFgVideoRam , 0x080000, 0x080fff, SM_RAM); - SekMapMemory(DrvSpriteRam , 0x081000, 0x081fff, SM_RAM); - SekMapMemory(DrvBgVideoRam , 0x082000, 0x0827ff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x100000, 0x1005ff, SM_RAM); - SekMapMemory(Drv68KRam , 0x1c0000, 0x1c3fff, SM_RAM); - SekSetReadWordHandler(0, Ddragon3b68KReadWord); - SekSetWriteWordHandler(0, Ddragon3b68KWriteWord); - SekSetReadByteHandler(0, Ddragon3b68KReadByte); - SekSetWriteByteHandler(0, Ddragon3b68KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Ddragon3Z80Read); - ZetSetWriteHandler(Ddragon3Z80Write); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom ); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 1000000 / 132, 1); - MSM6295SetRoute(0, 1.50, BURN_SND_ROUTE_BOTH); - - DrawFunction = DrvDraw; - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 CtribeInit() -{ - INT32 nRet = 0, nLen; - - BurnSetRefreshRate(57.0); - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x400000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00001, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x40000, 2, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 3, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x040000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x0c0000, 7, 1); if (nRet != 0) return 1; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ctribeb2")) { - nRet = BurnLoadRom(DrvTempRom + 0x100000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x140000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x180000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x1c0000, 11, 1); if (nRet != 0) return 1; - } - GfxDecode(8192, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x400000); - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ctribeb2")) { - nRet = BurnLoadRom(DrvTempRom + 0x000000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x020000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x040000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x060000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x120000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x140000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x160000, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x180000, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200000, 22, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x220000, 23, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x240000, 24, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x260000, 25, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x280000, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300000, 27, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x320000, 28, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x340000, 29, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x360000, 30, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x380000, 31, 1); if (nRet != 0) return 1; - } else { - nRet = BurnLoadRom(DrvTempRom + 0x000000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x180000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x280000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x380000, 15, 1); if (nRet != 0) return 1; - } - GfxDecode(0x4800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); - - // Load Sample Roms - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ctribeb")) { - memset(DrvTempRom, 0, 0x400000); - nRet = BurnLoadRom(DrvTempRom, 16, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROM + 0x20000, DrvTempRom + 0x00000, 0x20000); - memcpy(MSM6295ROM + 0x00000, DrvTempRom + 0x20000, 0x20000); - } else { - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ctribeb2")) { - nRet = BurnLoadRom(MSM6295ROM + 0x00000, 32, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROM + 0x20000, 33, 1); if (nRet != 0) return 1; - } else { - nRet = BurnLoadRom(MSM6295ROM + 0x00000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROM + 0x20000, 17, 1); if (nRet != 0) return 1; - } - } - memcpy(DrvMSM6295ROMSrc, MSM6295ROM, 0x40000); - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvFgVideoRam , 0x080000, 0x080fff, SM_RAM); - SekMapMemory(DrvSpriteRam , 0x081000, 0x081fff, SM_RAM); - SekMapMemory(DrvBgVideoRam , 0x082000, 0x0827ff, SM_RAM); - SekMapMemory(Drv68KRam , 0x082800, 0x082fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x100000, 0x1005ff, SM_RAM); - SekMapMemory(Drv68KRam + 0x800 , 0x1c0000, 0x1c3fff, SM_RAM); - SekSetReadWordHandler(0, Ctribeb68KReadWord); - SekSetWriteWordHandler(0, Ctribeb68KWriteWord); - SekSetReadByteHandler(0, Ctribeb68KReadByte); - SekSetWriteByteHandler(0, Ctribeb68KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(CtribeZ80Read); - ZetSetWriteHandler(CtribeZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.20, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.20, BURN_SND_ROUTE_RIGHT); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 1000000 / 132, 1); - MSM6295SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); - - DrawFunction = CtribeDraw; - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - SekExit(); - ZetExit(); - - BurnYM2151Exit(); - MSM6295Exit(0); - - GenericTilesExit(); - - DrawFunction = NULL; - - DrvBgTileBase = 0; - DrvBgScrollX = 0; - DrvBgScrollY = 0; - DrvFgScrollX = 0; - DrvFgScrollY = 0; - DrvVReg = 0; - DrvSoundLatch = 0; - DrvOkiBank = 0; - DrvVBlank = 0; - - BurnFree(Mem); - - return 0; -} - -static inline UINT8 pal4bit(UINT8 bits) -{ - bits &= 0x0f; - return (bits << 4) | bits; -} - -static inline UINT8 pal5bit(UINT8 bits) -{ - bits &= 0x1f; - return (bits << 3) | (bits >> 2); -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal5bit(nColour >> 0); - g = pal5bit(nColour >> 5); - b = pal5bit(nColour >> 10); - - return BurnHighCol(r, g, b, 0); -} - -inline static UINT32 CtribeCalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(nColour >> 0); - g = pal4bit(nColour >> 4); - b = pal4bit(nColour >> 8); - - return BurnHighCol(r, g, b, 0); -} - -static void DrvCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x600; i++, ps++, pd++) { - *pd = CalcCol(BURN_ENDIAN_SWAP_INT16(*ps)); - } -} - -static void CtribeCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x600; i++, ps++, pd++) { - *pd = CtribeCalcCol(BURN_ENDIAN_SWAP_INT16(*ps)); - } -} - -static void DrvRenderBgLayer(INT32 Opaque) -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvBgVideoRam; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Attr = BURN_ENDIAN_SWAP_INT16(VideoRam[TileIndex]); - Code = (Attr & 0xfff) | ((DrvBgTileBase & 0x01) << 12); - Colour = ((Attr & 0xf000) >> 12); - - x = 16 * mx; - y = 16 * my; - - x -= DrvBgScrollX; - y -= DrvBgScrollY; - if (x < -16) x += 512; - if (y < -16) y += 512; - - y -= 8; - - if (Opaque) { - if (x > 16 && x < 304 && y > 16 && y < 224) { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); - } - } else { - if (x > 16 && x < 304 && y > 16 && y < 224) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512, DrvTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512, DrvTiles); - } - } - - TileIndex++; - } - } -} - -static void DrvRenderFgLayer(INT32 Opaque) -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0, Offset, xFlip; - - UINT16 *VideoRam = (UINT16*)DrvFgVideoRam; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Offset = TileIndex * 2; - Attr = BURN_ENDIAN_SWAP_INT16(VideoRam[Offset]); - Code = BURN_ENDIAN_SWAP_INT16(VideoRam[Offset + 1]) & 0x1fff; - Colour = Attr & 0x0f; - xFlip = Attr & 0x40; - - x = 16 * mx; - y = 16 * my; - - x -= DrvFgScrollX; - y -= DrvFgScrollY; - if (x < -16) x += 512; - if (y < -16) y += 512; - - y -= 8; - - if (Opaque) { - if (x > 16 && x < 304 && y > 16 && y < 224) { - if (xFlip) { - Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } else { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } - } else { - if (xFlip) { - Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); - } - } - } else { - if (x > 16 && x < 304 && y > 16 && y < 224) { - if (xFlip) { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); - } - } else { - if (xFlip) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); - } - } - } - - TileIndex++; - } - } -} - -static void DrvRenderSprites() -{ - UINT16 *Source = (UINT16*)DrvSpriteRam; - UINT16 *Finish = Source + 0x800; - - while (Source < Finish) { - UINT16 Attr = BURN_ENDIAN_SWAP_INT16(Source[1]); - - if (Attr & 0x01) { - INT32 i; - INT32 Bank = BURN_ENDIAN_SWAP_INT16(Source[3]) & 0xff; - INT32 Code = (BURN_ENDIAN_SWAP_INT16(Source[2]) & 0xff) + (Bank * 256); - INT32 Colour = BURN_ENDIAN_SWAP_INT16(Source[4]) & 0xf; - INT32 xFlip = Attr & 0x10; - INT32 yFlip = Attr & 0x08; - INT32 sx = BURN_ENDIAN_SWAP_INT16(Source[5]) & 0xff; - INT32 sy = BURN_ENDIAN_SWAP_INT16(Source[0]) & 0xff; - INT32 Height = (Attr >> 5) & 0x07; - - if (Attr & 0x04) sx |= 0x100; - if (Attr & 0x02) { - sy = 239 + (0x100 - sy); - } else { - sy = 240 - sy; - } - if (sx > 0x17f) sx = 0 - (0x200 - sx); - - sy -= 8; - - for (i = 0; i <= Height; i++) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code + i, sx, sy - (i * 16), Colour, 4, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code + i, sx, sy - (i * 16), Colour, 4, 0, 0, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code + i, sx, sy - (i * 16), Colour, 4, 0, 0, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code + i, sx, sy - (i * 16), Colour, 4, 0, 0, DrvSprites); - } - } - } - } - - Source += 8; - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - - if ((DrvVReg & 0x60) == 0x40) { - DrvRenderBgLayer(1); - DrvRenderFgLayer(0); - DrvRenderSprites(); - } else if ((DrvVReg & 0x60) == 0x60) { - DrvRenderFgLayer(1); - DrvRenderBgLayer(0); - DrvRenderSprites(); - } else { - DrvRenderBgLayer(1); - DrvRenderSprites(); - DrvRenderFgLayer(0); - } - - BurnTransferCopy(DrvPalette); -} - -static void CtribeDraw() -{ - BurnTransferClear(); - CtribeCalcPalette(); - - if (DrvVReg & 0x08) { - DrvRenderFgLayer(1); - DrvRenderSprites(); - DrvRenderBgLayer(0); - } else { - DrvRenderBgLayer(1); - DrvRenderFgLayer(0); - DrvRenderSprites(); - } - - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = 12000000 / 60; - nCyclesTotal[1] = 3579545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - DrvVBlank = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 5) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - if (i == 5) DrvVBlank = 1; - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - SekOpen(0); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) DrawFunction(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029674; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); // Scan Z80 - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(DrvDip); - SCAN_VAR(DrvInput); - SCAN_VAR(DrvBgTileBase); - SCAN_VAR(DrvBgScrollX); - SCAN_VAR(DrvBgScrollY); - SCAN_VAR(DrvFgScrollX); - SCAN_VAR(DrvFgScrollY); - SCAN_VAR(DrvVReg); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(DrvOkiBank); - SCAN_VAR(DrvVBlank); - } - - if (nAction & ACB_WRITE) { - memcpy(MSM6295ROM + 0x00000, DrvMSM6295ROMSrc + (0x40000 * DrvOkiBank), 0x40000); - } - - return 0; -} - -struct BurnDriver BurnDrvDdragon3 = { - "ddragon3", NULL, NULL, NULL, "1990", - "Double Dragon 3 - The Rosetta Stone (US)\0", NULL, "Technos", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdrago3j = { - "ddragon3j", "ddragon3", NULL, NULL, "1990", - "Double Dragon 3 - The Rosetta Stone (Japan)\0", NULL, "Technos", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdrago3p = { - "ddragon3p", "ddragon3", NULL, NULL, "1990", - "Double Dragon 3 - The Rosetta Stone (prototype)\0", NULL, "Technos", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_PROTOTYPE, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvpRomInfo, DrvpRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvpInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDdrago3b = { - "ddragon3b", "ddragon3", NULL, NULL, "1990", - "Double Dragon 3 - The Rosetta Stone (bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvbDIPInfo, - DrvbInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvCtribe = { - "ctribe", NULL, NULL, NULL, "1990", - "The Combatribes (US)\0", NULL, "Technos", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, CtribeRomInfo, CtribeRomName, NULL, NULL, DrvInputInfo, CtribeDIPInfo, - CtribeInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvCtribe1 = { - "ctribe1", "ctribe", NULL, NULL, "1990", - "The Combatribes (US) - Set 1?\0", NULL, "Technos", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, Ctribe1RomInfo, Ctribe1RomName, NULL, NULL, DrvInputInfo, CtribeDIPInfo, - CtribeInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvCtribej = { - "ctribej", "ctribe", NULL, NULL, "1990", - "The Combatribes (Japan)\0", NULL, "Technos", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, CtribejRomInfo, CtribejRomName, NULL, NULL, DrvInputInfo, CtribeDIPInfo, - CtribeInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvCtribeb = { - "ctribeb", "ctribe", NULL, NULL, "1990", - "The Combatribes (bootleg set 1)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, CtribebRomInfo, CtribebRomName, NULL, NULL, DrvInputInfo, CtribeDIPInfo, - CtribeInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvCtribeb2 = { - "ctribeb2", "ctribe", NULL, NULL, "1990", - "The Combatribes (bootleg set 2)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, Ctribeb2RomInfo, Ctribeb2RomName, NULL, NULL, DrvInputInfo, CtribeDIPInfo, - CtribeInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x600, 320, 240, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm6295.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[4] = {0, 0, 0, 0}; +static UINT8 DrvInput[4] = {0x00, 0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Drv68KRom = NULL; +static UINT8 *Drv68KRam = NULL; +static UINT8 *DrvMSM6295ROMSrc = NULL; +static UINT8 *DrvFgVideoRam = NULL; +static UINT8 *DrvBgVideoRam = NULL; +static UINT8 *DrvZ80Rom = NULL; +static UINT8 *DrvZ80Ram = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvPaletteRam = NULL; +static UINT8 *DrvTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT16 DrvBgTileBase; +static UINT16 DrvBgScrollX; +static UINT16 DrvBgScrollY; +static UINT16 DrvFgScrollX; +static UINT16 DrvFgScrollY; +static UINT16 DrvVReg; +static UINT8 DrvSoundLatch; +static UINT8 DrvOkiBank; +static UINT8 DrvVBlank; + +typedef void (*Render)(); +static Render DrawFunction; +static void DrvDraw(); +static void CtribeDraw(); + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 7, "p2 start" }, + {"Start 3" , BIT_DIGITAL , DrvInputPort3 + 7, "p3 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 fire 3" }, + + {"P3 Up" , BIT_DIGITAL , DrvInputPort3 + 2, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , DrvInputPort3 + 3, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , DrvInputPort3 + 1, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , DrvInputPort3 + 0, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , DrvInputPort3 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , DrvInputPort3 + 5, "p3 fire 2" }, + {"P3 Fire 3" , BIT_DIGITAL , DrvInputPort3 + 6, "p3 fire 3" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort1 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, DrvDip + 2 , "dip" }, + {"Dip 4" , BIT_DIPSWITCH, DrvDip + 3 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = DrvInput[2] = DrvInput[3] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + DrvInput[3] |= (DrvInputPort3[i] & 1) << i; + } + + // Clear Opposites + DrvClearOpposites(&DrvInput[0]); + DrvClearOpposites(&DrvInput[2]); + DrvClearOpposites(&DrvInput[3]); +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x1c, 0xff, 0xff, 0xff, NULL }, + {0x1d, 0xff, 0xff, 0xff, NULL }, + {0x1e, 0xff, 0xff, 0xff, NULL }, + {0x1f, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x1c, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x1c, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x1c, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x1c, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Continue Discount" }, + {0x1c, 0x01, 0x10, 0x10, "Off" }, + {0x1c, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x1c, 0x01, 0x20, 0x00, "Off" }, + {0x1c, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x1c, 0x01, 0x40, 0x40, "Off" }, + {0x1c, 0x01, 0x40, 0x00, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x1d, 0x01, 0x03, 0x02, "Easy" }, + {0x1d, 0x01, 0x03, 0x03, "Normal" }, + {0x1d, 0x01, 0x03, 0x01, "Hard" }, + {0x1d, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Player vs Player Damage"}, + {0x1d, 0x01, 0x04, 0x04, "Off" }, + {0x1d, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Test Mode" }, + {0x1d, 0x01, 0x10, 0x10, "Off" }, + {0x1d, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Stage Clear Energy" }, + {0x1d, 0x01, 0x20, 0x00, "Off" }, + {0x1d, 0x01, 0x20, 0x20, "50" }, + + {0 , 0xfe, 0 , 2 , "Starting Energy" }, + {0x1d, 0x01, 0x40, 0x00, "200" }, + {0x1d, 0x01, 0x40, 0x40, "230" }, + + {0 , 0xfe, 0 , 2 , "Number of Players" }, + {0x1d, 0x01, 0x80, 0x80, "2" }, + {0x1d, 0x01, 0x80, 0x00, "3" }, +}; + +STDDIPINFO(Drv) + +static struct BurnDIPInfo DrvbDIPList[]= +{ + // Default Values + {0x1c, 0xff, 0xff, 0x10, NULL }, + {0x1d, 0xff, 0xff, 0xff, NULL }, + {0x1e, 0xff, 0xff, 0xff, NULL }, + {0x1f, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x1c, 0x01, 0x10, 0x10, "Off" }, + {0x1c, 0x01, 0x10, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x1d, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x1d, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x1d, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x1d, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Continue Discount" }, + {0x1d, 0x01, 0x10, 0x10, "Off" }, + {0x1d, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x1d, 0x01, 0x20, 0x00, "Off" }, + {0x1d, 0x01, 0x20, 0x20, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x1e, 0x01, 0x03, 0x02, "Easy" }, + {0x1e, 0x01, 0x03, 0x03, "Normal" }, + {0x1e, 0x01, 0x03, 0x01, "Hard" }, + {0x1e, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Player vs Player Damage"}, + {0x1e, 0x01, 0x04, 0x04, "Off" }, + {0x1e, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Test Mode" }, + {0x1e, 0x01, 0x10, 0x10, "Off" }, + {0x1e, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Stage Clear Energy" }, + {0x1e, 0x01, 0x20, 0x00, "Off" }, + {0x1e, 0x01, 0x20, 0x20, "50" }, + + // Dip 4 + {0 , 0xfe, 0 , 2 , "Starting Energy" }, + {0x1f, 0x01, 0x01, 0x00, "200" }, + {0x1f, 0x01, 0x01, 0x01, "230" }, + + {0 , 0xfe, 0 , 2 , "Number of Players" }, + {0x1f, 0x01, 0x02, 0x02, "2" }, + {0x1f, 0x01, 0x02, 0x00, "3" }, +}; + +STDDIPINFO(Drvb) + +static struct BurnDIPInfo CtribeDIPList[]= +{ + // Default Values + {0x1c, 0xff, 0xff, 0x10, NULL }, + {0x1d, 0xff, 0xff, 0xff, NULL }, + {0x1e, 0xff, 0xff, 0xff, NULL }, + {0x1f, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x1c, 0x01, 0x10, 0x10, "Off" }, + {0x1c, 0x01, 0x10, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x1d, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x1d, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x1d, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x1d, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Continue Discount" }, + {0x1d, 0x01, 0x10, 0x10, "Off" }, + {0x1d, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x1d, 0x01, 0x20, 0x00, "Off" }, + {0x1d, 0x01, 0x20, 0x20, "On" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x1e, 0x01, 0x03, 0x02, "Easy" }, + {0x1e, 0x01, 0x03, 0x03, "Normal" }, + {0x1e, 0x01, 0x03, 0x01, "Hard" }, + {0x1e, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Timer Speed" }, + {0x1e, 0x01, 0x04, 0x04, "Normal" }, + {0x1e, 0x01, 0x04, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "FBI Logo" }, + {0x1e, 0x01, 0x08, 0x00, "Off" }, + {0x1e, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2 , "Test Mode" }, + {0x1e, 0x01, 0x10, 0x10, "Off" }, + {0x1e, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Stage Clear Energy" }, + {0x1e, 0x01, 0x20, 0x20, "0" }, + {0x1e, 0x01, 0x20, 0x00, "50" }, + + // Dip 4 + {0 , 0xfe, 0 , 2 , "More Stage Clear Energy"}, + {0x1f, 0x01, 0x01, 0x01, "Off" }, + {0x1f, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Number of Players" }, + {0x1f, 0x01, 0x02, 0x02, "2" }, + {0x1f, 0x01, 0x02, 0x00, "3" }, +}; + +STDDIPINFO(Ctribe) + +static struct BurnRomInfo DrvRomDesc[] = { + { "30a14-0.ic78", 0x40000, 0xf42fe016, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "30a15-0.ic79", 0x20000, 0xad50e92c, BRF_ESS | BRF_PRG }, // 1 + + { "30a13-0.ic43", 0x10000, 0x1e974d9b, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "30j-7.ic4", 0x40000, 0x89d58d32, BRF_GRA }, // 3 Tiles + { "30j-6.ic5", 0x40000, 0x9bf1538e, BRF_GRA }, // 4 + { "30j-5.ic6", 0x40000, 0x8f671a62, BRF_GRA }, // 5 + { "30j-4.ic7", 0x40000, 0x0f74ea1c, BRF_GRA }, // 6 + + { "30j-3.ic9", 0x80000, 0xb3151871, BRF_GRA }, // 7 Sprites + { "30a12-0.ic8", 0x10000, 0x20d64bea, BRF_GRA }, // 8 + { "30j-2.ic11", 0x80000, 0x41c6fb08, BRF_GRA }, // 9 + { "30a11-0.ic10", 0x10000, 0x785d71b0, BRF_GRA }, // 10 + { "30j-1.ic13", 0x80000, 0x67a6f114, BRF_GRA }, // 11 + { "30a10-0.ic12", 0x10000, 0x15e43d12, BRF_GRA }, // 12 + { "30j-0.ic15", 0x80000, 0xf15dafbe, BRF_GRA }, // 13 + { "30a9-0.ic14", 0x10000, 0x5a47e7a4, BRF_GRA }, // 14 + + { "30j-8.ic73", 0x80000, 0xc3ad40f3, BRF_SND }, // 15 Samples + + { "mb7114h.ic38", 0x00100, 0x113c7443, BRF_GRA }, // 16 PROM +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo DrvjRomDesc[] = { + { "30j15.ic78", 0x40000, 0x40618cbc, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "30j14.ic79", 0x20000, 0x96827e80, BRF_ESS | BRF_PRG }, // 1 + + { "30j13.ic43", 0x10000, 0x1e974d9b, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "30j-7.ic4", 0x40000, 0x89d58d32, BRF_GRA }, // 3 Tiles + { "30j-6.ic5", 0x40000, 0x9bf1538e, BRF_GRA }, // 4 + { "30j-5.ic6", 0x40000, 0x8f671a62, BRF_GRA }, // 5 + { "30j-4.ic7", 0x40000, 0x0f74ea1c, BRF_GRA }, // 6 + + { "30j-3.ic9", 0x80000, 0xb3151871, BRF_GRA }, // 7 Sprites + { "30j12-0.ic8", 0x10000, 0x1e9290d7, BRF_GRA }, // 8 + { "30j-2.ic11", 0x80000, 0x41c6fb08, BRF_GRA }, // 9 + { "30j11-0.ic10", 0x10000, 0x99195b2a, BRF_GRA }, // 10 + { "30j-1.ic13", 0x80000, 0x67a6f114, BRF_GRA }, // 11 + { "30j10-0.ic12", 0x10000, 0xe3879b5d, BRF_GRA }, // 12 + { "30j-0.ic15", 0x80000, 0xf15dafbe, BRF_GRA }, // 13 + { "30j9-0.ic14", 0x10000, 0x2759ae84, BRF_GRA }, // 14 + + { "30j-8.ic73", 0x80000, 0xc3ad40f3, BRF_SND }, // 15 Samples + + { "mb7114h.ic38", 0x00100, 0x113c7443, BRF_GRA }, // 16 PROM +}; + +STD_ROM_PICK(Drvj) +STD_ROM_FN(Drvj) + +static struct BurnRomInfo DrvpRomDesc[] = { + { "30a14-0.ic80", 0x40000, 0xf42fe016, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "30a15-0.ic79", 0x20000, 0xad50e92c, BRF_ESS | BRF_PRG }, // 1 + + { "30a13-0.ic43", 0x10000, 0x1e974d9b, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "14.ic45", 0x20000, 0xb036a27b, BRF_GRA }, // 3 Tiles + { "15.ic46", 0x20000, 0x24d0bf41, BRF_GRA }, // 4 + { "30.ic13", 0x20000, 0x72fe2b16, BRF_GRA }, // 5 + { "31.ic14", 0x20000, 0xab48a0c8, BRF_GRA }, // 6 + { "23.ic29", 0x20000, 0x0768fedd, BRF_GRA }, // 7 + { "24.ic30", 0x20000, 0xec9db18a, BRF_GRA }, // 8 + { "21.ic25", 0x20000, 0x902744b9, BRF_GRA }, // 9 + { "22.ic26", 0x20000, 0x5b142d4d, BRF_GRA }, // 10 + + { "9.ic39", 0x20000, 0x726c49b7, BRF_GRA }, // 11 Sprites + { "10.ic40", 0x20000, 0x37a1c335, BRF_GRA }, // 12 + { "11.ic41", 0x20000, 0x2bcfe63c, BRF_GRA }, // 13 + { "12.ic42", 0x20000, 0xb864cf17, BRF_GRA }, // 14 + { "4.ic33", 0x20000, 0x8c71eb06, BRF_GRA }, // 15 + { "5.ic34", 0x20000, 0x3e134be9, BRF_GRA }, // 16 + { "6.ic35", 0x20000, 0xb4115ef0, BRF_GRA }, // 17 + { "7.ic36", 0x20000, 0x4639333d, BRF_GRA }, // 18 + { "16.ic19", 0x20000, 0x04420cc8, BRF_GRA }, // 19 + { "17.ic20", 0x20000, 0x33f97b2f, BRF_GRA }, // 20 + { "18.ic21", 0x20000, 0x0f9a8f2a, BRF_GRA }, // 21 + { "19.ic22", 0x20000, 0x15c91772, BRF_GRA }, // 22 + { "25.ic3", 0x20000, 0x894734b3, BRF_GRA }, // 23 + { "26.ic4", 0x20000, 0xcd504584, BRF_GRA }, // 24 + { "27.ic5", 0x20000, 0x38e8a9ad, BRF_GRA }, // 25 + { "28.ic6", 0x20000, 0x80c1cb74, BRF_GRA }, // 26 + { "30a12-0.ic43", 0x20000, 0x91da004c, BRF_GRA }, // 27 + { "30a11-0.ic37", 0x20000, 0x5f419232, BRF_GRA }, // 28 + { "30a10-0.ic23", 0x20000, 0x12f641ba, BRF_GRA }, // 29 + { "30a9-0.ic7", 0x20000, 0x9199a77b, BRF_GRA }, // 30 + + { "2.ic73", 0x40000, 0x3af21dbe, BRF_SND }, // 31 Samples + { "3.ic74", 0x40000, 0xc28b53cd, BRF_SND }, // 32 + + { "30.ic38", 0x00100, 0x113c7443, BRF_GRA }, // 33 PROM +}; + +STD_ROM_PICK(Drvp) +STD_ROM_FN(Drvp) + +static struct BurnRomInfo DrvbRomDesc[] = { + { "dd3.01", 0x20000, 0x68321d8b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "dd3.03", 0x20000, 0xbc05763b, BRF_ESS | BRF_PRG }, // 1 + { "dd3.02", 0x20000, 0x38d9ae75, BRF_ESS | BRF_PRG }, // 2 + + { "dd3.06", 0x10000, 0x1e974d9b, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "dd3.f", 0x40000, 0x89d58d32, BRF_GRA }, // 4 Tiles + { "dd3.e", 0x40000, 0x9bf1538e, BRF_GRA }, // 5 + { "dd3.b", 0x40000, 0x8f671a62, BRF_GRA }, // 6 + { "dd3.a", 0x40000, 0x0f74ea1c, BRF_GRA }, // 7 + + { "dd3.3e", 0x20000, 0x726c49b7, BRF_GRA }, // 8 Sprites + { "dd3.3d", 0x20000, 0x37a1c335, BRF_GRA }, // 9 + { "dd3.3c", 0x20000, 0x2bcfe63c, BRF_GRA }, // 10 + { "dd3.3b", 0x20000, 0xb864cf17, BRF_GRA }, // 11 + { "dd3.3a", 0x10000, 0x20d64bea, BRF_GRA }, // 12 + { "dd3.2e", 0x20000, 0x8c71eb06, BRF_GRA }, // 13 + { "dd3.2d", 0x20000, 0x3e134be9, BRF_GRA }, // 14 + { "dd3.2c", 0x20000, 0xb4115ef0, BRF_GRA }, // 15 + { "dd3.2b", 0x20000, 0x4639333d, BRF_GRA }, // 16 + { "dd3.2a", 0x10000, 0x785d71b0, BRF_GRA }, // 17 + { "dd3.1e", 0x20000, 0x04420cc8, BRF_GRA }, // 18 + { "dd3.1d", 0x20000, 0x33f97b2f, BRF_GRA }, // 19 + { "dd3.1c", 0x20000, 0x0f9a8f2a, BRF_GRA }, // 20 + { "dd3.1b", 0x20000, 0x15c91772, BRF_GRA }, // 21 + { "dd3.1a", 0x10000, 0x15e43d12, BRF_GRA }, // 22 + { "dd3.0e", 0x20000, 0x894734b3, BRF_GRA }, // 23 + { "dd3.0d", 0x20000, 0xcd504584, BRF_GRA }, // 24 + { "dd3.0c", 0x20000, 0x38e8a9ad, BRF_GRA }, // 25 + { "dd3.0b", 0x20000, 0x80c1cb74, BRF_GRA }, // 26 + { "dd3.0a", 0x10000, 0x5a47e7a4, BRF_GRA }, // 27 + + { "dd3.j7", 0x40000, 0x3af21dbe, BRF_SND }, // 28 Samples + { "dd3.j8", 0x40000, 0xc28b53cd, BRF_SND }, // 29 + + { "mb7114h.38", 0x00100, 0x113c7443, BRF_GRA }, // 30 PROM +}; + +STD_ROM_PICK(Drvb) +STD_ROM_FN(Drvb) + +static struct BurnRomInfo CtribeRomDesc[] = { + { "28a16-2.ic26", 0x20000, 0xc46b2e63, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "28a15-2.ic25", 0x20000, 0x3221c755, BRF_ESS | BRF_PRG }, // 1 + { "28j17-0.104", 0x10000, 0x8c2c6dbd, BRF_ESS | BRF_PRG }, // 2 + + { "28a10-0.ic89", 0x08000, 0x4346de13, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "28j7-0.ic11", 0x40000, 0xa8b773f1, BRF_GRA }, // 4 Tiles + { "28j6-0.ic13", 0x40000, 0x617530fc, BRF_GRA }, // 5 + { "28j5-0.ic12", 0x40000, 0xcef0a821, BRF_GRA }, // 6 + { "28j4-0.ic14", 0x40000, 0xb84fda09, BRF_GRA }, // 7 + + { "28j3-0.ic77", 0x80000, 0x1ac2a461, BRF_GRA }, // 8 Sprites + { "28a14-0.ic60", 0x10000, 0x972faddb, BRF_GRA }, // 9 + { "28j2-0.ic78", 0x80000, 0x8c796707, BRF_GRA }, // 10 + { "28a13-0.ic61", 0x10000, 0xeb3ab374, BRF_GRA }, // 11 + { "28j1-0.ic97", 0x80000, 0x1c9badbd, BRF_GRA }, // 12 + { "28a12-0.ic85", 0x10000, 0xc602ac97, BRF_GRA }, // 13 + { "28j0-0.ic98", 0x80000, 0xba73c49e, BRF_GRA }, // 14 + { "28a11-0.ic86", 0x10000, 0x4da1d8e5, BRF_GRA }, // 15 + + { "28j9-0.ic83", 0x20000, 0xf92a7f4a, BRF_SND }, // 16 Samples + { "28j8-0.ic82", 0x20000, 0x1a3a0b39, BRF_SND }, // 17 + + { "28.ic44", 0x00100, 0x964329ef, BRF_GRA }, // 18 PROM +}; + +STD_ROM_PICK(Ctribe) +STD_ROM_FN(Ctribe) + +static struct BurnRomInfo Ctribe1RomDesc[] = { + { "1_28a16-2.ic26",0x20000, 0xf00f8443, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "1_28a15-2.ic25",0x20000, 0xdd70079f, BRF_ESS | BRF_PRG }, // 1 + { "28j17-0.104", 0x10000, 0x8c2c6dbd, BRF_ESS | BRF_PRG }, // 2 + + { "28a10-0.ic89", 0x08000, 0x4346de13, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "28j7-0.ic11", 0x40000, 0xa8b773f1, BRF_GRA }, // 4 Tiles + { "28j6-0.ic13", 0x40000, 0x617530fc, BRF_GRA }, // 5 + { "28j5-0.ic12", 0x40000, 0xcef0a821, BRF_GRA }, // 6 + { "28j4-0.ic14", 0x40000, 0xb84fda09, BRF_GRA }, // 7 + + { "28j3-0.ic77", 0x80000, 0x1ac2a461, BRF_GRA }, // 8 Sprites + { "28a14-0.ic60", 0x10000, 0x972faddb, BRF_GRA }, // 9 + { "28j2-0.ic78", 0x80000, 0x8c796707, BRF_GRA }, // 10 + { "28a13-0.ic61", 0x10000, 0xeb3ab374, BRF_GRA }, // 11 + { "28j1-0.ic97", 0x80000, 0x1c9badbd, BRF_GRA }, // 12 + { "28a12-0.ic85", 0x10000, 0xc602ac97, BRF_GRA }, // 13 + { "28j0-0.ic98", 0x80000, 0xba73c49e, BRF_GRA }, // 14 + { "28a11-0.ic86", 0x10000, 0x4da1d8e5, BRF_GRA }, // 15 + + { "28j9-0.ic83", 0x20000, 0xf92a7f4a, BRF_SND }, // 16 Samples + { "28j8-0.ic82", 0x20000, 0x1a3a0b39, BRF_SND }, // 17 + + { "28.ic44", 0x00100, 0x964329ef, BRF_GRA }, // 18 PROM +}; + +STD_ROM_PICK(Ctribe1) +STD_ROM_FN(Ctribe1) + +static struct BurnRomInfo CtribejRomDesc[] = { + { "28j16-02.26", 0x20000, 0x658b8568, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "28j15-12.25", 0x20000, 0x50aac7e7, BRF_ESS | BRF_PRG }, // 1 + { "28j17-0.104", 0x10000, 0x8c2c6dbd, BRF_ESS | BRF_PRG }, // 2 + + { "28j10-0.89", 0x08000, 0x4346de13, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "28j7-0.ic11", 0x40000, 0xa8b773f1, BRF_GRA }, // 4 Tiles + { "28j6-0.ic13", 0x40000, 0x617530fc, BRF_GRA }, // 5 + { "28j5-0.ic12", 0x40000, 0xcef0a821, BRF_GRA }, // 6 + { "28j4-0.ic14", 0x40000, 0xb84fda09, BRF_GRA }, // 7 + + { "28j3-0.ic77", 0x80000, 0x1ac2a461, BRF_GRA }, // 8 Sprites + { "28j14-0.60", 0x10000, 0x6869050a, BRF_GRA }, // 9 + { "28j2-0.ic78", 0x80000, 0x8c796707, BRF_GRA }, // 10 + { "28j13-0.61", 0x10000, 0x8b8addea, BRF_GRA }, // 11 + { "28j1-0.ic97", 0x80000, 0x1c9badbd, BRF_GRA }, // 12 + { "28j12-0.85", 0x10000, 0x422b041c, BRF_GRA }, // 13 + { "28j0-0.ic98", 0x80000, 0xba73c49e, BRF_GRA }, // 14 + { "28j11-0.86", 0x10000, 0x4a391c5b, BRF_GRA }, // 15 + + { "28j9-0.ic83", 0x20000, 0xf92a7f4a, BRF_SND }, // 16 Samples + { "28j8-0.ic82", 0x20000, 0x1a3a0b39, BRF_SND }, // 17 + + { "28.ic44", 0x00100, 0x964329ef, BRF_GRA }, // 18 PROM +}; + +STD_ROM_PICK(Ctribej) +STD_ROM_FN(Ctribej) + +static struct BurnRomInfo CtribebRomDesc[] = { + { "ct_ep1.rom", 0x20000, 0x9cfa997f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ct_ep3.rom", 0x20000, 0x2ece8681, BRF_ESS | BRF_PRG }, // 1 + { "ct_ep2.rom", 0x10000, 0x8c2c6dbd, BRF_ESS | BRF_PRG }, // 2 + + { "ct_ep4.rom", 0x08000, 0x4346de13, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "ct_mr7.rom", 0x40000, 0xa8b773f1, BRF_GRA }, // 4 Tiles + { "ct_mr6.rom", 0x40000, 0x617530fc, BRF_GRA }, // 5 + { "ct_mr5.rom", 0x40000, 0xcef0a821, BRF_GRA }, // 6 + { "ct_mr4.rom", 0x40000, 0xb84fda09, BRF_GRA }, // 7 + + { "ct_mr3.rom", 0x80000, 0x1ac2a461, BRF_GRA }, // 8 Sprites + { "ct_ep5.rom", 0x10000, 0x972faddb, BRF_GRA }, // 9 + { "ct_mr2.rom", 0x80000, 0x8c796707, BRF_GRA }, // 10 + { "ct_ep6.rom", 0x10000, 0xeb3ab374, BRF_GRA }, // 11 + { "ct_mr1.rom", 0x80000, 0x1c9badbd, BRF_GRA }, // 12 + { "ct_ep7.rom", 0x10000, 0xc602ac97, BRF_GRA }, // 13 + { "ct_mr0.rom", 0x80000, 0xba73c49e, BRF_GRA }, // 14 + { "ct_ep8.rom", 0x10000, 0x4da1d8e5, BRF_GRA }, // 15 + + { "ct_mr8.rom", 0x40000, 0x9963a6be, BRF_SND }, // 16 Samples +}; + +STD_ROM_PICK(Ctribeb) +STD_ROM_FN(Ctribeb) + +static struct BurnRomInfo Ctribeb2RomDesc[] = { + { "1.bin", 0x20000, 0x9cfa997f, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "3.bin", 0x20000, 0x2ece8681, BRF_ESS | BRF_PRG }, // 1 + { "2.bin", 0x10000, 0x8c2c6dbd, BRF_ESS | BRF_PRG }, // 2 + + { "6.bin", 0x10000, 0x0101df2d, BRF_ESS | BRF_PRG }, // 3 Z80 Program + + { "7.bin", 0x40000, 0xa8b773f1, BRF_GRA }, // 4 Tiles + { "8.bin", 0x40000, 0x617530fc, BRF_GRA }, // 5 + { "11.bin", 0x40000, 0xcef0a821, BRF_GRA }, // 6 + { "12.bin", 0x40000, 0xb84fda09, BRF_GRA }, // 7 + { "9.bin", 0x20000, 0x2719d7ce, BRF_GRA }, // 8 + { "10.bin", 0x20000, 0x753a4f53, BRF_GRA }, // 9 + { "13.bin", 0x20000, 0x59e01fe1, BRF_GRA }, // 10 + { "14.bin", 0x20000, 0xa69ab4f3, BRF_GRA }, // 11 + + { "34.bin", 0x20000, 0x5b498f0e, BRF_GRA }, // 12 Sprites + { "33.bin", 0x20000, 0x14d79049, BRF_GRA }, // 13 + { "32.bin", 0x20000, 0x9631ea23, BRF_GRA }, // 14 + { "31.bin", 0x20000, 0x0ca8d3b9, BRF_GRA }, // 15 + { "30.bin", 0x10000, 0x972faddb, BRF_GRA }, // 16 + { "29.bin", 0x20000, 0x479ae8ea, BRF_GRA }, // 17 + { "28.bin", 0x20000, 0x95598bbf, BRF_GRA }, // 18 + { "27.bin", 0x20000, 0x4a3d006d, BRF_GRA }, // 19 + { "26.bin", 0x20000, 0xaa34a3cb, BRF_GRA }, // 20 + { "25.bin", 0x10000, 0xeb3ab374, BRF_GRA }, // 21 + { "24.bin", 0x20000, 0xd60bbff0, BRF_GRA }, // 22 + { "23.bin", 0x20000, 0xd9595c47, BRF_GRA }, // 23 + { "22.bin", 0x20000, 0x5a19a911, BRF_GRA }, // 24 + { "21.bin", 0x20000, 0x071360f9, BRF_GRA }, // 25 + { "20.bin", 0x10000, 0xc602ac97, BRF_GRA }, // 26 + { "19.bin", 0x20000, 0x8d22736a, BRF_GRA }, // 27 + { "18.bin", 0x20000, 0x0f157822, BRF_GRA }, // 28 + { "17.bin", 0x20000, 0x7f48c824, BRF_GRA }, // 29 + { "16.bin", 0x20000, 0xcd1e9bd5, BRF_GRA }, // 30 + { "15.bin", 0x10000, 0x4da1d8e5, BRF_GRA }, // 31 + + { "5.bin", 0x20000, 0xf92a7f4a, BRF_SND }, // 32 Samples + { "4.bin", 0x20000, 0x1a3a0b39, BRF_SND }, // 33 +}; + +STD_ROM_PICK(Ctribeb2) +STD_ROM_FN(Ctribeb2) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x80000; + DrvZ80Rom = Next; Next += 0x10000; + MSM6295ROM = Next; Next += 0x40000; + DrvMSM6295ROMSrc = Next; Next += 0x80000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x04800; + DrvZ80Ram = Next; Next += 0x00800; + DrvFgVideoRam = Next; Next += 0x01000; + DrvSpriteRam = Next; Next += 0x01000; + DrvBgVideoRam = Next; Next += 0x00800; + DrvPaletteRam = Next; Next += 0x00600; + + RamEnd = Next; + + DrvTiles = Next; Next += 8192 * 16 * 16; + DrvSprites = Next; Next += 0x4800 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00600 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + MSM6295Reset(0); + + DrvBgTileBase = 0; + DrvBgScrollX = 0; + DrvBgScrollY = 0; + DrvFgScrollX = 0; + DrvFgScrollY = 0; + DrvVReg = 0; + DrvSoundLatch = 0; + DrvOkiBank = 0; + DrvVBlank = 0; + + return 0; +} + +UINT8 __fastcall Ddragon368KReadByte(UINT32 a) +{ + switch (a) { + case 0x100000: { + return 0xff - DrvInput[2]; + } + + case 0x100001: { + return 0xff - DrvInput[0]; + } + + case 0x100003: { + return 0xff - DrvInput[1]; + } + + case 0x100007: { + return 0xff - DrvInput[3]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ddragon368KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x100003: { + DrvSoundLatch = d; + ZetOpen(0); + ZetNmi(); + nCyclesDone[1] += ZetRun(100); + ZetClose(); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Ddragon368KReadWord(UINT32 a) +{ + switch (a) { + case 0x100002: { + return (0xff << 8) | (0xff - DrvInput[1]); + } + + case 0x100004: { + return (DrvDip[1] << 8) | DrvDip[0]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ddragon368KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x000004: + case 0x000006: { + // ??? + return; + } + + case 0x0c0000: { + DrvFgScrollX = d & 0x1ff; + return; + } + + case 0x0c0002: { + DrvFgScrollY = d & 0x1ff; + return; + } + + case 0x0c0004: { + DrvBgScrollX = d & 0x1ff; + return; + } + + case 0x0c0006: { + DrvBgScrollY = d & 0x1ff; + return; + } + + case 0x0c0008: { + return; + } + + case 0x0c000c: { + DrvBgTileBase = d & 0x1ff; + return; + } + + case 0x100000: { + DrvVReg = d; + return; + } + + case 0x100002: { + DrvSoundLatch = d; + ZetOpen(0); + ZetNmi(); + nCyclesDone[1] += ZetRun(100); + ZetClose(); + return; + } + + case 0x100004: + case 0x100006: + case 0x100008: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Ddragon3b68KReadByte(UINT32 a) +{ + switch (a) { + case 0x180000: { + return 0xef - DrvInput[1] + (DrvDip[0] & 0x10); + } + + case 0x180001: { + return 0xff - DrvInput[0]; + } + + case 0x180002: { + return DrvDip[1]; + } + + case 0x180003: { + return 0xff - DrvInput[2]; + } + + case 0x180005: { + return 0xff - DrvInput[3]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ddragon3b68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x140003: { + DrvSoundLatch = d; + ZetOpen(0); + ZetNmi(); + nCyclesDone[1] += ZetRun(100); + ZetClose(); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Ddragon3b68KReadWord(UINT32 a) +{ + switch (a) { + case 0x180000: { + return (((0xef - DrvInput[1]) + (DrvDip[0] & 0x10)) << 8) | (0xff - DrvInput[0]); + } + + case 0x180004: { + return (DrvDip[2] << 8) | (0xff - DrvInput[3]); + } + + case 0x180006: { + return (DrvDip[3] << 8) | 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ddragon3b68KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x000004: + case 0x000006: { + // ??? + return; + } + + case 0x0c0000: { + DrvFgScrollX = d & 0x1ff; + return; + } + + case 0x0c0002: { + DrvFgScrollY = d & 0x1ff; + return; + } + + case 0x0c0004: { + DrvBgScrollX = d & 0x1ff; + return; + } + + case 0x0c0006: { + DrvBgScrollY = d & 0x1ff; + return; + } + + case 0x0c0008: { + return; + } + + case 0x0c000c: { + DrvBgTileBase = d & 0x1ff; + return; + } + + case 0x140000: { + DrvVReg = d; + return; + } + + case 0x140002: { + DrvSoundLatch = d; + ZetOpen(0); + ZetNmi(); + nCyclesDone[1] += ZetRun(100); + ZetClose(); + return; + } + + case 0x140004: + case 0x140006: + case 0x140008: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Ddragon3Z80Read(UINT16 a) +{ + switch (a) { + case 0xc801: { + return BurnYM2151ReadStatus(); + } + + case 0xd800: { + return MSM6295ReadStatus(0); + } + + case 0xe000: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall Ddragon3Z80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xc800: { + BurnYM2151SelectRegister(d); + return; + } + + case 0xc801: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xd800: { + MSM6295Command(0, d); + return; + } + + case 0xe800: { + DrvOkiBank = d & 1; + memcpy(MSM6295ROM + 0x00000, DrvMSM6295ROMSrc + (0x40000 * DrvOkiBank), 0x40000); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Ctribeb68KReadByte(UINT32 a) +{ + switch (a) { + case 0x180000: { + if (DrvVBlank) return 0xe7 - DrvInput[1] + (DrvDip[0] & 0x10); + return 0xef - DrvInput[1] + (DrvDip[0] & 0x10); + } + + case 0x180001: { + return 0xff - DrvInput[0]; + } + + case 0x180003: { + return 0xff - DrvInput[2]; + } + + case 0x180004: { + return DrvDip[2]; + } + + case 0x180005: { + return 0xff - DrvInput[3]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ctribeb68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x0c000d: { + DrvBgTileBase = d; + return; + } + + case 0x140001: { + DrvVReg = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Ctribeb68KReadWord(UINT32 a) +{ + switch (a) { + case 0x180000: { + if (DrvVBlank) return ((0xe7 - DrvInput[1] + (DrvDip[0] & 0x10)) << 8) | (0xff - DrvInput[0]); + return ((0xef - DrvInput[1] + (DrvDip[0] & 0x10)) << 8) | (0xff - DrvInput[0]); + } + + case 0x180002: { + return (DrvDip[1] << 8) | (0xff - DrvInput[2]); + } + + case 0x180004: { + return (DrvDip[2] << 8) | (0xff - DrvInput[3]); + } + + case 0x180006: { + return (DrvDip[3] << 8) | 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ctribeb68KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x0c0000: { + DrvFgScrollX = d & 0x1ff; + return; + } + + case 0x0c0002: { + DrvFgScrollY = d & 0x1ff; + return; + } + + case 0x0c0004: { + DrvBgScrollX = d & 0x1ff; + return; + } + + case 0x0c0006: { + DrvBgScrollY = d & 0x1ff; + return; + } + + case 0x0c0008: { + return; + } + + case 0x0c000c: { + DrvBgTileBase = d & 0x1ff; + return; + } + + case 0x140000: { + DrvVReg = d; + return; + } + + case 0x140002: { + DrvSoundLatch = d & 0xff; + ZetOpen(0); + ZetNmi(); + nCyclesDone[1] += ZetRun(100); + ZetClose(); + return; + } + + case 0x140004: + case 0x140006: + case 0x140008: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall CtribeZ80Read(UINT16 a) +{ + switch (a) { + case 0x8801: { + return BurnYM2151ReadStatus(); + } + + case 0x9800: { + return MSM6295ReadStatus(0); + } + + case 0xa000: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall CtribeZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x8800: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x8801: { + BurnYM2151WriteRegister(d); + return; + } + + case 0x9800: { + MSM6295Command(0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 TilePlaneOffsets[4] = { 0, 0x200000, 0x400000, 0x600000 }; +static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 TileYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; +static INT32 SpritePlaneOffsets[4] = { 0, 0x800000, 0x1000000, 0x1800000 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; + +static void DrvYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvInit() +{ + INT32 nRet = 0, nLen; + + BurnSetRefreshRate(57.0); + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x400000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x040000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c0000, 6, 1); if (nRet != 0) return 1; + GfxDecode(8192, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x400000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x180000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x280000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x380000, 14, 1); if (nRet != 0) return 1; + GfxDecode(0x4800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 15, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvFgVideoRam , 0x080000, 0x080fff, SM_RAM); + SekMapMemory(DrvBgVideoRam , 0x082000, 0x0827ff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x140000, 0x1405ff, SM_RAM); + SekMapMemory(DrvSpriteRam , 0x180000, 0x180fff, SM_RAM); + SekMapMemory(Drv68KRam , 0x1c0000, 0x1c3fff, SM_RAM); + SekSetReadWordHandler(0, Ddragon368KReadWord); + SekSetWriteWordHandler(0, Ddragon368KWriteWord); + SekSetReadByteHandler(0, Ddragon368KReadByte); + SekSetWriteByteHandler(0, Ddragon368KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Ddragon3Z80Read); + ZetSetWriteHandler(Ddragon3Z80Write); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom ); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 1000000 / 132, 1); + MSM6295SetRoute(0, 1.50, BURN_SND_ROUTE_BOTH); + + DrawFunction = DrvDraw; + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 DrvpInit() +{ + INT32 nRet = 0, nLen; + + BurnSetRefreshRate(57.0); + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x400000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x020000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x040000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x060000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0a0000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c0000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0e0000, 10, 1); if (nRet != 0) return 1; + GfxDecode(8192, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x400000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x020000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x040000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x060000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x120000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x140000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x160000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x220000, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x240000, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x260000, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300000, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x320000, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x340000, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x360000, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 27, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x180000, 28, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x280000, 29, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x380000, 30, 1); if (nRet != 0) return 1; + GfxDecode(0x4800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 31, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x40000, 32, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvFgVideoRam , 0x080000, 0x080fff, SM_RAM); + SekMapMemory(DrvBgVideoRam , 0x082000, 0x0827ff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x140000, 0x1405ff, SM_RAM); + SekMapMemory(DrvSpriteRam , 0x180000, 0x180fff, SM_RAM); + SekMapMemory(Drv68KRam , 0x1c0000, 0x1c3fff, SM_RAM); + SekSetReadWordHandler(0, Ddragon368KReadWord); + SekSetWriteWordHandler(0, Ddragon368KWriteWord); + SekSetReadByteHandler(0, Ddragon368KReadByte); + SekSetWriteByteHandler(0, Ddragon368KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Ddragon3Z80Read); + ZetSetWriteHandler(Ddragon3Z80Write); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom ); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 1000000 / 132, 1); + MSM6295SetRoute(0, 1.50, BURN_SND_ROUTE_BOTH); + + DrawFunction = DrvDraw; + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 DrvbInit() +{ + INT32 nRet = 0, nLen; + + BurnSetRefreshRate(57.0); + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x400000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00001, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x40000, 2, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 3, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x040000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c0000, 7, 1); if (nRet != 0) return 1; + GfxDecode(8192, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x400000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x020000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x040000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x060000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x120000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x140000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x160000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x180000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x220000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x240000, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x260000, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x280000, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300000, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x320000, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x340000, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x360000, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x380000, 27, 1); if (nRet != 0) return 1; + GfxDecode(0x4800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 28, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x40000, 29, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvFgVideoRam , 0x080000, 0x080fff, SM_RAM); + SekMapMemory(DrvSpriteRam , 0x081000, 0x081fff, SM_RAM); + SekMapMemory(DrvBgVideoRam , 0x082000, 0x0827ff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x100000, 0x1005ff, SM_RAM); + SekMapMemory(Drv68KRam , 0x1c0000, 0x1c3fff, SM_RAM); + SekSetReadWordHandler(0, Ddragon3b68KReadWord); + SekSetWriteWordHandler(0, Ddragon3b68KWriteWord); + SekSetReadByteHandler(0, Ddragon3b68KReadByte); + SekSetWriteByteHandler(0, Ddragon3b68KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Ddragon3Z80Read); + ZetSetWriteHandler(Ddragon3Z80Write); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom ); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 1000000 / 132, 1); + MSM6295SetRoute(0, 1.50, BURN_SND_ROUTE_BOTH); + + DrawFunction = DrvDraw; + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 CtribeInit() +{ + INT32 nRet = 0, nLen; + + BurnSetRefreshRate(57.0); + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x400000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00001, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x40000, 2, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 3, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x040000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x0c0000, 7, 1); if (nRet != 0) return 1; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ctribeb2")) { + nRet = BurnLoadRom(DrvTempRom + 0x100000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x140000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x180000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x1c0000, 11, 1); if (nRet != 0) return 1; + } + GfxDecode(8192, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x400000); + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ctribeb2")) { + nRet = BurnLoadRom(DrvTempRom + 0x000000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x020000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x040000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x060000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x120000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x140000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x160000, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x180000, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200000, 22, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x220000, 23, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x240000, 24, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x260000, 25, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x280000, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300000, 27, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x320000, 28, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x340000, 29, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x360000, 30, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x380000, 31, 1); if (nRet != 0) return 1; + } else { + nRet = BurnLoadRom(DrvTempRom + 0x000000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x180000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x280000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x380000, 15, 1); if (nRet != 0) return 1; + } + GfxDecode(0x4800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); + + // Load Sample Roms + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ctribeb")) { + memset(DrvTempRom, 0, 0x400000); + nRet = BurnLoadRom(DrvTempRom, 16, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROM + 0x20000, DrvTempRom + 0x00000, 0x20000); + memcpy(MSM6295ROM + 0x00000, DrvTempRom + 0x20000, 0x20000); + } else { + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ctribeb2")) { + nRet = BurnLoadRom(MSM6295ROM + 0x00000, 32, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROM + 0x20000, 33, 1); if (nRet != 0) return 1; + } else { + nRet = BurnLoadRom(MSM6295ROM + 0x00000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROM + 0x20000, 17, 1); if (nRet != 0) return 1; + } + } + memcpy(DrvMSM6295ROMSrc, MSM6295ROM, 0x40000); + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvFgVideoRam , 0x080000, 0x080fff, SM_RAM); + SekMapMemory(DrvSpriteRam , 0x081000, 0x081fff, SM_RAM); + SekMapMemory(DrvBgVideoRam , 0x082000, 0x0827ff, SM_RAM); + SekMapMemory(Drv68KRam , 0x082800, 0x082fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x100000, 0x1005ff, SM_RAM); + SekMapMemory(Drv68KRam + 0x800 , 0x1c0000, 0x1c3fff, SM_RAM); + SekSetReadWordHandler(0, Ctribeb68KReadWord); + SekSetWriteWordHandler(0, Ctribeb68KWriteWord); + SekSetReadByteHandler(0, Ctribeb68KReadByte); + SekSetWriteByteHandler(0, Ctribeb68KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(CtribeZ80Read); + ZetSetWriteHandler(CtribeZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.20, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.20, BURN_SND_ROUTE_RIGHT); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 1000000 / 132, 1); + MSM6295SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); + + DrawFunction = CtribeDraw; + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + SekExit(); + ZetExit(); + + BurnYM2151Exit(); + MSM6295Exit(0); + + GenericTilesExit(); + + DrawFunction = NULL; + + DrvBgTileBase = 0; + DrvBgScrollX = 0; + DrvBgScrollY = 0; + DrvFgScrollX = 0; + DrvFgScrollY = 0; + DrvVReg = 0; + DrvSoundLatch = 0; + DrvOkiBank = 0; + DrvVBlank = 0; + + BurnFree(Mem); + + return 0; +} + +static inline UINT8 pal4bit(UINT8 bits) +{ + bits &= 0x0f; + return (bits << 4) | bits; +} + +static inline UINT8 pal5bit(UINT8 bits) +{ + bits &= 0x1f; + return (bits << 3) | (bits >> 2); +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal5bit(nColour >> 0); + g = pal5bit(nColour >> 5); + b = pal5bit(nColour >> 10); + + return BurnHighCol(r, g, b, 0); +} + +inline static UINT32 CtribeCalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(nColour >> 0); + g = pal4bit(nColour >> 4); + b = pal4bit(nColour >> 8); + + return BurnHighCol(r, g, b, 0); +} + +static void DrvCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x600; i++, ps++, pd++) { + *pd = CalcCol(BURN_ENDIAN_SWAP_INT16(*ps)); + } +} + +static void CtribeCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x600; i++, ps++, pd++) { + *pd = CtribeCalcCol(BURN_ENDIAN_SWAP_INT16(*ps)); + } +} + +static void DrvRenderBgLayer(INT32 Opaque) +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvBgVideoRam; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Attr = BURN_ENDIAN_SWAP_INT16(VideoRam[TileIndex]); + Code = (Attr & 0xfff) | ((DrvBgTileBase & 0x01) << 12); + Colour = ((Attr & 0xf000) >> 12); + + x = 16 * mx; + y = 16 * my; + + x -= DrvBgScrollX; + y -= DrvBgScrollY; + if (x < -16) x += 512; + if (y < -16) y += 512; + + y -= 8; + + if (Opaque) { + if (x > 16 && x < 304 && y > 16 && y < 224) { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); + } + } else { + if (x > 16 && x < 304 && y > 16 && y < 224) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512, DrvTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512, DrvTiles); + } + } + + TileIndex++; + } + } +} + +static void DrvRenderFgLayer(INT32 Opaque) +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0, Offset, xFlip; + + UINT16 *VideoRam = (UINT16*)DrvFgVideoRam; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Offset = TileIndex * 2; + Attr = BURN_ENDIAN_SWAP_INT16(VideoRam[Offset]); + Code = BURN_ENDIAN_SWAP_INT16(VideoRam[Offset + 1]) & 0x1fff; + Colour = Attr & 0x0f; + xFlip = Attr & 0x40; + + x = 16 * mx; + y = 16 * my; + + x -= DrvFgScrollX; + y -= DrvFgScrollY; + if (x < -16) x += 512; + if (y < -16) y += 512; + + y -= 8; + + if (Opaque) { + if (x > 16 && x < 304 && y > 16 && y < 224) { + if (xFlip) { + Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } else { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } + } else { + if (xFlip) { + Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 256, DrvTiles); + } + } + } else { + if (x > 16 && x < 304 && y > 16 && y < 224) { + if (xFlip) { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); + } else { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); + } + } else { + if (xFlip) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); + } + } + } + + TileIndex++; + } + } +} + +static void DrvRenderSprites() +{ + UINT16 *Source = (UINT16*)DrvSpriteRam; + UINT16 *Finish = Source + 0x800; + + while (Source < Finish) { + UINT16 Attr = BURN_ENDIAN_SWAP_INT16(Source[1]); + + if (Attr & 0x01) { + INT32 i; + INT32 Bank = BURN_ENDIAN_SWAP_INT16(Source[3]) & 0xff; + INT32 Code = (BURN_ENDIAN_SWAP_INT16(Source[2]) & 0xff) + (Bank * 256); + INT32 Colour = BURN_ENDIAN_SWAP_INT16(Source[4]) & 0xf; + INT32 xFlip = Attr & 0x10; + INT32 yFlip = Attr & 0x08; + INT32 sx = BURN_ENDIAN_SWAP_INT16(Source[5]) & 0xff; + INT32 sy = BURN_ENDIAN_SWAP_INT16(Source[0]) & 0xff; + INT32 Height = (Attr >> 5) & 0x07; + + if (Attr & 0x04) sx |= 0x100; + if (Attr & 0x02) { + sy = 239 + (0x100 - sy); + } else { + sy = 240 - sy; + } + if (sx > 0x17f) sx = 0 - (0x200 - sx); + + sy -= 8; + + for (i = 0; i <= Height; i++) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code + i, sx, sy - (i * 16), Colour, 4, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code + i, sx, sy - (i * 16), Colour, 4, 0, 0, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code + i, sx, sy - (i * 16), Colour, 4, 0, 0, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code + i, sx, sy - (i * 16), Colour, 4, 0, 0, DrvSprites); + } + } + } + } + + Source += 8; + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + + if ((DrvVReg & 0x60) == 0x40) { + DrvRenderBgLayer(1); + DrvRenderFgLayer(0); + DrvRenderSprites(); + } else if ((DrvVReg & 0x60) == 0x60) { + DrvRenderFgLayer(1); + DrvRenderBgLayer(0); + DrvRenderSprites(); + } else { + DrvRenderBgLayer(1); + DrvRenderSprites(); + DrvRenderFgLayer(0); + } + + BurnTransferCopy(DrvPalette); +} + +static void CtribeDraw() +{ + BurnTransferClear(); + CtribeCalcPalette(); + + if (DrvVReg & 0x08) { + DrvRenderFgLayer(1); + DrvRenderSprites(); + DrvRenderBgLayer(0); + } else { + DrvRenderBgLayer(1); + DrvRenderFgLayer(0); + DrvRenderSprites(); + } + + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = 12000000 / 60; + nCyclesTotal[1] = 3579545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + DrvVBlank = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 5) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + if (i == 5) DrvVBlank = 1; + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + SekOpen(0); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) DrawFunction(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029674; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); // Scan Z80 + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(DrvDip); + SCAN_VAR(DrvInput); + SCAN_VAR(DrvBgTileBase); + SCAN_VAR(DrvBgScrollX); + SCAN_VAR(DrvBgScrollY); + SCAN_VAR(DrvFgScrollX); + SCAN_VAR(DrvFgScrollY); + SCAN_VAR(DrvVReg); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(DrvOkiBank); + SCAN_VAR(DrvVBlank); + } + + if (nAction & ACB_WRITE) { + memcpy(MSM6295ROM + 0x00000, DrvMSM6295ROMSrc + (0x40000 * DrvOkiBank), 0x40000); + } + + return 0; +} + +struct BurnDriver BurnDrvDdragon3 = { + "ddragon3", NULL, NULL, NULL, "1990", + "Double Dragon 3 - The Rosetta Stone (US)\0", NULL, "Technos", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdrago3j = { + "ddragon3j", "ddragon3", NULL, NULL, "1990", + "Double Dragon 3 - The Rosetta Stone (Japan)\0", NULL, "Technos", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdrago3p = { + "ddragon3p", "ddragon3", NULL, NULL, "1990", + "Double Dragon 3 - The Rosetta Stone (prototype)\0", NULL, "Technos", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_PROTOTYPE, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvpRomInfo, DrvpRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvpInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDdrago3b = { + "ddragon3b", "ddragon3", NULL, NULL, "1990", + "Double Dragon 3 - The Rosetta Stone (bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvbDIPInfo, + DrvbInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvCtribe = { + "ctribe", NULL, NULL, NULL, "1990", + "The Combatribes (US)\0", NULL, "Technos", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, CtribeRomInfo, CtribeRomName, NULL, NULL, DrvInputInfo, CtribeDIPInfo, + CtribeInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvCtribe1 = { + "ctribe1", "ctribe", NULL, NULL, "1990", + "The Combatribes (US) - Set 1?\0", NULL, "Technos", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, Ctribe1RomInfo, Ctribe1RomName, NULL, NULL, DrvInputInfo, CtribeDIPInfo, + CtribeInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvCtribej = { + "ctribej", "ctribe", NULL, NULL, "1990", + "The Combatribes (Japan)\0", NULL, "Technos", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, CtribejRomInfo, CtribejRomName, NULL, NULL, DrvInputInfo, CtribeDIPInfo, + CtribeInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvCtribeb = { + "ctribeb", "ctribe", NULL, NULL, "1990", + "The Combatribes (bootleg set 1)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, CtribebRomInfo, CtribebRomName, NULL, NULL, DrvInputInfo, CtribeDIPInfo, + CtribeInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvCtribeb2 = { + "ctribeb2", "ctribe", NULL, NULL, "1990", + "The Combatribes (bootleg set 2)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 3, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, Ctribeb2RomInfo, Ctribeb2RomName, NULL, NULL, DrvInputInfo, CtribeDIPInfo, + CtribeInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x600, 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_deniam.cpp b/src/burn/drv/pst90s/d_deniam.cpp index 3ae2c4d51..4df13756c 100644 --- a/src/burn/drv/pst90s/d_deniam.cpp +++ b/src/burn/drv/pst90s/d_deniam.cpp @@ -1,1000 +1,999 @@ -// FB Alpha Deniam-16 Hardware driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSndROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvTxtRAM; -static UINT32 *DrvPalette; -static INT16 *DrvTxtTable; -static INT16 *DrvLayerTable; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvDips[1]; -static UINT8 DrvReset; -static UINT8 DrvInputs[3]; - -static INT32 nCyclesDone[2]; - -static UINT8 *soundlatch; -static UINT8 *coin_control; -static UINT8 *okibank; - -static INT32 bg_scrollx_offs; -static INT32 bg_scrolly_offs; -static INT32 fg_scrollx_offs; -static INT32 fg_scrolly_offs; -static INT32 bg_scrollx_reg; -static INT32 bg_scrolly_reg; -static INT32 bg_page_reg; -static INT32 fg_scrollx_reg; -static INT32 fg_scrolly_reg; -static INT32 fg_page_reg; - -static INT32 nGame = 0; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 4, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 5, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 4, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 7, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 6, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 5, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 5, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 4, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 7, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 6, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 2, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 3, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo KarianxDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x14, 0x01, 0x07, 0x02, "3 Coins 1 Credits " }, - {0x14, 0x01, 0x07, 0x01, "2 Coins 1 Credits " }, - {0x14, 0x01, 0x07, 0x04, "3 Coins 2 Credits " }, - {0x14, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, - {0x14, 0x01, 0x07, 0x06, "2 Coins 3 Credits " }, - {0x14, 0x01, 0x07, 0x03, "1 Coin 2 Credits " }, - {0x14, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, - {0x14, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x18, 0x08, "Very Easy" }, - {0x14, 0x01, 0x18, 0x10, "Easy" }, - {0x14, 0x01, 0x18, 0x18, "Normal" }, - {0x14, 0x01, 0x18, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2, "Demo Music" }, - {0x14, 0x01, 0x20, 0x00, "Off" }, - {0x14, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 1, "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Karianx) - -static struct BurnDIPInfo Logicpr2DIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x14, 0x01, 0x07, 0x02, "3 Coins 1 Credits " }, - {0x14, 0x01, 0x07, 0x01, "2 Coins 1 Credits " }, - {0x14, 0x01, 0x07, 0x04, "3 Coins 2 Credits " }, - {0x14, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, - {0x14, 0x01, 0x07, 0x06, "2 Coins 3 Credits " }, - {0x14, 0x01, 0x07, 0x03, "1 Coin 2 Credits " }, - {0x14, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, - {0x14, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Play Time" }, - {0x14, 0x01, 0x18, 0x08, "Slow" }, - {0x14, 0x01, 0x18, 0x18, "Normal" }, - {0x14, 0x01, 0x18, 0x10, "Fast" }, - {0x14, 0x01, 0x18, 0x00, "Fastest" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x60, 0x20, "Easy" }, - {0x14, 0x01, 0x60, 0x60, "Normal" }, - {0x14, 0x01, 0x60, 0x40, "Hard" }, - {0x14, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x80, 0x00, "Off" }, - {0x14, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Logicpr2) - -static void deniam16_set_okibank(INT32 bank) -{ - *okibank = bank; - - MSM6295ROM = DrvSndROM + (*okibank ? 0x40000 : 0x00000); -} - -UINT8 __fastcall deniam16_read_byte(UINT32 address) -{ - switch (address) - { - case 0xc40001: - return MSM6295ReadStatus(0); // logicpr2 - - case 0xc40003: - return *coin_control; - - case 0xc44001: - return DrvInputs[0] & 0xff; - - case 0xc44003: - return DrvInputs[1] & 0xff; - - case 0xc44005: - return DrvInputs[2] & 0xff; - - case 0xc4400b: - return DrvDips[0]; - } - - return 0; -} - -void __fastcall deniam16_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0xc40000: - if (nGame != 2) { - *soundlatch = data; - ZetNmi(); - } - return; - - case 0xc40001: - if (nGame == 2) { - MSM6295Command(0, data); - } - return; - - case 0xc40003: - *coin_control = data; - return; - - case 0xc40007: - deniam16_set_okibank(data & 0x01); // logicpr2 - return; - - case 0xc40008: - BurnYM3812Write(0, data); // logicpr2 - return; - - case 0xc4000a: - BurnYM3812Write(1, data); // logicpr2 - return; - } -} - -void __fastcall deniam16_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x02: - BurnYM3812Write(0, data); - return; - - case 0x03: - BurnYM3812Write(1, data); - return; - - case 0x05: - MSM6295Command(0, data); - return; - - case 0x07: - deniam16_set_okibank(data & 0x40); - return; - } -} - -UINT8 __fastcall deniam16_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x01: - return *soundlatch; - - case 0x05: - return MSM6295ReadStatus(0); - } - - return 0; -} - -inline static INT32 deniam16ZetSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(ZetTotalCycles() * nSoundRate / 6250000); -} - -inline static INT32 deniam16SekSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(SekTotalCycles() * nSoundRate / 12500000); -} - -void deniam16YM3812IrqHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM3812Reset(); - - deniam16_set_okibank(0); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x100000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x400000; - DrvGfxROM1 = Next; Next += 0x400000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x100000; - - DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); - - DrvTxtTable = (INT16*)Next; Next += 0x0800 * sizeof(INT16); - DrvLayerTable = (INT16*)Next; Next += 0x2000 * sizeof(INT16); - - AllRam = Next; - - DrvSprRAM = Next; Next += 0x000800; - DrvTxtRAM = Next; Next += 0x001000; - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x001000; - DrvVidRAM = Next; Next += 0x010000; - - DrvZ80RAM = Next; Next += 0x000800; - - coin_control = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - okibank = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void create_offset_tables() -{ - for (INT32 offs = 0; offs < 128 * 64; offs++) - { - INT32 sx = (offs & 0x7f); - INT32 sy = (offs >> 7); - - DrvLayerTable[offs] = (sx & 0x3f) + ((sy & 0x1f) << 6) + ((sx & 0x40) << 5) + ((sy & 0x20) << 7); - } - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = (offs & 0x3f); - INT32 sy = (offs >> 6); - - DrvTxtTable[offs] = (sx & 0x3f) + ((sy & 0x1f) << 6) + ((sx & 0x40) << 5) + ((sy & 0x20) << 7); - } -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[3] = { (0x80000 * 8) * 2, (0x80000 * 8) * 1, 0 }; - INT32 XOffs[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; - INT32 YOffs[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x180000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x180000); - - GfxDecode(0x10000, 3, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - switch (nGame) - { - case 0: - { - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 8, 1)) return 1; - } - break; - - case 1: - { - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100001, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200001, 11, 2)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 12, 1)) return 1; - } - break; - - case 2: - { - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; - BurnByteswap(DrvGfxROM1, 0x400000); - - if (BurnLoadRom(DrvSndROM + 0x000000, 6, 1)) return 1; - } - break; - } - - DrvGfxDecode(); - create_offset_tables(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(DrvVidRAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(DrvTxtRAM, 0x410000, 0x410fff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x440000, 0x4407ff, SM_WRITE); - SekMapMemory(DrvPalRAM, 0x840000, 0x840fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xff0000, 0xffffff, SM_RAM); - SekSetWriteByteHandler(0, deniam16_write_byte); - SekSetReadByteHandler(0, deniam16_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xf7ff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xf7ff, 2, DrvZ80ROM); - ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM); - ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM); - ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); - ZetSetOutHandler(deniam16_sound_out); - ZetSetInHandler(deniam16_sound_in); - ZetMemEnd(); - ZetClose(); - - if (nGame != 2) { - BurnYM3812Init(3125000, &deniam16YM3812IrqHandler, deniam16ZetSynchroniseStream, 0); - BurnTimerAttachZetYM3812(6250000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); - } else { - BurnYM3812Init(3125000, NULL, deniam16SekSynchroniseStream, 0); - BurnTimerAttachSekYM3812(12500000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); - } - - MSM6295Init(0, 1056000 / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM3812Exit(); - MSM6295Exit(0); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - nGame = 0; - - return 0; -} - -static void palette_write(INT32 offset) -{ - UINT8 r,g,b; - UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset))); - - r = ((data << 1) & 0x1e) | ((data >> 12) & 1); - g = ((data >> 3) & 0x1e) | ((data >> 13) & 1); - b = ((data >> 7) & 0x1e) | ((data >> 14) & 1); - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); -} - -static void draw_sprites(INT32 priority) -{ - UINT16 *source = (UINT16*)DrvSprRAM; - - for (INT32 offs = 0;offs < 0x800/2;offs += 8) - { - if (priority != ((BURN_ENDIAN_SWAP_INT16(source[offs+4])&0xc0) >> 6)) continue; - - INT32 sx = (BURN_ENDIAN_SWAP_INT16(source[offs+1]) & 0x01ff) + 16*8 - 1; - if (sx >= 512) sx -= 512; - sx -= 192; - INT32 starty = BURN_ENDIAN_SWAP_INT16(source[offs+0]) & 0xff; - if (starty >= nScreenHeight) continue; - INT32 endy = BURN_ENDIAN_SWAP_INT16(source[offs+0]) >> 8; - if (endy >= nScreenHeight) endy = nScreenHeight-1; - - INT32 width = BURN_ENDIAN_SWAP_INT16(source[offs+2]) & 0x007f; - INT32 flipx = BURN_ENDIAN_SWAP_INT16(source[offs+2]) & 0x0100; - if (flipx) sx++; - - INT32 color = (0x40 + (BURN_ENDIAN_SWAP_INT16(source[offs+4]) & 0x3f)) << 4; - - INT32 start = BURN_ENDIAN_SWAP_INT16(source[offs+3]) + ((BURN_ENDIAN_SWAP_INT16(source[offs+4]) & 0x1f00) << 8); - UINT8 *rom = DrvGfxROM1 + start * 2; - - for (INT32 y = starty+1;y <= endy;y++) - { - INT32 drawing = 0; - INT32 i=0; - - rom += 2 * width; - INT32 x = 0; - - UINT16 *dest = pTransDraw + (y * nScreenWidth); - - while (i < 512) - { - if (flipx) - { - if ((rom[i] & 0x0f) == 0x0f) - { - if (!drawing) drawing = 1; - else break; - } - else - { - if (rom[i] & 0x0f) - { - if (sx+x >= 0 && sx+x < nScreenWidth) { - dest[(sx+x)] = color | (rom[i] & 0x0f); - } - } - x++; - } - - if ((rom[i] & 0xf0) == 0xf0) - { - if (!drawing) drawing = 1; - else break; - } - else - { - if (rom[i] & 0xf0) - { - if (sx+x >= 0 && sx+x < nScreenWidth) { - dest[(sx+x)] = color | (rom[i]>>4); - } - } - x++; - } - - i--; - } - else - { - if ((rom[i] & 0xf0) == 0xf0) - { - if (!drawing) drawing = 1; - else break; - } - else - { - if (rom[i] & 0xf0) - { - if (sx+x >= 0 && sx+x < nScreenWidth) { - dest[(sx+x)] = color | (rom[i]>>4); - } - } - x++; - } - - if ((rom[i] & 0x0f) == 0x0f) - { - if (!drawing) drawing = 1; - else break; - } - else - { - if (rom[i] & 0x0f) - { - if (sx+x >= 0 && sx+x < nScreenWidth) { - dest[(sx+x)] = color | (rom[i] & 0x0f); - } - } - x++; - } - - i++; - } - } - } - } -} - -static void draw_layer(INT32 *in_page, INT32 scrollx, INT32 scrolly, INT32 transp) -{ - UINT16 *vram = (UINT16*)DrvVidRAM; - - for (INT32 offs = 0; offs < 128 * 64; offs++) - { - INT32 sx = ((offs & 0x7f) << 3) - scrollx; - INT32 sy = ((offs >> 7) << 3) - scrolly; - - INT32 ofst = DrvLayerTable[offs]; - - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[in_page[ofst>>11] * 0x0800 + (ofst & 0x7ff)]); - INT32 code = attr; - if (transp && !code) continue; - INT32 color = (attr & 0x1fc0) >> 6; - - if (sx >= nScreenWidth || sy >= nScreenHeight || sy < -7 || sx < -7) continue; - - if (sx >= 0 && sx < (nScreenWidth - 7) && sy >= 0 && sy < (nScreenHeight - 7)) { - if (transp) { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM0); - } - } else { - if (transp) { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM0); - } - } - } -} - -static void draw_text() -{ - UINT16 *vram = (UINT16*)DrvTxtRAM; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = ((offs & 0x3f) << 3) - 192; - INT32 sy = (offs >> 6) << 3; - - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[DrvTxtTable[offs]]); - INT32 code = attr & 0xf1ff; - INT32 color = (attr & 0x0e00) >> 9; - - if (sx < 0 || sy >= nScreenHeight || sx >= nScreenWidth || !code) continue; - - if (sx >= 0 && sx < (nScreenWidth - 7) && sy >= 0 && sy < (nScreenHeight - 7)) { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x1000; i+=2) { - palette_write(i); - } - } - - if (~*coin_control & 0x20) return 0; - - { - INT32 pages[4]; - UINT16 *txtram = (UINT16*)DrvTxtRAM; - - // draw_sprites(0); - - INT32 bg_scrollx = (BURN_ENDIAN_SWAP_INT16(txtram[bg_scrollx_reg]) - bg_scrollx_offs) & 0x1ff; - INT32 bg_scrolly = ((BURN_ENDIAN_SWAP_INT16(txtram[bg_scrolly_reg]) & 0xff) - bg_scrolly_offs) & 0xff; - INT32 page = BURN_ENDIAN_SWAP_INT16(txtram[bg_page_reg]); - - pages[3] = (page >> 12) & 0x0f; - pages[2] = (page >> 8) & 0x0f; - pages[1] = (page >> 4) & 0x0f; - pages[0] = (page >> 0) & 0x0f; - - draw_layer(pages, bg_scrollx+192, bg_scrolly, 0); - - draw_sprites(1); - - INT32 fg_scrollx = (BURN_ENDIAN_SWAP_INT16(txtram[fg_scrollx_reg]) - fg_scrollx_offs) & 0x1ff; - INT32 fg_scrolly = ((BURN_ENDIAN_SWAP_INT16(txtram[fg_scrolly_reg]) & 0xff) - fg_scrolly_offs) & 0xff; - page = BURN_ENDIAN_SWAP_INT16(txtram[fg_page_reg]); - - pages[3] = (page >> 12) & 0x0f; - pages[2] = (page >> 8) & 0x0f; - pages[1] = (page >> 4) & 0x0f; - pages[0] = (page >> 0) & 0x0f; - - draw_layer(pages, fg_scrollx+192, fg_scrolly, 1); - - draw_sprites(2); - draw_text(); - draw_sprites(3); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) - { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - SekNewFrame(); - ZetNewFrame(); - - INT32 nInterleave = 10; - INT32 nCyclesSegment; - INT32 nCyclesTotal[2] = { 12500000 / 60, 6250000 / 60 }; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesSegment = nCyclesTotal[0] / nInterleave; - - nCyclesDone[0] = SekRun(nCyclesSegment); - - if (nGame == 2) continue; - - nCyclesSegment = nCyclesTotal[1] / nInterleave; - - BurnTimerUpdateYM3812(i * nCyclesSegment); - } - - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - if (nGame != 2) BurnTimerEndFrameYM3812(nCyclesTotal[1]); - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029698; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - SCAN_VAR(nCyclesDone[0]); - SCAN_VAR(nCyclesDone[1]); - - BurnYM3812Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - - deniam16_set_okibank(*okibank); - } - - return 0; -} - - -// Logic Pro (Japan) - -static struct BurnRomInfo logicproRomDesc[] = { - { "logicpro.r4", 0x40000, 0xc506d484, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "logicpro.r3", 0x40000, 0xd5a4cf62, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "logicpro.r2", 0x10000, 0x000d624b, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "logicpro.r5", 0x80000, 0xdedf18c9, 3 | BRF_GRA }, // 3 Graphics Tiles - { "logicpro.r6", 0x80000, 0x3ecbd1c2, 3 | BRF_GRA }, // 4 - { "logicpro.r7", 0x80000, 0x47135521, 3 | BRF_GRA }, // 5 - - { "logicpro.r9", 0x80000, 0xa98bc1d2, 4 | BRF_GRA }, // 6 Sprites - { "logicpro.r8", 0x80000, 0x1de46298, 4 | BRF_GRA }, // 7 - - { "logicpro.r1", 0x80000, 0xa1fec4d4, 5 | BRF_SND }, // 8 Samples -}; - -STD_ROM_PICK(logicpro) -STD_ROM_FN(logicpro) - -static INT32 logicproInit() -{ - bg_scrollx_reg = 0x00a4/2; - bg_scrolly_reg = 0x00a8/2; - bg_page_reg = 0x00ac/2; - fg_scrollx_reg = 0x00a2/2; - fg_scrolly_reg = 0x00a6/2; - fg_page_reg = 0x00aa/2; - - bg_scrollx_offs = 0x00d; - bg_scrolly_offs = 0x000; - fg_scrollx_offs = 0x009; - fg_scrolly_offs = 0x000; - - return DrvInit(); -} - -struct BurnDriver BurnDrvLogicpro = { - "logicpro", NULL, NULL, NULL, "1996", - "Logic Pro (Japan)\0", NULL, "Deniam", "Deniam-16b Hardware", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, logicproRomInfo, logicproRomName, NULL, NULL, DrvInputInfo, Logicpr2DIPInfo, - logicproInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 224, 4, 3 -}; - - -// Croquis (Germany) - -static struct BurnRomInfo croquisRomDesc[] = { - { "r4.bin", 0x40000, 0x03c9055e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "r3.bin", 0x40000, 0xa98ae4f6, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "logicpro.r2", 0x10000, 0x000d624b, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "logicpro.r5", 0x80000, 0xdedf18c9, 3 | BRF_GRA }, // 3 Graphics Tiles - { "logicpro.r6", 0x80000, 0x3ecbd1c2, 3 | BRF_GRA }, // 4 - { "logicpro.r7", 0x80000, 0x47135521, 3 | BRF_GRA }, // 5 - - { "logicpro.r9", 0x80000, 0xa98bc1d2, 4 | BRF_GRA }, // 6 Sprites - { "logicpro.r8", 0x80000, 0x1de46298, 4 | BRF_GRA }, // 7 - - { "logicpro.r1", 0x80000, 0xa1fec4d4, 5 | BRF_SND }, // 8 Samples -}; - -STD_ROM_PICK(croquis) -STD_ROM_FN(croquis) - -struct BurnDriver BurnDrvCroquis = { - "croquis", "logicpro", NULL, NULL, "1996", - "Croquis (Germany)\0", NULL, "Deniam", "Deniam-16b Hardware", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, croquisRomInfo, croquisRomName, NULL, NULL, DrvInputInfo, Logicpr2DIPInfo, - logicproInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 224, 4, 3 -}; - - -// Karian Cross (Rev. 1.0) - -static struct BurnRomInfo karianxRomDesc[] = { - { "even", 0x80000, 0xfd0ce238, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "odd", 0x80000, 0xbe173cdc, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "snd", 0x10000, 0xfedd3375, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "bkg1", 0x80000, 0x5cb8558a, 3 | BRF_GRA }, // 3 Graphics Tiles - { "bkg2", 0x80000, 0x95ff297c, 3 | BRF_GRA }, // 4 - { "bkg3", 0x80000, 0x6c81f1b2, 3 | BRF_GRA }, // 5 - - { "obj4", 0x80000, 0x5f8d75a9, 4 | BRF_GRA }, // 6 Sprites - { "obj1", 0x80000, 0x967ee97d, 4 | BRF_GRA }, // 7 - { "obj5", 0x80000, 0xe9fc22f9, 4 | BRF_GRA }, // 8 - { "obj2", 0x80000, 0xd39eb04e, 4 | BRF_GRA }, // 9 - { "obj6", 0x80000, 0xc1ec35a5, 4 | BRF_GRA }, // 10 - { "obj3", 0x80000, 0x6ac1ac87, 4 | BRF_GRA }, // 11 - - { "voi", 0x80000, 0xc6506a80, 5 | BRF_SND }, // 12 Samples -}; - -STD_ROM_PICK(karianx) -STD_ROM_FN(karianx) - -static INT32 karianxInit() -{ - nGame = 1; - - bg_scrollx_reg = 0x00a4/2; - bg_scrolly_reg = 0x00a8/2; - bg_page_reg = 0x00ac/2; - fg_scrollx_reg = 0x00a2/2; - fg_scrolly_reg = 0x00a6/2; - fg_page_reg = 0x00aa/2; - - bg_scrollx_offs = 0x10d; - bg_scrolly_offs = 0x080; - fg_scrollx_offs = 0x109; - fg_scrolly_offs = 0x080; - - return DrvInit(); -} - -struct BurnDriver BurnDrvKarianx = { - "karianx", NULL, NULL, NULL, "1996", - "Karian Cross (Rev. 1.0)\0", NULL, "Deniam", "Deniam-16b Hardware", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, karianxRomInfo, karianxRomName, NULL, NULL, DrvInputInfo, KarianxDIPInfo, - karianxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 224, 4, 3 -}; - - -// Logic Pro 2 (Japan) - -static struct BurnRomInfo logicpr2RomDesc[] = { - { "lp2-2", 0x080000, 0xcc1880bf, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "lp2-1", 0x080000, 0x46d5e954, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "log2-b01", 0x080000, 0xfe789e07, 3 | BRF_GRA }, // 2 Graphics Tiles - { "log2-b02", 0x080000, 0x1e0c51cd, 3 | BRF_GRA }, // 3 - { "log2-b03", 0x080000, 0x916f2928, 3 | BRF_GRA }, // 4 - - { "obj", 0x400000, 0xf221f305, 4 | BRF_GRA }, // 5 Sprites - - { "log2-s01", 0x100000, 0x2875c435, 5 | BRF_SND }, // 6 Samples -}; - -STD_ROM_PICK(logicpr2) -STD_ROM_FN(logicpr2) - -static INT32 logicpr2Init() -{ - nGame = 2; - - return logicproInit(); -} - -struct BurnDriver BurnDrvLogicpr2 = { - "logicpr2", NULL, NULL, NULL, "1997", - "Logic Pro 2 (Japan)\0", NULL, "Deniam", "Deniam-16c Hardware", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, logicpr2RomInfo, logicpr2RomName, NULL, NULL, DrvInputInfo, Logicpr2DIPInfo, - logicpr2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 224, 4, 3 -}; +// FB Alpha Deniam-16 Hardware driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSndROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvTxtRAM; +static UINT32 *DrvPalette; +static INT16 *DrvTxtTable; +static INT16 *DrvLayerTable; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvDips[1]; +static UINT8 DrvReset; +static UINT8 DrvInputs[3]; + +static INT32 nCyclesDone[2]; + +static UINT8 *soundlatch; +static UINT8 *coin_control; +static UINT8 *okibank; + +static INT32 bg_scrollx_offs; +static INT32 bg_scrolly_offs; +static INT32 fg_scrollx_offs; +static INT32 fg_scrolly_offs; +static INT32 bg_scrollx_reg; +static INT32 bg_scrolly_reg; +static INT32 bg_page_reg; +static INT32 fg_scrollx_reg; +static INT32 fg_scrolly_reg; +static INT32 fg_page_reg; + +static INT32 nGame = 0; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 4, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 5, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 4, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 7, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 6, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 5, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 5, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 4, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 7, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 6, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 2, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 3, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo KarianxDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x14, 0x01, 0x07, 0x02, "3 Coins 1 Credits " }, + {0x14, 0x01, 0x07, 0x01, "2 Coins 1 Credits " }, + {0x14, 0x01, 0x07, 0x04, "3 Coins 2 Credits " }, + {0x14, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, + {0x14, 0x01, 0x07, 0x06, "2 Coins 3 Credits " }, + {0x14, 0x01, 0x07, 0x03, "1 Coin 2 Credits " }, + {0x14, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, + {0x14, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x18, 0x08, "Very Easy" }, + {0x14, 0x01, 0x18, 0x10, "Easy" }, + {0x14, 0x01, 0x18, 0x18, "Normal" }, + {0x14, 0x01, 0x18, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2, "Demo Music" }, + {0x14, 0x01, 0x20, 0x00, "Off" }, + {0x14, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 1, "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Karianx) + +static struct BurnDIPInfo Logicpr2DIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x14, 0x01, 0x07, 0x02, "3 Coins 1 Credits " }, + {0x14, 0x01, 0x07, 0x01, "2 Coins 1 Credits " }, + {0x14, 0x01, 0x07, 0x04, "3 Coins 2 Credits " }, + {0x14, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, + {0x14, 0x01, 0x07, 0x06, "2 Coins 3 Credits " }, + {0x14, 0x01, 0x07, 0x03, "1 Coin 2 Credits " }, + {0x14, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, + {0x14, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Play Time" }, + {0x14, 0x01, 0x18, 0x08, "Slow" }, + {0x14, 0x01, 0x18, 0x18, "Normal" }, + {0x14, 0x01, 0x18, 0x10, "Fast" }, + {0x14, 0x01, 0x18, 0x00, "Fastest" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x60, 0x20, "Easy" }, + {0x14, 0x01, 0x60, 0x60, "Normal" }, + {0x14, 0x01, 0x60, 0x40, "Hard" }, + {0x14, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x80, 0x00, "Off" }, + {0x14, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Logicpr2) + +static void deniam16_set_okibank(INT32 bank) +{ + *okibank = bank; + + MSM6295ROM = DrvSndROM + (*okibank ? 0x40000 : 0x00000); +} + +UINT8 __fastcall deniam16_read_byte(UINT32 address) +{ + switch (address) + { + case 0xc40001: + return MSM6295ReadStatus(0); // logicpr2 + + case 0xc40003: + return *coin_control; + + case 0xc44001: + return DrvInputs[0] & 0xff; + + case 0xc44003: + return DrvInputs[1] & 0xff; + + case 0xc44005: + return DrvInputs[2] & 0xff; + + case 0xc4400b: + return DrvDips[0]; + } + + return 0; +} + +void __fastcall deniam16_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0xc40000: + if (nGame != 2) { + *soundlatch = data; + ZetNmi(); + } + return; + + case 0xc40001: + if (nGame == 2) { + MSM6295Command(0, data); + } + return; + + case 0xc40003: + *coin_control = data; + return; + + case 0xc40007: + deniam16_set_okibank(data & 0x01); // logicpr2 + return; + + case 0xc40008: + BurnYM3812Write(0, data); // logicpr2 + return; + + case 0xc4000a: + BurnYM3812Write(1, data); // logicpr2 + return; + } +} + +void __fastcall deniam16_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x02: + BurnYM3812Write(0, data); + return; + + case 0x03: + BurnYM3812Write(1, data); + return; + + case 0x05: + MSM6295Command(0, data); + return; + + case 0x07: + deniam16_set_okibank(data & 0x40); + return; + } +} + +UINT8 __fastcall deniam16_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x01: + return *soundlatch; + + case 0x05: + return MSM6295ReadStatus(0); + } + + return 0; +} + +inline static INT32 deniam16ZetSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(ZetTotalCycles() * nSoundRate / 6250000); +} + +inline static INT32 deniam16SekSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(SekTotalCycles() * nSoundRate / 12500000); +} + +void deniam16YM3812IrqHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM3812Reset(); + + deniam16_set_okibank(0); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x100000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x400000; + DrvGfxROM1 = Next; Next += 0x400000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x100000; + + DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); + + DrvTxtTable = (INT16*)Next; Next += 0x0800 * sizeof(INT16); + DrvLayerTable = (INT16*)Next; Next += 0x2000 * sizeof(INT16); + + AllRam = Next; + + DrvSprRAM = Next; Next += 0x000800; + DrvTxtRAM = Next; Next += 0x001000; + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x001000; + DrvVidRAM = Next; Next += 0x010000; + + DrvZ80RAM = Next; Next += 0x000800; + + coin_control = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + okibank = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void create_offset_tables() +{ + for (INT32 offs = 0; offs < 128 * 64; offs++) + { + INT32 sx = (offs & 0x7f); + INT32 sy = (offs >> 7); + + DrvLayerTable[offs] = (sx & 0x3f) + ((sy & 0x1f) << 6) + ((sx & 0x40) << 5) + ((sy & 0x20) << 7); + } + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = (offs & 0x3f); + INT32 sy = (offs >> 6); + + DrvTxtTable[offs] = (sx & 0x3f) + ((sy & 0x1f) << 6) + ((sx & 0x40) << 5) + ((sy & 0x20) << 7); + } +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[3] = { (0x80000 * 8) * 2, (0x80000 * 8) * 1, 0 }; + INT32 XOffs[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + INT32 YOffs[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x180000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x180000); + + GfxDecode(0x10000, 3, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + switch (nGame) + { + case 0: + { + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 8, 1)) return 1; + } + break; + + case 1: + { + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100001, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200001, 11, 2)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 12, 1)) return 1; + } + break; + + case 2: + { + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1; + BurnByteswap(DrvGfxROM1, 0x400000); + + if (BurnLoadRom(DrvSndROM + 0x000000, 6, 1)) return 1; + } + break; + } + + DrvGfxDecode(); + create_offset_tables(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(DrvVidRAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(DrvTxtRAM, 0x410000, 0x410fff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x440000, 0x4407ff, SM_WRITE); + SekMapMemory(DrvPalRAM, 0x840000, 0x840fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xff0000, 0xffffff, SM_RAM); + SekSetWriteByteHandler(0, deniam16_write_byte); + SekSetReadByteHandler(0, deniam16_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xf7ff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xf7ff, 2, DrvZ80ROM); + ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM); + ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM); + ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); + ZetSetOutHandler(deniam16_sound_out); + ZetSetInHandler(deniam16_sound_in); + ZetClose(); + + if (nGame != 2) { + BurnYM3812Init(3125000, &deniam16YM3812IrqHandler, deniam16ZetSynchroniseStream, 0); + BurnTimerAttachZetYM3812(6250000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); + } else { + BurnYM3812Init(3125000, NULL, deniam16SekSynchroniseStream, 0); + BurnTimerAttachSekYM3812(12500000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); + } + + MSM6295Init(0, 1056000 / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM3812Exit(); + MSM6295Exit(0); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + nGame = 0; + + return 0; +} + +static void palette_write(INT32 offset) +{ + UINT8 r,g,b; + UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset))); + + r = ((data << 1) & 0x1e) | ((data >> 12) & 1); + g = ((data >> 3) & 0x1e) | ((data >> 13) & 1); + b = ((data >> 7) & 0x1e) | ((data >> 14) & 1); + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); +} + +static void draw_sprites(INT32 priority) +{ + UINT16 *source = (UINT16*)DrvSprRAM; + + for (INT32 offs = 0;offs < 0x800/2;offs += 8) + { + if (priority != ((BURN_ENDIAN_SWAP_INT16(source[offs+4])&0xc0) >> 6)) continue; + + INT32 sx = (BURN_ENDIAN_SWAP_INT16(source[offs+1]) & 0x01ff) + 16*8 - 1; + if (sx >= 512) sx -= 512; + sx -= 192; + INT32 starty = BURN_ENDIAN_SWAP_INT16(source[offs+0]) & 0xff; + if (starty >= nScreenHeight) continue; + INT32 endy = BURN_ENDIAN_SWAP_INT16(source[offs+0]) >> 8; + if (endy >= nScreenHeight) endy = nScreenHeight-1; + + INT32 width = BURN_ENDIAN_SWAP_INT16(source[offs+2]) & 0x007f; + INT32 flipx = BURN_ENDIAN_SWAP_INT16(source[offs+2]) & 0x0100; + if (flipx) sx++; + + INT32 color = (0x40 + (BURN_ENDIAN_SWAP_INT16(source[offs+4]) & 0x3f)) << 4; + + INT32 start = BURN_ENDIAN_SWAP_INT16(source[offs+3]) + ((BURN_ENDIAN_SWAP_INT16(source[offs+4]) & 0x1f00) << 8); + UINT8 *rom = DrvGfxROM1 + start * 2; + + for (INT32 y = starty+1;y <= endy;y++) + { + INT32 drawing = 0; + INT32 i=0; + + rom += 2 * width; + INT32 x = 0; + + UINT16 *dest = pTransDraw + (y * nScreenWidth); + + while (i < 512) + { + if (flipx) + { + if ((rom[i] & 0x0f) == 0x0f) + { + if (!drawing) drawing = 1; + else break; + } + else + { + if (rom[i] & 0x0f) + { + if (sx+x >= 0 && sx+x < nScreenWidth) { + dest[(sx+x)] = color | (rom[i] & 0x0f); + } + } + x++; + } + + if ((rom[i] & 0xf0) == 0xf0) + { + if (!drawing) drawing = 1; + else break; + } + else + { + if (rom[i] & 0xf0) + { + if (sx+x >= 0 && sx+x < nScreenWidth) { + dest[(sx+x)] = color | (rom[i]>>4); + } + } + x++; + } + + i--; + } + else + { + if ((rom[i] & 0xf0) == 0xf0) + { + if (!drawing) drawing = 1; + else break; + } + else + { + if (rom[i] & 0xf0) + { + if (sx+x >= 0 && sx+x < nScreenWidth) { + dest[(sx+x)] = color | (rom[i]>>4); + } + } + x++; + } + + if ((rom[i] & 0x0f) == 0x0f) + { + if (!drawing) drawing = 1; + else break; + } + else + { + if (rom[i] & 0x0f) + { + if (sx+x >= 0 && sx+x < nScreenWidth) { + dest[(sx+x)] = color | (rom[i] & 0x0f); + } + } + x++; + } + + i++; + } + } + } + } +} + +static void draw_layer(INT32 *in_page, INT32 scrollx, INT32 scrolly, INT32 transp) +{ + UINT16 *vram = (UINT16*)DrvVidRAM; + + for (INT32 offs = 0; offs < 128 * 64; offs++) + { + INT32 sx = ((offs & 0x7f) << 3) - scrollx; + INT32 sy = ((offs >> 7) << 3) - scrolly; + + INT32 ofst = DrvLayerTable[offs]; + + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[in_page[ofst>>11] * 0x0800 + (ofst & 0x7ff)]); + INT32 code = attr; + if (transp && !code) continue; + INT32 color = (attr & 0x1fc0) >> 6; + + if (sx >= nScreenWidth || sy >= nScreenHeight || sy < -7 || sx < -7) continue; + + if (sx >= 0 && sx < (nScreenWidth - 7) && sy >= 0 && sy < (nScreenHeight - 7)) { + if (transp) { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM0); + } + } else { + if (transp) { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM0); + } + } + } +} + +static void draw_text() +{ + UINT16 *vram = (UINT16*)DrvTxtRAM; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = ((offs & 0x3f) << 3) - 192; + INT32 sy = (offs >> 6) << 3; + + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[DrvTxtTable[offs]]); + INT32 code = attr & 0xf1ff; + INT32 color = (attr & 0x0e00) >> 9; + + if (sx < 0 || sy >= nScreenHeight || sx >= nScreenWidth || !code) continue; + + if (sx >= 0 && sx < (nScreenWidth - 7) && sy >= 0 && sy < (nScreenHeight - 7)) { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x1000; i+=2) { + palette_write(i); + } + } + + if (~*coin_control & 0x20) return 0; + + { + INT32 pages[4]; + UINT16 *txtram = (UINT16*)DrvTxtRAM; + + // draw_sprites(0); + + INT32 bg_scrollx = (BURN_ENDIAN_SWAP_INT16(txtram[bg_scrollx_reg]) - bg_scrollx_offs) & 0x1ff; + INT32 bg_scrolly = ((BURN_ENDIAN_SWAP_INT16(txtram[bg_scrolly_reg]) & 0xff) - bg_scrolly_offs) & 0xff; + INT32 page = BURN_ENDIAN_SWAP_INT16(txtram[bg_page_reg]); + + pages[3] = (page >> 12) & 0x0f; + pages[2] = (page >> 8) & 0x0f; + pages[1] = (page >> 4) & 0x0f; + pages[0] = (page >> 0) & 0x0f; + + draw_layer(pages, bg_scrollx+192, bg_scrolly, 0); + + draw_sprites(1); + + INT32 fg_scrollx = (BURN_ENDIAN_SWAP_INT16(txtram[fg_scrollx_reg]) - fg_scrollx_offs) & 0x1ff; + INT32 fg_scrolly = ((BURN_ENDIAN_SWAP_INT16(txtram[fg_scrolly_reg]) & 0xff) - fg_scrolly_offs) & 0xff; + page = BURN_ENDIAN_SWAP_INT16(txtram[fg_page_reg]); + + pages[3] = (page >> 12) & 0x0f; + pages[2] = (page >> 8) & 0x0f; + pages[1] = (page >> 4) & 0x0f; + pages[0] = (page >> 0) & 0x0f; + + draw_layer(pages, fg_scrollx+192, fg_scrolly, 1); + + draw_sprites(2); + draw_text(); + draw_sprites(3); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) + { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + SekNewFrame(); + ZetNewFrame(); + + INT32 nInterleave = 10; + INT32 nCyclesSegment; + INT32 nCyclesTotal[2] = { 12500000 / 60, 6250000 / 60 }; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesSegment = nCyclesTotal[0] / nInterleave; + + nCyclesDone[0] = SekRun(nCyclesSegment); + + if (nGame == 2) continue; + + nCyclesSegment = nCyclesTotal[1] / nInterleave; + + BurnTimerUpdateYM3812(i * nCyclesSegment); + } + + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + if (nGame != 2) BurnTimerEndFrameYM3812(nCyclesTotal[1]); + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029698; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + SCAN_VAR(nCyclesDone[0]); + SCAN_VAR(nCyclesDone[1]); + + BurnYM3812Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + + deniam16_set_okibank(*okibank); + } + + return 0; +} + + +// Logic Pro (Japan) + +static struct BurnRomInfo logicproRomDesc[] = { + { "logicpro.r4", 0x40000, 0xc506d484, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "logicpro.r3", 0x40000, 0xd5a4cf62, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "logicpro.r2", 0x10000, 0x000d624b, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "logicpro.r5", 0x80000, 0xdedf18c9, 3 | BRF_GRA }, // 3 Graphics Tiles + { "logicpro.r6", 0x80000, 0x3ecbd1c2, 3 | BRF_GRA }, // 4 + { "logicpro.r7", 0x80000, 0x47135521, 3 | BRF_GRA }, // 5 + + { "logicpro.r9", 0x80000, 0xa98bc1d2, 4 | BRF_GRA }, // 6 Sprites + { "logicpro.r8", 0x80000, 0x1de46298, 4 | BRF_GRA }, // 7 + + { "logicpro.r1", 0x80000, 0xa1fec4d4, 5 | BRF_SND }, // 8 Samples +}; + +STD_ROM_PICK(logicpro) +STD_ROM_FN(logicpro) + +static INT32 logicproInit() +{ + bg_scrollx_reg = 0x00a4/2; + bg_scrolly_reg = 0x00a8/2; + bg_page_reg = 0x00ac/2; + fg_scrollx_reg = 0x00a2/2; + fg_scrolly_reg = 0x00a6/2; + fg_page_reg = 0x00aa/2; + + bg_scrollx_offs = 0x00d; + bg_scrolly_offs = 0x000; + fg_scrollx_offs = 0x009; + fg_scrolly_offs = 0x000; + + return DrvInit(); +} + +struct BurnDriver BurnDrvLogicpro = { + "logicpro", NULL, NULL, NULL, "1996", + "Logic Pro (Japan)\0", NULL, "Deniam", "Deniam-16b Hardware", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, logicproRomInfo, logicproRomName, NULL, NULL, DrvInputInfo, Logicpr2DIPInfo, + logicproInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 224, 4, 3 +}; + + +// Croquis (Germany) + +static struct BurnRomInfo croquisRomDesc[] = { + { "r4.bin", 0x40000, 0x03c9055e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "r3.bin", 0x40000, 0xa98ae4f6, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "logicpro.r2", 0x10000, 0x000d624b, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "logicpro.r5", 0x80000, 0xdedf18c9, 3 | BRF_GRA }, // 3 Graphics Tiles + { "logicpro.r6", 0x80000, 0x3ecbd1c2, 3 | BRF_GRA }, // 4 + { "logicpro.r7", 0x80000, 0x47135521, 3 | BRF_GRA }, // 5 + + { "logicpro.r9", 0x80000, 0xa98bc1d2, 4 | BRF_GRA }, // 6 Sprites + { "logicpro.r8", 0x80000, 0x1de46298, 4 | BRF_GRA }, // 7 + + { "logicpro.r1", 0x80000, 0xa1fec4d4, 5 | BRF_SND }, // 8 Samples +}; + +STD_ROM_PICK(croquis) +STD_ROM_FN(croquis) + +struct BurnDriver BurnDrvCroquis = { + "croquis", "logicpro", NULL, NULL, "1996", + "Croquis (Germany)\0", NULL, "Deniam", "Deniam-16b Hardware", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, croquisRomInfo, croquisRomName, NULL, NULL, DrvInputInfo, Logicpr2DIPInfo, + logicproInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 224, 4, 3 +}; + + +// Karian Cross (Rev. 1.0) + +static struct BurnRomInfo karianxRomDesc[] = { + { "even", 0x80000, 0xfd0ce238, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "odd", 0x80000, 0xbe173cdc, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "snd", 0x10000, 0xfedd3375, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "bkg1", 0x80000, 0x5cb8558a, 3 | BRF_GRA }, // 3 Graphics Tiles + { "bkg2", 0x80000, 0x95ff297c, 3 | BRF_GRA }, // 4 + { "bkg3", 0x80000, 0x6c81f1b2, 3 | BRF_GRA }, // 5 + + { "obj4", 0x80000, 0x5f8d75a9, 4 | BRF_GRA }, // 6 Sprites + { "obj1", 0x80000, 0x967ee97d, 4 | BRF_GRA }, // 7 + { "obj5", 0x80000, 0xe9fc22f9, 4 | BRF_GRA }, // 8 + { "obj2", 0x80000, 0xd39eb04e, 4 | BRF_GRA }, // 9 + { "obj6", 0x80000, 0xc1ec35a5, 4 | BRF_GRA }, // 10 + { "obj3", 0x80000, 0x6ac1ac87, 4 | BRF_GRA }, // 11 + + { "voi", 0x80000, 0xc6506a80, 5 | BRF_SND }, // 12 Samples +}; + +STD_ROM_PICK(karianx) +STD_ROM_FN(karianx) + +static INT32 karianxInit() +{ + nGame = 1; + + bg_scrollx_reg = 0x00a4/2; + bg_scrolly_reg = 0x00a8/2; + bg_page_reg = 0x00ac/2; + fg_scrollx_reg = 0x00a2/2; + fg_scrolly_reg = 0x00a6/2; + fg_page_reg = 0x00aa/2; + + bg_scrollx_offs = 0x10d; + bg_scrolly_offs = 0x080; + fg_scrollx_offs = 0x109; + fg_scrolly_offs = 0x080; + + return DrvInit(); +} + +struct BurnDriver BurnDrvKarianx = { + "karianx", NULL, NULL, NULL, "1996", + "Karian Cross (Rev. 1.0)\0", NULL, "Deniam", "Deniam-16b Hardware", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, karianxRomInfo, karianxRomName, NULL, NULL, DrvInputInfo, KarianxDIPInfo, + karianxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 224, 4, 3 +}; + + +// Logic Pro 2 (Japan) + +static struct BurnRomInfo logicpr2RomDesc[] = { + { "lp2-2", 0x080000, 0xcc1880bf, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "lp2-1", 0x080000, 0x46d5e954, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "log2-b01", 0x080000, 0xfe789e07, 3 | BRF_GRA }, // 2 Graphics Tiles + { "log2-b02", 0x080000, 0x1e0c51cd, 3 | BRF_GRA }, // 3 + { "log2-b03", 0x080000, 0x916f2928, 3 | BRF_GRA }, // 4 + + { "obj", 0x400000, 0xf221f305, 4 | BRF_GRA }, // 5 Sprites + + { "log2-s01", 0x100000, 0x2875c435, 5 | BRF_SND }, // 6 Samples +}; + +STD_ROM_PICK(logicpr2) +STD_ROM_FN(logicpr2) + +static INT32 logicpr2Init() +{ + nGame = 2; + + return logicproInit(); +} + +struct BurnDriver BurnDrvLogicpr2 = { + "logicpr2", NULL, NULL, NULL, "1997", + "Logic Pro 2 (Japan)\0", NULL, "Deniam", "Deniam-16c Hardware", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, logicpr2RomInfo, logicpr2RomName, NULL, NULL, DrvInputInfo, Logicpr2DIPInfo, + logicpr2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_diverboy.cpp b/src/burn/drv/pst90s/d_diverboy.cpp index fafb7504e..7abf065f6 100644 --- a/src/burn/drv/pst90s/d_diverboy.cpp +++ b/src/burn/drv/pst90s/d_diverboy.cpp @@ -1,499 +1,498 @@ -// FB Alpha Diverboy driver module -// Based on MAME driver by David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSndROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT32 *DrvPalette; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[1]; -static UINT8 DrvReset; -static UINT16 DrvInputs[2]; - -static UINT8 *soundlatch; -static UINT8 *samplebank; - -static struct BurnInputInfo DiverboyInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, - {"Coin 2", BIT_DIGITAL, DrvJoy2 + 1, "p2 coin" }, - {"Coin 3", BIT_DIGITAL, DrvJoy2 + 2, "p3 coin" }, - - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 15, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Diverboy) - -static struct BurnDIPInfo DiverboyDIPList[]= -{ - {0x12, 0xff, 0xff, 0xb8, NULL }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x12, 0x01, 0x07, 0x07, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x05, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x00, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x03, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x12, 0x01, 0x08, 0x00, "2" }, - {0x12, 0x01, 0x08, 0x08, "3" }, - - {0 , 0xfe, 0 , 2, "Display Copyright" }, - {0x12, 0x01, 0x10, 0x00, "No" }, - {0x12, 0x01, 0x10, 0x10, "Yes" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x60, 0x00, "Easy" }, - {0x12, 0x01, 0x60, 0x20, "Normal" }, - {0x12, 0x01, 0x60, 0x40, "Hard" }, - {0x12, 0x01, 0x60, 0x60, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x12, 0x01, 0x80, 0x80, "No" }, - {0x12, 0x01, 0x80, 0x00, "Yes" }, -}; - -STDDIPINFO(Diverboy) - -void __fastcall diverboy_write_byte(UINT32 /*address*/, UINT8 /*data*/) -{ -} - -void __fastcall diverboy_write_word(UINT32 address, UINT16 data) -{ - if (address == 0x100000) { - *soundlatch = data; - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - return; - } -} - -UINT8 __fastcall diverboy_read_byte(UINT32 address) -{ - switch (address) - { - case 0x180000: - return DrvInputs[0] >> 8; - - case 0x180001: - return DrvInputs[0] & 0xff; - - case 0x180009: - return DrvInputs[1] & 0xf7; - } - - return 0; -} - -UINT16 __fastcall diverboy_read_word(UINT32 address) -{ - switch (address) - { - case 0x180002: - return DrvDips[0]; - - case 0x180008: - return DrvInputs[1]; - } - - return 0; -} - -static inline void sample_bank(INT32 data) -{ - *samplebank = data & 3; - - MSM6295ROM = DrvSndROM + ((data & 3) << 18); -} - -void __fastcall diverboy_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x9000: - sample_bank(data); - return; - - case 0x9800: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall diverboy_sound_read(UINT16 address) -{ - switch (address) - { - case 0x9800: - return MSM6295ReadStatus(0); - - case 0xa000: - return *soundlatch; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - sample_bank(0); - MSM6295Reset(0); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x100000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x100000; - - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x004000; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - samplebank = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0, 1, 2, 3 }; - INT32 XOffs[16] = { 56, 60, 48, 52, 40, 44, 32, 36, 24, 28, 16, 20, 8, 12, 0, 4 }; - INT32 YOffs[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x100000); - - GfxDecode(0x2000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x080000); - - GfxDecode(0x1000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - memcpy (DrvZ80ROM, DrvZ80ROM + 0x8000, 0x8000); - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040001, 8, 2)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 9, 1)) return 1; - memcpy (DrvSndROM + 0xc0000, DrvSndROM + 0x60000, 0x20000); - memcpy (DrvSndROM + 0x80000, DrvSndROM + 0x40000, 0x20000); - memcpy (DrvSndROM + 0x40000, DrvSndROM + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM + 0x020000, 10, 1)) return 1; - memcpy (DrvSndROM + 0xe0000, DrvSndROM + 0x20000, 0x20000); - memcpy (DrvSndROM + 0xa0000, DrvSndROM + 0x20000, 0x20000); - memcpy (DrvSndROM + 0x60000, DrvSndROM + 0x20000, 0x20000); - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x040000, 0x04ffff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x080000, 0x083fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x140000, 0x1407ff, SM_RAM); - SekSetWriteByteHandler(0, diverboy_write_byte); - SekSetWriteWordHandler(0, diverboy_write_word); - SekSetReadByteHandler(0, diverboy_read_byte); - SekSetReadWordHandler(0, diverboy_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(diverboy_sound_write); - ZetSetReadHandler(diverboy_sound_read); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 1320000 / 132, 0); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - MSM6295Exit(0); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - return 0; -} - -static void draw_sprites() -{ - UINT16 *vram = (UINT16*)DrvSprRAM; - - for (INT32 offs = 0; offs < 0x4000 / 2; offs+=8) - { - INT32 sy = ( 256 - BURN_ENDIAN_SWAP_INT16(vram[offs + 4])) - 16; - INT32 sx = ((480 - BURN_ENDIAN_SWAP_INT16(vram[offs + 0])) & 0x1ff) - 173; - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs + 1]); - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs + 3]); - INT32 color = ((attr & 0x00f0) >> 4) | ((attr & 0x000c) << 2); - INT32 flash = (attr & 0x1000); - INT32 bank = (attr & 0x0002) >> 1; - - if (flash && (GetCurrentFrame() & 1)) continue; - if (sx >= nScreenWidth || sy >= nScreenHeight || sx < -15 || sy < -15) continue; - - if (attr & 0x0008) { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, bank ? DrvGfxROM1 : DrvGfxROM0); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, bank ? DrvGfxROM1 : DrvGfxROM0); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - UINT8 r,g,b; - UINT16 *pal = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x800 / 2; i++, pal++) { - r = ((BURN_ENDIAN_SWAP_INT16(*pal) << 4) & 0xf0) | ((BURN_ENDIAN_SWAP_INT16(*pal) << 0) & 0x0f); - g = ((BURN_ENDIAN_SWAP_INT16(*pal) >> 0) & 0xf0) | ((BURN_ENDIAN_SWAP_INT16(*pal) >> 4) & 0x0f); - b = ((BURN_ENDIAN_SWAP_INT16(*pal) >> 4) & 0xf0) | ((BURN_ENDIAN_SWAP_INT16(*pal) >> 8) & 0x0f); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } - } - - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = ~0; - DrvInputs[1] = ~8; - - for (INT32 i = 0; i < 16; i++) - { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - INT32 nSegment; - INT32 nInterleave = 10; - INT32 nTotalCycles[2] = { 12000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); - - nCyclesDone[0] += SekRun(nSegment); - - nSegment = (nTotalCycles[1] - nCyclesDone[1]) / (nInterleave - i); - - nCyclesDone[1] += ZetRun(nSegment); - } - - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029698; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - MSM6295Scan(0, nAction); - - if (nAction & ACB_WRITE) { - sample_bank(*samplebank); - } - } - - return 0; -} - - -// Diver Boy - -static struct BurnRomInfo diverboyRomDesc[] = { - { "db_01.bin", 0x20000, 0x6aa11366, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "db_02.bin", 0x20000, 0x45f8a673, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "db_05.bin", 0x10000, 0xffeb49ec, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "db_08.bin", 0x80000, 0x7bb96220, 3 | BRF_GRA }, // 3 Bank 0 Graphics - { "db_09.bin", 0x80000, 0x12b15476, 3 | BRF_GRA }, // 4 - - { "db_07.bin", 0x20000, 0x18485741, 4 | BRF_GRA }, // 5 Bank 1 Graphics - { "db_10.bin", 0x20000, 0xc381d1cc, 4 | BRF_GRA }, // 6 - { "db_06.bin", 0x20000, 0x21b4e352, 4 | BRF_GRA }, // 7 - { "db_11.bin", 0x20000, 0x41d29c81, 4 | BRF_GRA }, // 8 - - { "db_03.bin", 0x80000, 0x50457505, 5 | BRF_SND }, // 9 Oki6295 Samples - { "db_04.bin", 0x20000, 0x01b81da0, 5 | BRF_SND }, // 10 -}; - -STD_ROM_PICK(diverboy) -STD_ROM_FN(diverboy) - -struct BurnDriver BurnDrvDiverboy = { - "diverboy", NULL, NULL, NULL, "1992", - "Diver Boy\0", NULL, "Electronic Devices Italy", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MISC, 0, - NULL, diverboyRomInfo, diverboyRomName, NULL, NULL, DiverboyInputInfo, DiverboyDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 320, 240, 4, 3 -}; +// FB Alpha Diverboy driver module +// Based on MAME driver by David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSndROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT32 *DrvPalette; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[1]; +static UINT8 DrvReset; +static UINT16 DrvInputs[2]; + +static UINT8 *soundlatch; +static UINT8 *samplebank; + +static struct BurnInputInfo DiverboyInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, + {"Coin 2", BIT_DIGITAL, DrvJoy2 + 1, "p2 coin" }, + {"Coin 3", BIT_DIGITAL, DrvJoy2 + 2, "p3 coin" }, + + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 15, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Diverboy) + +static struct BurnDIPInfo DiverboyDIPList[]= +{ + {0x12, 0xff, 0xff, 0xb8, NULL }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x12, 0x01, 0x07, 0x07, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x05, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x00, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x03, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x12, 0x01, 0x08, 0x00, "2" }, + {0x12, 0x01, 0x08, 0x08, "3" }, + + {0 , 0xfe, 0 , 2, "Display Copyright" }, + {0x12, 0x01, 0x10, 0x00, "No" }, + {0x12, 0x01, 0x10, 0x10, "Yes" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x60, 0x00, "Easy" }, + {0x12, 0x01, 0x60, 0x20, "Normal" }, + {0x12, 0x01, 0x60, 0x40, "Hard" }, + {0x12, 0x01, 0x60, 0x60, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x12, 0x01, 0x80, 0x80, "No" }, + {0x12, 0x01, 0x80, 0x00, "Yes" }, +}; + +STDDIPINFO(Diverboy) + +void __fastcall diverboy_write_byte(UINT32 /*address*/, UINT8 /*data*/) +{ +} + +void __fastcall diverboy_write_word(UINT32 address, UINT16 data) +{ + if (address == 0x100000) { + *soundlatch = data; + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + return; + } +} + +UINT8 __fastcall diverboy_read_byte(UINT32 address) +{ + switch (address) + { + case 0x180000: + return DrvInputs[0] >> 8; + + case 0x180001: + return DrvInputs[0] & 0xff; + + case 0x180009: + return DrvInputs[1] & 0xf7; + } + + return 0; +} + +UINT16 __fastcall diverboy_read_word(UINT32 address) +{ + switch (address) + { + case 0x180002: + return DrvDips[0]; + + case 0x180008: + return DrvInputs[1]; + } + + return 0; +} + +static inline void sample_bank(INT32 data) +{ + *samplebank = data & 3; + + MSM6295ROM = DrvSndROM + ((data & 3) << 18); +} + +void __fastcall diverboy_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x9000: + sample_bank(data); + return; + + case 0x9800: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall diverboy_sound_read(UINT16 address) +{ + switch (address) + { + case 0x9800: + return MSM6295ReadStatus(0); + + case 0xa000: + return *soundlatch; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + sample_bank(0); + MSM6295Reset(0); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x100000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x100000; + + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x004000; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + samplebank = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0, 1, 2, 3 }; + INT32 XOffs[16] = { 56, 60, 48, 52, 40, 44, 32, 36, 24, 28, 16, 20, 8, 12, 0, 4 }; + INT32 YOffs[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x100000); + + GfxDecode(0x2000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x080000); + + GfxDecode(0x1000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + memcpy (DrvZ80ROM, DrvZ80ROM + 0x8000, 0x8000); + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040001, 8, 2)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 9, 1)) return 1; + memcpy (DrvSndROM + 0xc0000, DrvSndROM + 0x60000, 0x20000); + memcpy (DrvSndROM + 0x80000, DrvSndROM + 0x40000, 0x20000); + memcpy (DrvSndROM + 0x40000, DrvSndROM + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM + 0x020000, 10, 1)) return 1; + memcpy (DrvSndROM + 0xe0000, DrvSndROM + 0x20000, 0x20000); + memcpy (DrvSndROM + 0xa0000, DrvSndROM + 0x20000, 0x20000); + memcpy (DrvSndROM + 0x60000, DrvSndROM + 0x20000, 0x20000); + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x040000, 0x04ffff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x080000, 0x083fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x140000, 0x1407ff, SM_RAM); + SekSetWriteByteHandler(0, diverboy_write_byte); + SekSetWriteWordHandler(0, diverboy_write_word); + SekSetReadByteHandler(0, diverboy_read_byte); + SekSetReadWordHandler(0, diverboy_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(diverboy_sound_write); + ZetSetReadHandler(diverboy_sound_read); + ZetClose(); + + MSM6295Init(0, 1320000 / 132, 0); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + MSM6295Exit(0); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + return 0; +} + +static void draw_sprites() +{ + UINT16 *vram = (UINT16*)DrvSprRAM; + + for (INT32 offs = 0; offs < 0x4000 / 2; offs+=8) + { + INT32 sy = ( 256 - BURN_ENDIAN_SWAP_INT16(vram[offs + 4])) - 16; + INT32 sx = ((480 - BURN_ENDIAN_SWAP_INT16(vram[offs + 0])) & 0x1ff) - 173; + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs + 1]); + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs + 3]); + INT32 color = ((attr & 0x00f0) >> 4) | ((attr & 0x000c) << 2); + INT32 flash = (attr & 0x1000); + INT32 bank = (attr & 0x0002) >> 1; + + if (flash && (GetCurrentFrame() & 1)) continue; + if (sx >= nScreenWidth || sy >= nScreenHeight || sx < -15 || sy < -15) continue; + + if (attr & 0x0008) { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, bank ? DrvGfxROM1 : DrvGfxROM0); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, bank ? DrvGfxROM1 : DrvGfxROM0); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + UINT8 r,g,b; + UINT16 *pal = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x800 / 2; i++, pal++) { + r = ((BURN_ENDIAN_SWAP_INT16(*pal) << 4) & 0xf0) | ((BURN_ENDIAN_SWAP_INT16(*pal) << 0) & 0x0f); + g = ((BURN_ENDIAN_SWAP_INT16(*pal) >> 0) & 0xf0) | ((BURN_ENDIAN_SWAP_INT16(*pal) >> 4) & 0x0f); + b = ((BURN_ENDIAN_SWAP_INT16(*pal) >> 4) & 0xf0) | ((BURN_ENDIAN_SWAP_INT16(*pal) >> 8) & 0x0f); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } + } + + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = ~0; + DrvInputs[1] = ~8; + + for (INT32 i = 0; i < 16; i++) + { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + INT32 nSegment; + INT32 nInterleave = 10; + INT32 nTotalCycles[2] = { 12000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); + + nCyclesDone[0] += SekRun(nSegment); + + nSegment = (nTotalCycles[1] - nCyclesDone[1]) / (nInterleave - i); + + nCyclesDone[1] += ZetRun(nSegment); + } + + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029698; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + MSM6295Scan(0, nAction); + + if (nAction & ACB_WRITE) { + sample_bank(*samplebank); + } + } + + return 0; +} + + +// Diver Boy + +static struct BurnRomInfo diverboyRomDesc[] = { + { "db_01.bin", 0x20000, 0x6aa11366, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "db_02.bin", 0x20000, 0x45f8a673, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "db_05.bin", 0x10000, 0xffeb49ec, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "db_08.bin", 0x80000, 0x7bb96220, 3 | BRF_GRA }, // 3 Bank 0 Graphics + { "db_09.bin", 0x80000, 0x12b15476, 3 | BRF_GRA }, // 4 + + { "db_07.bin", 0x20000, 0x18485741, 4 | BRF_GRA }, // 5 Bank 1 Graphics + { "db_10.bin", 0x20000, 0xc381d1cc, 4 | BRF_GRA }, // 6 + { "db_06.bin", 0x20000, 0x21b4e352, 4 | BRF_GRA }, // 7 + { "db_11.bin", 0x20000, 0x41d29c81, 4 | BRF_GRA }, // 8 + + { "db_03.bin", 0x80000, 0x50457505, 5 | BRF_SND }, // 9 Oki6295 Samples + { "db_04.bin", 0x20000, 0x01b81da0, 5 | BRF_SND }, // 10 +}; + +STD_ROM_PICK(diverboy) +STD_ROM_FN(diverboy) + +struct BurnDriver BurnDrvDiverboy = { + "diverboy", NULL, NULL, NULL, "1992", + "Diver Boy\0", NULL, "Electronic Devices Italy", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MISC, 0, + NULL, diverboyRomInfo, diverboyRomName, NULL, NULL, DiverboyInputInfo, DiverboyDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_egghunt.cpp b/src/burn/drv/pst90s/d_egghunt.cpp index 5bf89444d..52efc540e 100644 --- a/src/burn/drv/pst90s/d_egghunt.cpp +++ b/src/burn/drv/pst90s/d_egghunt.cpp @@ -1,561 +1,559 @@ -// FB Alpha Egg Hunt driver module -// Based on MAME driver by David Haywood - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvSndROM0; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvVidRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvColRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM1; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; - -static UINT8 ram_bank; -static UINT8 gfx_bank; -static UINT8 oki_bank; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo EgghuntInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 7, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 6, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 5, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 4, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 2" }, - - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 7, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 6, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 5, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 4, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 3, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 2, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Egghunt) - -static struct BurnDIPInfo EgghuntDIPList[]= -{ - {0x10, 0xff, 0xff, 0x61, NULL }, - {0x11, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 2, "Debug Mode" }, - {0x10, 0x01, 0x01, 0x01, "Off" }, - {0x10, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 3, "Credits per Player" }, - {0x10, 0x01, 0x60, 0x60, "1" }, - {0x10, 0x01, 0x60, 0x40, "2" }, - {0x10, 0x01, 0x60, 0x00, "3" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x10, 0x01, 0x80, 0x80, "Off" }, - {0x10, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Censor Pictures" }, - {0x11, 0x01, 0x80, 0x00, "No" }, - {0x11, 0x01, 0x80, 0x80, "Yes" }, -}; - -STDDIPINFO(Egghunt) - -static inline void palette_write(INT32 offset) -{ - INT32 d = (DrvPalRAM[offset + 1] << 8) | (DrvPalRAM[offset + 0]); - - INT32 r = (d >> 10) & 0x1f; - INT32 g = (d >> 5) & 0x1f; - INT32 b = (d >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); -} - -void __fastcall egghunt_main_write(UINT16 address, UINT8 data) -{ - if ((address & 0xf800) == 0xc000) { - DrvPalRAM[address & 0x7ff] = data; - palette_write(address & 0x7fe); - return; - } -} - -static void set_ram_bank(INT32 data) -{ - ram_bank = data & 1; - - if (ram_bank) { - ZetMapArea(0xd000, 0xdfff, 0, DrvSprRAM); - ZetMapArea(0xd000, 0xdfff, 1, DrvSprRAM); - ZetMapArea(0xd000, 0xdfff, 2, DrvSprRAM); - } else { - ZetMapArea(0xd000, 0xdfff, 0, DrvVidRAM); - ZetMapArea(0xd000, 0xdfff, 1, DrvVidRAM); - ZetMapArea(0xd000, 0xdfff, 2, DrvVidRAM); - } -} - -void __fastcall egghunt_main_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - set_ram_bank(data); - return; - - case 0x01: - gfx_bank = data & 0x33; - return; - - case 0x03: - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(0); - *soundlatch = data; - return; - } -} - -UINT8 __fastcall egghunt_main_read_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return DrvDips[0]; - - case 0x01: - return DrvInputs[0]; - - case 0x02: - return DrvInputs[1]; - - case 0x03: - return DrvInputs[2]; - - case 0x04: - return DrvDips[1]; - - case 0x06: - return 0xff; - } - - return 0; -} - -static void set_oki_bank(INT32 data) -{ - MSM6295ROM = DrvSndROM0 + ((data & 0x10) >> 4) * 0x40000; - - for (INT32 nChannel = 0; nChannel < 4; nChannel++) { - MSM6295SampleInfo[0][nChannel] = MSM6295ROM + (nChannel << 8); - MSM6295SampleData[0][nChannel] = MSM6295ROM + (nChannel << 16); - } -} - -void __fastcall egghunt_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe001: - oki_bank = data; - set_oki_bank(data); - return; - - case 0xe004: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall egghunt_sound_read(UINT16 address) -{ - switch (address) - { - case 0xe000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0xe001: - return oki_bank; - - case 0xe004: - return MSM6295ReadStatus(0); - } - - return 0; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - set_oki_bank(0); - MSM6295Reset(0); - - oki_bank = 0; - ram_bank = 0; - gfx_bank = 0; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x400000, 0x600000, 0x000000, 0x200000 }; - INT32 XOffs0[8] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }; - INT32 XOffs1[16]= { 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x84, 0x85, 0x86, 0x87, 0x80, 0x81, 0x82, 0x83 }; - INT32 YOffs[16] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x100000; i++) tmp[i] = DrvGfxROM0[i] ^ 0xff; - - GfxDecode(0x08000, 4, 8, 8, Plane, XOffs0, YOffs, 0x040, tmp, DrvGfxROM0); - - for (INT32 i = 0; i < 0x100000; i++) tmp[i] = DrvGfxROM1[i] ^ 0xff; - - GfxDecode(0x01000, 4, 16, 16, Plane, XOffs1, YOffs, 0x100, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x020000; - DrvZ80ROM1 = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x100000; - - DrvSndROM0 = Next; Next += 0x080000; - - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x002000; - DrvVidRAM = Next; Next += 0x001000; - DrvSprRAM = Next; Next += 0x001000; - DrvColRAM = Next; Next += 0x000800; - DrvPalRAM = Next; Next += 0x000800; - - DrvZ80RAM1 = Next; Next += 0x001000; - - soundlatch = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - BurnSetRefreshRate(58.0); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x000000, 0, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x000000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0c0000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 9, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 10, 1)) return 1; - - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0xc000, 0xc7ff, 0, DrvPalRAM); -// ZetMapArea(0xc000, 0xc7ff, 1, DrvPalRAM); - ZetMapArea(0xc000, 0xc7ff, 2, DrvPalRAM); - ZetMapArea(0xc800, 0xcfff, 0, DrvColRAM); - ZetMapArea(0xc800, 0xcfff, 1, DrvColRAM); - ZetMapArea(0xc800, 0xcfff, 2, DrvColRAM); - ZetMapArea(0xd000, 0xdfff, 0, DrvVidRAM); - ZetMapArea(0xd000, 0xdfff, 1, DrvVidRAM); - ZetMapArea(0xd000, 0xdfff, 2, DrvVidRAM); - ZetMapArea(0xe000, 0xffff, 0, DrvZ80RAM0); - ZetMapArea(0xe000, 0xffff, 1, DrvZ80RAM0); - ZetMapArea(0xe000, 0xffff, 2, DrvZ80RAM0); - ZetSetWriteHandler(egghunt_main_write); - ZetSetOutHandler(egghunt_main_write_port); - ZetSetInHandler(egghunt_main_read_port); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0xf000, 0xffff, 0, DrvZ80RAM1); - ZetMapArea(0xf000, 0xffff, 1, DrvZ80RAM1); - ZetMapArea(0xf000, 0xffff, 2, DrvZ80RAM1); - ZetSetWriteHandler(egghunt_sound_write); - ZetSetReadHandler(egghunt_sound_read); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 1056000 / 132, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - MSM6295Exit(0); - MSM6295ROM = NULL; - - ZetExit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_sprites() -{ - for (INT32 offs = 0x1000 - 0x40; offs >= 0; offs -= 0x20) - { - INT32 attr = DrvSprRAM[offs + 1]; - INT32 code = DrvSprRAM[offs + 0] | ((attr & 0xe0) << 3); - INT32 sx = DrvSprRAM[offs + 3] | ((attr & 0x10) << 4); - INT32 sy = ((DrvSprRAM[offs + 2] + 8) & 0xff) - 8; - - if (attr & 0xe0) { - if (gfx_bank & 0x20) { - code += 0x400 << (gfx_bank & 1); - } - } - - Render16x16Tile_Mask_Clip(pTransDraw, code, sx - 64, sy - 8, attr & 0x0f, 4, 15, 0, DrvGfxROM1); - } -} - -static void draw_background_layer() -{ - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = ((offs & 0x3f) << 3) - 64; - INT32 sy = ((offs >> 6) << 3) - 8; - - if (sy < 0 || sy >= nScreenHeight || sx < 0 || sx >= nScreenWidth) continue; - - INT32 code = ((DrvVidRAM[offs * 2 + 1] & 0x3f) << 8) | (DrvVidRAM[offs * 2 + 0]); - INT32 color = DrvColRAM[offs] & 0x3f; - - if (code & 0x2000) { - if (gfx_bank & 0x02) { - code += 0x2000 << (gfx_bank & 1); - } - } - - Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x800; i+=2) { - palette_write(i); - } - DrvRecalc = 0; - } - - draw_background_layer(); - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { 6000000 / 60, 6000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = nCyclesTotal[0] / nInterleave; - - ZetOpen(0); - nCyclesDone[0] += ZetRun(nSegment); - if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - ZetOpen(1); - nCyclesDone[1] += ZetRun(nSegment); - ZetClose(); - } - - if (pBurnSoundOut) { - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029707; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - - MSM6295Scan(0, nAction); - - SCAN_VAR(oki_bank); - SCAN_VAR(gfx_bank); - SCAN_VAR(ram_bank); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - set_ram_bank(ram_bank); - ZetClose(); - - set_oki_bank(oki_bank); - } - - return 0; -} - - -// Egg Hunt - -static struct BurnRomInfo egghuntRomDesc[] = { - { "prg.bin", 0x20000, 0xeb647145, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code - - { "rom2.bin", 0x10000, 0x88a71bc3, 2 | BRF_ESS | BRF_PRG }, // 1 Z80 #1 Code - - { "rom3.bin", 0x40000, 0x9d51ac49, 3 | BRF_GRA }, // 2 Tiles - { "rom4.bin", 0x40000, 0x41c63041, 3 | BRF_GRA }, // 3 - { "rom5.bin", 0x40000, 0x6f96cb97, 3 | BRF_GRA }, // 4 - { "rom6.bin", 0x40000, 0xb5a41d4b, 3 | BRF_GRA }, // 5 - - { "rom7.bin", 0x20000, 0x1b43fb57, 4 | BRF_GRA }, // 6 Sprites - { "rom8.bin", 0x20000, 0xf8122d0d, 4 | BRF_GRA }, // 7 - { "rom9.bin", 0x20000, 0xdbfa0ffe, 4 | BRF_GRA }, // 8 - { "rom10.bin", 0x20000, 0x14f5fc74, 4 | BRF_GRA }, // 9 - - { "rom1.bin", 0x80000, 0xf03589bc, 5 | BRF_SND }, // 10 Samples -}; - -STD_ROM_PICK(egghunt) -STD_ROM_FN(egghunt) - -struct BurnDriver BurnDrvEgghunt = { - "egghunt", NULL, NULL, NULL, "1995", - "Egg Hunt\0", NULL, "Invi Image", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, egghuntRomInfo, egghuntRomName, NULL, NULL, EgghuntInputInfo, EgghuntDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 384, 240, 4, 3 -}; +// FB Alpha Egg Hunt driver module +// Based on MAME driver by David Haywood + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvSndROM0; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvVidRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvColRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM1; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; + +static UINT8 ram_bank; +static UINT8 gfx_bank; +static UINT8 oki_bank; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo EgghuntInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 7, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 6, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 5, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 4, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 2" }, + + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 7, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 6, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 5, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 4, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 3, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 2, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Egghunt) + +static struct BurnDIPInfo EgghuntDIPList[]= +{ + {0x10, 0xff, 0xff, 0x61, NULL }, + {0x11, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 2, "Debug Mode" }, + {0x10, 0x01, 0x01, 0x01, "Off" }, + {0x10, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 3, "Credits per Player" }, + {0x10, 0x01, 0x60, 0x60, "1" }, + {0x10, 0x01, 0x60, 0x40, "2" }, + {0x10, 0x01, 0x60, 0x00, "3" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x10, 0x01, 0x80, 0x80, "Off" }, + {0x10, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Censor Pictures" }, + {0x11, 0x01, 0x80, 0x00, "No" }, + {0x11, 0x01, 0x80, 0x80, "Yes" }, +}; + +STDDIPINFO(Egghunt) + +static inline void palette_write(INT32 offset) +{ + INT32 d = (DrvPalRAM[offset + 1] << 8) | (DrvPalRAM[offset + 0]); + + INT32 r = (d >> 10) & 0x1f; + INT32 g = (d >> 5) & 0x1f; + INT32 b = (d >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); +} + +void __fastcall egghunt_main_write(UINT16 address, UINT8 data) +{ + if ((address & 0xf800) == 0xc000) { + DrvPalRAM[address & 0x7ff] = data; + palette_write(address & 0x7fe); + return; + } +} + +static void set_ram_bank(INT32 data) +{ + ram_bank = data & 1; + + if (ram_bank) { + ZetMapArea(0xd000, 0xdfff, 0, DrvSprRAM); + ZetMapArea(0xd000, 0xdfff, 1, DrvSprRAM); + ZetMapArea(0xd000, 0xdfff, 2, DrvSprRAM); + } else { + ZetMapArea(0xd000, 0xdfff, 0, DrvVidRAM); + ZetMapArea(0xd000, 0xdfff, 1, DrvVidRAM); + ZetMapArea(0xd000, 0xdfff, 2, DrvVidRAM); + } +} + +void __fastcall egghunt_main_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + set_ram_bank(data); + return; + + case 0x01: + gfx_bank = data & 0x33; + return; + + case 0x03: + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(0); + *soundlatch = data; + return; + } +} + +UINT8 __fastcall egghunt_main_read_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return DrvDips[0]; + + case 0x01: + return DrvInputs[0]; + + case 0x02: + return DrvInputs[1]; + + case 0x03: + return DrvInputs[2]; + + case 0x04: + return DrvDips[1]; + + case 0x06: + return 0xff; + } + + return 0; +} + +static void set_oki_bank(INT32 data) +{ + MSM6295ROM = DrvSndROM0 + ((data & 0x10) >> 4) * 0x40000; + + for (INT32 nChannel = 0; nChannel < 4; nChannel++) { + MSM6295SampleInfo[0][nChannel] = MSM6295ROM + (nChannel << 8); + MSM6295SampleData[0][nChannel] = MSM6295ROM + (nChannel << 16); + } +} + +void __fastcall egghunt_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe001: + oki_bank = data; + set_oki_bank(data); + return; + + case 0xe004: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall egghunt_sound_read(UINT16 address) +{ + switch (address) + { + case 0xe000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0xe001: + return oki_bank; + + case 0xe004: + return MSM6295ReadStatus(0); + } + + return 0; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + set_oki_bank(0); + MSM6295Reset(0); + + oki_bank = 0; + ram_bank = 0; + gfx_bank = 0; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x400000, 0x600000, 0x000000, 0x200000 }; + INT32 XOffs0[8] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }; + INT32 XOffs1[16]= { 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x84, 0x85, 0x86, 0x87, 0x80, 0x81, 0x82, 0x83 }; + INT32 YOffs[16] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x100000; i++) tmp[i] = DrvGfxROM0[i] ^ 0xff; + + GfxDecode(0x08000, 4, 8, 8, Plane, XOffs0, YOffs, 0x040, tmp, DrvGfxROM0); + + for (INT32 i = 0; i < 0x100000; i++) tmp[i] = DrvGfxROM1[i] ^ 0xff; + + GfxDecode(0x01000, 4, 16, 16, Plane, XOffs1, YOffs, 0x100, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x020000; + DrvZ80ROM1 = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x100000; + + DrvSndROM0 = Next; Next += 0x080000; + + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x002000; + DrvVidRAM = Next; Next += 0x001000; + DrvSprRAM = Next; Next += 0x001000; + DrvColRAM = Next; Next += 0x000800; + DrvPalRAM = Next; Next += 0x000800; + + DrvZ80RAM1 = Next; Next += 0x001000; + + soundlatch = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + BurnSetRefreshRate(58.0); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x000000, 0, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x000000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0c0000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 9, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 10, 1)) return 1; + + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0xc000, 0xc7ff, 0, DrvPalRAM); +// ZetMapArea(0xc000, 0xc7ff, 1, DrvPalRAM); + ZetMapArea(0xc000, 0xc7ff, 2, DrvPalRAM); + ZetMapArea(0xc800, 0xcfff, 0, DrvColRAM); + ZetMapArea(0xc800, 0xcfff, 1, DrvColRAM); + ZetMapArea(0xc800, 0xcfff, 2, DrvColRAM); + ZetMapArea(0xd000, 0xdfff, 0, DrvVidRAM); + ZetMapArea(0xd000, 0xdfff, 1, DrvVidRAM); + ZetMapArea(0xd000, 0xdfff, 2, DrvVidRAM); + ZetMapArea(0xe000, 0xffff, 0, DrvZ80RAM0); + ZetMapArea(0xe000, 0xffff, 1, DrvZ80RAM0); + ZetMapArea(0xe000, 0xffff, 2, DrvZ80RAM0); + ZetSetWriteHandler(egghunt_main_write); + ZetSetOutHandler(egghunt_main_write_port); + ZetSetInHandler(egghunt_main_read_port); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0xf000, 0xffff, 0, DrvZ80RAM1); + ZetMapArea(0xf000, 0xffff, 1, DrvZ80RAM1); + ZetMapArea(0xf000, 0xffff, 2, DrvZ80RAM1); + ZetSetWriteHandler(egghunt_sound_write); + ZetSetReadHandler(egghunt_sound_read); + ZetClose(); + + MSM6295Init(0, 1056000 / 132, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + MSM6295Exit(0); + MSM6295ROM = NULL; + + ZetExit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_sprites() +{ + for (INT32 offs = 0x1000 - 0x40; offs >= 0; offs -= 0x20) + { + INT32 attr = DrvSprRAM[offs + 1]; + INT32 code = DrvSprRAM[offs + 0] | ((attr & 0xe0) << 3); + INT32 sx = DrvSprRAM[offs + 3] | ((attr & 0x10) << 4); + INT32 sy = ((DrvSprRAM[offs + 2] + 8) & 0xff) - 8; + + if (attr & 0xe0) { + if (gfx_bank & 0x20) { + code += 0x400 << (gfx_bank & 1); + } + } + + Render16x16Tile_Mask_Clip(pTransDraw, code, sx - 64, sy - 8, attr & 0x0f, 4, 15, 0, DrvGfxROM1); + } +} + +static void draw_background_layer() +{ + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = ((offs & 0x3f) << 3) - 64; + INT32 sy = ((offs >> 6) << 3) - 8; + + if (sy < 0 || sy >= nScreenHeight || sx < 0 || sx >= nScreenWidth) continue; + + INT32 code = ((DrvVidRAM[offs * 2 + 1] & 0x3f) << 8) | (DrvVidRAM[offs * 2 + 0]); + INT32 color = DrvColRAM[offs] & 0x3f; + + if (code & 0x2000) { + if (gfx_bank & 0x02) { + code += 0x2000 << (gfx_bank & 1); + } + } + + Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x800; i+=2) { + palette_write(i); + } + DrvRecalc = 0; + } + + draw_background_layer(); + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { 6000000 / 60, 6000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = nCyclesTotal[0] / nInterleave; + + ZetOpen(0); + nCyclesDone[0] += ZetRun(nSegment); + if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + ZetOpen(1); + nCyclesDone[1] += ZetRun(nSegment); + ZetClose(); + } + + if (pBurnSoundOut) { + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029707; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + + MSM6295Scan(0, nAction); + + SCAN_VAR(oki_bank); + SCAN_VAR(gfx_bank); + SCAN_VAR(ram_bank); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + set_ram_bank(ram_bank); + ZetClose(); + + set_oki_bank(oki_bank); + } + + return 0; +} + + +// Egg Hunt + +static struct BurnRomInfo egghuntRomDesc[] = { + { "prg.bin", 0x20000, 0xeb647145, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 #0 Code + + { "rom2.bin", 0x10000, 0x88a71bc3, 2 | BRF_ESS | BRF_PRG }, // 1 Z80 #1 Code + + { "rom3.bin", 0x40000, 0x9d51ac49, 3 | BRF_GRA }, // 2 Tiles + { "rom4.bin", 0x40000, 0x41c63041, 3 | BRF_GRA }, // 3 + { "rom5.bin", 0x40000, 0x6f96cb97, 3 | BRF_GRA }, // 4 + { "rom6.bin", 0x40000, 0xb5a41d4b, 3 | BRF_GRA }, // 5 + + { "rom7.bin", 0x20000, 0x1b43fb57, 4 | BRF_GRA }, // 6 Sprites + { "rom8.bin", 0x20000, 0xf8122d0d, 4 | BRF_GRA }, // 7 + { "rom9.bin", 0x20000, 0xdbfa0ffe, 4 | BRF_GRA }, // 8 + { "rom10.bin", 0x20000, 0x14f5fc74, 4 | BRF_GRA }, // 9 + + { "rom1.bin", 0x80000, 0xf03589bc, 5 | BRF_SND }, // 10 Samples +}; + +STD_ROM_PICK(egghunt) +STD_ROM_FN(egghunt) + +struct BurnDriver BurnDrvEgghunt = { + "egghunt", NULL, NULL, NULL, "1995", + "Egg Hunt\0", NULL, "Invi Image", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, egghuntRomInfo, egghuntRomName, NULL, NULL, EgghuntInputInfo, EgghuntDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 384, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_f1gp.cpp b/src/burn/drv/pst90s/d_f1gp.cpp index de5d88fcf..009704637 100644 --- a/src/burn/drv/pst90s/d_f1gp.cpp +++ b/src/burn/drv/pst90s/d_f1gp.cpp @@ -1,1392 +1,1391 @@ -// FB Alpha F-1 Grand Prix driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2610.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM0; -static UINT8 *Drv68KROM1; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM0; -static UINT8 *Drv68KRAM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZoomRAM; -static UINT8 *DrvRozVidRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvShareRAM; -static UINT8 *DrvSprVRAM1; -static UINT8 *DrvSprVRAM2; -static UINT8 *DrvSprCGRAM1; -static UINT8 *DrvSprCGRAM2; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvBgDirty; -static UINT8 *DrvBgTileDirty; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT16 *DrvBgTmp; - -static UINT8 *soundlatch; -static UINT8 *flipscreen; -static UINT8 *gfxctrl; -static UINT8 *pending_command; -static UINT8 *roz_bank; -static UINT8 *DrvZ80Bank; -static UINT16 *DrvFgScrollX; -static UINT16 *DrvFgScrollY; -static UINT16 *DrvBgCtrl; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvDips[4]; -static UINT16 DrvInputs[3]; -static UINT8 DrvReset; - -static INT16 zoom_table[32][33]; - -static INT32 nScreenStartY = 8; - -static struct BurnInputInfo F1gpInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 9, "p2 coin" }, - {"Start", BIT_DIGITAL, DrvJoy1 + 10, "p1 start" }, - {"Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, - {"Button 2", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 14, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, - {"Region", BIT_DIPSWITCH, DrvDips + 3, "dip" }, -}; - -STDINPUTINFO(F1gp) - -static struct BurnInputInfo F1gp2InputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 9, "p2 coin" }, - {"Start", BIT_DIGITAL, DrvJoy1 + 10, "p1 start" }, - {"Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, - {"Button 2", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 2" }, - {"Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 14, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, - {"Region", BIT_DIPSWITCH, DrvDips + 3, "dip" }, -}; - -STDINPUTINFO(F1gp2) - -static struct BurnDIPInfo F1gpDIPList[]= -{ - {0x09, 0xff, 0xff, 0xff, NULL }, - {0x0a, 0xff, 0xff, 0xff, NULL }, - {0x0b, 0xff, 0xff, 0xfb, NULL }, - {0x0c, 0xff, 0xff, 0x10, NULL }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x0a, 0x01, 0x01, 0x01, "Off" }, - {0x0a, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x0a, 0x01, 0x0e, 0x0a, "3 Coins 1 Credit" }, - {0x0a, 0x01, 0x0e, 0x0c, "2 Coins 1 Credit" }, - {0x0a, 0x01, 0x0e, 0x0e, "1 Coin 1 Credit" }, - {0x0a, 0x01, 0x0e, 0x08, "1 Coin 2 Credits" }, - {0x0a, 0x01, 0x0e, 0x06, "1 Coin 3 Credits" }, - {0x0a, 0x01, 0x0e, 0x04, "1 Coin 4 Credits" }, - {0x0a, 0x01, 0x0e, 0x02, "1 Coin 5 Credits" }, - {0x0a, 0x01, 0x0e, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x0a, 0x01, 0x70, 0x50, "3 Coins 1 Credit" }, - {0x0a, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x0a, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x0a, 0x01, 0x70, 0x40, "1 Coin 2 Credits" }, - {0x0a, 0x01, 0x70, 0x30, "1 Coin 3 Credits" }, - {0x0a, 0x01, 0x70, 0x20, "1 Coin 4 Credits" }, - {0x0a, 0x01, 0x70, 0x10, "1 Coin 5 Credits" }, - {0x0a, 0x01, 0x70, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, - {0x0a, 0x01, 0x80, 0x80, "Off" }, - {0x0a, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x09, 0x01, 0x03, 0x02, "Easy" }, - {0x09, 0x01, 0x03, 0x03, "Normal" }, - {0x09, 0x01, 0x03, 0x01, "Hard" }, - {0x09, 0x01, 0x03, 0x00, "Hardest" }, - -// {0 , 0xfe, 0 , 2, "Game Mode" }, -// {0x09, 0x01, 0x04, 0x04, "Single" }, -// {0x09, 0x01, 0x04, 0x00, "Multiple" }, // ID CHECK ERROR - - {0 , 0xfe, 0 , 2, "Mode Select" }, - {0x09, 0x01, 0x08, 0x00, "Off" }, - {0x09, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0b, 0x01, 0x01, 0x01, "Off" }, - {0x0b, 0x01, 0x01, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x0b, 0x01, 0x02, 0x02, "Off" }, -// {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 6, "Country" }, - {0x0c, 0x01, 0x1f, 0x10, "World" }, - {0x0c, 0x01, 0x1f, 0x01, "USA & Canada"}, - {0x0c, 0x01, 0x1f, 0x00, "Japan" }, - {0x0c, 0x01, 0x1f, 0x02, "Korea" }, - {0x0c, 0x01, 0x1f, 0x04, "Hong Kong" }, - {0x0c, 0x01, 0x1f, 0x08, "Taiwan" }, -}; - -STDDIPINFO(F1gp) - -static struct BurnDIPInfo F1gp2DIPList[]= -{ - {0x0a, 0xff, 0xff, 0xff, NULL }, - {0x0b, 0xff, 0xff, 0xff, NULL }, - {0x0c, 0xff, 0xff, 0xfb, NULL }, - {0x0d, 0xff, 0xff, 0x01, NULL }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x0b, 0x01, 0x01, 0x01, "Off" }, - {0x0b, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x0b, 0x01, 0x0e, 0x0a, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0x0e, 0x0c, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x0e, 0x0e, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x0e, 0x08, "1 Coin 2 Credits" }, - {0x0b, 0x01, 0x0e, 0x06, "1 Coin 3 Credits" }, - {0x0b, 0x01, 0x0e, 0x04, "1 Coin 4 Credits" }, - {0x0b, 0x01, 0x0e, 0x02, "1 Coin 5 Credits" }, - {0x0b, 0x01, 0x0e, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x0b, 0x01, 0x70, 0x50, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x70, 0x40, "1 Coin 2 Credits" }, - {0x0b, 0x01, 0x70, 0x30, "1 Coin 3 Credits" }, - {0x0b, 0x01, 0x70, 0x20, "1 Coin 4 Credits" }, - {0x0b, 0x01, 0x70, 0x10, "1 Coin 5 Credits" }, - {0x0b, 0x01, 0x70, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, - {0x0b, 0x01, 0x80, 0x80, "Off" }, - {0x0b, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x0a, 0x01, 0x03, 0x02, "Easy" }, - {0x0a, 0x01, 0x03, 0x03, "Normal" }, - {0x0a, 0x01, 0x03, 0x01, "Hard" }, - {0x0a, 0x01, 0x03, 0x00, "Hardest" }, - -// {0 , 0xfe, 0 , 2, "Game Mode" }, -// {0x0a, 0x01, 0x04, 0x04, "Single" }, -// {0x0a, 0x01, 0x04, 0x00, "Multiple" }, // ID CHECK ERROR - - {0 , 0xfe, 0 , 2, "Mode Select" }, - {0x0a, 0x01, 0x08, 0x00, "Off" }, - {0x0a, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0c, 0x01, 0x01, 0x01, "Off" }, - {0x0c, 0x01, 0x01, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x0c, 0x01, 0x02, 0x02, "Off" }, -// {0x0c, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0c, 0x01, 0x04, 0x04, "Off" }, - {0x0c, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Country" }, - {0x0d, 0x01, 0x01, 0x01, "World" }, - {0x0d, 0x01, 0x01, 0x00, "Japan" }, -}; - -STDDIPINFO(F1gp2) - -static inline void expand_dynamic_tiles(INT32 offset) -{ - UINT16 data = *((UINT16*)(DrvZoomRAM + offset)); - - offset <<= 1; - - DrvGfxROM3[offset + 0] = (data >> 12) & 0x0f; - DrvGfxROM3[offset + 1] = (data >> 8) & 0x0f; - DrvGfxROM3[offset + 2] = (data >> 4) & 0x0f; - DrvGfxROM3[offset + 3] = (data >> 0) & 0x0f; - - DrvBgTileDirty[offset >> 8] = 1; -} - -void __fastcall f1gp_main_write_word(UINT32 address, UINT16 data) -{ - if (((address & 0xfffffe0) == 0xfff040 && nScreenStartY == 8) || // f1gp - ((address & 0xffffff0) == 0xfff020 && nScreenStartY == 0)) { // f1gp2 - DrvBgCtrl[(address >> 1) & 0x0f] = data; - return; - } - - if ((address & 0xfc0000) == 0xc00000) { - UINT16 *p = (UINT16*)(DrvZoomRAM + (address & 0x3fffe)); - - if (p[0] == data) return; - - p[0] = data; - - expand_dynamic_tiles(address & 0x3fffe); - - return; - } - - if ((address & 0xff8000) == 0xd00000) { - UINT16 *p = (UINT16*)(DrvRozVidRAM + (address & 0x1ffe)); - - if (p[0] == data) return; - - p[0] = data; - - DrvBgDirty[(address >> 1) & 0xfff] = 1; - - return; - } - - switch (address) - { - case 0xfff002: // f1gp - case 0xfff003: - *DrvFgScrollX = data & 0x1ff; - return; - - case 0xfff004: - case 0xfff005: - *DrvFgScrollY = data & 0x0ff; - return; - - case 0xfff044: // f1gp2 - case 0xfff045: - *DrvFgScrollX = (data+80) & 0x1ff; - return; - - case 0xfff046: - case 0xfff047: - *DrvFgScrollY = (data+26) & 0x0ff; - return; - } -} - -void __fastcall f1gp_main_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xff8000) == 0xd00000) { - address = (address & 0x1fff) ^ 1; - - INT32 d = DrvRozVidRAM[address]; - - if (d == data) return; - - DrvRozVidRAM[address] = data; - DrvBgDirty[(address >> 1) & 0xfff] = 1; - - return; - } - - switch (address) - { - case 0xfff000: - if (*roz_bank != data) { - *roz_bank = data; - memset (DrvBgDirty, 1, 0x1000); - } - return; - - case 0xfff001: - *flipscreen = data & 0x20; - *gfxctrl = data & 0xdf; - return; - - case 0xfff009: - { - INT32 t = (SekTotalCycles() / 2) - ZetTotalCycles(); - if (t > 0) ZetRun(t); - *pending_command = 0xff; - *soundlatch = data; - ZetNmi(); - } - return; - } -} - -UINT16 __fastcall f1gp_main_read_word(UINT32 address) -{ - switch (address) - { - case 0xfff004: - return (DrvDips[1] << 8) | DrvDips[0]; - - case 0xfff006: - return (DrvDips[2] << 8); - } - - return 0; -} - -UINT8 __fastcall f1gp_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0xfff000: - case 0xfff001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0xfff004: - return DrvDips[0]; - - case 0xfff005: - return DrvDips[1]; - - case 0xfff006: - return DrvDips[2]; - - case 0xfff009: - return *pending_command; - - case 0xfff00b: - case 0xfff051: - return DrvDips[3]; - } - - return 0; -} - -static void sound_bankswitch(INT32 data) -{ - INT32 nBank = ((data & 1) << 15) + 0x8000; - - *DrvZ80Bank = data & 1; - - ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + nBank); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + nBank); -} - -void __fastcall f1gp_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - case 0x0c: - sound_bankswitch(data); - return; - - case 0x14: - *pending_command = 0; - return; - - case 0x18: - case 0x19: - case 0x1a: - case 0x1b: - BurnYM2610Write(port & 3, data); - return; - } -} - -UINT8 __fastcall f1gp_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x14: - return *soundlatch; - - case 0x18: - case 0x19: - case 0x1a: - case 0x1b: - return BurnYM2610Read(port & 3); - } - - return 0; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 5000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 5000000.0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - memset (DrvBgDirty, 1, 0x1000); - memset (DrvBgTileDirty, 1, 0x0800); - - SekOpen(0); - SekReset(); - SekClose(); - - SekOpen(1); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2610Reset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM0 = Next; Next += 0x500000; - Drv68KROM1 = Next; Next += 0x020000; - DrvZ80ROM = Next; Next += 0x020000; - - DrvGfxROM0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x400000; - DrvGfxROM2 = Next; Next += 0x200000; - DrvGfxROM3 = Next; Next += 0x800000; - - DrvSndROM = Next; Next += 0x200000; - - DrvPalette = (UINT32 *)Next; Next += 0x000401 * sizeof(UINT32); - - DrvBgDirty = Next; Next += 0x001000; - DrvBgTileDirty = Next; Next += 0x000800; - DrvBgTmp = (UINT16*)Next; Next += 0x100000 * sizeof(UINT16); - - AllRam = Next; - - Drv68KRAM0 = Next; Next += 0x004000; - Drv68KRAM1 = Next; Next += 0x004000; - DrvShareRAM = Next; Next += 0x001000; - DrvZoomRAM = Next; Next += 0x040000; - DrvPalRAM = Next; Next += 0x001000; - DrvRozVidRAM = Next; Next += 0x002000; - DrvVidRAM = Next; Next += 0x001000; - - DrvSprVRAM1 = Next; Next += 0x001000; - DrvSprVRAM2 = Next; Next += 0x000400; - - DrvSprCGRAM1 = Next; Next += 0x008000; - DrvSprCGRAM2 = Next; Next += 0x004000; - - DrvZ80RAM = Next; Next += 0x000800; - - pending_command = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - gfxctrl = Next; Next += 0x000001; - roz_bank = Next; Next += 0x000001; - - DrvZ80Bank = Next; Next += 0x000001; - - DrvFgScrollX = (UINT16*)Next; Next += 0x000001 * sizeof(UINT16); - DrvFgScrollY = (UINT16*)Next; Next += 0x000001 * sizeof(UINT16); - DrvBgCtrl = (UINT16*)Next; Next += 0x000010 * sizeof(UINT16); - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static void DrvInitZoomTable() -{ - zoom_table[0][0] = -1; - - for (INT32 x = 1; x < 32; x++) { - for (INT32 y = 0; y < 16; y++) { - float t = ((16.0000-1.0000) / x) * y; - zoom_table[x][y] = (t >= 16) ? -1 : (INT32)t; - } - } -} - -static void WordSwap(UINT8 *src, INT32 len) -{ - for (INT32 i = 0; i < len; i+=4) { - INT32 d = src[i+1]; - src[i+1] = src[i+2]; - src[i+2] = d; - } -} - -static INT32 F1gpGfxDecode() -{ - INT32 Plane[8] = { 0x000, 0x001, 0x002, 0x003 }; - INT32 XOffs[16] = { 0x004, 0x000, 0x00c, 0x008, 0x014, 0x010, 0x01c, 0x018, - 0x024, 0x020, 0x02c, 0x028, 0x034, 0x030, 0x03c, 0x038 }; - INT32 YOffs[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, - 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM1, 0x100000); - - GfxDecode(0x2000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x080000); - - GfxDecode(0x1000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); - - BurnFree (tmp); - - return 0; -} - -static INT32 F1gp2GfxDecode() -{ - INT32 Plane[8] = { 0x000, 0x001, 0x002, 0x003 }; - INT32 XOffs[16] = { 0x008, 0x00c, 0x000, 0x004, 0x018, 0x01c, 0x010, 0x014, - 0x028, 0x02c, 0x020, 0x024, 0x038, 0x03c, 0x030, 0x034 }; - INT32 YOffs[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, - 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x400000); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x200000; i++) { - tmp[i^1] = (DrvGfxROM1[i] << 4) | (DrvGfxROM1[i] >> 4); - } - - GfxDecode(0x4000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM3, 0x400000); - - GfxDecode(0x8000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM3); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit(INT32 nGame) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (nGame) { - nScreenStartY = 0; - - if (BurnLoadRom(Drv68KROM0 + 0x0000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0300000, 2, 1)) return 1; - memcpy (Drv68KROM0 + 0x100000, Drv68KROM0 + 0x400000, 0x100000); - memcpy (Drv68KROM0 + 0x200000, Drv68KROM0 + 0x300000, 0x100000); - - if (BurnLoadRom(Drv68KROM1, 3, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x100000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x200000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x300000, 10, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x0000000, 11, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x0100000, 12, 1)) return 1; - - F1gp2GfxDecode(); - } else { - if (BurnLoadRom(Drv68KROM0 + 0x0000000, 0, 1)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0100000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0100001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0180000, 3, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0180001, 4, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0200000, 5, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0200001, 6, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0280000, 7, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0280001, 8, 2)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0300000, 9, 1)) return 1; - if (BurnLoadRom(Drv68KROM0 + 0x0400000, 10, 1)) return 1; - - if (BurnLoadRom(Drv68KROM1, 11, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 12, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 14, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 15, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 16, 2)) return 1; - WordSwap(DrvGfxROM1, 0x100000); - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 17, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 18, 2)) return 1; - WordSwap(DrvGfxROM2, 0x080000); - - if (BurnLoadRom(DrvSndROM + 0x0000000, 19, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x0100000, 20, 1)) return 1; - - F1gpGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM0, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KROM0 + 0x100000, 0x100000, 0x2fffff, SM_ROM); - SekMapMemory(DrvRozVidRAM, 0xd00000, 0xd01fff, SM_ROM); - SekMapMemory(DrvRozVidRAM, 0xd02000, 0xd03fff, SM_ROM); - SekMapMemory(DrvRozVidRAM, 0xd04000, 0xd05fff, SM_ROM); - SekMapMemory(DrvRozVidRAM, 0xd06000, 0xd07fff, SM_ROM); - - if (nGame) { - SekMapMemory(DrvSprCGRAM1, 0xa00000, 0xa07fff, SM_RAM); - SekMapMemory(DrvSprVRAM1, 0xe00000, 0xe00fff, SM_RAM); - } else { - SekMapMemory(Drv68KROM0 + 0x300000, 0xa00000, 0xbfffff, SM_ROM); - SekMapMemory(DrvZoomRAM, 0xc00000, 0xc3ffff, SM_ROM); - SekMapMemory(DrvSprCGRAM1, 0xe00000, 0xe03fff, SM_RAM); - SekMapMemory(DrvSprCGRAM2, 0xe04000, 0xe07fff, SM_RAM); - SekMapMemory(DrvSprVRAM1, 0xf00000, 0xf003ff, SM_RAM); - SekMapMemory(DrvSprVRAM2, 0xf10000, 0xf103ff, SM_RAM); - } - - SekMapMemory(Drv68KRAM0, 0xff8000, 0xffbfff, SM_RAM); - SekMapMemory(DrvShareRAM, 0xffc000, 0xffcfff, SM_RAM); - SekMapMemory(DrvVidRAM, 0xffd000, 0xffdfff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xffe000, 0xffefff, SM_RAM); - SekSetWriteWordHandler(0, f1gp_main_write_word); - SekSetWriteByteHandler(0, f1gp_main_write_byte); - SekSetReadWordHandler(0, f1gp_main_read_word); - SekSetReadByteHandler(0, f1gp_main_read_byte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Drv68KROM1, 0x000000, 0x01ffff, SM_ROM); - SekMapMemory(Drv68KRAM1, 0xff8000, 0xffbfff, SM_RAM); - SekMapMemory(DrvShareRAM, 0xffc000, 0xffcfff, SM_RAM); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x77ff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x77ff, 2, DrvZ80ROM); - ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); - ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + 0x8000); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + 0x8000); - ZetSetOutHandler(f1gp_sound_out); - ZetSetInHandler(f1gp_sound_in); - ZetMemEnd(); - ZetClose(); - - INT32 DrvSndROMLen = 0x100000; - BurnYM2610Init(8000000, DrvSndROM + 0x100000, &DrvSndROMLen, DrvSndROM, &DrvSndROMLen, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(5000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - DrvInitZoomTable(); - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM2610Exit(); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - nScreenStartY = 8; - - return 0; -} - -static void draw_foreground(INT32 transp) -{ - transp *= 0xff; - - UINT16 *vram = (UINT16*)DrvVidRAM; - - for (INT32 offs = nScreenStartY; offs < 64 * 32; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = ((offs >> 6) << 3) - nScreenStartY; - - sx -= *DrvFgScrollX; - if (sx < -7) sx += 512; - sy -= *DrvFgScrollY; - if (sy < -7) sy += 256; - - INT32 code = vram[offs] & 0x7fff; - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 flipy = vram[offs] & 0x8000; - - if (transp) { - if (flipy) { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, 0, 8, transp, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, 0, 8, transp, 0, DrvGfxROM0); - } - } else { - if (flipy) { - Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM0); - } - } - } -} - -static void draw_16x16_zoom(UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 xz, INT32 yz, INT32 fx, INT32 fy) -{ - if (yz <= 1 || xz <= 1) return; - - if (yz == 16 && xz == 16) { - if (fy) { - if (fx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); - } - } else { - if (fx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); - } - } - - return; - } - - fx = (fx * 0x0f); - fy = (fy >> 1) * 0x0f; - - color = (color << 4); - UINT8 *src = gfx + (code << 8); - - INT16 *xm = zoom_table[xz-1]; - INT16 *ym = zoom_table[yz-1]; - - for (INT32 y = 0; y < 16; y++) - { - INT32 yy = sy + y; - - if (ym[y ^ fy] == -1 || yy < 0 || yy >= nScreenHeight) continue; - - INT32 yyz = (ym[y ^ fy] << 4); - - for (INT32 x = 0; x < 16; x++) - { - INT16 xxz = xm[x ^ fx]; - if (xxz == -1) continue; - - INT32 xx = sx + x; - - INT32 pxl = src[yyz|xxz]; - - if (pxl == 15 || xx < 0 || xx >= nScreenWidth || yy < 0 || yy >= nScreenHeight) continue; - - pTransDraw[(yy * nScreenWidth) + xx] = pxl | color; - } - } -} - -static void f1gp_draw_sprites(UINT8 *ram0, UINT8 *ram1, UINT8 *gfx, INT32 colo) -{ - INT32 attr_start,first; - UINT16 *spram = (UINT16*)ram0; - UINT16 *spram2 = (UINT16*)ram1; - - static const INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; - - first = 4 * spram[0x1fe]; - - for (attr_start = first; attr_start < 0x0200; attr_start += 4) - { - INT32 map_start; - INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color; - - if (!(spram[attr_start + 2] & 0x0080)) continue; - - oy = spram[attr_start + 0] & 0x01ff; - zoomy = (spram[attr_start + 0] & 0xf000) >> 12; - ox = spram[attr_start + 1] & 0x01ff; - zoomx = (spram[attr_start + 1] & 0xf000) >> 12; - xsize = (spram[attr_start + 2] & 0x0700) >> 8; - flipx = spram[attr_start + 2] & 0x0800; - ysize = (spram[attr_start + 2] & 0x7000) >> 12; - flipy = spram[attr_start + 2] & 0x8000; - color = (spram[attr_start + 2] & 0x000f) | colo; - map_start = spram[attr_start + 3]; - - zoomx = 16 - zoomtable[zoomx]/8; - zoomy = 16 - zoomtable[zoomy]/8; - - for (y = 0;y <= ysize;y++) - { - INT32 sx,sy; - - if (flipy) sy = ((oy + zoomy * (ysize - y) + 16) & 0x1ff) - 16; - else sy = ((oy + zoomy * y + 16) & 0x1ff) - 16; - - for (x = 0;x <= xsize;x++) - { - INT32 code; - - if (flipx) sx = ((ox + zoomx * (xsize - x) + 16) & 0x1ff) - 16; - else sx = ((ox + zoomx * x + 16) & 0x1ff) - 16; - - code = spram2[map_start & 0x1fff] & 0x1fff; - map_start++; - - draw_16x16_zoom(gfx, code, color, sx, sy-8, zoomx, zoomy, flipx, flipy); - } - - if (xsize == 2) map_start += 1; - if (xsize == 4) map_start += 3; - if (xsize == 5) map_start += 2; - if (xsize == 6) map_start += 1; - } - } -} - -static void f1gp2_draw_sprites() -{ - INT32 offs = 0; - UINT16 *spram = (UINT16*)DrvSprVRAM1; - UINT16 *spram2 = (UINT16*)DrvSprCGRAM1; - - while (offs < 0x0400 && (spram[offs] & 0x4000) == 0) - { - INT32 attr_start; - INT32 map_start; - INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color; - - attr_start = 4 * (spram[offs++] & 0x01ff); - - oy = spram[attr_start + 0] & 0x01ff; - ysize = (spram[attr_start + 0] & 0x0e00) >> 9; - zoomy = (spram[attr_start + 0] & 0xf000) >> 12; - ox = spram[attr_start + 1] & 0x01ff; - xsize = (spram[attr_start + 1] & 0x0e00) >> 9; - zoomx = (spram[attr_start + 1] & 0xf000) >> 12; - flipx = spram[attr_start + 2] & 0x4000; - flipy = spram[attr_start + 2] & 0x8000; - color = (spram[attr_start + 2] & 0x1f00) >> 8; - map_start = spram[attr_start + 3] & 0x7fff; - - zoomx = 32 - zoomx; - zoomy = 32 - zoomy; - - if (spram[attr_start + 2] & 0x20ff) color = GetCurrentFrame() & 0x0f; // good enough? - - for (y = 0;y <= ysize;y++) - { - INT32 sx,sy; - - if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16; - else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16; - - for (x = 0;x <= xsize;x++) - { - INT32 code; - - if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16; - else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16; - - code = spram2[map_start & 0x3fff] & 0x3fff; - map_start++; - - if (*flipscreen) { - flipx = !flipx; - flipy = !flipy; - sx = 304-sx; - sy = 208-sy; - } - - draw_16x16_zoom(DrvGfxROM1, code, color | 0x20, sx, sy, 16, 16, flipx, flipy); - } - } - } -} - -static void predraw_roz_tile(INT32 offset) -{ - UINT16 data = *((UINT16*)(DrvRozVidRAM + offset)); - - offset >>= 1; - - INT32 sx = (offset & 0x3f) << 4; - INT32 sy = (offset >> 6) << 4; - - UINT16 *dst = DrvBgTmp + (sy * 1024) + sx; - - INT32 code = (data & 0x7ff) | (*roz_bank << 11); - INT32 color = ((data >> 12) << 4) | ((nScreenStartY) ? 0x300 : 0x100); - UINT8 *src = DrvGfxROM3 + (code << 8); - - for (INT32 y = 0; y < 16; y++) { - for (INT32 x = 0; x < 16; x++) { - dst[x] = src[x] | color; - if (src[x] == 0x0f) dst[x] |= 0x8000; - } - dst += 1024; - src += 16; - } -} - -static void predraw_background() -{ - UINT16 *ptr = (UINT16*)DrvRozVidRAM; - for (INT32 i = 0; i < 0x2000; i+=2, ptr++) { - if (DrvBgDirty[i/2] || DrvBgTileDirty[*ptr & 0x7ff]) { - predraw_roz_tile(i); - DrvBgDirty[i/2] = 0; - } - } - - memset (DrvBgTileDirty, 0, 0x800); -} - -static inline void copy_roz(UINT32 startx, UINT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, INT32 transp) -{ - UINT16 *dst = pTransDraw; - UINT16 *src = DrvBgTmp; - - for (INT32 sy = 0; sy < nScreenHeight; sy++, startx+=incyx, starty+=incyy) - { - UINT32 cx = startx; - UINT32 cy = starty; - - if (transp) { - for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++) - { - INT32 pxl = src[(((cy >> 16) & 0x3ff) << 10) + ((cx >> 16) & 0x3ff)]; - - if (!(pxl & 0x8000)) { - *dst = pxl; - } - } - } else { - for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++) { - *dst = src[(((cy >> 16) & 0x3ff) << 10) + ((cx >> 16) & 0x3ff)] & 0x3ff; - } - } - } -} - -static void draw_background(INT32 transp) -{ - UINT16 *ctrl = DrvBgCtrl; - - UINT32 startx,starty; - INT32 incxx,incxy,incyx,incyy; - - startx = 256 * (INT16)(ctrl[0x00]); - starty = 256 * (INT16)(ctrl[0x01]); - incyx = (INT16)(ctrl[0x02]); - incyy = (INT16)(ctrl[0x03]); - incxx = (INT16)(ctrl[0x04]); - incxy = (INT16)(ctrl[0x05]); - - if (ctrl[0x06] & 0x4000) { incyx *= 256; incyy *= 256; } - if (ctrl[0x06] & 0x0040) { incxx *= 256; incxy *= 256; } - - if (nScreenStartY) { - startx -= -10 * incyx; - starty -= -10 * incyy; - startx -= -58 * incxx; - starty -= -58 * incxy; - } else { - startx -= -21 * incyx; - starty -= -21 * incyy; - startx -= -48 * incxx; - starty -= -48 * incxy; - } - - copy_roz(startx << 5, starty << 5, incxx << 5, incxy << 5, incyx << 5, incyy << 5, transp); -} - -static void recalculate_palette() -{ - if (DrvRecalc) { - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x400; i++) { - r = (p[i] >> 10) & 0x1f; - g = (p[i] >> 5) & 0x1f; - b = (p[i] >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } - DrvPalette[0x400] = 0; - } -} - -static INT32 F1gpDraw() -{ - recalculate_palette(); - predraw_background(); - draw_background(0); - - if (*gfxctrl == 0x00) { - if (nBurnLayer & 2) f1gp_draw_sprites(DrvSprVRAM2, DrvSprCGRAM2, DrvGfxROM2, 0x20); - if (nBurnLayer & 1) f1gp_draw_sprites(DrvSprVRAM1, DrvSprCGRAM1, DrvGfxROM1, 0x10); - if (nBurnLayer & 4) draw_foreground(1); - } else { - if (nBurnLayer & 2) f1gp_draw_sprites(DrvSprVRAM2, DrvSprCGRAM2, DrvGfxROM2, 0x20); - if (nBurnLayer & 4) draw_foreground(1); - if (nBurnLayer & 1) f1gp_draw_sprites(DrvSprVRAM1, DrvSprCGRAM1, DrvGfxROM1, 0x10); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 F1gp2Draw() -{ - recalculate_palette(); - predraw_background(); - - if (!(*gfxctrl & 4)) { - switch (*gfxctrl & 3) - { - case 0: - if (nBurnLayer & 1) draw_background(0); - if (nBurnLayer & 4) f1gp2_draw_sprites(); - if (nBurnLayer & 2) draw_foreground(1); - break; - - case 1: - if (nBurnLayer & 1) draw_background(0); - if (nBurnLayer & 2) draw_foreground(1); - if (nBurnLayer & 4) f1gp2_draw_sprites(); - break; - - case 2: - if (nBurnLayer & 2) draw_foreground(0); - if (nBurnLayer & 1) draw_background(1); - if (nBurnLayer & 4) f1gp2_draw_sprites(); - break; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 F1gpbDraw() -{ - recalculate_palette(); - BurnTransferClear(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - SekNewFrame(); - ZetNewFrame(); - - { - DrvInputs[0] = 0xffff; - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - } - - } - - INT32 nInterleave = 100; - INT32 nCyclesTotal[3] = { 10000000 / 60, 10000000 / 60, 5000000 / 60 }; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCycleSegment = ((nCyclesTotal[0] / nInterleave) * (i+1)) - nCyclesDone[0]; - - SekOpen(0); - nCyclesDone[0] += SekRun(nCycleSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - SekClose(); - - SekOpen(1); - nCyclesDone[1] += SekRun(nCycleSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - SekClose(); - } - - BurnTimerEndFrame(nCyclesTotal[2]); - - if (pBurnSoundOut) { - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029702; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2610Scan(nAction, pnMin); - } - - if (nAction & ACB_WRITE) { - if (nScreenStartY) { - for (INT32 i = 0; i < 0x40000; i+=2) { - expand_dynamic_tiles(i); - } - } - - ZetOpen(0); - sound_bankswitch(*DrvZ80Bank); - ZetClose(); - } - - return 0; -} - - -// F-1 Grand Prix - -static struct BurnRomInfo f1gpRomDesc[] = { - { "rom1-a.3", 0x020000, 0x2d8f785b, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "rom11-a.2", 0x040000, 0x53df8ea1, 1 | BRF_PRG | BRF_ESS }, // 1 - { "rom10-a.1", 0x040000, 0x46a289fb, 1 | BRF_PRG | BRF_ESS }, // 2 - { "rom13-a.4", 0x040000, 0x7d92e1fa, 1 | BRF_PRG | BRF_ESS }, // 3 - { "rom12-a.3", 0x040000, 0xd8c1bcf4, 1 | BRF_PRG | BRF_ESS }, // 4 - { "rom6-a.6", 0x040000, 0x6d947a3f, 1 | BRF_PRG | BRF_ESS }, // 5 - { "rom7-a.5", 0x040000, 0x7a014ba6, 1 | BRF_PRG | BRF_ESS }, // 6 - { "rom9-a.8", 0x040000, 0x49286572, 1 | BRF_PRG | BRF_ESS }, // 7 - { "rom8-a.7", 0x040000, 0x0ed783c7, 1 | BRF_PRG | BRF_ESS }, // 8 - { "rom2-a.06", 0x100000, 0x747dd112, 1 | BRF_PRG | BRF_ESS }, // 9 - { "rom3-a.05", 0x100000, 0x264aed13, 1 | BRF_PRG | BRF_ESS }, // 10 - - { "rom4-a.4", 0x020000, 0x8e811d36, 2 | BRF_PRG | BRF_ESS }, // 11 68K #1 Code - - { "rom5-a.8", 0x020000, 0x9ea36e35, 3 | BRF_PRG | BRF_ESS }, // 12 Z80 Code - - { "rom3-b.07", 0x100000, 0xffb1d489, 4 | BRF_GRA }, // 13 Character Tiles - { "rom2-b.04", 0x100000, 0xd1b3471f, 4 | BRF_GRA }, // 14 - - { "rom5-b.2", 0x080000, 0x17572b36, 5 | BRF_GRA }, // 15 Sprite Bank 0 - { "rom4-b.3", 0x080000, 0x72d12129, 5 | BRF_GRA }, // 16 - - { "rom7-b.17", 0x040000, 0x2aed9003, 6 | BRF_GRA }, // 17 Sprite Bank 1 - { "rom6-b.16", 0x040000, 0x6789ef12, 6 | BRF_GRA }, // 18 - - { "rom14-a.09", 0x100000, 0xb4c1ac31, 7 | BRF_SND }, // 19 YM2610 Samples - { "rom17-a.08", 0x100000, 0xea70303d, 7 | BRF_SND }, // 20 -}; - -STD_ROM_PICK(f1gp) -STD_ROM_FN(f1gp) - -static INT32 F1gpInit() -{ - return DrvInit(0); -} - -struct BurnDriver BurnDrvF1gp = { - "f1gp", NULL, NULL, NULL, "1991", - "F-1 Grand Prix\0", NULL, "Video System Co.", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 1, HARDWARE_MISC_POST90S, GBF_RACING, 0, - NULL, f1gpRomInfo, f1gpRomName, NULL, NULL, F1gpInputInfo, F1gpDIPInfo, - F1gpInit, DrvExit, DrvFrame, F1gpDraw, DrvScan, &DrvRecalc, 0x401, - 240, 320, 3, 4 -}; - - -// F-1 Grand Prix (Playmark bootleg) - -static struct BurnRomInfo f1gpbRomDesc[] = { - { "1.ic38", 0x020000, 0x046dd83a, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 code - { "7.ic39", 0x020000, 0x960f5db4, 1 | BRF_PRG | BRF_ESS }, // 1 - { "2.ic48", 0x080000, 0xb3b315c3, 1 | BRF_PRG | BRF_ESS }, // 2 - { "8.ic41", 0x080000, 0x39af8180, 1 | BRF_PRG | BRF_ESS }, // 3 - { "3.ic165", 0x080000, 0xb7295a30, 1 | BRF_PRG | BRF_ESS }, // 4 - { "9.ic166", 0x080000, 0xbb596d5b, 1 | BRF_PRG | BRF_ESS }, // 5 - { "4.ic42", 0x080000, 0x5dbde98a, 1 | BRF_PRG | BRF_ESS }, // 6 - { "10.ic43", 0x080000, 0xd60e7706, 1 | BRF_PRG | BRF_ESS }, // 7 - { "5.ic167", 0x080000, 0x48c36293, 1 | BRF_PRG | BRF_ESS }, // 8 - { "11.ic168", 0x080000, 0x92a28e52, 1 | BRF_PRG | BRF_ESS }, // 9 - - { "16.u7", 0x010000, 0x7609d818, 2 | BRF_PRG | BRF_ESS }, // 10 68K #1 Code - { "17.u6", 0x010000, 0x951befde, 2 | BRF_PRG | BRF_ESS }, // 11 - - { "13.ic151", 0x080000, 0x4238074b, 3 | BRF_GRA }, // 12 Character Tiles - { "12.ic152", 0x080000, 0xe97c2b6e, 3 | BRF_GRA }, // 13 - { "15.ic153", 0x080000, 0xc2867d7f, 3 | BRF_GRA }, // 14 - { "14.ic154", 0x080000, 0x0cd20423, 3 | BRF_GRA }, // 15 - - { "rom21", 0x080000, 0x7a08c3b7, 4 | BRF_GRA }, // 16 Sprite Banks - { "rom20", 0x080000, 0xbd1273d0, 4 | BRF_GRA }, // 17 - { "19.ic141", 0x080000, 0xaa4ebdfe, 4 | BRF_GRA }, // 18 - { "18.ic140", 0x080000, 0x9b2a4325, 4 | BRF_GRA }, // 19 - - { "6.ic13", 0x080000, 0x6e83ffd8, 5 | BRF_SND }, // 20 OKI MSM6295 Samples -}; - -STD_ROM_PICK(f1gpb) -STD_ROM_FN(f1gpb) - -static INT32 F1gpbInit() -{ - return 1; -} - -struct BurnDriverD BurnDrvF1gpb = { - "f1gpb", "f1gp", NULL, NULL, "1991", - "F-1 Grand Prix (Playmark bootleg)\0", NULL, "[Video System Co.] (Playmark bootleg)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 1, HARDWARE_MISC_POST90S, GBF_RACING, 0, - NULL, f1gpbRomInfo, f1gpbRomName, NULL, NULL, F1gpInputInfo, F1gpDIPInfo, - F1gpbInit, DrvExit, DrvFrame, F1gpbDraw, DrvScan, &DrvRecalc, 0x401, - 240, 320, 3, 4 -}; - - -// F-1 Grand Prix Part II - -static struct BurnRomInfo f1gp2RomDesc[] = { - { "rom12.v1", 0x020000, 0xc5c5f199, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code - { "rom14.v2", 0x020000, 0xdd5388e2, 1 | BRF_PRG | BRF_ESS }, // 1 - { "rom2", 0x200000, 0x3b0cfa82, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "rom13.v3", 0x020000, 0xc37aa303, 2 | BRF_PRG | BRF_ESS }, // 3 68K #1 Code - - { "rom5.v4", 0x020000, 0x6a9398a1, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "rom1", 0x200000, 0xf2d55ad7, 4 | BRF_GRA }, // 5 Character Tiles - - { "rom15", 0x200000, 0x1ac03e2e, 5 | BRF_GRA }, // 6 Sprites - - { "rom11", 0x100000, 0xb22a2c1f, 6 | BRF_GRA }, // 7 Background Tiles - { "rom10", 0x100000, 0x43fcbe23, 6 | BRF_GRA }, // 8 - { "rom9", 0x100000, 0x1bede8a1, 6 | BRF_GRA }, // 9 - { "rom8", 0x100000, 0x98baf2a1, 6 | BRF_GRA }, // 10 - - { "rom4", 0x080000, 0xc2d3d7ad, 7 | BRF_SND }, // 11 YM2610 Samples - { "rom3", 0x100000, 0x7f8f066f, 7 | BRF_SND }, // 12 -}; - -STD_ROM_PICK(f1gp2) -STD_ROM_FN(f1gp2) - -static INT32 F1gp2Init() -{ - return DrvInit(1); -} - -struct BurnDriver BurnDrvF1gp2 = { - "f1gp2", NULL, NULL, NULL, "1992", - "F-1 Grand Prix Part II\0", NULL, "Video System Co.", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 1, HARDWARE_MISC_POST90S, GBF_RACING, 0, - NULL, f1gp2RomInfo, f1gp2RomName, NULL, NULL, F1gp2InputInfo, F1gp2DIPInfo, - F1gp2Init, DrvExit, DrvFrame, F1gp2Draw, DrvScan, &DrvRecalc, 0x401, - 224, 320, 3, 4 -}; - +// FB Alpha F-1 Grand Prix driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2610.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM0; +static UINT8 *Drv68KROM1; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM0; +static UINT8 *Drv68KRAM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZoomRAM; +static UINT8 *DrvRozVidRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvShareRAM; +static UINT8 *DrvSprVRAM1; +static UINT8 *DrvSprVRAM2; +static UINT8 *DrvSprCGRAM1; +static UINT8 *DrvSprCGRAM2; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvBgDirty; +static UINT8 *DrvBgTileDirty; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT16 *DrvBgTmp; + +static UINT8 *soundlatch; +static UINT8 *flipscreen; +static UINT8 *gfxctrl; +static UINT8 *pending_command; +static UINT8 *roz_bank; +static UINT8 *DrvZ80Bank; +static UINT16 *DrvFgScrollX; +static UINT16 *DrvFgScrollY; +static UINT16 *DrvBgCtrl; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvDips[4]; +static UINT16 DrvInputs[3]; +static UINT8 DrvReset; + +static INT16 zoom_table[32][33]; + +static INT32 nScreenStartY = 8; + +static struct BurnInputInfo F1gpInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 9, "p2 coin" }, + {"Start", BIT_DIGITAL, DrvJoy1 + 10, "p1 start" }, + {"Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, + {"Button 2", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 14, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, + {"Region", BIT_DIPSWITCH, DrvDips + 3, "dip" }, +}; + +STDINPUTINFO(F1gp) + +static struct BurnInputInfo F1gp2InputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 9, "p2 coin" }, + {"Start", BIT_DIGITAL, DrvJoy1 + 10, "p1 start" }, + {"Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, + {"Button 2", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 2" }, + {"Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 14, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, + {"Region", BIT_DIPSWITCH, DrvDips + 3, "dip" }, +}; + +STDINPUTINFO(F1gp2) + +static struct BurnDIPInfo F1gpDIPList[]= +{ + {0x09, 0xff, 0xff, 0xff, NULL }, + {0x0a, 0xff, 0xff, 0xff, NULL }, + {0x0b, 0xff, 0xff, 0xfb, NULL }, + {0x0c, 0xff, 0xff, 0x10, NULL }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x0a, 0x01, 0x01, 0x01, "Off" }, + {0x0a, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x0a, 0x01, 0x0e, 0x0a, "3 Coins 1 Credit" }, + {0x0a, 0x01, 0x0e, 0x0c, "2 Coins 1 Credit" }, + {0x0a, 0x01, 0x0e, 0x0e, "1 Coin 1 Credit" }, + {0x0a, 0x01, 0x0e, 0x08, "1 Coin 2 Credits" }, + {0x0a, 0x01, 0x0e, 0x06, "1 Coin 3 Credits" }, + {0x0a, 0x01, 0x0e, 0x04, "1 Coin 4 Credits" }, + {0x0a, 0x01, 0x0e, 0x02, "1 Coin 5 Credits" }, + {0x0a, 0x01, 0x0e, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x0a, 0x01, 0x70, 0x50, "3 Coins 1 Credit" }, + {0x0a, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x0a, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x0a, 0x01, 0x70, 0x40, "1 Coin 2 Credits" }, + {0x0a, 0x01, 0x70, 0x30, "1 Coin 3 Credits" }, + {0x0a, 0x01, 0x70, 0x20, "1 Coin 4 Credits" }, + {0x0a, 0x01, 0x70, 0x10, "1 Coin 5 Credits" }, + {0x0a, 0x01, 0x70, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, + {0x0a, 0x01, 0x80, 0x80, "Off" }, + {0x0a, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x09, 0x01, 0x03, 0x02, "Easy" }, + {0x09, 0x01, 0x03, 0x03, "Normal" }, + {0x09, 0x01, 0x03, 0x01, "Hard" }, + {0x09, 0x01, 0x03, 0x00, "Hardest" }, + +// {0 , 0xfe, 0 , 2, "Game Mode" }, +// {0x09, 0x01, 0x04, 0x04, "Single" }, +// {0x09, 0x01, 0x04, 0x00, "Multiple" }, // ID CHECK ERROR + + {0 , 0xfe, 0 , 2, "Mode Select" }, + {0x09, 0x01, 0x08, 0x00, "Off" }, + {0x09, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0b, 0x01, 0x01, 0x01, "Off" }, + {0x0b, 0x01, 0x01, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x0b, 0x01, 0x02, 0x02, "Off" }, +// {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 6, "Country" }, + {0x0c, 0x01, 0x1f, 0x10, "World" }, + {0x0c, 0x01, 0x1f, 0x01, "USA & Canada"}, + {0x0c, 0x01, 0x1f, 0x00, "Japan" }, + {0x0c, 0x01, 0x1f, 0x02, "Korea" }, + {0x0c, 0x01, 0x1f, 0x04, "Hong Kong" }, + {0x0c, 0x01, 0x1f, 0x08, "Taiwan" }, +}; + +STDDIPINFO(F1gp) + +static struct BurnDIPInfo F1gp2DIPList[]= +{ + {0x0a, 0xff, 0xff, 0xff, NULL }, + {0x0b, 0xff, 0xff, 0xff, NULL }, + {0x0c, 0xff, 0xff, 0xfb, NULL }, + {0x0d, 0xff, 0xff, 0x01, NULL }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x0b, 0x01, 0x01, 0x01, "Off" }, + {0x0b, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x0b, 0x01, 0x0e, 0x0a, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0x0e, 0x0c, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x0e, 0x0e, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x0e, 0x08, "1 Coin 2 Credits" }, + {0x0b, 0x01, 0x0e, 0x06, "1 Coin 3 Credits" }, + {0x0b, 0x01, 0x0e, 0x04, "1 Coin 4 Credits" }, + {0x0b, 0x01, 0x0e, 0x02, "1 Coin 5 Credits" }, + {0x0b, 0x01, 0x0e, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x0b, 0x01, 0x70, 0x50, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x70, 0x40, "1 Coin 2 Credits" }, + {0x0b, 0x01, 0x70, 0x30, "1 Coin 3 Credits" }, + {0x0b, 0x01, 0x70, 0x20, "1 Coin 4 Credits" }, + {0x0b, 0x01, 0x70, 0x10, "1 Coin 5 Credits" }, + {0x0b, 0x01, 0x70, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, + {0x0b, 0x01, 0x80, 0x80, "Off" }, + {0x0b, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x0a, 0x01, 0x03, 0x02, "Easy" }, + {0x0a, 0x01, 0x03, 0x03, "Normal" }, + {0x0a, 0x01, 0x03, 0x01, "Hard" }, + {0x0a, 0x01, 0x03, 0x00, "Hardest" }, + +// {0 , 0xfe, 0 , 2, "Game Mode" }, +// {0x0a, 0x01, 0x04, 0x04, "Single" }, +// {0x0a, 0x01, 0x04, 0x00, "Multiple" }, // ID CHECK ERROR + + {0 , 0xfe, 0 , 2, "Mode Select" }, + {0x0a, 0x01, 0x08, 0x00, "Off" }, + {0x0a, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0c, 0x01, 0x01, 0x01, "Off" }, + {0x0c, 0x01, 0x01, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x0c, 0x01, 0x02, 0x02, "Off" }, +// {0x0c, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0c, 0x01, 0x04, 0x04, "Off" }, + {0x0c, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Country" }, + {0x0d, 0x01, 0x01, 0x01, "World" }, + {0x0d, 0x01, 0x01, 0x00, "Japan" }, +}; + +STDDIPINFO(F1gp2) + +static inline void expand_dynamic_tiles(INT32 offset) +{ + UINT16 data = *((UINT16*)(DrvZoomRAM + offset)); + + offset <<= 1; + + DrvGfxROM3[offset + 0] = (data >> 12) & 0x0f; + DrvGfxROM3[offset + 1] = (data >> 8) & 0x0f; + DrvGfxROM3[offset + 2] = (data >> 4) & 0x0f; + DrvGfxROM3[offset + 3] = (data >> 0) & 0x0f; + + DrvBgTileDirty[offset >> 8] = 1; +} + +void __fastcall f1gp_main_write_word(UINT32 address, UINT16 data) +{ + if (((address & 0xfffffe0) == 0xfff040 && nScreenStartY == 8) || // f1gp + ((address & 0xffffff0) == 0xfff020 && nScreenStartY == 0)) { // f1gp2 + DrvBgCtrl[(address >> 1) & 0x0f] = data; + return; + } + + if ((address & 0xfc0000) == 0xc00000) { + UINT16 *p = (UINT16*)(DrvZoomRAM + (address & 0x3fffe)); + + if (p[0] == data) return; + + p[0] = data; + + expand_dynamic_tiles(address & 0x3fffe); + + return; + } + + if ((address & 0xff8000) == 0xd00000) { + UINT16 *p = (UINT16*)(DrvRozVidRAM + (address & 0x1ffe)); + + if (p[0] == data) return; + + p[0] = data; + + DrvBgDirty[(address >> 1) & 0xfff] = 1; + + return; + } + + switch (address) + { + case 0xfff002: // f1gp + case 0xfff003: + *DrvFgScrollX = data & 0x1ff; + return; + + case 0xfff004: + case 0xfff005: + *DrvFgScrollY = data & 0x0ff; + return; + + case 0xfff044: // f1gp2 + case 0xfff045: + *DrvFgScrollX = (data+80) & 0x1ff; + return; + + case 0xfff046: + case 0xfff047: + *DrvFgScrollY = (data+26) & 0x0ff; + return; + } +} + +void __fastcall f1gp_main_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xff8000) == 0xd00000) { + address = (address & 0x1fff) ^ 1; + + INT32 d = DrvRozVidRAM[address]; + + if (d == data) return; + + DrvRozVidRAM[address] = data; + DrvBgDirty[(address >> 1) & 0xfff] = 1; + + return; + } + + switch (address) + { + case 0xfff000: + if (*roz_bank != data) { + *roz_bank = data; + memset (DrvBgDirty, 1, 0x1000); + } + return; + + case 0xfff001: + *flipscreen = data & 0x20; + *gfxctrl = data & 0xdf; + return; + + case 0xfff009: + { + INT32 t = (SekTotalCycles() / 2) - ZetTotalCycles(); + if (t > 0) ZetRun(t); + *pending_command = 0xff; + *soundlatch = data; + ZetNmi(); + } + return; + } +} + +UINT16 __fastcall f1gp_main_read_word(UINT32 address) +{ + switch (address) + { + case 0xfff004: + return (DrvDips[1] << 8) | DrvDips[0]; + + case 0xfff006: + return (DrvDips[2] << 8); + } + + return 0; +} + +UINT8 __fastcall f1gp_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0xfff000: + case 0xfff001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0xfff004: + return DrvDips[0]; + + case 0xfff005: + return DrvDips[1]; + + case 0xfff006: + return DrvDips[2]; + + case 0xfff009: + return *pending_command; + + case 0xfff00b: + case 0xfff051: + return DrvDips[3]; + } + + return 0; +} + +static void sound_bankswitch(INT32 data) +{ + INT32 nBank = ((data & 1) << 15) + 0x8000; + + *DrvZ80Bank = data & 1; + + ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + nBank); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + nBank); +} + +void __fastcall f1gp_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + case 0x0c: + sound_bankswitch(data); + return; + + case 0x14: + *pending_command = 0; + return; + + case 0x18: + case 0x19: + case 0x1a: + case 0x1b: + BurnYM2610Write(port & 3, data); + return; + } +} + +UINT8 __fastcall f1gp_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x14: + return *soundlatch; + + case 0x18: + case 0x19: + case 0x1a: + case 0x1b: + return BurnYM2610Read(port & 3); + } + + return 0; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 5000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 5000000.0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + memset (DrvBgDirty, 1, 0x1000); + memset (DrvBgTileDirty, 1, 0x0800); + + SekOpen(0); + SekReset(); + SekClose(); + + SekOpen(1); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2610Reset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM0 = Next; Next += 0x500000; + Drv68KROM1 = Next; Next += 0x020000; + DrvZ80ROM = Next; Next += 0x020000; + + DrvGfxROM0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x400000; + DrvGfxROM2 = Next; Next += 0x200000; + DrvGfxROM3 = Next; Next += 0x800000; + + DrvSndROM = Next; Next += 0x200000; + + DrvPalette = (UINT32 *)Next; Next += 0x000401 * sizeof(UINT32); + + DrvBgDirty = Next; Next += 0x001000; + DrvBgTileDirty = Next; Next += 0x000800; + DrvBgTmp = (UINT16*)Next; Next += 0x100000 * sizeof(UINT16); + + AllRam = Next; + + Drv68KRAM0 = Next; Next += 0x004000; + Drv68KRAM1 = Next; Next += 0x004000; + DrvShareRAM = Next; Next += 0x001000; + DrvZoomRAM = Next; Next += 0x040000; + DrvPalRAM = Next; Next += 0x001000; + DrvRozVidRAM = Next; Next += 0x002000; + DrvVidRAM = Next; Next += 0x001000; + + DrvSprVRAM1 = Next; Next += 0x001000; + DrvSprVRAM2 = Next; Next += 0x000400; + + DrvSprCGRAM1 = Next; Next += 0x008000; + DrvSprCGRAM2 = Next; Next += 0x004000; + + DrvZ80RAM = Next; Next += 0x000800; + + pending_command = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + gfxctrl = Next; Next += 0x000001; + roz_bank = Next; Next += 0x000001; + + DrvZ80Bank = Next; Next += 0x000001; + + DrvFgScrollX = (UINT16*)Next; Next += 0x000001 * sizeof(UINT16); + DrvFgScrollY = (UINT16*)Next; Next += 0x000001 * sizeof(UINT16); + DrvBgCtrl = (UINT16*)Next; Next += 0x000010 * sizeof(UINT16); + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static void DrvInitZoomTable() +{ + zoom_table[0][0] = -1; + + for (INT32 x = 1; x < 32; x++) { + for (INT32 y = 0; y < 16; y++) { + float t = ((16.0000-1.0000) / x) * y; + zoom_table[x][y] = (t >= 16) ? -1 : (INT32)t; + } + } +} + +static void WordSwap(UINT8 *src, INT32 len) +{ + for (INT32 i = 0; i < len; i+=4) { + INT32 d = src[i+1]; + src[i+1] = src[i+2]; + src[i+2] = d; + } +} + +static INT32 F1gpGfxDecode() +{ + INT32 Plane[8] = { 0x000, 0x001, 0x002, 0x003 }; + INT32 XOffs[16] = { 0x004, 0x000, 0x00c, 0x008, 0x014, 0x010, 0x01c, 0x018, + 0x024, 0x020, 0x02c, 0x028, 0x034, 0x030, 0x03c, 0x038 }; + INT32 YOffs[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM1, 0x100000); + + GfxDecode(0x2000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x080000); + + GfxDecode(0x1000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); + + BurnFree (tmp); + + return 0; +} + +static INT32 F1gp2GfxDecode() +{ + INT32 Plane[8] = { 0x000, 0x001, 0x002, 0x003 }; + INT32 XOffs[16] = { 0x008, 0x00c, 0x000, 0x004, 0x018, 0x01c, 0x010, 0x014, + 0x028, 0x02c, 0x020, 0x024, 0x038, 0x03c, 0x030, 0x034 }; + INT32 YOffs[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x400000); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x200000; i++) { + tmp[i^1] = (DrvGfxROM1[i] << 4) | (DrvGfxROM1[i] >> 4); + } + + GfxDecode(0x4000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM3, 0x400000); + + GfxDecode(0x8000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM3); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit(INT32 nGame) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (nGame) { + nScreenStartY = 0; + + if (BurnLoadRom(Drv68KROM0 + 0x0000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0300000, 2, 1)) return 1; + memcpy (Drv68KROM0 + 0x100000, Drv68KROM0 + 0x400000, 0x100000); + memcpy (Drv68KROM0 + 0x200000, Drv68KROM0 + 0x300000, 0x100000); + + if (BurnLoadRom(Drv68KROM1, 3, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x100000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x200000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x300000, 10, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x0000000, 11, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x0100000, 12, 1)) return 1; + + F1gp2GfxDecode(); + } else { + if (BurnLoadRom(Drv68KROM0 + 0x0000000, 0, 1)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0100000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0100001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0180000, 3, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0180001, 4, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0200000, 5, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0200001, 6, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0280000, 7, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0280001, 8, 2)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0300000, 9, 1)) return 1; + if (BurnLoadRom(Drv68KROM0 + 0x0400000, 10, 1)) return 1; + + if (BurnLoadRom(Drv68KROM1, 11, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 12, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 14, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 15, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 16, 2)) return 1; + WordSwap(DrvGfxROM1, 0x100000); + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 17, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 18, 2)) return 1; + WordSwap(DrvGfxROM2, 0x080000); + + if (BurnLoadRom(DrvSndROM + 0x0000000, 19, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x0100000, 20, 1)) return 1; + + F1gpGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM0, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KROM0 + 0x100000, 0x100000, 0x2fffff, SM_ROM); + SekMapMemory(DrvRozVidRAM, 0xd00000, 0xd01fff, SM_ROM); + SekMapMemory(DrvRozVidRAM, 0xd02000, 0xd03fff, SM_ROM); + SekMapMemory(DrvRozVidRAM, 0xd04000, 0xd05fff, SM_ROM); + SekMapMemory(DrvRozVidRAM, 0xd06000, 0xd07fff, SM_ROM); + + if (nGame) { + SekMapMemory(DrvSprCGRAM1, 0xa00000, 0xa07fff, SM_RAM); + SekMapMemory(DrvSprVRAM1, 0xe00000, 0xe00fff, SM_RAM); + } else { + SekMapMemory(Drv68KROM0 + 0x300000, 0xa00000, 0xbfffff, SM_ROM); + SekMapMemory(DrvZoomRAM, 0xc00000, 0xc3ffff, SM_ROM); + SekMapMemory(DrvSprCGRAM1, 0xe00000, 0xe03fff, SM_RAM); + SekMapMemory(DrvSprCGRAM2, 0xe04000, 0xe07fff, SM_RAM); + SekMapMemory(DrvSprVRAM1, 0xf00000, 0xf003ff, SM_RAM); + SekMapMemory(DrvSprVRAM2, 0xf10000, 0xf103ff, SM_RAM); + } + + SekMapMemory(Drv68KRAM0, 0xff8000, 0xffbfff, SM_RAM); + SekMapMemory(DrvShareRAM, 0xffc000, 0xffcfff, SM_RAM); + SekMapMemory(DrvVidRAM, 0xffd000, 0xffdfff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xffe000, 0xffefff, SM_RAM); + SekSetWriteWordHandler(0, f1gp_main_write_word); + SekSetWriteByteHandler(0, f1gp_main_write_byte); + SekSetReadWordHandler(0, f1gp_main_read_word); + SekSetReadByteHandler(0, f1gp_main_read_byte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Drv68KROM1, 0x000000, 0x01ffff, SM_ROM); + SekMapMemory(Drv68KRAM1, 0xff8000, 0xffbfff, SM_RAM); + SekMapMemory(DrvShareRAM, 0xffc000, 0xffcfff, SM_RAM); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x77ff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x77ff, 2, DrvZ80ROM); + ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); + ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + 0x8000); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + 0x8000); + ZetSetOutHandler(f1gp_sound_out); + ZetSetInHandler(f1gp_sound_in); + ZetClose(); + + INT32 DrvSndROMLen = 0x100000; + BurnYM2610Init(8000000, DrvSndROM + 0x100000, &DrvSndROMLen, DrvSndROM, &DrvSndROMLen, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(5000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + DrvInitZoomTable(); + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM2610Exit(); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + nScreenStartY = 8; + + return 0; +} + +static void draw_foreground(INT32 transp) +{ + transp *= 0xff; + + UINT16 *vram = (UINT16*)DrvVidRAM; + + for (INT32 offs = nScreenStartY; offs < 64 * 32; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = ((offs >> 6) << 3) - nScreenStartY; + + sx -= *DrvFgScrollX; + if (sx < -7) sx += 512; + sy -= *DrvFgScrollY; + if (sy < -7) sy += 256; + + INT32 code = vram[offs] & 0x7fff; + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 flipy = vram[offs] & 0x8000; + + if (transp) { + if (flipy) { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, 0, 8, transp, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, 0, 8, transp, 0, DrvGfxROM0); + } + } else { + if (flipy) { + Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM0); + } + } + } +} + +static void draw_16x16_zoom(UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 xz, INT32 yz, INT32 fx, INT32 fy) +{ + if (yz <= 1 || xz <= 1) return; + + if (yz == 16 && xz == 16) { + if (fy) { + if (fx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); + } + } else { + if (fx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); + } + } + + return; + } + + fx = (fx * 0x0f); + fy = (fy >> 1) * 0x0f; + + color = (color << 4); + UINT8 *src = gfx + (code << 8); + + INT16 *xm = zoom_table[xz-1]; + INT16 *ym = zoom_table[yz-1]; + + for (INT32 y = 0; y < 16; y++) + { + INT32 yy = sy + y; + + if (ym[y ^ fy] == -1 || yy < 0 || yy >= nScreenHeight) continue; + + INT32 yyz = (ym[y ^ fy] << 4); + + for (INT32 x = 0; x < 16; x++) + { + INT16 xxz = xm[x ^ fx]; + if (xxz == -1) continue; + + INT32 xx = sx + x; + + INT32 pxl = src[yyz|xxz]; + + if (pxl == 15 || xx < 0 || xx >= nScreenWidth || yy < 0 || yy >= nScreenHeight) continue; + + pTransDraw[(yy * nScreenWidth) + xx] = pxl | color; + } + } +} + +static void f1gp_draw_sprites(UINT8 *ram0, UINT8 *ram1, UINT8 *gfx, INT32 colo) +{ + INT32 attr_start,first; + UINT16 *spram = (UINT16*)ram0; + UINT16 *spram2 = (UINT16*)ram1; + + static const INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; + + first = 4 * spram[0x1fe]; + + for (attr_start = first; attr_start < 0x0200; attr_start += 4) + { + INT32 map_start; + INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color; + + if (!(spram[attr_start + 2] & 0x0080)) continue; + + oy = spram[attr_start + 0] & 0x01ff; + zoomy = (spram[attr_start + 0] & 0xf000) >> 12; + ox = spram[attr_start + 1] & 0x01ff; + zoomx = (spram[attr_start + 1] & 0xf000) >> 12; + xsize = (spram[attr_start + 2] & 0x0700) >> 8; + flipx = spram[attr_start + 2] & 0x0800; + ysize = (spram[attr_start + 2] & 0x7000) >> 12; + flipy = spram[attr_start + 2] & 0x8000; + color = (spram[attr_start + 2] & 0x000f) | colo; + map_start = spram[attr_start + 3]; + + zoomx = 16 - zoomtable[zoomx]/8; + zoomy = 16 - zoomtable[zoomy]/8; + + for (y = 0;y <= ysize;y++) + { + INT32 sx,sy; + + if (flipy) sy = ((oy + zoomy * (ysize - y) + 16) & 0x1ff) - 16; + else sy = ((oy + zoomy * y + 16) & 0x1ff) - 16; + + for (x = 0;x <= xsize;x++) + { + INT32 code; + + if (flipx) sx = ((ox + zoomx * (xsize - x) + 16) & 0x1ff) - 16; + else sx = ((ox + zoomx * x + 16) & 0x1ff) - 16; + + code = spram2[map_start & 0x1fff] & 0x1fff; + map_start++; + + draw_16x16_zoom(gfx, code, color, sx, sy-8, zoomx, zoomy, flipx, flipy); + } + + if (xsize == 2) map_start += 1; + if (xsize == 4) map_start += 3; + if (xsize == 5) map_start += 2; + if (xsize == 6) map_start += 1; + } + } +} + +static void f1gp2_draw_sprites() +{ + INT32 offs = 0; + UINT16 *spram = (UINT16*)DrvSprVRAM1; + UINT16 *spram2 = (UINT16*)DrvSprCGRAM1; + + while (offs < 0x0400 && (spram[offs] & 0x4000) == 0) + { + INT32 attr_start; + INT32 map_start; + INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color; + + attr_start = 4 * (spram[offs++] & 0x01ff); + + oy = spram[attr_start + 0] & 0x01ff; + ysize = (spram[attr_start + 0] & 0x0e00) >> 9; + zoomy = (spram[attr_start + 0] & 0xf000) >> 12; + ox = spram[attr_start + 1] & 0x01ff; + xsize = (spram[attr_start + 1] & 0x0e00) >> 9; + zoomx = (spram[attr_start + 1] & 0xf000) >> 12; + flipx = spram[attr_start + 2] & 0x4000; + flipy = spram[attr_start + 2] & 0x8000; + color = (spram[attr_start + 2] & 0x1f00) >> 8; + map_start = spram[attr_start + 3] & 0x7fff; + + zoomx = 32 - zoomx; + zoomy = 32 - zoomy; + + if (spram[attr_start + 2] & 0x20ff) color = GetCurrentFrame() & 0x0f; // good enough? + + for (y = 0;y <= ysize;y++) + { + INT32 sx,sy; + + if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16; + else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16; + + for (x = 0;x <= xsize;x++) + { + INT32 code; + + if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16; + else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16; + + code = spram2[map_start & 0x3fff] & 0x3fff; + map_start++; + + if (*flipscreen) { + flipx = !flipx; + flipy = !flipy; + sx = 304-sx; + sy = 208-sy; + } + + draw_16x16_zoom(DrvGfxROM1, code, color | 0x20, sx, sy, 16, 16, flipx, flipy); + } + } + } +} + +static void predraw_roz_tile(INT32 offset) +{ + UINT16 data = *((UINT16*)(DrvRozVidRAM + offset)); + + offset >>= 1; + + INT32 sx = (offset & 0x3f) << 4; + INT32 sy = (offset >> 6) << 4; + + UINT16 *dst = DrvBgTmp + (sy * 1024) + sx; + + INT32 code = (data & 0x7ff) | (*roz_bank << 11); + INT32 color = ((data >> 12) << 4) | ((nScreenStartY) ? 0x300 : 0x100); + UINT8 *src = DrvGfxROM3 + (code << 8); + + for (INT32 y = 0; y < 16; y++) { + for (INT32 x = 0; x < 16; x++) { + dst[x] = src[x] | color; + if (src[x] == 0x0f) dst[x] |= 0x8000; + } + dst += 1024; + src += 16; + } +} + +static void predraw_background() +{ + UINT16 *ptr = (UINT16*)DrvRozVidRAM; + for (INT32 i = 0; i < 0x2000; i+=2, ptr++) { + if (DrvBgDirty[i/2] || DrvBgTileDirty[*ptr & 0x7ff]) { + predraw_roz_tile(i); + DrvBgDirty[i/2] = 0; + } + } + + memset (DrvBgTileDirty, 0, 0x800); +} + +static inline void copy_roz(UINT32 startx, UINT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, INT32 transp) +{ + UINT16 *dst = pTransDraw; + UINT16 *src = DrvBgTmp; + + for (INT32 sy = 0; sy < nScreenHeight; sy++, startx+=incyx, starty+=incyy) + { + UINT32 cx = startx; + UINT32 cy = starty; + + if (transp) { + for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++) + { + INT32 pxl = src[(((cy >> 16) & 0x3ff) << 10) + ((cx >> 16) & 0x3ff)]; + + if (!(pxl & 0x8000)) { + *dst = pxl; + } + } + } else { + for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++) { + *dst = src[(((cy >> 16) & 0x3ff) << 10) + ((cx >> 16) & 0x3ff)] & 0x3ff; + } + } + } +} + +static void draw_background(INT32 transp) +{ + UINT16 *ctrl = DrvBgCtrl; + + UINT32 startx,starty; + INT32 incxx,incxy,incyx,incyy; + + startx = 256 * (INT16)(ctrl[0x00]); + starty = 256 * (INT16)(ctrl[0x01]); + incyx = (INT16)(ctrl[0x02]); + incyy = (INT16)(ctrl[0x03]); + incxx = (INT16)(ctrl[0x04]); + incxy = (INT16)(ctrl[0x05]); + + if (ctrl[0x06] & 0x4000) { incyx *= 256; incyy *= 256; } + if (ctrl[0x06] & 0x0040) { incxx *= 256; incxy *= 256; } + + if (nScreenStartY) { + startx -= -10 * incyx; + starty -= -10 * incyy; + startx -= -58 * incxx; + starty -= -58 * incxy; + } else { + startx -= -21 * incyx; + starty -= -21 * incyy; + startx -= -48 * incxx; + starty -= -48 * incxy; + } + + copy_roz(startx << 5, starty << 5, incxx << 5, incxy << 5, incyx << 5, incyy << 5, transp); +} + +static void recalculate_palette() +{ + if (DrvRecalc) { + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x400; i++) { + r = (p[i] >> 10) & 0x1f; + g = (p[i] >> 5) & 0x1f; + b = (p[i] >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } + DrvPalette[0x400] = 0; + } +} + +static INT32 F1gpDraw() +{ + recalculate_palette(); + predraw_background(); + draw_background(0); + + if (*gfxctrl == 0x00) { + if (nBurnLayer & 2) f1gp_draw_sprites(DrvSprVRAM2, DrvSprCGRAM2, DrvGfxROM2, 0x20); + if (nBurnLayer & 1) f1gp_draw_sprites(DrvSprVRAM1, DrvSprCGRAM1, DrvGfxROM1, 0x10); + if (nBurnLayer & 4) draw_foreground(1); + } else { + if (nBurnLayer & 2) f1gp_draw_sprites(DrvSprVRAM2, DrvSprCGRAM2, DrvGfxROM2, 0x20); + if (nBurnLayer & 4) draw_foreground(1); + if (nBurnLayer & 1) f1gp_draw_sprites(DrvSprVRAM1, DrvSprCGRAM1, DrvGfxROM1, 0x10); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 F1gp2Draw() +{ + recalculate_palette(); + predraw_background(); + + if (!(*gfxctrl & 4)) { + switch (*gfxctrl & 3) + { + case 0: + if (nBurnLayer & 1) draw_background(0); + if (nBurnLayer & 4) f1gp2_draw_sprites(); + if (nBurnLayer & 2) draw_foreground(1); + break; + + case 1: + if (nBurnLayer & 1) draw_background(0); + if (nBurnLayer & 2) draw_foreground(1); + if (nBurnLayer & 4) f1gp2_draw_sprites(); + break; + + case 2: + if (nBurnLayer & 2) draw_foreground(0); + if (nBurnLayer & 1) draw_background(1); + if (nBurnLayer & 4) f1gp2_draw_sprites(); + break; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 F1gpbDraw() +{ + recalculate_palette(); + BurnTransferClear(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + SekNewFrame(); + ZetNewFrame(); + + { + DrvInputs[0] = 0xffff; + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + } + + } + + INT32 nInterleave = 100; + INT32 nCyclesTotal[3] = { 10000000 / 60, 10000000 / 60, 5000000 / 60 }; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCycleSegment = ((nCyclesTotal[0] / nInterleave) * (i+1)) - nCyclesDone[0]; + + SekOpen(0); + nCyclesDone[0] += SekRun(nCycleSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + SekClose(); + + SekOpen(1); + nCyclesDone[1] += SekRun(nCycleSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + SekClose(); + } + + BurnTimerEndFrame(nCyclesTotal[2]); + + if (pBurnSoundOut) { + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029702; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2610Scan(nAction, pnMin); + } + + if (nAction & ACB_WRITE) { + if (nScreenStartY) { + for (INT32 i = 0; i < 0x40000; i+=2) { + expand_dynamic_tiles(i); + } + } + + ZetOpen(0); + sound_bankswitch(*DrvZ80Bank); + ZetClose(); + } + + return 0; +} + + +// F-1 Grand Prix + +static struct BurnRomInfo f1gpRomDesc[] = { + { "rom1-a.3", 0x020000, 0x2d8f785b, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "rom11-a.2", 0x040000, 0x53df8ea1, 1 | BRF_PRG | BRF_ESS }, // 1 + { "rom10-a.1", 0x040000, 0x46a289fb, 1 | BRF_PRG | BRF_ESS }, // 2 + { "rom13-a.4", 0x040000, 0x7d92e1fa, 1 | BRF_PRG | BRF_ESS }, // 3 + { "rom12-a.3", 0x040000, 0xd8c1bcf4, 1 | BRF_PRG | BRF_ESS }, // 4 + { "rom6-a.6", 0x040000, 0x6d947a3f, 1 | BRF_PRG | BRF_ESS }, // 5 + { "rom7-a.5", 0x040000, 0x7a014ba6, 1 | BRF_PRG | BRF_ESS }, // 6 + { "rom9-a.8", 0x040000, 0x49286572, 1 | BRF_PRG | BRF_ESS }, // 7 + { "rom8-a.7", 0x040000, 0x0ed783c7, 1 | BRF_PRG | BRF_ESS }, // 8 + { "rom2-a.06", 0x100000, 0x747dd112, 1 | BRF_PRG | BRF_ESS }, // 9 + { "rom3-a.05", 0x100000, 0x264aed13, 1 | BRF_PRG | BRF_ESS }, // 10 + + { "rom4-a.4", 0x020000, 0x8e811d36, 2 | BRF_PRG | BRF_ESS }, // 11 68K #1 Code + + { "rom5-a.8", 0x020000, 0x9ea36e35, 3 | BRF_PRG | BRF_ESS }, // 12 Z80 Code + + { "rom3-b.07", 0x100000, 0xffb1d489, 4 | BRF_GRA }, // 13 Character Tiles + { "rom2-b.04", 0x100000, 0xd1b3471f, 4 | BRF_GRA }, // 14 + + { "rom5-b.2", 0x080000, 0x17572b36, 5 | BRF_GRA }, // 15 Sprite Bank 0 + { "rom4-b.3", 0x080000, 0x72d12129, 5 | BRF_GRA }, // 16 + + { "rom7-b.17", 0x040000, 0x2aed9003, 6 | BRF_GRA }, // 17 Sprite Bank 1 + { "rom6-b.16", 0x040000, 0x6789ef12, 6 | BRF_GRA }, // 18 + + { "rom14-a.09", 0x100000, 0xb4c1ac31, 7 | BRF_SND }, // 19 YM2610 Samples + { "rom17-a.08", 0x100000, 0xea70303d, 7 | BRF_SND }, // 20 +}; + +STD_ROM_PICK(f1gp) +STD_ROM_FN(f1gp) + +static INT32 F1gpInit() +{ + return DrvInit(0); +} + +struct BurnDriver BurnDrvF1gp = { + "f1gp", NULL, NULL, NULL, "1991", + "F-1 Grand Prix\0", NULL, "Video System Co.", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 1, HARDWARE_MISC_POST90S, GBF_RACING, 0, + NULL, f1gpRomInfo, f1gpRomName, NULL, NULL, F1gpInputInfo, F1gpDIPInfo, + F1gpInit, DrvExit, DrvFrame, F1gpDraw, DrvScan, &DrvRecalc, 0x401, + 240, 320, 3, 4 +}; + + +// F-1 Grand Prix (Playmark bootleg) + +static struct BurnRomInfo f1gpbRomDesc[] = { + { "1.ic38", 0x020000, 0x046dd83a, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 code + { "7.ic39", 0x020000, 0x960f5db4, 1 | BRF_PRG | BRF_ESS }, // 1 + { "2.ic48", 0x080000, 0xb3b315c3, 1 | BRF_PRG | BRF_ESS }, // 2 + { "8.ic41", 0x080000, 0x39af8180, 1 | BRF_PRG | BRF_ESS }, // 3 + { "3.ic165", 0x080000, 0xb7295a30, 1 | BRF_PRG | BRF_ESS }, // 4 + { "9.ic166", 0x080000, 0xbb596d5b, 1 | BRF_PRG | BRF_ESS }, // 5 + { "4.ic42", 0x080000, 0x5dbde98a, 1 | BRF_PRG | BRF_ESS }, // 6 + { "10.ic43", 0x080000, 0xd60e7706, 1 | BRF_PRG | BRF_ESS }, // 7 + { "5.ic167", 0x080000, 0x48c36293, 1 | BRF_PRG | BRF_ESS }, // 8 + { "11.ic168", 0x080000, 0x92a28e52, 1 | BRF_PRG | BRF_ESS }, // 9 + + { "16.u7", 0x010000, 0x7609d818, 2 | BRF_PRG | BRF_ESS }, // 10 68K #1 Code + { "17.u6", 0x010000, 0x951befde, 2 | BRF_PRG | BRF_ESS }, // 11 + + { "13.ic151", 0x080000, 0x4238074b, 3 | BRF_GRA }, // 12 Character Tiles + { "12.ic152", 0x080000, 0xe97c2b6e, 3 | BRF_GRA }, // 13 + { "15.ic153", 0x080000, 0xc2867d7f, 3 | BRF_GRA }, // 14 + { "14.ic154", 0x080000, 0x0cd20423, 3 | BRF_GRA }, // 15 + + { "rom21", 0x080000, 0x7a08c3b7, 4 | BRF_GRA }, // 16 Sprite Banks + { "rom20", 0x080000, 0xbd1273d0, 4 | BRF_GRA }, // 17 + { "19.ic141", 0x080000, 0xaa4ebdfe, 4 | BRF_GRA }, // 18 + { "18.ic140", 0x080000, 0x9b2a4325, 4 | BRF_GRA }, // 19 + + { "6.ic13", 0x080000, 0x6e83ffd8, 5 | BRF_SND }, // 20 OKI MSM6295 Samples +}; + +STD_ROM_PICK(f1gpb) +STD_ROM_FN(f1gpb) + +static INT32 F1gpbInit() +{ + return 1; +} + +struct BurnDriverD BurnDrvF1gpb = { + "f1gpb", "f1gp", NULL, NULL, "1991", + "F-1 Grand Prix (Playmark bootleg)\0", NULL, "[Video System Co.] (Playmark bootleg)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_BOOTLEG, 1, HARDWARE_MISC_POST90S, GBF_RACING, 0, + NULL, f1gpbRomInfo, f1gpbRomName, NULL, NULL, F1gpInputInfo, F1gpDIPInfo, + F1gpbInit, DrvExit, DrvFrame, F1gpbDraw, DrvScan, &DrvRecalc, 0x401, + 240, 320, 3, 4 +}; + + +// F-1 Grand Prix Part II + +static struct BurnRomInfo f1gp2RomDesc[] = { + { "rom12.v1", 0x020000, 0xc5c5f199, 1 | BRF_PRG | BRF_ESS }, // 0 68K #0 Code + { "rom14.v2", 0x020000, 0xdd5388e2, 1 | BRF_PRG | BRF_ESS }, // 1 + { "rom2", 0x200000, 0x3b0cfa82, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "rom13.v3", 0x020000, 0xc37aa303, 2 | BRF_PRG | BRF_ESS }, // 3 68K #1 Code + + { "rom5.v4", 0x020000, 0x6a9398a1, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "rom1", 0x200000, 0xf2d55ad7, 4 | BRF_GRA }, // 5 Character Tiles + + { "rom15", 0x200000, 0x1ac03e2e, 5 | BRF_GRA }, // 6 Sprites + + { "rom11", 0x100000, 0xb22a2c1f, 6 | BRF_GRA }, // 7 Background Tiles + { "rom10", 0x100000, 0x43fcbe23, 6 | BRF_GRA }, // 8 + { "rom9", 0x100000, 0x1bede8a1, 6 | BRF_GRA }, // 9 + { "rom8", 0x100000, 0x98baf2a1, 6 | BRF_GRA }, // 10 + + { "rom4", 0x080000, 0xc2d3d7ad, 7 | BRF_SND }, // 11 YM2610 Samples + { "rom3", 0x100000, 0x7f8f066f, 7 | BRF_SND }, // 12 +}; + +STD_ROM_PICK(f1gp2) +STD_ROM_FN(f1gp2) + +static INT32 F1gp2Init() +{ + return DrvInit(1); +} + +struct BurnDriver BurnDrvF1gp2 = { + "f1gp2", NULL, NULL, NULL, "1992", + "F-1 Grand Prix Part II\0", NULL, "Video System Co.", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 1, HARDWARE_MISC_POST90S, GBF_RACING, 0, + NULL, f1gp2RomInfo, f1gp2RomName, NULL, NULL, F1gp2InputInfo, F1gp2DIPInfo, + F1gp2Init, DrvExit, DrvFrame, F1gp2Draw, DrvScan, &DrvRecalc, 0x401, + 224, 320, 3, 4 +}; + diff --git a/src/burn/drv/pst90s/d_fstarfrc.cpp b/src/burn/drv/pst90s/d_fstarfrc.cpp index 531a2111b..04bcb6e33 100644 --- a/src/burn/drv/pst90s/d_fstarfrc.cpp +++ b/src/burn/drv/pst90s/d_fstarfrc.cpp @@ -1,1291 +1,1290 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "msm6295.h" -#include "burn_ym2151.h" - -static UINT8 FstarfrcInputPort0[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 FstarfrcInputPort1[6] = {0, 0, 0, 0, 0, 0}; -static UINT8 FstarfrcDip[2] = {0, 0}; -static UINT16 FstarfrcInput[2] = {0x00, 0x00}; -static UINT8 FstarfrcReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *FstarfrcRom = NULL; -static UINT8 *FstarfrcZ80Rom = NULL; -static UINT8 *FstarfrcRam = NULL; -static UINT8 *FstarfrcCharRam = NULL; -static UINT8 *FstarfrcVideoRam = NULL; -static UINT8 *FstarfrcColourRam = NULL; -static UINT8 *FstarfrcVideo2Ram = NULL; -static UINT8 *FstarfrcColour2Ram = NULL; -static UINT8 *FstarfrcSpriteRam = NULL; -static UINT8 *FstarfrcPaletteRam = NULL; -static UINT8 *FstarfrcZ80Ram = NULL; -static UINT32 *FstarfrcPalette = NULL; -static UINT8 *FstarfrcCharTiles = NULL; -static UINT8 *FstarfrcLayerTiles = NULL; -static UINT8 *FstarfrcSpriteTiles = NULL; -static UINT8 *FstarfrcTempGfx = NULL; - -static INT32 CharScrollX; -static INT32 CharScrollY; -static INT32 Scroll1X; -static INT32 Scroll1Y; -static INT32 Scroll2X; -static INT32 Scroll2Y; - -static INT32 Ginkun = 0; -static INT32 Riot = 0; - -static INT32 FstarfrcSoundLatch; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo FstarfrcInputList[] = { - {"Coin 1" , BIT_DIGITAL , FstarfrcInputPort0 + 14, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , FstarfrcInputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , FstarfrcInputPort0 + 15, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , FstarfrcInputPort0 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , FstarfrcInputPort0 + 3, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , FstarfrcInputPort0 + 2, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , FstarfrcInputPort0 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , FstarfrcInputPort0 + 0, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , FstarfrcInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , FstarfrcInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , FstarfrcInputPort0 + 11, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , FstarfrcInputPort0 + 10, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , FstarfrcInputPort0 + 9, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , FstarfrcInputPort0 + 8, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , FstarfrcInputPort0 + 12, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , FstarfrcInputPort0 + 13, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &FstarfrcReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, FstarfrcDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, FstarfrcDip + 1 , "dip" }, -}; - -STDINPUTINFO(Fstarfrc) - -static struct BurnInputInfo RiotInputList[] = { - {"Coin 1" , BIT_DIGITAL , FstarfrcInputPort0 + 14, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , FstarfrcInputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , FstarfrcInputPort0 + 15, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , FstarfrcInputPort0 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , FstarfrcInputPort0 + 3, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , FstarfrcInputPort0 + 2, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , FstarfrcInputPort0 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , FstarfrcInputPort0 + 0, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , FstarfrcInputPort1 + 1, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , FstarfrcInputPort0 + 4, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , FstarfrcInputPort0 + 5, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , FstarfrcInputPort0 + 11, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , FstarfrcInputPort0 + 10, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , FstarfrcInputPort0 + 9, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , FstarfrcInputPort0 + 8, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , FstarfrcInputPort1 + 5, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , FstarfrcInputPort0 + 12, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , FstarfrcInputPort0 + 13, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &FstarfrcReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, FstarfrcDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, FstarfrcDip + 1 , "dip" }, -}; - -STDINPUTINFO(Riot) - -inline void FstarfrcMakeInputs() -{ - // Reset Inputs - FstarfrcInput[0] = FstarfrcInput[1] = 0x3fff; - - // Compile Digital Inputs - for (INT32 i = 0; i < 14; i++) { - FstarfrcInput[0] -= (FstarfrcInputPort0[i] & 1) << i; - } - - for (INT32 i = 14; i < 16; i++) { - FstarfrcInput[0] |= (FstarfrcInputPort0[i] & 1) << i; - } - - for (INT32 i = 0; i < 6; i++) { - FstarfrcInput[1] -= (FstarfrcInputPort1[i] & 1) << i; - } -} - -static struct BurnDIPInfo FstarfrcDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coin SW 1" }, - {0x11, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x03, 0x00, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin SW 2" }, - {0x11, 0x01, 0x0c, 0x00, "4 Coins 1 Credit" }, - {0x11, 0x01, 0x0c, 0x04, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 2 , "Screen Reverse" }, - {0x11, 0x01, 0x10, 0x10, "Off" }, - {0x11, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demonstration Sound" }, - {0x11, 0x01, 0x20, 0x00, "Off" }, - {0x11, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Continue Play" }, - {0x11, 0x01, 0x40, 0x00, "Off" }, - {0x11, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "The Number of Player" }, - {0x12, 0x01, 0x03, 0x00, "2" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Medium" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Level Up Speed" }, - {0x12, 0x01, 0x30, 0x00, "Slowest" }, - {0x12, 0x01, 0x30, 0x10, "Slow" }, - {0x12, 0x01, 0x30, 0x30, "Fast" }, - {0x12, 0x01, 0x30, 0x20, "Fastest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x12, 0x01, 0xc0, 0xc0, "200,000, 1,000,000" }, - {0x12, 0x01, 0xc0, 0x80, "220,000, 1,200,000" }, - {0x12, 0x01, 0xc0, 0x40, "240,000, 1,400,000" }, - {0x12, 0x01, 0xc0, 0x00, "Every 500,000, Once at Highest Score"}, -}; - -STDDIPINFO(Fstarfrc) - -static struct BurnDIPInfo GinkunDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coin SW 1" }, - {0x11, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x03, 0x00, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin SW 2" }, - {0x11, 0x01, 0x0c, 0x00, "4 Coins 1 Credit" }, - {0x11, 0x01, 0x0c, 0x04, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 2 , "Continue Plus 1up" }, - {0x11, 0x01, 0x10, 0x10, "Off" }, - {0x11, 0x01, 0x10, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x03, 0x00, "2" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x02, "4" }, - {0x12, 0x01, 0x03, 0x01, "5" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Normal" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x20, 0x00, "Off" }, - {0x12, 0x01, 0x20, 0x20, "On" }, -}; - -STDDIPINFO(Ginkun) - -static struct BurnDIPInfo RiotDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0x07, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0x07, 0x01, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x07, 0x02, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x07, 0x04, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x38, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x38, 0x30, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x38, 0x28, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x38, 0x18, "4 Coins 1 Credit" }, - - {0 , 0xfe, 0 , 2 , "Starting Coins" }, - {0x13, 0x01, 0x40, 0x40, "1" }, - {0x13, 0x01, 0x40, 0x00, "2" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x03, 0x03, "1" }, - {0x14, 0x01, 0x03, 0x02, "2" }, - {0x14, 0x01, 0x03, 0x01, "3" }, - {0x14, 0x01, 0x03, 0x00, "4" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x10, 0x10, "Off" }, - {0x14, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x20, 0x00, "Off" }, - {0x14, 0x01, 0x20, 0x20, "On" }, -}; - -STDDIPINFO(Riot) - -static struct BurnRomInfo FstarfrcRomDesc[] = { - { "fstarf01.rom", 0x40000, 0x94c71de6, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "fstarf02.rom", 0x40000, 0xb1a07761, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "fstarf03.rom", 0x20000, 0x54375335, BRF_GRA }, // 2 - { "fstarf05.rom", 0x80000, 0x77a281e7, BRF_GRA }, // 3 - { "fstarf04.rom", 0x80000, 0x398a920d, BRF_GRA }, // 4 - { "fstarf09.rom", 0x80000, 0xd51341d2, BRF_GRA }, // 5 - { "fstarf06.rom", 0x80000, 0x07e40e87, BRF_GRA }, // 6 - - { "fstarf07.rom", 0x10000, 0xe0ad5de1, BRF_PRG | BRF_SND }, // 7 Z80 Program Code - - { "fstarf08.rom", 0x20000, 0xf0ad5693, BRF_SND }, // 8 Samples -}; - - -STD_ROM_PICK(Fstarfrc) -STD_ROM_FN(Fstarfrc) - - -static struct BurnRomInfo FstarfrcjRomDesc[] = { - { "1.bin", 0x40000, 0x1905d85d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "2.bin", 0x40000, 0xde9cfc39, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "fstarf03.rom", 0x20000, 0x54375335, BRF_GRA }, // 2 - { "fstarf05.rom", 0x80000, 0x77a281e7, BRF_GRA }, // 3 - { "fstarf04.rom", 0x80000, 0x398a920d, BRF_GRA }, // 4 - { "fstarf09.rom", 0x80000, 0xd51341d2, BRF_GRA }, // 5 - { "fstarf06.rom", 0x80000, 0x07e40e87, BRF_GRA }, // 6 - - { "fstarf07.rom", 0x10000, 0xe0ad5de1, BRF_PRG | BRF_SND }, // 7 Z80 Program Code - - { "fstarf08.rom", 0x20000, 0xf0ad5693, BRF_SND }, // 8 Samples -}; - - -STD_ROM_PICK(Fstarfrcj) -STD_ROM_FN(Fstarfrcj) - -static struct BurnRomInfo GinkunRomDesc[] = { - { "ginkun01.i01", 0x40000, 0x98946fd5, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ginkun02.i02", 0x40000, 0xe98757f6, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "ginkun03.i03", 0x20000, 0x4456e0df, BRF_GRA }, // 2 - { "ginkun05.i09", 0x80000, 0x1263bd42, BRF_GRA }, // 3 - { "ginkun04.i05", 0x80000, 0x9e4cf611, BRF_GRA }, // 4 - { "ginkun09.i22", 0x80000, 0x233384b9, BRF_GRA }, // 5 - { "ginkun06.i16", 0x80000, 0xf8589184, BRF_GRA }, // 6 - - { "ginkun07.i17", 0x10000, 0x8836b1aa, BRF_PRG | BRF_SND }, // 7 Z80 Program Code - - { "ginkun08.i18", 0x20000, 0x8b7583c7, BRF_SND }, // 8 Samples -}; - - -STD_ROM_PICK(Ginkun) -STD_ROM_FN(Ginkun) - -static struct BurnRomInfo RiotRomDesc[] = { - { "1.ic1", 0x40000, 0x9ef4232e, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "2.ic2", 0x40000, 0xf2c6fbbf, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "3.ic3", 0x20000, 0xf60f5c96, BRF_GRA }, // 2 - { "5.ic9", 0x80000, 0x056fce78, BRF_GRA }, // 3 - { "4.ic5", 0x80000, 0x0894e7b4, BRF_GRA }, // 4 - { "9.ic22", 0x80000, 0x0ead54f3, BRF_GRA }, // 5 - { "6.ic16", 0x80000, 0x96ef61da, BRF_GRA }, // 6 - - { "7.ic17", 0x10000, 0x0a95b8f3, BRF_PRG | BRF_SND }, // 7 Z80 Program Code - - { "8.ic18", 0x20000, 0x4b70e266, BRF_SND }, // 8 Samples -}; - - -STD_ROM_PICK(Riot) -STD_ROM_FN(Riot) - -INT32 FstarfrcDoReset() -{ - CharScrollX = CharScrollY = Scroll1X = Scroll1Y = Scroll2X = Scroll2Y = 0; - - FstarfrcSoundLatch = 0; - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM2151Reset(); - - return 0; -} - -void FstarfrcYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0 , ZET_IRQSTATUS_NONE); - } -} - -UINT16 __fastcall FstarfrcReadWord(UINT32 a) -{ - switch (a) { - case 0x150030: { - SEK_DEF_READ_WORD(0, a); - } - - case 0x150040: { - SEK_DEF_READ_WORD(0, a); - } - - case 0x150050: { - return FstarfrcInput[0]; - } - } - - return 0; -} - -UINT8 __fastcall FstarfrcReadByte(UINT32 a) -{ - switch (a) { - case 0x150030: - case 0x150031: { - return FstarfrcDip[1]; - } - case 0x150040: - case 0x150041: { - return FstarfrcDip[0]; - } - } - - return 0; -} - -void __fastcall FstarfrcWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x150010: { - SEK_DEF_WRITE_WORD(0, a, d); - return; - } - - case 0x160000: { - CharScrollX = d; - return; - } - - case 0x16000c: { - Scroll1X = d; - return; - } - - case 0x160012: { - Scroll1Y = d; - return; - } - - case 0x160018: { - Scroll2X = d; - return; - } - - case 0x16001e: { - Scroll2Y = d; - return; - } - } -} - -void __fastcall FstarfrcWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x150011: { - FstarfrcSoundLatch = d & 0xff; - ZetOpen(0); - ZetNmi(); - ZetClose(); - return; - } - } -} - -UINT16 __fastcall GinkunReadWord(UINT32 a) -{ - switch (a) { - case 0x150020: { - return FstarfrcInput[1]; - } - - case 0x150030: { - SEK_DEF_READ_WORD(0, a); - } - - case 0x150040: { - SEK_DEF_READ_WORD(0, a); - } - - case 0x150050: { - return FstarfrcInput[0]; - } - } - -// bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); - - return 0; -} - -UINT8 __fastcall GinkunReadByte(UINT32 a) -{ - switch (a) { - case 0x150030: - case 0x150031: { - return FstarfrcDip[1]; - } - case 0x150040: - case 0x150041: { - return FstarfrcDip[0]; - } - } - - -// bprintf(PRINT_NORMAL, _T("Read Byte -> %06X\n"), a); - - return 0; -} - -void __fastcall GinkunWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { -// case 0x150010: { -// SEK_DEF_WRITE_WORD(0, a, d); -// return; -// } - - case 0x150066: { - return; - } - - case 0x16002e: { - return; - } - - case 0x160000: { - CharScrollX = d; - return; - } - - case 0x160006: { - CharScrollY = d; - return; - } - - case 0x16000c: { - Scroll1X = d; - return; - } - - case 0x160012: { - Scroll1Y = d; - return; - } - - case 0x160018: { - Scroll2X = d; - return; - } - - case 0x16001e: { - Scroll2Y = d; - return; - } - } - -// bprintf(PRINT_NORMAL, _T("Write Word -> %06X, %04X\n"), a, d); -} - -void __fastcall GinkunWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x150001: { - return; // Flipscreen - } - - case 0x150021: { - return; // NOP - } - - case 0x150031: { - return; // NOP - } - - case 0x150011: { - FstarfrcSoundLatch = d & 0xff; - ZetOpen(0); - ZetNmi(); - ZetClose(); - return; - } - } - -// bprintf(PRINT_NORMAL, _T("Write Byte -> %06X, %02X\n"), a, d); -} - -UINT8 __fastcall FstarfrcZ80Read(UINT16 a) -{ - switch (a) { - case 0xfc00: { - return MSM6295ReadStatus(0); - } - - case 0xfc05: { - return BurnYM2151ReadStatus(); - } - - case 0xfc08: { - return FstarfrcSoundLatch; - } - } - - return 0; -} - -void __fastcall FstarfrcZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xfc00: { - MSM6295Command(0, d); - return; - } - - case 0xfc04: { - BurnYM2151SelectRegister(d); - return; - } - - case 0xfc05: { - BurnYM2151WriteRegister(d); - return; - } - } -} - -static INT32 FstarfrcMemIndex() -{ - UINT8 *Next; Next = Mem; - - FstarfrcRom = Next; Next += 0x80000; - FstarfrcZ80Rom = Next; Next += 0x10000; - MSM6295ROM = Next; Next += 0x20000; - - RamStart = Next; - - if (Ginkun || Riot) { - FstarfrcRam = Next; Next += 0x05000; - FstarfrcCharRam = Next; Next += 0x01000; - FstarfrcVideoRam = Next; Next += 0x01000; - FstarfrcColourRam = Next; Next += 0x01000; - FstarfrcVideo2Ram = Next; Next += 0x01000; - FstarfrcColour2Ram = Next; Next += 0x01000; - } else { - FstarfrcRam = Next; Next += 0x0a000; - FstarfrcCharRam = Next; Next += 0x01000; - FstarfrcVideoRam = Next; Next += 0x00800; - FstarfrcColourRam = Next; Next += 0x00800; - FstarfrcVideo2Ram = Next; Next += 0x00800; - FstarfrcColour2Ram = Next; Next += 0x00800; - } - FstarfrcSpriteRam = Next; Next += 0x01000; - FstarfrcPaletteRam = Next; Next += 0x02000; - FstarfrcZ80Ram = Next; Next += 0x0c002; - - RamEnd = Next; - - FstarfrcCharTiles = Next; Next += (4096 * 8 * 8); - FstarfrcLayerTiles = Next; Next += (8192 * 16 * 16); - FstarfrcSpriteTiles = Next; Next += (32768 * 8 * 8); - FstarfrcPalette = (UINT32*)Next; Next += 0x02000 * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 TileXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; -static INT32 TileYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; -static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 CharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; -static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; - - -INT32 FstarfrcInit() -{ - INT32 nRet = 0, nLen; - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ginkun")) Ginkun = 1; - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "riot")) Riot = 1; - - // Allocate and Blank all required memory - Mem = NULL; - FstarfrcMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - FstarfrcMemIndex(); - - FstarfrcTempGfx = (UINT8*)BurnMalloc(0x100000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(FstarfrcRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(FstarfrcRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and decode Char Tiles rom - memset(FstarfrcTempGfx, 0, 0x100000); - nRet = BurnLoadRom(FstarfrcTempGfx, 2, 1); if (nRet != 0) return 1; - GfxDecode(4096, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, FstarfrcTempGfx, FstarfrcCharTiles); - - // Load, byteswap and decode Bg and Fg Layer roms - memset(FstarfrcTempGfx, 0, 0x100000); - nRet = BurnLoadRom(FstarfrcTempGfx + 0x000000, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(FstarfrcTempGfx + 0x000001, 4, 2); if (nRet != 0) return 1; - GfxDecode(8192, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, FstarfrcTempGfx, FstarfrcLayerTiles); - - // Load, byteswap and decode Sprite Tile roms - memset(FstarfrcTempGfx, 0, 0x100000); - nRet = BurnLoadRom(FstarfrcTempGfx + 0x000000, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(FstarfrcTempGfx + 0x000001, 6, 2); if (nRet != 0) return 1; - GfxDecode(32768, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, FstarfrcTempGfx, FstarfrcSpriteTiles); - - BurnFree(FstarfrcTempGfx); - - // Load Z80 Program rom - nRet = BurnLoadRom(FstarfrcZ80Rom, 7, 1); if (nRet != 0) return 1; - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 8, 1); if (nRet != 0) return 1; - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - if (!strncmp(BurnDrvGetTextA(DRV_NAME), "fstarfrc", 8)) { - SekMapMemory(FstarfrcRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(FstarfrcRam , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(FstarfrcCharRam , 0x110000, 0x110fff, SM_RAM); - SekMapMemory(FstarfrcVideoRam , 0x120000, 0x1207ff, SM_RAM); - SekMapMemory(FstarfrcColourRam , 0x120800, 0x120fff, SM_RAM); - SekMapMemory(FstarfrcVideo2Ram , 0x121000, 0x1217ff, SM_RAM); - SekMapMemory(FstarfrcColour2Ram , 0x121800, 0x121fff, SM_RAM); - SekMapMemory(FstarfrcRam + 0x4000, 0x122000, 0x127fff, SM_RAM); - SekMapMemory(FstarfrcSpriteRam , 0x130000, 0x130fff, SM_RAM); - SekMapMemory(FstarfrcPaletteRam , 0x140000, 0x141fff, SM_RAM); - SekSetReadWordHandler(0, FstarfrcReadWord); - SekSetWriteWordHandler(0, FstarfrcWriteWord); - SekSetReadByteHandler(0, FstarfrcReadByte); - SekSetWriteByteHandler(0, FstarfrcWriteByte); - } else { - SekMapMemory(FstarfrcRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(FstarfrcRam , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(FstarfrcCharRam , 0x110000, 0x110fff, SM_RAM); - SekMapMemory(FstarfrcVideoRam , 0x120000, 0x120fff, SM_RAM); - SekMapMemory(FstarfrcColourRam , 0x121000, 0x121fff, SM_RAM); - SekMapMemory(FstarfrcVideo2Ram , 0x122000, 0x122fff, SM_RAM); - SekMapMemory(FstarfrcColour2Ram , 0x123000, 0x123fff, SM_RAM); - SekMapMemory(FstarfrcRam + 0x4000, 0x124000, 0x124fff, SM_RAM); - SekMapMemory(FstarfrcSpriteRam , 0x130000, 0x130fff, SM_RAM); - SekMapMemory(FstarfrcPaletteRam , 0x140000, 0x141fff, SM_RAM); - SekSetReadWordHandler(0, GinkunReadWord); - SekSetWriteWordHandler(0, GinkunWriteWord); - SekSetReadByteHandler(0, GinkunReadByte); - SekSetWriteByteHandler(0, GinkunWriteByte); - } - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, FstarfrcZ80Rom ); - ZetMapArea(0x0000, 0xefff, 2, FstarfrcZ80Rom ); - ZetMapArea(0xf000, 0xfbff, 0, FstarfrcZ80Ram ); - ZetMapArea(0xf000, 0xfbff, 1, FstarfrcZ80Ram ); - ZetMapArea(0xf000, 0xfbff, 2, FstarfrcZ80Ram ); - ZetMapArea(0xfffe, 0xffff, 0, FstarfrcZ80Ram + 0xc000); - ZetMapArea(0xfffe, 0xffff, 1, FstarfrcZ80Ram + 0xc000); - ZetMapArea(0xfffe, 0xffff, 2, FstarfrcZ80Ram + 0xc000); - ZetMemEnd(); - ZetSetReadHandler(FstarfrcZ80Read); - ZetSetWriteHandler(FstarfrcZ80Write); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(8000000 / 2); - BurnYM2151SetIrqHandler(&FstarfrcYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.60, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.60, BURN_SND_ROUTE_RIGHT); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 7575, 1); - MSM6295SetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - FstarfrcDoReset(); - - return 0; -} - -INT32 FstarfrcExit() -{ - BurnYM2151Exit(); - MSM6295Exit(0); - - SekExit(); - ZetExit(); - - GenericTilesExit(); - - BurnFree(Mem); - - Ginkun = 0; - Riot = 0; - - return 0; -} - -void GinkunRenderBgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Code = ((FstarfrcVideo2Ram[TileIndex + 1] << 8) | FstarfrcVideo2Ram[TileIndex + 0]) & 0x1fff; - Colour = (((FstarfrcColour2Ram[TileIndex + 1] << 8) | FstarfrcColour2Ram[TileIndex + 0]) & 0x0f); - - x = 16 * mx; - y = 16 * my; - - x -= Scroll2X; - y -= Scroll2Y; - - x &= 0x1ff; - y &= 0x1ff; - - if (x >= 496) x -= 512; - if (y >= 496) y -= 512; - - y -= 16; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512 + (0x10 << 4), FstarfrcLayerTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512 + (0x10 << 4), FstarfrcLayerTiles); - } - - TileIndex += 2; - } - } -} - -void FstarfrcRenderBgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Code = ((FstarfrcVideo2Ram[TileIndex + 1] << 8) | FstarfrcVideo2Ram[TileIndex + 0]) & 0x1fff; - Colour = (((FstarfrcColour2Ram[TileIndex + 1] << 8) | FstarfrcColour2Ram[TileIndex + 0]) & 0x0f); - - x = 16 * mx; - y = 16 * my; - - x -= Scroll2X; - y -= Scroll2Y; - - x &= 0x1ff; - y &= 0x1ff; - - if (x >= 496) x -= 512; - if (y >= 496) y -= 512; - - y -= 16; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512 + (0x10 << 4), FstarfrcLayerTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512 + (0x10 << 4), FstarfrcLayerTiles); - } - - TileIndex += 2; - } - } -} - -void GinkunRenderFgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Code = ((FstarfrcVideoRam[TileIndex + 1] << 8) | FstarfrcVideoRam[TileIndex + 0]) & 0x1fff; - Colour = ((FstarfrcColourRam[TileIndex + 1] << 8) | FstarfrcColourRam[TileIndex + 0]) & 0x0f; - - x = 16 * mx; - y = 16 * my; - - x -= Scroll1X; - y -= Scroll1Y; - - x &= 0x1ff; - y &= 0x1ff; - - if (x >= 496) x -= 512; - if (y >= 496) y -= 512; - - y -= 16; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512, FstarfrcLayerTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512, FstarfrcLayerTiles); - } - - TileIndex += 2 ; - } - } -} - -void FstarfrcRenderFgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Code = ((FstarfrcVideoRam[TileIndex + 1] << 8) | FstarfrcVideoRam[TileIndex + 0]) & 0x1fff; - Colour = ((FstarfrcColourRam[TileIndex + 1] << 8) | FstarfrcColourRam[TileIndex + 0]) & 0x0f; - - x = 16 * mx; - y = 16 * my; - - x -= Scroll1X; - y -= Scroll1Y; - - x &= 0x1ff; - y &= 0x1ff; - - if (x >= 496) x -= 512; - if (y >= 496) y -= 512; - - y -= 16; - - if (x > 15 && x < 240 && y > 15 && y < 208) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512, FstarfrcLayerTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512, FstarfrcLayerTiles); - } - - TileIndex += 2 ; - } - } -} - -void FstarfrcRenderTextLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Code = (FstarfrcCharRam[TileIndex + 1] << 8) | FstarfrcCharRam[TileIndex + 0]; - Colour = Code >> 12; - Code &= 0x0fff; - - x = 8 * mx; - y = 8 * my; - - x -= CharScrollX; - y -= CharScrollY; - - x &= 0x1ff; - y &= 0x0ff; - - if (x > 7 && x < 248 && y > 7 && y < 216) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, FstarfrcCharTiles); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, FstarfrcCharTiles); - } - - TileIndex += 2 ; - } - } -} - -static void draw_sprites(INT32 layerpriority) -{ - UINT16* pFstarfrcSpriteRam = ((UINT16*)FstarfrcSpriteRam); - - - INT32 offs; - const UINT8 layout[8][8] = - { - {0,1,4,5,16,17,20,21}, - {2,3,6,7,18,19,22,23}, - {8,9,12,13,24,25,28,29}, - {10,11,14,15,26,27,30,31}, - {32,33,36,37,48,49,52,53}, - {34,35,38,39,50,51,54,55}, - {40,41,44,45,56,57,60,61}, - {42,43,46,47,58,59,62,63} - }; - - for (offs = 0; offs < 0x1000 / 2; offs += 8) - { - if (BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0x04) /* enable */ - { - INT32 code,color,sizex,sizey,flipx,flipy,xpos,ypos; - INT32 x,y,priority; - - code = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+1]); - color = (BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+2]) & 0xf0) >> 4; - sizex = 1 << ((BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+2]) & 0x03) >> 0); - if(Riot) - sizey = sizex; - else - sizey = 1 << ((BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+2]) & 0x0c) >> 2); - if (sizex >= 2) code &= ~0x01; - if (sizey >= 2) code &= ~0x02; - if (sizex >= 4) code &= ~0x04; - if (sizey >= 4) code &= ~0x08; - if (sizex >= 8) code &= ~0x10; - if (sizey >= 8) code &= ~0x20; - flipx = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0x01; - flipy = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0x02; - xpos = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+4]); - if (xpos >= 0x8000) xpos -= 0x10000; - ypos = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+3]); - if (ypos >= 0x8000) ypos -= 0x10000; - priority = (BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0xc0) >> 6; - - if (priority != layerpriority) continue; - - for (y = 0;y < sizey;y++) - { - for (x = 0;x < sizex;x++) - { - INT32 sx = xpos + 8*(flipx?(sizex-1-x):x); - INT32 sy = ypos + 8*(flipy?(sizey-1-y):y); - - if ((code + layout[y][x]) > 32767) break; - - sy -= 16; - - if (sx > 7 && sx < 248 && sy > 7 && sy < 216) { - if (!flipx) { - if (!flipy) { - Render8x8Tile_Mask(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); - } else { - Render8x8Tile_Mask_FlipY(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); - } - } else { - if (!flipy) { - Render8x8Tile_Mask_FlipX(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); - } else { - Render8x8Tile_Mask_FlipXY(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); - } - } - } else { - if (!flipx) { - if (!flipy) { - Render8x8Tile_Mask_Clip(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); - } - } else { - if (!flipy) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); - } else { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); - } - } - } - } - } - } - } -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour >> 0) & 0x0f; - g = (nColour >> 4) & 0x0f; - b = (nColour >> 8) & 0x0f; - - r = (r << 4) | r; - g = (g << 4) | g; - b = (b << 4) | b; - - return BurnHighCol(r, g, b, 0); -} - -INT32 FstarfrcCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)FstarfrcPaletteRam, pd = FstarfrcPalette; i < 0x2000; i++, ps++, pd++) { - *pd = CalcCol(BURN_ENDIAN_SWAP_INT16(*ps)); - } - - return 0; -} - -void GinkunRender() -{ - FstarfrcCalcPalette(); - - for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { - pTransDraw[i] = 0x300; - } - - draw_sprites(3); - GinkunRenderBgLayer(); - draw_sprites(2); - GinkunRenderFgLayer(); - draw_sprites(1); - FstarfrcRenderTextLayer(); - draw_sprites(0); - BurnTransferCopy(FstarfrcPalette); -} - -void FstarfrcRender() -{ - FstarfrcCalcPalette(); - - for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { - pTransDraw[i] = 0x300; - } - - draw_sprites(3); - FstarfrcRenderBgLayer(); - draw_sprites(2); - FstarfrcRenderFgLayer(); - draw_sprites(1); - FstarfrcRenderTextLayer(); - draw_sprites(0); - BurnTransferCopy(FstarfrcPalette); -} - -INT32 FstarfrcFrame() -{ - INT32 nInterleave = 10; - - if (FstarfrcReset) FstarfrcDoReset(); - - FstarfrcMakeInputs(); - - nCyclesTotal[0] = (24000000 / 2) / 60; - nCyclesTotal[1] = (8000000 / 2) / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - - SekOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) { - if (Ginkun || Riot) { - GinkunRender(); - } else { - FstarfrcRender(); - } - } - - return 0; -} - -static INT32 FstarfrcScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x02944; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); // Scan 68000 - ZetScan(nAction); // Scan Z80 - - MSM6295Scan(0, nAction); // Scan OKIM6295 - BurnYM2151Scan(nAction); - - // Scan critical driver variables - SCAN_VAR(FstarfrcSoundLatch); - SCAN_VAR(FstarfrcInput); - SCAN_VAR(FstarfrcDip); - SCAN_VAR(CharScrollX); - SCAN_VAR(CharScrollY); - SCAN_VAR(Scroll1X); - SCAN_VAR(Scroll1Y); - SCAN_VAR(Scroll2X); - SCAN_VAR(Scroll2Y); - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - } - - return 0; -} - -struct BurnDriver BurnDrvFstarfrc = { - "fstarfrc", NULL, NULL, NULL, "1992", - "Final Star Force (US)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, FstarfrcRomInfo, FstarfrcRomName, NULL, NULL, FstarfrcInputInfo, FstarfrcDIPInfo, - FstarfrcInit, FstarfrcExit, FstarfrcFrame, NULL, FstarfrcScan, - NULL, 0x2000, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvFstarfrcj = { - "fstarfrcj", "fstarfrc", NULL, NULL, "1992", - "Final Star Force (Japan)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, FstarfrcjRomInfo, FstarfrcjRomName, NULL, NULL, FstarfrcInputInfo, FstarfrcDIPInfo, - FstarfrcInit, FstarfrcExit, FstarfrcFrame, NULL, FstarfrcScan, - NULL, 0x2000, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGinkun = { - "ginkun", NULL, NULL, NULL, "1995", - "Ganbare Ginkun\0", "Imperfect GFX", "Tecmo", "Miscellaneous", - L"\u304C\u3093\u3070\u308C \u30AE\u30F3\u304F\u3093\0Ganbare Ginkun\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, GinkunRomInfo, GinkunRomName, NULL, NULL, FstarfrcInputInfo, GinkunDIPInfo, - FstarfrcInit, FstarfrcExit, FstarfrcFrame, NULL, FstarfrcScan, - NULL, 0x2000, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvRiot = { - "riot", NULL, NULL, NULL, "1992", - "Riot\0", NULL, "NMK", "Miscellaneous", - L"\u96F7\u8ECB\u6597 Riot\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0, - NULL, RiotRomInfo, RiotRomName, NULL, NULL, RiotInputInfo, RiotDIPInfo, - FstarfrcInit, FstarfrcExit, FstarfrcFrame, NULL, FstarfrcScan, - NULL, 0x2000, 256, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "msm6295.h" +#include "burn_ym2151.h" + +static UINT8 FstarfrcInputPort0[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 FstarfrcInputPort1[6] = {0, 0, 0, 0, 0, 0}; +static UINT8 FstarfrcDip[2] = {0, 0}; +static UINT16 FstarfrcInput[2] = {0x00, 0x00}; +static UINT8 FstarfrcReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *FstarfrcRom = NULL; +static UINT8 *FstarfrcZ80Rom = NULL; +static UINT8 *FstarfrcRam = NULL; +static UINT8 *FstarfrcCharRam = NULL; +static UINT8 *FstarfrcVideoRam = NULL; +static UINT8 *FstarfrcColourRam = NULL; +static UINT8 *FstarfrcVideo2Ram = NULL; +static UINT8 *FstarfrcColour2Ram = NULL; +static UINT8 *FstarfrcSpriteRam = NULL; +static UINT8 *FstarfrcPaletteRam = NULL; +static UINT8 *FstarfrcZ80Ram = NULL; +static UINT32 *FstarfrcPalette = NULL; +static UINT8 *FstarfrcCharTiles = NULL; +static UINT8 *FstarfrcLayerTiles = NULL; +static UINT8 *FstarfrcSpriteTiles = NULL; +static UINT8 *FstarfrcTempGfx = NULL; + +static INT32 CharScrollX; +static INT32 CharScrollY; +static INT32 Scroll1X; +static INT32 Scroll1Y; +static INT32 Scroll2X; +static INT32 Scroll2Y; + +static INT32 Ginkun = 0; +static INT32 Riot = 0; + +static INT32 FstarfrcSoundLatch; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo FstarfrcInputList[] = { + {"Coin 1" , BIT_DIGITAL , FstarfrcInputPort0 + 14, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , FstarfrcInputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , FstarfrcInputPort0 + 15, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , FstarfrcInputPort0 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , FstarfrcInputPort0 + 3, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , FstarfrcInputPort0 + 2, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , FstarfrcInputPort0 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , FstarfrcInputPort0 + 0, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , FstarfrcInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , FstarfrcInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , FstarfrcInputPort0 + 11, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , FstarfrcInputPort0 + 10, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , FstarfrcInputPort0 + 9, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , FstarfrcInputPort0 + 8, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , FstarfrcInputPort0 + 12, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , FstarfrcInputPort0 + 13, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &FstarfrcReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, FstarfrcDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, FstarfrcDip + 1 , "dip" }, +}; + +STDINPUTINFO(Fstarfrc) + +static struct BurnInputInfo RiotInputList[] = { + {"Coin 1" , BIT_DIGITAL , FstarfrcInputPort0 + 14, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , FstarfrcInputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , FstarfrcInputPort0 + 15, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , FstarfrcInputPort0 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , FstarfrcInputPort0 + 3, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , FstarfrcInputPort0 + 2, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , FstarfrcInputPort0 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , FstarfrcInputPort0 + 0, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , FstarfrcInputPort1 + 1, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , FstarfrcInputPort0 + 4, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , FstarfrcInputPort0 + 5, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , FstarfrcInputPort0 + 11, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , FstarfrcInputPort0 + 10, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , FstarfrcInputPort0 + 9, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , FstarfrcInputPort0 + 8, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , FstarfrcInputPort1 + 5, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , FstarfrcInputPort0 + 12, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , FstarfrcInputPort0 + 13, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &FstarfrcReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, FstarfrcDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, FstarfrcDip + 1 , "dip" }, +}; + +STDINPUTINFO(Riot) + +inline void FstarfrcMakeInputs() +{ + // Reset Inputs + FstarfrcInput[0] = FstarfrcInput[1] = 0x3fff; + + // Compile Digital Inputs + for (INT32 i = 0; i < 14; i++) { + FstarfrcInput[0] -= (FstarfrcInputPort0[i] & 1) << i; + } + + for (INT32 i = 14; i < 16; i++) { + FstarfrcInput[0] |= (FstarfrcInputPort0[i] & 1) << i; + } + + for (INT32 i = 0; i < 6; i++) { + FstarfrcInput[1] -= (FstarfrcInputPort1[i] & 1) << i; + } +} + +static struct BurnDIPInfo FstarfrcDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coin SW 1" }, + {0x11, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x03, 0x00, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin SW 2" }, + {0x11, 0x01, 0x0c, 0x00, "4 Coins 1 Credit" }, + {0x11, 0x01, 0x0c, 0x04, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 2 , "Screen Reverse" }, + {0x11, 0x01, 0x10, 0x10, "Off" }, + {0x11, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demonstration Sound" }, + {0x11, 0x01, 0x20, 0x00, "Off" }, + {0x11, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Continue Play" }, + {0x11, 0x01, 0x40, 0x00, "Off" }, + {0x11, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "The Number of Player" }, + {0x12, 0x01, 0x03, 0x00, "2" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Medium" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Level Up Speed" }, + {0x12, 0x01, 0x30, 0x00, "Slowest" }, + {0x12, 0x01, 0x30, 0x10, "Slow" }, + {0x12, 0x01, 0x30, 0x30, "Fast" }, + {0x12, 0x01, 0x30, 0x20, "Fastest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x12, 0x01, 0xc0, 0xc0, "200,000, 1,000,000" }, + {0x12, 0x01, 0xc0, 0x80, "220,000, 1,200,000" }, + {0x12, 0x01, 0xc0, 0x40, "240,000, 1,400,000" }, + {0x12, 0x01, 0xc0, 0x00, "Every 500,000, Once at Highest Score"}, +}; + +STDDIPINFO(Fstarfrc) + +static struct BurnDIPInfo GinkunDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coin SW 1" }, + {0x11, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x03, 0x00, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin SW 2" }, + {0x11, 0x01, 0x0c, 0x00, "4 Coins 1 Credit" }, + {0x11, 0x01, 0x0c, 0x04, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 2 , "Continue Plus 1up" }, + {0x11, 0x01, 0x10, 0x10, "Off" }, + {0x11, 0x01, 0x10, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x03, 0x00, "2" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x02, "4" }, + {0x12, 0x01, 0x03, 0x01, "5" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Normal" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x20, 0x00, "Off" }, + {0x12, 0x01, 0x20, 0x20, "On" }, +}; + +STDDIPINFO(Ginkun) + +static struct BurnDIPInfo RiotDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0x07, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0x07, 0x01, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x07, 0x02, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x07, 0x04, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x38, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x38, 0x30, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x38, 0x28, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x38, 0x18, "4 Coins 1 Credit" }, + + {0 , 0xfe, 0 , 2 , "Starting Coins" }, + {0x13, 0x01, 0x40, 0x40, "1" }, + {0x13, 0x01, 0x40, 0x00, "2" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x03, 0x03, "1" }, + {0x14, 0x01, 0x03, 0x02, "2" }, + {0x14, 0x01, 0x03, 0x01, "3" }, + {0x14, 0x01, 0x03, 0x00, "4" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x10, 0x10, "Off" }, + {0x14, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x20, 0x00, "Off" }, + {0x14, 0x01, 0x20, 0x20, "On" }, +}; + +STDDIPINFO(Riot) + +static struct BurnRomInfo FstarfrcRomDesc[] = { + { "fstarf01.rom", 0x40000, 0x94c71de6, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "fstarf02.rom", 0x40000, 0xb1a07761, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "fstarf03.rom", 0x20000, 0x54375335, BRF_GRA }, // 2 + { "fstarf05.rom", 0x80000, 0x77a281e7, BRF_GRA }, // 3 + { "fstarf04.rom", 0x80000, 0x398a920d, BRF_GRA }, // 4 + { "fstarf09.rom", 0x80000, 0xd51341d2, BRF_GRA }, // 5 + { "fstarf06.rom", 0x80000, 0x07e40e87, BRF_GRA }, // 6 + + { "fstarf07.rom", 0x10000, 0xe0ad5de1, BRF_PRG | BRF_SND }, // 7 Z80 Program Code + + { "fstarf08.rom", 0x20000, 0xf0ad5693, BRF_SND }, // 8 Samples +}; + + +STD_ROM_PICK(Fstarfrc) +STD_ROM_FN(Fstarfrc) + + +static struct BurnRomInfo FstarfrcjRomDesc[] = { + { "1.bin", 0x40000, 0x1905d85d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "2.bin", 0x40000, 0xde9cfc39, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "fstarf03.rom", 0x20000, 0x54375335, BRF_GRA }, // 2 + { "fstarf05.rom", 0x80000, 0x77a281e7, BRF_GRA }, // 3 + { "fstarf04.rom", 0x80000, 0x398a920d, BRF_GRA }, // 4 + { "fstarf09.rom", 0x80000, 0xd51341d2, BRF_GRA }, // 5 + { "fstarf06.rom", 0x80000, 0x07e40e87, BRF_GRA }, // 6 + + { "fstarf07.rom", 0x10000, 0xe0ad5de1, BRF_PRG | BRF_SND }, // 7 Z80 Program Code + + { "fstarf08.rom", 0x20000, 0xf0ad5693, BRF_SND }, // 8 Samples +}; + + +STD_ROM_PICK(Fstarfrcj) +STD_ROM_FN(Fstarfrcj) + +static struct BurnRomInfo GinkunRomDesc[] = { + { "ginkun01.i01", 0x40000, 0x98946fd5, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ginkun02.i02", 0x40000, 0xe98757f6, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "ginkun03.i03", 0x20000, 0x4456e0df, BRF_GRA }, // 2 + { "ginkun05.i09", 0x80000, 0x1263bd42, BRF_GRA }, // 3 + { "ginkun04.i05", 0x80000, 0x9e4cf611, BRF_GRA }, // 4 + { "ginkun09.i22", 0x80000, 0x233384b9, BRF_GRA }, // 5 + { "ginkun06.i16", 0x80000, 0xf8589184, BRF_GRA }, // 6 + + { "ginkun07.i17", 0x10000, 0x8836b1aa, BRF_PRG | BRF_SND }, // 7 Z80 Program Code + + { "ginkun08.i18", 0x20000, 0x8b7583c7, BRF_SND }, // 8 Samples +}; + + +STD_ROM_PICK(Ginkun) +STD_ROM_FN(Ginkun) + +static struct BurnRomInfo RiotRomDesc[] = { + { "1.ic1", 0x40000, 0x9ef4232e, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "2.ic2", 0x40000, 0xf2c6fbbf, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "3.ic3", 0x20000, 0xf60f5c96, BRF_GRA }, // 2 + { "5.ic9", 0x80000, 0x056fce78, BRF_GRA }, // 3 + { "4.ic5", 0x80000, 0x0894e7b4, BRF_GRA }, // 4 + { "9.ic22", 0x80000, 0x0ead54f3, BRF_GRA }, // 5 + { "6.ic16", 0x80000, 0x96ef61da, BRF_GRA }, // 6 + + { "7.ic17", 0x10000, 0x0a95b8f3, BRF_PRG | BRF_SND }, // 7 Z80 Program Code + + { "8.ic18", 0x20000, 0x4b70e266, BRF_SND }, // 8 Samples +}; + + +STD_ROM_PICK(Riot) +STD_ROM_FN(Riot) + +INT32 FstarfrcDoReset() +{ + CharScrollX = CharScrollY = Scroll1X = Scroll1Y = Scroll2X = Scroll2Y = 0; + + FstarfrcSoundLatch = 0; + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM2151Reset(); + + return 0; +} + +void FstarfrcYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0 , ZET_IRQSTATUS_NONE); + } +} + +UINT16 __fastcall FstarfrcReadWord(UINT32 a) +{ + switch (a) { + case 0x150030: { + SEK_DEF_READ_WORD(0, a); + } + + case 0x150040: { + SEK_DEF_READ_WORD(0, a); + } + + case 0x150050: { + return FstarfrcInput[0]; + } + } + + return 0; +} + +UINT8 __fastcall FstarfrcReadByte(UINT32 a) +{ + switch (a) { + case 0x150030: + case 0x150031: { + return FstarfrcDip[1]; + } + case 0x150040: + case 0x150041: { + return FstarfrcDip[0]; + } + } + + return 0; +} + +void __fastcall FstarfrcWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x150010: { + SEK_DEF_WRITE_WORD(0, a, d); + return; + } + + case 0x160000: { + CharScrollX = d; + return; + } + + case 0x16000c: { + Scroll1X = d; + return; + } + + case 0x160012: { + Scroll1Y = d; + return; + } + + case 0x160018: { + Scroll2X = d; + return; + } + + case 0x16001e: { + Scroll2Y = d; + return; + } + } +} + +void __fastcall FstarfrcWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x150011: { + FstarfrcSoundLatch = d & 0xff; + ZetOpen(0); + ZetNmi(); + ZetClose(); + return; + } + } +} + +UINT16 __fastcall GinkunReadWord(UINT32 a) +{ + switch (a) { + case 0x150020: { + return FstarfrcInput[1]; + } + + case 0x150030: { + SEK_DEF_READ_WORD(0, a); + } + + case 0x150040: { + SEK_DEF_READ_WORD(0, a); + } + + case 0x150050: { + return FstarfrcInput[0]; + } + } + +// bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); + + return 0; +} + +UINT8 __fastcall GinkunReadByte(UINT32 a) +{ + switch (a) { + case 0x150030: + case 0x150031: { + return FstarfrcDip[1]; + } + case 0x150040: + case 0x150041: { + return FstarfrcDip[0]; + } + } + + +// bprintf(PRINT_NORMAL, _T("Read Byte -> %06X\n"), a); + + return 0; +} + +void __fastcall GinkunWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { +// case 0x150010: { +// SEK_DEF_WRITE_WORD(0, a, d); +// return; +// } + + case 0x150066: { + return; + } + + case 0x16002e: { + return; + } + + case 0x160000: { + CharScrollX = d; + return; + } + + case 0x160006: { + CharScrollY = d; + return; + } + + case 0x16000c: { + Scroll1X = d; + return; + } + + case 0x160012: { + Scroll1Y = d; + return; + } + + case 0x160018: { + Scroll2X = d; + return; + } + + case 0x16001e: { + Scroll2Y = d; + return; + } + } + +// bprintf(PRINT_NORMAL, _T("Write Word -> %06X, %04X\n"), a, d); +} + +void __fastcall GinkunWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x150001: { + return; // Flipscreen + } + + case 0x150021: { + return; // NOP + } + + case 0x150031: { + return; // NOP + } + + case 0x150011: { + FstarfrcSoundLatch = d & 0xff; + ZetOpen(0); + ZetNmi(); + ZetClose(); + return; + } + } + +// bprintf(PRINT_NORMAL, _T("Write Byte -> %06X, %02X\n"), a, d); +} + +UINT8 __fastcall FstarfrcZ80Read(UINT16 a) +{ + switch (a) { + case 0xfc00: { + return MSM6295ReadStatus(0); + } + + case 0xfc05: { + return BurnYM2151ReadStatus(); + } + + case 0xfc08: { + return FstarfrcSoundLatch; + } + } + + return 0; +} + +void __fastcall FstarfrcZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xfc00: { + MSM6295Command(0, d); + return; + } + + case 0xfc04: { + BurnYM2151SelectRegister(d); + return; + } + + case 0xfc05: { + BurnYM2151WriteRegister(d); + return; + } + } +} + +static INT32 FstarfrcMemIndex() +{ + UINT8 *Next; Next = Mem; + + FstarfrcRom = Next; Next += 0x80000; + FstarfrcZ80Rom = Next; Next += 0x10000; + MSM6295ROM = Next; Next += 0x20000; + + RamStart = Next; + + if (Ginkun || Riot) { + FstarfrcRam = Next; Next += 0x05000; + FstarfrcCharRam = Next; Next += 0x01000; + FstarfrcVideoRam = Next; Next += 0x01000; + FstarfrcColourRam = Next; Next += 0x01000; + FstarfrcVideo2Ram = Next; Next += 0x01000; + FstarfrcColour2Ram = Next; Next += 0x01000; + } else { + FstarfrcRam = Next; Next += 0x0a000; + FstarfrcCharRam = Next; Next += 0x01000; + FstarfrcVideoRam = Next; Next += 0x00800; + FstarfrcColourRam = Next; Next += 0x00800; + FstarfrcVideo2Ram = Next; Next += 0x00800; + FstarfrcColour2Ram = Next; Next += 0x00800; + } + FstarfrcSpriteRam = Next; Next += 0x01000; + FstarfrcPaletteRam = Next; Next += 0x02000; + FstarfrcZ80Ram = Next; Next += 0x0c002; + + RamEnd = Next; + + FstarfrcCharTiles = Next; Next += (4096 * 8 * 8); + FstarfrcLayerTiles = Next; Next += (8192 * 16 * 16); + FstarfrcSpriteTiles = Next; Next += (32768 * 8 * 8); + FstarfrcPalette = (UINT32*)Next; Next += 0x02000 * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 TileXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; +static INT32 TileYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; +static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 CharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; +static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; + + +INT32 FstarfrcInit() +{ + INT32 nRet = 0, nLen; + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "ginkun")) Ginkun = 1; + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "riot")) Riot = 1; + + // Allocate and Blank all required memory + Mem = NULL; + FstarfrcMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + FstarfrcMemIndex(); + + FstarfrcTempGfx = (UINT8*)BurnMalloc(0x100000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(FstarfrcRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(FstarfrcRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and decode Char Tiles rom + memset(FstarfrcTempGfx, 0, 0x100000); + nRet = BurnLoadRom(FstarfrcTempGfx, 2, 1); if (nRet != 0) return 1; + GfxDecode(4096, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, FstarfrcTempGfx, FstarfrcCharTiles); + + // Load, byteswap and decode Bg and Fg Layer roms + memset(FstarfrcTempGfx, 0, 0x100000); + nRet = BurnLoadRom(FstarfrcTempGfx + 0x000000, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(FstarfrcTempGfx + 0x000001, 4, 2); if (nRet != 0) return 1; + GfxDecode(8192, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x400, FstarfrcTempGfx, FstarfrcLayerTiles); + + // Load, byteswap and decode Sprite Tile roms + memset(FstarfrcTempGfx, 0, 0x100000); + nRet = BurnLoadRom(FstarfrcTempGfx + 0x000000, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(FstarfrcTempGfx + 0x000001, 6, 2); if (nRet != 0) return 1; + GfxDecode(32768, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, FstarfrcTempGfx, FstarfrcSpriteTiles); + + BurnFree(FstarfrcTempGfx); + + // Load Z80 Program rom + nRet = BurnLoadRom(FstarfrcZ80Rom, 7, 1); if (nRet != 0) return 1; + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 8, 1); if (nRet != 0) return 1; + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + if (!strncmp(BurnDrvGetTextA(DRV_NAME), "fstarfrc", 8)) { + SekMapMemory(FstarfrcRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(FstarfrcRam , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(FstarfrcCharRam , 0x110000, 0x110fff, SM_RAM); + SekMapMemory(FstarfrcVideoRam , 0x120000, 0x1207ff, SM_RAM); + SekMapMemory(FstarfrcColourRam , 0x120800, 0x120fff, SM_RAM); + SekMapMemory(FstarfrcVideo2Ram , 0x121000, 0x1217ff, SM_RAM); + SekMapMemory(FstarfrcColour2Ram , 0x121800, 0x121fff, SM_RAM); + SekMapMemory(FstarfrcRam + 0x4000, 0x122000, 0x127fff, SM_RAM); + SekMapMemory(FstarfrcSpriteRam , 0x130000, 0x130fff, SM_RAM); + SekMapMemory(FstarfrcPaletteRam , 0x140000, 0x141fff, SM_RAM); + SekSetReadWordHandler(0, FstarfrcReadWord); + SekSetWriteWordHandler(0, FstarfrcWriteWord); + SekSetReadByteHandler(0, FstarfrcReadByte); + SekSetWriteByteHandler(0, FstarfrcWriteByte); + } else { + SekMapMemory(FstarfrcRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(FstarfrcRam , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(FstarfrcCharRam , 0x110000, 0x110fff, SM_RAM); + SekMapMemory(FstarfrcVideoRam , 0x120000, 0x120fff, SM_RAM); + SekMapMemory(FstarfrcColourRam , 0x121000, 0x121fff, SM_RAM); + SekMapMemory(FstarfrcVideo2Ram , 0x122000, 0x122fff, SM_RAM); + SekMapMemory(FstarfrcColour2Ram , 0x123000, 0x123fff, SM_RAM); + SekMapMemory(FstarfrcRam + 0x4000, 0x124000, 0x124fff, SM_RAM); + SekMapMemory(FstarfrcSpriteRam , 0x130000, 0x130fff, SM_RAM); + SekMapMemory(FstarfrcPaletteRam , 0x140000, 0x141fff, SM_RAM); + SekSetReadWordHandler(0, GinkunReadWord); + SekSetWriteWordHandler(0, GinkunWriteWord); + SekSetReadByteHandler(0, GinkunReadByte); + SekSetWriteByteHandler(0, GinkunWriteByte); + } + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, FstarfrcZ80Rom ); + ZetMapArea(0x0000, 0xefff, 2, FstarfrcZ80Rom ); + ZetMapArea(0xf000, 0xfbff, 0, FstarfrcZ80Ram ); + ZetMapArea(0xf000, 0xfbff, 1, FstarfrcZ80Ram ); + ZetMapArea(0xf000, 0xfbff, 2, FstarfrcZ80Ram ); + ZetMapArea(0xfffe, 0xffff, 0, FstarfrcZ80Ram + 0xc000); + ZetMapArea(0xfffe, 0xffff, 1, FstarfrcZ80Ram + 0xc000); + ZetMapArea(0xfffe, 0xffff, 2, FstarfrcZ80Ram + 0xc000); + ZetSetReadHandler(FstarfrcZ80Read); + ZetSetWriteHandler(FstarfrcZ80Write); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(8000000 / 2); + BurnYM2151SetIrqHandler(&FstarfrcYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.60, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.60, BURN_SND_ROUTE_RIGHT); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 7575, 1); + MSM6295SetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + FstarfrcDoReset(); + + return 0; +} + +INT32 FstarfrcExit() +{ + BurnYM2151Exit(); + MSM6295Exit(0); + + SekExit(); + ZetExit(); + + GenericTilesExit(); + + BurnFree(Mem); + + Ginkun = 0; + Riot = 0; + + return 0; +} + +void GinkunRenderBgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Code = ((FstarfrcVideo2Ram[TileIndex + 1] << 8) | FstarfrcVideo2Ram[TileIndex + 0]) & 0x1fff; + Colour = (((FstarfrcColour2Ram[TileIndex + 1] << 8) | FstarfrcColour2Ram[TileIndex + 0]) & 0x0f); + + x = 16 * mx; + y = 16 * my; + + x -= Scroll2X; + y -= Scroll2Y; + + x &= 0x1ff; + y &= 0x1ff; + + if (x >= 496) x -= 512; + if (y >= 496) y -= 512; + + y -= 16; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512 + (0x10 << 4), FstarfrcLayerTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512 + (0x10 << 4), FstarfrcLayerTiles); + } + + TileIndex += 2; + } + } +} + +void FstarfrcRenderBgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Code = ((FstarfrcVideo2Ram[TileIndex + 1] << 8) | FstarfrcVideo2Ram[TileIndex + 0]) & 0x1fff; + Colour = (((FstarfrcColour2Ram[TileIndex + 1] << 8) | FstarfrcColour2Ram[TileIndex + 0]) & 0x0f); + + x = 16 * mx; + y = 16 * my; + + x -= Scroll2X; + y -= Scroll2Y; + + x &= 0x1ff; + y &= 0x1ff; + + if (x >= 496) x -= 512; + if (y >= 496) y -= 512; + + y -= 16; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512 + (0x10 << 4), FstarfrcLayerTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512 + (0x10 << 4), FstarfrcLayerTiles); + } + + TileIndex += 2; + } + } +} + +void GinkunRenderFgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Code = ((FstarfrcVideoRam[TileIndex + 1] << 8) | FstarfrcVideoRam[TileIndex + 0]) & 0x1fff; + Colour = ((FstarfrcColourRam[TileIndex + 1] << 8) | FstarfrcColourRam[TileIndex + 0]) & 0x0f; + + x = 16 * mx; + y = 16 * my; + + x -= Scroll1X; + y -= Scroll1Y; + + x &= 0x1ff; + y &= 0x1ff; + + if (x >= 496) x -= 512; + if (y >= 496) y -= 512; + + y -= 16; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512, FstarfrcLayerTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512, FstarfrcLayerTiles); + } + + TileIndex += 2 ; + } + } +} + +void FstarfrcRenderFgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Code = ((FstarfrcVideoRam[TileIndex + 1] << 8) | FstarfrcVideoRam[TileIndex + 0]) & 0x1fff; + Colour = ((FstarfrcColourRam[TileIndex + 1] << 8) | FstarfrcColourRam[TileIndex + 0]) & 0x0f; + + x = 16 * mx; + y = 16 * my; + + x -= Scroll1X; + y -= Scroll1Y; + + x &= 0x1ff; + y &= 0x1ff; + + if (x >= 496) x -= 512; + if (y >= 496) y -= 512; + + y -= 16; + + if (x > 15 && x < 240 && y > 15 && y < 208) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 512, FstarfrcLayerTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 512, FstarfrcLayerTiles); + } + + TileIndex += 2 ; + } + } +} + +void FstarfrcRenderTextLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Code = (FstarfrcCharRam[TileIndex + 1] << 8) | FstarfrcCharRam[TileIndex + 0]; + Colour = Code >> 12; + Code &= 0x0fff; + + x = 8 * mx; + y = 8 * my; + + x -= CharScrollX; + y -= CharScrollY; + + x &= 0x1ff; + y &= 0x0ff; + + if (x > 7 && x < 248 && y > 7 && y < 216) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, FstarfrcCharTiles); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, FstarfrcCharTiles); + } + + TileIndex += 2 ; + } + } +} + +static void draw_sprites(INT32 layerpriority) +{ + UINT16* pFstarfrcSpriteRam = ((UINT16*)FstarfrcSpriteRam); + + + INT32 offs; + const UINT8 layout[8][8] = + { + {0,1,4,5,16,17,20,21}, + {2,3,6,7,18,19,22,23}, + {8,9,12,13,24,25,28,29}, + {10,11,14,15,26,27,30,31}, + {32,33,36,37,48,49,52,53}, + {34,35,38,39,50,51,54,55}, + {40,41,44,45,56,57,60,61}, + {42,43,46,47,58,59,62,63} + }; + + for (offs = 0; offs < 0x1000 / 2; offs += 8) + { + if (BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0x04) /* enable */ + { + INT32 code,color,sizex,sizey,flipx,flipy,xpos,ypos; + INT32 x,y,priority; + + code = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+1]); + color = (BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+2]) & 0xf0) >> 4; + sizex = 1 << ((BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+2]) & 0x03) >> 0); + if(Riot) + sizey = sizex; + else + sizey = 1 << ((BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+2]) & 0x0c) >> 2); + if (sizex >= 2) code &= ~0x01; + if (sizey >= 2) code &= ~0x02; + if (sizex >= 4) code &= ~0x04; + if (sizey >= 4) code &= ~0x08; + if (sizex >= 8) code &= ~0x10; + if (sizey >= 8) code &= ~0x20; + flipx = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0x01; + flipy = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0x02; + xpos = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+4]); + if (xpos >= 0x8000) xpos -= 0x10000; + ypos = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+3]); + if (ypos >= 0x8000) ypos -= 0x10000; + priority = (BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0xc0) >> 6; + + if (priority != layerpriority) continue; + + for (y = 0;y < sizey;y++) + { + for (x = 0;x < sizex;x++) + { + INT32 sx = xpos + 8*(flipx?(sizex-1-x):x); + INT32 sy = ypos + 8*(flipy?(sizey-1-y):y); + + if ((code + layout[y][x]) > 32767) break; + + sy -= 16; + + if (sx > 7 && sx < 248 && sy > 7 && sy < 216) { + if (!flipx) { + if (!flipy) { + Render8x8Tile_Mask(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); + } else { + Render8x8Tile_Mask_FlipY(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); + } + } else { + if (!flipy) { + Render8x8Tile_Mask_FlipX(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); + } else { + Render8x8Tile_Mask_FlipXY(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); + } + } + } else { + if (!flipx) { + if (!flipy) { + Render8x8Tile_Mask_Clip(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); + } + } else { + if (!flipy) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); + } else { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code + layout[y][x], sx, sy, color, 4, 0, 0, FstarfrcSpriteTiles); + } + } + } + } + } + } + } +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour >> 0) & 0x0f; + g = (nColour >> 4) & 0x0f; + b = (nColour >> 8) & 0x0f; + + r = (r << 4) | r; + g = (g << 4) | g; + b = (b << 4) | b; + + return BurnHighCol(r, g, b, 0); +} + +INT32 FstarfrcCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)FstarfrcPaletteRam, pd = FstarfrcPalette; i < 0x2000; i++, ps++, pd++) { + *pd = CalcCol(BURN_ENDIAN_SWAP_INT16(*ps)); + } + + return 0; +} + +void GinkunRender() +{ + FstarfrcCalcPalette(); + + for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { + pTransDraw[i] = 0x300; + } + + draw_sprites(3); + GinkunRenderBgLayer(); + draw_sprites(2); + GinkunRenderFgLayer(); + draw_sprites(1); + FstarfrcRenderTextLayer(); + draw_sprites(0); + BurnTransferCopy(FstarfrcPalette); +} + +void FstarfrcRender() +{ + FstarfrcCalcPalette(); + + for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { + pTransDraw[i] = 0x300; + } + + draw_sprites(3); + FstarfrcRenderBgLayer(); + draw_sprites(2); + FstarfrcRenderFgLayer(); + draw_sprites(1); + FstarfrcRenderTextLayer(); + draw_sprites(0); + BurnTransferCopy(FstarfrcPalette); +} + +INT32 FstarfrcFrame() +{ + INT32 nInterleave = 10; + + if (FstarfrcReset) FstarfrcDoReset(); + + FstarfrcMakeInputs(); + + nCyclesTotal[0] = (24000000 / 2) / 60; + nCyclesTotal[1] = (8000000 / 2) / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + + SekOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) { + if (Ginkun || Riot) { + GinkunRender(); + } else { + FstarfrcRender(); + } + } + + return 0; +} + +static INT32 FstarfrcScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x02944; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); // Scan 68000 + ZetScan(nAction); // Scan Z80 + + MSM6295Scan(0, nAction); // Scan OKIM6295 + BurnYM2151Scan(nAction); + + // Scan critical driver variables + SCAN_VAR(FstarfrcSoundLatch); + SCAN_VAR(FstarfrcInput); + SCAN_VAR(FstarfrcDip); + SCAN_VAR(CharScrollX); + SCAN_VAR(CharScrollY); + SCAN_VAR(Scroll1X); + SCAN_VAR(Scroll1Y); + SCAN_VAR(Scroll2X); + SCAN_VAR(Scroll2Y); + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + } + + return 0; +} + +struct BurnDriver BurnDrvFstarfrc = { + "fstarfrc", NULL, NULL, NULL, "1992", + "Final Star Force (US)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, FstarfrcRomInfo, FstarfrcRomName, NULL, NULL, FstarfrcInputInfo, FstarfrcDIPInfo, + FstarfrcInit, FstarfrcExit, FstarfrcFrame, NULL, FstarfrcScan, + NULL, 0x2000, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvFstarfrcj = { + "fstarfrcj", "fstarfrc", NULL, NULL, "1992", + "Final Star Force (Japan)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, FstarfrcjRomInfo, FstarfrcjRomName, NULL, NULL, FstarfrcInputInfo, FstarfrcDIPInfo, + FstarfrcInit, FstarfrcExit, FstarfrcFrame, NULL, FstarfrcScan, + NULL, 0x2000, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGinkun = { + "ginkun", NULL, NULL, NULL, "1995", + "Ganbare Ginkun\0", "Imperfect GFX", "Tecmo", "Miscellaneous", + L"\u304C\u3093\u3070\u308C \u30AE\u30F3\u304F\u3093\0Ganbare Ginkun\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, GinkunRomInfo, GinkunRomName, NULL, NULL, FstarfrcInputInfo, GinkunDIPInfo, + FstarfrcInit, FstarfrcExit, FstarfrcFrame, NULL, FstarfrcScan, + NULL, 0x2000, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvRiot = { + "riot", NULL, NULL, NULL, "1992", + "Riot\0", NULL, "NMK", "Miscellaneous", + L"\u96F7\u8ECB\u6597 Riot\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0, + NULL, RiotRomInfo, RiotRomName, NULL, NULL, RiotInputInfo, RiotDIPInfo, + FstarfrcInit, FstarfrcExit, FstarfrcFrame, NULL, FstarfrcScan, + NULL, 0x2000, 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_funybubl.cpp b/src/burn/drv/pst90s/d_funybubl.cpp index 126ec3452..a9ab117a2 100644 --- a/src/burn/drv/pst90s/d_funybubl.cpp +++ b/src/burn/drv/pst90s/d_funybubl.cpp @@ -1,626 +1,624 @@ -// FB Alpha Funny Bubble driver module -// Based on MAME driver by Pierpaolo Prazzoli and David Haywood - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "msm6295.h" - -// To do: -// Fix sound after save state - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvSndROM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvVidRAM; - -static UINT8 DrvReset; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[1]; -static UINT8 DrvInps[3]; - -static UINT32 *DrvPalette; -static UINT32 *Palette; - -static UINT8 DrvRecalc; - -static UINT8 soundlatch; -static INT32 nDrvRomBank; -static INT32 nDrvVidRAMBank; -static INT32 nDrvOkiBank; - -static struct BurnInputInfo FunybublInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Funybubl) - - -static struct BurnDIPInfo FunybublDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0x3f, NULL }, - - {0 , 0xfe, 0 , 8, "Coin_A" }, - {0x0f, 0x01, 0x07, 0x01, "3 Coins 1 Credits " }, - {0x0f, 0x01, 0x07, 0x02, "2 Coins 1 Credits " }, - {0x0f, 0x01, 0x07, 0x03, "3 Coins 2 Credits " }, - {0x0f, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, - {0x0f, 0x01, 0x07, 0x04, "2 Coins 3 Credits " }, - {0x0f, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, - {0x0f, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, - {0x0f, 0x01, 0x07, 0x00, "Free_Play" }, - - {0 , 0xfe, 0 , 7, "Difficulty" }, - {0x0f, 0x01, 0x38, 0x30, "Very_Easy" }, - {0x0f, 0x01, 0x38, 0x28, "Easy" }, - {0x0f, 0x01, 0x38, 0x38, "Normal" }, - {0x0f, 0x01, 0x38, 0x20, "Hard 1" }, - {0x0f, 0x01, 0x38, 0x18, "Hard 2" }, - {0x0f, 0x01, 0x38, 0x10, "Hard 3" }, - {0x0f, 0x01, 0x38, 0x08, "Hard 4" }, - - {0 , 0xfe, 0 , 2, "Demo_Sounds" }, - {0x0f, 0x01, 0x40, 0x40, "Off" }, - {0x0f, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Nudity" }, - {0x0f, 0x01, 0x80, 0x80, "Semi" }, - {0x0f, 0x01, 0x80, 0x00, "Full" }, -}; - -STDDIPINFO(Funybubl) - - -UINT8 __fastcall funybubl_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - case 0x02: - return DrvInps[port & 3]; - - case 0x03: - return DrvDips[0]; - - case 0x06: - return 0; - } - - return 0; -} - -void __fastcall funybubl_write(UINT16 address, UINT8 data) -{ - if (address >= 0xc400 && address <= 0xcfff) { - - INT32 offset = address - 0xc400; - - DrvPalRAM[offset] = data; - - UINT32 coldat; - - offset &= 0xfffc; - - coldat = DrvPalRAM[offset] | (DrvPalRAM[offset+1] << 8) | (DrvPalRAM[offset+2] << 16) | (DrvPalRAM[offset+3] << 24); - - UINT8 r, g, b; - - r = (coldat >> 12) << 2; - r |= r >> 6; - - g = (coldat >> 0) << 2; - g |= g >> 6; - - b = (coldat >> 6) << 2; - b |= b >> 6; - - Palette[offset >> 2] = (r << 16) | (g << 8) | b; - DrvPalette[offset >> 2] = BurnHighCol(r, g, b, 0); - - return; - } -} - -static void funybubl_set_vidram_bank(INT32 data) -{ - nDrvVidRAMBank = data & 1; - - ZetMapArea(0xd000, 0xdfff, 0, DrvVidRAM + nDrvVidRAMBank * 0x1000); - ZetMapArea(0xd000, 0xdfff, 1, DrvVidRAM + nDrvVidRAMBank * 0x1000); - ZetMapArea(0xd000, 0xdfff, 2, DrvVidRAM + nDrvVidRAMBank * 0x1000); -} - -static void funybubl_set_rom_bank(INT32 data) -{ - nDrvRomBank = data & 0x3f; - - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + nDrvRomBank * 0x4000); - ZetMapArea(0x8000, 0xbfff, 1, DrvZ80ROM0 + nDrvRomBank * 0x4000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + nDrvRomBank * 0x4000); -} - -static void funybubl_set_oki_bank(INT32 data) -{ - nDrvOkiBank = data & 1; - - MSM6295ROM = DrvSndROM + nDrvOkiBank * 0x40000; -} - -void __fastcall funybubl_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - funybubl_set_vidram_bank(data); - return; - - case 0x01: - funybubl_set_rom_bank(data); - return; - - case 0x03: - soundlatch = data; - - ZetClose(); - ZetOpen(1); - ZetRaiseIrq(0); - ZetClose(); - ZetOpen(0); - return; - - case 0x06: - case 0x07: - return; - } -} - -void __fastcall funybubl_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x9000: - funybubl_set_oki_bank(data); - return; - - case 0x9800: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall funybubl_sound_read(UINT16 address) -{ - switch (address) - { - case 0x9800: - return MSM6295ReadStatus(0); - - case 0xa000: - return soundlatch; - } - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[8] = { 0x200000 * 3, 0x200000 * 2, 0x200000 * 1, 0x200000 * 0, - 0x200000 * 7, 0x200000 * 6, 0x200000 * 5, 0x200000 * 4 }; - INT32 XOffs0[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; - INT32 YOffs0[8] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }; - - INT32 Plane1[8] = { 0x400000 * 3 + 4, 0x400000 * 3 + 0, 0x400000 * 2 + 4, 0x400000 * 2 + 0, - 0x400000 * 1 + 4, 0x400000 * 1 + 0, 0x400000 * 0 + 4, 0x400000 * 0 + 0 }; - INT32 XOffs1[16] = { 0, 1,2,3, 8,9,10,11, 256,257,258,259, 264,265,266,267 }; - INT32 YOffs1[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, - 8*16, 9*16,10*16,11*16,12*16,13*16,14*16,15*16 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x200000); - - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x200000; i++) { // invert - DrvGfxROM0[i] ^= 0xff; - DrvGfxROM1[i] ^= 0xff; - } - - memcpy (tmp, DrvGfxROM0, 0x200000); - - GfxDecode(0x8000, 8, 8, 8, Plane0, XOffs0, YOffs0, 0x040, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x200000); - - GfxDecode(0x2000, 8, 16, 16, Plane1, XOffs1, YOffs1, 0x200, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x040000; - DrvZ80ROM1 = Next; Next += 0x008000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x080000; - - DrvGfxROM0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x200000; - - DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x002000; - DrvPalRAM = Next; Next += 0x000c00; - DrvVidRAM = Next; Next += 0x002000; - - DrvZ80RAM1 = Next; Next += 0x000800; - - Palette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - funybubl_set_vidram_bank(0); - funybubl_set_rom_bank(0); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - funybubl_set_oki_bank(0); - MSM6295Reset(0); - - soundlatch = 0; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0, 0, 1)) return 1; - - for (INT32 i = 0; i < 8; i++) - if (BurnLoadRom(DrvGfxROM0 + i * 0x40000, i + 1, 1)) return 1; - - for (INT32 i = 0; i < 4; i++) - if (BurnLoadRom(DrvGfxROM1 + i * 0x80000, i + 9, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1, 13, 1)) return 1; - - if (BurnLoadRom(DrvSndROM, 14, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x20000, 15, 1)) return 1; - - memcpy (DrvSndROM + 0x60000, DrvSndROM + 0x40000, 0x20000); - memcpy (DrvSndROM + 0x40000, DrvSndROM + 0x00000, 0x20000); - - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0xc400, 0xcfff, 0, DrvPalRAM); - ZetMapArea(0xc400, 0xcfff, 2, DrvPalRAM); - ZetMapArea(0xe000, 0xffff, 0, DrvZ80RAM0); - ZetMapArea(0xe000, 0xffff, 1, DrvZ80RAM0); - ZetMapArea(0xe000, 0xffff, 2, DrvZ80RAM0); - ZetSetWriteHandler(funybubl_write); - ZetSetOutHandler(funybubl_out); - ZetSetInHandler(funybubl_in); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); - ZetSetWriteHandler(funybubl_sound_write); - ZetSetReadHandler(funybubl_sound_read); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 1056000 / 132, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - MSM6295Exit(0); - - ZetExit(); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - return 0; -} - -static void draw_sprites() -{ - UINT8 *source = &DrvVidRAM[0x2000-0x20]; - UINT8 *finish = source - 0x1000; - - while (source > finish) - { - INT32 sx, sy, code; - - sy = source[2]; - sx = source[3]; - code = source[0] | ( (source[1] & 0x0f) <<8); - if (source[1] & 0x80) code += 0x1000; - if (source[1] & 0x20) { if (sx < 0xe0) sx += 0x100; } - - sx -= 96; - sy -= 16; - - if ((sx >= 0 && sx < 305) || (sy >= 0 && sy < 208)) { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, 0, 8, 0xff, 0, DrvGfxROM1); - } - - source -= 0x20; - } -} - -static void draw_background() -{ - for (INT32 offs = 0; offs < 0x1000; offs+=2) - { - INT32 sx = ((offs >> 1) & 0x3f) << 3; - INT32 sy = (offs >> 7) << 3; - - sx -= 96; - sy -= 16; - if (sx < 0 || sx > 312 || sy < 0 || sy > 216) continue; - - INT32 code = DrvVidRAM[offs] | (DrvVidRAM[offs + 1] << 8); - - Render8x8Tile_Mask_Clip(pTransDraw, code & 0x7fff, sx, sy, 1+(code>>15), 8, 0, 0, DrvGfxROM0); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x300; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); - - draw_background(); - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInps, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInps[0] ^= (DrvJoy1[i] & 1) << i; - DrvInps[1] ^= (DrvJoy2[i] & 1) << i; - DrvInps[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { 6000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment; - - ZetOpen(0); - nSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); - nCyclesDone[0] += ZetRun(nSegment); - if (i == (nInterleave - 1)) ZetRaiseIrq(0); - ZetClose(); - - ZetOpen(1); - nSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i); - nCyclesDone[1] += ZetRun(nSegment); - ZetClose(); - } - - if (pBurnSoundOut) { - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029697; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - - MSM6295Scan(0, nAction); - - SCAN_VAR(soundlatch); - SCAN_VAR(nDrvOkiBank); - SCAN_VAR(nDrvRomBank); - SCAN_VAR(nDrvVidRAMBank); - } - - if (nAction & ACB_WRITE) { - funybubl_set_oki_bank(nDrvOkiBank); - funybubl_set_rom_bank(nDrvRomBank); - funybubl_set_vidram_bank(nDrvVidRAMBank); - } - - return 0; -} - -// Funny Bubble - -static struct BurnRomInfo funybublRomDesc[] = { - { "a.ub16", 0x40000, 0x4e799cdd, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "f.ug13", 0x40000, 0x64d7163d, 2 | BRF_GRA }, // 1 Background Tiles - { "g.uh13", 0x40000, 0x6891e2b8, 2 | BRF_GRA }, // 2 - { "h.ug15", 0x40000, 0xca7f7528, 2 | BRF_GRA }, // 3 - { "i.uh15", 0x40000, 0x23608ec6, 2 | BRF_GRA }, // 4 - { "l.ug16", 0x40000, 0x0acf8143, 2 | BRF_GRA }, // 5 - { "m.uh16", 0x40000, 0x55ed8d9c, 2 | BRF_GRA }, // 6 - { "n.ug17", 0x40000, 0x52398b68, 2 | BRF_GRA }, // 7 - { "o.uh17", 0x40000, 0x446e31b2, 2 | BRF_GRA }, // 8 - - { "d.ug1", 0x80000, 0xb7ebbc00, 3 | BRF_GRA }, // 9 Sprites - { "e.ug2", 0x80000, 0x28afc396, 3 | BRF_GRA }, // 10 - { "j.ug3", 0x80000, 0x9e8687cd, 3 | BRF_GRA }, // 11 - { "k.ug4", 0x80000, 0x63f0e810, 3 | BRF_GRA }, // 12 - - { "p.su6", 0x08000, 0x33169d4d, 4 | BRF_PRG | BRF_ESS }, // 13 Z80 #1 Code - - { "b.su12", 0x20000, 0xa2d780f4, 5 | BRF_SND }, // 14 Samples - { "c.su13", 0x40000, 0x1f7e9269, 5 | BRF_SND }, // 15 -}; - -STD_ROM_PICK(funybubl) -STD_ROM_FN(funybubl) - -struct BurnDriver BurnDrvFunybubl = { - "funybubl", NULL, NULL, NULL, "1999", - "Funny Bubble\0", NULL, "In Chang Electronic Co", "misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, funybublRomInfo, funybublRomName, NULL, NULL, FunybublInputInfo, FunybublDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, - 320, 224, 4, 3 -}; - - -// Funny Bubble (Comad version) - -static struct BurnRomInfo funybubcRomDesc[] = { - { "2.ub16", 0x40000, 0xd684c13f, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "7.ug12", 0x40000, 0x87603d7b, 2 | BRF_GRA }, // 1 Background Tiles - { "8.uh13", 0x40000, 0xab6031bd, 2 | BRF_GRA }, // 2 - { "9.ug15", 0x40000, 0x0e8352ff, 2 | BRF_GRA }, // 3 - { "10.uh15", 0x40000, 0xdf7dd356, 2 | BRF_GRA }, // 4 - { "13.ug16", 0x40000, 0x9f57bdd5, 2 | BRF_GRA }, // 5 - { "14.uh16", 0x40000, 0x2ac15ea3, 2 | BRF_GRA }, // 6 - { "15.ug17", 0x40000, 0x9a5e66a6, 2 | BRF_GRA }, // 7 - { "16.uh17", 0x40000, 0x218060b3, 2 | BRF_GRA }, // 8 - - { "5.ug1", 0x80000, 0xb7ebbc00, 3 | BRF_GRA }, // 9 Sprites - { "6.ug2", 0x80000, 0x28afc396, 3 | BRF_GRA }, // 10 - { "11.ug3", 0x80000, 0x9e8687cd, 3 | BRF_GRA }, // 11 - { "12.ug4", 0x80000, 0x63f0e810, 3 | BRF_GRA }, // 12 - - { "1.su6", 0x08000, 0x33169d4d, 4 | BRF_PRG | BRF_ESS }, // 13 Z80 #1 Code - - { "3.su12", 0x20000, 0xa2d780f4, 5 | BRF_SND }, // 14 Samples - { "4.su13", 0x40000, 0x1f7e9269, 5 | BRF_SND }, // 15 -}; - -STD_ROM_PICK(funybubc) -STD_ROM_FN(funybubc) - -struct BurnDriver BurnDrvFunybubc = { - "funybublc", "funybubl", NULL, NULL, "1999", - "Funny Bubble (Comad version)\0", NULL, "Comad Industry Co Ltd", "misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, funybubcRomInfo, funybubcRomName, NULL, NULL, FunybublInputInfo, FunybublDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, - 320, 224, 4, 3 -}; +// FB Alpha Funny Bubble driver module +// Based on MAME driver by Pierpaolo Prazzoli and David Haywood + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "msm6295.h" + +// To do: +// Fix sound after save state + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvSndROM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvVidRAM; + +static UINT8 DrvReset; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[1]; +static UINT8 DrvInps[3]; + +static UINT32 *DrvPalette; +static UINT32 *Palette; + +static UINT8 DrvRecalc; + +static UINT8 soundlatch; +static INT32 nDrvRomBank; +static INT32 nDrvVidRAMBank; +static INT32 nDrvOkiBank; + +static struct BurnInputInfo FunybublInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Funybubl) + + +static struct BurnDIPInfo FunybublDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0x3f, NULL }, + + {0 , 0xfe, 0 , 8, "Coin_A" }, + {0x0f, 0x01, 0x07, 0x01, "3 Coins 1 Credits " }, + {0x0f, 0x01, 0x07, 0x02, "2 Coins 1 Credits " }, + {0x0f, 0x01, 0x07, 0x03, "3 Coins 2 Credits " }, + {0x0f, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, + {0x0f, 0x01, 0x07, 0x04, "2 Coins 3 Credits " }, + {0x0f, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, + {0x0f, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, + {0x0f, 0x01, 0x07, 0x00, "Free_Play" }, + + {0 , 0xfe, 0 , 7, "Difficulty" }, + {0x0f, 0x01, 0x38, 0x30, "Very_Easy" }, + {0x0f, 0x01, 0x38, 0x28, "Easy" }, + {0x0f, 0x01, 0x38, 0x38, "Normal" }, + {0x0f, 0x01, 0x38, 0x20, "Hard 1" }, + {0x0f, 0x01, 0x38, 0x18, "Hard 2" }, + {0x0f, 0x01, 0x38, 0x10, "Hard 3" }, + {0x0f, 0x01, 0x38, 0x08, "Hard 4" }, + + {0 , 0xfe, 0 , 2, "Demo_Sounds" }, + {0x0f, 0x01, 0x40, 0x40, "Off" }, + {0x0f, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Nudity" }, + {0x0f, 0x01, 0x80, 0x80, "Semi" }, + {0x0f, 0x01, 0x80, 0x00, "Full" }, +}; + +STDDIPINFO(Funybubl) + + +UINT8 __fastcall funybubl_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + case 0x02: + return DrvInps[port & 3]; + + case 0x03: + return DrvDips[0]; + + case 0x06: + return 0; + } + + return 0; +} + +void __fastcall funybubl_write(UINT16 address, UINT8 data) +{ + if (address >= 0xc400 && address <= 0xcfff) { + + INT32 offset = address - 0xc400; + + DrvPalRAM[offset] = data; + + UINT32 coldat; + + offset &= 0xfffc; + + coldat = DrvPalRAM[offset] | (DrvPalRAM[offset+1] << 8) | (DrvPalRAM[offset+2] << 16) | (DrvPalRAM[offset+3] << 24); + + UINT8 r, g, b; + + r = (coldat >> 12) << 2; + r |= r >> 6; + + g = (coldat >> 0) << 2; + g |= g >> 6; + + b = (coldat >> 6) << 2; + b |= b >> 6; + + Palette[offset >> 2] = (r << 16) | (g << 8) | b; + DrvPalette[offset >> 2] = BurnHighCol(r, g, b, 0); + + return; + } +} + +static void funybubl_set_vidram_bank(INT32 data) +{ + nDrvVidRAMBank = data & 1; + + ZetMapArea(0xd000, 0xdfff, 0, DrvVidRAM + nDrvVidRAMBank * 0x1000); + ZetMapArea(0xd000, 0xdfff, 1, DrvVidRAM + nDrvVidRAMBank * 0x1000); + ZetMapArea(0xd000, 0xdfff, 2, DrvVidRAM + nDrvVidRAMBank * 0x1000); +} + +static void funybubl_set_rom_bank(INT32 data) +{ + nDrvRomBank = data & 0x3f; + + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + nDrvRomBank * 0x4000); + ZetMapArea(0x8000, 0xbfff, 1, DrvZ80ROM0 + nDrvRomBank * 0x4000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + nDrvRomBank * 0x4000); +} + +static void funybubl_set_oki_bank(INT32 data) +{ + nDrvOkiBank = data & 1; + + MSM6295ROM = DrvSndROM + nDrvOkiBank * 0x40000; +} + +void __fastcall funybubl_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + funybubl_set_vidram_bank(data); + return; + + case 0x01: + funybubl_set_rom_bank(data); + return; + + case 0x03: + soundlatch = data; + + ZetClose(); + ZetOpen(1); + ZetRaiseIrq(0); + ZetClose(); + ZetOpen(0); + return; + + case 0x06: + case 0x07: + return; + } +} + +void __fastcall funybubl_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x9000: + funybubl_set_oki_bank(data); + return; + + case 0x9800: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall funybubl_sound_read(UINT16 address) +{ + switch (address) + { + case 0x9800: + return MSM6295ReadStatus(0); + + case 0xa000: + return soundlatch; + } + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[8] = { 0x200000 * 3, 0x200000 * 2, 0x200000 * 1, 0x200000 * 0, + 0x200000 * 7, 0x200000 * 6, 0x200000 * 5, 0x200000 * 4 }; + INT32 XOffs0[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + INT32 YOffs0[8] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }; + + INT32 Plane1[8] = { 0x400000 * 3 + 4, 0x400000 * 3 + 0, 0x400000 * 2 + 4, 0x400000 * 2 + 0, + 0x400000 * 1 + 4, 0x400000 * 1 + 0, 0x400000 * 0 + 4, 0x400000 * 0 + 0 }; + INT32 XOffs1[16] = { 0, 1,2,3, 8,9,10,11, 256,257,258,259, 264,265,266,267 }; + INT32 YOffs1[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, + 8*16, 9*16,10*16,11*16,12*16,13*16,14*16,15*16 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x200000); + + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x200000; i++) { // invert + DrvGfxROM0[i] ^= 0xff; + DrvGfxROM1[i] ^= 0xff; + } + + memcpy (tmp, DrvGfxROM0, 0x200000); + + GfxDecode(0x8000, 8, 8, 8, Plane0, XOffs0, YOffs0, 0x040, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x200000); + + GfxDecode(0x2000, 8, 16, 16, Plane1, XOffs1, YOffs1, 0x200, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x040000; + DrvZ80ROM1 = Next; Next += 0x008000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x080000; + + DrvGfxROM0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x200000; + + DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x002000; + DrvPalRAM = Next; Next += 0x000c00; + DrvVidRAM = Next; Next += 0x002000; + + DrvZ80RAM1 = Next; Next += 0x000800; + + Palette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + funybubl_set_vidram_bank(0); + funybubl_set_rom_bank(0); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + funybubl_set_oki_bank(0); + MSM6295Reset(0); + + soundlatch = 0; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0, 0, 1)) return 1; + + for (INT32 i = 0; i < 8; i++) + if (BurnLoadRom(DrvGfxROM0 + i * 0x40000, i + 1, 1)) return 1; + + for (INT32 i = 0; i < 4; i++) + if (BurnLoadRom(DrvGfxROM1 + i * 0x80000, i + 9, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1, 13, 1)) return 1; + + if (BurnLoadRom(DrvSndROM, 14, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x20000, 15, 1)) return 1; + + memcpy (DrvSndROM + 0x60000, DrvSndROM + 0x40000, 0x20000); + memcpy (DrvSndROM + 0x40000, DrvSndROM + 0x00000, 0x20000); + + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0xc400, 0xcfff, 0, DrvPalRAM); + ZetMapArea(0xc400, 0xcfff, 2, DrvPalRAM); + ZetMapArea(0xe000, 0xffff, 0, DrvZ80RAM0); + ZetMapArea(0xe000, 0xffff, 1, DrvZ80RAM0); + ZetMapArea(0xe000, 0xffff, 2, DrvZ80RAM0); + ZetSetWriteHandler(funybubl_write); + ZetSetOutHandler(funybubl_out); + ZetSetInHandler(funybubl_in); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); + ZetSetWriteHandler(funybubl_sound_write); + ZetSetReadHandler(funybubl_sound_read); + ZetClose(); + + MSM6295Init(0, 1056000 / 132, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + MSM6295Exit(0); + + ZetExit(); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + return 0; +} + +static void draw_sprites() +{ + UINT8 *source = &DrvVidRAM[0x2000-0x20]; + UINT8 *finish = source - 0x1000; + + while (source > finish) + { + INT32 sx, sy, code; + + sy = source[2]; + sx = source[3]; + code = source[0] | ( (source[1] & 0x0f) <<8); + if (source[1] & 0x80) code += 0x1000; + if (source[1] & 0x20) { if (sx < 0xe0) sx += 0x100; } + + sx -= 96; + sy -= 16; + + if ((sx >= 0 && sx < 305) || (sy >= 0 && sy < 208)) { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, 0, 8, 0xff, 0, DrvGfxROM1); + } + + source -= 0x20; + } +} + +static void draw_background() +{ + for (INT32 offs = 0; offs < 0x1000; offs+=2) + { + INT32 sx = ((offs >> 1) & 0x3f) << 3; + INT32 sy = (offs >> 7) << 3; + + sx -= 96; + sy -= 16; + if (sx < 0 || sx > 312 || sy < 0 || sy > 216) continue; + + INT32 code = DrvVidRAM[offs] | (DrvVidRAM[offs + 1] << 8); + + Render8x8Tile_Mask_Clip(pTransDraw, code & 0x7fff, sx, sy, 1+(code>>15), 8, 0, 0, DrvGfxROM0); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x300; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); + + draw_background(); + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInps, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInps[0] ^= (DrvJoy1[i] & 1) << i; + DrvInps[1] ^= (DrvJoy2[i] & 1) << i; + DrvInps[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { 6000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment; + + ZetOpen(0); + nSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); + nCyclesDone[0] += ZetRun(nSegment); + if (i == (nInterleave - 1)) ZetRaiseIrq(0); + ZetClose(); + + ZetOpen(1); + nSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i); + nCyclesDone[1] += ZetRun(nSegment); + ZetClose(); + } + + if (pBurnSoundOut) { + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029697; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + + MSM6295Scan(0, nAction); + + SCAN_VAR(soundlatch); + SCAN_VAR(nDrvOkiBank); + SCAN_VAR(nDrvRomBank); + SCAN_VAR(nDrvVidRAMBank); + } + + if (nAction & ACB_WRITE) { + funybubl_set_oki_bank(nDrvOkiBank); + funybubl_set_rom_bank(nDrvRomBank); + funybubl_set_vidram_bank(nDrvVidRAMBank); + } + + return 0; +} + +// Funny Bubble + +static struct BurnRomInfo funybublRomDesc[] = { + { "a.ub16", 0x40000, 0x4e799cdd, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "f.ug13", 0x40000, 0x64d7163d, 2 | BRF_GRA }, // 1 Background Tiles + { "g.uh13", 0x40000, 0x6891e2b8, 2 | BRF_GRA }, // 2 + { "h.ug15", 0x40000, 0xca7f7528, 2 | BRF_GRA }, // 3 + { "i.uh15", 0x40000, 0x23608ec6, 2 | BRF_GRA }, // 4 + { "l.ug16", 0x40000, 0x0acf8143, 2 | BRF_GRA }, // 5 + { "m.uh16", 0x40000, 0x55ed8d9c, 2 | BRF_GRA }, // 6 + { "n.ug17", 0x40000, 0x52398b68, 2 | BRF_GRA }, // 7 + { "o.uh17", 0x40000, 0x446e31b2, 2 | BRF_GRA }, // 8 + + { "d.ug1", 0x80000, 0xb7ebbc00, 3 | BRF_GRA }, // 9 Sprites + { "e.ug2", 0x80000, 0x28afc396, 3 | BRF_GRA }, // 10 + { "j.ug3", 0x80000, 0x9e8687cd, 3 | BRF_GRA }, // 11 + { "k.ug4", 0x80000, 0x63f0e810, 3 | BRF_GRA }, // 12 + + { "p.su6", 0x08000, 0x33169d4d, 4 | BRF_PRG | BRF_ESS }, // 13 Z80 #1 Code + + { "b.su12", 0x20000, 0xa2d780f4, 5 | BRF_SND }, // 14 Samples + { "c.su13", 0x40000, 0x1f7e9269, 5 | BRF_SND }, // 15 +}; + +STD_ROM_PICK(funybubl) +STD_ROM_FN(funybubl) + +struct BurnDriver BurnDrvFunybubl = { + "funybubl", NULL, NULL, NULL, "1999", + "Funny Bubble\0", NULL, "In Chang Electronic Co", "misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, funybublRomInfo, funybublRomName, NULL, NULL, FunybublInputInfo, FunybublDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, + 320, 224, 4, 3 +}; + + +// Funny Bubble (Comad version) + +static struct BurnRomInfo funybubcRomDesc[] = { + { "2.ub16", 0x40000, 0xd684c13f, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "7.ug12", 0x40000, 0x87603d7b, 2 | BRF_GRA }, // 1 Background Tiles + { "8.uh13", 0x40000, 0xab6031bd, 2 | BRF_GRA }, // 2 + { "9.ug15", 0x40000, 0x0e8352ff, 2 | BRF_GRA }, // 3 + { "10.uh15", 0x40000, 0xdf7dd356, 2 | BRF_GRA }, // 4 + { "13.ug16", 0x40000, 0x9f57bdd5, 2 | BRF_GRA }, // 5 + { "14.uh16", 0x40000, 0x2ac15ea3, 2 | BRF_GRA }, // 6 + { "15.ug17", 0x40000, 0x9a5e66a6, 2 | BRF_GRA }, // 7 + { "16.uh17", 0x40000, 0x218060b3, 2 | BRF_GRA }, // 8 + + { "5.ug1", 0x80000, 0xb7ebbc00, 3 | BRF_GRA }, // 9 Sprites + { "6.ug2", 0x80000, 0x28afc396, 3 | BRF_GRA }, // 10 + { "11.ug3", 0x80000, 0x9e8687cd, 3 | BRF_GRA }, // 11 + { "12.ug4", 0x80000, 0x63f0e810, 3 | BRF_GRA }, // 12 + + { "1.su6", 0x08000, 0x33169d4d, 4 | BRF_PRG | BRF_ESS }, // 13 Z80 #1 Code + + { "3.su12", 0x20000, 0xa2d780f4, 5 | BRF_SND }, // 14 Samples + { "4.su13", 0x40000, 0x1f7e9269, 5 | BRF_SND }, // 15 +}; + +STD_ROM_PICK(funybubc) +STD_ROM_FN(funybubc) + +struct BurnDriver BurnDrvFunybubc = { + "funybublc", "funybubl", NULL, NULL, "1999", + "Funny Bubble (Comad version)\0", NULL, "Comad Industry Co Ltd", "misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, funybubcRomInfo, funybubcRomName, NULL, NULL, FunybublInputInfo, FunybublDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_fuukifg3.cpp b/src/burn/drv/pst90s/d_fuukifg3.cpp index 12d17247b..1bd078bab 100644 --- a/src/burn/drv/pst90s/d_fuukifg3.cpp +++ b/src/burn/drv/pst90s/d_fuukifg3.cpp @@ -1,1306 +1,1305 @@ -// FB Alpha Fuuki FG-3 driver module -// Based on MAME driver by Paul Priest and David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ymf278b.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf0; -static UINT8 *DrvSprBuf1; -static UINT8 *DrvFgRAM1; -static UINT8 *DrvFgRAM2; -static UINT8 *DrvBgRAM1; -static UINT8 *DrvBgRAM2; -static UINT8 *DrvVidRegs; -static UINT8 *DrvShareRAM; -static UINT8 *DrvZ80RAM; -static UINT32 *DrvScrollBuf; -static UINT8 *DrvTransTab1; -static UINT8 *DrvTransTab2; -static UINT8 *DrvTransTab3; - -static UINT16 *DrvRasterPos; -static UINT8 *nDrvZ80Bank; -static UINT16 *tilebank; -static UINT16 *tilebank_buf; -static UINT8 *priority; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT16 DrvInputs[4]; -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[4]; -static UINT8 DrvReset; - -static INT32 nEnableRaster[3]; - -static struct BurnInputInfo AsurabldInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 4, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 5, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 8, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 9, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 10, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 11, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 14, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 8, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Asurabld) - -static struct BurnDIPInfo AsurabldDIPList[]= -{ - {0x14, 0xff, 0xff, 0x3f, NULL }, - {0x15, 0xff, 0xff, 0x7f, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Blood Colour" }, - {0x14, 0x01, 0x02, 0x02, "Red" }, - {0x14, 0x01, 0x02, 0x00, "Green" }, - - {0 , 0xfe, 0 , 4, "Timer" }, - {0x14, 0x01, 0x30, 0x00, "Slow" }, - {0x14, 0x01, 0x30, 0x30, "Medium" }, - {0x14, 0x01, 0x30, 0x10, "Fast" }, - {0x14, 0x01, 0x30, 0x20, "Very Fast" }, - - {0 , 0xfe, 0 , 2, "Coinage Mode" }, - {0x14, 0x01, 0xc0, 0xc0, "Split" }, - {0x14, 0x01, 0xc0, 0x00, "Joint" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x15, 0x01, 0x01, 0x01, "Off" }, -// {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Computer Level" }, - {0x15, 0x01, 0x0e, 0x00, "0" }, - {0x15, 0x01, 0x0e, 0x08, "1" }, - {0x15, 0x01, 0x0e, 0x04, "2" }, - {0x15, 0x01, 0x0e, 0x0c, "3" }, - {0x15, 0x01, 0x0e, 0x0e, "4" }, - {0x15, 0x01, 0x0e, 0x02, "5" }, - {0x15, 0x01, 0x0e, 0x0a, "6" }, - {0x15, 0x01, 0x0e, 0x06, "7" }, - - {0 , 0xfe, 0 , 4, "Damage" }, - {0x15, 0x01, 0x30, 0x20, "Lowest" }, - {0x15, 0x01, 0x30, 0x30, "Low" }, - {0x15, 0x01, 0x30, 0x10, "Medium" }, - {0x15, 0x01, 0x30, 0x00, "High" }, - - {0 , 0xfe, 0 , 3, "Max Rounds" }, - {0x15, 0x01, 0xc0, 0x00, "1" }, - {0x15, 0x01, 0xc0, 0x40, "3" }, - {0x15, 0x01, 0xc0, 0x80, "5" }, - - {0 , 0xfe, 0 , 9, "Coin B" }, - {0x16, 0x01, 0x0f, 0x08, "8 Coins 1 Credits " }, - {0x16, 0x01, 0x0f, 0x09, "7 Coins 1 Credits " }, - {0x16, 0x01, 0x0f, 0x0a, "6 Coins 1 Credits " }, - {0x16, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits " }, - {0x16, 0x01, 0x0f, 0x0c, "4 Coins 1 Credits " }, - {0x16, 0x01, 0x0f, 0x0d, "3 Coins 1 Credits " }, - {0x16, 0x01, 0x0f, 0x0e, "2 Coins 1 Credits " }, - {0x16, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits " }, - {0x16, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 9, "Coin A" }, - {0x16, 0x01, 0xf0, 0x80, "8 Coins 1 Credits " }, - {0x16, 0x01, 0xf0, 0x90, "7 Coins 1 Credits " }, - {0x16, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits " }, - {0x16, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits " }, - {0x16, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits " }, - {0x16, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits " }, - {0x16, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits " }, - {0x16, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits " }, - {0x16, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Asurabld) - -static inline void cpu_sync() // sync z80 & 68k -{ - INT32 t = ((SekTotalCycles() * 3) / 10) - ZetTotalCycles(); - - if (t > 0) { - BurnTimerUpdate(t); - } -} - -void __fastcall fuuki32_write_long(UINT32 , UINT32 ) -{ - -} - -void __fastcall fuuki32_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xffffe0) == 0x8c0000) { - - if (address == 0x8c001c) { - DrvRasterPos[0] = data & 0xff; - } - - *((UINT16*)(DrvVidRegs + (address & 0x1e))) = BURN_ENDIAN_SWAP_INT16(data); - - return; - } - - if ((address & 0xffffe0) == 0x903fe0) { - cpu_sync(); - - DrvShareRAM[(address & 0x1f) >> 1] = data & 0xff; - return; - } - - switch (address) - { - case 0x8e0000: - priority[0] = data & 0x000f; - return; - - case 0xa00000: - tilebank[0] = data; - return; - } -} - -void __fastcall fuuki32_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xffffe0) == 0x903fe0) { - cpu_sync(); - - DrvShareRAM[(address & 0x1f) >> 1] = data; - return; - } -} - -UINT32 __fastcall fuuki32_read_long(UINT32) -{ - return 0; -} - -UINT16 __fastcall fuuki32_read_word(UINT32 address) -{ - switch (address) - { - case 0x800000: - return DrvInputs[0]; - - case 0x810000: - return DrvInputs[1]; - - case 0x880000: - return DrvInputs[2]; - - case 0x890000: - return DrvInputs[3]; - - case 0x8c001e: - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 0x1e))); - } - - return 0; -} - -UINT8 __fastcall fuuki32_read_byte(UINT32 address) -{ - if ((address & 0xffffe0) == 0x903fe0) { - cpu_sync(); - return DrvShareRAM[(address & 0x1f) >> 1]; - } - - return 0; -} - -static void bankswitch(INT32 data) -{ - nDrvZ80Bank[0] = data; - - INT32 nBank = (data & 0x0f) * 0x8000; - - ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + nBank); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + nBank); -} - -void __fastcall fuuki32_sound_write(UINT16 address, UINT8 data) -{ - if ((address & 0xfff0) == 0x7ff0) { - DrvShareRAM[address & 0x0f] = data; - return; - } -} - -UINT8 __fastcall fuuki32_sound_read(UINT16 address) -{ - if ((address & 0xfff0) == 0x7ff0) { - return DrvShareRAM[address & 0x0f]; - } - - return 0; -} - -void __fastcall fuuki32_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - bankswitch(data); - return; - - case 0x40: - case 0x42: - case 0x44: - BurnYMF278BSelectRegister((port >> 1) & 3, data); - return; - - case 0x41: - case 0x43: - case 0x45: - BurnYMF278BWriteRegister((port >> 1) & 3, data); - return; - } -} - -UINT8 __fastcall fuuki32_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x40: - return BurnYMF278BReadStatus(); - } - - return 0; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 6000000; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYMF278BReset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x200000; - DrvZ80ROM = Next; Next += 0x080000; - - DrvTransTab1 = Next; Next += 0x008000; - DrvTransTab2 = Next; Next += 0x008000; - DrvTransTab3 = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x4000000; - DrvGfxROM1 = Next; Next += 0x800000; - DrvGfxROM2 = Next; Next += 0x800000; - DrvGfxROM3 = Next; Next += 0x400000; - - DrvSndROM = Next; Next += 0x400000; - - DrvPalette = (UINT32 *)Next; Next += 0x2000 * sizeof(UINT32); - DrvScrollBuf = (UINT32 *)Next; Next += 256 * 4 * sizeof(UINT32); - DrvRasterPos = (UINT16*)Next; Next += 0x0001 * sizeof(UINT16); - - AllRam = Next; - - DrvVidRegs = Next; Next += 0x000400; - DrvShareRAM = Next; Next += 0x000010; - DrvZ80RAM = Next; Next += 0x001000; - - Drv68KRAM = Next; Next += 0x020000; - DrvPalRAM = Next; Next += 0x004000; - DrvFgRAM1 = Next; Next += 0x002000; - DrvFgRAM2 = Next; Next += 0x020000; - DrvBgRAM1 = Next; Next += 0x002000; - DrvBgRAM2 = Next; Next += 0x002000; - DrvSprRAM = Next; Next += 0x002000; - DrvSprBuf0 = Next; Next += 0x002000; - DrvSprBuf1 = Next; Next += 0x002000; - - priority = Next; Next += 0x000001; - - tilebank = (UINT16*)Next; Next += 0x0001 * sizeof(UINT16); - tilebank_buf = (UINT16*)Next; Next += 0x0002 * sizeof(UINT16); - - nDrvZ80Bank = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[ 8] = { 0x0000000, 0x0000001, 0x0000002, 0x0000003, - 0x2000000, 0x2000001, 0x2000002, 0x2000003 }; - INT32 XOffs[16] = { 0x008, 0x00c, 0x000, 0x004, 0x018, 0x01c, 0x010, 0x014, - 0x028, 0x02c, 0x020, 0x024, 0x038, 0x03c, 0x030, 0x034 }; - INT32 YOffs0[ 8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; - INT32 YOffs1[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, - 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; - - UINT8 *tmp = DrvGfxROM0 + 0x2000000; - - memcpy (tmp, DrvGfxROM1, 0x800000); - - GfxDecode(0x08000, 8, 16, 16, Plane, XOffs, YOffs1, 0x400, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x800000); - - GfxDecode(0x08000, 8, 16, 16, Plane, XOffs, YOffs1, 0x400, tmp, DrvGfxROM2); - - memcpy (tmp, DrvGfxROM3, 0x200000); - - GfxDecode(0x10000, 4, 8, 8, Plane, XOffs, YOffs0, 0x100, tmp, DrvGfxROM3); - - return 0; -} - -static void DrvSpriteExpand() -{ - BurnByteswap(DrvGfxROM0, 0x4000000); - UINT8 *tmp; - - for (INT32 i = 0x2000000 - 0x80; i >= 0; i -= 0x80) - { - tmp = DrvGfxROM0 + i; - - for (INT32 j = 0x7f; j >= 0; j--) { - INT32 t = tmp[j]; - DrvGfxROM0[((i + j) << 1) + 0] = t >> 4; - DrvGfxROM0[((i + j) << 1) + 1] = t & 0x0f; - } - } -} - -static void DrvCalculateTransTab(UINT8 *src, UINT8 *dst, INT32 t, INT32 w, INT32 len) -{ - UINT8 *dptr = dst; - for (INT32 i = 0; i < len; i+= w) - { - INT32 a = 0, b = 0; - for (INT32 j = 0; j < w; j++) { - a|=src[i+j]^t; - - if (src[i+j] != t) { - b++; - } - } - - dptr[0] = a ? 0 : 2; - if (b == w) dptr[0] |= 1; - - dptr++; - } -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x0000001, 0, 4)) return 1; - if (BurnLoadRom(Drv68KROM + 0x0000000, 1, 4)) return 1; - if (BurnLoadRom(Drv68KROM + 0x0000003, 2, 4)) return 1; - if (BurnLoadRom(Drv68KROM + 0x0000002, 3, 4)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 4, 1)) return 1; - - if (BurnLoadRom(DrvSndROM, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x0000000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0400000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x0000000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x0400000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x0000000, 10, 1)) return 1; - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "asurabld") == 0) { - if (BurnLoadRom(DrvGfxROM0 + 0x0400000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0800000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0c00000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x1000000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x1400000, 15, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x1800000, 16, 1)) return 1; - } else { - if (BurnLoadRom(DrvGfxROM0 + 0x0000000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0400000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0800000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0c00000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x1000000, 15, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x1400000, 16, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x1800000, 17, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x1c00000, 18, 1)) return 1; - } - - DrvGfxDecode(); - DrvSpriteExpand(); - - DrvCalculateTransTab(DrvGfxROM1, DrvTransTab1, 0xff, 0x100, 0x800000); - DrvCalculateTransTab(DrvGfxROM2, DrvTransTab2, 0xff, 0x100, 0x800000); - DrvCalculateTransTab(DrvGfxROM3, DrvTransTab3, 0x0f, 0x040, 0x400000); - } - - SekInit(0, 0x68ec020); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x410000, 0x41ffff, SM_RAM); - SekMapMemory(DrvBgRAM1, 0x500000, 0x501fff, SM_RAM); - SekMapMemory(DrvBgRAM2, 0x502000, 0x503fff, SM_RAM); - SekMapMemory(DrvFgRAM1, 0x504000, 0x505fff, SM_RAM); - SekMapMemory(DrvFgRAM2, 0x506000, 0x507fff, SM_RAM); - SekMapMemory(DrvFgRAM2 + 0x2000,0x508000, 0x517fff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x600000, 0x601fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x700000, 0x703fff, SM_RAM); - SekSetWriteLongHandler(0, fuuki32_write_long); - SekSetWriteWordHandler(0, fuuki32_write_word); - SekSetWriteByteHandler(0, fuuki32_write_byte); - SekSetReadLongHandler(0, fuuki32_read_long); - SekSetReadWordHandler(0, fuuki32_read_word); - SekSetReadByteHandler(0, fuuki32_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM); - ZetMapArea(0x6000, 0x6fff, 0, DrvZ80RAM); - ZetMapArea(0x6000, 0x6fff, 1, DrvZ80RAM); - ZetMapArea(0x6000, 0x6fff, 2, DrvZ80RAM); - ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + 0x8000); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + 0x8000); - ZetSetWriteHandler(fuuki32_sound_write); - ZetSetReadHandler(fuuki32_sound_read); - ZetSetOutHandler(fuuki32_sound_out); - ZetSetInHandler(fuuki32_sound_in); - ZetMemEnd(); - ZetClose(); - - BurnYMF278BInit(0, DrvSndROM, &DrvFMIRQHandler, DrvSynchroniseStream); - BurnYMF278BSetRoute(BURN_SND_YMF278B_YMF278B_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYMF278BSetRoute(BURN_SND_YMF278B_YMF278B_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - BurnTimerAttachZet(6000000); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYMF278BExit(); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_sprites(INT32 prio) -{ - UINT16 *src = (UINT16*)DrvSprBuf1; - - for (INT32 offs = 0; offs < 0x2000 / 2; offs += 4) - { - INT32 sx = BURN_ENDIAN_SWAP_INT16(src[offs + 0]); - INT32 sy = BURN_ENDIAN_SWAP_INT16(src[offs + 1]); - INT32 attr = BURN_ENDIAN_SWAP_INT16(src[offs + 2]); - INT32 code = BURN_ENDIAN_SWAP_INT16(src[offs + 3]); - - if (prio != ((attr >> 6) & 0x0003) || sx & 0x0400) continue; - - INT32 bank = (tilebank_buf[1] >> ((code >> 12) & 0x0c)) & 0xf; - - code = (code & 0x3fff) | (bank << 14); - - INT32 flipx = sx & 0x0800; - INT32 flipy = sy & 0x0800; - INT32 xnum = ((sx >> 12) & 0xf) + 1; - INT32 ynum = ((sy >> 12) & 0xf) + 1; - INT32 xzoom = 128 - ((attr >> 10) & 0x3c); - INT32 yzoom = 128 - ((attr >> 6) & 0x3c); - - sx = (sx & 0x1ff) - (sx & 0x200); - sy = (sy & 0x1ff) - (sy & 0x200); - - INT32 xstart, ystart, xend, yend, xinc, yinc; - if (flipx) { xstart = (xnum-1) * 16; xend = -16; xinc = -16; } - else { xstart = 0; xend = xnum * 16; xinc = +16; } - - if (flipy) { ystart = (ynum-1) * 16; yend = -16; yinc = -16; } - else { ystart = 0; yend = ynum * 16; yinc = +16; } - - for (INT32 y = ystart; y != yend; y += yinc) - { - for (INT32 x = xstart; x != xend; x += xinc) - { - if (xzoom == 128 && yzoom == 128) { - if (sx + x >= 0 && sx + x < nScreenWidth - 15 && sy + y >= 0 && sy + y < nScreenHeight - 15) { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); - } else { - Render16x16Tile_Mask_FlipY(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); - } else { - Render16x16Tile_Mask(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); - } - } - } else { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); - } - } - } - } else { - RenderZoomedTile(pTransDraw, DrvGfxROM0, code++, ((attr & 0x3f) << 4) | 0x800, 15, sx + (x * xzoom) / 128, sy + (y * yzoom) / 128, flipx, flipy, 16, 16, (xzoom + 8) << 9, (yzoom + 8) << 9); - } - } - } - } -} - -static void draw_background_layer(UINT8 *ram, UINT8 *gfx, UINT8 *tab, INT32 coloff, INT32 soff) -{ - INT32 yoff = (DrvScrollBuf[0x300] & 0xffff) - 0x1f3; - INT32 xoff = (DrvScrollBuf[0x300] >> 16) - 0x3f6; - INT32 scrolly = ((DrvScrollBuf[soff*256] & 0xffff) + yoff) & 0x1ff; - INT32 scrollx = ((DrvScrollBuf[soff*256] >> 16) + xoff) & 0x3ff; - - UINT16 *vram = (UINT16*)ram; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = (offs & 0x3f) << 4; - INT32 sy = (offs >> 6) << 4; - - sx -= scrollx; - if (sx < -15) sx += 1024; - sy -= scrolly; - if (sy < -15) sy += 512; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs*2]) & 0x7fff; - if (tab[code] == 2) continue; - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs*2 + 1]); - - INT32 color = (attr & 0x30) >> 4; - INT32 flipx = (attr >> 6) & 1; - INT32 flipy = (attr >> 7) & 1; - - if (sx >= 0 && sx < nScreenWidth - 15 && sy >= 0 && sy < nScreenHeight - 15) { - if (tab[code]) { - if (flipy) { - if (flipx) { - Render16x16Tile_FlipXY(pTransDraw, code, sx, sy, color, 8, coloff, gfx); - } else { - Render16x16Tile_FlipY(pTransDraw, code, sx, sy, color, 8, coloff, gfx); - } - } else { - if (flipx) { - Render16x16Tile_FlipX(pTransDraw, code, sx, sy, color, 8, coloff, gfx); - } else { - Render16x16Tile(pTransDraw, code, sx, sy, color, 8, coloff, gfx); - } - } - } else { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); - } else { - Render16x16Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); - } else { - Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); - } - } - } - } else { - if (sx >= nScreenWidth || sy >= nScreenWidth) continue; - - if (tab[code]) { - if (flipy) { - if (flipx) { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 8, coloff, gfx); - } else { - Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 8, coloff, gfx); - } - } else { - if (flipx) { - Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 8, coloff, gfx); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 8, coloff, gfx); - } - } - } else { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); - } - } - } - } - } -} - -static void draw_background_layer_byline(UINT8 *ram, UINT8 *gfx, UINT8 *tab, INT32 coloff, INT32 soff) -{ - UINT16 *vram = (UINT16*)ram; - UINT16 *dst = pTransDraw; - - for (INT32 y = 0; y < nScreenHeight; y++) - { - INT32 yoff = (DrvScrollBuf[0x300 + y] & 0xffff) - 0x1f3; - INT32 xoff = (DrvScrollBuf[0x300 + y] >> 16) - 0x3f6; - INT32 scrolly = ((DrvScrollBuf[(soff*256) + y] & 0xffff) + yoff + y) & 0x1ff; - INT32 scrollx = ((DrvScrollBuf[(soff*256) + y] >> 16) + xoff) & 0x3ff; - - INT32 yy = scrolly & 0x1f0; - INT32 yo = (scrolly & 0x0f) << 4; - INT32 xo = scrollx & 0x0f; - - for (INT32 x = 0; x < nScreenWidth + 16; x+=16) - { - INT32 xx = ((scrollx + x) >> 3) & 0x7e; - - INT32 ofst = (yy << 3) | xx; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst]) & 0x7fff; - if (tab[code] == 2) continue; - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[ofst + 1]); - - INT32 color = (attr & 0x30) << 4; - INT32 flipx = ((attr >> 6) & 1) * 0x0f; - INT32 flipy = ((attr >> 7) & 1) * 0xf0; - - color |= coloff; - - UINT8 *src = gfx + (code << 8) + (yo ^ flipy); - - INT32 xxx = x - xo; - - if (tab[code]) { - if (xxx >= 0 && xxx < (nScreenWidth - 15)) { - dst[xxx++] = src[ 0 ^ flipx] | color; - dst[xxx++] = src[ 1 ^ flipx] | color; - dst[xxx++] = src[ 2 ^ flipx] | color; - dst[xxx++] = src[ 3 ^ flipx] | color; - dst[xxx++] = src[ 4 ^ flipx] | color; - dst[xxx++] = src[ 5 ^ flipx] | color; - dst[xxx++] = src[ 6 ^ flipx] | color; - dst[xxx++] = src[ 7 ^ flipx] | color; - dst[xxx++] = src[ 8 ^ flipx] | color; - dst[xxx++] = src[ 9 ^ flipx] | color; - dst[xxx++] = src[10 ^ flipx] | color; - dst[xxx++] = src[11 ^ flipx] | color; - dst[xxx++] = src[12 ^ flipx] | color; - dst[xxx++] = src[13 ^ flipx] | color; - dst[xxx++] = src[14 ^ flipx] | color; - dst[xxx ] = src[15 ^ flipx] | color; - } else { - for (INT32 sx = 0; sx < 16; sx++, xxx++) - { - if (xxx >= 0 && xxx < nScreenWidth) { - dst[xxx] = src[sx ^ flipx] | color; - } - } - } - } else { - if (xxx >= 0 && xxx < (nScreenWidth - 15)) { - for (INT32 sx = 0; sx < 16; sx++, xxx++) { - INT32 pxl = src[sx ^ flipx]; - - if (pxl != 0xff) { - dst[xxx] = pxl | color; - } - } - } else { - for (INT32 sx = 0; sx < 16; sx++, xxx++) { - INT32 pxl = src[sx ^ flipx]; - - if (xxx >= 0 && xxx < nScreenWidth && pxl != 0xff) { - dst[xxx] = pxl | color; - } - } - } - } - } - - dst += nScreenWidth; - } -} - -static void draw_foreground_layer(UINT8 *ram) -{ - UINT16 *vram = (UINT16*)ram; - - INT32 scrolly = DrvScrollBuf[0x200] & 0xff; - INT32 scrollx = (DrvScrollBuf[0x200] >> 16) & 0x1ff; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - sx -= scrollx; - if (sx < -7) sx += 512; - sy -= scrolly; - if (sy < -7) sy += 256; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs*2]); - if (DrvTransTab3[code] == 2) continue; - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs*2+1]); - - INT32 color = attr & 0x3f; - INT32 flipx = (attr >> 6) & 1; - INT32 flipy = (attr >> 7) & 1; - - if (sx >= 0 && sx < nScreenWidth - 15 && sy >= 0 && sy < nScreenHeight - 15) { - if (DrvTransTab3[code]) { - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); - } else { - Render8x8Tile_FlipY(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); - } - } else { - if (flipx) { - Render8x8Tile_FlipX(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); - } else { - Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); - } - } - } else { - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); - } else { - Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); - } - } - } - } else { - if (DrvTransTab3[code]) { - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); - } else { - Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); - } - } else { - if (flipx) { - Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); - } - } - } else { - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); - } - } - } - } - } -} - -static void draw_foreground_layer_byline(UINT8 *ram) -{ - UINT16 *vram = (UINT16*)ram; - UINT16 *dst = pTransDraw; - - for (INT32 y = 0; y < nScreenHeight; y++) - { - INT32 scrolly = ((DrvScrollBuf[512 + y] & 0xffff) + y) & 0x0ff; - INT32 scrollx = (DrvScrollBuf[512 + y] >> 16) & 0x1ff; - - INT32 yy = scrolly & 0xf8; - INT32 yo = (scrolly & 0x07) << 3; - INT32 xo = scrollx & 0x07; - - for (INT32 x = 0; x < nScreenWidth + 8; x+=8) - { - INT32 xx = ((scrollx + x) >> 2) & 0x7e; - - INT32 ofst = (yy << 4) | xx; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst]); - if (DrvTransTab3[code] == 2) continue; - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[ofst + 1]); - - INT32 color = attr & 0x3f; - INT32 flipx = ((attr >> 6) & 1) * 0x07; - INT32 flipy = ((attr >> 7) & 1) * 0x38; - - color <<= 4; - color |= 0xc00; - - UINT8 *src = DrvGfxROM3 + (code << 6) + (yo ^ flipy); - - INT32 xxx = x - xo; - - if (DrvTransTab3[code]) { - if (xxx >= 0 && xxx < (nScreenWidth - 7)) { - dst[xxx++] = src[0 ^ flipx] | color; - dst[xxx++] = src[1 ^ flipx] | color; - dst[xxx++] = src[2 ^ flipx] | color; - dst[xxx++] = src[3 ^ flipx] | color; - dst[xxx++] = src[4 ^ flipx] | color; - dst[xxx++] = src[5 ^ flipx] | color; - dst[xxx++] = src[6 ^ flipx] | color; - dst[xxx++] = src[7 ^ flipx] | color; - } else { - for (INT32 sx = 0; sx < 8; sx++, xxx++) - { - if (xxx >= 0 && xxx < nScreenWidth) { - dst[xxx] = src[sx ^ flipx] | color; - } - } - } - } else { - if (xxx >= 0 && xxx < (nScreenWidth - 7)) { - for (INT32 sx = 0; sx < 8; sx++, xxx++) { - INT32 pxl = src[sx ^ flipx]; - if (pxl != 0x0f) { - dst[xxx] = pxl | color; - } - } - } else { - for (INT32 sx = 0; sx < 8; sx++, xxx++) { - INT32 pxl = src[sx ^ flipx]; - if (xxx >= 0 && xxx < nScreenWidth && pxl != 0x0f) { - dst[xxx] = pxl | color; - } - } - } - } - } - - dst += nScreenWidth; - } -} - -static void fuuki32_draw_layer(INT32 layer, INT32 buffer) -{ - switch (layer) - { - case 0: - if (nEnableRaster[0]) { - draw_background_layer_byline(DrvBgRAM1, DrvGfxROM1, DrvTransTab1, 0x000, 0); - } else { - draw_background_layer(DrvBgRAM1, DrvGfxROM1, DrvTransTab1, 0x000, 0); - } - return; - - case 1: - if (nEnableRaster[1]) { - draw_background_layer_byline(DrvBgRAM2, DrvGfxROM2, DrvTransTab2, 0x400, 1); - } else { - draw_background_layer(DrvBgRAM2, DrvGfxROM2, DrvTransTab2, 0x400, 1); - } - return; - - case 2: - if (buffer) { - if (nEnableRaster[2]) { - draw_foreground_layer_byline(DrvFgRAM2); - } else { - draw_foreground_layer(DrvFgRAM2); - } - } else { - if (nEnableRaster[2]) { - draw_foreground_layer_byline(DrvFgRAM1); - } else { - draw_foreground_layer(DrvFgRAM1); - } - } - return; - } -} - -static void enable_rasters() -{ - nEnableRaster[0] = nEnableRaster[1] = nEnableRaster[2] = 0; - - for (INT32 i = 0; i < nScreenHeight; i++) { - if (DrvScrollBuf[0x000] != DrvScrollBuf[0x000 + i]) { - nEnableRaster[0] |= 1; - } - - if (DrvScrollBuf[0x100] != DrvScrollBuf[0x100 + i]) { - nEnableRaster[1] |= 1; - } - - if (DrvScrollBuf[0x200] != DrvScrollBuf[0x200 + i]) { - nEnableRaster[2] |= 1; - } - - if (DrvScrollBuf[0x300] != DrvScrollBuf[0x300 + i]) { - nEnableRaster[0] |= 1; - nEnableRaster[1] |= 1; - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x2000 / 2; i++) { - r = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 10) & 0x1f; - g = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 5) & 0x1f; - b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } - } - - UINT32 *vregs = (UINT32*)DrvVidRegs; - - static const INT32 pri_table[6][3] = { - { 0, 1, 2 }, - { 0, 2, 1 }, - { 1, 0, 2 }, - { 1, 2, 0 }, // ? - { 2, 0, 1 }, - { 2, 1, 0 } - }; - - INT32 tm_front = pri_table[ priority[0] ][0]; - INT32 tm_middle = pri_table[ priority[0] ][1]; - INT32 tm_back = pri_table[ priority[0] ][2]; - INT32 buffer = BURN_ENDIAN_SWAP_INT32(vregs[0x1e/4]) & 0x40; - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x1fff; - } - - enable_rasters(); - - if (nSpriteEnable & 1) draw_sprites(3); - - fuuki32_draw_layer(tm_back, buffer); - - if (nSpriteEnable & 2) draw_sprites(2); - - fuuki32_draw_layer(tm_middle, buffer); - - if (nSpriteEnable & 4) draw_sprites(1); - - fuuki32_draw_layer(tm_front, buffer); - - if (nSpriteEnable & 8) draw_sprites(0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 0x04); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - DrvInputs[2] = 0xff00 | DrvDips[0]; - DrvInputs[3] = (DrvDips[2] << 8) | DrvDips[1]; - } - - SekNewFrame(); - ZetNewFrame(); - - INT32 nSegment; - INT32 nInterleave = 248; // ? - INT32 nCyclesTotal[2] = { 20000000 / 60, 6000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - UINT32 *vregs = (UINT32*)DrvVidRegs; - - SekOpen(0); - ZetOpen(0); - - // 68ec020 timing probably not right... - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); - nCyclesDone[0] += SekRun(nSegment - nCyclesDone[0]); - // if (i == 16) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); // raster line -- 0 not 16? - - if (i == DrvRasterPos[0]) { - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - DrvRasterPos[0] = 0x1000; - } - - if (i == 247) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); // level 1 or 8 ? - if (i == 239) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); // vblank - - // hack -- save scroll/offset registers so the - // lines can be drawn in one pass -- should save - // quite a few cycles... - DrvScrollBuf[i + 0x000] = BURN_ENDIAN_SWAP_INT32(vregs[0]); - DrvScrollBuf[i + 0x100] = BURN_ENDIAN_SWAP_INT32(vregs[1]); - DrvScrollBuf[i + 0x200] = BURN_ENDIAN_SWAP_INT32(vregs[2]); - DrvScrollBuf[i + 0x300] = BURN_ENDIAN_SWAP_INT32(vregs[3]); - } - - BurnTimerEndFrame(nCyclesTotal[1]); - BurnYMF278BUpdate(nBurnSoundLen); - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - memcpy (DrvSprBuf1, DrvSprBuf0, 0x2000); - memcpy (DrvSprBuf0, DrvSprRAM, 0x2000); - tilebank_buf[1] = tilebank_buf[0]; - tilebank_buf[0] = tilebank[0]; - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029704; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYMF278BScan(nAction, pnMin); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - bankswitch(nDrvZ80Bank[0]); - ZetClose(); - } - - return 0; -} - - -// Asura Blade - Sword of Dynasty (Japan) - -static struct BurnRomInfo asurabldRomDesc[] = { - { "pgm3.u1", 0x080000, 0x053e9758, 1 | BRF_PRG | BRF_ESS }, // 0 68ec020 Code - { "pgm2.u2", 0x080000, 0x16b656ca, 1 | BRF_PRG | BRF_ESS }, // 1 - { "pgm1.u3", 0x080000, 0x35104452, 1 | BRF_PRG | BRF_ESS }, // 2 - { "pgm0.u4", 0x080000, 0x68615497, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "srom.u7", 0x080000, 0xbb1deb89, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "pcm.u6", 0x400000, 0xac72225a, 3 | BRF_SND }, // 5 Samples - - { "bg1113.u23", 0x400000, 0x94338267, 4 | BRF_GRA }, // 6 Background Tiles 0 - { "bg1012.u22", 0x400000, 0xd717a0a1, 4 | BRF_GRA }, // 7 - - { "bg2123.u24", 0x400000, 0x4acfc469, 5 | BRF_GRA }, // 8 Background Tiles 1 - { "bg2022.u25", 0x400000, 0xee312cd3, 5 | BRF_GRA }, // 9 - - { "map.u5", 0x200000, 0xe681155e, 6 | BRF_GRA }, // 10 Character Tiles - - { "sp23.u14", 0x400000, 0x7df492eb, 7 | BRF_GRA }, // 11 Sprite Tiles - { "sp45.u15", 0x400000, 0x1890f42a, 7 | BRF_GRA }, // 12 - { "sp67.u16", 0x400000, 0xa48f1ef0, 7 | BRF_GRA }, // 13 - { "sp89.u17", 0x400000, 0x6b024362, 7 | BRF_GRA }, // 14 - { "spab.u18", 0x400000, 0x803d2d8c, 7 | BRF_GRA }, // 15 - { "spcd.u19", 0x400000, 0x42e5c26e, 7 | BRF_GRA }, // 16 -}; - -STD_ROM_PICK(asurabld) -STD_ROM_FN(asurabld) - -struct BurnDriver BurnDrvAsurabld = { - "asurabld", NULL, NULL, NULL, "1998", - "Asura Blade - Sword of Dynasty (Japan)\0", "Imperfect GFX", "Fuuki", "FG-3", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, asurabldRomInfo, asurabldRomName, NULL, NULL, AsurabldInputInfo, AsurabldDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, - 320, 240, 4, 3 -}; - - -// Asura Buster - Eternal Warriors (Japan) - -static struct BurnRomInfo asurabusRomDesc[] = { - { "pgm3.u1", 0x080000, 0x2c6b5271, 1 | BRF_PRG | BRF_ESS }, // 0 68ec020 Code - { "pgm2.u2", 0x080000, 0x8f8694ec, 1 | BRF_PRG | BRF_ESS }, // 1 - { "pgm1.u3", 0x080000, 0x0a040f0f, 1 | BRF_PRG | BRF_ESS }, // 2 - { "pgm0.u4", 0x080000, 0x9b71e9d8, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "srom.u7", 0x080000, 0x368da389, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "opm.u6", 0x400000, 0x31b05be4, 3 | BRF_SND }, // 5 Samples - - { "bg1113.u23", 0x400000, 0x5f8657e6, 4 | BRF_GRA }, // 6 Background Tiles 0 - { "bg1012.u22", 0x400000, 0xe3fb9af0, 4 | BRF_GRA }, // 7 - - { "bg2123.u24", 0x400000, 0xc4ebb86b, 5 | BRF_GRA }, // 8 Background Tiles 1 - { "bg2022.u25", 0x400000, 0xf46eda52, 5 | BRF_GRA }, // 9 - - { "map.u5", 0x200000, 0xbd179dc5, 6 | BRF_GRA }, // 10 Character Tiles - - { "sp01.u13", 0x400000, 0x5edea463, 7 | BRF_GRA }, // 11 Sprite Tiles - { "sp23.u14", 0x400000, 0x91b1b0de, 7 | BRF_GRA }, // 12 - { "sp45.u15", 0x400000, 0x96c69aac, 7 | BRF_GRA }, // 13 - { "sp67.u16", 0x400000, 0x7c3d83bf, 7 | BRF_GRA }, // 14 - { "sp89.u17", 0x400000, 0xcb1e14f8, 7 | BRF_GRA }, // 15 - { "spab.u18", 0x400000, 0xe5a4608d, 7 | BRF_GRA }, // 16 - { "spcd.u19", 0x400000, 0x99bfbe32, 7 | BRF_GRA }, // 17 - { "spef.u20", 0x400000, 0xc9c799cc, 7 | BRF_GRA }, // 18 -}; - -STD_ROM_PICK(asurabus) -STD_ROM_FN(asurabus) - -struct BurnDriver BurnDrvAsurabus = { - "asurabus", NULL, NULL, NULL, "2000", - "Asura Buster - Eternal Warriors (Japan)\0", "Imperfect SND, freezes on first boss", "Fuuki", "FG-3", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, asurabusRomInfo, asurabusRomName, NULL, NULL, AsurabldInputInfo, AsurabldDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, - 320, 240, 4, 3 -}; +// FB Alpha Fuuki FG-3 driver module +// Based on MAME driver by Paul Priest and David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ymf278b.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf0; +static UINT8 *DrvSprBuf1; +static UINT8 *DrvFgRAM1; +static UINT8 *DrvFgRAM2; +static UINT8 *DrvBgRAM1; +static UINT8 *DrvBgRAM2; +static UINT8 *DrvVidRegs; +static UINT8 *DrvShareRAM; +static UINT8 *DrvZ80RAM; +static UINT32 *DrvScrollBuf; +static UINT8 *DrvTransTab1; +static UINT8 *DrvTransTab2; +static UINT8 *DrvTransTab3; + +static UINT16 *DrvRasterPos; +static UINT8 *nDrvZ80Bank; +static UINT16 *tilebank; +static UINT16 *tilebank_buf; +static UINT8 *priority; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT16 DrvInputs[4]; +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[4]; +static UINT8 DrvReset; + +static INT32 nEnableRaster[3]; + +static struct BurnInputInfo AsurabldInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 4, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 5, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 8, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 9, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 10, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 11, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 14, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 8, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Asurabld) + +static struct BurnDIPInfo AsurabldDIPList[]= +{ + {0x14, 0xff, 0xff, 0x3f, NULL }, + {0x15, 0xff, 0xff, 0x7f, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Blood Colour" }, + {0x14, 0x01, 0x02, 0x02, "Red" }, + {0x14, 0x01, 0x02, 0x00, "Green" }, + + {0 , 0xfe, 0 , 4, "Timer" }, + {0x14, 0x01, 0x30, 0x00, "Slow" }, + {0x14, 0x01, 0x30, 0x30, "Medium" }, + {0x14, 0x01, 0x30, 0x10, "Fast" }, + {0x14, 0x01, 0x30, 0x20, "Very Fast" }, + + {0 , 0xfe, 0 , 2, "Coinage Mode" }, + {0x14, 0x01, 0xc0, 0xc0, "Split" }, + {0x14, 0x01, 0xc0, 0x00, "Joint" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x15, 0x01, 0x01, 0x01, "Off" }, +// {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Computer Level" }, + {0x15, 0x01, 0x0e, 0x00, "0" }, + {0x15, 0x01, 0x0e, 0x08, "1" }, + {0x15, 0x01, 0x0e, 0x04, "2" }, + {0x15, 0x01, 0x0e, 0x0c, "3" }, + {0x15, 0x01, 0x0e, 0x0e, "4" }, + {0x15, 0x01, 0x0e, 0x02, "5" }, + {0x15, 0x01, 0x0e, 0x0a, "6" }, + {0x15, 0x01, 0x0e, 0x06, "7" }, + + {0 , 0xfe, 0 , 4, "Damage" }, + {0x15, 0x01, 0x30, 0x20, "Lowest" }, + {0x15, 0x01, 0x30, 0x30, "Low" }, + {0x15, 0x01, 0x30, 0x10, "Medium" }, + {0x15, 0x01, 0x30, 0x00, "High" }, + + {0 , 0xfe, 0 , 3, "Max Rounds" }, + {0x15, 0x01, 0xc0, 0x00, "1" }, + {0x15, 0x01, 0xc0, 0x40, "3" }, + {0x15, 0x01, 0xc0, 0x80, "5" }, + + {0 , 0xfe, 0 , 9, "Coin B" }, + {0x16, 0x01, 0x0f, 0x08, "8 Coins 1 Credits " }, + {0x16, 0x01, 0x0f, 0x09, "7 Coins 1 Credits " }, + {0x16, 0x01, 0x0f, 0x0a, "6 Coins 1 Credits " }, + {0x16, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits " }, + {0x16, 0x01, 0x0f, 0x0c, "4 Coins 1 Credits " }, + {0x16, 0x01, 0x0f, 0x0d, "3 Coins 1 Credits " }, + {0x16, 0x01, 0x0f, 0x0e, "2 Coins 1 Credits " }, + {0x16, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits " }, + {0x16, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 9, "Coin A" }, + {0x16, 0x01, 0xf0, 0x80, "8 Coins 1 Credits " }, + {0x16, 0x01, 0xf0, 0x90, "7 Coins 1 Credits " }, + {0x16, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits " }, + {0x16, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits " }, + {0x16, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits " }, + {0x16, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits " }, + {0x16, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits " }, + {0x16, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits " }, + {0x16, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Asurabld) + +static inline void cpu_sync() // sync z80 & 68k +{ + INT32 t = ((SekTotalCycles() * 3) / 10) - ZetTotalCycles(); + + if (t > 0) { + BurnTimerUpdate(t); + } +} + +void __fastcall fuuki32_write_long(UINT32 , UINT32 ) +{ + +} + +void __fastcall fuuki32_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xffffe0) == 0x8c0000) { + + if (address == 0x8c001c) { + DrvRasterPos[0] = data & 0xff; + } + + *((UINT16*)(DrvVidRegs + (address & 0x1e))) = BURN_ENDIAN_SWAP_INT16(data); + + return; + } + + if ((address & 0xffffe0) == 0x903fe0) { + cpu_sync(); + + DrvShareRAM[(address & 0x1f) >> 1] = data & 0xff; + return; + } + + switch (address) + { + case 0x8e0000: + priority[0] = data & 0x000f; + return; + + case 0xa00000: + tilebank[0] = data; + return; + } +} + +void __fastcall fuuki32_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xffffe0) == 0x903fe0) { + cpu_sync(); + + DrvShareRAM[(address & 0x1f) >> 1] = data; + return; + } +} + +UINT32 __fastcall fuuki32_read_long(UINT32) +{ + return 0; +} + +UINT16 __fastcall fuuki32_read_word(UINT32 address) +{ + switch (address) + { + case 0x800000: + return DrvInputs[0]; + + case 0x810000: + return DrvInputs[1]; + + case 0x880000: + return DrvInputs[2]; + + case 0x890000: + return DrvInputs[3]; + + case 0x8c001e: + return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 0x1e))); + } + + return 0; +} + +UINT8 __fastcall fuuki32_read_byte(UINT32 address) +{ + if ((address & 0xffffe0) == 0x903fe0) { + cpu_sync(); + return DrvShareRAM[(address & 0x1f) >> 1]; + } + + return 0; +} + +static void bankswitch(INT32 data) +{ + nDrvZ80Bank[0] = data; + + INT32 nBank = (data & 0x0f) * 0x8000; + + ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + nBank); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + nBank); +} + +void __fastcall fuuki32_sound_write(UINT16 address, UINT8 data) +{ + if ((address & 0xfff0) == 0x7ff0) { + DrvShareRAM[address & 0x0f] = data; + return; + } +} + +UINT8 __fastcall fuuki32_sound_read(UINT16 address) +{ + if ((address & 0xfff0) == 0x7ff0) { + return DrvShareRAM[address & 0x0f]; + } + + return 0; +} + +void __fastcall fuuki32_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + bankswitch(data); + return; + + case 0x40: + case 0x42: + case 0x44: + BurnYMF278BSelectRegister((port >> 1) & 3, data); + return; + + case 0x41: + case 0x43: + case 0x45: + BurnYMF278BWriteRegister((port >> 1) & 3, data); + return; + } +} + +UINT8 __fastcall fuuki32_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x40: + return BurnYMF278BReadStatus(); + } + + return 0; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 6000000; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYMF278BReset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x200000; + DrvZ80ROM = Next; Next += 0x080000; + + DrvTransTab1 = Next; Next += 0x008000; + DrvTransTab2 = Next; Next += 0x008000; + DrvTransTab3 = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x4000000; + DrvGfxROM1 = Next; Next += 0x800000; + DrvGfxROM2 = Next; Next += 0x800000; + DrvGfxROM3 = Next; Next += 0x400000; + + DrvSndROM = Next; Next += 0x400000; + + DrvPalette = (UINT32 *)Next; Next += 0x2000 * sizeof(UINT32); + DrvScrollBuf = (UINT32 *)Next; Next += 256 * 4 * sizeof(UINT32); + DrvRasterPos = (UINT16*)Next; Next += 0x0001 * sizeof(UINT16); + + AllRam = Next; + + DrvVidRegs = Next; Next += 0x000400; + DrvShareRAM = Next; Next += 0x000010; + DrvZ80RAM = Next; Next += 0x001000; + + Drv68KRAM = Next; Next += 0x020000; + DrvPalRAM = Next; Next += 0x004000; + DrvFgRAM1 = Next; Next += 0x002000; + DrvFgRAM2 = Next; Next += 0x020000; + DrvBgRAM1 = Next; Next += 0x002000; + DrvBgRAM2 = Next; Next += 0x002000; + DrvSprRAM = Next; Next += 0x002000; + DrvSprBuf0 = Next; Next += 0x002000; + DrvSprBuf1 = Next; Next += 0x002000; + + priority = Next; Next += 0x000001; + + tilebank = (UINT16*)Next; Next += 0x0001 * sizeof(UINT16); + tilebank_buf = (UINT16*)Next; Next += 0x0002 * sizeof(UINT16); + + nDrvZ80Bank = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[ 8] = { 0x0000000, 0x0000001, 0x0000002, 0x0000003, + 0x2000000, 0x2000001, 0x2000002, 0x2000003 }; + INT32 XOffs[16] = { 0x008, 0x00c, 0x000, 0x004, 0x018, 0x01c, 0x010, 0x014, + 0x028, 0x02c, 0x020, 0x024, 0x038, 0x03c, 0x030, 0x034 }; + INT32 YOffs0[ 8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; + INT32 YOffs1[16] = { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 }; + + UINT8 *tmp = DrvGfxROM0 + 0x2000000; + + memcpy (tmp, DrvGfxROM1, 0x800000); + + GfxDecode(0x08000, 8, 16, 16, Plane, XOffs, YOffs1, 0x400, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x800000); + + GfxDecode(0x08000, 8, 16, 16, Plane, XOffs, YOffs1, 0x400, tmp, DrvGfxROM2); + + memcpy (tmp, DrvGfxROM3, 0x200000); + + GfxDecode(0x10000, 4, 8, 8, Plane, XOffs, YOffs0, 0x100, tmp, DrvGfxROM3); + + return 0; +} + +static void DrvSpriteExpand() +{ + BurnByteswap(DrvGfxROM0, 0x4000000); + UINT8 *tmp; + + for (INT32 i = 0x2000000 - 0x80; i >= 0; i -= 0x80) + { + tmp = DrvGfxROM0 + i; + + for (INT32 j = 0x7f; j >= 0; j--) { + INT32 t = tmp[j]; + DrvGfxROM0[((i + j) << 1) + 0] = t >> 4; + DrvGfxROM0[((i + j) << 1) + 1] = t & 0x0f; + } + } +} + +static void DrvCalculateTransTab(UINT8 *src, UINT8 *dst, INT32 t, INT32 w, INT32 len) +{ + UINT8 *dptr = dst; + for (INT32 i = 0; i < len; i+= w) + { + INT32 a = 0, b = 0; + for (INT32 j = 0; j < w; j++) { + a|=src[i+j]^t; + + if (src[i+j] != t) { + b++; + } + } + + dptr[0] = a ? 0 : 2; + if (b == w) dptr[0] |= 1; + + dptr++; + } +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x0000001, 0, 4)) return 1; + if (BurnLoadRom(Drv68KROM + 0x0000000, 1, 4)) return 1; + if (BurnLoadRom(Drv68KROM + 0x0000003, 2, 4)) return 1; + if (BurnLoadRom(Drv68KROM + 0x0000002, 3, 4)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 4, 1)) return 1; + + if (BurnLoadRom(DrvSndROM, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x0000000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0400000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x0000000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x0400000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x0000000, 10, 1)) return 1; + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "asurabld") == 0) { + if (BurnLoadRom(DrvGfxROM0 + 0x0400000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0800000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0c00000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x1000000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x1400000, 15, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x1800000, 16, 1)) return 1; + } else { + if (BurnLoadRom(DrvGfxROM0 + 0x0000000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0400000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0800000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0c00000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x1000000, 15, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x1400000, 16, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x1800000, 17, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x1c00000, 18, 1)) return 1; + } + + DrvGfxDecode(); + DrvSpriteExpand(); + + DrvCalculateTransTab(DrvGfxROM1, DrvTransTab1, 0xff, 0x100, 0x800000); + DrvCalculateTransTab(DrvGfxROM2, DrvTransTab2, 0xff, 0x100, 0x800000); + DrvCalculateTransTab(DrvGfxROM3, DrvTransTab3, 0x0f, 0x040, 0x400000); + } + + SekInit(0, 0x68ec020); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x410000, 0x41ffff, SM_RAM); + SekMapMemory(DrvBgRAM1, 0x500000, 0x501fff, SM_RAM); + SekMapMemory(DrvBgRAM2, 0x502000, 0x503fff, SM_RAM); + SekMapMemory(DrvFgRAM1, 0x504000, 0x505fff, SM_RAM); + SekMapMemory(DrvFgRAM2, 0x506000, 0x507fff, SM_RAM); + SekMapMemory(DrvFgRAM2 + 0x2000,0x508000, 0x517fff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x600000, 0x601fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x700000, 0x703fff, SM_RAM); + SekSetWriteLongHandler(0, fuuki32_write_long); + SekSetWriteWordHandler(0, fuuki32_write_word); + SekSetWriteByteHandler(0, fuuki32_write_byte); + SekSetReadLongHandler(0, fuuki32_read_long); + SekSetReadWordHandler(0, fuuki32_read_word); + SekSetReadByteHandler(0, fuuki32_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM); + ZetMapArea(0x6000, 0x6fff, 0, DrvZ80RAM); + ZetMapArea(0x6000, 0x6fff, 1, DrvZ80RAM); + ZetMapArea(0x6000, 0x6fff, 2, DrvZ80RAM); + ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + 0x8000); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + 0x8000); + ZetSetWriteHandler(fuuki32_sound_write); + ZetSetReadHandler(fuuki32_sound_read); + ZetSetOutHandler(fuuki32_sound_out); + ZetSetInHandler(fuuki32_sound_in); + ZetClose(); + + BurnYMF278BInit(0, DrvSndROM, &DrvFMIRQHandler, DrvSynchroniseStream); + BurnYMF278BSetRoute(BURN_SND_YMF278B_YMF278B_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYMF278BSetRoute(BURN_SND_YMF278B_YMF278B_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + BurnTimerAttachZet(6000000); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYMF278BExit(); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_sprites(INT32 prio) +{ + UINT16 *src = (UINT16*)DrvSprBuf1; + + for (INT32 offs = 0; offs < 0x2000 / 2; offs += 4) + { + INT32 sx = BURN_ENDIAN_SWAP_INT16(src[offs + 0]); + INT32 sy = BURN_ENDIAN_SWAP_INT16(src[offs + 1]); + INT32 attr = BURN_ENDIAN_SWAP_INT16(src[offs + 2]); + INT32 code = BURN_ENDIAN_SWAP_INT16(src[offs + 3]); + + if (prio != ((attr >> 6) & 0x0003) || sx & 0x0400) continue; + + INT32 bank = (tilebank_buf[1] >> ((code >> 12) & 0x0c)) & 0xf; + + code = (code & 0x3fff) | (bank << 14); + + INT32 flipx = sx & 0x0800; + INT32 flipy = sy & 0x0800; + INT32 xnum = ((sx >> 12) & 0xf) + 1; + INT32 ynum = ((sy >> 12) & 0xf) + 1; + INT32 xzoom = 128 - ((attr >> 10) & 0x3c); + INT32 yzoom = 128 - ((attr >> 6) & 0x3c); + + sx = (sx & 0x1ff) - (sx & 0x200); + sy = (sy & 0x1ff) - (sy & 0x200); + + INT32 xstart, ystart, xend, yend, xinc, yinc; + if (flipx) { xstart = (xnum-1) * 16; xend = -16; xinc = -16; } + else { xstart = 0; xend = xnum * 16; xinc = +16; } + + if (flipy) { ystart = (ynum-1) * 16; yend = -16; yinc = -16; } + else { ystart = 0; yend = ynum * 16; yinc = +16; } + + for (INT32 y = ystart; y != yend; y += yinc) + { + for (INT32 x = xstart; x != xend; x += xinc) + { + if (xzoom == 128 && yzoom == 128) { + if (sx + x >= 0 && sx + x < nScreenWidth - 15 && sy + y >= 0 && sy + y < nScreenHeight - 15) { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); + } else { + Render16x16Tile_Mask_FlipY(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); + } else { + Render16x16Tile_Mask(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); + } + } + } else { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code++, sx + x, sy + y, attr & 0x3f, 4, 0x0f, 0x800, DrvGfxROM0); + } + } + } + } else { + RenderZoomedTile(pTransDraw, DrvGfxROM0, code++, ((attr & 0x3f) << 4) | 0x800, 15, sx + (x * xzoom) / 128, sy + (y * yzoom) / 128, flipx, flipy, 16, 16, (xzoom + 8) << 9, (yzoom + 8) << 9); + } + } + } + } +} + +static void draw_background_layer(UINT8 *ram, UINT8 *gfx, UINT8 *tab, INT32 coloff, INT32 soff) +{ + INT32 yoff = (DrvScrollBuf[0x300] & 0xffff) - 0x1f3; + INT32 xoff = (DrvScrollBuf[0x300] >> 16) - 0x3f6; + INT32 scrolly = ((DrvScrollBuf[soff*256] & 0xffff) + yoff) & 0x1ff; + INT32 scrollx = ((DrvScrollBuf[soff*256] >> 16) + xoff) & 0x3ff; + + UINT16 *vram = (UINT16*)ram; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = (offs & 0x3f) << 4; + INT32 sy = (offs >> 6) << 4; + + sx -= scrollx; + if (sx < -15) sx += 1024; + sy -= scrolly; + if (sy < -15) sy += 512; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs*2]) & 0x7fff; + if (tab[code] == 2) continue; + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs*2 + 1]); + + INT32 color = (attr & 0x30) >> 4; + INT32 flipx = (attr >> 6) & 1; + INT32 flipy = (attr >> 7) & 1; + + if (sx >= 0 && sx < nScreenWidth - 15 && sy >= 0 && sy < nScreenHeight - 15) { + if (tab[code]) { + if (flipy) { + if (flipx) { + Render16x16Tile_FlipXY(pTransDraw, code, sx, sy, color, 8, coloff, gfx); + } else { + Render16x16Tile_FlipY(pTransDraw, code, sx, sy, color, 8, coloff, gfx); + } + } else { + if (flipx) { + Render16x16Tile_FlipX(pTransDraw, code, sx, sy, color, 8, coloff, gfx); + } else { + Render16x16Tile(pTransDraw, code, sx, sy, color, 8, coloff, gfx); + } + } + } else { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); + } else { + Render16x16Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); + } else { + Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); + } + } + } + } else { + if (sx >= nScreenWidth || sy >= nScreenWidth) continue; + + if (tab[code]) { + if (flipy) { + if (flipx) { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 8, coloff, gfx); + } else { + Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 8, coloff, gfx); + } + } else { + if (flipx) { + Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 8, coloff, gfx); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 8, coloff, gfx); + } + } + } else { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 8, 0xff, coloff, gfx); + } + } + } + } + } +} + +static void draw_background_layer_byline(UINT8 *ram, UINT8 *gfx, UINT8 *tab, INT32 coloff, INT32 soff) +{ + UINT16 *vram = (UINT16*)ram; + UINT16 *dst = pTransDraw; + + for (INT32 y = 0; y < nScreenHeight; y++) + { + INT32 yoff = (DrvScrollBuf[0x300 + y] & 0xffff) - 0x1f3; + INT32 xoff = (DrvScrollBuf[0x300 + y] >> 16) - 0x3f6; + INT32 scrolly = ((DrvScrollBuf[(soff*256) + y] & 0xffff) + yoff + y) & 0x1ff; + INT32 scrollx = ((DrvScrollBuf[(soff*256) + y] >> 16) + xoff) & 0x3ff; + + INT32 yy = scrolly & 0x1f0; + INT32 yo = (scrolly & 0x0f) << 4; + INT32 xo = scrollx & 0x0f; + + for (INT32 x = 0; x < nScreenWidth + 16; x+=16) + { + INT32 xx = ((scrollx + x) >> 3) & 0x7e; + + INT32 ofst = (yy << 3) | xx; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst]) & 0x7fff; + if (tab[code] == 2) continue; + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[ofst + 1]); + + INT32 color = (attr & 0x30) << 4; + INT32 flipx = ((attr >> 6) & 1) * 0x0f; + INT32 flipy = ((attr >> 7) & 1) * 0xf0; + + color |= coloff; + + UINT8 *src = gfx + (code << 8) + (yo ^ flipy); + + INT32 xxx = x - xo; + + if (tab[code]) { + if (xxx >= 0 && xxx < (nScreenWidth - 15)) { + dst[xxx++] = src[ 0 ^ flipx] | color; + dst[xxx++] = src[ 1 ^ flipx] | color; + dst[xxx++] = src[ 2 ^ flipx] | color; + dst[xxx++] = src[ 3 ^ flipx] | color; + dst[xxx++] = src[ 4 ^ flipx] | color; + dst[xxx++] = src[ 5 ^ flipx] | color; + dst[xxx++] = src[ 6 ^ flipx] | color; + dst[xxx++] = src[ 7 ^ flipx] | color; + dst[xxx++] = src[ 8 ^ flipx] | color; + dst[xxx++] = src[ 9 ^ flipx] | color; + dst[xxx++] = src[10 ^ flipx] | color; + dst[xxx++] = src[11 ^ flipx] | color; + dst[xxx++] = src[12 ^ flipx] | color; + dst[xxx++] = src[13 ^ flipx] | color; + dst[xxx++] = src[14 ^ flipx] | color; + dst[xxx ] = src[15 ^ flipx] | color; + } else { + for (INT32 sx = 0; sx < 16; sx++, xxx++) + { + if (xxx >= 0 && xxx < nScreenWidth) { + dst[xxx] = src[sx ^ flipx] | color; + } + } + } + } else { + if (xxx >= 0 && xxx < (nScreenWidth - 15)) { + for (INT32 sx = 0; sx < 16; sx++, xxx++) { + INT32 pxl = src[sx ^ flipx]; + + if (pxl != 0xff) { + dst[xxx] = pxl | color; + } + } + } else { + for (INT32 sx = 0; sx < 16; sx++, xxx++) { + INT32 pxl = src[sx ^ flipx]; + + if (xxx >= 0 && xxx < nScreenWidth && pxl != 0xff) { + dst[xxx] = pxl | color; + } + } + } + } + } + + dst += nScreenWidth; + } +} + +static void draw_foreground_layer(UINT8 *ram) +{ + UINT16 *vram = (UINT16*)ram; + + INT32 scrolly = DrvScrollBuf[0x200] & 0xff; + INT32 scrollx = (DrvScrollBuf[0x200] >> 16) & 0x1ff; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + sx -= scrollx; + if (sx < -7) sx += 512; + sy -= scrolly; + if (sy < -7) sy += 256; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs*2]); + if (DrvTransTab3[code] == 2) continue; + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs*2+1]); + + INT32 color = attr & 0x3f; + INT32 flipx = (attr >> 6) & 1; + INT32 flipy = (attr >> 7) & 1; + + if (sx >= 0 && sx < nScreenWidth - 15 && sy >= 0 && sy < nScreenHeight - 15) { + if (DrvTransTab3[code]) { + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); + } else { + Render8x8Tile_FlipY(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); + } + } else { + if (flipx) { + Render8x8Tile_FlipX(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); + } else { + Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); + } + } + } else { + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); + } else { + Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); + } + } + } + } else { + if (DrvTransTab3[code]) { + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); + } else { + Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); + } + } else { + if (flipx) { + Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0xc00, DrvGfxROM3); + } + } + } else { + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0x0f, 0xc00, DrvGfxROM3); + } + } + } + } + } +} + +static void draw_foreground_layer_byline(UINT8 *ram) +{ + UINT16 *vram = (UINT16*)ram; + UINT16 *dst = pTransDraw; + + for (INT32 y = 0; y < nScreenHeight; y++) + { + INT32 scrolly = ((DrvScrollBuf[512 + y] & 0xffff) + y) & 0x0ff; + INT32 scrollx = (DrvScrollBuf[512 + y] >> 16) & 0x1ff; + + INT32 yy = scrolly & 0xf8; + INT32 yo = (scrolly & 0x07) << 3; + INT32 xo = scrollx & 0x07; + + for (INT32 x = 0; x < nScreenWidth + 8; x+=8) + { + INT32 xx = ((scrollx + x) >> 2) & 0x7e; + + INT32 ofst = (yy << 4) | xx; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst]); + if (DrvTransTab3[code] == 2) continue; + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[ofst + 1]); + + INT32 color = attr & 0x3f; + INT32 flipx = ((attr >> 6) & 1) * 0x07; + INT32 flipy = ((attr >> 7) & 1) * 0x38; + + color <<= 4; + color |= 0xc00; + + UINT8 *src = DrvGfxROM3 + (code << 6) + (yo ^ flipy); + + INT32 xxx = x - xo; + + if (DrvTransTab3[code]) { + if (xxx >= 0 && xxx < (nScreenWidth - 7)) { + dst[xxx++] = src[0 ^ flipx] | color; + dst[xxx++] = src[1 ^ flipx] | color; + dst[xxx++] = src[2 ^ flipx] | color; + dst[xxx++] = src[3 ^ flipx] | color; + dst[xxx++] = src[4 ^ flipx] | color; + dst[xxx++] = src[5 ^ flipx] | color; + dst[xxx++] = src[6 ^ flipx] | color; + dst[xxx++] = src[7 ^ flipx] | color; + } else { + for (INT32 sx = 0; sx < 8; sx++, xxx++) + { + if (xxx >= 0 && xxx < nScreenWidth) { + dst[xxx] = src[sx ^ flipx] | color; + } + } + } + } else { + if (xxx >= 0 && xxx < (nScreenWidth - 7)) { + for (INT32 sx = 0; sx < 8; sx++, xxx++) { + INT32 pxl = src[sx ^ flipx]; + if (pxl != 0x0f) { + dst[xxx] = pxl | color; + } + } + } else { + for (INT32 sx = 0; sx < 8; sx++, xxx++) { + INT32 pxl = src[sx ^ flipx]; + if (xxx >= 0 && xxx < nScreenWidth && pxl != 0x0f) { + dst[xxx] = pxl | color; + } + } + } + } + } + + dst += nScreenWidth; + } +} + +static void fuuki32_draw_layer(INT32 layer, INT32 buffer) +{ + switch (layer) + { + case 0: + if (nEnableRaster[0]) { + draw_background_layer_byline(DrvBgRAM1, DrvGfxROM1, DrvTransTab1, 0x000, 0); + } else { + draw_background_layer(DrvBgRAM1, DrvGfxROM1, DrvTransTab1, 0x000, 0); + } + return; + + case 1: + if (nEnableRaster[1]) { + draw_background_layer_byline(DrvBgRAM2, DrvGfxROM2, DrvTransTab2, 0x400, 1); + } else { + draw_background_layer(DrvBgRAM2, DrvGfxROM2, DrvTransTab2, 0x400, 1); + } + return; + + case 2: + if (buffer) { + if (nEnableRaster[2]) { + draw_foreground_layer_byline(DrvFgRAM2); + } else { + draw_foreground_layer(DrvFgRAM2); + } + } else { + if (nEnableRaster[2]) { + draw_foreground_layer_byline(DrvFgRAM1); + } else { + draw_foreground_layer(DrvFgRAM1); + } + } + return; + } +} + +static void enable_rasters() +{ + nEnableRaster[0] = nEnableRaster[1] = nEnableRaster[2] = 0; + + for (INT32 i = 0; i < nScreenHeight; i++) { + if (DrvScrollBuf[0x000] != DrvScrollBuf[0x000 + i]) { + nEnableRaster[0] |= 1; + } + + if (DrvScrollBuf[0x100] != DrvScrollBuf[0x100 + i]) { + nEnableRaster[1] |= 1; + } + + if (DrvScrollBuf[0x200] != DrvScrollBuf[0x200 + i]) { + nEnableRaster[2] |= 1; + } + + if (DrvScrollBuf[0x300] != DrvScrollBuf[0x300 + i]) { + nEnableRaster[0] |= 1; + nEnableRaster[1] |= 1; + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x2000 / 2; i++) { + r = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 10) & 0x1f; + g = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 5) & 0x1f; + b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } + } + + UINT32 *vregs = (UINT32*)DrvVidRegs; + + static const INT32 pri_table[6][3] = { + { 0, 1, 2 }, + { 0, 2, 1 }, + { 1, 0, 2 }, + { 1, 2, 0 }, // ? + { 2, 0, 1 }, + { 2, 1, 0 } + }; + + INT32 tm_front = pri_table[ priority[0] ][0]; + INT32 tm_middle = pri_table[ priority[0] ][1]; + INT32 tm_back = pri_table[ priority[0] ][2]; + INT32 buffer = BURN_ENDIAN_SWAP_INT32(vregs[0x1e/4]) & 0x40; + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x1fff; + } + + enable_rasters(); + + if (nSpriteEnable & 1) draw_sprites(3); + + fuuki32_draw_layer(tm_back, buffer); + + if (nSpriteEnable & 2) draw_sprites(2); + + fuuki32_draw_layer(tm_middle, buffer); + + if (nSpriteEnable & 4) draw_sprites(1); + + fuuki32_draw_layer(tm_front, buffer); + + if (nSpriteEnable & 8) draw_sprites(0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 0x04); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + DrvInputs[2] = 0xff00 | DrvDips[0]; + DrvInputs[3] = (DrvDips[2] << 8) | DrvDips[1]; + } + + SekNewFrame(); + ZetNewFrame(); + + INT32 nSegment; + INT32 nInterleave = 248; // ? + INT32 nCyclesTotal[2] = { 20000000 / 60, 6000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + UINT32 *vregs = (UINT32*)DrvVidRegs; + + SekOpen(0); + ZetOpen(0); + + // 68ec020 timing probably not right... + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = (nCyclesTotal[0] / nInterleave) * (i + 1); + nCyclesDone[0] += SekRun(nSegment - nCyclesDone[0]); + // if (i == 16) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); // raster line -- 0 not 16? + + if (i == DrvRasterPos[0]) { + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + DrvRasterPos[0] = 0x1000; + } + + if (i == 247) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); // level 1 or 8 ? + if (i == 239) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); // vblank + + // hack -- save scroll/offset registers so the + // lines can be drawn in one pass -- should save + // quite a few cycles... + DrvScrollBuf[i + 0x000] = BURN_ENDIAN_SWAP_INT32(vregs[0]); + DrvScrollBuf[i + 0x100] = BURN_ENDIAN_SWAP_INT32(vregs[1]); + DrvScrollBuf[i + 0x200] = BURN_ENDIAN_SWAP_INT32(vregs[2]); + DrvScrollBuf[i + 0x300] = BURN_ENDIAN_SWAP_INT32(vregs[3]); + } + + BurnTimerEndFrame(nCyclesTotal[1]); + BurnYMF278BUpdate(nBurnSoundLen); + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + memcpy (DrvSprBuf1, DrvSprBuf0, 0x2000); + memcpy (DrvSprBuf0, DrvSprRAM, 0x2000); + tilebank_buf[1] = tilebank_buf[0]; + tilebank_buf[0] = tilebank[0]; + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029704; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYMF278BScan(nAction, pnMin); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + bankswitch(nDrvZ80Bank[0]); + ZetClose(); + } + + return 0; +} + + +// Asura Blade - Sword of Dynasty (Japan) + +static struct BurnRomInfo asurabldRomDesc[] = { + { "pgm3.u1", 0x080000, 0x053e9758, 1 | BRF_PRG | BRF_ESS }, // 0 68ec020 Code + { "pgm2.u2", 0x080000, 0x16b656ca, 1 | BRF_PRG | BRF_ESS }, // 1 + { "pgm1.u3", 0x080000, 0x35104452, 1 | BRF_PRG | BRF_ESS }, // 2 + { "pgm0.u4", 0x080000, 0x68615497, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "srom.u7", 0x080000, 0xbb1deb89, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "pcm.u6", 0x400000, 0xac72225a, 3 | BRF_SND }, // 5 Samples + + { "bg1113.u23", 0x400000, 0x94338267, 4 | BRF_GRA }, // 6 Background Tiles 0 + { "bg1012.u22", 0x400000, 0xd717a0a1, 4 | BRF_GRA }, // 7 + + { "bg2123.u24", 0x400000, 0x4acfc469, 5 | BRF_GRA }, // 8 Background Tiles 1 + { "bg2022.u25", 0x400000, 0xee312cd3, 5 | BRF_GRA }, // 9 + + { "map.u5", 0x200000, 0xe681155e, 6 | BRF_GRA }, // 10 Character Tiles + + { "sp23.u14", 0x400000, 0x7df492eb, 7 | BRF_GRA }, // 11 Sprite Tiles + { "sp45.u15", 0x400000, 0x1890f42a, 7 | BRF_GRA }, // 12 + { "sp67.u16", 0x400000, 0xa48f1ef0, 7 | BRF_GRA }, // 13 + { "sp89.u17", 0x400000, 0x6b024362, 7 | BRF_GRA }, // 14 + { "spab.u18", 0x400000, 0x803d2d8c, 7 | BRF_GRA }, // 15 + { "spcd.u19", 0x400000, 0x42e5c26e, 7 | BRF_GRA }, // 16 +}; + +STD_ROM_PICK(asurabld) +STD_ROM_FN(asurabld) + +struct BurnDriver BurnDrvAsurabld = { + "asurabld", NULL, NULL, NULL, "1998", + "Asura Blade - Sword of Dynasty (Japan)\0", "Imperfect GFX", "Fuuki", "FG-3", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, asurabldRomInfo, asurabldRomName, NULL, NULL, AsurabldInputInfo, AsurabldDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, + 320, 240, 4, 3 +}; + + +// Asura Buster - Eternal Warriors (Japan) + +static struct BurnRomInfo asurabusRomDesc[] = { + { "pgm3.u1", 0x080000, 0x2c6b5271, 1 | BRF_PRG | BRF_ESS }, // 0 68ec020 Code + { "pgm2.u2", 0x080000, 0x8f8694ec, 1 | BRF_PRG | BRF_ESS }, // 1 + { "pgm1.u3", 0x080000, 0x0a040f0f, 1 | BRF_PRG | BRF_ESS }, // 2 + { "pgm0.u4", 0x080000, 0x9b71e9d8, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "srom.u7", 0x080000, 0x368da389, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "opm.u6", 0x400000, 0x31b05be4, 3 | BRF_SND }, // 5 Samples + + { "bg1113.u23", 0x400000, 0x5f8657e6, 4 | BRF_GRA }, // 6 Background Tiles 0 + { "bg1012.u22", 0x400000, 0xe3fb9af0, 4 | BRF_GRA }, // 7 + + { "bg2123.u24", 0x400000, 0xc4ebb86b, 5 | BRF_GRA }, // 8 Background Tiles 1 + { "bg2022.u25", 0x400000, 0xf46eda52, 5 | BRF_GRA }, // 9 + + { "map.u5", 0x200000, 0xbd179dc5, 6 | BRF_GRA }, // 10 Character Tiles + + { "sp01.u13", 0x400000, 0x5edea463, 7 | BRF_GRA }, // 11 Sprite Tiles + { "sp23.u14", 0x400000, 0x91b1b0de, 7 | BRF_GRA }, // 12 + { "sp45.u15", 0x400000, 0x96c69aac, 7 | BRF_GRA }, // 13 + { "sp67.u16", 0x400000, 0x7c3d83bf, 7 | BRF_GRA }, // 14 + { "sp89.u17", 0x400000, 0xcb1e14f8, 7 | BRF_GRA }, // 15 + { "spab.u18", 0x400000, 0xe5a4608d, 7 | BRF_GRA }, // 16 + { "spcd.u19", 0x400000, 0x99bfbe32, 7 | BRF_GRA }, // 17 + { "spef.u20", 0x400000, 0xc9c799cc, 7 | BRF_GRA }, // 18 +}; + +STD_ROM_PICK(asurabus) +STD_ROM_FN(asurabus) + +struct BurnDriver BurnDrvAsurabus = { + "asurabus", NULL, NULL, NULL, "2000", + "Asura Buster - Eternal Warriors (Japan)\0", "Imperfect SND, freezes on first boss", "Fuuki", "FG-3", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, asurabusRomInfo, asurabusRomName, NULL, NULL, AsurabldInputInfo, AsurabldDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_gaiden.cpp b/src/burn/drv/pst90s/d_gaiden.cpp index 64dd6208c..5b995c9e7 100644 --- a/src/burn/drv/pst90s/d_gaiden.cpp +++ b/src/burn/drv/pst90s/d_gaiden.cpp @@ -1,2024 +1,2023 @@ -// FB Alpha Ninja Gaiden driver module -// Based on MAME driver by Alex Pasadyn, Phil Stroffolino, Nicola Salmoria, and various others - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "msm6295.h" -#include "burn_ym2151.h" -#include "burn_ym2203.h" -#include "bitswap.h" - - -static INT32 game = 0; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static UINT8 *Mem, *MemEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; - -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvGfx0Transp; -static UINT8 *DrvGfx1Transp; -static UINT8 *DrvGfx2Transp; - -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KRAM; -static UINT8 *DrvVidRAM0; -static UINT8 *DrvVidRAM1; -static UINT8 *DrvVidRAM2; -static UINT8 *DrvSprRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *DrvPalette; -static UINT32 *Palette; -static UINT8 DrvRecalc; - -static INT32 flipscreen; -static UINT8 soundlatch; - -static INT32 prot; -static INT32 jumpcode; -static INT32 jumppointer; - -static INT32 tx_scroll_x; -static INT32 tx_scroll_y; -static INT32 fg_scroll_x; -static INT32 fg_scroll_y; -static INT32 bg_scroll_x; -static INT32 bg_scroll_y; - - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p1 right" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 6, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 3"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 6, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 3"}, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo RaigaInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p1 right" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 2"}, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Raiga) - -static struct BurnDIPInfo GaidenDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x01, 0x00, "Off" }, - {0x13, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 3 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x04, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 4 , "Energy" }, - {0x14, 0x01, 0x30, 0x00, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x10, "4" }, - {0x14, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0xc0, 0x00, "1" }, - {0x14, 0x01, 0xc0, 0xc0, "2" }, - {0x14, 0x01, 0xc0, 0x40, "3" }, - {0x14, 0x01, 0xc0, 0x80, "4" }, -}; - -STDDIPINFO(Gaiden) - -static struct BurnDIPInfo WildfangDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x01, 0x00, "Off" }, - {0x13, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 3 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x04, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 2 , "Title" }, - {0x14, 0x01, 0x01, 0x01, "Wild Fang" }, - {0x14, 0x01, 0x01, 0x00, "Tecmo Knight" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, // Wild Fang - {0x14, 0x02, 0x0c, 0x0c, "Easy" }, - {0x14, 0x00, 0x01, 0x01, NULL }, - {0x14, 0x02, 0x0c, 0x04, "Normal" }, - {0x14, 0x00, 0x01, 0x01, NULL }, - {0x14, 0x02, 0x0c, 0x08, "Hard" }, - {0x14, 0x00, 0x01, 0x01, NULL }, - {0x14, 0x02, 0x0c, 0x00, "Hardest" }, - {0x14, 0x00, 0x01, 0x01, NULL }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, // Tecmo Knight - {0x14, 0x02, 0x30, 0x30, "Easy" }, - {0x14, 0x00, 0x01, 0x00, NULL }, - {0x14, 0x02, 0x30, 0x10, "Normal" }, - {0x14, 0x00, 0x01, 0x00, NULL }, - {0x14, 0x02, 0x30, 0x20, "Hard" }, - {0x14, 0x00, 0x01, 0x00, NULL }, - {0x14, 0x02, 0x30, 0x00, "Hardest" }, - {0x14, 0x00, 0x01, 0x00, NULL }, - - {0 , 0xfe, 0 , 3 , "Lives" }, - {0x14, 0x01, 0xc0, 0x80, "1" }, - {0x14, 0x01, 0xc0, 0xc0, "2" }, - {0x14, 0x01, 0xc0, 0x40, "3" }, -// {0x14, 0x01, 0xc0, 0x00, "2" }, -}; - -STDDIPINFO(Wildfang) - -static struct BurnDIPInfo TknightDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x01, 0x00, "Off" }, - {0x13, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 3 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x04, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x30, 0x30, "Easy" }, - {0x14, 0x01, 0x30, 0x10, "Normal" }, - {0x14, 0x01, 0x30, 0x20, "Hard" }, - {0x14, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 3 , "Lives" }, - {0x14, 0x01, 0xc0, 0x80, "1" }, - {0x14, 0x01, 0xc0, 0xc0, "2" }, - {0x14, 0x01, 0xc0, 0x40, "3" }, -// {0x14, 0x01, 0xc0, 0x00, "2" }, -}; - -STDDIPINFO(Tknight) - -static struct BurnDIPInfo DrgnbowlDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x01, 0x00, "Off" }, - {0x13, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 3 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x04, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 4 , "Energy" }, - {0x14, 0x01, 0x30, 0x00, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x10, "4" }, - {0x14, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0xc0, 0x00, "1" }, - {0x14, 0x01, 0xc0, 0xc0, "2" }, - {0x14, 0x01, 0xc0, 0x40, "3" }, - {0x14, 0x01, 0xc0, 0x80, "4" }, -}; - -STDDIPINFO(Drgnbowl) - -static struct BurnDIPInfo RaigaDIPList[]= -{ - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x5f, NULL }, - - {0 , 0xfe, 0 , 16 , "Coin A" }, - {0x11, 0x01, 0xf0, 0x00, "5 Coins 1 Credit" }, - {0x11, 0x01, 0xf0, 0x40, "4 Coins 1 Credit" }, - {0x11, 0x01, 0xf0, 0xa0, "3 Coins 1 Credit" }, - {0x11, 0x01, 0xf0, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xf0, 0x20, "3 Coins 2 Credits" }, - {0x11, 0x01, 0xf0, 0x80, "4 Coins 3 Credits" }, - {0x11, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xf0, 0xc0, "3 Coins 4 Credits" }, - {0x11, 0x01, 0xf0, 0xe0, "2 Coins 3 Credits" }, - {0x11, 0x01, 0xf0, 0x70, "1 Coin 2 Credits" }, - {0x11, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x11, 0x01, 0xf0, 0xb0, "1 Coin 3 Credits" }, - {0x11, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x11, 0x01, 0xf0, 0xd0, "1 Coin 5 Credits" }, - {0x11, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x11, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 16 , "Coin B" }, - {0x11, 0x01, 0x0f, 0x00, "5 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x04, "4 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x0a, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x01, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x0f, 0x02, "3 Coins 2 Credits" }, - {0x11, 0x01, 0x0f, 0x08, "4 Coins 3 Credits" }, - {0x11, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x0f, 0x0c, "3 Coins 4 Credits" }, - {0x11, 0x01, 0x0f, 0x0e, "2 Coins 3 Credits" }, - {0x11, 0x01, 0x0f, 0x07, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x11, 0x01, 0x0f, 0x0b, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x0f, 0x0d, "1 Coin 5 Credits" }, - {0x11, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x11, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x12, 0x01, 0x03, 0x03, "50k 200k" }, - {0x12, 0x01, 0x03, 0x01, "100k 300k" }, - {0x12, 0x01, 0x03, 0x02, "50k only" }, - {0x12, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x0c, 0x00, "2" }, - {0x12, 0x01, 0x0c, 0x0c, "3" }, - {0x12, 0x01, 0x0c, 0x04, "4" }, - {0x12, 0x01, 0x0c, 0x08, "5" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x30, 0x30, "Easy" }, - {0x12, 0x01, 0x30, 0x10, "Normal" }, - {0x12, 0x01, 0x30, 0x20, "Hard" }, - {0x12, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Raiga) - -static const INT32 jumppoints_00[0x100] = -{ - 0x6669, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1,0x4a46, -1, - -1,0x6704, -2, -1, -1, -1, -1, -1, - -1, -2, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -2, -1, -1, -1, -1,0x4e75, -1, -1, - -1, -2, -1,0x4e71,0x60fc, -1,0x7288, -1, - -1, -1, -1, -1, -1, -1, -1, -1 -}; - -static const INT32 jumppoints_other[0x100] = -{ - 0x5457,0x494e,0x5f4b,0x4149,0x5345,0x525f,0x4d49,0x5941, - 0x5241,0x5349,0x4d4f,0x4a49, -1, -1, -1, -1, - -1, -1, -2,0x594f, -1,0x4e75, -1, -1, - -1, -2, -1, -1,0x4e75, -1,0x5349, -1, - -1, -1, -1,0x4e75, -1,0x4849, -1, -1, - -2, -1, -1,0x524f, -1, -1, -1, -1, - -1, -2, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1 -}; - -static const INT32 wildfang_jumppoints[0x100] = -{ - 0x0c0c,0x0cac,0x0d42,0x0da2,0x0eea,0x112e,0x1300,0x13fa, - 0x159a,0x1630,0x109a,0x1700,0x1750,0x1806,0x18d6,0x1a44, - 0x1b52, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1 -}; - -static const INT32 *jumppoints; - -static void protection_w(UINT8 data) -{ - switch (data & 0xf0) - { - case 0x00: // init - prot = 0x00; - break; - - case 0x10: // high 4 bits of jump code - jumpcode = (data & 0x0f) << 4; - prot = 0x10; - break; - - case 0x20: // low 4 bits of jump code - jumpcode |= data & 0x0f; - if (jumppoints[jumpcode] == -2) { - jumppoints = jumppoints_other; - jumppointer = 1; - } - - if (jumppoints[jumpcode] == -1) { - jumpcode = 0; - } - prot = 0x20; - break; - - case 0x30: // bits 12-15 of function address - prot = 0x40 | ((jumppoints[jumpcode] >> 12) & 0x0f); - break; - - case 0x40: // bits 8-11 of function address - prot = 0x50 | ((jumppoints[jumpcode] >> 8) & 0x0f); - break; - - case 0x50: // bits 4-7 of function address - prot = 0x60 | ((jumppoints[jumpcode] >> 4) & 0x0f); - break; - - case 0x60: // bits 0-3 of function address - prot = 0x70 | ((jumppoints[jumpcode] >> 0) & 0x0f); - break; - } -} - -static UINT8 protection_r() -{ - return prot; -} - - -static void palette_write(INT32 offset, UINT16 pal) -{ - UINT8 b = (pal >> 8) & 0x0f; - UINT8 g = (pal >> 4) & 0x0f; - UINT8 r = (pal >> 0) & 0x0f; - - r = (r << 4) | r; - g = (g << 4) | g; - b = (b << 4) | b; - - Palette[offset] = (r << 16) | (g << 8) | b; - DrvPalette[offset] = BurnHighCol(r, g, b, 0); -} - -UINT8 __fastcall gaiden_read_byte(UINT32 address) -{ - switch (address) - { - case 0x07a001: - return DrvInputs[0]; - - case 0x07a002: - return DrvInputs[2]; - - case 0x07a003: - return DrvInputs[1]; - - case 0x07a004: - return DrvDips[1]; - - case 0x07a005: - return DrvDips[0]; - - case 0x07a007: // Raiga, Wild Fang - return protection_r(); - } - - return 0; -} - -UINT16 __fastcall gaiden_read_word(UINT32 address) -{ - switch (address) - { - case 0x07a000: - return DrvInputs[0]; - - case 0x07a002: - return (DrvInputs[2] << 8) | DrvInputs[1]; - - case 0x07a004: - return (DrvDips[1] << 8) | DrvDips[0]; - } - - return 0; -} - -void __fastcall gaiden_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xffffe000) == 0x78000) { - address &= 0x1fff; - - DrvPalRAM[address ^ 1] = data; - - palette_write(address>>1, *((UINT16*)(DrvPalRAM + (address & ~1)))); - - return; - } - - switch (address) - { - case 0x7a00e: // Dragon Bowl - soundlatch = data; - ZetRaiseIrq(0); - return; - - case 0x7a802: // Tecmo Knight - case 0x7a803: // Ninja Gaiden - soundlatch = data; - ZetNmi(); - return; - - case 0x7a804: // Raiga, Wild Fang - protection_w(data); - return; - - } -} - -void __fastcall gaiden_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xffffe000) == 0x78000) { - address &= 0x1ffe; - - *((UINT16*)(DrvPalRAM + address)) = data; - - palette_write(address>>1, *((UINT16*)(DrvPalRAM + address))); - - return; - } - - switch (address & 0xfffffffe) - { - case 0x7a104: - tx_scroll_y = data & 0x1ff; - return; - - case 0x7a10c: - tx_scroll_x = data & 0x3ff; - return; - - case 0x7a204: - fg_scroll_y = data & 0x1ff; - return; - - case 0x7a20c: - fg_scroll_x = data & 0x3ff; - return; - - case 0x7a304: - bg_scroll_y = data & 0x1ff; - return; - - case 0x7a30c: - bg_scroll_x = data & 0x3ff; - return; - - - case 0x7a808: - flipscreen = data & 1; - return; - - // Dragon Bowl - case 0x7f000: - bg_scroll_y = data & 0x1ff; - return; - - case 0x7f002: - bg_scroll_x = (data + 248) & 0x3ff; - return; - - case 0x7f004: - fg_scroll_y = data & 0x1ff; - return; - - case 0x7f006: - fg_scroll_x = (data + 252) & 0x3ff; - return; - } -} - - -void __fastcall gaiden_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf800: - MSM6295Command(0, data); - return; - - case 0xf810: - BurnYM2203Write(0, 0, data); - return; - - case 0xf811: - BurnYM2203Write(0, 1, data); - return; - - case 0xf820: - BurnYM2203Write(1, 0, data); - return; - - case 0xf821: - BurnYM2203Write(1, 1, data); - return; - } -} - -UINT8 __fastcall gaiden_sound_read(UINT16 address) -{ - switch (address) - { - case 0xf800: - return MSM6295ReadStatus(0); - - case 0xfc00: - return 0; - - case 0xfc20: - return soundlatch; - } - - return 0; -} - - -void __fastcall drgnbowl_sound_write(UINT16 address, UINT8 data) -{ - switch (address & 0xff) - { - case 0x00: - BurnYM2151SelectRegister(data); - return; - - case 0x01: - BurnYM2151WriteRegister(data); - return; - - case 0x80: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall drgnbowl_sound_read(UINT16 address) -{ - switch (address & 0xff) - { - case 0x01: - return BurnYM2151ReadStatus(); - - case 0x80: - return MSM6295ReadStatus(0); - - case 0xc0: - return soundlatch; - } - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KROM = Next; Next += 0x0040000; - DrvZ80ROM = Next; Next += 0x0010000; - - DrvGfxROM0 = Next; Next += 0x0020000; - DrvGfxROM1 = Next; Next += 0x0100000; - DrvGfxROM2 = Next; Next += 0x0100000; - DrvGfxROM3 = Next; Next += 0x0200000; - - DrvGfx0Transp = Next; Next += 0x0000800; - DrvGfx1Transp = Next; Next += 0x0001000; - DrvGfx2Transp = Next; Next += 0x0001000; - - MSM6295ROM = Next; Next += 0x0040000; - - DrvPalette = (UINT32*)Next; Next += 0x1000 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x0004000; - DrvVidRAM0 = Next; Next += 0x0001000; - DrvVidRAM1 = Next; Next += 0x0002000; - DrvVidRAM2 = Next; Next += 0x0002000; - DrvSprRAM = Next; Next += 0x0002000; - DrvPalRAM = Next; Next += 0x0002000; - - DrvZ80RAM = Next; Next += 0x0000800; - - Palette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - soundlatch = 0; - tx_scroll_x = 0; - tx_scroll_y = 0; - fg_scroll_x = 0; - fg_scroll_y = 0; - bg_scroll_x = 0; - bg_scroll_y = 0; - - flipscreen = 0; - - prot = 0; - jumpcode = 0; - jumppointer = 0; - - if (game == 2) { - jumppoints = jumppoints_00; - } else { - jumppoints = wildfang_jumppoints; - } - - prot = 0; - jumpcode = 0; - - DrvReset = 0; - - DrvRecalc = 1; - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - if (game == 1) { - BurnYM2151Reset(); - } else { - BurnYM2203Reset(); - } - - SetCurrentFrame(0); - - return 0; -} - -static INT32 DrvGfxDecode() -{ - static INT32 Planes[4] = { 0x000, 0x001, 0x002, 0x003 }; - static INT32 TileXOffsets[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, - 0x100, 0x104, 0x108, 0x10c, 0x110, 0x114, 0x118, 0x11c }; - static INT32 TileYOffsets[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - static INT32 SpriteXOffsets[8] = { 0x000000, 0x000004, 0x400000, 0x400004, - 0x000008, 0x00000c, 0x400008, 0x40000c }; - static INT32 SpriteYOffsets[8] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x010000); - - GfxDecode(0x00800, 4, 8, 8, Planes, TileXOffsets, TileYOffsets, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x080000); - - GfxDecode(0x01000, 4, 16, 16, Planes, TileXOffsets, TileYOffsets, 0x400, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x080000); - - GfxDecode(0x01000, 4, 16, 16, Planes, TileXOffsets, TileYOffsets, 0x400, tmp, DrvGfxROM2); - - memcpy (tmp, DrvGfxROM3, 0x100000); - - GfxDecode(0x08000, 4, 8, 8, Planes, SpriteXOffsets, SpriteYOffsets, 0x080, tmp, DrvGfxROM3); - - BurnFree (tmp); - - // Make transparency tables - { - memset(DrvGfx0Transp, 2, 0x0800); - for (INT32 i = 0; i < 0x20000; i++) { - if (DrvGfxROM0[i] != 0) DrvGfx0Transp[i>>6] |= 1; - if (DrvGfxROM0[i] == 0) DrvGfx0Transp[i>>6] &= ~2; - } - - memset(DrvGfx1Transp, 2, 0x1000); - memset(DrvGfx2Transp, 2, 0x1000); - for (INT32 i = 0; i < 0x100000; i++) { - if (DrvGfxROM1[i] != 0) DrvGfx1Transp[i>>8] |= 1; - if (DrvGfxROM1[i] == 0) DrvGfx1Transp[i>>8] &= ~2; - if (DrvGfxROM2[i] != 0) DrvGfx2Transp[i>>8] |= 1; - if (DrvGfxROM2[i] == 0) DrvGfx2Transp[i>>8] &= ~2; - } - } - - return 0; -} - -static INT32 drgnbowlDecode() -{ - UINT8 *buf = (UINT8*)BurnMalloc(0x100000); - if (buf == NULL) { - return 1; - } - - memcpy (buf, Drv68KROM, 0x40000); - - for (INT32 i = 0; i < 0x40000; i++) { - Drv68KROM[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,15,16,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)]; - } - - for (INT32 i = 0; i < 0x100000; i++) { - buf[i] = DrvGfxROM1[BITSWAP24(i,23,22,21,20,19,18,16,17,15,14,13,4,3,12,11,10,9,8,7,6,5,2,1,0)]; - } - - static INT32 CharPlanes[4] = { 0, 1, 2, 3 }; - static INT32 CharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; - static INT32 CharYOffsets[8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; - - static INT32 Planes[4] = { 0x600000, 0x400000, 0x200000, 0x000000 }; - static INT32 XOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; - static INT32 YOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; - - GfxDecode(0x02000, 4, 16, 16, Planes, XOffsets, YOffsets, 0x100, buf, DrvGfxROM1); - - memcpy (buf, DrvGfxROM3, 0x100000); - - for (INT32 i = 0; i < 0x100000; i++) buf[i] ^= 0xff; - - GfxDecode(0x02000, 4, 16, 16, Planes, XOffsets, YOffsets, 0x100, buf, DrvGfxROM3); - - memcpy (buf, DrvGfxROM0, 0x010000); - - GfxDecode(0x00800, 4, 8, 8, CharPlanes, CharXOffsets, CharYOffsets, 0x100, buf, DrvGfxROM0); - - BurnFree (buf); - - // Make transparency tables - { - memset(DrvGfx0Transp, 2, 0x0800); - for (INT32 i = 0; i < 0x20000; i++) { - if (DrvGfxROM0[i] != 0xf) DrvGfx0Transp[i>>6] |= 1; - if (DrvGfxROM0[i] == 0xf) DrvGfx0Transp[i>>6] &= ~2; - } - - memset(DrvGfx1Transp, 3, 0x1000); - memset(DrvGfx2Transp, 2, 0x1000); - for (INT32 i = 0; i < 0x100000; i++) { - if (DrvGfxROM2[i] != 0xf) DrvGfx2Transp[i>>8] |= 1; - if (DrvGfxROM2[i] == 0xf) DrvGfx2Transp[i>>8] &= ~2; - - } - } - - return 0; -} - -static INT32 DrvGetRoms() -{ - char* pRomName; - struct BurnRomInfo ri; - UINT8 *Load68K = Drv68KROM; - UINT8 *LoadZ80 = DrvZ80ROM; - UINT8 *LoadG0 = DrvGfxROM0; - UINT8 *LoadG1 = DrvGfxROM1; - UINT8 *LoadG2 = DrvGfxROM2; - UINT8 *LoadG3 = DrvGfxROM3; - UINT8 *LoadSND = MSM6295ROM; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & 7) == 1) { - if (BurnLoadRom(Load68K + 1, i + 0, 2)) return 1; - if (BurnLoadRom(Load68K + 0, i + 1, 2)) return 1; - Load68K += ri.nLen * 2; - i++; - continue; - } - - if ((ri.nType & 7) == 2) { - if (BurnLoadRom(LoadZ80, i, 1)) return 1; - LoadZ80 += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 3) { - if (BurnLoadRom(LoadG0, i, 1)) return 1; - LoadG0 += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 4) { - if (BurnLoadRom(LoadG1, i, 1)) return 1; - LoadG1 += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 5) { - if (BurnLoadRom(LoadG2, i, 1)) return 1; - LoadG2 += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 6) { - if (BurnLoadRom(LoadG3, i, 1)) return 1; - LoadG3 += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 7) { - if (BurnLoadRom(LoadSND, i, 1)) return 1; - LoadSND += ri.nLen; - continue; - } - } - - return 0; -} - -inline static void DrvYM2203IRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000; -} - - -static INT32 DrvInit() -{ - INT32 nLen; - - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - if (DrvGetRoms()) return 1; - if (game == 1) { - if (drgnbowlDecode()) return 1; - } else { - if (DrvGfxDecode()) return 1; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x060000, 0x063fff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x070000, 0x070fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x072000, 0x073fff, SM_RAM); - SekMapMemory(DrvVidRAM2, 0x074000, 0x075fff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x076000, 0x077fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x078000, 0x079fff, SM_ROM); - SekSetWriteByteHandler(0, gaiden_write_byte); - SekSetWriteWordHandler(0, gaiden_write_word); - SekSetReadByteHandler(0, gaiden_read_byte); - SekSetReadWordHandler(0, gaiden_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - if (game == 1) { - ZetMapArea(0x0000, 0xf7ff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xf7ff, 2, DrvZ80ROM); - ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM); - ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM); - ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); - ZetSetOutHandler(drgnbowl_sound_write); - ZetSetInHandler(drgnbowl_sound_read); - } else { - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(gaiden_sound_write); - ZetSetReadHandler(gaiden_sound_read); - } - ZetMemEnd(); - ZetClose(); - - if (game == 1) { - BurnYM2151Init(4000000); - BurnYM2151SetAllRoutes(0.40, BURN_SND_ROUTE_BOTH); - } else { - BurnYM2203Init(2, 4000000, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - } - - MSM6295Init(0, 1000000 / 132, 1); - MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - SekExit(); - ZetExit(); - - MSM6295Exit(0); - if (game == 1) { - BurnYM2151Exit(); - } else { - BurnYM2203Exit(); - } - - GenericTilesExit(); - - BurnFree (Mem); - - game = 0; - - return 0; -} - -static void gaiden_draw_sprites(INT32 prior) -{ - static const UINT8 layout[8][8] = - { - { 0, 1, 4, 5,16,17,20,21}, - { 2, 3, 6, 7,18,19,22,23}, - { 8, 9,12,13,24,25,28,29}, - {10,11,14,15,26,27,30,31}, - {32,33,36,37,48,49,52,53}, - {34,35,38,39,50,51,54,55}, - {40,41,44,45,56,57,60,61}, - {42,43,46,47,58,59,62,63} - }; - - INT32 count = 0; - const UINT16 *source = (UINT16*)DrvSprRAM; - - while (count < 256) - { - INT32 attributes = BURN_ENDIAN_SWAP_INT16(source[0]); - INT32 col,row; - - if (attributes & 0x04) - { - INT32 priority = (attributes >> 6) & 3; - - if (priority != prior) goto skip_sprite; - - INT32 flipx = (attributes & 1); - INT32 flipy = (attributes & 2); - - INT32 color = BURN_ENDIAN_SWAP_INT16(source[2]); - INT32 sizex = 1 << (color & 3); - INT32 sizey = 1 << ((color >> (game & 2)) & 3); - - INT32 number = (BURN_ENDIAN_SWAP_INT16(source[1]) & (sizex > 2 ? 0x7ff8 : 0x7ffc)); // raiga - - INT32 ypos = BURN_ENDIAN_SWAP_INT16(source[3]) & 0x01ff; - INT32 xpos = BURN_ENDIAN_SWAP_INT16(source[4]) & 0x01ff; - - if ((attributes & 0x20) && (GetCurrentFrame() & 1)) - goto skip_sprite; - - color = (color >> 4) & 0x0f; - - if (xpos >= 256) - xpos -= 512; - - if (ypos >= 256) - ypos -= 512; - - if (flipscreen) - { - flipx = !flipx; - flipy = !flipy; - - xpos = 256 - (sizex << 3) - xpos; - ypos = 256 - (sizey << 3) - ypos; - - if (xpos <= -256) - xpos += 512; - - if (ypos <= -256) - ypos += 512; - } - - for (row = 0; row < sizey; row++) - { - for (col = 0; col < sizex; col++) - { - INT32 sx = xpos + ((flipx ? (sizex - 1 - col) : col) << 3); - INT32 sy = ypos + ((flipy ? (sizey - 1 - row) : row) << 3); - - sy -= 16; - - if (sx < -15 || sx > 255 || sy < - 15 || sy > 223) continue; - - if (sx >= 0 && sx <= 240 && sy >= 0 && sy <= 208) { - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); - } else { - Render8x8Tile_Mask_FlipY(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); - } else { - Render8x8Tile_Mask(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); - } - } - } else { - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); - } - } - } - } - } - } -skip_sprite: - source += 8; - count++; - } -} - -static void drgnbowl_draw_sprites(INT32 priority) -{ - UINT16 *spriteram16 = (UINT16*)DrvSprRAM; - - INT32 i, code, color, x, y, flipx, flipy; - - for (i = 0x400 - 4; i >= 0; i -= 4) - { - if ((BURN_ENDIAN_SWAP_INT16(spriteram16[i + 3]) & 0x20) != priority) - continue; - - code = (BURN_ENDIAN_SWAP_INT16(spriteram16[i]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(spriteram16[i + 3]) & 0x1f) << 8); - y = 256 - (BURN_ENDIAN_SWAP_INT16(spriteram16[i + 1]) & 0xff) - 12; - x = BURN_ENDIAN_SWAP_INT16(spriteram16[i + 2]) & 0xff; - color = BURN_ENDIAN_SWAP_INT16(spriteram16[0x400 + i]) & 0x0f; - flipx = BURN_ENDIAN_SWAP_INT16(spriteram16[i + 3]) & 0x40; - flipy = BURN_ENDIAN_SWAP_INT16(spriteram16[i + 3]) & 0x80; - - if(BURN_ENDIAN_SWAP_INT16(spriteram16[0x400 + i]) & 0x80) - x -= 256; - - x += 256; - - y -= 16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y, color, 4, 0xf, 0x100, DrvGfxROM3); - if (x >= 497) Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x - 512, y, color, 4, 0xf, 0x100, DrvGfxROM3); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y, color, 4, 0xf, 0x100, DrvGfxROM3); - if (x >= 497) Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x - 512, y, color, 4, 0xf, 0x100, DrvGfxROM3); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, color, 4, 0xf, 0x100, DrvGfxROM3); - if (x >= 497) Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x - 512, y, color, 4, 0xf, 0x100, DrvGfxROM3); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, color, 4, 0xf, 0x100, DrvGfxROM3); - if (x >= 497) Render16x16Tile_Mask_Clip(pTransDraw, code, x - 512, y, color, 4, 0xf, 0x100, DrvGfxROM3); - } - } - } -} - -static void draw_layer(UINT16 *vidram, UINT8 *gfxbase, INT32 palette_offset, UINT16 scrollx, UINT16 scrolly, UINT8 *transptab, INT32 transp) -{ - for (INT32 offs = 0; offs < 0x800; offs++) - { - INT32 sx = (offs & 0x3f) << 4; - INT32 sy = (offs >> 6) << 4; - sx -= scrollx; - sy -= scrolly; - - if (sx < -15) sx += 1024; - if (sy < -15) sy += 512; - if (sy >= 0x100 || sx >= 0x100) continue; - - if (flipscreen) { - sy = 0x1ff - sy; - sx = 0x3ff - sx; - sy -= 0x110; - sx -= 0x310; - } - - sy -= 16; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vidram[0x0800 + offs]) & 0x0fff; - INT32 color = (BURN_ENDIAN_SWAP_INT16(vidram[offs]) >> 4) & 0x0f; - - if (game == 2) { //raiga - if (palette_offset == 0x300) { - color |= (BURN_ENDIAN_SWAP_INT16(vidram[offs]) & 0x08) << 4; - } - } - - if (sy >= 0 && sy <= 208 && sx >= 0 && sx <= 240) { - if (transptab[code] & 1) { - if (transptab[code] & 2) { - if (flipscreen) { - Render16x16Tile_FlipXY(pTransDraw, code, sx, sy, color, 4, palette_offset, gfxbase); - } else { - Render16x16Tile(pTransDraw, code, sx, sy, color, 4, palette_offset, gfxbase); - } - } else { - if (flipscreen) { - Render16x16Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, transp, palette_offset, gfxbase); - } else { - Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 4, transp, palette_offset, gfxbase); - } - } - } - } else { - if (transptab[code] & 1) { - if (transptab[code] & 2) { - if (flipscreen) { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, palette_offset, gfxbase); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, palette_offset, gfxbase); - } - } else { - if (flipscreen) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, transp, palette_offset, gfxbase); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, transp, palette_offset, gfxbase); - } - } - } - } - } -} - -static void draw_text(INT32 paloffset, INT32 transp) -{ - UINT16 *vidram = (UINT16*)DrvVidRAM0; - - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 2) & 0xf8; - - if (flipscreen) { - sy = 0xf8 - sy; - sx = 0xf8 - sx; - } - - sx -= tx_scroll_x; - sy -= tx_scroll_y + 16; - - // tx_scroll is used? - - INT32 code = BURN_ENDIAN_SWAP_INT16(vidram[0x400 + offs]) & 0x07ff; - INT32 color = (BURN_ENDIAN_SWAP_INT16(vidram[0x000 + offs]) >> 4) & 0x0f; - - if (!code) continue; - - if (sy >= 0 && sy <= 216 && sx >= 0 && sx <= 248) { - if (DrvGfx0Transp[code] & 1) { - if (DrvGfx0Transp[code] & 2) { - if (flipscreen) { - Render8x8Tile_FlipXY(pTransDraw, code, sx, sy, color, 4, paloffset, DrvGfxROM0); - } else { - Render8x8Tile(pTransDraw, code, sx, sy, color, 4, paloffset, DrvGfxROM0); - } - } else { - if (flipscreen) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, transp, paloffset, DrvGfxROM0); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, transp, paloffset, DrvGfxROM0); - } - } - } - } else { - if (DrvGfx0Transp[code] & 1) { - if (DrvGfx0Transp[code] & 2) { - if (flipscreen) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, paloffset, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, paloffset, DrvGfxROM0); - } - } else { - if (flipscreen) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, transp, paloffset, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, transp, paloffset, DrvGfxROM0); - } - } - } - } - } -} - -static INT32 DrgnbowlDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x1000; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - { - for (INT32 offs = 0; offs < nScreenWidth * nScreenHeight; offs++) { - pTransDraw[offs] = 0; - } - } - - draw_layer((UINT16*)DrvVidRAM2, DrvGfxROM1, 0x300, bg_scroll_x, bg_scroll_y, DrvGfx1Transp, -1); // no transp - drgnbowl_draw_sprites(0x20); - draw_layer((UINT16*)DrvVidRAM1, DrvGfxROM2, 0x200, fg_scroll_x, fg_scroll_y, DrvGfx2Transp, 0xf); - drgnbowl_draw_sprites(0x00); - draw_text(0, 0x0f); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x1000; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - { - for (INT32 offs = 0; offs < nScreenWidth * nScreenHeight; offs++) { - pTransDraw[offs] = 0x200; - } - } - - gaiden_draw_sprites(3); - draw_layer((UINT16*)DrvVidRAM2, DrvGfxROM1, 0x300, bg_scroll_x, bg_scroll_y, DrvGfx1Transp, 0); - gaiden_draw_sprites(2); - draw_layer((UINT16*)DrvVidRAM1, DrvGfxROM2, 0x200, fg_scroll_x, fg_scroll_y, DrvGfx2Transp, 0); - gaiden_draw_sprites(1); - draw_text(0x100,0); - gaiden_draw_sprites(0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - - { - DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - INT32 nCyclesTotal[2] = { (game == 1 ? 10000000 : 9216000) / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - - nCurrentCPU = 1; - if (game == 1) { - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - } else { - BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - } - - if (pBurnSoundOut && game == 1) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (game != 1) BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - if (game == 1) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } else { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - if (game == 1) { - DrgnbowlDraw(); - } else { - DrvDraw(); - } - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029523; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - MSM6295Scan(0, nAction); - - if (game == 1) { - BurnYM2151Scan(nAction); - } else { - BurnYM2203Scan(nAction, pnMin); - } - - SCAN_VAR(prot); - SCAN_VAR(jumpcode); - SCAN_VAR(jumppointer); - - SCAN_VAR(tx_scroll_x); - SCAN_VAR(tx_scroll_y); - SCAN_VAR(fg_scroll_x); - SCAN_VAR(fg_scroll_y); - SCAN_VAR(bg_scroll_x); - SCAN_VAR(bg_scroll_y); - - SCAN_VAR(soundlatch); - SCAN_VAR(flipscreen); - - if (jumppointer) { - jumppoints = jumppoints_other; - } - } - - return 0; -} - - -// Shadow Warriors (World, set 1) - -static struct BurnRomInfo shadowwRomDesc[] = { - { "shadowa_1.3s", 0x20000, 0x8290d567, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "shadowa_2.4s", 0x20000, 0xf3f08921, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "gaiden_3.4b", 0x10000, 0x75fd3e6a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "gaiden_5.7a", 0x10000, 0x8d4035f7, 3 | BRF_GRA }, // 3 Characters - - { "14.3a", 0x20000, 0x1ecfddaa, 4 | BRF_GRA }, // 4 Foreground Tiles - { "15.3b", 0x20000, 0x1291a696, 4 | BRF_GRA }, // 5 - { "16.1a", 0x20000, 0x140b47ca, 4 | BRF_GRA }, // 6 - { "17.1b", 0x20000, 0x7638cccb, 4 | BRF_GRA }, // 7 - - { "18.6a", 0x20000, 0x3fadafd6, 5 | BRF_GRA }, // 8 Background Tiles - { "19.6b", 0x20000, 0xddae9d5b, 5 | BRF_GRA }, // 9 - { "20.4b", 0x20000, 0x08cf7a93, 5 | BRF_GRA }, // 10 - { "21.4b", 0x20000, 0x1ac892f5, 5 | BRF_GRA }, // 11 - - { "6.3m", 0x20000, 0xe7ccdf9f, 6 | BRF_GRA }, // 12 Sprites - { "8.3n", 0x20000, 0x7ef7f880, 6 | BRF_GRA }, // 13 - { "10.3r", 0x20000, 0xa6451dec, 6 | BRF_GRA }, // 14 - { "shadoww_12a.xx", 0x10000, 0x9bb07731, 6 | BRF_GRA }, // 15 - { "shadoww_12b.xx", 0x10000, 0xa4a950a2, 6 | BRF_GRA }, // 16 - { "7.1m", 0x20000, 0x016bec95, 6 | BRF_GRA }, // 17 - { "9.1n", 0x20000, 0x6e9b7fd3, 6 | BRF_GRA }, // 18 - { "11.1r", 0x20000, 0x7fbfdf5e, 6 | BRF_GRA }, // 19 - { "shadoww_13a.xx", 0x10000, 0x996d2fa5, 6 | BRF_GRA }, // 20 - { "shadoww_13b.xx", 0x10000, 0xb8df8a34, 6 | BRF_GRA }, // 21 - - { "4.4a", 0x20000, 0xb0e0faf9, 7 | BRF_SND }, // 22 MSM6295 Samples -}; - -STD_ROM_PICK(shadoww) -STD_ROM_FN(shadoww) - -struct BurnDriver BurnDrvShadoww = { - "shadoww", NULL, NULL, NULL, "1988", - "Shadow Warriors (World, set 1)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, shadowwRomInfo, shadowwRomName, NULL, NULL, DrvInputInfo, GaidenDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Shadow Warriors (World, set 2) - -static struct BurnRomInfo shadowwaRomDesc[] = { - { "shadoww_1.3s", 0x20000, 0xfefba387, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "shadoww_2.4s", 0x20000, 0x9b9d6b18, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "gaiden_3.4b", 0x10000, 0x75fd3e6a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "gaiden_5.7a", 0x10000, 0x8d4035f7, 3 | BRF_GRA }, // 3 Characters - - { "14.3a", 0x20000, 0x1ecfddaa, 4 | BRF_GRA }, // 4 Foreground Tiles - { "15.3b", 0x20000, 0x1291a696, 4 | BRF_GRA }, // 5 - { "16.1a", 0x20000, 0x140b47ca, 4 | BRF_GRA }, // 6 - { "17.1b", 0x20000, 0x7638cccb, 4 | BRF_GRA }, // 7 - - { "18.6a", 0x20000, 0x3fadafd6, 5 | BRF_GRA }, // 8 Background Tiles - { "19.6b", 0x20000, 0xddae9d5b, 5 | BRF_GRA }, // 9 - { "20.4b", 0x20000, 0x08cf7a93, 5 | BRF_GRA }, // 10 - { "21.4b", 0x20000, 0x1ac892f5, 5 | BRF_GRA }, // 11 - - { "6.3m", 0x20000, 0xe7ccdf9f, 6 | BRF_GRA }, // 12 Sprites - { "8.3n", 0x20000, 0x7ef7f880, 6 | BRF_GRA }, // 13 - { "10.3r", 0x20000, 0xa6451dec, 6 | BRF_GRA }, // 14 - { "shadoww_12a.xx", 0x10000, 0x9bb07731, 6 | BRF_GRA }, // 15 - { "shadoww_12b.xx", 0x10000, 0xa4a950a2, 6 | BRF_GRA }, // 16 - { "7.1m", 0x20000, 0x016bec95, 6 | BRF_GRA }, // 17 - { "9.1n", 0x20000, 0x6e9b7fd3, 6 | BRF_GRA }, // 18 - { "11.1r", 0x20000, 0x7fbfdf5e, 6 | BRF_GRA }, // 19 - { "shadoww_13a.xx", 0x10000, 0x996d2fa5, 6 | BRF_GRA }, // 20 - { "shadoww_13b.xx", 0x10000, 0xb8df8a34, 6 | BRF_GRA }, // 21 - - { "4.4a", 0x20000, 0xb0e0faf9, 7 | BRF_SND }, // 22 MSM6295 Samples -}; - -STD_ROM_PICK(shadowwa) -STD_ROM_FN(shadowwa) - -struct BurnDriver BurnDrvShadowwa = { - "shadowwa", "shadoww", NULL, NULL, "1988", - "Shadow Warriors (World, set 2)\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, shadowwaRomInfo, shadowwaRomName, NULL, NULL, DrvInputInfo, GaidenDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Ninja Gaiden (US) - -static struct BurnRomInfo gaidenRomDesc[] = { - { "gaiden_1.3s", 0x20000, 0xe037ff7c, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "gaiden_2.4s", 0x20000, 0x454f7314, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "gaiden_3.4b", 0x10000, 0x75fd3e6a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "gaiden_5.7a", 0x10000, 0x8d4035f7, 3 | BRF_GRA }, // 3 Characters - - { "14.3a", 0x20000, 0x1ecfddaa, 4 | BRF_GRA }, // 4 Foreground Tiles - { "15.3b", 0x20000, 0x1291a696, 4 | BRF_GRA }, // 5 - { "16.1a", 0x20000, 0x140b47ca, 4 | BRF_GRA }, // 6 - { "17.1b", 0x20000, 0x7638cccb, 4 | BRF_GRA }, // 7 - - { "18.6a", 0x20000, 0x3fadafd6, 5 | BRF_GRA }, // 8 Background Tiles - { "19.6b", 0x20000, 0xddae9d5b, 5 | BRF_GRA }, // 9 - { "20.4b", 0x20000, 0x08cf7a93, 5 | BRF_GRA }, // 10 - { "21.4b", 0x20000, 0x1ac892f5, 5 | BRF_GRA }, // 11 - - { "6.3m", 0x20000, 0xe7ccdf9f, 6 | BRF_GRA }, // 12 Sprites - { "8.3n", 0x20000, 0x7ef7f880, 6 | BRF_GRA }, // 13 - { "10.3r", 0x20000, 0xa6451dec, 6 | BRF_GRA }, // 14 - { "gaiden_12.3s", 0x20000, 0x90f1e13a, 6 | BRF_GRA }, // 15 - { "7.1m", 0x20000, 0x016bec95, 6 | BRF_GRA }, // 16 - { "9.1n", 0x20000, 0x6e9b7fd3, 6 | BRF_GRA }, // 17 - { "11.1r", 0x20000, 0x7fbfdf5e, 6 | BRF_GRA }, // 18 - { "gaiden_13.1s", 0x20000, 0x7d9f5c5e, 6 | BRF_GRA }, // 19 - - { "4.4a", 0x20000, 0xb0e0faf9, 7 | BRF_SND }, // 20 MSM6295 Samples -}; - -STD_ROM_PICK(gaiden) -STD_ROM_FN(gaiden) - -struct BurnDriver BurnDrvGaiden = { - "gaiden", "shadoww", NULL, NULL, "1988", - "Ninja Gaiden (US)\0", NULL, "Tecmo", "Miscellaneous", - L"Ninja \u5916\u4F1D Gaiden (US)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, gaidenRomInfo, gaidenRomName, NULL, NULL, DrvInputInfo, GaidenDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Ninja Ryukenden (Japan, set 1) - -static struct BurnRomInfo ryukendnRomDesc[] = { - { "ryukendn_1.3s", 0x20000, 0x6203a5e2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ryukendn_2.4s", 0x20000, 0x9e99f522, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "3.4b", 0x10000, 0x6b686b69, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "hn27512p.7a", 0x10000, 0x765e7baa, 3 | BRF_GRA }, // 3 Characters - - { "14.3a", 0x20000, 0x1ecfddaa, 4 | BRF_GRA }, // 4 Foreground Tiles - { "15.3b", 0x20000, 0x1291a696, 4 | BRF_GRA }, // 5 - { "16.1a", 0x20000, 0x140b47ca, 4 | BRF_GRA }, // 6 - { "17.1b", 0x20000, 0x7638cccb, 4 | BRF_GRA }, // 7 - - { "18.6a", 0x20000, 0x3fadafd6, 5 | BRF_GRA }, // 8 Background Tiles - { "19.6b", 0x20000, 0xddae9d5b, 5 | BRF_GRA }, // 9 - { "20.4b", 0x20000, 0x08cf7a93, 5 | BRF_GRA }, // 10 - { "21.4b", 0x20000, 0x1ac892f5, 5 | BRF_GRA }, // 11 - - { "6.3m", 0x20000, 0xe7ccdf9f, 6 | BRF_GRA }, // 12 Sprites - { "8.3n", 0x20000, 0x7ef7f880, 6 | BRF_GRA }, // 13 - { "10.3r", 0x20000, 0xa6451dec, 6 | BRF_GRA }, // 14 - { "shadoww_12a.xx", 0x10000, 0x9bb07731, 6 | BRF_GRA }, // 15 - { "ryukendn_12b.xx",0x10000, 0x1773628a, 6 | BRF_GRA }, // 16 - { "7.1m", 0x20000, 0x016bec95, 6 | BRF_GRA }, // 17 - { "9.1n", 0x20000, 0x6e9b7fd3, 6 | BRF_GRA }, // 18 - { "11.1r", 0x20000, 0x7fbfdf5e, 6 | BRF_GRA }, // 19 - { "shadoww_13a.xx", 0x10000, 0x996d2fa5, 6 | BRF_GRA }, // 20 - { "ryukendn_13b.xx",0x10000, 0x1f43c507, 6 | BRF_GRA }, // 21 - - { "4.4a", 0x20000, 0xb0e0faf9, 7 | BRF_SND }, // 22 MSM6295 Samples -}; - -STD_ROM_PICK(ryukendn) -STD_ROM_FN(ryukendn) - -struct BurnDriver BurnDrvRyukendn = { - "ryukendn", "shadoww", NULL, NULL, "1989", - "Ninja Ryukenden (Japan, set 1)\0", NULL, "Tecmo", "Miscellaneous", - L"\u5FCD\u8005 \u9F8D\u5263\u4F1D (Japan, set 1)\0Ninja Ryukenden\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, ryukendnRomInfo, ryukendnRomName, NULL, NULL, DrvInputInfo, GaidenDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Ninja Ryukenden (Japan, set 2) - -static struct BurnRomInfo ryukendaRomDesc[] = { - { "1.3s", 0x20000, 0x0ed5464c, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "2.4s", 0x20000, 0xa93a8256, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "3.4b", 0x10000, 0x6b686b69, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "hn27512p.7a", 0x10000, 0x765e7baa, 3 | BRF_GRA }, // 3 Characters - - { "14.3a", 0x20000, 0x1ecfddaa, 4 | BRF_GRA }, // 4 Foreground Tiles - { "15.3b", 0x20000, 0x1291a696, 4 | BRF_GRA }, // 5 - { "16.1a", 0x20000, 0x140b47ca, 4 | BRF_GRA }, // 6 - { "17.1b", 0x20000, 0x7638cccb, 4 | BRF_GRA }, // 7 - - { "18.6a", 0x20000, 0x3fadafd6, 5 | BRF_GRA }, // 8 Background Tiles - { "19.6b", 0x20000, 0xddae9d5b, 5 | BRF_GRA }, // 9 - { "20.4b", 0x20000, 0x08cf7a93, 5 | BRF_GRA }, // 10 - { "21.4b", 0x20000, 0x1ac892f5, 5 | BRF_GRA }, // 11 - - { "6.3m", 0x20000, 0xe7ccdf9f, 6 | BRF_GRA }, // 12 Sprites - { "8.3n", 0x20000, 0x7ef7f880, 6 | BRF_GRA }, // 13 - { "10.3r", 0x20000, 0xa6451dec, 6 | BRF_GRA }, // 14 - { "12.3s", 0x20000, 0x277204f0, 6 | BRF_GRA }, // 15 - { "7.1m", 0x20000, 0x016bec95, 6 | BRF_GRA }, // 16 - { "9.1n", 0x20000, 0x6e9b7fd3, 6 | BRF_GRA }, // 17 - { "11.1r", 0x20000, 0x7fbfdf5e, 6 | BRF_GRA }, // 18 - { "13.1s", 0x20000, 0x4e56a508, 6 | BRF_GRA }, // 19 - - { "4.4a", 0x20000, 0xb0e0faf9, 7 | BRF_SND }, // 20 MSM6295 Samples -}; - -STD_ROM_PICK(ryukenda) -STD_ROM_FN(ryukenda) - -struct BurnDriver BurnDrvRyukenda = { - "ryukendna", "shadoww", NULL, NULL, "1989", - "Ninja Ryukenden (Japan, set 2)\0", NULL, "Tecmo", "Miscellaneous", - L"\u5FCD\u8005 \u9F8D\u5263\u4F1D (Japan, set 2)\0Ninja Ryukenden\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, ryukendaRomInfo, ryukendaRomName, NULL, NULL, DrvInputInfo, GaidenDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Wild Fang / Tecmo Knight - -static struct BurnRomInfo wildfangRomDesc[] = { - { "1.3st", 0x20000, 0xab876c9b, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "2.5st", 0x20000, 0x1dc74b3b, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "tkni3.bin", 0x10000, 0x15623ec7, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "tkni5.bin", 0x10000, 0x5ed15896, 3 | BRF_GRA }, // 3 Characters - - { "14.3a", 0x20000, 0x0d20c10c, 4 | BRF_GRA }, // 4 Foreground Tiles - { "15.3b", 0x20000, 0x3f40a6b4, 4 | BRF_GRA }, // 5 - { "16.1a", 0x20000, 0x0f31639e, 4 | BRF_GRA }, // 6 - { "17.1b", 0x20000, 0xf32c158e, 4 | BRF_GRA }, // 7 - - { "tkni6.bin", 0x80000, 0xf68fafb1, 5 | BRF_GRA }, // 8 - - { "tkni9.bin", 0x80000, 0xd22f4239, 6 | BRF_GRA }, // 9 Sprites - { "tkni8.bin", 0x80000, 0x4931b184, 6 | BRF_GRA }, // 10 - - { "tkni4.bin", 0x20000, 0xa7a1dbcf, 7 | BRF_SND }, // 11 MSM6295 Samples - - { "a-6v.mcu", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(wildfang) -STD_ROM_FN(wildfang) - -struct BurnDriver BurnDrvWildfang = { - "wildfang", NULL, NULL, NULL, "1989", - "Wild Fang / Tecmo Knight\0", NULL, "Tecmo", "Miscellaneous", - L"Wild Fang\0Tecmo Knight\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, wildfangRomInfo, wildfangRomName, NULL, NULL, DrvInputInfo, WildfangDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Tecmo Knight - -static struct BurnRomInfo tknightRomDesc[] = { - { "tkni1.bin", 0x20000, 0x9121daa8, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tkni2.bin", 0x20000, 0x6669cd87, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "tkni3.bin", 0x10000, 0x15623ec7, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "tkni5.bin", 0x10000, 0x5ed15896, 3 | BRF_GRA }, // 3 Characters - - { "tkni7.bin", 0x80000, 0x4b4d4286, 4 | BRF_GRA }, // 4 Foreground Tiles - - { "tkni6.bin", 0x80000, 0xf68fafb1, 5 | BRF_GRA }, // 5 - - { "tkni9.bin", 0x80000, 0xd22f4239, 6 | BRF_GRA }, // 6 Sprites - { "tkni8.bin", 0x80000, 0x4931b184, 6 | BRF_GRA }, // 7 - - { "tkni4.bin", 0x20000, 0xa7a1dbcf, 7 | BRF_SND }, // 8 MSM6295 Samples - - { "a-6v.mcu", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(tknight) -STD_ROM_FN(tknight) - -struct BurnDriver BurnDrvTknight = { - "tknight", "wildfang", NULL, NULL, "1989", - "Tecmo Knight\0", NULL, "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, - NULL, tknightRomInfo, tknightRomName, NULL, NULL, DrvInputInfo, TknightDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Raiga - Strato Fighter (US) - -static struct BurnRomInfo stratofRomDesc[] = { - { "1.3s", 0x20000, 0x060822a4, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "2.4s", 0x20000, 0x339358fa, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "a-4b.3", 0x10000, 0x18655c95, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "b-7a.5", 0x10000, 0x6d2e4bf1, 3 | BRF_GRA }, // 3 Characters - - { "b-1b", 0x80000, 0x781d1bd2, 4 | BRF_GRA }, // 4 Foreground Tiles - - { "b-4b", 0x80000, 0x89468b84, 5 | BRF_GRA }, // 5 - - { "b-2m", 0x80000, 0x5794ec32, 6 | BRF_GRA }, // 6 Sprites - { "b-1m", 0x80000, 0xb0de0ded, 6 | BRF_GRA }, // 7 - - { "a-4a.4", 0x20000, 0xef9acdcf, 7 | BRF_SND }, // 8 MSM6295 Samples - - { "a-6v.mcu", 0x01000, 0x00000000, 0 | BRF_NODUMP }, // 9 MCU -}; - -STD_ROM_PICK(stratof) -STD_ROM_FN(stratof) - -static INT32 stratofInit() -{ - game = 2; - - return DrvInit(); -} - -struct BurnDriver BurnDrvStratof = { - "stratof", NULL, NULL, NULL, "1991", - "Raiga - Strato Fighter (US)\0", NULL, "Tecmo", "Miscellaneous", - L"\u96F7\u7259 Strato Fighter (US)\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, stratofRomInfo, stratofRomName, NULL, NULL, RaigaInputInfo, RaigaDIPInfo, - stratofInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Raiga - Strato Fighter (Japan) - -static struct BurnRomInfo raigaRomDesc[] = { - { "a-3s.1", 0x20000, 0x303c2a6c, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "a-4s.2", 0x20000, 0x5f31fecb, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "a-4b.3", 0x10000, 0x18655c95, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "b-7a.5", 0x10000, 0x6d2e4bf1, 3 | BRF_GRA }, // 3 Characters - - { "b-1b", 0x80000, 0x781d1bd2, 4 | BRF_GRA }, // 4 Foreground Tiles - - { "b-4b", 0x80000, 0x89468b84, 5 | BRF_GRA }, // 5 - - { "b-2m", 0x80000, 0x5794ec32, 6 | BRF_GRA }, // 6 Sprites - { "b-1m", 0x80000, 0xb0de0ded, 6 | BRF_GRA }, // 7 - - { "a-4a.4", 0x20000, 0xef9acdcf, 7 | BRF_SND }, // 8 MSM6295 Samples - - { "a-6v.mcu", 0x01000, 0x00000000, 0 | BRF_NODUMP }, // 9 MCU -}; - -STD_ROM_PICK(raiga) -STD_ROM_FN(raiga) - -struct BurnDriver BurnDrvRaiga = { - "raiga", "stratof", NULL, NULL, "1991", - "Raiga - Strato Fighter (Japan)\0", NULL, "Tecmo", "Miscellaneous", - L"\u96F7\u7259 Strato Fighter (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, raigaRomInfo, raigaRomName, NULL, NULL, RaigaInputInfo, RaigaDIPInfo, - stratofInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Dragon Bowl - -static struct BurnRomInfo drgnbowlRomDesc[] = { - { "4.3h", 0x20000, 0x90730008, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "5.4h", 0x20000, 0x193cc915, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "1.2r", 0x10000, 0xd9cbf84a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "22.6m", 0x10000, 0x86e41198, 3 | BRF_GRA }, // 3 Characters - - { "6.5a", 0x20000, 0xb15759f7, 4 | BRF_GRA }, // 4 Foreground & Background Tiles - { "7.5b", 0x20000, 0x2541d445, 4 | BRF_GRA }, // 5 - { "8.6a", 0x20000, 0x51a2f5c4, 4 | BRF_GRA }, // 6 - { "9.6b", 0x20000, 0xf4c8850f, 4 | BRF_GRA }, // 7 - { "10.7a", 0x20000, 0x9e4b3c61, 4 | BRF_GRA }, // 8 - { "11.7b", 0x20000, 0x0d33d083, 4 | BRF_GRA }, // 9 - { "12.8a", 0x20000, 0x6c497ad3, 4 | BRF_GRA }, // 10 - { "13.8b", 0x20000, 0x7a84adff, 4 | BRF_GRA }, // 11 - - { "21.8r", 0x20000, 0x0cee8711, 6 | BRF_GRA }, // 18 Sprites - { "20.8q", 0x20000, 0x9647e02a, 6 | BRF_GRA }, // 19 - { "19.7r", 0x20000, 0x5082ceff, 6 | BRF_GRA }, // 16 - { "18.7q", 0x20000, 0xd18a7ffb, 6 | BRF_GRA }, // 17 - { "17.6r", 0x20000, 0x9088af09, 6 | BRF_GRA }, // 14 - { "16.6q", 0x20000, 0x8ade4e01, 6 | BRF_GRA }, // 15 - { "15.5r", 0x20000, 0x7429371c, 6 | BRF_GRA }, // 12 - { "14.5q", 0x20000, 0x4301b97f, 6 | BRF_GRA }, // 13 - - { "3.3q", 0x20000, 0x489c6d0e, 7 | BRF_SND }, // 20 MSM6295 Samples - { "2.3r", 0x20000, 0x7710ce39, 7 | BRF_SND }, // 21 -}; - -STD_ROM_PICK(drgnbowl) -STD_ROM_FN(drgnbowl) - -static INT32 drgnbowlInit() -{ - game = 1; - - INT32 nRet = DrvInit(); - - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -struct BurnDriver BurnDrvDrgnbowl = { - "drgnbowl", NULL, NULL, NULL, "1992", - "Dragon Bowl\0", NULL, "Nics", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, - NULL, drgnbowlRomInfo, drgnbowlRomName, NULL, NULL, DrvInputInfo, DrgnbowlDIPInfo, - drgnbowlInit, DrvExit, DrvFrame, DrgnbowlDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - +// FB Alpha Ninja Gaiden driver module +// Based on MAME driver by Alex Pasadyn, Phil Stroffolino, Nicola Salmoria, and various others + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "msm6295.h" +#include "burn_ym2151.h" +#include "burn_ym2203.h" +#include "bitswap.h" + + +static INT32 game = 0; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static UINT8 *Mem, *MemEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; + +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvGfx0Transp; +static UINT8 *DrvGfx1Transp; +static UINT8 *DrvGfx2Transp; + +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KRAM; +static UINT8 *DrvVidRAM0; +static UINT8 *DrvVidRAM1; +static UINT8 *DrvVidRAM2; +static UINT8 *DrvSprRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *DrvPalette; +static UINT32 *Palette; +static UINT8 DrvRecalc; + +static INT32 flipscreen; +static UINT8 soundlatch; + +static INT32 prot; +static INT32 jumpcode; +static INT32 jumppointer; + +static INT32 tx_scroll_x; +static INT32 tx_scroll_y; +static INT32 fg_scroll_x; +static INT32 fg_scroll_y; +static INT32 bg_scroll_x; +static INT32 bg_scroll_y; + + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p1 right" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 6, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 3"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 6, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 3"}, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo RaigaInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 6, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 7, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p1 right" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 1, "p2 right" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 2, "p2 down" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 3, "p2 up" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p2 fire 2"}, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Raiga) + +static struct BurnDIPInfo GaidenDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x01, 0x00, "Off" }, + {0x13, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 3 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x04, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 4 , "Energy" }, + {0x14, 0x01, 0x30, 0x00, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x10, "4" }, + {0x14, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0xc0, 0x00, "1" }, + {0x14, 0x01, 0xc0, 0xc0, "2" }, + {0x14, 0x01, 0xc0, 0x40, "3" }, + {0x14, 0x01, 0xc0, 0x80, "4" }, +}; + +STDDIPINFO(Gaiden) + +static struct BurnDIPInfo WildfangDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x01, 0x00, "Off" }, + {0x13, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 3 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x04, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 2 , "Title" }, + {0x14, 0x01, 0x01, 0x01, "Wild Fang" }, + {0x14, 0x01, 0x01, 0x00, "Tecmo Knight" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, // Wild Fang + {0x14, 0x02, 0x0c, 0x0c, "Easy" }, + {0x14, 0x00, 0x01, 0x01, NULL }, + {0x14, 0x02, 0x0c, 0x04, "Normal" }, + {0x14, 0x00, 0x01, 0x01, NULL }, + {0x14, 0x02, 0x0c, 0x08, "Hard" }, + {0x14, 0x00, 0x01, 0x01, NULL }, + {0x14, 0x02, 0x0c, 0x00, "Hardest" }, + {0x14, 0x00, 0x01, 0x01, NULL }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, // Tecmo Knight + {0x14, 0x02, 0x30, 0x30, "Easy" }, + {0x14, 0x00, 0x01, 0x00, NULL }, + {0x14, 0x02, 0x30, 0x10, "Normal" }, + {0x14, 0x00, 0x01, 0x00, NULL }, + {0x14, 0x02, 0x30, 0x20, "Hard" }, + {0x14, 0x00, 0x01, 0x00, NULL }, + {0x14, 0x02, 0x30, 0x00, "Hardest" }, + {0x14, 0x00, 0x01, 0x00, NULL }, + + {0 , 0xfe, 0 , 3 , "Lives" }, + {0x14, 0x01, 0xc0, 0x80, "1" }, + {0x14, 0x01, 0xc0, 0xc0, "2" }, + {0x14, 0x01, 0xc0, 0x40, "3" }, +// {0x14, 0x01, 0xc0, 0x00, "2" }, +}; + +STDDIPINFO(Wildfang) + +static struct BurnDIPInfo TknightDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x01, 0x00, "Off" }, + {0x13, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 3 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x04, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x30, 0x30, "Easy" }, + {0x14, 0x01, 0x30, 0x10, "Normal" }, + {0x14, 0x01, 0x30, 0x20, "Hard" }, + {0x14, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 3 , "Lives" }, + {0x14, 0x01, 0xc0, 0x80, "1" }, + {0x14, 0x01, 0xc0, 0xc0, "2" }, + {0x14, 0x01, 0xc0, 0x40, "3" }, +// {0x14, 0x01, 0xc0, 0x00, "2" }, +}; + +STDDIPINFO(Tknight) + +static struct BurnDIPInfo DrgnbowlDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x01, 0x00, "Off" }, + {0x13, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 3 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x04, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 4 , "Energy" }, + {0x14, 0x01, 0x30, 0x00, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x10, "4" }, + {0x14, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0xc0, 0x00, "1" }, + {0x14, 0x01, 0xc0, 0xc0, "2" }, + {0x14, 0x01, 0xc0, 0x40, "3" }, + {0x14, 0x01, 0xc0, 0x80, "4" }, +}; + +STDDIPINFO(Drgnbowl) + +static struct BurnDIPInfo RaigaDIPList[]= +{ + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x5f, NULL }, + + {0 , 0xfe, 0 , 16 , "Coin A" }, + {0x11, 0x01, 0xf0, 0x00, "5 Coins 1 Credit" }, + {0x11, 0x01, 0xf0, 0x40, "4 Coins 1 Credit" }, + {0x11, 0x01, 0xf0, 0xa0, "3 Coins 1 Credit" }, + {0x11, 0x01, 0xf0, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xf0, 0x20, "3 Coins 2 Credits" }, + {0x11, 0x01, 0xf0, 0x80, "4 Coins 3 Credits" }, + {0x11, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xf0, 0xc0, "3 Coins 4 Credits" }, + {0x11, 0x01, 0xf0, 0xe0, "2 Coins 3 Credits" }, + {0x11, 0x01, 0xf0, 0x70, "1 Coin 2 Credits" }, + {0x11, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x11, 0x01, 0xf0, 0xb0, "1 Coin 3 Credits" }, + {0x11, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x11, 0x01, 0xf0, 0xd0, "1 Coin 5 Credits" }, + {0x11, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x11, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 16 , "Coin B" }, + {0x11, 0x01, 0x0f, 0x00, "5 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x04, "4 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x0a, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x01, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x0f, 0x02, "3 Coins 2 Credits" }, + {0x11, 0x01, 0x0f, 0x08, "4 Coins 3 Credits" }, + {0x11, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x0f, 0x0c, "3 Coins 4 Credits" }, + {0x11, 0x01, 0x0f, 0x0e, "2 Coins 3 Credits" }, + {0x11, 0x01, 0x0f, 0x07, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x11, 0x01, 0x0f, 0x0b, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x0f, 0x0d, "1 Coin 5 Credits" }, + {0x11, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x11, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x12, 0x01, 0x03, 0x03, "50k 200k" }, + {0x12, 0x01, 0x03, 0x01, "100k 300k" }, + {0x12, 0x01, 0x03, 0x02, "50k only" }, + {0x12, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x0c, 0x00, "2" }, + {0x12, 0x01, 0x0c, 0x0c, "3" }, + {0x12, 0x01, 0x0c, 0x04, "4" }, + {0x12, 0x01, 0x0c, 0x08, "5" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x30, 0x30, "Easy" }, + {0x12, 0x01, 0x30, 0x10, "Normal" }, + {0x12, 0x01, 0x30, 0x20, "Hard" }, + {0x12, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Raiga) + +static const INT32 jumppoints_00[0x100] = +{ + 0x6669, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1,0x4a46, -1, + -1,0x6704, -2, -1, -1, -1, -1, -1, + -1, -2, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -2, -1, -1, -1, -1,0x4e75, -1, -1, + -1, -2, -1,0x4e71,0x60fc, -1,0x7288, -1, + -1, -1, -1, -1, -1, -1, -1, -1 +}; + +static const INT32 jumppoints_other[0x100] = +{ + 0x5457,0x494e,0x5f4b,0x4149,0x5345,0x525f,0x4d49,0x5941, + 0x5241,0x5349,0x4d4f,0x4a49, -1, -1, -1, -1, + -1, -1, -2,0x594f, -1,0x4e75, -1, -1, + -1, -2, -1, -1,0x4e75, -1,0x5349, -1, + -1, -1, -1,0x4e75, -1,0x4849, -1, -1, + -2, -1, -1,0x524f, -1, -1, -1, -1, + -1, -2, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1 +}; + +static const INT32 wildfang_jumppoints[0x100] = +{ + 0x0c0c,0x0cac,0x0d42,0x0da2,0x0eea,0x112e,0x1300,0x13fa, + 0x159a,0x1630,0x109a,0x1700,0x1750,0x1806,0x18d6,0x1a44, + 0x1b52, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1 +}; + +static const INT32 *jumppoints; + +static void protection_w(UINT8 data) +{ + switch (data & 0xf0) + { + case 0x00: // init + prot = 0x00; + break; + + case 0x10: // high 4 bits of jump code + jumpcode = (data & 0x0f) << 4; + prot = 0x10; + break; + + case 0x20: // low 4 bits of jump code + jumpcode |= data & 0x0f; + if (jumppoints[jumpcode] == -2) { + jumppoints = jumppoints_other; + jumppointer = 1; + } + + if (jumppoints[jumpcode] == -1) { + jumpcode = 0; + } + prot = 0x20; + break; + + case 0x30: // bits 12-15 of function address + prot = 0x40 | ((jumppoints[jumpcode] >> 12) & 0x0f); + break; + + case 0x40: // bits 8-11 of function address + prot = 0x50 | ((jumppoints[jumpcode] >> 8) & 0x0f); + break; + + case 0x50: // bits 4-7 of function address + prot = 0x60 | ((jumppoints[jumpcode] >> 4) & 0x0f); + break; + + case 0x60: // bits 0-3 of function address + prot = 0x70 | ((jumppoints[jumpcode] >> 0) & 0x0f); + break; + } +} + +static UINT8 protection_r() +{ + return prot; +} + + +static void palette_write(INT32 offset, UINT16 pal) +{ + UINT8 b = (pal >> 8) & 0x0f; + UINT8 g = (pal >> 4) & 0x0f; + UINT8 r = (pal >> 0) & 0x0f; + + r = (r << 4) | r; + g = (g << 4) | g; + b = (b << 4) | b; + + Palette[offset] = (r << 16) | (g << 8) | b; + DrvPalette[offset] = BurnHighCol(r, g, b, 0); +} + +UINT8 __fastcall gaiden_read_byte(UINT32 address) +{ + switch (address) + { + case 0x07a001: + return DrvInputs[0]; + + case 0x07a002: + return DrvInputs[2]; + + case 0x07a003: + return DrvInputs[1]; + + case 0x07a004: + return DrvDips[1]; + + case 0x07a005: + return DrvDips[0]; + + case 0x07a007: // Raiga, Wild Fang + return protection_r(); + } + + return 0; +} + +UINT16 __fastcall gaiden_read_word(UINT32 address) +{ + switch (address) + { + case 0x07a000: + return DrvInputs[0]; + + case 0x07a002: + return (DrvInputs[2] << 8) | DrvInputs[1]; + + case 0x07a004: + return (DrvDips[1] << 8) | DrvDips[0]; + } + + return 0; +} + +void __fastcall gaiden_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xffffe000) == 0x78000) { + address &= 0x1fff; + + DrvPalRAM[address ^ 1] = data; + + palette_write(address>>1, *((UINT16*)(DrvPalRAM + (address & ~1)))); + + return; + } + + switch (address) + { + case 0x7a00e: // Dragon Bowl + soundlatch = data; + ZetRaiseIrq(0); + return; + + case 0x7a802: // Tecmo Knight + case 0x7a803: // Ninja Gaiden + soundlatch = data; + ZetNmi(); + return; + + case 0x7a804: // Raiga, Wild Fang + protection_w(data); + return; + + } +} + +void __fastcall gaiden_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xffffe000) == 0x78000) { + address &= 0x1ffe; + + *((UINT16*)(DrvPalRAM + address)) = data; + + palette_write(address>>1, *((UINT16*)(DrvPalRAM + address))); + + return; + } + + switch (address & 0xfffffffe) + { + case 0x7a104: + tx_scroll_y = data & 0x1ff; + return; + + case 0x7a10c: + tx_scroll_x = data & 0x3ff; + return; + + case 0x7a204: + fg_scroll_y = data & 0x1ff; + return; + + case 0x7a20c: + fg_scroll_x = data & 0x3ff; + return; + + case 0x7a304: + bg_scroll_y = data & 0x1ff; + return; + + case 0x7a30c: + bg_scroll_x = data & 0x3ff; + return; + + + case 0x7a808: + flipscreen = data & 1; + return; + + // Dragon Bowl + case 0x7f000: + bg_scroll_y = data & 0x1ff; + return; + + case 0x7f002: + bg_scroll_x = (data + 248) & 0x3ff; + return; + + case 0x7f004: + fg_scroll_y = data & 0x1ff; + return; + + case 0x7f006: + fg_scroll_x = (data + 252) & 0x3ff; + return; + } +} + + +void __fastcall gaiden_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf800: + MSM6295Command(0, data); + return; + + case 0xf810: + BurnYM2203Write(0, 0, data); + return; + + case 0xf811: + BurnYM2203Write(0, 1, data); + return; + + case 0xf820: + BurnYM2203Write(1, 0, data); + return; + + case 0xf821: + BurnYM2203Write(1, 1, data); + return; + } +} + +UINT8 __fastcall gaiden_sound_read(UINT16 address) +{ + switch (address) + { + case 0xf800: + return MSM6295ReadStatus(0); + + case 0xfc00: + return 0; + + case 0xfc20: + return soundlatch; + } + + return 0; +} + + +void __fastcall drgnbowl_sound_write(UINT16 address, UINT8 data) +{ + switch (address & 0xff) + { + case 0x00: + BurnYM2151SelectRegister(data); + return; + + case 0x01: + BurnYM2151WriteRegister(data); + return; + + case 0x80: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall drgnbowl_sound_read(UINT16 address) +{ + switch (address & 0xff) + { + case 0x01: + return BurnYM2151ReadStatus(); + + case 0x80: + return MSM6295ReadStatus(0); + + case 0xc0: + return soundlatch; + } + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KROM = Next; Next += 0x0040000; + DrvZ80ROM = Next; Next += 0x0010000; + + DrvGfxROM0 = Next; Next += 0x0020000; + DrvGfxROM1 = Next; Next += 0x0100000; + DrvGfxROM2 = Next; Next += 0x0100000; + DrvGfxROM3 = Next; Next += 0x0200000; + + DrvGfx0Transp = Next; Next += 0x0000800; + DrvGfx1Transp = Next; Next += 0x0001000; + DrvGfx2Transp = Next; Next += 0x0001000; + + MSM6295ROM = Next; Next += 0x0040000; + + DrvPalette = (UINT32*)Next; Next += 0x1000 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x0004000; + DrvVidRAM0 = Next; Next += 0x0001000; + DrvVidRAM1 = Next; Next += 0x0002000; + DrvVidRAM2 = Next; Next += 0x0002000; + DrvSprRAM = Next; Next += 0x0002000; + DrvPalRAM = Next; Next += 0x0002000; + + DrvZ80RAM = Next; Next += 0x0000800; + + Palette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + soundlatch = 0; + tx_scroll_x = 0; + tx_scroll_y = 0; + fg_scroll_x = 0; + fg_scroll_y = 0; + bg_scroll_x = 0; + bg_scroll_y = 0; + + flipscreen = 0; + + prot = 0; + jumpcode = 0; + jumppointer = 0; + + if (game == 2) { + jumppoints = jumppoints_00; + } else { + jumppoints = wildfang_jumppoints; + } + + prot = 0; + jumpcode = 0; + + DrvReset = 0; + + DrvRecalc = 1; + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + if (game == 1) { + BurnYM2151Reset(); + } else { + BurnYM2203Reset(); + } + + SetCurrentFrame(0); + + return 0; +} + +static INT32 DrvGfxDecode() +{ + static INT32 Planes[4] = { 0x000, 0x001, 0x002, 0x003 }; + static INT32 TileXOffsets[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, + 0x100, 0x104, 0x108, 0x10c, 0x110, 0x114, 0x118, 0x11c }; + static INT32 TileYOffsets[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + static INT32 SpriteXOffsets[8] = { 0x000000, 0x000004, 0x400000, 0x400004, + 0x000008, 0x00000c, 0x400008, 0x40000c }; + static INT32 SpriteYOffsets[8] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x010000); + + GfxDecode(0x00800, 4, 8, 8, Planes, TileXOffsets, TileYOffsets, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x080000); + + GfxDecode(0x01000, 4, 16, 16, Planes, TileXOffsets, TileYOffsets, 0x400, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x080000); + + GfxDecode(0x01000, 4, 16, 16, Planes, TileXOffsets, TileYOffsets, 0x400, tmp, DrvGfxROM2); + + memcpy (tmp, DrvGfxROM3, 0x100000); + + GfxDecode(0x08000, 4, 8, 8, Planes, SpriteXOffsets, SpriteYOffsets, 0x080, tmp, DrvGfxROM3); + + BurnFree (tmp); + + // Make transparency tables + { + memset(DrvGfx0Transp, 2, 0x0800); + for (INT32 i = 0; i < 0x20000; i++) { + if (DrvGfxROM0[i] != 0) DrvGfx0Transp[i>>6] |= 1; + if (DrvGfxROM0[i] == 0) DrvGfx0Transp[i>>6] &= ~2; + } + + memset(DrvGfx1Transp, 2, 0x1000); + memset(DrvGfx2Transp, 2, 0x1000); + for (INT32 i = 0; i < 0x100000; i++) { + if (DrvGfxROM1[i] != 0) DrvGfx1Transp[i>>8] |= 1; + if (DrvGfxROM1[i] == 0) DrvGfx1Transp[i>>8] &= ~2; + if (DrvGfxROM2[i] != 0) DrvGfx2Transp[i>>8] |= 1; + if (DrvGfxROM2[i] == 0) DrvGfx2Transp[i>>8] &= ~2; + } + } + + return 0; +} + +static INT32 drgnbowlDecode() +{ + UINT8 *buf = (UINT8*)BurnMalloc(0x100000); + if (buf == NULL) { + return 1; + } + + memcpy (buf, Drv68KROM, 0x40000); + + for (INT32 i = 0; i < 0x40000; i++) { + Drv68KROM[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,15,16,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)]; + } + + for (INT32 i = 0; i < 0x100000; i++) { + buf[i] = DrvGfxROM1[BITSWAP24(i,23,22,21,20,19,18,16,17,15,14,13,4,3,12,11,10,9,8,7,6,5,2,1,0)]; + } + + static INT32 CharPlanes[4] = { 0, 1, 2, 3 }; + static INT32 CharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; + static INT32 CharYOffsets[8] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0 }; + + static INT32 Planes[4] = { 0x600000, 0x400000, 0x200000, 0x000000 }; + static INT32 XOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; + static INT32 YOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; + + GfxDecode(0x02000, 4, 16, 16, Planes, XOffsets, YOffsets, 0x100, buf, DrvGfxROM1); + + memcpy (buf, DrvGfxROM3, 0x100000); + + for (INT32 i = 0; i < 0x100000; i++) buf[i] ^= 0xff; + + GfxDecode(0x02000, 4, 16, 16, Planes, XOffsets, YOffsets, 0x100, buf, DrvGfxROM3); + + memcpy (buf, DrvGfxROM0, 0x010000); + + GfxDecode(0x00800, 4, 8, 8, CharPlanes, CharXOffsets, CharYOffsets, 0x100, buf, DrvGfxROM0); + + BurnFree (buf); + + // Make transparency tables + { + memset(DrvGfx0Transp, 2, 0x0800); + for (INT32 i = 0; i < 0x20000; i++) { + if (DrvGfxROM0[i] != 0xf) DrvGfx0Transp[i>>6] |= 1; + if (DrvGfxROM0[i] == 0xf) DrvGfx0Transp[i>>6] &= ~2; + } + + memset(DrvGfx1Transp, 3, 0x1000); + memset(DrvGfx2Transp, 2, 0x1000); + for (INT32 i = 0; i < 0x100000; i++) { + if (DrvGfxROM2[i] != 0xf) DrvGfx2Transp[i>>8] |= 1; + if (DrvGfxROM2[i] == 0xf) DrvGfx2Transp[i>>8] &= ~2; + + } + } + + return 0; +} + +static INT32 DrvGetRoms() +{ + char* pRomName; + struct BurnRomInfo ri; + UINT8 *Load68K = Drv68KROM; + UINT8 *LoadZ80 = DrvZ80ROM; + UINT8 *LoadG0 = DrvGfxROM0; + UINT8 *LoadG1 = DrvGfxROM1; + UINT8 *LoadG2 = DrvGfxROM2; + UINT8 *LoadG3 = DrvGfxROM3; + UINT8 *LoadSND = MSM6295ROM; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & 7) == 1) { + if (BurnLoadRom(Load68K + 1, i + 0, 2)) return 1; + if (BurnLoadRom(Load68K + 0, i + 1, 2)) return 1; + Load68K += ri.nLen * 2; + i++; + continue; + } + + if ((ri.nType & 7) == 2) { + if (BurnLoadRom(LoadZ80, i, 1)) return 1; + LoadZ80 += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 3) { + if (BurnLoadRom(LoadG0, i, 1)) return 1; + LoadG0 += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 4) { + if (BurnLoadRom(LoadG1, i, 1)) return 1; + LoadG1 += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 5) { + if (BurnLoadRom(LoadG2, i, 1)) return 1; + LoadG2 += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 6) { + if (BurnLoadRom(LoadG3, i, 1)) return 1; + LoadG3 += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 7) { + if (BurnLoadRom(LoadSND, i, 1)) return 1; + LoadSND += ri.nLen; + continue; + } + } + + return 0; +} + +inline static void DrvYM2203IRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000; +} + + +static INT32 DrvInit() +{ + INT32 nLen; + + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + if (DrvGetRoms()) return 1; + if (game == 1) { + if (drgnbowlDecode()) return 1; + } else { + if (DrvGfxDecode()) return 1; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x060000, 0x063fff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x070000, 0x070fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x072000, 0x073fff, SM_RAM); + SekMapMemory(DrvVidRAM2, 0x074000, 0x075fff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x076000, 0x077fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x078000, 0x079fff, SM_ROM); + SekSetWriteByteHandler(0, gaiden_write_byte); + SekSetWriteWordHandler(0, gaiden_write_word); + SekSetReadByteHandler(0, gaiden_read_byte); + SekSetReadWordHandler(0, gaiden_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + if (game == 1) { + ZetMapArea(0x0000, 0xf7ff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xf7ff, 2, DrvZ80ROM); + ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM); + ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM); + ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); + ZetSetOutHandler(drgnbowl_sound_write); + ZetSetInHandler(drgnbowl_sound_read); + } else { + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(gaiden_sound_write); + ZetSetReadHandler(gaiden_sound_read); + } + ZetClose(); + + if (game == 1) { + BurnYM2151Init(4000000); + BurnYM2151SetAllRoutes(0.40, BURN_SND_ROUTE_BOTH); + } else { + BurnYM2203Init(2, 4000000, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + } + + MSM6295Init(0, 1000000 / 132, 1); + MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + SekExit(); + ZetExit(); + + MSM6295Exit(0); + if (game == 1) { + BurnYM2151Exit(); + } else { + BurnYM2203Exit(); + } + + GenericTilesExit(); + + BurnFree (Mem); + + game = 0; + + return 0; +} + +static void gaiden_draw_sprites(INT32 prior) +{ + static const UINT8 layout[8][8] = + { + { 0, 1, 4, 5,16,17,20,21}, + { 2, 3, 6, 7,18,19,22,23}, + { 8, 9,12,13,24,25,28,29}, + {10,11,14,15,26,27,30,31}, + {32,33,36,37,48,49,52,53}, + {34,35,38,39,50,51,54,55}, + {40,41,44,45,56,57,60,61}, + {42,43,46,47,58,59,62,63} + }; + + INT32 count = 0; + const UINT16 *source = (UINT16*)DrvSprRAM; + + while (count < 256) + { + INT32 attributes = BURN_ENDIAN_SWAP_INT16(source[0]); + INT32 col,row; + + if (attributes & 0x04) + { + INT32 priority = (attributes >> 6) & 3; + + if (priority != prior) goto skip_sprite; + + INT32 flipx = (attributes & 1); + INT32 flipy = (attributes & 2); + + INT32 color = BURN_ENDIAN_SWAP_INT16(source[2]); + INT32 sizex = 1 << (color & 3); + INT32 sizey = 1 << ((color >> (game & 2)) & 3); + + INT32 number = (BURN_ENDIAN_SWAP_INT16(source[1]) & (sizex > 2 ? 0x7ff8 : 0x7ffc)); // raiga + + INT32 ypos = BURN_ENDIAN_SWAP_INT16(source[3]) & 0x01ff; + INT32 xpos = BURN_ENDIAN_SWAP_INT16(source[4]) & 0x01ff; + + if ((attributes & 0x20) && (GetCurrentFrame() & 1)) + goto skip_sprite; + + color = (color >> 4) & 0x0f; + + if (xpos >= 256) + xpos -= 512; + + if (ypos >= 256) + ypos -= 512; + + if (flipscreen) + { + flipx = !flipx; + flipy = !flipy; + + xpos = 256 - (sizex << 3) - xpos; + ypos = 256 - (sizey << 3) - ypos; + + if (xpos <= -256) + xpos += 512; + + if (ypos <= -256) + ypos += 512; + } + + for (row = 0; row < sizey; row++) + { + for (col = 0; col < sizex; col++) + { + INT32 sx = xpos + ((flipx ? (sizex - 1 - col) : col) << 3); + INT32 sy = ypos + ((flipy ? (sizey - 1 - row) : row) << 3); + + sy -= 16; + + if (sx < -15 || sx > 255 || sy < - 15 || sy > 223) continue; + + if (sx >= 0 && sx <= 240 && sy >= 0 && sy <= 208) { + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); + } else { + Render8x8Tile_Mask_FlipY(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); + } else { + Render8x8Tile_Mask(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); + } + } + } else { + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, number + layout[row][col], sx, sy, color, 4, 0, 0, DrvGfxROM3); + } + } + } + } + } + } +skip_sprite: + source += 8; + count++; + } +} + +static void drgnbowl_draw_sprites(INT32 priority) +{ + UINT16 *spriteram16 = (UINT16*)DrvSprRAM; + + INT32 i, code, color, x, y, flipx, flipy; + + for (i = 0x400 - 4; i >= 0; i -= 4) + { + if ((BURN_ENDIAN_SWAP_INT16(spriteram16[i + 3]) & 0x20) != priority) + continue; + + code = (BURN_ENDIAN_SWAP_INT16(spriteram16[i]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(spriteram16[i + 3]) & 0x1f) << 8); + y = 256 - (BURN_ENDIAN_SWAP_INT16(spriteram16[i + 1]) & 0xff) - 12; + x = BURN_ENDIAN_SWAP_INT16(spriteram16[i + 2]) & 0xff; + color = BURN_ENDIAN_SWAP_INT16(spriteram16[0x400 + i]) & 0x0f; + flipx = BURN_ENDIAN_SWAP_INT16(spriteram16[i + 3]) & 0x40; + flipy = BURN_ENDIAN_SWAP_INT16(spriteram16[i + 3]) & 0x80; + + if(BURN_ENDIAN_SWAP_INT16(spriteram16[0x400 + i]) & 0x80) + x -= 256; + + x += 256; + + y -= 16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y, color, 4, 0xf, 0x100, DrvGfxROM3); + if (x >= 497) Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x - 512, y, color, 4, 0xf, 0x100, DrvGfxROM3); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y, color, 4, 0xf, 0x100, DrvGfxROM3); + if (x >= 497) Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x - 512, y, color, 4, 0xf, 0x100, DrvGfxROM3); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, color, 4, 0xf, 0x100, DrvGfxROM3); + if (x >= 497) Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x - 512, y, color, 4, 0xf, 0x100, DrvGfxROM3); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, color, 4, 0xf, 0x100, DrvGfxROM3); + if (x >= 497) Render16x16Tile_Mask_Clip(pTransDraw, code, x - 512, y, color, 4, 0xf, 0x100, DrvGfxROM3); + } + } + } +} + +static void draw_layer(UINT16 *vidram, UINT8 *gfxbase, INT32 palette_offset, UINT16 scrollx, UINT16 scrolly, UINT8 *transptab, INT32 transp) +{ + for (INT32 offs = 0; offs < 0x800; offs++) + { + INT32 sx = (offs & 0x3f) << 4; + INT32 sy = (offs >> 6) << 4; + sx -= scrollx; + sy -= scrolly; + + if (sx < -15) sx += 1024; + if (sy < -15) sy += 512; + if (sy >= 0x100 || sx >= 0x100) continue; + + if (flipscreen) { + sy = 0x1ff - sy; + sx = 0x3ff - sx; + sy -= 0x110; + sx -= 0x310; + } + + sy -= 16; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vidram[0x0800 + offs]) & 0x0fff; + INT32 color = (BURN_ENDIAN_SWAP_INT16(vidram[offs]) >> 4) & 0x0f; + + if (game == 2) { //raiga + if (palette_offset == 0x300) { + color |= (BURN_ENDIAN_SWAP_INT16(vidram[offs]) & 0x08) << 4; + } + } + + if (sy >= 0 && sy <= 208 && sx >= 0 && sx <= 240) { + if (transptab[code] & 1) { + if (transptab[code] & 2) { + if (flipscreen) { + Render16x16Tile_FlipXY(pTransDraw, code, sx, sy, color, 4, palette_offset, gfxbase); + } else { + Render16x16Tile(pTransDraw, code, sx, sy, color, 4, palette_offset, gfxbase); + } + } else { + if (flipscreen) { + Render16x16Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, transp, palette_offset, gfxbase); + } else { + Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 4, transp, palette_offset, gfxbase); + } + } + } + } else { + if (transptab[code] & 1) { + if (transptab[code] & 2) { + if (flipscreen) { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, palette_offset, gfxbase); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, palette_offset, gfxbase); + } + } else { + if (flipscreen) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, transp, palette_offset, gfxbase); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, transp, palette_offset, gfxbase); + } + } + } + } + } +} + +static void draw_text(INT32 paloffset, INT32 transp) +{ + UINT16 *vidram = (UINT16*)DrvVidRAM0; + + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 2) & 0xf8; + + if (flipscreen) { + sy = 0xf8 - sy; + sx = 0xf8 - sx; + } + + sx -= tx_scroll_x; + sy -= tx_scroll_y + 16; + + // tx_scroll is used? + + INT32 code = BURN_ENDIAN_SWAP_INT16(vidram[0x400 + offs]) & 0x07ff; + INT32 color = (BURN_ENDIAN_SWAP_INT16(vidram[0x000 + offs]) >> 4) & 0x0f; + + if (!code) continue; + + if (sy >= 0 && sy <= 216 && sx >= 0 && sx <= 248) { + if (DrvGfx0Transp[code] & 1) { + if (DrvGfx0Transp[code] & 2) { + if (flipscreen) { + Render8x8Tile_FlipXY(pTransDraw, code, sx, sy, color, 4, paloffset, DrvGfxROM0); + } else { + Render8x8Tile(pTransDraw, code, sx, sy, color, 4, paloffset, DrvGfxROM0); + } + } else { + if (flipscreen) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, transp, paloffset, DrvGfxROM0); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, transp, paloffset, DrvGfxROM0); + } + } + } + } else { + if (DrvGfx0Transp[code] & 1) { + if (DrvGfx0Transp[code] & 2) { + if (flipscreen) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, paloffset, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, paloffset, DrvGfxROM0); + } + } else { + if (flipscreen) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, transp, paloffset, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, transp, paloffset, DrvGfxROM0); + } + } + } + } + } +} + +static INT32 DrgnbowlDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x1000; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + { + for (INT32 offs = 0; offs < nScreenWidth * nScreenHeight; offs++) { + pTransDraw[offs] = 0; + } + } + + draw_layer((UINT16*)DrvVidRAM2, DrvGfxROM1, 0x300, bg_scroll_x, bg_scroll_y, DrvGfx1Transp, -1); // no transp + drgnbowl_draw_sprites(0x20); + draw_layer((UINT16*)DrvVidRAM1, DrvGfxROM2, 0x200, fg_scroll_x, fg_scroll_y, DrvGfx2Transp, 0xf); + drgnbowl_draw_sprites(0x00); + draw_text(0, 0x0f); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x1000; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + { + for (INT32 offs = 0; offs < nScreenWidth * nScreenHeight; offs++) { + pTransDraw[offs] = 0x200; + } + } + + gaiden_draw_sprites(3); + draw_layer((UINT16*)DrvVidRAM2, DrvGfxROM1, 0x300, bg_scroll_x, bg_scroll_y, DrvGfx1Transp, 0); + gaiden_draw_sprites(2); + draw_layer((UINT16*)DrvVidRAM1, DrvGfxROM2, 0x200, fg_scroll_x, fg_scroll_y, DrvGfx2Transp, 0); + gaiden_draw_sprites(1); + draw_text(0x100,0); + gaiden_draw_sprites(0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + + { + DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + INT32 nCyclesTotal[2] = { (game == 1 ? 10000000 : 9216000) / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + + nCurrentCPU = 1; + if (game == 1) { + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + } else { + BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + } + + if (pBurnSoundOut && game == 1) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (game != 1) BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + if (game == 1) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } else { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + if (game == 1) { + DrgnbowlDraw(); + } else { + DrvDraw(); + } + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029523; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All RAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + MSM6295Scan(0, nAction); + + if (game == 1) { + BurnYM2151Scan(nAction); + } else { + BurnYM2203Scan(nAction, pnMin); + } + + SCAN_VAR(prot); + SCAN_VAR(jumpcode); + SCAN_VAR(jumppointer); + + SCAN_VAR(tx_scroll_x); + SCAN_VAR(tx_scroll_y); + SCAN_VAR(fg_scroll_x); + SCAN_VAR(fg_scroll_y); + SCAN_VAR(bg_scroll_x); + SCAN_VAR(bg_scroll_y); + + SCAN_VAR(soundlatch); + SCAN_VAR(flipscreen); + + if (jumppointer) { + jumppoints = jumppoints_other; + } + } + + return 0; +} + + +// Shadow Warriors (World, set 1) + +static struct BurnRomInfo shadowwRomDesc[] = { + { "shadowa_1.3s", 0x20000, 0x8290d567, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "shadowa_2.4s", 0x20000, 0xf3f08921, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "gaiden_3.4b", 0x10000, 0x75fd3e6a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "gaiden_5.7a", 0x10000, 0x8d4035f7, 3 | BRF_GRA }, // 3 Characters + + { "14.3a", 0x20000, 0x1ecfddaa, 4 | BRF_GRA }, // 4 Foreground Tiles + { "15.3b", 0x20000, 0x1291a696, 4 | BRF_GRA }, // 5 + { "16.1a", 0x20000, 0x140b47ca, 4 | BRF_GRA }, // 6 + { "17.1b", 0x20000, 0x7638cccb, 4 | BRF_GRA }, // 7 + + { "18.6a", 0x20000, 0x3fadafd6, 5 | BRF_GRA }, // 8 Background Tiles + { "19.6b", 0x20000, 0xddae9d5b, 5 | BRF_GRA }, // 9 + { "20.4b", 0x20000, 0x08cf7a93, 5 | BRF_GRA }, // 10 + { "21.4b", 0x20000, 0x1ac892f5, 5 | BRF_GRA }, // 11 + + { "6.3m", 0x20000, 0xe7ccdf9f, 6 | BRF_GRA }, // 12 Sprites + { "8.3n", 0x20000, 0x7ef7f880, 6 | BRF_GRA }, // 13 + { "10.3r", 0x20000, 0xa6451dec, 6 | BRF_GRA }, // 14 + { "shadoww_12a.xx", 0x10000, 0x9bb07731, 6 | BRF_GRA }, // 15 + { "shadoww_12b.xx", 0x10000, 0xa4a950a2, 6 | BRF_GRA }, // 16 + { "7.1m", 0x20000, 0x016bec95, 6 | BRF_GRA }, // 17 + { "9.1n", 0x20000, 0x6e9b7fd3, 6 | BRF_GRA }, // 18 + { "11.1r", 0x20000, 0x7fbfdf5e, 6 | BRF_GRA }, // 19 + { "shadoww_13a.xx", 0x10000, 0x996d2fa5, 6 | BRF_GRA }, // 20 + { "shadoww_13b.xx", 0x10000, 0xb8df8a34, 6 | BRF_GRA }, // 21 + + { "4.4a", 0x20000, 0xb0e0faf9, 7 | BRF_SND }, // 22 MSM6295 Samples +}; + +STD_ROM_PICK(shadoww) +STD_ROM_FN(shadoww) + +struct BurnDriver BurnDrvShadoww = { + "shadoww", NULL, NULL, NULL, "1988", + "Shadow Warriors (World, set 1)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, shadowwRomInfo, shadowwRomName, NULL, NULL, DrvInputInfo, GaidenDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Shadow Warriors (World, set 2) + +static struct BurnRomInfo shadowwaRomDesc[] = { + { "shadoww_1.3s", 0x20000, 0xfefba387, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "shadoww_2.4s", 0x20000, 0x9b9d6b18, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "gaiden_3.4b", 0x10000, 0x75fd3e6a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "gaiden_5.7a", 0x10000, 0x8d4035f7, 3 | BRF_GRA }, // 3 Characters + + { "14.3a", 0x20000, 0x1ecfddaa, 4 | BRF_GRA }, // 4 Foreground Tiles + { "15.3b", 0x20000, 0x1291a696, 4 | BRF_GRA }, // 5 + { "16.1a", 0x20000, 0x140b47ca, 4 | BRF_GRA }, // 6 + { "17.1b", 0x20000, 0x7638cccb, 4 | BRF_GRA }, // 7 + + { "18.6a", 0x20000, 0x3fadafd6, 5 | BRF_GRA }, // 8 Background Tiles + { "19.6b", 0x20000, 0xddae9d5b, 5 | BRF_GRA }, // 9 + { "20.4b", 0x20000, 0x08cf7a93, 5 | BRF_GRA }, // 10 + { "21.4b", 0x20000, 0x1ac892f5, 5 | BRF_GRA }, // 11 + + { "6.3m", 0x20000, 0xe7ccdf9f, 6 | BRF_GRA }, // 12 Sprites + { "8.3n", 0x20000, 0x7ef7f880, 6 | BRF_GRA }, // 13 + { "10.3r", 0x20000, 0xa6451dec, 6 | BRF_GRA }, // 14 + { "shadoww_12a.xx", 0x10000, 0x9bb07731, 6 | BRF_GRA }, // 15 + { "shadoww_12b.xx", 0x10000, 0xa4a950a2, 6 | BRF_GRA }, // 16 + { "7.1m", 0x20000, 0x016bec95, 6 | BRF_GRA }, // 17 + { "9.1n", 0x20000, 0x6e9b7fd3, 6 | BRF_GRA }, // 18 + { "11.1r", 0x20000, 0x7fbfdf5e, 6 | BRF_GRA }, // 19 + { "shadoww_13a.xx", 0x10000, 0x996d2fa5, 6 | BRF_GRA }, // 20 + { "shadoww_13b.xx", 0x10000, 0xb8df8a34, 6 | BRF_GRA }, // 21 + + { "4.4a", 0x20000, 0xb0e0faf9, 7 | BRF_SND }, // 22 MSM6295 Samples +}; + +STD_ROM_PICK(shadowwa) +STD_ROM_FN(shadowwa) + +struct BurnDriver BurnDrvShadowwa = { + "shadowwa", "shadoww", NULL, NULL, "1988", + "Shadow Warriors (World, set 2)\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, shadowwaRomInfo, shadowwaRomName, NULL, NULL, DrvInputInfo, GaidenDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Ninja Gaiden (US) + +static struct BurnRomInfo gaidenRomDesc[] = { + { "gaiden_1.3s", 0x20000, 0xe037ff7c, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "gaiden_2.4s", 0x20000, 0x454f7314, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "gaiden_3.4b", 0x10000, 0x75fd3e6a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "gaiden_5.7a", 0x10000, 0x8d4035f7, 3 | BRF_GRA }, // 3 Characters + + { "14.3a", 0x20000, 0x1ecfddaa, 4 | BRF_GRA }, // 4 Foreground Tiles + { "15.3b", 0x20000, 0x1291a696, 4 | BRF_GRA }, // 5 + { "16.1a", 0x20000, 0x140b47ca, 4 | BRF_GRA }, // 6 + { "17.1b", 0x20000, 0x7638cccb, 4 | BRF_GRA }, // 7 + + { "18.6a", 0x20000, 0x3fadafd6, 5 | BRF_GRA }, // 8 Background Tiles + { "19.6b", 0x20000, 0xddae9d5b, 5 | BRF_GRA }, // 9 + { "20.4b", 0x20000, 0x08cf7a93, 5 | BRF_GRA }, // 10 + { "21.4b", 0x20000, 0x1ac892f5, 5 | BRF_GRA }, // 11 + + { "6.3m", 0x20000, 0xe7ccdf9f, 6 | BRF_GRA }, // 12 Sprites + { "8.3n", 0x20000, 0x7ef7f880, 6 | BRF_GRA }, // 13 + { "10.3r", 0x20000, 0xa6451dec, 6 | BRF_GRA }, // 14 + { "gaiden_12.3s", 0x20000, 0x90f1e13a, 6 | BRF_GRA }, // 15 + { "7.1m", 0x20000, 0x016bec95, 6 | BRF_GRA }, // 16 + { "9.1n", 0x20000, 0x6e9b7fd3, 6 | BRF_GRA }, // 17 + { "11.1r", 0x20000, 0x7fbfdf5e, 6 | BRF_GRA }, // 18 + { "gaiden_13.1s", 0x20000, 0x7d9f5c5e, 6 | BRF_GRA }, // 19 + + { "4.4a", 0x20000, 0xb0e0faf9, 7 | BRF_SND }, // 20 MSM6295 Samples +}; + +STD_ROM_PICK(gaiden) +STD_ROM_FN(gaiden) + +struct BurnDriver BurnDrvGaiden = { + "gaiden", "shadoww", NULL, NULL, "1988", + "Ninja Gaiden (US)\0", NULL, "Tecmo", "Miscellaneous", + L"Ninja \u5916\u4F1D Gaiden (US)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, gaidenRomInfo, gaidenRomName, NULL, NULL, DrvInputInfo, GaidenDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Ninja Ryukenden (Japan, set 1) + +static struct BurnRomInfo ryukendnRomDesc[] = { + { "ryukendn_1.3s", 0x20000, 0x6203a5e2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ryukendn_2.4s", 0x20000, 0x9e99f522, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "3.4b", 0x10000, 0x6b686b69, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "hn27512p.7a", 0x10000, 0x765e7baa, 3 | BRF_GRA }, // 3 Characters + + { "14.3a", 0x20000, 0x1ecfddaa, 4 | BRF_GRA }, // 4 Foreground Tiles + { "15.3b", 0x20000, 0x1291a696, 4 | BRF_GRA }, // 5 + { "16.1a", 0x20000, 0x140b47ca, 4 | BRF_GRA }, // 6 + { "17.1b", 0x20000, 0x7638cccb, 4 | BRF_GRA }, // 7 + + { "18.6a", 0x20000, 0x3fadafd6, 5 | BRF_GRA }, // 8 Background Tiles + { "19.6b", 0x20000, 0xddae9d5b, 5 | BRF_GRA }, // 9 + { "20.4b", 0x20000, 0x08cf7a93, 5 | BRF_GRA }, // 10 + { "21.4b", 0x20000, 0x1ac892f5, 5 | BRF_GRA }, // 11 + + { "6.3m", 0x20000, 0xe7ccdf9f, 6 | BRF_GRA }, // 12 Sprites + { "8.3n", 0x20000, 0x7ef7f880, 6 | BRF_GRA }, // 13 + { "10.3r", 0x20000, 0xa6451dec, 6 | BRF_GRA }, // 14 + { "shadoww_12a.xx", 0x10000, 0x9bb07731, 6 | BRF_GRA }, // 15 + { "ryukendn_12b.xx",0x10000, 0x1773628a, 6 | BRF_GRA }, // 16 + { "7.1m", 0x20000, 0x016bec95, 6 | BRF_GRA }, // 17 + { "9.1n", 0x20000, 0x6e9b7fd3, 6 | BRF_GRA }, // 18 + { "11.1r", 0x20000, 0x7fbfdf5e, 6 | BRF_GRA }, // 19 + { "shadoww_13a.xx", 0x10000, 0x996d2fa5, 6 | BRF_GRA }, // 20 + { "ryukendn_13b.xx",0x10000, 0x1f43c507, 6 | BRF_GRA }, // 21 + + { "4.4a", 0x20000, 0xb0e0faf9, 7 | BRF_SND }, // 22 MSM6295 Samples +}; + +STD_ROM_PICK(ryukendn) +STD_ROM_FN(ryukendn) + +struct BurnDriver BurnDrvRyukendn = { + "ryukendn", "shadoww", NULL, NULL, "1989", + "Ninja Ryukenden (Japan, set 1)\0", NULL, "Tecmo", "Miscellaneous", + L"\u5FCD\u8005 \u9F8D\u5263\u4F1D (Japan, set 1)\0Ninja Ryukenden\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, ryukendnRomInfo, ryukendnRomName, NULL, NULL, DrvInputInfo, GaidenDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Ninja Ryukenden (Japan, set 2) + +static struct BurnRomInfo ryukendaRomDesc[] = { + { "1.3s", 0x20000, 0x0ed5464c, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "2.4s", 0x20000, 0xa93a8256, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "3.4b", 0x10000, 0x6b686b69, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "hn27512p.7a", 0x10000, 0x765e7baa, 3 | BRF_GRA }, // 3 Characters + + { "14.3a", 0x20000, 0x1ecfddaa, 4 | BRF_GRA }, // 4 Foreground Tiles + { "15.3b", 0x20000, 0x1291a696, 4 | BRF_GRA }, // 5 + { "16.1a", 0x20000, 0x140b47ca, 4 | BRF_GRA }, // 6 + { "17.1b", 0x20000, 0x7638cccb, 4 | BRF_GRA }, // 7 + + { "18.6a", 0x20000, 0x3fadafd6, 5 | BRF_GRA }, // 8 Background Tiles + { "19.6b", 0x20000, 0xddae9d5b, 5 | BRF_GRA }, // 9 + { "20.4b", 0x20000, 0x08cf7a93, 5 | BRF_GRA }, // 10 + { "21.4b", 0x20000, 0x1ac892f5, 5 | BRF_GRA }, // 11 + + { "6.3m", 0x20000, 0xe7ccdf9f, 6 | BRF_GRA }, // 12 Sprites + { "8.3n", 0x20000, 0x7ef7f880, 6 | BRF_GRA }, // 13 + { "10.3r", 0x20000, 0xa6451dec, 6 | BRF_GRA }, // 14 + { "12.3s", 0x20000, 0x277204f0, 6 | BRF_GRA }, // 15 + { "7.1m", 0x20000, 0x016bec95, 6 | BRF_GRA }, // 16 + { "9.1n", 0x20000, 0x6e9b7fd3, 6 | BRF_GRA }, // 17 + { "11.1r", 0x20000, 0x7fbfdf5e, 6 | BRF_GRA }, // 18 + { "13.1s", 0x20000, 0x4e56a508, 6 | BRF_GRA }, // 19 + + { "4.4a", 0x20000, 0xb0e0faf9, 7 | BRF_SND }, // 20 MSM6295 Samples +}; + +STD_ROM_PICK(ryukenda) +STD_ROM_FN(ryukenda) + +struct BurnDriver BurnDrvRyukenda = { + "ryukendna", "shadoww", NULL, NULL, "1989", + "Ninja Ryukenden (Japan, set 2)\0", NULL, "Tecmo", "Miscellaneous", + L"\u5FCD\u8005 \u9F8D\u5263\u4F1D (Japan, set 2)\0Ninja Ryukenden\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, ryukendaRomInfo, ryukendaRomName, NULL, NULL, DrvInputInfo, GaidenDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Wild Fang / Tecmo Knight + +static struct BurnRomInfo wildfangRomDesc[] = { + { "1.3st", 0x20000, 0xab876c9b, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "2.5st", 0x20000, 0x1dc74b3b, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "tkni3.bin", 0x10000, 0x15623ec7, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "tkni5.bin", 0x10000, 0x5ed15896, 3 | BRF_GRA }, // 3 Characters + + { "14.3a", 0x20000, 0x0d20c10c, 4 | BRF_GRA }, // 4 Foreground Tiles + { "15.3b", 0x20000, 0x3f40a6b4, 4 | BRF_GRA }, // 5 + { "16.1a", 0x20000, 0x0f31639e, 4 | BRF_GRA }, // 6 + { "17.1b", 0x20000, 0xf32c158e, 4 | BRF_GRA }, // 7 + + { "tkni6.bin", 0x80000, 0xf68fafb1, 5 | BRF_GRA }, // 8 + + { "tkni9.bin", 0x80000, 0xd22f4239, 6 | BRF_GRA }, // 9 Sprites + { "tkni8.bin", 0x80000, 0x4931b184, 6 | BRF_GRA }, // 10 + + { "tkni4.bin", 0x20000, 0xa7a1dbcf, 7 | BRF_SND }, // 11 MSM6295 Samples + + { "a-6v.mcu", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(wildfang) +STD_ROM_FN(wildfang) + +struct BurnDriver BurnDrvWildfang = { + "wildfang", NULL, NULL, NULL, "1989", + "Wild Fang / Tecmo Knight\0", NULL, "Tecmo", "Miscellaneous", + L"Wild Fang\0Tecmo Knight\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, wildfangRomInfo, wildfangRomName, NULL, NULL, DrvInputInfo, WildfangDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Tecmo Knight + +static struct BurnRomInfo tknightRomDesc[] = { + { "tkni1.bin", 0x20000, 0x9121daa8, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tkni2.bin", 0x20000, 0x6669cd87, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "tkni3.bin", 0x10000, 0x15623ec7, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "tkni5.bin", 0x10000, 0x5ed15896, 3 | BRF_GRA }, // 3 Characters + + { "tkni7.bin", 0x80000, 0x4b4d4286, 4 | BRF_GRA }, // 4 Foreground Tiles + + { "tkni6.bin", 0x80000, 0xf68fafb1, 5 | BRF_GRA }, // 5 + + { "tkni9.bin", 0x80000, 0xd22f4239, 6 | BRF_GRA }, // 6 Sprites + { "tkni8.bin", 0x80000, 0x4931b184, 6 | BRF_GRA }, // 7 + + { "tkni4.bin", 0x20000, 0xa7a1dbcf, 7 | BRF_SND }, // 8 MSM6295 Samples + + { "a-6v.mcu", 0x01000, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(tknight) +STD_ROM_FN(tknight) + +struct BurnDriver BurnDrvTknight = { + "tknight", "wildfang", NULL, NULL, "1989", + "Tecmo Knight\0", NULL, "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SCRFIGHT, 0, + NULL, tknightRomInfo, tknightRomName, NULL, NULL, DrvInputInfo, TknightDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Raiga - Strato Fighter (US) + +static struct BurnRomInfo stratofRomDesc[] = { + { "1.3s", 0x20000, 0x060822a4, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "2.4s", 0x20000, 0x339358fa, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "a-4b.3", 0x10000, 0x18655c95, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "b-7a.5", 0x10000, 0x6d2e4bf1, 3 | BRF_GRA }, // 3 Characters + + { "b-1b", 0x80000, 0x781d1bd2, 4 | BRF_GRA }, // 4 Foreground Tiles + + { "b-4b", 0x80000, 0x89468b84, 5 | BRF_GRA }, // 5 + + { "b-2m", 0x80000, 0x5794ec32, 6 | BRF_GRA }, // 6 Sprites + { "b-1m", 0x80000, 0xb0de0ded, 6 | BRF_GRA }, // 7 + + { "a-4a.4", 0x20000, 0xef9acdcf, 7 | BRF_SND }, // 8 MSM6295 Samples + + { "a-6v.mcu", 0x01000, 0x00000000, 0 | BRF_NODUMP }, // 9 MCU +}; + +STD_ROM_PICK(stratof) +STD_ROM_FN(stratof) + +static INT32 stratofInit() +{ + game = 2; + + return DrvInit(); +} + +struct BurnDriver BurnDrvStratof = { + "stratof", NULL, NULL, NULL, "1991", + "Raiga - Strato Fighter (US)\0", NULL, "Tecmo", "Miscellaneous", + L"\u96F7\u7259 Strato Fighter (US)\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, stratofRomInfo, stratofRomName, NULL, NULL, RaigaInputInfo, RaigaDIPInfo, + stratofInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Raiga - Strato Fighter (Japan) + +static struct BurnRomInfo raigaRomDesc[] = { + { "a-3s.1", 0x20000, 0x303c2a6c, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "a-4s.2", 0x20000, 0x5f31fecb, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "a-4b.3", 0x10000, 0x18655c95, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "b-7a.5", 0x10000, 0x6d2e4bf1, 3 | BRF_GRA }, // 3 Characters + + { "b-1b", 0x80000, 0x781d1bd2, 4 | BRF_GRA }, // 4 Foreground Tiles + + { "b-4b", 0x80000, 0x89468b84, 5 | BRF_GRA }, // 5 + + { "b-2m", 0x80000, 0x5794ec32, 6 | BRF_GRA }, // 6 Sprites + { "b-1m", 0x80000, 0xb0de0ded, 6 | BRF_GRA }, // 7 + + { "a-4a.4", 0x20000, 0xef9acdcf, 7 | BRF_SND }, // 8 MSM6295 Samples + + { "a-6v.mcu", 0x01000, 0x00000000, 0 | BRF_NODUMP }, // 9 MCU +}; + +STD_ROM_PICK(raiga) +STD_ROM_FN(raiga) + +struct BurnDriver BurnDrvRaiga = { + "raiga", "stratof", NULL, NULL, "1991", + "Raiga - Strato Fighter (Japan)\0", NULL, "Tecmo", "Miscellaneous", + L"\u96F7\u7259 Strato Fighter (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, raigaRomInfo, raigaRomName, NULL, NULL, RaigaInputInfo, RaigaDIPInfo, + stratofInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Dragon Bowl + +static struct BurnRomInfo drgnbowlRomDesc[] = { + { "4.3h", 0x20000, 0x90730008, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "5.4h", 0x20000, 0x193cc915, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "1.2r", 0x10000, 0xd9cbf84a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "22.6m", 0x10000, 0x86e41198, 3 | BRF_GRA }, // 3 Characters + + { "6.5a", 0x20000, 0xb15759f7, 4 | BRF_GRA }, // 4 Foreground & Background Tiles + { "7.5b", 0x20000, 0x2541d445, 4 | BRF_GRA }, // 5 + { "8.6a", 0x20000, 0x51a2f5c4, 4 | BRF_GRA }, // 6 + { "9.6b", 0x20000, 0xf4c8850f, 4 | BRF_GRA }, // 7 + { "10.7a", 0x20000, 0x9e4b3c61, 4 | BRF_GRA }, // 8 + { "11.7b", 0x20000, 0x0d33d083, 4 | BRF_GRA }, // 9 + { "12.8a", 0x20000, 0x6c497ad3, 4 | BRF_GRA }, // 10 + { "13.8b", 0x20000, 0x7a84adff, 4 | BRF_GRA }, // 11 + + { "21.8r", 0x20000, 0x0cee8711, 6 | BRF_GRA }, // 18 Sprites + { "20.8q", 0x20000, 0x9647e02a, 6 | BRF_GRA }, // 19 + { "19.7r", 0x20000, 0x5082ceff, 6 | BRF_GRA }, // 16 + { "18.7q", 0x20000, 0xd18a7ffb, 6 | BRF_GRA }, // 17 + { "17.6r", 0x20000, 0x9088af09, 6 | BRF_GRA }, // 14 + { "16.6q", 0x20000, 0x8ade4e01, 6 | BRF_GRA }, // 15 + { "15.5r", 0x20000, 0x7429371c, 6 | BRF_GRA }, // 12 + { "14.5q", 0x20000, 0x4301b97f, 6 | BRF_GRA }, // 13 + + { "3.3q", 0x20000, 0x489c6d0e, 7 | BRF_SND }, // 20 MSM6295 Samples + { "2.3r", 0x20000, 0x7710ce39, 7 | BRF_SND }, // 21 +}; + +STD_ROM_PICK(drgnbowl) +STD_ROM_FN(drgnbowl) + +static INT32 drgnbowlInit() +{ + game = 1; + + INT32 nRet = DrvInit(); + + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +struct BurnDriver BurnDrvDrgnbowl = { + "drgnbowl", NULL, NULL, NULL, "1992", + "Dragon Bowl\0", NULL, "Nics", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, + NULL, drgnbowlRomInfo, drgnbowlRomName, NULL, NULL, DrvInputInfo, DrgnbowlDIPInfo, + drgnbowlInit, DrvExit, DrvFrame, DrgnbowlDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + diff --git a/src/burn/drv/pst90s/d_galspnbl.cpp b/src/burn/drv/pst90s/d_galspnbl.cpp index 22567ead3..e1999d0b8 100644 --- a/src/burn/drv/pst90s/d_galspnbl.cpp +++ b/src/burn/drv/pst90s/d_galspnbl.cpp @@ -366,7 +366,6 @@ static INT32 DrvInit(INT32 select) ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); ZetSetWriteHandler(galspnbl_sound_write); ZetSetReadHandler(galspnbl_sound_read); - ZetMemEnd(); ZetClose(); BurnYM3812Init(3579545, &DrvYM3812IrqHandler, &DrvSynchroniseStream, 0); diff --git a/src/burn/drv/pst90s/d_gotcha.cpp b/src/burn/drv/pst90s/d_gotcha.cpp index 7fc607750..551db0683 100644 --- a/src/burn/drv/pst90s/d_gotcha.cpp +++ b/src/burn/drv/pst90s/d_gotcha.cpp @@ -1,667 +1,666 @@ -// FB Alpha "Got-ya" driver module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm6295.h" -#include "bitswap.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSndROM; -static UINT8 *DrvSndBank; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvFgRAM; -static UINT8 *DrvBgRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvGfxBank; -static UINT16 *DrvScrollx; -static UINT16 *DrvScrolly; -static UINT32 *DrvPalette; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; -static UINT16 DrvInputs[3]; - -static UINT8 *bankselect; -static UINT8 *soundlatch; - -static struct BurnInputInfo GotchaInputList[] = { - {"Coin A", BIT_DIGITAL, DrvJoy2 + 8, "p1 coin" }, - {"Coin B", BIT_DIGITAL, DrvJoy2 + 9, "p2 coin" }, - - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 3" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 7, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p2 fire 3" }, - - {"P3 Start", BIT_DIGITAL, DrvJoy1 + 11, "p3 start" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy1 + 8, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy1 + 9, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, DrvJoy1 + 10, "p3 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Gotcha) - -static struct BurnDIPInfo GotchaDIPList[]= -{ - {0x0f, 0xff, 0xff, 0x97, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Difficulty" }, - {0x0f, 0x01, 0x07, 0x07, "1" }, - {0x0f, 0x01, 0x07, 0x06, "2" }, - {0x0f, 0x01, 0x07, 0x05, "3" }, - {0x0f, 0x01, 0x07, 0x04, "4" }, - {0x0f, 0x01, 0x07, 0x03, "5" }, - {0x0f, 0x01, 0x07, 0x02, "6" }, - {0x0f, 0x01, 0x07, 0x01, "7" }, - {0x0f, 0x01, 0x07, 0x00, "8" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0f, 0x01, 0x08, 0x08, "Off" }, - {0x0f, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x0f, 0x01, 0x30, 0x30, "1" }, - {0x0f, 0x01, 0x30, 0x20, "2" }, - {0x0f, 0x01, 0x30, 0x10, "3" }, - {0x0f, 0x01, 0x30, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x0f, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, - {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 1 Credits" }, - {0x0f, 0x01, 0xc0, 0xc0, "1 Coin/99 Credits" }, - - {0 , 0xfe, 0 , 2, "Info" }, - {0x10, 0x01, 0x01, 0x01, "Off" }, - {0x10, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Explane Type" }, - {0x10, 0x01, 0x02, 0x02, "Off" }, - {0x10, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Game Selection" }, - {0x10, 0x01, 0x04, 0x00, "Off" }, - {0x10, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x10, 0x01, 0x80, 0x80, "Off" }, - {0x10, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Gotcha) - -static void set_okibank(INT32 data) -{ - *DrvSndBank = data & 1; - - INT32 nBank = (~data & 1) << 18; - - memcpy(MSM6295ROM + 0x00000, DrvSndROM + nBank, 0x40000); -} - -void __fastcall gotcha_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x100004: - set_okibank(data); - return; - - case 0x300000: - *bankselect = data & 3; - return; - - case 0x30000e: - DrvGfxBank[*bankselect] = data & 0x0f; - return; - } -} - -void __fastcall gotcha_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x100000: - *soundlatch = data & 0xff; - return; - - case 0x300002: - case 0x300006: - DrvScrollx[(address >> 2) & 1] = data & 0x3ff; - return; - - case 0x300004: - case 0x300008: - DrvScrolly[(address >> 3) & 1] = (data + 8) & 0x1ff; - return; - } -} - -UINT8 __fastcall gotcha_read_byte(UINT32 address) -{ - switch (address) - { - case 0x180002: - return DrvInputs[1] >> 8; - } - - return 0; -} - -UINT16 __fastcall gotcha_read_word(UINT32 address) -{ - switch (address) - { - case 0x180000: - return DrvInputs[0]; - - case 0x180004: - return DrvInputs[2]; - } - - return 0; -} - -void __fastcall gotcha_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc000: - BurnYM2151SelectRegister(data); - return; - - case 0xc001: - BurnYM2151WriteRegister(data); - return; - - case 0xc002: - case 0xc003: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall gotcha_sound_read(UINT16 address) -{ - switch (address) - { - case 0xc001: - return BurnYM2151ReadStatus(); - - case 0xc006: - return *soundlatch; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM2151Reset(); - - set_okibank(1); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x080000; - DrvZ80ROM = Next; Next += 0x008000; - - DrvGfxROM0 = Next; Next += 0x400000; - DrvGfxROM1 = Next; Next += 0x400000; - -// MSM6295ROM = Next; - MSM6295ROM = Next; Next += 0x040000; - DrvSndROM = Next; Next += 0x080000; - - DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x000800; - DrvFgRAM = Next; Next += 0x001000; - DrvBgRAM = Next; Next += 0x001000; - DrvSprRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - DrvScrollx = (UINT16*)Next; Next += 0x000002 * sizeof(UINT16); - DrvScrolly = (UINT16*)Next; Next += 0x000002 * sizeof(UINT16); - - DrvGfxBank = Next; Next += 0x000004; - - DrvSndBank = Next; Next += 0x000001; - - bankselect = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x000000, 0x400000, 0x800000, 0xc00000 }; - INT32 XOffs[16] = { 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087, - 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; - INT32 YOffs[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, - 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x200000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x200000); - - GfxDecode(0x4000, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x200000); - - GfxDecode(0x4000, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -void DrvYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; // gfx0 - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 4, 1)) return 1; // gfx0 - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 5, 1)) return 1; // gfx0 - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 6, 1)) return 1; // gfx0 - for (INT32 i = 0; i < 0x200000; i++) { - INT32 j = ((i & 0x20000) << 3) | ((i & 0x1c0000) >> 1) | ((i & 0x1ffff)^0x10); - DrvGfxROM0[j] = DrvGfxROM1[i]; - } - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; // gfx0 - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 1)) return 1; // gfx0 - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 9, 1)) return 1; // gfx0 - if (BurnLoadRom(DrvGfxROM1 + 0x180000, 10, 1)) return 1; // gfx0 - - if (BurnLoadRom(DrvSndROM, 11, 1)) return 1; - memcpy(MSM6295ROM, DrvSndROM, 0x40000); - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x120000, 0x12ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x140000, 0x1407ff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x160000, 0x1607ff, SM_RAM); - SekMapMemory(DrvFgRAM, 0x320000, 0x320fff, SM_RAM); - SekMapMemory(DrvBgRAM, 0x322000, 0x322fff, SM_RAM); - SekSetWriteWordHandler(0, gotcha_write_word); - SekSetWriteByteHandler(0, gotcha_write_byte); - SekSetReadWordHandler(0, gotcha_read_word); - SekSetReadByteHandler(0, gotcha_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xd000, 0xd7ff, 0, DrvZ80RAM); - ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80RAM); - ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(gotcha_sound_write); - ZetSetReadHandler(gotcha_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetAllRoutes(0.80, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 1000000 / 132, 1); - MSM6295SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM2151Exit(); - MSM6295Exit(0); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - return 0; -} - -static void draw_layer(UINT8 *ram, INT32 col, INT32 scrollx, INT32 scrolly, INT32 transp) -{ - UINT16 *vram = (UINT16*)ram; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = (offs & 0x3f) << 4; - INT32 sy = (offs >> 6) << 4; - - sx -= scrollx; - if (sx < -15) sx += 0x400; - sy -= scrolly; - if (sy < -15) sy += 0x200; - - INT32 ofst = (offs & 0x1f) | ((offs & 0x7c0)>>1) | ((offs & 0x20) << 5); - - INT32 attr = vram[ofst]; - INT32 code = (attr & 0x3ff) | (DrvGfxBank[(attr >> 10) & 3] << 10); - INT32 color = (attr >> 12) | col; - - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, transp, 0, DrvGfxROM0); - } -} - -static void draw_sprites() -{ - UINT16 *vram = (UINT16*)DrvSprRAM; - - for (INT32 offs = 0; offs < 0x800/2; offs += 4) - { - INT32 sx = 0x13b - ((vram[offs + 2] + 0x10) & 0x1ff); - INT32 sy = vram[offs + 0] + 8; - INT32 code = vram[offs + 1] & 0x3fff; - INT32 color = vram[offs + 2] >> 9; - INT32 height = 1 << ((vram[offs + 0] & 0x0600) >> 9); - INT32 flipx = vram[offs + 0] & 0x2000; - INT32 flipy = vram[offs + 0] & 0x4000; - - for (INT32 y = 0; y < height; y++) - { - INT32 yy = 0x101 - ((sy + 0x10 * (height - y)) & 0x1ff); - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code + height-1 - y, sx, yy, color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code + height-1 - y, sx, yy, color, 4, 0, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code + y, sx, yy, color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code + y, sx, yy, color, 4, 0, 0, DrvGfxROM1); - } - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - UINT8 r,g,b; - UINT16 *pal = (UINT16*)DrvPalRAM; - - for (INT32 i = 0; i < 0x600/2; i++) { - INT32 d = pal[i]; - - r = (d >> 10) & 0x1f; - g = (d >> 5) & 0x1f; - b = (d >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } - } - - draw_layer(DrvBgRAM, 32, DrvScrollx[1]+5, DrvScrolly[1], ~0); - draw_layer(DrvFgRAM, 16, DrvScrollx[0]+1, DrvScrolly[0], 0); - - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 2 * sizeof(UINT16)); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - - DrvInputs[2] = (DrvDips[0]) | (DrvDips[1] << 8); - } - - INT32 nSegment; - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 14318180 / 60, 6000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); - nCyclesDone[0] += SekRun(nSegment); - - nSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i); - nCyclesDone[1] += ZetRun(nSegment); - - if (pBurnSoundOut) { - nSegment = nBurnSoundLen / nInterleave; - - BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - - nSoundBufferPos += nSegment; - } - } - - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - nSegment = nBurnSoundLen - nSoundBufferPos; - if (nSegment > 0) { - BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029702; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - - set_okibank(*DrvSndBank); - } - - return 0; -} - - -// Got-cha Mini Game Festival - -static struct BurnRomInfo gotchaRomDesc[] = { - { "gotcha.u3", 0x40000, 0x5e5d52e0, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "gotcha.u2", 0x40000, 0x3aa8eaff, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "gotcha_u.z02", 0x10000, 0xf4f6e16b, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "gotcha-u.42a", 0x80000, 0x4ea822f0, 3 | BRF_GRA }, // 3 Tiles - { "gotcha-u.42b", 0x80000, 0x6bb529ac, 3 | BRF_GRA }, // 4 - { "gotcha-u.41a", 0x80000, 0x49299b7b, 3 | BRF_GRA }, // 5 - { "gotcha-u.41b", 0x80000, 0xc093f04e, 3 | BRF_GRA }, // 6 - - { "gotcha.u56", 0x80000, 0x85f6a062, 4 | BRF_GRA }, // 7 Sprites - { "gotcha.u55", 0x80000, 0x426b4e48, 4 | BRF_GRA }, // 8 - { "gotcha.u54", 0x80000, 0x903e05a4, 4 | BRF_GRA }, // 9 - { "gotcha.u53", 0x80000, 0x3c24d51e, 4 | BRF_GRA }, // 10 - - { "gotcha-u.z11", 0x80000, 0x6111c6ae, 5 | BRF_SND }, // 11 Samples -}; - -STD_ROM_PICK(gotcha) -STD_ROM_FN(gotcha) - -struct BurnDriver BurnDrvGotcha = { - "gotcha", NULL, NULL, NULL, "1997", - "Got-cha Mini Game Festival\0", NULL, "Dongsung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 3, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, gotchaRomInfo, gotchaRomName, NULL, NULL, GotchaInputInfo, GotchaDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, - 320, 240, 4, 3 -}; - - -// Pasha Pasha Champ Mini Game Festival - -static struct BurnRomInfo ppchampRomDesc[] = { - { "u3", 0x40000, 0xf56c0fc2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "u2", 0x40000, 0xa941ffdc, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "uz02", 0x10000, 0xf4f6e16b, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "u42a", 0x80000, 0xf0b521d1, 3 | BRF_GRA }, // 3 Tiles - { "u42b", 0x80000, 0x1107918e, 3 | BRF_GRA }, // 4 - { "u41a", 0x80000, 0x3f567d33, 3 | BRF_GRA }, // 5 - { "u41b", 0x80000, 0x18a3497e, 3 | BRF_GRA }, // 6 - - { "u56", 0x80000, 0x160e46b3, 4 | BRF_GRA }, // 7 Sprites - { "u55", 0x80000, 0x7351b61c, 4 | BRF_GRA }, // 8 - { "u54", 0x80000, 0xa3d8c5ef, 4 | BRF_GRA }, // 9 - { "u53", 0x80000, 0x10ca65c4, 4 | BRF_GRA }, // 10 - - { "uz11", 0x80000, 0x3d96274c, 5 | BRF_SND }, // 11 Samples -}; - -STD_ROM_PICK(ppchamp) -STD_ROM_FN(ppchamp) - -struct BurnDriver BurnDrvPpchamp = { - "ppchamp", "gotcha", NULL, NULL, "1997", - "Pasha Pasha Champ Mini Game Festival\0", NULL, "Dongsung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 3, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, ppchampRomInfo, ppchampRomName, NULL, NULL, GotchaInputInfo, GotchaDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, - 320, 240, 4, 3 -}; +// FB Alpha "Got-ya" driver module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm6295.h" +#include "bitswap.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSndROM; +static UINT8 *DrvSndBank; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvFgRAM; +static UINT8 *DrvBgRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvGfxBank; +static UINT16 *DrvScrollx; +static UINT16 *DrvScrolly; +static UINT32 *DrvPalette; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; +static UINT16 DrvInputs[3]; + +static UINT8 *bankselect; +static UINT8 *soundlatch; + +static struct BurnInputInfo GotchaInputList[] = { + {"Coin A", BIT_DIGITAL, DrvJoy2 + 8, "p1 coin" }, + {"Coin B", BIT_DIGITAL, DrvJoy2 + 9, "p2 coin" }, + + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 3" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 7, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p2 fire 3" }, + + {"P3 Start", BIT_DIGITAL, DrvJoy1 + 11, "p3 start" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy1 + 8, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy1 + 9, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, DrvJoy1 + 10, "p3 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Gotcha) + +static struct BurnDIPInfo GotchaDIPList[]= +{ + {0x0f, 0xff, 0xff, 0x97, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Difficulty" }, + {0x0f, 0x01, 0x07, 0x07, "1" }, + {0x0f, 0x01, 0x07, 0x06, "2" }, + {0x0f, 0x01, 0x07, 0x05, "3" }, + {0x0f, 0x01, 0x07, 0x04, "4" }, + {0x0f, 0x01, 0x07, 0x03, "5" }, + {0x0f, 0x01, 0x07, 0x02, "6" }, + {0x0f, 0x01, 0x07, 0x01, "7" }, + {0x0f, 0x01, 0x07, 0x00, "8" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0f, 0x01, 0x08, 0x08, "Off" }, + {0x0f, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x0f, 0x01, 0x30, 0x30, "1" }, + {0x0f, 0x01, 0x30, 0x20, "2" }, + {0x0f, 0x01, 0x30, 0x10, "3" }, + {0x0f, 0x01, 0x30, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x0f, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, + {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 1 Credits" }, + {0x0f, 0x01, 0xc0, 0xc0, "1 Coin/99 Credits" }, + + {0 , 0xfe, 0 , 2, "Info" }, + {0x10, 0x01, 0x01, 0x01, "Off" }, + {0x10, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Explane Type" }, + {0x10, 0x01, 0x02, 0x02, "Off" }, + {0x10, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Game Selection" }, + {0x10, 0x01, 0x04, 0x00, "Off" }, + {0x10, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x10, 0x01, 0x80, 0x80, "Off" }, + {0x10, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Gotcha) + +static void set_okibank(INT32 data) +{ + *DrvSndBank = data & 1; + + INT32 nBank = (~data & 1) << 18; + + memcpy(MSM6295ROM + 0x00000, DrvSndROM + nBank, 0x40000); +} + +void __fastcall gotcha_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x100004: + set_okibank(data); + return; + + case 0x300000: + *bankselect = data & 3; + return; + + case 0x30000e: + DrvGfxBank[*bankselect] = data & 0x0f; + return; + } +} + +void __fastcall gotcha_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x100000: + *soundlatch = data & 0xff; + return; + + case 0x300002: + case 0x300006: + DrvScrollx[(address >> 2) & 1] = data & 0x3ff; + return; + + case 0x300004: + case 0x300008: + DrvScrolly[(address >> 3) & 1] = (data + 8) & 0x1ff; + return; + } +} + +UINT8 __fastcall gotcha_read_byte(UINT32 address) +{ + switch (address) + { + case 0x180002: + return DrvInputs[1] >> 8; + } + + return 0; +} + +UINT16 __fastcall gotcha_read_word(UINT32 address) +{ + switch (address) + { + case 0x180000: + return DrvInputs[0]; + + case 0x180004: + return DrvInputs[2]; + } + + return 0; +} + +void __fastcall gotcha_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc000: + BurnYM2151SelectRegister(data); + return; + + case 0xc001: + BurnYM2151WriteRegister(data); + return; + + case 0xc002: + case 0xc003: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall gotcha_sound_read(UINT16 address) +{ + switch (address) + { + case 0xc001: + return BurnYM2151ReadStatus(); + + case 0xc006: + return *soundlatch; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM2151Reset(); + + set_okibank(1); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x080000; + DrvZ80ROM = Next; Next += 0x008000; + + DrvGfxROM0 = Next; Next += 0x400000; + DrvGfxROM1 = Next; Next += 0x400000; + +// MSM6295ROM = Next; + MSM6295ROM = Next; Next += 0x040000; + DrvSndROM = Next; Next += 0x080000; + + DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x000800; + DrvFgRAM = Next; Next += 0x001000; + DrvBgRAM = Next; Next += 0x001000; + DrvSprRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + DrvScrollx = (UINT16*)Next; Next += 0x000002 * sizeof(UINT16); + DrvScrolly = (UINT16*)Next; Next += 0x000002 * sizeof(UINT16); + + DrvGfxBank = Next; Next += 0x000004; + + DrvSndBank = Next; Next += 0x000001; + + bankselect = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x000000, 0x400000, 0x800000, 0xc00000 }; + INT32 XOffs[16] = { 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087, + 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; + INT32 YOffs[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, + 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x200000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x200000); + + GfxDecode(0x4000, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x200000); + + GfxDecode(0x4000, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +void DrvYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; // gfx0 + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 4, 1)) return 1; // gfx0 + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 5, 1)) return 1; // gfx0 + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 6, 1)) return 1; // gfx0 + for (INT32 i = 0; i < 0x200000; i++) { + INT32 j = ((i & 0x20000) << 3) | ((i & 0x1c0000) >> 1) | ((i & 0x1ffff)^0x10); + DrvGfxROM0[j] = DrvGfxROM1[i]; + } + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; // gfx0 + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 1)) return 1; // gfx0 + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 9, 1)) return 1; // gfx0 + if (BurnLoadRom(DrvGfxROM1 + 0x180000, 10, 1)) return 1; // gfx0 + + if (BurnLoadRom(DrvSndROM, 11, 1)) return 1; + memcpy(MSM6295ROM, DrvSndROM, 0x40000); + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x120000, 0x12ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x140000, 0x1407ff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x160000, 0x1607ff, SM_RAM); + SekMapMemory(DrvFgRAM, 0x320000, 0x320fff, SM_RAM); + SekMapMemory(DrvBgRAM, 0x322000, 0x322fff, SM_RAM); + SekSetWriteWordHandler(0, gotcha_write_word); + SekSetWriteByteHandler(0, gotcha_write_byte); + SekSetReadWordHandler(0, gotcha_read_word); + SekSetReadByteHandler(0, gotcha_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xd000, 0xd7ff, 0, DrvZ80RAM); + ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80RAM); + ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(gotcha_sound_write); + ZetSetReadHandler(gotcha_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetAllRoutes(0.80, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 1000000 / 132, 1); + MSM6295SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM2151Exit(); + MSM6295Exit(0); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + return 0; +} + +static void draw_layer(UINT8 *ram, INT32 col, INT32 scrollx, INT32 scrolly, INT32 transp) +{ + UINT16 *vram = (UINT16*)ram; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = (offs & 0x3f) << 4; + INT32 sy = (offs >> 6) << 4; + + sx -= scrollx; + if (sx < -15) sx += 0x400; + sy -= scrolly; + if (sy < -15) sy += 0x200; + + INT32 ofst = (offs & 0x1f) | ((offs & 0x7c0)>>1) | ((offs & 0x20) << 5); + + INT32 attr = vram[ofst]; + INT32 code = (attr & 0x3ff) | (DrvGfxBank[(attr >> 10) & 3] << 10); + INT32 color = (attr >> 12) | col; + + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, transp, 0, DrvGfxROM0); + } +} + +static void draw_sprites() +{ + UINT16 *vram = (UINT16*)DrvSprRAM; + + for (INT32 offs = 0; offs < 0x800/2; offs += 4) + { + INT32 sx = 0x13b - ((vram[offs + 2] + 0x10) & 0x1ff); + INT32 sy = vram[offs + 0] + 8; + INT32 code = vram[offs + 1] & 0x3fff; + INT32 color = vram[offs + 2] >> 9; + INT32 height = 1 << ((vram[offs + 0] & 0x0600) >> 9); + INT32 flipx = vram[offs + 0] & 0x2000; + INT32 flipy = vram[offs + 0] & 0x4000; + + for (INT32 y = 0; y < height; y++) + { + INT32 yy = 0x101 - ((sy + 0x10 * (height - y)) & 0x1ff); + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code + height-1 - y, sx, yy, color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code + height-1 - y, sx, yy, color, 4, 0, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code + y, sx, yy, color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code + y, sx, yy, color, 4, 0, 0, DrvGfxROM1); + } + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + UINT8 r,g,b; + UINT16 *pal = (UINT16*)DrvPalRAM; + + for (INT32 i = 0; i < 0x600/2; i++) { + INT32 d = pal[i]; + + r = (d >> 10) & 0x1f; + g = (d >> 5) & 0x1f; + b = (d >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } + } + + draw_layer(DrvBgRAM, 32, DrvScrollx[1]+5, DrvScrolly[1], ~0); + draw_layer(DrvFgRAM, 16, DrvScrollx[0]+1, DrvScrolly[0], 0); + + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 2 * sizeof(UINT16)); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + + DrvInputs[2] = (DrvDips[0]) | (DrvDips[1] << 8); + } + + INT32 nSegment; + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 14318180 / 60, 6000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); + nCyclesDone[0] += SekRun(nSegment); + + nSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i); + nCyclesDone[1] += ZetRun(nSegment); + + if (pBurnSoundOut) { + nSegment = nBurnSoundLen / nInterleave; + + BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + + nSoundBufferPos += nSegment; + } + } + + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + nSegment = nBurnSoundLen - nSoundBufferPos; + if (nSegment > 0) { + BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029702; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + + set_okibank(*DrvSndBank); + } + + return 0; +} + + +// Got-cha Mini Game Festival + +static struct BurnRomInfo gotchaRomDesc[] = { + { "gotcha.u3", 0x40000, 0x5e5d52e0, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "gotcha.u2", 0x40000, 0x3aa8eaff, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "gotcha_u.z02", 0x10000, 0xf4f6e16b, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "gotcha-u.42a", 0x80000, 0x4ea822f0, 3 | BRF_GRA }, // 3 Tiles + { "gotcha-u.42b", 0x80000, 0x6bb529ac, 3 | BRF_GRA }, // 4 + { "gotcha-u.41a", 0x80000, 0x49299b7b, 3 | BRF_GRA }, // 5 + { "gotcha-u.41b", 0x80000, 0xc093f04e, 3 | BRF_GRA }, // 6 + + { "gotcha.u56", 0x80000, 0x85f6a062, 4 | BRF_GRA }, // 7 Sprites + { "gotcha.u55", 0x80000, 0x426b4e48, 4 | BRF_GRA }, // 8 + { "gotcha.u54", 0x80000, 0x903e05a4, 4 | BRF_GRA }, // 9 + { "gotcha.u53", 0x80000, 0x3c24d51e, 4 | BRF_GRA }, // 10 + + { "gotcha-u.z11", 0x80000, 0x6111c6ae, 5 | BRF_SND }, // 11 Samples +}; + +STD_ROM_PICK(gotcha) +STD_ROM_FN(gotcha) + +struct BurnDriver BurnDrvGotcha = { + "gotcha", NULL, NULL, NULL, "1997", + "Got-cha Mini Game Festival\0", NULL, "Dongsung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 3, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, gotchaRomInfo, gotchaRomName, NULL, NULL, GotchaInputInfo, GotchaDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, + 320, 240, 4, 3 +}; + + +// Pasha Pasha Champ Mini Game Festival + +static struct BurnRomInfo ppchampRomDesc[] = { + { "u3", 0x40000, 0xf56c0fc2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "u2", 0x40000, 0xa941ffdc, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "uz02", 0x10000, 0xf4f6e16b, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "u42a", 0x80000, 0xf0b521d1, 3 | BRF_GRA }, // 3 Tiles + { "u42b", 0x80000, 0x1107918e, 3 | BRF_GRA }, // 4 + { "u41a", 0x80000, 0x3f567d33, 3 | BRF_GRA }, // 5 + { "u41b", 0x80000, 0x18a3497e, 3 | BRF_GRA }, // 6 + + { "u56", 0x80000, 0x160e46b3, 4 | BRF_GRA }, // 7 Sprites + { "u55", 0x80000, 0x7351b61c, 4 | BRF_GRA }, // 8 + { "u54", 0x80000, 0xa3d8c5ef, 4 | BRF_GRA }, // 9 + { "u53", 0x80000, 0x10ca65c4, 4 | BRF_GRA }, // 10 + + { "uz11", 0x80000, 0x3d96274c, 5 | BRF_SND }, // 11 Samples +}; + +STD_ROM_PICK(ppchamp) +STD_ROM_FN(ppchamp) + +struct BurnDriver BurnDrvPpchamp = { + "ppchamp", "gotcha", NULL, NULL, "1997", + "Pasha Pasha Champ Mini Game Festival\0", NULL, "Dongsung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 3, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, ppchampRomInfo, ppchampRomName, NULL, NULL, GotchaInputInfo, GotchaDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_hyperpac.cpp b/src/burn/drv/pst90s/d_hyperpac.cpp index 976bb28f7..ff4380745 100644 --- a/src/burn/drv/pst90s/d_hyperpac.cpp +++ b/src/burn/drv/pst90s/d_hyperpac.cpp @@ -1,4115 +1,4111 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "timer.h" -#include "msm6295.h" -#include "burn_ym2151.h" -#include "burn_ym3812.h" -#include "bitswap.h" - -static UINT8 HyperpacInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 HyperpacInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 HyperpacInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 HyperpacDip[2] = {0, 0}; -static UINT8 HyperpacInput[3] = {0x00, 0x00, 0x00}; -static UINT8 HyperpacReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *HyperpacRom = NULL; -static UINT8 *HyperpacZ80Rom = NULL; -static UINT8 *HyperpacRam = NULL; -static UINT8 *HyperpacPaletteRam = NULL; -static UINT8 *HyperpacSpriteRam = NULL; -static UINT8 *HyperpacZ80Ram = NULL; -static UINT32 *HyperpacPalette = NULL; -static UINT8 *HyperpacSprites = NULL; -static UINT8 *HyperpacSprites8bpp = NULL; -static UINT8 *HyperpacTempGfx = NULL; -static UINT8 *HyperpacProtData = NULL; - -static INT32 HyperpacSoundLatch; -static INT32 Moremore = 0; -static INT32 Threein1semi = 0; -static INT32 Cookbib3 = 0; -static INT32 Fourin1boot = 0; -static INT32 Finalttr = 0; -static INT32 Twinadv = 0; -static INT32 Honeydol = 0; -static INT32 Wintbob = 0; -static INT32 Snowbro3 = 0; - -static INT32 HyperpacNumTiles = 0; -static INT32 HyperpacNumTiles8bpp = 0; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static INT32 Snowbro3MusicPlaying; -static INT32 Snowbro3Music; - -static struct BurnInputInfo HyperpacInputList[] = { - {"Coin 1" , BIT_DIGITAL , HyperpacInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , HyperpacInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , HyperpacInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , HyperpacInputPort2 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , HyperpacInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , HyperpacInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , HyperpacInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , HyperpacInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , HyperpacInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , HyperpacInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , HyperpacInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , HyperpacInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , HyperpacInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , HyperpacInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , HyperpacInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , HyperpacInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , HyperpacInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , HyperpacInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &HyperpacReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, HyperpacDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, HyperpacDip + 1 , "dip" }, -}; - -STDINPUTINFO(Hyperpac) - -static struct BurnInputInfo SnowbrosInputList[] = { - {"Coin 1" , BIT_DIGITAL , HyperpacInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , HyperpacInputPort2 + 0, "p1 start" }, - - {"P1 Up" , BIT_DIGITAL , HyperpacInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , HyperpacInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , HyperpacInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , HyperpacInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , HyperpacInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , HyperpacInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , HyperpacInputPort0 + 6, "p1 fire 3" }, - - {"Coin 2" , BIT_DIGITAL , HyperpacInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , HyperpacInputPort2 + 1, "p2 start" }, - - {"P2 Up" , BIT_DIGITAL , HyperpacInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , HyperpacInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , HyperpacInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , HyperpacInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , HyperpacInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , HyperpacInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , HyperpacInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &HyperpacReset , "reset" }, - {"Service" , BIT_DIGITAL , HyperpacInputPort2 + 6, "service" }, - {"Tilt" , BIT_DIGITAL , HyperpacInputPort2 + 5, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, HyperpacDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, HyperpacDip + 1 , "dip" }, -}; - -STDINPUTINFO(Snowbros) - -static inline void HyperpacClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void HyperpacMakeInputs() -{ - // Reset Inputs - HyperpacInput[0] = HyperpacInput[1] = HyperpacInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - HyperpacInput[0] |= (HyperpacInputPort0[i] & 1) << i; - HyperpacInput[1] |= (HyperpacInputPort1[i] & 1) << i; - HyperpacInput[2] |= (HyperpacInputPort2[i] & 1) << i; - } - - // Clear Opposites - HyperpacClearOpposites(&HyperpacInput[0]); - HyperpacClearOpposites(&HyperpacInput[1]); -} - -static struct BurnDIPInfo HyperpacDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfc, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x13, 0x01, 0x02, 0x02, "3" }, - {0x13, 0x01, 0x02, 0x00, "5" }, - - {0 , 0xfe, 0 , 8 , "Coin : Credit" }, - {0x13, 0x01, 0x1c, 0x00, "5 : 1" }, - {0x13, 0x01, 0x1c, 0x04, "4 : 1" }, - {0x13, 0x01, 0x1c, 0x08, "3 : 1" }, - {0x13, 0x01, 0x1c, 0x0c, "2 : 1" }, - {0x13, 0x01, 0x1c, 0x1c, "1 : 1" }, - {0x13, 0x01, 0x1c, 0x14, "2 : 3" }, - {0x13, 0x01, 0x1c, 0x18, "1 : 2" }, - {0x13, 0x01, 0x1c, 0x10, "1 : 3" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x60, 0x00, "Easy" }, - {0x13, 0x01, 0x60, 0x60, "Normal" }, - {0x13, 0x01, 0x60, 0x40, "Hard" }, - {0x13, 0x01, 0x60, 0x20, "Very Hard" }, - - {0 , 0xfe, 0 , 2 , "Mode" }, - {0x13, 0x01, 0x80, 0x80, "Game" }, - {0x13, 0x01, 0x80, 0x00, "Test" }, -}; - -STDDIPINFO(Hyperpac) - -static struct BurnDIPInfo Cookbib2DIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfc, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Max Vs Round" }, - {0x13, 0x01, 0x02, 0x02, "3" }, - {0x13, 0x01, 0x02, 0x00, "1" }, - - {0 , 0xfe, 0 , 8 , "Coin : Credit" }, - {0x13, 0x01, 0x1c, 0x00, "5 : 1" }, - {0x13, 0x01, 0x1c, 0x04, "4 : 1" }, - {0x13, 0x01, 0x1c, 0x08, "3 : 1" }, - {0x13, 0x01, 0x1c, 0x0c, "2 : 1" }, - {0x13, 0x01, 0x1c, 0x1c, "1 : 1" }, - {0x13, 0x01, 0x1c, 0x14, "2 : 3" }, - {0x13, 0x01, 0x1c, 0x18, "1 : 2" }, - {0x13, 0x01, 0x1c, 0x10, "1 : 3" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x60, 0x00, "Easy" }, - {0x13, 0x01, 0x60, 0x60, "Normal" }, - {0x13, 0x01, 0x60, 0x40, "Hard" }, - {0x13, 0x01, 0x60, 0x20, "Very Hard" }, - - {0 , 0xfe, 0 , 2 , "Mode" }, - {0x13, 0x01, 0x80, 0x80, "Game" }, - {0x13, 0x01, 0x80, 0x00, "Test" }, -}; - -STDDIPINFO(Cookbib2) - -static struct BurnDIPInfo Cookbib3DIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xee, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Coin : Credit" }, - {0x13, 0x01, 0x0e, 0x00, "5 : 1" }, - {0x13, 0x01, 0x0e, 0x02, "4 : 1" }, - {0x13, 0x01, 0x0e, 0x04, "3 : 1" }, - {0x13, 0x01, 0x0e, 0x06, "2 : 1" }, - {0x13, 0x01, 0x0e, 0x0e, "1 : 1" }, - {0x13, 0x01, 0x0e, 0x0a, "2 : 3" }, - {0x13, 0x01, 0x0e, 0x0c, "1 : 2" }, - {0x13, 0x01, 0x0e, 0x08, "1 : 3" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x13, 0x01, 0x70, 0x20, "Level 1" }, - {0x13, 0x01, 0x70, 0x10, "Level 2" }, - {0x13, 0x01, 0x70, 0x00, "Level 3" }, - {0x13, 0x01, 0x70, 0x70, "Level 4" }, - {0x13, 0x01, 0x70, 0x60, "Level 5" }, - {0x13, 0x01, 0x70, 0x50, "Level 6" }, - {0x13, 0x01, 0x70, 0x40, "Level 7" }, - {0x13, 0x01, 0x70, 0x30, "Level 8" }, - - {0 , 0xfe, 0 , 2 , "Mode" }, - {0x13, 0x01, 0x80, 0x80, "Game" }, - {0x13, 0x01, 0x80, 0x00, "Test" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Cookbib3) - -static struct BurnDIPInfo MoremoreDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xee, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Coin : Credit" }, - {0x13, 0x01, 0x0e, 0x00, "5 : 1" }, - {0x13, 0x01, 0x0e, 0x02, "4 : 1" }, - {0x13, 0x01, 0x0e, 0x04, "3 : 1" }, - {0x13, 0x01, 0x0e, 0x06, "2 : 1" }, - {0x13, 0x01, 0x0e, 0x0e, "1 : 1" }, - {0x13, 0x01, 0x0e, 0x0a, "2 : 3" }, - {0x13, 0x01, 0x0e, 0x0c, "1 : 2" }, - {0x13, 0x01, 0x0e, 0x08, "1 : 3" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x13, 0x01, 0x70, 0x20, "Level 1" }, - {0x13, 0x01, 0x70, 0x10, "Level 2" }, - {0x13, 0x01, 0x70, 0x00, "Level 3" }, - {0x13, 0x01, 0x70, 0x70, "Level 4" }, - {0x13, 0x01, 0x70, 0x60, "Level 5" }, - {0x13, 0x01, 0x70, 0x50, "Level 6" }, - {0x13, 0x01, 0x70, 0x40, "Level 7" }, - {0x13, 0x01, 0x70, 0x30, "Level 8" }, - - {0 , 0xfe, 0 , 2 , "Mode" }, - {0x13, 0x01, 0x80, 0x80, "Game" }, - {0x13, 0x01, 0x80, 0x00, "Test" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Moremore) - -static struct BurnDIPInfo ToppyrapDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Coin : Credit" }, - {0x13, 0x01, 0x1c, 0x00, "5 : 1" }, - {0x13, 0x01, 0x1c, 0x04, "4 : 1" }, - {0x13, 0x01, 0x1c, 0x08, "3 : 1" }, - {0x13, 0x01, 0x1c, 0x0c, "2 : 1" }, - {0x13, 0x01, 0x1c, 0x1c, "1 : 1" }, - {0x13, 0x01, 0x1c, 0x14, "2 : 3" }, - {0x13, 0x01, 0x1c, 0x18, "1 : 2" }, - {0x13, 0x01, 0x1c, 0x10, "1 : 3" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x60, 0x00, "Easy" }, - {0x13, 0x01, 0x60, 0x60, "Normal" }, - {0x13, 0x01, 0x60, 0x40, "Hard" }, - {0x13, 0x01, 0x60, 0x20, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Mode" }, - {0x13, 0x01, 0x80, 0x80, "Game" }, - {0x13, 0x01, 0x80, 0x00, "Test" }, - - {0 , 0xfe, 0 , 4 , "Player Count" }, - {0x14, 0x01, 0x03, 0x00, "2" }, - {0x14, 0x01, 0x03, 0x03, "3" }, - {0x14, 0x01, 0x03, 0x02, "4" }, - {0x14, 0x01, 0x03, 0x01, "5" }, - - {0 , 0xfe, 0 , 4 , "Game Time" }, - {0x14, 0x01, 0x0c, 0x04, "40 seconds" }, - {0x14, 0x01, 0x0c, 0x08, "50 seconds" }, - {0x14, 0x01, 0x0c, 0x0c, "60 seconds" }, - {0x14, 0x01, 0x0c, 0x00, "70 seconds" }, - - {0 , 0xfe, 0 , 2 , "God Mode" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Internal Test" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Toppyrap) - -static struct BurnDIPInfo Fourin1bootDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x06, 0x04, "1" }, - {0x13, 0x01, 0x06, 0x06, "2" }, - {0x13, 0x01, 0x06, 0x02, "3" }, - {0x13, 0x01, 0x06, 0x00, "4" }, - - {0 , 0xfe, 0 , 16 , "Coin : Credit" }, - {0x13, 0x01, 0x78, 0x18, "4 : 1" }, - {0x13, 0x01, 0x78, 0x38, "3 : 1" }, - {0x13, 0x01, 0x78, 0x10, "4 : 2" }, - {0x13, 0x01, 0x78, 0x58, "2 : 1" }, - {0x13, 0x01, 0x78, 0x30, "3 : 2" }, - {0x13, 0x01, 0x78, 0x08, "4 : 3" }, - {0x13, 0x01, 0x78, 0x00, "4 : 4" }, - {0x13, 0x01, 0x78, 0x28, "3 : 3" }, - {0x13, 0x01, 0x78, 0x50, "2 : 2" }, - {0x13, 0x01, 0x78, 0x78, "1 : 1" }, - {0x13, 0x01, 0x78, 0x20, "3 : 4" }, - {0x13, 0x01, 0x78, 0x48, "2 : 3" }, - {0x13, 0x01, 0x78, 0x40, "2 : 4" }, - {0x13, 0x01, 0x78, 0x70, "1 : 2" }, - {0x13, 0x01, 0x78, 0x68, "1 : 3" }, - {0x13, 0x01, 0x78, 0x60, "1 : 4" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x03, 0x02, "1" }, - {0x14, 0x01, 0x03, 0x00, "2" }, - {0x14, 0x01, 0x03, 0x03, "3" }, - {0x14, 0x01, 0x03, 0x01, "4" }, - - {0 , 0xfe, 0 , 2 , "Mode" }, - {0x14, 0x01, 0x80, 0x80, "Game" }, - {0x14, 0x01, 0x80, 0x00, "Test" }, -}; - -STDDIPINFO(Fourin1boot) - -static struct BurnDIPInfo FinalttrDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x13, 0x01, 0x01, 0x00, "Off" }, - {0x13, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 7 , "Coin : Credit" }, - {0x13, 0x01, 0x38, 0x00, "4 : 1" }, - {0x13, 0x01, 0x38, 0x10, "3 : 1" }, - {0x13, 0x01, 0x38, 0x30, "2 : 1" }, - {0x13, 0x01, 0x38, 0x38, "1 : 1" }, - {0x13, 0x01, 0x38, 0x20, "2 : 3" }, - {0x13, 0x01, 0x38, 0x28, "1 : 2" }, - {0x13, 0x01, 0x38, 0x08, "1 : 4" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Time" }, - {0x14, 0x01, 0x0c, 0x00, "60 seconds" }, - {0x14, 0x01, 0x0c, 0x0c, "90 seconds" }, - {0x14, 0x01, 0x0c, 0x08, "120 seconds" }, - {0x14, 0x01, 0x0c, 0x04, "150 seconds" }, -}; - -STDDIPINFO(Finalttr) - -static struct BurnDIPInfo TwinadvDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coin : Credit" }, - {0x13, 0x01, 0x03, 0x00, "3 : 1" }, - {0x13, 0x01, 0x03, 0x01, "2 : 1" }, - {0x13, 0x01, 0x03, 0x03, "1 : 1" }, - {0x13, 0x01, 0x03, 0x02, "1 : 2" }, - - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x13, 0x01, 0x10, 0x00, "Off" }, - {0x13, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Level Select" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x03, "Normal" }, - {0x14, 0x01, 0x03, 0x02, "Hard" }, - {0x14, 0x01, 0x03, 0x01, "Harder" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x14, 0x01, 0x04, 0x04, "3" }, - {0x14, 0x01, 0x04, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Ticket Mode 1" }, - {0x14, 0x01, 0x08, 0x08, "Off" }, - {0x14, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Ticket Mode 2" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Twinadv) - -static struct BurnDIPInfo HoneydolDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xef, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x13, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Show Girls" }, - {0x13, 0x01, 0x04, 0x00, "Off" }, - {0x13, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x13, 0x01, 0x10, 0x00, "Off" }, - {0x13, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Level Select" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Slide show on boot" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x03, "Normal" }, - {0x14, 0x01, 0x03, 0x02, "Hard" }, - {0x14, 0x01, 0x03, 0x01, "Harder" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Timer speed" }, - {0x14, 0x01, 0x0c, 0x0c, "Normal" }, - {0x14, 0x01, 0x0c, 0x08, "Fast" }, - {0x14, 0x01, 0x0c, 0x04, "Faster" }, - {0x14, 0x01, 0x0c, 0x00, "Fastest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x00, "1" }, - {0x14, 0x01, 0x30, 0x10, "2" }, - {0x14, 0x01, 0x30, 0x20, "3" }, - {0x14, 0x01, 0x30, 0x30, "5" }, - - {0 , 0xfe, 0 , 2 , "Max vs Round" }, - {0x14, 0x01, 0x80, 0x80, "3" }, - {0x14, 0x01, 0x80, 0x00, "1" }, -}; - -STDDIPINFO(Honeydol) - -static struct BurnDIPInfo SnowbrosDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0x01, NULL }, - {0x16, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Country" }, - {0x15, 0x01, 0x01, 0x01, "Europ Type" }, - {0x15, 0x01, 0x01, 0x00, "America Type" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Invert Screen" }, - {0x15, 0x01, 0x02, 0x00, "Normal Screen" }, - - {0 , 0xfe, 0 , 2 , "Test Mode" }, - {0x15, 0x01, 0x04, 0x00, "Off" }, - {0x15, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x08, "Advertise Sound Off" }, - {0x15, 0x01, 0x08, 0x00, "Advertise Sound On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x30, "4 Coin 1 Play" }, - {0x15, 0x01, 0x30, 0x20, "3 Coin 1 Play" }, - {0x15, 0x01, 0x30, 0x10, "2 Coin 1 Play" }, - {0x15, 0x01, 0x30, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 2 Play" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 3 Play" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 4 Play" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 6 Play" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x01, "Game Difficulty A" }, - {0x16, 0x01, 0x03, 0x00, "Game Difficulty B" }, - {0x16, 0x01, 0x03, 0x02, "Game Difficulty C" }, - {0x16, 0x01, 0x03, 0x03, "Game Difficulty D" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x0c, "Extend No Extend" }, - {0x16, 0x01, 0x0c, 0x00, "Extend 100000 Only" }, - {0x16, 0x01, 0x0c, 0x08, "Extend 100000, 200000" }, - {0x16, 0x01, 0x0c, 0x04, "Extend 200000 Only" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x10, "Hero Counts 1" }, - {0x16, 0x01, 0x30, 0x30, "Hero Counts 2" }, - {0x16, 0x01, 0x30, 0x00, "Hero Counts 3" }, - {0x16, 0x01, 0x30, 0x20, "Hero Counts 4" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x16, 0x01, 0x40, 0x40, "No Death, Stop Mode" }, - {0x16, 0x01, 0x40, 0x00, "Normal Game" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x80, 0x00, "Continue Play On" }, - {0x16, 0x01, 0x80, 0x80, "Continue Play Off" }, -}; - -STDDIPINFO(Snowbros) - -static struct BurnDIPInfo SnowbrojDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0x00, NULL }, - {0x16, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet Type" }, - {0x15, 0x01, 0x01, 0x01, "Up-Right Type" }, - {0x15, 0x01, 0x01, 0x00, "Table Type" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Invert Screen" }, - {0x15, 0x01, 0x02, 0x00, "Normal Screen" }, - - {0 , 0xfe, 0 , 2 , "Test Mode" }, - {0x15, 0x01, 0x04, 0x00, "Off" }, - {0x15, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x08, "Advertise Sound Off" }, - {0x15, 0x01, 0x08, 0x00, "Advertise Sound On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x30, "2 Coin 3 Play" }, - {0x15, 0x01, 0x30, 0x20, "2 Coin 1 Play" }, - {0x15, 0x01, 0x30, 0x10, "1 Coin 2 Play" }, - {0x15, 0x01, 0x30, 0x00, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0xc0, "2 Coin 3 Play" }, - {0x15, 0x01, 0xc0, 0x80, "2 Coin 1 Play" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 2 Play" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x01, "Game Difficulty A" }, - {0x16, 0x01, 0x03, 0x00, "Game Difficulty B" }, - {0x16, 0x01, 0x03, 0x02, "Game Difficulty C" }, - {0x16, 0x01, 0x03, 0x03, "Game Difficulty D" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x0c, "Extend No Extend" }, - {0x16, 0x01, 0x0c, 0x00, "Extend 100000 Only" }, - {0x16, 0x01, 0x0c, 0x08, "Extend 100000, 200000" }, - {0x16, 0x01, 0x0c, 0x04, "Extend 200000 Only" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x10, "Hero Counts 1" }, - {0x16, 0x01, 0x30, 0x30, "Hero Counts 2" }, - {0x16, 0x01, 0x30, 0x00, "Hero Counts 3" }, - {0x16, 0x01, 0x30, 0x20, "Hero Counts 4" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x16, 0x01, 0x40, 0x40, "No Death, Stop Mode" }, - {0x16, 0x01, 0x40, 0x00, "Normal Game" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x80, 0x00, "Continue Play On" }, - {0x16, 0x01, 0x80, 0x80, "Continue Play Off" }, -}; - -STDDIPINFO(Snowbroj) - -static struct BurnRomInfo HyperpacRomDesc[] = { - { "hyperpac.h12", 0x20000, 0x2cf0531a, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "hyperpac.i12", 0x20000, 0x9c7d85b8, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "hyperpac.a4", 0x40000, 0xbd8673da, BRF_GRA }, // 2 Sprites - { "hyperpac.a5", 0x40000, 0x5d90cd82, BRF_GRA }, // 3 Sprites - { "hyperpac.a6", 0x40000, 0x61d86e63, BRF_GRA }, // 4 Sprites - - { "hyperpac.u1", 0x10000, 0x03faf88e, BRF_SND }, // 5 Z80 Program Code - - { "hyperpac.j15", 0x40000, 0xfb9f468d, BRF_SND }, // 6 Samples - - { "at89c52.bin", 0x02000, 0x291f9326, BRF_PRG | BRF_OPT }, -}; - - -STD_ROM_PICK(Hyperpac) -STD_ROM_FN(Hyperpac) - -static struct BurnRomInfo HyperpacbRomDesc[] = { - { "hpacuh12.bin", 0x20000, 0x633ab2c6, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "hpacui12.bin", 0x20000, 0x23dc00d1, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "hyperpac.a4", 0x40000, 0xbd8673da, BRF_GRA }, // 2 Sprites - { "hyperpac.a5", 0x40000, 0x5d90cd82, BRF_GRA }, // 3 Sprites - { "hyperpac.a6", 0x40000, 0x61d86e63, BRF_GRA }, // 4 Sprites - - { "hyperpac.u1", 0x10000, 0x03faf88e, BRF_SND }, // 5 Z80 Program Code - - { "hyperpac.j15", 0x40000, 0xfb9f468d, BRF_SND }, // 6 Samples -}; - - -STD_ROM_PICK(Hyperpacb) -STD_ROM_FN(Hyperpacb) - -static struct BurnRomInfo Cookbib2RomDesc[] = { - { "cookbib2.02", 0x40000, 0xb2909460, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "cookbib2.01", 0x40000, 0x65aafde2, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "cookbib2.05", 0x80000, 0x89fb38ce, BRF_GRA }, // 2 Sprites - { "cookbib2.04", 0x80000, 0xf240111f, BRF_GRA }, // 3 Sprites - { "cookbib2.03", 0x40000, 0xe1604821, BRF_GRA }, // 4 Sprites - - { "cookbib2.07", 0x10000, 0xf59f1c9a, BRF_SND }, // 5 Z80 Program Code - - { "cookbib2.06", 0x20000, 0x5e6f76b8, BRF_SND }, // 6 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, - - { "protdata.bin", 0x00200, 0xae6d8ed5, BRF_ESS | BRF_PRG }, // Data from shared RAM -}; - - -STD_ROM_PICK(Cookbib2) -STD_ROM_FN(Cookbib2) - -static struct BurnRomInfo Cookbib3RomDesc[] = { - { "u52.bin", 0x40000, 0x65134893, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "u74.bin", 0x40000, 0xc4ab8435, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "u75.bin", 0x80000, 0xcbe4d9c8, BRF_GRA }, // 2 Sprites - { "u76.bin", 0x80000, 0x1be17b57, BRF_GRA }, // 3 Sprites - { "u77.bin", 0x80000, 0x7823600d, BRF_GRA }, // 4 Sprites - - { "u35.bin", 0x10000, 0x5dfd2a98, BRF_SND }, // 5 Z80 Program Code - - { "u14.bin", 0x20000, 0xe5bf9288, BRF_SND }, // 6 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, - - { "protdata.bin", 0x00200, 0xc819b9a8, BRF_ESS | BRF_PRG }, // Data from shared RAM -}; - - -STD_ROM_PICK(Cookbib3) -STD_ROM_FN(Cookbib3) - -static struct BurnRomInfo MoremoreRomDesc[] = { - { "u52.bin", 0x40000, 0xcea4b246, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "u74.bin", 0x40000, 0x2acdcb88, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "u75.bin", 0x80000, 0xd671815c, BRF_GRA }, // 2 Sprites - { "u76.bin", 0x80000, 0xe0d479e8, BRF_GRA }, // 3 Sprites - { "u77.bin", 0x80000, 0x60a281da, BRF_GRA }, // 4 Sprites - { "u78.bin", 0x80000, 0xe2723b4e, BRF_GRA }, // 5 Sprites - - { "u35.bin", 0x10000, 0x92dc95fc, BRF_SND }, // 6 Z80 Program Code - - { "u14.bin", 0x40000, 0x90580088, BRF_SND }, // 7 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, - - { "protdata.bin", 0x00200, 0x782dd2aa, BRF_ESS | BRF_PRG }, // Data from shared RAM -}; - - -STD_ROM_PICK(Moremore) -STD_ROM_FN(Moremore) - -static struct BurnRomInfo MoremorpRomDesc[] = { - { "mmp_u52.bin", 0x40000, 0x66baf9b2, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "mmp_u74.bin", 0x40000, 0x7c6fede5, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "mmp_u75.bin", 0x80000, 0xaf9e824e, BRF_GRA }, // 2 Sprites - { "mmp_u76.bin", 0x80000, 0xc42af064, BRF_GRA }, // 3 Sprites - { "mmp_u77.bin", 0x80000, 0x1d7396e1, BRF_GRA }, // 4 Sprites - { "mmp_u78.bin", 0x80000, 0x5508d80b, BRF_GRA }, // 5 Sprites - - { "mmp_u35.bin", 0x10000, 0x4d098cad, BRF_SND }, // 6 Z80 Program Code - - { "mmp_u14.bin", 0x40000, 0x211a2566, BRF_SND }, // 7 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, - - { "protdata.bin", 0x00200, 0x782dd2aa, BRF_ESS | BRF_PRG }, // Data from shared RAM -}; - - -STD_ROM_PICK(Moremorp) -STD_ROM_FN(Moremorp) - -static struct BurnRomInfo ToppyrapRomDesc[] = { - { "uh12.bin", 0x40000, 0x6f5ad699, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ui12.bin", 0x40000, 0xcaf5a7e1, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "ua4.bin", 0x80000, 0xa9577bcf, BRF_GRA }, // 2 Sprites - { "ua5.bin", 0x80000, 0x7179d32d, BRF_GRA }, // 3 Sprites - { "ua6.bin", 0x80000, 0x4834e5b1, BRF_GRA }, // 4 Sprites - { "ua7.bin", 0x80000, 0x663dd099, BRF_GRA }, // 5 Sprites - - { "u1.bin", 0x10000, 0x07f50947, BRF_SND }, // 6 Z80 Program Code - - { "uj15.bin", 0x20000, 0xa3bacfd7, BRF_SND }, // 7 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, - - { "protdata.bin", 0x00200, 0x0704e6c7, BRF_ESS | BRF_PRG }, // Data from shared RAM -}; - - -STD_ROM_PICK(Toppyrap) -STD_ROM_FN(Toppyrap) - -static struct BurnRomInfo Threein1semiRomDesc[] = { - { "u52", 0x40000, 0xb0e4a0f7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "u74", 0x40000, 0x266862c4, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "u75", 0x80000, 0xb66a0db6, BRF_GRA }, // 2 Sprites - { "u76", 0x80000, 0x5f4b48ea, BRF_GRA }, // 3 Sprites - { "u77", 0x80000, 0xd44211e3, BRF_GRA }, // 4 Sprites - { "u78", 0x80000, 0xaf596afc, BRF_GRA }, // 5 Sprites - - { "u35", 0x10000, 0xe40481da, BRF_SND }, // 6 Z80 Program Code - - { "u14", 0x40000, 0xc83c11be, BRF_SND }, // 7 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, - - { "protdata.bin", 0x00200, 0x85deba7c, BRF_ESS | BRF_PRG }, // Data from shared RAM -}; - - -STD_ROM_PICK(Threein1semi) -STD_ROM_FN(Threein1semi) - -static struct BurnRomInfo TwinkleRomDesc[] = { - { "uh12.bin", 0x20000, 0xa99626fe, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ui12.bin", 0x20000, 0x5af73684, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "ua4.bin", 0x80000, 0x6b64bb09, BRF_GRA }, // 2 Sprites - - { "u1.bin", 0x10000, 0xe40481da, BRF_SND }, // 3 Z80 Program Code - - { "uj15.bin", 0x40000, 0x0a534b37, BRF_SND }, // 4 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, - - { "protdata.bin", 0x00200, 0x00d3e4b4, BRF_ESS | BRF_PRG }, // Data from shared RAM -}; - - -STD_ROM_PICK(Twinkle) -STD_ROM_FN(Twinkle) - -static struct BurnRomInfo PzlbreakRomDesc[] = { - { "4.uh12", 0x20000, 0xb3f04f80, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "5.ui12", 0x20000, 0x13c298a0, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "2.ua4", 0x80000, 0xd211705a, BRF_GRA }, // 2 Sprites - { "3.ua5", 0x80000, 0x6cdb73e9, BRF_GRA }, // 3 - - { "0.u1", 0x10000, 0x1ad646b7, BRF_SND }, // 4 Z80 Program Code - - { "1.uj15", 0x40000, 0xdbfae77c, BRF_SND }, // 5 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, - - { "protdata.bin", 0x00200, 0x092cb794, BRF_ESS | BRF_PRG }, // Data from shared RAM -}; - - -STD_ROM_PICK(Pzlbreak) -STD_ROM_FN(Pzlbreak) - -static struct BurnRomInfo Fourin1bootRomDesc[] = { - { "u52", 0x80000, 0x71815878, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "u74", 0x80000, 0xe22d3fa2, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "u78", 0x200000,0x6c1fbc9c, BRF_GRA }, // 2 Sprites - - { "u35", 0x10000, 0xc894ac80, BRF_SND }, // 3 Z80 Program Code - - { "u14", 0x40000, 0x94b09b0e, BRF_SND }, // 4 Samples -}; - - -STD_ROM_PICK(Fourin1boot) -STD_ROM_FN(Fourin1boot) - -static struct BurnRomInfo FinalttrRomDesc[] = { - { "10.7o", 0x20000, 0xeecc83e5, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "9.5o", 0x20000, 0x58d3640e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "5.1d", 0x40000, 0x64a450f3, BRF_GRA }, // 2 Sprites - { "6.1f", 0x40000, 0x7281a3cc, BRF_GRA }, // 3 Sprites - { "7.1g", 0x40000, 0xec80f442, BRF_GRA }, // 4 Sprites - { "9.1h", 0x40000, 0x2ebd316d, BRF_GRA }, // 5 Sprites - - { "12.5r", 0x10000, 0x4bc21361, BRF_SND }, // 6 Z80 Program Code - - { "11.7p", 0x20000, 0x2e331022, BRF_SND }, // 7 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, - - { "protdata.bin", 0x00200, 0xd5bbb006, BRF_ESS | BRF_PRG }, // Data from shared RAM -}; - - -STD_ROM_PICK(Finalttr) -STD_ROM_FN(Finalttr) - -static struct BurnRomInfo TwinadvRomDesc[] = { - { "13.uh12", 0x20000, 0x9f70a39b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "12.ui12", 0x20000, 0xd8776495, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "16.ua4", 0x80000, 0xf491e171, BRF_GRA }, // 2 Sprites - { "15.ua5", 0x80000, 0x79a08b8d, BRF_GRA }, // 3 Sprites - { "14.ua6", 0x80000, 0x79faee0b, BRF_GRA }, // 4 Sprites - - { "uh15.bin", 0x08000, 0x3d5acd08, BRF_SND }, // 5 Z80 Program Code - - { "sra.bin", 0x40000, 0x82f452c4, BRF_SND }, // 6 Samples - { "srb.bin", 0x40000, 0x109e51e6, BRF_SND }, // 7 Samples -}; - - -STD_ROM_PICK(Twinadv) -STD_ROM_FN(Twinadv) - -static struct BurnRomInfo TwinadvkRomDesc[] = { - { "uh12", 0x20000, 0xe0bcc738, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ui12", 0x20000, 0xa3ee6451, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "ua4", 0x80000, 0xa5aff49b, BRF_GRA }, // 2 Sprites - { "ua5", 0x80000, 0xf83b3b97, BRF_GRA }, // 3 Sprites - { "ua6", 0x80000, 0x4dfcffb9, BRF_GRA }, // 4 Sprites - - { "uh15.bin", 0x08000, 0x3d5acd08, BRF_SND }, // 5 Z80 Program Code - - { "sra.bin", 0x40000, 0x82f452c4, BRF_SND }, // 6 Samples - { "srb.bin", 0x40000, 0x109e51e6, BRF_SND }, // 7 Samples -}; - - -STD_ROM_PICK(Twinadvk) -STD_ROM_FN(Twinadvk) - -static struct BurnRomInfo HoneydolRomDesc[] = { - { "d-16.uh12", 0x20000, 0xcee1a2e3, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "d-17.ui12", 0x20000, 0xcac44154, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "d-13.1", 0x80000, 0xff6a57fb, BRF_GRA }, // 2 4bpp Sprites - - { "d-14.5", 0x80000, 0x2178996f, BRF_GRA }, // 3 8bpp Sprites - { "d-15.6", 0x80000, 0x6629239e, BRF_GRA }, // 4 8bpp Sprites - { "d-18.9", 0x80000, 0x0210507a, BRF_GRA }, // 5 8bpp Sprites - { "d-19.10", 0x80000, 0xd27375d5, BRF_GRA }, // 6 8bpp Sprites - - { "d-12.uh15", 0x08000, 0x386f1b63, BRF_SND }, // 7 Z80 Program Code - - { "d-11.u14", 0x40000, 0xf3ee4861, BRF_SND }, // 8 Samples -}; - - -STD_ROM_PICK(Honeydol) -STD_ROM_FN(Honeydol) - -static struct BurnRomInfo SnowbrosRomDesc[] = { - { "sn6.bin", 0x20000, 0x4899ddcf, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "sn5.bin", 0x20000, 0xad310d3f, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites - - { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code -}; - - -STD_ROM_PICK(Snowbros) -STD_ROM_FN(Snowbros) - -static struct BurnRomInfo SnowbroaRomDesc[] = { - { "sbros-3a.5", 0x20000, 0x10cb37e1, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "sbros-2a.6", 0x20000, 0xab91cc1e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites - - { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code -}; - - -STD_ROM_PICK(Snowbroa) -STD_ROM_FN(Snowbroa) - -static struct BurnRomInfo SnowbrobRomDesc[] = { - { "sbros3-a", 0x20000, 0x301627d6, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "sbros2-a", 0x20000, 0xf6689f41, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites - - { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code -}; - - -STD_ROM_PICK(Snowbrob) -STD_ROM_FN(Snowbrob) - -static struct BurnRomInfo SnowbrocRomDesc[] = { - { "3-a.ic5", 0x20000, 0xe1bc346b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "2-a.ic6", 0x20000, 0x1be27f9d, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites - - { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code -}; - - -STD_ROM_PICK(Snowbroc) -STD_ROM_FN(Snowbroc) - -static struct BurnRomInfo SnowbrojRomDesc[] = { - { "snowbros.3", 0x20000, 0x3f504f9e, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "snowbros.2", 0x20000, 0x854b02bc, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites - - { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code -}; - - -STD_ROM_PICK(Snowbroj) -STD_ROM_FN(Snowbroj) - -static struct BurnRomInfo SnowbrodRomDesc[] = { - { "sbk_3-a.bin", 0x20000, 0x97174d40, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "sbk_2-a.bin", 0x20000, 0x80cc80e5, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites - - { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code -}; - - -STD_ROM_PICK(Snowbrod) -STD_ROM_FN(Snowbrod) - -static struct BurnRomInfo WintbobRomDesc[] = { - { "wb3", 0x10000, 0xb9719767, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "wb1", 0x10000, 0xa4488998, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - { "wb04.bin", 0x10000, 0x53be758d, BRF_ESS | BRF_PRG }, // 2 68000 Program Code - { "wb02.bin", 0x10000, 0xfc8e292e, BRF_ESS | BRF_PRG }, // 3 68000 Program Code - - { "wb13.bin", 0x10000, 0x426921de, BRF_GRA }, // 4 Sprites - { "wb06.bin", 0x10000, 0x68204937, BRF_GRA }, // 5 Sprites - { "wb12.bin", 0x10000, 0xef4e04c7, BRF_GRA }, // 6 Sprites - { "wb07.bin", 0x10000, 0x53f40978, BRF_GRA }, // 7 Sprites - { "wb11.bin", 0x10000, 0x41cb4563, BRF_GRA }, // 8 Sprites - { "wb08.bin", 0x10000, 0x9497b88c, BRF_GRA }, // 9 Sprites - { "wb10.bin", 0x10000, 0x5fa22b1e, BRF_GRA }, // 10 Sprites - { "wb09.bin", 0x10000, 0x9be718ca, BRF_GRA }, // 11 Sprites - - { "wb05.bin", 0x10000, 0x53fe59df, BRF_SND }, // 12 Z80 Program Code -}; - - -STD_ROM_PICK(Wintbob) -STD_ROM_FN(Wintbob) - -static struct BurnRomInfo Snowbro3RomDesc[] = { - { "ur4", 0x020000, 0x19c13ffd, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ur3", 0x020000, 0x3f32fa15, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "ua5", 0x080000, 0x0604e385, BRF_GRA }, // 2 4bpp Sprites - - { "un7", 0x200000, 0x4a79da4c, BRF_GRA }, // 3 8bpp Sprites - { "un8", 0x200000, 0x7a4561a4, BRF_GRA }, // 4 8bpp Sprites - - { "us5", 0x080000, 0x7c6368ef, BRF_SND }, // 5 Samples - - { "sound.mcu", 0x010000, 0x00000000, BRF_PRG | BRF_NODUMP }, // 6 Sound MCU -}; - - -STD_ROM_PICK(Snowbro3) -STD_ROM_FN(Snowbro3) - -static INT32 HyperpacDoReset() -{ - HyperpacSoundLatch = 0; - - if(HyperpacProtData && !Finalttr) memcpy(HyperpacRam + 0xf000, HyperpacProtData, 0x200); - if(HyperpacProtData && Finalttr) memcpy(HyperpacRam + 0x2000, HyperpacProtData, 0x200); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - if (Honeydol) BurnYM3812Reset(); - if (!Twinadv && !Honeydol) BurnYM2151Reset(); - - return 0; -} - -static INT32 SnowbrosDoReset() -{ - HyperpacSoundLatch = 0; - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - - return 0; -} - -static INT32 Snowbro3DoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - MSM6295Reset(0); - - Snowbro3Music = 0; - Snowbro3MusicPlaying = 0; - - return 0; -} - -static void HyperpacYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -// ---------------------------------------------------------------------------- -// CPU synchronisation - -static INT32 nCycles68KSync; - -static inline void snowbrosSynchroniseZ80(INT32 nExtraCycles) -{ - INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]) + nExtraCycles; - - if (nCycles <= ZetTotalCycles()) { - return; - } - - nCycles68KSync = nCycles - nExtraCycles; - - BurnTimerUpdateYM3812(nCycles); -} - -// Callbacks for the FM chip - -static void snowbrosFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 snowbrosSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 6000000; -} - -static INT32 HoneydolSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static void Snowbro3PlayMusic(INT32 data) -{ - Snowbro3Music = data; - - bprintf(PRINT_NORMAL, _T("%x\n"), data); - - switch (data) { - case 0x23: { - memcpy(MSM6295ROM + 0x20000, MSM6295ROM + 0x80000, 0x20000); - Snowbro3MusicPlaying = 1; - break; - } - - case 0x24: { - memcpy(MSM6295ROM + 0x20000, MSM6295ROM + 0xa0000, 0x20000); - Snowbro3MusicPlaying = 1; - break; - } - - case 0x25: { - memcpy(MSM6295ROM + 0x20000, MSM6295ROM + 0xc0000, 0x20000); - Snowbro3MusicPlaying = 1; - break; - } - - case 0x26: { - memcpy(MSM6295ROM + 0x20000, MSM6295ROM + 0x80000, 0x20000); - Snowbro3MusicPlaying = 1; - break; - } - - case 0x27: - case 0x28: - case 0x29: - case 0x2a: - case 0x2b: - case 0x2c: - case 0x2d: { - memcpy(MSM6295ROM + 0x20000, MSM6295ROM + 0xc0000, 0x20000); - Snowbro3MusicPlaying = 1; - break; - } - - case 0x2e: { - Snowbro3MusicPlaying = 0; - break; - } - } -} - -static void Snowbro3PlaySound(INT32 data) -{ - INT32 Status = MSM6295ReadStatus(0); - - if ((Status & 0x01) == 0x00) { - MSM6295Command(0, 0x80 | data); - MSM6295Command(0, 0x12); - } else { - if ((Status & 0x02) == 0x00) { - MSM6295Command(0, 0x80 | data); - MSM6295Command(0, 0x12); - } else { - if ((Status & 0x04) == 0x00) { - MSM6295Command(0, 0x80 | data); - MSM6295Command(0, 0x42); - } - } - } -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall HyperpacReadByte(UINT32 a) -{ - switch (a) { - case 0x200000: { - if (Threein1semi) return 0x0a; - } - - case 0x200001: { - if (Moremore || Threein1semi) return 0x0a; - } - - case 0x500000: { - return HyperpacInput[0]; - } - - case 0x500001: { - return HyperpacDip[0]; - } - - case 0x500002: { - return HyperpacInput[1]; - } - - case 0x500003: { - return HyperpacDip[1]; - } - - case 0x500004: { - return HyperpacInput[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall HyperpacReadByteLow(UINT32 a) -{ - switch (a) { - case 0x200001: { - if (Fourin1boot) return 0x02; - } - - case 0x500000: { - return 0x7f - HyperpacInput[0]; - } - - case 0x500001: { - return HyperpacDip[0]; - } - - case 0x500002: { - return 0x7f - HyperpacInput[1]; - } - - case 0x500003: { - return HyperpacDip[1]; - } - - case 0x500004: { - return 0xff - HyperpacInput[2]; - } - - case 0x500005: { - return 0xff - HyperpacInput[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); - } - } - - return 0xff; -} - -void __fastcall HyperpacWriteByte(UINT32 a, UINT8 d) -{ - if (a < 0x100000) return; - - switch (a) { - case 0x300001: { - HyperpacSoundLatch = d & 0xff; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); - } - } -} - -void __fastcall TwinadvWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x200000: - case 0x200001: { - return; - } - - case 0x300001: { - HyperpacSoundLatch = d & 0xff; - ZetNmi(); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall HyperpacReadWord(UINT32 a) -{ - switch (a) { - case 0x200000: { - if (Cookbib3) return 0x2a2a; - } - - default: { - bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); - } - } - - return 0; -} - -UINT16 __fastcall HyperpacReadWordLow(UINT32 a) -{ - switch (a) { - case 0x500000: - case 0x500002: - case 0x500004: { - SEK_DEF_READ_WORD(0, a); - } - - default: { - bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); - } - - } - - return 0xffff; -} - -void __fastcall HyperpacWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x00b7d6: - case 0x00b7d8: { - if (Finalttr) return; - } - - case 0x200000: { - if (Fourin1boot) return; // Watchdog in original Snow Bros. - } - - case 0x300000: { - SEK_DEF_WRITE_WORD(0, a, d); - return; - } - - case 0x400000: { - return; - } - - case 0x800000: - case 0x900000: - case 0xa00000: { - // IRQ ACK - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall HoneydolReadByte(UINT32 a) -{ - switch (a) { - case 0x900000: { - return 0x7f - HyperpacInput[0]; - } - - case 0x900001: { - return HyperpacDip[0]; - } - - case 0x900002: { - return 0x7f - HyperpacInput[1]; - } - - case 0x900003: { - return HyperpacDip[1]; - } - - case 0x900004: { - return 0xff - HyperpacInput[2]; - } - - case 0x900005: { - return 0xff; - } - } - - bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); - - return 0; -} - -UINT16 __fastcall HoneydolReadWord(UINT32 a) -{ - switch (a) { - case 0x900000: - case 0x900002: - case 0x900004: { - SEK_DEF_READ_WORD(0, a); - } - } - - bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); - - return 0; -} - -void __fastcall HoneydolWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x300000: { - return; - } - - case 0x300001: { - HyperpacSoundLatch = d; - snowbrosSynchroniseZ80(0); - ZetNmi(); - return; - } - } - - bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); -} - -void __fastcall HoneydolWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x200000: { - return; // Watchdog? - } - - case 0x300000: { - SEK_DEF_WRITE_WORD(0, a, d); - return; - } - - case 0x400000: - case 0x500000: - case 0x600000: { - // IRQ Ack - return; - } - - case 0x800000: { - // ? - return; - } - } - - bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); -} - -UINT8 __fastcall HyperpacZ80Read(UINT16 a) -{ - switch (a) { - case 0xf001: { - return BurnYM2151ReadStatus(); - } - - case 0xf008: { - if (Fourin1boot) { - if (HyperpacSoundLatch != 0xff) return HyperpacSoundLatch; - } else { - return HyperpacSoundLatch; - } - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); - } - } - - return 0; -} - -void __fastcall HyperpacZ80Write(UINT16 a, UINT8 d) -{ - d &= 0xff; - - switch (a) { - case 0xf000: { - BurnYM2151SelectRegister(d); - return; - } - - case 0xf001: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xf002: { - MSM6295Command(0, d); - return; - } - - default: { -// bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02x\n"), a, d); - } - } -} - -UINT8 __fastcall TwinadvZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x02: { - return HyperpacSoundLatch; - } - - case 0x06: { - return MSM6295ReadStatus(0); - } - } - - bprintf(PRINT_NORMAL, _T("Z80 Port Read -> %02X\n"), a); - - return 0; -} - -void __fastcall TwinadvZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x02: { - HyperpacSoundLatch = d; - return; - } - - case 0x04: { - INT32 bank = (d &0x02) >> 1; - memcpy(MSM6295ROM + 0x00000, MSM6295ROM + (0x40000 * bank), 0x40000); - return; - } - - case 0x06: { - MSM6295Command(0, d); - return; - } - } - - bprintf(PRINT_NORMAL, _T("Z80 Port Write -> %02X, %02x\n"), a, d); -} - -UINT8 __fastcall HoneydolZ80Read(UINT16 a) -{ - switch (a) { - case 0xe010: { - return MSM6295ReadStatus(0); - } - } - - bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); - - return 0; -} - -void __fastcall HoneydolZ80Write(UINT16 a, UINT8 d) -{ - d &= 0xff; - - switch (a) { - case 0xe010: { - MSM6295Command(0, d); - return; - } - } - - bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02x\n"), a, d); -} - -UINT16 __fastcall SnowbrosReadWord(UINT32 a) -{ - switch (a) { - case 0x300000: - case 0x500000: - case 0x500002: - case 0x500004: { - SEK_DEF_READ_WORD(0, a); - } - } - - return 0; -} - -UINT8 __fastcall SnowbrosReadByte(UINT32 a) -{ - switch (a) { - case 0x300001: { - snowbrosSynchroniseZ80(0x0100); - return HyperpacSoundLatch; - } - - case 0x500000: { - return 0x7f - HyperpacInput[0]; - } - - case 0x500001: { - return 0xff - HyperpacDip[0]; - } - - case 0x500002: { - return 0xff - HyperpacInput[1]; - } - - case 0x500003: { - return 0xff - HyperpacDip[1]; - } - - case 0x500004: { - return 0xff - HyperpacInput[2]; - } - } - - return 0; -} - -void __fastcall SnowbrosWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x300000: { - SEK_DEF_WRITE_WORD(0, a, d); - return; - } - } -} - -void __fastcall SnowbrosWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x300001: { - HyperpacSoundLatch = d; - snowbrosSynchroniseZ80(0); - ZetNmi(); - return; - } - } -} - -UINT16 __fastcall Snowbro3ReadWord(UINT32 a) -{ - switch (a) { - case 0x300000: { - return 3; - } - - case 0x500000: - case 0x500002: - case 0x500004: { - SEK_DEF_READ_WORD(0, a); - } - } - - bprintf(PRINT_NORMAL, _T("68000 Read Word %06X\n"), a); - - return 0; -} - -UINT8 __fastcall Snowbro3ReadByte(UINT32 a) -{ - switch (a) { -/* case 0x300001: { - snowbrosSynchroniseZ80(0x0100); - return HyperpacSoundLatch; - }*/ - - case 0x500000: { - return 0x7f - HyperpacInput[0]; - } - - case 0x500001: { - return 0xff - HyperpacDip[0]; - } - - case 0x500002: { - return 0xff - HyperpacInput[1]; - } - - case 0x500003: { - return 0xff - HyperpacDip[1]; - } - - case 0x500004: { - return 0xff - HyperpacInput[2]; - } - - case 0x500005: { - return 0xff; - } - } - - bprintf(PRINT_NORMAL, _T("68000 Read Byte %06X\n"), a); - - return 0; -} - -void __fastcall Snowbro3WriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x300000: { - if (d == 0xfe) { - Snowbro3MusicPlaying = 0; - MSM6295Command(0, 0x78); - } else { - d = d >> 8; - - if (d <= 0x21) Snowbro3PlaySound(d); - if (d >= 0x22 && d <= 0x31) Snowbro3PlayMusic(d); - if (d >= 0x30 && d <= 0x51) Snowbro3PlaySound(d - 0x30); - if (d >= 0x52 && d <= 0x5f) Snowbro3PlayMusic(d - 0x30); - } - return; - } - - case 0x200000: - case 0x800000: - case 0x900000: - case 0xa00000: { - return; - } - } - - bprintf(PRINT_NORMAL, _T("68000 Write Word %06X -> %04X\n"), a, d); -} - -void __fastcall Snowbro3WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x300000: { - if (d == 0xfe) { - Snowbro3MusicPlaying = 0; - MSM6295Command(0, 0x78); - } else { - //d = d >> 8; - - if (d <= 0x21) Snowbro3PlaySound(d); - if (d >= 0x22 && d <= 0x31) Snowbro3PlayMusic(d); - if (d >= 0x30 && d <= 0x51) Snowbro3PlaySound(d - 0x30); - if (d >= 0x52 && d <= 0x5f) Snowbro3PlayMusic(d - 0x30); - } - return; - } - } - - bprintf(PRINT_NORMAL, _T("68000 Write Byte %06X -> %02X\n"), a, d); -} - -UINT8 __fastcall SnowbrosZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x02: - return BurnYM3812Read(0); - case 0x04: { - if (ZetTotalCycles() > nCycles68KSync) { - BurnTimerUpdateEndYM3812(); - } - return HyperpacSoundLatch; - } - } - - return 0; -} - -void __fastcall SnowbrosZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x02: { - BurnYM3812Write(0, d); - return; - } - - case 0x03: { - BurnYM3812Write(1, d); - return; - } - - case 0x04: { - HyperpacSoundLatch = d; - return; - } - } -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - HyperpacRom = Next; Next += 0x100000; - HyperpacZ80Rom = Next; Next += 0x10000; - if (Twinadv) { - MSM6295ROM = Next; Next += 0x80000; - } else { - MSM6295ROM = Next; Next += 0x40000; - } - - RamStart = Next; - - HyperpacRam = Next; Next += 0x10000; - if (Honeydol) { - HyperpacPaletteRam = Next; Next += 0x00800; - } else { - HyperpacPaletteRam = Next; Next += 0x00200; - } - HyperpacSpriteRam = Next; Next += 0x02000; - HyperpacZ80Ram = Next; Next += 0x00800; - - RamEnd = Next; - - HyperpacSprites = Next; Next += (HyperpacNumTiles * 16 * 16); - HyperpacSprites8bpp = Next; Next += (HyperpacNumTiles8bpp * 16 * 16); - HyperpacProtData = Next; Next += 0x00200; - if (Honeydol) { - HyperpacPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - } else { - HyperpacPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); - } - MemEnd = Next; - - return 0; -} - - -static INT32 SnowbrosMemIndex() -{ - UINT8 *Next; Next = Mem; - - HyperpacRom = Next; Next += 0x40000; - HyperpacZ80Rom = Next; Next += (Wintbob) ? 0x10000 : 0x08000; - - RamStart = Next; - - HyperpacRam = Next; Next += 0x04000; - HyperpacPaletteRam = Next; Next += 0x00200; - HyperpacSpriteRam = Next; Next += 0x02000; - HyperpacZ80Ram = Next; Next += 0x00800; - - RamEnd = Next; - - HyperpacSprites = Next; Next += (HyperpacNumTiles * 16 * 16); - HyperpacPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -static INT32 Snowbro3MemIndex() -{ - UINT8 *Next; Next = Mem; - - HyperpacRom = Next; Next += 0x40000; - MSM6295ROM = Next; Next += 0xe0000; - - RamStart = Next; - - HyperpacRam = Next; Next += 0x04000; - HyperpacPaletteRam = Next; Next += 0x00400; - HyperpacSpriteRam = Next; Next += 0x02200; - - RamEnd = Next; - - HyperpacSprites = Next; Next += (HyperpacNumTiles * 16 * 16); - HyperpacSprites8bpp = Next; Next += (HyperpacNumTiles8bpp * 16 * 16); - HyperpacPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -static INT32 HyperpacMachineInit() -{ - BurnSetRefreshRate(57.5); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(HyperpacRom , 0x000000, 0x0fffff, SM_ROM); - if (Finalttr) { - SekMapMemory(HyperpacRam , 0x100000, 0x103fff, SM_RAM); - } else { - SekMapMemory(HyperpacRam , 0x100000, 0x10ffff, SM_RAM); - } - SekMapMemory(HyperpacPaletteRam, 0x600000, 0x6001ff, SM_RAM); - SekMapMemory(HyperpacSpriteRam , 0x700000, 0x701fff, SM_RAM); - if (Fourin1boot || Finalttr) { - SekSetReadByteHandler(0, HyperpacReadByteLow); - SekSetReadWordHandler(0, HyperpacReadWordLow); - } else { - SekSetReadByteHandler(0, HyperpacReadByte); - SekSetReadWordHandler(0, HyperpacReadWord); - } - SekSetWriteByteHandler(0, HyperpacWriteByte); - SekSetWriteWordHandler(0, HyperpacWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xcfff, 0, HyperpacZ80Rom); - ZetMapArea(0x0000, 0xcfff, 2, HyperpacZ80Rom); - ZetMapArea(0xd000, 0xd7ff, 0, HyperpacZ80Ram); - ZetMapArea(0xd000, 0xd7ff, 1, HyperpacZ80Ram); - ZetMapArea(0xd000, 0xd7ff, 2, HyperpacZ80Ram); - ZetMemEnd(); - ZetSetReadHandler(HyperpacZ80Read); - ZetSetWriteHandler(HyperpacZ80Write); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(4000000); - BurnYM2151SetIrqHandler(&HyperpacYM2151IrqHandler); - BurnYM2151SetAllRoutes(0.10, BURN_SND_ROUTE_BOTH); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 999900 / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - HyperpacDoReset(); - - return 0; -} - -static INT32 HyperpacSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 HyperpacSpriteXOffsets[16] = { 4, 0, 260, 256, 20, 16, 276, 272, 12, 8, 268, 264, 28, 24, 284, 280 }; -static INT32 HyperpacSpriteYOffsets[16] = { 0, 64, 32, 96, 512, 576, 544, 608, 128, 192, 160, 224, 640, 704, 672, 736 }; -static INT32 SnowbrosSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 SnowbrosSpriteXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; -static INT32 SnowbrosSpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; -static INT32 WintbobSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 WintbobSpriteXOffsets[16] = { 12, 8, 4, 0, 28, 24, 20, 16, 44, 40, 36, 32, 60, 56, 52, 48 }; -static INT32 WintbobSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; -static INT32 Honeydol8BppPlaneOffsets[8] = { 0, 1, 2, 3, 0x800000, 0x800001, 0x800002, 0x800003 }; -static INT32 Honeydol8BppXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; -static INT32 Honeydol8BppYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; -static INT32 Snowbro38BppPlaneOffsets[8] = { 8, 9, 10, 11, 0, 1, 2, 3 }; -static INT32 Snowbro38BppXOffsets[16] = { 0, 4, 16, 20, 32, 36, 48, 52, 512, 516, 528, 532, 544, 548, 560, 564 }; -static INT32 Snowbro38BppYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472 }; - -static INT32 HyperpacInit() -{ - INT32 nRet = 0, nLen; - - HyperpacNumTiles = 6144; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x0c0000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 5, 1); if (nRet != 0) return 1; - - // Simulate RAM initialisation done by the protection MCU (not needed for bootleg) - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "hyperpac")) { - HyperpacRam[0xe000 + 0] = 0xf9; - HyperpacRam[0xe000 + 1] = 0x4e; - HyperpacRam[0xe002 + 0] = 0x00; - HyperpacRam[0xe002 + 1] = 0x00; - HyperpacRam[0xe004 + 0] = 0x2c; - HyperpacRam[0xe004 + 1] = 0x06; - HyperpacRam[0xe080 + 0] = 0xdc; - HyperpacRam[0xe080 + 1] = 0xfe; - HyperpacRam[0xe082 + 0] = 0x98; - HyperpacRam[0xe082 + 1] = 0xba; - HyperpacRam[0xe084 + 0] = 0x54; - HyperpacRam[0xe084 + 1] = 0x76; - HyperpacRam[0xe086 + 0] = 0x10; - HyperpacRam[0xe086 + 1] = 0x32; - } - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x00000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x40000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x80000, 4, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 6, 1); if (nRet != 0) return 1; - - nRet = HyperpacMachineInit(); if (nRet) return 1; - - return 0; -} - -static INT32 Cookbib2Init() -{ - INT32 nRet = 0, nLen; - - HyperpacNumTiles = 10240; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x140000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 5, 1); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x100000, 4, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 6, 1); if (nRet != 0) return 1; - - // Load Shared RAM data - nRet = BurnLoadRom(HyperpacProtData, 8, 1); if (nRet) return 1; - BurnByteswap(HyperpacProtData, 0x200); - - nRet = HyperpacMachineInit(); if (nRet) return 1; - - return 0; -} - -static INT32 Cookbib3Init() -{ - INT32 nRet = 0, nLen; - - HyperpacNumTiles = 16384; - - Cookbib3 = 1; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x200000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load and descramble Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 5, 1); if (nRet != 0) return 1; - UINT8 *pTemp = (UINT8*)BurnMalloc(0x10000); - memcpy(pTemp, HyperpacZ80Rom, 0x10000); - memcpy(HyperpacZ80Rom + 0xc000, pTemp + 0x0000, 0x4000); - memcpy(HyperpacZ80Rom + 0x8000, pTemp + 0x4000, 0x4000); - memcpy(HyperpacZ80Rom + 0x4000, pTemp + 0x8000, 0x4000); - memcpy(HyperpacZ80Rom + 0x0000, pTemp + 0xc000, 0x4000); - BurnFree(pTemp); - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x100000, 4, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 6, 1); if (nRet != 0) return 1; - - // Load Shared RAM data - nRet = BurnLoadRom(HyperpacProtData, 8, 1); if (nRet) return 1; - BurnByteswap(HyperpacProtData, 0x200); - - nRet = HyperpacMachineInit(); if (nRet) return 1; - - return 0; -} - -static INT32 MoremoreInit() -{ - INT32 nRet = 0, nLen; - - HyperpacNumTiles = 16384; - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "moremore") || !strcmp(BurnDrvGetTextA(DRV_NAME), "moremorp")) Moremore = 1; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "3in1semi")) Threein1semi = 1; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x200000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 6, 1); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x100000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x180000, 5, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 7, 1); if (nRet != 0) return 1; - - // Load Shared RAM data - nRet = BurnLoadRom(HyperpacProtData, 9, 1); if (nRet) return 1; - BurnByteswap(HyperpacProtData, 0x200); - - nRet = HyperpacMachineInit(); if (nRet) return 1; - - return 0; -} - -static INT32 TwinkleInit() -{ - INT32 nRet = 0, nLen; - - HyperpacNumTiles = 4096; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x080000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 3, 1); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 4, 1); if (nRet != 0) return 1; - - // Load Shared RAM data - nRet = BurnLoadRom(HyperpacProtData, 6, 1); if (nRet) return 1; - BurnByteswap(HyperpacProtData, 0x200); - - nRet = HyperpacMachineInit(); if (nRet) return 1; - - return 0; -} - -static INT32 PzlbreakInit() -{ - INT32 nRet = 0, nLen; - - HyperpacNumTiles = 8192; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x100000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 4, 1); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 3, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 5, 1); if (nRet != 0) return 1; - - // Load Shared RAM data - nRet = BurnLoadRom(HyperpacProtData, 7, 1); if (nRet) return 1; - BurnByteswap(HyperpacProtData, 0x200); - - nRet = HyperpacMachineInit(); if (nRet) return 1; - - return 0; -} - -static void Fourin1bootDescrambleRom() -{ - UINT8 *buffer; - UINT8 *src = HyperpacRom; - INT32 len = 0x100000; - - /* strange order */ - if ((buffer = (UINT8*)BurnMalloc(len))) - { - INT32 i; - for (i = 0;i < len; i++) - if (i&1) buffer[i] = BITSWAP08(src[i],6,7,5,4,3,2,1,0); - else buffer[i] = src[i]; - - memcpy(src,buffer,len); - BurnFree(buffer); - } - - src = HyperpacZ80Rom; - len = 0x10000; - - /* strange order */ - if ((buffer = (UINT8*)BurnMalloc(len))) - { - INT32 i; - for (i = 0;i < len; i++) { - buffer[i] = src[i ^ 0x4000]; - } - memcpy(src,buffer,len); - BurnFree(buffer); - } -} - -static INT32 Fourin1bootInit() -{ - INT32 nRet = 0, nLen; - - HyperpacNumTiles = 16384; - - Fourin1boot = 1; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x200000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load and Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 3, 1); if (nRet != 0) return 1; - - Fourin1bootDescrambleRom(); - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, SnowbrosSpritePlaneOffsets, SnowbrosSpriteXOffsets, SnowbrosSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 4, 1); if (nRet != 0) return 1; - - nRet = HyperpacMachineInit(); if (nRet) return 1; - - return 0; -} - -static INT32 FinalttrInit() -{ - INT32 nRet = 0, nLen; - - HyperpacNumTiles = 8192; - - Finalttr = 1; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x100000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 6, 1); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x040000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x0c0000, 5, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 7, 1); if (nRet != 0) return 1; - - // Load Shared RAM data - nRet = BurnLoadRom(HyperpacProtData, 9, 1); if (nRet) return 1; - BurnByteswap(HyperpacProtData, 0x200); - - nRet = HyperpacMachineInit(); if (nRet) return 1; - - BurnYM2151SetAllRoutes(0.08, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); - - return 0; -} - -static INT32 TwinadvInit() -{ - INT32 nRet = 0, nLen; - - HyperpacNumTiles = 12288; - - Twinadv = 1; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x180000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 5, 1); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x100000, 4, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, SnowbrosSpritePlaneOffsets, SnowbrosSpriteXOffsets, SnowbrosSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - - // Load Sample Roms - nRet = BurnLoadRom(MSM6295ROM + 0x00000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROM + 0x40000, 7, 1); if (nRet != 0) return 1; - - BurnSetRefreshRate(57.5); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(HyperpacRom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(HyperpacRam , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(HyperpacPaletteRam, 0x600000, 0x6001ff, SM_RAM); - SekMapMemory(HyperpacSpriteRam , 0x700000, 0x701fff, SM_RAM); - SekSetReadByteHandler(0, HyperpacReadByteLow); - SekSetReadWordHandler(0, HyperpacReadWordLow); - SekSetWriteByteHandler(0, TwinadvWriteByte); - SekSetWriteWordHandler(0, HyperpacWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, HyperpacZ80Rom); - ZetMapArea(0x0000, 0x7fff, 2, HyperpacZ80Rom); - ZetMapArea(0x8000, 0x87ff, 0, HyperpacZ80Ram); - ZetMapArea(0x8000, 0x87ff, 1, HyperpacZ80Ram); - ZetMapArea(0x8000, 0x87ff, 2, HyperpacZ80Ram); - ZetMemEnd(); - ZetSetInHandler(TwinadvZ80PortRead); - ZetSetOutHandler(TwinadvZ80PortWrite); - ZetClose(); - - // Setup the OKIM6295 emulation - MSM6295Init(0, (12000000/12) / 132, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - HyperpacDoReset(); - - return 0; -} - -static INT32 HoneydolInit() -{ - INT32 nRet = 0, nLen; - - HyperpacNumTiles = 4096; - HyperpacNumTiles8bpp = 8192; - - Honeydol = 1; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x200000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 7, 1); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, SnowbrosSpritePlaneOffsets, SnowbrosSpriteXOffsets, SnowbrosSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - - // Load and Decode 8bpp Sprite Roms - memset(HyperpacTempGfx, 0, 0x200000); - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x100000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x180000, 6, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles8bpp, 8, 16, 16, Honeydol8BppPlaneOffsets, Honeydol8BppXOffsets, Honeydol8BppYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites8bpp); - BurnFree(HyperpacTempGfx); - - // Load Sample Roms - nRet = BurnLoadRom(MSM6295ROM + 0x00000, 8, 1); if (nRet != 0) return 1; - - BurnSetRefreshRate(57.5); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(HyperpacRom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(HyperpacRam , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(HyperpacPaletteRam, 0xa00000, 0xa007ff, SM_RAM); - SekMapMemory(HyperpacSpriteRam , 0xb00000, 0xb01fff, SM_RAM); - SekSetReadByteHandler(0, HoneydolReadByte); - SekSetReadWordHandler(0, HoneydolReadWord); - SekSetWriteByteHandler(0, HoneydolWriteByte); - SekSetWriteWordHandler(0, HoneydolWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, HyperpacZ80Rom); - ZetMapArea(0x0000, 0x7fff, 2, HyperpacZ80Rom); - ZetMapArea(0x8000, 0x87ff, 0, HyperpacZ80Ram); - ZetMapArea(0x8000, 0x87ff, 1, HyperpacZ80Ram); - ZetMapArea(0x8000, 0x87ff, 2, HyperpacZ80Ram); - ZetMemEnd(); - ZetSetInHandler(SnowbrosZ80PortRead); - ZetSetOutHandler(SnowbrosZ80PortWrite); - ZetSetReadHandler(HoneydolZ80Read); - ZetSetWriteHandler(HoneydolZ80Write); - ZetClose(); - - BurnYM3812Init(3000000, &snowbrosFMIRQHandler, &HoneydolSynchroniseStream, 0); - BurnTimerAttachZetYM3812(4000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 999900 / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - HyperpacDoReset(); - - return 0; -} - -static INT32 SnowbrosInit() -{ - INT32 nRet = 0, nLen; - - BurnSetRefreshRate(57.5); - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "wintbob")) Wintbob = 1; - - HyperpacNumTiles = 4096; - - // Allocate and Blank all required memory - Mem = NULL; - SnowbrosMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - SnowbrosMemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x80000); - - if (Wintbob) { - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x20001, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x20000, 3, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 12, 1); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x00000, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x00001, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x20000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x20001, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x40000, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x40001, 9, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x60000, 10, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x60001, 11, 2); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, WintbobSpritePlaneOffsets, WintbobSpriteXOffsets, WintbobSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - } else { - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Rom - nRet = BurnLoadRom(HyperpacZ80Rom, 3, 1); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x00000, 2, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, SnowbrosSpritePlaneOffsets, SnowbrosSpriteXOffsets, SnowbrosSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - BurnFree(HyperpacTempGfx); - } - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(HyperpacRom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(HyperpacRam , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(HyperpacPaletteRam, 0x600000, 0x6001ff, SM_RAM); - SekMapMemory(HyperpacSpriteRam , 0x700000, 0x701fff, SM_RAM); - SekSetReadWordHandler(0, SnowbrosReadWord); - SekSetWriteWordHandler(0, SnowbrosWriteWord); - SekSetReadByteHandler(0, SnowbrosReadByte); - SekSetWriteByteHandler(0, SnowbrosWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, HyperpacZ80Rom); - ZetMapArea(0x0000, 0x7fff, 2, HyperpacZ80Rom); - ZetMapArea(0x8000, 0x87ff, 0, HyperpacZ80Ram); - ZetMapArea(0x8000, 0x87ff, 1, HyperpacZ80Ram); - ZetMapArea(0x8000, 0x87ff, 2, HyperpacZ80Ram); - ZetMemEnd(); - ZetSetInHandler(SnowbrosZ80PortRead); - ZetSetOutHandler(SnowbrosZ80PortWrite); - ZetClose(); - - BurnYM3812Init(3000000, &snowbrosFMIRQHandler, &snowbrosSynchroniseStream, 0); - BurnTimerAttachZetYM3812(6000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - SnowbrosDoReset(); - - return 0; -} - -static INT32 Snowbro3Init() -{ - INT32 nRet = 0, nLen; - - Snowbro3 = 1; - - HyperpacNumTiles = 0x1000; - HyperpacNumTiles8bpp = 0x4000; - - // Allocate and Blank all required memory - Mem = NULL; - Snowbro3MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - Snowbro3MemIndex(); - - HyperpacTempGfx = (UINT8*)BurnMalloc(0x400000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(HyperpacRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Decode 68000 Program Rom - UINT8 *buffer; - buffer = (UINT8*)BurnMalloc(0x40000); - for (INT32 i = 0; i < 0x40000; i++) { - buffer[i] = HyperpacRom[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,3,4,1,2,0)]; - } - memcpy(HyperpacRom, buffer, 0x40000); - BurnFree(buffer); - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(HyperpacTempGfx + 0x00000, 2, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles, 4, 16, 16, SnowbrosSpritePlaneOffsets, SnowbrosSpriteXOffsets, SnowbrosSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); - - // Load and Decode 8bpp Sprite Roms - memset(HyperpacTempGfx, 0, 0x400000); - nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(HyperpacTempGfx + 0x200000, 4, 1); if (nRet != 0) return 1; - GfxDecode(HyperpacNumTiles8bpp, 8, 16, 16, Snowbro38BppPlaneOffsets, Snowbro38BppXOffsets, Snowbro38BppYOffsets, 0x800, HyperpacTempGfx, HyperpacSprites8bpp); - - // Load Sample Roms - memset(HyperpacTempGfx, 0, 0x400000); - nRet = BurnLoadRom(HyperpacTempGfx, 5, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROM + 0x00000, HyperpacTempGfx + 0x00000, 0x20000); - memcpy(MSM6295ROM + 0x80000, HyperpacTempGfx + 0x20000, 0x60000); - BurnFree(HyperpacTempGfx); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(HyperpacRom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(HyperpacRam , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(HyperpacPaletteRam, 0x600000, 0x6003ff, SM_RAM); - SekMapMemory(HyperpacSpriteRam , 0x700000, 0x7021ff, SM_RAM); - SekSetReadWordHandler(0, Snowbro3ReadWord); - SekSetWriteWordHandler(0, Snowbro3WriteWord); - SekSetReadByteHandler(0, Snowbro3ReadByte); - SekSetWriteByteHandler(0, Snowbro3WriteByte); - SekClose(); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 999900 / 132, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - Snowbro3DoReset(); - - return 0; -} - -static INT32 HyperpacExit() -{ - MSM6295Exit(0); - - SekExit(); - ZetExit(); - - GenericTilesExit(); - - if (!Twinadv && !Honeydol) BurnYM2151Exit(); - if (Honeydol) BurnYM3812Exit(); - - BurnFree(Mem); - - HyperpacNumTiles = 0; - HyperpacNumTiles8bpp = 0; - - Moremore = 0; - Threein1semi = 0; - Cookbib3 = 0; - Fourin1boot = 0; - Finalttr = 0; - Twinadv = 0; - Honeydol = 0; - Snowbro3 = 0; - - return 0; -} - -static INT32 SnowbrosExit() -{ - if (!Snowbro3) BurnYM3812Exit(); - if (Snowbro3) MSM6295Exit(0); - - SekExit(); - if (!Snowbro3) ZetExit(); - - GenericTilesExit(); - - BurnFree(Mem); - - HyperpacNumTiles = 0; - HyperpacNumTiles8bpp = 0; - Wintbob = 0; - - Snowbro3Music = 0; - Snowbro3MusicPlaying = 0; - Snowbro3 = 0; - - return 0; -} - -static void HyperpacRenderSpriteLayer() -{ - INT32 x = 0, y = 0, Offs; - - for (Offs = 0; Offs < 0x2000; Offs += 16) { - INT32 dx = ((HyperpacSpriteRam[Offs + 9] << 8) + HyperpacSpriteRam[Offs + 8]) & 0xff; - INT32 dy = ((HyperpacSpriteRam[Offs + 11] << 8) + HyperpacSpriteRam[Offs + 10]) & 0xff; - INT32 TileColour = (HyperpacSpriteRam[Offs + 7] << 8) + HyperpacSpriteRam[Offs + 6]; - INT32 Attr = (HyperpacSpriteRam[Offs + 15] << 8) + HyperpacSpriteRam[Offs + 14]; - INT32 Attr2 = (HyperpacSpriteRam[Offs + 13] << 8) + HyperpacSpriteRam[Offs + 12]; - INT32 FlipX = Attr & 0x80; - INT32 FlipY = (Attr & 0x40) << 1; - INT32 Tile = ((Attr & 0x3f) << 8) + (Attr2 & 0xff); - INT32 Colour = (TileColour & 0xf0) >> 4; - - if (TileColour & 1) dx = -1 - (dx ^ 0xff); - if (TileColour & 2) dy = -1 - (dy ^ 0xff); - if (TileColour & 4) { - x += dx; - y += dy; - } else { - x = dx; - y = dy; - } - - if (x > 511) x &= 0x1ff; - if (y > 511) y &= 0x1ff; - - if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } - } else { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } - } - } -} - -static void TwinadvRenderSpriteLayer() -{ - INT32 x = 0, y = 0, Offs; - - for (Offs = 0; Offs < 0x2000; Offs += 16) { - INT32 dx = ((HyperpacSpriteRam[Offs + 9] << 8) + HyperpacSpriteRam[Offs + 8]) & 0xff; - INT32 dy = ((HyperpacSpriteRam[Offs + 11] << 8) + HyperpacSpriteRam[Offs + 10]) & 0xff; - INT32 TileColour = (HyperpacSpriteRam[Offs + 7] << 8) + HyperpacSpriteRam[Offs + 6]; - INT32 Attr = (HyperpacSpriteRam[Offs + 15] << 8) + HyperpacSpriteRam[Offs + 14]; - INT32 Attr2 = (HyperpacSpriteRam[Offs + 13] << 8) + HyperpacSpriteRam[Offs + 12]; - INT32 FlipX = Attr & 0x80; - INT32 FlipY = (Attr & 0x40) << 1; - INT32 Tile = ((Attr & 0x3f) << 8) + (Attr2 & 0xff); - INT32 Colour = (TileColour & 0xf0) >> 4; - Colour ^= 0xf; - - x = dx; - y = dy; - - if (x > 511) x &= 0x1ff; - if (y > 511) y &= 0x1ff; - - if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } - } else { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } - } - } -} - -static void HoneydolRenderSpriteLayer() -{ - INT32 x = 0, y = 0, Offs; - - for (Offs = 0; Offs < 0x2000; Offs += 16) { - INT32 dx = (((HyperpacSpriteRam[Offs + 9] << 8) + HyperpacSpriteRam[Offs + 8]) >> 8) & 0xff; - INT32 dy = (((HyperpacSpriteRam[Offs + 11] << 8) + HyperpacSpriteRam[Offs + 10]) >> 8) & 0xff; - INT32 TileColour = (((HyperpacSpriteRam[Offs + 7] << 8) + HyperpacSpriteRam[Offs + 6]) >> 8) & 3; - INT32 Attr = ((HyperpacSpriteRam[Offs + 15] << 8) + HyperpacSpriteRam[Offs + 14]) >> 8; - INT32 Attr2 = (((HyperpacSpriteRam[Offs + 13] << 8) + HyperpacSpriteRam[Offs + 12]) >> 8) & 0xff; - INT32 FlipX = Attr & 0x80; - INT32 FlipY = (Attr & 0x40) << 1; - INT32 Tile = ((Attr & 0x3f) << 8) + (Attr2 & 0xff); - INT32 Colour = TileColour; - - x = dx; - y = dy; - - if (x > 511) x &= 0x1ff; - if (y > 511) y &= 0x1ff; - - if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); - - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); - } else { - Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); - } - } - } else { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); - } - } - } - - - - - dx = ((HyperpacSpriteRam[Offs + 9] << 8) + HyperpacSpriteRam[Offs + 8]) & 0xff; - dy = ((HyperpacSpriteRam[Offs + 11] << 8) + HyperpacSpriteRam[Offs + 10]) & 0xff; - TileColour = (HyperpacSpriteRam[Offs + 7] << 8) + HyperpacSpriteRam[Offs + 6]; - Attr = (HyperpacSpriteRam[Offs + 15] << 8) + HyperpacSpriteRam[Offs + 14]; - Attr2 = (HyperpacSpriteRam[Offs + 13] << 8) + HyperpacSpriteRam[Offs + 12]; - FlipX = Attr & 0x80; - FlipY = (Attr & 0x40) << 1; - Tile = ((Attr & 0x3f) << 8) + (Attr2 & 0xff); - Colour = (TileColour & 0x3f0) >> 4; - Colour ^= 0x3f; - - x = dx; - y = dy; - - if (x > 511) x &= 0x1ff; - if (y > 511) y &= 0x1ff; - - if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } - } else { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } - } - } -} - -static void SnowbrosRenderSpriteLayer() -{ - INT32 x = 0, y = 0, Offs; - - for (Offs = 0; Offs < 0x2000; Offs += 16) { - INT32 dx = ((HyperpacSpriteRam[Offs + 9] << 8) + HyperpacSpriteRam[Offs + 8]) & 0xff; - INT32 dy = ((HyperpacSpriteRam[Offs + 11] << 8) + HyperpacSpriteRam[Offs + 10]) & 0xff; - INT32 TileColour = (HyperpacSpriteRam[Offs + 7] << 8) + HyperpacSpriteRam[Offs + 6]; - INT32 Attr = (HyperpacSpriteRam[Offs + 15] << 8) + HyperpacSpriteRam[Offs + 14]; - INT32 Attr2 = (HyperpacSpriteRam[Offs + 13] << 8) + HyperpacSpriteRam[Offs + 12]; - INT32 FlipX = Attr & 0x80; - INT32 FlipY = (Attr & 0x40) << 1; - INT32 Tile = ((Attr & 0x1f) << 8) + (Attr2 & 0xff); - INT32 Colour = (TileColour & 0xf0) >> 4; - - if (TileColour & 1) dx = -1 - (dx ^ 0xff); - if (TileColour & 2) dy = -1 - (dy ^ 0xff); - if (TileColour & 4) { - x += dx; - y += dy; - } else { - x = dx; - y = dy; - } - - if (x > 511) x &= 0x1ff; - if (y > 511) y &= 0x1ff; - - if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } - } else { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } - } - } -} - -static void WintbobRenderSpriteLayer() -{ - INT32 x = 0, y = 0, Offs; - - UINT16 *SpriteRam = (UINT16*)HyperpacSpriteRam; - - for (Offs = 0; Offs < 0x2000 >> 1; Offs += 8) { - x = SpriteRam[Offs + 0] & 0xff; - y = SpriteRam[Offs + 4] & 0xff; - INT32 Attr = SpriteRam[Offs + 1]; - INT32 Disbl = Attr & 0x02; - INT32 Wrapr = Attr & 0x08; - INT32 Colour = (Attr & 0xf0) >> 4; - INT32 Attr2 = SpriteRam[Offs + 2]; - INT32 Tile = (Attr2 << 8) | (SpriteRam[Offs + 3] & 0xff); - INT32 FlipX = Attr2 & 0x80; - INT32 FlipY = (Attr2 & 0x40) << 1; - - if (Wrapr == 8) x -= 256; - - Tile &= 0xfff; - - if (Disbl == 2) continue; - - if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } - } else { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); - } - } - } - } -} - -static void Snowbro3RenderSpriteLayer() -{ - INT32 x = 0, y = 0, Offs; - - UINT16 *SpriteRam = (UINT16*)HyperpacSpriteRam; - UINT8 *pTile = NULL; - INT32 ColourDepth = 0; - - for (Offs = 0; Offs < 0x2200 >> 1; Offs += 8) { - INT32 dx = SpriteRam[Offs + 4] & 0xff; - INT32 dy = SpriteRam[Offs + 5] & 0xff; - INT32 TileColour = SpriteRam[Offs + 3]; - INT32 Attr = SpriteRam[Offs + 7]; - INT32 Attr2 = SpriteRam[Offs + 6]; - INT32 FlipX = Attr & 0x80; - INT32 FlipY = (Attr & 0x40) << 1; - INT32 Tile = ((Attr & 0xff) << 8) + (Attr2 & 0xff); - - if (TileColour & 1) dx = -1 - (dx ^ 0xff); - if (TileColour & 2) dy = -1 - (dy ^ 0xff); - if (TileColour & 4) { - x += dx; - y += dy; - } else { - x = dx; - y = dy; - } - - if (x > 511) x &= 0x1ff; - if (y > 511) y &= 0x1ff; - - if (Offs < 0x800) { - TileColour = 0x10; - Tile &= 0x3fff; - ColourDepth = 8; - pTile = HyperpacSprites8bpp; - } else { - Tile &= 0xfff; - ColourDepth = 4; - pTile = HyperpacSprites; - } - - INT32 Colour = (TileColour & 0xf0) >> 4; - - if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); - - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); - } else { - Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); - } - } - } else { - if (!FlipY) { - if (!FlipX) { - Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); - } - } else { - if (!FlipX) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); - } else { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); - } - } - } - } -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour >> 0) & 0x1f; - g = (nColour >> 5) & 0x1f; - b = (nColour >> 10) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - return BurnHighCol(r, g, b, 0); -} - -static INT32 HyperpacCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)HyperpacPaletteRam, pd = HyperpacPalette; i < 0x200; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } - - return 0; -} - -static INT32 HoneydolCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)HyperpacPaletteRam, pd = HyperpacPalette; i < 0x800; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } - - return 0; -} - -static INT32 Snowbro3CalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)HyperpacPaletteRam, pd = HyperpacPalette; i < 0x400; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } - - return 0; -} - -static void HyperpacRender() -{ - HyperpacCalcPalette(); - - for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { - pTransDraw[i] = 0xf0; - } - - HyperpacRenderSpriteLayer(); - BurnTransferCopy(HyperpacPalette); -} - -static void PzlbreakRender() -{ - HyperpacCalcPalette(); - - for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { - pTransDraw[i] = 0xc0; - } - - HyperpacRenderSpriteLayer(); - BurnTransferCopy(HyperpacPalette); -} - -static void TwinadvRender() -{ - HyperpacCalcPalette(); - - for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { - pTransDraw[i] = 0xf0; - } - - TwinadvRenderSpriteLayer(); - BurnTransferCopy(HyperpacPalette); -} - -static void HoneydolRender() -{ - HoneydolCalcPalette(); - - for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { - pTransDraw[i] = 0xf0; - } - - HoneydolRenderSpriteLayer(); - BurnTransferCopy(HyperpacPalette); -} - -static void SnowbrosRender() -{ - HyperpacCalcPalette(); - - for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { - pTransDraw[i] = 0xf0; - } - - if (Wintbob) { - WintbobRenderSpriteLayer(); - } else { - SnowbrosRenderSpriteLayer(); - } - BurnTransferCopy(HyperpacPalette); -} - -static void Snowbro3Render() -{ - Snowbro3CalcPalette(); - - for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { - pTransDraw[i] = 0xf0; - - } - - Snowbro3RenderSpriteLayer(); - BurnTransferCopy(HyperpacPalette); -} - -static INT32 HyperpacFrame() -{ - INT32 nInterleave = 4; - - if (HyperpacReset) HyperpacDoReset(); - - HyperpacMakeInputs(); - - nCyclesTotal[0] = 16000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - // Run Z80 - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - - if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - } - - SekClose(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - - if (pBurnDraw) HyperpacRender(); - - return 0; -} - -static INT32 PzlbreakFrame() -{ - INT32 nInterleave = 4; - - if (HyperpacReset) HyperpacDoReset(); - - HyperpacMakeInputs(); - - nCyclesTotal[0] = 16000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - // Run Z80 - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - - if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - } - - SekClose(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - - if (pBurnDraw) PzlbreakRender(); - - return 0; -} - -static INT32 FinalttrFrame() -{ - INT32 nInterleave = 4; - - if (HyperpacReset) HyperpacDoReset(); - - HyperpacMakeInputs(); - - nCyclesTotal[0] = 12000000 / 60; - nCyclesTotal[1] = 3578545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - // Run Z80 - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - - if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - } - - SekClose(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - - if (pBurnDraw) HyperpacRender(); - - return 0; -} - -static INT32 TwinadvFrame() -{ - INT32 nInterleave = 4; - - if (HyperpacReset) HyperpacDoReset(); - - HyperpacMakeInputs(); - - nCyclesTotal[0] = 16000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - // Run Z80 - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 2) ZetRaiseIrq(0); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - - if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - } - - SekClose(); - ZetClose(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) TwinadvRender(); - - return 0; -} - -static INT32 HoneydolFrame() -{ - INT32 nInterleave = 4; - - if (HyperpacReset) HyperpacDoReset(); - - HyperpacMakeInputs(); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - nCyclesTotal[0] = 16000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - SekTotalCycles(); - SekRun(nCyclesSegment); - - if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - } - - nCycles68KSync = SekTotalCycles(); - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; - -// bprintf(PRINT_NORMAL, _T("%i\ %i\n"), nCyclesDone[0], nCyclesDone[1]); - - ZetClose(); - SekClose(); - - if (pBurnDraw) HoneydolRender(); - - return 0; -} - -static INT32 SnowbrosFrame() -{ - INT32 nInterleave = 4; - - if (HyperpacReset) SnowbrosDoReset(); - - HyperpacMakeInputs(); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - nCyclesTotal[0] = (Wintbob) ? 12000000 / 60 : 8000000 / 60; - nCyclesTotal[1] = 6000000 / 60; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - SekTotalCycles(); - SekRun(nCyclesSegment); - - if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - } - - nCycles68KSync = SekTotalCycles(); - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; - -// bprintf(PRINT_NORMAL, _T("%i\ %i\n"), nCyclesDone[0], nCyclesDone[1]); - - ZetClose(); - SekClose(); - - if (pBurnDraw) SnowbrosRender(); - - return 0; -} - -static INT32 Snowbro3Frame() -{ - INT32 nInterleave = 4; - - if (HyperpacReset) Snowbro3DoReset(); - - HyperpacMakeInputs(); - - SekOpen(0); - - SekNewFrame(); - - SekIdle(nCyclesDone[0]); - - nCyclesTotal[0] = 16000000 / 60; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - SekTotalCycles(); - SekRun(nCyclesSegment); - - if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - - INT32 Status = MSM6295ReadStatus(0); - if (Snowbro3MusicPlaying) { - if ((Status & 0x08) == 0x00) { - MSM6295Command(0, 0x80 | Snowbro3Music); - MSM6295Command(0, 0x82); - } - } else { - if ((Status & 0x08) == 0x00) { - MSM6295Command(0, 0x40); - } - } - } - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - - SekClose(); - - if (pBurnSoundOut) MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - - if (pBurnDraw) Snowbro3Render(); - - return 0; -} - -static INT32 HyperpacScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x02944; - } - - if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); // Scan 68000 - ZetScan(nAction); // Scan Z80 - - MSM6295Scan(0, nAction); // Scan OKIM6295 - BurnYM2151Scan(nAction); - - // Scan critical driver variables - SCAN_VAR(HyperpacSoundLatch); - SCAN_VAR(HyperpacInput); - SCAN_VAR(HyperpacDip); - } - - return 0; -} - -static INT32 SnowbrosScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029519; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); // Scan 68000 - ZetScan(nAction); // Scan Z80 - - SCAN_VAR(nCyclesDone); - - BurnYM3812Scan(nAction, pnMin); - - // Scan critical driver variables - SCAN_VAR(HyperpacSoundLatch); - SCAN_VAR(HyperpacInput); - SCAN_VAR(HyperpacDip); - } - - return 0; -} - -static INT32 Snowbro3Scan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029672; - } - - if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); // Scan 68000 - - MSM6295Scan(0, nAction); // Scan OKIM6295 - - // Scan critical driver variables - SCAN_VAR(HyperpacSoundLatch); - SCAN_VAR(HyperpacInput); - SCAN_VAR(HyperpacDip); - SCAN_VAR(Snowbro3Music); - SCAN_VAR(Snowbro3MusicPlaying); - } - - return 0; -} - -struct BurnDriver BurnDrvHyperpac = { - "hyperpac", NULL, NULL, NULL, "1995", - "Hyper Pacman\0", NULL, "SemiCom", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, - NULL, HyperpacRomInfo, HyperpacRomName, NULL, NULL, HyperpacInputInfo, HyperpacDIPInfo, - HyperpacInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvHyperpacb = { - "hyperpacb", "hyperpac", NULL, NULL, "1995", - "Hyper Pacman (bootleg)\0", NULL, "SemiCom", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, - NULL, HyperpacbRomInfo, HyperpacbRomName, NULL, NULL, HyperpacInputInfo, HyperpacDIPInfo, - HyperpacInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvCookbib2 = { - "cookbib2", NULL, NULL, NULL, "1996", - "Cookie & Bibi 2\0", NULL, "SemiCom", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, Cookbib2RomInfo, Cookbib2RomName, NULL, NULL, HyperpacInputInfo, Cookbib2DIPInfo, - Cookbib2Init, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvCookbib3 = { - "cookbib3", NULL, NULL, NULL, "1997", - "Cookie & Bibi 3\0", NULL, "SemiCom", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, Cookbib3RomInfo, Cookbib3RomName, NULL, NULL, HyperpacInputInfo, Cookbib3DIPInfo, - Cookbib3Init, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMoremore = { - "moremore", NULL, NULL, NULL, "1999", - "More More\0", NULL, "SemiCom / Exit", "Kaneko Pandora based", - L"More More\0\uBAA8\uC544\uBAA8\uC544 More More\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, MoremoreRomInfo, MoremoreRomName, NULL, NULL, HyperpacInputInfo, MoremoreDIPInfo, - MoremoreInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMoremorp = { - "moremorp", NULL, NULL, NULL, "1999", - "More More Plus\0", NULL, "SemiCom / Exit", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, MoremorpRomInfo, MoremorpRomName, NULL, NULL, HyperpacInputInfo, MoremoreDIPInfo, - MoremoreInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvThreein1semi = { - "3in1semi", NULL, NULL, NULL, "1997", - "XESS - The New Revolution (SemiCom 3-in-1)\0", NULL, "SemiCom", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, Threein1semiRomInfo, Threein1semiRomName, NULL, NULL, HyperpacInputInfo, MoremoreDIPInfo, - MoremoreInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvToppyrap = { - "toppyrap", NULL, NULL, NULL, "1996", - "Toppy & Rappy\0", NULL, "SemiCom", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, ToppyrapRomInfo, ToppyrapRomName, NULL, NULL, HyperpacInputInfo, ToppyrapDIPInfo, - MoremoreInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTwinkle = { - "twinkle", NULL, NULL, NULL, "1997", - "Twinkle\0", NULL, "SemiCom", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, - NULL, TwinkleRomInfo, TwinkleRomName, NULL, NULL, HyperpacInputInfo, MoremoreDIPInfo, - TwinkleInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPzlbreak = { - "pzlbreak", NULL, NULL, NULL, "1997", - "Puzzle Break\0", NULL, "SemiCom", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, - NULL, PzlbreakRomInfo, PzlbreakRomName, NULL, NULL, HyperpacInputInfo, MoremoreDIPInfo, - PzlbreakInit, HyperpacExit, PzlbreakFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFourin1boot = { - "4in1boot", NULL, NULL, NULL, "2002", - "Puzzle King\0", NULL, "K1 Soft", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, Fourin1bootRomInfo, Fourin1bootRomName, NULL, NULL, HyperpacInputInfo, Fourin1bootDIPInfo, - Fourin1bootInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFinalttr = { - "finalttr", NULL, NULL, NULL, "1993", - "Final Tetris\0", NULL, "Jeil Computer System", "Kaneko Pandora based", - L"Final Tetris\0\uD30C\uC774\uB110 \uD14C\uD2B8\uB9AC\uC2A4\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, FinalttrRomInfo, FinalttrRomName, NULL, NULL, HyperpacInputInfo, FinalttrDIPInfo, - FinalttrInit, HyperpacExit, FinalttrFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTwinadv = { - "twinadv", NULL, NULL, NULL, "1995", - "Twin Adventure (World)\0", NULL, "Barko Corp", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, TwinadvRomInfo, TwinadvRomName, NULL, NULL, HyperpacInputInfo, TwinadvDIPInfo, - TwinadvInit, HyperpacExit, TwinadvFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTwinadvk = { - "twinadvk", "twinadv", NULL, NULL, "1995", - "Twin Adventure (Korea)\0", NULL, "Barko Corp", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, TwinadvkRomInfo, TwinadvkRomName, NULL, NULL, HyperpacInputInfo, TwinadvDIPInfo, - TwinadvInit, HyperpacExit, TwinadvFrame, NULL, HyperpacScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvHoneydol = { - "honeydol", NULL, NULL, NULL, "1995", - "Honey Dolls\0", NULL, "Barko Corp", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, HoneydolRomInfo, HoneydolRomName, NULL, NULL, HyperpacInputInfo, HoneydolDIPInfo, - HoneydolInit, HyperpacExit, HoneydolFrame, NULL, HyperpacScan, - NULL, 0x800, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSnowbros = { - "snowbros", NULL, NULL, NULL, "1990", - "Snow Bros. - Nick & Tom (set 1)\0", NULL, "Toaplan", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, SnowbrosRomInfo, SnowbrosRomName, NULL, NULL, SnowbrosInputInfo, SnowbrosDIPInfo, - SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSnowbroa = { - "snowbrosa", "snowbros", NULL, NULL, "1990", - "Snow Bros. - Nick & Tom (set 2)\0", NULL, "Toaplan", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, SnowbroaRomInfo, SnowbroaRomName, NULL, NULL, SnowbrosInputInfo, SnowbrosDIPInfo, - SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSnowbrob = { - "snowbrosb", "snowbros", NULL, NULL, "1990", - "Snow Bros. - Nick & Tom (set 3)\0", NULL, "Toaplan", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, SnowbrobRomInfo, SnowbrobRomName, NULL, NULL, SnowbrosInputInfo, SnowbrosDIPInfo, - SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSnowbroc = { - "snowbrosc", "snowbros", NULL, NULL, "1990", - "Snow Bros. - Nick & Tom (set 4)\0", NULL, "Toaplan", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, SnowbrocRomInfo, SnowbrocRomName, NULL, NULL, SnowbrosInputInfo, SnowbrosDIPInfo, - SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSnowbroj = { - "snowbrosj", "snowbros", NULL, NULL, "1990", - "Snow Bros. - Nick & Tom (Japan)\0", NULL, "Toaplan", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, SnowbrojRomInfo, SnowbrojRomName, NULL, NULL, SnowbrosInputInfo, SnowbrojDIPInfo, - SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSnowbrod = { - "snowbrosd", "snowbros", NULL, NULL, "1990", - "Snow Bros. - Nick & Tom (Dooyong license)\0", NULL, "Toaplan (Dooyong license)", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, SnowbrodRomInfo, SnowbrodRomName, NULL, NULL, SnowbrosInputInfo, SnowbrojDIPInfo, - SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWintbob = { - "wintbob", "snowbros", NULL, NULL, "1990", - "The Winter Bobble (bootleg)\0", NULL, "bootleg", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, WintbobRomInfo, WintbobRomName, NULL, NULL, SnowbrosInputInfo, SnowbrosDIPInfo, - SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, - NULL, 0x200, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSnowbro3 = { - "snowbros3", "snowbros", NULL, NULL, "2002", - "Snow Brothers 3 - Magical Adventure\0", NULL, "bootleg", "Kaneko Pandora based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, Snowbro3RomInfo, Snowbro3RomName, NULL, NULL, SnowbrosInputInfo, SnowbrojDIPInfo, - Snowbro3Init, SnowbrosExit, Snowbro3Frame, NULL, Snowbro3Scan, - NULL, 0x400, 256, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "timer.h" +#include "msm6295.h" +#include "burn_ym2151.h" +#include "burn_ym3812.h" +#include "bitswap.h" + +static UINT8 HyperpacInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 HyperpacInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 HyperpacInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 HyperpacDip[2] = {0, 0}; +static UINT8 HyperpacInput[3] = {0x00, 0x00, 0x00}; +static UINT8 HyperpacReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *HyperpacRom = NULL; +static UINT8 *HyperpacZ80Rom = NULL; +static UINT8 *HyperpacRam = NULL; +static UINT8 *HyperpacPaletteRam = NULL; +static UINT8 *HyperpacSpriteRam = NULL; +static UINT8 *HyperpacZ80Ram = NULL; +static UINT32 *HyperpacPalette = NULL; +static UINT8 *HyperpacSprites = NULL; +static UINT8 *HyperpacSprites8bpp = NULL; +static UINT8 *HyperpacTempGfx = NULL; +static UINT8 *HyperpacProtData = NULL; + +static INT32 HyperpacSoundLatch; +static INT32 Moremore = 0; +static INT32 Threein1semi = 0; +static INT32 Cookbib3 = 0; +static INT32 Fourin1boot = 0; +static INT32 Finalttr = 0; +static INT32 Twinadv = 0; +static INT32 Honeydol = 0; +static INT32 Wintbob = 0; +static INT32 Snowbro3 = 0; + +static INT32 HyperpacNumTiles = 0; +static INT32 HyperpacNumTiles8bpp = 0; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static INT32 Snowbro3MusicPlaying; +static INT32 Snowbro3Music; + +static struct BurnInputInfo HyperpacInputList[] = { + {"Coin 1" , BIT_DIGITAL , HyperpacInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , HyperpacInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , HyperpacInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , HyperpacInputPort2 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , HyperpacInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , HyperpacInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , HyperpacInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , HyperpacInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , HyperpacInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , HyperpacInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , HyperpacInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , HyperpacInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , HyperpacInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , HyperpacInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , HyperpacInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , HyperpacInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , HyperpacInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , HyperpacInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &HyperpacReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, HyperpacDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, HyperpacDip + 1 , "dip" }, +}; + +STDINPUTINFO(Hyperpac) + +static struct BurnInputInfo SnowbrosInputList[] = { + {"Coin 1" , BIT_DIGITAL , HyperpacInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , HyperpacInputPort2 + 0, "p1 start" }, + + {"P1 Up" , BIT_DIGITAL , HyperpacInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , HyperpacInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , HyperpacInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , HyperpacInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , HyperpacInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , HyperpacInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , HyperpacInputPort0 + 6, "p1 fire 3" }, + + {"Coin 2" , BIT_DIGITAL , HyperpacInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , HyperpacInputPort2 + 1, "p2 start" }, + + {"P2 Up" , BIT_DIGITAL , HyperpacInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , HyperpacInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , HyperpacInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , HyperpacInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , HyperpacInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , HyperpacInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , HyperpacInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &HyperpacReset , "reset" }, + {"Service" , BIT_DIGITAL , HyperpacInputPort2 + 6, "service" }, + {"Tilt" , BIT_DIGITAL , HyperpacInputPort2 + 5, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, HyperpacDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, HyperpacDip + 1 , "dip" }, +}; + +STDINPUTINFO(Snowbros) + +static inline void HyperpacClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void HyperpacMakeInputs() +{ + // Reset Inputs + HyperpacInput[0] = HyperpacInput[1] = HyperpacInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + HyperpacInput[0] |= (HyperpacInputPort0[i] & 1) << i; + HyperpacInput[1] |= (HyperpacInputPort1[i] & 1) << i; + HyperpacInput[2] |= (HyperpacInputPort2[i] & 1) << i; + } + + // Clear Opposites + HyperpacClearOpposites(&HyperpacInput[0]); + HyperpacClearOpposites(&HyperpacInput[1]); +} + +static struct BurnDIPInfo HyperpacDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfc, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x13, 0x01, 0x02, 0x02, "3" }, + {0x13, 0x01, 0x02, 0x00, "5" }, + + {0 , 0xfe, 0 , 8 , "Coin : Credit" }, + {0x13, 0x01, 0x1c, 0x00, "5 : 1" }, + {0x13, 0x01, 0x1c, 0x04, "4 : 1" }, + {0x13, 0x01, 0x1c, 0x08, "3 : 1" }, + {0x13, 0x01, 0x1c, 0x0c, "2 : 1" }, + {0x13, 0x01, 0x1c, 0x1c, "1 : 1" }, + {0x13, 0x01, 0x1c, 0x14, "2 : 3" }, + {0x13, 0x01, 0x1c, 0x18, "1 : 2" }, + {0x13, 0x01, 0x1c, 0x10, "1 : 3" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x60, 0x00, "Easy" }, + {0x13, 0x01, 0x60, 0x60, "Normal" }, + {0x13, 0x01, 0x60, 0x40, "Hard" }, + {0x13, 0x01, 0x60, 0x20, "Very Hard" }, + + {0 , 0xfe, 0 , 2 , "Mode" }, + {0x13, 0x01, 0x80, 0x80, "Game" }, + {0x13, 0x01, 0x80, 0x00, "Test" }, +}; + +STDDIPINFO(Hyperpac) + +static struct BurnDIPInfo Cookbib2DIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfc, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Max Vs Round" }, + {0x13, 0x01, 0x02, 0x02, "3" }, + {0x13, 0x01, 0x02, 0x00, "1" }, + + {0 , 0xfe, 0 , 8 , "Coin : Credit" }, + {0x13, 0x01, 0x1c, 0x00, "5 : 1" }, + {0x13, 0x01, 0x1c, 0x04, "4 : 1" }, + {0x13, 0x01, 0x1c, 0x08, "3 : 1" }, + {0x13, 0x01, 0x1c, 0x0c, "2 : 1" }, + {0x13, 0x01, 0x1c, 0x1c, "1 : 1" }, + {0x13, 0x01, 0x1c, 0x14, "2 : 3" }, + {0x13, 0x01, 0x1c, 0x18, "1 : 2" }, + {0x13, 0x01, 0x1c, 0x10, "1 : 3" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x60, 0x00, "Easy" }, + {0x13, 0x01, 0x60, 0x60, "Normal" }, + {0x13, 0x01, 0x60, 0x40, "Hard" }, + {0x13, 0x01, 0x60, 0x20, "Very Hard" }, + + {0 , 0xfe, 0 , 2 , "Mode" }, + {0x13, 0x01, 0x80, 0x80, "Game" }, + {0x13, 0x01, 0x80, 0x00, "Test" }, +}; + +STDDIPINFO(Cookbib2) + +static struct BurnDIPInfo Cookbib3DIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xee, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Coin : Credit" }, + {0x13, 0x01, 0x0e, 0x00, "5 : 1" }, + {0x13, 0x01, 0x0e, 0x02, "4 : 1" }, + {0x13, 0x01, 0x0e, 0x04, "3 : 1" }, + {0x13, 0x01, 0x0e, 0x06, "2 : 1" }, + {0x13, 0x01, 0x0e, 0x0e, "1 : 1" }, + {0x13, 0x01, 0x0e, 0x0a, "2 : 3" }, + {0x13, 0x01, 0x0e, 0x0c, "1 : 2" }, + {0x13, 0x01, 0x0e, 0x08, "1 : 3" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x13, 0x01, 0x70, 0x20, "Level 1" }, + {0x13, 0x01, 0x70, 0x10, "Level 2" }, + {0x13, 0x01, 0x70, 0x00, "Level 3" }, + {0x13, 0x01, 0x70, 0x70, "Level 4" }, + {0x13, 0x01, 0x70, 0x60, "Level 5" }, + {0x13, 0x01, 0x70, 0x50, "Level 6" }, + {0x13, 0x01, 0x70, 0x40, "Level 7" }, + {0x13, 0x01, 0x70, 0x30, "Level 8" }, + + {0 , 0xfe, 0 , 2 , "Mode" }, + {0x13, 0x01, 0x80, 0x80, "Game" }, + {0x13, 0x01, 0x80, 0x00, "Test" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Cookbib3) + +static struct BurnDIPInfo MoremoreDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xee, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Coin : Credit" }, + {0x13, 0x01, 0x0e, 0x00, "5 : 1" }, + {0x13, 0x01, 0x0e, 0x02, "4 : 1" }, + {0x13, 0x01, 0x0e, 0x04, "3 : 1" }, + {0x13, 0x01, 0x0e, 0x06, "2 : 1" }, + {0x13, 0x01, 0x0e, 0x0e, "1 : 1" }, + {0x13, 0x01, 0x0e, 0x0a, "2 : 3" }, + {0x13, 0x01, 0x0e, 0x0c, "1 : 2" }, + {0x13, 0x01, 0x0e, 0x08, "1 : 3" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x13, 0x01, 0x70, 0x20, "Level 1" }, + {0x13, 0x01, 0x70, 0x10, "Level 2" }, + {0x13, 0x01, 0x70, 0x00, "Level 3" }, + {0x13, 0x01, 0x70, 0x70, "Level 4" }, + {0x13, 0x01, 0x70, 0x60, "Level 5" }, + {0x13, 0x01, 0x70, 0x50, "Level 6" }, + {0x13, 0x01, 0x70, 0x40, "Level 7" }, + {0x13, 0x01, 0x70, 0x30, "Level 8" }, + + {0 , 0xfe, 0 , 2 , "Mode" }, + {0x13, 0x01, 0x80, 0x80, "Game" }, + {0x13, 0x01, 0x80, 0x00, "Test" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Moremore) + +static struct BurnDIPInfo ToppyrapDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Coin : Credit" }, + {0x13, 0x01, 0x1c, 0x00, "5 : 1" }, + {0x13, 0x01, 0x1c, 0x04, "4 : 1" }, + {0x13, 0x01, 0x1c, 0x08, "3 : 1" }, + {0x13, 0x01, 0x1c, 0x0c, "2 : 1" }, + {0x13, 0x01, 0x1c, 0x1c, "1 : 1" }, + {0x13, 0x01, 0x1c, 0x14, "2 : 3" }, + {0x13, 0x01, 0x1c, 0x18, "1 : 2" }, + {0x13, 0x01, 0x1c, 0x10, "1 : 3" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x60, 0x00, "Easy" }, + {0x13, 0x01, 0x60, 0x60, "Normal" }, + {0x13, 0x01, 0x60, 0x40, "Hard" }, + {0x13, 0x01, 0x60, 0x20, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Mode" }, + {0x13, 0x01, 0x80, 0x80, "Game" }, + {0x13, 0x01, 0x80, 0x00, "Test" }, + + {0 , 0xfe, 0 , 4 , "Player Count" }, + {0x14, 0x01, 0x03, 0x00, "2" }, + {0x14, 0x01, 0x03, 0x03, "3" }, + {0x14, 0x01, 0x03, 0x02, "4" }, + {0x14, 0x01, 0x03, 0x01, "5" }, + + {0 , 0xfe, 0 , 4 , "Game Time" }, + {0x14, 0x01, 0x0c, 0x04, "40 seconds" }, + {0x14, 0x01, 0x0c, 0x08, "50 seconds" }, + {0x14, 0x01, 0x0c, 0x0c, "60 seconds" }, + {0x14, 0x01, 0x0c, 0x00, "70 seconds" }, + + {0 , 0xfe, 0 , 2 , "God Mode" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Internal Test" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Toppyrap) + +static struct BurnDIPInfo Fourin1bootDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x06, 0x04, "1" }, + {0x13, 0x01, 0x06, 0x06, "2" }, + {0x13, 0x01, 0x06, 0x02, "3" }, + {0x13, 0x01, 0x06, 0x00, "4" }, + + {0 , 0xfe, 0 , 16 , "Coin : Credit" }, + {0x13, 0x01, 0x78, 0x18, "4 : 1" }, + {0x13, 0x01, 0x78, 0x38, "3 : 1" }, + {0x13, 0x01, 0x78, 0x10, "4 : 2" }, + {0x13, 0x01, 0x78, 0x58, "2 : 1" }, + {0x13, 0x01, 0x78, 0x30, "3 : 2" }, + {0x13, 0x01, 0x78, 0x08, "4 : 3" }, + {0x13, 0x01, 0x78, 0x00, "4 : 4" }, + {0x13, 0x01, 0x78, 0x28, "3 : 3" }, + {0x13, 0x01, 0x78, 0x50, "2 : 2" }, + {0x13, 0x01, 0x78, 0x78, "1 : 1" }, + {0x13, 0x01, 0x78, 0x20, "3 : 4" }, + {0x13, 0x01, 0x78, 0x48, "2 : 3" }, + {0x13, 0x01, 0x78, 0x40, "2 : 4" }, + {0x13, 0x01, 0x78, 0x70, "1 : 2" }, + {0x13, 0x01, 0x78, 0x68, "1 : 3" }, + {0x13, 0x01, 0x78, 0x60, "1 : 4" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x03, 0x02, "1" }, + {0x14, 0x01, 0x03, 0x00, "2" }, + {0x14, 0x01, 0x03, 0x03, "3" }, + {0x14, 0x01, 0x03, 0x01, "4" }, + + {0 , 0xfe, 0 , 2 , "Mode" }, + {0x14, 0x01, 0x80, 0x80, "Game" }, + {0x14, 0x01, 0x80, 0x00, "Test" }, +}; + +STDDIPINFO(Fourin1boot) + +static struct BurnDIPInfo FinalttrDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x13, 0x01, 0x01, 0x00, "Off" }, + {0x13, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 7 , "Coin : Credit" }, + {0x13, 0x01, 0x38, 0x00, "4 : 1" }, + {0x13, 0x01, 0x38, 0x10, "3 : 1" }, + {0x13, 0x01, 0x38, 0x30, "2 : 1" }, + {0x13, 0x01, 0x38, 0x38, "1 : 1" }, + {0x13, 0x01, 0x38, 0x20, "2 : 3" }, + {0x13, 0x01, 0x38, 0x28, "1 : 2" }, + {0x13, 0x01, 0x38, 0x08, "1 : 4" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Time" }, + {0x14, 0x01, 0x0c, 0x00, "60 seconds" }, + {0x14, 0x01, 0x0c, 0x0c, "90 seconds" }, + {0x14, 0x01, 0x0c, 0x08, "120 seconds" }, + {0x14, 0x01, 0x0c, 0x04, "150 seconds" }, +}; + +STDDIPINFO(Finalttr) + +static struct BurnDIPInfo TwinadvDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coin : Credit" }, + {0x13, 0x01, 0x03, 0x00, "3 : 1" }, + {0x13, 0x01, 0x03, 0x01, "2 : 1" }, + {0x13, 0x01, 0x03, 0x03, "1 : 1" }, + {0x13, 0x01, 0x03, 0x02, "1 : 2" }, + + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x13, 0x01, 0x10, 0x00, "Off" }, + {0x13, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Level Select" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x03, "Normal" }, + {0x14, 0x01, 0x03, 0x02, "Hard" }, + {0x14, 0x01, 0x03, 0x01, "Harder" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x14, 0x01, 0x04, 0x04, "3" }, + {0x14, 0x01, 0x04, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Ticket Mode 1" }, + {0x14, 0x01, 0x08, 0x08, "Off" }, + {0x14, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Ticket Mode 2" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Twinadv) + +static struct BurnDIPInfo HoneydolDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xef, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x13, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Show Girls" }, + {0x13, 0x01, 0x04, 0x00, "Off" }, + {0x13, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x13, 0x01, 0x10, 0x00, "Off" }, + {0x13, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Level Select" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Slide show on boot" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x03, "Normal" }, + {0x14, 0x01, 0x03, 0x02, "Hard" }, + {0x14, 0x01, 0x03, 0x01, "Harder" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Timer speed" }, + {0x14, 0x01, 0x0c, 0x0c, "Normal" }, + {0x14, 0x01, 0x0c, 0x08, "Fast" }, + {0x14, 0x01, 0x0c, 0x04, "Faster" }, + {0x14, 0x01, 0x0c, 0x00, "Fastest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x00, "1" }, + {0x14, 0x01, 0x30, 0x10, "2" }, + {0x14, 0x01, 0x30, 0x20, "3" }, + {0x14, 0x01, 0x30, 0x30, "5" }, + + {0 , 0xfe, 0 , 2 , "Max vs Round" }, + {0x14, 0x01, 0x80, 0x80, "3" }, + {0x14, 0x01, 0x80, 0x00, "1" }, +}; + +STDDIPINFO(Honeydol) + +static struct BurnDIPInfo SnowbrosDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0x01, NULL }, + {0x16, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Country" }, + {0x15, 0x01, 0x01, 0x01, "Europ Type" }, + {0x15, 0x01, 0x01, 0x00, "America Type" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Invert Screen" }, + {0x15, 0x01, 0x02, 0x00, "Normal Screen" }, + + {0 , 0xfe, 0 , 2 , "Test Mode" }, + {0x15, 0x01, 0x04, 0x00, "Off" }, + {0x15, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x08, "Advertise Sound Off" }, + {0x15, 0x01, 0x08, 0x00, "Advertise Sound On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x30, "4 Coin 1 Play" }, + {0x15, 0x01, 0x30, 0x20, "3 Coin 1 Play" }, + {0x15, 0x01, 0x30, 0x10, "2 Coin 1 Play" }, + {0x15, 0x01, 0x30, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 2 Play" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 3 Play" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 4 Play" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 6 Play" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x01, "Game Difficulty A" }, + {0x16, 0x01, 0x03, 0x00, "Game Difficulty B" }, + {0x16, 0x01, 0x03, 0x02, "Game Difficulty C" }, + {0x16, 0x01, 0x03, 0x03, "Game Difficulty D" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x0c, "Extend No Extend" }, + {0x16, 0x01, 0x0c, 0x00, "Extend 100000 Only" }, + {0x16, 0x01, 0x0c, 0x08, "Extend 100000, 200000" }, + {0x16, 0x01, 0x0c, 0x04, "Extend 200000 Only" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x10, "Hero Counts 1" }, + {0x16, 0x01, 0x30, 0x30, "Hero Counts 2" }, + {0x16, 0x01, 0x30, 0x00, "Hero Counts 3" }, + {0x16, 0x01, 0x30, 0x20, "Hero Counts 4" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x16, 0x01, 0x40, 0x40, "No Death, Stop Mode" }, + {0x16, 0x01, 0x40, 0x00, "Normal Game" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x80, 0x00, "Continue Play On" }, + {0x16, 0x01, 0x80, 0x80, "Continue Play Off" }, +}; + +STDDIPINFO(Snowbros) + +static struct BurnDIPInfo SnowbrojDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0x00, NULL }, + {0x16, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet Type" }, + {0x15, 0x01, 0x01, 0x01, "Up-Right Type" }, + {0x15, 0x01, 0x01, 0x00, "Table Type" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Invert Screen" }, + {0x15, 0x01, 0x02, 0x00, "Normal Screen" }, + + {0 , 0xfe, 0 , 2 , "Test Mode" }, + {0x15, 0x01, 0x04, 0x00, "Off" }, + {0x15, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x08, "Advertise Sound Off" }, + {0x15, 0x01, 0x08, 0x00, "Advertise Sound On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x30, "2 Coin 3 Play" }, + {0x15, 0x01, 0x30, 0x20, "2 Coin 1 Play" }, + {0x15, 0x01, 0x30, 0x10, "1 Coin 2 Play" }, + {0x15, 0x01, 0x30, 0x00, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0xc0, "2 Coin 3 Play" }, + {0x15, 0x01, 0xc0, 0x80, "2 Coin 1 Play" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 2 Play" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 1 Play" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x01, "Game Difficulty A" }, + {0x16, 0x01, 0x03, 0x00, "Game Difficulty B" }, + {0x16, 0x01, 0x03, 0x02, "Game Difficulty C" }, + {0x16, 0x01, 0x03, 0x03, "Game Difficulty D" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x0c, "Extend No Extend" }, + {0x16, 0x01, 0x0c, 0x00, "Extend 100000 Only" }, + {0x16, 0x01, 0x0c, 0x08, "Extend 100000, 200000" }, + {0x16, 0x01, 0x0c, 0x04, "Extend 200000 Only" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x10, "Hero Counts 1" }, + {0x16, 0x01, 0x30, 0x30, "Hero Counts 2" }, + {0x16, 0x01, 0x30, 0x00, "Hero Counts 3" }, + {0x16, 0x01, 0x30, 0x20, "Hero Counts 4" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x16, 0x01, 0x40, 0x40, "No Death, Stop Mode" }, + {0x16, 0x01, 0x40, 0x00, "Normal Game" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x80, 0x00, "Continue Play On" }, + {0x16, 0x01, 0x80, 0x80, "Continue Play Off" }, +}; + +STDDIPINFO(Snowbroj) + +static struct BurnRomInfo HyperpacRomDesc[] = { + { "hyperpac.h12", 0x20000, 0x2cf0531a, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "hyperpac.i12", 0x20000, 0x9c7d85b8, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "hyperpac.a4", 0x40000, 0xbd8673da, BRF_GRA }, // 2 Sprites + { "hyperpac.a5", 0x40000, 0x5d90cd82, BRF_GRA }, // 3 Sprites + { "hyperpac.a6", 0x40000, 0x61d86e63, BRF_GRA }, // 4 Sprites + + { "hyperpac.u1", 0x10000, 0x03faf88e, BRF_SND }, // 5 Z80 Program Code + + { "hyperpac.j15", 0x40000, 0xfb9f468d, BRF_SND }, // 6 Samples + + { "at89c52.bin", 0x02000, 0x291f9326, BRF_PRG | BRF_OPT }, +}; + + +STD_ROM_PICK(Hyperpac) +STD_ROM_FN(Hyperpac) + +static struct BurnRomInfo HyperpacbRomDesc[] = { + { "hpacuh12.bin", 0x20000, 0x633ab2c6, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "hpacui12.bin", 0x20000, 0x23dc00d1, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "hyperpac.a4", 0x40000, 0xbd8673da, BRF_GRA }, // 2 Sprites + { "hyperpac.a5", 0x40000, 0x5d90cd82, BRF_GRA }, // 3 Sprites + { "hyperpac.a6", 0x40000, 0x61d86e63, BRF_GRA }, // 4 Sprites + + { "hyperpac.u1", 0x10000, 0x03faf88e, BRF_SND }, // 5 Z80 Program Code + + { "hyperpac.j15", 0x40000, 0xfb9f468d, BRF_SND }, // 6 Samples +}; + + +STD_ROM_PICK(Hyperpacb) +STD_ROM_FN(Hyperpacb) + +static struct BurnRomInfo Cookbib2RomDesc[] = { + { "cookbib2.02", 0x40000, 0xb2909460, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "cookbib2.01", 0x40000, 0x65aafde2, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "cookbib2.05", 0x80000, 0x89fb38ce, BRF_GRA }, // 2 Sprites + { "cookbib2.04", 0x80000, 0xf240111f, BRF_GRA }, // 3 Sprites + { "cookbib2.03", 0x40000, 0xe1604821, BRF_GRA }, // 4 Sprites + + { "cookbib2.07", 0x10000, 0xf59f1c9a, BRF_SND }, // 5 Z80 Program Code + + { "cookbib2.06", 0x20000, 0x5e6f76b8, BRF_SND }, // 6 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, + + { "protdata.bin", 0x00200, 0xae6d8ed5, BRF_ESS | BRF_PRG }, // Data from shared RAM +}; + + +STD_ROM_PICK(Cookbib2) +STD_ROM_FN(Cookbib2) + +static struct BurnRomInfo Cookbib3RomDesc[] = { + { "u52.bin", 0x40000, 0x65134893, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "u74.bin", 0x40000, 0xc4ab8435, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "u75.bin", 0x80000, 0xcbe4d9c8, BRF_GRA }, // 2 Sprites + { "u76.bin", 0x80000, 0x1be17b57, BRF_GRA }, // 3 Sprites + { "u77.bin", 0x80000, 0x7823600d, BRF_GRA }, // 4 Sprites + + { "u35.bin", 0x10000, 0x5dfd2a98, BRF_SND }, // 5 Z80 Program Code + + { "u14.bin", 0x20000, 0xe5bf9288, BRF_SND }, // 6 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, + + { "protdata.bin", 0x00200, 0xc819b9a8, BRF_ESS | BRF_PRG }, // Data from shared RAM +}; + + +STD_ROM_PICK(Cookbib3) +STD_ROM_FN(Cookbib3) + +static struct BurnRomInfo MoremoreRomDesc[] = { + { "u52.bin", 0x40000, 0xcea4b246, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "u74.bin", 0x40000, 0x2acdcb88, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "u75.bin", 0x80000, 0xd671815c, BRF_GRA }, // 2 Sprites + { "u76.bin", 0x80000, 0xe0d479e8, BRF_GRA }, // 3 Sprites + { "u77.bin", 0x80000, 0x60a281da, BRF_GRA }, // 4 Sprites + { "u78.bin", 0x80000, 0xe2723b4e, BRF_GRA }, // 5 Sprites + + { "u35.bin", 0x10000, 0x92dc95fc, BRF_SND }, // 6 Z80 Program Code + + { "u14.bin", 0x40000, 0x90580088, BRF_SND }, // 7 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, + + { "protdata.bin", 0x00200, 0x782dd2aa, BRF_ESS | BRF_PRG }, // Data from shared RAM +}; + + +STD_ROM_PICK(Moremore) +STD_ROM_FN(Moremore) + +static struct BurnRomInfo MoremorpRomDesc[] = { + { "mmp_u52.bin", 0x40000, 0x66baf9b2, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "mmp_u74.bin", 0x40000, 0x7c6fede5, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "mmp_u75.bin", 0x80000, 0xaf9e824e, BRF_GRA }, // 2 Sprites + { "mmp_u76.bin", 0x80000, 0xc42af064, BRF_GRA }, // 3 Sprites + { "mmp_u77.bin", 0x80000, 0x1d7396e1, BRF_GRA }, // 4 Sprites + { "mmp_u78.bin", 0x80000, 0x5508d80b, BRF_GRA }, // 5 Sprites + + { "mmp_u35.bin", 0x10000, 0x4d098cad, BRF_SND }, // 6 Z80 Program Code + + { "mmp_u14.bin", 0x40000, 0x211a2566, BRF_SND }, // 7 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, + + { "protdata.bin", 0x00200, 0x782dd2aa, BRF_ESS | BRF_PRG }, // Data from shared RAM +}; + + +STD_ROM_PICK(Moremorp) +STD_ROM_FN(Moremorp) + +static struct BurnRomInfo ToppyrapRomDesc[] = { + { "uh12.bin", 0x40000, 0x6f5ad699, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ui12.bin", 0x40000, 0xcaf5a7e1, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "ua4.bin", 0x80000, 0xa9577bcf, BRF_GRA }, // 2 Sprites + { "ua5.bin", 0x80000, 0x7179d32d, BRF_GRA }, // 3 Sprites + { "ua6.bin", 0x80000, 0x4834e5b1, BRF_GRA }, // 4 Sprites + { "ua7.bin", 0x80000, 0x663dd099, BRF_GRA }, // 5 Sprites + + { "u1.bin", 0x10000, 0x07f50947, BRF_SND }, // 6 Z80 Program Code + + { "uj15.bin", 0x20000, 0xa3bacfd7, BRF_SND }, // 7 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, + + { "protdata.bin", 0x00200, 0x0704e6c7, BRF_ESS | BRF_PRG }, // Data from shared RAM +}; + + +STD_ROM_PICK(Toppyrap) +STD_ROM_FN(Toppyrap) + +static struct BurnRomInfo Threein1semiRomDesc[] = { + { "u52", 0x40000, 0xb0e4a0f7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "u74", 0x40000, 0x266862c4, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "u75", 0x80000, 0xb66a0db6, BRF_GRA }, // 2 Sprites + { "u76", 0x80000, 0x5f4b48ea, BRF_GRA }, // 3 Sprites + { "u77", 0x80000, 0xd44211e3, BRF_GRA }, // 4 Sprites + { "u78", 0x80000, 0xaf596afc, BRF_GRA }, // 5 Sprites + + { "u35", 0x10000, 0xe40481da, BRF_SND }, // 6 Z80 Program Code + + { "u14", 0x40000, 0xc83c11be, BRF_SND }, // 7 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, + + { "protdata.bin", 0x00200, 0x85deba7c, BRF_ESS | BRF_PRG }, // Data from shared RAM +}; + + +STD_ROM_PICK(Threein1semi) +STD_ROM_FN(Threein1semi) + +static struct BurnRomInfo TwinkleRomDesc[] = { + { "uh12.bin", 0x20000, 0xa99626fe, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ui12.bin", 0x20000, 0x5af73684, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "ua4.bin", 0x80000, 0x6b64bb09, BRF_GRA }, // 2 Sprites + + { "u1.bin", 0x10000, 0xe40481da, BRF_SND }, // 3 Z80 Program Code + + { "uj15.bin", 0x40000, 0x0a534b37, BRF_SND }, // 4 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, + + { "protdata.bin", 0x00200, 0x00d3e4b4, BRF_ESS | BRF_PRG }, // Data from shared RAM +}; + + +STD_ROM_PICK(Twinkle) +STD_ROM_FN(Twinkle) + +static struct BurnRomInfo PzlbreakRomDesc[] = { + { "4.uh12", 0x20000, 0xb3f04f80, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "5.ui12", 0x20000, 0x13c298a0, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "2.ua4", 0x80000, 0xd211705a, BRF_GRA }, // 2 Sprites + { "3.ua5", 0x80000, 0x6cdb73e9, BRF_GRA }, // 3 + + { "0.u1", 0x10000, 0x1ad646b7, BRF_SND }, // 4 Z80 Program Code + + { "1.uj15", 0x40000, 0xdbfae77c, BRF_SND }, // 5 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, + + { "protdata.bin", 0x00200, 0x092cb794, BRF_ESS | BRF_PRG }, // Data from shared RAM +}; + + +STD_ROM_PICK(Pzlbreak) +STD_ROM_FN(Pzlbreak) + +static struct BurnRomInfo Fourin1bootRomDesc[] = { + { "u52", 0x80000, 0x71815878, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "u74", 0x80000, 0xe22d3fa2, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "u78", 0x200000,0x6c1fbc9c, BRF_GRA }, // 2 Sprites + + { "u35", 0x10000, 0xc894ac80, BRF_SND }, // 3 Z80 Program Code + + { "u14", 0x40000, 0x94b09b0e, BRF_SND }, // 4 Samples +}; + + +STD_ROM_PICK(Fourin1boot) +STD_ROM_FN(Fourin1boot) + +static struct BurnRomInfo FinalttrRomDesc[] = { + { "10.7o", 0x20000, 0xeecc83e5, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "9.5o", 0x20000, 0x58d3640e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "5.1d", 0x40000, 0x64a450f3, BRF_GRA }, // 2 Sprites + { "6.1f", 0x40000, 0x7281a3cc, BRF_GRA }, // 3 Sprites + { "7.1g", 0x40000, 0xec80f442, BRF_GRA }, // 4 Sprites + { "9.1h", 0x40000, 0x2ebd316d, BRF_GRA }, // 5 Sprites + + { "12.5r", 0x10000, 0x4bc21361, BRF_SND }, // 6 Z80 Program Code + + { "11.7p", 0x20000, 0x2e331022, BRF_SND }, // 7 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, + + { "protdata.bin", 0x00200, 0xd5bbb006, BRF_ESS | BRF_PRG }, // Data from shared RAM +}; + + +STD_ROM_PICK(Finalttr) +STD_ROM_FN(Finalttr) + +static struct BurnRomInfo TwinadvRomDesc[] = { + { "13.uh12", 0x20000, 0x9f70a39b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "12.ui12", 0x20000, 0xd8776495, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "16.ua4", 0x80000, 0xf491e171, BRF_GRA }, // 2 Sprites + { "15.ua5", 0x80000, 0x79a08b8d, BRF_GRA }, // 3 Sprites + { "14.ua6", 0x80000, 0x79faee0b, BRF_GRA }, // 4 Sprites + + { "uh15.bin", 0x08000, 0x3d5acd08, BRF_SND }, // 5 Z80 Program Code + + { "sra.bin", 0x40000, 0x82f452c4, BRF_SND }, // 6 Samples + { "srb.bin", 0x40000, 0x109e51e6, BRF_SND }, // 7 Samples +}; + + +STD_ROM_PICK(Twinadv) +STD_ROM_FN(Twinadv) + +static struct BurnRomInfo TwinadvkRomDesc[] = { + { "uh12", 0x20000, 0xe0bcc738, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ui12", 0x20000, 0xa3ee6451, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "ua4", 0x80000, 0xa5aff49b, BRF_GRA }, // 2 Sprites + { "ua5", 0x80000, 0xf83b3b97, BRF_GRA }, // 3 Sprites + { "ua6", 0x80000, 0x4dfcffb9, BRF_GRA }, // 4 Sprites + + { "uh15.bin", 0x08000, 0x3d5acd08, BRF_SND }, // 5 Z80 Program Code + + { "sra.bin", 0x40000, 0x82f452c4, BRF_SND }, // 6 Samples + { "srb.bin", 0x40000, 0x109e51e6, BRF_SND }, // 7 Samples +}; + + +STD_ROM_PICK(Twinadvk) +STD_ROM_FN(Twinadvk) + +static struct BurnRomInfo HoneydolRomDesc[] = { + { "d-16.uh12", 0x20000, 0xcee1a2e3, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "d-17.ui12", 0x20000, 0xcac44154, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "d-13.1", 0x80000, 0xff6a57fb, BRF_GRA }, // 2 4bpp Sprites + + { "d-14.5", 0x80000, 0x2178996f, BRF_GRA }, // 3 8bpp Sprites + { "d-15.6", 0x80000, 0x6629239e, BRF_GRA }, // 4 8bpp Sprites + { "d-18.9", 0x80000, 0x0210507a, BRF_GRA }, // 5 8bpp Sprites + { "d-19.10", 0x80000, 0xd27375d5, BRF_GRA }, // 6 8bpp Sprites + + { "d-12.uh15", 0x08000, 0x386f1b63, BRF_SND }, // 7 Z80 Program Code + + { "d-11.u14", 0x40000, 0xf3ee4861, BRF_SND }, // 8 Samples +}; + + +STD_ROM_PICK(Honeydol) +STD_ROM_FN(Honeydol) + +static struct BurnRomInfo SnowbrosRomDesc[] = { + { "sn6.bin", 0x20000, 0x4899ddcf, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "sn5.bin", 0x20000, 0xad310d3f, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites + + { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code +}; + + +STD_ROM_PICK(Snowbros) +STD_ROM_FN(Snowbros) + +static struct BurnRomInfo SnowbroaRomDesc[] = { + { "sbros-3a.5", 0x20000, 0x10cb37e1, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "sbros-2a.6", 0x20000, 0xab91cc1e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites + + { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code +}; + + +STD_ROM_PICK(Snowbroa) +STD_ROM_FN(Snowbroa) + +static struct BurnRomInfo SnowbrobRomDesc[] = { + { "sbros3-a", 0x20000, 0x301627d6, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "sbros2-a", 0x20000, 0xf6689f41, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites + + { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code +}; + + +STD_ROM_PICK(Snowbrob) +STD_ROM_FN(Snowbrob) + +static struct BurnRomInfo SnowbrocRomDesc[] = { + { "3-a.ic5", 0x20000, 0xe1bc346b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "2-a.ic6", 0x20000, 0x1be27f9d, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites + + { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code +}; + + +STD_ROM_PICK(Snowbroc) +STD_ROM_FN(Snowbroc) + +static struct BurnRomInfo SnowbrojRomDesc[] = { + { "snowbros.3", 0x20000, 0x3f504f9e, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "snowbros.2", 0x20000, 0x854b02bc, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites + + { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code +}; + + +STD_ROM_PICK(Snowbroj) +STD_ROM_FN(Snowbroj) + +static struct BurnRomInfo SnowbrodRomDesc[] = { + { "sbk_3-a.bin", 0x20000, 0x97174d40, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "sbk_2-a.bin", 0x20000, 0x80cc80e5, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "sbros-1.41", 0x80000, 0x16f06b3a, BRF_GRA }, // 2 Sprites + + { "sbros-4.29", 0x08000, 0xe6eab4e4, BRF_SND }, // 3 Z80 Program Code +}; + + +STD_ROM_PICK(Snowbrod) +STD_ROM_FN(Snowbrod) + +static struct BurnRomInfo WintbobRomDesc[] = { + { "wb3", 0x10000, 0xb9719767, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "wb1", 0x10000, 0xa4488998, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + { "wb04.bin", 0x10000, 0x53be758d, BRF_ESS | BRF_PRG }, // 2 68000 Program Code + { "wb02.bin", 0x10000, 0xfc8e292e, BRF_ESS | BRF_PRG }, // 3 68000 Program Code + + { "wb13.bin", 0x10000, 0x426921de, BRF_GRA }, // 4 Sprites + { "wb06.bin", 0x10000, 0x68204937, BRF_GRA }, // 5 Sprites + { "wb12.bin", 0x10000, 0xef4e04c7, BRF_GRA }, // 6 Sprites + { "wb07.bin", 0x10000, 0x53f40978, BRF_GRA }, // 7 Sprites + { "wb11.bin", 0x10000, 0x41cb4563, BRF_GRA }, // 8 Sprites + { "wb08.bin", 0x10000, 0x9497b88c, BRF_GRA }, // 9 Sprites + { "wb10.bin", 0x10000, 0x5fa22b1e, BRF_GRA }, // 10 Sprites + { "wb09.bin", 0x10000, 0x9be718ca, BRF_GRA }, // 11 Sprites + + { "wb05.bin", 0x10000, 0x53fe59df, BRF_SND }, // 12 Z80 Program Code +}; + + +STD_ROM_PICK(Wintbob) +STD_ROM_FN(Wintbob) + +static struct BurnRomInfo Snowbro3RomDesc[] = { + { "ur4", 0x020000, 0x19c13ffd, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ur3", 0x020000, 0x3f32fa15, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "ua5", 0x080000, 0x0604e385, BRF_GRA }, // 2 4bpp Sprites + + { "un7", 0x200000, 0x4a79da4c, BRF_GRA }, // 3 8bpp Sprites + { "un8", 0x200000, 0x7a4561a4, BRF_GRA }, // 4 8bpp Sprites + + { "us5", 0x080000, 0x7c6368ef, BRF_SND }, // 5 Samples + + { "sound.mcu", 0x010000, 0x00000000, BRF_PRG | BRF_NODUMP }, // 6 Sound MCU +}; + + +STD_ROM_PICK(Snowbro3) +STD_ROM_FN(Snowbro3) + +static INT32 HyperpacDoReset() +{ + HyperpacSoundLatch = 0; + + if(HyperpacProtData && !Finalttr) memcpy(HyperpacRam + 0xf000, HyperpacProtData, 0x200); + if(HyperpacProtData && Finalttr) memcpy(HyperpacRam + 0x2000, HyperpacProtData, 0x200); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + if (Honeydol) BurnYM3812Reset(); + if (!Twinadv && !Honeydol) BurnYM2151Reset(); + + return 0; +} + +static INT32 SnowbrosDoReset() +{ + HyperpacSoundLatch = 0; + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + + return 0; +} + +static INT32 Snowbro3DoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + MSM6295Reset(0); + + Snowbro3Music = 0; + Snowbro3MusicPlaying = 0; + + return 0; +} + +static void HyperpacYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +// ---------------------------------------------------------------------------- +// CPU synchronisation + +static INT32 nCycles68KSync; + +static inline void snowbrosSynchroniseZ80(INT32 nExtraCycles) +{ + INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]) + nExtraCycles; + + if (nCycles <= ZetTotalCycles()) { + return; + } + + nCycles68KSync = nCycles - nExtraCycles; + + BurnTimerUpdateYM3812(nCycles); +} + +// Callbacks for the FM chip + +static void snowbrosFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 snowbrosSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 6000000; +} + +static INT32 HoneydolSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static void Snowbro3PlayMusic(INT32 data) +{ + Snowbro3Music = data; + + bprintf(PRINT_NORMAL, _T("%x\n"), data); + + switch (data) { + case 0x23: { + memcpy(MSM6295ROM + 0x20000, MSM6295ROM + 0x80000, 0x20000); + Snowbro3MusicPlaying = 1; + break; + } + + case 0x24: { + memcpy(MSM6295ROM + 0x20000, MSM6295ROM + 0xa0000, 0x20000); + Snowbro3MusicPlaying = 1; + break; + } + + case 0x25: { + memcpy(MSM6295ROM + 0x20000, MSM6295ROM + 0xc0000, 0x20000); + Snowbro3MusicPlaying = 1; + break; + } + + case 0x26: { + memcpy(MSM6295ROM + 0x20000, MSM6295ROM + 0x80000, 0x20000); + Snowbro3MusicPlaying = 1; + break; + } + + case 0x27: + case 0x28: + case 0x29: + case 0x2a: + case 0x2b: + case 0x2c: + case 0x2d: { + memcpy(MSM6295ROM + 0x20000, MSM6295ROM + 0xc0000, 0x20000); + Snowbro3MusicPlaying = 1; + break; + } + + case 0x2e: { + Snowbro3MusicPlaying = 0; + break; + } + } +} + +static void Snowbro3PlaySound(INT32 data) +{ + INT32 Status = MSM6295ReadStatus(0); + + if ((Status & 0x01) == 0x00) { + MSM6295Command(0, 0x80 | data); + MSM6295Command(0, 0x12); + } else { + if ((Status & 0x02) == 0x00) { + MSM6295Command(0, 0x80 | data); + MSM6295Command(0, 0x12); + } else { + if ((Status & 0x04) == 0x00) { + MSM6295Command(0, 0x80 | data); + MSM6295Command(0, 0x42); + } + } + } +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall HyperpacReadByte(UINT32 a) +{ + switch (a) { + case 0x200000: { + if (Threein1semi) return 0x0a; + } + + case 0x200001: { + if (Moremore || Threein1semi) return 0x0a; + } + + case 0x500000: { + return HyperpacInput[0]; + } + + case 0x500001: { + return HyperpacDip[0]; + } + + case 0x500002: { + return HyperpacInput[1]; + } + + case 0x500003: { + return HyperpacDip[1]; + } + + case 0x500004: { + return HyperpacInput[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall HyperpacReadByteLow(UINT32 a) +{ + switch (a) { + case 0x200001: { + if (Fourin1boot) return 0x02; + } + + case 0x500000: { + return 0x7f - HyperpacInput[0]; + } + + case 0x500001: { + return HyperpacDip[0]; + } + + case 0x500002: { + return 0x7f - HyperpacInput[1]; + } + + case 0x500003: { + return HyperpacDip[1]; + } + + case 0x500004: { + return 0xff - HyperpacInput[2]; + } + + case 0x500005: { + return 0xff - HyperpacInput[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); + } + } + + return 0xff; +} + +void __fastcall HyperpacWriteByte(UINT32 a, UINT8 d) +{ + if (a < 0x100000) return; + + switch (a) { + case 0x300001: { + HyperpacSoundLatch = d & 0xff; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); + } + } +} + +void __fastcall TwinadvWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x200000: + case 0x200001: { + return; + } + + case 0x300001: { + HyperpacSoundLatch = d & 0xff; + ZetNmi(); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall HyperpacReadWord(UINT32 a) +{ + switch (a) { + case 0x200000: { + if (Cookbib3) return 0x2a2a; + } + + default: { + bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); + } + } + + return 0; +} + +UINT16 __fastcall HyperpacReadWordLow(UINT32 a) +{ + switch (a) { + case 0x500000: + case 0x500002: + case 0x500004: { + SEK_DEF_READ_WORD(0, a); + } + + default: { + bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); + } + + } + + return 0xffff; +} + +void __fastcall HyperpacWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x00b7d6: + case 0x00b7d8: { + if (Finalttr) return; + } + + case 0x200000: { + if (Fourin1boot) return; // Watchdog in original Snow Bros. + } + + case 0x300000: { + SEK_DEF_WRITE_WORD(0, a, d); + return; + } + + case 0x400000: { + return; + } + + case 0x800000: + case 0x900000: + case 0xa00000: { + // IRQ ACK + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall HoneydolReadByte(UINT32 a) +{ + switch (a) { + case 0x900000: { + return 0x7f - HyperpacInput[0]; + } + + case 0x900001: { + return HyperpacDip[0]; + } + + case 0x900002: { + return 0x7f - HyperpacInput[1]; + } + + case 0x900003: { + return HyperpacDip[1]; + } + + case 0x900004: { + return 0xff - HyperpacInput[2]; + } + + case 0x900005: { + return 0xff; + } + } + + bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); + + return 0; +} + +UINT16 __fastcall HoneydolReadWord(UINT32 a) +{ + switch (a) { + case 0x900000: + case 0x900002: + case 0x900004: { + SEK_DEF_READ_WORD(0, a); + } + } + + bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); + + return 0; +} + +void __fastcall HoneydolWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x300000: { + return; + } + + case 0x300001: { + HyperpacSoundLatch = d; + snowbrosSynchroniseZ80(0); + ZetNmi(); + return; + } + } + + bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); +} + +void __fastcall HoneydolWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x200000: { + return; // Watchdog? + } + + case 0x300000: { + SEK_DEF_WRITE_WORD(0, a, d); + return; + } + + case 0x400000: + case 0x500000: + case 0x600000: { + // IRQ Ack + return; + } + + case 0x800000: { + // ? + return; + } + } + + bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); +} + +UINT8 __fastcall HyperpacZ80Read(UINT16 a) +{ + switch (a) { + case 0xf001: { + return BurnYM2151ReadStatus(); + } + + case 0xf008: { + if (Fourin1boot) { + if (HyperpacSoundLatch != 0xff) return HyperpacSoundLatch; + } else { + return HyperpacSoundLatch; + } + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); + } + } + + return 0; +} + +void __fastcall HyperpacZ80Write(UINT16 a, UINT8 d) +{ + d &= 0xff; + + switch (a) { + case 0xf000: { + BurnYM2151SelectRegister(d); + return; + } + + case 0xf001: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xf002: { + MSM6295Command(0, d); + return; + } + + default: { +// bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02x\n"), a, d); + } + } +} + +UINT8 __fastcall TwinadvZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x02: { + return HyperpacSoundLatch; + } + + case 0x06: { + return MSM6295ReadStatus(0); + } + } + + bprintf(PRINT_NORMAL, _T("Z80 Port Read -> %02X\n"), a); + + return 0; +} + +void __fastcall TwinadvZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x02: { + HyperpacSoundLatch = d; + return; + } + + case 0x04: { + INT32 bank = (d &0x02) >> 1; + memcpy(MSM6295ROM + 0x00000, MSM6295ROM + (0x40000 * bank), 0x40000); + return; + } + + case 0x06: { + MSM6295Command(0, d); + return; + } + } + + bprintf(PRINT_NORMAL, _T("Z80 Port Write -> %02X, %02x\n"), a, d); +} + +UINT8 __fastcall HoneydolZ80Read(UINT16 a) +{ + switch (a) { + case 0xe010: { + return MSM6295ReadStatus(0); + } + } + + bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); + + return 0; +} + +void __fastcall HoneydolZ80Write(UINT16 a, UINT8 d) +{ + d &= 0xff; + + switch (a) { + case 0xe010: { + MSM6295Command(0, d); + return; + } + } + + bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02x\n"), a, d); +} + +UINT16 __fastcall SnowbrosReadWord(UINT32 a) +{ + switch (a) { + case 0x300000: + case 0x500000: + case 0x500002: + case 0x500004: { + SEK_DEF_READ_WORD(0, a); + } + } + + return 0; +} + +UINT8 __fastcall SnowbrosReadByte(UINT32 a) +{ + switch (a) { + case 0x300001: { + snowbrosSynchroniseZ80(0x0100); + return HyperpacSoundLatch; + } + + case 0x500000: { + return 0x7f - HyperpacInput[0]; + } + + case 0x500001: { + return 0xff - HyperpacDip[0]; + } + + case 0x500002: { + return 0xff - HyperpacInput[1]; + } + + case 0x500003: { + return 0xff - HyperpacDip[1]; + } + + case 0x500004: { + return 0xff - HyperpacInput[2]; + } + } + + return 0; +} + +void __fastcall SnowbrosWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x300000: { + SEK_DEF_WRITE_WORD(0, a, d); + return; + } + } +} + +void __fastcall SnowbrosWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x300001: { + HyperpacSoundLatch = d; + snowbrosSynchroniseZ80(0); + ZetNmi(); + return; + } + } +} + +UINT16 __fastcall Snowbro3ReadWord(UINT32 a) +{ + switch (a) { + case 0x300000: { + return 3; + } + + case 0x500000: + case 0x500002: + case 0x500004: { + SEK_DEF_READ_WORD(0, a); + } + } + + bprintf(PRINT_NORMAL, _T("68000 Read Word %06X\n"), a); + + return 0; +} + +UINT8 __fastcall Snowbro3ReadByte(UINT32 a) +{ + switch (a) { +/* case 0x300001: { + snowbrosSynchroniseZ80(0x0100); + return HyperpacSoundLatch; + }*/ + + case 0x500000: { + return 0x7f - HyperpacInput[0]; + } + + case 0x500001: { + return 0xff - HyperpacDip[0]; + } + + case 0x500002: { + return 0xff - HyperpacInput[1]; + } + + case 0x500003: { + return 0xff - HyperpacDip[1]; + } + + case 0x500004: { + return 0xff - HyperpacInput[2]; + } + + case 0x500005: { + return 0xff; + } + } + + bprintf(PRINT_NORMAL, _T("68000 Read Byte %06X\n"), a); + + return 0; +} + +void __fastcall Snowbro3WriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x300000: { + if (d == 0xfe) { + Snowbro3MusicPlaying = 0; + MSM6295Command(0, 0x78); + } else { + d = d >> 8; + + if (d <= 0x21) Snowbro3PlaySound(d); + if (d >= 0x22 && d <= 0x31) Snowbro3PlayMusic(d); + if (d >= 0x30 && d <= 0x51) Snowbro3PlaySound(d - 0x30); + if (d >= 0x52 && d <= 0x5f) Snowbro3PlayMusic(d - 0x30); + } + return; + } + + case 0x200000: + case 0x800000: + case 0x900000: + case 0xa00000: { + return; + } + } + + bprintf(PRINT_NORMAL, _T("68000 Write Word %06X -> %04X\n"), a, d); +} + +void __fastcall Snowbro3WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x300000: { + if (d == 0xfe) { + Snowbro3MusicPlaying = 0; + MSM6295Command(0, 0x78); + } else { + //d = d >> 8; + + if (d <= 0x21) Snowbro3PlaySound(d); + if (d >= 0x22 && d <= 0x31) Snowbro3PlayMusic(d); + if (d >= 0x30 && d <= 0x51) Snowbro3PlaySound(d - 0x30); + if (d >= 0x52 && d <= 0x5f) Snowbro3PlayMusic(d - 0x30); + } + return; + } + } + + bprintf(PRINT_NORMAL, _T("68000 Write Byte %06X -> %02X\n"), a, d); +} + +UINT8 __fastcall SnowbrosZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x02: + return BurnYM3812Read(0); + case 0x04: { + if (ZetTotalCycles() > nCycles68KSync) { + BurnTimerUpdateEndYM3812(); + } + return HyperpacSoundLatch; + } + } + + return 0; +} + +void __fastcall SnowbrosZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x02: { + BurnYM3812Write(0, d); + return; + } + + case 0x03: { + BurnYM3812Write(1, d); + return; + } + + case 0x04: { + HyperpacSoundLatch = d; + return; + } + } +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + HyperpacRom = Next; Next += 0x100000; + HyperpacZ80Rom = Next; Next += 0x10000; + if (Twinadv) { + MSM6295ROM = Next; Next += 0x80000; + } else { + MSM6295ROM = Next; Next += 0x40000; + } + + RamStart = Next; + + HyperpacRam = Next; Next += 0x10000; + if (Honeydol) { + HyperpacPaletteRam = Next; Next += 0x00800; + } else { + HyperpacPaletteRam = Next; Next += 0x00200; + } + HyperpacSpriteRam = Next; Next += 0x02000; + HyperpacZ80Ram = Next; Next += 0x00800; + + RamEnd = Next; + + HyperpacSprites = Next; Next += (HyperpacNumTiles * 16 * 16); + HyperpacSprites8bpp = Next; Next += (HyperpacNumTiles8bpp * 16 * 16); + HyperpacProtData = Next; Next += 0x00200; + if (Honeydol) { + HyperpacPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + } else { + HyperpacPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); + } + MemEnd = Next; + + return 0; +} + + +static INT32 SnowbrosMemIndex() +{ + UINT8 *Next; Next = Mem; + + HyperpacRom = Next; Next += 0x40000; + HyperpacZ80Rom = Next; Next += (Wintbob) ? 0x10000 : 0x08000; + + RamStart = Next; + + HyperpacRam = Next; Next += 0x04000; + HyperpacPaletteRam = Next; Next += 0x00200; + HyperpacSpriteRam = Next; Next += 0x02000; + HyperpacZ80Ram = Next; Next += 0x00800; + + RamEnd = Next; + + HyperpacSprites = Next; Next += (HyperpacNumTiles * 16 * 16); + HyperpacPalette = (UINT32*)Next; Next += 0x00200 * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +static INT32 Snowbro3MemIndex() +{ + UINT8 *Next; Next = Mem; + + HyperpacRom = Next; Next += 0x40000; + MSM6295ROM = Next; Next += 0xe0000; + + RamStart = Next; + + HyperpacRam = Next; Next += 0x04000; + HyperpacPaletteRam = Next; Next += 0x00400; + HyperpacSpriteRam = Next; Next += 0x02200; + + RamEnd = Next; + + HyperpacSprites = Next; Next += (HyperpacNumTiles * 16 * 16); + HyperpacSprites8bpp = Next; Next += (HyperpacNumTiles8bpp * 16 * 16); + HyperpacPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +static INT32 HyperpacMachineInit() +{ + BurnSetRefreshRate(57.5); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(HyperpacRom , 0x000000, 0x0fffff, SM_ROM); + if (Finalttr) { + SekMapMemory(HyperpacRam , 0x100000, 0x103fff, SM_RAM); + } else { + SekMapMemory(HyperpacRam , 0x100000, 0x10ffff, SM_RAM); + } + SekMapMemory(HyperpacPaletteRam, 0x600000, 0x6001ff, SM_RAM); + SekMapMemory(HyperpacSpriteRam , 0x700000, 0x701fff, SM_RAM); + if (Fourin1boot || Finalttr) { + SekSetReadByteHandler(0, HyperpacReadByteLow); + SekSetReadWordHandler(0, HyperpacReadWordLow); + } else { + SekSetReadByteHandler(0, HyperpacReadByte); + SekSetReadWordHandler(0, HyperpacReadWord); + } + SekSetWriteByteHandler(0, HyperpacWriteByte); + SekSetWriteWordHandler(0, HyperpacWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xcfff, 0, HyperpacZ80Rom); + ZetMapArea(0x0000, 0xcfff, 2, HyperpacZ80Rom); + ZetMapArea(0xd000, 0xd7ff, 0, HyperpacZ80Ram); + ZetMapArea(0xd000, 0xd7ff, 1, HyperpacZ80Ram); + ZetMapArea(0xd000, 0xd7ff, 2, HyperpacZ80Ram); + ZetSetReadHandler(HyperpacZ80Read); + ZetSetWriteHandler(HyperpacZ80Write); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(4000000); + BurnYM2151SetIrqHandler(&HyperpacYM2151IrqHandler); + BurnYM2151SetAllRoutes(0.10, BURN_SND_ROUTE_BOTH); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 999900 / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + HyperpacDoReset(); + + return 0; +} + +static INT32 HyperpacSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 HyperpacSpriteXOffsets[16] = { 4, 0, 260, 256, 20, 16, 276, 272, 12, 8, 268, 264, 28, 24, 284, 280 }; +static INT32 HyperpacSpriteYOffsets[16] = { 0, 64, 32, 96, 512, 576, 544, 608, 128, 192, 160, 224, 640, 704, 672, 736 }; +static INT32 SnowbrosSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 SnowbrosSpriteXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; +static INT32 SnowbrosSpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; +static INT32 WintbobSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 WintbobSpriteXOffsets[16] = { 12, 8, 4, 0, 28, 24, 20, 16, 44, 40, 36, 32, 60, 56, 52, 48 }; +static INT32 WintbobSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; +static INT32 Honeydol8BppPlaneOffsets[8] = { 0, 1, 2, 3, 0x800000, 0x800001, 0x800002, 0x800003 }; +static INT32 Honeydol8BppXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; +static INT32 Honeydol8BppYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; +static INT32 Snowbro38BppPlaneOffsets[8] = { 8, 9, 10, 11, 0, 1, 2, 3 }; +static INT32 Snowbro38BppXOffsets[16] = { 0, 4, 16, 20, 32, 36, 48, 52, 512, 516, 528, 532, 544, 548, 560, 564 }; +static INT32 Snowbro38BppYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472 }; + +static INT32 HyperpacInit() +{ + INT32 nRet = 0, nLen; + + HyperpacNumTiles = 6144; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x0c0000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 5, 1); if (nRet != 0) return 1; + + // Simulate RAM initialisation done by the protection MCU (not needed for bootleg) + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "hyperpac")) { + HyperpacRam[0xe000 + 0] = 0xf9; + HyperpacRam[0xe000 + 1] = 0x4e; + HyperpacRam[0xe002 + 0] = 0x00; + HyperpacRam[0xe002 + 1] = 0x00; + HyperpacRam[0xe004 + 0] = 0x2c; + HyperpacRam[0xe004 + 1] = 0x06; + HyperpacRam[0xe080 + 0] = 0xdc; + HyperpacRam[0xe080 + 1] = 0xfe; + HyperpacRam[0xe082 + 0] = 0x98; + HyperpacRam[0xe082 + 1] = 0xba; + HyperpacRam[0xe084 + 0] = 0x54; + HyperpacRam[0xe084 + 1] = 0x76; + HyperpacRam[0xe086 + 0] = 0x10; + HyperpacRam[0xe086 + 1] = 0x32; + } + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x00000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x40000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x80000, 4, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 6, 1); if (nRet != 0) return 1; + + nRet = HyperpacMachineInit(); if (nRet) return 1; + + return 0; +} + +static INT32 Cookbib2Init() +{ + INT32 nRet = 0, nLen; + + HyperpacNumTiles = 10240; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x140000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 5, 1); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x100000, 4, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 6, 1); if (nRet != 0) return 1; + + // Load Shared RAM data + nRet = BurnLoadRom(HyperpacProtData, 8, 1); if (nRet) return 1; + BurnByteswap(HyperpacProtData, 0x200); + + nRet = HyperpacMachineInit(); if (nRet) return 1; + + return 0; +} + +static INT32 Cookbib3Init() +{ + INT32 nRet = 0, nLen; + + HyperpacNumTiles = 16384; + + Cookbib3 = 1; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x200000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load and descramble Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 5, 1); if (nRet != 0) return 1; + UINT8 *pTemp = (UINT8*)BurnMalloc(0x10000); + memcpy(pTemp, HyperpacZ80Rom, 0x10000); + memcpy(HyperpacZ80Rom + 0xc000, pTemp + 0x0000, 0x4000); + memcpy(HyperpacZ80Rom + 0x8000, pTemp + 0x4000, 0x4000); + memcpy(HyperpacZ80Rom + 0x4000, pTemp + 0x8000, 0x4000); + memcpy(HyperpacZ80Rom + 0x0000, pTemp + 0xc000, 0x4000); + BurnFree(pTemp); + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x100000, 4, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 6, 1); if (nRet != 0) return 1; + + // Load Shared RAM data + nRet = BurnLoadRom(HyperpacProtData, 8, 1); if (nRet) return 1; + BurnByteswap(HyperpacProtData, 0x200); + + nRet = HyperpacMachineInit(); if (nRet) return 1; + + return 0; +} + +static INT32 MoremoreInit() +{ + INT32 nRet = 0, nLen; + + HyperpacNumTiles = 16384; + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "moremore") || !strcmp(BurnDrvGetTextA(DRV_NAME), "moremorp")) Moremore = 1; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "3in1semi")) Threein1semi = 1; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x200000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 6, 1); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x100000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x180000, 5, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 7, 1); if (nRet != 0) return 1; + + // Load Shared RAM data + nRet = BurnLoadRom(HyperpacProtData, 9, 1); if (nRet) return 1; + BurnByteswap(HyperpacProtData, 0x200); + + nRet = HyperpacMachineInit(); if (nRet) return 1; + + return 0; +} + +static INT32 TwinkleInit() +{ + INT32 nRet = 0, nLen; + + HyperpacNumTiles = 4096; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x080000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 3, 1); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 4, 1); if (nRet != 0) return 1; + + // Load Shared RAM data + nRet = BurnLoadRom(HyperpacProtData, 6, 1); if (nRet) return 1; + BurnByteswap(HyperpacProtData, 0x200); + + nRet = HyperpacMachineInit(); if (nRet) return 1; + + return 0; +} + +static INT32 PzlbreakInit() +{ + INT32 nRet = 0, nLen; + + HyperpacNumTiles = 8192; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x100000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 4, 1); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 3, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 5, 1); if (nRet != 0) return 1; + + // Load Shared RAM data + nRet = BurnLoadRom(HyperpacProtData, 7, 1); if (nRet) return 1; + BurnByteswap(HyperpacProtData, 0x200); + + nRet = HyperpacMachineInit(); if (nRet) return 1; + + return 0; +} + +static void Fourin1bootDescrambleRom() +{ + UINT8 *buffer; + UINT8 *src = HyperpacRom; + INT32 len = 0x100000; + + /* strange order */ + if ((buffer = (UINT8*)BurnMalloc(len))) + { + INT32 i; + for (i = 0;i < len; i++) + if (i&1) buffer[i] = BITSWAP08(src[i],6,7,5,4,3,2,1,0); + else buffer[i] = src[i]; + + memcpy(src,buffer,len); + BurnFree(buffer); + } + + src = HyperpacZ80Rom; + len = 0x10000; + + /* strange order */ + if ((buffer = (UINT8*)BurnMalloc(len))) + { + INT32 i; + for (i = 0;i < len; i++) { + buffer[i] = src[i ^ 0x4000]; + } + memcpy(src,buffer,len); + BurnFree(buffer); + } +} + +static INT32 Fourin1bootInit() +{ + INT32 nRet = 0, nLen; + + HyperpacNumTiles = 16384; + + Fourin1boot = 1; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x200000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load and Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 3, 1); if (nRet != 0) return 1; + + Fourin1bootDescrambleRom(); + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, SnowbrosSpritePlaneOffsets, SnowbrosSpriteXOffsets, SnowbrosSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 4, 1); if (nRet != 0) return 1; + + nRet = HyperpacMachineInit(); if (nRet) return 1; + + return 0; +} + +static INT32 FinalttrInit() +{ + INT32 nRet = 0, nLen; + + HyperpacNumTiles = 8192; + + Finalttr = 1; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x100000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 6, 1); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x040000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x0c0000, 5, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, HyperpacSpritePlaneOffsets, HyperpacSpriteXOffsets, HyperpacSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 7, 1); if (nRet != 0) return 1; + + // Load Shared RAM data + nRet = BurnLoadRom(HyperpacProtData, 9, 1); if (nRet) return 1; + BurnByteswap(HyperpacProtData, 0x200); + + nRet = HyperpacMachineInit(); if (nRet) return 1; + + BurnYM2151SetAllRoutes(0.08, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(0, 0.40, BURN_SND_ROUTE_BOTH); + + return 0; +} + +static INT32 TwinadvInit() +{ + INT32 nRet = 0, nLen; + + HyperpacNumTiles = 12288; + + Twinadv = 1; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x180000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 5, 1); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x100000, 4, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, SnowbrosSpritePlaneOffsets, SnowbrosSpriteXOffsets, SnowbrosSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + + // Load Sample Roms + nRet = BurnLoadRom(MSM6295ROM + 0x00000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROM + 0x40000, 7, 1); if (nRet != 0) return 1; + + BurnSetRefreshRate(57.5); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(HyperpacRom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(HyperpacRam , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(HyperpacPaletteRam, 0x600000, 0x6001ff, SM_RAM); + SekMapMemory(HyperpacSpriteRam , 0x700000, 0x701fff, SM_RAM); + SekSetReadByteHandler(0, HyperpacReadByteLow); + SekSetReadWordHandler(0, HyperpacReadWordLow); + SekSetWriteByteHandler(0, TwinadvWriteByte); + SekSetWriteWordHandler(0, HyperpacWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, HyperpacZ80Rom); + ZetMapArea(0x0000, 0x7fff, 2, HyperpacZ80Rom); + ZetMapArea(0x8000, 0x87ff, 0, HyperpacZ80Ram); + ZetMapArea(0x8000, 0x87ff, 1, HyperpacZ80Ram); + ZetMapArea(0x8000, 0x87ff, 2, HyperpacZ80Ram); + ZetSetInHandler(TwinadvZ80PortRead); + ZetSetOutHandler(TwinadvZ80PortWrite); + ZetClose(); + + // Setup the OKIM6295 emulation + MSM6295Init(0, (12000000/12) / 132, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + HyperpacDoReset(); + + return 0; +} + +static INT32 HoneydolInit() +{ + INT32 nRet = 0, nLen; + + HyperpacNumTiles = 4096; + HyperpacNumTiles8bpp = 8192; + + Honeydol = 1; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x200000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 7, 1); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 2, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, SnowbrosSpritePlaneOffsets, SnowbrosSpriteXOffsets, SnowbrosSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + + // Load and Decode 8bpp Sprite Roms + memset(HyperpacTempGfx, 0, 0x200000); + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x080000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x100000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x180000, 6, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles8bpp, 8, 16, 16, Honeydol8BppPlaneOffsets, Honeydol8BppXOffsets, Honeydol8BppYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites8bpp); + BurnFree(HyperpacTempGfx); + + // Load Sample Roms + nRet = BurnLoadRom(MSM6295ROM + 0x00000, 8, 1); if (nRet != 0) return 1; + + BurnSetRefreshRate(57.5); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(HyperpacRom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(HyperpacRam , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(HyperpacPaletteRam, 0xa00000, 0xa007ff, SM_RAM); + SekMapMemory(HyperpacSpriteRam , 0xb00000, 0xb01fff, SM_RAM); + SekSetReadByteHandler(0, HoneydolReadByte); + SekSetReadWordHandler(0, HoneydolReadWord); + SekSetWriteByteHandler(0, HoneydolWriteByte); + SekSetWriteWordHandler(0, HoneydolWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, HyperpacZ80Rom); + ZetMapArea(0x0000, 0x7fff, 2, HyperpacZ80Rom); + ZetMapArea(0x8000, 0x87ff, 0, HyperpacZ80Ram); + ZetMapArea(0x8000, 0x87ff, 1, HyperpacZ80Ram); + ZetMapArea(0x8000, 0x87ff, 2, HyperpacZ80Ram); + ZetSetInHandler(SnowbrosZ80PortRead); + ZetSetOutHandler(SnowbrosZ80PortWrite); + ZetSetReadHandler(HoneydolZ80Read); + ZetSetWriteHandler(HoneydolZ80Write); + ZetClose(); + + BurnYM3812Init(3000000, &snowbrosFMIRQHandler, &HoneydolSynchroniseStream, 0); + BurnTimerAttachZetYM3812(4000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 999900 / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + HyperpacDoReset(); + + return 0; +} + +static INT32 SnowbrosInit() +{ + INT32 nRet = 0, nLen; + + BurnSetRefreshRate(57.5); + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "wintbob")) Wintbob = 1; + + HyperpacNumTiles = 4096; + + // Allocate and Blank all required memory + Mem = NULL; + SnowbrosMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + SnowbrosMemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x80000); + + if (Wintbob) { + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x20001, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x20000, 3, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 12, 1); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x00000, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x00001, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x20000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x20001, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x40000, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x40001, 9, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x60000, 10, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x60001, 11, 2); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, WintbobSpritePlaneOffsets, WintbobSpriteXOffsets, WintbobSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + } else { + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Rom + nRet = BurnLoadRom(HyperpacZ80Rom, 3, 1); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x00000, 2, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, SnowbrosSpritePlaneOffsets, SnowbrosSpriteXOffsets, SnowbrosSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + BurnFree(HyperpacTempGfx); + } + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(HyperpacRom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(HyperpacRam , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(HyperpacPaletteRam, 0x600000, 0x6001ff, SM_RAM); + SekMapMemory(HyperpacSpriteRam , 0x700000, 0x701fff, SM_RAM); + SekSetReadWordHandler(0, SnowbrosReadWord); + SekSetWriteWordHandler(0, SnowbrosWriteWord); + SekSetReadByteHandler(0, SnowbrosReadByte); + SekSetWriteByteHandler(0, SnowbrosWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, HyperpacZ80Rom); + ZetMapArea(0x0000, 0x7fff, 2, HyperpacZ80Rom); + ZetMapArea(0x8000, 0x87ff, 0, HyperpacZ80Ram); + ZetMapArea(0x8000, 0x87ff, 1, HyperpacZ80Ram); + ZetMapArea(0x8000, 0x87ff, 2, HyperpacZ80Ram); + ZetSetInHandler(SnowbrosZ80PortRead); + ZetSetOutHandler(SnowbrosZ80PortWrite); + ZetClose(); + + BurnYM3812Init(3000000, &snowbrosFMIRQHandler, &snowbrosSynchroniseStream, 0); + BurnTimerAttachZetYM3812(6000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + SnowbrosDoReset(); + + return 0; +} + +static INT32 Snowbro3Init() +{ + INT32 nRet = 0, nLen; + + Snowbro3 = 1; + + HyperpacNumTiles = 0x1000; + HyperpacNumTiles8bpp = 0x4000; + + // Allocate and Blank all required memory + Mem = NULL; + Snowbro3MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + Snowbro3MemIndex(); + + HyperpacTempGfx = (UINT8*)BurnMalloc(0x400000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(HyperpacRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Decode 68000 Program Rom + UINT8 *buffer; + buffer = (UINT8*)BurnMalloc(0x40000); + for (INT32 i = 0; i < 0x40000; i++) { + buffer[i] = HyperpacRom[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,3,4,1,2,0)]; + } + memcpy(HyperpacRom, buffer, 0x40000); + BurnFree(buffer); + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(HyperpacTempGfx + 0x00000, 2, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles, 4, 16, 16, SnowbrosSpritePlaneOffsets, SnowbrosSpriteXOffsets, SnowbrosSpriteYOffsets, 0x400, HyperpacTempGfx, HyperpacSprites); + + // Load and Decode 8bpp Sprite Roms + memset(HyperpacTempGfx, 0, 0x400000); + nRet = BurnLoadRom(HyperpacTempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(HyperpacTempGfx + 0x200000, 4, 1); if (nRet != 0) return 1; + GfxDecode(HyperpacNumTiles8bpp, 8, 16, 16, Snowbro38BppPlaneOffsets, Snowbro38BppXOffsets, Snowbro38BppYOffsets, 0x800, HyperpacTempGfx, HyperpacSprites8bpp); + + // Load Sample Roms + memset(HyperpacTempGfx, 0, 0x400000); + nRet = BurnLoadRom(HyperpacTempGfx, 5, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROM + 0x00000, HyperpacTempGfx + 0x00000, 0x20000); + memcpy(MSM6295ROM + 0x80000, HyperpacTempGfx + 0x20000, 0x60000); + BurnFree(HyperpacTempGfx); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(HyperpacRom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(HyperpacRam , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(HyperpacPaletteRam, 0x600000, 0x6003ff, SM_RAM); + SekMapMemory(HyperpacSpriteRam , 0x700000, 0x7021ff, SM_RAM); + SekSetReadWordHandler(0, Snowbro3ReadWord); + SekSetWriteWordHandler(0, Snowbro3WriteWord); + SekSetReadByteHandler(0, Snowbro3ReadByte); + SekSetWriteByteHandler(0, Snowbro3WriteByte); + SekClose(); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 999900 / 132, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + Snowbro3DoReset(); + + return 0; +} + +static INT32 HyperpacExit() +{ + MSM6295Exit(0); + + SekExit(); + ZetExit(); + + GenericTilesExit(); + + if (!Twinadv && !Honeydol) BurnYM2151Exit(); + if (Honeydol) BurnYM3812Exit(); + + BurnFree(Mem); + + HyperpacNumTiles = 0; + HyperpacNumTiles8bpp = 0; + + Moremore = 0; + Threein1semi = 0; + Cookbib3 = 0; + Fourin1boot = 0; + Finalttr = 0; + Twinadv = 0; + Honeydol = 0; + Snowbro3 = 0; + + return 0; +} + +static INT32 SnowbrosExit() +{ + if (!Snowbro3) BurnYM3812Exit(); + if (Snowbro3) MSM6295Exit(0); + + SekExit(); + if (!Snowbro3) ZetExit(); + + GenericTilesExit(); + + BurnFree(Mem); + + HyperpacNumTiles = 0; + HyperpacNumTiles8bpp = 0; + Wintbob = 0; + + Snowbro3Music = 0; + Snowbro3MusicPlaying = 0; + Snowbro3 = 0; + + return 0; +} + +static void HyperpacRenderSpriteLayer() +{ + INT32 x = 0, y = 0, Offs; + + for (Offs = 0; Offs < 0x2000; Offs += 16) { + INT32 dx = ((HyperpacSpriteRam[Offs + 9] << 8) + HyperpacSpriteRam[Offs + 8]) & 0xff; + INT32 dy = ((HyperpacSpriteRam[Offs + 11] << 8) + HyperpacSpriteRam[Offs + 10]) & 0xff; + INT32 TileColour = (HyperpacSpriteRam[Offs + 7] << 8) + HyperpacSpriteRam[Offs + 6]; + INT32 Attr = (HyperpacSpriteRam[Offs + 15] << 8) + HyperpacSpriteRam[Offs + 14]; + INT32 Attr2 = (HyperpacSpriteRam[Offs + 13] << 8) + HyperpacSpriteRam[Offs + 12]; + INT32 FlipX = Attr & 0x80; + INT32 FlipY = (Attr & 0x40) << 1; + INT32 Tile = ((Attr & 0x3f) << 8) + (Attr2 & 0xff); + INT32 Colour = (TileColour & 0xf0) >> 4; + + if (TileColour & 1) dx = -1 - (dx ^ 0xff); + if (TileColour & 2) dy = -1 - (dy ^ 0xff); + if (TileColour & 4) { + x += dx; + y += dy; + } else { + x = dx; + y = dy; + } + + if (x > 511) x &= 0x1ff; + if (y > 511) y &= 0x1ff; + + if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } + } else { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } + } + } +} + +static void TwinadvRenderSpriteLayer() +{ + INT32 x = 0, y = 0, Offs; + + for (Offs = 0; Offs < 0x2000; Offs += 16) { + INT32 dx = ((HyperpacSpriteRam[Offs + 9] << 8) + HyperpacSpriteRam[Offs + 8]) & 0xff; + INT32 dy = ((HyperpacSpriteRam[Offs + 11] << 8) + HyperpacSpriteRam[Offs + 10]) & 0xff; + INT32 TileColour = (HyperpacSpriteRam[Offs + 7] << 8) + HyperpacSpriteRam[Offs + 6]; + INT32 Attr = (HyperpacSpriteRam[Offs + 15] << 8) + HyperpacSpriteRam[Offs + 14]; + INT32 Attr2 = (HyperpacSpriteRam[Offs + 13] << 8) + HyperpacSpriteRam[Offs + 12]; + INT32 FlipX = Attr & 0x80; + INT32 FlipY = (Attr & 0x40) << 1; + INT32 Tile = ((Attr & 0x3f) << 8) + (Attr2 & 0xff); + INT32 Colour = (TileColour & 0xf0) >> 4; + Colour ^= 0xf; + + x = dx; + y = dy; + + if (x > 511) x &= 0x1ff; + if (y > 511) y &= 0x1ff; + + if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } + } else { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } + } + } +} + +static void HoneydolRenderSpriteLayer() +{ + INT32 x = 0, y = 0, Offs; + + for (Offs = 0; Offs < 0x2000; Offs += 16) { + INT32 dx = (((HyperpacSpriteRam[Offs + 9] << 8) + HyperpacSpriteRam[Offs + 8]) >> 8) & 0xff; + INT32 dy = (((HyperpacSpriteRam[Offs + 11] << 8) + HyperpacSpriteRam[Offs + 10]) >> 8) & 0xff; + INT32 TileColour = (((HyperpacSpriteRam[Offs + 7] << 8) + HyperpacSpriteRam[Offs + 6]) >> 8) & 3; + INT32 Attr = ((HyperpacSpriteRam[Offs + 15] << 8) + HyperpacSpriteRam[Offs + 14]) >> 8; + INT32 Attr2 = (((HyperpacSpriteRam[Offs + 13] << 8) + HyperpacSpriteRam[Offs + 12]) >> 8) & 0xff; + INT32 FlipX = Attr & 0x80; + INT32 FlipY = (Attr & 0x40) << 1; + INT32 Tile = ((Attr & 0x3f) << 8) + (Attr2 & 0xff); + INT32 Colour = TileColour; + + x = dx; + y = dy; + + if (x > 511) x &= 0x1ff; + if (y > 511) y &= 0x1ff; + + if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); + + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); + } else { + Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); + } + } + } else { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 8, 0, 0, HyperpacSprites8bpp); + } + } + } + + + + + dx = ((HyperpacSpriteRam[Offs + 9] << 8) + HyperpacSpriteRam[Offs + 8]) & 0xff; + dy = ((HyperpacSpriteRam[Offs + 11] << 8) + HyperpacSpriteRam[Offs + 10]) & 0xff; + TileColour = (HyperpacSpriteRam[Offs + 7] << 8) + HyperpacSpriteRam[Offs + 6]; + Attr = (HyperpacSpriteRam[Offs + 15] << 8) + HyperpacSpriteRam[Offs + 14]; + Attr2 = (HyperpacSpriteRam[Offs + 13] << 8) + HyperpacSpriteRam[Offs + 12]; + FlipX = Attr & 0x80; + FlipY = (Attr & 0x40) << 1; + Tile = ((Attr & 0x3f) << 8) + (Attr2 & 0xff); + Colour = (TileColour & 0x3f0) >> 4; + Colour ^= 0x3f; + + x = dx; + y = dy; + + if (x > 511) x &= 0x1ff; + if (y > 511) y &= 0x1ff; + + if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } + } else { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } + } + } +} + +static void SnowbrosRenderSpriteLayer() +{ + INT32 x = 0, y = 0, Offs; + + for (Offs = 0; Offs < 0x2000; Offs += 16) { + INT32 dx = ((HyperpacSpriteRam[Offs + 9] << 8) + HyperpacSpriteRam[Offs + 8]) & 0xff; + INT32 dy = ((HyperpacSpriteRam[Offs + 11] << 8) + HyperpacSpriteRam[Offs + 10]) & 0xff; + INT32 TileColour = (HyperpacSpriteRam[Offs + 7] << 8) + HyperpacSpriteRam[Offs + 6]; + INT32 Attr = (HyperpacSpriteRam[Offs + 15] << 8) + HyperpacSpriteRam[Offs + 14]; + INT32 Attr2 = (HyperpacSpriteRam[Offs + 13] << 8) + HyperpacSpriteRam[Offs + 12]; + INT32 FlipX = Attr & 0x80; + INT32 FlipY = (Attr & 0x40) << 1; + INT32 Tile = ((Attr & 0x1f) << 8) + (Attr2 & 0xff); + INT32 Colour = (TileColour & 0xf0) >> 4; + + if (TileColour & 1) dx = -1 - (dx ^ 0xff); + if (TileColour & 2) dy = -1 - (dy ^ 0xff); + if (TileColour & 4) { + x += dx; + y += dy; + } else { + x = dx; + y = dy; + } + + if (x > 511) x &= 0x1ff; + if (y > 511) y &= 0x1ff; + + if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } + } else { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } + } + } +} + +static void WintbobRenderSpriteLayer() +{ + INT32 x = 0, y = 0, Offs; + + UINT16 *SpriteRam = (UINT16*)HyperpacSpriteRam; + + for (Offs = 0; Offs < 0x2000 >> 1; Offs += 8) { + x = SpriteRam[Offs + 0] & 0xff; + y = SpriteRam[Offs + 4] & 0xff; + INT32 Attr = SpriteRam[Offs + 1]; + INT32 Disbl = Attr & 0x02; + INT32 Wrapr = Attr & 0x08; + INT32 Colour = (Attr & 0xf0) >> 4; + INT32 Attr2 = SpriteRam[Offs + 2]; + INT32 Tile = (Attr2 << 8) | (SpriteRam[Offs + 3] & 0xff); + INT32 FlipX = Attr2 & 0x80; + INT32 FlipY = (Attr2 & 0x40) << 1; + + if (Wrapr == 8) x -= 256; + + Tile &= 0xfff; + + if (Disbl == 2) continue; + + if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } + } else { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, 4, 0, 0, HyperpacSprites); + } + } + } + } +} + +static void Snowbro3RenderSpriteLayer() +{ + INT32 x = 0, y = 0, Offs; + + UINT16 *SpriteRam = (UINT16*)HyperpacSpriteRam; + UINT8 *pTile = NULL; + INT32 ColourDepth = 0; + + for (Offs = 0; Offs < 0x2200 >> 1; Offs += 8) { + INT32 dx = SpriteRam[Offs + 4] & 0xff; + INT32 dy = SpriteRam[Offs + 5] & 0xff; + INT32 TileColour = SpriteRam[Offs + 3]; + INT32 Attr = SpriteRam[Offs + 7]; + INT32 Attr2 = SpriteRam[Offs + 6]; + INT32 FlipX = Attr & 0x80; + INT32 FlipY = (Attr & 0x40) << 1; + INT32 Tile = ((Attr & 0xff) << 8) + (Attr2 & 0xff); + + if (TileColour & 1) dx = -1 - (dx ^ 0xff); + if (TileColour & 2) dy = -1 - (dy ^ 0xff); + if (TileColour & 4) { + x += dx; + y += dy; + } else { + x = dx; + y = dy; + } + + if (x > 511) x &= 0x1ff; + if (y > 511) y &= 0x1ff; + + if (Offs < 0x800) { + TileColour = 0x10; + Tile &= 0x3fff; + ColourDepth = 8; + pTile = HyperpacSprites8bpp; + } else { + Tile &= 0xfff; + ColourDepth = 4; + pTile = HyperpacSprites; + } + + INT32 Colour = (TileColour & 0xf0) >> 4; + + if (x > 15 && x < 240 && (y - 16) > 15 && (y - 16) <= 208) { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); + + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); + } else { + Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); + } + } + } else { + if (!FlipY) { + if (!FlipX) { + Render16x16Tile_Mask_Clip(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); + } + } else { + if (!FlipX) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); + } else { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, x, y - 16, Colour, ColourDepth, 0, 0, pTile); + } + } + } + } +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour >> 0) & 0x1f; + g = (nColour >> 5) & 0x1f; + b = (nColour >> 10) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + return BurnHighCol(r, g, b, 0); +} + +static INT32 HyperpacCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)HyperpacPaletteRam, pd = HyperpacPalette; i < 0x200; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } + + return 0; +} + +static INT32 HoneydolCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)HyperpacPaletteRam, pd = HyperpacPalette; i < 0x800; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } + + return 0; +} + +static INT32 Snowbro3CalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)HyperpacPaletteRam, pd = HyperpacPalette; i < 0x400; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } + + return 0; +} + +static void HyperpacRender() +{ + HyperpacCalcPalette(); + + for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { + pTransDraw[i] = 0xf0; + } + + HyperpacRenderSpriteLayer(); + BurnTransferCopy(HyperpacPalette); +} + +static void PzlbreakRender() +{ + HyperpacCalcPalette(); + + for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { + pTransDraw[i] = 0xc0; + } + + HyperpacRenderSpriteLayer(); + BurnTransferCopy(HyperpacPalette); +} + +static void TwinadvRender() +{ + HyperpacCalcPalette(); + + for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { + pTransDraw[i] = 0xf0; + } + + TwinadvRenderSpriteLayer(); + BurnTransferCopy(HyperpacPalette); +} + +static void HoneydolRender() +{ + HoneydolCalcPalette(); + + for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { + pTransDraw[i] = 0xf0; + } + + HoneydolRenderSpriteLayer(); + BurnTransferCopy(HyperpacPalette); +} + +static void SnowbrosRender() +{ + HyperpacCalcPalette(); + + for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { + pTransDraw[i] = 0xf0; + } + + if (Wintbob) { + WintbobRenderSpriteLayer(); + } else { + SnowbrosRenderSpriteLayer(); + } + BurnTransferCopy(HyperpacPalette); +} + +static void Snowbro3Render() +{ + Snowbro3CalcPalette(); + + for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { + pTransDraw[i] = 0xf0; + + } + + Snowbro3RenderSpriteLayer(); + BurnTransferCopy(HyperpacPalette); +} + +static INT32 HyperpacFrame() +{ + INT32 nInterleave = 4; + + if (HyperpacReset) HyperpacDoReset(); + + HyperpacMakeInputs(); + + nCyclesTotal[0] = 16000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + // Run Z80 + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + + if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + } + + SekClose(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + + if (pBurnDraw) HyperpacRender(); + + return 0; +} + +static INT32 PzlbreakFrame() +{ + INT32 nInterleave = 4; + + if (HyperpacReset) HyperpacDoReset(); + + HyperpacMakeInputs(); + + nCyclesTotal[0] = 16000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + // Run Z80 + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + + if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + } + + SekClose(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + + if (pBurnDraw) PzlbreakRender(); + + return 0; +} + +static INT32 FinalttrFrame() +{ + INT32 nInterleave = 4; + + if (HyperpacReset) HyperpacDoReset(); + + HyperpacMakeInputs(); + + nCyclesTotal[0] = 12000000 / 60; + nCyclesTotal[1] = 3578545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + // Run Z80 + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + + if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + } + + SekClose(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + + if (pBurnDraw) HyperpacRender(); + + return 0; +} + +static INT32 TwinadvFrame() +{ + INT32 nInterleave = 4; + + if (HyperpacReset) HyperpacDoReset(); + + HyperpacMakeInputs(); + + nCyclesTotal[0] = 16000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + // Run Z80 + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 2) ZetRaiseIrq(0); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + + if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + } + + SekClose(); + ZetClose(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) TwinadvRender(); + + return 0; +} + +static INT32 HoneydolFrame() +{ + INT32 nInterleave = 4; + + if (HyperpacReset) HyperpacDoReset(); + + HyperpacMakeInputs(); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + nCyclesTotal[0] = 16000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - SekTotalCycles(); + SekRun(nCyclesSegment); + + if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + } + + nCycles68KSync = SekTotalCycles(); + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; + +// bprintf(PRINT_NORMAL, _T("%i\ %i\n"), nCyclesDone[0], nCyclesDone[1]); + + ZetClose(); + SekClose(); + + if (pBurnDraw) HoneydolRender(); + + return 0; +} + +static INT32 SnowbrosFrame() +{ + INT32 nInterleave = 4; + + if (HyperpacReset) SnowbrosDoReset(); + + HyperpacMakeInputs(); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + nCyclesTotal[0] = (Wintbob) ? 12000000 / 60 : 8000000 / 60; + nCyclesTotal[1] = 6000000 / 60; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - SekTotalCycles(); + SekRun(nCyclesSegment); + + if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + } + + nCycles68KSync = SekTotalCycles(); + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; + +// bprintf(PRINT_NORMAL, _T("%i\ %i\n"), nCyclesDone[0], nCyclesDone[1]); + + ZetClose(); + SekClose(); + + if (pBurnDraw) SnowbrosRender(); + + return 0; +} + +static INT32 Snowbro3Frame() +{ + INT32 nInterleave = 4; + + if (HyperpacReset) Snowbro3DoReset(); + + HyperpacMakeInputs(); + + SekOpen(0); + + SekNewFrame(); + + SekIdle(nCyclesDone[0]); + + nCyclesTotal[0] = 16000000 / 60; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - SekTotalCycles(); + SekRun(nCyclesSegment); + + if (i == 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + if (i == 2) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + if (i == 3) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + + INT32 Status = MSM6295ReadStatus(0); + if (Snowbro3MusicPlaying) { + if ((Status & 0x08) == 0x00) { + MSM6295Command(0, 0x80 | Snowbro3Music); + MSM6295Command(0, 0x82); + } + } else { + if ((Status & 0x08) == 0x00) { + MSM6295Command(0, 0x40); + } + } + } + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + + SekClose(); + + if (pBurnSoundOut) MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + + if (pBurnDraw) Snowbro3Render(); + + return 0; +} + +static INT32 HyperpacScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x02944; + } + + if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); // Scan 68000 + ZetScan(nAction); // Scan Z80 + + MSM6295Scan(0, nAction); // Scan OKIM6295 + BurnYM2151Scan(nAction); + + // Scan critical driver variables + SCAN_VAR(HyperpacSoundLatch); + SCAN_VAR(HyperpacInput); + SCAN_VAR(HyperpacDip); + } + + return 0; +} + +static INT32 SnowbrosScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029519; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); // Scan 68000 + ZetScan(nAction); // Scan Z80 + + SCAN_VAR(nCyclesDone); + + BurnYM3812Scan(nAction, pnMin); + + // Scan critical driver variables + SCAN_VAR(HyperpacSoundLatch); + SCAN_VAR(HyperpacInput); + SCAN_VAR(HyperpacDip); + } + + return 0; +} + +static INT32 Snowbro3Scan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029672; + } + + if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); // Scan 68000 + + MSM6295Scan(0, nAction); // Scan OKIM6295 + + // Scan critical driver variables + SCAN_VAR(HyperpacSoundLatch); + SCAN_VAR(HyperpacInput); + SCAN_VAR(HyperpacDip); + SCAN_VAR(Snowbro3Music); + SCAN_VAR(Snowbro3MusicPlaying); + } + + return 0; +} + +struct BurnDriver BurnDrvHyperpac = { + "hyperpac", NULL, NULL, NULL, "1995", + "Hyper Pacman\0", NULL, "SemiCom", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, + NULL, HyperpacRomInfo, HyperpacRomName, NULL, NULL, HyperpacInputInfo, HyperpacDIPInfo, + HyperpacInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvHyperpacb = { + "hyperpacb", "hyperpac", NULL, NULL, "1995", + "Hyper Pacman (bootleg)\0", NULL, "SemiCom", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, + NULL, HyperpacbRomInfo, HyperpacbRomName, NULL, NULL, HyperpacInputInfo, HyperpacDIPInfo, + HyperpacInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvCookbib2 = { + "cookbib2", NULL, NULL, NULL, "1996", + "Cookie & Bibi 2\0", NULL, "SemiCom", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, Cookbib2RomInfo, Cookbib2RomName, NULL, NULL, HyperpacInputInfo, Cookbib2DIPInfo, + Cookbib2Init, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvCookbib3 = { + "cookbib3", NULL, NULL, NULL, "1997", + "Cookie & Bibi 3\0", NULL, "SemiCom", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, Cookbib3RomInfo, Cookbib3RomName, NULL, NULL, HyperpacInputInfo, Cookbib3DIPInfo, + Cookbib3Init, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMoremore = { + "moremore", NULL, NULL, NULL, "1999", + "More More\0", NULL, "SemiCom / Exit", "Kaneko Pandora based", + L"More More\0\uBAA8\uC544\uBAA8\uC544 More More\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, MoremoreRomInfo, MoremoreRomName, NULL, NULL, HyperpacInputInfo, MoremoreDIPInfo, + MoremoreInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMoremorp = { + "moremorp", NULL, NULL, NULL, "1999", + "More More Plus\0", NULL, "SemiCom / Exit", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, MoremorpRomInfo, MoremorpRomName, NULL, NULL, HyperpacInputInfo, MoremoreDIPInfo, + MoremoreInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvThreein1semi = { + "3in1semi", NULL, NULL, NULL, "1997", + "XESS - The New Revolution (SemiCom 3-in-1)\0", NULL, "SemiCom", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, Threein1semiRomInfo, Threein1semiRomName, NULL, NULL, HyperpacInputInfo, MoremoreDIPInfo, + MoremoreInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvToppyrap = { + "toppyrap", NULL, NULL, NULL, "1996", + "Toppy & Rappy\0", NULL, "SemiCom", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, ToppyrapRomInfo, ToppyrapRomName, NULL, NULL, HyperpacInputInfo, ToppyrapDIPInfo, + MoremoreInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTwinkle = { + "twinkle", NULL, NULL, NULL, "1997", + "Twinkle\0", NULL, "SemiCom", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, + NULL, TwinkleRomInfo, TwinkleRomName, NULL, NULL, HyperpacInputInfo, MoremoreDIPInfo, + TwinkleInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPzlbreak = { + "pzlbreak", NULL, NULL, NULL, "1997", + "Puzzle Break\0", NULL, "SemiCom", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, + NULL, PzlbreakRomInfo, PzlbreakRomName, NULL, NULL, HyperpacInputInfo, MoremoreDIPInfo, + PzlbreakInit, HyperpacExit, PzlbreakFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFourin1boot = { + "4in1boot", NULL, NULL, NULL, "2002", + "Puzzle King\0", NULL, "K1 Soft", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, Fourin1bootRomInfo, Fourin1bootRomName, NULL, NULL, HyperpacInputInfo, Fourin1bootDIPInfo, + Fourin1bootInit, HyperpacExit, HyperpacFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFinalttr = { + "finalttr", NULL, NULL, NULL, "1993", + "Final Tetris\0", NULL, "Jeil Computer System", "Kaneko Pandora based", + L"Final Tetris\0\uD30C\uC774\uB110 \uD14C\uD2B8\uB9AC\uC2A4\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, FinalttrRomInfo, FinalttrRomName, NULL, NULL, HyperpacInputInfo, FinalttrDIPInfo, + FinalttrInit, HyperpacExit, FinalttrFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTwinadv = { + "twinadv", NULL, NULL, NULL, "1995", + "Twin Adventure (World)\0", NULL, "Barko Corp", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, TwinadvRomInfo, TwinadvRomName, NULL, NULL, HyperpacInputInfo, TwinadvDIPInfo, + TwinadvInit, HyperpacExit, TwinadvFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTwinadvk = { + "twinadvk", "twinadv", NULL, NULL, "1995", + "Twin Adventure (Korea)\0", NULL, "Barko Corp", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, TwinadvkRomInfo, TwinadvkRomName, NULL, NULL, HyperpacInputInfo, TwinadvDIPInfo, + TwinadvInit, HyperpacExit, TwinadvFrame, NULL, HyperpacScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvHoneydol = { + "honeydol", NULL, NULL, NULL, "1995", + "Honey Dolls\0", NULL, "Barko Corp", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, HoneydolRomInfo, HoneydolRomName, NULL, NULL, HyperpacInputInfo, HoneydolDIPInfo, + HoneydolInit, HyperpacExit, HoneydolFrame, NULL, HyperpacScan, + NULL, 0x800, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSnowbros = { + "snowbros", NULL, NULL, NULL, "1990", + "Snow Bros. - Nick & Tom (set 1)\0", NULL, "Toaplan", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, SnowbrosRomInfo, SnowbrosRomName, NULL, NULL, SnowbrosInputInfo, SnowbrosDIPInfo, + SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSnowbroa = { + "snowbrosa", "snowbros", NULL, NULL, "1990", + "Snow Bros. - Nick & Tom (set 2)\0", NULL, "Toaplan", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, SnowbroaRomInfo, SnowbroaRomName, NULL, NULL, SnowbrosInputInfo, SnowbrosDIPInfo, + SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSnowbrob = { + "snowbrosb", "snowbros", NULL, NULL, "1990", + "Snow Bros. - Nick & Tom (set 3)\0", NULL, "Toaplan", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, SnowbrobRomInfo, SnowbrobRomName, NULL, NULL, SnowbrosInputInfo, SnowbrosDIPInfo, + SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSnowbroc = { + "snowbrosc", "snowbros", NULL, NULL, "1990", + "Snow Bros. - Nick & Tom (set 4)\0", NULL, "Toaplan", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, SnowbrocRomInfo, SnowbrocRomName, NULL, NULL, SnowbrosInputInfo, SnowbrosDIPInfo, + SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSnowbroj = { + "snowbrosj", "snowbros", NULL, NULL, "1990", + "Snow Bros. - Nick & Tom (Japan)\0", NULL, "Toaplan", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, SnowbrojRomInfo, SnowbrojRomName, NULL, NULL, SnowbrosInputInfo, SnowbrojDIPInfo, + SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSnowbrod = { + "snowbrosd", "snowbros", NULL, NULL, "1990", + "Snow Bros. - Nick & Tom (Dooyong license)\0", NULL, "Toaplan (Dooyong license)", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, SnowbrodRomInfo, SnowbrodRomName, NULL, NULL, SnowbrosInputInfo, SnowbrojDIPInfo, + SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWintbob = { + "wintbob", "snowbros", NULL, NULL, "1990", + "The Winter Bobble (bootleg)\0", NULL, "bootleg", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, WintbobRomInfo, WintbobRomName, NULL, NULL, SnowbrosInputInfo, SnowbrosDIPInfo, + SnowbrosInit, SnowbrosExit, SnowbrosFrame, NULL, SnowbrosScan, + NULL, 0x200, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSnowbro3 = { + "snowbros3", "snowbros", NULL, NULL, "2002", + "Snow Brothers 3 - Magical Adventure\0", NULL, "bootleg", "Kaneko Pandora based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, Snowbro3RomInfo, Snowbro3RomName, NULL, NULL, SnowbrosInputInfo, SnowbrojDIPInfo, + Snowbro3Init, SnowbrosExit, Snowbro3Frame, NULL, Snowbro3Scan, + NULL, 0x400, 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_kaneko16.cpp b/src/burn/drv/pst90s/d_kaneko16.cpp index 7f20d9e85..ddfce0e3e 100644 --- a/src/burn/drv/pst90s/d_kaneko16.cpp +++ b/src/burn/drv/pst90s/d_kaneko16.cpp @@ -1,5037 +1,5036 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "msm6295.h" -#include "burn_ym2151.h" -#include "eeprom.h" -#include "kanekotb.h" - -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -/*============================================================================================== -Driver Variables -===============================================================================================*/ - -static UINT8 Kaneko16InputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 Kaneko16InputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 Kaneko16InputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 Kaneko16InputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 Kaneko16Dip[2] = {0, 0}; -static UINT8 Kaneko16Input[4] = {0x00, 0x00, 0x00, 0x00}; -static UINT8 Kaneko16Reset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Kaneko16Rom = NULL; -static UINT8 *Kaneko16Z80Rom = NULL; -static UINT8 *MSM6295ROMData = NULL; -static UINT8 *MSM6295ROMData2 = NULL; -static UINT8 *Kaneko16Ram = NULL; -static UINT8 *Kaneko16Z80Ram = NULL; -static UINT8 *Kaneko16MCURam = NULL; -static UINT8 *Kaneko16NVRam = NULL; -static UINT8 *Kaneko16PaletteRam = NULL; -static UINT8 *Kaneko16SpriteRam = NULL; -static UINT8 *Kaneko16Video0Ram = NULL; -static UINT8 *Kaneko16Video1Ram = NULL; -static UINT8 *Kaneko16Video2Ram = NULL; -static UINT8 *Kaneko16Video3Ram = NULL; -static UINT8 *Kaneko16VScrl0Ram = NULL; -static UINT8 *Kaneko16VScrl1Ram = NULL; -static UINT8 *Kaneko16VScrl2Ram = NULL; -static UINT8 *Kaneko16VScrl3Ram = NULL; -static UINT32 *Kaneko16Palette = NULL; -static UINT8 *Kaneko16Tiles = NULL; -static UINT8 *Kaneko16Tiles2 = NULL; -static UINT8 *Kaneko16Sprites = NULL; -static UINT8 *Kaneko16TempGfx = NULL; - -static INT16* pFMBuffer; -static INT16* pAY8910Buffer[6]; - -static UINT32 Kaneko16SoundLatch; -static INT32 MSM6295Bank0; -static INT32 MSM6295Bank1; - -static UINT16 ToyboxMCUCom[4]; - -static UINT16 Kaneko16Bg15Reg; -static UINT16 Kaneko16Bg15Select; -static UINT16 *Kaneko16Bg15Data = NULL; -static UINT8 Kaneko16RecalcBg15Palette; - -static UINT16 Kaneko16SpriteFlipX; -static UINT16 Kaneko16SpriteFlipY; -static UINT16 Kaneko16SpriteRegs[0x20]; -static UINT16 Kaneko16Layer0Regs[0x10]; -static UINT16 Kaneko16Layer1Regs[0x10]; -static UINT32 Kaneko16SpritesColourOffset; -static UINT32 Kaneko16LayersColourOffset; -static UINT32 Kaneko16SpritesColourMask; -static UINT16 Kaneko16DisplayEnable; -static INT32 Kaneko16TilesXOffset; -static INT32 Kaneko16TilesYOffset; -static INT32 Kaneko16SpriteXOffset; - -static UINT32 *LayerQueueXY[4]; -static UINT32 *LayerQueueColour[4]; -static UINT8 *LayerQueuePriority[4]; -static INT32 LayerQueueSize[4]; - -static INT32 Kaneko16NumTiles; -static INT32 Kaneko16NumTiles2; -static INT32 Kaneko16NumSprites; -static INT32 Kaneko16SpriteRamSize; - -// Flags -static INT32 Kaneko168BppSprites; -static INT32 Kaneko16Eeprom; -static INT32 Kaneko16Bg15; -static INT32 Gtmr; -static INT32 Bloodwar; -static INT32 Bonkadv; -static INT32 Mgcrystl; - -typedef void (*MCURun)(); -MCURun ToyboxMCURun; - -typedef void (*FrameRender)(); -FrameRender Kaneko16FrameRender; -static void BerlwallFrameRender(); -static void BlazeonFrameRender(); -static void BloodwarFrameRender(); -static void ExplbrkrFrameRender(); -static void GtmrFrameRender(); -static void MgcrystlFrameRender(); - -typedef INT32 (*ParseSprite)(INT32, struct tempsprite*); -ParseSprite Kaneko16ParseSprite; -static INT32 Kaneko16ParseSpriteType0(INT32 i, struct tempsprite *s); -static INT32 Kaneko16ParseSpriteType1(INT32 i, struct tempsprite *s); -static INT32 Kaneko16ParseSpriteType2(INT32 i, struct tempsprite *s); - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; -static INT32 nSoundBufferPos; - -struct tempsprite -{ - INT32 code,color; - INT32 x,y; - INT32 xoffs,yoffs; - INT32 flipx,flipy; - INT32 priority; -}; - -static struct -{ - struct tempsprite *first_sprite; -} spritelist; - -/*============================================================================================== -Input Definitions -===============================================================================================*/ - -static struct BurnInputInfo BerlwallInputList[] = { - {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , Kaneko16InputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , Kaneko16InputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, - {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, - {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 4, "diag" }, - {"Tilt" , BIT_DIGITAL , Kaneko16InputPort2 + 5, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, Kaneko16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Berlwall) - -static struct BurnInputInfo BlazeonInputList[] = { - {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort0 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , Kaneko16InputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort1 + 7, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , Kaneko16InputPort1 + 6, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, - {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 7, "service" }, - {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 5, "diag" }, - {"Tilt" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, Kaneko16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Blazeon) - -static struct BurnInputInfo BloodwarInputList[] = { - {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , Kaneko16InputPort0 + 6, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , Kaneko16InputPort0 + 7, "p1 fire 4" }, - - {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , Kaneko16InputPort1 + 6, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , Kaneko16InputPort3 + 2, "p2 fire 4" }, - - {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, - {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, - {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 4, "diag" }, - {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, -}; - -STDINPUTINFO(Bloodwar) - -static struct BurnInputInfo BonkadvInputList[] = { - {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, - {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, - {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 4, "diag" }, - {"Tilt" , BIT_DIGITAL , Kaneko16InputPort2 + 5, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, -}; - -STDINPUTINFO(Bonkadv) - -static struct BurnInputInfo ExplbrkrInputList[] = { - {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, - {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, - {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, -}; - -STDINPUTINFO(Explbrkr) - -static struct BurnInputInfo GtmrInputList[] = { - {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, - {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, - {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 4, "diag" }, - {"Tilt" , BIT_DIGITAL , Kaneko16InputPort2 + 5, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, -}; - -STDINPUTINFO(Gtmr) - -static struct BurnInputInfo MgcrystlInputList[] = { - {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, - {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, - {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 4, "diag" }, - {"Tilt" , BIT_DIGITAL , Kaneko16InputPort2 + 5, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, -}; - -STDINPUTINFO(Mgcrystl) - -inline void Kaneko16ClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -inline void Kaneko16MakeInputs() -{ - // Reset Inputs - Kaneko16Input[0] = Kaneko16Input[1] = Kaneko16Input[2] = Kaneko16Input[3] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - Kaneko16Input[0] |= (Kaneko16InputPort0[i] & 1) << i; - Kaneko16Input[1] |= (Kaneko16InputPort1[i] & 1) << i; - Kaneko16Input[2] |= (Kaneko16InputPort2[i] & 1) << i; - Kaneko16Input[3] |= (Kaneko16InputPort3[i] & 1) << i; - } - - // Clear Opposites - Kaneko16ClearOpposites(&Kaneko16Input[0]); - Kaneko16ClearOpposites(&Kaneko16Input[1]); -} - -/*============================================================================================== -Dip Switch Definitions -===============================================================================================*/ - -static struct BurnDIPInfo BerlwallDIPList[]= -{ - // Default Values - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Screen Direction" }, - {0x16, 0x01, 0x01, 0x01, "Normal" }, - {0x16, 0x01, 0x01, 0x00, "Reverse" }, - - {0 , 0xfe, 0 , 8 , "Coin Slot A" }, - {0x16, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, - {0x16, 0x01, 0x1c, 0x18, "1 Coins 2 Credits" }, - {0x16, 0x01, 0x1c, 0x14, "1 Coins 3 Credits" }, - {0x16, 0x01, 0x1c, 0x10, "1 Coins 4 Credits" }, - {0x16, 0x01, 0x1c, 0x0c, "2 Coins 1 Credit" }, - {0x16, 0x01, 0x1c, 0x08, "2 Coin 3 Credits" }, - {0x16, 0x01, 0x1c, 0x04, "3 Coins 1 Credit" }, - {0x16, 0x01, 0x1c, 0x00, "4 Coins 1 Credit" }, - - {0 , 0xfe, 0 , 8 , "Coin Slot B" }, - {0x16, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, - {0x16, 0x01, 0xe0, 0xc0, "1 Coins 2 Credits" }, - {0x16, 0x01, 0xe0, 0xa0, "1 Coins 3 Credits" }, - {0x16, 0x01, 0xe0, 0x80, "1 Coins 4 Credits" }, - {0x16, 0x01, 0xe0, 0x60, "2 Coins 1 Credit" }, - {0x16, 0x01, 0xe0, 0x40, "2 Coin 3 Credits" }, - {0x16, 0x01, 0xe0, 0x20, "1 Coin 5 Credits" }, - {0x16, 0x01, 0xe0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Game Level" }, - {0x17, 0x01, 0x03, 0x03, "Standard" }, - {0x17, 0x01, 0x03, 0x02, "Easy" }, - {0x17, 0x01, 0x03, 0x01, "Difficult" }, - {0x17, 0x01, 0x03, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 4 , "Number of Players" }, - {0x17, 0x01, 0x0c, 0x0c, "3" }, - {0x17, 0x01, 0x0c, 0x08, "2" }, - {0x17, 0x01, 0x0c, 0x04, "5" }, - {0x17, 0x01, 0x0c, 0x00, "7" }, - - {0 , 0xfe, 0 , 4 , "Language Type" }, - {0x17, 0x01, 0x30, 0x30, "English" }, - {0x17, 0x01, 0x30, 0x20, "Italy" }, - {0x17, 0x01, 0x30, 0x10, "Germany" }, - {0x17, 0x01, 0x30, 0x00, "Pause Mode" }, - - {0 , 0xfe, 0 , 2 , "Demonstration Sound" }, - {0x17, 0x01, 0x40, 0x00, "Off" }, - {0x17, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Testmode Switch" }, - {0x17, 0x01, 0x80, 0x80, "Normal Game" }, - {0x17, 0x01, 0x80, 0x00, "Testmode" }, -}; - -STDDIPINFO(Berlwall) - -static struct BurnDIPInfo BerlwalltDIPList[]= -{ - // Default Values - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Screen Direction" }, - {0x16, 0x01, 0x01, 0x01, "Normal" }, - {0x16, 0x01, 0x01, 0x00, "Reverse" }, - - {0 , 0xfe, 0 , 8 , "Coin Slot A" }, - {0x16, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, - {0x16, 0x01, 0x1c, 0x18, "1 Coins 2 Credits" }, - {0x16, 0x01, 0x1c, 0x14, "1 Coins 3 Credits" }, - {0x16, 0x01, 0x1c, 0x10, "1 Coins 4 Credits" }, - {0x16, 0x01, 0x1c, 0x0c, "2 Coins 1 Credit" }, - {0x16, 0x01, 0x1c, 0x08, "2 Coin 3 Credits" }, - {0x16, 0x01, 0x1c, 0x04, "3 Coins 1 Credit" }, - {0x16, 0x01, 0x1c, 0x00, "4 Coins 1 Credit" }, - - {0 , 0xfe, 0 , 8 , "Coin Slot B" }, - {0x16, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, - {0x16, 0x01, 0xe0, 0xc0, "1 Coins 2 Credits" }, - {0x16, 0x01, 0xe0, 0xa0, "1 Coins 3 Credits" }, - {0x16, 0x01, 0xe0, 0x80, "1 Coins 4 Credits" }, - {0x16, 0x01, 0xe0, 0x60, "2 Coins 1 Credit" }, - {0x16, 0x01, 0xe0, 0x40, "2 Coin 3 Credits" }, - {0x16, 0x01, 0xe0, 0x20, "1 Coin 5 Credits" }, - {0x16, 0x01, 0xe0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Game Level" }, - {0x17, 0x01, 0x03, 0x03, "Standard" }, - {0x17, 0x01, 0x03, 0x02, "Easy" }, - {0x17, 0x01, 0x03, 0x01, "Difficult" }, - {0x17, 0x01, 0x03, 0x00, "Very Difficult" }, - - {0 , 0xfe, 0 , 4 , "Number of Players" }, - {0x17, 0x01, 0x0c, 0x0c, "2" }, - {0x17, 0x01, 0x0c, 0x08, "3" }, - {0x17, 0x01, 0x0c, 0x04, "5" }, - {0x17, 0x01, 0x0c, 0x00, "1" }, - - {0 , 0xfe, 0 , 4 , "Language Type" }, - {0x17, 0x01, 0x30, 0x30, "English" }, - {0x17, 0x01, 0x30, 0x20, "Italy" }, - {0x17, 0x01, 0x30, 0x10, "Germany" }, - {0x17, 0x01, 0x30, 0x00, "Pause Mode" }, - - {0 , 0xfe, 0 , 2 , "Demonstration Sound" }, - {0x17, 0x01, 0x40, 0x00, "Off" }, - {0x17, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Testmode Switch" }, - {0x17, 0x01, 0x80, 0x80, "Normal Game" }, - {0x17, 0x01, 0x80, 0x00, "Testmode" }, -}; - -STDDIPINFO(Berlwallt) - -static struct BurnDIPInfo BlazeonDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x03, "Standard" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Strong" }, - - {0 , 0xfe, 0 , 4 , "Number of Players" }, - {0x14, 0x01, 0x0c, 0x00, "2" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Demonstration Sound" }, - {0x14, 0x01, 0x10, 0x00, "Off" }, - {0x14, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 16 , "Coin Rate Slot A" }, - {0x15, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, - {0x15, 0x01, 0x0f, 0x01, "2 Coin 3 Play" }, - {0x15, 0x01, 0x0f, 0x02, "4 Coin 5 Play" }, - {0x15, 0x01, 0x0f, 0x03, "5 Coin 6 Play" }, - {0x15, 0x01, 0x0f, 0x04, "4 Coin 3 Play" }, - {0x15, 0x01, 0x0f, 0x05, "6 Coin 3 Play" }, - {0x15, 0x01, 0x0f, 0x06, "2 Coin 3 Play" }, - {0x15, 0x01, 0x0f, 0x07, "4 Coin 1 Play" }, - {0x15, 0x01, 0x0f, 0x08, "3 Coin 1 Play" }, - {0x15, 0x01, 0x0f, 0x09, "2 Coin 1 Play" }, - {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Play" }, - {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Play" }, - {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Play" }, - {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Play" }, - {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Play" }, - {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, - - {0 , 0xfe, 0 , 16 , "Coin Rate Slot B" }, - {0x15, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, - {0x15, 0x01, 0xf0, 0x10, "2 Coin 3 Play" }, - {0x15, 0x01, 0xf0, 0x20, "4 Coin 5 Play" }, - {0x15, 0x01, 0xf0, 0x30, "5 Coin 6 Play" }, - {0x15, 0x01, 0xf0, 0x40, "4 Coin 3 Play" }, - {0x15, 0x01, 0xf0, 0x50, "6 Coin 3 Play" }, - {0x15, 0x01, 0xf0, 0x60, "2 Coin 3 Play" }, - {0x15, 0x01, 0xf0, 0x70, "4 Coin 1 Play" }, - {0x15, 0x01, 0xf0, 0x80, "3 Coin 1 Play" }, - {0x15, 0x01, 0xf0, 0x90, "2 Coin 1 Play" }, - {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Play" }, - {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Play" }, - {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Play" }, - {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Play" }, - {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Play" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, -}; - -STDDIPINFO(Blazeon) - -static struct BurnDIPInfo BloodwarDIPList[]= -{ - // Default Values - {0x17, 0xff, 0xff, 0x01, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x17, 0x01, 0x01, 0x00, "Off" }, - {0x17, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x17, 0x01, 0x02, 0x00, "Off" }, - {0x17, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Screen Flip" }, - {0x17, 0x01, 0x04, 0x00, "Normal" }, - {0x17, 0x01, 0x04, 0x04, "Reverse" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x17, 0x01, 0x38, 0x00, "1 Easy" }, - {0x17, 0x01, 0x38, 0x08, "2" }, - {0x17, 0x01, 0x38, 0x10, "3" }, - {0x17, 0x01, 0x38, 0x18, "4" }, - {0x17, 0x01, 0x38, 0x20, "5" }, - {0x17, 0x01, 0x38, 0x28, "6" }, - {0x17, 0x01, 0x38, 0x30, "7" }, - {0x17, 0x01, 0x38, 0x38, "8 Hard" }, - - {0 , 0xfe, 0 , 2 , "Join During Game" }, - {0x17, 0x01, 0x40, 0x40, "Impossible" }, - {0x17, 0x01, 0x40, 0x00, "Possible" }, - - {0 , 0xfe, 0 , 2 , "Continue Coin" }, - {0x17, 0x01, 0x80, 0x00, "Normal" }, - {0x17, 0x01, 0x80, 0x80, "Continue coin" }, -}; - -STDDIPINFO(Bloodwar) - -static struct BurnDIPInfo BonkadvDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0x10, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Screen Direction" }, - {0x14, 0x01, 0x01, 0x00, "Standard" }, - {0x14, 0x01, 0x01, 0x01, "Reverse" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x14, 0x01, 0x02, 0x00, "Off" }, - {0x14, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sound" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Title Level Display" }, - {0x14, 0x01, 0x10, 0x00, "Off" }, - {0x14, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x80, 0x00, "Off" }, - {0x14, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Bonkadv) - -static struct BurnDIPInfo ExplbrkrDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x02, 0x02, "Off" }, - {0x12, 0x01, 0x02, 0x00, "On" }, -}; - -STDDIPINFO(Explbrkr) - -static struct BurnDIPInfo GtmrDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x01, 0x00, "Off" }, - {0x14, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x02, 0x00, "Off" }, - {0x14, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x04, 0x00, "Upright" }, - {0x14, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Controls" }, - {0x14, 0x01, 0x18, 0x00, "1 Joystick" }, - {0x14, 0x01, 0x18, 0x10, "2 Joysticks" }, - {0x14, 0x01, 0x18, 0x08, "Wheel (360)" }, - {0x14, 0x01, 0x18, 0x18, "Wheel (270)" }, - - {0 , 0xfe, 0 , 2 , "Use Brake" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "National Anthem & Flag" }, - {0x14, 0x01, 0xc0, 0x00, "Use Memory" }, - {0x14, 0x01, 0xc0, 0x40, "Anthem Only" }, - {0x14, 0x01, 0xc0, 0x80, "Flag Only" }, - {0x14, 0x01, 0xc0, 0xc0, "None" }, -}; - -STDDIPINFO(Gtmr) - -static struct BurnDIPInfo Gtmr2DIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 5 , "Communication" }, - {0x14, 0x01, 0x07, 0x00, "None" }, - {0x14, 0x01, 0x07, 0x01, "Machine 1" }, - {0x14, 0x01, 0x07, 0x02, "Machine 2" }, - {0x14, 0x01, 0x07, 0x03, "Machine 3" }, - {0x14, 0x01, 0x07, 0x04, "Machine 4" }, - - {0 , 0xfe, 0 , 4 , "Controls" }, - {0x14, 0x01, 0x18, 0x00, "Joystick" }, - {0x14, 0x01, 0x18, 0x10, "Wheel (360)" }, - {0x14, 0x01, 0x18, 0x08, "Wheel (270D)" }, - {0x14, 0x01, 0x18, 0x18, "Wheel (270A)" }, - - {0 , 0xfe, 0 , 2 , "Pedal Function" }, - {0x14, 0x01, 0x20, 0x00, "Microswitch" }, - {0x14, 0x01, 0x20, 0x20, "Potentiometer" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x80, 0x00, "Off" }, - {0x14, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Gtmr2) - -static struct BurnDIPInfo MgcrystlDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, -}; - -STDDIPINFO(Mgcrystl) - -/*============================================================================================== -ROM Descriptions -===============================================================================================*/ - -static struct BurnRomInfo BerlwallRomDesc[] = { - { "u23_01.bin", 0x020000, 0x76b526ce, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "u39_01.bin", 0x020000, 0x78fa7ef2, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "bw001", 0x080000, 0xbc927260, BRF_GRA }, // 2 Sprites - { "bw002", 0x080000, 0x223f5465, BRF_GRA }, // 3 Sprites - { "bw300", 0x020000, 0xb258737a, BRF_GRA }, // 4 Sprites - - { "bw003", 0x080000, 0xfbb4b72d, BRF_GRA }, // 5 Tiles - - { "bw004", 0x080000, 0x5300c34d, BRF_GRA }, // 6 High colour background - { "bw008", 0x080000, 0x9aaf2f2f, BRF_GRA }, // 7 High colour background - { "bw005", 0x080000, 0x16db6d43, BRF_GRA }, // 8 High colour background - { "bw009", 0x080000, 0x1151a0b0, BRF_GRA }, // 9 High colour background - { "bw006", 0x080000, 0x73a35d1f, BRF_GRA }, // 10 High colour background - { "bw00a", 0x080000, 0xf447dfc2, BRF_GRA }, // 11 High colour background - { "bw007", 0x080000, 0x97f85c87, BRF_GRA }, // 12 High colour background - { "bw00b", 0x080000, 0xb0a48225, BRF_GRA }, // 13 High colour background - - { "bw000", 0x040000, 0xd8fe869d, BRF_SND }, // 14 Samples -}; - - -STD_ROM_PICK(Berlwall) -STD_ROM_FN(Berlwall) - -static struct BurnRomInfo BerlwalltRomDesc[] = { - { "bw100a", 0x020000, 0xe6bcb4eb, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "bw101a", 0x020000, 0x38056fb2, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "bw001", 0x080000, 0xbc927260, BRF_GRA }, // 2 Sprites - { "bw002", 0x080000, 0x223f5465, BRF_GRA }, // 3 Sprites - { "bw300", 0x020000, 0xb258737a, BRF_GRA }, // 4 Sprites - - { "bw003", 0x080000, 0xfbb4b72d, BRF_GRA }, // 5 Tiles - - { "bw004", 0x080000, 0x5300c34d, BRF_GRA }, // 6 High colour background - { "bw008", 0x080000, 0x9aaf2f2f, BRF_GRA }, // 7 High colour background - { "bw005", 0x080000, 0x16db6d43, BRF_GRA }, // 8 High colour background - { "bw009", 0x080000, 0x1151a0b0, BRF_GRA }, // 9 High colour background - { "bw006", 0x080000, 0x73a35d1f, BRF_GRA }, // 10 High colour background - { "bw00a", 0x080000, 0xf447dfc2, BRF_GRA }, // 11 High colour background - { "bw007", 0x080000, 0x97f85c87, BRF_GRA }, // 12 High colour background - { "bw00b", 0x080000, 0xb0a48225, BRF_GRA }, // 13 High colour background - - { "bw000", 0x040000, 0xd8fe869d, BRF_SND }, // 14 Samples -}; - - -STD_ROM_PICK(Berlwallt) -STD_ROM_FN(Berlwallt) - -static struct BurnRomInfo BlazeonRomDesc[] = { - { "bz_prg1.u80", 0x040000, 0x8409e31d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "bz_prg2.u81", 0x040000, 0xb8a0a08b, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "bz_sp1.u20", 0x100000, 0x0d5809a1, BRF_GRA }, // 2 Sprites - { "bz_sp2.u21", 0x100000, 0x56ead2bd, BRF_GRA }, // 3 Sprites - - { "bz_bg.u2", 0x100000, 0xfc67f19f, BRF_GRA }, // 4 Tiles - - { "3.u45", 0x020000, 0x52fe4c94, BRF_ESS | BRF_PRG }, // 5 Z80 Program Code -}; - - -STD_ROM_PICK(Blazeon) -STD_ROM_FN(Blazeon) - -static struct BurnRomInfo BloodwarRomDesc[] = { - { "ofp0f3.514", 0x080000, 0x0c93da15, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ofp1f3.513", 0x080000, 0x894ecbe5, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "ofd0x3.124", 0x020000, 0x399f2005, BRF_PRG | BRF_OPT }, // 2 MCU Code - - { "of-200-0201.8", 0x200000, 0xbba63025, BRF_GRA }, // 3 Sprites - { "of-201-0202.9", 0x200000, 0x4ffd9ddc, BRF_GRA }, // 4 Sprites - { "of-202-0203.10", 0x200000, 0xfbcc5363, BRF_GRA }, // 5 Sprites - { "of-203-0204.11", 0x200000, 0x8e818ce9, BRF_GRA }, // 6 Sprites - { "of-204-0205.12", 0x200000, 0x70c4a76b, BRF_GRA }, // 7 Sprites - { "of-205-0206.13", 0x200000, 0x80c667bb, BRF_GRA }, // 8 Sprites - { "of-206-0207.14", 0x200000, 0xc2028c97, BRF_GRA }, // 9 Sprites - { "of-207-0208.15", 0x200000, 0xb1f30c61, BRF_GRA }, // 10 Sprites - { "of-208-0209.28", 0x200000, 0xa8f29545, BRF_GRA }, // 11 Sprites - { "of-209e-0210.16", 0x100000, 0x93018468, BRF_GRA }, // 12 Sprites - { "of-2090-2011.17", 0x100000, 0x3fb226a1, BRF_GRA }, // 13 Sprites - { "of-210e-0212.18", 0x100000, 0x80f3fa1b, BRF_GRA }, // 14 Sprites - { "of-2100-0213.19", 0x100000, 0x8ca3a3d6, BRF_GRA }, // 15 Sprites - { "of-211e-0214.20", 0x100000, 0x8d3d96f7, BRF_GRA }, // 16 Sprites - { "of-2110-0215.21", 0x100000, 0x78268230, BRF_GRA }, // 17 Sprites - { "of-212e-0216.22", 0x100000, 0x5a013d99, BRF_GRA }, // 18 Sprites - { "of-2120-0217.23", 0x100000, 0x84ed25bd, BRF_GRA }, // 19 Sprites - { "of-213e-0218.24", 0x100000, 0x861bc5b1, BRF_GRA }, // 20 Sprites - { "of-2130-0219.25", 0x100000, 0xa79b8119, BRF_GRA }, // 21 Sprites - { "of-214e-0220.26", 0x100000, 0x43c622de, BRF_GRA }, // 22 Sprites - { "of-2140-0221.27", 0x100000, 0xd10bf03c, BRF_GRA }, // 23 Sprites - - { "of-300-0225.51", 0x100000, 0xfbc3c08a, BRF_GRA }, // 24 Tiles - { "of-301-0226.55", 0x100000, 0xfcf215de, BRF_GRA }, // 25 Tiles (Layers 2 & 3) - - { "of-101-f-0223.101", 0x100000, 0x295f3c93, BRF_SND }, // 26 Samples - { "of-100-0222.99", 0x100000, 0x42b12269, BRF_SND }, // 27 Samples -}; - - -STD_ROM_PICK(Bloodwar) -STD_ROM_FN(Bloodwar) - -static struct BurnRomInfo BonkadvRomDesc[] = { - { "prg.8", 0x080000, 0xaf2e60f8, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "prg.7", 0x080000, 0xa1cc6a78, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "mcu.124", 0x020000, 0x9d4e2724, BRF_PRG | BRF_OPT }, // 2 MCU Code - - { "pc100101.37", 0x200000, 0xc96e7c10, BRF_GRA }, // 3 Sprites - { "pc200102.40", 0x100000, 0xc2b7a26a, BRF_GRA }, // 4 Sprites - { "pc300103.38", 0x100000, 0x51ee162c, BRF_GRA }, // 5 Sprites - { "pc600106.42", 0x080000, 0x25877026, BRF_GRA }, // 6 Sprites - { "pc700107.43", 0x080000, 0xbfe21c44, BRF_GRA }, // 7 Sprites - - { "pc400104.51", 0x100000, 0x3b176f84, BRF_GRA }, // 8 Tiles - { "pc500105.55", 0x100000, 0xbebb3edc, BRF_GRA }, // 9 Tiles (Layers 2 & 3) - - { "pc604109.101", 0x100000, 0x76025530, BRF_SND }, // 10 Samples - { "pc601106.99", 0x100000, 0xa893651c, BRF_SND }, // 11 Samples - { "pc602107.100", 0x100000, 0x0fbb23aa, BRF_SND }, // 12 Samples - { "pc603108.102", 0x100000, 0x58458985, BRF_SND }, // 13 Samples -}; - - -STD_ROM_PICK(Bonkadv) -STD_ROM_FN(Bonkadv) - -static struct BurnRomInfo ExplbrkrRomDesc[] = { - { "ts100e.u18", 0x040000, 0xcc84a985, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ts101e.u19", 0x040000, 0x88f4afb7, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "ts001e.u37", 0x080000, 0x70b66e7e, BRF_GRA }, // 2 Sprites - { "ts000e.u38", 0x080000, 0xa7a94143, BRF_GRA }, // 3 Sprites - { "ts002e.u36", 0x040000, 0x611271e6, BRF_GRA }, // 4 Sprites - - { "ts010.u4", 0x100000, 0xdf935324, BRF_GRA }, // 5 Tiles - { "ts020.u33", 0x100000, 0xeb58c35d, BRF_GRA }, // 6 Tiles (Layers 2 & 3) - - { "ts030.u5", 0x100000, 0x1d68e9d1, BRF_SND }, // 7 Samples -}; - - -STD_ROM_PICK(Explbrkr) -STD_ROM_FN(Explbrkr) - -static struct BurnRomInfo BakubrkrRomDesc[] = { - { "ts100j.u18", 0x040000, 0x8cc0a4fd, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ts101j.u19", 0x040000, 0xaea92195, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "ts001j.u37", 0x080000, 0x70b66e7e, BRF_GRA }, // 2 Sprites - { "ts000j.u38", 0x080000, 0xa7a94143, BRF_GRA }, // 3 Sprites - { "ts002j.u36", 0x040000, 0x611271e6, BRF_GRA }, // 4 Sprites - - { "ts010.u4", 0x100000, 0xdf935324, BRF_GRA }, // 5 Tiles - { "ts020.u33", 0x100000, 0xeb58c35d, BRF_GRA }, // 6 Tiles (Layers 2 & 3) - - { "ts030.u5", 0x100000, 0x1d68e9d1, BRF_SND }, // 7 Samples -}; - - -STD_ROM_PICK(Bakubrkr) -STD_ROM_FN(Bakubrkr) - -static struct BurnRomInfo GtmrRomDesc[] = { - { "u2.bin", 0x080000, 0x031799f7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "u1.bin", 0x080000, 0x6238790a, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "mmd0x2.u124.bin", 0x020000, 0x3d7cb329, BRF_PRG | BRF_OPT }, // 2 MCU Code - - { "mm-200-402-s0.bin", 0x200000, 0xc0ab3efc, BRF_GRA }, // 3 Sprites - { "mm-201-403-s1.bin", 0x200000, 0xcf6b23dc, BRF_GRA }, // 4 Sprites - { "mm-202-404-s2.bin", 0x200000, 0x8f27f5d3, BRF_GRA }, // 5 Sprites - { "mm-203-405-s3.bin", 0x080000, 0xe9747c8c, BRF_GRA }, // 6 Sprites - { "mms1x2.u30.bin", 0x020000, 0xb42b426f, BRF_GRA }, // 7 Sprites - { "mms0x2.u29.bin", 0x020000, 0xbd22b7d2, BRF_GRA }, // 8 Sprites - - { "mm-300-406-a0.bin", 0x200000, 0xb15f6b7f, BRF_GRA }, // 9 Tiles - - { "mm-100-401-e0.bin", 0x100000, 0xb9cbfbee, BRF_SND }, // 10 Samples -}; - - -STD_ROM_PICK(Gtmr) -STD_ROM_FN(Gtmr) - -static struct BurnRomInfo GtmraRomDesc[] = { - { "mmp0x2.u514.bin", 0x080000, 0xba4a77c8, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "mmp1x2.u513.bin", 0x080000, 0xa2b9034e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "mmd0x2.u124.bin", 0x020000, 0x3d7cb329, BRF_PRG | BRF_OPT }, // 2 MCU Code - - { "mm-200-402-s0.bin", 0x200000, 0xc0ab3efc, BRF_GRA }, // 3 Sprites - { "mm-201-403-s1.bin", 0x200000, 0xcf6b23dc, BRF_GRA }, // 4 Sprites - { "mm-202-404-s2.bin", 0x200000, 0x8f27f5d3, BRF_GRA }, // 5 Sprites - { "mm-203-405-s3.bin", 0x080000, 0xe9747c8c, BRF_GRA }, // 6 Sprites - { "mms1x2.u30.bin", 0x020000, 0xb42b426f, BRF_GRA }, // 7 Sprites - { "mms0x2.u29.bin", 0x020000, 0xbd22b7d2, BRF_GRA }, // 8 Sprites - - { "mm-300-406-a0.bin", 0x200000, 0xb15f6b7f, BRF_GRA }, // 9 Tiles - - { "mm-100-401-e0.bin", 0x100000, 0xb9cbfbee, BRF_SND }, // 10 Samples -}; - - -STD_ROM_PICK(Gtmra) -STD_ROM_FN(Gtmra) - -static struct BurnRomInfo GtmreRomDesc[] = { - { "gmmu2.bin", 0x080000, 0x36dc4aa9, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "gmmu1.bin", 0x080000, 0x8653c144, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "gtmrusa.u12", 0x020000, 0x2e1a06ff, BRF_PRG | BRF_OPT }, // 2 MCU Code - - { "gmmu27.bin", 0x200000, 0xc0ab3efc, BRF_GRA }, // 3 Sprites - { "gmmu28.bin", 0x200000, 0xcf6b23dc, BRF_GRA }, // 4 Sprites - { "gmmu29.bin", 0x200000, 0x8f27f5d3, BRF_GRA }, // 5 Sprites - { "gmmu30.bin", 0x080000, 0xe9747c8c, BRF_GRA }, // 6 Sprites - { "gmmu64.bin", 0x100000, 0x57d77b33, BRF_GRA }, // 7 Sprites - { "gmmu65.bin", 0x100000, 0x05b8bdca, BRF_GRA }, // 8 Sprites - - { "gmmu52.bin", 0x200000, 0xb15f6b7f, BRF_GRA }, // 9 Tiles - - { "gmmu23.bin", 0x100000, 0xb9cbfbee, BRF_SND }, // 10 Samples - { "gmmu24.bin", 0x100000, 0x380cdc7c, BRF_SND }, // 11 Samples -}; - - -STD_ROM_PICK(Gtmre) -STD_ROM_FN(Gtmre) - -static struct BurnRomInfo GtmrusaRomDesc[] = { - { "gtmrusa.u2", 0x080000, 0x5be615c4, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "gtmrusa.u1", 0x080000, 0xae853e4e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "gtmrusa.u12", 0x020000, 0x2e1a06ff, BRF_PRG | BRF_OPT }, // 2 MCU Code - - { "gmmu27.bin", 0x200000, 0xc0ab3efc, BRF_GRA }, // 3 Sprites - { "gmmu28.bin", 0x200000, 0xcf6b23dc, BRF_GRA }, // 4 Sprites - { "gmmu29.bin", 0x200000, 0x8f27f5d3, BRF_GRA }, // 5 Sprites - { "gmmu30.bin", 0x080000, 0xe9747c8c, BRF_GRA }, // 6 Sprites - { "gmmu64.bin", 0x100000, 0x57d77b33, BRF_GRA }, // 7 Sprites - { "gmmu65.bin", 0x100000, 0x05b8bdca, BRF_GRA }, // 8 Sprites - - { "gmmu52.bin", 0x200000, 0xb15f6b7f, BRF_GRA }, // 9 Tiles - - { "gmmu23.bin", 0x100000, 0xb9cbfbee, BRF_SND }, // 10 Samples - { "gmmu24.bin", 0x100000, 0x380cdc7c, BRF_SND }, // 11 Samples -}; - - -STD_ROM_PICK(Gtmrusa) -STD_ROM_FN(Gtmrusa) - -static struct BurnRomInfo Gtmr2RomDesc[] = { - { "m2p0x1a.u8", 0x080000, 0xc29039fb, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "m2p1x1a.u7", 0x080000, 0x8ef392c4, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "m2d0x0.u31", 0x020000, 0x2e1a06ff, BRF_PRG | BRF_OPT }, // 2 MCU Code - - { "m2-200-0.u49", 0x400000, 0x93aafc53, BRF_GRA }, // 3 Sprites - { "m2-201-0.u50", 0x200000, 0x39b60a83, BRF_GRA }, // 4 Sprites - { "m2-202-0.u51", 0x200000, 0xfd06b339, BRF_GRA }, // 5 Sprites - { "m2s0x1a.u32", 0x080000, 0xa485eec6, BRF_GRA }, // 6 Sprites - { "m2s1x1a.u33", 0x080000, 0xc5b71bb2, BRF_GRA }, // 7 Sprites - - { "m2-300-0.u89", 0x200000, 0x4dc42fbb, BRF_GRA }, // 8 Tiles - { "m2-301-0.u90", 0x200000, 0xf4e894f2, BRF_GRA }, // 9 Tiles - { "m2b0x0.u93", 0x020000, 0xe023d51b, BRF_GRA }, // 10 Tiles - { "m2b1x0.u94", 0x020000, 0x03c48bdb, BRF_GRA }, // 11 Tiles - - { "m2-100-0.u48", 0x100000, 0x5250fa45, BRF_SND }, // 12 Samples - { "m2w1x0.u47", 0x040000, 0x1b0513c5, BRF_SND }, // 13 Samples -}; - - -STD_ROM_PICK(Gtmr2) -STD_ROM_FN(Gtmr2) - -static struct BurnRomInfo Gtmr2aRomDesc[] = { - { "m2p0x1.u8", 0x080000, 0x525f6618, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "m2p1x1.u7", 0x080000, 0x914683e5, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "m2d0x0.u31", 0x020000, 0x2e1a06ff, BRF_PRG | BRF_OPT }, // 2 MCU Code - - { "m2-200-0.u49", 0x400000, 0x93aafc53, BRF_GRA }, // 3 Sprites - { "m2-201-0.u50", 0x200000, 0x39b60a83, BRF_GRA }, // 4 Sprites - { "m2-202-0.u51", 0x200000, 0xfd06b339, BRF_GRA }, // 5 Sprites - { "m2s0x1.u32", 0x080000, 0x4069d6c7, BRF_GRA }, // 6 Sprites - { "m2s1x1.u33", 0x080000, 0xc53fe269, BRF_GRA }, // 7 Sprites - - { "m2-300-0.u89", 0x200000, 0x4dc42fbb, BRF_GRA }, // 8 Tiles - { "m2-301-0.u90", 0x200000, 0xf4e894f2, BRF_GRA }, // 9 Tiles - { "m2b0x0.u93", 0x020000, 0xe023d51b, BRF_GRA }, // 10 Tiles - { "m2b1x0.u94", 0x020000, 0x03c48bdb, BRF_GRA }, // 11 Tiles - - { "m2-100-0.u48", 0x100000, 0x5250fa45, BRF_SND }, // 12 Samples - { "m2w1x0.u47", 0x040000, 0x1b0513c5, BRF_SND }, // 13 Samples -}; - - -STD_ROM_PICK(Gtmr2a) -STD_ROM_FN(Gtmr2a) - -static struct BurnRomInfo Gtmr2uRomDesc[] = { - { "m2p0a1.u8", 0x080000, 0x813e1d5e, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "m2p1a1.u7", 0x080000, 0xbee63666, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "m2d0x0.u31", 0x020000, 0x2e1a06ff, BRF_PRG | BRF_OPT }, // 2 MCU Code - - { "m2-200-0.u49", 0x400000, 0x93aafc53, BRF_GRA }, // 3 Sprites - { "m2-201-0.u50", 0x200000, 0x39b60a83, BRF_GRA }, // 4 Sprites - { "m2-202-0.u51", 0x200000, 0xfd06b339, BRF_GRA }, // 5 Sprites - { "m2s0a1.u32", 0x080000, 0x98977171, BRF_GRA }, // 6 Sprites - { "m2s1a1.u33", 0x080000, 0xc69a732e, BRF_GRA }, // 7 Sprites - - { "m2-300-0.u89", 0x200000, 0x4dc42fbb, BRF_GRA }, // 8 Tiles - { "m2-301-0.u90", 0x200000, 0xf4e894f2, BRF_GRA }, // 9 Tiles - { "m2b0x0.u93", 0x020000, 0xe023d51b, BRF_GRA }, // 10 Tiles - { "m2b1x0.u94", 0x020000, 0x03c48bdb, BRF_GRA }, // 11 Tiles - - { "m2-100-0.u48", 0x100000, 0x5250fa45, BRF_SND }, // 12 Samples - { "m2w1a1.u47", 0x080000, 0x15f25342, BRF_SND }, // 13 Samples -}; - - -STD_ROM_PICK(Gtmr2u) -STD_ROM_FN(Gtmr2u) - -static struct BurnRomInfo MgcrystlRomDesc[] = { - { "mc100e02.u18", 0x020000, 0x246a1335, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "mc101e02.u19", 0x040000, 0x708ea1dc, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "mc000.u38", 0x100000, 0x28acf6f4, BRF_GRA }, // 2 Sprites - { "mc001.u37", 0x080000, 0x005bc43d, BRF_GRA }, // 3 Sprites - { "mc002e02.u36", 0x020000, 0x27ac1056, BRF_GRA }, // 4 Sprites - - { "mc010.u04", 0x100000, 0x85072772, BRF_GRA }, // 5 Tiles - { "mc020.u34", 0x100000, 0x1ea92ff1, BRF_GRA }, // 6 Tiles (Layers 2 & 3) - - { "mc030.u32", 0x040000, 0xc165962e, BRF_SND }, // 7 Samples -}; - - -STD_ROM_PICK(Mgcrystl) -STD_ROM_FN(Mgcrystl) - -static struct BurnRomInfo MgcrystloRomDesc[] = { - { "mc100h00.u18", 0x020000, 0xc7456ba7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "mc101h00.u19", 0x040000, 0xea8f9300, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "mc000.u38", 0x100000, 0x28acf6f4, BRF_GRA }, // 2 Sprites - { "mc001.u37", 0x080000, 0x005bc43d, BRF_GRA }, // 3 Sprites - { "mc002h00.u36", 0x020000, 0x22729037, BRF_GRA }, // 4 Sprites - - { "mc010.u04", 0x100000, 0x85072772, BRF_GRA }, // 5 Tiles - { "mc020.u34", 0x100000, 0x1ea92ff1, BRF_GRA }, // 6 Tiles (Layers 2 & 3) - - { "mc030.u32", 0x040000, 0xc165962e, BRF_SND }, // 7 Samples -}; - - -STD_ROM_PICK(Mgcrystlo) -STD_ROM_FN(Mgcrystlo) - -static struct BurnRomInfo MgcrystljRomDesc[] = { - { "mc100j02.u18", 0x020000, 0xafe5882d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "mc101j02.u19", 0x040000, 0x60da5492, BRF_ESS | BRF_PRG }, // 1 68000 Program Code - - { "mc000.u38", 0x100000, 0x28acf6f4, BRF_GRA }, // 2 Sprites - { "mc001.u37", 0x080000, 0x005bc43d, BRF_GRA }, // 3 Sprites - { "mc002e02.u36", 0x020000, 0x27ac1056, BRF_GRA }, // 4 Sprites - - { "mc010.u04", 0x100000, 0x85072772, BRF_GRA }, // 5 Tiles - { "mc020.u34", 0x100000, 0x1ea92ff1, BRF_GRA }, // 6 Tiles (Layers 2 & 3) - - { "mc030.u32", 0x040000, 0xc165962e, BRF_SND }, // 7 Samples -}; - - -STD_ROM_PICK(Mgcrystlj) -STD_ROM_FN(Mgcrystlj) - -/*============================================================================================== -Graphics Decoding -===============================================================================================*/ - -static void Kaneko16DecodeBg15Bitmaps() -{ - INT32 sx, x, y; - - for (sx = 0; sx < 32; sx++) { - for (x = 0; x < 256; x++) { - for (y = 0; y < 256; y++) { - INT32 addr = (sx * 256 * 256) + (y * 256) + x; - INT32 data = (Kaneko16TempGfx[addr * 2 + 0] * 256) + Kaneko16TempGfx[addr * 2 + 1]; - INT32 r, g, b; - - r = (data & 0x07c0) >> 6; - g = (data & 0xf800) >> 11; - b = (data & 0x003e) >> 1; - - r ^= 0x09; - - if (~g & 0x08) g ^= 0x010; - g = (g - 1) & 0x1f; - - b ^= 0x03; - if (~b & 0x08) b ^= 0x10; - b = (b + 2) & 0x1f; - - if ((r & 0x10) && (b & 0x10)) g = (g - 1) & 0x1f; - - Kaneko16Bg15Data[addr] = 2048 + ((g << 10) | (r << 5) | b); - } - } - } -} - -/*============================================================================================== -Unscramble Tile/Sound ROM Functions -===============================================================================================*/ - -static void UnscrambleTiles(INT32 length) -{ - UINT8 *RAM = Kaneko16TempGfx; - INT32 i; - - if (RAM == NULL) return; - - for (i = 0; i < length; i ++) - { - RAM[i] = ((RAM[i] & 0xF0)>>4) + ((RAM[i] & 0x0F)<<4); - } -} - -static void ExpandSampleBanks() -{ - INT32 bank; - - for (bank = 15; bank > 0; bank--) - { - UINT8 *src0 = MSM6295ROMData; - UINT8 *srcn = src0 + 0x10000 * (bank < 3 ? 3 : bank); - UINT8 *dst = src0 + 0x40000 * bank; - - memcpy(dst + 0x30000, srcn + 0x00000, 0x10000); - memcpy(dst + 0x00000, src0 + 0x00000, 0x30000); - } -} - -/*============================================================================================== -Allocate Memory -===============================================================================================*/ - -static INT32 GtmrMemIndex() -{ - UINT8 *Next; Next = Mem; - - Kaneko16Rom = Next; Next += 0x100000; - MSM6295ROM = Next; Next += 0x140000; - MSM6295ROMData = Next; Next += 0x400000; - MSM6295ROMData2 = Next; Next += 0x300000; - - RamStart = Next; - - Kaneko16Ram = Next; Next += 0x028000; - Kaneko16MCURam = Next; Next += 0x010000; - Kaneko16NVRam = Next; Next += 0x000100; - Kaneko16PaletteRam = Next; Next += 0x010000; - Kaneko16SpriteRam = Next; Next += Kaneko16SpriteRamSize; - Kaneko16Video0Ram = Next; Next += 0x001000; - Kaneko16Video1Ram = Next; Next += 0x001000; - Kaneko16Video2Ram = Next; Next += 0x001000; - Kaneko16Video3Ram = Next; Next += 0x001000; - Kaneko16VScrl0Ram = Next; Next += 0x001000; - Kaneko16VScrl1Ram = Next; Next += 0x001000; - Kaneko16VScrl2Ram = Next; Next += 0x001000; - Kaneko16VScrl3Ram = Next; Next += 0x001000; - - RamEnd = Next; - - Kaneko16Sprites = Next; Next += (Kaneko16NumSprites * 16 * 16); - Kaneko16Tiles = Next; Next += (Kaneko16NumTiles * 16 * 16); - LayerQueueXY[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueXY[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueColour[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueColour[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueuePriority[0] = Next; Next += nScreenWidth * nScreenHeight; - LayerQueuePriority[1] = Next; Next += nScreenWidth * nScreenHeight; - if (Kaneko16NumTiles2) { - Kaneko16Tiles2 = Next; Next += (Kaneko16NumTiles2 * 16 * 16); - LayerQueueXY[2] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueXY[3] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueColour[2] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueColour[3] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueuePriority[2] = Next; Next += nScreenWidth * nScreenHeight; - LayerQueuePriority[3] = Next; Next += nScreenWidth * nScreenHeight; - } - Kaneko16Palette = (UINT32*)Next; Next += 0x010000 * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -static INT32 ExplbrkrMemIndex() -{ - UINT8 *Next; Next = Mem; - - Kaneko16Rom = Next; Next += 0x080000; - MSM6295ROM = Next; Next += 0x040000; - MSM6295ROMData = Next; Next += 0x200000; - - RamStart = Next; - - Kaneko16Ram = Next; Next += 0x010000; - Kaneko16PaletteRam = Next; Next += 0x001000; - Kaneko16SpriteRam = Next; Next += Kaneko16SpriteRamSize; - Kaneko16Video0Ram = Next; Next += 0x001000; - Kaneko16Video1Ram = Next; Next += 0x001000; - Kaneko16Video2Ram = Next; Next += 0x001000; - Kaneko16Video3Ram = Next; Next += 0x001000; - Kaneko16VScrl0Ram = Next; Next += 0x001000; - Kaneko16VScrl1Ram = Next; Next += 0x001000; - Kaneko16VScrl2Ram = Next; Next += 0x001000; - Kaneko16VScrl3Ram = Next; Next += 0x001000; - - RamEnd = Next; - - Kaneko16Sprites = Next; Next += (Kaneko16NumSprites * 16 * 16); - Kaneko16Tiles = Next; Next += (Kaneko16NumTiles * 16 * 16); - LayerQueueXY[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueXY[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueColour[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueColour[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueuePriority[0] = Next; Next += nScreenWidth * nScreenHeight; - LayerQueuePriority[1] = Next; Next += nScreenWidth * nScreenHeight; - if (Kaneko16NumTiles2) { - Kaneko16Tiles2 = Next; Next += (Kaneko16NumTiles2 * 16 * 16); - LayerQueueXY[2] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueXY[3] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueColour[2] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueColour[3] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueuePriority[2] = Next; Next += nScreenWidth * nScreenHeight; - LayerQueuePriority[3] = Next; Next += nScreenWidth * nScreenHeight; - } - pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); - if (Kaneko16Bg15) { - Kaneko16Bg15Data = (UINT16*)Next; Next += (32 * 256 * 256) * sizeof(UINT16); // 32 bitmaps - 256 x 256 - Kaneko16Palette = (UINT32*)Next; Next += (0x001000 + 32768) * sizeof(UINT32); - } else { - Kaneko16Palette = (UINT32*)Next; Next += 0x001000 * sizeof(UINT32); - } - MemEnd = Next; - - return 0; -} - -static INT32 BlazeonMemIndex() -{ - UINT8 *Next; Next = Mem; - - Kaneko16Rom = Next; Next += 0x080000; - Kaneko16Z80Rom = Next; Next += 0x020000; - - RamStart = Next; - - Kaneko16Ram = Next; Next += 0x010000; - Kaneko16Z80Ram = Next; Next += 0x002000; - Kaneko16PaletteRam = Next; Next += 0x001000; - Kaneko16SpriteRam = Next; Next += Kaneko16SpriteRamSize; - Kaneko16Video0Ram = Next; Next += 0x001000; - Kaneko16Video1Ram = Next; Next += 0x001000; - Kaneko16VScrl0Ram = Next; Next += 0x001000; - Kaneko16VScrl1Ram = Next; Next += 0x001000; - - RamEnd = Next; - - Kaneko16Sprites = Next; Next += (Kaneko16NumSprites * 16 * 16); - Kaneko16Tiles = Next; Next += (Kaneko16NumTiles * 16 * 16); - LayerQueueXY[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueXY[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueColour[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueueColour[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); - LayerQueuePriority[0] = Next; Next += nScreenWidth * nScreenHeight; - LayerQueuePriority[1] = Next; Next += nScreenWidth * nScreenHeight; - Kaneko16Palette = (UINT32*)Next; Next += 0x001000 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -/*============================================================================================== -Protection Calculator -===============================================================================================*/ - -static struct { - UINT16 x1p, y1p, x1s, y1s; - UINT16 x2p, y2p, x2s, y2s; - - INT16 x12, y12, x21, y21; - - UINT16 mult_a, mult_b; -} hit; - -static INT16 calc_compute_x(void) -{ - INT16 x_coll; - - // X distance - if ((hit.x2p >= hit.x1p) && (hit.x2p < (hit.x1p + hit.x1s))) // x2p inside x1 - x_coll = (hit.x1s - (hit.x2p - hit.x1p)); - else if ((hit.x1p >= hit.x2p) && (hit.x1p < (hit.x2p + hit.x2s))) // x1p inside x2 - x_coll = (hit.x2s - (hit.x1p - hit.x2p)); - else // normal/no overlap - x_coll = ((hit.x1s + hit.x2s)/2) - abs((hit.x1p + hit.x1s/2) - (hit.x2p + hit.x2s/2)); - - return x_coll; -} -static INT16 calc_compute_y(void) -{ - INT16 y_coll; - - // Y distance - if ((hit.y2p >= hit.y1p) && (hit.y2p < (hit.y1p + hit.y1s))) // y2p inside y1 - y_coll = (hit.y1s - (hit.y2p - hit.y1p)); - else if ((hit.y1p >= hit.y2p) && (hit.y1p < (hit.y2p + hit.y2s))) // y1p inside y2 - y_coll = (hit.y2s - (hit.y1p - hit.y2p)); - else // normal/no overlap - y_coll = ((hit.y1s + hit.y2s)/2) - abs((hit.y1p + hit.y1s/2) - (hit.y2p + hit.y2s/2)); - - return y_coll; -} - -static UINT16 BloodwarCalcRead(INT32 offset) -{ - UINT16 data = 0; - INT16 x_coll, y_coll; - - x_coll = calc_compute_x(); - y_coll = calc_compute_y(); - - switch (offset) - { - case 0x00/2: // X distance - return x_coll; - - case 0x02/2: // Y distance - return y_coll; - - case 0x04/2: // similar to the hit detection from SuperNova, but much simpler - - // 4th nibble: Y Absolute Collision -> possible values = 9,8,4,3,2 - if (hit.y1p > hit.y2p) data |= 0x2000; - else if (hit.y1p == hit.y2p) data |= 0x4000; - else if (hit.y1p < hit.y2p) data |= 0x8000; - if (y_coll<0) data |= 0x1000; - - // 3rd nibble: X Absolute Collision -> possible values = 9,8,4,3,2 - if (hit.x1p > hit.x2p) data |= 0x0200; - else if (hit.x1p == hit.x2p) data |= 0x0400; - else if (hit.x1p < hit.x2p) data |= 0x0800; - if (x_coll<0) data |= 0x0100; - - // 2nd nibble: always set to 4 - data |= 0x0040; - - // 1st nibble: XY Overlap Collision -> possible values = 0,2,4,f - if (x_coll>=0) data |= 0x0004; - if (y_coll>=0) data |= 0x0002; - if ((x_coll>=0)&&(y_coll>=0)) data |= 0x000F; - - return data; - - case 0x14/2: - return rand() & 0xffff; - - case 0x20/2: return hit.x1p; - case 0x22/2: return hit.x1s; - case 0x24/2: return hit.y1p; - case 0x26/2: return hit.y1s; - - case 0x2c/2: return hit.x2p; - case 0x2e/2: return hit.x2s; - case 0x30/2: return hit.y2p; - case 0x32/2: return hit.y2s; - } - - return 0; -} - -static UINT16 BonkadvCalcRead(INT32 offset) -{ - UINT16 data = 0; - - switch (offset) - { - case 0x00/2: // watchdog - return 0; - - case 0x02/2: // unknown (yet!), used by *MANY* games !!! - break; - - case 0x04/2: // similar to the hit detection from SuperNova, but much simpler - - // X Absolute Collision - if (hit.x1p > hit.x2p) data |= 0x0200; - else if (hit.x1p == hit.x2p) data |= 0x0400; - else if (hit.x1p < hit.x2p) data |= 0x0800; - - // Y Absolute Collision - if (hit.y1p > hit.y2p) data |= 0x2000; - else if (hit.y1p == hit.y2p) data |= 0x4000; - else if (hit.y1p < hit.y2p) data |= 0x8000; - - // XY Overlap Collision - hit.x12 = (hit.x1p) - (hit.x2p + hit.x2s); - hit.y12 = (hit.y1p) - (hit.y2p + hit.y2s); - hit.x21 = (hit.x1p + hit.x1s) - (hit.x2p); - hit.y21 = (hit.y1p + hit.y1s) - (hit.y2p); - - if ((hit.x12 < 0) && (hit.y12 < 0) && - (hit.x21 >= 0) && (hit.y21 >= 0)) - data |= 0x0001; - - return data; - - case 0x10/2: - return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) >> 16); - case 0x12/2: - return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) & 0xffff); - - case 0x14/2: - return rand() & 0xffff; - } - - return 0; -} - -static void BloodwarCalcWrite(INT32 offset, UINT16 data) -{ - switch (offset) { - case 0x20 >> 1: hit.x1p = data; return; - case 0x22 >> 1: hit.x1s = data; return; - case 0x24 >> 1: hit.y1p = data; return; - case 0x26 >> 1: hit.y1s = data; return; - - case 0x2c >> 1: hit.x2p = data; return; - case 0x2e >> 1: hit.x2s = data; return; - case 0x30 >> 1: hit.y2p = data; return; - case 0x32 >> 1: hit.y2s = data; return; - } -} - -static void BonkadvCalcWrite(INT32 offset, UINT16 data) -{ - switch (offset) { - case 0x00 >> 1: hit.x1p = data; return; - case 0x02 >> 1: hit.x1s = data; return; - case 0x04 >> 1: hit.y1p = data; return; - case 0x06 >> 1: hit.y1s = data; return; - case 0x08 >> 1: hit.x2p = data; return; - case 0x0a >> 1: hit.x2s = data; return; - case 0x0c >> 1: hit.y2p = data; return; - case 0x0e >> 1: hit.y2s = data; return; - case 0x10 >> 1: hit.mult_a = data; return; - case 0x12 >> 1: hit.mult_b = data; return; - } -} - -/*============================================================================================== -Toybox MCU -===============================================================================================*/ - -static void ToyboxMCUInit() -{ - memset(ToyboxMCUCom, 0, 4 * sizeof(UINT16)); -} - -static UINT16 ToyboxMCUStatusRead() -{ - return 0; -} - -#define MCU_RESPONSE(d) memcpy(&MCURam[MCUOffset], d, sizeof(d)) - -static void BloodwarMCURun() -{ - UINT16 *MCURam = (UINT16*)Kaneko16MCURam; - UINT16 *NVRam = (UINT16*)Kaneko16NVRam; - - UINT16 MCUCommand = MCURam[0x10/2]; - UINT16 MCUOffset = MCURam[0x12/2] >> 1; - UINT16 MCUData = MCURam[0x14/2]; - - switch (MCUCommand >> 8) { - case 0x02: { - memcpy(MCURam + MCUOffset, NVRam, 128); - return; - } - - case 0x03: { - MCURam[MCUOffset + 0] = 0xff00 - (Kaneko16Dip[0] << 8); - return; - } - - case 0x04: { - switch (MCUData) { - // unknown purpose data - case 0x01: MCU_RESPONSE(bloodwar_mcu_4_01); break; // Warrior 1 - case 0x02: MCU_RESPONSE(bloodwar_mcu_4_02); break; // Warrior 2 - case 0x03: MCU_RESPONSE(bloodwar_mcu_4_03); break; // Warrior 3 - case 0x04: MCU_RESPONSE(bloodwar_mcu_4_04); break; // Warrior 4 - case 0x05: MCU_RESPONSE(bloodwar_mcu_4_05); break; // Warrior 5 - case 0x06: MCU_RESPONSE(bloodwar_mcu_4_06); break; // Warrior 6 - case 0x07: MCU_RESPONSE(bloodwar_mcu_4_07); break; // Warrior 7 - case 0x08: MCU_RESPONSE(bloodwar_mcu_4_08); break; // Warrior 8 - case 0x09: MCU_RESPONSE(bloodwar_mcu_4_09); break; // Warrior 9 - - // palette data - case 0x0a: MCU_RESPONSE(bloodwar_mcu_4_0a); break; // Warrior 1 Player 1 - case 0x0b: MCU_RESPONSE(bloodwar_mcu_4_0b); break; // Warrior 1 Player 2 - case 0x0c: MCU_RESPONSE(bloodwar_mcu_4_0c); break; // Warrior 5 Player 1 - case 0x0d: MCU_RESPONSE(bloodwar_mcu_4_0d); break; // Warrior 5 Player 2 - case 0x0e: MCU_RESPONSE(bloodwar_mcu_4_0e); break; // Warrior 4 Player 2 - case 0x0f: MCU_RESPONSE(bloodwar_mcu_4_0f); break; // Warrior 4 Player 1 - case 0x10: MCU_RESPONSE(bloodwar_mcu_4_10); break; // Warrior 6 Player 1 - case 0x11: MCU_RESPONSE(bloodwar_mcu_4_11); break; // Warrior 6 Player 2 - case 0x12: MCU_RESPONSE(bloodwar_mcu_4_12); break; // Warrior 9 Player 1 - case 0x13: MCU_RESPONSE(bloodwar_mcu_4_13); break; // Warrior 9 Player 2 - case 0x14: MCU_RESPONSE(bloodwar_mcu_4_14); break; // Warrior 7 Player 1 - case 0x15: MCU_RESPONSE(bloodwar_mcu_4_15); break; // Warrior 7 Player 2 - case 0x16: MCU_RESPONSE(bloodwar_mcu_4_16); break; // Warrior 8 Player 1 - case 0x17: MCU_RESPONSE(bloodwar_mcu_4_17); break; // Warrior 8 Player 2 - case 0x18: MCU_RESPONSE(bloodwar_mcu_4_18); break; // Warrior 2 Player 2 - case 0x19: MCU_RESPONSE(bloodwar_mcu_4_19); break; // Warrior 2 Player 1 - case 0x1a: MCU_RESPONSE(bloodwar_mcu_4_1a); break; // Warrior 3 Player 1 - case 0x1b: MCU_RESPONSE(bloodwar_mcu_4_1b); break; // Warrior 3 Player 2 - - // tilemap data - case 0x1c: MCU_RESPONSE(bloodwar_mcu_4_1c); break; // Warrior 8 - case 0x1d: MCU_RESPONSE(bloodwar_mcu_4_1d); break; // Warrior 2 - case 0x1e: MCU_RESPONSE(bloodwar_mcu_4_1e); break; // Warrior 3 - case 0x1f: MCU_RESPONSE(bloodwar_mcu_4_1f); break; // Warrior 5 - case 0x20: MCU_RESPONSE(bloodwar_mcu_4_20); break; // Warrior 4 - case 0x21: MCU_RESPONSE(bloodwar_mcu_4_21); break; // Warrior 6 - case 0x22: MCU_RESPONSE(bloodwar_mcu_4_22); break; // Warrior 1 - case 0x23: MCU_RESPONSE(bloodwar_mcu_4_23); break; // Warrior 9 - case 0x24: MCU_RESPONSE(bloodwar_mcu_4_24); break; // Warrior 7 - - // fighter data: pointers to ROM data - case 0x25: MCU_RESPONSE(bloodwar_mcu_4_25); break; // Warrior 1 - case 0x26: MCU_RESPONSE(bloodwar_mcu_4_26); break; // Warrior 2 - case 0x27: MCU_RESPONSE(bloodwar_mcu_4_27); break; // Warrior 3 - case 0x28: MCU_RESPONSE(bloodwar_mcu_4_28); break; // Warrior 4 - case 0x29: MCU_RESPONSE(bloodwar_mcu_4_29); break; // Warrior 5 - case 0x2a: MCU_RESPONSE(bloodwar_mcu_4_2a); break; // Warrior 6 - case 0x2b: MCU_RESPONSE(bloodwar_mcu_4_2b); break; // Warrior 7 - case 0x2c: MCU_RESPONSE(bloodwar_mcu_4_2c); break; // Warrior 8 - case 0x2d: MCU_RESPONSE(bloodwar_mcu_4_2d); break; // Warrior 9 - } - return; - } - - case 0x42: { - memcpy(NVRam, MCURam + MCUOffset, 128); - return; - } - } -} - -static void BonkadvMCURun() -{ - UINT16 *MCURam = (UINT16*)Kaneko16MCURam; - UINT16 *NVRam = (UINT16*)Kaneko16NVRam; - - UINT16 MCUCommand = MCURam[0x10/2]; - UINT16 MCUOffset = MCURam[0x12/2] >> 1; - UINT16 MCUData = MCURam[0x14/2]; - - switch (MCUCommand >> 8) { - case 0x02: { - memcpy(MCURam + MCUOffset, NVRam, 128); - return; - } - - case 0x03: { - MCURam[MCUOffset + 0] = 0xff00 - (Kaneko16Dip[0] << 8); - return; - } - - case 0x04: { - switch (MCUData) { - // static, in this order, at boot/reset - case 0x34: MCU_RESPONSE(bonkadv_mcu_4_34); break; - case 0x30: MCU_RESPONSE(bonkadv_mcu_4_30); break; - case 0x31: MCU_RESPONSE(bonkadv_mcu_4_31); break; - case 0x32: MCU_RESPONSE(bonkadv_mcu_4_32); break; - case 0x33: MCU_RESPONSE(bonkadv_mcu_4_33); break; - - // dynamic, per-level (29), in level order - case 0x00: MCU_RESPONSE(bonkadv_mcu_4_00); break; - case 0x02: MCU_RESPONSE(bonkadv_mcu_4_02); break; - case 0x01: MCU_RESPONSE(bonkadv_mcu_4_01); break; - case 0x05: MCU_RESPONSE(bonkadv_mcu_4_05); break; - case 0x07: MCU_RESPONSE(bonkadv_mcu_4_07); break; - case 0x06: MCU_RESPONSE(bonkadv_mcu_4_06); break; - case 0x09: MCU_RESPONSE(bonkadv_mcu_4_09); break; - case 0x0D: MCU_RESPONSE(bonkadv_mcu_4_0D); break; - case 0x03: MCU_RESPONSE(bonkadv_mcu_4_03); break; - case 0x08: MCU_RESPONSE(bonkadv_mcu_4_08); break; - case 0x04: MCU_RESPONSE(bonkadv_mcu_4_04); break; - case 0x0C: MCU_RESPONSE(bonkadv_mcu_4_0C); break; - case 0x0A: MCU_RESPONSE(bonkadv_mcu_4_0A); break; - case 0x0B: MCU_RESPONSE(bonkadv_mcu_4_0B); break; - case 0x10: MCU_RESPONSE(bonkadv_mcu_4_10); break; - case 0x0E: MCU_RESPONSE(bonkadv_mcu_4_0E); break; - case 0x13: MCU_RESPONSE(bonkadv_mcu_4_13); break; - case 0x0F: MCU_RESPONSE(bonkadv_mcu_4_0F); break; - case 0x11: MCU_RESPONSE(bonkadv_mcu_4_11); break; - case 0x14: MCU_RESPONSE(bonkadv_mcu_4_14); break; - case 0x12: MCU_RESPONSE(bonkadv_mcu_4_12); break; - case 0x17: MCU_RESPONSE(bonkadv_mcu_4_17); break; - case 0x1A: MCU_RESPONSE(bonkadv_mcu_4_1A); break; - case 0x15: MCU_RESPONSE(bonkadv_mcu_4_15); break; - case 0x18: MCU_RESPONSE(bonkadv_mcu_4_18); break; - case 0x16: MCU_RESPONSE(bonkadv_mcu_4_16); break; - case 0x19: MCU_RESPONSE(bonkadv_mcu_4_19); break; - case 0x1B: MCU_RESPONSE(bonkadv_mcu_4_1B); break; - case 0x1C: MCU_RESPONSE(bonkadv_mcu_4_1C); break; - } - return; - } - - case 0x42: { - memcpy(NVRam, MCURam + MCUOffset, 128); - return; - } - - case 0x43: { - // Reset defaults - memcpy(NVRam, bonkadv_mcu_43, sizeof(bonkadv_mcu_43)); - return; - } - } -} - -#undef MCU_RESPONSE - -static void GtmrMCURun() -{ - UINT16 *MCURam = (UINT16*)Kaneko16MCURam; - UINT16 *NVRam = (UINT16*)Kaneko16NVRam; - - UINT16 MCUCommand = MCURam[0x10/2]; - UINT16 MCUOffset = MCURam[0x12/2] >> 1; - - switch (MCUCommand >> 8) { - case 0x02: { - memcpy(MCURam + MCUOffset, NVRam, 128); - return; - } - - case 0x03: { - MCURam[MCUOffset + 0] = 0xff00 - (Kaneko16Dip[0] << 8); - return; - } - - case 0x04: { - /* MCU writes the string "MM0525-TOYBOX199" to shared ram */ - MCURam[MCUOffset + 0] = 0x4d4d; - MCURam[MCUOffset + 1] = 0x3035; - MCURam[MCUOffset + 2] = 0x3235; - MCURam[MCUOffset + 3] = 0x2d54; - MCURam[MCUOffset + 4] = 0x4f59; - MCURam[MCUOffset + 5] = 0x424f; - MCURam[MCUOffset + 6] = 0x5831; - MCURam[MCUOffset + 7] = 0x3939; - return; - } - - case 0x42: { - memcpy(NVRam, MCURam + MCUOffset, 128); - return; - } - } -} - -static void GtmrevoMCURun() -{ - UINT16 *MCURam = (UINT16*)Kaneko16MCURam; - UINT16 *NVRam = (UINT16*)Kaneko16NVRam; - - UINT16 MCUCommand = MCURam[0x10/2]; - UINT16 MCUOffset = MCURam[0x12/2] >> 1; - - switch (MCUCommand >> 8) { - case 0x02: { - memcpy(MCURam + MCUOffset, NVRam, 128); - return; - } - - case 0x03: { - MCURam[MCUOffset + 0] = 0xff00 - (Kaneko16Dip[0] << 8); - return; - } - - case 0x04: { - /* MCU writes the string "USMM0713-TB1994 " to shared ram */ - MCURam[MCUOffset + 0] = 0x5553; - MCURam[MCUOffset + 1] = 0x4d4d; - MCURam[MCUOffset + 2] = 0x3037; - MCURam[MCUOffset + 3] = 0x3133; - MCURam[MCUOffset + 4] = 0x2d54; - MCURam[MCUOffset + 5] = 0x4231; - MCURam[MCUOffset + 6] = 0x3939; - MCURam[MCUOffset + 7] = 0x3420; - return; - } - - case 0x42: { - memcpy(NVRam, MCURam + MCUOffset, 128); - return; - } - } -} - -static void ToyboxMCUComWrite(INT32 which, UINT16 data) -{ - ToyboxMCUCom[which] = data; - if (ToyboxMCUCom[0] != 0xffff) return; - if (ToyboxMCUCom[1] != 0xffff) return; - if (ToyboxMCUCom[2] != 0xffff) return; - if (ToyboxMCUCom[3] != 0xffff) return; - - memset(ToyboxMCUCom, 0, 4 * sizeof(UINT16)); - ToyboxMCURun(); -} - -/*============================================================================================== -Reset Functions -===============================================================================================*/ - -static INT32 Kaneko16DoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - Kaneko16SpriteFlipX = 0; - Kaneko16SpriteFlipY = 0; - Kaneko16DisplayEnable = 0; - memset(Kaneko16SpriteRegs, 0, 0x20 * sizeof(UINT16)); - memset(Kaneko16Layer0Regs, 0, 0x10 * sizeof(UINT16)); - memset(Kaneko16Layer1Regs, 0, 0x10 * sizeof(UINT16)); - - return 0; -} - -static INT32 BerlwallDoReset() -{ - INT32 nRet = Kaneko16DoReset(); - - for (INT32 i = 0; i < 2; i++) { - AY8910Reset(i); - } - - MSM6295Reset(0); - MSM6295Bank0 = 0; - - Kaneko16Bg15Reg = 0; - Kaneko16Bg15Select = 0; - - return nRet; -} - -static INT32 BlazeonDoReset() -{ - INT32 nRet = Kaneko16DoReset(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - - Kaneko16SoundLatch = 0; - - return nRet; -} - -static INT32 ExplbrkrDoReset() -{ - INT32 nRet = Kaneko16DoReset(); - - for (INT32 i = 0; i < 2; i++) { - AY8910Reset(i); - } - - EEPROMReset(); - - MSM6295Reset(0); - MSM6295Bank0 = 0; - - return nRet; -} - -static INT32 GtmrDoReset() -{ - INT32 nRet = Kaneko16DoReset(); - - MSM6295Reset(0); - MSM6295Reset(1); - MSM6295Bank0 = 0; - MSM6295Bank1 = 0; - - ToyboxMCUInit(); - - return nRet; -} - -/*============================================================================================== -Memory Handlers -===============================================================================================*/ - -UINT8 __fastcall BerlwallReadByte(UINT32 a) -{ - switch (a) { - case 0x680000: { - return 0xff - Kaneko16Input[0]; - } - - case 0x680002: { - return 0xff - Kaneko16Input[1]; - } - - case 0x680004: { - return 0xff - Kaneko16Input[2]; - } - - case 0x800001: { - AY8910Write(0, 0, (a - 0x800000) >> 1); - return AY8910Read(0); - } - - case 0x800401: { - return MSM6295ReadStatus(0); - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); -// } - } - - return 0; -} - -void __fastcall BerlwallWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x700000: { - // Coin lockout - return; - } - - case 0x800010: - case 0x800012: - case 0x800014: { - AY8910Write(0, 0, (a - 0x800000) >> 1); - AY8910Write(0, 1, d & 0xff); - return; - } - - case 0x800210: - case 0x800212: - case 0x800214: { - AY8910Write(1, 0, (a - 0x800200) >> 1); - AY8910Write(1, 1, d & 0xff); - return; - } - - - case 0x800401: { - MSM6295Command(0, d & 0xff); - return; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); -// } - } -} - -UINT16 __fastcall BerlwallReadWord(UINT32 a) -{ - switch (a) { - case 0x780000: { - // watchdog reset - return 0; - } - - case 0x80000e: - case 0x80001c: - case 0x80001e: { - AY8910Write(0, 0, (a - 0x800000) >> 1); - return AY8910Read(0); - } - - case 0x80020e: { - AY8910Write(1, 0, (a - 0x800200) >> 1); - return AY8910Read(1); - } - - case 0x8003fe: { - // NOP - return 0; - } - - case 0x800400: { - return MSM6295ReadStatus(0); - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); -// } - } - - return 0; -} - -void __fastcall BerlwallWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x480000: { - // ?? - return; - } - - case 0x500000: { - Kaneko16Bg15Reg = d; - return; - } - - case 0x580000: { - Kaneko16Bg15Select = d; - return; - } - - case 0x800000: - case 0x800002: - case 0x800004: - case 0x800006: - case 0x800008: - case 0x80000a: - case 0x80000c: - case 0x80000e: - case 0x800010: - case 0x800012: - case 0x800014: - case 0x800016: - case 0x800018: - case 0x80001a: { - AY8910Write(0, 0, (a - 0x800000) >> 1); - AY8910Write(0, 1, d & 0xff); - return; - } - - case 0x800200: - case 0x800202: - case 0x800204: - case 0x800206: - case 0x800208: - case 0x80020a: - case 0x80020c: - case 0x80020e: - case 0x800210: - case 0x800212: - case 0x800214: - case 0x800216: - case 0x800218: - case 0x80021a: { - AY8910Write(1, 0, (a - 0x800200) >> 1); - AY8910Write(1, 1, d & 0xff); - return; - } - - case 0x8003fe: { - // NOP - return; - } - - case 0x800400: { - MSM6295Command(0, d & 0xff); - return; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); -// } - } -} - -UINT8 __fastcall BlazeonReadByte(UINT32 a) -{ - switch (a) { - case 0xc00000: { - return 0xff - Kaneko16Input[0]; - } - - case 0xc00001: { - return Kaneko16Dip[0]; - } - - case 0xc00002: { - return 0xff - Kaneko16Input[1]; - } - - case 0xc00003: { - return Kaneko16Dip[1]; - } - - case 0xc00006: { - return 0xff - Kaneko16Input[2]; - } - - case 0xc00007: { - return 0xff; - } - - case 0xec0000: { - // NOP - return 0; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); -// } - } - - return 0; -} - -void __fastcall BlazeonWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xd00000: { - // Coin lockout - return; - } - - case 0xe00000: { - Kaneko16SoundLatch = d; - ZetOpen(0); - ZetNmi(); - ZetClose(); - return; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); -// } - } -} - -UINT16 __fastcall BlazeonReadWord(UINT32 a) -{ - switch (a) { - case 0xc00000: { - SEK_DEF_READ_WORD(0, a); - return 0; - } - - case 0xc00002: { - SEK_DEF_READ_WORD(0, a); - return 0; - } - - case 0xc00004: { - return 0xffff; - } - - case 0xc00006: { - SEK_DEF_READ_WORD(0, a); - return 0; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); -// } - } - - return 0; -} - -void __fastcall BlazeonWriteWord(UINT32 a, UINT16 /*d*/) -{ - switch (a) { - case 0xd00000: { - // Coin lockout - return; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); -// } - } -} - -UINT8 __fastcall ExplbrkrReadByte(UINT32 a) -{ - switch (a) { - case 0x400001: { - AY8910Write(0, 0, (a - 0x400000) >> 1); - return AY8910Read(0); - } - - case 0x40021d: { - AY8910Write(1, 0, (a - 0x400200) >> 1); - return AY8910Read(1); - } - - case 0x400401: { - return MSM6295ReadStatus(0); - } - - case 0xe00000: { - return 0xff - Kaneko16Input[0]; - } - - case 0xe00001: { - return Kaneko16Dip[0]; - } - - case 0xe00002: { - return 0xff - Kaneko16Input[1]; - } - - case 0xe00004: { - return 0xff - Kaneko16Input[2]; - } - - case 0xe00006: { - return 0xff; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); -// } - } - - return 0; -} - -void __fastcall ExplbrkrWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x40000f: - case 0x400010: - case 0x400012: - case 0x400014: { - AY8910Write(0, 0, (a - 0x400000) >> 1); - AY8910Write(0, 1, d & 0xff); - return; - } - - case 0x40020f: - case 0x400210: - case 0x400212: - case 0x400214: - case 0x40021f: { - AY8910Write(1, 0, (a - 0x400200) >> 1); - AY8910Write(1, 1, d & 0xff); - return; - } - - case 0x400401: { - MSM6295Command(0, d & 0xff); - return; - } - - case 0xd00000: return; - - case 0xd00001: { - EEPROMWriteBit(d & 0x02); - EEPROMSetClockLine((d & 0x01) ? EEPROM_ASSERT_LINE : EEPROM_CLEAR_LINE ); - return; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); -// } - } -} - -UINT16 __fastcall ExplbrkrReadWord(UINT32 a) -{ - switch (a) { - case 0xa00000: { - // Magical crystals Watchdog reset - return 0; - } - - case 0xa80000: { - // Watchdog reset - return 0; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); -// } - } - - return 0; -} - -void __fastcall ExplbrkrWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x400000: - case 0x400002: - case 0x400004: - case 0x400006: - case 0x400008: - case 0x40000a: - case 0x40000c: - case 0x40000e: - case 0x400010: - case 0x400012: - case 0x400014: - case 0x400016: - case 0x400018: - case 0x40001a: - case 0x40001c: { - AY8910Write(0, 0, (a - 0x400000) >> 1); - AY8910Write(0, 1, d & 0xff); - return; - } - - case 0x40001e: { - if (Mgcrystl) { - AY8910Write(0, 0, (a - 0x400000) >> 1); - AY8910Write(0, 1, d & 0xff); - } else { - MSM6295Bank0 = d & 7; - memcpy(MSM6295ROM + 0x0000000, MSM6295ROMData + (0x40000 * (d & 7)), 0x40000); - } - return; - } - - case 0x400200: - case 0x400202: - case 0x400204: - case 0x400206: - case 0x400208: - case 0x40020a: - case 0x40020c: - case 0x40020e: - case 0x400210: - case 0x400212: - case 0x400214: - case 0x400216: - case 0x400218: - case 0x40021a: - case 0x40021c: - case 0x40021e: { - AY8910Write(1, 0, (a - 0x400200) >> 1); - AY8910Write(1, 1, d & 0xff); - return; - } - - case 0x900000: { - Kaneko16SpriteRegs[0] = d; - if (d & 0xff) { - Kaneko16SpriteFlipX = d & 2; - Kaneko16SpriteFlipY = d & 1; - } - return; - } - - case 0xd00000: { - SEK_DEF_WRITE_WORD(0, a, d); - return; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); -// } - } -} - -UINT8 __fastcall MgcrystlReadByte(UINT32 a) -{ - switch (a) { - case 0x400001: { - AY8910Write(0, 0, (a - 0x400000) >> 1); - return AY8910Read(0); - } - - case 0x40021d: { - AY8910Write(1, 0, (a - 0x400200) >> 1); - return AY8910Read(1); - } - - case 0x400401: { - return MSM6295ReadStatus(0); - } - - case 0xc00000: { - return 0xff - Kaneko16Input[0]; - } - - case 0xc00001: { - return Kaneko16Dip[0]; - } - - case 0xc00002: { - return 0x3f - Kaneko16Input[1]; - } - - case 0xc00004: { - return 0xff - Kaneko16Input[2]; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); -// } - } - - return 0; -} - -UINT8 __fastcall GtmrReadByte(UINT32 a) -{ - switch (a) { - case 0x900014: { - if (Gtmr) return rand() & 0xff; - return 0; - } - - case 0x900015: { - if (Bonkadv) return BonkadvCalcRead((a - 0x900000) >> 1); - return 0; - } - - case 0xb00000: { - return 0xff - Kaneko16Input[0]; - } - - case 0xb00002: { - return 0xff - Kaneko16Input[1]; - } - - case 0xb00004: { - return 0xff - Kaneko16Input[2]; - } - - case 0xb00006: { - return 0xff - Kaneko16Input[3]; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); -// } - } - - return 0; -} - -void __fastcall GtmrWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x600000: - case 0x600002: - case 0x600004: - case 0x600006: - case 0x600008: - case 0x600009: - case 0x60000a: - case 0x60000b: - case 0x60000c: - case 0x60000e: - case 0x600010: - case 0x600012: - case 0x600014: - case 0x600016: - case 0x600018: - case 0x60001a: - case 0x60001c: - case 0x60001e: { - Kaneko16Layer0Regs[(a - 0x600000) >> 1] = d; - return; - } - - case 0x680000: - case 0x680002: - case 0x680004: - case 0x680006: - case 0x680008: - case 0x680009: - case 0x68000a: - case 0x68000b: - case 0x68000c: - case 0x68000e: - case 0x680010: - case 0x680012: - case 0x680014: - case 0x680016: - case 0x680018: - case 0x68001a: - case 0x68001c: - case 0x68001e: { - Kaneko16Layer1Regs[(a - 0x680000) >> 1] = d; - return; - } - - case 0x700000: - case 0x700002: - case 0x700004: - case 0x700006: - case 0x700008: - case 0x70000a: - case 0x70000c: - case 0x70000e: - case 0x700010: - case 0x700012: - case 0x700014: - case 0x700016: - case 0x700018: - case 0x70001a: - case 0x70001c: - case 0x70001e: { - UINT32 offset = (a - 0x700000) >> 1; - Kaneko16SpriteRegs[offset] = d; - if (offset == 0 && (d & 0xff)) { - Kaneko16SpriteFlipX = d & 2; - Kaneko16SpriteFlipY = d & 1; - } - return; - } - - case 0x800001: { - MSM6295Command(0, d); - return; - } - - case 0x880001: { - MSM6295Command(1, d); - return; - } - - case 0xb80000: { - // Coin lockout - return; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); -// } - } -} - -UINT16 __fastcall GtmrReadWord(UINT32 a) -{ - switch (a) { - case 0x800000: { - return MSM6295ReadStatus(0); - } - - case 0x880000: { - return MSM6295ReadStatus(1); - } - - case 0x900000: - case 0x900002: - case 0x900004: - case 0x900006: - case 0x900008: - case 0x90000a: - case 0x90000c: - case 0x90000e: - case 0x900010: - case 0x900012: - case 0x900014: - case 0x900016: - case 0x900018: - case 0x90001a: - case 0x90001c: - case 0x90001e: - case 0x900020: - case 0x900022: - case 0x900024: - case 0x900026: - case 0x900028: - case 0x90002a: - case 0x90002c: - case 0x90002e: - case 0x900030: - case 0x900032: - case 0x900034: - case 0x900036: - case 0x900038: { - if (Bloodwar) return BloodwarCalcRead((a - 0x900000) >> 1); - if (Bonkadv) return BonkadvCalcRead((a - 0x900000) >> 1); - if (Gtmr) return rand() & 0xffff; - return 0; - } - - case 0xa00000: { - // Watchdog read - return 0; - } - - case 0xb00000: { - return 0xff00 - (Kaneko16Input[0] << 8); - } - - case 0xb00002: { - return 0xff00 - (Kaneko16Input[1] << 8); - } - - case 0xb00004: { - return 0xff00 - (Kaneko16Input[2] << 8); - } - - case 0xb00006: { - return 0xffff; - } - - case 0xd00000: { - return ToyboxMCUStatusRead(); - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); -// } - } - - return 0; -} - -void __fastcall GtmrWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x2a0000: { - ToyboxMCUComWrite(0, d); - return; - } - - case 0x2b0000: { - ToyboxMCUComWrite(1, d); - return; - } - - case 0x2c0000: { - ToyboxMCUComWrite(2, d); - return; - } - - case 0x2d0000: { - ToyboxMCUComWrite(3, d); - return; - } - - case 0x700000: { - Kaneko16SpriteRegs[0] = d; - if (d & 0xff) { - Kaneko16SpriteFlipX = d & 2; - Kaneko16SpriteFlipY = d & 1; - } - return; - } - - case 0x800000: { - MSM6295Command(0, d); - return; - } - - case 0x880000: { - MSM6295Command(1, d); - return; - } - - case 0x900000: - case 0x900002: - case 0x900004: - case 0x900006: - case 0x900008: - case 0x90000a: - case 0x90000c: - case 0x90000e: - case 0x900010: - case 0x900012: - case 0x900014: - case 0x900016: - case 0x900018: - case 0x90001a: - case 0x90001c: - case 0x90001e: - case 0x900020: - case 0x900022: - case 0x900024: - case 0x900026: - case 0x900028: - case 0x90002a: - case 0x90002c: - case 0x90002e: - case 0x900030: - case 0x900032: - case 0x900034: - case 0x900036: - case 0x900038: { - if (Bonkadv) BonkadvCalcWrite((a - 0x900000) >> 1, d); - if (Bloodwar) BloodwarCalcWrite((a - 0x900000) >> 1, d); - return; - } - - case 0xa00000: { - // Watchdog write - return; - } - - case 0xb80000: { - // Coin lockout - return; - } - - case 0xc00000: { - Kaneko16DisplayEnable = d; - return; - } - - case 0xe00000: { - MSM6295Bank0 = d & 0xf; - memcpy(MSM6295ROM + 0x0000000, MSM6295ROMData + (0x40000 * (d & 0x0f)),0x40000); - return; - } - - case 0xe80000: { - if (Gtmr) { - MSM6295Bank1 = d & 1; - memcpy(MSM6295ROM + 0x0100000, MSM6295ROMData2 + (0x40000 * (d & 0x01)),0x40000); - } else { - MSM6295Bank1 = d; - memcpy(MSM6295ROM + 0x0100000, MSM6295ROMData2 + (0x40000 * d),0x40000); - } - return; - } - -// default: { -// bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); -// } - } -} - -UINT8 __fastcall Kaneko16Z80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x03: { - return BurnYM2151ReadStatus(); - } - - case 0x06: { - return Kaneko16SoundLatch; - } - } - - return 0; -} - -void __fastcall Kaneko16Z80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x02: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x03: { - BurnYM2151WriteRegister(d); - return; - } - } -} - -/*============================================================================================== -Sound Chip Handlers -===============================================================================================*/ - -static UINT8 Kaneko16EepromRead(UINT32 /*a*/) -{ - return EEPROMRead() & 0x01; -} - -static void Kaneko16EepromReset(UINT32 /*a*/, UINT32 d) -{ - EEPROMSetCSLine((d & 0x01) ? EEPROM_CLEAR_LINE : EEPROM_ASSERT_LINE ); -} - -static UINT8 Kaneko16Dip0Read(UINT32 /*a*/) -{ - return Kaneko16Dip[0]; -} - -static UINT8 Kaneko16Dip1Read(UINT32 /*a*/) -{ - return Kaneko16Dip[1]; -} - -/*============================================================================================== -Driver Inits -===============================================================================================*/ - -static void Kaneko16VideoInit() -{ - GenericTilesInit(); - - spritelist.first_sprite = (struct tempsprite *)BurnMalloc(0x400 * sizeof(spritelist.first_sprite[0])); - - Kaneko16ParseSprite = Kaneko16ParseSpriteType0; - - Kaneko16SpritesColourOffset = 0; - Kaneko16SpritesColourMask = 0x0fff; - Kaneko168BppSprites = 0; - if (Gtmr || Bloodwar || Bonkadv) { - Kaneko16SpritesColourOffset = 0x4000; - Kaneko16SpritesColourMask = 0xffff; - Kaneko168BppSprites = 1; - } - - Kaneko16SpriteXOffset = 0; - Kaneko16SpriteRamSize = 0x2000; - - Kaneko16LayersColourOffset = 0x40 * 16; - if (Gtmr || Bloodwar || Bonkadv) Kaneko16LayersColourOffset = 0; - Kaneko16TilesXOffset = 0; - if (nScreenWidth == 256) Kaneko16TilesXOffset = 0x5b; - if (nScreenWidth == 320) Kaneko16TilesXOffset = 0x33; - Kaneko16TilesYOffset = 0; - if (nScreenHeight == 224 || nScreenHeight == 232) Kaneko16TilesYOffset = -0x08; - - Kaneko16Bg15 = 0; - Kaneko16Bg15Reg = 0; - Kaneko16Bg15Select = 0; - Kaneko16RecalcBg15Palette = 0; -} - -static INT32 GtmrMachineInit() -{ - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Kaneko16Rom , 0x000000, 0x0ffffd, SM_ROM); - SekMapMemory(Kaneko16Ram , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(Kaneko16MCURam , 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(Kaneko16PaletteRam , 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(Kaneko16Ram + 0x10000, 0x310000, 0x327fff, SM_RAM); - SekMapMemory(Kaneko16SpriteRam , 0x400000, 0x401fff, SM_RAM); - SekMapMemory(Kaneko16Video1Ram , 0x500000, 0x500fff, SM_RAM); - SekMapMemory(Kaneko16Video0Ram , 0x501000, 0x501fff, SM_RAM); - SekMapMemory(Kaneko16VScrl1Ram , 0x502000, 0x502fff, SM_RAM); - SekMapMemory(Kaneko16VScrl0Ram , 0x503000, 0x503fff, SM_RAM); - SekMapMemory(Kaneko16Video3Ram , 0x580000, 0x580fff, SM_RAM); - SekMapMemory(Kaneko16Video2Ram , 0x581000, 0x581fff, SM_RAM); - SekMapMemory(Kaneko16VScrl3Ram , 0x582000, 0x582fff, SM_RAM); - SekMapMemory(Kaneko16VScrl2Ram , 0x583000, 0x583fff, SM_RAM); - SekMapMemory((UINT8*)Kaneko16Layer0Regs , 0x600000, 0x60001f, SM_WRITE); - SekMapMemory((UINT8*)Kaneko16Layer1Regs , 0x680000, 0x68001f, SM_WRITE); - SekMapMemory((UINT8*)Kaneko16SpriteRegs + 2, 0x700002, 0x70001f, SM_WRITE); - SekSetReadByteHandler(0, GtmrReadByte); - SekSetReadWordHandler(0, GtmrReadWord); - SekSetWriteByteHandler(0, GtmrWriteByte); - SekSetWriteWordHandler(0, GtmrWriteWord); - SekClose(); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 1980000 / 165, 0); - MSM6295Init(1, 1980000 / 165, 0); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); - - return 0; -} - -static INT32 FourBppPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 FourBppXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; -static INT32 FourBppYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; -static INT32 EightBppPlaneOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 EightBppXOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 512, 520, 528, 536, 544, 552, 560, 568 }; -static INT32 EightBppYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472 }; - -static INT32 BerlwallInit() -{ - INT32 nRet = 0, nLen; - - Kaneko16NumSprites = 0x2400; - Kaneko16NumTiles = 0x1000; - Kaneko16NumTiles2 = 0; - - Kaneko16VideoInit(); - Kaneko16ParseSprite = Kaneko16ParseSpriteType2; - Kaneko16Bg15 = 1; - Kaneko16RecalcBg15Palette = 1; - - // Allocate and Blank all required memory - Mem = NULL; - ExplbrkrMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - ExplbrkrMemIndex(); - - Kaneko16TempGfx = (UINT8*)BurnMalloc(0x400000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0080000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0100000, 4, 1); if (nRet != 0) return 1; - GfxDecode(Kaneko16NumSprites, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Sprites); - - // Load and Decode Tile Roms - memset(Kaneko16TempGfx, 0, 0x400000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 5, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x080000); - GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); - - // Load bitmap roms - memset(Kaneko16TempGfx, 0, 0x400000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000001, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x100000, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x100001, 9, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x200000, 10, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x200001, 11, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x300000, 12, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x300001, 13, 2); if (nRet != 0) return 1; - Kaneko16DecodeBg15Bitmaps(); - BurnFree(Kaneko16TempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 14, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROMData, MSM6295ROM, 0x40000); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Kaneko16Rom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Kaneko16Ram , 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(Kaneko16SpriteRam , 0x30e000, 0x30ffff, SM_RAM); - SekMapMemory(Kaneko16PaletteRam , 0x400000, 0x400fff, SM_RAM); - SekMapMemory(Kaneko16Video1Ram , 0xc00000, 0xc00fff, SM_RAM); - SekMapMemory(Kaneko16Video0Ram , 0xc01000, 0xc01fff, SM_RAM); - SekMapMemory(Kaneko16VScrl1Ram , 0xc02000, 0xc02fff, SM_RAM); - SekMapMemory(Kaneko16VScrl0Ram , 0xc03000, 0xc03fff, SM_RAM); - SekMapMemory((UINT8*)Kaneko16Layer0Regs , 0xd00000, 0xd0001f, SM_WRITE); - SekMapMemory((UINT8*)Kaneko16SpriteRegs + 2, 0x600002, 0x60003f, SM_WRITE); - SekSetReadByteHandler(0, BerlwallReadByte); - SekSetReadWordHandler(0, BerlwallReadWord); - SekSetWriteByteHandler(0, BerlwallWriteByte); - SekSetWriteWordHandler(0, BerlwallWriteWord); - SekClose(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - - AY8910Init(0, 2000000, nBurnSoundRate, &Kaneko16Dip0Read, &Kaneko16Dip1Read, NULL, NULL); - AY8910Init(1, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 1.00, BURN_SND_ROUTE_BOTH); - - // Setup the OKIM6295 emulation - MSM6295Init(0, (12000000 / 6) / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - Kaneko16FrameRender = BerlwallFrameRender; - - // Reset the driver - BerlwallDoReset(); - - return 0; -} - -static INT32 BlazeonInit() -{ - INT32 nRet = 0, nLen; - - Kaneko16NumSprites = 0x4000; - Kaneko16NumTiles = 0x2000; - Kaneko16NumTiles2 = 0; - - Kaneko16VideoInit(); - Kaneko16SpriteRamSize = 0x1000; - Kaneko16SpriteXOffset = 0x10000 - 0x680; - - // Allocate and Blank all required memory - Mem = NULL; - BlazeonMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - BlazeonMemIndex(); - - Kaneko16TempGfx = (UINT8*)BurnMalloc(0x200000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0100000, 3, 1); if (nRet != 0) return 1; - GfxDecode(Kaneko16NumSprites, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Sprites); - - // Load and Decode Tile Roms - memset(Kaneko16TempGfx, 0, 0x200000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 4, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x100000); - GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); - - BurnFree(Kaneko16TempGfx); - - // Load Z80 Rom - nRet = BurnLoadRom(Kaneko16Z80Rom, 5, 1); if (nRet != 0) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Kaneko16Rom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Kaneko16Ram , 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(Kaneko16PaletteRam , 0x500000, 0x500fff, SM_RAM); - SekMapMemory(Kaneko16Video1Ram , 0x600000, 0x600fff, SM_RAM); - SekMapMemory(Kaneko16Video0Ram , 0x601000, 0x601fff, SM_RAM); - SekMapMemory(Kaneko16VScrl1Ram , 0x602000, 0x602fff, SM_RAM); - SekMapMemory(Kaneko16VScrl0Ram , 0x603000, 0x603fff, SM_RAM); - SekMapMemory(Kaneko16SpriteRam , 0x700000, 0x700fff, SM_RAM); - SekMapMemory((UINT8*)Kaneko16Layer0Regs , 0x800000, 0x80000f, SM_WRITE); - SekMapMemory((UINT8*)Kaneko16SpriteRegs + 2, 0x900002, 0x90001f, SM_WRITE); - SekSetReadByteHandler(0, BlazeonReadByte); - SekSetReadWordHandler(0, BlazeonReadWord); - SekSetWriteByteHandler(0, BlazeonWriteByte); - SekSetWriteWordHandler(0, BlazeonWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, Kaneko16Z80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, Kaneko16Z80Rom ); - ZetMapArea(0xc000, 0xdfff, 0, Kaneko16Z80Ram ); - ZetMapArea(0xc000, 0xdfff, 1, Kaneko16Z80Ram ); - ZetMapArea(0xc000, 0xdfff, 2, Kaneko16Z80Ram ); - ZetMemEnd(); - ZetSetInHandler(Kaneko16Z80PortRead); - ZetSetOutHandler(Kaneko16Z80PortWrite); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(4000000); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - Kaneko16FrameRender = BlazeonFrameRender; - - // Reset the driver - BlazeonDoReset(); - - return 0; -} - -static INT32 BloodwarInit() -{ - INT32 nRet = 0, nLen; - - Bloodwar = 1; - - Kaneko16NumSprites = 0x1e000; - Kaneko16NumTiles = 0x2000; - Kaneko16NumTiles2 = 0x2000; - - Kaneko16VideoInit(); - Kaneko16ParseSprite = Kaneko16ParseSpriteType1; - - // Allocate and Blank all required memory - Mem = NULL; - GtmrMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - GtmrMemIndex(); - - Kaneko16TempGfx = (UINT8*)BurnMalloc(0x1e00000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0200000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0400000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0600000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0800000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0a00000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0c00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0e00000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1000000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1200000, 12, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1200001, 13, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1400000, 14, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1400001, 15, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1600000, 16, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1600001, 17, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1800000, 18, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1800001, 19, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1a00000, 20, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1a00001, 21, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1c00000, 22, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x1c00001, 23, 2); if (nRet != 0) return 1; - GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); - - // Load and Decode Tile Roms - memset(Kaneko16TempGfx, 0, 0x1e00000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 24, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x100000); - GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); - memset(Kaneko16TempGfx, 0, 0x1e00000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 25, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x100000); - GfxDecode(Kaneko16NumTiles2, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles2); - BurnFree(Kaneko16TempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROMData, 26, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROMData2, 27, 1); if (nRet != 0) return 1; - ExpandSampleBanks(); - - ToyboxMCURun = BloodwarMCURun; - Kaneko16FrameRender = BloodwarFrameRender; - - nRet = GtmrMachineInit(); if (nRet != 0) return 1; - - // Reset the driver - GtmrDoReset(); - - return 0; -} - -static INT32 BonkadvInit() -{ - INT32 nRet = 0, nLen; - - Bonkadv = 1; - - Kaneko16NumSprites = 0x5000; - Kaneko16NumTiles = 0x4000; - Kaneko16NumTiles2 = 0x4000; - - Kaneko16VideoInit(); - Kaneko16ParseSprite = Kaneko16ParseSpriteType1; - - // Allocate and Blank all required memory - Mem = NULL; - GtmrMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - GtmrMemIndex(); - - Kaneko16TempGfx = (UINT8*)BurnMalloc(0x500000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0200000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0300000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0400000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0400001, 7, 2); if (nRet != 0) return 1; - GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); - - // Load and Decode Tile Roms - memset(Kaneko16TempGfx, 0, 0x500000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 8, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x100000); - GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); - memset(Kaneko16TempGfx, 0, 0x500000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 9, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x100000); - GfxDecode(Kaneko16NumTiles2, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles2); - BurnFree(Kaneko16TempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROMData, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROMData2, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROMData2 + 0x100000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROMData2 + 0x200000, 13, 1); if (nRet != 0) return 1; - ExpandSampleBanks(); - - ToyboxMCURun = BonkadvMCURun; - Kaneko16FrameRender = BloodwarFrameRender; - - nRet = GtmrMachineInit(); if (nRet != 0) return 1; - - // Reset the driver - GtmrDoReset(); - - return 0; -} - -static INT32 ExplbrkrInit() -{ - INT32 nRet = 0, nLen; - - Kaneko16NumSprites = 0x4800; - Kaneko16NumTiles = 0x2000; - Kaneko16NumTiles2 = 0x2000; - - Kaneko16VideoInit(); - - // Allocate and Blank all required memory - Mem = NULL; - ExplbrkrMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - ExplbrkrMemIndex(); - - Kaneko16TempGfx = (UINT8*)BurnMalloc(0x240000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0080000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0100000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0180000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0200000, 4, 1); if (nRet != 0) return 1; - GfxDecode(Kaneko16NumSprites, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Sprites); - - // Load and Decode Tile Roms - memset(Kaneko16TempGfx, 0, 0x240000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 5, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x100000); - GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); - memset(Kaneko16TempGfx, 0, 0x240000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 6, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x100000); - GfxDecode(Kaneko16NumTiles2, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles2); - - // Load Sample Rom - memset(Kaneko16TempGfx, 0, 0x240000); - nRet = BurnLoadRom(Kaneko16TempGfx, 7, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROMData + 0x000000, Kaneko16TempGfx + 0x000000, 0x20000); - memcpy(MSM6295ROMData + 0x020000, Kaneko16TempGfx + 0x020000, 0x20000); - memcpy(MSM6295ROMData + 0x040000, Kaneko16TempGfx + 0x000000, 0x20000); - memcpy(MSM6295ROMData + 0x060000, Kaneko16TempGfx + 0x040000, 0x20000); - memcpy(MSM6295ROMData + 0x080000, Kaneko16TempGfx + 0x000000, 0x20000); - memcpy(MSM6295ROMData + 0x0a0000, Kaneko16TempGfx + 0x060000, 0x20000); - memcpy(MSM6295ROMData + 0x0c0000, Kaneko16TempGfx + 0x000000, 0x20000); - memcpy(MSM6295ROMData + 0x0e0000, Kaneko16TempGfx + 0x080000, 0x20000); - memcpy(MSM6295ROMData + 0x100000, Kaneko16TempGfx + 0x000000, 0x20000); - memcpy(MSM6295ROMData + 0x120000, Kaneko16TempGfx + 0x0a0000, 0x20000); - memcpy(MSM6295ROMData + 0x140000, Kaneko16TempGfx + 0x000000, 0x20000); - memcpy(MSM6295ROMData + 0x160000, Kaneko16TempGfx + 0x0c0000, 0x20000); - memcpy(MSM6295ROMData + 0x180000, Kaneko16TempGfx + 0x000000, 0x20000); - memcpy(MSM6295ROMData + 0x1a0000, Kaneko16TempGfx + 0x0e0000, 0x20000); - BurnFree(Kaneko16TempGfx); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Kaneko16Rom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Kaneko16Ram , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(Kaneko16Video1Ram , 0x500000, 0x500fff, SM_RAM); - SekMapMemory(Kaneko16Video0Ram , 0x501000, 0x501fff, SM_RAM); - SekMapMemory(Kaneko16VScrl1Ram , 0x502000, 0x502fff, SM_RAM); - SekMapMemory(Kaneko16VScrl0Ram , 0x503000, 0x503fff, SM_RAM); - SekMapMemory(Kaneko16Video3Ram , 0x580000, 0x580fff, SM_RAM); - SekMapMemory(Kaneko16Video2Ram , 0x581000, 0x581fff, SM_RAM); - SekMapMemory(Kaneko16VScrl3Ram , 0x582000, 0x582fff, SM_RAM); - SekMapMemory(Kaneko16VScrl2Ram , 0x583000, 0x583fff, SM_RAM); - SekMapMemory(Kaneko16SpriteRam , 0x600000, 0x601fff, SM_RAM); - SekMapMemory(Kaneko16PaletteRam , 0x700000, 0x700fff, SM_RAM); - SekMapMemory((UINT8*)Kaneko16Layer0Regs , 0x800000, 0x80001f, SM_WRITE); - SekMapMemory((UINT8*)Kaneko16SpriteRegs + 2, 0x900002, 0x90001f, SM_WRITE); - SekMapMemory((UINT8*)Kaneko16Layer1Regs , 0xb00000, 0xb0001f, SM_WRITE); - SekSetReadByteHandler(0, ExplbrkrReadByte); - SekSetReadWordHandler(0, ExplbrkrReadWord); - SekSetWriteByteHandler(0, ExplbrkrWriteByte); - SekSetWriteWordHandler(0, ExplbrkrWriteWord); - SekClose(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - - Kaneko16Eeprom = 1; - EEPROMInit(&eeprom_interface_93C46); - - AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 2000000, nBurnSoundRate, &Kaneko16EepromRead, NULL, NULL, &Kaneko16EepromReset); - - // Setup the OKIM6295 emulation - MSM6295Init(0, (12000000 / 6) / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - Kaneko16FrameRender = ExplbrkrFrameRender; - - // Reset the driver - ExplbrkrDoReset(); - - return 0; -} - -static INT32 GtmrInit() -{ - INT32 nRet = 0, nLen; - - Gtmr = 1; - - Kaneko16NumSprites = 0x8400; - Kaneko16NumTiles = 0x4000; - Kaneko16NumTiles2 = 0x4000; - - Kaneko16VideoInit(); - Kaneko16ParseSprite = Kaneko16ParseSpriteType1; - - // Allocate and Blank all required memory - Mem = NULL; - GtmrMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - GtmrMemIndex(); - - Kaneko16TempGfx = (UINT8*)BurnMalloc(0x840000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x200000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x600000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x800001, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x800000, 8, 2); if (nRet != 0) return 1; - GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); - - // Load and Decode Tile Roms - memset(Kaneko16TempGfx, 0, 0x840000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 9, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x200000); - GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); - BurnFree(Kaneko16TempGfx); - memcpy(Kaneko16Tiles2, Kaneko16Tiles, Kaneko16NumTiles * 16 * 16); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROMData, 10, 1); if (nRet != 0) return 1; - ExpandSampleBanks(); - - ToyboxMCURun = GtmrMCURun; - Kaneko16FrameRender = GtmrFrameRender; - - nRet = GtmrMachineInit(); if (nRet != 0) return 1; - - // Reset the driver - GtmrDoReset(); - - return 0; -} - -static INT32 GtmrevoInit() -{ - INT32 nRet = 0, nLen; - - Gtmr = 1; - - Kaneko16NumSprites = 0x8000; - Kaneko16NumTiles = 0x4000; - Kaneko16NumTiles2 = 0x4000; - - Kaneko16VideoInit(); - Kaneko16ParseSprite = Kaneko16ParseSpriteType1; - - // Allocate and Blank all required memory - Mem = NULL; - GtmrMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - GtmrMemIndex(); - - Kaneko16TempGfx = (UINT8*)BurnMalloc(0x800000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(Kaneko16TempGfx + 0x600000, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x600001, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x200000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x600000, 6, 1); if (nRet != 0) return 1; - GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); - - // Load and Decode Tile Roms - memset(Kaneko16TempGfx, 0, 0x800000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 9, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x200000); - GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); - BurnFree(Kaneko16TempGfx); - memcpy(Kaneko16Tiles2, Kaneko16Tiles, Kaneko16NumTiles * 16 * 16); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROMData, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROMData2, 11, 1); if (nRet != 0) return 1; - ExpandSampleBanks(); - - nRet = GtmrMachineInit(); if (nRet != 0) return 1; - - ToyboxMCURun = GtmrevoMCURun; - Kaneko16FrameRender = GtmrFrameRender; - - // Reset the driver - GtmrDoReset(); - - return 0; -} - -static INT32 Gtmr2Init() -{ - INT32 nRet = 0, nLen; - - Gtmr = 1; - - Kaneko16NumSprites = 0x8000; - Kaneko16NumTiles = 0x8800; - Kaneko16NumTiles2 = 0x8800; - - Kaneko16VideoInit(); - Kaneko16ParseSprite = Kaneko16ParseSpriteType1; - - // Allocate and Blank all required memory - Mem = NULL; - GtmrMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - GtmrMemIndex(); - - Kaneko16TempGfx = (UINT8*)BurnMalloc(0x800000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x600000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x700000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x700001, 7, 2); if (nRet != 0) return 1; - GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); - - // Load and Decode Tile Roms - memset(Kaneko16TempGfx, 0, 0x800000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x200000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 10, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x400001, 11, 2); if (nRet != 0) return 1; - UnscrambleTiles(0x440000); - GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); - BurnFree(Kaneko16TempGfx); - memcpy(Kaneko16Tiles2, Kaneko16Tiles, Kaneko16NumTiles * 16 * 16); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROMData, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROMData2 + 0x40000, 13, 1); if (nRet != 0) return 1; - ExpandSampleBanks(); - - nRet = GtmrMachineInit(); if (nRet != 0) return 1; - - ToyboxMCURun = GtmrevoMCURun; - Kaneko16FrameRender = GtmrFrameRender; - - // Reset the driver - GtmrDoReset(); - - return 0; -} - -static INT32 Gtmr2uInit() -{ - INT32 nRet = 0, nLen; - - Gtmr = 1; - - Kaneko16NumSprites = 0x8000; - Kaneko16NumTiles = 0x8800; - Kaneko16NumTiles2 = 0x8800; - - Kaneko16VideoInit(); - Kaneko16ParseSprite = Kaneko16ParseSpriteType1; - - // Allocate and Blank all required memory - Mem = NULL; - GtmrMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - GtmrMemIndex(); - - Kaneko16TempGfx = (UINT8*)BurnMalloc(0x800000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x600000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x700000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x700001, 7, 2); if (nRet != 0) return 1; - GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); - - // Load and Decode Tile Roms - memset(Kaneko16TempGfx, 0, 0x800000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x200000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 10, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x400001, 11, 2); if (nRet != 0) return 1; - UnscrambleTiles(0x440000); - GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); - BurnFree(Kaneko16TempGfx); - memcpy(Kaneko16Tiles2, Kaneko16Tiles, Kaneko16NumTiles * 16 * 16); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROMData, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROMData2, 13, 1); if (nRet != 0) return 1; - ExpandSampleBanks(); - - nRet = GtmrMachineInit(); if (nRet != 0) return 1; - - ToyboxMCURun = GtmrevoMCURun; - Kaneko16FrameRender = GtmrFrameRender; - - // Reset the driver - GtmrDoReset(); - - return 0; -} - -static INT32 MgcrystlInit() -{ - INT32 nRet = 0, nLen; - - Mgcrystl = 1; - - Kaneko16NumSprites = 0x5000; - Kaneko16NumTiles = 0x2000; - Kaneko16NumTiles2 = 0x2000; - - Kaneko16VideoInit(); - - // Allocate and Blank all required memory - Mem = NULL; - ExplbrkrMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - ExplbrkrMemIndex(); - - Kaneko16TempGfx = (UINT8*)BurnMalloc(0x280000); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and Decode Sprite Roms - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0100000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0180000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0200000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0220000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0240000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Kaneko16TempGfx + 0x0260000, 4, 1); if (nRet != 0) return 1; - GfxDecode(Kaneko16NumSprites, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Sprites); - - // Load and Decode Tile Roms - memset(Kaneko16TempGfx, 0, 0x280000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 5, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x100000); - GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); - memset(Kaneko16TempGfx, 0, 0x280000); - nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 6, 1); if (nRet != 0) return 1; - UnscrambleTiles(0x100000); - GfxDecode(Kaneko16NumTiles2, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles2); - BurnFree(Kaneko16TempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 7, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROMData, MSM6295ROM, 0x40000); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Kaneko16Rom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Kaneko16Ram , 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(Kaneko16PaletteRam , 0x500000, 0x500fff, SM_RAM); - SekMapMemory(Kaneko16Video1Ram , 0x600000, 0x600fff, SM_RAM); - SekMapMemory(Kaneko16Video0Ram , 0x601000, 0x601fff, SM_RAM); - SekMapMemory(Kaneko16VScrl1Ram , 0x602000, 0x602fff, SM_RAM); - SekMapMemory(Kaneko16VScrl0Ram , 0x603000, 0x603fff, SM_RAM); - SekMapMemory(Kaneko16Video3Ram , 0x680000, 0x680fff, SM_RAM); - SekMapMemory(Kaneko16Video2Ram , 0x681000, 0x681fff, SM_RAM); - SekMapMemory(Kaneko16VScrl3Ram , 0x682000, 0x682fff, SM_RAM); - SekMapMemory(Kaneko16VScrl2Ram , 0x683000, 0x683fff, SM_RAM); - SekMapMemory(Kaneko16SpriteRam , 0x700000, 0x701fff, SM_RAM); - SekMapMemory((UINT8*)Kaneko16Layer0Regs , 0x800000, 0x80001f, SM_WRITE); - SekMapMemory((UINT8*)Kaneko16SpriteRegs + 2, 0x900002, 0x90001f, SM_WRITE); - SekMapMemory((UINT8*)Kaneko16Layer1Regs , 0xb00000, 0xb0001f, SM_WRITE); - SekSetReadByteHandler(0, MgcrystlReadByte); - SekSetReadWordHandler(0, ExplbrkrReadWord); - SekSetWriteByteHandler(0, ExplbrkrWriteByte); - SekSetWriteWordHandler(0, ExplbrkrWriteWord); - SekClose(); - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - - Kaneko16Eeprom = 1; - EEPROMInit(&eeprom_interface_93C46); - - AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910Init(1, 2000000, nBurnSoundRate, &Kaneko16EepromRead, NULL, NULL, &Kaneko16EepromReset); - - // Setup the OKIM6295 emulation - MSM6295Init(0, (12000000 / 4) / 165, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - Kaneko16FrameRender = MgcrystlFrameRender; - - // Reset the driver - ExplbrkrDoReset(); - - return 0; -} - -static INT32 Kaneko16Exit() -{ - SekExit(); - if (Kaneko16Eeprom) EEPROMExit(); - - GenericTilesExit(); - - BurnFree(Mem); - BurnFree(spritelist.first_sprite); - - Kaneko16NumTiles = 0; - Kaneko16NumTiles2 = 0; - Kaneko16NumSprites = 0; - Kaneko16SpriteFlipX = 0; - Kaneko16SpriteFlipY = 0; - Kaneko16SpritesColourOffset = 0; - Kaneko16SpritesColourMask = 0; - Kaneko16LayersColourOffset = 0; - Kaneko16DisplayEnable = 0; - Kaneko168BppSprites = 0; - Kaneko16Eeprom = 0; - Kaneko16TilesXOffset = 0; - Kaneko16TilesYOffset = 0; - Kaneko16Bg15 = 0; - Kaneko16Bg15Reg = 0; - Kaneko16Bg15Select = 0; - Kaneko16RecalcBg15Palette = 0; - Kaneko16SpriteRamSize = 0; - Kaneko16SpriteXOffset = 0; - Kaneko16SoundLatch = 0; - MSM6295Bank0 = 0; - MSM6295Bank1 = 0; - memset(Kaneko16SpriteRegs, 0, 0x20 * sizeof(UINT16)); - memset(Kaneko16Layer0Regs, 0, 0x10 * sizeof(UINT16)); - memset(Kaneko16Layer1Regs, 0, 0x10 * sizeof(UINT16)); - memset(ToyboxMCUCom, 0, 0x04 * sizeof(UINT16)); - - ToyboxMCURun = NULL; - Kaneko16FrameRender = NULL; - Kaneko16ParseSprite = NULL; - - Gtmr = 0; - Bloodwar = 0; - Bonkadv = 0; - Mgcrystl = 0; - - return 0; -} - -static INT32 BerlwallExit() -{ - AY8910Exit(0); - AY8910Exit(1); - MSM6295Exit(0); - - return Kaneko16Exit(); -} - -static INT32 BlazeonExit() -{ - ZetExit(); - BurnYM2151Exit(); - - return Kaneko16Exit(); -} - -static INT32 GtmrMachineExit() -{ - MSM6295Exit(0); - MSM6295Exit(1); - - return Kaneko16Exit(); -} - -static INT32 ExplbrkrExit() -{ - AY8910Exit(0); - AY8910Exit(1); - MSM6295Exit(0); - - return Kaneko16Exit(); -} - -/*============================================================================================== -Sprite Rendering -===============================================================================================*/ - -#define USE_LATCHED_XY 1 -#define USE_LATCHED_CODE 2 -#define USE_LATCHED_COLOUR 4 - -static INT32 Kaneko16ParseSpriteType0(INT32 i, struct tempsprite *s) -{ - INT32 Attr, xOffs, Offset; - UINT16 *SpriteRam = (UINT16*)Kaneko16SpriteRam; - - Offset = (i * 8) >> 1; - - if (Offset >= (Kaneko16SpriteRamSize >> 1)) return -1; - - Attr = SpriteRam[Offset + 0]; - s->code = SpriteRam[Offset + 1]; - s->x = SpriteRam[Offset + 2]; - s->y = SpriteRam[Offset + 3]; - - s->color = (Attr & 0xfc) >> 2; - s->priority = (Attr & 0x300) >> 8; - s->flipy = Attr & 0x001; - s->flipx = Attr & 0x002; - - xOffs = (Attr & 0x1800) >> 11; - s->yoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 1]; - s->xoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 0]; - - s->yoffs -= Kaneko16SpriteRegs[0x01]; - - return ((Attr & 0x2000) ? USE_LATCHED_XY : 0) | ((Attr & 0x4000) ? USE_LATCHED_COLOUR: 0) | ((Attr & 0x8000) ? USE_LATCHED_CODE : 0); -} - -static INT32 Kaneko16ParseSpriteType1(INT32 i, struct tempsprite *s) -{ - INT32 Attr, xOffs, Offset; - UINT16 *SpriteRam = (UINT16*)Kaneko16SpriteRam; - - Offset = (i * 8) >> 1; - - if (Offset >= (Kaneko16SpriteRamSize >> 1)) return -1; - - Attr = SpriteRam[Offset + 0]; - s->code = SpriteRam[Offset + 1]; - s->x = SpriteRam[Offset + 2]; - s->y = SpriteRam[Offset + 3]; - - s->color = Attr & 0x3f; - s->priority = (Attr & 0xc0) >> 6; - s->flipy = Attr & 0x100; - s->flipx = Attr & 0x200; - s->code += (s->y & 1) << 16; - - xOffs = (Attr & 0x1800) >> 11; - s->yoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 1]; - s->xoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 0]; - - s->yoffs -= Kaneko16SpriteRegs[0x01]; - - return ((Attr & 0x2000) ? USE_LATCHED_XY : 0) | ((Attr & 0x4000) ? USE_LATCHED_COLOUR: 0) | ((Attr & 0x8000) ? USE_LATCHED_CODE : 0); -} - -static INT32 Kaneko16ParseSpriteType2(INT32 i, struct tempsprite *s) -{ - INT32 Attr, xOffs, Offset; - UINT16 *SpriteRam = (UINT16*)Kaneko16SpriteRam; - - Offset = (i * (16 >> 1)) + (8 >> 1); - - if (Offset >= (Kaneko16SpriteRamSize >> 1)) return -1; - - Attr = SpriteRam[Offset + 0]; - s->code = SpriteRam[Offset + 1]; - s->x = SpriteRam[Offset + 2]; - s->y = SpriteRam[Offset + 3]; - - s->color = (Attr & 0xfc) >> 2; - s->priority = (Attr & 0x300) >> 8; - s->flipy = Attr & 0x001; - s->flipx = Attr & 0x002; - - xOffs = (Attr & 0x1800) >> 11; - s->yoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 1]; - s->xoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 0]; - - s->yoffs -= Kaneko16SpriteRegs[0x01]; - - return ((Attr & 0x2000) ? USE_LATCHED_XY : 0) | ((Attr & 0x4000) ? USE_LATCHED_COLOUR: 0) | ((Attr & 0x8000) ? USE_LATCHED_CODE : 0); -} - -static void Kaneko16RenderSprite(UINT32 Code, UINT32 Colour, INT32 FlipX, INT32 FlipY, INT32 sx, INT32 sy) -{ - UINT8 *SourceBase = Kaneko16Sprites + ((Code % Kaneko16NumSprites) * 256); - - INT32 SpriteScreenHeight = ((1 << 16) * 16 + 0x8000) >> 16; - INT32 SpriteScreenWidth = ((1 << 16) * 16 + 0x8000) >> 16; - - if (Kaneko168BppSprites) { - Colour = 0x100 * (Colour % 0x40); - } else { - Colour = 0x10 * (Colour % 0x40); - } - - if (SpriteScreenHeight && SpriteScreenWidth) { - INT32 dx = (16 << 16) / SpriteScreenWidth; - INT32 dy = (16 << 16) / SpriteScreenHeight; - - INT32 ex = sx + SpriteScreenWidth; - INT32 ey = sy + SpriteScreenHeight; - - INT32 xIndexBase; - INT32 yIndex; - - if (FlipX) { - xIndexBase = (SpriteScreenWidth - 1) * dx; - dx = -dx; - } else { - xIndexBase = 0; - } - - if (FlipY) { - yIndex = (SpriteScreenHeight - 1) * dy; - dy = -dy; - } else { - yIndex = 0; - } - - if (sx < 0) { - INT32 Pixels = 0 - sx; - sx += Pixels; - xIndexBase += Pixels * dx; - } - - if (sy < 0) { - INT32 Pixels = 0 - sy; - sy += Pixels; - yIndex += Pixels * dy; - } - - if (ex > nScreenWidth + 1) { - INT32 Pixels = ex - nScreenWidth - 1; - ex -= Pixels; - } - - if (ey > nScreenHeight + 1) { - INT32 Pixels = ey - nScreenHeight - 1; - ey -= Pixels; - } - - if (ex > sx) { - INT32 y; - - for (y = sy; y < ey; y++) { - UINT8 *Source = SourceBase + ((yIndex >> 16) * 16); - UINT16* pPixel = pTransDraw + (y * nScreenWidth); - - if (y < 0 || y > (nScreenHeight - 1)) continue; - - INT32 x, xIndex = xIndexBase; - for (x = sx; x > 16]; - if (c != 0) { - if (x >= 0 && x < nScreenWidth) pPixel[x] = (c | Colour | Kaneko16SpritesColourOffset) & Kaneko16SpritesColourMask; - } - xIndex += dx; - } - - yIndex += dy; - } - } - } -} - -static void Kaneko16RenderSprites(INT32 PriorityDraw) -{ - struct tempsprite *s = spritelist.first_sprite; - - INT32 i = 0; - INT32 x = 0; - INT32 y = 0; - INT32 Colour = 0; - INT32 Code = 0; - INT32 Priority = 0; - INT32 xOffs = 0; - INT32 yOffs = 0; - INT32 FlipX = 0; - INT32 FlipY = 0; - - while (1) { - INT32 Flags; - - Flags = Kaneko16ParseSprite(i, s); - - if (Flags == -1) break; - - if (Flags & USE_LATCHED_CODE) { - s->code = ++Code; - } else { - Code = s->code; - } - - if (Flags & USE_LATCHED_COLOUR) { - s->color = Colour; - s->priority = Priority; - s->xoffs = xOffs; - s->yoffs = yOffs; - s->flipx = FlipX; - s->flipy = FlipY; - } else { - Colour = s->color; - Priority = s->priority; - xOffs = s->xoffs; - yOffs = s->yoffs; - FlipX = s->flipx; - FlipY = s->flipy; - } - - if (Flags & USE_LATCHED_XY) - { - s->x += x; - s->y += y; - } - - x = s->x; - y = s->y; - - s->x = s->xoffs + s->x; - s->y = s->yoffs + s->y; - - s->x += Kaneko16SpriteXOffset; - - s->x = ((s->x & 0x7fc0) - (s->x & 0x8000)) / 0x40; - s->y = ((s->y & 0x7fc0) - (s->y & 0x8000)) / 0x40; - - i++; - s++; - } - - for (s = spritelist.first_sprite; s < spritelist.first_sprite + 0x400; s++) { - if (s->priority == PriorityDraw) Kaneko16RenderSprite(s->code, s->color, s->flipx, s->flipy, s->x, s->y); - } -} - -#undef USE_LATCHED_XY -#undef USE_LATCHED_CODE -#undef USE_LATCHED_COLOUR - -/*============================================================================================== -Tile Rendering -===============================================================================================*/ - -static INT32 Kaneko16GetLayerFlipOffset(INT32 curroffs) -{ - if (curroffs == 0) return 15; - if (curroffs == 1) return 14; - if (curroffs == 2) return 13; - if (curroffs == 3) return 12; - if (curroffs == 4) return 11; - if (curroffs == 5) return 10; - if (curroffs == 6) return 9; - if (curroffs == 7) return 8; - if (curroffs == 8) return 7; - if (curroffs == 9) return 6; - if (curroffs == 10) return 5; - if (curroffs == 11) return 4; - if (curroffs == 12) return 3; - if (curroffs == 13) return 2; - if (curroffs == 14) return 1; - if (curroffs == 15) return 0; - - return 0; -} - -static void Kaneko16QueueTilesLayer(INT32 Layer) -{ - INT32 x, y, mx, my, px, py, Code, Attr, Colour, Flip, Priority, LineScroll, TileIndex, pSrcXOffs, pSrcYOffs, xScroll, yScroll; - UINT8 pTileSrc; - - LayerQueueSize[Layer] = 0; - TileIndex = 0; - - UINT16 *VRAM = NULL; - UINT16 *VSCROLLRAM = NULL; - UINT16 *LAYERREGS = NULL; - UINT8 *TILEDATA = NULL; - INT32 xScrollReg = 0; - INT32 yScrollReg = 0; - INT32 xOffs = 0; - INT32 numTiles = 0; - - switch (Layer) { - case 0: { - VRAM = (UINT16*)Kaneko16Video0Ram; - VSCROLLRAM = (UINT16*)Kaneko16VScrl0Ram; - LAYERREGS = Kaneko16Layer0Regs; - TILEDATA = Kaneko16Tiles; - xScrollReg = 2; - yScrollReg = 3; - xOffs = 0; - numTiles = Kaneko16NumTiles; - break; - } - - case 1: { - VRAM = (UINT16*)Kaneko16Video1Ram; - VSCROLLRAM = (UINT16*)Kaneko16VScrl1Ram; - LAYERREGS = Kaneko16Layer0Regs; - TILEDATA = Kaneko16Tiles; - xScrollReg = 0; - yScrollReg = 1; - xOffs = 2; - numTiles = Kaneko16NumTiles; - break; - } - - case 2: { - VRAM = (UINT16*)Kaneko16Video2Ram; - VSCROLLRAM = (UINT16*)Kaneko16VScrl2Ram; - LAYERREGS = Kaneko16Layer1Regs; - TILEDATA = Kaneko16Tiles2; - xScrollReg = 2; - yScrollReg = 3; - xOffs = 0; - numTiles = Kaneko16NumTiles2; - break; - } - - case 3: { - VRAM = (UINT16*)Kaneko16Video3Ram; - VSCROLLRAM = (UINT16*)Kaneko16VScrl3Ram; - LAYERREGS = Kaneko16Layer1Regs; - TILEDATA = Kaneko16Tiles2; - xScrollReg = 0; - yScrollReg = 1; - xOffs = 2; - numTiles = Kaneko16NumTiles2; - break; - } - } - - xScroll = LAYERREGS[xScrollReg]; - xOffs = Kaneko16TilesXOffset + xOffs; - yScroll = ((LAYERREGS[yScrollReg] >> 6) & 0x1ff) - Kaneko16TilesYOffset; - - mx = my = -1; - for (y = 0; y < 512; y++) { - if (!(y % 16)) my++; - - LineScroll = VSCROLLRAM[y]; - py = y - yScroll; - - if (py < -30) py += 512; - - for (x = 0; x < 512; x++) { - if (!(x % 16)) mx++; - - if (py < 0 || py >= nScreenHeight) continue; - - px = x - (((xScroll + LineScroll) >> 6) & 0x1ff) - xOffs; - if (px < -7) px += 512; - - if (px < 0 || px >= nScreenWidth) continue; - - TileIndex = ((my * 32) + mx) * 2; - - Code = VRAM[TileIndex + 1]; - if (Code >= numTiles) continue; - Attr = VRAM[TileIndex + 0]; - Priority = (Attr >> 8) & 7; - Colour = (Attr >> 2) & 0x3f; - Flip = Attr & 3; - - pSrcXOffs = x % 16; - pSrcYOffs = y % 16; - if (Flip & 1) pSrcYOffs = Kaneko16GetLayerFlipOffset(pSrcYOffs); - if (Flip & 2) pSrcXOffs = Kaneko16GetLayerFlipOffset(pSrcXOffs); - - pTileSrc = TILEDATA[(Code << 8) + (pSrcYOffs * 16) + pSrcXOffs]; - - if (pTileSrc != 0) { - LayerQueueXY[Layer][LayerQueueSize[Layer]] = (py << 9) | px; - LayerQueueColour[Layer][LayerQueueSize[Layer]] = (Colour << 4) | pTileSrc; - LayerQueuePriority[Layer][LayerQueueSize[Layer]] = Priority; - LayerQueueSize[Layer]++; - } - } - mx = -1; - } -} - -static void Kaneko16RenderLayerQueue(INT32 Layer, INT32 Priority) -{ - for (INT32 i = 0; i < LayerQueueSize[Layer]; i++) { - if (LayerQueuePriority[Layer][i] == Priority) { - UINT16* pPixel = pTransDraw + ((LayerQueueXY[Layer][i] >> 9) * nScreenWidth) + (LayerQueueXY[Layer][i] & 0x1ff); - pPixel[0] = LayerQueueColour[Layer][i] | Kaneko16LayersColourOffset; - } - } -} - -static void Kaneko16RenderTileLayer(INT32 Layer, INT32 PriorityDraw, INT32 xScroll) -{ - INT32 mx, my, Code, Attr, Colour, Flip, Priority, x, y, TileIndex = 0; - - UINT16 *VRAM = NULL; - UINT16 *LAYERREGS = NULL; - UINT8 *TILEDATA = NULL; - INT32 yScrollReg = 0; - INT32 xOffs = 0; - INT32 numTiles = 0; - - switch (Layer) { - case 0: { - VRAM = (UINT16*)Kaneko16Video0Ram; - LAYERREGS = Kaneko16Layer0Regs; - TILEDATA = Kaneko16Tiles; - yScrollReg = 3; - xOffs = 0; - numTiles = Kaneko16NumTiles; - break; - } - - case 1: { - VRAM = (UINT16*)Kaneko16Video1Ram; - LAYERREGS = Kaneko16Layer0Regs; - TILEDATA = Kaneko16Tiles; - yScrollReg = 1; - xOffs = 2; - numTiles = Kaneko16NumTiles; - break; - } - - case 2: { - VRAM = (UINT16*)Kaneko16Video2Ram; - LAYERREGS = Kaneko16Layer1Regs; - TILEDATA = Kaneko16Tiles2; - yScrollReg = 3; - xOffs = 0; - numTiles = Kaneko16NumTiles2; - break; - } - - case 3: { - VRAM = (UINT16*)Kaneko16Video3Ram; - LAYERREGS = Kaneko16Layer1Regs; - TILEDATA = Kaneko16Tiles2; - yScrollReg = 1; - xOffs = 2; - numTiles = Kaneko16NumTiles2; - break; - } - } - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Code = VRAM[TileIndex + 1]; - - if (Code >= numTiles) continue; - - Attr = VRAM[TileIndex + 0]; - Colour = (Attr >> 2) & 0x3f; - Flip = Attr & 3; - Priority = (Attr >> 8) & 7; - - if (Priority == PriorityDraw) { - x = 16 * mx; - y = 16 * my; - - x -= (xScroll >> 6) & 0x1ff; - y -= (LAYERREGS[yScrollReg] >> 6) & 0x1ff; - - if (x < -7) x += 512; - if (y < -30) y += 512; - - x -= Kaneko16TilesXOffset + xOffs; - y += Kaneko16TilesYOffset; - - if (x > 0 && x < (nScreenWidth - 16) && y > 0 && y < (nScreenHeight - 16)) { - if (Flip == 0) Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); - if (Flip == 1) Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); - if (Flip == 2) Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); - if (Flip == 3) Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); - } else { - if (Flip == 0) Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); - if (Flip == 1) Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); - if (Flip == 2) Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); - if (Flip == 3) Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); - } - } - - TileIndex += 2; - } - } -} - -/*============================================================================================== -Background Bitmap Rendering -===============================================================================================*/ - -static void Kaneko16RenderBg15Bitmap() -{ - INT32 Select = Kaneko16Bg15Select; - INT32 Flip = Select & 0x20; - INT32 x, y; - - if (Flip) Select ^= 0x1f; - Select &= 0x1f; - - for (y = 0; y < nScreenHeight; y++) { - UINT16 *pPixel = pTransDraw + (y * nScreenWidth); - UINT16 *data = Kaneko16Bg15Data + (Select * 256 * 256) + ((y + 16) * 256); - - for (x = 0; x < nScreenWidth; x++) { - pPixel[x] = data[x]; - } - } -} - -/*============================================================================================== -Palette Handling -===============================================================================================*/ - -static inline UINT8 pal5bit(UINT8 bits) -{ - bits &= 0x1f; - return (bits << 3) | (bits >> 2); -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal5bit(nColour >> 5); - g = pal5bit(nColour >> 10); - b = pal5bit(nColour >> 0); - - return BurnHighCol(r, g, b, 0); -} - -INT32 Kaneko16CalcPalette(INT32 num) -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)Kaneko16PaletteRam, pd = Kaneko16Palette; i < num; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } - - return 0; -} - -/*============================================================================================== -Graphics Rendering -===============================================================================================*/ - -// If the VScroll RAM is the same all the way through then just apply it as an xScroll value - much faster then doing line scroll on every line -#define HANDLE_VSCROLL(_N_) \ - if (Layer##_N_##Enabled) { \ - INT32 vScrollFast = 1; \ - UINT16 *VSCROLLRAM = (UINT16*)Kaneko16VScrl##_N_##Ram; \ - INT32 LineScroll = VSCROLLRAM[0]; \ - for (i = 0; i < 0x200; i++) { \ - if (VSCROLLRAM[i] != LineScroll) { \ - vScrollFast = 0; \ - break; \ - } \ - } \ - if (!vScrollFast) { \ - vScroll##_N_##Enabled = 1; \ - Kaneko16QueueTilesLayer(_N_); \ - } else { \ - vScroll##_N_##Enabled = 0; \ - xScroll##_N_ += LineScroll; \ - } \ - } \ -\ - -static void BerlwallFrameRender() -{ - INT32 i; - INT32 Layer0Enabled = 0; - INT32 Layer1Enabled = 0; - - INT32 vScroll0Enabled = 0; - INT32 vScroll1Enabled = 0; - - INT32 xScroll0 = Kaneko16Layer0Regs[2]; - INT32 xScroll1 = Kaneko16Layer0Regs[0]; - - if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; - if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; - - BurnTransferClear(); - Kaneko16CalcPalette(0x0800); - - if (Kaneko16RecalcBg15Palette) { - for (i = 0; i < 32768; i++) { - INT32 r = pal5bit(i >> 5); - INT32 g = pal5bit(i >> 10); - INT32 b = pal5bit(i >> 0); - Kaneko16Palette[i + 2048] = BurnHighCol(r, g, b, 0); - } - - Kaneko16RecalcBg15Palette = 0; - } - - if (Kaneko16Layer0Regs[4] & 0x800) { - HANDLE_VSCROLL(0) - } - - if (Kaneko16Layer0Regs[4] & 0x008) { - HANDLE_VSCROLL(1) - } - - Kaneko16RenderBg15Bitmap(); - - for (i = 0; i < 8; i++) { - if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} - if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} - - if (i == 0) Kaneko16RenderSprites(0); - if (i == 1) Kaneko16RenderSprites(1); - if (i == 2) Kaneko16RenderSprites(2); - if (i == 7) Kaneko16RenderSprites(3); - } - - BurnTransferCopy(Kaneko16Palette); -} - -static void BlazeonFrameRender() -{ - INT32 i; - INT32 Layer0Enabled = 0; - INT32 Layer1Enabled = 0; - - INT32 vScroll0Enabled = 0; - INT32 vScroll1Enabled = 0; - - INT32 xScroll0 = Kaneko16Layer0Regs[2]; - INT32 xScroll1 = Kaneko16Layer0Regs[0]; - - if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; - if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; - - BurnTransferClear(); - Kaneko16CalcPalette(0x0800); - - if (Kaneko16Layer0Regs[4] & 0x800) { - HANDLE_VSCROLL(0) - } - - if (Kaneko16Layer0Regs[4] & 0x008) { - HANDLE_VSCROLL(1) - } - - for (i = 0; i < 8; i++) { - if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} - if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} - - if (i == 0) Kaneko16RenderSprites(0); - if (i == 1) Kaneko16RenderSprites(1); - if (i == 7) Kaneko16RenderSprites(2); - if (i == 7) Kaneko16RenderSprites(3); - } - - BurnTransferCopy(Kaneko16Palette); -} - -static void BloodwarFrameRender() -{ - INT32 i; - INT32 Layer0Enabled = 0; - INT32 Layer1Enabled = 0; - INT32 Layer2Enabled = 0; - INT32 Layer3Enabled = 0; - - INT32 vScroll0Enabled = 0; - INT32 vScroll1Enabled = 0; - INT32 vScroll2Enabled = 0; - INT32 vScroll3Enabled = 0; - - INT32 xScroll0 = Kaneko16Layer0Regs[2]; - INT32 xScroll1 = Kaneko16Layer0Regs[0]; - INT32 xScroll2 = Kaneko16Layer1Regs[2]; - INT32 xScroll3 = Kaneko16Layer1Regs[0]; - - if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; - if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; - if (~Kaneko16Layer1Regs[4] & 0x1000) Layer2Enabled = 1; - if (~Kaneko16Layer1Regs[4] & 0x0010) Layer3Enabled = 1; - - BurnTransferClear(); - Kaneko16CalcPalette(0x10000); - - if (!Kaneko16DisplayEnable) return; - - if (Kaneko16Layer0Regs[4] & 0x800) { - HANDLE_VSCROLL(0) - } - - if (Kaneko16Layer0Regs[4] & 0x008) { - HANDLE_VSCROLL(1) - } - - if (Kaneko16Layer1Regs[4] & 0x800) { - HANDLE_VSCROLL(2) - } - - if (Kaneko16Layer1Regs[4] & 0x008) { - HANDLE_VSCROLL(3) - } - - for (i = 0; i < 8; i++) { - if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} - if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} - if (Layer2Enabled) { if (vScroll2Enabled) { Kaneko16RenderLayerQueue(2, i); } else { Kaneko16RenderTileLayer(2, i, xScroll2); }} - if (Layer3Enabled) { if (vScroll3Enabled) { Kaneko16RenderLayerQueue(3, i); } else { Kaneko16RenderTileLayer(3, i, xScroll3); }} - - if (i == 1) Kaneko16RenderSprites(0); - if (i == 2) Kaneko16RenderSprites(1); - if (i == 4) Kaneko16RenderSprites(2); - if (i == 6) Kaneko16RenderSprites(3); - } - - BurnTransferCopy(Kaneko16Palette); -} - -static void ExplbrkrFrameRender() -{ - INT32 i; - INT32 Layer0Enabled = 0; - INT32 Layer1Enabled = 0; - INT32 Layer2Enabled = 0; - INT32 Layer3Enabled = 0; - - INT32 vScroll0Enabled = 0; - INT32 vScroll1Enabled = 0; - INT32 vScroll2Enabled = 0; - INT32 vScroll3Enabled = 0; - - INT32 xScroll0 = Kaneko16Layer0Regs[2]; - INT32 xScroll1 = Kaneko16Layer0Regs[0]; - INT32 xScroll2 = Kaneko16Layer1Regs[2]; - INT32 xScroll3 = Kaneko16Layer1Regs[0]; - - if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; - if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; - if (~Kaneko16Layer1Regs[4] & 0x1000) Layer2Enabled = 1; - if (~Kaneko16Layer1Regs[4] & 0x0010) Layer3Enabled = 1; - - BurnTransferClear(); - Kaneko16CalcPalette(0x1000); - - if (Kaneko16Layer0Regs[4] & 0x800) { - HANDLE_VSCROLL(0) - } - - if (Kaneko16Layer0Regs[4] & 0x008) { - HANDLE_VSCROLL(1) - } - - if (Kaneko16Layer1Regs[4] & 0x800) { - HANDLE_VSCROLL(2) - } - - if (Kaneko16Layer1Regs[4] & 0x008) { - HANDLE_VSCROLL(3) - } - - for (i = 0; i < 8; i++) { - if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} - if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} - if (Layer2Enabled) { if (vScroll2Enabled) { Kaneko16RenderLayerQueue(2, i); } else { Kaneko16RenderTileLayer(2, i, xScroll2); }} - if (Layer3Enabled) { if (vScroll3Enabled) { Kaneko16RenderLayerQueue(3, i); } else { Kaneko16RenderTileLayer(3, i, xScroll3); }} - } - - Kaneko16RenderSprites(0); - Kaneko16RenderSprites(1); - Kaneko16RenderSprites(2); - Kaneko16RenderSprites(3); - - BurnTransferCopy(Kaneko16Palette); -} - -static void GtmrFrameRender() -{ - INT32 i; - INT32 Layer0Enabled = 0; - INT32 Layer1Enabled = 0; - INT32 Layer2Enabled = 0; - INT32 Layer3Enabled = 0; - - INT32 vScroll0Enabled = 0; - INT32 vScroll1Enabled = 0; - INT32 vScroll2Enabled = 0; - INT32 vScroll3Enabled = 0; - - INT32 xScroll0 = Kaneko16Layer0Regs[2]; - INT32 xScroll1 = Kaneko16Layer0Regs[0]; - INT32 xScroll2 = Kaneko16Layer1Regs[2]; - INT32 xScroll3 = Kaneko16Layer1Regs[0]; - - if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; - if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; - if (~Kaneko16Layer1Regs[4] & 0x1000) Layer2Enabled = 1; - if (~Kaneko16Layer1Regs[4] & 0x0010) Layer3Enabled = 1; - - BurnTransferClear(); - Kaneko16CalcPalette(0x10000); - - if (!Kaneko16DisplayEnable) return; - - if (Kaneko16Layer0Regs[4] & 0x800) { - HANDLE_VSCROLL(0) - } - - if (Kaneko16Layer0Regs[4] & 0x008) { - HANDLE_VSCROLL(1) - } - - if (Kaneko16Layer1Regs[4] & 0x800) { - HANDLE_VSCROLL(2) - } - - if (Kaneko16Layer1Regs[4] & 0x008) { - HANDLE_VSCROLL(3) - } - - for (i = 0; i < 8; i++) { - if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} - if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} - if (Layer2Enabled) { if (vScroll2Enabled) { Kaneko16RenderLayerQueue(2, i); } else { Kaneko16RenderTileLayer(2, i, xScroll2); }} - if (Layer3Enabled) { if (vScroll3Enabled) { Kaneko16RenderLayerQueue(3, i); } else { Kaneko16RenderTileLayer(3, i, xScroll3); }} - - if (i == 0) Kaneko16RenderSprites(0); - if (i == 1) Kaneko16RenderSprites(1); - if (i == 2) Kaneko16RenderSprites(2); - if (i == 7) Kaneko16RenderSprites(3); - } - - BurnTransferCopy(Kaneko16Palette); -} - -static void MgcrystlFrameRender() -{ - INT32 i; - INT32 Layer0Enabled = 0; - INT32 Layer1Enabled = 0; - INT32 Layer2Enabled = 0; - INT32 Layer3Enabled = 0; - - INT32 vScroll0Enabled = 0; - INT32 vScroll1Enabled = 0; - INT32 vScroll2Enabled = 0; - INT32 vScroll3Enabled = 0; - - INT32 xScroll0 = Kaneko16Layer0Regs[2]; - INT32 xScroll1 = Kaneko16Layer0Regs[0]; - INT32 xScroll2 = Kaneko16Layer1Regs[2]; - INT32 xScroll3 = Kaneko16Layer1Regs[0]; - - if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; - if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; - if (~Kaneko16Layer1Regs[4] & 0x1000) Layer2Enabled = 1; - if (~Kaneko16Layer1Regs[4] & 0x0010) Layer3Enabled = 1; - - BurnTransferClear(); - Kaneko16CalcPalette(0x1000); - - if (Kaneko16Layer0Regs[4] & 0x800) { - HANDLE_VSCROLL(0) - } - - if (Kaneko16Layer0Regs[4] & 0x008) { - HANDLE_VSCROLL(1) - } - - if (Kaneko16Layer1Regs[4] & 0x800) { - HANDLE_VSCROLL(2) - } - - if (Kaneko16Layer1Regs[4] & 0x008) { - HANDLE_VSCROLL(3) - } - - for (i = 0; i < 8; i++) { - if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} - if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} - if (Layer2Enabled) { if (vScroll2Enabled) { Kaneko16RenderLayerQueue(2, i); } else { Kaneko16RenderTileLayer(2, i, xScroll2); }} - if (Layer3Enabled) { if (vScroll3Enabled) { Kaneko16RenderLayerQueue(3, i); } else { Kaneko16RenderTileLayer(3, i, xScroll3); }} - - if (i == 1) Kaneko16RenderSprites(0); - if (i == 2) Kaneko16RenderSprites(1); - if (i == 4) Kaneko16RenderSprites(2); - if (i == 6) Kaneko16RenderSprites(3); - } - - BurnTransferCopy(Kaneko16Palette); -} - -/*============================================================================================== -Frame functions -===============================================================================================*/ - -static INT32 ExplbrkrFrame() -{ - INT32 nInterleave = 10; - nSoundBufferPos = 0; - - if (Kaneko16Reset) ExplbrkrDoReset(); - - Kaneko16MakeInputs(); - - nCyclesTotal[0] = 12000000 / 60; - nCyclesDone[0] = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 3) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - if (i == 6) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - if (i == 9) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) Kaneko16FrameRender(); - - return 0; -} - -static INT32 BlazeonFrame() -{ - INT32 nInterleave = 10; - nSoundBufferPos = 0; - - if (Kaneko16Reset) BlazeonDoReset(); - - Kaneko16MakeInputs(); - - nCyclesTotal[0] = 12000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 3) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - if (i == 6) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - if (i == 9) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - // Render Sound Segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - } - - } - - if (pBurnDraw) Kaneko16FrameRender(); - - return 0; -} - -static INT32 GtmrFrame() -{ - if (Kaneko16Reset) GtmrDoReset(); - - Kaneko16MakeInputs(); - - SekOpen(0); - SekNewFrame(); - - SekRun((16000000 / 60) / 4); - SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - SekRun((16000000 / 60) / 4); - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekRun((16000000 / 60) / 4); - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - SekRun((16000000 / 60) / 4); - - SekClose(); - - if (pBurnSoundOut) { - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) Kaneko16FrameRender(); - - return 0; -} - -/*============================================================================================== -Scan Driver -===============================================================================================*/ - -static INT32 Kaneko16Scan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029672; - } - - if (Kaneko16Eeprom) EEPROMScan(nAction, pnMin); - - if (nAction & ACB_NVRAM && Kaneko16NVRam) { - memset(&ba, 0, sizeof(ba)); - ba.Data = Kaneko16NVRam; - ba.nLen = 0x100; - ba.szName = "NVRam"; - BurnAcb(&ba); - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(Kaneko16Dip); - SCAN_VAR(Kaneko16Input); - SCAN_VAR(Kaneko16SoundLatch); - SCAN_VAR(Kaneko16SpriteFlipX); - SCAN_VAR(Kaneko16SpriteFlipY); - SCAN_VAR(Kaneko16DisplayEnable); - SCAN_VAR(Kaneko16SpriteRegs); - SCAN_VAR(Kaneko16Layer0Regs); - SCAN_VAR(Kaneko16Layer1Regs); - - if (Kaneko16Bg15) { - SCAN_VAR(Kaneko16Bg15Reg); - SCAN_VAR(Kaneko16Bg15Select); - } - } - - return 0; -} - -static INT32 BlazeonScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { - *pnMin = 0x029672; - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - BurnYM2151Scan(nAction); - - SCAN_VAR(nSoundBufferPos); - } - - return Kaneko16Scan(nAction, pnMin);; -} - -static INT32 ExplbrkrScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { - *pnMin = 0x029672; - } - - if (nAction & ACB_DRIVER_DATA) { - AY8910Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - SCAN_VAR(MSM6295Bank0); - SCAN_VAR(nSoundBufferPos); - } - - if (nAction & ACB_WRITE) { - memcpy(MSM6295ROM + 0x0000000, MSM6295ROMData + (0x40000 * MSM6295Bank0),0x40000); - } - - return Kaneko16Scan(nAction, pnMin);; -} - -static INT32 GtmrScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { - *pnMin = 0x029672; - } - - if (nAction & ACB_DRIVER_DATA) { - MSM6295Scan(0, nAction); - MSM6295Scan(1, nAction); - SCAN_VAR(ToyboxMCUCom); - SCAN_VAR(MSM6295Bank0); - SCAN_VAR(MSM6295Bank1); - } - - if (nAction & ACB_WRITE) { - memcpy(MSM6295ROM + 0x0000000, MSM6295ROMData + (0x40000 * MSM6295Bank0),0x40000); - memcpy(MSM6295ROM + 0x0100000, MSM6295ROMData2 + (0x40000 * MSM6295Bank1),0x40000); - } - - return Kaneko16Scan(nAction, pnMin);; -} - -/*============================================================================================== -Driver defs -===============================================================================================*/ - -struct BurnDriver BurnDrvBerlwall = { - "berlwall", NULL, NULL, NULL, "1991", - "The Berlin Wall\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, - NULL, BerlwallRomInfo, BerlwallRomName, NULL, NULL, BerlwallInputInfo, BerlwallDIPInfo, - BerlwallInit, BerlwallExit, ExplbrkrFrame, NULL, ExplbrkrScan, - &Kaneko16RecalcBg15Palette, 0x9000, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBerlwallt = { - "berlwallt", "berlwall", NULL, NULL, "1991", - "The Berlin Wall (bootleg ?)\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, - NULL, BerlwalltRomInfo, BerlwalltRomName, NULL, NULL, BerlwallInputInfo, BerlwalltDIPInfo, - BerlwallInit, BerlwallExit, ExplbrkrFrame, NULL, ExplbrkrScan, - &Kaneko16RecalcBg15Palette, 0x9000, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBlazeon = { - "blazeon", NULL, NULL, NULL, "1991", - "Blaze On (Japan)\0", NULL, "Atlus", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_HORSHOOT, 0, - NULL, BlazeonRomInfo, BlazeonRomName, NULL, NULL, BlazeonInputInfo, BlazeonDIPInfo, - BlazeonInit, BlazeonExit, BlazeonFrame, NULL, BlazeonScan, - NULL, 0x1000, 320, 232, 4, 3 -}; - -struct BurnDriver BurnDrvBloodwar = { - "bloodwar", NULL, NULL, NULL, "1994", - "Blood Warrior\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_VSFIGHT, 0, - NULL, BloodwarRomInfo, BloodwarRomName, NULL, NULL, BloodwarInputInfo, BloodwarDIPInfo, - BloodwarInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, - NULL, 0x10000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvBonkadv = { - "bonkadv", NULL, NULL, NULL, "1994", - "B.C. Kid / Bonk's Adventure / Kyukyoku!! PC Genjin\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, - NULL, BonkadvRomInfo, BonkadvRomName, NULL, NULL, BonkadvInputInfo, BonkadvDIPInfo, - BonkadvInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, - NULL, 0x10000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvExplbrkr = { - "explbrkr", NULL, NULL, NULL, "1992", - "Explosive Breaker\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KANEKO16, GBF_VERSHOOT, 0, - NULL, ExplbrkrRomInfo, ExplbrkrRomName, NULL, NULL, ExplbrkrInputInfo, ExplbrkrDIPInfo, - ExplbrkrInit, ExplbrkrExit, ExplbrkrFrame, NULL, ExplbrkrScan, - NULL, 0x1000, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvBakubrkr = { - "bakubrkr", "explbrkr", NULL, NULL, "1992", - "Bakuretsu Breaker\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KANEKO16, GBF_VERSHOOT, 0, - NULL, BakubrkrRomInfo, BakubrkrRomName, NULL, NULL, ExplbrkrInputInfo, ExplbrkrDIPInfo, - ExplbrkrInit, ExplbrkrExit, ExplbrkrFrame, NULL, ExplbrkrScan, - NULL, 0x1000, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvGtmr = { - "gtmr", NULL, NULL, NULL, "1994", - "1000 Miglia: Great 1000 Miles Rally (94/07/18)\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_RACING, 0, - NULL, GtmrRomInfo, GtmrRomName, NULL, NULL, GtmrInputInfo, GtmrDIPInfo, - GtmrInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, - NULL, 0x10000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGtmra = { - "gtmra", "gtmr", NULL, NULL, "1994", - "1000 Miglia: Great 1000 Miles Rally (94/06/13)\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_RACING, 0, - NULL, GtmraRomInfo, GtmraRomName, NULL, NULL, GtmrInputInfo, GtmrDIPInfo, - GtmrInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, - NULL, 0x10000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGtmre = { - "gtmre", "gtmr", NULL, NULL, "1994", - "Great 1000 Miles Rally: Evolution Model!!! (94/09/06)\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_RACING, 0, - NULL, GtmreRomInfo, GtmreRomName, NULL, NULL, GtmrInputInfo, GtmrDIPInfo, - GtmrevoInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, - NULL, 0x10000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGtmrusa = { - "gtmrusa", "gtmr", NULL, NULL, "1994", - "Great 1000 Miles Rally: U.S.A Version! (94/09/06)\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_RACING, 0, - NULL, GtmrusaRomInfo, GtmrusaRomName, NULL, NULL, GtmrInputInfo, GtmrDIPInfo, - GtmrevoInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, - NULL, 0x10000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGtmr2 = { - "gtmr2", NULL, NULL, NULL, "1995", - "Mille Miglia 2: Great 1000 Miles Rally (95/05/24)\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_RACING, 0, - NULL, Gtmr2RomInfo, Gtmr2RomName, NULL, NULL, GtmrInputInfo, Gtmr2DIPInfo, - Gtmr2Init, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, - NULL, 0x10000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGtmr2a = { - "gtmr2a", "gtmr2", NULL, NULL, "1995", - "Mille Miglia 2: Great 1000 Miles Rally (95/04/04)\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_RACING, 0, - NULL, Gtmr2aRomInfo, Gtmr2aRomName, NULL, NULL, GtmrInputInfo, Gtmr2DIPInfo, - Gtmr2Init, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, - NULL, 0x10000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGtmr2u = { - "gtmr2u", "gtmr2", NULL, NULL, "1995", - "Great 1000 Miles Rally 2 USA (95/05/18)\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_RACING, 0, - NULL, Gtmr2uRomInfo, Gtmr2uRomName, NULL, NULL, GtmrInputInfo, Gtmr2DIPInfo, - Gtmr2uInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, - NULL, 0x10000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvMgcrsytl = { - "mgcrystl", NULL, NULL, NULL, "1991", - "Magical Crystals (World, 92/01/10)\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, - NULL, MgcrystlRomInfo, MgcrystlRomName, NULL, NULL, MgcrystlInputInfo, MgcrystlDIPInfo, - MgcrystlInit, ExplbrkrExit, ExplbrkrFrame, NULL, ExplbrkrScan, - NULL, 0x1000, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMgcrsytlo = { - "mgcrystlo", "mgcrystl", NULL, NULL, "1991", - "Magical Crystals (World, 91/12/10)\0", NULL, "Kaneko", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, - NULL, MgcrystloRomInfo, MgcrystloRomName, NULL, NULL, MgcrystlInputInfo, MgcrystlDIPInfo, - MgcrystlInit, ExplbrkrExit, ExplbrkrFrame, NULL, ExplbrkrScan, - NULL, 0x1000, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMgcrsytlj = { - "mgcrystlj", "mgcrystl", NULL, NULL, "1991", - "Magical Crystals (Japan, 92/01/13)\0", NULL, "Kaneko (Atlus license)", "Kaneko16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, - NULL, MgcrystljRomInfo, MgcrystljRomName, NULL, NULL, MgcrystlInputInfo, MgcrystlDIPInfo, - MgcrystlInit, ExplbrkrExit, ExplbrkrFrame, NULL, ExplbrkrScan, - NULL, 0x1000, 256, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "msm6295.h" +#include "burn_ym2151.h" +#include "eeprom.h" +#include "kanekotb.h" + +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +/*============================================================================================== +Driver Variables +===============================================================================================*/ + +static UINT8 Kaneko16InputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 Kaneko16InputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 Kaneko16InputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 Kaneko16InputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 Kaneko16Dip[2] = {0, 0}; +static UINT8 Kaneko16Input[4] = {0x00, 0x00, 0x00, 0x00}; +static UINT8 Kaneko16Reset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Kaneko16Rom = NULL; +static UINT8 *Kaneko16Z80Rom = NULL; +static UINT8 *MSM6295ROMData = NULL; +static UINT8 *MSM6295ROMData2 = NULL; +static UINT8 *Kaneko16Ram = NULL; +static UINT8 *Kaneko16Z80Ram = NULL; +static UINT8 *Kaneko16MCURam = NULL; +static UINT8 *Kaneko16NVRam = NULL; +static UINT8 *Kaneko16PaletteRam = NULL; +static UINT8 *Kaneko16SpriteRam = NULL; +static UINT8 *Kaneko16Video0Ram = NULL; +static UINT8 *Kaneko16Video1Ram = NULL; +static UINT8 *Kaneko16Video2Ram = NULL; +static UINT8 *Kaneko16Video3Ram = NULL; +static UINT8 *Kaneko16VScrl0Ram = NULL; +static UINT8 *Kaneko16VScrl1Ram = NULL; +static UINT8 *Kaneko16VScrl2Ram = NULL; +static UINT8 *Kaneko16VScrl3Ram = NULL; +static UINT32 *Kaneko16Palette = NULL; +static UINT8 *Kaneko16Tiles = NULL; +static UINT8 *Kaneko16Tiles2 = NULL; +static UINT8 *Kaneko16Sprites = NULL; +static UINT8 *Kaneko16TempGfx = NULL; + +static INT16* pFMBuffer; +static INT16* pAY8910Buffer[6]; + +static UINT32 Kaneko16SoundLatch; +static INT32 MSM6295Bank0; +static INT32 MSM6295Bank1; + +static UINT16 ToyboxMCUCom[4]; + +static UINT16 Kaneko16Bg15Reg; +static UINT16 Kaneko16Bg15Select; +static UINT16 *Kaneko16Bg15Data = NULL; +static UINT8 Kaneko16RecalcBg15Palette; + +static UINT16 Kaneko16SpriteFlipX; +static UINT16 Kaneko16SpriteFlipY; +static UINT16 Kaneko16SpriteRegs[0x20]; +static UINT16 Kaneko16Layer0Regs[0x10]; +static UINT16 Kaneko16Layer1Regs[0x10]; +static UINT32 Kaneko16SpritesColourOffset; +static UINT32 Kaneko16LayersColourOffset; +static UINT32 Kaneko16SpritesColourMask; +static UINT16 Kaneko16DisplayEnable; +static INT32 Kaneko16TilesXOffset; +static INT32 Kaneko16TilesYOffset; +static INT32 Kaneko16SpriteXOffset; + +static UINT32 *LayerQueueXY[4]; +static UINT32 *LayerQueueColour[4]; +static UINT8 *LayerQueuePriority[4]; +static INT32 LayerQueueSize[4]; + +static INT32 Kaneko16NumTiles; +static INT32 Kaneko16NumTiles2; +static INT32 Kaneko16NumSprites; +static INT32 Kaneko16SpriteRamSize; + +// Flags +static INT32 Kaneko168BppSprites; +static INT32 Kaneko16Eeprom; +static INT32 Kaneko16Bg15; +static INT32 Gtmr; +static INT32 Bloodwar; +static INT32 Bonkadv; +static INT32 Mgcrystl; + +typedef void (*MCURun)(); +MCURun ToyboxMCURun; + +typedef void (*FrameRender)(); +FrameRender Kaneko16FrameRender; +static void BerlwallFrameRender(); +static void BlazeonFrameRender(); +static void BloodwarFrameRender(); +static void ExplbrkrFrameRender(); +static void GtmrFrameRender(); +static void MgcrystlFrameRender(); + +typedef INT32 (*ParseSprite)(INT32, struct tempsprite*); +ParseSprite Kaneko16ParseSprite; +static INT32 Kaneko16ParseSpriteType0(INT32 i, struct tempsprite *s); +static INT32 Kaneko16ParseSpriteType1(INT32 i, struct tempsprite *s); +static INT32 Kaneko16ParseSpriteType2(INT32 i, struct tempsprite *s); + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; +static INT32 nSoundBufferPos; + +struct tempsprite +{ + INT32 code,color; + INT32 x,y; + INT32 xoffs,yoffs; + INT32 flipx,flipy; + INT32 priority; +}; + +static struct +{ + struct tempsprite *first_sprite; +} spritelist; + +/*============================================================================================== +Input Definitions +===============================================================================================*/ + +static struct BurnInputInfo BerlwallInputList[] = { + {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , Kaneko16InputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , Kaneko16InputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, + {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, + {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 4, "diag" }, + {"Tilt" , BIT_DIGITAL , Kaneko16InputPort2 + 5, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, Kaneko16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Berlwall) + +static struct BurnInputInfo BlazeonInputList[] = { + {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort0 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , Kaneko16InputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort1 + 7, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , Kaneko16InputPort1 + 6, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, + {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 7, "service" }, + {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 5, "diag" }, + {"Tilt" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, Kaneko16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Blazeon) + +static struct BurnInputInfo BloodwarInputList[] = { + {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , Kaneko16InputPort0 + 6, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , Kaneko16InputPort0 + 7, "p1 fire 4" }, + + {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , Kaneko16InputPort1 + 6, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , Kaneko16InputPort3 + 2, "p2 fire 4" }, + + {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, + {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, + {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 4, "diag" }, + {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, +}; + +STDINPUTINFO(Bloodwar) + +static struct BurnInputInfo BonkadvInputList[] = { + {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, + {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, + {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 4, "diag" }, + {"Tilt" , BIT_DIGITAL , Kaneko16InputPort2 + 5, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, +}; + +STDINPUTINFO(Bonkadv) + +static struct BurnInputInfo ExplbrkrInputList[] = { + {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, + {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, + {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, +}; + +STDINPUTINFO(Explbrkr) + +static struct BurnInputInfo GtmrInputList[] = { + {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, + {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, + {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 4, "diag" }, + {"Tilt" , BIT_DIGITAL , Kaneko16InputPort2 + 5, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, +}; + +STDINPUTINFO(Gtmr) + +static struct BurnInputInfo MgcrystlInputList[] = { + {"Coin 1" , BIT_DIGITAL , Kaneko16InputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , Kaneko16InputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , Kaneko16InputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , Kaneko16InputPort2 + 1, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , Kaneko16InputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , Kaneko16InputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , Kaneko16InputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , Kaneko16InputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , Kaneko16InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , Kaneko16InputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , Kaneko16InputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , Kaneko16InputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , Kaneko16InputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , Kaneko16InputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , Kaneko16InputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , Kaneko16InputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &Kaneko16Reset , "reset" }, + {"Service" , BIT_DIGITAL , Kaneko16InputPort2 + 6, "service" }, + {"Test" , BIT_DIGITAL , Kaneko16InputPort2 + 4, "diag" }, + {"Tilt" , BIT_DIGITAL , Kaneko16InputPort2 + 5, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, Kaneko16Dip + 0 , "dip" }, +}; + +STDINPUTINFO(Mgcrystl) + +inline void Kaneko16ClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +inline void Kaneko16MakeInputs() +{ + // Reset Inputs + Kaneko16Input[0] = Kaneko16Input[1] = Kaneko16Input[2] = Kaneko16Input[3] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + Kaneko16Input[0] |= (Kaneko16InputPort0[i] & 1) << i; + Kaneko16Input[1] |= (Kaneko16InputPort1[i] & 1) << i; + Kaneko16Input[2] |= (Kaneko16InputPort2[i] & 1) << i; + Kaneko16Input[3] |= (Kaneko16InputPort3[i] & 1) << i; + } + + // Clear Opposites + Kaneko16ClearOpposites(&Kaneko16Input[0]); + Kaneko16ClearOpposites(&Kaneko16Input[1]); +} + +/*============================================================================================== +Dip Switch Definitions +===============================================================================================*/ + +static struct BurnDIPInfo BerlwallDIPList[]= +{ + // Default Values + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Screen Direction" }, + {0x16, 0x01, 0x01, 0x01, "Normal" }, + {0x16, 0x01, 0x01, 0x00, "Reverse" }, + + {0 , 0xfe, 0 , 8 , "Coin Slot A" }, + {0x16, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, + {0x16, 0x01, 0x1c, 0x18, "1 Coins 2 Credits" }, + {0x16, 0x01, 0x1c, 0x14, "1 Coins 3 Credits" }, + {0x16, 0x01, 0x1c, 0x10, "1 Coins 4 Credits" }, + {0x16, 0x01, 0x1c, 0x0c, "2 Coins 1 Credit" }, + {0x16, 0x01, 0x1c, 0x08, "2 Coin 3 Credits" }, + {0x16, 0x01, 0x1c, 0x04, "3 Coins 1 Credit" }, + {0x16, 0x01, 0x1c, 0x00, "4 Coins 1 Credit" }, + + {0 , 0xfe, 0 , 8 , "Coin Slot B" }, + {0x16, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, + {0x16, 0x01, 0xe0, 0xc0, "1 Coins 2 Credits" }, + {0x16, 0x01, 0xe0, 0xa0, "1 Coins 3 Credits" }, + {0x16, 0x01, 0xe0, 0x80, "1 Coins 4 Credits" }, + {0x16, 0x01, 0xe0, 0x60, "2 Coins 1 Credit" }, + {0x16, 0x01, 0xe0, 0x40, "2 Coin 3 Credits" }, + {0x16, 0x01, 0xe0, 0x20, "1 Coin 5 Credits" }, + {0x16, 0x01, 0xe0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Game Level" }, + {0x17, 0x01, 0x03, 0x03, "Standard" }, + {0x17, 0x01, 0x03, 0x02, "Easy" }, + {0x17, 0x01, 0x03, 0x01, "Difficult" }, + {0x17, 0x01, 0x03, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 4 , "Number of Players" }, + {0x17, 0x01, 0x0c, 0x0c, "3" }, + {0x17, 0x01, 0x0c, 0x08, "2" }, + {0x17, 0x01, 0x0c, 0x04, "5" }, + {0x17, 0x01, 0x0c, 0x00, "7" }, + + {0 , 0xfe, 0 , 4 , "Language Type" }, + {0x17, 0x01, 0x30, 0x30, "English" }, + {0x17, 0x01, 0x30, 0x20, "Italy" }, + {0x17, 0x01, 0x30, 0x10, "Germany" }, + {0x17, 0x01, 0x30, 0x00, "Pause Mode" }, + + {0 , 0xfe, 0 , 2 , "Demonstration Sound" }, + {0x17, 0x01, 0x40, 0x00, "Off" }, + {0x17, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Testmode Switch" }, + {0x17, 0x01, 0x80, 0x80, "Normal Game" }, + {0x17, 0x01, 0x80, 0x00, "Testmode" }, +}; + +STDDIPINFO(Berlwall) + +static struct BurnDIPInfo BerlwalltDIPList[]= +{ + // Default Values + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Screen Direction" }, + {0x16, 0x01, 0x01, 0x01, "Normal" }, + {0x16, 0x01, 0x01, 0x00, "Reverse" }, + + {0 , 0xfe, 0 , 8 , "Coin Slot A" }, + {0x16, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, + {0x16, 0x01, 0x1c, 0x18, "1 Coins 2 Credits" }, + {0x16, 0x01, 0x1c, 0x14, "1 Coins 3 Credits" }, + {0x16, 0x01, 0x1c, 0x10, "1 Coins 4 Credits" }, + {0x16, 0x01, 0x1c, 0x0c, "2 Coins 1 Credit" }, + {0x16, 0x01, 0x1c, 0x08, "2 Coin 3 Credits" }, + {0x16, 0x01, 0x1c, 0x04, "3 Coins 1 Credit" }, + {0x16, 0x01, 0x1c, 0x00, "4 Coins 1 Credit" }, + + {0 , 0xfe, 0 , 8 , "Coin Slot B" }, + {0x16, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, + {0x16, 0x01, 0xe0, 0xc0, "1 Coins 2 Credits" }, + {0x16, 0x01, 0xe0, 0xa0, "1 Coins 3 Credits" }, + {0x16, 0x01, 0xe0, 0x80, "1 Coins 4 Credits" }, + {0x16, 0x01, 0xe0, 0x60, "2 Coins 1 Credit" }, + {0x16, 0x01, 0xe0, 0x40, "2 Coin 3 Credits" }, + {0x16, 0x01, 0xe0, 0x20, "1 Coin 5 Credits" }, + {0x16, 0x01, 0xe0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Game Level" }, + {0x17, 0x01, 0x03, 0x03, "Standard" }, + {0x17, 0x01, 0x03, 0x02, "Easy" }, + {0x17, 0x01, 0x03, 0x01, "Difficult" }, + {0x17, 0x01, 0x03, 0x00, "Very Difficult" }, + + {0 , 0xfe, 0 , 4 , "Number of Players" }, + {0x17, 0x01, 0x0c, 0x0c, "2" }, + {0x17, 0x01, 0x0c, 0x08, "3" }, + {0x17, 0x01, 0x0c, 0x04, "5" }, + {0x17, 0x01, 0x0c, 0x00, "1" }, + + {0 , 0xfe, 0 , 4 , "Language Type" }, + {0x17, 0x01, 0x30, 0x30, "English" }, + {0x17, 0x01, 0x30, 0x20, "Italy" }, + {0x17, 0x01, 0x30, 0x10, "Germany" }, + {0x17, 0x01, 0x30, 0x00, "Pause Mode" }, + + {0 , 0xfe, 0 , 2 , "Demonstration Sound" }, + {0x17, 0x01, 0x40, 0x00, "Off" }, + {0x17, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Testmode Switch" }, + {0x17, 0x01, 0x80, 0x80, "Normal Game" }, + {0x17, 0x01, 0x80, 0x00, "Testmode" }, +}; + +STDDIPINFO(Berlwallt) + +static struct BurnDIPInfo BlazeonDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x03, "Standard" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Strong" }, + + {0 , 0xfe, 0 , 4 , "Number of Players" }, + {0x14, 0x01, 0x0c, 0x00, "2" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Demonstration Sound" }, + {0x14, 0x01, 0x10, 0x00, "Off" }, + {0x14, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 16 , "Coin Rate Slot A" }, + {0x15, 0x01, 0x0f, 0x00, "1 Coin 1 Play" }, + {0x15, 0x01, 0x0f, 0x01, "2 Coin 3 Play" }, + {0x15, 0x01, 0x0f, 0x02, "4 Coin 5 Play" }, + {0x15, 0x01, 0x0f, 0x03, "5 Coin 6 Play" }, + {0x15, 0x01, 0x0f, 0x04, "4 Coin 3 Play" }, + {0x15, 0x01, 0x0f, 0x05, "6 Coin 3 Play" }, + {0x15, 0x01, 0x0f, 0x06, "2 Coin 3 Play" }, + {0x15, 0x01, 0x0f, 0x07, "4 Coin 1 Play" }, + {0x15, 0x01, 0x0f, 0x08, "3 Coin 1 Play" }, + {0x15, 0x01, 0x0f, 0x09, "2 Coin 1 Play" }, + {0x15, 0x01, 0x0f, 0x0a, "1 Coin 6 Play" }, + {0x15, 0x01, 0x0f, 0x0b, "1 Coin 5 Play" }, + {0x15, 0x01, 0x0f, 0x0c, "1 Coin 4 Play" }, + {0x15, 0x01, 0x0f, 0x0d, "1 Coin 3 Play" }, + {0x15, 0x01, 0x0f, 0x0e, "1 Coin 2 Play" }, + {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Play" }, + + {0 , 0xfe, 0 , 16 , "Coin Rate Slot B" }, + {0x15, 0x01, 0xf0, 0x00, "1 Coin 1 Play" }, + {0x15, 0x01, 0xf0, 0x10, "2 Coin 3 Play" }, + {0x15, 0x01, 0xf0, 0x20, "4 Coin 5 Play" }, + {0x15, 0x01, 0xf0, 0x30, "5 Coin 6 Play" }, + {0x15, 0x01, 0xf0, 0x40, "4 Coin 3 Play" }, + {0x15, 0x01, 0xf0, 0x50, "6 Coin 3 Play" }, + {0x15, 0x01, 0xf0, 0x60, "2 Coin 3 Play" }, + {0x15, 0x01, 0xf0, 0x70, "4 Coin 1 Play" }, + {0x15, 0x01, 0xf0, 0x80, "3 Coin 1 Play" }, + {0x15, 0x01, 0xf0, 0x90, "2 Coin 1 Play" }, + {0x15, 0x01, 0xf0, 0xa0, "1 Coin 6 Play" }, + {0x15, 0x01, 0xf0, 0xb0, "1 Coin 5 Play" }, + {0x15, 0x01, 0xf0, 0xc0, "1 Coin 4 Play" }, + {0x15, 0x01, 0xf0, 0xd0, "1 Coin 3 Play" }, + {0x15, 0x01, 0xf0, 0xe0, "1 Coin 2 Play" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Play" }, +}; + +STDDIPINFO(Blazeon) + +static struct BurnDIPInfo BloodwarDIPList[]= +{ + // Default Values + {0x17, 0xff, 0xff, 0x01, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x17, 0x01, 0x01, 0x00, "Off" }, + {0x17, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x17, 0x01, 0x02, 0x00, "Off" }, + {0x17, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Screen Flip" }, + {0x17, 0x01, 0x04, 0x00, "Normal" }, + {0x17, 0x01, 0x04, 0x04, "Reverse" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x17, 0x01, 0x38, 0x00, "1 Easy" }, + {0x17, 0x01, 0x38, 0x08, "2" }, + {0x17, 0x01, 0x38, 0x10, "3" }, + {0x17, 0x01, 0x38, 0x18, "4" }, + {0x17, 0x01, 0x38, 0x20, "5" }, + {0x17, 0x01, 0x38, 0x28, "6" }, + {0x17, 0x01, 0x38, 0x30, "7" }, + {0x17, 0x01, 0x38, 0x38, "8 Hard" }, + + {0 , 0xfe, 0 , 2 , "Join During Game" }, + {0x17, 0x01, 0x40, 0x40, "Impossible" }, + {0x17, 0x01, 0x40, 0x00, "Possible" }, + + {0 , 0xfe, 0 , 2 , "Continue Coin" }, + {0x17, 0x01, 0x80, 0x00, "Normal" }, + {0x17, 0x01, 0x80, 0x80, "Continue coin" }, +}; + +STDDIPINFO(Bloodwar) + +static struct BurnDIPInfo BonkadvDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0x10, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Screen Direction" }, + {0x14, 0x01, 0x01, 0x00, "Standard" }, + {0x14, 0x01, 0x01, 0x01, "Reverse" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x14, 0x01, 0x02, 0x00, "Off" }, + {0x14, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sound" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Title Level Display" }, + {0x14, 0x01, 0x10, 0x00, "Off" }, + {0x14, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x80, 0x00, "Off" }, + {0x14, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Bonkadv) + +static struct BurnDIPInfo ExplbrkrDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x02, 0x02, "Off" }, + {0x12, 0x01, 0x02, 0x00, "On" }, +}; + +STDDIPINFO(Explbrkr) + +static struct BurnDIPInfo GtmrDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x01, 0x00, "Off" }, + {0x14, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x02, 0x00, "Off" }, + {0x14, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x04, 0x00, "Upright" }, + {0x14, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Controls" }, + {0x14, 0x01, 0x18, 0x00, "1 Joystick" }, + {0x14, 0x01, 0x18, 0x10, "2 Joysticks" }, + {0x14, 0x01, 0x18, 0x08, "Wheel (360)" }, + {0x14, 0x01, 0x18, 0x18, "Wheel (270)" }, + + {0 , 0xfe, 0 , 2 , "Use Brake" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "National Anthem & Flag" }, + {0x14, 0x01, 0xc0, 0x00, "Use Memory" }, + {0x14, 0x01, 0xc0, 0x40, "Anthem Only" }, + {0x14, 0x01, 0xc0, 0x80, "Flag Only" }, + {0x14, 0x01, 0xc0, 0xc0, "None" }, +}; + +STDDIPINFO(Gtmr) + +static struct BurnDIPInfo Gtmr2DIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 5 , "Communication" }, + {0x14, 0x01, 0x07, 0x00, "None" }, + {0x14, 0x01, 0x07, 0x01, "Machine 1" }, + {0x14, 0x01, 0x07, 0x02, "Machine 2" }, + {0x14, 0x01, 0x07, 0x03, "Machine 3" }, + {0x14, 0x01, 0x07, 0x04, "Machine 4" }, + + {0 , 0xfe, 0 , 4 , "Controls" }, + {0x14, 0x01, 0x18, 0x00, "Joystick" }, + {0x14, 0x01, 0x18, 0x10, "Wheel (360)" }, + {0x14, 0x01, 0x18, 0x08, "Wheel (270D)" }, + {0x14, 0x01, 0x18, 0x18, "Wheel (270A)" }, + + {0 , 0xfe, 0 , 2 , "Pedal Function" }, + {0x14, 0x01, 0x20, 0x00, "Microswitch" }, + {0x14, 0x01, 0x20, 0x20, "Potentiometer" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x80, 0x00, "Off" }, + {0x14, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Gtmr2) + +static struct BurnDIPInfo MgcrystlDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, +}; + +STDDIPINFO(Mgcrystl) + +/*============================================================================================== +ROM Descriptions +===============================================================================================*/ + +static struct BurnRomInfo BerlwallRomDesc[] = { + { "u23_01.bin", 0x020000, 0x76b526ce, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "u39_01.bin", 0x020000, 0x78fa7ef2, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "bw001", 0x080000, 0xbc927260, BRF_GRA }, // 2 Sprites + { "bw002", 0x080000, 0x223f5465, BRF_GRA }, // 3 Sprites + { "bw300", 0x020000, 0xb258737a, BRF_GRA }, // 4 Sprites + + { "bw003", 0x080000, 0xfbb4b72d, BRF_GRA }, // 5 Tiles + + { "bw004", 0x080000, 0x5300c34d, BRF_GRA }, // 6 High colour background + { "bw008", 0x080000, 0x9aaf2f2f, BRF_GRA }, // 7 High colour background + { "bw005", 0x080000, 0x16db6d43, BRF_GRA }, // 8 High colour background + { "bw009", 0x080000, 0x1151a0b0, BRF_GRA }, // 9 High colour background + { "bw006", 0x080000, 0x73a35d1f, BRF_GRA }, // 10 High colour background + { "bw00a", 0x080000, 0xf447dfc2, BRF_GRA }, // 11 High colour background + { "bw007", 0x080000, 0x97f85c87, BRF_GRA }, // 12 High colour background + { "bw00b", 0x080000, 0xb0a48225, BRF_GRA }, // 13 High colour background + + { "bw000", 0x040000, 0xd8fe869d, BRF_SND }, // 14 Samples +}; + + +STD_ROM_PICK(Berlwall) +STD_ROM_FN(Berlwall) + +static struct BurnRomInfo BerlwalltRomDesc[] = { + { "bw100a", 0x020000, 0xe6bcb4eb, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "bw101a", 0x020000, 0x38056fb2, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "bw001", 0x080000, 0xbc927260, BRF_GRA }, // 2 Sprites + { "bw002", 0x080000, 0x223f5465, BRF_GRA }, // 3 Sprites + { "bw300", 0x020000, 0xb258737a, BRF_GRA }, // 4 Sprites + + { "bw003", 0x080000, 0xfbb4b72d, BRF_GRA }, // 5 Tiles + + { "bw004", 0x080000, 0x5300c34d, BRF_GRA }, // 6 High colour background + { "bw008", 0x080000, 0x9aaf2f2f, BRF_GRA }, // 7 High colour background + { "bw005", 0x080000, 0x16db6d43, BRF_GRA }, // 8 High colour background + { "bw009", 0x080000, 0x1151a0b0, BRF_GRA }, // 9 High colour background + { "bw006", 0x080000, 0x73a35d1f, BRF_GRA }, // 10 High colour background + { "bw00a", 0x080000, 0xf447dfc2, BRF_GRA }, // 11 High colour background + { "bw007", 0x080000, 0x97f85c87, BRF_GRA }, // 12 High colour background + { "bw00b", 0x080000, 0xb0a48225, BRF_GRA }, // 13 High colour background + + { "bw000", 0x040000, 0xd8fe869d, BRF_SND }, // 14 Samples +}; + + +STD_ROM_PICK(Berlwallt) +STD_ROM_FN(Berlwallt) + +static struct BurnRomInfo BlazeonRomDesc[] = { + { "bz_prg1.u80", 0x040000, 0x8409e31d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "bz_prg2.u81", 0x040000, 0xb8a0a08b, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "bz_sp1.u20", 0x100000, 0x0d5809a1, BRF_GRA }, // 2 Sprites + { "bz_sp2.u21", 0x100000, 0x56ead2bd, BRF_GRA }, // 3 Sprites + + { "bz_bg.u2", 0x100000, 0xfc67f19f, BRF_GRA }, // 4 Tiles + + { "3.u45", 0x020000, 0x52fe4c94, BRF_ESS | BRF_PRG }, // 5 Z80 Program Code +}; + + +STD_ROM_PICK(Blazeon) +STD_ROM_FN(Blazeon) + +static struct BurnRomInfo BloodwarRomDesc[] = { + { "ofp0f3.514", 0x080000, 0x0c93da15, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ofp1f3.513", 0x080000, 0x894ecbe5, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "ofd0x3.124", 0x020000, 0x399f2005, BRF_PRG | BRF_OPT }, // 2 MCU Code + + { "of-200-0201.8", 0x200000, 0xbba63025, BRF_GRA }, // 3 Sprites + { "of-201-0202.9", 0x200000, 0x4ffd9ddc, BRF_GRA }, // 4 Sprites + { "of-202-0203.10", 0x200000, 0xfbcc5363, BRF_GRA }, // 5 Sprites + { "of-203-0204.11", 0x200000, 0x8e818ce9, BRF_GRA }, // 6 Sprites + { "of-204-0205.12", 0x200000, 0x70c4a76b, BRF_GRA }, // 7 Sprites + { "of-205-0206.13", 0x200000, 0x80c667bb, BRF_GRA }, // 8 Sprites + { "of-206-0207.14", 0x200000, 0xc2028c97, BRF_GRA }, // 9 Sprites + { "of-207-0208.15", 0x200000, 0xb1f30c61, BRF_GRA }, // 10 Sprites + { "of-208-0209.28", 0x200000, 0xa8f29545, BRF_GRA }, // 11 Sprites + { "of-209e-0210.16", 0x100000, 0x93018468, BRF_GRA }, // 12 Sprites + { "of-2090-2011.17", 0x100000, 0x3fb226a1, BRF_GRA }, // 13 Sprites + { "of-210e-0212.18", 0x100000, 0x80f3fa1b, BRF_GRA }, // 14 Sprites + { "of-2100-0213.19", 0x100000, 0x8ca3a3d6, BRF_GRA }, // 15 Sprites + { "of-211e-0214.20", 0x100000, 0x8d3d96f7, BRF_GRA }, // 16 Sprites + { "of-2110-0215.21", 0x100000, 0x78268230, BRF_GRA }, // 17 Sprites + { "of-212e-0216.22", 0x100000, 0x5a013d99, BRF_GRA }, // 18 Sprites + { "of-2120-0217.23", 0x100000, 0x84ed25bd, BRF_GRA }, // 19 Sprites + { "of-213e-0218.24", 0x100000, 0x861bc5b1, BRF_GRA }, // 20 Sprites + { "of-2130-0219.25", 0x100000, 0xa79b8119, BRF_GRA }, // 21 Sprites + { "of-214e-0220.26", 0x100000, 0x43c622de, BRF_GRA }, // 22 Sprites + { "of-2140-0221.27", 0x100000, 0xd10bf03c, BRF_GRA }, // 23 Sprites + + { "of-300-0225.51", 0x100000, 0xfbc3c08a, BRF_GRA }, // 24 Tiles + { "of-301-0226.55", 0x100000, 0xfcf215de, BRF_GRA }, // 25 Tiles (Layers 2 & 3) + + { "of-101-f-0223.101", 0x100000, 0x295f3c93, BRF_SND }, // 26 Samples + { "of-100-0222.99", 0x100000, 0x42b12269, BRF_SND }, // 27 Samples +}; + + +STD_ROM_PICK(Bloodwar) +STD_ROM_FN(Bloodwar) + +static struct BurnRomInfo BonkadvRomDesc[] = { + { "prg.8", 0x080000, 0xaf2e60f8, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "prg.7", 0x080000, 0xa1cc6a78, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "mcu.124", 0x020000, 0x9d4e2724, BRF_PRG | BRF_OPT }, // 2 MCU Code + + { "pc100101.37", 0x200000, 0xc96e7c10, BRF_GRA }, // 3 Sprites + { "pc200102.40", 0x100000, 0xc2b7a26a, BRF_GRA }, // 4 Sprites + { "pc300103.38", 0x100000, 0x51ee162c, BRF_GRA }, // 5 Sprites + { "pc600106.42", 0x080000, 0x25877026, BRF_GRA }, // 6 Sprites + { "pc700107.43", 0x080000, 0xbfe21c44, BRF_GRA }, // 7 Sprites + + { "pc400104.51", 0x100000, 0x3b176f84, BRF_GRA }, // 8 Tiles + { "pc500105.55", 0x100000, 0xbebb3edc, BRF_GRA }, // 9 Tiles (Layers 2 & 3) + + { "pc604109.101", 0x100000, 0x76025530, BRF_SND }, // 10 Samples + { "pc601106.99", 0x100000, 0xa893651c, BRF_SND }, // 11 Samples + { "pc602107.100", 0x100000, 0x0fbb23aa, BRF_SND }, // 12 Samples + { "pc603108.102", 0x100000, 0x58458985, BRF_SND }, // 13 Samples +}; + + +STD_ROM_PICK(Bonkadv) +STD_ROM_FN(Bonkadv) + +static struct BurnRomInfo ExplbrkrRomDesc[] = { + { "ts100e.u18", 0x040000, 0xcc84a985, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ts101e.u19", 0x040000, 0x88f4afb7, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "ts001e.u37", 0x080000, 0x70b66e7e, BRF_GRA }, // 2 Sprites + { "ts000e.u38", 0x080000, 0xa7a94143, BRF_GRA }, // 3 Sprites + { "ts002e.u36", 0x040000, 0x611271e6, BRF_GRA }, // 4 Sprites + + { "ts010.u4", 0x100000, 0xdf935324, BRF_GRA }, // 5 Tiles + { "ts020.u33", 0x100000, 0xeb58c35d, BRF_GRA }, // 6 Tiles (Layers 2 & 3) + + { "ts030.u5", 0x100000, 0x1d68e9d1, BRF_SND }, // 7 Samples +}; + + +STD_ROM_PICK(Explbrkr) +STD_ROM_FN(Explbrkr) + +static struct BurnRomInfo BakubrkrRomDesc[] = { + { "ts100j.u18", 0x040000, 0x8cc0a4fd, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ts101j.u19", 0x040000, 0xaea92195, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "ts001j.u37", 0x080000, 0x70b66e7e, BRF_GRA }, // 2 Sprites + { "ts000j.u38", 0x080000, 0xa7a94143, BRF_GRA }, // 3 Sprites + { "ts002j.u36", 0x040000, 0x611271e6, BRF_GRA }, // 4 Sprites + + { "ts010.u4", 0x100000, 0xdf935324, BRF_GRA }, // 5 Tiles + { "ts020.u33", 0x100000, 0xeb58c35d, BRF_GRA }, // 6 Tiles (Layers 2 & 3) + + { "ts030.u5", 0x100000, 0x1d68e9d1, BRF_SND }, // 7 Samples +}; + + +STD_ROM_PICK(Bakubrkr) +STD_ROM_FN(Bakubrkr) + +static struct BurnRomInfo GtmrRomDesc[] = { + { "u2.bin", 0x080000, 0x031799f7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "u1.bin", 0x080000, 0x6238790a, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "mmd0x2.u124.bin", 0x020000, 0x3d7cb329, BRF_PRG | BRF_OPT }, // 2 MCU Code + + { "mm-200-402-s0.bin", 0x200000, 0xc0ab3efc, BRF_GRA }, // 3 Sprites + { "mm-201-403-s1.bin", 0x200000, 0xcf6b23dc, BRF_GRA }, // 4 Sprites + { "mm-202-404-s2.bin", 0x200000, 0x8f27f5d3, BRF_GRA }, // 5 Sprites + { "mm-203-405-s3.bin", 0x080000, 0xe9747c8c, BRF_GRA }, // 6 Sprites + { "mms1x2.u30.bin", 0x020000, 0xb42b426f, BRF_GRA }, // 7 Sprites + { "mms0x2.u29.bin", 0x020000, 0xbd22b7d2, BRF_GRA }, // 8 Sprites + + { "mm-300-406-a0.bin", 0x200000, 0xb15f6b7f, BRF_GRA }, // 9 Tiles + + { "mm-100-401-e0.bin", 0x100000, 0xb9cbfbee, BRF_SND }, // 10 Samples +}; + + +STD_ROM_PICK(Gtmr) +STD_ROM_FN(Gtmr) + +static struct BurnRomInfo GtmraRomDesc[] = { + { "mmp0x2.u514.bin", 0x080000, 0xba4a77c8, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "mmp1x2.u513.bin", 0x080000, 0xa2b9034e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "mmd0x2.u124.bin", 0x020000, 0x3d7cb329, BRF_PRG | BRF_OPT }, // 2 MCU Code + + { "mm-200-402-s0.bin", 0x200000, 0xc0ab3efc, BRF_GRA }, // 3 Sprites + { "mm-201-403-s1.bin", 0x200000, 0xcf6b23dc, BRF_GRA }, // 4 Sprites + { "mm-202-404-s2.bin", 0x200000, 0x8f27f5d3, BRF_GRA }, // 5 Sprites + { "mm-203-405-s3.bin", 0x080000, 0xe9747c8c, BRF_GRA }, // 6 Sprites + { "mms1x2.u30.bin", 0x020000, 0xb42b426f, BRF_GRA }, // 7 Sprites + { "mms0x2.u29.bin", 0x020000, 0xbd22b7d2, BRF_GRA }, // 8 Sprites + + { "mm-300-406-a0.bin", 0x200000, 0xb15f6b7f, BRF_GRA }, // 9 Tiles + + { "mm-100-401-e0.bin", 0x100000, 0xb9cbfbee, BRF_SND }, // 10 Samples +}; + + +STD_ROM_PICK(Gtmra) +STD_ROM_FN(Gtmra) + +static struct BurnRomInfo GtmreRomDesc[] = { + { "gmmu2.bin", 0x080000, 0x36dc4aa9, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "gmmu1.bin", 0x080000, 0x8653c144, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "gtmrusa.u12", 0x020000, 0x2e1a06ff, BRF_PRG | BRF_OPT }, // 2 MCU Code + + { "gmmu27.bin", 0x200000, 0xc0ab3efc, BRF_GRA }, // 3 Sprites + { "gmmu28.bin", 0x200000, 0xcf6b23dc, BRF_GRA }, // 4 Sprites + { "gmmu29.bin", 0x200000, 0x8f27f5d3, BRF_GRA }, // 5 Sprites + { "gmmu30.bin", 0x080000, 0xe9747c8c, BRF_GRA }, // 6 Sprites + { "gmmu64.bin", 0x100000, 0x57d77b33, BRF_GRA }, // 7 Sprites + { "gmmu65.bin", 0x100000, 0x05b8bdca, BRF_GRA }, // 8 Sprites + + { "gmmu52.bin", 0x200000, 0xb15f6b7f, BRF_GRA }, // 9 Tiles + + { "gmmu23.bin", 0x100000, 0xb9cbfbee, BRF_SND }, // 10 Samples + { "gmmu24.bin", 0x100000, 0x380cdc7c, BRF_SND }, // 11 Samples +}; + + +STD_ROM_PICK(Gtmre) +STD_ROM_FN(Gtmre) + +static struct BurnRomInfo GtmrusaRomDesc[] = { + { "gtmrusa.u2", 0x080000, 0x5be615c4, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "gtmrusa.u1", 0x080000, 0xae853e4e, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "gtmrusa.u12", 0x020000, 0x2e1a06ff, BRF_PRG | BRF_OPT }, // 2 MCU Code + + { "gmmu27.bin", 0x200000, 0xc0ab3efc, BRF_GRA }, // 3 Sprites + { "gmmu28.bin", 0x200000, 0xcf6b23dc, BRF_GRA }, // 4 Sprites + { "gmmu29.bin", 0x200000, 0x8f27f5d3, BRF_GRA }, // 5 Sprites + { "gmmu30.bin", 0x080000, 0xe9747c8c, BRF_GRA }, // 6 Sprites + { "gmmu64.bin", 0x100000, 0x57d77b33, BRF_GRA }, // 7 Sprites + { "gmmu65.bin", 0x100000, 0x05b8bdca, BRF_GRA }, // 8 Sprites + + { "gmmu52.bin", 0x200000, 0xb15f6b7f, BRF_GRA }, // 9 Tiles + + { "gmmu23.bin", 0x100000, 0xb9cbfbee, BRF_SND }, // 10 Samples + { "gmmu24.bin", 0x100000, 0x380cdc7c, BRF_SND }, // 11 Samples +}; + + +STD_ROM_PICK(Gtmrusa) +STD_ROM_FN(Gtmrusa) + +static struct BurnRomInfo Gtmr2RomDesc[] = { + { "m2p0x1a.u8", 0x080000, 0xc29039fb, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "m2p1x1a.u7", 0x080000, 0x8ef392c4, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "m2d0x0.u31", 0x020000, 0x2e1a06ff, BRF_PRG | BRF_OPT }, // 2 MCU Code + + { "m2-200-0.u49", 0x400000, 0x93aafc53, BRF_GRA }, // 3 Sprites + { "m2-201-0.u50", 0x200000, 0x39b60a83, BRF_GRA }, // 4 Sprites + { "m2-202-0.u51", 0x200000, 0xfd06b339, BRF_GRA }, // 5 Sprites + { "m2s0x1a.u32", 0x080000, 0xa485eec6, BRF_GRA }, // 6 Sprites + { "m2s1x1a.u33", 0x080000, 0xc5b71bb2, BRF_GRA }, // 7 Sprites + + { "m2-300-0.u89", 0x200000, 0x4dc42fbb, BRF_GRA }, // 8 Tiles + { "m2-301-0.u90", 0x200000, 0xf4e894f2, BRF_GRA }, // 9 Tiles + { "m2b0x0.u93", 0x020000, 0xe023d51b, BRF_GRA }, // 10 Tiles + { "m2b1x0.u94", 0x020000, 0x03c48bdb, BRF_GRA }, // 11 Tiles + + { "m2-100-0.u48", 0x100000, 0x5250fa45, BRF_SND }, // 12 Samples + { "m2w1x0.u47", 0x040000, 0x1b0513c5, BRF_SND }, // 13 Samples +}; + + +STD_ROM_PICK(Gtmr2) +STD_ROM_FN(Gtmr2) + +static struct BurnRomInfo Gtmr2aRomDesc[] = { + { "m2p0x1.u8", 0x080000, 0x525f6618, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "m2p1x1.u7", 0x080000, 0x914683e5, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "m2d0x0.u31", 0x020000, 0x2e1a06ff, BRF_PRG | BRF_OPT }, // 2 MCU Code + + { "m2-200-0.u49", 0x400000, 0x93aafc53, BRF_GRA }, // 3 Sprites + { "m2-201-0.u50", 0x200000, 0x39b60a83, BRF_GRA }, // 4 Sprites + { "m2-202-0.u51", 0x200000, 0xfd06b339, BRF_GRA }, // 5 Sprites + { "m2s0x1.u32", 0x080000, 0x4069d6c7, BRF_GRA }, // 6 Sprites + { "m2s1x1.u33", 0x080000, 0xc53fe269, BRF_GRA }, // 7 Sprites + + { "m2-300-0.u89", 0x200000, 0x4dc42fbb, BRF_GRA }, // 8 Tiles + { "m2-301-0.u90", 0x200000, 0xf4e894f2, BRF_GRA }, // 9 Tiles + { "m2b0x0.u93", 0x020000, 0xe023d51b, BRF_GRA }, // 10 Tiles + { "m2b1x0.u94", 0x020000, 0x03c48bdb, BRF_GRA }, // 11 Tiles + + { "m2-100-0.u48", 0x100000, 0x5250fa45, BRF_SND }, // 12 Samples + { "m2w1x0.u47", 0x040000, 0x1b0513c5, BRF_SND }, // 13 Samples +}; + + +STD_ROM_PICK(Gtmr2a) +STD_ROM_FN(Gtmr2a) + +static struct BurnRomInfo Gtmr2uRomDesc[] = { + { "m2p0a1.u8", 0x080000, 0x813e1d5e, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "m2p1a1.u7", 0x080000, 0xbee63666, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "m2d0x0.u31", 0x020000, 0x2e1a06ff, BRF_PRG | BRF_OPT }, // 2 MCU Code + + { "m2-200-0.u49", 0x400000, 0x93aafc53, BRF_GRA }, // 3 Sprites + { "m2-201-0.u50", 0x200000, 0x39b60a83, BRF_GRA }, // 4 Sprites + { "m2-202-0.u51", 0x200000, 0xfd06b339, BRF_GRA }, // 5 Sprites + { "m2s0a1.u32", 0x080000, 0x98977171, BRF_GRA }, // 6 Sprites + { "m2s1a1.u33", 0x080000, 0xc69a732e, BRF_GRA }, // 7 Sprites + + { "m2-300-0.u89", 0x200000, 0x4dc42fbb, BRF_GRA }, // 8 Tiles + { "m2-301-0.u90", 0x200000, 0xf4e894f2, BRF_GRA }, // 9 Tiles + { "m2b0x0.u93", 0x020000, 0xe023d51b, BRF_GRA }, // 10 Tiles + { "m2b1x0.u94", 0x020000, 0x03c48bdb, BRF_GRA }, // 11 Tiles + + { "m2-100-0.u48", 0x100000, 0x5250fa45, BRF_SND }, // 12 Samples + { "m2w1a1.u47", 0x080000, 0x15f25342, BRF_SND }, // 13 Samples +}; + + +STD_ROM_PICK(Gtmr2u) +STD_ROM_FN(Gtmr2u) + +static struct BurnRomInfo MgcrystlRomDesc[] = { + { "mc100e02.u18", 0x020000, 0x246a1335, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "mc101e02.u19", 0x040000, 0x708ea1dc, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "mc000.u38", 0x100000, 0x28acf6f4, BRF_GRA }, // 2 Sprites + { "mc001.u37", 0x080000, 0x005bc43d, BRF_GRA }, // 3 Sprites + { "mc002e02.u36", 0x020000, 0x27ac1056, BRF_GRA }, // 4 Sprites + + { "mc010.u04", 0x100000, 0x85072772, BRF_GRA }, // 5 Tiles + { "mc020.u34", 0x100000, 0x1ea92ff1, BRF_GRA }, // 6 Tiles (Layers 2 & 3) + + { "mc030.u32", 0x040000, 0xc165962e, BRF_SND }, // 7 Samples +}; + + +STD_ROM_PICK(Mgcrystl) +STD_ROM_FN(Mgcrystl) + +static struct BurnRomInfo MgcrystloRomDesc[] = { + { "mc100h00.u18", 0x020000, 0xc7456ba7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "mc101h00.u19", 0x040000, 0xea8f9300, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "mc000.u38", 0x100000, 0x28acf6f4, BRF_GRA }, // 2 Sprites + { "mc001.u37", 0x080000, 0x005bc43d, BRF_GRA }, // 3 Sprites + { "mc002h00.u36", 0x020000, 0x22729037, BRF_GRA }, // 4 Sprites + + { "mc010.u04", 0x100000, 0x85072772, BRF_GRA }, // 5 Tiles + { "mc020.u34", 0x100000, 0x1ea92ff1, BRF_GRA }, // 6 Tiles (Layers 2 & 3) + + { "mc030.u32", 0x040000, 0xc165962e, BRF_SND }, // 7 Samples +}; + + +STD_ROM_PICK(Mgcrystlo) +STD_ROM_FN(Mgcrystlo) + +static struct BurnRomInfo MgcrystljRomDesc[] = { + { "mc100j02.u18", 0x020000, 0xafe5882d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "mc101j02.u19", 0x040000, 0x60da5492, BRF_ESS | BRF_PRG }, // 1 68000 Program Code + + { "mc000.u38", 0x100000, 0x28acf6f4, BRF_GRA }, // 2 Sprites + { "mc001.u37", 0x080000, 0x005bc43d, BRF_GRA }, // 3 Sprites + { "mc002e02.u36", 0x020000, 0x27ac1056, BRF_GRA }, // 4 Sprites + + { "mc010.u04", 0x100000, 0x85072772, BRF_GRA }, // 5 Tiles + { "mc020.u34", 0x100000, 0x1ea92ff1, BRF_GRA }, // 6 Tiles (Layers 2 & 3) + + { "mc030.u32", 0x040000, 0xc165962e, BRF_SND }, // 7 Samples +}; + + +STD_ROM_PICK(Mgcrystlj) +STD_ROM_FN(Mgcrystlj) + +/*============================================================================================== +Graphics Decoding +===============================================================================================*/ + +static void Kaneko16DecodeBg15Bitmaps() +{ + INT32 sx, x, y; + + for (sx = 0; sx < 32; sx++) { + for (x = 0; x < 256; x++) { + for (y = 0; y < 256; y++) { + INT32 addr = (sx * 256 * 256) + (y * 256) + x; + INT32 data = (Kaneko16TempGfx[addr * 2 + 0] * 256) + Kaneko16TempGfx[addr * 2 + 1]; + INT32 r, g, b; + + r = (data & 0x07c0) >> 6; + g = (data & 0xf800) >> 11; + b = (data & 0x003e) >> 1; + + r ^= 0x09; + + if (~g & 0x08) g ^= 0x010; + g = (g - 1) & 0x1f; + + b ^= 0x03; + if (~b & 0x08) b ^= 0x10; + b = (b + 2) & 0x1f; + + if ((r & 0x10) && (b & 0x10)) g = (g - 1) & 0x1f; + + Kaneko16Bg15Data[addr] = 2048 + ((g << 10) | (r << 5) | b); + } + } + } +} + +/*============================================================================================== +Unscramble Tile/Sound ROM Functions +===============================================================================================*/ + +static void UnscrambleTiles(INT32 length) +{ + UINT8 *RAM = Kaneko16TempGfx; + INT32 i; + + if (RAM == NULL) return; + + for (i = 0; i < length; i ++) + { + RAM[i] = ((RAM[i] & 0xF0)>>4) + ((RAM[i] & 0x0F)<<4); + } +} + +static void ExpandSampleBanks() +{ + INT32 bank; + + for (bank = 15; bank > 0; bank--) + { + UINT8 *src0 = MSM6295ROMData; + UINT8 *srcn = src0 + 0x10000 * (bank < 3 ? 3 : bank); + UINT8 *dst = src0 + 0x40000 * bank; + + memcpy(dst + 0x30000, srcn + 0x00000, 0x10000); + memcpy(dst + 0x00000, src0 + 0x00000, 0x30000); + } +} + +/*============================================================================================== +Allocate Memory +===============================================================================================*/ + +static INT32 GtmrMemIndex() +{ + UINT8 *Next; Next = Mem; + + Kaneko16Rom = Next; Next += 0x100000; + MSM6295ROM = Next; Next += 0x140000; + MSM6295ROMData = Next; Next += 0x400000; + MSM6295ROMData2 = Next; Next += 0x300000; + + RamStart = Next; + + Kaneko16Ram = Next; Next += 0x028000; + Kaneko16MCURam = Next; Next += 0x010000; + Kaneko16NVRam = Next; Next += 0x000100; + Kaneko16PaletteRam = Next; Next += 0x010000; + Kaneko16SpriteRam = Next; Next += Kaneko16SpriteRamSize; + Kaneko16Video0Ram = Next; Next += 0x001000; + Kaneko16Video1Ram = Next; Next += 0x001000; + Kaneko16Video2Ram = Next; Next += 0x001000; + Kaneko16Video3Ram = Next; Next += 0x001000; + Kaneko16VScrl0Ram = Next; Next += 0x001000; + Kaneko16VScrl1Ram = Next; Next += 0x001000; + Kaneko16VScrl2Ram = Next; Next += 0x001000; + Kaneko16VScrl3Ram = Next; Next += 0x001000; + + RamEnd = Next; + + Kaneko16Sprites = Next; Next += (Kaneko16NumSprites * 16 * 16); + Kaneko16Tiles = Next; Next += (Kaneko16NumTiles * 16 * 16); + LayerQueueXY[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueXY[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueColour[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueColour[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueuePriority[0] = Next; Next += nScreenWidth * nScreenHeight; + LayerQueuePriority[1] = Next; Next += nScreenWidth * nScreenHeight; + if (Kaneko16NumTiles2) { + Kaneko16Tiles2 = Next; Next += (Kaneko16NumTiles2 * 16 * 16); + LayerQueueXY[2] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueXY[3] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueColour[2] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueColour[3] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueuePriority[2] = Next; Next += nScreenWidth * nScreenHeight; + LayerQueuePriority[3] = Next; Next += nScreenWidth * nScreenHeight; + } + Kaneko16Palette = (UINT32*)Next; Next += 0x010000 * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +static INT32 ExplbrkrMemIndex() +{ + UINT8 *Next; Next = Mem; + + Kaneko16Rom = Next; Next += 0x080000; + MSM6295ROM = Next; Next += 0x040000; + MSM6295ROMData = Next; Next += 0x200000; + + RamStart = Next; + + Kaneko16Ram = Next; Next += 0x010000; + Kaneko16PaletteRam = Next; Next += 0x001000; + Kaneko16SpriteRam = Next; Next += Kaneko16SpriteRamSize; + Kaneko16Video0Ram = Next; Next += 0x001000; + Kaneko16Video1Ram = Next; Next += 0x001000; + Kaneko16Video2Ram = Next; Next += 0x001000; + Kaneko16Video3Ram = Next; Next += 0x001000; + Kaneko16VScrl0Ram = Next; Next += 0x001000; + Kaneko16VScrl1Ram = Next; Next += 0x001000; + Kaneko16VScrl2Ram = Next; Next += 0x001000; + Kaneko16VScrl3Ram = Next; Next += 0x001000; + + RamEnd = Next; + + Kaneko16Sprites = Next; Next += (Kaneko16NumSprites * 16 * 16); + Kaneko16Tiles = Next; Next += (Kaneko16NumTiles * 16 * 16); + LayerQueueXY[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueXY[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueColour[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueColour[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueuePriority[0] = Next; Next += nScreenWidth * nScreenHeight; + LayerQueuePriority[1] = Next; Next += nScreenWidth * nScreenHeight; + if (Kaneko16NumTiles2) { + Kaneko16Tiles2 = Next; Next += (Kaneko16NumTiles2 * 16 * 16); + LayerQueueXY[2] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueXY[3] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueColour[2] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueColour[3] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueuePriority[2] = Next; Next += nScreenWidth * nScreenHeight; + LayerQueuePriority[3] = Next; Next += nScreenWidth * nScreenHeight; + } + pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); + if (Kaneko16Bg15) { + Kaneko16Bg15Data = (UINT16*)Next; Next += (32 * 256 * 256) * sizeof(UINT16); // 32 bitmaps - 256 x 256 + Kaneko16Palette = (UINT32*)Next; Next += (0x001000 + 32768) * sizeof(UINT32); + } else { + Kaneko16Palette = (UINT32*)Next; Next += 0x001000 * sizeof(UINT32); + } + MemEnd = Next; + + return 0; +} + +static INT32 BlazeonMemIndex() +{ + UINT8 *Next; Next = Mem; + + Kaneko16Rom = Next; Next += 0x080000; + Kaneko16Z80Rom = Next; Next += 0x020000; + + RamStart = Next; + + Kaneko16Ram = Next; Next += 0x010000; + Kaneko16Z80Ram = Next; Next += 0x002000; + Kaneko16PaletteRam = Next; Next += 0x001000; + Kaneko16SpriteRam = Next; Next += Kaneko16SpriteRamSize; + Kaneko16Video0Ram = Next; Next += 0x001000; + Kaneko16Video1Ram = Next; Next += 0x001000; + Kaneko16VScrl0Ram = Next; Next += 0x001000; + Kaneko16VScrl1Ram = Next; Next += 0x001000; + + RamEnd = Next; + + Kaneko16Sprites = Next; Next += (Kaneko16NumSprites * 16 * 16); + Kaneko16Tiles = Next; Next += (Kaneko16NumTiles * 16 * 16); + LayerQueueXY[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueXY[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueColour[0] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueueColour[1] = (UINT32*)Next; Next += nScreenWidth * nScreenHeight * sizeof(UINT32); + LayerQueuePriority[0] = Next; Next += nScreenWidth * nScreenHeight; + LayerQueuePriority[1] = Next; Next += nScreenWidth * nScreenHeight; + Kaneko16Palette = (UINT32*)Next; Next += 0x001000 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +/*============================================================================================== +Protection Calculator +===============================================================================================*/ + +static struct { + UINT16 x1p, y1p, x1s, y1s; + UINT16 x2p, y2p, x2s, y2s; + + INT16 x12, y12, x21, y21; + + UINT16 mult_a, mult_b; +} hit; + +static INT16 calc_compute_x(void) +{ + INT16 x_coll; + + // X distance + if ((hit.x2p >= hit.x1p) && (hit.x2p < (hit.x1p + hit.x1s))) // x2p inside x1 + x_coll = (hit.x1s - (hit.x2p - hit.x1p)); + else if ((hit.x1p >= hit.x2p) && (hit.x1p < (hit.x2p + hit.x2s))) // x1p inside x2 + x_coll = (hit.x2s - (hit.x1p - hit.x2p)); + else // normal/no overlap + x_coll = ((hit.x1s + hit.x2s)/2) - abs((hit.x1p + hit.x1s/2) - (hit.x2p + hit.x2s/2)); + + return x_coll; +} +static INT16 calc_compute_y(void) +{ + INT16 y_coll; + + // Y distance + if ((hit.y2p >= hit.y1p) && (hit.y2p < (hit.y1p + hit.y1s))) // y2p inside y1 + y_coll = (hit.y1s - (hit.y2p - hit.y1p)); + else if ((hit.y1p >= hit.y2p) && (hit.y1p < (hit.y2p + hit.y2s))) // y1p inside y2 + y_coll = (hit.y2s - (hit.y1p - hit.y2p)); + else // normal/no overlap + y_coll = ((hit.y1s + hit.y2s)/2) - abs((hit.y1p + hit.y1s/2) - (hit.y2p + hit.y2s/2)); + + return y_coll; +} + +static UINT16 BloodwarCalcRead(INT32 offset) +{ + UINT16 data = 0; + INT16 x_coll, y_coll; + + x_coll = calc_compute_x(); + y_coll = calc_compute_y(); + + switch (offset) + { + case 0x00/2: // X distance + return x_coll; + + case 0x02/2: // Y distance + return y_coll; + + case 0x04/2: // similar to the hit detection from SuperNova, but much simpler + + // 4th nibble: Y Absolute Collision -> possible values = 9,8,4,3,2 + if (hit.y1p > hit.y2p) data |= 0x2000; + else if (hit.y1p == hit.y2p) data |= 0x4000; + else if (hit.y1p < hit.y2p) data |= 0x8000; + if (y_coll<0) data |= 0x1000; + + // 3rd nibble: X Absolute Collision -> possible values = 9,8,4,3,2 + if (hit.x1p > hit.x2p) data |= 0x0200; + else if (hit.x1p == hit.x2p) data |= 0x0400; + else if (hit.x1p < hit.x2p) data |= 0x0800; + if (x_coll<0) data |= 0x0100; + + // 2nd nibble: always set to 4 + data |= 0x0040; + + // 1st nibble: XY Overlap Collision -> possible values = 0,2,4,f + if (x_coll>=0) data |= 0x0004; + if (y_coll>=0) data |= 0x0002; + if ((x_coll>=0)&&(y_coll>=0)) data |= 0x000F; + + return data; + + case 0x14/2: + return rand() & 0xffff; + + case 0x20/2: return hit.x1p; + case 0x22/2: return hit.x1s; + case 0x24/2: return hit.y1p; + case 0x26/2: return hit.y1s; + + case 0x2c/2: return hit.x2p; + case 0x2e/2: return hit.x2s; + case 0x30/2: return hit.y2p; + case 0x32/2: return hit.y2s; + } + + return 0; +} + +static UINT16 BonkadvCalcRead(INT32 offset) +{ + UINT16 data = 0; + + switch (offset) + { + case 0x00/2: // watchdog + return 0; + + case 0x02/2: // unknown (yet!), used by *MANY* games !!! + break; + + case 0x04/2: // similar to the hit detection from SuperNova, but much simpler + + // X Absolute Collision + if (hit.x1p > hit.x2p) data |= 0x0200; + else if (hit.x1p == hit.x2p) data |= 0x0400; + else if (hit.x1p < hit.x2p) data |= 0x0800; + + // Y Absolute Collision + if (hit.y1p > hit.y2p) data |= 0x2000; + else if (hit.y1p == hit.y2p) data |= 0x4000; + else if (hit.y1p < hit.y2p) data |= 0x8000; + + // XY Overlap Collision + hit.x12 = (hit.x1p) - (hit.x2p + hit.x2s); + hit.y12 = (hit.y1p) - (hit.y2p + hit.y2s); + hit.x21 = (hit.x1p + hit.x1s) - (hit.x2p); + hit.y21 = (hit.y1p + hit.y1s) - (hit.y2p); + + if ((hit.x12 < 0) && (hit.y12 < 0) && + (hit.x21 >= 0) && (hit.y21 >= 0)) + data |= 0x0001; + + return data; + + case 0x10/2: + return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) >> 16); + case 0x12/2: + return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) & 0xffff); + + case 0x14/2: + return rand() & 0xffff; + } + + return 0; +} + +static void BloodwarCalcWrite(INT32 offset, UINT16 data) +{ + switch (offset) { + case 0x20 >> 1: hit.x1p = data; return; + case 0x22 >> 1: hit.x1s = data; return; + case 0x24 >> 1: hit.y1p = data; return; + case 0x26 >> 1: hit.y1s = data; return; + + case 0x2c >> 1: hit.x2p = data; return; + case 0x2e >> 1: hit.x2s = data; return; + case 0x30 >> 1: hit.y2p = data; return; + case 0x32 >> 1: hit.y2s = data; return; + } +} + +static void BonkadvCalcWrite(INT32 offset, UINT16 data) +{ + switch (offset) { + case 0x00 >> 1: hit.x1p = data; return; + case 0x02 >> 1: hit.x1s = data; return; + case 0x04 >> 1: hit.y1p = data; return; + case 0x06 >> 1: hit.y1s = data; return; + case 0x08 >> 1: hit.x2p = data; return; + case 0x0a >> 1: hit.x2s = data; return; + case 0x0c >> 1: hit.y2p = data; return; + case 0x0e >> 1: hit.y2s = data; return; + case 0x10 >> 1: hit.mult_a = data; return; + case 0x12 >> 1: hit.mult_b = data; return; + } +} + +/*============================================================================================== +Toybox MCU +===============================================================================================*/ + +static void ToyboxMCUInit() +{ + memset(ToyboxMCUCom, 0, 4 * sizeof(UINT16)); +} + +static UINT16 ToyboxMCUStatusRead() +{ + return 0; +} + +#define MCU_RESPONSE(d) memcpy(&MCURam[MCUOffset], d, sizeof(d)) + +static void BloodwarMCURun() +{ + UINT16 *MCURam = (UINT16*)Kaneko16MCURam; + UINT16 *NVRam = (UINT16*)Kaneko16NVRam; + + UINT16 MCUCommand = MCURam[0x10/2]; + UINT16 MCUOffset = MCURam[0x12/2] >> 1; + UINT16 MCUData = MCURam[0x14/2]; + + switch (MCUCommand >> 8) { + case 0x02: { + memcpy(MCURam + MCUOffset, NVRam, 128); + return; + } + + case 0x03: { + MCURam[MCUOffset + 0] = 0xff00 - (Kaneko16Dip[0] << 8); + return; + } + + case 0x04: { + switch (MCUData) { + // unknown purpose data + case 0x01: MCU_RESPONSE(bloodwar_mcu_4_01); break; // Warrior 1 + case 0x02: MCU_RESPONSE(bloodwar_mcu_4_02); break; // Warrior 2 + case 0x03: MCU_RESPONSE(bloodwar_mcu_4_03); break; // Warrior 3 + case 0x04: MCU_RESPONSE(bloodwar_mcu_4_04); break; // Warrior 4 + case 0x05: MCU_RESPONSE(bloodwar_mcu_4_05); break; // Warrior 5 + case 0x06: MCU_RESPONSE(bloodwar_mcu_4_06); break; // Warrior 6 + case 0x07: MCU_RESPONSE(bloodwar_mcu_4_07); break; // Warrior 7 + case 0x08: MCU_RESPONSE(bloodwar_mcu_4_08); break; // Warrior 8 + case 0x09: MCU_RESPONSE(bloodwar_mcu_4_09); break; // Warrior 9 + + // palette data + case 0x0a: MCU_RESPONSE(bloodwar_mcu_4_0a); break; // Warrior 1 Player 1 + case 0x0b: MCU_RESPONSE(bloodwar_mcu_4_0b); break; // Warrior 1 Player 2 + case 0x0c: MCU_RESPONSE(bloodwar_mcu_4_0c); break; // Warrior 5 Player 1 + case 0x0d: MCU_RESPONSE(bloodwar_mcu_4_0d); break; // Warrior 5 Player 2 + case 0x0e: MCU_RESPONSE(bloodwar_mcu_4_0e); break; // Warrior 4 Player 2 + case 0x0f: MCU_RESPONSE(bloodwar_mcu_4_0f); break; // Warrior 4 Player 1 + case 0x10: MCU_RESPONSE(bloodwar_mcu_4_10); break; // Warrior 6 Player 1 + case 0x11: MCU_RESPONSE(bloodwar_mcu_4_11); break; // Warrior 6 Player 2 + case 0x12: MCU_RESPONSE(bloodwar_mcu_4_12); break; // Warrior 9 Player 1 + case 0x13: MCU_RESPONSE(bloodwar_mcu_4_13); break; // Warrior 9 Player 2 + case 0x14: MCU_RESPONSE(bloodwar_mcu_4_14); break; // Warrior 7 Player 1 + case 0x15: MCU_RESPONSE(bloodwar_mcu_4_15); break; // Warrior 7 Player 2 + case 0x16: MCU_RESPONSE(bloodwar_mcu_4_16); break; // Warrior 8 Player 1 + case 0x17: MCU_RESPONSE(bloodwar_mcu_4_17); break; // Warrior 8 Player 2 + case 0x18: MCU_RESPONSE(bloodwar_mcu_4_18); break; // Warrior 2 Player 2 + case 0x19: MCU_RESPONSE(bloodwar_mcu_4_19); break; // Warrior 2 Player 1 + case 0x1a: MCU_RESPONSE(bloodwar_mcu_4_1a); break; // Warrior 3 Player 1 + case 0x1b: MCU_RESPONSE(bloodwar_mcu_4_1b); break; // Warrior 3 Player 2 + + // tilemap data + case 0x1c: MCU_RESPONSE(bloodwar_mcu_4_1c); break; // Warrior 8 + case 0x1d: MCU_RESPONSE(bloodwar_mcu_4_1d); break; // Warrior 2 + case 0x1e: MCU_RESPONSE(bloodwar_mcu_4_1e); break; // Warrior 3 + case 0x1f: MCU_RESPONSE(bloodwar_mcu_4_1f); break; // Warrior 5 + case 0x20: MCU_RESPONSE(bloodwar_mcu_4_20); break; // Warrior 4 + case 0x21: MCU_RESPONSE(bloodwar_mcu_4_21); break; // Warrior 6 + case 0x22: MCU_RESPONSE(bloodwar_mcu_4_22); break; // Warrior 1 + case 0x23: MCU_RESPONSE(bloodwar_mcu_4_23); break; // Warrior 9 + case 0x24: MCU_RESPONSE(bloodwar_mcu_4_24); break; // Warrior 7 + + // fighter data: pointers to ROM data + case 0x25: MCU_RESPONSE(bloodwar_mcu_4_25); break; // Warrior 1 + case 0x26: MCU_RESPONSE(bloodwar_mcu_4_26); break; // Warrior 2 + case 0x27: MCU_RESPONSE(bloodwar_mcu_4_27); break; // Warrior 3 + case 0x28: MCU_RESPONSE(bloodwar_mcu_4_28); break; // Warrior 4 + case 0x29: MCU_RESPONSE(bloodwar_mcu_4_29); break; // Warrior 5 + case 0x2a: MCU_RESPONSE(bloodwar_mcu_4_2a); break; // Warrior 6 + case 0x2b: MCU_RESPONSE(bloodwar_mcu_4_2b); break; // Warrior 7 + case 0x2c: MCU_RESPONSE(bloodwar_mcu_4_2c); break; // Warrior 8 + case 0x2d: MCU_RESPONSE(bloodwar_mcu_4_2d); break; // Warrior 9 + } + return; + } + + case 0x42: { + memcpy(NVRam, MCURam + MCUOffset, 128); + return; + } + } +} + +static void BonkadvMCURun() +{ + UINT16 *MCURam = (UINT16*)Kaneko16MCURam; + UINT16 *NVRam = (UINT16*)Kaneko16NVRam; + + UINT16 MCUCommand = MCURam[0x10/2]; + UINT16 MCUOffset = MCURam[0x12/2] >> 1; + UINT16 MCUData = MCURam[0x14/2]; + + switch (MCUCommand >> 8) { + case 0x02: { + memcpy(MCURam + MCUOffset, NVRam, 128); + return; + } + + case 0x03: { + MCURam[MCUOffset + 0] = 0xff00 - (Kaneko16Dip[0] << 8); + return; + } + + case 0x04: { + switch (MCUData) { + // static, in this order, at boot/reset + case 0x34: MCU_RESPONSE(bonkadv_mcu_4_34); break; + case 0x30: MCU_RESPONSE(bonkadv_mcu_4_30); break; + case 0x31: MCU_RESPONSE(bonkadv_mcu_4_31); break; + case 0x32: MCU_RESPONSE(bonkadv_mcu_4_32); break; + case 0x33: MCU_RESPONSE(bonkadv_mcu_4_33); break; + + // dynamic, per-level (29), in level order + case 0x00: MCU_RESPONSE(bonkadv_mcu_4_00); break; + case 0x02: MCU_RESPONSE(bonkadv_mcu_4_02); break; + case 0x01: MCU_RESPONSE(bonkadv_mcu_4_01); break; + case 0x05: MCU_RESPONSE(bonkadv_mcu_4_05); break; + case 0x07: MCU_RESPONSE(bonkadv_mcu_4_07); break; + case 0x06: MCU_RESPONSE(bonkadv_mcu_4_06); break; + case 0x09: MCU_RESPONSE(bonkadv_mcu_4_09); break; + case 0x0D: MCU_RESPONSE(bonkadv_mcu_4_0D); break; + case 0x03: MCU_RESPONSE(bonkadv_mcu_4_03); break; + case 0x08: MCU_RESPONSE(bonkadv_mcu_4_08); break; + case 0x04: MCU_RESPONSE(bonkadv_mcu_4_04); break; + case 0x0C: MCU_RESPONSE(bonkadv_mcu_4_0C); break; + case 0x0A: MCU_RESPONSE(bonkadv_mcu_4_0A); break; + case 0x0B: MCU_RESPONSE(bonkadv_mcu_4_0B); break; + case 0x10: MCU_RESPONSE(bonkadv_mcu_4_10); break; + case 0x0E: MCU_RESPONSE(bonkadv_mcu_4_0E); break; + case 0x13: MCU_RESPONSE(bonkadv_mcu_4_13); break; + case 0x0F: MCU_RESPONSE(bonkadv_mcu_4_0F); break; + case 0x11: MCU_RESPONSE(bonkadv_mcu_4_11); break; + case 0x14: MCU_RESPONSE(bonkadv_mcu_4_14); break; + case 0x12: MCU_RESPONSE(bonkadv_mcu_4_12); break; + case 0x17: MCU_RESPONSE(bonkadv_mcu_4_17); break; + case 0x1A: MCU_RESPONSE(bonkadv_mcu_4_1A); break; + case 0x15: MCU_RESPONSE(bonkadv_mcu_4_15); break; + case 0x18: MCU_RESPONSE(bonkadv_mcu_4_18); break; + case 0x16: MCU_RESPONSE(bonkadv_mcu_4_16); break; + case 0x19: MCU_RESPONSE(bonkadv_mcu_4_19); break; + case 0x1B: MCU_RESPONSE(bonkadv_mcu_4_1B); break; + case 0x1C: MCU_RESPONSE(bonkadv_mcu_4_1C); break; + } + return; + } + + case 0x42: { + memcpy(NVRam, MCURam + MCUOffset, 128); + return; + } + + case 0x43: { + // Reset defaults + memcpy(NVRam, bonkadv_mcu_43, sizeof(bonkadv_mcu_43)); + return; + } + } +} + +#undef MCU_RESPONSE + +static void GtmrMCURun() +{ + UINT16 *MCURam = (UINT16*)Kaneko16MCURam; + UINT16 *NVRam = (UINT16*)Kaneko16NVRam; + + UINT16 MCUCommand = MCURam[0x10/2]; + UINT16 MCUOffset = MCURam[0x12/2] >> 1; + + switch (MCUCommand >> 8) { + case 0x02: { + memcpy(MCURam + MCUOffset, NVRam, 128); + return; + } + + case 0x03: { + MCURam[MCUOffset + 0] = 0xff00 - (Kaneko16Dip[0] << 8); + return; + } + + case 0x04: { + /* MCU writes the string "MM0525-TOYBOX199" to shared ram */ + MCURam[MCUOffset + 0] = 0x4d4d; + MCURam[MCUOffset + 1] = 0x3035; + MCURam[MCUOffset + 2] = 0x3235; + MCURam[MCUOffset + 3] = 0x2d54; + MCURam[MCUOffset + 4] = 0x4f59; + MCURam[MCUOffset + 5] = 0x424f; + MCURam[MCUOffset + 6] = 0x5831; + MCURam[MCUOffset + 7] = 0x3939; + return; + } + + case 0x42: { + memcpy(NVRam, MCURam + MCUOffset, 128); + return; + } + } +} + +static void GtmrevoMCURun() +{ + UINT16 *MCURam = (UINT16*)Kaneko16MCURam; + UINT16 *NVRam = (UINT16*)Kaneko16NVRam; + + UINT16 MCUCommand = MCURam[0x10/2]; + UINT16 MCUOffset = MCURam[0x12/2] >> 1; + + switch (MCUCommand >> 8) { + case 0x02: { + memcpy(MCURam + MCUOffset, NVRam, 128); + return; + } + + case 0x03: { + MCURam[MCUOffset + 0] = 0xff00 - (Kaneko16Dip[0] << 8); + return; + } + + case 0x04: { + /* MCU writes the string "USMM0713-TB1994 " to shared ram */ + MCURam[MCUOffset + 0] = 0x5553; + MCURam[MCUOffset + 1] = 0x4d4d; + MCURam[MCUOffset + 2] = 0x3037; + MCURam[MCUOffset + 3] = 0x3133; + MCURam[MCUOffset + 4] = 0x2d54; + MCURam[MCUOffset + 5] = 0x4231; + MCURam[MCUOffset + 6] = 0x3939; + MCURam[MCUOffset + 7] = 0x3420; + return; + } + + case 0x42: { + memcpy(NVRam, MCURam + MCUOffset, 128); + return; + } + } +} + +static void ToyboxMCUComWrite(INT32 which, UINT16 data) +{ + ToyboxMCUCom[which] = data; + if (ToyboxMCUCom[0] != 0xffff) return; + if (ToyboxMCUCom[1] != 0xffff) return; + if (ToyboxMCUCom[2] != 0xffff) return; + if (ToyboxMCUCom[3] != 0xffff) return; + + memset(ToyboxMCUCom, 0, 4 * sizeof(UINT16)); + ToyboxMCURun(); +} + +/*============================================================================================== +Reset Functions +===============================================================================================*/ + +static INT32 Kaneko16DoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + Kaneko16SpriteFlipX = 0; + Kaneko16SpriteFlipY = 0; + Kaneko16DisplayEnable = 0; + memset(Kaneko16SpriteRegs, 0, 0x20 * sizeof(UINT16)); + memset(Kaneko16Layer0Regs, 0, 0x10 * sizeof(UINT16)); + memset(Kaneko16Layer1Regs, 0, 0x10 * sizeof(UINT16)); + + return 0; +} + +static INT32 BerlwallDoReset() +{ + INT32 nRet = Kaneko16DoReset(); + + for (INT32 i = 0; i < 2; i++) { + AY8910Reset(i); + } + + MSM6295Reset(0); + MSM6295Bank0 = 0; + + Kaneko16Bg15Reg = 0; + Kaneko16Bg15Select = 0; + + return nRet; +} + +static INT32 BlazeonDoReset() +{ + INT32 nRet = Kaneko16DoReset(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + + Kaneko16SoundLatch = 0; + + return nRet; +} + +static INT32 ExplbrkrDoReset() +{ + INT32 nRet = Kaneko16DoReset(); + + for (INT32 i = 0; i < 2; i++) { + AY8910Reset(i); + } + + EEPROMReset(); + + MSM6295Reset(0); + MSM6295Bank0 = 0; + + return nRet; +} + +static INT32 GtmrDoReset() +{ + INT32 nRet = Kaneko16DoReset(); + + MSM6295Reset(0); + MSM6295Reset(1); + MSM6295Bank0 = 0; + MSM6295Bank1 = 0; + + ToyboxMCUInit(); + + return nRet; +} + +/*============================================================================================== +Memory Handlers +===============================================================================================*/ + +UINT8 __fastcall BerlwallReadByte(UINT32 a) +{ + switch (a) { + case 0x680000: { + return 0xff - Kaneko16Input[0]; + } + + case 0x680002: { + return 0xff - Kaneko16Input[1]; + } + + case 0x680004: { + return 0xff - Kaneko16Input[2]; + } + + case 0x800001: { + AY8910Write(0, 0, (a - 0x800000) >> 1); + return AY8910Read(0); + } + + case 0x800401: { + return MSM6295ReadStatus(0); + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); +// } + } + + return 0; +} + +void __fastcall BerlwallWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x700000: { + // Coin lockout + return; + } + + case 0x800010: + case 0x800012: + case 0x800014: { + AY8910Write(0, 0, (a - 0x800000) >> 1); + AY8910Write(0, 1, d & 0xff); + return; + } + + case 0x800210: + case 0x800212: + case 0x800214: { + AY8910Write(1, 0, (a - 0x800200) >> 1); + AY8910Write(1, 1, d & 0xff); + return; + } + + + case 0x800401: { + MSM6295Command(0, d & 0xff); + return; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); +// } + } +} + +UINT16 __fastcall BerlwallReadWord(UINT32 a) +{ + switch (a) { + case 0x780000: { + // watchdog reset + return 0; + } + + case 0x80000e: + case 0x80001c: + case 0x80001e: { + AY8910Write(0, 0, (a - 0x800000) >> 1); + return AY8910Read(0); + } + + case 0x80020e: { + AY8910Write(1, 0, (a - 0x800200) >> 1); + return AY8910Read(1); + } + + case 0x8003fe: { + // NOP + return 0; + } + + case 0x800400: { + return MSM6295ReadStatus(0); + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); +// } + } + + return 0; +} + +void __fastcall BerlwallWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x480000: { + // ?? + return; + } + + case 0x500000: { + Kaneko16Bg15Reg = d; + return; + } + + case 0x580000: { + Kaneko16Bg15Select = d; + return; + } + + case 0x800000: + case 0x800002: + case 0x800004: + case 0x800006: + case 0x800008: + case 0x80000a: + case 0x80000c: + case 0x80000e: + case 0x800010: + case 0x800012: + case 0x800014: + case 0x800016: + case 0x800018: + case 0x80001a: { + AY8910Write(0, 0, (a - 0x800000) >> 1); + AY8910Write(0, 1, d & 0xff); + return; + } + + case 0x800200: + case 0x800202: + case 0x800204: + case 0x800206: + case 0x800208: + case 0x80020a: + case 0x80020c: + case 0x80020e: + case 0x800210: + case 0x800212: + case 0x800214: + case 0x800216: + case 0x800218: + case 0x80021a: { + AY8910Write(1, 0, (a - 0x800200) >> 1); + AY8910Write(1, 1, d & 0xff); + return; + } + + case 0x8003fe: { + // NOP + return; + } + + case 0x800400: { + MSM6295Command(0, d & 0xff); + return; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); +// } + } +} + +UINT8 __fastcall BlazeonReadByte(UINT32 a) +{ + switch (a) { + case 0xc00000: { + return 0xff - Kaneko16Input[0]; + } + + case 0xc00001: { + return Kaneko16Dip[0]; + } + + case 0xc00002: { + return 0xff - Kaneko16Input[1]; + } + + case 0xc00003: { + return Kaneko16Dip[1]; + } + + case 0xc00006: { + return 0xff - Kaneko16Input[2]; + } + + case 0xc00007: { + return 0xff; + } + + case 0xec0000: { + // NOP + return 0; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); +// } + } + + return 0; +} + +void __fastcall BlazeonWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xd00000: { + // Coin lockout + return; + } + + case 0xe00000: { + Kaneko16SoundLatch = d; + ZetOpen(0); + ZetNmi(); + ZetClose(); + return; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); +// } + } +} + +UINT16 __fastcall BlazeonReadWord(UINT32 a) +{ + switch (a) { + case 0xc00000: { + SEK_DEF_READ_WORD(0, a); + return 0; + } + + case 0xc00002: { + SEK_DEF_READ_WORD(0, a); + return 0; + } + + case 0xc00004: { + return 0xffff; + } + + case 0xc00006: { + SEK_DEF_READ_WORD(0, a); + return 0; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); +// } + } + + return 0; +} + +void __fastcall BlazeonWriteWord(UINT32 a, UINT16 /*d*/) +{ + switch (a) { + case 0xd00000: { + // Coin lockout + return; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); +// } + } +} + +UINT8 __fastcall ExplbrkrReadByte(UINT32 a) +{ + switch (a) { + case 0x400001: { + AY8910Write(0, 0, (a - 0x400000) >> 1); + return AY8910Read(0); + } + + case 0x40021d: { + AY8910Write(1, 0, (a - 0x400200) >> 1); + return AY8910Read(1); + } + + case 0x400401: { + return MSM6295ReadStatus(0); + } + + case 0xe00000: { + return 0xff - Kaneko16Input[0]; + } + + case 0xe00001: { + return Kaneko16Dip[0]; + } + + case 0xe00002: { + return 0xff - Kaneko16Input[1]; + } + + case 0xe00004: { + return 0xff - Kaneko16Input[2]; + } + + case 0xe00006: { + return 0xff; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); +// } + } + + return 0; +} + +void __fastcall ExplbrkrWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x40000f: + case 0x400010: + case 0x400012: + case 0x400014: { + AY8910Write(0, 0, (a - 0x400000) >> 1); + AY8910Write(0, 1, d & 0xff); + return; + } + + case 0x40020f: + case 0x400210: + case 0x400212: + case 0x400214: + case 0x40021f: { + AY8910Write(1, 0, (a - 0x400200) >> 1); + AY8910Write(1, 1, d & 0xff); + return; + } + + case 0x400401: { + MSM6295Command(0, d & 0xff); + return; + } + + case 0xd00000: return; + + case 0xd00001: { + EEPROMWriteBit(d & 0x02); + EEPROMSetClockLine((d & 0x01) ? EEPROM_ASSERT_LINE : EEPROM_CLEAR_LINE ); + return; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); +// } + } +} + +UINT16 __fastcall ExplbrkrReadWord(UINT32 a) +{ + switch (a) { + case 0xa00000: { + // Magical crystals Watchdog reset + return 0; + } + + case 0xa80000: { + // Watchdog reset + return 0; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); +// } + } + + return 0; +} + +void __fastcall ExplbrkrWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x400000: + case 0x400002: + case 0x400004: + case 0x400006: + case 0x400008: + case 0x40000a: + case 0x40000c: + case 0x40000e: + case 0x400010: + case 0x400012: + case 0x400014: + case 0x400016: + case 0x400018: + case 0x40001a: + case 0x40001c: { + AY8910Write(0, 0, (a - 0x400000) >> 1); + AY8910Write(0, 1, d & 0xff); + return; + } + + case 0x40001e: { + if (Mgcrystl) { + AY8910Write(0, 0, (a - 0x400000) >> 1); + AY8910Write(0, 1, d & 0xff); + } else { + MSM6295Bank0 = d & 7; + memcpy(MSM6295ROM + 0x0000000, MSM6295ROMData + (0x40000 * (d & 7)), 0x40000); + } + return; + } + + case 0x400200: + case 0x400202: + case 0x400204: + case 0x400206: + case 0x400208: + case 0x40020a: + case 0x40020c: + case 0x40020e: + case 0x400210: + case 0x400212: + case 0x400214: + case 0x400216: + case 0x400218: + case 0x40021a: + case 0x40021c: + case 0x40021e: { + AY8910Write(1, 0, (a - 0x400200) >> 1); + AY8910Write(1, 1, d & 0xff); + return; + } + + case 0x900000: { + Kaneko16SpriteRegs[0] = d; + if (d & 0xff) { + Kaneko16SpriteFlipX = d & 2; + Kaneko16SpriteFlipY = d & 1; + } + return; + } + + case 0xd00000: { + SEK_DEF_WRITE_WORD(0, a, d); + return; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); +// } + } +} + +UINT8 __fastcall MgcrystlReadByte(UINT32 a) +{ + switch (a) { + case 0x400001: { + AY8910Write(0, 0, (a - 0x400000) >> 1); + return AY8910Read(0); + } + + case 0x40021d: { + AY8910Write(1, 0, (a - 0x400200) >> 1); + return AY8910Read(1); + } + + case 0x400401: { + return MSM6295ReadStatus(0); + } + + case 0xc00000: { + return 0xff - Kaneko16Input[0]; + } + + case 0xc00001: { + return Kaneko16Dip[0]; + } + + case 0xc00002: { + return 0x3f - Kaneko16Input[1]; + } + + case 0xc00004: { + return 0xff - Kaneko16Input[2]; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); +// } + } + + return 0; +} + +UINT8 __fastcall GtmrReadByte(UINT32 a) +{ + switch (a) { + case 0x900014: { + if (Gtmr) return rand() & 0xff; + return 0; + } + + case 0x900015: { + if (Bonkadv) return BonkadvCalcRead((a - 0x900000) >> 1); + return 0; + } + + case 0xb00000: { + return 0xff - Kaneko16Input[0]; + } + + case 0xb00002: { + return 0xff - Kaneko16Input[1]; + } + + case 0xb00004: { + return 0xff - Kaneko16Input[2]; + } + + case 0xb00006: { + return 0xff - Kaneko16Input[3]; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Read byte -> %06X\n"), a); +// } + } + + return 0; +} + +void __fastcall GtmrWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x600000: + case 0x600002: + case 0x600004: + case 0x600006: + case 0x600008: + case 0x600009: + case 0x60000a: + case 0x60000b: + case 0x60000c: + case 0x60000e: + case 0x600010: + case 0x600012: + case 0x600014: + case 0x600016: + case 0x600018: + case 0x60001a: + case 0x60001c: + case 0x60001e: { + Kaneko16Layer0Regs[(a - 0x600000) >> 1] = d; + return; + } + + case 0x680000: + case 0x680002: + case 0x680004: + case 0x680006: + case 0x680008: + case 0x680009: + case 0x68000a: + case 0x68000b: + case 0x68000c: + case 0x68000e: + case 0x680010: + case 0x680012: + case 0x680014: + case 0x680016: + case 0x680018: + case 0x68001a: + case 0x68001c: + case 0x68001e: { + Kaneko16Layer1Regs[(a - 0x680000) >> 1] = d; + return; + } + + case 0x700000: + case 0x700002: + case 0x700004: + case 0x700006: + case 0x700008: + case 0x70000a: + case 0x70000c: + case 0x70000e: + case 0x700010: + case 0x700012: + case 0x700014: + case 0x700016: + case 0x700018: + case 0x70001a: + case 0x70001c: + case 0x70001e: { + UINT32 offset = (a - 0x700000) >> 1; + Kaneko16SpriteRegs[offset] = d; + if (offset == 0 && (d & 0xff)) { + Kaneko16SpriteFlipX = d & 2; + Kaneko16SpriteFlipY = d & 1; + } + return; + } + + case 0x800001: { + MSM6295Command(0, d); + return; + } + + case 0x880001: { + MSM6295Command(1, d); + return; + } + + case 0xb80000: { + // Coin lockout + return; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Write byte -> %06X, %02X\n"), a, d); +// } + } +} + +UINT16 __fastcall GtmrReadWord(UINT32 a) +{ + switch (a) { + case 0x800000: { + return MSM6295ReadStatus(0); + } + + case 0x880000: { + return MSM6295ReadStatus(1); + } + + case 0x900000: + case 0x900002: + case 0x900004: + case 0x900006: + case 0x900008: + case 0x90000a: + case 0x90000c: + case 0x90000e: + case 0x900010: + case 0x900012: + case 0x900014: + case 0x900016: + case 0x900018: + case 0x90001a: + case 0x90001c: + case 0x90001e: + case 0x900020: + case 0x900022: + case 0x900024: + case 0x900026: + case 0x900028: + case 0x90002a: + case 0x90002c: + case 0x90002e: + case 0x900030: + case 0x900032: + case 0x900034: + case 0x900036: + case 0x900038: { + if (Bloodwar) return BloodwarCalcRead((a - 0x900000) >> 1); + if (Bonkadv) return BonkadvCalcRead((a - 0x900000) >> 1); + if (Gtmr) return rand() & 0xffff; + return 0; + } + + case 0xa00000: { + // Watchdog read + return 0; + } + + case 0xb00000: { + return 0xff00 - (Kaneko16Input[0] << 8); + } + + case 0xb00002: { + return 0xff00 - (Kaneko16Input[1] << 8); + } + + case 0xb00004: { + return 0xff00 - (Kaneko16Input[2] << 8); + } + + case 0xb00006: { + return 0xffff; + } + + case 0xd00000: { + return ToyboxMCUStatusRead(); + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Read Word -> %06X\n"), a); +// } + } + + return 0; +} + +void __fastcall GtmrWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x2a0000: { + ToyboxMCUComWrite(0, d); + return; + } + + case 0x2b0000: { + ToyboxMCUComWrite(1, d); + return; + } + + case 0x2c0000: { + ToyboxMCUComWrite(2, d); + return; + } + + case 0x2d0000: { + ToyboxMCUComWrite(3, d); + return; + } + + case 0x700000: { + Kaneko16SpriteRegs[0] = d; + if (d & 0xff) { + Kaneko16SpriteFlipX = d & 2; + Kaneko16SpriteFlipY = d & 1; + } + return; + } + + case 0x800000: { + MSM6295Command(0, d); + return; + } + + case 0x880000: { + MSM6295Command(1, d); + return; + } + + case 0x900000: + case 0x900002: + case 0x900004: + case 0x900006: + case 0x900008: + case 0x90000a: + case 0x90000c: + case 0x90000e: + case 0x900010: + case 0x900012: + case 0x900014: + case 0x900016: + case 0x900018: + case 0x90001a: + case 0x90001c: + case 0x90001e: + case 0x900020: + case 0x900022: + case 0x900024: + case 0x900026: + case 0x900028: + case 0x90002a: + case 0x90002c: + case 0x90002e: + case 0x900030: + case 0x900032: + case 0x900034: + case 0x900036: + case 0x900038: { + if (Bonkadv) BonkadvCalcWrite((a - 0x900000) >> 1, d); + if (Bloodwar) BloodwarCalcWrite((a - 0x900000) >> 1, d); + return; + } + + case 0xa00000: { + // Watchdog write + return; + } + + case 0xb80000: { + // Coin lockout + return; + } + + case 0xc00000: { + Kaneko16DisplayEnable = d; + return; + } + + case 0xe00000: { + MSM6295Bank0 = d & 0xf; + memcpy(MSM6295ROM + 0x0000000, MSM6295ROMData + (0x40000 * (d & 0x0f)),0x40000); + return; + } + + case 0xe80000: { + if (Gtmr) { + MSM6295Bank1 = d & 1; + memcpy(MSM6295ROM + 0x0100000, MSM6295ROMData2 + (0x40000 * (d & 0x01)),0x40000); + } else { + MSM6295Bank1 = d; + memcpy(MSM6295ROM + 0x0100000, MSM6295ROMData2 + (0x40000 * d),0x40000); + } + return; + } + +// default: { +// bprintf(PRINT_NORMAL, _T("Write word -> %06X, %04X\n"), a, d); +// } + } +} + +UINT8 __fastcall Kaneko16Z80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x03: { + return BurnYM2151ReadStatus(); + } + + case 0x06: { + return Kaneko16SoundLatch; + } + } + + return 0; +} + +void __fastcall Kaneko16Z80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x02: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x03: { + BurnYM2151WriteRegister(d); + return; + } + } +} + +/*============================================================================================== +Sound Chip Handlers +===============================================================================================*/ + +static UINT8 Kaneko16EepromRead(UINT32 /*a*/) +{ + return EEPROMRead() & 0x01; +} + +static void Kaneko16EepromReset(UINT32 /*a*/, UINT32 d) +{ + EEPROMSetCSLine((d & 0x01) ? EEPROM_CLEAR_LINE : EEPROM_ASSERT_LINE ); +} + +static UINT8 Kaneko16Dip0Read(UINT32 /*a*/) +{ + return Kaneko16Dip[0]; +} + +static UINT8 Kaneko16Dip1Read(UINT32 /*a*/) +{ + return Kaneko16Dip[1]; +} + +/*============================================================================================== +Driver Inits +===============================================================================================*/ + +static void Kaneko16VideoInit() +{ + GenericTilesInit(); + + spritelist.first_sprite = (struct tempsprite *)BurnMalloc(0x400 * sizeof(spritelist.first_sprite[0])); + + Kaneko16ParseSprite = Kaneko16ParseSpriteType0; + + Kaneko16SpritesColourOffset = 0; + Kaneko16SpritesColourMask = 0x0fff; + Kaneko168BppSprites = 0; + if (Gtmr || Bloodwar || Bonkadv) { + Kaneko16SpritesColourOffset = 0x4000; + Kaneko16SpritesColourMask = 0xffff; + Kaneko168BppSprites = 1; + } + + Kaneko16SpriteXOffset = 0; + Kaneko16SpriteRamSize = 0x2000; + + Kaneko16LayersColourOffset = 0x40 * 16; + if (Gtmr || Bloodwar || Bonkadv) Kaneko16LayersColourOffset = 0; + Kaneko16TilesXOffset = 0; + if (nScreenWidth == 256) Kaneko16TilesXOffset = 0x5b; + if (nScreenWidth == 320) Kaneko16TilesXOffset = 0x33; + Kaneko16TilesYOffset = 0; + if (nScreenHeight == 224 || nScreenHeight == 232) Kaneko16TilesYOffset = -0x08; + + Kaneko16Bg15 = 0; + Kaneko16Bg15Reg = 0; + Kaneko16Bg15Select = 0; + Kaneko16RecalcBg15Palette = 0; +} + +static INT32 GtmrMachineInit() +{ + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Kaneko16Rom , 0x000000, 0x0ffffd, SM_ROM); + SekMapMemory(Kaneko16Ram , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(Kaneko16MCURam , 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(Kaneko16PaletteRam , 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(Kaneko16Ram + 0x10000, 0x310000, 0x327fff, SM_RAM); + SekMapMemory(Kaneko16SpriteRam , 0x400000, 0x401fff, SM_RAM); + SekMapMemory(Kaneko16Video1Ram , 0x500000, 0x500fff, SM_RAM); + SekMapMemory(Kaneko16Video0Ram , 0x501000, 0x501fff, SM_RAM); + SekMapMemory(Kaneko16VScrl1Ram , 0x502000, 0x502fff, SM_RAM); + SekMapMemory(Kaneko16VScrl0Ram , 0x503000, 0x503fff, SM_RAM); + SekMapMemory(Kaneko16Video3Ram , 0x580000, 0x580fff, SM_RAM); + SekMapMemory(Kaneko16Video2Ram , 0x581000, 0x581fff, SM_RAM); + SekMapMemory(Kaneko16VScrl3Ram , 0x582000, 0x582fff, SM_RAM); + SekMapMemory(Kaneko16VScrl2Ram , 0x583000, 0x583fff, SM_RAM); + SekMapMemory((UINT8*)Kaneko16Layer0Regs , 0x600000, 0x60001f, SM_WRITE); + SekMapMemory((UINT8*)Kaneko16Layer1Regs , 0x680000, 0x68001f, SM_WRITE); + SekMapMemory((UINT8*)Kaneko16SpriteRegs + 2, 0x700002, 0x70001f, SM_WRITE); + SekSetReadByteHandler(0, GtmrReadByte); + SekSetReadWordHandler(0, GtmrReadWord); + SekSetWriteByteHandler(0, GtmrWriteByte); + SekSetWriteWordHandler(0, GtmrWriteWord); + SekClose(); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 1980000 / 165, 0); + MSM6295Init(1, 1980000 / 165, 0); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); + + return 0; +} + +static INT32 FourBppPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 FourBppXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; +static INT32 FourBppYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; +static INT32 EightBppPlaneOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 EightBppXOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 512, 520, 528, 536, 544, 552, 560, 568 }; +static INT32 EightBppYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472 }; + +static INT32 BerlwallInit() +{ + INT32 nRet = 0, nLen; + + Kaneko16NumSprites = 0x2400; + Kaneko16NumTiles = 0x1000; + Kaneko16NumTiles2 = 0; + + Kaneko16VideoInit(); + Kaneko16ParseSprite = Kaneko16ParseSpriteType2; + Kaneko16Bg15 = 1; + Kaneko16RecalcBg15Palette = 1; + + // Allocate and Blank all required memory + Mem = NULL; + ExplbrkrMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + ExplbrkrMemIndex(); + + Kaneko16TempGfx = (UINT8*)BurnMalloc(0x400000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0080000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0100000, 4, 1); if (nRet != 0) return 1; + GfxDecode(Kaneko16NumSprites, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Sprites); + + // Load and Decode Tile Roms + memset(Kaneko16TempGfx, 0, 0x400000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 5, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x080000); + GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); + + // Load bitmap roms + memset(Kaneko16TempGfx, 0, 0x400000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000001, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x100000, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x100001, 9, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x200000, 10, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x200001, 11, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x300000, 12, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x300001, 13, 2); if (nRet != 0) return 1; + Kaneko16DecodeBg15Bitmaps(); + BurnFree(Kaneko16TempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 14, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROMData, MSM6295ROM, 0x40000); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Kaneko16Rom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Kaneko16Ram , 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(Kaneko16SpriteRam , 0x30e000, 0x30ffff, SM_RAM); + SekMapMemory(Kaneko16PaletteRam , 0x400000, 0x400fff, SM_RAM); + SekMapMemory(Kaneko16Video1Ram , 0xc00000, 0xc00fff, SM_RAM); + SekMapMemory(Kaneko16Video0Ram , 0xc01000, 0xc01fff, SM_RAM); + SekMapMemory(Kaneko16VScrl1Ram , 0xc02000, 0xc02fff, SM_RAM); + SekMapMemory(Kaneko16VScrl0Ram , 0xc03000, 0xc03fff, SM_RAM); + SekMapMemory((UINT8*)Kaneko16Layer0Regs , 0xd00000, 0xd0001f, SM_WRITE); + SekMapMemory((UINT8*)Kaneko16SpriteRegs + 2, 0x600002, 0x60003f, SM_WRITE); + SekSetReadByteHandler(0, BerlwallReadByte); + SekSetReadWordHandler(0, BerlwallReadWord); + SekSetWriteByteHandler(0, BerlwallWriteByte); + SekSetWriteWordHandler(0, BerlwallWriteWord); + SekClose(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + + AY8910Init(0, 2000000, nBurnSoundRate, &Kaneko16Dip0Read, &Kaneko16Dip1Read, NULL, NULL); + AY8910Init(1, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 1.00, BURN_SND_ROUTE_BOTH); + + // Setup the OKIM6295 emulation + MSM6295Init(0, (12000000 / 6) / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + Kaneko16FrameRender = BerlwallFrameRender; + + // Reset the driver + BerlwallDoReset(); + + return 0; +} + +static INT32 BlazeonInit() +{ + INT32 nRet = 0, nLen; + + Kaneko16NumSprites = 0x4000; + Kaneko16NumTiles = 0x2000; + Kaneko16NumTiles2 = 0; + + Kaneko16VideoInit(); + Kaneko16SpriteRamSize = 0x1000; + Kaneko16SpriteXOffset = 0x10000 - 0x680; + + // Allocate and Blank all required memory + Mem = NULL; + BlazeonMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + BlazeonMemIndex(); + + Kaneko16TempGfx = (UINT8*)BurnMalloc(0x200000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0100000, 3, 1); if (nRet != 0) return 1; + GfxDecode(Kaneko16NumSprites, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Sprites); + + // Load and Decode Tile Roms + memset(Kaneko16TempGfx, 0, 0x200000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 4, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x100000); + GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); + + BurnFree(Kaneko16TempGfx); + + // Load Z80 Rom + nRet = BurnLoadRom(Kaneko16Z80Rom, 5, 1); if (nRet != 0) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Kaneko16Rom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Kaneko16Ram , 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(Kaneko16PaletteRam , 0x500000, 0x500fff, SM_RAM); + SekMapMemory(Kaneko16Video1Ram , 0x600000, 0x600fff, SM_RAM); + SekMapMemory(Kaneko16Video0Ram , 0x601000, 0x601fff, SM_RAM); + SekMapMemory(Kaneko16VScrl1Ram , 0x602000, 0x602fff, SM_RAM); + SekMapMemory(Kaneko16VScrl0Ram , 0x603000, 0x603fff, SM_RAM); + SekMapMemory(Kaneko16SpriteRam , 0x700000, 0x700fff, SM_RAM); + SekMapMemory((UINT8*)Kaneko16Layer0Regs , 0x800000, 0x80000f, SM_WRITE); + SekMapMemory((UINT8*)Kaneko16SpriteRegs + 2, 0x900002, 0x90001f, SM_WRITE); + SekSetReadByteHandler(0, BlazeonReadByte); + SekSetReadWordHandler(0, BlazeonReadWord); + SekSetWriteByteHandler(0, BlazeonWriteByte); + SekSetWriteWordHandler(0, BlazeonWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, Kaneko16Z80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, Kaneko16Z80Rom ); + ZetMapArea(0xc000, 0xdfff, 0, Kaneko16Z80Ram ); + ZetMapArea(0xc000, 0xdfff, 1, Kaneko16Z80Ram ); + ZetMapArea(0xc000, 0xdfff, 2, Kaneko16Z80Ram ); + ZetSetInHandler(Kaneko16Z80PortRead); + ZetSetOutHandler(Kaneko16Z80PortWrite); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(4000000); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + Kaneko16FrameRender = BlazeonFrameRender; + + // Reset the driver + BlazeonDoReset(); + + return 0; +} + +static INT32 BloodwarInit() +{ + INT32 nRet = 0, nLen; + + Bloodwar = 1; + + Kaneko16NumSprites = 0x1e000; + Kaneko16NumTiles = 0x2000; + Kaneko16NumTiles2 = 0x2000; + + Kaneko16VideoInit(); + Kaneko16ParseSprite = Kaneko16ParseSpriteType1; + + // Allocate and Blank all required memory + Mem = NULL; + GtmrMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + GtmrMemIndex(); + + Kaneko16TempGfx = (UINT8*)BurnMalloc(0x1e00000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0200000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0400000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0600000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0800000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0a00000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0c00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0e00000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1000000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1200000, 12, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1200001, 13, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1400000, 14, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1400001, 15, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1600000, 16, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1600001, 17, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1800000, 18, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1800001, 19, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1a00000, 20, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1a00001, 21, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1c00000, 22, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x1c00001, 23, 2); if (nRet != 0) return 1; + GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); + + // Load and Decode Tile Roms + memset(Kaneko16TempGfx, 0, 0x1e00000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 24, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x100000); + GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); + memset(Kaneko16TempGfx, 0, 0x1e00000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 25, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x100000); + GfxDecode(Kaneko16NumTiles2, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles2); + BurnFree(Kaneko16TempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROMData, 26, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROMData2, 27, 1); if (nRet != 0) return 1; + ExpandSampleBanks(); + + ToyboxMCURun = BloodwarMCURun; + Kaneko16FrameRender = BloodwarFrameRender; + + nRet = GtmrMachineInit(); if (nRet != 0) return 1; + + // Reset the driver + GtmrDoReset(); + + return 0; +} + +static INT32 BonkadvInit() +{ + INT32 nRet = 0, nLen; + + Bonkadv = 1; + + Kaneko16NumSprites = 0x5000; + Kaneko16NumTiles = 0x4000; + Kaneko16NumTiles2 = 0x4000; + + Kaneko16VideoInit(); + Kaneko16ParseSprite = Kaneko16ParseSpriteType1; + + // Allocate and Blank all required memory + Mem = NULL; + GtmrMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + GtmrMemIndex(); + + Kaneko16TempGfx = (UINT8*)BurnMalloc(0x500000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0200000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0300000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0400000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0400001, 7, 2); if (nRet != 0) return 1; + GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); + + // Load and Decode Tile Roms + memset(Kaneko16TempGfx, 0, 0x500000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 8, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x100000); + GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); + memset(Kaneko16TempGfx, 0, 0x500000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 9, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x100000); + GfxDecode(Kaneko16NumTiles2, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles2); + BurnFree(Kaneko16TempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROMData, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROMData2, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROMData2 + 0x100000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROMData2 + 0x200000, 13, 1); if (nRet != 0) return 1; + ExpandSampleBanks(); + + ToyboxMCURun = BonkadvMCURun; + Kaneko16FrameRender = BloodwarFrameRender; + + nRet = GtmrMachineInit(); if (nRet != 0) return 1; + + // Reset the driver + GtmrDoReset(); + + return 0; +} + +static INT32 ExplbrkrInit() +{ + INT32 nRet = 0, nLen; + + Kaneko16NumSprites = 0x4800; + Kaneko16NumTiles = 0x2000; + Kaneko16NumTiles2 = 0x2000; + + Kaneko16VideoInit(); + + // Allocate and Blank all required memory + Mem = NULL; + ExplbrkrMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + ExplbrkrMemIndex(); + + Kaneko16TempGfx = (UINT8*)BurnMalloc(0x240000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0080000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0100000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0180000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0200000, 4, 1); if (nRet != 0) return 1; + GfxDecode(Kaneko16NumSprites, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Sprites); + + // Load and Decode Tile Roms + memset(Kaneko16TempGfx, 0, 0x240000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 5, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x100000); + GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); + memset(Kaneko16TempGfx, 0, 0x240000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 6, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x100000); + GfxDecode(Kaneko16NumTiles2, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles2); + + // Load Sample Rom + memset(Kaneko16TempGfx, 0, 0x240000); + nRet = BurnLoadRom(Kaneko16TempGfx, 7, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROMData + 0x000000, Kaneko16TempGfx + 0x000000, 0x20000); + memcpy(MSM6295ROMData + 0x020000, Kaneko16TempGfx + 0x020000, 0x20000); + memcpy(MSM6295ROMData + 0x040000, Kaneko16TempGfx + 0x000000, 0x20000); + memcpy(MSM6295ROMData + 0x060000, Kaneko16TempGfx + 0x040000, 0x20000); + memcpy(MSM6295ROMData + 0x080000, Kaneko16TempGfx + 0x000000, 0x20000); + memcpy(MSM6295ROMData + 0x0a0000, Kaneko16TempGfx + 0x060000, 0x20000); + memcpy(MSM6295ROMData + 0x0c0000, Kaneko16TempGfx + 0x000000, 0x20000); + memcpy(MSM6295ROMData + 0x0e0000, Kaneko16TempGfx + 0x080000, 0x20000); + memcpy(MSM6295ROMData + 0x100000, Kaneko16TempGfx + 0x000000, 0x20000); + memcpy(MSM6295ROMData + 0x120000, Kaneko16TempGfx + 0x0a0000, 0x20000); + memcpy(MSM6295ROMData + 0x140000, Kaneko16TempGfx + 0x000000, 0x20000); + memcpy(MSM6295ROMData + 0x160000, Kaneko16TempGfx + 0x0c0000, 0x20000); + memcpy(MSM6295ROMData + 0x180000, Kaneko16TempGfx + 0x000000, 0x20000); + memcpy(MSM6295ROMData + 0x1a0000, Kaneko16TempGfx + 0x0e0000, 0x20000); + BurnFree(Kaneko16TempGfx); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Kaneko16Rom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Kaneko16Ram , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(Kaneko16Video1Ram , 0x500000, 0x500fff, SM_RAM); + SekMapMemory(Kaneko16Video0Ram , 0x501000, 0x501fff, SM_RAM); + SekMapMemory(Kaneko16VScrl1Ram , 0x502000, 0x502fff, SM_RAM); + SekMapMemory(Kaneko16VScrl0Ram , 0x503000, 0x503fff, SM_RAM); + SekMapMemory(Kaneko16Video3Ram , 0x580000, 0x580fff, SM_RAM); + SekMapMemory(Kaneko16Video2Ram , 0x581000, 0x581fff, SM_RAM); + SekMapMemory(Kaneko16VScrl3Ram , 0x582000, 0x582fff, SM_RAM); + SekMapMemory(Kaneko16VScrl2Ram , 0x583000, 0x583fff, SM_RAM); + SekMapMemory(Kaneko16SpriteRam , 0x600000, 0x601fff, SM_RAM); + SekMapMemory(Kaneko16PaletteRam , 0x700000, 0x700fff, SM_RAM); + SekMapMemory((UINT8*)Kaneko16Layer0Regs , 0x800000, 0x80001f, SM_WRITE); + SekMapMemory((UINT8*)Kaneko16SpriteRegs + 2, 0x900002, 0x90001f, SM_WRITE); + SekMapMemory((UINT8*)Kaneko16Layer1Regs , 0xb00000, 0xb0001f, SM_WRITE); + SekSetReadByteHandler(0, ExplbrkrReadByte); + SekSetReadWordHandler(0, ExplbrkrReadWord); + SekSetWriteByteHandler(0, ExplbrkrWriteByte); + SekSetWriteWordHandler(0, ExplbrkrWriteWord); + SekClose(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + + Kaneko16Eeprom = 1; + EEPROMInit(&eeprom_interface_93C46); + + AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 2000000, nBurnSoundRate, &Kaneko16EepromRead, NULL, NULL, &Kaneko16EepromReset); + + // Setup the OKIM6295 emulation + MSM6295Init(0, (12000000 / 6) / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + Kaneko16FrameRender = ExplbrkrFrameRender; + + // Reset the driver + ExplbrkrDoReset(); + + return 0; +} + +static INT32 GtmrInit() +{ + INT32 nRet = 0, nLen; + + Gtmr = 1; + + Kaneko16NumSprites = 0x8400; + Kaneko16NumTiles = 0x4000; + Kaneko16NumTiles2 = 0x4000; + + Kaneko16VideoInit(); + Kaneko16ParseSprite = Kaneko16ParseSpriteType1; + + // Allocate and Blank all required memory + Mem = NULL; + GtmrMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + GtmrMemIndex(); + + Kaneko16TempGfx = (UINT8*)BurnMalloc(0x840000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x200000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x600000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x800001, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x800000, 8, 2); if (nRet != 0) return 1; + GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); + + // Load and Decode Tile Roms + memset(Kaneko16TempGfx, 0, 0x840000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 9, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x200000); + GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); + BurnFree(Kaneko16TempGfx); + memcpy(Kaneko16Tiles2, Kaneko16Tiles, Kaneko16NumTiles * 16 * 16); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROMData, 10, 1); if (nRet != 0) return 1; + ExpandSampleBanks(); + + ToyboxMCURun = GtmrMCURun; + Kaneko16FrameRender = GtmrFrameRender; + + nRet = GtmrMachineInit(); if (nRet != 0) return 1; + + // Reset the driver + GtmrDoReset(); + + return 0; +} + +static INT32 GtmrevoInit() +{ + INT32 nRet = 0, nLen; + + Gtmr = 1; + + Kaneko16NumSprites = 0x8000; + Kaneko16NumTiles = 0x4000; + Kaneko16NumTiles2 = 0x4000; + + Kaneko16VideoInit(); + Kaneko16ParseSprite = Kaneko16ParseSpriteType1; + + // Allocate and Blank all required memory + Mem = NULL; + GtmrMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + GtmrMemIndex(); + + Kaneko16TempGfx = (UINT8*)BurnMalloc(0x800000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(Kaneko16TempGfx + 0x600000, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x600001, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x200000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x600000, 6, 1); if (nRet != 0) return 1; + GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); + + // Load and Decode Tile Roms + memset(Kaneko16TempGfx, 0, 0x800000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 9, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x200000); + GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); + BurnFree(Kaneko16TempGfx); + memcpy(Kaneko16Tiles2, Kaneko16Tiles, Kaneko16NumTiles * 16 * 16); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROMData, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROMData2, 11, 1); if (nRet != 0) return 1; + ExpandSampleBanks(); + + nRet = GtmrMachineInit(); if (nRet != 0) return 1; + + ToyboxMCURun = GtmrevoMCURun; + Kaneko16FrameRender = GtmrFrameRender; + + // Reset the driver + GtmrDoReset(); + + return 0; +} + +static INT32 Gtmr2Init() +{ + INT32 nRet = 0, nLen; + + Gtmr = 1; + + Kaneko16NumSprites = 0x8000; + Kaneko16NumTiles = 0x8800; + Kaneko16NumTiles2 = 0x8800; + + Kaneko16VideoInit(); + Kaneko16ParseSprite = Kaneko16ParseSpriteType1; + + // Allocate and Blank all required memory + Mem = NULL; + GtmrMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + GtmrMemIndex(); + + Kaneko16TempGfx = (UINT8*)BurnMalloc(0x800000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x600000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x700000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x700001, 7, 2); if (nRet != 0) return 1; + GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); + + // Load and Decode Tile Roms + memset(Kaneko16TempGfx, 0, 0x800000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x200000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 10, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x400001, 11, 2); if (nRet != 0) return 1; + UnscrambleTiles(0x440000); + GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); + BurnFree(Kaneko16TempGfx); + memcpy(Kaneko16Tiles2, Kaneko16Tiles, Kaneko16NumTiles * 16 * 16); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROMData, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROMData2 + 0x40000, 13, 1); if (nRet != 0) return 1; + ExpandSampleBanks(); + + nRet = GtmrMachineInit(); if (nRet != 0) return 1; + + ToyboxMCURun = GtmrevoMCURun; + Kaneko16FrameRender = GtmrFrameRender; + + // Reset the driver + GtmrDoReset(); + + return 0; +} + +static INT32 Gtmr2uInit() +{ + INT32 nRet = 0, nLen; + + Gtmr = 1; + + Kaneko16NumSprites = 0x8000; + Kaneko16NumTiles = 0x8800; + Kaneko16NumTiles2 = 0x8800; + + Kaneko16VideoInit(); + Kaneko16ParseSprite = Kaneko16ParseSpriteType1; + + // Allocate and Blank all required memory + Mem = NULL; + GtmrMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + GtmrMemIndex(); + + Kaneko16TempGfx = (UINT8*)BurnMalloc(0x800000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x600000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x700000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x700001, 7, 2); if (nRet != 0) return 1; + GfxDecode(Kaneko16NumSprites, 8, 16, 16, EightBppPlaneOffsets, EightBppXOffsets, EightBppYOffsets, 0x800, Kaneko16TempGfx, Kaneko16Sprites); + + // Load and Decode Tile Roms + memset(Kaneko16TempGfx, 0, 0x800000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x200000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x400000, 10, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x400001, 11, 2); if (nRet != 0) return 1; + UnscrambleTiles(0x440000); + GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); + BurnFree(Kaneko16TempGfx); + memcpy(Kaneko16Tiles2, Kaneko16Tiles, Kaneko16NumTiles * 16 * 16); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROMData, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROMData2, 13, 1); if (nRet != 0) return 1; + ExpandSampleBanks(); + + nRet = GtmrMachineInit(); if (nRet != 0) return 1; + + ToyboxMCURun = GtmrevoMCURun; + Kaneko16FrameRender = GtmrFrameRender; + + // Reset the driver + GtmrDoReset(); + + return 0; +} + +static INT32 MgcrystlInit() +{ + INT32 nRet = 0, nLen; + + Mgcrystl = 1; + + Kaneko16NumSprites = 0x5000; + Kaneko16NumTiles = 0x2000; + Kaneko16NumTiles2 = 0x2000; + + Kaneko16VideoInit(); + + // Allocate and Blank all required memory + Mem = NULL; + ExplbrkrMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + ExplbrkrMemIndex(); + + Kaneko16TempGfx = (UINT8*)BurnMalloc(0x280000); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Kaneko16Rom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16Rom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and Decode Sprite Roms + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0100000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0180000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0200000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0220000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0240000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Kaneko16TempGfx + 0x0260000, 4, 1); if (nRet != 0) return 1; + GfxDecode(Kaneko16NumSprites, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Sprites); + + // Load and Decode Tile Roms + memset(Kaneko16TempGfx, 0, 0x280000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 5, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x100000); + GfxDecode(Kaneko16NumTiles, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles); + memset(Kaneko16TempGfx, 0, 0x280000); + nRet = BurnLoadRom(Kaneko16TempGfx + 0x000000, 6, 1); if (nRet != 0) return 1; + UnscrambleTiles(0x100000); + GfxDecode(Kaneko16NumTiles2, 4, 16, 16, FourBppPlaneOffsets, FourBppXOffsets, FourBppYOffsets, 0x400, Kaneko16TempGfx, Kaneko16Tiles2); + BurnFree(Kaneko16TempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 7, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROMData, MSM6295ROM, 0x40000); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Kaneko16Rom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Kaneko16Ram , 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(Kaneko16PaletteRam , 0x500000, 0x500fff, SM_RAM); + SekMapMemory(Kaneko16Video1Ram , 0x600000, 0x600fff, SM_RAM); + SekMapMemory(Kaneko16Video0Ram , 0x601000, 0x601fff, SM_RAM); + SekMapMemory(Kaneko16VScrl1Ram , 0x602000, 0x602fff, SM_RAM); + SekMapMemory(Kaneko16VScrl0Ram , 0x603000, 0x603fff, SM_RAM); + SekMapMemory(Kaneko16Video3Ram , 0x680000, 0x680fff, SM_RAM); + SekMapMemory(Kaneko16Video2Ram , 0x681000, 0x681fff, SM_RAM); + SekMapMemory(Kaneko16VScrl3Ram , 0x682000, 0x682fff, SM_RAM); + SekMapMemory(Kaneko16VScrl2Ram , 0x683000, 0x683fff, SM_RAM); + SekMapMemory(Kaneko16SpriteRam , 0x700000, 0x701fff, SM_RAM); + SekMapMemory((UINT8*)Kaneko16Layer0Regs , 0x800000, 0x80001f, SM_WRITE); + SekMapMemory((UINT8*)Kaneko16SpriteRegs + 2, 0x900002, 0x90001f, SM_WRITE); + SekMapMemory((UINT8*)Kaneko16Layer1Regs , 0xb00000, 0xb0001f, SM_WRITE); + SekSetReadByteHandler(0, MgcrystlReadByte); + SekSetReadWordHandler(0, ExplbrkrReadWord); + SekSetWriteByteHandler(0, ExplbrkrWriteByte); + SekSetWriteWordHandler(0, ExplbrkrWriteWord); + SekClose(); + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + + Kaneko16Eeprom = 1; + EEPROMInit(&eeprom_interface_93C46); + + AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910Init(1, 2000000, nBurnSoundRate, &Kaneko16EepromRead, NULL, NULL, &Kaneko16EepromReset); + + // Setup the OKIM6295 emulation + MSM6295Init(0, (12000000 / 4) / 165, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + Kaneko16FrameRender = MgcrystlFrameRender; + + // Reset the driver + ExplbrkrDoReset(); + + return 0; +} + +static INT32 Kaneko16Exit() +{ + SekExit(); + if (Kaneko16Eeprom) EEPROMExit(); + + GenericTilesExit(); + + BurnFree(Mem); + BurnFree(spritelist.first_sprite); + + Kaneko16NumTiles = 0; + Kaneko16NumTiles2 = 0; + Kaneko16NumSprites = 0; + Kaneko16SpriteFlipX = 0; + Kaneko16SpriteFlipY = 0; + Kaneko16SpritesColourOffset = 0; + Kaneko16SpritesColourMask = 0; + Kaneko16LayersColourOffset = 0; + Kaneko16DisplayEnable = 0; + Kaneko168BppSprites = 0; + Kaneko16Eeprom = 0; + Kaneko16TilesXOffset = 0; + Kaneko16TilesYOffset = 0; + Kaneko16Bg15 = 0; + Kaneko16Bg15Reg = 0; + Kaneko16Bg15Select = 0; + Kaneko16RecalcBg15Palette = 0; + Kaneko16SpriteRamSize = 0; + Kaneko16SpriteXOffset = 0; + Kaneko16SoundLatch = 0; + MSM6295Bank0 = 0; + MSM6295Bank1 = 0; + memset(Kaneko16SpriteRegs, 0, 0x20 * sizeof(UINT16)); + memset(Kaneko16Layer0Regs, 0, 0x10 * sizeof(UINT16)); + memset(Kaneko16Layer1Regs, 0, 0x10 * sizeof(UINT16)); + memset(ToyboxMCUCom, 0, 0x04 * sizeof(UINT16)); + + ToyboxMCURun = NULL; + Kaneko16FrameRender = NULL; + Kaneko16ParseSprite = NULL; + + Gtmr = 0; + Bloodwar = 0; + Bonkadv = 0; + Mgcrystl = 0; + + return 0; +} + +static INT32 BerlwallExit() +{ + AY8910Exit(0); + AY8910Exit(1); + MSM6295Exit(0); + + return Kaneko16Exit(); +} + +static INT32 BlazeonExit() +{ + ZetExit(); + BurnYM2151Exit(); + + return Kaneko16Exit(); +} + +static INT32 GtmrMachineExit() +{ + MSM6295Exit(0); + MSM6295Exit(1); + + return Kaneko16Exit(); +} + +static INT32 ExplbrkrExit() +{ + AY8910Exit(0); + AY8910Exit(1); + MSM6295Exit(0); + + return Kaneko16Exit(); +} + +/*============================================================================================== +Sprite Rendering +===============================================================================================*/ + +#define USE_LATCHED_XY 1 +#define USE_LATCHED_CODE 2 +#define USE_LATCHED_COLOUR 4 + +static INT32 Kaneko16ParseSpriteType0(INT32 i, struct tempsprite *s) +{ + INT32 Attr, xOffs, Offset; + UINT16 *SpriteRam = (UINT16*)Kaneko16SpriteRam; + + Offset = (i * 8) >> 1; + + if (Offset >= (Kaneko16SpriteRamSize >> 1)) return -1; + + Attr = SpriteRam[Offset + 0]; + s->code = SpriteRam[Offset + 1]; + s->x = SpriteRam[Offset + 2]; + s->y = SpriteRam[Offset + 3]; + + s->color = (Attr & 0xfc) >> 2; + s->priority = (Attr & 0x300) >> 8; + s->flipy = Attr & 0x001; + s->flipx = Attr & 0x002; + + xOffs = (Attr & 0x1800) >> 11; + s->yoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 1]; + s->xoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 0]; + + s->yoffs -= Kaneko16SpriteRegs[0x01]; + + return ((Attr & 0x2000) ? USE_LATCHED_XY : 0) | ((Attr & 0x4000) ? USE_LATCHED_COLOUR: 0) | ((Attr & 0x8000) ? USE_LATCHED_CODE : 0); +} + +static INT32 Kaneko16ParseSpriteType1(INT32 i, struct tempsprite *s) +{ + INT32 Attr, xOffs, Offset; + UINT16 *SpriteRam = (UINT16*)Kaneko16SpriteRam; + + Offset = (i * 8) >> 1; + + if (Offset >= (Kaneko16SpriteRamSize >> 1)) return -1; + + Attr = SpriteRam[Offset + 0]; + s->code = SpriteRam[Offset + 1]; + s->x = SpriteRam[Offset + 2]; + s->y = SpriteRam[Offset + 3]; + + s->color = Attr & 0x3f; + s->priority = (Attr & 0xc0) >> 6; + s->flipy = Attr & 0x100; + s->flipx = Attr & 0x200; + s->code += (s->y & 1) << 16; + + xOffs = (Attr & 0x1800) >> 11; + s->yoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 1]; + s->xoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 0]; + + s->yoffs -= Kaneko16SpriteRegs[0x01]; + + return ((Attr & 0x2000) ? USE_LATCHED_XY : 0) | ((Attr & 0x4000) ? USE_LATCHED_COLOUR: 0) | ((Attr & 0x8000) ? USE_LATCHED_CODE : 0); +} + +static INT32 Kaneko16ParseSpriteType2(INT32 i, struct tempsprite *s) +{ + INT32 Attr, xOffs, Offset; + UINT16 *SpriteRam = (UINT16*)Kaneko16SpriteRam; + + Offset = (i * (16 >> 1)) + (8 >> 1); + + if (Offset >= (Kaneko16SpriteRamSize >> 1)) return -1; + + Attr = SpriteRam[Offset + 0]; + s->code = SpriteRam[Offset + 1]; + s->x = SpriteRam[Offset + 2]; + s->y = SpriteRam[Offset + 3]; + + s->color = (Attr & 0xfc) >> 2; + s->priority = (Attr & 0x300) >> 8; + s->flipy = Attr & 0x001; + s->flipx = Attr & 0x002; + + xOffs = (Attr & 0x1800) >> 11; + s->yoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 1]; + s->xoffs = Kaneko16SpriteRegs[0x08 + (xOffs * 2) + 0]; + + s->yoffs -= Kaneko16SpriteRegs[0x01]; + + return ((Attr & 0x2000) ? USE_LATCHED_XY : 0) | ((Attr & 0x4000) ? USE_LATCHED_COLOUR: 0) | ((Attr & 0x8000) ? USE_LATCHED_CODE : 0); +} + +static void Kaneko16RenderSprite(UINT32 Code, UINT32 Colour, INT32 FlipX, INT32 FlipY, INT32 sx, INT32 sy) +{ + UINT8 *SourceBase = Kaneko16Sprites + ((Code % Kaneko16NumSprites) * 256); + + INT32 SpriteScreenHeight = ((1 << 16) * 16 + 0x8000) >> 16; + INT32 SpriteScreenWidth = ((1 << 16) * 16 + 0x8000) >> 16; + + if (Kaneko168BppSprites) { + Colour = 0x100 * (Colour % 0x40); + } else { + Colour = 0x10 * (Colour % 0x40); + } + + if (SpriteScreenHeight && SpriteScreenWidth) { + INT32 dx = (16 << 16) / SpriteScreenWidth; + INT32 dy = (16 << 16) / SpriteScreenHeight; + + INT32 ex = sx + SpriteScreenWidth; + INT32 ey = sy + SpriteScreenHeight; + + INT32 xIndexBase; + INT32 yIndex; + + if (FlipX) { + xIndexBase = (SpriteScreenWidth - 1) * dx; + dx = -dx; + } else { + xIndexBase = 0; + } + + if (FlipY) { + yIndex = (SpriteScreenHeight - 1) * dy; + dy = -dy; + } else { + yIndex = 0; + } + + if (sx < 0) { + INT32 Pixels = 0 - sx; + sx += Pixels; + xIndexBase += Pixels * dx; + } + + if (sy < 0) { + INT32 Pixels = 0 - sy; + sy += Pixels; + yIndex += Pixels * dy; + } + + if (ex > nScreenWidth + 1) { + INT32 Pixels = ex - nScreenWidth - 1; + ex -= Pixels; + } + + if (ey > nScreenHeight + 1) { + INT32 Pixels = ey - nScreenHeight - 1; + ey -= Pixels; + } + + if (ex > sx) { + INT32 y; + + for (y = sy; y < ey; y++) { + UINT8 *Source = SourceBase + ((yIndex >> 16) * 16); + UINT16* pPixel = pTransDraw + (y * nScreenWidth); + + if (y < 0 || y > (nScreenHeight - 1)) continue; + + INT32 x, xIndex = xIndexBase; + for (x = sx; x > 16]; + if (c != 0) { + if (x >= 0 && x < nScreenWidth) pPixel[x] = (c | Colour | Kaneko16SpritesColourOffset) & Kaneko16SpritesColourMask; + } + xIndex += dx; + } + + yIndex += dy; + } + } + } +} + +static void Kaneko16RenderSprites(INT32 PriorityDraw) +{ + struct tempsprite *s = spritelist.first_sprite; + + INT32 i = 0; + INT32 x = 0; + INT32 y = 0; + INT32 Colour = 0; + INT32 Code = 0; + INT32 Priority = 0; + INT32 xOffs = 0; + INT32 yOffs = 0; + INT32 FlipX = 0; + INT32 FlipY = 0; + + while (1) { + INT32 Flags; + + Flags = Kaneko16ParseSprite(i, s); + + if (Flags == -1) break; + + if (Flags & USE_LATCHED_CODE) { + s->code = ++Code; + } else { + Code = s->code; + } + + if (Flags & USE_LATCHED_COLOUR) { + s->color = Colour; + s->priority = Priority; + s->xoffs = xOffs; + s->yoffs = yOffs; + s->flipx = FlipX; + s->flipy = FlipY; + } else { + Colour = s->color; + Priority = s->priority; + xOffs = s->xoffs; + yOffs = s->yoffs; + FlipX = s->flipx; + FlipY = s->flipy; + } + + if (Flags & USE_LATCHED_XY) + { + s->x += x; + s->y += y; + } + + x = s->x; + y = s->y; + + s->x = s->xoffs + s->x; + s->y = s->yoffs + s->y; + + s->x += Kaneko16SpriteXOffset; + + s->x = ((s->x & 0x7fc0) - (s->x & 0x8000)) / 0x40; + s->y = ((s->y & 0x7fc0) - (s->y & 0x8000)) / 0x40; + + i++; + s++; + } + + for (s = spritelist.first_sprite; s < spritelist.first_sprite + 0x400; s++) { + if (s->priority == PriorityDraw) Kaneko16RenderSprite(s->code, s->color, s->flipx, s->flipy, s->x, s->y); + } +} + +#undef USE_LATCHED_XY +#undef USE_LATCHED_CODE +#undef USE_LATCHED_COLOUR + +/*============================================================================================== +Tile Rendering +===============================================================================================*/ + +static INT32 Kaneko16GetLayerFlipOffset(INT32 curroffs) +{ + if (curroffs == 0) return 15; + if (curroffs == 1) return 14; + if (curroffs == 2) return 13; + if (curroffs == 3) return 12; + if (curroffs == 4) return 11; + if (curroffs == 5) return 10; + if (curroffs == 6) return 9; + if (curroffs == 7) return 8; + if (curroffs == 8) return 7; + if (curroffs == 9) return 6; + if (curroffs == 10) return 5; + if (curroffs == 11) return 4; + if (curroffs == 12) return 3; + if (curroffs == 13) return 2; + if (curroffs == 14) return 1; + if (curroffs == 15) return 0; + + return 0; +} + +static void Kaneko16QueueTilesLayer(INT32 Layer) +{ + INT32 x, y, mx, my, px, py, Code, Attr, Colour, Flip, Priority, LineScroll, TileIndex, pSrcXOffs, pSrcYOffs, xScroll, yScroll; + UINT8 pTileSrc; + + LayerQueueSize[Layer] = 0; + TileIndex = 0; + + UINT16 *VRAM = NULL; + UINT16 *VSCROLLRAM = NULL; + UINT16 *LAYERREGS = NULL; + UINT8 *TILEDATA = NULL; + INT32 xScrollReg = 0; + INT32 yScrollReg = 0; + INT32 xOffs = 0; + INT32 numTiles = 0; + + switch (Layer) { + case 0: { + VRAM = (UINT16*)Kaneko16Video0Ram; + VSCROLLRAM = (UINT16*)Kaneko16VScrl0Ram; + LAYERREGS = Kaneko16Layer0Regs; + TILEDATA = Kaneko16Tiles; + xScrollReg = 2; + yScrollReg = 3; + xOffs = 0; + numTiles = Kaneko16NumTiles; + break; + } + + case 1: { + VRAM = (UINT16*)Kaneko16Video1Ram; + VSCROLLRAM = (UINT16*)Kaneko16VScrl1Ram; + LAYERREGS = Kaneko16Layer0Regs; + TILEDATA = Kaneko16Tiles; + xScrollReg = 0; + yScrollReg = 1; + xOffs = 2; + numTiles = Kaneko16NumTiles; + break; + } + + case 2: { + VRAM = (UINT16*)Kaneko16Video2Ram; + VSCROLLRAM = (UINT16*)Kaneko16VScrl2Ram; + LAYERREGS = Kaneko16Layer1Regs; + TILEDATA = Kaneko16Tiles2; + xScrollReg = 2; + yScrollReg = 3; + xOffs = 0; + numTiles = Kaneko16NumTiles2; + break; + } + + case 3: { + VRAM = (UINT16*)Kaneko16Video3Ram; + VSCROLLRAM = (UINT16*)Kaneko16VScrl3Ram; + LAYERREGS = Kaneko16Layer1Regs; + TILEDATA = Kaneko16Tiles2; + xScrollReg = 0; + yScrollReg = 1; + xOffs = 2; + numTiles = Kaneko16NumTiles2; + break; + } + } + + xScroll = LAYERREGS[xScrollReg]; + xOffs = Kaneko16TilesXOffset + xOffs; + yScroll = ((LAYERREGS[yScrollReg] >> 6) & 0x1ff) - Kaneko16TilesYOffset; + + mx = my = -1; + for (y = 0; y < 512; y++) { + if (!(y % 16)) my++; + + LineScroll = VSCROLLRAM[y]; + py = y - yScroll; + + if (py < -30) py += 512; + + for (x = 0; x < 512; x++) { + if (!(x % 16)) mx++; + + if (py < 0 || py >= nScreenHeight) continue; + + px = x - (((xScroll + LineScroll) >> 6) & 0x1ff) - xOffs; + if (px < -7) px += 512; + + if (px < 0 || px >= nScreenWidth) continue; + + TileIndex = ((my * 32) + mx) * 2; + + Code = VRAM[TileIndex + 1]; + if (Code >= numTiles) continue; + Attr = VRAM[TileIndex + 0]; + Priority = (Attr >> 8) & 7; + Colour = (Attr >> 2) & 0x3f; + Flip = Attr & 3; + + pSrcXOffs = x % 16; + pSrcYOffs = y % 16; + if (Flip & 1) pSrcYOffs = Kaneko16GetLayerFlipOffset(pSrcYOffs); + if (Flip & 2) pSrcXOffs = Kaneko16GetLayerFlipOffset(pSrcXOffs); + + pTileSrc = TILEDATA[(Code << 8) + (pSrcYOffs * 16) + pSrcXOffs]; + + if (pTileSrc != 0) { + LayerQueueXY[Layer][LayerQueueSize[Layer]] = (py << 9) | px; + LayerQueueColour[Layer][LayerQueueSize[Layer]] = (Colour << 4) | pTileSrc; + LayerQueuePriority[Layer][LayerQueueSize[Layer]] = Priority; + LayerQueueSize[Layer]++; + } + } + mx = -1; + } +} + +static void Kaneko16RenderLayerQueue(INT32 Layer, INT32 Priority) +{ + for (INT32 i = 0; i < LayerQueueSize[Layer]; i++) { + if (LayerQueuePriority[Layer][i] == Priority) { + UINT16* pPixel = pTransDraw + ((LayerQueueXY[Layer][i] >> 9) * nScreenWidth) + (LayerQueueXY[Layer][i] & 0x1ff); + pPixel[0] = LayerQueueColour[Layer][i] | Kaneko16LayersColourOffset; + } + } +} + +static void Kaneko16RenderTileLayer(INT32 Layer, INT32 PriorityDraw, INT32 xScroll) +{ + INT32 mx, my, Code, Attr, Colour, Flip, Priority, x, y, TileIndex = 0; + + UINT16 *VRAM = NULL; + UINT16 *LAYERREGS = NULL; + UINT8 *TILEDATA = NULL; + INT32 yScrollReg = 0; + INT32 xOffs = 0; + INT32 numTiles = 0; + + switch (Layer) { + case 0: { + VRAM = (UINT16*)Kaneko16Video0Ram; + LAYERREGS = Kaneko16Layer0Regs; + TILEDATA = Kaneko16Tiles; + yScrollReg = 3; + xOffs = 0; + numTiles = Kaneko16NumTiles; + break; + } + + case 1: { + VRAM = (UINT16*)Kaneko16Video1Ram; + LAYERREGS = Kaneko16Layer0Regs; + TILEDATA = Kaneko16Tiles; + yScrollReg = 1; + xOffs = 2; + numTiles = Kaneko16NumTiles; + break; + } + + case 2: { + VRAM = (UINT16*)Kaneko16Video2Ram; + LAYERREGS = Kaneko16Layer1Regs; + TILEDATA = Kaneko16Tiles2; + yScrollReg = 3; + xOffs = 0; + numTiles = Kaneko16NumTiles2; + break; + } + + case 3: { + VRAM = (UINT16*)Kaneko16Video3Ram; + LAYERREGS = Kaneko16Layer1Regs; + TILEDATA = Kaneko16Tiles2; + yScrollReg = 1; + xOffs = 2; + numTiles = Kaneko16NumTiles2; + break; + } + } + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Code = VRAM[TileIndex + 1]; + + if (Code >= numTiles) continue; + + Attr = VRAM[TileIndex + 0]; + Colour = (Attr >> 2) & 0x3f; + Flip = Attr & 3; + Priority = (Attr >> 8) & 7; + + if (Priority == PriorityDraw) { + x = 16 * mx; + y = 16 * my; + + x -= (xScroll >> 6) & 0x1ff; + y -= (LAYERREGS[yScrollReg] >> 6) & 0x1ff; + + if (x < -7) x += 512; + if (y < -30) y += 512; + + x -= Kaneko16TilesXOffset + xOffs; + y += Kaneko16TilesYOffset; + + if (x > 0 && x < (nScreenWidth - 16) && y > 0 && y < (nScreenHeight - 16)) { + if (Flip == 0) Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); + if (Flip == 1) Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); + if (Flip == 2) Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); + if (Flip == 3) Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); + } else { + if (Flip == 0) Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); + if (Flip == 1) Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); + if (Flip == 2) Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); + if (Flip == 3) Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, Kaneko16LayersColourOffset, TILEDATA); + } + } + + TileIndex += 2; + } + } +} + +/*============================================================================================== +Background Bitmap Rendering +===============================================================================================*/ + +static void Kaneko16RenderBg15Bitmap() +{ + INT32 Select = Kaneko16Bg15Select; + INT32 Flip = Select & 0x20; + INT32 x, y; + + if (Flip) Select ^= 0x1f; + Select &= 0x1f; + + for (y = 0; y < nScreenHeight; y++) { + UINT16 *pPixel = pTransDraw + (y * nScreenWidth); + UINT16 *data = Kaneko16Bg15Data + (Select * 256 * 256) + ((y + 16) * 256); + + for (x = 0; x < nScreenWidth; x++) { + pPixel[x] = data[x]; + } + } +} + +/*============================================================================================== +Palette Handling +===============================================================================================*/ + +static inline UINT8 pal5bit(UINT8 bits) +{ + bits &= 0x1f; + return (bits << 3) | (bits >> 2); +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal5bit(nColour >> 5); + g = pal5bit(nColour >> 10); + b = pal5bit(nColour >> 0); + + return BurnHighCol(r, g, b, 0); +} + +INT32 Kaneko16CalcPalette(INT32 num) +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)Kaneko16PaletteRam, pd = Kaneko16Palette; i < num; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } + + return 0; +} + +/*============================================================================================== +Graphics Rendering +===============================================================================================*/ + +// If the VScroll RAM is the same all the way through then just apply it as an xScroll value - much faster then doing line scroll on every line +#define HANDLE_VSCROLL(_N_) \ + if (Layer##_N_##Enabled) { \ + INT32 vScrollFast = 1; \ + UINT16 *VSCROLLRAM = (UINT16*)Kaneko16VScrl##_N_##Ram; \ + INT32 LineScroll = VSCROLLRAM[0]; \ + for (i = 0; i < 0x200; i++) { \ + if (VSCROLLRAM[i] != LineScroll) { \ + vScrollFast = 0; \ + break; \ + } \ + } \ + if (!vScrollFast) { \ + vScroll##_N_##Enabled = 1; \ + Kaneko16QueueTilesLayer(_N_); \ + } else { \ + vScroll##_N_##Enabled = 0; \ + xScroll##_N_ += LineScroll; \ + } \ + } \ +\ + +static void BerlwallFrameRender() +{ + INT32 i; + INT32 Layer0Enabled = 0; + INT32 Layer1Enabled = 0; + + INT32 vScroll0Enabled = 0; + INT32 vScroll1Enabled = 0; + + INT32 xScroll0 = Kaneko16Layer0Regs[2]; + INT32 xScroll1 = Kaneko16Layer0Regs[0]; + + if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; + if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; + + BurnTransferClear(); + Kaneko16CalcPalette(0x0800); + + if (Kaneko16RecalcBg15Palette) { + for (i = 0; i < 32768; i++) { + INT32 r = pal5bit(i >> 5); + INT32 g = pal5bit(i >> 10); + INT32 b = pal5bit(i >> 0); + Kaneko16Palette[i + 2048] = BurnHighCol(r, g, b, 0); + } + + Kaneko16RecalcBg15Palette = 0; + } + + if (Kaneko16Layer0Regs[4] & 0x800) { + HANDLE_VSCROLL(0) + } + + if (Kaneko16Layer0Regs[4] & 0x008) { + HANDLE_VSCROLL(1) + } + + Kaneko16RenderBg15Bitmap(); + + for (i = 0; i < 8; i++) { + if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} + if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} + + if (i == 0) Kaneko16RenderSprites(0); + if (i == 1) Kaneko16RenderSprites(1); + if (i == 2) Kaneko16RenderSprites(2); + if (i == 7) Kaneko16RenderSprites(3); + } + + BurnTransferCopy(Kaneko16Palette); +} + +static void BlazeonFrameRender() +{ + INT32 i; + INT32 Layer0Enabled = 0; + INT32 Layer1Enabled = 0; + + INT32 vScroll0Enabled = 0; + INT32 vScroll1Enabled = 0; + + INT32 xScroll0 = Kaneko16Layer0Regs[2]; + INT32 xScroll1 = Kaneko16Layer0Regs[0]; + + if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; + if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; + + BurnTransferClear(); + Kaneko16CalcPalette(0x0800); + + if (Kaneko16Layer0Regs[4] & 0x800) { + HANDLE_VSCROLL(0) + } + + if (Kaneko16Layer0Regs[4] & 0x008) { + HANDLE_VSCROLL(1) + } + + for (i = 0; i < 8; i++) { + if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} + if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} + + if (i == 0) Kaneko16RenderSprites(0); + if (i == 1) Kaneko16RenderSprites(1); + if (i == 7) Kaneko16RenderSprites(2); + if (i == 7) Kaneko16RenderSprites(3); + } + + BurnTransferCopy(Kaneko16Palette); +} + +static void BloodwarFrameRender() +{ + INT32 i; + INT32 Layer0Enabled = 0; + INT32 Layer1Enabled = 0; + INT32 Layer2Enabled = 0; + INT32 Layer3Enabled = 0; + + INT32 vScroll0Enabled = 0; + INT32 vScroll1Enabled = 0; + INT32 vScroll2Enabled = 0; + INT32 vScroll3Enabled = 0; + + INT32 xScroll0 = Kaneko16Layer0Regs[2]; + INT32 xScroll1 = Kaneko16Layer0Regs[0]; + INT32 xScroll2 = Kaneko16Layer1Regs[2]; + INT32 xScroll3 = Kaneko16Layer1Regs[0]; + + if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; + if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; + if (~Kaneko16Layer1Regs[4] & 0x1000) Layer2Enabled = 1; + if (~Kaneko16Layer1Regs[4] & 0x0010) Layer3Enabled = 1; + + BurnTransferClear(); + Kaneko16CalcPalette(0x10000); + + if (!Kaneko16DisplayEnable) return; + + if (Kaneko16Layer0Regs[4] & 0x800) { + HANDLE_VSCROLL(0) + } + + if (Kaneko16Layer0Regs[4] & 0x008) { + HANDLE_VSCROLL(1) + } + + if (Kaneko16Layer1Regs[4] & 0x800) { + HANDLE_VSCROLL(2) + } + + if (Kaneko16Layer1Regs[4] & 0x008) { + HANDLE_VSCROLL(3) + } + + for (i = 0; i < 8; i++) { + if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} + if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} + if (Layer2Enabled) { if (vScroll2Enabled) { Kaneko16RenderLayerQueue(2, i); } else { Kaneko16RenderTileLayer(2, i, xScroll2); }} + if (Layer3Enabled) { if (vScroll3Enabled) { Kaneko16RenderLayerQueue(3, i); } else { Kaneko16RenderTileLayer(3, i, xScroll3); }} + + if (i == 1) Kaneko16RenderSprites(0); + if (i == 2) Kaneko16RenderSprites(1); + if (i == 4) Kaneko16RenderSprites(2); + if (i == 6) Kaneko16RenderSprites(3); + } + + BurnTransferCopy(Kaneko16Palette); +} + +static void ExplbrkrFrameRender() +{ + INT32 i; + INT32 Layer0Enabled = 0; + INT32 Layer1Enabled = 0; + INT32 Layer2Enabled = 0; + INT32 Layer3Enabled = 0; + + INT32 vScroll0Enabled = 0; + INT32 vScroll1Enabled = 0; + INT32 vScroll2Enabled = 0; + INT32 vScroll3Enabled = 0; + + INT32 xScroll0 = Kaneko16Layer0Regs[2]; + INT32 xScroll1 = Kaneko16Layer0Regs[0]; + INT32 xScroll2 = Kaneko16Layer1Regs[2]; + INT32 xScroll3 = Kaneko16Layer1Regs[0]; + + if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; + if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; + if (~Kaneko16Layer1Regs[4] & 0x1000) Layer2Enabled = 1; + if (~Kaneko16Layer1Regs[4] & 0x0010) Layer3Enabled = 1; + + BurnTransferClear(); + Kaneko16CalcPalette(0x1000); + + if (Kaneko16Layer0Regs[4] & 0x800) { + HANDLE_VSCROLL(0) + } + + if (Kaneko16Layer0Regs[4] & 0x008) { + HANDLE_VSCROLL(1) + } + + if (Kaneko16Layer1Regs[4] & 0x800) { + HANDLE_VSCROLL(2) + } + + if (Kaneko16Layer1Regs[4] & 0x008) { + HANDLE_VSCROLL(3) + } + + for (i = 0; i < 8; i++) { + if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} + if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} + if (Layer2Enabled) { if (vScroll2Enabled) { Kaneko16RenderLayerQueue(2, i); } else { Kaneko16RenderTileLayer(2, i, xScroll2); }} + if (Layer3Enabled) { if (vScroll3Enabled) { Kaneko16RenderLayerQueue(3, i); } else { Kaneko16RenderTileLayer(3, i, xScroll3); }} + } + + Kaneko16RenderSprites(0); + Kaneko16RenderSprites(1); + Kaneko16RenderSprites(2); + Kaneko16RenderSprites(3); + + BurnTransferCopy(Kaneko16Palette); +} + +static void GtmrFrameRender() +{ + INT32 i; + INT32 Layer0Enabled = 0; + INT32 Layer1Enabled = 0; + INT32 Layer2Enabled = 0; + INT32 Layer3Enabled = 0; + + INT32 vScroll0Enabled = 0; + INT32 vScroll1Enabled = 0; + INT32 vScroll2Enabled = 0; + INT32 vScroll3Enabled = 0; + + INT32 xScroll0 = Kaneko16Layer0Regs[2]; + INT32 xScroll1 = Kaneko16Layer0Regs[0]; + INT32 xScroll2 = Kaneko16Layer1Regs[2]; + INT32 xScroll3 = Kaneko16Layer1Regs[0]; + + if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; + if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; + if (~Kaneko16Layer1Regs[4] & 0x1000) Layer2Enabled = 1; + if (~Kaneko16Layer1Regs[4] & 0x0010) Layer3Enabled = 1; + + BurnTransferClear(); + Kaneko16CalcPalette(0x10000); + + if (!Kaneko16DisplayEnable) return; + + if (Kaneko16Layer0Regs[4] & 0x800) { + HANDLE_VSCROLL(0) + } + + if (Kaneko16Layer0Regs[4] & 0x008) { + HANDLE_VSCROLL(1) + } + + if (Kaneko16Layer1Regs[4] & 0x800) { + HANDLE_VSCROLL(2) + } + + if (Kaneko16Layer1Regs[4] & 0x008) { + HANDLE_VSCROLL(3) + } + + for (i = 0; i < 8; i++) { + if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} + if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} + if (Layer2Enabled) { if (vScroll2Enabled) { Kaneko16RenderLayerQueue(2, i); } else { Kaneko16RenderTileLayer(2, i, xScroll2); }} + if (Layer3Enabled) { if (vScroll3Enabled) { Kaneko16RenderLayerQueue(3, i); } else { Kaneko16RenderTileLayer(3, i, xScroll3); }} + + if (i == 0) Kaneko16RenderSprites(0); + if (i == 1) Kaneko16RenderSprites(1); + if (i == 2) Kaneko16RenderSprites(2); + if (i == 7) Kaneko16RenderSprites(3); + } + + BurnTransferCopy(Kaneko16Palette); +} + +static void MgcrystlFrameRender() +{ + INT32 i; + INT32 Layer0Enabled = 0; + INT32 Layer1Enabled = 0; + INT32 Layer2Enabled = 0; + INT32 Layer3Enabled = 0; + + INT32 vScroll0Enabled = 0; + INT32 vScroll1Enabled = 0; + INT32 vScroll2Enabled = 0; + INT32 vScroll3Enabled = 0; + + INT32 xScroll0 = Kaneko16Layer0Regs[2]; + INT32 xScroll1 = Kaneko16Layer0Regs[0]; + INT32 xScroll2 = Kaneko16Layer1Regs[2]; + INT32 xScroll3 = Kaneko16Layer1Regs[0]; + + if (~Kaneko16Layer0Regs[4] & 0x1000) Layer0Enabled = 1; + if (~Kaneko16Layer0Regs[4] & 0x0010) Layer1Enabled = 1; + if (~Kaneko16Layer1Regs[4] & 0x1000) Layer2Enabled = 1; + if (~Kaneko16Layer1Regs[4] & 0x0010) Layer3Enabled = 1; + + BurnTransferClear(); + Kaneko16CalcPalette(0x1000); + + if (Kaneko16Layer0Regs[4] & 0x800) { + HANDLE_VSCROLL(0) + } + + if (Kaneko16Layer0Regs[4] & 0x008) { + HANDLE_VSCROLL(1) + } + + if (Kaneko16Layer1Regs[4] & 0x800) { + HANDLE_VSCROLL(2) + } + + if (Kaneko16Layer1Regs[4] & 0x008) { + HANDLE_VSCROLL(3) + } + + for (i = 0; i < 8; i++) { + if (Layer0Enabled) { if (vScroll0Enabled) { Kaneko16RenderLayerQueue(0, i); } else { Kaneko16RenderTileLayer(0, i, xScroll0); }} + if (Layer1Enabled) { if (vScroll1Enabled) { Kaneko16RenderLayerQueue(1, i); } else { Kaneko16RenderTileLayer(1, i, xScroll1); }} + if (Layer2Enabled) { if (vScroll2Enabled) { Kaneko16RenderLayerQueue(2, i); } else { Kaneko16RenderTileLayer(2, i, xScroll2); }} + if (Layer3Enabled) { if (vScroll3Enabled) { Kaneko16RenderLayerQueue(3, i); } else { Kaneko16RenderTileLayer(3, i, xScroll3); }} + + if (i == 1) Kaneko16RenderSprites(0); + if (i == 2) Kaneko16RenderSprites(1); + if (i == 4) Kaneko16RenderSprites(2); + if (i == 6) Kaneko16RenderSprites(3); + } + + BurnTransferCopy(Kaneko16Palette); +} + +/*============================================================================================== +Frame functions +===============================================================================================*/ + +static INT32 ExplbrkrFrame() +{ + INT32 nInterleave = 10; + nSoundBufferPos = 0; + + if (Kaneko16Reset) ExplbrkrDoReset(); + + Kaneko16MakeInputs(); + + nCyclesTotal[0] = 12000000 / 60; + nCyclesDone[0] = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 3) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + if (i == 6) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + if (i == 9) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) Kaneko16FrameRender(); + + return 0; +} + +static INT32 BlazeonFrame() +{ + INT32 nInterleave = 10; + nSoundBufferPos = 0; + + if (Kaneko16Reset) BlazeonDoReset(); + + Kaneko16MakeInputs(); + + nCyclesTotal[0] = 12000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 3) SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + if (i == 6) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + if (i == 9) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + // Render Sound Segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + } + + } + + if (pBurnDraw) Kaneko16FrameRender(); + + return 0; +} + +static INT32 GtmrFrame() +{ + if (Kaneko16Reset) GtmrDoReset(); + + Kaneko16MakeInputs(); + + SekOpen(0); + SekNewFrame(); + + SekRun((16000000 / 60) / 4); + SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + SekRun((16000000 / 60) / 4); + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekRun((16000000 / 60) / 4); + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + SekRun((16000000 / 60) / 4); + + SekClose(); + + if (pBurnSoundOut) { + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) Kaneko16FrameRender(); + + return 0; +} + +/*============================================================================================== +Scan Driver +===============================================================================================*/ + +static INT32 Kaneko16Scan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029672; + } + + if (Kaneko16Eeprom) EEPROMScan(nAction, pnMin); + + if (nAction & ACB_NVRAM && Kaneko16NVRam) { + memset(&ba, 0, sizeof(ba)); + ba.Data = Kaneko16NVRam; + ba.nLen = 0x100; + ba.szName = "NVRam"; + BurnAcb(&ba); + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(Kaneko16Dip); + SCAN_VAR(Kaneko16Input); + SCAN_VAR(Kaneko16SoundLatch); + SCAN_VAR(Kaneko16SpriteFlipX); + SCAN_VAR(Kaneko16SpriteFlipY); + SCAN_VAR(Kaneko16DisplayEnable); + SCAN_VAR(Kaneko16SpriteRegs); + SCAN_VAR(Kaneko16Layer0Regs); + SCAN_VAR(Kaneko16Layer1Regs); + + if (Kaneko16Bg15) { + SCAN_VAR(Kaneko16Bg15Reg); + SCAN_VAR(Kaneko16Bg15Select); + } + } + + return 0; +} + +static INT32 BlazeonScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { + *pnMin = 0x029672; + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + BurnYM2151Scan(nAction); + + SCAN_VAR(nSoundBufferPos); + } + + return Kaneko16Scan(nAction, pnMin);; +} + +static INT32 ExplbrkrScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { + *pnMin = 0x029672; + } + + if (nAction & ACB_DRIVER_DATA) { + AY8910Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + SCAN_VAR(MSM6295Bank0); + SCAN_VAR(nSoundBufferPos); + } + + if (nAction & ACB_WRITE) { + memcpy(MSM6295ROM + 0x0000000, MSM6295ROMData + (0x40000 * MSM6295Bank0),0x40000); + } + + return Kaneko16Scan(nAction, pnMin);; +} + +static INT32 GtmrScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { + *pnMin = 0x029672; + } + + if (nAction & ACB_DRIVER_DATA) { + MSM6295Scan(0, nAction); + MSM6295Scan(1, nAction); + SCAN_VAR(ToyboxMCUCom); + SCAN_VAR(MSM6295Bank0); + SCAN_VAR(MSM6295Bank1); + } + + if (nAction & ACB_WRITE) { + memcpy(MSM6295ROM + 0x0000000, MSM6295ROMData + (0x40000 * MSM6295Bank0),0x40000); + memcpy(MSM6295ROM + 0x0100000, MSM6295ROMData2 + (0x40000 * MSM6295Bank1),0x40000); + } + + return Kaneko16Scan(nAction, pnMin);; +} + +/*============================================================================================== +Driver defs +===============================================================================================*/ + +struct BurnDriver BurnDrvBerlwall = { + "berlwall", NULL, NULL, NULL, "1991", + "The Berlin Wall\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, + NULL, BerlwallRomInfo, BerlwallRomName, NULL, NULL, BerlwallInputInfo, BerlwallDIPInfo, + BerlwallInit, BerlwallExit, ExplbrkrFrame, NULL, ExplbrkrScan, + &Kaneko16RecalcBg15Palette, 0x9000, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBerlwallt = { + "berlwallt", "berlwall", NULL, NULL, "1991", + "The Berlin Wall (bootleg ?)\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, + NULL, BerlwalltRomInfo, BerlwalltRomName, NULL, NULL, BerlwallInputInfo, BerlwalltDIPInfo, + BerlwallInit, BerlwallExit, ExplbrkrFrame, NULL, ExplbrkrScan, + &Kaneko16RecalcBg15Palette, 0x9000, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBlazeon = { + "blazeon", NULL, NULL, NULL, "1991", + "Blaze On (Japan)\0", NULL, "Atlus", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_HORSHOOT, 0, + NULL, BlazeonRomInfo, BlazeonRomName, NULL, NULL, BlazeonInputInfo, BlazeonDIPInfo, + BlazeonInit, BlazeonExit, BlazeonFrame, NULL, BlazeonScan, + NULL, 0x1000, 320, 232, 4, 3 +}; + +struct BurnDriver BurnDrvBloodwar = { + "bloodwar", NULL, NULL, NULL, "1994", + "Blood Warrior\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_VSFIGHT, 0, + NULL, BloodwarRomInfo, BloodwarRomName, NULL, NULL, BloodwarInputInfo, BloodwarDIPInfo, + BloodwarInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, + NULL, 0x10000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvBonkadv = { + "bonkadv", NULL, NULL, NULL, "1994", + "B.C. Kid / Bonk's Adventure / Kyukyoku!! PC Genjin\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, + NULL, BonkadvRomInfo, BonkadvRomName, NULL, NULL, BonkadvInputInfo, BonkadvDIPInfo, + BonkadvInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, + NULL, 0x10000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvExplbrkr = { + "explbrkr", NULL, NULL, NULL, "1992", + "Explosive Breaker\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KANEKO16, GBF_VERSHOOT, 0, + NULL, ExplbrkrRomInfo, ExplbrkrRomName, NULL, NULL, ExplbrkrInputInfo, ExplbrkrDIPInfo, + ExplbrkrInit, ExplbrkrExit, ExplbrkrFrame, NULL, ExplbrkrScan, + NULL, 0x1000, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvBakubrkr = { + "bakubrkr", "explbrkr", NULL, NULL, "1992", + "Bakuretsu Breaker\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KANEKO16, GBF_VERSHOOT, 0, + NULL, BakubrkrRomInfo, BakubrkrRomName, NULL, NULL, ExplbrkrInputInfo, ExplbrkrDIPInfo, + ExplbrkrInit, ExplbrkrExit, ExplbrkrFrame, NULL, ExplbrkrScan, + NULL, 0x1000, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvGtmr = { + "gtmr", NULL, NULL, NULL, "1994", + "1000 Miglia: Great 1000 Miles Rally (94/07/18)\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_RACING, 0, + NULL, GtmrRomInfo, GtmrRomName, NULL, NULL, GtmrInputInfo, GtmrDIPInfo, + GtmrInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, + NULL, 0x10000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGtmra = { + "gtmra", "gtmr", NULL, NULL, "1994", + "1000 Miglia: Great 1000 Miles Rally (94/06/13)\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_RACING, 0, + NULL, GtmraRomInfo, GtmraRomName, NULL, NULL, GtmrInputInfo, GtmrDIPInfo, + GtmrInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, + NULL, 0x10000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGtmre = { + "gtmre", "gtmr", NULL, NULL, "1994", + "Great 1000 Miles Rally: Evolution Model!!! (94/09/06)\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_RACING, 0, + NULL, GtmreRomInfo, GtmreRomName, NULL, NULL, GtmrInputInfo, GtmrDIPInfo, + GtmrevoInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, + NULL, 0x10000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGtmrusa = { + "gtmrusa", "gtmr", NULL, NULL, "1994", + "Great 1000 Miles Rally: U.S.A Version! (94/09/06)\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_RACING, 0, + NULL, GtmrusaRomInfo, GtmrusaRomName, NULL, NULL, GtmrInputInfo, GtmrDIPInfo, + GtmrevoInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, + NULL, 0x10000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGtmr2 = { + "gtmr2", NULL, NULL, NULL, "1995", + "Mille Miglia 2: Great 1000 Miles Rally (95/05/24)\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_RACING, 0, + NULL, Gtmr2RomInfo, Gtmr2RomName, NULL, NULL, GtmrInputInfo, Gtmr2DIPInfo, + Gtmr2Init, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, + NULL, 0x10000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGtmr2a = { + "gtmr2a", "gtmr2", NULL, NULL, "1995", + "Mille Miglia 2: Great 1000 Miles Rally (95/04/04)\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_RACING, 0, + NULL, Gtmr2aRomInfo, Gtmr2aRomName, NULL, NULL, GtmrInputInfo, Gtmr2DIPInfo, + Gtmr2Init, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, + NULL, 0x10000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGtmr2u = { + "gtmr2u", "gtmr2", NULL, NULL, "1995", + "Great 1000 Miles Rally 2 USA (95/05/18)\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_RACING, 0, + NULL, Gtmr2uRomInfo, Gtmr2uRomName, NULL, NULL, GtmrInputInfo, Gtmr2DIPInfo, + Gtmr2uInit, GtmrMachineExit, GtmrFrame, NULL, GtmrScan, + NULL, 0x10000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvMgcrsytl = { + "mgcrystl", NULL, NULL, NULL, "1991", + "Magical Crystals (World, 92/01/10)\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, + NULL, MgcrystlRomInfo, MgcrystlRomName, NULL, NULL, MgcrystlInputInfo, MgcrystlDIPInfo, + MgcrystlInit, ExplbrkrExit, ExplbrkrFrame, NULL, ExplbrkrScan, + NULL, 0x1000, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMgcrsytlo = { + "mgcrystlo", "mgcrystl", NULL, NULL, "1991", + "Magical Crystals (World, 91/12/10)\0", NULL, "Kaneko", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, + NULL, MgcrystloRomInfo, MgcrystloRomName, NULL, NULL, MgcrystlInputInfo, MgcrystlDIPInfo, + MgcrystlInit, ExplbrkrExit, ExplbrkrFrame, NULL, ExplbrkrScan, + NULL, 0x1000, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMgcrsytlj = { + "mgcrystlj", "mgcrystl", NULL, NULL, "1991", + "Magical Crystals (Japan, 92/01/13)\0", NULL, "Kaneko (Atlus license)", "Kaneko16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO16, GBF_PLATFORM, 0, + NULL, MgcrystljRomInfo, MgcrystljRomName, NULL, NULL, MgcrystlInputInfo, MgcrystlDIPInfo, + MgcrystlInit, ExplbrkrExit, ExplbrkrFrame, NULL, ExplbrkrScan, + NULL, 0x1000, 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_lordgun.cpp b/src/burn/drv/pst90s/d_lordgun.cpp index ffe4ce164..fe68d888b 100644 --- a/src/burn/drv/pst90s/d_lordgun.cpp +++ b/src/burn/drv/pst90s/d_lordgun.cpp @@ -1,1519 +1,1518 @@ -// FB Alpha Lord of Gun driver module -// Based on MAME driver by Luca Elia, XingXing, and David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ymf278b.h" -#include "burn_ym3812.h" -#include "msm6295.h" -#include "8255ppi.h" -#include "eeprom.h" -#include "burn_gun.h" - -static UINT8 *AllMem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *AllRam = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Drv68KROM = NULL; -static UINT8 *DrvZ80ROM = NULL; -static UINT8 *DrvGfxROM0 = NULL; -static UINT8 *DrvGfxROM1 = NULL; -static UINT8 *DrvGfxROM2 = NULL; -static UINT8 *DrvGfxROM3 = NULL; -static UINT8 *DrvSndROM0 = NULL; -static UINT8 *DrvSndROM1 = NULL; -static UINT8 *DrvSndROM2 = NULL; -static UINT8 *Drv68KRAM = NULL; -static UINT8 *DrvPriRAM = NULL; -static UINT8 *DrvPalRAM = NULL; -static UINT8 *DrvVidRAM0 = NULL; -static UINT8 *DrvVidRAM1 = NULL; -static UINT8 *DrvVidRAM2 = NULL; -static UINT8 *DrvVidRAM3 = NULL; -static UINT8 *DrvScrRAM = NULL; -static UINT8 *DrvSprRAM = NULL; -static UINT8 *DrvProtRAM = NULL; -static UINT8 *DrvZ80RAM = NULL; - -static UINT32 *DrvPalette = NULL; -static UINT8 DrvRecalc; - -static UINT16 *scrollx = NULL; -static UINT16 *scrolly = NULL; -static UINT16 *priority = NULL; -static UINT8 *soundlatch = NULL; -static INT8 *okibank = NULL; - -static UINT8 *DrvTransTable[5] = { NULL, NULL, NULL, NULL, NULL }; -static UINT16 *draw_bitmap[5] = { NULL, NULL, NULL, NULL, NULL }; - -static UINT8 aliencha_dip_sel; -static UINT8 lordgun_whitescreen; - -static INT32 DrvAxis[4]; -static UINT16 DrvAnalogInput[4]; -static UINT16 DrvInputs[5]; -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvJoy4[16]; -static UINT8 DrvJoy5[16]; -static UINT8 DrvDips[4]; -static UINT8 DrvReset; - -static INT32 lordgun_gun_hw_x[2]; -static INT32 lordgun_gun_hw_y[2]; - -#define A(a, b, c, d) { a, b, (UINT8*)(c), d } - -static struct BurnInputInfo LordgunInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy4 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "mouse x-axis"), - A("P1 Up / Down", BIT_ANALOG_REL, DrvAxis + 1, "mouse y-axis"), - {"P1 Button 1", BIT_DIGITAL, DrvJoy5 + 4, "mouse button" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy4 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start" }, - A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 2, "mouse x-axis"), - A("P2 Up / Down", BIT_ANALOG_REL, DrvAxis + 3, "mouse y-axis"), - {"P2 Button 1", BIT_DIGITAL, DrvJoy5 + 5, "mouse button" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 7, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Lordgun) - -#undef A - -static struct BurnInputInfo AlienchaInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy4 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 1, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 4, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvJoy4 + 2, "p1 fire 4" }, - {"P1 Button 5", BIT_DIGITAL, DrvJoy4 + 3, "p1 fire 5" }, - {"P1 Button 6", BIT_DIGITAL, DrvJoy4 + 4, "p1 fire 6" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy4 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 1, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 4, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, DrvJoy4 + 5, "p2 fire 4" }, - {"P2 Button 5", BIT_DIGITAL, DrvJoy4 + 6, "p2 fire 5" }, - {"P2 Button 6", BIT_DIGITAL, DrvJoy4 + 7, "p2 fire 6" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 1, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, - {"Fake Dip", BIT_DIPSWITCH, DrvDips + 3, "dip" }, -}; - -STDINPUTINFO(Aliencha) - -static struct BurnDIPInfo LordgunDIPList[]= -{ - {0x0d, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 2, "Stage Select" }, - {0x0d, 0x01, 0x01, 0x01, "Off" }, - {0x0d, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Guns" }, - {0x0d, 0x01, 0x02, 0x02, "IGS" }, - {0x0d, 0x01, 0x02, 0x00, "Konami" }, - - {0 , 0xfe, 0 , 2, "Ranking Music" }, - {0x0d, 0x01, 0x04, 0x04, "Exciting" }, - {0x0d, 0x01, 0x04, 0x00, "Tender" }, - - {0 , 0xfe, 0 , 2, "Coin Slots" }, - {0x0d, 0x01, 0x08, 0x00, "1" }, - {0x0d, 0x01, 0x08, 0x08, "2" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0d, 0x01, 0x40, 0x40, "Off" }, - {0x0d, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(Lordgun) - -static struct BurnDIPInfo AlienchaDIPList[]= -{ - {0x1a, 0xff, 0xff, 0xff, NULL }, - {0x1b, 0xff, 0xff, 0xff, NULL }, - {0x1c, 0xff, 0xff, 0xff, NULL }, - {0x1d, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 2, "Credits To Start" }, - {0x1a, 0x01, 0x01, 0x01, "1" }, - {0x1a, 0x01, 0x01, 0x00, "2" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x1a, 0x01, 0x0e, 0x00, "5 Coins 1 Credits" }, - {0x1a, 0x01, 0x0e, 0x02, "4 Coins 1 Credits" }, - {0x1a, 0x01, 0x0e, 0x04, "3 Coins 1 Credits" }, - {0x1a, 0x01, 0x0e, 0x06, "2 Coins 1 Credits" }, - {0x1a, 0x01, 0x0e, 0x0e, "1 Coin 1 Credits" }, - {0x1a, 0x01, 0x0e, 0x0c, "1 Coin 2 Credits" }, - {0x1a, 0x01, 0x0e, 0x0a, "1 Coin 3 Credits" }, - {0x1a, 0x01, 0x0e, 0x08, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x1a, 0x01, 0x70, 0x00, "5 Coins 1 Credits" }, - {0x1a, 0x01, 0x70, 0x10, "4 Coins 1 Credits" }, - {0x1a, 0x01, 0x70, 0x20, "3 Coins 1 Credits" }, - {0x1a, 0x01, 0x70, 0x30, "2 Coins 1 Credits" }, - {0x1a, 0x01, 0x70, 0x70, "1 Coin 1 Credits" }, - {0x1a, 0x01, 0x70, 0x60, "1 Coin 2 Credits" }, - {0x1a, 0x01, 0x70, 0x50, "1 Coin 3 Credits" }, - {0x1a, 0x01, 0x70, 0x40, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 2, "Coin Slots" }, - {0x1a, 0x01, 0x80, 0x80, "1" }, - {0x1a, 0x01, 0x80, 0x00, "2" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x1b, 0x01, 0x03, 0x03, "0" }, - {0x1b, 0x01, 0x03, 0x02, "1" }, - {0x1b, 0x01, 0x03, 0x01, "2" }, - {0x1b, 0x01, 0x03, 0x00, "3" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x1b, 0x01, 0x04, 0x04, "Off" }, - {0x1b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Round Time" }, - {0x1b, 0x01, 0x08, 0x00, "32 s" }, - {0x1b, 0x01, 0x08, 0x08, "40 s" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x1b, 0x01, 0x10, 0x00, "Off" }, - {0x1b, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x1b, 0x01, 0x20, 0x20, "Off" }, - {0x1b, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Allow Join" }, - {0x1b, 0x01, 0x40, 0x00, "No" }, - {0x1b, 0x01, 0x40, 0x40, "Yes" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x1b, 0x01, 0x80, 0x00, "No" }, - {0x1b, 0x01, 0x80, 0x80, "Yes" }, - - {0 , 0xfe, 0 , 3, "Buttons" }, - {0x1c, 0x01, 0x03, 0x01, "3" }, - {0x1c, 0x01, 0x03, 0x02, "4" }, - {0x1c, 0x01, 0x03, 0x03, "6" }, - - {0 , 0xfe, 0 , 2, "Vs. Rounds" }, - {0x1c, 0x01, 0x04, 0x00, "3" }, - {0x1c, 0x01, 0x04, 0x04, "5" }, - - {0 , 0xfe, 0 , 2, "Language (text)" }, - {0x1d, 0x01, 0x01, 0x00, "English" }, - {0x1d, 0x01, 0x01, 0x01, "Chinese" }, - - {0 , 0xfe, 0 , 2, "Language (char names)"}, - {0x1d, 0x01, 0x02, 0x00, "English" }, - {0x1d, 0x01, 0x02, 0x02, "Chinese" }, - - {0 , 0xfe, 0 , 2, "Title" }, - {0x1d, 0x01, 0x04, 0x00, "Alien Challenge" }, - {0x1d, 0x01, 0x04, 0x04, "Round House Rumble" }, -}; - -STDDIPINFO(Aliencha) - -static struct BurnDIPInfo AlienchacDIPList[] = { - {0x1d, 0xff, 0xff, 0x03, NULL }, -}; - -STDDIPINFOEXT(Alienchac, Aliencha, Alienchac) - -static const short lordgun_gun_x_table[] = -{ - -100, 0x001,0x001,0x002,0x002,0x003,0x003,0x004,0x005,0x006,0x007,0x008,0x009,0x00A,0x00B,0x00C, - 0x00D,0x00E,0x00F,0x010,0x011,0x012,0x013,0x014,0x015,0x016,0x017,0x018,0x019,0x01A,0x01B,0x01C, - 0x01D,0x01E,0x01F,0x020,0x021,0x022,0x023,0x024,0x025,0x026,0x027,0x028,0x029,0x02A,0x02B,0x02C, - 0x02D,0x02E,0x02F,0x030,0x031,0x032,0x033,0x034,0x035,0x036,0x037,0x038,0x039,0x03A,0x03B,0x03C, - 0x03D,0x03E,0x03F,0x040,0x041,0x043,0x044,0x045,0x046,0x047,0x048,0x049,0x04A,0x04B,0x04C,0x04E, - 0x04F,0x050,0x051,0x052,0x053,0x054,0x055,0x056,0x057,0x059,0x05A,0x05B,0x05C,0x05D,0x05E,0x05F, - 0x060,0x061,0x05A,0x063,0x065,0x066,0x067,0x068,0x069,0x06A,0x06B,0x06C,0x06D,0x06E,0x06F,0x071, - 0x072,0x074,0x075,0x077,0x078,0x07A,0x07B,0x07D,0x07E,0x080,0x081,0x083,0x085,0x087,0x089,0x08B, - 0x08D,0x08E,0x08F,0x090,0x092,0x093,0x095,0x097,0x098,0x099,0x09A,0x09B,0x09C,0x09D,0x09E,0x0A0, - 0x0A1,0x0A2,0x0A3,0x0A4,0x0A5,0x0A6,0x0A7,0x0A8,0x0A9,0x0AA,0x0AC,0x0AD,0x0AE,0x0AF,0x0B0,0x0B1, - 0x0B2,0x0B3,0x0B4,0x0B5,0x0B6,0x0B8,0x0B9,0x0BA,0x0BB,0x0BC,0x0BD,0x0BE,0x0BF,0x0C0,0x0C1,0x0C2, - 0x0C4,0x0C5,0x0C6,0x0C7,0x0C8,0x0C9,0x0CA,0x0CB,0x0CC,0x0CD,0x0CF,0x0D0,0x0D1,0x0D2,0x0D3,0x0D4, - 0x0D5,0x0D6,0x0D7,0x0D8,0x0D9,0x0DB,0x0DC,0x0DD,0x0DE,0x0DF,0x0E0,0x0E1,0x0E2,0x0E3,0x0E4,0x0E5, - 0x0E7,0x0E8,0x0E9,0x0EA,0x0EB,0x0EC,0x0ED,0x0EE,0x0EF,0x0F0,0x0F1,0x0F3,0x0F4,0x0F5,0x0F6,0x0F7, - 0x0F8,0x0F9,0x0FA,0x0FB,0x0FC,0x0FE,0x0FF,0x100,0x101,0x102,0x103,0x104,0x105,0x106,0x107,0x108, - 0x10A,0x10B,0x10C,0x10D,0x10E,0x10F,0x110,0x111,0x112,0x113,0x114,0x116,0x117,0x118,0x119,0x11A, - 0x11B,0x11C,0x11D,0x11E,0x11F,0x120,0x122,0x123,0x124,0x125,0x126,0x127,0x128,0x129,0x12A,0x12B, - 0x12C,0x12E,0x12F,0x130,0x131,0x132,0x133,0x134,0x135,0x136,0x137,0x139,0x13A,0x13B,0x13C,0x13D, - 0x13E,0x13F,0x140,0x141,0x142,0x143,0x145,0x146,0x147,0x148,0x149,0x14A,0x14B,0x14C,0x14D,0x14E, - 0x14F,0x151,0x152,0x153,0x154,0x155,0x156,0x157,0x158,0x159,0x15A,0x15B,0x15D,0x15E,0x15F,0x160, - 0x161,0x162,0x163,0x164,0x165,0x166,0x167,0x169,0x16A,0x16B,0x16C,0x16D,0x16E,0x16F,0x170,0x171, - 0x172,0x174,0x175,0x176,0x177,0x178,0x179,0x17A,0x17B,0x17C,0x17D,0x17E,0x17F,0x180,0x181,0x182, - 0x183,0x184,0x185,0x186,0x187,0x188,0x189,0x18A,0x18B,0x18C,0x18D,0x18E,0x18F,0x190,0x191,0x192, - 0x193,0x194,0x195,0x196,0x197,0x198,0x199,0x19A,0x19B,0x19C,0x19D,0x19E,0x19F,0x1A0,0x1A1,0x1A2, - 0x1A3,0x1A4,0x1A5,0x1A6,0x1A7,0x1A8,0x1A9,0x1AA,0x1AB,0x1AC,0x1AD,0x1AE,0x1AF,0x1B0,0x1B1,0x1B2, - 0x1B3,0x1B4,0x1B5,0x1B6,0x1B7,0x1B8,0x1B9,0x1BA,0x1BB,0x1BC,0x1BD,0x1BE,0x1BF,0x1BF -}; - -static void lordgun_update_gun(INT32 i) -{ - INT32 x = DrvAnalogInput[i] - 0x3c; - - lordgun_gun_hw_x[i] = DrvAnalogInput[i]; - lordgun_gun_hw_y[i] = DrvAnalogInput[i+2]; - - if ((x < 0) || (x > (INT32)(sizeof(lordgun_gun_x_table)/sizeof(lordgun_gun_x_table[0]))) ) - x = 0; - - INT32 scrx = lordgun_gun_x_table[x]; - INT32 scry = DrvAnalogInput[i+2]; - - if ((scrx < 0) || (scrx >= nScreenWidth) || (scry < 0) || (scry > nScreenHeight)) { - lordgun_gun_hw_x[i] = lordgun_gun_hw_y[i] = 0; - } -} - -void __fastcall lordgun_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x502000: - scrollx[0] = data; - return; - - case 0x502200: - scrollx[1] = data; - return; - - case 0x502400: - scrollx[2] = data; - return; - - case 0x502600: - scrollx[3] = data; - return; - - case 0x502800: - scrolly[0] = data; - return; - - case 0x502a00: - scrolly[1] = data; - return; - - case 0x502c00: - scrolly[2] = data; - return; - - case 0x502e00: - scrolly[3] = data; - return; - - case 0x503000: - priority[0] = data; - return; - - case 0x504000: - soundlatch[0] = data >> 8; - soundlatch[1] = data; - ZetNmi(); - return; - - case 0x506000: - case 0x506002: - case 0x506004: - case 0x506006: - ppi8255_w(0, (address >> 1) & 3, data); - return; - - case 0x508000: - case 0x508002: - case 0x508004: - case 0x508006: - ppi8255_w(1, (address >> 1) & 3, data); - return; - } -} - -void __fastcall lordgun_write_byte(UINT32 /*address*/, UINT8 /*data*/) -{ -// address = data; // kill warnings... -} - -UINT16 __fastcall lordgun_read_word(UINT32 address) -{ - switch (address) - { - case 0x503800: - return lordgun_gun_hw_x[0]; - - case 0x503a00: - return lordgun_gun_hw_x[1]; - - case 0x503c00: - return lordgun_gun_hw_y[0]; - - case 0x503e00: - return lordgun_gun_hw_y[1]; - - case 0x506000: - case 0x506002: - case 0x506004: - case 0x506006: - return ppi8255_r(0, (address >> 1) & 3); - - case 0x508000: - case 0x508002: - case 0x508004: - case 0x508006: - return ppi8255_r(1, (address >> 1) & 3); - } - - return 0; -} - -UINT8 __fastcall lordgun_read_byte(UINT32 address) -{ - switch (address) - { - case 0x506001: - case 0x506003: - case 0x506005: - case 0x506007: - return ppi8255_r(0, (address >> 1) & 3); - - case 0x508001: - case 0x508003: - case 0x508005: - case 0x508007: - return ppi8255_r(1, (address >> 1) & 3); - } - - return 0; -} - -static void set_oki_bank(INT32 bank) -{ - if (*okibank != (bank & 0x02)) { - *okibank = bank & 0x02; - - memcpy (DrvSndROM0, DrvSndROM0 + 0x40000 + *okibank * 0x40000, 0x40000); - } -} - -void __fastcall lordgun_sound_write_port(UINT16 port, UINT8 data) -{ - switch (port) - { - case 0x1000: // lordgun - case 0x1001: - BurnYM3812Write(port & 1, data); - return; - - case 0x2000: // lordgun - MSM6295Command(0, data); - return; - - case 0x6000: // lordgun - set_oki_bank(data); - return; - - case 0x7000: // aliencha - case 0x7001: - case 0x7002: - BurnYMF278BSelectRegister(port & 3, data); - return; - - case 0x7003: - case 0x7004: - case 0x7005: - BurnYMF278BWriteRegister(port & 3, data); - return; - - case 0x7400: // aliencha - MSM6295Command(0, data); - return; - - case 0x7800: // aliencha - MSM6295Command(1, data); - return; - } -} - -UINT8 __fastcall lordgun_sound_read_port(UINT16 port) -{ - switch (port) - { - case 0x2000: // lordgun - return MSM6295ReadStatus(0); - - case 0x3000: - return soundlatch[0]; - - case 0x4000: - return soundlatch[1]; - - case 0x7000: // aliencha - return BurnYMF278BReadStatus(); - - case 0x7400: // aliencha - return MSM6295ReadStatus(0); - - case 0x7800: // aliencha - return MSM6295ReadStatus(1); - } - - return 0; -} - -// ppi8255 handlers - -static void aliencha_dip_select(UINT8 data) -{ - aliencha_dip_sel = data; -} - -static UINT8 lordgun_dip_read() -{ - return (DrvDips[0] & 0x4f) | (EEPROMRead() ? 0x80 : 0) | (DrvInputs[4] & 0x30); -} - -static void lordgun_eeprom_write(UINT8 data) -{ - static INT32 old; - - for (INT32 i = 0; i < 2; i++) - if ((data & (0x04 << i)) && !(old & (0x04 << i))) - lordgun_update_gun(i); - - // coin counter 0x01 (0) - - EEPROMWrite((data & 0x20), (data & 0x10), (data & 0x40)); - - lordgun_whitescreen = data & 0x80; - - old = data; -} - -static void aliencha_eeprom_write(UINT8 data) -{ - lordgun_whitescreen = !(data & 0x02); - - // coin counters 0x08 (0) and 0x10 (1) - - EEPROMWrite((data & 0x40), (data & 0x20), (data & 0x80)); -} - -static UINT8 lordgun_start1_read() { return DrvInputs[0]; } -static UINT8 lordgun_start2_read() { return DrvInputs[1]; } -static UINT8 lordgun_service_read(){ return DrvInputs[2]; } -static UINT8 lordgun_coin_read() { return DrvInputs[3]; } - -static UINT8 aliencha_service_read(){ return (DrvInputs[2] & 0xfe) | (EEPROMRead() ? 0x01 : 0); } // aliencha eeprom read... - -static UINT8 aliencha_dip_read() -{ - switch (aliencha_dip_sel & 0x70) { - case 0x30: return DrvDips[0]; - case 0x60: return DrvDips[1]; - case 0x50: return DrvDips[2]; - } - return 0xff; -} - -// sound irq / timing handlers - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - ZetSetIRQLine(0, nStatus ? ZET_IRQSTATUS_ACK : ZET_IRQSTATUS_NONE); -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 5000000; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYMF278BReset(); // aliencha - BurnYM3812Reset(); - MSM6295Reset(0); - MSM6295Reset(1); // aliencha - - *okibank = -1; - set_oki_bank(0); // lordgun - - EEPROMReset(); - - aliencha_dip_sel = 0; - lordgun_whitescreen = 0; - - // rom hacks - if (!strncmp(BurnDrvGetTextA(DRV_NAME), "aliencha", 8)) { - *((UINT16*)(Drv68KROM + 0x00a34)) = BURN_ENDIAN_SWAP_INT16(0x7000) | ((DrvDips[3] >> 0) & 1); // text language - *((UINT16*)(Drv68KROM + 0x00a38)) = BURN_ENDIAN_SWAP_INT16(0x7000) | ((DrvDips[3] >> 1) & 1); // character name language - *((UINT16*)(Drv68KROM + 0x00a3c)) = BURN_ENDIAN_SWAP_INT16(0x7000) | ((DrvDips[3] >> 2) & 1); // title - } else { - - UINT8 lordgun_eepromdata[48] = { - 0xFF, 0x83, 0x5F, 0xFF, 0xFF, 0xBF, 0x14, 0xB7, 0xA3, 0xA4, 0x80, 0x29, 0x37, 0xA6, 0x32, 0x39, - 0x37, 0x90, 0x10, 0x33, 0xBA, 0xA3, 0x00, 0x37, 0x01, 0x00, 0xFF, 0xFF, 0x03, 0x42, 0xFF, 0xFF, - 0xFF, 0x83, 0xFF, 0xFF, 0xFF, 0x87, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - }; - - if (EEPROMAvailable() == 0) { - EEPROMFill(lordgun_eepromdata, 0, 48); - } - } - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x200000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x400000; - DrvGfxROM1 = Next; Next += 0x800000; - DrvGfxROM2 = Next; Next += 0x800000; - DrvGfxROM3 = Next; Next += 0x1000000; - - DrvTransTable[0]= Next; Next += (0x0400000 / ( 8 * 8)); - DrvTransTable[1]= Next; Next += (0x0800000 / (16 * 16)); - DrvTransTable[2]= Next; Next += (0x0800000 / (32 * 32)); - DrvTransTable[3]= Next; Next += (0x1000000 / (16 * 16)); - DrvTransTable[4]= Next; Next += (0x0800000 / (16 * 16)) * 16; - - MSM6295ROM = Next; - DrvSndROM0 = Next; Next += 0x100000; - DrvSndROM1 = Next; Next += 0x040000; - DrvSndROM2 = Next; Next += 0x200000; - - DrvPalette = (UINT32*)Next; Next += (0x0800 + 1) * sizeof(UINT32); - - draw_bitmap[0] = (UINT16*)Next; Next += 448 * 240 * 2; - draw_bitmap[1] = (UINT16*)Next; Next += 448 * 240 * 2; - draw_bitmap[2] = (UINT16*)Next; Next += 448 * 240 * 2; - draw_bitmap[3] = (UINT16*)Next; Next += 448 * 240 * 2; - draw_bitmap[4] = (UINT16*)Next; Next += 448 * 240 * 2; - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPriRAM = Next; Next += 0x010000; - DrvVidRAM0 = Next; Next += 0x010000; - DrvVidRAM1 = Next; Next += 0x004000; - DrvVidRAM2 = Next; Next += 0x004000; - DrvVidRAM3 = Next; Next += 0x002000; - DrvScrRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x000800; - DrvProtRAM = Next; Next += 0x000400; - DrvPalRAM = Next; Next += 0x001000; - - DrvZ80RAM = Next; Next += 0x001000; - - scrollx = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); - scrolly = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); - priority = (UINT16*)Next; Next += 0x000001 * sizeof(UINT16); - - soundlatch = Next; Next += 0x000002; - - okibank = (INT8*)Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void DrvSetTransTab(UINT8 *gfx, INT32 tab, INT32 len, INT32 size) -{ - for (INT32 i = 0; i < len; i+= (size * size)) - { - DrvTransTable[tab][i/(size*size)] = 1; // transparent - - for (INT32 j = 0; j < (size * size); j++) { - if (gfx[i + j] != 0x3f) { - DrvTransTable[tab][i/(size*size)] = 0; - break; - } - } - } -} - -static void DrvGfxDecode(UINT8 *gfxsrc, UINT8 *gfxdest, INT32 len, INT32 size) -{ - INT32 Planes[6] = { - (((len * 8) / 3) * 2) + 8, (((len * 8) / 3) * 2) + 0, - (((len * 8) / 3) * 1) + 8, (((len * 8) / 3) * 1) + 0, - (((len * 8) / 3) * 0) + 8, (((len * 8) / 3) * 0) + 0 - }; - - INT32 XOffs1[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; - INT32 XOffs2[32] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x200, 0x201, 0x202, 0x203, 0x204, 0x205, 0x206, 0x207, - 0x400, 0x401, 0x402, 0x403, 0x404, 0x405, 0x406, 0x407, - 0x600, 0x601, 0x602, 0x603, 0x604, 0x605, 0x606, 0x607 }; - INT32 YOffs[32] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, - 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0, - 0x100, 0x110, 0x120, 0x130, 0x140, 0x150, 0x160, 0x170, - 0x180, 0x190, 0x1a0, 0x1b0, 0x1c0, 0x1d0, 0x1e0, 0x1f0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(len); - if (tmp == NULL) { - return; - } - - memcpy (tmp, gfxsrc, len); - - GfxDecode(((len * 8) / 6) / (size*size), 6, size, size, Planes, (size == 32) ? XOffs2 : XOffs1, YOffs, (size*size*2), tmp, gfxdest); - - BurnFree (tmp); -} - -static INT32 DrvInit(INT32 (*pInitCallback)(), INT32 lordgun) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (pInitCallback) { - if (pInitCallback()) return 1; - } - - DrvGfxDecode(DrvGfxROM0, DrvGfxROM0, 0x300000, 8); - DrvGfxDecode(DrvGfxROM2, DrvGfxROM1, 0x600000, 16); - DrvGfxDecode(DrvGfxROM2, DrvGfxROM2, 0x600000, 32); - DrvGfxDecode(DrvGfxROM3, DrvGfxROM3, 0xc00000, 16); - DrvSetTransTab(DrvGfxROM0, 0, 0x0400000, 8); - DrvSetTransTab(DrvGfxROM1, 1, 0x0800000, 16); - DrvSetTransTab(DrvGfxROM2, 2, 0x0800000, 32); - DrvSetTransTab(DrvGfxROM3, 3, 0x1000000, 16); - DrvSetTransTab(DrvGfxROM1, 4, 0x0800000, 16/4); // for line scroll - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(DrvPriRAM, 0x210000, 0x21ffff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x310000, 0x313fff, SM_RAM); - SekMapMemory(DrvVidRAM2 , 0x314000, 0x317fff, SM_RAM); - SekMapMemory(DrvVidRAM3, 0x318000, 0x319fff, SM_RAM); - SekMapMemory(DrvScrRAM, 0x31c000, 0x31c7ff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x400000, 0x4007ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x500000, 0x500fff, SM_RAM); - SekMapMemory(DrvProtRAM, 0x50a800, 0x50abff, SM_RAM); // 900-9ff (lordgun) - SekMapMemory(DrvProtRAM, 0x50b800, 0x50bbff, SM_RAM); // 900-9ff (aliencha) - SekSetWriteWordHandler(0, lordgun_write_word); - SekSetWriteByteHandler(0, lordgun_write_byte); - SekSetReadWordHandler(0, lordgun_read_word); - SekSetReadByteHandler(0, lordgun_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); - ZetMapArea(0xf000, 0xffff, 0, DrvZ80RAM); - ZetMapArea(0xf000, 0xffff, 1, DrvZ80RAM); - ZetMapArea(0xf000, 0xffff, 2, DrvZ80RAM); - ZetSetOutHandler(lordgun_sound_write_port); - ZetSetInHandler(lordgun_sound_read_port); - ZetMemEnd(); - ZetClose(); - - // aliencha - BurnYMF278BInit(0, DrvSndROM2, &DrvFMIRQHandler, DrvSynchroniseStream); - BurnYMF278BSetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); - BurnTimerAttachZet(5000000); - - // lordgun - BurnYM3812Init(3579545, &DrvFMIRQHandler, &DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3812(5000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 1000000 / 132, 1); - MSM6295Init(1, 1000000 / 132, 1); // aliencha - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - - ppi8255_init(2); - if (lordgun) { - PPI0PortReadA = lordgun_dip_read; - PPI0PortWriteB = lordgun_eeprom_write; - PPI0PortReadC = lordgun_service_read; - } else { - PPI0PortReadA = aliencha_dip_read; - PPI0PortReadC = aliencha_service_read; - PPI0PortWriteB = aliencha_eeprom_write; - PPI0PortWriteC = aliencha_dip_select; - } - - PPI1PortReadA = lordgun_start1_read; - PPI1PortReadB = lordgun_start2_read; - PPI1PortReadC = lordgun_coin_read; - - EEPROMInit(&eeprom_interface_93C46); - - GenericTilesInit(); - - BurnGunInit(2, true); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYMF278BExit(); // aliencha - BurnYM3812Exit(); - MSM6295Exit(0); - MSM6295Exit(1); // aliencha - - ppi8255_exit(); - BurnGunExit(); - - SekExit(); - ZetExit(); - - EEPROMExit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 lordgunLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x200000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x400000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x200000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x400000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x600000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x800000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0xa00000, 14, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x040000, 15, 1)) return 1; - - UINT16 *rom = (UINT16*)Drv68KROM; - - for (INT32 i = 0; i < 0x100000/2; i++) { - if ((i & 0x0120) == 0x0100 || (i & 0x0a00) == 0x0800) - rom[i] ^= BURN_ENDIAN_SWAP_INT16(0x0010); - } - - rom[0x14832/2] = BURN_ENDIAN_SWAP_INT16(0x6000); // 014832: 6700 0006 beq $1483a (protection) - rom[0x1587e/2] = BURN_ENDIAN_SWAP_INT16(0x6010); // 01587E: 6710 beq $15890 (rom check) - - return 0; -} - -static INT32 alienchaLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; - BurnByteswap(Drv68KROM, 0x200000); - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x200000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x400000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x400000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x800000, 10, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x040000, 11, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x000000, 12, 1)) return 1; - - if (BurnLoadRom(DrvSndROM2 + 0x000000, 13, 1)) return 1; - - UINT16 *rom = (UINT16*)Drv68KROM; - - rom[0x0A558/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0A558 beq.s $A56C - rom[0x0A8DC/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0A8DC beq.s $A8F0 - rom[0x0AC92/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0AC92 beq.s $ACA6 - rom[0x124CC/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 124CC beq.s $124E0 - rom[0x12850/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 12850 beq.s $12864 - rom[0x12C06/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 12C06 beq.s $12C1A - rom[0x1862A/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 1862A beq.s $1863E - rom[0x189AE/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 189AE beq.s $189C2 - rom[0x18D64/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 18D64 beq.s $18D78 - rom[0x230FC/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 230FC beq.s $23110 - rom[0x23480/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 23480 beq.s $23494 - rom[0x23836/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 23836 beq.s $2384A - rom[0x2BD0E/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2BD0E beq.s $2BD22 - rom[0x2C092/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2C092 beq.s $2C0A6 - rom[0x2C448/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2C448 beq.s $2C45C - - return 0; -} - -static INT32 alienchacLoadRoms() -{ - if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; - BurnByteswap(Drv68KROM, 0x200000); - if (BurnLoadRom(Drv68KROM + 0x000001, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 2, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x200000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x400000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x400000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x800000, 12, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x040000, 13, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x000000, 14, 1)) return 1; - - if (BurnLoadRom(DrvSndROM2 + 0x000000, 15, 1)) return 1; - - UINT16 *rom = (UINT16*)Drv68KROM; - - rom[0x0A550/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0A558 beq.s $A564 - rom[0x0A8D4/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0A8D4 beq.s $A8E8 - rom[0x0AC8A/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0AC8A beq.s $AC9E - rom[0x124B8/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 124B8 beq.s $124CC - rom[0x1283C/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 1283C beq.s $12850 - rom[0x12BF2/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 12BF2 beq.s $12C06 - rom[0x18616/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 18616 beq.s $1862A - rom[0x1899A/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 1899A beq.s $189AE - rom[0x18D50/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 18D50 beq.s $18D64 - rom[0x230E8/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 230E8 beq.s $230FC - rom[0x2346C/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2346C beq.s $23480 - rom[0x23822/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 23822 beq.s $23822 - rom[0x2BCFA/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2BCFA beq.s $2BD0E - rom[0x2C07E/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2C07E beq.s $2C092 - rom[0x2C434/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2C434 beq.s $2C448 - - return 0; -} - -static void draw_layer_linescroll() -{ - UINT16 *vram = (UINT16*)DrvVidRAM1; - UINT16 *sram = (UINT16*)DrvScrRAM; - UINT16 *dest = draw_bitmap[1]; - - for (INT32 y = 0; y < nScreenHeight; y++, dest += nScreenWidth) - { - INT32 yscroll = (scrolly[1] + y) & 0x1ff; - - for (INT32 x = 0; x < nScreenWidth + 16; x+=16) { - - INT32 xscroll = (scrollx[1] + sram[y * 2 + 1] + x) & 0x7ff; - - INT32 ofst = (((yscroll >> 4) << 7) | (xscroll >> 4)) << 1; - - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[ofst]); - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst + 1]) & 0x7fff; - INT32 pri = (attr & 0x0e00) >> 9; - - INT32 flipx = attr & 0x8000; - INT32 flipy = attr & 0x4000; - - INT32 color = ((attr & 0x0070) << 2)+0x600+pri*0x800; - - { - UINT8 *gfx = DrvGfxROM1 + (code << 8); - - if (flipy) gfx += ((yscroll & 0x0f)^0xf) << 4; - else gfx += ((yscroll & 0x0f) ) << 4; - - if (DrvTransTable[4][(gfx-DrvGfxROM1)/16]) continue; - - if (flipx) flipx = 0x0f; - - for (INT32 xx = 0, sx = x - (xscroll & 0x0f); xx < 16; xx++, sx++) { - if (sx < 0 || sx >= nScreenWidth) continue; - - INT32 pxl = gfx[xx^flipx]; - - if (pxl == 0x3f) continue; - - dest[sx] = pxl | color; - } - } - } - } -} - -static void draw_layer(UINT8 *ram, UINT8 *gfx, INT32 size, INT32 wide, INT32 high, INT32 color_offset, INT32 color_and, INT32 layer) -{ - INT32 twidth = wide * size; - INT32 theight = high * size; - - INT32 code_and = (size == 32) ? 0x1fff : ((size == 16) ? 0x7fff : 0xffff); - - UINT16 *vram = (UINT16*)ram; - - for (INT32 sy = 0, offs = 0; sy < high * size; sy+=size) - { - for (INT32 sx = 0; sx < wide * size; sx+=size, offs++) - { - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & code_and; - if (DrvTransTable[layer][code]) continue; // transparent - - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]); - - INT32 prio = (attr >> 9) & 0x07; - INT32 color= ((attr >> 4) & color_and) + color_offset / 0x40 + prio * 0x800 / 0x40; - - INT32 flipx= attr & 0x8000; - INT32 flipy= attr & 0x4000; - - INT32 xx = sx - (scrollx[layer] % twidth); - if (xx < (0 - (size - 1))) xx += twidth; - - INT32 yy = sy - (scrolly[layer] % theight); - if (yy < (0 - (size - 1))) yy += theight; - - if (xx >= nScreenWidth || yy >= nScreenHeight) continue; - - if (flipy) { - if (flipx) { - RenderCustomTile_Mask_FlipXY_Clip(draw_bitmap[layer], size, size, code, xx, yy, color, 6, 0x3f, 0, gfx); - } else { - RenderCustomTile_Mask_FlipY_Clip(draw_bitmap[layer], size, size, code, xx, yy, color, 6, 0x3f, 0, gfx); - } - } else { - if (flipx) { - RenderCustomTile_Mask_FlipX_Clip(draw_bitmap[layer], size, size, code, xx, yy, color, 6, 0x3f, 0, gfx); - } else { - RenderCustomTile_Mask_Clip(draw_bitmap[layer], size, size, code, xx, yy, color, 6, 0x3f, 0, gfx); - } - } - } - } -} - -static void draw_sprites() -{ - UINT16 *sprite = (UINT16*)DrvSprRAM; - - for (INT32 offs = 0; offs < 0x800 / 2; offs += 4) - { - INT32 x0, x1, dx, y0, y1, dy; - - INT32 attr = BURN_ENDIAN_SWAP_INT16(sprite[offs + 1]); - if (attr & 0x0100) break; - - INT32 sy = BURN_ENDIAN_SWAP_INT16(sprite[offs + 0]); - INT32 code = BURN_ENDIAN_SWAP_INT16(sprite[offs + 2]); - INT32 sx = BURN_ENDIAN_SWAP_INT16(sprite[offs + 3]); - INT32 flipx = (attr & 0x8000); - INT32 flipy = (attr & 0x4000); - INT32 pri = (attr & 0x0e00) >> 9; - INT32 color = (attr & 0x00f0) >> 4; - INT32 nx = (attr & 0x000f) + 1; - INT32 ny = ((sy & 0xf000) >> 12) + 1; - - if (flipx) { x0 = nx - 1; x1 = -1; dx = -1; } - else { x0 = 0; x1 = nx; dx = +1; } - - if (flipy) { y0 = ny - 1; y1 = -1; dy = -1; } - else { y0 = 0; y1 = ny; dy = +1; } - - sx -= 0x18; - sy = (sy & 0x7ff) - (sy & 0x800); - - for (INT32 y = y0; y != y1; y += dy, code += 1 - 0x10 * nx) - { - for (INT32 x = x0; x != x1; x += dx, code += 0x10) - { - if (DrvTransTable[3][code]) continue; - - if (flipy) { - if (flipx) { - RenderCustomTile_Mask_FlipXY_Clip(draw_bitmap[4], 16, 16, code, sx + x * 0x10, sy + y * 0x10, color + pri * 0x800/0x40, 6, 0x3f, 0, DrvGfxROM3); - } else { - RenderCustomTile_Mask_FlipY_Clip(draw_bitmap[4], 16, 16, code, sx + x * 0x10, sy + y * 0x10, color + pri * 0x800/0x40, 6, 0x3f, 0, DrvGfxROM3); - } - } else { - if (flipx) { - RenderCustomTile_Mask_FlipX_Clip(draw_bitmap[4], 16, 16, code, sx + x * 0x10, sy + y * 0x10, color + pri * 0x800/0x40, 6, 0x3f, 0, DrvGfxROM3); - } else { - RenderCustomTile_Mask_Clip(draw_bitmap[4], 16, 16, code, sx + x * 0x10, sy + y * 0x10, color + pri * 0x800/0x40, 6, 0x3f, 0, DrvGfxROM3); - } - } - } - } - } -} - -static void copy_layers() -{ - const UINT8 pri2layer[8] = { 0, 0, 0, 4, 3, 0, 1, 2 }; - const UINT8 layerpri[5] = { 0, 1, 2, 4, 3 }; - - UINT16 *dest = pTransDraw; - UINT16 *source[5] = { draw_bitmap[0], draw_bitmap[1], draw_bitmap[2], draw_bitmap[3], draw_bitmap[4] }; - UINT16 *pri_ram = (UINT16*)DrvPriRAM; - - for (INT32 y = 0; y < nScreenHeight; y++) - { - for (INT32 x = 0; x < nScreenWidth; x++) - { - UINT16 pens[5]; - INT32 pri_addr = 0; - - for (INT32 l = 0; l < 5; l++) { - pens[l] = *source[l]++; - if (pens[l] == 0x3f) pri_addr |= 1 << layerpri[l]; - } - - pri_addr |= (pens[1] >> 11) << 5; - pri_addr |= (pens[4] >> 11) << 8; - pri_addr |= (pens[0] >> 11) << 11; - pri_addr |= (pens[3] >> 11) << 14; - - *dest++ = pens[pri2layer[BURN_ENDIAN_SWAP_INT16(pri_ram[pri_addr & 0x7fff]) & 7]] & 0x7ff; - } - } -} - -static void DrvPaletteRecalc() -{ - UINT16 *p = (UINT16*)DrvPalRAM; - - for (INT32 i = 0; i < 0x1000 / 2; i++) { - INT32 r = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 0) & 0x0f; - INT32 g = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 4) & 0x0f; - INT32 b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 8) & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } - - DrvPalette[0x0800] = BurnHighCol(0xff, 0xff, 0xff, 0); // white -} - -static INT32 DrvDraw() -{ - DrvPaletteRecalc(); - - if (lordgun_whitescreen) { - for (INT32 o = 0; o < nScreenWidth * nScreenHeight; o++) { - pTransDraw[o] = 0x800; // white!! - } - - BurnTransferCopy(DrvPalette); - return 0; - } - - for (INT32 o = 0; o < nScreenWidth * nScreenHeight; o++) { - draw_bitmap[0][o] = draw_bitmap[1][o] = draw_bitmap[2][o] = draw_bitmap[3][o] = draw_bitmap[4][o] = 0x003f; - } - - INT32 line_enable = 0; - { - UINT16 *rs = (UINT16*)DrvScrRAM; - for (INT32 i = 0; i < nScreenHeight * 2; i+=2) { - if ((BURN_ENDIAN_SWAP_INT16(rs[i + 1]) & 0x7ff) != (BURN_ENDIAN_SWAP_INT16(rs[1]) & 0x7ff)) { - line_enable = 1; - break; - } - } - } - - draw_layer(DrvVidRAM0, DrvGfxROM0, 8, 0x100, 0x040, 0x500, 0x03, 0); - if (line_enable == 0) { - draw_layer(DrvVidRAM1, DrvGfxROM1, 16, 0x080, 0x020, 0x600, 0x07, 1); - } else { - draw_layer_linescroll(); - } - draw_layer(DrvVidRAM2, DrvGfxROM2, 32, 0x040, 0x010, 0x700, 0x03, 2); - draw_layer(DrvVidRAM3, DrvGfxROM0, 8, 0x040, 0x020, 0x400, 0x0f, 3); - draw_sprites(); - - copy_layers(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 lordgunDraw() -{ - DrvDraw(); - - for (INT32 i = 0; i < BurnDrvGetMaxPlayers(); i++) { - BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); - } - - return 0; -} - -static inline void compile_inputs() -{ - memset (DrvInputs, 0xff, 5 * sizeof(INT16)); - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - } - - BurnGunMakeInputs(0, (INT16)DrvAxis[0], (INT16)DrvAxis[1]); - BurnGunMakeInputs(1, (INT16)DrvAxis[2], (INT16)DrvAxis[3]); - - float x0 = ((float)((BurnGunX[0] >> 8) + 8)) / 448 * 412; - float y0 = ((float)((BurnGunY[0] >> 8) + 8)) / 224 * 224; - float x1 = ((float)((BurnGunX[1] >> 8) + 8)) / 448 * 412; - float y1 = ((float)((BurnGunY[1] >> 8) + 8)) / 224 * 224; - DrvAnalogInput[0] = (UINT16)x0 + 0x3c; - DrvAnalogInput[2] = (UINT8)y0 + 0; - DrvAnalogInput[1] = (UINT16)x1 + 0x3c; - DrvAnalogInput[3] = (UINT8)y1 + 0; -} - -static INT32 lordgunFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - compile_inputs(); - - SekNewFrame(); - ZetNewFrame(); - - INT32 nTotalCycles[2] = { 10000000 / 60, 5000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - INT32 nInterleave = 50; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - nCurrentCPU = 0; - nNext = (i + 1) * nTotalCycles[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - BurnTimerUpdateYM3812(i * (nTotalCycles[1] / nInterleave)); - } - - BurnTimerEndFrameYM3812(nTotalCycles[1]); - - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - lordgunDraw(); - } - - return 0; -} - -static INT32 alienchaFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - compile_inputs(); - - SekNewFrame(); - ZetNewFrame(); - - INT32 nInterleave = 1000; - - INT32 nCyclesTotal[2] = { 10000000 / 60, 5000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - } - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYMF278BUpdate(nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029708; - } - - if (nAction & ACB_VOLATILE) { - - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All RAM"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYMF278BScan(nAction, pnMin); - - BurnGunScan(); - EEPROMScan(nAction, pnMin); - - SCAN_VAR(aliencha_dip_sel); - SCAN_VAR(lordgun_whitescreen); - - SCAN_VAR(lordgun_gun_hw_x[0]); - SCAN_VAR(lordgun_gun_hw_y[0]); - SCAN_VAR(lordgun_gun_hw_x[1]); - SCAN_VAR(lordgun_gun_hw_y[1]); - } - - if (nAction & ACB_WRITE) { - INT32 bank = *okibank; - *okibank = -1; - set_oki_bank(bank); - } - - return 0; -} - - -// Lord of Gun (USA) - -static struct BurnRomInfo lordgunRomDesc[] = { - { "lordgun.10", 0x080000, 0xacda77ef, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "lordgun.4", 0x080000, 0xa1a61254, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "lordgun.90", 0x010000, 0xd59b5e28, 2 | BRF_PRG | BRF_ESS }, // 2 z80 code - - { "igst001.108", 0x100000, 0x36dd96f3, 3 | BRF_GRA }, // 3 8x8 tiles - { "igst002.114", 0x100000, 0x816a7665, 3 | BRF_GRA }, // 4 - { "igst003.119", 0x100000, 0xcbfee543, 3 | BRF_GRA }, // 5 - - { "igsb001.82", 0x200000, 0x3096de1c, 4 | BRF_GRA }, // 6 16x16 and 32x32 tiles - { "igsb002.91", 0x200000, 0x2234531e, 4 | BRF_GRA }, // 7 - { "igsb003.97", 0x200000, 0x6cbf21ac, 4 | BRF_GRA }, // 8 - - { "igsa001.14", 0x200000, 0x400abe33, 5 | BRF_GRA }, // 9 Sprites - { "igsa004.13", 0x200000, 0x52687264, 5 | BRF_GRA }, // 10 - { "igsa002.9", 0x200000, 0xa4810e38, 5 | BRF_GRA }, // 11 - { "igsa005.8", 0x200000, 0xe32e79e3, 5 | BRF_GRA }, // 12 - { "igsa003.3", 0x200000, 0x649e48d9, 5 | BRF_GRA }, // 13 - { "igsa006.2", 0x200000, 0x39288eb6, 5 | BRF_GRA }, // 14 - - { "lordgun.100", 0x080000, 0xb4e0fa07, 6 | BRF_SND }, // 15 OKI #0 Samples -}; - -STD_ROM_PICK(lordgun) -STD_ROM_FN(lordgun) - -static INT32 lordgunInit() -{ - return DrvInit(lordgunLoadRoms, 1); -} - -struct BurnDriver BurnDrvLordgun = { - "lordgun", NULL, NULL, NULL, "1994", - "Lord of Gun (USA)\0", "Imperfect graphics and sound", "IGS", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0, - NULL, lordgunRomInfo, lordgunRomName, NULL, NULL, LordgunInputInfo, LordgunDIPInfo, - lordgunInit, DrvExit, lordgunFrame, lordgunDraw, DrvScan, &DrvRecalc, 0x800, - 448, 224, 4, 3 -}; - -// Alien Challenge (World) - -static struct BurnRomInfo alienchaRomDesc[] = { - { "igsc0102.u81", 0x200000, 0xe3432be3, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - - { "hfh_s.u86", 0x010000, 0x5728a9ed, 2 | BRF_PRG | BRF_ESS }, // 1 z80 code - - { "igst0101.u9", 0x100000, 0x2ce12d7b, 3 | BRF_GRA }, // 2 8x8 tiles - { "igst0102.u10", 0x100000, 0x542a76a0, 3 | BRF_GRA }, // 3 - { "igst0103.u11", 0x100000, 0xadf5698a, 3 | BRF_GRA }, // 4 - - { "igsb0101.u8", 0x200000, 0x5c995f7e, 4 | BRF_GRA }, // 5 16x16 and 32x32 tiles - { "igsb0102.u7", 0x200000, 0xa2ae9baf, 4 | BRF_GRA }, // 6 - { "igsb0103.u6", 0x200000, 0x11b927af, 4 | BRF_GRA }, // 7 - - { "igsa0101.u3", 0x400000, 0x374d07c4, 5 | BRF_GRA }, // 8 Sprites - { "igsa0102.u2", 0x400000, 0xdbeee7ac, 5 | BRF_GRA }, // 9 - { "igsa0103.u1", 0x400000, 0xe5f19041, 5 | BRF_GRA }, // 10 - - { "hfh_g.u65", 0x040000, 0xec469b57, 6 | BRF_SND }, // 11 OKI #0 Samples - - { "hfh_g.u66", 0x040000, 0x7cfcd98e, 7 | BRF_SND }, // 12 OKI #1 Samples - - { "yrw801-m", 0x200000, 0x2a9d8d43, 8 | BRF_SND }, // 13 YMF278b Samples -}; - -STD_ROM_PICK(aliencha) -STD_ROM_FN(aliencha) - -static INT32 alienchaInit() -{ - return DrvInit(alienchaLoadRoms, 0); -} - -struct BurnDriver BurnDrvAliencha = { - "aliencha", NULL, NULL, NULL, "1994", - "Alien Challenge (World)\0", "Imperfect sound", "IGS", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, alienchaRomInfo, alienchaRomName, NULL, NULL, AlienchaInputInfo, AlienchaDIPInfo, - alienchaInit, DrvExit, alienchaFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 448, 224, 4, 3 -}; - - -// Alien Challenge (China) - -static struct BurnRomInfo alienchacRomDesc[] = { - { "igsc0102.u81", 0x200000, 0xe3432be3, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "hfh_p.u80", 0x080000, 0x5175ebdc, 1 | BRF_PRG | BRF_ESS }, // 1 - { "hfh_p.u79", 0x080000, 0x42ad978c, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "hfh_s.u86", 0x010000, 0x5728a9ed, 2 | BRF_PRG | BRF_ESS }, // 3 z80 code - - { "igst0101.u9", 0x100000, 0x2ce12d7b, 3 | BRF_GRA }, // 4 8x8 tiles - { "igst0102.u10", 0x100000, 0x542a76a0, 3 | BRF_GRA }, // 5 - { "igst0103.u11", 0x100000, 0xadf5698a, 3 | BRF_GRA }, // 6 - - { "igsb0101.u8", 0x200000, 0x5c995f7e, 4 | BRF_GRA }, // 7 16x16 and 32x32 tiles - { "igsb0102.u7", 0x200000, 0xa2ae9baf, 4 | BRF_GRA }, // 8 - { "igsb0103.u6", 0x200000, 0x11b927af, 4 | BRF_GRA }, // 9 - - { "igsa0101.u3", 0x400000, 0x374d07c4, 5 | BRF_GRA }, // 10 Sprites - { "igsa0102.u2", 0x400000, 0xdbeee7ac, 5 | BRF_GRA }, // 11 - { "igsa0103.u1", 0x400000, 0xe5f19041, 5 | BRF_GRA }, // 12 - - { "hfh_g.u65", 0x040000, 0xec469b57, 6 | BRF_SND }, // 11 OKI #0 Samples - - { "hfh_g.u66", 0x040000, 0x7cfcd98e, 7 | BRF_SND }, // 12 OKI #1 Samples - - { "yrw801-m", 0x200000, 0x2a9d8d43, 8 | BRF_SND }, // 13 YMF278b Samples -}; - -STD_ROM_PICK(alienchac) -STD_ROM_FN(alienchac) - -static INT32 alienchacInit() -{ - return DrvInit(alienchacLoadRoms, 0); -} - -struct BurnDriver BurnDrvAlienchac = { - "alienchac", "aliencha", NULL, NULL, "1994", - "Alien Challenge (China)\0", "Imperfect sound", "IGS", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, alienchacRomInfo, alienchacRomName, NULL, NULL, AlienchaInputInfo, AlienchacDIPInfo, - alienchacInit, DrvExit, alienchaFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 448, 224, 4, 3 -}; +// FB Alpha Lord of Gun driver module +// Based on MAME driver by Luca Elia, XingXing, and David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ymf278b.h" +#include "burn_ym3812.h" +#include "msm6295.h" +#include "8255ppi.h" +#include "eeprom.h" +#include "burn_gun.h" + +static UINT8 *AllMem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *AllRam = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Drv68KROM = NULL; +static UINT8 *DrvZ80ROM = NULL; +static UINT8 *DrvGfxROM0 = NULL; +static UINT8 *DrvGfxROM1 = NULL; +static UINT8 *DrvGfxROM2 = NULL; +static UINT8 *DrvGfxROM3 = NULL; +static UINT8 *DrvSndROM0 = NULL; +static UINT8 *DrvSndROM1 = NULL; +static UINT8 *DrvSndROM2 = NULL; +static UINT8 *Drv68KRAM = NULL; +static UINT8 *DrvPriRAM = NULL; +static UINT8 *DrvPalRAM = NULL; +static UINT8 *DrvVidRAM0 = NULL; +static UINT8 *DrvVidRAM1 = NULL; +static UINT8 *DrvVidRAM2 = NULL; +static UINT8 *DrvVidRAM3 = NULL; +static UINT8 *DrvScrRAM = NULL; +static UINT8 *DrvSprRAM = NULL; +static UINT8 *DrvProtRAM = NULL; +static UINT8 *DrvZ80RAM = NULL; + +static UINT32 *DrvPalette = NULL; +static UINT8 DrvRecalc; + +static UINT16 *scrollx = NULL; +static UINT16 *scrolly = NULL; +static UINT16 *priority = NULL; +static UINT8 *soundlatch = NULL; +static INT8 *okibank = NULL; + +static UINT8 *DrvTransTable[5] = { NULL, NULL, NULL, NULL, NULL }; +static UINT16 *draw_bitmap[5] = { NULL, NULL, NULL, NULL, NULL }; + +static UINT8 aliencha_dip_sel; +static UINT8 lordgun_whitescreen; + +static INT32 DrvAxis[4]; +static UINT16 DrvAnalogInput[4]; +static UINT16 DrvInputs[5]; +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvJoy4[16]; +static UINT8 DrvJoy5[16]; +static UINT8 DrvDips[4]; +static UINT8 DrvReset; + +static INT32 lordgun_gun_hw_x[2]; +static INT32 lordgun_gun_hw_y[2]; + +#define A(a, b, c, d) { a, b, (UINT8*)(c), d } + +static struct BurnInputInfo LordgunInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy4 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "mouse x-axis"), + A("P1 Up / Down", BIT_ANALOG_REL, DrvAxis + 1, "mouse y-axis"), + {"P1 Button 1", BIT_DIGITAL, DrvJoy5 + 4, "mouse button" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy4 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start" }, + A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 2, "mouse x-axis"), + A("P2 Up / Down", BIT_ANALOG_REL, DrvAxis + 3, "mouse y-axis"), + {"P2 Button 1", BIT_DIGITAL, DrvJoy5 + 5, "mouse button" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 7, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Lordgun) + +#undef A + +static struct BurnInputInfo AlienchaInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy4 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 1, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 4, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvJoy4 + 2, "p1 fire 4" }, + {"P1 Button 5", BIT_DIGITAL, DrvJoy4 + 3, "p1 fire 5" }, + {"P1 Button 6", BIT_DIGITAL, DrvJoy4 + 4, "p1 fire 6" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy4 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 0, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 1, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 4, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, DrvJoy4 + 5, "p2 fire 4" }, + {"P2 Button 5", BIT_DIGITAL, DrvJoy4 + 6, "p2 fire 5" }, + {"P2 Button 6", BIT_DIGITAL, DrvJoy4 + 7, "p2 fire 6" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 1, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, + {"Fake Dip", BIT_DIPSWITCH, DrvDips + 3, "dip" }, +}; + +STDINPUTINFO(Aliencha) + +static struct BurnDIPInfo LordgunDIPList[]= +{ + {0x0d, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 2, "Stage Select" }, + {0x0d, 0x01, 0x01, 0x01, "Off" }, + {0x0d, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Guns" }, + {0x0d, 0x01, 0x02, 0x02, "IGS" }, + {0x0d, 0x01, 0x02, 0x00, "Konami" }, + + {0 , 0xfe, 0 , 2, "Ranking Music" }, + {0x0d, 0x01, 0x04, 0x04, "Exciting" }, + {0x0d, 0x01, 0x04, 0x00, "Tender" }, + + {0 , 0xfe, 0 , 2, "Coin Slots" }, + {0x0d, 0x01, 0x08, 0x00, "1" }, + {0x0d, 0x01, 0x08, 0x08, "2" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0d, 0x01, 0x40, 0x40, "Off" }, + {0x0d, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(Lordgun) + +static struct BurnDIPInfo AlienchaDIPList[]= +{ + {0x1a, 0xff, 0xff, 0xff, NULL }, + {0x1b, 0xff, 0xff, 0xff, NULL }, + {0x1c, 0xff, 0xff, 0xff, NULL }, + {0x1d, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 2, "Credits To Start" }, + {0x1a, 0x01, 0x01, 0x01, "1" }, + {0x1a, 0x01, 0x01, 0x00, "2" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x1a, 0x01, 0x0e, 0x00, "5 Coins 1 Credits" }, + {0x1a, 0x01, 0x0e, 0x02, "4 Coins 1 Credits" }, + {0x1a, 0x01, 0x0e, 0x04, "3 Coins 1 Credits" }, + {0x1a, 0x01, 0x0e, 0x06, "2 Coins 1 Credits" }, + {0x1a, 0x01, 0x0e, 0x0e, "1 Coin 1 Credits" }, + {0x1a, 0x01, 0x0e, 0x0c, "1 Coin 2 Credits" }, + {0x1a, 0x01, 0x0e, 0x0a, "1 Coin 3 Credits" }, + {0x1a, 0x01, 0x0e, 0x08, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x1a, 0x01, 0x70, 0x00, "5 Coins 1 Credits" }, + {0x1a, 0x01, 0x70, 0x10, "4 Coins 1 Credits" }, + {0x1a, 0x01, 0x70, 0x20, "3 Coins 1 Credits" }, + {0x1a, 0x01, 0x70, 0x30, "2 Coins 1 Credits" }, + {0x1a, 0x01, 0x70, 0x70, "1 Coin 1 Credits" }, + {0x1a, 0x01, 0x70, 0x60, "1 Coin 2 Credits" }, + {0x1a, 0x01, 0x70, 0x50, "1 Coin 3 Credits" }, + {0x1a, 0x01, 0x70, 0x40, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 2, "Coin Slots" }, + {0x1a, 0x01, 0x80, 0x80, "1" }, + {0x1a, 0x01, 0x80, 0x00, "2" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x1b, 0x01, 0x03, 0x03, "0" }, + {0x1b, 0x01, 0x03, 0x02, "1" }, + {0x1b, 0x01, 0x03, 0x01, "2" }, + {0x1b, 0x01, 0x03, 0x00, "3" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x1b, 0x01, 0x04, 0x04, "Off" }, + {0x1b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Round Time" }, + {0x1b, 0x01, 0x08, 0x00, "32 s" }, + {0x1b, 0x01, 0x08, 0x08, "40 s" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x1b, 0x01, 0x10, 0x00, "Off" }, + {0x1b, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x1b, 0x01, 0x20, 0x20, "Off" }, + {0x1b, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Allow Join" }, + {0x1b, 0x01, 0x40, 0x00, "No" }, + {0x1b, 0x01, 0x40, 0x40, "Yes" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x1b, 0x01, 0x80, 0x00, "No" }, + {0x1b, 0x01, 0x80, 0x80, "Yes" }, + + {0 , 0xfe, 0 , 3, "Buttons" }, + {0x1c, 0x01, 0x03, 0x01, "3" }, + {0x1c, 0x01, 0x03, 0x02, "4" }, + {0x1c, 0x01, 0x03, 0x03, "6" }, + + {0 , 0xfe, 0 , 2, "Vs. Rounds" }, + {0x1c, 0x01, 0x04, 0x00, "3" }, + {0x1c, 0x01, 0x04, 0x04, "5" }, + + {0 , 0xfe, 0 , 2, "Language (text)" }, + {0x1d, 0x01, 0x01, 0x00, "English" }, + {0x1d, 0x01, 0x01, 0x01, "Chinese" }, + + {0 , 0xfe, 0 , 2, "Language (char names)"}, + {0x1d, 0x01, 0x02, 0x00, "English" }, + {0x1d, 0x01, 0x02, 0x02, "Chinese" }, + + {0 , 0xfe, 0 , 2, "Title" }, + {0x1d, 0x01, 0x04, 0x00, "Alien Challenge" }, + {0x1d, 0x01, 0x04, 0x04, "Round House Rumble" }, +}; + +STDDIPINFO(Aliencha) + +static struct BurnDIPInfo AlienchacDIPList[] = { + {0x1d, 0xff, 0xff, 0x03, NULL }, +}; + +STDDIPINFOEXT(Alienchac, Aliencha, Alienchac) + +static const short lordgun_gun_x_table[] = +{ + -100, 0x001,0x001,0x002,0x002,0x003,0x003,0x004,0x005,0x006,0x007,0x008,0x009,0x00A,0x00B,0x00C, + 0x00D,0x00E,0x00F,0x010,0x011,0x012,0x013,0x014,0x015,0x016,0x017,0x018,0x019,0x01A,0x01B,0x01C, + 0x01D,0x01E,0x01F,0x020,0x021,0x022,0x023,0x024,0x025,0x026,0x027,0x028,0x029,0x02A,0x02B,0x02C, + 0x02D,0x02E,0x02F,0x030,0x031,0x032,0x033,0x034,0x035,0x036,0x037,0x038,0x039,0x03A,0x03B,0x03C, + 0x03D,0x03E,0x03F,0x040,0x041,0x043,0x044,0x045,0x046,0x047,0x048,0x049,0x04A,0x04B,0x04C,0x04E, + 0x04F,0x050,0x051,0x052,0x053,0x054,0x055,0x056,0x057,0x059,0x05A,0x05B,0x05C,0x05D,0x05E,0x05F, + 0x060,0x061,0x05A,0x063,0x065,0x066,0x067,0x068,0x069,0x06A,0x06B,0x06C,0x06D,0x06E,0x06F,0x071, + 0x072,0x074,0x075,0x077,0x078,0x07A,0x07B,0x07D,0x07E,0x080,0x081,0x083,0x085,0x087,0x089,0x08B, + 0x08D,0x08E,0x08F,0x090,0x092,0x093,0x095,0x097,0x098,0x099,0x09A,0x09B,0x09C,0x09D,0x09E,0x0A0, + 0x0A1,0x0A2,0x0A3,0x0A4,0x0A5,0x0A6,0x0A7,0x0A8,0x0A9,0x0AA,0x0AC,0x0AD,0x0AE,0x0AF,0x0B0,0x0B1, + 0x0B2,0x0B3,0x0B4,0x0B5,0x0B6,0x0B8,0x0B9,0x0BA,0x0BB,0x0BC,0x0BD,0x0BE,0x0BF,0x0C0,0x0C1,0x0C2, + 0x0C4,0x0C5,0x0C6,0x0C7,0x0C8,0x0C9,0x0CA,0x0CB,0x0CC,0x0CD,0x0CF,0x0D0,0x0D1,0x0D2,0x0D3,0x0D4, + 0x0D5,0x0D6,0x0D7,0x0D8,0x0D9,0x0DB,0x0DC,0x0DD,0x0DE,0x0DF,0x0E0,0x0E1,0x0E2,0x0E3,0x0E4,0x0E5, + 0x0E7,0x0E8,0x0E9,0x0EA,0x0EB,0x0EC,0x0ED,0x0EE,0x0EF,0x0F0,0x0F1,0x0F3,0x0F4,0x0F5,0x0F6,0x0F7, + 0x0F8,0x0F9,0x0FA,0x0FB,0x0FC,0x0FE,0x0FF,0x100,0x101,0x102,0x103,0x104,0x105,0x106,0x107,0x108, + 0x10A,0x10B,0x10C,0x10D,0x10E,0x10F,0x110,0x111,0x112,0x113,0x114,0x116,0x117,0x118,0x119,0x11A, + 0x11B,0x11C,0x11D,0x11E,0x11F,0x120,0x122,0x123,0x124,0x125,0x126,0x127,0x128,0x129,0x12A,0x12B, + 0x12C,0x12E,0x12F,0x130,0x131,0x132,0x133,0x134,0x135,0x136,0x137,0x139,0x13A,0x13B,0x13C,0x13D, + 0x13E,0x13F,0x140,0x141,0x142,0x143,0x145,0x146,0x147,0x148,0x149,0x14A,0x14B,0x14C,0x14D,0x14E, + 0x14F,0x151,0x152,0x153,0x154,0x155,0x156,0x157,0x158,0x159,0x15A,0x15B,0x15D,0x15E,0x15F,0x160, + 0x161,0x162,0x163,0x164,0x165,0x166,0x167,0x169,0x16A,0x16B,0x16C,0x16D,0x16E,0x16F,0x170,0x171, + 0x172,0x174,0x175,0x176,0x177,0x178,0x179,0x17A,0x17B,0x17C,0x17D,0x17E,0x17F,0x180,0x181,0x182, + 0x183,0x184,0x185,0x186,0x187,0x188,0x189,0x18A,0x18B,0x18C,0x18D,0x18E,0x18F,0x190,0x191,0x192, + 0x193,0x194,0x195,0x196,0x197,0x198,0x199,0x19A,0x19B,0x19C,0x19D,0x19E,0x19F,0x1A0,0x1A1,0x1A2, + 0x1A3,0x1A4,0x1A5,0x1A6,0x1A7,0x1A8,0x1A9,0x1AA,0x1AB,0x1AC,0x1AD,0x1AE,0x1AF,0x1B0,0x1B1,0x1B2, + 0x1B3,0x1B4,0x1B5,0x1B6,0x1B7,0x1B8,0x1B9,0x1BA,0x1BB,0x1BC,0x1BD,0x1BE,0x1BF,0x1BF +}; + +static void lordgun_update_gun(INT32 i) +{ + INT32 x = DrvAnalogInput[i] - 0x3c; + + lordgun_gun_hw_x[i] = DrvAnalogInput[i]; + lordgun_gun_hw_y[i] = DrvAnalogInput[i+2]; + + if ((x < 0) || (x > (INT32)(sizeof(lordgun_gun_x_table)/sizeof(lordgun_gun_x_table[0]))) ) + x = 0; + + INT32 scrx = lordgun_gun_x_table[x]; + INT32 scry = DrvAnalogInput[i+2]; + + if ((scrx < 0) || (scrx >= nScreenWidth) || (scry < 0) || (scry > nScreenHeight)) { + lordgun_gun_hw_x[i] = lordgun_gun_hw_y[i] = 0; + } +} + +void __fastcall lordgun_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x502000: + scrollx[0] = data; + return; + + case 0x502200: + scrollx[1] = data; + return; + + case 0x502400: + scrollx[2] = data; + return; + + case 0x502600: + scrollx[3] = data; + return; + + case 0x502800: + scrolly[0] = data; + return; + + case 0x502a00: + scrolly[1] = data; + return; + + case 0x502c00: + scrolly[2] = data; + return; + + case 0x502e00: + scrolly[3] = data; + return; + + case 0x503000: + priority[0] = data; + return; + + case 0x504000: + soundlatch[0] = data >> 8; + soundlatch[1] = data; + ZetNmi(); + return; + + case 0x506000: + case 0x506002: + case 0x506004: + case 0x506006: + ppi8255_w(0, (address >> 1) & 3, data); + return; + + case 0x508000: + case 0x508002: + case 0x508004: + case 0x508006: + ppi8255_w(1, (address >> 1) & 3, data); + return; + } +} + +void __fastcall lordgun_write_byte(UINT32 /*address*/, UINT8 /*data*/) +{ +// address = data; // kill warnings... +} + +UINT16 __fastcall lordgun_read_word(UINT32 address) +{ + switch (address) + { + case 0x503800: + return lordgun_gun_hw_x[0]; + + case 0x503a00: + return lordgun_gun_hw_x[1]; + + case 0x503c00: + return lordgun_gun_hw_y[0]; + + case 0x503e00: + return lordgun_gun_hw_y[1]; + + case 0x506000: + case 0x506002: + case 0x506004: + case 0x506006: + return ppi8255_r(0, (address >> 1) & 3); + + case 0x508000: + case 0x508002: + case 0x508004: + case 0x508006: + return ppi8255_r(1, (address >> 1) & 3); + } + + return 0; +} + +UINT8 __fastcall lordgun_read_byte(UINT32 address) +{ + switch (address) + { + case 0x506001: + case 0x506003: + case 0x506005: + case 0x506007: + return ppi8255_r(0, (address >> 1) & 3); + + case 0x508001: + case 0x508003: + case 0x508005: + case 0x508007: + return ppi8255_r(1, (address >> 1) & 3); + } + + return 0; +} + +static void set_oki_bank(INT32 bank) +{ + if (*okibank != (bank & 0x02)) { + *okibank = bank & 0x02; + + memcpy (DrvSndROM0, DrvSndROM0 + 0x40000 + *okibank * 0x40000, 0x40000); + } +} + +void __fastcall lordgun_sound_write_port(UINT16 port, UINT8 data) +{ + switch (port) + { + case 0x1000: // lordgun + case 0x1001: + BurnYM3812Write(port & 1, data); + return; + + case 0x2000: // lordgun + MSM6295Command(0, data); + return; + + case 0x6000: // lordgun + set_oki_bank(data); + return; + + case 0x7000: // aliencha + case 0x7001: + case 0x7002: + BurnYMF278BSelectRegister(port & 3, data); + return; + + case 0x7003: + case 0x7004: + case 0x7005: + BurnYMF278BWriteRegister(port & 3, data); + return; + + case 0x7400: // aliencha + MSM6295Command(0, data); + return; + + case 0x7800: // aliencha + MSM6295Command(1, data); + return; + } +} + +UINT8 __fastcall lordgun_sound_read_port(UINT16 port) +{ + switch (port) + { + case 0x2000: // lordgun + return MSM6295ReadStatus(0); + + case 0x3000: + return soundlatch[0]; + + case 0x4000: + return soundlatch[1]; + + case 0x7000: // aliencha + return BurnYMF278BReadStatus(); + + case 0x7400: // aliencha + return MSM6295ReadStatus(0); + + case 0x7800: // aliencha + return MSM6295ReadStatus(1); + } + + return 0; +} + +// ppi8255 handlers + +static void aliencha_dip_select(UINT8 data) +{ + aliencha_dip_sel = data; +} + +static UINT8 lordgun_dip_read() +{ + return (DrvDips[0] & 0x4f) | (EEPROMRead() ? 0x80 : 0) | (DrvInputs[4] & 0x30); +} + +static void lordgun_eeprom_write(UINT8 data) +{ + static INT32 old; + + for (INT32 i = 0; i < 2; i++) + if ((data & (0x04 << i)) && !(old & (0x04 << i))) + lordgun_update_gun(i); + + // coin counter 0x01 (0) + + EEPROMWrite((data & 0x20), (data & 0x10), (data & 0x40)); + + lordgun_whitescreen = data & 0x80; + + old = data; +} + +static void aliencha_eeprom_write(UINT8 data) +{ + lordgun_whitescreen = !(data & 0x02); + + // coin counters 0x08 (0) and 0x10 (1) + + EEPROMWrite((data & 0x40), (data & 0x20), (data & 0x80)); +} + +static UINT8 lordgun_start1_read() { return DrvInputs[0]; } +static UINT8 lordgun_start2_read() { return DrvInputs[1]; } +static UINT8 lordgun_service_read(){ return DrvInputs[2]; } +static UINT8 lordgun_coin_read() { return DrvInputs[3]; } + +static UINT8 aliencha_service_read(){ return (DrvInputs[2] & 0xfe) | (EEPROMRead() ? 0x01 : 0); } // aliencha eeprom read... + +static UINT8 aliencha_dip_read() +{ + switch (aliencha_dip_sel & 0x70) { + case 0x30: return DrvDips[0]; + case 0x60: return DrvDips[1]; + case 0x50: return DrvDips[2]; + } + return 0xff; +} + +// sound irq / timing handlers + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + ZetSetIRQLine(0, nStatus ? ZET_IRQSTATUS_ACK : ZET_IRQSTATUS_NONE); +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 5000000; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYMF278BReset(); // aliencha + BurnYM3812Reset(); + MSM6295Reset(0); + MSM6295Reset(1); // aliencha + + *okibank = -1; + set_oki_bank(0); // lordgun + + EEPROMReset(); + + aliencha_dip_sel = 0; + lordgun_whitescreen = 0; + + // rom hacks + if (!strncmp(BurnDrvGetTextA(DRV_NAME), "aliencha", 8)) { + *((UINT16*)(Drv68KROM + 0x00a34)) = BURN_ENDIAN_SWAP_INT16(0x7000) | ((DrvDips[3] >> 0) & 1); // text language + *((UINT16*)(Drv68KROM + 0x00a38)) = BURN_ENDIAN_SWAP_INT16(0x7000) | ((DrvDips[3] >> 1) & 1); // character name language + *((UINT16*)(Drv68KROM + 0x00a3c)) = BURN_ENDIAN_SWAP_INT16(0x7000) | ((DrvDips[3] >> 2) & 1); // title + } else { + + UINT8 lordgun_eepromdata[48] = { + 0xFF, 0x83, 0x5F, 0xFF, 0xFF, 0xBF, 0x14, 0xB7, 0xA3, 0xA4, 0x80, 0x29, 0x37, 0xA6, 0x32, 0x39, + 0x37, 0x90, 0x10, 0x33, 0xBA, 0xA3, 0x00, 0x37, 0x01, 0x00, 0xFF, 0xFF, 0x03, 0x42, 0xFF, 0xFF, + 0xFF, 0x83, 0xFF, 0xFF, 0xFF, 0x87, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + }; + + if (EEPROMAvailable() == 0) { + EEPROMFill(lordgun_eepromdata, 0, 48); + } + } + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x200000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x400000; + DrvGfxROM1 = Next; Next += 0x800000; + DrvGfxROM2 = Next; Next += 0x800000; + DrvGfxROM3 = Next; Next += 0x1000000; + + DrvTransTable[0]= Next; Next += (0x0400000 / ( 8 * 8)); + DrvTransTable[1]= Next; Next += (0x0800000 / (16 * 16)); + DrvTransTable[2]= Next; Next += (0x0800000 / (32 * 32)); + DrvTransTable[3]= Next; Next += (0x1000000 / (16 * 16)); + DrvTransTable[4]= Next; Next += (0x0800000 / (16 * 16)) * 16; + + MSM6295ROM = Next; + DrvSndROM0 = Next; Next += 0x100000; + DrvSndROM1 = Next; Next += 0x040000; + DrvSndROM2 = Next; Next += 0x200000; + + DrvPalette = (UINT32*)Next; Next += (0x0800 + 1) * sizeof(UINT32); + + draw_bitmap[0] = (UINT16*)Next; Next += 448 * 240 * 2; + draw_bitmap[1] = (UINT16*)Next; Next += 448 * 240 * 2; + draw_bitmap[2] = (UINT16*)Next; Next += 448 * 240 * 2; + draw_bitmap[3] = (UINT16*)Next; Next += 448 * 240 * 2; + draw_bitmap[4] = (UINT16*)Next; Next += 448 * 240 * 2; + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPriRAM = Next; Next += 0x010000; + DrvVidRAM0 = Next; Next += 0x010000; + DrvVidRAM1 = Next; Next += 0x004000; + DrvVidRAM2 = Next; Next += 0x004000; + DrvVidRAM3 = Next; Next += 0x002000; + DrvScrRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x000800; + DrvProtRAM = Next; Next += 0x000400; + DrvPalRAM = Next; Next += 0x001000; + + DrvZ80RAM = Next; Next += 0x001000; + + scrollx = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); + scrolly = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); + priority = (UINT16*)Next; Next += 0x000001 * sizeof(UINT16); + + soundlatch = Next; Next += 0x000002; + + okibank = (INT8*)Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void DrvSetTransTab(UINT8 *gfx, INT32 tab, INT32 len, INT32 size) +{ + for (INT32 i = 0; i < len; i+= (size * size)) + { + DrvTransTable[tab][i/(size*size)] = 1; // transparent + + for (INT32 j = 0; j < (size * size); j++) { + if (gfx[i + j] != 0x3f) { + DrvTransTable[tab][i/(size*size)] = 0; + break; + } + } + } +} + +static void DrvGfxDecode(UINT8 *gfxsrc, UINT8 *gfxdest, INT32 len, INT32 size) +{ + INT32 Planes[6] = { + (((len * 8) / 3) * 2) + 8, (((len * 8) / 3) * 2) + 0, + (((len * 8) / 3) * 1) + 8, (((len * 8) / 3) * 1) + 0, + (((len * 8) / 3) * 0) + 8, (((len * 8) / 3) * 0) + 0 + }; + + INT32 XOffs1[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }; + INT32 XOffs2[32] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x200, 0x201, 0x202, 0x203, 0x204, 0x205, 0x206, 0x207, + 0x400, 0x401, 0x402, 0x403, 0x404, 0x405, 0x406, 0x407, + 0x600, 0x601, 0x602, 0x603, 0x604, 0x605, 0x606, 0x607 }; + INT32 YOffs[32] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, + 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0, + 0x100, 0x110, 0x120, 0x130, 0x140, 0x150, 0x160, 0x170, + 0x180, 0x190, 0x1a0, 0x1b0, 0x1c0, 0x1d0, 0x1e0, 0x1f0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(len); + if (tmp == NULL) { + return; + } + + memcpy (tmp, gfxsrc, len); + + GfxDecode(((len * 8) / 6) / (size*size), 6, size, size, Planes, (size == 32) ? XOffs2 : XOffs1, YOffs, (size*size*2), tmp, gfxdest); + + BurnFree (tmp); +} + +static INT32 DrvInit(INT32 (*pInitCallback)(), INT32 lordgun) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (pInitCallback) { + if (pInitCallback()) return 1; + } + + DrvGfxDecode(DrvGfxROM0, DrvGfxROM0, 0x300000, 8); + DrvGfxDecode(DrvGfxROM2, DrvGfxROM1, 0x600000, 16); + DrvGfxDecode(DrvGfxROM2, DrvGfxROM2, 0x600000, 32); + DrvGfxDecode(DrvGfxROM3, DrvGfxROM3, 0xc00000, 16); + DrvSetTransTab(DrvGfxROM0, 0, 0x0400000, 8); + DrvSetTransTab(DrvGfxROM1, 1, 0x0800000, 16); + DrvSetTransTab(DrvGfxROM2, 2, 0x0800000, 32); + DrvSetTransTab(DrvGfxROM3, 3, 0x1000000, 16); + DrvSetTransTab(DrvGfxROM1, 4, 0x0800000, 16/4); // for line scroll + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(DrvPriRAM, 0x210000, 0x21ffff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x310000, 0x313fff, SM_RAM); + SekMapMemory(DrvVidRAM2 , 0x314000, 0x317fff, SM_RAM); + SekMapMemory(DrvVidRAM3, 0x318000, 0x319fff, SM_RAM); + SekMapMemory(DrvScrRAM, 0x31c000, 0x31c7ff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x400000, 0x4007ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x500000, 0x500fff, SM_RAM); + SekMapMemory(DrvProtRAM, 0x50a800, 0x50abff, SM_RAM); // 900-9ff (lordgun) + SekMapMemory(DrvProtRAM, 0x50b800, 0x50bbff, SM_RAM); // 900-9ff (aliencha) + SekSetWriteWordHandler(0, lordgun_write_word); + SekSetWriteByteHandler(0, lordgun_write_byte); + SekSetReadWordHandler(0, lordgun_read_word); + SekSetReadByteHandler(0, lordgun_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); + ZetMapArea(0xf000, 0xffff, 0, DrvZ80RAM); + ZetMapArea(0xf000, 0xffff, 1, DrvZ80RAM); + ZetMapArea(0xf000, 0xffff, 2, DrvZ80RAM); + ZetSetOutHandler(lordgun_sound_write_port); + ZetSetInHandler(lordgun_sound_read_port); + ZetClose(); + + // aliencha + BurnYMF278BInit(0, DrvSndROM2, &DrvFMIRQHandler, DrvSynchroniseStream); + BurnYMF278BSetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); + BurnTimerAttachZet(5000000); + + // lordgun + BurnYM3812Init(3579545, &DrvFMIRQHandler, &DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3812(5000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 1000000 / 132, 1); + MSM6295Init(1, 1000000 / 132, 1); // aliencha + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + + ppi8255_init(2); + if (lordgun) { + PPI0PortReadA = lordgun_dip_read; + PPI0PortWriteB = lordgun_eeprom_write; + PPI0PortReadC = lordgun_service_read; + } else { + PPI0PortReadA = aliencha_dip_read; + PPI0PortReadC = aliencha_service_read; + PPI0PortWriteB = aliencha_eeprom_write; + PPI0PortWriteC = aliencha_dip_select; + } + + PPI1PortReadA = lordgun_start1_read; + PPI1PortReadB = lordgun_start2_read; + PPI1PortReadC = lordgun_coin_read; + + EEPROMInit(&eeprom_interface_93C46); + + GenericTilesInit(); + + BurnGunInit(2, true); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYMF278BExit(); // aliencha + BurnYM3812Exit(); + MSM6295Exit(0); + MSM6295Exit(1); // aliencha + + ppi8255_exit(); + BurnGunExit(); + + SekExit(); + ZetExit(); + + EEPROMExit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 lordgunLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x200000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x400000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x200000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x400000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x600000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x800000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0xa00000, 14, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x040000, 15, 1)) return 1; + + UINT16 *rom = (UINT16*)Drv68KROM; + + for (INT32 i = 0; i < 0x100000/2; i++) { + if ((i & 0x0120) == 0x0100 || (i & 0x0a00) == 0x0800) + rom[i] ^= BURN_ENDIAN_SWAP_INT16(0x0010); + } + + rom[0x14832/2] = BURN_ENDIAN_SWAP_INT16(0x6000); // 014832: 6700 0006 beq $1483a (protection) + rom[0x1587e/2] = BURN_ENDIAN_SWAP_INT16(0x6010); // 01587E: 6710 beq $15890 (rom check) + + return 0; +} + +static INT32 alienchaLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; + BurnByteswap(Drv68KROM, 0x200000); + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x200000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x400000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x400000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x800000, 10, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x040000, 11, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x000000, 12, 1)) return 1; + + if (BurnLoadRom(DrvSndROM2 + 0x000000, 13, 1)) return 1; + + UINT16 *rom = (UINT16*)Drv68KROM; + + rom[0x0A558/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0A558 beq.s $A56C + rom[0x0A8DC/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0A8DC beq.s $A8F0 + rom[0x0AC92/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0AC92 beq.s $ACA6 + rom[0x124CC/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 124CC beq.s $124E0 + rom[0x12850/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 12850 beq.s $12864 + rom[0x12C06/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 12C06 beq.s $12C1A + rom[0x1862A/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 1862A beq.s $1863E + rom[0x189AE/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 189AE beq.s $189C2 + rom[0x18D64/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 18D64 beq.s $18D78 + rom[0x230FC/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 230FC beq.s $23110 + rom[0x23480/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 23480 beq.s $23494 + rom[0x23836/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 23836 beq.s $2384A + rom[0x2BD0E/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2BD0E beq.s $2BD22 + rom[0x2C092/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2C092 beq.s $2C0A6 + rom[0x2C448/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2C448 beq.s $2C45C + + return 0; +} + +static INT32 alienchacLoadRoms() +{ + if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; + BurnByteswap(Drv68KROM, 0x200000); + if (BurnLoadRom(Drv68KROM + 0x000001, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 2, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x200000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x400000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x400000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x800000, 12, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x040000, 13, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x000000, 14, 1)) return 1; + + if (BurnLoadRom(DrvSndROM2 + 0x000000, 15, 1)) return 1; + + UINT16 *rom = (UINT16*)Drv68KROM; + + rom[0x0A550/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0A558 beq.s $A564 + rom[0x0A8D4/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0A8D4 beq.s $A8E8 + rom[0x0AC8A/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 0AC8A beq.s $AC9E + rom[0x124B8/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 124B8 beq.s $124CC + rom[0x1283C/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 1283C beq.s $12850 + rom[0x12BF2/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 12BF2 beq.s $12C06 + rom[0x18616/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 18616 beq.s $1862A + rom[0x1899A/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 1899A beq.s $189AE + rom[0x18D50/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 18D50 beq.s $18D64 + rom[0x230E8/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 230E8 beq.s $230FC + rom[0x2346C/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2346C beq.s $23480 + rom[0x23822/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 23822 beq.s $23822 + rom[0x2BCFA/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2BCFA beq.s $2BD0E + rom[0x2C07E/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2C07E beq.s $2C092 + rom[0x2C434/2] = BURN_ENDIAN_SWAP_INT16(0x6012); // 2C434 beq.s $2C448 + + return 0; +} + +static void draw_layer_linescroll() +{ + UINT16 *vram = (UINT16*)DrvVidRAM1; + UINT16 *sram = (UINT16*)DrvScrRAM; + UINT16 *dest = draw_bitmap[1]; + + for (INT32 y = 0; y < nScreenHeight; y++, dest += nScreenWidth) + { + INT32 yscroll = (scrolly[1] + y) & 0x1ff; + + for (INT32 x = 0; x < nScreenWidth + 16; x+=16) { + + INT32 xscroll = (scrollx[1] + sram[y * 2 + 1] + x) & 0x7ff; + + INT32 ofst = (((yscroll >> 4) << 7) | (xscroll >> 4)) << 1; + + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[ofst]); + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst + 1]) & 0x7fff; + INT32 pri = (attr & 0x0e00) >> 9; + + INT32 flipx = attr & 0x8000; + INT32 flipy = attr & 0x4000; + + INT32 color = ((attr & 0x0070) << 2)+0x600+pri*0x800; + + { + UINT8 *gfx = DrvGfxROM1 + (code << 8); + + if (flipy) gfx += ((yscroll & 0x0f)^0xf) << 4; + else gfx += ((yscroll & 0x0f) ) << 4; + + if (DrvTransTable[4][(gfx-DrvGfxROM1)/16]) continue; + + if (flipx) flipx = 0x0f; + + for (INT32 xx = 0, sx = x - (xscroll & 0x0f); xx < 16; xx++, sx++) { + if (sx < 0 || sx >= nScreenWidth) continue; + + INT32 pxl = gfx[xx^flipx]; + + if (pxl == 0x3f) continue; + + dest[sx] = pxl | color; + } + } + } + } +} + +static void draw_layer(UINT8 *ram, UINT8 *gfx, INT32 size, INT32 wide, INT32 high, INT32 color_offset, INT32 color_and, INT32 layer) +{ + INT32 twidth = wide * size; + INT32 theight = high * size; + + INT32 code_and = (size == 32) ? 0x1fff : ((size == 16) ? 0x7fff : 0xffff); + + UINT16 *vram = (UINT16*)ram; + + for (INT32 sy = 0, offs = 0; sy < high * size; sy+=size) + { + for (INT32 sx = 0; sx < wide * size; sx+=size, offs++) + { + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & code_and; + if (DrvTransTable[layer][code]) continue; // transparent + + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]); + + INT32 prio = (attr >> 9) & 0x07; + INT32 color= ((attr >> 4) & color_and) + color_offset / 0x40 + prio * 0x800 / 0x40; + + INT32 flipx= attr & 0x8000; + INT32 flipy= attr & 0x4000; + + INT32 xx = sx - (scrollx[layer] % twidth); + if (xx < (0 - (size - 1))) xx += twidth; + + INT32 yy = sy - (scrolly[layer] % theight); + if (yy < (0 - (size - 1))) yy += theight; + + if (xx >= nScreenWidth || yy >= nScreenHeight) continue; + + if (flipy) { + if (flipx) { + RenderCustomTile_Mask_FlipXY_Clip(draw_bitmap[layer], size, size, code, xx, yy, color, 6, 0x3f, 0, gfx); + } else { + RenderCustomTile_Mask_FlipY_Clip(draw_bitmap[layer], size, size, code, xx, yy, color, 6, 0x3f, 0, gfx); + } + } else { + if (flipx) { + RenderCustomTile_Mask_FlipX_Clip(draw_bitmap[layer], size, size, code, xx, yy, color, 6, 0x3f, 0, gfx); + } else { + RenderCustomTile_Mask_Clip(draw_bitmap[layer], size, size, code, xx, yy, color, 6, 0x3f, 0, gfx); + } + } + } + } +} + +static void draw_sprites() +{ + UINT16 *sprite = (UINT16*)DrvSprRAM; + + for (INT32 offs = 0; offs < 0x800 / 2; offs += 4) + { + INT32 x0, x1, dx, y0, y1, dy; + + INT32 attr = BURN_ENDIAN_SWAP_INT16(sprite[offs + 1]); + if (attr & 0x0100) break; + + INT32 sy = BURN_ENDIAN_SWAP_INT16(sprite[offs + 0]); + INT32 code = BURN_ENDIAN_SWAP_INT16(sprite[offs + 2]); + INT32 sx = BURN_ENDIAN_SWAP_INT16(sprite[offs + 3]); + INT32 flipx = (attr & 0x8000); + INT32 flipy = (attr & 0x4000); + INT32 pri = (attr & 0x0e00) >> 9; + INT32 color = (attr & 0x00f0) >> 4; + INT32 nx = (attr & 0x000f) + 1; + INT32 ny = ((sy & 0xf000) >> 12) + 1; + + if (flipx) { x0 = nx - 1; x1 = -1; dx = -1; } + else { x0 = 0; x1 = nx; dx = +1; } + + if (flipy) { y0 = ny - 1; y1 = -1; dy = -1; } + else { y0 = 0; y1 = ny; dy = +1; } + + sx -= 0x18; + sy = (sy & 0x7ff) - (sy & 0x800); + + for (INT32 y = y0; y != y1; y += dy, code += 1 - 0x10 * nx) + { + for (INT32 x = x0; x != x1; x += dx, code += 0x10) + { + if (DrvTransTable[3][code]) continue; + + if (flipy) { + if (flipx) { + RenderCustomTile_Mask_FlipXY_Clip(draw_bitmap[4], 16, 16, code, sx + x * 0x10, sy + y * 0x10, color + pri * 0x800/0x40, 6, 0x3f, 0, DrvGfxROM3); + } else { + RenderCustomTile_Mask_FlipY_Clip(draw_bitmap[4], 16, 16, code, sx + x * 0x10, sy + y * 0x10, color + pri * 0x800/0x40, 6, 0x3f, 0, DrvGfxROM3); + } + } else { + if (flipx) { + RenderCustomTile_Mask_FlipX_Clip(draw_bitmap[4], 16, 16, code, sx + x * 0x10, sy + y * 0x10, color + pri * 0x800/0x40, 6, 0x3f, 0, DrvGfxROM3); + } else { + RenderCustomTile_Mask_Clip(draw_bitmap[4], 16, 16, code, sx + x * 0x10, sy + y * 0x10, color + pri * 0x800/0x40, 6, 0x3f, 0, DrvGfxROM3); + } + } + } + } + } +} + +static void copy_layers() +{ + const UINT8 pri2layer[8] = { 0, 0, 0, 4, 3, 0, 1, 2 }; + const UINT8 layerpri[5] = { 0, 1, 2, 4, 3 }; + + UINT16 *dest = pTransDraw; + UINT16 *source[5] = { draw_bitmap[0], draw_bitmap[1], draw_bitmap[2], draw_bitmap[3], draw_bitmap[4] }; + UINT16 *pri_ram = (UINT16*)DrvPriRAM; + + for (INT32 y = 0; y < nScreenHeight; y++) + { + for (INT32 x = 0; x < nScreenWidth; x++) + { + UINT16 pens[5]; + INT32 pri_addr = 0; + + for (INT32 l = 0; l < 5; l++) { + pens[l] = *source[l]++; + if (pens[l] == 0x3f) pri_addr |= 1 << layerpri[l]; + } + + pri_addr |= (pens[1] >> 11) << 5; + pri_addr |= (pens[4] >> 11) << 8; + pri_addr |= (pens[0] >> 11) << 11; + pri_addr |= (pens[3] >> 11) << 14; + + *dest++ = pens[pri2layer[BURN_ENDIAN_SWAP_INT16(pri_ram[pri_addr & 0x7fff]) & 7]] & 0x7ff; + } + } +} + +static void DrvPaletteRecalc() +{ + UINT16 *p = (UINT16*)DrvPalRAM; + + for (INT32 i = 0; i < 0x1000 / 2; i++) { + INT32 r = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 0) & 0x0f; + INT32 g = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 4) & 0x0f; + INT32 b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 8) & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } + + DrvPalette[0x0800] = BurnHighCol(0xff, 0xff, 0xff, 0); // white +} + +static INT32 DrvDraw() +{ + DrvPaletteRecalc(); + + if (lordgun_whitescreen) { + for (INT32 o = 0; o < nScreenWidth * nScreenHeight; o++) { + pTransDraw[o] = 0x800; // white!! + } + + BurnTransferCopy(DrvPalette); + return 0; + } + + for (INT32 o = 0; o < nScreenWidth * nScreenHeight; o++) { + draw_bitmap[0][o] = draw_bitmap[1][o] = draw_bitmap[2][o] = draw_bitmap[3][o] = draw_bitmap[4][o] = 0x003f; + } + + INT32 line_enable = 0; + { + UINT16 *rs = (UINT16*)DrvScrRAM; + for (INT32 i = 0; i < nScreenHeight * 2; i+=2) { + if ((BURN_ENDIAN_SWAP_INT16(rs[i + 1]) & 0x7ff) != (BURN_ENDIAN_SWAP_INT16(rs[1]) & 0x7ff)) { + line_enable = 1; + break; + } + } + } + + draw_layer(DrvVidRAM0, DrvGfxROM0, 8, 0x100, 0x040, 0x500, 0x03, 0); + if (line_enable == 0) { + draw_layer(DrvVidRAM1, DrvGfxROM1, 16, 0x080, 0x020, 0x600, 0x07, 1); + } else { + draw_layer_linescroll(); + } + draw_layer(DrvVidRAM2, DrvGfxROM2, 32, 0x040, 0x010, 0x700, 0x03, 2); + draw_layer(DrvVidRAM3, DrvGfxROM0, 8, 0x040, 0x020, 0x400, 0x0f, 3); + draw_sprites(); + + copy_layers(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 lordgunDraw() +{ + DrvDraw(); + + for (INT32 i = 0; i < BurnDrvGetMaxPlayers(); i++) { + BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); + } + + return 0; +} + +static inline void compile_inputs() +{ + memset (DrvInputs, 0xff, 5 * sizeof(INT16)); + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + } + + BurnGunMakeInputs(0, (INT16)DrvAxis[0], (INT16)DrvAxis[1]); + BurnGunMakeInputs(1, (INT16)DrvAxis[2], (INT16)DrvAxis[3]); + + float x0 = ((float)((BurnGunX[0] >> 8) + 8)) / 448 * 412; + float y0 = ((float)((BurnGunY[0] >> 8) + 8)) / 224 * 224; + float x1 = ((float)((BurnGunX[1] >> 8) + 8)) / 448 * 412; + float y1 = ((float)((BurnGunY[1] >> 8) + 8)) / 224 * 224; + DrvAnalogInput[0] = (UINT16)x0 + 0x3c; + DrvAnalogInput[2] = (UINT8)y0 + 0; + DrvAnalogInput[1] = (UINT16)x1 + 0x3c; + DrvAnalogInput[3] = (UINT8)y1 + 0; +} + +static INT32 lordgunFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + compile_inputs(); + + SekNewFrame(); + ZetNewFrame(); + + INT32 nTotalCycles[2] = { 10000000 / 60, 5000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + INT32 nInterleave = 50; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + nCurrentCPU = 0; + nNext = (i + 1) * nTotalCycles[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + BurnTimerUpdateYM3812(i * (nTotalCycles[1] / nInterleave)); + } + + BurnTimerEndFrameYM3812(nTotalCycles[1]); + + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + lordgunDraw(); + } + + return 0; +} + +static INT32 alienchaFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + compile_inputs(); + + SekNewFrame(); + ZetNewFrame(); + + INT32 nInterleave = 1000; + + INT32 nCyclesTotal[2] = { 10000000 / 60, 5000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + } + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYMF278BUpdate(nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029708; + } + + if (nAction & ACB_VOLATILE) { + + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All RAM"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYMF278BScan(nAction, pnMin); + + BurnGunScan(); + EEPROMScan(nAction, pnMin); + + SCAN_VAR(aliencha_dip_sel); + SCAN_VAR(lordgun_whitescreen); + + SCAN_VAR(lordgun_gun_hw_x[0]); + SCAN_VAR(lordgun_gun_hw_y[0]); + SCAN_VAR(lordgun_gun_hw_x[1]); + SCAN_VAR(lordgun_gun_hw_y[1]); + } + + if (nAction & ACB_WRITE) { + INT32 bank = *okibank; + *okibank = -1; + set_oki_bank(bank); + } + + return 0; +} + + +// Lord of Gun (USA) + +static struct BurnRomInfo lordgunRomDesc[] = { + { "lordgun.10", 0x080000, 0xacda77ef, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "lordgun.4", 0x080000, 0xa1a61254, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "lordgun.90", 0x010000, 0xd59b5e28, 2 | BRF_PRG | BRF_ESS }, // 2 z80 code + + { "igst001.108", 0x100000, 0x36dd96f3, 3 | BRF_GRA }, // 3 8x8 tiles + { "igst002.114", 0x100000, 0x816a7665, 3 | BRF_GRA }, // 4 + { "igst003.119", 0x100000, 0xcbfee543, 3 | BRF_GRA }, // 5 + + { "igsb001.82", 0x200000, 0x3096de1c, 4 | BRF_GRA }, // 6 16x16 and 32x32 tiles + { "igsb002.91", 0x200000, 0x2234531e, 4 | BRF_GRA }, // 7 + { "igsb003.97", 0x200000, 0x6cbf21ac, 4 | BRF_GRA }, // 8 + + { "igsa001.14", 0x200000, 0x400abe33, 5 | BRF_GRA }, // 9 Sprites + { "igsa004.13", 0x200000, 0x52687264, 5 | BRF_GRA }, // 10 + { "igsa002.9", 0x200000, 0xa4810e38, 5 | BRF_GRA }, // 11 + { "igsa005.8", 0x200000, 0xe32e79e3, 5 | BRF_GRA }, // 12 + { "igsa003.3", 0x200000, 0x649e48d9, 5 | BRF_GRA }, // 13 + { "igsa006.2", 0x200000, 0x39288eb6, 5 | BRF_GRA }, // 14 + + { "lordgun.100", 0x080000, 0xb4e0fa07, 6 | BRF_SND }, // 15 OKI #0 Samples +}; + +STD_ROM_PICK(lordgun) +STD_ROM_FN(lordgun) + +static INT32 lordgunInit() +{ + return DrvInit(lordgunLoadRoms, 1); +} + +struct BurnDriver BurnDrvLordgun = { + "lordgun", NULL, NULL, NULL, "1994", + "Lord of Gun (USA)\0", "Imperfect graphics and sound", "IGS", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0, + NULL, lordgunRomInfo, lordgunRomName, NULL, NULL, LordgunInputInfo, LordgunDIPInfo, + lordgunInit, DrvExit, lordgunFrame, lordgunDraw, DrvScan, &DrvRecalc, 0x800, + 448, 224, 4, 3 +}; + +// Alien Challenge (World) + +static struct BurnRomInfo alienchaRomDesc[] = { + { "igsc0102.u81", 0x200000, 0xe3432be3, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + + { "hfh_s.u86", 0x010000, 0x5728a9ed, 2 | BRF_PRG | BRF_ESS }, // 1 z80 code + + { "igst0101.u9", 0x100000, 0x2ce12d7b, 3 | BRF_GRA }, // 2 8x8 tiles + { "igst0102.u10", 0x100000, 0x542a76a0, 3 | BRF_GRA }, // 3 + { "igst0103.u11", 0x100000, 0xadf5698a, 3 | BRF_GRA }, // 4 + + { "igsb0101.u8", 0x200000, 0x5c995f7e, 4 | BRF_GRA }, // 5 16x16 and 32x32 tiles + { "igsb0102.u7", 0x200000, 0xa2ae9baf, 4 | BRF_GRA }, // 6 + { "igsb0103.u6", 0x200000, 0x11b927af, 4 | BRF_GRA }, // 7 + + { "igsa0101.u3", 0x400000, 0x374d07c4, 5 | BRF_GRA }, // 8 Sprites + { "igsa0102.u2", 0x400000, 0xdbeee7ac, 5 | BRF_GRA }, // 9 + { "igsa0103.u1", 0x400000, 0xe5f19041, 5 | BRF_GRA }, // 10 + + { "hfh_g.u65", 0x040000, 0xec469b57, 6 | BRF_SND }, // 11 OKI #0 Samples + + { "hfh_g.u66", 0x040000, 0x7cfcd98e, 7 | BRF_SND }, // 12 OKI #1 Samples + + { "yrw801-m", 0x200000, 0x2a9d8d43, 8 | BRF_SND }, // 13 YMF278b Samples +}; + +STD_ROM_PICK(aliencha) +STD_ROM_FN(aliencha) + +static INT32 alienchaInit() +{ + return DrvInit(alienchaLoadRoms, 0); +} + +struct BurnDriver BurnDrvAliencha = { + "aliencha", NULL, NULL, NULL, "1994", + "Alien Challenge (World)\0", "Imperfect sound", "IGS", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, alienchaRomInfo, alienchaRomName, NULL, NULL, AlienchaInputInfo, AlienchaDIPInfo, + alienchaInit, DrvExit, alienchaFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 448, 224, 4, 3 +}; + + +// Alien Challenge (China) + +static struct BurnRomInfo alienchacRomDesc[] = { + { "igsc0102.u81", 0x200000, 0xe3432be3, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "hfh_p.u80", 0x080000, 0x5175ebdc, 1 | BRF_PRG | BRF_ESS }, // 1 + { "hfh_p.u79", 0x080000, 0x42ad978c, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "hfh_s.u86", 0x010000, 0x5728a9ed, 2 | BRF_PRG | BRF_ESS }, // 3 z80 code + + { "igst0101.u9", 0x100000, 0x2ce12d7b, 3 | BRF_GRA }, // 4 8x8 tiles + { "igst0102.u10", 0x100000, 0x542a76a0, 3 | BRF_GRA }, // 5 + { "igst0103.u11", 0x100000, 0xadf5698a, 3 | BRF_GRA }, // 6 + + { "igsb0101.u8", 0x200000, 0x5c995f7e, 4 | BRF_GRA }, // 7 16x16 and 32x32 tiles + { "igsb0102.u7", 0x200000, 0xa2ae9baf, 4 | BRF_GRA }, // 8 + { "igsb0103.u6", 0x200000, 0x11b927af, 4 | BRF_GRA }, // 9 + + { "igsa0101.u3", 0x400000, 0x374d07c4, 5 | BRF_GRA }, // 10 Sprites + { "igsa0102.u2", 0x400000, 0xdbeee7ac, 5 | BRF_GRA }, // 11 + { "igsa0103.u1", 0x400000, 0xe5f19041, 5 | BRF_GRA }, // 12 + + { "hfh_g.u65", 0x040000, 0xec469b57, 6 | BRF_SND }, // 11 OKI #0 Samples + + { "hfh_g.u66", 0x040000, 0x7cfcd98e, 7 | BRF_SND }, // 12 OKI #1 Samples + + { "yrw801-m", 0x200000, 0x2a9d8d43, 8 | BRF_SND }, // 13 YMF278b Samples +}; + +STD_ROM_PICK(alienchac) +STD_ROM_FN(alienchac) + +static INT32 alienchacInit() +{ + return DrvInit(alienchacLoadRoms, 0); +} + +struct BurnDriver BurnDrvAlienchac = { + "alienchac", "aliencha", NULL, NULL, "1994", + "Alien Challenge (China)\0", "Imperfect sound", "IGS", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, alienchacRomInfo, alienchacRomName, NULL, NULL, AlienchaInputInfo, AlienchacDIPInfo, + alienchacInit, DrvExit, alienchaFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 448, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_mcatadv.cpp b/src/burn/drv/pst90s/d_mcatadv.cpp index b6b093b18..1afa01f90 100644 --- a/src/burn/drv/pst90s/d_mcatadv.cpp +++ b/src/burn/drv/pst90s/d_mcatadv.cpp @@ -1,1186 +1,1185 @@ -// FB Alpha Face "LINDA" hardware driver module -// Based on MAME driver by Paul Priest and David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2610.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvSndROM; -static UINT8 *DrvVidRAM0; -static UINT8 *DrvVidRAM1; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf; -static UINT8 *DrvPalRAM; -static UINT32 *DrvPalette; - -static UINT8 *DrvPrioBitmap; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[ 2]; -static UINT16 DrvInputs[2]; -static UINT8 DrvReset; - -static UINT16 *DrvScrollRAM0; -static UINT16 *DrvScrollRAM1; -static UINT16 *DrvVidRegs; -static UINT16 *DrvVidRegBuf; - -static UINT8 *nDrvZ80Bank; -static UINT8 *soundlatch; -static UINT8 *soundlatch2; - -static INT32 nCyclesTotal[2]; -static INT32 nCyclesDone[2]; -static INT32 watchdog; - -static INT32 nGame; - -static struct BurnInputInfo McatadvInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Mcatadv) - -static struct BurnDIPInfo McatadvDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x01, 0x00, "Off" }, - {0x13, 0x01, 0x01, 0x01, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x13, 0x01, 0x02, 0x02, "Off" }, -// {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x13, 0x01, 0x08, 0x08, "Mode 1" }, - {0x13, 0x01, 0x08, 0x00, "Mode 2" }, - - {0 , 0xfe, 0 , 7, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits " }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits " }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits " }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits " }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits " }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits " }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 4 Credits " }, - - {0 , 0xfe, 0 , 7, "Coin B" }, - {0x13, 0x01, 0xc0, 0x00, "4 Coins 1 Credits " }, - {0x13, 0x01, 0xc0, 0x40, "3 Coins 1 Credits " }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits " }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits " }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits " }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits " }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 4 Credits " }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Normal" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x0c, 0x04, "2" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Energy" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - {0x14, 0x01, 0x30, 0x00, "8" }, - - {0 , 0xfe, 0 , 3, "Cabinet" }, - {0x14, 0x01, 0xc0, 0x40, "Upright 1 Player" }, - {0x14, 0x01, 0xc0, 0xc0, "Upright 2 Players" }, - {0x14, 0x01, 0xc0, 0x80, "Cocktail" }, -}; - -STDDIPINFO(Mcatadv) - -static struct BurnInputInfo NostInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Nost) - -static struct BurnDIPInfo NostDIPList[]= -{ - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x10, 0x01, 0x03, 0x02, "2" }, - {0x10, 0x01, 0x03, 0x03, "3" }, - {0x10, 0x01, 0x03, 0x01, "4" }, - {0x10, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x10, 0x01, 0x0c, 0x08, "Easy" }, - {0x10, 0x01, 0x0c, 0x0c, "Normal" }, - {0x10, 0x01, 0x0c, 0x04, "Hard" }, - {0x10, 0x01, 0x0c, 0x00, "Hardest" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x10, 0x01, 0x10, 0x10, "Off" }, -// {0x10, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x10, 0x01, 0x20, 0x00, "Off" }, - {0x10, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x10, 0x01, 0xc0, 0x80, "500k 1000k" }, - {0x10, 0x01, 0xc0, 0xc0, "800k 1500k" }, - {0x10, 0x01, 0xc0, 0x40, "1000k 2000k" }, - {0x10, 0x01, 0xc0, 0x00, "None" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x11, 0x01, 0x07, 0x02, "3 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x04, "2 Coins 1 Credits " }, - {0x11, 0x01, 0x07, 0x01, "3 Coins 2 Credits " }, - {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, - {0x11, 0x01, 0x07, 0x03, "2 Coins 3 Credits " }, - {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, - {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, - {0x11, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin_B" }, - {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x10, "3 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x20, "2 Coins 1 Credits " }, - {0x11, 0x01, 0x38, 0x08, "3 Coins 2 Credits " }, - {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits " }, - {0x11, 0x01, 0x38, 0x18, "2 Coins 3 Credits " }, - {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits " }, - {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits " }, -}; - -STDDIPINFO(Nost) - -static inline void mcatadv_z80_sync() -{ -#if 0 - float nCycles = SekTotalCycles() * 1.0000; - nCycles /= nCyclesTotal[0]; - nCycles *= nCyclesTotal[1]; - nCycles -= nCyclesDone[1]; - if (nCycles > 0) { - nCyclesDone[1] += ZetRun((INT32)nCycles); - } -#endif -} - -static inline void palette_write(INT32 offset) -{ - UINT8 r,g,b; - UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset))); - - r = (data >> 5) & 0x1f; - r = (r << 3) | (r >> 2); - - g = (data >> 10) & 0x1f; - g = (g << 3) | (g >> 2); - - b = (data >> 0) & 0x1f; - b = (b << 3) | (b >> 2); - - DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); -} - -void __fastcall mcatadv_write_byte(UINT32 /*address*/, UINT8 /*data*/) -{ - -} - -void __fastcall mcatadv_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x200000: - case 0x200002: - case 0x200004: - DrvScrollRAM0[(address & 6) >> 1] = data; - return; - - case 0x300000: - case 0x300002: - case 0x300004: - DrvScrollRAM1[(address & 6) >> 1] = data; - return; - - case 0xb00000: - case 0xb00002: - case 0xb00004: - case 0xb00006: - case 0xb00008: - case 0xb0000a: - case 0xb0000c: - case 0xb0000e: - DrvVidRegs[(address & 0x0e) >> 1] = data; - return; - - case 0xb00018: - watchdog = 0; - return; - - case 0xc00000: - { - mcatadv_z80_sync(); - - *soundlatch = data; - ZetNmi(); - } - return; - } -} - -UINT8 __fastcall mcatadv_read_byte(UINT32 address) -{ - switch (address) - { - case 0x800000: - return DrvInputs[0] >> 8; - - case 0x800001: - return DrvInputs[0] & 0xff; - - case 0x800002: - return DrvInputs[1] >> 8; - - case 0x800003: - return DrvInputs[1] & 0xff; - } - - return 0; -} - -UINT16 __fastcall mcatadv_read_word(UINT32 address) -{ - switch (address) - { - case 0x800000: - return DrvInputs[0]; - - case 0x800002: - return DrvInputs[1]; - - case 0xa00000: - return (DrvDips[0] << 8) | 0x00ff; - - case 0xa00002: - return (DrvDips[1] << 8) | 0x00ff; - - case 0xb0001e: - watchdog = 0; - return 0x0c00; - - case 0xc00000: - mcatadv_z80_sync(); - return *soundlatch2; - } - - return 0; -} - -static void sound_bankswitch(INT32 data) -{ - *nDrvZ80Bank = data; - - ZetMapArea(0x4000 << nGame, 0xbfff, 0, DrvZ80ROM + (data * 0x4000)); - ZetMapArea(0x4000 << nGame, 0xbfff, 2, DrvZ80ROM + (data * 0x4000)); -} - -void __fastcall mcatadv_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe000: - case 0xe001: - case 0xe002: - case 0xe003: - BurnYM2610Write(address & 3, data); - return; - - case 0xf000: - sound_bankswitch(data); - return; - } -} - -UINT8 __fastcall mcatadv_sound_read(UINT16 address) -{ - switch (address) - { - case 0xe000: - case 0xe002: - return BurnYM2610Read(address & 2); - } - - return 0; -} - -void __fastcall mcatadv_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - BurnYM2610Write(port & 3, data); - return; - - case 0x40: - sound_bankswitch(data); - return; - - case 0x80: - *soundlatch2 = data; - return; - } -} - -UINT8 __fastcall mcatadv_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x04: - case 0x05: - case 0x06: - case 0x07: - return BurnYM2610Read(port & 3); - - case 0x80: - return *soundlatch; - } - - return 0; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000.0; -} - -static INT32 DrvGfxDecode() -{ - static INT32 Planes[4] = { 0, 1, 2, 3 }; - static INT32 XOffs[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; - static INT32 YOffs[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x280000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM1, 0x180000); - - GfxDecode(0x3000, 4, 16, 16, Planes, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x280000); - - GfxDecode(0x5000, 4, 16, 16, Planes, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); - - BurnFree (tmp); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x100000; - DrvZ80ROM = Next; Next += 0x040000; - - DrvGfxROM0 = Next; Next += 0x600000; - DrvGfxROM1 = Next; Next += 0x300000; - DrvGfxROM2 = Next; Next += 0x500000; - - DrvSndROM = Next; Next += 0x100000; - - DrvPalette = (UINT32*)Next; Next += 0x1001 * sizeof(UINT32); - - DrvPrioBitmap = Next; Next += 320 * 224; - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvZ80RAM = Next; Next += 0x002000; - - DrvVidRAM0 = Next; Next += 0x002000; - DrvVidRAM1 = Next; Next += 0x002000; - DrvPalRAM = Next; Next += 0x003000; - DrvSprRAM = Next; Next += 0x010000; - DrvSprBuf = Next; Next += 0x008000; - - DrvScrollRAM0 = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); - DrvScrollRAM1 = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); - DrvVidRegs = (UINT16*)Next; Next += 0x000008 * sizeof(UINT16); - DrvVidRegBuf = (UINT16*)Next; Next += 0x000008 * sizeof(UINT16); - - nDrvZ80Bank = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - soundlatch2 = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - sound_bankswitch(1); - ZetClose(); - - BurnYM2610Reset(); - - watchdog = 0; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200001, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x400000, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x400001, 8, 2)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 13, 1)) return 1; - - if (DrvZ80ROM[0x20000]) // Nostradamus - { - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 10, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x100000, 12, 1)) return 1; - - nGame = 1; - } - else - { - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x100000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x200000, 12, 1)) return 1; - - nGame = 0; - } - } - - DrvGfxDecode(); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x400000, 0x401fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x500000, 0x501fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x600000, 0x602fff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x700000, 0x70ffff, SM_RAM); - SekSetWriteByteHandler(0, mcatadv_write_byte); - SekSetWriteWordHandler(0, mcatadv_write_word); - SekSetReadByteHandler(0, mcatadv_read_byte); - SekSetReadWordHandler(0, mcatadv_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM); - ZetSetWriteHandler(mcatadv_sound_write); - ZetSetReadHandler(mcatadv_sound_read); - ZetSetInHandler(mcatadv_sound_in); - ZetSetOutHandler(mcatadv_sound_out); - ZetMemEnd(); - ZetClose(); - - INT32 DrvSndROMLen = nGame ? 0x100000 : 0x80000; - BurnYM2610Init(8000000, DrvSndROM, &DrvSndROMLen, DrvSndROM, &DrvSndROMLen, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 2.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 2.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 1.28, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - SekExit(); - ZetExit(); - BurnYM2610Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_sprites() -{ - UINT16 *source = (UINT16*)DrvSprBuf; - UINT16 *vidregram = DrvVidRegs; - UINT16 *vidregbuf = DrvVidRegBuf; - UINT16 *finish = source + 0x2000-4; - UINT8 *prio = DrvPrioBitmap; - INT32 global_x = vidregram[0]-0x184; - INT32 global_y = vidregram[1]-0x1f1; - - UINT16 *destline; - - INT32 xstart, xend, xinc; - INT32 ystart, yend, yinc; - - if (BURN_ENDIAN_SWAP_INT16(vidregbuf[2]) == 0x0001) - { - source += 0x2000; - finish += 0x2000; - } - - while (source < finish) - { - INT32 attr = BURN_ENDIAN_SWAP_INT16(source[0]); - INT32 pri = attr >> 14; - INT32 pen = (attr & 0x3f00) >> 4; - INT32 tileno = BURN_ENDIAN_SWAP_INT16(source[1]); - INT32 x = BURN_ENDIAN_SWAP_INT16(source[2]) & 0x03ff; - INT32 y = BURN_ENDIAN_SWAP_INT16(source[3]) & 0x03ff; - INT32 flipy = attr & 0x0040; - INT32 flipx = attr & 0x0080; - - INT32 height = (BURN_ENDIAN_SWAP_INT16(source[3]) & 0xf000) >> 8; - INT32 width = (BURN_ENDIAN_SWAP_INT16(source[2]) & 0xf000) >> 8; - INT32 offset = tileno << 8; - - UINT8 *sprdata = DrvGfxROM0; - - INT32 drawxpos, drawypos; - INT32 xcnt,ycnt; - INT32 pix; - - if (x & 0x200) x-=0x400; - if (y & 0x200) y-=0x400; - - if (BURN_ENDIAN_SWAP_INT16(source[3]) != BURN_ENDIAN_SWAP_INT16(source[0])) - { - if(!flipx) { xstart = 0; xend = width; xinc = 1; } - else { xstart = width-1; xend = -1; xinc = -1; } - if(!flipy) { ystart = 0; yend = height; yinc = 1; } - else { ystart = height-1; yend = -1; yinc = -1; } - - for (ycnt = ystart; ycnt != yend; ycnt += yinc) { - drawypos = y+ycnt-global_y; - - if ((drawypos >= 0) && (drawypos < 224)) { - destline = pTransDraw + drawypos * 320; - prio = DrvPrioBitmap + drawypos * 320; - - for (xcnt = xstart; xcnt != xend; xcnt += xinc) { - drawxpos = x+xcnt-global_x; - - if (drawxpos >= 0 && drawxpos < 320) { - if (prio[drawxpos] < pri) { - if (offset >= 0xa00000) offset = 0; - pix = sprdata[offset >> 1]; - - if (offset & 1) pix >>= 4; - pix &= 0x0f; - - if (pix && drawxpos >= 0 && drawxpos < 320) destline[drawxpos] = pix | pen; - } - } - - offset++; - } - } else { - offset += width; - } - } - } - source+=4; - } - - return; -} - -static void draw_background(UINT8 *vidramsrc, UINT8 *gfxbase, UINT16 *scroll, INT32 priority, INT32 max_tile) -{ - UINT16 *vidram = (UINT16*)vidramsrc; - UINT16 *dest = pTransDraw; - UINT8 *prio = DrvPrioBitmap; - - INT32 yscroll = ((scroll[1] & 0x1ff) - 0x1df) & 0x1ff; - INT32 xscroll = ((scroll[0] & 0x1ff) - 0x194) & 0x1ff; - - if (~scroll[1] & 0x4000 && ~scroll[0] & 0x4000) { // row by row - yscroll &= 0x1ff; - xscroll &= 0x1ff; - - for (INT32 y = 0; y < 239; y+=16) - { - for (INT32 x = 0; x < 335; x+=16) - { - INT32 sy = y - (yscroll & 0x0f); - INT32 sx = x - (xscroll & 0x0f); - if (sy < -15 || sx < -15 || sy >= nScreenHeight || sx >= nScreenWidth) continue; - - INT32 offs = (((yscroll+y)&0x1f0) << 2) | (((xscroll+x)&0x1f0)>>3); - - if ((BURN_ENDIAN_SWAP_INT16(vidram[offs]) >> 14) != priority) continue; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vidram[offs | 1]); - if (!code || code >= max_tile) continue; - INT32 color = ((BURN_ENDIAN_SWAP_INT16(vidram[offs]) >> 8) & 0x3f) | ((scroll[2] & 3) << 6); - - { - color <<= 4; - - UINT8 *gfx = gfxbase + code * 0x100; - - for (INT32 vy = 0; vy < 16; vy++, sy++, gfx+=16) { - if (sy < 0) continue; - if (sy >= nScreenHeight) break; - - dest = pTransDraw + nScreenWidth * sy; - prio = DrvPrioBitmap + nScreenWidth * sy; - - for (INT32 vx = 0; vx < 16; vx++, sx++) { - if (sx < 0 || sx >= nScreenWidth) continue; - - INT32 pxl = gfx[vx]; - - if (pxl) { - dest[sx] = pxl | color; - prio[sx] = priority; - } - } - - sx -= 16; - } - } - - //Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, gfxbase); - } - } - - return; - } - - for (INT32 y = 0; y < 224; y++, dest += 320, prio += 320) // line by line - { - INT32 scrollx = xscroll; - INT32 scrolly = (yscroll + y) & 0x1ff; - - if (scroll[1] & 0x4000) scrolly = BURN_ENDIAN_SWAP_INT16(vidram[0x0800 + (scrolly * 2) + 1]) & 0x1ff; - if (scroll[0] & 0x4000) scrollx += BURN_ENDIAN_SWAP_INT16(vidram[0x0800 + (scrolly * 2) + 0]); - - INT32 srcy = (scrolly & 0x1ff) >> 4; - INT32 srcx = (scrollx & 0x1ff) >> 4; - - for (INT32 x = 0; x < 336; x+=16) - { - INT32 offs = ((srcy << 5) | ((srcx + (x >> 4)) & 0x1f)) << 1; - - if ((BURN_ENDIAN_SWAP_INT16(vidram[offs]) >> 14) != priority) continue; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vidram[offs | 1]); - if (!code || code >= max_tile) continue; - - INT32 color = ((BURN_ENDIAN_SWAP_INT16(vidram[offs]) >> 4) & 0x3f0) | ((scroll[2] & 3) << 10); - - UINT8 *gfxsrc = gfxbase + (code << 8) + ((scrolly & 0x0f) << 4); - - for (INT32 dx = 0; dx < 16; dx++) - { - INT32 dst = (x + dx) - (scrollx & 0x0f); - if (dst < 0 || dst >= nScreenWidth) continue; - - if (gfxsrc[dx]) { - dest[dst] = color | gfxsrc[dx]; - prio[dst] = priority; - } - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x2000; i+=2) { - palette_write(i); - } - DrvPalette[0x1000] = 0; - } - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x1000; - DrvPrioBitmap[i] = 0; - } - - for (INT32 i = 0; i < 4; i++) - { - draw_background(DrvVidRAM0, DrvGfxROM1, DrvScrollRAM0, i, 0x3000); - draw_background(DrvVidRAM1, DrvGfxROM2, DrvScrollRAM1, i, 0x5000); - } - - draw_sprites(); - - memcpy (DrvSprBuf, DrvSprRAM, 0x08000); - memcpy (DrvVidRegBuf, DrvVidRegs, 0x08 * sizeof(UINT16)); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = DrvInputs[1] = 0xffff; - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - - DrvInputs[0] ^= (nGame << 11); // nostradamus wants bit 11 off - } - - - nCyclesTotal[0] = 16000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - nCyclesDone[1 ] = 0; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - watchdog++; - if (watchdog == 180) { - SekReset(); - ZetReset(); - watchdog = 0; - } - - SekRun(nCyclesTotal[0]); - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029702; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2610Scan(nAction, pnMin); - - SCAN_VAR(nCyclesDone[1]); - SCAN_VAR(watchdog); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - sound_bankswitch(*nDrvZ80Bank); - ZetClose(); - } - - return 0; -} - - -// Magical Cat Adventure - -static struct BurnRomInfo mcatadvRomDesc[] = { - { "mca-u30e", 0x080000, 0xc62fbb65, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "mca-u29e", 0x080000, 0xcf21227c, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "u9.bin", 0x020000, 0xfda05171, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "mca-u82.bin", 0x100000, 0x5f01d746, 3 | BRF_GRA }, // 3 Sprites - { "mca-u83.bin", 0x100000, 0x4e1be5a6, 3 | BRF_GRA }, // 4 - { "mca-u84.bin", 0x080000, 0xdf202790, 3 | BRF_GRA }, // 5 - { "mca-u85.bin", 0x080000, 0xa85771d2, 3 | BRF_GRA }, // 6 - { "mca-u86e", 0x080000, 0x017bf1da, 3 | BRF_GRA }, // 7 - { "mca-u87e", 0x080000, 0xbc9dc9b9, 3 | BRF_GRA }, // 8 - - { "mca-u58.bin", 0x080000, 0x3a8186e2, 4 | BRF_GRA }, // 9 Background Tiles - - { "mca-u60.bin", 0x100000, 0xc8942614, 5 | BRF_GRA }, // 10 Foreground Tiles - { "mca-u61.bin", 0x100000, 0x51af66c9, 5 | BRF_GRA }, // 11 - { "mca-u100", 0x080000, 0xb273f1b0, 5 | BRF_GRA }, // 12 - - { "mca-u53.bin", 0x080000, 0x64c76e05, 6 | BRF_SND }, // 13 YM2610 Samples -}; - -STD_ROM_PICK(mcatadv) -STD_ROM_FN(mcatadv) - -struct BurnDriver BurnDrvMcatadv = { - "mcatadv", NULL, NULL, NULL, "1993", - "Magical Cat Adventure\0", NULL, "Wintechno", "LINDA", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, mcatadvRomInfo, mcatadvRomName, NULL, NULL, McatadvInputInfo, McatadvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, - 320, 224, 4, 3 -}; - - -// Magical Cat Adventure (Japan) - -static struct BurnRomInfo mcatadvjRomDesc[] = { - { "u30.bin", 0x080000, 0x05762f42, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "u29.bin", 0x080000, 0x4c59d648, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "u9.bin", 0x020000, 0xfda05171, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "mca-u82.bin", 0x100000, 0x5f01d746, 3 | BRF_GRA }, // 3 Sprites - { "mca-u83.bin", 0x100000, 0x4e1be5a6, 3 | BRF_GRA }, // 4 - { "mca-u84.bin", 0x080000, 0xdf202790, 3 | BRF_GRA }, // 5 - { "mca-u85.bin", 0x080000, 0xa85771d2, 3 | BRF_GRA }, // 6 - { "u86.bin", 0x080000, 0x2d3725ed, 3 | BRF_GRA }, // 7 - { "u87.bin", 0x080000, 0x4ddefe08, 3 | BRF_GRA }, // 8 - - { "mca-u58.bin", 0x080000, 0x3a8186e2, 4 | BRF_GRA }, // 9 Background Tiles - - { "mca-u60.bin", 0x100000, 0xc8942614, 5 | BRF_GRA }, // 10 Foreground Tiles - { "mca-u61.bin", 0x100000, 0x51af66c9, 5 | BRF_GRA }, // 11 - { "u100.bin", 0x080000, 0xe2c311da, 5 | BRF_GRA }, // 12 - - { "mca-u53.bin", 0x080000, 0x64c76e05, 6 | BRF_SND }, // 13 YM2610 Samples -}; - -STD_ROM_PICK(mcatadvj) -STD_ROM_FN(mcatadvj) - -struct BurnDriver BurnDrvMcatadvj = { - "mcatadvj", "mcatadv", NULL, NULL, "1993", - "Magical Cat Adventure (Japan)\0", NULL, "Wintechno", "LINDA", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, mcatadvjRomInfo, mcatadvjRomName, NULL, NULL, McatadvInputInfo, McatadvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, - 320, 224, 4, 3 -}; - - -// Catt (Japan) - -static struct BurnRomInfo cattRomDesc[] = { - { "catt-u30.bin", 0x080000, 0x8c921e1e, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "catt-u29.bin", 0x080000, 0xe725af6d, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "u9.bin", 0x020000, 0xfda05171, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "mca-u82.bin", 0x100000, 0x5f01d746, 3 | BRF_GRA }, // 3 Sprites - { "mca-u83.bin", 0x100000, 0x4e1be5a6, 3 | BRF_GRA }, // 4 - { "u84.bin", 0x100000, 0x843fd624, 3 | BRF_GRA }, // 5 - { "u85.bin", 0x100000, 0x5ee7b628, 3 | BRF_GRA }, // 6 - { "mca-u86e", 0x080000, 0x017bf1da, 3 | BRF_GRA }, // 7 - { "mca-u87e", 0x080000, 0xbc9dc9b9, 3 | BRF_GRA }, // 8 - - { "u58.bin", 0x100000, 0x73c9343a, 4 | BRF_GRA }, // 9 Background Tiles - - { "mca-u60.bin", 0x100000, 0xc8942614, 5 | BRF_GRA }, // 10 Foreground Tiles - { "mca-u61.bin", 0x100000, 0x51af66c9, 5 | BRF_GRA }, // 11 - { "mca-u100", 0x080000, 0xb273f1b0, 5 | BRF_GRA }, // 12 - - { "u53.bin", 0x100000, 0x99f2a624, 6 | BRF_SND }, // 13 YM2610 Samples - - { "peel18cv8.u1", 0x000155, 0x00000000, 7 | BRF_NODUMP | BRF_OPT }, // 14 plds - { "gal16v8a.u10", 0x000117, 0x00000000, 7 | BRF_NODUMP | BRF_OPT }, // 15 -}; - -STD_ROM_PICK(catt) -STD_ROM_FN(catt) - -struct BurnDriver BurnDrvCatt = { - "catt", "mcatadv", NULL, NULL, "1993", - "Catt (Japan)\0", NULL, "Wintechno", "LINDA", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, cattRomInfo, cattRomName, NULL, NULL, McatadvInputInfo, McatadvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, - 320, 224, 4, 3 -}; - - -// Nostradamus - -static struct BurnRomInfo nostRomDesc[] = { - { "nos-pe-u.bin", 0x080000, 0x4b080149, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "nos-po-u.bin", 0x080000, 0x9e3cd6d9, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "nos-ps.u9", 0x040000, 0x832551e9, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "nos-se-0.u82", 0x100000, 0x9d99108d, 3 | BRF_GRA }, // 3 Sprites - { "nos-so-0.u83", 0x100000, 0x7df0fc7e, 3 | BRF_GRA }, // 4 - { "nos-se-1.u84", 0x100000, 0xaad07607, 3 | BRF_GRA }, // 5 - { "nos-so-1.u85", 0x100000, 0x83d0012c, 3 | BRF_GRA }, // 6 - { "nos-se-2.u86", 0x080000, 0xd99e6005, 3 | BRF_GRA }, // 7 - { "nos-so-2.u87", 0x080000, 0xf60e8ef3, 3 | BRF_GRA }, // 8 - - { "nos-b0-0.u58", 0x100000, 0x0214b0f2, 4 | BRF_GRA }, // 9 Background Tiles - { "nos-b0-1.u59", 0x080000, 0x3f8b6b34, 4 | BRF_GRA }, // 10 - - { "nos-b1-0.u60", 0x100000, 0xba6fd0c7, 5 | BRF_GRA }, // 11 Foreground Tiles - { "nos-b1-1.u61", 0x080000, 0xdabd8009, 5 | BRF_GRA }, // 12 - - { "nossn-00.u53", 0x100000, 0x3bd1bcbc, 6 | BRF_SND }, // 13 YM2610 Samples -}; - -STD_ROM_PICK(nost) -STD_ROM_FN(nost) - -static void NostPatch() -{ - // Can also be fixed overclocking the z80 to 4250000 and enabling - // z80 sync, but is slow and breaks sound in Mcatadv. - *((UINT16*)(Drv68KROM + 0x000122)) = BURN_ENDIAN_SWAP_INT16(0x0146); // Skip ROM Check -} - -static INT32 NostInit() -{ - INT32 nRet = DrvInit(); - - if (nRet == 0) { - NostPatch(); - } - - return nRet; -} - -struct BurnDriver BurnDrvNost = { - "nost", NULL, NULL, NULL, "1993", - "Nostradamus\0", NULL, "Face", "LINDA", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, nostRomInfo, nostRomName, NULL, NULL, NostInputInfo, NostDIPInfo, - NostInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, - 224, 320, 3, 4 -}; - - -// Nostradamus (Japan) - -static struct BurnRomInfo nostjRomDesc[] = { - { "nos-pe-j.u30", 0x080000, 0x4b080149, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "nos-po-j.u29", 0x080000, 0x7fe241de, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "nos-ps.u9", 0x040000, 0x832551e9, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "nos-se-0.u82", 0x100000, 0x9d99108d, 3 | BRF_GRA }, // 3 Sprites - { "nos-so-0.u83", 0x100000, 0x7df0fc7e, 3 | BRF_GRA }, // 4 - { "nos-se-1.u84", 0x100000, 0xaad07607, 3 | BRF_GRA }, // 5 - { "nos-so-1.u85", 0x100000, 0x83d0012c, 3 | BRF_GRA }, // 6 - { "nos-se-2.u86", 0x080000, 0xd99e6005, 3 | BRF_GRA }, // 7 - { "nos-so-2.u87", 0x080000, 0xf60e8ef3, 3 | BRF_GRA }, // 8 - - { "nos-b0-0.u58", 0x100000, 0x0214b0f2, 4 | BRF_GRA }, // 9 Background Tiles - { "nos-b0-1.u59", 0x080000, 0x3f8b6b34, 4 | BRF_GRA }, // 10 - - { "nos-b1-0.u60", 0x100000, 0xba6fd0c7, 5 | BRF_GRA }, // 11 Foreground Tiles - { "nos-b1-1.u61", 0x080000, 0xdabd8009, 5 | BRF_GRA }, // 12 - - { "nossn-00.u53", 0x100000, 0x3bd1bcbc, 6 | BRF_SND }, // 13 YM2610 Samples -}; - -STD_ROM_PICK(nostj) -STD_ROM_FN(nostj) - -struct BurnDriver BurnDrvNostj = { - "nostj", "nost", NULL, NULL, "1993", - "Nostradamus (Japan)\0", NULL, "Face", "LINDA", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, nostjRomInfo, nostjRomName, NULL, NULL, NostInputInfo, NostDIPInfo, - NostInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, - 224, 320, 3, 4 -}; - - -// Nostradamus (Korea) - -static struct BurnRomInfo nostkRomDesc[] = { - { "nos-pe-t.u30", 0x080000, 0xbee5fbc8, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "nos-po-t.u29", 0x080000, 0xf4736331, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "nos-ps.u9", 0x040000, 0x832551e9, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "nos-se-0.u82", 0x100000, 0x9d99108d, 3 | BRF_GRA }, // 3 Sprites - { "nos-so-0.u83", 0x100000, 0x7df0fc7e, 3 | BRF_GRA }, // 4 - { "nos-se-1.u84", 0x100000, 0xaad07607, 3 | BRF_GRA }, // 5 - { "nos-so-1.u85", 0x100000, 0x83d0012c, 3 | BRF_GRA }, // 6 - { "nos-se-2.u86", 0x080000, 0xd99e6005, 3 | BRF_GRA }, // 7 - { "nos-so-2.u87", 0x080000, 0xf60e8ef3, 3 | BRF_GRA }, // 8 - - { "nos-b0-0.u58", 0x100000, 0x0214b0f2, 4 | BRF_GRA }, // 9 Background Tiles - { "nos-b0-1.u59", 0x080000, 0x3f8b6b34, 4 | BRF_GRA }, // 10 - - { "nos-b1-0.u60", 0x100000, 0xba6fd0c7, 5 | BRF_GRA }, // 11 Foreground Tiles - { "nos-b1-1.u61", 0x080000, 0xdabd8009, 5 | BRF_GRA }, // 12 - - { "nossn-00.u53", 0x100000, 0x3bd1bcbc, 6 | BRF_SND }, // 13 YM2610 Samples -}; - -STD_ROM_PICK(nostk) -STD_ROM_FN(nostk) - -struct BurnDriver BurnDrvNostk = { - "nostk", "nost", NULL, NULL, "1993", - "Nostradamus (Korea)\0", NULL, "Face", "LINDA", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, nostkRomInfo, nostkRomName, NULL, NULL, NostInputInfo, NostDIPInfo, - NostInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, - 224, 320, 3, 4 -}; +// FB Alpha Face "LINDA" hardware driver module +// Based on MAME driver by Paul Priest and David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2610.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvSndROM; +static UINT8 *DrvVidRAM0; +static UINT8 *DrvVidRAM1; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf; +static UINT8 *DrvPalRAM; +static UINT32 *DrvPalette; + +static UINT8 *DrvPrioBitmap; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[ 2]; +static UINT16 DrvInputs[2]; +static UINT8 DrvReset; + +static UINT16 *DrvScrollRAM0; +static UINT16 *DrvScrollRAM1; +static UINT16 *DrvVidRegs; +static UINT16 *DrvVidRegBuf; + +static UINT8 *nDrvZ80Bank; +static UINT8 *soundlatch; +static UINT8 *soundlatch2; + +static INT32 nCyclesTotal[2]; +static INT32 nCyclesDone[2]; +static INT32 watchdog; + +static INT32 nGame; + +static struct BurnInputInfo McatadvInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Mcatadv) + +static struct BurnDIPInfo McatadvDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x01, 0x00, "Off" }, + {0x13, 0x01, 0x01, 0x01, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x13, 0x01, 0x02, 0x02, "Off" }, +// {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x13, 0x01, 0x08, 0x08, "Mode 1" }, + {0x13, 0x01, 0x08, 0x00, "Mode 2" }, + + {0 , 0xfe, 0 , 7, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits " }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits " }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits " }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits " }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits " }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits " }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 4 Credits " }, + + {0 , 0xfe, 0 , 7, "Coin B" }, + {0x13, 0x01, 0xc0, 0x00, "4 Coins 1 Credits " }, + {0x13, 0x01, 0xc0, 0x40, "3 Coins 1 Credits " }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits " }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits " }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits " }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits " }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 4 Credits " }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Normal" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x0c, 0x04, "2" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Energy" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + {0x14, 0x01, 0x30, 0x00, "8" }, + + {0 , 0xfe, 0 , 3, "Cabinet" }, + {0x14, 0x01, 0xc0, 0x40, "Upright 1 Player" }, + {0x14, 0x01, 0xc0, 0xc0, "Upright 2 Players" }, + {0x14, 0x01, 0xc0, 0x80, "Cocktail" }, +}; + +STDDIPINFO(Mcatadv) + +static struct BurnInputInfo NostInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 9, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Nost) + +static struct BurnDIPInfo NostDIPList[]= +{ + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x10, 0x01, 0x03, 0x02, "2" }, + {0x10, 0x01, 0x03, 0x03, "3" }, + {0x10, 0x01, 0x03, 0x01, "4" }, + {0x10, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x10, 0x01, 0x0c, 0x08, "Easy" }, + {0x10, 0x01, 0x0c, 0x0c, "Normal" }, + {0x10, 0x01, 0x0c, 0x04, "Hard" }, + {0x10, 0x01, 0x0c, 0x00, "Hardest" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x10, 0x01, 0x10, 0x10, "Off" }, +// {0x10, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x10, 0x01, 0x20, 0x00, "Off" }, + {0x10, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x10, 0x01, 0xc0, 0x80, "500k 1000k" }, + {0x10, 0x01, 0xc0, 0xc0, "800k 1500k" }, + {0x10, 0x01, 0xc0, 0x40, "1000k 2000k" }, + {0x10, 0x01, 0xc0, 0x00, "None" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x11, 0x01, 0x07, 0x02, "3 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x04, "2 Coins 1 Credits " }, + {0x11, 0x01, 0x07, 0x01, "3 Coins 2 Credits " }, + {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits " }, + {0x11, 0x01, 0x07, 0x03, "2 Coins 3 Credits " }, + {0x11, 0x01, 0x07, 0x06, "1 Coin 2 Credits " }, + {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits " }, + {0x11, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin_B" }, + {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x10, "3 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x20, "2 Coins 1 Credits " }, + {0x11, 0x01, 0x38, 0x08, "3 Coins 2 Credits " }, + {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits " }, + {0x11, 0x01, 0x38, 0x18, "2 Coins 3 Credits " }, + {0x11, 0x01, 0x38, 0x30, "1 Coin 2 Credits " }, + {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits " }, +}; + +STDDIPINFO(Nost) + +static inline void mcatadv_z80_sync() +{ +#if 0 + float nCycles = SekTotalCycles() * 1.0000; + nCycles /= nCyclesTotal[0]; + nCycles *= nCyclesTotal[1]; + nCycles -= nCyclesDone[1]; + if (nCycles > 0) { + nCyclesDone[1] += ZetRun((INT32)nCycles); + } +#endif +} + +static inline void palette_write(INT32 offset) +{ + UINT8 r,g,b; + UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset))); + + r = (data >> 5) & 0x1f; + r = (r << 3) | (r >> 2); + + g = (data >> 10) & 0x1f; + g = (g << 3) | (g >> 2); + + b = (data >> 0) & 0x1f; + b = (b << 3) | (b >> 2); + + DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); +} + +void __fastcall mcatadv_write_byte(UINT32 /*address*/, UINT8 /*data*/) +{ + +} + +void __fastcall mcatadv_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x200000: + case 0x200002: + case 0x200004: + DrvScrollRAM0[(address & 6) >> 1] = data; + return; + + case 0x300000: + case 0x300002: + case 0x300004: + DrvScrollRAM1[(address & 6) >> 1] = data; + return; + + case 0xb00000: + case 0xb00002: + case 0xb00004: + case 0xb00006: + case 0xb00008: + case 0xb0000a: + case 0xb0000c: + case 0xb0000e: + DrvVidRegs[(address & 0x0e) >> 1] = data; + return; + + case 0xb00018: + watchdog = 0; + return; + + case 0xc00000: + { + mcatadv_z80_sync(); + + *soundlatch = data; + ZetNmi(); + } + return; + } +} + +UINT8 __fastcall mcatadv_read_byte(UINT32 address) +{ + switch (address) + { + case 0x800000: + return DrvInputs[0] >> 8; + + case 0x800001: + return DrvInputs[0] & 0xff; + + case 0x800002: + return DrvInputs[1] >> 8; + + case 0x800003: + return DrvInputs[1] & 0xff; + } + + return 0; +} + +UINT16 __fastcall mcatadv_read_word(UINT32 address) +{ + switch (address) + { + case 0x800000: + return DrvInputs[0]; + + case 0x800002: + return DrvInputs[1]; + + case 0xa00000: + return (DrvDips[0] << 8) | 0x00ff; + + case 0xa00002: + return (DrvDips[1] << 8) | 0x00ff; + + case 0xb0001e: + watchdog = 0; + return 0x0c00; + + case 0xc00000: + mcatadv_z80_sync(); + return *soundlatch2; + } + + return 0; +} + +static void sound_bankswitch(INT32 data) +{ + *nDrvZ80Bank = data; + + ZetMapArea(0x4000 << nGame, 0xbfff, 0, DrvZ80ROM + (data * 0x4000)); + ZetMapArea(0x4000 << nGame, 0xbfff, 2, DrvZ80ROM + (data * 0x4000)); +} + +void __fastcall mcatadv_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe000: + case 0xe001: + case 0xe002: + case 0xe003: + BurnYM2610Write(address & 3, data); + return; + + case 0xf000: + sound_bankswitch(data); + return; + } +} + +UINT8 __fastcall mcatadv_sound_read(UINT16 address) +{ + switch (address) + { + case 0xe000: + case 0xe002: + return BurnYM2610Read(address & 2); + } + + return 0; +} + +void __fastcall mcatadv_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + BurnYM2610Write(port & 3, data); + return; + + case 0x40: + sound_bankswitch(data); + return; + + case 0x80: + *soundlatch2 = data; + return; + } +} + +UINT8 __fastcall mcatadv_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x04: + case 0x05: + case 0x06: + case 0x07: + return BurnYM2610Read(port & 3); + + case 0x80: + return *soundlatch; + } + + return 0; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000.0; +} + +static INT32 DrvGfxDecode() +{ + static INT32 Planes[4] = { 0, 1, 2, 3 }; + static INT32 XOffs[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 256, 260, 264, 268, 272, 276, 280, 284 }; + static INT32 YOffs[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x280000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM1, 0x180000); + + GfxDecode(0x3000, 4, 16, 16, Planes, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x280000); + + GfxDecode(0x5000, 4, 16, 16, Planes, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); + + BurnFree (tmp); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x100000; + DrvZ80ROM = Next; Next += 0x040000; + + DrvGfxROM0 = Next; Next += 0x600000; + DrvGfxROM1 = Next; Next += 0x300000; + DrvGfxROM2 = Next; Next += 0x500000; + + DrvSndROM = Next; Next += 0x100000; + + DrvPalette = (UINT32*)Next; Next += 0x1001 * sizeof(UINT32); + + DrvPrioBitmap = Next; Next += 320 * 224; + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvZ80RAM = Next; Next += 0x002000; + + DrvVidRAM0 = Next; Next += 0x002000; + DrvVidRAM1 = Next; Next += 0x002000; + DrvPalRAM = Next; Next += 0x003000; + DrvSprRAM = Next; Next += 0x010000; + DrvSprBuf = Next; Next += 0x008000; + + DrvScrollRAM0 = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); + DrvScrollRAM1 = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); + DrvVidRegs = (UINT16*)Next; Next += 0x000008 * sizeof(UINT16); + DrvVidRegBuf = (UINT16*)Next; Next += 0x000008 * sizeof(UINT16); + + nDrvZ80Bank = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + soundlatch2 = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + sound_bankswitch(1); + ZetClose(); + + BurnYM2610Reset(); + + watchdog = 0; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200001, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x400000, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x400001, 8, 2)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 13, 1)) return 1; + + if (DrvZ80ROM[0x20000]) // Nostradamus + { + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 10, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x100000, 12, 1)) return 1; + + nGame = 1; + } + else + { + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x100000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x200000, 12, 1)) return 1; + + nGame = 0; + } + } + + DrvGfxDecode(); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x400000, 0x401fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x500000, 0x501fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x600000, 0x602fff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x700000, 0x70ffff, SM_RAM); + SekSetWriteByteHandler(0, mcatadv_write_byte); + SekSetWriteWordHandler(0, mcatadv_write_word); + SekSetReadByteHandler(0, mcatadv_read_byte); + SekSetReadWordHandler(0, mcatadv_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM); + ZetSetWriteHandler(mcatadv_sound_write); + ZetSetReadHandler(mcatadv_sound_read); + ZetSetInHandler(mcatadv_sound_in); + ZetSetOutHandler(mcatadv_sound_out); + ZetClose(); + + INT32 DrvSndROMLen = nGame ? 0x100000 : 0x80000; + BurnYM2610Init(8000000, DrvSndROM, &DrvSndROMLen, DrvSndROM, &DrvSndROMLen, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 2.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 2.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 1.28, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + SekExit(); + ZetExit(); + BurnYM2610Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_sprites() +{ + UINT16 *source = (UINT16*)DrvSprBuf; + UINT16 *vidregram = DrvVidRegs; + UINT16 *vidregbuf = DrvVidRegBuf; + UINT16 *finish = source + 0x2000-4; + UINT8 *prio = DrvPrioBitmap; + INT32 global_x = vidregram[0]-0x184; + INT32 global_y = vidregram[1]-0x1f1; + + UINT16 *destline; + + INT32 xstart, xend, xinc; + INT32 ystart, yend, yinc; + + if (BURN_ENDIAN_SWAP_INT16(vidregbuf[2]) == 0x0001) + { + source += 0x2000; + finish += 0x2000; + } + + while (source < finish) + { + INT32 attr = BURN_ENDIAN_SWAP_INT16(source[0]); + INT32 pri = attr >> 14; + INT32 pen = (attr & 0x3f00) >> 4; + INT32 tileno = BURN_ENDIAN_SWAP_INT16(source[1]); + INT32 x = BURN_ENDIAN_SWAP_INT16(source[2]) & 0x03ff; + INT32 y = BURN_ENDIAN_SWAP_INT16(source[3]) & 0x03ff; + INT32 flipy = attr & 0x0040; + INT32 flipx = attr & 0x0080; + + INT32 height = (BURN_ENDIAN_SWAP_INT16(source[3]) & 0xf000) >> 8; + INT32 width = (BURN_ENDIAN_SWAP_INT16(source[2]) & 0xf000) >> 8; + INT32 offset = tileno << 8; + + UINT8 *sprdata = DrvGfxROM0; + + INT32 drawxpos, drawypos; + INT32 xcnt,ycnt; + INT32 pix; + + if (x & 0x200) x-=0x400; + if (y & 0x200) y-=0x400; + + if (BURN_ENDIAN_SWAP_INT16(source[3]) != BURN_ENDIAN_SWAP_INT16(source[0])) + { + if(!flipx) { xstart = 0; xend = width; xinc = 1; } + else { xstart = width-1; xend = -1; xinc = -1; } + if(!flipy) { ystart = 0; yend = height; yinc = 1; } + else { ystart = height-1; yend = -1; yinc = -1; } + + for (ycnt = ystart; ycnt != yend; ycnt += yinc) { + drawypos = y+ycnt-global_y; + + if ((drawypos >= 0) && (drawypos < 224)) { + destline = pTransDraw + drawypos * 320; + prio = DrvPrioBitmap + drawypos * 320; + + for (xcnt = xstart; xcnt != xend; xcnt += xinc) { + drawxpos = x+xcnt-global_x; + + if (drawxpos >= 0 && drawxpos < 320) { + if (prio[drawxpos] < pri) { + if (offset >= 0xa00000) offset = 0; + pix = sprdata[offset >> 1]; + + if (offset & 1) pix >>= 4; + pix &= 0x0f; + + if (pix && drawxpos >= 0 && drawxpos < 320) destline[drawxpos] = pix | pen; + } + } + + offset++; + } + } else { + offset += width; + } + } + } + source+=4; + } + + return; +} + +static void draw_background(UINT8 *vidramsrc, UINT8 *gfxbase, UINT16 *scroll, INT32 priority, INT32 max_tile) +{ + UINT16 *vidram = (UINT16*)vidramsrc; + UINT16 *dest = pTransDraw; + UINT8 *prio = DrvPrioBitmap; + + INT32 yscroll = ((scroll[1] & 0x1ff) - 0x1df) & 0x1ff; + INT32 xscroll = ((scroll[0] & 0x1ff) - 0x194) & 0x1ff; + + if (~scroll[1] & 0x4000 && ~scroll[0] & 0x4000) { // row by row + yscroll &= 0x1ff; + xscroll &= 0x1ff; + + for (INT32 y = 0; y < 239; y+=16) + { + for (INT32 x = 0; x < 335; x+=16) + { + INT32 sy = y - (yscroll & 0x0f); + INT32 sx = x - (xscroll & 0x0f); + if (sy < -15 || sx < -15 || sy >= nScreenHeight || sx >= nScreenWidth) continue; + + INT32 offs = (((yscroll+y)&0x1f0) << 2) | (((xscroll+x)&0x1f0)>>3); + + if ((BURN_ENDIAN_SWAP_INT16(vidram[offs]) >> 14) != priority) continue; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vidram[offs | 1]); + if (!code || code >= max_tile) continue; + INT32 color = ((BURN_ENDIAN_SWAP_INT16(vidram[offs]) >> 8) & 0x3f) | ((scroll[2] & 3) << 6); + + { + color <<= 4; + + UINT8 *gfx = gfxbase + code * 0x100; + + for (INT32 vy = 0; vy < 16; vy++, sy++, gfx+=16) { + if (sy < 0) continue; + if (sy >= nScreenHeight) break; + + dest = pTransDraw + nScreenWidth * sy; + prio = DrvPrioBitmap + nScreenWidth * sy; + + for (INT32 vx = 0; vx < 16; vx++, sx++) { + if (sx < 0 || sx >= nScreenWidth) continue; + + INT32 pxl = gfx[vx]; + + if (pxl) { + dest[sx] = pxl | color; + prio[sx] = priority; + } + } + + sx -= 16; + } + } + + //Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, gfxbase); + } + } + + return; + } + + for (INT32 y = 0; y < 224; y++, dest += 320, prio += 320) // line by line + { + INT32 scrollx = xscroll; + INT32 scrolly = (yscroll + y) & 0x1ff; + + if (scroll[1] & 0x4000) scrolly = BURN_ENDIAN_SWAP_INT16(vidram[0x0800 + (scrolly * 2) + 1]) & 0x1ff; + if (scroll[0] & 0x4000) scrollx += BURN_ENDIAN_SWAP_INT16(vidram[0x0800 + (scrolly * 2) + 0]); + + INT32 srcy = (scrolly & 0x1ff) >> 4; + INT32 srcx = (scrollx & 0x1ff) >> 4; + + for (INT32 x = 0; x < 336; x+=16) + { + INT32 offs = ((srcy << 5) | ((srcx + (x >> 4)) & 0x1f)) << 1; + + if ((BURN_ENDIAN_SWAP_INT16(vidram[offs]) >> 14) != priority) continue; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vidram[offs | 1]); + if (!code || code >= max_tile) continue; + + INT32 color = ((BURN_ENDIAN_SWAP_INT16(vidram[offs]) >> 4) & 0x3f0) | ((scroll[2] & 3) << 10); + + UINT8 *gfxsrc = gfxbase + (code << 8) + ((scrolly & 0x0f) << 4); + + for (INT32 dx = 0; dx < 16; dx++) + { + INT32 dst = (x + dx) - (scrollx & 0x0f); + if (dst < 0 || dst >= nScreenWidth) continue; + + if (gfxsrc[dx]) { + dest[dst] = color | gfxsrc[dx]; + prio[dst] = priority; + } + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x2000; i+=2) { + palette_write(i); + } + DrvPalette[0x1000] = 0; + } + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x1000; + DrvPrioBitmap[i] = 0; + } + + for (INT32 i = 0; i < 4; i++) + { + draw_background(DrvVidRAM0, DrvGfxROM1, DrvScrollRAM0, i, 0x3000); + draw_background(DrvVidRAM1, DrvGfxROM2, DrvScrollRAM1, i, 0x5000); + } + + draw_sprites(); + + memcpy (DrvSprBuf, DrvSprRAM, 0x08000); + memcpy (DrvVidRegBuf, DrvVidRegs, 0x08 * sizeof(UINT16)); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = DrvInputs[1] = 0xffff; + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + + DrvInputs[0] ^= (nGame << 11); // nostradamus wants bit 11 off + } + + + nCyclesTotal[0] = 16000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + nCyclesDone[1 ] = 0; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + watchdog++; + if (watchdog == 180) { + SekReset(); + ZetReset(); + watchdog = 0; + } + + SekRun(nCyclesTotal[0]); + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029702; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2610Scan(nAction, pnMin); + + SCAN_VAR(nCyclesDone[1]); + SCAN_VAR(watchdog); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + sound_bankswitch(*nDrvZ80Bank); + ZetClose(); + } + + return 0; +} + + +// Magical Cat Adventure + +static struct BurnRomInfo mcatadvRomDesc[] = { + { "mca-u30e", 0x080000, 0xc62fbb65, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "mca-u29e", 0x080000, 0xcf21227c, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "u9.bin", 0x020000, 0xfda05171, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "mca-u82.bin", 0x100000, 0x5f01d746, 3 | BRF_GRA }, // 3 Sprites + { "mca-u83.bin", 0x100000, 0x4e1be5a6, 3 | BRF_GRA }, // 4 + { "mca-u84.bin", 0x080000, 0xdf202790, 3 | BRF_GRA }, // 5 + { "mca-u85.bin", 0x080000, 0xa85771d2, 3 | BRF_GRA }, // 6 + { "mca-u86e", 0x080000, 0x017bf1da, 3 | BRF_GRA }, // 7 + { "mca-u87e", 0x080000, 0xbc9dc9b9, 3 | BRF_GRA }, // 8 + + { "mca-u58.bin", 0x080000, 0x3a8186e2, 4 | BRF_GRA }, // 9 Background Tiles + + { "mca-u60.bin", 0x100000, 0xc8942614, 5 | BRF_GRA }, // 10 Foreground Tiles + { "mca-u61.bin", 0x100000, 0x51af66c9, 5 | BRF_GRA }, // 11 + { "mca-u100", 0x080000, 0xb273f1b0, 5 | BRF_GRA }, // 12 + + { "mca-u53.bin", 0x080000, 0x64c76e05, 6 | BRF_SND }, // 13 YM2610 Samples +}; + +STD_ROM_PICK(mcatadv) +STD_ROM_FN(mcatadv) + +struct BurnDriver BurnDrvMcatadv = { + "mcatadv", NULL, NULL, NULL, "1993", + "Magical Cat Adventure\0", NULL, "Wintechno", "LINDA", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, mcatadvRomInfo, mcatadvRomName, NULL, NULL, McatadvInputInfo, McatadvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, + 320, 224, 4, 3 +}; + + +// Magical Cat Adventure (Japan) + +static struct BurnRomInfo mcatadvjRomDesc[] = { + { "u30.bin", 0x080000, 0x05762f42, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "u29.bin", 0x080000, 0x4c59d648, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "u9.bin", 0x020000, 0xfda05171, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "mca-u82.bin", 0x100000, 0x5f01d746, 3 | BRF_GRA }, // 3 Sprites + { "mca-u83.bin", 0x100000, 0x4e1be5a6, 3 | BRF_GRA }, // 4 + { "mca-u84.bin", 0x080000, 0xdf202790, 3 | BRF_GRA }, // 5 + { "mca-u85.bin", 0x080000, 0xa85771d2, 3 | BRF_GRA }, // 6 + { "u86.bin", 0x080000, 0x2d3725ed, 3 | BRF_GRA }, // 7 + { "u87.bin", 0x080000, 0x4ddefe08, 3 | BRF_GRA }, // 8 + + { "mca-u58.bin", 0x080000, 0x3a8186e2, 4 | BRF_GRA }, // 9 Background Tiles + + { "mca-u60.bin", 0x100000, 0xc8942614, 5 | BRF_GRA }, // 10 Foreground Tiles + { "mca-u61.bin", 0x100000, 0x51af66c9, 5 | BRF_GRA }, // 11 + { "u100.bin", 0x080000, 0xe2c311da, 5 | BRF_GRA }, // 12 + + { "mca-u53.bin", 0x080000, 0x64c76e05, 6 | BRF_SND }, // 13 YM2610 Samples +}; + +STD_ROM_PICK(mcatadvj) +STD_ROM_FN(mcatadvj) + +struct BurnDriver BurnDrvMcatadvj = { + "mcatadvj", "mcatadv", NULL, NULL, "1993", + "Magical Cat Adventure (Japan)\0", NULL, "Wintechno", "LINDA", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, mcatadvjRomInfo, mcatadvjRomName, NULL, NULL, McatadvInputInfo, McatadvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, + 320, 224, 4, 3 +}; + + +// Catt (Japan) + +static struct BurnRomInfo cattRomDesc[] = { + { "catt-u30.bin", 0x080000, 0x8c921e1e, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "catt-u29.bin", 0x080000, 0xe725af6d, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "u9.bin", 0x020000, 0xfda05171, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "mca-u82.bin", 0x100000, 0x5f01d746, 3 | BRF_GRA }, // 3 Sprites + { "mca-u83.bin", 0x100000, 0x4e1be5a6, 3 | BRF_GRA }, // 4 + { "u84.bin", 0x100000, 0x843fd624, 3 | BRF_GRA }, // 5 + { "u85.bin", 0x100000, 0x5ee7b628, 3 | BRF_GRA }, // 6 + { "mca-u86e", 0x080000, 0x017bf1da, 3 | BRF_GRA }, // 7 + { "mca-u87e", 0x080000, 0xbc9dc9b9, 3 | BRF_GRA }, // 8 + + { "u58.bin", 0x100000, 0x73c9343a, 4 | BRF_GRA }, // 9 Background Tiles + + { "mca-u60.bin", 0x100000, 0xc8942614, 5 | BRF_GRA }, // 10 Foreground Tiles + { "mca-u61.bin", 0x100000, 0x51af66c9, 5 | BRF_GRA }, // 11 + { "mca-u100", 0x080000, 0xb273f1b0, 5 | BRF_GRA }, // 12 + + { "u53.bin", 0x100000, 0x99f2a624, 6 | BRF_SND }, // 13 YM2610 Samples + + { "peel18cv8.u1", 0x000155, 0x00000000, 7 | BRF_NODUMP | BRF_OPT }, // 14 plds + { "gal16v8a.u10", 0x000117, 0x00000000, 7 | BRF_NODUMP | BRF_OPT }, // 15 +}; + +STD_ROM_PICK(catt) +STD_ROM_FN(catt) + +struct BurnDriver BurnDrvCatt = { + "catt", "mcatadv", NULL, NULL, "1993", + "Catt (Japan)\0", NULL, "Wintechno", "LINDA", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, cattRomInfo, cattRomName, NULL, NULL, McatadvInputInfo, McatadvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, + 320, 224, 4, 3 +}; + + +// Nostradamus + +static struct BurnRomInfo nostRomDesc[] = { + { "nos-pe-u.bin", 0x080000, 0x4b080149, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "nos-po-u.bin", 0x080000, 0x9e3cd6d9, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "nos-ps.u9", 0x040000, 0x832551e9, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "nos-se-0.u82", 0x100000, 0x9d99108d, 3 | BRF_GRA }, // 3 Sprites + { "nos-so-0.u83", 0x100000, 0x7df0fc7e, 3 | BRF_GRA }, // 4 + { "nos-se-1.u84", 0x100000, 0xaad07607, 3 | BRF_GRA }, // 5 + { "nos-so-1.u85", 0x100000, 0x83d0012c, 3 | BRF_GRA }, // 6 + { "nos-se-2.u86", 0x080000, 0xd99e6005, 3 | BRF_GRA }, // 7 + { "nos-so-2.u87", 0x080000, 0xf60e8ef3, 3 | BRF_GRA }, // 8 + + { "nos-b0-0.u58", 0x100000, 0x0214b0f2, 4 | BRF_GRA }, // 9 Background Tiles + { "nos-b0-1.u59", 0x080000, 0x3f8b6b34, 4 | BRF_GRA }, // 10 + + { "nos-b1-0.u60", 0x100000, 0xba6fd0c7, 5 | BRF_GRA }, // 11 Foreground Tiles + { "nos-b1-1.u61", 0x080000, 0xdabd8009, 5 | BRF_GRA }, // 12 + + { "nossn-00.u53", 0x100000, 0x3bd1bcbc, 6 | BRF_SND }, // 13 YM2610 Samples +}; + +STD_ROM_PICK(nost) +STD_ROM_FN(nost) + +static void NostPatch() +{ + // Can also be fixed overclocking the z80 to 4250000 and enabling + // z80 sync, but is slow and breaks sound in Mcatadv. + *((UINT16*)(Drv68KROM + 0x000122)) = BURN_ENDIAN_SWAP_INT16(0x0146); // Skip ROM Check +} + +static INT32 NostInit() +{ + INT32 nRet = DrvInit(); + + if (nRet == 0) { + NostPatch(); + } + + return nRet; +} + +struct BurnDriver BurnDrvNost = { + "nost", NULL, NULL, NULL, "1993", + "Nostradamus\0", NULL, "Face", "LINDA", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, nostRomInfo, nostRomName, NULL, NULL, NostInputInfo, NostDIPInfo, + NostInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, + 224, 320, 3, 4 +}; + + +// Nostradamus (Japan) + +static struct BurnRomInfo nostjRomDesc[] = { + { "nos-pe-j.u30", 0x080000, 0x4b080149, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "nos-po-j.u29", 0x080000, 0x7fe241de, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "nos-ps.u9", 0x040000, 0x832551e9, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "nos-se-0.u82", 0x100000, 0x9d99108d, 3 | BRF_GRA }, // 3 Sprites + { "nos-so-0.u83", 0x100000, 0x7df0fc7e, 3 | BRF_GRA }, // 4 + { "nos-se-1.u84", 0x100000, 0xaad07607, 3 | BRF_GRA }, // 5 + { "nos-so-1.u85", 0x100000, 0x83d0012c, 3 | BRF_GRA }, // 6 + { "nos-se-2.u86", 0x080000, 0xd99e6005, 3 | BRF_GRA }, // 7 + { "nos-so-2.u87", 0x080000, 0xf60e8ef3, 3 | BRF_GRA }, // 8 + + { "nos-b0-0.u58", 0x100000, 0x0214b0f2, 4 | BRF_GRA }, // 9 Background Tiles + { "nos-b0-1.u59", 0x080000, 0x3f8b6b34, 4 | BRF_GRA }, // 10 + + { "nos-b1-0.u60", 0x100000, 0xba6fd0c7, 5 | BRF_GRA }, // 11 Foreground Tiles + { "nos-b1-1.u61", 0x080000, 0xdabd8009, 5 | BRF_GRA }, // 12 + + { "nossn-00.u53", 0x100000, 0x3bd1bcbc, 6 | BRF_SND }, // 13 YM2610 Samples +}; + +STD_ROM_PICK(nostj) +STD_ROM_FN(nostj) + +struct BurnDriver BurnDrvNostj = { + "nostj", "nost", NULL, NULL, "1993", + "Nostradamus (Japan)\0", NULL, "Face", "LINDA", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, nostjRomInfo, nostjRomName, NULL, NULL, NostInputInfo, NostDIPInfo, + NostInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, + 224, 320, 3, 4 +}; + + +// Nostradamus (Korea) + +static struct BurnRomInfo nostkRomDesc[] = { + { "nos-pe-t.u30", 0x080000, 0xbee5fbc8, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "nos-po-t.u29", 0x080000, 0xf4736331, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "nos-ps.u9", 0x040000, 0x832551e9, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "nos-se-0.u82", 0x100000, 0x9d99108d, 3 | BRF_GRA }, // 3 Sprites + { "nos-so-0.u83", 0x100000, 0x7df0fc7e, 3 | BRF_GRA }, // 4 + { "nos-se-1.u84", 0x100000, 0xaad07607, 3 | BRF_GRA }, // 5 + { "nos-so-1.u85", 0x100000, 0x83d0012c, 3 | BRF_GRA }, // 6 + { "nos-se-2.u86", 0x080000, 0xd99e6005, 3 | BRF_GRA }, // 7 + { "nos-so-2.u87", 0x080000, 0xf60e8ef3, 3 | BRF_GRA }, // 8 + + { "nos-b0-0.u58", 0x100000, 0x0214b0f2, 4 | BRF_GRA }, // 9 Background Tiles + { "nos-b0-1.u59", 0x080000, 0x3f8b6b34, 4 | BRF_GRA }, // 10 + + { "nos-b1-0.u60", 0x100000, 0xba6fd0c7, 5 | BRF_GRA }, // 11 Foreground Tiles + { "nos-b1-1.u61", 0x080000, 0xdabd8009, 5 | BRF_GRA }, // 12 + + { "nossn-00.u53", 0x100000, 0x3bd1bcbc, 6 | BRF_SND }, // 13 YM2610 Samples +}; + +STD_ROM_PICK(nostk) +STD_ROM_FN(nostk) + +struct BurnDriver BurnDrvNostk = { + "nostk", "nost", NULL, NULL, "1993", + "Nostradamus (Korea)\0", NULL, "Face", "LINDA", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, nostkRomInfo, nostkRomName, NULL, NULL, NostInputInfo, NostDIPInfo, + NostInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1001, + 224, 320, 3, 4 +}; diff --git a/src/burn/drv/pst90s/d_mugsmash.cpp b/src/burn/drv/pst90s/d_mugsmash.cpp index 522f55498..3aca7c191 100644 --- a/src/burn/drv/pst90s/d_mugsmash.cpp +++ b/src/burn/drv/pst90s/d_mugsmash.cpp @@ -1,691 +1,690 @@ -// FB Alpha Mug Smashers driver module -// Based on MAME driver by David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvVidRAM0; -static UINT8 *DrvVidRAM1; -static UINT8 *DrvVidRegs; -static UINT8 *DrvSndRegs; - -static UINT32 *DrvPalette; -static UINT32 *Palette; - -static UINT8 DrvRecalc; - -static INT32 *DrvScrollX; -static INT32 *DrvScrollY; - -static UINT8 DrvReset; -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[4]; -static UINT16 DrvInps[4]; - -static UINT8 *soundlatch; - -static struct BurnInputInfo MugsmashInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 9, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip"}, - {"Dip D", BIT_DIPSWITCH, DrvDips + 3, "dip"}, -}; - -STDINPUTINFO(Mugsmash) - -static struct BurnDIPInfo MugsmashDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xe1, NULL }, - {0x15, 0xff, 0xff, 0xda, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Color Test" }, - {0x13, 0x01, 0x10, 0x10, "Off" }, - {0x13, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Draw SF." }, - {0x13, 0x01, 0x20, 0x20, "Off" }, - {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x14, 0x01, 0x0e, 0x0c, "4 Coins 1 Credits " }, - {0x14, 0x01, 0x0e, 0x0a, "3 Coins 1 Credits " }, - {0x14, 0x01, 0x0e, 0x08, "2 Coins 1 Credits " }, - {0x14, 0x01, 0x0e, 0x00, "1 Coin 1 Credits " }, - {0x14, 0x01, 0x0e, 0x02, "1 Coin 2 Credits " }, - {0x14, 0x01, 0x0e, 0x04, "1 Coin 3 Credits " }, - {0x14, 0x01, 0x0e, 0x06, "1 Coin 4 Credits " }, - {0x14, 0x01, 0x0e, 0x0e, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Allow_Continue" }, - {0x14, 0x01, 0x10, 0x10, "No" }, - {0x14, 0x01, 0x10, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2, "Sound Test" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo_Sounds" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x06, 0x00, "1" }, - {0x15, 0x01, 0x06, 0x02, "2" }, - {0x15, 0x01, 0x06, 0x04, "3" }, - {0x15, 0x01, 0x06, 0x06, "4" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x30, 0x00, "Very_Easy" }, - {0x15, 0x01, 0x30, 0x10, "Easy" }, - {0x15, 0x01, 0x30, 0x20, "Hard" }, - {0x15, 0x01, 0x30, 0x30, "Very_Hard" }, - - {0 , 0xfe, 0 , 2, "Draw Objects" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x16, 0x01, 0x02, 0x02, "Off" }, - {0x16, 0x01, 0x02, 0x00, "On" }, -}; - -STDDIPINFO(Mugsmash) - -UINT8 __fastcall mugsmash_read_byte(UINT32 address) -{ - switch (address) - { - case 0x180000: - case 0x180001: - case 0x180002: - case 0x180003: - case 0x180004: - case 0x180005: - case 0x180006: - case 0x180007: - return DrvInps[(address >> 1) & 3] >> ((~address & 1) << 3); - } - - return 0; -} - -UINT16 __fastcall mugsmash_read_word(UINT32 address) -{ - switch (address) - { - case 0x180000: - case 0x180002: - case 0x180004: - case 0x180006: - return DrvInps[(address >> 1) & 3]; - } - - return 0; -} - -static void palette_write(INT32 offset) -{ - UINT16 data = *((UINT16*)(DrvPalRAM + offset)); - - UINT8 r,g,b; - - r = (data >> 10); - r = (r << 3) | (r >> 2); - - g = (data >> 5); - g = (g << 3) | (r >> 2); - - b = (data >> 0); - b = (b << 3) | (b >> 2); - - Palette[offset >> 1] = (r << 16) | (g << 8) | (b); - DrvPalette[offset >> 1] = BurnHighCol(r, g, b, 0); -} - -void __fastcall mugsmash_write_byte(UINT32 address, UINT8 data) -{ - if (address >= 0x100000 && address <= 0x1005ff) { - DrvPalRAM[address & 0x7ff] = data; - - palette_write(address & 0x7ff); - - return; - } - - switch (address) - { - case 0x0c0000: - case 0x0c0001: - case 0x0c0002: - case 0x0c0003: - case 0x0c0004: - case 0x0c0005: - case 0x0c0006: - case 0x0c0007: - DrvVidRegs[address & 7] = data; - return; - - case 0x140002: - case 0x140003: - ZetNmi(); - case 0x140000: - case 0x140001: - case 0x140004: - case 0x140005: - case 0x140006: - case 0x140007: - DrvSndRegs[address & 7] = data; - return; - } -} - -void __fastcall mugsmash_write_word(UINT32 address, UINT16 data) -{ - if (address >= 0x100000 && address <= 0x1005ff) { - *((UINT16*)(DrvPalRAM + (address & 0x7fe))) = data; - - palette_write(address & 0x7fe); - - return; - } - - switch (address) - { - case 0x0c0000: - *((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data); - DrvScrollX[1] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 4))) + 7; - return; - - case 0x0c0002: - *((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data); - DrvScrollY[1] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 6))) + 12; - return; - - case 0x0c0004: - *((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data); - DrvScrollX[0] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 0))) + 3; - return; - - case 0x0c0006: - *((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data); - DrvScrollY[0] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 2))) + 12; - return; - - case 0x140002: - ZetNmi(); - case 0x140000: - case 0x140004: - case 0x140006: - *((UINT16*)(DrvSndRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data); - return; - } -} - -void __fastcall mugsmash_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8800: - BurnYM2151SelectRegister(data); - return; - - case 0x8801: - BurnYM2151WriteRegister(data); - return; - - case 0x9800: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall mugsmash_sound_read(UINT16 address) -{ - switch (address) - { - case 0x8801: - return BurnYM2151ReadStatus(); - - case 0x9800: - return MSM6295ReadStatus(0); - - case 0xa000: - return *soundlatch; - } - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0, 1, 2, 3 }; - INT32 XOffs0[16] = { 16, 20, 24, 28, 0, 4, 8, 12, 48, 52, 56, 60, 32, 36, 40, 44 }; - INT32 YOffs0[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; - - INT32 Plane1[4] = { 0xc00000, 0x800000, 0x400000, 0x000000 }; - INT32 XOffs1[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; - INT32 YOffs1[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x300000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x300000); - - GfxDecode(0x6000, 4, 16, 16, Plane0, XOffs0, YOffs0, 0x400, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x200000); - - GfxDecode(0x4000, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x080000; - DrvZ80ROM = Next; Next += 0x010000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x040000; - - DrvGfxROM0 = Next; Next += 0x600000; - DrvGfxROM1 = Next; Next += 0x400000; - - DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x004000; - DrvVidRAM0 = Next; Next += 0x001000; - DrvVidRAM1 = Next; Next += 0x001000; - - DrvVidRegs = Next; Next += 0x000008; - DrvSndRegs = Next; Next += 0x000008; - - DrvScrollX = (INT32*)Next; Next += 0x000002 * sizeof(INT32); - DrvScrollY = (INT32*)Next; Next += 0x000002 * sizeof(INT32); - - DrvZ80RAM = Next; Next += 0x000800; - - Palette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM2151Reset(); - - return 0; -} - -void MugsmashYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - for (INT32 i = 0; i < 6; i+=2) { - if (BurnLoadRom(DrvGfxROM0 + i * 0x80000 + 0, i + 3, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + i * 0x80000 + 1, i + 4, 2)) return 1; - } - - for (INT32 i = 0; i < 4; i++) - if (BurnLoadRom(DrvGfxROM1 + i * 0x80000, i + 9, 1)) return 1; - - for (INT32 i = 0; i < 2; i++) - if (BurnLoadRom(DrvSndROM + i * 0x20000, i + 13, 1)) return 1; - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvVidRAM0, 0x080000, 0x080fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x082000, 0x082fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x100000, 0x1005ff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x1c0000, 0x1cffff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x200000, 0x203fff, SM_RAM); - SekSetWriteByteHandler(0, mugsmash_write_byte); - SekSetWriteWordHandler(0, mugsmash_write_word); - SekSetReadByteHandler(0, mugsmash_read_byte); - SekSetReadWordHandler(0, mugsmash_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(mugsmash_sound_write); - ZetSetReadHandler(mugsmash_sound_read); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - - soundlatch = DrvSndRegs + 2; - - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&MugsmashYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - MSM6295Init(0, 1122000 / 132, 1); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - SekExit(); - ZetExit(); - - MSM6295Exit(0); - BurnYM2151Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_sprites() -{ - const UINT16 *source = (const UINT16*)DrvSprRAM; - const UINT16 *finish = source + 0x2000; - - while (source < finish) - { - INT32 xpos = BURN_ENDIAN_SWAP_INT16(source[0]) & 0x00ff; - INT32 ypos = BURN_ENDIAN_SWAP_INT16(source[4]) & 0x00ff; - INT32 num = (BURN_ENDIAN_SWAP_INT16(source[3]) & 0x00ff) | ((BURN_ENDIAN_SWAP_INT16(source[2]) & 0x00ff) << 8); - INT32 attr = BURN_ENDIAN_SWAP_INT16(source[1]); - INT32 flipx = (attr & 0x0080)>>7; - INT32 color = attr & 0x000f; - - xpos += (attr & 0x0020) << 3; - ypos += (attr & 0x0010) << 4; - - xpos -= 28; - ypos -= 24; - - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, num, xpos, ypos, color, 4, 0, 0, DrvGfxROM0); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, num, xpos, ypos, color, 4, 0, 0, DrvGfxROM0); - } - - source += 8; - } -} - -static void draw_layer(UINT8 *source, INT32 colofst, INT32 scroll) -{ - UINT16 *vram = (UINT16*)source; - - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 sx = (offs & 0x1f) << 4; - INT32 sy = (offs >> 5) << 4; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[(offs << 1) | 1]); - INT32 color = BURN_ENDIAN_SWAP_INT16(vram[(offs << 1)]); - INT32 flipx = color & 0x40; - INT32 flipy = color & 0x80; - color &= 0x000f; - - sx -= DrvScrollX[scroll] & 0x1ff; - sy -= DrvScrollY[scroll] & 0x1ff; - if (sx < -15) sx += 0x200; - if (sy < -15) sy += 0x200; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, colofst, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, colofst, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, colofst, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, colofst, DrvGfxROM1); - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x300; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); - - draw_layer(DrvVidRAM1, 0x200, 1); - draw_layer(DrvVidRAM0, 0x100, 0); - - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - for (INT32 i = 0; i < 4; i++) { - DrvInps[i] = (DrvDips[i] << 8) | 0xff; - } - - for (INT32 i = 0; i < 16; i++) { - DrvInps[0] ^= (DrvJoy1[i] & 1) << i; - DrvInps[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { 12000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment; - - nSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); - nCyclesDone[0] += SekRun(nSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - - nSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i); - nCyclesDone[1] += ZetRun(nSegment); - - nSegment = nBurnSoundLen / nInterleave; - - if (pBurnSoundOut) { - BurnYM2151Render(pBurnSoundOut + ((nSegment * i) << 1), nSegment); - MSM6295Render(0, pBurnSoundOut + ((nSegment * i) << 1), nSegment); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029697; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - } - - return 0; -} - - -// Mug Smashers - -static struct BurnRomInfo mugsmashRomDesc[] = { - { "mugs_04.bin", 0x40000, 0x2498fd27, 1 | BRF_PRG | BRF_ESS }, // 0 68000 Code - { "mugs_05.bin", 0x40000, 0x95efb40b, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "mugs_03.bin", 0x10000, 0x0101df2d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "mugs_11.bin", 0x80000, 0x1c9f5acf, 3 | BRF_GRA }, // 3 Sprites - { "mugs_10.bin", 0x80000, 0x6b3c22d9, 3 | BRF_GRA }, // 4 - { "mugs_09.bin", 0x80000, 0x4e9490f3, 3 | BRF_GRA }, // 5 - { "mugs_08.bin", 0x80000, 0x716328d5, 3 | BRF_GRA }, // 6 - { "mugs_07.bin", 0x80000, 0x9e3167fd, 3 | BRF_GRA }, // 7 - { "mugs_06.bin", 0x80000, 0x8df75d29, 3 | BRF_GRA }, // 8 - - { "mugs_12.bin", 0x80000, 0xc0a6ed98, 4 | BRF_GRA }, // 9 Bg Tiles - { "mugs_13.bin", 0x80000, 0xe2be8595, 4 | BRF_GRA }, // 10 - { "mugs_14.bin", 0x80000, 0x24e81068, 4 | BRF_GRA }, // 11 - { "mugs_15.bin", 0x80000, 0x82e8187c, 4 | BRF_GRA }, // 12 - - { "mugs_02.bin", 0x20000, 0xf92a7f4a, 5 | BRF_GRA }, // 13 Samples - { "mugs_01.bin", 0x20000, 0x1a3a0b39, 5 | BRF_GRA }, // 14 -}; - -STD_ROM_PICK(mugsmash) -STD_ROM_FN(mugsmash) - -struct BurnDriver BurnDrvMugsmash = { - "mugsmash", NULL, NULL, NULL, "1990?", - "Mug Smashers\0", NULL, "Electronic Devices Italy / 3D Games England", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, - NULL, mugsmashRomInfo, mugsmashRomName, NULL, NULL, MugsmashInputInfo, MugsmashDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, - 320, 240, 4, 3 -}; +// FB Alpha Mug Smashers driver module +// Based on MAME driver by David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvVidRAM0; +static UINT8 *DrvVidRAM1; +static UINT8 *DrvVidRegs; +static UINT8 *DrvSndRegs; + +static UINT32 *DrvPalette; +static UINT32 *Palette; + +static UINT8 DrvRecalc; + +static INT32 *DrvScrollX; +static INT32 *DrvScrollY; + +static UINT8 DrvReset; +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[4]; +static UINT16 DrvInps[4]; + +static UINT8 *soundlatch; + +static struct BurnInputInfo MugsmashInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 9, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip"}, + {"Dip D", BIT_DIPSWITCH, DrvDips + 3, "dip"}, +}; + +STDINPUTINFO(Mugsmash) + +static struct BurnDIPInfo MugsmashDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xe1, NULL }, + {0x15, 0xff, 0xff, 0xda, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Color Test" }, + {0x13, 0x01, 0x10, 0x10, "Off" }, + {0x13, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Draw SF." }, + {0x13, 0x01, 0x20, 0x20, "Off" }, + {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x14, 0x01, 0x0e, 0x0c, "4 Coins 1 Credits " }, + {0x14, 0x01, 0x0e, 0x0a, "3 Coins 1 Credits " }, + {0x14, 0x01, 0x0e, 0x08, "2 Coins 1 Credits " }, + {0x14, 0x01, 0x0e, 0x00, "1 Coin 1 Credits " }, + {0x14, 0x01, 0x0e, 0x02, "1 Coin 2 Credits " }, + {0x14, 0x01, 0x0e, 0x04, "1 Coin 3 Credits " }, + {0x14, 0x01, 0x0e, 0x06, "1 Coin 4 Credits " }, + {0x14, 0x01, 0x0e, 0x0e, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Allow_Continue" }, + {0x14, 0x01, 0x10, 0x10, "No" }, + {0x14, 0x01, 0x10, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2, "Sound Test" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo_Sounds" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x06, 0x00, "1" }, + {0x15, 0x01, 0x06, 0x02, "2" }, + {0x15, 0x01, 0x06, 0x04, "3" }, + {0x15, 0x01, 0x06, 0x06, "4" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x30, 0x00, "Very_Easy" }, + {0x15, 0x01, 0x30, 0x10, "Easy" }, + {0x15, 0x01, 0x30, 0x20, "Hard" }, + {0x15, 0x01, 0x30, 0x30, "Very_Hard" }, + + {0 , 0xfe, 0 , 2, "Draw Objects" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x16, 0x01, 0x02, 0x02, "Off" }, + {0x16, 0x01, 0x02, 0x00, "On" }, +}; + +STDDIPINFO(Mugsmash) + +UINT8 __fastcall mugsmash_read_byte(UINT32 address) +{ + switch (address) + { + case 0x180000: + case 0x180001: + case 0x180002: + case 0x180003: + case 0x180004: + case 0x180005: + case 0x180006: + case 0x180007: + return DrvInps[(address >> 1) & 3] >> ((~address & 1) << 3); + } + + return 0; +} + +UINT16 __fastcall mugsmash_read_word(UINT32 address) +{ + switch (address) + { + case 0x180000: + case 0x180002: + case 0x180004: + case 0x180006: + return DrvInps[(address >> 1) & 3]; + } + + return 0; +} + +static void palette_write(INT32 offset) +{ + UINT16 data = *((UINT16*)(DrvPalRAM + offset)); + + UINT8 r,g,b; + + r = (data >> 10); + r = (r << 3) | (r >> 2); + + g = (data >> 5); + g = (g << 3) | (r >> 2); + + b = (data >> 0); + b = (b << 3) | (b >> 2); + + Palette[offset >> 1] = (r << 16) | (g << 8) | (b); + DrvPalette[offset >> 1] = BurnHighCol(r, g, b, 0); +} + +void __fastcall mugsmash_write_byte(UINT32 address, UINT8 data) +{ + if (address >= 0x100000 && address <= 0x1005ff) { + DrvPalRAM[address & 0x7ff] = data; + + palette_write(address & 0x7ff); + + return; + } + + switch (address) + { + case 0x0c0000: + case 0x0c0001: + case 0x0c0002: + case 0x0c0003: + case 0x0c0004: + case 0x0c0005: + case 0x0c0006: + case 0x0c0007: + DrvVidRegs[address & 7] = data; + return; + + case 0x140002: + case 0x140003: + ZetNmi(); + case 0x140000: + case 0x140001: + case 0x140004: + case 0x140005: + case 0x140006: + case 0x140007: + DrvSndRegs[address & 7] = data; + return; + } +} + +void __fastcall mugsmash_write_word(UINT32 address, UINT16 data) +{ + if (address >= 0x100000 && address <= 0x1005ff) { + *((UINT16*)(DrvPalRAM + (address & 0x7fe))) = data; + + palette_write(address & 0x7fe); + + return; + } + + switch (address) + { + case 0x0c0000: + *((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data); + DrvScrollX[1] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 4))) + 7; + return; + + case 0x0c0002: + *((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data); + DrvScrollY[1] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 6))) + 12; + return; + + case 0x0c0004: + *((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data); + DrvScrollX[0] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 0))) + 3; + return; + + case 0x0c0006: + *((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data); + DrvScrollY[0] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 2))) + 12; + return; + + case 0x140002: + ZetNmi(); + case 0x140000: + case 0x140004: + case 0x140006: + *((UINT16*)(DrvSndRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data); + return; + } +} + +void __fastcall mugsmash_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8800: + BurnYM2151SelectRegister(data); + return; + + case 0x8801: + BurnYM2151WriteRegister(data); + return; + + case 0x9800: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall mugsmash_sound_read(UINT16 address) +{ + switch (address) + { + case 0x8801: + return BurnYM2151ReadStatus(); + + case 0x9800: + return MSM6295ReadStatus(0); + + case 0xa000: + return *soundlatch; + } + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0, 1, 2, 3 }; + INT32 XOffs0[16] = { 16, 20, 24, 28, 0, 4, 8, 12, 48, 52, 56, 60, 32, 36, 40, 44 }; + INT32 YOffs0[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; + + INT32 Plane1[4] = { 0xc00000, 0x800000, 0x400000, 0x000000 }; + INT32 XOffs1[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; + INT32 YOffs1[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x300000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x300000); + + GfxDecode(0x6000, 4, 16, 16, Plane0, XOffs0, YOffs0, 0x400, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x200000); + + GfxDecode(0x4000, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x080000; + DrvZ80ROM = Next; Next += 0x010000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x040000; + + DrvGfxROM0 = Next; Next += 0x600000; + DrvGfxROM1 = Next; Next += 0x400000; + + DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x004000; + DrvVidRAM0 = Next; Next += 0x001000; + DrvVidRAM1 = Next; Next += 0x001000; + + DrvVidRegs = Next; Next += 0x000008; + DrvSndRegs = Next; Next += 0x000008; + + DrvScrollX = (INT32*)Next; Next += 0x000002 * sizeof(INT32); + DrvScrollY = (INT32*)Next; Next += 0x000002 * sizeof(INT32); + + DrvZ80RAM = Next; Next += 0x000800; + + Palette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM2151Reset(); + + return 0; +} + +void MugsmashYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + for (INT32 i = 0; i < 6; i+=2) { + if (BurnLoadRom(DrvGfxROM0 + i * 0x80000 + 0, i + 3, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + i * 0x80000 + 1, i + 4, 2)) return 1; + } + + for (INT32 i = 0; i < 4; i++) + if (BurnLoadRom(DrvGfxROM1 + i * 0x80000, i + 9, 1)) return 1; + + for (INT32 i = 0; i < 2; i++) + if (BurnLoadRom(DrvSndROM + i * 0x20000, i + 13, 1)) return 1; + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvVidRAM0, 0x080000, 0x080fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x082000, 0x082fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x100000, 0x1005ff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x1c0000, 0x1cffff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x200000, 0x203fff, SM_RAM); + SekSetWriteByteHandler(0, mugsmash_write_byte); + SekSetWriteWordHandler(0, mugsmash_write_word); + SekSetReadByteHandler(0, mugsmash_read_byte); + SekSetReadWordHandler(0, mugsmash_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(mugsmash_sound_write); + ZetSetReadHandler(mugsmash_sound_read); + ZetClose(); + + GenericTilesInit(); + + soundlatch = DrvSndRegs + 2; + + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&MugsmashYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + MSM6295Init(0, 1122000 / 132, 1); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + SekExit(); + ZetExit(); + + MSM6295Exit(0); + BurnYM2151Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_sprites() +{ + const UINT16 *source = (const UINT16*)DrvSprRAM; + const UINT16 *finish = source + 0x2000; + + while (source < finish) + { + INT32 xpos = BURN_ENDIAN_SWAP_INT16(source[0]) & 0x00ff; + INT32 ypos = BURN_ENDIAN_SWAP_INT16(source[4]) & 0x00ff; + INT32 num = (BURN_ENDIAN_SWAP_INT16(source[3]) & 0x00ff) | ((BURN_ENDIAN_SWAP_INT16(source[2]) & 0x00ff) << 8); + INT32 attr = BURN_ENDIAN_SWAP_INT16(source[1]); + INT32 flipx = (attr & 0x0080)>>7; + INT32 color = attr & 0x000f; + + xpos += (attr & 0x0020) << 3; + ypos += (attr & 0x0010) << 4; + + xpos -= 28; + ypos -= 24; + + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, num, xpos, ypos, color, 4, 0, 0, DrvGfxROM0); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, num, xpos, ypos, color, 4, 0, 0, DrvGfxROM0); + } + + source += 8; + } +} + +static void draw_layer(UINT8 *source, INT32 colofst, INT32 scroll) +{ + UINT16 *vram = (UINT16*)source; + + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 sx = (offs & 0x1f) << 4; + INT32 sy = (offs >> 5) << 4; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[(offs << 1) | 1]); + INT32 color = BURN_ENDIAN_SWAP_INT16(vram[(offs << 1)]); + INT32 flipx = color & 0x40; + INT32 flipy = color & 0x80; + color &= 0x000f; + + sx -= DrvScrollX[scroll] & 0x1ff; + sy -= DrvScrollY[scroll] & 0x1ff; + if (sx < -15) sx += 0x200; + if (sy < -15) sy += 0x200; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, colofst, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, colofst, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, colofst, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, colofst, DrvGfxROM1); + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x300; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + memset (pTransDraw, 0, nScreenWidth * nScreenHeight * 2); + + draw_layer(DrvVidRAM1, 0x200, 1); + draw_layer(DrvVidRAM0, 0x100, 0); + + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + for (INT32 i = 0; i < 4; i++) { + DrvInps[i] = (DrvDips[i] << 8) | 0xff; + } + + for (INT32 i = 0; i < 16; i++) { + DrvInps[0] ^= (DrvJoy1[i] & 1) << i; + DrvInps[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { 12000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment; + + nSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i); + nCyclesDone[0] += SekRun(nSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + + nSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i); + nCyclesDone[1] += ZetRun(nSegment); + + nSegment = nBurnSoundLen / nInterleave; + + if (pBurnSoundOut) { + BurnYM2151Render(pBurnSoundOut + ((nSegment * i) << 1), nSegment); + MSM6295Render(0, pBurnSoundOut + ((nSegment * i) << 1), nSegment); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029697; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + } + + return 0; +} + + +// Mug Smashers + +static struct BurnRomInfo mugsmashRomDesc[] = { + { "mugs_04.bin", 0x40000, 0x2498fd27, 1 | BRF_PRG | BRF_ESS }, // 0 68000 Code + { "mugs_05.bin", 0x40000, 0x95efb40b, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "mugs_03.bin", 0x10000, 0x0101df2d, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "mugs_11.bin", 0x80000, 0x1c9f5acf, 3 | BRF_GRA }, // 3 Sprites + { "mugs_10.bin", 0x80000, 0x6b3c22d9, 3 | BRF_GRA }, // 4 + { "mugs_09.bin", 0x80000, 0x4e9490f3, 3 | BRF_GRA }, // 5 + { "mugs_08.bin", 0x80000, 0x716328d5, 3 | BRF_GRA }, // 6 + { "mugs_07.bin", 0x80000, 0x9e3167fd, 3 | BRF_GRA }, // 7 + { "mugs_06.bin", 0x80000, 0x8df75d29, 3 | BRF_GRA }, // 8 + + { "mugs_12.bin", 0x80000, 0xc0a6ed98, 4 | BRF_GRA }, // 9 Bg Tiles + { "mugs_13.bin", 0x80000, 0xe2be8595, 4 | BRF_GRA }, // 10 + { "mugs_14.bin", 0x80000, 0x24e81068, 4 | BRF_GRA }, // 11 + { "mugs_15.bin", 0x80000, 0x82e8187c, 4 | BRF_GRA }, // 12 + + { "mugs_02.bin", 0x20000, 0xf92a7f4a, 5 | BRF_GRA }, // 13 Samples + { "mugs_01.bin", 0x20000, 0x1a3a0b39, 5 | BRF_GRA }, // 14 +}; + +STD_ROM_PICK(mugsmash) +STD_ROM_FN(mugsmash) + +struct BurnDriver BurnDrvMugsmash = { + "mugsmash", NULL, NULL, NULL, "1990?", + "Mug Smashers\0", NULL, "Electronic Devices Italy / 3D Games England", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, + NULL, mugsmashRomInfo, mugsmashRomName, NULL, NULL, MugsmashInputInfo, MugsmashDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_news.cpp b/src/burn/drv/pst90s/d_news.cpp index a95811759..c6c981a5b 100644 --- a/src/burn/drv/pst90s/d_news.cpp +++ b/src/burn/drv/pst90s/d_news.cpp @@ -1,458 +1,457 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "msm6295.h" - -// FB Alpha - "News" Driver - -// Input Related Variables -static UINT8 NewsInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 NewsDip[1] = {0}; -static UINT8 NewsInput[1] = {0x00}; -static UINT8 NewsReset = 0; - -// Memory Holders -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *NewsRom = NULL; -static UINT8 *NewsRam = NULL; -static UINT8 *NewsFgVideoRam = NULL; -static UINT8 *NewsBgVideoRam = NULL; -static UINT8 *NewsPaletteRam = NULL; -static UINT32 *NewsPalette = NULL; -static UINT8 *NewsTiles = NULL; -static UINT8 *NewsTempGfx = NULL; - -// Misc Variables, system control values, etc. -static INT32 BgPic; - -// Dip Switch and Input Definitions -static struct BurnInputInfo NewsInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , NewsInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , NewsInputPort0 + 1, "p1 start" }, - - {"Up" , BIT_DIGITAL , NewsInputPort0 + 2, "p1 up" }, - {"Down" , BIT_DIGITAL , NewsInputPort0 + 3, "p1 down" }, - {"Left" , BIT_DIGITAL , NewsInputPort0 + 4, "p1 left" }, - {"Right" , BIT_DIGITAL , NewsInputPort0 + 5, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , NewsInputPort0 + 6, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , NewsInputPort0 + 7, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &NewsReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, NewsDip + 0 , "dip" }, -}; - -STDINPUTINFO(News) - -inline void NewsClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } - if ((*nJoystickInputs & 0x30) == 0x30) { - *nJoystickInputs &= ~0x30; - } -} - -inline void NewsMakeInputs() -{ - // Reset Inputs - NewsInput[0] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - NewsInput[0] |= (NewsInputPort0[i] & 1) << i; - } - - // Clear Opposites - NewsClearOpposites(&NewsInput[0]); -} - -static struct BurnDIPInfo NewsDIPList[]= -{ - // Default Values - {0x09, 0xff, 0xff, 0xdf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x09, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x09, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x09, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x09, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x09, 0x01, 0x0c, 0x0c, "Easy" }, - {0x09, 0x01, 0x0c, 0x08, "Medium" }, - {0x09, 0x01, 0x0c, 0x04, "Hard" }, - {0x09, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Helps" }, - {0x09, 0x01, 0x10, 0x10, "1" }, - {0x09, 0x01, 0x10, 0x00, "2" }, - - {0 , 0xfe, 0 , 2 , "Copyright" }, - {0x09, 0x01, 0x20, 0x00, "Poby" }, - {0x09, 0x01, 0x20, 0x20, "Virus" }, -}; - -STDDIPINFO(News) - -static struct BurnDIPInfo NewsaDIPList[]= -{ - // Default Values - {0x09, 0xff, 0xff, 0xdf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x09, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x09, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x09, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x09, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x09, 0x01, 0x0c, 0x0c, "Easy" }, - {0x09, 0x01, 0x0c, 0x08, "Medium" }, - {0x09, 0x01, 0x0c, 0x04, "Hard" }, - {0x09, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Helps" }, - {0x09, 0x01, 0x10, 0x10, "1" }, - {0x09, 0x01, 0x10, 0x00, "2" }, -}; - -STDDIPINFO(Newsa) - -// Rom Definitions -static struct BurnRomInfo NewsRomDesc[] = { - { "virus.4", 0x08000, 0xaa005dfb, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - - { "virus.2", 0x40000, 0xb5af58d8, BRF_GRA }, // 1 Tiles - { "virus.3", 0x40000, 0xa4b1c175, BRF_GRA }, // 2 Tiles - - { "virus.1", 0x40000, 0x41f5935a, BRF_SND }, // 3 Samples -}; - - -STD_ROM_PICK(News) -STD_ROM_FN(News) - -static struct BurnRomInfo NewsaRomDesc[] = { - { "newsa_virus.4", 0x10000, 0x74a257da, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code - - { "virus.2", 0x40000, 0xb5af58d8, BRF_GRA }, // 1 Tiles - { "virus.3", 0x40000, 0xa4b1c175, BRF_GRA }, // 2 Tiles - - { "virus.1", 0x40000, 0x41f5935a, BRF_SND }, // 3 Samples -}; - - -STD_ROM_PICK(Newsa) -STD_ROM_FN(Newsa) - -// Misc Driver Functions and Memory Handlers -INT32 NewsDoReset() -{ - BgPic = 0; - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - - return 0; -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = (nColour >> 8) & 0x0f; - g = (nColour >> 4) & 0x0f; - b = (nColour >> 0) & 0x0f; - - r = (r << 4) | r; - g = (g << 4) | g; - b = (b << 4) | b; - - return BurnHighCol(r, g, b, 0); -} - -UINT8 __fastcall NewsRead(UINT16 a) -{ - switch (a) { - case 0xc000: { - return NewsDip[0]; - } - - case 0xc001: { - return 0xff - NewsInput[0]; - } - - case 0xc002: { - return MSM6295ReadStatus(0); - } - } - - return 0; -} - -void __fastcall NewsWrite(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xc002: { - MSM6295Command(0, d); - return; - } - - case 0xc003: { - BgPic = d; - return; - } - } - - if (a >= 0x9000 && a <= 0x91ff) { - INT32 Offset = a - 0x9000; - - NewsPaletteRam[Offset] = d; - NewsPalette[Offset / 2] = CalcCol(NewsPaletteRam[Offset | 1] | (NewsPaletteRam[Offset & ~1] << 8)); - return; - } -} - - - -// Function to Allocate and Index required memory -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - NewsRom = Next; Next += 0x10000; - MSM6295ROM = Next; Next += 0x40000; - - RamStart = Next; - - NewsRam = Next; Next += 0x02000; - NewsFgVideoRam = Next; Next += 0x00800; - NewsBgVideoRam = Next; Next += 0x00800; - NewsPaletteRam = Next; Next += 0x00200; - - RamEnd = Next; - - NewsTiles = Next; Next += (16384 * 8 * 8); - NewsPalette = (UINT32*)Next; Next += 0x00100 * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 TileXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; -static INT32 TileYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; - -// Driver Init and Exit Functions -INT32 NewsInit() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - NewsTempGfx = (UINT8*)BurnMalloc(0x80000); - - // Load Z80 Program Rom - nRet = BurnLoadRom(NewsRom, 0, 1); if (nRet != 0) return 1; - - // Load, byte-swap and decode Tile Roms - nRet = BurnLoadRom(NewsTempGfx + 0x00000, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(NewsTempGfx + 0x00001, 2, 2); if (nRet != 0) return 1; - GfxDecode(16384, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, NewsTempGfx, NewsTiles); - BurnFree(NewsTempGfx); - - // Load Sample Rom - nRet = BurnLoadRom(MSM6295ROM, 3, 1); if (nRet != 0) return 1; - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, NewsRom ); - ZetMapArea(0x0000, 0x7fff, 2, NewsRom ); - ZetMapArea(0x8000, 0x87ff, 0, NewsFgVideoRam ); - ZetMapArea(0x8000, 0x87ff, 1, NewsFgVideoRam ); - ZetMapArea(0x8000, 0x87ff, 2, NewsFgVideoRam ); - ZetMapArea(0x8800, 0x8fff, 0, NewsBgVideoRam ); - ZetMapArea(0x8800, 0x8fff, 1, NewsBgVideoRam ); - ZetMapArea(0x8800, 0x8fff, 2, NewsBgVideoRam ); - ZetMapArea(0xe000, 0xffff, 0, NewsRam ); - ZetMapArea(0xe000, 0xffff, 1, NewsRam ); - ZetMapArea(0xe000, 0xffff, 2, NewsRam ); - ZetMemEnd(); - ZetSetReadHandler(NewsRead); - ZetSetWriteHandler(NewsWrite); - ZetClose(); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 8000, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - // Reset the driver - NewsDoReset(); - - return 0; -} - -INT32 NewsExit() -{ - MSM6295Exit(0); - ZetExit(); - - GenericTilesExit(); - - BurnFree(Mem); - - BgPic = 0; - - return 0; -} - -// Graphics Emulation -void NewsRenderBgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Code = (NewsBgVideoRam[TileIndex * 2] << 8) | NewsBgVideoRam[TileIndex * 2 + 1]; - Colour = (Code & 0xf000) >> 12; - Code &= 0x0fff; - if ((Code & 0x0e00) == 0xe00) Code = (Code & 0x1ff) | (BgPic << 9); - x = 8 * mx; - y = 8 * my; - y -= 16; - - if (x > 7 && x < 248 && y > 7 && y < 216) { - Render8x8Tile(pTransDraw, Code, x, y, Colour, 4, 0, NewsTiles); - } else { - Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, NewsTiles); - } - - TileIndex++; - } - } -} - -void NewsRenderFgLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - Code = (NewsFgVideoRam[TileIndex * 2] << 8) | NewsFgVideoRam[TileIndex * 2 + 1]; - Colour = (Code & 0xf000) >> 12; - Code &= 0x0fff; - x = 8 * mx; - y = 8 * my; - y -= 16; - - if (x > 7 && x < 248 && y > 7 && y < 216) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, NewsTiles); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, NewsTiles); - } - - TileIndex++; - } - } -} - -void NewsDraw() -{ - NewsRenderBgLayer(); - NewsRenderFgLayer(); - BurnTransferCopy(NewsPalette); -} - -// Frame Function -INT32 NewsFrame() -{ - if (NewsReset) NewsDoReset(); - - NewsMakeInputs(); - - ZetOpen(0); - ZetRun(8000000 / 60); - ZetRaiseIrq(0); - ZetClose(); - - if (pBurnDraw) NewsDraw(); - if (pBurnSoundOut) MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - - return 0; -} - -// Scan RAM -static INT32 NewsScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x02942; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - memset(&ba, 0, sizeof(ba)); - ba.Data = NewsPalette; - ba.nLen = 0x100 * sizeof(UINT32); - ba.szName = "Palette"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); // Scan Z80 - - MSM6295Scan(0, nAction); // Scan OKIM6295 - - // Scan critical driver variables - SCAN_VAR(NewsInput); - SCAN_VAR(NewsDip); - SCAN_VAR(BgPic); - } - - return 0; -} - -// Driver Declaration -struct BurnDriver BurnDrvNews = { - "news", NULL, NULL, NULL, "1993", - "News (set 1)\0", NULL, "Poby / Virus", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 1, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, NewsRomInfo, NewsRomName, NULL, NULL, NewsInputInfo, NewsDIPInfo, - NewsInit, NewsExit, NewsFrame, NULL, NewsScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNewsa = { - "newsa", "news", NULL, NULL, "1993", - "News (set 2)\0", NULL, "Poby / Jeansole", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 1, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, NewsaRomInfo, NewsaRomName, NULL, NULL, NewsInputInfo, NewsaDIPInfo, - NewsInit, NewsExit, NewsFrame, NULL, NewsScan, - NULL, 0x100, 256, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "msm6295.h" + +// FB Alpha - "News" Driver + +// Input Related Variables +static UINT8 NewsInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 NewsDip[1] = {0}; +static UINT8 NewsInput[1] = {0x00}; +static UINT8 NewsReset = 0; + +// Memory Holders +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *NewsRom = NULL; +static UINT8 *NewsRam = NULL; +static UINT8 *NewsFgVideoRam = NULL; +static UINT8 *NewsBgVideoRam = NULL; +static UINT8 *NewsPaletteRam = NULL; +static UINT32 *NewsPalette = NULL; +static UINT8 *NewsTiles = NULL; +static UINT8 *NewsTempGfx = NULL; + +// Misc Variables, system control values, etc. +static INT32 BgPic; + +// Dip Switch and Input Definitions +static struct BurnInputInfo NewsInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , NewsInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , NewsInputPort0 + 1, "p1 start" }, + + {"Up" , BIT_DIGITAL , NewsInputPort0 + 2, "p1 up" }, + {"Down" , BIT_DIGITAL , NewsInputPort0 + 3, "p1 down" }, + {"Left" , BIT_DIGITAL , NewsInputPort0 + 4, "p1 left" }, + {"Right" , BIT_DIGITAL , NewsInputPort0 + 5, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , NewsInputPort0 + 6, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , NewsInputPort0 + 7, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &NewsReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, NewsDip + 0 , "dip" }, +}; + +STDINPUTINFO(News) + +inline void NewsClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } + if ((*nJoystickInputs & 0x30) == 0x30) { + *nJoystickInputs &= ~0x30; + } +} + +inline void NewsMakeInputs() +{ + // Reset Inputs + NewsInput[0] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + NewsInput[0] |= (NewsInputPort0[i] & 1) << i; + } + + // Clear Opposites + NewsClearOpposites(&NewsInput[0]); +} + +static struct BurnDIPInfo NewsDIPList[]= +{ + // Default Values + {0x09, 0xff, 0xff, 0xdf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x09, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x09, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x09, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x09, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x09, 0x01, 0x0c, 0x0c, "Easy" }, + {0x09, 0x01, 0x0c, 0x08, "Medium" }, + {0x09, 0x01, 0x0c, 0x04, "Hard" }, + {0x09, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Helps" }, + {0x09, 0x01, 0x10, 0x10, "1" }, + {0x09, 0x01, 0x10, 0x00, "2" }, + + {0 , 0xfe, 0 , 2 , "Copyright" }, + {0x09, 0x01, 0x20, 0x00, "Poby" }, + {0x09, 0x01, 0x20, 0x20, "Virus" }, +}; + +STDDIPINFO(News) + +static struct BurnDIPInfo NewsaDIPList[]= +{ + // Default Values + {0x09, 0xff, 0xff, 0xdf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x09, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x09, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x09, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x09, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x09, 0x01, 0x0c, 0x0c, "Easy" }, + {0x09, 0x01, 0x0c, 0x08, "Medium" }, + {0x09, 0x01, 0x0c, 0x04, "Hard" }, + {0x09, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Helps" }, + {0x09, 0x01, 0x10, 0x10, "1" }, + {0x09, 0x01, 0x10, 0x00, "2" }, +}; + +STDDIPINFO(Newsa) + +// Rom Definitions +static struct BurnRomInfo NewsRomDesc[] = { + { "virus.4", 0x08000, 0xaa005dfb, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + + { "virus.2", 0x40000, 0xb5af58d8, BRF_GRA }, // 1 Tiles + { "virus.3", 0x40000, 0xa4b1c175, BRF_GRA }, // 2 Tiles + + { "virus.1", 0x40000, 0x41f5935a, BRF_SND }, // 3 Samples +}; + + +STD_ROM_PICK(News) +STD_ROM_FN(News) + +static struct BurnRomInfo NewsaRomDesc[] = { + { "newsa_virus.4", 0x10000, 0x74a257da, BRF_ESS | BRF_PRG }, // 0 Z80 Program Code + + { "virus.2", 0x40000, 0xb5af58d8, BRF_GRA }, // 1 Tiles + { "virus.3", 0x40000, 0xa4b1c175, BRF_GRA }, // 2 Tiles + + { "virus.1", 0x40000, 0x41f5935a, BRF_SND }, // 3 Samples +}; + + +STD_ROM_PICK(Newsa) +STD_ROM_FN(Newsa) + +// Misc Driver Functions and Memory Handlers +INT32 NewsDoReset() +{ + BgPic = 0; + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + + return 0; +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = (nColour >> 8) & 0x0f; + g = (nColour >> 4) & 0x0f; + b = (nColour >> 0) & 0x0f; + + r = (r << 4) | r; + g = (g << 4) | g; + b = (b << 4) | b; + + return BurnHighCol(r, g, b, 0); +} + +UINT8 __fastcall NewsRead(UINT16 a) +{ + switch (a) { + case 0xc000: { + return NewsDip[0]; + } + + case 0xc001: { + return 0xff - NewsInput[0]; + } + + case 0xc002: { + return MSM6295ReadStatus(0); + } + } + + return 0; +} + +void __fastcall NewsWrite(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xc002: { + MSM6295Command(0, d); + return; + } + + case 0xc003: { + BgPic = d; + return; + } + } + + if (a >= 0x9000 && a <= 0x91ff) { + INT32 Offset = a - 0x9000; + + NewsPaletteRam[Offset] = d; + NewsPalette[Offset / 2] = CalcCol(NewsPaletteRam[Offset | 1] | (NewsPaletteRam[Offset & ~1] << 8)); + return; + } +} + + + +// Function to Allocate and Index required memory +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + NewsRom = Next; Next += 0x10000; + MSM6295ROM = Next; Next += 0x40000; + + RamStart = Next; + + NewsRam = Next; Next += 0x02000; + NewsFgVideoRam = Next; Next += 0x00800; + NewsBgVideoRam = Next; Next += 0x00800; + NewsPaletteRam = Next; Next += 0x00200; + + RamEnd = Next; + + NewsTiles = Next; Next += (16384 * 8 * 8); + NewsPalette = (UINT32*)Next; Next += 0x00100 * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +static INT32 TilePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 TileXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; +static INT32 TileYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; + +// Driver Init and Exit Functions +INT32 NewsInit() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + NewsTempGfx = (UINT8*)BurnMalloc(0x80000); + + // Load Z80 Program Rom + nRet = BurnLoadRom(NewsRom, 0, 1); if (nRet != 0) return 1; + + // Load, byte-swap and decode Tile Roms + nRet = BurnLoadRom(NewsTempGfx + 0x00000, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(NewsTempGfx + 0x00001, 2, 2); if (nRet != 0) return 1; + GfxDecode(16384, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, NewsTempGfx, NewsTiles); + BurnFree(NewsTempGfx); + + // Load Sample Rom + nRet = BurnLoadRom(MSM6295ROM, 3, 1); if (nRet != 0) return 1; + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, NewsRom ); + ZetMapArea(0x0000, 0x7fff, 2, NewsRom ); + ZetMapArea(0x8000, 0x87ff, 0, NewsFgVideoRam ); + ZetMapArea(0x8000, 0x87ff, 1, NewsFgVideoRam ); + ZetMapArea(0x8000, 0x87ff, 2, NewsFgVideoRam ); + ZetMapArea(0x8800, 0x8fff, 0, NewsBgVideoRam ); + ZetMapArea(0x8800, 0x8fff, 1, NewsBgVideoRam ); + ZetMapArea(0x8800, 0x8fff, 2, NewsBgVideoRam ); + ZetMapArea(0xe000, 0xffff, 0, NewsRam ); + ZetMapArea(0xe000, 0xffff, 1, NewsRam ); + ZetMapArea(0xe000, 0xffff, 2, NewsRam ); + ZetSetReadHandler(NewsRead); + ZetSetWriteHandler(NewsWrite); + ZetClose(); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 8000, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + // Reset the driver + NewsDoReset(); + + return 0; +} + +INT32 NewsExit() +{ + MSM6295Exit(0); + ZetExit(); + + GenericTilesExit(); + + BurnFree(Mem); + + BgPic = 0; + + return 0; +} + +// Graphics Emulation +void NewsRenderBgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Code = (NewsBgVideoRam[TileIndex * 2] << 8) | NewsBgVideoRam[TileIndex * 2 + 1]; + Colour = (Code & 0xf000) >> 12; + Code &= 0x0fff; + if ((Code & 0x0e00) == 0xe00) Code = (Code & 0x1ff) | (BgPic << 9); + x = 8 * mx; + y = 8 * my; + y -= 16; + + if (x > 7 && x < 248 && y > 7 && y < 216) { + Render8x8Tile(pTransDraw, Code, x, y, Colour, 4, 0, NewsTiles); + } else { + Render8x8Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0, NewsTiles); + } + + TileIndex++; + } + } +} + +void NewsRenderFgLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + Code = (NewsFgVideoRam[TileIndex * 2] << 8) | NewsFgVideoRam[TileIndex * 2 + 1]; + Colour = (Code & 0xf000) >> 12; + Code &= 0x0fff; + x = 8 * mx; + y = 8 * my; + y -= 16; + + if (x > 7 && x < 248 && y > 7 && y < 216) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, NewsTiles); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, NewsTiles); + } + + TileIndex++; + } + } +} + +void NewsDraw() +{ + NewsRenderBgLayer(); + NewsRenderFgLayer(); + BurnTransferCopy(NewsPalette); +} + +// Frame Function +INT32 NewsFrame() +{ + if (NewsReset) NewsDoReset(); + + NewsMakeInputs(); + + ZetOpen(0); + ZetRun(8000000 / 60); + ZetRaiseIrq(0); + ZetClose(); + + if (pBurnDraw) NewsDraw(); + if (pBurnSoundOut) MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + + return 0; +} + +// Scan RAM +static INT32 NewsScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x02942; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + memset(&ba, 0, sizeof(ba)); + ba.Data = NewsPalette; + ba.nLen = 0x100 * sizeof(UINT32); + ba.szName = "Palette"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); // Scan Z80 + + MSM6295Scan(0, nAction); // Scan OKIM6295 + + // Scan critical driver variables + SCAN_VAR(NewsInput); + SCAN_VAR(NewsDip); + SCAN_VAR(BgPic); + } + + return 0; +} + +// Driver Declaration +struct BurnDriver BurnDrvNews = { + "news", NULL, NULL, NULL, "1993", + "News (set 1)\0", NULL, "Poby / Virus", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 1, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, NewsRomInfo, NewsRomName, NULL, NULL, NewsInputInfo, NewsDIPInfo, + NewsInit, NewsExit, NewsFrame, NULL, NewsScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNewsa = { + "newsa", "news", NULL, NULL, "1993", + "News (set 2)\0", NULL, "Poby / Jeansole", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 1, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, NewsaRomInfo, NewsaRomName, NULL, NULL, NewsInputInfo, NewsaDIPInfo, + NewsInit, NewsExit, NewsFrame, NULL, NewsScan, + NULL, 0x100, 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_nmg5.cpp b/src/burn/drv/pst90s/d_nmg5.cpp index ce778cba5..dd7147c29 100644 --- a/src/burn/drv/pst90s/d_nmg5.cpp +++ b/src/burn/drv/pst90s/d_nmg5.cpp @@ -1,1765 +1,1764 @@ -// FB Alpha NMG5 driver module -// Based on MAME driver by Pierpaolo Prazzoli - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "msm6295.h" - -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvBmpRAM; -static UINT8 *DrvVidRAM0; -static UINT8 *DrvVidRAM1; -static UINT16 *DrvScrRAM; -static UINT32 *DrvPalette; -static UINT32 *Palette; -static UINT8 DrvRecalc; - -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvDips[ 2]; -static UINT8 DrvReset; -static UINT16 DrvInputs[3]; - -static UINT8 DrvOkiBank; -static UINT8 soundlatch; -static UINT8 prot_val; -static UINT8 input_data; -static UINT8 priority_reg; -static UINT8 gfx_bank; - -static struct BurnInputInfo Nmg5InputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy3 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy3 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 6, "p1 fire 3"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 15, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 8, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 9, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 10, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 11, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 12, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 13, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 14, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Nmg5) - -static struct BurnInputInfo SearcheyInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy3 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy3 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p1 fire 2"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 15, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 8, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 9, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 10, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 11, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 12, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 13, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Searchey) - -static struct BurnInputInfo PclubysInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy3 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy3 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 6, "p1 fire 3"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 15, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 8, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 9, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 10, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 11, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 12, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 13, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 14, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Pclubys) - -static struct BurnInputInfo GarogunInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy3 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy3 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p1 fire 2"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Garogun) - -static struct BurnInputInfo Ordi7InputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p1 start" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 2, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 3, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 3"}, - {"P1 Button 4" , BIT_DIGITAL , DrvJoy3 + 1, "p1 fire 4"}, - {"P1 Button 5" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 5"}, - {"P1 Button 6" , BIT_DIGITAL , DrvJoy3 + 10, "p1 fire 6"}, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Ordi7) - -static struct BurnDIPInfo Nmg5DIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xdf, NULL }, - - {0x13, 0xfe, 0, 2, "Game Title" }, - {0x13, 0x01, 0x01, 0x01, "Multi 5" }, - {0x13, 0x01, 0x01, 0x00, "New Multi Game 5" }, - - {0x13, 0xfe, 0, 4, "Crocodiles (Tong Boy)" }, - {0x13, 0x01, 0x06, 0x06, "Pattern 1" }, - {0x13, 0x01, 0x06, 0x02, "Pattern 2" }, - {0x13, 0x01, 0x06, 0x04, "Pattern 3" }, - {0x13, 0x01, 0x06, 0x00, "Pattern 4" }, - - {0x13, 0xfe, 0, 4, "License" }, - {0x13, 0x01, 0x18, 0x00, "New Impeuropex Corp. S.R.L." }, - {0x13, 0x01, 0x18, 0x08, "BNS Enterprises" }, - {0x13, 0x01, 0x18, 0x10, "Nova Games" }, - {0x13, 0x01, 0x18, 0x18, "None" }, - - {0x13, 0xfe, 0, 2, "1P Vs 2P Rounds (Bubble Gum)" }, - {0x13, 0x01, 0x20, 0x20, "Best of 1" }, - {0x13, 0x01, 0x20, 0x00, "Best of 3" }, - - {0x13, 0xfe, 0, 4, "Difficulty" }, - {0x13, 0x01, 0xc0, 0x40, "Easy" }, - {0x13, 0x01, 0xc0, 0xc0, "Normal" }, - {0x13, 0x01, 0xc0, 0x80, "Hard" }, - {0x13, 0x01, 0xc0, 0x00, "Hardest" }, - - {0x14, 0xfe, 0, 4, "Coin B" }, - {0x14, 0x01, 0x03, 0x02, "2C 1C" }, - {0x14, 0x01, 0x03, 0x03, "1C 1C" }, - {0x14, 0x01, 0x03, 0x00, "2C 3C" }, - {0x14, 0x01, 0x03, 0x01, "1C 2C" }, -// {0x14, 0x01, 0x03, 0x03, "1C 1C" }, -// {0x14, 0x01, 0x03, 0x01, "1C 3C" }, -// {0x14, 0x01, 0x03, 0x02, "1C 4C" }, -// {0x14, 0x01, 0x03, 0x00, "1C 6C" }, - - {0x14, 0xfe, 0, 4, "Coin A" }, - {0x14, 0x01, 0x0c, 0x08, "2C 1C" }, - {0x14, 0x01, 0x0c, 0x0c, "1C 1C" }, - {0x14, 0x01, 0x0c, 0x00, "2C 3C" }, - {0x14, 0x01, 0x0c, 0x04, "1C 2C" }, -// {0x14, 0x01, 0x0c, 0x00, "4C 1C" }, -// {0x14, 0x01, 0x0c, 0x08, "3C 1C" }, -// {0x14, 0x01, 0x0c, 0x04, "2C 1C" }, -// {0x14, 0x01, 0x0c, 0x0c, "1C 1C" }, - - {0x14, 0xfe, 0, 2, "Demo Sounds" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0x14, 0xfe, 0, 2, "Coin Type" }, - {0x14, 0x01, 0x40, 0x40, "1" }, - {0x14, 0x01, 0x40, 0x00, "2" }, - - {0x14, 0xfe, 0, 2, "Service Mode" }, - {0x14, 0x01, 0x80, 0x00, "Off" }, - {0x14, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Nmg5) - -static struct BurnDIPInfo SearcheyDIPList[]= -{ - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xdd, NULL }, - - {0 , 0xfe, 0, 4, "Timer Speed" }, - {0x10, 0x01, 0x03, 0x03, "Slowest" }, - {0x10, 0x01, 0x03, 0x02, "Slow" }, - {0x10, 0x01, 0x03, 0x01, "Fast" }, - {0x10, 0x01, 0x03, 0x00, "Fastest" }, - - {0x10, 0xfe, 0, 4, "Helps" }, - {0x10, 0x01, 0x0c, 0x0c, "1" }, - {0x10, 0x01, 0x0c, 0x08, "2" }, - {0x10, 0x01, 0x0c, 0x04, "3" }, - {0x10, 0x01, 0x0c, 0x00, "4" }, - - {0x10, 0xfe, 0, 4, "Lives" }, - {0x10, 0x01, 0x30, 0x20, "3" }, - {0x10, 0x01, 0x30, 0x10, "4" }, - {0x10, 0x01, 0x30, 0x30, "5" }, - {0x10, 0x01, 0x30, 0x00, "6" }, - - {0x10, 0xfe, 0, 4, "Coinage" }, - {0x10, 0x01, 0xc0, 0x00, "3C 1C" }, - {0x10, 0x01, 0xc0, 0x40, "2C 1C" }, - {0x10, 0x01, 0xc0, 0xc0, "1C 1C" }, - {0x10, 0x01, 0xc0, 0x80, "1C 2C" }, - - {0x11, 0xfe, 0, 2, "Service Mode" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0x11, 0xfe, 0, 2, "Demo Sounds" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0x11, 0xfe, 0, 2, "Language" }, - {0x11, 0x01, 0x20, 0x00, "English" }, - {0x11, 0x01, 0x20, 0x20, "Korean" }, - - {0x11, 0xfe, 0, 2, "Items to find" }, - {0x11, 0x01, 0x80, 0x00, "Less" }, - {0x11, 0x01, 0x80, 0x80, "More" }, -}; - -STDDIPINFO(Searchey) - -static struct BurnDIPInfo Searchp2DIPList[]= -{ - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xf7, NULL }, - - {0x10, 0xfe, 0, 4, "Timer Speed" }, - {0x10, 0x01, 0x03, 0x03, "Slowest" }, - {0x10, 0x01, 0x03, 0x02, "Slow" }, - {0x10, 0x01, 0x03, 0x01, "Fast" }, - {0x10, 0x01, 0x03, 0x00, "Fastest" }, - - {0x10, 0xfe, 0, 4, "Helps" }, - {0x10, 0x01, 0x0c, 0x0c, "1" }, - {0x10, 0x01, 0x0c, 0x08, "2" }, - {0x10, 0x01, 0x0c, 0x04, "3" }, - {0x10, 0x01, 0x0c, 0x00, "4" }, - - {0x10, 0xfe, 0, 4, "Lives" }, - {0x10, 0x01, 0x30, 0x20, "3" }, - {0x10, 0x01, 0x30, 0x10, "4" }, - {0x10, 0x01, 0x30, 0x30, "5" }, - {0x10, 0x01, 0x30, 0x00, "6" }, - - {0x10, 0xfe, 0, 4, "Coinage" }, - {0x10, 0x01, 0xc0, 0x00, "3C 1C" }, - {0x10, 0x01, 0xc0, 0x40, "2C 1C" }, - {0x10, 0x01, 0xc0, 0xc0, "1C 1C" }, - {0x10, 0x01, 0xc0, 0x80, "1C 2C" }, - - {0x11, 0xfe, 0, 2, "Service Mode" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0x11, 0xfe, 0, 4, "Lucky Chance" }, - {0x11, 0x01, 0x06, 0x06, "Table 1" }, - {0x11, 0x01, 0x06, 0x04, "Table 2" }, - {0x11, 0x01, 0x06, 0x02, "Table 3" }, - {0x11, 0x01, 0x06, 0x00, "Table 4" }, - - {0x11, 0xfe, 0, 8, "Language" }, - {0x11, 0x01, 0x38, 0x38, "Korean" }, - {0x11, 0x01, 0x38, 0x30, "English" }, - {0x11, 0x01, 0x38, 0x28, "Japanese" }, - {0x11, 0x01, 0x38, 0x20, "Chinese" }, - {0x11, 0x01, 0x38, 0x18, "Italian" }, - {0x11, 0x01, 0x38, 0x10, "Korean" }, - {0x11, 0x01, 0x38, 0x08, "Korean" }, - {0x11, 0x01, 0x38, 0x00, "Korean" }, - - {0x11, 0xfe, 0, 2, "Lucky Timer" }, - {0x11, 0x01, 0x40, 0x00, "Less" }, - {0x11, 0x01, 0x40, 0x40, "More" }, - - {0x11, 0xfe, 0, 2, "Items to find" }, - {0x11, 0x01, 0x80, 0x00, "Less" }, - {0x11, 0x01, 0x80, 0x80, "More" }, -}; - -STDDIPINFO(Searchp2) - -static struct BurnDIPInfo PclubysDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0x12, 0xfe, 0, 2, "Lives (Mad Ball)" }, - {0x12, 0x01, 0x01, 0x00, "3" }, - {0x12, 0x01, 0x01, 0x01, "4" }, - - {0x12, 0xfe, 0, 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0x12, 0xfe, 0, 2, "1P Vs 2P Rounds" }, - {0x12, 0x01, 0x04, 0x00, "Best of 1" }, - {0x12, 0x01, 0x04, 0x04, "Best of 3" }, - - {0x12, 0xfe, 0, 2, "Nudity" }, - {0x12, 0x01, 0x08, 0x08, "Soft only" }, - {0x12, 0x01, 0x08, 0x00, "Soft and Hard" }, - - {0x12, 0xfe, 0, 4, "Difficulty" }, - {0x12, 0x01, 0x30, 0x30, "Easy" }, - {0x12, 0x01, 0x30, 0x20, "Normal" }, - {0x12, 0x01, 0x30, 0x10, "Hard" }, - {0x12, 0x01, 0x30, 0x00, "Hardest" }, - - {0x12, 0xfe, 0, 4, "Coinage" }, - {0x12, 0x01, 0xc0, 0x00, "3C 1C" }, - {0x12, 0x01, 0xc0, 0x40, "2C 1C" }, - {0x12, 0x01, 0xc0, 0xc0, "1C 1C" }, - {0x12, 0x01, 0xc0, 0x80, "1C 2C" }, - - {0x13, 0xfe, 0, 2, "Service Mode" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0x13, 0xfe, 0, 4, "Timer Speed (Magic Eye)" }, - {0x13, 0x01, 0x30, 0x30, "Slowest" }, - {0x13, 0x01, 0x30, 0x20, "Slow" }, - {0x13, 0x01, 0x30, 0x10, "Fast" }, - {0x13, 0x01, 0x30, 0x00, "Fastest" }, - - {0x13, 0xfe, 0, 2, "Lives (Magic Eye)" }, - {0x13, 0x01, 0x40, 0x00, "3" }, - {0x13, 0x01, 0x40, 0x40, "4" }, - - {0x13, 0xfe, 0, 2, "Timer Speed (Box Logic)" }, - {0x13, 0x01, 0x80, 0x80, "Slow" }, - {0x13, 0x01, 0x80, 0x00, "Fast" }, -}; - -STDDIPINFO(Pclubys) - -static struct BurnDIPInfo GarogunDIPList[]= -{ - {0x09, 0xff, 0xff, 0xff, NULL }, - {0x0a, 0xff, 0xff, 0xfd, NULL }, - - {0x09, 0xfe, 0, 4, "Helps" }, - {0x09, 0x01, 0x03, 0x00, "1" }, - {0x09, 0x01, 0x03, 0x01, "2" }, - {0x09, 0x01, 0x03, 0x02, "3" }, - {0x09, 0x01, 0x03, 0x03, "4" }, - - {0x09, 0xfe, 0, 4, "Timer Speed (Bonus Levels)" }, - {0x09, 0x01, 0x0c, 0x0c, "Slowest" }, - {0x09, 0x01, 0x0c, 0x08, "Slow" }, - {0x09, 0x01, 0x0c, 0x04, "Fast" }, - {0x09, 0x01, 0x0c, 0x00, "Fastest" }, - - {0x09, 0xfe, 0, 4, "Timer Speed (Main Levels)" }, - {0x09, 0x01, 0x30, 0x30, "Slowest" }, - {0x09, 0x01, 0x30, 0x20, "Slow" }, - {0x09, 0x01, 0x30, 0x10, "Fast" }, - {0x09, 0x01, 0x30, 0x00, "Fastest" }, - - {0x09, 0xfe, 0, 4, "Coinage" }, - {0x09, 0x01, 0xc0, 0x00, "3C 1C" }, - {0x09, 0x01, 0xc0, 0x40, "2C 1C" }, - {0x09, 0x01, 0xc0, 0xc0, "1C 1C" }, - {0x09, 0x01, 0xc0, 0x80, "1C 2C" }, - - {0x0a, 0xfe, 0, 2, "Service Mode" }, - {0x0a, 0x01, 0x01, 0x01, "Off" }, - {0x0a, 0x01, 0x01, 0x00, "On" }, - - {0x0a, 0xfe, 0, 2, "Demo Sounds" }, - {0x0a, 0x01, 0x02, 0x02, "Off" }, - {0x0a, 0x01, 0x02, 0x00, "On" }, -}; - -STDDIPINFO(Garogun) - -static struct BurnDIPInfo Ordi7DIPList[]= -{ - {0x09, 0xff, 0xff, 0xff, NULL }, - {0x0a, 0xff, 0xff, 0xff, NULL }, - - {0x09, 0xfe, 0, 2, "High-Low Error" }, - {0x09, 0x01, 0x01, 0x01, "-500" }, - {0x09, 0x01, 0x01, 0x00, "Lose All" }, - - {0x09, 0xfe, 0, 2, "Minimum Credits" }, - {0x09, 0x01, 0x02, 0x02, "300" }, - {0x09, 0x01, 0x02, 0x00, "500" }, - - {0x09, 0xfe, 0, 4, "Credit Limit" }, - {0x09, 0x01, 0x0c, 0x0c, "10000" }, - {0x09, 0x01, 0x0c, 0x08, "30000" }, - {0x09, 0x01, 0x0c, 0x04, "50000" }, - {0x09, 0x01, 0x0c, 0x00, "100000" }, - - {0x09, 0xfe, 0, 4, "Bet" }, - {0x09, 0x01, 0x30, 0x30, "50 Credits" }, - {0x09, 0x01, 0x30, 0x20, "100 Credits" }, - {0x09, 0x01, 0x30, 0x10, "150 Credits" }, - {0x09, 0x01, 0x30, 0x00, "200 Credits" }, - - {0x09, 0xfe, 0, 4, "Coinage" }, - {0x09, 0x01, 0xc0, 0xc0, "1 Coin 50 Credits" }, - {0x09, 0x01, 0xc0, 0x80, "1 Coin 100 Credits" }, - {0x09, 0x01, 0xc0, 0x40, "1 Coin 500 Credits" }, - {0x09, 0x01, 0xc0, 0x00, "1 Coin 1000 Credits" }, - - {0x0a, 0xfe, 0, 2, "Service Mode" }, - {0x0a, 0x01, 0x01, 0x01, "Off" }, - {0x0a, 0x01, 0x01, 0x00, "On" }, - - {0x0a, 0xfe, 0, 2, "Winnings" }, - {0x0a, 0x01, 0x04, 0x04, "Medals and Credits" }, - {0x0a, 0x01, 0x04, 0x00, "Credits only" }, - - {0x0a, 0xfe, 0, 4, "Medals Table" }, - {0x0a, 0x01, 0x18, 0x18, "x1.0" }, - {0x0a, 0x01, 0x18, 0x10, "x1.4" }, - {0x0a, 0x01, 0x18, 0x08, "x2.0" }, - {0x0a, 0x01, 0x18, 0x00, "x3.0" }, - - {0x0a, 0xfe, 0, 8, "Payout %" }, - {0x0a, 0x01, 0xe0, 0xe0, "90%" }, - {0x0a, 0x01, 0xe0, 0xc0, "85%" }, - {0x0a, 0x01, 0xe0, 0xa0, "80%" }, - {0x0a, 0x01, 0xe0, 0x80, "75%" }, - {0x0a, 0x01, 0xe0, 0x60, "70%" }, - {0x0a, 0x01, 0xe0, 0x40, "65%" }, - {0x0a, 0x01, 0xe0, 0x20, "60%" }, - {0x0a, 0x01, 0xe0, 0x00, "55%" }, -}; - -STDDIPINFO(Ordi7) - -static struct BurnDIPInfo WondstckDIPList[]= -{ - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xfd, NULL }, - - {0x10, 0xfe, 0, 2, "Helps" }, - {0x10, 0x01, 0x10, 0x10, "3" }, - {0x10, 0x01, 0x10, 0x00, "5" }, - - {0x10, 0xfe, 0, 2, "Lives" }, - {0x10, 0x01, 0x20, 0x20, "3" }, - {0x10, 0x01, 0x20, 0x00, "5" }, - - {0x10, 0xfe, 0, 4, "Coinage" }, - {0x10, 0x01, 0xc0, 0x00, "3C 1C" }, - {0x10, 0x01, 0xc0, 0x40, "2C 1C" }, - {0x10, 0x01, 0xc0, 0xc0, "1C 1C" }, - {0x10, 0x01, 0xc0, 0x80, "1C 2C" }, - - {0x11, 0xfe, 0, 2, "Service Mode" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0x11, 0xfe, 0, 2, "Demo Sounds" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0x11, 0xfe, 0, 4, "Difficulty" }, - {0x11, 0x01, 0xc0, 0x80, "Easy" }, - {0x11, 0x01, 0xc0, 0xc0, "Normal" }, - {0x11, 0x01, 0xc0, 0x40, "Hard" }, - {0x11, 0x01, 0xc0, 0x00, "Hardest" }, -}; - -STDDIPINFO(Wondstck) - -//----------------------------------------------------------------------------------------------- - -static void palette_write(INT32 offset) -{ - INT32 data = *((UINT16*)(DrvPalRAM + offset)); - - INT32 r = (data >> 0) & 0x1f; - INT32 g = (data >> 5) & 0x1f; - INT32 b = (data >> 10) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - Palette[offset>>1] = (r << 16) | (g << 8) | b; - DrvPalette[offset>>1] = BurnHighCol(r, g, b, 0); -} - -void __fastcall nmg5_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfffff800) == 0x140000) { - DrvPalRAM[address & 0x7ff] = data; - palette_write(address & 0x7ff); - return; - } - - switch (address) - { - case 0x180000: - case 0x180001: - soundlatch = data; - ZetNmi(); - return; - - case 0x180004: - case 0x180005: - input_data = data & 0xf; - return; - - case 0x180006: - case 0x180007: - gfx_bank = data & 3; - return; - - case 0x18000e: - case 0x18000f: - priority_reg = data & 7; - return; - - case 0x300002: - case 0x300003: - case 0x300004: - case 0x300005: - case 0x300006: - case 0x300007: - case 0x300008: - case 0x300009: - *((UINT8*)(DrvScrRAM + ((address - 2) & 7))) = data; - return; - } - - return; -} - -void __fastcall nmg5_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfffff800) == 0x140000) { - *((UINT16*)(DrvPalRAM + (address & 0x7ff))) = data; - palette_write(address & 0x7ff); - return; - } - - switch (address) - { - case 0x180000: - soundlatch = data; - ZetNmi(); - return; - - case 0x180004: - input_data = data & 0xf; - return; - - case 0x180006: - gfx_bank = data & 3; - return; - - case 0x18000e: - priority_reg = data & 7; - return; - - case 0x300002: - case 0x300004: - case 0x300006: - case 0x300008: - DrvScrRAM[(address - 0x300002) >> 1] = data & 0x1ff; - return; - } - - return; -} - -UINT8 __fastcall nmg5_read_byte(UINT32 address) -{ - switch (address) - { - case 0x180004: - case 0x180005: - return prot_val | input_data; - - case 0x180008: - return DrvInputs[0] >> 8; - - case 0x180009: - return DrvInputs[0]; - - case 0x18000a: - return DrvInputs[1] >> 8; - - case 0x18000b: - return DrvInputs[1] & ~0x50; - - case 0x18000c: - return DrvInputs[2] >> 8; - - case 0x18000d: - return DrvInputs[2]; - } - - return 0; -} - -UINT16 __fastcall nmg5_read_word(UINT32 address) -{ - switch (address) - { - case 0x180004: - return prot_val | input_data; - - case 0x180008: - return DrvInputs[0]; - - case 0x18000a: - return DrvInputs[1] & ~0x50; - - case 0x18000c: - return DrvInputs[2]; - } - - return 0; -} - -//----------------------------------------------------------------------------------------------- - -void __fastcall pclubys_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfffff800) == 0x440000) { - DrvPalRAM[address & 0x7ff] = data; - palette_write(address & 0x7ff); - return; - } - - switch (address) - { - case 0x480000: - case 0x480001: - soundlatch = data; - ZetNmi(); - return; - - case 0x480004: - case 0x480005: - input_data = data & 0xf; - return; - - case 0x480006: - case 0x480007: - gfx_bank = data & 3; - return; - - case 0x48000e: - case 0x48000f: - priority_reg = data & 7; - return; - - case 0x500002: - case 0x500003: - case 0x500004: - case 0x500005: - case 0x500006: - case 0x500007: - case 0x500008: - case 0x500009: - *((UINT8*)(DrvScrRAM + ((address - 0x500002) & 7))) = data; - return; - } - - return; -} - -void __fastcall pclubys_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfffff800) == 0x440000) { - *((UINT16*)(DrvPalRAM + (address & 0x7ff))) = data; - palette_write(address & 0x7ff); - return; - } - - switch (address) - { - case 0x480000: - soundlatch = data; - ZetNmi(); - return; - - case 0x480004: - input_data = data & 0xf; - return; - - case 0x480006: - gfx_bank = data & 3; - return; - - case 0x48000e: - priority_reg = data & 7; - return; - - case 0x500002: - case 0x500004: - case 0x500006: - case 0x500008: - DrvScrRAM[(address - 0x500002) >> 1] = data; - return; - } - - return; -} - -UINT8 __fastcall pclubys_read_byte(UINT32 address) -{ - switch (address) - { - case 0x480004: - case 0x480005: - return prot_val | input_data; - - case 0x480008: - return DrvInputs[0] >> 8; - - case 0x480009: - return DrvInputs[0]; - - case 0x48000a: - return DrvInputs[1] >> 8; - - case 0x48000b: - return DrvInputs[1]; - - case 0x48000c: - return DrvInputs[2] >> 8; - - case 0x48000d: - return DrvInputs[2]; - } - - return 0; -} - -UINT16 __fastcall pclubys_read_word(UINT32 address) -{ - switch (address) - { - case 0x480004: - return prot_val | input_data; - - case 0x480008: - return DrvInputs[0]; - - case 0x48000a: - return DrvInputs[1]; - - case 0x48000c: - return DrvInputs[2]; - } - - return 0; -} - -//----------------------------------------------------------------------------------------------- - -void __fastcall nmg5_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - DrvOkiBank = data & 1; - MSM6295ROM = DrvSndROM + (DrvOkiBank ? 0x40000 : 0); - return; - - case 0x10: - BurnYM3812Write(0, data); - return; - - case 0x11: - BurnYM3812Write(1, data); - return; - - case 0x1c: - MSM6295Command(0, data); - return; - } - - return; -} - -UINT8 __fastcall nmg5_read_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x10: - return BurnYM3812Read(0); - - case 0x18: - return soundlatch; - - case 0x1c: - return MSM6295ReadStatus(0); - } - - return 0; -} - -//----------------------------------------------------------------------------------------------- - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x0100000; - DrvZ80ROM = Next; Next += 0x0010000; - - DrvGfxROM0 = Next; Next += 0x1000000; - DrvGfxROM1 = Next; Next += 0x0400000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x0080000; - - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x0010000; - DrvZ80RAM = Next; Next += 0x0000800; - - DrvPalRAM = Next; Next += 0x0000800; - - DrvSprRAM = Next; Next += 0x0000800; - - DrvVidRAM0 = Next; Next += 0x0002000; - DrvVidRAM1 = Next; Next += 0x0002000; - - DrvBmpRAM = Next; Next += 0x0010000; - - DrvScrRAM = (UINT16*)Next; Next += 0x0000004 * sizeof(UINT16); - - Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - priority_reg = 7; - - soundlatch = 0; - input_data = 0; - gfx_bank = 0; - DrvOkiBank = 0; - MSM6295ROM = DrvSndROM; - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM3812Reset(); - - return 0; -} - -static INT32 DrvGfxDecode(INT32 type) -{ - static INT32 Planes0[8] = { - 0x1C00000, 0x1800000, 0x1400000, 0x1000000, - 0x0c00000, 0x0800000, 0x0400000, 0x0000000 - }; - - static INT32 XOffs0[8] = { - 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 - }; - - static INT32 YOffs0[8] = { - 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038 - }; - - static INT32 Planes0a[8] = { - 0x2000008, 0x4000000, 0x0000008, 0x0000000, - 0x6000008, 0x6000000, 0x4000008, 0x2000000 - }; - - static INT32 XOffs0a[8] = { - 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 - }; - - static INT32 YOffs0a[8] = { - 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070 - }; - - static INT32 Planes1[5] = { - 0x0800000, 0x0c00000, 0x0400000, 0x1000000, 0x0000000 - }; - - static INT32 XOffs1[16] = { - 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000, - 0x087, 0x086, 0x085, 0x084, 0x083, 0x082, 0x081, 0x080 - }; - - static INT32 YOffs1[16] = { - 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, - 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 - }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x1000000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x1000000); - - if (type) { - GfxDecode(0x40000, 8, 8, 8, Planes0a, XOffs0a, YOffs0a, 0x080, tmp, DrvGfxROM0); - } else { - GfxDecode(0x10000, 8, 8, 8, Planes0, XOffs0, YOffs0, 0x040, tmp, DrvGfxROM0); - } - - memcpy (tmp, DrvGfxROM1, 0x400000); - - GfxDecode(0x04000, 5, 16, 16, Planes1, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvInit(INT32 loadtype, INT32 sektype, INT32 zettype) // 0 nmg, 1 pclubys -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - if (loadtype) { - for (INT32 i = 0; i < 4; i++) { - if (BurnLoadRom(DrvGfxROM0 + i * 0x400000, i + 3, 1)) return 1; - } - - for (INT32 i = 0; i < 5; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x080000, i + 7, 1)) return 1; - } - - if (BurnLoadRom(DrvSndROM, 12, 1)) return 1; - } else { - for (INT32 i = 0; i < 8; i++) { - if (BurnLoadRom(DrvGfxROM0 + i * 0x80000, i + 3, 1)) return 1; - } - - for (INT32 i = 0; i < 5; i++) { - if (BurnLoadRom(DrvGfxROM1 + i * 0x80000, i + 11, 1)) return 1; - } - - if (BurnLoadRom(DrvSndROM, 16, 1)) return 1; - } - - DrvGfxDecode(loadtype); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(DrvBmpRAM, 0x800000, 0x80ffff, SM_RAM); - if (sektype) { - SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x440000, 0x4407ff, SM_ROM); - SekMapMemory(DrvSprRAM, 0x460000, 0x4607ff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x520000, 0x521fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x522000, 0x523fff, SM_RAM); - SekSetWriteByteHandler(0, pclubys_write_byte); - SekSetWriteWordHandler(0, pclubys_write_word); - SekSetReadByteHandler(0, pclubys_read_byte); - SekSetReadWordHandler(0, pclubys_read_word); - } else { - SekMapMemory(Drv68KRAM, 0x120000, 0x12ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x140000, 0x1407ff, SM_ROM); - SekMapMemory(DrvSprRAM, 0x160000, 0x1607ff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x320000, 0x321fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x322000, 0x323fff, SM_RAM); - SekSetWriteByteHandler(0, nmg5_write_byte); - SekSetWriteWordHandler(0, nmg5_write_word); - SekSetReadByteHandler(0, nmg5_read_byte); - SekSetReadWordHandler(0, nmg5_read_word); - } - SekClose(); - - ZetInit(0); - ZetOpen(0); - if (zettype) { - ZetMapArea(0x0000, 0xf7ff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xf7ff, 2, DrvZ80ROM); - ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM); - ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM); - ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); - } else { - ZetMapArea(0x0000, 0xdfff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xdfff, 2, DrvZ80ROM); - ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM); - ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM); - ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM); - } - ZetSetInHandler(nmg5_read_port); - ZetSetOutHandler(nmg5_write_port); - ZetMemEnd(); - ZetClose(); - - BurnYM3812Init(4000000, &DrvFMIRQHandler, &DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3812(4000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 1000000 / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - MSM6295Exit(0); - BurnYM3812Exit(); - - GenericTilesExit(); - ZetExit(); - SekExit(); - - BurnFree (AllMem); - - return 0; -} - -//----------------------------------------------------------------------------------------------- - -static void draw_bitmap() -{ - UINT16 x,y,count; - INT32 pix; - - UINT16 *bitmap = (UINT16*)DrvBmpRAM; - - for (y = 0, count = 0; y < 256; y++) - { - for(x = 0; x < 128; x++, count++) - { - if (!bitmap[count]) continue; - - INT32 ofst = ((y - 9) * nScreenWidth) + ((x << 2) - 12); - - pix = bitmap[count] >> 12; - if (pix) pTransDraw[ofst ] = pix | 0x300; - - pix = (bitmap[count]&0x0f00)>>8; - if (pix) pTransDraw[ofst | 1] = pix | 0x300; - - pix = (bitmap[count]&0x00f0)>>4; - if (pix) pTransDraw[ofst | 2] = pix | 0x300; - - pix = bitmap[count] & 0x000f; - if (pix) pTransDraw[ofst | 3] = pix | 0x300; - } - } -} - -static void DrawTiles(UINT8 *vidram, INT32 color, INT32 transp, INT32 scrollx, INT32 scrolly) -{ - UINT16 *vram = (UINT16*)vidram; - - for (INT32 offs = 0; offs < 0x2000 / 2; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - INT32 code = vram[offs] | (gfx_bank << 16); - - sx -= scrollx; - sy -= scrolly; - if (sx < -7) sx += 0x200; - if (sy < -7) sy += 0x200; - - if (transp) { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 8, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 8, 0, DrvGfxROM0); - } - } -} - -static void draw_sprites() -{ - UINT16 *spriteram16 = (UINT16*)DrvSprRAM; - - for (INT32 offs = 0;offs < 0x800/2;offs += 4) - { - INT32 sx = spriteram16[offs + 2] & 0x1ff; - INT32 sy = spriteram16[offs]; - INT32 code = spriteram16[offs + 1]; - INT32 color = (spriteram16[offs + 2] >> 9) & 0xf; - INT32 height = 1 << ((sy & 0x0600) >> 9); - INT32 flipx = sy & 0x2000; - INT32 flipy = sy & 0x4000; - - for (INT32 y = 0;y < height;y++) - { - INT32 yy = 248 - ((sy + ((height - y) << 4)) & 0x1ff); - - INT32 tile = code + (flipy ? height-1-y : y); - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, tile, sx, yy, color, 5, 0, 0x200, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, tile, sx, yy, color, 5, 0, 0x200, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, tile, sx, yy, color, 5, 0, 0x200, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, tile, sx, yy, color, 5, 0, 0x200, DrvGfxROM1); - } - } - - if (sx < 0x1f1) continue; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, tile, sx - 512, yy, color, 5, 0, 0x200, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, tile, sx - 512, yy, color, 5, 0, 0x200, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, tile, sx - 512, yy, color, 5, 0, 0x200, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, tile, sx - 512, yy, color, 5, 0, 0x200, DrvGfxROM1); - } - } - } - } -} - - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - DrawTiles(DrvVidRAM0, 1, 0, DrvScrRAM[2]+3, DrvScrRAM[3]+9); - - if(priority_reg == 0) - { - draw_sprites(); - DrawTiles(DrvVidRAM1, 0, 1, DrvScrRAM[0]-1, DrvScrRAM[1]+9); - draw_bitmap(); - } - else if(priority_reg == 1) - { - draw_bitmap(); - draw_sprites(); - DrawTiles(DrvVidRAM1, 0, 1, DrvScrRAM[0]-1, DrvScrRAM[1]+9); - } - else if(priority_reg == 2) - { - draw_sprites(); - draw_bitmap(); - DrawTiles(DrvVidRAM1, 0, 1, DrvScrRAM[0]-1, DrvScrRAM[1]+9); - } - else if(priority_reg == 3) - { - DrawTiles(DrvVidRAM1, 0, 1, DrvScrRAM[0]-1, DrvScrRAM[1]+9); - draw_sprites(); - draw_bitmap(); - } - else if(priority_reg == 7) - { - DrawTiles(DrvVidRAM1, 0, 1, DrvScrRAM[0]-1, DrvScrRAM[1]+9); - draw_bitmap(); - draw_sprites(); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - - - -static INT32 DrvFrame() -{ - INT32 nTotalCycles[2] = { 16000000 / 60, 4000000 / 60 }; - - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 6); - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[1] ^= DrvJoy2[i] << i; - DrvInputs[2] ^= DrvJoy3[i] << i; - } - - DrvInputs[0] = (DrvDips[1] << 8) | DrvDips[0]; - } - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - SekRun(nTotalCycles[0]); - - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - BurnTimerEndFrameYM3812(nTotalCycles[1]); - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -//----------------------------------------------------------------------------------------------- - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029692; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - BurnYM3812Scan(nAction, pnMin); - MSM6295Scan(0, nAction); -// BurnTimerScan(nAction, pnMin); - - SCAN_VAR(soundlatch); - SCAN_VAR(prot_val); - SCAN_VAR(input_data); - SCAN_VAR(priority_reg); - SCAN_VAR(gfx_bank); - SCAN_VAR(DrvOkiBank); - } - - if (nAction & ACB_WRITE) { - nmg5_write_port(0, DrvOkiBank); - } - - return 0; -} - -//----------------------------------------------------------------------------------------------- - -// Multi 5 / New Multi Game 5 - -static struct BurnRomInfo nmg5RomDesc[] = { - { "ub15.bin", 0x80000, 0x36af3e2f, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "ub16.bin", 0x80000, 0x2d9923d4, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "xh15.bin", 0x10000, 0x12d047c4, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "srom1.bin", 0x80000, 0x6771b694, 3 | BRF_GRA }, // 3 - Tiles - { "srom2.bin", 0x80000, 0x362d33af, 3 | BRF_GRA }, // 4 - { "srom3.bin", 0x80000, 0x8bad69d1, 3 | BRF_GRA }, // 5 - { "srom4.bin", 0x80000, 0xe73a7fcb, 3 | BRF_GRA }, // 6 - { "srom5.bin", 0x80000, 0x7300494e, 3 | BRF_GRA }, // 7 - { "srom6.bin", 0x80000, 0x74b5fdf9, 3 | BRF_GRA }, // 8 - { "srom7.bin", 0x80000, 0xbd2b9036, 3 | BRF_GRA }, // 9 - { "srom8.bin", 0x80000, 0xdd38360e, 3 | BRF_GRA }, // 10 - - { "uf1.bin", 0x40000, 0x9a9fb6f4, 4 | BRF_GRA }, // 11 - Sprites - { "uf2.bin", 0x40000, 0x66954d63, 4 | BRF_GRA }, // 12 - { "ufa1.bin", 0x40000, 0xba73ed2d, 4 | BRF_GRA }, // 13 - { "uh1.bin", 0x40000, 0xf7726e8e, 4 | BRF_GRA }, // 14 - { "uj1.bin", 0x40000, 0x54f7486e, 4 | BRF_GRA }, // 15 - - { "xra1.bin", 0x20000, 0xc74a4f3e, 5 | BRF_SND }, // 16 - Samples -}; - -STD_ROM_PICK(nmg5) -STD_ROM_FN(nmg5) - -static INT32 Nmg5Init() -{ - prot_val = 0x10; - - return DrvInit(0,0,0); -} - -struct BurnDriver BurnDrvNmg5 = { - "nmg5", NULL, NULL, NULL, "1998", - "Multi 5 / New Multi Game 5\0", NULL, "Yun Sung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, nmg5RomInfo, nmg5RomName, NULL, NULL, Nmg5InputInfo, Nmg5DIPInfo, - Nmg5Init, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x400, 320, 240, 4, 3 -}; - - -// Multi 5 / New Multi Game 5 (earlier) - -static struct BurnRomInfo nmg5eRomDesc[] = { - { "ub15.rom", 0x80000, 0x578516e2, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "ub16.rom", 0x80000, 0x12fab483, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "xh15.bin", 0x10000, 0x12d047c4, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "srom1.rom", 0x80000, 0x6df3e0c2, 3 | BRF_GRA }, // 3 - Tiles - { "srom2.rom", 0x80000, 0x3caf65f9, 3 | BRF_GRA }, // 4 - { "srom3.rom", 0x80000, 0x812f3f87, 3 | BRF_GRA }, // 5 - { "srom4.rom", 0x80000, 0xedb8299d, 3 | BRF_GRA }, // 6 - { "srom5.rom", 0x80000, 0x79821f18, 3 | BRF_GRA }, // 7 - { "srom6.rom", 0x80000, 0x7e37abaf, 3 | BRF_GRA }, // 8 - { "srom7.rom", 0x80000, 0xb7a9c660, 3 | BRF_GRA }, // 9 - { "srom8.rom", 0x80000, 0xd7ba6058, 3 | BRF_GRA }, // 10 - - { "uf1.rom", 0x40000, 0x502dbd65, 4 | BRF_GRA }, // 11 - Sprites - { "uf2.rom", 0x40000, 0x6744cca0, 4 | BRF_GRA }, // 12 - { "ufa1.rom", 0x40000, 0x7110677f, 4 | BRF_GRA }, // 13 - { "uh1.rom", 0x40000, 0xf6a3ef4d, 4 | BRF_GRA }, // 14 - { "uj1.rom", 0x40000, 0x0595d8ef, 4 | BRF_GRA }, // 15 - - { "xra1.bin", 0x20000, 0xc74a4f3e, 5 | BRF_SND }, // 16 - Samples -}; - -STD_ROM_PICK(nmg5e) -STD_ROM_FN(nmg5e) - -struct BurnDriver BurnDrvNmg5e = { - "nmg5e", "nmg5", NULL, NULL, "1997", - "Multi 5 / New Multi Game 5 (earlier)\0", NULL, "Yun Sung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, nmg5eRomInfo, nmg5eRomName, NULL, NULL, Nmg5InputInfo, Nmg5DIPInfo, - Nmg5Init, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x400, 320, 240, 4, 3 -}; - - -// Search Eye - -static struct BurnRomInfo searcheyRomDesc[] = { - { "u7.bin", 0x40000, 0x287ce3dd, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "u2.bin", 0x40000, 0xb574f033, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "u128.bin", 0x10000, 0x85bae10c, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "u63.bin", 0x80000, 0x1b0b7b7d, 3 | BRF_GRA }, // 3 - Tiles - { "u68.bin", 0x80000, 0xae18b2aa, 3 | BRF_GRA }, // 4 - { "u73.bin", 0x80000, 0xab7f8716, 3 | BRF_GRA }, // 5 - { "u79.bin", 0x80000, 0x7f2c8b83, 3 | BRF_GRA }, // 6 - { "u64.bin", 0x80000, 0x322a903c, 3 | BRF_GRA }, // 7 - { "u69.bin", 0x80000, 0xd546eaf8, 3 | BRF_GRA }, // 8 - { "u74.bin", 0x80000, 0xe6134d84, 3 | BRF_GRA }, // 9 - { "u80.bin", 0x80000, 0x9a160918, 3 | BRF_GRA }, // 10 - - { "u83.bin", 0x20000, 0xc5a1c647, 4 | BRF_GRA }, // 11 - Sprites - { "u82.bin", 0x20000, 0x25b2ae62, 4 | BRF_GRA }, // 12 - { "u105.bin", 0x20000, 0xb4207ef0, 4 | BRF_GRA }, // 13 - { "u96.bin", 0x20000, 0x8c40818a, 4 | BRF_GRA }, // 14 - { "u97.bin", 0x20000, 0x5dc7f231, 4 | BRF_GRA }, // 15 - - { "u137.bin", 0x40000, 0x49105e23, 5 | BRF_SND }, // 16 - Samples -}; - -STD_ROM_PICK(searchey) -STD_ROM_FN(searchey) - -struct BurnDriver BurnDrvSearchey = { - "searchey", NULL, NULL, NULL, "1999", - "Search Eye\0", NULL, "Yun Sung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, searcheyRomInfo, searcheyRomName, NULL, NULL, SearcheyInputInfo, SearcheyDIPInfo, - Nmg5Init, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x400, 320, 240, 4, 3 -}; - - -// Search Eye Plus V2.0 - -static struct BurnRomInfo searchp2RomDesc[] = { - { "u7", 0x080000, 0x37fe9e18, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "u2", 0x080000, 0x8278513b, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "u128", 0x010000, 0x85bae10c, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "0.u1", 0x400000, 0x28a50dcf, 3 | BRF_GRA }, // 3 - Tiles - { "2.u3", 0x400000, 0x30d46e19, 3 | BRF_GRA }, // 4 - { "1.u2", 0x400000, 0xf9c4e824, 3 | BRF_GRA }, // 5 - { "3.u4", 0x400000, 0x619f142f, 3 | BRF_GRA }, // 6 - - { "u83", 0x040000, 0x2bae34cb, 4 | BRF_GRA }, // 7 - Sprites - { "u82", 0x040000, 0x5cb773f0, 4 | BRF_GRA }, // 8 - { "u105", 0x040000, 0xe8adb15e, 4 | BRF_GRA }, // 9 - { "u96", 0x040000, 0x67efb536, 4 | BRF_GRA }, // 10 - { "u97", 0x040000, 0xf7b63826, 4 | BRF_GRA }, // 11 - - { "u137", 0x040000, 0xcd037524, 5 | BRF_SND }, // 12 - Samples -}; - -STD_ROM_PICK(searchp2) -STD_ROM_FN(searchp2) - -static INT32 Searchp2Init() -{ - prot_val = 0x10; - - BurnSetRefreshRate(55); - - return DrvInit(1,0,0); -} - -struct BurnDriver BurnDrvSearchp2 = { - "searchp2", NULL, NULL, NULL, "1999", - "Search Eye Plus V2.0\0", NULL, "Yun Sung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, searchp2RomInfo, searchp2RomName, NULL, NULL, SearcheyInputInfo, Searchp2DIPInfo, - Searchp2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x400, 320, 240, 4, 3 -}; - - -// Puzzle Club (Yun Sung, set 1) - -static struct BurnRomInfo pclubysRomDesc[] = { - { "rom3.7", 0x080000, 0x62e28e6d, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "rom4.2", 0x080000, 0xb51dab41, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "rom1.128", 0x010000, 0x25cd27f8, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "rom10.167", 0x400000, 0xd67e8e84, 3 | BRF_GRA }, // 3 - Tiles - { "rom12.165", 0x400000, 0x6be8b733, 3 | BRF_GRA }, // 4 - { "rom11.166", 0x400000, 0x672501a4, 3 | BRF_GRA }, // 5 - { "rom13.164", 0x400000, 0xfc725ce7, 3 | BRF_GRA }, // 6 - - { "rom8.83", 0x080000, 0x651af101, 4 | BRF_GRA }, // 7 - Sprites - { "rom9.82", 0x080000, 0x2535b4d6, 4 | BRF_GRA }, // 8 - { "rom7.105", 0x080000, 0xf7536c52, 4 | BRF_GRA }, // 9 - { "rom6.95", 0x080000, 0x3c078a52, 4 | BRF_GRA }, // 10 - { "rom5.97", 0x080000, 0x20eae2f8, 4 | BRF_GRA }, // 11 - - { "rom2.137", 0x080000, 0x4ff97ad1, 4 | BRF_SND }, // 12 - Samples -}; - -STD_ROM_PICK(pclubys) -STD_ROM_FN(pclubys) - -static INT32 PclubysInit() -{ - prot_val = 0x10; - - return DrvInit(1,1,1); -} - -struct BurnDriver BurnDrvPclubys = { - "pclubys", NULL, NULL, NULL, "2000", - "Puzzle Club (Yun Sung, set 1)\0", NULL, "Yun Sung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, pclubysRomInfo, pclubysRomName, NULL, NULL, PclubysInputInfo, PclubysDIPInfo, - PclubysInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x400, 320, 240, 4, 3 -}; - - -// Puzzle Club (Yun Sung, set 2) - -static struct BurnRomInfo pclubysaRomDesc[] = { - { "rom3a.7", 0x080000, 0x885aa07a, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "rom4a.2", 0x080000, 0x9bfbdeac, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "rom1.128", 0x010000, 0x25cd27f8, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "rom10.167", 0x400000, 0xd67e8e84, 3 | BRF_GRA }, // 3 - Tiles - { "rom12.165", 0x400000, 0x6be8b733, 3 | BRF_GRA }, // 4 - { "rom11.166", 0x400000, 0x672501a4, 3 | BRF_GRA }, // 5 - { "rom13.164", 0x400000, 0xfc725ce7, 3 | BRF_GRA }, // 6 - - { "rom8.83", 0x080000, 0x651af101, 4 | BRF_GRA }, // 7 - Sprites - { "rom9.82", 0x080000, 0x2535b4d6, 4 | BRF_GRA }, // 8 - { "rom7.105", 0x080000, 0xf7536c52, 4 | BRF_GRA }, // 9 - { "rom6.95", 0x080000, 0x3c078a52, 4 | BRF_GRA }, // 10 - { "rom5.97", 0x080000, 0x20eae2f8, 4 | BRF_GRA }, // 11 - - { "rom2.137", 0x080000, 0x4ff97ad1, 4 | BRF_SND }, // 12 - Samples -}; - -STD_ROM_PICK(pclubysa) -STD_ROM_FN(pclubysa) - -struct BurnDriver BurnDrvPclubysa = { - "pclubysa", "pclubys", NULL, NULL, "2000", - "Puzzle Club (Yun Sung, set 2)\0", NULL, "Yun Sung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, - NULL, pclubysaRomInfo, pclubysaRomName, NULL, NULL, PclubysInputInfo, PclubysDIPInfo, - PclubysInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x400, 320, 240, 4, 3 -}; - - -// Garogun Seroyang (Korea) - -static struct BurnRomInfo garogunRomDesc[] = { - { "p1.u7", 0x80000, 0x9b5627f8, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "p2.u2", 0x80000, 0x1d2ff271, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "rom.u128", 0x10000, 0x117b31ce, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "8.u63", 0x80000, 0x2d152d32, 3 | BRF_GRA }, // 3 - Tiles - { "11.u68", 0x80000, 0x60ec7f67, 3 | BRF_GRA }, // 4 - { "9.u73", 0x80000, 0xa4b16319, 3 | BRF_GRA }, // 5 - { "13.u79", 0x80000, 0x2dc14fb6, 3 | BRF_GRA }, // 6 - { "6.u64", 0x80000, 0xa0fc7547, 3 | BRF_GRA }, // 7 - { "10.u69", 0x80000, 0xe5dc36c3, 3 | BRF_GRA }, // 8 - { "7.u74", 0x80000, 0xa0574f8d, 3 | BRF_GRA }, // 9 - { "12.u80", 0x80000, 0x94d66169, 3 | BRF_GRA }, // 10 - - { "4.u83", 0x40000, 0x3d1d46ff, 4 | BRF_GRA }, // 11 - Sprites - { "5.u82", 0x40000, 0x2a7b2fb5, 4 | BRF_GRA }, // 12 - { "3.u105", 0x40000, 0xcd20e39c, 4 | BRF_GRA }, // 13 - { "2.u96", 0x40000, 0x4df3b502, 4 | BRF_GRA }, // 14 - { "1.u97", 0x40000, 0x591b3efe, 4 | BRF_GRA }, // 15 - - { "s.u137", 0x80000, 0x3eadc21a, 5 | BRF_SND }, // 16 - Samples -}; - -STD_ROM_PICK(garogun) -STD_ROM_FN(garogun) - -static INT32 GarogunInit() -{ - prot_val = 0x40; - - return DrvInit(0,1,1); -} - -struct BurnDriver BurnDrvGarogun = { - "garogun", NULL, NULL, NULL, "2000", - "Garogun Seroyang (Korea)\0", NULL, "Yun Sung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 1, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, - NULL, garogunRomInfo, garogunRomName, NULL, NULL, GarogunInputInfo, GarogunDIPInfo, - GarogunInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x400, 320, 240, 4, 3 -}; - - -// 7 Ordi (Korea) - -static struct BurnRomInfo ordi7RomDesc[] = { - { "p1.u7", 0x20000, 0xebf21862, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "p2.u2", 0x20000, 0xf7943a6a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "4.u128", 0x10000, 0xed73b565, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "8.u63", 0x80000, 0xed8dfe5d, 3 | BRF_GRA }, // 3 - Tiles - { "11.u68", 0x80000, 0x742764a7, 3 | BRF_GRA }, // 4 - { "9.u73", 0x80000, 0x2b76efd0, 3 | BRF_GRA }, // 5 - { "13.u79", 0x80000, 0x3892b356, 3 | BRF_GRA }, // 6 - { "6.u64", 0x80000, 0x5c0b0838, 3 | BRF_GRA }, // 7 - { "10.u69", 0x80000, 0xc15db1a4, 3 | BRF_GRA }, // 8 - { "7.u74", 0x80000, 0x6910f754, 3 | BRF_GRA }, // 9 - { "12.u80", 0x80000, 0x4c5dd9ef, 3 | BRF_GRA }, // 10 - - { "4.u83", 0x80000, 0xa2569cf4, 4 | BRF_GRA }, // 11 - Sprites - { "5.u82", 0x80000, 0x045e548e, 4 | BRF_GRA }, // 12 - { "3.u105", 0x80000, 0x04c1dbf9, 4 | BRF_GRA }, // 13 - { "2.u96", 0x80000, 0x11fa7de8, 4 | BRF_GRA }, // 14 - { "1.u97", 0x80000, 0xcd1ffe88, 4 | BRF_GRA }, // 15 - - { "3.u137", 0x20000, 0x669ed310, 5 | BRF_SND }, // 16 - Samples -}; - -STD_ROM_PICK(ordi7) -STD_ROM_FN(ordi7) - -static INT32 Ordi7Init() -{ - INT32 nRet; - - prot_val = 0x20; - - nRet = DrvInit(0,0,1); - - if (nRet == 0) { - memcpy (DrvSndROM + 0x20000, DrvSndROM, 0x20000); - memcpy (DrvSndROM + 0x40000, DrvSndROM, 0x20000); - memcpy (DrvSndROM + 0x50000, DrvSndROM, 0x20000); - } - - return nRet; -} - -struct BurnDriver BurnDrvOrdi7 = { - "7ordi", NULL, NULL, NULL, "2002", - "7 Ordi (Korea)\0", NULL, "Yun Sung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 1, HARDWARE_MISC_POST90S, GBF_CASINO, 0, - NULL, ordi7RomInfo, ordi7RomName, NULL, NULL, Ordi7InputInfo, Ordi7DIPInfo, - Ordi7Init, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x400, 320, 240, 4, 3 -}; - - -// Wonder Stick - -static struct BurnRomInfo wondstckRomDesc[] = { - { "u4.bin", 0x20000, 0x46a3e9f6, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "u2.bin", 0x20000, 0x9995b743, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "u128.bin", 0x10000, 0x86dba085, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "u63.bin", 0x80000, 0xc6cf09b4, 3 | BRF_GRA }, // 3 - Tiles - { "u68.bin", 0x80000, 0x2e9e9a5e, 3 | BRF_GRA }, // 4 - { "u73.bin", 0x80000, 0x3a828604, 3 | BRF_GRA }, // 5 - { "u79.bin", 0x80000, 0x0cca46af, 3 | BRF_GRA }, // 6 - { "u64.bin", 0x80000, 0xdcec9ac5, 3 | BRF_GRA }, // 7 - { "u69.bin", 0x80000, 0x27b9d708, 3 | BRF_GRA }, // 8 - { "u74.bin", 0x80000, 0x7eff8e2f, 3 | BRF_GRA }, // 9 - { "u80.bin", 0x80000, 0x1160a0c2, 3 | BRF_GRA }, // 10 - - { "u83.bin", 0x80000, 0xf51cf9c6, 4 | BRF_GRA }, // 11 - Sprites - { "u82.bin", 0x80000, 0xddd3c60c, 4 | BRF_GRA }, // 12 - { "u105.bin", 0x80000, 0xa7fc624d, 4 | BRF_GRA }, // 13 - { "u96.bin", 0x80000, 0x2369d8a3, 4 | BRF_GRA }, // 14 - { "u97.bin", 0x80000, 0xaba1bd94, 4 | BRF_GRA }, // 15 - - { "u137.bin", 0x40000, 0x294b6cbd, 5 | BRF_SND }, // 16 - Samples -}; - -STD_ROM_PICK(wondstck) -STD_ROM_FN(wondstck) - -static INT32 WondstckInit() -{ - prot_val = 0x00; - - return DrvInit(0,0,0); -} - -struct BurnDriver BurnDrvWondstck = { - "wondstck", NULL, NULL, NULL, "????", - "Wonder Stick\0", NULL, "Yun Sung", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, wondstckRomInfo, wondstckRomName, NULL, NULL, SearcheyInputInfo, WondstckDIPInfo, - WondstckInit, DrvExit, DrvFrame, DrvDraw, DrvScan, - &DrvRecalc, 0x400, 320, 240, 4, 3 -}; +// FB Alpha NMG5 driver module +// Based on MAME driver by Pierpaolo Prazzoli + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "msm6295.h" + +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvBmpRAM; +static UINT8 *DrvVidRAM0; +static UINT8 *DrvVidRAM1; +static UINT16 *DrvScrRAM; +static UINT32 *DrvPalette; +static UINT32 *Palette; +static UINT8 DrvRecalc; + +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvDips[ 2]; +static UINT8 DrvReset; +static UINT16 DrvInputs[3]; + +static UINT8 DrvOkiBank; +static UINT8 soundlatch; +static UINT8 prot_val; +static UINT8 input_data; +static UINT8 priority_reg; +static UINT8 gfx_bank; + +static struct BurnInputInfo Nmg5InputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy3 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy3 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 6, "p1 fire 3"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 15, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 8, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 9, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 10, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 11, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 12, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 13, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 14, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Nmg5) + +static struct BurnInputInfo SearcheyInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy3 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy3 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p1 fire 2"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 15, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 8, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 9, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 10, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 11, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 12, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 13, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Searchey) + +static struct BurnInputInfo PclubysInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy3 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy3 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 6, "p1 fire 3"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 15, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy3 + 8, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy3 + 9, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy3 + 10, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy3 + 11, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy3 + 12, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy3 + 13, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 14, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Pclubys) + +static struct BurnInputInfo GarogunInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy3 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy3 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy3 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy3 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p1 fire 2"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Garogun) + +static struct BurnInputInfo Ordi7InputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p1 start" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy3 + 2, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy3 + 3, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 4, "p1 fire 3"}, + {"P1 Button 4" , BIT_DIGITAL , DrvJoy3 + 1, "p1 fire 4"}, + {"P1 Button 5" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 5"}, + {"P1 Button 6" , BIT_DIGITAL , DrvJoy3 + 10, "p1 fire 6"}, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Ordi7) + +static struct BurnDIPInfo Nmg5DIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xdf, NULL }, + + {0x13, 0xfe, 0, 2, "Game Title" }, + {0x13, 0x01, 0x01, 0x01, "Multi 5" }, + {0x13, 0x01, 0x01, 0x00, "New Multi Game 5" }, + + {0x13, 0xfe, 0, 4, "Crocodiles (Tong Boy)" }, + {0x13, 0x01, 0x06, 0x06, "Pattern 1" }, + {0x13, 0x01, 0x06, 0x02, "Pattern 2" }, + {0x13, 0x01, 0x06, 0x04, "Pattern 3" }, + {0x13, 0x01, 0x06, 0x00, "Pattern 4" }, + + {0x13, 0xfe, 0, 4, "License" }, + {0x13, 0x01, 0x18, 0x00, "New Impeuropex Corp. S.R.L." }, + {0x13, 0x01, 0x18, 0x08, "BNS Enterprises" }, + {0x13, 0x01, 0x18, 0x10, "Nova Games" }, + {0x13, 0x01, 0x18, 0x18, "None" }, + + {0x13, 0xfe, 0, 2, "1P Vs 2P Rounds (Bubble Gum)" }, + {0x13, 0x01, 0x20, 0x20, "Best of 1" }, + {0x13, 0x01, 0x20, 0x00, "Best of 3" }, + + {0x13, 0xfe, 0, 4, "Difficulty" }, + {0x13, 0x01, 0xc0, 0x40, "Easy" }, + {0x13, 0x01, 0xc0, 0xc0, "Normal" }, + {0x13, 0x01, 0xc0, 0x80, "Hard" }, + {0x13, 0x01, 0xc0, 0x00, "Hardest" }, + + {0x14, 0xfe, 0, 4, "Coin B" }, + {0x14, 0x01, 0x03, 0x02, "2C 1C" }, + {0x14, 0x01, 0x03, 0x03, "1C 1C" }, + {0x14, 0x01, 0x03, 0x00, "2C 3C" }, + {0x14, 0x01, 0x03, 0x01, "1C 2C" }, +// {0x14, 0x01, 0x03, 0x03, "1C 1C" }, +// {0x14, 0x01, 0x03, 0x01, "1C 3C" }, +// {0x14, 0x01, 0x03, 0x02, "1C 4C" }, +// {0x14, 0x01, 0x03, 0x00, "1C 6C" }, + + {0x14, 0xfe, 0, 4, "Coin A" }, + {0x14, 0x01, 0x0c, 0x08, "2C 1C" }, + {0x14, 0x01, 0x0c, 0x0c, "1C 1C" }, + {0x14, 0x01, 0x0c, 0x00, "2C 3C" }, + {0x14, 0x01, 0x0c, 0x04, "1C 2C" }, +// {0x14, 0x01, 0x0c, 0x00, "4C 1C" }, +// {0x14, 0x01, 0x0c, 0x08, "3C 1C" }, +// {0x14, 0x01, 0x0c, 0x04, "2C 1C" }, +// {0x14, 0x01, 0x0c, 0x0c, "1C 1C" }, + + {0x14, 0xfe, 0, 2, "Demo Sounds" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0x14, 0xfe, 0, 2, "Coin Type" }, + {0x14, 0x01, 0x40, 0x40, "1" }, + {0x14, 0x01, 0x40, 0x00, "2" }, + + {0x14, 0xfe, 0, 2, "Service Mode" }, + {0x14, 0x01, 0x80, 0x00, "Off" }, + {0x14, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Nmg5) + +static struct BurnDIPInfo SearcheyDIPList[]= +{ + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xdd, NULL }, + + {0 , 0xfe, 0, 4, "Timer Speed" }, + {0x10, 0x01, 0x03, 0x03, "Slowest" }, + {0x10, 0x01, 0x03, 0x02, "Slow" }, + {0x10, 0x01, 0x03, 0x01, "Fast" }, + {0x10, 0x01, 0x03, 0x00, "Fastest" }, + + {0x10, 0xfe, 0, 4, "Helps" }, + {0x10, 0x01, 0x0c, 0x0c, "1" }, + {0x10, 0x01, 0x0c, 0x08, "2" }, + {0x10, 0x01, 0x0c, 0x04, "3" }, + {0x10, 0x01, 0x0c, 0x00, "4" }, + + {0x10, 0xfe, 0, 4, "Lives" }, + {0x10, 0x01, 0x30, 0x20, "3" }, + {0x10, 0x01, 0x30, 0x10, "4" }, + {0x10, 0x01, 0x30, 0x30, "5" }, + {0x10, 0x01, 0x30, 0x00, "6" }, + + {0x10, 0xfe, 0, 4, "Coinage" }, + {0x10, 0x01, 0xc0, 0x00, "3C 1C" }, + {0x10, 0x01, 0xc0, 0x40, "2C 1C" }, + {0x10, 0x01, 0xc0, 0xc0, "1C 1C" }, + {0x10, 0x01, 0xc0, 0x80, "1C 2C" }, + + {0x11, 0xfe, 0, 2, "Service Mode" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0x11, 0xfe, 0, 2, "Demo Sounds" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0x11, 0xfe, 0, 2, "Language" }, + {0x11, 0x01, 0x20, 0x00, "English" }, + {0x11, 0x01, 0x20, 0x20, "Korean" }, + + {0x11, 0xfe, 0, 2, "Items to find" }, + {0x11, 0x01, 0x80, 0x00, "Less" }, + {0x11, 0x01, 0x80, 0x80, "More" }, +}; + +STDDIPINFO(Searchey) + +static struct BurnDIPInfo Searchp2DIPList[]= +{ + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xf7, NULL }, + + {0x10, 0xfe, 0, 4, "Timer Speed" }, + {0x10, 0x01, 0x03, 0x03, "Slowest" }, + {0x10, 0x01, 0x03, 0x02, "Slow" }, + {0x10, 0x01, 0x03, 0x01, "Fast" }, + {0x10, 0x01, 0x03, 0x00, "Fastest" }, + + {0x10, 0xfe, 0, 4, "Helps" }, + {0x10, 0x01, 0x0c, 0x0c, "1" }, + {0x10, 0x01, 0x0c, 0x08, "2" }, + {0x10, 0x01, 0x0c, 0x04, "3" }, + {0x10, 0x01, 0x0c, 0x00, "4" }, + + {0x10, 0xfe, 0, 4, "Lives" }, + {0x10, 0x01, 0x30, 0x20, "3" }, + {0x10, 0x01, 0x30, 0x10, "4" }, + {0x10, 0x01, 0x30, 0x30, "5" }, + {0x10, 0x01, 0x30, 0x00, "6" }, + + {0x10, 0xfe, 0, 4, "Coinage" }, + {0x10, 0x01, 0xc0, 0x00, "3C 1C" }, + {0x10, 0x01, 0xc0, 0x40, "2C 1C" }, + {0x10, 0x01, 0xc0, 0xc0, "1C 1C" }, + {0x10, 0x01, 0xc0, 0x80, "1C 2C" }, + + {0x11, 0xfe, 0, 2, "Service Mode" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0x11, 0xfe, 0, 4, "Lucky Chance" }, + {0x11, 0x01, 0x06, 0x06, "Table 1" }, + {0x11, 0x01, 0x06, 0x04, "Table 2" }, + {0x11, 0x01, 0x06, 0x02, "Table 3" }, + {0x11, 0x01, 0x06, 0x00, "Table 4" }, + + {0x11, 0xfe, 0, 8, "Language" }, + {0x11, 0x01, 0x38, 0x38, "Korean" }, + {0x11, 0x01, 0x38, 0x30, "English" }, + {0x11, 0x01, 0x38, 0x28, "Japanese" }, + {0x11, 0x01, 0x38, 0x20, "Chinese" }, + {0x11, 0x01, 0x38, 0x18, "Italian" }, + {0x11, 0x01, 0x38, 0x10, "Korean" }, + {0x11, 0x01, 0x38, 0x08, "Korean" }, + {0x11, 0x01, 0x38, 0x00, "Korean" }, + + {0x11, 0xfe, 0, 2, "Lucky Timer" }, + {0x11, 0x01, 0x40, 0x00, "Less" }, + {0x11, 0x01, 0x40, 0x40, "More" }, + + {0x11, 0xfe, 0, 2, "Items to find" }, + {0x11, 0x01, 0x80, 0x00, "Less" }, + {0x11, 0x01, 0x80, 0x80, "More" }, +}; + +STDDIPINFO(Searchp2) + +static struct BurnDIPInfo PclubysDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0x12, 0xfe, 0, 2, "Lives (Mad Ball)" }, + {0x12, 0x01, 0x01, 0x00, "3" }, + {0x12, 0x01, 0x01, 0x01, "4" }, + + {0x12, 0xfe, 0, 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0x12, 0xfe, 0, 2, "1P Vs 2P Rounds" }, + {0x12, 0x01, 0x04, 0x00, "Best of 1" }, + {0x12, 0x01, 0x04, 0x04, "Best of 3" }, + + {0x12, 0xfe, 0, 2, "Nudity" }, + {0x12, 0x01, 0x08, 0x08, "Soft only" }, + {0x12, 0x01, 0x08, 0x00, "Soft and Hard" }, + + {0x12, 0xfe, 0, 4, "Difficulty" }, + {0x12, 0x01, 0x30, 0x30, "Easy" }, + {0x12, 0x01, 0x30, 0x20, "Normal" }, + {0x12, 0x01, 0x30, 0x10, "Hard" }, + {0x12, 0x01, 0x30, 0x00, "Hardest" }, + + {0x12, 0xfe, 0, 4, "Coinage" }, + {0x12, 0x01, 0xc0, 0x00, "3C 1C" }, + {0x12, 0x01, 0xc0, 0x40, "2C 1C" }, + {0x12, 0x01, 0xc0, 0xc0, "1C 1C" }, + {0x12, 0x01, 0xc0, 0x80, "1C 2C" }, + + {0x13, 0xfe, 0, 2, "Service Mode" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0x13, 0xfe, 0, 4, "Timer Speed (Magic Eye)" }, + {0x13, 0x01, 0x30, 0x30, "Slowest" }, + {0x13, 0x01, 0x30, 0x20, "Slow" }, + {0x13, 0x01, 0x30, 0x10, "Fast" }, + {0x13, 0x01, 0x30, 0x00, "Fastest" }, + + {0x13, 0xfe, 0, 2, "Lives (Magic Eye)" }, + {0x13, 0x01, 0x40, 0x00, "3" }, + {0x13, 0x01, 0x40, 0x40, "4" }, + + {0x13, 0xfe, 0, 2, "Timer Speed (Box Logic)" }, + {0x13, 0x01, 0x80, 0x80, "Slow" }, + {0x13, 0x01, 0x80, 0x00, "Fast" }, +}; + +STDDIPINFO(Pclubys) + +static struct BurnDIPInfo GarogunDIPList[]= +{ + {0x09, 0xff, 0xff, 0xff, NULL }, + {0x0a, 0xff, 0xff, 0xfd, NULL }, + + {0x09, 0xfe, 0, 4, "Helps" }, + {0x09, 0x01, 0x03, 0x00, "1" }, + {0x09, 0x01, 0x03, 0x01, "2" }, + {0x09, 0x01, 0x03, 0x02, "3" }, + {0x09, 0x01, 0x03, 0x03, "4" }, + + {0x09, 0xfe, 0, 4, "Timer Speed (Bonus Levels)" }, + {0x09, 0x01, 0x0c, 0x0c, "Slowest" }, + {0x09, 0x01, 0x0c, 0x08, "Slow" }, + {0x09, 0x01, 0x0c, 0x04, "Fast" }, + {0x09, 0x01, 0x0c, 0x00, "Fastest" }, + + {0x09, 0xfe, 0, 4, "Timer Speed (Main Levels)" }, + {0x09, 0x01, 0x30, 0x30, "Slowest" }, + {0x09, 0x01, 0x30, 0x20, "Slow" }, + {0x09, 0x01, 0x30, 0x10, "Fast" }, + {0x09, 0x01, 0x30, 0x00, "Fastest" }, + + {0x09, 0xfe, 0, 4, "Coinage" }, + {0x09, 0x01, 0xc0, 0x00, "3C 1C" }, + {0x09, 0x01, 0xc0, 0x40, "2C 1C" }, + {0x09, 0x01, 0xc0, 0xc0, "1C 1C" }, + {0x09, 0x01, 0xc0, 0x80, "1C 2C" }, + + {0x0a, 0xfe, 0, 2, "Service Mode" }, + {0x0a, 0x01, 0x01, 0x01, "Off" }, + {0x0a, 0x01, 0x01, 0x00, "On" }, + + {0x0a, 0xfe, 0, 2, "Demo Sounds" }, + {0x0a, 0x01, 0x02, 0x02, "Off" }, + {0x0a, 0x01, 0x02, 0x00, "On" }, +}; + +STDDIPINFO(Garogun) + +static struct BurnDIPInfo Ordi7DIPList[]= +{ + {0x09, 0xff, 0xff, 0xff, NULL }, + {0x0a, 0xff, 0xff, 0xff, NULL }, + + {0x09, 0xfe, 0, 2, "High-Low Error" }, + {0x09, 0x01, 0x01, 0x01, "-500" }, + {0x09, 0x01, 0x01, 0x00, "Lose All" }, + + {0x09, 0xfe, 0, 2, "Minimum Credits" }, + {0x09, 0x01, 0x02, 0x02, "300" }, + {0x09, 0x01, 0x02, 0x00, "500" }, + + {0x09, 0xfe, 0, 4, "Credit Limit" }, + {0x09, 0x01, 0x0c, 0x0c, "10000" }, + {0x09, 0x01, 0x0c, 0x08, "30000" }, + {0x09, 0x01, 0x0c, 0x04, "50000" }, + {0x09, 0x01, 0x0c, 0x00, "100000" }, + + {0x09, 0xfe, 0, 4, "Bet" }, + {0x09, 0x01, 0x30, 0x30, "50 Credits" }, + {0x09, 0x01, 0x30, 0x20, "100 Credits" }, + {0x09, 0x01, 0x30, 0x10, "150 Credits" }, + {0x09, 0x01, 0x30, 0x00, "200 Credits" }, + + {0x09, 0xfe, 0, 4, "Coinage" }, + {0x09, 0x01, 0xc0, 0xc0, "1 Coin 50 Credits" }, + {0x09, 0x01, 0xc0, 0x80, "1 Coin 100 Credits" }, + {0x09, 0x01, 0xc0, 0x40, "1 Coin 500 Credits" }, + {0x09, 0x01, 0xc0, 0x00, "1 Coin 1000 Credits" }, + + {0x0a, 0xfe, 0, 2, "Service Mode" }, + {0x0a, 0x01, 0x01, 0x01, "Off" }, + {0x0a, 0x01, 0x01, 0x00, "On" }, + + {0x0a, 0xfe, 0, 2, "Winnings" }, + {0x0a, 0x01, 0x04, 0x04, "Medals and Credits" }, + {0x0a, 0x01, 0x04, 0x00, "Credits only" }, + + {0x0a, 0xfe, 0, 4, "Medals Table" }, + {0x0a, 0x01, 0x18, 0x18, "x1.0" }, + {0x0a, 0x01, 0x18, 0x10, "x1.4" }, + {0x0a, 0x01, 0x18, 0x08, "x2.0" }, + {0x0a, 0x01, 0x18, 0x00, "x3.0" }, + + {0x0a, 0xfe, 0, 8, "Payout %" }, + {0x0a, 0x01, 0xe0, 0xe0, "90%" }, + {0x0a, 0x01, 0xe0, 0xc0, "85%" }, + {0x0a, 0x01, 0xe0, 0xa0, "80%" }, + {0x0a, 0x01, 0xe0, 0x80, "75%" }, + {0x0a, 0x01, 0xe0, 0x60, "70%" }, + {0x0a, 0x01, 0xe0, 0x40, "65%" }, + {0x0a, 0x01, 0xe0, 0x20, "60%" }, + {0x0a, 0x01, 0xe0, 0x00, "55%" }, +}; + +STDDIPINFO(Ordi7) + +static struct BurnDIPInfo WondstckDIPList[]= +{ + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xfd, NULL }, + + {0x10, 0xfe, 0, 2, "Helps" }, + {0x10, 0x01, 0x10, 0x10, "3" }, + {0x10, 0x01, 0x10, 0x00, "5" }, + + {0x10, 0xfe, 0, 2, "Lives" }, + {0x10, 0x01, 0x20, 0x20, "3" }, + {0x10, 0x01, 0x20, 0x00, "5" }, + + {0x10, 0xfe, 0, 4, "Coinage" }, + {0x10, 0x01, 0xc0, 0x00, "3C 1C" }, + {0x10, 0x01, 0xc0, 0x40, "2C 1C" }, + {0x10, 0x01, 0xc0, 0xc0, "1C 1C" }, + {0x10, 0x01, 0xc0, 0x80, "1C 2C" }, + + {0x11, 0xfe, 0, 2, "Service Mode" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0x11, 0xfe, 0, 2, "Demo Sounds" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0x11, 0xfe, 0, 4, "Difficulty" }, + {0x11, 0x01, 0xc0, 0x80, "Easy" }, + {0x11, 0x01, 0xc0, 0xc0, "Normal" }, + {0x11, 0x01, 0xc0, 0x40, "Hard" }, + {0x11, 0x01, 0xc0, 0x00, "Hardest" }, +}; + +STDDIPINFO(Wondstck) + +//----------------------------------------------------------------------------------------------- + +static void palette_write(INT32 offset) +{ + INT32 data = *((UINT16*)(DrvPalRAM + offset)); + + INT32 r = (data >> 0) & 0x1f; + INT32 g = (data >> 5) & 0x1f; + INT32 b = (data >> 10) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + Palette[offset>>1] = (r << 16) | (g << 8) | b; + DrvPalette[offset>>1] = BurnHighCol(r, g, b, 0); +} + +void __fastcall nmg5_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfffff800) == 0x140000) { + DrvPalRAM[address & 0x7ff] = data; + palette_write(address & 0x7ff); + return; + } + + switch (address) + { + case 0x180000: + case 0x180001: + soundlatch = data; + ZetNmi(); + return; + + case 0x180004: + case 0x180005: + input_data = data & 0xf; + return; + + case 0x180006: + case 0x180007: + gfx_bank = data & 3; + return; + + case 0x18000e: + case 0x18000f: + priority_reg = data & 7; + return; + + case 0x300002: + case 0x300003: + case 0x300004: + case 0x300005: + case 0x300006: + case 0x300007: + case 0x300008: + case 0x300009: + *((UINT8*)(DrvScrRAM + ((address - 2) & 7))) = data; + return; + } + + return; +} + +void __fastcall nmg5_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfffff800) == 0x140000) { + *((UINT16*)(DrvPalRAM + (address & 0x7ff))) = data; + palette_write(address & 0x7ff); + return; + } + + switch (address) + { + case 0x180000: + soundlatch = data; + ZetNmi(); + return; + + case 0x180004: + input_data = data & 0xf; + return; + + case 0x180006: + gfx_bank = data & 3; + return; + + case 0x18000e: + priority_reg = data & 7; + return; + + case 0x300002: + case 0x300004: + case 0x300006: + case 0x300008: + DrvScrRAM[(address - 0x300002) >> 1] = data & 0x1ff; + return; + } + + return; +} + +UINT8 __fastcall nmg5_read_byte(UINT32 address) +{ + switch (address) + { + case 0x180004: + case 0x180005: + return prot_val | input_data; + + case 0x180008: + return DrvInputs[0] >> 8; + + case 0x180009: + return DrvInputs[0]; + + case 0x18000a: + return DrvInputs[1] >> 8; + + case 0x18000b: + return DrvInputs[1] & ~0x50; + + case 0x18000c: + return DrvInputs[2] >> 8; + + case 0x18000d: + return DrvInputs[2]; + } + + return 0; +} + +UINT16 __fastcall nmg5_read_word(UINT32 address) +{ + switch (address) + { + case 0x180004: + return prot_val | input_data; + + case 0x180008: + return DrvInputs[0]; + + case 0x18000a: + return DrvInputs[1] & ~0x50; + + case 0x18000c: + return DrvInputs[2]; + } + + return 0; +} + +//----------------------------------------------------------------------------------------------- + +void __fastcall pclubys_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfffff800) == 0x440000) { + DrvPalRAM[address & 0x7ff] = data; + palette_write(address & 0x7ff); + return; + } + + switch (address) + { + case 0x480000: + case 0x480001: + soundlatch = data; + ZetNmi(); + return; + + case 0x480004: + case 0x480005: + input_data = data & 0xf; + return; + + case 0x480006: + case 0x480007: + gfx_bank = data & 3; + return; + + case 0x48000e: + case 0x48000f: + priority_reg = data & 7; + return; + + case 0x500002: + case 0x500003: + case 0x500004: + case 0x500005: + case 0x500006: + case 0x500007: + case 0x500008: + case 0x500009: + *((UINT8*)(DrvScrRAM + ((address - 0x500002) & 7))) = data; + return; + } + + return; +} + +void __fastcall pclubys_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfffff800) == 0x440000) { + *((UINT16*)(DrvPalRAM + (address & 0x7ff))) = data; + palette_write(address & 0x7ff); + return; + } + + switch (address) + { + case 0x480000: + soundlatch = data; + ZetNmi(); + return; + + case 0x480004: + input_data = data & 0xf; + return; + + case 0x480006: + gfx_bank = data & 3; + return; + + case 0x48000e: + priority_reg = data & 7; + return; + + case 0x500002: + case 0x500004: + case 0x500006: + case 0x500008: + DrvScrRAM[(address - 0x500002) >> 1] = data; + return; + } + + return; +} + +UINT8 __fastcall pclubys_read_byte(UINT32 address) +{ + switch (address) + { + case 0x480004: + case 0x480005: + return prot_val | input_data; + + case 0x480008: + return DrvInputs[0] >> 8; + + case 0x480009: + return DrvInputs[0]; + + case 0x48000a: + return DrvInputs[1] >> 8; + + case 0x48000b: + return DrvInputs[1]; + + case 0x48000c: + return DrvInputs[2] >> 8; + + case 0x48000d: + return DrvInputs[2]; + } + + return 0; +} + +UINT16 __fastcall pclubys_read_word(UINT32 address) +{ + switch (address) + { + case 0x480004: + return prot_val | input_data; + + case 0x480008: + return DrvInputs[0]; + + case 0x48000a: + return DrvInputs[1]; + + case 0x48000c: + return DrvInputs[2]; + } + + return 0; +} + +//----------------------------------------------------------------------------------------------- + +void __fastcall nmg5_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + DrvOkiBank = data & 1; + MSM6295ROM = DrvSndROM + (DrvOkiBank ? 0x40000 : 0); + return; + + case 0x10: + BurnYM3812Write(0, data); + return; + + case 0x11: + BurnYM3812Write(1, data); + return; + + case 0x1c: + MSM6295Command(0, data); + return; + } + + return; +} + +UINT8 __fastcall nmg5_read_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x10: + return BurnYM3812Read(0); + + case 0x18: + return soundlatch; + + case 0x1c: + return MSM6295ReadStatus(0); + } + + return 0; +} + +//----------------------------------------------------------------------------------------------- + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x0100000; + DrvZ80ROM = Next; Next += 0x0010000; + + DrvGfxROM0 = Next; Next += 0x1000000; + DrvGfxROM1 = Next; Next += 0x0400000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x0080000; + + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x0010000; + DrvZ80RAM = Next; Next += 0x0000800; + + DrvPalRAM = Next; Next += 0x0000800; + + DrvSprRAM = Next; Next += 0x0000800; + + DrvVidRAM0 = Next; Next += 0x0002000; + DrvVidRAM1 = Next; Next += 0x0002000; + + DrvBmpRAM = Next; Next += 0x0010000; + + DrvScrRAM = (UINT16*)Next; Next += 0x0000004 * sizeof(UINT16); + + Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + priority_reg = 7; + + soundlatch = 0; + input_data = 0; + gfx_bank = 0; + DrvOkiBank = 0; + MSM6295ROM = DrvSndROM; + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM3812Reset(); + + return 0; +} + +static INT32 DrvGfxDecode(INT32 type) +{ + static INT32 Planes0[8] = { + 0x1C00000, 0x1800000, 0x1400000, 0x1000000, + 0x0c00000, 0x0800000, 0x0400000, 0x0000000 + }; + + static INT32 XOffs0[8] = { + 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 + }; + + static INT32 YOffs0[8] = { + 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038 + }; + + static INT32 Planes0a[8] = { + 0x2000008, 0x4000000, 0x0000008, 0x0000000, + 0x6000008, 0x6000000, 0x4000008, 0x2000000 + }; + + static INT32 XOffs0a[8] = { + 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 + }; + + static INT32 YOffs0a[8] = { + 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070 + }; + + static INT32 Planes1[5] = { + 0x0800000, 0x0c00000, 0x0400000, 0x1000000, 0x0000000 + }; + + static INT32 XOffs1[16] = { + 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000, + 0x087, 0x086, 0x085, 0x084, 0x083, 0x082, 0x081, 0x080 + }; + + static INT32 YOffs1[16] = { + 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, + 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 + }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x1000000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x1000000); + + if (type) { + GfxDecode(0x40000, 8, 8, 8, Planes0a, XOffs0a, YOffs0a, 0x080, tmp, DrvGfxROM0); + } else { + GfxDecode(0x10000, 8, 8, 8, Planes0, XOffs0, YOffs0, 0x040, tmp, DrvGfxROM0); + } + + memcpy (tmp, DrvGfxROM1, 0x400000); + + GfxDecode(0x04000, 5, 16, 16, Planes1, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvInit(INT32 loadtype, INT32 sektype, INT32 zettype) // 0 nmg, 1 pclubys +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + if (loadtype) { + for (INT32 i = 0; i < 4; i++) { + if (BurnLoadRom(DrvGfxROM0 + i * 0x400000, i + 3, 1)) return 1; + } + + for (INT32 i = 0; i < 5; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x080000, i + 7, 1)) return 1; + } + + if (BurnLoadRom(DrvSndROM, 12, 1)) return 1; + } else { + for (INT32 i = 0; i < 8; i++) { + if (BurnLoadRom(DrvGfxROM0 + i * 0x80000, i + 3, 1)) return 1; + } + + for (INT32 i = 0; i < 5; i++) { + if (BurnLoadRom(DrvGfxROM1 + i * 0x80000, i + 11, 1)) return 1; + } + + if (BurnLoadRom(DrvSndROM, 16, 1)) return 1; + } + + DrvGfxDecode(loadtype); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(DrvBmpRAM, 0x800000, 0x80ffff, SM_RAM); + if (sektype) { + SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x440000, 0x4407ff, SM_ROM); + SekMapMemory(DrvSprRAM, 0x460000, 0x4607ff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x520000, 0x521fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x522000, 0x523fff, SM_RAM); + SekSetWriteByteHandler(0, pclubys_write_byte); + SekSetWriteWordHandler(0, pclubys_write_word); + SekSetReadByteHandler(0, pclubys_read_byte); + SekSetReadWordHandler(0, pclubys_read_word); + } else { + SekMapMemory(Drv68KRAM, 0x120000, 0x12ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x140000, 0x1407ff, SM_ROM); + SekMapMemory(DrvSprRAM, 0x160000, 0x1607ff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x320000, 0x321fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x322000, 0x323fff, SM_RAM); + SekSetWriteByteHandler(0, nmg5_write_byte); + SekSetWriteWordHandler(0, nmg5_write_word); + SekSetReadByteHandler(0, nmg5_read_byte); + SekSetReadWordHandler(0, nmg5_read_word); + } + SekClose(); + + ZetInit(0); + ZetOpen(0); + if (zettype) { + ZetMapArea(0x0000, 0xf7ff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xf7ff, 2, DrvZ80ROM); + ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM); + ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM); + ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); + } else { + ZetMapArea(0x0000, 0xdfff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xdfff, 2, DrvZ80ROM); + ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM); + ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM); + ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM); + } + ZetSetInHandler(nmg5_read_port); + ZetSetOutHandler(nmg5_write_port); + ZetClose(); + + BurnYM3812Init(4000000, &DrvFMIRQHandler, &DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3812(4000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 1000000 / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + MSM6295Exit(0); + BurnYM3812Exit(); + + GenericTilesExit(); + ZetExit(); + SekExit(); + + BurnFree (AllMem); + + return 0; +} + +//----------------------------------------------------------------------------------------------- + +static void draw_bitmap() +{ + UINT16 x,y,count; + INT32 pix; + + UINT16 *bitmap = (UINT16*)DrvBmpRAM; + + for (y = 0, count = 0; y < 256; y++) + { + for(x = 0; x < 128; x++, count++) + { + if (!bitmap[count]) continue; + + INT32 ofst = ((y - 9) * nScreenWidth) + ((x << 2) - 12); + + pix = bitmap[count] >> 12; + if (pix) pTransDraw[ofst ] = pix | 0x300; + + pix = (bitmap[count]&0x0f00)>>8; + if (pix) pTransDraw[ofst | 1] = pix | 0x300; + + pix = (bitmap[count]&0x00f0)>>4; + if (pix) pTransDraw[ofst | 2] = pix | 0x300; + + pix = bitmap[count] & 0x000f; + if (pix) pTransDraw[ofst | 3] = pix | 0x300; + } + } +} + +static void DrawTiles(UINT8 *vidram, INT32 color, INT32 transp, INT32 scrollx, INT32 scrolly) +{ + UINT16 *vram = (UINT16*)vidram; + + for (INT32 offs = 0; offs < 0x2000 / 2; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + INT32 code = vram[offs] | (gfx_bank << 16); + + sx -= scrollx; + sy -= scrolly; + if (sx < -7) sx += 0x200; + if (sy < -7) sy += 0x200; + + if (transp) { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 8, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 8, 0, DrvGfxROM0); + } + } +} + +static void draw_sprites() +{ + UINT16 *spriteram16 = (UINT16*)DrvSprRAM; + + for (INT32 offs = 0;offs < 0x800/2;offs += 4) + { + INT32 sx = spriteram16[offs + 2] & 0x1ff; + INT32 sy = spriteram16[offs]; + INT32 code = spriteram16[offs + 1]; + INT32 color = (spriteram16[offs + 2] >> 9) & 0xf; + INT32 height = 1 << ((sy & 0x0600) >> 9); + INT32 flipx = sy & 0x2000; + INT32 flipy = sy & 0x4000; + + for (INT32 y = 0;y < height;y++) + { + INT32 yy = 248 - ((sy + ((height - y) << 4)) & 0x1ff); + + INT32 tile = code + (flipy ? height-1-y : y); + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, tile, sx, yy, color, 5, 0, 0x200, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, tile, sx, yy, color, 5, 0, 0x200, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, tile, sx, yy, color, 5, 0, 0x200, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, tile, sx, yy, color, 5, 0, 0x200, DrvGfxROM1); + } + } + + if (sx < 0x1f1) continue; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, tile, sx - 512, yy, color, 5, 0, 0x200, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, tile, sx - 512, yy, color, 5, 0, 0x200, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, tile, sx - 512, yy, color, 5, 0, 0x200, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, tile, sx - 512, yy, color, 5, 0, 0x200, DrvGfxROM1); + } + } + } + } +} + + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + DrawTiles(DrvVidRAM0, 1, 0, DrvScrRAM[2]+3, DrvScrRAM[3]+9); + + if(priority_reg == 0) + { + draw_sprites(); + DrawTiles(DrvVidRAM1, 0, 1, DrvScrRAM[0]-1, DrvScrRAM[1]+9); + draw_bitmap(); + } + else if(priority_reg == 1) + { + draw_bitmap(); + draw_sprites(); + DrawTiles(DrvVidRAM1, 0, 1, DrvScrRAM[0]-1, DrvScrRAM[1]+9); + } + else if(priority_reg == 2) + { + draw_sprites(); + draw_bitmap(); + DrawTiles(DrvVidRAM1, 0, 1, DrvScrRAM[0]-1, DrvScrRAM[1]+9); + } + else if(priority_reg == 3) + { + DrawTiles(DrvVidRAM1, 0, 1, DrvScrRAM[0]-1, DrvScrRAM[1]+9); + draw_sprites(); + draw_bitmap(); + } + else if(priority_reg == 7) + { + DrawTiles(DrvVidRAM1, 0, 1, DrvScrRAM[0]-1, DrvScrRAM[1]+9); + draw_bitmap(); + draw_sprites(); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + + + +static INT32 DrvFrame() +{ + INT32 nTotalCycles[2] = { 16000000 / 60, 4000000 / 60 }; + + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 6); + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[1] ^= DrvJoy2[i] << i; + DrvInputs[2] ^= DrvJoy3[i] << i; + } + + DrvInputs[0] = (DrvDips[1] << 8) | DrvDips[0]; + } + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + SekRun(nTotalCycles[0]); + + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + BurnTimerEndFrameYM3812(nTotalCycles[1]); + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +//----------------------------------------------------------------------------------------------- + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029692; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + BurnYM3812Scan(nAction, pnMin); + MSM6295Scan(0, nAction); +// BurnTimerScan(nAction, pnMin); + + SCAN_VAR(soundlatch); + SCAN_VAR(prot_val); + SCAN_VAR(input_data); + SCAN_VAR(priority_reg); + SCAN_VAR(gfx_bank); + SCAN_VAR(DrvOkiBank); + } + + if (nAction & ACB_WRITE) { + nmg5_write_port(0, DrvOkiBank); + } + + return 0; +} + +//----------------------------------------------------------------------------------------------- + +// Multi 5 / New Multi Game 5 + +static struct BurnRomInfo nmg5RomDesc[] = { + { "ub15.bin", 0x80000, 0x36af3e2f, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "ub16.bin", 0x80000, 0x2d9923d4, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "xh15.bin", 0x10000, 0x12d047c4, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "srom1.bin", 0x80000, 0x6771b694, 3 | BRF_GRA }, // 3 - Tiles + { "srom2.bin", 0x80000, 0x362d33af, 3 | BRF_GRA }, // 4 + { "srom3.bin", 0x80000, 0x8bad69d1, 3 | BRF_GRA }, // 5 + { "srom4.bin", 0x80000, 0xe73a7fcb, 3 | BRF_GRA }, // 6 + { "srom5.bin", 0x80000, 0x7300494e, 3 | BRF_GRA }, // 7 + { "srom6.bin", 0x80000, 0x74b5fdf9, 3 | BRF_GRA }, // 8 + { "srom7.bin", 0x80000, 0xbd2b9036, 3 | BRF_GRA }, // 9 + { "srom8.bin", 0x80000, 0xdd38360e, 3 | BRF_GRA }, // 10 + + { "uf1.bin", 0x40000, 0x9a9fb6f4, 4 | BRF_GRA }, // 11 - Sprites + { "uf2.bin", 0x40000, 0x66954d63, 4 | BRF_GRA }, // 12 + { "ufa1.bin", 0x40000, 0xba73ed2d, 4 | BRF_GRA }, // 13 + { "uh1.bin", 0x40000, 0xf7726e8e, 4 | BRF_GRA }, // 14 + { "uj1.bin", 0x40000, 0x54f7486e, 4 | BRF_GRA }, // 15 + + { "xra1.bin", 0x20000, 0xc74a4f3e, 5 | BRF_SND }, // 16 - Samples +}; + +STD_ROM_PICK(nmg5) +STD_ROM_FN(nmg5) + +static INT32 Nmg5Init() +{ + prot_val = 0x10; + + return DrvInit(0,0,0); +} + +struct BurnDriver BurnDrvNmg5 = { + "nmg5", NULL, NULL, NULL, "1998", + "Multi 5 / New Multi Game 5\0", NULL, "Yun Sung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, nmg5RomInfo, nmg5RomName, NULL, NULL, Nmg5InputInfo, Nmg5DIPInfo, + Nmg5Init, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x400, 320, 240, 4, 3 +}; + + +// Multi 5 / New Multi Game 5 (earlier) + +static struct BurnRomInfo nmg5eRomDesc[] = { + { "ub15.rom", 0x80000, 0x578516e2, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "ub16.rom", 0x80000, 0x12fab483, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "xh15.bin", 0x10000, 0x12d047c4, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "srom1.rom", 0x80000, 0x6df3e0c2, 3 | BRF_GRA }, // 3 - Tiles + { "srom2.rom", 0x80000, 0x3caf65f9, 3 | BRF_GRA }, // 4 + { "srom3.rom", 0x80000, 0x812f3f87, 3 | BRF_GRA }, // 5 + { "srom4.rom", 0x80000, 0xedb8299d, 3 | BRF_GRA }, // 6 + { "srom5.rom", 0x80000, 0x79821f18, 3 | BRF_GRA }, // 7 + { "srom6.rom", 0x80000, 0x7e37abaf, 3 | BRF_GRA }, // 8 + { "srom7.rom", 0x80000, 0xb7a9c660, 3 | BRF_GRA }, // 9 + { "srom8.rom", 0x80000, 0xd7ba6058, 3 | BRF_GRA }, // 10 + + { "uf1.rom", 0x40000, 0x502dbd65, 4 | BRF_GRA }, // 11 - Sprites + { "uf2.rom", 0x40000, 0x6744cca0, 4 | BRF_GRA }, // 12 + { "ufa1.rom", 0x40000, 0x7110677f, 4 | BRF_GRA }, // 13 + { "uh1.rom", 0x40000, 0xf6a3ef4d, 4 | BRF_GRA }, // 14 + { "uj1.rom", 0x40000, 0x0595d8ef, 4 | BRF_GRA }, // 15 + + { "xra1.bin", 0x20000, 0xc74a4f3e, 5 | BRF_SND }, // 16 - Samples +}; + +STD_ROM_PICK(nmg5e) +STD_ROM_FN(nmg5e) + +struct BurnDriver BurnDrvNmg5e = { + "nmg5e", "nmg5", NULL, NULL, "1997", + "Multi 5 / New Multi Game 5 (earlier)\0", NULL, "Yun Sung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, nmg5eRomInfo, nmg5eRomName, NULL, NULL, Nmg5InputInfo, Nmg5DIPInfo, + Nmg5Init, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x400, 320, 240, 4, 3 +}; + + +// Search Eye + +static struct BurnRomInfo searcheyRomDesc[] = { + { "u7.bin", 0x40000, 0x287ce3dd, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "u2.bin", 0x40000, 0xb574f033, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "u128.bin", 0x10000, 0x85bae10c, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "u63.bin", 0x80000, 0x1b0b7b7d, 3 | BRF_GRA }, // 3 - Tiles + { "u68.bin", 0x80000, 0xae18b2aa, 3 | BRF_GRA }, // 4 + { "u73.bin", 0x80000, 0xab7f8716, 3 | BRF_GRA }, // 5 + { "u79.bin", 0x80000, 0x7f2c8b83, 3 | BRF_GRA }, // 6 + { "u64.bin", 0x80000, 0x322a903c, 3 | BRF_GRA }, // 7 + { "u69.bin", 0x80000, 0xd546eaf8, 3 | BRF_GRA }, // 8 + { "u74.bin", 0x80000, 0xe6134d84, 3 | BRF_GRA }, // 9 + { "u80.bin", 0x80000, 0x9a160918, 3 | BRF_GRA }, // 10 + + { "u83.bin", 0x20000, 0xc5a1c647, 4 | BRF_GRA }, // 11 - Sprites + { "u82.bin", 0x20000, 0x25b2ae62, 4 | BRF_GRA }, // 12 + { "u105.bin", 0x20000, 0xb4207ef0, 4 | BRF_GRA }, // 13 + { "u96.bin", 0x20000, 0x8c40818a, 4 | BRF_GRA }, // 14 + { "u97.bin", 0x20000, 0x5dc7f231, 4 | BRF_GRA }, // 15 + + { "u137.bin", 0x40000, 0x49105e23, 5 | BRF_SND }, // 16 - Samples +}; + +STD_ROM_PICK(searchey) +STD_ROM_FN(searchey) + +struct BurnDriver BurnDrvSearchey = { + "searchey", NULL, NULL, NULL, "1999", + "Search Eye\0", NULL, "Yun Sung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, searcheyRomInfo, searcheyRomName, NULL, NULL, SearcheyInputInfo, SearcheyDIPInfo, + Nmg5Init, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x400, 320, 240, 4, 3 +}; + + +// Search Eye Plus V2.0 + +static struct BurnRomInfo searchp2RomDesc[] = { + { "u7", 0x080000, 0x37fe9e18, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "u2", 0x080000, 0x8278513b, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "u128", 0x010000, 0x85bae10c, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "0.u1", 0x400000, 0x28a50dcf, 3 | BRF_GRA }, // 3 - Tiles + { "2.u3", 0x400000, 0x30d46e19, 3 | BRF_GRA }, // 4 + { "1.u2", 0x400000, 0xf9c4e824, 3 | BRF_GRA }, // 5 + { "3.u4", 0x400000, 0x619f142f, 3 | BRF_GRA }, // 6 + + { "u83", 0x040000, 0x2bae34cb, 4 | BRF_GRA }, // 7 - Sprites + { "u82", 0x040000, 0x5cb773f0, 4 | BRF_GRA }, // 8 + { "u105", 0x040000, 0xe8adb15e, 4 | BRF_GRA }, // 9 + { "u96", 0x040000, 0x67efb536, 4 | BRF_GRA }, // 10 + { "u97", 0x040000, 0xf7b63826, 4 | BRF_GRA }, // 11 + + { "u137", 0x040000, 0xcd037524, 5 | BRF_SND }, // 12 - Samples +}; + +STD_ROM_PICK(searchp2) +STD_ROM_FN(searchp2) + +static INT32 Searchp2Init() +{ + prot_val = 0x10; + + BurnSetRefreshRate(55); + + return DrvInit(1,0,0); +} + +struct BurnDriver BurnDrvSearchp2 = { + "searchp2", NULL, NULL, NULL, "1999", + "Search Eye Plus V2.0\0", NULL, "Yun Sung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, searchp2RomInfo, searchp2RomName, NULL, NULL, SearcheyInputInfo, Searchp2DIPInfo, + Searchp2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x400, 320, 240, 4, 3 +}; + + +// Puzzle Club (Yun Sung, set 1) + +static struct BurnRomInfo pclubysRomDesc[] = { + { "rom3.7", 0x080000, 0x62e28e6d, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "rom4.2", 0x080000, 0xb51dab41, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "rom1.128", 0x010000, 0x25cd27f8, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "rom10.167", 0x400000, 0xd67e8e84, 3 | BRF_GRA }, // 3 - Tiles + { "rom12.165", 0x400000, 0x6be8b733, 3 | BRF_GRA }, // 4 + { "rom11.166", 0x400000, 0x672501a4, 3 | BRF_GRA }, // 5 + { "rom13.164", 0x400000, 0xfc725ce7, 3 | BRF_GRA }, // 6 + + { "rom8.83", 0x080000, 0x651af101, 4 | BRF_GRA }, // 7 - Sprites + { "rom9.82", 0x080000, 0x2535b4d6, 4 | BRF_GRA }, // 8 + { "rom7.105", 0x080000, 0xf7536c52, 4 | BRF_GRA }, // 9 + { "rom6.95", 0x080000, 0x3c078a52, 4 | BRF_GRA }, // 10 + { "rom5.97", 0x080000, 0x20eae2f8, 4 | BRF_GRA }, // 11 + + { "rom2.137", 0x080000, 0x4ff97ad1, 4 | BRF_SND }, // 12 - Samples +}; + +STD_ROM_PICK(pclubys) +STD_ROM_FN(pclubys) + +static INT32 PclubysInit() +{ + prot_val = 0x10; + + return DrvInit(1,1,1); +} + +struct BurnDriver BurnDrvPclubys = { + "pclubys", NULL, NULL, NULL, "2000", + "Puzzle Club (Yun Sung, set 1)\0", NULL, "Yun Sung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, pclubysRomInfo, pclubysRomName, NULL, NULL, PclubysInputInfo, PclubysDIPInfo, + PclubysInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x400, 320, 240, 4, 3 +}; + + +// Puzzle Club (Yun Sung, set 2) + +static struct BurnRomInfo pclubysaRomDesc[] = { + { "rom3a.7", 0x080000, 0x885aa07a, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "rom4a.2", 0x080000, 0x9bfbdeac, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "rom1.128", 0x010000, 0x25cd27f8, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "rom10.167", 0x400000, 0xd67e8e84, 3 | BRF_GRA }, // 3 - Tiles + { "rom12.165", 0x400000, 0x6be8b733, 3 | BRF_GRA }, // 4 + { "rom11.166", 0x400000, 0x672501a4, 3 | BRF_GRA }, // 5 + { "rom13.164", 0x400000, 0xfc725ce7, 3 | BRF_GRA }, // 6 + + { "rom8.83", 0x080000, 0x651af101, 4 | BRF_GRA }, // 7 - Sprites + { "rom9.82", 0x080000, 0x2535b4d6, 4 | BRF_GRA }, // 8 + { "rom7.105", 0x080000, 0xf7536c52, 4 | BRF_GRA }, // 9 + { "rom6.95", 0x080000, 0x3c078a52, 4 | BRF_GRA }, // 10 + { "rom5.97", 0x080000, 0x20eae2f8, 4 | BRF_GRA }, // 11 + + { "rom2.137", 0x080000, 0x4ff97ad1, 4 | BRF_SND }, // 12 - Samples +}; + +STD_ROM_PICK(pclubysa) +STD_ROM_FN(pclubysa) + +struct BurnDriver BurnDrvPclubysa = { + "pclubysa", "pclubys", NULL, NULL, "2000", + "Puzzle Club (Yun Sung, set 2)\0", NULL, "Yun Sung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0, + NULL, pclubysaRomInfo, pclubysaRomName, NULL, NULL, PclubysInputInfo, PclubysDIPInfo, + PclubysInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x400, 320, 240, 4, 3 +}; + + +// Garogun Seroyang (Korea) + +static struct BurnRomInfo garogunRomDesc[] = { + { "p1.u7", 0x80000, 0x9b5627f8, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "p2.u2", 0x80000, 0x1d2ff271, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "rom.u128", 0x10000, 0x117b31ce, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "8.u63", 0x80000, 0x2d152d32, 3 | BRF_GRA }, // 3 - Tiles + { "11.u68", 0x80000, 0x60ec7f67, 3 | BRF_GRA }, // 4 + { "9.u73", 0x80000, 0xa4b16319, 3 | BRF_GRA }, // 5 + { "13.u79", 0x80000, 0x2dc14fb6, 3 | BRF_GRA }, // 6 + { "6.u64", 0x80000, 0xa0fc7547, 3 | BRF_GRA }, // 7 + { "10.u69", 0x80000, 0xe5dc36c3, 3 | BRF_GRA }, // 8 + { "7.u74", 0x80000, 0xa0574f8d, 3 | BRF_GRA }, // 9 + { "12.u80", 0x80000, 0x94d66169, 3 | BRF_GRA }, // 10 + + { "4.u83", 0x40000, 0x3d1d46ff, 4 | BRF_GRA }, // 11 - Sprites + { "5.u82", 0x40000, 0x2a7b2fb5, 4 | BRF_GRA }, // 12 + { "3.u105", 0x40000, 0xcd20e39c, 4 | BRF_GRA }, // 13 + { "2.u96", 0x40000, 0x4df3b502, 4 | BRF_GRA }, // 14 + { "1.u97", 0x40000, 0x591b3efe, 4 | BRF_GRA }, // 15 + + { "s.u137", 0x80000, 0x3eadc21a, 5 | BRF_SND }, // 16 - Samples +}; + +STD_ROM_PICK(garogun) +STD_ROM_FN(garogun) + +static INT32 GarogunInit() +{ + prot_val = 0x40; + + return DrvInit(0,1,1); +} + +struct BurnDriver BurnDrvGarogun = { + "garogun", NULL, NULL, NULL, "2000", + "Garogun Seroyang (Korea)\0", NULL, "Yun Sung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 1, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, + NULL, garogunRomInfo, garogunRomName, NULL, NULL, GarogunInputInfo, GarogunDIPInfo, + GarogunInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x400, 320, 240, 4, 3 +}; + + +// 7 Ordi (Korea) + +static struct BurnRomInfo ordi7RomDesc[] = { + { "p1.u7", 0x20000, 0xebf21862, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "p2.u2", 0x20000, 0xf7943a6a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "4.u128", 0x10000, 0xed73b565, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "8.u63", 0x80000, 0xed8dfe5d, 3 | BRF_GRA }, // 3 - Tiles + { "11.u68", 0x80000, 0x742764a7, 3 | BRF_GRA }, // 4 + { "9.u73", 0x80000, 0x2b76efd0, 3 | BRF_GRA }, // 5 + { "13.u79", 0x80000, 0x3892b356, 3 | BRF_GRA }, // 6 + { "6.u64", 0x80000, 0x5c0b0838, 3 | BRF_GRA }, // 7 + { "10.u69", 0x80000, 0xc15db1a4, 3 | BRF_GRA }, // 8 + { "7.u74", 0x80000, 0x6910f754, 3 | BRF_GRA }, // 9 + { "12.u80", 0x80000, 0x4c5dd9ef, 3 | BRF_GRA }, // 10 + + { "4.u83", 0x80000, 0xa2569cf4, 4 | BRF_GRA }, // 11 - Sprites + { "5.u82", 0x80000, 0x045e548e, 4 | BRF_GRA }, // 12 + { "3.u105", 0x80000, 0x04c1dbf9, 4 | BRF_GRA }, // 13 + { "2.u96", 0x80000, 0x11fa7de8, 4 | BRF_GRA }, // 14 + { "1.u97", 0x80000, 0xcd1ffe88, 4 | BRF_GRA }, // 15 + + { "3.u137", 0x20000, 0x669ed310, 5 | BRF_SND }, // 16 - Samples +}; + +STD_ROM_PICK(ordi7) +STD_ROM_FN(ordi7) + +static INT32 Ordi7Init() +{ + INT32 nRet; + + prot_val = 0x20; + + nRet = DrvInit(0,0,1); + + if (nRet == 0) { + memcpy (DrvSndROM + 0x20000, DrvSndROM, 0x20000); + memcpy (DrvSndROM + 0x40000, DrvSndROM, 0x20000); + memcpy (DrvSndROM + 0x50000, DrvSndROM, 0x20000); + } + + return nRet; +} + +struct BurnDriver BurnDrvOrdi7 = { + "7ordi", NULL, NULL, NULL, "2002", + "7 Ordi (Korea)\0", NULL, "Yun Sung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 1, HARDWARE_MISC_POST90S, GBF_CASINO, 0, + NULL, ordi7RomInfo, ordi7RomName, NULL, NULL, Ordi7InputInfo, Ordi7DIPInfo, + Ordi7Init, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x400, 320, 240, 4, 3 +}; + + +// Wonder Stick + +static struct BurnRomInfo wondstckRomDesc[] = { + { "u4.bin", 0x20000, 0x46a3e9f6, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "u2.bin", 0x20000, 0x9995b743, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "u128.bin", 0x10000, 0x86dba085, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "u63.bin", 0x80000, 0xc6cf09b4, 3 | BRF_GRA }, // 3 - Tiles + { "u68.bin", 0x80000, 0x2e9e9a5e, 3 | BRF_GRA }, // 4 + { "u73.bin", 0x80000, 0x3a828604, 3 | BRF_GRA }, // 5 + { "u79.bin", 0x80000, 0x0cca46af, 3 | BRF_GRA }, // 6 + { "u64.bin", 0x80000, 0xdcec9ac5, 3 | BRF_GRA }, // 7 + { "u69.bin", 0x80000, 0x27b9d708, 3 | BRF_GRA }, // 8 + { "u74.bin", 0x80000, 0x7eff8e2f, 3 | BRF_GRA }, // 9 + { "u80.bin", 0x80000, 0x1160a0c2, 3 | BRF_GRA }, // 10 + + { "u83.bin", 0x80000, 0xf51cf9c6, 4 | BRF_GRA }, // 11 - Sprites + { "u82.bin", 0x80000, 0xddd3c60c, 4 | BRF_GRA }, // 12 + { "u105.bin", 0x80000, 0xa7fc624d, 4 | BRF_GRA }, // 13 + { "u96.bin", 0x80000, 0x2369d8a3, 4 | BRF_GRA }, // 14 + { "u97.bin", 0x80000, 0xaba1bd94, 4 | BRF_GRA }, // 15 + + { "u137.bin", 0x40000, 0x294b6cbd, 5 | BRF_SND }, // 16 - Samples +}; + +STD_ROM_PICK(wondstck) +STD_ROM_FN(wondstck) + +static INT32 WondstckInit() +{ + prot_val = 0x00; + + return DrvInit(0,0,0); +} + +struct BurnDriver BurnDrvWondstck = { + "wondstck", NULL, NULL, NULL, "????", + "Wonder Stick\0", NULL, "Yun Sung", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, wondstckRomInfo, wondstckRomName, NULL, NULL, SearcheyInputInfo, WondstckDIPInfo, + WondstckInit, DrvExit, DrvFrame, DrvDraw, DrvScan, + &DrvRecalc, 0x400, 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_nmk16.cpp b/src/burn/drv/pst90s/d_nmk16.cpp index abb5d872f..07e1f03a7 100644 --- a/src/burn/drv/pst90s/d_nmk16.cpp +++ b/src/burn/drv/pst90s/d_nmk16.cpp @@ -1,8878 +1,8873 @@ -// FB Alpha NMK16 driver module -// Based on MAME driver by Mirko Buffoni, Richard Bush, Nicola Salmoria, Bryan McPhail, David Haywood, and R. Belmont -// Also, a huge "thank you!" to JackC for helping bug test - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "seibusnd.h" -#include "bitswap.h" -#include "nmk004.h" - -#if 0 - blkheart -- good - mustang -- good - acrobatm -- good - manybloc -- good - stagger1 -- good - tharrier -- good - airattck -- good - macross -- good - redhawkb -- good - popspops -- good - spec2k -- good - firehawk -- good - mangchi -- good - bubble2000 -- good - hachamf -- good -- small gfx issues, need to compare to MAME - redhawki -- good - strahl -- good - bioship -- good - nouryoku -- good - tdragon -- good - tdragon2 -- good (input issues?, I can not confirm) - macross2 -- good (input issues?, I can not confirm) - ssmissin -- good - twinactn -- good - gunnail -- good - raphero -- good -- no sound, cpu NOT emulated (input issues?, I can not confirm) - vandyke -- good - vandykeb -- good -- no sound. cpu NOT emulated :) - grdnstrm -- good - grdnstrmk -- good - bjtwin -- good - sabotenb -- good - - tdragonb -- bad sound. Seibu sound needs hooked up properly - mustangb -- bad sound. Seibu sound needs hooked up properly -#endif - -static UINT8 *AllMem; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvTileROM; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvBgRAM0; -static UINT8 *DrvBgRAM1; -static UINT8 *DrvBgRAM2; -static UINT8 *DrvBgRAM3; -static UINT8 *DrvTxRAM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvSprBuf; -static UINT8 *DrvSprBuf2; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvScrollRAM; - -static UINT32 *DrvPalette; - -static UINT8 *soundlatch; -static UINT8 *soundlatch2; -static UINT8 *flipscreen; -static UINT8 *tilebank; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvDips[2]; -static UINT16 DrvInputs[3]; -static UINT8 DrvReset; - -static INT32 nGraphicsMask[3]; -static INT32 videoshift = 0; -static INT32 input_high[2] = { 0, 0 }; -static INT32 is_8bpp = 0; -static INT32 global_y_offset = 16; -static INT32 screen_flip_y = 0; -static UINT32 nNMK004CpuSpeed; -static INT32 nNMK004EnableIrq2; -static INT32 macross2_sound_enable; - -static struct BurnInputInfo CommonInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 11, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 10, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 9, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 8, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Common) - -static struct BurnInputInfo TharrierInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy3 + 6, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy3 + 5, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy3 + 4, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy3 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy3 + 1, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy3 + 2, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy3 + 7, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 14, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 13, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 12, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 11, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 9, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 10, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Tharrier) - -static struct BurnInputInfo ManyblocInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 6, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 5, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 4, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 15, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 8, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 14, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 13, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 12, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 11, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 9, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 10, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Manybloc) - -static struct BurnInputInfo SsmissinInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 11, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 10, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 9, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 8, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Ssmissin) - -static struct BurnInputInfo Tdragon2InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 11, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 10, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 9, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 8, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 14, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Tdragon2) - -static struct BurnInputInfo AcrobatmInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 11, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 10, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 9, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 8, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Acrobatm) - -static struct BurnDIPInfo RedhawkbDIPList[]= -{ - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x02, "Off" }, - {0x12, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0xc0, "1" }, - {0x12, 0x01, 0xc0, 0x40, "2" }, - {0x12, 0x01, 0xc0, 0x00, "3" }, - {0x12, 0x01, 0xc0, 0x80, "5" }, - -// {0 , 0xfe, 0 , 4, "Flip Screen" }, -// {0x13, 0x01, 0x03, 0x00, "Off" }, -// {0x13, 0x01, 0x03, 0x03, "On" }, -// {0x13, 0x01, 0x03, 0x01, "Horizontally" }, -// {0x13, 0x01, 0x03, 0x02, "Vertically" }, - - {0 , 0xfe, 0 , 2, "Unused" }, - {0x13, 0x01, 0x04, 0x00, "Off" }, - {0x13, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x18, 0x10, "Easy" }, - {0x13, 0x01, 0x18, 0x00, "Normal" }, - {0x13, 0x01, 0x18, 0x08, "Hard" }, - {0x13, 0x01, 0x18, 0x18, "Hardest" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x13, 0x01, 0xe0, 0xe0, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xe0, 0x00, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "1 Coin 3 Credits" }, -}; - -STDDIPINFO(Redhawkb) - -static struct BurnDIPInfo RapheroDIPList[]= -{ - {0x14, 0xff, 0xff, 0xfd, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x14, 0x01, 0x02, 0x02, "Japanese" }, - {0x14, 0x01, 0x02, 0x00, "English" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x30, 0x10, "Easy" }, - {0x14, 0x01, 0x30, 0x30, "Normal" }, - {0x14, 0x01, 0x30, 0x20, "Hard" }, - {0x14, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0xc0, 0x00, "1" }, - {0x14, 0x01, 0xc0, 0x40, "2" }, - {0x14, 0x01, 0xc0, 0xc0, "3" }, - {0x14, 0x01, 0xc0, 0x80, "4" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x15, 0x01, 0x01, 0x01, "Off" }, -// {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x00, "Off" }, - {0x15, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x15, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x15, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x15, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x15, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x15, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - {0x15, 0x01, 0x1c, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x15, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x15, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x15, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x15, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x15, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xe0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Raphero) - -static struct BurnDIPInfo BioshipDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x01, 0x01, "Off" }, -// {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x06, 0x00, "Easy" }, - {0x12, 0x01, 0x06, 0x06, "Normal" }, - {0x12, 0x01, 0x06, 0x02, "Hard" }, - {0x12, 0x01, 0x06, 0x04, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x20, 0x00, "Off" }, - {0x12, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x80, "4" }, - {0x12, 0x01, 0xc0, 0x40, "5" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, -}; - -STDDIPINFO(Bioship) - -static struct BurnDIPInfo StrahlDIPList[]= -{ - {0x12, 0xff, 0xff, 0x7f, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0x07, 0x00, "5 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x03, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x38, 0x00, "5 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x18, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x40, 0x40, "Off" }, -// {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x02, "2" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x01, "4" }, - {0x13, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x08, "Easy" }, - {0x13, 0x01, 0x0c, 0x0c, "Normal" }, - {0x13, 0x01, 0x0c, 0x04, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x60, 0x40, "100k and every 200k" }, - {0x13, 0x01, 0x60, 0x60, "200k and every 200k" }, - {0x13, 0x01, 0x60, 0x20, "300k and every 300k" }, - {0x13, 0x01, 0x60, 0x00, "None" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Strahl) - -static struct BurnDIPInfo HachamfDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xfd, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x03, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x18, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x38, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x40, 0x00, "Off" }, - {0x12, 0x01, 0x40, 0x40, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x13, 0x01, 0x01, 0x01, "Off" }, -// {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x13, 0x01, 0x02, 0x00, "English" }, - {0x13, 0x01, 0x02, 0x02, "Japanese" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x04, "Easy" }, - {0x13, 0x01, 0x0c, 0x0c, "Normal" }, - {0x13, 0x01, 0x0c, 0x08, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0xc0, 0x00, "1" }, - {0x13, 0x01, 0xc0, 0x40, "2" }, - {0x13, 0x01, 0xc0, 0xc0, "3" }, - {0x13, 0x01, 0xc0, 0x80, "4" }, -}; - -STDDIPINFO(Hachamf) - -static struct BurnDIPInfo VandykeDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x12, 0x01, 0x01, 0x00, "2" }, - {0x12, 0x01, 0x01, 0x01, "3" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x20, 0x00, "Off" }, - {0x12, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0xc0, 0x00, "Easy" }, - {0x12, 0x01, 0xc0, 0xc0, "Normal" }, - {0x12, 0x01, 0xc0, 0x40, "Hard" }, - {0x12, 0x01, 0xc0, 0x80, "Hardest" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x13, 0x01, 0x01, 0x01, "Off" }, -// {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, -}; - -STDDIPINFO(Vandyke) - - -static struct BurnDIPInfo BlkheartDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x01, 0x01, "Off" }, -// {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x02, 0x02, "Off" }, - {0x12, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x0c, 0x0c, "Easy" }, - {0x12, 0x01, 0x0c, 0x08, "Normal" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x40, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x80, "4" }, - {0x12, 0x01, 0xc0, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x1c, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xe0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Blkheart) - -static struct BurnDIPInfo MacrossDIPList[]= -{ - {0x12, 0xff, 0xff, 0xf7, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x04, 0x04, "Off" }, -// {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x12, 0x01, 0x08, 0x00, "English" }, - {0x12, 0x01, 0x08, 0x08, "Japanese" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x30, 0x10, "Easy" }, - {0x12, 0x01, 0x30, 0x30, "Normal" }, - {0x12, 0x01, 0x30, 0x20, "Hard" }, - {0x12, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "1" }, - {0x12, 0x01, 0xc0, 0x40, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x80, "4" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x13, 0x01, 0x0f, 0x04, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x01, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x00, "5 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x02, "3 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x08, "4 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0c, "3 Coins 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x07, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "1 Coin 5 Credits" }, - {0x13, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x13, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x13, 0x01, 0xf0, 0x40, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x20, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "3 Coins 4 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "1 Coin 5 Credits" }, - {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x13, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Macross) - -static struct BurnDIPInfo TharrierDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x1c, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xe0, 0x00, "Free Play" }, - -// {0 , 0xfe, 0 , 2, "Cabinet" }, -// {0x14, 0x01, 0x01, 0x01, "Upright" }, -// {0x14, 0x01, 0x01, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x0c, 0x04, "Easy" }, - {0x14, 0x01, 0x0c, 0x0c, "Normal" }, - {0x14, 0x01, 0x0c, 0x08, "Hard" }, - {0x14, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "200k" }, - {0x14, 0x01, 0x30, 0x20, "200k and 1 Mil" }, - {0x14, 0x01, 0x30, 0x00, "200k, 500k & 1,2,3,5 Mil" }, - {0x14, 0x01, 0x30, 0x10, "None" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0xc0, 0x40, "2" }, - {0x14, 0x01, 0xc0, 0xc0, "3" }, - {0x14, 0x01, 0xc0, 0x80, "4" }, - {0x14, 0x01, 0xc0, 0x00, "5" }, -}; - -STDDIPINFO(Tharrier) - -static struct BurnDIPInfo ManyblocDIPList[]= -{ - {0x11, 0xff, 0xff, 0x18, NULL }, - {0x12, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 2, "Slot System" }, - {0x11, 0x01, 0x01, 0x00, "Off" }, - {0x11, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2, "Explanation" }, - {0x11, 0x01, 0x02, 0x00, "English" }, - {0x11, 0x01, 0x02, 0x02, "Japanese" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x11, 0x01, 0x08, 0x08, "Upright" }, - {0x11, 0x01, 0x08, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x11, 0x01, 0x10, 0x10, "Off" }, - {0x11, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x11, 0x01, 0x60, 0x60, "Easy" }, - {0x11, 0x01, 0x60, 0x00, "Normal" }, - {0x11, 0x01, 0x60, 0x20, "Hard" }, - {0x11, 0x01, 0x60, 0x40, "Hardest" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x11, 0x01, 0x80, 0x00, "Off" }, -// {0x11, 0x01, 0x80, 0x80, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0x07, 0x07, "5 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x00, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x03, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x38, 0x38, "5 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x30, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x20, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x00, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x08, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x10, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 4, "Plate Probability" }, - {0x12, 0x01, 0xc0, 0xc0, "Bad" }, - {0x12, 0x01, 0xc0, 0x00, "Normal" }, - {0x12, 0x01, 0xc0, 0x40, "Better" }, - {0x12, 0x01, 0xc0, 0x80, "Best" }, -}; - -STDDIPINFO(Manybloc) - -static struct BurnDIPInfo SsmissinDIPList[]= -{ - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x11, 0x01, 0x01, 0x01, "Off" }, -// {0x11, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x11, 0x01, 0x0c, 0x04, "Easy" }, - {0x11, 0x01, 0x0c, 0x0c, "Normal" }, - {0x11, 0x01, 0x0c, 0x08, "Hard" }, - {0x11, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x11, 0x01, 0xc0, 0x00, "1" }, - {0x11, 0x01, 0xc0, 0x40, "2" }, - {0x11, 0x01, 0xc0, 0xc0, "3" }, - {0x11, 0x01, 0xc0, 0x80, "4" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x12, 0x01, 0xe0, 0x20, "4 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0xa0, "3 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0x60, "2 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xe0, 0x40, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xe0, 0x80, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xe0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Ssmissin) - -static struct BurnDIPInfo Macross2DIPList[]= -{ - {0x12, 0xff, 0xff, 0xf7, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x04, 0x04, "Off" }, -// {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x12, 0x01, 0x08, 0x00, "English" }, - {0x12, 0x01, 0x08, 0x08, "Japanese" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x30, 0x10, "Easy" }, - {0x12, 0x01, 0x30, 0x30, "Normal" }, - {0x12, 0x01, 0x30, 0x20, "Hard" }, - {0x12, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x13, 0x01, 0x0f, 0x04, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x01, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x00, "5 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x02, "3 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x08, "4 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0c, "3 Coins 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x07, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "1 Coin 5 Credits" }, - {0x13, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x13, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x13, 0x01, 0xf0, 0x40, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x20, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "3 Coins 4 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "1 Coin 5 Credits" }, - {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x13, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Macross2) - -static struct BurnDIPInfo Tdragon2DIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x00, "Off" }, - {0x14, 0x01, 0x02, 0x02, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x04, 0x04, "Off" }, -// {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x30, 0x10, "Easy" }, - {0x14, 0x01, 0x30, 0x30, "Normal" }, - {0x14, 0x01, 0x30, 0x20, "Hard" }, - {0x14, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0xc0, 0x00, "1" }, - {0x14, 0x01, 0xc0, 0x40, "2" }, - {0x14, 0x01, 0xc0, 0xc0, "3" }, - {0x14, 0x01, 0xc0, 0x80, "4" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x15, 0x01, 0x0f, 0x04, "4 Coins 1 Credits" }, - {0x15, 0x01, 0x0f, 0x0a, "3 Coins 1 Credits" }, - {0x15, 0x01, 0x0f, 0x01, "2 Coins 1 Credits" }, - {0x15, 0x01, 0x0f, 0x00, "5 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x02, "3 Coins 2 Credits" }, - {0x15, 0x01, 0x0f, 0x08, "4 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x15, 0x01, 0x0f, 0x0c, "3 Coins 4 Credits" }, - {0x15, 0x01, 0x0f, 0x0e, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x0f, 0x07, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x15, 0x01, 0x0f, 0x0b, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x15, 0x01, 0x0f, 0x0d, "1 Coin 5 Credits" }, - {0x15, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x15, 0x01, 0xf0, 0x40, "4 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xa0, "3 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0x10, "2 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0x20, "3 Coins 2 Credits" }, - {0x15, 0x01, 0xf0, 0x80, "4 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x15, 0x01, 0xf0, 0xc0, "3 Coins 4 Credits" }, - {0x15, 0x01, 0xf0, 0xe0, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0x70, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x15, 0x01, 0xf0, 0xb0, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xf0, 0xd0, "1 Coin 5 Credits" }, - {0x15, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - {0x15, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Tdragon2) - -static struct BurnDIPInfo Stagger1DIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "1" }, - {0x12, 0x01, 0xc0, 0x80, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x40, "5" }, - -// {0 , 0xfe, 0 , 4, "Flip Screen" }, -// {0x13, 0x01, 0x03, 0x03, "Off" }, -// {0x13, 0x01, 0x03, 0x00, "On" }, -// {0x13, 0x01, 0x03, 0x02, "Horizontally" }, -// {0x13, 0x01, 0x03, 0x01, "Vertically" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x18, 0x08, "Easy" }, - {0x13, 0x01, 0x18, 0x18, "Normal" }, - {0x13, 0x01, 0x18, 0x10, "Hard" }, - {0x13, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, -}; - -STDDIPINFO(Stagger1) - -static struct BurnDIPInfo GrdnstrmDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x12, 0x01, 0x04, 0x04, "Off" }, - {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Bombs" }, - {0x12, 0x01, 0x08, 0x08, "2" }, - {0x12, 0x01, 0x08, 0x00, "3" }, - - {0 , 0xfe, 0 , 0, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "1" }, - {0x12, 0x01, 0xc0, 0x80, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x40, "5" }, - -// {0 , 0xfe, 0 , 0, "Mirror Screen" }, -// {0x13, 0x01, 0x01, 0x01, "Off" }, -// {0x13, 0x01, 0x01, 0x00, "On" }, - -// {0 , 0xfe, 0 , 4, "Flip Screen" }, -// {0x13, 0x01, 0x02, 0x02, "Off" }, -// {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x13, 0x01, 0x18, 0x08, "Easy" }, - {0x13, 0x01, 0x18, 0x18, "Normal" }, - {0x13, 0x01, 0x18, 0x10, "Hard" }, - {0x13, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, -}; - -STDDIPINFO(Grdnstrm) - -static struct BurnDIPInfo GrdnstrkDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x12, 0x01, 0x04, 0x04, "Off" }, - {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Bombs" }, - {0x12, 0x01, 0x08, 0x08, "2" }, - {0x12, 0x01, 0x08, 0x00, "3" }, - - {0 , 0xfe, 0 , 0, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "1" }, - {0x12, 0x01, 0xc0, 0x80, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x40, "5" }, - -// {0 , 0xfe, 0 , 0, "Flip Screen" }, -// {0x13, 0x01, 0x01, 0x01, "Off" }, -// {0x13, 0x01, 0x01, 0x00, "On" }, - -// {0 , 0xfe, 0 , 4, "Mirror Screen" }, -// {0x13, 0x01, 0x02, 0x02, "Off" }, -// {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x13, 0x01, 0x18, 0x08, "Easy" }, - {0x13, 0x01, 0x18, 0x18, "Normal" }, - {0x13, 0x01, 0x18, 0x10, "Hard" }, - {0x13, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, -}; - -STDDIPINFO(Grdnstrk) - -static struct BurnDIPInfo PopspopsDIPList[]= -{ - {0x12, 0xff, 0xff, 0xfa, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x18, 0x10, "Easy" }, - {0x13, 0x01, 0x18, 0x18, "Normal" }, - {0x13, 0x01, 0x18, 0x08, "Hard" }, - {0x13, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, -}; - -STDDIPINFO(Popspops) - -static struct BurnDIPInfo Bubl2000DIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Normal" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Free Credit" }, - {0x12, 0x01, 0xc0, 0x80, "500k" }, - {0x12, 0x01, 0xc0, 0xc0, "800k" }, - {0x12, 0x01, 0xc0, 0x40, "1000k" }, - {0x12, 0x01, 0xc0, 0x00, "1500k" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 7, "Coin B" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 7, "Coin A" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, -}; - -STDDIPINFO(Bubl2000) - -static struct BurnDIPInfo MangchiDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "DSWS" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 4, "Vs Rounds" }, - {0x12, 0x01, 0x18, 0x18, "2" }, - {0x12, 0x01, 0x18, 0x10, "3" }, - {0x12, 0x01, 0x18, 0x08, "4" }, - {0x12, 0x01, 0x18, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x18, 0x08, "Easy" }, - {0x13, 0x01, 0x18, 0x18, "Normal" }, - {0x13, 0x01, 0x18, 0x10, "Hard" }, - {0x13, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, -}; - -STDDIPINFO(Mangchi) - -static struct BurnDIPInfo FirehawkDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 6, "Difficulty" }, - {0x12, 0x01, 0x0e, 0x06, "Very Easy" }, - {0x12, 0x01, 0x0e, 0x08, "Easy" }, - {0x12, 0x01, 0x0e, 0x0e, "Normal" }, - {0x12, 0x01, 0x0e, 0x02, "Hard" }, - {0x12, 0x01, 0x0e, 0x04, "Hardest" }, - {0x12, 0x01, 0x0e, 0x0c, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x10, 0x00, "Off" }, - {0x12, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2, "Number of Bombs" }, - {0x12, 0x01, 0x20, 0x20, "2" }, - {0x12, 0x01, 0x20, 0x00, "3" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "1" }, - {0x12, 0x01, 0xc0, 0x80, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x40, "4" }, - - {0 , 0xfe, 0 , 2, "Region" }, - {0x13, 0x01, 0x02, 0x02, "English" }, - {0x13, 0x01, 0x02, 0x00, "China" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Continue Coins" }, - {0x13, 0x01, 0x18, 0x18, "1 Coin" }, - {0x13, 0x01, 0x18, 0x08, "2 Coins" }, - {0x13, 0x01, 0x18, 0x10, "3 Coins" }, - {0x13, 0x01, 0x18, 0x00, "4 Coins" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, -}; - -STDDIPINFO(Firehawk) - -static struct BurnDIPInfo Spec2kDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x12, 0x01, 0x04, 0x04, "Off" }, - {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Number of Bombs" }, - {0x12, 0x01, 0x08, 0x08, "2" }, - {0x12, 0x01, 0x08, 0x00, "3" }, - - {0 , 0xfe, 0 , 2, "Copyright Notice" }, - {0x12, 0x01, 0x10, 0x00, "Off" }, - {0x12, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "1" }, - {0x12, 0x01, 0xc0, 0x80, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x40, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x18, 0x08, "Easy" }, - {0x13, 0x01, 0x18, 0x18, "Normal" }, - {0x13, 0x01, 0x18, 0x10, "Hard" }, - {0x13, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, -}; - -STDDIPINFO(Spec2k) - -static struct BurnDIPInfo TwinactnDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x1c, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xe0, 0x00, "Free Play" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x13, 0x01, 0x01, 0x01, "Off" }, -// {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x0c, "Easy" }, - {0x13, 0x01, 0x0c, 0x04, "Normal" }, - {0x13, 0x01, 0x0c, 0x08, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0xc0, 0x40, "2" }, - {0x13, 0x01, 0xc0, 0xc0, "3" }, - {0x13, 0x01, 0xc0, 0x80, "4" }, - {0x13, 0x01, 0xc0, 0x00, "5" }, -}; - -STDDIPINFO(Twinactn) - -static struct BurnDIPInfo BjtwinDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x01, 0x01, "Off" }, -// {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Starting level" }, - {0x12, 0x01, 0x0e, 0x08, "Germany" }, - {0x12, 0x01, 0x0e, 0x04, "Thailand" }, - {0x12, 0x01, 0x0e, 0x0c, "Nevada" }, - {0x12, 0x01, 0x0e, 0x0e, "Japan" }, - {0x12, 0x01, 0x0e, 0x06, "Korea" }, - {0x12, 0x01, 0x0e, 0x0a, "England" }, - {0x12, 0x01, 0x0e, 0x02, "Hong Kong" }, - {0x12, 0x01, 0x0e, 0x00, "China" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x30, 0x20, "Easy" }, - {0x12, 0x01, 0x30, 0x30, "Normal" }, - {0x12, 0x01, 0x30, 0x10, "Hard" }, - {0x12, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "1" }, - {0x12, 0x01, 0xc0, 0x40, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x80, "4" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x1c, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xe0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Bjtwin) - -static struct BurnDIPInfo SabotenbDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x01, 0x01, "Off" }, -// {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x12, 0x01, 0x02, 0x02, "Japanese" }, - {0x12, 0x01, 0x02, 0x00, "English" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Normal" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "1" }, - {0x12, 0x01, 0xc0, 0x40, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x80, "4" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x1c, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xe0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Sabotenb) - -static struct BurnDIPInfo NouryokuDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Life Decrease Speed" }, - {0x12, 0x01, 0x03, 0x02, "Slow" }, - {0x12, 0x01, 0x03, 0x03, "Normal" }, - {0x12, 0x01, 0x03, 0x01, "Fast" }, - {0x12, 0x01, 0x03, 0x00, "Very Fast" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Normal" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x12, 0x01, 0xe0, 0x20, "4 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0xa0, "3 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0x60, "2 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xe0, 0x00, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xe0, 0x40, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xe0, 0x80, "1 Coin 4 Credits" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x13, 0x01, 0x20, 0x20, "Off" }, -// {0x13, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Nouryoku) - -static struct BurnDIPInfo MustangDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x1c, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xe0, 0x00, "Free Play" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x13, 0x01, 0x01, 0x01, "Off" }, -// {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x04, "Easy" }, - {0x13, 0x01, 0x0c, 0x0c, "Normal" }, - {0x13, 0x01, 0x0c, 0x08, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0xc0, 0x40, "2" }, - {0x13, 0x01, 0xc0, 0xc0, "3" }, - {0x13, 0x01, 0xc0, 0x80, "4" }, - {0x13, 0x01, 0xc0, 0x00, "5" }, -}; - -STDDIPINFO(Mustang) - -static struct BurnDIPInfo TdragonbDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x03, 0x00, "1" }, - {0x12, 0x01, 0x03, 0x02, "2" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x01, "4" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x30, 0x20, "Easy" }, - {0x12, 0x01, 0x30, 0x30, "Normal" }, - {0x12, 0x01, 0x30, 0x10, "Hard" }, - {0x12, 0x01, 0x30, 0x00, "Hardest" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x80, 0x80, "Off" }, -// {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x38, 0x20, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x38, 0x10, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x38, 0x08, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x38, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Tdragonb) - -static struct BurnDIPInfo TdragonDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x01, 0x01, "Off" }, -// {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x0c, 0x04, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Normal" }, - {0x12, 0x01, 0x0c, 0x08, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0x00, "1" }, - {0x12, 0x01, 0xc0, 0x40, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x80, "4" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x38, 0x20, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x38, 0x10, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x38, 0x08, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x38, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Tdragon) - -static struct BurnDIPInfo AcrobatmDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xf7, NULL }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x13, 0x01, 0x02, 0x02, "Off" }, -// {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x06, 0x02, "50k and 100k" }, - {0x14, 0x01, 0x06, 0x06, "100k and 100k" }, - {0x14, 0x01, 0x06, 0x04, "100k and 200k" }, - {0x14, 0x01, 0x06, 0x00, "None" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x14, 0x01, 0x08, 0x00, "English" }, - {0x14, 0x01, 0x08, 0x08, "Japanese" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x30, 0x00, "Hardest" }, - {0x14, 0x01, 0x30, 0x10, "Easy" }, - {0x14, 0x01, 0x30, 0x20, "Hard" }, - {0x14, 0x01, 0x30, 0x30, "Normal" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0xc0, 0x40, "2" }, - {0x14, 0x01, 0xc0, 0xc0, "3" }, - {0x14, 0x01, 0xc0, 0x80, "4" }, - {0x14, 0x01, 0xc0, 0x00, "5" }, -}; - -STDDIPINFO(Acrobatm) - -static struct BurnDIPInfo GunnailDIPList[]= -{ - {0x12, 0xff, 0xff, 0xfd, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x12, 0x01, 0x01, 0x01, "Off" }, -// {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x12, 0x01, 0x02, 0x02, "Japanese" }, - {0x12, 0x01, 0x02, 0x00, "English" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Normal" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x1c, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xe0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Gunnail) - -//------------------------------------------------------------------------------------------------------------ -// NMK112 chip emulation -- probably should be in an external file - -#define MAXCHIPS 2 -#define TABLESIZE 0x100 -#define BANKSIZE 0x10000 - -static UINT8 page_mask; -static UINT8 current_bank[8]; -static UINT8 *region[2]; -static UINT32 regionlen[2]; - -void NMK112_okibank_write(INT32 offset, UINT8 data) -{ - INT32 chip = (offset & 4) >> 2; - INT32 banknum = offset & 3; - INT32 paged = (page_mask & (1 << chip)); - - UINT8 *rom = region[chip]; - INT32 size = regionlen[chip] - 0x40000; - INT32 bankaddr = (data * BANKSIZE) % size; - - if (current_bank[offset] == data) return; - current_bank[offset] = data; - - if ((paged) && (banknum == 0)) - memcpy (rom + 0x400, rom + 0x40000 + bankaddr+0x400, BANKSIZE-0x400); - else - memcpy (rom + banknum * BANKSIZE, rom + 0x40000 + bankaddr, BANKSIZE); - - if (paged) - { - rom += banknum * TABLESIZE; - memcpy(rom, rom + 0x40000 + bankaddr, TABLESIZE); - } -} - -void NMK112Reset() -{ - memset (current_bank, ~0, sizeof(current_bank)); - NMK112_okibank_write(0, 0); - NMK112_okibank_write(4, 0); -} - -void NMK112_init(UINT8 disable_page_mask, UINT8 *rgn0, UINT8 *rgn1, INT32 len0, INT32 len1) -{ - region[0] = rgn0; - region[1] = rgn1; - regionlen[0] = len0; - regionlen[1] = len1; - page_mask = ~disable_page_mask; - NMK112Reset(); -} - -//------------------------------------------------------------------------------------------------------------ - -#define STRANGE_RAM_WRITE_BYTE(value) \ - if ((address & 0xffff0000) == value) { \ - Drv68KRAM[(address & 0xfffe) | 0] = data; \ - Drv68KRAM[(address & 0xfffe) | 1] = data; \ - return; \ - } \ - -// MAKE SHORT ^^ - -#define STRANGE_RAM_WRITE_WORD(value) \ - if ((address & 0xffff0000) == value) { \ - *((UINT16*)(Drv68KRAM + (address & 0xfffe))) = BURN_ENDIAN_SWAP_INT16(data); \ - return; \ - } \ - -#define PROT_JSR(_offs_,_protvalue_,_pc_) \ - if(nmk16_mainram[(_offs_)/2] == BURN_ENDIAN_SWAP_INT16(_protvalue_)) \ - { \ - nmk16_mainram[(_offs_)/2] = 0xffff; /*(MCU job done)*/ \ - nmk16_mainram[(_offs_+2-0x10)/2] = BURN_ENDIAN_SWAP_INT16(0x4ef9);/*JMP*/\ - nmk16_mainram[(_offs_+4-0x10)/2] = 0x0000;/*HI-DWORD*/\ - nmk16_mainram[(_offs_+6-0x10)/2] = BURN_ENDIAN_SWAP_INT16(_pc_); /*LO-DWORD*/\ - } \ - -#define PROT_INPUT(_offs_,_protvalue_,_protinput_,_input_) \ - if(nmk16_mainram[_offs_] == BURN_ENDIAN_SWAP_INT16(_protvalue_)) \ - {\ - nmk16_mainram[_protinput_] = BURN_ENDIAN_SWAP_INT16((_input_ & 0xffff0000)>>16);\ - nmk16_mainram[_protinput_+1] = BURN_ENDIAN_SWAP_INT16(_input_ & 0x0000ffff);\ - } - -//------------------------------------------------------------------------------------------------------------ -// MCU simulation stuff - -static INT32 prot_count = 0; - -static UINT8 tharrier_mcu_r() -{ - UINT16 *nmk16_mainram = (UINT16*)Drv68KRAM; - - static const UINT8 to_main[15] = - { - 0x82,0xc7,0x00,0x2c,0x6c,0x00,0x9f,0xc7,0x00,0x29,0x69,0x00,0x8b,0xc7,0x00 - }; - - INT32 res; - - if (SekGetPC(-1)==0x08aa) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9064/2]))|0x20; - else if (SekGetPC(-1)==0x08ce) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9064/2]))|0x60; - else if (SekGetPC(-1)==0x0332) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x90f6/2]))|0x00; - else if (SekGetPC(-1)==0x64f4) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x90f6/2]))|0x00; - else - { - res = to_main[prot_count++]; - if (prot_count > 14) - prot_count = 0; - } - return res; -} - -static void HachaRAMProt(INT32 offset) -{ - UINT16 *nmk16_mainram = (UINT16*)Drv68KRAM; - - switch(offset) - { - case 0xe058/2: PROT_INPUT(0xe058/2,0xc71f,0xe000/2,0x00080000); break; - case 0xe182/2: PROT_INPUT(0xe182/2,0x865d,0xe004/2,0x00080002); break; - case 0xe51e/2: PROT_INPUT(0xe51e/2,0x0f82,0xe008/2,0x00080008); break; - case 0xe6b4/2: PROT_INPUT(0xe6b4/2,0x79be,0xe00c/2,0x0008000a); break; - case 0xe10e/2: PROT_JSR(0xe10e,0x8007,0x870a); //870a not 9d66 - PROT_JSR(0xe10e,0x8000,0xd9c6); break; - case 0xe11e/2: PROT_JSR(0xe11e,0x8038,0x972a); // 972a - PROT_JSR(0xe11e,0x8031,0xd1f8); break; - case 0xe12e/2: PROT_JSR(0xe12e,0x8019,0x9642); // OK-9642 - PROT_JSR(0xe12e,0x8022,0xda06); break; - case 0xe13e/2: PROT_JSR(0xe13e,0x802a,0x9d66); // 9d66 not 9400 - OK - PROT_JSR(0xe13e,0x8013,0x81aa); break; - case 0xe14e/2: PROT_JSR(0xe14e,0x800b,0xb3f2); // b3f2 - OK - PROT_JSR(0xe14e,0x8004,0x8994); break; - case 0xe15e/2: PROT_JSR(0xe15e,0x803c,0xb59e); // b59e - OK - PROT_JSR(0xe15e,0x8035,0x8d0c); break; - case 0xe16e/2: PROT_JSR(0xe16e,0x801d,0x9ac2); // 9ac2 - OK - PROT_JSR(0xe16e,0x8026,0x8c36); break; - case 0xe17e/2: PROT_JSR(0xe17e,0x802e,0xc366); // c366 - OK - PROT_JSR(0xe17e,0x8017,0x870a); break; - case 0xe18e/2: PROT_JSR(0xe18e,0x8004,0xd620); // unused - PROT_JSR(0xe18e,0x8008,0x972a); break; // unused - case 0xe19e/2: PROT_JSR(0xe19e,0x8030,0xd9c6); // OK-d9c6 - PROT_JSR(0xe19e,0x8039,0x9642); break; - case 0xe1ae/2: PROT_JSR(0xe1ae,0x8011,0xd1f8); // d1f8 not c67e - PROT_JSR(0xe1ae,0x802a,0x9d66); break; - case 0xe1be/2: PROT_JSR(0xe1be,0x8022,0xda06); // da06 - PROT_JSR(0xe1be,0x801b,0xb3f2); break; - case 0xe1ce/2: PROT_JSR(0xe1ce,0x8003,0x81aa); // 81aa - PROT_JSR(0xe1ce,0x800c,0xb59e); break; - case 0xe1de/2: PROT_JSR(0xe1de,0x8034,0x8994); // 8994 - OK - PROT_JSR(0xe1de,0x803d,0x9ac2); break; - case 0xe1ee/2: PROT_JSR(0xe1ee,0x8015,0x8d0c); // 8d0c not 82f6 - PROT_JSR(0xe1ee,0x802e,0xc366); break; - case 0xe1fe/2: PROT_JSR(0xe1fe,0x8026,0x8c36); // 8c36 - PROT_JSR(0xe1fe,0x8016,0xd620); break; // unused - case 0xef00/2: - if(nmk16_mainram[0xef00/2] == BURN_ENDIAN_SWAP_INT16(0x60fe)) - { - nmk16_mainram[0xef00/2] = 0x0000; // this is the coin counter - nmk16_mainram[0xef02/2] = 0x0000; - nmk16_mainram[0xef04/2] = BURN_ENDIAN_SWAP_INT16(0x4ef9); - nmk16_mainram[0xef06/2] = 0x0000; - nmk16_mainram[0xef08/2] = BURN_ENDIAN_SWAP_INT16(0x7dc2); - } - break; - } -} - -static void tdragon_mainram_w(INT32 offset) -{ - UINT16 *nmk16_mainram = (UINT16*)Drv68KRAM; - - switch(offset) - { - case 0xe066/2: PROT_INPUT(0xe066/2,0xe23e,0xe000/2,0x000c0000); break; - case 0xe144/2: PROT_INPUT(0xe144/2,0xf54d,0xe004/2,0x000c0002); break; - case 0xe60e/2: PROT_INPUT(0xe60e/2,0x067c,0xe008/2,0x000c0008); break; - case 0xe714/2: PROT_INPUT(0xe714/2,0x198b,0xe00c/2,0x000c000a); break; - case 0xe70e/2: PROT_JSR(0xe70e,0x8007,0x9e22); - PROT_JSR(0xe70e,0x8000,0xd518); break; - case 0xe71e/2: PROT_JSR(0xe71e,0x8038,0xaa0a); - PROT_JSR(0xe71e,0x8031,0x8e7c); break; - case 0xe72e/2: PROT_JSR(0xe72e,0x8019,0xac48); - PROT_JSR(0xe72e,0x8022,0xd558); break; - case 0xe73e/2: PROT_JSR(0xe73e,0x802a,0xb110); - PROT_JSR(0xe73e,0x8013,0x96da); break; - case 0xe74e/2: PROT_JSR(0xe74e,0x800b,0xb9b2); - PROT_JSR(0xe74e,0x8004,0xa062); break; - case 0xe75e/2: PROT_JSR(0xe75e,0x803c,0xbb4c); - PROT_JSR(0xe75e,0x8035,0xa154); break; - case 0xe76e/2: PROT_JSR(0xe76e,0x801d,0xafa6); - PROT_JSR(0xe76e,0x8026,0xa57a); break; - case 0xe77e/2: PROT_JSR(0xe77e,0x802e,0xc6a4); - PROT_JSR(0xe77e,0x8017,0x9e22); break; - case 0xe78e/2: PROT_JSR(0xe78e,0x8004,0xaa0a); - PROT_JSR(0xe78e,0x8008,0xaa0a); break; - case 0xe79e/2: PROT_JSR(0xe79e,0x8030,0xd518); - PROT_JSR(0xe79e,0x8039,0xac48); break; - case 0xe7ae/2: PROT_JSR(0xe7ae,0x8011,0x8e7c); - PROT_JSR(0xe7ae,0x802a,0xb110); break; - case 0xe7be/2: PROT_JSR(0xe7be,0x8022,0xd558); - PROT_JSR(0xe7be,0x801b,0xb9b2); break; - case 0xe7ce/2: PROT_JSR(0xe7ce,0x8003,0x96da); - PROT_JSR(0xe7ce,0x800c,0xbb4c); break; - case 0xe7de/2: PROT_JSR(0xe7de,0x8034,0xa062); - PROT_JSR(0xe7de,0x803d,0xafa6); break; - case 0xe7ee/2: PROT_JSR(0xe7ee,0x8015,0xa154); - PROT_JSR(0xe7ee,0x802e,0xc6a4); break; - case 0xe7fe/2: PROT_JSR(0xe7fe,0x8026,0xa57a); - PROT_JSR(0xe7fe,0x8016,0xa57a); break; - case 0xef00/2: - if(nmk16_mainram[0xef00/2] == BURN_ENDIAN_SWAP_INT16(0x60fe)) - { - nmk16_mainram[0xef00/2] = 0x0000; // this is the coin counter - nmk16_mainram[0xef02/2] = 0x0000; - nmk16_mainram[0xef04/2] = BURN_ENDIAN_SWAP_INT16(0x4ef9); - nmk16_mainram[0xef06/2] = 0x0000; - nmk16_mainram[0xef08/2] = BURN_ENDIAN_SWAP_INT16(0x92f4); - } - break; - } -} - -static void mcu_run(UINT8 dsw_setting) -{ - static UINT8 input_pressed; - static UINT16 coin_input; - UINT8 dsw[2]; - static UINT8 start_helper = 0; - static UINT8 coin_count[2],coin_count_frac[2]; - static UINT8 i; - - UINT16 *nmk16_mainram = (UINT16*)Drv68KRAM; - - if(start_helper & 1 && BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9000/2]) & 0x0200) // start 1 - { - nmk16_mainram[0xef00/2]--; - start_helper = start_helper & 2; - } - if(start_helper & 2 && BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9000/2]) & 0x0100) // start 2 - { - nmk16_mainram[0xef00/2]--; - start_helper = start_helper & 1; - } - - if(dsw_setting) // Thunder Dragon - { - dsw[0] = (DrvDips[1] & 0x7); - dsw[1] = (DrvDips[1] & 0x38) >> 3; - for(i=0;i<2;i++) - { - switch(dsw[i] & 7) - { - case 0: nmk16_mainram[0x9000/2]|=BURN_ENDIAN_SWAP_INT16(0x4000); break; // free play - case 1: coin_count_frac[i] = 1; coin_count[i] = 4; break; - case 2: coin_count_frac[i] = 1; coin_count[i] = 3; break; - case 3: coin_count_frac[i] = 1; coin_count[i] = 2; break; - case 4: coin_count_frac[i] = 4; coin_count[i] = 1; break; - case 5: coin_count_frac[i] = 3; coin_count[i] = 1; break; - case 6: coin_count_frac[i] = 2; coin_count[i] = 1; break; - case 7: coin_count_frac[i] = 1; coin_count[i] = 1; break; - } - } - } - else // Hacha Mecha Fighter - { - dsw[0] = (DrvDips[1] & 0x07) >> 0; - dsw[1] = (DrvDips[1] & 0x38) >> 3; - for(i=0;i<2;i++) - { - switch(dsw[i] & 7) - { - case 0: nmk16_mainram[0x9000/2]|=BURN_ENDIAN_SWAP_INT16(0x4000); break; // free play - case 1: coin_count_frac[i] = 4; coin_count[i] = 1; break; - case 2: coin_count_frac[i] = 3; coin_count[i] = 1; break; - case 3: coin_count_frac[i] = 2; coin_count[i] = 1; break; - case 4: coin_count_frac[i] = 1; coin_count[i] = 4; break; - case 5: coin_count_frac[i] = 1; coin_count[i] = 3; break; - case 6: coin_count_frac[i] = 1; coin_count[i] = 2; break; - case 7: coin_count_frac[i] = 1; coin_count[i] = 1; break; - } - } - } - - // read the coin port - coin_input = (~(DrvInputs[0])); - - if(coin_input & 0x01) // coin 1 - { - if((input_pressed & 0x01) == 0) - { - if(coin_count_frac[0] != 1) - { - nmk16_mainram[0xef02/2]+=coin_count[0]; - if(coin_count_frac[0] == nmk16_mainram[0xef02/2]) - { - nmk16_mainram[0xef00/2]+=coin_count[0]; - nmk16_mainram[0xef02/2] = 0; - } - } - else - nmk16_mainram[0xef00/2]+=coin_count[0]; - } - input_pressed = (input_pressed & 0xfe) | 1; - } - else - input_pressed = (input_pressed & 0xfe); - - if(coin_input & 0x02) // coin 2 - { - if((input_pressed & 0x02) == 0) - { - if(coin_count_frac[1] != 1) - { - nmk16_mainram[0xef02/2]+=coin_count[1]; - if(coin_count_frac[1] == nmk16_mainram[0xef02/2]) - { - nmk16_mainram[0xef00/2]+=coin_count[1]; - nmk16_mainram[0xef02/2] = 0; - } - } - else - nmk16_mainram[0xef00/2]+=coin_count[1]; - } - input_pressed = (input_pressed & 0xfd) | 2; - } - else - input_pressed = (input_pressed & 0xfd); - - if(coin_input & 0x04) // service 1 - { - if((input_pressed & 0x04) == 0) - nmk16_mainram[0xef00/2]++; - input_pressed = (input_pressed & 0xfb) | 4; - } - else - input_pressed = (input_pressed & 0xfb); - - if(nmk16_mainram[0xef00/2] > 0 && nmk16_mainram[0x9000/2] & 0x8000) //enable start button - { - if(coin_input & 0x08) // start 1 - { - if((input_pressed & 0x08) == 0 && (!(nmk16_mainram[0x9000/2] & 0x0200))) // start 1 - start_helper = 1; - - input_pressed = (input_pressed & 0xf7) | 8; - } - else - input_pressed = (input_pressed & 0xf7); - - if(coin_input & 0x10) // start 2 - { - if((input_pressed & 0x10) == 0 && (!(nmk16_mainram[0x9000/2] & 0x0100))) // start 2 - start_helper = (nmk16_mainram[0x9000/2] == 0x8000) ? (3) : (2); - - input_pressed = (input_pressed & 0xef) | 0x10; - } - else - input_pressed = (input_pressed & 0xef); - } -} - -//------------------------------------------------------------------------------------------------- - -void __fastcall tharrier_main_write_byte(UINT32 address, UINT8 data) -{ - STRANGE_RAM_WRITE_BYTE(0xf0000) -} - -void __fastcall tharrier_main_write_word(UINT32 address, UINT16 data) -{ - STRANGE_RAM_WRITE_WORD(0xf0000) - - switch (address) - { - case 0x080010: // mcu write.. unused... - return; - - case 0x08001e: - *soundlatch = data; - return; - } -} - -UINT8 __fastcall tharrier_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[0] >> 8; - - case 0x080001: - return DrvInputs[0]; - - case 0x080002: - return tharrier_mcu_r(); - - case 0x080003: - return DrvInputs[1]; - - case 0x080004: - return DrvDips[1]; - - case 0x080005: - return DrvDips[0]; - - case 0x08000e: - case 0x08000f: - return *soundlatch2; - - case 0x080202: - return DrvInputs[2] >> 8; - - case 0x080203: - return DrvInputs[2]; - } - - return 0; -} - -UINT16 __fastcall tharrier_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1]; - - case 0x080004: - return (DrvDips[0] << 8) | DrvDips[1]; - - case 0x08000e: - return *soundlatch2; - - case 0x080202: - return DrvInputs[2]; - } - - return 0; -} - -void __fastcall manybloc_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x080014: - case 0x080015: - // *flipscreen = data & 1; - return; - - case 0x08001e: - case 0x08001f: - *soundlatch = data; - return; - } -} - -void __fastcall manybloc_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x080014: - // *flipscreen = data & 1; - return; - - case 0x08001e: - *soundlatch = data; - return; - } -} - -UINT8 __fastcall manybloc_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[0] >> 8; - - case 0x080001: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1] >> 8; - - case 0x080003: - return DrvInputs[1]; - - case 0x080004: - return DrvDips[0]; - - case 0x080005: - return DrvDips[1]; - - case 0x08001e: - case 0x08001f: - return *soundlatch2; - } - - return 0; -} - -UINT16 __fastcall manybloc_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1]; - - case 0x080004: - return (DrvDips[0] << 8) | DrvDips[1]; - - case 0x08001e: - return *soundlatch2; - } - - return 0; -} - -void __fastcall ssmissin_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x0c0014: - case 0x0c0015: - // *flipscreen = data & 1; - return; - - case 0x0c0018: - case 0x0c0019: - if (data != 0xff) { - *tilebank = data; - } - return; - - case 0x0c001e: - case 0x0c001f: - *soundlatch = data; - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - } -} - -void __fastcall ssmissin_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x0c0014: - // *flipscreen = data & 1; - return; - - case 0x0c0018: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x0c001e: - *soundlatch = data; - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - } -} - -UINT8 __fastcall ssmissin_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x0c0000: - return DrvInputs[0] >> 8; - - case 0x0c0001: - return DrvInputs[0]; - - case 0x0c0004: - return DrvInputs[1] >> 8; - - case 0x0c0005: - return DrvInputs[1]; - - case 0x0c0006: - return DrvDips[0]; - - case 0x0c0007: - return DrvDips[1]; - } - - return 0; -} - -UINT16 __fastcall ssmissin_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x0c0000: - return DrvInputs[0]; - - case 0x0c0004: - return DrvInputs[1]; - - case 0x0c0006: - return (DrvDips[0] << 8) | DrvDips[1]; - } - - return 0; -} - -UINT8 __fastcall macross2_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x100000: - return DrvInputs[0] >> 8; - - case 0x100001: - return DrvInputs[0]; - - case 0x100002: - return DrvInputs[1] >> 8; - - case 0x100003: - return DrvInputs[1]; - - case 0x100008: - case 0x100009: - return DrvDips[0]; - - case 0x10000a: - case 0x10000b: - return DrvDips[1]; - - case 0x10000e: - case 0x10000f: - return *soundlatch2; - } - - return 0; -} - -UINT16 __fastcall macross2_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x100000: - return DrvInputs[0]; - - case 0x100002: - return DrvInputs[1]; - - case 0x100008: - return (DrvDips[0] << 8) | DrvDips[0]; - - case 0x10000a: - return (DrvDips[1] << 8) | DrvDips[1]; - - case 0x10000e: - return *soundlatch2; - } - - return 0; -} - -void __fastcall macross2_main_write_byte(UINT32 address, UINT8 data) -{ - bprintf (0, _T("%x, %x wb\n"), address, data); - - switch (address) - { - case 0x100014: - case 0x100015: - // *flipscreen = data & 1; - return; - } -} - -void __fastcall macross2_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x100014: - // *flipscreen = data & 1; - return; - - case 0x100016: - if (data == 0) { - if (macross2_sound_enable != 0) { - ZetReset(); - } - } - macross2_sound_enable = data; - return; - - case 0x100018: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x10001e: - *soundlatch = data; - return; - } -} - -void __fastcall afega_main_write_word(UINT32 address, UINT16 data) -{ - if (address & 0xfff00000) { - SekWriteWord(address & 0xfffff, data); - return; - } - - STRANGE_RAM_WRITE_WORD(0xc0000) - STRANGE_RAM_WRITE_WORD(0xf0000) - - switch (address) - { - case 0x080014: - // *flipscreen = data & 1; - return; - - - case 0x08001e: - *soundlatch = data & 0xff; - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - } -} - -void __fastcall afega_main_write_byte(UINT32 address, UINT8 data) -{ - if (address & 0xfff00000) { - SekWriteByte(address & 0xfffff, data); - return; - } - - STRANGE_RAM_WRITE_BYTE(0xc0000) - STRANGE_RAM_WRITE_BYTE(0xf0000) - - switch (address) - { - case 0x080014: - case 0x080015: - // *flipscreen = data & 1; - return; - - case 0x08001e: - case 0x08001f: - *soundlatch = data & 0xff; - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - return; - } -} - -UINT8 __fastcall afega_main_read_byte(UINT32 address) -{ - if (address & 0xfff00000) { - return SekReadByte(address & 0xfffff); - } - - switch (address) - { - case 0x080000: - return DrvInputs[0] >> 8; - - case 0x080001: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1] >> 8; - - case 0x080003: - return DrvInputs[1]; - - case 0x080004: - return DrvDips[0]; - - case 0x080005: - return DrvDips[1]; - - case 0x080012: - case 0x080013: - return 0x01; - } - - return 0; -} - -UINT16 __fastcall afega_main_read_word(UINT32 address) -{ - if (address & 0xfff00000) { - return SekReadWord(address & 0xfffff); - } - - switch (address) - { - case 0x080000: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1]; - - case 0x080004: - return ((DrvDips[0] << 8) | DrvDips[1]); - - case 0x080012: - return 0x0100; - } - - return 0; -} - -void __fastcall bjtwin_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x080014: - case 0x080015: - // *flipscreen = data & 1; - return; - - case 0x094000: - case 0x094001: - if (data != 0xff) { - *tilebank = data; - } - return; - } -} - -void __fastcall bjtwin_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x080014: - // *flipscreen = data & 1; - return; - - case 0x084000: - MSM6295Command(0, data & 0xff); - return; - - case 0x084010: - MSM6295Command(1, data & 0xff); - return; - - case 0x084020: - case 0x084022: - case 0x084024: - case 0x084026: - case 0x084028: - case 0x08402a: - case 0x08402c: - case 0x08402e: - NMK112_okibank_write((address >> 1) & 7, data); - return; - - case 0x094000: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - } -} - -UINT8 __fastcall bjtwin_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[0] >> 8; - - case 0x080001: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1] >> 8; - - case 0x080003: - return DrvInputs[1]; - - case 0x080008: - case 0x080009: - return DrvDips[0]; - - case 0x08000a: - case 0x08000b: - return DrvDips[1]; - - case 0x084000: - case 0x084001: - return MSM6295ReadStatus(0); - - case 0x084010: - case 0x084011: - return MSM6295ReadStatus(1); - } - - return 0; -} - -UINT16 __fastcall bjtwin_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1]; - - case 0x080008: - return 0xff00 | DrvDips[0]; - - case 0x08000a: - return 0xff00 | DrvDips[1]; - - case 0x084000: - return MSM6295ReadStatus(0); - - case 0x084010: - return MSM6295ReadStatus(1); - } - - return 0; -} - -void __fastcall mustangb_main_write_word(UINT32 address, UINT16 data) -{ - STRANGE_RAM_WRITE_WORD(0xf0000) - - switch (address) - { - case 0x080014: - case 0x0c0014: - // *flipscreen = data & 1; - return; - - case 0x08001e: - case 0x0c001e: - // bprintf (0, _T("%6.6x, %x,\n"), SekGetPC(-1), data); - seibu_sound_mustb_write_word(0, data); - return; - } -} - -void __fastcall mustangb_main_write_byte(UINT32 address, UINT8 data) -{ - STRANGE_RAM_WRITE_BYTE(0xf0000) - - switch (address) - { - case 0x080014: - case 0x080015: - case 0x0c0014: - case 0x0c0015: - // *flipscreen = data & 1; - return; - - case 0x08001e: - case 0x08001f: - case 0x0c001e: - case 0x0c001f: - // bprintf (0, _T("%6.6x, %x,\n"), SekGetPC(-1), data); - seibu_sound_mustb_write_word(0, data); - return; - } -} - -UINT16 __fastcall mustangb_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x080000: - case 0x0c0000: - return DrvInputs[0]; - - case 0x080002: - case 0x0c0002: - return DrvInputs[1]; - - case 0x080004: - case 0x0c0008: - return (DrvDips[0] << 8) | DrvDips[1]; - - case 0x0c000a: - return 0xff00 | DrvDips[1]; - } - - return 0; -} - -UINT8 __fastcall mustangb_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x080000: - case 0x0c0000: - return DrvInputs[0] >> 8; - - case 0x080001: - case 0x0c0001: - return DrvInputs[0]; - - case 0x080002: - case 0x0c0002: - return DrvInputs[1] >> 8; - - case 0x080003: - case 0x0c0003: - return DrvInputs[1]; - - case 0x080004: - case 0x0c0008: - return DrvDips[1]; - - case 0x080005: - case 0x0c0009: - return DrvDips[0]; - - case 0x0c000a: - case 0x0c000b: - return DrvDips[1]; - } - - return 0; -} - -UINT8 __fastcall mustang_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x080000: - case 0x080001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x080002: - case 0x080003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x080004: - case 0x080005: - return DrvDips[address & 1]; - - case 0x08000e: - case 0x08000f: - return NMK004Read(); - } - - return 0; -} - -UINT16 __fastcall mustang_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1]; - - case 0x080004: - return (DrvDips[0] << 8) | DrvDips[1]; - - case 0x08000e: - return NMK004Read(); - } - - return 0; -} - -void __fastcall mustang_main_write_word(UINT32 address, UINT16 data) -{ - STRANGE_RAM_WRITE_WORD(0xf0000) - - switch (address) - { - case 0x080014: - // *flipscreen = data & 1; - return; - - case 0x08001e: - NMK004Write(0, data); - return; - } -} - -void __fastcall mustang_main_write_byte(UINT32 address, UINT8 data) -{ - STRANGE_RAM_WRITE_BYTE(0xf0000) -} - -UINT8 __fastcall acrobatm_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x0c0000: - case 0x0c0001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x0c0002: - case 0x0c0003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x0c0008: - case 0x0c0009: - return DrvDips[0]; - - case 0x0c000a: - case 0x0c000b: - return DrvDips[1]; - } - - return 0; -} - -UINT16 __fastcall acrobatm_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x0c0000: - return DrvInputs[0]; - - case 0x0c0002: - return DrvInputs[1]; - - case 0x0c0008: - return DrvDips[0]; - - case 0x0c000a: - return DrvDips[1]; - - case 0x0c000e: - return NMK004Read(); - } - - return 0; -} - -void __fastcall acrobatm_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x0c0014: - case 0x0c0015: - // *flipscreen = data & 1; - return; - - case 0x0c0018: - case 0x0c0019: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x0c001e: - case 0x0c001f: - NMK004Write(0, data); - return; - } -} - -void __fastcall acrobatm_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x0c0014: - case 0x0c0015: - // *flipscreen = data & 1; - return; - - case 0x0c0018: - case 0x0c0019: - if (data != 0xff) { - *tilebank = data; - } - return; - - case 0x0c001e: - case 0x0c001f: - NMK004Write(0, data); - return; - } -} - -UINT8 __fastcall tdragon_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x0c0000: - case 0x0c0001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x0c0002: - case 0x0c0003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x0c0008: - case 0x0c0009: - return DrvDips[0]; - - case 0x0c000a: - case 0x0c000b: - return DrvDips[1]; - } - - return 0; -} - -UINT16 __fastcall tdragon_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x0c0000: - return DrvInputs[0]; - - case 0x0c0002: - return DrvInputs[1]; - - case 0x0c0008: - return DrvDips[0]; - - case 0x0c000a: - return DrvDips[1]; - - case 0x0c000e: - return NMK004Read(); - } - - return 0; -} - -void __fastcall tdragon_main_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xffff0000) == 0x0b0000) { - *((UINT16*)(Drv68KRAM + (address & 0xfffe))) = BURN_ENDIAN_SWAP_INT16(data); - tdragon_mainram_w((address >> 1) & 0x7fff); - return; - } - - switch (address) - { - case 0x0c0014: - // *flipscreen = data & 1; - return; - - case 0x0c0018: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x0c001e: - NMK004Write(0, data); - return; - } -} - -void __fastcall tdragon_main_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xffff0000) == 0x0b0000) { - Drv68KRAM [(address & 0xffff) ^ 1] = data; - tdragon_mainram_w((address >> 1) & 0x7fff); - return; - } - - switch (address) - { - case 0x0c0014: - case 0x0c0015: - // *flipscreen = data & 1; - return; - - case 0x0c0018: - case 0x0c0019: - if (data != 0xff) { - *tilebank = data; - } - return; - - case 0x0c001e: - case 0x0c001f: - NMK004Write(0, data); - return; - } -} - - -UINT8 __fastcall macross_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x080000: - case 0x080001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x080002: - case 0x080003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x080008: - case 0x080009: - return DrvDips[0]; - - case 0x08000a: - case 0x08000b: - return DrvDips[1]; - - case 0x08000e: - case 0x08000f: - return NMK004Read(); - } - - return 0; -} - -UINT16 __fastcall macross_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1]; - - case 0x080008: - return (DrvDips[0] << 8) | DrvDips[0]; - - case 0x08000a: - return (DrvDips[1] << 8) | DrvDips[1]; - - case 0x08000e: - return NMK004Read(); - } - - return 0; -} - -void __fastcall macross_main_write_word(UINT32 address, UINT16 data) -{ - STRANGE_RAM_WRITE_WORD(0xf0000) - - switch (address) - { - case 0x080014: - // *flipscreen = data & 1; - return; - - case 0x080018: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x08001e: - NMK004Write(0, data); - return; - - case 0x084000: - if ((data & 0xff) != 0xff) - *tilebank = data; // bioship - return; - } -} - -void __fastcall macross_main_write_byte(UINT32 address, UINT8 data) -{ - STRANGE_RAM_WRITE_BYTE(0xf0000) - - switch (address) - { - case 0x080014: - case 0x080015: - // *flipscreen = data & 1; - return; - - case 0x080018: - case 0x080019: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x08001e: - case 0x08001f: - NMK004Write(0, data); - return; - - case 0x084000: - case 0x084001: - if ((data & 0xff) != 0xff) { - *tilebank = data; // bioship - } - return; - } -} - -void __fastcall vandykeb_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x080010: - *((UINT16 *)(DrvScrollRAM + 0x06)) = data; - return; - - case 0x080012: - *((UINT16 *)(DrvScrollRAM + 0x04)) = data; - return; - - case 0x080014: - // *flipscreen = data & 1; - return; - - case 0x080018: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x08001a: - *((UINT16 *)(DrvScrollRAM + 0x02)) = data; - return; - - case 0x08001c: - *((UINT16 *)(DrvScrollRAM + 0x00)) = data; - return; - - case 0x08001e: - // write to PIC - return; - } -} - -void __fastcall vandykeb_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x080010: - DrvScrollRAM[7] = data; - return; - - case 0x080014: - case 0x080015: - // *flipscreen = data & 1; - return; - - case 0x080018: - case 0x080019: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x08001a: - DrvScrollRAM[3] = data; - return; - - case 0x08001e: - case 0x08001f: - // write to PIC - return; - } -} - -UINT8 __fastcall hachamf_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x080000: - case 0x080001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x080002: - case 0x080003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x08000a: - case 0x08000b: - return 0; // ?? - - case 0x08000e: - case 0x08000f: - return NMK004Read(); - } - - return 0; -} - -UINT16 __fastcall hachamf_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1]; - - case 0x080008: - return (DrvDips[0] << 8) | DrvDips[1]; - - case 0x08000a: - return 0; // ?? - - case 0x08000e: - return NMK004Read(); - } - - return 0; -} - -void __fastcall hachamf_main_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xffff0000) == 0xf0000) { - *((UINT16*)(Drv68KRAM + (address & 0xfffe))) = data; - HachaRAMProt((address & 0xffff) >> 1); - return; - } - - switch (address) - { - case 0x080014: - // *flipscreen = data & 1; - return; - - case 0x080018: - if ((data & 0xff) != 0xff) { - *tilebank = data & 0xff; - } - return; - - case 0x08001e: - NMK004Write(0, data); - return; - } -} - -void __fastcall hachamf_main_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xffff0000) == 0xf0000) { - Drv68KRAM[(address & 0xffff) ^ 1] = data; - HachaRAMProt((address & 0xffff) >> 1); - return; - } - - switch (address) - { - case 0x080014: - case 0x080015: - // *flipscreen = data & 1; - return; - - case 0x080018: - case 0x080019: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x08001e: - case 0x08001f: - NMK004Write(0, data); - return; - } -} - -void __fastcall raphero_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x100014: - case 0x100015: - // *flipscreen = data & 1; - return; - - case 0x100018: - case 0x100019: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x10001e: - case 0x10001f: - *soundlatch = data; - return; - } -} - -void __fastcall raphero_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x100014: - // *flipscreen = data & 1; - return; - - case 0x100018: - if ((data & 0xff) != 0xff) { - *tilebank = data; - } - return; - - case 0x10001e: - *soundlatch = data & 0xff; - return; - } -} - -UINT8 __fastcall raphero_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x100000: - case 0x100001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x100002: - case 0x100003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x100008: - case 0x100009: - return DrvDips[0]; - - case 0x10000a: - case 0x10000b: - return DrvDips[1]; - - case 0x10000e: - case 0x10000f: - return *soundlatch2; - } - - return 0; -} - -UINT16 __fastcall raphero_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x100000: - return DrvInputs[0]; - - case 0x100002: - return DrvInputs[1]; - - case 0x100008: - return DrvDips[0]; - - case 0x10000a: - return DrvDips[1]; - - case 0x10000e: - return *soundlatch2; - } - - return 0; -} - - -//----------------------------------------------------------------------------------------------------- - - -static void tharrier_sound_bankswitch(UINT8 *rom, INT32 bank) -{ - if (bank < 3) { - memcpy (rom + 0x20000, rom + 0x40000 + (bank * 0x20000), 0x20000); - } -} - -void __fastcall tharrier_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf000: - *soundlatch2 = data; - return; - - case 0xf400: - MSM6295Command(0, data); - return; - - case 0xf500: - MSM6295Command(0, data); - return; - - case 0xf600: - tharrier_sound_bankswitch(DrvSndROM0, data & 3); - return; - - case 0xf700: - tharrier_sound_bankswitch(DrvSndROM1, data & 3); - return; - } -} - -UINT8 __fastcall tharrier_sound_read(UINT16 address) -{ - switch (address) - { - case 0xf000: - return *soundlatch; - - case 0xf400: - return MSM6295ReadStatus(0); - - case 0xf500: - return MSM6295ReadStatus(1); - } - - return 0; -} - -void __fastcall tharrier_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - BurnYM2203Write(0, 0, data); - return; - - case 0x01: - BurnYM2203Write(0, 1, data); - return; - } -} - -UINT8 __fastcall tharrier_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - return BurnYM2203Read(0, 0); - } - - return 0; -} - -static void ssmissin_okibank(INT32 bank) -{ - memcpy(DrvSndROM0 + 0x20000, DrvSndROM0 + 0x40000 + (bank & 3) * 0x20000, 0x20000); -} - -void __fastcall ssmissin_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x9000: - ssmissin_okibank(data); - return; - - case 0x9800: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall ssmissin_sound_read(UINT16 address) -{ - switch (address) - { - case 0x9800: - return MSM6295ReadStatus(0); - - case 0xa000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -void __fastcall afega_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf808: - BurnYM2151SelectRegister(data); - return; - - case 0xf809: - BurnYM2151WriteRegister(data); - return; - - case 0xf80a: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall afega_sound_read(UINT16 address) -{ - switch (address) - { - case 0xf800: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0xf808: - case 0xf809: - return BurnYM2151ReadStatus(); - - case 0xf80a: - return MSM6295ReadStatus(0); - } - - return 0; -} - -void __fastcall firehawk_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xfff2: - if (data == 0xfe) - memcpy (DrvSndROM1, DrvSndROM1 + 0x40000, 0x40000); - else if(data == 0xff) - memcpy (DrvSndROM1, DrvSndROM1 + 0x80000, 0x40000); - return; - - case 0xfff8: - MSM6295Command(1, data); - return; - - case 0xfffa: - MSM6295Command(0, data); - return; - } - - if (address >= 0xfe00) { - DrvZ80RAM[address & 0xfff] = data; - return; - } -} - -UINT8 __fastcall firehawk_sound_read(UINT16 address) -{ - switch (address) - { - case 0xfff0: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - - case 0xfff8: - return MSM6295ReadStatus(1); - - case 0xfffa: - return MSM6295ReadStatus(0); - } - - if (address >= 0xfe00) { - return DrvZ80RAM[address & 0xfff]; - } - - return 0; -} - -static void macross2_sound_bank(INT32 bank) -{ - bank = (bank & 7) * 0x4000; - - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x10000 + bank); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x10000 + bank); -} - -void __fastcall macross2_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe001: - macross2_sound_bank(data); - return; - - case 0xf000: - *soundlatch2 = data; - return; - } -} - -UINT8 __fastcall macross2_sound_read(UINT16 address) -{ - if (address == 0xf000) return *soundlatch; - - return 0; -} - -void __fastcall macross2_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - BurnYM2203Write(0, 0, data); - return; - - case 0x01: - BurnYM2203Write(0, 1, data); - return; - - case 0x80: - MSM6295Command(0, data); - return; - - case 0x88: - MSM6295Command(1, data); - return; - - case 0x90: - case 0x91: - case 0x92: - case 0x93: - case 0x94: - case 0x95: - case 0x96: - case 0x97: - NMK112_okibank_write(port & 7, data); - return; - } -} - -UINT8 __fastcall macross2_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - return BurnYM2203Read(0, 0); - - case 0x80: - return MSM6295ReadStatus(0); - - case 0x88: - return MSM6295ReadStatus(1); - } - - return 0; -} - -//----------------------------------------------------------------------------------------------------- - -static void DrvYM2203IrqHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static void DrvYM2151IrqHandler(INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3000000; -} - -inline static INT32 Macross2SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(ZetTotalCycles() * nSoundRate / 4000000); -} - -inline static double Macross2GetTime() -{ - return (double)ZetTotalCycles() / 4000000; -} - -static void NMK004YM2203IrqHandler(INT32, INT32 nStatus) -{ - NMK004_irq(nStatus); -} - -inline static double NMK004GetTime() -{ - return (double)SekTotalCycles() / nNMK004CpuSpeed; -} - -inline static INT32 NMK004SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(SekTotalCycles() * nSoundRate / nNMK004CpuSpeed); -} - -static void MSM6295SetInitialBanks(INT32 chips) -{ - INT32 len = DrvSndROM1 - DrvSndROM0; - - for (INT32 i = 0; i < chips; i++) { - for (INT32 nChannel = 0; nChannel < 4; nChannel++) { - MSM6295SampleInfo[i][nChannel] = MSM6295ROM + (i * len) + (nChannel << 8); - MSM6295SampleData[i][nChannel] = MSM6295ROM + (i * len) + (nChannel << 16); - } - } -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - MSM6295Reset(0); - MSM6295Reset(1); - - MSM6295SetInitialBanks(2); - - macross2_sound_enable = -1; - prot_count = 0; - - return 0; -} - -static INT32 SmissinDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - - return 0; -} - -static INT32 AfegaDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - MSM6295Reset(0); - MSM6295Reset(1); - - MSM6295SetInitialBanks(2); - - return 0; -} - -static INT32 BjtwinDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - MSM6295Reset(0); - MSM6295Reset(1); - - NMK112Reset(); - MSM6295SetInitialBanks(2); - - return 0; -} - -static INT32 SeibuSoundDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - seibu_sound_reset(); - MSM6295SetInitialBanks(2); - - return 0; -} - -static INT32 NMK004DoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - BurnYM2203Reset(); - - MSM6295Reset(0); - MSM6295Reset(1); - - MSM6295SetInitialBanks(2); - - SekOpen(0); - NMK004_init(); - SekClose(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x080000; - DrvZ80ROM = Next; Next += 0x030000; - - DrvGfxROM0 = Next; Next += 0x040000; - DrvGfxROM1 = Next; Next += 0x800000; - DrvGfxROM2 = Next; Next += 0x800000; - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "raphero") == 0) { - Next += 0x800000; - } - - DrvTileROM = Next; Next += 0x020000; - - MSM6295ROM = Next; - - DrvSndROM0 = Next; Next += 0x300000; - DrvSndROM1 = Next; Next += 0x300000; - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "raphero") == 0) { - Next += 0x600000; - } - - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - AllRam = Next; - - DrvPalRAM = Next; Next += 0x000800; - Drv68KRAM = Next; Next += 0x010000; - DrvBgRAM0 = Next; Next += 0x004000; - DrvBgRAM1 = Next; Next += 0x004000; - DrvBgRAM2 = Next; Next += 0x004000; - DrvBgRAM3 = Next; Next += 0x004000; - DrvTxRAM = Next; Next += 0x001000; - DrvScrollRAM = Next; Next += 0x001000; - - DrvSprBuf = Next; Next += 0x001000; - DrvSprBuf2 = Next; Next += 0x001000; - - DrvZ80RAM = Next; Next += 0x002000; - - soundlatch = Next; Next += 0x000001; - soundlatch2 = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - tilebank = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode(INT32 len0, INT32 len1, INT32 len2) -{ - INT32 Plane[4] = { 0x000, 0x001, 0x002, 0x003 }; - INT32 XOffs[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, - 0x200, 0x204, 0x208, 0x20c, 0x210, 0x214, 0x218, 0x21c }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc((len2 >= len1) ? len2 : len1); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, len0); - - GfxDecode((len0 * 2) / ( 8 * 8), 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, len1); - - GfxDecode((len1 * 2) / (16 * 16), 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, len2); - - GfxDecode((len2 * 2) / (16 * 16), 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); - - nGraphicsMask[0] = ((len0 * 2) / ( 8 * 8)) - 1; - nGraphicsMask[1] = ((len1 * 2) / (16 * 16)) - 1; - nGraphicsMask[2] = ((len2 * 2) / (16 * 16)) - 1; - - BurnFree (tmp); - - return 0; -} - -static INT32 BjtwinGfxDecode(INT32 len0, INT32 len1, INT32 len2) -{ - INT32 Plane[4] = { 0x000, 0x001, 0x002, 0x003 }; - INT32 XOffs[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, - 0x200, 0x204, 0x208, 0x20c, 0x210, 0x214, 0x218, 0x21c }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc((len2 >= len1) ? len2 : len1); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, len0); - - GfxDecode((len0 * 2) / ( 8 * 8), 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, len1); - - GfxDecode((len1 * 2) / ( 8 * 8), 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, len2); - - GfxDecode((len2 * 2) / (16 * 16), 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); - - nGraphicsMask[0] = ((len0 * 2) / ( 8 * 8)) - 1; - nGraphicsMask[1] = ((len1 * 2) / ( 8 * 8)) - 1; - nGraphicsMask[2] = ((len2 * 2) / (16 * 16)) - 1; - - BurnFree (tmp); - - return 0; -} - -static INT32 GrdnstrmGfxDecode(INT32 len0, INT32 len1, INT32 len2) -{ - INT32 Plane[8] = { 0x000, 0x001, 0x002, 0x003, (len1*4), (len1*4)+1, (len1*4)+2, (len1*4)+3 }; - INT32 XOffs[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, - 0x200, 0x204, 0x208, 0x20c, 0x210, 0x214, 0x218, 0x21c }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, - 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc((len2 >= len1) ? len2 : len1); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, len0); - - GfxDecode((len0 * 2) / ( 8 * 8), 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, len1); - - GfxDecode((len1 * 1) / (16 * 16), 8, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, len2); - - GfxDecode((len2 * 2) / (16 * 16), 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); - - nGraphicsMask[0] = ((len0 * 2) / ( 8 * 8)) - 1; - nGraphicsMask[1] = ((len1 * 1) / (16 * 16)) - 1; - nGraphicsMask[2] = ((len2 * 2) / (16 * 16)) - 1; - is_8bpp = 1; - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit(INT32 (*pLoadCallback)()) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (pLoadCallback) { - if (pLoadCallback()) return 1; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(tharrier_sound_write); - ZetSetReadHandler(tharrier_sound_read); - ZetSetOutHandler(tharrier_sound_out); - ZetSetInHandler(tharrier_sound_in); - ZetMemEnd(); - ZetClose(); - - BurnSetRefreshRate(56.00); - - BurnYM2203Init(1, 1500000, &DrvYM2203IrqHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 2.00, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.50, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.50, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.50, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 4000000 / 165, 1); - MSM6295Init(1, 4000000 / 165, 1); - MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 0.20, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 BjtwinInit(INT32 (*pLoadCallback)()) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (pLoadCallback) { - if (pLoadCallback()) return 1; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x09c000, 0x09cfff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x09d000, 0x09dfff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); - SekSetWriteWordHandler(0, bjtwin_main_write_word); - SekSetWriteByteHandler(0, bjtwin_main_write_byte); - SekSetReadWordHandler(0, bjtwin_main_read_word); - SekSetReadByteHandler(0, bjtwin_main_read_byte); - SekClose(); - - BurnSetRefreshRate(56.00); - - MSM6295Init(0, 4000000 / 165, 1); - MSM6295Init(1, 4000000 / 165, 1); - MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 0.20, BURN_SND_ROUTE_BOTH); - - NMK112_init(0, DrvSndROM0, DrvSndROM1, 0x140000, 0x140000); - - GenericTilesInit(); - - BjtwinDoReset(); - - return 0; -} - -static INT32 Macross2Init() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; - memcpy (DrvZ80ROM + 0x10000, DrvZ80ROM, 0x20000); - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x200000, 5, 1)) return 1; - BurnByteswap(DrvGfxROM2, 0x400000); - - if (BurnLoadRom(DrvSndROM0 + 0x040000, 6, 1)) return 1; - memcpy (DrvSndROM0, DrvSndROM0 + 0x40000, 0x40000); - - if (BurnLoadRom(DrvSndROM1 + 0x040000, 7, 1)) return 1; - memcpy (DrvSndROM1, DrvSndROM1 + 0x40000, 0x40000); - - DrvGfxDecode(0x20000, 0x200000, 0x400000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x120000, 0x1207ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x130000, 0x1307ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x140000, 0x143fff, SM_RAM); - SekMapMemory(DrvBgRAM1, 0x144000, 0x147fff, SM_RAM); - SekMapMemory(DrvBgRAM2, 0x148000, 0x14bfff, SM_RAM); - SekMapMemory(DrvBgRAM3, 0x14c000, 0x14ffff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x170000, 0x170fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x171000, 0x171fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x1f0000, 0x1fffff, SM_RAM); - SekSetWriteWordHandler(0, macross2_main_write_word); - SekSetWriteByteHandler(0, macross2_main_write_byte); - SekSetReadWordHandler(0, macross2_main_read_word); - SekSetReadByteHandler(0, macross2_main_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x8000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x8000); - ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM); - ZetSetWriteHandler(macross2_sound_write); - ZetSetReadHandler(macross2_sound_read); - ZetSetOutHandler(macross2_sound_out); - ZetSetInHandler(macross2_sound_in); - ZetMemEnd(); - ZetClose(); - - BurnSetRefreshRate(56.00); - - BurnYM2203Init(1, 1500000, &DrvYM2203IrqHandler, Macross2SynchroniseStream, Macross2GetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2203SetAllRoutes(0, 0.90, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 4000000 / 165, 1); - MSM6295Init(1, 4000000 / 165, 1); - MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 0.20, BURN_SND_ROUTE_BOTH); - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "macross2") == 0) { - NMK112_init(0, DrvSndROM0, DrvSndROM1, 0x240000, 0x140000); - } else { - NMK112_init(0, DrvSndROM0, DrvSndROM1, 0x240000, 0x240000); - } - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 MSM6295x1Init(INT32 (*pLoadCallback)()) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (pLoadCallback) { - if (pLoadCallback()) return 1; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(ssmissin_sound_write); - ZetSetReadHandler(ssmissin_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnSetRefreshRate(56.00); - - MSM6295Init(0, 1000000 / 165, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - SmissinDoReset(); - - return 0; -} - -static INT32 SeibuSoundInit(INT32 (*pLoadCallback)(), INT32 type) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (pLoadCallback) { - if (pLoadCallback()) return 1; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - - if (type) { // mustangb - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); - } else { // tdragonb - SekMapMemory(Drv68KRAM, 0x0b0000, 0x0bffff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x0c4000, 0x0c43ff, SM_WRITE); - SekMapMemory(DrvPalRAM, 0x0c8000, 0x0c87ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x0cc000, 0x0cffff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x0d0000, 0x0d07ff, SM_RAM); - } - SekSetWriteWordHandler(0, mustangb_main_write_word); - SekSetWriteByteHandler(0, mustangb_main_write_byte); - SekSetReadWordHandler(0, mustangb_main_read_word); - SekSetReadByteHandler(0, mustangb_main_read_byte); - SekClose(); - - BurnSetRefreshRate(56.00); - - SeibuZ80ROM = DrvZ80ROM; - SeibuZ80RAM = DrvZ80RAM; - seibu_sound_init(0, 0, 3579545, 3579545, 1320000 / 132); - - GenericTilesInit(); - - SeibuSoundDoReset(); - - return 0; -} - -static INT32 AfegaInit(INT32 (*pLoadCallback)(), void (*pZ80Callback)(), INT32 pin7high) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (pLoadCallback) { - if (pLoadCallback()) return 1; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x084000, 0x0843ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0c0000, 0x0cffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); - SekSetWriteWordHandler(0, afega_main_write_word); - SekSetWriteByteHandler(0, afega_main_write_byte); - SekSetReadWordHandler(0, afega_main_read_word); - SekSetReadByteHandler(0, afega_main_read_byte); - SekClose(); - - if (pZ80Callback) { - pZ80Callback(); - } - - BurnSetRefreshRate(56.00); - - BurnYM2151Init(4000000); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.30, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.30, BURN_SND_ROUTE_RIGHT); - - MSM6295Init(0, 1000000 / (pin7high ? 132 : 165), 1); - MSM6295Init(1, 1000000 / (pin7high ? 132 : 165), 1); - MSM6295SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - AfegaDoReset(); - - return 0; -} - -static INT32 NMK004Init(INT32 (*pLoadCallback)(), INT32 nCpuSpeed, INT32 pin7high, INT32 irq2) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - nNMK004CpuSpeed = nCpuSpeed; - nNMK004EnableIrq2 = irq2; - - if (pLoadCallback) { - pLoadCallback(); - } - - BurnSetRefreshRate(56.00); - - BurnYM2203Init(1, 1500000, &NMK004YM2203IrqHandler, NMK004SynchroniseStream, NMK004GetTime, 0); - BurnTimerAttachSek(nNMK004CpuSpeed); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 2.00, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.50, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.50, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.50, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 4000000 / (pin7high ? 132 : 165), 1); - MSM6295Init(1, 4000000 / (pin7high ? 132 : 165), 1); - MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 0.20, BURN_SND_ROUTE_BOTH); - - NMK004OKIROM0 = DrvSndROM0; - NMK004OKIROM1 = DrvSndROM1; - NMK004PROGROM = DrvZ80ROM; - - GenericTilesInit(); - - NMK004DoReset(); - - return 0; -} - -static INT32 CommonExit() -{ - GenericTilesExit(); - - SekExit(); - - BurnFree (AllMem); - - input_high[0] = input_high[1] = 0; - is_8bpp = 0; - global_y_offset = 16; - videoshift = 0; - screen_flip_y = 0; - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - BurnYM2203Exit(); - MSM6295Exit(0); - MSM6295Exit(1); - MSM6295ROM = NULL; - - return CommonExit(); -} - -static INT32 MSM6295x1Exit() -{ - ZetExit(); - MSM6295Exit(0); - MSM6295ROM = NULL; - - return CommonExit(); -} - -static INT32 SeibuSoundExit() -{ - GenericTilesExit(); - - seibu_sound_exit(); - SekExit(); - - BurnFree (AllMem); - - input_high[0] = input_high[1] = 0; - is_8bpp = 0; - global_y_offset = 16; - videoshift = 0; - - return 0; -} - -static INT32 AfegaExit() -{ - ZetExit(); - BurnYM2151Exit(); - MSM6295Exit(0); - MSM6295Exit(1); - MSM6295ROM = NULL; - - return CommonExit(); -} - -static INT32 BjtwinExit() -{ - MSM6295Exit(0); - MSM6295Exit(1); - MSM6295ROM = NULL; - - return CommonExit(); -} - - -static INT32 NMK004Exit() -{ - BurnYM2203Exit(); - MSM6295Exit(0); - MSM6295Exit(1); - MSM6295ROM = NULL; - - return CommonExit(); -} - -//------------------------------------------------------------------------------------------------------------------ - -static void DrvPaletteRecalc() -{ - UINT8 r,g,b; - UINT16 *pal = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x400; i++) { - INT32 data = BURN_ENDIAN_SWAP_INT16(pal[i]); - - r = ((data >> 11) & 0x1e) | ((data >> 3) & 0x01); - g = ((data >> 7) & 0x1e) | ((data >> 2) & 0x01); - b = ((data >> 3) & 0x1e) | ((data >> 1) & 0x01); - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static void draw_sprites(INT32 flip, INT32 coloff, INT32 coland, INT32 priority) -{ - UINT16 *sprram = (UINT16*)DrvSprBuf2; - - for (INT32 offs = 0; offs < 0x1000/2; offs += 8) - { - if (BURN_ENDIAN_SWAP_INT16(sprram[offs]) & 0x0001) - { - INT32 sx = (BURN_ENDIAN_SWAP_INT16(sprram[offs+4]) & 0x01ff) + videoshift; - INT32 sy = (BURN_ENDIAN_SWAP_INT16(sprram[offs+6]) & 0x01ff); - INT32 code = BURN_ENDIAN_SWAP_INT16(sprram[offs+3]) & nGraphicsMask[2]; - INT32 color = BURN_ENDIAN_SWAP_INT16(sprram[offs+7]) & coland; - INT32 w = (BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x000f); - INT32 h = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x00f0) >> 4); - INT32 pri = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+0]) & 0x00c0) >> 6); - INT32 flipy = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x0200) >> 9); - INT32 flipx = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x0100) >> 8); - - if (!flip) flipy = flipx = 0; - - color = (color << 4) + coloff; - - INT32 delta = 16; - - if (pri != priority) - continue; - - if (*flipscreen) - { - sx = 368 - sx; - sy = 240 - sy; - delta = -16; - - flipx ^= *flipscreen; - flipy ^= *flipscreen; - } - - INT32 yy = h; - sy += flipy ? (delta * h) : 0; - - do - { - INT32 x = sx + (flipx ? (delta * w) : 0); - INT32 xx = w; - - do - { - INT32 xxx = ((x + 16) & 0x1ff) - 16; - INT32 yyy = (sy & 0x1ff) - global_y_offset; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, xxx, yyy, color, 0, 15, 0, DrvGfxROM2); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, xxx, yyy, color, 0, 15, 0, DrvGfxROM2); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, xxx, yyy, color, 0, 15, 0, DrvGfxROM2); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, xxx, yyy, color, 0, 15, 0, DrvGfxROM2); - } - } - code = (code + 1) & nGraphicsMask[2]; - x += delta * (flipx ? -1 : 1); - - } while (--xx >= 0); - sy += delta * (flipx ? -1 : 1); - - } while (--yy >= 0); - } - } -} - -static void draw_macross_background(UINT8 *ram, INT32 scrollx, INT32 scrolly, INT32 coloff, INT32 t) -{ - scrolly = (scrolly + global_y_offset) & 0x1ff; - UINT16 *vram = (UINT16*)ram; - - for (INT32 offs = 0; offs < 0x100 * 0x20; offs++) - { - INT32 sx = (offs & 0xff) << 4; - INT32 sy = (offs >> 8) << 4; - - INT32 row = sy >> 4; - INT32 col = sx >> 4; - - sx = (((sx - scrollx) + 16) & 0xfff) - 16; - sy = (((sy - scrolly) + 16) & 0x1ff) - 16; - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 ofst = ((row >> 4) << 12) | (row & 0x0f) | (col << 4); - - if (is_8bpp) { - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst]) & nGraphicsMask[1]; - - Render16x16Tile_Clip(pTransDraw, code, sx, sy, 0, 8, coloff, DrvGfxROM1); - } else { - INT32 code = ((BURN_ENDIAN_SWAP_INT16(vram[ofst]) & 0xfff) | (*tilebank << 12)) & nGraphicsMask[1]; - INT32 color = BURN_ENDIAN_SWAP_INT16(vram[ofst]) >> 12; - - if (t) { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, coloff, DrvGfxROM1); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, coloff, DrvGfxROM1); - } - } - } -} - -static void draw_gunnail_background(UINT8 *ram) -{ - INT32 bank = (*tilebank << 12) & nGraphicsMask[1]; // good enough?? - UINT16 *vram = (UINT16*)ram; - UINT16 *scroll = (UINT16*)DrvScrollRAM; - - for (INT32 y = 16; y < nScreenHeight + 16; y++) - { - INT32 yscroll = (BURN_ENDIAN_SWAP_INT16(scroll[0x100]) + BURN_ENDIAN_SWAP_INT16(scroll[0x100 | y]) + y) & 0x1ff; - - INT32 row = yscroll >> 4; - INT32 yl = (yscroll & 0x0f) << 4; - - INT32 ofst0 = ((row >> 4) << 12) | (row & 0x0f); - INT32 xscroll0 = BURN_ENDIAN_SWAP_INT16(scroll[0]) + BURN_ENDIAN_SWAP_INT16(scroll[y]) - videoshift; - - UINT16 *dest = pTransDraw + (y - 16) * nScreenWidth; - - for (INT32 x = 0; x < nScreenWidth + 16; x+=16) - { - INT32 xscroll = (x + xscroll0) & 0xfff; - INT32 sx = x - (xscroll & 0x0f); - - INT32 ofst = ofst0 | (xscroll & 0xff0); - - INT32 code = (BURN_ENDIAN_SWAP_INT16(vram[ofst]) & 0xfff) | bank; - INT32 color = (BURN_ENDIAN_SWAP_INT16(vram[ofst]) >> 12) << 4; - - UINT8 *src = DrvGfxROM1 + (code << 8) + yl; - - for (INT32 xx = 0; xx < 16; xx++, sx++) { - if (sx < 0 || sx >= nScreenWidth) continue; - - dest[sx] = src[xx] | color; - } - } - } -} - -static void draw_bjtwin_background(INT32 scrollx) -{ - UINT16 *vram = (UINT16*)DrvBgRAM0; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = (offs >> 5) << 3; - INT32 sy = (offs & 0x1f) << 3; - - sy -= global_y_offset; - sx = (((sx - scrollx) + 8) & 0x1ff) - 8; - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); - INT32 color = code >> 12; - INT32 bank = code & 0x800; - code &= 0x7ff; - if (bank) code |= (*tilebank << 11); - code &= nGraphicsMask[1]; - - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, bank ? DrvGfxROM1 : DrvGfxROM0); - } -} - -static void bioship_draw_background(INT32 scrollx, INT32 scrolly) -{ - scrolly = (scrolly + global_y_offset) & 0x1ff; - INT32 bank = *tilebank * 0x2000; - UINT16 *tilerom = (UINT16*)DrvTileROM; - - for (INT32 offs = 0; offs < 0x1000; offs++) - { - INT32 sx = (offs >> 4) << 4; - INT32 sy = (offs & 0x0f) << 4; - - sx = (((sx + 16) - scrollx) & 0xfff) - 16; - - if (sx >= nScreenWidth) continue; - - INT32 code = BURN_ENDIAN_SWAP_INT16(tilerom[offs | bank]); - sy = (((sy + 16) - scrolly) & 0x1ff) - 16; - - if (sy < nScreenHeight) { - Render16x16Tile_Clip(pTransDraw, code & 0xfff, sx, sy, code >> 12, 4, 0, DrvGfxROM1 + 0x100000); - } - - code = BURN_ENDIAN_SWAP_INT16(tilerom[offs | bank | 0x1000]); - sy = (((sy + 16) + 256) & 0x1ff) - 16; - - if (sy < nScreenHeight) { - Render16x16Tile_Clip(pTransDraw, code & 0xfff, sx, sy, code >> 12, 4, 0, DrvGfxROM1 + 0x100000); - } - } -} - -static void draw_macross_text_layer(INT32 scrollx, INT32 scrolly, INT32 wide, INT32 coloff) -{ - if (nGraphicsMask[0] == 0) return; - - scrolly = (scrolly + global_y_offset) & 0x1ff; - INT32 wmask = (0x100 << wide) - 1; - UINT16 *vram = (UINT16*)DrvTxRAM; - - for (INT32 offs = 0; offs < 32 * (32 << wide); offs++) - { - INT32 sx = (offs >> 5) << 3; - INT32 sy = (offs & 0x1f) << 3; - - sx = (((sx - scrollx) + 8) & wmask) - 8; - sy = (((sy - scrolly) + 8) & 0xff) - 8; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); - - Render8x8Tile_Mask_Clip(pTransDraw, code & 0xfff, sx, sy, code >> 12, 4, 15, coloff, DrvGfxROM0); - } -} - -static void draw_screen_yflip() -{ - if (!screen_flip_y) return; - - UINT16 *tmp = (UINT16*)pBurnDraw; // :D - UINT16 *src1 = pTransDraw; - UINT16 *src2 = pTransDraw + (nScreenHeight-1) * nScreenWidth; - - for (INT32 y = 0; y < nScreenHeight / 2; y++) { - memcpy (tmp, src1, nScreenWidth * 2); - memcpy (src1, src2, nScreenWidth * 2); - memcpy (src2, tmp, nScreenWidth * 2); - src1 += nScreenWidth; - src2 -= nScreenWidth; - } -} - -static inline void common_draw(INT32 spriteflip, INT32 bgscrollx, INT32 bgscrolly, INT32 txscrollx, INT32 txscrolly, INT32 tx_coloff) -{ - DrvPaletteRecalc(); - - draw_macross_background(DrvBgRAM0, bgscrollx, bgscrolly, 0, 0); - - draw_sprites(spriteflip, 0x100, 0x0f, 3); - draw_sprites(spriteflip, 0x100, 0x0f, 2); - draw_sprites(spriteflip, 0x100, 0x0f, 1); - draw_sprites(spriteflip, 0x100, 0x0f, 0); - - draw_macross_text_layer(txscrollx, txscrolly, 0, tx_coloff); - - draw_screen_yflip(); - BurnTransferCopy(DrvPalette); -} - -static INT32 TharrierDraw() -{ - INT32 scrollx = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(Drv68KRAM + 0x9f00))) & 0xfff; - - common_draw(1, scrollx, 0, 0, 0, 0); - - return 0; -} - -static INT32 ManyblocDraw() -{ - UINT16 *scroll = (UINT16*)DrvScrollRAM; - INT32 scrollx = BURN_ENDIAN_SWAP_INT16(scroll[0x82 / 2]) & 0xfff; - INT32 scrolly = BURN_ENDIAN_SWAP_INT16(scroll[0xc2 / 2]) & 0x1ff; - - common_draw(1, scrollx, scrolly, 0, 0, 0); - - return 0; -} - -static INT32 MacrossDraw() -{ - UINT16 *scroll = (UINT16*)DrvScrollRAM; - INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) & 0xff); - INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff); - - common_draw(0, scrollx, scrolly, 0, 0, 0x200); - - return 0; -} - -static INT32 VandykeDraw() -{ - UINT16 *scroll = (UINT16*)DrvScrollRAM; - INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) >> 8); - INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) >> 8); - - common_draw(0, scrollx, scrolly, 0, 0, 0x200); - - return 0; -} - -static INT32 RedhawkiDraw() -{ - UINT16 *scroll = (UINT16*)DrvScrollRAM; - INT32 scrollx = BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0xff; - INT32 scrolly = BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff; - - common_draw(0, scrollx, scrolly, 0, 0, 0x300); - - return 0; -} - -static INT32 FirehawkDraw() -{ - UINT16 *scroll = (UINT16*)DrvScrollRAM; - INT32 scrolly = (BURN_ENDIAN_SWAP_INT16(scroll[3]) + 0x100) & 0x1ff; - INT32 scrollx = (BURN_ENDIAN_SWAP_INT16(scroll[2]) + 0x000) & 0xfff; - - common_draw(1, scrollx, scrolly, 0, 0, 0x200); - - return 0; -} - -static INT32 HachamfDraw() -{ - if (nNMK004CpuSpeed == 10000000) { // hachamf - mcu_run(0); - } else { // tdragon - mcu_run(1); - } - - UINT16 *scroll = (UINT16*)DrvScrollRAM; - INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) & 0xff); - INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff); - - common_draw(0, scrollx, scrolly, 0, 0, 0x200); - - return 0; -} - -static INT32 StrahlDraw() -{ - DrvPaletteRecalc(); - - UINT16 *scroll = (UINT16*)DrvScrollRAM; - - INT32 bgscrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0x000]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x001]) & 0xff); - INT32 bgscrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[0x002]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x003]) & 0xff); - INT32 fgscrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0x200]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x201]) & 0xff); - INT32 fgscrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[0x202]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x203]) & 0xff); - - draw_macross_background(DrvBgRAM0, bgscrollx, bgscrolly, 0x300, 0); - - INT32 bgbank_bak = *tilebank; *tilebank = 0x01; - draw_macross_background(DrvBgRAM1, fgscrollx, fgscrolly, 0x200, 1); - *tilebank = bgbank_bak; - - draw_sprites(0, 0x100, 0x0f, 3); - draw_sprites(0, 0x100, 0x0f, 2); - draw_sprites(0, 0x100, 0x0f, 1); - draw_sprites(0, 0x100, 0x0f, 0); - - draw_macross_text_layer(0, 0, 0, 0x200); - - draw_screen_yflip(); - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 Macross2Draw() -{ - videoshift = 64; - DrvPaletteRecalc(); - - UINT16 *scroll = (UINT16*)DrvScrollRAM; - - INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) & 0xff); - INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff); - - switch (scroll[0] & 0x30) - { - case 0x00: draw_macross_background(DrvBgRAM0, (scrollx - 64) & 0xfff, scrolly, 0, 0); break; - case 0x10: draw_macross_background(DrvBgRAM1, (scrollx - 64) & 0xfff, scrolly, 0, 0); break; - case 0x20: draw_macross_background(DrvBgRAM2, (scrollx - 64) & 0xfff, scrolly, 0, 0); break; - case 0x30: draw_macross_background(DrvBgRAM3, (scrollx - 64) & 0xfff, scrolly, 0, 0); break; - } - - draw_sprites(0, 0x100, 0x1f, 3); - draw_sprites(0, 0x100, 0x1f, 2); - draw_sprites(0, 0x100, 0x1f, 1); - draw_sprites(0, 0x100, 0x1f, 0); - - draw_macross_text_layer(-64, 0, 1, 0x300); - - draw_screen_yflip(); - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 GunnailDraw() -{ - DrvPaletteRecalc(); - - videoshift = 64; - UINT16 *scroll = (UINT16*)DrvScrollRAM; - - switch ((BURN_ENDIAN_SWAP_INT16(scroll[0]) >> 8) & 0x30) - { - case 0x00: draw_gunnail_background(DrvBgRAM0); break; - //case 0x10: draw_gunnail_background(DrvBgRAM1); break; - //case 0x20: draw_gunnail_background(DrvBgRAM2); break; - //case 0x30: draw_gunnail_background(DrvBgRAM3); break; - - // GunNail only has a single ram bank. If it tries to - // use another, just clear everything. - - case 0x10: - case 0x20: - case 0x30: - BurnTransferClear(); - break; - } - - draw_sprites(0, 0x100, 0x0f, 3); - draw_sprites(0, 0x100, 0x0f, 2); - draw_sprites(0, 0x100, 0x0f, 1); - draw_sprites(0, 0x100, 0x0f, 0); - - draw_macross_text_layer(-64, 0, 1, 0x200); - - draw_screen_yflip(); - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 RapheroDraw() -{ - DrvPaletteRecalc(); - - videoshift = 64; - UINT16 *scroll = (UINT16*)DrvScrollRAM; - - switch ((BURN_ENDIAN_SWAP_INT16(scroll[0]) >> 8) & 0x30) - { - case 0x00: draw_gunnail_background(DrvBgRAM0); break; - case 0x10: draw_gunnail_background(DrvBgRAM1); break; - case 0x20: draw_gunnail_background(DrvBgRAM2); break; - case 0x30: draw_gunnail_background(DrvBgRAM3); break; - } - - draw_sprites(0, 0x100, 0x1f, 3); - draw_sprites(0, 0x100, 0x1f, 2); - draw_sprites(0, 0x100, 0x1f, 1); - draw_sprites(0, 0x100, 0x1f, 0); - - draw_macross_text_layer(-64, 0, 1, 0x300); - - draw_screen_yflip(); - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 BioshipDraw() -{ - DrvPaletteRecalc(); - - UINT16 *scroll = (UINT16*)DrvScrollRAM; - INT32 bgscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[0x02]) & 0x100) | (BURN_ENDIAN_SWAP_INT16(scroll[0x03]) >> 8); - INT32 bgscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[0x00]) & 0xf00) | (BURN_ENDIAN_SWAP_INT16(scroll[0x01]) >> 8); - INT32 fgscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[0x02]) & 0x100) | (BURN_ENDIAN_SWAP_INT16(scroll[0x03]) >> 8); - INT32 fgscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[0x00]) & 0xf00) | (BURN_ENDIAN_SWAP_INT16(scroll[0x01]) >> 8); - - bioship_draw_background(bgscrollx, bgscrolly); - - INT32 bgbank_bak = *tilebank; *tilebank = 0; - draw_macross_background(DrvBgRAM0, fgscrollx, fgscrolly, 0x100, 1); - *tilebank = bgbank_bak; - - draw_sprites(0, 0x200, 0x0f, 3); - draw_sprites(0, 0x200, 0x0f, 2); - draw_sprites(0, 0x200, 0x0f, 1); - draw_sprites(0, 0x200, 0x0f, 0); - - draw_macross_text_layer(0, 0, 0, 0x300); - - draw_screen_yflip(); - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 BjtwinDraw() -{ - videoshift = 64; - - DrvPaletteRecalc(); - - draw_bjtwin_background(-64); - - draw_sprites(0, 0x100, 0x0f, 3); - draw_sprites(0, 0x100, 0x0f, 2); - draw_sprites(0, 0x100, 0x0f, 1); - draw_sprites(0, 0x100, 0x0f, 0); - - draw_screen_yflip(); - BurnTransferCopy(DrvPalette); - - return 0; -} - -static void AfegaCommonDraw(INT32 , INT32 xoffset, INT32 yoffset) -{ - UINT16 *scroll = (UINT16*)DrvScrollRAM; - INT32 bgscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[1]) + xoffset) & 0xfff; - INT32 bgscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[0]) + yoffset) & 0x1ff; - INT32 txscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff); - INT32 txscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0xff); - - common_draw(1, bgscrollx, bgscrolly, txscrollx, txscrolly, 0x200); -} - -static INT32 AfegaDraw() -{ - AfegaCommonDraw(1, -0x100, 0); - return 0; -} - -static INT32 RedhawkbDraw() -{ - AfegaCommonDraw(1, 0, 0x100); - return 0; -} - -static INT32 Bubl2000Draw() -{ - AfegaCommonDraw(0, -0x100, 0); - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - if (strncmp(BurnDrvGetTextA(DRV_NAME), "tharrier", 8) == 0) - { - DrvInputs[0] = 0x8000; - DrvInputs[1] = 0x0000; - DrvInputs[2] = 0x0000; - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - if (DrvInputs[0] & 0x0001) DrvInputs[1] ^= 0x0080; - if (DrvInputs[0] & 0x0002) DrvInputs[1] ^= 0x0020; - if (DrvInputs[0] & 0x0008) DrvInputs[1] ^= 0x0001; - if (DrvInputs[0] & 0x0010) DrvInputs[1] ^= 0x0102; - } - else - { - DrvInputs[0] = ~input_high[0]; - DrvInputs[1] = ~input_high[1]; - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - ZetNewFrame(); - - INT32 nSegment; - INT32 nInterleave = 10; - INT32 nTotalCycles[2] = { 10000000 / 56, 3000000 / 56 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = nTotalCycles[0] / nInterleave; - nCyclesDone[0] += SekRun(nSegment); - if (i == (nInterleave-1) || i == ((nInterleave / 2) - 1)) { - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - SekRun(0); - } - if (i == ((nInterleave/2)-1)) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - if (i == (nInterleave-1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - BurnTimerUpdate(i * (nTotalCycles[1] / nInterleave)); - } - - BurnTimerEndFrame(nTotalCycles[1]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); - - return 0; -} - -static INT32 SsmissinFrame() -{ - if (DrvReset) { - SmissinDoReset(); - } - - { - DrvInputs[0] = ~input_high[0]; - DrvInputs[1] = ~input_high[1]; - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - ZetNewFrame(); - - INT32 nSegment; - INT32 nInterleave = 10; - INT32 nTotalCycles[2] = { 8000000 / 56, 4000000 / 56 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = nTotalCycles[0] / nInterleave; - - nCyclesDone[0] += SekRun(nSegment); - - if (i == (nInterleave-1) || i == ((nInterleave / 2) - 1)) { - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - SekRun(0); - } - if (i == ((nInterleave/2)-1) && nNMK004EnableIrq2) - SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - if (i == (nInterleave-1)) - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - ZetRun(nTotalCycles[1] / nInterleave); - } - - if (pBurnSoundOut) { - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); - - return 0; -} - -static INT32 Macross2Frame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = ~input_high[0]; - DrvInputs[1] = ~input_high[1]; - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - ZetNewFrame(); - - INT32 nSegment; - INT32 nInterleave = 200; - INT32 nTotalCycles[2] = { 10000000 / 56, 4000000 / 56 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = nTotalCycles[0] / nInterleave; - nCyclesDone[0] += SekRun(nSegment); - if (i == 1 || i == (nInterleave / 2)) { - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - } - if (i == (nInterleave-1)) { - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - - if (macross2_sound_enable) { - //BurnTimerUpdate((nSegment * 4) / 10); - BurnTimerUpdate(i * (nTotalCycles[1] / nInterleave)); - } - } - - if (macross2_sound_enable) { - BurnTimerEndFrame(nTotalCycles[1]); - } - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); - - return 0; -} - -static INT32 AfegaFrame() -{ - if (DrvReset) { - AfegaDoReset(); - } - - ZetNewFrame(); - - { - DrvInputs[0] = ~input_high[0]; - DrvInputs[1] = ~input_high[1]; - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 12000000 / 56, 4000000 / 56 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nSegment; - - nSegment = nCyclesTotal[0] / nInterleave; - nCyclesDone[0] += SekRun(nSegment); - if (i == (nInterleave / 2) - 1) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - if (i == (nInterleave) - 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - nSegment = nCyclesTotal[1] / nInterleave; - nCyclesDone[1] += ZetRun(nSegment); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); - - return 0; -} - -static INT32 BjtwinFrame() -{ - if (DrvReset) { - BjtwinDoReset(); - } - - { - DrvInputs[0] = ~input_high[0]; - DrvInputs[1] = ~input_high[1]; - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - INT32 nInterleave = 10; - INT32 nCyclesTotal[1] = { 10000000 / 56 }; - INT32 nCyclesDone[1] = { 0 }; - - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nSegment; - - nSegment = nCyclesTotal[0] / nInterleave; - nCyclesDone[0] += SekRun(nSegment); - if (i == (nInterleave-1) || i == ((nInterleave / 2) - 1)) { - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - } - if (i == (nInterleave-1)) { - SekRun(0); - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - } - - if (pBurnSoundOut) { - memset (pBurnSoundOut, 0, nBurnSoundLen * 2 * sizeof(INT16)); - MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - SekClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); - - return 0; -} - -static INT32 SeibuSoundFrame() -{ - if (DrvReset) { - SeibuSoundDoReset(); - } - - ZetNewFrame(); - - { - DrvInputs[0] = ~input_high[0]; - DrvInputs[1] = ~input_high[1]; - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - INT32 nInterleave = 100; - INT32 nCyclesTotal[2] = { 10000000 / 56, 3579545 / 56 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nSegment; - - nSegment = nCyclesTotal[0] / nInterleave; - nCyclesDone[0] += SekRun(nSegment); - if (i == (nInterleave-1) || i == ((nInterleave / 2) - 1)) { - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - } - - if (i == ((nInterleave/2)-1)) { - SekRun(0); - SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - } - - if (i == (nInterleave-1)) { - SekRun(0); - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - - BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); - } - - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - - if (pBurnSoundOut) { - seibu_sound_update(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); - - return 0; -} - -static INT32 NMK004Frame() -{ - if (DrvReset) { - NMK004DoReset(); - } - - { - DrvInputs[0] = ~input_high[0]; - DrvInputs[1] = ~input_high[1]; - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - SekNewFrame(); - - INT32 nSegment; - INT32 nInterleave = 200; - INT32 nTotalCycles[1] = { nNMK004CpuSpeed / 56 }; - - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = (nTotalCycles[0] / nInterleave) * (i + 1); - BurnTimerUpdate(nSegment); - - if (i == (nInterleave-1) || i == ((nInterleave / 2) - 1)) { - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - } - if (i == ((nInterleave/2)-1) && nNMK004EnableIrq2) { - SekRun(0); - SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - } - if (i == (nInterleave-1)) { - SekRun(0); - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - } - - BurnTimerEndFrame(nTotalCycles[0]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); - } - - SekClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - if (strncmp(BurnDrvGetTextA(DRV_NAME), "strahl", 6) == 0) { - memcpy (DrvSprBuf2, Drv68KRAM + 0xf000, 0x1000); - } else { - memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); - } - - return 0; -} - - -//------------------------------------------------------------------------------------------------------------------------------------- - -static void decryptcode(INT32 len, INT32 a17, INT32 a16, INT32 a15, INT32 a14, INT32 a13) -{ - UINT8 *buf = (UINT8*)malloc(len); - - memcpy (buf, Drv68KROM, len); - - for (INT32 i = 0; i < len; i++) { - Drv68KROM[i] = buf[BITSWAP24(i, 23,22,21,20,19,18,a17,a16,a15,a14,a13,12,11,10,9,8,7,6,5,4,3,2,1,0)]; - } - - if (buf) { - free (buf); - buf = NULL; - } -} - -static UINT32 bjtwin_address_map_bg0(UINT32 addr) -{ - return ((addr & 0x00004) >> 2) | ((addr & 0x00800) >> 10) | ((addr & 0x40000) >> 16); -} - -static UINT8 decode_byte(UINT8 src, const UINT8 *bitp) -{ - UINT8 ret = 0; - for (INT32 i=0; i<8; i++) - ret |= (((src >> bitp[i]) & 1) << (7-i)); - - return ret; -} - -static UINT16 decode_word(UINT16 src, const UINT8 *bitp) -{ - UINT16 ret=0; - for (INT32 i = 0; i < 16; i++) - ret |= (((src >> bitp[i]) & 1) << (15-i)); - - return ret; -} - -static UINT32 bjtwin_address_map_sprites(UINT32 addr) -{ - return ((addr & 0x00010) >> 4) | ((addr & 0x20000) >> 16) | ((addr & 0x100000) >> 18); -} - -static void decode_gfx(INT32 gfxlen0, INT32 gfxlen1) -{ - static const UINT8 decode_data_bg[8][8] = - { - {0x3,0x0,0x7,0x2,0x5,0x1,0x4,0x6}, - {0x1,0x2,0x6,0x5,0x4,0x0,0x3,0x7}, - {0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0}, - {0x7,0x6,0x5,0x0,0x1,0x4,0x3,0x2}, - {0x2,0x0,0x1,0x4,0x3,0x5,0x7,0x6}, - {0x5,0x3,0x7,0x0,0x4,0x6,0x2,0x1}, - {0x2,0x7,0x0,0x6,0x5,0x3,0x1,0x4}, - {0x3,0x4,0x7,0x6,0x2,0x0,0x5,0x1}, - }; - - static const UINT8 decode_data_sprite[8][16] = - { - {0x9,0x3,0x4,0x5,0x7,0x1,0xb,0x8,0x0,0xd,0x2,0xc,0xe,0x6,0xf,0xa}, - {0x1,0x3,0xc,0x4,0x0,0xf,0xb,0xa,0x8,0x5,0xe,0x6,0xd,0x2,0x7,0x9}, - {0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0}, - {0xf,0xe,0xc,0x6,0xa,0xb,0x7,0x8,0x9,0x2,0x3,0x4,0x5,0xd,0x1,0x0}, - {0x1,0x6,0x2,0x5,0xf,0x7,0xb,0x9,0xa,0x3,0xd,0xe,0xc,0x4,0x0,0x8}, - {0x7,0x5,0xd,0xe,0xb,0xa,0x0,0x1,0x9,0x6,0xc,0x2,0x3,0x4,0x8,0xf}, - {0x0,0x5,0x6,0x3,0x9,0xb,0xa,0x7,0x1,0xd,0x2,0xe,0x4,0xc,0x8,0xf}, - {0x9,0xc,0x4,0x2,0xf,0x0,0xb,0x8,0xa,0xd,0x3,0x6,0x5,0xe,0x1,0x7}, - }; - - for (INT32 A = 0; A < gfxlen0; A++) { - DrvGfxROM1[A] = decode_byte(DrvGfxROM1[A], decode_data_bg[bjtwin_address_map_bg0(A)]); - } - - for (INT32 A = 0; A < gfxlen1; A += 2) - { - UINT16 tmp = decode_word((DrvGfxROM2[A+1] << 8) | DrvGfxROM2[A], decode_data_sprite[bjtwin_address_map_sprites(A)]); - DrvGfxROM2[A+1] = tmp >> 8; - DrvGfxROM2[A] = tmp & 0xff; - } -} - -static void ssmissin_decode() -{ - for (INT32 A = 0; A < 0x100000; A++) - { - DrvGfxROM1[A] = BITSWAP08(DrvGfxROM1[A], 7, 6, 5, 3, 4, 2, 1, 0); - DrvGfxROM2[A] = BITSWAP08(DrvGfxROM2[A], 7, 6, 5, 3, 4, 2, 1, 0); - } -} - -static void decode_tdragonb() -{ - static const UINT8 decode_data_tdragonb[16] = { - 0xe,0xc,0xa,0x8,0x7,0x5,0x3,0x1,0xf,0xd,0xb,0x9,0x6,0x4,0x2,0x0 - }; - - for (INT32 A = 0; A < 0x40000; A += 2) - { - UINT16 tmp = decode_word((Drv68KROM[A+1] << 8) | Drv68KROM[A], decode_data_tdragonb); - Drv68KROM[A+1] = tmp >> 8; - Drv68KROM[A] = tmp & 0xff; - } - - ssmissin_decode(); -} - -//------------------------------------------------------------------------------------------------------------- - - -// Task Force Harrier - -static struct BurnRomInfo tharrierRomDesc[] = { - { "2", 0x020000, 0x78923aaa, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "3", 0x020000, 0x99cea259, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "12", 0x010000, 0xb959f837, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "1", 0x010000, 0xc7402e4a, 3 | BRF_GRA }, // 3 Characters - - { "89050-4", 0x080000, 0x64d7d687, 4 | BRF_GRA }, // 4 Tiles - - { "89050-13", 0x080000, 0x24db3fa4, 5 | BRF_GRA }, // 5 Sprites - { "89050-17", 0x080000, 0x7f715421, 5 | BRF_GRA }, // 6 - - { "89050-8", 0x080000, 0x11ee4c39, 6 | BRF_SND }, // 7 OKI1 Samples - - { "89050-10", 0x080000, 0x893552ab, 7 | BRF_SND }, // 8 OKI2 Samples - - { "21.bpr", 0x000100, 0xfcd5efea, 0 | BRF_OPT }, // 9 Unused proms - { "22.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 - { "23.bpr", 0x000020, 0xfc3569f4, 0 | BRF_OPT }, // 11 - { "24.bpr", 0x000100, 0xe0a009fe, 0 | BRF_OPT }, // 12 - { "25.bpr", 0x000100, 0xe0a009fe, 0 | BRF_OPT }, // 13 - { "26.bpr", 0x000020, 0x0cbfb33e, 0 | BRF_OPT }, // 14 -}; - -STD_ROM_PICK(tharrier) -STD_ROM_FN(tharrier) - -static INT32 TharrierLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x00001, 6, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 7, 1)) return 1; - memmove (DrvSndROM0 + 0x40000, DrvSndROM0 + 0x20000, 0x60000); - - if (BurnLoadRom(DrvSndROM1 + 0x00000, 8, 1)) return 1; - memmove (DrvSndROM1 + 0x40000, DrvSndROM1 + 0x20000, 0x60000); - - DrvGfxDecode(0x10000, 0x80000, 0x100000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0883ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x09c000, 0x09c7ff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09d000, 0x09d7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); - SekSetWriteWordHandler(0, tharrier_main_write_word); - SekSetWriteByteHandler(0, tharrier_main_write_byte); - SekSetReadWordHandler(0, tharrier_main_read_word); - SekSetReadByteHandler(0, tharrier_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 TharrierInit() -{ - input_high[0] = 0x7fff; - input_high[1] = 0xffff; - - return DrvInit(TharrierLoadCallback); -} - -struct BurnDriver BurnDrvTharrier = { - "tharrier", NULL, NULL, NULL, "1989", - "Task Force Harrier\0", NULL, "UPL (American Sammy license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, tharrierRomInfo, tharrierRomName, NULL, NULL, TharrierInputInfo, TharrierDIPInfo, - TharrierInit, DrvExit, DrvFrame, TharrierDraw, NULL, NULL, 0x200, - 224, 256, 3, 4 -}; - - -// Task Force Harrier (Japan) - -static struct BurnRomInfo tharrierjRomDesc[] = { - { "2.bin", 0x020000, 0xf3887a44, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "3.bin", 0x020000, 0x65c247f6, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "12", 0x010000, 0xb959f837, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "1.bin", 0x010000, 0x005c26c3, 3 | BRF_GRA }, // 3 Characters - - { "89050-4", 0x080000, 0x64d7d687, 4 | BRF_GRA }, // 4 Tiles - - { "89050-13", 0x080000, 0x24db3fa4, 5 | BRF_GRA }, // 5 Sprites - { "89050-17", 0x080000, 0x7f715421, 5 | BRF_GRA }, // 6 - - { "89050-8", 0x080000, 0x11ee4c39, 6 | BRF_SND }, // 7 OKI1 Samples - - { "89050-10", 0x080000, 0x893552ab, 7 | BRF_SND }, // 8 OKI2 Samples - - { "21.bpr", 0x000100, 0xfcd5efea, 0 | BRF_OPT }, // 9 Unused proms - { "22.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 - { "23.bpr", 0x000020, 0xfc3569f4, 0 | BRF_OPT }, // 11 - { "24.bpr", 0x000100, 0xe0a009fe, 0 | BRF_OPT }, // 12 - { "25.bpr", 0x000100, 0xe0a009fe, 0 | BRF_OPT }, // 13 - { "26.bpr", 0x000020, 0x0cbfb33e, 0 | BRF_OPT }, // 14 -}; - -STD_ROM_PICK(tharrierj) -STD_ROM_FN(tharrierj) - -struct BurnDriver BurnDrvTharrierj = { - "tharrierj", "tharrier", NULL, NULL, "1989", - "Task Force Harrier (Japan)\0", NULL, "UPL", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, - NULL, tharrierjRomInfo, tharrierjRomName, NULL, NULL, TharrierInputInfo, TharrierDIPInfo, - TharrierInit, DrvExit, DrvFrame, TharrierDraw, NULL, NULL, 0x200, - 224, 256, 3, 4 -}; - - -// Many Block - -static struct BurnRomInfo manyblocRomDesc[] = { - { "1-u33.bin", 0x020000, 0x07473154, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "2-u35.bin", 0x020000, 0x04acd8c1, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "3-u146.bin", 0x010000, 0x7bf5fafa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "12-u39.bin", 0x010000, 0x413b5438, 3 | BRF_GRA }, // 3 Characters - - { "5-u97.bin", 0x040000, 0x536699e6, 4 | BRF_GRA }, // 4 Ciles - { "4-u96.bin", 0x040000, 0x28af2640, 4 | BRF_GRA }, // 5 - - { "8-u54b.bin", 0x020000, 0x03eede77, 5 | BRF_GRA }, // 6 Sprites - { "10-u86b.bin", 0x020000, 0x9eab216f, 5 | BRF_GRA }, // 7 - { "9-u53b.bin", 0x020000, 0xdfcfa040, 5 | BRF_GRA }, // 8 - { "11-u85b.bin", 0x020000, 0xfe747dd5, 5 | BRF_GRA }, // 9 - - { "6-u131.bin", 0x040000, 0x79a4ae75, 6 | BRF_SND }, // 10 OKI1 Samples - { "7-u132.bin", 0x040000, 0x21db875e, 6 | BRF_SND }, // 11 - - { "u200.bpr", 0x000020, 0x1823600b, 0 | BRF_OPT }, // 12 Unused proms - { "u7.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 13 - { "u10.bpr", 0x000200, 0x8e9b569a, 0 | BRF_OPT }, // 14 - { "u120.bpr", 0x000100, 0x576c5984, 0 | BRF_OPT }, // 15 -}; - -STD_ROM_PICK(manybloc) -STD_ROM_FN(manybloc) - -static INT32 ManyblocLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x00000, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00001, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x40000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x00001, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x40000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x40001, 9, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 10, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x60000, 11, 1)) return 1; - memmove (DrvSndROM0 + 0x40000, DrvSndROM0 + 0x20000, 0x20000); - - DrvGfxDecode(0x10000, 0x80000, 0x80000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0883ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x09c000, 0x09cfff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09d000, 0x09d7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); - SekSetWriteWordHandler(0, manybloc_main_write_word); - SekSetWriteByteHandler(0, manybloc_main_write_byte); - SekSetReadWordHandler(0, manybloc_main_read_word); - SekSetReadByteHandler(0, manybloc_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 ManyblocInit() -{ - global_y_offset = 8; - input_high[0] = 0x7fff; - input_high[1] = 0xffff; - - return DrvInit(ManyblocLoadCallback); -} - -struct BurnDriver BurnDrvManybloc = { - "manybloc", NULL, NULL, NULL, "1991", - "Many Block\0", NULL, "Bee-Oh", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, manyblocRomInfo, manyblocRomName, NULL, NULL, ManyblocInputInfo, ManyblocDIPInfo, - ManyblocInit, DrvExit, DrvFrame, ManyblocDraw, NULL, NULL, 0x200, - 240, 256, 3, 4 -}; - - -// S.S. Mission - -static struct BurnRomInfo ssmissinRomDesc[] = { - { "ssm14.165", 0x020000, 0xeda61b74, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "ssm15.166", 0x020000, 0xaff15927, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "ssm11.188", 0x008000, 0x8be6dce3, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "ssm16.172", 0x020000, 0x5cf6eb1f, 3 | BRF_GRA }, // 3 Characters - - { "ssm17.147", 0x080000, 0xc9c28455, 4 | BRF_GRA }, // 4 Tiles - { "ssm18.148", 0x080000, 0xebfdaad6, 4 | BRF_GRA }, // 5 - - { "ssm20.34", 0x080000, 0xa0c16c4d, 5 | BRF_GRA }, // 6 Sprites - { "ssm19.33", 0x080000, 0xb1943657, 5 | BRF_GRA }, // 7 - - { "ssm13.190", 0x020000, 0x618f66f0, 6 | BRF_SND }, // 8 OKI1 Samples - { "ssm12.189", 0x080000, 0xe8219c83, 6 | BRF_SND }, // 9 - - { "ssm-pr2.113", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 Unused proms - { "ssm-pr1.114", 0x000200, 0xed0bd072, 0 | BRF_OPT }, // 11 -}; - -STD_ROM_PICK(ssmissin) -STD_ROM_FN(ssmissin) - -static INT32 SsmissinLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x00000, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00001, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x80000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00001, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 7, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 8, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x40000, 9, 1)) return 1; - - ssmissin_decode(); - DrvGfxDecode(0x20000, 0x100000, 0x100000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x0b0000, 0x0bffff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x0c4000, 0x0c43ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x0c8000, 0x0c87ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x0cc000, 0x0cffff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x0d0000, 0x0d07ff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x0d0800, 0x0d0fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x0d1000, 0x0d17ff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x0d1800, 0x0d1fff, SM_RAM); - SekSetWriteWordHandler(0, ssmissin_main_write_word); - SekSetWriteByteHandler(0, ssmissin_main_write_byte); - SekSetReadWordHandler(0, ssmissin_main_read_word); - SekSetReadByteHandler(0, ssmissin_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 SsmissinInit() -{ - return MSM6295x1Init(SsmissinLoadCallback); -} - -struct BurnDriver BurnDrvSsmissin = { - "ssmissin", NULL, NULL, NULL, "1992", - "S.S. Mission\0", NULL, "Comad", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, ssmissinRomInfo, ssmissinRomName, NULL, NULL, SsmissinInputInfo, SsmissinDIPInfo, - SsmissinInit, MSM6295x1Exit, SsmissinFrame, MacrossDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - -// Air Attack (set 1) - -static struct BurnRomInfo airattckRomDesc[] = { - { "uc10.bin", 0x020000, 0x1837d4ba, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "ue10.bin", 0x020000, 0x71deb9d8, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "3.su6", 0x008000, 0x3e352370, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "4.ul10", 0x020000, 0xe9362ab4, 3 | BRF_GRA }, // 3 Characters - - { "9.uw9", 0x080000, 0x86e59966, 4 | BRF_GRA }, // 4 Tiles - { "10.ux9", 0x080000, 0x122c8d04, 4 | BRF_GRA }, // 5 - - { "8.uo82", 0x080000, 0x9a83e3d8, 5 | BRF_GRA }, // 6 Sprites - { "7.uo81", 0x080000, 0x3c38d671, 5 | BRF_GRA }, // 7 - - { "2.su12", 0x020000, 0x93ab615b, 6 | BRF_SND }, // 8 OKI1 Samples - { "1.su13", 0x080000, 0x09a836bb, 6 | BRF_SND }, // 9 - - { "82s129.ug6", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 Unused proms - { "82s147.uh6", 0x000200, 0xed0bd072, 0 | BRF_OPT }, // 11 -}; - -STD_ROM_PICK(airattck) -STD_ROM_FN(airattck) - -struct BurnDriver BurnDrvAirattck = { - "airattck", NULL, NULL, NULL, "1996", - "Air Attack (set 1)\0", NULL, "Comad", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, airattckRomInfo, airattckRomName, NULL, NULL, SsmissinInputInfo, SsmissinDIPInfo, - SsmissinInit, MSM6295x1Exit, SsmissinFrame, MacrossDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - -// Air Attack (set 2) - -static struct BurnRomInfo airattckaRomDesc[] = { - { "5.ue10", 0x020000, 0x6589c005, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "6.uc10", 0x020000, 0x3572baf0, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "3.su6", 0x008000, 0x3e352370, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "4.ul10", 0x020000, 0xe9362ab4, 3 | BRF_GRA }, // 3 Characters - - { "9.uw9", 0x080000, 0x86e59966, 4 | BRF_GRA }, // 4 Tiles - { "10.ux9", 0x080000, 0x122c8d04, 4 | BRF_GRA }, // 5 - - { "8.uo82", 0x080000, 0x9a83e3d8, 5 | BRF_GRA }, // 6 Sprites - { "7.uo81", 0x080000, 0x3c38d671, 5 | BRF_GRA }, // 7 - - { "2.su12", 0x020000, 0x93ab615b, 6 | BRF_SND }, // 8 OKI1 Samples - { "1.su13", 0x080000, 0x09a836bb, 6 | BRF_SND }, // 9 - - { "82s129.ug6", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 Unused proms - { "82s147.uh6", 0x000200, 0xed0bd072, 0 | BRF_OPT }, // 11 -}; - -STD_ROM_PICK(airattcka) -STD_ROM_FN(airattcka) - -struct BurnDriver BurnDrvAirattcka = { - "airattcka", "airattck", NULL, NULL, "1996", - "Air Attack (set 2)\0", NULL, "Comad", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, airattckaRomInfo, airattckaRomName, NULL, NULL, SsmissinInputInfo, SsmissinDIPInfo, - SsmissinInit, MSM6295x1Exit, SsmissinFrame, MacrossDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - -// Super Spacefortress Macross II / Chou-Jikuu Yousai Macross II - -static struct BurnRomInfo macross2RomDesc[] = { - { "mcrs2j.3", 0x080000, 0x36a618fe, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - - { "mcrs2j.2", 0x020000, 0xb4aa8ac7, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 code - - { "mcrs2j.1", 0x020000, 0xc7417410, 3 | BRF_GRA }, // 2 Characters - - { "bp932an.a04", 0x200000, 0xc4d77ff0, 4 | BRF_GRA }, // 3 Tiles - - { "bp932an.a07", 0x200000, 0xaa1b21b9, 5 | BRF_GRA }, // 4 Sprites - { "bp932an.a08", 0x200000, 0x67eb2901, 5 | BRF_GRA }, // 5 - - { "bp932an.a06", 0x200000, 0xef0ffec0, 6 | BRF_SND }, // 6 OKI1 Samples - - { "bp932an.a05", 0x100000, 0xb5335abb, 7 | BRF_SND }, // 7 OKI2 Samples - - { "mcrs2bpr.9", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 Unused proms - { "mcrs2bpr.10", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 -}; - -STD_ROM_PICK(macross2) -STD_ROM_FN(macross2) - -struct BurnDriver BurnDrvMacross2 = { - "macross2", NULL, NULL, NULL, "1993", - "Super Spacefortress Macross II / Chou-Jikuu Yousai Macross II\0", NULL, "Banpresto", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, macross2RomInfo, macross2RomName, NULL, NULL, CommonInputInfo, Macross2DIPInfo, - Macross2Init, DrvExit, Macross2Frame, Macross2Draw, NULL, NULL, 0x400, - 384, 224, 4, 3 -}; - - -// Thunder Dragon 2 (9th Nov. 1993) - -static struct BurnRomInfo tdragon2RomDesc[] = { - { "6.rom", 0x080000, 0xca348caf, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - - { "5.bin", 0x020000, 0xb870be61, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 code - - { "1.bin", 0x020000, 0xd488aafa, 3 | BRF_GRA }, // 2 Characters - - { "ww930914.2", 0x200000, 0xf968c65d, 4 | BRF_GRA }, // 3 Tiles - - { "ww930917.7", 0x200000, 0xb98873cb, 5 | BRF_GRA }, // 4 Sprites - { "ww930918.8", 0x200000, 0xbaee84b2, 5 | BRF_GRA }, // 5 - - { "ww930916.4", 0x200000, 0x07c35fe6, 6 | BRF_SND }, // 6 OKI1 Samples - - { "ww930915.3", 0x200000, 0x82025bab, 7 | BRF_SND }, // 7 OKI2 Samples - - { "9.bpr", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 Unused proms - { "10.bpr", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 -}; - -STD_ROM_PICK(tdragon2) -STD_ROM_FN(tdragon2) - -struct BurnDriver BurnDrvTdragon2 = { - "tdragon2", NULL, NULL, NULL, "1993", - "Thunder Dragon 2 (9th Nov. 1993)\0", NULL, "NMK", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, tdragon2RomInfo, tdragon2RomName, NULL, NULL, Tdragon2InputInfo, Tdragon2DIPInfo, - Macross2Init, DrvExit, Macross2Frame, Macross2Draw, NULL, NULL, 0x400, - 224, 384, 3, 4 -}; - - -// Thunder Dragon 2 (1st Oct. 1993) - -static struct BurnRomInfo tdragon2aRomDesc[] = { - { "6.bin", 0x080000, 0x310d6bca, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - - { "5.bin", 0x020000, 0xb870be61, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 code - - { "1.bin", 0x020000, 0xd488aafa, 3 | BRF_GRA }, // 2 Characters - - { "ww930914.2", 0x200000, 0xf968c65d, 4 | BRF_GRA }, // 3 Tiles - - { "ww930917.7", 0x200000, 0xb98873cb, 5 | BRF_GRA }, // 4 Sprites - { "ww930918.8", 0x200000, 0xbaee84b2, 5 | BRF_GRA }, // 5 - - { "ww930916.4", 0x200000, 0x07c35fe6, 6 | BRF_SND }, // 6 OKI1 Samples - - { "ww930915.3", 0x200000, 0x82025bab, 7 | BRF_SND }, // 7 OKI2 Samples - - { "9.bpr", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 Unused proms - { "10.bpr", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 -}; - -STD_ROM_PICK(tdragon2a) -STD_ROM_FN(tdragon2a) - -struct BurnDriver BurnDrvTdragon2a = { - "tdragon2a", "tdragon2", NULL, NULL, "1993", - "Thunder Dragon 2 (1st Oct. 1993)\0", NULL, "NMK", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, tdragon2aRomInfo, tdragon2aRomName, NULL, NULL, Tdragon2InputInfo, Tdragon2DIPInfo, - Macross2Init, DrvExit, Macross2Frame, Macross2Draw, NULL, NULL, 0x400, - 224, 384, 3, 4 -}; - - -// Big Bang (9th Nov. 1993) - -static struct BurnRomInfo bigbangRomDesc[] = { - { "eprom.3", 0x080000, 0x28e5957a, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - - { "5.bin", 0x020000, 0xb870be61, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 code - - { "1.bin", 0x020000, 0xd488aafa, 3 | BRF_GRA }, // 2 Characters - - { "ww930914.2", 0x200000, 0xf968c65d, 4 | BRF_GRA }, // 3 Tiles - - { "ww930917.7", 0x200000, 0xb98873cb, 5 | BRF_GRA }, // 4 Sprites - { "ww930918.8", 0x200000, 0xbaee84b2, 5 | BRF_GRA }, // 5 - - { "ww930916.4", 0x200000, 0x07c35fe6, 6 | BRF_SND }, // 6 OKI1 Samples - - { "ww930915.3", 0x200000, 0x82025bab, 7 | BRF_SND }, // 7 OKI2 Samples - - { "9.bpr", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 Unused proms - { "10.bpr", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 -}; - -STD_ROM_PICK(bigbang) -STD_ROM_FN(bigbang) - -struct BurnDriver BurnDrvBigbang = { - "bigbang", "tdragon2", NULL, NULL, "1993", - "Big Bang (9th Nov. 1993)\0", NULL, "NMK", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, bigbangRomInfo, bigbangRomName, NULL, NULL, Tdragon2InputInfo, Tdragon2DIPInfo, - Macross2Init, DrvExit, Macross2Frame, Macross2Draw, NULL, NULL, 0x400, - 224, 384, 3, 4 -}; - - -// Stagger I (Japan) - -static struct BurnRomInfo stagger1RomDesc[] = { - { "2.bin", 0x020000, 0x8555929b, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "3.bin", 0x020000, 0x5b0b63ac, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "1.bin", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "4.bin", 0x080000, 0x46463d36, 4 | BRF_GRA }, // 3 Tiles - - { "7.bin", 0x080000, 0x048f7683, 5 | BRF_GRA }, // 4 Characters - { "6.bin", 0x080000, 0x051d4a77, 5 | BRF_GRA }, // 5 - - { "5", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 6 OKI1 Samples -}; - -STD_ROM_PICK(stagger1) -STD_ROM_FN(stagger1) - -static void pAfegaZ80Callback() -{ - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(afega_sound_write); - ZetSetReadHandler(afega_sound_read); - ZetMemEnd(); - ZetClose(); -} - -static INT32 Stagger1LoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; - - memset (DrvGfxROM0, 0xff, 0x20); - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x00001, 5, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 6, 1)) return 1; - - DrvGfxDecode(0x20, 0x80000, 0x100000); - - return 0; -} - -static INT32 Stagger1Init() -{ - return AfegaInit(Stagger1LoadCallback, pAfegaZ80Callback, 1); -} - -struct BurnDriver BurnDrvStagger1 = { - "stagger1", NULL, NULL, NULL, "1998", - "Stagger I (Japan)\0", NULL, "Afega", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, stagger1RomInfo, stagger1RomName, NULL, NULL, CommonInputInfo, Stagger1DIPInfo, - Stagger1Init, AfegaExit, AfegaFrame, AfegaDraw, NULL, NULL, 0x300, - 224, 256, 3, 4 -}; - - -// Red Hawk (US) - -static struct BurnRomInfo redhawkRomDesc[] = { - { "2", 0x020000, 0x3ef5f326, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "3", 0x020000, 0x9b3a10ef, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "1.bin", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "4", 0x080000, 0xd6427b8a, 4 | BRF_GRA }, // 5 Tiles - - { "7", 0x080000, 0x66a8976d, 5 | BRF_GRA }, // 3 Characters - { "6", 0x080000, 0x61560164, 5 | BRF_GRA }, // 4 - - { "5", 0x040000, 0xe911ce33, 6 | BRF_GRA }, // 6 OKI1 Samples -}; - -STD_ROM_PICK(redhawk) -STD_ROM_FN(redhawk) - -static INT32 RedhawkInit() -{ - INT32 nRet = AfegaInit(Stagger1LoadCallback, pAfegaZ80Callback, 1); - - if (nRet == 0) { - decryptcode(0x40000, 16,15,14,17,13); - } - - return nRet; -} - -struct BurnDriver BurnDrvRedhawk = { - "redhawk", "stagger1", NULL, NULL, "1997", - "Red Hawk (US)\0", NULL, "Afega (New Vision Ent. license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, redhawkRomInfo, redhawkRomName, NULL, NULL, CommonInputInfo, Stagger1DIPInfo, - RedhawkInit, AfegaExit, AfegaFrame, AfegaDraw, NULL, NULL, 0x300, - 224, 256, 3, 4 -}; - - -// Red Hawk (Excellent Co., Ltd) - -static struct BurnRomInfo redhawkeRomDesc[] = { - { "rhawk2.bin", 0x020000, 0x6d2e23b4, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "rhawk3.bin", 0x020000, 0x5e0d6188, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "1.bin", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "rhawk4.bin", 0x080000, 0xd79aa288, 4 | BRF_GRA }, // 3 Tiles - - { "rhawk7.bin", 0x080000, 0x0264ef54, 5 | BRF_GRA }, // 4 Characters - { "rhawk6.bin", 0x080000, 0x3f980ab6, 5 | BRF_GRA }, // 5 - - { "5", 0x040000, 0xe911ce33, 6 | BRF_GRA }, // 6 OKI1 Samples -}; - -STD_ROM_PICK(redhawke) -STD_ROM_FN(redhawke) - -struct BurnDriver BurnDrvRedhawke = { - "redhawke", "stagger1", NULL, NULL, "1997", - "Red Hawk (Excellent Co., Ltd)\0", NULL, "Afega (Excellent Co. license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, redhawkeRomInfo, redhawkeRomName, NULL, NULL, CommonInputInfo, Stagger1DIPInfo, - Stagger1Init, AfegaExit, AfegaFrame, AfegaDraw, NULL, NULL, 0x300, - 224, 256, 3, 4 -}; - - -// Red Hawk (Italy) - -static struct BurnRomInfo redhawkiRomDesc[] = { - { "rhit-2.bin", 0x020000, 0x30cade0e, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "rhit-3.bin", 0x020000, 0x37dbb3c2, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "1.bin", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "rhit-4.bin", 0x080000, 0xaafb3cc4, 4 | BRF_GRA }, // 3 Tiles - - { "rhit-7.bin", 0x080000, 0xbcb367c7, 5 | BRF_GRA }, // 4 Characters - { "rhit-6.bin", 0x080000, 0x7cbd5c60, 5 | BRF_GRA }, // 5 - - { "5", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 6 OKI1 Samples -}; - -STD_ROM_PICK(redhawki) -STD_ROM_FN(redhawki) - -static INT32 RedhawkiInit() -{ - INT32 nRet = AfegaInit(Stagger1LoadCallback, pAfegaZ80Callback, 1); - - if (nRet == 0) { - decryptcode(0x40000, 15, 16, 17, 14, 13); - } - - return nRet; -} - -struct BurnDriver BurnDrvRedhawki = { - "redhawki", "stagger1", NULL, NULL, "1997", - "Red Hawk (Italy)\0", NULL, "Afega (Hea Dong Corp license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, redhawkiRomInfo, redhawkiRomName, NULL, NULL, CommonInputInfo, Stagger1DIPInfo, - RedhawkiInit, AfegaExit, AfegaFrame, RedhawkiDraw, NULL, NULL, 0x300, - 256, 224, 4, 3 -}; - - -// Vince (Redhawk bootleg - -static struct BurnRomInfo redhawkbRomDesc[] = { - { "rhb-1.bin", 0x020000, 0xe733ea07, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "rhb-2.bin", 0x020000, 0xf9fa5684, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "1.bin", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "rhb-5.bin", 0x080000, 0xd0eaf6f2, 4 | BRF_GRA }, // 3 Tiles - - { "rhb-3.bin", 0x080000, 0x0318d68b, 5 | BRF_GRA }, // 4 Characters - { "rhb-4.bin", 0x080000, 0xba21c1ef, 5 | BRF_GRA }, // 5 - - { "5", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 6 OKI1 Samples -}; - -STD_ROM_PICK(redhawkb) -STD_ROM_FN(redhawkb) - -static INT32 RedhawkbLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; - - memset (DrvGfxROM0, 0xff, 0x20); - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x80000, 5, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x00000, 6, 1)) return 1; - - DrvGfxDecode(0x20, 0x80000, 0x100000); - - BurnByteswap(DrvGfxROM1, 0x100000); - BurnByteswap(DrvGfxROM2, 0x200000); - - return 0; -} - -static INT32 RedhawkbInit() -{ - input_high[0] = input_high[1] = 0xffff; - - return AfegaInit(RedhawkbLoadCallback, pAfegaZ80Callback, 1); -} - -struct BurnDriver BurnDrvRedhawkb = { - "redhawkb", "stagger1", NULL, NULL, "1997", - "Vince (Redhawk bootleg)\0", NULL, "bootleg", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, redhawkbRomInfo, redhawkbRomName, NULL, NULL, CommonInputInfo, RedhawkbDIPInfo, - RedhawkbInit, AfegaExit, AfegaFrame, RedhawkbDraw, NULL, NULL, 0x300, - 256, 224, 4, 3 -}; - - -// Guardian Storm - -static struct BurnRomInfo grdnstrmRomDesc[] = { - { "afega4.u112", 0x040000, 0x2244713a, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "afega5.u107", 0x040000, 0x5815c806, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "afega7.u92", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "afega1.u4", 0x010000, 0x9e7ef086, 3 | BRF_GRA }, // 3 Characters - - { "afega_af1-b2.uc8", 0x200000, 0xd68588c2, 4 | BRF_GRA }, // 4 Tiles - { "afega_af1-b1.uc3", 0x200000, 0xf8b200a8, 4 | BRF_GRA }, // 5 - - { "afega3.uc13", 0x200000, 0x0218017c, 5 | BRF_GRA }, // 6 Sprites - - { "afega1.u95", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 7 OKI1 Samples -}; - -STD_ROM_PICK(grdnstrm) -STD_ROM_FN(grdnstrm) - -static INT32 GrdnstrmLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; - - GrdnstrmGfxDecode(0x10000, 0x400000, 0x200000); - - return 0; -} - -static INT32 GrdnstrmInit() -{ - screen_flip_y = 1; - - return AfegaInit(GrdnstrmLoadCallback, pAfegaZ80Callback, 1); -} - -struct BurnDriver BurnDrvGrdnstrm = { - "grdnstrm", NULL, NULL, NULL, "1998", - "Guardian Storm\0", NULL, "Afega (Apples Industries license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, grdnstrmRomInfo, grdnstrmRomName, NULL, NULL, CommonInputInfo, GrdnstrmDIPInfo, - GrdnstrmInit, AfegaExit, AfegaFrame, FirehawkDraw, NULL, NULL, 0x300, - 256, 224, 4, 3 -}; - - -// Sen Jin - Guardian Storm (Korea) - -static struct BurnRomInfo grdnstrmkRomDesc[] = { - { "gst-04.u112", 0x040000, 0x922c931a, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "gst-05.u107", 0x040000, 0xd22ca2dc, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "afega7.u92", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "gst-03.u4", 0x010000, 0xa1347297, 3 | BRF_GRA }, // 3 Characters - - { "afega_af1-b2.uc8", 0x200000, 0xd68588c2, 4 | BRF_GRA }, // 4 Tiles - { "afega_af1-b1.uc3", 0x200000, 0xf8b200a8, 4 | BRF_GRA }, // 5 - - { "afega_af1-sp.uc13", 0x200000, 0x7d4d4985, 5 | BRF_GRA }, // 6 Sprites - - { "afega1.u95", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 7 OKI1 Samples -}; - -STD_ROM_PICK(grdnstrmk) -STD_ROM_FN(grdnstrmk) - -static INT32 GrdnstrmkInit() -{ - INT32 nRet = AfegaInit(GrdnstrmLoadCallback, pAfegaZ80Callback, 1); - - if (nRet == 0) { - decryptcode(0x80000, 16,17,14,15,13); - } - - return nRet; -} - -struct BurnDriver BurnDrvGrdnstrmk = { - "grdnstrmk", "grdnstrm", NULL, NULL, "1998", - "Sen Jin - Guardian Storm (Korea)\0", NULL, "Afega", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, grdnstrmkRomInfo, grdnstrmkRomName, NULL, NULL, CommonInputInfo, GrdnstrkDIPInfo, - GrdnstrmkInit, AfegaExit, AfegaFrame, AfegaDraw, NULL, NULL, 0x300, - 224, 256, 3, 4 -}; - - -// Red Fox War Planes II (China) - -static struct BurnRomInfo redfoxwp2RomDesc[] = { - { "u112", 0x040000, 0x3f31600b, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "u107", 0x040000, 0xdaa44ab4, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "u92", 0x010000, 0x864b55c2, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "u4", 0x010000, 0x19239401, 3 | BRF_GRA }, // 3 Characters - - { "afega_af1-b2.uc8", 0x200000, 0xd68588c2, 4 | BRF_GRA }, // 4 Tiles - { "afega_af1-b1.uc3", 0x200000, 0xf8b200a8, 4 | BRF_GRA }, // 5 - - { "afega_af1-sp.uc13", 0x200000, 0x7d4d4985, 5 | BRF_GRA }, // 6 Sprites - - { "afega1.u95", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 7 OKI1 Samples -}; - -STD_ROM_PICK(redfoxwp2) -STD_ROM_FN(redfoxwp2) - -struct BurnDriver BurnDrvRedfoxwp2 = { - "redfoxwp2", "grdnstrm", NULL, NULL, "1998", - "Red Fox War Planes II (China)\0", NULL, "Afega", "NMK16", - L"\u7D05\u5B64\u6230\u6A5FII\0Red Fox War Planes II (China)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, redfoxwp2RomInfo, redfoxwp2RomName, NULL, NULL, CommonInputInfo, GrdnstrkDIPInfo, - GrdnstrmkInit, AfegaExit, AfegaFrame, AfegaDraw, NULL, NULL, 0x300, - 224, 256, 3, 4 -}; - - -// Pop's Pop's - -static struct BurnRomInfo popspopsRomDesc[] = { - { "afega4.u112", 0x040000, 0xdb191762, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "afega5.u107", 0x040000, 0x17e0c48b, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "afega1.u92", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "afega3.u4", 0x010000, 0xf39dd5d2, 3 | BRF_GRA }, // 3 Characters - - { "afega6.uc8", 0x200000, 0x6d506c97, 4 | BRF_GRA }, // 4 Tiles - { "afega7.uc3", 0x200000, 0x02d7f9de, 4 | BRF_GRA }, // 5 - - { "afega2.u95", 0x040000, 0xecd8eeac, 6 | BRF_SND }, // 6 OKI1 Samples -}; - -STD_ROM_PICK(popspops) -STD_ROM_FN(popspops) - -static INT32 PopspopsLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 5, 1)) return 1; - - memset (DrvGfxROM2, 0xff, 0x80); - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 6, 1)) return 1; - - GrdnstrmGfxDecode(0x10000, 0x400000, 0x80); - - return 0; -} - -static INT32 PopspopsInit() -{ - INT32 nRet = AfegaInit(PopspopsLoadCallback, pAfegaZ80Callback, 1); - - if (nRet == 0) { - decryptcode(0x80000, 16,17,14,15,13); - } - - return nRet; -} - -struct BurnDriver BurnDrvPopspops = { - "popspops", NULL, NULL, NULL, "1999", - "Pop's Pop's\0", NULL, "Afega", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, popspopsRomInfo, popspopsRomName, NULL, NULL, CommonInputInfo, PopspopsDIPInfo, - PopspopsInit, AfegaExit, AfegaFrame, Bubl2000Draw, NULL, NULL, 0x300, - 256, 224, 4, 3 -}; - - -// Bubble 2000 - -static struct BurnRomInfo bubl2000RomDesc[] = { - { "rom10.112", 0x020000, 0x87f960d7, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "rom11.107", 0x020000, 0xb386041a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "rom01.92", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "rom03.4", 0x010000, 0xf4c15588, 3 | BRF_GRA }, // 3 Characters - - { "rom06.6", 0x080000, 0xac1aabf5, 4 | BRF_GRA }, // 4 Tiles - { "rom07.9", 0x080000, 0x69aff769, 4 | BRF_GRA }, // 5 - { "rom13.7", 0x080000, 0x3a5b7226, 4 | BRF_GRA }, // 6 - { "rom04.1", 0x080000, 0x46acd054, 4 | BRF_GRA }, // 7 - { "rom05.3", 0x080000, 0x37deb6a1, 4 | BRF_GRA }, // 8 - { "rom12.2", 0x080000, 0x1fdc59dd, 4 | BRF_GRA }, // 9 - - { "rom08.11", 0x040000, 0x519dfd82, 5 | BRF_GRA }, // 10 Sprites - { "rom09.14", 0x040000, 0x04fcb5c6, 5 | BRF_GRA }, // 11 - - { "rom02.95", 0x040000, 0x859a86e5, 6 | BRF_SND }, // 12 OKI1 Samples -}; - -STD_ROM_PICK(bubl2000) -STD_ROM_FN(bubl2000) - -static INT32 Bubl2000LoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x280000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x300000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 11, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 12, 1)) return 1; - - GrdnstrmGfxDecode(0x10000, 0x400000, 0x80000); - - return 0; -} - -static INT32 Bubl2000Init() -{ - INT32 nRet = AfegaInit(Bubl2000LoadCallback, pAfegaZ80Callback, 1); - - if (nRet == 0) { - decryptcode(0x40000, 13,14,15,16,17); - } - - return nRet; -} - -struct BurnDriver BurnDrvBubl2000 = { - "bubl2000", NULL, NULL, NULL, "1998", - "Bubble 2000\0", NULL, "Tuning", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, bubl2000RomInfo, bubl2000RomName, NULL, NULL, CommonInputInfo, Bubl2000DIPInfo, - Bubl2000Init, AfegaExit, AfegaFrame, Bubl2000Draw, NULL, NULL, 0x300, - 256, 224, 4, 3 -}; - - -// Hot Bubble - -static struct BurnRomInfo hotbublRomDesc[] = { - { "c2.uc9", 0x040000, 0x7917b95d, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "c1.uc1", 0x040000, 0x7bb240e9, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "s1.uc14", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "t1.uc2", 0x010000, 0xce683a93, 3 | BRF_GRA }, // 3 Characters - - { "cr5.uc15", 0x080000, 0x65bd5159, 4 | BRF_GRA }, // 4 Tiles - { "cr7.uc19", 0x080000, 0xa89d9ce4, 4 | BRF_GRA }, // 5 - { "cr6.uc16", 0x080000, 0x99d6523c, 4 | BRF_GRA }, // 6 - { "cr1.uc6", 0x080000, 0xfc9101d2, 4 | BRF_GRA }, // 7 - { "cr3.uc12", 0x080000, 0xc841a4f6, 4 | BRF_GRA }, // 8 - { "cr2.uc7", 0x080000, 0x27ad6fc8, 4 | BRF_GRA }, // 9 - - { "br1.uc3", 0x080000, 0x6fc18de4, 5 | BRF_GRA }, // 10 Sprites - { "br3.uc10", 0x080000, 0xbb677240, 5 | BRF_GRA }, // 11 - - { "s2.uc18", 0x040000, 0x401c980f, 6 | BRF_SND }, // 12 OKI1 Samples -}; - -STD_ROM_PICK(hotbubl) -STD_ROM_FN(hotbubl) - -struct BurnDriver BurnDrvHotbubl = { - "hotbubl", "bubl2000", NULL, NULL, "1998", - "Hot Bubble\0", NULL, "Pandora", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, hotbublRomInfo, hotbublRomName, NULL, NULL, CommonInputInfo, Bubl2000DIPInfo, - Bubl2000Init, AfegaExit, AfegaFrame, Bubl2000Draw, NULL, NULL, 0x300, - 256, 224, 4, 3 -}; - - -// Mang-Chi - -static struct BurnRomInfo mangchiRomDesc[] = { - { "afega9.u112", 0x040000, 0x0b1517a5, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "afega10.u107", 0x040000, 0xb1d0f33d, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "sound.u92", 0x010000, 0xbec4f9aa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "afega5.uc6", 0x080000, 0xc73261e0, 4 | BRF_GRA }, // 3 Tiles - { "afega4.uc1", 0x080000, 0x73940917, 4 | BRF_GRA }, // 4 - - { "afega6.uc11", 0x040000, 0x979efc30, 5 | BRF_GRA }, // 5 Sprites - { "afega7.uc14", 0x040000, 0xc5cbcc38, 5 | BRF_GRA }, // 6 - - { "afega2.u95", 0x040000, 0x78c8c1f9, 6 | BRF_SND }, // 7 OKI1 Samples -}; - -STD_ROM_PICK(mangchi) -STD_ROM_FN(mangchi) - -static INT32 MangchiLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - memset (DrvGfxROM0, 0xff, 0x20); - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 6, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; - - GrdnstrmGfxDecode(0x20, 0x100000, 0x80000); - - return 0; -} - -static INT32 MangchiInit() -{ - INT32 nRet = AfegaInit(MangchiLoadCallback, pAfegaZ80Callback, 1); - - if (nRet == 0) { - decryptcode(0x80000, 13,14,15,16,17); - } - - return nRet; -} - -struct BurnDriver BurnDrvMangchi = { - "mangchi", NULL, NULL, NULL, "2000", - "Mang-Chi\0", NULL, "Afega", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, mangchiRomInfo, mangchiRomName, NULL, NULL, CommonInputInfo, MangchiDIPInfo, - MangchiInit, AfegaExit, AfegaFrame, Bubl2000Draw, NULL, NULL, 0x300, - 256, 224, 4, 3 -}; - - -// Fire Hawk - -static struct BurnRomInfo firehawkRomDesc[] = { - { "fhawk_p1.u59", 0x080000, 0xd6d71a50, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "fhawk_p2.u60", 0x080000, 0x9f35d245, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "fhawk_s1.u40", 0x020000, 0xc6609c39, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "fhawk_g1.uc6", 0x200000, 0x2ab0b06b, 4 | BRF_GRA }, // 3 Tiles - { "fhawk_g2.uc5", 0x200000, 0xd11bfa20, 4 | BRF_GRA }, // 4 - - { "fhawk_g3.uc2", 0x200000, 0xcae72ff4, 5 | BRF_GRA }, // 5 Sprites - - { "fhawk_s2.u36", 0x040000, 0xd16aaaad, 6 | BRF_SND }, // 6 OKI1 Samples - - { "fhawk_s3.u41", 0x040000, 0x3fdcfac2, 7 | BRF_SND }, // 7 OKI2 Samples -}; - -STD_ROM_PICK(firehawk) -STD_ROM_FN(firehawk) - -static void pFirehawkZ80Callback() -{ - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); - ZetMapArea(0xf000, 0xfeff, 0, DrvZ80RAM); - ZetMapArea(0xf000, 0xfeff, 1, DrvZ80RAM); - ZetMapArea(0xf000, 0xfeff, 2, DrvZ80RAM); - - ZetSetWriteHandler(firehawk_sound_write); - ZetSetReadHandler(firehawk_sound_read); - ZetMemEnd(); - ZetClose(); -} - -static INT32 FirehawkLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000000, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000001, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - memset (DrvGfxROM0, 0xff, 0x20); - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 6, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x040000, 7, 1)) return 1; - - GrdnstrmGfxDecode(0x20, 0x400000, 0x200000); - - return 0; -} - -static INT32 FirehawkInit() -{ - screen_flip_y = 1; - - return AfegaInit(FirehawkLoadCallback, pFirehawkZ80Callback, 1); -} - -struct BurnDriver BurnDrvFirehawk = { - "firehawk", NULL, NULL, NULL, "2001", - "Fire Hawk\0", NULL, "ESD", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, firehawkRomInfo, firehawkRomName, NULL, NULL, CommonInputInfo, FirehawkDIPInfo, - FirehawkInit, AfegaExit, AfegaFrame, FirehawkDraw, NULL, NULL, 0x300, - 256, 224, 4, 3 -}; - - -// Spectrum 2000 (Euro) - -static struct BurnRomInfo spec2kRomDesc[] = { - { "yonatech5.u124", 0x040000, 0x72ab5c05, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "yonatech6.u120", 0x040000, 0x7e44bd9c, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "yonatech1.u103", 0x010000, 0xef5acda7, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "yonatech4.u3", 0x020000, 0x5626b08e, 3 | BRF_GRA }, // 3 Characters - - { "u153.bin", 0x200000, 0xa00bbf8f, 4 | BRF_GRA }, // 4 Tiles - { "u152.bin", 0x200000, 0xf6423fab, 4 | BRF_GRA }, // 5 - - { "u154.bin", 0x200000, 0xf77b764e, 5 | BRF_GRA }, // 6 Sprites - - { "yonatech2.u101", 0x020000, 0x4160f172, 6 | BRF_SND }, // 7 OKI1 Samples - - { "yonatech3.u106", 0x080000, 0x6644c404, 7 | BRF_SND }, // 8 OKI2 Samples -}; - -STD_ROM_PICK(spec2k) -STD_ROM_FN(spec2k) - -static INT32 Spec2kLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x040000, 8, 1)) return 1; - - GrdnstrmGfxDecode(0x20000, 0x400000, 0x200000); - - return 0; -} - -static INT32 Spec2kInit() -{ - screen_flip_y = 1; - - INT32 nRet = AfegaInit(Spec2kLoadCallback, pFirehawkZ80Callback, 1); - - if (nRet == 0) { - decryptcode(0x80000, 17,13,14,15,16); - } - - return nRet; -} - -struct BurnDriver BurnDrvSpec2k = { - "spec2k", NULL, NULL, NULL, "2000", - "Spectrum 2000 (Euro)\0", NULL, "YONA Tech", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, spec2kRomInfo, spec2kRomName, NULL, NULL, CommonInputInfo, Spec2kDIPInfo, - Spec2kInit, AfegaExit, AfegaFrame, FirehawkDraw, NULL, NULL, 0x300, - 256, 224, 4, 3 -}; - - -// Twin Action - -static struct BurnRomInfo twinactnRomDesc[] = { - { "afega.uj13", 0x020000, 0x9187701d, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "afega.uj12", 0x020000, 0xfe8cff9c, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "afega.su6", 0x008000, 0x3a52dc88, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "afega.uj11", 0x020000, 0x3f439e92, 3 | BRF_GRA }, // 3 Characters - - { "afega.ui20", 0x080000, 0x237c8f92, 4 | BRF_GRA }, // 4 Tiles - - { "afega.ub11", 0x080000, 0x287f20d8, 5 | BRF_GRA }, // 5 Sprites - { "afega.ub13", 0x080000, 0xf525f819, 5 | BRF_GRA }, // 6 - - { "afega.su12", 0x020000, 0x91d665f3, 6 | BRF_SND }, // 7 OKI1 Samples - { "afega.su13", 0x040000, 0x30e1c306, 6 | BRF_SND }, // 8 -}; - -STD_ROM_PICK(twinactn) -STD_ROM_FN(twinactn) - -static INT32 TwinactnLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 6, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; - memcpy (DrvSndROM0 + 0x40000, DrvSndROM0 + 0x00000, 0x20000); - memcpy (DrvSndROM0 + 0x60000, DrvSndROM0 + 0x00000, 0x20000); - if (BurnLoadRom(DrvSndROM0 + 0x080000, 8, 1)) return 1; - - DrvGfxDecode(0x20000, 0x80000, 0x100000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); - SekSetWriteWordHandler(0, afega_main_write_word); - SekSetWriteByteHandler(0, afega_main_write_byte); - SekSetReadWordHandler(0, afega_main_read_word); - SekSetReadByteHandler(0, afega_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 TwinactnInit() -{ - input_high[0] = 0x0000; - input_high[1] = 0x8080; - nNMK004EnableIrq2 = 1; - - return MSM6295x1Init(TwinactnLoadCallback); -} - -struct BurnDriver BurnDrvTwinactn = { - "twinactn", NULL, NULL, NULL, "1995", - "Twin Action\0", NULL, "Afega", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, twinactnRomInfo, twinactnRomName, NULL, NULL, CommonInputInfo, TwinactnDIPInfo, - TwinactnInit, MSM6295x1Exit, SsmissinFrame, MacrossDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Saboten Bombers (set 1) - -static struct BurnRomInfo sabotenbRomDesc[] = { - { "ic76.sb1", 0x040000, 0xb2b0b2cf, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "ic75.sb2", 0x040000, 0x367e87b7, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "ic35.sb3", 0x010000, 0xeb7bc99d, 3 | BRF_GRA }, // 2 Characters - - { "ic32.sb4", 0x200000, 0x24c62205, 4 | BRF_GRA }, // 3 Tiles - - { "ic100.sb5", 0x200000, 0xb20f166e, 5 | BRF_GRA }, // 4 Sprites - - { "ic30.sb6", 0x100000, 0x288407af, 6 | BRF_SND }, // 5 OKI1 Samples - - { "ic27.sb7", 0x100000, 0x43e33a7e, 7 | BRF_SND }, // 6 OKI2 Samples -}; - -STD_ROM_PICK(sabotenb) -STD_ROM_FN(sabotenb) - -static INT32 SabotenbLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; - BurnByteswap(DrvGfxROM2, 0x200000); - - if (BurnLoadRom(DrvSndROM0 + 0x040000, 5, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x040000, 6, 1)) return 1; - - decode_gfx(0x200000, 0x200000); - - BjtwinGfxDecode(0x10000, 0x200000, 0x200000); - - return 0; -} - -static INT32 SabotenbInit() -{ - return BjtwinInit(SabotenbLoadCallback); -} - -struct BurnDriver BurnDrvSabotenb = { - "sabotenb", NULL, NULL, NULL, "1992", - "Saboten Bombers (set 1)\0", NULL, "NMK / Tecmo", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, sabotenbRomInfo, sabotenbRomName, NULL, NULL, CommonInputInfo, SabotenbDIPInfo, - SabotenbInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, - 384, 224, 4, 3 -}; - - -// Saboten Bombers (set 2) - -static struct BurnRomInfo sabotenbaRomDesc[] = { - { "sb1.76", 0x040000, 0xdf6f65e2, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "sb2.75", 0x040000, 0x0d2c1ab8, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "ic35.sb3", 0x010000, 0xeb7bc99d, 3 | BRF_GRA }, // 2 Characters - - { "ic32.sb4", 0x200000, 0x24c62205, 4 | BRF_GRA }, // 3 Tiles - - { "ic100.sb5", 0x200000, 0xb20f166e, 5 | BRF_GRA }, // 4 Sprites - - { "ic30.sb6", 0x100000, 0x288407af, 6 | BRF_SND }, // 5 OKI1 Samples - - { "ic27.sb7", 0x100000, 0x43e33a7e, 7 | BRF_SND }, // 6 OKI2 Samples -}; - -STD_ROM_PICK(sabotenba) -STD_ROM_FN(sabotenba) - -struct BurnDriver BurnDrvSabotenba = { - "sabotenba", "sabotenb", NULL, NULL, "1992", - "Saboten Bombers (set 2)\0", NULL, "NMK / Tecmo", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, sabotenbaRomInfo, sabotenbaRomName, NULL, NULL, CommonInputInfo, SabotenbDIPInfo, - SabotenbInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, - 384, 224, 4, 3 -}; - - -// Cactus (bootleg of Saboten Bombers) - -static struct BurnRomInfo cactusRomDesc[] = { - { "02.bin", 0x040000, 0x15b2ff2f, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "01.bin", 0x040000, 0x5b8ba46a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "i03.bin", 0x010000, 0xeb7bc99d, 3 | BRF_GRA }, // 2 Characters - - { "s-05.bin", 0x100000, 0xfce962b9, 4 | BRF_GRA }, // 3 Tiles - { "s-06.bin", 0x100000, 0x16768fbc, 4 | BRF_GRA }, // 4 - - { "s-03.bin", 0x100000, 0xbc1781b8, 5 | BRF_GRA }, // 5 Sprites - { "s-04.bin", 0x100000, 0xf823885e, 5 | BRF_GRA }, // 6 - - { "s-01.bin", 0x100000, 0x288407af, 6 | BRF_SND }, // 7 OKI1 Samples - - { "s-02.bin", 0x100000, 0x43e33a7e, 7 | BRF_SND }, // 8 OKI2 Samples -}; - -STD_ROM_PICK(cactus) -STD_ROM_FN(cactus) - -static INT32 CactusLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x040000, 7, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x040000, 8, 1)) return 1; - - decode_gfx(0x200000, 0x200000); - - BjtwinGfxDecode(0x10000, 0x200000, 0x200000); - - return 0; -} - -static INT32 CactusInit() -{ - return BjtwinInit(CactusLoadCallback); -} - -struct BurnDriver BurnDrvCactus = { - "cactus", "sabotenb", NULL, NULL, "1992", - "Cactus (bootleg of Saboten Bombers)\0", NULL, "bootleg", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, cactusRomInfo, cactusRomName, NULL, NULL, CommonInputInfo, SabotenbDIPInfo, - CactusInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, - 384, 224, 4, 3 -}; - - -// Bombjack Twin (set 1) - -static struct BurnRomInfo bjtwinRomDesc[] = { - { "93087-1.bin", 0x020000, 0x93c84e2d, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "93087-2.bin", 0x020000, 0x30ff678a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "93087-3.bin", 0x010000, 0xaa13df7c, 3 | BRF_GRA }, // 2 Characters - - { "93087-4.bin", 0x100000, 0x8a4f26d0, 4 | BRF_GRA }, // 3 Tiles - - { "93087-5.bin", 0x100000, 0xbb06245d, 5 | BRF_GRA }, // 4 Sprites - - { "93087-6.bin", 0x100000, 0x372d46dd, 6 | BRF_SND }, // 5 OKI1 Samples - - { "93087-7.bin", 0x100000, 0x8da67808, 7 | BRF_SND }, // 6 OKI2 Samples - - { "8.bpr", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 7 Unused proms - { "9.bpr", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 -}; - -STD_ROM_PICK(bjtwin) -STD_ROM_FN(bjtwin) - -static INT32 BjtwinLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; - BurnByteswap(DrvGfxROM2, 0x100000); - - if (BurnLoadRom(DrvSndROM0 + 0x040000, 5, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x040000, 6, 1)) return 1; - - decode_gfx(0x100000, 0x100000); - - BjtwinGfxDecode(0x10000, 0x100000, 0x100000); - - return 0; -} - -static INT32 BjtwinGameInit() -{ - return BjtwinInit(BjtwinLoadCallback); -} - -struct BurnDriver BurnDrvBjtwin = { - "bjtwin", NULL, NULL, NULL, "1993", - "Bombjack Twin (set 1)\0", NULL, "NMK", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, bjtwinRomInfo, bjtwinRomName, NULL, NULL, CommonInputInfo, BjtwinDIPInfo, - BjtwinGameInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, - 224, 384, 3, 4 -}; - - -// Bombjack Twin (set 2) - -static struct BurnRomInfo bjtwinaRomDesc[] = { - { "93087.1", 0x020000, 0xc82b3d8e, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "93087.2", 0x020000, 0x9be1ec47, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "93087-3.bin", 0x010000, 0xaa13df7c, 3 | BRF_GRA }, // 2 Characters - - { "93087-4.bin", 0x100000, 0x8a4f26d0, 4 | BRF_GRA }, // 3 Tiles - - { "93087-5.bin", 0x100000, 0xbb06245d, 5 | BRF_GRA }, // 4 Sprites - - { "93087-6.bin", 0x100000, 0x372d46dd, 6 | BRF_SND }, // 5 OKI1 Samples - - { "93087-7.bin", 0x100000, 0x8da67808, 7 | BRF_SND }, // 6 OKI2 Samples - - { "8.bpr", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 7 Unused proms - { "9.bpr", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 -}; - -STD_ROM_PICK(bjtwina) -STD_ROM_FN(bjtwina) - -struct BurnDriver BurnDrvBjtwina = { - "bjtwina", "bjtwin", NULL, NULL, "1993", - "Bombjack Twin (set 2)\0", NULL, "NMK", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, bjtwinaRomInfo, bjtwinaRomName, NULL, NULL, CommonInputInfo, BjtwinDIPInfo, - BjtwinGameInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, - 224, 384, 3, 4 -}; - - -// Nouryoku Koujou Iinkai - -static struct BurnRomInfo nouryokuRomDesc[] = { - { "ic76.1", 0x040000, 0x26075988, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "ic75.2", 0x040000, 0x75ab82cd, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "ic35.3", 0x010000, 0x03d0c3b1, 3 | BRF_GRA }, // 2 Characters - - { "ic32.4", 0x200000, 0x88d454fd, 4 | BRF_GRA }, // 3 Tiles - - { "ic100.5", 0x200000, 0x24d3e24e, 5 | BRF_GRA }, // 4 Sprites - - { "ic30.6", 0x100000, 0xfeea34f4, 6 | BRF_SND }, // 5 OKI1 Samples - - { "ic27.7", 0x100000, 0x8a69fded, 7 | BRF_SND }, // 6 OKI2 Samples -}; - -STD_ROM_PICK(nouryoku) -STD_ROM_FN(nouryoku) - -static INT32 NouryokuLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; - BurnByteswap(DrvGfxROM2, 0x200000); - - if (BurnLoadRom(DrvSndROM0 + 0x040000, 5, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x040000, 6, 1)) return 1; - - decode_gfx(0x200000, 0x200000); - - BjtwinGfxDecode(0x10000, 0x200000, 0x200000); - - return 0; -} - -static INT32 NouryokuGameInit() -{ - return BjtwinInit(NouryokuLoadCallback); -} - -struct BurnDriver BurnDrvNouryoku = { - "nouryoku", NULL, NULL, NULL, "1995", - "Nouryoku Koujou Iinkai\0", NULL, "Tecmo", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, - NULL, nouryokuRomInfo, nouryokuRomName, NULL, NULL, CommonInputInfo, NouryokuDIPInfo, - NouryokuGameInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, - 384, 224, 4, 3 -}; - - -// US AAF Mustang (25th May. 1990) - -static struct BurnRomInfo mustangRomDesc[] = { - { "2.bin", 0x020000, 0xbd9f7c89, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "3.bin", 0x020000, 0x0eec36a5, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "90058-7", 0x010000, 0x920a93c8, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "90058-1", 0x020000, 0x81ccfcad, 3 | BRF_GRA }, // 3 Characters - - { "90058-4", 0x080000, 0xa07a2002, 4 | BRF_GRA }, // 4 Tiles - - { "90058-8", 0x080000, 0x560bff04, 5 | BRF_GRA }, // 5 Sprites - { "90058-9", 0x080000, 0xb9d72a03, 5 | BRF_GRA }, // 6 - - { "90058-5", 0x080000, 0xc60c883e, 6 | BRF_SND }, // 7 OKI1 Samples - - { "90058-6", 0x080000, 0x233c1776, 7 | BRF_SND }, // 8 OKI2 Samples - - { "10.bpr", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 9 Unused proms - { "90058-11", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 -}; - -STD_ROM_PICK(mustang) -STD_ROM_FN(mustang) - -static INT32 MustangLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x00001, 6, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x20000, 7, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM1 + 0x20000, 8, 1)) return 1; - memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); - - DrvGfxDecode(0x20000, 0x80000, 0x100000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); - SekSetWriteWordHandler(0, mustang_main_write_word); - SekSetWriteByteHandler(0, mustang_main_write_byte); - SekSetReadWordHandler(0, mustang_main_read_word); - SekSetReadByteHandler(0, mustang_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 MustangInit() -{ - return NMK004Init(MustangLoadCallback, 10000000, 0, 1); -} - -struct BurnDriver BurnDrvMustang = { - "mustang", NULL, NULL, NULL, "1990", - "US AAF Mustang (25th May. 1990)\0", NULL, "UPL", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, mustangRomInfo, mustangRomName, NULL, NULL, CommonInputInfo, MustangDIPInfo, - MustangInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// US AAF Mustang (25th May. 1990 / Seoul Trading) - -static struct BurnRomInfo mustangsRomDesc[] = { - { "90058-2", 0x020000, 0x833aa458, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "90058-3", 0x020000, 0xe4b80f06, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "90058-7", 0x010000, 0x920a93c8, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "90058-1", 0x020000, 0x81ccfcad, 3 | BRF_GRA }, // 3 Characters - - { "90058-4", 0x080000, 0xa07a2002, 4 | BRF_GRA }, // 4 Tiles - - { "90058-8", 0x080000, 0x560bff04, 5 | BRF_GRA }, // 5 Sprites - { "90058-9", 0x080000, 0xb9d72a03, 5 | BRF_GRA }, // 6 - - { "90058-5", 0x080000, 0xc60c883e, 6 | BRF_SND }, // 7 OKI1 Samples - - { "90058-6", 0x080000, 0x233c1776, 7 | BRF_SND }, // 8 OKI2 Samples - - { "90058-10", 0x000100, 0xde156d99, 0 | BRF_OPT }, // 9 Unused proms - { "90058-11", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 -}; - -STD_ROM_PICK(mustangs) -STD_ROM_FN(mustangs) - -struct BurnDriver BurnDrvMustangs = { - "mustangs", "mustang", NULL, NULL, "1990", - "US AAF Mustang (25th May. 1990 / Seoul Trading)\0", NULL, "UPL (Seoul Trading license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, mustangsRomInfo, mustangsRomName, NULL, NULL, CommonInputInfo, MustangDIPInfo, - MustangInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// US AAF Mustang (bootleg) - -static struct BurnRomInfo mustangbRomDesc[] = { - { "mustang.14", 0x020000, 0x13c6363b, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "mustang.13", 0x020000, 0xd8ccce31, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "mustang.16", 0x010000, 0x99ee7505, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "90058-1", 0x020000, 0x81ccfcad, 3 | BRF_GRA }, // 3 Characters - - { "90058-4", 0x080000, 0xa07a2002, 4 | BRF_GRA }, // 4 Tiles - - { "90058-8", 0x080000, 0x560bff04, 5 | BRF_GRA }, // 5 Sprites - { "90058-9", 0x080000, 0xb9d72a03, 5 | BRF_GRA }, // 6 - - { "mustang.17", 0x010000, 0xf6f6c4bf, 6 | BRF_SND }, // 7 oki -}; - -STD_ROM_PICK(mustangb) -STD_ROM_FN(mustangb) - -static INT32 MustangbLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - memcpy (DrvZ80ROM + 0x10000, DrvZ80ROM + 0x8000, 0x8000); - memcpy (DrvZ80ROM + 0x18000, DrvZ80ROM + 0x0000, 0x8000); - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 6, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; - - DrvGfxDecode(0x20000, 0x80000, 0x100000); - - return 0; -} - -static INT32 MustangbInit() -{ - return SeibuSoundInit(MustangbLoadCallback, 1); -} - -struct BurnDriver BurnDrvMustangb = { - "mustangb", "mustang", NULL, NULL, "1990", - "US AAF Mustang (bootleg)\0", "No sound", "bootleg", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, mustangbRomInfo, mustangbRomName, NULL, NULL, CommonInputInfo, MustangDIPInfo, - MustangbInit, SeibuSoundExit, SeibuSoundFrame, MacrossDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// US AAF Mustang (TAB Austria bootleg) - -static struct BurnRomInfo mustangb2RomDesc[] = { - { "05.bin", 0x020000, 0x13c6363b, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "04.bin", 0x020000, 0x0d06f723, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "01.bin", 0x010000, 0x90820499, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "06.bin", 0x020000, 0x81ccfcad, 3 | BRF_GRA }, // 3 Characters - - { "07.bin", 0x020000, 0x5f8fdfb1, 4 | BRF_GRA }, // 4 Tiles - { "10.bin", 0x020000, 0x39757d6a, 4 | BRF_GRA }, // 5 - { "08.bin", 0x020000, 0xb3dd5243, 4 | BRF_GRA }, // 6 - { "09.bin", 0x020000, 0xc6c9752f, 4 | BRF_GRA }, // 7 - - { "18.bin", 0x020000, 0xd13f0722, 5 | BRF_GRA }, // 8 Sprites - { "13.bin", 0x020000, 0x54773f95, 5 | BRF_GRA }, // 9 - { "17.bin", 0x020000, 0x87c1fb43, 5 | BRF_GRA }, // 10 - { "14.bin", 0x020000, 0x932d3e33, 5 | BRF_GRA }, // 11 - { "16.bin", 0x020000, 0x23d03ad5, 5 | BRF_GRA }, // 12 - { "15.bin", 0x020000, 0xa62b2f87, 5 | BRF_GRA }, // 13 - { "12.bin", 0x020000, 0x42a6cfc2, 5 | BRF_GRA }, // 14 - { "11.bin", 0x020000, 0x9d3bee66, 5 | BRF_GRA }, // 15 - - { "02.bin", 0x010000, 0xf6f6c4bf, 6 | BRF_SND }, // 16 oki -}; - -STD_ROM_PICK(mustangb2) -STD_ROM_FN(mustangb2) - -static INT32 Mustangb2LoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - memcpy (DrvZ80ROM + 0x10000, DrvZ80ROM + 0x8000, 0x8000); - memcpy (DrvZ80ROM + 0x18000, DrvZ80ROM + 0x8000, 0x8000); - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x060000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x040000, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x040001, 11, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x080000, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x080001, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x0c0000, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x0c0001, 15, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 16, 1)) return 1; - - DrvGfxDecode(0x20000, 0x80000, 0x100000); - - return 0; -} - -static INT32 Mustangb2Init() -{ - return SeibuSoundInit(Mustangb2LoadCallback, 1); -} - -struct BurnDriver BurnDrvMustangb2 = { - "mustangb2", "mustang", NULL, NULL, "1990", - "US AAF Mustang (TAB Austria bootleg)\0", "No sound", "bootleg", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, mustangb2RomInfo, mustangb2RomName, NULL, NULL, CommonInputInfo, MustangDIPInfo, - Mustangb2Init, SeibuSoundExit, SeibuSoundFrame, MacrossDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Thunder Dragon (9th Jan. 1992) - -static struct BurnRomInfo tdragonRomDesc[] = { - { "91070_68k.8", 0x020000, 0x121c3ae7, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "91070_68k.7", 0x020000, 0x6e154d8e, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "91070.1", 0x010000, 0xbf493d74, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "91070.6", 0x020000, 0xfe365920, 3 | BRF_GRA }, // 3 Characters - - { "91070.5", 0x100000, 0xd0bde826, 4 | BRF_GRA }, // 4 Tiles - - { "91070.4", 0x100000, 0x3eedc2fe, 5 | BRF_GRA }, // 5 Sprites - - { "91070.3", 0x080000, 0xae6875a8, 6 | BRF_SND }, // 6 OKI1 Samples - - { "91070.2", 0x080000, 0xecfea43e, 7 | BRF_SND }, // 7 OKI2 Samples - - { "91070.9", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 8 Unused proms - { "91070.10", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 -}; - -STD_ROM_PICK(tdragon) -STD_ROM_FN(tdragon) - -static INT32 TdragonLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 5, 1)) return 1; - BurnByteswap(DrvGfxROM2, 0x100000); - - if (BurnLoadRom(DrvSndROM0 + 0x20000, 6, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM1 + 0x20000, 7, 1)) return 1; - memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); - - DrvGfxDecode(0x20000, 0x100000, 0x100000); - } - - { - *((UINT16*)(Drv68KROM + 0x048a)) = BURN_ENDIAN_SWAP_INT16(0x4e71); - *((UINT16*)(Drv68KROM + 0x04aa)) = BURN_ENDIAN_SWAP_INT16(0x4e71); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x0b0000, 0x0bffff, SM_ROM); - SekMapMemory(DrvScrollRAM, 0x0c4000, 0x0c43ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x0c8000, 0x0c87ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x0cc000, 0x0cffff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x0d0000, 0x0d07ff, SM_RAM); - SekSetWriteWordHandler(0, tdragon_main_write_word); - SekSetWriteByteHandler(0, tdragon_main_write_byte); - SekSetReadWordHandler(0, tdragon_main_read_word); - SekSetReadByteHandler(0, tdragon_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 TdragonInit() -{ - return NMK004Init(TdragonLoadCallback, 8000000, 0, 1); -} - -struct BurnDriver BurnDrvTdragon = { - "tdragon", NULL, NULL, NULL, "1991", - "Thunder Dragon (9th Jan. 1992)\0", "No sound", "NMK (Tecmo license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, tdragonRomInfo, tdragonRomName, NULL, NULL, CommonInputInfo, TdragonDIPInfo, - TdragonInit, NMK004Exit, NMK004Frame, HachamfDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - -// Thunder Dragon (4th Jun. 1991) - -static struct BurnRomInfo tdragon1RomDesc[] = { - { "thund.8", 0x020000, 0xedd02831, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "thund.7", 0x020000, 0x52192fe5, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "91070.1", 0x010000, 0xbf493d74, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "91070.6", 0x020000, 0xfe365920, 3 | BRF_GRA }, // 3 Characters - - { "91070.5", 0x100000, 0xd0bde826, 4 | BRF_GRA }, // 4 Tiles - - { "91070.4", 0x100000, 0x3eedc2fe, 5 | BRF_GRA }, // 5 Sprites - - { "91070.3", 0x080000, 0xae6875a8, 6 | BRF_SND }, // 6 OKI1 Samples - - { "91070.2", 0x080000, 0xecfea43e, 7 | BRF_SND }, // 7 OKI2 Samples - - { "91070.9", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 8 Unused proms - { "91070.10", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 -}; - -STD_ROM_PICK(tdragon1) -STD_ROM_FN(tdragon1) - -struct BurnDriver BurnDrvTdragon1 = { - "tdragon1", "tdragon", NULL, NULL, "1991", - "Thunder Dragon (4th Jun. 1991)\0", NULL, "NMK (Tecmo license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, tdragon1RomInfo, tdragon1RomName, NULL, NULL, CommonInputInfo, TdragonDIPInfo, - TdragonInit, NMK004Exit, NMK004Frame, HachamfDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - -// Thunder Dragon (bootleg) - -static struct BurnRomInfo tdragonbRomDesc[] = { - { "td_04.bin", 0x020000, 0xe8a62d3e, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "td_03.bin", 0x020000, 0x2fa1aa04, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "td_02.bin", 0x010000, 0x99ee7505, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code - - { "td_08.bin", 0x020000, 0x5144dc69, 3 | BRF_GRA }, // 3 Characters - - { "td_06.bin", 0x080000, 0xc1be8a4d, 4 | BRF_GRA }, // 4 Tiles - { "td_07.bin", 0x080000, 0x2c3e371f, 4 | BRF_GRA }, // 5 - - { "td_10.bin", 0x080000, 0xbfd0ec5d, 5 | BRF_GRA }, // 6 Sprites - { "td_09.bin", 0x080000, 0xb6e074eb, 5 | BRF_GRA }, // 7 - - { "td_01.bin", 0x010000, 0xf6f6c4bf, 6 | BRF_SND }, // 8 OKI1 Samples -}; - -STD_ROM_PICK(tdragonb) -STD_ROM_FN(tdragonb) - -static INT32 TdragonbLoadCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - memcpy (DrvZ80ROM + 0x10000, DrvZ80ROM + 0x8000, 0x8000); - memcpy (DrvZ80ROM + 0x18000, DrvZ80ROM + 0x0000, 0x8000); - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 7, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 8, 1)) return 1; - - decode_tdragonb(); - DrvGfxDecode(0x20000, 0x100000, 0x100000); - - *((UINT16 *)(Drv68KROM + 0x00308)) = BURN_ENDIAN_SWAP_INT16(0x4e71); // fix intro sprites - - return 0; -} - -static INT32 TdragonbInit() -{ - return SeibuSoundInit(TdragonbLoadCallback, 0); -} - -struct BurnDriver BurnDrvTdragonb = { - "tdragonb", "tdragon", NULL, NULL, "1991", - "Thunder Dragon (bootleg)\0", "No sound", "bootleg", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, tdragonbRomInfo, tdragonbRomName, NULL, NULL, CommonInputInfo, TdragonbDIPInfo, - TdragonbInit, SeibuSoundExit, SeibuSoundFrame, MacrossDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - - -// Acrobat Mission - -static struct BurnRomInfo acrobatmRomDesc[] = { - { "02_ic100.bin", 0x020000, 0x3fe487f4, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "01_ic101.bin", 0x020000, 0x17175753, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "04_ic74.bin", 0x010000, 0x176905fb, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "03_ic79.bin", 0x010000, 0xd86c186e, 3 | BRF_GRA }, // 3 Characters - - { "09_ic8.bin", 0x100000, 0x7c12afed, 4 | BRF_GRA }, // 4 Tiles - - { "07_ic42.bin", 0x100000, 0x5672bdaa, 5 | BRF_GRA }, // 5 Sprites - { "08_ic29.bin", 0x080000, 0xb4c0ace3, 5 | BRF_GRA }, // 6 - - { "05_ic54.bin", 0x080000, 0x3b8c2b0e, 6 | BRF_SND }, // 7 OKI1 Samples - - { "06_ic53.bin", 0x080000, 0xc1517cd4, 7 | BRF_SND }, // 8 OKI2 Samples - - { "10_ic81.bin", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 9 Unused proms - { "11_ic80.bin", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 10 -}; - -STD_ROM_PICK(acrobatm) -STD_ROM_FN(acrobatm) - -static INT32 AcrobatmLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x100000, 6, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x020000, 7, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM1 + 0x020000, 8, 1)) return 1; - memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); - - DrvGfxDecode(0x10000, 0x100000, 0x200000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x080000, 0x08ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x0c4000, 0x0c47ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x0c8000, 0x0c83ff, SM_WRITE); - SekMapMemory(DrvBgRAM0, 0x0cc000, 0x0cffff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x0d4000, 0x0d47ff, SM_RAM); - SekSetWriteWordHandler(0, acrobatm_main_write_word); - SekSetWriteByteHandler(0, acrobatm_main_write_byte); - SekSetReadWordHandler(0, acrobatm_main_read_word); - SekSetReadByteHandler(0, acrobatm_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 AcrobatmInit() -{ - return NMK004Init(AcrobatmLoadCallback, 10000000, 0, 1); -} - -struct BurnDriver BurnDrvAcrobatm = { - "acrobatm", NULL, NULL, NULL, "1991", - "Acrobat Mission\0", NULL, "UPL (Taito license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, acrobatmRomInfo, acrobatmRomName, NULL, NULL, AcrobatmInputInfo, AcrobatmDIPInfo, - AcrobatmInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x300, - 224, 256, 3, 4 -}; - - -// Super Spacefortress Macross / Chou-Jikuu Yousai Macross - -static struct BurnRomInfo macrossRomDesc[] = { - { "921a03", 0x080000, 0x33318d55, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - - { "921a02", 0x010000, 0x77c082c7, 2 | BRF_PRG | BRF_ESS }, // 1 NMK004 data - - { "921a01", 0x020000, 0xbbd8242d, 3 | BRF_GRA }, // 2 Characters - - { "921a04", 0x200000, 0x4002e4bb, 4 | BRF_GRA }, // 3 Tiles - - { "921a07", 0x200000, 0x7d2bf112, 5 | BRF_GRA }, // 4 Sprites - - { "921a05", 0x080000, 0xd5a1eddd, 6 | BRF_SND }, // 5 OKI1 Samples - - { "921a06", 0x080000, 0x89461d0f, 7 | BRF_SND }, // 6 OKI2 Samples - - { "921a08", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 7 Unused proms - { "921a09", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 8 - { "921a10", 0x000020, 0x8371e42d, 0 | BRF_OPT }, // 9 -}; - -STD_ROM_PICK(macross) -STD_ROM_FN(macross) - -static INT32 MacrossLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; - BurnByteswap(DrvGfxROM2, 0x200000); - - if (BurnLoadRom(DrvSndROM0 + 0x020000, 5, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM1 + 0x020000, 6, 1)) return 1; - memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); - - decode_gfx(0x200000, 0x200000); - DrvGfxDecode(0x20000, 0x200000, 0x200000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); - SekSetWriteWordHandler(0, macross_main_write_word); - SekSetWriteByteHandler(0, macross_main_write_byte); - SekSetReadWordHandler(0, macross_main_read_word); - SekSetReadByteHandler(0, macross_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 MacrossInit() -{ - return NMK004Init(MacrossLoadCallback, 10000000, 0, 0); -} - -struct BurnDriver BurnDrvMacross = { - "macross", NULL, NULL, NULL, "1992", - "Super Spacefortress Macross / Chou-Jikuu Yousai Macross\0", NULL, "Banpresto", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, macrossRomInfo, macrossRomName, NULL, NULL, CommonInputInfo, MacrossDIPInfo, - MacrossInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - -// GunNail (28th May. 1992) - -static struct BurnRomInfo gunnailRomDesc[] = { - { "3e.bin", 0x040000, 0x61d985b2, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "3o.bin", 0x040000, 0xf114e89c, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "92077_2.bin", 0x010000, 0xcd4e55f8, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "1.bin", 0x020000, 0x3d00a9f4, 3 | BRF_GRA }, // 3 Characters - - { "92077-4.bin", 0x100000, 0xa9ea2804, 4 | BRF_GRA }, // 4 Tiles - - { "92077-7.bin", 0x200000, 0xd49169b3, 5 | BRF_GRA }, // 5 Sprites - - { "92077-5.bin", 0x080000, 0xfeb83c73, 6 | BRF_SND }, // 6 OKI1 Samples - - { "92077-6.bin", 0x080000, 0x6d133f0d, 7 | BRF_SND }, // 7 OKI2 Samples - - { "8.bpr", 0x000100, 0x4299776e, 0 | BRF_OPT }, // 8 Unused proms - { "9.bpr", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 9 - { "10.bpr", 0x000020, 0xc60103c8, 0 | BRF_OPT }, // 10 -}; - -STD_ROM_PICK(gunnail) -STD_ROM_FN(gunnail) - -static INT32 GunnailLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; - BurnByteswap(DrvGfxROM2, 0x200000); - - if (BurnLoadRom(DrvSndROM0 + 0x020000, 5, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM1 + 0x020000, 6, 1)) return 1; - memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); - - decode_gfx(0x100000, 0x200000); - DrvGfxDecode(0x20000, 0x100000, 0x200000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c7ff, SM_WRITE); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09c000, 0x09cfff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09d000, 0x09dfff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); - SekSetWriteWordHandler(0, macross_main_write_word); - SekSetWriteByteHandler(0, macross_main_write_byte); - SekSetReadWordHandler(0, macross_main_read_word); - SekSetReadByteHandler(0, macross_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 GunnailInit() -{ - return NMK004Init(GunnailLoadCallback, 12000000, 0, 0); -} - -struct BurnDriver BurnDrvGunnail = { - "gunnail", NULL, NULL, NULL, "1993", - "GunNail (28th May. 1992)\0", NULL, "NMK / Tecmo", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, gunnailRomInfo, gunnailRomName, NULL, NULL, CommonInputInfo, GunnailDIPInfo, - GunnailInit, NMK004Exit, NMK004Frame, GunnailDraw, NULL, NULL, 0x400, - 224, 384, 3, 4 -}; - - -// Black Heart - -static struct BurnRomInfo blkheartRomDesc[] = { - { "blkhrt.7", 0x020000, 0x5bd248c0, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "blkhrt.6", 0x020000, 0x6449e50d, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "4.bin", 0x010000, 0x7cefa295, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "3.bin", 0x020000, 0xa1ab3a16, 3 | BRF_GRA }, // 3 Characters - - { "90068-5.bin", 0x100000, 0xa1ab4f24, 4 | BRF_GRA }, // 4 Tiles - - { "90068-8.bin", 0x100000, 0x9d3204b2, 5 | BRF_GRA }, // 5 Sprites - - { "90068-2.bin", 0x080000, 0x3a583184, 6 | BRF_SND }, // 6 OKI1 Samples - - { "90068-1.bin", 0x080000, 0xe7af69d2, 7 | BRF_SND }, // 7 OKI2 Samples - - { "9.bpr", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 8 Unused proms - { "10.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 9 -}; - -STD_ROM_PICK(blkheart) -STD_ROM_FN(blkheart) - -static INT32 BlkheartLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; - BurnByteswap(DrvGfxROM2, 0x100000); - - if (BurnLoadRom(DrvSndROM0 + 0x020000, 6, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM1 + 0x020000, 7, 1)) return 1; - memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); - - DrvGfxDecode(0x20000, 0x100000, 0x100000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); - SekSetWriteWordHandler(0, macross_main_write_word); - SekSetWriteByteHandler(0, macross_main_write_byte); - SekSetReadWordHandler(0, macross_main_read_word); - SekSetReadByteHandler(0, macross_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 BlkheartInit() -{ - return NMK004Init(BlkheartLoadCallback, 8000000, 0, 0); -} - -struct BurnDriver BurnDrvBlkheart = { - "blkheart", NULL, NULL, NULL, "1991", - "Black Heart\0", NULL, "UPL", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, blkheartRomInfo, blkheartRomName, NULL, NULL, CommonInputInfo, BlkheartDIPInfo, - BlkheartInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Black Heart (Japan) - -static struct BurnRomInfo blkheartjRomDesc[] = { - { "7.bin", 0x020000, 0xe0a5c667, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "6.bin", 0x020000, 0x7cce45e8, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "4.bin", 0x010000, 0x7cefa295, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "3.bin", 0x020000, 0xa1ab3a16, 3 | BRF_GRA }, // 3 Characters - - { "90068-5.bin", 0x100000, 0xa1ab4f24, 4 | BRF_GRA }, // 4 Tiles - - { "90068-8.bin", 0x100000, 0x9d3204b2, 5 | BRF_GRA }, // 5 Sprites - - { "90068-2.bin", 0x080000, 0x3a583184, 6 | BRF_SND }, // 6 OKI1 Samples - - { "90068-1.bin", 0x080000, 0xe7af69d2, 7 | BRF_SND }, // 7 OKI2 Samples - - { "9.bpr", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 8 Unused proms - { "10.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 9 -}; - -STD_ROM_PICK(blkheartj) -STD_ROM_FN(blkheartj) - -struct BurnDriver BurnDrvBlkheartj = { - "blkheartj", "blkheart", NULL, NULL, "1991", - "Black Heart (Japan)\0", NULL, "UPL", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, blkheartjRomInfo, blkheartjRomName, NULL, NULL, CommonInputInfo, BlkheartDIPInfo, - BlkheartInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Vandyke (Japan) - -static struct BurnRomInfo vandykeRomDesc[] = { - { "vdk-1.16", 0x020000, 0xc1d01c59, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "vdk-2.15", 0x020000, 0x9d741cc2, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "vdk-4.127", 0x010000, 0xeba544f0, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "vdk-3.222", 0x010000, 0x5a547c1b, 3 | BRF_GRA }, // 3 Characters - - { "vdk-01.13", 0x080000, 0x195a24be, 4 | BRF_GRA }, // 4 Tiles - - { "vdk-07.202", 0x080000, 0x42d41f06, 5 | BRF_GRA }, // 5 Sprites - { "vdk-06.203", 0x080000, 0xd54722a8, 5 | BRF_GRA }, // 6 - { "vdk-04.2-1", 0x080000, 0x0a730547, 5 | BRF_GRA }, // 7 - { "vdk-05.3-1", 0x080000, 0xba456d27, 5 | BRF_GRA }, // 8 - - { "vdk-02.126", 0x080000, 0xb2103274, 6 | BRF_SND }, // 9 OKI1 Samples - - { "vdk-03.165", 0x080000, 0x631776d3, 7 | BRF_SND }, // 10 OKI2 Samples - - { "ic100.bpr", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 11 Unused proms - { "ic101.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 12 -}; - -STD_ROM_PICK(vandyke) -STD_ROM_FN(vandyke) - -static INT32 VandykeLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x100000, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x100001, 8, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x020000, 9, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM1 + 0x020000, 10, 1)) return 1; - memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); - - DrvGfxDecode(0x10000, 0x80000, 0x200000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09d000, 0x09d7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); - SekSetWriteWordHandler(0, macross_main_write_word); - SekSetWriteByteHandler(0, macross_main_write_byte); - SekSetReadWordHandler(0, macross_main_read_word); - SekSetReadByteHandler(0, macross_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 VandykeInit() -{ - return NMK004Init(VandykeLoadCallback, 10000000, 0, 1); -} - -struct BurnDriver BurnDrvVandyke = { - "vandyke", NULL, NULL, NULL, "1990", - "Vandyke (Japan)\0", NULL, "UPL", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, - NULL, vandykeRomInfo, vandykeRomName, NULL, NULL, CommonInputInfo, VandykeDIPInfo, - VandykeInit, NMK004Exit, NMK004Frame, VandykeDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - -// Vandyke (Jaleco, Set 1) - -static struct BurnRomInfo vandykejalRomDesc[] = { - { "vdk-1.16", 0x020000, 0xc1d01c59, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "jaleco2.15", 0x020000, 0x170e4d2e, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "vdk-4.127", 0x010000, 0xeba544f0, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "vdk-3.222", 0x010000, 0x5a547c1b, 3 | BRF_GRA }, // 3 Characters - - { "vdk-01.13", 0x080000, 0x195a24be, 4 | BRF_GRA }, // 4 Tiles - - { "vdk-07.202", 0x080000, 0x42d41f06, 5 | BRF_GRA }, // 5 Sprites - { "vdk-06.203", 0x080000, 0xd54722a8, 5 | BRF_GRA }, // 6 - { "vdk-04.2-1", 0x080000, 0x0a730547, 5 | BRF_GRA }, // 7 - { "vdk-05.3-1", 0x080000, 0xba456d27, 5 | BRF_GRA }, // 8 - - { "vdk-02.126", 0x080000, 0xb2103274, 6 | BRF_SND }, // 9 OKI1 Samples - - { "vdk-03.165", 0x080000, 0x631776d3, 7 | BRF_SND }, // 10 OKI2 Samples - - { "ic100.bpr", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 11 Unused proms - { "ic101.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 12 -}; - -STD_ROM_PICK(vandykejal) -STD_ROM_FN(vandykejal) - -struct BurnDriver BurnDrvVandykejal = { - "vandykejal", "vandyke", NULL, NULL, "1990", - "Vandyke (Jaleco, Set 1)\0", NULL, "UPL (Jaleco license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, - NULL, vandykejalRomInfo, vandykejalRomName, NULL, NULL, CommonInputInfo, VandykeDIPInfo, - VandykeInit, NMK004Exit, NMK004Frame, VandykeDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - -// Vandyke (Jaleco, Set 2) - -static struct BurnRomInfo vandykejal2RomDesc[] = { - { "vdk-even.16", 0x020000, 0xcde05a84, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "vdk-odd.15", 0x020000, 0x0f6fea40, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "vdk-4.127", 0x010000, 0xeba544f0, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "vdk-3.222", 0x010000, 0x5a547c1b, 3 | BRF_GRA }, // 3 Characters - - { "vdk-01.13", 0x080000, 0x195a24be, 4 | BRF_GRA }, // 4 Tiles - - { "vdk-07.202", 0x080000, 0x42d41f06, 5 | BRF_GRA }, // 5 Sprites - { "vdk-06.203", 0x080000, 0xd54722a8, 5 | BRF_GRA }, // 6 - { "vdk-04.2-1", 0x080000, 0x0a730547, 5 | BRF_GRA }, // 7 - { "vdk-05.3-1", 0x080000, 0xba456d27, 5 | BRF_GRA }, // 8 - - { "vdk-02.126", 0x080000, 0xb2103274, 6 | BRF_SND }, // 9 OKI1 Samples - - { "vdk-03.165", 0x080000, 0x631776d3, 7 | BRF_SND }, // 10 OKI2 Samples - - { "ic100.bpr", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 11 Unused proms - { "ic101.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 12 -}; - -STD_ROM_PICK(vandykejal2) -STD_ROM_FN(vandykejal2) - -struct BurnDriver BurnDrvVandykejal2 = { - "vandykejal2", "vandyke", NULL, NULL, "1990", - "Vandyke (Jaleco, Set 2)\0", NULL, "UPL (Jaleco license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, - NULL, vandykejal2RomInfo, vandykejal2RomName, NULL, NULL, CommonInputInfo, VandykeDIPInfo, - VandykeInit, NMK004Exit, NMK004Frame, VandykeDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - -// Vandyke (bootleg with PIC16c57) - -static struct BurnRomInfo vandykebRomDesc[] = { - { "2.bin", 0x020000, 0x9c269702, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "1.bin", 0x020000, 0xdd6303a1, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "pic16c57", 0x002d4c, 0xbdb3920d, 2 | BRF_PRG | BRF_ESS }, // 2 PIC16c57 code - - { "3.bin", 0x010000, 0x5a547c1b, 3 | BRF_GRA }, // 3 Characters - - { "4.bin", 0x040000, 0x4ba4138d, 4 | BRF_GRA }, // 4 Tiles - { "5.bin", 0x040000, 0x9a1ac697, 4 | BRF_GRA }, // 5 - - { "13.bin", 0x040000, 0xbb561871, 5 | BRF_GRA }, // 6 Sprites - { "17.bin", 0x040000, 0x346e3b66, 5 | BRF_GRA }, // 7 - { "12.bin", 0x040000, 0xcdef9b17, 5 | BRF_GRA }, // 8 - { "16.bin", 0x040000, 0xbeda678c, 5 | BRF_GRA }, // 9 - { "11.bin", 0x020000, 0x823185d9, 5 | BRF_GRA }, // 10 - { "15.bin", 0x020000, 0x149f3247, 5 | BRF_GRA }, // 11 - { "10.bin", 0x020000, 0x388b1abc, 5 | BRF_GRA }, // 12 - { "14.bin", 0x020000, 0x32eeba37, 5 | BRF_GRA }, // 13 - - { "9.bin", 0x020000, 0x56bf774f, 6 | BRF_SND }, // 14 OKI1 Samples - { "8.bin", 0x020000, 0x89851fcf, 6 | BRF_SND }, // 15 - { "7.bin", 0x020000, 0xd7bf0f6a, 6 | BRF_SND }, // 16 - { "6.bin", 0x020000, 0xa7fcf709, 6 | BRF_SND }, // 17 -}; - -STD_ROM_PICK(vandykeb) -STD_ROM_FN(vandykeb) - -static INT32 VandykebLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - // if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000001, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x080000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x080001, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x100000, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x100001, 11, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x140000, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x140001, 13, 2)) return 1; - - // if (BurnLoadRom(DrvSndROM0 + 0x000000, 14, 1)) return 1; - // if (BurnLoadRom(DrvSndROM0 + 0x020000, 15, 1)) return 1; - // if (BurnLoadRom(DrvSndROM0 + 0x040000, 16, 1)) return 1; - // if (BurnLoadRom(DrvSndROM0 + 0x060000, 17, 1)) return 1; - - DrvGfxDecode(0x10000, 0x80000, 0x200000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); -// SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09d000, 0x09d7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); - SekSetWriteWordHandler(0, vandykeb_main_write_word); // different scroll regs - SekSetWriteByteHandler(0, vandykeb_main_write_byte); - SekSetReadWordHandler(0, macross_main_read_word); - SekSetReadByteHandler(0, macross_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 VandykebInit() -{ - input_high[0] = 0x0040; // or it locks up - - return NMK004Init(VandykebLoadCallback, 10000000, 0, 1); -} - -struct BurnDriver BurnDrvVandykeb = { - "vandykeb", "vandyke", NULL, NULL, "1990", - "Vandyke (bootleg with PIC16c57)\0", "No sound", "[UPL] (bootleg)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, - NULL, vandykebRomInfo, vandykebRomName, NULL, NULL, CommonInputInfo, VandykeDIPInfo, - VandykebInit, NMK004Exit, NMK004Frame, VandykeDraw, NULL, NULL, 0x400, - 224, 256, 3, 4 -}; - - -// Hacha Mecha Fighter (19th Sep. 1991) - -static struct BurnRomInfo hachamfRomDesc[] = { - { "7.93", 0x020000, 0x9d847c31, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "6.94", 0x020000, 0xde6408a0, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "1.70", 0x010000, 0x9e6f48fc, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "5.95", 0x020000, 0x29fb04a2, 3 | BRF_GRA }, // 3 Characters - - { "91076-4.101", 0x100000, 0xdf9653a4, 4 | BRF_GRA }, // 4 Tiles - - { "91076-8.57", 0x100000, 0x7fd0f556, 5 | BRF_GRA }, // 5 Sprites - - { "91076-2.46", 0x080000, 0x3f1e67f2, 6 | BRF_SND }, // 6 OKI1 Samples - - { "91076-3.45", 0x080000, 0xb25ed93b, 7 | BRF_SND }, // 7 OKI2 Samples -}; - -STD_ROM_PICK(hachamf) -STD_ROM_FN(hachamf) - -static INT32 HachamfLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; - BurnByteswap(DrvGfxROM2, 0x100000); - - if (BurnLoadRom(DrvSndROM0 + 0x020000, 6, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM1 + 0x020000, 7, 1)) return 1; - memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); - - DrvGfxDecode(0x20000, 0x100000, 0x100000); - } - - { - *((UINT16*)(Drv68KROM + 0x048a)) = 0x4e71; - *((UINT16*)(Drv68KROM + 0x04aa)) = 0x4e71; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); - SekSetWriteWordHandler(0, hachamf_main_write_word); - SekSetWriteByteHandler(0, hachamf_main_write_byte); - SekSetReadWordHandler(0, hachamf_main_read_word); - SekSetReadByteHandler(0, hachamf_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 HachamfInit() -{ - return NMK004Init(HachamfLoadCallback, 10000000, 0, 0); -} - -struct BurnDriver BurnDrvHachamf = { - "hachamf", NULL, NULL, NULL, "1991", - "Hacha Mecha Fighter (19th Sep. 1991)\0", NULL, "NMK", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, hachamfRomInfo, hachamfRomName, NULL, NULL, CommonInputInfo, HachamfDIPInfo, - HachamfInit, NMK004Exit, NMK004Frame, HachamfDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Koutetsu Yousai Strahl (Japan set 1) - -static struct BurnRomInfo strahlRomDesc[] = { - { "strahl-2.82", 0x020000, 0xc9d008ae, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "strahl-1.83", 0x020000, 0xafc3c4d6, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "strahl-4.66", 0x010000, 0x60a799c4, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "strahl-3.73", 0x010000, 0x2273b33e, 3 | BRF_GRA }, // 3 Characters - - { "str7b2r0.275", 0x040000, 0x5769e3e1, 4 | BRF_GRA }, // 4 Tiles - - { "strl3-01.32", 0x080000, 0xd8337f15, 5 | BRF_GRA }, // 5 Sprites - { "strl4-02.57", 0x080000, 0x2a38552b, 5 | BRF_GRA }, // 6 - { "strl5-03.58", 0x080000, 0xa0e7d210, 5 | BRF_GRA }, // 7 - - { "str6b1w1.776", 0x080000, 0xbb1bb155, 9 | BRF_SND }, // 8 Foreground Tiles - - { "str8pmw1.540", 0x080000, 0x01d6bb6a, 6 | BRF_SND }, // 9 OKI1 Samples - - { "str9pew1.639", 0x080000, 0x6bb3eb9f, 7 | BRF_SND }, // 10 OKI2 Samples -}; - -STD_ROM_PICK(strahl) -STD_ROM_FN(strahl) - -static INT32 StrahlLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x080000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x100000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x020000, 9, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM1 + 0x020000, 10, 1)) return 1; - memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); - - DrvGfxDecode(0x10000, 0x100000, 0x200000); - } - - { - *((UINT16*)(Drv68KROM + 0x79e)) = 0x4e71; // remove protection - *((UINT16*)(Drv68KROM + 0x7a0)) = 0x4e71; - *((UINT16*)(Drv68KROM + 0x7a2)) = 0x4e71; - *((UINT16*)(Drv68KROM + 0x8e0)) = 0x4e71; // force pass rom check - *((UINT16*)(Drv68KROM + 0x8e2)) = 0x4e71; - *((UINT16*)(Drv68KROM + 0x968)) = 0x4e71; - *((UINT16*)(Drv68KROM + 0x96a)) = 0x4e71; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvScrollRAM, 0x084000, 0x0843ff, SM_RAM); - SekMapMemory(DrvScrollRAM + 0x400, 0x088000, 0x0883ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x08c000, 0x08c7ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvBgRAM1, 0x094000, 0x097fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); - SekSetWriteWordHandler(0, macross_main_write_word); - SekSetWriteByteHandler(0, macross_main_write_byte); - SekSetReadWordHandler(0, macross_main_read_word); - SekSetReadByteHandler(0, macross_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 StrahlInit() -{ - return NMK004Init(StrahlLoadCallback, 12000000, 0, 1); -} - -struct BurnDriver BurnDrvStrahl = { - "strahl", NULL, NULL, NULL, "1992", - "Koutetsu Yousai Strahl (Japan set 1)\0", NULL, "UPL", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, strahlRomInfo, strahlRomName, NULL, NULL, CommonInputInfo, StrahlDIPInfo, - StrahlInit, NMK004Exit, NMK004Frame, StrahlDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Koutetsu Yousai Strahl (Japan set 2) - -static struct BurnRomInfo strahlaRomDesc[] = { - { "rom2", 0x020000, 0xf80a22ef, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "rom1", 0x020000, 0x802ecbfc, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "strahl-4.66", 0x010000, 0x60a799c4, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "strahl-3.73", 0x010000, 0x2273b33e, 3 | BRF_GRA }, // 3 Characters - - { "str7b2r0.275", 0x040000, 0x5769e3e1, 4 | BRF_GRA }, // 4 Tiles - - { "strl3-01.32", 0x080000, 0xd8337f15, 5 | BRF_GRA }, // 5 Sprites - { "strl4-02.57", 0x080000, 0x2a38552b, 5 | BRF_GRA }, // 6 - { "strl5-03.58", 0x080000, 0xa0e7d210, 5 | BRF_GRA }, // 7 - - { "str6b1w1.776", 0x080000, 0xbb1bb155, 9 | BRF_GRA }, // 8 Foreground tiles - - { "str8pmw1.540", 0x080000, 0x01d6bb6a, 6 | BRF_SND }, // 9 OKI1 Samples - - { "str9pew1.639", 0x080000, 0x6bb3eb9f, 7 | BRF_SND }, // 10 OKI2 Samples -}; - -STD_ROM_PICK(strahla) -STD_ROM_FN(strahla) - -struct BurnDriver BurnDrvStrahla = { - "strahla", "strahl", NULL, NULL, "1992", - "Koutetsu Yousai Strahl (Japan set 2)\0", NULL, "UPL", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, strahlaRomInfo, strahlaRomName, NULL, NULL, CommonInputInfo, StrahlDIPInfo, - StrahlInit, NMK004Exit, NMK004Frame, StrahlDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Bio-ship Paladin - -static struct BurnRomInfo bioshipRomDesc[] = { - { "2.ic14", 0x020000, 0xacf56afb, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "1.ic15", 0x020000, 0x820ef303, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "6.ic120", 0x010000, 0x5f39a980, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "7", 0x010000, 0x2f3f5a10, 3 | BRF_GRA }, // 3 Characters - - { "sbs-g_01.ic9", 0x080000, 0x21302e78, 4 | BRF_GRA }, // 4 Tiles - - { "sbs-g_03.ic194", 0x080000, 0x60e00d7b, 5 | BRF_GRA }, // 5 Sprites - - { "sbs-g_02.ic4", 0x080000, 0xf31eb668, 9 | BRF_GRA }, // 6 Foreground tiles - - { "8.ic27", 0x010000, 0x75a46fea, 10 | BRF_GRA }, // 7 Tilemap roms - { "9.ic26", 0x010000, 0xd91448ee, 10 | BRF_GRA }, // 8 - - { "sbs-g_04.ic139", 0x080000, 0x7c74cc4e, 6 | BRF_SND }, // 9 OKI1 Samples - - { "sbs-g_05.ic160", 0x080000, 0xf0a782e3, 7 | BRF_SND }, // 10 OKI2 Samples - - { "82s135.ic94", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 11 Unused proms - { "82s129.ic69", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 12 - { "82s123.ic154", 0x000020, 0x0f789fc7, 0 | BRF_OPT }, // 13 -}; - -STD_ROM_PICK(bioship) -STD_ROM_FN(bioship) - -static INT32 BioshipLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x080000, 6, 1)) return 1; - - if (BurnLoadRom(DrvTileROM + 0x000001, 7, 2)) return 1; - if (BurnLoadRom(DrvTileROM + 0x000000, 8, 2)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x020000, 9, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); - - if (BurnLoadRom(DrvSndROM1 + 0x020000, 10, 1)) return 1; - memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); - - DrvGfxDecode(0x10000, 0x100000, 0x80000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); - SekSetWriteWordHandler(0, macross_main_write_word); - SekSetWriteByteHandler(0, macross_main_write_byte); - SekSetReadWordHandler(0, macross_main_read_word); - SekSetReadByteHandler(0, macross_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 BioshipInit() -{ - return NMK004Init(BioshipLoadCallback, 10000000, 1, 1); -} - -struct BurnDriver BurnDrvBioship = { - "bioship", NULL, NULL, NULL, "1990", - "Bio-ship Paladin\0", NULL, "UPL (American Sammy license)", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, bioshipRomInfo, bioshipRomName, NULL, NULL, CommonInputInfo, BioshipDIPInfo, - BioshipInit, NMK004Exit, NMK004Frame, BioshipDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Space Battle Ship Gomorrah - -static struct BurnRomInfo sbsgomoRomDesc[] = { - { "11.ic14", 0x020000, 0x7916150b, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - { "10.ic15", 0x020000, 0x1d7accb8, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "6.ic120", 0x010000, 0x5f39a980, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data - - { "7.ic46", 0x010000, 0xf2b77f80, 3 | BRF_GRA }, // 3 Characters - - { "sbs-g_01.ic9", 0x080000, 0x21302e78, 4 | BRF_GRA }, // 4 Tiles - - { "sbs-g_03.ic194", 0x080000, 0x60e00d7b, 5 | BRF_GRA }, // 5 Sprites - - { "sbs-g_02.ic4", 0x080000, 0xf31eb668, 9 | BRF_GRA }, // 6 Foreground tiles - - { "8.ic27", 0x010000, 0x75a46fea, 10 | BRF_GRA }, // 7 Tilemap roms - { "9.ic26", 0x010000, 0xd91448ee, 10 | BRF_GRA }, // 8 - - { "sbs-g_04.ic139", 0x080000, 0x7c74cc4e, 6 | BRF_SND }, // 9 OKI1 Samples - - { "sbs-g_05.ic160", 0x080000, 0xf0a782e3, 7 | BRF_SND }, // 10 OKI2 Samples - - { "82s135.ic94", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 11 Unused proms - { "82s129.ic69", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 12 - { "82s123.ic154", 0x000020, 0x0f789fc7, 0 | BRF_OPT }, // 13 -}; - -STD_ROM_PICK(sbsgomo) -STD_ROM_FN(sbsgomo) - -struct BurnDriver BurnDrvSbsgomo = { - "sbsgomo", "bioship", NULL, NULL, "1990", - "Space Battle Ship Gomorrah\0", NULL, "UPL", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, - NULL, sbsgomoRomInfo, sbsgomoRomName, NULL, NULL, CommonInputInfo, BioshipDIPInfo, - BioshipInit, NMK004Exit, NMK004Frame, BioshipDraw, NULL, NULL, 0x400, - 256, 224, 4, 3 -}; - - -// Rapid Hero - -static struct BurnRomInfo rapheroRomDesc[] = { - { "rhp94099.3", 0x080000, 0xec9b4f05, 1 | BRF_PRG | BRF_ESS }, // 0 68k code - - { "rhp94099.2", 0x020000, 0xfe01ece1, 2 | BRF_PRG | BRF_ESS }, // 1 Tmp90c841 Code - - { "rhp94099.1", 0x020000, 0x55a7a011, 3 | BRF_GRA }, // 2 Characters - - { "rhp94099.4", 0x200000, 0x076eee7b, 4 | BRF_GRA }, // 3 Tiles - - { "rhp94099.8", 0x200000, 0x49892f07, 5 | BRF_GRA }, // 4 Sprites - { "rhp94099.9", 0x200000, 0xea2e47f0, 5 | BRF_GRA }, // 5 - { "rhp94099.10", 0x200000, 0x512cb839, 5 | BRF_GRA }, // 6 - - { "rhp94099.7", 0x200000, 0x0d99547e, 6 | BRF_SND }, // 7 OKI1 Samples - - { "rhp94099.5", 0x200000, 0x515eba93, 7 | BRF_SND }, // 8 OKI2 Samples - { "rhp94099.6", 0x200000, 0xf1a80e5a, 7 | BRF_SND }, // 9 - { "rhp94099.7", 0x200000, 0x0d99547e, 7 | BRF_SND }, // 10 - { "rhp94099.7", 0x200000, 0x0d99547e, 7 | BRF_SND }, // 11 - - { "prom1.u19", 0x000100, 0x4299776e, 0 | BRF_OPT }, // 12 Unused proms - { "prom2.u53", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 13 - { "prom3.u60", 0x000100, 0x304f98c6, 0 | BRF_OPT }, // 14 -}; - -STD_ROM_PICK(raphero) -STD_ROM_FN(raphero) - -static INT32 RapheroLoadCallback() -{ - { - if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; - memmove (DrvZ80ROM + 0x10000, DrvZ80ROM + 0x00000, 0x20000); - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x200000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x400000, 6, 1)) return 1; - BurnByteswap(DrvGfxROM2, 0x600000); - - if (BurnLoadRom(DrvSndROM0 + 0x040000, 7, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x40000, 0x20000); - - if (BurnLoadRom(DrvSndROM0 + 0x040000, 8, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x240000, 9, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x440000, 10, 1)) return 1; - if (BurnLoadRom(DrvSndROM0 + 0x640000, 11, 1)) return 1; - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x40000, 0x20000); - - DrvGfxDecode(0x20000, 0x200000, 0x600000); - memset (DrvGfxROM2 + 0xc00000, 0x0f, 0x400000); - nGraphicsMask[2] = 0xffff; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x120000, 0x1207ff, SM_RAM); - SekMapMemory(DrvScrollRAM, 0x130000, 0x1307ff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x140000, 0x143fff, SM_RAM); - SekMapMemory(DrvBgRAM1, 0x144000, 0x147fff, SM_RAM); - SekMapMemory(DrvBgRAM2, 0x148000, 0x14bfff, SM_RAM); - SekMapMemory(DrvBgRAM3, 0x14c000, 0x14ffff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x170000, 0x170fff, SM_RAM); - SekMapMemory(DrvTxRAM, 0x171000, 0x171fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x1f0000, 0x1fffff, SM_RAM); - SekSetWriteWordHandler(0, raphero_main_write_word); - SekSetWriteByteHandler(0, raphero_main_write_byte); - SekSetReadWordHandler(0, raphero_main_read_word); - SekSetReadByteHandler(0, raphero_main_read_byte); - SekClose(); - - return 0; -} - -static INT32 RapheroInit() -{ - return NMK004Init(RapheroLoadCallback, 14000000, 0, 0); // NOT REALLY NMK004!!! -} - -struct BurnDriver BurnDrvRaphero = { - "raphero", NULL, NULL, NULL, "1994", - "Rapid Hero\0", "Incomplete sound", "Media Trading Corp", "NMK16", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, rapheroRomInfo, rapheroRomName, NULL, NULL, Tdragon2InputInfo, RapheroDIPInfo, - RapheroInit, NMK004Exit, NMK004Frame, RapheroDraw, NULL, NULL, 0x400, - 224, 384, 3, 4 -}; +// FB Alpha NMK16 driver module +// Based on MAME driver by Mirko Buffoni, Richard Bush, Nicola Salmoria, Bryan McPhail, David Haywood, and R. Belmont +// Also, a huge "thank you!" to JackC for helping bug test + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "seibusnd.h" +#include "bitswap.h" +#include "nmk004.h" + +#if 0 + blkheart -- good + mustang -- good + acrobatm -- good + manybloc -- good + stagger1 -- good + tharrier -- good + airattck -- good + macross -- good + redhawkb -- good + popspops -- good + spec2k -- good + firehawk -- good + mangchi -- good + bubble2000 -- good + hachamf -- good -- small gfx issues, need to compare to MAME + redhawki -- good + strahl -- good + bioship -- good + nouryoku -- good + tdragon -- good + tdragon2 -- good (input issues?, I can not confirm) + macross2 -- good (input issues?, I can not confirm) + ssmissin -- good + twinactn -- good + gunnail -- good + raphero -- good -- no sound, cpu NOT emulated (input issues?, I can not confirm) + vandyke -- good + vandykeb -- good -- no sound. cpu NOT emulated :) + grdnstrm -- good + grdnstrmk -- good + bjtwin -- good + sabotenb -- good + + tdragonb -- bad sound. Seibu sound needs hooked up properly + mustangb -- bad sound. Seibu sound needs hooked up properly +#endif + +static UINT8 *AllMem; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvTileROM; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvBgRAM0; +static UINT8 *DrvBgRAM1; +static UINT8 *DrvBgRAM2; +static UINT8 *DrvBgRAM3; +static UINT8 *DrvTxRAM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvSprBuf; +static UINT8 *DrvSprBuf2; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvScrollRAM; + +static UINT32 *DrvPalette; + +static UINT8 *soundlatch; +static UINT8 *soundlatch2; +static UINT8 *flipscreen; +static UINT8 *tilebank; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvDips[2]; +static UINT16 DrvInputs[3]; +static UINT8 DrvReset; + +static INT32 nGraphicsMask[3]; +static INT32 videoshift = 0; +static INT32 input_high[2] = { 0, 0 }; +static INT32 is_8bpp = 0; +static INT32 global_y_offset = 16; +static INT32 screen_flip_y = 0; +static UINT32 nNMK004CpuSpeed; +static INT32 nNMK004EnableIrq2; +static INT32 macross2_sound_enable; + +static struct BurnInputInfo CommonInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 11, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 10, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 9, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 8, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Common) + +static struct BurnInputInfo TharrierInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy3 + 6, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy3 + 5, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy3 + 4, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy3 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy3 + 1, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy3 + 2, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy3 + 7, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 14, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 13, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 12, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 11, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 9, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 10, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Tharrier) + +static struct BurnInputInfo ManyblocInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 6, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 5, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 4, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 15, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 8, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 14, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 13, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 12, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 11, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 9, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 10, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Manybloc) + +static struct BurnInputInfo SsmissinInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 11, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 10, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 9, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 8, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Ssmissin) + +static struct BurnInputInfo Tdragon2InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 11, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 10, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 9, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 8, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 14, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Tdragon2) + +static struct BurnInputInfo AcrobatmInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 11, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 10, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 9, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 8, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 13, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Acrobatm) + +static struct BurnDIPInfo RedhawkbDIPList[]= +{ + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x02, "Off" }, + {0x12, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0xc0, "1" }, + {0x12, 0x01, 0xc0, 0x40, "2" }, + {0x12, 0x01, 0xc0, 0x00, "3" }, + {0x12, 0x01, 0xc0, 0x80, "5" }, + +// {0 , 0xfe, 0 , 4, "Flip Screen" }, +// {0x13, 0x01, 0x03, 0x00, "Off" }, +// {0x13, 0x01, 0x03, 0x03, "On" }, +// {0x13, 0x01, 0x03, 0x01, "Horizontally" }, +// {0x13, 0x01, 0x03, 0x02, "Vertically" }, + + {0 , 0xfe, 0 , 2, "Unused" }, + {0x13, 0x01, 0x04, 0x00, "Off" }, + {0x13, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x18, 0x10, "Easy" }, + {0x13, 0x01, 0x18, 0x00, "Normal" }, + {0x13, 0x01, 0x18, 0x08, "Hard" }, + {0x13, 0x01, 0x18, 0x18, "Hardest" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x13, 0x01, 0xe0, 0xe0, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xe0, 0x00, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "1 Coin 3 Credits" }, +}; + +STDDIPINFO(Redhawkb) + +static struct BurnDIPInfo RapheroDIPList[]= +{ + {0x14, 0xff, 0xff, 0xfd, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x14, 0x01, 0x02, 0x02, "Japanese" }, + {0x14, 0x01, 0x02, 0x00, "English" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x30, 0x10, "Easy" }, + {0x14, 0x01, 0x30, 0x30, "Normal" }, + {0x14, 0x01, 0x30, 0x20, "Hard" }, + {0x14, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0xc0, 0x00, "1" }, + {0x14, 0x01, 0xc0, 0x40, "2" }, + {0x14, 0x01, 0xc0, 0xc0, "3" }, + {0x14, 0x01, 0xc0, 0x80, "4" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x15, 0x01, 0x01, 0x01, "Off" }, +// {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x00, "Off" }, + {0x15, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x15, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x15, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x15, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x15, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x15, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + {0x15, 0x01, 0x1c, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x15, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x15, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x15, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x15, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x15, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xe0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Raphero) + +static struct BurnDIPInfo BioshipDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x01, 0x01, "Off" }, +// {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x06, 0x00, "Easy" }, + {0x12, 0x01, 0x06, 0x06, "Normal" }, + {0x12, 0x01, 0x06, 0x02, "Hard" }, + {0x12, 0x01, 0x06, 0x04, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x20, 0x00, "Off" }, + {0x12, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x80, "4" }, + {0x12, 0x01, 0xc0, 0x40, "5" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, +}; + +STDDIPINFO(Bioship) + +static struct BurnDIPInfo StrahlDIPList[]= +{ + {0x12, 0xff, 0xff, 0x7f, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0x07, 0x00, "5 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x03, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x38, 0x00, "5 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x18, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x40, 0x40, "Off" }, +// {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x02, "2" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x01, "4" }, + {0x13, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x08, "Easy" }, + {0x13, 0x01, 0x0c, 0x0c, "Normal" }, + {0x13, 0x01, 0x0c, 0x04, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x60, 0x40, "100k and every 200k" }, + {0x13, 0x01, 0x60, 0x60, "200k and every 200k" }, + {0x13, 0x01, 0x60, 0x20, "300k and every 300k" }, + {0x13, 0x01, 0x60, 0x00, "None" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Strahl) + +static struct BurnDIPInfo HachamfDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xfd, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x03, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x18, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x38, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x40, 0x00, "Off" }, + {0x12, 0x01, 0x40, 0x40, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x13, 0x01, 0x01, 0x01, "Off" }, +// {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x13, 0x01, 0x02, 0x00, "English" }, + {0x13, 0x01, 0x02, 0x02, "Japanese" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x04, "Easy" }, + {0x13, 0x01, 0x0c, 0x0c, "Normal" }, + {0x13, 0x01, 0x0c, 0x08, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0xc0, 0x00, "1" }, + {0x13, 0x01, 0xc0, 0x40, "2" }, + {0x13, 0x01, 0xc0, 0xc0, "3" }, + {0x13, 0x01, 0xc0, 0x80, "4" }, +}; + +STDDIPINFO(Hachamf) + +static struct BurnDIPInfo VandykeDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x12, 0x01, 0x01, 0x00, "2" }, + {0x12, 0x01, 0x01, 0x01, "3" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x20, 0x00, "Off" }, + {0x12, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0xc0, 0x00, "Easy" }, + {0x12, 0x01, 0xc0, 0xc0, "Normal" }, + {0x12, 0x01, 0xc0, 0x40, "Hard" }, + {0x12, 0x01, 0xc0, 0x80, "Hardest" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x13, 0x01, 0x01, 0x01, "Off" }, +// {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, +}; + +STDDIPINFO(Vandyke) + + +static struct BurnDIPInfo BlkheartDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x01, 0x01, "Off" }, +// {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x02, 0x02, "Off" }, + {0x12, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x0c, 0x0c, "Easy" }, + {0x12, 0x01, 0x0c, 0x08, "Normal" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x40, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x80, "4" }, + {0x12, 0x01, 0xc0, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x1c, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xe0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Blkheart) + +static struct BurnDIPInfo MacrossDIPList[]= +{ + {0x12, 0xff, 0xff, 0xf7, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x04, 0x04, "Off" }, +// {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x12, 0x01, 0x08, 0x00, "English" }, + {0x12, 0x01, 0x08, 0x08, "Japanese" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x30, 0x10, "Easy" }, + {0x12, 0x01, 0x30, 0x30, "Normal" }, + {0x12, 0x01, 0x30, 0x20, "Hard" }, + {0x12, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "1" }, + {0x12, 0x01, 0xc0, 0x40, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x80, "4" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x13, 0x01, 0x0f, 0x04, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x01, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x00, "5 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x02, "3 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x08, "4 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0c, "3 Coins 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x07, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "1 Coin 5 Credits" }, + {0x13, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x13, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x13, 0x01, 0xf0, 0x40, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x20, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "3 Coins 4 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "1 Coin 5 Credits" }, + {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x13, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Macross) + +static struct BurnDIPInfo TharrierDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x1c, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xe0, 0x00, "Free Play" }, + +// {0 , 0xfe, 0 , 2, "Cabinet" }, +// {0x14, 0x01, 0x01, 0x01, "Upright" }, +// {0x14, 0x01, 0x01, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x0c, 0x04, "Easy" }, + {0x14, 0x01, 0x0c, 0x0c, "Normal" }, + {0x14, 0x01, 0x0c, 0x08, "Hard" }, + {0x14, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "200k" }, + {0x14, 0x01, 0x30, 0x20, "200k and 1 Mil" }, + {0x14, 0x01, 0x30, 0x00, "200k, 500k & 1,2,3,5 Mil" }, + {0x14, 0x01, 0x30, 0x10, "None" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0xc0, 0x40, "2" }, + {0x14, 0x01, 0xc0, 0xc0, "3" }, + {0x14, 0x01, 0xc0, 0x80, "4" }, + {0x14, 0x01, 0xc0, 0x00, "5" }, +}; + +STDDIPINFO(Tharrier) + +static struct BurnDIPInfo ManyblocDIPList[]= +{ + {0x11, 0xff, 0xff, 0x18, NULL }, + {0x12, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 2, "Slot System" }, + {0x11, 0x01, 0x01, 0x00, "Off" }, + {0x11, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2, "Explanation" }, + {0x11, 0x01, 0x02, 0x00, "English" }, + {0x11, 0x01, 0x02, 0x02, "Japanese" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x11, 0x01, 0x08, 0x08, "Upright" }, + {0x11, 0x01, 0x08, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x11, 0x01, 0x10, 0x10, "Off" }, + {0x11, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x11, 0x01, 0x60, 0x60, "Easy" }, + {0x11, 0x01, 0x60, 0x00, "Normal" }, + {0x11, 0x01, 0x60, 0x20, "Hard" }, + {0x11, 0x01, 0x60, 0x40, "Hardest" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x11, 0x01, 0x80, 0x00, "Off" }, +// {0x11, 0x01, 0x80, 0x80, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0x07, 0x07, "5 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x00, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x03, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x38, 0x38, "5 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x30, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x20, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x00, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x08, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x10, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 4, "Plate Probability" }, + {0x12, 0x01, 0xc0, 0xc0, "Bad" }, + {0x12, 0x01, 0xc0, 0x00, "Normal" }, + {0x12, 0x01, 0xc0, 0x40, "Better" }, + {0x12, 0x01, 0xc0, 0x80, "Best" }, +}; + +STDDIPINFO(Manybloc) + +static struct BurnDIPInfo SsmissinDIPList[]= +{ + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x11, 0x01, 0x01, 0x01, "Off" }, +// {0x11, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x11, 0x01, 0x0c, 0x04, "Easy" }, + {0x11, 0x01, 0x0c, 0x0c, "Normal" }, + {0x11, 0x01, 0x0c, 0x08, "Hard" }, + {0x11, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x11, 0x01, 0xc0, 0x00, "1" }, + {0x11, 0x01, 0xc0, 0x40, "2" }, + {0x11, 0x01, 0xc0, 0xc0, "3" }, + {0x11, 0x01, 0xc0, 0x80, "4" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x12, 0x01, 0xe0, 0x20, "4 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0xa0, "3 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0x60, "2 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xe0, 0x40, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xe0, 0x80, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xe0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Ssmissin) + +static struct BurnDIPInfo Macross2DIPList[]= +{ + {0x12, 0xff, 0xff, 0xf7, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x04, 0x04, "Off" }, +// {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x12, 0x01, 0x08, 0x00, "English" }, + {0x12, 0x01, 0x08, 0x08, "Japanese" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x30, 0x10, "Easy" }, + {0x12, 0x01, 0x30, 0x30, "Normal" }, + {0x12, 0x01, 0x30, 0x20, "Hard" }, + {0x12, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x13, 0x01, 0x0f, 0x04, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x01, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x00, "5 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x02, "3 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x08, "4 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0c, "3 Coins 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x07, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "1 Coin 5 Credits" }, + {0x13, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x13, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x13, 0x01, 0xf0, 0x40, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x20, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "3 Coins 4 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "1 Coin 5 Credits" }, + {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x13, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Macross2) + +static struct BurnDIPInfo Tdragon2DIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x00, "Off" }, + {0x14, 0x01, 0x02, 0x02, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x04, 0x04, "Off" }, +// {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x30, 0x10, "Easy" }, + {0x14, 0x01, 0x30, 0x30, "Normal" }, + {0x14, 0x01, 0x30, 0x20, "Hard" }, + {0x14, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0xc0, 0x00, "1" }, + {0x14, 0x01, 0xc0, 0x40, "2" }, + {0x14, 0x01, 0xc0, 0xc0, "3" }, + {0x14, 0x01, 0xc0, 0x80, "4" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x15, 0x01, 0x0f, 0x04, "4 Coins 1 Credits" }, + {0x15, 0x01, 0x0f, 0x0a, "3 Coins 1 Credits" }, + {0x15, 0x01, 0x0f, 0x01, "2 Coins 1 Credits" }, + {0x15, 0x01, 0x0f, 0x00, "5 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x02, "3 Coins 2 Credits" }, + {0x15, 0x01, 0x0f, 0x08, "4 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x15, 0x01, 0x0f, 0x0c, "3 Coins 4 Credits" }, + {0x15, 0x01, 0x0f, 0x0e, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x0f, 0x07, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x15, 0x01, 0x0f, 0x0b, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x15, 0x01, 0x0f, 0x0d, "1 Coin 5 Credits" }, + {0x15, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x15, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x15, 0x01, 0xf0, 0x40, "4 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xa0, "3 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0x10, "2 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0x20, "3 Coins 2 Credits" }, + {0x15, 0x01, 0xf0, 0x80, "4 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x15, 0x01, 0xf0, 0xc0, "3 Coins 4 Credits" }, + {0x15, 0x01, 0xf0, 0xe0, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0x70, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x15, 0x01, 0xf0, 0xb0, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xf0, 0xd0, "1 Coin 5 Credits" }, + {0x15, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x15, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + {0x15, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Tdragon2) + +static struct BurnDIPInfo Stagger1DIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "1" }, + {0x12, 0x01, 0xc0, 0x80, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x40, "5" }, + +// {0 , 0xfe, 0 , 4, "Flip Screen" }, +// {0x13, 0x01, 0x03, 0x03, "Off" }, +// {0x13, 0x01, 0x03, 0x00, "On" }, +// {0x13, 0x01, 0x03, 0x02, "Horizontally" }, +// {0x13, 0x01, 0x03, 0x01, "Vertically" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x18, 0x08, "Easy" }, + {0x13, 0x01, 0x18, 0x18, "Normal" }, + {0x13, 0x01, 0x18, 0x10, "Hard" }, + {0x13, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, +}; + +STDDIPINFO(Stagger1) + +static struct BurnDIPInfo GrdnstrmDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x12, 0x01, 0x04, 0x04, "Off" }, + {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Bombs" }, + {0x12, 0x01, 0x08, 0x08, "2" }, + {0x12, 0x01, 0x08, 0x00, "3" }, + + {0 , 0xfe, 0 , 0, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "1" }, + {0x12, 0x01, 0xc0, 0x80, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x40, "5" }, + +// {0 , 0xfe, 0 , 0, "Mirror Screen" }, +// {0x13, 0x01, 0x01, 0x01, "Off" }, +// {0x13, 0x01, 0x01, 0x00, "On" }, + +// {0 , 0xfe, 0 , 4, "Flip Screen" }, +// {0x13, 0x01, 0x02, 0x02, "Off" }, +// {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x13, 0x01, 0x18, 0x08, "Easy" }, + {0x13, 0x01, 0x18, 0x18, "Normal" }, + {0x13, 0x01, 0x18, 0x10, "Hard" }, + {0x13, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, +}; + +STDDIPINFO(Grdnstrm) + +static struct BurnDIPInfo GrdnstrkDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x12, 0x01, 0x04, 0x04, "Off" }, + {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Bombs" }, + {0x12, 0x01, 0x08, 0x08, "2" }, + {0x12, 0x01, 0x08, 0x00, "3" }, + + {0 , 0xfe, 0 , 0, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "1" }, + {0x12, 0x01, 0xc0, 0x80, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x40, "5" }, + +// {0 , 0xfe, 0 , 0, "Flip Screen" }, +// {0x13, 0x01, 0x01, 0x01, "Off" }, +// {0x13, 0x01, 0x01, 0x00, "On" }, + +// {0 , 0xfe, 0 , 4, "Mirror Screen" }, +// {0x13, 0x01, 0x02, 0x02, "Off" }, +// {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x13, 0x01, 0x18, 0x08, "Easy" }, + {0x13, 0x01, 0x18, 0x18, "Normal" }, + {0x13, 0x01, 0x18, 0x10, "Hard" }, + {0x13, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, +}; + +STDDIPINFO(Grdnstrk) + +static struct BurnDIPInfo PopspopsDIPList[]= +{ + {0x12, 0xff, 0xff, 0xfa, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x18, 0x10, "Easy" }, + {0x13, 0x01, 0x18, 0x18, "Normal" }, + {0x13, 0x01, 0x18, 0x08, "Hard" }, + {0x13, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, +}; + +STDDIPINFO(Popspops) + +static struct BurnDIPInfo Bubl2000DIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Normal" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Free Credit" }, + {0x12, 0x01, 0xc0, 0x80, "500k" }, + {0x12, 0x01, 0xc0, 0xc0, "800k" }, + {0x12, 0x01, 0xc0, 0x40, "1000k" }, + {0x12, 0x01, 0xc0, 0x00, "1500k" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 7, "Coin B" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 7, "Coin A" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, +}; + +STDDIPINFO(Bubl2000) + +static struct BurnDIPInfo MangchiDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "DSWS" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 4, "Vs Rounds" }, + {0x12, 0x01, 0x18, 0x18, "2" }, + {0x12, 0x01, 0x18, 0x10, "3" }, + {0x12, 0x01, 0x18, 0x08, "4" }, + {0x12, 0x01, 0x18, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x18, 0x08, "Easy" }, + {0x13, 0x01, 0x18, 0x18, "Normal" }, + {0x13, 0x01, 0x18, 0x10, "Hard" }, + {0x13, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, +}; + +STDDIPINFO(Mangchi) + +static struct BurnDIPInfo FirehawkDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 6, "Difficulty" }, + {0x12, 0x01, 0x0e, 0x06, "Very Easy" }, + {0x12, 0x01, 0x0e, 0x08, "Easy" }, + {0x12, 0x01, 0x0e, 0x0e, "Normal" }, + {0x12, 0x01, 0x0e, 0x02, "Hard" }, + {0x12, 0x01, 0x0e, 0x04, "Hardest" }, + {0x12, 0x01, 0x0e, 0x0c, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x10, 0x00, "Off" }, + {0x12, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2, "Number of Bombs" }, + {0x12, 0x01, 0x20, 0x20, "2" }, + {0x12, 0x01, 0x20, 0x00, "3" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "1" }, + {0x12, 0x01, 0xc0, 0x80, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x40, "4" }, + + {0 , 0xfe, 0 , 2, "Region" }, + {0x13, 0x01, 0x02, 0x02, "English" }, + {0x13, 0x01, 0x02, 0x00, "China" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Continue Coins" }, + {0x13, 0x01, 0x18, 0x18, "1 Coin" }, + {0x13, 0x01, 0x18, 0x08, "2 Coins" }, + {0x13, 0x01, 0x18, 0x10, "3 Coins" }, + {0x13, 0x01, 0x18, 0x00, "4 Coins" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, +}; + +STDDIPINFO(Firehawk) + +static struct BurnDIPInfo Spec2kDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x12, 0x01, 0x04, 0x04, "Off" }, + {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Number of Bombs" }, + {0x12, 0x01, 0x08, 0x08, "2" }, + {0x12, 0x01, 0x08, 0x00, "3" }, + + {0 , 0xfe, 0 , 2, "Copyright Notice" }, + {0x12, 0x01, 0x10, 0x00, "Off" }, + {0x12, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "1" }, + {0x12, 0x01, 0xc0, 0x80, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x40, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x18, 0x08, "Easy" }, + {0x13, 0x01, 0x18, 0x18, "Normal" }, + {0x13, 0x01, 0x18, 0x10, "Hard" }, + {0x13, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x13, 0x01, 0xe0, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, +}; + +STDDIPINFO(Spec2k) + +static struct BurnDIPInfo TwinactnDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x1c, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xe0, 0x00, "Free Play" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x13, 0x01, 0x01, 0x01, "Off" }, +// {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x0c, "Easy" }, + {0x13, 0x01, 0x0c, 0x04, "Normal" }, + {0x13, 0x01, 0x0c, 0x08, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0xc0, 0x40, "2" }, + {0x13, 0x01, 0xc0, 0xc0, "3" }, + {0x13, 0x01, 0xc0, 0x80, "4" }, + {0x13, 0x01, 0xc0, 0x00, "5" }, +}; + +STDDIPINFO(Twinactn) + +static struct BurnDIPInfo BjtwinDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x01, 0x01, "Off" }, +// {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Starting level" }, + {0x12, 0x01, 0x0e, 0x08, "Germany" }, + {0x12, 0x01, 0x0e, 0x04, "Thailand" }, + {0x12, 0x01, 0x0e, 0x0c, "Nevada" }, + {0x12, 0x01, 0x0e, 0x0e, "Japan" }, + {0x12, 0x01, 0x0e, 0x06, "Korea" }, + {0x12, 0x01, 0x0e, 0x0a, "England" }, + {0x12, 0x01, 0x0e, 0x02, "Hong Kong" }, + {0x12, 0x01, 0x0e, 0x00, "China" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x30, 0x20, "Easy" }, + {0x12, 0x01, 0x30, 0x30, "Normal" }, + {0x12, 0x01, 0x30, 0x10, "Hard" }, + {0x12, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "1" }, + {0x12, 0x01, 0xc0, 0x40, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x80, "4" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x1c, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xe0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Bjtwin) + +static struct BurnDIPInfo SabotenbDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x01, 0x01, "Off" }, +// {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x12, 0x01, 0x02, 0x02, "Japanese" }, + {0x12, 0x01, 0x02, 0x00, "English" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Normal" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "1" }, + {0x12, 0x01, 0xc0, 0x40, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x80, "4" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x1c, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xe0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Sabotenb) + +static struct BurnDIPInfo NouryokuDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Life Decrease Speed" }, + {0x12, 0x01, 0x03, 0x02, "Slow" }, + {0x12, 0x01, 0x03, 0x03, "Normal" }, + {0x12, 0x01, 0x03, 0x01, "Fast" }, + {0x12, 0x01, 0x03, 0x00, "Very Fast" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Normal" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x12, 0x01, 0xe0, 0x20, "4 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0xa0, "3 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0x60, "2 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xe0, 0x00, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xe0, 0x40, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xe0, 0x80, "1 Coin 4 Credits" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x13, 0x01, 0x20, 0x20, "Off" }, +// {0x13, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Nouryoku) + +static struct BurnDIPInfo MustangDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x1c, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xe0, 0x00, "Free Play" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x13, 0x01, 0x01, 0x01, "Off" }, +// {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x04, "Easy" }, + {0x13, 0x01, 0x0c, 0x0c, "Normal" }, + {0x13, 0x01, 0x0c, 0x08, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0xc0, 0x40, "2" }, + {0x13, 0x01, 0xc0, 0xc0, "3" }, + {0x13, 0x01, 0xc0, 0x80, "4" }, + {0x13, 0x01, 0xc0, 0x00, "5" }, +}; + +STDDIPINFO(Mustang) + +static struct BurnDIPInfo TdragonbDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x03, 0x00, "1" }, + {0x12, 0x01, 0x03, 0x02, "2" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x01, "4" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x30, 0x20, "Easy" }, + {0x12, 0x01, 0x30, 0x30, "Normal" }, + {0x12, 0x01, 0x30, 0x10, "Hard" }, + {0x12, 0x01, 0x30, 0x00, "Hardest" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x80, 0x80, "Off" }, +// {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x38, 0x20, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x38, 0x10, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x38, 0x08, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x38, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Tdragonb) + +static struct BurnDIPInfo TdragonDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x01, 0x01, "Off" }, +// {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x0c, 0x04, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Normal" }, + {0x12, 0x01, 0x0c, 0x08, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0x00, "1" }, + {0x12, 0x01, 0xc0, 0x40, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x80, "4" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x38, 0x20, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x38, 0x10, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x38, 0x08, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x38, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Tdragon) + +static struct BurnDIPInfo AcrobatmDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xf7, NULL }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x13, 0x01, 0x02, 0x02, "Off" }, +// {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x1c, 0x00, "5 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0xe0, 0x00, "5 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x06, 0x02, "50k and 100k" }, + {0x14, 0x01, 0x06, 0x06, "100k and 100k" }, + {0x14, 0x01, 0x06, 0x04, "100k and 200k" }, + {0x14, 0x01, 0x06, 0x00, "None" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x14, 0x01, 0x08, 0x00, "English" }, + {0x14, 0x01, 0x08, 0x08, "Japanese" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x30, 0x00, "Hardest" }, + {0x14, 0x01, 0x30, 0x10, "Easy" }, + {0x14, 0x01, 0x30, 0x20, "Hard" }, + {0x14, 0x01, 0x30, 0x30, "Normal" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0xc0, 0x40, "2" }, + {0x14, 0x01, 0xc0, 0xc0, "3" }, + {0x14, 0x01, 0xc0, 0x80, "4" }, + {0x14, 0x01, 0xc0, 0x00, "5" }, +}; + +STDDIPINFO(Acrobatm) + +static struct BurnDIPInfo GunnailDIPList[]= +{ + {0x12, 0xff, 0xff, 0xfd, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x12, 0x01, 0x01, 0x01, "Off" }, +// {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x12, 0x01, 0x02, 0x02, "Japanese" }, + {0x12, 0x01, 0x02, 0x00, "English" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Normal" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x1c, 0x10, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x18, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x1c, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0xe0, 0x80, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xe0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Gunnail) + +//------------------------------------------------------------------------------------------------------------ +// NMK112 chip emulation -- probably should be in an external file + +#define MAXCHIPS 2 +#define TABLESIZE 0x100 +#define BANKSIZE 0x10000 + +static UINT8 page_mask; +static UINT8 current_bank[8]; +static UINT8 *region[2]; +static UINT32 regionlen[2]; + +void NMK112_okibank_write(INT32 offset, UINT8 data) +{ + INT32 chip = (offset & 4) >> 2; + INT32 banknum = offset & 3; + INT32 paged = (page_mask & (1 << chip)); + + UINT8 *rom = region[chip]; + INT32 size = regionlen[chip] - 0x40000; + INT32 bankaddr = (data * BANKSIZE) % size; + + if (current_bank[offset] == data) return; + current_bank[offset] = data; + + if ((paged) && (banknum == 0)) + memcpy (rom + 0x400, rom + 0x40000 + bankaddr+0x400, BANKSIZE-0x400); + else + memcpy (rom + banknum * BANKSIZE, rom + 0x40000 + bankaddr, BANKSIZE); + + if (paged) + { + rom += banknum * TABLESIZE; + memcpy(rom, rom + 0x40000 + bankaddr, TABLESIZE); + } +} + +void NMK112Reset() +{ + memset (current_bank, ~0, sizeof(current_bank)); + NMK112_okibank_write(0, 0); + NMK112_okibank_write(4, 0); +} + +void NMK112_init(UINT8 disable_page_mask, UINT8 *rgn0, UINT8 *rgn1, INT32 len0, INT32 len1) +{ + region[0] = rgn0; + region[1] = rgn1; + regionlen[0] = len0; + regionlen[1] = len1; + page_mask = ~disable_page_mask; + NMK112Reset(); +} + +//------------------------------------------------------------------------------------------------------------ + +#define STRANGE_RAM_WRITE_BYTE(value) \ + if ((address & 0xffff0000) == value) { \ + Drv68KRAM[(address & 0xfffe) | 0] = data; \ + Drv68KRAM[(address & 0xfffe) | 1] = data; \ + return; \ + } \ + +// MAKE SHORT ^^ + +#define STRANGE_RAM_WRITE_WORD(value) \ + if ((address & 0xffff0000) == value) { \ + *((UINT16*)(Drv68KRAM + (address & 0xfffe))) = BURN_ENDIAN_SWAP_INT16(data); \ + return; \ + } \ + +#define PROT_JSR(_offs_,_protvalue_,_pc_) \ + if(nmk16_mainram[(_offs_)/2] == BURN_ENDIAN_SWAP_INT16(_protvalue_)) \ + { \ + nmk16_mainram[(_offs_)/2] = 0xffff; /*(MCU job done)*/ \ + nmk16_mainram[(_offs_+2-0x10)/2] = BURN_ENDIAN_SWAP_INT16(0x4ef9);/*JMP*/\ + nmk16_mainram[(_offs_+4-0x10)/2] = 0x0000;/*HI-DWORD*/\ + nmk16_mainram[(_offs_+6-0x10)/2] = BURN_ENDIAN_SWAP_INT16(_pc_); /*LO-DWORD*/\ + } \ + +#define PROT_INPUT(_offs_,_protvalue_,_protinput_,_input_) \ + if(nmk16_mainram[_offs_] == BURN_ENDIAN_SWAP_INT16(_protvalue_)) \ + {\ + nmk16_mainram[_protinput_] = BURN_ENDIAN_SWAP_INT16((_input_ & 0xffff0000)>>16);\ + nmk16_mainram[_protinput_+1] = BURN_ENDIAN_SWAP_INT16(_input_ & 0x0000ffff);\ + } + +//------------------------------------------------------------------------------------------------------------ +// MCU simulation stuff + +static INT32 prot_count = 0; + +static UINT8 tharrier_mcu_r() +{ + UINT16 *nmk16_mainram = (UINT16*)Drv68KRAM; + + static const UINT8 to_main[15] = + { + 0x82,0xc7,0x00,0x2c,0x6c,0x00,0x9f,0xc7,0x00,0x29,0x69,0x00,0x8b,0xc7,0x00 + }; + + INT32 res; + + if (SekGetPC(-1)==0x08aa) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9064/2]))|0x20; + else if (SekGetPC(-1)==0x08ce) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9064/2]))|0x60; + else if (SekGetPC(-1)==0x0332) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x90f6/2]))|0x00; + else if (SekGetPC(-1)==0x64f4) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x90f6/2]))|0x00; + else + { + res = to_main[prot_count++]; + if (prot_count > 14) + prot_count = 0; + } + return res; +} + +static void HachaRAMProt(INT32 offset) +{ + UINT16 *nmk16_mainram = (UINT16*)Drv68KRAM; + + switch(offset) + { + case 0xe058/2: PROT_INPUT(0xe058/2,0xc71f,0xe000/2,0x00080000); break; + case 0xe182/2: PROT_INPUT(0xe182/2,0x865d,0xe004/2,0x00080002); break; + case 0xe51e/2: PROT_INPUT(0xe51e/2,0x0f82,0xe008/2,0x00080008); break; + case 0xe6b4/2: PROT_INPUT(0xe6b4/2,0x79be,0xe00c/2,0x0008000a); break; + case 0xe10e/2: PROT_JSR(0xe10e,0x8007,0x870a); //870a not 9d66 + PROT_JSR(0xe10e,0x8000,0xd9c6); break; + case 0xe11e/2: PROT_JSR(0xe11e,0x8038,0x972a); // 972a + PROT_JSR(0xe11e,0x8031,0xd1f8); break; + case 0xe12e/2: PROT_JSR(0xe12e,0x8019,0x9642); // OK-9642 + PROT_JSR(0xe12e,0x8022,0xda06); break; + case 0xe13e/2: PROT_JSR(0xe13e,0x802a,0x9d66); // 9d66 not 9400 - OK + PROT_JSR(0xe13e,0x8013,0x81aa); break; + case 0xe14e/2: PROT_JSR(0xe14e,0x800b,0xb3f2); // b3f2 - OK + PROT_JSR(0xe14e,0x8004,0x8994); break; + case 0xe15e/2: PROT_JSR(0xe15e,0x803c,0xb59e); // b59e - OK + PROT_JSR(0xe15e,0x8035,0x8d0c); break; + case 0xe16e/2: PROT_JSR(0xe16e,0x801d,0x9ac2); // 9ac2 - OK + PROT_JSR(0xe16e,0x8026,0x8c36); break; + case 0xe17e/2: PROT_JSR(0xe17e,0x802e,0xc366); // c366 - OK + PROT_JSR(0xe17e,0x8017,0x870a); break; + case 0xe18e/2: PROT_JSR(0xe18e,0x8004,0xd620); // unused + PROT_JSR(0xe18e,0x8008,0x972a); break; // unused + case 0xe19e/2: PROT_JSR(0xe19e,0x8030,0xd9c6); // OK-d9c6 + PROT_JSR(0xe19e,0x8039,0x9642); break; + case 0xe1ae/2: PROT_JSR(0xe1ae,0x8011,0xd1f8); // d1f8 not c67e + PROT_JSR(0xe1ae,0x802a,0x9d66); break; + case 0xe1be/2: PROT_JSR(0xe1be,0x8022,0xda06); // da06 + PROT_JSR(0xe1be,0x801b,0xb3f2); break; + case 0xe1ce/2: PROT_JSR(0xe1ce,0x8003,0x81aa); // 81aa + PROT_JSR(0xe1ce,0x800c,0xb59e); break; + case 0xe1de/2: PROT_JSR(0xe1de,0x8034,0x8994); // 8994 - OK + PROT_JSR(0xe1de,0x803d,0x9ac2); break; + case 0xe1ee/2: PROT_JSR(0xe1ee,0x8015,0x8d0c); // 8d0c not 82f6 + PROT_JSR(0xe1ee,0x802e,0xc366); break; + case 0xe1fe/2: PROT_JSR(0xe1fe,0x8026,0x8c36); // 8c36 + PROT_JSR(0xe1fe,0x8016,0xd620); break; // unused + case 0xef00/2: + if(nmk16_mainram[0xef00/2] == BURN_ENDIAN_SWAP_INT16(0x60fe)) + { + nmk16_mainram[0xef00/2] = 0x0000; // this is the coin counter + nmk16_mainram[0xef02/2] = 0x0000; + nmk16_mainram[0xef04/2] = BURN_ENDIAN_SWAP_INT16(0x4ef9); + nmk16_mainram[0xef06/2] = 0x0000; + nmk16_mainram[0xef08/2] = BURN_ENDIAN_SWAP_INT16(0x7dc2); + } + break; + } +} + +static void tdragon_mainram_w(INT32 offset) +{ + UINT16 *nmk16_mainram = (UINT16*)Drv68KRAM; + + switch(offset) + { + case 0xe066/2: PROT_INPUT(0xe066/2,0xe23e,0xe000/2,0x000c0000); break; + case 0xe144/2: PROT_INPUT(0xe144/2,0xf54d,0xe004/2,0x000c0002); break; + case 0xe60e/2: PROT_INPUT(0xe60e/2,0x067c,0xe008/2,0x000c0008); break; + case 0xe714/2: PROT_INPUT(0xe714/2,0x198b,0xe00c/2,0x000c000a); break; + case 0xe70e/2: PROT_JSR(0xe70e,0x8007,0x9e22); + PROT_JSR(0xe70e,0x8000,0xd518); break; + case 0xe71e/2: PROT_JSR(0xe71e,0x8038,0xaa0a); + PROT_JSR(0xe71e,0x8031,0x8e7c); break; + case 0xe72e/2: PROT_JSR(0xe72e,0x8019,0xac48); + PROT_JSR(0xe72e,0x8022,0xd558); break; + case 0xe73e/2: PROT_JSR(0xe73e,0x802a,0xb110); + PROT_JSR(0xe73e,0x8013,0x96da); break; + case 0xe74e/2: PROT_JSR(0xe74e,0x800b,0xb9b2); + PROT_JSR(0xe74e,0x8004,0xa062); break; + case 0xe75e/2: PROT_JSR(0xe75e,0x803c,0xbb4c); + PROT_JSR(0xe75e,0x8035,0xa154); break; + case 0xe76e/2: PROT_JSR(0xe76e,0x801d,0xafa6); + PROT_JSR(0xe76e,0x8026,0xa57a); break; + case 0xe77e/2: PROT_JSR(0xe77e,0x802e,0xc6a4); + PROT_JSR(0xe77e,0x8017,0x9e22); break; + case 0xe78e/2: PROT_JSR(0xe78e,0x8004,0xaa0a); + PROT_JSR(0xe78e,0x8008,0xaa0a); break; + case 0xe79e/2: PROT_JSR(0xe79e,0x8030,0xd518); + PROT_JSR(0xe79e,0x8039,0xac48); break; + case 0xe7ae/2: PROT_JSR(0xe7ae,0x8011,0x8e7c); + PROT_JSR(0xe7ae,0x802a,0xb110); break; + case 0xe7be/2: PROT_JSR(0xe7be,0x8022,0xd558); + PROT_JSR(0xe7be,0x801b,0xb9b2); break; + case 0xe7ce/2: PROT_JSR(0xe7ce,0x8003,0x96da); + PROT_JSR(0xe7ce,0x800c,0xbb4c); break; + case 0xe7de/2: PROT_JSR(0xe7de,0x8034,0xa062); + PROT_JSR(0xe7de,0x803d,0xafa6); break; + case 0xe7ee/2: PROT_JSR(0xe7ee,0x8015,0xa154); + PROT_JSR(0xe7ee,0x802e,0xc6a4); break; + case 0xe7fe/2: PROT_JSR(0xe7fe,0x8026,0xa57a); + PROT_JSR(0xe7fe,0x8016,0xa57a); break; + case 0xef00/2: + if(nmk16_mainram[0xef00/2] == BURN_ENDIAN_SWAP_INT16(0x60fe)) + { + nmk16_mainram[0xef00/2] = 0x0000; // this is the coin counter + nmk16_mainram[0xef02/2] = 0x0000; + nmk16_mainram[0xef04/2] = BURN_ENDIAN_SWAP_INT16(0x4ef9); + nmk16_mainram[0xef06/2] = 0x0000; + nmk16_mainram[0xef08/2] = BURN_ENDIAN_SWAP_INT16(0x92f4); + } + break; + } +} + +static void mcu_run(UINT8 dsw_setting) +{ + static UINT8 input_pressed; + static UINT16 coin_input; + UINT8 dsw[2]; + static UINT8 start_helper = 0; + static UINT8 coin_count[2],coin_count_frac[2]; + static UINT8 i; + + UINT16 *nmk16_mainram = (UINT16*)Drv68KRAM; + + if(start_helper & 1 && BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9000/2]) & 0x0200) // start 1 + { + nmk16_mainram[0xef00/2]--; + start_helper = start_helper & 2; + } + if(start_helper & 2 && BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9000/2]) & 0x0100) // start 2 + { + nmk16_mainram[0xef00/2]--; + start_helper = start_helper & 1; + } + + if(dsw_setting) // Thunder Dragon + { + dsw[0] = (DrvDips[1] & 0x7); + dsw[1] = (DrvDips[1] & 0x38) >> 3; + for(i=0;i<2;i++) + { + switch(dsw[i] & 7) + { + case 0: nmk16_mainram[0x9000/2]|=BURN_ENDIAN_SWAP_INT16(0x4000); break; // free play + case 1: coin_count_frac[i] = 1; coin_count[i] = 4; break; + case 2: coin_count_frac[i] = 1; coin_count[i] = 3; break; + case 3: coin_count_frac[i] = 1; coin_count[i] = 2; break; + case 4: coin_count_frac[i] = 4; coin_count[i] = 1; break; + case 5: coin_count_frac[i] = 3; coin_count[i] = 1; break; + case 6: coin_count_frac[i] = 2; coin_count[i] = 1; break; + case 7: coin_count_frac[i] = 1; coin_count[i] = 1; break; + } + } + } + else // Hacha Mecha Fighter + { + dsw[0] = (DrvDips[1] & 0x07) >> 0; + dsw[1] = (DrvDips[1] & 0x38) >> 3; + for(i=0;i<2;i++) + { + switch(dsw[i] & 7) + { + case 0: nmk16_mainram[0x9000/2]|=BURN_ENDIAN_SWAP_INT16(0x4000); break; // free play + case 1: coin_count_frac[i] = 4; coin_count[i] = 1; break; + case 2: coin_count_frac[i] = 3; coin_count[i] = 1; break; + case 3: coin_count_frac[i] = 2; coin_count[i] = 1; break; + case 4: coin_count_frac[i] = 1; coin_count[i] = 4; break; + case 5: coin_count_frac[i] = 1; coin_count[i] = 3; break; + case 6: coin_count_frac[i] = 1; coin_count[i] = 2; break; + case 7: coin_count_frac[i] = 1; coin_count[i] = 1; break; + } + } + } + + // read the coin port + coin_input = (~(DrvInputs[0])); + + if(coin_input & 0x01) // coin 1 + { + if((input_pressed & 0x01) == 0) + { + if(coin_count_frac[0] != 1) + { + nmk16_mainram[0xef02/2]+=coin_count[0]; + if(coin_count_frac[0] == nmk16_mainram[0xef02/2]) + { + nmk16_mainram[0xef00/2]+=coin_count[0]; + nmk16_mainram[0xef02/2] = 0; + } + } + else + nmk16_mainram[0xef00/2]+=coin_count[0]; + } + input_pressed = (input_pressed & 0xfe) | 1; + } + else + input_pressed = (input_pressed & 0xfe); + + if(coin_input & 0x02) // coin 2 + { + if((input_pressed & 0x02) == 0) + { + if(coin_count_frac[1] != 1) + { + nmk16_mainram[0xef02/2]+=coin_count[1]; + if(coin_count_frac[1] == nmk16_mainram[0xef02/2]) + { + nmk16_mainram[0xef00/2]+=coin_count[1]; + nmk16_mainram[0xef02/2] = 0; + } + } + else + nmk16_mainram[0xef00/2]+=coin_count[1]; + } + input_pressed = (input_pressed & 0xfd) | 2; + } + else + input_pressed = (input_pressed & 0xfd); + + if(coin_input & 0x04) // service 1 + { + if((input_pressed & 0x04) == 0) + nmk16_mainram[0xef00/2]++; + input_pressed = (input_pressed & 0xfb) | 4; + } + else + input_pressed = (input_pressed & 0xfb); + + if(nmk16_mainram[0xef00/2] > 0 && nmk16_mainram[0x9000/2] & 0x8000) //enable start button + { + if(coin_input & 0x08) // start 1 + { + if((input_pressed & 0x08) == 0 && (!(nmk16_mainram[0x9000/2] & 0x0200))) // start 1 + start_helper = 1; + + input_pressed = (input_pressed & 0xf7) | 8; + } + else + input_pressed = (input_pressed & 0xf7); + + if(coin_input & 0x10) // start 2 + { + if((input_pressed & 0x10) == 0 && (!(nmk16_mainram[0x9000/2] & 0x0100))) // start 2 + start_helper = (nmk16_mainram[0x9000/2] == 0x8000) ? (3) : (2); + + input_pressed = (input_pressed & 0xef) | 0x10; + } + else + input_pressed = (input_pressed & 0xef); + } +} + +//------------------------------------------------------------------------------------------------- + +void __fastcall tharrier_main_write_byte(UINT32 address, UINT8 data) +{ + STRANGE_RAM_WRITE_BYTE(0xf0000) +} + +void __fastcall tharrier_main_write_word(UINT32 address, UINT16 data) +{ + STRANGE_RAM_WRITE_WORD(0xf0000) + + switch (address) + { + case 0x080010: // mcu write.. unused... + return; + + case 0x08001e: + *soundlatch = data; + return; + } +} + +UINT8 __fastcall tharrier_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[0] >> 8; + + case 0x080001: + return DrvInputs[0]; + + case 0x080002: + return tharrier_mcu_r(); + + case 0x080003: + return DrvInputs[1]; + + case 0x080004: + return DrvDips[1]; + + case 0x080005: + return DrvDips[0]; + + case 0x08000e: + case 0x08000f: + return *soundlatch2; + + case 0x080202: + return DrvInputs[2] >> 8; + + case 0x080203: + return DrvInputs[2]; + } + + return 0; +} + +UINT16 __fastcall tharrier_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1]; + + case 0x080004: + return (DrvDips[0] << 8) | DrvDips[1]; + + case 0x08000e: + return *soundlatch2; + + case 0x080202: + return DrvInputs[2]; + } + + return 0; +} + +void __fastcall manybloc_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x080014: + case 0x080015: + // *flipscreen = data & 1; + return; + + case 0x08001e: + case 0x08001f: + *soundlatch = data; + return; + } +} + +void __fastcall manybloc_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x080014: + // *flipscreen = data & 1; + return; + + case 0x08001e: + *soundlatch = data; + return; + } +} + +UINT8 __fastcall manybloc_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[0] >> 8; + + case 0x080001: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1] >> 8; + + case 0x080003: + return DrvInputs[1]; + + case 0x080004: + return DrvDips[0]; + + case 0x080005: + return DrvDips[1]; + + case 0x08001e: + case 0x08001f: + return *soundlatch2; + } + + return 0; +} + +UINT16 __fastcall manybloc_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1]; + + case 0x080004: + return (DrvDips[0] << 8) | DrvDips[1]; + + case 0x08001e: + return *soundlatch2; + } + + return 0; +} + +void __fastcall ssmissin_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x0c0014: + case 0x0c0015: + // *flipscreen = data & 1; + return; + + case 0x0c0018: + case 0x0c0019: + if (data != 0xff) { + *tilebank = data; + } + return; + + case 0x0c001e: + case 0x0c001f: + *soundlatch = data; + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + } +} + +void __fastcall ssmissin_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x0c0014: + // *flipscreen = data & 1; + return; + + case 0x0c0018: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x0c001e: + *soundlatch = data; + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + } +} + +UINT8 __fastcall ssmissin_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x0c0000: + return DrvInputs[0] >> 8; + + case 0x0c0001: + return DrvInputs[0]; + + case 0x0c0004: + return DrvInputs[1] >> 8; + + case 0x0c0005: + return DrvInputs[1]; + + case 0x0c0006: + return DrvDips[0]; + + case 0x0c0007: + return DrvDips[1]; + } + + return 0; +} + +UINT16 __fastcall ssmissin_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x0c0000: + return DrvInputs[0]; + + case 0x0c0004: + return DrvInputs[1]; + + case 0x0c0006: + return (DrvDips[0] << 8) | DrvDips[1]; + } + + return 0; +} + +UINT8 __fastcall macross2_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x100000: + return DrvInputs[0] >> 8; + + case 0x100001: + return DrvInputs[0]; + + case 0x100002: + return DrvInputs[1] >> 8; + + case 0x100003: + return DrvInputs[1]; + + case 0x100008: + case 0x100009: + return DrvDips[0]; + + case 0x10000a: + case 0x10000b: + return DrvDips[1]; + + case 0x10000e: + case 0x10000f: + return *soundlatch2; + } + + return 0; +} + +UINT16 __fastcall macross2_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x100000: + return DrvInputs[0]; + + case 0x100002: + return DrvInputs[1]; + + case 0x100008: + return (DrvDips[0] << 8) | DrvDips[0]; + + case 0x10000a: + return (DrvDips[1] << 8) | DrvDips[1]; + + case 0x10000e: + return *soundlatch2; + } + + return 0; +} + +void __fastcall macross2_main_write_byte(UINT32 address, UINT8 data) +{ + bprintf (0, _T("%x, %x wb\n"), address, data); + + switch (address) + { + case 0x100014: + case 0x100015: + // *flipscreen = data & 1; + return; + } +} + +void __fastcall macross2_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x100014: + // *flipscreen = data & 1; + return; + + case 0x100016: + if (data == 0) { + if (macross2_sound_enable != 0) { + ZetReset(); + } + } + macross2_sound_enable = data; + return; + + case 0x100018: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x10001e: + *soundlatch = data; + return; + } +} + +void __fastcall afega_main_write_word(UINT32 address, UINT16 data) +{ + if (address & 0xfff00000) { + SekWriteWord(address & 0xfffff, data); + return; + } + + STRANGE_RAM_WRITE_WORD(0xc0000) + STRANGE_RAM_WRITE_WORD(0xf0000) + + switch (address) + { + case 0x080014: + // *flipscreen = data & 1; + return; + + + case 0x08001e: + *soundlatch = data & 0xff; + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + } +} + +void __fastcall afega_main_write_byte(UINT32 address, UINT8 data) +{ + if (address & 0xfff00000) { + SekWriteByte(address & 0xfffff, data); + return; + } + + STRANGE_RAM_WRITE_BYTE(0xc0000) + STRANGE_RAM_WRITE_BYTE(0xf0000) + + switch (address) + { + case 0x080014: + case 0x080015: + // *flipscreen = data & 1; + return; + + case 0x08001e: + case 0x08001f: + *soundlatch = data & 0xff; + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + return; + } +} + +UINT8 __fastcall afega_main_read_byte(UINT32 address) +{ + if (address & 0xfff00000) { + return SekReadByte(address & 0xfffff); + } + + switch (address) + { + case 0x080000: + return DrvInputs[0] >> 8; + + case 0x080001: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1] >> 8; + + case 0x080003: + return DrvInputs[1]; + + case 0x080004: + return DrvDips[0]; + + case 0x080005: + return DrvDips[1]; + + case 0x080012: + case 0x080013: + return 0x01; + } + + return 0; +} + +UINT16 __fastcall afega_main_read_word(UINT32 address) +{ + if (address & 0xfff00000) { + return SekReadWord(address & 0xfffff); + } + + switch (address) + { + case 0x080000: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1]; + + case 0x080004: + return ((DrvDips[0] << 8) | DrvDips[1]); + + case 0x080012: + return 0x0100; + } + + return 0; +} + +void __fastcall bjtwin_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x080014: + case 0x080015: + // *flipscreen = data & 1; + return; + + case 0x094000: + case 0x094001: + if (data != 0xff) { + *tilebank = data; + } + return; + } +} + +void __fastcall bjtwin_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x080014: + // *flipscreen = data & 1; + return; + + case 0x084000: + MSM6295Command(0, data & 0xff); + return; + + case 0x084010: + MSM6295Command(1, data & 0xff); + return; + + case 0x084020: + case 0x084022: + case 0x084024: + case 0x084026: + case 0x084028: + case 0x08402a: + case 0x08402c: + case 0x08402e: + NMK112_okibank_write((address >> 1) & 7, data); + return; + + case 0x094000: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + } +} + +UINT8 __fastcall bjtwin_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[0] >> 8; + + case 0x080001: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1] >> 8; + + case 0x080003: + return DrvInputs[1]; + + case 0x080008: + case 0x080009: + return DrvDips[0]; + + case 0x08000a: + case 0x08000b: + return DrvDips[1]; + + case 0x084000: + case 0x084001: + return MSM6295ReadStatus(0); + + case 0x084010: + case 0x084011: + return MSM6295ReadStatus(1); + } + + return 0; +} + +UINT16 __fastcall bjtwin_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1]; + + case 0x080008: + return 0xff00 | DrvDips[0]; + + case 0x08000a: + return 0xff00 | DrvDips[1]; + + case 0x084000: + return MSM6295ReadStatus(0); + + case 0x084010: + return MSM6295ReadStatus(1); + } + + return 0; +} + +void __fastcall mustangb_main_write_word(UINT32 address, UINT16 data) +{ + STRANGE_RAM_WRITE_WORD(0xf0000) + + switch (address) + { + case 0x080014: + case 0x0c0014: + // *flipscreen = data & 1; + return; + + case 0x08001e: + case 0x0c001e: + // bprintf (0, _T("%6.6x, %x,\n"), SekGetPC(-1), data); + seibu_sound_mustb_write_word(0, data); + return; + } +} + +void __fastcall mustangb_main_write_byte(UINT32 address, UINT8 data) +{ + STRANGE_RAM_WRITE_BYTE(0xf0000) + + switch (address) + { + case 0x080014: + case 0x080015: + case 0x0c0014: + case 0x0c0015: + // *flipscreen = data & 1; + return; + + case 0x08001e: + case 0x08001f: + case 0x0c001e: + case 0x0c001f: + // bprintf (0, _T("%6.6x, %x,\n"), SekGetPC(-1), data); + seibu_sound_mustb_write_word(0, data); + return; + } +} + +UINT16 __fastcall mustangb_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x080000: + case 0x0c0000: + return DrvInputs[0]; + + case 0x080002: + case 0x0c0002: + return DrvInputs[1]; + + case 0x080004: + case 0x0c0008: + return (DrvDips[0] << 8) | DrvDips[1]; + + case 0x0c000a: + return 0xff00 | DrvDips[1]; + } + + return 0; +} + +UINT8 __fastcall mustangb_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x080000: + case 0x0c0000: + return DrvInputs[0] >> 8; + + case 0x080001: + case 0x0c0001: + return DrvInputs[0]; + + case 0x080002: + case 0x0c0002: + return DrvInputs[1] >> 8; + + case 0x080003: + case 0x0c0003: + return DrvInputs[1]; + + case 0x080004: + case 0x0c0008: + return DrvDips[1]; + + case 0x080005: + case 0x0c0009: + return DrvDips[0]; + + case 0x0c000a: + case 0x0c000b: + return DrvDips[1]; + } + + return 0; +} + +UINT8 __fastcall mustang_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x080000: + case 0x080001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x080002: + case 0x080003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x080004: + case 0x080005: + return DrvDips[address & 1]; + + case 0x08000e: + case 0x08000f: + return NMK004Read(); + } + + return 0; +} + +UINT16 __fastcall mustang_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1]; + + case 0x080004: + return (DrvDips[0] << 8) | DrvDips[1]; + + case 0x08000e: + return NMK004Read(); + } + + return 0; +} + +void __fastcall mustang_main_write_word(UINT32 address, UINT16 data) +{ + STRANGE_RAM_WRITE_WORD(0xf0000) + + switch (address) + { + case 0x080014: + // *flipscreen = data & 1; + return; + + case 0x08001e: + NMK004Write(0, data); + return; + } +} + +void __fastcall mustang_main_write_byte(UINT32 address, UINT8 data) +{ + STRANGE_RAM_WRITE_BYTE(0xf0000) +} + +UINT8 __fastcall acrobatm_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x0c0000: + case 0x0c0001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x0c0002: + case 0x0c0003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x0c0008: + case 0x0c0009: + return DrvDips[0]; + + case 0x0c000a: + case 0x0c000b: + return DrvDips[1]; + } + + return 0; +} + +UINT16 __fastcall acrobatm_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x0c0000: + return DrvInputs[0]; + + case 0x0c0002: + return DrvInputs[1]; + + case 0x0c0008: + return DrvDips[0]; + + case 0x0c000a: + return DrvDips[1]; + + case 0x0c000e: + return NMK004Read(); + } + + return 0; +} + +void __fastcall acrobatm_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x0c0014: + case 0x0c0015: + // *flipscreen = data & 1; + return; + + case 0x0c0018: + case 0x0c0019: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x0c001e: + case 0x0c001f: + NMK004Write(0, data); + return; + } +} + +void __fastcall acrobatm_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x0c0014: + case 0x0c0015: + // *flipscreen = data & 1; + return; + + case 0x0c0018: + case 0x0c0019: + if (data != 0xff) { + *tilebank = data; + } + return; + + case 0x0c001e: + case 0x0c001f: + NMK004Write(0, data); + return; + } +} + +UINT8 __fastcall tdragon_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x0c0000: + case 0x0c0001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x0c0002: + case 0x0c0003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x0c0008: + case 0x0c0009: + return DrvDips[0]; + + case 0x0c000a: + case 0x0c000b: + return DrvDips[1]; + } + + return 0; +} + +UINT16 __fastcall tdragon_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x0c0000: + return DrvInputs[0]; + + case 0x0c0002: + return DrvInputs[1]; + + case 0x0c0008: + return DrvDips[0]; + + case 0x0c000a: + return DrvDips[1]; + + case 0x0c000e: + return NMK004Read(); + } + + return 0; +} + +void __fastcall tdragon_main_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xffff0000) == 0x0b0000) { + *((UINT16*)(Drv68KRAM + (address & 0xfffe))) = BURN_ENDIAN_SWAP_INT16(data); + tdragon_mainram_w((address >> 1) & 0x7fff); + return; + } + + switch (address) + { + case 0x0c0014: + // *flipscreen = data & 1; + return; + + case 0x0c0018: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x0c001e: + NMK004Write(0, data); + return; + } +} + +void __fastcall tdragon_main_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xffff0000) == 0x0b0000) { + Drv68KRAM [(address & 0xffff) ^ 1] = data; + tdragon_mainram_w((address >> 1) & 0x7fff); + return; + } + + switch (address) + { + case 0x0c0014: + case 0x0c0015: + // *flipscreen = data & 1; + return; + + case 0x0c0018: + case 0x0c0019: + if (data != 0xff) { + *tilebank = data; + } + return; + + case 0x0c001e: + case 0x0c001f: + NMK004Write(0, data); + return; + } +} + + +UINT8 __fastcall macross_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x080000: + case 0x080001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x080002: + case 0x080003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x080008: + case 0x080009: + return DrvDips[0]; + + case 0x08000a: + case 0x08000b: + return DrvDips[1]; + + case 0x08000e: + case 0x08000f: + return NMK004Read(); + } + + return 0; +} + +UINT16 __fastcall macross_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1]; + + case 0x080008: + return (DrvDips[0] << 8) | DrvDips[0]; + + case 0x08000a: + return (DrvDips[1] << 8) | DrvDips[1]; + + case 0x08000e: + return NMK004Read(); + } + + return 0; +} + +void __fastcall macross_main_write_word(UINT32 address, UINT16 data) +{ + STRANGE_RAM_WRITE_WORD(0xf0000) + + switch (address) + { + case 0x080014: + // *flipscreen = data & 1; + return; + + case 0x080018: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x08001e: + NMK004Write(0, data); + return; + + case 0x084000: + if ((data & 0xff) != 0xff) + *tilebank = data; // bioship + return; + } +} + +void __fastcall macross_main_write_byte(UINT32 address, UINT8 data) +{ + STRANGE_RAM_WRITE_BYTE(0xf0000) + + switch (address) + { + case 0x080014: + case 0x080015: + // *flipscreen = data & 1; + return; + + case 0x080018: + case 0x080019: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x08001e: + case 0x08001f: + NMK004Write(0, data); + return; + + case 0x084000: + case 0x084001: + if ((data & 0xff) != 0xff) { + *tilebank = data; // bioship + } + return; + } +} + +void __fastcall vandykeb_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x080010: + *((UINT16 *)(DrvScrollRAM + 0x06)) = data; + return; + + case 0x080012: + *((UINT16 *)(DrvScrollRAM + 0x04)) = data; + return; + + case 0x080014: + // *flipscreen = data & 1; + return; + + case 0x080018: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x08001a: + *((UINT16 *)(DrvScrollRAM + 0x02)) = data; + return; + + case 0x08001c: + *((UINT16 *)(DrvScrollRAM + 0x00)) = data; + return; + + case 0x08001e: + // write to PIC + return; + } +} + +void __fastcall vandykeb_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x080010: + DrvScrollRAM[7] = data; + return; + + case 0x080014: + case 0x080015: + // *flipscreen = data & 1; + return; + + case 0x080018: + case 0x080019: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x08001a: + DrvScrollRAM[3] = data; + return; + + case 0x08001e: + case 0x08001f: + // write to PIC + return; + } +} + +UINT8 __fastcall hachamf_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x080000: + case 0x080001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x080002: + case 0x080003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x08000a: + case 0x08000b: + return 0; // ?? + + case 0x08000e: + case 0x08000f: + return NMK004Read(); + } + + return 0; +} + +UINT16 __fastcall hachamf_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1]; + + case 0x080008: + return (DrvDips[0] << 8) | DrvDips[1]; + + case 0x08000a: + return 0; // ?? + + case 0x08000e: + return NMK004Read(); + } + + return 0; +} + +void __fastcall hachamf_main_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xffff0000) == 0xf0000) { + *((UINT16*)(Drv68KRAM + (address & 0xfffe))) = data; + HachaRAMProt((address & 0xffff) >> 1); + return; + } + + switch (address) + { + case 0x080014: + // *flipscreen = data & 1; + return; + + case 0x080018: + if ((data & 0xff) != 0xff) { + *tilebank = data & 0xff; + } + return; + + case 0x08001e: + NMK004Write(0, data); + return; + } +} + +void __fastcall hachamf_main_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xffff0000) == 0xf0000) { + Drv68KRAM[(address & 0xffff) ^ 1] = data; + HachaRAMProt((address & 0xffff) >> 1); + return; + } + + switch (address) + { + case 0x080014: + case 0x080015: + // *flipscreen = data & 1; + return; + + case 0x080018: + case 0x080019: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x08001e: + case 0x08001f: + NMK004Write(0, data); + return; + } +} + +void __fastcall raphero_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x100014: + case 0x100015: + // *flipscreen = data & 1; + return; + + case 0x100018: + case 0x100019: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x10001e: + case 0x10001f: + *soundlatch = data; + return; + } +} + +void __fastcall raphero_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x100014: + // *flipscreen = data & 1; + return; + + case 0x100018: + if ((data & 0xff) != 0xff) { + *tilebank = data; + } + return; + + case 0x10001e: + *soundlatch = data & 0xff; + return; + } +} + +UINT8 __fastcall raphero_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x100000: + case 0x100001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x100002: + case 0x100003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x100008: + case 0x100009: + return DrvDips[0]; + + case 0x10000a: + case 0x10000b: + return DrvDips[1]; + + case 0x10000e: + case 0x10000f: + return *soundlatch2; + } + + return 0; +} + +UINT16 __fastcall raphero_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x100000: + return DrvInputs[0]; + + case 0x100002: + return DrvInputs[1]; + + case 0x100008: + return DrvDips[0]; + + case 0x10000a: + return DrvDips[1]; + + case 0x10000e: + return *soundlatch2; + } + + return 0; +} + + +//----------------------------------------------------------------------------------------------------- + + +static void tharrier_sound_bankswitch(UINT8 *rom, INT32 bank) +{ + if (bank < 3) { + memcpy (rom + 0x20000, rom + 0x40000 + (bank * 0x20000), 0x20000); + } +} + +void __fastcall tharrier_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf000: + *soundlatch2 = data; + return; + + case 0xf400: + MSM6295Command(0, data); + return; + + case 0xf500: + MSM6295Command(0, data); + return; + + case 0xf600: + tharrier_sound_bankswitch(DrvSndROM0, data & 3); + return; + + case 0xf700: + tharrier_sound_bankswitch(DrvSndROM1, data & 3); + return; + } +} + +UINT8 __fastcall tharrier_sound_read(UINT16 address) +{ + switch (address) + { + case 0xf000: + return *soundlatch; + + case 0xf400: + return MSM6295ReadStatus(0); + + case 0xf500: + return MSM6295ReadStatus(1); + } + + return 0; +} + +void __fastcall tharrier_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + BurnYM2203Write(0, 0, data); + return; + + case 0x01: + BurnYM2203Write(0, 1, data); + return; + } +} + +UINT8 __fastcall tharrier_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + return BurnYM2203Read(0, 0); + } + + return 0; +} + +static void ssmissin_okibank(INT32 bank) +{ + memcpy(DrvSndROM0 + 0x20000, DrvSndROM0 + 0x40000 + (bank & 3) * 0x20000, 0x20000); +} + +void __fastcall ssmissin_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x9000: + ssmissin_okibank(data); + return; + + case 0x9800: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall ssmissin_sound_read(UINT16 address) +{ + switch (address) + { + case 0x9800: + return MSM6295ReadStatus(0); + + case 0xa000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +void __fastcall afega_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf808: + BurnYM2151SelectRegister(data); + return; + + case 0xf809: + BurnYM2151WriteRegister(data); + return; + + case 0xf80a: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall afega_sound_read(UINT16 address) +{ + switch (address) + { + case 0xf800: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0xf808: + case 0xf809: + return BurnYM2151ReadStatus(); + + case 0xf80a: + return MSM6295ReadStatus(0); + } + + return 0; +} + +void __fastcall firehawk_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xfff2: + if (data == 0xfe) + memcpy (DrvSndROM1, DrvSndROM1 + 0x40000, 0x40000); + else if(data == 0xff) + memcpy (DrvSndROM1, DrvSndROM1 + 0x80000, 0x40000); + return; + + case 0xfff8: + MSM6295Command(1, data); + return; + + case 0xfffa: + MSM6295Command(0, data); + return; + } + + if (address >= 0xfe00) { + DrvZ80RAM[address & 0xfff] = data; + return; + } +} + +UINT8 __fastcall firehawk_sound_read(UINT16 address) +{ + switch (address) + { + case 0xfff0: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + + case 0xfff8: + return MSM6295ReadStatus(1); + + case 0xfffa: + return MSM6295ReadStatus(0); + } + + if (address >= 0xfe00) { + return DrvZ80RAM[address & 0xfff]; + } + + return 0; +} + +static void macross2_sound_bank(INT32 bank) +{ + bank = (bank & 7) * 0x4000; + + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x10000 + bank); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x10000 + bank); +} + +void __fastcall macross2_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe001: + macross2_sound_bank(data); + return; + + case 0xf000: + *soundlatch2 = data; + return; + } +} + +UINT8 __fastcall macross2_sound_read(UINT16 address) +{ + if (address == 0xf000) return *soundlatch; + + return 0; +} + +void __fastcall macross2_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + BurnYM2203Write(0, 0, data); + return; + + case 0x01: + BurnYM2203Write(0, 1, data); + return; + + case 0x80: + MSM6295Command(0, data); + return; + + case 0x88: + MSM6295Command(1, data); + return; + + case 0x90: + case 0x91: + case 0x92: + case 0x93: + case 0x94: + case 0x95: + case 0x96: + case 0x97: + NMK112_okibank_write(port & 7, data); + return; + } +} + +UINT8 __fastcall macross2_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + return BurnYM2203Read(0, 0); + + case 0x80: + return MSM6295ReadStatus(0); + + case 0x88: + return MSM6295ReadStatus(1); + } + + return 0; +} + +//----------------------------------------------------------------------------------------------------- + +static void DrvYM2203IrqHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static void DrvYM2151IrqHandler(INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(ZetTotalCycles() * nSoundRate / 3000000); +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3000000; +} + +inline static INT32 Macross2SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(ZetTotalCycles() * nSoundRate / 4000000); +} + +inline static double Macross2GetTime() +{ + return (double)ZetTotalCycles() / 4000000; +} + +static void NMK004YM2203IrqHandler(INT32, INT32 nStatus) +{ + NMK004_irq(nStatus); +} + +inline static double NMK004GetTime() +{ + return (double)SekTotalCycles() / nNMK004CpuSpeed; +} + +inline static INT32 NMK004SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(SekTotalCycles() * nSoundRate / nNMK004CpuSpeed); +} + +static void MSM6295SetInitialBanks(INT32 chips) +{ + INT32 len = DrvSndROM1 - DrvSndROM0; + + for (INT32 i = 0; i < chips; i++) { + for (INT32 nChannel = 0; nChannel < 4; nChannel++) { + MSM6295SampleInfo[i][nChannel] = MSM6295ROM + (i * len) + (nChannel << 8); + MSM6295SampleData[i][nChannel] = MSM6295ROM + (i * len) + (nChannel << 16); + } + } +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + MSM6295Reset(0); + MSM6295Reset(1); + + MSM6295SetInitialBanks(2); + + macross2_sound_enable = -1; + prot_count = 0; + + return 0; +} + +static INT32 SmissinDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + + return 0; +} + +static INT32 AfegaDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + MSM6295Reset(0); + MSM6295Reset(1); + + MSM6295SetInitialBanks(2); + + return 0; +} + +static INT32 BjtwinDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + MSM6295Reset(0); + MSM6295Reset(1); + + NMK112Reset(); + MSM6295SetInitialBanks(2); + + return 0; +} + +static INT32 SeibuSoundDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + seibu_sound_reset(); + MSM6295SetInitialBanks(2); + + return 0; +} + +static INT32 NMK004DoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + BurnYM2203Reset(); + + MSM6295Reset(0); + MSM6295Reset(1); + + MSM6295SetInitialBanks(2); + + SekOpen(0); + NMK004_init(); + SekClose(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x080000; + DrvZ80ROM = Next; Next += 0x030000; + + DrvGfxROM0 = Next; Next += 0x040000; + DrvGfxROM1 = Next; Next += 0x800000; + DrvGfxROM2 = Next; Next += 0x800000; + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "raphero") == 0) { + Next += 0x800000; + } + + DrvTileROM = Next; Next += 0x020000; + + MSM6295ROM = Next; + + DrvSndROM0 = Next; Next += 0x300000; + DrvSndROM1 = Next; Next += 0x300000; + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "raphero") == 0) { + Next += 0x600000; + } + + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + AllRam = Next; + + DrvPalRAM = Next; Next += 0x000800; + Drv68KRAM = Next; Next += 0x010000; + DrvBgRAM0 = Next; Next += 0x004000; + DrvBgRAM1 = Next; Next += 0x004000; + DrvBgRAM2 = Next; Next += 0x004000; + DrvBgRAM3 = Next; Next += 0x004000; + DrvTxRAM = Next; Next += 0x001000; + DrvScrollRAM = Next; Next += 0x001000; + + DrvSprBuf = Next; Next += 0x001000; + DrvSprBuf2 = Next; Next += 0x001000; + + DrvZ80RAM = Next; Next += 0x002000; + + soundlatch = Next; Next += 0x000001; + soundlatch2 = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + tilebank = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode(INT32 len0, INT32 len1, INT32 len2) +{ + INT32 Plane[4] = { 0x000, 0x001, 0x002, 0x003 }; + INT32 XOffs[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, + 0x200, 0x204, 0x208, 0x20c, 0x210, 0x214, 0x218, 0x21c }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc((len2 >= len1) ? len2 : len1); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, len0); + + GfxDecode((len0 * 2) / ( 8 * 8), 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, len1); + + GfxDecode((len1 * 2) / (16 * 16), 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, len2); + + GfxDecode((len2 * 2) / (16 * 16), 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); + + nGraphicsMask[0] = ((len0 * 2) / ( 8 * 8)) - 1; + nGraphicsMask[1] = ((len1 * 2) / (16 * 16)) - 1; + nGraphicsMask[2] = ((len2 * 2) / (16 * 16)) - 1; + + BurnFree (tmp); + + return 0; +} + +static INT32 BjtwinGfxDecode(INT32 len0, INT32 len1, INT32 len2) +{ + INT32 Plane[4] = { 0x000, 0x001, 0x002, 0x003 }; + INT32 XOffs[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, + 0x200, 0x204, 0x208, 0x20c, 0x210, 0x214, 0x218, 0x21c }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc((len2 >= len1) ? len2 : len1); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, len0); + + GfxDecode((len0 * 2) / ( 8 * 8), 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, len1); + + GfxDecode((len1 * 2) / ( 8 * 8), 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, len2); + + GfxDecode((len2 * 2) / (16 * 16), 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); + + nGraphicsMask[0] = ((len0 * 2) / ( 8 * 8)) - 1; + nGraphicsMask[1] = ((len1 * 2) / ( 8 * 8)) - 1; + nGraphicsMask[2] = ((len2 * 2) / (16 * 16)) - 1; + + BurnFree (tmp); + + return 0; +} + +static INT32 GrdnstrmGfxDecode(INT32 len0, INT32 len1, INT32 len2) +{ + INT32 Plane[8] = { 0x000, 0x001, 0x002, 0x003, (len1*4), (len1*4)+1, (len1*4)+2, (len1*4)+3 }; + INT32 XOffs[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, + 0x200, 0x204, 0x208, 0x20c, 0x210, 0x214, 0x218, 0x21c }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc((len2 >= len1) ? len2 : len1); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, len0); + + GfxDecode((len0 * 2) / ( 8 * 8), 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, len1); + + GfxDecode((len1 * 1) / (16 * 16), 8, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, len2); + + GfxDecode((len2 * 2) / (16 * 16), 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM2); + + nGraphicsMask[0] = ((len0 * 2) / ( 8 * 8)) - 1; + nGraphicsMask[1] = ((len1 * 1) / (16 * 16)) - 1; + nGraphicsMask[2] = ((len2 * 2) / (16 * 16)) - 1; + is_8bpp = 1; + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit(INT32 (*pLoadCallback)()) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (pLoadCallback) { + if (pLoadCallback()) return 1; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(tharrier_sound_write); + ZetSetReadHandler(tharrier_sound_read); + ZetSetOutHandler(tharrier_sound_out); + ZetSetInHandler(tharrier_sound_in); + ZetClose(); + + BurnSetRefreshRate(56.00); + + BurnYM2203Init(1, 1500000, &DrvYM2203IrqHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 2.00, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.50, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.50, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.50, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 4000000 / 165, 1); + MSM6295Init(1, 4000000 / 165, 1); + MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 0.20, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 BjtwinInit(INT32 (*pLoadCallback)()) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (pLoadCallback) { + if (pLoadCallback()) return 1; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x09c000, 0x09cfff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x09d000, 0x09dfff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); + SekSetWriteWordHandler(0, bjtwin_main_write_word); + SekSetWriteByteHandler(0, bjtwin_main_write_byte); + SekSetReadWordHandler(0, bjtwin_main_read_word); + SekSetReadByteHandler(0, bjtwin_main_read_byte); + SekClose(); + + BurnSetRefreshRate(56.00); + + MSM6295Init(0, 4000000 / 165, 1); + MSM6295Init(1, 4000000 / 165, 1); + MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 0.20, BURN_SND_ROUTE_BOTH); + + NMK112_init(0, DrvSndROM0, DrvSndROM1, 0x140000, 0x140000); + + GenericTilesInit(); + + BjtwinDoReset(); + + return 0; +} + +static INT32 Macross2Init() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; + memcpy (DrvZ80ROM + 0x10000, DrvZ80ROM, 0x20000); + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x200000, 5, 1)) return 1; + BurnByteswap(DrvGfxROM2, 0x400000); + + if (BurnLoadRom(DrvSndROM0 + 0x040000, 6, 1)) return 1; + memcpy (DrvSndROM0, DrvSndROM0 + 0x40000, 0x40000); + + if (BurnLoadRom(DrvSndROM1 + 0x040000, 7, 1)) return 1; + memcpy (DrvSndROM1, DrvSndROM1 + 0x40000, 0x40000); + + DrvGfxDecode(0x20000, 0x200000, 0x400000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x120000, 0x1207ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x130000, 0x1307ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x140000, 0x143fff, SM_RAM); + SekMapMemory(DrvBgRAM1, 0x144000, 0x147fff, SM_RAM); + SekMapMemory(DrvBgRAM2, 0x148000, 0x14bfff, SM_RAM); + SekMapMemory(DrvBgRAM3, 0x14c000, 0x14ffff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x170000, 0x170fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x171000, 0x171fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x1f0000, 0x1fffff, SM_RAM); + SekSetWriteWordHandler(0, macross2_main_write_word); + SekSetWriteByteHandler(0, macross2_main_write_byte); + SekSetReadWordHandler(0, macross2_main_read_word); + SekSetReadByteHandler(0, macross2_main_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x8000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x8000); + ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM); + ZetSetWriteHandler(macross2_sound_write); + ZetSetReadHandler(macross2_sound_read); + ZetSetOutHandler(macross2_sound_out); + ZetSetInHandler(macross2_sound_in); + ZetClose(); + + BurnSetRefreshRate(56.00); + + BurnYM2203Init(1, 1500000, &DrvYM2203IrqHandler, Macross2SynchroniseStream, Macross2GetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2203SetAllRoutes(0, 0.90, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 4000000 / 165, 1); + MSM6295Init(1, 4000000 / 165, 1); + MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 0.20, BURN_SND_ROUTE_BOTH); + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "macross2") == 0) { + NMK112_init(0, DrvSndROM0, DrvSndROM1, 0x240000, 0x140000); + } else { + NMK112_init(0, DrvSndROM0, DrvSndROM1, 0x240000, 0x240000); + } + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 MSM6295x1Init(INT32 (*pLoadCallback)()) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (pLoadCallback) { + if (pLoadCallback()) return 1; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(ssmissin_sound_write); + ZetSetReadHandler(ssmissin_sound_read); + ZetClose(); + + BurnSetRefreshRate(56.00); + + MSM6295Init(0, 1000000 / 165, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + SmissinDoReset(); + + return 0; +} + +static INT32 SeibuSoundInit(INT32 (*pLoadCallback)(), INT32 type) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (pLoadCallback) { + if (pLoadCallback()) return 1; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + + if (type) { // mustangb + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); + } else { // tdragonb + SekMapMemory(Drv68KRAM, 0x0b0000, 0x0bffff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x0c4000, 0x0c43ff, SM_WRITE); + SekMapMemory(DrvPalRAM, 0x0c8000, 0x0c87ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x0cc000, 0x0cffff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x0d0000, 0x0d07ff, SM_RAM); + } + SekSetWriteWordHandler(0, mustangb_main_write_word); + SekSetWriteByteHandler(0, mustangb_main_write_byte); + SekSetReadWordHandler(0, mustangb_main_read_word); + SekSetReadByteHandler(0, mustangb_main_read_byte); + SekClose(); + + BurnSetRefreshRate(56.00); + + SeibuZ80ROM = DrvZ80ROM; + SeibuZ80RAM = DrvZ80RAM; + seibu_sound_init(0, 0, 3579545, 3579545, 1320000 / 132); + + GenericTilesInit(); + + SeibuSoundDoReset(); + + return 0; +} + +static INT32 AfegaInit(INT32 (*pLoadCallback)(), void (*pZ80Callback)(), INT32 pin7high) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (pLoadCallback) { + if (pLoadCallback()) return 1; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x084000, 0x0843ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0c0000, 0x0cffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); + SekSetWriteWordHandler(0, afega_main_write_word); + SekSetWriteByteHandler(0, afega_main_write_byte); + SekSetReadWordHandler(0, afega_main_read_word); + SekSetReadByteHandler(0, afega_main_read_byte); + SekClose(); + + if (pZ80Callback) { + pZ80Callback(); + } + + BurnSetRefreshRate(56.00); + + BurnYM2151Init(4000000); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.30, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.30, BURN_SND_ROUTE_RIGHT); + + MSM6295Init(0, 1000000 / (pin7high ? 132 : 165), 1); + MSM6295Init(1, 1000000 / (pin7high ? 132 : 165), 1); + MSM6295SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + AfegaDoReset(); + + return 0; +} + +static INT32 NMK004Init(INT32 (*pLoadCallback)(), INT32 nCpuSpeed, INT32 pin7high, INT32 irq2) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + nNMK004CpuSpeed = nCpuSpeed; + nNMK004EnableIrq2 = irq2; + + if (pLoadCallback) { + pLoadCallback(); + } + + BurnSetRefreshRate(56.00); + + BurnYM2203Init(1, 1500000, &NMK004YM2203IrqHandler, NMK004SynchroniseStream, NMK004GetTime, 0); + BurnTimerAttachSek(nNMK004CpuSpeed); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 2.00, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.50, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.50, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.50, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 4000000 / (pin7high ? 132 : 165), 1); + MSM6295Init(1, 4000000 / (pin7high ? 132 : 165), 1); + MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 0.20, BURN_SND_ROUTE_BOTH); + + NMK004OKIROM0 = DrvSndROM0; + NMK004OKIROM1 = DrvSndROM1; + NMK004PROGROM = DrvZ80ROM; + + GenericTilesInit(); + + NMK004DoReset(); + + return 0; +} + +static INT32 CommonExit() +{ + GenericTilesExit(); + + SekExit(); + + BurnFree (AllMem); + + input_high[0] = input_high[1] = 0; + is_8bpp = 0; + global_y_offset = 16; + videoshift = 0; + screen_flip_y = 0; + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + BurnYM2203Exit(); + MSM6295Exit(0); + MSM6295Exit(1); + MSM6295ROM = NULL; + + return CommonExit(); +} + +static INT32 MSM6295x1Exit() +{ + ZetExit(); + MSM6295Exit(0); + MSM6295ROM = NULL; + + return CommonExit(); +} + +static INT32 SeibuSoundExit() +{ + GenericTilesExit(); + + seibu_sound_exit(); + SekExit(); + + BurnFree (AllMem); + + input_high[0] = input_high[1] = 0; + is_8bpp = 0; + global_y_offset = 16; + videoshift = 0; + + return 0; +} + +static INT32 AfegaExit() +{ + ZetExit(); + BurnYM2151Exit(); + MSM6295Exit(0); + MSM6295Exit(1); + MSM6295ROM = NULL; + + return CommonExit(); +} + +static INT32 BjtwinExit() +{ + MSM6295Exit(0); + MSM6295Exit(1); + MSM6295ROM = NULL; + + return CommonExit(); +} + + +static INT32 NMK004Exit() +{ + BurnYM2203Exit(); + MSM6295Exit(0); + MSM6295Exit(1); + MSM6295ROM = NULL; + + return CommonExit(); +} + +//------------------------------------------------------------------------------------------------------------------ + +static void DrvPaletteRecalc() +{ + UINT8 r,g,b; + UINT16 *pal = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x400; i++) { + INT32 data = BURN_ENDIAN_SWAP_INT16(pal[i]); + + r = ((data >> 11) & 0x1e) | ((data >> 3) & 0x01); + g = ((data >> 7) & 0x1e) | ((data >> 2) & 0x01); + b = ((data >> 3) & 0x1e) | ((data >> 1) & 0x01); + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static void draw_sprites(INT32 flip, INT32 coloff, INT32 coland, INT32 priority) +{ + UINT16 *sprram = (UINT16*)DrvSprBuf2; + + for (INT32 offs = 0; offs < 0x1000/2; offs += 8) + { + if (BURN_ENDIAN_SWAP_INT16(sprram[offs]) & 0x0001) + { + INT32 sx = (BURN_ENDIAN_SWAP_INT16(sprram[offs+4]) & 0x01ff) + videoshift; + INT32 sy = (BURN_ENDIAN_SWAP_INT16(sprram[offs+6]) & 0x01ff); + INT32 code = BURN_ENDIAN_SWAP_INT16(sprram[offs+3]) & nGraphicsMask[2]; + INT32 color = BURN_ENDIAN_SWAP_INT16(sprram[offs+7]) & coland; + INT32 w = (BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x000f); + INT32 h = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x00f0) >> 4); + INT32 pri = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+0]) & 0x00c0) >> 6); + INT32 flipy = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x0200) >> 9); + INT32 flipx = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x0100) >> 8); + + if (!flip) flipy = flipx = 0; + + color = (color << 4) + coloff; + + INT32 delta = 16; + + if (pri != priority) + continue; + + if (*flipscreen) + { + sx = 368 - sx; + sy = 240 - sy; + delta = -16; + + flipx ^= *flipscreen; + flipy ^= *flipscreen; + } + + INT32 yy = h; + sy += flipy ? (delta * h) : 0; + + do + { + INT32 x = sx + (flipx ? (delta * w) : 0); + INT32 xx = w; + + do + { + INT32 xxx = ((x + 16) & 0x1ff) - 16; + INT32 yyy = (sy & 0x1ff) - global_y_offset; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, xxx, yyy, color, 0, 15, 0, DrvGfxROM2); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, xxx, yyy, color, 0, 15, 0, DrvGfxROM2); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, xxx, yyy, color, 0, 15, 0, DrvGfxROM2); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, xxx, yyy, color, 0, 15, 0, DrvGfxROM2); + } + } + code = (code + 1) & nGraphicsMask[2]; + x += delta * (flipx ? -1 : 1); + + } while (--xx >= 0); + sy += delta * (flipx ? -1 : 1); + + } while (--yy >= 0); + } + } +} + +static void draw_macross_background(UINT8 *ram, INT32 scrollx, INT32 scrolly, INT32 coloff, INT32 t) +{ + scrolly = (scrolly + global_y_offset) & 0x1ff; + UINT16 *vram = (UINT16*)ram; + + for (INT32 offs = 0; offs < 0x100 * 0x20; offs++) + { + INT32 sx = (offs & 0xff) << 4; + INT32 sy = (offs >> 8) << 4; + + INT32 row = sy >> 4; + INT32 col = sx >> 4; + + sx = (((sx - scrollx) + 16) & 0xfff) - 16; + sy = (((sy - scrolly) + 16) & 0x1ff) - 16; + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 ofst = ((row >> 4) << 12) | (row & 0x0f) | (col << 4); + + if (is_8bpp) { + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst]) & nGraphicsMask[1]; + + Render16x16Tile_Clip(pTransDraw, code, sx, sy, 0, 8, coloff, DrvGfxROM1); + } else { + INT32 code = ((BURN_ENDIAN_SWAP_INT16(vram[ofst]) & 0xfff) | (*tilebank << 12)) & nGraphicsMask[1]; + INT32 color = BURN_ENDIAN_SWAP_INT16(vram[ofst]) >> 12; + + if (t) { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, coloff, DrvGfxROM1); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, coloff, DrvGfxROM1); + } + } + } +} + +static void draw_gunnail_background(UINT8 *ram) +{ + INT32 bank = (*tilebank << 12) & nGraphicsMask[1]; // good enough?? + UINT16 *vram = (UINT16*)ram; + UINT16 *scroll = (UINT16*)DrvScrollRAM; + + for (INT32 y = 16; y < nScreenHeight + 16; y++) + { + INT32 yscroll = (BURN_ENDIAN_SWAP_INT16(scroll[0x100]) + BURN_ENDIAN_SWAP_INT16(scroll[0x100 | y]) + y) & 0x1ff; + + INT32 row = yscroll >> 4; + INT32 yl = (yscroll & 0x0f) << 4; + + INT32 ofst0 = ((row >> 4) << 12) | (row & 0x0f); + INT32 xscroll0 = BURN_ENDIAN_SWAP_INT16(scroll[0]) + BURN_ENDIAN_SWAP_INT16(scroll[y]) - videoshift; + + UINT16 *dest = pTransDraw + (y - 16) * nScreenWidth; + + for (INT32 x = 0; x < nScreenWidth + 16; x+=16) + { + INT32 xscroll = (x + xscroll0) & 0xfff; + INT32 sx = x - (xscroll & 0x0f); + + INT32 ofst = ofst0 | (xscroll & 0xff0); + + INT32 code = (BURN_ENDIAN_SWAP_INT16(vram[ofst]) & 0xfff) | bank; + INT32 color = (BURN_ENDIAN_SWAP_INT16(vram[ofst]) >> 12) << 4; + + UINT8 *src = DrvGfxROM1 + (code << 8) + yl; + + for (INT32 xx = 0; xx < 16; xx++, sx++) { + if (sx < 0 || sx >= nScreenWidth) continue; + + dest[sx] = src[xx] | color; + } + } + } +} + +static void draw_bjtwin_background(INT32 scrollx) +{ + UINT16 *vram = (UINT16*)DrvBgRAM0; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = (offs >> 5) << 3; + INT32 sy = (offs & 0x1f) << 3; + + sy -= global_y_offset; + sx = (((sx - scrollx) + 8) & 0x1ff) - 8; + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); + INT32 color = code >> 12; + INT32 bank = code & 0x800; + code &= 0x7ff; + if (bank) code |= (*tilebank << 11); + code &= nGraphicsMask[1]; + + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, bank ? DrvGfxROM1 : DrvGfxROM0); + } +} + +static void bioship_draw_background(INT32 scrollx, INT32 scrolly) +{ + scrolly = (scrolly + global_y_offset) & 0x1ff; + INT32 bank = *tilebank * 0x2000; + UINT16 *tilerom = (UINT16*)DrvTileROM; + + for (INT32 offs = 0; offs < 0x1000; offs++) + { + INT32 sx = (offs >> 4) << 4; + INT32 sy = (offs & 0x0f) << 4; + + sx = (((sx + 16) - scrollx) & 0xfff) - 16; + + if (sx >= nScreenWidth) continue; + + INT32 code = BURN_ENDIAN_SWAP_INT16(tilerom[offs | bank]); + sy = (((sy + 16) - scrolly) & 0x1ff) - 16; + + if (sy < nScreenHeight) { + Render16x16Tile_Clip(pTransDraw, code & 0xfff, sx, sy, code >> 12, 4, 0, DrvGfxROM1 + 0x100000); + } + + code = BURN_ENDIAN_SWAP_INT16(tilerom[offs | bank | 0x1000]); + sy = (((sy + 16) + 256) & 0x1ff) - 16; + + if (sy < nScreenHeight) { + Render16x16Tile_Clip(pTransDraw, code & 0xfff, sx, sy, code >> 12, 4, 0, DrvGfxROM1 + 0x100000); + } + } +} + +static void draw_macross_text_layer(INT32 scrollx, INT32 scrolly, INT32 wide, INT32 coloff) +{ + if (nGraphicsMask[0] == 0) return; + + scrolly = (scrolly + global_y_offset) & 0x1ff; + INT32 wmask = (0x100 << wide) - 1; + UINT16 *vram = (UINT16*)DrvTxRAM; + + for (INT32 offs = 0; offs < 32 * (32 << wide); offs++) + { + INT32 sx = (offs >> 5) << 3; + INT32 sy = (offs & 0x1f) << 3; + + sx = (((sx - scrollx) + 8) & wmask) - 8; + sy = (((sy - scrolly) + 8) & 0xff) - 8; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]); + + Render8x8Tile_Mask_Clip(pTransDraw, code & 0xfff, sx, sy, code >> 12, 4, 15, coloff, DrvGfxROM0); + } +} + +static void draw_screen_yflip() +{ + if (!screen_flip_y) return; + + UINT16 *tmp = (UINT16*)pBurnDraw; // :D + UINT16 *src1 = pTransDraw; + UINT16 *src2 = pTransDraw + (nScreenHeight-1) * nScreenWidth; + + for (INT32 y = 0; y < nScreenHeight / 2; y++) { + memcpy (tmp, src1, nScreenWidth * 2); + memcpy (src1, src2, nScreenWidth * 2); + memcpy (src2, tmp, nScreenWidth * 2); + src1 += nScreenWidth; + src2 -= nScreenWidth; + } +} + +static inline void common_draw(INT32 spriteflip, INT32 bgscrollx, INT32 bgscrolly, INT32 txscrollx, INT32 txscrolly, INT32 tx_coloff) +{ + DrvPaletteRecalc(); + + draw_macross_background(DrvBgRAM0, bgscrollx, bgscrolly, 0, 0); + + draw_sprites(spriteflip, 0x100, 0x0f, 3); + draw_sprites(spriteflip, 0x100, 0x0f, 2); + draw_sprites(spriteflip, 0x100, 0x0f, 1); + draw_sprites(spriteflip, 0x100, 0x0f, 0); + + draw_macross_text_layer(txscrollx, txscrolly, 0, tx_coloff); + + draw_screen_yflip(); + BurnTransferCopy(DrvPalette); +} + +static INT32 TharrierDraw() +{ + INT32 scrollx = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(Drv68KRAM + 0x9f00))) & 0xfff; + + common_draw(1, scrollx, 0, 0, 0, 0); + + return 0; +} + +static INT32 ManyblocDraw() +{ + UINT16 *scroll = (UINT16*)DrvScrollRAM; + INT32 scrollx = BURN_ENDIAN_SWAP_INT16(scroll[0x82 / 2]) & 0xfff; + INT32 scrolly = BURN_ENDIAN_SWAP_INT16(scroll[0xc2 / 2]) & 0x1ff; + + common_draw(1, scrollx, scrolly, 0, 0, 0); + + return 0; +} + +static INT32 MacrossDraw() +{ + UINT16 *scroll = (UINT16*)DrvScrollRAM; + INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) & 0xff); + INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff); + + common_draw(0, scrollx, scrolly, 0, 0, 0x200); + + return 0; +} + +static INT32 VandykeDraw() +{ + UINT16 *scroll = (UINT16*)DrvScrollRAM; + INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) >> 8); + INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) >> 8); + + common_draw(0, scrollx, scrolly, 0, 0, 0x200); + + return 0; +} + +static INT32 RedhawkiDraw() +{ + UINT16 *scroll = (UINT16*)DrvScrollRAM; + INT32 scrollx = BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0xff; + INT32 scrolly = BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff; + + common_draw(0, scrollx, scrolly, 0, 0, 0x300); + + return 0; +} + +static INT32 FirehawkDraw() +{ + UINT16 *scroll = (UINT16*)DrvScrollRAM; + INT32 scrolly = (BURN_ENDIAN_SWAP_INT16(scroll[3]) + 0x100) & 0x1ff; + INT32 scrollx = (BURN_ENDIAN_SWAP_INT16(scroll[2]) + 0x000) & 0xfff; + + common_draw(1, scrollx, scrolly, 0, 0, 0x200); + + return 0; +} + +static INT32 HachamfDraw() +{ + if (nNMK004CpuSpeed == 10000000) { // hachamf + mcu_run(0); + } else { // tdragon + mcu_run(1); + } + + UINT16 *scroll = (UINT16*)DrvScrollRAM; + INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) & 0xff); + INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff); + + common_draw(0, scrollx, scrolly, 0, 0, 0x200); + + return 0; +} + +static INT32 StrahlDraw() +{ + DrvPaletteRecalc(); + + UINT16 *scroll = (UINT16*)DrvScrollRAM; + + INT32 bgscrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0x000]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x001]) & 0xff); + INT32 bgscrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[0x002]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x003]) & 0xff); + INT32 fgscrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0x200]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x201]) & 0xff); + INT32 fgscrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[0x202]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x203]) & 0xff); + + draw_macross_background(DrvBgRAM0, bgscrollx, bgscrolly, 0x300, 0); + + INT32 bgbank_bak = *tilebank; *tilebank = 0x01; + draw_macross_background(DrvBgRAM1, fgscrollx, fgscrolly, 0x200, 1); + *tilebank = bgbank_bak; + + draw_sprites(0, 0x100, 0x0f, 3); + draw_sprites(0, 0x100, 0x0f, 2); + draw_sprites(0, 0x100, 0x0f, 1); + draw_sprites(0, 0x100, 0x0f, 0); + + draw_macross_text_layer(0, 0, 0, 0x200); + + draw_screen_yflip(); + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 Macross2Draw() +{ + videoshift = 64; + DrvPaletteRecalc(); + + UINT16 *scroll = (UINT16*)DrvScrollRAM; + + INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) & 0xff); + INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff); + + switch (scroll[0] & 0x30) + { + case 0x00: draw_macross_background(DrvBgRAM0, (scrollx - 64) & 0xfff, scrolly, 0, 0); break; + case 0x10: draw_macross_background(DrvBgRAM1, (scrollx - 64) & 0xfff, scrolly, 0, 0); break; + case 0x20: draw_macross_background(DrvBgRAM2, (scrollx - 64) & 0xfff, scrolly, 0, 0); break; + case 0x30: draw_macross_background(DrvBgRAM3, (scrollx - 64) & 0xfff, scrolly, 0, 0); break; + } + + draw_sprites(0, 0x100, 0x1f, 3); + draw_sprites(0, 0x100, 0x1f, 2); + draw_sprites(0, 0x100, 0x1f, 1); + draw_sprites(0, 0x100, 0x1f, 0); + + draw_macross_text_layer(-64, 0, 1, 0x300); + + draw_screen_yflip(); + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 GunnailDraw() +{ + DrvPaletteRecalc(); + + videoshift = 64; + UINT16 *scroll = (UINT16*)DrvScrollRAM; + + switch ((BURN_ENDIAN_SWAP_INT16(scroll[0]) >> 8) & 0x30) + { + case 0x00: draw_gunnail_background(DrvBgRAM0); break; + //case 0x10: draw_gunnail_background(DrvBgRAM1); break; + //case 0x20: draw_gunnail_background(DrvBgRAM2); break; + //case 0x30: draw_gunnail_background(DrvBgRAM3); break; + + // GunNail only has a single ram bank. If it tries to + // use another, just clear everything. + + case 0x10: + case 0x20: + case 0x30: + BurnTransferClear(); + break; + } + + draw_sprites(0, 0x100, 0x0f, 3); + draw_sprites(0, 0x100, 0x0f, 2); + draw_sprites(0, 0x100, 0x0f, 1); + draw_sprites(0, 0x100, 0x0f, 0); + + draw_macross_text_layer(-64, 0, 1, 0x200); + + draw_screen_yflip(); + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 RapheroDraw() +{ + DrvPaletteRecalc(); + + videoshift = 64; + UINT16 *scroll = (UINT16*)DrvScrollRAM; + + switch ((BURN_ENDIAN_SWAP_INT16(scroll[0]) >> 8) & 0x30) + { + case 0x00: draw_gunnail_background(DrvBgRAM0); break; + case 0x10: draw_gunnail_background(DrvBgRAM1); break; + case 0x20: draw_gunnail_background(DrvBgRAM2); break; + case 0x30: draw_gunnail_background(DrvBgRAM3); break; + } + + draw_sprites(0, 0x100, 0x1f, 3); + draw_sprites(0, 0x100, 0x1f, 2); + draw_sprites(0, 0x100, 0x1f, 1); + draw_sprites(0, 0x100, 0x1f, 0); + + draw_macross_text_layer(-64, 0, 1, 0x300); + + draw_screen_yflip(); + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 BioshipDraw() +{ + DrvPaletteRecalc(); + + UINT16 *scroll = (UINT16*)DrvScrollRAM; + INT32 bgscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[0x02]) & 0x100) | (BURN_ENDIAN_SWAP_INT16(scroll[0x03]) >> 8); + INT32 bgscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[0x00]) & 0xf00) | (BURN_ENDIAN_SWAP_INT16(scroll[0x01]) >> 8); + INT32 fgscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[0x02]) & 0x100) | (BURN_ENDIAN_SWAP_INT16(scroll[0x03]) >> 8); + INT32 fgscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[0x00]) & 0xf00) | (BURN_ENDIAN_SWAP_INT16(scroll[0x01]) >> 8); + + bioship_draw_background(bgscrollx, bgscrolly); + + INT32 bgbank_bak = *tilebank; *tilebank = 0; + draw_macross_background(DrvBgRAM0, fgscrollx, fgscrolly, 0x100, 1); + *tilebank = bgbank_bak; + + draw_sprites(0, 0x200, 0x0f, 3); + draw_sprites(0, 0x200, 0x0f, 2); + draw_sprites(0, 0x200, 0x0f, 1); + draw_sprites(0, 0x200, 0x0f, 0); + + draw_macross_text_layer(0, 0, 0, 0x300); + + draw_screen_yflip(); + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 BjtwinDraw() +{ + videoshift = 64; + + DrvPaletteRecalc(); + + draw_bjtwin_background(-64); + + draw_sprites(0, 0x100, 0x0f, 3); + draw_sprites(0, 0x100, 0x0f, 2); + draw_sprites(0, 0x100, 0x0f, 1); + draw_sprites(0, 0x100, 0x0f, 0); + + draw_screen_yflip(); + BurnTransferCopy(DrvPalette); + + return 0; +} + +static void AfegaCommonDraw(INT32 , INT32 xoffset, INT32 yoffset) +{ + UINT16 *scroll = (UINT16*)DrvScrollRAM; + INT32 bgscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[1]) + xoffset) & 0xfff; + INT32 bgscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[0]) + yoffset) & 0x1ff; + INT32 txscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff); + INT32 txscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0xff); + + common_draw(1, bgscrollx, bgscrolly, txscrollx, txscrolly, 0x200); +} + +static INT32 AfegaDraw() +{ + AfegaCommonDraw(1, -0x100, 0); + return 0; +} + +static INT32 RedhawkbDraw() +{ + AfegaCommonDraw(1, 0, 0x100); + return 0; +} + +static INT32 Bubl2000Draw() +{ + AfegaCommonDraw(0, -0x100, 0); + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + if (strncmp(BurnDrvGetTextA(DRV_NAME), "tharrier", 8) == 0) + { + DrvInputs[0] = 0x8000; + DrvInputs[1] = 0x0000; + DrvInputs[2] = 0x0000; + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + if (DrvInputs[0] & 0x0001) DrvInputs[1] ^= 0x0080; + if (DrvInputs[0] & 0x0002) DrvInputs[1] ^= 0x0020; + if (DrvInputs[0] & 0x0008) DrvInputs[1] ^= 0x0001; + if (DrvInputs[0] & 0x0010) DrvInputs[1] ^= 0x0102; + } + else + { + DrvInputs[0] = ~input_high[0]; + DrvInputs[1] = ~input_high[1]; + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + ZetNewFrame(); + + INT32 nSegment; + INT32 nInterleave = 10; + INT32 nTotalCycles[2] = { 10000000 / 56, 3000000 / 56 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = nTotalCycles[0] / nInterleave; + nCyclesDone[0] += SekRun(nSegment); + if (i == (nInterleave-1) || i == ((nInterleave / 2) - 1)) { + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + SekRun(0); + } + if (i == ((nInterleave/2)-1)) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + if (i == (nInterleave-1)) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + BurnTimerUpdate(i * (nTotalCycles[1] / nInterleave)); + } + + BurnTimerEndFrame(nTotalCycles[1]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); + + return 0; +} + +static INT32 SsmissinFrame() +{ + if (DrvReset) { + SmissinDoReset(); + } + + { + DrvInputs[0] = ~input_high[0]; + DrvInputs[1] = ~input_high[1]; + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + ZetNewFrame(); + + INT32 nSegment; + INT32 nInterleave = 10; + INT32 nTotalCycles[2] = { 8000000 / 56, 4000000 / 56 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = nTotalCycles[0] / nInterleave; + + nCyclesDone[0] += SekRun(nSegment); + + if (i == (nInterleave-1) || i == ((nInterleave / 2) - 1)) { + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + SekRun(0); + } + if (i == ((nInterleave/2)-1) && nNMK004EnableIrq2) + SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + if (i == (nInterleave-1)) + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + ZetRun(nTotalCycles[1] / nInterleave); + } + + if (pBurnSoundOut) { + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); + + return 0; +} + +static INT32 Macross2Frame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = ~input_high[0]; + DrvInputs[1] = ~input_high[1]; + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + ZetNewFrame(); + + INT32 nSegment; + INT32 nInterleave = 200; + INT32 nTotalCycles[2] = { 10000000 / 56, 4000000 / 56 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = nTotalCycles[0] / nInterleave; + nCyclesDone[0] += SekRun(nSegment); + if (i == 1 || i == (nInterleave / 2)) { + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + } + if (i == (nInterleave-1)) { + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + + if (macross2_sound_enable) { + //BurnTimerUpdate((nSegment * 4) / 10); + BurnTimerUpdate(i * (nTotalCycles[1] / nInterleave)); + } + } + + if (macross2_sound_enable) { + BurnTimerEndFrame(nTotalCycles[1]); + } + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); + + return 0; +} + +static INT32 AfegaFrame() +{ + if (DrvReset) { + AfegaDoReset(); + } + + ZetNewFrame(); + + { + DrvInputs[0] = ~input_high[0]; + DrvInputs[1] = ~input_high[1]; + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 12000000 / 56, 4000000 / 56 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nSegment; + + nSegment = nCyclesTotal[0] / nInterleave; + nCyclesDone[0] += SekRun(nSegment); + if (i == (nInterleave / 2) - 1) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + if (i == (nInterleave) - 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + nSegment = nCyclesTotal[1] / nInterleave; + nCyclesDone[1] += ZetRun(nSegment); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + MSM6295Render(1, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + MSM6295Render(1, pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); + + return 0; +} + +static INT32 BjtwinFrame() +{ + if (DrvReset) { + BjtwinDoReset(); + } + + { + DrvInputs[0] = ~input_high[0]; + DrvInputs[1] = ~input_high[1]; + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + INT32 nInterleave = 10; + INT32 nCyclesTotal[1] = { 10000000 / 56 }; + INT32 nCyclesDone[1] = { 0 }; + + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nSegment; + + nSegment = nCyclesTotal[0] / nInterleave; + nCyclesDone[0] += SekRun(nSegment); + if (i == (nInterleave-1) || i == ((nInterleave / 2) - 1)) { + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + } + if (i == (nInterleave-1)) { + SekRun(0); + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + } + + if (pBurnSoundOut) { + memset (pBurnSoundOut, 0, nBurnSoundLen * 2 * sizeof(INT16)); + MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + SekClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); + + return 0; +} + +static INT32 SeibuSoundFrame() +{ + if (DrvReset) { + SeibuSoundDoReset(); + } + + ZetNewFrame(); + + { + DrvInputs[0] = ~input_high[0]; + DrvInputs[1] = ~input_high[1]; + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + INT32 nInterleave = 100; + INT32 nCyclesTotal[2] = { 10000000 / 56, 3579545 / 56 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nSegment; + + nSegment = nCyclesTotal[0] / nInterleave; + nCyclesDone[0] += SekRun(nSegment); + if (i == (nInterleave-1) || i == ((nInterleave / 2) - 1)) { + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + } + + if (i == ((nInterleave/2)-1)) { + SekRun(0); + SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + } + + if (i == (nInterleave-1)) { + SekRun(0); + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + + BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); + } + + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + + if (pBurnSoundOut) { + seibu_sound_update(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); + + return 0; +} + +static INT32 NMK004Frame() +{ + if (DrvReset) { + NMK004DoReset(); + } + + { + DrvInputs[0] = ~input_high[0]; + DrvInputs[1] = ~input_high[1]; + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + SekNewFrame(); + + INT32 nSegment; + INT32 nInterleave = 200; + INT32 nTotalCycles[1] = { nNMK004CpuSpeed / 56 }; + + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = (nTotalCycles[0] / nInterleave) * (i + 1); + BurnTimerUpdate(nSegment); + + if (i == (nInterleave-1) || i == ((nInterleave / 2) - 1)) { + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + } + if (i == ((nInterleave/2)-1) && nNMK004EnableIrq2) { + SekRun(0); + SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + } + if (i == (nInterleave-1)) { + SekRun(0); + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + } + + BurnTimerEndFrame(nTotalCycles[0]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); + } + + SekClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + if (strncmp(BurnDrvGetTextA(DRV_NAME), "strahl", 6) == 0) { + memcpy (DrvSprBuf2, Drv68KRAM + 0xf000, 0x1000); + } else { + memcpy (DrvSprBuf2, Drv68KRAM + 0x8000, 0x1000); + } + + return 0; +} + + +//------------------------------------------------------------------------------------------------------------------------------------- + +static void decryptcode(INT32 len, INT32 a17, INT32 a16, INT32 a15, INT32 a14, INT32 a13) +{ + UINT8 *buf = (UINT8*)malloc(len); + + memcpy (buf, Drv68KROM, len); + + for (INT32 i = 0; i < len; i++) { + Drv68KROM[i] = buf[BITSWAP24(i, 23,22,21,20,19,18,a17,a16,a15,a14,a13,12,11,10,9,8,7,6,5,4,3,2,1,0)]; + } + + if (buf) { + free (buf); + buf = NULL; + } +} + +static UINT32 bjtwin_address_map_bg0(UINT32 addr) +{ + return ((addr & 0x00004) >> 2) | ((addr & 0x00800) >> 10) | ((addr & 0x40000) >> 16); +} + +static UINT8 decode_byte(UINT8 src, const UINT8 *bitp) +{ + UINT8 ret = 0; + for (INT32 i=0; i<8; i++) + ret |= (((src >> bitp[i]) & 1) << (7-i)); + + return ret; +} + +static UINT16 decode_word(UINT16 src, const UINT8 *bitp) +{ + UINT16 ret=0; + for (INT32 i = 0; i < 16; i++) + ret |= (((src >> bitp[i]) & 1) << (15-i)); + + return ret; +} + +static UINT32 bjtwin_address_map_sprites(UINT32 addr) +{ + return ((addr & 0x00010) >> 4) | ((addr & 0x20000) >> 16) | ((addr & 0x100000) >> 18); +} + +static void decode_gfx(INT32 gfxlen0, INT32 gfxlen1) +{ + static const UINT8 decode_data_bg[8][8] = + { + {0x3,0x0,0x7,0x2,0x5,0x1,0x4,0x6}, + {0x1,0x2,0x6,0x5,0x4,0x0,0x3,0x7}, + {0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0}, + {0x7,0x6,0x5,0x0,0x1,0x4,0x3,0x2}, + {0x2,0x0,0x1,0x4,0x3,0x5,0x7,0x6}, + {0x5,0x3,0x7,0x0,0x4,0x6,0x2,0x1}, + {0x2,0x7,0x0,0x6,0x5,0x3,0x1,0x4}, + {0x3,0x4,0x7,0x6,0x2,0x0,0x5,0x1}, + }; + + static const UINT8 decode_data_sprite[8][16] = + { + {0x9,0x3,0x4,0x5,0x7,0x1,0xb,0x8,0x0,0xd,0x2,0xc,0xe,0x6,0xf,0xa}, + {0x1,0x3,0xc,0x4,0x0,0xf,0xb,0xa,0x8,0x5,0xe,0x6,0xd,0x2,0x7,0x9}, + {0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0}, + {0xf,0xe,0xc,0x6,0xa,0xb,0x7,0x8,0x9,0x2,0x3,0x4,0x5,0xd,0x1,0x0}, + {0x1,0x6,0x2,0x5,0xf,0x7,0xb,0x9,0xa,0x3,0xd,0xe,0xc,0x4,0x0,0x8}, + {0x7,0x5,0xd,0xe,0xb,0xa,0x0,0x1,0x9,0x6,0xc,0x2,0x3,0x4,0x8,0xf}, + {0x0,0x5,0x6,0x3,0x9,0xb,0xa,0x7,0x1,0xd,0x2,0xe,0x4,0xc,0x8,0xf}, + {0x9,0xc,0x4,0x2,0xf,0x0,0xb,0x8,0xa,0xd,0x3,0x6,0x5,0xe,0x1,0x7}, + }; + + for (INT32 A = 0; A < gfxlen0; A++) { + DrvGfxROM1[A] = decode_byte(DrvGfxROM1[A], decode_data_bg[bjtwin_address_map_bg0(A)]); + } + + for (INT32 A = 0; A < gfxlen1; A += 2) + { + UINT16 tmp = decode_word((DrvGfxROM2[A+1] << 8) | DrvGfxROM2[A], decode_data_sprite[bjtwin_address_map_sprites(A)]); + DrvGfxROM2[A+1] = tmp >> 8; + DrvGfxROM2[A] = tmp & 0xff; + } +} + +static void ssmissin_decode() +{ + for (INT32 A = 0; A < 0x100000; A++) + { + DrvGfxROM1[A] = BITSWAP08(DrvGfxROM1[A], 7, 6, 5, 3, 4, 2, 1, 0); + DrvGfxROM2[A] = BITSWAP08(DrvGfxROM2[A], 7, 6, 5, 3, 4, 2, 1, 0); + } +} + +static void decode_tdragonb() +{ + static const UINT8 decode_data_tdragonb[16] = { + 0xe,0xc,0xa,0x8,0x7,0x5,0x3,0x1,0xf,0xd,0xb,0x9,0x6,0x4,0x2,0x0 + }; + + for (INT32 A = 0; A < 0x40000; A += 2) + { + UINT16 tmp = decode_word((Drv68KROM[A+1] << 8) | Drv68KROM[A], decode_data_tdragonb); + Drv68KROM[A+1] = tmp >> 8; + Drv68KROM[A] = tmp & 0xff; + } + + ssmissin_decode(); +} + +//------------------------------------------------------------------------------------------------------------- + + +// Task Force Harrier + +static struct BurnRomInfo tharrierRomDesc[] = { + { "2", 0x020000, 0x78923aaa, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "3", 0x020000, 0x99cea259, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "12", 0x010000, 0xb959f837, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "1", 0x010000, 0xc7402e4a, 3 | BRF_GRA }, // 3 Characters + + { "89050-4", 0x080000, 0x64d7d687, 4 | BRF_GRA }, // 4 Tiles + + { "89050-13", 0x080000, 0x24db3fa4, 5 | BRF_GRA }, // 5 Sprites + { "89050-17", 0x080000, 0x7f715421, 5 | BRF_GRA }, // 6 + + { "89050-8", 0x080000, 0x11ee4c39, 6 | BRF_SND }, // 7 OKI1 Samples + + { "89050-10", 0x080000, 0x893552ab, 7 | BRF_SND }, // 8 OKI2 Samples + + { "21.bpr", 0x000100, 0xfcd5efea, 0 | BRF_OPT }, // 9 Unused proms + { "22.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 + { "23.bpr", 0x000020, 0xfc3569f4, 0 | BRF_OPT }, // 11 + { "24.bpr", 0x000100, 0xe0a009fe, 0 | BRF_OPT }, // 12 + { "25.bpr", 0x000100, 0xe0a009fe, 0 | BRF_OPT }, // 13 + { "26.bpr", 0x000020, 0x0cbfb33e, 0 | BRF_OPT }, // 14 +}; + +STD_ROM_PICK(tharrier) +STD_ROM_FN(tharrier) + +static INT32 TharrierLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x00001, 6, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 7, 1)) return 1; + memmove (DrvSndROM0 + 0x40000, DrvSndROM0 + 0x20000, 0x60000); + + if (BurnLoadRom(DrvSndROM1 + 0x00000, 8, 1)) return 1; + memmove (DrvSndROM1 + 0x40000, DrvSndROM1 + 0x20000, 0x60000); + + DrvGfxDecode(0x10000, 0x80000, 0x100000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0883ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x09c000, 0x09c7ff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09d000, 0x09d7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); + SekSetWriteWordHandler(0, tharrier_main_write_word); + SekSetWriteByteHandler(0, tharrier_main_write_byte); + SekSetReadWordHandler(0, tharrier_main_read_word); + SekSetReadByteHandler(0, tharrier_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 TharrierInit() +{ + input_high[0] = 0x7fff; + input_high[1] = 0xffff; + + return DrvInit(TharrierLoadCallback); +} + +struct BurnDriver BurnDrvTharrier = { + "tharrier", NULL, NULL, NULL, "1989", + "Task Force Harrier\0", NULL, "UPL (American Sammy license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, tharrierRomInfo, tharrierRomName, NULL, NULL, TharrierInputInfo, TharrierDIPInfo, + TharrierInit, DrvExit, DrvFrame, TharrierDraw, NULL, NULL, 0x200, + 224, 256, 3, 4 +}; + + +// Task Force Harrier (Japan) + +static struct BurnRomInfo tharrierjRomDesc[] = { + { "2.bin", 0x020000, 0xf3887a44, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "3.bin", 0x020000, 0x65c247f6, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "12", 0x010000, 0xb959f837, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "1.bin", 0x010000, 0x005c26c3, 3 | BRF_GRA }, // 3 Characters + + { "89050-4", 0x080000, 0x64d7d687, 4 | BRF_GRA }, // 4 Tiles + + { "89050-13", 0x080000, 0x24db3fa4, 5 | BRF_GRA }, // 5 Sprites + { "89050-17", 0x080000, 0x7f715421, 5 | BRF_GRA }, // 6 + + { "89050-8", 0x080000, 0x11ee4c39, 6 | BRF_SND }, // 7 OKI1 Samples + + { "89050-10", 0x080000, 0x893552ab, 7 | BRF_SND }, // 8 OKI2 Samples + + { "21.bpr", 0x000100, 0xfcd5efea, 0 | BRF_OPT }, // 9 Unused proms + { "22.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 + { "23.bpr", 0x000020, 0xfc3569f4, 0 | BRF_OPT }, // 11 + { "24.bpr", 0x000100, 0xe0a009fe, 0 | BRF_OPT }, // 12 + { "25.bpr", 0x000100, 0xe0a009fe, 0 | BRF_OPT }, // 13 + { "26.bpr", 0x000020, 0x0cbfb33e, 0 | BRF_OPT }, // 14 +}; + +STD_ROM_PICK(tharrierj) +STD_ROM_FN(tharrierj) + +struct BurnDriver BurnDrvTharrierj = { + "tharrierj", "tharrier", NULL, NULL, "1989", + "Task Force Harrier (Japan)\0", NULL, "UPL", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0, + NULL, tharrierjRomInfo, tharrierjRomName, NULL, NULL, TharrierInputInfo, TharrierDIPInfo, + TharrierInit, DrvExit, DrvFrame, TharrierDraw, NULL, NULL, 0x200, + 224, 256, 3, 4 +}; + + +// Many Block + +static struct BurnRomInfo manyblocRomDesc[] = { + { "1-u33.bin", 0x020000, 0x07473154, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "2-u35.bin", 0x020000, 0x04acd8c1, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "3-u146.bin", 0x010000, 0x7bf5fafa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "12-u39.bin", 0x010000, 0x413b5438, 3 | BRF_GRA }, // 3 Characters + + { "5-u97.bin", 0x040000, 0x536699e6, 4 | BRF_GRA }, // 4 Ciles + { "4-u96.bin", 0x040000, 0x28af2640, 4 | BRF_GRA }, // 5 + + { "8-u54b.bin", 0x020000, 0x03eede77, 5 | BRF_GRA }, // 6 Sprites + { "10-u86b.bin", 0x020000, 0x9eab216f, 5 | BRF_GRA }, // 7 + { "9-u53b.bin", 0x020000, 0xdfcfa040, 5 | BRF_GRA }, // 8 + { "11-u85b.bin", 0x020000, 0xfe747dd5, 5 | BRF_GRA }, // 9 + + { "6-u131.bin", 0x040000, 0x79a4ae75, 6 | BRF_SND }, // 10 OKI1 Samples + { "7-u132.bin", 0x040000, 0x21db875e, 6 | BRF_SND }, // 11 + + { "u200.bpr", 0x000020, 0x1823600b, 0 | BRF_OPT }, // 12 Unused proms + { "u7.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 13 + { "u10.bpr", 0x000200, 0x8e9b569a, 0 | BRF_OPT }, // 14 + { "u120.bpr", 0x000100, 0x576c5984, 0 | BRF_OPT }, // 15 +}; + +STD_ROM_PICK(manybloc) +STD_ROM_FN(manybloc) + +static INT32 ManyblocLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x00000, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00001, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x40000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x00001, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x40000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x40001, 9, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 10, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x60000, 11, 1)) return 1; + memmove (DrvSndROM0 + 0x40000, DrvSndROM0 + 0x20000, 0x20000); + + DrvGfxDecode(0x10000, 0x80000, 0x80000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0883ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x09c000, 0x09cfff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09d000, 0x09d7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); + SekSetWriteWordHandler(0, manybloc_main_write_word); + SekSetWriteByteHandler(0, manybloc_main_write_byte); + SekSetReadWordHandler(0, manybloc_main_read_word); + SekSetReadByteHandler(0, manybloc_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 ManyblocInit() +{ + global_y_offset = 8; + input_high[0] = 0x7fff; + input_high[1] = 0xffff; + + return DrvInit(ManyblocLoadCallback); +} + +struct BurnDriver BurnDrvManybloc = { + "manybloc", NULL, NULL, NULL, "1991", + "Many Block\0", NULL, "Bee-Oh", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, manyblocRomInfo, manyblocRomName, NULL, NULL, ManyblocInputInfo, ManyblocDIPInfo, + ManyblocInit, DrvExit, DrvFrame, ManyblocDraw, NULL, NULL, 0x200, + 240, 256, 3, 4 +}; + + +// S.S. Mission + +static struct BurnRomInfo ssmissinRomDesc[] = { + { "ssm14.165", 0x020000, 0xeda61b74, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "ssm15.166", 0x020000, 0xaff15927, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "ssm11.188", 0x008000, 0x8be6dce3, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "ssm16.172", 0x020000, 0x5cf6eb1f, 3 | BRF_GRA }, // 3 Characters + + { "ssm17.147", 0x080000, 0xc9c28455, 4 | BRF_GRA }, // 4 Tiles + { "ssm18.148", 0x080000, 0xebfdaad6, 4 | BRF_GRA }, // 5 + + { "ssm20.34", 0x080000, 0xa0c16c4d, 5 | BRF_GRA }, // 6 Sprites + { "ssm19.33", 0x080000, 0xb1943657, 5 | BRF_GRA }, // 7 + + { "ssm13.190", 0x020000, 0x618f66f0, 6 | BRF_SND }, // 8 OKI1 Samples + { "ssm12.189", 0x080000, 0xe8219c83, 6 | BRF_SND }, // 9 + + { "ssm-pr2.113", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 Unused proms + { "ssm-pr1.114", 0x000200, 0xed0bd072, 0 | BRF_OPT }, // 11 +}; + +STD_ROM_PICK(ssmissin) +STD_ROM_FN(ssmissin) + +static INT32 SsmissinLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x00000, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00001, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x80000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00001, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 7, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 8, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x40000, 9, 1)) return 1; + + ssmissin_decode(); + DrvGfxDecode(0x20000, 0x100000, 0x100000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x0b0000, 0x0bffff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x0c4000, 0x0c43ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x0c8000, 0x0c87ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x0cc000, 0x0cffff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x0d0000, 0x0d07ff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x0d0800, 0x0d0fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x0d1000, 0x0d17ff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x0d1800, 0x0d1fff, SM_RAM); + SekSetWriteWordHandler(0, ssmissin_main_write_word); + SekSetWriteByteHandler(0, ssmissin_main_write_byte); + SekSetReadWordHandler(0, ssmissin_main_read_word); + SekSetReadByteHandler(0, ssmissin_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 SsmissinInit() +{ + return MSM6295x1Init(SsmissinLoadCallback); +} + +struct BurnDriver BurnDrvSsmissin = { + "ssmissin", NULL, NULL, NULL, "1992", + "S.S. Mission\0", NULL, "Comad", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, ssmissinRomInfo, ssmissinRomName, NULL, NULL, SsmissinInputInfo, SsmissinDIPInfo, + SsmissinInit, MSM6295x1Exit, SsmissinFrame, MacrossDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + +// Air Attack (set 1) + +static struct BurnRomInfo airattckRomDesc[] = { + { "uc10.bin", 0x020000, 0x1837d4ba, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "ue10.bin", 0x020000, 0x71deb9d8, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "3.su6", 0x008000, 0x3e352370, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "4.ul10", 0x020000, 0xe9362ab4, 3 | BRF_GRA }, // 3 Characters + + { "9.uw9", 0x080000, 0x86e59966, 4 | BRF_GRA }, // 4 Tiles + { "10.ux9", 0x080000, 0x122c8d04, 4 | BRF_GRA }, // 5 + + { "8.uo82", 0x080000, 0x9a83e3d8, 5 | BRF_GRA }, // 6 Sprites + { "7.uo81", 0x080000, 0x3c38d671, 5 | BRF_GRA }, // 7 + + { "2.su12", 0x020000, 0x93ab615b, 6 | BRF_SND }, // 8 OKI1 Samples + { "1.su13", 0x080000, 0x09a836bb, 6 | BRF_SND }, // 9 + + { "82s129.ug6", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 Unused proms + { "82s147.uh6", 0x000200, 0xed0bd072, 0 | BRF_OPT }, // 11 +}; + +STD_ROM_PICK(airattck) +STD_ROM_FN(airattck) + +struct BurnDriver BurnDrvAirattck = { + "airattck", NULL, NULL, NULL, "1996", + "Air Attack (set 1)\0", NULL, "Comad", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, airattckRomInfo, airattckRomName, NULL, NULL, SsmissinInputInfo, SsmissinDIPInfo, + SsmissinInit, MSM6295x1Exit, SsmissinFrame, MacrossDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + +// Air Attack (set 2) + +static struct BurnRomInfo airattckaRomDesc[] = { + { "5.ue10", 0x020000, 0x6589c005, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "6.uc10", 0x020000, 0x3572baf0, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "3.su6", 0x008000, 0x3e352370, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "4.ul10", 0x020000, 0xe9362ab4, 3 | BRF_GRA }, // 3 Characters + + { "9.uw9", 0x080000, 0x86e59966, 4 | BRF_GRA }, // 4 Tiles + { "10.ux9", 0x080000, 0x122c8d04, 4 | BRF_GRA }, // 5 + + { "8.uo82", 0x080000, 0x9a83e3d8, 5 | BRF_GRA }, // 6 Sprites + { "7.uo81", 0x080000, 0x3c38d671, 5 | BRF_GRA }, // 7 + + { "2.su12", 0x020000, 0x93ab615b, 6 | BRF_SND }, // 8 OKI1 Samples + { "1.su13", 0x080000, 0x09a836bb, 6 | BRF_SND }, // 9 + + { "82s129.ug6", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 Unused proms + { "82s147.uh6", 0x000200, 0xed0bd072, 0 | BRF_OPT }, // 11 +}; + +STD_ROM_PICK(airattcka) +STD_ROM_FN(airattcka) + +struct BurnDriver BurnDrvAirattcka = { + "airattcka", "airattck", NULL, NULL, "1996", + "Air Attack (set 2)\0", NULL, "Comad", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, airattckaRomInfo, airattckaRomName, NULL, NULL, SsmissinInputInfo, SsmissinDIPInfo, + SsmissinInit, MSM6295x1Exit, SsmissinFrame, MacrossDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + +// Super Spacefortress Macross II / Chou-Jikuu Yousai Macross II + +static struct BurnRomInfo macross2RomDesc[] = { + { "mcrs2j.3", 0x080000, 0x36a618fe, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + + { "mcrs2j.2", 0x020000, 0xb4aa8ac7, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 code + + { "mcrs2j.1", 0x020000, 0xc7417410, 3 | BRF_GRA }, // 2 Characters + + { "bp932an.a04", 0x200000, 0xc4d77ff0, 4 | BRF_GRA }, // 3 Tiles + + { "bp932an.a07", 0x200000, 0xaa1b21b9, 5 | BRF_GRA }, // 4 Sprites + { "bp932an.a08", 0x200000, 0x67eb2901, 5 | BRF_GRA }, // 5 + + { "bp932an.a06", 0x200000, 0xef0ffec0, 6 | BRF_SND }, // 6 OKI1 Samples + + { "bp932an.a05", 0x100000, 0xb5335abb, 7 | BRF_SND }, // 7 OKI2 Samples + + { "mcrs2bpr.9", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 Unused proms + { "mcrs2bpr.10", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 +}; + +STD_ROM_PICK(macross2) +STD_ROM_FN(macross2) + +struct BurnDriver BurnDrvMacross2 = { + "macross2", NULL, NULL, NULL, "1993", + "Super Spacefortress Macross II / Chou-Jikuu Yousai Macross II\0", NULL, "Banpresto", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, macross2RomInfo, macross2RomName, NULL, NULL, CommonInputInfo, Macross2DIPInfo, + Macross2Init, DrvExit, Macross2Frame, Macross2Draw, NULL, NULL, 0x400, + 384, 224, 4, 3 +}; + + +// Thunder Dragon 2 (9th Nov. 1993) + +static struct BurnRomInfo tdragon2RomDesc[] = { + { "6.rom", 0x080000, 0xca348caf, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + + { "5.bin", 0x020000, 0xb870be61, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 code + + { "1.bin", 0x020000, 0xd488aafa, 3 | BRF_GRA }, // 2 Characters + + { "ww930914.2", 0x200000, 0xf968c65d, 4 | BRF_GRA }, // 3 Tiles + + { "ww930917.7", 0x200000, 0xb98873cb, 5 | BRF_GRA }, // 4 Sprites + { "ww930918.8", 0x200000, 0xbaee84b2, 5 | BRF_GRA }, // 5 + + { "ww930916.4", 0x200000, 0x07c35fe6, 6 | BRF_SND }, // 6 OKI1 Samples + + { "ww930915.3", 0x200000, 0x82025bab, 7 | BRF_SND }, // 7 OKI2 Samples + + { "9.bpr", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 Unused proms + { "10.bpr", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 +}; + +STD_ROM_PICK(tdragon2) +STD_ROM_FN(tdragon2) + +struct BurnDriver BurnDrvTdragon2 = { + "tdragon2", NULL, NULL, NULL, "1993", + "Thunder Dragon 2 (9th Nov. 1993)\0", NULL, "NMK", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, tdragon2RomInfo, tdragon2RomName, NULL, NULL, Tdragon2InputInfo, Tdragon2DIPInfo, + Macross2Init, DrvExit, Macross2Frame, Macross2Draw, NULL, NULL, 0x400, + 224, 384, 3, 4 +}; + + +// Thunder Dragon 2 (1st Oct. 1993) + +static struct BurnRomInfo tdragon2aRomDesc[] = { + { "6.bin", 0x080000, 0x310d6bca, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + + { "5.bin", 0x020000, 0xb870be61, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 code + + { "1.bin", 0x020000, 0xd488aafa, 3 | BRF_GRA }, // 2 Characters + + { "ww930914.2", 0x200000, 0xf968c65d, 4 | BRF_GRA }, // 3 Tiles + + { "ww930917.7", 0x200000, 0xb98873cb, 5 | BRF_GRA }, // 4 Sprites + { "ww930918.8", 0x200000, 0xbaee84b2, 5 | BRF_GRA }, // 5 + + { "ww930916.4", 0x200000, 0x07c35fe6, 6 | BRF_SND }, // 6 OKI1 Samples + + { "ww930915.3", 0x200000, 0x82025bab, 7 | BRF_SND }, // 7 OKI2 Samples + + { "9.bpr", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 Unused proms + { "10.bpr", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 +}; + +STD_ROM_PICK(tdragon2a) +STD_ROM_FN(tdragon2a) + +struct BurnDriver BurnDrvTdragon2a = { + "tdragon2a", "tdragon2", NULL, NULL, "1993", + "Thunder Dragon 2 (1st Oct. 1993)\0", NULL, "NMK", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, tdragon2aRomInfo, tdragon2aRomName, NULL, NULL, Tdragon2InputInfo, Tdragon2DIPInfo, + Macross2Init, DrvExit, Macross2Frame, Macross2Draw, NULL, NULL, 0x400, + 224, 384, 3, 4 +}; + + +// Big Bang (9th Nov. 1993) + +static struct BurnRomInfo bigbangRomDesc[] = { + { "eprom.3", 0x080000, 0x28e5957a, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + + { "5.bin", 0x020000, 0xb870be61, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 code + + { "1.bin", 0x020000, 0xd488aafa, 3 | BRF_GRA }, // 2 Characters + + { "ww930914.2", 0x200000, 0xf968c65d, 4 | BRF_GRA }, // 3 Tiles + + { "ww930917.7", 0x200000, 0xb98873cb, 5 | BRF_GRA }, // 4 Sprites + { "ww930918.8", 0x200000, 0xbaee84b2, 5 | BRF_GRA }, // 5 + + { "ww930916.4", 0x200000, 0x07c35fe6, 6 | BRF_SND }, // 6 OKI1 Samples + + { "ww930915.3", 0x200000, 0x82025bab, 7 | BRF_SND }, // 7 OKI2 Samples + + { "9.bpr", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 Unused proms + { "10.bpr", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 +}; + +STD_ROM_PICK(bigbang) +STD_ROM_FN(bigbang) + +struct BurnDriver BurnDrvBigbang = { + "bigbang", "tdragon2", NULL, NULL, "1993", + "Big Bang (9th Nov. 1993)\0", NULL, "NMK", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, bigbangRomInfo, bigbangRomName, NULL, NULL, Tdragon2InputInfo, Tdragon2DIPInfo, + Macross2Init, DrvExit, Macross2Frame, Macross2Draw, NULL, NULL, 0x400, + 224, 384, 3, 4 +}; + + +// Stagger I (Japan) + +static struct BurnRomInfo stagger1RomDesc[] = { + { "2.bin", 0x020000, 0x8555929b, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "3.bin", 0x020000, 0x5b0b63ac, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "1.bin", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "4.bin", 0x080000, 0x46463d36, 4 | BRF_GRA }, // 3 Tiles + + { "7.bin", 0x080000, 0x048f7683, 5 | BRF_GRA }, // 4 Characters + { "6.bin", 0x080000, 0x051d4a77, 5 | BRF_GRA }, // 5 + + { "5", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 6 OKI1 Samples +}; + +STD_ROM_PICK(stagger1) +STD_ROM_FN(stagger1) + +static void pAfegaZ80Callback() +{ + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(afega_sound_write); + ZetSetReadHandler(afega_sound_read); + ZetClose(); +} + +static INT32 Stagger1LoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; + + memset (DrvGfxROM0, 0xff, 0x20); + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x00001, 5, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 6, 1)) return 1; + + DrvGfxDecode(0x20, 0x80000, 0x100000); + + return 0; +} + +static INT32 Stagger1Init() +{ + return AfegaInit(Stagger1LoadCallback, pAfegaZ80Callback, 1); +} + +struct BurnDriver BurnDrvStagger1 = { + "stagger1", NULL, NULL, NULL, "1998", + "Stagger I (Japan)\0", NULL, "Afega", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, stagger1RomInfo, stagger1RomName, NULL, NULL, CommonInputInfo, Stagger1DIPInfo, + Stagger1Init, AfegaExit, AfegaFrame, AfegaDraw, NULL, NULL, 0x300, + 224, 256, 3, 4 +}; + + +// Red Hawk (US) + +static struct BurnRomInfo redhawkRomDesc[] = { + { "2", 0x020000, 0x3ef5f326, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "3", 0x020000, 0x9b3a10ef, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "1.bin", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "4", 0x080000, 0xd6427b8a, 4 | BRF_GRA }, // 5 Tiles + + { "7", 0x080000, 0x66a8976d, 5 | BRF_GRA }, // 3 Characters + { "6", 0x080000, 0x61560164, 5 | BRF_GRA }, // 4 + + { "5", 0x040000, 0xe911ce33, 6 | BRF_GRA }, // 6 OKI1 Samples +}; + +STD_ROM_PICK(redhawk) +STD_ROM_FN(redhawk) + +static INT32 RedhawkInit() +{ + INT32 nRet = AfegaInit(Stagger1LoadCallback, pAfegaZ80Callback, 1); + + if (nRet == 0) { + decryptcode(0x40000, 16,15,14,17,13); + } + + return nRet; +} + +struct BurnDriver BurnDrvRedhawk = { + "redhawk", "stagger1", NULL, NULL, "1997", + "Red Hawk (US)\0", NULL, "Afega (New Vision Ent. license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, redhawkRomInfo, redhawkRomName, NULL, NULL, CommonInputInfo, Stagger1DIPInfo, + RedhawkInit, AfegaExit, AfegaFrame, AfegaDraw, NULL, NULL, 0x300, + 224, 256, 3, 4 +}; + + +// Red Hawk (Excellent Co., Ltd) + +static struct BurnRomInfo redhawkeRomDesc[] = { + { "rhawk2.bin", 0x020000, 0x6d2e23b4, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "rhawk3.bin", 0x020000, 0x5e0d6188, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "1.bin", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "rhawk4.bin", 0x080000, 0xd79aa288, 4 | BRF_GRA }, // 3 Tiles + + { "rhawk7.bin", 0x080000, 0x0264ef54, 5 | BRF_GRA }, // 4 Characters + { "rhawk6.bin", 0x080000, 0x3f980ab6, 5 | BRF_GRA }, // 5 + + { "5", 0x040000, 0xe911ce33, 6 | BRF_GRA }, // 6 OKI1 Samples +}; + +STD_ROM_PICK(redhawke) +STD_ROM_FN(redhawke) + +struct BurnDriver BurnDrvRedhawke = { + "redhawke", "stagger1", NULL, NULL, "1997", + "Red Hawk (Excellent Co., Ltd)\0", NULL, "Afega (Excellent Co. license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, redhawkeRomInfo, redhawkeRomName, NULL, NULL, CommonInputInfo, Stagger1DIPInfo, + Stagger1Init, AfegaExit, AfegaFrame, AfegaDraw, NULL, NULL, 0x300, + 224, 256, 3, 4 +}; + + +// Red Hawk (Italy) + +static struct BurnRomInfo redhawkiRomDesc[] = { + { "rhit-2.bin", 0x020000, 0x30cade0e, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "rhit-3.bin", 0x020000, 0x37dbb3c2, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "1.bin", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "rhit-4.bin", 0x080000, 0xaafb3cc4, 4 | BRF_GRA }, // 3 Tiles + + { "rhit-7.bin", 0x080000, 0xbcb367c7, 5 | BRF_GRA }, // 4 Characters + { "rhit-6.bin", 0x080000, 0x7cbd5c60, 5 | BRF_GRA }, // 5 + + { "5", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 6 OKI1 Samples +}; + +STD_ROM_PICK(redhawki) +STD_ROM_FN(redhawki) + +static INT32 RedhawkiInit() +{ + INT32 nRet = AfegaInit(Stagger1LoadCallback, pAfegaZ80Callback, 1); + + if (nRet == 0) { + decryptcode(0x40000, 15, 16, 17, 14, 13); + } + + return nRet; +} + +struct BurnDriver BurnDrvRedhawki = { + "redhawki", "stagger1", NULL, NULL, "1997", + "Red Hawk (Italy)\0", NULL, "Afega (Hea Dong Corp license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, redhawkiRomInfo, redhawkiRomName, NULL, NULL, CommonInputInfo, Stagger1DIPInfo, + RedhawkiInit, AfegaExit, AfegaFrame, RedhawkiDraw, NULL, NULL, 0x300, + 256, 224, 4, 3 +}; + + +// Vince (Redhawk bootleg + +static struct BurnRomInfo redhawkbRomDesc[] = { + { "rhb-1.bin", 0x020000, 0xe733ea07, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "rhb-2.bin", 0x020000, 0xf9fa5684, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "1.bin", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "rhb-5.bin", 0x080000, 0xd0eaf6f2, 4 | BRF_GRA }, // 3 Tiles + + { "rhb-3.bin", 0x080000, 0x0318d68b, 5 | BRF_GRA }, // 4 Characters + { "rhb-4.bin", 0x080000, 0xba21c1ef, 5 | BRF_GRA }, // 5 + + { "5", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 6 OKI1 Samples +}; + +STD_ROM_PICK(redhawkb) +STD_ROM_FN(redhawkb) + +static INT32 RedhawkbLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; + + memset (DrvGfxROM0, 0xff, 0x20); + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x80000, 5, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x00000, 6, 1)) return 1; + + DrvGfxDecode(0x20, 0x80000, 0x100000); + + BurnByteswap(DrvGfxROM1, 0x100000); + BurnByteswap(DrvGfxROM2, 0x200000); + + return 0; +} + +static INT32 RedhawkbInit() +{ + input_high[0] = input_high[1] = 0xffff; + + return AfegaInit(RedhawkbLoadCallback, pAfegaZ80Callback, 1); +} + +struct BurnDriver BurnDrvRedhawkb = { + "redhawkb", "stagger1", NULL, NULL, "1997", + "Vince (Redhawk bootleg)\0", NULL, "bootleg", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, redhawkbRomInfo, redhawkbRomName, NULL, NULL, CommonInputInfo, RedhawkbDIPInfo, + RedhawkbInit, AfegaExit, AfegaFrame, RedhawkbDraw, NULL, NULL, 0x300, + 256, 224, 4, 3 +}; + + +// Guardian Storm + +static struct BurnRomInfo grdnstrmRomDesc[] = { + { "afega4.u112", 0x040000, 0x2244713a, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "afega5.u107", 0x040000, 0x5815c806, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "afega7.u92", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "afega1.u4", 0x010000, 0x9e7ef086, 3 | BRF_GRA }, // 3 Characters + + { "afega_af1-b2.uc8", 0x200000, 0xd68588c2, 4 | BRF_GRA }, // 4 Tiles + { "afega_af1-b1.uc3", 0x200000, 0xf8b200a8, 4 | BRF_GRA }, // 5 + + { "afega3.uc13", 0x200000, 0x0218017c, 5 | BRF_GRA }, // 6 Sprites + + { "afega1.u95", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 7 OKI1 Samples +}; + +STD_ROM_PICK(grdnstrm) +STD_ROM_FN(grdnstrm) + +static INT32 GrdnstrmLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; + + GrdnstrmGfxDecode(0x10000, 0x400000, 0x200000); + + return 0; +} + +static INT32 GrdnstrmInit() +{ + screen_flip_y = 1; + + return AfegaInit(GrdnstrmLoadCallback, pAfegaZ80Callback, 1); +} + +struct BurnDriver BurnDrvGrdnstrm = { + "grdnstrm", NULL, NULL, NULL, "1998", + "Guardian Storm\0", NULL, "Afega (Apples Industries license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, grdnstrmRomInfo, grdnstrmRomName, NULL, NULL, CommonInputInfo, GrdnstrmDIPInfo, + GrdnstrmInit, AfegaExit, AfegaFrame, FirehawkDraw, NULL, NULL, 0x300, + 256, 224, 4, 3 +}; + + +// Sen Jin - Guardian Storm (Korea) + +static struct BurnRomInfo grdnstrmkRomDesc[] = { + { "gst-04.u112", 0x040000, 0x922c931a, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "gst-05.u107", 0x040000, 0xd22ca2dc, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "afega7.u92", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "gst-03.u4", 0x010000, 0xa1347297, 3 | BRF_GRA }, // 3 Characters + + { "afega_af1-b2.uc8", 0x200000, 0xd68588c2, 4 | BRF_GRA }, // 4 Tiles + { "afega_af1-b1.uc3", 0x200000, 0xf8b200a8, 4 | BRF_GRA }, // 5 + + { "afega_af1-sp.uc13", 0x200000, 0x7d4d4985, 5 | BRF_GRA }, // 6 Sprites + + { "afega1.u95", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 7 OKI1 Samples +}; + +STD_ROM_PICK(grdnstrmk) +STD_ROM_FN(grdnstrmk) + +static INT32 GrdnstrmkInit() +{ + INT32 nRet = AfegaInit(GrdnstrmLoadCallback, pAfegaZ80Callback, 1); + + if (nRet == 0) { + decryptcode(0x80000, 16,17,14,15,13); + } + + return nRet; +} + +struct BurnDriver BurnDrvGrdnstrmk = { + "grdnstrmk", "grdnstrm", NULL, NULL, "1998", + "Sen Jin - Guardian Storm (Korea)\0", NULL, "Afega", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, grdnstrmkRomInfo, grdnstrmkRomName, NULL, NULL, CommonInputInfo, GrdnstrkDIPInfo, + GrdnstrmkInit, AfegaExit, AfegaFrame, AfegaDraw, NULL, NULL, 0x300, + 224, 256, 3, 4 +}; + + +// Red Fox War Planes II (China) + +static struct BurnRomInfo redfoxwp2RomDesc[] = { + { "u112", 0x040000, 0x3f31600b, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "u107", 0x040000, 0xdaa44ab4, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "u92", 0x010000, 0x864b55c2, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "u4", 0x010000, 0x19239401, 3 | BRF_GRA }, // 3 Characters + + { "afega_af1-b2.uc8", 0x200000, 0xd68588c2, 4 | BRF_GRA }, // 4 Tiles + { "afega_af1-b1.uc3", 0x200000, 0xf8b200a8, 4 | BRF_GRA }, // 5 + + { "afega_af1-sp.uc13", 0x200000, 0x7d4d4985, 5 | BRF_GRA }, // 6 Sprites + + { "afega1.u95", 0x040000, 0xe911ce33, 6 | BRF_SND }, // 7 OKI1 Samples +}; + +STD_ROM_PICK(redfoxwp2) +STD_ROM_FN(redfoxwp2) + +struct BurnDriver BurnDrvRedfoxwp2 = { + "redfoxwp2", "grdnstrm", NULL, NULL, "1998", + "Red Fox War Planes II (China)\0", NULL, "Afega", "NMK16", + L"\u7D05\u5B64\u6230\u6A5FII\0Red Fox War Planes II (China)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, redfoxwp2RomInfo, redfoxwp2RomName, NULL, NULL, CommonInputInfo, GrdnstrkDIPInfo, + GrdnstrmkInit, AfegaExit, AfegaFrame, AfegaDraw, NULL, NULL, 0x300, + 224, 256, 3, 4 +}; + + +// Pop's Pop's + +static struct BurnRomInfo popspopsRomDesc[] = { + { "afega4.u112", 0x040000, 0xdb191762, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "afega5.u107", 0x040000, 0x17e0c48b, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "afega1.u92", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "afega3.u4", 0x010000, 0xf39dd5d2, 3 | BRF_GRA }, // 3 Characters + + { "afega6.uc8", 0x200000, 0x6d506c97, 4 | BRF_GRA }, // 4 Tiles + { "afega7.uc3", 0x200000, 0x02d7f9de, 4 | BRF_GRA }, // 5 + + { "afega2.u95", 0x040000, 0xecd8eeac, 6 | BRF_SND }, // 6 OKI1 Samples +}; + +STD_ROM_PICK(popspops) +STD_ROM_FN(popspops) + +static INT32 PopspopsLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 5, 1)) return 1; + + memset (DrvGfxROM2, 0xff, 0x80); + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 6, 1)) return 1; + + GrdnstrmGfxDecode(0x10000, 0x400000, 0x80); + + return 0; +} + +static INT32 PopspopsInit() +{ + INT32 nRet = AfegaInit(PopspopsLoadCallback, pAfegaZ80Callback, 1); + + if (nRet == 0) { + decryptcode(0x80000, 16,17,14,15,13); + } + + return nRet; +} + +struct BurnDriver BurnDrvPopspops = { + "popspops", NULL, NULL, NULL, "1999", + "Pop's Pop's\0", NULL, "Afega", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, popspopsRomInfo, popspopsRomName, NULL, NULL, CommonInputInfo, PopspopsDIPInfo, + PopspopsInit, AfegaExit, AfegaFrame, Bubl2000Draw, NULL, NULL, 0x300, + 256, 224, 4, 3 +}; + + +// Bubble 2000 + +static struct BurnRomInfo bubl2000RomDesc[] = { + { "rom10.112", 0x020000, 0x87f960d7, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "rom11.107", 0x020000, 0xb386041a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "rom01.92", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "rom03.4", 0x010000, 0xf4c15588, 3 | BRF_GRA }, // 3 Characters + + { "rom06.6", 0x080000, 0xac1aabf5, 4 | BRF_GRA }, // 4 Tiles + { "rom07.9", 0x080000, 0x69aff769, 4 | BRF_GRA }, // 5 + { "rom13.7", 0x080000, 0x3a5b7226, 4 | BRF_GRA }, // 6 + { "rom04.1", 0x080000, 0x46acd054, 4 | BRF_GRA }, // 7 + { "rom05.3", 0x080000, 0x37deb6a1, 4 | BRF_GRA }, // 8 + { "rom12.2", 0x080000, 0x1fdc59dd, 4 | BRF_GRA }, // 9 + + { "rom08.11", 0x040000, 0x519dfd82, 5 | BRF_GRA }, // 10 Sprites + { "rom09.14", 0x040000, 0x04fcb5c6, 5 | BRF_GRA }, // 11 + + { "rom02.95", 0x040000, 0x859a86e5, 6 | BRF_SND }, // 12 OKI1 Samples +}; + +STD_ROM_PICK(bubl2000) +STD_ROM_FN(bubl2000) + +static INT32 Bubl2000LoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x280000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x300000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 11, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 12, 1)) return 1; + + GrdnstrmGfxDecode(0x10000, 0x400000, 0x80000); + + return 0; +} + +static INT32 Bubl2000Init() +{ + INT32 nRet = AfegaInit(Bubl2000LoadCallback, pAfegaZ80Callback, 1); + + if (nRet == 0) { + decryptcode(0x40000, 13,14,15,16,17); + } + + return nRet; +} + +struct BurnDriver BurnDrvBubl2000 = { + "bubl2000", NULL, NULL, NULL, "1998", + "Bubble 2000\0", NULL, "Tuning", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, bubl2000RomInfo, bubl2000RomName, NULL, NULL, CommonInputInfo, Bubl2000DIPInfo, + Bubl2000Init, AfegaExit, AfegaFrame, Bubl2000Draw, NULL, NULL, 0x300, + 256, 224, 4, 3 +}; + + +// Hot Bubble + +static struct BurnRomInfo hotbublRomDesc[] = { + { "c2.uc9", 0x040000, 0x7917b95d, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "c1.uc1", 0x040000, 0x7bb240e9, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "s1.uc14", 0x010000, 0x5d8cf28e, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "t1.uc2", 0x010000, 0xce683a93, 3 | BRF_GRA }, // 3 Characters + + { "cr5.uc15", 0x080000, 0x65bd5159, 4 | BRF_GRA }, // 4 Tiles + { "cr7.uc19", 0x080000, 0xa89d9ce4, 4 | BRF_GRA }, // 5 + { "cr6.uc16", 0x080000, 0x99d6523c, 4 | BRF_GRA }, // 6 + { "cr1.uc6", 0x080000, 0xfc9101d2, 4 | BRF_GRA }, // 7 + { "cr3.uc12", 0x080000, 0xc841a4f6, 4 | BRF_GRA }, // 8 + { "cr2.uc7", 0x080000, 0x27ad6fc8, 4 | BRF_GRA }, // 9 + + { "br1.uc3", 0x080000, 0x6fc18de4, 5 | BRF_GRA }, // 10 Sprites + { "br3.uc10", 0x080000, 0xbb677240, 5 | BRF_GRA }, // 11 + + { "s2.uc18", 0x040000, 0x401c980f, 6 | BRF_SND }, // 12 OKI1 Samples +}; + +STD_ROM_PICK(hotbubl) +STD_ROM_FN(hotbubl) + +struct BurnDriver BurnDrvHotbubl = { + "hotbubl", "bubl2000", NULL, NULL, "1998", + "Hot Bubble\0", NULL, "Pandora", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, hotbublRomInfo, hotbublRomName, NULL, NULL, CommonInputInfo, Bubl2000DIPInfo, + Bubl2000Init, AfegaExit, AfegaFrame, Bubl2000Draw, NULL, NULL, 0x300, + 256, 224, 4, 3 +}; + + +// Mang-Chi + +static struct BurnRomInfo mangchiRomDesc[] = { + { "afega9.u112", 0x040000, 0x0b1517a5, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "afega10.u107", 0x040000, 0xb1d0f33d, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "sound.u92", 0x010000, 0xbec4f9aa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "afega5.uc6", 0x080000, 0xc73261e0, 4 | BRF_GRA }, // 3 Tiles + { "afega4.uc1", 0x080000, 0x73940917, 4 | BRF_GRA }, // 4 + + { "afega6.uc11", 0x040000, 0x979efc30, 5 | BRF_GRA }, // 5 Sprites + { "afega7.uc14", 0x040000, 0xc5cbcc38, 5 | BRF_GRA }, // 6 + + { "afega2.u95", 0x040000, 0x78c8c1f9, 6 | BRF_SND }, // 7 OKI1 Samples +}; + +STD_ROM_PICK(mangchi) +STD_ROM_FN(mangchi) + +static INT32 MangchiLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + memset (DrvGfxROM0, 0xff, 0x20); + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 6, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; + + GrdnstrmGfxDecode(0x20, 0x100000, 0x80000); + + return 0; +} + +static INT32 MangchiInit() +{ + INT32 nRet = AfegaInit(MangchiLoadCallback, pAfegaZ80Callback, 1); + + if (nRet == 0) { + decryptcode(0x80000, 13,14,15,16,17); + } + + return nRet; +} + +struct BurnDriver BurnDrvMangchi = { + "mangchi", NULL, NULL, NULL, "2000", + "Mang-Chi\0", NULL, "Afega", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, mangchiRomInfo, mangchiRomName, NULL, NULL, CommonInputInfo, MangchiDIPInfo, + MangchiInit, AfegaExit, AfegaFrame, Bubl2000Draw, NULL, NULL, 0x300, + 256, 224, 4, 3 +}; + + +// Fire Hawk + +static struct BurnRomInfo firehawkRomDesc[] = { + { "fhawk_p1.u59", 0x080000, 0xd6d71a50, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "fhawk_p2.u60", 0x080000, 0x9f35d245, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "fhawk_s1.u40", 0x020000, 0xc6609c39, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "fhawk_g1.uc6", 0x200000, 0x2ab0b06b, 4 | BRF_GRA }, // 3 Tiles + { "fhawk_g2.uc5", 0x200000, 0xd11bfa20, 4 | BRF_GRA }, // 4 + + { "fhawk_g3.uc2", 0x200000, 0xcae72ff4, 5 | BRF_GRA }, // 5 Sprites + + { "fhawk_s2.u36", 0x040000, 0xd16aaaad, 6 | BRF_SND }, // 6 OKI1 Samples + + { "fhawk_s3.u41", 0x040000, 0x3fdcfac2, 7 | BRF_SND }, // 7 OKI2 Samples +}; + +STD_ROM_PICK(firehawk) +STD_ROM_FN(firehawk) + +static void pFirehawkZ80Callback() +{ + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM); + ZetMapArea(0xf000, 0xfeff, 0, DrvZ80RAM); + ZetMapArea(0xf000, 0xfeff, 1, DrvZ80RAM); + ZetMapArea(0xf000, 0xfeff, 2, DrvZ80RAM); + + ZetSetWriteHandler(firehawk_sound_write); + ZetSetReadHandler(firehawk_sound_read); + ZetClose(); +} + +static INT32 FirehawkLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000000, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000001, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + memset (DrvGfxROM0, 0xff, 0x20); + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 6, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x040000, 7, 1)) return 1; + + GrdnstrmGfxDecode(0x20, 0x400000, 0x200000); + + return 0; +} + +static INT32 FirehawkInit() +{ + screen_flip_y = 1; + + return AfegaInit(FirehawkLoadCallback, pFirehawkZ80Callback, 1); +} + +struct BurnDriver BurnDrvFirehawk = { + "firehawk", NULL, NULL, NULL, "2001", + "Fire Hawk\0", NULL, "ESD", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, firehawkRomInfo, firehawkRomName, NULL, NULL, CommonInputInfo, FirehawkDIPInfo, + FirehawkInit, AfegaExit, AfegaFrame, FirehawkDraw, NULL, NULL, 0x300, + 256, 224, 4, 3 +}; + + +// Spectrum 2000 (Euro) + +static struct BurnRomInfo spec2kRomDesc[] = { + { "yonatech5.u124", 0x040000, 0x72ab5c05, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "yonatech6.u120", 0x040000, 0x7e44bd9c, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "yonatech1.u103", 0x010000, 0xef5acda7, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "yonatech4.u3", 0x020000, 0x5626b08e, 3 | BRF_GRA }, // 3 Characters + + { "u153.bin", 0x200000, 0xa00bbf8f, 4 | BRF_GRA }, // 4 Tiles + { "u152.bin", 0x200000, 0xf6423fab, 4 | BRF_GRA }, // 5 + + { "u154.bin", 0x200000, 0xf77b764e, 5 | BRF_GRA }, // 6 Sprites + + { "yonatech2.u101", 0x020000, 0x4160f172, 6 | BRF_SND }, // 7 OKI1 Samples + + { "yonatech3.u106", 0x080000, 0x6644c404, 7 | BRF_SND }, // 8 OKI2 Samples +}; + +STD_ROM_PICK(spec2k) +STD_ROM_FN(spec2k) + +static INT32 Spec2kLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x040000, 8, 1)) return 1; + + GrdnstrmGfxDecode(0x20000, 0x400000, 0x200000); + + return 0; +} + +static INT32 Spec2kInit() +{ + screen_flip_y = 1; + + INT32 nRet = AfegaInit(Spec2kLoadCallback, pFirehawkZ80Callback, 1); + + if (nRet == 0) { + decryptcode(0x80000, 17,13,14,15,16); + } + + return nRet; +} + +struct BurnDriver BurnDrvSpec2k = { + "spec2k", NULL, NULL, NULL, "2000", + "Spectrum 2000 (Euro)\0", NULL, "YONA Tech", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, spec2kRomInfo, spec2kRomName, NULL, NULL, CommonInputInfo, Spec2kDIPInfo, + Spec2kInit, AfegaExit, AfegaFrame, FirehawkDraw, NULL, NULL, 0x300, + 256, 224, 4, 3 +}; + + +// Twin Action + +static struct BurnRomInfo twinactnRomDesc[] = { + { "afega.uj13", 0x020000, 0x9187701d, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "afega.uj12", 0x020000, 0xfe8cff9c, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "afega.su6", 0x008000, 0x3a52dc88, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "afega.uj11", 0x020000, 0x3f439e92, 3 | BRF_GRA }, // 3 Characters + + { "afega.ui20", 0x080000, 0x237c8f92, 4 | BRF_GRA }, // 4 Tiles + + { "afega.ub11", 0x080000, 0x287f20d8, 5 | BRF_GRA }, // 5 Sprites + { "afega.ub13", 0x080000, 0xf525f819, 5 | BRF_GRA }, // 6 + + { "afega.su12", 0x020000, 0x91d665f3, 6 | BRF_SND }, // 7 OKI1 Samples + { "afega.su13", 0x040000, 0x30e1c306, 6 | BRF_SND }, // 8 +}; + +STD_ROM_PICK(twinactn) +STD_ROM_FN(twinactn) + +static INT32 TwinactnLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 6, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; + memcpy (DrvSndROM0 + 0x40000, DrvSndROM0 + 0x00000, 0x20000); + memcpy (DrvSndROM0 + 0x60000, DrvSndROM0 + 0x00000, 0x20000); + if (BurnLoadRom(DrvSndROM0 + 0x080000, 8, 1)) return 1; + + DrvGfxDecode(0x20000, 0x80000, 0x100000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); + SekSetWriteWordHandler(0, afega_main_write_word); + SekSetWriteByteHandler(0, afega_main_write_byte); + SekSetReadWordHandler(0, afega_main_read_word); + SekSetReadByteHandler(0, afega_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 TwinactnInit() +{ + input_high[0] = 0x0000; + input_high[1] = 0x8080; + nNMK004EnableIrq2 = 1; + + return MSM6295x1Init(TwinactnLoadCallback); +} + +struct BurnDriver BurnDrvTwinactn = { + "twinactn", NULL, NULL, NULL, "1995", + "Twin Action\0", NULL, "Afega", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, twinactnRomInfo, twinactnRomName, NULL, NULL, CommonInputInfo, TwinactnDIPInfo, + TwinactnInit, MSM6295x1Exit, SsmissinFrame, MacrossDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Saboten Bombers (set 1) + +static struct BurnRomInfo sabotenbRomDesc[] = { + { "ic76.sb1", 0x040000, 0xb2b0b2cf, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "ic75.sb2", 0x040000, 0x367e87b7, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "ic35.sb3", 0x010000, 0xeb7bc99d, 3 | BRF_GRA }, // 2 Characters + + { "ic32.sb4", 0x200000, 0x24c62205, 4 | BRF_GRA }, // 3 Tiles + + { "ic100.sb5", 0x200000, 0xb20f166e, 5 | BRF_GRA }, // 4 Sprites + + { "ic30.sb6", 0x100000, 0x288407af, 6 | BRF_SND }, // 5 OKI1 Samples + + { "ic27.sb7", 0x100000, 0x43e33a7e, 7 | BRF_SND }, // 6 OKI2 Samples +}; + +STD_ROM_PICK(sabotenb) +STD_ROM_FN(sabotenb) + +static INT32 SabotenbLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; + BurnByteswap(DrvGfxROM2, 0x200000); + + if (BurnLoadRom(DrvSndROM0 + 0x040000, 5, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x040000, 6, 1)) return 1; + + decode_gfx(0x200000, 0x200000); + + BjtwinGfxDecode(0x10000, 0x200000, 0x200000); + + return 0; +} + +static INT32 SabotenbInit() +{ + return BjtwinInit(SabotenbLoadCallback); +} + +struct BurnDriver BurnDrvSabotenb = { + "sabotenb", NULL, NULL, NULL, "1992", + "Saboten Bombers (set 1)\0", NULL, "NMK / Tecmo", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, sabotenbRomInfo, sabotenbRomName, NULL, NULL, CommonInputInfo, SabotenbDIPInfo, + SabotenbInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, + 384, 224, 4, 3 +}; + + +// Saboten Bombers (set 2) + +static struct BurnRomInfo sabotenbaRomDesc[] = { + { "sb1.76", 0x040000, 0xdf6f65e2, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "sb2.75", 0x040000, 0x0d2c1ab8, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "ic35.sb3", 0x010000, 0xeb7bc99d, 3 | BRF_GRA }, // 2 Characters + + { "ic32.sb4", 0x200000, 0x24c62205, 4 | BRF_GRA }, // 3 Tiles + + { "ic100.sb5", 0x200000, 0xb20f166e, 5 | BRF_GRA }, // 4 Sprites + + { "ic30.sb6", 0x100000, 0x288407af, 6 | BRF_SND }, // 5 OKI1 Samples + + { "ic27.sb7", 0x100000, 0x43e33a7e, 7 | BRF_SND }, // 6 OKI2 Samples +}; + +STD_ROM_PICK(sabotenba) +STD_ROM_FN(sabotenba) + +struct BurnDriver BurnDrvSabotenba = { + "sabotenba", "sabotenb", NULL, NULL, "1992", + "Saboten Bombers (set 2)\0", NULL, "NMK / Tecmo", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, sabotenbaRomInfo, sabotenbaRomName, NULL, NULL, CommonInputInfo, SabotenbDIPInfo, + SabotenbInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, + 384, 224, 4, 3 +}; + + +// Cactus (bootleg of Saboten Bombers) + +static struct BurnRomInfo cactusRomDesc[] = { + { "02.bin", 0x040000, 0x15b2ff2f, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "01.bin", 0x040000, 0x5b8ba46a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "i03.bin", 0x010000, 0xeb7bc99d, 3 | BRF_GRA }, // 2 Characters + + { "s-05.bin", 0x100000, 0xfce962b9, 4 | BRF_GRA }, // 3 Tiles + { "s-06.bin", 0x100000, 0x16768fbc, 4 | BRF_GRA }, // 4 + + { "s-03.bin", 0x100000, 0xbc1781b8, 5 | BRF_GRA }, // 5 Sprites + { "s-04.bin", 0x100000, 0xf823885e, 5 | BRF_GRA }, // 6 + + { "s-01.bin", 0x100000, 0x288407af, 6 | BRF_SND }, // 7 OKI1 Samples + + { "s-02.bin", 0x100000, 0x43e33a7e, 7 | BRF_SND }, // 8 OKI2 Samples +}; + +STD_ROM_PICK(cactus) +STD_ROM_FN(cactus) + +static INT32 CactusLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x040000, 7, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x040000, 8, 1)) return 1; + + decode_gfx(0x200000, 0x200000); + + BjtwinGfxDecode(0x10000, 0x200000, 0x200000); + + return 0; +} + +static INT32 CactusInit() +{ + return BjtwinInit(CactusLoadCallback); +} + +struct BurnDriver BurnDrvCactus = { + "cactus", "sabotenb", NULL, NULL, "1992", + "Cactus (bootleg of Saboten Bombers)\0", NULL, "bootleg", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, cactusRomInfo, cactusRomName, NULL, NULL, CommonInputInfo, SabotenbDIPInfo, + CactusInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, + 384, 224, 4, 3 +}; + + +// Bombjack Twin (set 1) + +static struct BurnRomInfo bjtwinRomDesc[] = { + { "93087-1.bin", 0x020000, 0x93c84e2d, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "93087-2.bin", 0x020000, 0x30ff678a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "93087-3.bin", 0x010000, 0xaa13df7c, 3 | BRF_GRA }, // 2 Characters + + { "93087-4.bin", 0x100000, 0x8a4f26d0, 4 | BRF_GRA }, // 3 Tiles + + { "93087-5.bin", 0x100000, 0xbb06245d, 5 | BRF_GRA }, // 4 Sprites + + { "93087-6.bin", 0x100000, 0x372d46dd, 6 | BRF_SND }, // 5 OKI1 Samples + + { "93087-7.bin", 0x100000, 0x8da67808, 7 | BRF_SND }, // 6 OKI2 Samples + + { "8.bpr", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 7 Unused proms + { "9.bpr", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 +}; + +STD_ROM_PICK(bjtwin) +STD_ROM_FN(bjtwin) + +static INT32 BjtwinLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; + BurnByteswap(DrvGfxROM2, 0x100000); + + if (BurnLoadRom(DrvSndROM0 + 0x040000, 5, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x040000, 6, 1)) return 1; + + decode_gfx(0x100000, 0x100000); + + BjtwinGfxDecode(0x10000, 0x100000, 0x100000); + + return 0; +} + +static INT32 BjtwinGameInit() +{ + return BjtwinInit(BjtwinLoadCallback); +} + +struct BurnDriver BurnDrvBjtwin = { + "bjtwin", NULL, NULL, NULL, "1993", + "Bombjack Twin (set 1)\0", NULL, "NMK", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, bjtwinRomInfo, bjtwinRomName, NULL, NULL, CommonInputInfo, BjtwinDIPInfo, + BjtwinGameInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, + 224, 384, 3, 4 +}; + + +// Bombjack Twin (set 2) + +static struct BurnRomInfo bjtwinaRomDesc[] = { + { "93087.1", 0x020000, 0xc82b3d8e, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "93087.2", 0x020000, 0x9be1ec47, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "93087-3.bin", 0x010000, 0xaa13df7c, 3 | BRF_GRA }, // 2 Characters + + { "93087-4.bin", 0x100000, 0x8a4f26d0, 4 | BRF_GRA }, // 3 Tiles + + { "93087-5.bin", 0x100000, 0xbb06245d, 5 | BRF_GRA }, // 4 Sprites + + { "93087-6.bin", 0x100000, 0x372d46dd, 6 | BRF_SND }, // 5 OKI1 Samples + + { "93087-7.bin", 0x100000, 0x8da67808, 7 | BRF_SND }, // 6 OKI2 Samples + + { "8.bpr", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 7 Unused proms + { "9.bpr", 0x000100, 0x435653a2, 0 | BRF_OPT }, // 8 +}; + +STD_ROM_PICK(bjtwina) +STD_ROM_FN(bjtwina) + +struct BurnDriver BurnDrvBjtwina = { + "bjtwina", "bjtwin", NULL, NULL, "1993", + "Bombjack Twin (set 2)\0", NULL, "NMK", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, bjtwinaRomInfo, bjtwinaRomName, NULL, NULL, CommonInputInfo, BjtwinDIPInfo, + BjtwinGameInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, + 224, 384, 3, 4 +}; + + +// Nouryoku Koujou Iinkai + +static struct BurnRomInfo nouryokuRomDesc[] = { + { "ic76.1", 0x040000, 0x26075988, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "ic75.2", 0x040000, 0x75ab82cd, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "ic35.3", 0x010000, 0x03d0c3b1, 3 | BRF_GRA }, // 2 Characters + + { "ic32.4", 0x200000, 0x88d454fd, 4 | BRF_GRA }, // 3 Tiles + + { "ic100.5", 0x200000, 0x24d3e24e, 5 | BRF_GRA }, // 4 Sprites + + { "ic30.6", 0x100000, 0xfeea34f4, 6 | BRF_SND }, // 5 OKI1 Samples + + { "ic27.7", 0x100000, 0x8a69fded, 7 | BRF_SND }, // 6 OKI2 Samples +}; + +STD_ROM_PICK(nouryoku) +STD_ROM_FN(nouryoku) + +static INT32 NouryokuLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; + BurnByteswap(DrvGfxROM2, 0x200000); + + if (BurnLoadRom(DrvSndROM0 + 0x040000, 5, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x040000, 6, 1)) return 1; + + decode_gfx(0x200000, 0x200000); + + BjtwinGfxDecode(0x10000, 0x200000, 0x200000); + + return 0; +} + +static INT32 NouryokuGameInit() +{ + return BjtwinInit(NouryokuLoadCallback); +} + +struct BurnDriver BurnDrvNouryoku = { + "nouryoku", NULL, NULL, NULL, "1995", + "Nouryoku Koujou Iinkai\0", NULL, "Tecmo", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, + NULL, nouryokuRomInfo, nouryokuRomName, NULL, NULL, CommonInputInfo, NouryokuDIPInfo, + NouryokuGameInit, BjtwinExit, BjtwinFrame, BjtwinDraw, NULL, NULL, 0x400, + 384, 224, 4, 3 +}; + + +// US AAF Mustang (25th May. 1990) + +static struct BurnRomInfo mustangRomDesc[] = { + { "2.bin", 0x020000, 0xbd9f7c89, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "3.bin", 0x020000, 0x0eec36a5, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "90058-7", 0x010000, 0x920a93c8, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "90058-1", 0x020000, 0x81ccfcad, 3 | BRF_GRA }, // 3 Characters + + { "90058-4", 0x080000, 0xa07a2002, 4 | BRF_GRA }, // 4 Tiles + + { "90058-8", 0x080000, 0x560bff04, 5 | BRF_GRA }, // 5 Sprites + { "90058-9", 0x080000, 0xb9d72a03, 5 | BRF_GRA }, // 6 + + { "90058-5", 0x080000, 0xc60c883e, 6 | BRF_SND }, // 7 OKI1 Samples + + { "90058-6", 0x080000, 0x233c1776, 7 | BRF_SND }, // 8 OKI2 Samples + + { "10.bpr", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 9 Unused proms + { "90058-11", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 +}; + +STD_ROM_PICK(mustang) +STD_ROM_FN(mustang) + +static INT32 MustangLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x00001, 6, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x20000, 7, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM1 + 0x20000, 8, 1)) return 1; + memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); + + DrvGfxDecode(0x20000, 0x80000, 0x100000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); + SekSetWriteWordHandler(0, mustang_main_write_word); + SekSetWriteByteHandler(0, mustang_main_write_byte); + SekSetReadWordHandler(0, mustang_main_read_word); + SekSetReadByteHandler(0, mustang_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 MustangInit() +{ + return NMK004Init(MustangLoadCallback, 10000000, 0, 1); +} + +struct BurnDriver BurnDrvMustang = { + "mustang", NULL, NULL, NULL, "1990", + "US AAF Mustang (25th May. 1990)\0", NULL, "UPL", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, mustangRomInfo, mustangRomName, NULL, NULL, CommonInputInfo, MustangDIPInfo, + MustangInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// US AAF Mustang (25th May. 1990 / Seoul Trading) + +static struct BurnRomInfo mustangsRomDesc[] = { + { "90058-2", 0x020000, 0x833aa458, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "90058-3", 0x020000, 0xe4b80f06, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "90058-7", 0x010000, 0x920a93c8, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "90058-1", 0x020000, 0x81ccfcad, 3 | BRF_GRA }, // 3 Characters + + { "90058-4", 0x080000, 0xa07a2002, 4 | BRF_GRA }, // 4 Tiles + + { "90058-8", 0x080000, 0x560bff04, 5 | BRF_GRA }, // 5 Sprites + { "90058-9", 0x080000, 0xb9d72a03, 5 | BRF_GRA }, // 6 + + { "90058-5", 0x080000, 0xc60c883e, 6 | BRF_SND }, // 7 OKI1 Samples + + { "90058-6", 0x080000, 0x233c1776, 7 | BRF_SND }, // 8 OKI2 Samples + + { "90058-10", 0x000100, 0xde156d99, 0 | BRF_OPT }, // 9 Unused proms + { "90058-11", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 10 +}; + +STD_ROM_PICK(mustangs) +STD_ROM_FN(mustangs) + +struct BurnDriver BurnDrvMustangs = { + "mustangs", "mustang", NULL, NULL, "1990", + "US AAF Mustang (25th May. 1990 / Seoul Trading)\0", NULL, "UPL (Seoul Trading license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, mustangsRomInfo, mustangsRomName, NULL, NULL, CommonInputInfo, MustangDIPInfo, + MustangInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// US AAF Mustang (bootleg) + +static struct BurnRomInfo mustangbRomDesc[] = { + { "mustang.14", 0x020000, 0x13c6363b, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "mustang.13", 0x020000, 0xd8ccce31, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "mustang.16", 0x010000, 0x99ee7505, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "90058-1", 0x020000, 0x81ccfcad, 3 | BRF_GRA }, // 3 Characters + + { "90058-4", 0x080000, 0xa07a2002, 4 | BRF_GRA }, // 4 Tiles + + { "90058-8", 0x080000, 0x560bff04, 5 | BRF_GRA }, // 5 Sprites + { "90058-9", 0x080000, 0xb9d72a03, 5 | BRF_GRA }, // 6 + + { "mustang.17", 0x010000, 0xf6f6c4bf, 6 | BRF_SND }, // 7 oki +}; + +STD_ROM_PICK(mustangb) +STD_ROM_FN(mustangb) + +static INT32 MustangbLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + memcpy (DrvZ80ROM + 0x10000, DrvZ80ROM + 0x8000, 0x8000); + memcpy (DrvZ80ROM + 0x18000, DrvZ80ROM + 0x0000, 0x8000); + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 6, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; + + DrvGfxDecode(0x20000, 0x80000, 0x100000); + + return 0; +} + +static INT32 MustangbInit() +{ + return SeibuSoundInit(MustangbLoadCallback, 1); +} + +struct BurnDriver BurnDrvMustangb = { + "mustangb", "mustang", NULL, NULL, "1990", + "US AAF Mustang (bootleg)\0", "No sound", "bootleg", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, mustangbRomInfo, mustangbRomName, NULL, NULL, CommonInputInfo, MustangDIPInfo, + MustangbInit, SeibuSoundExit, SeibuSoundFrame, MacrossDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// US AAF Mustang (TAB Austria bootleg) + +static struct BurnRomInfo mustangb2RomDesc[] = { + { "05.bin", 0x020000, 0x13c6363b, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "04.bin", 0x020000, 0x0d06f723, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "01.bin", 0x010000, 0x90820499, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "06.bin", 0x020000, 0x81ccfcad, 3 | BRF_GRA }, // 3 Characters + + { "07.bin", 0x020000, 0x5f8fdfb1, 4 | BRF_GRA }, // 4 Tiles + { "10.bin", 0x020000, 0x39757d6a, 4 | BRF_GRA }, // 5 + { "08.bin", 0x020000, 0xb3dd5243, 4 | BRF_GRA }, // 6 + { "09.bin", 0x020000, 0xc6c9752f, 4 | BRF_GRA }, // 7 + + { "18.bin", 0x020000, 0xd13f0722, 5 | BRF_GRA }, // 8 Sprites + { "13.bin", 0x020000, 0x54773f95, 5 | BRF_GRA }, // 9 + { "17.bin", 0x020000, 0x87c1fb43, 5 | BRF_GRA }, // 10 + { "14.bin", 0x020000, 0x932d3e33, 5 | BRF_GRA }, // 11 + { "16.bin", 0x020000, 0x23d03ad5, 5 | BRF_GRA }, // 12 + { "15.bin", 0x020000, 0xa62b2f87, 5 | BRF_GRA }, // 13 + { "12.bin", 0x020000, 0x42a6cfc2, 5 | BRF_GRA }, // 14 + { "11.bin", 0x020000, 0x9d3bee66, 5 | BRF_GRA }, // 15 + + { "02.bin", 0x010000, 0xf6f6c4bf, 6 | BRF_SND }, // 16 oki +}; + +STD_ROM_PICK(mustangb2) +STD_ROM_FN(mustangb2) + +static INT32 Mustangb2LoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + memcpy (DrvZ80ROM + 0x10000, DrvZ80ROM + 0x8000, 0x8000); + memcpy (DrvZ80ROM + 0x18000, DrvZ80ROM + 0x8000, 0x8000); + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x060000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x040000, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x040001, 11, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x080000, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x080001, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x0c0000, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x0c0001, 15, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 16, 1)) return 1; + + DrvGfxDecode(0x20000, 0x80000, 0x100000); + + return 0; +} + +static INT32 Mustangb2Init() +{ + return SeibuSoundInit(Mustangb2LoadCallback, 1); +} + +struct BurnDriver BurnDrvMustangb2 = { + "mustangb2", "mustang", NULL, NULL, "1990", + "US AAF Mustang (TAB Austria bootleg)\0", "No sound", "bootleg", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, mustangb2RomInfo, mustangb2RomName, NULL, NULL, CommonInputInfo, MustangDIPInfo, + Mustangb2Init, SeibuSoundExit, SeibuSoundFrame, MacrossDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Thunder Dragon (9th Jan. 1992) + +static struct BurnRomInfo tdragonRomDesc[] = { + { "91070_68k.8", 0x020000, 0x121c3ae7, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "91070_68k.7", 0x020000, 0x6e154d8e, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "91070.1", 0x010000, 0xbf493d74, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "91070.6", 0x020000, 0xfe365920, 3 | BRF_GRA }, // 3 Characters + + { "91070.5", 0x100000, 0xd0bde826, 4 | BRF_GRA }, // 4 Tiles + + { "91070.4", 0x100000, 0x3eedc2fe, 5 | BRF_GRA }, // 5 Sprites + + { "91070.3", 0x080000, 0xae6875a8, 6 | BRF_SND }, // 6 OKI1 Samples + + { "91070.2", 0x080000, 0xecfea43e, 7 | BRF_SND }, // 7 OKI2 Samples + + { "91070.9", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 8 Unused proms + { "91070.10", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 +}; + +STD_ROM_PICK(tdragon) +STD_ROM_FN(tdragon) + +static INT32 TdragonLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 5, 1)) return 1; + BurnByteswap(DrvGfxROM2, 0x100000); + + if (BurnLoadRom(DrvSndROM0 + 0x20000, 6, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM1 + 0x20000, 7, 1)) return 1; + memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); + + DrvGfxDecode(0x20000, 0x100000, 0x100000); + } + + { + *((UINT16*)(Drv68KROM + 0x048a)) = BURN_ENDIAN_SWAP_INT16(0x4e71); + *((UINT16*)(Drv68KROM + 0x04aa)) = BURN_ENDIAN_SWAP_INT16(0x4e71); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x0b0000, 0x0bffff, SM_ROM); + SekMapMemory(DrvScrollRAM, 0x0c4000, 0x0c43ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x0c8000, 0x0c87ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x0cc000, 0x0cffff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x0d0000, 0x0d07ff, SM_RAM); + SekSetWriteWordHandler(0, tdragon_main_write_word); + SekSetWriteByteHandler(0, tdragon_main_write_byte); + SekSetReadWordHandler(0, tdragon_main_read_word); + SekSetReadByteHandler(0, tdragon_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 TdragonInit() +{ + return NMK004Init(TdragonLoadCallback, 8000000, 0, 1); +} + +struct BurnDriver BurnDrvTdragon = { + "tdragon", NULL, NULL, NULL, "1991", + "Thunder Dragon (9th Jan. 1992)\0", "No sound", "NMK (Tecmo license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, tdragonRomInfo, tdragonRomName, NULL, NULL, CommonInputInfo, TdragonDIPInfo, + TdragonInit, NMK004Exit, NMK004Frame, HachamfDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + +// Thunder Dragon (4th Jun. 1991) + +static struct BurnRomInfo tdragon1RomDesc[] = { + { "thund.8", 0x020000, 0xedd02831, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "thund.7", 0x020000, 0x52192fe5, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "91070.1", 0x010000, 0xbf493d74, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "91070.6", 0x020000, 0xfe365920, 3 | BRF_GRA }, // 3 Characters + + { "91070.5", 0x100000, 0xd0bde826, 4 | BRF_GRA }, // 4 Tiles + + { "91070.4", 0x100000, 0x3eedc2fe, 5 | BRF_GRA }, // 5 Sprites + + { "91070.3", 0x080000, 0xae6875a8, 6 | BRF_SND }, // 6 OKI1 Samples + + { "91070.2", 0x080000, 0xecfea43e, 7 | BRF_SND }, // 7 OKI2 Samples + + { "91070.9", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 8 Unused proms + { "91070.10", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 9 +}; + +STD_ROM_PICK(tdragon1) +STD_ROM_FN(tdragon1) + +struct BurnDriver BurnDrvTdragon1 = { + "tdragon1", "tdragon", NULL, NULL, "1991", + "Thunder Dragon (4th Jun. 1991)\0", NULL, "NMK (Tecmo license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, tdragon1RomInfo, tdragon1RomName, NULL, NULL, CommonInputInfo, TdragonDIPInfo, + TdragonInit, NMK004Exit, NMK004Frame, HachamfDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + +// Thunder Dragon (bootleg) + +static struct BurnRomInfo tdragonbRomDesc[] = { + { "td_04.bin", 0x020000, 0xe8a62d3e, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "td_03.bin", 0x020000, 0x2fa1aa04, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "td_02.bin", 0x010000, 0x99ee7505, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 code + + { "td_08.bin", 0x020000, 0x5144dc69, 3 | BRF_GRA }, // 3 Characters + + { "td_06.bin", 0x080000, 0xc1be8a4d, 4 | BRF_GRA }, // 4 Tiles + { "td_07.bin", 0x080000, 0x2c3e371f, 4 | BRF_GRA }, // 5 + + { "td_10.bin", 0x080000, 0xbfd0ec5d, 5 | BRF_GRA }, // 6 Sprites + { "td_09.bin", 0x080000, 0xb6e074eb, 5 | BRF_GRA }, // 7 + + { "td_01.bin", 0x010000, 0xf6f6c4bf, 6 | BRF_SND }, // 8 OKI1 Samples +}; + +STD_ROM_PICK(tdragonb) +STD_ROM_FN(tdragonb) + +static INT32 TdragonbLoadCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + memcpy (DrvZ80ROM + 0x10000, DrvZ80ROM + 0x8000, 0x8000); + memcpy (DrvZ80ROM + 0x18000, DrvZ80ROM + 0x0000, 0x8000); + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 7, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 8, 1)) return 1; + + decode_tdragonb(); + DrvGfxDecode(0x20000, 0x100000, 0x100000); + + *((UINT16 *)(Drv68KROM + 0x00308)) = BURN_ENDIAN_SWAP_INT16(0x4e71); // fix intro sprites + + return 0; +} + +static INT32 TdragonbInit() +{ + return SeibuSoundInit(TdragonbLoadCallback, 0); +} + +struct BurnDriver BurnDrvTdragonb = { + "tdragonb", "tdragon", NULL, NULL, "1991", + "Thunder Dragon (bootleg)\0", "No sound", "bootleg", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, tdragonbRomInfo, tdragonbRomName, NULL, NULL, CommonInputInfo, TdragonbDIPInfo, + TdragonbInit, SeibuSoundExit, SeibuSoundFrame, MacrossDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + + +// Acrobat Mission + +static struct BurnRomInfo acrobatmRomDesc[] = { + { "02_ic100.bin", 0x020000, 0x3fe487f4, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "01_ic101.bin", 0x020000, 0x17175753, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "04_ic74.bin", 0x010000, 0x176905fb, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "03_ic79.bin", 0x010000, 0xd86c186e, 3 | BRF_GRA }, // 3 Characters + + { "09_ic8.bin", 0x100000, 0x7c12afed, 4 | BRF_GRA }, // 4 Tiles + + { "07_ic42.bin", 0x100000, 0x5672bdaa, 5 | BRF_GRA }, // 5 Sprites + { "08_ic29.bin", 0x080000, 0xb4c0ace3, 5 | BRF_GRA }, // 6 + + { "05_ic54.bin", 0x080000, 0x3b8c2b0e, 6 | BRF_SND }, // 7 OKI1 Samples + + { "06_ic53.bin", 0x080000, 0xc1517cd4, 7 | BRF_SND }, // 8 OKI2 Samples + + { "10_ic81.bin", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 9 Unused proms + { "11_ic80.bin", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 10 +}; + +STD_ROM_PICK(acrobatm) +STD_ROM_FN(acrobatm) + +static INT32 AcrobatmLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x100000, 6, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x020000, 7, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM1 + 0x020000, 8, 1)) return 1; + memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); + + DrvGfxDecode(0x10000, 0x100000, 0x200000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x080000, 0x08ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x0c4000, 0x0c47ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x0c8000, 0x0c83ff, SM_WRITE); + SekMapMemory(DrvBgRAM0, 0x0cc000, 0x0cffff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x0d4000, 0x0d47ff, SM_RAM); + SekSetWriteWordHandler(0, acrobatm_main_write_word); + SekSetWriteByteHandler(0, acrobatm_main_write_byte); + SekSetReadWordHandler(0, acrobatm_main_read_word); + SekSetReadByteHandler(0, acrobatm_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 AcrobatmInit() +{ + return NMK004Init(AcrobatmLoadCallback, 10000000, 0, 1); +} + +struct BurnDriver BurnDrvAcrobatm = { + "acrobatm", NULL, NULL, NULL, "1991", + "Acrobat Mission\0", NULL, "UPL (Taito license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, acrobatmRomInfo, acrobatmRomName, NULL, NULL, AcrobatmInputInfo, AcrobatmDIPInfo, + AcrobatmInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x300, + 224, 256, 3, 4 +}; + + +// Super Spacefortress Macross / Chou-Jikuu Yousai Macross + +static struct BurnRomInfo macrossRomDesc[] = { + { "921a03", 0x080000, 0x33318d55, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + + { "921a02", 0x010000, 0x77c082c7, 2 | BRF_PRG | BRF_ESS }, // 1 NMK004 data + + { "921a01", 0x020000, 0xbbd8242d, 3 | BRF_GRA }, // 2 Characters + + { "921a04", 0x200000, 0x4002e4bb, 4 | BRF_GRA }, // 3 Tiles + + { "921a07", 0x200000, 0x7d2bf112, 5 | BRF_GRA }, // 4 Sprites + + { "921a05", 0x080000, 0xd5a1eddd, 6 | BRF_SND }, // 5 OKI1 Samples + + { "921a06", 0x080000, 0x89461d0f, 7 | BRF_SND }, // 6 OKI2 Samples + + { "921a08", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 7 Unused proms + { "921a09", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 8 + { "921a10", 0x000020, 0x8371e42d, 0 | BRF_OPT }, // 9 +}; + +STD_ROM_PICK(macross) +STD_ROM_FN(macross) + +static INT32 MacrossLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; + BurnByteswap(DrvGfxROM2, 0x200000); + + if (BurnLoadRom(DrvSndROM0 + 0x020000, 5, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM1 + 0x020000, 6, 1)) return 1; + memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); + + decode_gfx(0x200000, 0x200000); + DrvGfxDecode(0x20000, 0x200000, 0x200000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); + SekSetWriteWordHandler(0, macross_main_write_word); + SekSetWriteByteHandler(0, macross_main_write_byte); + SekSetReadWordHandler(0, macross_main_read_word); + SekSetReadByteHandler(0, macross_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 MacrossInit() +{ + return NMK004Init(MacrossLoadCallback, 10000000, 0, 0); +} + +struct BurnDriver BurnDrvMacross = { + "macross", NULL, NULL, NULL, "1992", + "Super Spacefortress Macross / Chou-Jikuu Yousai Macross\0", NULL, "Banpresto", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, macrossRomInfo, macrossRomName, NULL, NULL, CommonInputInfo, MacrossDIPInfo, + MacrossInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + +// GunNail (28th May. 1992) + +static struct BurnRomInfo gunnailRomDesc[] = { + { "3e.bin", 0x040000, 0x61d985b2, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "3o.bin", 0x040000, 0xf114e89c, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "92077_2.bin", 0x010000, 0xcd4e55f8, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "1.bin", 0x020000, 0x3d00a9f4, 3 | BRF_GRA }, // 3 Characters + + { "92077-4.bin", 0x100000, 0xa9ea2804, 4 | BRF_GRA }, // 4 Tiles + + { "92077-7.bin", 0x200000, 0xd49169b3, 5 | BRF_GRA }, // 5 Sprites + + { "92077-5.bin", 0x080000, 0xfeb83c73, 6 | BRF_SND }, // 6 OKI1 Samples + + { "92077-6.bin", 0x080000, 0x6d133f0d, 7 | BRF_SND }, // 7 OKI2 Samples + + { "8.bpr", 0x000100, 0x4299776e, 0 | BRF_OPT }, // 8 Unused proms + { "9.bpr", 0x000100, 0x633ab1c9, 0 | BRF_OPT }, // 9 + { "10.bpr", 0x000020, 0xc60103c8, 0 | BRF_OPT }, // 10 +}; + +STD_ROM_PICK(gunnail) +STD_ROM_FN(gunnail) + +static INT32 GunnailLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; + BurnByteswap(DrvGfxROM2, 0x200000); + + if (BurnLoadRom(DrvSndROM0 + 0x020000, 5, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM1 + 0x020000, 6, 1)) return 1; + memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); + + decode_gfx(0x100000, 0x200000); + DrvGfxDecode(0x20000, 0x100000, 0x200000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c7ff, SM_WRITE); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09c000, 0x09cfff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09d000, 0x09dfff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); + SekSetWriteWordHandler(0, macross_main_write_word); + SekSetWriteByteHandler(0, macross_main_write_byte); + SekSetReadWordHandler(0, macross_main_read_word); + SekSetReadByteHandler(0, macross_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 GunnailInit() +{ + return NMK004Init(GunnailLoadCallback, 12000000, 0, 0); +} + +struct BurnDriver BurnDrvGunnail = { + "gunnail", NULL, NULL, NULL, "1993", + "GunNail (28th May. 1992)\0", NULL, "NMK / Tecmo", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, gunnailRomInfo, gunnailRomName, NULL, NULL, CommonInputInfo, GunnailDIPInfo, + GunnailInit, NMK004Exit, NMK004Frame, GunnailDraw, NULL, NULL, 0x400, + 224, 384, 3, 4 +}; + + +// Black Heart + +static struct BurnRomInfo blkheartRomDesc[] = { + { "blkhrt.7", 0x020000, 0x5bd248c0, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "blkhrt.6", 0x020000, 0x6449e50d, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "4.bin", 0x010000, 0x7cefa295, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "3.bin", 0x020000, 0xa1ab3a16, 3 | BRF_GRA }, // 3 Characters + + { "90068-5.bin", 0x100000, 0xa1ab4f24, 4 | BRF_GRA }, // 4 Tiles + + { "90068-8.bin", 0x100000, 0x9d3204b2, 5 | BRF_GRA }, // 5 Sprites + + { "90068-2.bin", 0x080000, 0x3a583184, 6 | BRF_SND }, // 6 OKI1 Samples + + { "90068-1.bin", 0x080000, 0xe7af69d2, 7 | BRF_SND }, // 7 OKI2 Samples + + { "9.bpr", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 8 Unused proms + { "10.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 9 +}; + +STD_ROM_PICK(blkheart) +STD_ROM_FN(blkheart) + +static INT32 BlkheartLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; + BurnByteswap(DrvGfxROM2, 0x100000); + + if (BurnLoadRom(DrvSndROM0 + 0x020000, 6, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM1 + 0x020000, 7, 1)) return 1; + memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); + + DrvGfxDecode(0x20000, 0x100000, 0x100000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); + SekSetWriteWordHandler(0, macross_main_write_word); + SekSetWriteByteHandler(0, macross_main_write_byte); + SekSetReadWordHandler(0, macross_main_read_word); + SekSetReadByteHandler(0, macross_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 BlkheartInit() +{ + return NMK004Init(BlkheartLoadCallback, 8000000, 0, 0); +} + +struct BurnDriver BurnDrvBlkheart = { + "blkheart", NULL, NULL, NULL, "1991", + "Black Heart\0", NULL, "UPL", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, blkheartRomInfo, blkheartRomName, NULL, NULL, CommonInputInfo, BlkheartDIPInfo, + BlkheartInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Black Heart (Japan) + +static struct BurnRomInfo blkheartjRomDesc[] = { + { "7.bin", 0x020000, 0xe0a5c667, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "6.bin", 0x020000, 0x7cce45e8, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "4.bin", 0x010000, 0x7cefa295, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "3.bin", 0x020000, 0xa1ab3a16, 3 | BRF_GRA }, // 3 Characters + + { "90068-5.bin", 0x100000, 0xa1ab4f24, 4 | BRF_GRA }, // 4 Tiles + + { "90068-8.bin", 0x100000, 0x9d3204b2, 5 | BRF_GRA }, // 5 Sprites + + { "90068-2.bin", 0x080000, 0x3a583184, 6 | BRF_SND }, // 6 OKI1 Samples + + { "90068-1.bin", 0x080000, 0xe7af69d2, 7 | BRF_SND }, // 7 OKI2 Samples + + { "9.bpr", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 8 Unused proms + { "10.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 9 +}; + +STD_ROM_PICK(blkheartj) +STD_ROM_FN(blkheartj) + +struct BurnDriver BurnDrvBlkheartj = { + "blkheartj", "blkheart", NULL, NULL, "1991", + "Black Heart (Japan)\0", NULL, "UPL", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, blkheartjRomInfo, blkheartjRomName, NULL, NULL, CommonInputInfo, BlkheartDIPInfo, + BlkheartInit, NMK004Exit, NMK004Frame, MacrossDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Vandyke (Japan) + +static struct BurnRomInfo vandykeRomDesc[] = { + { "vdk-1.16", 0x020000, 0xc1d01c59, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "vdk-2.15", 0x020000, 0x9d741cc2, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "vdk-4.127", 0x010000, 0xeba544f0, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "vdk-3.222", 0x010000, 0x5a547c1b, 3 | BRF_GRA }, // 3 Characters + + { "vdk-01.13", 0x080000, 0x195a24be, 4 | BRF_GRA }, // 4 Tiles + + { "vdk-07.202", 0x080000, 0x42d41f06, 5 | BRF_GRA }, // 5 Sprites + { "vdk-06.203", 0x080000, 0xd54722a8, 5 | BRF_GRA }, // 6 + { "vdk-04.2-1", 0x080000, 0x0a730547, 5 | BRF_GRA }, // 7 + { "vdk-05.3-1", 0x080000, 0xba456d27, 5 | BRF_GRA }, // 8 + + { "vdk-02.126", 0x080000, 0xb2103274, 6 | BRF_SND }, // 9 OKI1 Samples + + { "vdk-03.165", 0x080000, 0x631776d3, 7 | BRF_SND }, // 10 OKI2 Samples + + { "ic100.bpr", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 11 Unused proms + { "ic101.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 12 +}; + +STD_ROM_PICK(vandyke) +STD_ROM_FN(vandyke) + +static INT32 VandykeLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x100000, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x100001, 8, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x020000, 9, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM1 + 0x020000, 10, 1)) return 1; + memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); + + DrvGfxDecode(0x10000, 0x80000, 0x200000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09d000, 0x09d7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); + SekSetWriteWordHandler(0, macross_main_write_word); + SekSetWriteByteHandler(0, macross_main_write_byte); + SekSetReadWordHandler(0, macross_main_read_word); + SekSetReadByteHandler(0, macross_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 VandykeInit() +{ + return NMK004Init(VandykeLoadCallback, 10000000, 0, 1); +} + +struct BurnDriver BurnDrvVandyke = { + "vandyke", NULL, NULL, NULL, "1990", + "Vandyke (Japan)\0", NULL, "UPL", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, + NULL, vandykeRomInfo, vandykeRomName, NULL, NULL, CommonInputInfo, VandykeDIPInfo, + VandykeInit, NMK004Exit, NMK004Frame, VandykeDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + +// Vandyke (Jaleco, Set 1) + +static struct BurnRomInfo vandykejalRomDesc[] = { + { "vdk-1.16", 0x020000, 0xc1d01c59, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "jaleco2.15", 0x020000, 0x170e4d2e, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "vdk-4.127", 0x010000, 0xeba544f0, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "vdk-3.222", 0x010000, 0x5a547c1b, 3 | BRF_GRA }, // 3 Characters + + { "vdk-01.13", 0x080000, 0x195a24be, 4 | BRF_GRA }, // 4 Tiles + + { "vdk-07.202", 0x080000, 0x42d41f06, 5 | BRF_GRA }, // 5 Sprites + { "vdk-06.203", 0x080000, 0xd54722a8, 5 | BRF_GRA }, // 6 + { "vdk-04.2-1", 0x080000, 0x0a730547, 5 | BRF_GRA }, // 7 + { "vdk-05.3-1", 0x080000, 0xba456d27, 5 | BRF_GRA }, // 8 + + { "vdk-02.126", 0x080000, 0xb2103274, 6 | BRF_SND }, // 9 OKI1 Samples + + { "vdk-03.165", 0x080000, 0x631776d3, 7 | BRF_SND }, // 10 OKI2 Samples + + { "ic100.bpr", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 11 Unused proms + { "ic101.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 12 +}; + +STD_ROM_PICK(vandykejal) +STD_ROM_FN(vandykejal) + +struct BurnDriver BurnDrvVandykejal = { + "vandykejal", "vandyke", NULL, NULL, "1990", + "Vandyke (Jaleco, Set 1)\0", NULL, "UPL (Jaleco license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, + NULL, vandykejalRomInfo, vandykejalRomName, NULL, NULL, CommonInputInfo, VandykeDIPInfo, + VandykeInit, NMK004Exit, NMK004Frame, VandykeDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + +// Vandyke (Jaleco, Set 2) + +static struct BurnRomInfo vandykejal2RomDesc[] = { + { "vdk-even.16", 0x020000, 0xcde05a84, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "vdk-odd.15", 0x020000, 0x0f6fea40, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "vdk-4.127", 0x010000, 0xeba544f0, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "vdk-3.222", 0x010000, 0x5a547c1b, 3 | BRF_GRA }, // 3 Characters + + { "vdk-01.13", 0x080000, 0x195a24be, 4 | BRF_GRA }, // 4 Tiles + + { "vdk-07.202", 0x080000, 0x42d41f06, 5 | BRF_GRA }, // 5 Sprites + { "vdk-06.203", 0x080000, 0xd54722a8, 5 | BRF_GRA }, // 6 + { "vdk-04.2-1", 0x080000, 0x0a730547, 5 | BRF_GRA }, // 7 + { "vdk-05.3-1", 0x080000, 0xba456d27, 5 | BRF_GRA }, // 8 + + { "vdk-02.126", 0x080000, 0xb2103274, 6 | BRF_SND }, // 9 OKI1 Samples + + { "vdk-03.165", 0x080000, 0x631776d3, 7 | BRF_SND }, // 10 OKI2 Samples + + { "ic100.bpr", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 11 Unused proms + { "ic101.bpr", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 12 +}; + +STD_ROM_PICK(vandykejal2) +STD_ROM_FN(vandykejal2) + +struct BurnDriver BurnDrvVandykejal2 = { + "vandykejal2", "vandyke", NULL, NULL, "1990", + "Vandyke (Jaleco, Set 2)\0", NULL, "UPL (Jaleco license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, + NULL, vandykejal2RomInfo, vandykejal2RomName, NULL, NULL, CommonInputInfo, VandykeDIPInfo, + VandykeInit, NMK004Exit, NMK004Frame, VandykeDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + +// Vandyke (bootleg with PIC16c57) + +static struct BurnRomInfo vandykebRomDesc[] = { + { "2.bin", 0x020000, 0x9c269702, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "1.bin", 0x020000, 0xdd6303a1, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "pic16c57", 0x002d4c, 0xbdb3920d, 2 | BRF_PRG | BRF_ESS }, // 2 PIC16c57 code + + { "3.bin", 0x010000, 0x5a547c1b, 3 | BRF_GRA }, // 3 Characters + + { "4.bin", 0x040000, 0x4ba4138d, 4 | BRF_GRA }, // 4 Tiles + { "5.bin", 0x040000, 0x9a1ac697, 4 | BRF_GRA }, // 5 + + { "13.bin", 0x040000, 0xbb561871, 5 | BRF_GRA }, // 6 Sprites + { "17.bin", 0x040000, 0x346e3b66, 5 | BRF_GRA }, // 7 + { "12.bin", 0x040000, 0xcdef9b17, 5 | BRF_GRA }, // 8 + { "16.bin", 0x040000, 0xbeda678c, 5 | BRF_GRA }, // 9 + { "11.bin", 0x020000, 0x823185d9, 5 | BRF_GRA }, // 10 + { "15.bin", 0x020000, 0x149f3247, 5 | BRF_GRA }, // 11 + { "10.bin", 0x020000, 0x388b1abc, 5 | BRF_GRA }, // 12 + { "14.bin", 0x020000, 0x32eeba37, 5 | BRF_GRA }, // 13 + + { "9.bin", 0x020000, 0x56bf774f, 6 | BRF_SND }, // 14 OKI1 Samples + { "8.bin", 0x020000, 0x89851fcf, 6 | BRF_SND }, // 15 + { "7.bin", 0x020000, 0xd7bf0f6a, 6 | BRF_SND }, // 16 + { "6.bin", 0x020000, 0xa7fcf709, 6 | BRF_SND }, // 17 +}; + +STD_ROM_PICK(vandykeb) +STD_ROM_FN(vandykeb) + +static INT32 VandykebLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + // if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000001, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x080000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x080001, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x100000, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x100001, 11, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x140000, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x140001, 13, 2)) return 1; + + // if (BurnLoadRom(DrvSndROM0 + 0x000000, 14, 1)) return 1; + // if (BurnLoadRom(DrvSndROM0 + 0x020000, 15, 1)) return 1; + // if (BurnLoadRom(DrvSndROM0 + 0x040000, 16, 1)) return 1; + // if (BurnLoadRom(DrvSndROM0 + 0x060000, 17, 1)) return 1; + + DrvGfxDecode(0x10000, 0x80000, 0x200000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); +// SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09d000, 0x09d7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); + SekSetWriteWordHandler(0, vandykeb_main_write_word); // different scroll regs + SekSetWriteByteHandler(0, vandykeb_main_write_byte); + SekSetReadWordHandler(0, macross_main_read_word); + SekSetReadByteHandler(0, macross_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 VandykebInit() +{ + input_high[0] = 0x0040; // or it locks up + + return NMK004Init(VandykebLoadCallback, 10000000, 0, 1); +} + +struct BurnDriver BurnDrvVandykeb = { + "vandykeb", "vandyke", NULL, NULL, "1990", + "Vandyke (bootleg with PIC16c57)\0", "No sound", "[UPL] (bootleg)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_SCRFIGHT, 0, + NULL, vandykebRomInfo, vandykebRomName, NULL, NULL, CommonInputInfo, VandykeDIPInfo, + VandykebInit, NMK004Exit, NMK004Frame, VandykeDraw, NULL, NULL, 0x400, + 224, 256, 3, 4 +}; + + +// Hacha Mecha Fighter (19th Sep. 1991) + +static struct BurnRomInfo hachamfRomDesc[] = { + { "7.93", 0x020000, 0x9d847c31, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "6.94", 0x020000, 0xde6408a0, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "1.70", 0x010000, 0x9e6f48fc, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "5.95", 0x020000, 0x29fb04a2, 3 | BRF_GRA }, // 3 Characters + + { "91076-4.101", 0x100000, 0xdf9653a4, 4 | BRF_GRA }, // 4 Tiles + + { "91076-8.57", 0x100000, 0x7fd0f556, 5 | BRF_GRA }, // 5 Sprites + + { "91076-2.46", 0x080000, 0x3f1e67f2, 6 | BRF_SND }, // 6 OKI1 Samples + + { "91076-3.45", 0x080000, 0xb25ed93b, 7 | BRF_SND }, // 7 OKI2 Samples +}; + +STD_ROM_PICK(hachamf) +STD_ROM_FN(hachamf) + +static INT32 HachamfLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; + BurnByteswap(DrvGfxROM2, 0x100000); + + if (BurnLoadRom(DrvSndROM0 + 0x020000, 6, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM1 + 0x020000, 7, 1)) return 1; + memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); + + DrvGfxDecode(0x20000, 0x100000, 0x100000); + } + + { + *((UINT16*)(Drv68KROM + 0x048a)) = 0x4e71; + *((UINT16*)(Drv68KROM + 0x04aa)) = 0x4e71; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_WRITE); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_ROM); + SekSetWriteWordHandler(0, hachamf_main_write_word); + SekSetWriteByteHandler(0, hachamf_main_write_byte); + SekSetReadWordHandler(0, hachamf_main_read_word); + SekSetReadByteHandler(0, hachamf_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 HachamfInit() +{ + return NMK004Init(HachamfLoadCallback, 10000000, 0, 0); +} + +struct BurnDriver BurnDrvHachamf = { + "hachamf", NULL, NULL, NULL, "1991", + "Hacha Mecha Fighter (19th Sep. 1991)\0", NULL, "NMK", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, hachamfRomInfo, hachamfRomName, NULL, NULL, CommonInputInfo, HachamfDIPInfo, + HachamfInit, NMK004Exit, NMK004Frame, HachamfDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Koutetsu Yousai Strahl (Japan set 1) + +static struct BurnRomInfo strahlRomDesc[] = { + { "strahl-2.82", 0x020000, 0xc9d008ae, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "strahl-1.83", 0x020000, 0xafc3c4d6, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "strahl-4.66", 0x010000, 0x60a799c4, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "strahl-3.73", 0x010000, 0x2273b33e, 3 | BRF_GRA }, // 3 Characters + + { "str7b2r0.275", 0x040000, 0x5769e3e1, 4 | BRF_GRA }, // 4 Tiles + + { "strl3-01.32", 0x080000, 0xd8337f15, 5 | BRF_GRA }, // 5 Sprites + { "strl4-02.57", 0x080000, 0x2a38552b, 5 | BRF_GRA }, // 6 + { "strl5-03.58", 0x080000, 0xa0e7d210, 5 | BRF_GRA }, // 7 + + { "str6b1w1.776", 0x080000, 0xbb1bb155, 9 | BRF_SND }, // 8 Foreground Tiles + + { "str8pmw1.540", 0x080000, 0x01d6bb6a, 6 | BRF_SND }, // 9 OKI1 Samples + + { "str9pew1.639", 0x080000, 0x6bb3eb9f, 7 | BRF_SND }, // 10 OKI2 Samples +}; + +STD_ROM_PICK(strahl) +STD_ROM_FN(strahl) + +static INT32 StrahlLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x080000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x100000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 8, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x020000, 9, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM1 + 0x020000, 10, 1)) return 1; + memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); + + DrvGfxDecode(0x10000, 0x100000, 0x200000); + } + + { + *((UINT16*)(Drv68KROM + 0x79e)) = 0x4e71; // remove protection + *((UINT16*)(Drv68KROM + 0x7a0)) = 0x4e71; + *((UINT16*)(Drv68KROM + 0x7a2)) = 0x4e71; + *((UINT16*)(Drv68KROM + 0x8e0)) = 0x4e71; // force pass rom check + *((UINT16*)(Drv68KROM + 0x8e2)) = 0x4e71; + *((UINT16*)(Drv68KROM + 0x968)) = 0x4e71; + *((UINT16*)(Drv68KROM + 0x96a)) = 0x4e71; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvScrollRAM, 0x084000, 0x0843ff, SM_RAM); + SekMapMemory(DrvScrollRAM + 0x400, 0x088000, 0x0883ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x08c000, 0x08c7ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvBgRAM1, 0x094000, 0x097fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); + SekSetWriteWordHandler(0, macross_main_write_word); + SekSetWriteByteHandler(0, macross_main_write_byte); + SekSetReadWordHandler(0, macross_main_read_word); + SekSetReadByteHandler(0, macross_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 StrahlInit() +{ + return NMK004Init(StrahlLoadCallback, 12000000, 0, 1); +} + +struct BurnDriver BurnDrvStrahl = { + "strahl", NULL, NULL, NULL, "1992", + "Koutetsu Yousai Strahl (Japan set 1)\0", NULL, "UPL", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, strahlRomInfo, strahlRomName, NULL, NULL, CommonInputInfo, StrahlDIPInfo, + StrahlInit, NMK004Exit, NMK004Frame, StrahlDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Koutetsu Yousai Strahl (Japan set 2) + +static struct BurnRomInfo strahlaRomDesc[] = { + { "rom2", 0x020000, 0xf80a22ef, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "rom1", 0x020000, 0x802ecbfc, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "strahl-4.66", 0x010000, 0x60a799c4, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "strahl-3.73", 0x010000, 0x2273b33e, 3 | BRF_GRA }, // 3 Characters + + { "str7b2r0.275", 0x040000, 0x5769e3e1, 4 | BRF_GRA }, // 4 Tiles + + { "strl3-01.32", 0x080000, 0xd8337f15, 5 | BRF_GRA }, // 5 Sprites + { "strl4-02.57", 0x080000, 0x2a38552b, 5 | BRF_GRA }, // 6 + { "strl5-03.58", 0x080000, 0xa0e7d210, 5 | BRF_GRA }, // 7 + + { "str6b1w1.776", 0x080000, 0xbb1bb155, 9 | BRF_GRA }, // 8 Foreground tiles + + { "str8pmw1.540", 0x080000, 0x01d6bb6a, 6 | BRF_SND }, // 9 OKI1 Samples + + { "str9pew1.639", 0x080000, 0x6bb3eb9f, 7 | BRF_SND }, // 10 OKI2 Samples +}; + +STD_ROM_PICK(strahla) +STD_ROM_FN(strahla) + +struct BurnDriver BurnDrvStrahla = { + "strahla", "strahl", NULL, NULL, "1992", + "Koutetsu Yousai Strahl (Japan set 2)\0", NULL, "UPL", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, strahlaRomInfo, strahlaRomName, NULL, NULL, CommonInputInfo, StrahlDIPInfo, + StrahlInit, NMK004Exit, NMK004Frame, StrahlDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Bio-ship Paladin + +static struct BurnRomInfo bioshipRomDesc[] = { + { "2.ic14", 0x020000, 0xacf56afb, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "1.ic15", 0x020000, 0x820ef303, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "6.ic120", 0x010000, 0x5f39a980, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "7", 0x010000, 0x2f3f5a10, 3 | BRF_GRA }, // 3 Characters + + { "sbs-g_01.ic9", 0x080000, 0x21302e78, 4 | BRF_GRA }, // 4 Tiles + + { "sbs-g_03.ic194", 0x080000, 0x60e00d7b, 5 | BRF_GRA }, // 5 Sprites + + { "sbs-g_02.ic4", 0x080000, 0xf31eb668, 9 | BRF_GRA }, // 6 Foreground tiles + + { "8.ic27", 0x010000, 0x75a46fea, 10 | BRF_GRA }, // 7 Tilemap roms + { "9.ic26", 0x010000, 0xd91448ee, 10 | BRF_GRA }, // 8 + + { "sbs-g_04.ic139", 0x080000, 0x7c74cc4e, 6 | BRF_SND }, // 9 OKI1 Samples + + { "sbs-g_05.ic160", 0x080000, 0xf0a782e3, 7 | BRF_SND }, // 10 OKI2 Samples + + { "82s135.ic94", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 11 Unused proms + { "82s129.ic69", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 12 + { "82s123.ic154", 0x000020, 0x0f789fc7, 0 | BRF_OPT }, // 13 +}; + +STD_ROM_PICK(bioship) +STD_ROM_FN(bioship) + +static INT32 BioshipLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x080000, 6, 1)) return 1; + + if (BurnLoadRom(DrvTileROM + 0x000001, 7, 2)) return 1; + if (BurnLoadRom(DrvTileROM + 0x000000, 8, 2)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x020000, 9, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x20000, 0x20000); + + if (BurnLoadRom(DrvSndROM1 + 0x020000, 10, 1)) return 1; + memcpy (DrvSndROM1 + 0x00000, DrvSndROM1 + 0x20000, 0x20000); + + DrvGfxDecode(0x10000, 0x100000, 0x80000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0887ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x08c000, 0x08c3ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x090000, 0x093fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x09c000, 0x09c7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0f0000, 0x0fffff, SM_RAM); + SekSetWriteWordHandler(0, macross_main_write_word); + SekSetWriteByteHandler(0, macross_main_write_byte); + SekSetReadWordHandler(0, macross_main_read_word); + SekSetReadByteHandler(0, macross_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 BioshipInit() +{ + return NMK004Init(BioshipLoadCallback, 10000000, 1, 1); +} + +struct BurnDriver BurnDrvBioship = { + "bioship", NULL, NULL, NULL, "1990", + "Bio-ship Paladin\0", NULL, "UPL (American Sammy license)", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, bioshipRomInfo, bioshipRomName, NULL, NULL, CommonInputInfo, BioshipDIPInfo, + BioshipInit, NMK004Exit, NMK004Frame, BioshipDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Space Battle Ship Gomorrah + +static struct BurnRomInfo sbsgomoRomDesc[] = { + { "11.ic14", 0x020000, 0x7916150b, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + { "10.ic15", 0x020000, 0x1d7accb8, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "6.ic120", 0x010000, 0x5f39a980, 2 | BRF_PRG | BRF_ESS }, // 2 NMK004 data + + { "7.ic46", 0x010000, 0xf2b77f80, 3 | BRF_GRA }, // 3 Characters + + { "sbs-g_01.ic9", 0x080000, 0x21302e78, 4 | BRF_GRA }, // 4 Tiles + + { "sbs-g_03.ic194", 0x080000, 0x60e00d7b, 5 | BRF_GRA }, // 5 Sprites + + { "sbs-g_02.ic4", 0x080000, 0xf31eb668, 9 | BRF_GRA }, // 6 Foreground tiles + + { "8.ic27", 0x010000, 0x75a46fea, 10 | BRF_GRA }, // 7 Tilemap roms + { "9.ic26", 0x010000, 0xd91448ee, 10 | BRF_GRA }, // 8 + + { "sbs-g_04.ic139", 0x080000, 0x7c74cc4e, 6 | BRF_SND }, // 9 OKI1 Samples + + { "sbs-g_05.ic160", 0x080000, 0xf0a782e3, 7 | BRF_SND }, // 10 OKI2 Samples + + { "82s135.ic94", 0x000100, 0x98ed1c97, 0 | BRF_OPT }, // 11 Unused proms + { "82s129.ic69", 0x000100, 0xcfdbb86c, 0 | BRF_OPT }, // 12 + { "82s123.ic154", 0x000020, 0x0f789fc7, 0 | BRF_OPT }, // 13 +}; + +STD_ROM_PICK(sbsgomo) +STD_ROM_FN(sbsgomo) + +struct BurnDriver BurnDrvSbsgomo = { + "sbsgomo", "bioship", NULL, NULL, "1990", + "Space Battle Ship Gomorrah\0", NULL, "UPL", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_HORSHOOT, 0, + NULL, sbsgomoRomInfo, sbsgomoRomName, NULL, NULL, CommonInputInfo, BioshipDIPInfo, + BioshipInit, NMK004Exit, NMK004Frame, BioshipDraw, NULL, NULL, 0x400, + 256, 224, 4, 3 +}; + + +// Rapid Hero + +static struct BurnRomInfo rapheroRomDesc[] = { + { "rhp94099.3", 0x080000, 0xec9b4f05, 1 | BRF_PRG | BRF_ESS }, // 0 68k code + + { "rhp94099.2", 0x020000, 0xfe01ece1, 2 | BRF_PRG | BRF_ESS }, // 1 Tmp90c841 Code + + { "rhp94099.1", 0x020000, 0x55a7a011, 3 | BRF_GRA }, // 2 Characters + + { "rhp94099.4", 0x200000, 0x076eee7b, 4 | BRF_GRA }, // 3 Tiles + + { "rhp94099.8", 0x200000, 0x49892f07, 5 | BRF_GRA }, // 4 Sprites + { "rhp94099.9", 0x200000, 0xea2e47f0, 5 | BRF_GRA }, // 5 + { "rhp94099.10", 0x200000, 0x512cb839, 5 | BRF_GRA }, // 6 + + { "rhp94099.7", 0x200000, 0x0d99547e, 6 | BRF_SND }, // 7 OKI1 Samples + + { "rhp94099.5", 0x200000, 0x515eba93, 7 | BRF_SND }, // 8 OKI2 Samples + { "rhp94099.6", 0x200000, 0xf1a80e5a, 7 | BRF_SND }, // 9 + { "rhp94099.7", 0x200000, 0x0d99547e, 7 | BRF_SND }, // 10 + { "rhp94099.7", 0x200000, 0x0d99547e, 7 | BRF_SND }, // 11 + + { "prom1.u19", 0x000100, 0x4299776e, 0 | BRF_OPT }, // 12 Unused proms + { "prom2.u53", 0x000100, 0xe6ead349, 0 | BRF_OPT }, // 13 + { "prom3.u60", 0x000100, 0x304f98c6, 0 | BRF_OPT }, // 14 +}; + +STD_ROM_PICK(raphero) +STD_ROM_FN(raphero) + +static INT32 RapheroLoadCallback() +{ + { + if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 1, 1)) return 1; + memmove (DrvZ80ROM + 0x10000, DrvZ80ROM + 0x00000, 0x20000); + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x200000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x400000, 6, 1)) return 1; + BurnByteswap(DrvGfxROM2, 0x600000); + + if (BurnLoadRom(DrvSndROM0 + 0x040000, 7, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x40000, 0x20000); + + if (BurnLoadRom(DrvSndROM0 + 0x040000, 8, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x240000, 9, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x440000, 10, 1)) return 1; + if (BurnLoadRom(DrvSndROM0 + 0x640000, 11, 1)) return 1; + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x40000, 0x20000); + + DrvGfxDecode(0x20000, 0x200000, 0x600000); + memset (DrvGfxROM2 + 0xc00000, 0x0f, 0x400000); + nGraphicsMask[2] = 0xffff; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x120000, 0x1207ff, SM_RAM); + SekMapMemory(DrvScrollRAM, 0x130000, 0x1307ff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x140000, 0x143fff, SM_RAM); + SekMapMemory(DrvBgRAM1, 0x144000, 0x147fff, SM_RAM); + SekMapMemory(DrvBgRAM2, 0x148000, 0x14bfff, SM_RAM); + SekMapMemory(DrvBgRAM3, 0x14c000, 0x14ffff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x170000, 0x170fff, SM_RAM); + SekMapMemory(DrvTxRAM, 0x171000, 0x171fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x1f0000, 0x1fffff, SM_RAM); + SekSetWriteWordHandler(0, raphero_main_write_word); + SekSetWriteByteHandler(0, raphero_main_write_byte); + SekSetReadWordHandler(0, raphero_main_read_word); + SekSetReadByteHandler(0, raphero_main_read_byte); + SekClose(); + + return 0; +} + +static INT32 RapheroInit() +{ + return NMK004Init(RapheroLoadCallback, 14000000, 0, 0); // NOT REALLY NMK004!!! +} + +struct BurnDriver BurnDrvRaphero = { + "raphero", NULL, NULL, NULL, "1994", + "Rapid Hero\0", "Incomplete sound", "Media Trading Corp", "NMK16", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, rapheroRomInfo, rapheroRomName, NULL, NULL, Tdragon2InputInfo, RapheroDIPInfo, + RapheroInit, NMK004Exit, NMK004Frame, RapheroDraw, NULL, NULL, 0x400, + 224, 384, 3, 4 +}; diff --git a/src/burn/drv/pst90s/d_pass.cpp b/src/burn/drv/pst90s/d_pass.cpp index 5480b3713..776aa3fff 100644 --- a/src/burn/drv/pst90s/d_pass.cpp +++ b/src/burn/drv/pst90s/d_pass.cpp @@ -1,516 +1,515 @@ -// FB Alpha Pass driver module -// Based on MAME driver by David Haywood and Stephh - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2203.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSndROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvBgVRAM; -static UINT8 *DrvFgVRAM; -static UINT32 *DrvPalette; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; -static UINT16 DrvInputs[2]; - -static UINT8 *soundlatch; - -static struct BurnInputInfo PassInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 1, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 4, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 5, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 6, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 7, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 9, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 12, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 13, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 14, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 15, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 10, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 11, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Pass) - -static struct BurnDIPInfo PassDIPList[]= -{ - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xe7, NULL }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x03, 0x00, "2" }, - {0x12, 0x01, 0x03, 0x03, "3" }, - {0x12, 0x01, 0x03, 0x01, "4" }, - {0x12, 0x01, 0x03, 0x02, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x18, 0x00, "Easy" }, - {0x12, 0x01, 0x18, 0x18, "Normal" }, - {0x12, 0x01, 0x18, 0x08, "Hard" }, - {0x12, 0x01, 0x18, 0x10, "Hardest" }, - - {0 , 0xfe, 0 , 7, "Coinage" }, - {0x12, 0x01, 0xe0, 0x80, "4 Coins 1 Credits " }, - {0x12, 0x01, 0xe0, 0x40, "3 Coins 1 Credits " }, - {0x12, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits " }, - {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, -}; - -STDDIPINFO(Pass) - -void __fastcall pass_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x230000: - *soundlatch = data & 0xff; - return; - } -} - -void __fastcall pass_write_byte(UINT32 /*address*/, UINT8 /*data*/) -{ - -} - -UINT16 __fastcall pass_read_word(UINT32 address) -{ - switch (address) - { - case 0x230100: - return DrvInputs[1]; - - case 0x230200: - return DrvInputs[0]; - } - - return 0; -} - -UINT8 __fastcall pass_read_byte(UINT32 /*address*/) -{ - return 0; -} - -void __fastcall pass_sound_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x70: - BurnYM2203Write(0, 0, data); - return; - - case 0x71: - BurnYM2203Write(0, 1, data); - return; - - case 0x80: - MSM6295Command(0, data); - return; - - case 0xc0: - *soundlatch = 0; - return; - } -} - -UINT8 __fastcall pass_sound_read_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return *soundlatch; - - case 0x70: - return BurnYM2203Read(0, 0); - - case 0x71: - return BurnYM2203Read(0, 1); - } - - return 0; -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3579545; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3579545.0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - MSM6295Reset(0); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x040000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x040000; - DrvGfxROM1 = Next; Next += 0x080000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x020000; - - DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x004000; - DrvPalRAM = Next; Next += 0x000400; - DrvBgVRAM = Next; Next += 0x001000; - DrvFgVRAM = Next; Next += 0x004000; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x0000000, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x0000001, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - if (BurnLoadRom(DrvSndROM, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 5, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040001, 9, 2)) return 1; - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x080000, 0x083fff, SM_RAM); - SekMapMemory(DrvBgVRAM, 0x200000, 0x200fff, SM_RAM); - SekMapMemory(DrvFgVRAM, 0x210000, 0x213fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x220000, 0x2203ff, SM_RAM); - SekSetWriteWordHandler(0, pass_write_word); - SekSetWriteByteHandler(0, pass_write_byte); - SekSetReadWordHandler(0, pass_read_word); - SekSetReadByteHandler(0, pass_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM); - ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM); - ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); - ZetSetOutHandler(pass_sound_write_port); - ZetSetInHandler(pass_sound_read_port); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(1, 3579545, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3579545); - BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 792000 / 132, 1); - MSM6295SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM2203Exit(); - MSM6295Exit(0); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - return 0; -} - -static void draw_foreground_layer() -{ - UINT16 *vram = (UINT16*)DrvFgVRAM; - - for (INT32 offs = 0; offs < 128 * 64; offs++) - { - INT32 sx = ((offs & 0x7f) << 2) - 64; - INT32 sy = ((offs >> 7) << 2) - 16; - - if (sx >= nScreenWidth || sx < -3 || sy >= nScreenHeight || sy < -3) continue; - - INT32 attr = vram[offs]; - INT32 code = attr & 0x3fff; - INT32 flipy = (attr & 0x8000) >> 15; - INT32 flipx = (attr & 0x4000) >> 14; - - if (code < 0x10) continue; - - INT32 flip = (flipy * 0x0c) | (flipx * 3); - UINT8 *src = DrvGfxROM0 + (code << 4); - - for (INT32 y = 0; y < 4; y++, sy++) - { - for (INT32 x = 0; x < 4; x++) - { - INT32 pxl = src[((y << 2) | x) ^ flip]; - if (pxl == 0xff) continue; - - pTransDraw[(sy * nScreenWidth) + (sx + x)] = pxl | 0x100; - } - } - } -} - -static void draw_background_layer() -{ - UINT16 *vram = (UINT16*)DrvBgVRAM; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = ((offs & 0x3f) << 3) - 64; - INT32 sy = ((offs >> 6) << 3) - 16; - - if (sx >= nScreenWidth || sx < -7 || sy >= nScreenHeight || sy < -7) continue; - - INT32 attr = vram[offs]; - INT32 code = attr & 0x1fff; - INT32 flipy = attr & 0x8000; - INT32 flipx = attr & 0x4000; - - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM1); - } else { - Render8x8Tile_FlipY(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render8x8Tile_FlipX(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM1); - } else { - Render8x8Tile(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM1); - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - UINT8 r,g,b; - UINT16 *pal = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x200; i++) { - INT32 d = pal[i]; - - r = ((d >> 10) & 0x1f); - g = ((d >> 5) & 0x1f); - b = ((d >> 0) & 0x1f); - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } - } - - draw_background_layer(); - draw_foreground_layer(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - SekNewFrame(); - ZetNewFrame(); - - { - DrvInputs[0] = ~0; - DrvInputs[1] = DrvDips[0] | (DrvDips[1] << 8); - - for (INT32 i = 0; i < 16; i++) - { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - } - } - - INT32 nSegment; - INT32 nInterleave = 10; - INT32 nTotalCycles[2] = { 7159090 / 60, 3579545 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); - nCyclesDone[0] += SekRun(nSegment); - - nSegment = nTotalCycles[1] / nInterleave; - BurnTimerUpdate(i * nSegment); - } - - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - BurnTimerEndFrame(nTotalCycles[1]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029703; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - } - - return 0; -} - - -// Pass - -static struct BurnRomInfo passRomDesc[] = { - { "33", 0x20000, 0x0c5f18f6, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "34", 0x20000, 0x7b54573d, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "23", 0x10000, 0xb9a0ccde, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "31", 0x20000, 0xc7315bbd, 3 | BRF_SND }, // 3 Samples - - { "35", 0x20000, 0x2ab33f07, 4 | BRF_GRA }, // 4 Foreground Tiles - { "36", 0x20000, 0x6677709d, 4 | BRF_GRA }, // 5 - - { "38", 0x20000, 0x7f11b81a, 5 | BRF_GRA }, // 6 Background Tiles - { "40", 0x20000, 0x80e0a71d, 5 | BRF_GRA }, // 7 - { "37", 0x20000, 0x296499e7, 5 | BRF_GRA }, // 8 - { "39", 0x20000, 0x35c0ad5c, 5 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(pass) -STD_ROM_FN(pass) - -struct BurnDriver BurnDrvPass = { - "pass", NULL, NULL, NULL, "1992", - "Pass\0", NULL, "Oksan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, - NULL, passRomInfo, passRomName, NULL, NULL, PassInputInfo, PassDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 320, 224, 4, 3 -}; +// FB Alpha Pass driver module +// Based on MAME driver by David Haywood and Stephh + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2203.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSndROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvBgVRAM; +static UINT8 *DrvFgVRAM; +static UINT32 *DrvPalette; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; +static UINT16 DrvInputs[2]; + +static UINT8 *soundlatch; + +static struct BurnInputInfo PassInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 1, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 4, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 5, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 6, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 7, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 9, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 12, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 13, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 14, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 15, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 10, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 11, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Pass) + +static struct BurnDIPInfo PassDIPList[]= +{ + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xe7, NULL }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x03, 0x00, "2" }, + {0x12, 0x01, 0x03, 0x03, "3" }, + {0x12, 0x01, 0x03, 0x01, "4" }, + {0x12, 0x01, 0x03, 0x02, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x18, 0x00, "Easy" }, + {0x12, 0x01, 0x18, 0x18, "Normal" }, + {0x12, 0x01, 0x18, 0x08, "Hard" }, + {0x12, 0x01, 0x18, 0x10, "Hardest" }, + + {0 , 0xfe, 0 , 7, "Coinage" }, + {0x12, 0x01, 0xe0, 0x80, "4 Coins 1 Credits " }, + {0x12, 0x01, 0xe0, 0x40, "3 Coins 1 Credits " }, + {0x12, 0x01, 0xe0, 0xc0, "2 Coins 1 Credits " }, + {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, +}; + +STDDIPINFO(Pass) + +void __fastcall pass_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x230000: + *soundlatch = data & 0xff; + return; + } +} + +void __fastcall pass_write_byte(UINT32 /*address*/, UINT8 /*data*/) +{ + +} + +UINT16 __fastcall pass_read_word(UINT32 address) +{ + switch (address) + { + case 0x230100: + return DrvInputs[1]; + + case 0x230200: + return DrvInputs[0]; + } + + return 0; +} + +UINT8 __fastcall pass_read_byte(UINT32 /*address*/) +{ + return 0; +} + +void __fastcall pass_sound_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x70: + BurnYM2203Write(0, 0, data); + return; + + case 0x71: + BurnYM2203Write(0, 1, data); + return; + + case 0x80: + MSM6295Command(0, data); + return; + + case 0xc0: + *soundlatch = 0; + return; + } +} + +UINT8 __fastcall pass_sound_read_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return *soundlatch; + + case 0x70: + return BurnYM2203Read(0, 0); + + case 0x71: + return BurnYM2203Read(0, 1); + } + + return 0; +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3579545; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3579545.0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + MSM6295Reset(0); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x040000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x040000; + DrvGfxROM1 = Next; Next += 0x080000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x020000; + + DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x004000; + DrvPalRAM = Next; Next += 0x000400; + DrvBgVRAM = Next; Next += 0x001000; + DrvFgVRAM = Next; Next += 0x004000; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x0000000, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x0000001, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + if (BurnLoadRom(DrvSndROM, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 5, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040001, 9, 2)) return 1; + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x080000, 0x083fff, SM_RAM); + SekMapMemory(DrvBgVRAM, 0x200000, 0x200fff, SM_RAM); + SekMapMemory(DrvFgVRAM, 0x210000, 0x213fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x220000, 0x2203ff, SM_RAM); + SekSetWriteWordHandler(0, pass_write_word); + SekSetWriteByteHandler(0, pass_write_byte); + SekSetReadWordHandler(0, pass_read_word); + SekSetReadByteHandler(0, pass_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM); + ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM); + ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM); + ZetSetOutHandler(pass_sound_write_port); + ZetSetInHandler(pass_sound_read_port); + ZetClose(); + + BurnYM2203Init(1, 3579545, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3579545); + BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 792000 / 132, 1); + MSM6295SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM2203Exit(); + MSM6295Exit(0); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + return 0; +} + +static void draw_foreground_layer() +{ + UINT16 *vram = (UINT16*)DrvFgVRAM; + + for (INT32 offs = 0; offs < 128 * 64; offs++) + { + INT32 sx = ((offs & 0x7f) << 2) - 64; + INT32 sy = ((offs >> 7) << 2) - 16; + + if (sx >= nScreenWidth || sx < -3 || sy >= nScreenHeight || sy < -3) continue; + + INT32 attr = vram[offs]; + INT32 code = attr & 0x3fff; + INT32 flipy = (attr & 0x8000) >> 15; + INT32 flipx = (attr & 0x4000) >> 14; + + if (code < 0x10) continue; + + INT32 flip = (flipy * 0x0c) | (flipx * 3); + UINT8 *src = DrvGfxROM0 + (code << 4); + + for (INT32 y = 0; y < 4; y++, sy++) + { + for (INT32 x = 0; x < 4; x++) + { + INT32 pxl = src[((y << 2) | x) ^ flip]; + if (pxl == 0xff) continue; + + pTransDraw[(sy * nScreenWidth) + (sx + x)] = pxl | 0x100; + } + } + } +} + +static void draw_background_layer() +{ + UINT16 *vram = (UINT16*)DrvBgVRAM; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = ((offs & 0x3f) << 3) - 64; + INT32 sy = ((offs >> 6) << 3) - 16; + + if (sx >= nScreenWidth || sx < -7 || sy >= nScreenHeight || sy < -7) continue; + + INT32 attr = vram[offs]; + INT32 code = attr & 0x1fff; + INT32 flipy = attr & 0x8000; + INT32 flipx = attr & 0x4000; + + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM1); + } else { + Render8x8Tile_FlipY(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render8x8Tile_FlipX(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM1); + } else { + Render8x8Tile(pTransDraw, code, sx, sy, 0, 8, 0, DrvGfxROM1); + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + UINT8 r,g,b; + UINT16 *pal = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x200; i++) { + INT32 d = pal[i]; + + r = ((d >> 10) & 0x1f); + g = ((d >> 5) & 0x1f); + b = ((d >> 0) & 0x1f); + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } + } + + draw_background_layer(); + draw_foreground_layer(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + SekNewFrame(); + ZetNewFrame(); + + { + DrvInputs[0] = ~0; + DrvInputs[1] = DrvDips[0] | (DrvDips[1] << 8); + + for (INT32 i = 0; i < 16; i++) + { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + } + } + + INT32 nSegment; + INT32 nInterleave = 10; + INT32 nTotalCycles[2] = { 7159090 / 60, 3579545 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); + nCyclesDone[0] += SekRun(nSegment); + + nSegment = nTotalCycles[1] / nInterleave; + BurnTimerUpdate(i * nSegment); + } + + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + BurnTimerEndFrame(nTotalCycles[1]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029703; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + } + + return 0; +} + + +// Pass + +static struct BurnRomInfo passRomDesc[] = { + { "33", 0x20000, 0x0c5f18f6, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "34", 0x20000, 0x7b54573d, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "23", 0x10000, 0xb9a0ccde, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "31", 0x20000, 0xc7315bbd, 3 | BRF_SND }, // 3 Samples + + { "35", 0x20000, 0x2ab33f07, 4 | BRF_GRA }, // 4 Foreground Tiles + { "36", 0x20000, 0x6677709d, 4 | BRF_GRA }, // 5 + + { "38", 0x20000, 0x7f11b81a, 5 | BRF_GRA }, // 6 Background Tiles + { "40", 0x20000, 0x80e0a71d, 5 | BRF_GRA }, // 7 + { "37", 0x20000, 0x296499e7, 5 | BRF_GRA }, // 8 + { "39", 0x20000, 0x35c0ad5c, 5 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(pass) +STD_ROM_FN(pass) + +struct BurnDriver BurnDrvPass = { + "pass", NULL, NULL, NULL, "1992", + "Pass\0", NULL, "Oksan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, + NULL, passRomInfo, passRomName, NULL, NULL, PassInputInfo, PassDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_powerins.cpp b/src/burn/drv/pst90s/d_powerins.cpp index 970c613d5..7394060ee 100644 --- a/src/burn/drv/pst90s/d_powerins.cpp +++ b/src/burn/drv/pst90s/d_powerins.cpp @@ -1,1205 +1,1204 @@ -/*************************************************************** - Power Instinct - (C) 1993 Atlus - driver by Luca Elia (l.elia@tin.it) - *************************************************************** - port to Finalburn Alpha by OopsWare. 2007 - ***************************************************************/ - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "msm6295.h" -#include "burn_ym2203.h" - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; - -static UINT8 *Rom68K; -static UINT8 *RomZ80; -static UINT8 *RomBg; -static UINT8 *RomFg; -static UINT8 *RomSpr; - -static UINT8 *RamZ80; -static UINT16 *RamPal; -static UINT16 *RamBg; -static UINT16 *RamFg; -static UINT16 *RamSpr; -static UINT16 *RamVReg; - -static UINT32 *RamCurPal; - -static UINT8 DrvButton[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -static UINT8 DrvJoy1[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -static UINT8 DrvJoy2[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -static UINT8 DrvInput[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -static UINT8 bRecalcPalette = 0; -static UINT8 DrvReset = 0; - -static UINT32 tile_bank; -static INT32 m6295size; -static UINT16 soundlatch = 0; -static INT32 oki_bank = -1; - -#define GAME_POWERINS 1 -#define GAME_POWERINA 2 -#define GAME_POWERINB 3 - -static INT32 game_drv = 0; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -inline static void CalcCol(INT32 idx) -{ - /* RRRR GGGG BBBB RGBx */ - UINT16 wordValue = RamPal[idx]; - INT32 r = ((wordValue >> 8) & 0xF0 ) | ((wordValue << 0) & 0x08) | ((wordValue >> 13) & 0x07 ); - INT32 g = ((wordValue >> 4) & 0xF0 ) | ((wordValue << 1) & 0x08) | ((wordValue >> 9) & 0x07 ); - INT32 b = ((wordValue >> 0) & 0xF0 ) | ((wordValue << 2) & 0x08) | ((wordValue >> 5) & 0x07 ); - RamCurPal[idx] = BurnHighCol(r, g, b, 0); -} - -static struct BurnInputInfo powerinsInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 3, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 4"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 4, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 4"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvButton + 5, "diag"}, - {"Service", BIT_DIGITAL, DrvButton + 2, "service"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 4, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 6, "dip"}, -}; - -STDINPUTINFO(powerins) - -static struct BurnDIPInfo powerinsDIPList[] = { - - // Defaults - {0x17, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, "Free play"}, - {0x17, 0x01, 0x01, 0x00, "Off"}, - {0x17, 0x01, 0x01, 0x01, "On"}, - {0, 0xFE, 0, 8, "Coin 1"}, - {0x17, 0x01, 0x70, 0x30, "4 coins 1 credit"}, - {0x17, 0x01, 0x70, 0x50, "3 coins 1 credit"}, - {0x17, 0x01, 0x70, 0x10, "2 coins 1 credit"}, - {0x17, 0x01, 0x70, 0x00, "1 coin 1 credit"}, - {0x17, 0x01, 0x70, 0x40, "1 coin 2 credits"}, - {0x17, 0x01, 0x70, 0x20, "1 coin 3 credits"}, - {0x17, 0x01, 0x70, 0x60, "1 coin 4 credits"}, - {0x17, 0x01, 0x70, 0x70, "2 coins to start, 1 to continue"}, - {0, 0xFE, 0, 8, "Coin 2"}, - {0x17, 0x01, 0x0E, 0x06, "4 coins 1 credit"}, - {0x17, 0x01, 0x0E, 0x0A, "3 coins 1 credit"}, - {0x17, 0x01, 0x0E, 0x02, "2 coins 1 credit"}, - {0x17, 0x01, 0x0E, 0x00, "1 coin 1 credit"}, - {0x17, 0x01, 0x0E, 0x08, "1 coin 2 credits"}, - {0x17, 0x01, 0x0E, 0x04, "1 coin 3 credits"}, - {0x17, 0x01, 0x0E, 0x0C, "1 coin 4 credits"}, - {0x17, 0x01, 0x0E, 0x0E, "2 coins to start, 1 to continue"}, - {0, 0xFE, 0, 2, "Flip screen"}, - {0x17, 0x01, 0x80, 0x00, "Off"}, - {0x17, 0x01, 0x80, 0x80, "On"}, - -}; - -static struct BurnDIPInfo powerinaDIPList[] = { - - // Defaults - {0x18, 0xFF, 0xFF, 0x04, NULL}, - - // DIP 2 - {0, 0xFE, 0, 2, "Coin chutes"}, - {0x18, 0x01, 0x01, 0x00, "1 chute"}, - {0x18, 0x01, 0x01, 0x01, "2 chutes"}, - {0, 0xFE, 0, 2, "Join In mode"}, - {0x18, 0x01, 0x02, 0x00, "Off"}, - {0x18, 0x01, 0x02, 0x02, "On"}, - {0, 0xFE, 0, 2, "Demo sounds"}, - {0x18, 0x01, 0x04, 0x00, "Off"}, - {0x18, 0x01, 0x04, 0x04, "On"}, - {0, 0xFE, 0, 2, "Allow continue"}, - {0x18, 0x01, 0x08, 0x08, "Off"}, - {0x18, 0x01, 0x08, 0x00, "On"}, - {0, 0xFE, 0, 2, "Blood color"}, - {0x18, 0x01, 0x10, 0x00, "Red"}, - {0x18, 0x01, 0x10, 0x10, "Blue"}, - {0, 0xFE, 0, 2, "Game time"}, - {0x18, 0x01, 0x20, 0x00, "Normal"}, - {0x18, 0x01, 0x20, 0x20, "Short"}, - {0, 0xFE, 0, 4, "Difficulty"}, - {0x18, 0x01, 0xC0, 0x80, "Easy"}, - {0x18, 0x01, 0xC0, 0x00, "Normal"}, - {0x18, 0x01, 0xC0, 0x40, "Hard"}, - {0x18, 0x01, 0xC0, 0xC0, "Hardest"}, - -}; - -static struct BurnDIPInfo powerinjDIPList[] = { - - // Defaults - {0x18, 0xFF, 0xFF, 0x04, NULL}, - - // DIP 2 -// {0, 0xFE, 0, 2, "Unknown"}, -// {0x18, 0x01, 0x01, 0x00, "Off"}, -// {0x18, 0x01, 0x01, 0x01, "On"}, - {0, 0xFE, 0, 2, "Join In mode"}, - {0x18, 0x01, 0x02, 0x00, "Off"}, - {0x18, 0x01, 0x02, 0x02, "On"}, - {0, 0xFE, 0, 2, "Demo sounds"}, - {0x18, 0x01, 0x04, 0x00, "Off"}, - {0x18, 0x01, 0x04, 0x04, "On"}, - {0, 0xFE, 0, 2, "Allow continue"}, - {0x18, 0x01, 0x08, 0x08, "Off"}, - {0x18, 0x01, 0x08, 0x00, "On"}, - {0, 0xFE, 0, 2, "Blood color"}, - {0x18, 0x01, 0x10, 0x00, "Red"}, - {0x18, 0x01, 0x10, 0x10, "Blue"}, - {0, 0xFE, 0, 2, "Game time"}, - {0x18, 0x01, 0x20, 0x00, "Normal"}, - {0x18, 0x01, 0x20, 0x20, "Short"}, - {0, 0xFE, 0, 4, "Difficulty"}, - {0x18, 0x01, 0xC0, 0x80, "Easy"}, - {0x18, 0x01, 0xC0, 0x00, "Normal"}, - {0x18, 0x01, 0xC0, 0x40, "Hard"}, - {0x18, 0x01, 0xC0, 0xC0, "Hardest"}, - -}; - -STDDIPINFOEXT(powerins, powerins, powerina) -STDDIPINFOEXT(powerinj, powerins, powerinj) - -// Rom information - -static struct BurnRomInfo powerinsRomDesc[] = { - { "93095-3a.u108", 0x080000, 0x9825ea3d, BRF_ESS | BRF_PRG }, // 68000 code - { "93095-4.u109", 0x080000, 0xd3d7a782, BRF_ESS | BRF_PRG }, - - { "93095-2.u90", 0x020000, 0x4b123cc6, BRF_ESS | BRF_PRG }, // Z80 code - - { "93095-5.u16", 0x100000, 0xb1371808, BRF_GRA }, // layer 0 - { "93095-6.u17", 0x100000, 0x29c85d80, BRF_GRA }, - { "93095-7.u18", 0x080000, 0x2dd76149, BRF_GRA }, - - { "93095-1.u15", 0x020000, 0x6a579ee0, BRF_GRA }, // layer 1 - - { "93095-12.u116", 0x100000, 0x35f3c2a3, BRF_GRA }, - { "93095-13.u117", 0x100000, 0x1ebd45da, BRF_GRA }, - { "93095-14.u118", 0x100000, 0x760d871b, BRF_GRA }, - { "93095-15.u119", 0x100000, 0xd011be88, BRF_GRA }, - { "93095-16.u120", 0x100000, 0xa9c16c9c, BRF_GRA }, - { "93095-17.u121", 0x100000, 0x51b57288, BRF_GRA }, - { "93095-18.u122", 0x100000, 0xb135e3f2, BRF_GRA }, - { "93095-19.u123", 0x100000, 0x67695537, BRF_GRA }, - - { "93095-10.u48", 0x100000, 0x329ac6c5, BRF_SND }, // sound 1 - { "93095-11.u49", 0x100000, 0x75d6097c, BRF_SND }, - - { "93095-8.u46", 0x100000, 0xf019bedb, BRF_SND }, // sound 2 - { "93095-9.u47", 0x100000, 0xadc83765, BRF_SND }, - - { "22.u81", 0x000020, 0x67d5ec4b, BRF_OPT }, // unknown - { "21.u71", 0x000100, 0x182cd81f, BRF_OPT }, - { "20.u54", 0x000100, 0x38bd0e2f, BRF_OPT }, - -}; - -STD_ROM_PICK(powerins) -STD_ROM_FN(powerins) - -static struct BurnRomInfo powerinjRomDesc[] = { - { "93095-3j.u108", 0x080000, 0x3050a3fb, BRF_ESS | BRF_PRG }, // 68000 code - { "93095-4.u109", 0x080000, 0xd3d7a782, BRF_ESS | BRF_PRG }, - - { "93095-2.u90", 0x020000, 0x4b123cc6, BRF_ESS | BRF_PRG }, // Z80 code - - { "93095-5.u16", 0x100000, 0xb1371808, BRF_GRA }, // layer 0 - { "93095-6.u17", 0x100000, 0x29c85d80, BRF_GRA }, - { "93095-7.u18", 0x080000, 0x2dd76149, BRF_GRA }, - - { "93095-1.u15", 0x020000, 0x6a579ee0, BRF_GRA }, // layer 1 - - { "93095-12.u116", 0x100000, 0x35f3c2a3, BRF_GRA }, - { "93095-13.u117", 0x100000, 0x1ebd45da, BRF_GRA }, - { "93095-14.u118", 0x100000, 0x760d871b, BRF_GRA }, - { "93095-15.u119", 0x100000, 0xd011be88, BRF_GRA }, - { "93095-16.u120", 0x100000, 0xa9c16c9c, BRF_GRA }, - { "93095-17.u121", 0x100000, 0x51b57288, BRF_GRA }, - { "93095-18.u122", 0x100000, 0xb135e3f2, BRF_GRA }, - { "93095-19.u123", 0x100000, 0x67695537, BRF_GRA }, - - { "93095-10.u48", 0x100000, 0x329ac6c5, BRF_SND }, // sound 1 - { "93095-11.u49", 0x100000, 0x75d6097c, BRF_SND }, - - { "93095-8.u46", 0x100000, 0xf019bedb, BRF_SND }, // sound 2 - { "93095-9.u47", 0x100000, 0xadc83765, BRF_SND }, - - { "22.u81", 0x000020, 0x67d5ec4b, BRF_OPT }, // unknown - { "21.u71", 0x000100, 0x182cd81f, BRF_OPT }, - { "20.u54", 0x000100, 0x38bd0e2f, BRF_OPT }, - -}; - -STD_ROM_PICK(powerinj) -STD_ROM_FN(powerinj) - -static struct BurnRomInfo powerinaRomDesc[] = { - { "rom1", 0x080000, 0xb86c84d6, BRF_ESS | BRF_PRG }, // 68000 code - { "rom2", 0x080000, 0xd3d7a782, BRF_ESS | BRF_PRG }, - - { "rom6", 0x200000, 0xb6c10f80, BRF_GRA }, // layer 0 - { "rom4", 0x080000, 0x2dd76149, BRF_GRA }, - - { "rom3", 0x020000, 0x6a579ee0, BRF_GRA }, // layer 1 - - { "rom10", 0x200000, 0xefad50e8, BRF_GRA }, // sprites - { "rom9", 0x200000, 0x08229592, BRF_GRA }, - { "rom8", 0x200000, 0xb02fdd6d, BRF_GRA }, - { "rom7", 0x200000, 0x92ab9996, BRF_GRA }, - - { "rom5", 0x080000, 0x88579c8f, BRF_SND }, // sound 1 -}; - -STD_ROM_PICK(powerina) -STD_ROM_FN(powerina) - -static struct BurnRomInfo powerinbRomDesc[] = { - { "2q.bin", 0x080000, 0x11bf3f2a, BRF_ESS | BRF_PRG }, // 68000 code - { "2r.bin", 0x080000, 0xd8d621be, BRF_ESS | BRF_PRG }, - - { "1f.bin", 0x020000, 0x4b123cc6, BRF_ESS | BRF_PRG }, // Z80 code - - { "13k.bin", 0x080000, 0x1975b4b8, BRF_GRA }, // layer 0 - { "13l.bin", 0x080000, 0x376e4919, BRF_GRA }, - { "13o.bin", 0x080000, 0x0d5ff532, BRF_GRA }, - { "13q.bin", 0x080000, 0x99b25791, BRF_GRA }, - { "13r.bin", 0x080000, 0x2dd76149, BRF_GRA }, - - { "6n.bin", 0x020000, 0x6a579ee0, BRF_GRA }, // layer 1 - - { "14g.bin", 0x080000, 0x8b9b89c9, BRF_GRA }, - { "11g.bin", 0x080000, 0x4d127bdf, BRF_GRA }, - { "13g.bin", 0x080000, 0x298eb50e, BRF_GRA }, - { "11i.bin", 0x080000, 0x57e6d283, BRF_GRA }, - { "12g.bin", 0x080000, 0xfb184167, BRF_GRA }, - { "11j.bin", 0x080000, 0x1b752a4d, BRF_GRA }, - { "14m.bin", 0x080000, 0x2f26ba7b, BRF_GRA }, - { "11k.bin", 0x080000, 0x0263d89b, BRF_GRA }, - { "14n.bin", 0x080000, 0xc4633294, BRF_GRA }, - { "11l.bin", 0x080000, 0x5e4b5655, BRF_GRA }, - { "14p.bin", 0x080000, 0x4d4b0e4e, BRF_GRA }, - { "11o.bin", 0x080000, 0x7e9f2d2b, BRF_GRA }, - { "13p.bin", 0x080000, 0x0e7671f2, BRF_GRA }, - { "11p.bin", 0x080000, 0xee59b1ec, BRF_GRA }, - { "12p.bin", 0x080000, 0x9ab1998c, BRF_GRA }, - { "11q.bin", 0x080000, 0x1ab0c88a, BRF_GRA }, - - { "4a.bin", 0x080000, 0x8cd6824e, BRF_SND }, // sound 1 - { "4b.bin", 0x080000, 0xe31ae04d, BRF_SND }, - { "4c.bin", 0x080000, 0xc4c9f599, BRF_SND }, - { "4d.bin", 0x080000, 0xf0a9f0e1, BRF_SND }, - - { "5a.bin", 0x080000, 0x62557502, BRF_SND }, // sound 2 - { "5b.bin", 0x080000, 0xdbc86bd7, BRF_SND }, - { "5c.bin", 0x080000, 0x5839a2bd, BRF_SND }, - { "5d.bin", 0x080000, 0x446f9dc3, BRF_SND }, - - { "82s123.bin", 0x000020, 0x67d5ec4b, BRF_OPT }, // unknown - { "82s147.bin", 0x000200, 0xd7818542, BRF_OPT }, - -}; - -STD_ROM_PICK(powerinb) -STD_ROM_FN(powerinb) - -static void sndSetBank(UINT8 offset, UINT8 data) -{ - INT32 chip = (offset & 4) >> 2; - INT32 bank = offset & 3; - - MSM6295SampleInfo[chip][bank] = MSM6295ROM + 0x200000 * chip + 0x010000 * data + (bank << 8); - MSM6295SampleData[chip][bank] = MSM6295ROM + 0x200000 * chip + 0x010000 * data; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom68K = Next; Next += 0x0100000; // 68000 ROM - RomZ80 = Next; Next += 0x0020000; // Z80 ROM - RomBg = Next; Next += 0x0500000; - RomFg = Next; Next += 0x0100000; - RomSpr = Next; Next += 0x1000000; - MSM6295ROM = Next; Next += m6295size; - - RamStart = Next; - - RamZ80 = Next; Next += 0x002000; - - RamPal = (UINT16 *) Next; Next += 0x001000; - RamBg = (UINT16 *) Next; Next += 0x004000; - RamFg = (UINT16 *) Next; Next += 0x001000; - RamSpr = (UINT16 *) Next; Next += 0x010000; - RamVReg = (UINT16 *) Next; Next += 0x000008; - - RamEnd = Next; - - RamCurPal = (UINT32 *) Next; Next += 0x000800 * sizeof(UINT32); - - MemEnd = Next; - return 0; -} - -UINT8 __fastcall powerinsReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x10003f: - return MSM6295ReadStatus(0); - -// default: -// bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); - } - return 0; -} - -UINT16 __fastcall powerinsReadWord(UINT32 sekAddress) -{ - switch (sekAddress) - { - case 0x100000: - return ~DrvInput[0]; - - case 0x100002: - return ~(DrvInput[2] + (DrvInput[3]<<8)); - - case 0x100008: - return ~DrvInput[4]; - - case 0x10000A: - return ~DrvInput[6]; - -// default: -// bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); - } - return 0; -} - -void __fastcall powerinsWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) - { - case 0x100031: - // powerins_okibank - if (oki_bank != (byteValue & 7)) { - oki_bank = byteValue & 7; - memcpy(&MSM6295ROM[0x30000],&MSM6295ROM[0x40000 + 0x10000*oki_bank],0x10000); - } - break; - - case 0x10003e: - // powerina only! - break; - - case 0x10003f: - // powerina only! - MSM6295Command(0, byteValue); - break; - -// default: -// bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); - } -} - -void __fastcall powerinsWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) - { - case 0x100014: - // powerins_flipscreen_w - break; - - case 0x100018: - // powerins_tilebank_w - tile_bank = wordValue * 0x800; - break; - - case 0x10001e: - //powerins_soundlatch_w - soundlatch = wordValue & 0xff; - break; - - case 0x10003e: - // powerina only! - MSM6295Command(0, wordValue & 0xff); - break; - - case 0x130000: RamVReg[0] = wordValue; break; - case 0x130002: RamVReg[1] = wordValue; break; - case 0x130004: RamVReg[2] = wordValue; break; - case 0x130006: RamVReg[3] = wordValue; break; - - case 0x100016: // NOP - break; - -// default: -// bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); - } -} - -void __fastcall powerinsWriteWordPalette(UINT32 sekAddress, UINT16 wordValue) -{ - sekAddress -= 0x120000; - sekAddress >>= 1; - RamPal[sekAddress] = wordValue; - CalcCol( sekAddress ); -} - -UINT8 __fastcall powerinsZ80Read(UINT16 a) -{ - switch (a) - { - case 0xE000: - return soundlatch; - -// default: -// bprintf(PRINT_NORMAL, _T("Z80 Attempt to read value of location %04x\n"), a); - } - - return 0; -} - -#if 1 && defined FBA_DEBUG -void __fastcall powerinsZ80Write(UINT16 a,UINT8 v) -{ - switch (a) { - case 0xE000: - case 0xE001: - break; - - default: - bprintf(PRINT_NORMAL, _T("Z80 Attempt to write value %x to location %x\n"), v, a); - } -} -#endif - -UINT8 __fastcall powerinsZ80In(UINT16 p) -{ - switch (p & 0xFF) - { - case 0x00: - if ( game_drv == GAME_POWERINS ) - return BurnYM2203Read(0, 0); - else - return 0x01; - - case 0x01: - if ( game_drv == GAME_POWERINS ) - return BurnYM2203Read(0, 1); - else - return 0; - - case 0x80: - return MSM6295ReadStatus(0); - - case 0x88: - return MSM6295ReadStatus(1); - -// default: -// bprintf(PRINT_NORMAL, _T("Z80 Attempt to read port %04x\n"), p); - } - - return 0; -} - -void __fastcall powerinsZ80Out(UINT16 p, UINT8 v) -{ - switch (p & 0x0FF) { - case 0x00: - if ( game_drv == GAME_POWERINS ) { - BurnYM2203Write(0, 0, v); - } - break; - - case 0x01: - if ( game_drv == GAME_POWERINS ) { - BurnYM2203Write(0, 1, v); - } - break; - - case 0x80: - MSM6295Command(0, v); - break; - - case 0x88: - MSM6295Command(1, v); - break; - - case 0x90: sndSetBank(0, v); break; - case 0x91: sndSetBank(1, v); break; - case 0x92: sndSetBank(2, v); break; - case 0x93: sndSetBank(3, v); break; - case 0x94: sndSetBank(4, v); break; - case 0x95: sndSetBank(5, v); break; - case 0x96: sndSetBank(6, v); break; - case 0x97: sndSetBank(7, v); break; - -// default: -// bprintf(PRINT_NORMAL, _T("Z80 Attempt to write %02x to port %04x\n"), v, p); - } -} - -static void powerinsIRQHandler(INT32, INT32 nStatus) -{ -// bprintf(PRINT_NORMAL, _T("powerinsIRQHandler %i\n"), nStatus); - - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 powerinsSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 6000000; -} - -static double powerinsGetTime() -{ - return (double)ZetTotalCycles() / 6000000; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekSetIRQLine(0, SEK_IRQSTATUS_NONE); - SekReset(); - SekClose(); - - MSM6295Reset(0); - - if (game_drv != GAME_POWERINA) { - ZetOpen(0); - ZetReset(); - ZetClose(); - - if (game_drv == GAME_POWERINS) BurnYM2203Reset(); - - MSM6295Reset(1); - - } - - return 0; -} - -static void LoadDecodeBgRom(UINT8 *tmp, UINT8 * dest, INT32 id, INT32 size) -{ - BurnLoadRom(tmp, id, 1); - - for (INT32 z=0;z<(size/128);z++) { - for (INT32 y=0;y<16;y++) { - dest[ 0] = tmp[ 0] >> 4; - dest[ 1] = tmp[ 0] & 15; - dest[ 2] = tmp[ 1] >> 4; - dest[ 3] = tmp[ 1] & 15; - - dest[ 4] = tmp[ 2] >> 4; - dest[ 5] = tmp[ 2] & 15; - dest[ 6] = tmp[ 3] >> 4; - dest[ 7] = tmp[ 3] & 15; - - dest[ 8] = tmp[64] >> 4; - dest[ 9] = tmp[64] & 15; - dest[10] = tmp[65] >> 4; - dest[11] = tmp[65] & 15; - - dest[12] = tmp[66] >> 4; - dest[13] = tmp[66] & 15; - dest[14] = tmp[67] >> 4; - dest[15] = tmp[67] & 15; - - dest += 16; - tmp += 4; - } - tmp += 64; - } -} - -static void LoadDecodeSprRom(UINT8 *tmp, UINT8 * dest, INT32 id, INT32 size) -{ - if ( game_drv == GAME_POWERINB ) { - BurnLoadRom(tmp + 0, 9 + id*2, 2); - BurnLoadRom(tmp + 1, 10 + id*2, 2); - } else - BurnLoadRom(tmp, id, 1); - - for (INT32 z=0;z<(size/128);z++) { - for (INT32 y=0;y<16;y++) { - dest[ 0] = tmp[ 1] >> 4; - dest[ 1] = tmp[ 1] & 15; - dest[ 2] = tmp[ 0] >> 4; - dest[ 3] = tmp[ 0] & 15; - - dest[ 4] = tmp[ 3] >> 4; - dest[ 5] = tmp[ 3] & 15; - dest[ 6] = tmp[ 2] >> 4; - dest[ 7] = tmp[ 2] & 15; - - dest[ 8] = tmp[65] >> 4; - dest[ 9] = tmp[65] & 15; - dest[10] = tmp[64] >> 4; - dest[11] = tmp[64] & 15; - - dest[12] = tmp[67] >> 4; - dest[13] = tmp[67] & 15; - dest[14] = tmp[66] >> 4; - dest[15] = tmp[66] & 15; - - dest += 16; - tmp += 4; - } - tmp += 64; - } -} - -static INT32 powerinsInit() -{ - INT32 nRet; - UINT8 * tmp; - - m6295size = 0x80000 * 4 * 2; - - if ( strcmp(BurnDrvGetTextA(DRV_NAME), "powerins") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "powerinsj") == 0) { - game_drv = GAME_POWERINS; - } else - if ( strcmp(BurnDrvGetTextA(DRV_NAME), "powerinsa") == 0 ) { - game_drv = GAME_POWERINA; - m6295size = 0x90000; - } else - if ( strcmp(BurnDrvGetTextA(DRV_NAME), "powerinsb") == 0 ) { - game_drv = GAME_POWERINB; - } else - return 1; - - Mem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); // blank all memory - MemIndex(); - - // load roms - - tmp = (UINT8 *)BurnMalloc(0x200000); - if (tmp==0) return 1; - - if ( game_drv == GAME_POWERINS ) { - nRet = BurnLoadRom(Rom68K + 0x000000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Rom68K + 0x080000, 1, 1); if (nRet != 0) return 1; - - nRet = BurnLoadRom(RomZ80 + 0x000000, 2, 1); if (nRet != 0) return 1; - - // load background tile roms - LoadDecodeBgRom(tmp, RomBg+0x000000, 3, 0x100000); - LoadDecodeBgRom(tmp, RomBg+0x200000, 4, 0x100000); - LoadDecodeBgRom(tmp, RomBg+0x400000, 5, 0x080000); - - BurnLoadRom(RomFg + 0x000000, 6, 1); - - // load sprite roms - for (INT32 i=0;i<8;i++) - LoadDecodeSprRom(tmp, RomSpr+0x200000*i, i+7, 0x100000); - - BurnLoadRom(MSM6295ROM + 0x000000, 15, 1); - BurnLoadRom(MSM6295ROM + 0x100000, 16, 1); - BurnLoadRom(MSM6295ROM + 0x200000, 17, 1); - BurnLoadRom(MSM6295ROM + 0x300000, 18, 1); - - - } else - if ( game_drv == GAME_POWERINA ) { - nRet = BurnLoadRom(Rom68K + 0x000000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(Rom68K + 0x080000, 1, 1); if (nRet != 0) return 1; - - // load background tile roms - LoadDecodeBgRom(tmp, RomBg+0x000000, 2, 0x200000); - LoadDecodeBgRom(tmp, RomBg+0x400000, 3, 0x080000); - - // load foreground tile roms - BurnLoadRom(RomFg + 0x000000, 4, 1); - - // load sprite roms - for (INT32 i=0;i<4;i++) - LoadDecodeSprRom(tmp, RomSpr+0x400000*i, i+5, 0x200000); - - BurnLoadRom(MSM6295ROM + 0x10000, 9, 1); - memcpy(MSM6295ROM, MSM6295ROM + 0x10000, 0x30000); - - } else - if ( game_drv == GAME_POWERINB ) { - - nRet = BurnLoadRom(Rom68K + 0x000001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Rom68K + 0x000000, 1, 2); if (nRet != 0) return 1; - - nRet = BurnLoadRom(RomZ80 + 0x000000, 2, 1); if (nRet != 0) return 1; - - // load background tile roms - for (INT32 i=0;i<5;i++) - LoadDecodeBgRom(tmp, RomBg+0x100000*i, i+3, 0x80000); - - // load foreground tile roms - BurnLoadRom(RomFg + 0x000000, 8, 1); - - // load sprite roms - for (INT32 i=0;i<8;i++) - LoadDecodeSprRom(tmp, RomSpr+0x200000*i, i, 0x100000); - - BurnLoadRom(MSM6295ROM + 0x000000, 25, 1); - BurnLoadRom(MSM6295ROM + 0x080000, 26, 1); - BurnLoadRom(MSM6295ROM + 0x100000, 27, 1); - BurnLoadRom(MSM6295ROM + 0x180000, 28, 1); - BurnLoadRom(MSM6295ROM + 0x200000, 29, 1); - BurnLoadRom(MSM6295ROM + 0x280000, 30, 1); - BurnLoadRom(MSM6295ROM + 0x300000, 31, 1); - BurnLoadRom(MSM6295ROM + 0x380000, 32, 1); - - } - - BurnFree(tmp); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom68K, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM - SekMapMemory((UINT8 *)RamPal, - 0x120000, 0x120FFF, SM_ROM); // palette - SekMapMemory((UINT8 *)RamBg, - 0x140000, 0x143fff, SM_RAM); // b ground - SekMapMemory((UINT8 *)RamFg, - 0x170000, 0x170fff, SM_RAM); // f ground - SekMapMemory((UINT8 *)RamFg, - 0x171000, 0x171fff, SM_RAM); // f ground Mirror - SekMapMemory((UINT8 *)RamSpr, - 0x180000, 0x18ffff, SM_RAM); // sprites - - SekMapHandler(1, 0x120000, 0x120FFF, SM_WRITE); - - - SekSetReadWordHandler(0, powerinsReadWord); - SekSetReadByteHandler(0, powerinsReadByte); - SekSetWriteWordHandler(0, powerinsWriteWord); - SekSetWriteByteHandler(0, powerinsWriteByte); - - //SekSetWriteByteHandler(1, powerinsWriteBytePalette); - SekSetWriteWordHandler(1, powerinsWriteWordPalette); - - SekClose(); - } - - if ( game_drv != GAME_POWERINA ) { - - ZetInit(0); - ZetOpen(0); - - ZetSetReadHandler(powerinsZ80Read); -#if 1 && defined FBA_DEBUG - ZetSetWriteHandler(powerinsZ80Write); -#endif - ZetSetInHandler(powerinsZ80In); - ZetSetOutHandler(powerinsZ80Out); - - // ROM bank 1 - ZetMapArea(0x0000, 0xBFFF, 0, RomZ80); - ZetMapArea(0x0000, 0xBFFF, 2, RomZ80); - // RAM - ZetMapArea(0xC000, 0xDFFF, 0, RamZ80); - ZetMapArea(0xC000, 0xDFFF, 1, RamZ80); - ZetMapArea(0xC000, 0xDFFF, 2, RamZ80); - - ZetMemEnd(); - ZetClose(); - } - - if ( game_drv == GAME_POWERINA ) { - MSM6295Init(0, 990000 / 165, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - } - - if (game_drv == GAME_POWERINS ) { - BurnYM2203Init(1, 12000000 / 8, &powerinsIRQHandler, powerinsSynchroniseStream, powerinsGetTime, 0); - BurnTimerAttachZet(6000000); - BurnYM2203SetAllRoutes(0, 2.00, BURN_SND_ROUTE_BOTH); - BurnSetRefreshRate(56.0); - - MSM6295Init(0, 4000000 / 165, 1); - MSM6295Init(1, 4000000 / 165, 1); - MSM6295SetRoute(0, 0.15, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 0.15, BURN_SND_ROUTE_BOTH); - } - - if (game_drv == GAME_POWERINB ) { - MSM6295Init(0, 4000000 / 165, 1); - MSM6295Init(1, 4000000 / 165, 1); - MSM6295SetRoute(0, 0.15, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 0.15, BURN_SND_ROUTE_BOTH); - } - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 powerinsExit() -{ - GenericTilesExit(); - - SekExit(); - MSM6295Exit(0); - - if (game_drv != GAME_POWERINA) { - MSM6295Exit(1); - - if (game_drv == GAME_POWERINS) - BurnYM2203Exit(); - - ZetExit(); - } - - BurnFree(Mem); - return 0; -} - -static void TileBackground() -{ - for (INT32 offs = 256*32-1; offs >=0; offs--) { - - INT32 page = offs >> 8; - INT32 x = (offs >> 4) & 0xF; - INT32 y = (offs >> 0) & 0xF; - - x = x * 16 + (page & 7) * 256 + 32 - ((RamVReg[1]&0xff) + (RamVReg[0]&0xff)*256); - y = y * 16 + (page >> 4) * 256 - 16 - ((RamVReg[3]&0xff) + (RamVReg[2]&0xff)*256); - - if ( x<=-16 || x>=320 || y <=-16 || y>=224 ) continue; - else { - INT32 attr = RamBg[offs]; - INT32 code = ((attr & 0x7ff) + tile_bank); - INT32 color = (attr >> 12) | ((attr >> 7) & 0x10); - - if ( x >=0 && x <= (320-16) && y>=0 && y <=(224-16) ) { - Render16x16Tile(pTransDraw, code, x, y, color, 4, 0, RomBg); - } else { - Render16x16Tile_Clip(pTransDraw, code, x, y, color, 4, 0, RomBg); - } - } - } -} - -static void TileForeground() -{ - for (INT32 offs = 0; offs < 64*32; offs++) { - INT32 x = ((offs & 0xFFE0) >> 2 ) + 32; - INT32 y = ((offs & 0x001F) << 3 ) - 16; - if (x > 320) x -= 512; - if ( x<0 || x>(320-8) || y<0 || y>(224-8)) continue; - else { - if ((RamFg[offs] & 0x0FFF) == 0) continue; - UINT8 *d = RomFg + (RamFg[offs] & 0x0FFF) * 32; - UINT16 c = ((RamFg[offs] & 0xF000) >> 8) | 0x200; - UINT16 *p = pTransDraw + y * 320 + x; - for (INT32 k=0;k<8;k++) { - if ((d[0] >> 4) != 15) p[0] = (d[0] >> 4) | c; - if ((d[0] & 0xF) != 15) p[1] = (d[0] & 0xF) | c; - if ((d[1] >> 4) != 15) p[2] = (d[1] >> 4) | c; - if ((d[1] & 0xF) != 15) p[3] = (d[1] & 0xF) | c; - if ((d[2] >> 4) != 15) p[4] = (d[2] >> 4) | c; - if ((d[2] & 0xF) != 15) p[5] = (d[2] & 0xF) | c; - if ((d[3] >> 4) != 15) p[6] = (d[3] >> 4) | c; - if ((d[3] & 0xF) != 15) p[7] = (d[3] & 0xF) | c; - d += 4; - p += 320; - } - } - } -} - -static inline void drawgfx(UINT32 code,UINT32 color,INT32 flipx,/*INT32 flipy,*/INT32 sx,INT32 sy) -{ - if (sx >= 0 && sx <= (320-16) && sy >= 0 && sy <= (224-16) ) { - if ( flipx ) - Render16x16Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 15, 0x400, RomSpr); - else - Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 4, 15, 0x400, RomSpr); - } else { - if ( flipx ) - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x400, RomSpr); - else - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x400, RomSpr); - } -} - -static void DrawSprites() -{ - UINT16 *source = RamSpr + 0x8000/2; - UINT16 *finish = RamSpr + 0x9000/2; - - for ( ; source < finish; source += 8 ) { - - if (!(source[0]&1)) continue; - - INT32 size = source[1]; - INT32 code = (source[3] & 0x7fff) + ( (size & 0x0100) << 7 ); - INT32 sx = source[4]; - INT32 sy = source[6]; - INT32 color = source[7] & 0x3F; - INT32 flipx = size & 0x1000; - INT32 dimx = ((size >> 0) & 0xf ) + 1; - INT32 dimy = ((size >> 4) & 0xf ) + 1; - - sx &= 0x3ff; if (sx > 0x1ff) sx -= 0x400; sx += 32; - sy &= 0x3ff; if (sy > 0x1ff) sy -= 0x400; sy -= 16; - - for (INT32 x = 0 ; x < dimx ; x++) - for (INT32 y = 0 ; y < dimy ; y++) { - drawgfx(code, color, flipx, /*flipy, */sx + x*16, sy + y*16); - code ++; - } - } -} - -static void DrvDraw() -{ - if (bRecalcPalette) { - for (INT32 i=0; i<0x800; i++) CalcCol(i); - bRecalcPalette = 0; - } - - BurnTransferClear(); - - TileBackground(); - DrawSprites(); - TileForeground(); - - BurnTransferCopy(RamCurPal); -} - -static INT32 powerinsFrame() -{ - INT32 nInterleave = 200; - - if (DrvReset) DrvDoReset(); - - DrvInput[0] = 0x00; - DrvInput[2] = 0x00; - DrvInput[3] = 0x00; - for (INT32 i = 0; i < 8; i++) { - DrvInput[2] |= (DrvJoy1[i] & 1) << i; - DrvInput[3] |= (DrvJoy2[i] & 1) << i; - DrvInput[0] |= (DrvButton[i] & 1) << i; - } - - nCyclesTotal[0] = (INT32)((INT64)12000000 * nBurnCPUSpeedAdjust / (0x0100 * 56)); - if (game_drv == GAME_POWERINB) nCyclesTotal[0] = (INT32)((INT64)12000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = 6000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - SekOpen(0); - if (game_drv != GAME_POWERINA) { - ZetNewFrame(); - ZetOpen(0); - } - - if ( game_drv == GAME_POWERINA ) { - nCyclesTotal[0] = (INT32)((INT64)12000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - SekRun(nCyclesTotal[0]); - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - if (game_drv == GAME_POWERINS) { - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - } - - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - - if (game_drv == GAME_POWERINB) { - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if ((i & 180) == 0) { - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - } - } - - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - - SekClose(); - - if (game_drv == GAME_POWERINS) { - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - } - - if (game_drv == GAME_POWERINB) { - ZetRun(nCyclesTotal[1] - nCyclesDone[1]); - - if (pBurnSoundOut) { - memset(pBurnSoundOut, 0, nBurnSoundLen * 2 * sizeof(INT16)); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - } - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 powerinsScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029671; - } - - if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - - SekScan(nAction); // Scan 68000 state - - if ( game_drv != GAME_POWERINA ) - ZetScan(nAction); // Scan Z80 state - - if ( game_drv == GAME_POWERINS ) - BurnYM2203Scan(nAction, pnMin); - - MSM6295Scan(0, nAction); - if ( game_drv != GAME_POWERINA ) - MSM6295Scan(1, nAction); - - SCAN_VAR(m6295size); - SCAN_VAR(soundlatch); - if ( game_drv == GAME_POWERINA ) - SCAN_VAR(oki_bank); - - SCAN_VAR(tile_bank); - SCAN_VAR(RamCurPal); - - if (nAction & ACB_WRITE) { - bRecalcPalette = 1; - if ( game_drv == GAME_POWERINA ) - memcpy(&MSM6295ROM[0x30000],&MSM6295ROM[0x40000 + 0x10000*oki_bank],0x10000); - } - } - - return 0; -} - -struct BurnDriver BurnDrvPowerins = { - "powerins", NULL, NULL, NULL, "1993", - "Power Instinct (USA)\0", NULL, "Atlus", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, FBF_PWRINST, - NULL, powerinsRomInfo, powerinsRomName, NULL, NULL, powerinsInputInfo, powerinsDIPInfo, - powerinsInit, powerinsExit, powerinsFrame, NULL, powerinsScan, &bRecalcPalette, 0x800, - 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPowerinj = { - "powerinsj", "powerins", NULL, NULL, "1993", - "Gouketsuji Ichizoku (Japan)\0", NULL, "Atlus", "Miscellaneous", - L"\u8C6A\u8840\u5BFA\u4E00\u65CF (Japan)\0Gouketsuji Ichizoku\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, FBF_PWRINST, - NULL, powerinjRomInfo, powerinjRomName, NULL, NULL, powerinsInputInfo, powerinjDIPInfo, - powerinsInit, powerinsExit, powerinsFrame, NULL, powerinsScan, &bRecalcPalette, 0x800, - 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPowerina = { - "powerinsa", "powerins", NULL, NULL, "1993", - "Power Instinct (USA, bootleg set 1)\0", NULL, "Atlus", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, FBF_PWRINST, - NULL, powerinaRomInfo, powerinaRomName, NULL, NULL, powerinsInputInfo, powerinsDIPInfo, - powerinsInit, powerinsExit, powerinsFrame, NULL, powerinsScan, &bRecalcPalette, 0x800, - 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPowerinb = { - "powerinsb", "powerins", NULL, NULL, "1993", - "Power Instinct (USA, bootleg set 2)\0", NULL, "Atlus", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, FBF_PWRINST, - NULL, powerinbRomInfo, powerinbRomName, NULL, NULL, powerinsInputInfo, powerinsDIPInfo, - powerinsInit, powerinsExit, powerinsFrame, NULL, powerinsScan, &bRecalcPalette, 0x800, - 320, 224, 4, 3 -}; +/*************************************************************** + Power Instinct + (C) 1993 Atlus + driver by Luca Elia (l.elia@tin.it) + *************************************************************** + port to Finalburn Alpha by OopsWare. 2007 + ***************************************************************/ + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "msm6295.h" +#include "burn_ym2203.h" + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; + +static UINT8 *Rom68K; +static UINT8 *RomZ80; +static UINT8 *RomBg; +static UINT8 *RomFg; +static UINT8 *RomSpr; + +static UINT8 *RamZ80; +static UINT16 *RamPal; +static UINT16 *RamBg; +static UINT16 *RamFg; +static UINT16 *RamSpr; +static UINT16 *RamVReg; + +static UINT32 *RamCurPal; + +static UINT8 DrvButton[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +static UINT8 DrvJoy1[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +static UINT8 DrvJoy2[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +static UINT8 DrvInput[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +static UINT8 bRecalcPalette = 0; +static UINT8 DrvReset = 0; + +static UINT32 tile_bank; +static INT32 m6295size; +static UINT16 soundlatch = 0; +static INT32 oki_bank = -1; + +#define GAME_POWERINS 1 +#define GAME_POWERINA 2 +#define GAME_POWERINB 3 + +static INT32 game_drv = 0; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +inline static void CalcCol(INT32 idx) +{ + /* RRRR GGGG BBBB RGBx */ + UINT16 wordValue = RamPal[idx]; + INT32 r = ((wordValue >> 8) & 0xF0 ) | ((wordValue << 0) & 0x08) | ((wordValue >> 13) & 0x07 ); + INT32 g = ((wordValue >> 4) & 0xF0 ) | ((wordValue << 1) & 0x08) | ((wordValue >> 9) & 0x07 ); + INT32 b = ((wordValue >> 0) & 0xF0 ) | ((wordValue << 2) & 0x08) | ((wordValue >> 5) & 0x07 ); + RamCurPal[idx] = BurnHighCol(r, g, b, 0); +} + +static struct BurnInputInfo powerinsInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 3, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 4"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 4, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 3, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 2, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 4"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvButton + 5, "diag"}, + {"Service", BIT_DIGITAL, DrvButton + 2, "service"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 4, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 6, "dip"}, +}; + +STDINPUTINFO(powerins) + +static struct BurnDIPInfo powerinsDIPList[] = { + + // Defaults + {0x17, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, "Free play"}, + {0x17, 0x01, 0x01, 0x00, "Off"}, + {0x17, 0x01, 0x01, 0x01, "On"}, + {0, 0xFE, 0, 8, "Coin 1"}, + {0x17, 0x01, 0x70, 0x30, "4 coins 1 credit"}, + {0x17, 0x01, 0x70, 0x50, "3 coins 1 credit"}, + {0x17, 0x01, 0x70, 0x10, "2 coins 1 credit"}, + {0x17, 0x01, 0x70, 0x00, "1 coin 1 credit"}, + {0x17, 0x01, 0x70, 0x40, "1 coin 2 credits"}, + {0x17, 0x01, 0x70, 0x20, "1 coin 3 credits"}, + {0x17, 0x01, 0x70, 0x60, "1 coin 4 credits"}, + {0x17, 0x01, 0x70, 0x70, "2 coins to start, 1 to continue"}, + {0, 0xFE, 0, 8, "Coin 2"}, + {0x17, 0x01, 0x0E, 0x06, "4 coins 1 credit"}, + {0x17, 0x01, 0x0E, 0x0A, "3 coins 1 credit"}, + {0x17, 0x01, 0x0E, 0x02, "2 coins 1 credit"}, + {0x17, 0x01, 0x0E, 0x00, "1 coin 1 credit"}, + {0x17, 0x01, 0x0E, 0x08, "1 coin 2 credits"}, + {0x17, 0x01, 0x0E, 0x04, "1 coin 3 credits"}, + {0x17, 0x01, 0x0E, 0x0C, "1 coin 4 credits"}, + {0x17, 0x01, 0x0E, 0x0E, "2 coins to start, 1 to continue"}, + {0, 0xFE, 0, 2, "Flip screen"}, + {0x17, 0x01, 0x80, 0x00, "Off"}, + {0x17, 0x01, 0x80, 0x80, "On"}, + +}; + +static struct BurnDIPInfo powerinaDIPList[] = { + + // Defaults + {0x18, 0xFF, 0xFF, 0x04, NULL}, + + // DIP 2 + {0, 0xFE, 0, 2, "Coin chutes"}, + {0x18, 0x01, 0x01, 0x00, "1 chute"}, + {0x18, 0x01, 0x01, 0x01, "2 chutes"}, + {0, 0xFE, 0, 2, "Join In mode"}, + {0x18, 0x01, 0x02, 0x00, "Off"}, + {0x18, 0x01, 0x02, 0x02, "On"}, + {0, 0xFE, 0, 2, "Demo sounds"}, + {0x18, 0x01, 0x04, 0x00, "Off"}, + {0x18, 0x01, 0x04, 0x04, "On"}, + {0, 0xFE, 0, 2, "Allow continue"}, + {0x18, 0x01, 0x08, 0x08, "Off"}, + {0x18, 0x01, 0x08, 0x00, "On"}, + {0, 0xFE, 0, 2, "Blood color"}, + {0x18, 0x01, 0x10, 0x00, "Red"}, + {0x18, 0x01, 0x10, 0x10, "Blue"}, + {0, 0xFE, 0, 2, "Game time"}, + {0x18, 0x01, 0x20, 0x00, "Normal"}, + {0x18, 0x01, 0x20, 0x20, "Short"}, + {0, 0xFE, 0, 4, "Difficulty"}, + {0x18, 0x01, 0xC0, 0x80, "Easy"}, + {0x18, 0x01, 0xC0, 0x00, "Normal"}, + {0x18, 0x01, 0xC0, 0x40, "Hard"}, + {0x18, 0x01, 0xC0, 0xC0, "Hardest"}, + +}; + +static struct BurnDIPInfo powerinjDIPList[] = { + + // Defaults + {0x18, 0xFF, 0xFF, 0x04, NULL}, + + // DIP 2 +// {0, 0xFE, 0, 2, "Unknown"}, +// {0x18, 0x01, 0x01, 0x00, "Off"}, +// {0x18, 0x01, 0x01, 0x01, "On"}, + {0, 0xFE, 0, 2, "Join In mode"}, + {0x18, 0x01, 0x02, 0x00, "Off"}, + {0x18, 0x01, 0x02, 0x02, "On"}, + {0, 0xFE, 0, 2, "Demo sounds"}, + {0x18, 0x01, 0x04, 0x00, "Off"}, + {0x18, 0x01, 0x04, 0x04, "On"}, + {0, 0xFE, 0, 2, "Allow continue"}, + {0x18, 0x01, 0x08, 0x08, "Off"}, + {0x18, 0x01, 0x08, 0x00, "On"}, + {0, 0xFE, 0, 2, "Blood color"}, + {0x18, 0x01, 0x10, 0x00, "Red"}, + {0x18, 0x01, 0x10, 0x10, "Blue"}, + {0, 0xFE, 0, 2, "Game time"}, + {0x18, 0x01, 0x20, 0x00, "Normal"}, + {0x18, 0x01, 0x20, 0x20, "Short"}, + {0, 0xFE, 0, 4, "Difficulty"}, + {0x18, 0x01, 0xC0, 0x80, "Easy"}, + {0x18, 0x01, 0xC0, 0x00, "Normal"}, + {0x18, 0x01, 0xC0, 0x40, "Hard"}, + {0x18, 0x01, 0xC0, 0xC0, "Hardest"}, + +}; + +STDDIPINFOEXT(powerins, powerins, powerina) +STDDIPINFOEXT(powerinj, powerins, powerinj) + +// Rom information + +static struct BurnRomInfo powerinsRomDesc[] = { + { "93095-3a.u108", 0x080000, 0x9825ea3d, BRF_ESS | BRF_PRG }, // 68000 code + { "93095-4.u109", 0x080000, 0xd3d7a782, BRF_ESS | BRF_PRG }, + + { "93095-2.u90", 0x020000, 0x4b123cc6, BRF_ESS | BRF_PRG }, // Z80 code + + { "93095-5.u16", 0x100000, 0xb1371808, BRF_GRA }, // layer 0 + { "93095-6.u17", 0x100000, 0x29c85d80, BRF_GRA }, + { "93095-7.u18", 0x080000, 0x2dd76149, BRF_GRA }, + + { "93095-1.u15", 0x020000, 0x6a579ee0, BRF_GRA }, // layer 1 + + { "93095-12.u116", 0x100000, 0x35f3c2a3, BRF_GRA }, + { "93095-13.u117", 0x100000, 0x1ebd45da, BRF_GRA }, + { "93095-14.u118", 0x100000, 0x760d871b, BRF_GRA }, + { "93095-15.u119", 0x100000, 0xd011be88, BRF_GRA }, + { "93095-16.u120", 0x100000, 0xa9c16c9c, BRF_GRA }, + { "93095-17.u121", 0x100000, 0x51b57288, BRF_GRA }, + { "93095-18.u122", 0x100000, 0xb135e3f2, BRF_GRA }, + { "93095-19.u123", 0x100000, 0x67695537, BRF_GRA }, + + { "93095-10.u48", 0x100000, 0x329ac6c5, BRF_SND }, // sound 1 + { "93095-11.u49", 0x100000, 0x75d6097c, BRF_SND }, + + { "93095-8.u46", 0x100000, 0xf019bedb, BRF_SND }, // sound 2 + { "93095-9.u47", 0x100000, 0xadc83765, BRF_SND }, + + { "22.u81", 0x000020, 0x67d5ec4b, BRF_OPT }, // unknown + { "21.u71", 0x000100, 0x182cd81f, BRF_OPT }, + { "20.u54", 0x000100, 0x38bd0e2f, BRF_OPT }, + +}; + +STD_ROM_PICK(powerins) +STD_ROM_FN(powerins) + +static struct BurnRomInfo powerinjRomDesc[] = { + { "93095-3j.u108", 0x080000, 0x3050a3fb, BRF_ESS | BRF_PRG }, // 68000 code + { "93095-4.u109", 0x080000, 0xd3d7a782, BRF_ESS | BRF_PRG }, + + { "93095-2.u90", 0x020000, 0x4b123cc6, BRF_ESS | BRF_PRG }, // Z80 code + + { "93095-5.u16", 0x100000, 0xb1371808, BRF_GRA }, // layer 0 + { "93095-6.u17", 0x100000, 0x29c85d80, BRF_GRA }, + { "93095-7.u18", 0x080000, 0x2dd76149, BRF_GRA }, + + { "93095-1.u15", 0x020000, 0x6a579ee0, BRF_GRA }, // layer 1 + + { "93095-12.u116", 0x100000, 0x35f3c2a3, BRF_GRA }, + { "93095-13.u117", 0x100000, 0x1ebd45da, BRF_GRA }, + { "93095-14.u118", 0x100000, 0x760d871b, BRF_GRA }, + { "93095-15.u119", 0x100000, 0xd011be88, BRF_GRA }, + { "93095-16.u120", 0x100000, 0xa9c16c9c, BRF_GRA }, + { "93095-17.u121", 0x100000, 0x51b57288, BRF_GRA }, + { "93095-18.u122", 0x100000, 0xb135e3f2, BRF_GRA }, + { "93095-19.u123", 0x100000, 0x67695537, BRF_GRA }, + + { "93095-10.u48", 0x100000, 0x329ac6c5, BRF_SND }, // sound 1 + { "93095-11.u49", 0x100000, 0x75d6097c, BRF_SND }, + + { "93095-8.u46", 0x100000, 0xf019bedb, BRF_SND }, // sound 2 + { "93095-9.u47", 0x100000, 0xadc83765, BRF_SND }, + + { "22.u81", 0x000020, 0x67d5ec4b, BRF_OPT }, // unknown + { "21.u71", 0x000100, 0x182cd81f, BRF_OPT }, + { "20.u54", 0x000100, 0x38bd0e2f, BRF_OPT }, + +}; + +STD_ROM_PICK(powerinj) +STD_ROM_FN(powerinj) + +static struct BurnRomInfo powerinaRomDesc[] = { + { "rom1", 0x080000, 0xb86c84d6, BRF_ESS | BRF_PRG }, // 68000 code + { "rom2", 0x080000, 0xd3d7a782, BRF_ESS | BRF_PRG }, + + { "rom6", 0x200000, 0xb6c10f80, BRF_GRA }, // layer 0 + { "rom4", 0x080000, 0x2dd76149, BRF_GRA }, + + { "rom3", 0x020000, 0x6a579ee0, BRF_GRA }, // layer 1 + + { "rom10", 0x200000, 0xefad50e8, BRF_GRA }, // sprites + { "rom9", 0x200000, 0x08229592, BRF_GRA }, + { "rom8", 0x200000, 0xb02fdd6d, BRF_GRA }, + { "rom7", 0x200000, 0x92ab9996, BRF_GRA }, + + { "rom5", 0x080000, 0x88579c8f, BRF_SND }, // sound 1 +}; + +STD_ROM_PICK(powerina) +STD_ROM_FN(powerina) + +static struct BurnRomInfo powerinbRomDesc[] = { + { "2q.bin", 0x080000, 0x11bf3f2a, BRF_ESS | BRF_PRG }, // 68000 code + { "2r.bin", 0x080000, 0xd8d621be, BRF_ESS | BRF_PRG }, + + { "1f.bin", 0x020000, 0x4b123cc6, BRF_ESS | BRF_PRG }, // Z80 code + + { "13k.bin", 0x080000, 0x1975b4b8, BRF_GRA }, // layer 0 + { "13l.bin", 0x080000, 0x376e4919, BRF_GRA }, + { "13o.bin", 0x080000, 0x0d5ff532, BRF_GRA }, + { "13q.bin", 0x080000, 0x99b25791, BRF_GRA }, + { "13r.bin", 0x080000, 0x2dd76149, BRF_GRA }, + + { "6n.bin", 0x020000, 0x6a579ee0, BRF_GRA }, // layer 1 + + { "14g.bin", 0x080000, 0x8b9b89c9, BRF_GRA }, + { "11g.bin", 0x080000, 0x4d127bdf, BRF_GRA }, + { "13g.bin", 0x080000, 0x298eb50e, BRF_GRA }, + { "11i.bin", 0x080000, 0x57e6d283, BRF_GRA }, + { "12g.bin", 0x080000, 0xfb184167, BRF_GRA }, + { "11j.bin", 0x080000, 0x1b752a4d, BRF_GRA }, + { "14m.bin", 0x080000, 0x2f26ba7b, BRF_GRA }, + { "11k.bin", 0x080000, 0x0263d89b, BRF_GRA }, + { "14n.bin", 0x080000, 0xc4633294, BRF_GRA }, + { "11l.bin", 0x080000, 0x5e4b5655, BRF_GRA }, + { "14p.bin", 0x080000, 0x4d4b0e4e, BRF_GRA }, + { "11o.bin", 0x080000, 0x7e9f2d2b, BRF_GRA }, + { "13p.bin", 0x080000, 0x0e7671f2, BRF_GRA }, + { "11p.bin", 0x080000, 0xee59b1ec, BRF_GRA }, + { "12p.bin", 0x080000, 0x9ab1998c, BRF_GRA }, + { "11q.bin", 0x080000, 0x1ab0c88a, BRF_GRA }, + + { "4a.bin", 0x080000, 0x8cd6824e, BRF_SND }, // sound 1 + { "4b.bin", 0x080000, 0xe31ae04d, BRF_SND }, + { "4c.bin", 0x080000, 0xc4c9f599, BRF_SND }, + { "4d.bin", 0x080000, 0xf0a9f0e1, BRF_SND }, + + { "5a.bin", 0x080000, 0x62557502, BRF_SND }, // sound 2 + { "5b.bin", 0x080000, 0xdbc86bd7, BRF_SND }, + { "5c.bin", 0x080000, 0x5839a2bd, BRF_SND }, + { "5d.bin", 0x080000, 0x446f9dc3, BRF_SND }, + + { "82s123.bin", 0x000020, 0x67d5ec4b, BRF_OPT }, // unknown + { "82s147.bin", 0x000200, 0xd7818542, BRF_OPT }, + +}; + +STD_ROM_PICK(powerinb) +STD_ROM_FN(powerinb) + +static void sndSetBank(UINT8 offset, UINT8 data) +{ + INT32 chip = (offset & 4) >> 2; + INT32 bank = offset & 3; + + MSM6295SampleInfo[chip][bank] = MSM6295ROM + 0x200000 * chip + 0x010000 * data + (bank << 8); + MSM6295SampleData[chip][bank] = MSM6295ROM + 0x200000 * chip + 0x010000 * data; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom68K = Next; Next += 0x0100000; // 68000 ROM + RomZ80 = Next; Next += 0x0020000; // Z80 ROM + RomBg = Next; Next += 0x0500000; + RomFg = Next; Next += 0x0100000; + RomSpr = Next; Next += 0x1000000; + MSM6295ROM = Next; Next += m6295size; + + RamStart = Next; + + RamZ80 = Next; Next += 0x002000; + + RamPal = (UINT16 *) Next; Next += 0x001000; + RamBg = (UINT16 *) Next; Next += 0x004000; + RamFg = (UINT16 *) Next; Next += 0x001000; + RamSpr = (UINT16 *) Next; Next += 0x010000; + RamVReg = (UINT16 *) Next; Next += 0x000008; + + RamEnd = Next; + + RamCurPal = (UINT32 *) Next; Next += 0x000800 * sizeof(UINT32); + + MemEnd = Next; + return 0; +} + +UINT8 __fastcall powerinsReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x10003f: + return MSM6295ReadStatus(0); + +// default: +// bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); + } + return 0; +} + +UINT16 __fastcall powerinsReadWord(UINT32 sekAddress) +{ + switch (sekAddress) + { + case 0x100000: + return ~DrvInput[0]; + + case 0x100002: + return ~(DrvInput[2] + (DrvInput[3]<<8)); + + case 0x100008: + return ~DrvInput[4]; + + case 0x10000A: + return ~DrvInput[6]; + +// default: +// bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); + } + return 0; +} + +void __fastcall powerinsWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) + { + case 0x100031: + // powerins_okibank + if (oki_bank != (byteValue & 7)) { + oki_bank = byteValue & 7; + memcpy(&MSM6295ROM[0x30000],&MSM6295ROM[0x40000 + 0x10000*oki_bank],0x10000); + } + break; + + case 0x10003e: + // powerina only! + break; + + case 0x10003f: + // powerina only! + MSM6295Command(0, byteValue); + break; + +// default: +// bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); + } +} + +void __fastcall powerinsWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) + { + case 0x100014: + // powerins_flipscreen_w + break; + + case 0x100018: + // powerins_tilebank_w + tile_bank = wordValue * 0x800; + break; + + case 0x10001e: + //powerins_soundlatch_w + soundlatch = wordValue & 0xff; + break; + + case 0x10003e: + // powerina only! + MSM6295Command(0, wordValue & 0xff); + break; + + case 0x130000: RamVReg[0] = wordValue; break; + case 0x130002: RamVReg[1] = wordValue; break; + case 0x130004: RamVReg[2] = wordValue; break; + case 0x130006: RamVReg[3] = wordValue; break; + + case 0x100016: // NOP + break; + +// default: +// bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); + } +} + +void __fastcall powerinsWriteWordPalette(UINT32 sekAddress, UINT16 wordValue) +{ + sekAddress -= 0x120000; + sekAddress >>= 1; + RamPal[sekAddress] = wordValue; + CalcCol( sekAddress ); +} + +UINT8 __fastcall powerinsZ80Read(UINT16 a) +{ + switch (a) + { + case 0xE000: + return soundlatch; + +// default: +// bprintf(PRINT_NORMAL, _T("Z80 Attempt to read value of location %04x\n"), a); + } + + return 0; +} + +#if 1 && defined FBA_DEBUG +void __fastcall powerinsZ80Write(UINT16 a,UINT8 v) +{ + switch (a) { + case 0xE000: + case 0xE001: + break; + + default: + bprintf(PRINT_NORMAL, _T("Z80 Attempt to write value %x to location %x\n"), v, a); + } +} +#endif + +UINT8 __fastcall powerinsZ80In(UINT16 p) +{ + switch (p & 0xFF) + { + case 0x00: + if ( game_drv == GAME_POWERINS ) + return BurnYM2203Read(0, 0); + else + return 0x01; + + case 0x01: + if ( game_drv == GAME_POWERINS ) + return BurnYM2203Read(0, 1); + else + return 0; + + case 0x80: + return MSM6295ReadStatus(0); + + case 0x88: + return MSM6295ReadStatus(1); + +// default: +// bprintf(PRINT_NORMAL, _T("Z80 Attempt to read port %04x\n"), p); + } + + return 0; +} + +void __fastcall powerinsZ80Out(UINT16 p, UINT8 v) +{ + switch (p & 0x0FF) { + case 0x00: + if ( game_drv == GAME_POWERINS ) { + BurnYM2203Write(0, 0, v); + } + break; + + case 0x01: + if ( game_drv == GAME_POWERINS ) { + BurnYM2203Write(0, 1, v); + } + break; + + case 0x80: + MSM6295Command(0, v); + break; + + case 0x88: + MSM6295Command(1, v); + break; + + case 0x90: sndSetBank(0, v); break; + case 0x91: sndSetBank(1, v); break; + case 0x92: sndSetBank(2, v); break; + case 0x93: sndSetBank(3, v); break; + case 0x94: sndSetBank(4, v); break; + case 0x95: sndSetBank(5, v); break; + case 0x96: sndSetBank(6, v); break; + case 0x97: sndSetBank(7, v); break; + +// default: +// bprintf(PRINT_NORMAL, _T("Z80 Attempt to write %02x to port %04x\n"), v, p); + } +} + +static void powerinsIRQHandler(INT32, INT32 nStatus) +{ +// bprintf(PRINT_NORMAL, _T("powerinsIRQHandler %i\n"), nStatus); + + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 powerinsSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 6000000; +} + +static double powerinsGetTime() +{ + return (double)ZetTotalCycles() / 6000000; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekSetIRQLine(0, SEK_IRQSTATUS_NONE); + SekReset(); + SekClose(); + + MSM6295Reset(0); + + if (game_drv != GAME_POWERINA) { + ZetOpen(0); + ZetReset(); + ZetClose(); + + if (game_drv == GAME_POWERINS) BurnYM2203Reset(); + + MSM6295Reset(1); + + } + + return 0; +} + +static void LoadDecodeBgRom(UINT8 *tmp, UINT8 * dest, INT32 id, INT32 size) +{ + BurnLoadRom(tmp, id, 1); + + for (INT32 z=0;z<(size/128);z++) { + for (INT32 y=0;y<16;y++) { + dest[ 0] = tmp[ 0] >> 4; + dest[ 1] = tmp[ 0] & 15; + dest[ 2] = tmp[ 1] >> 4; + dest[ 3] = tmp[ 1] & 15; + + dest[ 4] = tmp[ 2] >> 4; + dest[ 5] = tmp[ 2] & 15; + dest[ 6] = tmp[ 3] >> 4; + dest[ 7] = tmp[ 3] & 15; + + dest[ 8] = tmp[64] >> 4; + dest[ 9] = tmp[64] & 15; + dest[10] = tmp[65] >> 4; + dest[11] = tmp[65] & 15; + + dest[12] = tmp[66] >> 4; + dest[13] = tmp[66] & 15; + dest[14] = tmp[67] >> 4; + dest[15] = tmp[67] & 15; + + dest += 16; + tmp += 4; + } + tmp += 64; + } +} + +static void LoadDecodeSprRom(UINT8 *tmp, UINT8 * dest, INT32 id, INT32 size) +{ + if ( game_drv == GAME_POWERINB ) { + BurnLoadRom(tmp + 0, 9 + id*2, 2); + BurnLoadRom(tmp + 1, 10 + id*2, 2); + } else + BurnLoadRom(tmp, id, 1); + + for (INT32 z=0;z<(size/128);z++) { + for (INT32 y=0;y<16;y++) { + dest[ 0] = tmp[ 1] >> 4; + dest[ 1] = tmp[ 1] & 15; + dest[ 2] = tmp[ 0] >> 4; + dest[ 3] = tmp[ 0] & 15; + + dest[ 4] = tmp[ 3] >> 4; + dest[ 5] = tmp[ 3] & 15; + dest[ 6] = tmp[ 2] >> 4; + dest[ 7] = tmp[ 2] & 15; + + dest[ 8] = tmp[65] >> 4; + dest[ 9] = tmp[65] & 15; + dest[10] = tmp[64] >> 4; + dest[11] = tmp[64] & 15; + + dest[12] = tmp[67] >> 4; + dest[13] = tmp[67] & 15; + dest[14] = tmp[66] >> 4; + dest[15] = tmp[66] & 15; + + dest += 16; + tmp += 4; + } + tmp += 64; + } +} + +static INT32 powerinsInit() +{ + INT32 nRet; + UINT8 * tmp; + + m6295size = 0x80000 * 4 * 2; + + if ( strcmp(BurnDrvGetTextA(DRV_NAME), "powerins") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "powerinsj") == 0) { + game_drv = GAME_POWERINS; + } else + if ( strcmp(BurnDrvGetTextA(DRV_NAME), "powerinsa") == 0 ) { + game_drv = GAME_POWERINA; + m6295size = 0x90000; + } else + if ( strcmp(BurnDrvGetTextA(DRV_NAME), "powerinsb") == 0 ) { + game_drv = GAME_POWERINB; + } else + return 1; + + Mem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); // blank all memory + MemIndex(); + + // load roms + + tmp = (UINT8 *)BurnMalloc(0x200000); + if (tmp==0) return 1; + + if ( game_drv == GAME_POWERINS ) { + nRet = BurnLoadRom(Rom68K + 0x000000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Rom68K + 0x080000, 1, 1); if (nRet != 0) return 1; + + nRet = BurnLoadRom(RomZ80 + 0x000000, 2, 1); if (nRet != 0) return 1; + + // load background tile roms + LoadDecodeBgRom(tmp, RomBg+0x000000, 3, 0x100000); + LoadDecodeBgRom(tmp, RomBg+0x200000, 4, 0x100000); + LoadDecodeBgRom(tmp, RomBg+0x400000, 5, 0x080000); + + BurnLoadRom(RomFg + 0x000000, 6, 1); + + // load sprite roms + for (INT32 i=0;i<8;i++) + LoadDecodeSprRom(tmp, RomSpr+0x200000*i, i+7, 0x100000); + + BurnLoadRom(MSM6295ROM + 0x000000, 15, 1); + BurnLoadRom(MSM6295ROM + 0x100000, 16, 1); + BurnLoadRom(MSM6295ROM + 0x200000, 17, 1); + BurnLoadRom(MSM6295ROM + 0x300000, 18, 1); + + + } else + if ( game_drv == GAME_POWERINA ) { + nRet = BurnLoadRom(Rom68K + 0x000000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(Rom68K + 0x080000, 1, 1); if (nRet != 0) return 1; + + // load background tile roms + LoadDecodeBgRom(tmp, RomBg+0x000000, 2, 0x200000); + LoadDecodeBgRom(tmp, RomBg+0x400000, 3, 0x080000); + + // load foreground tile roms + BurnLoadRom(RomFg + 0x000000, 4, 1); + + // load sprite roms + for (INT32 i=0;i<4;i++) + LoadDecodeSprRom(tmp, RomSpr+0x400000*i, i+5, 0x200000); + + BurnLoadRom(MSM6295ROM + 0x10000, 9, 1); + memcpy(MSM6295ROM, MSM6295ROM + 0x10000, 0x30000); + + } else + if ( game_drv == GAME_POWERINB ) { + + nRet = BurnLoadRom(Rom68K + 0x000001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Rom68K + 0x000000, 1, 2); if (nRet != 0) return 1; + + nRet = BurnLoadRom(RomZ80 + 0x000000, 2, 1); if (nRet != 0) return 1; + + // load background tile roms + for (INT32 i=0;i<5;i++) + LoadDecodeBgRom(tmp, RomBg+0x100000*i, i+3, 0x80000); + + // load foreground tile roms + BurnLoadRom(RomFg + 0x000000, 8, 1); + + // load sprite roms + for (INT32 i=0;i<8;i++) + LoadDecodeSprRom(tmp, RomSpr+0x200000*i, i, 0x100000); + + BurnLoadRom(MSM6295ROM + 0x000000, 25, 1); + BurnLoadRom(MSM6295ROM + 0x080000, 26, 1); + BurnLoadRom(MSM6295ROM + 0x100000, 27, 1); + BurnLoadRom(MSM6295ROM + 0x180000, 28, 1); + BurnLoadRom(MSM6295ROM + 0x200000, 29, 1); + BurnLoadRom(MSM6295ROM + 0x280000, 30, 1); + BurnLoadRom(MSM6295ROM + 0x300000, 31, 1); + BurnLoadRom(MSM6295ROM + 0x380000, 32, 1); + + } + + BurnFree(tmp); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom68K, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM + SekMapMemory((UINT8 *)RamPal, + 0x120000, 0x120FFF, SM_ROM); // palette + SekMapMemory((UINT8 *)RamBg, + 0x140000, 0x143fff, SM_RAM); // b ground + SekMapMemory((UINT8 *)RamFg, + 0x170000, 0x170fff, SM_RAM); // f ground + SekMapMemory((UINT8 *)RamFg, + 0x171000, 0x171fff, SM_RAM); // f ground Mirror + SekMapMemory((UINT8 *)RamSpr, + 0x180000, 0x18ffff, SM_RAM); // sprites + + SekMapHandler(1, 0x120000, 0x120FFF, SM_WRITE); + + + SekSetReadWordHandler(0, powerinsReadWord); + SekSetReadByteHandler(0, powerinsReadByte); + SekSetWriteWordHandler(0, powerinsWriteWord); + SekSetWriteByteHandler(0, powerinsWriteByte); + + //SekSetWriteByteHandler(1, powerinsWriteBytePalette); + SekSetWriteWordHandler(1, powerinsWriteWordPalette); + + SekClose(); + } + + if ( game_drv != GAME_POWERINA ) { + + ZetInit(0); + ZetOpen(0); + + ZetSetReadHandler(powerinsZ80Read); +#if 1 && defined FBA_DEBUG + ZetSetWriteHandler(powerinsZ80Write); +#endif + ZetSetInHandler(powerinsZ80In); + ZetSetOutHandler(powerinsZ80Out); + + // ROM bank 1 + ZetMapArea(0x0000, 0xBFFF, 0, RomZ80); + ZetMapArea(0x0000, 0xBFFF, 2, RomZ80); + // RAM + ZetMapArea(0xC000, 0xDFFF, 0, RamZ80); + ZetMapArea(0xC000, 0xDFFF, 1, RamZ80); + ZetMapArea(0xC000, 0xDFFF, 2, RamZ80); + + ZetClose(); + } + + if ( game_drv == GAME_POWERINA ) { + MSM6295Init(0, 990000 / 165, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + } + + if (game_drv == GAME_POWERINS ) { + BurnYM2203Init(1, 12000000 / 8, &powerinsIRQHandler, powerinsSynchroniseStream, powerinsGetTime, 0); + BurnTimerAttachZet(6000000); + BurnYM2203SetAllRoutes(0, 2.00, BURN_SND_ROUTE_BOTH); + BurnSetRefreshRate(56.0); + + MSM6295Init(0, 4000000 / 165, 1); + MSM6295Init(1, 4000000 / 165, 1); + MSM6295SetRoute(0, 0.15, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 0.15, BURN_SND_ROUTE_BOTH); + } + + if (game_drv == GAME_POWERINB ) { + MSM6295Init(0, 4000000 / 165, 1); + MSM6295Init(1, 4000000 / 165, 1); + MSM6295SetRoute(0, 0.15, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 0.15, BURN_SND_ROUTE_BOTH); + } + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 powerinsExit() +{ + GenericTilesExit(); + + SekExit(); + MSM6295Exit(0); + + if (game_drv != GAME_POWERINA) { + MSM6295Exit(1); + + if (game_drv == GAME_POWERINS) + BurnYM2203Exit(); + + ZetExit(); + } + + BurnFree(Mem); + return 0; +} + +static void TileBackground() +{ + for (INT32 offs = 256*32-1; offs >=0; offs--) { + + INT32 page = offs >> 8; + INT32 x = (offs >> 4) & 0xF; + INT32 y = (offs >> 0) & 0xF; + + x = x * 16 + (page & 7) * 256 + 32 - ((RamVReg[1]&0xff) + (RamVReg[0]&0xff)*256); + y = y * 16 + (page >> 4) * 256 - 16 - ((RamVReg[3]&0xff) + (RamVReg[2]&0xff)*256); + + if ( x<=-16 || x>=320 || y <=-16 || y>=224 ) continue; + else { + INT32 attr = RamBg[offs]; + INT32 code = ((attr & 0x7ff) + tile_bank); + INT32 color = (attr >> 12) | ((attr >> 7) & 0x10); + + if ( x >=0 && x <= (320-16) && y>=0 && y <=(224-16) ) { + Render16x16Tile(pTransDraw, code, x, y, color, 4, 0, RomBg); + } else { + Render16x16Tile_Clip(pTransDraw, code, x, y, color, 4, 0, RomBg); + } + } + } +} + +static void TileForeground() +{ + for (INT32 offs = 0; offs < 64*32; offs++) { + INT32 x = ((offs & 0xFFE0) >> 2 ) + 32; + INT32 y = ((offs & 0x001F) << 3 ) - 16; + if (x > 320) x -= 512; + if ( x<0 || x>(320-8) || y<0 || y>(224-8)) continue; + else { + if ((RamFg[offs] & 0x0FFF) == 0) continue; + UINT8 *d = RomFg + (RamFg[offs] & 0x0FFF) * 32; + UINT16 c = ((RamFg[offs] & 0xF000) >> 8) | 0x200; + UINT16 *p = pTransDraw + y * 320 + x; + for (INT32 k=0;k<8;k++) { + if ((d[0] >> 4) != 15) p[0] = (d[0] >> 4) | c; + if ((d[0] & 0xF) != 15) p[1] = (d[0] & 0xF) | c; + if ((d[1] >> 4) != 15) p[2] = (d[1] >> 4) | c; + if ((d[1] & 0xF) != 15) p[3] = (d[1] & 0xF) | c; + if ((d[2] >> 4) != 15) p[4] = (d[2] >> 4) | c; + if ((d[2] & 0xF) != 15) p[5] = (d[2] & 0xF) | c; + if ((d[3] >> 4) != 15) p[6] = (d[3] >> 4) | c; + if ((d[3] & 0xF) != 15) p[7] = (d[3] & 0xF) | c; + d += 4; + p += 320; + } + } + } +} + +static inline void drawgfx(UINT32 code,UINT32 color,INT32 flipx,/*INT32 flipy,*/INT32 sx,INT32 sy) +{ + if (sx >= 0 && sx <= (320-16) && sy >= 0 && sy <= (224-16) ) { + if ( flipx ) + Render16x16Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 15, 0x400, RomSpr); + else + Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 4, 15, 0x400, RomSpr); + } else { + if ( flipx ) + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x400, RomSpr); + else + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0x400, RomSpr); + } +} + +static void DrawSprites() +{ + UINT16 *source = RamSpr + 0x8000/2; + UINT16 *finish = RamSpr + 0x9000/2; + + for ( ; source < finish; source += 8 ) { + + if (!(source[0]&1)) continue; + + INT32 size = source[1]; + INT32 code = (source[3] & 0x7fff) + ( (size & 0x0100) << 7 ); + INT32 sx = source[4]; + INT32 sy = source[6]; + INT32 color = source[7] & 0x3F; + INT32 flipx = size & 0x1000; + INT32 dimx = ((size >> 0) & 0xf ) + 1; + INT32 dimy = ((size >> 4) & 0xf ) + 1; + + sx &= 0x3ff; if (sx > 0x1ff) sx -= 0x400; sx += 32; + sy &= 0x3ff; if (sy > 0x1ff) sy -= 0x400; sy -= 16; + + for (INT32 x = 0 ; x < dimx ; x++) + for (INT32 y = 0 ; y < dimy ; y++) { + drawgfx(code, color, flipx, /*flipy, */sx + x*16, sy + y*16); + code ++; + } + } +} + +static void DrvDraw() +{ + if (bRecalcPalette) { + for (INT32 i=0; i<0x800; i++) CalcCol(i); + bRecalcPalette = 0; + } + + BurnTransferClear(); + + TileBackground(); + DrawSprites(); + TileForeground(); + + BurnTransferCopy(RamCurPal); +} + +static INT32 powerinsFrame() +{ + INT32 nInterleave = 200; + + if (DrvReset) DrvDoReset(); + + DrvInput[0] = 0x00; + DrvInput[2] = 0x00; + DrvInput[3] = 0x00; + for (INT32 i = 0; i < 8; i++) { + DrvInput[2] |= (DrvJoy1[i] & 1) << i; + DrvInput[3] |= (DrvJoy2[i] & 1) << i; + DrvInput[0] |= (DrvButton[i] & 1) << i; + } + + nCyclesTotal[0] = (INT32)((INT64)12000000 * nBurnCPUSpeedAdjust / (0x0100 * 56)); + if (game_drv == GAME_POWERINB) nCyclesTotal[0] = (INT32)((INT64)12000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = 6000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + SekOpen(0); + if (game_drv != GAME_POWERINA) { + ZetNewFrame(); + ZetOpen(0); + } + + if ( game_drv == GAME_POWERINA ) { + nCyclesTotal[0] = (INT32)((INT64)12000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + SekRun(nCyclesTotal[0]); + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + if (game_drv == GAME_POWERINS) { + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + } + + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + + if (game_drv == GAME_POWERINB) { + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if ((i & 180) == 0) { + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + } + } + + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + + SekClose(); + + if (game_drv == GAME_POWERINS) { + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + } + + if (game_drv == GAME_POWERINB) { + ZetRun(nCyclesTotal[1] - nCyclesDone[1]); + + if (pBurnSoundOut) { + memset(pBurnSoundOut, 0, nBurnSoundLen * 2 * sizeof(INT16)); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + MSM6295Render(1, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + } + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 powerinsScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029671; + } + + if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + + SekScan(nAction); // Scan 68000 state + + if ( game_drv != GAME_POWERINA ) + ZetScan(nAction); // Scan Z80 state + + if ( game_drv == GAME_POWERINS ) + BurnYM2203Scan(nAction, pnMin); + + MSM6295Scan(0, nAction); + if ( game_drv != GAME_POWERINA ) + MSM6295Scan(1, nAction); + + SCAN_VAR(m6295size); + SCAN_VAR(soundlatch); + if ( game_drv == GAME_POWERINA ) + SCAN_VAR(oki_bank); + + SCAN_VAR(tile_bank); + SCAN_VAR(RamCurPal); + + if (nAction & ACB_WRITE) { + bRecalcPalette = 1; + if ( game_drv == GAME_POWERINA ) + memcpy(&MSM6295ROM[0x30000],&MSM6295ROM[0x40000 + 0x10000*oki_bank],0x10000); + } + } + + return 0; +} + +struct BurnDriver BurnDrvPowerins = { + "powerins", NULL, NULL, NULL, "1993", + "Power Instinct (USA)\0", NULL, "Atlus", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, FBF_PWRINST, + NULL, powerinsRomInfo, powerinsRomName, NULL, NULL, powerinsInputInfo, powerinsDIPInfo, + powerinsInit, powerinsExit, powerinsFrame, NULL, powerinsScan, &bRecalcPalette, 0x800, + 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPowerinj = { + "powerinsj", "powerins", NULL, NULL, "1993", + "Gouketsuji Ichizoku (Japan)\0", NULL, "Atlus", "Miscellaneous", + L"\u8C6A\u8840\u5BFA\u4E00\u65CF (Japan)\0Gouketsuji Ichizoku\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, FBF_PWRINST, + NULL, powerinjRomInfo, powerinjRomName, NULL, NULL, powerinsInputInfo, powerinjDIPInfo, + powerinsInit, powerinsExit, powerinsFrame, NULL, powerinsScan, &bRecalcPalette, 0x800, + 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPowerina = { + "powerinsa", "powerins", NULL, NULL, "1993", + "Power Instinct (USA, bootleg set 1)\0", NULL, "Atlus", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, FBF_PWRINST, + NULL, powerinaRomInfo, powerinaRomName, NULL, NULL, powerinsInputInfo, powerinsDIPInfo, + powerinsInit, powerinsExit, powerinsFrame, NULL, powerinsScan, &bRecalcPalette, 0x800, + 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPowerinb = { + "powerinsb", "powerins", NULL, NULL, "1993", + "Power Instinct (USA, bootleg set 2)\0", NULL, "Atlus", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, FBF_PWRINST, + NULL, powerinbRomInfo, powerinbRomName, NULL, NULL, powerinsInputInfo, powerinsDIPInfo, + powerinsInit, powerinsExit, powerinsFrame, NULL, powerinsScan, &bRecalcPalette, 0x800, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_pushman.cpp b/src/burn/drv/pst90s/d_pushman.cpp index d54eb298f..86365c1ef 100644 --- a/src/burn/drv/pst90s/d_pushman.cpp +++ b/src/burn/drv/pst90s/d_pushman.cpp @@ -1,980 +1,979 @@ -// FB Alpha Pushman driver module -// Based on MAME driver by Bryan McPhail - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "m6805_intf.h" -#include "burn_ym2203.h" - -static UINT8 *AllMem; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvMcuROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *Drv68KRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvMcuRAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT16*DrvScroll; -static UINT8 *DrvShareRAM; -static UINT8 *soundlatch; -static UINT8 *flipscreen; - -static INT32 latch; -static INT32 new_latch; - -static UINT16 DrvInputs[2]; -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; - -static INT32 vblank; -static INT32 no_mcu = 0; - -static struct BurnInputInfo PushmanInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 14, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 8, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 15, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 9, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 11, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 10, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 9, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 8, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 14, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 13, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Pushman) - -static struct BurnInputInfo BballsInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 14, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 8, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 15, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 9, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 11, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 10, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 9, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 8, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 13, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Bballs) - -static struct BurnDIPInfo PushmanDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Debug Mode (Cheat)" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Pull Option" }, - {0x14, 0x01, 0x02, 0x02, "5" }, - {0x14, 0x01, 0x02, 0x00, "9" }, - - {0 , 0xfe, 0 , 2, "Level Select" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x14, 0x01, 0x08, 0x08, "Upright" }, - {0x14, 0x01, 0x08, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x10, 0x00, "Off" }, - {0x14, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x15, 0x01, 0x07, 0x00, "5 Coins 1 Credits" }, - {0x15, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, - {0x15, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x15, 0x01, 0x07, 0x03, "2 Coins 1 Credits" }, - {0x15, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x15, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x15, 0x01, 0x08, 0x08, "Easy" }, - {0x15, 0x01, 0x08, 0x00, "Hard" }, -}; - -STDDIPINFO(Pushman) - -static struct BurnDIPInfo BballsDIPList[]= -{ - {0x12, 0xff, 0xff, 0xcf, NULL }, - {0x13, 0xff, 0xff, 0xfd, NULL }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x12, 0x01, 0x07, 0x00, "5 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x03, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x12, 0x01, 0x08, 0x08, "Easy" }, - {0x12, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2, "Music (In-game)" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Music (Attract Mode)" }, - {0x12, 0x01, 0x20, 0x20, "Off" }, - {0x12, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0xc0, 0xc0, "1" }, - {0x12, 0x01, 0xc0, 0x80, "2" }, - {0x12, 0x01, 0xc0, 0x40, "3" }, - {0x12, 0x01, 0xc0, 0x00, "4" }, - - {0 , 0xfe, 0 , 2, "Zaps" }, - {0x13, 0x01, 0x01, 0x01, "1" }, - {0x13, 0x01, 0x01, 0x00, "2" }, - - {0 , 0xfe, 0 , 2, "Display Next Ball" }, - {0x13, 0x01, 0x02, 0x02, "No" }, - {0x13, 0x01, 0x02, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 3, "Service Mode" }, - {0x13, 0x01, 0xc0, 0xc0, "Off" }, - {0x13, 0x01, 0xc0, 0x40, "Inputs/Outputs" }, - {0x13, 0x01, 0xc0, 0x00, "Graphics" }, -}; - -STDDIPINFO(Bballs) - -void __fastcall pushman_main_write_word(UINT32 address, UINT16 data) -{ - if (address & 0xf00000) { - SekWriteWord(address & 0xfffff, data); - return; - } - - switch (address) - { - case 0x060000: - case 0x060002: - case 0x060004: - case 0x060006: - { - INT32 offset = address & 0x06; - - DrvShareRAM[offset + 0] = data >> 8; - DrvShareRAM[offset + 1] = data; - - if (no_mcu) { - if(offset == 0) { - latch = 0; - if (DrvShareRAM[0] <= 0xf) latch = DrvShareRAM[0] << 2; - if (DrvShareRAM[1]) latch |= 2; - new_latch = 1; - } - } else { - if (offset == 2) { - m68705SetIrqLine(0, 1); - m6805Run(0); - m68705SetIrqLine(0, 0); - new_latch = 0; - } - } - } - return; - - case 0x0e8000: - case 0x0e8002: - DrvScroll[(address >> 1) & 1] = data; - return; - } -} - -void __fastcall pushman_main_write_byte(UINT32 address, UINT8 data) -{ - if (address & 0xf00000) { - SekWriteByte(address & 0xfffff, data); - return; - } - - switch (address) - { - case 0x0e4000: - *flipscreen = data & 0x02; - return; - - case 0x0e4002: - *soundlatch = data; - return; - } -} - -UINT16 __fastcall pushman_main_read_word(UINT32 address) -{ - if (address & 0xf00000) { - return SekReadWord(address & 0xfffff); - } - - switch (address) - { - case 0x060000: - return latch; - - case 0x060002: - case 0x060004: - return ((DrvShareRAM[(address & 0x06) + 1] << 8) | DrvShareRAM[(address & 0x06)]); - - case 0x060006: - if ( new_latch) { new_latch = 0; return 0; } - if (!new_latch) return 0xff; - - case 0x0e4000: - return DrvInputs[0]; - - case 0x0e4002: - return DrvInputs[1] ^ vblank; - - case 0x0e4004: - return (DrvDips[1] << 8) | DrvDips[0]; - } - - return 0; -} - -UINT8 __fastcall pushman_main_read_byte(UINT32 address) -{ - if (address & 0xf00000) { - return SekReadByte(address & 0xfffff); - } - - switch (address) - { - case 0x0e4002: - return (DrvInputs[1] ^ vblank) >> 8; - } - - return 0; -} - - -void __fastcall pushman_sound_out_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - BurnYM2203Write(0, port & 1, data); - return; - - case 0x80: - case 0x81: - BurnYM2203Write(1, port & 1, data); - return; - } -} - -UINT8 __fastcall pushman_sound_read(UINT16 address) -{ - if (address == 0xe000) return *soundlatch; - - return 0; -} - -void pushman_mcu_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x0002: - { - if (~DrvShareRAM[2] & 0x02 && data & 0x02) { - latch = (DrvShareRAM[1] << 8) | DrvShareRAM[0]; - new_latch = 1; - } - DrvShareRAM[address] = data; - } - return; - - case 0x0000: - case 0x0001: - case 0x0003: - case 0x0004: - case 0x0005: - case 0x0006: - case 0x0007: - DrvShareRAM[address] = data; - return; - } -} - -UINT8 pushman_mcu_read(UINT16 address) -{ - switch (address) - { - case 0x0000: - case 0x0001: - case 0x0002: - case 0x0003: - case 0x0004: - case 0x0005: - case 0x0006: - case 0x0007: - return DrvShareRAM[address]; - } - - return 0; -} - -static void DrvIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000.0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - -// m6805Open(0); - m68705Reset(); -// m6805Close(); - - BurnYM2203Reset(); - - latch = 0x400; // bballs - new_latch = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x020000; - DrvZ80ROM = Next; Next += 0x010000; - DrvMcuROM = Next; Next += 0x001000; - - DrvGfxROM0 = Next; Next += 0x020000; - DrvGfxROM1 = Next; Next += 0x080000; - DrvGfxROM2 = Next; Next += 0x080000; - DrvGfxROM3 = Next; Next += 0x010000; - - DrvPalette = (UINT32*)Next; Next += 0x0240 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x004000; - DrvPalRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x001000; - DrvVidRAM = Next; Next += 0x000800; - DrvZ80RAM = Next; Next += 0x000800; - DrvMcuRAM = Next; Next += 0x000080; - - DrvShareRAM = Next; Next += 0x000008; - - DrvScroll = (UINT16*)Next; Next += 0x000002 * sizeof(UINT16); - - soundlatch = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x000004, 0x000000, 0x100004, 0x100000 }; - INT32 Plane1[4] = { 0x000000, 0x080000, 0x100000, 0x180000 }; - INT32 XOffs0[32] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, - 0x200, 0x201, 0x202, 0x203, 0x208, 0x209, 0x20a, 0x20b, - 0x400, 0x401, 0x402, 0x403, 0x408, 0x409, 0x40a, 0x40b, - 0x600, 0x601, 0x602, 0x603, 0x608, 0x609, 0x60a, 0x60b }; - INT32 YOffs0[32] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, - 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0, - 0x100, 0x110, 0x120, 0x130, 0x140, 0x150, 0x160, 0x170, - 0x180, 0x190, 0x1a0, 0x1b0, 0x1c0, 0x1d0, 0x1e0, 0x1f0 }; - INT32 XOffs1[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087 }; - INT32 YOffs1[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, - 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x08000); - - GfxDecode(0x0800, 2, 8, 8, Plane0, XOffs0, YOffs0, 0x080, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x40000); - - GfxDecode(0x0800, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x40000); - - GfxDecode(0x0200, 4, 32, 32, Plane0, XOffs0, YOffs0, 0x800, tmp, DrvGfxROM2); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; - - BurnLoadRom(DrvMcuROM + 0x00000, 3, 1); - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x10000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x20000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x30000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x10000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x20000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x30000, 12, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x00000, 13, 1)) return 1; - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x01ffff, SM_ROM); - SekMapMemory(DrvSprRAM, 0x0e0800, 0x0e17ff, SM_RAM); - SekMapMemory(DrvVidRAM, 0x0ec000, 0x0ec7ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x0f8000, 0x0f87ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0fc000, 0x0fffff, SM_RAM); - SekSetWriteWordHandler(0, pushman_main_write_word); - SekSetWriteByteHandler(0, pushman_main_write_byte); - SekSetReadWordHandler(0, pushman_main_read_word); - SekSetReadByteHandler(0, pushman_main_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); - ZetSetReadHandler(pushman_sound_read); - ZetSetOutHandler(pushman_sound_out_port); - ZetMemEnd(); - ZetClose(); - - m6805Init(1, 0x1000); -// m6805Open(0); - m6805MapMemory(DrvMcuRAM + 0x0000, 0x0010, 0x007f, M6805_RAM); - m6805MapMemory(DrvMcuROM + 0x0080, 0x0080, 0x0fff, M6805_ROM); - m6805SetWriteHandler(pushman_mcu_write); - m6805SetReadHandler(pushman_mcu_read); -// m6805Close(); - - BurnYM2203Init(2, 2000000, &DrvIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - SekExit(); - ZetExit(); - m6805Exit(); - - BurnYM2203Exit(); - - BurnFree (AllMem); - - no_mcu = 0; - - return 0; -} - -static void draw_background() -{ - INT32 scrollx = DrvScroll[0] & 0xfff; - INT32 scrolly = (0xf00 - DrvScroll[1] + 16) & 0x7ff; - - for (INT32 offs = 0; offs < 128 * 64; offs++) - { - INT32 col = offs & 0x7f; - INT32 row = offs >> 7; - - INT32 sy = (row << 5) - scrolly; - if (sy < -31) sy += 0x0800; - - INT32 sx = (col << 5) - scrollx; - if (sx < -31) sx += 0x1000; - - if (sy >= nScreenHeight || sx >= nScreenWidth) continue; - - INT32 ofst = (col & 7) + ((~row & 7) << 3) + ((col & 0x78) << 3) + ((~row&0x38)<<7); - - INT32 attr = DrvGfxROM3[ofst * 2 + 0] | (DrvGfxROM3[ofst * 2 + 1] << 8); - INT32 code = (attr & 0xff) | ((attr & 0x4000) >> 6); - INT32 color = (attr >> 8) & 0x0f; - INT32 flipx = (attr & 0x2000); - - if (flipx) { - Render32x32Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM2); - } else { - Render32x32Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM2); - } - } -} - -static void draw_foreground() -{ - UINT16 *vram = (UINT16*)DrvVidRAM; - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - sy -= 16; - if (sy < 0 || sy >= nScreenHeight) continue; - - INT32 attr = vram[offs]; - INT32 code = (attr & 0xff) | ((attr & 0xc000) >> 6) | ((attr & 0x2000) >> 3); - INT32 color = (attr >> 8) & 0x0f; - INT32 flipy = (attr & 0x1000); - - if (flipy) { - Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 2, 3, 0x200, DrvGfxROM0); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 2, 3, 0x200, DrvGfxROM0); - } - } -} - -static void draw_sprites() -{ - UINT16 *vram = (UINT16*)DrvSprRAM; - - for (INT32 offs = 0x0800-4; offs >= 0; offs -= 4) - { - INT32 x = vram[offs + 3] & 0x1ff; - if (x == 0x180) continue; - - if (x > 0xff) x=0-(0x200-x); - - INT32 y = 240-vram[offs + 2]; - INT32 color = (vram[offs + 1] >> 2) & 0xf; - INT32 code = vram[offs + 0] & 0x7ff; - - INT32 flipx = vram[offs + 1] & 2; - INT32 flipy = vram[offs + 1] & 1; - - if (*flipscreen) - { - x = 240 - x; - y = 240 - y; - flipx = !flipx; - flipy = !flipy; - } - - y -= 16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y, color, 4, 15, 0x100, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y, color, 4, 15, 0x100, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, color, 4, 15, 0x100, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, color, 4, 15, 0x100, DrvGfxROM1); - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0x200 / 2; i < 0x680 / 2; i++) { - r = (p[i] >> 8) & 0x0f; - g = (p[i] >> 4) & 0x0f; - b = (p[i] >> 0) & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - DrvPalette[i - 0x100] = BurnHighCol(r, g, b, 0); - } - } - - draw_background(); - draw_sprites(); - draw_foreground(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - memset (DrvInputs, 0xff, 2 * sizeof(INT16)); - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - SekOpen(0); - ZetOpen(0); -// m6805Open(0); - - INT32 nInterleave = 256; - INT32 nCyclesTotal[3] = { 8000000 / 60, 4000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - - vblank = 0; - - for (INT32 i = 0; i < nInterleave; i++) - { - if (i == 16) vblank = 0x0400; - if (i == 240) vblank = 0; - - INT32 segment = nCyclesTotal[0] / nInterleave; - - nCyclesDone[0] += SekRun(segment); - if (i == (nInterleave - 1)) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - - if (no_mcu == 0) { - nCyclesDone[1] += m6805Run(segment / 2); - } - - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - } - - if (pBurnSoundOut) { - BurnTimerEndFrame(nCyclesTotal[1]); - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - } - -// m6805Close(); - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029707; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - m6805Scan(nAction, 0); - - BurnYM2203Scan(nAction, pnMin); - - SCAN_VAR(new_latch); - SCAN_VAR(latch); - } - - return 0; -} - - -// Pushman (Korea, set 1) - -static struct BurnRomInfo pushmanRomDesc[] = { - { "pushman.012", 0x10000, 0x330762bc, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "pushman.011", 0x10000, 0x62636796, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "pushman.013", 0x08000, 0xadfe66c1, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "pushman68705r3p.ic23",0x01000, 0xd7916657, 3 | BRF_PRG | BRF_ESS }, // 3 M68705 MCU Code - - { "pushman.001", 0x08000, 0x626e5865, 4 | BRF_GRA }, // 4 Characters - - { "pushman.004", 0x10000, 0x87aafa70, 5 | BRF_GRA }, // 5 Sprites - { "pushman.005", 0x10000, 0x7fd1200c, 5 | BRF_GRA }, // 6 - { "pushman.002", 0x10000, 0x0a094ab0, 5 | BRF_GRA }, // 7 - { "pushman.003", 0x10000, 0x73d1f29d, 5 | BRF_GRA }, // 8 - - { "pushman.006", 0x10000, 0x48ef3da6, 6 | BRF_GRA }, // 9 Tiles - { "pushman.008", 0x10000, 0x4b6a3e88, 6 | BRF_GRA }, // 10 - { "pushman.007", 0x10000, 0xb70020bd, 6 | BRF_GRA }, // 11 - { "pushman.009", 0x10000, 0xcc555667, 6 | BRF_GRA }, // 12 - - { "pushman.010", 0x08000, 0xa500132d, 7 | BRF_GRA }, // 13 Tilemap - - { "n82s129an.ic82", 0x00100, 0xec80ae36, 0 | BRF_GRA }, // 14 Prom -}; - -STD_ROM_PICK(pushman) -STD_ROM_FN(pushman) - -struct BurnDriver BurnDrvPushman = { - "pushman", NULL, NULL, NULL, "1990", - "Pushman (Korea, set 1)\0", NULL, "Comad", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, pushmanRomInfo, pushmanRomName, NULL, NULL, PushmanInputInfo, PushmanDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, - 256, 224, 4, 3 -}; - - -// Pushman (Korea, set 2) - -static struct BurnRomInfo pushmanaRomDesc[] = { - { "pushmana.212", 0x10000, 0x871d0858, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "pushmana.011", 0x10000, 0xae57761e, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "pushman.013", 0x08000, 0xadfe66c1, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "pushman68705r3p.ic23",0x01000, 0xd7916657, 3 | BRF_PRG | BRF_ESS }, // 3 M68705 MCU Code - - { "pushmana.130", 0x10000, 0xf83f92e7, 4 | BRF_GRA }, // 4 Characters - - { "pushman.004", 0x10000, 0x87aafa70, 5 | BRF_GRA }, // 5 Sprites - { "pushman.005", 0x10000, 0x7fd1200c, 5 | BRF_GRA }, // 6 - { "pushman.002", 0x10000, 0x0a094ab0, 5 | BRF_GRA }, // 7 - { "pushman.003", 0x10000, 0x73d1f29d, 5 | BRF_GRA }, // 8 - - { "pushman.006", 0x10000, 0x48ef3da6, 6 | BRF_GRA }, // 9 Tiles - { "pushman.008", 0x10000, 0x4b6a3e88, 6 | BRF_GRA }, // 10 - { "pushman.007", 0x10000, 0xb70020bd, 6 | BRF_GRA }, // 11 - { "pushman.009", 0x10000, 0xcc555667, 6 | BRF_GRA }, // 12 - - { "pushmana.189", 0x10000, 0x59f25598, 7 | BRF_GRA }, // 13 Tilemap - - { "n82s129an.ic82", 0x000100, 0xec80ae36, 0 | BRF_GRA }, // 14 Prom -}; - -STD_ROM_PICK(pushmana) -STD_ROM_FN(pushmana) - -struct BurnDriver BurnDrvPushmana = { - "pushmana", "pushman", NULL, NULL, "1990", - "Pushman (Korea, set 2)\0", NULL, "Comad", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, pushmanaRomInfo, pushmanaRomName, NULL, NULL, PushmanInputInfo, PushmanDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, - 256, 224, 4, 3 -}; - - -// Pushman (American Sammy license) - -static struct BurnRomInfo pushmansRomDesc[] = { - { "pman-12.ic212", 0x10000, 0x4251109d, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "pman-11.ic197", 0x10000, 0x1167ed9f, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "pman-13.ic216", 0x08000, 0xbc03827a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "pushman68705r3p.ic23",0x01000, 0xd7916657, 3 | BRF_PRG | BRF_ESS }, // 3 M68705 MCU Code - - { "pman-1.ic130", 0x08000, 0x14497754, 4 | BRF_GRA }, // 4 Characters - - { "pman-4.ic58", 0x10000, 0x16e5ce6b, 5 | BRF_GRA }, // 5 Sprites - { "pman-5.ic59", 0x10000, 0xb82140b8, 5 | BRF_GRA }, // 6 - { "pman-2.56", 0x10000, 0x2cb2ac29, 5 | BRF_GRA }, // 7 - { "pman-3.57", 0x10000, 0x8ab957c8, 5 | BRF_GRA }, // 8 - - { "pman-6.ic131", 0x10000, 0xbd0f9025, 6 | BRF_GRA }, // 9 Tiles - { "pman-8.ic148", 0x10000, 0x591bd5c0, 6 | BRF_GRA }, // 10 - { "pman-7.ic132", 0x10000, 0x208cb197, 6 | BRF_GRA }, // 11 - { "pman-9.ic149", 0x10000, 0x77ee8577, 6 | BRF_GRA }, // 12 - - { "pman-10.ic189", 0x08000, 0x5f9ae9a1, 7 | BRF_GRA }, // 13 Tilemap - - { "n82s129an.ic82", 0x00100, 0xec80ae36, 0 | BRF_GRA }, // 14 Prom -}; - -STD_ROM_PICK(pushmans) -STD_ROM_FN(pushmans) - -struct BurnDriver BurnDrvPushmans = { - "pushmans", "pushman", NULL, NULL, "1990", - "Pushman (American Sammy license)\0", NULL, "Comad (American Sammy license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, pushmansRomInfo, pushmansRomName, NULL, NULL, PushmanInputInfo, PushmanDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, - 256, 224, 4, 3 -}; - - -// Bouncing Balls - -static struct BurnRomInfo bballsRomDesc[] = { - { "bb12.m17", 0x10000, 0x4501c245, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "bb11.l17", 0x10000, 0x55e45b60, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bb13.n4", 0x08000, 0x1ef78175, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "68705.uc", 0x01000, 0x00000000, 3 | BRF_PRG | BRF_NODUMP }, // 3 M68705 MCU Code - - { "bb1.g20", 0x08000, 0xb62dbcb8, 4 | BRF_GRA }, // 4 Characters - - { "bb4.d1", 0x10000, 0xb77de5f8, 5 | BRF_GRA }, // 5 Sprites - { "bb5.d2", 0x10000, 0xffffccbf, 5 | BRF_GRA }, // 6 - { "bb2.b1", 0x10000, 0xa5b13236, 5 | BRF_GRA }, // 7 - { "bb3.b2", 0x10000, 0xe35b383d, 5 | BRF_GRA }, // 8 - - { "bb6.h1", 0x10000, 0x0cada9ce, 6 | BRF_GRA }, // 9 Tiles - { "bb8.j1", 0x10000, 0xd55fe7c1, 6 | BRF_GRA }, // 10 - { "bb7.h2", 0x10000, 0xa352d53b, 6 | BRF_GRA }, // 11 - { "bb9.j2", 0x10000, 0x78d185ac, 6 | BRF_GRA }, // 12 - - { "bb10.l6", 0x08000, 0xd06498f9, 7 | BRF_GRA }, // 13 Tilemap - - { "bb_prom.e9", 0x00100, 0xec80ae36, 8 | BRF_OPT }, // 14 Priority -}; - -STD_ROM_PICK(bballs) -STD_ROM_FN(bballs) - -static INT32 bballsInit() -{ - no_mcu = 1; - - return DrvInit(); -} - -struct BurnDriver BurnDrvBballs = { - "bballs", NULL, NULL, NULL, "1991", - "Bouncing Balls\0", NULL, "Comad", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, bballsRomInfo, bballsRomName, NULL, NULL, BballsInputInfo, BballsDIPInfo, - bballsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, - 256, 224, 4, 3 -}; +// FB Alpha Pushman driver module +// Based on MAME driver by Bryan McPhail + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "m6805_intf.h" +#include "burn_ym2203.h" + +static UINT8 *AllMem; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvMcuROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *Drv68KRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvMcuRAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT16*DrvScroll; +static UINT8 *DrvShareRAM; +static UINT8 *soundlatch; +static UINT8 *flipscreen; + +static INT32 latch; +static INT32 new_latch; + +static UINT16 DrvInputs[2]; +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; + +static INT32 vblank; +static INT32 no_mcu = 0; + +static struct BurnInputInfo PushmanInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 14, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 8, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 15, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 9, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 11, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 10, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 9, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 8, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 14, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 13, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Pushman) + +static struct BurnInputInfo BballsInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 14, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 8, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 15, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 9, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 11, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 10, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 9, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 8, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 13, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Bballs) + +static struct BurnDIPInfo PushmanDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Debug Mode (Cheat)" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Pull Option" }, + {0x14, 0x01, 0x02, 0x02, "5" }, + {0x14, 0x01, 0x02, 0x00, "9" }, + + {0 , 0xfe, 0 , 2, "Level Select" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x14, 0x01, 0x08, 0x08, "Upright" }, + {0x14, 0x01, 0x08, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x10, 0x00, "Off" }, + {0x14, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x15, 0x01, 0x07, 0x00, "5 Coins 1 Credits" }, + {0x15, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, + {0x15, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x15, 0x01, 0x07, 0x03, "2 Coins 1 Credits" }, + {0x15, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x15, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x15, 0x01, 0x08, 0x08, "Easy" }, + {0x15, 0x01, 0x08, 0x00, "Hard" }, +}; + +STDDIPINFO(Pushman) + +static struct BurnDIPInfo BballsDIPList[]= +{ + {0x12, 0xff, 0xff, 0xcf, NULL }, + {0x13, 0xff, 0xff, 0xfd, NULL }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x12, 0x01, 0x07, 0x00, "5 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x03, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x12, 0x01, 0x08, 0x08, "Easy" }, + {0x12, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2, "Music (In-game)" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Music (Attract Mode)" }, + {0x12, 0x01, 0x20, 0x20, "Off" }, + {0x12, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0xc0, 0xc0, "1" }, + {0x12, 0x01, 0xc0, 0x80, "2" }, + {0x12, 0x01, 0xc0, 0x40, "3" }, + {0x12, 0x01, 0xc0, 0x00, "4" }, + + {0 , 0xfe, 0 , 2, "Zaps" }, + {0x13, 0x01, 0x01, 0x01, "1" }, + {0x13, 0x01, 0x01, 0x00, "2" }, + + {0 , 0xfe, 0 , 2, "Display Next Ball" }, + {0x13, 0x01, 0x02, 0x02, "No" }, + {0x13, 0x01, 0x02, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 3, "Service Mode" }, + {0x13, 0x01, 0xc0, 0xc0, "Off" }, + {0x13, 0x01, 0xc0, 0x40, "Inputs/Outputs" }, + {0x13, 0x01, 0xc0, 0x00, "Graphics" }, +}; + +STDDIPINFO(Bballs) + +void __fastcall pushman_main_write_word(UINT32 address, UINT16 data) +{ + if (address & 0xf00000) { + SekWriteWord(address & 0xfffff, data); + return; + } + + switch (address) + { + case 0x060000: + case 0x060002: + case 0x060004: + case 0x060006: + { + INT32 offset = address & 0x06; + + DrvShareRAM[offset + 0] = data >> 8; + DrvShareRAM[offset + 1] = data; + + if (no_mcu) { + if(offset == 0) { + latch = 0; + if (DrvShareRAM[0] <= 0xf) latch = DrvShareRAM[0] << 2; + if (DrvShareRAM[1]) latch |= 2; + new_latch = 1; + } + } else { + if (offset == 2) { + m68705SetIrqLine(0, 1); + m6805Run(0); + m68705SetIrqLine(0, 0); + new_latch = 0; + } + } + } + return; + + case 0x0e8000: + case 0x0e8002: + DrvScroll[(address >> 1) & 1] = data; + return; + } +} + +void __fastcall pushman_main_write_byte(UINT32 address, UINT8 data) +{ + if (address & 0xf00000) { + SekWriteByte(address & 0xfffff, data); + return; + } + + switch (address) + { + case 0x0e4000: + *flipscreen = data & 0x02; + return; + + case 0x0e4002: + *soundlatch = data; + return; + } +} + +UINT16 __fastcall pushman_main_read_word(UINT32 address) +{ + if (address & 0xf00000) { + return SekReadWord(address & 0xfffff); + } + + switch (address) + { + case 0x060000: + return latch; + + case 0x060002: + case 0x060004: + return ((DrvShareRAM[(address & 0x06) + 1] << 8) | DrvShareRAM[(address & 0x06)]); + + case 0x060006: + if ( new_latch) { new_latch = 0; return 0; } + if (!new_latch) return 0xff; + + case 0x0e4000: + return DrvInputs[0]; + + case 0x0e4002: + return DrvInputs[1] ^ vblank; + + case 0x0e4004: + return (DrvDips[1] << 8) | DrvDips[0]; + } + + return 0; +} + +UINT8 __fastcall pushman_main_read_byte(UINT32 address) +{ + if (address & 0xf00000) { + return SekReadByte(address & 0xfffff); + } + + switch (address) + { + case 0x0e4002: + return (DrvInputs[1] ^ vblank) >> 8; + } + + return 0; +} + + +void __fastcall pushman_sound_out_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + BurnYM2203Write(0, port & 1, data); + return; + + case 0x80: + case 0x81: + BurnYM2203Write(1, port & 1, data); + return; + } +} + +UINT8 __fastcall pushman_sound_read(UINT16 address) +{ + if (address == 0xe000) return *soundlatch; + + return 0; +} + +void pushman_mcu_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x0002: + { + if (~DrvShareRAM[2] & 0x02 && data & 0x02) { + latch = (DrvShareRAM[1] << 8) | DrvShareRAM[0]; + new_latch = 1; + } + DrvShareRAM[address] = data; + } + return; + + case 0x0000: + case 0x0001: + case 0x0003: + case 0x0004: + case 0x0005: + case 0x0006: + case 0x0007: + DrvShareRAM[address] = data; + return; + } +} + +UINT8 pushman_mcu_read(UINT16 address) +{ + switch (address) + { + case 0x0000: + case 0x0001: + case 0x0002: + case 0x0003: + case 0x0004: + case 0x0005: + case 0x0006: + case 0x0007: + return DrvShareRAM[address]; + } + + return 0; +} + +static void DrvIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000.0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + +// m6805Open(0); + m68705Reset(); +// m6805Close(); + + BurnYM2203Reset(); + + latch = 0x400; // bballs + new_latch = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x020000; + DrvZ80ROM = Next; Next += 0x010000; + DrvMcuROM = Next; Next += 0x001000; + + DrvGfxROM0 = Next; Next += 0x020000; + DrvGfxROM1 = Next; Next += 0x080000; + DrvGfxROM2 = Next; Next += 0x080000; + DrvGfxROM3 = Next; Next += 0x010000; + + DrvPalette = (UINT32*)Next; Next += 0x0240 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x004000; + DrvPalRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x001000; + DrvVidRAM = Next; Next += 0x000800; + DrvZ80RAM = Next; Next += 0x000800; + DrvMcuRAM = Next; Next += 0x000080; + + DrvShareRAM = Next; Next += 0x000008; + + DrvScroll = (UINT16*)Next; Next += 0x000002 * sizeof(UINT16); + + soundlatch = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x000004, 0x000000, 0x100004, 0x100000 }; + INT32 Plane1[4] = { 0x000000, 0x080000, 0x100000, 0x180000 }; + INT32 XOffs0[32] = { 0x000, 0x001, 0x002, 0x003, 0x008, 0x009, 0x00a, 0x00b, + 0x200, 0x201, 0x202, 0x203, 0x208, 0x209, 0x20a, 0x20b, + 0x400, 0x401, 0x402, 0x403, 0x408, 0x409, 0x40a, 0x40b, + 0x600, 0x601, 0x602, 0x603, 0x608, 0x609, 0x60a, 0x60b }; + INT32 YOffs0[32] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, + 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0, + 0x100, 0x110, 0x120, 0x130, 0x140, 0x150, 0x160, 0x170, + 0x180, 0x190, 0x1a0, 0x1b0, 0x1c0, 0x1d0, 0x1e0, 0x1f0 }; + INT32 XOffs1[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087 }; + INT32 YOffs1[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, + 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x08000); + + GfxDecode(0x0800, 2, 8, 8, Plane0, XOffs0, YOffs0, 0x080, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x40000); + + GfxDecode(0x0800, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x40000); + + GfxDecode(0x0200, 4, 32, 32, Plane0, XOffs0, YOffs0, 0x800, tmp, DrvGfxROM2); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x00001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x00000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x00000, 2, 1)) return 1; + + BurnLoadRom(DrvMcuROM + 0x00000, 3, 1); + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x10000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x20000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x30000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x10000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x20000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x30000, 12, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x00000, 13, 1)) return 1; + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x01ffff, SM_ROM); + SekMapMemory(DrvSprRAM, 0x0e0800, 0x0e17ff, SM_RAM); + SekMapMemory(DrvVidRAM, 0x0ec000, 0x0ec7ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x0f8000, 0x0f87ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0fc000, 0x0fffff, SM_RAM); + SekSetWriteWordHandler(0, pushman_main_write_word); + SekSetWriteByteHandler(0, pushman_main_write_byte); + SekSetReadWordHandler(0, pushman_main_read_word); + SekSetReadByteHandler(0, pushman_main_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); + ZetSetReadHandler(pushman_sound_read); + ZetSetOutHandler(pushman_sound_out_port); + ZetClose(); + + m6805Init(1, 0x1000); +// m6805Open(0); + m6805MapMemory(DrvMcuRAM + 0x0000, 0x0010, 0x007f, M6805_RAM); + m6805MapMemory(DrvMcuROM + 0x0080, 0x0080, 0x0fff, M6805_ROM); + m6805SetWriteHandler(pushman_mcu_write); + m6805SetReadHandler(pushman_mcu_read); +// m6805Close(); + + BurnYM2203Init(2, 2000000, &DrvIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2203SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + SekExit(); + ZetExit(); + m6805Exit(); + + BurnYM2203Exit(); + + BurnFree (AllMem); + + no_mcu = 0; + + return 0; +} + +static void draw_background() +{ + INT32 scrollx = DrvScroll[0] & 0xfff; + INT32 scrolly = (0xf00 - DrvScroll[1] + 16) & 0x7ff; + + for (INT32 offs = 0; offs < 128 * 64; offs++) + { + INT32 col = offs & 0x7f; + INT32 row = offs >> 7; + + INT32 sy = (row << 5) - scrolly; + if (sy < -31) sy += 0x0800; + + INT32 sx = (col << 5) - scrollx; + if (sx < -31) sx += 0x1000; + + if (sy >= nScreenHeight || sx >= nScreenWidth) continue; + + INT32 ofst = (col & 7) + ((~row & 7) << 3) + ((col & 0x78) << 3) + ((~row&0x38)<<7); + + INT32 attr = DrvGfxROM3[ofst * 2 + 0] | (DrvGfxROM3[ofst * 2 + 1] << 8); + INT32 code = (attr & 0xff) | ((attr & 0x4000) >> 6); + INT32 color = (attr >> 8) & 0x0f; + INT32 flipx = (attr & 0x2000); + + if (flipx) { + Render32x32Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM2); + } else { + Render32x32Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM2); + } + } +} + +static void draw_foreground() +{ + UINT16 *vram = (UINT16*)DrvVidRAM; + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + sy -= 16; + if (sy < 0 || sy >= nScreenHeight) continue; + + INT32 attr = vram[offs]; + INT32 code = (attr & 0xff) | ((attr & 0xc000) >> 6) | ((attr & 0x2000) >> 3); + INT32 color = (attr >> 8) & 0x0f; + INT32 flipy = (attr & 0x1000); + + if (flipy) { + Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 2, 3, 0x200, DrvGfxROM0); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 2, 3, 0x200, DrvGfxROM0); + } + } +} + +static void draw_sprites() +{ + UINT16 *vram = (UINT16*)DrvSprRAM; + + for (INT32 offs = 0x0800-4; offs >= 0; offs -= 4) + { + INT32 x = vram[offs + 3] & 0x1ff; + if (x == 0x180) continue; + + if (x > 0xff) x=0-(0x200-x); + + INT32 y = 240-vram[offs + 2]; + INT32 color = (vram[offs + 1] >> 2) & 0xf; + INT32 code = vram[offs + 0] & 0x7ff; + + INT32 flipx = vram[offs + 1] & 2; + INT32 flipy = vram[offs + 1] & 1; + + if (*flipscreen) + { + x = 240 - x; + y = 240 - y; + flipx = !flipx; + flipy = !flipy; + } + + y -= 16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y, color, 4, 15, 0x100, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y, color, 4, 15, 0x100, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, color, 4, 15, 0x100, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, color, 4, 15, 0x100, DrvGfxROM1); + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0x200 / 2; i < 0x680 / 2; i++) { + r = (p[i] >> 8) & 0x0f; + g = (p[i] >> 4) & 0x0f; + b = (p[i] >> 0) & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + DrvPalette[i - 0x100] = BurnHighCol(r, g, b, 0); + } + } + + draw_background(); + draw_sprites(); + draw_foreground(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + memset (DrvInputs, 0xff, 2 * sizeof(INT16)); + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + SekOpen(0); + ZetOpen(0); +// m6805Open(0); + + INT32 nInterleave = 256; + INT32 nCyclesTotal[3] = { 8000000 / 60, 4000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + + vblank = 0; + + for (INT32 i = 0; i < nInterleave; i++) + { + if (i == 16) vblank = 0x0400; + if (i == 240) vblank = 0; + + INT32 segment = nCyclesTotal[0] / nInterleave; + + nCyclesDone[0] += SekRun(segment); + if (i == (nInterleave - 1)) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + + if (no_mcu == 0) { + nCyclesDone[1] += m6805Run(segment / 2); + } + + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + } + + if (pBurnSoundOut) { + BurnTimerEndFrame(nCyclesTotal[1]); + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + } + +// m6805Close(); + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029707; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + m6805Scan(nAction, 0); + + BurnYM2203Scan(nAction, pnMin); + + SCAN_VAR(new_latch); + SCAN_VAR(latch); + } + + return 0; +} + + +// Pushman (Korea, set 1) + +static struct BurnRomInfo pushmanRomDesc[] = { + { "pushman.012", 0x10000, 0x330762bc, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "pushman.011", 0x10000, 0x62636796, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "pushman.013", 0x08000, 0xadfe66c1, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "pushman68705r3p.ic23",0x01000, 0xd7916657, 3 | BRF_PRG | BRF_ESS }, // 3 M68705 MCU Code + + { "pushman.001", 0x08000, 0x626e5865, 4 | BRF_GRA }, // 4 Characters + + { "pushman.004", 0x10000, 0x87aafa70, 5 | BRF_GRA }, // 5 Sprites + { "pushman.005", 0x10000, 0x7fd1200c, 5 | BRF_GRA }, // 6 + { "pushman.002", 0x10000, 0x0a094ab0, 5 | BRF_GRA }, // 7 + { "pushman.003", 0x10000, 0x73d1f29d, 5 | BRF_GRA }, // 8 + + { "pushman.006", 0x10000, 0x48ef3da6, 6 | BRF_GRA }, // 9 Tiles + { "pushman.008", 0x10000, 0x4b6a3e88, 6 | BRF_GRA }, // 10 + { "pushman.007", 0x10000, 0xb70020bd, 6 | BRF_GRA }, // 11 + { "pushman.009", 0x10000, 0xcc555667, 6 | BRF_GRA }, // 12 + + { "pushman.010", 0x08000, 0xa500132d, 7 | BRF_GRA }, // 13 Tilemap + + { "n82s129an.ic82", 0x00100, 0xec80ae36, 0 | BRF_GRA }, // 14 Prom +}; + +STD_ROM_PICK(pushman) +STD_ROM_FN(pushman) + +struct BurnDriver BurnDrvPushman = { + "pushman", NULL, NULL, NULL, "1990", + "Pushman (Korea, set 1)\0", NULL, "Comad", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, pushmanRomInfo, pushmanRomName, NULL, NULL, PushmanInputInfo, PushmanDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, + 256, 224, 4, 3 +}; + + +// Pushman (Korea, set 2) + +static struct BurnRomInfo pushmanaRomDesc[] = { + { "pushmana.212", 0x10000, 0x871d0858, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "pushmana.011", 0x10000, 0xae57761e, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "pushman.013", 0x08000, 0xadfe66c1, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "pushman68705r3p.ic23",0x01000, 0xd7916657, 3 | BRF_PRG | BRF_ESS }, // 3 M68705 MCU Code + + { "pushmana.130", 0x10000, 0xf83f92e7, 4 | BRF_GRA }, // 4 Characters + + { "pushman.004", 0x10000, 0x87aafa70, 5 | BRF_GRA }, // 5 Sprites + { "pushman.005", 0x10000, 0x7fd1200c, 5 | BRF_GRA }, // 6 + { "pushman.002", 0x10000, 0x0a094ab0, 5 | BRF_GRA }, // 7 + { "pushman.003", 0x10000, 0x73d1f29d, 5 | BRF_GRA }, // 8 + + { "pushman.006", 0x10000, 0x48ef3da6, 6 | BRF_GRA }, // 9 Tiles + { "pushman.008", 0x10000, 0x4b6a3e88, 6 | BRF_GRA }, // 10 + { "pushman.007", 0x10000, 0xb70020bd, 6 | BRF_GRA }, // 11 + { "pushman.009", 0x10000, 0xcc555667, 6 | BRF_GRA }, // 12 + + { "pushmana.189", 0x10000, 0x59f25598, 7 | BRF_GRA }, // 13 Tilemap + + { "n82s129an.ic82", 0x000100, 0xec80ae36, 0 | BRF_GRA }, // 14 Prom +}; + +STD_ROM_PICK(pushmana) +STD_ROM_FN(pushmana) + +struct BurnDriver BurnDrvPushmana = { + "pushmana", "pushman", NULL, NULL, "1990", + "Pushman (Korea, set 2)\0", NULL, "Comad", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, pushmanaRomInfo, pushmanaRomName, NULL, NULL, PushmanInputInfo, PushmanDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, + 256, 224, 4, 3 +}; + + +// Pushman (American Sammy license) + +static struct BurnRomInfo pushmansRomDesc[] = { + { "pman-12.ic212", 0x10000, 0x4251109d, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "pman-11.ic197", 0x10000, 0x1167ed9f, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "pman-13.ic216", 0x08000, 0xbc03827a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "pushman68705r3p.ic23",0x01000, 0xd7916657, 3 | BRF_PRG | BRF_ESS }, // 3 M68705 MCU Code + + { "pman-1.ic130", 0x08000, 0x14497754, 4 | BRF_GRA }, // 4 Characters + + { "pman-4.ic58", 0x10000, 0x16e5ce6b, 5 | BRF_GRA }, // 5 Sprites + { "pman-5.ic59", 0x10000, 0xb82140b8, 5 | BRF_GRA }, // 6 + { "pman-2.56", 0x10000, 0x2cb2ac29, 5 | BRF_GRA }, // 7 + { "pman-3.57", 0x10000, 0x8ab957c8, 5 | BRF_GRA }, // 8 + + { "pman-6.ic131", 0x10000, 0xbd0f9025, 6 | BRF_GRA }, // 9 Tiles + { "pman-8.ic148", 0x10000, 0x591bd5c0, 6 | BRF_GRA }, // 10 + { "pman-7.ic132", 0x10000, 0x208cb197, 6 | BRF_GRA }, // 11 + { "pman-9.ic149", 0x10000, 0x77ee8577, 6 | BRF_GRA }, // 12 + + { "pman-10.ic189", 0x08000, 0x5f9ae9a1, 7 | BRF_GRA }, // 13 Tilemap + + { "n82s129an.ic82", 0x00100, 0xec80ae36, 0 | BRF_GRA }, // 14 Prom +}; + +STD_ROM_PICK(pushmans) +STD_ROM_FN(pushmans) + +struct BurnDriver BurnDrvPushmans = { + "pushmans", "pushman", NULL, NULL, "1990", + "Pushman (American Sammy license)\0", NULL, "Comad (American Sammy license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, pushmansRomInfo, pushmansRomName, NULL, NULL, PushmanInputInfo, PushmanDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, + 256, 224, 4, 3 +}; + + +// Bouncing Balls + +static struct BurnRomInfo bballsRomDesc[] = { + { "bb12.m17", 0x10000, 0x4501c245, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "bb11.l17", 0x10000, 0x55e45b60, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bb13.n4", 0x08000, 0x1ef78175, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "68705.uc", 0x01000, 0x00000000, 3 | BRF_PRG | BRF_NODUMP }, // 3 M68705 MCU Code + + { "bb1.g20", 0x08000, 0xb62dbcb8, 4 | BRF_GRA }, // 4 Characters + + { "bb4.d1", 0x10000, 0xb77de5f8, 5 | BRF_GRA }, // 5 Sprites + { "bb5.d2", 0x10000, 0xffffccbf, 5 | BRF_GRA }, // 6 + { "bb2.b1", 0x10000, 0xa5b13236, 5 | BRF_GRA }, // 7 + { "bb3.b2", 0x10000, 0xe35b383d, 5 | BRF_GRA }, // 8 + + { "bb6.h1", 0x10000, 0x0cada9ce, 6 | BRF_GRA }, // 9 Tiles + { "bb8.j1", 0x10000, 0xd55fe7c1, 6 | BRF_GRA }, // 10 + { "bb7.h2", 0x10000, 0xa352d53b, 6 | BRF_GRA }, // 11 + { "bb9.j2", 0x10000, 0x78d185ac, 6 | BRF_GRA }, // 12 + + { "bb10.l6", 0x08000, 0xd06498f9, 7 | BRF_GRA }, // 13 Tilemap + + { "bb_prom.e9", 0x00100, 0xec80ae36, 8 | BRF_OPT }, // 14 Priority +}; + +STD_ROM_PICK(bballs) +STD_ROM_FN(bballs) + +static INT32 bballsInit() +{ + no_mcu = 1; + + return DrvInit(); +} + +struct BurnDriver BurnDrvBballs = { + "bballs", NULL, NULL, NULL, "1991", + "Bouncing Balls\0", NULL, "Comad", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, bballsRomInfo, bballsRomName, NULL, NULL, BballsInputInfo, BballsDIPInfo, + bballsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x240, + 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_raiden.cpp b/src/burn/drv/pst90s/d_raiden.cpp index b5f89b062..ef1cbd249 100644 --- a/src/burn/drv/pst90s/d_raiden.cpp +++ b/src/burn/drv/pst90s/d_raiden.cpp @@ -1,1905 +1,1904 @@ -// Raiden (c) 1990 Seibu Kaihatsu -// driver by Oliver Bergmann, Bryan McPhail, Randy Mongenel - -// port to FB Alpha by OopsWare - - -#include "burnint.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "msm6295.h" -#include "nec_intf.h" - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *RomV30A; -static UINT8 *RomV30B; -static UINT8 *RomZ80; - -static UINT8 *RomGfx1; -static UINT8 *RomGfx2; -static UINT8 *RomGfx3; -static UINT8 *RomGfx4; - -static UINT8 *RamV30A; -static UINT8 *RamV30B; -static UINT8 *RamV30S; -static UINT8 *RamZ80; - -static UINT8 *RamSpr; -static UINT16 *RamFg; -static UINT16 *RamBg; -static UINT16 *RamTxt; -static UINT8 *RamPal; -static UINT8 *RamScroll; - -static UINT16 *RamCurPal; - -static UINT8 bRecalcPalette = 0; -static UINT8 DrvReset = 0; - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - -static UINT8 main2sub[2] = {0, 0}; -static UINT8 sub2main[2] = {0, 0}; -static INT32 main2sub_pending = 0; -static INT32 sub2main_pending = 0; -static UINT8 z80_irq1, z80_irq2; -static INT32 seibu_bank = 0; - -#define GAME_RAIDEN 0 -#define GAME_RAIDENA 1 -#define GAME_RAIDENK 2 -#define GAME_RAIDENU 3 -static INT32 game_drv; - -inline static UINT32 CalcCol(INT32 offs) -{ - // xxxxBBBBGGGGRRRR - INT32 nColour = RamPal[offs + 0] | (RamPal[offs + 1] << 8); - INT32 r, g, b; - - r = (nColour & 0x000F) << 4; // Red - r |= r >> 4; - g = (nColour & 0x00F0) >> 0; // Green - g |= g >> 4; - b = (nColour & 0x0F00) >> 4; // Blue - b |= b >> 4; - - return BurnHighCol(r, g, b, 0); -} - -static struct BurnInputInfo raidenInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, -}; - -STDINPUTINFO(raiden) - - -static struct BurnDIPInfo raidenDIPList[] = { - - // Defaults - {0x11, 0xFF, 0xFF, 0x00, NULL}, - {0x12, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, "Coin Mode"}, - {0x11, 0x01, 0x01, 0x00, "A"}, - {0x11, 0x01, 0x01, 0x01, "B"}, - {0, 0xFE, 0, 16, "Coinage"}, - {0x11, 0x01, 0x1E, 0x00, "1 coin 1 credit"}, - {0x11, 0x01, 0x1E, 0x02, "2 coins 1 credit"}, - {0x11, 0x01, 0x1E, 0x04, "3 coins 1 credit"}, - {0x11, 0x01, 0x1E, 0x06, "4 coins 1 credits"}, - {0x11, 0x01, 0x1E, 0x08, "5 coins 1 credit"}, - {0x11, 0x01, 0x1E, 0x0A, "6 coins 1 credit"}, - {0x11, 0x01, 0x1E, 0x0C, "1 coin 2 credits"}, - {0x11, 0x01, 0x1E, 0x0E, "1 coin 3 credits"}, - {0x11, 0x01, 0x1E, 0x10, "1 coin 4 credits"}, - {0x11, 0x01, 0x1E, 0x12, "1 coin 5 credits"}, - {0x11, 0x01, 0x1E, 0x14, "1 coin 6 credits"}, - {0x11, 0x01, 0x1E, 0x16, "2 coins 3 credits"}, - {0x11, 0x01, 0x1E, 0x18, "3 coins 2 credits"}, - {0x11, 0x01, 0x1E, 0x1A, "5 coins 3 credits"}, - {0x11, 0x01, 0x1E, 0x1C, "8 coins 3 credits"}, - {0x11, 0x01, 0x1E, 0x1E, "Free Play"}, - {0, 0xFE, 0, 2, "Credits to Start"}, - {0x11, 0x01, 0x20, 0x00, "1"}, - {0x11, 0x01, 0x20, 0x20, "2"}, - {0, 0xFE, 0, 2, "Flip Screen"}, - {0x11, 0x01, 0x80, 0x00, "Off"}, - {0x11, 0x01, 0x80, 0x80, "On"}, - - // DIP 2 - {0, 0xFE, 0, 4, "Lives"}, - {0x12, 0x01, 0x03, 0x00, "3"}, - {0x12, 0x01, 0x03, 0x01, "1"}, - {0x12, 0x01, 0x03, 0x02, "2"}, - {0x12, 0x01, 0x03, 0x03, "5"}, - {0, 0xFE, 0, 4, "Bonus Life"}, - {0x12, 0x01, 0x0c, 0x00, "150000 400000"}, - {0x12, 0x01, 0x0c, 0x04, "80000 300000"}, - {0x12, 0x01, 0x0c, 0x08, "300000 1000000"}, - {0x12, 0x01, 0x0c, 0x0c, "1000000 5000000"}, - {0, 0xFE, 0, 4, "Difficulty"}, - {0x12, 0x01, 0x30, 0x00, "Normal"}, - {0x12, 0x01, 0x30, 0x10, "Easy"}, - {0x12, 0x01, 0x30, 0x20, "Hard"}, - {0x12, 0x01, 0x30, 0x30, "Very Hard"}, - {0, 0xFE, 0, 2, "Allow Continue"}, - {0x12, 0x01, 0x40, 0x00, "Yes"}, - {0x12, 0x01, 0x40, 0x40, "No"}, - {0, 0xFE, 0, 2, "Demo sound"}, - {0x12, 0x01, 0x80, 0x00, "On"}, - {0x12, 0x01, 0x80, 0x80, "Off"}, -}; - -STDDIPINFO(raiden) - -static struct BurnRomInfo raidenRomDesc[] = { - { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 - { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, - { "3.u022", 0x020000, 0xf6af09d0, BRF_ESS | BRF_PRG }, - { "4j.u023", 0x020000, 0x505c4c5d, BRF_ESS | BRF_PRG }, - - { "5.u042", 0x020000, 0xed03562e, BRF_ESS | BRF_PRG }, // CPU 1, V30 - { "6.u043", 0x020000, 0xa19d5b5d, BRF_ESS | BRF_PRG }, - - { "8.u212", 0x010000, 0xcbe055c7, BRF_ESS | BRF_PRG }, // CPU 2, Z80 - - { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles - { "10", 0x008000, 0x5f90786a, BRF_GRA }, - { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, - { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, - { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, - - { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound -}; - -STD_ROM_PICK(raiden) -STD_ROM_FN(raiden) - -static struct BurnRomInfo raidenaRomDesc[] = { - { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 - { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, - { "3.u022", 0x020000, 0xf6af09d0, BRF_ESS | BRF_PRG }, - { "4.u023", 0x020000, 0x6bdfd416, BRF_ESS | BRF_PRG }, - - { "5.u042", 0x020000, 0xed03562e, BRF_ESS | BRF_PRG }, // CPU 1, V30 - { "6.u043", 0x020000, 0xa19d5b5d, BRF_ESS | BRF_PRG }, - - { "8.u212", 0x010000, 0xcbe055c7, BRF_ESS | BRF_PRG }, // CPU 2, Z80 - - { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles - { "10", 0x008000, 0x5f90786a, BRF_GRA }, - { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, - { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, - { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, - - { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound -}; - -STD_ROM_PICK(raidena) -STD_ROM_FN(raidena) - -static struct BurnRomInfo raidentRomDesc[] = { - { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 - { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, - { "3.u022", 0x020000, 0xf6af09d0, BRF_ESS | BRF_PRG }, - { "4t.u023", 0x020000, 0x61eefab1, BRF_ESS | BRF_PRG }, - - { "5.u042", 0x020000, 0xed03562e, BRF_ESS | BRF_PRG }, // CPU 1, V30 - { "6.u043", 0x020000, 0xa19d5b5d, BRF_ESS | BRF_PRG }, - - { "8.u212", 0x010000, 0xcbe055c7, BRF_ESS | BRF_PRG }, // CPU 2, Z80 - - { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles - { "10", 0x008000, 0x5f90786a, BRF_GRA }, - { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, - { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, - { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, - - { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound -}; - -STD_ROM_PICK(raident) -STD_ROM_FN(raident) - -static struct BurnRomInfo raidenuRomDesc[] = { - { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 - { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, - { "3a.u022", 0x020000, 0xa8fadbdd, BRF_ESS | BRF_PRG }, - { "4a.u023", 0x020000, 0xbafb268d, BRF_ESS | BRF_PRG }, - - { "5.u042", 0x020000, 0xed03562e, BRF_ESS | BRF_PRG }, // CPU 1, V30 - { "6.u043", 0x020000, 0xa19d5b5d, BRF_ESS | BRF_PRG }, - - { "8.u212", 0x010000, 0xcbe055c7, BRF_ESS | BRF_PRG }, // CPU 2, Z80 - - { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles - { "10", 0x008000, 0x5f90786a, BRF_GRA }, - { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, - { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, - { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, - - { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound -}; - -STD_ROM_PICK(raidenu) -STD_ROM_FN(raidenu) - -static struct BurnRomInfo raidenkRomDesc[] = { - { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 - { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, - { "3.u022", 0x020000, 0xf6af09d0, BRF_ESS | BRF_PRG }, - { "4k.u023", 0x020000, 0xfddf24da, BRF_ESS | BRF_PRG }, - - { "5.u042", 0x020000, 0xed03562e, BRF_ESS | BRF_PRG }, // CPU 1, V30 - { "6.u043", 0x020000, 0xa19d5b5d, BRF_ESS | BRF_PRG }, - - { "8b.u212", 0x010000, 0x99ee7505, BRF_ESS | BRF_PRG }, // CPU 2, Z80 - - { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles - { "10", 0x008000, 0x5f90786a, BRF_GRA }, - { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, - { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, - { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, - - { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound -}; - -STD_ROM_PICK(raidenk) -STD_ROM_FN(raidenk) - -static struct BurnRomInfo raidenbRomDesc[] = { - { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 - { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, - { "3__(raidenb).u022", 0x020000, 0x9d735bf5, BRF_ESS | BRF_PRG }, - { "4__(raidenb).u023", 0x020000, 0x8d184b99, BRF_ESS | BRF_PRG }, - - { "5__(raidenb).u042", 0x020000, 0x7aca6d61, BRF_ESS | BRF_PRG }, // CPU 1, V30 - { "6__(raidenb).u043", 0x020000, 0xe3d35cc2, BRF_ESS | BRF_PRG }, - - { "rai6.u212", 0x010000, 0x723a483b, BRF_ESS | BRF_PRG }, // CPU 2, Z80 - - { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles - { "10", 0x008000, 0x5f90786a, BRF_GRA }, - { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, - { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, - { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, - - { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound - - { "ep910pc-1.bin", 0x000884, 0x00000000, BRF_NODUMP }, - { "ep910pc-2.bin", 0x000884, 0x00000000, BRF_NODUMP }, -}; - -STD_ROM_PICK(raidenb) -STD_ROM_FN(raidenb) - -static struct BurnRomInfo raidenuaRomDesc[] = { - { "1.c8", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 - { "2.c7", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, - { "3dd.e8", 0x020000, 0xb6f3bad2, BRF_ESS | BRF_PRG }, - { "4dd.e7", 0x020000, 0xd294dfc1, BRF_ESS | BRF_PRG }, - - { "5.p8", 0x020000, 0x15c1cf45, BRF_ESS | BRF_PRG }, // CPU 1, V30 - { "6.p7", 0x020000, 0x261c381b, BRF_ESS | BRF_PRG }, - - { "8.w8", 0x010000, 0x105b9c11, BRF_ESS | BRF_PRG }, // CPU 2, Z80 - - { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles - { "10", 0x008000, 0x5f90786a, BRF_GRA }, - { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, - { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, - { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, - - { "7.x10", 0x010000, 0x2051263e, BRF_SND }, // Sound -}; - -STD_ROM_PICK(raidenua) -STD_ROM_FN(raidenua) - -static void update_irq_lines() -{ - if ((z80_irq1 & z80_irq2) == 0xff) - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - else - if (z80_irq2 == 0xdf) { // this shouldn't be required - ZetSetVector(z80_irq1 & z80_irq2); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } -} - -static UINT8 __fastcall seibu_main_v30_r(UINT32 offset) -{ - switch (offset) { - case 0x4: return sub2main[0]; - case 0x5: return 0; - - case 0x6: return sub2main[1]; - case 0x7: return 0; - - case 0xa: return main2sub_pending ? 1 : 0; - case 0xb: return 0; - default : return 0xff; - } -} - -static void __fastcall seibu_main_v30_w(UINT32 offset, UINT8 data) -{ - switch (offset) { - case 0x0: main2sub[0] = data; break; - case 0x2: main2sub[1] = data; break; - case 0x8: - z80_irq2 = 0xdf; - ZetOpen(0); - update_irq_lines(); - ZetClose(); - break; - case 0xc: - sub2main_pending = 0; - main2sub_pending = 1; - break; - } -} - -void raidenFMIRQHandler(INT32, INT32 nStatus) -{ - z80_irq1 = (nStatus) ? 0xd7 : 0xff; - update_irq_lines(); -} - -static void set_seibu_bank(INT32 bank) -{ - bank &= 1; - if (seibu_bank != bank) { - seibu_bank = bank; - ZetMapArea(0x8000, 0xFFFF, 0, RomZ80 + 0x8000 * (1-seibu_bank) ); - ZetMapArea(0x8000, 0xFFFF, 2, RomZ80 + 0x8000 * (1-seibu_bank) ); - } -} - -INT32 raidenSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3579545; -} - -UINT8 __fastcall raidenReadByte(UINT32 vezAddress) -{ - switch (vezAddress) { - case 0x0b000: return ~DrvInput[1]; - case 0x0b001: return ~DrvInput[2]; - case 0x0b002: return ~DrvInput[3]; - case 0x0b003: return ~DrvInput[4]; - - case 0x0d000: - case 0x0d001: - case 0x0d002: - case 0x0d003: - case 0x0d004: - case 0x0d005: - case 0x0d006: - case 0x0d007: - case 0x0d008: - case 0x0d009: - case 0x0d00a: - case 0x0d00b: - case 0x0d00c: - case 0x0d00d: return seibu_main_v30_r(vezAddress - 0x0d000); - - //default: - // bprintf(PRINT_NORMAL, _T("CPU #0 Attempt to read byte value of location %x\n"), vezAddress); - } - return 0; -} - -void __fastcall raidenWriteByte(UINT32 vezAddress, UINT8 byteValue) -{ - - switch (vezAddress) { - - case 0x0b000: - case 0x0b001: - case 0x0b002: - case 0x0b003: - case 0x0b004: - case 0x0b005: - case 0x0b006: - case 0x0b007: - // raiden_control_w - // flip_screen not support - break; - - case 0x0d060: - case 0x0d061: - case 0x0d062: - case 0x0d063: - case 0x0d064: - case 0x0d065: - case 0x0d066: - case 0x0d067: - RamScroll[ vezAddress - 0x0d060 ] = byteValue; - break; - - case 0x0d000: - case 0x0d001: - case 0x0d002: - case 0x0d003: - case 0x0d004: - case 0x0d005: - case 0x0d006: - case 0x0d007: - case 0x0d008: - case 0x0d009: - case 0x0d00a: - case 0x0d00b: - case 0x0d00c: - case 0x0d00d: - seibu_main_v30_w(vezAddress - 0x0d000, byteValue); - break; - //default: - // bprintf(PRINT_NORMAL, _T("CPU #0 Attempt to write byte value %x to location %x\n"), byteValue, vezAddress); - } -} - -UINT8 __fastcall raidenAltReadByte(UINT32 vezAddress) -{ - switch (vezAddress) { - case 0x0a000: - case 0x0a001: - case 0x0a002: - case 0x0a003: - case 0x0a004: - case 0x0a005: - case 0x0a006: - case 0x0a007: - case 0x0a008: - case 0x0a009: - case 0x0a00a: - case 0x0a00b: - case 0x0a00c: - case 0x0a00d: return seibu_main_v30_r(vezAddress - 0x0a000); - - case 0x0e000: return ~DrvInput[1]; - case 0x0e001: return ~DrvInput[2]; - case 0x0e002: return ~DrvInput[3]; - case 0x0e003: return ~DrvInput[4]; - - //default: - // bprintf(PRINT_NORMAL, _T("CPU #0 Attempt to read byte value of location %x\n"), vezAddress); - } - return 0; -} - -void __fastcall raidenAltWriteByte(UINT32 vezAddress, UINT8 byteValue) -{ - - switch (vezAddress) { - - case 0x0b000: - case 0x0b001: - case 0x0b002: - case 0x0b003: - case 0x0b004: - case 0x0b005: - case 0x0b006: - case 0x0b007: - // raiden_control_w - // flip_screen not support - break; - - case 0x0f002: RamScroll[0] = byteValue; break; - case 0x0f004: RamScroll[1] = byteValue; break; - case 0x0f012: RamScroll[2] = byteValue; break; - case 0x0f014: RamScroll[3] = byteValue; break; - case 0x0f022: RamScroll[4] = byteValue; break; - case 0x0f024: RamScroll[5] = byteValue; break; - case 0x0f032: RamScroll[6] = byteValue; break; - case 0x0f034: RamScroll[7] = byteValue; break; - - case 0x0a000: - case 0x0a001: - case 0x0a002: - case 0x0a003: - case 0x0a004: - case 0x0a005: - case 0x0a006: - case 0x0a007: - case 0x0a008: - case 0x0a009: - case 0x0a00a: - case 0x0a00b: - case 0x0a00c: - case 0x0a00d: - seibu_main_v30_w(vezAddress - 0x0a000, byteValue); - break; - //default: - // bprintf(PRINT_NORMAL, _T("CPU #0 Attempt to write byte value %x to location %x\n"), byteValue, vezAddress); - } -} - -void __fastcall raidenuWriteByte(UINT32 vezAddress, UINT8 byteValue) -{ - - switch (vezAddress) { - - case 0x0b000: - case 0x0b001: - case 0x0b002: - case 0x0b003: - case 0x0b004: - case 0x0b005: - case 0x0b006: - case 0x0b007: - // raiden_control_w - // flip_screen not support - break; - - case 0x08002: RamScroll[0] = byteValue; break; - case 0x08004: RamScroll[1] = byteValue; break; - case 0x08012: RamScroll[2] = byteValue; break; - case 0x08014: RamScroll[3] = byteValue; break; - case 0x08022: RamScroll[4] = byteValue; break; - case 0x08024: RamScroll[5] = byteValue; break; - case 0x08032: RamScroll[6] = byteValue; break; - case 0x08034: RamScroll[7] = byteValue; break; - - case 0x0d000: - case 0x0d001: - case 0x0d002: - case 0x0d003: - case 0x0d004: - case 0x0d005: - case 0x0d006: - case 0x0d007: - case 0x0d008: - case 0x0d009: - case 0x0d00a: - case 0x0d00b: - case 0x0d00c: - case 0x0d00d: - seibu_main_v30_w(vezAddress - 0x0d000, byteValue); - break; - //default: - // bprintf(PRINT_NORMAL, _T("CPU #0 Attempt to write byte value %x to location %x\n"), byteValue, vezAddress); - } -} - -UINT8 __fastcall raidenSubReadByte(UINT32 vezAddress) -{ - switch (vezAddress) { - case 0x04008: { - UINT8 nRet = RamV30S[0x8]; - //INT32 pc = VezPC(); - //if (pc==0xfcde6 && ret!=0x40) cpu_spin(); - bprintf(PRINT_NORMAL, _T("sub_cpu_spin_r %02x%02x\n"), RamV30S[0x8], RamV30S[0x9]); - return nRet; } - case 0x04009: - bprintf(PRINT_NORMAL, _T("sub_cpu_spin_r %02x%02x\n"), RamV30S[0x8], RamV30S[0x9]); - return RamV30S[0x9]; - - //default: - // bprintf(PRINT_NORMAL, _T("CPU #1 Attempt to read byte value of location %x\n"), vezAddress); - } - return 0; -} - -void __fastcall raidenSubWriteByte(UINT32 vezAddress, UINT8 byteValue) -{ - if ((vezAddress & 0xFF000) == 0x03000 ) { - vezAddress -= 0x03000; - RamPal[ vezAddress ] = byteValue; - if (vezAddress & 1) - RamCurPal[ vezAddress >> 1 ] = CalcCol( vezAddress - 1 ); - return; - } - -// switch (vezAddress) { -// default: -// bprintf(PRINT_NORMAL, _T("CPU #1 Attempt to write byte value %x to location %x\n"), byteValue, vezAddress); -// } - -} - -UINT8 __fastcall raidenuSubReadByte(UINT32 vezAddress) -{ - switch (vezAddress) { - case 0x08008: { - UINT8 nRet = RamV30S[0x8]; - //INT32 pc = VezPC(); - //if (pc==0xfcde6 && ret!=0x40) cpu_spin(); - bprintf(PRINT_NORMAL, _T("sub_cpu_spin_r %02x%02x\n"), RamV30S[0x8], RamV30S[0x9]); - return nRet; } - case 0x08009: - bprintf(PRINT_NORMAL, _T("sub_cpu_spin_r %02x%02x\n"), RamV30S[0x8], RamV30S[0x9]); - return RamV30S[0x9]; - - //default: - // bprintf(PRINT_NORMAL, _T("CPU #1 Attempt to read byte value of location %x\n"), vezAddress); - } - return 0; -} - -void __fastcall raidenuSubWriteByte(UINT32 vezAddress, UINT8 byteValue) -{ - if ((vezAddress & 0xFF000) == 0x07000 ) { - vezAddress -= 0x07000; - RamPal[ vezAddress ] = byteValue; - if (vezAddress & 1) - RamCurPal[ vezAddress >> 1 ] = CalcCol( vezAddress - 1 ); - return; - } - -// switch (vezAddress) { -// default: -// bprintf(PRINT_NORMAL, _T("CPU #1 Attempt to write byte value %x to location %x\n"), byteValue, vezAddress); -// } - -} - -UINT8 __fastcall raidenZ80Read(UINT16 a) -{ - switch (a) { - case 0x4008: return BurnYM3812Read(0); - case 0x4010: return main2sub[0]; - case 0x4011: return main2sub[1]; - case 0x4012: return sub2main_pending ? 1 : 0; - case 0x4013: return DrvInput[0]; - case 0x6000: return MSM6295ReadStatus(0); -// default: -// bprintf(PRINT_NORMAL, _T("Z80 Attempt to read word value of location %04x\n"), a); - } - return 0; -} - - -void __fastcall raidenZ80Write(UINT16 a,UINT8 v) -{ - switch (a) { - case 0x4000: - // just a guess - main2sub_pending = 0; - sub2main_pending = 1; - break; - case 0x4001: - // seibu_irq_clear_w - z80_irq1 = 0xff; - z80_irq2 = 0xff; - update_irq_lines(); - break; - case 0x4002: - // seibu_rst10_ack_w - break; - case 0x4003: - // seibu_rst18_ack_w - z80_irq2 = 0xff; - update_irq_lines(); - break; - case 0x4007: - // seibu_bank_w - set_seibu_bank(v); - break; - case 0x4008: - // YM3812_control_port_0_w - BurnYM3812Write(0, v); - break; - case 0x4009: - // YM3812_write_port_0_w - BurnYM3812Write(1, v); - break; - case 0x4018: - sub2main[0] = v; - break; - case 0x4019: - sub2main[1] = v; - break; - case 0x401b: - // seibu_coin_w - //bprintf(PRINT_NORMAL, _T("seibu_coin_w(%02x)\n"), v); - break; - case 0x6000: - // OKIM6295_data_0_w - MSM6295Command(0, v); - break; - //default: - // bprintf(PRINT_NORMAL, _T("Z80 Attempt to write word value %x to location %x\n"), v, a); - } -} - -static INT32 DrvDoReset() -{ - - VezOpen(0); - VezReset(); - VezClose(); - - VezOpen(1); - VezReset(); - VezClose(); - - seibu_bank = -1; - - ZetOpen(0); - set_seibu_bank(0); - ZetReset(); - z80_irq1 = 0xff; - z80_irq2 = 0xff; - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - MSM6295Reset(0); - BurnYM3812Reset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - RomV30A = Next; Next += 0x060000; // V30 main cpu - RomV30B = Next; Next += 0x040000; // V30 sub cpu - RomZ80 = Next; Next += 0x020000; // Z80 sound cpu - - RomGfx1 = Next; Next += 0x020000; // char - RomGfx2 = Next; Next += 0x100000; // tile 1 - RomGfx3 = Next; Next += 0x100000; // tile 2 - RomGfx4 = Next; Next += 0x100000; // spr - - MSM6295ROM = Next; Next += 0x010000; - - RamStart = Next; - - RamV30A = Next; Next += 0x007000; - RamV30B = Next; Next += 0x006000; - RamV30S = Next; Next += 0x001000; - RamZ80 = Next; Next += 0x000800; - - RamSpr = Next; Next += 0x001000; - RamFg = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); - RamBg = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); - RamTxt = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); - - RamPal = Next; Next += 0x001000; - RamScroll = Next; Next += 0x000008; - - RamEnd = Next; - - RamCurPal = (UINT16 *) Next; Next += 0x000800 * sizeof(UINT16); - - MemEnd = Next; - return 0; -} - -void decode_gfx_1(UINT8 * dst, UINT8 * src) -{ - for(INT32 i=0;i<0x10000/32;i++) { - for (INT32 j=0;j<8;j++) { - - dst[0] = (((src[0] >> 7) & 1) << 2) | (((src[0] >> 3) & 1) << 3) | (((src[0x8000] >> 7) & 1) << 0) | (((src[0x8000] >> 3) & 1) << 1); - dst[1] = (((src[0] >> 6) & 1) << 2) | (((src[0] >> 2) & 1) << 3) | (((src[0x8000] >> 6) & 1) << 0) | (((src[0x8000] >> 2) & 1) << 1); - dst[2] = (((src[0] >> 5) & 1) << 2) | (((src[0] >> 1) & 1) << 3) | (((src[0x8000] >> 5) & 1) << 0) | (((src[0x8000] >> 1) & 1) << 1); - dst[3] = (((src[0] >> 4) & 1) << 2) | (((src[0] >> 0) & 1) << 3) | (((src[0x8000] >> 4) & 1) << 0) | (((src[0x8000] >> 0) & 1) << 1); - dst[4] = (((src[1] >> 7) & 1) << 2) | (((src[1] >> 3) & 1) << 3) | (((src[0x8001] >> 7) & 1) << 0) | (((src[0x8001] >> 3) & 1) << 1); - dst[5] = (((src[1] >> 6) & 1) << 2) | (((src[1] >> 2) & 1) << 3) | (((src[0x8001] >> 6) & 1) << 0) | (((src[0x8001] >> 2) & 1) << 1); - dst[6] = (((src[1] >> 5) & 1) << 2) | (((src[1] >> 1) & 1) << 3) | (((src[0x8001] >> 5) & 1) << 0) | (((src[0x8001] >> 1) & 1) << 1); - dst[7] = (((src[1] >> 4) & 1) << 2) | (((src[1] >> 0) & 1) << 3) | (((src[0x8001] >> 4) & 1) << 0) | (((src[0x8001] >> 0) & 1) << 1); - - src += 2; - dst += 8; - } - } -} - -void decode_gfx_2(UINT8 * dst, UINT8 * src) -{ - for(INT32 i=0;i<0x80000/128;i++) { - for (INT32 j=0;j<16;j++) { - - dst[ 0] = (((src[ 1] >> 7) & 1) << 2) | (((src[ 1] >> 3) & 1) << 3) | (((src[ 0] >> 7) & 1) << 0) | (((src[ 0] >> 3) & 1) << 1); - dst[ 1] = (((src[ 1] >> 6) & 1) << 2) | (((src[ 1] >> 2) & 1) << 3) | (((src[ 0] >> 6) & 1) << 0) | (((src[ 0] >> 2) & 1) << 1); - dst[ 2] = (((src[ 1] >> 5) & 1) << 2) | (((src[ 1] >> 1) & 1) << 3) | (((src[ 0] >> 5) & 1) << 0) | (((src[ 0] >> 1) & 1) << 1); - dst[ 3] = (((src[ 1] >> 4) & 1) << 2) | (((src[ 1] >> 0) & 1) << 3) | (((src[ 0] >> 4) & 1) << 0) | (((src[ 0] >> 0) & 1) << 1); - dst[ 4] = (((src[ 3] >> 7) & 1) << 2) | (((src[ 3] >> 3) & 1) << 3) | (((src[ 2] >> 7) & 1) << 0) | (((src[ 2] >> 3) & 1) << 1); - dst[ 5] = (((src[ 3] >> 6) & 1) << 2) | (((src[ 3] >> 2) & 1) << 3) | (((src[ 2] >> 6) & 1) << 0) | (((src[ 2] >> 2) & 1) << 1); - dst[ 6] = (((src[ 3] >> 5) & 1) << 2) | (((src[ 3] >> 1) & 1) << 3) | (((src[ 2] >> 5) & 1) << 0) | (((src[ 2] >> 1) & 1) << 1); - dst[ 7] = (((src[ 3] >> 4) & 1) << 2) | (((src[ 3] >> 0) & 1) << 3) | (((src[ 2] >> 4) & 1) << 0) | (((src[ 2] >> 0) & 1) << 1); - - dst[ 8] = (((src[65] >> 7) & 1) << 2) | (((src[65] >> 3) & 1) << 3) | (((src[64] >> 7) & 1) << 0) | (((src[64] >> 3) & 1) << 1); - dst[ 9] = (((src[65] >> 6) & 1) << 2) | (((src[65] >> 2) & 1) << 3) | (((src[64] >> 6) & 1) << 0) | (((src[64] >> 2) & 1) << 1); - dst[10] = (((src[65] >> 5) & 1) << 2) | (((src[65] >> 1) & 1) << 3) | (((src[64] >> 5) & 1) << 0) | (((src[64] >> 1) & 1) << 1); - dst[11] = (((src[65] >> 4) & 1) << 2) | (((src[65] >> 0) & 1) << 3) | (((src[64] >> 4) & 1) << 0) | (((src[64] >> 0) & 1) << 1); - dst[12] = (((src[67] >> 7) & 1) << 2) | (((src[67] >> 3) & 1) << 3) | (((src[66] >> 7) & 1) << 0) | (((src[66] >> 3) & 1) << 1); - dst[13] = (((src[67] >> 6) & 1) << 2) | (((src[67] >> 2) & 1) << 3) | (((src[66] >> 6) & 1) << 0) | (((src[66] >> 2) & 1) << 1); - dst[14] = (((src[67] >> 5) & 1) << 2) | (((src[67] >> 1) & 1) << 3) | (((src[66] >> 5) & 1) << 0) | (((src[66] >> 1) & 1) << 1); - dst[15] = (((src[67] >> 4) & 1) << 2) | (((src[67] >> 0) & 1) << 3) | (((src[66] >> 4) & 1) << 0) | (((src[66] >> 0) & 1) << 1); - - - src += 4; - dst += 16; - } - src += 64; - } -} - -static void common_decrypt() -{ - UINT8 *RAM = RomV30A; - INT32 i; - UINT8 a; - - static const UINT8 xor_table[4][16]={ - {0xF1,0xF9,0xF5,0xFD,0xF1,0xF1,0x3D,0x3D,0x73,0xFB,0x77,0xFF,0x73,0xF3,0x3F,0x3F}, // rom 3 - {0xDF,0xFF,0xFF,0xFF,0xDB,0xFF,0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0xFF,0xFB,0xFF}, // rom 4 - {0x7F,0x7F,0xBB,0x77,0x77,0x77,0xBE,0xF6,0x7F,0x7F,0xBB,0x77,0x77,0x77,0xBE,0xF6}, // rom 5 - {0xFF,0xFF,0xFD,0xFD,0xFD,0xFD,0xEF,0xEF,0xFF,0xFF,0xFD,0xFD,0xFD,0xFD,0xEF,0xEF} // rom 6 - }; - - // Rom 3 - main cpu even bytes - for (i=0x20000; i<0x60000; i+=2) { - a=RAM[i]; - a^=xor_table[0][(i/2) & 0x0f]; - a^=0xff; - a=(a & 0x31) | ((a<<1) & 0x04) | ((a>>5) & 0x02) | ((a<<4) & 0x40) | ((a<<4) & 0x80) | ((a>>4) & 0x08); - RAM[i]=a; - } - - // Rom 4 - main cpu odd bytes - for (i=0x20001; i<0x60000; i+=2) { - a=RAM[i]; - a^=xor_table[1][(i/2) & 0x0f]; - a^=0xff; - a=(a & 0xdb) | ((a>>3) & 0x04) | ((a<<3) & 0x20); - RAM[i]=a; - } - - RAM = RomV30B; - - // Rom 5 - sub cpu even bytes - for (i=0x00000; i<0x40000; i+=2) { - a=RAM[i]; - a^=xor_table[2][(i/2) & 0x0f]; - a^=0xff; - a=(a & 0x32) | ((a>>1) & 0x04) | ((a>>4) & 0x08) | ((a<<5) & 0x80) | ((a>>6) & 0x01) | ((a<<6) & 0x40); - RAM[i]=a; - } - - // Rom 6 - sub cpu odd bytes - for (i=0x00001; i<0x40000; i+=2) { - a=RAM[i]; - a^=xor_table[3][(i/2) & 0x0f]; - a^=0xff; - a=(a & 0xed) | ((a>>3) & 0x02) | ((a<<3) & 0x10); - RAM[i]=a; - } -} - -#define BIT(x,n) (((x)>>(n))&1) - -#define BITSWAP8(val,B7,B6,B5,B4,B3,B2,B1,B0) \ - ((BIT(val,B7) << 7) | \ - (BIT(val,B6) << 6) | \ - (BIT(val,B5) << 5) | \ - (BIT(val,B4) << 4) | \ - (BIT(val,B3) << 3) | \ - (BIT(val,B2) << 2) | \ - (BIT(val,B1) << 1) | \ - (BIT(val,B0) << 0)) - -static UINT8 decrypt_data(INT32 a,UINT8 src) -{ - if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; - if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; - if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; - if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; - if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; - - if (BIT(a,13) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,3,2,0,1); - if (BIT(a, 8) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,2,3,1,0); - - return src; -} - -static UINT8 decrypt_opcode(INT32 a,UINT8 src) -{ - if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; - if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; - if (~BIT(a,13) & BIT(a,12)) src ^= 0x20; - if (~BIT(a,6) & BIT(a,1)) src ^= 0x10; - if (~BIT(a,12) & BIT(a,2)) src ^= 0x08; - if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; - if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; - if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; - - if (BIT(a,13) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,3,2,0,1); - if (BIT(a, 8) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,2,3,1,0); - if (BIT(a,12) & BIT(a,9)) src = BITSWAP8(src,7,6,4,5,3,2,1,0); - if (BIT(a,11) & ~BIT(a,6)) src = BITSWAP8(src,6,7,5,4,3,2,1,0); - - return src; -} - -void seibu_sound_decrypt() -{ - for (INT32 i=0; i<0x10000;i++) { - UINT8 src = RomZ80[i]; - RomZ80[i+0x00000] = decrypt_data(i,src); - RomZ80[i+0x10000] = decrypt_opcode(i,src); - } -} - -static INT32 DrvInit() -{ - INT32 nRet; - - if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raiden") == 0 ) - game_drv = GAME_RAIDEN; - else - if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raidena") == 0 ) - game_drv = GAME_RAIDEN; - else - if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raidenk") == 0 ) - game_drv = GAME_RAIDENK; - else - if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raident") == 0 ) - game_drv = GAME_RAIDEN; - else - if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raidenu") == 0 ) - game_drv = GAME_RAIDEN; - else - if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raidenb") == 0 ) - game_drv = GAME_RAIDENA; - else - if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raidenua") == 0 ) - game_drv = GAME_RAIDENU; - else - return 1; - - Mem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); // blank all memory - MemIndex(); - - nRet = BurnLoadRom(RomV30A + 0x000000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(RomV30A + 0x000001, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(RomV30A + 0x020000, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(RomV30A + 0x020001, 3, 2); if (nRet != 0) return 1; - - nRet = BurnLoadRom(RomV30B + 0x000000, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(RomV30B + 0x000001, 5, 2); if (nRet != 0) return 1; - - if (game_drv != GAME_RAIDENA && game_drv != GAME_RAIDENU) - common_decrypt(); - - nRet = BurnLoadRom(RomZ80 + 0x000000, 6, 1); if (nRet != 0) return 1; - - if (game_drv == GAME_RAIDEN || game_drv == GAME_RAIDENU) - seibu_sound_decrypt(); - - UINT8 * tmp = (UINT8 *) BurnMalloc (0x80000); - if (tmp == 0) return 1; - - BurnLoadRom(tmp + 0x00000, 7, 1); - BurnLoadRom(tmp + 0x08000, 8, 1); - decode_gfx_1(RomGfx1, tmp); - - BurnLoadRom(tmp + 0x00000, 9, 1); - decode_gfx_2(RomGfx2, tmp); - BurnLoadRom(tmp + 0x00000, 10, 1); - decode_gfx_2(RomGfx3, tmp); - BurnLoadRom(tmp + 0x00000, 11, 1); - decode_gfx_2(RomGfx4, tmp); - - BurnFree (tmp); - - BurnLoadRom(MSM6295ROM, 12, 1); - - { - VezInit(0, V30_TYPE); - VezInit(1, V30_TYPE); - - // main-cpu - VezOpen(0); - - VezMapArea(0x00000, 0x06fff, 0, RamV30A); // RAM - VezMapArea(0x00000, 0x06fff, 1, RamV30A); - - VezMapArea(0x07000, 0x07fff, 0, RamSpr); // Sprites - VezMapArea(0x07000, 0x07fff, 1, RamSpr); - - VezMapArea(0x0c000, 0x0c7ff, 1, (UINT8 *)RamTxt); - - VezMapArea(0xA0000, 0xFFFFF, 0, RomV30A); // CPU 0 ROM - VezMapArea(0xA0000, 0xFFFFF, 2, RomV30A); // CPU 0 ROM - - if (game_drv == GAME_RAIDENA || game_drv == GAME_RAIDENU) { - VezMapArea(0x0a000, 0x0afff, 0, RamV30S); // Share RAM - VezMapArea(0x0a000, 0x0afff, 1, RamV30S); - VezSetReadHandler(raidenReadByte); - if (game_drv == GAME_RAIDENU) { - VezSetWriteHandler(raidenuWriteByte); - } else { - VezSetWriteHandler(raidenWriteByte); - } - } else { - VezMapArea(0x08000, 0x08fff, 0, RamV30S); // Share RAM - VezMapArea(0x08000, 0x08fff, 1, RamV30S); - VezSetReadHandler(raidenAltReadByte); - VezSetWriteHandler(raidenAltWriteByte); - } - - VezClose(); - - // sub-cpu - VezOpen(1); - - if (game_drv != GAME_RAIDENU) { - VezMapArea(0x00000, 0x01fff, 0, RamV30B); // RAM - VezMapArea(0x00000, 0x01fff, 1, RamV30B); - - VezMapArea(0x02000, 0x027ff, 0, (UINT8 *)RamBg); // Background - VezMapArea(0x02000, 0x027ff, 1, (UINT8 *)RamBg); - - VezMapArea(0x02800, 0x02fff, 0, (UINT8 *)RamFg); // Foreground - VezMapArea(0x02800, 0x02fff, 1, (UINT8 *)RamFg); - - VezMapArea(0x03000, 0x03fff, 0, RamPal); // Palette - //VezMapArea(0x03000, 0x03fff, 1, RamPal); - - VezMapArea(0x04000, 0x04fff, 0, RamV30S); // Share RAM - VezMapArea(0x04000, 0x04fff, 1, RamV30S); - - VezSetReadHandler(raidenSubReadByte); - VezSetWriteHandler(raidenSubWriteByte); - } else { - VezMapArea(0x00000, 0x05fff, 0, RamV30B); // RAM - VezMapArea(0x00000, 0x05fff, 1, RamV30B); - - VezMapArea(0x06000, 0x067ff, 0, (UINT8 *)RamBg); // Background - VezMapArea(0x06000, 0x067ff, 1, (UINT8 *)RamBg); - - VezMapArea(0x06800, 0x06fff, 0, (UINT8 *)RamFg); // Foreground - VezMapArea(0x06800, 0x06fff, 1, (UINT8 *)RamFg); - - VezMapArea(0x07000, 0x07fff, 0, RamPal); // Palette - //VezMapArea(0x07000, 0x07fff, 1, RamPal); - - VezMapArea(0x08000, 0x08fff, 0, RamV30S); // Share RAM - VezMapArea(0x08000, 0x08fff, 1, RamV30S); - - VezSetReadHandler(raidenuSubReadByte); - VezSetWriteHandler(raidenuSubWriteByte); - } - - VezMapArea(0xC0000, 0xFFFFF, 0, RomV30B); // CPU 1 ROM - VezMapArea(0xC0000, 0xFFFFF, 2, RomV30B); // CPU 1 ROM - - VezClose(); - } - - { - ZetInit(0); - ZetOpen(0); - - ZetMapArea(0x0000, 0x1FFF, 0, RomZ80); - - if (game_drv == GAME_RAIDEN || game_drv == GAME_RAIDENU) - ZetMapArea(0x0000, 0x1FFF, 2, RomZ80 + 0x10000, RomZ80); - else - ZetMapArea(0x0000, 0x1FFF, 2, RomZ80); - - ZetMapArea(0x2000, 0x27FF, 0, RamZ80); - ZetMapArea(0x2000, 0x27FF, 1, RamZ80); - ZetMapArea(0x2000, 0x27FF, 2, RamZ80); - - //ZetMapArea(0x8000, 0xFFFF, 0, RomZ80 + 0x8000); - //ZetMapArea(0x8000, 0xFFFF, 2, RomZ80 + 0x8000); - //use set_seibu_bank(0); in DrvDoReset(); - - ZetMemEnd(); - - ZetSetReadHandler(raidenZ80Read); - ZetSetWriteHandler(raidenZ80Write); - ZetClose(); - - } - - BurnYM3812Init(3579545, &raidenFMIRQHandler, &raidenSynchroniseStream, 0); - BurnTimerAttachZetYM3812(3579545); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 8000, 1); // 1320000 - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - DrvDoReset(); - return 0; -} - -static INT32 DrvExit() -{ - MSM6295Exit(0); - BurnYM3812Exit(); - - VezExit(); - ZetExit(); - - BurnFree(Mem); - - return 0; -} - -static void drawBackground() -{ - /* cccc tttt tttt tttt */ - UINT16 * pal = RamCurPal + 0; - INT32 offs, mx, my, x, y, sx, sy; - - if (game_drv == GAME_RAIDENA) { - sx = (RamScroll[0] | (RamScroll[1] << 8)) & 0x1ff; - sy = (RamScroll[2] | (RamScroll[3] << 8)) & 0x1ff; - } else { - sx = ((RamScroll[2]&0x10)<<4) | ((RamScroll[3]&0x7f) << 1) | ((RamScroll[3]&0x80) >> 7); - sy = ((RamScroll[0]&0x10)<<4) | ((RamScroll[1]&0x7f) << 1) | ((RamScroll[1]&0x80) >> 7); - } - - mx = 0; - my = -1; - for (offs = 0; offs < 32*32; offs++) { - my++; - if (my == 32) { - my = 0; - mx++; - } - - x = mx * 16 - 0 - sx; - if (x < -16) x += 512; - - y = my * 16 - 16 - sy; - if (y < -16) y += 512; - - if (x<=-16 || x>=256 || y<=-16 || y>=224) continue; - else { - UINT32 tileno = BURN_ENDIAN_SWAP_INT16(RamBg[offs]) & 0x0FFF; - //if (tileno == 0) continue; - UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamBg[offs]) & 0xF000) >> 8; - UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x; - UINT8 *d = RomGfx2 + (tileno << 8); - - if (x<0 || x>(256-16) || y<0 || y>(224-16)) - for (INT32 k=0;k<16;k++) { - if ((y+k)>=0 && (y+k)<224) { - if ((x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[ 0]|c]; - if ((x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[ 1]|c]; - if ((x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[ 2]|c]; - if ((x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[ 3]|c]; - if ((x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[ 4]|c]; - if ((x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[ 5]|c]; - if ((x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 6]|c]; - if ((x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 7]|c]; - if ((x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 8]|c]; - if ((x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 9]|c]; - if ((x+10)>=0 && (x+10)<256) p[10] = pal[d[10]|c]; - if ((x+11)>=0 && (x+11)<256) p[11] = pal[d[11]|c]; - if ((x+12)>=0 && (x+12)<256) p[12] = pal[d[12]|c]; - if ((x+13)>=0 && (x+13)<256) p[13] = pal[d[13]|c]; - if ((x+14)>=0 && (x+14)<256) p[14] = pal[d[14]|c]; - if ((x+15)>=0 && (x+15)<256) p[15] = pal[d[15]|c]; - } - d += 16; - p += 256; - } - else - for (INT32 k=0;k<16;k++) { - p[ 0] = pal[d[ 0]|c]; - p[ 1] = pal[d[ 1]|c]; - p[ 2] = pal[d[ 2]|c]; - p[ 3] = pal[d[ 3]|c]; - p[ 4] = pal[d[ 4]|c]; - p[ 5] = pal[d[ 5]|c]; - p[ 6] = pal[d[ 6]|c]; - p[ 7] = pal[d[ 7]|c]; - p[ 8] = pal[d[ 8]|c]; - p[ 9] = pal[d[ 9]|c]; - p[10] = pal[d[10]|c]; - p[11] = pal[d[11]|c]; - p[12] = pal[d[12]|c]; - p[13] = pal[d[13]|c]; - p[14] = pal[d[14]|c]; - p[15] = pal[d[15]|c]; - - d += 16; - p += 256; - } - } - } -} - -static void drawForeground() -{ - /* cccc tttt tttt tttt */ - UINT16 * pal = RamCurPal + 256; - INT32 offs, mx, my, x, y, sx, sy; - - if (game_drv == GAME_RAIDENA) { - sx = (RamScroll[4] | (RamScroll[5] << 8)) & 0x1ff; - sy = (RamScroll[6] | (RamScroll[7] << 8)) & 0x1ff; - } else { - sx = ((RamScroll[6]&0x10)<<4) | ((RamScroll[7]&0x7f) << 1) | ((RamScroll[7]&0x80) >> 7); - sy = ((RamScroll[4]&0x10)<<4) | ((RamScroll[5]&0x7f) << 1) | ((RamScroll[5]&0x80) >> 7); - } - - mx = 0; - my = -1; - for (offs = 0; offs < 32*32; offs++) { - my++; - if (my == 32) { - my = 0; - mx++; - } - - x = mx * 16 - 0 - sx; - if (x < -16) x += 512; - - y = my * 16 - 16 - sy; - if (y < -16) y += 512; - - if (x<=-16 || x>=256 || y<=-16 || y>=224) continue; - else { - UINT32 tileno = BURN_ENDIAN_SWAP_INT16(RamFg[offs]) & 0x0FFF; - if (tileno == 0) continue; - UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamFg[offs]) & 0xF000) >> 8; - UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x; - UINT8 *d = RomGfx3 + (tileno << 8); - - if (x<0 || x>(256-16) || y<0 || y>(224-16)) - for (INT32 k=0;k<16;k++) { - if ((y+k)>=0 && (y+k)<224) { - if (d[ 0]!=15 && (x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[ 0]|c]; - if (d[ 1]!=15 && (x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[ 1]|c]; - if (d[ 2]!=15 && (x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[ 2]|c]; - if (d[ 3]!=15 && (x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[ 3]|c]; - if (d[ 4]!=15 && (x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[ 4]|c]; - if (d[ 5]!=15 && (x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[ 5]|c]; - if (d[ 6]!=15 && (x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 6]|c]; - if (d[ 7]!=15 && (x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 7]|c]; - if (d[ 8]!=15 && (x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 8]|c]; - if (d[ 9]!=15 && (x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 9]|c]; - if (d[10]!=15 && (x+10)>=0 && (x+10)<256) p[10] = pal[d[10]|c]; - if (d[11]!=15 && (x+11)>=0 && (x+11)<256) p[11] = pal[d[11]|c]; - if (d[12]!=15 && (x+12)>=0 && (x+12)<256) p[12] = pal[d[12]|c]; - if (d[13]!=15 && (x+13)>=0 && (x+13)<256) p[13] = pal[d[13]|c]; - if (d[14]!=15 && (x+14)>=0 && (x+14)<256) p[14] = pal[d[14]|c]; - if (d[15]!=15 && (x+15)>=0 && (x+15)<256) p[15] = pal[d[15]|c]; - } - d += 16; - p += 256; - } - else - for (INT32 k=0;k<16;k++) { - if (d[ 0] != 15) p[ 0] = pal[d[ 0]|c]; - if (d[ 1] != 15) p[ 1] = pal[d[ 1]|c]; - if (d[ 2] != 15) p[ 2] = pal[d[ 2]|c]; - if (d[ 3] != 15) p[ 3] = pal[d[ 3]|c]; - if (d[ 4] != 15) p[ 4] = pal[d[ 4]|c]; - if (d[ 5] != 15) p[ 5] = pal[d[ 5]|c]; - if (d[ 6] != 15) p[ 6] = pal[d[ 6]|c]; - if (d[ 7] != 15) p[ 7] = pal[d[ 7]|c]; - if (d[ 8] != 15) p[ 8] = pal[d[ 8]|c]; - if (d[ 9] != 15) p[ 9] = pal[d[ 9]|c]; - if (d[10] != 15) p[10] = pal[d[10]|c]; - if (d[11] != 15) p[11] = pal[d[11]|c]; - if (d[12] != 15) p[12] = pal[d[12]|c]; - if (d[13] != 15) p[13] = pal[d[13]|c]; - if (d[14] != 15) p[14] = pal[d[14]|c]; - if (d[15] != 15) p[15] = pal[d[15]|c]; - - d += 16; - p += 256; - } - } - } -} - -static void drawSprites(INT32 pri) -{ - /* yyyyyyyy -ff-CCCC tttttttt ----TTTT xxxxxxxx PP-----X -------- EEEEEEEE */ - UINT16 * pal = RamCurPal + 512; - - for(UINT8 * pSpr = RamSpr + 0x1000 - 8; pSpr>=RamSpr; pSpr-=8 ) { - - if (pSpr[7]!=0xf) continue; - if (!(pri & pSpr[5])) continue; - - INT32 fx= pSpr[1] & 0x20; - INT32 fy= pSpr[1] & 0x40; - INT32 y = pSpr[0] - 16; - INT32 x = pSpr[4]; - - if (pSpr[5]&1) x = 0 - (0x100-x); - - INT32 c = (pSpr[1] & 0xf) << 4; - INT32 sprite = (pSpr[2] | (pSpr[3] << 8)) & 0x0fff; - - if (x<=-16 || x>=256 || y<=-16 || y>=224) continue; - else { - - UINT8 *d = RomGfx4 + (sprite << 8); - UINT16 * p = (UINT16 *) pBurnDraw ; - p += y * 256 + x; - - if (x<0 || x>(256-16) || y<0 || y>(224-16)) { - - - if ( fy ) { - p += 256 * 15; - - if ( fx ) - for (INT32 k=15;k>=0;k--) { - if ((y+k)>=0 && (y+k)<224) { - if (d[15]!=15 && (x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[15]|c]; - if (d[14]!=15 && (x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[14]|c]; - if (d[13]!=15 && (x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[13]|c]; - if (d[12]!=15 && (x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[12]|c]; - if (d[11]!=15 && (x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[11]|c]; - if (d[10]!=15 && (x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[10]|c]; - if (d[ 9]!=15 && (x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 9]|c]; - if (d[ 8]!=15 && (x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 8]|c]; - if (d[ 7]!=15 && (x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 7]|c]; - if (d[ 6]!=15 && (x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 6]|c]; - if (d[ 5]!=15 && (x+10)>=0 && (x+10)<256) p[10] = pal[d[ 5]|c]; - if (d[ 4]!=15 && (x+11)>=0 && (x+11)<256) p[11] = pal[d[ 4]|c]; - if (d[ 3]!=15 && (x+12)>=0 && (x+12)<256) p[12] = pal[d[ 3]|c]; - if (d[ 2]!=15 && (x+13)>=0 && (x+13)<256) p[13] = pal[d[ 2]|c]; - if (d[ 1]!=15 && (x+14)>=0 && (x+14)<256) p[14] = pal[d[ 1]|c]; - if (d[ 0]!=15 && (x+15)>=0 && (x+15)<256) p[15] = pal[d[ 0]|c]; - } - d += 16; - p -= 256; - } - else - for (INT32 k=15;k>=0;k--) { - if ((y+k)>=0 && (y+k)<224) { - if (d[ 0]!=15 && (x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[ 0]|c]; - if (d[ 1]!=15 && (x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[ 1]|c]; - if (d[ 2]!=15 && (x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[ 2]|c]; - if (d[ 3]!=15 && (x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[ 3]|c]; - if (d[ 4]!=15 && (x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[ 4]|c]; - if (d[ 5]!=15 && (x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[ 5]|c]; - if (d[ 6]!=15 && (x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 6]|c]; - if (d[ 7]!=15 && (x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 7]|c]; - if (d[ 8]!=15 && (x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 8]|c]; - if (d[ 9]!=15 && (x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 9]|c]; - if (d[10]!=15 && (x+10)>=0 && (x+10)<256) p[10] = pal[d[10]|c]; - if (d[11]!=15 && (x+11)>=0 && (x+11)<256) p[11] = pal[d[11]|c]; - if (d[12]!=15 && (x+12)>=0 && (x+12)<256) p[12] = pal[d[12]|c]; - if (d[13]!=15 && (x+13)>=0 && (x+13)<256) p[13] = pal[d[13]|c]; - if (d[14]!=15 && (x+14)>=0 && (x+14)<256) p[14] = pal[d[14]|c]; - if (d[15]!=15 && (x+15)>=0 && (x+15)<256) p[15] = pal[d[15]|c]; - } - d += 16; - p -= 256; - } - - } else { - - if ( fx ) - for (INT32 k=0;k<16;k++) { - if ((y+k)>=0 && (y+k)<224) { - if (d[15]!=15 && (x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[15]|c]; - if (d[14]!=15 && (x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[14]|c]; - if (d[13]!=15 && (x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[13]|c]; - if (d[12]!=15 && (x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[12]|c]; - if (d[11]!=15 && (x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[11]|c]; - if (d[10]!=15 && (x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[10]|c]; - if (d[ 9]!=15 && (x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 9]|c]; - if (d[ 8]!=15 && (x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 8]|c]; - if (d[ 7]!=15 && (x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 7]|c]; - if (d[ 6]!=15 && (x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 6]|c]; - if (d[ 5]!=15 && (x+10)>=0 && (x+10)<256) p[10] = pal[d[ 5]|c]; - if (d[ 4]!=15 && (x+11)>=0 && (x+11)<256) p[11] = pal[d[ 4]|c]; - if (d[ 3]!=15 && (x+12)>=0 && (x+12)<256) p[12] = pal[d[ 3]|c]; - if (d[ 2]!=15 && (x+13)>=0 && (x+13)<256) p[13] = pal[d[ 2]|c]; - if (d[ 1]!=15 && (x+14)>=0 && (x+14)<256) p[14] = pal[d[ 1]|c]; - if (d[ 0]!=15 && (x+15)>=0 && (x+15)<256) p[15] = pal[d[ 0]|c]; - } - d += 16; - p += 256; - } - else - for (INT32 k=0;k<16;k++) { - if ((y+k)>=0 && (y+k)<224) { - if (d[ 0]!=15 && (x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[ 0]|c]; - if (d[ 1]!=15 && (x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[ 1]|c]; - if (d[ 2]!=15 && (x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[ 2]|c]; - if (d[ 3]!=15 && (x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[ 3]|c]; - if (d[ 4]!=15 && (x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[ 4]|c]; - if (d[ 5]!=15 && (x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[ 5]|c]; - if (d[ 6]!=15 && (x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 6]|c]; - if (d[ 7]!=15 && (x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 7]|c]; - if (d[ 8]!=15 && (x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 8]|c]; - if (d[ 9]!=15 && (x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 9]|c]; - if (d[10]!=15 && (x+10)>=0 && (x+10)<256) p[10] = pal[d[10]|c]; - if (d[11]!=15 && (x+11)>=0 && (x+11)<256) p[11] = pal[d[11]|c]; - if (d[12]!=15 && (x+12)>=0 && (x+12)<256) p[12] = pal[d[12]|c]; - if (d[13]!=15 && (x+13)>=0 && (x+13)<256) p[13] = pal[d[13]|c]; - if (d[14]!=15 && (x+14)>=0 && (x+14)<256) p[14] = pal[d[14]|c]; - if (d[15]!=15 && (x+15)>=0 && (x+15)<256) p[15] = pal[d[15]|c]; - } - d += 16; - p += 256; - } - } - - } else { - - if ( fy ) { - - p += 256 * 15; - - if ( fx ) { - - for (INT32 k=15;k>=0;k--) { - if (d[15] != 15) p[ 0] = pal[d[15]|c]; - if (d[14] != 15) p[ 1] = pal[d[14]|c]; - if (d[13] != 15) p[ 2] = pal[d[13]|c]; - if (d[12] != 15) p[ 3] = pal[d[12]|c]; - if (d[11] != 15) p[ 4] = pal[d[11]|c]; - if (d[10] != 15) p[ 5] = pal[d[10]|c]; - if (d[ 9] != 15) p[ 6] = pal[d[ 9]|c]; - if (d[ 8] != 15) p[ 7] = pal[d[ 8]|c]; - if (d[ 7] != 15) p[ 8] = pal[d[ 7]|c]; - if (d[ 6] != 15) p[ 9] = pal[d[ 6]|c]; - if (d[ 5] != 15) p[10] = pal[d[ 5]|c]; - if (d[ 4] != 15) p[11] = pal[d[ 4]|c]; - if (d[ 3] != 15) p[12] = pal[d[ 3]|c]; - if (d[ 2] != 15) p[13] = pal[d[ 2]|c]; - if (d[ 1] != 15) p[14] = pal[d[ 1]|c]; - if (d[ 0] != 15) p[15] = pal[d[ 0]|c]; - - d += 16; - p -= 256; - } - - } else { - - for (INT32 k=15;k>=0;k--) { - if (d[ 0] != 15) p[ 0] = pal[d[ 0]|c]; - if (d[ 1] != 15) p[ 1] = pal[d[ 1]|c]; - if (d[ 2] != 15) p[ 2] = pal[d[ 2]|c]; - if (d[ 3] != 15) p[ 3] = pal[d[ 3]|c]; - if (d[ 4] != 15) p[ 4] = pal[d[ 4]|c]; - if (d[ 5] != 15) p[ 5] = pal[d[ 5]|c]; - if (d[ 6] != 15) p[ 6] = pal[d[ 6]|c]; - if (d[ 7] != 15) p[ 7] = pal[d[ 7]|c]; - if (d[ 8] != 15) p[ 8] = pal[d[ 8]|c]; - if (d[ 9] != 15) p[ 9] = pal[d[ 9]|c]; - if (d[10] != 15) p[10] = pal[d[10]|c]; - if (d[11] != 15) p[11] = pal[d[11]|c]; - if (d[12] != 15) p[12] = pal[d[12]|c]; - if (d[13] != 15) p[13] = pal[d[13]|c]; - if (d[14] != 15) p[14] = pal[d[14]|c]; - if (d[15] != 15) p[15] = pal[d[15]|c]; - - d += 16; - p -= 256; - } - - } - - } else { - - if ( fx ) { - - for (INT32 k=0;k<16;k++) { - if (d[15] != 15) p[ 0] = pal[d[15]|c]; - if (d[14] != 15) p[ 1] = pal[d[14]|c]; - if (d[13] != 15) p[ 2] = pal[d[13]|c]; - if (d[12] != 15) p[ 3] = pal[d[12]|c]; - if (d[11] != 15) p[ 4] = pal[d[11]|c]; - if (d[10] != 15) p[ 5] = pal[d[10]|c]; - if (d[ 9] != 15) p[ 6] = pal[d[ 9]|c]; - if (d[ 8] != 15) p[ 7] = pal[d[ 8]|c]; - if (d[ 7] != 15) p[ 8] = pal[d[ 7]|c]; - if (d[ 6] != 15) p[ 9] = pal[d[ 6]|c]; - if (d[ 5] != 15) p[10] = pal[d[ 5]|c]; - if (d[ 4] != 15) p[11] = pal[d[ 4]|c]; - if (d[ 3] != 15) p[12] = pal[d[ 3]|c]; - if (d[ 2] != 15) p[13] = pal[d[ 2]|c]; - if (d[ 1] != 15) p[14] = pal[d[ 1]|c]; - if (d[ 0] != 15) p[15] = pal[d[ 0]|c]; - - d += 16; - p += 256; - } - - } else { - - for (INT32 k=0;k<16;k++) { - if (d[ 0] != 15) p[ 0] = pal[d[ 0]|c]; - if (d[ 1] != 15) p[ 1] = pal[d[ 1]|c]; - if (d[ 2] != 15) p[ 2] = pal[d[ 2]|c]; - if (d[ 3] != 15) p[ 3] = pal[d[ 3]|c]; - if (d[ 4] != 15) p[ 4] = pal[d[ 4]|c]; - if (d[ 5] != 15) p[ 5] = pal[d[ 5]|c]; - if (d[ 6] != 15) p[ 6] = pal[d[ 6]|c]; - if (d[ 7] != 15) p[ 7] = pal[d[ 7]|c]; - if (d[ 8] != 15) p[ 8] = pal[d[ 8]|c]; - if (d[ 9] != 15) p[ 9] = pal[d[ 9]|c]; - if (d[10] != 15) p[10] = pal[d[10]|c]; - if (d[11] != 15) p[11] = pal[d[11]|c]; - if (d[12] != 15) p[12] = pal[d[12]|c]; - if (d[13] != 15) p[13] = pal[d[13]|c]; - if (d[14] != 15) p[14] = pal[d[14]|c]; - if (d[15] != 15) p[15] = pal[d[15]|c]; - - d += 16; - p += 256; - } - - } - - } - } - } - - } - -} - -static void drawText() -{ - /* TT-- cccc tttt tttt */ - UINT16 * pal = RamCurPal + 768; - INT32 offs, mx, my, x, y; - - mx = 0; - my = -1; - for (offs = 0; offs < 32*32; offs++) { - my++; - if (my == 32) { - my = 0; - mx++; - } - x = mx * 8; - y = my * 8 - 16; - - if ( y<0 || y>=224) continue; - else { - UINT32 tileno = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x00FF) | ((BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0xC000) >> 6); - if (tileno == 0) continue; - UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x0F00) >> 4; - UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x; - UINT8 *d = RomGfx1 + (tileno << 6); - - for (INT32 k=0;k<8;k++) { - if (d[0] != 15) p[0] = pal[d[0]|c]; - if (d[1] != 15) p[1] = pal[d[1]|c]; - if (d[2] != 15) p[2] = pal[d[2]|c]; - if (d[3] != 15) p[3] = pal[d[3]|c]; - if (d[4] != 15) p[4] = pal[d[4]|c]; - if (d[5] != 15) p[5] = pal[d[5]|c]; - if (d[6] != 15) p[6] = pal[d[6]|c]; - if (d[7] != 15) p[7] = pal[d[7]|c]; - d += 8; - p += 256; - } - } - } -} - -static void drawTextAlt() -{ - /* TT-- cccc tttt tttt */ - UINT16 * pal = RamCurPal + 768; - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 32*32; offs++) { - mx++; - if (mx == 32) { - mx = 0; - my++; - } - x = mx * 8; - y = my * 8 - 16; - - if ( y<0 || y>=224) continue; - else { - UINT32 tileno = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x00FF) | ((BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0xC000) >> 6); - if (tileno == 0) continue; - UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x0F00) >> 4; - UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x; - UINT8 *d = RomGfx1 + (tileno << 6); - - for (INT32 k=0;k<8;k++) { - if (d[0] != 15) p[0] = pal[d[0]|c]; - if (d[1] != 15) p[1] = pal[d[1]|c]; - if (d[2] != 15) p[2] = pal[d[2]|c]; - if (d[3] != 15) p[3] = pal[d[3]|c]; - if (d[4] != 15) p[4] = pal[d[4]|c]; - if (d[5] != 15) p[5] = pal[d[5]|c]; - if (d[6] != 15) p[6] = pal[d[6]|c]; - if (d[7] != 15) p[7] = pal[d[7]|c]; - d += 8; - p += 256; - } - } - } -} - -static void DrvDraw() -{ - drawBackground(); - drawSprites(0x40); - drawForeground(); - drawSprites(0x80); - drawText(); -} - -static INT32 DrvFrame() -{ - if (DrvReset) DrvDoReset(); - - if (bRecalcPalette) { - for (INT32 i=0;i<(0x1000/2);i++) - RamCurPal[i] = CalcCol(i << 1); - bRecalcPalette = 0; - } - - DrvInput[0] = 0x00; // Buttons - DrvInput[1] = 0x00; // Joy1 - DrvInput[2] = 0x00; // Joy2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvButton[i] & 1) << i; - DrvInput[1] |= (DrvJoy1[i] & 1) << i; - DrvInput[2] |= (DrvJoy2[i] & 1) << i; - } - - VezNewFrame(); - ZetNewFrame(); - - for (INT32 i=0; i<200; i++) { - VezOpen(0); - VezRun(10000000 / 60 / 200); - VezClose(); - VezOpen(1); - VezRun(10000000 / 60 / 200); - VezClose(); - ZetOpen(0); - BurnTimerUpdateYM3812(i * ((3579545 / 60) / 200)); - ZetClose(); - } - - VezOpen(0); - VezSetIRQLineAndVector(0, 0xc8/4, VEZ_IRQSTATUS_ACK); - VezClose(); - - VezOpen(1); - VezSetIRQLineAndVector(0, 0xc8/4, VEZ_IRQSTATUS_ACK); - VezClose(); - -// ZetOpen(0); -// ZetRun( 3579545 / 60 ); -// ZetClose(); - - if (pBurnDraw) DrvDraw(); - - ZetOpen(0); - BurnTimerEndFrameYM3812(3579545 / 60); - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - return 0; -} - -static void DrvDrawAlt() -{ - drawBackground(); - drawSprites(0x40); - drawForeground(); - drawSprites(0x80); - drawTextAlt(); -} - -static INT32 DrvFrameAlt() -{ - if (DrvReset) DrvDoReset(); - - if (bRecalcPalette) { - for (INT32 i=0;i<(0x1000/2);i++) - RamCurPal[i] = CalcCol(i << 1); - bRecalcPalette = 0; - } - - DrvInput[0] = 0x00; // Buttons - DrvInput[1] = 0x00; // Joy1 - DrvInput[2] = 0x00; // Joy2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvButton[i] & 1) << i; - DrvInput[1] |= (DrvJoy1[i] & 1) << i; - DrvInput[2] |= (DrvJoy2[i] & 1) << i; - } - - VezNewFrame(); - ZetNewFrame(); - - for (INT32 i=0; i<120; i++) { - VezOpen(0); - VezRun(10000000 / 60 / 120); - VezClose(); - VezOpen(1); - VezRun(10000000 / 60 / 120); - VezClose(); - } - - VezOpen(0); - VezSetIRQLineAndVector(0, 0xc8/4, VEZ_IRQSTATUS_ACK); - VezClose(); - - VezOpen(1); - VezSetIRQLineAndVector(0, 0xc8/4, VEZ_IRQSTATUS_ACK); - VezClose(); - -// ZetOpen(0); -// ZetRun( 3579545 / 60 ); -// ZetClose(); - - if (pBurnDraw) DrvDrawAlt(); - - ZetOpen(0); - BurnTimerEndFrameYM3812(3579545 / 60); - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - if ( pnMin ) *pnMin = 0x029671; - - struct BurnArea ba; - - if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - if (nAction & ACB_WRITE) - bRecalcPalette = 1; - } - - if (nAction & ACB_DRIVER_DATA) { - - VezScan(nAction); - ZetScan(nAction); - - BurnYM3812Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - - INT32 cbank; - if (nAction & ACB_WRITE) { - SCAN_VAR(cbank); - set_seibu_bank(cbank); - } else { - cbank = seibu_bank; - SCAN_VAR(cbank); - } - - SCAN_VAR(DrvInput); - - SCAN_VAR(main2sub); - SCAN_VAR(sub2main); - SCAN_VAR(main2sub_pending); - SCAN_VAR(sub2main_pending); - SCAN_VAR(z80_irq1); - SCAN_VAR(z80_irq2); - } - - return 0; -} - -struct BurnDriver BurnDrvRaiden = { - "raiden", NULL, NULL, NULL, "1990", - "Raiden (set 1)\0", NULL, "Seibu Kaihatsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, raidenRomInfo, raidenRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, - DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, - 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvRaidena = { - "raidena", "raiden", NULL, NULL, "1990", - "Raiden (set 2)\0", NULL, "Seibu Kaihatsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, raidenaRomInfo, raidenaRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, - DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, - 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvRaident = { - "raident", "raiden", NULL, NULL, "1990", - "Raiden (Taiwan)\0", NULL, "Seibu Kaihatsu (Liang HWA Electronics license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, raidentRomInfo, raidentRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, - DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, - 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvRaidenu = { - "raidenu", "raiden", NULL, NULL, "1990", - "Raiden (US, set 1)\0", NULL, "Seibu Kaihatsu (Fabtek license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, raidenuRomInfo, raidenuRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, - DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, - 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvRaidenk = { - "raidenk", "raiden", NULL, NULL, "1990", - "Raiden (Korea)\0", NULL, "Seibu Kaihatsu (IBL Corporation license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, raidenkRomInfo, raidenkRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, - DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, - 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvRaidenb = { - "raidenb", "raiden", NULL, NULL, "1990", - "Raiden (set 3, Alternate hardware)\0", NULL, "Seibu Kaihatsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, raidenbRomInfo, raidenbRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, &bRecalcPalette, 0x1000, - 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvRaidenua = { - "raidenua", "raiden", NULL, NULL, "1990", - "Raiden (US, set 2, SEI8904 + SEI9008 PCBs)\0", NULL, "Seibu Kaihatsu (Fabtek license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, raidenuaRomInfo, raidenuaRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, - DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, - 224, 256, 3, 4 -}; +// Raiden (c) 1990 Seibu Kaihatsu +// driver by Oliver Bergmann, Bryan McPhail, Randy Mongenel + +// port to FB Alpha by OopsWare + + +#include "burnint.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "msm6295.h" +#include "nec_intf.h" + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *RomV30A; +static UINT8 *RomV30B; +static UINT8 *RomZ80; + +static UINT8 *RomGfx1; +static UINT8 *RomGfx2; +static UINT8 *RomGfx3; +static UINT8 *RomGfx4; + +static UINT8 *RamV30A; +static UINT8 *RamV30B; +static UINT8 *RamV30S; +static UINT8 *RamZ80; + +static UINT8 *RamSpr; +static UINT16 *RamFg; +static UINT16 *RamBg; +static UINT16 *RamTxt; +static UINT8 *RamPal; +static UINT8 *RamScroll; + +static UINT16 *RamCurPal; + +static UINT8 bRecalcPalette = 0; +static UINT8 DrvReset = 0; + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + +static UINT8 main2sub[2] = {0, 0}; +static UINT8 sub2main[2] = {0, 0}; +static INT32 main2sub_pending = 0; +static INT32 sub2main_pending = 0; +static UINT8 z80_irq1, z80_irq2; +static INT32 seibu_bank = 0; + +#define GAME_RAIDEN 0 +#define GAME_RAIDENA 1 +#define GAME_RAIDENK 2 +#define GAME_RAIDENU 3 +static INT32 game_drv; + +inline static UINT32 CalcCol(INT32 offs) +{ + // xxxxBBBBGGGGRRRR + INT32 nColour = RamPal[offs + 0] | (RamPal[offs + 1] << 8); + INT32 r, g, b; + + r = (nColour & 0x000F) << 4; // Red + r |= r >> 4; + g = (nColour & 0x00F0) >> 0; // Green + g |= g >> 4; + b = (nColour & 0x0F00) >> 4; // Blue + b |= b >> 4; + + return BurnHighCol(r, g, b, 0); +} + +static struct BurnInputInfo raidenInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 1, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, +}; + +STDINPUTINFO(raiden) + + +static struct BurnDIPInfo raidenDIPList[] = { + + // Defaults + {0x11, 0xFF, 0xFF, 0x00, NULL}, + {0x12, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, "Coin Mode"}, + {0x11, 0x01, 0x01, 0x00, "A"}, + {0x11, 0x01, 0x01, 0x01, "B"}, + {0, 0xFE, 0, 16, "Coinage"}, + {0x11, 0x01, 0x1E, 0x00, "1 coin 1 credit"}, + {0x11, 0x01, 0x1E, 0x02, "2 coins 1 credit"}, + {0x11, 0x01, 0x1E, 0x04, "3 coins 1 credit"}, + {0x11, 0x01, 0x1E, 0x06, "4 coins 1 credits"}, + {0x11, 0x01, 0x1E, 0x08, "5 coins 1 credit"}, + {0x11, 0x01, 0x1E, 0x0A, "6 coins 1 credit"}, + {0x11, 0x01, 0x1E, 0x0C, "1 coin 2 credits"}, + {0x11, 0x01, 0x1E, 0x0E, "1 coin 3 credits"}, + {0x11, 0x01, 0x1E, 0x10, "1 coin 4 credits"}, + {0x11, 0x01, 0x1E, 0x12, "1 coin 5 credits"}, + {0x11, 0x01, 0x1E, 0x14, "1 coin 6 credits"}, + {0x11, 0x01, 0x1E, 0x16, "2 coins 3 credits"}, + {0x11, 0x01, 0x1E, 0x18, "3 coins 2 credits"}, + {0x11, 0x01, 0x1E, 0x1A, "5 coins 3 credits"}, + {0x11, 0x01, 0x1E, 0x1C, "8 coins 3 credits"}, + {0x11, 0x01, 0x1E, 0x1E, "Free Play"}, + {0, 0xFE, 0, 2, "Credits to Start"}, + {0x11, 0x01, 0x20, 0x00, "1"}, + {0x11, 0x01, 0x20, 0x20, "2"}, + {0, 0xFE, 0, 2, "Flip Screen"}, + {0x11, 0x01, 0x80, 0x00, "Off"}, + {0x11, 0x01, 0x80, 0x80, "On"}, + + // DIP 2 + {0, 0xFE, 0, 4, "Lives"}, + {0x12, 0x01, 0x03, 0x00, "3"}, + {0x12, 0x01, 0x03, 0x01, "1"}, + {0x12, 0x01, 0x03, 0x02, "2"}, + {0x12, 0x01, 0x03, 0x03, "5"}, + {0, 0xFE, 0, 4, "Bonus Life"}, + {0x12, 0x01, 0x0c, 0x00, "150000 400000"}, + {0x12, 0x01, 0x0c, 0x04, "80000 300000"}, + {0x12, 0x01, 0x0c, 0x08, "300000 1000000"}, + {0x12, 0x01, 0x0c, 0x0c, "1000000 5000000"}, + {0, 0xFE, 0, 4, "Difficulty"}, + {0x12, 0x01, 0x30, 0x00, "Normal"}, + {0x12, 0x01, 0x30, 0x10, "Easy"}, + {0x12, 0x01, 0x30, 0x20, "Hard"}, + {0x12, 0x01, 0x30, 0x30, "Very Hard"}, + {0, 0xFE, 0, 2, "Allow Continue"}, + {0x12, 0x01, 0x40, 0x00, "Yes"}, + {0x12, 0x01, 0x40, 0x40, "No"}, + {0, 0xFE, 0, 2, "Demo sound"}, + {0x12, 0x01, 0x80, 0x00, "On"}, + {0x12, 0x01, 0x80, 0x80, "Off"}, +}; + +STDDIPINFO(raiden) + +static struct BurnRomInfo raidenRomDesc[] = { + { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 + { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, + { "3.u022", 0x020000, 0xf6af09d0, BRF_ESS | BRF_PRG }, + { "4j.u023", 0x020000, 0x505c4c5d, BRF_ESS | BRF_PRG }, + + { "5.u042", 0x020000, 0xed03562e, BRF_ESS | BRF_PRG }, // CPU 1, V30 + { "6.u043", 0x020000, 0xa19d5b5d, BRF_ESS | BRF_PRG }, + + { "8.u212", 0x010000, 0xcbe055c7, BRF_ESS | BRF_PRG }, // CPU 2, Z80 + + { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles + { "10", 0x008000, 0x5f90786a, BRF_GRA }, + { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, + { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, + { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, + + { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound +}; + +STD_ROM_PICK(raiden) +STD_ROM_FN(raiden) + +static struct BurnRomInfo raidenaRomDesc[] = { + { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 + { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, + { "3.u022", 0x020000, 0xf6af09d0, BRF_ESS | BRF_PRG }, + { "4.u023", 0x020000, 0x6bdfd416, BRF_ESS | BRF_PRG }, + + { "5.u042", 0x020000, 0xed03562e, BRF_ESS | BRF_PRG }, // CPU 1, V30 + { "6.u043", 0x020000, 0xa19d5b5d, BRF_ESS | BRF_PRG }, + + { "8.u212", 0x010000, 0xcbe055c7, BRF_ESS | BRF_PRG }, // CPU 2, Z80 + + { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles + { "10", 0x008000, 0x5f90786a, BRF_GRA }, + { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, + { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, + { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, + + { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound +}; + +STD_ROM_PICK(raidena) +STD_ROM_FN(raidena) + +static struct BurnRomInfo raidentRomDesc[] = { + { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 + { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, + { "3.u022", 0x020000, 0xf6af09d0, BRF_ESS | BRF_PRG }, + { "4t.u023", 0x020000, 0x61eefab1, BRF_ESS | BRF_PRG }, + + { "5.u042", 0x020000, 0xed03562e, BRF_ESS | BRF_PRG }, // CPU 1, V30 + { "6.u043", 0x020000, 0xa19d5b5d, BRF_ESS | BRF_PRG }, + + { "8.u212", 0x010000, 0xcbe055c7, BRF_ESS | BRF_PRG }, // CPU 2, Z80 + + { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles + { "10", 0x008000, 0x5f90786a, BRF_GRA }, + { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, + { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, + { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, + + { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound +}; + +STD_ROM_PICK(raident) +STD_ROM_FN(raident) + +static struct BurnRomInfo raidenuRomDesc[] = { + { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 + { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, + { "3a.u022", 0x020000, 0xa8fadbdd, BRF_ESS | BRF_PRG }, + { "4a.u023", 0x020000, 0xbafb268d, BRF_ESS | BRF_PRG }, + + { "5.u042", 0x020000, 0xed03562e, BRF_ESS | BRF_PRG }, // CPU 1, V30 + { "6.u043", 0x020000, 0xa19d5b5d, BRF_ESS | BRF_PRG }, + + { "8.u212", 0x010000, 0xcbe055c7, BRF_ESS | BRF_PRG }, // CPU 2, Z80 + + { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles + { "10", 0x008000, 0x5f90786a, BRF_GRA }, + { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, + { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, + { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, + + { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound +}; + +STD_ROM_PICK(raidenu) +STD_ROM_FN(raidenu) + +static struct BurnRomInfo raidenkRomDesc[] = { + { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 + { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, + { "3.u022", 0x020000, 0xf6af09d0, BRF_ESS | BRF_PRG }, + { "4k.u023", 0x020000, 0xfddf24da, BRF_ESS | BRF_PRG }, + + { "5.u042", 0x020000, 0xed03562e, BRF_ESS | BRF_PRG }, // CPU 1, V30 + { "6.u043", 0x020000, 0xa19d5b5d, BRF_ESS | BRF_PRG }, + + { "8b.u212", 0x010000, 0x99ee7505, BRF_ESS | BRF_PRG }, // CPU 2, Z80 + + { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles + { "10", 0x008000, 0x5f90786a, BRF_GRA }, + { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, + { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, + { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, + + { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound +}; + +STD_ROM_PICK(raidenk) +STD_ROM_FN(raidenk) + +static struct BurnRomInfo raidenbRomDesc[] = { + { "1.u0253", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 + { "2.u0252", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, + { "3__(raidenb).u022", 0x020000, 0x9d735bf5, BRF_ESS | BRF_PRG }, + { "4__(raidenb).u023", 0x020000, 0x8d184b99, BRF_ESS | BRF_PRG }, + + { "5__(raidenb).u042", 0x020000, 0x7aca6d61, BRF_ESS | BRF_PRG }, // CPU 1, V30 + { "6__(raidenb).u043", 0x020000, 0xe3d35cc2, BRF_ESS | BRF_PRG }, + + { "rai6.u212", 0x010000, 0x723a483b, BRF_ESS | BRF_PRG }, // CPU 2, Z80 + + { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles + { "10", 0x008000, 0x5f90786a, BRF_GRA }, + { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, + { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, + { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, + + { "7.u203", 0x010000, 0x8f927822, BRF_SND }, // Sound + + { "ep910pc-1.bin", 0x000884, 0x00000000, BRF_NODUMP }, + { "ep910pc-2.bin", 0x000884, 0x00000000, BRF_NODUMP }, +}; + +STD_ROM_PICK(raidenb) +STD_ROM_FN(raidenb) + +static struct BurnRomInfo raidenuaRomDesc[] = { + { "1.c8", 0x010000, 0xa4b12785, BRF_ESS | BRF_PRG }, // CPU 0, V30 + { "2.c7", 0x010000, 0x17640bd5, BRF_ESS | BRF_PRG }, + { "3dd.e8", 0x020000, 0xb6f3bad2, BRF_ESS | BRF_PRG }, + { "4dd.e7", 0x020000, 0xd294dfc1, BRF_ESS | BRF_PRG }, + + { "5.p8", 0x020000, 0x15c1cf45, BRF_ESS | BRF_PRG }, // CPU 1, V30 + { "6.p7", 0x020000, 0x261c381b, BRF_ESS | BRF_PRG }, + + { "8.w8", 0x010000, 0x105b9c11, BRF_ESS | BRF_PRG }, // CPU 2, Z80 + + { "9", 0x008000, 0x1922b25e, BRF_GRA }, // Tiles + { "10", 0x008000, 0x5f90786a, BRF_GRA }, + { "sei420", 0x080000, 0xda151f0b, BRF_GRA }, + { "sei430", 0x080000, 0xac1f57ac, BRF_GRA }, + { "sei440", 0x080000, 0x946d7bde, BRF_GRA }, + + { "7.x10", 0x010000, 0x2051263e, BRF_SND }, // Sound +}; + +STD_ROM_PICK(raidenua) +STD_ROM_FN(raidenua) + +static void update_irq_lines() +{ + if ((z80_irq1 & z80_irq2) == 0xff) + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + else + if (z80_irq2 == 0xdf) { // this shouldn't be required + ZetSetVector(z80_irq1 & z80_irq2); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } +} + +static UINT8 __fastcall seibu_main_v30_r(UINT32 offset) +{ + switch (offset) { + case 0x4: return sub2main[0]; + case 0x5: return 0; + + case 0x6: return sub2main[1]; + case 0x7: return 0; + + case 0xa: return main2sub_pending ? 1 : 0; + case 0xb: return 0; + default : return 0xff; + } +} + +static void __fastcall seibu_main_v30_w(UINT32 offset, UINT8 data) +{ + switch (offset) { + case 0x0: main2sub[0] = data; break; + case 0x2: main2sub[1] = data; break; + case 0x8: + z80_irq2 = 0xdf; + ZetOpen(0); + update_irq_lines(); + ZetClose(); + break; + case 0xc: + sub2main_pending = 0; + main2sub_pending = 1; + break; + } +} + +void raidenFMIRQHandler(INT32, INT32 nStatus) +{ + z80_irq1 = (nStatus) ? 0xd7 : 0xff; + update_irq_lines(); +} + +static void set_seibu_bank(INT32 bank) +{ + bank &= 1; + if (seibu_bank != bank) { + seibu_bank = bank; + ZetMapArea(0x8000, 0xFFFF, 0, RomZ80 + 0x8000 * (1-seibu_bank) ); + ZetMapArea(0x8000, 0xFFFF, 2, RomZ80 + 0x8000 * (1-seibu_bank) ); + } +} + +INT32 raidenSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3579545; +} + +UINT8 __fastcall raidenReadByte(UINT32 vezAddress) +{ + switch (vezAddress) { + case 0x0b000: return ~DrvInput[1]; + case 0x0b001: return ~DrvInput[2]; + case 0x0b002: return ~DrvInput[3]; + case 0x0b003: return ~DrvInput[4]; + + case 0x0d000: + case 0x0d001: + case 0x0d002: + case 0x0d003: + case 0x0d004: + case 0x0d005: + case 0x0d006: + case 0x0d007: + case 0x0d008: + case 0x0d009: + case 0x0d00a: + case 0x0d00b: + case 0x0d00c: + case 0x0d00d: return seibu_main_v30_r(vezAddress - 0x0d000); + + //default: + // bprintf(PRINT_NORMAL, _T("CPU #0 Attempt to read byte value of location %x\n"), vezAddress); + } + return 0; +} + +void __fastcall raidenWriteByte(UINT32 vezAddress, UINT8 byteValue) +{ + + switch (vezAddress) { + + case 0x0b000: + case 0x0b001: + case 0x0b002: + case 0x0b003: + case 0x0b004: + case 0x0b005: + case 0x0b006: + case 0x0b007: + // raiden_control_w + // flip_screen not support + break; + + case 0x0d060: + case 0x0d061: + case 0x0d062: + case 0x0d063: + case 0x0d064: + case 0x0d065: + case 0x0d066: + case 0x0d067: + RamScroll[ vezAddress - 0x0d060 ] = byteValue; + break; + + case 0x0d000: + case 0x0d001: + case 0x0d002: + case 0x0d003: + case 0x0d004: + case 0x0d005: + case 0x0d006: + case 0x0d007: + case 0x0d008: + case 0x0d009: + case 0x0d00a: + case 0x0d00b: + case 0x0d00c: + case 0x0d00d: + seibu_main_v30_w(vezAddress - 0x0d000, byteValue); + break; + //default: + // bprintf(PRINT_NORMAL, _T("CPU #0 Attempt to write byte value %x to location %x\n"), byteValue, vezAddress); + } +} + +UINT8 __fastcall raidenAltReadByte(UINT32 vezAddress) +{ + switch (vezAddress) { + case 0x0a000: + case 0x0a001: + case 0x0a002: + case 0x0a003: + case 0x0a004: + case 0x0a005: + case 0x0a006: + case 0x0a007: + case 0x0a008: + case 0x0a009: + case 0x0a00a: + case 0x0a00b: + case 0x0a00c: + case 0x0a00d: return seibu_main_v30_r(vezAddress - 0x0a000); + + case 0x0e000: return ~DrvInput[1]; + case 0x0e001: return ~DrvInput[2]; + case 0x0e002: return ~DrvInput[3]; + case 0x0e003: return ~DrvInput[4]; + + //default: + // bprintf(PRINT_NORMAL, _T("CPU #0 Attempt to read byte value of location %x\n"), vezAddress); + } + return 0; +} + +void __fastcall raidenAltWriteByte(UINT32 vezAddress, UINT8 byteValue) +{ + + switch (vezAddress) { + + case 0x0b000: + case 0x0b001: + case 0x0b002: + case 0x0b003: + case 0x0b004: + case 0x0b005: + case 0x0b006: + case 0x0b007: + // raiden_control_w + // flip_screen not support + break; + + case 0x0f002: RamScroll[0] = byteValue; break; + case 0x0f004: RamScroll[1] = byteValue; break; + case 0x0f012: RamScroll[2] = byteValue; break; + case 0x0f014: RamScroll[3] = byteValue; break; + case 0x0f022: RamScroll[4] = byteValue; break; + case 0x0f024: RamScroll[5] = byteValue; break; + case 0x0f032: RamScroll[6] = byteValue; break; + case 0x0f034: RamScroll[7] = byteValue; break; + + case 0x0a000: + case 0x0a001: + case 0x0a002: + case 0x0a003: + case 0x0a004: + case 0x0a005: + case 0x0a006: + case 0x0a007: + case 0x0a008: + case 0x0a009: + case 0x0a00a: + case 0x0a00b: + case 0x0a00c: + case 0x0a00d: + seibu_main_v30_w(vezAddress - 0x0a000, byteValue); + break; + //default: + // bprintf(PRINT_NORMAL, _T("CPU #0 Attempt to write byte value %x to location %x\n"), byteValue, vezAddress); + } +} + +void __fastcall raidenuWriteByte(UINT32 vezAddress, UINT8 byteValue) +{ + + switch (vezAddress) { + + case 0x0b000: + case 0x0b001: + case 0x0b002: + case 0x0b003: + case 0x0b004: + case 0x0b005: + case 0x0b006: + case 0x0b007: + // raiden_control_w + // flip_screen not support + break; + + case 0x08002: RamScroll[0] = byteValue; break; + case 0x08004: RamScroll[1] = byteValue; break; + case 0x08012: RamScroll[2] = byteValue; break; + case 0x08014: RamScroll[3] = byteValue; break; + case 0x08022: RamScroll[4] = byteValue; break; + case 0x08024: RamScroll[5] = byteValue; break; + case 0x08032: RamScroll[6] = byteValue; break; + case 0x08034: RamScroll[7] = byteValue; break; + + case 0x0d000: + case 0x0d001: + case 0x0d002: + case 0x0d003: + case 0x0d004: + case 0x0d005: + case 0x0d006: + case 0x0d007: + case 0x0d008: + case 0x0d009: + case 0x0d00a: + case 0x0d00b: + case 0x0d00c: + case 0x0d00d: + seibu_main_v30_w(vezAddress - 0x0d000, byteValue); + break; + //default: + // bprintf(PRINT_NORMAL, _T("CPU #0 Attempt to write byte value %x to location %x\n"), byteValue, vezAddress); + } +} + +UINT8 __fastcall raidenSubReadByte(UINT32 vezAddress) +{ + switch (vezAddress) { + case 0x04008: { + UINT8 nRet = RamV30S[0x8]; + //INT32 pc = VezPC(); + //if (pc==0xfcde6 && ret!=0x40) cpu_spin(); + bprintf(PRINT_NORMAL, _T("sub_cpu_spin_r %02x%02x\n"), RamV30S[0x8], RamV30S[0x9]); + return nRet; } + case 0x04009: + bprintf(PRINT_NORMAL, _T("sub_cpu_spin_r %02x%02x\n"), RamV30S[0x8], RamV30S[0x9]); + return RamV30S[0x9]; + + //default: + // bprintf(PRINT_NORMAL, _T("CPU #1 Attempt to read byte value of location %x\n"), vezAddress); + } + return 0; +} + +void __fastcall raidenSubWriteByte(UINT32 vezAddress, UINT8 byteValue) +{ + if ((vezAddress & 0xFF000) == 0x03000 ) { + vezAddress -= 0x03000; + RamPal[ vezAddress ] = byteValue; + if (vezAddress & 1) + RamCurPal[ vezAddress >> 1 ] = CalcCol( vezAddress - 1 ); + return; + } + +// switch (vezAddress) { +// default: +// bprintf(PRINT_NORMAL, _T("CPU #1 Attempt to write byte value %x to location %x\n"), byteValue, vezAddress); +// } + +} + +UINT8 __fastcall raidenuSubReadByte(UINT32 vezAddress) +{ + switch (vezAddress) { + case 0x08008: { + UINT8 nRet = RamV30S[0x8]; + //INT32 pc = VezPC(); + //if (pc==0xfcde6 && ret!=0x40) cpu_spin(); + bprintf(PRINT_NORMAL, _T("sub_cpu_spin_r %02x%02x\n"), RamV30S[0x8], RamV30S[0x9]); + return nRet; } + case 0x08009: + bprintf(PRINT_NORMAL, _T("sub_cpu_spin_r %02x%02x\n"), RamV30S[0x8], RamV30S[0x9]); + return RamV30S[0x9]; + + //default: + // bprintf(PRINT_NORMAL, _T("CPU #1 Attempt to read byte value of location %x\n"), vezAddress); + } + return 0; +} + +void __fastcall raidenuSubWriteByte(UINT32 vezAddress, UINT8 byteValue) +{ + if ((vezAddress & 0xFF000) == 0x07000 ) { + vezAddress -= 0x07000; + RamPal[ vezAddress ] = byteValue; + if (vezAddress & 1) + RamCurPal[ vezAddress >> 1 ] = CalcCol( vezAddress - 1 ); + return; + } + +// switch (vezAddress) { +// default: +// bprintf(PRINT_NORMAL, _T("CPU #1 Attempt to write byte value %x to location %x\n"), byteValue, vezAddress); +// } + +} + +UINT8 __fastcall raidenZ80Read(UINT16 a) +{ + switch (a) { + case 0x4008: return BurnYM3812Read(0); + case 0x4010: return main2sub[0]; + case 0x4011: return main2sub[1]; + case 0x4012: return sub2main_pending ? 1 : 0; + case 0x4013: return DrvInput[0]; + case 0x6000: return MSM6295ReadStatus(0); +// default: +// bprintf(PRINT_NORMAL, _T("Z80 Attempt to read word value of location %04x\n"), a); + } + return 0; +} + + +void __fastcall raidenZ80Write(UINT16 a,UINT8 v) +{ + switch (a) { + case 0x4000: + // just a guess + main2sub_pending = 0; + sub2main_pending = 1; + break; + case 0x4001: + // seibu_irq_clear_w + z80_irq1 = 0xff; + z80_irq2 = 0xff; + update_irq_lines(); + break; + case 0x4002: + // seibu_rst10_ack_w + break; + case 0x4003: + // seibu_rst18_ack_w + z80_irq2 = 0xff; + update_irq_lines(); + break; + case 0x4007: + // seibu_bank_w + set_seibu_bank(v); + break; + case 0x4008: + // YM3812_control_port_0_w + BurnYM3812Write(0, v); + break; + case 0x4009: + // YM3812_write_port_0_w + BurnYM3812Write(1, v); + break; + case 0x4018: + sub2main[0] = v; + break; + case 0x4019: + sub2main[1] = v; + break; + case 0x401b: + // seibu_coin_w + //bprintf(PRINT_NORMAL, _T("seibu_coin_w(%02x)\n"), v); + break; + case 0x6000: + // OKIM6295_data_0_w + MSM6295Command(0, v); + break; + //default: + // bprintf(PRINT_NORMAL, _T("Z80 Attempt to write word value %x to location %x\n"), v, a); + } +} + +static INT32 DrvDoReset() +{ + + VezOpen(0); + VezReset(); + VezClose(); + + VezOpen(1); + VezReset(); + VezClose(); + + seibu_bank = -1; + + ZetOpen(0); + set_seibu_bank(0); + ZetReset(); + z80_irq1 = 0xff; + z80_irq2 = 0xff; + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + MSM6295Reset(0); + BurnYM3812Reset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + RomV30A = Next; Next += 0x060000; // V30 main cpu + RomV30B = Next; Next += 0x040000; // V30 sub cpu + RomZ80 = Next; Next += 0x020000; // Z80 sound cpu + + RomGfx1 = Next; Next += 0x020000; // char + RomGfx2 = Next; Next += 0x100000; // tile 1 + RomGfx3 = Next; Next += 0x100000; // tile 2 + RomGfx4 = Next; Next += 0x100000; // spr + + MSM6295ROM = Next; Next += 0x010000; + + RamStart = Next; + + RamV30A = Next; Next += 0x007000; + RamV30B = Next; Next += 0x006000; + RamV30S = Next; Next += 0x001000; + RamZ80 = Next; Next += 0x000800; + + RamSpr = Next; Next += 0x001000; + RamFg = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); + RamBg = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); + RamTxt = (UINT16 *)Next; Next += 0x000400 * sizeof(UINT16); + + RamPal = Next; Next += 0x001000; + RamScroll = Next; Next += 0x000008; + + RamEnd = Next; + + RamCurPal = (UINT16 *) Next; Next += 0x000800 * sizeof(UINT16); + + MemEnd = Next; + return 0; +} + +void decode_gfx_1(UINT8 * dst, UINT8 * src) +{ + for(INT32 i=0;i<0x10000/32;i++) { + for (INT32 j=0;j<8;j++) { + + dst[0] = (((src[0] >> 7) & 1) << 2) | (((src[0] >> 3) & 1) << 3) | (((src[0x8000] >> 7) & 1) << 0) | (((src[0x8000] >> 3) & 1) << 1); + dst[1] = (((src[0] >> 6) & 1) << 2) | (((src[0] >> 2) & 1) << 3) | (((src[0x8000] >> 6) & 1) << 0) | (((src[0x8000] >> 2) & 1) << 1); + dst[2] = (((src[0] >> 5) & 1) << 2) | (((src[0] >> 1) & 1) << 3) | (((src[0x8000] >> 5) & 1) << 0) | (((src[0x8000] >> 1) & 1) << 1); + dst[3] = (((src[0] >> 4) & 1) << 2) | (((src[0] >> 0) & 1) << 3) | (((src[0x8000] >> 4) & 1) << 0) | (((src[0x8000] >> 0) & 1) << 1); + dst[4] = (((src[1] >> 7) & 1) << 2) | (((src[1] >> 3) & 1) << 3) | (((src[0x8001] >> 7) & 1) << 0) | (((src[0x8001] >> 3) & 1) << 1); + dst[5] = (((src[1] >> 6) & 1) << 2) | (((src[1] >> 2) & 1) << 3) | (((src[0x8001] >> 6) & 1) << 0) | (((src[0x8001] >> 2) & 1) << 1); + dst[6] = (((src[1] >> 5) & 1) << 2) | (((src[1] >> 1) & 1) << 3) | (((src[0x8001] >> 5) & 1) << 0) | (((src[0x8001] >> 1) & 1) << 1); + dst[7] = (((src[1] >> 4) & 1) << 2) | (((src[1] >> 0) & 1) << 3) | (((src[0x8001] >> 4) & 1) << 0) | (((src[0x8001] >> 0) & 1) << 1); + + src += 2; + dst += 8; + } + } +} + +void decode_gfx_2(UINT8 * dst, UINT8 * src) +{ + for(INT32 i=0;i<0x80000/128;i++) { + for (INT32 j=0;j<16;j++) { + + dst[ 0] = (((src[ 1] >> 7) & 1) << 2) | (((src[ 1] >> 3) & 1) << 3) | (((src[ 0] >> 7) & 1) << 0) | (((src[ 0] >> 3) & 1) << 1); + dst[ 1] = (((src[ 1] >> 6) & 1) << 2) | (((src[ 1] >> 2) & 1) << 3) | (((src[ 0] >> 6) & 1) << 0) | (((src[ 0] >> 2) & 1) << 1); + dst[ 2] = (((src[ 1] >> 5) & 1) << 2) | (((src[ 1] >> 1) & 1) << 3) | (((src[ 0] >> 5) & 1) << 0) | (((src[ 0] >> 1) & 1) << 1); + dst[ 3] = (((src[ 1] >> 4) & 1) << 2) | (((src[ 1] >> 0) & 1) << 3) | (((src[ 0] >> 4) & 1) << 0) | (((src[ 0] >> 0) & 1) << 1); + dst[ 4] = (((src[ 3] >> 7) & 1) << 2) | (((src[ 3] >> 3) & 1) << 3) | (((src[ 2] >> 7) & 1) << 0) | (((src[ 2] >> 3) & 1) << 1); + dst[ 5] = (((src[ 3] >> 6) & 1) << 2) | (((src[ 3] >> 2) & 1) << 3) | (((src[ 2] >> 6) & 1) << 0) | (((src[ 2] >> 2) & 1) << 1); + dst[ 6] = (((src[ 3] >> 5) & 1) << 2) | (((src[ 3] >> 1) & 1) << 3) | (((src[ 2] >> 5) & 1) << 0) | (((src[ 2] >> 1) & 1) << 1); + dst[ 7] = (((src[ 3] >> 4) & 1) << 2) | (((src[ 3] >> 0) & 1) << 3) | (((src[ 2] >> 4) & 1) << 0) | (((src[ 2] >> 0) & 1) << 1); + + dst[ 8] = (((src[65] >> 7) & 1) << 2) | (((src[65] >> 3) & 1) << 3) | (((src[64] >> 7) & 1) << 0) | (((src[64] >> 3) & 1) << 1); + dst[ 9] = (((src[65] >> 6) & 1) << 2) | (((src[65] >> 2) & 1) << 3) | (((src[64] >> 6) & 1) << 0) | (((src[64] >> 2) & 1) << 1); + dst[10] = (((src[65] >> 5) & 1) << 2) | (((src[65] >> 1) & 1) << 3) | (((src[64] >> 5) & 1) << 0) | (((src[64] >> 1) & 1) << 1); + dst[11] = (((src[65] >> 4) & 1) << 2) | (((src[65] >> 0) & 1) << 3) | (((src[64] >> 4) & 1) << 0) | (((src[64] >> 0) & 1) << 1); + dst[12] = (((src[67] >> 7) & 1) << 2) | (((src[67] >> 3) & 1) << 3) | (((src[66] >> 7) & 1) << 0) | (((src[66] >> 3) & 1) << 1); + dst[13] = (((src[67] >> 6) & 1) << 2) | (((src[67] >> 2) & 1) << 3) | (((src[66] >> 6) & 1) << 0) | (((src[66] >> 2) & 1) << 1); + dst[14] = (((src[67] >> 5) & 1) << 2) | (((src[67] >> 1) & 1) << 3) | (((src[66] >> 5) & 1) << 0) | (((src[66] >> 1) & 1) << 1); + dst[15] = (((src[67] >> 4) & 1) << 2) | (((src[67] >> 0) & 1) << 3) | (((src[66] >> 4) & 1) << 0) | (((src[66] >> 0) & 1) << 1); + + + src += 4; + dst += 16; + } + src += 64; + } +} + +static void common_decrypt() +{ + UINT8 *RAM = RomV30A; + INT32 i; + UINT8 a; + + static const UINT8 xor_table[4][16]={ + {0xF1,0xF9,0xF5,0xFD,0xF1,0xF1,0x3D,0x3D,0x73,0xFB,0x77,0xFF,0x73,0xF3,0x3F,0x3F}, // rom 3 + {0xDF,0xFF,0xFF,0xFF,0xDB,0xFF,0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0xFF,0xFB,0xFF}, // rom 4 + {0x7F,0x7F,0xBB,0x77,0x77,0x77,0xBE,0xF6,0x7F,0x7F,0xBB,0x77,0x77,0x77,0xBE,0xF6}, // rom 5 + {0xFF,0xFF,0xFD,0xFD,0xFD,0xFD,0xEF,0xEF,0xFF,0xFF,0xFD,0xFD,0xFD,0xFD,0xEF,0xEF} // rom 6 + }; + + // Rom 3 - main cpu even bytes + for (i=0x20000; i<0x60000; i+=2) { + a=RAM[i]; + a^=xor_table[0][(i/2) & 0x0f]; + a^=0xff; + a=(a & 0x31) | ((a<<1) & 0x04) | ((a>>5) & 0x02) | ((a<<4) & 0x40) | ((a<<4) & 0x80) | ((a>>4) & 0x08); + RAM[i]=a; + } + + // Rom 4 - main cpu odd bytes + for (i=0x20001; i<0x60000; i+=2) { + a=RAM[i]; + a^=xor_table[1][(i/2) & 0x0f]; + a^=0xff; + a=(a & 0xdb) | ((a>>3) & 0x04) | ((a<<3) & 0x20); + RAM[i]=a; + } + + RAM = RomV30B; + + // Rom 5 - sub cpu even bytes + for (i=0x00000; i<0x40000; i+=2) { + a=RAM[i]; + a^=xor_table[2][(i/2) & 0x0f]; + a^=0xff; + a=(a & 0x32) | ((a>>1) & 0x04) | ((a>>4) & 0x08) | ((a<<5) & 0x80) | ((a>>6) & 0x01) | ((a<<6) & 0x40); + RAM[i]=a; + } + + // Rom 6 - sub cpu odd bytes + for (i=0x00001; i<0x40000; i+=2) { + a=RAM[i]; + a^=xor_table[3][(i/2) & 0x0f]; + a^=0xff; + a=(a & 0xed) | ((a>>3) & 0x02) | ((a<<3) & 0x10); + RAM[i]=a; + } +} + +#define BIT(x,n) (((x)>>(n))&1) + +#define BITSWAP8(val,B7,B6,B5,B4,B3,B2,B1,B0) \ + ((BIT(val,B7) << 7) | \ + (BIT(val,B6) << 6) | \ + (BIT(val,B5) << 5) | \ + (BIT(val,B4) << 4) | \ + (BIT(val,B3) << 3) | \ + (BIT(val,B2) << 2) | \ + (BIT(val,B1) << 1) | \ + (BIT(val,B0) << 0)) + +static UINT8 decrypt_data(INT32 a,UINT8 src) +{ + if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; + if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; + if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; + if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; + if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; + + if (BIT(a,13) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,3,2,0,1); + if (BIT(a, 8) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,2,3,1,0); + + return src; +} + +static UINT8 decrypt_opcode(INT32 a,UINT8 src) +{ + if ( BIT(a,9) & BIT(a,8)) src ^= 0x80; + if ( BIT(a,11) & BIT(a,4) & BIT(a,1)) src ^= 0x40; + if (~BIT(a,13) & BIT(a,12)) src ^= 0x20; + if (~BIT(a,6) & BIT(a,1)) src ^= 0x10; + if (~BIT(a,12) & BIT(a,2)) src ^= 0x08; + if ( BIT(a,11) & ~BIT(a,8) & BIT(a,1)) src ^= 0x04; + if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02; + if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01; + + if (BIT(a,13) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,3,2,0,1); + if (BIT(a, 8) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,2,3,1,0); + if (BIT(a,12) & BIT(a,9)) src = BITSWAP8(src,7,6,4,5,3,2,1,0); + if (BIT(a,11) & ~BIT(a,6)) src = BITSWAP8(src,6,7,5,4,3,2,1,0); + + return src; +} + +void seibu_sound_decrypt() +{ + for (INT32 i=0; i<0x10000;i++) { + UINT8 src = RomZ80[i]; + RomZ80[i+0x00000] = decrypt_data(i,src); + RomZ80[i+0x10000] = decrypt_opcode(i,src); + } +} + +static INT32 DrvInit() +{ + INT32 nRet; + + if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raiden") == 0 ) + game_drv = GAME_RAIDEN; + else + if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raidena") == 0 ) + game_drv = GAME_RAIDEN; + else + if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raidenk") == 0 ) + game_drv = GAME_RAIDENK; + else + if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raident") == 0 ) + game_drv = GAME_RAIDEN; + else + if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raidenu") == 0 ) + game_drv = GAME_RAIDEN; + else + if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raidenb") == 0 ) + game_drv = GAME_RAIDENA; + else + if ( strcmp(BurnDrvGetTextA(DRV_NAME), "raidenua") == 0 ) + game_drv = GAME_RAIDENU; + else + return 1; + + Mem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); // blank all memory + MemIndex(); + + nRet = BurnLoadRom(RomV30A + 0x000000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(RomV30A + 0x000001, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(RomV30A + 0x020000, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(RomV30A + 0x020001, 3, 2); if (nRet != 0) return 1; + + nRet = BurnLoadRom(RomV30B + 0x000000, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(RomV30B + 0x000001, 5, 2); if (nRet != 0) return 1; + + if (game_drv != GAME_RAIDENA && game_drv != GAME_RAIDENU) + common_decrypt(); + + nRet = BurnLoadRom(RomZ80 + 0x000000, 6, 1); if (nRet != 0) return 1; + + if (game_drv == GAME_RAIDEN || game_drv == GAME_RAIDENU) + seibu_sound_decrypt(); + + UINT8 * tmp = (UINT8 *) BurnMalloc (0x80000); + if (tmp == 0) return 1; + + BurnLoadRom(tmp + 0x00000, 7, 1); + BurnLoadRom(tmp + 0x08000, 8, 1); + decode_gfx_1(RomGfx1, tmp); + + BurnLoadRom(tmp + 0x00000, 9, 1); + decode_gfx_2(RomGfx2, tmp); + BurnLoadRom(tmp + 0x00000, 10, 1); + decode_gfx_2(RomGfx3, tmp); + BurnLoadRom(tmp + 0x00000, 11, 1); + decode_gfx_2(RomGfx4, tmp); + + BurnFree (tmp); + + BurnLoadRom(MSM6295ROM, 12, 1); + + { + VezInit(0, V30_TYPE); + VezInit(1, V30_TYPE); + + // main-cpu + VezOpen(0); + + VezMapArea(0x00000, 0x06fff, 0, RamV30A); // RAM + VezMapArea(0x00000, 0x06fff, 1, RamV30A); + + VezMapArea(0x07000, 0x07fff, 0, RamSpr); // Sprites + VezMapArea(0x07000, 0x07fff, 1, RamSpr); + + VezMapArea(0x0c000, 0x0c7ff, 1, (UINT8 *)RamTxt); + + VezMapArea(0xA0000, 0xFFFFF, 0, RomV30A); // CPU 0 ROM + VezMapArea(0xA0000, 0xFFFFF, 2, RomV30A); // CPU 0 ROM + + if (game_drv == GAME_RAIDENA || game_drv == GAME_RAIDENU) { + VezMapArea(0x0a000, 0x0afff, 0, RamV30S); // Share RAM + VezMapArea(0x0a000, 0x0afff, 1, RamV30S); + VezSetReadHandler(raidenReadByte); + if (game_drv == GAME_RAIDENU) { + VezSetWriteHandler(raidenuWriteByte); + } else { + VezSetWriteHandler(raidenWriteByte); + } + } else { + VezMapArea(0x08000, 0x08fff, 0, RamV30S); // Share RAM + VezMapArea(0x08000, 0x08fff, 1, RamV30S); + VezSetReadHandler(raidenAltReadByte); + VezSetWriteHandler(raidenAltWriteByte); + } + + VezClose(); + + // sub-cpu + VezOpen(1); + + if (game_drv != GAME_RAIDENU) { + VezMapArea(0x00000, 0x01fff, 0, RamV30B); // RAM + VezMapArea(0x00000, 0x01fff, 1, RamV30B); + + VezMapArea(0x02000, 0x027ff, 0, (UINT8 *)RamBg); // Background + VezMapArea(0x02000, 0x027ff, 1, (UINT8 *)RamBg); + + VezMapArea(0x02800, 0x02fff, 0, (UINT8 *)RamFg); // Foreground + VezMapArea(0x02800, 0x02fff, 1, (UINT8 *)RamFg); + + VezMapArea(0x03000, 0x03fff, 0, RamPal); // Palette + //VezMapArea(0x03000, 0x03fff, 1, RamPal); + + VezMapArea(0x04000, 0x04fff, 0, RamV30S); // Share RAM + VezMapArea(0x04000, 0x04fff, 1, RamV30S); + + VezSetReadHandler(raidenSubReadByte); + VezSetWriteHandler(raidenSubWriteByte); + } else { + VezMapArea(0x00000, 0x05fff, 0, RamV30B); // RAM + VezMapArea(0x00000, 0x05fff, 1, RamV30B); + + VezMapArea(0x06000, 0x067ff, 0, (UINT8 *)RamBg); // Background + VezMapArea(0x06000, 0x067ff, 1, (UINT8 *)RamBg); + + VezMapArea(0x06800, 0x06fff, 0, (UINT8 *)RamFg); // Foreground + VezMapArea(0x06800, 0x06fff, 1, (UINT8 *)RamFg); + + VezMapArea(0x07000, 0x07fff, 0, RamPal); // Palette + //VezMapArea(0x07000, 0x07fff, 1, RamPal); + + VezMapArea(0x08000, 0x08fff, 0, RamV30S); // Share RAM + VezMapArea(0x08000, 0x08fff, 1, RamV30S); + + VezSetReadHandler(raidenuSubReadByte); + VezSetWriteHandler(raidenuSubWriteByte); + } + + VezMapArea(0xC0000, 0xFFFFF, 0, RomV30B); // CPU 1 ROM + VezMapArea(0xC0000, 0xFFFFF, 2, RomV30B); // CPU 1 ROM + + VezClose(); + } + + { + ZetInit(0); + ZetOpen(0); + + ZetMapArea(0x0000, 0x1FFF, 0, RomZ80); + + if (game_drv == GAME_RAIDEN || game_drv == GAME_RAIDENU) + ZetMapArea(0x0000, 0x1FFF, 2, RomZ80 + 0x10000, RomZ80); + else + ZetMapArea(0x0000, 0x1FFF, 2, RomZ80); + + ZetMapArea(0x2000, 0x27FF, 0, RamZ80); + ZetMapArea(0x2000, 0x27FF, 1, RamZ80); + ZetMapArea(0x2000, 0x27FF, 2, RamZ80); + + //ZetMapArea(0x8000, 0xFFFF, 0, RomZ80 + 0x8000); + //ZetMapArea(0x8000, 0xFFFF, 2, RomZ80 + 0x8000); + //use set_seibu_bank(0); in DrvDoReset(); + + + ZetSetReadHandler(raidenZ80Read); + ZetSetWriteHandler(raidenZ80Write); + ZetClose(); + + } + + BurnYM3812Init(3579545, &raidenFMIRQHandler, &raidenSynchroniseStream, 0); + BurnTimerAttachZetYM3812(3579545); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 8000, 1); // 1320000 + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + DrvDoReset(); + return 0; +} + +static INT32 DrvExit() +{ + MSM6295Exit(0); + BurnYM3812Exit(); + + VezExit(); + ZetExit(); + + BurnFree(Mem); + + return 0; +} + +static void drawBackground() +{ + /* cccc tttt tttt tttt */ + UINT16 * pal = RamCurPal + 0; + INT32 offs, mx, my, x, y, sx, sy; + + if (game_drv == GAME_RAIDENA) { + sx = (RamScroll[0] | (RamScroll[1] << 8)) & 0x1ff; + sy = (RamScroll[2] | (RamScroll[3] << 8)) & 0x1ff; + } else { + sx = ((RamScroll[2]&0x10)<<4) | ((RamScroll[3]&0x7f) << 1) | ((RamScroll[3]&0x80) >> 7); + sy = ((RamScroll[0]&0x10)<<4) | ((RamScroll[1]&0x7f) << 1) | ((RamScroll[1]&0x80) >> 7); + } + + mx = 0; + my = -1; + for (offs = 0; offs < 32*32; offs++) { + my++; + if (my == 32) { + my = 0; + mx++; + } + + x = mx * 16 - 0 - sx; + if (x < -16) x += 512; + + y = my * 16 - 16 - sy; + if (y < -16) y += 512; + + if (x<=-16 || x>=256 || y<=-16 || y>=224) continue; + else { + UINT32 tileno = BURN_ENDIAN_SWAP_INT16(RamBg[offs]) & 0x0FFF; + //if (tileno == 0) continue; + UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamBg[offs]) & 0xF000) >> 8; + UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x; + UINT8 *d = RomGfx2 + (tileno << 8); + + if (x<0 || x>(256-16) || y<0 || y>(224-16)) + for (INT32 k=0;k<16;k++) { + if ((y+k)>=0 && (y+k)<224) { + if ((x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[ 0]|c]; + if ((x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[ 1]|c]; + if ((x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[ 2]|c]; + if ((x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[ 3]|c]; + if ((x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[ 4]|c]; + if ((x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[ 5]|c]; + if ((x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 6]|c]; + if ((x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 7]|c]; + if ((x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 8]|c]; + if ((x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 9]|c]; + if ((x+10)>=0 && (x+10)<256) p[10] = pal[d[10]|c]; + if ((x+11)>=0 && (x+11)<256) p[11] = pal[d[11]|c]; + if ((x+12)>=0 && (x+12)<256) p[12] = pal[d[12]|c]; + if ((x+13)>=0 && (x+13)<256) p[13] = pal[d[13]|c]; + if ((x+14)>=0 && (x+14)<256) p[14] = pal[d[14]|c]; + if ((x+15)>=0 && (x+15)<256) p[15] = pal[d[15]|c]; + } + d += 16; + p += 256; + } + else + for (INT32 k=0;k<16;k++) { + p[ 0] = pal[d[ 0]|c]; + p[ 1] = pal[d[ 1]|c]; + p[ 2] = pal[d[ 2]|c]; + p[ 3] = pal[d[ 3]|c]; + p[ 4] = pal[d[ 4]|c]; + p[ 5] = pal[d[ 5]|c]; + p[ 6] = pal[d[ 6]|c]; + p[ 7] = pal[d[ 7]|c]; + p[ 8] = pal[d[ 8]|c]; + p[ 9] = pal[d[ 9]|c]; + p[10] = pal[d[10]|c]; + p[11] = pal[d[11]|c]; + p[12] = pal[d[12]|c]; + p[13] = pal[d[13]|c]; + p[14] = pal[d[14]|c]; + p[15] = pal[d[15]|c]; + + d += 16; + p += 256; + } + } + } +} + +static void drawForeground() +{ + /* cccc tttt tttt tttt */ + UINT16 * pal = RamCurPal + 256; + INT32 offs, mx, my, x, y, sx, sy; + + if (game_drv == GAME_RAIDENA) { + sx = (RamScroll[4] | (RamScroll[5] << 8)) & 0x1ff; + sy = (RamScroll[6] | (RamScroll[7] << 8)) & 0x1ff; + } else { + sx = ((RamScroll[6]&0x10)<<4) | ((RamScroll[7]&0x7f) << 1) | ((RamScroll[7]&0x80) >> 7); + sy = ((RamScroll[4]&0x10)<<4) | ((RamScroll[5]&0x7f) << 1) | ((RamScroll[5]&0x80) >> 7); + } + + mx = 0; + my = -1; + for (offs = 0; offs < 32*32; offs++) { + my++; + if (my == 32) { + my = 0; + mx++; + } + + x = mx * 16 - 0 - sx; + if (x < -16) x += 512; + + y = my * 16 - 16 - sy; + if (y < -16) y += 512; + + if (x<=-16 || x>=256 || y<=-16 || y>=224) continue; + else { + UINT32 tileno = BURN_ENDIAN_SWAP_INT16(RamFg[offs]) & 0x0FFF; + if (tileno == 0) continue; + UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamFg[offs]) & 0xF000) >> 8; + UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x; + UINT8 *d = RomGfx3 + (tileno << 8); + + if (x<0 || x>(256-16) || y<0 || y>(224-16)) + for (INT32 k=0;k<16;k++) { + if ((y+k)>=0 && (y+k)<224) { + if (d[ 0]!=15 && (x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[ 0]|c]; + if (d[ 1]!=15 && (x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[ 1]|c]; + if (d[ 2]!=15 && (x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[ 2]|c]; + if (d[ 3]!=15 && (x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[ 3]|c]; + if (d[ 4]!=15 && (x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[ 4]|c]; + if (d[ 5]!=15 && (x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[ 5]|c]; + if (d[ 6]!=15 && (x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 6]|c]; + if (d[ 7]!=15 && (x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 7]|c]; + if (d[ 8]!=15 && (x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 8]|c]; + if (d[ 9]!=15 && (x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 9]|c]; + if (d[10]!=15 && (x+10)>=0 && (x+10)<256) p[10] = pal[d[10]|c]; + if (d[11]!=15 && (x+11)>=0 && (x+11)<256) p[11] = pal[d[11]|c]; + if (d[12]!=15 && (x+12)>=0 && (x+12)<256) p[12] = pal[d[12]|c]; + if (d[13]!=15 && (x+13)>=0 && (x+13)<256) p[13] = pal[d[13]|c]; + if (d[14]!=15 && (x+14)>=0 && (x+14)<256) p[14] = pal[d[14]|c]; + if (d[15]!=15 && (x+15)>=0 && (x+15)<256) p[15] = pal[d[15]|c]; + } + d += 16; + p += 256; + } + else + for (INT32 k=0;k<16;k++) { + if (d[ 0] != 15) p[ 0] = pal[d[ 0]|c]; + if (d[ 1] != 15) p[ 1] = pal[d[ 1]|c]; + if (d[ 2] != 15) p[ 2] = pal[d[ 2]|c]; + if (d[ 3] != 15) p[ 3] = pal[d[ 3]|c]; + if (d[ 4] != 15) p[ 4] = pal[d[ 4]|c]; + if (d[ 5] != 15) p[ 5] = pal[d[ 5]|c]; + if (d[ 6] != 15) p[ 6] = pal[d[ 6]|c]; + if (d[ 7] != 15) p[ 7] = pal[d[ 7]|c]; + if (d[ 8] != 15) p[ 8] = pal[d[ 8]|c]; + if (d[ 9] != 15) p[ 9] = pal[d[ 9]|c]; + if (d[10] != 15) p[10] = pal[d[10]|c]; + if (d[11] != 15) p[11] = pal[d[11]|c]; + if (d[12] != 15) p[12] = pal[d[12]|c]; + if (d[13] != 15) p[13] = pal[d[13]|c]; + if (d[14] != 15) p[14] = pal[d[14]|c]; + if (d[15] != 15) p[15] = pal[d[15]|c]; + + d += 16; + p += 256; + } + } + } +} + +static void drawSprites(INT32 pri) +{ + /* yyyyyyyy -ff-CCCC tttttttt ----TTTT xxxxxxxx PP-----X -------- EEEEEEEE */ + UINT16 * pal = RamCurPal + 512; + + for(UINT8 * pSpr = RamSpr + 0x1000 - 8; pSpr>=RamSpr; pSpr-=8 ) { + + if (pSpr[7]!=0xf) continue; + if (!(pri & pSpr[5])) continue; + + INT32 fx= pSpr[1] & 0x20; + INT32 fy= pSpr[1] & 0x40; + INT32 y = pSpr[0] - 16; + INT32 x = pSpr[4]; + + if (pSpr[5]&1) x = 0 - (0x100-x); + + INT32 c = (pSpr[1] & 0xf) << 4; + INT32 sprite = (pSpr[2] | (pSpr[3] << 8)) & 0x0fff; + + if (x<=-16 || x>=256 || y<=-16 || y>=224) continue; + else { + + UINT8 *d = RomGfx4 + (sprite << 8); + UINT16 * p = (UINT16 *) pBurnDraw ; + p += y * 256 + x; + + if (x<0 || x>(256-16) || y<0 || y>(224-16)) { + + + if ( fy ) { + p += 256 * 15; + + if ( fx ) + for (INT32 k=15;k>=0;k--) { + if ((y+k)>=0 && (y+k)<224) { + if (d[15]!=15 && (x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[15]|c]; + if (d[14]!=15 && (x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[14]|c]; + if (d[13]!=15 && (x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[13]|c]; + if (d[12]!=15 && (x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[12]|c]; + if (d[11]!=15 && (x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[11]|c]; + if (d[10]!=15 && (x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[10]|c]; + if (d[ 9]!=15 && (x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 9]|c]; + if (d[ 8]!=15 && (x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 8]|c]; + if (d[ 7]!=15 && (x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 7]|c]; + if (d[ 6]!=15 && (x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 6]|c]; + if (d[ 5]!=15 && (x+10)>=0 && (x+10)<256) p[10] = pal[d[ 5]|c]; + if (d[ 4]!=15 && (x+11)>=0 && (x+11)<256) p[11] = pal[d[ 4]|c]; + if (d[ 3]!=15 && (x+12)>=0 && (x+12)<256) p[12] = pal[d[ 3]|c]; + if (d[ 2]!=15 && (x+13)>=0 && (x+13)<256) p[13] = pal[d[ 2]|c]; + if (d[ 1]!=15 && (x+14)>=0 && (x+14)<256) p[14] = pal[d[ 1]|c]; + if (d[ 0]!=15 && (x+15)>=0 && (x+15)<256) p[15] = pal[d[ 0]|c]; + } + d += 16; + p -= 256; + } + else + for (INT32 k=15;k>=0;k--) { + if ((y+k)>=0 && (y+k)<224) { + if (d[ 0]!=15 && (x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[ 0]|c]; + if (d[ 1]!=15 && (x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[ 1]|c]; + if (d[ 2]!=15 && (x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[ 2]|c]; + if (d[ 3]!=15 && (x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[ 3]|c]; + if (d[ 4]!=15 && (x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[ 4]|c]; + if (d[ 5]!=15 && (x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[ 5]|c]; + if (d[ 6]!=15 && (x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 6]|c]; + if (d[ 7]!=15 && (x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 7]|c]; + if (d[ 8]!=15 && (x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 8]|c]; + if (d[ 9]!=15 && (x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 9]|c]; + if (d[10]!=15 && (x+10)>=0 && (x+10)<256) p[10] = pal[d[10]|c]; + if (d[11]!=15 && (x+11)>=0 && (x+11)<256) p[11] = pal[d[11]|c]; + if (d[12]!=15 && (x+12)>=0 && (x+12)<256) p[12] = pal[d[12]|c]; + if (d[13]!=15 && (x+13)>=0 && (x+13)<256) p[13] = pal[d[13]|c]; + if (d[14]!=15 && (x+14)>=0 && (x+14)<256) p[14] = pal[d[14]|c]; + if (d[15]!=15 && (x+15)>=0 && (x+15)<256) p[15] = pal[d[15]|c]; + } + d += 16; + p -= 256; + } + + } else { + + if ( fx ) + for (INT32 k=0;k<16;k++) { + if ((y+k)>=0 && (y+k)<224) { + if (d[15]!=15 && (x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[15]|c]; + if (d[14]!=15 && (x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[14]|c]; + if (d[13]!=15 && (x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[13]|c]; + if (d[12]!=15 && (x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[12]|c]; + if (d[11]!=15 && (x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[11]|c]; + if (d[10]!=15 && (x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[10]|c]; + if (d[ 9]!=15 && (x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 9]|c]; + if (d[ 8]!=15 && (x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 8]|c]; + if (d[ 7]!=15 && (x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 7]|c]; + if (d[ 6]!=15 && (x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 6]|c]; + if (d[ 5]!=15 && (x+10)>=0 && (x+10)<256) p[10] = pal[d[ 5]|c]; + if (d[ 4]!=15 && (x+11)>=0 && (x+11)<256) p[11] = pal[d[ 4]|c]; + if (d[ 3]!=15 && (x+12)>=0 && (x+12)<256) p[12] = pal[d[ 3]|c]; + if (d[ 2]!=15 && (x+13)>=0 && (x+13)<256) p[13] = pal[d[ 2]|c]; + if (d[ 1]!=15 && (x+14)>=0 && (x+14)<256) p[14] = pal[d[ 1]|c]; + if (d[ 0]!=15 && (x+15)>=0 && (x+15)<256) p[15] = pal[d[ 0]|c]; + } + d += 16; + p += 256; + } + else + for (INT32 k=0;k<16;k++) { + if ((y+k)>=0 && (y+k)<224) { + if (d[ 0]!=15 && (x+ 0)>=0 && (x+ 0)<256) p[ 0] = pal[d[ 0]|c]; + if (d[ 1]!=15 && (x+ 1)>=0 && (x+ 1)<256) p[ 1] = pal[d[ 1]|c]; + if (d[ 2]!=15 && (x+ 2)>=0 && (x+ 2)<256) p[ 2] = pal[d[ 2]|c]; + if (d[ 3]!=15 && (x+ 3)>=0 && (x+ 3)<256) p[ 3] = pal[d[ 3]|c]; + if (d[ 4]!=15 && (x+ 4)>=0 && (x+ 4)<256) p[ 4] = pal[d[ 4]|c]; + if (d[ 5]!=15 && (x+ 5)>=0 && (x+ 5)<256) p[ 5] = pal[d[ 5]|c]; + if (d[ 6]!=15 && (x+ 6)>=0 && (x+ 6)<256) p[ 6] = pal[d[ 6]|c]; + if (d[ 7]!=15 && (x+ 7)>=0 && (x+ 7)<256) p[ 7] = pal[d[ 7]|c]; + if (d[ 8]!=15 && (x+ 8)>=0 && (x+ 8)<256) p[ 8] = pal[d[ 8]|c]; + if (d[ 9]!=15 && (x+ 9)>=0 && (x+ 9)<256) p[ 9] = pal[d[ 9]|c]; + if (d[10]!=15 && (x+10)>=0 && (x+10)<256) p[10] = pal[d[10]|c]; + if (d[11]!=15 && (x+11)>=0 && (x+11)<256) p[11] = pal[d[11]|c]; + if (d[12]!=15 && (x+12)>=0 && (x+12)<256) p[12] = pal[d[12]|c]; + if (d[13]!=15 && (x+13)>=0 && (x+13)<256) p[13] = pal[d[13]|c]; + if (d[14]!=15 && (x+14)>=0 && (x+14)<256) p[14] = pal[d[14]|c]; + if (d[15]!=15 && (x+15)>=0 && (x+15)<256) p[15] = pal[d[15]|c]; + } + d += 16; + p += 256; + } + } + + } else { + + if ( fy ) { + + p += 256 * 15; + + if ( fx ) { + + for (INT32 k=15;k>=0;k--) { + if (d[15] != 15) p[ 0] = pal[d[15]|c]; + if (d[14] != 15) p[ 1] = pal[d[14]|c]; + if (d[13] != 15) p[ 2] = pal[d[13]|c]; + if (d[12] != 15) p[ 3] = pal[d[12]|c]; + if (d[11] != 15) p[ 4] = pal[d[11]|c]; + if (d[10] != 15) p[ 5] = pal[d[10]|c]; + if (d[ 9] != 15) p[ 6] = pal[d[ 9]|c]; + if (d[ 8] != 15) p[ 7] = pal[d[ 8]|c]; + if (d[ 7] != 15) p[ 8] = pal[d[ 7]|c]; + if (d[ 6] != 15) p[ 9] = pal[d[ 6]|c]; + if (d[ 5] != 15) p[10] = pal[d[ 5]|c]; + if (d[ 4] != 15) p[11] = pal[d[ 4]|c]; + if (d[ 3] != 15) p[12] = pal[d[ 3]|c]; + if (d[ 2] != 15) p[13] = pal[d[ 2]|c]; + if (d[ 1] != 15) p[14] = pal[d[ 1]|c]; + if (d[ 0] != 15) p[15] = pal[d[ 0]|c]; + + d += 16; + p -= 256; + } + + } else { + + for (INT32 k=15;k>=0;k--) { + if (d[ 0] != 15) p[ 0] = pal[d[ 0]|c]; + if (d[ 1] != 15) p[ 1] = pal[d[ 1]|c]; + if (d[ 2] != 15) p[ 2] = pal[d[ 2]|c]; + if (d[ 3] != 15) p[ 3] = pal[d[ 3]|c]; + if (d[ 4] != 15) p[ 4] = pal[d[ 4]|c]; + if (d[ 5] != 15) p[ 5] = pal[d[ 5]|c]; + if (d[ 6] != 15) p[ 6] = pal[d[ 6]|c]; + if (d[ 7] != 15) p[ 7] = pal[d[ 7]|c]; + if (d[ 8] != 15) p[ 8] = pal[d[ 8]|c]; + if (d[ 9] != 15) p[ 9] = pal[d[ 9]|c]; + if (d[10] != 15) p[10] = pal[d[10]|c]; + if (d[11] != 15) p[11] = pal[d[11]|c]; + if (d[12] != 15) p[12] = pal[d[12]|c]; + if (d[13] != 15) p[13] = pal[d[13]|c]; + if (d[14] != 15) p[14] = pal[d[14]|c]; + if (d[15] != 15) p[15] = pal[d[15]|c]; + + d += 16; + p -= 256; + } + + } + + } else { + + if ( fx ) { + + for (INT32 k=0;k<16;k++) { + if (d[15] != 15) p[ 0] = pal[d[15]|c]; + if (d[14] != 15) p[ 1] = pal[d[14]|c]; + if (d[13] != 15) p[ 2] = pal[d[13]|c]; + if (d[12] != 15) p[ 3] = pal[d[12]|c]; + if (d[11] != 15) p[ 4] = pal[d[11]|c]; + if (d[10] != 15) p[ 5] = pal[d[10]|c]; + if (d[ 9] != 15) p[ 6] = pal[d[ 9]|c]; + if (d[ 8] != 15) p[ 7] = pal[d[ 8]|c]; + if (d[ 7] != 15) p[ 8] = pal[d[ 7]|c]; + if (d[ 6] != 15) p[ 9] = pal[d[ 6]|c]; + if (d[ 5] != 15) p[10] = pal[d[ 5]|c]; + if (d[ 4] != 15) p[11] = pal[d[ 4]|c]; + if (d[ 3] != 15) p[12] = pal[d[ 3]|c]; + if (d[ 2] != 15) p[13] = pal[d[ 2]|c]; + if (d[ 1] != 15) p[14] = pal[d[ 1]|c]; + if (d[ 0] != 15) p[15] = pal[d[ 0]|c]; + + d += 16; + p += 256; + } + + } else { + + for (INT32 k=0;k<16;k++) { + if (d[ 0] != 15) p[ 0] = pal[d[ 0]|c]; + if (d[ 1] != 15) p[ 1] = pal[d[ 1]|c]; + if (d[ 2] != 15) p[ 2] = pal[d[ 2]|c]; + if (d[ 3] != 15) p[ 3] = pal[d[ 3]|c]; + if (d[ 4] != 15) p[ 4] = pal[d[ 4]|c]; + if (d[ 5] != 15) p[ 5] = pal[d[ 5]|c]; + if (d[ 6] != 15) p[ 6] = pal[d[ 6]|c]; + if (d[ 7] != 15) p[ 7] = pal[d[ 7]|c]; + if (d[ 8] != 15) p[ 8] = pal[d[ 8]|c]; + if (d[ 9] != 15) p[ 9] = pal[d[ 9]|c]; + if (d[10] != 15) p[10] = pal[d[10]|c]; + if (d[11] != 15) p[11] = pal[d[11]|c]; + if (d[12] != 15) p[12] = pal[d[12]|c]; + if (d[13] != 15) p[13] = pal[d[13]|c]; + if (d[14] != 15) p[14] = pal[d[14]|c]; + if (d[15] != 15) p[15] = pal[d[15]|c]; + + d += 16; + p += 256; + } + + } + + } + } + } + + } + +} + +static void drawText() +{ + /* TT-- cccc tttt tttt */ + UINT16 * pal = RamCurPal + 768; + INT32 offs, mx, my, x, y; + + mx = 0; + my = -1; + for (offs = 0; offs < 32*32; offs++) { + my++; + if (my == 32) { + my = 0; + mx++; + } + x = mx * 8; + y = my * 8 - 16; + + if ( y<0 || y>=224) continue; + else { + UINT32 tileno = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x00FF) | ((BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0xC000) >> 6); + if (tileno == 0) continue; + UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x0F00) >> 4; + UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x; + UINT8 *d = RomGfx1 + (tileno << 6); + + for (INT32 k=0;k<8;k++) { + if (d[0] != 15) p[0] = pal[d[0]|c]; + if (d[1] != 15) p[1] = pal[d[1]|c]; + if (d[2] != 15) p[2] = pal[d[2]|c]; + if (d[3] != 15) p[3] = pal[d[3]|c]; + if (d[4] != 15) p[4] = pal[d[4]|c]; + if (d[5] != 15) p[5] = pal[d[5]|c]; + if (d[6] != 15) p[6] = pal[d[6]|c]; + if (d[7] != 15) p[7] = pal[d[7]|c]; + d += 8; + p += 256; + } + } + } +} + +static void drawTextAlt() +{ + /* TT-- cccc tttt tttt */ + UINT16 * pal = RamCurPal + 768; + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 32*32; offs++) { + mx++; + if (mx == 32) { + mx = 0; + my++; + } + x = mx * 8; + y = my * 8 - 16; + + if ( y<0 || y>=224) continue; + else { + UINT32 tileno = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x00FF) | ((BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0xC000) >> 6); + if (tileno == 0) continue; + UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x0F00) >> 4; + UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x; + UINT8 *d = RomGfx1 + (tileno << 6); + + for (INT32 k=0;k<8;k++) { + if (d[0] != 15) p[0] = pal[d[0]|c]; + if (d[1] != 15) p[1] = pal[d[1]|c]; + if (d[2] != 15) p[2] = pal[d[2]|c]; + if (d[3] != 15) p[3] = pal[d[3]|c]; + if (d[4] != 15) p[4] = pal[d[4]|c]; + if (d[5] != 15) p[5] = pal[d[5]|c]; + if (d[6] != 15) p[6] = pal[d[6]|c]; + if (d[7] != 15) p[7] = pal[d[7]|c]; + d += 8; + p += 256; + } + } + } +} + +static void DrvDraw() +{ + drawBackground(); + drawSprites(0x40); + drawForeground(); + drawSprites(0x80); + drawText(); +} + +static INT32 DrvFrame() +{ + if (DrvReset) DrvDoReset(); + + if (bRecalcPalette) { + for (INT32 i=0;i<(0x1000/2);i++) + RamCurPal[i] = CalcCol(i << 1); + bRecalcPalette = 0; + } + + DrvInput[0] = 0x00; // Buttons + DrvInput[1] = 0x00; // Joy1 + DrvInput[2] = 0x00; // Joy2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvButton[i] & 1) << i; + DrvInput[1] |= (DrvJoy1[i] & 1) << i; + DrvInput[2] |= (DrvJoy2[i] & 1) << i; + } + + VezNewFrame(); + ZetNewFrame(); + + for (INT32 i=0; i<200; i++) { + VezOpen(0); + VezRun(10000000 / 60 / 200); + VezClose(); + VezOpen(1); + VezRun(10000000 / 60 / 200); + VezClose(); + ZetOpen(0); + BurnTimerUpdateYM3812(i * ((3579545 / 60) / 200)); + ZetClose(); + } + + VezOpen(0); + VezSetIRQLineAndVector(0, 0xc8/4, VEZ_IRQSTATUS_ACK); + VezClose(); + + VezOpen(1); + VezSetIRQLineAndVector(0, 0xc8/4, VEZ_IRQSTATUS_ACK); + VezClose(); + +// ZetOpen(0); +// ZetRun( 3579545 / 60 ); +// ZetClose(); + + if (pBurnDraw) DrvDraw(); + + ZetOpen(0); + BurnTimerEndFrameYM3812(3579545 / 60); + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + return 0; +} + +static void DrvDrawAlt() +{ + drawBackground(); + drawSprites(0x40); + drawForeground(); + drawSprites(0x80); + drawTextAlt(); +} + +static INT32 DrvFrameAlt() +{ + if (DrvReset) DrvDoReset(); + + if (bRecalcPalette) { + for (INT32 i=0;i<(0x1000/2);i++) + RamCurPal[i] = CalcCol(i << 1); + bRecalcPalette = 0; + } + + DrvInput[0] = 0x00; // Buttons + DrvInput[1] = 0x00; // Joy1 + DrvInput[2] = 0x00; // Joy2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvButton[i] & 1) << i; + DrvInput[1] |= (DrvJoy1[i] & 1) << i; + DrvInput[2] |= (DrvJoy2[i] & 1) << i; + } + + VezNewFrame(); + ZetNewFrame(); + + for (INT32 i=0; i<120; i++) { + VezOpen(0); + VezRun(10000000 / 60 / 120); + VezClose(); + VezOpen(1); + VezRun(10000000 / 60 / 120); + VezClose(); + } + + VezOpen(0); + VezSetIRQLineAndVector(0, 0xc8/4, VEZ_IRQSTATUS_ACK); + VezClose(); + + VezOpen(1); + VezSetIRQLineAndVector(0, 0xc8/4, VEZ_IRQSTATUS_ACK); + VezClose(); + +// ZetOpen(0); +// ZetRun( 3579545 / 60 ); +// ZetClose(); + + if (pBurnDraw) DrvDrawAlt(); + + ZetOpen(0); + BurnTimerEndFrameYM3812(3579545 / 60); + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + if ( pnMin ) *pnMin = 0x029671; + + struct BurnArea ba; + + if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + if (nAction & ACB_WRITE) + bRecalcPalette = 1; + } + + if (nAction & ACB_DRIVER_DATA) { + + VezScan(nAction); + ZetScan(nAction); + + BurnYM3812Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + + INT32 cbank; + if (nAction & ACB_WRITE) { + SCAN_VAR(cbank); + set_seibu_bank(cbank); + } else { + cbank = seibu_bank; + SCAN_VAR(cbank); + } + + SCAN_VAR(DrvInput); + + SCAN_VAR(main2sub); + SCAN_VAR(sub2main); + SCAN_VAR(main2sub_pending); + SCAN_VAR(sub2main_pending); + SCAN_VAR(z80_irq1); + SCAN_VAR(z80_irq2); + } + + return 0; +} + +struct BurnDriver BurnDrvRaiden = { + "raiden", NULL, NULL, NULL, "1990", + "Raiden (set 1)\0", NULL, "Seibu Kaihatsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, raidenRomInfo, raidenRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, + DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, + 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvRaidena = { + "raidena", "raiden", NULL, NULL, "1990", + "Raiden (set 2)\0", NULL, "Seibu Kaihatsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, raidenaRomInfo, raidenaRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, + DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, + 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvRaident = { + "raident", "raiden", NULL, NULL, "1990", + "Raiden (Taiwan)\0", NULL, "Seibu Kaihatsu (Liang HWA Electronics license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, raidentRomInfo, raidentRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, + DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, + 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvRaidenu = { + "raidenu", "raiden", NULL, NULL, "1990", + "Raiden (US, set 1)\0", NULL, "Seibu Kaihatsu (Fabtek license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, raidenuRomInfo, raidenuRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, + DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, + 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvRaidenk = { + "raidenk", "raiden", NULL, NULL, "1990", + "Raiden (Korea)\0", NULL, "Seibu Kaihatsu (IBL Corporation license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, raidenkRomInfo, raidenkRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, + DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, + 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvRaidenb = { + "raidenb", "raiden", NULL, NULL, "1990", + "Raiden (set 3, Alternate hardware)\0", NULL, "Seibu Kaihatsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, raidenbRomInfo, raidenbRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, &bRecalcPalette, 0x1000, + 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvRaidenua = { + "raidenua", "raiden", NULL, NULL, "1990", + "Raiden (US, set 2, SEI8904 + SEI9008 PCBs)\0", NULL, "Seibu Kaihatsu (Fabtek license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, raidenuaRomInfo, raidenuaRomName, NULL, NULL, raidenInputInfo, raidenDIPInfo, + DrvInit, DrvExit, DrvFrameAlt, NULL, DrvScan, &bRecalcPalette, 0x1000, + 224, 256, 3, 4 +}; diff --git a/src/burn/drv/pst90s/d_seta.cpp b/src/burn/drv/pst90s/d_seta.cpp index e02bf40eb..0165c4d66 100644 --- a/src/burn/drv/pst90s/d_seta.cpp +++ b/src/burn/drv/pst90s/d_seta.cpp @@ -1,10212 +1,10210 @@ -// FB Alpha Seta driver module -// Based on MAME driver by Luca Elia - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2612.h" -#include "burn_ym3812.h" -#include "burn_gun.h" -#include "msm6295.h" -#include "x1010.h" - -/* - To do: - further simulate m65c02 games - calibr50, usclassc, krazybowl, downtown need analog inputs hooked up... - flipscreen support - jockeyc needs work... -*/ - -#define NOIRQ2 0x80 -#define SET_IRQLINES(vblank, irq2) (((vblank) << 8) | (irq2)) -#define SPRITE_BUFFER 1 -#define NO_SPRITE_BUFFER 0 -#define SET_GFX_DECODE(n0, n1, n2) n0, n1, n2 - -static UINT8 *AllMem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *AllRam = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Drv68KROM = NULL; -static UINT8 *DrvSubROM = NULL; -static UINT8 *DrvGfxROM0 = NULL; -static UINT8 *DrvGfxROM1 = NULL; -static UINT8 *DrvGfxROM2 = NULL; -static UINT8 *DrvColPROM = NULL; -static UINT8 *DrvSndROM = NULL; -static UINT8 *Drv68KRAM = NULL; -static UINT8 *Drv68KRAM2 = NULL; -static UINT8 *DrvSubRAM = NULL; -static UINT8 *DrvShareRAM = NULL; -static UINT8 *DrvNVRAM = NULL; -static UINT8 *DrvPalRAM = NULL; -static UINT8 *DrvSprRAM0 = NULL; -static UINT8 *DrvSprRAM1 = NULL; -static UINT8 *DrvVidRAM0 = NULL; -static UINT8 *DrvVidRAM1 = NULL; -static UINT8 *DrvVIDCTRLRAM0 = NULL; -static UINT8 *DrvVIDCTRLRAM1 = NULL; -static UINT8 *DrvVideoRegs = NULL; - -static UINT32 *Palette = NULL; -static UINT32 *DrvPalette = NULL; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch = NULL; -static UINT8 *tilebank = NULL; -static UINT32 *tile_offset = NULL; - -static INT32 cpuspeed = 0; -static INT32 irqtype = 0; -static INT32 buffer_sprites = 0; -static INT32 DrvROMLen[5] = { 0, 0, 0, 0, 0 }; -static INT32 DrvGfxMask[3] = { 0, 0, 0 }; -static UINT8 *DrvGfxTransMask[3] = { NULL, NULL, NULL }; -static INT32 VideoOffsets[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } }; -static INT32 ColorOffsets[3] = { 0, 0, 0 }; -static INT32 ColorDepths[3]; -static INT32 twineagle = 0; -static INT32 oisipuzl_hack = 0; -static INT32 refresh_rate = 6000; - -static INT32 seta_samples_bank = 0; -static INT32 usclssic_port_select = 0; -static INT32 tndrcade_init_sim = 0; -static INT32 gun_input_bit = 0; -static INT32 gun_input_src = 0; - -static INT32 watchdog_enable = 0; -static INT32 watchdog = 0; -static INT32 flipscreen; - -static INT32 DrvAxis[4]; -static UINT16 DrvAnalogInput[4]; -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvJoy4[16]; -static UINT8 DrvJoy5[16]; -static UINT8 DrvJoy6[16]; -static UINT8 DrvJoy7[16]; -static UINT8 DrvDips[7]; -static UINT16 DrvInputs[7]; -static UINT8 DrvReset; - -#define A(a, b, c, d) { a, b, (UINT8*)(c), d } - -static struct BurnInputInfo QzkklogyInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 4" }, - {"P1 Button 5", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 5" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 4" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Qzkklogy) - -static struct BurnInputInfo DrgnunitInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Drgnunit) - -static struct BurnInputInfo StgInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Stg) - -static struct BurnInputInfo Qzkklgy2InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 4" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 4" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Qzkklgy2) - -static struct BurnInputInfo DaiohInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvJoy4 + 0, "p1 fire 4" }, - {"P1 Button 5", BIT_DIGITAL, DrvJoy4 + 1, "p1 fire 5" }, - {"P1 Button 6", BIT_DIGITAL, DrvJoy4 + 2, "p1 fire 6" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, DrvJoy4 + 3, "p2 fire 4" }, - {"P2 Button 5", BIT_DIGITAL, DrvJoy4 + 4, "p2 fire 5" }, - {"P2 Button 6", BIT_DIGITAL, DrvJoy4 + 5, "p2 fire 6" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Daioh) - -static struct BurnInputInfo RezonInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Rezon) - -static struct BurnInputInfo EightfrcInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Eightfrc) - -static struct BurnInputInfo WrofaeroInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Wrofaero) - -static struct BurnInputInfo ZingzipInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Zingzip) - -static struct BurnInputInfo MsgundamInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Msgundam) - -static struct BurnInputInfo KamenridInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Kamenrid) - -static struct BurnInputInfo MadsharkInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Madshark) - -static struct BurnInputInfo WitsInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"P3 Start", BIT_DIGITAL, DrvJoy4 + 7, "p3 start" }, - {"P3 Up", BIT_DIGITAL, DrvJoy4 + 2, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy4 + 3, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy4 + 0, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy4 + 1, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p3 fire 2" }, - - {"P4 Start", BIT_DIGITAL, DrvJoy5 + 7, "p4 start" }, - {"P4 Up", BIT_DIGITAL, DrvJoy5 + 2, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvJoy5 + 3, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvJoy5 + 0, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvJoy5 + 1, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy5 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy5 + 5, "p4 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Wits) - -static struct BurnInputInfo ThunderlInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Thunderl) - -static struct BurnInputInfo AtehateInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 4" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 4" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Atehate) - -static struct BurnInputInfo BlockcarInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Blockcar) - -static struct BurnInputInfo GundharaInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Gundhara) - -static struct BurnInputInfo BlandiaInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Blandia) - -static struct BurnInputInfo OisipuzlInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 3, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Oisipuzl) - -static struct BurnInputInfo PairloveInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Pairlove) - -static struct BurnInputInfo OrbsInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Orbs) - -static struct BurnInputInfo KeroppiInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Keroppi) - -static struct BurnInputInfo JjsquawkInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Jjsquawk) - -static struct BurnInputInfo ExtdwnhlInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Extdwnhl) - -static struct BurnInputInfo KrzybowlInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - // space holders for analog inputs - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 8, "p1 fire 4" }, - {"P1 Button 5", BIT_DIGITAL, DrvJoy1 + 9, "p1 fire 5" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - // space holders for analog inputs - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 8, "p2 fire 4" }, - {"P2 Button 5", BIT_DIGITAL, DrvJoy2 + 9, "p2 fire 5" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Krzybowl) - -static struct BurnInputInfo UtoukondInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Utoukond) - -static struct BurnInputInfo TndrcadeInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 5, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Tndrcade) - -static struct BurnInputInfo DowntownInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, -// fake to make space for analog - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 9, "p1 fire 4" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 6, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, -// fake to make space for analog - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 9, "p2 fire 4" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 5, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 4, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Downtown) - -static struct BurnInputInfo MetafoxInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 6, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 5, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 4, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Metafox) - -static struct BurnInputInfo ZombraidInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "mouse button 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "mouse button 2" }, - A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "mouse x-axis"), - A("P1 Up / Down", BIT_ANALOG_REL, DrvAxis + 1, "mouse y-axis"), - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 2, "p2 x-axis"), - A("P2 Up / Down", BIT_ANALOG_REL, DrvAxis + 3, "p2 y-axis"), - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Zombraid) - -static struct BurnInputInfo KiwameInputList[] = { - {"Coin 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"Coin 2", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"Start", BIT_DIGITAL, DrvJoy4 + 5, "p1 start" }, - {"A", BIT_DIGITAL, DrvJoy4 + 0, "mah a" }, - {"B", BIT_DIGITAL, DrvJoy3 + 0, "mah b" }, - {"C", BIT_DIGITAL, DrvJoy5 + 0, "mah c" }, - {"D", BIT_DIGITAL, DrvJoy6 + 0, "mah d" }, - {"E", BIT_DIGITAL, DrvJoy4 + 1, "mah e" }, - {"F", BIT_DIGITAL, DrvJoy2 + 3, "mah f" }, - {"G", BIT_DIGITAL, DrvJoy5 + 1, "mah g" }, - {"H", BIT_DIGITAL, DrvJoy6 + 1, "mah h" }, - {"I", BIT_DIGITAL, DrvJoy4 + 2, "mah i" }, - {"J", BIT_DIGITAL, DrvJoy3 + 2, "mah j" }, - {"K", BIT_DIGITAL, DrvJoy4 + 4, "mah k" }, - {"L", BIT_DIGITAL, DrvJoy2 + 0, "mah l" }, - {"M", BIT_DIGITAL, DrvJoy4 + 3, "mah m" }, - {"N", BIT_DIGITAL, DrvJoy3 + 3, "mah n" }, - {"Pon", BIT_DIGITAL, DrvJoy6 + 3, "mah pon" }, - {"Chi", BIT_DIGITAL, DrvJoy5 + 3, "mah chi" }, - {"Kan", BIT_DIGITAL, DrvJoy4 + 4, "mah kan" }, - {"Ron", BIT_DIGITAL, DrvJoy5 + 4, "mah ron" }, - {"Reach", BIT_DIGITAL, DrvJoy3 + 4, "mah reach" }, - {"Flip Flip", BIT_DIGITAL, DrvJoy2 + 3, "mah ff" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Kiwame) - -static struct BurnInputInfo SokonukeInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Sokonuke) - -static struct BurnInputInfo NeobattlInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Neobattl) - -static struct BurnInputInfo UmanclubInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Umanclub) - -static struct BurnInputInfo TwineaglInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 5, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Twineagl) - -static struct BurnInputInfo CrazyfgtInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 top-center", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, - {"P1 bottom-center", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, - {"P1 top-left", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 3" }, - {"P1 bottom-left", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 4" }, - {"P1 top-right", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 5" }, - {"P1 bottom-right", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 6" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 7, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Crazyfgt) - -static struct BurnInputInfo Calibr50InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, -// fake to make space for analog inputs... - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 6, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, -// fake to make space for analog inputs... - - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 5, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 4, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Calibr50) - -static struct BurnInputInfo UsclssicInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 14, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy3 + 13, "p1 fire 1" }, -// space holder for analog inputs - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy3 + 0, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy5 + 14, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy5 + 13, "p2 fire 1" }, -// space holder for analog inputs - {"P2 Button 2", BIT_DIGITAL, DrvJoy4 + 0, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy5 + 0, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 7, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Usclssic) - -static struct BurnInputInfo JockeycInputList[] = { - {"P1 A Coin", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin" }, - {"P1 B Coin", BIT_DIGITAL, DrvJoy1 + 4, "p3 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy4 + 3, "p1 start" }, - {"P1 Bet 1", BIT_DIGITAL, DrvJoy3 + 0, "p1 bet 1" }, - {"P1 Bet 2", BIT_DIGITAL, DrvJoy3 + 1, "p1 bet 2" }, - {"P1 Bet 3", BIT_DIGITAL, DrvJoy3 + 2, "p1 bet 3" }, - {"P1 Bet 4", BIT_DIGITAL, DrvJoy3 + 3, "p1 bet 4" }, - {"P1 Bet 5", BIT_DIGITAL, DrvJoy3 + 4, "p1 bet 5" }, - {"P1 Bet 6", BIT_DIGITAL, DrvJoy4 + 0, "p1 bet 6" }, - {"P1 Bet 1-2", BIT_DIGITAL, DrvJoy5 + 0, "p1 bet 1-2" }, - {"P1 Bet 1-3", BIT_DIGITAL, DrvJoy5 + 1, "p1 bet 1-3" }, - {"P1 Bet 1-4", BIT_DIGITAL, DrvJoy5 + 2, "p1 bet 1-4" }, - {"P1 Bet 1-5", BIT_DIGITAL, DrvJoy5 + 3, "p1 bet 1-5" }, - {"P1 Bet 1-6", BIT_DIGITAL, DrvJoy5 + 4, "p1 bet 1-6" }, - {"P1 Bet 2-3", BIT_DIGITAL, DrvJoy6 + 0, "p1 bet 2-3" }, - {"P1 Bet 2-4", BIT_DIGITAL, DrvJoy6 + 1, "p1 bet 2-4" }, - {"P1 Bet 2-5", BIT_DIGITAL, DrvJoy6 + 2, "p1 bet 2-5" }, - {"P1 Bet 2-6", BIT_DIGITAL, DrvJoy6 + 3, "p1 bet 2-6" }, - {"P1 Bet 3-4", BIT_DIGITAL, DrvJoy6 + 4, "p1 bet 3-4" }, - {"P1 Bet 3-5", BIT_DIGITAL, DrvJoy7 + 0, "p1 bet 3-5" }, - {"P1 Bet 3-6", BIT_DIGITAL, DrvJoy7 + 1, "p1 bet 3-6" }, - {"P1 Bet 4-5", BIT_DIGITAL, DrvJoy7 + 2, "p1 bet 4-5" }, - {"P1 Bet 4-6", BIT_DIGITAL, DrvJoy7 + 3, "p1 bet 4-6" }, - {"P1 Bet 5-6", BIT_DIGITAL, DrvJoy7 + 4, "p1 bet 5-6" }, - {"P1 Collect", BIT_DIGITAL, DrvJoy4 + 1, "p1 collect" }, - {"P1 Credit", BIT_DIGITAL, DrvJoy4 + 2, "p1 credit" }, - {"P1 Cancel", BIT_DIGITAL, DrvJoy4 + 4, "p1 cancel" }, - - {"P2 A Coin", BIT_DIGITAL, DrvJoy1 + 13, "p2 coin" }, - {"P2 B Coin", BIT_DIGITAL, DrvJoy1 + 12, "p4 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy4 + 11, "p2 start" }, - {"P2 Bet 1", BIT_DIGITAL, DrvJoy3 + 8, "p2 bet 1" }, - {"P2 Bet 2", BIT_DIGITAL, DrvJoy3 + 9, "p2 bet 2" }, - {"P2 Bet 3", BIT_DIGITAL, DrvJoy3 + 10, "p2 bet 3" }, - {"P2 Bet 4", BIT_DIGITAL, DrvJoy3 + 11, "p2 bet 4" }, - {"P2 Bet 5", BIT_DIGITAL, DrvJoy3 + 12, "p2 bet 5" }, - {"P2 Bet 6", BIT_DIGITAL, DrvJoy4 + 8, "p2 bet 6" }, - {"P2 Bet 1-2", BIT_DIGITAL, DrvJoy5 + 8, "p2 bet 1-2" }, - {"P2 Bet 1-3", BIT_DIGITAL, DrvJoy5 + 9, "p2 bet 1-3" }, - {"P2 Bet 1-4", BIT_DIGITAL, DrvJoy5 + 10, "p2 bet 1-4" }, - {"P2 Bet 1-5", BIT_DIGITAL, DrvJoy5 + 11, "p2 bet 1-5" }, - {"P2 Bet 1-6", BIT_DIGITAL, DrvJoy5 + 12, "p2 bet 1-6" }, - {"P2 Bet 2-3", BIT_DIGITAL, DrvJoy6 + 8, "p2 bet 2-3" }, - {"P2 Bet 2-4", BIT_DIGITAL, DrvJoy6 + 9, "p2 bet 2-4" }, - {"P2 Bet 2-5", BIT_DIGITAL, DrvJoy6 + 10, "p2 bet 2-5" }, - {"P2 Bet 2-6", BIT_DIGITAL, DrvJoy6 + 11, "p2 bet 2-6" }, - {"P2 Bet 3-4", BIT_DIGITAL, DrvJoy6 + 12, "p2 bet 3-4" }, - {"P2 Bet 3-5", BIT_DIGITAL, DrvJoy7 + 8, "p2 bet 3-5" }, - {"P2 Bet 3-6", BIT_DIGITAL, DrvJoy7 + 9, "p2 bet 3-6" }, - {"P2 Bet 4-5", BIT_DIGITAL, DrvJoy7 + 10, "p2 bet 4-5" }, - {"P2 Bet 4-6", BIT_DIGITAL, DrvJoy7 + 11, "p2 bet 4-6" }, - {"P2 Bet 5-6", BIT_DIGITAL, DrvJoy7 + 12, "p2 bet 5-6" }, - {"P2 Collect", BIT_DIGITAL, DrvJoy4 + 9, "p2 collect" }, - {"P2 Credit", BIT_DIGITAL, DrvJoy4 + 10, "p2 credit" }, - {"P2 Cancel", BIT_DIGITAL, DrvJoy4 + 12, "p2 cancel" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 14, "service" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 0, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, - {"Dip D", BIT_DIPSWITCH, DrvDips + 3, "dip" }, - {"Dip E", BIT_DIPSWITCH, DrvDips + 4, "dip" }, - {"Dip F", BIT_DIPSWITCH, DrvDips + 5, "dip" }, - {"Dip 10", BIT_DIPSWITCH, DrvDips + 6, "dip" }, -}; - -STDINPUTINFO(Jockeyc) - -#undef A - -static struct BurnDIPInfo CrazyfgtDIPList[]= -{ - {0x09, 0xff, 0xff, 0x3f, NULL }, - {0x0a, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x09, 0x01, 0x07, 0x00, "4 Coins 1 Credits" }, - {0x09, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, - {0x09, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, - {0x09, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x09, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x09, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x09, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x09, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x09, 0x01, 0x38, 0x00, "4 Coins 1 Credits" }, - {0x09, 0x01, 0x38, 0x08, "3 Coins 1 Credits" }, - {0x09, 0x01, 0x38, 0x10, "2 Coins 1 Credits" }, - {0x09, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x09, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x09, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x09, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, - {0x09, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 4, "Unknown" }, - {0x09, 0x01, 0xc0, 0xc0, "5" }, - {0x09, 0x01, 0xc0, 0x80, "10" }, - {0x09, 0x01, 0xc0, 0x40, "15" }, - {0x09, 0x01, 0xc0, 0x00, "20" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0a, 0x01, 0x01, 0x01, "Off" }, - {0x0a, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty?" }, - {0x0a, 0x01, 0x0c, 0x0c, "0" }, - {0x0a, 0x01, 0x0c, 0x08, "1" }, - {0x0a, 0x01, 0x0c, 0x04, "2" }, - {0x0a, 0x01, 0x0c, 0x00, "3" }, - - {0 , 0xfe, 0 , 4, "Energy" }, - {0x0a, 0x01, 0x30, 0x10, "24" }, - {0x0a, 0x01, 0x30, 0x20, "32" }, - {0x0a, 0x01, 0x30, 0x30, "48" }, - {0x0a, 0x01, 0x30, 0x00, "100" }, - - {0 , 0xfe, 0 , 4, "Bonus?" }, - {0x0a, 0x01, 0xc0, 0xc0, "0" }, - {0x0a, 0x01, 0xc0, 0x80, "1" }, - {0x0a, 0x01, 0xc0, 0x40, "2" }, - {0x0a, 0x01, 0xc0, 0x00, "3" }, -}; - -STDDIPINFO(Crazyfgt) - - -static struct BurnDIPInfo UsclssicDIPList[]= -{ - {0x0d, 0xff, 0xff, 0xff, NULL }, - {0x0e, 0xff, 0xff, 0xfe, NULL }, - - {0 , 0xfe, 0 , 2, "Credits For 9-Hole" }, - {0x0d, 0x01, 0x01, 0x01, "2" }, - {0x0d, 0x01, 0x01, 0x00, "3" }, - - {0 , 0xfe, 0 , 2, "Game Type" }, - {0x0d, 0x01, 0x02, 0x02, "Domestic" }, - {0x0d, 0x01, 0x02, 0x00, "Foreign" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x0d, 0x01, 0x0c, 0x04, "1" }, - {0x0d, 0x01, 0x0c, 0x08, "2" }, - {0x0d, 0x01, 0x0c, 0x0c, "3" }, - {0x0d, 0x01, 0x0c, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x0d, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x0d, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0d, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x0d, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x0e, 0x01, 0x01, 0x00, "Upright" }, - {0x0e, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x0e, 0x01, 0x02, 0x02, "Off" }, - {0x0e, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0e, 0x01, 0x04, 0x04, "Off" }, - {0x0e, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Flight Distance" }, - {0x0e, 0x01, 0x38, 0x38, "Normal" }, - {0x0e, 0x01, 0x38, 0x30, "-30 Yards" }, - {0x0e, 0x01, 0x38, 0x28, "+10 Yards" }, - {0x0e, 0x01, 0x38, 0x20, "+20 Yards" }, - {0x0e, 0x01, 0x38, 0x18, "+30 Yards" }, - {0x0e, 0x01, 0x38, 0x10, "+40 Yards" }, - {0x0e, 0x01, 0x38, 0x08, "+50 Yards" }, - {0x0e, 0x01, 0x38, 0x00, "+60 Yards" }, - - {0 , 0xfe, 0 , 4, "Licensed To" }, - {0x0e, 0x01, 0xc0, 0xc0, "Romstar" }, - {0x0e, 0x01, 0xc0, 0x80, "None (Japan)" }, - {0x0e, 0x01, 0xc0, 0x40, "Taito" }, - {0x0e, 0x01, 0xc0, 0x00, "Taito America" }, -}; - -STDDIPINFO(Usclssic) - - -static struct BurnDIPInfo Calibr50DIPList[]= -{ - {0x15, 0xff, 0xff, 0xfe, NULL }, - {0x16, 0xff, 0xff, 0xfd, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Licensed To" }, - {0x15, 0x01, 0x01, 0x01, "Romstar" }, - {0x15, 0x01, 0x01, 0x00, "None (Japan)" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x15, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x15, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x03, 0x03, "Easiest" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x01, "Normal" }, - {0x16, 0x01, 0x03, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2, "Score Digits" }, - {0x16, 0x01, 0x04, 0x04, "7" }, - {0x16, 0x01, 0x04, 0x00, "3" }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x16, 0x01, 0x08, 0x08, "3" }, - {0x16, 0x01, 0x08, 0x00, "4" }, - - {0 , 0xfe, 0 , 2, "Display Score" }, - {0x16, 0x01, 0x10, 0x00, "Off" }, - {0x16, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2, "Erase Backup Ram" }, - {0x16, 0x01, 0x20, 0x00, "Off" }, - {0x16, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2, "Licensed To" }, - {0x16, 0x01, 0x40, 0x40, "Taito America" }, - {0x16, 0x01, 0x40, 0x40, "Taito" }, -}; - -STDDIPINFO(Calibr50) - -static struct BurnDIPInfo TwineaglDIPList[]= -{ - {0x13, 0xff, 0xff, 0xf7, NULL }, - {0x14, 0xff, 0xff, 0xf3, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Copyright" }, - {0x13, 0x01, 0x01, 0x01, "Taito" }, - {0x13, 0x01, 0x01, 0x00, "Taito America (Romstar license)" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x08, 0x00, "Upright" }, - {0x13, 0x01, 0x08, 0x08, "Cocktail" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x03, "Normal" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "Never" }, - {0x14, 0x01, 0x0c, 0x08, "500K Only" }, - {0x14, 0x01, 0x0c, 0x04, "1000K Only" }, - {0x14, 0x01, 0x0c, 0x00, "500K, Every 1500K" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x10, "1" }, - {0x14, 0x01, 0x30, 0x00, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2, "Copyright" }, - {0x14, 0x01, 0x40, 0x40, "Seta (Taito license)" }, - {0x14, 0x01, 0x40, 0x40, "Taito America" }, - - {0 , 0xfe, 0 , 2, "Coinage Type" }, - {0x14, 0x01, 0x80, 0x80, "1" }, - {0x14, 0x01, 0x80, 0x00, "2" }, -}; - -STDDIPINFO(Twineagl) - -static struct BurnDIPInfo KiwameDIPList[]= -{ - {0x19, 0xff, 0xff, 0xff, NULL }, - {0x1a, 0xff, 0xff, 0xff, NULL }, - {0x1b, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x19, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, - {0x19, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x19, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, - {0x19, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x19, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, - {0x19, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x19, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x19, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x19, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, - {0x19, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, - {0x19, 0x01, 0x38, 0x20, "2 Coins 1 Credits" }, - {0x19, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x19, 0x01, 0x38, 0x18, "2 Coins 3 Credits" }, - {0x19, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x19, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x19, 0x01, 0x38, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x19, 0x01, 0x40, 0x00, "Off" }, - {0x19, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Player's TSUMO" }, - {0x19, 0x01, 0x80, 0x80, "Manual" }, - {0x19, 0x01, 0x80, 0x00, "Auto" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x1a, 0x01, 0x01, 0x01, "Off" }, - {0x1a, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x1a, 0x01, 0x02, 0x02, "Off" }, - {0x1a, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Difficulty" }, - {0x1a, 0x01, 0x1c, 0x1c, "None" }, - {0x1a, 0x01, 0x1c, 0x18, "Prelim 1" }, - {0x1a, 0x01, 0x1c, 0x14, "Prelim 2" }, - {0x1a, 0x01, 0x1c, 0x10, "Final 1" }, - {0x1a, 0x01, 0x1c, 0x0c, "Final 2" }, - {0x1a, 0x01, 0x1c, 0x08, "Final 3" }, - {0x1a, 0x01, 0x1c, 0x04, "Qrt Final" }, - {0x1a, 0x01, 0x1c, 0x00, "SemiFinal" }, - - {0 , 0xfe, 0 , 8, "Points Gap" }, - {0x1a, 0x01, 0xe0, 0xe0, "None" }, - {0x1a, 0x01, 0xe0, 0xc0, "+6000" }, - {0x1a, 0x01, 0xe0, 0xa0, "+4000" }, - {0x1a, 0x01, 0xe0, 0x80, "+2000" }, - {0x1a, 0x01, 0xe0, 0x60, "-2000" }, - {0x1a, 0x01, 0xe0, 0x40, "-4000" }, - {0x1a, 0x01, 0xe0, 0x20, "-6000" }, - {0x1a, 0x01, 0xe0, 0x00, "-8000" }, -}; - -STDDIPINFO(Kiwame) - -static struct BurnDIPInfo MetafoxDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xb1, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Licensed To" }, - {0x13, 0x01, 0x01, 0x01, "Jordan" }, - {0x13, 0x01, 0x01, 0x00, "Taito America" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x03, "Normal" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "None" }, - {0x14, 0x01, 0x0c, 0x08, "60K Only" }, - {0x14, 0x01, 0x0c, 0x00, "60k & 90k" }, - {0x14, 0x01, 0x0c, 0x04, "90K Only" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x10, "1" }, - {0x14, 0x01, 0x30, 0x00, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2, "Licensed To" }, - {0x14, 0x01, 0x40, 0x40, "Romstar" }, - {0x14, 0x01, 0x40, 0x00, "Taito" }, - - {0 , 0xfe, 0 , 2, "Coinage Type" }, - {0x14, 0x01, 0x80, 0x80, "1" }, - {0x14, 0x01, 0x80, 0x00, "2" }, -}; - -STDDIPINFO(Metafox) - -static struct BurnDIPInfo ArbalestDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xbf, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Licensed To" }, - {0x13, 0x01, 0x01, 0x00, "Taito" }, - {0x13, 0x01, 0x01, 0x01, "Jordan" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x03, "Easy" }, - {0x14, 0x01, 0x03, 0x02, "Hard" }, - {0x14, 0x01, 0x03, 0x01, "Harder" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "Never" }, - {0x14, 0x01, 0x0c, 0x08, "300k Only" }, - {0x14, 0x01, 0x0c, 0x04, "600k Only" }, - {0x14, 0x01, 0x0c, 0x00, "300k & 600k" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x10, "1" }, - {0x14, 0x01, 0x30, 0x00, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 1, "Licensed To" }, - {0x14, 0x01, 0x40, 0x40, "Romstar" }, - - {0 , 0xfe, 0 , 2, "Coinage Type" }, - {0x14, 0x01, 0x80, 0x80, "1" }, - {0x14, 0x01, 0x80, 0x00, "2" }, -}; - -STDDIPINFO(Arbalest) - -static struct BurnDIPInfo DowntownDIPList[]= -{ - {0x15, 0xff, 0xff, 0xf6, NULL }, - {0x16, 0xff, 0xff, 0xbd, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Sales" }, - {0x15, 0x01, 0x01, 0x01, "Japan Only" }, - {0x15, 0x01, 0x01, 0x00, "World" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x08, "Off" }, - {0x15, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x15, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x15, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Normal" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x0c, "Never" }, - {0x16, 0x01, 0x0c, 0x08, "50K Only" }, - {0x16, 0x01, 0x0c, 0x04, "100K Only" }, - {0x16, 0x01, 0x0c, 0x00, "50K, Every 150K" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x30, 0x10, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x00, "4" }, - {0x16, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2, "World License" }, - {0x16, 0x01, 0x40, 0x40, "Romstar" }, - {0x16, 0x01, 0x40, 0x00, "Taito" }, - - {0 , 0xfe, 0 , 2, "Coinage Type" }, - {0x16, 0x01, 0x80, 0x80, "1" }, - {0x16, 0x01, 0x80, 0x00, "2" }, -}; - -STDDIPINFO(Downtown) - -static struct BurnDIPInfo TndrcadeDIPList[]= -{ - {0x13, 0xff, 0xff, 0x7f, NULL }, - {0x14, 0xff, 0xff, 0xf7, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x03, 0x02, "Easy" }, - {0x13, 0x01, 0x03, 0x03, "Normal" }, - {0x13, 0x01, 0x03, 0x01, "Hard" }, - {0x13, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x0c, 0x0c, "50K Only" }, - {0x13, 0x01, 0x0c, 0x04, "50K, Every 150K" }, - {0x13, 0x01, 0x0c, 0x00, "70K, Every 200K" }, - {0x13, 0x01, 0x0c, 0x08, "100K Only" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x30, 0x10, "1" }, - {0x13, 0x01, 0x30, 0x00, "2" }, - {0x13, 0x01, 0x30, 0x30, "3" }, - {0x13, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Licensed To" }, - {0x13, 0x01, 0x80, 0x80, "Taito America Corp." }, - {0x13, 0x01, 0x80, 0x00, "Taito Corp. Japan" }, - - {0 , 0xfe, 0 , 2, "Title" }, - {0x14, 0x01, 0x01, 0x01, "Thundercade" }, - {0x14, 0x01, 0x01, 0x00, "Twin Formation" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x08, 0x08, "Off" }, - {0x14, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, -}; - -STDDIPINFO(Tndrcade) - -static struct BurnDIPInfo TndrcadjDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xf7, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x03, 0x02, "Easy" }, - {0x13, 0x01, 0x03, 0x03, "Normal" }, - {0x13, 0x01, 0x03, 0x01, "Hard" }, - {0x13, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x0c, 0x0c, "50K Only" }, - {0x13, 0x01, 0x0c, 0x04, "50K, Every 150K" }, - {0x13, 0x01, 0x0c, 0x00, "70K, Every 200K" }, - {0x13, 0x01, 0x0c, 0x08, "100K Only" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x30, 0x10, "1" }, - {0x13, 0x01, 0x30, 0x00, "2" }, - {0x13, 0x01, 0x30, 0x30, "3" }, - {0x13, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Invulnerability" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x08, 0x08, "Off" }, - {0x14, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, -}; - -STDDIPINFO(Tndrcadj) - -static struct BurnDIPInfo UtoukondDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x14, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x00, "5 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x14, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x14, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x14, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x00, "1" }, - {0x15, 0x01, 0x03, 0x02, "2" }, - {0x15, 0x01, 0x03, 0x03, "3" }, - {0x15, 0x01, 0x03, 0x01, "4" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x0c, 0x08, "Easy" }, - {0x15, 0x01, 0x0c, 0x0c, "Normal" }, - {0x15, 0x01, 0x0c, 0x04, "Hard" }, - {0x15, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x10, 0x10, "Off" }, - {0x15, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x20, 0x00, "Off" }, - {0x15, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x15, 0x01, 0x40, 0x40, "100k" }, - {0x15, 0x01, 0x40, 0x00, "150k" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Utoukond) - -static struct BurnDIPInfo KrzybowlDIPList[]= -{ - {0x18, 0xff, 0xff, 0xff, NULL }, - {0x19, 0xff, 0xff, 0xff, NULL }, - {0x1a, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x18, 0x01, 0x01, 0x01, "Off" }, - {0x18, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x18, 0x01, 0x02, 0x00, "Off" }, - {0x18, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x18, 0x01, 0x0c, 0x08, "Easy" }, - {0x18, 0x01, 0x0c, 0x0c, "Normal" }, - {0x18, 0x01, 0x0c, 0x04, "Hard" }, - {0x18, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Frames" }, - {0x18, 0x01, 0x10, 0x10, "10" }, - {0x18, 0x01, 0x10, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x18, 0x01, 0x20, 0x20, "Upright" }, - {0x18, 0x01, 0x20, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Controls" }, - {0x18, 0x01, 0x40, 0x40, "Trackball" }, - {0x18, 0x01, 0x40, 0x00, "Joystick" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x18, 0x01, 0x80, 0x80, "Off" }, - {0x18, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x19, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x19, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x19, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x19, 0x01, 0x07, 0x04, "1 Coin 2 Credits" }, - {0x19, 0x01, 0x07, 0x03, "1 Coin 3 Credits" }, - {0x19, 0x01, 0x07, 0x02, "1 Coin 4 Credits" }, - {0x19, 0x01, 0x07, 0x01, "1 Coin 5 Credits" }, - {0x19, 0x01, 0x07, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x19, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, - {0x19, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, - {0x19, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x19, 0x01, 0x38, 0x20, "1 Coin 2 Credits" }, - {0x19, 0x01, 0x38, 0x18, "1 Coin 3 Credits" }, - {0x19, 0x01, 0x38, 0x10, "1 Coin 4 Credits" }, - {0x19, 0x01, 0x38, 0x08, "1 Coin 5 Credits" }, - {0x19, 0x01, 0x38, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Force Coinage" }, - {0x19, 0x01, 0x40, 0x40, "No" }, - {0x19, 0x01, 0x40, 0x00, "2 Coins 1 Credits" }, -}; - -STDDIPINFO(Krzybowl) - -static struct BurnDIPInfo ExtdwnhlDIPList[]= -{ - {0x0c, 0xff, 0xff, 0xff, NULL }, - {0x0d, 0xff, 0xff, 0xff, NULL }, - {0x0e, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x0c, 0x01, 0x01, 0x01, "Off" }, - {0x0c, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0c, 0x01, 0x02, 0x00, "Off" }, - {0x0c, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x0c, 0x01, 0x0c, 0x08, "Easy" }, - {0x0c, 0x01, 0x0c, 0x0c, "Normal" }, - {0x0c, 0x01, 0x0c, 0x04, "Hard" }, - {0x0c, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x0c, 0x01, 0x10, 0x10, "Off" }, - {0x0c, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x0c, 0x01, 0x20, 0x20, "Upright" }, - {0x0c, 0x01, 0x20, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Controls" }, - {0x0c, 0x01, 0x40, 0x40, "2" }, - {0x0c, 0x01, 0x40, 0x00, "1" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0c, 0x01, 0x80, 0x80, "Off" }, - {0x0c, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x0d, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x0d, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x0d, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x0d, 0x01, 0x07, 0x04, "1 Coin 2 Credits" }, - {0x0d, 0x01, 0x07, 0x03, "1 Coin 3 Credits" }, - {0x0d, 0x01, 0x07, 0x02, "1 Coin 4 Credits" }, - {0x0d, 0x01, 0x07, 0x01, "1 Coin 5 Credits" }, - {0x0d, 0x01, 0x07, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x0d, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, - {0x0d, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, - {0x0d, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x0d, 0x01, 0x38, 0x20, "1 Coin 2 Credits" }, - {0x0d, 0x01, 0x38, 0x18, "1 Coin 3 Credits" }, - {0x0d, 0x01, 0x38, 0x10, "1 Coin 4 Credits" }, - {0x0d, 0x01, 0x38, 0x08, "1 Coin 5 Credits" }, - {0x0d, 0x01, 0x38, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Continue Coin" }, - {0x0d, 0x01, 0x40, 0x40, "Normal: Start 1C / Continue 1C" }, - {0x0d, 0x01, 0x40, 0x00, "Half Continue: Start 2C / Continue 1C" }, - - {0 , 0xfe, 0 , 2, "Game Mode" }, - {0x0d, 0x01, 0x80, 0x80, "Finals Only" }, - {0x0d, 0x01, 0x80, 0x00, "Semi-Finals & Finals" }, - - {0 , 0xfe, 0 , 2, "Service Mode (No Toggle)" }, - {0x0e, 0x01, 0x08, 0x08, "Off" }, - {0x0e, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 3, "Country" }, - {0x0e, 0x01, 0x30, 0x30, "World" }, - {0x0e, 0x01, 0x30, 0x10, "USA" }, - {0x0e, 0x01, 0x30, 0x00, "Japan" }, -}; - -STDDIPINFO(Extdwnhl) - -static struct BurnDIPInfo SokonukeDIPList[]= -{ - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x10, 0x01, 0x01, 0x01, "Off" }, - {0x10, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x10, 0x01, 0x02, 0x00, "Off" }, - {0x10, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x10, 0x01, 0x0c, 0x08, "Easy" }, - {0x10, 0x01, 0x0c, 0x0c, "Normal" }, - {0x10, 0x01, 0x0c, 0x04, "Hard" }, - {0x10, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x10, 0x01, 0x10, 0x10, "Off" }, - {0x10, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x10, 0x01, 0x80, 0x80, "Off" }, - {0x10, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x11, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x11, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x11, 0x01, 0x07, 0x04, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x07, 0x03, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x07, 0x02, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x07, 0x01, "1 Coin 5 Credits" }, - {0x11, 0x01, 0x07, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x11, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, - {0x11, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, - {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x11, 0x01, 0x38, 0x20, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x38, 0x18, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x38, 0x10, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x38, 0x08, "1 Coin 5 Credits" }, - {0x11, 0x01, 0x38, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Cheap Continue" }, - {0x11, 0x01, 0x40, 0x40, "No" }, - {0x11, 0x01, 0x40, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, -}; - -STDDIPINFO(Sokonuke) - -static struct BurnDIPInfo JjsquawkDIPList[]= -{ - {0x12, 0xff, 0xff, 0xbf, NULL }, - {0x13, 0xff, 0xff, 0xef, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x12, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x12, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x20, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x38, 0x18, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x38, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x08, "Easy" }, - {0x13, 0x01, 0x0c, 0x0c, "Normal" }, - {0x13, 0x01, 0x0c, 0x04, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Energy" }, - {0x13, 0x01, 0x30, 0x20, "2" }, - {0x13, 0x01, 0x30, 0x30, "3" }, - {0x13, 0x01, 0x30, 0x10, "4" }, - {0x13, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0xc0, 0x80, "20K, Every 100K" }, - {0x13, 0x01, 0xc0, 0xc0, "50K, Every 200K" }, - {0x13, 0x01, 0xc0, 0x40, "70K, 200K Only" }, - {0x13, 0x01, 0xc0, 0x00, "100K Only" }, -}; - -STDDIPINFO(Jjsquawk) - -static struct BurnDIPInfo KeroppiDIPList[]= -{ - {0x04, 0xff, 0xff, 0xff, NULL }, - {0x05, 0xff, 0xff, 0xbf, NULL }, - {0x06, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Difficulty" }, - {0x04, 0x01, 0x07, 0x03, "1" }, - {0x04, 0x01, 0x07, 0x05, "2" }, - {0x04, 0x01, 0x07, 0x01, "3" }, - {0x04, 0x01, 0x07, 0x07, "4" }, - {0x04, 0x01, 0x07, 0x06, "5" }, - {0x04, 0x01, 0x07, 0x02, "6" }, - {0x04, 0x01, 0x07, 0x04, "7" }, - {0x04, 0x01, 0x07, 0x00, "8" }, - - {0 , 0xfe, 0 , 8, "Game Select" }, - {0x04, 0x01, 0x38, 0x38, "No. 1,2,3" }, - {0x04, 0x01, 0x38, 0x30, "No. 1" }, - {0x04, 0x01, 0x38, 0x28, "No. 2,3" }, - {0x04, 0x01, 0x38, 0x20, "No. 3" }, - {0x04, 0x01, 0x38, 0x18, "No. 1,2" }, - {0x04, 0x01, 0x38, 0x10, "No. 2" }, - {0x04, 0x01, 0x38, 0x08, "No. 1,3" }, - {0x04, 0x01, 0x38, 0x00, "No. 1,2,3" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x05, 0x01, 0x07, 0x00, "5 Coins 1 Credits" }, - {0x05, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, - {0x05, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x05, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x05, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x05, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, - {0x05, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x05, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x05, 0x01, 0x20, 0x20, "Off" }, - {0x05, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x05, 0x01, 0x40, 0x40, "Off" }, - {0x05, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x05, 0x01, 0x80, 0x80, "Off" }, - {0x05, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Keroppi) - -static struct BurnDIPInfo OrbsDIPList[]= -{ - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x10, 0x01, 0x01, 0x01, "Off" }, - {0x10, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x10, 0x01, 0x02, 0x00, "Off" }, - {0x10, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x10, 0x01, 0x0c, 0x08, "Easy" }, - {0x10, 0x01, 0x0c, 0x0c, "Normal" }, - {0x10, 0x01, 0x0c, 0x04, "Hard" }, - {0x10, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Stock" }, - {0x10, 0x01, 0x10, 0x10, "1" }, - {0x10, 0x01, 0x10, 0x00, "2" }, - - {0 , 0xfe, 0 , 2, "Level Select" }, - {0x10, 0x01, 0x20, 0x20, "Off" }, - {0x10, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Timer speed" }, - {0x10, 0x01, 0x40, 0x40, "Normal" }, - {0x10, 0x01, 0x40, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x10, 0x01, 0x80, 0x80, "Off" }, - {0x10, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x11, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x11, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x11, 0x01, 0x07, 0x04, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x07, 0x03, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x07, 0x02, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x07, 0x01, "1 Coin 5 Credits" }, - {0x11, 0x01, 0x07, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x11, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, - {0x11, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, - {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x11, 0x01, 0x38, 0x20, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x38, 0x18, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x38, 0x10, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x38, 0x08, "1 Coin 5 Credits" }, - {0x11, 0x01, 0x38, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "Force Coinage (Half)" }, - {0x11, 0x01, 0x40, 0x40, "No" }, - {0x11, 0x01, 0x40, 0x00, "2 Coins 1 Credits" }, -}; - -STDDIPINFO(Orbs) - -static struct BurnDIPInfo PairloveDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfd, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x0c, 0x08, "Easy" }, - {0x14, 0x01, 0x0c, 0x0c, "Normal" }, - {0x14, 0x01, 0x0c, 0x04, "Hard" }, - {0x14, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x14, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x14, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x14, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x14, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Pairlove) - -static struct BurnDIPInfo OisipuzlDIPList[]= -{ - {0x12, 0xff, 0xff, 0xfb, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Normal" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x04, 0x04, "Off" }, - {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0x07, 0x00, "5 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x03, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, -}; - -STDDIPINFO(Oisipuzl) - -static struct BurnDIPInfo BlandiaDIPList[]= -{ - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x01, 0x00, "Off" }, - {0x15, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2, "Coinage Type" }, - {0x15, 0x01, 0x02, 0x02, "1" }, - {0x15, 0x01, 0x02, 0x00, "2" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x15, 0x01, 0x1c, 0x10, "3 Coins 1 Credits" }, - {0x15, 0x01, 0x1c, 0x0c, "2 Coins 1 Credits" }, - {0x15, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x15, 0x01, 0x1c, 0x04, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x1c, 0x18, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x1c, 0x08, "2 Coins 5 Credits" }, - {0x15, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x15, 0x01, 0x1c, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x15, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x15, 0x01, 0xe0, 0x60, "2 Coins 4 Credits" }, - {0x15, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xe0, 0x80, "3 Coins/7 Credits" }, - {0x15, 0x01, 0xe0, 0x20, "2 Coins 5 Credits" }, - {0x15, 0x01, 0xe0, 0x40, "2 Coins 6 Credits" }, - {0x15, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xe0, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "1" }, - {0x16, 0x01, 0x03, 0x03, "2" }, - {0x16, 0x01, 0x03, 0x01, "3" }, - {0x16, 0x01, 0x03, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x0c, 0x08, "Easy" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Hard" }, - {0x16, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "2 Player Game" }, - {0x16, 0x01, 0x10, 0x10, "2 Credits" }, - {0x16, 0x01, 0x10, 0x00, "1 Credit" }, - - {0 , 0xfe, 0 , 2, "Continue" }, - {0x16, 0x01, 0x20, 0x20, "1 Credit" }, - {0x16, 0x01, 0x20, 0x00, "1 Coin" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x16, 0x01, 0x40, 0x40, "Off" }, - {0x16, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Blandia) - -static struct BurnDIPInfo GundharaDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x14, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x14, 0x01, 0x30, 0x00, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x14, 0x01, 0xc0, 0xc0, "Japanese" }, - {0x14, 0x01, 0xc0, 0x00, "English" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x03, 0x02, "Easy" }, - {0x15, 0x01, 0x03, 0x03, "Normal" }, - {0x15, 0x01, 0x03, 0x01, "Hard" }, - {0x15, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x0c, 0x08, "1" }, - {0x15, 0x01, 0x0c, 0x0c, "2" }, - {0x15, 0x01, 0x0c, 0x04, "3" }, - {0x15, 0x01, 0x0c, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x15, 0x01, 0x30, 0x30, "200K" }, - {0x15, 0x01, 0x30, 0x20, "200K, Every 200K" }, - {0x15, 0x01, 0x30, 0x10, "400K" }, - {0x15, 0x01, 0x30, 0x00, "None" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x40, 0x00, "Off" }, - {0x15, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x08, 0x08, "Off" }, - {0x16, 0x01, 0x08, 0x00, "On" }, -}; - -STDDIPINFO(Gundhara) - -static struct BurnDIPInfo AtehateDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xff, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x0e, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, - {0x0e, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x0e, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, - {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x0e, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x0e, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x0e, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, - {0x0e, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, - {0x0e, 0x01, 0x38, 0x20, "2 Coins 1 Credits" }, - {0x0e, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x0e, 0x01, 0x38, 0x18, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x0e, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x0e, 0x01, 0x38, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0e, 0x01, 0x40, 0x00, "Off" }, - {0x0e, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 0, "Flip Screen" }, - {0x0f, 0x01, 0x01, 0x01, "Off" }, - {0x0f, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0f, 0x01, 0x02, 0x02, "Off" }, - {0x0f, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x0f, 0x01, 0x0c, 0x08, "Easy" }, - {0x0f, 0x01, 0x0c, 0x0c, "Normal" }, - {0x0f, 0x01, 0x0c, 0x04, "Hard" }, - {0x0f, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x0f, 0x01, 0x30, 0x00, "2" }, - {0x0f, 0x01, 0x30, 0x30, "3" }, - {0x0f, 0x01, 0x30, 0x10, "4" }, - {0x0f, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x0f, 0x01, 0xc0, 0xc0, "None" }, - {0x0f, 0x01, 0xc0, 0x00, "20K Only" }, - {0x0f, 0x01, 0xc0, 0x80, "20K, Every 30K" }, - {0x0f, 0x01, 0xc0, 0x40, "30K, Every 40K" }, -}; - -STDDIPINFO(Atehate) - -static struct BurnDIPInfo ThunderlDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xe9, NULL }, - {0x15, 0xff, 0xff, 0xef, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x13, 0x01, 0x0f, 0x0c, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x08, "4 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x09, "3 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x04, "4 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x00, "4 Coins 4 Credits" }, - {0x13, 0x01, 0x0f, 0x05, "3 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "2 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x0f, 0x01, "3 Coins 4 Credits" }, - {0x13, 0x01, 0x0f, 0x06, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x02, "2 Coins 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x07, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x13, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "4 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0x40, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0x00, "4 Coins 4 Credits" }, - {0x13, 0x01, 0xf0, 0x50, "3 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "2 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x10, "3 Coins 4 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0x20, "2 Coins 4 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x02, 0x00, "Off" }, - {0x14, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x14, 0x01, 0x04, 0x00, "Upright" }, - {0x14, 0x01, 0x04, 0x04, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Controls" }, - {0x14, 0x01, 0x08, 0x08, "2" }, - {0x14, 0x01, 0x08, 0x00, "1" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x10, 0x10, "Off" }, - {0x14, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x14, 0x01, 0x20, 0x20, "3" }, - {0x14, 0x01, 0x20, 0x00, "2" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0xc0, 0x80, "Easy" }, - {0x14, 0x01, 0xc0, 0xc0, "Normal" }, - {0x14, 0x01, 0xc0, 0x40, "Hard" }, - {0x14, 0x01, 0xc0, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Force 1 Life" }, - {0x15, 0x01, 0x10, 0x00, "Off" }, - {0x15, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 5, "Copyright" }, - {0x15, 0x01, 0xe0, 0x80, "Romstar" }, - {0x15, 0x01, 0xe0, 0xc0, "Seta (Romstar License)"}, - {0x15, 0x01, 0xe0, 0xe0, "Seta (Visco License)" }, - {0x15, 0x01, 0xe0, 0xa0, "Visco" }, - {0x15, 0x01, 0xe0, 0x60, "None" }, -}; - -STDDIPINFO(Thunderl) - -static struct BurnDIPInfo WitsDIPList[]= -{ - {0x21, 0xff, 0xff, 0xff, NULL }, - {0x22, 0xff, 0xff, 0xff, NULL }, - {0x23, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x21, 0x01, 0x03, 0x02, "Easy" }, - {0x21, 0x01, 0x03, 0x03, "Normal" }, - {0x21, 0x01, 0x03, 0x01, "Hard" }, - {0x21, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x21, 0x01, 0x0c, 0x08, "150k, 350k" }, - {0x21, 0x01, 0x0c, 0x0c, "200k, 500k" }, - {0x21, 0x01, 0x0c, 0x04, "300k, 600k" }, - {0x21, 0x01, 0x0c, 0x00, "400k" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x21, 0x01, 0x30, 0x00, "1" }, - {0x21, 0x01, 0x30, 0x10, "2" }, - {0x21, 0x01, 0x30, 0x30, "3" }, - {0x21, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2, "Play Mode" }, - {0x21, 0x01, 0x40, 0x40, "2 Players" }, - {0x21, 0x01, 0x40, 0x00, "4 Players" }, - - {0 , 0xfe, 0 , 2, "CPU Player During Multi-Player Game" }, - {0x21, 0x01, 0x80, 0x00, "No" }, - {0x21, 0x01, 0x80, 0x80, "Yes" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x22, 0x01, 0x01, 0x01, "Upright" }, - {0x22, 0x01, 0x01, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x22, 0x01, 0x02, 0x02, "Off" }, - {0x22, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x22, 0x01, 0x04, 0x04, "Every 3rd Loop" }, - {0x22, 0x01, 0x04, 0x00, "Every 7th Loop" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x22, 0x01, 0x08, 0x08, "Off" }, - {0x22, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x22, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x22, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x22, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x22, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x22, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x22, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x22, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x22, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "License" }, - {0x23, 0x01, 0xc0, 0xc0, "Romstar" }, - {0x23, 0x01, 0xc0, 0x80, "Seta U.S.A" }, - {0x23, 0x01, 0xc0, 0x40, "Visco (Japan Only)" }, - {0x23, 0x01, 0xc0, 0x00, "Athena (Japan Only)" }, -}; - -STDDIPINFO(Wits) - -static struct BurnDIPInfo MadsharkDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 0, "Bonus Life" }, - {0x13, 0x01, 0x18, 0x18, "1000k" }, - {0x13, 0x01, 0x18, 0x08, "1000k 2000k" }, - {0x13, 0x01, 0x18, 0x10, "1500k 3000k" }, - {0x13, 0x01, 0x18, 0x00, "No" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x40, "Easy" }, - {0x13, 0x01, 0x60, 0x60, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Hard" }, - {0x13, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Lives" }, - {0x14, 0x01, 0x03, 0x02, "2" }, - {0x14, 0x01, 0x03, 0x03, "3" }, - {0x14, 0x01, 0x03, 0x01, "4" }, - {0x14, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x14, 0x01, 0x1c, 0x04, "4 Coins 1 Credits" }, - {0x14, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x1c, 0x10, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x1c, 0x0c, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x1c, 0x18, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x1c, 0x00, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x14, 0x01, 0xe0, 0x20, "4 Coins 1 Credits" }, - {0x14, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, - {0x14, 0x01, 0xe0, 0x80, "2 Coins 1 Credits" }, - {0x14, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, - {0x14, 0x01, 0xe0, 0x60, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xe0, 0x00, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 2, "Country" }, - {0x15, 0x01, 0x80, 0x80, "Japan" }, - {0x15, 0x01, 0x80, 0x00, "World" }, -}; - -STDDIPINFO(Madshark) - -static struct BurnDIPInfo MsgundamDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0x07, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x38, 0x18, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x38, 0x20, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x01, 0x00, "Off" }, - {0x14, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x06, 0x04, "Easy" }, - {0x14, 0x01, 0x06, 0x06, "Normal" }, - {0x14, 0x01, 0x06, 0x02, "Hard" }, - {0x14, 0x01, 0x06, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x10, 0x10, "Off" }, - {0x14, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Memory Check" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x15, 0x01, 0x80, 0x80, "English" }, - {0x15, 0x01, 0x80, 0x00, "Japanese" }, -}; - -STDDIPINFO(Msgundam) - -static struct BurnDIPInfo Msgunda1DIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0x07, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x07, 0x04, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x38, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x08, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x38, 0x18, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x38, 0x20, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x01, 0x00, "Off" }, - {0x14, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x06, 0x04, "Easy" }, - {0x14, 0x01, 0x06, 0x06, "Normal" }, - {0x14, 0x01, 0x06, 0x02, "Hard" }, - {0x14, 0x01, 0x06, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x10, 0x10, "Off" }, - {0x14, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Memory Check" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 1, "Language" }, - {0x15, 0x01, 0x80, 0x00, "Japanese" }, -}; - -STDDIPINFO(Msgunda1) - -static struct BurnDIPInfo ZingzipDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 0, "Service Mode" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 0, "Lives" }, - {0x13, 0x01, 0x03, 0x02, "2" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x01, "4" }, - {0x13, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 0, "Difficulty" }, - {0x13, 0x01, 0x0c, 0x08, "Easy" }, - {0x13, 0x01, 0x0c, 0x0c, "Normal" }, - {0x13, 0x01, 0x0c, 0x04, "Hard" }, - {0x13, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 0, "Coinage" }, - {0x13, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x13, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Zingzip) - -static struct BurnDIPInfo WrofaeroDIPList[]= -{ - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x00, "Off" }, - {0x15, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Stage & Weapon Select"}, - {0x15, 0x01, 0x08, 0x08, "Off" }, - {0x15, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 0, "Service Mode" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 0, "Lives" }, - {0x16, 0x01, 0x03, 0x02, "2" }, - {0x16, 0x01, 0x03, 0x03, "3" }, - {0x16, 0x01, 0x03, 0x01, "4" }, - {0x16, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 0, "Difficulty" }, - {0x16, 0x01, 0x0c, 0x08, "Easy" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Hard" }, - {0x16, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x16, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, - {0x16, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, - {0x16, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x16, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x16, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x16, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x16, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x16, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x16, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x16, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x16, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Wrofaero) - -static struct BurnDIPInfo EightfrcDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0x7b, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0x38, 0x20, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x38, 0x10, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x38, 0x08, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x38, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Shared Credits" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Credits To Start" }, - {0x13, 0x01, 0x80, 0x80, "1" }, - {0x13, 0x01, 0x80, 0x00, "2" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x18, 0x10, "Easy" }, - {0x14, 0x01, 0x18, 0x18, "Normal" }, - {0x14, 0x01, 0x18, 0x08, "Hard" }, - {0x14, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x60, 0x40, "2" }, - {0x14, 0x01, 0x60, 0x60, "3" }, - {0x14, 0x01, 0x60, 0x20, "4" }, - {0x14, 0x01, 0x60, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x14, 0x01, 0x80, 0x00, "English" }, - {0x14, 0x01, 0x80, 0x80, "Japanese" }, -}; - -STDDIPINFO(Eightfrc) - -static struct BurnDIPInfo RezonDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x00, "Off" }, - {0x14, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 3, "Cabinet" }, - {0x14, 0x01, 0x18, 0x00, "Upright 1 Controller" }, - {0x14, 0x01, 0x18, 0x18, "Upright 2 Controllers"}, - {0x14, 0x01, 0x18, 0x08, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x03, 0x02, "2" }, - {0x15, 0x01, 0x03, 0x03, "3" }, - {0x15, 0x01, 0x03, 0x01, "4" }, - {0x15, 0x01, 0x03, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x0c, 0x08, "Easy" }, - {0x15, 0x01, 0x0c, 0x0c, "Normal" }, - {0x15, 0x01, 0x0c, 0x04, "Hard" }, - {0x15, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x15, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x15, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x15, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x15, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x15, 0x01, 0xf0, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x08, 0x08, "Off" }, - {0x16, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Taito Logo" }, - {0x16, 0x01, 0x10, 0x00, "Off" }, - {0x16, 0x01, 0x10, 0x10, "On" }, -}; - -STDDIPINFO(Rezon) - -static struct BurnDIPInfo Qzkklgy2DIPList[]= -{ - {0x0e, 0xff, 0xff, 0xff, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Highlight Right Answer" }, - {0x0e, 0x01, 0x04, 0x04, "Off" }, - {0x0e, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Skip Real DAT Rom Check?" }, - {0x0e, 0x01, 0x08, 0x08, "Off" }, - {0x0e, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0f, 0x01, 0x20, 0x20, "Off" }, - {0x0f, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0e, 0x01, 0x40, 0x00, "Off" }, - {0x0e, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x0e, 0x01, 0x80, 0x80, "Off" }, - {0x0e, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x0f, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, - {0x0f, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x0f, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x0f, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x0f, 0x01, 0x07, 0x00, "2 Coins 3 Credits" }, - {0x0f, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, - {0x0f, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, - {0x0f, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x0f, 0x01, 0x08, 0x08, "Off" }, - {0x0f, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x0f, 0x01, 0x30, 0x30, "Easy" }, - {0x0f, 0x01, 0x30, 0x20, "Normal" }, - {0x0f, 0x01, 0x30, 0x10, "Hard" }, - {0x0f, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x0f, 0x01, 0xc0, 0x80, "2" }, - {0x0f, 0x01, 0xc0, 0xc0, "3" }, - {0x0f, 0x01, 0xc0, 0x40, "4" }, - {0x0f, 0x01, 0xc0, 0x00, "5" }, -}; - -STDDIPINFO(Qzkklgy2) - -static struct BurnDIPInfo QzkklogyDIPList[]= -{ - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Highlight Right Answer" }, - {0x0f, 0x01, 0x04, 0x04, "Off" }, - {0x0f, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0f, 0x01, 0x20, 0x20, "Off" }, - {0x0f, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0f, 0x01, 0x40, 0x00, "Off" }, - {0x0f, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x0f, 0x01, 0x80, 0x80, "Off" }, - {0x0f, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x10, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, - {0x10, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x10, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x10, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x10, 0x01, 0x07, 0x01, "2 Coins 3 Credits" }, - {0x10, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, - {0x10, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, - {0x10, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x10, 0x01, 0x30, 0x20, "Easy" }, - {0x10, 0x01, 0x30, 0x30, "Normal" }, - {0x10, 0x01, 0x30, 0x10, "Hard" }, - {0x10, 0x01, 0x30, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x10, 0x01, 0xc0, 0x80, "2" }, - {0x10, 0x01, 0xc0, 0xc0, "3" }, - {0x10, 0x01, 0xc0, 0x40, "4" }, - {0x10, 0x01, 0xc0, 0x00, "5" }, -}; - -STDDIPINFO(Qzkklogy) - -static struct BurnDIPInfo StgDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x03, 0x02, "Easy" }, - {0x13, 0x01, 0x03, 0x03, "Normal" }, - {0x13, 0x01, 0x03, 0x01, "Hard" }, - {0x13, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x30, 0x10, "1" }, - {0x13, 0x01, 0x30, 0x00, "2" }, - {0x13, 0x01, 0x30, 0x30, "3" }, - {0x13, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 4, "Flip Screen" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Stg) - -static struct BurnDIPInfo DrgnunitDIPList[]= -{ - {0x15, 0xff, 0xff, 0xfe, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x03, 0x03, "Easy" }, - {0x15, 0x01, 0x03, 0x02, "Normal" }, - {0x15, 0x01, 0x03, 0x01, "Hard" }, - {0x15, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x15, 0x01, 0x0c, 0x08, "150K, Every 300K" }, - {0x15, 0x01, 0x0c, 0x0c, "200K, Every 400K" }, - {0x15, 0x01, 0x0c, 0x04, "300K, Every 500K" }, - {0x15, 0x01, 0x0c, 0x00, "400K Only" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x15, 0x01, 0x30, 0x00, "1" }, - {0x15, 0x01, 0x30, 0x10, "2" }, - {0x15, 0x01, 0x30, 0x30, "3" }, - {0x15, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x16, 0x01, 0x02, 0x02, "Off" }, - {0x16, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 0, "Demo Sounds" }, - {0x16, 0x01, 0x04, 0x04, "1 of 4 Scenes" }, - {0x16, 0x01, 0x04, 0x00, "1 of 8 Scenes" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x08, 0x08, "Off" }, - {0x16, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin A" }, - {0x16, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x16, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x16, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x16, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2, "Coin B" }, - {0x16, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x16, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x16, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x16, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coinage Type" }, - {0x17, 0x01, 0x10, 0x10, "1" }, - {0x17, 0x01, 0x10, 0x00, "2" }, - - {0 , 0xfe, 0 , 4, "Title" }, - {0x17, 0x01, 0x20, 0x20, "Dragon Unit" }, - {0x17, 0x01, 0x20, 0x00, "Castle of Dragon" }, - - {0 , 0xfe, 0 , 2, "(C) / License" }, - {0x17, 0x01, 0xc0, 0xc0, "Athena (Japan)" }, - {0x17, 0x01, 0xc0, 0x80, "Athena / Taito (Japan)" }, - {0x17, 0x01, 0xc0, 0x40, "Seta USA / Taito America" }, - {0x17, 0x01, 0xc0, 0x00, "Seta USA / Romstar" }, -}; - -STDDIPINFO(Drgnunit) - -static struct BurnDIPInfo DaiohDIPList[]= -{ - {0x1a, 0xff, 0xff, 0x7f, NULL }, - {0x1b, 0xff, 0xff, 0xff, NULL }, - {0x1c, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x1a, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, - {0x1a, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x1a, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, - {0x1a, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x1a, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, - {0x1a, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x1a, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x1a, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x1a, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, - {0x1a, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, - {0x1a, 0x01, 0x38, 0x20, "2 Coins 1 Credits" }, - {0x1a, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x1a, 0x01, 0x38, 0x18, "2 Coins 3 Credits" }, - {0x1a, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, - {0x1a, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x1a, 0x01, 0x38, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x1a, 0x01, 0x40, 0x00, "Off" }, - {0x1a, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Auto Shot" }, - {0x1a, 0x01, 0x80, 0x80, "Off" }, - {0x1a, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x1b, 0x01, 0x01, 0x01, "Off" }, - {0x1b, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x1b, 0x01, 0x02, 0x02, "Off" }, - {0x1b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x1b, 0x01, 0x0c, 0x08, "Easy" }, - {0x1b, 0x01, 0x0c, 0x0c, "Normal" }, - {0x1b, 0x01, 0x0c, 0x04, "Hard" }, - {0x1b, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x1b, 0x01, 0x30, 0x00, "1" }, - {0x1b, 0x01, 0x30, 0x10, "2" }, - {0x1b, 0x01, 0x30, 0x30, "3" }, - {0x1b, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x1b, 0x01, 0xc0, 0x80, "300k and every 800k" }, - {0x1b, 0x01, 0xc0, 0xc0, "500k and every 1000k" }, - {0x1b, 0x01, 0xc0, 0x40, "800k and 2000k only" }, - {0x1b, 0x01, 0xc0, 0x00, "1000k Only" }, - - {0 , 0xfe, 0 , 2, "Country" }, - {0x1c, 0x01, 0x80, 0x80, "USA (6 buttons)" }, - {0x1c, 0x01, 0x80, 0x00, "Japan (2 buttons)" }, -}; - -STDDIPINFO(Daioh) - -static struct BurnDIPInfo NeobattlDIPList[]= -{ - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x11, 0x01, 0x02, 0x00, "Off" }, - {0x11, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Stage Select" }, - {0x11, 0x01, 0x08, 0x08, "Off" }, - {0x11, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x12, 0x01, 0x03, 0x02, "1" }, - {0x12, 0x01, 0x03, 0x03, "2" }, - {0x12, 0x01, 0x03, 0x01, "3" }, - {0x12, 0x01, 0x03, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Normal" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x12, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Neobattl) - -static struct BurnDIPInfo UmanclubDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Stage Select" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x03, 0x02, "1" }, - {0x14, 0x01, 0x03, 0x03, "2" }, - {0x14, 0x01, 0x03, 0x01, "3" }, - {0x14, 0x01, 0x03, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x0c, 0x08, "Easy" }, - {0x14, 0x01, 0x0c, 0x0c, "Normal" }, - {0x14, 0x01, 0x0c, 0x04, "Hard" }, - {0x14, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x14, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, - {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x14, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, - {0x14, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x14, 0x01, 0xf0, 0x00, "Free Play" }, -}; - -STDDIPINFO(Umanclub) - -static struct BurnDIPInfo KamenridDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Intro Music" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 16, "Coinage" }, - {0x14, 0x01, 0x0f, 0x05, "6 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0d, "5 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x03, "4 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0b, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x08, "8 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x07, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x04, "5 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0c, "3 Coins 2 Credits" }, - {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x0f, 0x02, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x0f, 0x09, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0f, 0x01, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0f, 0x0e, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x0f, 0x06, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x14, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x30, 0x10, "Easy" }, - {0x14, 0x01, 0x30, 0x30, "Normal" }, - {0x14, 0x01, 0x30, 0x20, "Hard" }, - {0x14, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Country" }, - {0x15, 0x01, 0x80, 0x80, "USA" }, - {0x15, 0x01, 0x80, 0x00, "Japan" }, -}; - -STDDIPINFO(Kamenrid) - -static struct BurnDIPInfo BlockcarDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x03, 0x02, "Easy" }, - {0x13, 0x01, 0x03, 0x03, "Normal" }, - {0x13, 0x01, 0x03, 0x01, "Hard" }, - {0x13, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x0c, 0x0c, "20K, Every 50K" }, - {0x13, 0x01, 0x0c, 0x04, "20K, Every 70K" }, - {0x13, 0x01, 0x0c, 0x08, "30K, Every 60K" }, - {0x13, 0x01, 0x0c, 0x00, "30K, Every 90K" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x30, 0x00, "1" }, - {0x13, 0x01, 0x30, 0x30, "2" }, - {0x13, 0x01, 0x30, 0x20, "3" }, - {0x13, 0x01, 0x30, 0x10, "4" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x04, 0x00, "Off" }, - {0x14, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2, "Title" }, - {0x15, 0x01, 0x10, 0x10, "Thunder & Lightning 2" }, - {0x15, 0x01, 0x10, 0x00, "Block Carnival" }, -}; - -STDDIPINFO(Blockcar) - -static struct BurnDIPInfo ZombraidDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xfd, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Vertical Screen Flip" }, - {0x0e, 0x01, 0x01, 0x01, "Off" }, - {0x0e, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Horizontal Screen Flip" }, - {0x0e, 0x01, 0x02, 0x00, "Off" }, - {0x0e, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0e, 0x01, 0x04, 0x00, "Off" }, - {0x0e, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x0e, 0x01, 0x18, 0x10, "Easy" }, - {0x0e, 0x01, 0x18, 0x18, "Normal" }, - {0x0e, 0x01, 0x18, 0x08, "Hard" }, - {0x0e, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x0e, 0x01, 0x20, 0x00, "Off" }, - {0x0e, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0e, 0x01, 0x80, 0x80, "Off" }, - {0x0e, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x0f, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, - {0x0f, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, - {0x0f, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x0f, 0x01, 0x07, 0x04, "1 Coin 2 Credits" }, - {0x0f, 0x01, 0x07, 0x03, "1 Coin 3 Credits" }, - {0x0f, 0x01, 0x07, 0x02, "1 Coin 4 Credits" }, - {0x0f, 0x01, 0x07, 0x01, "1 Coin 5 Credits" }, - {0x0f, 0x01, 0x07, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x0f, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, - {0x0f, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, - {0x0f, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, - {0x0f, 0x01, 0x38, 0x20, "1 Coin 2 Credits" }, - {0x0f, 0x01, 0x38, 0x18, "1 Coin 3 Credits" }, - {0x0f, 0x01, 0x38, 0x10, "1 Coin 4 Credits" }, - {0x0f, 0x01, 0x38, 0x08, "1 Coin 5 Credits" }, - {0x0f, 0x01, 0x38, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, - {0x0f, 0x01, 0x40, 0x40, "No" }, - {0x0f, 0x01, 0x40, 0x00, "Yes" }, -}; - -STDDIPINFO(Zombraid) - -static struct BurnDIPInfo JockeycDIPList[]= -{ - {0x39, 0xff, 0xff, 0xff, NULL }, - {0x3a, 0xff, 0xff, 0xff, NULL }, - {0x3b, 0xff, 0xff, 0xff, NULL }, - - {0x3c, 0xff, 0xff, 0xff, NULL }, - {0x3d, 0xff, 0xff, 0xff, NULL }, - {0x3e, 0xff, 0xff, 0xff, NULL }, - {0x3f, 0xff, 0xff, 0xff, NULL }, - -// dip1 - {0 , 0xfe, 0 , 3, "Max Bet" }, - {0x39, 0x01, 0x03, 0x03, "10" }, - {0x39, 0x01, 0x03, 0x02, "20" }, - {0x39, 0x01, 0x03, 0x01, "99" }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x39, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, - {0x39, 0x01, 0x1c, 0x18, "1 Coin 2 Credits" }, - {0x39, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x39, 0x01, 0x1c, 0x10, "1 Coin 4 Credits" }, - {0x39, 0x01, 0x1c, 0x0c, "1 Coin 5 Credits" }, - {0x39, 0x01, 0x1c, 0x08, "1 Coin/10 Credits" }, - {0x39, 0x01, 0x1c, 0x04, "1 Coin/20 Credits" }, - {0x39, 0x01, 0x1c, 0x00, "1 Coin/50 Credits" }, - -// dip2-3 - {0 , 0xfe, 0 , 4, "Betting Clock Speed" }, - {0x3a, 0x01, 0x18, 0x18, "Slowest" }, - {0x3a, 0x01, 0x18, 0x10, "Slower" }, - {0x3a, 0x01, 0x18, 0x08, "Faster" }, - {0x3a, 0x01, 0x18, 0x00, "Fastest" }, - - {0 , 0xfe, 0 , 16, "Payout Rate" }, - {0x3b, 0x01, 0x01, 0x01, "80%" }, - {0x3b, 0x01, 0x01, 0x01, "81%" }, - {0x3b, 0x01, 0x01, 0x01, "82%" }, - {0x3b, 0x01, 0x01, 0x01, "83%" }, - {0x3b, 0x01, 0x01, 0x01, "84%" }, - {0x3b, 0x01, 0x01, 0x01, "85%" }, - {0x3b, 0x01, 0x01, 0x01, "86%" }, - {0x3b, 0x01, 0x01, 0x01, "87%" }, - {0x3b, 0x01, 0x01, 0xe0, "88%" }, - {0x3b, 0x01, 0x01, 0xc0, "89%" }, - {0x3b, 0x01, 0x01, 0xa0, "90%" }, - {0x3b, 0x01, 0x01, 0x80, "91%" }, - {0x3b, 0x01, 0x01, 0x60, "92%" }, - {0x3b, 0x01, 0x01, 0x40, "93%" }, - {0x3b, 0x01, 0x01, 0x20, "94%" }, - {0x3b, 0x01, 0x01, 0x00, "95%" }, - - {0 , 0xfe, 0 , 2, "Payout" }, - {0x3b, 0x01, 0x04, 0x00, "Off" }, - {0x3b, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2, "Horses" }, - {0x3b, 0x01, 0x08, 0x08, "Random" }, - {0x3b, 0x01, 0x08, 0x00, "Cyclic" }, - - {0 , 0xfe, 0 , 2, "Higher Odds" }, - {0x3b, 0x01, 0x10, 0x10, "Off" }, - {0x3b, 0x01, 0x10, 0x00, "On" }, - -// overlay on p1/p2 - {0 , 0xfe, 0 , 2, "Coin Drop - 1P" }, - {0x3c, 0x01, 0x01, 0x01, "Off" }, - {0x3c, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Hopper Overflow - 1P" }, - {0x3c, 0x01, 0x02, 0x02, "Off" }, - {0x3c, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Out" }, - {0x3c, 0x01, 0x04, 0x00, "Off" }, - {0x3c, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2, "Att Pay - 1P" }, - {0x3c, 0x01, 0x08, 0x08, "Off" }, - {0x3c, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Sense 2 - 1P" }, - {0x3c, 0x01, 0x40, 0x40, "Off" }, - {0x3c, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Sense 1 - 1P" }, - {0x3c, 0x01, 0x80, 0x80, "Off" }, - {0x3c, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Drop - 2P" }, - {0x3d, 0x01, 0x01, 0x01, "Off" }, - {0x3d, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Sel Sense" }, - {0x3d, 0x01, 0x02, 0x02, "Off" }, - {0x3d, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Att Pay - 2P" }, - {0x3d, 0x01, 0x08, 0x08, "Off" }, - {0x3d, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Sense 2 - 2P" }, - {0x3d, 0x01, 0x40, 0x40, "Off" }, - {0x3d, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Sense 1 - 2P" }, - {0x3d, 0x01, 0x80, 0x80, "Off" }, - {0x3d, 0x01, 0x80, 0x00, "On" }, - -// p2 - {0 , 0xfe, 0 , 2, "SYSTEM" }, - {0x3e, 0x01, 0x02, 0x02, "Off" }, - {0x3e, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Tilt" }, - {0x3e, 0x01, 0x08, 0x08, "Off" }, - {0x3e, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Special Test Mode Item?" }, - {0x3f, 0x01, 0x04, 0x04, "Off" }, - {0x3f, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Call SW" }, - {0x3f, 0x01, 0x08, 0x08, "Off" }, - {0x3f, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x3f, 0x01, 0x10, 0x10, "Off" }, - {0x3f, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Analyzer" }, - {0x3f, 0x01, 0x20, 0x20, "Off" }, - {0x3f, 0x01, 0x20, 0x00, "On" }, -}; - -STDDIPINFO(Jockeyc) - -// d_seta2.cpp -//void __fastcall setaSoundRegWriteByte(UINT32 sekAddress, UINT8 byteValue); -void __fastcall setaSoundRegWriteWord(UINT32 sekAddress, UINT16 wordValue); -//UINT8 __fastcall setaSoundRegReadByte(UINT32 sekAddress); -UINT16 __fastcall setaSoundRegReadWord(UINT32 sekAddress); - -// these should probably be moved to x1010.cpp -static UINT8 __fastcall setaSoundRegReadByte(UINT32 sekAddress) -{ - if (~sekAddress & 1) { - return x1_010_chip->HI_WORD_BUF[(sekAddress & 0x3fff) >> 1]; - } else { - return x1010_sound_read_word((sekAddress & 0x3fff) >> 1); - } -} - -static void __fastcall setaSoundRegWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - UINT32 offset = (sekAddress & 0x00003fff) >> 1; - INT32 channel, reg; - - if (~sekAddress & 1) { - x1_010_chip->HI_WORD_BUF[ offset ] = byteValue; - } else { - offset ^= x1_010_chip->address; - channel = offset / sizeof(X1_010_CHANNEL); - reg = offset % sizeof(X1_010_CHANNEL); - - if (channel < SETA_NUM_CHANNELS && reg == 0 && (x1_010_chip->reg[offset] & 1) == 0 && (byteValue&1) != 0) { - x1_010_chip->smp_offset[channel] = 0; - x1_010_chip->env_offset[channel] = 0; - } - x1_010_chip->reg[offset] = byteValue; - } -} - -void x1010Reset() -{ - x1_010_chip->sound_enable = 1; // enabled by default? - memset (x1_010_chip->reg, 0, 0x2000); - memset (x1_010_chip->HI_WORD_BUF, 0, 0x2000); - memset (x1_010_chip->smp_offset, 0, SETA_NUM_CHANNELS * sizeof(INT32)); - memset (x1_010_chip->env_offset, 0, SETA_NUM_CHANNELS * sizeof(INT32)); - memset (x1_010_chip->sound_banks, 0, SETA_NUM_BANKS * sizeof(INT32)); -} - -void x1010Enable(INT32 data) -{ - x1_010_chip->sound_enable = data; -} - -static void set_pcm_bank(INT32 data) -{ - INT32 new_bank = (data >> 3) & 0x07; - - if (new_bank != seta_samples_bank) - { - INT32 samples_len = DrvROMLen[3]; - - seta_samples_bank = new_bank; - - if (samples_len == 0x200000 || samples_len == 0x180000) // eightfrc, blandia - { - INT32 addr = 0x40000 * new_bank; - if (new_bank >= 3) addr += 0x40000; - - if ((samples_len > 0x100000) && ((addr + 0x40000) <= samples_len)) - memcpy(DrvSndROM + 0xc0000, DrvSndROM + addr, 0x40000); - } - else if (samples_len == 0x400000) // zombraid - { - if (new_bank == 0) new_bank = 1; - INT32 addr = 0x80000 * new_bank; - if (new_bank > 0) addr += 0x80000; - - memcpy (DrvSndROM + 0x80000, DrvSndROM + addr, 0x80000); - } - } -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// macros - -#define SetaVidRAMCtrlWriteWord(num, base) \ - if ((address >= (base + 0)) && address <= (base + 5)) { \ - *((UINT16*)(DrvVIDCTRLRAM##num + (address & 0x06))) = BURN_ENDIAN_SWAP_INT16(data); \ - return; \ - } - -#define SetaVidRAMCtrlWriteByte(num, base) \ - if ((address >= (base + 0)) && (address <= (base + 5))) { \ - DrvVIDCTRLRAM##num[(address & 0x07)^1] = data; \ - return; \ - } - -#define SetVidRAMRegsWriteWord(base) \ - if ((address >= (base + 0)) && (address <= (base + 5))) { \ - *((UINT16*)(DrvVideoRegs + (address & 0x06))) = BURN_ENDIAN_SWAP_INT16(data); \ - if ((address - base) == 0) x1010Enable(data & 0x20); \ - if ((address - base) == 2) set_pcm_bank(data); \ - return; \ - } - -#define SetVidRAMRegsWriteByte(base) \ - if ((address >= (base + 0)) && (address <= (base + 5))) { \ - DrvVideoRegs[(address & 0x07)^1] = data; \ - return; \ - } - -#define SetaReadDips(base) \ - if (address >= (base + 0) && address <= (base + 3)) { \ - return DrvDips[((address - base)/2)^1]; \ - } - -//----------------------------------------------------------------------------------------------------------------------------------- -// drgnunit - -UINT16 __fastcall drgnunit_read_word(UINT32 address) -{ - SetaReadDips(0x600000) - - switch (address) - { - case 0xb00000: - return DrvInputs[0]; - - case 0xb00002: - return DrvInputs[1]; - - case 0xb00004: - return DrvInputs[2]^0xff^DrvDips[2]; - } - - return 0; -} - -UINT8 __fastcall drgnunit_read_byte(UINT32 address) -{ - SetaReadDips(0x600000) - - switch (address) - { - case 0xb00000: - case 0xb00001: - return DrvInputs[0]; - - case 0xb00002: - case 0xb00003: - return DrvInputs[1]; - - case 0xb00004: - case 0xb00005: - return DrvInputs[2]^0xff^DrvDips[2]; - } - - return 0; -} - -void __fastcall drgnunit_write_word(UINT32 address, UINT16 data) -{ - SetaVidRAMCtrlWriteWord(0, 0x800000) - - SetVidRAMRegsWriteWord(0x500000) -} - -void __fastcall drgnunit_write_byte(UINT32 address, UINT8 data) -{ - SetaVidRAMCtrlWriteByte(0, 0x800000) - - SetVidRAMRegsWriteByte(0x500000) -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// thunderl, wits - -UINT16 __fastcall thunderl_read_word(UINT32 address) -{ - SetaReadDips(0x600000) - - switch (address) - { - case 0xb00000: - case 0xb00001: - return DrvInputs[0]; - - case 0xb00002: - case 0xb00003: - return DrvInputs[1]; - - case 0xb00004: - case 0xb00005: - return DrvInputs[2]^0xff^DrvDips[2]; - - case 0xb00008: - case 0xb00009: - return DrvInputs[3]; - - case 0xb0000a: - case 0xb0000b: - return DrvInputs[4]; - - case 0xb0000c: - case 0xb0000d: - return 0x00dd;// thunderl_prot - } - - return 0; -} - -UINT8 __fastcall thunderl_read_byte(UINT32 address) -{ - SetaReadDips(0x600000) - - switch (address) - { - case 0xb00000: - case 0xb00001: - return DrvInputs[0]; - - case 0xb00002: - case 0xb00003: - return DrvInputs[1]; - - case 0xb00004: - case 0xb00005: - return DrvInputs[2]^0xff^DrvDips[2]; - - case 0xb00008: - case 0xb00009: - return DrvInputs[3]; - - case 0xb0000a: - case 0xb0000b: - return DrvInputs[4]; - - case 0xb0000c: - case 0xb0000d: - return 0xdd;// thunderl_prot - } - - return 0; -} - -void __fastcall thunderl_write_word(UINT32 address, UINT16 data) -{ - SetVidRAMRegsWriteWord(0x500000) -} - -void __fastcall thunderl_write_byte(UINT32 address, UINT8 data) -{ - SetVidRAMRegsWriteByte(0x500000) -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// daioh - -UINT16 __fastcall daioh_read_word(UINT32 address) -{ - SetaReadDips(0x300000) - SetaReadDips(0x400008) - SetaReadDips(0x600000) - - switch (address) - { - case 0x400000: - return DrvInputs[0]; - - case 0x400002: - return DrvInputs[1]; - - case 0x400004: - return DrvInputs[2]^0xff^DrvDips[2]; - - case 0x40000c: - watchdog = 0; - return 0xff; - - case 0x500006: - return DrvInputs[3]; - } - - return 0; -} - -UINT8 __fastcall daioh_read_byte(UINT32 address) -{ - SetaReadDips(0x300000) - SetaReadDips(0x400008) - SetaReadDips(0x600000) - - switch (address) - { - case 0x400000: - case 0x400001: - return DrvInputs[0]; - - case 0x400002: - case 0x400003: - return DrvInputs[1]; - - case 0x400004: - case 0x400005: - return DrvInputs[2]^0xff^DrvDips[2]; - - case 0x40000c: - case 0x40000d: - watchdog = 0; - return 0xff; - - case 0x500006: - case 0x500007: - return DrvInputs[3]; - } - - return 0; -} - -void __fastcall daioh_write_word(UINT32 address, UINT16 data) -{ - SetVidRAMRegsWriteWord(0x500000) - - SetaVidRAMCtrlWriteWord(0, 0x900000) // blandiap - SetaVidRAMCtrlWriteWord(0, 0x908000) // jjsquawkb - SetaVidRAMCtrlWriteWord(0, 0xa00000) // blandia - - SetaVidRAMCtrlWriteWord(1, 0x980000) // blandiap - SetaVidRAMCtrlWriteWord(1, 0x909000) // jjsquawkb - SetaVidRAMCtrlWriteWord(1, 0xa80000) // blandia - - switch (address) - { - case 0x400000: - case 0x40000c: - watchdog = 0; - return; - } -} - -void __fastcall daioh_write_byte(UINT32 address, UINT8 data) -{ - SetVidRAMRegsWriteByte(0x500000) - - SetaVidRAMCtrlWriteByte(0, 0x900000) // blandiap - SetaVidRAMCtrlWriteByte(0, 0x908000) // jjsquawkb - SetaVidRAMCtrlWriteByte(0, 0xa00000) // blandia - - SetaVidRAMCtrlWriteByte(1, 0x980000) // blandiap - SetaVidRAMCtrlWriteByte(1, 0x909000) // jjsquawkb - SetaVidRAMCtrlWriteByte(1, 0xa80000) // blandia - - switch (address) - { - case 0x400000: - case 0x400001: - case 0x40000c: - case 0x40000d: - watchdog = 0; - return; - } -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// msgundam - -void __fastcall msgundam_write_word(UINT32 address, UINT16 data) -{ - SetaVidRAMCtrlWriteWord(0, 0xb00000) - SetaVidRAMCtrlWriteWord(1, 0xb80000) - - switch (address) - { - case 0x500000: - case 0x500001: - *((UINT16*)(DrvVideoRegs + 0)) = data; - return; - case 0x500002: - case 0x500003: - *((UINT16*)(DrvVideoRegs + 4)) = data; - return; - - case 0x500004: - case 0x500005: - *((UINT16*)(DrvVideoRegs + 2)) = data; - return; - } -} - -void __fastcall msgundam_write_byte(UINT32 address, UINT8 data) -{ - SetaVidRAMCtrlWriteByte(0, 0xb00000) - SetaVidRAMCtrlWriteByte(1, 0xb80000) - - switch (address) - { - case 0x500000: - case 0x500001: - DrvVideoRegs[(~address & 0x01) | 0] = data; - return; - - case 0x500002: - case 0x500003: - DrvVideoRegs[(~address & 0x01) | 4] = data; - return; - - case 0x500004: - case 0x500005: - DrvVideoRegs[(~address & 0x01) | 2] = data; - // seta_vregs_w - return; - } -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// kamenrid - -UINT16 __fastcall kamenrid_read_word(UINT32 address) -{ - SetaReadDips(0x500004) - - switch (address) - { - case 0x500000: - return DrvInputs[0]; - - case 0x500002: - return DrvInputs[1]; - - case 0x500009: - return DrvInputs[2]^0xff^DrvDips[2]; - - case 0x50000c: - return 0xffff; // watchdog - } - - return 0; -} - -UINT8 __fastcall kamenrid_read_byte(UINT32 address) -{ - SetaReadDips(0x500004) - - switch (address) - { - case 0x500000: - case 0x500001: - return DrvInputs[0]; - - case 0x500002: - case 0x500003: - return DrvInputs[1]; - - case 0x500009: - case 0x50000a: - return DrvInputs[2]^0xff^DrvDips[2]; - - case 0x50000c: - case 0x50000d: - return 0xff; // watchdog - } - - return 0; -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// krzybowl, madshark - -static UINT16 krzybowl_input_read(INT32 offset) -{ - INT32 dir1x = 0x800; //input_port_read(space->machine, "TRACK1_X") & 0xfff; - INT32 dir1y = 0x800; //input_port_read(space->machine, "TRACK1_Y") & 0xfff; - INT32 dir2x = 0x800; //input_port_read(space->machine, "TRACK2_X") & 0xfff; - INT32 dir2y = 0x800; //input_port_read(space->machine, "TRACK2_Y") & 0xfff; - - switch ((offset & 0x0e) / 2) - { - case 0x0/2: return dir1x & 0xff; - case 0x2/2: return dir1x >> 8; - case 0x4/2: return dir1y & 0xff; - case 0x6/2: return dir1y >> 8; - case 0x8/2: return dir2x & 0xff; - case 0xa/2: return dir2x >> 8; - case 0xc/2: return dir2y & 0xff; - case 0xe/2: return dir2y >> 8; - } - - return 0; -} - -UINT16 __fastcall madshark_read_word(UINT32 address) -{ - SetaReadDips(0x300000) - SetaReadDips(0x500008) - - switch (address) - { - case 0x500000: - return DrvInputs[0]; - - case 0x500002: - return DrvInputs[1]; - - case 0x500004: - return DrvInputs[2]^0xff^DrvDips[2]; - - case 0x50000c: - watchdog = 0; - return 0xffff; - } - - if ((address & ~0x00000f) == 0x600000) { - return krzybowl_input_read(address); - } - - return 0; -} - -UINT8 __fastcall madshark_read_byte(UINT32 address) -{ - SetaReadDips(0x300000) - SetaReadDips(0x500008) - - switch (address) - { - case 0x500000: - case 0x500001: - return DrvInputs[0]; - - case 0x500002: - case 0x500003: - return DrvInputs[1]; - - case 0x500004: - case 0x500005: - return DrvInputs[2]^0xff^DrvDips[2]; - - case 0x50000c: - case 0x50000d: - watchdog = 0; - return 0xff; - } - - if ((address & ~0x00000f) == 0x600000) { - return krzybowl_input_read(address); - } - - return 0; -} - -void __fastcall madshark_write_word(UINT32 address, UINT16 data) -{ - SetVidRAMRegsWriteWord(0x600000) - SetaVidRAMCtrlWriteWord(0, 0x900000) - SetaVidRAMCtrlWriteWord(1, 0x980000) - - switch (address) - { - case 0x50000c: - watchdog = 0; - return; - } -} - -void __fastcall madshark_write_byte(UINT32 address, UINT8 data) -{ - SetVidRAMRegsWriteByte(0x600000) - SetaVidRAMCtrlWriteByte(0, 0x900000) - SetaVidRAMCtrlWriteByte(1, 0x980000) - - switch (address) - { - case 0x50000c: - case 0x50000d: - watchdog = 0; - return; - } -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// keroppi, pairlove - -static INT32 keroppi_prize_hop = 0; -static INT32 keroppi_protection_count = 0; -static INT32 keroppi_timer_frame = -1; -static const UINT16 keroppi_protection_word[] = { - 0x0000, - 0x0000, 0x0000, 0x0000, - 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, - 0x0400, 0x0400, 0x0400, - 0x0000, 0x0000, 0x0000 -}; - -static UINT16 pairslove_protram[0x100]; -static UINT16 pairslove_protram_old[0x100]; - -UINT16 __fastcall pairlove_read_word(UINT32 address) -{ - SetaReadDips(0x300000) - - switch (address) - { - case 0x100000: { // keroppi - INT32 res = keroppi_protection_word[keroppi_protection_count]; - keroppi_protection_count++; - if (keroppi_protection_count > 15) keroppi_protection_count = 15; - return res; - } - - case 0x200000: // keroppi - keroppi_protection_count = 0; - return 0x00; - - case 0x500000: - return DrvInputs[0]; - - case 0x500002: - return DrvInputs[1]; - - case 0x500004: { - INT32 res = DrvInputs[2]^0xff^DrvDips[2]; - - if (keroppi_prize_hop == 1 && keroppi_timer_frame != -1) { - if ((GetCurrentFrame() - keroppi_timer_frame) >= 3) { - keroppi_prize_hop = 2; - keroppi_timer_frame = - 1; - } - } - - if (keroppi_prize_hop == 2) { - res &= ~0x0002; - keroppi_prize_hop = 0; - } - return res; - } - } - - if ((address & 0xfffffe00) == 0x900000) { - INT32 offset = (address & 0x1ff) / 2; - - INT32 retdata = pairslove_protram[offset]; - pairslove_protram[offset]=pairslove_protram_old[offset]; - return retdata; - } - - return 0; -} - -UINT8 __fastcall pairlove_read_byte(UINT32 address) -{ - SetaReadDips(0x300000) - - switch (address) - { - case 0x100000: // keroppi - case 0x100001: { - INT32 res = keroppi_protection_word[keroppi_protection_count]; - keroppi_protection_count++; - if (keroppi_protection_count > 15) keroppi_protection_count = 15; - return res; - } - - case 0x200000: - case 0x200001: // keroppi - keroppi_protection_count = 0; - return 0x00; - - case 0x500000: - case 0x500001: - return DrvInputs[0]; - - case 0x500002: - case 0x500003: - return DrvInputs[1]; - - case 0x500004: - case 0x500005: { - INT32 res = DrvInputs[2]^0xff^DrvDips[2]; - - if (keroppi_prize_hop == 1 && keroppi_timer_frame != -1) { - if ((GetCurrentFrame() - keroppi_timer_frame) >= 3) { - keroppi_prize_hop = 2; - keroppi_timer_frame = -1; - } - } - - if (keroppi_prize_hop == 2) { - res &= ~0x0002; - keroppi_prize_hop = 0; - } - return res; - } - } - - if ((address & 0xfffffe00) == 0x900000) { - INT32 offset = (address & 0x1ff) / 2; - INT32 retdata = pairslove_protram[offset]; - pairslove_protram[offset]=pairslove_protram_old[offset]; - return retdata; - } - - return 0; -} - -void __fastcall pairlove_write_word(UINT32 address, UINT16 data) -{ - SetVidRAMRegsWriteWord(0x400000) - - switch (address) - { - case 0x900002: // keroppi - if ((data & 0x0010) && !keroppi_prize_hop) { - keroppi_prize_hop = 1; - keroppi_timer_frame = GetCurrentFrame(); - } - break; // for pairslove prot - } - - if ((address & 0xfffffe00) == 0x900000) { - INT32 offset = (address & 0x1ff) / 2; - pairslove_protram_old[offset]=pairslove_protram[offset]; - pairslove_protram[offset]=data; - return; - } -} - -void __fastcall pairlove_write_byte(UINT32 address, UINT8 data) -{ - SetVidRAMRegsWriteByte(0x400000) - - switch (address) - { - case 0x900002: - case 0x900003: // keroppi - if ((data & 0x0010) && !keroppi_prize_hop) { - keroppi_prize_hop = 1; - keroppi_timer_frame = GetCurrentFrame(); - } - break; // for pairslove prot - } - - if ((address & 0xfffffe00) == 0x900000) { - INT32 offset = (address & 0x1ff) / 2; - pairslove_protram_old[offset]=pairslove_protram[offset]; - pairslove_protram[offset]=data; - return; - } -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// downtown, metafox, twineagl, arbelester - -void __fastcall downtown_write_word(UINT32 address, UINT16 data) -{ - SetaVidRAMCtrlWriteWord(0, 0x800000) - - switch (address) - { - case 0x400000: - case 0x400002: - case 0x400004: - case 0x400006: - // tilebank[(address & 6) / 2] = data; - return; - - case 0xa00000: - case 0xa00002: - case 0xa00004: - case 0xa00006: - // sub_ctrl_w - return; - } -} - -void __fastcall downtown_write_byte(UINT32 address, UINT8 data) -{ - SetaVidRAMCtrlWriteByte(0, 0x800000) - - switch (address) - { - case 0x400000: - case 0x400001: - case 0x400002: - case 0x400003: - case 0x400004: - case 0x400005: - case 0x400006: - case 0x400007: - tilebank[(address & 6) / 2] = data; - return; - - case 0xa00000: - case 0xa00001: - case 0xa00002: - case 0xa00003: - case 0xa00004: - case 0xa00005: - case 0xa00006: - case 0xa00007: - // sub_ctrl_w - return; - } -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// kiwame - -static INT32 kiwame_inputs_read(INT32 offset) -{ - INT32 i; - INT32 row_select = DrvNVRAM[0x10b]; - - for (i = 0; i < 5; i++) - if (row_select & (1 << i)) break; - - switch (offset) - { - case 0: return DrvInputs[i+1]; - case 4: return DrvInputs[0]^0xff^DrvDips[2]; - case 2: - case 8: return 0xffff; - } - - return 0; -} - -UINT16 __fastcall kiwame_read_word(UINT32 address) -{ - switch (address) - { - case 0xe00000: - return DrvDips[1]; - - case 0xe00002: - return DrvDips[0]; - } - - if ((address & 0xfffff0) == 0xd00000) { - return kiwame_inputs_read(address & 0x0e); - } - if ((address & 0xfffc00) == 0xfffc00) { - // bprintf (0, _T("%5.5x, rw\n"), address); - return DrvNVRAM[(address & 0x3fe)]; - } - - return 0; -} - -UINT8 __fastcall kiwame_read_byte(UINT32 address) -{ - switch (address) - { - case 0xe00000: - case 0xe00001: - return DrvDips[1]; - - case 0xe00002: - case 0xe00003: - return DrvDips[0]; - } - - if ((address & 0xfffff0) == 0xd00000) { - return kiwame_inputs_read(address & 0x0e); - } - - if ((address & 0xfffc01) == 0xfffc01) { - return DrvNVRAM[(address & 0x3fe)]; - } - - return 0; -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// zombraid gun handler - -static INT32 zombraid_gun_read() -{ - return (DrvAnalogInput[gun_input_src] >> gun_input_bit) & 1; -} - -static void zombraid_gun_write(INT32 data) -{ - static INT32 bit_count = 0, old_clock = 0; - - if(data&4) { bit_count = 0; return; } // Reset - - if((data&1) == old_clock) return; // No change - - if (old_clock == 0) // Rising edge - { - switch (bit_count) - { - case 0: - case 1: // Starting sequence 2,3,2,3. Other inputs? - break; - - case 2: // First bit of source - gun_input_src = (gun_input_src&2) | (data>>1); - break; - - case 3: // Second bit of source - gun_input_src = (gun_input_src&1) | (data&2); - break; - - default: - // "Player1_Gun_Recoil", (data & 0x10)>>4 - // "Player2_Gun_Recoil", (data & 0x08)>>3 - gun_input_bit = bit_count - 4; - gun_input_bit = 8 - gun_input_bit; // Reverse order - break; - } - bit_count++; - } - - old_clock = data & 1; -} - -void __fastcall zombraid_gun_write_word(UINT32 address, UINT16 data) -{ - if ((address & ~1) == 0xf00000) zombraid_gun_write(data); -} - -void __fastcall zombraid_gun_write_byte(UINT32 address, UINT8 data) -{ - if ((address & ~1) == 0xf00000) zombraid_gun_write(data); -} - -UINT16 __fastcall zombraid_gun_read_word(UINT32 ) -{ - return zombraid_gun_read(); -} - -UINT8 __fastcall zombraid_gun_read_byte(UINT32 ) -{ - return zombraid_gun_read(); -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// utoukond sound handler - -void __fastcall utoukond_sound_write(UINT16 address, UINT8 data) -{ - if (address >= 0xf000) { - setaSoundRegWriteByte((address & 0xfff) * 2 + 1, data); - } -} - -UINT8 __fastcall utoukond_sound_read(UINT16 address) -{ - if (address >= 0xf000) { - return x1010_sound_read(address & 0xfff); - } - return 0; -} - -void __fastcall utoukond_sound_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - BurnYM3438Write(0, port & 3, data); - return; - } -} - -UINT8 __fastcall utoukond_sound_read_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - return BurnYM3438Read(0, port & 3);// right? - - case 0xc0: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// wiggie / superbar sound handler - -void __fastcall wiggie_sound_write_word(UINT32 , UINT16 ) -{ - -} - -void __fastcall wiggie_sound_write_byte(UINT32 address, UINT8 data) -{ - if (address != 0xb00008 && address != 0xc00000) return; // wiggie - - *soundlatch = data; - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); -} - -void __fastcall wiggie_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x9800: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall wiggie_sound_read(UINT16 address) -{ - switch (address) - { - case 0x9800: - return MSM6295ReadStatus(0); - - case 0xa000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// usclssic - -void __fastcall usclssic_write_word(UINT32 address, UINT16 data) -{ - SetaVidRAMCtrlWriteWord(0, 0xa00000) - - switch (address) - { - case 0xb40000: - usclssic_port_select = (data & 0x40) >> 6; - tile_offset[0] = (data & 0x10) << 10; - // coin lockout too... - return; - - case 0xb40010: - *soundlatch = data; - return; - - case 0xb40018: - watchdog = 0; - return; - } -} - -void __fastcall usclssic_write_byte(UINT32 address, UINT8 data) -{ - SetaVidRAMCtrlWriteByte(0, 0xa00000) - - switch (address) - { - case 0xb40000: - case 0xb40001: - usclssic_port_select = (data & 0x40) >> 6; - tile_offset[0] = (data & 0x10) << 10; - // coin lockout too... - return; - - case 0xb40010: - case 0xb40011: - *soundlatch = data; - return; - - case 0xb40018: - case 0xb40019: - watchdog = 0; - return; - } -} - -static UINT8 uclssic_trackball_read(INT32 offset) -{ - const UINT16 start_vals[2] = { 0xf000, 0x9000 }; - - UINT16 ret = DrvInputs[1 + ((offset & 4)/4) + (usclssic_port_select * 2)] ^ start_vals[(offset / 4) & 1]; - - if (offset & 2) ret >>= 8; - - return ret ^ 0xff; -} - -UINT16 __fastcall usclssic_read_word(UINT32 address) -{ - switch (address) - { - case 0xb40000: - case 0xb40002: - case 0xb40004: - case 0xb40006: - return uclssic_trackball_read(address); - - case 0xb40010: - return DrvInputs[0] ^ 0xf0; - - case 0xb40018: - return DrvDips[1] & 0x0f; - - case 0xb4001a: - return DrvDips[1] >> 4; - - case 0xb4001c: - return DrvDips[0] & 0x0f; - - case 0xb4001e: - return DrvDips[0] >> 4; - } - - return 0; -} - -UINT8 __fastcall usclssic_read_byte(UINT32 address) -{ - switch (address) - { - case 0xb40000: - case 0xb40001: - case 0xb40002: - case 0xb40003: - case 0xb40004: - case 0xb40005: - case 0xb40006: - case 0xb40007: - return uclssic_trackball_read(address); - - case 0xb40010: - case 0xb40011: - return DrvInputs[0] ^ 0xf0; - - case 0xb40018: - case 0xb40019: - return DrvDips[1] & 0x0f; - - case 0xb4001a: - case 0xb4001b: - return DrvDips[1] >> 4; - - case 0xb4001c: - case 0xb4001d: - return DrvDips[0] & 0x0f; - - case 0xb4001e: - case 0xb4001f: - return DrvDips[0] >> 4; - } - - return 0; -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// calibr50 - -static UINT16 calibr50_input_read(INT32 offset) -{ - INT32 dir1 = 0; // analog port - INT32 dir2 = 0; // analog port - - switch (offset & 0x1e) - { - case 0x00: return DrvInputs[0]; // p1 - case 0x02: return DrvInputs[1]; // p2 - case 0x08: return DrvInputs[2]^0xff^DrvDips[2]; // Coins - case 0x10: return (dir1 & 0xff); // lower 8 bits of p1 rotation - case 0x12: return (dir1 >> 8); // upper 4 bits of p1 rotation - case 0x14: return (dir2 & 0xff); // lower 8 bits of p2 rotation - case 0x16: return (dir2 >> 8); // upper 4 bits of p2 rotation - case 0x18: return 0xffff; // ? (value's read but not used) - } - - return 0; -} - -UINT16 __fastcall calibr50_read_word(UINT32 address) -{ - switch (address) - { - case 0x400000: - case 0x400001: - watchdog = 0; - return 0xffff; - } - - if ((address & 0xfffffe0) == 0xa00000) { - return calibr50_input_read(address); - } - - SetaReadDips(0x600000) - - return 0; -} - -UINT8 __fastcall calibr50_read_byte(UINT32 address) -{ - switch (address) - { - case 0x400000: - case 0x400001: - watchdog = 0; - return 0xff; - - case 0xb00000: - case 0xb00001: - static INT32 ret; // fake read from sound cpu - ret ^= 0x80; - return ret; - } - - if ((address & 0xfffffe0) == 0xa00000) { - return calibr50_input_read(address) >> ((~address & 1) << 3); - } - - SetaReadDips(0x600000) - - return 0; -} - -void __fastcall calibr50_write_word(UINT32 address, UINT16 data) -{ - SetaVidRAMCtrlWriteWord(0, 0x800000) - - if ((address & ~1) == 0xb00000) { - *soundlatch = data; - return; - } -} - -void __fastcall calibr50_write_byte(UINT32 address, UINT8 data) -{ - SetaVidRAMCtrlWriteByte(0, 0x800000) - - if ((address & ~1) == 0xb00000) { - *soundlatch = data; - return; - } -} - -//----------------------------------------------------------------------------------------------------------------------------------- -// downtown protection handler, m65c02 simulation (metafox, arbelester) - -static UINT8 *downtown_protram; - -UINT8 __fastcall downtown_prot_read(UINT32 address) -{ - if (downtown_protram[0xf8] == 0xa3) { - if (address >= 0x200100 && address <= 0x20010b) { - char *waltz = "WALTZ0"; - return waltz[(address & 0x0f) / 2]; - } else { - return 0; - } - } - - return downtown_protram[(address & 0x1ff)^1]; -} - -static inline UINT8 simulation_input_return(UINT8 inputs, INT32 a0, INT32 a1, INT32 a2, INT32 a3) -{ - UINT8 ret = 0; - if (inputs & a0 ) ret |= 0x01; // right - if (inputs & a1 ) ret |= 0x02; // left - if (inputs & a2 ) ret |= 0x04; // up - if (inputs & a3 ) ret |= 0x08; // down - if (inputs & 0x10) ret |= 0x10; // button 1 - if (inputs & 0x20) ret |= 0x20; // button 2 - if (inputs & 0x20) ret |= 0x40; // button 3 - if (inputs & 0x80) ret |= 0x80; // start - - if ((ret & 0x0c) == 0x0c) ret &= ~0x0c; // clear opposites - if ((ret & 0x03) == 0x03) ret &= ~0x03; - - return ret; -} - -UINT8 __fastcall metafox_sharedram_read_byte(UINT32 address)// metafox input simulation -{ - static INT32 coin_read = 0; - INT32 inputs0 = DrvInputs[0]^0xffff; - INT32 inputs1 = DrvInputs[1]^0xffff; - INT32 inputs2 = (DrvInputs[2]^0xff^DrvDips[2])^0xffff; - - INT32 offset = address & 0xffe; - - if (offset == 0x014) { // handle start input... - DrvShareRAM[offset] = 0; - if (inputs0 & 0x80) DrvShareRAM[0x14] |= 0x04; // start 1 pressed - if (inputs1 & 0x80) DrvShareRAM[0x14] |= 0x08; // start 2 pressed - if (inputs2 & 0x20) DrvShareRAM[0x14] |= 0x10; // service - if (inputs2 & 0x10) DrvShareRAM[0x14] |= 0x20; // tilt - - static INT32 nPreviousStart0, nPreviousStart1; - INT32 nCurrentStart0 = inputs0 & 0x80; - INT32 nCurrentStart1 = inputs1 & 0x80; - if ((nCurrentStart0 != nPreviousStart0) && !nCurrentStart0) { - if (DrvShareRAM[0x68] && coin_read) { - DrvShareRAM[0x68]--; - coin_read = 0; - } - } - if ((nCurrentStart1 != nPreviousStart1) && !nCurrentStart1) { - if (DrvShareRAM[0x68] && coin_read) { - DrvShareRAM[0x68]--; - coin_read = 0; - } - } - nPreviousStart0 = nCurrentStart0; - nPreviousStart1 = nCurrentStart1; - } - - if (offset == 0x00a) { // player 1 inputs... - DrvShareRAM[offset] = simulation_input_return(inputs0, 8, 4, 1, 2); - } - - if (offset == 0x010) { // player 2 inputs... - DrvShareRAM[offset] = simulation_input_return(inputs1, 8, 4, 1, 2); - } - - if (offset == 0x068) { // coin1 & coin2 (needs coinage dips added) - static INT32 nPreviousCoin0, nPreviousCoin1; - INT32 nCurrentCoin0 = inputs2 & 0x80; - INT32 nCurrentCoin1 = inputs2 & 0x40; - if (nPreviousCoin0 != nCurrentCoin0) DrvShareRAM[0x068] += ((nCurrentCoin0 >> 7) & 1); - if (nPreviousCoin1 != nCurrentCoin1) DrvShareRAM[0x068] += ((nCurrentCoin1 >> 6) & 1); - if (DrvShareRAM[0x68] > 9) DrvShareRAM[0x68] = 9; - nPreviousCoin0 = nCurrentCoin0; - nPreviousCoin1 = nCurrentCoin1; - coin_read = 1; - } - - return DrvShareRAM[offset]; -} - -UINT16 __fastcall metafox_sharedram_read_word(UINT32 address) -{ - return metafox_sharedram_read_byte(address); -} - -UINT8 __fastcall tndrcade_sharedram_read_byte(UINT32 address) // tndrcade input simulation -{ - static INT32 coin_read = 0; - INT32 inputs0 = DrvInputs[0]^0xffff; - INT32 inputs1 = DrvInputs[1]^0xffff; - INT32 inputs2 = (DrvInputs[2]^0xff^DrvDips[2])^0xffff; - - INT32 offset = address & 0xffe; - - if (offset >= 0x1c0 && offset <= 0x1de) { // these are read often, the game refuses to boot without the proper sequence - if (tndrcade_init_sim > 0 && tndrcade_init_sim <= 4) { - DrvShareRAM[offset] = ((((offset - 0x1c0) / 2) * 0x0f) + 3) - (tndrcade_init_sim-1); - if (offset == 0x1de) tndrcade_init_sim++; - } else { - DrvShareRAM[offset] = ((offset & 0x1f) / 2) | (((offset & 0x1f) / 2) << 4); - if (offset == 0x1dc) tndrcade_init_sim++; - } - } - - if (offset == 0x002) return 0x31; // or error - if (offset == 0x09a) return DrvDips[1] ^ 0xff; // ? - if (offset == 0x09c) return DrvDips[0] ^ 0xff; - - if (offset == 0x014) { // handle start input... - DrvShareRAM[0x14] = 0; - if (inputs0 & 0x80) DrvShareRAM[0x14] |= 0x04; // start 1 pressed - if (inputs1 & 0x80) DrvShareRAM[0x14] |= 0x08; // start 2 pressed - if (inputs2 & 0x20) DrvShareRAM[0x14] |= 0x10; // service - if (inputs2 & 0x10) DrvShareRAM[0x14] |= 0x20; // tilt - - static INT32 nPreviousStart0, nPreviousStart1; - INT32 nCurrentStart0 = inputs0 & 0x80; - INT32 nCurrentStart1 = inputs1 & 0x80; - if ((nCurrentStart0 != nPreviousStart0) && !nCurrentStart0) { - if (DrvShareRAM[0x68] && coin_read) { - DrvShareRAM[0x68]--; - coin_read = 0; - } - } - if ((nCurrentStart1 != nPreviousStart1) && !nCurrentStart1) { - if (DrvShareRAM[0x68] && coin_read) { - DrvShareRAM[0x68]--; - coin_read = 0; - } - } - nPreviousStart0 = nCurrentStart0; - nPreviousStart1 = nCurrentStart1; - } - - if (offset == 0x00a) { // player 1 inputs... - DrvShareRAM[offset] = simulation_input_return(inputs0, 2, 1, 4, 8); - } - - if (offset == 0x010) { // player 2 inputs... - DrvShareRAM[offset] = simulation_input_return(inputs1, 2, 1, 4, 8); - } - - if (offset == 0x068) { // coin1 & coin2 (needs coinage dips added) - static INT32 nPreviousCoin0, nPreviousCoin1; - INT32 nCurrentCoin0 = inputs2 & 0x01; - INT32 nCurrentCoin1 = inputs2 & 0x02; - if (nPreviousCoin0 != nCurrentCoin0) DrvShareRAM[offset] += ((nCurrentCoin0 >> 0) & 1); - if (nPreviousCoin1 != nCurrentCoin1) DrvShareRAM[offset] += ((nCurrentCoin1 >> 1) & 1); - if (DrvShareRAM[offset] > 9) DrvShareRAM[offset] = 9; - nPreviousCoin0 = nCurrentCoin0; - nPreviousCoin1 = nCurrentCoin1; - coin_read = 1; - } - - return DrvShareRAM[(address & 0xffe)]; -} - -UINT16 __fastcall tndrcade_sharedram_read_word(UINT32 address) -{ - return tndrcade_sharedram_read_byte(address); -} - -UINT8 __fastcall downtown_sharedram_read_byte(UINT32 address) // downtown input simulation -{ -//bprintf (0, _T("%5.5x\n"), address); - static INT32 coin_read = 0; - INT32 inputs0 = DrvInputs[0]^0xffff; - INT32 inputs1 = DrvInputs[1]^0xffff; - INT32 inputs2 = (DrvInputs[2]^0xff^DrvDips[2])^0xffff; - INT32 offset = address & 0xffe; - - if (offset == 0x002) DrvShareRAM[offset] = 0x31; // or ERROR COM RAM - - if (offset == 0x070) { // coin1 & coin2 - static INT32 nPreviousCoin0, nPreviousCoin1; - INT32 nCurrentCoin0 = inputs2 & 0x80; - INT32 nCurrentCoin1 = inputs2 & 0x40; - if (nPreviousCoin0 != nCurrentCoin0) DrvShareRAM[offset] += ((nCurrentCoin0 >> 7) & 1); - if (nPreviousCoin1 != nCurrentCoin1) DrvShareRAM[offset] += ((nCurrentCoin1 >> 6) & 1); - if (DrvShareRAM[offset] > 9) DrvShareRAM[offset] = 9; - nPreviousCoin0 = nCurrentCoin0; - nPreviousCoin1 = nCurrentCoin1; - coin_read = 1; - } - - if (offset == 0x0d4) { // service button & tilt - DrvShareRAM[offset] = 0xf7; // player 1 rotation high - if (inputs2 & 0x10) DrvShareRAM[offset] ^= 0x10; - if (inputs2 & 0x20) DrvShareRAM[offset] ^= 0x20; - } - - if (offset == 0x0d6) DrvShareRAM[offset] = 0xff; // player 1 rotation low - if (offset == 0x0d8) DrvShareRAM[offset] = ~simulation_input_return(inputs0, 1, 2, 4, 8); // player 1 inputs... - if (offset == 0x0dc) DrvShareRAM[offset] = 0x0f; // player 2 rotation high - if (offset == 0x0de) DrvShareRAM[offset] = 0xbf; // player 2 rotation low - if (offset == 0x0e0) DrvShareRAM[offset] = ~simulation_input_return(inputs1, 1, 2, 4, 8); // player 2 inputs... - - if (offset >= 0x1c0 && offset <= 0x1de) { // these are read often, the game refuses to boot without the proper sequence - if (tndrcade_init_sim <= 1) { - DrvShareRAM[offset] = ((((offset - 0x1c0) / 2) * 0x0f) + 1) - tndrcade_init_sim; - if (offset == 0x1de) tndrcade_init_sim++; - } else { - DrvShareRAM[offset] = ((offset & 0x1f) / 2) | (((offset & 0x1f) / 2) << 4); - if (offset == 0x1dc) tndrcade_init_sim++; - } - } - - return DrvShareRAM[offset]; -} - -UINT16 __fastcall downtown_sharedram_read_word(UINT32 address) -{ - downtown_sharedram_read_byte(address & 0xffe); - return DrvShareRAM[address & 0xffe]; // -} - -UINT8 __fastcall twineagl_sharedram_read_byte(UINT32 address) // twineagl input simulation -{ - static INT32 coin_read = 0; - INT32 inputs0 = DrvInputs[0]^0xffff; - INT32 inputs1 = DrvInputs[1]^0xffff; - INT32 inputs2 = (DrvInputs[2]^0xff^DrvDips[2])^0xffff; - INT32 offset = address & 0xffe; - - if (offset == 0x000) DrvShareRAM[offset] = 0x00; - if (offset == 0x002) DrvShareRAM[offset] = 0x31; // or ERROR COM RAM - - if (offset == 0x00a) { // player 1 inputs... - DrvShareRAM[offset] = simulation_input_return(inputs0, 2, 1, 4, 8); - } - - if (offset == 0x010) { // player 2 inputs... - DrvShareRAM[offset] = simulation_input_return(inputs1, 2, 1, 4, 8); - } - - if (offset == 0x014) { // handle start input... - DrvShareRAM[offset] = 0; - if (inputs0 & 0x80) DrvShareRAM[offset] |= 0x04; // start 1 pressed - if (inputs1 & 0x80) DrvShareRAM[offset] |= 0x08; // start 2 pressed - if (inputs2 & 0x20) DrvShareRAM[offset] |= 0x10; // service - if (inputs2 & 0x10) DrvShareRAM[offset] |= 0x20; // tilt - - static INT32 nPreviousStart0, nPreviousStart1; - INT32 nCurrentStart0 = inputs0 & 0x80; - INT32 nCurrentStart1 = inputs1 & 0x80; - if ((nCurrentStart0 != nPreviousStart0) && !nCurrentStart0) { - if (DrvShareRAM[0x68] && coin_read) { - DrvShareRAM[0x68]--; - coin_read = 0; - } - } - if ((nCurrentStart1 != nPreviousStart1) && !nCurrentStart1) { - if (DrvShareRAM[0x68] > 1 && coin_read) { - DrvShareRAM[0x68]-=2; - coin_read = 0; - } - } - nPreviousStart0 = nCurrentStart0; - nPreviousStart1 = nCurrentStart1; - } - - if (offset == 0x068) { // coin1 & coin2 - static INT32 nPreviousCoin0, nPreviousCoin1; - INT32 nCurrentCoin0 = inputs2 & 0x01; - INT32 nCurrentCoin1 = inputs2 & 0x02; - if (nPreviousCoin0 != nCurrentCoin0) DrvShareRAM[offset] += ((nCurrentCoin0 >> 0) & 1); - if (nPreviousCoin1 != nCurrentCoin1) DrvShareRAM[offset] += ((nCurrentCoin1 >> 1) & 1); - if (DrvShareRAM[offset] > 9) DrvShareRAM[offset] = 9; - nPreviousCoin0 = nCurrentCoin0; - nPreviousCoin1 = nCurrentCoin1; - coin_read = 1; - } - - if (offset == 0x0a8) { // more start inputs... - if (coin_read && ((inputs0 & 0x80) || (inputs1 & 0x80))) { - DrvShareRAM[offset] = 0; - if (inputs0 & 0x80) DrvShareRAM[offset] |= 0x04; // start 1 pressed - if (inputs1 & 0x80) DrvShareRAM[offset] |= 0x08; // start 2 pressed - } - } - - if (offset >= 0x1c0 && offset <= 0x1de) { // these are read often, the game refuses to boot without the proper sequence - if (tndrcade_init_sim <= 1) { - DrvShareRAM[offset] = ((((offset - 0x1c0) / 2) * 0x0f) + 1) - tndrcade_init_sim; - if (offset == 0x1de) tndrcade_init_sim++; - } else { - DrvShareRAM[offset] = ((offset & 0x1f) / 2) | (((offset & 0x1f) / 2) << 4); - if (offset == 0x1dc) tndrcade_init_sim++; - } - } - - return DrvShareRAM[offset]; -} - -UINT16 __fastcall twineagl_sharedram_read_word(UINT32 address) -{ - INT32 offset = address & 0xffe; - twineagl_sharedram_read_byte(offset); - return DrvShareRAM[offset]; -} - -void __fastcall twineagl_sharedram_write_word(UINT32 address, UINT16 data) -{ - INT32 offset = address & 0xffe; - - data &= 0xff; - - DrvShareRAM[offset] = data; - - if (offset == 0x400 && data) { - INT32 ofst = 0; - - for (INT32 i = 0; i < 0x100; i+=16) { - if (DrvShareRAM[i + 0x200] == 0) { - ofst = i + 0x200; - break; - } - } - if (ofst == 0) return; - - // add to playlist - { - INT32 ofst2 = (DrvShareRAM[offset] * 0x0b) + 0x204; // find song data in m65c02 rom (correct?) - - DrvShareRAM[ofst + 0] = 0x81; - DrvShareRAM[ofst + 2] = DrvSubROM[ofst2 + 0]; - DrvShareRAM[ofst + 4] = DrvSubROM[ofst2 + 1]; - DrvShareRAM[ofst + 8] = DrvSubROM[ofst2 + 2]; - } - } -} - -void __fastcall twineagl_sharedram_write_byte(UINT32 address, UINT8 data) -{ - twineagl_sharedram_write_word(address, data); -} - - -//----------------------------------------------------------------------------------------------------------------------------------- -// crazy fight - -UINT16 __fastcall crazyfgt_read_word(UINT32 address) -{ - switch (address) - { - case 0x610000: - case 0x610001: - return DrvInputs[0]; - - case 0x610002: - case 0x610003: - return 0xffff; - - case 0x610004: - case 0x610005: - return DrvInputs[1]; - } - - SetaReadDips(0x630000) - - return 0; -} - -UINT8 __fastcall crazyfgt_read_byte(UINT32 address) -{ - switch (address) - { - case 0x610000: - case 0x610001: - return DrvInputs[0]; - - case 0x610002: - case 0x610003: - return 0xff; - - case 0x610004: - case 0x610005: - return DrvInputs[1]; - } - - SetaReadDips(0x630000) - - return 0; -} - -void __fastcall crazyfgt_write_byte(UINT32 address, UINT8 data) -{ - SetaVidRAMCtrlWriteByte(1, 0x900000) - SetaVidRAMCtrlWriteByte(0, 0x980000) - - switch (address) - { - case 0x650000: - case 0x650001: - BurnYM3812Write(0, data); - return; - - case 0x658000: - case 0x658001: - MSM6295Command(0, data); - return; - } -} - -void __fastcall crazyfgt_write_word(UINT32 address, UINT16 data) -{ - SetaVidRAMCtrlWriteWord(1, 0x900000) - SetaVidRAMCtrlWriteWord(0, 0x980000) - - switch (address) - { - case 0x650000: - case 0x650001: - BurnYM3812Write(0, data); - return; - - case 0x658000: - case 0x658001: - MSM6295Command(0, data); - return; - } -} - - -//----------------------------------------------------------------------------------------------------------------------------------- -// 68k initializers - -static void drgnunit68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0bffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x700000, 0x7003ff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x900000, 0x903fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xf00000, 0xf0ffff, SM_RAM); - SekMapMemory(Drv68KRAM + 0x0010000, 0xffc000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, drgnunit_write_word); - SekSetWriteByteHandler(0, drgnunit_write_byte); - SekSetReadWordHandler(0, drgnunit_read_word); - SekSetReadByteHandler(0, drgnunit_read_byte); - - SekMapHandler(1, 0x100000, 0x103fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); -} - -static void daioh68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(Drv68KRAM + 0x0010000, 0x700000, 0x7003ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); - SekMapMemory(Drv68KRAM2, 0x701000, 0x70ffff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x800000, 0x80ffff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x880000, 0x88ffff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(Drv68KRAM + 0x0020000, 0xa80000, 0xa803ff, SM_WRITE); // nop out - SekMapMemory(DrvSprRAM1, 0xb00000, 0xb13fff, SM_RAM); - SekSetWriteWordHandler(0, daioh_write_word); - SekSetWriteByteHandler(0, daioh_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); -} - -static void wrofaero68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x21ffff, SM_RAM); - SekMapMemory(Drv68KRAM2, 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x7003ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0011000, 0x701000, 0x70ffff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x800000, 0x80ffff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x880000, 0x88ffff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xb00000, 0xb13fff, SM_RAM); - SekSetWriteWordHandler(0, daioh_write_word); - SekSetWriteByteHandler(0, daioh_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); -} - -static void msgundam68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - - for (INT32 i = 0; i < 0x80000; i+=0x10000) // mirrored - SekMapMemory(Drv68KRAM, 0x200000+i, 0x20ffff+i, SM_RAM); - - SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0x800000, 0x800607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0x900000, 0x903fff, SM_RAM); - - SekMapMemory(DrvVidRAM0, 0xa00000, 0xa0ffff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0xa80000, 0xa8ffff, SM_RAM); - SekSetWriteWordHandler(0, msgundam_write_word); - SekSetWriteByteHandler(0, msgundam_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); -} - -static void umanclub68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x300000, 0x300fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xb00000, 0xb03fff, SM_RAM); - SekSetWriteWordHandler(0, daioh_write_word); - SekSetWriteByteHandler(0, daioh_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); -} - -static void kamenrid68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x7003ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0011000, 0x701000, 0x703fff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x800000, 0x807fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x880000, 0x887fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xb00000, 0xb07fff, SM_RAM); - SekSetWriteWordHandler(0, madshark_write_word); - SekSetWriteByteHandler(0, madshark_write_byte); - SekSetReadWordHandler(0, kamenrid_read_word); - SekSetReadByteHandler(0, kamenrid_read_byte); - - SekMapHandler(1, 0xd00000, 0xd03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); - - { - DrvGfxROM2 = DrvGfxROM1 + 0x80000; - DrvROMLen[2] = DrvROMLen[1] = DrvROMLen[1] / 2; - memcpy (DrvGfxROM2, DrvGfxROM1 + 0x40000, 0x40000); - } -} - -static void madshark68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x7003ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0011000, 0x701000, 0x703fff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x800000, 0x807fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x880000, 0x887fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xb00000, 0xb07fff, SM_RAM); - SekSetWriteWordHandler(0, madshark_write_word); - SekSetWriteByteHandler(0, madshark_write_byte); - SekSetReadWordHandler(0, madshark_read_word); - SekSetReadByteHandler(0, madshark_read_byte); - - SekMapHandler(1, 0xd00000, 0xd03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); - - { - DrvGfxROM2 = (UINT8*)BurnMalloc(0x200000); - DrvROMLen[1] = DrvROMLen[2] = 0x200000; - - memcpy (DrvGfxROM0 + 0x200000, DrvGfxROM0 + 0x000000, 0x100000); - memcpy (DrvGfxROM0 + 0x000000, DrvGfxROM0 + 0x100000, 0x200000); - - memcpy (DrvGfxROM2 + 0x000000, DrvGfxROM1 + 0x100000, 0x100000); - memcpy (DrvGfxROM2 + 0x100000, DrvGfxROM1 + 0x300000, 0x100000); - memcpy (DrvGfxROM1 + 0x100000, DrvGfxROM1 + 0x200000, 0x100000); - } -} - -static void thunderl68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x00ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x700000, 0x700fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xe00000, 0xe07fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xffc000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, thunderl_write_word); - SekSetWriteByteHandler(0, thunderl_write_byte); - SekSetReadWordHandler(0, thunderl_read_word); - SekSetReadByteHandler(0, thunderl_read_byte); - - SekMapHandler(1, 0x100000, 0x103fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); -} - -static void atehate68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x700000, 0x700fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x900000, 0x9fffff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); - SekSetWriteWordHandler(0, thunderl_write_word); - SekSetWriteByteHandler(0, thunderl_write_byte); - SekSetReadWordHandler(0, thunderl_read_word); - SekSetReadByteHandler(0, thunderl_read_byte); - - SekMapHandler(1, 0x100000, 0x103fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); -} - -static void blockcar68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0xb00000, 0xb00fff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xc00000, 0xc03fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xe00000, 0xe00607 | 0x7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xf00000, 0xf05fff, SM_RAM); - SekSetWriteWordHandler(0, thunderl_write_word); - SekSetWriteByteHandler(0, thunderl_write_byte); - SekSetReadWordHandler(0, madshark_read_word); - SekSetReadByteHandler(0, madshark_read_byte); - - SekMapHandler(1, 0xa00000, 0xa03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); - - memcpy (DrvSndROM + 0x80000, DrvSndROM, 0x80000); -} - -static void zombraid68kInit() -{ - wrofaero68kInit(); - - SekOpen(0); - SekMapHandler(2, 0xf00000, 0xf00003, SM_READ | SM_WRITE); - SekSetReadWordHandler (2, zombraid_gun_read_word); - SekSetReadByteHandler (2, zombraid_gun_read_byte); - SekSetWriteWordHandler(2, zombraid_gun_write_word); - SekSetWriteByteHandler(2, zombraid_gun_write_byte); - SekClose(); - - memcpy (DrvSndROM + 0x100000, DrvSndROM + 0x080000, 0x280000); -} - -static void BlandiaGfxRearrange() -{ - INT32 rom_size = DrvROMLen[1]; - UINT8 *buf = (UINT8*)BurnMalloc(rom_size); - - UINT8 *rom = DrvGfxROM1 + 0x40000; - - if (rom_size == 0x100000) memcpy (rom, rom + 0x40000, 0x80000); // blandia - - for (INT32 rpos = 0; rpos < 0x80000/2; rpos++) { - buf[rpos+0x40000] = rom[rpos*2]; - buf[rpos] = rom[rpos*2+1]; - } - - memcpy (rom, buf, 0x80000); - - rom = DrvGfxROM2 + 0x40000; - - if (rom_size == 0x100000) memcpy (rom, rom + 0x40000, 0x80000); // blandia - - for (INT32 rpos = 0; rpos < 0x80000/2; rpos++) { - buf[rpos+0x40000] = rom[rpos*2]; - buf[rpos] = rom[rpos*2+1]; - } - - memcpy (rom, buf, 0x80000); - - DrvROMLen[1] = DrvROMLen[2] = 0xc0000; - - BurnFree (buf); -} - -static void blandia68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x21ffff, SM_RAM); - SekMapMemory(Drv68KRAM2, 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x7003ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0011000, 0x701000, 0x70ffff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0x800000, 0x800607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0x900000, 0x903fff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0xb00000, 0xb0ffff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0xb80000, 0xb8ffff, SM_RAM); - SekSetWriteWordHandler(0, daioh_write_word); - SekSetWriteByteHandler(0, daioh_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); - - memmove (Drv68KROM + 0x100000, Drv68KROM + 0x080000, 0x100000); - memmove (DrvSndROM + 0x100000, DrvSndROM + 0x0c0000, 0x0c0000); - - BlandiaGfxRearrange(); -} - -static void blandiap68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x21ffff, SM_RAM); - SekMapMemory(Drv68KRAM2, 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x7003ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0011000, 0x701000, 0x70ffff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x800000, 0x80ffff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x880000, 0x88ffff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(Drv68KRAM + 0x0020000, 0xa80000, 0xa803ff, SM_WRITE); //nop - SekMapMemory(DrvSprRAM1, 0xb00000, 0xb03fff, SM_RAM); - SekSetWriteWordHandler(0, daioh_write_word); - SekSetWriteByteHandler(0, daioh_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); - - memmove (Drv68KROM + 0x100000, Drv68KROM + 0x080000, 0x100000); - - // set up sound banks... - { - UINT8 *tmp = (UINT8*)BurnMalloc(0x240000); - - INT32 offsets[16] = { - 0x000000, 0x140000, 0x020000, 0x160000, - 0x040000, 0x180000, 0x060000, 0x1a0000, - 0x080000, 0x1c0000, 0x0a0000, 0x1e0000, - 0x100000, 0x200000, 0x120000, 0x220000 - }; - - for (INT32 i = 0; i < 16; i++) { - memcpy (tmp + offsets[i], DrvSndROM + (i * 0x020000), 0x020000); - } - - memcpy (DrvSndROM, tmp, 0x240000); - - BurnFree (tmp); - } -} - -static void oisipuzl68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x800000, 0x803fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x880000, 0x883fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xb00000, 0xb03fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xc00400, 0xc00fff, SM_RAM); - SekSetWriteWordHandler(0, daioh_write_word); - SekSetWriteByteHandler(0, daioh_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0x700000, 0x703fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); -} - -static void pairlove68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvNVRAM, 0x800000, 0x8001ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xb00000, 0xb00fff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xc00000, 0xc03fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xe00000, 0xe00607 | 0x7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xf00000, 0xf0ffff, SM_RAM); - SekSetWriteWordHandler(0, pairlove_write_word); - SekSetWriteByteHandler(0, pairlove_write_byte); - SekSetReadWordHandler(0, pairlove_read_word); - SekSetReadByteHandler(0, pairlove_read_byte); - - SekMapHandler(1, 0xa00000, 0xa03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); -} - -static void jjsquawkb68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x21ffff, SM_RAM); - SekMapMemory(Drv68KRAM2, 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x70b3ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x70b400, 0x70bfff, SM_RAM); - SekMapMemory(Drv68KRAM2 + 0x001c000, 0x70c000, 0x70ffff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x800000, 0x803fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x804000, 0x807fff, SM_RAM); - SekMapMemory(DrvVidRAM1 + 0x4000, 0x884000, 0x88ffff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa0a000, 0xa0a607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xb0c000, 0xb0ffff, SM_RAM); - SekSetWriteWordHandler(0, daioh_write_word); - SekSetWriteByteHandler(0, daioh_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); - - BurnLoadRom(Drv68KROM + 0x0000000, 0, 1); - BurnLoadRom(Drv68KROM + 0x0100000, 1, 1); - - DrvGfxROM2 = DrvGfxROM1 + 0x400000; - DrvROMLen[1] = DrvROMLen[2] = 0x200000; - - memcpy (DrvGfxROM2 + 0x000000, DrvGfxROM1 + 0x100000, 0x100000); - memcpy (DrvGfxROM2 + 0x100000, DrvGfxROM1 + 0x300000, 0x100000); - memcpy (DrvGfxROM1 + 0x100000, DrvGfxROM1 + 0x200000, 0x100000); -} - -static void extdwnhl68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x23ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x600400, 0x600fff, SM_RAM); - SekMapMemory(Drv68KRAM2, 0x601000, 0x610bff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x800000, 0x80ffff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x880000, 0x88ffff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xb00000, 0xb13fff, SM_RAM); - SekSetWriteWordHandler(0, daioh_write_word); - SekSetWriteByteHandler(0, daioh_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0xe00000, 0xe03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); - - // swap halves of sound rom - memcpy (DrvSndROM + 0x100000, DrvSndROM + 0x000000, 0x080000); - memcpy (DrvSndROM + 0x000000, DrvSndROM + 0x080000, 0x100000); -} - -static void krzybowl68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvNVRAM, 0x800000, 0x8001ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xb00000, 0xb003ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xc00000, 0xc03fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xe00000, 0xe00607 | 0x7ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xf00000, 0xf0ffff, SM_RAM); - SekSetWriteWordHandler(0, thunderl_write_word); - SekSetWriteByteHandler(0, thunderl_write_byte); - SekSetReadWordHandler(0, madshark_read_word); - SekSetReadByteHandler(0, madshark_read_byte); - - SekMapHandler(1, 0xa00000, 0xa03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); -} - -void __fastcall triplfun_sound_write_byte(UINT32 address, UINT8 data) -{ - if ((address & ~1) == 0x500006) { - MSM6295Command(0, data); - } -} - -UINT8 __fastcall triplfun_sound_read_byte(UINT32) -{ - return MSM6295ReadStatus(0); -} - -static void triplfun68kInit() -{ - oisipuzl68kInit(); - - SekOpen(0); - SekMapHandler(2, 0x500006, 0x500007, SM_READ | SM_WRITE); -// SekSetReadWordHandler (2, triplfun_sound_read_word); - SekSetReadByteHandler (2, triplfun_sound_read_byte); -// SekSetWriteWordHandler(2, triplfun_sound_write_word); - SekSetWriteByteHandler(2, triplfun_sound_write_byte); - SekClose(); - - MSM6295Exit(0); - MSM6295Init(0, 792000 / 132, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - memcpy (Drv68KROM + 0x100000, Drv68KROM + 0x080000, 0x080000); - memset (Drv68KROM + 0x080000, 0, 0x080000); -} - -static void utoukond68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x800000, 0x803fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x880000, 0x883fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xb00000, 0xb03fff, SM_RAM); - SekSetWriteWordHandler(0, daioh_write_word); - SekSetWriteByteHandler(0, daioh_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0xc00000, 0xc00001, SM_WRITE); - SekSetWriteWordHandler(1, wiggie_sound_write_word); - SekSetWriteByteHandler(1, wiggie_sound_write_byte); - SekClose(); - - ZetOpen(0); - ZetMapArea(0x0000, 0xdfff, 0, DrvSubROM); - ZetMapArea(0x0000, 0xdfff, 2, DrvSubROM); - ZetMapArea(0xe000, 0xefff, 0, DrvSubRAM); - ZetMapArea(0xe000, 0xefff, 1, DrvSubRAM); - ZetMapArea(0xe000, 0xefff, 2, DrvSubRAM); - ZetSetWriteHandler(utoukond_sound_write); - ZetSetReadHandler(utoukond_sound_read); - ZetSetOutHandler(utoukond_sound_write_port); - ZetSetInHandler(utoukond_sound_read_port); - ZetMemEnd(); - ZetClose(); - - for (INT32 i = 0; i < 0x400000; i++) DrvGfxROM0[i] ^= 0xff; -} - -static void Wiggie68kDecode() -{ - UINT8 *tmp = Drv68KRAM; - - for (INT32 i = 0; i < 0x20000; i+=16) { - for (INT32 j = 0; j < 16; j++) { - tmp[j] = Drv68KROM[i+((j & 1) | ((j & 2) << 2) | ((j & 0x0c) >> 1))]; - } - memcpy (Drv68KROM + i, tmp, 0x10); - } -} - -static void wiggie68kInit() -{ - thunderl68kInit(); - - SekOpen(0); - SekMapMemory(Drv68KRAM + 0x80000, 0x100000, 0x103fff, SM_READ); // nop - - SekMapHandler(1, 0xb00008, 0xb00009, SM_WRITE); - SekSetWriteWordHandler(1, wiggie_sound_write_word); - SekSetWriteByteHandler(1, wiggie_sound_write_byte); - SekClose(); - - Wiggie68kDecode(); - - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvSubROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvSubROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvSubRAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvSubRAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvSubRAM); - ZetSetWriteHandler(wiggie_sound_write); - ZetSetReadHandler(wiggie_sound_read); - ZetMemEnd(); - ZetClose(); -} - -static void downtown68kInit() -{ - downtown_protram = DrvNVRAM; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x09ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x700000, 0x7003ff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x900000, 0x903fff, SM_RAM); - SekMapMemory(DrvShareRAM, 0xb00000, 0xb00fff, SM_WRITE); // m65c02 not emulated, simulate instead - SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xf00000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, downtown_write_word); - SekSetWriteByteHandler(0, downtown_write_byte); - SekSetReadWordHandler(0, daioh_read_word); - SekSetReadByteHandler(0, daioh_read_byte); - - SekMapHandler(1, 0x100000, 0x103fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - - SekMapMemory(downtown_protram, 0x200000, 0x2003ff, SM_WRITE); - SekMapHandler(2, 0x200000, 0x2003ff, SM_READ); - SekSetReadByteHandler (2, downtown_prot_read); - - SekMapHandler(3, 0xb00000, 0xb00fff, SM_READ); - SekSetReadByteHandler (3, downtown_sharedram_read_byte); - SekSetReadWordHandler (3, downtown_sharedram_read_word); - SekClose(); -} - -static void metafox68kInit() -{ - downtown68kInit(); - - SekOpen(0); - SekSetReadByteHandler (3, metafox_sharedram_read_byte); - SekSetReadWordHandler (3, metafox_sharedram_read_word); - SekClose(); -} - -static void tndrcade68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x380000, 0x3803ff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0x600000, 0x600607 | 0x7ff, SM_RAM); - SekMapMemory(DrvShareRAM, 0xa00000, 0xa00fff, SM_WRITE); // m65c02 not emulated, simulate instead - SekMapMemory(DrvSprRAM1, 0xc00000, 0xc03fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xe00000, 0xe03fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xffc000, 0xffffff, SM_RAM); - - // install simulation to make game playable - SekMapHandler(3, 0xa00000, 0xa00fff, SM_READ); - SekSetReadByteHandler (3, tndrcade_sharedram_read_byte); - SekSetReadWordHandler (3, tndrcade_sharedram_read_word); - SekClose(); -} - -static void kiwame68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0x800000, 0x803fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xb00000, 0xb003ff, SM_RAM); - SekMapMemory(DrvNVRAM, 0xfffc00, 0xffffff, SM_WRITE); - - SekSetReadWordHandler(0, kiwame_read_word); - SekSetReadByteHandler(0, kiwame_read_byte); - - SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); - - { - // give the game proper vectors - *((UINT16 *)(Drv68KROM + 0x00064)) = 0x0000; - *((UINT16 *)(Drv68KROM + 0x00066)) = 0x0dca; - - // get past backup ram error - // the game never actually tests it before failing?? - *((UINT16 *)(Drv68KROM + 0x136d2)) = 0x6052; - } -} - -UINT8 __fastcall twineagle_extram_read_byte(UINT32 address) -{ - return DrvNVRAM[address & 0x3fe]; -} - -static void twineagle68kInit() -{ - downtown68kInit(); - - SekOpen(0); - SekMapMemory(DrvNVRAM, 0x200000, 0x2003ff, SM_WRITE); - SekMapHandler(2, 0x200000, 0x2003ff, SM_READ); - SekSetReadByteHandler (2, twineagle_extram_read_byte); - - SekMapHandler(3, 0xb00000, 0xb00fff, SM_READ | SM_WRITE); - SekSetReadByteHandler (3, twineagl_sharedram_read_byte); - SekSetReadWordHandler (3, twineagl_sharedram_read_word); - SekSetWriteWordHandler(3, twineagl_sharedram_write_word); - SekSetWriteByteHandler(3, twineagl_sharedram_write_byte); - SekClose(); - - BurnByteswap(Drv68KROM, 0x80000); -} - -static void crazyfgt68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x640400, 0x640fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x800000, 0x803fff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x880000, 0x883fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xb00000, 0xb03fff, SM_RAM); - SekSetWriteWordHandler(0, crazyfgt_write_word); - SekSetWriteByteHandler(0, crazyfgt_write_byte); - SekSetReadWordHandler(0, crazyfgt_read_word); - SekSetReadByteHandler(0, crazyfgt_read_byte); - SekClose(); - - // Patch protection - *((UINT16*)(Drv68KROM + 0x1078)) = 0x4e71; - - BlandiaGfxRearrange(); // fix bg tiles -} - -static void usclssic68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvSprRAM0, 0x800000, 0x800607 | 0x7ff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xb00000, 0xb003ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xc00000, 0xc03fff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0xd00000, 0xd04fff, SM_RAM); - SekMapMemory(Drv68KRAM2, 0xe00000, 0xe00fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xff0000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, usclssic_write_word); - SekSetWriteByteHandler(0, usclssic_write_byte); - SekSetReadWordHandler(0, usclssic_read_word); - SekSetReadByteHandler(0, usclssic_read_byte); - SekClose(); - - // m65c02 sound... -} - -static void calibr5068kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x09ffff, SM_ROM); - SekMapMemory(Drv68KRAM2, 0x200000, 0x200fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x700000, 0x7003ff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x900000, 0x904fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xff0000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, calibr50_write_word); - SekSetWriteByteHandler(0, calibr50_write_byte); - SekSetReadWordHandler(0, calibr50_read_word); - SekSetReadByteHandler(0, calibr50_read_byte); - SekClose(); - - // m65c02 sound... -} - -//----------------------------------------------------------------------------------------------------------------------------------- - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0x20, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0x20, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static INT32 DrvYM3812SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)SekTotalCycles() * nSoundRate / 16000000; -} - - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000.0; -} - -static INT32 DrvGfxDecode(INT32 type, UINT8 *gfx, INT32 num) -{ - DrvGfxTransMask[num] = NULL; - - INT32 len = DrvROMLen[num]; - if (DrvROMLen[num] == 0) DrvGfxMask[num] = 1; // no divide by 0 - if (len == 0 || type == -1) return 0; - - INT32 Plane0[4] = { ((len * 8) / 2) + 8, ((len * 8) / 2) + 0, 8, 0 }; - INT32 XOffs0[16] = { 0,1,2,3,4,5,6,7, 128,129,130,131,132,133,134,135 }; - INT32 YOffs0[16] = { 0*16,1*16,2*16,3*16,4*16,5*16,6*16,7*16, 16*16,17*16,18*16,19*16,20*16,21*16,22*16,23*16 }; - - INT32 Plane1[4] = { 0, 4, ((len * 8) / 2) + 0, ((len * 8) / 2) + 4 }; - INT32 Plane1a[6] = { (((len * 8) / 3) * 0) + 0, (((len * 8) / 3) * 0) + 4, (((len * 8) / 3) * 1) + 0, (((len * 8) / 3) * 1) + 4, (((len * 8) / 3) * 2) + 0, (((len * 8) / 3) * 2) + 4 }; - INT32 XOffs1[16] = { 128+64,128+65,128+66,128+67, 128+0,128+1,128+2,128+3, 8*8+0,8*8+1,8*8+2,8*8+3, 0,1,2,3 }; - INT32 YOffs1[16] = { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8, 32*8,33*8,34*8,35*8,36*8,37*8,38*8,39*8 }; - - INT32 Plane2[6] = { ((len * 8) / 2)+0*4, ((len * 8) / 2)+1*4, 2*4,3*4,0*4,1*4 }; - INT32 XOffs2[16] = { 256+128,256+129,256+130,256+131, 256+0,256+1,256+2,256+3, 128,129,130,131, 0,1,2,3 }; - INT32 YOffs2[16] = { 0*16,1*16,2*16,3*16,4*16,5*16,6*16,7*16, 32*16,33*16,34*16,35*16,36*16,37*16,38*16,39*16 }; - - INT32 Plane3[4] = { ((len * 8) / 4) * 0, ((len * 8) / 4) * 1, ((len * 8) / 4) * 2, ((len * 8) / 4) * 3 }; - INT32 XOffs3[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; - INT32 YOffs3[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128+0, 128+8, 128+16, 128+24, 128+32, 128+40, 128+48, 128+56 }; - INT32 YOffs3a[16]= { 0*8, 16*8, 4*8, 20*8, 2*8, 18*8, 6*8, 22*8, 1*8, 17*8, 5*8, 21*8, 3*8, 19*8, 7*8, 23*8 }; // wiggie - INT32 YOffs3b[16]= { 0*8, 2*8, 16*8, 18*8, 1*8, 3*8, 17*8, 19*8, 4*8, 6*8, 20*8, 22*8, 5*8, 7*8,21*8, 23*8 }; // superbar - - UINT8 *tmp = (UINT8*)BurnMalloc(len); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, gfx, len); - - switch (type) - { - case 0: // layout_planes_2roms - GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane0, XOffs0, YOffs0, 0x200, tmp, gfx); - DrvGfxMask[num] = (len * 2) / (16 * 16); - ColorDepths[num] = 4; - break; - - case 1: // layout_planes_2roms_split - GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane1, XOffs1, YOffs1, 0x200, tmp, gfx); - DrvGfxMask[num] = (len * 2) / (16 * 16); - ColorDepths[num] = 4; - break; - - case 2: // layout_packed - GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane2 + 2, XOffs2, YOffs2, 0x400, tmp, gfx); - DrvGfxMask[num] = (len * 2) / (16 * 16); - ColorDepths[num] = 4; - break; - - case 3: // layout_packed_6bits_2roms - GfxDecode((len * 1) / (16 * 16), 6, 16, 16, Plane2 + 0, XOffs2, YOffs2, 0x400, tmp, gfx); - DrvGfxMask[num] = (len * 1) / (16 * 16); - ColorDepths[num] = 6; //handled like 4 - break; - - case 4: // layout_packed_6bits_3roms - GfxDecode(((len * 8)/6) / (16 * 16), 6, 16, 16, Plane1a, XOffs1, YOffs1, 0x200, tmp, gfx); - DrvGfxMask[num] = ((len * 8)/6) / (16 * 16); - ColorDepths[num] = 6; //handled like 4 - break; - - case 5: // layout_planes - GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane3, XOffs3, YOffs3 , 0x100, tmp, gfx); - DrvGfxMask[num] = (len * 2) / (16 * 16); - ColorDepths[num] = 4; - break; - - case 6: // wiggie_layout - GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane3, XOffs3, YOffs3a, 0x100, tmp, gfx); - DrvGfxMask[num] = (len * 2) / (16 * 16); - ColorDepths[num] = 4; - break; - - case 7: // superbar_layout - GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane3, XOffs3, YOffs3b, 0x100, tmp, gfx); - DrvGfxMask[num] = (len * 2) / (16 * 16); - ColorDepths[num] = 4; - break; - } - - BurnFree (tmp); - - { - INT32 size = DrvGfxMask[num]; - - DrvGfxTransMask[num] = (UINT8*)BurnMalloc(size); - - for (INT32 i = 0; i < size << 8; i += (1 << 8)) { - DrvGfxTransMask[num][i >> 8] = 1; // transparent - for (INT32 j = 0; j < (1 << 8); j++) { - if (gfx[i + j]) { - DrvGfxTransMask[num][i >> 8] = 0; - break; - } - } - } - } - - return 0; -} - -static INT32 DrvLoadRoms(INT32 bload) -{ - char* pRomName; - struct BurnRomInfo ri, rh; - - UINT8 *LoadPrg[2] = { Drv68KROM, DrvSubROM }; - UINT8 *LoadGfx[5] = { DrvGfxROM0, DrvGfxROM1, DrvGfxROM2, DrvSndROM, DrvColPROM }; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - - BurnDrvGetRomInfo(&ri, i + 0); - BurnDrvGetRomInfo(&rh, i + 1); - - if ((ri.nType & 7) < 3 && (ri.nType & 7)) { - INT32 type = (ri.nType - 1) & 1; - - if ((rh.nType & 7) == 1 && (rh.nLen == ri.nLen)) { - if (bload) if (BurnLoadRom(LoadPrg[type] + 0, i + 1, 2)) return 1; - if (bload) if (BurnLoadRom(LoadPrg[type] + 1, i + 0, 2)) return 1; - LoadPrg[type] += ri.nLen * 2; - i++; // loading two roms - } else { - if (bload) if (BurnLoadRom(LoadPrg[type], i, 1)) return 1; - LoadPrg[type] += ri.nLen; - } - continue; - } - - if ((ri.nType & 7) == 3 || (ri.nType & 7) == 4 || (ri.nType & 7) == 5 || (ri.nType & 7) == 6 || (ri.nType & 7) == 7) { // gfx, snd, colprom - INT32 type = (ri.nType & 7) - 3; - - if (ri.nType & 8) { // interleaved... - if (bload) if (BurnLoadRom(LoadGfx[type] + 0, i + 0, 2)) return 1; - - if ((ri.nType & 16) == 0) { // zingzap - if (bload) if (BurnLoadRom(LoadGfx[type] + 1, i + 1, 2)) return 1; - i++; - } - - LoadGfx[type] += ri.nLen * 2; - } else { - if (bload) if (BurnLoadRom(LoadGfx[type], i, 1)) return 1; - LoadGfx[type] += ri.nLen; - } - - continue; - } - } - - if (bload == 0) { - DrvROMLen[0] = LoadGfx[0] - DrvGfxROM0; - DrvROMLen[1] = LoadGfx[1] - DrvGfxROM1; - DrvROMLen[2] = LoadGfx[2] - DrvGfxROM2; - DrvROMLen[3] = LoadGfx[3] - DrvSndROM; - DrvROMLen[4] = LoadGfx[4] - DrvColPROM; - - // bprintf (0, _T("%x, %x, %x, %x %x\n"), DrvROMLen[0], DrvROMLen[1], DrvROMLen[2], DrvROMLen[3], DrvROMLen[4]); - } - - return 0; -} - -static INT32 DrvDoReset(INT32 ram) -{ - if (ram) memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); // wiggie, utoukond, superbar - ZetReset(); - ZetClose(); - - x1010Reset(); - MSM6295Reset(0); - BurnYM3438Reset(); - BurnYM3812Reset(); - - watchdog = 0; - - tndrcade_init_sim = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x200000; - DrvSubROM = Next; Next += 0x050000; - - DrvGfxROM2 = Next; Next += DrvROMLen[2] * 2; - DrvGfxROM1 = Next; Next += DrvROMLen[1] * 2; - DrvGfxROM0 = Next; Next += DrvROMLen[0] * 2; - - DrvColPROM = Next; Next += 0x000800; - - MSM6295ROM = Next; - X1010SNDROM = Next; - DrvSndROM = Next; Next += DrvROMLen[3] + 0x100000; // for banking - - Palette = (UINT32*)Next; Next += BurnDrvGetPaletteEntries() * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += BurnDrvGetPaletteEntries() * sizeof(UINT32); - - DrvNVRAM = Next; Next += 0x000400; - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x100000; - Drv68KRAM2 = Next; Next += 0x020000; - DrvSubRAM = Next; Next += 0x001000; - DrvPalRAM = Next; Next += 0x001000; - DrvSprRAM0 = Next; Next += 0x000800; - DrvSprRAM1 = Next; Next += 0x014000; - - DrvVidRAM0 = Next; Next += 0x010000; - DrvVIDCTRLRAM0 = Next; Next += 0x000008; - - DrvVidRAM1 = Next; Next += 0x010000; - DrvVIDCTRLRAM1 = Next; Next += 0x000008; - - DrvVideoRegs = Next; Next += 0x000008; - - soundlatch = Next; Next += 0x000001; - tilebank = Next; Next += 0x000004; - tile_offset = (UINT32*)Next; Next += 0x000001 * sizeof(UINT32); - - DrvShareRAM = Next; Next += 0x001000; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static void DrvSetVideoOffsets(INT32 spritex, INT32 spritex_flipped, INT32 tilesx, INT32 tilesx_flipped) -{ - VideoOffsets[0][0] = spritex; - VideoOffsets[0][1] = spritex_flipped; - VideoOffsets[1][0] = tilesx; - VideoOffsets[1][1] = tilesx_flipped; -} - -static void DrvSetColorOffsets(INT32 gfx0, INT32 gfx1, INT32 gfx2) -{ - ColorOffsets[0] = gfx0; - ColorOffsets[1] = gfx1; - ColorOffsets[2] = gfx2; -} - -static void DrvSetDefaultColorTable() -{ - for (INT32 i = 0; i < BurnDrvGetPaletteEntries(); i++) { - Palette[i] = i; - } -} - -static void zingzapSetColorTable() -{ - for (INT32 color = 0; color < 0x20; color++) { - for (INT32 pen = 0; pen < 0x40; pen++) { - Palette[0x400 + ((color << 6) | pen)] = 0x400 + (((color << 4) + pen) & 0x1ff); - } - } -} - -static void jjsquawkSetColorTable() -{ - for (INT32 color = 0; color < 0x20; color++) { - for (INT32 pen = 0; pen < 0x40; pen++) { - Palette[0x200 + ((color << 6) | pen)] = 0x400 + (((color << 4) + pen) & 0x1ff); - Palette[0xa00 + ((color << 6) | pen)] = 0x200 + (((color << 4) + pen) & 0x1ff); - } - } -} - -static void gundharaSetColorTable() -{ - for (INT32 color = 0; color < 0x20; color++) { - for (INT32 pen = 0; pen < 0x40; pen++) { - Palette[0x200 + ((color << 6) | pen)] = 0x400 + ((((color & ~3) << 4) + pen) & 0x1ff); - Palette[0xa00 + ((color << 6) | pen)] = 0x200 + ((((color & ~3) << 4) + pen) & 0x1ff); - } - } -} - -static void blandiaSetColorTable() -{ - for (INT32 color = 0; color < 0x20; color++) { - for (INT32 pen = 0; pen < 0x40; pen++) { - Palette[0x200 + ((color << 6) | pen)] = 0x200 + ((color << 4) | (pen & 0x0f)); - Palette[0xa00 + ((color << 6) | pen)] = 0x400 + pen; - } - } -} - -static void usclssicSetColorTable() -{ - memcpy (DrvColPROM + 0x600, DrvColPROM + 0x000, 0x200); -// memcpy (DrvColPROM + 0x200, DrvColPROM + 0x200, 0x200); - - for (INT32 color = 0; color < 0x200; color++) { - Palette[color] = color; - } - - for (INT32 color = 0; color < 0x20; color++) { - for (INT32 pen = 0; pen < 0x40; pen++) { - Palette[0x200 + ((color << 6) | pen)] = 0x200 + (((color << 4) + pen) & 0x1ff); - } - } -} - -static INT32 DrvInit(void (*p68kInit)(), INT32 cpu_speed, INT32 irq_type, INT32 spr_buffer, INT32 gfxtype0, INT32 gfxtype1, INT32 gfxtype2) -{ - BurnSetRefreshRate((1.00 * refresh_rate)/100); - - DrvLoadRoms(0); - - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (DrvLoadRoms(1)) return 1; - - // make sure these are initialized so that we can use common routines - ZetInit(0); - MSM6295Init(0, 1000000 / 132, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - if (p68kInit) { - p68kInit(); - } - - DrvGfxDecode(gfxtype0, DrvGfxROM0, 0); - DrvGfxDecode(gfxtype1, DrvGfxROM1, 1); - DrvGfxDecode(gfxtype2, DrvGfxROM2, 2); - - cpuspeed = cpu_speed; - irqtype = irq_type; - buffer_sprites = spr_buffer; - - x1010_sound_init(16000000, 0x0000); - x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - - BurnYM3812Init(4000000, NULL, DrvYM3812SynchroniseStream, 0); - BurnTimerAttachSekYM3812(16000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - BurnYM3438Init(1, 16000000/4, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 1); - BurnTimerAttachZet(4000000); - BurnYM3438SetRoute(0, BURN_SND_YM3438_YM3438_ROUTE_1, 0.30, BURN_SND_ROUTE_LEFT); - BurnYM3438SetRoute(0, BURN_SND_YM3438_YM3438_ROUTE_2, 0.30, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvSetDefaultColorTable(); - - bprintf (0, _T("%d\n"), nScreenHeight); - - VideoOffsets[2][0] = ((256 - nScreenHeight) / 2); // adjust for screen height - VideoOffsets[2][1] = VideoOffsets[2][0]; - - BurnGunInit(2, true); - - DrvDoReset(1); - - return 0; -} - -static INT32 DrvExit() -{ -// FILE *fa = fopen("nvram", "wb"); -// fwrite (DrvNVRAM, 0x400, 1, fa); -// fclose (fa); - - GenericTilesExit(); - - DrvGfxROM0 = NULL; - DrvGfxROM1 = NULL; - DrvGfxROM2 = NULL; - - memset (ColorOffsets, 0, 3 * sizeof(INT32)); - - SekExit(); - ZetExit(); - - BurnGunExit(); - - x1010_exit(); - BurnYM3438Exit(); - BurnYM3812Exit(); - - MSM6295Exit(0); - MSM6295ROM = NULL; - - BurnFree (AllMem); - - oisipuzl_hack = 0; - twineagle = 0; - watchdog_enable = 0; - refresh_rate = 6000; - - BurnFree (DrvGfxTransMask[0]); - BurnFree (DrvGfxTransMask[2]); - BurnFree (DrvGfxTransMask[1]); - - return 0; -} - -// usclssic needs color set up... - -static inline void DrvColors(INT32 i, INT32 pal) -{ - INT32 r = (pal >> 10) & 0x1f; - INT32 g = (pal >> 5) & 0x1f; - INT32 b = (pal >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); -} - -static void DrvPaletteRecalc() -{ - UINT16 *p = (UINT16*)DrvPalRAM; - - if (DrvROMLen[4]) { // color prom - if (DrvROMLen[4] > 1) { // usclassic - memcpy (DrvColPROM + 0x400, DrvPalRAM, 0x200); - memcpy (DrvColPROM + 0x000, DrvPalRAM, 0x200); - } - p = (UINT16*)DrvColPROM; - } - - for (INT32 i = 0; i < BurnDrvGetPaletteEntries(); i++) { - DrvColors(i, BURN_ENDIAN_SWAP_INT16(p[Palette[i]])); - } -} - -static void draw_sprites_map() -{ - UINT16 *spriteram16 = (UINT16*)DrvSprRAM0; - - INT32 ctrl = BURN_ENDIAN_SWAP_INT16(spriteram16[0x600/2]); - INT32 ctrl2 = BURN_ENDIAN_SWAP_INT16(spriteram16[0x602/2]); - - INT32 flip = ctrl & 0x40; - INT32 numcol = ctrl2 & 0x0f; - - UINT16 *src = ((UINT16*)DrvSprRAM1) + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); - - INT32 upper = ( BURN_ENDIAN_SWAP_INT16(spriteram16[ 0x604/2 ]) & 0xFF ) +( BURN_ENDIAN_SWAP_INT16(spriteram16[ 0x606/2 ]) & 0xFF ) * 256; - - INT32 col0 = 0; - switch (ctrl & 0x0f) - { - case 0x01: col0 = 0x4; break; // krzybowl - case 0x06: col0 = 0x8; break; // kiwame - } - - INT32 xoffs = 0; - INT32 yoffs = flip ? 1 : -1; - - if (numcol == 1) numcol = 16; - - for (INT32 col = 0 ; col < numcol; col++) - { - INT32 x = BURN_ENDIAN_SWAP_INT16(spriteram16[(col * 0x20 + 0x408)/2]) & 0xff; - INT32 y = BURN_ENDIAN_SWAP_INT16(spriteram16[(col * 0x20 + 0x400)/2]) & 0xff; - - for (INT32 offs = 0; offs < 0x20; offs++) - { - INT32 code = BURN_ENDIAN_SWAP_INT16(src[((col+col0)&0xf) * 0x40/2 + offs + 0x800/2]); - INT32 color = BURN_ENDIAN_SWAP_INT16(src[((col+col0)&0xf) * 0x40/2 + offs + 0xc00/2]); - - INT32 flipx = code & 0x8000; - INT32 flipy = code & 0x4000; - - INT32 bank = (color & 0x0600) >> 9; - - INT32 sx = x + xoffs + (offs & 1) * 16; - INT32 sy = -(y + yoffs) + (offs / 2) * 16; - - if (upper & (1 << col)) sx += 256; - - if (flip) { - sy = 0xf0 - sy; - flipx = !flipx; - flipy = !flipy; - } - - color = (color >> 11) & 0x1f; - code = ((code & 0x3fff) + (bank * 0x4000)) % DrvGfxMask[0]; - - if (DrvGfxTransMask[0][code]) continue; - - sx = ((sx + 0x10) & 0x1ff) - 0x10; - sy = ((sy + 8) & 0x0ff) - 8; - sy = ((sy+16-VideoOffsets[2][0])&0xff)-16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, 0, DrvGfxROM0); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, 0, DrvGfxROM0); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, 0, DrvGfxROM0); - } - } - } - } -} - -static void draw_sprites() -{ - if (~nSpriteEnable & 1) return; - - UINT16 *spriteram16 = (UINT16*)DrvSprRAM0; - - INT32 ctrl = BURN_ENDIAN_SWAP_INT16(spriteram16[ 0x600/2 ]); - INT32 ctrl2 = BURN_ENDIAN_SWAP_INT16(spriteram16[ 0x602/2 ]); - - INT32 flip = ctrl & 0x40; - - UINT16 *src = ((UINT16*)DrvSprRAM1) + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); - - draw_sprites_map(); - - INT32 yoffs = oisipuzl_hack ? 32 : 0; - INT32 xoffs = VideoOffsets[0][flip ? 1 : 0]; - - for (INT32 offs = (0x400-2)/2 ; offs >= 0; offs -= 1) - { - int code = BURN_ENDIAN_SWAP_INT16(src[offs + 0x000/2]); - int sx = BURN_ENDIAN_SWAP_INT16(src[offs + 0x400/2]); - - int sy = BURN_ENDIAN_SWAP_INT16(spriteram16[offs + 0x000/2]) & 0xff; - - int flipx = code & 0x8000; - int flipy = code & 0x4000; - - INT32 bank = (sx & 0x0600) >> 9; - INT32 color = (sx >> 11) & 0x1f; - - if (flip) - { - sy = (0x100 - nScreenHeight) + 0xf0 - sy; - flipx = !flipx; - flipy = !flipy; - } - - code = ((code & 0x3fff) + (bank * 0x4000)) % DrvGfxMask[0]; - - if (DrvGfxTransMask[0][code]) continue; - - sx = ((sx + xoffs + 0x10) & 0x1ff) - 0x10; - sy = ((((0xf0 - sy) - (-2) + 8)) & 0x0ff) - 8; - sy = ((yoffs+sy+16-VideoOffsets[2][0])&0xff)-16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, ColorOffsets[0], DrvGfxROM0); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, ColorOffsets[0], DrvGfxROM0); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, ColorOffsets[0], DrvGfxROM0); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, ColorOffsets[0], DrvGfxROM0); - } - } - } -} - -// this is needed because some color depths (specifically 6 bits per pixel) need colors added rather than xored. -static void RenderTile(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color, INT32 trans_col, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 width, INT32 height) -{ - INT32 flip = 0; - if (flipy) flip |= (height - 1) * width; - if (flipx) flip |= width - 1; - - gfx += code * width * height; - - for (INT32 y = 0; y < height; y++, sy++) { - if (sy < 0 || sy >= nScreenHeight) continue; - - for (INT32 x = 0; x < width; x++, sx++) { - if (sx < 0 || sx >= nScreenWidth) continue; - - INT32 pxl = gfx[((y * width) + x) ^ flip]; - - if (pxl == trans_col) continue; - - dest[sy * nScreenWidth + sx] = pxl + color; - } - - sx -= width; - } -} - -static void draw_layer(UINT8 *ram, UINT8 *gfx, INT32 num, INT32 opaque, INT32 scrollx, INT32 scrolly) -{ - INT32 mask = DrvGfxMask[num]; - INT32 depth = ColorDepths[num]; - INT32 color_offset = ColorOffsets[num]; - - scrollx = (scrollx + VideoOffsets[1][flipscreen]) & 0x3ff; - scrolly = (scrolly + VideoOffsets[2][0]) & 0x1ff; - - UINT16 *vram = (UINT16*)ram; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = (offs & 0x3f) << 4; - INT32 sy = (offs >> 6) << 4; - - sx -= scrollx; - if (sx < -15) sx += 0x400; - sy -= scrolly; - if (sy < -15) sy += 0x200; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs + 0x000]); - INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs + 0x800]) & 0x001f; - - INT32 code = (attr & 0x3fff) + tile_offset[0]; - - if (twineagle) { - if ((code & 0x3e00) == 0x3e00) { - code = (code & 0x007f) | ((tilebank[(code & 0x0180) >> 7] >> 1) << 7); - } - } - - code %= mask; - - if (!opaque) { - if (DrvGfxTransMask[num][code]) continue; - } - - INT32 flipx = attr & 0x8000; - INT32 flipy = attr & 0x4000; - - if (flipscreen) { - sx = (nScreenWidth - 16) - sx; - sy = (nScreenHeight - 16) - sy; - flipx ^= 0x8000; - flipy ^= 0x4000; - } - - if (depth == 6) { - RenderTile(pTransDraw, gfx, code, (color * (1<> 6; // disabled for now... - flipscreen ^= tmap_flip; - - INT32 visible = (nScreenHeight - 1); - - UINT16 *vctrl0 = (UINT16*)DrvVIDCTRLRAM0; - UINT16 *vctrl1 = (UINT16*)DrvVIDCTRLRAM1; - - INT32 x_0 = BURN_ENDIAN_SWAP_INT16(vctrl0[0]); - INT32 y_0 = BURN_ENDIAN_SWAP_INT16(vctrl0[1]); - INT32 en0 = BURN_ENDIAN_SWAP_INT16(vctrl0[2]); - - INT32 x_1 = BURN_ENDIAN_SWAP_INT16(vctrl1[0]); - INT32 y_1 = BURN_ENDIAN_SWAP_INT16(vctrl1[1]); - INT32 en1 = BURN_ENDIAN_SWAP_INT16(vctrl1[2]); - - x_0 += 0x10 - VideoOffsets[1][flipscreen ? 1 : 0]; - y_0 -= (256 - visible)/2; - if (flipscreen) - { - x_0 = -x_0 - 512; - y_0 = y_0 - visible; - } - - if (enable_tilemap2) - { - x_1 += 0x10 - VideoOffsets[1][flipscreen ? 1 : 0]; - y_1 -= (256 - visible)/2; - if (flipscreen) - { - x_1 = -x_1 - 512; - y_1 = y_1 - visible; - } - - order = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVideoRegs + 2))); - } - - if ( en0 & 0x08) layer_enable &= ~0x01; - if (~en0 & 0x08) layer_enable &= ~0x02; - if ( en1 & 0x08) layer_enable &= ~0x04; - if (~en1 & 0x08) layer_enable &= ~0x08; - if (enable_tilemap2 == 0) layer_enable &= ~0x0c; - - layer_enable &= nBurnLayer; - - BurnTransferClear(); - - if (order & 1) - { - if (layer_enable & 0x04) draw_layer(DrvVidRAM1 + 0x0000, DrvGfxROM2, 2, 1, x_1, y_1); - if (layer_enable & 0x08) draw_layer(DrvVidRAM1 + 0x2000, DrvGfxROM2, 2, 1, x_1, y_1); - - if ((order & 2) == 2) draw_sprites(); - - if (layer_enable & 0x01) draw_layer(DrvVidRAM0 + 0x0000, DrvGfxROM1, 1, 0, x_0, y_0); - if (layer_enable & 0x02) draw_layer(DrvVidRAM0 + 0x2000, DrvGfxROM1, 1, 0, x_0, y_0); - - if ((order & 2) == 0) draw_sprites(); - } - else - { - if (layer_enable & 0x01) draw_layer(DrvVidRAM0 + 0x0000, DrvGfxROM1, 1, 1, x_0, y_0); - if (layer_enable & 0x02) draw_layer(DrvVidRAM0 + 0x2000, DrvGfxROM1, 1, 1, x_0, y_0); - - if ((order & 2) == 2) draw_sprites(); - - if (layer_enable & 0x04) draw_layer(DrvVidRAM1 + 0x0000, DrvGfxROM2, 2, 0, x_1, y_1); - if (layer_enable & 0x08) draw_layer(DrvVidRAM1 + 0x2000, DrvGfxROM2, 2, 0, x_1, y_1); - - if ((order & 2) == 0) draw_sprites(); - } -} - -static INT32 setaNoLayersDraw() -{ - DrvPaletteRecalc(); - - BurnTransferClear(); - - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 seta1layerDraw() -{ - DrvPaletteRecalc(); - - seta_update(0, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 seta2layerDraw() -{ - DrvPaletteRecalc(); - - seta_update(1, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 zombraidDraw() -{ - seta2layerDraw(); - - for (INT32 i = 0; i < BurnDrvGetMaxPlayers(); i++) { - BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); - } - - return 0; -} - -static INT32 seta2layerFlippedDraw() -{ - DrvPaletteRecalc(); - - seta_update(1, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static void irq_generator(INT32 loop) -{ - if (loop != 4 && loop != 9) return; - - loop = (loop / 5) & 1; - - INT32 line = (irqtype >> (loop * 8)) & 0xff; - if (line & 0x80) return; - - SekSetIRQLine(line, SEK_IRQSTATUS_AUTO); -} - -static void sprite_buffer() -{ - if ((DrvSprRAM0[0x602] & 0x20) == 0) - { - if (DrvSprRAM0[0x602] & 0x40) { - memcpy (DrvSprRAM1 + 0x0000, DrvSprRAM1 + 0x2000, 0x2000); - } else { - memcpy (DrvSprRAM1 + 0x2000, DrvSprRAM1 + 0x0000, 0x2000); - } - } -} - -static INT32 DrvCommonFrame(void (*pFrameCallback)()) -{ - if (DrvReset) { - DrvDoReset(1); - } - - if (watchdog_enable) { - watchdog++; - if (watchdog >= 180) { - DrvDoReset(0); - } - } - - { - memset (DrvInputs, 0xff, 7 * sizeof(UINT16)); - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - DrvInputs[5] ^= (DrvJoy6[i] & 1) << i; - DrvInputs[6] ^= (DrvJoy7[i] & 1) << i; - } - - BurnGunMakeInputs(0, (INT16)DrvAxis[0], (INT16)DrvAxis[1]); // zombraid - BurnGunMakeInputs(1, (INT16)DrvAxis[2], (INT16)DrvAxis[3]); - - float xRatio = (float)128 / 384; - float yRatio = (float)96 / 224; - - for (INT32 i = 0; i < 2; i++) { - INT32 x = BurnGunX[i] >> 8; - INT32 y = BurnGunY[i] >> 8; - - x = (INT32)(x * xRatio); - y = (INT32)(y * yRatio); - - x -= 0xbe; - y += 0x48; - - DrvAnalogInput[0 + (i * 2)] = (UINT8)~x; - DrvAnalogInput[1 + (i * 2)] = (UINT8)y; - } - } - - pFrameCallback(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - if (buffer_sprites) { - sprite_buffer(); - } - - return 0; -} - -static void Drv68kNoSubFrameCallback() -{ - INT32 nInterleave = 10; - INT32 nCyclesTotal[1] = { (cpuspeed * 100) / refresh_rate }; - INT32 nCyclesDone[1] = { 0 }; - - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); - - irq_generator(i); - } - - SekClose(); - - if (pBurnSoundOut) { - x1010_sound_update(); - } -} - -static INT32 DrvFrame() -{ - return DrvCommonFrame(Drv68kNoSubFrameCallback); -} - -static void Drv68k_5IRQ_FrameCallback() -{ - INT32 nInterleave = 10; - INT32 nCyclesTotal[1] = { (cpuspeed * 100) / refresh_rate }; - INT32 nCyclesDone[1] = { 0 }; - - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); - - if (i & 1 && i == 1) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - if (i & 1 && i != 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - - SekClose(); - - if (pBurnSoundOut) { - x1010_sound_update(); - } -} - -static INT32 Drv5IRQFrame() -{ - return DrvCommonFrame(Drv68k_5IRQ_FrameCallback); -} - -static void Drv68kNoSubM6295FrameCallback() -{ - INT32 nInterleave = 10; - INT32 nCyclesTotal[1] = { (cpuspeed * 100) / refresh_rate }; - INT32 nCyclesDone[1] = { 0 }; - - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); - - irq_generator(i); - } - - SekClose(); - - if (pBurnSoundOut) { - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } -} - -static INT32 DrvM6295Frame() -{ - return DrvCommonFrame(Drv68kNoSubM6295FrameCallback); -} - -static void Drv68kZ80M6295FrameCallback() -{ - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { (cpuspeed * 100) / refresh_rate, (4000000 * 100) / refresh_rate }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); - nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave); - irq_generator(i); - } - - ZetClose(); - SekClose(); - - if (pBurnSoundOut) { - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } -} - -static INT32 DrvZ80M6295Frame() -{ - return DrvCommonFrame(Drv68kZ80M6295FrameCallback); -} - - -static void Drv68kZ80YM3438FrameCallback() -{ - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { (cpuspeed * 100) / refresh_rate, (4000000 * 100) / refresh_rate }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); - // nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave); - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - irq_generator(i); - } - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - x1010_sound_update(); - BurnYM3438Update(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - -} - -static INT32 Drv68kZ80YM3438Frame() -{ - return DrvCommonFrame(Drv68kZ80YM3438FrameCallback); -} - -static void CrzyfghtFrameCallback() -{ - INT32 nInterleave = 6; - INT32 nCyclesTotal[1] = { (cpuspeed * 100) / refresh_rate }; - - SekOpen(0); - - INT32 irq[6] = { 2, 2, 2, 2, 2, 1 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - //BurnTimerUpdateYM3812(nCyclesTotal[0] / nInterleave); - - SekRun(nCyclesTotal[0] / nInterleave); - - SekSetIRQLine(irq[i], SEK_IRQSTATUS_AUTO); - } - - BurnTimerUpdateEndYM3812(); - - if (pBurnSoundOut) { - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - // BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - } - - SekClose(); -} - -static INT32 CrazyfgtFrame() -{ - return DrvCommonFrame(CrzyfghtFrameCallback); -} - - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029708; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_NVRAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = DrvNVRAM; - ba.nLen = 0x400; - ba.szName = "NV Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - x1010_scan(nAction, pnMin); - BurnYM3812Scan(nAction, pnMin); - BurnYM3438Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - - SCAN_VAR(seta_samples_bank); - SCAN_VAR(usclssic_port_select); - SCAN_VAR(tndrcade_init_sim); - SCAN_VAR(gun_input_bit); - SCAN_VAR(gun_input_src); - } - - if (nAction & ACB_WRITE) { - INT32 tmpbank = seta_samples_bank; - seta_samples_bank = -1; - set_pcm_bank(tmpbank); - } - - return 0; -} - - -//----------------------------------------------------------------------------------------------------------------- -// Nonworking games... - -// Seta / Visco Roulette? - -static struct BurnRomInfo setaroulRomDesc[] = { - { "uf1002.u14", 0x10000, 0xb3a622b0, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "uf1003.u16", 0x10000, 0xa6afd769, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "uf0005.u3", 0x08000, 0x383c2d57, 0x03 | BRF_GRA }, // 2 Sprites - { "uf0006.u4", 0x08000, 0x90c9dae6, 0x03 | BRF_GRA }, // 3 - { "uf0007.u5", 0x08000, 0xe72c3dba, 0x03 | BRF_GRA }, // 4 - { "uf0008.u6", 0x08000, 0xe198e602, 0x03 | BRF_GRA }, // 5 - - { "uf0010.u15", 0x80000, 0x0af13a56, 0x04 | BRF_GRA }, // 6 Layer 1 tiles - { "uf0009.u13", 0x80000, 0x20f2d7f5, 0x04 | BRF_GRA }, // 7 - { "uf0012.u29", 0x80000, 0xcba2a6b7, 0x04 | BRF_GRA }, // 8 - { "uf0011.u22", 0x80000, 0xaf60adf9, 0x04 | BRF_GRA }, // 9 - { "uf0014.u38", 0x80000, 0xda2bd4e4, 0x04 | BRF_GRA }, // 10 - { "uf0013.u37", 0x80000, 0x645ec3c3, 0x04 | BRF_GRA }, // 11 - { "uf0015.u40", 0x80000, 0x11dc19fa, 0x04 | BRF_GRA }, // 12 - { "uf0016.u48", 0x80000, 0x10f99fa8, 0x04 | BRF_GRA }, // 13 - - { "uf1004.u52", 0x20000, 0xd63ea334, 0x06 | BRF_SND }, // 14 x1-010 Samples - - { "ufo017.bin", 0x00200, 0xbf50c303, 0x00 | BRF_GRA }, // 15 Color Proms - { "ufo018.bin", 0x00200, 0x1c584d5f, 0x00 | BRF_GRA }, // 16 -}; - -STD_ROM_PICK(setaroul) -STD_ROM_FN(setaroul) - -static INT32 NotWorkingInit() -{ - return 1; -} - -struct BurnDriverD BurnDrvSetaroul = { - "setaroul", NULL, NULL, NULL, "198?", - "Seta / Visco Roulette?\0", NULL, "Seta / Visco", "Seta", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, setaroulRomInfo, setaroulRomName, NULL, NULL, DrgnunitInputInfo, NULL, - NotWorkingInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0, - 240, 384, 3, 4 -}; - - -// International Toote (Germany) - -static struct BurnRomInfo inttooteRomDesc[] = { - { "p523.v01_horse_prog_2.002", 0x10000, 0x6ce6f1ad, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "p523.v01_horse_prog_1.003", 0x10000, 0x921fcff5, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ya_002_001.u18", 0x80000, 0xdd108016, 0x01 | BRF_PRG | BRF_ESS }, // 2 - - { "ya_011_004.u10", 0x80000, 0xeb74d2e0, 0x03 | BRF_GRA }, // 3 Sprites - { "ya_011_005.u17", 0x80000, 0x4a6c804b, 0x03 | BRF_GRA }, // 4 - { "ya_011_006.u22", 0x80000, 0xbfae01a5, 0x03 | BRF_GRA }, // 5 - { "ya_011_007.u27", 0x80000, 0x2dc7a294, 0x03 | BRF_GRA }, // 6 - { "p523.v01_horse_fore_1.u135", 0x10000, 0x3a75df30, 0x00 | BRF_GRA }, // 7 - { "p523.v01_horse_fore_2.u134", 0x10000, 0x26fb0339, 0x00 | BRF_GRA }, // 8 - { "p523.v01_horse_fore_3.u133", 0x10000, 0xc38596af, 0x00 | BRF_GRA }, // 9 - { "p523.v01_horse_fore_4.u132", 0x10000, 0x64ef345e, 0x00 | BRF_GRA }, // 10 - - { "ya_011_008.u35", 0x40000, 0x4b890f83, 0x04 | BRF_GRA }, // 11 Layer 1 tiles - { "p523.v01_horse_back_1.u137", 0x20000, 0x39b221ea, 0x04 | BRF_GRA }, // 12 - { "ya_011_009.u41", 0x40000, 0xcaa5e3c1, 0x04 | BRF_GRA }, // 13 - { "p523.v01_horse_back_2.u136", 0x20000, 0x9c5e32a0, 0x04 | BRF_GRA }, // 14 - - { "ya_011_013.u71", 0x80000, 0x2bccaf47, 0x06 | BRF_SND }, // 17 x1-010 Samples - { "ya_011_012.u64", 0x80000, 0xa8015ce6, 0x06 | BRF_SND }, // 18 - - { "ya-010.prom", 0x00200, 0x778094b3, 0x00 | BRF_GRA }, // 15 Color Proms - { "ya-011.prom", 0x00200, 0xbd4fe2f6, 0x00 | BRF_GRA }, // 16 -}; - -STD_ROM_PICK(inttoote) -STD_ROM_FN(inttoote) - -#if 0 -static void inttoote68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(DrvVidRAM0, 0xb00000, 0xb07fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xffc000, 0xffffff, SM_RAM); - - - SekMapHandler(1, 0x900000, 0x903fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); - - - BurnLoadRom(DrvGfxROM0 + 0x070000, 7, 1); - BurnLoadRom(DrvGfxROM0 + 0x0f0000, 8, 1); - BurnLoadRom(DrvGfxROM0 + 0x170000, 9, 1); - BurnLoadRom(DrvGfxROM0 + 0x1f0000, 10, 1); -} - -static INT32 inttooteInit() -{ - DrvSetColorOffsets(0, 0, 0); - DrvSetVideoOffsets(1, 1, -1, -1); - - return DrvInit(inttoote68kInit, 16000000, SET_IRQLINES(0x80, 0x80) /* Custom */, NO_SPRITE_BUFFER, SET_GFX_DECODE(5, 1, -1)); -} -#endif - -struct BurnDriverD BurnDrvInttoote = { - "inttoote", "jockeyc", NULL, NULL, "1998", - "International Toote (Germany)\0", NULL, "Coinmaster", "Seta", - NULL, NULL, NULL, NULL, - BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, inttooteRomInfo, inttooteRomName, NULL, NULL, DrgnunitInputInfo, NULL, - NotWorkingInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0, - 384, 240, 4, 3 -}; - - -// International Toote II (World?) - -static struct BurnRomInfo inttooteaRomDesc[] = { - { "p387.v01_horse_prog_2.002", 0x10000, 0x1ced885e, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "p387.v01_horse_prog_1.003", 0x10000, 0xe24592af, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ya_002_001.u18", 0x80000, 0xdd108016, 0x01 | BRF_PRG | BRF_ESS }, // 2 - - { "ya_011_004.u10", 0x80000, 0xeb74d2e0, 0x03 | BRF_GRA }, // 3 Sprites - { "ya_011_005.u17", 0x80000, 0x4a6c804b, 0x03 | BRF_GRA }, // 4 - { "ya_011_006.u22", 0x80000, 0xbfae01a5, 0x03 | BRF_GRA }, // 5 - { "ya_011_007.u27", 0x80000, 0x2dc7a294, 0x03 | BRF_GRA }, // 6 - { "p523.v01_horse_fore_1.u135", 0x10000, 0x3a75df30, 0x00 | BRF_GRA }, // 7 - { "p523.v01_horse_fore_2.u134", 0x10000, 0x26fb0339, 0x00 | BRF_GRA }, // 8 - { "p523.v01_horse_fore_3.u133", 0x10000, 0xc38596af, 0x00 | BRF_GRA }, // 9 - { "p523.v01_horse_fore_4.u132", 0x10000, 0x64ef345e, 0x00 | BRF_GRA }, // 10 - - { "ya_011_008.u35", 0x40000, 0x4b890f83, 0x04 | BRF_GRA }, // 11 Layer 1 tiles - { "p523.v01_horse_back_1.u137", 0x20000, 0x39b221ea, 0x04 | BRF_GRA }, // 12 - { "ya_011_009.u41", 0x40000, 0xcaa5e3c1, 0x04 | BRF_GRA }, // 13 - { "p523.v01_horse_back_2.u136", 0x20000, 0x9c5e32a0, 0x04 | BRF_GRA }, // 14 - - { "ya_011_013.u71", 0x80000, 0x2bccaf47, 0x06 | BRF_SND }, // 17 x1-010 Samples - { "ya_011_012.u64", 0x80000, 0xa8015ce6, 0x06 | BRF_SND }, // 18 - - { "ya-010.prom", 0x00200, 0x778094b3, 0x00 | BRF_GRA }, // 15 Color Proms - { "ya-011.prom", 0x00200, 0xbd4fe2f6, 0x00 | BRF_GRA }, // 16 -}; - -STD_ROM_PICK(inttootea) -STD_ROM_FN(inttootea) - -struct BurnDriverD BurnDrvInttootea = { - "inttootea", "jockeyc", NULL, NULL, "1993", - "International Toote II (World?)\0", NULL, "Coinmaster", "Seta", - NULL, NULL, NULL, NULL, - BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, inttooteaRomInfo, inttooteaRomName, NULL, NULL, DrgnunitInputInfo, NULL, - NotWorkingInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0, - 384, 240, 4, 3 -}; - - -//----------------------------------------------------------------------------------------------------------------- -// Working games - - -// Dragon Unit / Castle of Dragon - -static struct BurnRomInfo drgnunitRomDesc[] = { - { "prg-e.bin", 0x20000, 0x728447df, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "prg-o.bin", 0x20000, 0xb2f58ecf, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "obj-2.bin", 0x20000, 0xd7f6ab5a, 0x0b | BRF_GRA }, // 2 Sprites - { "obj-1.bin", 0x20000, 0x53a95b13, 0x0b | BRF_GRA }, // 3 - { "obj-6.bin", 0x20000, 0x80b801f7, 0x0b | BRF_GRA }, // 4 - { "obj-5.bin", 0x20000, 0x6b87bc20, 0x0b | BRF_GRA }, // 5 - { "obj-4.bin", 0x20000, 0x60d17771, 0x0b | BRF_GRA }, // 6 - { "obj-3.bin", 0x20000, 0x0bccd4d5, 0x0b | BRF_GRA }, // 7 - { "obj-8.bin", 0x20000, 0x826c1543, 0x0b | BRF_GRA }, // 8 - { "obj-7.bin", 0x20000, 0xcbaa7f6a, 0x0b | BRF_GRA }, // 9 - - { "scr-1o.bin", 0x20000, 0x671525db, 0x04 | BRF_GRA }, // 10 Layer 1 tiles - { "scr-2o.bin", 0x20000, 0x2a3f2ed8, 0x04 | BRF_GRA }, // 11 - { "scr-3o.bin", 0x20000, 0x4d33a92d, 0x04 | BRF_GRA }, // 12 - { "scr-4o.bin", 0x20000, 0x79a0aa61, 0x04 | BRF_GRA }, // 13 - { "scr-1e.bin", 0x20000, 0xdc9cd8c9, 0x04 | BRF_GRA }, // 14 - { "scr-2e.bin", 0x20000, 0xb6126b41, 0x04 | BRF_GRA }, // 15 - { "scr-3e.bin", 0x20000, 0x1592b8c2, 0x04 | BRF_GRA }, // 16 - { "scr-4e.bin", 0x20000, 0x8201681c, 0x04 | BRF_GRA }, // 17 - - { "snd-1.bin", 0x20000, 0x8f47bd0d, 0x06 | BRF_SND }, // 18 x1-010 Samples - { "snd-2.bin", 0x20000, 0x65c40ef5, 0x06 | BRF_SND }, // 19 - { "snd-3.bin", 0x20000, 0x71fbd54e, 0x06 | BRF_SND }, // 20 - { "snd-4.bin", 0x20000, 0xac50133f, 0x06 | BRF_SND }, // 21 - { "snd-5.bin", 0x20000, 0x70652f2c, 0x06 | BRF_SND }, // 22 - { "snd-6.bin", 0x20000, 0x10a1039d, 0x06 | BRF_SND }, // 23 - { "snd-7.bin", 0x20000, 0xdecbc8b0, 0x06 | BRF_SND }, // 24 - { "snd-8.bin", 0x20000, 0x3ac51bee, 0x06 | BRF_SND }, // 25 -}; - -STD_ROM_PICK(drgnunit) -STD_ROM_FN(drgnunit) - -static INT32 drgnunitInit() -{ - DrvSetColorOffsets(0, 0, 0); - DrvSetVideoOffsets(2, 2, -2, -2); - - return DrvInit(drgnunit68kInit, 8000000, SET_IRQLINES(1, 2), SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); -} - -struct BurnDriver BurnDrvDrgnunit = { - "drgnunit", NULL, NULL, NULL, "1989", - "Dragon Unit / Castle of Dragon\0", NULL, "Seta", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, drgnunitRomInfo, drgnunitRomName, NULL, NULL, DrgnunitInputInfo, DrgnunitDIPInfo, - drgnunitInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; - - -// Quiz Kokology - -static struct BurnRomInfo qzkklogyRomDesc[] = { - { "3.u27", 0x20000, 0xb8c27cde, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "1.u9", 0x20000, 0xce01cd54, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "4.u33", 0x20000, 0x4f5c554c, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "2.u17", 0x20000, 0x65fa1b8d, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "t2709u32.u32", 0x80000, 0x900f196c, 0x03 | BRF_GRA }, // 4 Sprites - { "t2709u26.u26", 0x80000, 0x416ac849, 0x03 | BRF_GRA }, // 5 - - { "t2709u42.u39", 0x80000, 0x194d5704, 0x04 | BRF_GRA }, // 6 Layer 1 tiles - { "t2709u39.u42", 0x80000, 0x6f95a76d, 0x04 | BRF_GRA }, // 7 - - { "t2709u47.u47", 0x80000, 0x0ebdad40, 0x06 | BRF_SND }, // 8 x1-010 Samples - { "t2709u55.u55", 0x80000, 0x43960c68, 0x06 | BRF_SND }, // 9 -}; - -STD_ROM_PICK(qzkklogy) -STD_ROM_FN(qzkklogy) - -static INT32 qzkklogyInit() -{ - DrvSetColorOffsets(0, 0, 0); - DrvSetVideoOffsets(1, 1, -1, -1); - - return DrvInit(drgnunit68kInit, 8000000, SET_IRQLINES(1, 2), SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); -} - -struct BurnDriver BurnDrvQzkklogy = { - "qzkklogy", NULL, NULL, NULL, "1992", - "Quiz Kokology\0", NULL, "Tecmo", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, qzkklogyRomInfo, qzkklogyRomName, NULL, NULL, QzkklogyInputInfo, QzkklogyDIPInfo, - qzkklogyInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; - - -// Strike Gunner S.T.G - -static struct BurnRomInfo stgRomDesc[] = { - { "att01003.u27", 0x20000, 0x7a640a93, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "att01001.u9", 0x20000, 0x4fa88ad3, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "att01004.u33", 0x20000, 0xbbd45ca1, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "att01002.u17", 0x20000, 0x2f8fd80c, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "att01006.u32", 0x80000, 0x6ad78ea2, 0x03 | BRF_GRA }, // 4 Sprites - { "att01005.u26", 0x80000, 0xa347ff00, 0x03 | BRF_GRA }, // 5 - - { "att01008.u39", 0x80000, 0x20c47457, 0x04 | BRF_GRA }, // 6 Layer 1 tiles - { "att01007.u42", 0x80000, 0xac975544, 0x04 | BRF_GRA }, // 7 - - { "att01009.u47", 0x80000, 0x4276b58d, 0x06 | BRF_SND }, // 8 x1-010 Samples - { "att01010.u55", 0x80000, 0xfffb2f53, 0x06 | BRF_SND }, // 9 -}; - -STD_ROM_PICK(stg) -STD_ROM_FN(stg) - -static INT32 stgInit() -{ - DrvSetColorOffsets(0, 0, 0); - DrvSetVideoOffsets(0, 0, -2, -2); - - return DrvInit(drgnunit68kInit, 8000000, SET_IRQLINES(2, 1), SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); -} - -struct BurnDriver BurnDrvStg = { - "stg", NULL, NULL, NULL, "1991", - "Strike Gunner S.T.G\0", NULL, "Athena / Tecmo", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, stgRomInfo, stgRomName, NULL, NULL, StgInputInfo, StgDIPInfo, - stgInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 240, 384, 3, 4 -}; - - -// Quiz Kokology 2 - -static struct BurnRomInfo qzkklgy2RomDesc[] = { - { "fn001001.106", 0x080000, 0x7bf8eb17, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fn001003.107", 0x040000, 0xee6ef111, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fn001004.100", 0x100000, 0x5ba139a2, 0x03 | BRF_GRA }, // 2 Sprites - - { "fn001005.104", 0x200000, 0x95726a63, 0x04 | BRF_GRA }, // 3 Layer 1 tiles - - { "fn001006.105", 0x100000, 0x83f201e6, 0x06 | BRF_SND }, // 4 x1-010 Samples -}; - -STD_ROM_PICK(qzkklgy2) -STD_ROM_FN(qzkklgy2) - -static INT32 qzkklgy2Init() -{ - DrvSetColorOffsets(0, 0, 0); - DrvSetVideoOffsets(0, 0, -1, -3); - - return DrvInit(drgnunit68kInit, 16000000, SET_IRQLINES(1, 2), SPRITE_BUFFER, SET_GFX_DECODE(0, 2, -1)); -} - -struct BurnDriver BurnDrvQzkklgy2 = { - "qzkklgy2", NULL, NULL, NULL, "1993", - "Quiz Kokology 2\0", NULL, "Tecmo", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, qzkklgy2RomInfo, qzkklgy2RomName, NULL, NULL, Qzkklgy2InputInfo, Qzkklgy2DIPInfo, - qzkklgy2Init, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; - - -// Daioh (set 1) - -static struct BurnRomInfo daiohRomDesc[] = { - { "fg001001.u3", 0x080000, 0xe1ef3007, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fg001002.u4", 0x080000, 0x5e3481f9, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fg1-004", 0x100000, 0x9ab0533e, 0x03 | BRF_GRA }, // 2 Sprites - { "fg1-003", 0x100000, 0x1c9d51e2, 0x03 | BRF_GRA }, // 3 - - { "fg1-005", 0x200000, 0xc25159b9, 0x04 | BRF_GRA }, // 4 Layer 1 tiles - - { "fg1-006", 0x200000, 0x2052c39a, 0x05 | BRF_GRA }, // 5 Layer 2 tiles - - { "fg1-007", 0x100000, 0x4a2fe9e0, 0x06 | BRF_SND }, // 6 x1-010 Samples -}; - -STD_ROM_PICK(daioh) -STD_ROM_FN(daioh) - -static INT32 daiohInit() -{ - DrvSetVideoOffsets(1, 1, -1, -1); - DrvSetColorOffsets(0, 0x400, 0x200); - - return DrvInit(daioh68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); -} - -struct BurnDriver BurnDrvDaioh = { - "daioh", NULL, NULL, NULL, "1993", - "Daioh (set 1)\0", NULL, "Athena", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, daiohRomInfo, daiohRomName, NULL, NULL, DaiohInputInfo, DaiohDIPInfo, - daiohInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, - 240, 384, 3, 4 -}; - - -// Daioh (set 2) - -static struct BurnRomInfo daiohaRomDesc[] = { - { "fg1-001.u3", 0x080000, 0x104ae74a, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fg1-002.u4", 0x080000, 0xe39a4e67, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fg1-004", 0x100000, 0x9ab0533e, 0x03 | BRF_GRA }, // 2 Sprites - { "fg1-003", 0x100000, 0x1c9d51e2, 0x03 | BRF_GRA }, // 3 - - { "fg1-005", 0x200000, 0xc25159b9, 0x04 | BRF_GRA }, // 4 Layer 1 tiles - - { "fg1-006", 0x200000, 0x2052c39a, 0x05 | BRF_GRA }, // 5 Layer 2 tiles - - { "fg1-007", 0x100000, 0x4a2fe9e0, 0x06 | BRF_SND }, // 6 x1-010 Samples -}; - -STD_ROM_PICK(daioha) -STD_ROM_FN(daioha) - -struct BurnDriver BurnDrvDaioha = { - "daioha", "daioh", NULL, NULL, "1993", - "Daioh (set 2)\0", NULL, "Athena", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, daiohaRomInfo, daiohaRomName, NULL, NULL, DaiohInputInfo, DaiohDIPInfo, - daiohInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, - 240, 384, 3, 4 -}; - - -// Rezon - -static struct BurnRomInfo rezonRomDesc[] = { - { "us001001.u3", 0x020000, 0xab923052, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "us001002.u4", 0x020000, 0x3dafa0d5, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "us001004.103", 0x020000, 0x54871c7c, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "us001003.102", 0x020000, 0x1ac3d272, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "us001006.u64", 0x080000, 0xa4916e96, 0x03 | BRF_GRA }, // 4 Sprites - { "us001005.u63", 0x080000, 0xe6251ebc, 0x03 | BRF_GRA }, // 5 - - { "us001007.u66", 0x080000, 0x3760b935, 0x04 | BRF_GRA }, // 6 Layer 1 tiles - - { "us001008.u68", 0x080000, 0x0ab73910, 0x05 | BRF_GRA }, // 7 Layer 2 tiles - - { "us001009.u70", 0x100000, 0x0d7d2e2b, 0x06 | BRF_SND }, // 8 x1-010 Samples -}; - -STD_ROM_PICK(rezon) -STD_ROM_FN(rezon) - -static INT32 rezonInit() -{ - DrvSetVideoOffsets(0, 0, -2, -2); - DrvSetColorOffsets(0, 0x400, 0x200); - - INT32 nRet = DrvInit(wrofaero68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); - - if (nRet == 0) { - memcpy (Drv68KROM + 0x100000, Drv68KROM + 0x040000, 0x040000); - memset (Drv68KROM + 0x040000, 0, 0x40000); - BurnByteswap(DrvSndROM, 0x100000); - } - - return nRet; -} - -struct BurnDriver BurnDrvRezon = { - "rezon", NULL, NULL, NULL, "1991", - "Rezon\0", NULL, "Allumer", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, rezonRomInfo, rezonRomName, NULL, NULL, RezonInputInfo, RezonDIPInfo, - rezonInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, - 384, 240, 4, 3 -}; - - -// Rezon (Taito) - -static struct BurnRomInfo rezontRomDesc[] = { - { "us001001.u3", 0x020000, 0xab923052, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "rezon_1_p.u4", 0x020000, 0x9ed32f8c, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "us001004.103", 0x020000, 0x54871c7c, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "us001003.102", 0x020000, 0x1ac3d272, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "us001006.u64", 0x080000, 0xa4916e96, 0x03 | BRF_GRA }, // 4 Sprites - { "us001005.u63", 0x080000, 0xe6251ebc, 0x03 | BRF_GRA }, // 5 - - { "us001007.u66", 0x080000, 0x3760b935, 0x04 | BRF_GRA }, // 6 Layer 1 tiles - - { "us001008.u68", 0x080000, 0x0ab73910, 0x05 | BRF_GRA }, // 7 Layer 2 tiles - - { "us001009.u70", 0x100000, 0x0d7d2e2b, 0x06 | BRF_SND }, // 8 x1-010 Samples -}; - -STD_ROM_PICK(rezont) -STD_ROM_FN(rezont) - -struct BurnDriver BurnDrvRezont = { - "rezont", "rezon", NULL, NULL, "1992", - "Rezon (Taito)\0", NULL, "Allumer (Taito license)", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, rezontRomInfo, rezontRomName, NULL, NULL, RezonInputInfo, RezonDIPInfo, - rezonInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, - 384, 240, 4, 3 -}; - - -// Eight Forces - -static struct BurnRomInfo eightfrcRomDesc[] = { - { "uy2-u4.u3", 0x040000, 0xf1f249c5, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "uy2-u3.u4", 0x040000, 0x6f2d8618, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "u64.bin", 0x080000, 0xf561ff2e, 0x03 | BRF_GRA }, // 2 Sprites - { "u63.bin", 0x080000, 0x4c3f8366, 0x03 | BRF_GRA }, // 3 - - { "u66.bin", 0x100000, 0x6fad2b7f, 0x04 | BRF_GRA }, // 4 Layer 1 tiles - - { "u68.bin", 0x100000, 0xc17aad22, 0x05 | BRF_GRA }, // 5 Layer 2 tiles - - { "u70.bin", 0x100000, 0xdfdb67a3, 0x06 | BRF_SND }, // 6 x1-010 Samples - { "u69.bin", 0x100000, 0x82ec08f1, 0x06 | BRF_SND }, // 7 -}; - -STD_ROM_PICK(eightfrc) -STD_ROM_FN(eightfrc) - -static INT32 eightfrcInit() -{ - DrvSetVideoOffsets(3, 4, 0, 0); - DrvSetColorOffsets(0, 0x400, 0x200); - - INT32 nRet = DrvInit(wrofaero68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); - - if (nRet == 0) { - memcpy (DrvSndROM + 0x100000, DrvSndROM + 0x0c0000, 0x140000); // sound banks - } - - return nRet; -} - -struct BurnDriver BurnDrvEightfrc = { - "eightfrc", NULL, NULL, NULL, "1994", - "Eight Forces\0", NULL, "Tecmo", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, eightfrcRomInfo, eightfrcRomName, NULL, NULL, EightfrcInputInfo, EightfrcDIPInfo, - eightfrcInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, - 224, 384, 3, 4 -}; - - -// War of Aero - Project MEIOU - -static struct BurnRomInfo wrofaeroRomDesc[] = { - { "u3.bin", 0x40000, 0x9b896a97, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "u4.bin", 0x40000, 0xdda84846, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "u64.bin", 0x80000, 0xf06ccd78, 0x03 | BRF_GRA }, // 2 Sprites - { "u63.bin", 0x80000, 0x2a602a1b, 0x03 | BRF_GRA }, // 3 - - { "u66.bin", 0x80000, 0xc9fc6a0c, 0x04 | BRF_GRA }, // 4 Layer 1 tiles - - { "u68.bin", 0x80000, 0x25c0c483, 0x05 | BRF_GRA }, // 5 Layer 2 tiles - - { "u69.bin", 0x80000, 0x957ecd41, 0x06 | BRF_SND }, // 6 x1-010 Samples - { "u70.bin", 0x80000, 0x8d756fdf, 0x06 | BRF_SND }, // 7 -}; - -STD_ROM_PICK(wrofaero) -STD_ROM_FN(wrofaero) - -static INT32 wrofaeroInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0x400, 0x200); - - return DrvInit(wrofaero68kInit, 16000000, SET_IRQLINES(2, 4), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); -} - -struct BurnDriver BurnDrvWrofaero = { - "wrofaero", NULL, NULL, NULL, "1993", - "War of Aero - Project MEIOU\0", NULL, "Yang Cheng", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, wrofaeroRomInfo, wrofaeroRomName, NULL, NULL, WrofaeroInputInfo, WrofaeroDIPInfo, - wrofaeroInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, - 240, 384, 3, 4 -}; - - -// Zing Zing Zip - -static struct BurnRomInfo zingzipRomDesc[] = { - { "uy001001.3", 0x040000, 0x1a1687ec, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "uy001002.4", 0x040000, 0x62e3b0c4, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "uy001006.64", 0x080000, 0x46e4a7d8, 0x03 | BRF_GRA }, // 2 Sprites - { "uy001005.63", 0x080000, 0x4aac128e, 0x03 | BRF_GRA }, // 3 - - { "uy001008.66", 0x100000, 0x1dff7c4b, 0x04 | BRF_GRA }, // 4 Layer 1 tiles - { "uy001007.65", 0x080000, 0xec5b3ab9, 0x1c | BRF_GRA }, // 5 - - { "uy001010.68", 0x100000, 0xbdbcdf03, 0x05 | BRF_GRA }, // 6 Layer 2 tiles - - { "uy001011.70", 0x100000, 0xbd845f55, 0x06 | BRF_SND }, // 7 x1-010 Samples -}; - -STD_ROM_PICK(zingzip) -STD_ROM_FN(zingzip) - -static INT32 zingzipInit() -{ - DrvSetVideoOffsets(0, 0, -1, -2); - DrvSetColorOffsets(0, 0x400, 0x200); - - INT32 nRet = DrvInit(wrofaero68kInit, 16000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 2)); - - if (nRet == 0) { - zingzapSetColorTable(); - } - - return nRet; -} - -struct BurnDriver BurnDrvZingzip = { - "zingzip", NULL, NULL, NULL, "1992", - "Zing Zing Zip\0", NULL, "Allumer + Tecmo", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, zingzipRomInfo, zingzipRomName, NULL, NULL, ZingzipInputInfo, ZingzipDIPInfo, - zingzipInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0xc00, - 240, 384, 3, 4 -}; - - -// Mobile Suit Gundam - -static struct BurnRomInfo msgundamRomDesc[] = { - { "fa003002.u25", 0x080000, 0x1cc72d4c, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fa001001.u20", 0x100000, 0xfca139d0, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fa001008.u21", 0x200000, 0xe7accf48, 0x03 | BRF_GRA }, // 2 Sprites - { "fa001007.u22", 0x200000, 0x793198a6, 0x03 | BRF_GRA }, // 3 - - { "fa001006.u23", 0x100000, 0x3b60365c, 0x04 | BRF_GRA }, // 4 Layer 1 tiles - - { "fa001005.u24", 0x080000, 0x8cd7ff86, 0x05 | BRF_GRA }, // 5 Layer 2 tiles - - { "fa001004.u26", 0x100000, 0xb965f07c, 0x06 | BRF_SND }, // 6 x1-010 Samples -}; - -STD_ROM_PICK(msgundam) -STD_ROM_FN(msgundam) - -static INT32 msgundamInit() -{ - refresh_rate = 5666; // 56.66 hz - DrvSetVideoOffsets(0, 0, -2, -2); - DrvSetColorOffsets(0, 0x400, 0x200); - - INT32 nRet = DrvInit(msgundam68kInit, 16000000, SET_IRQLINES(4, 2), SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); - - if (nRet == 0) { - memmove (Drv68KROM + 0x100000, Drv68KROM + 0x080000, 0x100000); - memset(Drv68KROM + 0x080000, 0, 0x080000); - } - - return nRet; -} - -struct BurnDriver BurnDrvMsgundam = { - "msgundam", NULL, NULL, NULL, "1993", - "Mobile Suit Gundam\0", NULL, "Banpresto", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, msgundamRomInfo, msgundamRomName, NULL, NULL, MsgundamInputInfo, MsgundamDIPInfo, - msgundamInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, - 384, 240, 4, 3 -}; - - -// Mobile Suit Gundam (Japan) - -static struct BurnRomInfo msgundam1RomDesc[] = { - { "fa002002.u25", 0x080000, 0xdee3b083, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fa001001.u20", 0x100000, 0xfca139d0, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fa001008.u21", 0x200000, 0xe7accf48, 0x03 | BRF_GRA }, // 2 Sprites - { "fa001007.u22", 0x200000, 0x793198a6, 0x03 | BRF_GRA }, // 3 - - { "fa001006.u23", 0x100000, 0x3b60365c, 0x04 | BRF_GRA }, // 4 Layer 1 tiles - - { "fa001005.u24", 0x080000, 0x8cd7ff86, 0x05 | BRF_GRA }, // 5 Layer 2 tiles - - { "fa001004.u26", 0x100000, 0xb965f07c, 0x06 | BRF_SND }, // 6 x1-010 Samples -}; - -STD_ROM_PICK(msgundam1) -STD_ROM_FN(msgundam1) - -struct BurnDriver BurnDrvMsgundam1 = { - "msgundam1", "msgundam", NULL, NULL, "1993", - "Mobile Suit Gundam (Japan)\0", NULL, "Banpresto", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, msgundam1RomInfo, msgundam1RomName, NULL, NULL, MsgundamInputInfo, Msgunda1DIPInfo, - msgundamInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, - 384, 240, 4, 3 -}; - - -// SD Gundam Neo Battling (Japan) - -static struct BurnRomInfo neobattlRomDesc[] = { - { "bp923001.u45", 0x020000, 0x0d0aeb73, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "bp923002.u46", 0x020000, 0x9731fbbc, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "bp923-003.u15", 0x080000, 0x91ca98a1, 0x03 | BRF_GRA }, // 2 Sprites - { "bp923-004.u9", 0x080000, 0x15c678e3, 0x03 | BRF_GRA }, // 3 - - { "bp923-005.u4", 0x100000, 0x7c0e37be, 0x06 | BRF_SND }, // 4 x1-010 Samples -}; - -STD_ROM_PICK(neobattl) -STD_ROM_FN(neobattl) - -static INT32 umanclubInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(umanclub68kInit, 16000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); -} - -struct BurnDriver BurnDrvNeobattl = { - "neobattl", NULL, NULL, NULL, "1992", - "SD Gundam Neo Battling (Japan)\0", NULL, "Banpresto / Sotsu Agency. Sunrise", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, neobattlRomInfo, neobattlRomName, NULL, NULL, NeobattlInputInfo, NeobattlDIPInfo, - umanclubInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 240, 384, 3, 4 -}; - - -// Ultraman Club - Tatakae! Ultraman Kyoudai!! - -static struct BurnRomInfo umanclubRomDesc[] = { - { "uw001006.u48", 0x020000, 0x3dae1e9d, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "uw001007.u49", 0x020000, 0x5c21e702, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "bp-u-002.u2", 0x080000, 0x936cbaaa, 0x03 | BRF_GRA }, // 2 Sprites - { "bp-u-001.u1", 0x080000, 0x87813c48, 0x03 | BRF_GRA }, // 3 - - { "uw003.u13", 0x100000, 0xe2f718eb, 0x06 | BRF_SND }, // 4 x1-010 Samples -}; - -STD_ROM_PICK(umanclub) -STD_ROM_FN(umanclub) - -struct BurnDriver BurnDrvUmanclub = { - "umanclub", NULL, NULL, NULL, "1992", - "Ultraman Club - Tatakae! Ultraman Kyoudai!!\0", NULL, "Tsuburaya Prod. / Banpresto", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, umanclubRomInfo, umanclubRomName, NULL, NULL, UmanclubInputInfo, UmanclubDIPInfo, - umanclubInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; - - -// Masked Riders Club Battle Race - -static struct BurnRomInfo kamenridRomDesc[] = { - { "fj001003.25", 0x080000, 0x9b65d1b9, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - - { "fj001005.21", 0x100000, 0x5d031333, 0x03 | BRF_GRA }, // 1 Sprites - { "fj001006.22", 0x100000, 0xcf28eb78, 0x03 | BRF_GRA }, // 2 - - { "fj001007.152", 0x080000, 0xd9ffe80b, 0x04 | BRF_GRA }, // 3 user1 - - { "fj001008.26", 0x100000, 0x45e2b329, 0x06 | BRF_SND }, // 4 x1-010 Samples -}; - -STD_ROM_PICK(kamenrid) -STD_ROM_FN(kamenrid) - -static INT32 kamenridInit() -{ - DrvSetVideoOffsets(0, 0, -2, -2); - DrvSetColorOffsets(0, 0x400, 0x200); - - return DrvInit(kamenrid68kInit, 16000000, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); -} - -struct BurnDriver BurnDrvKamenrid = { - "kamenrid", NULL, NULL, NULL, "1993", - "Masked Riders Club Battle Race\0", NULL, "Toei / Banpresto", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, kamenridRomInfo, kamenridRomName, NULL, NULL, KamenridInputInfo, KamenridDIPInfo, - kamenridInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, - 384, 240, 4, 3 -}; - - -// Mad Shark - -static struct BurnRomInfo madsharkRomDesc[] = { - { "fq001002.201", 0x080000, 0x4286a811, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fq001001.200", 0x080000, 0x38bfa0ad, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fq001004.202", 0x200000, 0xe56a1b5e, 0x03 | BRF_GRA }, // 2 Sprites - - { "fq001006.152", 0x200000, 0x3bc5e8e4, 0x04 | BRF_GRA }, // 3 user1 - { "fq001005.205", 0x100000, 0x5f6c6d4a, 0x1c | BRF_GRA }, // 4 - - { "fq001007.26", 0x100000, 0xe4b33c13, 0x06 | BRF_SND }, // 5 x1-010 Samples -}; - -STD_ROM_PICK(madshark) -STD_ROM_FN(madshark) - -static INT32 madsharkInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0x200, 0xa00); - - INT32 nRet = DrvInit(madshark68kInit, 16000000, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 3)); - - if (nRet == 0) { - jjsquawkSetColorTable(); - } - - return nRet; -} - -static INT32 madsharkExit() -{ - BurnFree (DrvGfxROM2); - - return DrvExit(); -} - -struct BurnDriver BurnDrvMadshark = { - "madshark", NULL, NULL, NULL, "1993", - "Mad Shark\0", NULL, "Allumer", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, madsharkRomInfo, madsharkRomName, NULL, NULL, MadsharkInputInfo, MadsharkDIPInfo, - madsharkInit, madsharkExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, - 224, 384, 3, 4 -}; - - -// Wit's (Japan) - -static struct BurnRomInfo witsRomDesc[] = { - { "un001001.u1", 0x08000, 0x416c567e, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "un001002.u4", 0x08000, 0x497a3fa6, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "un001008.7l", 0x20000, 0x1d5d0b2b, 0x0b | BRF_GRA }, // 2 Sprites - { "un001007.5l", 0x20000, 0x9e1e6d51, 0x0b | BRF_GRA }, // 3 - { "un001006.4l", 0x20000, 0x98a980d4, 0x0b | BRF_GRA }, // 4 - { "un001005.2l", 0x20000, 0x6f2ce3c0, 0x0b | BRF_GRA }, // 5 - - { "un001004.12a", 0x20000, 0xa15ff938, 0x06 | BRF_SND }, // 6 x1-010 Samples - { "un001003.10a", 0x20000, 0x3f4b9e55, 0x06 | BRF_SND }, // 7 -}; - -STD_ROM_PICK(wits) -STD_ROM_FN(wits) - -static INT32 witsInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(thunderl68kInit, 8000000, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); -} - -struct BurnDriver BurnDrvWits = { - "wits", NULL, NULL, NULL, "1989", - "Wit's (Japan)\0", NULL, "Athena (Visco license)", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_SETA1, GBF_MISC, 0, - NULL, witsRomInfo, witsRomName, NULL, NULL, WitsInputInfo, WitsDIPInfo, - witsInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; - - -// Thunder & Lightning - -static struct BurnRomInfo thunderlRomDesc[] = { - { "m4", 0x08000, 0x1e6b9462, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "m5", 0x08000, 0x7e82793e, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "t17", 0x20000, 0x599a632a, 0x0b | BRF_GRA }, // 2 Sprites - { "t16", 0x20000, 0x3aeef91c, 0x0b | BRF_GRA }, // 3 - { "t15", 0x20000, 0xb97a7b56, 0x0b | BRF_GRA }, // 4 - { "t14", 0x20000, 0x79c707be, 0x0b | BRF_GRA }, // 5 - - { "r28", 0x80000, 0xa043615d, 0x06 | BRF_SND }, // 6 x1-010 Samples - { "r27", 0x80000, 0xcb8425a3, 0x06 | BRF_SND }, // 7 -}; - -STD_ROM_PICK(thunderl) -STD_ROM_FN(thunderl) - -struct BurnDriver BurnDrvThunderl = { - "thunderl", NULL, NULL, NULL, "1990", - "Thunder & Lightning\0", NULL, "Seta", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, thunderlRomInfo, thunderlRomName, NULL, NULL, ThunderlInputInfo, ThunderlDIPInfo, - witsInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 240, 384, 3, 4 -}; - - -// Athena no Hatena ? - -static struct BurnRomInfo atehateRomDesc[] = { - { "fs001001.evn", 0x080000, 0x4af1f273, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fs001002.odd", 0x080000, 0xc7ca7a85, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fs001003.gfx", 0x200000, 0x8b17e431, 0x03 | BRF_GRA }, // 2 Sprites - - { "fs001004.pcm", 0x100000, 0xf9344ce5, 0x06 | BRF_SND }, // 3 x1-010 Samples -}; - -STD_ROM_PICK(atehate) -STD_ROM_FN(atehate) - -static INT32 atehateInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(atehate68kInit, 16000000, SET_IRQLINES(2, 1), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); -} - -struct BurnDriver BurnDrvAtehate = { - "atehate", NULL, NULL, NULL, "1993", - "Athena no Hatena ?\0", NULL, "Athena", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, atehateRomInfo, atehateRomName, NULL, NULL, AtehateInputInfo, AtehateDIPInfo, - atehateInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; - - -// Block Carnival / Thunder & Lightning 2 - -static struct BurnRomInfo blockcarRomDesc[] = { - { "u1.a1", 0x20000, 0x4313fb00, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "u4.a3", 0x20000, 0x2237196d, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "bl-chr-0.j3", 0x80000, 0xa33300ca, 0x03 | BRF_GRA }, // 2 Sprites - { "bl-chr-1.l3", 0x80000, 0x563de808, 0x03 | BRF_GRA }, // 3 - - { "bl-snd-0.a13", 0x80000, 0xa92dabaf, 0x06 | BRF_SND }, // 4 x1-010 Samples -}; - -STD_ROM_PICK(blockcar) -STD_ROM_FN(blockcar) - -static INT32 blockcarInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(blockcar68kInit, 8000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); -} - -struct BurnDriver BurnDrvBlockcar = { - "blockcar", NULL, NULL, NULL, "1992", - "Block Carnival / Thunder & Lightning 2\0", NULL, "Visco", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, blockcarRomInfo, blockcarRomName, NULL, NULL, BlockcarInputInfo, BlockcarDIPInfo, - blockcarInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 240, 384, 3, 4 -}; - - -// Zombie Raid (US) - -static struct BurnRomInfo zombraidRomDesc[] = { - { "fy001003.3", 0x080000, 0x0b34b8f7, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fy001004.4", 0x080000, 0x71bfeb1a, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "fy001002.103", 0x080000, 0x313fd68f, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "fy001001.102", 0x080000, 0xa0f61f13, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "fy001006.200", 0x200000, 0xe9ae99f7, 0x03 | BRF_GRA }, // 4 Sprites - - { "fy001008.66", 0x200000, 0x73d7b0e1, 0x04 | BRF_GRA }, // 5 Layer 1 tiles - { "fy001007.65", 0x100000, 0xb2fc2c81, 0x1c | BRF_GRA }, // 6 - - { "fy001010.68", 0x200000, 0x8b40ed7a, 0x05 | BRF_GRA }, // 7 Layer 2 tiles - { "fy001009.67", 0x100000, 0x6bcca641, 0x1d | BRF_GRA }, // 8 - - { "fy001012.b", 0x200000, 0xfd30e102, 0x06 | BRF_SND }, // 9 x1-010 Samples - { "fy001011.a", 0x200000, 0xe3c431de, 0x06 | BRF_SND }, // 10 -}; - -STD_ROM_PICK(zombraid) -STD_ROM_FN(zombraid) - -static INT32 zombraidInit() -{ - DrvSetVideoOffsets(0, 0, -2, -2); - DrvSetColorOffsets(0, 0x200, 0xa00); - - INT32 nRet = DrvInit(zombraid68kInit, 16000000, SET_IRQLINES(2, 4), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 3)); - - if (nRet == 0) { - gundharaSetColorTable(); - } - - return nRet; -} - -struct BurnDriver BurnDrvZombraid = { - "zombraid", NULL, NULL, NULL, "1995", - "Zombie Raid (US)\0", NULL, "American Sammy", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, zombraidRomInfo, zombraidRomName, NULL, NULL, ZombraidInputInfo, ZombraidDIPInfo, - zombraidInit, DrvExit, DrvFrame, zombraidDraw, DrvScan, &DrvRecalc, 0x1200, - 384, 240, 4, 3 -}; - - -// Gundhara - -static struct BurnRomInfo gundharaRomDesc[] = { - { "bpgh-003.u3", 0x080000, 0x14e9970a, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "bpgh-004.u4", 0x080000, 0x96dfc658, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "bpgh-002.103", 0x080000, 0x312f58e2, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "bpgh-001.102", 0x080000, 0x8d23a23c, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "bpgh-008.u64", 0x200000, 0x7ed9d272, 0x03 | BRF_GRA }, // 4 Sprites - { "bpgh-006.201", 0x200000, 0x5a81411d, 0x03 | BRF_GRA }, // 5 - { "bpgh-007.u63", 0x200000, 0xaa49ce7b, 0x03 | BRF_GRA }, // 6 - { "bpgh-005.200", 0x200000, 0x74138266, 0x03 | BRF_GRA }, // 7 - - { "bpgh-010.u66", 0x100000, 0xb742f0b8, 0x04 | BRF_GRA }, // 8 Layer 1 tiles - { "bpgh-009.u65", 0x080000, 0xb768e666, 0x1c | BRF_GRA }, // 9 - - { "bpgh-012.u68", 0x200000, 0xedfda595, 0x05 | BRF_GRA }, // 10 Layer 2 tiles - { "bpgh-011.u67", 0x100000, 0x49aff270, 0x1d | BRF_GRA }, // 11 - - { "bpgh-013.u70", 0x100000, 0x0fa5d503, 0x06 | BRF_SND }, // 12 x1-010 Samples -}; - -STD_ROM_PICK(gundhara) -STD_ROM_FN(gundhara) - -static void gundhara68kInit() -{ - wrofaero68kInit(); - - memmove (DrvSndROM + 0x100000, DrvSndROM + 0x080000, 0x080000); - memmove (DrvSndROM + 0x000000, DrvSndROM + 0x080000, 0x100000); -} - -static INT32 gundharaInit() -{ - DrvSetVideoOffsets(0, 0, -2, -2); - DrvSetColorOffsets(0, 0x200, 0xa00); - - INT32 nRet = DrvInit(gundhara68kInit, 16000000, SET_IRQLINES(2, 4), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 3)); - - if (nRet == 0) { - gundharaSetColorTable(); - } - - return nRet; -} - -struct BurnDriver BurnDrvGundhara = { - "gundhara", NULL, NULL, NULL, "1995", - "Gundhara\0", NULL, "Banpresto", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, gundharaRomInfo, gundharaRomName, NULL, NULL, GundharaInputInfo, GundharaDIPInfo, - gundharaInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, - 240, 384, 3, 4 -}; - - -// Blandia - -static struct BurnRomInfo blandiaRomDesc[] = { - { "ux001001.u3", 0x040000, 0x2376a1f3, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ux001002.u4", 0x040000, 0xb915e172, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ux001003.u202", 0x100000, 0x98052c63, 0x01 | BRF_PRG | BRF_ESS }, // 2 - - { "ux001008.u64", 0x100000, 0x413647b6, 0x03 | BRF_GRA }, // 6 - { "ux001007.u201", 0x100000, 0x4440fdd1, 0x03 | BRF_GRA }, // 4 - { "ux001006.u63", 0x100000, 0xabc01cf7, 0x03 | BRF_GRA }, // 5 - { "ux001005.u200", 0x100000, 0xbea0c4a5, 0x03 | BRF_GRA }, // 3 Sprites - - { "ux001009.u65", 0x080000, 0xbc6f6aea, 0x04 | BRF_GRA }, // 7 Layer 1 tiles - { "ux001010.u66", 0x080000, 0xbd7f7614, 0x04 | BRF_GRA }, // 8 - - { "ux001011.u67", 0x080000, 0x5efe0397, 0x05 | BRF_GRA }, // 9 Layer 2 tiles - { "ux001012.u068", 0x080000, 0xf29959f6, 0x05 | BRF_GRA }, // 10 - - { "ux001013.u69", 0x100000, 0x5cd273cd, 0x06 | BRF_SND }, // 11 x1-010 Samples - { "ux001014.u70", 0x080000, 0x86b49b4e, 0x06 | BRF_SND }, // 12 -}; - -STD_ROM_PICK(blandia) -STD_ROM_FN(blandia) - -static INT32 blandiaInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0xa00, 0x200); - - INT32 nRet = DrvInit(blandia68kInit, 16000000, SET_IRQLINES(2, 4), SPRITE_BUFFER, SET_GFX_DECODE(0, 4, 4)); - - if (nRet == 0) { - blandiaSetColorTable(); - } - - return nRet; -} - -struct BurnDriver BurnDrvBlandia = { - "blandia", NULL, NULL, NULL, "1992", - "Blandia\0", NULL, "Allumer", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, blandiaRomInfo, blandiaRomName, NULL, NULL, BlandiaInputInfo, BlandiaDIPInfo, - blandiaInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, - 384, 240, 4, 3 -}; - - -// Blandia (prototype) - -static struct BurnRomInfo blandiapRomDesc[] = { - { "prg-even.bin", 0x40000, 0x7ecd30e8, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "prg-odd.bin", 0x40000, 0x42b86c15, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "tbl0.bin", 0x80000, 0x69b79eb8, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "tbl1.bin", 0x80000, 0xcf2fd350, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "o-1.bin", 0x80000, 0x4c67b7f0, 0x0b | BRF_GRA }, // 4 Sprites - { "o-0.bin", 0x80000, 0x5e7b8555, 0x0b | BRF_GRA }, // 5 - { "o-5.bin", 0x80000, 0x40bee78b, 0x0b | BRF_GRA }, // 6 - { "o-4.bin", 0x80000, 0x7c634784, 0x0b | BRF_GRA }, // 7 - { "o-3.bin", 0x80000, 0x387fc7c4, 0x0b | BRF_GRA }, // 8 - { "o-2.bin", 0x80000, 0xc669bb49, 0x0b | BRF_GRA }, // 9 - { "o-7.bin", 0x80000, 0xfc77b04a, 0x0b | BRF_GRA }, // 10 - { "o-6.bin", 0x80000, 0x92882943, 0x0b | BRF_GRA }, // 11 - - { "v1-2.bin", 0x20000, 0xd524735e, 0x04 | BRF_GRA }, // 12 Layer 1 tiles - { "v1-5.bin", 0x20000, 0xeb440cdb, 0x04 | BRF_GRA }, // 13 - { "v1-1.bin", 0x20000, 0x09bdf75f, 0x04 | BRF_GRA }, // 14 - { "v1-4.bin", 0x20000, 0x803911e5, 0x04 | BRF_GRA }, // 15 - { "v1-0.bin", 0x20000, 0x73617548, 0x04 | BRF_GRA }, // 16 - { "v1-3.bin", 0x20000, 0x7f18e4fb, 0x04 | BRF_GRA }, // 17 - - { "v2-2.bin", 0x20000, 0xc4f15638, 0x05 | BRF_GRA }, // 18 Layer 2 tiles - { "v2-5.bin", 0x20000, 0xc2e57622, 0x05 | BRF_GRA }, // 19 - { "v2-1.bin", 0x20000, 0xc4f15638, 0x05 | BRF_GRA }, // 20 - { "v2-4.bin", 0x20000, 0x16ec2130, 0x05 | BRF_GRA }, // 21 - { "v2-0.bin", 0x20000, 0x5b05eba9, 0x05 | BRF_GRA }, // 22 - { "v2-3.bin", 0x20000, 0x80ad0c3b, 0x05 | BRF_GRA }, // 23 - - { "s-0.bin", 0x40000, 0xa5fde408, 0x06 | BRF_SND }, // 24 x1-010 Samples - { "s-1.bin", 0x40000, 0x3083f9c4, 0x06 | BRF_SND }, // 25 - { "s-2.bin", 0x40000, 0xa591c9ef, 0x06 | BRF_SND }, // 26 - { "s-3.bin", 0x40000, 0x68826c9d, 0x06 | BRF_SND }, // 27 - { "s-4.bin", 0x40000, 0x1c7dc8c2, 0x06 | BRF_SND }, // 28 - { "s-5.bin", 0x40000, 0x4bb0146a, 0x06 | BRF_SND }, // 29 - { "s-6.bin", 0x40000, 0x9f8f34ee, 0x06 | BRF_SND }, // 30 - { "s-7.bin", 0x40000, 0xe077dd39, 0x06 | BRF_SND }, // 31 -}; - -STD_ROM_PICK(blandiap) -STD_ROM_FN(blandiap) - -static INT32 blandiapInit() -{ - DrvSetVideoOffsets(0, 8, -2, 6); - DrvSetColorOffsets(0, 0xa00, 0x200); - - INT32 nRet = DrvInit(blandiap68kInit, 16000000, SET_IRQLINES(2, 4), SPRITE_BUFFER, SET_GFX_DECODE(0, 4, 4)); - - if (nRet == 0) { - blandiaSetColorTable(); - } - - return nRet; -} - -struct BurnDriver BurnDrvBlandiap = { - "blandiap", "blandia", NULL, NULL, "1992", - "Blandia (prototype)\0", NULL, "Allumer", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, blandiapRomInfo, blandiapRomName, NULL, NULL, BlandiaInputInfo, BlandiaDIPInfo, - blandiapInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, - 384, 240, 4, 3 -}; - - -// Oishii Puzzle Ha Irimasenka - -static struct BurnRomInfo oisipuzlRomDesc[] = { - { "ss1u200.v10", 0x80000, 0xf5e53baf, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ss1u201.v10", 0x80000, 0x7a7ff5ae, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "ss1u306.v10", 0x80000, 0xce43a754, 0x03 | BRF_GRA }, // 2 Sprites - { "ss1u307.v10", 0x80000, 0x2170b7ec, 0x03 | BRF_GRA }, // 3 - { "ss1u304.v10", 0x80000, 0x546ab541, 0x03 | BRF_GRA }, // 4 - { "ss1u305.v10", 0x80000, 0x2a33e08b, 0x03 | BRF_GRA }, // 5 - - { "ss1u23.v10", 0x80000, 0x9fa60901, 0x04 | BRF_GRA }, // 6 Layer 1 tiles - { "ss1u24.v10", 0x80000, 0xc10eb4b3, 0x04 | BRF_GRA }, // 7 - - { "ss1u25.v10", 0x80000, 0x56840728, 0x05 | BRF_GRA }, // 8 Layer 2 tiles - - { "ss1u26.v10", 0x80000, 0xd452336b, 0x06 | BRF_SND }, // 9 x1-010 Samples - { "ss1u27.v10", 0x80000, 0x17fe921d, 0x06 | BRF_SND }, // 10 -}; - -STD_ROM_PICK(oisipuzl) -STD_ROM_FN(oisipuzl) - -static INT32 oisipuzlInit() -{ - oisipuzl_hack = 1; // 32 pixel offset for sprites??? - watchdog_enable = 1; // needs a reset before it will boot - - DrvSetVideoOffsets(2, 2, -1, -1); - DrvSetColorOffsets(0, 0x400, 0x200); - - INT32 nRet = DrvInit(oisipuzl68kInit, 16000000, (2 << 8) | (1 << 0), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); - - if (nRet == 0) - { - memset (Drv68KROM, 0, 0x200000); - - if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; - if (BurnLoadRom(Drv68KROM + 0x100000, 1, 1)) return 1; - - for (INT32 i = 0; i < 0x400000; i++) DrvGfxROM0[i] ^= 0x0f; // invert - } - - return nRet; -} - -struct BurnDriver BurnDrvOisipuzl = { - "oisipuzl", NULL, NULL, NULL, "1993", - "Oishii Puzzle Ha Irimasenka\0", NULL, "Sunsoft + Atlus", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, oisipuzlRomInfo, oisipuzlRomName, NULL, NULL, OisipuzlInputInfo, OisipuzlDIPInfo, - oisipuzlInit, DrvExit, DrvFrame, seta2layerFlippedDraw, DrvScan, &DrvRecalc, 0x600, - 320, 224, 4, 3 -}; - - -// Triple Fun - -static struct BurnRomInfo triplfunRomDesc[] = { - { "05.bin", 0x80000, 0x06eb3821, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "04.bin", 0x80000, 0x37a5c46e, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "09.bin", 0x80000, 0x98cc8ca5, 0x0b | BRF_GRA }, // 2 Sprites - { "08.bin", 0x80000, 0x63a8f10f, 0x0b | BRF_GRA }, // 3 - { "11.bin", 0x80000, 0x276ef724, 0x0b | BRF_GRA }, // 4 - { "10.bin", 0x80000, 0x20b0f282, 0x0b | BRF_GRA }, // 5 - - { "02.bin", 0x80000, 0x4c0d1068, 0x0c | BRF_GRA }, // 6 Layer 1 tiles - { "03.bin", 0x80000, 0xdba94e18, 0x0c | BRF_GRA }, // 7 - - { "06.bin", 0x40000, 0x8944bb72, 0x0d | BRF_GRA }, // 8 Layer 2 tiles - { "07.bin", 0x40000, 0x934a5d91, 0x0d | BRF_GRA }, // 9 - - { "01.bin", 0x40000, 0xc186a930, 0x06 | BRF_SND }, // 10 OKI M6295 Samples -}; - -STD_ROM_PICK(triplfun) -STD_ROM_FN(triplfun) - -static INT32 triplfunInit() -{ - oisipuzl_hack = 1; - DrvSetVideoOffsets(0, 0, -1, -1); - DrvSetColorOffsets(0, 0x400, 0x200); - - return DrvInit(triplfun68kInit, 16000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); -} - -struct BurnDriver BurnDrvTriplfun = { - "triplfun", "oisipuzl", NULL, NULL, "1993", - "Triple Fun\0", NULL, "bootleg", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, triplfunRomInfo, triplfunRomName, NULL, NULL, OisipuzlInputInfo, OisipuzlDIPInfo, - triplfunInit, DrvExit, DrvM6295Frame, seta2layerFlippedDraw, DrvScan, &DrvRecalc, 0x600, - 320, 224, 4, 3 -}; - - -// Pairs Love - -static struct BurnRomInfo pairloveRomDesc[] = { - { "ut2-001-001.1a", 0x10000, 0x083338b7, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ut2-001-002.3a", 0x10000, 0x39d88aae, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "ut2-001-004.5j", 0x80000, 0xfdc47b26, 0x03 | BRF_GRA }, // 2 Sprites - { "ut2-001-005.5l", 0x80000, 0x076f94a2, 0x03 | BRF_GRA }, // 3 - - { "ut2-001-003.12a", 0x80000, 0x900219a9, 0x06 | BRF_SND }, // 4 x1-010 Samples -}; - -STD_ROM_PICK(pairlove) -STD_ROM_FN(pairlove) - -static INT32 pairloveInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - INT32 nRet = DrvInit(pairlove68kInit, 8000000, SET_IRQLINES(2, 1), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); - - if (nRet == 0) { - memcpy (DrvSndROM + 0x80000, DrvSndROM, 0x80000); - } - - return nRet; -} - -struct BurnDriver BurnDrvPairlove = { - "pairlove", NULL, NULL, NULL, "1991", - "Pairs Love\0", NULL, "Athena", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, pairloveRomInfo, pairloveRomName, NULL, NULL, PairloveInputInfo, PairloveDIPInfo, - pairloveInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 240, 384, 3, 4 -}; - - -// Orbs (10/7/94 prototype?) - -static struct BurnRomInfo orbsRomDesc[] = { - { "orbs.u10", 0x80000, 0x10f079c8, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "orbs.u9", 0x80000, 0xf269d16f, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "orbs.u14", 0x80000, 0x1cc76541, 0x03 | BRF_GRA }, // 2 Sprites - { "orbs.u13", 0x80000, 0x784bdc1a, 0x03 | BRF_GRA }, // 3 - { "orbs.u12", 0x80000, 0xb8c352c2, 0x03 | BRF_GRA }, // 4 - { "orbs.u11", 0x80000, 0x58cb38ba, 0x03 | BRF_GRA }, // 5 - - { "orbs.u15", 0x80000, 0xbc0e9fe3, 0x06 | BRF_SND }, // 6 x1-010 Samples - { "orbs.u16", 0x80000, 0xaecd8373, 0x06 | BRF_SND }, // 7 -}; - -STD_ROM_PICK(orbs) -STD_ROM_FN(orbs) - -static INT32 orbsInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(pairlove68kInit, 7159090, SET_IRQLINES(2, 1), NO_SPRITE_BUFFER, SET_GFX_DECODE(5, -1, -1)); -} - -struct BurnDriver BurnDrvOrbs = { - "orbs", NULL, NULL, NULL, "1994", - "Orbs (10/7/94 prototype?)\0", NULL, "American Sammy", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, orbsRomInfo, orbsRomName, NULL, NULL, OrbsInputInfo, OrbsDIPInfo, - orbsInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 320, 240, 4, 3 -}; - - -// Kero Kero Keroppi no Issyoni Asobou (Japan) - -static struct BurnRomInfo keroppiRomDesc[] = { - { "ft-001-001.u10", 0x80000, 0x37861e7d, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ft-001-002.u9", 0x80000, 0xf531d4ef, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "ft-001-003.u14", 0x80000, 0x62fb22fb, 0x03 | BRF_GRA }, // 2 Sprites - { "ft-001-004.u13", 0x80000, 0x69908c98, 0x03 | BRF_GRA }, // 3 - { "ft-001-005.u12", 0x80000, 0xde6432a8, 0x03 | BRF_GRA }, // 4 - { "ft-001-006.u11", 0x80000, 0x9c500eae, 0x03 | BRF_GRA }, // 5 - - { "ft-001-007.u15", 0x80000, 0xc98dacf0, 0x06 | BRF_SND }, // 6 x1-010 Samples - { "ft-001-008.u16", 0x80000, 0xb9c4b637, 0x06 | BRF_SND }, // 7 -}; - -STD_ROM_PICK(keroppi) -STD_ROM_FN(keroppi) - -struct BurnDriver BurnDrvKeroppi = { - "keroppi", NULL, NULL, NULL, "1993", - "Kero Kero Keroppi no Issyoni Asobou (Japan)\0", NULL, "Sammy Industries", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 1, HARDWARE_SETA1, GBF_MISC, 0, - NULL, keroppiRomInfo, keroppiRomName, NULL, NULL, KeroppiInputInfo, KeroppiDIPInfo, - orbsInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 320, 240, 4, 3 -}; - - -// J. J. Squawkers - -static struct BurnRomInfo jjsquawkRomDesc[] = { - { "fe2002001.u3", 0x80000, 0x7b9af960, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fe2002002.u4", 0x80000, 0x47dd71a3, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fe2001009", 0x80000, 0x27441cd3, 0x03 | BRF_GRA }, // 2 Sprites - { "fe2001010", 0x80000, 0xca2b42c4, 0x03 | BRF_GRA }, // 3 - { "fe2001007", 0x80000, 0x62c45658, 0x03 | BRF_GRA }, // 4 - { "fe2001008", 0x80000, 0x2690c57b, 0x03 | BRF_GRA }, // 5 - - { "fe2001011", 0x80000, 0x98b9f4b4, 0x04 | BRF_GRA }, // 6 Layer 1 tiles - { "fe2001012", 0x80000, 0xd4aa916c, 0x04 | BRF_GRA }, // 7 - { "fe2001003", 0x80000, 0xa5a35caf, 0x1c | BRF_GRA }, // 8 - - { "fe2001014", 0x80000, 0x274bbb48, 0x05 | BRF_GRA }, // 9 Layer 2 tiles - { "fe2001013", 0x80000, 0x51e29871, 0x05 | BRF_GRA }, // 10 - { "fe2001004", 0x80000, 0xa235488e, 0x1d | BRF_GRA }, // 11 - - { "fe2001005.u69", 0x80000, 0xd99f2879, 0x06 | BRF_SND }, // 12 x1-010 Samples - { "fe2001006.u70", 0x80000, 0x9df1e478, 0x06 | BRF_SND }, // 13 -}; - -STD_ROM_PICK(jjsquawk) -STD_ROM_FN(jjsquawk) - -static INT32 jjsquawkInit() -{ - DrvSetVideoOffsets(1, 1, -1, -1); - DrvSetColorOffsets(0, 0x200, 0xa00); - - INT32 nRet = DrvInit(wrofaero68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 3)); - - if (nRet == 0) { - jjsquawkSetColorTable(); - - memcpy (Drv68KROM + 0x100000, Drv68KROM + 0x080000, 0x080000); - memset (Drv68KROM + 0x080000, 0, 0x080000); - } - - return nRet; -} - -struct BurnDriver BurnDrvJjsquawk = { - "jjsquawk", NULL, NULL, NULL, "1993", - "J. J. Squawkers\0", NULL, "Athena / Able", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, jjsquawkRomInfo, jjsquawkRomName, NULL, NULL, JjsquawkInputInfo, JjsquawkDIPInfo, - jjsquawkInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, - 384, 240, 4, 3 -}; - - -// J. J. Squawkers (bootleg, Blandia conversion) - -static struct BurnRomInfo jjsquawkb2RomDesc[] = { - { "u3.3a", 0x080000, 0xf94c913b, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "u4.4a", 0x080000, 0x0227a2be, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "u64.3l", 0x100000, 0x11d8713a, 0x03 | BRF_GRA }, // 2 Sprites // jj-rom9 + jj-rom10 from jjsquawk - { "u63.2l", 0x100000, 0x7a385ef0, 0x03 | BRF_GRA }, // 3 // jj-rom7 + jj-rom8 from jjsquawk - - { "u66.5l", 0x100000, 0xbbaf40c5, 0x04 | BRF_GRA }, // 4 Layer 1 tiles // jj-rom11 + jj-rom12 from jjsquawk - { "u65.4l", 0x080000, 0xa5a35caf, 0x1c | BRF_GRA }, // 5 // jj-rom3.040 from jjsquawk - - { "u68.7l", 0x100000, 0xae9ae01f, 0x05 | BRF_GRA }, // 9 Layer 2 tiles // jj-rom14 + jj-rom13 from jjsquawk - { "u67.6l", 0x080000, 0xa235488e, 0x1d | BRF_GRA }, // 10 // jj-rom4.040 from jjsquawk - - { "u70.10l", 0x100000, 0x181a55b8, 0x06 | BRF_SND }, // 11 x1-010 Samples // jj-rom5.040 + jj-rom6.040 from jjsquawk -}; - -STD_ROM_PICK(jjsquawkb2) -STD_ROM_FN(jjsquawkb2) - -struct BurnDriver BurnDrvJjsquawkb2 = { - "jjsquawkb2", "jjsquawk", NULL, NULL, "1993", - "J. J. Squawkers (bootleg, Blandia conversion)\0", NULL, "Athena / Able", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, jjsquawkb2RomInfo, jjsquawkb2RomName, NULL, NULL, JjsquawkInputInfo, JjsquawkDIPInfo, - jjsquawkInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, - 384, 240, 4, 3 -}; - - -// J. J. Squawkers (bootleg) - -static struct BurnRomInfo jjsquawkbRomDesc[] = { - { "3", 0x080000, 0xafd5bd07, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "2", 0x080000, 0x740a7366, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "4.bin", 0x200000, 0x969502f7, 0x03 | BRF_GRA }, // 2 Sprites - { "2.bin", 0x200000, 0x765253d1, 0x03 | BRF_GRA }, // 3 - - { "3.bin", 0x200000, 0xb1e3a4bb, 0x04 | BRF_GRA }, // 4 Layer 1 tiles - { "1.bin", 0x200000, 0xa5d37cf7, 0x04 | BRF_GRA }, // 5 - - { "1", 0x100000, 0x181a55b8, 0x06 | BRF_SND }, // 6 x1-010 Samples -}; - -STD_ROM_PICK(jjsquawkb) -STD_ROM_FN(jjsquawkb) - -static INT32 jjsquawkbInit() -{ - DrvSetVideoOffsets(1, 1, -1, -1); - DrvSetColorOffsets(0, 0x200, 0xa00); - - INT32 nRet = DrvInit(jjsquawkb68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 3)); - - if (nRet == 0) { - jjsquawkSetColorTable(); - } - - return nRet; -} - -struct BurnDriver BurnDrvJjsquawkb = { - "jjsquawkb", "jjsquawk", NULL, NULL, "1993", - "J. J. Squawkers (bootleg)\0", NULL, "bootleg", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, jjsquawkbRomInfo, jjsquawkbRomName, NULL, NULL, JjsquawkInputInfo, JjsquawkDIPInfo, - jjsquawkbInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, - 384, 240, 4, 3 -}; - - -// Extreme Downhill (v1.5) - -static struct BurnRomInfo extdwnhlRomDesc[] = { - { "fw001002.201", 0x080000, 0x24d21924, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fw001001.200", 0x080000, 0xfb12a28b, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fw001003.202", 0x200000, 0xac9b31d5, 0x03 | BRF_GRA }, // 2 Sprites - - { "fw001004.206", 0x200000, 0x0dcb1d72, 0x04 | BRF_GRA }, // 3 Layer 1 tiles - { "fw001005.205", 0x100000, 0x5c33b2f1, 0x1c | BRF_GRA }, // 4 - - { "fw001006.152", 0x200000, 0xd00e8ddd, 0x05 | BRF_GRA }, // 5 Layer 2 tiles - - { "fw001007.026", 0x100000, 0x16d84d7a, 0x06 | BRF_SND }, // 6 x1-010 Samples -}; - -STD_ROM_PICK(extdwnhl) -STD_ROM_FN(extdwnhl) - -static INT32 extdwnhlInit() -{ - watchdog_enable = 1; - - DrvSetVideoOffsets(0, 0, -2, -2); - DrvSetColorOffsets(0, 0x400, 0x200); - - INT32 nRet = DrvInit(extdwnhl68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 2)); - - if (nRet == 0) { - zingzapSetColorTable(); - if (DrvGfxTransMask[2] == NULL) { - DrvGfxTransMask[2] = DrvGfxTransMask[1]; // sokonuke fix - bprintf (0, _T("null\n")); - } - } - - return nRet; -} - -struct BurnDriver BurnDrvExtdwnhl = { - "extdwnhl", NULL, NULL, NULL, "1995", - "Extreme Downhill (v1.5)\0", NULL, "Sammy Industries Japan", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, extdwnhlRomInfo, extdwnhlRomName, NULL, NULL, ExtdwnhlInputInfo, ExtdwnhlDIPInfo, - extdwnhlInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, - 320, 240, 4, 3 -}; - - -// Sokonuke Taisen Game (Japan) - -static struct BurnRomInfo sokonukeRomDesc[] = { - { "001-001.bin", 0x080000, 0x9d0aa3ca, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "001-002.bin", 0x080000, 0x96f2ef5f, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "001-003.bin", 0x200000, 0xab9ba897, 0x03 | BRF_GRA }, // 2 Sprites - - { "001-004.bin", 0x100000, 0x34ca3540, 0x04 | BRF_GRA }, // 3 Layer 1 tiles - { "001-005.bin", 0x080000, 0x2b95d68d, 0x1c | BRF_GRA }, // 4 - - { "001-006.bin", 0x100000, 0xecfac767, 0x06 | BRF_SND }, // 5 x1-010 Samples -}; - -STD_ROM_PICK(sokonuke) -STD_ROM_FN(sokonuke) - -struct BurnDriver BurnDrvSokonuke = { - "sokonuke", NULL, NULL, NULL, "1995", - "Sokonuke Taisen Game (Japan)\0", NULL, "Sammy Industries", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, sokonukeRomInfo, sokonukeRomName, NULL, NULL, SokonukeInputInfo, SokonukeDIPInfo, - extdwnhlInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, - 320, 240, 4, 3 -}; - - -// Krazy Bowl - -static struct BurnRomInfo krzybowlRomDesc[] = { - { "fv001.002", 0x40000, 0x8c03c75f, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fv001.001", 0x40000, 0xf0630beb, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fv001.003", 0x80000, 0x7de22749, 0x03 | BRF_GRA }, // 2 Sprites - { "fv001.004", 0x80000, 0xc7d2fe32, 0x03 | BRF_GRA }, // 3 - - { "fv001.005", 0x80000, 0x5e206062, 0x06 | BRF_SND }, // 4 x1-010 Samples - { "fv001.006", 0x80000, 0x572a15e7, 0x06 | BRF_SND }, // 5 -}; - -STD_ROM_PICK(krzybowl) -STD_ROM_FN(krzybowl) - -static INT32 krzybowlInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(krzybowl68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); -} - -struct BurnDriverD BurnDrvKrzybowl = { - "krzybowl", NULL, NULL, NULL, "1994", - "Krazy Bowl\0", NULL, "American Sammy", "Seta", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, krzybowlRomInfo, krzybowlRomName, NULL, NULL, KrzybowlInputInfo, KrzybowlDIPInfo, - krzybowlInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 240, 320, 3, 4 -}; - - -// Wiggie Waggie - -static struct BurnRomInfo wiggieRomDesc[] = { - { "wiggie.e19", 0x10000, 0x24b58f16, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "wiggie.e21", 0x10000, 0x83ba6edb, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "wiggie.a5", 0x10000, 0x8078d77b, 0x02 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "wiggie.j16", 0x20000, 0x4fb40b8a, 0x03 | BRF_GRA }, // 3 Sprites - { "wiggie.j18", 0x20000, 0xebc418e9, 0x03 | BRF_GRA }, // 4 - { "wiggie.j20", 0x20000, 0xc073501b, 0x03 | BRF_GRA }, // 5 - { "wiggie.j21", 0x20000, 0x22f6fa39, 0x03 | BRF_GRA }, // 6 - - { "wiggie.d1", 0x40000, 0x27fbe12a, 0x06 | BRF_SND }, // 7 OKI M6295 Samples -}; - -STD_ROM_PICK(wiggie) -STD_ROM_FN(wiggie) - -static INT32 wiggieInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(wiggie68kInit, 16000000 / 2, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(6, -1, -1)); -} - -struct BurnDriver BurnDrvWiggie = { - "wiggie", NULL, NULL, NULL, "1994", - "Wiggie Waggie\0", NULL, "Promat", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, wiggieRomInfo, wiggieRomName, NULL, NULL, ThunderlInputInfo, ThunderlDIPInfo, - wiggieInit, DrvExit, DrvZ80M6295Frame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 240, 384, 3, 4 -}; - - -// Super Bar - -static struct BurnRomInfo superbarRomDesc[] = { - { "promat_512-1.e19", 0x10000, 0xcc7f9e87, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "promat_512-2.e21", 0x10000, 0x5e8c7231, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "promat.a5", 0x10000, 0x8078d77b, 0x02 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "promat_1m-4.j16", 0x20000, 0x43dbc99f, 0x03 | BRF_GRA }, // 3 Sprites - { "promat_1m-5.j18", 0x20000, 0xc09344b0, 0x03 | BRF_GRA }, // 4 - { "promat_1m-6.j20", 0x20000, 0x7d83f8ba, 0x03 | BRF_GRA }, // 5 - { "promat_1m-7.j21", 0x20000, 0x734df92a, 0x03 | BRF_GRA }, // 6 - - { "promat_2m-1.d1", 0x40000, 0x27fbe12a, 0x06 | BRF_SND }, // 7 OKI M6295 Samples -}; - -STD_ROM_PICK(superbar) -STD_ROM_FN(superbar) - -static INT32 superbarInit() -{ - DrvSetVideoOffsets(0, 0, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(wiggie68kInit, 8000000, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(7, -1, -1)); -} - -struct BurnDriver BurnDrvSuperbar = { - "superbar", "wiggie", NULL, NULL, "1994", - "Super Bar\0", NULL, "Promat", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, superbarRomInfo, superbarRomName, NULL, NULL, ThunderlInputInfo, ThunderlDIPInfo, - superbarInit, DrvExit, DrvZ80M6295Frame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 240, 384, 3, 4 -}; - - -// Ultra Toukon Densetsu (Japan) - -static struct BurnRomInfo utoukondRomDesc[] = { - { "93uta010.3", 0x080000, 0xc486ef5e, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "93uta011.4", 0x080000, 0x978978f7, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "93uta009.112", 0x010000, 0x67f18483, 0x02 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "93uta04.64", 0x100000, 0x9cba0538, 0x03 | BRF_GRA }, // 3 Sprites - { "93uta02.201", 0x100000, 0x884fedfa, 0x03 | BRF_GRA }, // 4 - { "93uta03.63", 0x100000, 0x818484a5, 0x03 | BRF_GRA }, // 5 - { "93uta01.200", 0x100000, 0x364de841, 0x03 | BRF_GRA }, // 6 - - { "93uta05.66", 0x100000, 0x5e640bfb, 0x04 | BRF_GRA }, // 7 Layer 1 tiles - - { "93uta07.68", 0x100000, 0x67bdd036, 0x05 | BRF_GRA }, // 8 Layer 2 tiles - { "93uta06.67", 0x100000, 0x294c26e4, 0x05 | BRF_GRA }, // 9 - - { "93uta08.69", 0x100000, 0x3d50bbcd, 0x06 | BRF_SND }, // 10 x1-010 Samples -}; - -STD_ROM_PICK(utoukond) -STD_ROM_FN(utoukond) - -static INT32 utoukondInit() -{ - DrvSetVideoOffsets(0, 0, -2, 0); - DrvSetColorOffsets(0, 0x400, 0x200); - - return DrvInit(utoukond68kInit, 16000000, SET_IRQLINES(2, 1), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); -} - -struct BurnDriver BurnDrvUtoukond = { - "utoukond", NULL, NULL, NULL, "1993", - "Ultra Toukon Densetsu (Japan)\0", "No sound", "Banpresto + Tsuburaya Prod.", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, utoukondRomInfo, utoukondRomName, NULL, NULL, UtoukondInputInfo, UtoukondDIPInfo, - utoukondInit, DrvExit, Drv68kZ80YM3438Frame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, - 384, 224, 4, 3 -}; - - -// DownTown / Mokugeki (Set 1) - -static struct BurnRomInfo downtownRomDesc[] = { - { "ud2-001-000.3c", 0x40000, 0xf1965260, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ud2-001-003.11c", 0x40000, 0xe7d5fa5f, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ud2001002.9b", 0x10000, 0xa300e3ac, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ud2001001.8b", 0x10000, 0xd2918094, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ud2-002-004.17c", 0x40000, 0xbbd538b1, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code - - { "ud2-001-005-t01.2n", 0x80000, 0x77e6d249, 0x0b | BRF_GRA }, // 5 Sprites - { "ud2-001-006-t02.3n", 0x80000, 0x6e381bf2, 0x0b | BRF_GRA }, // 6 - { "ud2-001-007-t03.5n", 0x80000, 0x737b4971, 0x0b | BRF_GRA }, // 7 - { "ud2-001-008-t04.6n", 0x80000, 0x99b9d757, 0x0b | BRF_GRA }, // 8 - - { "ud2-001-009-t05.8n", 0x80000, 0xaee6c581, 0x04 | BRF_GRA }, // 9 Layer 1 tiles - { "ud2-001-010-t06.9n", 0x80000, 0x3d399d54, 0x04 | BRF_GRA }, // 10 - - { "ud2-001-011-t07.14n", 0x80000, 0x9c9ff69f, 0x06 | BRF_SND }, // 11 x1-010 Samples -}; - -STD_ROM_PICK(downtown) -STD_ROM_FN(downtown) - -static INT32 downtownInit() -{ - refresh_rate = 5742; // 57.42 hz - DrvSetVideoOffsets(0, 0, -1, 0); - DrvSetColorOffsets(0, 0, 0); - - INT32 nRet = DrvInit(downtown68kInit, 8000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); - - x1010_set_all_routes(0.50, BURN_SND_ROUTE_LEFT); - - return nRet; -} - -struct BurnDriver BurnDrvDowntown = { - "downtown", NULL, NULL, NULL, "1989", - "DownTown / Mokugeki (Set 1)\0", "No sound, imperfect inputs", "Seta", "Seta", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, downtownRomInfo, downtownRomName, NULL, NULL, DowntownInputInfo, DowntownDIPInfo, - downtownInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 224, 384, 3, 4 -}; - - -// DownTown / Mokugeki (Set 2) - -static struct BurnRomInfo downtown2RomDesc[] = { - { "ud2-001-000.3c", 0x40000, 0xf1965260, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ud2-001-003.11c", 0x40000, 0xe7d5fa5f, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ud2000002.9b", 0x10000, 0xca976b24, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ud2000001.8b", 0x10000, 0x1708aebd, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ud2-002-004.17c", 0x40000, 0xbbd538b1, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code - - { "ud2-001-005-t01.2n", 0x80000, 0x77e6d249, 0x0b | BRF_GRA }, // 5 Sprites - { "ud2-001-006-t02.3n", 0x80000, 0x6e381bf2, 0x0b | BRF_GRA }, // 6 - { "ud2-001-007-t03.5n", 0x80000, 0x737b4971, 0x0b | BRF_GRA }, // 7 - { "ud2-001-008-t04.6n", 0x80000, 0x99b9d757, 0x0b | BRF_GRA }, // 8 - - { "ud2-001-009-t05.8n", 0x80000, 0xaee6c581, 0x04 | BRF_GRA }, // 9 Layer 1 tiles - { "ud2-001-010-t06.9n", 0x80000, 0x3d399d54, 0x04 | BRF_GRA }, // 10 - - { "ud2-001-011-t07.14n", 0x80000, 0x9c9ff69f, 0x06 | BRF_SND }, // 11 x1-010 Samples -}; - -STD_ROM_PICK(downtown2) -STD_ROM_FN(downtown2) - -struct BurnDriverD BurnDrvDowntown2 = { - "downtown2", "downtown", NULL, NULL, "1989", - "DownTown / Mokugeki (Set 2)\0", "No sound, imperfect inputs", "Seta", "Seta", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, downtown2RomInfo, downtown2RomName, NULL, NULL, DowntownInputInfo, DowntownDIPInfo, - downtownInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 224, 384, 3, 4 -}; - - -// DownTown / Mokugeki (Joystick Hack) - -static struct BurnRomInfo downtownjRomDesc[] = { - { "ud2-001-000.3c", 0x40000, 0xf1965260, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ud2-001-003.11c", 0x40000, 0xe7d5fa5f, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "u37.9b", 0x10000, 0x73047657, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "u31.8b", 0x10000, 0x6a050240, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ud2-002-004.17c", 0x40000, 0xbbd538b1, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code - - { "ud2-001-005-t01.2n", 0x80000, 0x77e6d249, 0x0b | BRF_GRA }, // 5 Sprites - { "ud2-001-006-t02.3n", 0x80000, 0x6e381bf2, 0x0b | BRF_GRA }, // 6 - { "ud2-001-007-t03.5n", 0x80000, 0x737b4971, 0x0b | BRF_GRA }, // 7 - { "ud2-001-008-t04.6n", 0x80000, 0x99b9d757, 0x0b | BRF_GRA }, // 8 - - { "ud2-001-009-t05.8n", 0x80000, 0xaee6c581, 0x04 | BRF_GRA }, // 9 Layer 1 tiles - { "ud2-001-010-t06.9n", 0x80000, 0x3d399d54, 0x04 | BRF_GRA }, // 10 - - { "ud2-001-011-t07.14n", 0x80000, 0x9c9ff69f, 0x06 | BRF_SND }, // 11 x1-010 Samples -}; - -STD_ROM_PICK(downtownj) -STD_ROM_FN(downtownj) - -struct BurnDriver BurnDrvDowntownj = { - "downtownj", "downtown", NULL, NULL, "1989", - "DownTown / Mokugeki (Joystick Hack)\0", "No sound, imperfect inputs", "Seta", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, downtownjRomInfo, downtownjRomName, NULL, NULL, DowntownInputInfo, DowntownDIPInfo, - downtownInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 224, 384, 3, 4 -}; - - -// DownTown / Mokugeki (prototype) - -static struct BurnRomInfo downtownpRomDesc[] = { - { "ud2-001-000.3c", 0x40000, 0xf1965260, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ud2-001-003.11c", 0x40000, 0xe7d5fa5f, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ud2_even_v061.9b", 0x10000, 0x251d6552, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ud2_odd_v061.8b", 0x10000, 0x6394a7c0, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ud2-002-004.17c", 0x40000, 0xbbd538b1, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code - - { "ud2-001-005-t01.2n", 0x80000, 0x77e6d249, 0x0b | BRF_GRA }, // 5 Sprites - { "ud2-001-006-t02.3n", 0x80000, 0x6e381bf2, 0x0b | BRF_GRA }, // 6 - { "ud2-001-007-t03.5n", 0x80000, 0x737b4971, 0x0b | BRF_GRA }, // 7 - { "ud2-001-008-t04.6n", 0x80000, 0x99b9d757, 0x0b | BRF_GRA }, // 8 - - { "ud2-001-009-t05.8n", 0x80000, 0xaee6c581, 0x04 | BRF_GRA }, // 9 Layer 1 tiles - { "ud2-001-010-t06.9n", 0x80000, 0x3d399d54, 0x04 | BRF_GRA }, // 10 - - { "ud2-001-011-t07.14n", 0x80000, 0x9c9ff69f, 0x06 | BRF_SND }, // 11 x1-010 Samples -}; - -STD_ROM_PICK(downtownp) -STD_ROM_FN(downtownp) - -struct BurnDriverD BurnDrvDowntownp = { - "downtownp", "downtown", NULL, NULL, "1989", - "DownTown / Mokugeki (prototype)\0", "No sound, imperfect inputs", "Seta", "Seta", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, downtownpRomInfo, downtownpRomName, NULL, NULL, DowntownInputInfo, DowntownDIPInfo, - downtownInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 224, 384, 3, 4 -}; - - -// Thundercade / Twin Formation - -static struct BurnRomInfo tndrcadeRomDesc[] = { - { "ua0-4.u19", 0x20000, 0x73bd63eb, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ua0-2.u17", 0x20000, 0xe96194b1, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ua0-3.u18", 0x20000, 0x0a7b1c41, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ua0-1.u16", 0x20000, 0xfa906626, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ua10-5.u24", 0x20000, 0x8eff6122, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code - - { "ua0-10.u12", 0x40000, 0xaa7b6757, 0x03 | BRF_GRA }, // 5 Sprites - { "ua0-11.u13", 0x40000, 0x11eaf931, 0x03 | BRF_GRA }, // 6 - { "ua0-12.u14", 0x40000, 0x00b5381c, 0x03 | BRF_GRA }, // 7 - { "ua0-13.u15", 0x40000, 0x8f9a0ed3, 0x03 | BRF_GRA }, // 8 - { "ua0-6.u8", 0x40000, 0x14ecc7bb, 0x03 | BRF_GRA }, // 9 - { "ua0-7.u9", 0x40000, 0xff1a4e68, 0x03 | BRF_GRA }, // 10 - { "ua0-8.u10", 0x40000, 0x936e1884, 0x03 | BRF_GRA }, // 11 - { "ua0-9.u11", 0x40000, 0xe812371c, 0x03 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(tndrcade) -STD_ROM_FN(tndrcade) - -static INT32 tndrcadeInit() -{ - DrvSetVideoOffsets(-1, 0, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(tndrcade68kInit, 8000000, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); -} - -struct BurnDriverD BurnDrvTndrcade = { - "tndrcade", NULL, NULL, NULL, "1987", - "Thundercade / Twin Formation\0", "No sound, imperfect inputs", "[Seta] (Taito license)", "Seta", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, tndrcadeRomInfo, tndrcadeRomName, NULL, NULL, TndrcadeInputInfo, TndrcadeDIPInfo, - tndrcadeInit, DrvExit, DrvFrame /*DrvM65c02Frame*/, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 224, 384, 3, 4 -}; - - -// Tokusyu Butai U.A.G. (Japan) - -static struct BurnRomInfo tndrcadejRomDesc[] = { - { "ua0-4.u19", 0x20000, 0x73bd63eb, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ua0-2.u17", 0x20000, 0xe96194b1, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ua0-3.u18", 0x20000, 0x0a7b1c41, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ua0-1.u16", 0x20000, 0xfa906626, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "thcade5.u24", 0x20000, 0x8cb9df7b, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code - - { "ua0-10.u12", 0x40000, 0xaa7b6757, 0x03 | BRF_GRA }, // 5 Sprites - { "ua0-11.u13", 0x40000, 0x11eaf931, 0x03 | BRF_GRA }, // 6 - { "ua0-12.u14", 0x40000, 0x00b5381c, 0x03 | BRF_GRA }, // 7 - { "ua0-13.u15", 0x40000, 0x8f9a0ed3, 0x03 | BRF_GRA }, // 8 - { "ua0-6.u8", 0x40000, 0x14ecc7bb, 0x03 | BRF_GRA }, // 9 - { "ua0-7.u9", 0x40000, 0xff1a4e68, 0x03 | BRF_GRA }, // 10 - { "ua0-8.u10", 0x40000, 0x936e1884, 0x03 | BRF_GRA }, // 11 - { "ua0-9.u11", 0x40000, 0xe812371c, 0x03 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(tndrcadej) -STD_ROM_FN(tndrcadej) - -struct BurnDriverD BurnDrvTndrcadej = { - "tndrcadej", "tndrcade", NULL, NULL, "1987", - "Tokusyu Butai U.A.G. (Japan)\0", "No sound, imperfect inputs", "[Seta] (Taito license)", "Seta", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, tndrcadejRomInfo, tndrcadejRomName, NULL, NULL, TndrcadeInputInfo, TndrcadjDIPInfo, - tndrcadeInit, DrvExit, DrvFrame /*DrvM65c02Frame*/, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 224, 384, 3, 4 -}; - - -// Arbalester - -static struct BurnRomInfo arbalestRomDesc[] = { - { "uk-001-003", 0x40000, 0xee878a2c, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "uk-001-004", 0x40000, 0x902bb4e3, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "uk6005", 0x04000, 0x48c73a4a, 0x02 | BRF_PRG | BRF_ESS }, // 2 M65c02 Code - - { "uk001.06", 0x40000, 0x11c75746, 0x0b | BRF_GRA }, // 3 Sprites - { "uk001.07", 0x40000, 0x01b166c7, 0x0b | BRF_GRA }, // 4 - { "uk001.08", 0x40000, 0x78d60ba3, 0x0b | BRF_GRA }, // 5 - { "uk001.09", 0x40000, 0xb4748ae0, 0x0b | BRF_GRA }, // 6 - - { "uk-001-010-t26", 0x80000, 0xc1e2f823, 0x04 | BRF_GRA }, // 7 Layer 1 tiles - { "uk-001-011-t27", 0x80000, 0x09dfe56a, 0x04 | BRF_GRA }, // 8 - { "uk-001-012-t28", 0x80000, 0x818a4085, 0x04 | BRF_GRA }, // 9 - { "uk-001-013-t29", 0x80000, 0x771fa164, 0x04 | BRF_GRA }, // 10 - - { "uk-001-015-t31", 0x80000, 0xce9df5dd, 0x06 | BRF_SND }, // 11 x1-010 Samples - { "uk-001-014-t30", 0x80000, 0x016b844a, 0x06 | BRF_SND }, // 12 -}; - -STD_ROM_PICK(arbalest) -STD_ROM_FN(arbalest) - -static INT32 arbalestInit() -{ - DrvSetVideoOffsets(0, 1, -2, -1); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(metafox68kInit, 8000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); -} - -struct BurnDriver BurnDrvArbalest = { - "arbalest", NULL, NULL, NULL, "1989", - "Arbalester\0", "Imperfect inputs", "Seta", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, arbalestRomInfo, arbalestRomName, NULL, NULL, MetafoxInputInfo, ArbalestDIPInfo, - arbalestInit, DrvExit, DrvFrame /*DrvM65c02Frame*/, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 224, 384, 3, 4 -}; - - -// Meta Fox - -static struct BurnRomInfo metafoxRomDesc[] = { - { "p1003161", 0x40000, 0x4fd6e6a1, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "p1004162", 0x40000, 0xb6356c9a, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "up001002", 0x10000, 0xce91c987, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "up001001", 0x10000, 0x0db7a505, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "up001005", 0x02000, 0x2ac5e3e3, 0x02 | BRF_PRG | BRF_ESS }, // 4 m65c02 Code - - { "p1006163", 0x40000, 0x80f69c7c, 0x0b | BRF_GRA }, // 5 Sprites - { "p1007164", 0x40000, 0xd137e1a3, 0x0b | BRF_GRA }, // 6 - { "p1008165", 0x40000, 0x57494f2b, 0x0b | BRF_GRA }, // 7 - { "p1009166", 0x40000, 0x8344afd2, 0x0b | BRF_GRA }, // 8 - - { "up001010", 0x80000, 0xbfbab472, 0x04 | BRF_GRA }, // 9 Layer 1 tiles - { "up001011", 0x80000, 0x26cea381, 0x04 | BRF_GRA }, // 10 - { "up001012", 0x80000, 0xfed2c5f9, 0x04 | BRF_GRA }, // 11 - { "up001013", 0x80000, 0xadabf9ea, 0x04 | BRF_GRA }, // 12 - - { "up001015", 0x80000, 0x2e20e39f, 0x06 | BRF_SND }, // 13 x1-010 Samples - { "up001014", 0x80000, 0xfca6315e, 0x06 | BRF_SND }, // 14 -}; - -STD_ROM_PICK(metafox) -STD_ROM_FN(metafox) - -static INT32 metafoxInit() -{ - DrvSetVideoOffsets(0, 0, 16, -19); - DrvSetColorOffsets(0, 0, 0); - - INT32 nRet = DrvInit(metafox68kInit, 8000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); - - if (nRet == 0) { - *((UINT16*)(Drv68KROM + 0x8ab1c)) = 0x4e71; - *((UINT16*)(Drv68KROM + 0x8ab1e)) = 0x4e71; - *((UINT16*)(Drv68KROM + 0x8ab20)) = 0x4e71; - } - - return nRet; -} - -struct BurnDriver BurnDrvMetafox = { - "metafox", NULL, NULL, NULL, "1989", - "Meta Fox\0", "Imperfect inputs", "Seta", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, metafoxRomInfo, metafoxRomName, NULL, NULL, MetafoxInputInfo, MetafoxDIPInfo, - metafoxInit, DrvExit, DrvFrame /*DrvM65c02Frame*/, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 224, 384, 3, 4 -}; - - -// Pro Mahjong Kiwame - -static struct BurnRomInfo kiwameRomDesc[] = { - { "fp001001.bin", 0x40000, 0x31b17e39, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "fp001002.bin", 0x40000, 0x5a6e2efb, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "fp001003.bin", 0x80000, 0x0f904421, 0x03 | BRF_GRA }, // 2 Sprites - - { "fp001006.bin", 0x80000, 0x96cf395d, 0x06 | BRF_SND }, // 3 x1-010 Samples - { "fp001005.bin", 0x80000, 0x65b5fe9a, 0x06 | BRF_SND }, // 4 -}; - -STD_ROM_PICK(kiwame) -STD_ROM_FN(kiwame) - -static INT32 kiwameInit() -{ - DrvSetVideoOffsets(0, -16, 0, 0); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(kiwame68kInit, 16000000, SET_IRQLINES(1, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); -} - -struct BurnDriverD BurnDrvKiwame = { - "kiwame", NULL, NULL, NULL, "1994", - "Pro Mahjong Kiwame\0", NULL, "Athena", "Seta", - NULL, NULL, NULL, NULL, - 0, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, kiwameRomInfo, kiwameRomName, NULL, NULL, KiwameInputInfo, KiwameDIPInfo, - kiwameInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, - 448, 240, 4, 3 -}; - - -// Twin Eagle - Revenge Joe's Brother - -static struct BurnRomInfo twineaglRomDesc[] = { - { "ua2-1", 0x80000, 0x5c3fe531, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - - { "ua2-2", 0x02000, 0x783ca84e, 0x02 | BRF_PRG | BRF_ESS }, // 1 M65c02 Code - - { "ua2-4", 0x40000, 0x8b7532d6, 0x0b | BRF_GRA }, // 2 Sprites - { "ua2-3", 0x40000, 0x1124417a, 0x0b | BRF_GRA }, // 3 - { "ua2-6", 0x40000, 0x99d8dbba, 0x0b | BRF_GRA }, // 4 - { "ua2-5", 0x40000, 0x6e450d28, 0x0b | BRF_GRA }, // 5 - - { "ua2-8", 0x80000, 0x7d3a8d73, 0x04 | BRF_GRA }, // 6 Layer 1 tiles - { "ua2-10", 0x80000, 0x5bbe1f56, 0x04 | BRF_GRA }, // 7 - { "ua2-7", 0x80000, 0xfce56907, 0x04 | BRF_GRA }, // 8 - { "ua2-9", 0x80000, 0xa451eae9, 0x04 | BRF_GRA }, // 9 - - { "ua2-11", 0x80000, 0x624e6057, 0x06 | BRF_SND }, // 10 x1-010 Samples - { "ua2-12", 0x80000, 0x3068ff64, 0x06 | BRF_SND }, // 11 -}; - -STD_ROM_PICK(twineagl) -STD_ROM_FN(twineagl) - -static INT32 twineaglInit() -{ - twineagle = 1; - - DrvSetVideoOffsets(0, 0, 0, -3); - DrvSetColorOffsets(0, 0, 0); - - return DrvInit(twineagle68kInit, 8000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); -} - -struct BurnDriver BurnDrvTwineagl = { - "twineagl", NULL, NULL, NULL, "1988", - "Twin Eagle - Revenge Joe's Brother\0", "Imperfect inputs", "Seta (Taito license)", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, twineaglRomInfo, twineaglRomName, NULL, NULL, TwineaglInputInfo, TwineaglDIPInfo, - twineaglInit, DrvExit, DrvFrame /*DrvM65c02Frame*/, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 224, 384, 3, 4 -}; - - -// U.S. Classic - -static struct BurnRomInfo usclssicRomDesc[] = { - { "ue2001.u20", 0x20000, 0x18b41421, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ue2000.u14", 0x20000, 0x69454bc2, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ue2002.u22", 0x20000, 0xa7bbe248, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "ue2003.u30", 0x20000, 0x29601906, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "ue002u61.004", 0x40000, 0x476e9f60, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code - - { "ue001009.119", 0x80000, 0xdc065204, 0x0b | BRF_GRA }, // 5 Sprites - { "ue001008.118", 0x80000, 0x5947d9b5, 0x0b | BRF_GRA }, // 6 - { "ue001007.117", 0x80000, 0xb48a885c, 0x0b | BRF_GRA }, // 7 - { "ue001006.116", 0x80000, 0xa6ab6ef4, 0x0b | BRF_GRA }, // 8 - - { "ue001010.120", 0x80000, 0xdd683031, 0x04 | BRF_GRA }, // 9 Layer 1 tiles - { "ue001011.121", 0x80000, 0x0e27bc49, 0x04 | BRF_GRA }, // 10 - { "ue001012.122", 0x80000, 0x961dfcdc, 0x04 | BRF_GRA }, // 11 - { "ue001013.123", 0x80000, 0x03e9eb79, 0x04 | BRF_GRA }, // 12 - { "ue001014.124", 0x80000, 0x9576ace7, 0x04 | BRF_GRA }, // 13 - { "ue001015.125", 0x80000, 0x631d6eb1, 0x04 | BRF_GRA }, // 14 - { "ue001016.126", 0x80000, 0xf44a8686, 0x04 | BRF_GRA }, // 15 - { "ue001017.127", 0x80000, 0x7f568258, 0x04 | BRF_GRA }, // 16 - { "ue001018.128", 0x80000, 0x4bd98f23, 0x04 | BRF_GRA }, // 17 - { "ue001019.129", 0x80000, 0x6d9f5a33, 0x04 | BRF_GRA }, // 18 - { "ue001020.130", 0x80000, 0xbc07403f, 0x04 | BRF_GRA }, // 19 - { "ue001021.131", 0x80000, 0x98c03efd, 0x04 | BRF_GRA }, // 20 - - { "ue001005.132", 0x80000, 0xc5fea37c, 0x06 | BRF_SND }, // 21 x1-010 Samples - - { "ue1-023.prm", 0x00200, 0xa13192a4, 0x0f | BRF_GRA }, // 22 Color PROMs - { "ue1-022.prm", 0x00200, 0x1a23129e, 0x0f | BRF_GRA }, // 23 -}; - -STD_ROM_PICK(usclssic) -STD_ROM_FN(usclssic) - -static INT32 usclssicInit() -{ - watchdog_enable = 1; - DrvSetColorOffsets(0, 0x200, 0); - DrvSetVideoOffsets(1, 2, 0, -1); - - INT32 nRet = DrvInit(usclssic68kInit, 8000000, SET_IRQLINES(0x80, 0x80) /*custom*/, NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 4, -1)); - - if (nRet == 0) { - usclssicSetColorTable(); - } - - return nRet; -} - -struct BurnDriverD BurnDrvUsclssic = { - "usclssic", NULL, NULL, NULL, "1989", - "U.S. Classic\0", "No sound, imperfect inputs", "Seta", "Seta", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, usclssicRomInfo, usclssicRomName, NULL, NULL, UsclssicInputInfo, UsclssicDIPInfo, - usclssicInit, DrvExit, Drv5IRQFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0xa00, - 240, 384, 3, 4 -}; - - -// Caliber 50 - -static struct BurnRomInfo calibr50RomDesc[] = { - { "uh002001.u45", 0x40000, 0xeb92e7ed, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "uh002004.u41", 0x40000, 0x5a0ed31e, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "uh001003.9a", 0x10000, 0x0d30d09f, 0x01 | BRF_PRG | BRF_ESS }, // 2 - { "uh001002.7a", 0x10000, 0x7aecc3f9, 0x01 | BRF_PRG | BRF_ESS }, // 3 - - { "uh001005.u61", 0x40000, 0x4a54c085, 0x02 | BRF_PRG | BRF_ESS }, // 4 m65c02 Code - - { "uh001006.ux2", 0x80000, 0xfff52f91, 0x0b | BRF_GRA }, // 5 Sprites - { "uh001007.ux1", 0x80000, 0xb6c19f71, 0x0b | BRF_GRA }, // 6 - { "uh001008.ux6", 0x80000, 0x7aae07ef, 0x0b | BRF_GRA }, // 7 - { "uh001009.ux0", 0x80000, 0xf85da2c5, 0x0b | BRF_GRA }, // 8 - - { "uh001010.u3x", 0x80000, 0xf986577a, 0x04 | BRF_GRA }, // 9 Layer 1 tiles - { "uh001011.u50", 0x80000, 0x08620052, 0x04 | BRF_GRA }, // 10 - - { "uh001013.u60", 0x80000, 0x09ec0df6, 0x06 | BRF_SND }, // 11 x1-010 Samples - { "uh001012.u46", 0x80000, 0xbb996547, 0x06 | BRF_SND }, // 12 -}; - -STD_ROM_PICK(calibr50) -STD_ROM_FN(calibr50) - -static INT32 calibr50Init() -{ - refresh_rate = 5742; // 57.42 hz - watchdog_enable = 1; - DrvSetColorOffsets(0, 0, 0); - DrvSetVideoOffsets(-1, 2, -3, -2); - - INT32 nRet = DrvInit(calibr5068kInit, 8000000, SET_IRQLINES(0x80, 0x80) /*custom*/, NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); - - x1010_set_all_routes(0.50, BURN_SND_ROUTE_LEFT); - - return nRet; -} - -struct BurnDriver BurnDrvCalibr50 = { - "calibr50", NULL, NULL, NULL, "1989", - "Caliber 50\0", "No sound, imperfect inputs", "Athena / Seta", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, calibr50RomInfo, calibr50RomName, NULL, NULL, Calibr50InputInfo, Calibr50DIPInfo, - calibr50Init, DrvExit, Drv5IRQFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 240, 384, 3, 4 -}; - - -// Crazy Fight - -static struct BurnRomInfo crazyfgtRomDesc[] = { - { "rom.u3", 0x40000, 0xbf333e75, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "rom.u4", 0x40000, 0x505e9d47, 0x01 | BRF_PRG | BRF_ESS }, // 1 - - { "rom.u228", 0x80000, 0x7181618e, 0x03 | BRF_GRA }, // 2 Sprites - { "rom.u227", 0x80000, 0x7905b5f2, 0x03 | BRF_GRA }, // 3 - { "rom.u226", 0x80000, 0xef210e34, 0x03 | BRF_GRA }, // 4 - { "rom.u225", 0x80000, 0x451b4419, 0x03 | BRF_GRA }, // 5 - - { "rom.u67", 0x40000, 0xec8c6831, 0x04 | BRF_GRA }, // 6 Layer 1 tiles - { "rom.u68", 0x80000, 0x2124312e, 0x04 | BRF_GRA }, // 7 - - { "rom.u65", 0x40000, 0x58448231, 0x05 | BRF_GRA }, // 8 Layer 2 tiles - { "rom.u66", 0x80000, 0xc6f7735b, 0x05 | BRF_GRA }, // 9 - - { "rom.u85", 0x40000, 0x7b95d0bb, 0x06 | BRF_SND }, // 10 OKI M6295 Samples -}; - -STD_ROM_PICK(crazyfgt) -STD_ROM_FN(crazyfgt) - -static INT32 crazyfgtInit() -{ - DrvSetColorOffsets(0, 0xa00, 0x200); - DrvSetVideoOffsets(6, 0, -4, 0); - - INT32 nRet = DrvInit(crazyfgt68kInit, 16000000, SET_IRQLINES(0x80, 0x80) /*custom*/, NO_SPRITE_BUFFER, SET_GFX_DECODE(5, 4, 4)); - - if (nRet == 0) { - gundharaSetColorTable(); - } - - return nRet; -} - -struct BurnDriver BurnDrvCrazyfgt = { - "crazyfgt", NULL, NULL, NULL, "1996", - "Crazy Fight\0", NULL, "Subsino", "Seta", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, crazyfgtRomInfo, crazyfgtRomName, NULL, NULL, CrazyfgtInputInfo, CrazyfgtDIPInfo, - crazyfgtInit, DrvExit, CrazyfgtFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, - 384, 224, 4, 3 -}; - - -//---------------------------------------------------------------------------------------------------------- -// should be moved into its own file - -static UINT8 msm6242_reg[3]; -static time_t msm6242_hold_time; - -UINT8 msm6242_read(UINT32 offset) -{ - tm *systime; - - if (msm6242_reg[0] & 1) { - systime = localtime(&msm6242_hold_time); - } else { - time_t curtime = time(NULL); - systime = localtime(&curtime); - } - - switch (offset) - { - case 0x00: return systime->tm_sec % 10; - case 0x01: return systime->tm_sec / 10; - case 0x02: return systime->tm_min % 10; - case 0x03: return systime->tm_min / 10; - case 0x04: - case 0x05: - { - INT32 hour = systime->tm_hour, pm = 0; - - if ((msm6242_reg[2] & 0x04) == 0) // 12 hour mode? - { - if (hour >= 12) pm = 1; - hour %= 12; - if (hour == 0) hour = 12; - } - - if (offset == 0x04) return hour % 10; - - return (hour / 10) | (pm <<2); - } - - case 0x06: return systime->tm_mday % 10; - case 0x07: return systime->tm_mday / 10; - case 0x08: return (systime->tm_mon+1) % 10; - case 0x09: return (systime->tm_mon+1) / 10; - case 0x0a: return systime->tm_year % 10; - case 0x0b: return (systime->tm_year % 100) / 10; - case 0x0c: return systime->tm_wday; - case 0x0d: return msm6242_reg[0]; - case 0x0e: return msm6242_reg[1]; - case 0x0f: return msm6242_reg[2]; - } - - return 0; -} - -void msm6242_write(UINT32 offset, UINT8 data) -{ - if (offset == 0x0d) { - msm6242_reg[0] = data & 0x0f; - if (data & 1) msm6242_hold_time = time(NULL); - } else if (offset == 0x0e) { - msm6242_reg[1] = data & 0x0f; - } else if (offset == 0x0f) { - if ((data ^ msm6242_reg[2]) & 0x04) { - msm6242_reg[2] = (msm6242_reg[2] & 0x04) | (data & ~0x04); - - if (msm6242_reg[2] & 1) msm6242_reg[2] = (msm6242_reg[2] & ~0x04) | (data & 0x04); - } else { - msm6242_reg[2] = data & 0x0f; - } - } -} - -void msm6242_reset() -{ - memset (msm6242_reg, 0, 3); - msm6242_hold_time = time(NULL); -} - -//-------------------------------------------------------------------------------------------------------------------- - -static UINT16 jockeyc_dsw_read(INT32 offset) -{ - INT32 dip2 = DrvDips[1] | (DrvDips[2] << 8); - INT32 shift = offset << 2; - - return ((((DrvDips[0] >> shift) & 0xf)) << 0) | ((((dip2 >> shift) & 0xf)) << 4) | ((((dip2 >> (shift+8)) & 0xf)) << 8); -} - -UINT16 __fastcall jockeyc_read_word(UINT32 address) -{ - switch (address) - { - case 0x200000: - case 0x200001: { - INT32 i; - for (i = 3; i < 8; i++) { - if (usclssic_port_select & (1 << i)) return DrvInputs[(i - 3) + 2]; - } - return 0xffff; - } - - case 0x200002: - case 0x200003: - return DrvInputs[0]; - - case 0x200010: - case 0x200011: - return DrvInputs[1] & 0x7fff; - - case 0x500000: - case 0x500001: - case 0x500002: - case 0x500003: - return jockeyc_dsw_read(address & 2); - - case 0x600000: - case 0x600001: - case 0x600002: - case 0x600003: - return ~0; - } - - if ((address & 0xfffffe0) == 0x800000) { - return msm6242_read((address & 0x1e) / 2); - } - - return 0; -} - -UINT8 __fastcall jockeyc_read_byte(UINT32 address) -{ - switch (address) - { - case 0x200000: - case 0x200001: { - INT32 i; - for (i = 3; i < 8; i++) { - if (usclssic_port_select & (1 << i)) return DrvInputs[(i - 3) + 2]; - } - return 0xff; - } - - case 0x200002: - return DrvInputs[0] >> 8; - - case 0x200003: - return DrvInputs[0]; - - case 0x200010: - return (DrvInputs[1] >> 8) & 0x7f; - - case 0x200011: - return DrvInputs[1]; - - case 0x500000: - case 0x500001: - case 0x500002: - case 0x500003: - return jockeyc_dsw_read(address & 2); - - case 0x600000: - case 0x600001: - case 0x600002: - case 0x600003: - return ~0; - } - - if ((address & 0xfffffe0) == 0x800000) { - return msm6242_read((address & 0x1e) / 2); - } - - return 0; -} - -void __fastcall jockeyc_write_word(UINT32 address, UINT16 data) -{ - SetaVidRAMCtrlWriteWord(0, 0xa00000) - - switch (address) - { - case 0x200000: - case 0x200001: - usclssic_port_select = data & 0xf8; - return; - - case 0x300000: - case 0x300001: - watchdog = 0; - return; - } - - if ((address & 0xfffffe0) == 0x800000) { - msm6242_write((address & 0x1e) / 2, data); - return; - } -} - -void __fastcall jockeyc_write_byte(UINT32 address, UINT8 data) -{ - SetaVidRAMCtrlWriteByte(0, 0xa00000) - - switch (address) - { - case 0x200000: - case 0x200001: - usclssic_port_select = data & 0xf8; - return; - - case 0x300000: - case 0x300001: - watchdog = 0; - return; - } - - if ((address & 0xfffffe0) == 0x800000) { - msm6242_write((address & 0x1e) / 2, data); - return; - - } -} - -static void jockeyc68kInit() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(DrvVidRAM0, 0xb00000, 0xb07fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xffc000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, jockeyc_write_word); - SekSetWriteByteHandler(0, jockeyc_write_byte); - SekSetReadWordHandler(0, jockeyc_read_word); - SekSetReadByteHandler(0, jockeyc_read_byte); - - SekMapHandler(1, 0x900000, 0x903fff, SM_READ | SM_WRITE); - SekSetReadWordHandler (1, setaSoundRegReadWord); - SekSetReadByteHandler (1, setaSoundRegReadByte); - SekSetWriteWordHandler(1, setaSoundRegWriteWord); - SekSetWriteByteHandler(1, setaSoundRegWriteByte); - SekClose(); - - memcpy (Drv68KROM + 0x100000, Drv68KROM + 0x020000, 0x080000); - memset (Drv68KROM + 0x020000, 0xff, 0x60000); - memset (Drv68KROM + 0x180000, 0xff, 0x80000); - - memmove (DrvGfxROM1 + 0x60000, DrvGfxROM1 + 0x40000, 0x40000); - memset (DrvGfxROM1 + 0x40000, 0, 0x20000); - memset (DrvGfxROM1 + 0xa0000, 0, 0x20000); - - DrvROMLen[4] = 1; // force use of pal ram - - msm6242_reset(); -} - -static INT32 jockeycInit() -{ - watchdog_enable = 1; - DrvSetColorOffsets(0, 0, 0); - DrvSetVideoOffsets(0, 0, 0, 0); - - return DrvInit(jockeyc68kInit, 16000000, SET_IRQLINES(0x80, 0x80) /*custom*/, NO_SPRITE_BUFFER, SET_GFX_DECODE(5, 1, -1)); -} - -static void jockeycFrameCallback() -{ - DrvInputs[0] ^= 0xffff; - DrvInputs[0] ^= DrvDips[3] | (DrvDips[4] << 8); - DrvInputs[1] ^= 0xffff; - DrvInputs[1] ^= DrvDips[5] | (DrvDips[6] << 8); - - INT32 nInterleave = 10; - INT32 nCyclesTotal[1] = { cpuspeed / 60 }; - INT32 nCyclesDone[1] = { 0 }; - - INT32 irqs[10] = { 4, 1, 2, 6, 6, 6, 6, 6, 6, 6 }; - - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); - - SekSetIRQLine(irqs[9-i], SEK_IRQSTATUS_AUTO); // ? - } - - SekClose(); - - if (pBurnSoundOut) { - x1010_sound_update(); - } -} - -static INT32 jockeycFrame() -{ - return DrvCommonFrame(jockeycFrameCallback); -} - - -// Jockey Club - -static struct BurnRomInfo jockeycRomDesc[] = { - { "ya-007-002-u23.bin", 0x10000, 0xc499bf4d, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "ya-007-003-u33.bin", 0x10000, 0xe7b0677e, 0x01 | BRF_PRG | BRF_ESS }, // 1 - { "ya_002_001.u18", 0x80000, 0xdd108016, 0x01 | BRF_PRG | BRF_ESS }, // 2 - - { "ya_011_004.u10", 0x80000, 0xeb74d2e0, 0x03 | BRF_GRA }, // 3 Sprites - { "ya_011_005.u17", 0x80000, 0x4a6c804b, 0x03 | BRF_GRA }, // 4 - { "ya_011_006.u22", 0x80000, 0xbfae01a5, 0x03 | BRF_GRA }, // 5 - { "ya_011_007.u27", 0x80000, 0x2dc7a294, 0x03 | BRF_GRA }, // 6 - - { "ya_011_008.u35", 0x40000, 0x4b890f83, 0x04 | BRF_GRA }, // 7 Layer 1 tiles - { "ya_011_009.u41", 0x40000, 0xcaa5e3c1, 0x04 | BRF_GRA }, // 8 -// double this so that we can use the graphics decoding routines... - { "ya_011_009.u41", 0x40000, 0xcaa5e3c1, 0x04 | BRF_GRA }, // 9 - - { "ya_011_013.u71", 0x80000, 0x2bccaf47, 0x06 | BRF_SND }, // 10 x1snd - { "ya_011_012.u64", 0x80000, 0xa8015ce6, 0x06 | BRF_SND }, // 11 - - { "ya-011.prom", 0x00200, 0xbd4fe2f6, 0x0f | BRF_GRA }, // 13 - { "ya-010.prom", 0x00200, 0x778094b3, 0x0f | BRF_GRA }, // 12 Color PROMs -}; - -STD_ROM_PICK(jockeyc) -STD_ROM_FN(jockeyc) - -struct BurnDriverD BurnDrvJockeyc = { - "jockeyc", NULL, NULL, NULL, "1990", - "Jockey Club\0", NULL, "[Seta] (Visco license)", "Seta", - NULL, NULL, NULL, NULL, - 0, 2, HARDWARE_SETA1, GBF_MISC, 0, - NULL, jockeycRomInfo, jockeycRomName, NULL, NULL, JockeycInputInfo, JockeycDIPInfo, - jockeycInit, DrvExit, jockeycFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, - 384, 240, 4, 3 -}; +// FB Alpha Seta driver module +// Based on MAME driver by Luca Elia + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2612.h" +#include "burn_ym3812.h" +#include "burn_gun.h" +#include "msm6295.h" +#include "x1010.h" + +/* + To do: + further simulate m65c02 games + calibr50, usclassc, krazybowl, downtown need analog inputs hooked up... + flipscreen support + jockeyc needs work... +*/ + +#define NOIRQ2 0x80 +#define SET_IRQLINES(vblank, irq2) (((vblank) << 8) | (irq2)) +#define SPRITE_BUFFER 1 +#define NO_SPRITE_BUFFER 0 +#define SET_GFX_DECODE(n0, n1, n2) n0, n1, n2 + +static UINT8 *AllMem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *AllRam = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Drv68KROM = NULL; +static UINT8 *DrvSubROM = NULL; +static UINT8 *DrvGfxROM0 = NULL; +static UINT8 *DrvGfxROM1 = NULL; +static UINT8 *DrvGfxROM2 = NULL; +static UINT8 *DrvColPROM = NULL; +static UINT8 *DrvSndROM = NULL; +static UINT8 *Drv68KRAM = NULL; +static UINT8 *Drv68KRAM2 = NULL; +static UINT8 *DrvSubRAM = NULL; +static UINT8 *DrvShareRAM = NULL; +static UINT8 *DrvNVRAM = NULL; +static UINT8 *DrvPalRAM = NULL; +static UINT8 *DrvSprRAM0 = NULL; +static UINT8 *DrvSprRAM1 = NULL; +static UINT8 *DrvVidRAM0 = NULL; +static UINT8 *DrvVidRAM1 = NULL; +static UINT8 *DrvVIDCTRLRAM0 = NULL; +static UINT8 *DrvVIDCTRLRAM1 = NULL; +static UINT8 *DrvVideoRegs = NULL; + +static UINT32 *Palette = NULL; +static UINT32 *DrvPalette = NULL; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch = NULL; +static UINT8 *tilebank = NULL; +static UINT32 *tile_offset = NULL; + +static INT32 cpuspeed = 0; +static INT32 irqtype = 0; +static INT32 buffer_sprites = 0; +static INT32 DrvROMLen[5] = { 0, 0, 0, 0, 0 }; +static INT32 DrvGfxMask[3] = { 0, 0, 0 }; +static UINT8 *DrvGfxTransMask[3] = { NULL, NULL, NULL }; +static INT32 VideoOffsets[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } }; +static INT32 ColorOffsets[3] = { 0, 0, 0 }; +static INT32 ColorDepths[3]; +static INT32 twineagle = 0; +static INT32 oisipuzl_hack = 0; +static INT32 refresh_rate = 6000; + +static INT32 seta_samples_bank = 0; +static INT32 usclssic_port_select = 0; +static INT32 tndrcade_init_sim = 0; +static INT32 gun_input_bit = 0; +static INT32 gun_input_src = 0; + +static INT32 watchdog_enable = 0; +static INT32 watchdog = 0; +static INT32 flipscreen; + +static INT32 DrvAxis[4]; +static UINT16 DrvAnalogInput[4]; +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvJoy4[16]; +static UINT8 DrvJoy5[16]; +static UINT8 DrvJoy6[16]; +static UINT8 DrvJoy7[16]; +static UINT8 DrvDips[7]; +static UINT16 DrvInputs[7]; +static UINT8 DrvReset; + +#define A(a, b, c, d) { a, b, (UINT8*)(c), d } + +static struct BurnInputInfo QzkklogyInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 4" }, + {"P1 Button 5", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 5" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 4" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Qzkklogy) + +static struct BurnInputInfo DrgnunitInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Drgnunit) + +static struct BurnInputInfo StgInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Stg) + +static struct BurnInputInfo Qzkklgy2InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 4" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 4" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Qzkklgy2) + +static struct BurnInputInfo DaiohInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvJoy4 + 0, "p1 fire 4" }, + {"P1 Button 5", BIT_DIGITAL, DrvJoy4 + 1, "p1 fire 5" }, + {"P1 Button 6", BIT_DIGITAL, DrvJoy4 + 2, "p1 fire 6" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, DrvJoy4 + 3, "p2 fire 4" }, + {"P2 Button 5", BIT_DIGITAL, DrvJoy4 + 4, "p2 fire 5" }, + {"P2 Button 6", BIT_DIGITAL, DrvJoy4 + 5, "p2 fire 6" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Daioh) + +static struct BurnInputInfo RezonInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Rezon) + +static struct BurnInputInfo EightfrcInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Eightfrc) + +static struct BurnInputInfo WrofaeroInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Wrofaero) + +static struct BurnInputInfo ZingzipInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Zingzip) + +static struct BurnInputInfo MsgundamInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Msgundam) + +static struct BurnInputInfo KamenridInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Kamenrid) + +static struct BurnInputInfo MadsharkInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Madshark) + +static struct BurnInputInfo WitsInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"P3 Start", BIT_DIGITAL, DrvJoy4 + 7, "p3 start" }, + {"P3 Up", BIT_DIGITAL, DrvJoy4 + 2, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy4 + 3, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy4 + 0, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy4 + 1, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p3 fire 2" }, + + {"P4 Start", BIT_DIGITAL, DrvJoy5 + 7, "p4 start" }, + {"P4 Up", BIT_DIGITAL, DrvJoy5 + 2, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvJoy5 + 3, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvJoy5 + 0, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvJoy5 + 1, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy5 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy5 + 5, "p4 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Wits) + +static struct BurnInputInfo ThunderlInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Thunderl) + +static struct BurnInputInfo AtehateInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 4" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 4" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Atehate) + +static struct BurnInputInfo BlockcarInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Blockcar) + +static struct BurnInputInfo GundharaInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Gundhara) + +static struct BurnInputInfo BlandiaInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Blandia) + +static struct BurnInputInfo OisipuzlInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 3, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Oisipuzl) + +static struct BurnInputInfo PairloveInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Pairlove) + +static struct BurnInputInfo OrbsInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Orbs) + +static struct BurnInputInfo KeroppiInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Keroppi) + +static struct BurnInputInfo JjsquawkInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Jjsquawk) + +static struct BurnInputInfo ExtdwnhlInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Extdwnhl) + +static struct BurnInputInfo KrzybowlInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + // space holders for analog inputs + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 8, "p1 fire 4" }, + {"P1 Button 5", BIT_DIGITAL, DrvJoy1 + 9, "p1 fire 5" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + // space holders for analog inputs + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 8, "p2 fire 4" }, + {"P2 Button 5", BIT_DIGITAL, DrvJoy2 + 9, "p2 fire 5" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Krzybowl) + +static struct BurnInputInfo UtoukondInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Utoukond) + +static struct BurnInputInfo TndrcadeInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 5, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Tndrcade) + +static struct BurnInputInfo DowntownInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, +// fake to make space for analog + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 9, "p1 fire 4" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 6, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, +// fake to make space for analog + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 9, "p2 fire 4" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 5, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 4, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Downtown) + +static struct BurnInputInfo MetafoxInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 6, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 5, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 4, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Metafox) + +static struct BurnInputInfo ZombraidInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "mouse button 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "mouse button 2" }, + A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "mouse x-axis"), + A("P1 Up / Down", BIT_ANALOG_REL, DrvAxis + 1, "mouse y-axis"), + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 2, "p2 x-axis"), + A("P2 Up / Down", BIT_ANALOG_REL, DrvAxis + 3, "p2 y-axis"), + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Zombraid) + +static struct BurnInputInfo KiwameInputList[] = { + {"Coin 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"Coin 2", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"Start", BIT_DIGITAL, DrvJoy4 + 5, "p1 start" }, + {"A", BIT_DIGITAL, DrvJoy4 + 0, "mah a" }, + {"B", BIT_DIGITAL, DrvJoy3 + 0, "mah b" }, + {"C", BIT_DIGITAL, DrvJoy5 + 0, "mah c" }, + {"D", BIT_DIGITAL, DrvJoy6 + 0, "mah d" }, + {"E", BIT_DIGITAL, DrvJoy4 + 1, "mah e" }, + {"F", BIT_DIGITAL, DrvJoy2 + 3, "mah f" }, + {"G", BIT_DIGITAL, DrvJoy5 + 1, "mah g" }, + {"H", BIT_DIGITAL, DrvJoy6 + 1, "mah h" }, + {"I", BIT_DIGITAL, DrvJoy4 + 2, "mah i" }, + {"J", BIT_DIGITAL, DrvJoy3 + 2, "mah j" }, + {"K", BIT_DIGITAL, DrvJoy4 + 4, "mah k" }, + {"L", BIT_DIGITAL, DrvJoy2 + 0, "mah l" }, + {"M", BIT_DIGITAL, DrvJoy4 + 3, "mah m" }, + {"N", BIT_DIGITAL, DrvJoy3 + 3, "mah n" }, + {"Pon", BIT_DIGITAL, DrvJoy6 + 3, "mah pon" }, + {"Chi", BIT_DIGITAL, DrvJoy5 + 3, "mah chi" }, + {"Kan", BIT_DIGITAL, DrvJoy4 + 4, "mah kan" }, + {"Ron", BIT_DIGITAL, DrvJoy5 + 4, "mah ron" }, + {"Reach", BIT_DIGITAL, DrvJoy3 + 4, "mah reach" }, + {"Flip Flip", BIT_DIGITAL, DrvJoy2 + 3, "mah ff" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Kiwame) + +static struct BurnInputInfo SokonukeInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Sokonuke) + +static struct BurnInputInfo NeobattlInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Neobattl) + +static struct BurnInputInfo UmanclubInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 3, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Umanclub) + +static struct BurnInputInfo TwineaglInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 4, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 5, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Twineagl) + +static struct BurnInputInfo CrazyfgtInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 top-center", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, + {"P1 bottom-center", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, + {"P1 top-left", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 3" }, + {"P1 bottom-left", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 4" }, + {"P1 top-right", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 5" }, + {"P1 bottom-right", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 6" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 7, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Crazyfgt) + +static struct BurnInputInfo Calibr50InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, +// fake to make space for analog inputs... + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 6, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, +// fake to make space for analog inputs... + + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 5, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 4, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Calibr50) + +static struct BurnInputInfo UsclssicInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 14, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy3 + 13, "p1 fire 1" }, +// space holder for analog inputs + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy3 + 0, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy5 + 14, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy5 + 13, "p2 fire 1" }, +// space holder for analog inputs + {"P2 Button 2", BIT_DIGITAL, DrvJoy4 + 0, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy5 + 0, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 7, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Usclssic) + +static struct BurnInputInfo JockeycInputList[] = { + {"P1 A Coin", BIT_DIGITAL, DrvJoy1 + 5, "p1 coin" }, + {"P1 B Coin", BIT_DIGITAL, DrvJoy1 + 4, "p3 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy4 + 3, "p1 start" }, + {"P1 Bet 1", BIT_DIGITAL, DrvJoy3 + 0, "p1 bet 1" }, + {"P1 Bet 2", BIT_DIGITAL, DrvJoy3 + 1, "p1 bet 2" }, + {"P1 Bet 3", BIT_DIGITAL, DrvJoy3 + 2, "p1 bet 3" }, + {"P1 Bet 4", BIT_DIGITAL, DrvJoy3 + 3, "p1 bet 4" }, + {"P1 Bet 5", BIT_DIGITAL, DrvJoy3 + 4, "p1 bet 5" }, + {"P1 Bet 6", BIT_DIGITAL, DrvJoy4 + 0, "p1 bet 6" }, + {"P1 Bet 1-2", BIT_DIGITAL, DrvJoy5 + 0, "p1 bet 1-2" }, + {"P1 Bet 1-3", BIT_DIGITAL, DrvJoy5 + 1, "p1 bet 1-3" }, + {"P1 Bet 1-4", BIT_DIGITAL, DrvJoy5 + 2, "p1 bet 1-4" }, + {"P1 Bet 1-5", BIT_DIGITAL, DrvJoy5 + 3, "p1 bet 1-5" }, + {"P1 Bet 1-6", BIT_DIGITAL, DrvJoy5 + 4, "p1 bet 1-6" }, + {"P1 Bet 2-3", BIT_DIGITAL, DrvJoy6 + 0, "p1 bet 2-3" }, + {"P1 Bet 2-4", BIT_DIGITAL, DrvJoy6 + 1, "p1 bet 2-4" }, + {"P1 Bet 2-5", BIT_DIGITAL, DrvJoy6 + 2, "p1 bet 2-5" }, + {"P1 Bet 2-6", BIT_DIGITAL, DrvJoy6 + 3, "p1 bet 2-6" }, + {"P1 Bet 3-4", BIT_DIGITAL, DrvJoy6 + 4, "p1 bet 3-4" }, + {"P1 Bet 3-5", BIT_DIGITAL, DrvJoy7 + 0, "p1 bet 3-5" }, + {"P1 Bet 3-6", BIT_DIGITAL, DrvJoy7 + 1, "p1 bet 3-6" }, + {"P1 Bet 4-5", BIT_DIGITAL, DrvJoy7 + 2, "p1 bet 4-5" }, + {"P1 Bet 4-6", BIT_DIGITAL, DrvJoy7 + 3, "p1 bet 4-6" }, + {"P1 Bet 5-6", BIT_DIGITAL, DrvJoy7 + 4, "p1 bet 5-6" }, + {"P1 Collect", BIT_DIGITAL, DrvJoy4 + 1, "p1 collect" }, + {"P1 Credit", BIT_DIGITAL, DrvJoy4 + 2, "p1 credit" }, + {"P1 Cancel", BIT_DIGITAL, DrvJoy4 + 4, "p1 cancel" }, + + {"P2 A Coin", BIT_DIGITAL, DrvJoy1 + 13, "p2 coin" }, + {"P2 B Coin", BIT_DIGITAL, DrvJoy1 + 12, "p4 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy4 + 11, "p2 start" }, + {"P2 Bet 1", BIT_DIGITAL, DrvJoy3 + 8, "p2 bet 1" }, + {"P2 Bet 2", BIT_DIGITAL, DrvJoy3 + 9, "p2 bet 2" }, + {"P2 Bet 3", BIT_DIGITAL, DrvJoy3 + 10, "p2 bet 3" }, + {"P2 Bet 4", BIT_DIGITAL, DrvJoy3 + 11, "p2 bet 4" }, + {"P2 Bet 5", BIT_DIGITAL, DrvJoy3 + 12, "p2 bet 5" }, + {"P2 Bet 6", BIT_DIGITAL, DrvJoy4 + 8, "p2 bet 6" }, + {"P2 Bet 1-2", BIT_DIGITAL, DrvJoy5 + 8, "p2 bet 1-2" }, + {"P2 Bet 1-3", BIT_DIGITAL, DrvJoy5 + 9, "p2 bet 1-3" }, + {"P2 Bet 1-4", BIT_DIGITAL, DrvJoy5 + 10, "p2 bet 1-4" }, + {"P2 Bet 1-5", BIT_DIGITAL, DrvJoy5 + 11, "p2 bet 1-5" }, + {"P2 Bet 1-6", BIT_DIGITAL, DrvJoy5 + 12, "p2 bet 1-6" }, + {"P2 Bet 2-3", BIT_DIGITAL, DrvJoy6 + 8, "p2 bet 2-3" }, + {"P2 Bet 2-4", BIT_DIGITAL, DrvJoy6 + 9, "p2 bet 2-4" }, + {"P2 Bet 2-5", BIT_DIGITAL, DrvJoy6 + 10, "p2 bet 2-5" }, + {"P2 Bet 2-6", BIT_DIGITAL, DrvJoy6 + 11, "p2 bet 2-6" }, + {"P2 Bet 3-4", BIT_DIGITAL, DrvJoy6 + 12, "p2 bet 3-4" }, + {"P2 Bet 3-5", BIT_DIGITAL, DrvJoy7 + 8, "p2 bet 3-5" }, + {"P2 Bet 3-6", BIT_DIGITAL, DrvJoy7 + 9, "p2 bet 3-6" }, + {"P2 Bet 4-5", BIT_DIGITAL, DrvJoy7 + 10, "p2 bet 4-5" }, + {"P2 Bet 4-6", BIT_DIGITAL, DrvJoy7 + 11, "p2 bet 4-6" }, + {"P2 Bet 5-6", BIT_DIGITAL, DrvJoy7 + 12, "p2 bet 5-6" }, + {"P2 Collect", BIT_DIGITAL, DrvJoy4 + 9, "p2 collect" }, + {"P2 Credit", BIT_DIGITAL, DrvJoy4 + 10, "p2 credit" }, + {"P2 Cancel", BIT_DIGITAL, DrvJoy4 + 12, "p2 cancel" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 14, "service" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 0, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, + {"Dip D", BIT_DIPSWITCH, DrvDips + 3, "dip" }, + {"Dip E", BIT_DIPSWITCH, DrvDips + 4, "dip" }, + {"Dip F", BIT_DIPSWITCH, DrvDips + 5, "dip" }, + {"Dip 10", BIT_DIPSWITCH, DrvDips + 6, "dip" }, +}; + +STDINPUTINFO(Jockeyc) + +#undef A + +static struct BurnDIPInfo CrazyfgtDIPList[]= +{ + {0x09, 0xff, 0xff, 0x3f, NULL }, + {0x0a, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x09, 0x01, 0x07, 0x00, "4 Coins 1 Credits" }, + {0x09, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, + {0x09, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, + {0x09, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x09, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x09, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x09, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x09, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x09, 0x01, 0x38, 0x00, "4 Coins 1 Credits" }, + {0x09, 0x01, 0x38, 0x08, "3 Coins 1 Credits" }, + {0x09, 0x01, 0x38, 0x10, "2 Coins 1 Credits" }, + {0x09, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x09, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x09, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x09, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, + {0x09, 0x01, 0x38, 0x18, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 4, "Unknown" }, + {0x09, 0x01, 0xc0, 0xc0, "5" }, + {0x09, 0x01, 0xc0, 0x80, "10" }, + {0x09, 0x01, 0xc0, 0x40, "15" }, + {0x09, 0x01, 0xc0, 0x00, "20" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0a, 0x01, 0x01, 0x01, "Off" }, + {0x0a, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty?" }, + {0x0a, 0x01, 0x0c, 0x0c, "0" }, + {0x0a, 0x01, 0x0c, 0x08, "1" }, + {0x0a, 0x01, 0x0c, 0x04, "2" }, + {0x0a, 0x01, 0x0c, 0x00, "3" }, + + {0 , 0xfe, 0 , 4, "Energy" }, + {0x0a, 0x01, 0x30, 0x10, "24" }, + {0x0a, 0x01, 0x30, 0x20, "32" }, + {0x0a, 0x01, 0x30, 0x30, "48" }, + {0x0a, 0x01, 0x30, 0x00, "100" }, + + {0 , 0xfe, 0 , 4, "Bonus?" }, + {0x0a, 0x01, 0xc0, 0xc0, "0" }, + {0x0a, 0x01, 0xc0, 0x80, "1" }, + {0x0a, 0x01, 0xc0, 0x40, "2" }, + {0x0a, 0x01, 0xc0, 0x00, "3" }, +}; + +STDDIPINFO(Crazyfgt) + + +static struct BurnDIPInfo UsclssicDIPList[]= +{ + {0x0d, 0xff, 0xff, 0xff, NULL }, + {0x0e, 0xff, 0xff, 0xfe, NULL }, + + {0 , 0xfe, 0 , 2, "Credits For 9-Hole" }, + {0x0d, 0x01, 0x01, 0x01, "2" }, + {0x0d, 0x01, 0x01, 0x00, "3" }, + + {0 , 0xfe, 0 , 2, "Game Type" }, + {0x0d, 0x01, 0x02, 0x02, "Domestic" }, + {0x0d, 0x01, 0x02, 0x00, "Foreign" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x0d, 0x01, 0x0c, 0x04, "1" }, + {0x0d, 0x01, 0x0c, 0x08, "2" }, + {0x0d, 0x01, 0x0c, 0x0c, "3" }, + {0x0d, 0x01, 0x0c, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x0d, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x0d, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0d, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x0d, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x0e, 0x01, 0x01, 0x00, "Upright" }, + {0x0e, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x0e, 0x01, 0x02, 0x02, "Off" }, + {0x0e, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0e, 0x01, 0x04, 0x04, "Off" }, + {0x0e, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Flight Distance" }, + {0x0e, 0x01, 0x38, 0x38, "Normal" }, + {0x0e, 0x01, 0x38, 0x30, "-30 Yards" }, + {0x0e, 0x01, 0x38, 0x28, "+10 Yards" }, + {0x0e, 0x01, 0x38, 0x20, "+20 Yards" }, + {0x0e, 0x01, 0x38, 0x18, "+30 Yards" }, + {0x0e, 0x01, 0x38, 0x10, "+40 Yards" }, + {0x0e, 0x01, 0x38, 0x08, "+50 Yards" }, + {0x0e, 0x01, 0x38, 0x00, "+60 Yards" }, + + {0 , 0xfe, 0 , 4, "Licensed To" }, + {0x0e, 0x01, 0xc0, 0xc0, "Romstar" }, + {0x0e, 0x01, 0xc0, 0x80, "None (Japan)" }, + {0x0e, 0x01, 0xc0, 0x40, "Taito" }, + {0x0e, 0x01, 0xc0, 0x00, "Taito America" }, +}; + +STDDIPINFO(Usclssic) + + +static struct BurnDIPInfo Calibr50DIPList[]= +{ + {0x15, 0xff, 0xff, 0xfe, NULL }, + {0x16, 0xff, 0xff, 0xfd, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Licensed To" }, + {0x15, 0x01, 0x01, 0x01, "Romstar" }, + {0x15, 0x01, 0x01, 0x00, "None (Japan)" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x15, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x15, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x03, 0x03, "Easiest" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x01, "Normal" }, + {0x16, 0x01, 0x03, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2, "Score Digits" }, + {0x16, 0x01, 0x04, 0x04, "7" }, + {0x16, 0x01, 0x04, 0x00, "3" }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x16, 0x01, 0x08, 0x08, "3" }, + {0x16, 0x01, 0x08, 0x00, "4" }, + + {0 , 0xfe, 0 , 2, "Display Score" }, + {0x16, 0x01, 0x10, 0x00, "Off" }, + {0x16, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2, "Erase Backup Ram" }, + {0x16, 0x01, 0x20, 0x00, "Off" }, + {0x16, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2, "Licensed To" }, + {0x16, 0x01, 0x40, 0x40, "Taito America" }, + {0x16, 0x01, 0x40, 0x40, "Taito" }, +}; + +STDDIPINFO(Calibr50) + +static struct BurnDIPInfo TwineaglDIPList[]= +{ + {0x13, 0xff, 0xff, 0xf7, NULL }, + {0x14, 0xff, 0xff, 0xf3, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Copyright" }, + {0x13, 0x01, 0x01, 0x01, "Taito" }, + {0x13, 0x01, 0x01, 0x00, "Taito America (Romstar license)" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x08, 0x00, "Upright" }, + {0x13, 0x01, 0x08, 0x08, "Cocktail" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x03, "Normal" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "Never" }, + {0x14, 0x01, 0x0c, 0x08, "500K Only" }, + {0x14, 0x01, 0x0c, 0x04, "1000K Only" }, + {0x14, 0x01, 0x0c, 0x00, "500K, Every 1500K" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x10, "1" }, + {0x14, 0x01, 0x30, 0x00, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2, "Copyright" }, + {0x14, 0x01, 0x40, 0x40, "Seta (Taito license)" }, + {0x14, 0x01, 0x40, 0x40, "Taito America" }, + + {0 , 0xfe, 0 , 2, "Coinage Type" }, + {0x14, 0x01, 0x80, 0x80, "1" }, + {0x14, 0x01, 0x80, 0x00, "2" }, +}; + +STDDIPINFO(Twineagl) + +static struct BurnDIPInfo KiwameDIPList[]= +{ + {0x19, 0xff, 0xff, 0xff, NULL }, + {0x1a, 0xff, 0xff, 0xff, NULL }, + {0x1b, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x19, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, + {0x19, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x19, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, + {0x19, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x19, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, + {0x19, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x19, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x19, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x19, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, + {0x19, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, + {0x19, 0x01, 0x38, 0x20, "2 Coins 1 Credits" }, + {0x19, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x19, 0x01, 0x38, 0x18, "2 Coins 3 Credits" }, + {0x19, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x19, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x19, 0x01, 0x38, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x19, 0x01, 0x40, 0x00, "Off" }, + {0x19, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Player's TSUMO" }, + {0x19, 0x01, 0x80, 0x80, "Manual" }, + {0x19, 0x01, 0x80, 0x00, "Auto" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x1a, 0x01, 0x01, 0x01, "Off" }, + {0x1a, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x1a, 0x01, 0x02, 0x02, "Off" }, + {0x1a, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Difficulty" }, + {0x1a, 0x01, 0x1c, 0x1c, "None" }, + {0x1a, 0x01, 0x1c, 0x18, "Prelim 1" }, + {0x1a, 0x01, 0x1c, 0x14, "Prelim 2" }, + {0x1a, 0x01, 0x1c, 0x10, "Final 1" }, + {0x1a, 0x01, 0x1c, 0x0c, "Final 2" }, + {0x1a, 0x01, 0x1c, 0x08, "Final 3" }, + {0x1a, 0x01, 0x1c, 0x04, "Qrt Final" }, + {0x1a, 0x01, 0x1c, 0x00, "SemiFinal" }, + + {0 , 0xfe, 0 , 8, "Points Gap" }, + {0x1a, 0x01, 0xe0, 0xe0, "None" }, + {0x1a, 0x01, 0xe0, 0xc0, "+6000" }, + {0x1a, 0x01, 0xe0, 0xa0, "+4000" }, + {0x1a, 0x01, 0xe0, 0x80, "+2000" }, + {0x1a, 0x01, 0xe0, 0x60, "-2000" }, + {0x1a, 0x01, 0xe0, 0x40, "-4000" }, + {0x1a, 0x01, 0xe0, 0x20, "-6000" }, + {0x1a, 0x01, 0xe0, 0x00, "-8000" }, +}; + +STDDIPINFO(Kiwame) + +static struct BurnDIPInfo MetafoxDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xb1, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Licensed To" }, + {0x13, 0x01, 0x01, 0x01, "Jordan" }, + {0x13, 0x01, 0x01, 0x00, "Taito America" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x03, "Normal" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "None" }, + {0x14, 0x01, 0x0c, 0x08, "60K Only" }, + {0x14, 0x01, 0x0c, 0x00, "60k & 90k" }, + {0x14, 0x01, 0x0c, 0x04, "90K Only" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x10, "1" }, + {0x14, 0x01, 0x30, 0x00, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2, "Licensed To" }, + {0x14, 0x01, 0x40, 0x40, "Romstar" }, + {0x14, 0x01, 0x40, 0x00, "Taito" }, + + {0 , 0xfe, 0 , 2, "Coinage Type" }, + {0x14, 0x01, 0x80, 0x80, "1" }, + {0x14, 0x01, 0x80, 0x00, "2" }, +}; + +STDDIPINFO(Metafox) + +static struct BurnDIPInfo ArbalestDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xbf, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Licensed To" }, + {0x13, 0x01, 0x01, 0x00, "Taito" }, + {0x13, 0x01, 0x01, 0x01, "Jordan" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x03, "Easy" }, + {0x14, 0x01, 0x03, 0x02, "Hard" }, + {0x14, 0x01, 0x03, 0x01, "Harder" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "Never" }, + {0x14, 0x01, 0x0c, 0x08, "300k Only" }, + {0x14, 0x01, 0x0c, 0x04, "600k Only" }, + {0x14, 0x01, 0x0c, 0x00, "300k & 600k" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x10, "1" }, + {0x14, 0x01, 0x30, 0x00, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 1, "Licensed To" }, + {0x14, 0x01, 0x40, 0x40, "Romstar" }, + + {0 , 0xfe, 0 , 2, "Coinage Type" }, + {0x14, 0x01, 0x80, 0x80, "1" }, + {0x14, 0x01, 0x80, 0x00, "2" }, +}; + +STDDIPINFO(Arbalest) + +static struct BurnDIPInfo DowntownDIPList[]= +{ + {0x15, 0xff, 0xff, 0xf6, NULL }, + {0x16, 0xff, 0xff, 0xbd, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Sales" }, + {0x15, 0x01, 0x01, 0x01, "Japan Only" }, + {0x15, 0x01, 0x01, 0x00, "World" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x08, "Off" }, + {0x15, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x15, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x15, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Normal" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x0c, "Never" }, + {0x16, 0x01, 0x0c, 0x08, "50K Only" }, + {0x16, 0x01, 0x0c, 0x04, "100K Only" }, + {0x16, 0x01, 0x0c, 0x00, "50K, Every 150K" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x30, 0x10, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x00, "4" }, + {0x16, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2, "World License" }, + {0x16, 0x01, 0x40, 0x40, "Romstar" }, + {0x16, 0x01, 0x40, 0x00, "Taito" }, + + {0 , 0xfe, 0 , 2, "Coinage Type" }, + {0x16, 0x01, 0x80, 0x80, "1" }, + {0x16, 0x01, 0x80, 0x00, "2" }, +}; + +STDDIPINFO(Downtown) + +static struct BurnDIPInfo TndrcadeDIPList[]= +{ + {0x13, 0xff, 0xff, 0x7f, NULL }, + {0x14, 0xff, 0xff, 0xf7, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x03, 0x02, "Easy" }, + {0x13, 0x01, 0x03, 0x03, "Normal" }, + {0x13, 0x01, 0x03, 0x01, "Hard" }, + {0x13, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x0c, 0x0c, "50K Only" }, + {0x13, 0x01, 0x0c, 0x04, "50K, Every 150K" }, + {0x13, 0x01, 0x0c, 0x00, "70K, Every 200K" }, + {0x13, 0x01, 0x0c, 0x08, "100K Only" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x30, 0x10, "1" }, + {0x13, 0x01, 0x30, 0x00, "2" }, + {0x13, 0x01, 0x30, 0x30, "3" }, + {0x13, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Licensed To" }, + {0x13, 0x01, 0x80, 0x80, "Taito America Corp." }, + {0x13, 0x01, 0x80, 0x00, "Taito Corp. Japan" }, + + {0 , 0xfe, 0 , 2, "Title" }, + {0x14, 0x01, 0x01, 0x01, "Thundercade" }, + {0x14, 0x01, 0x01, 0x00, "Twin Formation" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x08, 0x08, "Off" }, + {0x14, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, +}; + +STDDIPINFO(Tndrcade) + +static struct BurnDIPInfo TndrcadjDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xf7, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x03, 0x02, "Easy" }, + {0x13, 0x01, 0x03, 0x03, "Normal" }, + {0x13, 0x01, 0x03, 0x01, "Hard" }, + {0x13, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x0c, 0x0c, "50K Only" }, + {0x13, 0x01, 0x0c, 0x04, "50K, Every 150K" }, + {0x13, 0x01, 0x0c, 0x00, "70K, Every 200K" }, + {0x13, 0x01, 0x0c, 0x08, "100K Only" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x30, 0x10, "1" }, + {0x13, 0x01, 0x30, 0x00, "2" }, + {0x13, 0x01, 0x30, 0x30, "3" }, + {0x13, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Invulnerability" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x08, 0x08, "Off" }, + {0x14, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, +}; + +STDDIPINFO(Tndrcadj) + +static struct BurnDIPInfo UtoukondDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x14, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x00, "5 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x14, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x14, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x14, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x00, "1" }, + {0x15, 0x01, 0x03, 0x02, "2" }, + {0x15, 0x01, 0x03, 0x03, "3" }, + {0x15, 0x01, 0x03, 0x01, "4" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x0c, 0x08, "Easy" }, + {0x15, 0x01, 0x0c, 0x0c, "Normal" }, + {0x15, 0x01, 0x0c, 0x04, "Hard" }, + {0x15, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x10, 0x10, "Off" }, + {0x15, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x20, 0x00, "Off" }, + {0x15, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x15, 0x01, 0x40, 0x40, "100k" }, + {0x15, 0x01, 0x40, 0x00, "150k" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Utoukond) + +static struct BurnDIPInfo KrzybowlDIPList[]= +{ + {0x18, 0xff, 0xff, 0xff, NULL }, + {0x19, 0xff, 0xff, 0xff, NULL }, + {0x1a, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x18, 0x01, 0x01, 0x01, "Off" }, + {0x18, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x18, 0x01, 0x02, 0x00, "Off" }, + {0x18, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x18, 0x01, 0x0c, 0x08, "Easy" }, + {0x18, 0x01, 0x0c, 0x0c, "Normal" }, + {0x18, 0x01, 0x0c, 0x04, "Hard" }, + {0x18, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Frames" }, + {0x18, 0x01, 0x10, 0x10, "10" }, + {0x18, 0x01, 0x10, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x18, 0x01, 0x20, 0x20, "Upright" }, + {0x18, 0x01, 0x20, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Controls" }, + {0x18, 0x01, 0x40, 0x40, "Trackball" }, + {0x18, 0x01, 0x40, 0x00, "Joystick" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x18, 0x01, 0x80, 0x80, "Off" }, + {0x18, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x19, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x19, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x19, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x19, 0x01, 0x07, 0x04, "1 Coin 2 Credits" }, + {0x19, 0x01, 0x07, 0x03, "1 Coin 3 Credits" }, + {0x19, 0x01, 0x07, 0x02, "1 Coin 4 Credits" }, + {0x19, 0x01, 0x07, 0x01, "1 Coin 5 Credits" }, + {0x19, 0x01, 0x07, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x19, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, + {0x19, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, + {0x19, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x19, 0x01, 0x38, 0x20, "1 Coin 2 Credits" }, + {0x19, 0x01, 0x38, 0x18, "1 Coin 3 Credits" }, + {0x19, 0x01, 0x38, 0x10, "1 Coin 4 Credits" }, + {0x19, 0x01, 0x38, 0x08, "1 Coin 5 Credits" }, + {0x19, 0x01, 0x38, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Force Coinage" }, + {0x19, 0x01, 0x40, 0x40, "No" }, + {0x19, 0x01, 0x40, 0x00, "2 Coins 1 Credits" }, +}; + +STDDIPINFO(Krzybowl) + +static struct BurnDIPInfo ExtdwnhlDIPList[]= +{ + {0x0c, 0xff, 0xff, 0xff, NULL }, + {0x0d, 0xff, 0xff, 0xff, NULL }, + {0x0e, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x0c, 0x01, 0x01, 0x01, "Off" }, + {0x0c, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0c, 0x01, 0x02, 0x00, "Off" }, + {0x0c, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x0c, 0x01, 0x0c, 0x08, "Easy" }, + {0x0c, 0x01, 0x0c, 0x0c, "Normal" }, + {0x0c, 0x01, 0x0c, 0x04, "Hard" }, + {0x0c, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x0c, 0x01, 0x10, 0x10, "Off" }, + {0x0c, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x0c, 0x01, 0x20, 0x20, "Upright" }, + {0x0c, 0x01, 0x20, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Controls" }, + {0x0c, 0x01, 0x40, 0x40, "2" }, + {0x0c, 0x01, 0x40, 0x00, "1" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0c, 0x01, 0x80, 0x80, "Off" }, + {0x0c, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x0d, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x0d, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x0d, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x0d, 0x01, 0x07, 0x04, "1 Coin 2 Credits" }, + {0x0d, 0x01, 0x07, 0x03, "1 Coin 3 Credits" }, + {0x0d, 0x01, 0x07, 0x02, "1 Coin 4 Credits" }, + {0x0d, 0x01, 0x07, 0x01, "1 Coin 5 Credits" }, + {0x0d, 0x01, 0x07, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x0d, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, + {0x0d, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, + {0x0d, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x0d, 0x01, 0x38, 0x20, "1 Coin 2 Credits" }, + {0x0d, 0x01, 0x38, 0x18, "1 Coin 3 Credits" }, + {0x0d, 0x01, 0x38, 0x10, "1 Coin 4 Credits" }, + {0x0d, 0x01, 0x38, 0x08, "1 Coin 5 Credits" }, + {0x0d, 0x01, 0x38, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Continue Coin" }, + {0x0d, 0x01, 0x40, 0x40, "Normal: Start 1C / Continue 1C" }, + {0x0d, 0x01, 0x40, 0x00, "Half Continue: Start 2C / Continue 1C" }, + + {0 , 0xfe, 0 , 2, "Game Mode" }, + {0x0d, 0x01, 0x80, 0x80, "Finals Only" }, + {0x0d, 0x01, 0x80, 0x00, "Semi-Finals & Finals" }, + + {0 , 0xfe, 0 , 2, "Service Mode (No Toggle)" }, + {0x0e, 0x01, 0x08, 0x08, "Off" }, + {0x0e, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 3, "Country" }, + {0x0e, 0x01, 0x30, 0x30, "World" }, + {0x0e, 0x01, 0x30, 0x10, "USA" }, + {0x0e, 0x01, 0x30, 0x00, "Japan" }, +}; + +STDDIPINFO(Extdwnhl) + +static struct BurnDIPInfo SokonukeDIPList[]= +{ + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x10, 0x01, 0x01, 0x01, "Off" }, + {0x10, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x10, 0x01, 0x02, 0x00, "Off" }, + {0x10, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x10, 0x01, 0x0c, 0x08, "Easy" }, + {0x10, 0x01, 0x0c, 0x0c, "Normal" }, + {0x10, 0x01, 0x0c, 0x04, "Hard" }, + {0x10, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x10, 0x01, 0x10, 0x10, "Off" }, + {0x10, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x10, 0x01, 0x80, 0x80, "Off" }, + {0x10, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x11, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x11, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x11, 0x01, 0x07, 0x04, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x07, 0x03, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x07, 0x02, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x07, 0x01, "1 Coin 5 Credits" }, + {0x11, 0x01, 0x07, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x11, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, + {0x11, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, + {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x11, 0x01, 0x38, 0x20, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x38, 0x18, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x38, 0x10, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x38, 0x08, "1 Coin 5 Credits" }, + {0x11, 0x01, 0x38, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Cheap Continue" }, + {0x11, 0x01, 0x40, 0x40, "No" }, + {0x11, 0x01, 0x40, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, +}; + +STDDIPINFO(Sokonuke) + +static struct BurnDIPInfo JjsquawkDIPList[]= +{ + {0x12, 0xff, 0xff, 0xbf, NULL }, + {0x13, 0xff, 0xff, 0xef, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x12, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x12, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x20, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x38, 0x18, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x38, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x08, "Easy" }, + {0x13, 0x01, 0x0c, 0x0c, "Normal" }, + {0x13, 0x01, 0x0c, 0x04, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Energy" }, + {0x13, 0x01, 0x30, 0x20, "2" }, + {0x13, 0x01, 0x30, 0x30, "3" }, + {0x13, 0x01, 0x30, 0x10, "4" }, + {0x13, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0xc0, 0x80, "20K, Every 100K" }, + {0x13, 0x01, 0xc0, 0xc0, "50K, Every 200K" }, + {0x13, 0x01, 0xc0, 0x40, "70K, 200K Only" }, + {0x13, 0x01, 0xc0, 0x00, "100K Only" }, +}; + +STDDIPINFO(Jjsquawk) + +static struct BurnDIPInfo KeroppiDIPList[]= +{ + {0x04, 0xff, 0xff, 0xff, NULL }, + {0x05, 0xff, 0xff, 0xbf, NULL }, + {0x06, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Difficulty" }, + {0x04, 0x01, 0x07, 0x03, "1" }, + {0x04, 0x01, 0x07, 0x05, "2" }, + {0x04, 0x01, 0x07, 0x01, "3" }, + {0x04, 0x01, 0x07, 0x07, "4" }, + {0x04, 0x01, 0x07, 0x06, "5" }, + {0x04, 0x01, 0x07, 0x02, "6" }, + {0x04, 0x01, 0x07, 0x04, "7" }, + {0x04, 0x01, 0x07, 0x00, "8" }, + + {0 , 0xfe, 0 , 8, "Game Select" }, + {0x04, 0x01, 0x38, 0x38, "No. 1,2,3" }, + {0x04, 0x01, 0x38, 0x30, "No. 1" }, + {0x04, 0x01, 0x38, 0x28, "No. 2,3" }, + {0x04, 0x01, 0x38, 0x20, "No. 3" }, + {0x04, 0x01, 0x38, 0x18, "No. 1,2" }, + {0x04, 0x01, 0x38, 0x10, "No. 2" }, + {0x04, 0x01, 0x38, 0x08, "No. 1,3" }, + {0x04, 0x01, 0x38, 0x00, "No. 1,2,3" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x05, 0x01, 0x07, 0x00, "5 Coins 1 Credits" }, + {0x05, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, + {0x05, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x05, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x05, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x05, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, + {0x05, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x05, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x05, 0x01, 0x20, 0x20, "Off" }, + {0x05, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x05, 0x01, 0x40, 0x40, "Off" }, + {0x05, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x05, 0x01, 0x80, 0x80, "Off" }, + {0x05, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Keroppi) + +static struct BurnDIPInfo OrbsDIPList[]= +{ + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x10, 0x01, 0x01, 0x01, "Off" }, + {0x10, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x10, 0x01, 0x02, 0x00, "Off" }, + {0x10, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x10, 0x01, 0x0c, 0x08, "Easy" }, + {0x10, 0x01, 0x0c, 0x0c, "Normal" }, + {0x10, 0x01, 0x0c, 0x04, "Hard" }, + {0x10, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Stock" }, + {0x10, 0x01, 0x10, 0x10, "1" }, + {0x10, 0x01, 0x10, 0x00, "2" }, + + {0 , 0xfe, 0 , 2, "Level Select" }, + {0x10, 0x01, 0x20, 0x20, "Off" }, + {0x10, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Timer speed" }, + {0x10, 0x01, 0x40, 0x40, "Normal" }, + {0x10, 0x01, 0x40, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x10, 0x01, 0x80, 0x80, "Off" }, + {0x10, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x11, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x11, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x11, 0x01, 0x07, 0x04, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x07, 0x03, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x07, 0x02, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x07, 0x01, "1 Coin 5 Credits" }, + {0x11, 0x01, 0x07, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x11, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, + {0x11, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, + {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x11, 0x01, 0x38, 0x20, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x38, 0x18, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x38, 0x10, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x38, 0x08, "1 Coin 5 Credits" }, + {0x11, 0x01, 0x38, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "Force Coinage (Half)" }, + {0x11, 0x01, 0x40, 0x40, "No" }, + {0x11, 0x01, 0x40, 0x00, "2 Coins 1 Credits" }, +}; + +STDDIPINFO(Orbs) + +static struct BurnDIPInfo PairloveDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfd, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x0c, 0x08, "Easy" }, + {0x14, 0x01, 0x0c, 0x0c, "Normal" }, + {0x14, 0x01, 0x0c, 0x04, "Hard" }, + {0x14, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x14, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x14, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x14, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x14, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Pairlove) + +static struct BurnDIPInfo OisipuzlDIPList[]= +{ + {0x12, 0xff, 0xff, 0xfb, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Normal" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x04, 0x04, "Off" }, + {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0x07, 0x00, "5 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x03, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "5 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x18, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x38, 0x20, "1 Coin 4 Credits" }, +}; + +STDDIPINFO(Oisipuzl) + +static struct BurnDIPInfo BlandiaDIPList[]= +{ + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x01, 0x00, "Off" }, + {0x15, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2, "Coinage Type" }, + {0x15, 0x01, 0x02, 0x02, "1" }, + {0x15, 0x01, 0x02, 0x00, "2" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x15, 0x01, 0x1c, 0x10, "3 Coins 1 Credits" }, + {0x15, 0x01, 0x1c, 0x0c, "2 Coins 1 Credits" }, + {0x15, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x15, 0x01, 0x1c, 0x04, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x1c, 0x18, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x1c, 0x08, "2 Coins 5 Credits" }, + {0x15, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x15, 0x01, 0x1c, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x15, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x15, 0x01, 0xe0, 0x60, "2 Coins 4 Credits" }, + {0x15, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xe0, 0x80, "3 Coins/7 Credits" }, + {0x15, 0x01, 0xe0, 0x20, "2 Coins 5 Credits" }, + {0x15, 0x01, 0xe0, 0x40, "2 Coins 6 Credits" }, + {0x15, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xe0, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "1" }, + {0x16, 0x01, 0x03, 0x03, "2" }, + {0x16, 0x01, 0x03, 0x01, "3" }, + {0x16, 0x01, 0x03, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x0c, 0x08, "Easy" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Hard" }, + {0x16, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "2 Player Game" }, + {0x16, 0x01, 0x10, 0x10, "2 Credits" }, + {0x16, 0x01, 0x10, 0x00, "1 Credit" }, + + {0 , 0xfe, 0 , 2, "Continue" }, + {0x16, 0x01, 0x20, 0x20, "1 Credit" }, + {0x16, 0x01, 0x20, 0x00, "1 Coin" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x16, 0x01, 0x40, 0x40, "Off" }, + {0x16, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Blandia) + +static struct BurnDIPInfo GundharaDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x14, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x14, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x14, 0x01, 0x30, 0x00, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x14, 0x01, 0xc0, 0xc0, "Japanese" }, + {0x14, 0x01, 0xc0, 0x00, "English" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x03, 0x02, "Easy" }, + {0x15, 0x01, 0x03, 0x03, "Normal" }, + {0x15, 0x01, 0x03, 0x01, "Hard" }, + {0x15, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x0c, 0x08, "1" }, + {0x15, 0x01, 0x0c, 0x0c, "2" }, + {0x15, 0x01, 0x0c, 0x04, "3" }, + {0x15, 0x01, 0x0c, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x15, 0x01, 0x30, 0x30, "200K" }, + {0x15, 0x01, 0x30, 0x20, "200K, Every 200K" }, + {0x15, 0x01, 0x30, 0x10, "400K" }, + {0x15, 0x01, 0x30, 0x00, "None" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x40, 0x00, "Off" }, + {0x15, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x08, 0x08, "Off" }, + {0x16, 0x01, 0x08, 0x00, "On" }, +}; + +STDDIPINFO(Gundhara) + +static struct BurnDIPInfo AtehateDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xff, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x0e, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, + {0x0e, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x0e, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, + {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x0e, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x0e, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x0e, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, + {0x0e, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, + {0x0e, 0x01, 0x38, 0x20, "2 Coins 1 Credits" }, + {0x0e, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x0e, 0x01, 0x38, 0x18, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x0e, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x0e, 0x01, 0x38, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0e, 0x01, 0x40, 0x00, "Off" }, + {0x0e, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 0, "Flip Screen" }, + {0x0f, 0x01, 0x01, 0x01, "Off" }, + {0x0f, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0f, 0x01, 0x02, 0x02, "Off" }, + {0x0f, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x0f, 0x01, 0x0c, 0x08, "Easy" }, + {0x0f, 0x01, 0x0c, 0x0c, "Normal" }, + {0x0f, 0x01, 0x0c, 0x04, "Hard" }, + {0x0f, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x0f, 0x01, 0x30, 0x00, "2" }, + {0x0f, 0x01, 0x30, 0x30, "3" }, + {0x0f, 0x01, 0x30, 0x10, "4" }, + {0x0f, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x0f, 0x01, 0xc0, 0xc0, "None" }, + {0x0f, 0x01, 0xc0, 0x00, "20K Only" }, + {0x0f, 0x01, 0xc0, 0x80, "20K, Every 30K" }, + {0x0f, 0x01, 0xc0, 0x40, "30K, Every 40K" }, +}; + +STDDIPINFO(Atehate) + +static struct BurnDIPInfo ThunderlDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xe9, NULL }, + {0x15, 0xff, 0xff, 0xef, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x13, 0x01, 0x0f, 0x0c, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x08, "4 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x09, "3 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x04, "4 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x00, "4 Coins 4 Credits" }, + {0x13, 0x01, 0x0f, 0x05, "3 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "2 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x0f, 0x01, "3 Coins 4 Credits" }, + {0x13, 0x01, 0x0f, 0x06, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x02, "2 Coins 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x07, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x13, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "4 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0x40, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0x00, "4 Coins 4 Credits" }, + {0x13, 0x01, 0xf0, 0x50, "3 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "2 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x10, "3 Coins 4 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0x20, "2 Coins 4 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x02, 0x00, "Off" }, + {0x14, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x14, 0x01, 0x04, 0x00, "Upright" }, + {0x14, 0x01, 0x04, 0x04, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Controls" }, + {0x14, 0x01, 0x08, 0x08, "2" }, + {0x14, 0x01, 0x08, 0x00, "1" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x10, 0x10, "Off" }, + {0x14, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x14, 0x01, 0x20, 0x20, "3" }, + {0x14, 0x01, 0x20, 0x00, "2" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0xc0, 0x80, "Easy" }, + {0x14, 0x01, 0xc0, 0xc0, "Normal" }, + {0x14, 0x01, 0xc0, 0x40, "Hard" }, + {0x14, 0x01, 0xc0, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Force 1 Life" }, + {0x15, 0x01, 0x10, 0x00, "Off" }, + {0x15, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 5, "Copyright" }, + {0x15, 0x01, 0xe0, 0x80, "Romstar" }, + {0x15, 0x01, 0xe0, 0xc0, "Seta (Romstar License)"}, + {0x15, 0x01, 0xe0, 0xe0, "Seta (Visco License)" }, + {0x15, 0x01, 0xe0, 0xa0, "Visco" }, + {0x15, 0x01, 0xe0, 0x60, "None" }, +}; + +STDDIPINFO(Thunderl) + +static struct BurnDIPInfo WitsDIPList[]= +{ + {0x21, 0xff, 0xff, 0xff, NULL }, + {0x22, 0xff, 0xff, 0xff, NULL }, + {0x23, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x21, 0x01, 0x03, 0x02, "Easy" }, + {0x21, 0x01, 0x03, 0x03, "Normal" }, + {0x21, 0x01, 0x03, 0x01, "Hard" }, + {0x21, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x21, 0x01, 0x0c, 0x08, "150k, 350k" }, + {0x21, 0x01, 0x0c, 0x0c, "200k, 500k" }, + {0x21, 0x01, 0x0c, 0x04, "300k, 600k" }, + {0x21, 0x01, 0x0c, 0x00, "400k" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x21, 0x01, 0x30, 0x00, "1" }, + {0x21, 0x01, 0x30, 0x10, "2" }, + {0x21, 0x01, 0x30, 0x30, "3" }, + {0x21, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2, "Play Mode" }, + {0x21, 0x01, 0x40, 0x40, "2 Players" }, + {0x21, 0x01, 0x40, 0x00, "4 Players" }, + + {0 , 0xfe, 0 , 2, "CPU Player During Multi-Player Game" }, + {0x21, 0x01, 0x80, 0x00, "No" }, + {0x21, 0x01, 0x80, 0x80, "Yes" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x22, 0x01, 0x01, 0x01, "Upright" }, + {0x22, 0x01, 0x01, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x22, 0x01, 0x02, 0x02, "Off" }, + {0x22, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x22, 0x01, 0x04, 0x04, "Every 3rd Loop" }, + {0x22, 0x01, 0x04, 0x00, "Every 7th Loop" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x22, 0x01, 0x08, 0x08, "Off" }, + {0x22, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x22, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x22, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x22, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x22, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x22, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x22, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x22, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x22, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "License" }, + {0x23, 0x01, 0xc0, 0xc0, "Romstar" }, + {0x23, 0x01, 0xc0, 0x80, "Seta U.S.A" }, + {0x23, 0x01, 0xc0, 0x40, "Visco (Japan Only)" }, + {0x23, 0x01, 0xc0, 0x00, "Athena (Japan Only)" }, +}; + +STDDIPINFO(Wits) + +static struct BurnDIPInfo MadsharkDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 0, "Bonus Life" }, + {0x13, 0x01, 0x18, 0x18, "1000k" }, + {0x13, 0x01, 0x18, 0x08, "1000k 2000k" }, + {0x13, 0x01, 0x18, 0x10, "1500k 3000k" }, + {0x13, 0x01, 0x18, 0x00, "No" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x40, "Easy" }, + {0x13, 0x01, 0x60, 0x60, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Hard" }, + {0x13, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Lives" }, + {0x14, 0x01, 0x03, 0x02, "2" }, + {0x14, 0x01, 0x03, 0x03, "3" }, + {0x14, 0x01, 0x03, 0x01, "4" }, + {0x14, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x14, 0x01, 0x1c, 0x04, "4 Coins 1 Credits" }, + {0x14, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x1c, 0x10, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x1c, 0x0c, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x1c, 0x18, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x1c, 0x00, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x14, 0x01, 0xe0, 0x20, "4 Coins 1 Credits" }, + {0x14, 0x01, 0xe0, 0x40, "3 Coins 1 Credits" }, + {0x14, 0x01, 0xe0, 0x80, "2 Coins 1 Credits" }, + {0x14, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" }, + {0x14, 0x01, 0xe0, 0x60, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xe0, 0x00, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 2, "Country" }, + {0x15, 0x01, 0x80, 0x80, "Japan" }, + {0x15, 0x01, 0x80, 0x00, "World" }, +}; + +STDDIPINFO(Madshark) + +static struct BurnDIPInfo MsgundamDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0x07, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x38, 0x18, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x38, 0x20, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x01, 0x00, "Off" }, + {0x14, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x06, 0x04, "Easy" }, + {0x14, 0x01, 0x06, 0x06, "Normal" }, + {0x14, 0x01, 0x06, 0x02, "Hard" }, + {0x14, 0x01, 0x06, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x10, 0x10, "Off" }, + {0x14, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Memory Check" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x15, 0x01, 0x80, 0x80, "English" }, + {0x15, 0x01, 0x80, 0x00, "Japanese" }, +}; + +STDDIPINFO(Msgundam) + +static struct BurnDIPInfo Msgunda1DIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0x07, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x07, 0x04, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x38, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x08, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x38, 0x18, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x38, 0x20, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x01, 0x00, "Off" }, + {0x14, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x06, 0x04, "Easy" }, + {0x14, 0x01, 0x06, 0x06, "Normal" }, + {0x14, 0x01, 0x06, 0x02, "Hard" }, + {0x14, 0x01, 0x06, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x10, 0x10, "Off" }, + {0x14, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Memory Check" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 1, "Language" }, + {0x15, 0x01, 0x80, 0x00, "Japanese" }, +}; + +STDDIPINFO(Msgunda1) + +static struct BurnDIPInfo ZingzipDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 0, "Service Mode" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 0, "Lives" }, + {0x13, 0x01, 0x03, 0x02, "2" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x01, "4" }, + {0x13, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 0, "Difficulty" }, + {0x13, 0x01, 0x0c, 0x08, "Easy" }, + {0x13, 0x01, 0x0c, 0x0c, "Normal" }, + {0x13, 0x01, 0x0c, 0x04, "Hard" }, + {0x13, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 0, "Coinage" }, + {0x13, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x13, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Zingzip) + +static struct BurnDIPInfo WrofaeroDIPList[]= +{ + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x00, "Off" }, + {0x15, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Stage & Weapon Select"}, + {0x15, 0x01, 0x08, 0x08, "Off" }, + {0x15, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 0, "Service Mode" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 0, "Lives" }, + {0x16, 0x01, 0x03, 0x02, "2" }, + {0x16, 0x01, 0x03, 0x03, "3" }, + {0x16, 0x01, 0x03, 0x01, "4" }, + {0x16, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 0, "Difficulty" }, + {0x16, 0x01, 0x0c, 0x08, "Easy" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Hard" }, + {0x16, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x16, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, + {0x16, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, + {0x16, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x16, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x16, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x16, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x16, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x16, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x16, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x16, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x16, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Wrofaero) + +static struct BurnDIPInfo EightfrcDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0x7b, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0x38, 0x20, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x38, 0x10, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x38, 0x08, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x38, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Shared Credits" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Credits To Start" }, + {0x13, 0x01, 0x80, 0x80, "1" }, + {0x13, 0x01, 0x80, 0x00, "2" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x18, 0x10, "Easy" }, + {0x14, 0x01, 0x18, 0x18, "Normal" }, + {0x14, 0x01, 0x18, 0x08, "Hard" }, + {0x14, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x60, 0x40, "2" }, + {0x14, 0x01, 0x60, 0x60, "3" }, + {0x14, 0x01, 0x60, 0x20, "4" }, + {0x14, 0x01, 0x60, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x14, 0x01, 0x80, 0x00, "English" }, + {0x14, 0x01, 0x80, 0x80, "Japanese" }, +}; + +STDDIPINFO(Eightfrc) + +static struct BurnDIPInfo RezonDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x00, "Off" }, + {0x14, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 3, "Cabinet" }, + {0x14, 0x01, 0x18, 0x00, "Upright 1 Controller" }, + {0x14, 0x01, 0x18, 0x18, "Upright 2 Controllers"}, + {0x14, 0x01, 0x18, 0x08, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x03, 0x02, "2" }, + {0x15, 0x01, 0x03, 0x03, "3" }, + {0x15, 0x01, 0x03, 0x01, "4" }, + {0x15, 0x01, 0x03, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x0c, 0x08, "Easy" }, + {0x15, 0x01, 0x0c, 0x0c, "Normal" }, + {0x15, 0x01, 0x0c, 0x04, "Hard" }, + {0x15, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x15, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x15, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x15, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x15, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x15, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x15, 0x01, 0xf0, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x08, 0x08, "Off" }, + {0x16, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Taito Logo" }, + {0x16, 0x01, 0x10, 0x00, "Off" }, + {0x16, 0x01, 0x10, 0x10, "On" }, +}; + +STDDIPINFO(Rezon) + +static struct BurnDIPInfo Qzkklgy2DIPList[]= +{ + {0x0e, 0xff, 0xff, 0xff, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Highlight Right Answer" }, + {0x0e, 0x01, 0x04, 0x04, "Off" }, + {0x0e, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Skip Real DAT Rom Check?" }, + {0x0e, 0x01, 0x08, 0x08, "Off" }, + {0x0e, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0f, 0x01, 0x20, 0x20, "Off" }, + {0x0f, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0e, 0x01, 0x40, 0x00, "Off" }, + {0x0e, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x0e, 0x01, 0x80, 0x80, "Off" }, + {0x0e, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x0f, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, + {0x0f, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x0f, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x0f, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x0f, 0x01, 0x07, 0x00, "2 Coins 3 Credits" }, + {0x0f, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, + {0x0f, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, + {0x0f, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x0f, 0x01, 0x08, 0x08, "Off" }, + {0x0f, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x0f, 0x01, 0x30, 0x30, "Easy" }, + {0x0f, 0x01, 0x30, 0x20, "Normal" }, + {0x0f, 0x01, 0x30, 0x10, "Hard" }, + {0x0f, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x0f, 0x01, 0xc0, 0x80, "2" }, + {0x0f, 0x01, 0xc0, 0xc0, "3" }, + {0x0f, 0x01, 0xc0, 0x40, "4" }, + {0x0f, 0x01, 0xc0, 0x00, "5" }, +}; + +STDDIPINFO(Qzkklgy2) + +static struct BurnDIPInfo QzkklogyDIPList[]= +{ + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Highlight Right Answer" }, + {0x0f, 0x01, 0x04, 0x04, "Off" }, + {0x0f, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0f, 0x01, 0x20, 0x20, "Off" }, + {0x0f, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0f, 0x01, 0x40, 0x00, "Off" }, + {0x0f, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x0f, 0x01, 0x80, 0x80, "Off" }, + {0x0f, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x10, 0x01, 0x07, 0x04, "4 Coins 1 Credits" }, + {0x10, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x10, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x10, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x10, 0x01, 0x07, 0x01, "2 Coins 3 Credits" }, + {0x10, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, + {0x10, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, + {0x10, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x10, 0x01, 0x30, 0x20, "Easy" }, + {0x10, 0x01, 0x30, 0x30, "Normal" }, + {0x10, 0x01, 0x30, 0x10, "Hard" }, + {0x10, 0x01, 0x30, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x10, 0x01, 0xc0, 0x80, "2" }, + {0x10, 0x01, 0xc0, 0xc0, "3" }, + {0x10, 0x01, 0xc0, 0x40, "4" }, + {0x10, 0x01, 0xc0, 0x00, "5" }, +}; + +STDDIPINFO(Qzkklogy) + +static struct BurnDIPInfo StgDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x03, 0x02, "Easy" }, + {0x13, 0x01, 0x03, 0x03, "Normal" }, + {0x13, 0x01, 0x03, 0x01, "Hard" }, + {0x13, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x30, 0x10, "1" }, + {0x13, 0x01, 0x30, 0x00, "2" }, + {0x13, 0x01, 0x30, 0x30, "3" }, + {0x13, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 4, "Flip Screen" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Stg) + +static struct BurnDIPInfo DrgnunitDIPList[]= +{ + {0x15, 0xff, 0xff, 0xfe, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x03, 0x03, "Easy" }, + {0x15, 0x01, 0x03, 0x02, "Normal" }, + {0x15, 0x01, 0x03, 0x01, "Hard" }, + {0x15, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x15, 0x01, 0x0c, 0x08, "150K, Every 300K" }, + {0x15, 0x01, 0x0c, 0x0c, "200K, Every 400K" }, + {0x15, 0x01, 0x0c, 0x04, "300K, Every 500K" }, + {0x15, 0x01, 0x0c, 0x00, "400K Only" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x15, 0x01, 0x30, 0x00, "1" }, + {0x15, 0x01, 0x30, 0x10, "2" }, + {0x15, 0x01, 0x30, 0x30, "3" }, + {0x15, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x16, 0x01, 0x02, 0x02, "Off" }, + {0x16, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 0, "Demo Sounds" }, + {0x16, 0x01, 0x04, 0x04, "1 of 4 Scenes" }, + {0x16, 0x01, 0x04, 0x00, "1 of 8 Scenes" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x08, 0x08, "Off" }, + {0x16, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin A" }, + {0x16, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x16, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x16, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x16, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2, "Coin B" }, + {0x16, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x16, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x16, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x16, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coinage Type" }, + {0x17, 0x01, 0x10, 0x10, "1" }, + {0x17, 0x01, 0x10, 0x00, "2" }, + + {0 , 0xfe, 0 , 4, "Title" }, + {0x17, 0x01, 0x20, 0x20, "Dragon Unit" }, + {0x17, 0x01, 0x20, 0x00, "Castle of Dragon" }, + + {0 , 0xfe, 0 , 2, "(C) / License" }, + {0x17, 0x01, 0xc0, 0xc0, "Athena (Japan)" }, + {0x17, 0x01, 0xc0, 0x80, "Athena / Taito (Japan)" }, + {0x17, 0x01, 0xc0, 0x40, "Seta USA / Taito America" }, + {0x17, 0x01, 0xc0, 0x00, "Seta USA / Romstar" }, +}; + +STDDIPINFO(Drgnunit) + +static struct BurnDIPInfo DaiohDIPList[]= +{ + {0x1a, 0xff, 0xff, 0x7f, NULL }, + {0x1b, 0xff, 0xff, 0xff, NULL }, + {0x1c, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x1a, 0x01, 0x07, 0x01, "4 Coins 1 Credits" }, + {0x1a, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x1a, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, + {0x1a, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x1a, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, + {0x1a, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x1a, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x1a, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x1a, 0x01, 0x38, 0x08, "4 Coins 1 Credits" }, + {0x1a, 0x01, 0x38, 0x10, "3 Coins 1 Credits" }, + {0x1a, 0x01, 0x38, 0x20, "2 Coins 1 Credits" }, + {0x1a, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x1a, 0x01, 0x38, 0x18, "2 Coins 3 Credits" }, + {0x1a, 0x01, 0x38, 0x30, "1 Coin 2 Credits" }, + {0x1a, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x1a, 0x01, 0x38, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x1a, 0x01, 0x40, 0x00, "Off" }, + {0x1a, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Auto Shot" }, + {0x1a, 0x01, 0x80, 0x80, "Off" }, + {0x1a, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x1b, 0x01, 0x01, 0x01, "Off" }, + {0x1b, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x1b, 0x01, 0x02, 0x02, "Off" }, + {0x1b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x1b, 0x01, 0x0c, 0x08, "Easy" }, + {0x1b, 0x01, 0x0c, 0x0c, "Normal" }, + {0x1b, 0x01, 0x0c, 0x04, "Hard" }, + {0x1b, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x1b, 0x01, 0x30, 0x00, "1" }, + {0x1b, 0x01, 0x30, 0x10, "2" }, + {0x1b, 0x01, 0x30, 0x30, "3" }, + {0x1b, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x1b, 0x01, 0xc0, 0x80, "300k and every 800k" }, + {0x1b, 0x01, 0xc0, 0xc0, "500k and every 1000k" }, + {0x1b, 0x01, 0xc0, 0x40, "800k and 2000k only" }, + {0x1b, 0x01, 0xc0, 0x00, "1000k Only" }, + + {0 , 0xfe, 0 , 2, "Country" }, + {0x1c, 0x01, 0x80, 0x80, "USA (6 buttons)" }, + {0x1c, 0x01, 0x80, 0x00, "Japan (2 buttons)" }, +}; + +STDDIPINFO(Daioh) + +static struct BurnDIPInfo NeobattlDIPList[]= +{ + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x11, 0x01, 0x02, 0x00, "Off" }, + {0x11, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Stage Select" }, + {0x11, 0x01, 0x08, 0x08, "Off" }, + {0x11, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x12, 0x01, 0x03, 0x02, "1" }, + {0x12, 0x01, 0x03, 0x03, "2" }, + {0x12, 0x01, 0x03, 0x01, "3" }, + {0x12, 0x01, 0x03, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Normal" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x12, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Neobattl) + +static struct BurnDIPInfo UmanclubDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Stage Select" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x03, 0x02, "1" }, + {0x14, 0x01, 0x03, 0x03, "2" }, + {0x14, 0x01, 0x03, 0x01, "3" }, + {0x14, 0x01, 0x03, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x0c, 0x08, "Easy" }, + {0x14, 0x01, 0x0c, 0x0c, "Normal" }, + {0x14, 0x01, 0x0c, 0x04, "Hard" }, + {0x14, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x14, 0x01, 0xf0, 0xa0, "6 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xc0, "4 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xd0, "3 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x10, "8 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0xe0, "2 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x20, "5 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0x30, "3 Coins 2 Credits" }, + {0x14, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x14, 0x01, 0xf0, 0x40, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xf0, 0x90, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xf0, 0x80, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xf0, 0x70, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xf0, 0x60, "1 Coin 5 Credits" }, + {0x14, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x14, 0x01, 0xf0, 0x00, "Free Play" }, +}; + +STDDIPINFO(Umanclub) + +static struct BurnDIPInfo KamenridDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Intro Music" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 16, "Coinage" }, + {0x14, 0x01, 0x0f, 0x05, "6 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0d, "5 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x03, "4 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0b, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x08, "8 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x07, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x04, "5 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0c, "3 Coins 2 Credits" }, + {0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x0f, 0x02, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x0f, 0x09, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0f, 0x01, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0f, 0x0e, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x0f, 0x06, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x14, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x30, 0x10, "Easy" }, + {0x14, 0x01, 0x30, 0x30, "Normal" }, + {0x14, 0x01, 0x30, 0x20, "Hard" }, + {0x14, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Country" }, + {0x15, 0x01, 0x80, 0x80, "USA" }, + {0x15, 0x01, 0x80, 0x00, "Japan" }, +}; + +STDDIPINFO(Kamenrid) + +static struct BurnDIPInfo BlockcarDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x03, 0x02, "Easy" }, + {0x13, 0x01, 0x03, 0x03, "Normal" }, + {0x13, 0x01, 0x03, 0x01, "Hard" }, + {0x13, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x0c, 0x0c, "20K, Every 50K" }, + {0x13, 0x01, 0x0c, 0x04, "20K, Every 70K" }, + {0x13, 0x01, 0x0c, 0x08, "30K, Every 60K" }, + {0x13, 0x01, 0x0c, 0x00, "30K, Every 90K" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x30, 0x00, "1" }, + {0x13, 0x01, 0x30, 0x30, "2" }, + {0x13, 0x01, 0x30, 0x20, "3" }, + {0x13, 0x01, 0x30, 0x10, "4" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x04, 0x00, "Off" }, + {0x14, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2, "Title" }, + {0x15, 0x01, 0x10, 0x10, "Thunder & Lightning 2" }, + {0x15, 0x01, 0x10, 0x00, "Block Carnival" }, +}; + +STDDIPINFO(Blockcar) + +static struct BurnDIPInfo ZombraidDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xfd, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Vertical Screen Flip" }, + {0x0e, 0x01, 0x01, 0x01, "Off" }, + {0x0e, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Horizontal Screen Flip" }, + {0x0e, 0x01, 0x02, 0x00, "Off" }, + {0x0e, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0e, 0x01, 0x04, 0x00, "Off" }, + {0x0e, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x0e, 0x01, 0x18, 0x10, "Easy" }, + {0x0e, 0x01, 0x18, 0x18, "Normal" }, + {0x0e, 0x01, 0x18, 0x08, "Hard" }, + {0x0e, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x0e, 0x01, 0x20, 0x00, "Off" }, + {0x0e, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0e, 0x01, 0x80, 0x80, "Off" }, + {0x0e, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x0f, 0x01, 0x07, 0x05, "3 Coins 1 Credits" }, + {0x0f, 0x01, 0x07, 0x06, "2 Coins 1 Credits" }, + {0x0f, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x0f, 0x01, 0x07, 0x04, "1 Coin 2 Credits" }, + {0x0f, 0x01, 0x07, 0x03, "1 Coin 3 Credits" }, + {0x0f, 0x01, 0x07, 0x02, "1 Coin 4 Credits" }, + {0x0f, 0x01, 0x07, 0x01, "1 Coin 5 Credits" }, + {0x0f, 0x01, 0x07, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x0f, 0x01, 0x38, 0x28, "3 Coins 1 Credits" }, + {0x0f, 0x01, 0x38, 0x30, "2 Coins 1 Credits" }, + {0x0f, 0x01, 0x38, 0x38, "1 Coin 1 Credits" }, + {0x0f, 0x01, 0x38, 0x20, "1 Coin 2 Credits" }, + {0x0f, 0x01, 0x38, 0x18, "1 Coin 3 Credits" }, + {0x0f, 0x01, 0x38, 0x10, "1 Coin 4 Credits" }, + {0x0f, 0x01, 0x38, 0x08, "1 Coin 5 Credits" }, + {0x0f, 0x01, 0x38, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, + {0x0f, 0x01, 0x40, 0x40, "No" }, + {0x0f, 0x01, 0x40, 0x00, "Yes" }, +}; + +STDDIPINFO(Zombraid) + +static struct BurnDIPInfo JockeycDIPList[]= +{ + {0x39, 0xff, 0xff, 0xff, NULL }, + {0x3a, 0xff, 0xff, 0xff, NULL }, + {0x3b, 0xff, 0xff, 0xff, NULL }, + + {0x3c, 0xff, 0xff, 0xff, NULL }, + {0x3d, 0xff, 0xff, 0xff, NULL }, + {0x3e, 0xff, 0xff, 0xff, NULL }, + {0x3f, 0xff, 0xff, 0xff, NULL }, + +// dip1 + {0 , 0xfe, 0 , 3, "Max Bet" }, + {0x39, 0x01, 0x03, 0x03, "10" }, + {0x39, 0x01, 0x03, 0x02, "20" }, + {0x39, 0x01, 0x03, 0x01, "99" }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x39, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" }, + {0x39, 0x01, 0x1c, 0x18, "1 Coin 2 Credits" }, + {0x39, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x39, 0x01, 0x1c, 0x10, "1 Coin 4 Credits" }, + {0x39, 0x01, 0x1c, 0x0c, "1 Coin 5 Credits" }, + {0x39, 0x01, 0x1c, 0x08, "1 Coin/10 Credits" }, + {0x39, 0x01, 0x1c, 0x04, "1 Coin/20 Credits" }, + {0x39, 0x01, 0x1c, 0x00, "1 Coin/50 Credits" }, + +// dip2-3 + {0 , 0xfe, 0 , 4, "Betting Clock Speed" }, + {0x3a, 0x01, 0x18, 0x18, "Slowest" }, + {0x3a, 0x01, 0x18, 0x10, "Slower" }, + {0x3a, 0x01, 0x18, 0x08, "Faster" }, + {0x3a, 0x01, 0x18, 0x00, "Fastest" }, + + {0 , 0xfe, 0 , 16, "Payout Rate" }, + {0x3b, 0x01, 0x01, 0x01, "80%" }, + {0x3b, 0x01, 0x01, 0x01, "81%" }, + {0x3b, 0x01, 0x01, 0x01, "82%" }, + {0x3b, 0x01, 0x01, 0x01, "83%" }, + {0x3b, 0x01, 0x01, 0x01, "84%" }, + {0x3b, 0x01, 0x01, 0x01, "85%" }, + {0x3b, 0x01, 0x01, 0x01, "86%" }, + {0x3b, 0x01, 0x01, 0x01, "87%" }, + {0x3b, 0x01, 0x01, 0xe0, "88%" }, + {0x3b, 0x01, 0x01, 0xc0, "89%" }, + {0x3b, 0x01, 0x01, 0xa0, "90%" }, + {0x3b, 0x01, 0x01, 0x80, "91%" }, + {0x3b, 0x01, 0x01, 0x60, "92%" }, + {0x3b, 0x01, 0x01, 0x40, "93%" }, + {0x3b, 0x01, 0x01, 0x20, "94%" }, + {0x3b, 0x01, 0x01, 0x00, "95%" }, + + {0 , 0xfe, 0 , 2, "Payout" }, + {0x3b, 0x01, 0x04, 0x00, "Off" }, + {0x3b, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2, "Horses" }, + {0x3b, 0x01, 0x08, 0x08, "Random" }, + {0x3b, 0x01, 0x08, 0x00, "Cyclic" }, + + {0 , 0xfe, 0 , 2, "Higher Odds" }, + {0x3b, 0x01, 0x10, 0x10, "Off" }, + {0x3b, 0x01, 0x10, 0x00, "On" }, + +// overlay on p1/p2 + {0 , 0xfe, 0 , 2, "Coin Drop - 1P" }, + {0x3c, 0x01, 0x01, 0x01, "Off" }, + {0x3c, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Hopper Overflow - 1P" }, + {0x3c, 0x01, 0x02, 0x02, "Off" }, + {0x3c, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Out" }, + {0x3c, 0x01, 0x04, 0x00, "Off" }, + {0x3c, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2, "Att Pay - 1P" }, + {0x3c, 0x01, 0x08, 0x08, "Off" }, + {0x3c, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Sense 2 - 1P" }, + {0x3c, 0x01, 0x40, 0x40, "Off" }, + {0x3c, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Sense 1 - 1P" }, + {0x3c, 0x01, 0x80, 0x80, "Off" }, + {0x3c, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Drop - 2P" }, + {0x3d, 0x01, 0x01, 0x01, "Off" }, + {0x3d, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Sel Sense" }, + {0x3d, 0x01, 0x02, 0x02, "Off" }, + {0x3d, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Att Pay - 2P" }, + {0x3d, 0x01, 0x08, 0x08, "Off" }, + {0x3d, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Sense 2 - 2P" }, + {0x3d, 0x01, 0x40, 0x40, "Off" }, + {0x3d, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Sense 1 - 2P" }, + {0x3d, 0x01, 0x80, 0x80, "Off" }, + {0x3d, 0x01, 0x80, 0x00, "On" }, + +// p2 + {0 , 0xfe, 0 , 2, "SYSTEM" }, + {0x3e, 0x01, 0x02, 0x02, "Off" }, + {0x3e, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Tilt" }, + {0x3e, 0x01, 0x08, 0x08, "Off" }, + {0x3e, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Special Test Mode Item?" }, + {0x3f, 0x01, 0x04, 0x04, "Off" }, + {0x3f, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Call SW" }, + {0x3f, 0x01, 0x08, 0x08, "Off" }, + {0x3f, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x3f, 0x01, 0x10, 0x10, "Off" }, + {0x3f, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Analyzer" }, + {0x3f, 0x01, 0x20, 0x20, "Off" }, + {0x3f, 0x01, 0x20, 0x00, "On" }, +}; + +STDDIPINFO(Jockeyc) + +// d_seta2.cpp +//void __fastcall setaSoundRegWriteByte(UINT32 sekAddress, UINT8 byteValue); +void __fastcall setaSoundRegWriteWord(UINT32 sekAddress, UINT16 wordValue); +//UINT8 __fastcall setaSoundRegReadByte(UINT32 sekAddress); +UINT16 __fastcall setaSoundRegReadWord(UINT32 sekAddress); + +// these should probably be moved to x1010.cpp +static UINT8 __fastcall setaSoundRegReadByte(UINT32 sekAddress) +{ + if (~sekAddress & 1) { + return x1_010_chip->HI_WORD_BUF[(sekAddress & 0x3fff) >> 1]; + } else { + return x1010_sound_read_word((sekAddress & 0x3fff) >> 1); + } +} + +static void __fastcall setaSoundRegWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + UINT32 offset = (sekAddress & 0x00003fff) >> 1; + INT32 channel, reg; + + if (~sekAddress & 1) { + x1_010_chip->HI_WORD_BUF[ offset ] = byteValue; + } else { + offset ^= x1_010_chip->address; + channel = offset / sizeof(X1_010_CHANNEL); + reg = offset % sizeof(X1_010_CHANNEL); + + if (channel < SETA_NUM_CHANNELS && reg == 0 && (x1_010_chip->reg[offset] & 1) == 0 && (byteValue&1) != 0) { + x1_010_chip->smp_offset[channel] = 0; + x1_010_chip->env_offset[channel] = 0; + } + x1_010_chip->reg[offset] = byteValue; + } +} + +void x1010Reset() +{ + x1_010_chip->sound_enable = 1; // enabled by default? + memset (x1_010_chip->reg, 0, 0x2000); + memset (x1_010_chip->HI_WORD_BUF, 0, 0x2000); + memset (x1_010_chip->smp_offset, 0, SETA_NUM_CHANNELS * sizeof(INT32)); + memset (x1_010_chip->env_offset, 0, SETA_NUM_CHANNELS * sizeof(INT32)); + memset (x1_010_chip->sound_banks, 0, SETA_NUM_BANKS * sizeof(INT32)); +} + +void x1010Enable(INT32 data) +{ + x1_010_chip->sound_enable = data; +} + +static void set_pcm_bank(INT32 data) +{ + INT32 new_bank = (data >> 3) & 0x07; + + if (new_bank != seta_samples_bank) + { + INT32 samples_len = DrvROMLen[3]; + + seta_samples_bank = new_bank; + + if (samples_len == 0x200000 || samples_len == 0x180000) // eightfrc, blandia + { + INT32 addr = 0x40000 * new_bank; + if (new_bank >= 3) addr += 0x40000; + + if ((samples_len > 0x100000) && ((addr + 0x40000) <= samples_len)) + memcpy(DrvSndROM + 0xc0000, DrvSndROM + addr, 0x40000); + } + else if (samples_len == 0x400000) // zombraid + { + if (new_bank == 0) new_bank = 1; + INT32 addr = 0x80000 * new_bank; + if (new_bank > 0) addr += 0x80000; + + memcpy (DrvSndROM + 0x80000, DrvSndROM + addr, 0x80000); + } + } +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// macros + +#define SetaVidRAMCtrlWriteWord(num, base) \ + if ((address >= (base + 0)) && address <= (base + 5)) { \ + *((UINT16*)(DrvVIDCTRLRAM##num + (address & 0x06))) = BURN_ENDIAN_SWAP_INT16(data); \ + return; \ + } + +#define SetaVidRAMCtrlWriteByte(num, base) \ + if ((address >= (base + 0)) && (address <= (base + 5))) { \ + DrvVIDCTRLRAM##num[(address & 0x07)^1] = data; \ + return; \ + } + +#define SetVidRAMRegsWriteWord(base) \ + if ((address >= (base + 0)) && (address <= (base + 5))) { \ + *((UINT16*)(DrvVideoRegs + (address & 0x06))) = BURN_ENDIAN_SWAP_INT16(data); \ + if ((address - base) == 0) x1010Enable(data & 0x20); \ + if ((address - base) == 2) set_pcm_bank(data); \ + return; \ + } + +#define SetVidRAMRegsWriteByte(base) \ + if ((address >= (base + 0)) && (address <= (base + 5))) { \ + DrvVideoRegs[(address & 0x07)^1] = data; \ + return; \ + } + +#define SetaReadDips(base) \ + if (address >= (base + 0) && address <= (base + 3)) { \ + return DrvDips[((address - base)/2)^1]; \ + } + +//----------------------------------------------------------------------------------------------------------------------------------- +// drgnunit + +UINT16 __fastcall drgnunit_read_word(UINT32 address) +{ + SetaReadDips(0x600000) + + switch (address) + { + case 0xb00000: + return DrvInputs[0]; + + case 0xb00002: + return DrvInputs[1]; + + case 0xb00004: + return DrvInputs[2]^0xff^DrvDips[2]; + } + + return 0; +} + +UINT8 __fastcall drgnunit_read_byte(UINT32 address) +{ + SetaReadDips(0x600000) + + switch (address) + { + case 0xb00000: + case 0xb00001: + return DrvInputs[0]; + + case 0xb00002: + case 0xb00003: + return DrvInputs[1]; + + case 0xb00004: + case 0xb00005: + return DrvInputs[2]^0xff^DrvDips[2]; + } + + return 0; +} + +void __fastcall drgnunit_write_word(UINT32 address, UINT16 data) +{ + SetaVidRAMCtrlWriteWord(0, 0x800000) + + SetVidRAMRegsWriteWord(0x500000) +} + +void __fastcall drgnunit_write_byte(UINT32 address, UINT8 data) +{ + SetaVidRAMCtrlWriteByte(0, 0x800000) + + SetVidRAMRegsWriteByte(0x500000) +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// thunderl, wits + +UINT16 __fastcall thunderl_read_word(UINT32 address) +{ + SetaReadDips(0x600000) + + switch (address) + { + case 0xb00000: + case 0xb00001: + return DrvInputs[0]; + + case 0xb00002: + case 0xb00003: + return DrvInputs[1]; + + case 0xb00004: + case 0xb00005: + return DrvInputs[2]^0xff^DrvDips[2]; + + case 0xb00008: + case 0xb00009: + return DrvInputs[3]; + + case 0xb0000a: + case 0xb0000b: + return DrvInputs[4]; + + case 0xb0000c: + case 0xb0000d: + return 0x00dd;// thunderl_prot + } + + return 0; +} + +UINT8 __fastcall thunderl_read_byte(UINT32 address) +{ + SetaReadDips(0x600000) + + switch (address) + { + case 0xb00000: + case 0xb00001: + return DrvInputs[0]; + + case 0xb00002: + case 0xb00003: + return DrvInputs[1]; + + case 0xb00004: + case 0xb00005: + return DrvInputs[2]^0xff^DrvDips[2]; + + case 0xb00008: + case 0xb00009: + return DrvInputs[3]; + + case 0xb0000a: + case 0xb0000b: + return DrvInputs[4]; + + case 0xb0000c: + case 0xb0000d: + return 0xdd;// thunderl_prot + } + + return 0; +} + +void __fastcall thunderl_write_word(UINT32 address, UINT16 data) +{ + SetVidRAMRegsWriteWord(0x500000) +} + +void __fastcall thunderl_write_byte(UINT32 address, UINT8 data) +{ + SetVidRAMRegsWriteByte(0x500000) +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// daioh + +UINT16 __fastcall daioh_read_word(UINT32 address) +{ + SetaReadDips(0x300000) + SetaReadDips(0x400008) + SetaReadDips(0x600000) + + switch (address) + { + case 0x400000: + return DrvInputs[0]; + + case 0x400002: + return DrvInputs[1]; + + case 0x400004: + return DrvInputs[2]^0xff^DrvDips[2]; + + case 0x40000c: + watchdog = 0; + return 0xff; + + case 0x500006: + return DrvInputs[3]; + } + + return 0; +} + +UINT8 __fastcall daioh_read_byte(UINT32 address) +{ + SetaReadDips(0x300000) + SetaReadDips(0x400008) + SetaReadDips(0x600000) + + switch (address) + { + case 0x400000: + case 0x400001: + return DrvInputs[0]; + + case 0x400002: + case 0x400003: + return DrvInputs[1]; + + case 0x400004: + case 0x400005: + return DrvInputs[2]^0xff^DrvDips[2]; + + case 0x40000c: + case 0x40000d: + watchdog = 0; + return 0xff; + + case 0x500006: + case 0x500007: + return DrvInputs[3]; + } + + return 0; +} + +void __fastcall daioh_write_word(UINT32 address, UINT16 data) +{ + SetVidRAMRegsWriteWord(0x500000) + + SetaVidRAMCtrlWriteWord(0, 0x900000) // blandiap + SetaVidRAMCtrlWriteWord(0, 0x908000) // jjsquawkb + SetaVidRAMCtrlWriteWord(0, 0xa00000) // blandia + + SetaVidRAMCtrlWriteWord(1, 0x980000) // blandiap + SetaVidRAMCtrlWriteWord(1, 0x909000) // jjsquawkb + SetaVidRAMCtrlWriteWord(1, 0xa80000) // blandia + + switch (address) + { + case 0x400000: + case 0x40000c: + watchdog = 0; + return; + } +} + +void __fastcall daioh_write_byte(UINT32 address, UINT8 data) +{ + SetVidRAMRegsWriteByte(0x500000) + + SetaVidRAMCtrlWriteByte(0, 0x900000) // blandiap + SetaVidRAMCtrlWriteByte(0, 0x908000) // jjsquawkb + SetaVidRAMCtrlWriteByte(0, 0xa00000) // blandia + + SetaVidRAMCtrlWriteByte(1, 0x980000) // blandiap + SetaVidRAMCtrlWriteByte(1, 0x909000) // jjsquawkb + SetaVidRAMCtrlWriteByte(1, 0xa80000) // blandia + + switch (address) + { + case 0x400000: + case 0x400001: + case 0x40000c: + case 0x40000d: + watchdog = 0; + return; + } +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// msgundam + +void __fastcall msgundam_write_word(UINT32 address, UINT16 data) +{ + SetaVidRAMCtrlWriteWord(0, 0xb00000) + SetaVidRAMCtrlWriteWord(1, 0xb80000) + + switch (address) + { + case 0x500000: + case 0x500001: + *((UINT16*)(DrvVideoRegs + 0)) = data; + return; + case 0x500002: + case 0x500003: + *((UINT16*)(DrvVideoRegs + 4)) = data; + return; + + case 0x500004: + case 0x500005: + *((UINT16*)(DrvVideoRegs + 2)) = data; + return; + } +} + +void __fastcall msgundam_write_byte(UINT32 address, UINT8 data) +{ + SetaVidRAMCtrlWriteByte(0, 0xb00000) + SetaVidRAMCtrlWriteByte(1, 0xb80000) + + switch (address) + { + case 0x500000: + case 0x500001: + DrvVideoRegs[(~address & 0x01) | 0] = data; + return; + + case 0x500002: + case 0x500003: + DrvVideoRegs[(~address & 0x01) | 4] = data; + return; + + case 0x500004: + case 0x500005: + DrvVideoRegs[(~address & 0x01) | 2] = data; + // seta_vregs_w + return; + } +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// kamenrid + +UINT16 __fastcall kamenrid_read_word(UINT32 address) +{ + SetaReadDips(0x500004) + + switch (address) + { + case 0x500000: + return DrvInputs[0]; + + case 0x500002: + return DrvInputs[1]; + + case 0x500009: + return DrvInputs[2]^0xff^DrvDips[2]; + + case 0x50000c: + return 0xffff; // watchdog + } + + return 0; +} + +UINT8 __fastcall kamenrid_read_byte(UINT32 address) +{ + SetaReadDips(0x500004) + + switch (address) + { + case 0x500000: + case 0x500001: + return DrvInputs[0]; + + case 0x500002: + case 0x500003: + return DrvInputs[1]; + + case 0x500009: + case 0x50000a: + return DrvInputs[2]^0xff^DrvDips[2]; + + case 0x50000c: + case 0x50000d: + return 0xff; // watchdog + } + + return 0; +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// krzybowl, madshark + +static UINT16 krzybowl_input_read(INT32 offset) +{ + INT32 dir1x = 0x800; //input_port_read(space->machine, "TRACK1_X") & 0xfff; + INT32 dir1y = 0x800; //input_port_read(space->machine, "TRACK1_Y") & 0xfff; + INT32 dir2x = 0x800; //input_port_read(space->machine, "TRACK2_X") & 0xfff; + INT32 dir2y = 0x800; //input_port_read(space->machine, "TRACK2_Y") & 0xfff; + + switch ((offset & 0x0e) / 2) + { + case 0x0/2: return dir1x & 0xff; + case 0x2/2: return dir1x >> 8; + case 0x4/2: return dir1y & 0xff; + case 0x6/2: return dir1y >> 8; + case 0x8/2: return dir2x & 0xff; + case 0xa/2: return dir2x >> 8; + case 0xc/2: return dir2y & 0xff; + case 0xe/2: return dir2y >> 8; + } + + return 0; +} + +UINT16 __fastcall madshark_read_word(UINT32 address) +{ + SetaReadDips(0x300000) + SetaReadDips(0x500008) + + switch (address) + { + case 0x500000: + return DrvInputs[0]; + + case 0x500002: + return DrvInputs[1]; + + case 0x500004: + return DrvInputs[2]^0xff^DrvDips[2]; + + case 0x50000c: + watchdog = 0; + return 0xffff; + } + + if ((address & ~0x00000f) == 0x600000) { + return krzybowl_input_read(address); + } + + return 0; +} + +UINT8 __fastcall madshark_read_byte(UINT32 address) +{ + SetaReadDips(0x300000) + SetaReadDips(0x500008) + + switch (address) + { + case 0x500000: + case 0x500001: + return DrvInputs[0]; + + case 0x500002: + case 0x500003: + return DrvInputs[1]; + + case 0x500004: + case 0x500005: + return DrvInputs[2]^0xff^DrvDips[2]; + + case 0x50000c: + case 0x50000d: + watchdog = 0; + return 0xff; + } + + if ((address & ~0x00000f) == 0x600000) { + return krzybowl_input_read(address); + } + + return 0; +} + +void __fastcall madshark_write_word(UINT32 address, UINT16 data) +{ + SetVidRAMRegsWriteWord(0x600000) + SetaVidRAMCtrlWriteWord(0, 0x900000) + SetaVidRAMCtrlWriteWord(1, 0x980000) + + switch (address) + { + case 0x50000c: + watchdog = 0; + return; + } +} + +void __fastcall madshark_write_byte(UINT32 address, UINT8 data) +{ + SetVidRAMRegsWriteByte(0x600000) + SetaVidRAMCtrlWriteByte(0, 0x900000) + SetaVidRAMCtrlWriteByte(1, 0x980000) + + switch (address) + { + case 0x50000c: + case 0x50000d: + watchdog = 0; + return; + } +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// keroppi, pairlove + +static INT32 keroppi_prize_hop = 0; +static INT32 keroppi_protection_count = 0; +static INT32 keroppi_timer_frame = -1; +static const UINT16 keroppi_protection_word[] = { + 0x0000, + 0x0000, 0x0000, 0x0000, + 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, + 0x0400, 0x0400, 0x0400, + 0x0000, 0x0000, 0x0000 +}; + +static UINT16 pairslove_protram[0x100]; +static UINT16 pairslove_protram_old[0x100]; + +UINT16 __fastcall pairlove_read_word(UINT32 address) +{ + SetaReadDips(0x300000) + + switch (address) + { + case 0x100000: { // keroppi + INT32 res = keroppi_protection_word[keroppi_protection_count]; + keroppi_protection_count++; + if (keroppi_protection_count > 15) keroppi_protection_count = 15; + return res; + } + + case 0x200000: // keroppi + keroppi_protection_count = 0; + return 0x00; + + case 0x500000: + return DrvInputs[0]; + + case 0x500002: + return DrvInputs[1]; + + case 0x500004: { + INT32 res = DrvInputs[2]^0xff^DrvDips[2]; + + if (keroppi_prize_hop == 1 && keroppi_timer_frame != -1) { + if ((GetCurrentFrame() - keroppi_timer_frame) >= 3) { + keroppi_prize_hop = 2; + keroppi_timer_frame = - 1; + } + } + + if (keroppi_prize_hop == 2) { + res &= ~0x0002; + keroppi_prize_hop = 0; + } + return res; + } + } + + if ((address & 0xfffffe00) == 0x900000) { + INT32 offset = (address & 0x1ff) / 2; + + INT32 retdata = pairslove_protram[offset]; + pairslove_protram[offset]=pairslove_protram_old[offset]; + return retdata; + } + + return 0; +} + +UINT8 __fastcall pairlove_read_byte(UINT32 address) +{ + SetaReadDips(0x300000) + + switch (address) + { + case 0x100000: // keroppi + case 0x100001: { + INT32 res = keroppi_protection_word[keroppi_protection_count]; + keroppi_protection_count++; + if (keroppi_protection_count > 15) keroppi_protection_count = 15; + return res; + } + + case 0x200000: + case 0x200001: // keroppi + keroppi_protection_count = 0; + return 0x00; + + case 0x500000: + case 0x500001: + return DrvInputs[0]; + + case 0x500002: + case 0x500003: + return DrvInputs[1]; + + case 0x500004: + case 0x500005: { + INT32 res = DrvInputs[2]^0xff^DrvDips[2]; + + if (keroppi_prize_hop == 1 && keroppi_timer_frame != -1) { + if ((GetCurrentFrame() - keroppi_timer_frame) >= 3) { + keroppi_prize_hop = 2; + keroppi_timer_frame = -1; + } + } + + if (keroppi_prize_hop == 2) { + res &= ~0x0002; + keroppi_prize_hop = 0; + } + return res; + } + } + + if ((address & 0xfffffe00) == 0x900000) { + INT32 offset = (address & 0x1ff) / 2; + INT32 retdata = pairslove_protram[offset]; + pairslove_protram[offset]=pairslove_protram_old[offset]; + return retdata; + } + + return 0; +} + +void __fastcall pairlove_write_word(UINT32 address, UINT16 data) +{ + SetVidRAMRegsWriteWord(0x400000) + + switch (address) + { + case 0x900002: // keroppi + if ((data & 0x0010) && !keroppi_prize_hop) { + keroppi_prize_hop = 1; + keroppi_timer_frame = GetCurrentFrame(); + } + break; // for pairslove prot + } + + if ((address & 0xfffffe00) == 0x900000) { + INT32 offset = (address & 0x1ff) / 2; + pairslove_protram_old[offset]=pairslove_protram[offset]; + pairslove_protram[offset]=data; + return; + } +} + +void __fastcall pairlove_write_byte(UINT32 address, UINT8 data) +{ + SetVidRAMRegsWriteByte(0x400000) + + switch (address) + { + case 0x900002: + case 0x900003: // keroppi + if ((data & 0x0010) && !keroppi_prize_hop) { + keroppi_prize_hop = 1; + keroppi_timer_frame = GetCurrentFrame(); + } + break; // for pairslove prot + } + + if ((address & 0xfffffe00) == 0x900000) { + INT32 offset = (address & 0x1ff) / 2; + pairslove_protram_old[offset]=pairslove_protram[offset]; + pairslove_protram[offset]=data; + return; + } +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// downtown, metafox, twineagl, arbelester + +void __fastcall downtown_write_word(UINT32 address, UINT16 data) +{ + SetaVidRAMCtrlWriteWord(0, 0x800000) + + switch (address) + { + case 0x400000: + case 0x400002: + case 0x400004: + case 0x400006: + // tilebank[(address & 6) / 2] = data; + return; + + case 0xa00000: + case 0xa00002: + case 0xa00004: + case 0xa00006: + // sub_ctrl_w + return; + } +} + +void __fastcall downtown_write_byte(UINT32 address, UINT8 data) +{ + SetaVidRAMCtrlWriteByte(0, 0x800000) + + switch (address) + { + case 0x400000: + case 0x400001: + case 0x400002: + case 0x400003: + case 0x400004: + case 0x400005: + case 0x400006: + case 0x400007: + tilebank[(address & 6) / 2] = data; + return; + + case 0xa00000: + case 0xa00001: + case 0xa00002: + case 0xa00003: + case 0xa00004: + case 0xa00005: + case 0xa00006: + case 0xa00007: + // sub_ctrl_w + return; + } +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// kiwame + +static INT32 kiwame_inputs_read(INT32 offset) +{ + INT32 i; + INT32 row_select = DrvNVRAM[0x10b]; + + for (i = 0; i < 5; i++) + if (row_select & (1 << i)) break; + + switch (offset) + { + case 0: return DrvInputs[i+1]; + case 4: return DrvInputs[0]^0xff^DrvDips[2]; + case 2: + case 8: return 0xffff; + } + + return 0; +} + +UINT16 __fastcall kiwame_read_word(UINT32 address) +{ + switch (address) + { + case 0xe00000: + return DrvDips[1]; + + case 0xe00002: + return DrvDips[0]; + } + + if ((address & 0xfffff0) == 0xd00000) { + return kiwame_inputs_read(address & 0x0e); + } + if ((address & 0xfffc00) == 0xfffc00) { + // bprintf (0, _T("%5.5x, rw\n"), address); + return DrvNVRAM[(address & 0x3fe)]; + } + + return 0; +} + +UINT8 __fastcall kiwame_read_byte(UINT32 address) +{ + switch (address) + { + case 0xe00000: + case 0xe00001: + return DrvDips[1]; + + case 0xe00002: + case 0xe00003: + return DrvDips[0]; + } + + if ((address & 0xfffff0) == 0xd00000) { + return kiwame_inputs_read(address & 0x0e); + } + + if ((address & 0xfffc01) == 0xfffc01) { + return DrvNVRAM[(address & 0x3fe)]; + } + + return 0; +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// zombraid gun handler + +static INT32 zombraid_gun_read() +{ + return (DrvAnalogInput[gun_input_src] >> gun_input_bit) & 1; +} + +static void zombraid_gun_write(INT32 data) +{ + static INT32 bit_count = 0, old_clock = 0; + + if(data&4) { bit_count = 0; return; } // Reset + + if((data&1) == old_clock) return; // No change + + if (old_clock == 0) // Rising edge + { + switch (bit_count) + { + case 0: + case 1: // Starting sequence 2,3,2,3. Other inputs? + break; + + case 2: // First bit of source + gun_input_src = (gun_input_src&2) | (data>>1); + break; + + case 3: // Second bit of source + gun_input_src = (gun_input_src&1) | (data&2); + break; + + default: + // "Player1_Gun_Recoil", (data & 0x10)>>4 + // "Player2_Gun_Recoil", (data & 0x08)>>3 + gun_input_bit = bit_count - 4; + gun_input_bit = 8 - gun_input_bit; // Reverse order + break; + } + bit_count++; + } + + old_clock = data & 1; +} + +void __fastcall zombraid_gun_write_word(UINT32 address, UINT16 data) +{ + if ((address & ~1) == 0xf00000) zombraid_gun_write(data); +} + +void __fastcall zombraid_gun_write_byte(UINT32 address, UINT8 data) +{ + if ((address & ~1) == 0xf00000) zombraid_gun_write(data); +} + +UINT16 __fastcall zombraid_gun_read_word(UINT32 ) +{ + return zombraid_gun_read(); +} + +UINT8 __fastcall zombraid_gun_read_byte(UINT32 ) +{ + return zombraid_gun_read(); +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// utoukond sound handler + +void __fastcall utoukond_sound_write(UINT16 address, UINT8 data) +{ + if (address >= 0xf000) { + setaSoundRegWriteByte((address & 0xfff) * 2 + 1, data); + } +} + +UINT8 __fastcall utoukond_sound_read(UINT16 address) +{ + if (address >= 0xf000) { + return x1010_sound_read(address & 0xfff); + } + return 0; +} + +void __fastcall utoukond_sound_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + BurnYM3438Write(0, port & 3, data); + return; + } +} + +UINT8 __fastcall utoukond_sound_read_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + return BurnYM3438Read(0, port & 3);// right? + + case 0xc0: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// wiggie / superbar sound handler + +void __fastcall wiggie_sound_write_word(UINT32 , UINT16 ) +{ + +} + +void __fastcall wiggie_sound_write_byte(UINT32 address, UINT8 data) +{ + if (address != 0xb00008 && address != 0xc00000) return; // wiggie + + *soundlatch = data; + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); +} + +void __fastcall wiggie_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x9800: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall wiggie_sound_read(UINT16 address) +{ + switch (address) + { + case 0x9800: + return MSM6295ReadStatus(0); + + case 0xa000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// usclssic + +void __fastcall usclssic_write_word(UINT32 address, UINT16 data) +{ + SetaVidRAMCtrlWriteWord(0, 0xa00000) + + switch (address) + { + case 0xb40000: + usclssic_port_select = (data & 0x40) >> 6; + tile_offset[0] = (data & 0x10) << 10; + // coin lockout too... + return; + + case 0xb40010: + *soundlatch = data; + return; + + case 0xb40018: + watchdog = 0; + return; + } +} + +void __fastcall usclssic_write_byte(UINT32 address, UINT8 data) +{ + SetaVidRAMCtrlWriteByte(0, 0xa00000) + + switch (address) + { + case 0xb40000: + case 0xb40001: + usclssic_port_select = (data & 0x40) >> 6; + tile_offset[0] = (data & 0x10) << 10; + // coin lockout too... + return; + + case 0xb40010: + case 0xb40011: + *soundlatch = data; + return; + + case 0xb40018: + case 0xb40019: + watchdog = 0; + return; + } +} + +static UINT8 uclssic_trackball_read(INT32 offset) +{ + const UINT16 start_vals[2] = { 0xf000, 0x9000 }; + + UINT16 ret = DrvInputs[1 + ((offset & 4)/4) + (usclssic_port_select * 2)] ^ start_vals[(offset / 4) & 1]; + + if (offset & 2) ret >>= 8; + + return ret ^ 0xff; +} + +UINT16 __fastcall usclssic_read_word(UINT32 address) +{ + switch (address) + { + case 0xb40000: + case 0xb40002: + case 0xb40004: + case 0xb40006: + return uclssic_trackball_read(address); + + case 0xb40010: + return DrvInputs[0] ^ 0xf0; + + case 0xb40018: + return DrvDips[1] & 0x0f; + + case 0xb4001a: + return DrvDips[1] >> 4; + + case 0xb4001c: + return DrvDips[0] & 0x0f; + + case 0xb4001e: + return DrvDips[0] >> 4; + } + + return 0; +} + +UINT8 __fastcall usclssic_read_byte(UINT32 address) +{ + switch (address) + { + case 0xb40000: + case 0xb40001: + case 0xb40002: + case 0xb40003: + case 0xb40004: + case 0xb40005: + case 0xb40006: + case 0xb40007: + return uclssic_trackball_read(address); + + case 0xb40010: + case 0xb40011: + return DrvInputs[0] ^ 0xf0; + + case 0xb40018: + case 0xb40019: + return DrvDips[1] & 0x0f; + + case 0xb4001a: + case 0xb4001b: + return DrvDips[1] >> 4; + + case 0xb4001c: + case 0xb4001d: + return DrvDips[0] & 0x0f; + + case 0xb4001e: + case 0xb4001f: + return DrvDips[0] >> 4; + } + + return 0; +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// calibr50 + +static UINT16 calibr50_input_read(INT32 offset) +{ + INT32 dir1 = 0; // analog port + INT32 dir2 = 0; // analog port + + switch (offset & 0x1e) + { + case 0x00: return DrvInputs[0]; // p1 + case 0x02: return DrvInputs[1]; // p2 + case 0x08: return DrvInputs[2]^0xff^DrvDips[2]; // Coins + case 0x10: return (dir1 & 0xff); // lower 8 bits of p1 rotation + case 0x12: return (dir1 >> 8); // upper 4 bits of p1 rotation + case 0x14: return (dir2 & 0xff); // lower 8 bits of p2 rotation + case 0x16: return (dir2 >> 8); // upper 4 bits of p2 rotation + case 0x18: return 0xffff; // ? (value's read but not used) + } + + return 0; +} + +UINT16 __fastcall calibr50_read_word(UINT32 address) +{ + switch (address) + { + case 0x400000: + case 0x400001: + watchdog = 0; + return 0xffff; + } + + if ((address & 0xfffffe0) == 0xa00000) { + return calibr50_input_read(address); + } + + SetaReadDips(0x600000) + + return 0; +} + +UINT8 __fastcall calibr50_read_byte(UINT32 address) +{ + switch (address) + { + case 0x400000: + case 0x400001: + watchdog = 0; + return 0xff; + + case 0xb00000: + case 0xb00001: + static INT32 ret; // fake read from sound cpu + ret ^= 0x80; + return ret; + } + + if ((address & 0xfffffe0) == 0xa00000) { + return calibr50_input_read(address) >> ((~address & 1) << 3); + } + + SetaReadDips(0x600000) + + return 0; +} + +void __fastcall calibr50_write_word(UINT32 address, UINT16 data) +{ + SetaVidRAMCtrlWriteWord(0, 0x800000) + + if ((address & ~1) == 0xb00000) { + *soundlatch = data; + return; + } +} + +void __fastcall calibr50_write_byte(UINT32 address, UINT8 data) +{ + SetaVidRAMCtrlWriteByte(0, 0x800000) + + if ((address & ~1) == 0xb00000) { + *soundlatch = data; + return; + } +} + +//----------------------------------------------------------------------------------------------------------------------------------- +// downtown protection handler, m65c02 simulation (metafox, arbelester) + +static UINT8 *downtown_protram; + +UINT8 __fastcall downtown_prot_read(UINT32 address) +{ + if (downtown_protram[0xf8] == 0xa3) { + if (address >= 0x200100 && address <= 0x20010b) { + char *waltz = "WALTZ0"; + return waltz[(address & 0x0f) / 2]; + } else { + return 0; + } + } + + return downtown_protram[(address & 0x1ff)^1]; +} + +static inline UINT8 simulation_input_return(UINT8 inputs, INT32 a0, INT32 a1, INT32 a2, INT32 a3) +{ + UINT8 ret = 0; + if (inputs & a0 ) ret |= 0x01; // right + if (inputs & a1 ) ret |= 0x02; // left + if (inputs & a2 ) ret |= 0x04; // up + if (inputs & a3 ) ret |= 0x08; // down + if (inputs & 0x10) ret |= 0x10; // button 1 + if (inputs & 0x20) ret |= 0x20; // button 2 + if (inputs & 0x20) ret |= 0x40; // button 3 + if (inputs & 0x80) ret |= 0x80; // start + + if ((ret & 0x0c) == 0x0c) ret &= ~0x0c; // clear opposites + if ((ret & 0x03) == 0x03) ret &= ~0x03; + + return ret; +} + +UINT8 __fastcall metafox_sharedram_read_byte(UINT32 address)// metafox input simulation +{ + static INT32 coin_read = 0; + INT32 inputs0 = DrvInputs[0]^0xffff; + INT32 inputs1 = DrvInputs[1]^0xffff; + INT32 inputs2 = (DrvInputs[2]^0xff^DrvDips[2])^0xffff; + + INT32 offset = address & 0xffe; + + if (offset == 0x014) { // handle start input... + DrvShareRAM[offset] = 0; + if (inputs0 & 0x80) DrvShareRAM[0x14] |= 0x04; // start 1 pressed + if (inputs1 & 0x80) DrvShareRAM[0x14] |= 0x08; // start 2 pressed + if (inputs2 & 0x20) DrvShareRAM[0x14] |= 0x10; // service + if (inputs2 & 0x10) DrvShareRAM[0x14] |= 0x20; // tilt + + static INT32 nPreviousStart0, nPreviousStart1; + INT32 nCurrentStart0 = inputs0 & 0x80; + INT32 nCurrentStart1 = inputs1 & 0x80; + if ((nCurrentStart0 != nPreviousStart0) && !nCurrentStart0) { + if (DrvShareRAM[0x68] && coin_read) { + DrvShareRAM[0x68]--; + coin_read = 0; + } + } + if ((nCurrentStart1 != nPreviousStart1) && !nCurrentStart1) { + if (DrvShareRAM[0x68] && coin_read) { + DrvShareRAM[0x68]--; + coin_read = 0; + } + } + nPreviousStart0 = nCurrentStart0; + nPreviousStart1 = nCurrentStart1; + } + + if (offset == 0x00a) { // player 1 inputs... + DrvShareRAM[offset] = simulation_input_return(inputs0, 8, 4, 1, 2); + } + + if (offset == 0x010) { // player 2 inputs... + DrvShareRAM[offset] = simulation_input_return(inputs1, 8, 4, 1, 2); + } + + if (offset == 0x068) { // coin1 & coin2 (needs coinage dips added) + static INT32 nPreviousCoin0, nPreviousCoin1; + INT32 nCurrentCoin0 = inputs2 & 0x80; + INT32 nCurrentCoin1 = inputs2 & 0x40; + if (nPreviousCoin0 != nCurrentCoin0) DrvShareRAM[0x068] += ((nCurrentCoin0 >> 7) & 1); + if (nPreviousCoin1 != nCurrentCoin1) DrvShareRAM[0x068] += ((nCurrentCoin1 >> 6) & 1); + if (DrvShareRAM[0x68] > 9) DrvShareRAM[0x68] = 9; + nPreviousCoin0 = nCurrentCoin0; + nPreviousCoin1 = nCurrentCoin1; + coin_read = 1; + } + + return DrvShareRAM[offset]; +} + +UINT16 __fastcall metafox_sharedram_read_word(UINT32 address) +{ + return metafox_sharedram_read_byte(address); +} + +UINT8 __fastcall tndrcade_sharedram_read_byte(UINT32 address) // tndrcade input simulation +{ + static INT32 coin_read = 0; + INT32 inputs0 = DrvInputs[0]^0xffff; + INT32 inputs1 = DrvInputs[1]^0xffff; + INT32 inputs2 = (DrvInputs[2]^0xff^DrvDips[2])^0xffff; + + INT32 offset = address & 0xffe; + + if (offset >= 0x1c0 && offset <= 0x1de) { // these are read often, the game refuses to boot without the proper sequence + if (tndrcade_init_sim > 0 && tndrcade_init_sim <= 4) { + DrvShareRAM[offset] = ((((offset - 0x1c0) / 2) * 0x0f) + 3) - (tndrcade_init_sim-1); + if (offset == 0x1de) tndrcade_init_sim++; + } else { + DrvShareRAM[offset] = ((offset & 0x1f) / 2) | (((offset & 0x1f) / 2) << 4); + if (offset == 0x1dc) tndrcade_init_sim++; + } + } + + if (offset == 0x002) return 0x31; // or error + if (offset == 0x09a) return DrvDips[1] ^ 0xff; // ? + if (offset == 0x09c) return DrvDips[0] ^ 0xff; + + if (offset == 0x014) { // handle start input... + DrvShareRAM[0x14] = 0; + if (inputs0 & 0x80) DrvShareRAM[0x14] |= 0x04; // start 1 pressed + if (inputs1 & 0x80) DrvShareRAM[0x14] |= 0x08; // start 2 pressed + if (inputs2 & 0x20) DrvShareRAM[0x14] |= 0x10; // service + if (inputs2 & 0x10) DrvShareRAM[0x14] |= 0x20; // tilt + + static INT32 nPreviousStart0, nPreviousStart1; + INT32 nCurrentStart0 = inputs0 & 0x80; + INT32 nCurrentStart1 = inputs1 & 0x80; + if ((nCurrentStart0 != nPreviousStart0) && !nCurrentStart0) { + if (DrvShareRAM[0x68] && coin_read) { + DrvShareRAM[0x68]--; + coin_read = 0; + } + } + if ((nCurrentStart1 != nPreviousStart1) && !nCurrentStart1) { + if (DrvShareRAM[0x68] && coin_read) { + DrvShareRAM[0x68]--; + coin_read = 0; + } + } + nPreviousStart0 = nCurrentStart0; + nPreviousStart1 = nCurrentStart1; + } + + if (offset == 0x00a) { // player 1 inputs... + DrvShareRAM[offset] = simulation_input_return(inputs0, 2, 1, 4, 8); + } + + if (offset == 0x010) { // player 2 inputs... + DrvShareRAM[offset] = simulation_input_return(inputs1, 2, 1, 4, 8); + } + + if (offset == 0x068) { // coin1 & coin2 (needs coinage dips added) + static INT32 nPreviousCoin0, nPreviousCoin1; + INT32 nCurrentCoin0 = inputs2 & 0x01; + INT32 nCurrentCoin1 = inputs2 & 0x02; + if (nPreviousCoin0 != nCurrentCoin0) DrvShareRAM[offset] += ((nCurrentCoin0 >> 0) & 1); + if (nPreviousCoin1 != nCurrentCoin1) DrvShareRAM[offset] += ((nCurrentCoin1 >> 1) & 1); + if (DrvShareRAM[offset] > 9) DrvShareRAM[offset] = 9; + nPreviousCoin0 = nCurrentCoin0; + nPreviousCoin1 = nCurrentCoin1; + coin_read = 1; + } + + return DrvShareRAM[(address & 0xffe)]; +} + +UINT16 __fastcall tndrcade_sharedram_read_word(UINT32 address) +{ + return tndrcade_sharedram_read_byte(address); +} + +UINT8 __fastcall downtown_sharedram_read_byte(UINT32 address) // downtown input simulation +{ +//bprintf (0, _T("%5.5x\n"), address); + static INT32 coin_read = 0; + INT32 inputs0 = DrvInputs[0]^0xffff; + INT32 inputs1 = DrvInputs[1]^0xffff; + INT32 inputs2 = (DrvInputs[2]^0xff^DrvDips[2])^0xffff; + INT32 offset = address & 0xffe; + + if (offset == 0x002) DrvShareRAM[offset] = 0x31; // or ERROR COM RAM + + if (offset == 0x070) { // coin1 & coin2 + static INT32 nPreviousCoin0, nPreviousCoin1; + INT32 nCurrentCoin0 = inputs2 & 0x80; + INT32 nCurrentCoin1 = inputs2 & 0x40; + if (nPreviousCoin0 != nCurrentCoin0) DrvShareRAM[offset] += ((nCurrentCoin0 >> 7) & 1); + if (nPreviousCoin1 != nCurrentCoin1) DrvShareRAM[offset] += ((nCurrentCoin1 >> 6) & 1); + if (DrvShareRAM[offset] > 9) DrvShareRAM[offset] = 9; + nPreviousCoin0 = nCurrentCoin0; + nPreviousCoin1 = nCurrentCoin1; + coin_read = 1; + } + + if (offset == 0x0d4) { // service button & tilt + DrvShareRAM[offset] = 0xf7; // player 1 rotation high + if (inputs2 & 0x10) DrvShareRAM[offset] ^= 0x10; + if (inputs2 & 0x20) DrvShareRAM[offset] ^= 0x20; + } + + if (offset == 0x0d6) DrvShareRAM[offset] = 0xff; // player 1 rotation low + if (offset == 0x0d8) DrvShareRAM[offset] = ~simulation_input_return(inputs0, 1, 2, 4, 8); // player 1 inputs... + if (offset == 0x0dc) DrvShareRAM[offset] = 0x0f; // player 2 rotation high + if (offset == 0x0de) DrvShareRAM[offset] = 0xbf; // player 2 rotation low + if (offset == 0x0e0) DrvShareRAM[offset] = ~simulation_input_return(inputs1, 1, 2, 4, 8); // player 2 inputs... + + if (offset >= 0x1c0 && offset <= 0x1de) { // these are read often, the game refuses to boot without the proper sequence + if (tndrcade_init_sim <= 1) { + DrvShareRAM[offset] = ((((offset - 0x1c0) / 2) * 0x0f) + 1) - tndrcade_init_sim; + if (offset == 0x1de) tndrcade_init_sim++; + } else { + DrvShareRAM[offset] = ((offset & 0x1f) / 2) | (((offset & 0x1f) / 2) << 4); + if (offset == 0x1dc) tndrcade_init_sim++; + } + } + + return DrvShareRAM[offset]; +} + +UINT16 __fastcall downtown_sharedram_read_word(UINT32 address) +{ + downtown_sharedram_read_byte(address & 0xffe); + return DrvShareRAM[address & 0xffe]; // +} + +UINT8 __fastcall twineagl_sharedram_read_byte(UINT32 address) // twineagl input simulation +{ + static INT32 coin_read = 0; + INT32 inputs0 = DrvInputs[0]^0xffff; + INT32 inputs1 = DrvInputs[1]^0xffff; + INT32 inputs2 = (DrvInputs[2]^0xff^DrvDips[2])^0xffff; + INT32 offset = address & 0xffe; + + if (offset == 0x000) DrvShareRAM[offset] = 0x00; + if (offset == 0x002) DrvShareRAM[offset] = 0x31; // or ERROR COM RAM + + if (offset == 0x00a) { // player 1 inputs... + DrvShareRAM[offset] = simulation_input_return(inputs0, 2, 1, 4, 8); + } + + if (offset == 0x010) { // player 2 inputs... + DrvShareRAM[offset] = simulation_input_return(inputs1, 2, 1, 4, 8); + } + + if (offset == 0x014) { // handle start input... + DrvShareRAM[offset] = 0; + if (inputs0 & 0x80) DrvShareRAM[offset] |= 0x04; // start 1 pressed + if (inputs1 & 0x80) DrvShareRAM[offset] |= 0x08; // start 2 pressed + if (inputs2 & 0x20) DrvShareRAM[offset] |= 0x10; // service + if (inputs2 & 0x10) DrvShareRAM[offset] |= 0x20; // tilt + + static INT32 nPreviousStart0, nPreviousStart1; + INT32 nCurrentStart0 = inputs0 & 0x80; + INT32 nCurrentStart1 = inputs1 & 0x80; + if ((nCurrentStart0 != nPreviousStart0) && !nCurrentStart0) { + if (DrvShareRAM[0x68] && coin_read) { + DrvShareRAM[0x68]--; + coin_read = 0; + } + } + if ((nCurrentStart1 != nPreviousStart1) && !nCurrentStart1) { + if (DrvShareRAM[0x68] > 1 && coin_read) { + DrvShareRAM[0x68]-=2; + coin_read = 0; + } + } + nPreviousStart0 = nCurrentStart0; + nPreviousStart1 = nCurrentStart1; + } + + if (offset == 0x068) { // coin1 & coin2 + static INT32 nPreviousCoin0, nPreviousCoin1; + INT32 nCurrentCoin0 = inputs2 & 0x01; + INT32 nCurrentCoin1 = inputs2 & 0x02; + if (nPreviousCoin0 != nCurrentCoin0) DrvShareRAM[offset] += ((nCurrentCoin0 >> 0) & 1); + if (nPreviousCoin1 != nCurrentCoin1) DrvShareRAM[offset] += ((nCurrentCoin1 >> 1) & 1); + if (DrvShareRAM[offset] > 9) DrvShareRAM[offset] = 9; + nPreviousCoin0 = nCurrentCoin0; + nPreviousCoin1 = nCurrentCoin1; + coin_read = 1; + } + + if (offset == 0x0a8) { // more start inputs... + if (coin_read && ((inputs0 & 0x80) || (inputs1 & 0x80))) { + DrvShareRAM[offset] = 0; + if (inputs0 & 0x80) DrvShareRAM[offset] |= 0x04; // start 1 pressed + if (inputs1 & 0x80) DrvShareRAM[offset] |= 0x08; // start 2 pressed + } + } + + if (offset >= 0x1c0 && offset <= 0x1de) { // these are read often, the game refuses to boot without the proper sequence + if (tndrcade_init_sim <= 1) { + DrvShareRAM[offset] = ((((offset - 0x1c0) / 2) * 0x0f) + 1) - tndrcade_init_sim; + if (offset == 0x1de) tndrcade_init_sim++; + } else { + DrvShareRAM[offset] = ((offset & 0x1f) / 2) | (((offset & 0x1f) / 2) << 4); + if (offset == 0x1dc) tndrcade_init_sim++; + } + } + + return DrvShareRAM[offset]; +} + +UINT16 __fastcall twineagl_sharedram_read_word(UINT32 address) +{ + INT32 offset = address & 0xffe; + twineagl_sharedram_read_byte(offset); + return DrvShareRAM[offset]; +} + +void __fastcall twineagl_sharedram_write_word(UINT32 address, UINT16 data) +{ + INT32 offset = address & 0xffe; + + data &= 0xff; + + DrvShareRAM[offset] = data; + + if (offset == 0x400 && data) { + INT32 ofst = 0; + + for (INT32 i = 0; i < 0x100; i+=16) { + if (DrvShareRAM[i + 0x200] == 0) { + ofst = i + 0x200; + break; + } + } + if (ofst == 0) return; + + // add to playlist + { + INT32 ofst2 = (DrvShareRAM[offset] * 0x0b) + 0x204; // find song data in m65c02 rom (correct?) + + DrvShareRAM[ofst + 0] = 0x81; + DrvShareRAM[ofst + 2] = DrvSubROM[ofst2 + 0]; + DrvShareRAM[ofst + 4] = DrvSubROM[ofst2 + 1]; + DrvShareRAM[ofst + 8] = DrvSubROM[ofst2 + 2]; + } + } +} + +void __fastcall twineagl_sharedram_write_byte(UINT32 address, UINT8 data) +{ + twineagl_sharedram_write_word(address, data); +} + + +//----------------------------------------------------------------------------------------------------------------------------------- +// crazy fight + +UINT16 __fastcall crazyfgt_read_word(UINT32 address) +{ + switch (address) + { + case 0x610000: + case 0x610001: + return DrvInputs[0]; + + case 0x610002: + case 0x610003: + return 0xffff; + + case 0x610004: + case 0x610005: + return DrvInputs[1]; + } + + SetaReadDips(0x630000) + + return 0; +} + +UINT8 __fastcall crazyfgt_read_byte(UINT32 address) +{ + switch (address) + { + case 0x610000: + case 0x610001: + return DrvInputs[0]; + + case 0x610002: + case 0x610003: + return 0xff; + + case 0x610004: + case 0x610005: + return DrvInputs[1]; + } + + SetaReadDips(0x630000) + + return 0; +} + +void __fastcall crazyfgt_write_byte(UINT32 address, UINT8 data) +{ + SetaVidRAMCtrlWriteByte(1, 0x900000) + SetaVidRAMCtrlWriteByte(0, 0x980000) + + switch (address) + { + case 0x650000: + case 0x650001: + BurnYM3812Write(0, data); + return; + + case 0x658000: + case 0x658001: + MSM6295Command(0, data); + return; + } +} + +void __fastcall crazyfgt_write_word(UINT32 address, UINT16 data) +{ + SetaVidRAMCtrlWriteWord(1, 0x900000) + SetaVidRAMCtrlWriteWord(0, 0x980000) + + switch (address) + { + case 0x650000: + case 0x650001: + BurnYM3812Write(0, data); + return; + + case 0x658000: + case 0x658001: + MSM6295Command(0, data); + return; + } +} + + +//----------------------------------------------------------------------------------------------------------------------------------- +// 68k initializers + +static void drgnunit68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0bffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x700000, 0x7003ff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x900000, 0x903fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xf00000, 0xf0ffff, SM_RAM); + SekMapMemory(Drv68KRAM + 0x0010000, 0xffc000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, drgnunit_write_word); + SekSetWriteByteHandler(0, drgnunit_write_byte); + SekSetReadWordHandler(0, drgnunit_read_word); + SekSetReadByteHandler(0, drgnunit_read_byte); + + SekMapHandler(1, 0x100000, 0x103fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); +} + +static void daioh68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(Drv68KRAM + 0x0010000, 0x700000, 0x7003ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); + SekMapMemory(Drv68KRAM2, 0x701000, 0x70ffff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x800000, 0x80ffff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x880000, 0x88ffff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(Drv68KRAM + 0x0020000, 0xa80000, 0xa803ff, SM_WRITE); // nop out + SekMapMemory(DrvSprRAM1, 0xb00000, 0xb13fff, SM_RAM); + SekSetWriteWordHandler(0, daioh_write_word); + SekSetWriteByteHandler(0, daioh_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); +} + +static void wrofaero68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x21ffff, SM_RAM); + SekMapMemory(Drv68KRAM2, 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x7003ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0011000, 0x701000, 0x70ffff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x800000, 0x80ffff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x880000, 0x88ffff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xb00000, 0xb13fff, SM_RAM); + SekSetWriteWordHandler(0, daioh_write_word); + SekSetWriteByteHandler(0, daioh_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); +} + +static void msgundam68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + + for (INT32 i = 0; i < 0x80000; i+=0x10000) // mirrored + SekMapMemory(Drv68KRAM, 0x200000+i, 0x20ffff+i, SM_RAM); + + SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0x800000, 0x800607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0x900000, 0x903fff, SM_RAM); + + SekMapMemory(DrvVidRAM0, 0xa00000, 0xa0ffff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0xa80000, 0xa8ffff, SM_RAM); + SekSetWriteWordHandler(0, msgundam_write_word); + SekSetWriteByteHandler(0, msgundam_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); +} + +static void umanclub68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x300000, 0x300fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xb00000, 0xb03fff, SM_RAM); + SekSetWriteWordHandler(0, daioh_write_word); + SekSetWriteByteHandler(0, daioh_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); +} + +static void kamenrid68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x7003ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0011000, 0x701000, 0x703fff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x800000, 0x807fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x880000, 0x887fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xb00000, 0xb07fff, SM_RAM); + SekSetWriteWordHandler(0, madshark_write_word); + SekSetWriteByteHandler(0, madshark_write_byte); + SekSetReadWordHandler(0, kamenrid_read_word); + SekSetReadByteHandler(0, kamenrid_read_byte); + + SekMapHandler(1, 0xd00000, 0xd03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); + + { + DrvGfxROM2 = DrvGfxROM1 + 0x80000; + DrvROMLen[2] = DrvROMLen[1] = DrvROMLen[1] / 2; + memcpy (DrvGfxROM2, DrvGfxROM1 + 0x40000, 0x40000); + } +} + +static void madshark68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x7003ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0011000, 0x701000, 0x703fff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x800000, 0x807fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x880000, 0x887fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xb00000, 0xb07fff, SM_RAM); + SekSetWriteWordHandler(0, madshark_write_word); + SekSetWriteByteHandler(0, madshark_write_byte); + SekSetReadWordHandler(0, madshark_read_word); + SekSetReadByteHandler(0, madshark_read_byte); + + SekMapHandler(1, 0xd00000, 0xd03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); + + { + DrvGfxROM2 = (UINT8*)BurnMalloc(0x200000); + DrvROMLen[1] = DrvROMLen[2] = 0x200000; + + memcpy (DrvGfxROM0 + 0x200000, DrvGfxROM0 + 0x000000, 0x100000); + memcpy (DrvGfxROM0 + 0x000000, DrvGfxROM0 + 0x100000, 0x200000); + + memcpy (DrvGfxROM2 + 0x000000, DrvGfxROM1 + 0x100000, 0x100000); + memcpy (DrvGfxROM2 + 0x100000, DrvGfxROM1 + 0x300000, 0x100000); + memcpy (DrvGfxROM1 + 0x100000, DrvGfxROM1 + 0x200000, 0x100000); + } +} + +static void thunderl68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x00ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x700000, 0x700fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xe00000, 0xe07fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xffc000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, thunderl_write_word); + SekSetWriteByteHandler(0, thunderl_write_byte); + SekSetReadWordHandler(0, thunderl_read_word); + SekSetReadByteHandler(0, thunderl_read_byte); + + SekMapHandler(1, 0x100000, 0x103fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); +} + +static void atehate68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x700000, 0x700fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x900000, 0x9fffff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); + SekSetWriteWordHandler(0, thunderl_write_word); + SekSetWriteByteHandler(0, thunderl_write_byte); + SekSetReadWordHandler(0, thunderl_read_word); + SekSetReadByteHandler(0, thunderl_read_byte); + + SekMapHandler(1, 0x100000, 0x103fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); +} + +static void blockcar68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0xb00000, 0xb00fff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xc00000, 0xc03fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xe00000, 0xe00607 | 0x7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xf00000, 0xf05fff, SM_RAM); + SekSetWriteWordHandler(0, thunderl_write_word); + SekSetWriteByteHandler(0, thunderl_write_byte); + SekSetReadWordHandler(0, madshark_read_word); + SekSetReadByteHandler(0, madshark_read_byte); + + SekMapHandler(1, 0xa00000, 0xa03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); + + memcpy (DrvSndROM + 0x80000, DrvSndROM, 0x80000); +} + +static void zombraid68kInit() +{ + wrofaero68kInit(); + + SekOpen(0); + SekMapHandler(2, 0xf00000, 0xf00003, SM_READ | SM_WRITE); + SekSetReadWordHandler (2, zombraid_gun_read_word); + SekSetReadByteHandler (2, zombraid_gun_read_byte); + SekSetWriteWordHandler(2, zombraid_gun_write_word); + SekSetWriteByteHandler(2, zombraid_gun_write_byte); + SekClose(); + + memcpy (DrvSndROM + 0x100000, DrvSndROM + 0x080000, 0x280000); +} + +static void BlandiaGfxRearrange() +{ + INT32 rom_size = DrvROMLen[1]; + UINT8 *buf = (UINT8*)BurnMalloc(rom_size); + + UINT8 *rom = DrvGfxROM1 + 0x40000; + + if (rom_size == 0x100000) memcpy (rom, rom + 0x40000, 0x80000); // blandia + + for (INT32 rpos = 0; rpos < 0x80000/2; rpos++) { + buf[rpos+0x40000] = rom[rpos*2]; + buf[rpos] = rom[rpos*2+1]; + } + + memcpy (rom, buf, 0x80000); + + rom = DrvGfxROM2 + 0x40000; + + if (rom_size == 0x100000) memcpy (rom, rom + 0x40000, 0x80000); // blandia + + for (INT32 rpos = 0; rpos < 0x80000/2; rpos++) { + buf[rpos+0x40000] = rom[rpos*2]; + buf[rpos] = rom[rpos*2+1]; + } + + memcpy (rom, buf, 0x80000); + + DrvROMLen[1] = DrvROMLen[2] = 0xc0000; + + BurnFree (buf); +} + +static void blandia68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x21ffff, SM_RAM); + SekMapMemory(Drv68KRAM2, 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x7003ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0011000, 0x701000, 0x70ffff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0x800000, 0x800607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0x900000, 0x903fff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0xb00000, 0xb0ffff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0xb80000, 0xb8ffff, SM_RAM); + SekSetWriteWordHandler(0, daioh_write_word); + SekSetWriteByteHandler(0, daioh_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); + + memmove (Drv68KROM + 0x100000, Drv68KROM + 0x080000, 0x100000); + memmove (DrvSndROM + 0x100000, DrvSndROM + 0x0c0000, 0x0c0000); + + BlandiaGfxRearrange(); +} + +static void blandiap68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x21ffff, SM_RAM); + SekMapMemory(Drv68KRAM2, 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x7003ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0011000, 0x701000, 0x70ffff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x800000, 0x80ffff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x880000, 0x88ffff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(Drv68KRAM + 0x0020000, 0xa80000, 0xa803ff, SM_WRITE); //nop + SekMapMemory(DrvSprRAM1, 0xb00000, 0xb03fff, SM_RAM); + SekSetWriteWordHandler(0, daioh_write_word); + SekSetWriteByteHandler(0, daioh_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); + + memmove (Drv68KROM + 0x100000, Drv68KROM + 0x080000, 0x100000); + + // set up sound banks... + { + UINT8 *tmp = (UINT8*)BurnMalloc(0x240000); + + INT32 offsets[16] = { + 0x000000, 0x140000, 0x020000, 0x160000, + 0x040000, 0x180000, 0x060000, 0x1a0000, + 0x080000, 0x1c0000, 0x0a0000, 0x1e0000, + 0x100000, 0x200000, 0x120000, 0x220000 + }; + + for (INT32 i = 0; i < 16; i++) { + memcpy (tmp + offsets[i], DrvSndROM + (i * 0x020000), 0x020000); + } + + memcpy (DrvSndROM, tmp, 0x240000); + + BurnFree (tmp); + } +} + +static void oisipuzl68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x800000, 0x803fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x880000, 0x883fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xb00000, 0xb03fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xc00400, 0xc00fff, SM_RAM); + SekSetWriteWordHandler(0, daioh_write_word); + SekSetWriteByteHandler(0, daioh_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0x700000, 0x703fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); +} + +static void pairlove68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvNVRAM, 0x800000, 0x8001ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xb00000, 0xb00fff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xc00000, 0xc03fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xe00000, 0xe00607 | 0x7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xf00000, 0xf0ffff, SM_RAM); + SekSetWriteWordHandler(0, pairlove_write_word); + SekSetWriteByteHandler(0, pairlove_write_byte); + SekSetReadWordHandler(0, pairlove_read_word); + SekSetReadByteHandler(0, pairlove_read_byte); + + SekMapHandler(1, 0xa00000, 0xa03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); +} + +static void jjsquawkb68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x21ffff, SM_RAM); + SekMapMemory(Drv68KRAM2, 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x0010000, 0x700000, 0x70b3ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x70b400, 0x70bfff, SM_RAM); + SekMapMemory(Drv68KRAM2 + 0x001c000, 0x70c000, 0x70ffff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x800000, 0x803fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x804000, 0x807fff, SM_RAM); + SekMapMemory(DrvVidRAM1 + 0x4000, 0x884000, 0x88ffff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa0a000, 0xa0a607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xb0c000, 0xb0ffff, SM_RAM); + SekSetWriteWordHandler(0, daioh_write_word); + SekSetWriteByteHandler(0, daioh_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); + + BurnLoadRom(Drv68KROM + 0x0000000, 0, 1); + BurnLoadRom(Drv68KROM + 0x0100000, 1, 1); + + DrvGfxROM2 = DrvGfxROM1 + 0x400000; + DrvROMLen[1] = DrvROMLen[2] = 0x200000; + + memcpy (DrvGfxROM2 + 0x000000, DrvGfxROM1 + 0x100000, 0x100000); + memcpy (DrvGfxROM2 + 0x100000, DrvGfxROM1 + 0x300000, 0x100000); + memcpy (DrvGfxROM1 + 0x100000, DrvGfxROM1 + 0x200000, 0x100000); +} + +static void extdwnhl68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x23ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x600400, 0x600fff, SM_RAM); + SekMapMemory(Drv68KRAM2, 0x601000, 0x610bff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x800000, 0x80ffff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x880000, 0x88ffff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xb00000, 0xb13fff, SM_RAM); + SekSetWriteWordHandler(0, daioh_write_word); + SekSetWriteByteHandler(0, daioh_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0xe00000, 0xe03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); + + // swap halves of sound rom + memcpy (DrvSndROM + 0x100000, DrvSndROM + 0x000000, 0x080000); + memcpy (DrvSndROM + 0x000000, DrvSndROM + 0x080000, 0x100000); +} + +static void krzybowl68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvNVRAM, 0x800000, 0x8001ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xb00000, 0xb003ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xc00000, 0xc03fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xe00000, 0xe00607 | 0x7ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xf00000, 0xf0ffff, SM_RAM); + SekSetWriteWordHandler(0, thunderl_write_word); + SekSetWriteByteHandler(0, thunderl_write_byte); + SekSetReadWordHandler(0, madshark_read_word); + SekSetReadByteHandler(0, madshark_read_byte); + + SekMapHandler(1, 0xa00000, 0xa03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); +} + +void __fastcall triplfun_sound_write_byte(UINT32 address, UINT8 data) +{ + if ((address & ~1) == 0x500006) { + MSM6295Command(0, data); + } +} + +UINT8 __fastcall triplfun_sound_read_byte(UINT32) +{ + return MSM6295ReadStatus(0); +} + +static void triplfun68kInit() +{ + oisipuzl68kInit(); + + SekOpen(0); + SekMapHandler(2, 0x500006, 0x500007, SM_READ | SM_WRITE); +// SekSetReadWordHandler (2, triplfun_sound_read_word); + SekSetReadByteHandler (2, triplfun_sound_read_byte); +// SekSetWriteWordHandler(2, triplfun_sound_write_word); + SekSetWriteByteHandler(2, triplfun_sound_write_byte); + SekClose(); + + MSM6295Exit(0); + MSM6295Init(0, 792000 / 132, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + memcpy (Drv68KROM + 0x100000, Drv68KROM + 0x080000, 0x080000); + memset (Drv68KROM + 0x080000, 0, 0x080000); +} + +static void utoukond68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x700400, 0x700fff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x800000, 0x803fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x880000, 0x883fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xb00000, 0xb03fff, SM_RAM); + SekSetWriteWordHandler(0, daioh_write_word); + SekSetWriteByteHandler(0, daioh_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0xc00000, 0xc00001, SM_WRITE); + SekSetWriteWordHandler(1, wiggie_sound_write_word); + SekSetWriteByteHandler(1, wiggie_sound_write_byte); + SekClose(); + + ZetOpen(0); + ZetMapArea(0x0000, 0xdfff, 0, DrvSubROM); + ZetMapArea(0x0000, 0xdfff, 2, DrvSubROM); + ZetMapArea(0xe000, 0xefff, 0, DrvSubRAM); + ZetMapArea(0xe000, 0xefff, 1, DrvSubRAM); + ZetMapArea(0xe000, 0xefff, 2, DrvSubRAM); + ZetSetWriteHandler(utoukond_sound_write); + ZetSetReadHandler(utoukond_sound_read); + ZetSetOutHandler(utoukond_sound_write_port); + ZetSetInHandler(utoukond_sound_read_port); + ZetClose(); + + for (INT32 i = 0; i < 0x400000; i++) DrvGfxROM0[i] ^= 0xff; +} + +static void Wiggie68kDecode() +{ + UINT8 *tmp = Drv68KRAM; + + for (INT32 i = 0; i < 0x20000; i+=16) { + for (INT32 j = 0; j < 16; j++) { + tmp[j] = Drv68KROM[i+((j & 1) | ((j & 2) << 2) | ((j & 0x0c) >> 1))]; + } + memcpy (Drv68KROM + i, tmp, 0x10); + } +} + +static void wiggie68kInit() +{ + thunderl68kInit(); + + SekOpen(0); + SekMapMemory(Drv68KRAM + 0x80000, 0x100000, 0x103fff, SM_READ); // nop + + SekMapHandler(1, 0xb00008, 0xb00009, SM_WRITE); + SekSetWriteWordHandler(1, wiggie_sound_write_word); + SekSetWriteByteHandler(1, wiggie_sound_write_byte); + SekClose(); + + Wiggie68kDecode(); + + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvSubROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvSubROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvSubRAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvSubRAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvSubRAM); + ZetSetWriteHandler(wiggie_sound_write); + ZetSetReadHandler(wiggie_sound_read); + ZetClose(); +} + +static void downtown68kInit() +{ + downtown_protram = DrvNVRAM; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x09ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x700000, 0x7003ff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x900000, 0x903fff, SM_RAM); + SekMapMemory(DrvShareRAM, 0xb00000, 0xb00fff, SM_WRITE); // m65c02 not emulated, simulate instead + SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xf00000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, downtown_write_word); + SekSetWriteByteHandler(0, downtown_write_byte); + SekSetReadWordHandler(0, daioh_read_word); + SekSetReadByteHandler(0, daioh_read_byte); + + SekMapHandler(1, 0x100000, 0x103fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + + SekMapMemory(downtown_protram, 0x200000, 0x2003ff, SM_WRITE); + SekMapHandler(2, 0x200000, 0x2003ff, SM_READ); + SekSetReadByteHandler (2, downtown_prot_read); + + SekMapHandler(3, 0xb00000, 0xb00fff, SM_READ); + SekSetReadByteHandler (3, downtown_sharedram_read_byte); + SekSetReadWordHandler (3, downtown_sharedram_read_word); + SekClose(); +} + +static void metafox68kInit() +{ + downtown68kInit(); + + SekOpen(0); + SekSetReadByteHandler (3, metafox_sharedram_read_byte); + SekSetReadWordHandler (3, metafox_sharedram_read_word); + SekClose(); +} + +static void tndrcade68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x380000, 0x3803ff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0x600000, 0x600607 | 0x7ff, SM_RAM); + SekMapMemory(DrvShareRAM, 0xa00000, 0xa00fff, SM_WRITE); // m65c02 not emulated, simulate instead + SekMapMemory(DrvSprRAM1, 0xc00000, 0xc03fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xe00000, 0xe03fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xffc000, 0xffffff, SM_RAM); + + // install simulation to make game playable + SekMapHandler(3, 0xa00000, 0xa00fff, SM_READ); + SekSetReadByteHandler (3, tndrcade_sharedram_read_byte); + SekSetReadWordHandler (3, tndrcade_sharedram_read_word); + SekClose(); +} + +static void kiwame68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0x800000, 0x803fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xb00000, 0xb003ff, SM_RAM); + SekMapMemory(DrvNVRAM, 0xfffc00, 0xffffff, SM_WRITE); + + SekSetReadWordHandler(0, kiwame_read_word); + SekSetReadByteHandler(0, kiwame_read_byte); + + SekMapHandler(1, 0xc00000, 0xc03fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); + + { + // give the game proper vectors + *((UINT16 *)(Drv68KROM + 0x00064)) = 0x0000; + *((UINT16 *)(Drv68KROM + 0x00066)) = 0x0dca; + + // get past backup ram error + // the game never actually tests it before failing?? + *((UINT16 *)(Drv68KROM + 0x136d2)) = 0x6052; + } +} + +UINT8 __fastcall twineagle_extram_read_byte(UINT32 address) +{ + return DrvNVRAM[address & 0x3fe]; +} + +static void twineagle68kInit() +{ + downtown68kInit(); + + SekOpen(0); + SekMapMemory(DrvNVRAM, 0x200000, 0x2003ff, SM_WRITE); + SekMapHandler(2, 0x200000, 0x2003ff, SM_READ); + SekSetReadByteHandler (2, twineagle_extram_read_byte); + + SekMapHandler(3, 0xb00000, 0xb00fff, SM_READ | SM_WRITE); + SekSetReadByteHandler (3, twineagl_sharedram_read_byte); + SekSetReadWordHandler (3, twineagl_sharedram_read_word); + SekSetWriteWordHandler(3, twineagl_sharedram_write_word); + SekSetWriteByteHandler(3, twineagl_sharedram_write_byte); + SekClose(); + + BurnByteswap(Drv68KROM, 0x80000); +} + +static void crazyfgt68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x640400, 0x640fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x800000, 0x803fff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x880000, 0x883fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xb00000, 0xb03fff, SM_RAM); + SekSetWriteWordHandler(0, crazyfgt_write_word); + SekSetWriteByteHandler(0, crazyfgt_write_byte); + SekSetReadWordHandler(0, crazyfgt_read_word); + SekSetReadByteHandler(0, crazyfgt_read_byte); + SekClose(); + + // Patch protection + *((UINT16*)(Drv68KROM + 0x1078)) = 0x4e71; + + BlandiaGfxRearrange(); // fix bg tiles +} + +static void usclssic68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvSprRAM0, 0x800000, 0x800607 | 0x7ff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xb00000, 0xb003ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xc00000, 0xc03fff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0xd00000, 0xd04fff, SM_RAM); + SekMapMemory(Drv68KRAM2, 0xe00000, 0xe00fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xff0000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, usclssic_write_word); + SekSetWriteByteHandler(0, usclssic_write_byte); + SekSetReadWordHandler(0, usclssic_read_word); + SekSetReadByteHandler(0, usclssic_read_byte); + SekClose(); + + // m65c02 sound... +} + +static void calibr5068kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x09ffff, SM_ROM); + SekMapMemory(Drv68KRAM2, 0x200000, 0x200fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x700000, 0x7003ff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x900000, 0x904fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xff0000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, calibr50_write_word); + SekSetWriteByteHandler(0, calibr50_write_byte); + SekSetReadWordHandler(0, calibr50_read_word); + SekSetReadByteHandler(0, calibr50_read_byte); + SekClose(); + + // m65c02 sound... +} + +//----------------------------------------------------------------------------------------------------------------------------------- + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0x20, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0x20, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static INT32 DrvYM3812SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)SekTotalCycles() * nSoundRate / 16000000; +} + + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000.0; +} + +static INT32 DrvGfxDecode(INT32 type, UINT8 *gfx, INT32 num) +{ + DrvGfxTransMask[num] = NULL; + + INT32 len = DrvROMLen[num]; + if (DrvROMLen[num] == 0) DrvGfxMask[num] = 1; // no divide by 0 + if (len == 0 || type == -1) return 0; + + INT32 Plane0[4] = { ((len * 8) / 2) + 8, ((len * 8) / 2) + 0, 8, 0 }; + INT32 XOffs0[16] = { 0,1,2,3,4,5,6,7, 128,129,130,131,132,133,134,135 }; + INT32 YOffs0[16] = { 0*16,1*16,2*16,3*16,4*16,5*16,6*16,7*16, 16*16,17*16,18*16,19*16,20*16,21*16,22*16,23*16 }; + + INT32 Plane1[4] = { 0, 4, ((len * 8) / 2) + 0, ((len * 8) / 2) + 4 }; + INT32 Plane1a[6] = { (((len * 8) / 3) * 0) + 0, (((len * 8) / 3) * 0) + 4, (((len * 8) / 3) * 1) + 0, (((len * 8) / 3) * 1) + 4, (((len * 8) / 3) * 2) + 0, (((len * 8) / 3) * 2) + 4 }; + INT32 XOffs1[16] = { 128+64,128+65,128+66,128+67, 128+0,128+1,128+2,128+3, 8*8+0,8*8+1,8*8+2,8*8+3, 0,1,2,3 }; + INT32 YOffs1[16] = { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8, 32*8,33*8,34*8,35*8,36*8,37*8,38*8,39*8 }; + + INT32 Plane2[6] = { ((len * 8) / 2)+0*4, ((len * 8) / 2)+1*4, 2*4,3*4,0*4,1*4 }; + INT32 XOffs2[16] = { 256+128,256+129,256+130,256+131, 256+0,256+1,256+2,256+3, 128,129,130,131, 0,1,2,3 }; + INT32 YOffs2[16] = { 0*16,1*16,2*16,3*16,4*16,5*16,6*16,7*16, 32*16,33*16,34*16,35*16,36*16,37*16,38*16,39*16 }; + + INT32 Plane3[4] = { ((len * 8) / 4) * 0, ((len * 8) / 4) * 1, ((len * 8) / 4) * 2, ((len * 8) / 4) * 3 }; + INT32 XOffs3[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; + INT32 YOffs3[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128+0, 128+8, 128+16, 128+24, 128+32, 128+40, 128+48, 128+56 }; + INT32 YOffs3a[16]= { 0*8, 16*8, 4*8, 20*8, 2*8, 18*8, 6*8, 22*8, 1*8, 17*8, 5*8, 21*8, 3*8, 19*8, 7*8, 23*8 }; // wiggie + INT32 YOffs3b[16]= { 0*8, 2*8, 16*8, 18*8, 1*8, 3*8, 17*8, 19*8, 4*8, 6*8, 20*8, 22*8, 5*8, 7*8,21*8, 23*8 }; // superbar + + UINT8 *tmp = (UINT8*)BurnMalloc(len); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, gfx, len); + + switch (type) + { + case 0: // layout_planes_2roms + GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane0, XOffs0, YOffs0, 0x200, tmp, gfx); + DrvGfxMask[num] = (len * 2) / (16 * 16); + ColorDepths[num] = 4; + break; + + case 1: // layout_planes_2roms_split + GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane1, XOffs1, YOffs1, 0x200, tmp, gfx); + DrvGfxMask[num] = (len * 2) / (16 * 16); + ColorDepths[num] = 4; + break; + + case 2: // layout_packed + GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane2 + 2, XOffs2, YOffs2, 0x400, tmp, gfx); + DrvGfxMask[num] = (len * 2) / (16 * 16); + ColorDepths[num] = 4; + break; + + case 3: // layout_packed_6bits_2roms + GfxDecode((len * 1) / (16 * 16), 6, 16, 16, Plane2 + 0, XOffs2, YOffs2, 0x400, tmp, gfx); + DrvGfxMask[num] = (len * 1) / (16 * 16); + ColorDepths[num] = 6; //handled like 4 + break; + + case 4: // layout_packed_6bits_3roms + GfxDecode(((len * 8)/6) / (16 * 16), 6, 16, 16, Plane1a, XOffs1, YOffs1, 0x200, tmp, gfx); + DrvGfxMask[num] = ((len * 8)/6) / (16 * 16); + ColorDepths[num] = 6; //handled like 4 + break; + + case 5: // layout_planes + GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane3, XOffs3, YOffs3 , 0x100, tmp, gfx); + DrvGfxMask[num] = (len * 2) / (16 * 16); + ColorDepths[num] = 4; + break; + + case 6: // wiggie_layout + GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane3, XOffs3, YOffs3a, 0x100, tmp, gfx); + DrvGfxMask[num] = (len * 2) / (16 * 16); + ColorDepths[num] = 4; + break; + + case 7: // superbar_layout + GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Plane3, XOffs3, YOffs3b, 0x100, tmp, gfx); + DrvGfxMask[num] = (len * 2) / (16 * 16); + ColorDepths[num] = 4; + break; + } + + BurnFree (tmp); + + { + INT32 size = DrvGfxMask[num]; + + DrvGfxTransMask[num] = (UINT8*)BurnMalloc(size); + + for (INT32 i = 0; i < size << 8; i += (1 << 8)) { + DrvGfxTransMask[num][i >> 8] = 1; // transparent + for (INT32 j = 0; j < (1 << 8); j++) { + if (gfx[i + j]) { + DrvGfxTransMask[num][i >> 8] = 0; + break; + } + } + } + } + + return 0; +} + +static INT32 DrvLoadRoms(INT32 bload) +{ + char* pRomName; + struct BurnRomInfo ri, rh; + + UINT8 *LoadPrg[2] = { Drv68KROM, DrvSubROM }; + UINT8 *LoadGfx[5] = { DrvGfxROM0, DrvGfxROM1, DrvGfxROM2, DrvSndROM, DrvColPROM }; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + + BurnDrvGetRomInfo(&ri, i + 0); + BurnDrvGetRomInfo(&rh, i + 1); + + if ((ri.nType & 7) < 3 && (ri.nType & 7)) { + INT32 type = (ri.nType - 1) & 1; + + if ((rh.nType & 7) == 1 && (rh.nLen == ri.nLen)) { + if (bload) if (BurnLoadRom(LoadPrg[type] + 0, i + 1, 2)) return 1; + if (bload) if (BurnLoadRom(LoadPrg[type] + 1, i + 0, 2)) return 1; + LoadPrg[type] += ri.nLen * 2; + i++; // loading two roms + } else { + if (bload) if (BurnLoadRom(LoadPrg[type], i, 1)) return 1; + LoadPrg[type] += ri.nLen; + } + continue; + } + + if ((ri.nType & 7) == 3 || (ri.nType & 7) == 4 || (ri.nType & 7) == 5 || (ri.nType & 7) == 6 || (ri.nType & 7) == 7) { // gfx, snd, colprom + INT32 type = (ri.nType & 7) - 3; + + if (ri.nType & 8) { // interleaved... + if (bload) if (BurnLoadRom(LoadGfx[type] + 0, i + 0, 2)) return 1; + + if ((ri.nType & 16) == 0) { // zingzap + if (bload) if (BurnLoadRom(LoadGfx[type] + 1, i + 1, 2)) return 1; + i++; + } + + LoadGfx[type] += ri.nLen * 2; + } else { + if (bload) if (BurnLoadRom(LoadGfx[type], i, 1)) return 1; + LoadGfx[type] += ri.nLen; + } + + continue; + } + } + + if (bload == 0) { + DrvROMLen[0] = LoadGfx[0] - DrvGfxROM0; + DrvROMLen[1] = LoadGfx[1] - DrvGfxROM1; + DrvROMLen[2] = LoadGfx[2] - DrvGfxROM2; + DrvROMLen[3] = LoadGfx[3] - DrvSndROM; + DrvROMLen[4] = LoadGfx[4] - DrvColPROM; + + // bprintf (0, _T("%x, %x, %x, %x %x\n"), DrvROMLen[0], DrvROMLen[1], DrvROMLen[2], DrvROMLen[3], DrvROMLen[4]); + } + + return 0; +} + +static INT32 DrvDoReset(INT32 ram) +{ + if (ram) memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); // wiggie, utoukond, superbar + ZetReset(); + ZetClose(); + + x1010Reset(); + MSM6295Reset(0); + BurnYM3438Reset(); + BurnYM3812Reset(); + + watchdog = 0; + + tndrcade_init_sim = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x200000; + DrvSubROM = Next; Next += 0x050000; + + DrvGfxROM2 = Next; Next += DrvROMLen[2] * 2; + DrvGfxROM1 = Next; Next += DrvROMLen[1] * 2; + DrvGfxROM0 = Next; Next += DrvROMLen[0] * 2; + + DrvColPROM = Next; Next += 0x000800; + + MSM6295ROM = Next; + X1010SNDROM = Next; + DrvSndROM = Next; Next += DrvROMLen[3] + 0x100000; // for banking + + Palette = (UINT32*)Next; Next += BurnDrvGetPaletteEntries() * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += BurnDrvGetPaletteEntries() * sizeof(UINT32); + + DrvNVRAM = Next; Next += 0x000400; + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x100000; + Drv68KRAM2 = Next; Next += 0x020000; + DrvSubRAM = Next; Next += 0x001000; + DrvPalRAM = Next; Next += 0x001000; + DrvSprRAM0 = Next; Next += 0x000800; + DrvSprRAM1 = Next; Next += 0x014000; + + DrvVidRAM0 = Next; Next += 0x010000; + DrvVIDCTRLRAM0 = Next; Next += 0x000008; + + DrvVidRAM1 = Next; Next += 0x010000; + DrvVIDCTRLRAM1 = Next; Next += 0x000008; + + DrvVideoRegs = Next; Next += 0x000008; + + soundlatch = Next; Next += 0x000001; + tilebank = Next; Next += 0x000004; + tile_offset = (UINT32*)Next; Next += 0x000001 * sizeof(UINT32); + + DrvShareRAM = Next; Next += 0x001000; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static void DrvSetVideoOffsets(INT32 spritex, INT32 spritex_flipped, INT32 tilesx, INT32 tilesx_flipped) +{ + VideoOffsets[0][0] = spritex; + VideoOffsets[0][1] = spritex_flipped; + VideoOffsets[1][0] = tilesx; + VideoOffsets[1][1] = tilesx_flipped; +} + +static void DrvSetColorOffsets(INT32 gfx0, INT32 gfx1, INT32 gfx2) +{ + ColorOffsets[0] = gfx0; + ColorOffsets[1] = gfx1; + ColorOffsets[2] = gfx2; +} + +static void DrvSetDefaultColorTable() +{ + for (INT32 i = 0; i < BurnDrvGetPaletteEntries(); i++) { + Palette[i] = i; + } +} + +static void zingzapSetColorTable() +{ + for (INT32 color = 0; color < 0x20; color++) { + for (INT32 pen = 0; pen < 0x40; pen++) { + Palette[0x400 + ((color << 6) | pen)] = 0x400 + (((color << 4) + pen) & 0x1ff); + } + } +} + +static void jjsquawkSetColorTable() +{ + for (INT32 color = 0; color < 0x20; color++) { + for (INT32 pen = 0; pen < 0x40; pen++) { + Palette[0x200 + ((color << 6) | pen)] = 0x400 + (((color << 4) + pen) & 0x1ff); + Palette[0xa00 + ((color << 6) | pen)] = 0x200 + (((color << 4) + pen) & 0x1ff); + } + } +} + +static void gundharaSetColorTable() +{ + for (INT32 color = 0; color < 0x20; color++) { + for (INT32 pen = 0; pen < 0x40; pen++) { + Palette[0x200 + ((color << 6) | pen)] = 0x400 + ((((color & ~3) << 4) + pen) & 0x1ff); + Palette[0xa00 + ((color << 6) | pen)] = 0x200 + ((((color & ~3) << 4) + pen) & 0x1ff); + } + } +} + +static void blandiaSetColorTable() +{ + for (INT32 color = 0; color < 0x20; color++) { + for (INT32 pen = 0; pen < 0x40; pen++) { + Palette[0x200 + ((color << 6) | pen)] = 0x200 + ((color << 4) | (pen & 0x0f)); + Palette[0xa00 + ((color << 6) | pen)] = 0x400 + pen; + } + } +} + +static void usclssicSetColorTable() +{ + memcpy (DrvColPROM + 0x600, DrvColPROM + 0x000, 0x200); +// memcpy (DrvColPROM + 0x200, DrvColPROM + 0x200, 0x200); + + for (INT32 color = 0; color < 0x200; color++) { + Palette[color] = color; + } + + for (INT32 color = 0; color < 0x20; color++) { + for (INT32 pen = 0; pen < 0x40; pen++) { + Palette[0x200 + ((color << 6) | pen)] = 0x200 + (((color << 4) + pen) & 0x1ff); + } + } +} + +static INT32 DrvInit(void (*p68kInit)(), INT32 cpu_speed, INT32 irq_type, INT32 spr_buffer, INT32 gfxtype0, INT32 gfxtype1, INT32 gfxtype2) +{ + BurnSetRefreshRate((1.00 * refresh_rate)/100); + + DrvLoadRoms(0); + + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (DrvLoadRoms(1)) return 1; + + // make sure these are initialized so that we can use common routines + ZetInit(0); + MSM6295Init(0, 1000000 / 132, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + if (p68kInit) { + p68kInit(); + } + + DrvGfxDecode(gfxtype0, DrvGfxROM0, 0); + DrvGfxDecode(gfxtype1, DrvGfxROM1, 1); + DrvGfxDecode(gfxtype2, DrvGfxROM2, 2); + + cpuspeed = cpu_speed; + irqtype = irq_type; + buffer_sprites = spr_buffer; + + x1010_sound_init(16000000, 0x0000); + x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + + BurnYM3812Init(4000000, NULL, DrvYM3812SynchroniseStream, 0); + BurnTimerAttachSekYM3812(16000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + BurnYM3438Init(1, 16000000/4, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 1); + BurnTimerAttachZet(4000000); + BurnYM3438SetRoute(0, BURN_SND_YM3438_YM3438_ROUTE_1, 0.30, BURN_SND_ROUTE_LEFT); + BurnYM3438SetRoute(0, BURN_SND_YM3438_YM3438_ROUTE_2, 0.30, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvSetDefaultColorTable(); + + bprintf (0, _T("%d\n"), nScreenHeight); + + VideoOffsets[2][0] = ((256 - nScreenHeight) / 2); // adjust for screen height + VideoOffsets[2][1] = VideoOffsets[2][0]; + + BurnGunInit(2, true); + + DrvDoReset(1); + + return 0; +} + +static INT32 DrvExit() +{ +// FILE *fa = fopen("nvram", "wb"); +// fwrite (DrvNVRAM, 0x400, 1, fa); +// fclose (fa); + + GenericTilesExit(); + + DrvGfxROM0 = NULL; + DrvGfxROM1 = NULL; + DrvGfxROM2 = NULL; + + memset (ColorOffsets, 0, 3 * sizeof(INT32)); + + SekExit(); + ZetExit(); + + BurnGunExit(); + + x1010_exit(); + BurnYM3438Exit(); + BurnYM3812Exit(); + + MSM6295Exit(0); + MSM6295ROM = NULL; + + BurnFree (AllMem); + + oisipuzl_hack = 0; + twineagle = 0; + watchdog_enable = 0; + refresh_rate = 6000; + + BurnFree (DrvGfxTransMask[0]); + BurnFree (DrvGfxTransMask[2]); + BurnFree (DrvGfxTransMask[1]); + + return 0; +} + +// usclssic needs color set up... + +static inline void DrvColors(INT32 i, INT32 pal) +{ + INT32 r = (pal >> 10) & 0x1f; + INT32 g = (pal >> 5) & 0x1f; + INT32 b = (pal >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); +} + +static void DrvPaletteRecalc() +{ + UINT16 *p = (UINT16*)DrvPalRAM; + + if (DrvROMLen[4]) { // color prom + if (DrvROMLen[4] > 1) { // usclassic + memcpy (DrvColPROM + 0x400, DrvPalRAM, 0x200); + memcpy (DrvColPROM + 0x000, DrvPalRAM, 0x200); + } + p = (UINT16*)DrvColPROM; + } + + for (INT32 i = 0; i < BurnDrvGetPaletteEntries(); i++) { + DrvColors(i, BURN_ENDIAN_SWAP_INT16(p[Palette[i]])); + } +} + +static void draw_sprites_map() +{ + UINT16 *spriteram16 = (UINT16*)DrvSprRAM0; + + INT32 ctrl = BURN_ENDIAN_SWAP_INT16(spriteram16[0x600/2]); + INT32 ctrl2 = BURN_ENDIAN_SWAP_INT16(spriteram16[0x602/2]); + + INT32 flip = ctrl & 0x40; + INT32 numcol = ctrl2 & 0x0f; + + UINT16 *src = ((UINT16*)DrvSprRAM1) + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); + + INT32 upper = ( BURN_ENDIAN_SWAP_INT16(spriteram16[ 0x604/2 ]) & 0xFF ) +( BURN_ENDIAN_SWAP_INT16(spriteram16[ 0x606/2 ]) & 0xFF ) * 256; + + INT32 col0 = 0; + switch (ctrl & 0x0f) + { + case 0x01: col0 = 0x4; break; // krzybowl + case 0x06: col0 = 0x8; break; // kiwame + } + + INT32 xoffs = 0; + INT32 yoffs = flip ? 1 : -1; + + if (numcol == 1) numcol = 16; + + for (INT32 col = 0 ; col < numcol; col++) + { + INT32 x = BURN_ENDIAN_SWAP_INT16(spriteram16[(col * 0x20 + 0x408)/2]) & 0xff; + INT32 y = BURN_ENDIAN_SWAP_INT16(spriteram16[(col * 0x20 + 0x400)/2]) & 0xff; + + for (INT32 offs = 0; offs < 0x20; offs++) + { + INT32 code = BURN_ENDIAN_SWAP_INT16(src[((col+col0)&0xf) * 0x40/2 + offs + 0x800/2]); + INT32 color = BURN_ENDIAN_SWAP_INT16(src[((col+col0)&0xf) * 0x40/2 + offs + 0xc00/2]); + + INT32 flipx = code & 0x8000; + INT32 flipy = code & 0x4000; + + INT32 bank = (color & 0x0600) >> 9; + + INT32 sx = x + xoffs + (offs & 1) * 16; + INT32 sy = -(y + yoffs) + (offs / 2) * 16; + + if (upper & (1 << col)) sx += 256; + + if (flip) { + sy = 0xf0 - sy; + flipx = !flipx; + flipy = !flipy; + } + + color = (color >> 11) & 0x1f; + code = ((code & 0x3fff) + (bank * 0x4000)) % DrvGfxMask[0]; + + if (DrvGfxTransMask[0][code]) continue; + + sx = ((sx + 0x10) & 0x1ff) - 0x10; + sy = ((sy + 8) & 0x0ff) - 8; + sy = ((sy+16-VideoOffsets[2][0])&0xff)-16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, 0, DrvGfxROM0); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, 0, DrvGfxROM0); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, 0, DrvGfxROM0); + } + } + } + } +} + +static void draw_sprites() +{ + if (~nSpriteEnable & 1) return; + + UINT16 *spriteram16 = (UINT16*)DrvSprRAM0; + + INT32 ctrl = BURN_ENDIAN_SWAP_INT16(spriteram16[ 0x600/2 ]); + INT32 ctrl2 = BURN_ENDIAN_SWAP_INT16(spriteram16[ 0x602/2 ]); + + INT32 flip = ctrl & 0x40; + + UINT16 *src = ((UINT16*)DrvSprRAM1) + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); + + draw_sprites_map(); + + INT32 yoffs = oisipuzl_hack ? 32 : 0; + INT32 xoffs = VideoOffsets[0][flip ? 1 : 0]; + + for (INT32 offs = (0x400-2)/2 ; offs >= 0; offs -= 1) + { + int code = BURN_ENDIAN_SWAP_INT16(src[offs + 0x000/2]); + int sx = BURN_ENDIAN_SWAP_INT16(src[offs + 0x400/2]); + + int sy = BURN_ENDIAN_SWAP_INT16(spriteram16[offs + 0x000/2]) & 0xff; + + int flipx = code & 0x8000; + int flipy = code & 0x4000; + + INT32 bank = (sx & 0x0600) >> 9; + INT32 color = (sx >> 11) & 0x1f; + + if (flip) + { + sy = (0x100 - nScreenHeight) + 0xf0 - sy; + flipx = !flipx; + flipy = !flipy; + } + + code = ((code & 0x3fff) + (bank * 0x4000)) % DrvGfxMask[0]; + + if (DrvGfxTransMask[0][code]) continue; + + sx = ((sx + xoffs + 0x10) & 0x1ff) - 0x10; + sy = ((((0xf0 - sy) - (-2) + 8)) & 0x0ff) - 8; + sy = ((yoffs+sy+16-VideoOffsets[2][0])&0xff)-16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, ColorOffsets[0], DrvGfxROM0); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, ColorOffsets[0], DrvGfxROM0); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, ColorOffsets[0], DrvGfxROM0); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, ColorDepths[0], 0, ColorOffsets[0], DrvGfxROM0); + } + } + } +} + +// this is needed because some color depths (specifically 6 bits per pixel) need colors added rather than xored. +static void RenderTile(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color, INT32 trans_col, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 width, INT32 height) +{ + INT32 flip = 0; + if (flipy) flip |= (height - 1) * width; + if (flipx) flip |= width - 1; + + gfx += code * width * height; + + for (INT32 y = 0; y < height; y++, sy++) { + if (sy < 0 || sy >= nScreenHeight) continue; + + for (INT32 x = 0; x < width; x++, sx++) { + if (sx < 0 || sx >= nScreenWidth) continue; + + INT32 pxl = gfx[((y * width) + x) ^ flip]; + + if (pxl == trans_col) continue; + + dest[sy * nScreenWidth + sx] = pxl + color; + } + + sx -= width; + } +} + +static void draw_layer(UINT8 *ram, UINT8 *gfx, INT32 num, INT32 opaque, INT32 scrollx, INT32 scrolly) +{ + INT32 mask = DrvGfxMask[num]; + INT32 depth = ColorDepths[num]; + INT32 color_offset = ColorOffsets[num]; + + scrollx = (scrollx + VideoOffsets[1][flipscreen]) & 0x3ff; + scrolly = (scrolly + VideoOffsets[2][0]) & 0x1ff; + + UINT16 *vram = (UINT16*)ram; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = (offs & 0x3f) << 4; + INT32 sy = (offs >> 6) << 4; + + sx -= scrollx; + if (sx < -15) sx += 0x400; + sy -= scrolly; + if (sy < -15) sy += 0x200; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs + 0x000]); + INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs + 0x800]) & 0x001f; + + INT32 code = (attr & 0x3fff) + tile_offset[0]; + + if (twineagle) { + if ((code & 0x3e00) == 0x3e00) { + code = (code & 0x007f) | ((tilebank[(code & 0x0180) >> 7] >> 1) << 7); + } + } + + code %= mask; + + if (!opaque) { + if (DrvGfxTransMask[num][code]) continue; + } + + INT32 flipx = attr & 0x8000; + INT32 flipy = attr & 0x4000; + + if (flipscreen) { + sx = (nScreenWidth - 16) - sx; + sy = (nScreenHeight - 16) - sy; + flipx ^= 0x8000; + flipy ^= 0x4000; + } + + if (depth == 6) { + RenderTile(pTransDraw, gfx, code, (color * (1<> 6; // disabled for now... + flipscreen ^= tmap_flip; + + INT32 visible = (nScreenHeight - 1); + + UINT16 *vctrl0 = (UINT16*)DrvVIDCTRLRAM0; + UINT16 *vctrl1 = (UINT16*)DrvVIDCTRLRAM1; + + INT32 x_0 = BURN_ENDIAN_SWAP_INT16(vctrl0[0]); + INT32 y_0 = BURN_ENDIAN_SWAP_INT16(vctrl0[1]); + INT32 en0 = BURN_ENDIAN_SWAP_INT16(vctrl0[2]); + + INT32 x_1 = BURN_ENDIAN_SWAP_INT16(vctrl1[0]); + INT32 y_1 = BURN_ENDIAN_SWAP_INT16(vctrl1[1]); + INT32 en1 = BURN_ENDIAN_SWAP_INT16(vctrl1[2]); + + x_0 += 0x10 - VideoOffsets[1][flipscreen ? 1 : 0]; + y_0 -= (256 - visible)/2; + if (flipscreen) + { + x_0 = -x_0 - 512; + y_0 = y_0 - visible; + } + + if (enable_tilemap2) + { + x_1 += 0x10 - VideoOffsets[1][flipscreen ? 1 : 0]; + y_1 -= (256 - visible)/2; + if (flipscreen) + { + x_1 = -x_1 - 512; + y_1 = y_1 - visible; + } + + order = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVideoRegs + 2))); + } + + if ( en0 & 0x08) layer_enable &= ~0x01; + if (~en0 & 0x08) layer_enable &= ~0x02; + if ( en1 & 0x08) layer_enable &= ~0x04; + if (~en1 & 0x08) layer_enable &= ~0x08; + if (enable_tilemap2 == 0) layer_enable &= ~0x0c; + + layer_enable &= nBurnLayer; + + BurnTransferClear(); + + if (order & 1) + { + if (layer_enable & 0x04) draw_layer(DrvVidRAM1 + 0x0000, DrvGfxROM2, 2, 1, x_1, y_1); + if (layer_enable & 0x08) draw_layer(DrvVidRAM1 + 0x2000, DrvGfxROM2, 2, 1, x_1, y_1); + + if ((order & 2) == 2) draw_sprites(); + + if (layer_enable & 0x01) draw_layer(DrvVidRAM0 + 0x0000, DrvGfxROM1, 1, 0, x_0, y_0); + if (layer_enable & 0x02) draw_layer(DrvVidRAM0 + 0x2000, DrvGfxROM1, 1, 0, x_0, y_0); + + if ((order & 2) == 0) draw_sprites(); + } + else + { + if (layer_enable & 0x01) draw_layer(DrvVidRAM0 + 0x0000, DrvGfxROM1, 1, 1, x_0, y_0); + if (layer_enable & 0x02) draw_layer(DrvVidRAM0 + 0x2000, DrvGfxROM1, 1, 1, x_0, y_0); + + if ((order & 2) == 2) draw_sprites(); + + if (layer_enable & 0x04) draw_layer(DrvVidRAM1 + 0x0000, DrvGfxROM2, 2, 0, x_1, y_1); + if (layer_enable & 0x08) draw_layer(DrvVidRAM1 + 0x2000, DrvGfxROM2, 2, 0, x_1, y_1); + + if ((order & 2) == 0) draw_sprites(); + } +} + +static INT32 setaNoLayersDraw() +{ + DrvPaletteRecalc(); + + BurnTransferClear(); + + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 seta1layerDraw() +{ + DrvPaletteRecalc(); + + seta_update(0, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 seta2layerDraw() +{ + DrvPaletteRecalc(); + + seta_update(1, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 zombraidDraw() +{ + seta2layerDraw(); + + for (INT32 i = 0; i < BurnDrvGetMaxPlayers(); i++) { + BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); + } + + return 0; +} + +static INT32 seta2layerFlippedDraw() +{ + DrvPaletteRecalc(); + + seta_update(1, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static void irq_generator(INT32 loop) +{ + if (loop != 4 && loop != 9) return; + + loop = (loop / 5) & 1; + + INT32 line = (irqtype >> (loop * 8)) & 0xff; + if (line & 0x80) return; + + SekSetIRQLine(line, SEK_IRQSTATUS_AUTO); +} + +static void sprite_buffer() +{ + if ((DrvSprRAM0[0x602] & 0x20) == 0) + { + if (DrvSprRAM0[0x602] & 0x40) { + memcpy (DrvSprRAM1 + 0x0000, DrvSprRAM1 + 0x2000, 0x2000); + } else { + memcpy (DrvSprRAM1 + 0x2000, DrvSprRAM1 + 0x0000, 0x2000); + } + } +} + +static INT32 DrvCommonFrame(void (*pFrameCallback)()) +{ + if (DrvReset) { + DrvDoReset(1); + } + + if (watchdog_enable) { + watchdog++; + if (watchdog >= 180) { + DrvDoReset(0); + } + } + + { + memset (DrvInputs, 0xff, 7 * sizeof(UINT16)); + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + DrvInputs[5] ^= (DrvJoy6[i] & 1) << i; + DrvInputs[6] ^= (DrvJoy7[i] & 1) << i; + } + + BurnGunMakeInputs(0, (INT16)DrvAxis[0], (INT16)DrvAxis[1]); // zombraid + BurnGunMakeInputs(1, (INT16)DrvAxis[2], (INT16)DrvAxis[3]); + + float xRatio = (float)128 / 384; + float yRatio = (float)96 / 224; + + for (INT32 i = 0; i < 2; i++) { + INT32 x = BurnGunX[i] >> 8; + INT32 y = BurnGunY[i] >> 8; + + x = (INT32)(x * xRatio); + y = (INT32)(y * yRatio); + + x -= 0xbe; + y += 0x48; + + DrvAnalogInput[0 + (i * 2)] = (UINT8)~x; + DrvAnalogInput[1 + (i * 2)] = (UINT8)y; + } + } + + pFrameCallback(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + if (buffer_sprites) { + sprite_buffer(); + } + + return 0; +} + +static void Drv68kNoSubFrameCallback() +{ + INT32 nInterleave = 10; + INT32 nCyclesTotal[1] = { (cpuspeed * 100) / refresh_rate }; + INT32 nCyclesDone[1] = { 0 }; + + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); + + irq_generator(i); + } + + SekClose(); + + if (pBurnSoundOut) { + x1010_sound_update(); + } +} + +static INT32 DrvFrame() +{ + return DrvCommonFrame(Drv68kNoSubFrameCallback); +} + +static void Drv68k_5IRQ_FrameCallback() +{ + INT32 nInterleave = 10; + INT32 nCyclesTotal[1] = { (cpuspeed * 100) / refresh_rate }; + INT32 nCyclesDone[1] = { 0 }; + + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); + + if (i & 1 && i == 1) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + if (i & 1 && i != 1) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + + SekClose(); + + if (pBurnSoundOut) { + x1010_sound_update(); + } +} + +static INT32 Drv5IRQFrame() +{ + return DrvCommonFrame(Drv68k_5IRQ_FrameCallback); +} + +static void Drv68kNoSubM6295FrameCallback() +{ + INT32 nInterleave = 10; + INT32 nCyclesTotal[1] = { (cpuspeed * 100) / refresh_rate }; + INT32 nCyclesDone[1] = { 0 }; + + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); + + irq_generator(i); + } + + SekClose(); + + if (pBurnSoundOut) { + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } +} + +static INT32 DrvM6295Frame() +{ + return DrvCommonFrame(Drv68kNoSubM6295FrameCallback); +} + +static void Drv68kZ80M6295FrameCallback() +{ + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { (cpuspeed * 100) / refresh_rate, (4000000 * 100) / refresh_rate }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); + nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave); + irq_generator(i); + } + + ZetClose(); + SekClose(); + + if (pBurnSoundOut) { + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } +} + +static INT32 DrvZ80M6295Frame() +{ + return DrvCommonFrame(Drv68kZ80M6295FrameCallback); +} + + +static void Drv68kZ80YM3438FrameCallback() +{ + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { (cpuspeed * 100) / refresh_rate, (4000000 * 100) / refresh_rate }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); + // nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave); + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + irq_generator(i); + } + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + x1010_sound_update(); + BurnYM3438Update(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + +} + +static INT32 Drv68kZ80YM3438Frame() +{ + return DrvCommonFrame(Drv68kZ80YM3438FrameCallback); +} + +static void CrzyfghtFrameCallback() +{ + INT32 nInterleave = 6; + INT32 nCyclesTotal[1] = { (cpuspeed * 100) / refresh_rate }; + + SekOpen(0); + + INT32 irq[6] = { 2, 2, 2, 2, 2, 1 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + //BurnTimerUpdateYM3812(nCyclesTotal[0] / nInterleave); + + SekRun(nCyclesTotal[0] / nInterleave); + + SekSetIRQLine(irq[i], SEK_IRQSTATUS_AUTO); + } + + BurnTimerUpdateEndYM3812(); + + if (pBurnSoundOut) { + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + // BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + } + + SekClose(); +} + +static INT32 CrazyfgtFrame() +{ + return DrvCommonFrame(CrzyfghtFrameCallback); +} + + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029708; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_NVRAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = DrvNVRAM; + ba.nLen = 0x400; + ba.szName = "NV Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + x1010_scan(nAction, pnMin); + BurnYM3812Scan(nAction, pnMin); + BurnYM3438Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + + SCAN_VAR(seta_samples_bank); + SCAN_VAR(usclssic_port_select); + SCAN_VAR(tndrcade_init_sim); + SCAN_VAR(gun_input_bit); + SCAN_VAR(gun_input_src); + } + + if (nAction & ACB_WRITE) { + INT32 tmpbank = seta_samples_bank; + seta_samples_bank = -1; + set_pcm_bank(tmpbank); + } + + return 0; +} + + +//----------------------------------------------------------------------------------------------------------------- +// Nonworking games... + +// Seta / Visco Roulette? + +static struct BurnRomInfo setaroulRomDesc[] = { + { "uf1002.u14", 0x10000, 0xb3a622b0, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "uf1003.u16", 0x10000, 0xa6afd769, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "uf0005.u3", 0x08000, 0x383c2d57, 0x03 | BRF_GRA }, // 2 Sprites + { "uf0006.u4", 0x08000, 0x90c9dae6, 0x03 | BRF_GRA }, // 3 + { "uf0007.u5", 0x08000, 0xe72c3dba, 0x03 | BRF_GRA }, // 4 + { "uf0008.u6", 0x08000, 0xe198e602, 0x03 | BRF_GRA }, // 5 + + { "uf0010.u15", 0x80000, 0x0af13a56, 0x04 | BRF_GRA }, // 6 Layer 1 tiles + { "uf0009.u13", 0x80000, 0x20f2d7f5, 0x04 | BRF_GRA }, // 7 + { "uf0012.u29", 0x80000, 0xcba2a6b7, 0x04 | BRF_GRA }, // 8 + { "uf0011.u22", 0x80000, 0xaf60adf9, 0x04 | BRF_GRA }, // 9 + { "uf0014.u38", 0x80000, 0xda2bd4e4, 0x04 | BRF_GRA }, // 10 + { "uf0013.u37", 0x80000, 0x645ec3c3, 0x04 | BRF_GRA }, // 11 + { "uf0015.u40", 0x80000, 0x11dc19fa, 0x04 | BRF_GRA }, // 12 + { "uf0016.u48", 0x80000, 0x10f99fa8, 0x04 | BRF_GRA }, // 13 + + { "uf1004.u52", 0x20000, 0xd63ea334, 0x06 | BRF_SND }, // 14 x1-010 Samples + + { "ufo017.bin", 0x00200, 0xbf50c303, 0x00 | BRF_GRA }, // 15 Color Proms + { "ufo018.bin", 0x00200, 0x1c584d5f, 0x00 | BRF_GRA }, // 16 +}; + +STD_ROM_PICK(setaroul) +STD_ROM_FN(setaroul) + +static INT32 NotWorkingInit() +{ + return 1; +} + +struct BurnDriverD BurnDrvSetaroul = { + "setaroul", NULL, NULL, NULL, "198?", + "Seta / Visco Roulette?\0", NULL, "Seta / Visco", "Seta", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, setaroulRomInfo, setaroulRomName, NULL, NULL, DrgnunitInputInfo, NULL, + NotWorkingInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0, + 240, 384, 3, 4 +}; + + +// International Toote (Germany) + +static struct BurnRomInfo inttooteRomDesc[] = { + { "p523.v01_horse_prog_2.002", 0x10000, 0x6ce6f1ad, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "p523.v01_horse_prog_1.003", 0x10000, 0x921fcff5, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ya_002_001.u18", 0x80000, 0xdd108016, 0x01 | BRF_PRG | BRF_ESS }, // 2 + + { "ya_011_004.u10", 0x80000, 0xeb74d2e0, 0x03 | BRF_GRA }, // 3 Sprites + { "ya_011_005.u17", 0x80000, 0x4a6c804b, 0x03 | BRF_GRA }, // 4 + { "ya_011_006.u22", 0x80000, 0xbfae01a5, 0x03 | BRF_GRA }, // 5 + { "ya_011_007.u27", 0x80000, 0x2dc7a294, 0x03 | BRF_GRA }, // 6 + { "p523.v01_horse_fore_1.u135", 0x10000, 0x3a75df30, 0x00 | BRF_GRA }, // 7 + { "p523.v01_horse_fore_2.u134", 0x10000, 0x26fb0339, 0x00 | BRF_GRA }, // 8 + { "p523.v01_horse_fore_3.u133", 0x10000, 0xc38596af, 0x00 | BRF_GRA }, // 9 + { "p523.v01_horse_fore_4.u132", 0x10000, 0x64ef345e, 0x00 | BRF_GRA }, // 10 + + { "ya_011_008.u35", 0x40000, 0x4b890f83, 0x04 | BRF_GRA }, // 11 Layer 1 tiles + { "p523.v01_horse_back_1.u137", 0x20000, 0x39b221ea, 0x04 | BRF_GRA }, // 12 + { "ya_011_009.u41", 0x40000, 0xcaa5e3c1, 0x04 | BRF_GRA }, // 13 + { "p523.v01_horse_back_2.u136", 0x20000, 0x9c5e32a0, 0x04 | BRF_GRA }, // 14 + + { "ya_011_013.u71", 0x80000, 0x2bccaf47, 0x06 | BRF_SND }, // 17 x1-010 Samples + { "ya_011_012.u64", 0x80000, 0xa8015ce6, 0x06 | BRF_SND }, // 18 + + { "ya-010.prom", 0x00200, 0x778094b3, 0x00 | BRF_GRA }, // 15 Color Proms + { "ya-011.prom", 0x00200, 0xbd4fe2f6, 0x00 | BRF_GRA }, // 16 +}; + +STD_ROM_PICK(inttoote) +STD_ROM_FN(inttoote) + +#if 0 +static void inttoote68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(DrvVidRAM0, 0xb00000, 0xb07fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xffc000, 0xffffff, SM_RAM); + + + SekMapHandler(1, 0x900000, 0x903fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); + + + BurnLoadRom(DrvGfxROM0 + 0x070000, 7, 1); + BurnLoadRom(DrvGfxROM0 + 0x0f0000, 8, 1); + BurnLoadRom(DrvGfxROM0 + 0x170000, 9, 1); + BurnLoadRom(DrvGfxROM0 + 0x1f0000, 10, 1); +} + +static INT32 inttooteInit() +{ + DrvSetColorOffsets(0, 0, 0); + DrvSetVideoOffsets(1, 1, -1, -1); + + return DrvInit(inttoote68kInit, 16000000, SET_IRQLINES(0x80, 0x80) /* Custom */, NO_SPRITE_BUFFER, SET_GFX_DECODE(5, 1, -1)); +} +#endif + +struct BurnDriverD BurnDrvInttoote = { + "inttoote", "jockeyc", NULL, NULL, "1998", + "International Toote (Germany)\0", NULL, "Coinmaster", "Seta", + NULL, NULL, NULL, NULL, + BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, inttooteRomInfo, inttooteRomName, NULL, NULL, DrgnunitInputInfo, NULL, + NotWorkingInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0, + 384, 240, 4, 3 +}; + + +// International Toote II (World?) + +static struct BurnRomInfo inttooteaRomDesc[] = { + { "p387.v01_horse_prog_2.002", 0x10000, 0x1ced885e, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "p387.v01_horse_prog_1.003", 0x10000, 0xe24592af, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ya_002_001.u18", 0x80000, 0xdd108016, 0x01 | BRF_PRG | BRF_ESS }, // 2 + + { "ya_011_004.u10", 0x80000, 0xeb74d2e0, 0x03 | BRF_GRA }, // 3 Sprites + { "ya_011_005.u17", 0x80000, 0x4a6c804b, 0x03 | BRF_GRA }, // 4 + { "ya_011_006.u22", 0x80000, 0xbfae01a5, 0x03 | BRF_GRA }, // 5 + { "ya_011_007.u27", 0x80000, 0x2dc7a294, 0x03 | BRF_GRA }, // 6 + { "p523.v01_horse_fore_1.u135", 0x10000, 0x3a75df30, 0x00 | BRF_GRA }, // 7 + { "p523.v01_horse_fore_2.u134", 0x10000, 0x26fb0339, 0x00 | BRF_GRA }, // 8 + { "p523.v01_horse_fore_3.u133", 0x10000, 0xc38596af, 0x00 | BRF_GRA }, // 9 + { "p523.v01_horse_fore_4.u132", 0x10000, 0x64ef345e, 0x00 | BRF_GRA }, // 10 + + { "ya_011_008.u35", 0x40000, 0x4b890f83, 0x04 | BRF_GRA }, // 11 Layer 1 tiles + { "p523.v01_horse_back_1.u137", 0x20000, 0x39b221ea, 0x04 | BRF_GRA }, // 12 + { "ya_011_009.u41", 0x40000, 0xcaa5e3c1, 0x04 | BRF_GRA }, // 13 + { "p523.v01_horse_back_2.u136", 0x20000, 0x9c5e32a0, 0x04 | BRF_GRA }, // 14 + + { "ya_011_013.u71", 0x80000, 0x2bccaf47, 0x06 | BRF_SND }, // 17 x1-010 Samples + { "ya_011_012.u64", 0x80000, 0xa8015ce6, 0x06 | BRF_SND }, // 18 + + { "ya-010.prom", 0x00200, 0x778094b3, 0x00 | BRF_GRA }, // 15 Color Proms + { "ya-011.prom", 0x00200, 0xbd4fe2f6, 0x00 | BRF_GRA }, // 16 +}; + +STD_ROM_PICK(inttootea) +STD_ROM_FN(inttootea) + +struct BurnDriverD BurnDrvInttootea = { + "inttootea", "jockeyc", NULL, NULL, "1993", + "International Toote II (World?)\0", NULL, "Coinmaster", "Seta", + NULL, NULL, NULL, NULL, + BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, inttooteaRomInfo, inttooteaRomName, NULL, NULL, DrgnunitInputInfo, NULL, + NotWorkingInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0, + 384, 240, 4, 3 +}; + + +//----------------------------------------------------------------------------------------------------------------- +// Working games + + +// Dragon Unit / Castle of Dragon + +static struct BurnRomInfo drgnunitRomDesc[] = { + { "prg-e.bin", 0x20000, 0x728447df, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "prg-o.bin", 0x20000, 0xb2f58ecf, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "obj-2.bin", 0x20000, 0xd7f6ab5a, 0x0b | BRF_GRA }, // 2 Sprites + { "obj-1.bin", 0x20000, 0x53a95b13, 0x0b | BRF_GRA }, // 3 + { "obj-6.bin", 0x20000, 0x80b801f7, 0x0b | BRF_GRA }, // 4 + { "obj-5.bin", 0x20000, 0x6b87bc20, 0x0b | BRF_GRA }, // 5 + { "obj-4.bin", 0x20000, 0x60d17771, 0x0b | BRF_GRA }, // 6 + { "obj-3.bin", 0x20000, 0x0bccd4d5, 0x0b | BRF_GRA }, // 7 + { "obj-8.bin", 0x20000, 0x826c1543, 0x0b | BRF_GRA }, // 8 + { "obj-7.bin", 0x20000, 0xcbaa7f6a, 0x0b | BRF_GRA }, // 9 + + { "scr-1o.bin", 0x20000, 0x671525db, 0x04 | BRF_GRA }, // 10 Layer 1 tiles + { "scr-2o.bin", 0x20000, 0x2a3f2ed8, 0x04 | BRF_GRA }, // 11 + { "scr-3o.bin", 0x20000, 0x4d33a92d, 0x04 | BRF_GRA }, // 12 + { "scr-4o.bin", 0x20000, 0x79a0aa61, 0x04 | BRF_GRA }, // 13 + { "scr-1e.bin", 0x20000, 0xdc9cd8c9, 0x04 | BRF_GRA }, // 14 + { "scr-2e.bin", 0x20000, 0xb6126b41, 0x04 | BRF_GRA }, // 15 + { "scr-3e.bin", 0x20000, 0x1592b8c2, 0x04 | BRF_GRA }, // 16 + { "scr-4e.bin", 0x20000, 0x8201681c, 0x04 | BRF_GRA }, // 17 + + { "snd-1.bin", 0x20000, 0x8f47bd0d, 0x06 | BRF_SND }, // 18 x1-010 Samples + { "snd-2.bin", 0x20000, 0x65c40ef5, 0x06 | BRF_SND }, // 19 + { "snd-3.bin", 0x20000, 0x71fbd54e, 0x06 | BRF_SND }, // 20 + { "snd-4.bin", 0x20000, 0xac50133f, 0x06 | BRF_SND }, // 21 + { "snd-5.bin", 0x20000, 0x70652f2c, 0x06 | BRF_SND }, // 22 + { "snd-6.bin", 0x20000, 0x10a1039d, 0x06 | BRF_SND }, // 23 + { "snd-7.bin", 0x20000, 0xdecbc8b0, 0x06 | BRF_SND }, // 24 + { "snd-8.bin", 0x20000, 0x3ac51bee, 0x06 | BRF_SND }, // 25 +}; + +STD_ROM_PICK(drgnunit) +STD_ROM_FN(drgnunit) + +static INT32 drgnunitInit() +{ + DrvSetColorOffsets(0, 0, 0); + DrvSetVideoOffsets(2, 2, -2, -2); + + return DrvInit(drgnunit68kInit, 8000000, SET_IRQLINES(1, 2), SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); +} + +struct BurnDriver BurnDrvDrgnunit = { + "drgnunit", NULL, NULL, NULL, "1989", + "Dragon Unit / Castle of Dragon\0", NULL, "Seta", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, drgnunitRomInfo, drgnunitRomName, NULL, NULL, DrgnunitInputInfo, DrgnunitDIPInfo, + drgnunitInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; + + +// Quiz Kokology + +static struct BurnRomInfo qzkklogyRomDesc[] = { + { "3.u27", 0x20000, 0xb8c27cde, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "1.u9", 0x20000, 0xce01cd54, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "4.u33", 0x20000, 0x4f5c554c, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "2.u17", 0x20000, 0x65fa1b8d, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "t2709u32.u32", 0x80000, 0x900f196c, 0x03 | BRF_GRA }, // 4 Sprites + { "t2709u26.u26", 0x80000, 0x416ac849, 0x03 | BRF_GRA }, // 5 + + { "t2709u42.u39", 0x80000, 0x194d5704, 0x04 | BRF_GRA }, // 6 Layer 1 tiles + { "t2709u39.u42", 0x80000, 0x6f95a76d, 0x04 | BRF_GRA }, // 7 + + { "t2709u47.u47", 0x80000, 0x0ebdad40, 0x06 | BRF_SND }, // 8 x1-010 Samples + { "t2709u55.u55", 0x80000, 0x43960c68, 0x06 | BRF_SND }, // 9 +}; + +STD_ROM_PICK(qzkklogy) +STD_ROM_FN(qzkklogy) + +static INT32 qzkklogyInit() +{ + DrvSetColorOffsets(0, 0, 0); + DrvSetVideoOffsets(1, 1, -1, -1); + + return DrvInit(drgnunit68kInit, 8000000, SET_IRQLINES(1, 2), SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); +} + +struct BurnDriver BurnDrvQzkklogy = { + "qzkklogy", NULL, NULL, NULL, "1992", + "Quiz Kokology\0", NULL, "Tecmo", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, qzkklogyRomInfo, qzkklogyRomName, NULL, NULL, QzkklogyInputInfo, QzkklogyDIPInfo, + qzkklogyInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; + + +// Strike Gunner S.T.G + +static struct BurnRomInfo stgRomDesc[] = { + { "att01003.u27", 0x20000, 0x7a640a93, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "att01001.u9", 0x20000, 0x4fa88ad3, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "att01004.u33", 0x20000, 0xbbd45ca1, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "att01002.u17", 0x20000, 0x2f8fd80c, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "att01006.u32", 0x80000, 0x6ad78ea2, 0x03 | BRF_GRA }, // 4 Sprites + { "att01005.u26", 0x80000, 0xa347ff00, 0x03 | BRF_GRA }, // 5 + + { "att01008.u39", 0x80000, 0x20c47457, 0x04 | BRF_GRA }, // 6 Layer 1 tiles + { "att01007.u42", 0x80000, 0xac975544, 0x04 | BRF_GRA }, // 7 + + { "att01009.u47", 0x80000, 0x4276b58d, 0x06 | BRF_SND }, // 8 x1-010 Samples + { "att01010.u55", 0x80000, 0xfffb2f53, 0x06 | BRF_SND }, // 9 +}; + +STD_ROM_PICK(stg) +STD_ROM_FN(stg) + +static INT32 stgInit() +{ + DrvSetColorOffsets(0, 0, 0); + DrvSetVideoOffsets(0, 0, -2, -2); + + return DrvInit(drgnunit68kInit, 8000000, SET_IRQLINES(2, 1), SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); +} + +struct BurnDriver BurnDrvStg = { + "stg", NULL, NULL, NULL, "1991", + "Strike Gunner S.T.G\0", NULL, "Athena / Tecmo", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, stgRomInfo, stgRomName, NULL, NULL, StgInputInfo, StgDIPInfo, + stgInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 240, 384, 3, 4 +}; + + +// Quiz Kokology 2 + +static struct BurnRomInfo qzkklgy2RomDesc[] = { + { "fn001001.106", 0x080000, 0x7bf8eb17, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fn001003.107", 0x040000, 0xee6ef111, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fn001004.100", 0x100000, 0x5ba139a2, 0x03 | BRF_GRA }, // 2 Sprites + + { "fn001005.104", 0x200000, 0x95726a63, 0x04 | BRF_GRA }, // 3 Layer 1 tiles + + { "fn001006.105", 0x100000, 0x83f201e6, 0x06 | BRF_SND }, // 4 x1-010 Samples +}; + +STD_ROM_PICK(qzkklgy2) +STD_ROM_FN(qzkklgy2) + +static INT32 qzkklgy2Init() +{ + DrvSetColorOffsets(0, 0, 0); + DrvSetVideoOffsets(0, 0, -1, -3); + + return DrvInit(drgnunit68kInit, 16000000, SET_IRQLINES(1, 2), SPRITE_BUFFER, SET_GFX_DECODE(0, 2, -1)); +} + +struct BurnDriver BurnDrvQzkklgy2 = { + "qzkklgy2", NULL, NULL, NULL, "1993", + "Quiz Kokology 2\0", NULL, "Tecmo", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, qzkklgy2RomInfo, qzkklgy2RomName, NULL, NULL, Qzkklgy2InputInfo, Qzkklgy2DIPInfo, + qzkklgy2Init, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; + + +// Daioh (set 1) + +static struct BurnRomInfo daiohRomDesc[] = { + { "fg001001.u3", 0x080000, 0xe1ef3007, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fg001002.u4", 0x080000, 0x5e3481f9, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fg1-004", 0x100000, 0x9ab0533e, 0x03 | BRF_GRA }, // 2 Sprites + { "fg1-003", 0x100000, 0x1c9d51e2, 0x03 | BRF_GRA }, // 3 + + { "fg1-005", 0x200000, 0xc25159b9, 0x04 | BRF_GRA }, // 4 Layer 1 tiles + + { "fg1-006", 0x200000, 0x2052c39a, 0x05 | BRF_GRA }, // 5 Layer 2 tiles + + { "fg1-007", 0x100000, 0x4a2fe9e0, 0x06 | BRF_SND }, // 6 x1-010 Samples +}; + +STD_ROM_PICK(daioh) +STD_ROM_FN(daioh) + +static INT32 daiohInit() +{ + DrvSetVideoOffsets(1, 1, -1, -1); + DrvSetColorOffsets(0, 0x400, 0x200); + + return DrvInit(daioh68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); +} + +struct BurnDriver BurnDrvDaioh = { + "daioh", NULL, NULL, NULL, "1993", + "Daioh (set 1)\0", NULL, "Athena", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, daiohRomInfo, daiohRomName, NULL, NULL, DaiohInputInfo, DaiohDIPInfo, + daiohInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, + 240, 384, 3, 4 +}; + + +// Daioh (set 2) + +static struct BurnRomInfo daiohaRomDesc[] = { + { "fg1-001.u3", 0x080000, 0x104ae74a, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fg1-002.u4", 0x080000, 0xe39a4e67, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fg1-004", 0x100000, 0x9ab0533e, 0x03 | BRF_GRA }, // 2 Sprites + { "fg1-003", 0x100000, 0x1c9d51e2, 0x03 | BRF_GRA }, // 3 + + { "fg1-005", 0x200000, 0xc25159b9, 0x04 | BRF_GRA }, // 4 Layer 1 tiles + + { "fg1-006", 0x200000, 0x2052c39a, 0x05 | BRF_GRA }, // 5 Layer 2 tiles + + { "fg1-007", 0x100000, 0x4a2fe9e0, 0x06 | BRF_SND }, // 6 x1-010 Samples +}; + +STD_ROM_PICK(daioha) +STD_ROM_FN(daioha) + +struct BurnDriver BurnDrvDaioha = { + "daioha", "daioh", NULL, NULL, "1993", + "Daioh (set 2)\0", NULL, "Athena", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, daiohaRomInfo, daiohaRomName, NULL, NULL, DaiohInputInfo, DaiohDIPInfo, + daiohInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, + 240, 384, 3, 4 +}; + + +// Rezon + +static struct BurnRomInfo rezonRomDesc[] = { + { "us001001.u3", 0x020000, 0xab923052, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "us001002.u4", 0x020000, 0x3dafa0d5, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "us001004.103", 0x020000, 0x54871c7c, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "us001003.102", 0x020000, 0x1ac3d272, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "us001006.u64", 0x080000, 0xa4916e96, 0x03 | BRF_GRA }, // 4 Sprites + { "us001005.u63", 0x080000, 0xe6251ebc, 0x03 | BRF_GRA }, // 5 + + { "us001007.u66", 0x080000, 0x3760b935, 0x04 | BRF_GRA }, // 6 Layer 1 tiles + + { "us001008.u68", 0x080000, 0x0ab73910, 0x05 | BRF_GRA }, // 7 Layer 2 tiles + + { "us001009.u70", 0x100000, 0x0d7d2e2b, 0x06 | BRF_SND }, // 8 x1-010 Samples +}; + +STD_ROM_PICK(rezon) +STD_ROM_FN(rezon) + +static INT32 rezonInit() +{ + DrvSetVideoOffsets(0, 0, -2, -2); + DrvSetColorOffsets(0, 0x400, 0x200); + + INT32 nRet = DrvInit(wrofaero68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); + + if (nRet == 0) { + memcpy (Drv68KROM + 0x100000, Drv68KROM + 0x040000, 0x040000); + memset (Drv68KROM + 0x040000, 0, 0x40000); + BurnByteswap(DrvSndROM, 0x100000); + } + + return nRet; +} + +struct BurnDriver BurnDrvRezon = { + "rezon", NULL, NULL, NULL, "1991", + "Rezon\0", NULL, "Allumer", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, rezonRomInfo, rezonRomName, NULL, NULL, RezonInputInfo, RezonDIPInfo, + rezonInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, + 384, 240, 4, 3 +}; + + +// Rezon (Taito) + +static struct BurnRomInfo rezontRomDesc[] = { + { "us001001.u3", 0x020000, 0xab923052, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "rezon_1_p.u4", 0x020000, 0x9ed32f8c, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "us001004.103", 0x020000, 0x54871c7c, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "us001003.102", 0x020000, 0x1ac3d272, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "us001006.u64", 0x080000, 0xa4916e96, 0x03 | BRF_GRA }, // 4 Sprites + { "us001005.u63", 0x080000, 0xe6251ebc, 0x03 | BRF_GRA }, // 5 + + { "us001007.u66", 0x080000, 0x3760b935, 0x04 | BRF_GRA }, // 6 Layer 1 tiles + + { "us001008.u68", 0x080000, 0x0ab73910, 0x05 | BRF_GRA }, // 7 Layer 2 tiles + + { "us001009.u70", 0x100000, 0x0d7d2e2b, 0x06 | BRF_SND }, // 8 x1-010 Samples +}; + +STD_ROM_PICK(rezont) +STD_ROM_FN(rezont) + +struct BurnDriver BurnDrvRezont = { + "rezont", "rezon", NULL, NULL, "1992", + "Rezon (Taito)\0", NULL, "Allumer (Taito license)", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, rezontRomInfo, rezontRomName, NULL, NULL, RezonInputInfo, RezonDIPInfo, + rezonInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, + 384, 240, 4, 3 +}; + + +// Eight Forces + +static struct BurnRomInfo eightfrcRomDesc[] = { + { "uy2-u4.u3", 0x040000, 0xf1f249c5, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "uy2-u3.u4", 0x040000, 0x6f2d8618, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "u64.bin", 0x080000, 0xf561ff2e, 0x03 | BRF_GRA }, // 2 Sprites + { "u63.bin", 0x080000, 0x4c3f8366, 0x03 | BRF_GRA }, // 3 + + { "u66.bin", 0x100000, 0x6fad2b7f, 0x04 | BRF_GRA }, // 4 Layer 1 tiles + + { "u68.bin", 0x100000, 0xc17aad22, 0x05 | BRF_GRA }, // 5 Layer 2 tiles + + { "u70.bin", 0x100000, 0xdfdb67a3, 0x06 | BRF_SND }, // 6 x1-010 Samples + { "u69.bin", 0x100000, 0x82ec08f1, 0x06 | BRF_SND }, // 7 +}; + +STD_ROM_PICK(eightfrc) +STD_ROM_FN(eightfrc) + +static INT32 eightfrcInit() +{ + DrvSetVideoOffsets(3, 4, 0, 0); + DrvSetColorOffsets(0, 0x400, 0x200); + + INT32 nRet = DrvInit(wrofaero68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); + + if (nRet == 0) { + memcpy (DrvSndROM + 0x100000, DrvSndROM + 0x0c0000, 0x140000); // sound banks + } + + return nRet; +} + +struct BurnDriver BurnDrvEightfrc = { + "eightfrc", NULL, NULL, NULL, "1994", + "Eight Forces\0", NULL, "Tecmo", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, eightfrcRomInfo, eightfrcRomName, NULL, NULL, EightfrcInputInfo, EightfrcDIPInfo, + eightfrcInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, + 224, 384, 3, 4 +}; + + +// War of Aero - Project MEIOU + +static struct BurnRomInfo wrofaeroRomDesc[] = { + { "u3.bin", 0x40000, 0x9b896a97, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "u4.bin", 0x40000, 0xdda84846, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "u64.bin", 0x80000, 0xf06ccd78, 0x03 | BRF_GRA }, // 2 Sprites + { "u63.bin", 0x80000, 0x2a602a1b, 0x03 | BRF_GRA }, // 3 + + { "u66.bin", 0x80000, 0xc9fc6a0c, 0x04 | BRF_GRA }, // 4 Layer 1 tiles + + { "u68.bin", 0x80000, 0x25c0c483, 0x05 | BRF_GRA }, // 5 Layer 2 tiles + + { "u69.bin", 0x80000, 0x957ecd41, 0x06 | BRF_SND }, // 6 x1-010 Samples + { "u70.bin", 0x80000, 0x8d756fdf, 0x06 | BRF_SND }, // 7 +}; + +STD_ROM_PICK(wrofaero) +STD_ROM_FN(wrofaero) + +static INT32 wrofaeroInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0x400, 0x200); + + return DrvInit(wrofaero68kInit, 16000000, SET_IRQLINES(2, 4), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); +} + +struct BurnDriver BurnDrvWrofaero = { + "wrofaero", NULL, NULL, NULL, "1993", + "War of Aero - Project MEIOU\0", NULL, "Yang Cheng", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, wrofaeroRomInfo, wrofaeroRomName, NULL, NULL, WrofaeroInputInfo, WrofaeroDIPInfo, + wrofaeroInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, + 240, 384, 3, 4 +}; + + +// Zing Zing Zip + +static struct BurnRomInfo zingzipRomDesc[] = { + { "uy001001.3", 0x040000, 0x1a1687ec, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "uy001002.4", 0x040000, 0x62e3b0c4, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "uy001006.64", 0x080000, 0x46e4a7d8, 0x03 | BRF_GRA }, // 2 Sprites + { "uy001005.63", 0x080000, 0x4aac128e, 0x03 | BRF_GRA }, // 3 + + { "uy001008.66", 0x100000, 0x1dff7c4b, 0x04 | BRF_GRA }, // 4 Layer 1 tiles + { "uy001007.65", 0x080000, 0xec5b3ab9, 0x1c | BRF_GRA }, // 5 + + { "uy001010.68", 0x100000, 0xbdbcdf03, 0x05 | BRF_GRA }, // 6 Layer 2 tiles + + { "uy001011.70", 0x100000, 0xbd845f55, 0x06 | BRF_SND }, // 7 x1-010 Samples +}; + +STD_ROM_PICK(zingzip) +STD_ROM_FN(zingzip) + +static INT32 zingzipInit() +{ + DrvSetVideoOffsets(0, 0, -1, -2); + DrvSetColorOffsets(0, 0x400, 0x200); + + INT32 nRet = DrvInit(wrofaero68kInit, 16000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 2)); + + if (nRet == 0) { + zingzapSetColorTable(); + } + + return nRet; +} + +struct BurnDriver BurnDrvZingzip = { + "zingzip", NULL, NULL, NULL, "1992", + "Zing Zing Zip\0", NULL, "Allumer + Tecmo", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, zingzipRomInfo, zingzipRomName, NULL, NULL, ZingzipInputInfo, ZingzipDIPInfo, + zingzipInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0xc00, + 240, 384, 3, 4 +}; + + +// Mobile Suit Gundam + +static struct BurnRomInfo msgundamRomDesc[] = { + { "fa003002.u25", 0x080000, 0x1cc72d4c, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fa001001.u20", 0x100000, 0xfca139d0, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fa001008.u21", 0x200000, 0xe7accf48, 0x03 | BRF_GRA }, // 2 Sprites + { "fa001007.u22", 0x200000, 0x793198a6, 0x03 | BRF_GRA }, // 3 + + { "fa001006.u23", 0x100000, 0x3b60365c, 0x04 | BRF_GRA }, // 4 Layer 1 tiles + + { "fa001005.u24", 0x080000, 0x8cd7ff86, 0x05 | BRF_GRA }, // 5 Layer 2 tiles + + { "fa001004.u26", 0x100000, 0xb965f07c, 0x06 | BRF_SND }, // 6 x1-010 Samples +}; + +STD_ROM_PICK(msgundam) +STD_ROM_FN(msgundam) + +static INT32 msgundamInit() +{ + refresh_rate = 5666; // 56.66 hz + DrvSetVideoOffsets(0, 0, -2, -2); + DrvSetColorOffsets(0, 0x400, 0x200); + + INT32 nRet = DrvInit(msgundam68kInit, 16000000, SET_IRQLINES(4, 2), SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); + + if (nRet == 0) { + memmove (Drv68KROM + 0x100000, Drv68KROM + 0x080000, 0x100000); + memset(Drv68KROM + 0x080000, 0, 0x080000); + } + + return nRet; +} + +struct BurnDriver BurnDrvMsgundam = { + "msgundam", NULL, NULL, NULL, "1993", + "Mobile Suit Gundam\0", NULL, "Banpresto", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, msgundamRomInfo, msgundamRomName, NULL, NULL, MsgundamInputInfo, MsgundamDIPInfo, + msgundamInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, + 384, 240, 4, 3 +}; + + +// Mobile Suit Gundam (Japan) + +static struct BurnRomInfo msgundam1RomDesc[] = { + { "fa002002.u25", 0x080000, 0xdee3b083, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fa001001.u20", 0x100000, 0xfca139d0, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fa001008.u21", 0x200000, 0xe7accf48, 0x03 | BRF_GRA }, // 2 Sprites + { "fa001007.u22", 0x200000, 0x793198a6, 0x03 | BRF_GRA }, // 3 + + { "fa001006.u23", 0x100000, 0x3b60365c, 0x04 | BRF_GRA }, // 4 Layer 1 tiles + + { "fa001005.u24", 0x080000, 0x8cd7ff86, 0x05 | BRF_GRA }, // 5 Layer 2 tiles + + { "fa001004.u26", 0x100000, 0xb965f07c, 0x06 | BRF_SND }, // 6 x1-010 Samples +}; + +STD_ROM_PICK(msgundam1) +STD_ROM_FN(msgundam1) + +struct BurnDriver BurnDrvMsgundam1 = { + "msgundam1", "msgundam", NULL, NULL, "1993", + "Mobile Suit Gundam (Japan)\0", NULL, "Banpresto", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, msgundam1RomInfo, msgundam1RomName, NULL, NULL, MsgundamInputInfo, Msgunda1DIPInfo, + msgundamInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, + 384, 240, 4, 3 +}; + + +// SD Gundam Neo Battling (Japan) + +static struct BurnRomInfo neobattlRomDesc[] = { + { "bp923001.u45", 0x020000, 0x0d0aeb73, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "bp923002.u46", 0x020000, 0x9731fbbc, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "bp923-003.u15", 0x080000, 0x91ca98a1, 0x03 | BRF_GRA }, // 2 Sprites + { "bp923-004.u9", 0x080000, 0x15c678e3, 0x03 | BRF_GRA }, // 3 + + { "bp923-005.u4", 0x100000, 0x7c0e37be, 0x06 | BRF_SND }, // 4 x1-010 Samples +}; + +STD_ROM_PICK(neobattl) +STD_ROM_FN(neobattl) + +static INT32 umanclubInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(umanclub68kInit, 16000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); +} + +struct BurnDriver BurnDrvNeobattl = { + "neobattl", NULL, NULL, NULL, "1992", + "SD Gundam Neo Battling (Japan)\0", NULL, "Banpresto / Sotsu Agency. Sunrise", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, neobattlRomInfo, neobattlRomName, NULL, NULL, NeobattlInputInfo, NeobattlDIPInfo, + umanclubInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 240, 384, 3, 4 +}; + + +// Ultraman Club - Tatakae! Ultraman Kyoudai!! + +static struct BurnRomInfo umanclubRomDesc[] = { + { "uw001006.u48", 0x020000, 0x3dae1e9d, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "uw001007.u49", 0x020000, 0x5c21e702, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "bp-u-002.u2", 0x080000, 0x936cbaaa, 0x03 | BRF_GRA }, // 2 Sprites + { "bp-u-001.u1", 0x080000, 0x87813c48, 0x03 | BRF_GRA }, // 3 + + { "uw003.u13", 0x100000, 0xe2f718eb, 0x06 | BRF_SND }, // 4 x1-010 Samples +}; + +STD_ROM_PICK(umanclub) +STD_ROM_FN(umanclub) + +struct BurnDriver BurnDrvUmanclub = { + "umanclub", NULL, NULL, NULL, "1992", + "Ultraman Club - Tatakae! Ultraman Kyoudai!!\0", NULL, "Tsuburaya Prod. / Banpresto", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, umanclubRomInfo, umanclubRomName, NULL, NULL, UmanclubInputInfo, UmanclubDIPInfo, + umanclubInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; + + +// Masked Riders Club Battle Race + +static struct BurnRomInfo kamenridRomDesc[] = { + { "fj001003.25", 0x080000, 0x9b65d1b9, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + + { "fj001005.21", 0x100000, 0x5d031333, 0x03 | BRF_GRA }, // 1 Sprites + { "fj001006.22", 0x100000, 0xcf28eb78, 0x03 | BRF_GRA }, // 2 + + { "fj001007.152", 0x080000, 0xd9ffe80b, 0x04 | BRF_GRA }, // 3 user1 + + { "fj001008.26", 0x100000, 0x45e2b329, 0x06 | BRF_SND }, // 4 x1-010 Samples +}; + +STD_ROM_PICK(kamenrid) +STD_ROM_FN(kamenrid) + +static INT32 kamenridInit() +{ + DrvSetVideoOffsets(0, 0, -2, -2); + DrvSetColorOffsets(0, 0x400, 0x200); + + return DrvInit(kamenrid68kInit, 16000000, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); +} + +struct BurnDriver BurnDrvKamenrid = { + "kamenrid", NULL, NULL, NULL, "1993", + "Masked Riders Club Battle Race\0", NULL, "Toei / Banpresto", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, kamenridRomInfo, kamenridRomName, NULL, NULL, KamenridInputInfo, KamenridDIPInfo, + kamenridInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, + 384, 240, 4, 3 +}; + + +// Mad Shark + +static struct BurnRomInfo madsharkRomDesc[] = { + { "fq001002.201", 0x080000, 0x4286a811, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fq001001.200", 0x080000, 0x38bfa0ad, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fq001004.202", 0x200000, 0xe56a1b5e, 0x03 | BRF_GRA }, // 2 Sprites + + { "fq001006.152", 0x200000, 0x3bc5e8e4, 0x04 | BRF_GRA }, // 3 user1 + { "fq001005.205", 0x100000, 0x5f6c6d4a, 0x1c | BRF_GRA }, // 4 + + { "fq001007.26", 0x100000, 0xe4b33c13, 0x06 | BRF_SND }, // 5 x1-010 Samples +}; + +STD_ROM_PICK(madshark) +STD_ROM_FN(madshark) + +static INT32 madsharkInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0x200, 0xa00); + + INT32 nRet = DrvInit(madshark68kInit, 16000000, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 3)); + + if (nRet == 0) { + jjsquawkSetColorTable(); + } + + return nRet; +} + +static INT32 madsharkExit() +{ + BurnFree (DrvGfxROM2); + + return DrvExit(); +} + +struct BurnDriver BurnDrvMadshark = { + "madshark", NULL, NULL, NULL, "1993", + "Mad Shark\0", NULL, "Allumer", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, madsharkRomInfo, madsharkRomName, NULL, NULL, MadsharkInputInfo, MadsharkDIPInfo, + madsharkInit, madsharkExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, + 224, 384, 3, 4 +}; + + +// Wit's (Japan) + +static struct BurnRomInfo witsRomDesc[] = { + { "un001001.u1", 0x08000, 0x416c567e, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "un001002.u4", 0x08000, 0x497a3fa6, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "un001008.7l", 0x20000, 0x1d5d0b2b, 0x0b | BRF_GRA }, // 2 Sprites + { "un001007.5l", 0x20000, 0x9e1e6d51, 0x0b | BRF_GRA }, // 3 + { "un001006.4l", 0x20000, 0x98a980d4, 0x0b | BRF_GRA }, // 4 + { "un001005.2l", 0x20000, 0x6f2ce3c0, 0x0b | BRF_GRA }, // 5 + + { "un001004.12a", 0x20000, 0xa15ff938, 0x06 | BRF_SND }, // 6 x1-010 Samples + { "un001003.10a", 0x20000, 0x3f4b9e55, 0x06 | BRF_SND }, // 7 +}; + +STD_ROM_PICK(wits) +STD_ROM_FN(wits) + +static INT32 witsInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(thunderl68kInit, 8000000, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); +} + +struct BurnDriver BurnDrvWits = { + "wits", NULL, NULL, NULL, "1989", + "Wit's (Japan)\0", NULL, "Athena (Visco license)", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_SETA1, GBF_MISC, 0, + NULL, witsRomInfo, witsRomName, NULL, NULL, WitsInputInfo, WitsDIPInfo, + witsInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; + + +// Thunder & Lightning + +static struct BurnRomInfo thunderlRomDesc[] = { + { "m4", 0x08000, 0x1e6b9462, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "m5", 0x08000, 0x7e82793e, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "t17", 0x20000, 0x599a632a, 0x0b | BRF_GRA }, // 2 Sprites + { "t16", 0x20000, 0x3aeef91c, 0x0b | BRF_GRA }, // 3 + { "t15", 0x20000, 0xb97a7b56, 0x0b | BRF_GRA }, // 4 + { "t14", 0x20000, 0x79c707be, 0x0b | BRF_GRA }, // 5 + + { "r28", 0x80000, 0xa043615d, 0x06 | BRF_SND }, // 6 x1-010 Samples + { "r27", 0x80000, 0xcb8425a3, 0x06 | BRF_SND }, // 7 +}; + +STD_ROM_PICK(thunderl) +STD_ROM_FN(thunderl) + +struct BurnDriver BurnDrvThunderl = { + "thunderl", NULL, NULL, NULL, "1990", + "Thunder & Lightning\0", NULL, "Seta", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, thunderlRomInfo, thunderlRomName, NULL, NULL, ThunderlInputInfo, ThunderlDIPInfo, + witsInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 240, 384, 3, 4 +}; + + +// Athena no Hatena ? + +static struct BurnRomInfo atehateRomDesc[] = { + { "fs001001.evn", 0x080000, 0x4af1f273, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fs001002.odd", 0x080000, 0xc7ca7a85, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fs001003.gfx", 0x200000, 0x8b17e431, 0x03 | BRF_GRA }, // 2 Sprites + + { "fs001004.pcm", 0x100000, 0xf9344ce5, 0x06 | BRF_SND }, // 3 x1-010 Samples +}; + +STD_ROM_PICK(atehate) +STD_ROM_FN(atehate) + +static INT32 atehateInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(atehate68kInit, 16000000, SET_IRQLINES(2, 1), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); +} + +struct BurnDriver BurnDrvAtehate = { + "atehate", NULL, NULL, NULL, "1993", + "Athena no Hatena ?\0", NULL, "Athena", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, atehateRomInfo, atehateRomName, NULL, NULL, AtehateInputInfo, AtehateDIPInfo, + atehateInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; + + +// Block Carnival / Thunder & Lightning 2 + +static struct BurnRomInfo blockcarRomDesc[] = { + { "u1.a1", 0x20000, 0x4313fb00, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "u4.a3", 0x20000, 0x2237196d, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "bl-chr-0.j3", 0x80000, 0xa33300ca, 0x03 | BRF_GRA }, // 2 Sprites + { "bl-chr-1.l3", 0x80000, 0x563de808, 0x03 | BRF_GRA }, // 3 + + { "bl-snd-0.a13", 0x80000, 0xa92dabaf, 0x06 | BRF_SND }, // 4 x1-010 Samples +}; + +STD_ROM_PICK(blockcar) +STD_ROM_FN(blockcar) + +static INT32 blockcarInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(blockcar68kInit, 8000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); +} + +struct BurnDriver BurnDrvBlockcar = { + "blockcar", NULL, NULL, NULL, "1992", + "Block Carnival / Thunder & Lightning 2\0", NULL, "Visco", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, blockcarRomInfo, blockcarRomName, NULL, NULL, BlockcarInputInfo, BlockcarDIPInfo, + blockcarInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 240, 384, 3, 4 +}; + + +// Zombie Raid (US) + +static struct BurnRomInfo zombraidRomDesc[] = { + { "fy001003.3", 0x080000, 0x0b34b8f7, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fy001004.4", 0x080000, 0x71bfeb1a, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "fy001002.103", 0x080000, 0x313fd68f, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "fy001001.102", 0x080000, 0xa0f61f13, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "fy001006.200", 0x200000, 0xe9ae99f7, 0x03 | BRF_GRA }, // 4 Sprites + + { "fy001008.66", 0x200000, 0x73d7b0e1, 0x04 | BRF_GRA }, // 5 Layer 1 tiles + { "fy001007.65", 0x100000, 0xb2fc2c81, 0x1c | BRF_GRA }, // 6 + + { "fy001010.68", 0x200000, 0x8b40ed7a, 0x05 | BRF_GRA }, // 7 Layer 2 tiles + { "fy001009.67", 0x100000, 0x6bcca641, 0x1d | BRF_GRA }, // 8 + + { "fy001012.b", 0x200000, 0xfd30e102, 0x06 | BRF_SND }, // 9 x1-010 Samples + { "fy001011.a", 0x200000, 0xe3c431de, 0x06 | BRF_SND }, // 10 +}; + +STD_ROM_PICK(zombraid) +STD_ROM_FN(zombraid) + +static INT32 zombraidInit() +{ + DrvSetVideoOffsets(0, 0, -2, -2); + DrvSetColorOffsets(0, 0x200, 0xa00); + + INT32 nRet = DrvInit(zombraid68kInit, 16000000, SET_IRQLINES(2, 4), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 3)); + + if (nRet == 0) { + gundharaSetColorTable(); + } + + return nRet; +} + +struct BurnDriver BurnDrvZombraid = { + "zombraid", NULL, NULL, NULL, "1995", + "Zombie Raid (US)\0", NULL, "American Sammy", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, zombraidRomInfo, zombraidRomName, NULL, NULL, ZombraidInputInfo, ZombraidDIPInfo, + zombraidInit, DrvExit, DrvFrame, zombraidDraw, DrvScan, &DrvRecalc, 0x1200, + 384, 240, 4, 3 +}; + + +// Gundhara + +static struct BurnRomInfo gundharaRomDesc[] = { + { "bpgh-003.u3", 0x080000, 0x14e9970a, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "bpgh-004.u4", 0x080000, 0x96dfc658, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "bpgh-002.103", 0x080000, 0x312f58e2, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "bpgh-001.102", 0x080000, 0x8d23a23c, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "bpgh-008.u64", 0x200000, 0x7ed9d272, 0x03 | BRF_GRA }, // 4 Sprites + { "bpgh-006.201", 0x200000, 0x5a81411d, 0x03 | BRF_GRA }, // 5 + { "bpgh-007.u63", 0x200000, 0xaa49ce7b, 0x03 | BRF_GRA }, // 6 + { "bpgh-005.200", 0x200000, 0x74138266, 0x03 | BRF_GRA }, // 7 + + { "bpgh-010.u66", 0x100000, 0xb742f0b8, 0x04 | BRF_GRA }, // 8 Layer 1 tiles + { "bpgh-009.u65", 0x080000, 0xb768e666, 0x1c | BRF_GRA }, // 9 + + { "bpgh-012.u68", 0x200000, 0xedfda595, 0x05 | BRF_GRA }, // 10 Layer 2 tiles + { "bpgh-011.u67", 0x100000, 0x49aff270, 0x1d | BRF_GRA }, // 11 + + { "bpgh-013.u70", 0x100000, 0x0fa5d503, 0x06 | BRF_SND }, // 12 x1-010 Samples +}; + +STD_ROM_PICK(gundhara) +STD_ROM_FN(gundhara) + +static void gundhara68kInit() +{ + wrofaero68kInit(); + + memmove (DrvSndROM + 0x100000, DrvSndROM + 0x080000, 0x080000); + memmove (DrvSndROM + 0x000000, DrvSndROM + 0x080000, 0x100000); +} + +static INT32 gundharaInit() +{ + DrvSetVideoOffsets(0, 0, -2, -2); + DrvSetColorOffsets(0, 0x200, 0xa00); + + INT32 nRet = DrvInit(gundhara68kInit, 16000000, SET_IRQLINES(2, 4), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 3)); + + if (nRet == 0) { + gundharaSetColorTable(); + } + + return nRet; +} + +struct BurnDriver BurnDrvGundhara = { + "gundhara", NULL, NULL, NULL, "1995", + "Gundhara\0", NULL, "Banpresto", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, gundharaRomInfo, gundharaRomName, NULL, NULL, GundharaInputInfo, GundharaDIPInfo, + gundharaInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, + 240, 384, 3, 4 +}; + + +// Blandia + +static struct BurnRomInfo blandiaRomDesc[] = { + { "ux001001.u3", 0x040000, 0x2376a1f3, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ux001002.u4", 0x040000, 0xb915e172, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ux001003.u202", 0x100000, 0x98052c63, 0x01 | BRF_PRG | BRF_ESS }, // 2 + + { "ux001008.u64", 0x100000, 0x413647b6, 0x03 | BRF_GRA }, // 6 + { "ux001007.u201", 0x100000, 0x4440fdd1, 0x03 | BRF_GRA }, // 4 + { "ux001006.u63", 0x100000, 0xabc01cf7, 0x03 | BRF_GRA }, // 5 + { "ux001005.u200", 0x100000, 0xbea0c4a5, 0x03 | BRF_GRA }, // 3 Sprites + + { "ux001009.u65", 0x080000, 0xbc6f6aea, 0x04 | BRF_GRA }, // 7 Layer 1 tiles + { "ux001010.u66", 0x080000, 0xbd7f7614, 0x04 | BRF_GRA }, // 8 + + { "ux001011.u67", 0x080000, 0x5efe0397, 0x05 | BRF_GRA }, // 9 Layer 2 tiles + { "ux001012.u068", 0x080000, 0xf29959f6, 0x05 | BRF_GRA }, // 10 + + { "ux001013.u69", 0x100000, 0x5cd273cd, 0x06 | BRF_SND }, // 11 x1-010 Samples + { "ux001014.u70", 0x080000, 0x86b49b4e, 0x06 | BRF_SND }, // 12 +}; + +STD_ROM_PICK(blandia) +STD_ROM_FN(blandia) + +static INT32 blandiaInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0xa00, 0x200); + + INT32 nRet = DrvInit(blandia68kInit, 16000000, SET_IRQLINES(2, 4), SPRITE_BUFFER, SET_GFX_DECODE(0, 4, 4)); + + if (nRet == 0) { + blandiaSetColorTable(); + } + + return nRet; +} + +struct BurnDriver BurnDrvBlandia = { + "blandia", NULL, NULL, NULL, "1992", + "Blandia\0", NULL, "Allumer", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, blandiaRomInfo, blandiaRomName, NULL, NULL, BlandiaInputInfo, BlandiaDIPInfo, + blandiaInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, + 384, 240, 4, 3 +}; + + +// Blandia (prototype) + +static struct BurnRomInfo blandiapRomDesc[] = { + { "prg-even.bin", 0x40000, 0x7ecd30e8, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "prg-odd.bin", 0x40000, 0x42b86c15, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "tbl0.bin", 0x80000, 0x69b79eb8, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "tbl1.bin", 0x80000, 0xcf2fd350, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "o-1.bin", 0x80000, 0x4c67b7f0, 0x0b | BRF_GRA }, // 4 Sprites + { "o-0.bin", 0x80000, 0x5e7b8555, 0x0b | BRF_GRA }, // 5 + { "o-5.bin", 0x80000, 0x40bee78b, 0x0b | BRF_GRA }, // 6 + { "o-4.bin", 0x80000, 0x7c634784, 0x0b | BRF_GRA }, // 7 + { "o-3.bin", 0x80000, 0x387fc7c4, 0x0b | BRF_GRA }, // 8 + { "o-2.bin", 0x80000, 0xc669bb49, 0x0b | BRF_GRA }, // 9 + { "o-7.bin", 0x80000, 0xfc77b04a, 0x0b | BRF_GRA }, // 10 + { "o-6.bin", 0x80000, 0x92882943, 0x0b | BRF_GRA }, // 11 + + { "v1-2.bin", 0x20000, 0xd524735e, 0x04 | BRF_GRA }, // 12 Layer 1 tiles + { "v1-5.bin", 0x20000, 0xeb440cdb, 0x04 | BRF_GRA }, // 13 + { "v1-1.bin", 0x20000, 0x09bdf75f, 0x04 | BRF_GRA }, // 14 + { "v1-4.bin", 0x20000, 0x803911e5, 0x04 | BRF_GRA }, // 15 + { "v1-0.bin", 0x20000, 0x73617548, 0x04 | BRF_GRA }, // 16 + { "v1-3.bin", 0x20000, 0x7f18e4fb, 0x04 | BRF_GRA }, // 17 + + { "v2-2.bin", 0x20000, 0xc4f15638, 0x05 | BRF_GRA }, // 18 Layer 2 tiles + { "v2-5.bin", 0x20000, 0xc2e57622, 0x05 | BRF_GRA }, // 19 + { "v2-1.bin", 0x20000, 0xc4f15638, 0x05 | BRF_GRA }, // 20 + { "v2-4.bin", 0x20000, 0x16ec2130, 0x05 | BRF_GRA }, // 21 + { "v2-0.bin", 0x20000, 0x5b05eba9, 0x05 | BRF_GRA }, // 22 + { "v2-3.bin", 0x20000, 0x80ad0c3b, 0x05 | BRF_GRA }, // 23 + + { "s-0.bin", 0x40000, 0xa5fde408, 0x06 | BRF_SND }, // 24 x1-010 Samples + { "s-1.bin", 0x40000, 0x3083f9c4, 0x06 | BRF_SND }, // 25 + { "s-2.bin", 0x40000, 0xa591c9ef, 0x06 | BRF_SND }, // 26 + { "s-3.bin", 0x40000, 0x68826c9d, 0x06 | BRF_SND }, // 27 + { "s-4.bin", 0x40000, 0x1c7dc8c2, 0x06 | BRF_SND }, // 28 + { "s-5.bin", 0x40000, 0x4bb0146a, 0x06 | BRF_SND }, // 29 + { "s-6.bin", 0x40000, 0x9f8f34ee, 0x06 | BRF_SND }, // 30 + { "s-7.bin", 0x40000, 0xe077dd39, 0x06 | BRF_SND }, // 31 +}; + +STD_ROM_PICK(blandiap) +STD_ROM_FN(blandiap) + +static INT32 blandiapInit() +{ + DrvSetVideoOffsets(0, 8, -2, 6); + DrvSetColorOffsets(0, 0xa00, 0x200); + + INT32 nRet = DrvInit(blandiap68kInit, 16000000, SET_IRQLINES(2, 4), SPRITE_BUFFER, SET_GFX_DECODE(0, 4, 4)); + + if (nRet == 0) { + blandiaSetColorTable(); + } + + return nRet; +} + +struct BurnDriver BurnDrvBlandiap = { + "blandiap", "blandia", NULL, NULL, "1992", + "Blandia (prototype)\0", NULL, "Allumer", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, blandiapRomInfo, blandiapRomName, NULL, NULL, BlandiaInputInfo, BlandiaDIPInfo, + blandiapInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, + 384, 240, 4, 3 +}; + + +// Oishii Puzzle Ha Irimasenka + +static struct BurnRomInfo oisipuzlRomDesc[] = { + { "ss1u200.v10", 0x80000, 0xf5e53baf, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ss1u201.v10", 0x80000, 0x7a7ff5ae, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "ss1u306.v10", 0x80000, 0xce43a754, 0x03 | BRF_GRA }, // 2 Sprites + { "ss1u307.v10", 0x80000, 0x2170b7ec, 0x03 | BRF_GRA }, // 3 + { "ss1u304.v10", 0x80000, 0x546ab541, 0x03 | BRF_GRA }, // 4 + { "ss1u305.v10", 0x80000, 0x2a33e08b, 0x03 | BRF_GRA }, // 5 + + { "ss1u23.v10", 0x80000, 0x9fa60901, 0x04 | BRF_GRA }, // 6 Layer 1 tiles + { "ss1u24.v10", 0x80000, 0xc10eb4b3, 0x04 | BRF_GRA }, // 7 + + { "ss1u25.v10", 0x80000, 0x56840728, 0x05 | BRF_GRA }, // 8 Layer 2 tiles + + { "ss1u26.v10", 0x80000, 0xd452336b, 0x06 | BRF_SND }, // 9 x1-010 Samples + { "ss1u27.v10", 0x80000, 0x17fe921d, 0x06 | BRF_SND }, // 10 +}; + +STD_ROM_PICK(oisipuzl) +STD_ROM_FN(oisipuzl) + +static INT32 oisipuzlInit() +{ + oisipuzl_hack = 1; // 32 pixel offset for sprites??? + watchdog_enable = 1; // needs a reset before it will boot + + DrvSetVideoOffsets(2, 2, -1, -1); + DrvSetColorOffsets(0, 0x400, 0x200); + + INT32 nRet = DrvInit(oisipuzl68kInit, 16000000, (2 << 8) | (1 << 0), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); + + if (nRet == 0) + { + memset (Drv68KROM, 0, 0x200000); + + if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; + if (BurnLoadRom(Drv68KROM + 0x100000, 1, 1)) return 1; + + for (INT32 i = 0; i < 0x400000; i++) DrvGfxROM0[i] ^= 0x0f; // invert + } + + return nRet; +} + +struct BurnDriver BurnDrvOisipuzl = { + "oisipuzl", NULL, NULL, NULL, "1993", + "Oishii Puzzle Ha Irimasenka\0", NULL, "Sunsoft + Atlus", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, oisipuzlRomInfo, oisipuzlRomName, NULL, NULL, OisipuzlInputInfo, OisipuzlDIPInfo, + oisipuzlInit, DrvExit, DrvFrame, seta2layerFlippedDraw, DrvScan, &DrvRecalc, 0x600, + 320, 224, 4, 3 +}; + + +// Triple Fun + +static struct BurnRomInfo triplfunRomDesc[] = { + { "05.bin", 0x80000, 0x06eb3821, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "04.bin", 0x80000, 0x37a5c46e, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "09.bin", 0x80000, 0x98cc8ca5, 0x0b | BRF_GRA }, // 2 Sprites + { "08.bin", 0x80000, 0x63a8f10f, 0x0b | BRF_GRA }, // 3 + { "11.bin", 0x80000, 0x276ef724, 0x0b | BRF_GRA }, // 4 + { "10.bin", 0x80000, 0x20b0f282, 0x0b | BRF_GRA }, // 5 + + { "02.bin", 0x80000, 0x4c0d1068, 0x0c | BRF_GRA }, // 6 Layer 1 tiles + { "03.bin", 0x80000, 0xdba94e18, 0x0c | BRF_GRA }, // 7 + + { "06.bin", 0x40000, 0x8944bb72, 0x0d | BRF_GRA }, // 8 Layer 2 tiles + { "07.bin", 0x40000, 0x934a5d91, 0x0d | BRF_GRA }, // 9 + + { "01.bin", 0x40000, 0xc186a930, 0x06 | BRF_SND }, // 10 OKI M6295 Samples +}; + +STD_ROM_PICK(triplfun) +STD_ROM_FN(triplfun) + +static INT32 triplfunInit() +{ + oisipuzl_hack = 1; + DrvSetVideoOffsets(0, 0, -1, -1); + DrvSetColorOffsets(0, 0x400, 0x200); + + return DrvInit(triplfun68kInit, 16000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); +} + +struct BurnDriver BurnDrvTriplfun = { + "triplfun", "oisipuzl", NULL, NULL, "1993", + "Triple Fun\0", NULL, "bootleg", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, triplfunRomInfo, triplfunRomName, NULL, NULL, OisipuzlInputInfo, OisipuzlDIPInfo, + triplfunInit, DrvExit, DrvM6295Frame, seta2layerFlippedDraw, DrvScan, &DrvRecalc, 0x600, + 320, 224, 4, 3 +}; + + +// Pairs Love + +static struct BurnRomInfo pairloveRomDesc[] = { + { "ut2-001-001.1a", 0x10000, 0x083338b7, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ut2-001-002.3a", 0x10000, 0x39d88aae, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "ut2-001-004.5j", 0x80000, 0xfdc47b26, 0x03 | BRF_GRA }, // 2 Sprites + { "ut2-001-005.5l", 0x80000, 0x076f94a2, 0x03 | BRF_GRA }, // 3 + + { "ut2-001-003.12a", 0x80000, 0x900219a9, 0x06 | BRF_SND }, // 4 x1-010 Samples +}; + +STD_ROM_PICK(pairlove) +STD_ROM_FN(pairlove) + +static INT32 pairloveInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + INT32 nRet = DrvInit(pairlove68kInit, 8000000, SET_IRQLINES(2, 1), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); + + if (nRet == 0) { + memcpy (DrvSndROM + 0x80000, DrvSndROM, 0x80000); + } + + return nRet; +} + +struct BurnDriver BurnDrvPairlove = { + "pairlove", NULL, NULL, NULL, "1991", + "Pairs Love\0", NULL, "Athena", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, pairloveRomInfo, pairloveRomName, NULL, NULL, PairloveInputInfo, PairloveDIPInfo, + pairloveInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 240, 384, 3, 4 +}; + + +// Orbs (10/7/94 prototype?) + +static struct BurnRomInfo orbsRomDesc[] = { + { "orbs.u10", 0x80000, 0x10f079c8, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "orbs.u9", 0x80000, 0xf269d16f, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "orbs.u14", 0x80000, 0x1cc76541, 0x03 | BRF_GRA }, // 2 Sprites + { "orbs.u13", 0x80000, 0x784bdc1a, 0x03 | BRF_GRA }, // 3 + { "orbs.u12", 0x80000, 0xb8c352c2, 0x03 | BRF_GRA }, // 4 + { "orbs.u11", 0x80000, 0x58cb38ba, 0x03 | BRF_GRA }, // 5 + + { "orbs.u15", 0x80000, 0xbc0e9fe3, 0x06 | BRF_SND }, // 6 x1-010 Samples + { "orbs.u16", 0x80000, 0xaecd8373, 0x06 | BRF_SND }, // 7 +}; + +STD_ROM_PICK(orbs) +STD_ROM_FN(orbs) + +static INT32 orbsInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(pairlove68kInit, 7159090, SET_IRQLINES(2, 1), NO_SPRITE_BUFFER, SET_GFX_DECODE(5, -1, -1)); +} + +struct BurnDriver BurnDrvOrbs = { + "orbs", NULL, NULL, NULL, "1994", + "Orbs (10/7/94 prototype?)\0", NULL, "American Sammy", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, orbsRomInfo, orbsRomName, NULL, NULL, OrbsInputInfo, OrbsDIPInfo, + orbsInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 320, 240, 4, 3 +}; + + +// Kero Kero Keroppi no Issyoni Asobou (Japan) + +static struct BurnRomInfo keroppiRomDesc[] = { + { "ft-001-001.u10", 0x80000, 0x37861e7d, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ft-001-002.u9", 0x80000, 0xf531d4ef, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "ft-001-003.u14", 0x80000, 0x62fb22fb, 0x03 | BRF_GRA }, // 2 Sprites + { "ft-001-004.u13", 0x80000, 0x69908c98, 0x03 | BRF_GRA }, // 3 + { "ft-001-005.u12", 0x80000, 0xde6432a8, 0x03 | BRF_GRA }, // 4 + { "ft-001-006.u11", 0x80000, 0x9c500eae, 0x03 | BRF_GRA }, // 5 + + { "ft-001-007.u15", 0x80000, 0xc98dacf0, 0x06 | BRF_SND }, // 6 x1-010 Samples + { "ft-001-008.u16", 0x80000, 0xb9c4b637, 0x06 | BRF_SND }, // 7 +}; + +STD_ROM_PICK(keroppi) +STD_ROM_FN(keroppi) + +struct BurnDriver BurnDrvKeroppi = { + "keroppi", NULL, NULL, NULL, "1993", + "Kero Kero Keroppi no Issyoni Asobou (Japan)\0", NULL, "Sammy Industries", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 1, HARDWARE_SETA1, GBF_MISC, 0, + NULL, keroppiRomInfo, keroppiRomName, NULL, NULL, KeroppiInputInfo, KeroppiDIPInfo, + orbsInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 320, 240, 4, 3 +}; + + +// J. J. Squawkers + +static struct BurnRomInfo jjsquawkRomDesc[] = { + { "fe2002001.u3", 0x80000, 0x7b9af960, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fe2002002.u4", 0x80000, 0x47dd71a3, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fe2001009", 0x80000, 0x27441cd3, 0x03 | BRF_GRA }, // 2 Sprites + { "fe2001010", 0x80000, 0xca2b42c4, 0x03 | BRF_GRA }, // 3 + { "fe2001007", 0x80000, 0x62c45658, 0x03 | BRF_GRA }, // 4 + { "fe2001008", 0x80000, 0x2690c57b, 0x03 | BRF_GRA }, // 5 + + { "fe2001011", 0x80000, 0x98b9f4b4, 0x04 | BRF_GRA }, // 6 Layer 1 tiles + { "fe2001012", 0x80000, 0xd4aa916c, 0x04 | BRF_GRA }, // 7 + { "fe2001003", 0x80000, 0xa5a35caf, 0x1c | BRF_GRA }, // 8 + + { "fe2001014", 0x80000, 0x274bbb48, 0x05 | BRF_GRA }, // 9 Layer 2 tiles + { "fe2001013", 0x80000, 0x51e29871, 0x05 | BRF_GRA }, // 10 + { "fe2001004", 0x80000, 0xa235488e, 0x1d | BRF_GRA }, // 11 + + { "fe2001005.u69", 0x80000, 0xd99f2879, 0x06 | BRF_SND }, // 12 x1-010 Samples + { "fe2001006.u70", 0x80000, 0x9df1e478, 0x06 | BRF_SND }, // 13 +}; + +STD_ROM_PICK(jjsquawk) +STD_ROM_FN(jjsquawk) + +static INT32 jjsquawkInit() +{ + DrvSetVideoOffsets(1, 1, -1, -1); + DrvSetColorOffsets(0, 0x200, 0xa00); + + INT32 nRet = DrvInit(wrofaero68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 3)); + + if (nRet == 0) { + jjsquawkSetColorTable(); + + memcpy (Drv68KROM + 0x100000, Drv68KROM + 0x080000, 0x080000); + memset (Drv68KROM + 0x080000, 0, 0x080000); + } + + return nRet; +} + +struct BurnDriver BurnDrvJjsquawk = { + "jjsquawk", NULL, NULL, NULL, "1993", + "J. J. Squawkers\0", NULL, "Athena / Able", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, jjsquawkRomInfo, jjsquawkRomName, NULL, NULL, JjsquawkInputInfo, JjsquawkDIPInfo, + jjsquawkInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, + 384, 240, 4, 3 +}; + + +// J. J. Squawkers (bootleg, Blandia conversion) + +static struct BurnRomInfo jjsquawkb2RomDesc[] = { + { "u3.3a", 0x080000, 0xf94c913b, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "u4.4a", 0x080000, 0x0227a2be, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "u64.3l", 0x100000, 0x11d8713a, 0x03 | BRF_GRA }, // 2 Sprites // jj-rom9 + jj-rom10 from jjsquawk + { "u63.2l", 0x100000, 0x7a385ef0, 0x03 | BRF_GRA }, // 3 // jj-rom7 + jj-rom8 from jjsquawk + + { "u66.5l", 0x100000, 0xbbaf40c5, 0x04 | BRF_GRA }, // 4 Layer 1 tiles // jj-rom11 + jj-rom12 from jjsquawk + { "u65.4l", 0x080000, 0xa5a35caf, 0x1c | BRF_GRA }, // 5 // jj-rom3.040 from jjsquawk + + { "u68.7l", 0x100000, 0xae9ae01f, 0x05 | BRF_GRA }, // 9 Layer 2 tiles // jj-rom14 + jj-rom13 from jjsquawk + { "u67.6l", 0x080000, 0xa235488e, 0x1d | BRF_GRA }, // 10 // jj-rom4.040 from jjsquawk + + { "u70.10l", 0x100000, 0x181a55b8, 0x06 | BRF_SND }, // 11 x1-010 Samples // jj-rom5.040 + jj-rom6.040 from jjsquawk +}; + +STD_ROM_PICK(jjsquawkb2) +STD_ROM_FN(jjsquawkb2) + +struct BurnDriver BurnDrvJjsquawkb2 = { + "jjsquawkb2", "jjsquawk", NULL, NULL, "1993", + "J. J. Squawkers (bootleg, Blandia conversion)\0", NULL, "Athena / Able", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, jjsquawkb2RomInfo, jjsquawkb2RomName, NULL, NULL, JjsquawkInputInfo, JjsquawkDIPInfo, + jjsquawkInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, + 384, 240, 4, 3 +}; + + +// J. J. Squawkers (bootleg) + +static struct BurnRomInfo jjsquawkbRomDesc[] = { + { "3", 0x080000, 0xafd5bd07, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "2", 0x080000, 0x740a7366, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "4.bin", 0x200000, 0x969502f7, 0x03 | BRF_GRA }, // 2 Sprites + { "2.bin", 0x200000, 0x765253d1, 0x03 | BRF_GRA }, // 3 + + { "3.bin", 0x200000, 0xb1e3a4bb, 0x04 | BRF_GRA }, // 4 Layer 1 tiles + { "1.bin", 0x200000, 0xa5d37cf7, 0x04 | BRF_GRA }, // 5 + + { "1", 0x100000, 0x181a55b8, 0x06 | BRF_SND }, // 6 x1-010 Samples +}; + +STD_ROM_PICK(jjsquawkb) +STD_ROM_FN(jjsquawkb) + +static INT32 jjsquawkbInit() +{ + DrvSetVideoOffsets(1, 1, -1, -1); + DrvSetColorOffsets(0, 0x200, 0xa00); + + INT32 nRet = DrvInit(jjsquawkb68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 3)); + + if (nRet == 0) { + jjsquawkSetColorTable(); + } + + return nRet; +} + +struct BurnDriver BurnDrvJjsquawkb = { + "jjsquawkb", "jjsquawk", NULL, NULL, "1993", + "J. J. Squawkers (bootleg)\0", NULL, "bootleg", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, jjsquawkbRomInfo, jjsquawkbRomName, NULL, NULL, JjsquawkInputInfo, JjsquawkDIPInfo, + jjsquawkbInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, + 384, 240, 4, 3 +}; + + +// Extreme Downhill (v1.5) + +static struct BurnRomInfo extdwnhlRomDesc[] = { + { "fw001002.201", 0x080000, 0x24d21924, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fw001001.200", 0x080000, 0xfb12a28b, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fw001003.202", 0x200000, 0xac9b31d5, 0x03 | BRF_GRA }, // 2 Sprites + + { "fw001004.206", 0x200000, 0x0dcb1d72, 0x04 | BRF_GRA }, // 3 Layer 1 tiles + { "fw001005.205", 0x100000, 0x5c33b2f1, 0x1c | BRF_GRA }, // 4 + + { "fw001006.152", 0x200000, 0xd00e8ddd, 0x05 | BRF_GRA }, // 5 Layer 2 tiles + + { "fw001007.026", 0x100000, 0x16d84d7a, 0x06 | BRF_SND }, // 6 x1-010 Samples +}; + +STD_ROM_PICK(extdwnhl) +STD_ROM_FN(extdwnhl) + +static INT32 extdwnhlInit() +{ + watchdog_enable = 1; + + DrvSetVideoOffsets(0, 0, -2, -2); + DrvSetColorOffsets(0, 0x400, 0x200); + + INT32 nRet = DrvInit(extdwnhl68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 3, 2)); + + if (nRet == 0) { + zingzapSetColorTable(); + if (DrvGfxTransMask[2] == NULL) { + DrvGfxTransMask[2] = DrvGfxTransMask[1]; // sokonuke fix + bprintf (0, _T("null\n")); + } + } + + return nRet; +} + +struct BurnDriver BurnDrvExtdwnhl = { + "extdwnhl", NULL, NULL, NULL, "1995", + "Extreme Downhill (v1.5)\0", NULL, "Sammy Industries Japan", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, extdwnhlRomInfo, extdwnhlRomName, NULL, NULL, ExtdwnhlInputInfo, ExtdwnhlDIPInfo, + extdwnhlInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, + 320, 240, 4, 3 +}; + + +// Sokonuke Taisen Game (Japan) + +static struct BurnRomInfo sokonukeRomDesc[] = { + { "001-001.bin", 0x080000, 0x9d0aa3ca, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "001-002.bin", 0x080000, 0x96f2ef5f, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "001-003.bin", 0x200000, 0xab9ba897, 0x03 | BRF_GRA }, // 2 Sprites + + { "001-004.bin", 0x100000, 0x34ca3540, 0x04 | BRF_GRA }, // 3 Layer 1 tiles + { "001-005.bin", 0x080000, 0x2b95d68d, 0x1c | BRF_GRA }, // 4 + + { "001-006.bin", 0x100000, 0xecfac767, 0x06 | BRF_SND }, // 5 x1-010 Samples +}; + +STD_ROM_PICK(sokonuke) +STD_ROM_FN(sokonuke) + +struct BurnDriver BurnDrvSokonuke = { + "sokonuke", NULL, NULL, NULL, "1995", + "Sokonuke Taisen Game (Japan)\0", NULL, "Sammy Industries", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, sokonukeRomInfo, sokonukeRomName, NULL, NULL, SokonukeInputInfo, SokonukeDIPInfo, + extdwnhlInit, DrvExit, DrvFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, + 320, 240, 4, 3 +}; + + +// Krazy Bowl + +static struct BurnRomInfo krzybowlRomDesc[] = { + { "fv001.002", 0x40000, 0x8c03c75f, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fv001.001", 0x40000, 0xf0630beb, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fv001.003", 0x80000, 0x7de22749, 0x03 | BRF_GRA }, // 2 Sprites + { "fv001.004", 0x80000, 0xc7d2fe32, 0x03 | BRF_GRA }, // 3 + + { "fv001.005", 0x80000, 0x5e206062, 0x06 | BRF_SND }, // 4 x1-010 Samples + { "fv001.006", 0x80000, 0x572a15e7, 0x06 | BRF_SND }, // 5 +}; + +STD_ROM_PICK(krzybowl) +STD_ROM_FN(krzybowl) + +static INT32 krzybowlInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(krzybowl68kInit, 16000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); +} + +struct BurnDriverD BurnDrvKrzybowl = { + "krzybowl", NULL, NULL, NULL, "1994", + "Krazy Bowl\0", NULL, "American Sammy", "Seta", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, krzybowlRomInfo, krzybowlRomName, NULL, NULL, KrzybowlInputInfo, KrzybowlDIPInfo, + krzybowlInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 240, 320, 3, 4 +}; + + +// Wiggie Waggie + +static struct BurnRomInfo wiggieRomDesc[] = { + { "wiggie.e19", 0x10000, 0x24b58f16, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "wiggie.e21", 0x10000, 0x83ba6edb, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "wiggie.a5", 0x10000, 0x8078d77b, 0x02 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "wiggie.j16", 0x20000, 0x4fb40b8a, 0x03 | BRF_GRA }, // 3 Sprites + { "wiggie.j18", 0x20000, 0xebc418e9, 0x03 | BRF_GRA }, // 4 + { "wiggie.j20", 0x20000, 0xc073501b, 0x03 | BRF_GRA }, // 5 + { "wiggie.j21", 0x20000, 0x22f6fa39, 0x03 | BRF_GRA }, // 6 + + { "wiggie.d1", 0x40000, 0x27fbe12a, 0x06 | BRF_SND }, // 7 OKI M6295 Samples +}; + +STD_ROM_PICK(wiggie) +STD_ROM_FN(wiggie) + +static INT32 wiggieInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(wiggie68kInit, 16000000 / 2, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(6, -1, -1)); +} + +struct BurnDriver BurnDrvWiggie = { + "wiggie", NULL, NULL, NULL, "1994", + "Wiggie Waggie\0", NULL, "Promat", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, wiggieRomInfo, wiggieRomName, NULL, NULL, ThunderlInputInfo, ThunderlDIPInfo, + wiggieInit, DrvExit, DrvZ80M6295Frame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 240, 384, 3, 4 +}; + + +// Super Bar + +static struct BurnRomInfo superbarRomDesc[] = { + { "promat_512-1.e19", 0x10000, 0xcc7f9e87, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "promat_512-2.e21", 0x10000, 0x5e8c7231, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "promat.a5", 0x10000, 0x8078d77b, 0x02 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "promat_1m-4.j16", 0x20000, 0x43dbc99f, 0x03 | BRF_GRA }, // 3 Sprites + { "promat_1m-5.j18", 0x20000, 0xc09344b0, 0x03 | BRF_GRA }, // 4 + { "promat_1m-6.j20", 0x20000, 0x7d83f8ba, 0x03 | BRF_GRA }, // 5 + { "promat_1m-7.j21", 0x20000, 0x734df92a, 0x03 | BRF_GRA }, // 6 + + { "promat_2m-1.d1", 0x40000, 0x27fbe12a, 0x06 | BRF_SND }, // 7 OKI M6295 Samples +}; + +STD_ROM_PICK(superbar) +STD_ROM_FN(superbar) + +static INT32 superbarInit() +{ + DrvSetVideoOffsets(0, 0, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(wiggie68kInit, 8000000, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(7, -1, -1)); +} + +struct BurnDriver BurnDrvSuperbar = { + "superbar", "wiggie", NULL, NULL, "1994", + "Super Bar\0", NULL, "Promat", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, superbarRomInfo, superbarRomName, NULL, NULL, ThunderlInputInfo, ThunderlDIPInfo, + superbarInit, DrvExit, DrvZ80M6295Frame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 240, 384, 3, 4 +}; + + +// Ultra Toukon Densetsu (Japan) + +static struct BurnRomInfo utoukondRomDesc[] = { + { "93uta010.3", 0x080000, 0xc486ef5e, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "93uta011.4", 0x080000, 0x978978f7, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "93uta009.112", 0x010000, 0x67f18483, 0x02 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "93uta04.64", 0x100000, 0x9cba0538, 0x03 | BRF_GRA }, // 3 Sprites + { "93uta02.201", 0x100000, 0x884fedfa, 0x03 | BRF_GRA }, // 4 + { "93uta03.63", 0x100000, 0x818484a5, 0x03 | BRF_GRA }, // 5 + { "93uta01.200", 0x100000, 0x364de841, 0x03 | BRF_GRA }, // 6 + + { "93uta05.66", 0x100000, 0x5e640bfb, 0x04 | BRF_GRA }, // 7 Layer 1 tiles + + { "93uta07.68", 0x100000, 0x67bdd036, 0x05 | BRF_GRA }, // 8 Layer 2 tiles + { "93uta06.67", 0x100000, 0x294c26e4, 0x05 | BRF_GRA }, // 9 + + { "93uta08.69", 0x100000, 0x3d50bbcd, 0x06 | BRF_SND }, // 10 x1-010 Samples +}; + +STD_ROM_PICK(utoukond) +STD_ROM_FN(utoukond) + +static INT32 utoukondInit() +{ + DrvSetVideoOffsets(0, 0, -2, 0); + DrvSetColorOffsets(0, 0x400, 0x200); + + return DrvInit(utoukond68kInit, 16000000, SET_IRQLINES(2, 1), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 2, 2)); +} + +struct BurnDriver BurnDrvUtoukond = { + "utoukond", NULL, NULL, NULL, "1993", + "Ultra Toukon Densetsu (Japan)\0", "No sound", "Banpresto + Tsuburaya Prod.", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, utoukondRomInfo, utoukondRomName, NULL, NULL, UtoukondInputInfo, UtoukondDIPInfo, + utoukondInit, DrvExit, Drv68kZ80YM3438Frame, seta2layerDraw, DrvScan, &DrvRecalc, 0x600, + 384, 224, 4, 3 +}; + + +// DownTown / Mokugeki (Set 1) + +static struct BurnRomInfo downtownRomDesc[] = { + { "ud2-001-000.3c", 0x40000, 0xf1965260, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ud2-001-003.11c", 0x40000, 0xe7d5fa5f, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ud2001002.9b", 0x10000, 0xa300e3ac, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ud2001001.8b", 0x10000, 0xd2918094, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ud2-002-004.17c", 0x40000, 0xbbd538b1, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code + + { "ud2-001-005-t01.2n", 0x80000, 0x77e6d249, 0x0b | BRF_GRA }, // 5 Sprites + { "ud2-001-006-t02.3n", 0x80000, 0x6e381bf2, 0x0b | BRF_GRA }, // 6 + { "ud2-001-007-t03.5n", 0x80000, 0x737b4971, 0x0b | BRF_GRA }, // 7 + { "ud2-001-008-t04.6n", 0x80000, 0x99b9d757, 0x0b | BRF_GRA }, // 8 + + { "ud2-001-009-t05.8n", 0x80000, 0xaee6c581, 0x04 | BRF_GRA }, // 9 Layer 1 tiles + { "ud2-001-010-t06.9n", 0x80000, 0x3d399d54, 0x04 | BRF_GRA }, // 10 + + { "ud2-001-011-t07.14n", 0x80000, 0x9c9ff69f, 0x06 | BRF_SND }, // 11 x1-010 Samples +}; + +STD_ROM_PICK(downtown) +STD_ROM_FN(downtown) + +static INT32 downtownInit() +{ + refresh_rate = 5742; // 57.42 hz + DrvSetVideoOffsets(0, 0, -1, 0); + DrvSetColorOffsets(0, 0, 0); + + INT32 nRet = DrvInit(downtown68kInit, 8000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); + + x1010_set_all_routes(0.50, BURN_SND_ROUTE_LEFT); + + return nRet; +} + +struct BurnDriver BurnDrvDowntown = { + "downtown", NULL, NULL, NULL, "1989", + "DownTown / Mokugeki (Set 1)\0", "No sound, imperfect inputs", "Seta", "Seta", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, downtownRomInfo, downtownRomName, NULL, NULL, DowntownInputInfo, DowntownDIPInfo, + downtownInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 224, 384, 3, 4 +}; + + +// DownTown / Mokugeki (Set 2) + +static struct BurnRomInfo downtown2RomDesc[] = { + { "ud2-001-000.3c", 0x40000, 0xf1965260, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ud2-001-003.11c", 0x40000, 0xe7d5fa5f, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ud2000002.9b", 0x10000, 0xca976b24, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ud2000001.8b", 0x10000, 0x1708aebd, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ud2-002-004.17c", 0x40000, 0xbbd538b1, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code + + { "ud2-001-005-t01.2n", 0x80000, 0x77e6d249, 0x0b | BRF_GRA }, // 5 Sprites + { "ud2-001-006-t02.3n", 0x80000, 0x6e381bf2, 0x0b | BRF_GRA }, // 6 + { "ud2-001-007-t03.5n", 0x80000, 0x737b4971, 0x0b | BRF_GRA }, // 7 + { "ud2-001-008-t04.6n", 0x80000, 0x99b9d757, 0x0b | BRF_GRA }, // 8 + + { "ud2-001-009-t05.8n", 0x80000, 0xaee6c581, 0x04 | BRF_GRA }, // 9 Layer 1 tiles + { "ud2-001-010-t06.9n", 0x80000, 0x3d399d54, 0x04 | BRF_GRA }, // 10 + + { "ud2-001-011-t07.14n", 0x80000, 0x9c9ff69f, 0x06 | BRF_SND }, // 11 x1-010 Samples +}; + +STD_ROM_PICK(downtown2) +STD_ROM_FN(downtown2) + +struct BurnDriverD BurnDrvDowntown2 = { + "downtown2", "downtown", NULL, NULL, "1989", + "DownTown / Mokugeki (Set 2)\0", "No sound, imperfect inputs", "Seta", "Seta", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, downtown2RomInfo, downtown2RomName, NULL, NULL, DowntownInputInfo, DowntownDIPInfo, + downtownInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 224, 384, 3, 4 +}; + + +// DownTown / Mokugeki (Joystick Hack) + +static struct BurnRomInfo downtownjRomDesc[] = { + { "ud2-001-000.3c", 0x40000, 0xf1965260, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ud2-001-003.11c", 0x40000, 0xe7d5fa5f, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "u37.9b", 0x10000, 0x73047657, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "u31.8b", 0x10000, 0x6a050240, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ud2-002-004.17c", 0x40000, 0xbbd538b1, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code + + { "ud2-001-005-t01.2n", 0x80000, 0x77e6d249, 0x0b | BRF_GRA }, // 5 Sprites + { "ud2-001-006-t02.3n", 0x80000, 0x6e381bf2, 0x0b | BRF_GRA }, // 6 + { "ud2-001-007-t03.5n", 0x80000, 0x737b4971, 0x0b | BRF_GRA }, // 7 + { "ud2-001-008-t04.6n", 0x80000, 0x99b9d757, 0x0b | BRF_GRA }, // 8 + + { "ud2-001-009-t05.8n", 0x80000, 0xaee6c581, 0x04 | BRF_GRA }, // 9 Layer 1 tiles + { "ud2-001-010-t06.9n", 0x80000, 0x3d399d54, 0x04 | BRF_GRA }, // 10 + + { "ud2-001-011-t07.14n", 0x80000, 0x9c9ff69f, 0x06 | BRF_SND }, // 11 x1-010 Samples +}; + +STD_ROM_PICK(downtownj) +STD_ROM_FN(downtownj) + +struct BurnDriver BurnDrvDowntownj = { + "downtownj", "downtown", NULL, NULL, "1989", + "DownTown / Mokugeki (Joystick Hack)\0", "No sound, imperfect inputs", "Seta", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, downtownjRomInfo, downtownjRomName, NULL, NULL, DowntownInputInfo, DowntownDIPInfo, + downtownInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 224, 384, 3, 4 +}; + + +// DownTown / Mokugeki (prototype) + +static struct BurnRomInfo downtownpRomDesc[] = { + { "ud2-001-000.3c", 0x40000, 0xf1965260, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ud2-001-003.11c", 0x40000, 0xe7d5fa5f, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ud2_even_v061.9b", 0x10000, 0x251d6552, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ud2_odd_v061.8b", 0x10000, 0x6394a7c0, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ud2-002-004.17c", 0x40000, 0xbbd538b1, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code + + { "ud2-001-005-t01.2n", 0x80000, 0x77e6d249, 0x0b | BRF_GRA }, // 5 Sprites + { "ud2-001-006-t02.3n", 0x80000, 0x6e381bf2, 0x0b | BRF_GRA }, // 6 + { "ud2-001-007-t03.5n", 0x80000, 0x737b4971, 0x0b | BRF_GRA }, // 7 + { "ud2-001-008-t04.6n", 0x80000, 0x99b9d757, 0x0b | BRF_GRA }, // 8 + + { "ud2-001-009-t05.8n", 0x80000, 0xaee6c581, 0x04 | BRF_GRA }, // 9 Layer 1 tiles + { "ud2-001-010-t06.9n", 0x80000, 0x3d399d54, 0x04 | BRF_GRA }, // 10 + + { "ud2-001-011-t07.14n", 0x80000, 0x9c9ff69f, 0x06 | BRF_SND }, // 11 x1-010 Samples +}; + +STD_ROM_PICK(downtownp) +STD_ROM_FN(downtownp) + +struct BurnDriverD BurnDrvDowntownp = { + "downtownp", "downtown", NULL, NULL, "1989", + "DownTown / Mokugeki (prototype)\0", "No sound, imperfect inputs", "Seta", "Seta", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, downtownpRomInfo, downtownpRomName, NULL, NULL, DowntownInputInfo, DowntownDIPInfo, + downtownInit, DrvExit, DrvFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 224, 384, 3, 4 +}; + + +// Thundercade / Twin Formation + +static struct BurnRomInfo tndrcadeRomDesc[] = { + { "ua0-4.u19", 0x20000, 0x73bd63eb, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ua0-2.u17", 0x20000, 0xe96194b1, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ua0-3.u18", 0x20000, 0x0a7b1c41, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ua0-1.u16", 0x20000, 0xfa906626, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ua10-5.u24", 0x20000, 0x8eff6122, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code + + { "ua0-10.u12", 0x40000, 0xaa7b6757, 0x03 | BRF_GRA }, // 5 Sprites + { "ua0-11.u13", 0x40000, 0x11eaf931, 0x03 | BRF_GRA }, // 6 + { "ua0-12.u14", 0x40000, 0x00b5381c, 0x03 | BRF_GRA }, // 7 + { "ua0-13.u15", 0x40000, 0x8f9a0ed3, 0x03 | BRF_GRA }, // 8 + { "ua0-6.u8", 0x40000, 0x14ecc7bb, 0x03 | BRF_GRA }, // 9 + { "ua0-7.u9", 0x40000, 0xff1a4e68, 0x03 | BRF_GRA }, // 10 + { "ua0-8.u10", 0x40000, 0x936e1884, 0x03 | BRF_GRA }, // 11 + { "ua0-9.u11", 0x40000, 0xe812371c, 0x03 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(tndrcade) +STD_ROM_FN(tndrcade) + +static INT32 tndrcadeInit() +{ + DrvSetVideoOffsets(-1, 0, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(tndrcade68kInit, 8000000, SET_IRQLINES(2, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, -1, -1)); +} + +struct BurnDriverD BurnDrvTndrcade = { + "tndrcade", NULL, NULL, NULL, "1987", + "Thundercade / Twin Formation\0", "No sound, imperfect inputs", "[Seta] (Taito license)", "Seta", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, tndrcadeRomInfo, tndrcadeRomName, NULL, NULL, TndrcadeInputInfo, TndrcadeDIPInfo, + tndrcadeInit, DrvExit, DrvFrame /*DrvM65c02Frame*/, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 224, 384, 3, 4 +}; + + +// Tokusyu Butai U.A.G. (Japan) + +static struct BurnRomInfo tndrcadejRomDesc[] = { + { "ua0-4.u19", 0x20000, 0x73bd63eb, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ua0-2.u17", 0x20000, 0xe96194b1, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ua0-3.u18", 0x20000, 0x0a7b1c41, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ua0-1.u16", 0x20000, 0xfa906626, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "thcade5.u24", 0x20000, 0x8cb9df7b, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code + + { "ua0-10.u12", 0x40000, 0xaa7b6757, 0x03 | BRF_GRA }, // 5 Sprites + { "ua0-11.u13", 0x40000, 0x11eaf931, 0x03 | BRF_GRA }, // 6 + { "ua0-12.u14", 0x40000, 0x00b5381c, 0x03 | BRF_GRA }, // 7 + { "ua0-13.u15", 0x40000, 0x8f9a0ed3, 0x03 | BRF_GRA }, // 8 + { "ua0-6.u8", 0x40000, 0x14ecc7bb, 0x03 | BRF_GRA }, // 9 + { "ua0-7.u9", 0x40000, 0xff1a4e68, 0x03 | BRF_GRA }, // 10 + { "ua0-8.u10", 0x40000, 0x936e1884, 0x03 | BRF_GRA }, // 11 + { "ua0-9.u11", 0x40000, 0xe812371c, 0x03 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(tndrcadej) +STD_ROM_FN(tndrcadej) + +struct BurnDriverD BurnDrvTndrcadej = { + "tndrcadej", "tndrcade", NULL, NULL, "1987", + "Tokusyu Butai U.A.G. (Japan)\0", "No sound, imperfect inputs", "[Seta] (Taito license)", "Seta", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, tndrcadejRomInfo, tndrcadejRomName, NULL, NULL, TndrcadeInputInfo, TndrcadjDIPInfo, + tndrcadeInit, DrvExit, DrvFrame /*DrvM65c02Frame*/, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 224, 384, 3, 4 +}; + + +// Arbalester + +static struct BurnRomInfo arbalestRomDesc[] = { + { "uk-001-003", 0x40000, 0xee878a2c, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "uk-001-004", 0x40000, 0x902bb4e3, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "uk6005", 0x04000, 0x48c73a4a, 0x02 | BRF_PRG | BRF_ESS }, // 2 M65c02 Code + + { "uk001.06", 0x40000, 0x11c75746, 0x0b | BRF_GRA }, // 3 Sprites + { "uk001.07", 0x40000, 0x01b166c7, 0x0b | BRF_GRA }, // 4 + { "uk001.08", 0x40000, 0x78d60ba3, 0x0b | BRF_GRA }, // 5 + { "uk001.09", 0x40000, 0xb4748ae0, 0x0b | BRF_GRA }, // 6 + + { "uk-001-010-t26", 0x80000, 0xc1e2f823, 0x04 | BRF_GRA }, // 7 Layer 1 tiles + { "uk-001-011-t27", 0x80000, 0x09dfe56a, 0x04 | BRF_GRA }, // 8 + { "uk-001-012-t28", 0x80000, 0x818a4085, 0x04 | BRF_GRA }, // 9 + { "uk-001-013-t29", 0x80000, 0x771fa164, 0x04 | BRF_GRA }, // 10 + + { "uk-001-015-t31", 0x80000, 0xce9df5dd, 0x06 | BRF_SND }, // 11 x1-010 Samples + { "uk-001-014-t30", 0x80000, 0x016b844a, 0x06 | BRF_SND }, // 12 +}; + +STD_ROM_PICK(arbalest) +STD_ROM_FN(arbalest) + +static INT32 arbalestInit() +{ + DrvSetVideoOffsets(0, 1, -2, -1); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(metafox68kInit, 8000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); +} + +struct BurnDriver BurnDrvArbalest = { + "arbalest", NULL, NULL, NULL, "1989", + "Arbalester\0", "Imperfect inputs", "Seta", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, arbalestRomInfo, arbalestRomName, NULL, NULL, MetafoxInputInfo, ArbalestDIPInfo, + arbalestInit, DrvExit, DrvFrame /*DrvM65c02Frame*/, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 224, 384, 3, 4 +}; + + +// Meta Fox + +static struct BurnRomInfo metafoxRomDesc[] = { + { "p1003161", 0x40000, 0x4fd6e6a1, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "p1004162", 0x40000, 0xb6356c9a, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "up001002", 0x10000, 0xce91c987, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "up001001", 0x10000, 0x0db7a505, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "up001005", 0x02000, 0x2ac5e3e3, 0x02 | BRF_PRG | BRF_ESS }, // 4 m65c02 Code + + { "p1006163", 0x40000, 0x80f69c7c, 0x0b | BRF_GRA }, // 5 Sprites + { "p1007164", 0x40000, 0xd137e1a3, 0x0b | BRF_GRA }, // 6 + { "p1008165", 0x40000, 0x57494f2b, 0x0b | BRF_GRA }, // 7 + { "p1009166", 0x40000, 0x8344afd2, 0x0b | BRF_GRA }, // 8 + + { "up001010", 0x80000, 0xbfbab472, 0x04 | BRF_GRA }, // 9 Layer 1 tiles + { "up001011", 0x80000, 0x26cea381, 0x04 | BRF_GRA }, // 10 + { "up001012", 0x80000, 0xfed2c5f9, 0x04 | BRF_GRA }, // 11 + { "up001013", 0x80000, 0xadabf9ea, 0x04 | BRF_GRA }, // 12 + + { "up001015", 0x80000, 0x2e20e39f, 0x06 | BRF_SND }, // 13 x1-010 Samples + { "up001014", 0x80000, 0xfca6315e, 0x06 | BRF_SND }, // 14 +}; + +STD_ROM_PICK(metafox) +STD_ROM_FN(metafox) + +static INT32 metafoxInit() +{ + DrvSetVideoOffsets(0, 0, 16, -19); + DrvSetColorOffsets(0, 0, 0); + + INT32 nRet = DrvInit(metafox68kInit, 8000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); + + if (nRet == 0) { + *((UINT16*)(Drv68KROM + 0x8ab1c)) = 0x4e71; + *((UINT16*)(Drv68KROM + 0x8ab1e)) = 0x4e71; + *((UINT16*)(Drv68KROM + 0x8ab20)) = 0x4e71; + } + + return nRet; +} + +struct BurnDriver BurnDrvMetafox = { + "metafox", NULL, NULL, NULL, "1989", + "Meta Fox\0", "Imperfect inputs", "Seta", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, metafoxRomInfo, metafoxRomName, NULL, NULL, MetafoxInputInfo, MetafoxDIPInfo, + metafoxInit, DrvExit, DrvFrame /*DrvM65c02Frame*/, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 224, 384, 3, 4 +}; + + +// Pro Mahjong Kiwame + +static struct BurnRomInfo kiwameRomDesc[] = { + { "fp001001.bin", 0x40000, 0x31b17e39, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "fp001002.bin", 0x40000, 0x5a6e2efb, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "fp001003.bin", 0x80000, 0x0f904421, 0x03 | BRF_GRA }, // 2 Sprites + + { "fp001006.bin", 0x80000, 0x96cf395d, 0x06 | BRF_SND }, // 3 x1-010 Samples + { "fp001005.bin", 0x80000, 0x65b5fe9a, 0x06 | BRF_SND }, // 4 +}; + +STD_ROM_PICK(kiwame) +STD_ROM_FN(kiwame) + +static INT32 kiwameInit() +{ + DrvSetVideoOffsets(0, -16, 0, 0); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(kiwame68kInit, 16000000, SET_IRQLINES(1, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); +} + +struct BurnDriverD BurnDrvKiwame = { + "kiwame", NULL, NULL, NULL, "1994", + "Pro Mahjong Kiwame\0", NULL, "Athena", "Seta", + NULL, NULL, NULL, NULL, + 0, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, kiwameRomInfo, kiwameRomName, NULL, NULL, KiwameInputInfo, KiwameDIPInfo, + kiwameInit, DrvExit, DrvFrame, setaNoLayersDraw, DrvScan, &DrvRecalc, 0x200, + 448, 240, 4, 3 +}; + + +// Twin Eagle - Revenge Joe's Brother + +static struct BurnRomInfo twineaglRomDesc[] = { + { "ua2-1", 0x80000, 0x5c3fe531, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + + { "ua2-2", 0x02000, 0x783ca84e, 0x02 | BRF_PRG | BRF_ESS }, // 1 M65c02 Code + + { "ua2-4", 0x40000, 0x8b7532d6, 0x0b | BRF_GRA }, // 2 Sprites + { "ua2-3", 0x40000, 0x1124417a, 0x0b | BRF_GRA }, // 3 + { "ua2-6", 0x40000, 0x99d8dbba, 0x0b | BRF_GRA }, // 4 + { "ua2-5", 0x40000, 0x6e450d28, 0x0b | BRF_GRA }, // 5 + + { "ua2-8", 0x80000, 0x7d3a8d73, 0x04 | BRF_GRA }, // 6 Layer 1 tiles + { "ua2-10", 0x80000, 0x5bbe1f56, 0x04 | BRF_GRA }, // 7 + { "ua2-7", 0x80000, 0xfce56907, 0x04 | BRF_GRA }, // 8 + { "ua2-9", 0x80000, 0xa451eae9, 0x04 | BRF_GRA }, // 9 + + { "ua2-11", 0x80000, 0x624e6057, 0x06 | BRF_SND }, // 10 x1-010 Samples + { "ua2-12", 0x80000, 0x3068ff64, 0x06 | BRF_SND }, // 11 +}; + +STD_ROM_PICK(twineagl) +STD_ROM_FN(twineagl) + +static INT32 twineaglInit() +{ + twineagle = 1; + + DrvSetVideoOffsets(0, 0, 0, -3); + DrvSetColorOffsets(0, 0, 0); + + return DrvInit(twineagle68kInit, 8000000, SET_IRQLINES(3, NOIRQ2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); +} + +struct BurnDriver BurnDrvTwineagl = { + "twineagl", NULL, NULL, NULL, "1988", + "Twin Eagle - Revenge Joe's Brother\0", "Imperfect inputs", "Seta (Taito license)", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, twineaglRomInfo, twineaglRomName, NULL, NULL, TwineaglInputInfo, TwineaglDIPInfo, + twineaglInit, DrvExit, DrvFrame /*DrvM65c02Frame*/, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 224, 384, 3, 4 +}; + + +// U.S. Classic + +static struct BurnRomInfo usclssicRomDesc[] = { + { "ue2001.u20", 0x20000, 0x18b41421, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ue2000.u14", 0x20000, 0x69454bc2, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ue2002.u22", 0x20000, 0xa7bbe248, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "ue2003.u30", 0x20000, 0x29601906, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "ue002u61.004", 0x40000, 0x476e9f60, 0x02 | BRF_PRG | BRF_ESS }, // 4 M65c02 Code + + { "ue001009.119", 0x80000, 0xdc065204, 0x0b | BRF_GRA }, // 5 Sprites + { "ue001008.118", 0x80000, 0x5947d9b5, 0x0b | BRF_GRA }, // 6 + { "ue001007.117", 0x80000, 0xb48a885c, 0x0b | BRF_GRA }, // 7 + { "ue001006.116", 0x80000, 0xa6ab6ef4, 0x0b | BRF_GRA }, // 8 + + { "ue001010.120", 0x80000, 0xdd683031, 0x04 | BRF_GRA }, // 9 Layer 1 tiles + { "ue001011.121", 0x80000, 0x0e27bc49, 0x04 | BRF_GRA }, // 10 + { "ue001012.122", 0x80000, 0x961dfcdc, 0x04 | BRF_GRA }, // 11 + { "ue001013.123", 0x80000, 0x03e9eb79, 0x04 | BRF_GRA }, // 12 + { "ue001014.124", 0x80000, 0x9576ace7, 0x04 | BRF_GRA }, // 13 + { "ue001015.125", 0x80000, 0x631d6eb1, 0x04 | BRF_GRA }, // 14 + { "ue001016.126", 0x80000, 0xf44a8686, 0x04 | BRF_GRA }, // 15 + { "ue001017.127", 0x80000, 0x7f568258, 0x04 | BRF_GRA }, // 16 + { "ue001018.128", 0x80000, 0x4bd98f23, 0x04 | BRF_GRA }, // 17 + { "ue001019.129", 0x80000, 0x6d9f5a33, 0x04 | BRF_GRA }, // 18 + { "ue001020.130", 0x80000, 0xbc07403f, 0x04 | BRF_GRA }, // 19 + { "ue001021.131", 0x80000, 0x98c03efd, 0x04 | BRF_GRA }, // 20 + + { "ue001005.132", 0x80000, 0xc5fea37c, 0x06 | BRF_SND }, // 21 x1-010 Samples + + { "ue1-023.prm", 0x00200, 0xa13192a4, 0x0f | BRF_GRA }, // 22 Color PROMs + { "ue1-022.prm", 0x00200, 0x1a23129e, 0x0f | BRF_GRA }, // 23 +}; + +STD_ROM_PICK(usclssic) +STD_ROM_FN(usclssic) + +static INT32 usclssicInit() +{ + watchdog_enable = 1; + DrvSetColorOffsets(0, 0x200, 0); + DrvSetVideoOffsets(1, 2, 0, -1); + + INT32 nRet = DrvInit(usclssic68kInit, 8000000, SET_IRQLINES(0x80, 0x80) /*custom*/, NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 4, -1)); + + if (nRet == 0) { + usclssicSetColorTable(); + } + + return nRet; +} + +struct BurnDriverD BurnDrvUsclssic = { + "usclssic", NULL, NULL, NULL, "1989", + "U.S. Classic\0", "No sound, imperfect inputs", "Seta", "Seta", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, usclssicRomInfo, usclssicRomName, NULL, NULL, UsclssicInputInfo, UsclssicDIPInfo, + usclssicInit, DrvExit, Drv5IRQFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0xa00, + 240, 384, 3, 4 +}; + + +// Caliber 50 + +static struct BurnRomInfo calibr50RomDesc[] = { + { "uh002001.u45", 0x40000, 0xeb92e7ed, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "uh002004.u41", 0x40000, 0x5a0ed31e, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "uh001003.9a", 0x10000, 0x0d30d09f, 0x01 | BRF_PRG | BRF_ESS }, // 2 + { "uh001002.7a", 0x10000, 0x7aecc3f9, 0x01 | BRF_PRG | BRF_ESS }, // 3 + + { "uh001005.u61", 0x40000, 0x4a54c085, 0x02 | BRF_PRG | BRF_ESS }, // 4 m65c02 Code + + { "uh001006.ux2", 0x80000, 0xfff52f91, 0x0b | BRF_GRA }, // 5 Sprites + { "uh001007.ux1", 0x80000, 0xb6c19f71, 0x0b | BRF_GRA }, // 6 + { "uh001008.ux6", 0x80000, 0x7aae07ef, 0x0b | BRF_GRA }, // 7 + { "uh001009.ux0", 0x80000, 0xf85da2c5, 0x0b | BRF_GRA }, // 8 + + { "uh001010.u3x", 0x80000, 0xf986577a, 0x04 | BRF_GRA }, // 9 Layer 1 tiles + { "uh001011.u50", 0x80000, 0x08620052, 0x04 | BRF_GRA }, // 10 + + { "uh001013.u60", 0x80000, 0x09ec0df6, 0x06 | BRF_SND }, // 11 x1-010 Samples + { "uh001012.u46", 0x80000, 0xbb996547, 0x06 | BRF_SND }, // 12 +}; + +STD_ROM_PICK(calibr50) +STD_ROM_FN(calibr50) + +static INT32 calibr50Init() +{ + refresh_rate = 5742; // 57.42 hz + watchdog_enable = 1; + DrvSetColorOffsets(0, 0, 0); + DrvSetVideoOffsets(-1, 2, -3, -2); + + INT32 nRet = DrvInit(calibr5068kInit, 8000000, SET_IRQLINES(0x80, 0x80) /*custom*/, NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1)); + + x1010_set_all_routes(0.50, BURN_SND_ROUTE_LEFT); + + return nRet; +} + +struct BurnDriver BurnDrvCalibr50 = { + "calibr50", NULL, NULL, NULL, "1989", + "Caliber 50\0", "No sound, imperfect inputs", "Athena / Seta", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, calibr50RomInfo, calibr50RomName, NULL, NULL, Calibr50InputInfo, Calibr50DIPInfo, + calibr50Init, DrvExit, Drv5IRQFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 240, 384, 3, 4 +}; + + +// Crazy Fight + +static struct BurnRomInfo crazyfgtRomDesc[] = { + { "rom.u3", 0x40000, 0xbf333e75, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "rom.u4", 0x40000, 0x505e9d47, 0x01 | BRF_PRG | BRF_ESS }, // 1 + + { "rom.u228", 0x80000, 0x7181618e, 0x03 | BRF_GRA }, // 2 Sprites + { "rom.u227", 0x80000, 0x7905b5f2, 0x03 | BRF_GRA }, // 3 + { "rom.u226", 0x80000, 0xef210e34, 0x03 | BRF_GRA }, // 4 + { "rom.u225", 0x80000, 0x451b4419, 0x03 | BRF_GRA }, // 5 + + { "rom.u67", 0x40000, 0xec8c6831, 0x04 | BRF_GRA }, // 6 Layer 1 tiles + { "rom.u68", 0x80000, 0x2124312e, 0x04 | BRF_GRA }, // 7 + + { "rom.u65", 0x40000, 0x58448231, 0x05 | BRF_GRA }, // 8 Layer 2 tiles + { "rom.u66", 0x80000, 0xc6f7735b, 0x05 | BRF_GRA }, // 9 + + { "rom.u85", 0x40000, 0x7b95d0bb, 0x06 | BRF_SND }, // 10 OKI M6295 Samples +}; + +STD_ROM_PICK(crazyfgt) +STD_ROM_FN(crazyfgt) + +static INT32 crazyfgtInit() +{ + DrvSetColorOffsets(0, 0xa00, 0x200); + DrvSetVideoOffsets(6, 0, -4, 0); + + INT32 nRet = DrvInit(crazyfgt68kInit, 16000000, SET_IRQLINES(0x80, 0x80) /*custom*/, NO_SPRITE_BUFFER, SET_GFX_DECODE(5, 4, 4)); + + if (nRet == 0) { + gundharaSetColorTable(); + } + + return nRet; +} + +struct BurnDriver BurnDrvCrazyfgt = { + "crazyfgt", NULL, NULL, NULL, "1996", + "Crazy Fight\0", NULL, "Subsino", "Seta", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, crazyfgtRomInfo, crazyfgtRomName, NULL, NULL, CrazyfgtInputInfo, CrazyfgtDIPInfo, + crazyfgtInit, DrvExit, CrazyfgtFrame, seta2layerDraw, DrvScan, &DrvRecalc, 0x1200, + 384, 224, 4, 3 +}; + + +//---------------------------------------------------------------------------------------------------------- +// should be moved into its own file + +static UINT8 msm6242_reg[3]; +static time_t msm6242_hold_time; + +UINT8 msm6242_read(UINT32 offset) +{ + tm *systime; + + if (msm6242_reg[0] & 1) { + systime = localtime(&msm6242_hold_time); + } else { + time_t curtime = time(NULL); + systime = localtime(&curtime); + } + + switch (offset) + { + case 0x00: return systime->tm_sec % 10; + case 0x01: return systime->tm_sec / 10; + case 0x02: return systime->tm_min % 10; + case 0x03: return systime->tm_min / 10; + case 0x04: + case 0x05: + { + INT32 hour = systime->tm_hour, pm = 0; + + if ((msm6242_reg[2] & 0x04) == 0) // 12 hour mode? + { + if (hour >= 12) pm = 1; + hour %= 12; + if (hour == 0) hour = 12; + } + + if (offset == 0x04) return hour % 10; + + return (hour / 10) | (pm <<2); + } + + case 0x06: return systime->tm_mday % 10; + case 0x07: return systime->tm_mday / 10; + case 0x08: return (systime->tm_mon+1) % 10; + case 0x09: return (systime->tm_mon+1) / 10; + case 0x0a: return systime->tm_year % 10; + case 0x0b: return (systime->tm_year % 100) / 10; + case 0x0c: return systime->tm_wday; + case 0x0d: return msm6242_reg[0]; + case 0x0e: return msm6242_reg[1]; + case 0x0f: return msm6242_reg[2]; + } + + return 0; +} + +void msm6242_write(UINT32 offset, UINT8 data) +{ + if (offset == 0x0d) { + msm6242_reg[0] = data & 0x0f; + if (data & 1) msm6242_hold_time = time(NULL); + } else if (offset == 0x0e) { + msm6242_reg[1] = data & 0x0f; + } else if (offset == 0x0f) { + if ((data ^ msm6242_reg[2]) & 0x04) { + msm6242_reg[2] = (msm6242_reg[2] & 0x04) | (data & ~0x04); + + if (msm6242_reg[2] & 1) msm6242_reg[2] = (msm6242_reg[2] & ~0x04) | (data & 0x04); + } else { + msm6242_reg[2] = data & 0x0f; + } + } +} + +void msm6242_reset() +{ + memset (msm6242_reg, 0, 3); + msm6242_hold_time = time(NULL); +} + +//-------------------------------------------------------------------------------------------------------------------- + +static UINT16 jockeyc_dsw_read(INT32 offset) +{ + INT32 dip2 = DrvDips[1] | (DrvDips[2] << 8); + INT32 shift = offset << 2; + + return ((((DrvDips[0] >> shift) & 0xf)) << 0) | ((((dip2 >> shift) & 0xf)) << 4) | ((((dip2 >> (shift+8)) & 0xf)) << 8); +} + +UINT16 __fastcall jockeyc_read_word(UINT32 address) +{ + switch (address) + { + case 0x200000: + case 0x200001: { + INT32 i; + for (i = 3; i < 8; i++) { + if (usclssic_port_select & (1 << i)) return DrvInputs[(i - 3) + 2]; + } + return 0xffff; + } + + case 0x200002: + case 0x200003: + return DrvInputs[0]; + + case 0x200010: + case 0x200011: + return DrvInputs[1] & 0x7fff; + + case 0x500000: + case 0x500001: + case 0x500002: + case 0x500003: + return jockeyc_dsw_read(address & 2); + + case 0x600000: + case 0x600001: + case 0x600002: + case 0x600003: + return ~0; + } + + if ((address & 0xfffffe0) == 0x800000) { + return msm6242_read((address & 0x1e) / 2); + } + + return 0; +} + +UINT8 __fastcall jockeyc_read_byte(UINT32 address) +{ + switch (address) + { + case 0x200000: + case 0x200001: { + INT32 i; + for (i = 3; i < 8; i++) { + if (usclssic_port_select & (1 << i)) return DrvInputs[(i - 3) + 2]; + } + return 0xff; + } + + case 0x200002: + return DrvInputs[0] >> 8; + + case 0x200003: + return DrvInputs[0]; + + case 0x200010: + return (DrvInputs[1] >> 8) & 0x7f; + + case 0x200011: + return DrvInputs[1]; + + case 0x500000: + case 0x500001: + case 0x500002: + case 0x500003: + return jockeyc_dsw_read(address & 2); + + case 0x600000: + case 0x600001: + case 0x600002: + case 0x600003: + return ~0; + } + + if ((address & 0xfffffe0) == 0x800000) { + return msm6242_read((address & 0x1e) / 2); + } + + return 0; +} + +void __fastcall jockeyc_write_word(UINT32 address, UINT16 data) +{ + SetaVidRAMCtrlWriteWord(0, 0xa00000) + + switch (address) + { + case 0x200000: + case 0x200001: + usclssic_port_select = data & 0xf8; + return; + + case 0x300000: + case 0x300001: + watchdog = 0; + return; + } + + if ((address & 0xfffffe0) == 0x800000) { + msm6242_write((address & 0x1e) / 2, data); + return; + } +} + +void __fastcall jockeyc_write_byte(UINT32 address, UINT8 data) +{ + SetaVidRAMCtrlWriteByte(0, 0xa00000) + + switch (address) + { + case 0x200000: + case 0x200001: + usclssic_port_select = data & 0xf8; + return; + + case 0x300000: + case 0x300001: + watchdog = 0; + return; + } + + if ((address & 0xfffffe0) == 0x800000) { + msm6242_write((address & 0x1e) / 2, data); + return; + + } +} + +static void jockeyc68kInit() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(DrvVidRAM0, 0xb00000, 0xb07fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xd00000, 0xd00607 | 0x7ff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xe00000, 0xe03fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xffc000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, jockeyc_write_word); + SekSetWriteByteHandler(0, jockeyc_write_byte); + SekSetReadWordHandler(0, jockeyc_read_word); + SekSetReadByteHandler(0, jockeyc_read_byte); + + SekMapHandler(1, 0x900000, 0x903fff, SM_READ | SM_WRITE); + SekSetReadWordHandler (1, setaSoundRegReadWord); + SekSetReadByteHandler (1, setaSoundRegReadByte); + SekSetWriteWordHandler(1, setaSoundRegWriteWord); + SekSetWriteByteHandler(1, setaSoundRegWriteByte); + SekClose(); + + memcpy (Drv68KROM + 0x100000, Drv68KROM + 0x020000, 0x080000); + memset (Drv68KROM + 0x020000, 0xff, 0x60000); + memset (Drv68KROM + 0x180000, 0xff, 0x80000); + + memmove (DrvGfxROM1 + 0x60000, DrvGfxROM1 + 0x40000, 0x40000); + memset (DrvGfxROM1 + 0x40000, 0, 0x20000); + memset (DrvGfxROM1 + 0xa0000, 0, 0x20000); + + DrvROMLen[4] = 1; // force use of pal ram + + msm6242_reset(); +} + +static INT32 jockeycInit() +{ + watchdog_enable = 1; + DrvSetColorOffsets(0, 0, 0); + DrvSetVideoOffsets(0, 0, 0, 0); + + return DrvInit(jockeyc68kInit, 16000000, SET_IRQLINES(0x80, 0x80) /*custom*/, NO_SPRITE_BUFFER, SET_GFX_DECODE(5, 1, -1)); +} + +static void jockeycFrameCallback() +{ + DrvInputs[0] ^= 0xffff; + DrvInputs[0] ^= DrvDips[3] | (DrvDips[4] << 8); + DrvInputs[1] ^= 0xffff; + DrvInputs[1] ^= DrvDips[5] | (DrvDips[6] << 8); + + INT32 nInterleave = 10; + INT32 nCyclesTotal[1] = { cpuspeed / 60 }; + INT32 nCyclesDone[1] = { 0 }; + + INT32 irqs[10] = { 4, 1, 2, 6, 6, 6, 6, 6, 6, 6 }; + + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave); + + SekSetIRQLine(irqs[9-i], SEK_IRQSTATUS_AUTO); // ? + } + + SekClose(); + + if (pBurnSoundOut) { + x1010_sound_update(); + } +} + +static INT32 jockeycFrame() +{ + return DrvCommonFrame(jockeycFrameCallback); +} + + +// Jockey Club + +static struct BurnRomInfo jockeycRomDesc[] = { + { "ya-007-002-u23.bin", 0x10000, 0xc499bf4d, 0x01 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "ya-007-003-u33.bin", 0x10000, 0xe7b0677e, 0x01 | BRF_PRG | BRF_ESS }, // 1 + { "ya_002_001.u18", 0x80000, 0xdd108016, 0x01 | BRF_PRG | BRF_ESS }, // 2 + + { "ya_011_004.u10", 0x80000, 0xeb74d2e0, 0x03 | BRF_GRA }, // 3 Sprites + { "ya_011_005.u17", 0x80000, 0x4a6c804b, 0x03 | BRF_GRA }, // 4 + { "ya_011_006.u22", 0x80000, 0xbfae01a5, 0x03 | BRF_GRA }, // 5 + { "ya_011_007.u27", 0x80000, 0x2dc7a294, 0x03 | BRF_GRA }, // 6 + + { "ya_011_008.u35", 0x40000, 0x4b890f83, 0x04 | BRF_GRA }, // 7 Layer 1 tiles + { "ya_011_009.u41", 0x40000, 0xcaa5e3c1, 0x04 | BRF_GRA }, // 8 +// double this so that we can use the graphics decoding routines... + { "ya_011_009.u41", 0x40000, 0xcaa5e3c1, 0x04 | BRF_GRA }, // 9 + + { "ya_011_013.u71", 0x80000, 0x2bccaf47, 0x06 | BRF_SND }, // 10 x1snd + { "ya_011_012.u64", 0x80000, 0xa8015ce6, 0x06 | BRF_SND }, // 11 + + { "ya-011.prom", 0x00200, 0xbd4fe2f6, 0x0f | BRF_GRA }, // 13 + { "ya-010.prom", 0x00200, 0x778094b3, 0x0f | BRF_GRA }, // 12 Color PROMs +}; + +STD_ROM_PICK(jockeyc) +STD_ROM_FN(jockeyc) + +struct BurnDriverD BurnDrvJockeyc = { + "jockeyc", NULL, NULL, NULL, "1990", + "Jockey Club\0", NULL, "[Seta] (Visco license)", "Seta", + NULL, NULL, NULL, NULL, + 0, 2, HARDWARE_SETA1, GBF_MISC, 0, + NULL, jockeycRomInfo, jockeycRomName, NULL, NULL, JockeycInputInfo, JockeycDIPInfo, + jockeycInit, DrvExit, jockeycFrame, seta1layerDraw, DrvScan, &DrvRecalc, 0x200, + 384, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_shadfrce.cpp b/src/burn/drv/pst90s/d_shadfrce.cpp index c0a05e2df..c694a8d80 100644 --- a/src/burn/drv/pst90s/d_shadfrce.cpp +++ b/src/burn/drv/pst90s/d_shadfrce.cpp @@ -1,1606 +1,1605 @@ -/******************************************************************************** - Shadow Force (c)1993 Technos - Preliminary Driver by David Haywood - Based on the Various Other Technos Games - ******************************************************************************** - port to Finalburn Alpha by OopsWare. 2007 - ******************************************************************************** - - 2007.07.05 - bug fix: no reset while init driver, 68k boot from pc addr 0x000000 ... - add pri-buf (RamPri) for render - - ********************************************************************************/ - -#include "burnint.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm6295.h" - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; - -static UINT8 *Rom68K; -static UINT8 *RomZ80; -static UINT8 *RomGfx01; -static UINT8 *RomGfx02; -static UINT8 *RomGfx03; - -static UINT8 *Ram68K; -static UINT16 *RamBg00; -static UINT16 *RamBg01; -static UINT16 *RamFg; -static UINT16 *RamSpr; -static UINT16 *RamPal; -static UINT8 *RamZ80; - -static UINT16 *RamCurPal; -static UINT8 *RamPri; - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDipBtn[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - -static UINT8 DrvInput[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvReset = 0; -static UINT8 nBrightness = 0xFF; - -static UINT8 bVBlink = 0; -static UINT16 bg0scrollx, bg0scrolly, bg1scrollx, bg1scrolly; -static UINT8 nSoundlatch = 0; -static UINT8 bRecalcPalette = 0; - -static INT32 nZ80Cycles; - -inline static void CalcCol(INT32 idx) -{ - /* xBBBBBGGGGGRRRRR */ - UINT16 nColour = RamPal[idx]; - INT32 r = (nColour & 0x001F) << 3; r |= r >> 5; // Red - INT32 g = (nColour & 0x03E0) >> 2; g |= g >> 5; // Green - INT32 b = (nColour & 0x7C00) >> 7; b |= b >> 5; // Blue - r = (r * nBrightness) >> 8; - g = (g * nBrightness) >> 8; - b = (b * nBrightness) >> 8; - RamCurPal[idx] = BurnHighCol(r, g, b, 0); -} - -static struct BurnInputInfo shadfrceInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvDipBtn + 0, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, - - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - {"P1 Button 4", BIT_DIGITAL, DrvButton + 0, "p1 fire 4"}, - {"P1 Button 5", BIT_DIGITAL, DrvButton + 1, "p1 fire 5"}, - {"P1 Button 6", BIT_DIGITAL, DrvButton + 2, "p1 fire 6"}, - - {"P2 Coin", BIT_DIGITAL, DrvDipBtn + 1, "p2 coin"}, // only available when you are in "test mode" - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, - - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - {"P2 Button 4", BIT_DIGITAL, DrvButton + 3, "p2 fire 4"}, - {"P2 Button 5", BIT_DIGITAL, DrvButton + 4, "p2 fire 5"}, - {"P2 Button 6", BIT_DIGITAL, DrvButton + 5, "p2 fire 6"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 1, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, - {"Dip D", BIT_DIPSWITCH, DrvInput + 7, "dip"}, -}; - -STDINPUTINFO(shadfrce) - -static struct BurnDIPInfo shadfrceDIPList[] = { - - // Defaults - {0x19, 0xFF, 0xFF, 0x00, NULL}, - {0x1A, 0xFF, 0xFF, 0x00, NULL}, - {0x1B, 0xFF, 0xFF, 0x00, NULL}, - {0x1C, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - // coin 1 - // coin 2 - {0, 0xFE, 0, 2, "Service1"}, // only available when you are in "test mode" - {0x19, 0x01, 0x04, 0x00, "Off"}, - {0x19, 0x01, 0x04, 0x04, "On"}, - - // DIP 2 - {0, 0xFE, 0, 4, "Difficulty"}, - {0x1A, 0x01, 0x03, 0x00, "Normal"}, - {0x1A, 0x01, 0x03, 0x01, "Hard"}, - {0x1A, 0x01, 0x03, 0x02, "Easy"}, - {0x1A, 0x01, 0x03, 0x03, "Hardest"}, - {0, 0xFE, 0, 4, "Stage Clear Energy Regain"}, - {0x1A, 0x01, 0x0C, 0x00, "25%"}, - {0x1A, 0x01, 0x0C, 0x04, "10%"}, - {0x1A, 0x01, 0x0C, 0x08, "50%"}, - {0x1A, 0x01, 0x0C, 0x0C, "0%"}, - - // DIP 3 - {0, 0xFE, 0, 4, "Coinage"}, - {0x1B, 0x01, 0x06, 0x00, "1C_1C"}, - {0x1B, 0x01, 0x06, 0x02, "1C_2C"}, - {0x1B, 0x01, 0x06, 0x04, "2C_1C"}, - {0x1B, 0x01, 0x06, 0x06, "3C_1C"}, - - {0, 0xFE, 0, 2, "Continue Price"}, - {0x1B, 0x01, 0x08, 0x00, "Off"}, - {0x1B, 0x01, 0x08, 0x80, "On"}, - {0, 0xFE, 0, 2, "Free Play"}, - {0x1B, 0x01, 0x10, 0x00, "Off"}, - {0x1B, 0x01, 0x10, 0x10, "On"}, - {0, 0xFE, 0, 2, "Flip Screen"}, - {0x1B, 0x01, 0x20, 0x00, "Off"}, - {0x1B, 0x01, 0x20, 0x20, "On"}, - - // DIP 4 - {0, 0xFE, 0, 2, "Demo Sounds"}, - {0x1C, 0x01, 0x01, 0x00, "Off"}, - {0x1C, 0x01, 0x01, 0x01, "On"}, - {0, 0xFE, 0, 2, "Test Mode"}, - {0x1C, 0x01, 0x02, 0x00, "Off"}, - {0x1C, 0x01, 0x02, 0x02, "On"}, -// {0, 0xFE, 0, 2, "VBlink"}, // ??? -// {0x1C, 0x01, 0x04, 0x00, "Off"}, -// {0x1C, 0x01, 0x04, 0x04, "On"}, - -}; - -STDDIPINFO(shadfrce) - -// Rom information -static struct BurnRomInfo shadfrceRomDesc[] = { - { "32a12-01.34", 0x040000, 0x04501198, BRF_ESS | BRF_PRG }, // 68000 code - { "32a13-01.26", 0x040000, 0xb8f8a05c, BRF_ESS | BRF_PRG }, - { "32a14-0.33", 0x040000, 0x08279be9, BRF_ESS | BRF_PRG }, - { "32a15-0.14", 0x040000, 0xbfcadfea, BRF_ESS | BRF_PRG }, - - { "32j10-0.42", 0x010000, 0x65daf475, BRF_ESS | BRF_PRG }, // Z80 code - - { "32a11-0.55", 0x020000, 0xcfaf5e77, BRF_GRA }, // gfx 1 chars - - { "32j4-0.12", 0x200000, 0x1ebea5b6, BRF_GRA }, // gfx 2 sprite - { "32j5-0.13", 0x200000, 0x600026b5, BRF_GRA }, - { "32j6-0.24", 0x200000, 0x6cde8ebe, BRF_GRA }, - { "32j7-0.25", 0x200000, 0xbcb37922, BRF_GRA }, - { "32j8-0.32", 0x200000, 0x201bebf6, BRF_GRA }, - - { "32j1-0.4", 0x100000, 0xf1cca740, BRF_GRA }, // gfx 3 bg - { "32j2-0.5", 0x100000, 0x5fac3e01, BRF_GRA }, - { "32j3-0.6", 0x100000, 0xd297925e, BRF_GRA }, - - { "32j9-0.76", 0x080000, 0x16001e81, BRF_SND }, // PCM -}; - -STD_ROM_PICK(shadfrce) -STD_ROM_FN(shadfrce) - -static struct BurnRomInfo shadfrcjRomDesc[] = { - { "32a12-011.34", 0x040000, 0x0c041e08, BRF_ESS | BRF_PRG }, // 68000 code - { "32a13-010.26", 0x040000, 0x00985361, BRF_ESS | BRF_PRG }, - { "32a14-010.33", 0x040000, 0xea03ca25, BRF_ESS | BRF_PRG }, - { "32j15-01.14", 0x040000, 0x3dc3a84a, BRF_ESS | BRF_PRG }, - - { "32j10-0.42", 0x010000, 0x65daf475, BRF_ESS | BRF_PRG }, // Z80 code - - { "32j11-0.55", 0x020000, 0x7252d993, BRF_GRA }, // gfx 1 chars - - { "32j4-0.12", 0x200000, 0x1ebea5b6, BRF_GRA }, // gfx 2 sprite - { "32j5-0.13", 0x200000, 0x600026b5, BRF_GRA }, - { "32j6-0.24", 0x200000, 0x6cde8ebe, BRF_GRA }, - { "32j7-0.25", 0x200000, 0xbcb37922, BRF_GRA }, - { "32j8-0.32", 0x200000, 0x201bebf6, BRF_GRA }, - - { "32j1-0.4", 0x100000, 0xf1cca740, BRF_GRA }, // gfx 3 bg - { "32j2-0.5", 0x100000, 0x5fac3e01, BRF_GRA }, - { "32j3-0.6", 0x100000, 0xd297925e, BRF_GRA }, - - { "32j9-0.76", 0x080000, 0x16001e81, BRF_SND }, // PCM -}; - -STD_ROM_PICK(shadfrcj) -STD_ROM_FN(shadfrcj) - -static struct BurnRomInfo shadfrcjv2RomDesc[] = { - { "32j12-01.34", 0x040000, 0x38fdbe1d, BRF_ESS | BRF_PRG }, // 68000 code - { "32j13-01.26", 0x040000, 0x6e1df6f1, BRF_ESS | BRF_PRG }, - { "32j14-01.33", 0x040000, 0x89e3fb60, BRF_ESS | BRF_PRG }, - { "32j15-01.14", 0x040000, 0x3dc3a84a, BRF_ESS | BRF_PRG }, - - { "32j10-0.42", 0x010000, 0x65daf475, BRF_ESS | BRF_PRG }, // Z80 code - - { "32j11-0.55", 0x020000, 0x7252d993, BRF_GRA }, // gfx 1 chars - - { "32j4-0.12", 0x200000, 0x1ebea5b6, BRF_GRA }, // gfx 2 sprite - { "32j5-0.13", 0x200000, 0x600026b5, BRF_GRA }, - { "32j6-0.24", 0x200000, 0x6cde8ebe, BRF_GRA }, - { "32j7-0.25", 0x200000, 0xbcb37922, BRF_GRA }, - { "32j8-0.32", 0x200000, 0x201bebf6, BRF_GRA }, - - { "32j1-0.4", 0x100000, 0xf1cca740, BRF_GRA }, // gfx 3 bg - { "32j2-0.5", 0x100000, 0x5fac3e01, BRF_GRA }, - { "32j3-0.6", 0x100000, 0xd297925e, BRF_GRA }, - - { "32j9-0.76", 0x080000, 0x16001e81, BRF_SND }, // PCM -}; - -STD_ROM_PICK(shadfrcjv2) -STD_ROM_FN(shadfrcjv2) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom68K = Next; Next += 0x100000; // 68000 ROM - RomZ80 = Next; Next += 0x010000; // Z80 ROM - RomGfx01 = Next; Next += 0x020000 / 4 * 8; // fg 8x8x4 - RomGfx02 = Next; Next += 0xA00000 / 5 * 8; // spr 16x16x5 sprite - RomGfx03 = Next; Next += 0x300000 / 6 * 8; // bg 16x16x6 tile - MSM6295ROM = Next; Next += 0x080000; - - RamStart = Next; - RamBg00 = (UINT16 *) Next; Next += 0x001000 * sizeof(UINT16); - RamBg01 = (UINT16 *) Next; Next += 0x001000 * sizeof(UINT16); - RamFg = (UINT16 *) Next; Next += 0x001000 * sizeof(UINT16); - RamSpr = (UINT16 *) Next; Next += 0x001000 * sizeof(UINT16); - RamPal = (UINT16 *) Next; Next += 0x004000 * sizeof(UINT16); - Ram68K = Next; Next += 0x010000; - RamZ80 = Next; Next += 0x001800; - RamEnd = Next; - - RamCurPal = (UINT16 *) Next; Next += 0x004000 * sizeof(UINT16); - RamPri = Next; Next += 0x014000; // 320x256 Priority Buffer - - MemEnd = Next; - return 0; -} - -UINT8 __fastcall shadfrceReadByte(UINT32 sekAddress) -{ -/* - INP0 : --AABBBB CCCCCCCC : DIP2-8 DIP2-7, coin 1 coin 2 service 1 , player 1 - INP1 : --DDDDDD EEEEEEEE : Difficulty but DIP2-8 DIP2-7, player 2 - INP2 : --FFFFFF GGGGGGGG : Coinage ~ Flip_Screen but Demo_Sounds service, button 4~6 - INP3 : ----HHII ???????? : v-blink? , service Demo_Sounds -*/ - switch (sekAddress) { - case 0x1D0020: - return (~DrvInput[1] & 0x3F); - case 0x1D0021: - return ~DrvInput[0]; - case 0x1D0022: - return (~DrvInput[3] & 0x3F); - case 0x1D0023: - return ~DrvInput[2]; - case 0x1D0024: - return (~DrvInput[5] & 0x3F); - case 0x1D0025: - return ~DrvInput[4]; - case 0x1D0026: - return ~(DrvInput[7] | (bVBlink << 2)) /*& 0x0F*/; - case 0x1D0027: - return ~DrvInput[6]; - - case 0x1C000B: - return 0; - case 0x1D000D: - return nBrightness; - default: - bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); - } - return 0; -} - -UINT16 __fastcall shadfrceReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x1D0020: - return ~(DrvInput[0] | (DrvInput[1] << 8)) & 0x3FFF; - case 0x1D0022: - return ~(DrvInput[2] | (DrvInput[3] << 8)) & 0x3FFF; - case 0x1D0024: - return ~(DrvInput[4] | (DrvInput[5] << 8)) & 0x3FFF; - case 0x1D0026: - return ~(DrvInput[6] | ( (DrvInput[7] | (bVBlink << 2))<< 8)) /*& 0x0FFF*/; - default: - bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); - } - return 0; -} - -void __fastcall shadfrceWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - case 0x1C000B: - // shadfrce_flip_screen - break; - case 0x1D000C: -// bprintf(PRINT_NORMAL, _T("sound write %02x\n"), byteValue); - nSoundlatch = byteValue; - ZetNmi(); - break; - case 0x1D000D: - //bprintf(PRINT_NORMAL, _T("Brightness set to %02x\n"), byteValue); - nBrightness = byteValue; - for(INT32 i=0;i<0x4000;i++) CalcCol(i); - break; - - case 0x1C0009: - case 0x1C000D: - case 0x1D0007: - case 0x1D0009: - case 0x1D0011: - case 0x1D0013: - case 0x1D0015: - case 0x1D0017: // NOP - break; - default: - bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); - - } -} - -void __fastcall shadfrceWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - case 0x1C0000: bg0scrollx = wordValue & 0x1FF; break; - case 0x1C0002: bg0scrolly = wordValue & 0x1FF; break; - case 0x1C0004: bg1scrollx = wordValue & 0x1FF; break; - case 0x1C0006: bg1scrolly = wordValue & 0x1FF; break; - - case 0x1D000D: - bprintf(PRINT_NORMAL, _T("Brightness set to %04x\n"), wordValue); - //nBrightness = byteValue; - break; - case 0x1D0016: - // wait v-blink dip change call back ??? - //bprintf(PRINT_NORMAL, _T("v-blink clear at PC 0x%06x\n"), SekGetPC(0) ); - break; - - case 0x1D0000: // NOP - case 0x1D0002: - case 0x1D0006: - case 0x1D0008: - break; - default: - bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); - - } -} - -/* -void __fastcall shadfrceWriteBytePalette(UINT32 sekAddress, UINT8 byteValue) -{ - //CavePalWriteByte(sekAddress & 0xFFFF, byteValue); - bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to palette %x\n"), byteValue, sekAddress); -} -*/ - -void __fastcall shadfrceWriteWordPalette(UINT32 sekAddress, UINT16 wordValue) -{ - sekAddress &= 0x7FFF; - sekAddress >>= 1; - RamPal[sekAddress] = wordValue; - CalcCol(sekAddress); -} - -UINT8 __fastcall shadfrceZRead(UINT16 a) -{ - switch (a) { - case 0xC801: // YM2151_status_port_0_r - //bprintf(PRINT_NORMAL, _T("YM2151_status_port_0_r\n")); - return BurnYM2151ReadStatus(); - case 0xD800: // OKIM6295_status_0_r - //bprintf(PRINT_NORMAL, _T("OKIM6295_status_0_r\n")); - return MSM6295ReadStatus(0); - case 0xE000: // soundlatch_r - //bprintf(PRINT_NORMAL, _T("Soundlatch_r\n")); - return nSoundlatch; -// default: -// bprintf(PRINT_NORMAL, _T("Z80 address %04X read.\n"), a); - } - return 0; -} - -void __fastcall shadfrceZWrite(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xC800: // YM2151_register_port_0_w - //bprintf(PRINT_NORMAL, _T("BurnYM2151SelectRegister(%02x)\n"), d); - BurnYM2151SelectRegister(d); - break; - case 0xC801: // YM2151_data_port_0_w - //bprintf(PRINT_NORMAL, _T("BurnYM2151WriteRegister(%02x)\n"), d); - BurnYM2151WriteRegister(d); - break; - case 0xD800: // OKIM6295_data_0_w - //bprintf(PRINT_NORMAL, _T("MSM6295Command(%02x)\n"), d); - MSM6295Command(0, d); - break; - case 0xE800: // oki_bankswitch_w - bprintf(PRINT_NORMAL, _T("oki_bankswitch_w(%02X)\n"), d); - break; -// default: -// bprintf(PRINT_NORMAL, _T("Z80 address %04X -> %02X.\n"), a, d); - } -} - -static void shadfrceYM2151IRQHandler(INT32 nStatus) -{ - if (nStatus) { - //ZetRaiseIrq(255); - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - ZetRun(0x0400); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekSetIRQLine(0, SEK_IRQSTATUS_NONE); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM2151Reset(); - - return 0; -} - -static INT32 loadDecodeGfx01() -{ -/* - 8,8, - RGN_FRAC(1,1), - 4, - { 0, 2, 4, 6 }, - { 1, 0, 8*8+1, 8*8+0, 16*8+1, 16*8+0, 24*8+1, 24*8+0 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 32*8 -*/ - UINT8 *buf = NULL; - - if ((buf = (UINT8*)BurnMalloc(0x20000)) == NULL) { - return 1; - } - - memset(buf, 0, 0x20000); - BurnLoadRom(buf, 5, 1); - - UINT8 *tmp = buf; - UINT8 *pgfx = RomGfx01; - - for (INT32 i=0; i<(0x20000/32); i++) { - for( INT32 y=0;y<8;y++) { - - pgfx[0] = (((tmp[ 0]>>0)&1)<<0) | (((tmp[ 0]>>2)&1)<<1) | (((tmp[ 0]>>4)&1)<<2) | (((tmp[ 0]>>6)&1)<<3); - pgfx[1] = (((tmp[ 0]>>1)&1)<<0) | (((tmp[ 0]>>3)&1)<<1) | (((tmp[ 0]>>5)&1)<<2) | (((tmp[ 0]>>7)&1)<<3); - pgfx[2] = (((tmp[ 8]>>0)&1)<<0) | (((tmp[ 8]>>2)&1)<<1) | (((tmp[ 8]>>4)&1)<<2) | (((tmp[ 8]>>6)&1)<<3); - pgfx[3] = (((tmp[ 8]>>1)&1)<<0) | (((tmp[ 8]>>3)&1)<<1) | (((tmp[ 8]>>5)&1)<<2) | (((tmp[ 8]>>7)&1)<<3); - pgfx[4] = (((tmp[16]>>0)&1)<<0) | (((tmp[16]>>2)&1)<<1) | (((tmp[16]>>4)&1)<<2) | (((tmp[16]>>6)&1)<<3); - pgfx[5] = (((tmp[16]>>1)&1)<<0) | (((tmp[16]>>3)&1)<<1) | (((tmp[16]>>5)&1)<<2) | (((tmp[16]>>7)&1)<<3); - pgfx[6] = (((tmp[24]>>0)&1)<<0) | (((tmp[24]>>2)&1)<<1) | (((tmp[24]>>4)&1)<<2) | (((tmp[24]>>6)&1)<<3); - pgfx[7] = (((tmp[24]>>1)&1)<<0) | (((tmp[24]>>3)&1)<<1) | (((tmp[24]>>5)&1)<<2) | (((tmp[24]>>7)&1)<<3); - - tmp += 1; - pgfx += 8; - } - tmp += 24; - } - - BurnFree(buf); - return 0; -} - -static INT32 loadDecodeGfx02() -{ -/* - 16,16, - RGN_FRAC(1,5), - 5, - { 0x800000*8, 0x600000*8, 0x400000*8, 0x200000*8, 0x000000*8 }, - { 0,1,2,3,4,5,6,7,16*8+0,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, - 16*16 -*/ - UINT8 *buf = NULL; - - if ((buf = (UINT8*)BurnMalloc(0xA00000)) == NULL) { - return 1; - } - memset(buf, 0, 0xA00000); - - BurnLoadRom(buf + 0x000000, 6, 1); - BurnLoadRom(buf + 0x200000, 7, 1); - BurnLoadRom(buf + 0x400000, 8, 1); - BurnLoadRom(buf + 0x600000, 9, 1); - BurnLoadRom(buf + 0x800000, 10, 1); - - UINT8 *tmp1 = buf; - UINT8 *tmp2 = tmp1 + 0x200000; - UINT8 *tmp3 = tmp2 + 0x200000; - UINT8 *tmp4 = tmp3 + 0x200000; - UINT8 *tmp5 = tmp4 + 0x200000; - UINT8 *pgfx = RomGfx02; - -// TODO: be lazy to research how BurnProgresser work, so ... - -// BurnSetProgressRange(1.0); - - for (INT32 i=0; i<(0x200000/32); i++) { - for( INT32 y=0;y<16;y++) { - - for(INT32 x=0;x<8;x++) { - pgfx[(7-x)+0] = (((tmp1[ 0] >> x) & 0x01) << 0) | - (((tmp2[ 0] >> x) & 0x01) << 1) | - (((tmp3[ 0] >> x) & 0x01) << 2) | - (((tmp4[ 0] >> x) & 0x01) << 3) | - (((tmp5[ 0] >> x) & 0x01) << 4); - pgfx[(7-x)+8] = (((tmp1[16] >> x) & 0x01) << 0) | - (((tmp2[16] >> x) & 0x01) << 1) | - (((tmp3[16] >> x) & 0x01) << 2) | - (((tmp4[16] >> x) & 0x01) << 3) | - (((tmp5[16] >> x) & 0x01) << 4); - } - tmp1 += 1; - tmp2 += 1; - tmp3 += 1; - tmp4 += 1; - tmp5 += 1; - pgfx += 16; - } - -// if ((i & 0xFFF) == 0) -// BurnUpdateProgress( 1.0 / 16, i ? NULL : _T("Decodeing graphics..."), 1); - - tmp1 += 16; - tmp2 += 16; - tmp3 += 16; - tmp4 += 16; - tmp5 += 16; - } - - BurnFree(buf); - return 0; -} - -static INT32 loadDecodeGfx03() -{ -/* - 16,16, - RGN_FRAC(1,3), - 6, - { 0x000000*8+8, 0x000000*8+0, 0x100000*8+8, 0x100000*8+0, 0x200000*8+8, 0x200000*8+0 }, - { 0, 1, 2, 3, 4, 5, 6, 7,16*16+0,16*16+1,16*16+2,16*16+3,16*16+4,16*16+5,16*16+6,16*16+7 }, - { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 8*16,9*16,10*16,11*16,12*16,13*16,14*16,15*16 }, - 64*8 -*/ - UINT8 *buf = NULL; - - if ((buf = (UINT8*)BurnMalloc(0x300000)) == NULL) { - return 1; - } - memset(buf, 0, 0x300000); - - BurnLoadRom(buf + 0x000000, 11, 1); - BurnLoadRom(buf + 0x100000, 12, 1); - BurnLoadRom(buf + 0x200000, 13, 1); - - UINT8 *tmp1 = buf; - UINT8 *tmp2 = tmp1 + 0x100000; - UINT8 *tmp3 = tmp2 + 0x100000; - UINT8 *pgfx = RomGfx03; - - for (INT32 i=0; i<(0x100000/64); i++) { - for( INT32 y=0;y<16;y++) { - - for(INT32 x=0;x<8;x++) { - pgfx[(7-x)+0] = (((tmp3[ 0] >> x) & 0x01) << 0) | (((tmp3[ 1] >> x) & 0x01) << 1) | - (((tmp2[ 0] >> x) & 0x01) << 2) | (((tmp2[ 1] >> x) & 0x01) << 3) | - (((tmp1[ 0] >> x) & 0x01) << 4) | (((tmp1[ 1] >> x) & 0x01) << 5); - pgfx[(7-x)+8] = (((tmp3[32] >> x) & 0x01) << 0) | (((tmp3[33] >> x) & 0x01) << 1) | - (((tmp2[32] >> x) & 0x01) << 2) | (((tmp2[33] >> x) & 0x01) << 3) | - (((tmp1[32] >> x) & 0x01) << 4) | (((tmp1[33] >> x) & 0x01) << 5); - } - tmp1 += 2; - tmp2 += 2; - tmp3 += 2; - pgfx += 16; - } - tmp1 += 32; - tmp2 += 32; - tmp3 += 32; - } - - BurnFree(buf); - - return 0; -} - -static INT32 shadfrceInit() -{ - INT32 nRet; - - Mem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); // blank all memory - MemIndex(); - - // Load and byte-swap 68000 Program roms - nRet = BurnLoadRom(Rom68K + 0x000000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Rom68K + 0x000001, 1, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Rom68K + 0x080000, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Rom68K + 0x080001, 3, 2); if (nRet != 0) return 1; - - nRet = BurnLoadRom(RomZ80 + 0x000000, 4, 1); if (nRet != 0) return 1; - - loadDecodeGfx01(); - loadDecodeGfx02(); - loadDecodeGfx03(); - - BurnLoadRom(MSM6295ROM, 14, 1); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom68K, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM - - SekMapMemory((UINT8 *)RamBg00, - 0x100000, 0x101FFF, SM_RAM); // b ground 0 - SekMapMemory((UINT8 *)RamBg01, - 0x102000, 0x103FFF, SM_RAM); // b ground 1 - SekMapMemory((UINT8 *)RamFg, - 0x140000, 0x141FFF, SM_RAM); // f ground - SekMapMemory((UINT8 *)RamSpr, - 0x142000, 0x143FFF, SM_RAM); // sprites - SekMapMemory((UINT8 *)RamPal, - 0x180000, 0x187FFF, SM_ROM); // palette - SekMapMemory(Ram68K, 0x1F0000, 0x1FFFFF, SM_RAM); // 68K RAM - - SekMapHandler(1, 0x180000, 0x187FFF, SM_WRITE); - - - SekSetReadWordHandler(0, shadfrceReadWord); - SekSetReadByteHandler(0, shadfrceReadByte); - SekSetWriteWordHandler(0, shadfrceWriteWord); - SekSetWriteByteHandler(0, shadfrceWriteByte); - - //SekSetWriteByteHandler(1, shadfrceWriteBytePalette); - SekSetWriteWordHandler(1, shadfrceWriteWordPalette); - - SekClose(); - } - - { - ZetInit(0); - ZetOpen(0); - - ZetSetReadHandler(shadfrceZRead); - ZetSetWriteHandler(shadfrceZWrite); - //ZetSetInHandler(shadfrceZIn); - //ZetSetOutHandler(shadfrceZOut); - - // ROM bank 1 - ZetMapArea(0x0000, 0xBFFF, 0, RomZ80); - ZetMapArea(0x0000, 0xBFFF, 2, RomZ80); - - // RAM - ZetMapArea(0xC000, 0xC7FF, 0, RamZ80); - ZetMapArea(0xC000, 0xC7FF, 1, RamZ80); - ZetMapArea(0xC000, 0xC7FF, 2, RamZ80); - - ZetMapArea(0xF000, 0xFFFF, 0, RamZ80+0x0800); - ZetMapArea(0xF000, 0xFFFF, 1, RamZ80+0x0800); - ZetMapArea(0xF000, 0xFFFF, 2, RamZ80+0x0800); - - ZetMemEnd(); - ZetClose(); - } - - BurnYM2151Init(3579545); // 3.5795 MHz - YM2151SetIrqHandler(0, &shadfrceYM2151IRQHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - MSM6295Init(0, 12000, 1); // 12.000 KHz - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - nZ80Cycles = 3579545 * 100 / nBurnFPS; - - DrvDoReset(); - return 0; -} - -static INT32 shadfrceExit() -{ - MSM6295Exit(0); - BurnYM2151Exit(); - - SekExit(); - ZetExit(); - - BurnFree(Mem); - - return 0; -} - -#define TILE_BG0(x) \ - if (d[x]) { p[x]=pal[d[x]|c]; pp[x]=2; } - -#define TILE_BG0_FLIPX(x) \ - if (d[x]) { p[15-x]=pal[d[x]|c]; pp[15-x]=2; } - -#define TILE_BG0_E(z) \ - if (d[z]&&(x+z)>=0 && (x+z)<320) { p[z]=pal[d[z]|c]; pp[z]=2; } - -#define TILE_BG0_FLIPX_E(z) \ - if (d[z]&&(x+15-z)>=0&&(x+15-z)<320) { p[15-z]=pal[d[z]|c]; pp[15-z]=2; } - -#define TILE_BG0_LINE \ - TILE_BG0( 0) \ - TILE_BG0( 1) \ - TILE_BG0( 2) \ - TILE_BG0( 3) \ - TILE_BG0( 4) \ - TILE_BG0( 5) \ - TILE_BG0( 6) \ - TILE_BG0( 7) \ - TILE_BG0( 8) \ - TILE_BG0( 9) \ - TILE_BG0(10) \ - TILE_BG0(11) \ - TILE_BG0(12) \ - TILE_BG0(13) \ - TILE_BG0(14) \ - TILE_BG0(15) - -#define TILE_BG0_FLIPX_LINE \ - TILE_BG0_FLIPX( 0) \ - TILE_BG0_FLIPX( 1) \ - TILE_BG0_FLIPX( 2) \ - TILE_BG0_FLIPX( 3) \ - TILE_BG0_FLIPX( 4) \ - TILE_BG0_FLIPX( 5) \ - TILE_BG0_FLIPX( 6) \ - TILE_BG0_FLIPX( 7) \ - TILE_BG0_FLIPX( 8) \ - TILE_BG0_FLIPX( 9) \ - TILE_BG0_FLIPX(10) \ - TILE_BG0_FLIPX(11) \ - TILE_BG0_FLIPX(12) \ - TILE_BG0_FLIPX(13) \ - TILE_BG0_FLIPX(14) \ - TILE_BG0_FLIPX(15) - -#define TILE_BG0_LINE_E \ - if (((y+k)>=0) && ((y+k)<256)) { \ - TILE_BG0_E( 0) \ - TILE_BG0_E( 1) \ - TILE_BG0_E( 2) \ - TILE_BG0_E( 3) \ - TILE_BG0_E( 4) \ - TILE_BG0_E( 5) \ - TILE_BG0_E( 6) \ - TILE_BG0_E( 7) \ - TILE_BG0_E( 8) \ - TILE_BG0_E( 9) \ - TILE_BG0_E(10) \ - TILE_BG0_E(11) \ - TILE_BG0_E(12) \ - TILE_BG0_E(13) \ - TILE_BG0_E(14) \ - TILE_BG0_E(15) \ - } - -#define TILE_BG0_FLIPX_LINE_E \ - if (((y+k)>=0) && ((y+k)<256)) { \ - TILE_BG0_FLIPX_E( 0) \ - TILE_BG0_FLIPX_E( 1) \ - TILE_BG0_FLIPX_E( 2) \ - TILE_BG0_FLIPX_E( 3) \ - TILE_BG0_FLIPX_E( 4) \ - TILE_BG0_FLIPX_E( 5) \ - TILE_BG0_FLIPX_E( 6) \ - TILE_BG0_FLIPX_E( 7) \ - TILE_BG0_FLIPX_E( 8) \ - TILE_BG0_FLIPX_E( 9) \ - TILE_BG0_FLIPX_E(10) \ - TILE_BG0_FLIPX_E(11) \ - TILE_BG0_FLIPX_E(12) \ - TILE_BG0_FLIPX_E(13) \ - TILE_BG0_FLIPX_E(14) \ - TILE_BG0_FLIPX_E(15) \ - } - -static void tileBackground_0() -{ - /* ---- ---- YXcc CCCC --TT TTTT TTTT TTTT */ - - UINT16 * pal = RamCurPal + 0x2000; - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 32*32*2; offs+=2) { - mx++; - if (mx == 32) { - mx = 0; - my++; - } - - x = mx * 16 - bg0scrollx; - if (x <= (320-512)) x += 512; - - y = my * 16 - bg0scrolly; - if (y <= (256-512)) y += 512; - - if ( x<=-16 || x>=320 || y<=-16 || y>= 256 ) - continue; - else - if ( x >=0 && x <= (320-16) && y >= 0 && y <= (256-16)) { - - UINT32 tileno = RamBg00[offs+1] & 0x3FFF; - if (tileno == 0) continue; - - UINT32 c = (RamBg00[offs] & 0x1F); - if (c & 0x10) c ^= 0x30; // skip hole - c <<= 6; - - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - UINT8 *d = RomGfx03 + (tileno << 8); - - UINT8 * pp = RamPri + y * 320 + x; - - if (RamBg00[offs] & 0x0080) { - p += 320 * 15; - pp += 320 * 15; - if (RamBg00[offs] & 0x0040) { - for (INT32 k=0;k<16;k++) { - - TILE_BG0_FLIPX_LINE - - d += 16; - p -= 320; - pp -= 320; - } - } else { - for (INT32 k=0;k<16;k++) { - - TILE_BG0_LINE - - d += 16; - p -= 320; - pp -= 320; - } - } - } else { - if (RamBg00[offs] & 0x0040) { - for (INT32 k=0;k<16;k++) { - - TILE_BG0_FLIPX_LINE - - d += 16; - p += 320; - pp += 320; - } - } else { - for (INT32 k=0;k<16;k++) { - - TILE_BG0_LINE - - d += 16; - p += 320; - pp += 320; - } - } - } - - } else { - - UINT32 tileno = RamBg00[offs+1] & 0x3FFF; - if (tileno == 0) continue; - - UINT32 c = (RamBg00[offs] & 0x1F); - if (c & 0x10) c ^= 0x30; // skip hole - c <<= 6; - - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - UINT8 *d = RomGfx03 + (tileno << 8); - UINT8 * pp = RamPri + y * 320 + x; - - if (RamBg00[offs] & 0x0080) { - p += 320 * 15; - pp += 320 * 15; - if (RamBg00[offs] & 0x0040) { - for (INT32 k=0;k<16;k++) { - - TILE_BG0_FLIPX_LINE_E - - d += 16; - p -= 320; - pp -= 320; - } - } else { - for (INT32 k=0;k<16;k++) { - - TILE_BG0_LINE_E - - d += 16; - p -= 320; - pp -= 320; - } - } - } else { - if (RamBg00[offs] & 0x0040) { - for (INT32 k=0;k<16;k++) { - - TILE_BG0_FLIPX_LINE_E - - d += 16; - p += 320; - pp += 320; - } - } else { - for (INT32 k=0;k<16;k++) { - - TILE_BG0_LINE_E - - d += 16; - p += 320; - pp += 320; - } - } - } - - } - } - -} - -static void tileBackground_1() -{ - /* cccc TTTT TTTT TTTT */ - - UINT16 * pal = RamCurPal + 0x2000; - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 32*32; offs++) { - mx++; - if (mx == 32) { - mx = 0; - my++; - } - - x = mx * 16 - bg1scrollx; - if (x <= (320-512)) x += 512; - - y = my * 16 - bg1scrolly; - if (y <= (256-512)) y += 512; - - if ( x<=-16 || x>=320 || y<=-16 || y>= 256 ) - continue; - else - if ( x >=0 && x <= (320-16) && y >= 0 && y <= (256-16)) { - - UINT32 tileno = RamBg01[offs] & 0x0FFF; - UINT32 c = ((RamBg01[offs] & 0xF000) >> 6) + (64 << 6); - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - UINT8 *d = RomGfx03 + (tileno << 8); - - for (INT32 k=0;k<16;k++) { - p[ 0] = pal[ d[ 0] | c ]; - p[ 1] = pal[ d[ 1] | c ]; - p[ 2] = pal[ d[ 2] | c ]; - p[ 3] = pal[ d[ 3] | c ]; - p[ 4] = pal[ d[ 4] | c ]; - p[ 5] = pal[ d[ 5] | c ]; - p[ 6] = pal[ d[ 6] | c ]; - p[ 7] = pal[ d[ 7] | c ]; - p[ 8] = pal[ d[ 8] | c ]; - p[ 9] = pal[ d[ 9] | c ]; - p[10] = pal[ d[10] | c ]; - p[11] = pal[ d[11] | c ]; - p[12] = pal[ d[12] | c ]; - p[13] = pal[ d[13] | c ]; - p[14] = pal[ d[14] | c ]; - p[15] = pal[ d[15] | c ]; - - d += 16; - p += 320; - } - } else { - UINT32 tileno = RamBg01[offs] & 0x0FFF; - UINT32 c = ((RamBg01[offs] & 0xF000) >> 6) + (64 << 6); - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - UINT8 *d = RomGfx03 + (tileno << 8); - - for (INT32 k=0;k<16;k++) { - if ( (y+k)>=0 && (y+k)<256 ) { - if ((x + 0) >= 0 && (x + 0)<320) p[ 0] = pal[ d[ 0] | c ]; - if ((x + 1) >= 0 && (x + 1)<320) p[ 1] = pal[ d[ 1] | c ]; - if ((x + 2) >= 0 && (x + 2)<320) p[ 2] = pal[ d[ 2] | c ]; - if ((x + 3) >= 0 && (x + 3)<320) p[ 3] = pal[ d[ 3] | c ]; - if ((x + 4) >= 0 && (x + 4)<320) p[ 4] = pal[ d[ 4] | c ]; - if ((x + 5) >= 0 && (x + 5)<320) p[ 5] = pal[ d[ 5] | c ]; - if ((x + 6) >= 0 && (x + 6)<320) p[ 6] = pal[ d[ 6] | c ]; - if ((x + 7) >= 0 && (x + 7)<320) p[ 7] = pal[ d[ 7] | c ]; - if ((x + 8) >= 0 && (x + 8)<320) p[ 8] = pal[ d[ 8] | c ]; - if ((x + 9) >= 0 && (x + 9)<320) p[ 9] = pal[ d[ 9] | c ]; - if ((x + 10) >= 0 && (x + 10)<320) p[10] = pal[ d[10] | c ]; - if ((x + 11) >= 0 && (x + 11)<320) p[11] = pal[ d[11] | c ]; - if ((x + 12) >= 0 && (x + 12)<320) p[12] = pal[ d[12] | c ]; - if ((x + 13) >= 0 && (x + 13)<320) p[13] = pal[ d[13] | c ]; - if ((x + 14) >= 0 && (x + 14)<320) p[14] = pal[ d[14] | c ]; - if ((x + 15) >= 0 && (x + 15)<320) p[15] = pal[ d[15] | c ]; - } - d += 16; - p += 320; - } - } - } -} - -static void tileForeground() -{ - /* ---- ---- tttt tttt ---- ---- pppp TTTT */ - - UINT16 * pal = RamCurPal; - INT32 offs, mx, my, x, y; - - mx = -1; - my = 0; - for (offs = 0; offs < 64*32*2; offs+=2) { - mx++; - if (mx == 64) { - mx = 0; - my++; - } - - x = mx * 8; - y = my * 8; - - if ( x<=-8 || x>=320 || y<=-8 || y>= 256 ) - continue; - else - if ( x >=0 && x < (320-8) && y >= 0 && y < (256-8)) { - - UINT32 tileno = (RamFg[offs] & 0x00FF) | ((RamFg[offs+1] & 0x000F) << 8); - if (tileno == 0) continue; - - UINT32 c = (RamFg[offs+1] & 0x00F0) << 2; - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - UINT8 *d = RomGfx01 + (tileno << 6); - - for (INT32 k=0;k<8;k++) { - if (d[0]) p[0] = pal[d[0]|c]; - if (d[1]) p[1] = pal[d[1]|c]; - if (d[2]) p[2] = pal[d[2]|c]; - if (d[3]) p[3] = pal[d[3]|c]; - if (d[4]) p[4] = pal[d[4]|c]; - if (d[5]) p[5] = pal[d[5]|c]; - if (d[6]) p[6] = pal[d[6]|c]; - if (d[7]) p[7] = pal[d[7]|c]; - - d += 8; - p += 320; - } - } else { - - UINT32 tileno = (RamFg[offs] & 0x00FF) | ((RamFg[offs+1] & 0x000F) << 8); - if (tileno == 0) continue; - - UINT32 c = (RamFg[offs+1] & 0x00F0) << 2; - UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; - UINT8 *d = RomGfx01 + (tileno << 6); - - for (INT32 k=0;k<8;k++) { - if ( (y+k)>=0 && (y+k)<256 ) { - if ((x + 0) >= 0 && (x + 0)<320) p[0] = pal[ d[0] | c ]; - if ((x + 1) >= 0 && (x + 1)<320) p[1] = pal[ d[1] | c ]; - if ((x + 2) >= 0 && (x + 2)<320) p[2] = pal[ d[2] | c ]; - if ((x + 3) >= 0 && (x + 3)<320) p[3] = pal[ d[3] | c ]; - if ((x + 4) >= 0 && (x + 4)<320) p[4] = pal[ d[4] | c ]; - if ((x + 5) >= 0 && (x + 5)<320) p[5] = pal[ d[5] | c ]; - if ((x + 6) >= 0 && (x + 6)<320) p[6] = pal[ d[6] | c ]; - if ((x + 7) >= 0 && (x + 7)<320) p[7] = pal[ d[7] | c ]; - } - d += 8; - p += 320; - } - } - } -} - -#define TILE_SPR_NORMAL(x) \ - if (q[x]) { if((pp[x]&(0x05|pri))==0) p[x]=pal[q[x]|color]; pp[x]|=(1<=0)&&((sx+x)<320)) { if((pp[x]&(0x05|pri))==0) p[x]=pal[q[x]|color]; pp[x]|=(1<=0)&&((sx+15-x)<320)) { if((pp[15-x]&(0x05|pri))==0) p[15-x]=pal[q[x]|color]; pp[15-x]|=(1<= (320-16) || sy < 0 || sy >= (256-16) ) { - - if ((sx <= -16) || (sx >= 320) || (sy <= -16) || (sy >= 256)) - return; - - if (flipy) { - - p += 320 * 15; - pp += 320 * 15; - - if (flipx) { - - for (INT32 i=15;i>=0;i--) { - if (((sy+i)>=0) && ((sy+i)<256)) { - - TILE_SPR_FLIP_X_LINE_E - - } - p -= 320; - pp -= 320; - q += 16; - } - - } else { - - for (INT32 i=15;i>=0;i--) { - if (((sy+i)>=0) && ((sy+i)<256)) { - - TILE_SPR_NORMAL_LINE_E - - } - p -= 320; - pp -= 320; - q += 16; - } - } - - } else { - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - if (((sy+i)>=0) && ((sy+i)<256)) { - - TILE_SPR_FLIP_X_LINE_E - - } - p += 320; - pp += 320; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - if (((sy+i)>=0) && ((sy+i)<256)) { - - TILE_SPR_NORMAL_LINE_E - - } - p += 320; - pp += 320; - q += 16; - } - - } - - } - - return; - } - - if (flipy) { - - p += 320 * 15; - pp += 320 * 15; - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - - TILE_SPR_FLIP_X_LINE - - p -= 320; - pp -= 320; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - - TILE_SPR_NORMAL_LINE - - p -= 320; - pp -= 320; - q += 16; - } - } - - } else { - - if (flipx) { - - for (INT32 i=0;i<16;i++) { - - TILE_SPR_FLIP_X_LINE - - p += 320; - pp += 320; - q += 16; - } - - } else { - - for (INT32 i=0;i<16;i++) { - - TILE_SPR_NORMAL_LINE - - p += 320; - pp += 320; - q += 16; - } - - } - - } - -} - -static void drawSprites() -{ - /* | ---- ---- hhhf Fe-Y | ---- ---- yyyy yyyy | ---- ---- TTTT TTTT | ---- ---- tttt tttt | - | ---- ---- -pCc cccX | ---- ---- xxxx xxxx | ---- ---- ---- ---- | ---- ---- ---- ---- | */ - - UINT16 * finish = RamSpr; - UINT16 * source = finish + 0x2000/2 - 8; - INT32 hcount; - - while( source>=finish ) { - INT32 ypos = 0x100 - (((source[0] & 0x0003) << 8) | (source[1] & 0x00ff)); - INT32 xpos = (((source[4] & 0x0001) << 8) | (source[5] & 0x00ff)) + 1; - INT32 tile = ((source[2] & 0x00ff) << 8) | (source[3] & 0x00ff); - INT32 height = (source[0] & 0x00e0) >> 5; - INT32 enable = ((source[0] & 0x0004)); - INT32 flipx = ((source[0] & 0x0010) >> 4); - INT32 flipy = ((source[0] & 0x0008) >> 3); - INT32 pal = ((source[4] & 0x003e)); - INT32 pri_mask = (source[4] & 0x0040) ? 0x02 : 0x00; - -// if ( (1 << pri_mask) & nSpriteEnable) { - - if (pal & 0x20) pal ^= 0x60; // skip hole - pal <<= 5; - - height++; - if (enable) { - for (hcount=0;hcount> 2); - if (pBurnSoundOut) { - INT32 nSegmentLength = (nBurnSoundLen * 1 / 4) - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - - bVBlink = 0; - SekRun(3500000 / 60); - SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - - ZetRun(nZ80Cycles >> 2); - if (pBurnSoundOut) { - INT32 nSegmentLength = (nBurnSoundLen * 2 / 4) - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - - bVBlink = 1; - SekRun(3500000 / 60); - - ZetRun(nZ80Cycles >> 2); - if (pBurnSoundOut) { - INT32 nSegmentLength = (nBurnSoundLen * 3 / 4) - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - - - bVBlink = 0; - SekRun(3500000 / 60); - SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - - ZetRun(nZ80Cycles >> 2); - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - -/* - ZetRun(nZ80Cycles); - if (pBurnSoundOut) { - BurnYM2151Render(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } -*/ - - ZetClose(); - SekClose(); - - if (pBurnDraw) - DrvDraw(); // Draw screen if needed - - - - return 0; -} - -static INT32 shadfrceScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) // Return minimum compatible version - *pnMin = 0x029671; - - if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); // Scan 68000 state - ZetScan(nAction); - - MSM6295Scan(0, nAction); - BurnYM2151Scan(nAction); - - SCAN_VAR(DrvInput); - SCAN_VAR(nBrightness); - SCAN_VAR(bg0scrollx); - SCAN_VAR(bg0scrolly); - SCAN_VAR(bg1scrollx); - SCAN_VAR(bg1scrolly); - SCAN_VAR(nSoundlatch); - } - - if (nAction & ACB_WRITE) { - // recalc palette and brightness - for(INT32 i=0;i<0x4000;i++) CalcCol(i); - } - - return 0; -} - -struct BurnDriver BurnDrvShadfrce = { - "shadfrce", NULL, NULL, NULL, "1993", - "Shadow Force (US Version 2)\0", NULL, "Technos Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, shadfrceRomInfo, shadfrceRomName, NULL, NULL, shadfrceInputInfo, shadfrceDIPInfo, - shadfrceInit, shadfrceExit, shadfrceFrame, NULL, shadfrceScan, &bRecalcPalette, 0x8000, - 320, 256, 4, 3 -}; - -struct BurnDriver BurnDrvShadfrcj = { - "shadfrcej", "shadfrce", NULL, NULL, "1993", - "Shadow Force (Japan Version 3)\0", NULL, "Technos Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, shadfrcjRomInfo, shadfrcjRomName, NULL, NULL, shadfrceInputInfo, shadfrceDIPInfo, - shadfrceInit, shadfrceExit, shadfrceFrame, NULL, shadfrceScan, &bRecalcPalette, 0x8000, - 320, 256, 4, 3 -}; - -struct BurnDriver BurnDrvShadfrcjv2 = { - "shadfrcejv2", "shadfrce", NULL, NULL, "1993", - "Shadow Force (Japan Version 2)\0", NULL, "Technos Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, - NULL, shadfrcjv2RomInfo, shadfrcjv2RomName, NULL, NULL, shadfrceInputInfo, shadfrceDIPInfo, - shadfrceInit, shadfrceExit, shadfrceFrame, NULL, shadfrceScan, &bRecalcPalette, 0x8000, - 320, 256, 4, 3 -}; +/******************************************************************************** + Shadow Force (c)1993 Technos + Preliminary Driver by David Haywood + Based on the Various Other Technos Games + ******************************************************************************** + port to Finalburn Alpha by OopsWare. 2007 + ******************************************************************************** + + 2007.07.05 + bug fix: no reset while init driver, 68k boot from pc addr 0x000000 ... + add pri-buf (RamPri) for render + + ********************************************************************************/ + +#include "burnint.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm6295.h" + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; + +static UINT8 *Rom68K; +static UINT8 *RomZ80; +static UINT8 *RomGfx01; +static UINT8 *RomGfx02; +static UINT8 *RomGfx03; + +static UINT8 *Ram68K; +static UINT16 *RamBg00; +static UINT16 *RamBg01; +static UINT16 *RamFg; +static UINT16 *RamSpr; +static UINT16 *RamPal; +static UINT8 *RamZ80; + +static UINT16 *RamCurPal; +static UINT8 *RamPri; + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDipBtn[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + +static UINT8 DrvInput[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvReset = 0; +static UINT8 nBrightness = 0xFF; + +static UINT8 bVBlink = 0; +static UINT16 bg0scrollx, bg0scrolly, bg1scrollx, bg1scrolly; +static UINT8 nSoundlatch = 0; +static UINT8 bRecalcPalette = 0; + +static INT32 nZ80Cycles; + +inline static void CalcCol(INT32 idx) +{ + /* xBBBBBGGGGGRRRRR */ + UINT16 nColour = RamPal[idx]; + INT32 r = (nColour & 0x001F) << 3; r |= r >> 5; // Red + INT32 g = (nColour & 0x03E0) >> 2; g |= g >> 5; // Green + INT32 b = (nColour & 0x7C00) >> 7; b |= b >> 5; // Blue + r = (r * nBrightness) >> 8; + g = (g * nBrightness) >> 8; + b = (b * nBrightness) >> 8; + RamCurPal[idx] = BurnHighCol(r, g, b, 0); +} + +static struct BurnInputInfo shadfrceInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvDipBtn + 0, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start"}, + + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"}, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + {"P1 Button 4", BIT_DIGITAL, DrvButton + 0, "p1 fire 4"}, + {"P1 Button 5", BIT_DIGITAL, DrvButton + 1, "p1 fire 5"}, + {"P1 Button 6", BIT_DIGITAL, DrvButton + 2, "p1 fire 6"}, + + {"P2 Coin", BIT_DIGITAL, DrvDipBtn + 1, "p2 coin"}, // only available when you are in "test mode" + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start"}, + + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"}, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + {"P2 Button 4", BIT_DIGITAL, DrvButton + 3, "p2 fire 4"}, + {"P2 Button 5", BIT_DIGITAL, DrvButton + 4, "p2 fire 5"}, + {"P2 Button 6", BIT_DIGITAL, DrvButton + 5, "p2 fire 6"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 1, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, + {"Dip D", BIT_DIPSWITCH, DrvInput + 7, "dip"}, +}; + +STDINPUTINFO(shadfrce) + +static struct BurnDIPInfo shadfrceDIPList[] = { + + // Defaults + {0x19, 0xFF, 0xFF, 0x00, NULL}, + {0x1A, 0xFF, 0xFF, 0x00, NULL}, + {0x1B, 0xFF, 0xFF, 0x00, NULL}, + {0x1C, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + // coin 1 + // coin 2 + {0, 0xFE, 0, 2, "Service1"}, // only available when you are in "test mode" + {0x19, 0x01, 0x04, 0x00, "Off"}, + {0x19, 0x01, 0x04, 0x04, "On"}, + + // DIP 2 + {0, 0xFE, 0, 4, "Difficulty"}, + {0x1A, 0x01, 0x03, 0x00, "Normal"}, + {0x1A, 0x01, 0x03, 0x01, "Hard"}, + {0x1A, 0x01, 0x03, 0x02, "Easy"}, + {0x1A, 0x01, 0x03, 0x03, "Hardest"}, + {0, 0xFE, 0, 4, "Stage Clear Energy Regain"}, + {0x1A, 0x01, 0x0C, 0x00, "25%"}, + {0x1A, 0x01, 0x0C, 0x04, "10%"}, + {0x1A, 0x01, 0x0C, 0x08, "50%"}, + {0x1A, 0x01, 0x0C, 0x0C, "0%"}, + + // DIP 3 + {0, 0xFE, 0, 4, "Coinage"}, + {0x1B, 0x01, 0x06, 0x00, "1C_1C"}, + {0x1B, 0x01, 0x06, 0x02, "1C_2C"}, + {0x1B, 0x01, 0x06, 0x04, "2C_1C"}, + {0x1B, 0x01, 0x06, 0x06, "3C_1C"}, + + {0, 0xFE, 0, 2, "Continue Price"}, + {0x1B, 0x01, 0x08, 0x00, "Off"}, + {0x1B, 0x01, 0x08, 0x80, "On"}, + {0, 0xFE, 0, 2, "Free Play"}, + {0x1B, 0x01, 0x10, 0x00, "Off"}, + {0x1B, 0x01, 0x10, 0x10, "On"}, + {0, 0xFE, 0, 2, "Flip Screen"}, + {0x1B, 0x01, 0x20, 0x00, "Off"}, + {0x1B, 0x01, 0x20, 0x20, "On"}, + + // DIP 4 + {0, 0xFE, 0, 2, "Demo Sounds"}, + {0x1C, 0x01, 0x01, 0x00, "Off"}, + {0x1C, 0x01, 0x01, 0x01, "On"}, + {0, 0xFE, 0, 2, "Test Mode"}, + {0x1C, 0x01, 0x02, 0x00, "Off"}, + {0x1C, 0x01, 0x02, 0x02, "On"}, +// {0, 0xFE, 0, 2, "VBlink"}, // ??? +// {0x1C, 0x01, 0x04, 0x00, "Off"}, +// {0x1C, 0x01, 0x04, 0x04, "On"}, + +}; + +STDDIPINFO(shadfrce) + +// Rom information +static struct BurnRomInfo shadfrceRomDesc[] = { + { "32a12-01.34", 0x040000, 0x04501198, BRF_ESS | BRF_PRG }, // 68000 code + { "32a13-01.26", 0x040000, 0xb8f8a05c, BRF_ESS | BRF_PRG }, + { "32a14-0.33", 0x040000, 0x08279be9, BRF_ESS | BRF_PRG }, + { "32a15-0.14", 0x040000, 0xbfcadfea, BRF_ESS | BRF_PRG }, + + { "32j10-0.42", 0x010000, 0x65daf475, BRF_ESS | BRF_PRG }, // Z80 code + + { "32a11-0.55", 0x020000, 0xcfaf5e77, BRF_GRA }, // gfx 1 chars + + { "32j4-0.12", 0x200000, 0x1ebea5b6, BRF_GRA }, // gfx 2 sprite + { "32j5-0.13", 0x200000, 0x600026b5, BRF_GRA }, + { "32j6-0.24", 0x200000, 0x6cde8ebe, BRF_GRA }, + { "32j7-0.25", 0x200000, 0xbcb37922, BRF_GRA }, + { "32j8-0.32", 0x200000, 0x201bebf6, BRF_GRA }, + + { "32j1-0.4", 0x100000, 0xf1cca740, BRF_GRA }, // gfx 3 bg + { "32j2-0.5", 0x100000, 0x5fac3e01, BRF_GRA }, + { "32j3-0.6", 0x100000, 0xd297925e, BRF_GRA }, + + { "32j9-0.76", 0x080000, 0x16001e81, BRF_SND }, // PCM +}; + +STD_ROM_PICK(shadfrce) +STD_ROM_FN(shadfrce) + +static struct BurnRomInfo shadfrcjRomDesc[] = { + { "32a12-011.34", 0x040000, 0x0c041e08, BRF_ESS | BRF_PRG }, // 68000 code + { "32a13-010.26", 0x040000, 0x00985361, BRF_ESS | BRF_PRG }, + { "32a14-010.33", 0x040000, 0xea03ca25, BRF_ESS | BRF_PRG }, + { "32j15-01.14", 0x040000, 0x3dc3a84a, BRF_ESS | BRF_PRG }, + + { "32j10-0.42", 0x010000, 0x65daf475, BRF_ESS | BRF_PRG }, // Z80 code + + { "32j11-0.55", 0x020000, 0x7252d993, BRF_GRA }, // gfx 1 chars + + { "32j4-0.12", 0x200000, 0x1ebea5b6, BRF_GRA }, // gfx 2 sprite + { "32j5-0.13", 0x200000, 0x600026b5, BRF_GRA }, + { "32j6-0.24", 0x200000, 0x6cde8ebe, BRF_GRA }, + { "32j7-0.25", 0x200000, 0xbcb37922, BRF_GRA }, + { "32j8-0.32", 0x200000, 0x201bebf6, BRF_GRA }, + + { "32j1-0.4", 0x100000, 0xf1cca740, BRF_GRA }, // gfx 3 bg + { "32j2-0.5", 0x100000, 0x5fac3e01, BRF_GRA }, + { "32j3-0.6", 0x100000, 0xd297925e, BRF_GRA }, + + { "32j9-0.76", 0x080000, 0x16001e81, BRF_SND }, // PCM +}; + +STD_ROM_PICK(shadfrcj) +STD_ROM_FN(shadfrcj) + +static struct BurnRomInfo shadfrcjv2RomDesc[] = { + { "32j12-01.34", 0x040000, 0x38fdbe1d, BRF_ESS | BRF_PRG }, // 68000 code + { "32j13-01.26", 0x040000, 0x6e1df6f1, BRF_ESS | BRF_PRG }, + { "32j14-01.33", 0x040000, 0x89e3fb60, BRF_ESS | BRF_PRG }, + { "32j15-01.14", 0x040000, 0x3dc3a84a, BRF_ESS | BRF_PRG }, + + { "32j10-0.42", 0x010000, 0x65daf475, BRF_ESS | BRF_PRG }, // Z80 code + + { "32j11-0.55", 0x020000, 0x7252d993, BRF_GRA }, // gfx 1 chars + + { "32j4-0.12", 0x200000, 0x1ebea5b6, BRF_GRA }, // gfx 2 sprite + { "32j5-0.13", 0x200000, 0x600026b5, BRF_GRA }, + { "32j6-0.24", 0x200000, 0x6cde8ebe, BRF_GRA }, + { "32j7-0.25", 0x200000, 0xbcb37922, BRF_GRA }, + { "32j8-0.32", 0x200000, 0x201bebf6, BRF_GRA }, + + { "32j1-0.4", 0x100000, 0xf1cca740, BRF_GRA }, // gfx 3 bg + { "32j2-0.5", 0x100000, 0x5fac3e01, BRF_GRA }, + { "32j3-0.6", 0x100000, 0xd297925e, BRF_GRA }, + + { "32j9-0.76", 0x080000, 0x16001e81, BRF_SND }, // PCM +}; + +STD_ROM_PICK(shadfrcjv2) +STD_ROM_FN(shadfrcjv2) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom68K = Next; Next += 0x100000; // 68000 ROM + RomZ80 = Next; Next += 0x010000; // Z80 ROM + RomGfx01 = Next; Next += 0x020000 / 4 * 8; // fg 8x8x4 + RomGfx02 = Next; Next += 0xA00000 / 5 * 8; // spr 16x16x5 sprite + RomGfx03 = Next; Next += 0x300000 / 6 * 8; // bg 16x16x6 tile + MSM6295ROM = Next; Next += 0x080000; + + RamStart = Next; + RamBg00 = (UINT16 *) Next; Next += 0x001000 * sizeof(UINT16); + RamBg01 = (UINT16 *) Next; Next += 0x001000 * sizeof(UINT16); + RamFg = (UINT16 *) Next; Next += 0x001000 * sizeof(UINT16); + RamSpr = (UINT16 *) Next; Next += 0x001000 * sizeof(UINT16); + RamPal = (UINT16 *) Next; Next += 0x004000 * sizeof(UINT16); + Ram68K = Next; Next += 0x010000; + RamZ80 = Next; Next += 0x001800; + RamEnd = Next; + + RamCurPal = (UINT16 *) Next; Next += 0x004000 * sizeof(UINT16); + RamPri = Next; Next += 0x014000; // 320x256 Priority Buffer + + MemEnd = Next; + return 0; +} + +UINT8 __fastcall shadfrceReadByte(UINT32 sekAddress) +{ +/* + INP0 : --AABBBB CCCCCCCC : DIP2-8 DIP2-7, coin 1 coin 2 service 1 , player 1 + INP1 : --DDDDDD EEEEEEEE : Difficulty but DIP2-8 DIP2-7, player 2 + INP2 : --FFFFFF GGGGGGGG : Coinage ~ Flip_Screen but Demo_Sounds service, button 4~6 + INP3 : ----HHII ???????? : v-blink? , service Demo_Sounds +*/ + switch (sekAddress) { + case 0x1D0020: + return (~DrvInput[1] & 0x3F); + case 0x1D0021: + return ~DrvInput[0]; + case 0x1D0022: + return (~DrvInput[3] & 0x3F); + case 0x1D0023: + return ~DrvInput[2]; + case 0x1D0024: + return (~DrvInput[5] & 0x3F); + case 0x1D0025: + return ~DrvInput[4]; + case 0x1D0026: + return ~(DrvInput[7] | (bVBlink << 2)) /*& 0x0F*/; + case 0x1D0027: + return ~DrvInput[6]; + + case 0x1C000B: + return 0; + case 0x1D000D: + return nBrightness; + default: + bprintf(PRINT_NORMAL, _T("Attempt to read byte value of location %x\n"), sekAddress); + } + return 0; +} + +UINT16 __fastcall shadfrceReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x1D0020: + return ~(DrvInput[0] | (DrvInput[1] << 8)) & 0x3FFF; + case 0x1D0022: + return ~(DrvInput[2] | (DrvInput[3] << 8)) & 0x3FFF; + case 0x1D0024: + return ~(DrvInput[4] | (DrvInput[5] << 8)) & 0x3FFF; + case 0x1D0026: + return ~(DrvInput[6] | ( (DrvInput[7] | (bVBlink << 2))<< 8)) /*& 0x0FFF*/; + default: + bprintf(PRINT_NORMAL, _T("Attempt to read word value of location %x\n"), sekAddress); + } + return 0; +} + +void __fastcall shadfrceWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + case 0x1C000B: + // shadfrce_flip_screen + break; + case 0x1D000C: +// bprintf(PRINT_NORMAL, _T("sound write %02x\n"), byteValue); + nSoundlatch = byteValue; + ZetNmi(); + break; + case 0x1D000D: + //bprintf(PRINT_NORMAL, _T("Brightness set to %02x\n"), byteValue); + nBrightness = byteValue; + for(INT32 i=0;i<0x4000;i++) CalcCol(i); + break; + + case 0x1C0009: + case 0x1C000D: + case 0x1D0007: + case 0x1D0009: + case 0x1D0011: + case 0x1D0013: + case 0x1D0015: + case 0x1D0017: // NOP + break; + default: + bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to location %x\n"), byteValue, sekAddress); + + } +} + +void __fastcall shadfrceWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + case 0x1C0000: bg0scrollx = wordValue & 0x1FF; break; + case 0x1C0002: bg0scrolly = wordValue & 0x1FF; break; + case 0x1C0004: bg1scrollx = wordValue & 0x1FF; break; + case 0x1C0006: bg1scrolly = wordValue & 0x1FF; break; + + case 0x1D000D: + bprintf(PRINT_NORMAL, _T("Brightness set to %04x\n"), wordValue); + //nBrightness = byteValue; + break; + case 0x1D0016: + // wait v-blink dip change call back ??? + //bprintf(PRINT_NORMAL, _T("v-blink clear at PC 0x%06x\n"), SekGetPC(0) ); + break; + + case 0x1D0000: // NOP + case 0x1D0002: + case 0x1D0006: + case 0x1D0008: + break; + default: + bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); + + } +} + +/* +void __fastcall shadfrceWriteBytePalette(UINT32 sekAddress, UINT8 byteValue) +{ + //CavePalWriteByte(sekAddress & 0xFFFF, byteValue); + bprintf(PRINT_NORMAL, _T("Attempt to write byte value %x to palette %x\n"), byteValue, sekAddress); +} +*/ + +void __fastcall shadfrceWriteWordPalette(UINT32 sekAddress, UINT16 wordValue) +{ + sekAddress &= 0x7FFF; + sekAddress >>= 1; + RamPal[sekAddress] = wordValue; + CalcCol(sekAddress); +} + +UINT8 __fastcall shadfrceZRead(UINT16 a) +{ + switch (a) { + case 0xC801: // YM2151_status_port_0_r + //bprintf(PRINT_NORMAL, _T("YM2151_status_port_0_r\n")); + return BurnYM2151ReadStatus(); + case 0xD800: // OKIM6295_status_0_r + //bprintf(PRINT_NORMAL, _T("OKIM6295_status_0_r\n")); + return MSM6295ReadStatus(0); + case 0xE000: // soundlatch_r + //bprintf(PRINT_NORMAL, _T("Soundlatch_r\n")); + return nSoundlatch; +// default: +// bprintf(PRINT_NORMAL, _T("Z80 address %04X read.\n"), a); + } + return 0; +} + +void __fastcall shadfrceZWrite(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xC800: // YM2151_register_port_0_w + //bprintf(PRINT_NORMAL, _T("BurnYM2151SelectRegister(%02x)\n"), d); + BurnYM2151SelectRegister(d); + break; + case 0xC801: // YM2151_data_port_0_w + //bprintf(PRINT_NORMAL, _T("BurnYM2151WriteRegister(%02x)\n"), d); + BurnYM2151WriteRegister(d); + break; + case 0xD800: // OKIM6295_data_0_w + //bprintf(PRINT_NORMAL, _T("MSM6295Command(%02x)\n"), d); + MSM6295Command(0, d); + break; + case 0xE800: // oki_bankswitch_w + bprintf(PRINT_NORMAL, _T("oki_bankswitch_w(%02X)\n"), d); + break; +// default: +// bprintf(PRINT_NORMAL, _T("Z80 address %04X -> %02X.\n"), a, d); + } +} + +static void shadfrceYM2151IRQHandler(INT32 nStatus) +{ + if (nStatus) { + //ZetRaiseIrq(255); + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + ZetRun(0x0400); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekSetIRQLine(0, SEK_IRQSTATUS_NONE); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM2151Reset(); + + return 0; +} + +static INT32 loadDecodeGfx01() +{ +/* + 8,8, + RGN_FRAC(1,1), + 4, + { 0, 2, 4, 6 }, + { 1, 0, 8*8+1, 8*8+0, 16*8+1, 16*8+0, 24*8+1, 24*8+0 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 32*8 +*/ + UINT8 *buf = NULL; + + if ((buf = (UINT8*)BurnMalloc(0x20000)) == NULL) { + return 1; + } + + memset(buf, 0, 0x20000); + BurnLoadRom(buf, 5, 1); + + UINT8 *tmp = buf; + UINT8 *pgfx = RomGfx01; + + for (INT32 i=0; i<(0x20000/32); i++) { + for( INT32 y=0;y<8;y++) { + + pgfx[0] = (((tmp[ 0]>>0)&1)<<0) | (((tmp[ 0]>>2)&1)<<1) | (((tmp[ 0]>>4)&1)<<2) | (((tmp[ 0]>>6)&1)<<3); + pgfx[1] = (((tmp[ 0]>>1)&1)<<0) | (((tmp[ 0]>>3)&1)<<1) | (((tmp[ 0]>>5)&1)<<2) | (((tmp[ 0]>>7)&1)<<3); + pgfx[2] = (((tmp[ 8]>>0)&1)<<0) | (((tmp[ 8]>>2)&1)<<1) | (((tmp[ 8]>>4)&1)<<2) | (((tmp[ 8]>>6)&1)<<3); + pgfx[3] = (((tmp[ 8]>>1)&1)<<0) | (((tmp[ 8]>>3)&1)<<1) | (((tmp[ 8]>>5)&1)<<2) | (((tmp[ 8]>>7)&1)<<3); + pgfx[4] = (((tmp[16]>>0)&1)<<0) | (((tmp[16]>>2)&1)<<1) | (((tmp[16]>>4)&1)<<2) | (((tmp[16]>>6)&1)<<3); + pgfx[5] = (((tmp[16]>>1)&1)<<0) | (((tmp[16]>>3)&1)<<1) | (((tmp[16]>>5)&1)<<2) | (((tmp[16]>>7)&1)<<3); + pgfx[6] = (((tmp[24]>>0)&1)<<0) | (((tmp[24]>>2)&1)<<1) | (((tmp[24]>>4)&1)<<2) | (((tmp[24]>>6)&1)<<3); + pgfx[7] = (((tmp[24]>>1)&1)<<0) | (((tmp[24]>>3)&1)<<1) | (((tmp[24]>>5)&1)<<2) | (((tmp[24]>>7)&1)<<3); + + tmp += 1; + pgfx += 8; + } + tmp += 24; + } + + BurnFree(buf); + return 0; +} + +static INT32 loadDecodeGfx02() +{ +/* + 16,16, + RGN_FRAC(1,5), + 5, + { 0x800000*8, 0x600000*8, 0x400000*8, 0x200000*8, 0x000000*8 }, + { 0,1,2,3,4,5,6,7,16*8+0,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, + 16*16 +*/ + UINT8 *buf = NULL; + + if ((buf = (UINT8*)BurnMalloc(0xA00000)) == NULL) { + return 1; + } + memset(buf, 0, 0xA00000); + + BurnLoadRom(buf + 0x000000, 6, 1); + BurnLoadRom(buf + 0x200000, 7, 1); + BurnLoadRom(buf + 0x400000, 8, 1); + BurnLoadRom(buf + 0x600000, 9, 1); + BurnLoadRom(buf + 0x800000, 10, 1); + + UINT8 *tmp1 = buf; + UINT8 *tmp2 = tmp1 + 0x200000; + UINT8 *tmp3 = tmp2 + 0x200000; + UINT8 *tmp4 = tmp3 + 0x200000; + UINT8 *tmp5 = tmp4 + 0x200000; + UINT8 *pgfx = RomGfx02; + +// TODO: be lazy to research how BurnProgresser work, so ... + +// BurnSetProgressRange(1.0); + + for (INT32 i=0; i<(0x200000/32); i++) { + for( INT32 y=0;y<16;y++) { + + for(INT32 x=0;x<8;x++) { + pgfx[(7-x)+0] = (((tmp1[ 0] >> x) & 0x01) << 0) | + (((tmp2[ 0] >> x) & 0x01) << 1) | + (((tmp3[ 0] >> x) & 0x01) << 2) | + (((tmp4[ 0] >> x) & 0x01) << 3) | + (((tmp5[ 0] >> x) & 0x01) << 4); + pgfx[(7-x)+8] = (((tmp1[16] >> x) & 0x01) << 0) | + (((tmp2[16] >> x) & 0x01) << 1) | + (((tmp3[16] >> x) & 0x01) << 2) | + (((tmp4[16] >> x) & 0x01) << 3) | + (((tmp5[16] >> x) & 0x01) << 4); + } + tmp1 += 1; + tmp2 += 1; + tmp3 += 1; + tmp4 += 1; + tmp5 += 1; + pgfx += 16; + } + +// if ((i & 0xFFF) == 0) +// BurnUpdateProgress( 1.0 / 16, i ? NULL : _T("Decodeing graphics..."), 1); + + tmp1 += 16; + tmp2 += 16; + tmp3 += 16; + tmp4 += 16; + tmp5 += 16; + } + + BurnFree(buf); + return 0; +} + +static INT32 loadDecodeGfx03() +{ +/* + 16,16, + RGN_FRAC(1,3), + 6, + { 0x000000*8+8, 0x000000*8+0, 0x100000*8+8, 0x100000*8+0, 0x200000*8+8, 0x200000*8+0 }, + { 0, 1, 2, 3, 4, 5, 6, 7,16*16+0,16*16+1,16*16+2,16*16+3,16*16+4,16*16+5,16*16+6,16*16+7 }, + { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 8*16,9*16,10*16,11*16,12*16,13*16,14*16,15*16 }, + 64*8 +*/ + UINT8 *buf = NULL; + + if ((buf = (UINT8*)BurnMalloc(0x300000)) == NULL) { + return 1; + } + memset(buf, 0, 0x300000); + + BurnLoadRom(buf + 0x000000, 11, 1); + BurnLoadRom(buf + 0x100000, 12, 1); + BurnLoadRom(buf + 0x200000, 13, 1); + + UINT8 *tmp1 = buf; + UINT8 *tmp2 = tmp1 + 0x100000; + UINT8 *tmp3 = tmp2 + 0x100000; + UINT8 *pgfx = RomGfx03; + + for (INT32 i=0; i<(0x100000/64); i++) { + for( INT32 y=0;y<16;y++) { + + for(INT32 x=0;x<8;x++) { + pgfx[(7-x)+0] = (((tmp3[ 0] >> x) & 0x01) << 0) | (((tmp3[ 1] >> x) & 0x01) << 1) | + (((tmp2[ 0] >> x) & 0x01) << 2) | (((tmp2[ 1] >> x) & 0x01) << 3) | + (((tmp1[ 0] >> x) & 0x01) << 4) | (((tmp1[ 1] >> x) & 0x01) << 5); + pgfx[(7-x)+8] = (((tmp3[32] >> x) & 0x01) << 0) | (((tmp3[33] >> x) & 0x01) << 1) | + (((tmp2[32] >> x) & 0x01) << 2) | (((tmp2[33] >> x) & 0x01) << 3) | + (((tmp1[32] >> x) & 0x01) << 4) | (((tmp1[33] >> x) & 0x01) << 5); + } + tmp1 += 2; + tmp2 += 2; + tmp3 += 2; + pgfx += 16; + } + tmp1 += 32; + tmp2 += 32; + tmp3 += 32; + } + + BurnFree(buf); + + return 0; +} + +static INT32 shadfrceInit() +{ + INT32 nRet; + + Mem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); // blank all memory + MemIndex(); + + // Load and byte-swap 68000 Program roms + nRet = BurnLoadRom(Rom68K + 0x000000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Rom68K + 0x000001, 1, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Rom68K + 0x080000, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Rom68K + 0x080001, 3, 2); if (nRet != 0) return 1; + + nRet = BurnLoadRom(RomZ80 + 0x000000, 4, 1); if (nRet != 0) return 1; + + loadDecodeGfx01(); + loadDecodeGfx02(); + loadDecodeGfx03(); + + BurnLoadRom(MSM6295ROM, 14, 1); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom68K, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM + + SekMapMemory((UINT8 *)RamBg00, + 0x100000, 0x101FFF, SM_RAM); // b ground 0 + SekMapMemory((UINT8 *)RamBg01, + 0x102000, 0x103FFF, SM_RAM); // b ground 1 + SekMapMemory((UINT8 *)RamFg, + 0x140000, 0x141FFF, SM_RAM); // f ground + SekMapMemory((UINT8 *)RamSpr, + 0x142000, 0x143FFF, SM_RAM); // sprites + SekMapMemory((UINT8 *)RamPal, + 0x180000, 0x187FFF, SM_ROM); // palette + SekMapMemory(Ram68K, 0x1F0000, 0x1FFFFF, SM_RAM); // 68K RAM + + SekMapHandler(1, 0x180000, 0x187FFF, SM_WRITE); + + + SekSetReadWordHandler(0, shadfrceReadWord); + SekSetReadByteHandler(0, shadfrceReadByte); + SekSetWriteWordHandler(0, shadfrceWriteWord); + SekSetWriteByteHandler(0, shadfrceWriteByte); + + //SekSetWriteByteHandler(1, shadfrceWriteBytePalette); + SekSetWriteWordHandler(1, shadfrceWriteWordPalette); + + SekClose(); + } + + { + ZetInit(0); + ZetOpen(0); + + ZetSetReadHandler(shadfrceZRead); + ZetSetWriteHandler(shadfrceZWrite); + //ZetSetInHandler(shadfrceZIn); + //ZetSetOutHandler(shadfrceZOut); + + // ROM bank 1 + ZetMapArea(0x0000, 0xBFFF, 0, RomZ80); + ZetMapArea(0x0000, 0xBFFF, 2, RomZ80); + + // RAM + ZetMapArea(0xC000, 0xC7FF, 0, RamZ80); + ZetMapArea(0xC000, 0xC7FF, 1, RamZ80); + ZetMapArea(0xC000, 0xC7FF, 2, RamZ80); + + ZetMapArea(0xF000, 0xFFFF, 0, RamZ80+0x0800); + ZetMapArea(0xF000, 0xFFFF, 1, RamZ80+0x0800); + ZetMapArea(0xF000, 0xFFFF, 2, RamZ80+0x0800); + + ZetClose(); + } + + BurnYM2151Init(3579545); // 3.5795 MHz + YM2151SetIrqHandler(0, &shadfrceYM2151IRQHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + MSM6295Init(0, 12000, 1); // 12.000 KHz + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + nZ80Cycles = 3579545 * 100 / nBurnFPS; + + DrvDoReset(); + return 0; +} + +static INT32 shadfrceExit() +{ + MSM6295Exit(0); + BurnYM2151Exit(); + + SekExit(); + ZetExit(); + + BurnFree(Mem); + + return 0; +} + +#define TILE_BG0(x) \ + if (d[x]) { p[x]=pal[d[x]|c]; pp[x]=2; } + +#define TILE_BG0_FLIPX(x) \ + if (d[x]) { p[15-x]=pal[d[x]|c]; pp[15-x]=2; } + +#define TILE_BG0_E(z) \ + if (d[z]&&(x+z)>=0 && (x+z)<320) { p[z]=pal[d[z]|c]; pp[z]=2; } + +#define TILE_BG0_FLIPX_E(z) \ + if (d[z]&&(x+15-z)>=0&&(x+15-z)<320) { p[15-z]=pal[d[z]|c]; pp[15-z]=2; } + +#define TILE_BG0_LINE \ + TILE_BG0( 0) \ + TILE_BG0( 1) \ + TILE_BG0( 2) \ + TILE_BG0( 3) \ + TILE_BG0( 4) \ + TILE_BG0( 5) \ + TILE_BG0( 6) \ + TILE_BG0( 7) \ + TILE_BG0( 8) \ + TILE_BG0( 9) \ + TILE_BG0(10) \ + TILE_BG0(11) \ + TILE_BG0(12) \ + TILE_BG0(13) \ + TILE_BG0(14) \ + TILE_BG0(15) + +#define TILE_BG0_FLIPX_LINE \ + TILE_BG0_FLIPX( 0) \ + TILE_BG0_FLIPX( 1) \ + TILE_BG0_FLIPX( 2) \ + TILE_BG0_FLIPX( 3) \ + TILE_BG0_FLIPX( 4) \ + TILE_BG0_FLIPX( 5) \ + TILE_BG0_FLIPX( 6) \ + TILE_BG0_FLIPX( 7) \ + TILE_BG0_FLIPX( 8) \ + TILE_BG0_FLIPX( 9) \ + TILE_BG0_FLIPX(10) \ + TILE_BG0_FLIPX(11) \ + TILE_BG0_FLIPX(12) \ + TILE_BG0_FLIPX(13) \ + TILE_BG0_FLIPX(14) \ + TILE_BG0_FLIPX(15) + +#define TILE_BG0_LINE_E \ + if (((y+k)>=0) && ((y+k)<256)) { \ + TILE_BG0_E( 0) \ + TILE_BG0_E( 1) \ + TILE_BG0_E( 2) \ + TILE_BG0_E( 3) \ + TILE_BG0_E( 4) \ + TILE_BG0_E( 5) \ + TILE_BG0_E( 6) \ + TILE_BG0_E( 7) \ + TILE_BG0_E( 8) \ + TILE_BG0_E( 9) \ + TILE_BG0_E(10) \ + TILE_BG0_E(11) \ + TILE_BG0_E(12) \ + TILE_BG0_E(13) \ + TILE_BG0_E(14) \ + TILE_BG0_E(15) \ + } + +#define TILE_BG0_FLIPX_LINE_E \ + if (((y+k)>=0) && ((y+k)<256)) { \ + TILE_BG0_FLIPX_E( 0) \ + TILE_BG0_FLIPX_E( 1) \ + TILE_BG0_FLIPX_E( 2) \ + TILE_BG0_FLIPX_E( 3) \ + TILE_BG0_FLIPX_E( 4) \ + TILE_BG0_FLIPX_E( 5) \ + TILE_BG0_FLIPX_E( 6) \ + TILE_BG0_FLIPX_E( 7) \ + TILE_BG0_FLIPX_E( 8) \ + TILE_BG0_FLIPX_E( 9) \ + TILE_BG0_FLIPX_E(10) \ + TILE_BG0_FLIPX_E(11) \ + TILE_BG0_FLIPX_E(12) \ + TILE_BG0_FLIPX_E(13) \ + TILE_BG0_FLIPX_E(14) \ + TILE_BG0_FLIPX_E(15) \ + } + +static void tileBackground_0() +{ + /* ---- ---- YXcc CCCC --TT TTTT TTTT TTTT */ + + UINT16 * pal = RamCurPal + 0x2000; + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 32*32*2; offs+=2) { + mx++; + if (mx == 32) { + mx = 0; + my++; + } + + x = mx * 16 - bg0scrollx; + if (x <= (320-512)) x += 512; + + y = my * 16 - bg0scrolly; + if (y <= (256-512)) y += 512; + + if ( x<=-16 || x>=320 || y<=-16 || y>= 256 ) + continue; + else + if ( x >=0 && x <= (320-16) && y >= 0 && y <= (256-16)) { + + UINT32 tileno = RamBg00[offs+1] & 0x3FFF; + if (tileno == 0) continue; + + UINT32 c = (RamBg00[offs] & 0x1F); + if (c & 0x10) c ^= 0x30; // skip hole + c <<= 6; + + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + UINT8 *d = RomGfx03 + (tileno << 8); + + UINT8 * pp = RamPri + y * 320 + x; + + if (RamBg00[offs] & 0x0080) { + p += 320 * 15; + pp += 320 * 15; + if (RamBg00[offs] & 0x0040) { + for (INT32 k=0;k<16;k++) { + + TILE_BG0_FLIPX_LINE + + d += 16; + p -= 320; + pp -= 320; + } + } else { + for (INT32 k=0;k<16;k++) { + + TILE_BG0_LINE + + d += 16; + p -= 320; + pp -= 320; + } + } + } else { + if (RamBg00[offs] & 0x0040) { + for (INT32 k=0;k<16;k++) { + + TILE_BG0_FLIPX_LINE + + d += 16; + p += 320; + pp += 320; + } + } else { + for (INT32 k=0;k<16;k++) { + + TILE_BG0_LINE + + d += 16; + p += 320; + pp += 320; + } + } + } + + } else { + + UINT32 tileno = RamBg00[offs+1] & 0x3FFF; + if (tileno == 0) continue; + + UINT32 c = (RamBg00[offs] & 0x1F); + if (c & 0x10) c ^= 0x30; // skip hole + c <<= 6; + + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + UINT8 *d = RomGfx03 + (tileno << 8); + UINT8 * pp = RamPri + y * 320 + x; + + if (RamBg00[offs] & 0x0080) { + p += 320 * 15; + pp += 320 * 15; + if (RamBg00[offs] & 0x0040) { + for (INT32 k=0;k<16;k++) { + + TILE_BG0_FLIPX_LINE_E + + d += 16; + p -= 320; + pp -= 320; + } + } else { + for (INT32 k=0;k<16;k++) { + + TILE_BG0_LINE_E + + d += 16; + p -= 320; + pp -= 320; + } + } + } else { + if (RamBg00[offs] & 0x0040) { + for (INT32 k=0;k<16;k++) { + + TILE_BG0_FLIPX_LINE_E + + d += 16; + p += 320; + pp += 320; + } + } else { + for (INT32 k=0;k<16;k++) { + + TILE_BG0_LINE_E + + d += 16; + p += 320; + pp += 320; + } + } + } + + } + } + +} + +static void tileBackground_1() +{ + /* cccc TTTT TTTT TTTT */ + + UINT16 * pal = RamCurPal + 0x2000; + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 32*32; offs++) { + mx++; + if (mx == 32) { + mx = 0; + my++; + } + + x = mx * 16 - bg1scrollx; + if (x <= (320-512)) x += 512; + + y = my * 16 - bg1scrolly; + if (y <= (256-512)) y += 512; + + if ( x<=-16 || x>=320 || y<=-16 || y>= 256 ) + continue; + else + if ( x >=0 && x <= (320-16) && y >= 0 && y <= (256-16)) { + + UINT32 tileno = RamBg01[offs] & 0x0FFF; + UINT32 c = ((RamBg01[offs] & 0xF000) >> 6) + (64 << 6); + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + UINT8 *d = RomGfx03 + (tileno << 8); + + for (INT32 k=0;k<16;k++) { + p[ 0] = pal[ d[ 0] | c ]; + p[ 1] = pal[ d[ 1] | c ]; + p[ 2] = pal[ d[ 2] | c ]; + p[ 3] = pal[ d[ 3] | c ]; + p[ 4] = pal[ d[ 4] | c ]; + p[ 5] = pal[ d[ 5] | c ]; + p[ 6] = pal[ d[ 6] | c ]; + p[ 7] = pal[ d[ 7] | c ]; + p[ 8] = pal[ d[ 8] | c ]; + p[ 9] = pal[ d[ 9] | c ]; + p[10] = pal[ d[10] | c ]; + p[11] = pal[ d[11] | c ]; + p[12] = pal[ d[12] | c ]; + p[13] = pal[ d[13] | c ]; + p[14] = pal[ d[14] | c ]; + p[15] = pal[ d[15] | c ]; + + d += 16; + p += 320; + } + } else { + UINT32 tileno = RamBg01[offs] & 0x0FFF; + UINT32 c = ((RamBg01[offs] & 0xF000) >> 6) + (64 << 6); + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + UINT8 *d = RomGfx03 + (tileno << 8); + + for (INT32 k=0;k<16;k++) { + if ( (y+k)>=0 && (y+k)<256 ) { + if ((x + 0) >= 0 && (x + 0)<320) p[ 0] = pal[ d[ 0] | c ]; + if ((x + 1) >= 0 && (x + 1)<320) p[ 1] = pal[ d[ 1] | c ]; + if ((x + 2) >= 0 && (x + 2)<320) p[ 2] = pal[ d[ 2] | c ]; + if ((x + 3) >= 0 && (x + 3)<320) p[ 3] = pal[ d[ 3] | c ]; + if ((x + 4) >= 0 && (x + 4)<320) p[ 4] = pal[ d[ 4] | c ]; + if ((x + 5) >= 0 && (x + 5)<320) p[ 5] = pal[ d[ 5] | c ]; + if ((x + 6) >= 0 && (x + 6)<320) p[ 6] = pal[ d[ 6] | c ]; + if ((x + 7) >= 0 && (x + 7)<320) p[ 7] = pal[ d[ 7] | c ]; + if ((x + 8) >= 0 && (x + 8)<320) p[ 8] = pal[ d[ 8] | c ]; + if ((x + 9) >= 0 && (x + 9)<320) p[ 9] = pal[ d[ 9] | c ]; + if ((x + 10) >= 0 && (x + 10)<320) p[10] = pal[ d[10] | c ]; + if ((x + 11) >= 0 && (x + 11)<320) p[11] = pal[ d[11] | c ]; + if ((x + 12) >= 0 && (x + 12)<320) p[12] = pal[ d[12] | c ]; + if ((x + 13) >= 0 && (x + 13)<320) p[13] = pal[ d[13] | c ]; + if ((x + 14) >= 0 && (x + 14)<320) p[14] = pal[ d[14] | c ]; + if ((x + 15) >= 0 && (x + 15)<320) p[15] = pal[ d[15] | c ]; + } + d += 16; + p += 320; + } + } + } +} + +static void tileForeground() +{ + /* ---- ---- tttt tttt ---- ---- pppp TTTT */ + + UINT16 * pal = RamCurPal; + INT32 offs, mx, my, x, y; + + mx = -1; + my = 0; + for (offs = 0; offs < 64*32*2; offs+=2) { + mx++; + if (mx == 64) { + mx = 0; + my++; + } + + x = mx * 8; + y = my * 8; + + if ( x<=-8 || x>=320 || y<=-8 || y>= 256 ) + continue; + else + if ( x >=0 && x < (320-8) && y >= 0 && y < (256-8)) { + + UINT32 tileno = (RamFg[offs] & 0x00FF) | ((RamFg[offs+1] & 0x000F) << 8); + if (tileno == 0) continue; + + UINT32 c = (RamFg[offs+1] & 0x00F0) << 2; + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + UINT8 *d = RomGfx01 + (tileno << 6); + + for (INT32 k=0;k<8;k++) { + if (d[0]) p[0] = pal[d[0]|c]; + if (d[1]) p[1] = pal[d[1]|c]; + if (d[2]) p[2] = pal[d[2]|c]; + if (d[3]) p[3] = pal[d[3]|c]; + if (d[4]) p[4] = pal[d[4]|c]; + if (d[5]) p[5] = pal[d[5]|c]; + if (d[6]) p[6] = pal[d[6]|c]; + if (d[7]) p[7] = pal[d[7]|c]; + + d += 8; + p += 320; + } + } else { + + UINT32 tileno = (RamFg[offs] & 0x00FF) | ((RamFg[offs+1] & 0x000F) << 8); + if (tileno == 0) continue; + + UINT32 c = (RamFg[offs+1] & 0x00F0) << 2; + UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x; + UINT8 *d = RomGfx01 + (tileno << 6); + + for (INT32 k=0;k<8;k++) { + if ( (y+k)>=0 && (y+k)<256 ) { + if ((x + 0) >= 0 && (x + 0)<320) p[0] = pal[ d[0] | c ]; + if ((x + 1) >= 0 && (x + 1)<320) p[1] = pal[ d[1] | c ]; + if ((x + 2) >= 0 && (x + 2)<320) p[2] = pal[ d[2] | c ]; + if ((x + 3) >= 0 && (x + 3)<320) p[3] = pal[ d[3] | c ]; + if ((x + 4) >= 0 && (x + 4)<320) p[4] = pal[ d[4] | c ]; + if ((x + 5) >= 0 && (x + 5)<320) p[5] = pal[ d[5] | c ]; + if ((x + 6) >= 0 && (x + 6)<320) p[6] = pal[ d[6] | c ]; + if ((x + 7) >= 0 && (x + 7)<320) p[7] = pal[ d[7] | c ]; + } + d += 8; + p += 320; + } + } + } +} + +#define TILE_SPR_NORMAL(x) \ + if (q[x]) { if((pp[x]&(0x05|pri))==0) p[x]=pal[q[x]|color]; pp[x]|=(1<=0)&&((sx+x)<320)) { if((pp[x]&(0x05|pri))==0) p[x]=pal[q[x]|color]; pp[x]|=(1<=0)&&((sx+15-x)<320)) { if((pp[15-x]&(0x05|pri))==0) p[15-x]=pal[q[x]|color]; pp[15-x]|=(1<= (320-16) || sy < 0 || sy >= (256-16) ) { + + if ((sx <= -16) || (sx >= 320) || (sy <= -16) || (sy >= 256)) + return; + + if (flipy) { + + p += 320 * 15; + pp += 320 * 15; + + if (flipx) { + + for (INT32 i=15;i>=0;i--) { + if (((sy+i)>=0) && ((sy+i)<256)) { + + TILE_SPR_FLIP_X_LINE_E + + } + p -= 320; + pp -= 320; + q += 16; + } + + } else { + + for (INT32 i=15;i>=0;i--) { + if (((sy+i)>=0) && ((sy+i)<256)) { + + TILE_SPR_NORMAL_LINE_E + + } + p -= 320; + pp -= 320; + q += 16; + } + } + + } else { + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + if (((sy+i)>=0) && ((sy+i)<256)) { + + TILE_SPR_FLIP_X_LINE_E + + } + p += 320; + pp += 320; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + if (((sy+i)>=0) && ((sy+i)<256)) { + + TILE_SPR_NORMAL_LINE_E + + } + p += 320; + pp += 320; + q += 16; + } + + } + + } + + return; + } + + if (flipy) { + + p += 320 * 15; + pp += 320 * 15; + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + + TILE_SPR_FLIP_X_LINE + + p -= 320; + pp -= 320; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + + TILE_SPR_NORMAL_LINE + + p -= 320; + pp -= 320; + q += 16; + } + } + + } else { + + if (flipx) { + + for (INT32 i=0;i<16;i++) { + + TILE_SPR_FLIP_X_LINE + + p += 320; + pp += 320; + q += 16; + } + + } else { + + for (INT32 i=0;i<16;i++) { + + TILE_SPR_NORMAL_LINE + + p += 320; + pp += 320; + q += 16; + } + + } + + } + +} + +static void drawSprites() +{ + /* | ---- ---- hhhf Fe-Y | ---- ---- yyyy yyyy | ---- ---- TTTT TTTT | ---- ---- tttt tttt | + | ---- ---- -pCc cccX | ---- ---- xxxx xxxx | ---- ---- ---- ---- | ---- ---- ---- ---- | */ + + UINT16 * finish = RamSpr; + UINT16 * source = finish + 0x2000/2 - 8; + INT32 hcount; + + while( source>=finish ) { + INT32 ypos = 0x100 - (((source[0] & 0x0003) << 8) | (source[1] & 0x00ff)); + INT32 xpos = (((source[4] & 0x0001) << 8) | (source[5] & 0x00ff)) + 1; + INT32 tile = ((source[2] & 0x00ff) << 8) | (source[3] & 0x00ff); + INT32 height = (source[0] & 0x00e0) >> 5; + INT32 enable = ((source[0] & 0x0004)); + INT32 flipx = ((source[0] & 0x0010) >> 4); + INT32 flipy = ((source[0] & 0x0008) >> 3); + INT32 pal = ((source[4] & 0x003e)); + INT32 pri_mask = (source[4] & 0x0040) ? 0x02 : 0x00; + +// if ( (1 << pri_mask) & nSpriteEnable) { + + if (pal & 0x20) pal ^= 0x60; // skip hole + pal <<= 5; + + height++; + if (enable) { + for (hcount=0;hcount> 2); + if (pBurnSoundOut) { + INT32 nSegmentLength = (nBurnSoundLen * 1 / 4) - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + + bVBlink = 0; + SekRun(3500000 / 60); + SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + + ZetRun(nZ80Cycles >> 2); + if (pBurnSoundOut) { + INT32 nSegmentLength = (nBurnSoundLen * 2 / 4) - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + + bVBlink = 1; + SekRun(3500000 / 60); + + ZetRun(nZ80Cycles >> 2); + if (pBurnSoundOut) { + INT32 nSegmentLength = (nBurnSoundLen * 3 / 4) - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + + + bVBlink = 0; + SekRun(3500000 / 60); + SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + + ZetRun(nZ80Cycles >> 2); + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + +/* + ZetRun(nZ80Cycles); + if (pBurnSoundOut) { + BurnYM2151Render(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } +*/ + + ZetClose(); + SekClose(); + + if (pBurnDraw) + DrvDraw(); // Draw screen if needed + + + + return 0; +} + +static INT32 shadfrceScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) // Return minimum compatible version + *pnMin = 0x029671; + + if (nAction & ACB_MEMORY_RAM) { // Scan all memory, devices & variables + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); // Scan 68000 state + ZetScan(nAction); + + MSM6295Scan(0, nAction); + BurnYM2151Scan(nAction); + + SCAN_VAR(DrvInput); + SCAN_VAR(nBrightness); + SCAN_VAR(bg0scrollx); + SCAN_VAR(bg0scrolly); + SCAN_VAR(bg1scrollx); + SCAN_VAR(bg1scrolly); + SCAN_VAR(nSoundlatch); + } + + if (nAction & ACB_WRITE) { + // recalc palette and brightness + for(INT32 i=0;i<0x4000;i++) CalcCol(i); + } + + return 0; +} + +struct BurnDriver BurnDrvShadfrce = { + "shadfrce", NULL, NULL, NULL, "1993", + "Shadow Force (US Version 2)\0", NULL, "Technos Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, shadfrceRomInfo, shadfrceRomName, NULL, NULL, shadfrceInputInfo, shadfrceDIPInfo, + shadfrceInit, shadfrceExit, shadfrceFrame, NULL, shadfrceScan, &bRecalcPalette, 0x8000, + 320, 256, 4, 3 +}; + +struct BurnDriver BurnDrvShadfrcj = { + "shadfrcej", "shadfrce", NULL, NULL, "1993", + "Shadow Force (Japan Version 3)\0", NULL, "Technos Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, shadfrcjRomInfo, shadfrcjRomName, NULL, NULL, shadfrceInputInfo, shadfrceDIPInfo, + shadfrceInit, shadfrceExit, shadfrceFrame, NULL, shadfrceScan, &bRecalcPalette, 0x8000, + 320, 256, 4, 3 +}; + +struct BurnDriver BurnDrvShadfrcjv2 = { + "shadfrcejv2", "shadfrce", NULL, NULL, "1993", + "Shadow Force (Japan Version 2)\0", NULL, "Technos Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_16BIT_ONLY | BDF_CLONE, 2, HARDWARE_TECHNOS, GBF_SCRFIGHT, 0, + NULL, shadfrcjv2RomInfo, shadfrcjv2RomName, NULL, NULL, shadfrceInputInfo, shadfrceDIPInfo, + shadfrceInit, shadfrceExit, shadfrceFrame, NULL, shadfrceScan, &bRecalcPalette, 0x8000, + 320, 256, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_silvmil.cpp b/src/burn/drv/pst90s/d_silvmil.cpp index 2b7d0275b..d0e92fdb1 100644 --- a/src/burn/drv/pst90s/d_silvmil.cpp +++ b/src/burn/drv/pst90s/d_silvmil.cpp @@ -1,675 +1,674 @@ -// FB Alpha Silver Millennium driver module -// Based on MAME driver by David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "msm6295.h" -#include "burn_ym2151.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvSndROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvFgRAM; -static UINT8 *DrvBgRAM; -static UINT8 *DrvSprRAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *tilebanks; -static UINT8 *soundlatch; -static UINT8 *tile_bank; -static UINT16 *fg_scroll_x; -static UINT16 *fg_scroll_y; -static UINT16 *bg_scroll_x; -static UINT16 *bg_scroll_y; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; -static UINT16 DrvInputs[3]; - -static struct BurnInputInfo SilvmilInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 9, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 15, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 14, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Silvmil) - -static struct BurnDIPInfo SilvmilDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x03, 0x03, "Easy" }, - {0x13, 0x01, 0x03, 0x02, "Normal" }, - {0x13, 0x01, 0x03, 0x01, "Hard" }, - {0x13, 0x01, 0x03, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x14, 0x01, 0x04, 0x04, "Korean" }, - {0x14, 0x01, 0x04, 0x00, "English" }, - - {0 , 0xfe, 0 , 7, "Coinage" }, - {0x14, 0x01, 0x38, 0x08, "4 Coins 4 Credits" }, - {0x14, 0x01, 0x38, 0x18, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x38, 0x00, "4 Coins 2 Credits" }, - {0x14, 0x01, 0x38, 0x28, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x38, 0x10, "3 Coins 2 Credits" }, - {0x14, 0x01, 0x38, 0x20, "2 Coins 2 Credits" }, - {0x14, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 2, "Coin Box" }, - {0x14, 0x01, 0x40, 0x40, "1" }, - {0x14, 0x01, 0x40, 0x00, "2" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Silvmil) - -static inline void DrvPaletteUpdate(INT32 offset) -{ - UINT8 r,g,b; - UINT16 pal = *((UINT16*)(DrvPalRAM + offset)); - - r = (BURN_ENDIAN_SWAP_INT16(pal) >> 10) & 0x1f; - g = (BURN_ENDIAN_SWAP_INT16(pal) >> 5) & 0x1f; - b = (BURN_ENDIAN_SWAP_INT16(pal) >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); -} - -void __fastcall silvmil_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x100000: - *tile_bank = data & 0x03; - return; - - case 0x10000e: - tilebanks[*tile_bank] = data & 0x1f; - return; - } -} - -void __fastcall silvmil_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x100002: - *fg_scroll_x = data & 0x3ff; - return; - - case 0x100004: - *fg_scroll_y = (data + 8) & 0x1ff; - return; - - case 0x100006: - *bg_scroll_x = (data + 4) & 0x3ff; - return; - - case 0x100008: - *bg_scroll_y = (data + 8) & 0x1ff; - return; - - case 0x270000: - *soundlatch = data; - return; - } -} - -UINT8 __fastcall silvmil_read_byte(UINT32 address) -{ - switch (address) - { - case 0x280002: - return DrvInputs[1] >> 8; - } - - return 0; -} - -UINT16 __fastcall silvmil_read_word(UINT32 address) -{ - switch (address) - { - case 0x280000: - case 0x280002: - case 0x280004: - return DrvInputs[(address >> 1) & 3]; - } - - return 0; -} - -void __fastcall silvmil_palette_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xffff800) == 0x200000) { - DrvPalRAM[(address & 0x7ff) ^ 1] = data; - DrvPaletteUpdate(address & 0x7fe); - return; - } -} - -void __fastcall silvmil_palette_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xffff800) == 0x200000) { - *((UINT16*)(DrvPalRAM + (address & 0x7fe))) = BURN_ENDIAN_SWAP_INT16(data); - DrvPaletteUpdate(address & 0x7fe); - return; - } -} - -void __fastcall silvmil_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc000: - BurnYM2151SelectRegister(data); - return; - - case 0xc001: - BurnYM2151WriteRegister(data); - return; - - case 0xc002: - case 0xc003: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall silvmil_sound_read(UINT16 address) -{ - switch (address) - { - case 0xc001: - return BurnYM2151ReadStatus(); - - case 0xc002: - case 0xc003: - return MSM6295ReadStatus(0); - - case 0xc006: - return *soundlatch; - } - - return 0; -} - -void silvmilYM2151IrqHandler(INT32 nStatus) -{ - ZetSetIRQLine(0, (nStatus) ? ZET_IRQSTATUS_ACK : ZET_IRQSTATUS_NONE); -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - MSM6295Reset(0); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x100000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x800000; - DrvGfxROM1 = Next; Next += 0x400000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x000800; - DrvFgRAM = Next; Next += 0x001000; - DrvBgRAM = Next; Next += 0x001000; - DrvSprRAM = Next; Next += 0x000800; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - - tile_bank = Next; Next += 0x000001; - tilebanks = Next; Next += 0x000004; - - fg_scroll_x = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); - bg_scroll_x = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); - fg_scroll_y = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); - bg_scroll_y = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode(UINT8 *gfx, INT32 gfxlen) -{ - INT32 Planes[4] = { ((gfxlen / 2) * 8) + 8, ((gfxlen / 2) * 8) + 0, 8, 0 }; - INT32 XOffs[16] = { STEP8(256, 1), STEP8(0, 1) }; - INT32 YOffs[16] = { STEP16(0, 16) }; - - UINT8 *tmp = (UINT8*)BurnMalloc(gfxlen); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, gfx, gfxlen); - - GfxDecode((gfxlen * 2) / (16 * 16), 4, 16, 16, Planes, XOffs, YOffs, 0x200, tmp, gfx); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 5, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 6, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100001, 7, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x200001, 9, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x300000, 10, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x300001, 11, 2)) return 1; - - for (INT32 i = 0; i < 0x400000; i++) { - DrvGfxROM0[((i & 0x03ffff) ^ 0x20) | ((~i & 0x040000) << 3) | ((i & 0x380000) >> 1)] = DrvGfxROM1[i]; - } - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 12, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x000001, 13, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100000, 14, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x100001, 15, 2)) return 1; - - DrvGfxDecode(DrvGfxROM0, 0x400000); - DrvGfxDecode(DrvGfxROM1, 0x200000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(DrvFgRAM, 0x120000, 0x120fff, SM_RAM); - SekMapMemory(DrvBgRAM, 0x122000, 0x122fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x200000, 0x2005ff, SM_ROM); - SekMapMemory(DrvSprRAM, 0x210000, 0x2107ff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x300000, 0x30ffff, SM_RAM); - SekSetWriteByteHandler(0, silvmil_write_byte); - SekSetWriteWordHandler(0, silvmil_write_word); - SekSetReadByteHandler(0, silvmil_read_byte); - SekSetReadWordHandler(0, silvmil_read_word); - - SekMapHandler(1, 0x200000, 0x2005ff, SM_WRITE); - SekSetWriteByteHandler(1, silvmil_palette_write_byte); - SekSetWriteWordHandler(1, silvmil_palette_write_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); - ZetMapArea(0xd000, 0xd7ff, 0, DrvZ80RAM); - ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80RAM); - ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80RAM); - ZetSetWriteHandler(silvmil_sound_write); - ZetSetReadHandler(silvmil_sound_read); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&silvmilYM2151IrqHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - - MSM6295Init(0, 1024000 / 132, 1); - MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM2151Exit(); - MSM6295Exit(0); - - MSM6295ROM = NULL; - - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_layer(UINT8 *src, INT32 colbank, INT32 scrollx, INT32 scrolly, INT32 transp) -{ - UINT16 *vram = (UINT16*)src; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = (offs & 0x3f) << 4; - INT32 sy = (offs >> 6) << 4; - - sx -= scrollx; - if (sx < -15) sx += 0x400; - sy -= scrolly; - if (sy < -15) sy += 0x200; - - if (sy >= nScreenHeight || sx >= nScreenWidth) continue; - - INT32 data = BURN_ENDIAN_SWAP_INT16(vram[(offs & 0x1f) + ((offs >> 6) << 5) + ((offs & 0x20) << 5)]); - INT32 code = (data & 0x3ff) + (tilebanks[(data & 0x0c00) >> 10] << 10); - INT32 color = (data >> 12) + colbank; - - if (transp) { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } - } -} - -static void draw_sprites() -{ - UINT16 *ram = (UINT16*)DrvSprRAM; - - for (INT32 offs = 0;offs < 0x400;offs += 4) - { - INT32 sprite = BURN_ENDIAN_SWAP_INT16(ram[offs + 1]) & 0x3fff; - if (!sprite) continue; - - INT32 y = BURN_ENDIAN_SWAP_INT16(ram[offs]); - if ((y & 0x1000) && (GetCurrentFrame() & 1)) continue; // flash - - INT32 x = BURN_ENDIAN_SWAP_INT16(ram[offs + 2]); - INT32 color = (x >>9) & 0xf; - - INT32 fx = y & 0x2000; - INT32 fy = y & 0x4000; - INT32 multi = (1 << ((y & 0x0600) >> 9)) - 1; - - x &= 0x01ff; - y &= 0x01ff; - if (x >= 320) x -= 512; - if (y >= 256) y -= 512; - y = (240 - y) - 7; - x = (304 - x) - 5; - - INT32 inc = -1; - - if (!fy) - { - sprite += multi; - inc = 1; - } - - while (multi >= 0) - { - if (fy) { - if (fx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); - } - } else { - if (fx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); - } - } - - multi--; - } - } -} - -static void DrvPaletteRecalc() -{ - UINT8 r,g,b; - UINT16 *pal = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x300; i++) { - r = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 10) & 0x1f; - g = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 5) & 0x1f; - b = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvPaletteRecalc(); - DrvRecalc = 0; - } - - if (~nBurnLayer & 1) BurnTransferClear(); - if ( nBurnLayer & 1) draw_layer(DrvBgRAM, 0x20, *bg_scroll_x, *bg_scroll_y, 0); - if ( nBurnLayer & 2) draw_layer(DrvFgRAM, 0x10, *fg_scroll_x, *fg_scroll_y, 1); - if ( nBurnLayer & 4) draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - SekNewFrame(); - ZetNewFrame(); - - { - DrvInputs[0] = DrvInputs[1] = 0xffff; - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - - DrvInputs[2] = (DrvDips[1] << 8) | DrvDips[0]; - } - - INT32 nSegment; - INT32 nSoundBufferPos = 0; - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { 12000000 / 60, 4096000 /*3579545?*/ / 60 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = nCyclesTotal[0] / nInterleave; - - SekRun(nSegment); - - nSegment = nCyclesTotal[1] / nInterleave; - - ZetRun(nSegment); - - if (pBurnSoundOut) { - nSegment = nBurnSoundLen / nInterleave; - - BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - - nSoundBufferPos += nSegment; - } - } - - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - nSegment = nBurnSoundLen - nSoundBufferPos; - if (nSegment > 0) { - BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029698; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - } - - return 0; -} - - -// Silver Millennium - -static struct BurnRomInfo silvmilRomDesc[] = { - { "d-13_u3.bin", 0x40000, 0x46106c59, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "d-14_u2.bin", 0x40000, 0x65421eca, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "d-11_uz02.bin", 0x10000, 0xb41289e6, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "d-12_uz1.bin", 0x40000, 0xa170d8a9, 3 | BRF_SND }, // 3 MSM6295 Samples - - { "d-16_u41.bin", 0x80000, 0xff5ea605, 4 | BRF_GRA }, // 4 Background Tiles - { "d-15_u42.bin", 0x80000, 0x5f72d6cc, 4 | BRF_GRA }, // 5 - { "d-17_pat11.bin", 0x80000, 0x2facb3f1, 4 | BRF_GRA }, // 6 - { "d-20_pat01.bin", 0x80000, 0xcc4d3b49, 4 | BRF_GRA }, // 7 - { "d-18_pat12.bin", 0x80000, 0xa429b237, 4 | BRF_GRA }, // 8 - { "d-17_pat02.bin", 0x80000, 0xaddc5261, 4 | BRF_GRA }, // 9 - { "d-19_pat13.bin", 0x80000, 0xaf2507ce, 4 | BRF_GRA }, // 10 - { "d-18_pat03.bin", 0x80000, 0x36b9c407, 4 | BRF_GRA }, // 11 - - { "d-17_u53.bin", 0x80000, 0x4d177bda, 5 | BRF_GRA }, // 12 Sprites - { "d-18_u54.bin", 0x80000, 0x218c4471, 5 | BRF_GRA }, // 13 - { "d-19_u55.bin", 0x80000, 0x59507521, 5 | BRF_GRA }, // 14 - { "d-20_u56.bin", 0x80000, 0xe67c2c7d, 5 | BRF_GRA }, // 15 -}; - -STD_ROM_PICK(silvmil) -STD_ROM_FN(silvmil) - -struct BurnDriver BurnDrvSilvmil = { - "silvmil", NULL, NULL, NULL, "1995", - "Silver Millennium\0", NULL, "Para", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, - NULL, silvmilRomInfo, silvmilRomName, NULL, NULL, SilvmilInputInfo, SilvmilDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, - 240, 320, 3, 4 -}; +// FB Alpha Silver Millennium driver module +// Based on MAME driver by David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "msm6295.h" +#include "burn_ym2151.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvSndROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvFgRAM; +static UINT8 *DrvBgRAM; +static UINT8 *DrvSprRAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *tilebanks; +static UINT8 *soundlatch; +static UINT8 *tile_bank; +static UINT16 *fg_scroll_x; +static UINT16 *fg_scroll_y; +static UINT16 *bg_scroll_x; +static UINT16 *bg_scroll_y; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; +static UINT16 DrvInputs[3]; + +static struct BurnInputInfo SilvmilInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 8, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 9, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 15, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 8, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 9, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 10, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 11, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 14, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Silvmil) + +static struct BurnDIPInfo SilvmilDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x03, 0x03, "Easy" }, + {0x13, 0x01, 0x03, 0x02, "Normal" }, + {0x13, 0x01, 0x03, 0x01, "Hard" }, + {0x13, 0x01, 0x03, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x14, 0x01, 0x04, 0x04, "Korean" }, + {0x14, 0x01, 0x04, 0x00, "English" }, + + {0 , 0xfe, 0 , 7, "Coinage" }, + {0x14, 0x01, 0x38, 0x08, "4 Coins 4 Credits" }, + {0x14, 0x01, 0x38, 0x18, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x38, 0x00, "4 Coins 2 Credits" }, + {0x14, 0x01, 0x38, 0x28, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x38, 0x10, "3 Coins 2 Credits" }, + {0x14, 0x01, 0x38, 0x20, "2 Coins 2 Credits" }, + {0x14, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 2, "Coin Box" }, + {0x14, 0x01, 0x40, 0x40, "1" }, + {0x14, 0x01, 0x40, 0x00, "2" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Silvmil) + +static inline void DrvPaletteUpdate(INT32 offset) +{ + UINT8 r,g,b; + UINT16 pal = *((UINT16*)(DrvPalRAM + offset)); + + r = (BURN_ENDIAN_SWAP_INT16(pal) >> 10) & 0x1f; + g = (BURN_ENDIAN_SWAP_INT16(pal) >> 5) & 0x1f; + b = (BURN_ENDIAN_SWAP_INT16(pal) >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); +} + +void __fastcall silvmil_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x100000: + *tile_bank = data & 0x03; + return; + + case 0x10000e: + tilebanks[*tile_bank] = data & 0x1f; + return; + } +} + +void __fastcall silvmil_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x100002: + *fg_scroll_x = data & 0x3ff; + return; + + case 0x100004: + *fg_scroll_y = (data + 8) & 0x1ff; + return; + + case 0x100006: + *bg_scroll_x = (data + 4) & 0x3ff; + return; + + case 0x100008: + *bg_scroll_y = (data + 8) & 0x1ff; + return; + + case 0x270000: + *soundlatch = data; + return; + } +} + +UINT8 __fastcall silvmil_read_byte(UINT32 address) +{ + switch (address) + { + case 0x280002: + return DrvInputs[1] >> 8; + } + + return 0; +} + +UINT16 __fastcall silvmil_read_word(UINT32 address) +{ + switch (address) + { + case 0x280000: + case 0x280002: + case 0x280004: + return DrvInputs[(address >> 1) & 3]; + } + + return 0; +} + +void __fastcall silvmil_palette_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xffff800) == 0x200000) { + DrvPalRAM[(address & 0x7ff) ^ 1] = data; + DrvPaletteUpdate(address & 0x7fe); + return; + } +} + +void __fastcall silvmil_palette_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xffff800) == 0x200000) { + *((UINT16*)(DrvPalRAM + (address & 0x7fe))) = BURN_ENDIAN_SWAP_INT16(data); + DrvPaletteUpdate(address & 0x7fe); + return; + } +} + +void __fastcall silvmil_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc000: + BurnYM2151SelectRegister(data); + return; + + case 0xc001: + BurnYM2151WriteRegister(data); + return; + + case 0xc002: + case 0xc003: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall silvmil_sound_read(UINT16 address) +{ + switch (address) + { + case 0xc001: + return BurnYM2151ReadStatus(); + + case 0xc002: + case 0xc003: + return MSM6295ReadStatus(0); + + case 0xc006: + return *soundlatch; + } + + return 0; +} + +void silvmilYM2151IrqHandler(INT32 nStatus) +{ + ZetSetIRQLine(0, (nStatus) ? ZET_IRQSTATUS_ACK : ZET_IRQSTATUS_NONE); +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + MSM6295Reset(0); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x100000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x800000; + DrvGfxROM1 = Next; Next += 0x400000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x000800; + DrvFgRAM = Next; Next += 0x001000; + DrvBgRAM = Next; Next += 0x001000; + DrvSprRAM = Next; Next += 0x000800; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + + tile_bank = Next; Next += 0x000001; + tilebanks = Next; Next += 0x000004; + + fg_scroll_x = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); + bg_scroll_x = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); + fg_scroll_y = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); + bg_scroll_y = (UINT16*)Next; Next += 0x0001 * sizeof (UINT16); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode(UINT8 *gfx, INT32 gfxlen) +{ + INT32 Planes[4] = { ((gfxlen / 2) * 8) + 8, ((gfxlen / 2) * 8) + 0, 8, 0 }; + INT32 XOffs[16] = { STEP8(256, 1), STEP8(0, 1) }; + INT32 YOffs[16] = { STEP16(0, 16) }; + + UINT8 *tmp = (UINT8*)BurnMalloc(gfxlen); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, gfx, gfxlen); + + GfxDecode((gfxlen * 2) / (16 * 16), 4, 16, 16, Planes, XOffs, YOffs, 0x200, tmp, gfx); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 5, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 6, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100001, 7, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x200001, 9, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x300000, 10, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x300001, 11, 2)) return 1; + + for (INT32 i = 0; i < 0x400000; i++) { + DrvGfxROM0[((i & 0x03ffff) ^ 0x20) | ((~i & 0x040000) << 3) | ((i & 0x380000) >> 1)] = DrvGfxROM1[i]; + } + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 12, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x000001, 13, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100000, 14, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x100001, 15, 2)) return 1; + + DrvGfxDecode(DrvGfxROM0, 0x400000); + DrvGfxDecode(DrvGfxROM1, 0x200000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(DrvFgRAM, 0x120000, 0x120fff, SM_RAM); + SekMapMemory(DrvBgRAM, 0x122000, 0x122fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x200000, 0x2005ff, SM_ROM); + SekMapMemory(DrvSprRAM, 0x210000, 0x2107ff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x300000, 0x30ffff, SM_RAM); + SekSetWriteByteHandler(0, silvmil_write_byte); + SekSetWriteWordHandler(0, silvmil_write_word); + SekSetReadByteHandler(0, silvmil_read_byte); + SekSetReadWordHandler(0, silvmil_read_word); + + SekMapHandler(1, 0x200000, 0x2005ff, SM_WRITE); + SekSetWriteByteHandler(1, silvmil_palette_write_byte); + SekSetWriteWordHandler(1, silvmil_palette_write_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); + ZetMapArea(0xd000, 0xd7ff, 0, DrvZ80RAM); + ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80RAM); + ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80RAM); + ZetSetWriteHandler(silvmil_sound_write); + ZetSetReadHandler(silvmil_sound_read); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&silvmilYM2151IrqHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + + MSM6295Init(0, 1024000 / 132, 1); + MSM6295SetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM2151Exit(); + MSM6295Exit(0); + + MSM6295ROM = NULL; + + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_layer(UINT8 *src, INT32 colbank, INT32 scrollx, INT32 scrolly, INT32 transp) +{ + UINT16 *vram = (UINT16*)src; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = (offs & 0x3f) << 4; + INT32 sy = (offs >> 6) << 4; + + sx -= scrollx; + if (sx < -15) sx += 0x400; + sy -= scrolly; + if (sy < -15) sy += 0x200; + + if (sy >= nScreenHeight || sx >= nScreenWidth) continue; + + INT32 data = BURN_ENDIAN_SWAP_INT16(vram[(offs & 0x1f) + ((offs >> 6) << 5) + ((offs & 0x20) << 5)]); + INT32 code = (data & 0x3ff) + (tilebanks[(data & 0x0c00) >> 10] << 10); + INT32 color = (data >> 12) + colbank; + + if (transp) { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } + } +} + +static void draw_sprites() +{ + UINT16 *ram = (UINT16*)DrvSprRAM; + + for (INT32 offs = 0;offs < 0x400;offs += 4) + { + INT32 sprite = BURN_ENDIAN_SWAP_INT16(ram[offs + 1]) & 0x3fff; + if (!sprite) continue; + + INT32 y = BURN_ENDIAN_SWAP_INT16(ram[offs]); + if ((y & 0x1000) && (GetCurrentFrame() & 1)) continue; // flash + + INT32 x = BURN_ENDIAN_SWAP_INT16(ram[offs + 2]); + INT32 color = (x >>9) & 0xf; + + INT32 fx = y & 0x2000; + INT32 fy = y & 0x4000; + INT32 multi = (1 << ((y & 0x0600) >> 9)) - 1; + + x &= 0x01ff; + y &= 0x01ff; + if (x >= 320) x -= 512; + if (y >= 256) y -= 512; + y = (240 - y) - 7; + x = (304 - x) - 5; + + INT32 inc = -1; + + if (!fy) + { + sprite += multi; + inc = 1; + } + + while (multi >= 0) + { + if (fy) { + if (fx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); + } + } else { + if (fx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, sprite - multi * inc, x, y - 16 * multi, color, 4, 0, 0, DrvGfxROM1); + } + } + + multi--; + } + } +} + +static void DrvPaletteRecalc() +{ + UINT8 r,g,b; + UINT16 *pal = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x300; i++) { + r = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 10) & 0x1f; + g = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 5) & 0x1f; + b = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvPaletteRecalc(); + DrvRecalc = 0; + } + + if (~nBurnLayer & 1) BurnTransferClear(); + if ( nBurnLayer & 1) draw_layer(DrvBgRAM, 0x20, *bg_scroll_x, *bg_scroll_y, 0); + if ( nBurnLayer & 2) draw_layer(DrvFgRAM, 0x10, *fg_scroll_x, *fg_scroll_y, 1); + if ( nBurnLayer & 4) draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + SekNewFrame(); + ZetNewFrame(); + + { + DrvInputs[0] = DrvInputs[1] = 0xffff; + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + + DrvInputs[2] = (DrvDips[1] << 8) | DrvDips[0]; + } + + INT32 nSegment; + INT32 nSoundBufferPos = 0; + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { 12000000 / 60, 4096000 /*3579545?*/ / 60 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = nCyclesTotal[0] / nInterleave; + + SekRun(nSegment); + + nSegment = nCyclesTotal[1] / nInterleave; + + ZetRun(nSegment); + + if (pBurnSoundOut) { + nSegment = nBurnSoundLen / nInterleave; + + BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + + nSoundBufferPos += nSegment; + } + } + + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + nSegment = nBurnSoundLen - nSoundBufferPos; + if (nSegment > 0) { + BurnYM2151Render(pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + MSM6295Render(0, pBurnSoundOut + (nSoundBufferPos << 1), nSegment); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029698; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + } + + return 0; +} + + +// Silver Millennium + +static struct BurnRomInfo silvmilRomDesc[] = { + { "d-13_u3.bin", 0x40000, 0x46106c59, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "d-14_u2.bin", 0x40000, 0x65421eca, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "d-11_uz02.bin", 0x10000, 0xb41289e6, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "d-12_uz1.bin", 0x40000, 0xa170d8a9, 3 | BRF_SND }, // 3 MSM6295 Samples + + { "d-16_u41.bin", 0x80000, 0xff5ea605, 4 | BRF_GRA }, // 4 Background Tiles + { "d-15_u42.bin", 0x80000, 0x5f72d6cc, 4 | BRF_GRA }, // 5 + { "d-17_pat11.bin", 0x80000, 0x2facb3f1, 4 | BRF_GRA }, // 6 + { "d-20_pat01.bin", 0x80000, 0xcc4d3b49, 4 | BRF_GRA }, // 7 + { "d-18_pat12.bin", 0x80000, 0xa429b237, 4 | BRF_GRA }, // 8 + { "d-17_pat02.bin", 0x80000, 0xaddc5261, 4 | BRF_GRA }, // 9 + { "d-19_pat13.bin", 0x80000, 0xaf2507ce, 4 | BRF_GRA }, // 10 + { "d-18_pat03.bin", 0x80000, 0x36b9c407, 4 | BRF_GRA }, // 11 + + { "d-17_u53.bin", 0x80000, 0x4d177bda, 5 | BRF_GRA }, // 12 Sprites + { "d-18_u54.bin", 0x80000, 0x218c4471, 5 | BRF_GRA }, // 13 + { "d-19_u55.bin", 0x80000, 0x59507521, 5 | BRF_GRA }, // 14 + { "d-20_u56.bin", 0x80000, 0xe67c2c7d, 5 | BRF_GRA }, // 15 +}; + +STD_ROM_PICK(silvmil) +STD_ROM_FN(silvmil) + +struct BurnDriver BurnDrvSilvmil = { + "silvmil", NULL, NULL, NULL, "1995", + "Silver Millennium\0", NULL, "Para", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0, + NULL, silvmilRomInfo, silvmilRomName, NULL, NULL, SilvmilInputInfo, SilvmilDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300, + 240, 320, 3, 4 +}; diff --git a/src/burn/drv/pst90s/d_speedspn.cpp b/src/burn/drv/pst90s/d_speedspn.cpp index 65429b4cc..010a12b1d 100644 --- a/src/burn/drv/pst90s/d_speedspn.cpp +++ b/src/burn/drv/pst90s/d_speedspn.cpp @@ -1,635 +1,633 @@ -// FB Alpha Speed Spin driver module -// Based on MAME driver by David Haywood - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvSndROM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvVidRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvAttrRAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *display_enable; -static UINT8 *banks; - -static UINT8 DrvInputs[3]; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; - -static INT32 black_color; - -static struct BurnInputInfo SpeedspnInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 7, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 6, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 5, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 4, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 7, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 6, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 5, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 4, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 3, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 2, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Speedspn) - -static struct BurnDIPInfo SpeedspnDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x13, 0x01, 0x0f, 0x01, "5 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x04, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x07, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x00, "5 Coins/2 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x06, "3 Coins 2 Credits" }, - {0x13, 0x01, 0x0f, 0x03, "4 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x0f, 0x02, "4 Coins 5 Credits" }, - {0x13, 0x01, 0x0f, 0x05, "3 Coins/5 Credits" }, - {0x13, 0x01, 0x0f, 0x09, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x08, "2 Coins 5 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x13, 0x01, 0xf0, 0x10, "5 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x40, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x00, "5 Coins/2 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "3 Coins 2 Credits" }, - {0x13, 0x01, 0xf0, 0x30, "4 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x20, "4 Coins 5 Credits" }, - {0x13, 0x01, 0xf0, 0x50, "3 Coins/5 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "2 Coins 5 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 2, "World Cup" }, - {0x14, 0x01, 0x01, 0x00, "Off" }, - {0x14, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2, "Backhand" }, - {0x14, 0x01, 0x02, 0x02, "Automatic" }, - {0x14, 0x01, 0x02, 0x00, "Manual" }, - - {0 , 0xfe, 0 , 4, "Points to Win" }, - {0x14, 0x01, 0x0c, 0x0c, "11 Points and 1 Adv." }, - {0x14, 0x01, 0x0c, 0x08, "11 Points and 2 Adv." }, - {0x14, 0x01, 0x0c, 0x04, "21 Points and 1 Adv." }, - {0x14, 0x01, 0x0c, 0x00, "21 Points and 2 Adv." }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x30, 0x20, "Easy" }, - {0x14, 0x01, 0x30, 0x30, "Normal" }, - {0x14, 0x01, 0x30, 0x10, "Hard" }, - {0x14, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, - -}; - -STDDIPINFO(Speedspn) - -static void bankswitch(INT32 data) -{ - const INT32 offsets[10] = { - 0x30000, 0x1c000, 0x24000, 0x5c000, 0x50000, 0x44000, 0x20000, 0x54000, 0x58000, 0x08000 - }; - - banks[0] = (data > 8) ? 9 : data; - - ZetMapArea(0xc000, 0xffff, 0, DrvZ80ROM0 + offsets[banks[0]]); - ZetMapArea(0xc000, 0xffff, 2, DrvZ80ROM0 + offsets[banks[0]]); -} - -static void vidram_bankswitch(INT32 data) -{ - banks[1] = data & 1; - - ZetMapArea(0x9000, 0x9fff, 0, DrvVidRAM + banks[1] * 0x1000); - ZetMapArea(0x9000, 0x9fff, 1, DrvVidRAM + banks[1] * 0x1000); - ZetMapArea(0x9000, 0x9fff, 2, DrvVidRAM + banks[1] * 0x1000); -} - -static inline void speedspn_palette_write(INT32 offset) -{ - INT32 r = DrvPalRAM[offset + 1] & 0x0f; - INT32 g = DrvPalRAM[offset + 0] >> 4; - INT32 b = DrvPalRAM[offset + 0] & 0x0f; - - offset /= 2; - - DrvPalette[offset] = BurnHighCol((r << 4) | r, (g << 4) | g, (b << 4) | b, 0); - if (DrvPalette[offset] == 0) black_color = offset; -} - -void __fastcall speedspn_main_write(UINT16 address, UINT8 data) -{ - if ((address & 0xf800) == 0x8000) { - address &= 0x7ff; - - if (data != DrvPalRAM[address]) { - DrvPalRAM[address] = data; - - speedspn_palette_write(address & ~1); - } - } -} - -void __fastcall speedspn_main_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x01: - case 0x10: // ? - return; - - case 0x07: - *display_enable = ~data & 1; - return; - - case 0x12: - bankswitch(data); - return; - - case 0x13: - *soundlatch = data; - ZetClose(); - ZetOpen(1); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(0); - return; - - case 0x17: - vidram_bankswitch(data); - return; - } -} - -UINT8 __fastcall speedspn_main_read_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x10: - return DrvInputs[0]; - - case 0x11: - return DrvInputs[1]; - - case 0x12: - return DrvInputs[2]; - - case 0x13: - return DrvDips[0]; - - case 0x14: - return DrvDips[1]; - - case 0x16: - return 0; // irq ack? - } - - return 0; -} - -static void oki_bankswitch(INT32 data) -{ - banks[2] = data & 3; - - MSM6295ROM = DrvSndROM + (banks[2] * 0x40000); - - for (INT32 nChannel = 0; nChannel < 4; nChannel++) { - MSM6295SampleInfo[0][nChannel] = MSM6295ROM + (nChannel << 8); - MSM6295SampleData[0][nChannel] = MSM6295ROM + (nChannel << 16); - } -} - -void __fastcall speedspn_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x9000: - oki_bankswitch(data); - return; - - case 0x9800: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall speedspn_sound_read(UINT16 address) -{ - switch (address) - { - case 0x9800: - return MSM6295ReadStatus(0); - - case 0xa000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - bankswitch(0); - vidram_bankswitch(0); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - oki_bankswitch(1); - MSM6295Reset(0); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x090000; - DrvZ80ROM1 = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x100000; - DrvGfxROM1 = Next; Next += 0x080000; - - DrvSndROM = Next; Next += 0x100000; - - DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x002000; - DrvZ80RAM1 = Next; Next += 0x000800; - - DrvVidRAM = Next; Next += 0x002000; - DrvPalRAM = Next; Next += 0x000800; - DrvAttrRAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - display_enable = Next; Next += 0x000001; - banks = Next; Next += 0x000003; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[4] = { 0x200000, 0x300000, 0x000000, 0x100000 }; - INT32 XOffs0[8] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; - INT32 YOffs0[8] = { 0x038, 0x030, 0x028, 0x020, 0x018, 0x010, 0x008, 0x000 }; - - INT32 Plane1[4] = { 0x000004, 0x000000, 0x100004, 0x100000 }; - INT32 XOffs1[16] = { 0x10b, 0x10a, 0x109, 0x108, 0x103, 0x102, 0x101, 0x100, - 0x00b, 0x00a, 0x009, 0x008, 0x003, 0x002, 0x001, 0x000 }; - INT32 YOffs1[16] = { 0x0f0, 0x0e0, 0x0d0, 0x0c0, 0x0b0, 0x0a0, 0x090, 0x080, - 0x070, 0x060, 0x050, 0x040, 0x030, 0x020, 0x010, 0x000 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x80000); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x80000; i++) tmp[i] = DrvGfxROM0[i] ^ 0xff; - - GfxDecode(0x4000, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x040, tmp, DrvGfxROM0); - - for (INT32 i = 0; i < 0x40000; i++) tmp[i] = DrvGfxROM1[i] ^ 0xff; - - GfxDecode(0x0800, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x200, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x000000, 0, 1)) return 1; - memmove (DrvZ80ROM0 + 0x10000, DrvZ80ROM0 + 0x08000, 0x78000); - - if (BurnLoadRom(DrvZ80ROM1 + 0x000000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; - memcpy (DrvSndROM + 0x000000, DrvGfxROM0 + 0x000000, 0x020000); - memcpy (DrvSndROM + 0x040000, DrvGfxROM0 + 0x000000, 0x020000); - memcpy (DrvSndROM + 0x080000, DrvGfxROM0 + 0x000000, 0x020000); - memcpy (DrvSndROM + 0x0c0000, DrvGfxROM0 + 0x000000, 0x020000); - memcpy (DrvSndROM + 0x020000, DrvGfxROM0 + 0x000000, 0x020000); - memcpy (DrvSndROM + 0x060000, DrvGfxROM0 + 0x020000, 0x020000); - memcpy (DrvSndROM + 0x0a0000, DrvGfxROM0 + 0x040000, 0x020000); - memcpy (DrvSndROM + 0x0e0000, DrvGfxROM0 + 0x060000, 0x020000); - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x020000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x040000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x060000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x020000, 8, 1)) return 1; - - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0x8000, 0x87ff, 0, DrvPalRAM); -// ZetMapArea(0x8000, 0x87ff, 1, DrvPalRAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvPalRAM); - ZetMapArea(0x8800, 0x8fff, 0, DrvAttrRAM); - ZetMapArea(0x8800, 0x8fff, 1, DrvAttrRAM); - ZetMapArea(0x8800, 0x8fff, 2, DrvAttrRAM); - ZetMapArea(0xa000, 0xbfff, 0, DrvZ80RAM0); - ZetMapArea(0xa000, 0xbfff, 1, DrvZ80RAM0); - ZetMapArea(0xa000, 0xbfff, 2, DrvZ80RAM0); - ZetSetWriteHandler(speedspn_main_write); - ZetSetOutHandler(speedspn_main_write_port); - ZetSetInHandler(speedspn_main_read_port); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); - ZetSetWriteHandler(speedspn_sound_write); - ZetSetReadHandler(speedspn_sound_read); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 1122000 / 132, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - - MSM6295Exit(0); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - return 0; -} - -static void draw_layer() -{ - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = (((offs / 32) << 3) + 192) & 0x1ff; - INT32 sy = (((offs & 0x1f) << 3) - 8) & 0x0ff; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 code = DrvVidRAM[offs * 2 + 1] | ((DrvVidRAM[offs * 2 + 0] & 0x3f) << 8); - INT32 color = DrvAttrRAM[offs ^ 0x400]; - - if (color & 0x80) { - Render8x8Tile_FlipX(pTransDraw, code, sx, sy, color & 0x3f, 4, 0, DrvGfxROM0); - } else { - Render8x8Tile(pTransDraw, code, sx, sy, color & 0x3f, 4, 0, DrvGfxROM0); - } - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0x1000; offs < 0x2000; offs += 4) - { - INT32 sy = DrvVidRAM[offs + 3]; - INT32 attr = DrvVidRAM[offs + 2]; - INT32 code = DrvVidRAM[offs + 1] + ((attr & 0xe0) << 3); - INT32 sx = DrvVidRAM[offs + 0] + ((attr & 0x10) << 4); - - if (attr == 0 && sx != 0) // fix junk on char. select screen - break; - - if (attr == 0 && code == 0) // speedup - continue; - - Render16x16Tile_Mask_Clip(pTransDraw, code, (0x1f8 - sx) - 64, sy - 8, attr & 0x0f, 4, 0x0f, 0, DrvGfxROM1); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x800; i+=2) { - speedspn_palette_write(i); - } - DrvRecalc = 0; - } - - if (*display_enable) - { - draw_layer(); - draw_sprites(); - } - else - { - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = black_color; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= DrvJoy1[i] << i; - DrvInputs[1] ^= DrvJoy2[i] << i; - DrvInputs[2] ^= DrvJoy3[i] << i; - } - } - - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { 6000000 / 60, 6000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nSegment; - - ZetOpen(0); - nSegment = nCyclesTotal[0] / nInterleave; - nCyclesDone[0] += ZetRun(nSegment); - if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - ZetOpen(1); - nCyclesDone[1] += ZetRun(nSegment); - ZetClose(); - } - - if (pBurnSoundOut) { - MSM6295Render(0,pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029707; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - - MSM6295Scan(0, nAction); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - bankswitch(banks[0]); - vidram_bankswitch(banks[1]); - ZetClose(); - - oki_bankswitch(banks[2]); - - DrvRecalc = 1; - } - - return 0; -} - - -// Speed Spin - -static struct BurnRomInfo speedspnRomDesc[] = { - { "tch-ss1.u78", 0x80000, 0x41b6b45b, 1 | BRF_PRG | BRF_ESS }, // 0 Main Z80 Code - - { "tch-ss2.u96", 0x10000, 0x4611fd0c, 2 | BRF_PRG | BRF_ESS }, // 1 Sound Z80 Code - - { "tch-ss3.u95", 0x80000, 0x1c9deb5e, 3 | BRF_SND }, // 2 Samples - - { "tch-ss4.u70", 0x20000, 0x41517859, 4 | BRF_GRA }, // 3 Background Tiles - { "tch-ss5.u69", 0x20000, 0x832b2f34, 4 | BRF_GRA }, // 4 - { "tch-ss6.u60", 0x20000, 0xf1fd7289, 4 | BRF_GRA }, // 5 - { "tch-ss7.u59", 0x20000, 0xc4958543, 4 | BRF_GRA }, // 6 - - { "tch-ss8.u39", 0x20000, 0x2f27b16d, 5 | BRF_GRA }, // 7 Sprites - { "tch-ss9.u34", 0x20000, 0xc372f8ec, 5 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(speedspn) -STD_ROM_FN(speedspn) - -struct BurnDriver BurnDrvSpeedspn = { - "speedspn", NULL, NULL, NULL, "1994", - "Speed Spin\0", NULL, "TCH", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, - NULL, speedspnRomInfo, speedspnRomName, NULL, NULL, SpeedspnInputInfo, SpeedspnDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 384, 240, 4, 3 -}; +// FB Alpha Speed Spin driver module +// Based on MAME driver by David Haywood + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvSndROM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvVidRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvAttrRAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *display_enable; +static UINT8 *banks; + +static UINT8 DrvInputs[3]; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; + +static INT32 black_color; + +static struct BurnInputInfo SpeedspnInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 7, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 6, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 5, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 4, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 7, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 6, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 5, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 4, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 3, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 2, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Speedspn) + +static struct BurnDIPInfo SpeedspnDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x13, 0x01, 0x0f, 0x01, "5 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x04, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x07, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x00, "5 Coins/2 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x06, "3 Coins 2 Credits" }, + {0x13, 0x01, 0x0f, 0x03, "4 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x0f, 0x02, "4 Coins 5 Credits" }, + {0x13, 0x01, 0x0f, 0x05, "3 Coins/5 Credits" }, + {0x13, 0x01, 0x0f, 0x09, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x08, "2 Coins 5 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x13, 0x01, 0xf0, 0x10, "5 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x40, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x00, "5 Coins/2 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "3 Coins 2 Credits" }, + {0x13, 0x01, 0xf0, 0x30, "4 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x20, "4 Coins 5 Credits" }, + {0x13, 0x01, 0xf0, 0x50, "3 Coins/5 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "2 Coins 5 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 2, "World Cup" }, + {0x14, 0x01, 0x01, 0x00, "Off" }, + {0x14, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2, "Backhand" }, + {0x14, 0x01, 0x02, 0x02, "Automatic" }, + {0x14, 0x01, 0x02, 0x00, "Manual" }, + + {0 , 0xfe, 0 , 4, "Points to Win" }, + {0x14, 0x01, 0x0c, 0x0c, "11 Points and 1 Adv." }, + {0x14, 0x01, 0x0c, 0x08, "11 Points and 2 Adv." }, + {0x14, 0x01, 0x0c, 0x04, "21 Points and 1 Adv." }, + {0x14, 0x01, 0x0c, 0x00, "21 Points and 2 Adv." }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x30, 0x20, "Easy" }, + {0x14, 0x01, 0x30, 0x30, "Normal" }, + {0x14, 0x01, 0x30, 0x10, "Hard" }, + {0x14, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, + +}; + +STDDIPINFO(Speedspn) + +static void bankswitch(INT32 data) +{ + const INT32 offsets[10] = { + 0x30000, 0x1c000, 0x24000, 0x5c000, 0x50000, 0x44000, 0x20000, 0x54000, 0x58000, 0x08000 + }; + + banks[0] = (data > 8) ? 9 : data; + + ZetMapArea(0xc000, 0xffff, 0, DrvZ80ROM0 + offsets[banks[0]]); + ZetMapArea(0xc000, 0xffff, 2, DrvZ80ROM0 + offsets[banks[0]]); +} + +static void vidram_bankswitch(INT32 data) +{ + banks[1] = data & 1; + + ZetMapArea(0x9000, 0x9fff, 0, DrvVidRAM + banks[1] * 0x1000); + ZetMapArea(0x9000, 0x9fff, 1, DrvVidRAM + banks[1] * 0x1000); + ZetMapArea(0x9000, 0x9fff, 2, DrvVidRAM + banks[1] * 0x1000); +} + +static inline void speedspn_palette_write(INT32 offset) +{ + INT32 r = DrvPalRAM[offset + 1] & 0x0f; + INT32 g = DrvPalRAM[offset + 0] >> 4; + INT32 b = DrvPalRAM[offset + 0] & 0x0f; + + offset /= 2; + + DrvPalette[offset] = BurnHighCol((r << 4) | r, (g << 4) | g, (b << 4) | b, 0); + if (DrvPalette[offset] == 0) black_color = offset; +} + +void __fastcall speedspn_main_write(UINT16 address, UINT8 data) +{ + if ((address & 0xf800) == 0x8000) { + address &= 0x7ff; + + if (data != DrvPalRAM[address]) { + DrvPalRAM[address] = data; + + speedspn_palette_write(address & ~1); + } + } +} + +void __fastcall speedspn_main_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x01: + case 0x10: // ? + return; + + case 0x07: + *display_enable = ~data & 1; + return; + + case 0x12: + bankswitch(data); + return; + + case 0x13: + *soundlatch = data; + ZetClose(); + ZetOpen(1); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(0); + return; + + case 0x17: + vidram_bankswitch(data); + return; + } +} + +UINT8 __fastcall speedspn_main_read_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x10: + return DrvInputs[0]; + + case 0x11: + return DrvInputs[1]; + + case 0x12: + return DrvInputs[2]; + + case 0x13: + return DrvDips[0]; + + case 0x14: + return DrvDips[1]; + + case 0x16: + return 0; // irq ack? + } + + return 0; +} + +static void oki_bankswitch(INT32 data) +{ + banks[2] = data & 3; + + MSM6295ROM = DrvSndROM + (banks[2] * 0x40000); + + for (INT32 nChannel = 0; nChannel < 4; nChannel++) { + MSM6295SampleInfo[0][nChannel] = MSM6295ROM + (nChannel << 8); + MSM6295SampleData[0][nChannel] = MSM6295ROM + (nChannel << 16); + } +} + +void __fastcall speedspn_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x9000: + oki_bankswitch(data); + return; + + case 0x9800: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall speedspn_sound_read(UINT16 address) +{ + switch (address) + { + case 0x9800: + return MSM6295ReadStatus(0); + + case 0xa000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + bankswitch(0); + vidram_bankswitch(0); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + oki_bankswitch(1); + MSM6295Reset(0); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x090000; + DrvZ80ROM1 = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x100000; + DrvGfxROM1 = Next; Next += 0x080000; + + DrvSndROM = Next; Next += 0x100000; + + DrvPalette = (UINT32*)Next; Next += 0x400 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x002000; + DrvZ80RAM1 = Next; Next += 0x000800; + + DrvVidRAM = Next; Next += 0x002000; + DrvPalRAM = Next; Next += 0x000800; + DrvAttrRAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + display_enable = Next; Next += 0x000001; + banks = Next; Next += 0x000003; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[4] = { 0x200000, 0x300000, 0x000000, 0x100000 }; + INT32 XOffs0[8] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 }; + INT32 YOffs0[8] = { 0x038, 0x030, 0x028, 0x020, 0x018, 0x010, 0x008, 0x000 }; + + INT32 Plane1[4] = { 0x000004, 0x000000, 0x100004, 0x100000 }; + INT32 XOffs1[16] = { 0x10b, 0x10a, 0x109, 0x108, 0x103, 0x102, 0x101, 0x100, + 0x00b, 0x00a, 0x009, 0x008, 0x003, 0x002, 0x001, 0x000 }; + INT32 YOffs1[16] = { 0x0f0, 0x0e0, 0x0d0, 0x0c0, 0x0b0, 0x0a0, 0x090, 0x080, + 0x070, 0x060, 0x050, 0x040, 0x030, 0x020, 0x010, 0x000 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x80000); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x80000; i++) tmp[i] = DrvGfxROM0[i] ^ 0xff; + + GfxDecode(0x4000, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x040, tmp, DrvGfxROM0); + + for (INT32 i = 0; i < 0x40000; i++) tmp[i] = DrvGfxROM1[i] ^ 0xff; + + GfxDecode(0x0800, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x200, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x000000, 0, 1)) return 1; + memmove (DrvZ80ROM0 + 0x10000, DrvZ80ROM0 + 0x08000, 0x78000); + + if (BurnLoadRom(DrvZ80ROM1 + 0x000000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 1)) return 1; + memcpy (DrvSndROM + 0x000000, DrvGfxROM0 + 0x000000, 0x020000); + memcpy (DrvSndROM + 0x040000, DrvGfxROM0 + 0x000000, 0x020000); + memcpy (DrvSndROM + 0x080000, DrvGfxROM0 + 0x000000, 0x020000); + memcpy (DrvSndROM + 0x0c0000, DrvGfxROM0 + 0x000000, 0x020000); + memcpy (DrvSndROM + 0x020000, DrvGfxROM0 + 0x000000, 0x020000); + memcpy (DrvSndROM + 0x060000, DrvGfxROM0 + 0x020000, 0x020000); + memcpy (DrvSndROM + 0x0a0000, DrvGfxROM0 + 0x040000, 0x020000); + memcpy (DrvSndROM + 0x0e0000, DrvGfxROM0 + 0x060000, 0x020000); + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x020000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x040000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x060000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x020000, 8, 1)) return 1; + + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0x8000, 0x87ff, 0, DrvPalRAM); +// ZetMapArea(0x8000, 0x87ff, 1, DrvPalRAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvPalRAM); + ZetMapArea(0x8800, 0x8fff, 0, DrvAttrRAM); + ZetMapArea(0x8800, 0x8fff, 1, DrvAttrRAM); + ZetMapArea(0x8800, 0x8fff, 2, DrvAttrRAM); + ZetMapArea(0xa000, 0xbfff, 0, DrvZ80RAM0); + ZetMapArea(0xa000, 0xbfff, 1, DrvZ80RAM0); + ZetMapArea(0xa000, 0xbfff, 2, DrvZ80RAM0); + ZetSetWriteHandler(speedspn_main_write); + ZetSetOutHandler(speedspn_main_write_port); + ZetSetInHandler(speedspn_main_read_port); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); + ZetSetWriteHandler(speedspn_sound_write); + ZetSetReadHandler(speedspn_sound_read); + ZetClose(); + + MSM6295Init(0, 1122000 / 132, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + + MSM6295Exit(0); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + return 0; +} + +static void draw_layer() +{ + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = (((offs / 32) << 3) + 192) & 0x1ff; + INT32 sy = (((offs & 0x1f) << 3) - 8) & 0x0ff; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 code = DrvVidRAM[offs * 2 + 1] | ((DrvVidRAM[offs * 2 + 0] & 0x3f) << 8); + INT32 color = DrvAttrRAM[offs ^ 0x400]; + + if (color & 0x80) { + Render8x8Tile_FlipX(pTransDraw, code, sx, sy, color & 0x3f, 4, 0, DrvGfxROM0); + } else { + Render8x8Tile(pTransDraw, code, sx, sy, color & 0x3f, 4, 0, DrvGfxROM0); + } + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0x1000; offs < 0x2000; offs += 4) + { + INT32 sy = DrvVidRAM[offs + 3]; + INT32 attr = DrvVidRAM[offs + 2]; + INT32 code = DrvVidRAM[offs + 1] + ((attr & 0xe0) << 3); + INT32 sx = DrvVidRAM[offs + 0] + ((attr & 0x10) << 4); + + if (attr == 0 && sx != 0) // fix junk on char. select screen + break; + + if (attr == 0 && code == 0) // speedup + continue; + + Render16x16Tile_Mask_Clip(pTransDraw, code, (0x1f8 - sx) - 64, sy - 8, attr & 0x0f, 4, 0x0f, 0, DrvGfxROM1); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x800; i+=2) { + speedspn_palette_write(i); + } + DrvRecalc = 0; + } + + if (*display_enable) + { + draw_layer(); + draw_sprites(); + } + else + { + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = black_color; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= DrvJoy1[i] << i; + DrvInputs[1] ^= DrvJoy2[i] << i; + DrvInputs[2] ^= DrvJoy3[i] << i; + } + } + + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { 6000000 / 60, 6000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nSegment; + + ZetOpen(0); + nSegment = nCyclesTotal[0] / nInterleave; + nCyclesDone[0] += ZetRun(nSegment); + if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + ZetOpen(1); + nCyclesDone[1] += ZetRun(nSegment); + ZetClose(); + } + + if (pBurnSoundOut) { + MSM6295Render(0,pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029707; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + + MSM6295Scan(0, nAction); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + bankswitch(banks[0]); + vidram_bankswitch(banks[1]); + ZetClose(); + + oki_bankswitch(banks[2]); + + DrvRecalc = 1; + } + + return 0; +} + + +// Speed Spin + +static struct BurnRomInfo speedspnRomDesc[] = { + { "tch-ss1.u78", 0x80000, 0x41b6b45b, 1 | BRF_PRG | BRF_ESS }, // 0 Main Z80 Code + + { "tch-ss2.u96", 0x10000, 0x4611fd0c, 2 | BRF_PRG | BRF_ESS }, // 1 Sound Z80 Code + + { "tch-ss3.u95", 0x80000, 0x1c9deb5e, 3 | BRF_SND }, // 2 Samples + + { "tch-ss4.u70", 0x20000, 0x41517859, 4 | BRF_GRA }, // 3 Background Tiles + { "tch-ss5.u69", 0x20000, 0x832b2f34, 4 | BRF_GRA }, // 4 + { "tch-ss6.u60", 0x20000, 0xf1fd7289, 4 | BRF_GRA }, // 5 + { "tch-ss7.u59", 0x20000, 0xc4958543, 4 | BRF_GRA }, // 6 + + { "tch-ss8.u39", 0x20000, 0x2f27b16d, 5 | BRF_GRA }, // 7 Sprites + { "tch-ss9.u34", 0x20000, 0xc372f8ec, 5 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(speedspn) +STD_ROM_FN(speedspn) + +struct BurnDriver BurnDrvSpeedspn = { + "speedspn", NULL, NULL, NULL, "1994", + "Speed Spin\0", NULL, "TCH", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, + NULL, speedspnRomInfo, speedspnRomName, NULL, NULL, SpeedspnInputInfo, SpeedspnDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 384, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_suna16.cpp b/src/burn/drv/pst90s/d_suna16.cpp index e94ed5253..ff128202a 100644 --- a/src/burn/drv/pst90s/d_suna16.cpp +++ b/src/burn/drv/pst90s/d_suna16.cpp @@ -1,2371 +1,2363 @@ -// FB Alpha SunA 16-bit hardware driver module -// Based on MAME driver by Luca Elia - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "burn_ym3526.h" -#include "driver.h" -#include "dac.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvZ80ROM2; -static UINT8 *DrvGfxROM0; -static UINT32 nGfxROM0Len; -static UINT8 *DrvGfxROM1; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvSprRAM0; -static UINT8 *DrvSprRAM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvPalRAM2; -static UINT32 *Palette; -static UINT32 *DrvPalette; - -static INT16 *pFMBuffer; -static INT16 *pAY8910Buffer[3]; -static INT16 *pSoundBuffer; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy3[16]; -static UINT8 DrvJoy4[16]; -static UINT8 DrvJoy5[16]; -static UINT8 DrvJoy6[16]; - -static UINT8 DrvDips[3]; -static UINT8 DrvReset; - -static UINT16 DrvInputs[6]; - -static INT32 game_select = 0; - -static UINT8 soundlatch; -static UINT8 soundlatch2; -static UINT8 soundlatch3; -static UINT8 flipscreen; -static UINT8 color_bank; - -static UINT8 bestofbest_prot = 0; - -static UINT8 z80bankdata[2]; - -static struct BurnInputInfo BestbestInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 15, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 15, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 14, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 3"}, - {"P1 Button 4" , BIT_DIGITAL , DrvJoy1 + 9, "p1 fire 4"}, - {"P1 Button 5" , BIT_DIGITAL , DrvJoy1 + 10, "p1 fire 5"}, - {"P1 Button 6" , BIT_DIGITAL , DrvJoy1 + 11, "p1 fire 6"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 14, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 3"}, - {"P2 Button 4" , BIT_DIGITAL , DrvJoy2 + 9, "p2 fire 4"}, - {"P2 Button 5" , BIT_DIGITAL , DrvJoy2 + 10, "p2 fire 5"}, - {"P2 Button 6" , BIT_DIGITAL , DrvJoy2 + 11, "p2 fire 6"}, - - {"Service" , BIT_DIGITAL , DrvJoy3 + 6, "service" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Bestbest) - -static struct BurnInputInfo UballoonInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 15, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 15, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 14, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 14, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2"}, - - {"Service" , BIT_DIGITAL , DrvJoy1 + 12, "service" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Uballoon) - -static struct BurnInputInfo BssoccerInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy6 + 4, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy6 + 5, "p2 coin" }, - {"Coin 3" , BIT_DIGITAL , DrvJoy6 + 6, "p3 coin" }, - {"Coin 4" , BIT_DIGITAL , DrvJoy6 + 7, "p4 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 7, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 7, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 3"}, - - {"P3 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p3 start" }, - {"P3 Up" , BIT_DIGITAL , DrvJoy3 + 0, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , DrvJoy3 + 1, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , DrvJoy3 + 2, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , DrvJoy3 + 3, "p3 right" }, - {"P3 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p3 fire 1"}, - {"P3 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p3 fire 2"}, - {"P3 Button 3" , BIT_DIGITAL , DrvJoy3 + 6, "p3 fire 3"}, - - {"P4 Start" , BIT_DIGITAL , DrvJoy4 + 7, "p4 start" }, - {"P4 Up" , BIT_DIGITAL , DrvJoy4 + 0, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , DrvJoy4 + 1, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , DrvJoy4 + 2, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , DrvJoy4 + 3, "p4 right" }, - {"P4 Button 1" , BIT_DIGITAL , DrvJoy4 + 4, "p4 fire 1"}, - {"P4 Button 2" , BIT_DIGITAL , DrvJoy4 + 5, "p4 fire 2"}, - {"P4 Button 3" , BIT_DIGITAL , DrvJoy4 + 6, "p4 fire 3"}, - - {"Service" , BIT_DIGITAL , DrvJoy3 + 6, "service" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Bssoccer) - -static struct BurnInputInfo SunaqInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 7, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 7, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 6, "p1 start" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 0, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 1, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 2, "p1 fire 3"}, - {"P1 Button 4" , BIT_DIGITAL , DrvJoy1 + 3, "p1 fire 4"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 6, "p2 start" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 0, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 2, "p2 fire 3"}, - {"P2 Button 4" , BIT_DIGITAL , DrvJoy2 + 3, "p2 fire 4"}, - - {"Service" , BIT_DIGITAL , DrvJoy3 + 6, "service" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Sunaq) - -static struct BurnDIPInfo bestbestDIPList[]= -{ - {0x1a, 0xff, 0xff, 0xff, NULL }, - {0x1b, 0xff, 0xff, 0xff, NULL }, - - {0x1a, 0xfe, 0, 8, "Coinage" }, - {0x1a, 0x01, 0x07, 0x00, "5C 1C" }, - {0x1a, 0x01, 0x07, 0x01, "4C 1C" }, - {0x1a, 0x01, 0x07, 0x02, "3C 1C" }, - {0x1a, 0x01, 0x07, 0x03, "2C 1C" }, - {0x1a, 0x01, 0x07, 0x07, "1C 1C" }, - {0x1a, 0x01, 0x07, 0x06, "1C 2C" }, - {0x1a, 0x01, 0x07, 0x05, "1C 3C" }, - {0x1a, 0x01, 0x07, 0x04, "1C 4C" }, - - {0x1a, 0xfe, 0, 4, "Difficulty" }, - {0x1a, 0x01, 0x18, 0x18, "Easy" }, - {0x1a, 0x01, 0x18, 0x10, "Normal" }, - {0x1a, 0x01, 0x18, 0x08, "Hard" }, - {0x1a, 0x01, 0x18, 0x00, "Hardest" }, - - {0x1a, 0xfe, 0, 2, "Display Combos" }, - {0x1a, 0x01, 0x20, 0x00, "Off" }, - {0x1a, 0x01, 0x20, 0x20, "On" }, - - {0x1a, 0xfe, 0, 2, "Demo Sounds" }, - {0x1a, 0x01, 0x80, 0x80, "Off" }, - {0x1a, 0x01, 0x80, 0x00, "On" }, - - {0x1b, 0xfe, 0, 2, "Flip Screen" }, - {0x1b, 0x01, 0x01, 0x01, "Off" }, - {0x1b, 0x01, 0x01, 0x00, "On" }, - - {0x1b, 0xfe, 0, 4, "Play Time" }, - {0x1b, 0x01, 0x06, 0x06, "1:10" }, - {0x1b, 0x01, 0x06, 0x04, "1:20" }, - {0x1b, 0x01, 0x06, 0x02, "1:30" }, - {0x1b, 0x01, 0x06, 0x00, "1:40" }, -}; - -STDDIPINFO(bestbest) - -static struct BurnDIPInfo bssoccerDIPList[]= -{ - {0x26, 0xff, 0xff, 0xff, NULL }, - {0x27, 0xff, 0xff, 0xff, NULL }, - {0x28, 0xff, 0xff, 0xff, NULL }, - - {0x26, 0xfe, 0, 8, "Coinage" }, - {0x26, 0x01, 0x07, 0x00, "4C 1C" }, - {0x26, 0x01, 0x07, 0x01, "3C 1C" }, - {0x26, 0x01, 0x07, 0x02, "2C 1C" }, - {0x26, 0x01, 0x07, 0x07, "1C 1C" }, - {0x26, 0x01, 0x07, 0x06, "1C 2C" }, - {0x26, 0x01, 0x07, 0x05, "1C 3C" }, - {0x26, 0x01, 0x07, 0x04, "1C 4C" }, - {0x26, 0x01, 0x07, 0x03, "1C 5C" }, - - {0x26, 0xfe, 0, 4, "Difficulty" }, - {0x26, 0x01, 0x18, 0x10, "Easy" }, - {0x26, 0x01, 0x18, 0x18, "Normal" }, - {0x26, 0x01, 0x18, 0x08, "Hard" }, - {0x26, 0x01, 0x18, 0x00, "Hardest?" }, - - {0x26, 0xfe, 0, 2, "Demo Sounds" }, - {0x26, 0x01, 0x20, 0x00, "Off" }, - {0x26, 0x01, 0x20, 0x20, "On" }, - - {0x26, 0xfe, 0, 2, "Flip Screen" }, - {0x26, 0x01, 0x40, 0x40, "Off" }, - {0x26, 0x01, 0x40, 0x00, "On" }, - - {0x27, 0xfe, 0, 4, "Play Time P1" }, - {0x27, 0x01, 0x03, 0x03, "1:30" }, - {0x27, 0x01, 0x03, 0x02, "1:45" }, - {0x27, 0x01, 0x03, 0x01, "2:00" }, - {0x27, 0x01, 0x03, 0x00, "2:15" }, - - {0x27, 0xfe, 0, 4, "Play Time P2" }, - {0x27, 0x01, 0x0c, 0x0c, "1:30" }, - {0x27, 0x01, 0x0c, 0x08, "1:45" }, - {0x27, 0x01, 0x0c, 0x04, "2:00" }, - {0x27, 0x01, 0x0c, 0x00, "2:15" }, - - {0x27, 0xfe, 0, 4, "Play Time P3" }, - {0x27, 0x01, 0x30, 0x30, "1:30" }, - {0x27, 0x01, 0x30, 0x20, "1:45" }, - {0x27, 0x01, 0x30, 0x10, "2:00" }, - {0x27, 0x01, 0x30, 0x00, "2:15" }, - - {0x27, 0xfe, 0, 4, "Play Time P4" }, - {0x27, 0x01, 0xc0, 0xc0, "1:30" }, - {0x27, 0x01, 0xc0, 0x80, "1:45" }, - {0x27, 0x01, 0xc0, 0x40, "2:00" }, - {0x27, 0x01, 0xc0, 0x00, "2:15" }, - - {0x28, 0xfe, 0, 2, "Copyright" }, - {0x28, 0x01, 0x01, 0x01, "Distributer Unico" }, - {0x28, 0x01, 0x01, 0x00, "All Rights Reserved" }, -}; - -STDDIPINFO(bssoccer) - - -static struct BurnDIPInfo sunaqDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xcf, NULL }, - - {0x0e, 0xfe, 0, 8, "Coinage" }, - {0x0e, 0x01, 0x07, 0x00, "5C 1C" }, - {0x0e, 0x01, 0x07, 0x01, "4C 1C" }, - {0x0e, 0x01, 0x07, 0x02, "3C 1C" }, - {0x0e, 0x01, 0x07, 0x03, "2C 1C" }, - {0x0e, 0x01, 0x07, 0x07, "1C 1C" }, - {0x0e, 0x01, 0x07, 0x06, "1C 2C" }, - {0x0e, 0x01, 0x07, 0x05, "1C 3C" }, - {0x0e, 0x01, 0x07, 0x04, "1C 4C" }, - - {0x0e, 0xfe, 0, 4, "Difficulty" }, - {0x0e, 0x01, 0x18, 0x00, "Easy" }, - {0x0e, 0x01, 0x18, 0x08, "Normal" }, - {0x0e, 0x01, 0x18, 0x10, "Hard" }, - {0x0e, 0x01, 0x18, 0x18, "Hardest" }, - - {0x0e, 0xfe, 0, 2, "Demo Sounds" }, - {0x0e, 0x01, 0x20, 0x20, "Off" }, - {0x0e, 0x01, 0x20, 0x00, "On" }, - - {0x0e, 0xfe, 0, 2, "Flip Screen" }, - {0x0e, 0x01, 0x40, 0x40, "Off" }, - {0x0e, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(sunaq) - - -static struct BurnDIPInfo uballoonDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0x12, 0xfe, 0, 2, "Copyright" }, - {0x12, 0x01, 0x30, 0x30, "Distributer Unico" }, - {0x12, 0x01, 0x30, 0x20, "All Rights Reserved" }, -// {0x12, 0x01, 0x30, 0x10, "Distributer Unico" }, -// {0x12, 0x01, 0x30, 0x00, "All Rights Reserved" }, - - {0x13, 0xfe, 0, 8, "Coinage" }, - {0x13, 0x01, 0x07, 0x00, "5C 1C" }, - {0x13, 0x01, 0x07, 0x01, "4C 1C" }, - {0x13, 0x01, 0x07, 0x02, "3C 1C" }, - {0x13, 0x01, 0x07, 0x03, "2C 1C" }, - {0x13, 0x01, 0x07, 0x07, "1C 1C" }, - {0x13, 0x01, 0x07, 0x06, "1C 2C" }, - {0x13, 0x01, 0x07, 0x05, "1C 3C" }, - {0x13, 0x01, 0x07, 0x04, "1C 4C" }, - - {0x13, 0xfe, 0, 4, "Lives" }, - {0x13, 0x01, 0x18, 0x10, "2" }, - {0x13, 0x01, 0x18, 0x18, "3" }, - {0x13, 0x01, 0x18, 0x08, "4" }, - {0x13, 0x01, 0x18, 0x00, "5" }, - - {0x13, 0xfe, 0, 4, "Difficulty" }, - {0x13, 0x01, 0x60, 0x40, "Easy" }, - {0x13, 0x01, 0x60, 0x60, "Normal" }, - {0x13, 0x01, 0x60, 0x20, "Hard" }, - {0x13, 0x01, 0x60, 0x00, "Hardest" }, - - {0x14, 0xfe, 0, 2, "Flip Screen" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0x14, 0xfe, 0, 2, "Cabinet" }, - {0x14, 0x01, 0x02, 0x02, "Upright" }, - {0x14, 0x01, 0x02, 0x00, "Cocktail" }, - - {0x14, 0xfe, 0, 8, "Bonus Life" }, - {0x14, 0x01, 0x1c, 0x1c, "200K" }, - {0x14, 0x01, 0x1c, 0x10, "300K, 1000K" }, - {0x14, 0x01, 0x1c, 0x18, "400K" }, - {0x14, 0x01, 0x1c, 0x0c, "500K, 1500K" }, - {0x14, 0x01, 0x1c, 0x08, "500K, 2000K" }, - {0x14, 0x01, 0x1c, 0x04, "500K, 3000K" }, - {0x14, 0x01, 0x1c, 0x14, "600K" }, - {0x14, 0x01, 0x1c, 0x00, "None" }, - - {0x14, 0xfe, 0, 2, "Demo Sounds" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(uballoon) - - -//------------------------------------------------------------------------------------------------- -// Generic functions - -static void suna_palette_write(INT32 offset) -{ - UINT8 r, b, g; - UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset))); - - r = (data >> 0) & 0x1f; - r = (r << 3) | (r >> 2); - - g = (data >> 5) & 0x1f; - g = (g << 3) | (g >> 2); - - b = (data >> 10) & 0x1f; - b = (b << 3) | (b >> 2); - - Palette[offset>>1] = (r << 16) | (g << 8) | b; - DrvPalette[offset>>1] = BurnHighCol(r, g, b, 0); - - return; -} - -//------------------------------------------------------------------------------------------------- -// Memory handlers - - -//---------------------------------------------------------------- -// Best of Best - - -//------------------ -// 68k - -UINT16 __fastcall bestbest_read_word(UINT32 address) -{ - switch (address & ~1) - { - case 0x500000: - return DrvInputs[0]; - - case 0x500002: - return DrvInputs[1]; - - case 0x500004: - return DrvInputs[2]; - } - - return 0; -} - -UINT8 __fastcall bestbest_read_byte(UINT32 address) -{ - switch (address) - { - case 0x500000: - case 0x500001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x500002: - case 0x500003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x500004: - case 0x500005: - return DrvInputs[2] >> ((~address & 1) << 3); - - case 0x500019: - return bestofbest_prot; - } - - return 0; -} - -void __fastcall bestbest_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfff000) == 0x540000) { - *((UINT16*)(DrvPalRAM + (address & 0x0fff))) = BURN_ENDIAN_SWAP_INT16(data); - suna_palette_write(address & 0xffe); - return; - } - - switch (address & ~1) - { - case 0x500000: - soundlatch = data; - return; - - case 0x500002: - flipscreen = data & 0x10; - return; - } - - return; -} - -void __fastcall bestbest_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfff000) == 0x540000) { - DrvPalRAM[address & 0xfff] = data; - suna_palette_write(address & 0xffe); - return; - } - - switch (address) - { - case 0x500000: - case 0x500001: - soundlatch = data; - return; - - case 0x500002: - case 0x500003: - flipscreen = data & 0x10; - return; - - case 0x500008: - case 0x500009: - switch (data & 0xff) { - case 0x00: bestofbest_prot ^= 0x09; break; - case 0x08: bestofbest_prot ^= 0x02; break; - case 0x0c: bestofbest_prot ^= 0x03; break; - } - return; - } - - return; -} - -//------------------ -// Z80 #0 - -void __fastcall bestbest_sound0_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc000: - case 0xc001: - BurnYM3526Write(address & 1, data); - return; - - case 0xc002: - case 0xc003: - AY8910Write(0, address & 1, data); - return; - - case 0xf000: - soundlatch2 = data; - return; - } - - return; -} - -UINT8 __fastcall bestbest_sound0_read(UINT16 address) -{ - switch (address) - { - case 0xf800: - return soundlatch; - } - - return 0; -} - -//------------------ -// Z80 #1 - -void __fastcall bestbest_sound1_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: { DACWrite(0, (data & 0xf) * 0x11); return; } - case 0x01: { DACWrite(1, (data & 0xf) * 0x11); return; } - - case 0x02: { DACWrite(2, (data & 0xf) * 0x11); return; } - case 0x03: { DACWrite(3, (data & 0xf) * 0x11); return; } - } - - return; -} - -UINT8 __fastcall bestbest_sound1_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return soundlatch2; - } - - return 0; -} - - -//---------------------------------------------------------------- -// SunA Quiz - - -//------------------ -// 68k - -UINT16 __fastcall sunaq_read_word(UINT32 address) -{ - if ((address & 0xfff000) == 0x540000) { - if (address & 0x200) { - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM2 + (address & 0xffe)))); - } else { - address += color_bank << 9; - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + (address & 0xffe)))); - } - } - - switch (address & ~1) - { - case 0x500000: - return DrvInputs[0]; - - case 0x500002: - return DrvInputs[1]; - - case 0x500004: - return DrvInputs[2]; - - case 0x500006: - return DrvInputs[3]; - } - - return 0; -} - -UINT8 __fastcall sunaq_read_byte(UINT32 address) -{ - if ((address & 0xfff000) == 0x540000) { - if (address & 0x200) { - return DrvPalRAM2[address & 0xffe]; - } else { - address += color_bank << 9; - return DrvPalRAM[address & 0xffe]; - } - } - - switch (address) - { - case 0x500000: - case 0x500001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x500002: - case 0x500003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x500004: - case 0x500005: - return DrvInputs[2] >> ((~address & 1) << 3); - - case 0x500006: - case 0x500007: - return DrvInputs[3] >> ((~address & 1) << 3); - } - - return 0; -} - -void __fastcall sunaq_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfff000) == 0x540000) { - if (address & 0x200) { - *((UINT16*)(DrvPalRAM2 + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); - } else { - address += color_bank << 9; - *((UINT16*)(DrvPalRAM + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); - suna_palette_write(address & 0xffff); - } - return; - } - - switch (address & ~1) - { - case 0x500000: - soundlatch = data; - return; - - case 0x500002: - flipscreen = data & 0x01; - color_bank = (data >> 2) & 1; - return; - - case 0x500004: - // coin counter - return; - } - return; -} - -void __fastcall sunaq_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfff000) == 0x540000) { - if (address & 0x200) { - DrvPalRAM2[address & 0xfff] = data; - } else { - address += color_bank << 9; - DrvPalRAM[address & 0xfff] = data; - suna_palette_write(address & 0xffe); - } - - return; - } - - switch (address) - { - case 0x500000: - case 0x500001: - soundlatch = data; - return; - - case 0x500002: - case 0x500003: - flipscreen = data & 0x01; - color_bank = (data >> 2) & 1; - return; - - case 0x500004: - case 0x500005: - // coin counter - return; - } - return; -} - -//------------------ -// Z80 #0 - -void __fastcall sunaq_sound0_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf800: - BurnYM2151SelectRegister(data); - return; - - case 0xf801: - BurnYM2151WriteRegister(data); - return; - - case 0xfc00: - soundlatch2 = data; - return; - } - - return; -} - - -//---------------------------------------------------------------- -// Ultra Balloon - - -//------------------ -// 68k - -UINT16 __fastcall uballoon_read_word(UINT32 address) -{ - if ((address & 0xfff000) == 0x200000) { - if (address & 0x200) { - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM2 + (address & 0xffe)))); - } else { - address += color_bank << 9; - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + (address & 0xffe)))); - } - } - - switch (address & ~1) - { - case 0x600000: - return DrvInputs[0]; - - case 0x600002: - return DrvInputs[1]; - - case 0x600004: - return DrvInputs[2]; - - case 0x600006: - return DrvInputs[3]; - } - - return 0; -} - -UINT8 __fastcall uballoon_read_byte(UINT32 address) -{ - if ((address & 0xfff000) == 0x200000) { - if (address & 0x200) { - return DrvPalRAM2[address & 0xffe]; - } else { - address += color_bank << 9; - return DrvPalRAM[address & 0xffe]; - } - } - - switch (address) - { - case 0x600000: - case 0x600001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x600002: - case 0x600003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x600004: - case 0x600005: - return DrvInputs[2] >> ((~address & 1) << 3); - - case 0x600006: - case 0x600007: - return DrvInputs[3] >> ((~address & 1) << 3); - } - - return 0; -} - -void __fastcall uballoon_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfff000) == 0x200000) { - if (address & 0x200) { - *((UINT16*)(DrvPalRAM2 + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); - } else { - address += color_bank << 9; - *((UINT16*)(DrvPalRAM + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); - suna_palette_write(address & 0xffff); - } - return; - } - - switch (address & ~1) - { - case 0x600000: - soundlatch = data; - return; - - case 0x600004: - flipscreen = data & 0x01; - color_bank = (data >> 2) & 1; - return; - } - return; -} - -void __fastcall uballoon_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfff000) == 0x200000) { - if (address & 0x200) { - DrvPalRAM2[address & 0xfff] = data; - } else { - address += color_bank << 9; - DrvPalRAM[address & 0xfff] = data; - suna_palette_write(address & 0xffe); - } - return; - } - - switch (address) - { - case 0x600000: - case 0x600001: - soundlatch = data; - return; - - case 0x600004: - case 0x600005: - flipscreen = data & 0x01; - color_bank = (data >> 2) & 1; - return; - } - return; -} - -//------------------ -// Z80 #1 - -static void uballoon_bankswitch(INT32 data) -{ - z80bankdata[0] = data; - - INT32 bank = ((data & 1) << 16) | 0x400; - - ZetMapArea(0x0400, 0xffff, 0, DrvZ80ROM1 + bank); - ZetMapArea(0x0400, 0xffff, 2, DrvZ80ROM1 + bank); -} - -void __fastcall uballoon_sound1_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: { DACWrite(0, (data & 0xf) * 0x11); return; } - case 0x01: { DACWrite(1, (data & 0xf) * 0x11); return; } - - case 0x03: - uballoon_bankswitch(data); - return; - } - - return; -} - -UINT8 __fastcall uballoon_sound1_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return soundlatch2; - } - - return 0; -} - - -//---------------------------------------------------------------- -// Back Street Soccer - - -//------------------ -// 68k - -UINT16 __fastcall bssoccer_read_word(UINT32 address) -{ - if ((address & 0xfff000) == 0x400000) { - if (address & 0x200) { - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM2 + (address & 0xffe)))); - } else { - address += color_bank << 9; - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + (address & 0xffe)))); - } - } - - switch (address & ~1) - { - case 0xa00000: - return DrvInputs[0]; - - case 0xa00002: - return DrvInputs[1]; - - case 0xa00004: - return DrvInputs[2]; - - case 0xa00006: - return DrvInputs[3]; - - case 0xa00008: - return DrvInputs[4]; - - case 0xa0000a: - return DrvInputs[5]; - - } - - return 0; -} - -UINT8 __fastcall bssoccer_read_byte(UINT32 address) -{ - if ((address & 0xfff000) == 0x400000) { - if (address & 0x200) { - return DrvPalRAM2[address & 0xffe]; - } else { - address += color_bank << 9; - return DrvPalRAM[address & 0xffe]; - } - } - - switch (address) - { - case 0xa00000: - case 0xa00001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0xa00002: - case 0xa00003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0xa00004: - case 0xa00005: - return DrvInputs[2] >> ((~address & 1) << 3); - - case 0xa00006: - case 0xa00007: - return DrvInputs[3] >> ((~address & 1) << 3); - - case 0xa00008: - case 0xa00009: - return DrvInputs[4] >> ((~address & 1) << 3); - - case 0xa0000a: - case 0xa0000b: - return DrvInputs[5] >> ((~address & 1) << 3); - } - - return 0; -} - -void __fastcall bssoccer_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfff000) == 0x400000) { - if (address & 0x200) { - *((UINT16*)(DrvPalRAM2 + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); - } else { - address += color_bank << 9; - *((UINT16*)(DrvPalRAM + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); - suna_palette_write(address & 0xffff); - } - return; - } - - switch (address & ~1) - { - case 0xa00000: - soundlatch = data; - return; - - case 0xa00002: - flipscreen = data & 0x01; - color_bank = (data >> 2) & 1; - return; - } - return; -} - -void __fastcall bssoccer_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfff000) == 0x400000) { - if (address & 0x200) { - DrvPalRAM[address & 0xfff] = data; - } else { - address += color_bank << 9; - DrvPalRAM[address & 0xfff] = data; - suna_palette_write(address & 0xffe); - } - return; - } - - switch (address) - { - case 0xa00000: - case 0xa00001: - soundlatch = data; - return; - - case 0xa00002: - case 0xa00003: - flipscreen = data & 0x01; - color_bank = (data >> 2) & 1; - return; - } - return; -} - -//------------------ -// Z80 #0 - -static void bssoccer_bankswitch_w(UINT8 *z80data, INT32 p, INT32 data) -{ - z80bankdata[p] = data; - - INT32 bank = ((data & 7) << 16) | 0x1000; - - ZetMapArea(0x1000, 0xffff, 0, z80data + bank); - ZetMapArea(0x1000, 0xffff, 2, z80data + bank); -} - -void __fastcall bssoccer_sound0_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf800: - BurnYM2151SelectRegister(data); - return; - - case 0xf801: - BurnYM2151WriteRegister(data); - return; - - case 0xfd00: - soundlatch2 = data; - return; - - case 0xfe00: - soundlatch3 = data; - return; - } - - return; -} - -UINT8 __fastcall bssoccer_sound0_read(UINT16 address) -{ - switch (address) - { - case 0xf801: - return BurnYM2151ReadStatus(); - - case 0xfc00: - return soundlatch; - } - - return 0; -} - -//------------------ -// Z80 #1 - -void __fastcall bssoccer_sound1_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: { DACWrite(0, (data & 0xf) * 0x11); return; } - case 0x01: { DACWrite(1, (data & 0xf) * 0x11); return; } - - case 0x03: - bssoccer_bankswitch_w(DrvZ80ROM1, 0, data); - return; - } - - return; -} - -UINT8 __fastcall bssoccer_sound1_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return soundlatch2; - } - - return 0; -} - -//------------------ -// Z80 #2 - -void __fastcall bssoccer_sound2_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: { DACWrite(2, (data & 0xf) * 0x11); return; } - case 0x01: { DACWrite(3, (data & 0xf) * 0x11); return; } - return; - - case 0x03: - bssoccer_bankswitch_w(DrvZ80ROM2, 1, data); - return; - } - - return; -} - -UINT8 __fastcall bssoccer_sound2_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return soundlatch3; - } - - return 0; -} - - -//------------------------------------------------------------------------------------------------- -// Initialization routines - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - for (INT32 j = 0; j < 2; j++) { - ZetOpen(j); - ZetReset(); - ZetClose(); - } - - if (game_select == 3) { - ZetOpen(2); - ZetReset(); - ZetClose(); - } - - soundlatch = 0; - soundlatch2 = 0; - soundlatch3 = 0; - color_bank = 0; - bestofbest_prot = 0; - flipscreen = 0; - - z80bankdata[0] = z80bankdata[1] = 0; - - if (game_select == 3) { - ZetOpen(1); - bssoccer_bankswitch_w(DrvZ80ROM1, 0, z80bankdata[0]); - ZetClose(); - ZetOpen(2); - bssoccer_bankswitch_w(DrvZ80ROM2, 1, z80bankdata[1]); - ZetClose(); - } - - if (game_select == 2) { - ZetOpen(1); - uballoon_bankswitch(z80bankdata[0]); - ZetClose(); - } - - if (game_select == 1) { - ZetOpen(1); - bssoccer_bankswitch_w(DrvZ80ROM1, 0, z80bankdata[0]); - ZetClose(); - } - - if (game_select) { - BurnYM2151Reset(); - } else { - BurnYM3526Reset(); - AY8910Reset(0); - } - - DACReset(); - - return 0; -} - - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x0200000; - DrvZ80ROM0 = Next; Next += 0x0010000; - DrvZ80ROM1 = Next; Next += 0x0080000; - DrvZ80ROM2 = Next; Next += 0x0080000; - - DrvGfxROM0 = Next; Next += 0x0600000; - if (game_select == 0) { - DrvGfxROM1 = Next; Next += 0x0800000; - } - - DrvPalette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); - - pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 3 * sizeof(INT16); - pSoundBuffer = (INT16*)Next; Next += nBurnSoundLen * 2 * sizeof(INT16); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x0010000; - -// DrvZ80RAM0 = Next; Next += 0x0000800; - DrvZ80RAM0 = Next; Next += 0x0001000; - - DrvSprRAM0 = Next; Next += 0x0020000; - DrvSprRAM1 = Next; Next += 0x0020000; - - DrvPalRAM = Next; Next += 0x0001000; - DrvPalRAM2 = Next; Next += 0x0010000; - - Palette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode(UINT8 *gfx_base, INT32 len) -{ - INT32 Plane[4] = {(len << 2) + 0, (len << 2) + 4, 0, 4 }; - INT32 XOffs[8] = { 3, 2, 1, 0, 11, 10, 9, 8 }; - INT32 YOffs[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(len); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < len; i++) tmp[i] = gfx_base[i] ^ 0xff; // copy & invert - - GfxDecode(((len * 8) / 4) / 64, 4, 8, 8, Plane, XOffs, YOffs, 0x80, tmp, gfx_base); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvLoadRoms() -{ - char* pRomName; - struct BurnRomInfo ri; - - UINT8 *Load68K = Drv68KROM; - UINT8 *Loadz0 = DrvZ80ROM0; - UINT8 *Loadz1 = DrvZ80ROM1; - UINT8 *Loadz2 = DrvZ80ROM2; - UINT8 *Loadg0 = DrvGfxROM0; - UINT8 *Loadg1 = DrvGfxROM1; - - INT32 gfx0_len = 0; - INT32 gfx1_len = 0; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & 7) == 1) { - - if (BurnLoadRom(Load68K + 1, i + 0, 2)) return 1; - if (BurnLoadRom(Load68K + 0, i + 1, 2)) return 1; - - Load68K += 0x100000; - - i++; - - continue; - } - - if ((ri.nType & 7) == 2) { - if (BurnLoadRom(Loadz0, i, 1)) return 1; - continue; - } - - if ((ri.nType & 7) == 3) { - if (BurnLoadRom(Loadz1, i, 1)) return 1; - continue; - } - - if ((ri.nType & 7) == 4) { - if (BurnLoadRom(Loadz2, i, 1)) return 1; - continue; - } - - if ((ri.nType & 7) == 5) { - if (BurnLoadRom(Loadg0, i, 1)) return 1; - - Loadg0 += ri.nLen; - gfx0_len += ri.nLen; - - continue; - } - - if ((ri.nType & 7) == 6) { - if (BurnLoadRom(Loadg1, i, 1)) return 1; - - Loadg1 += ri.nLen; - gfx1_len += ri.nLen; - - continue; - } - } - - nGfxROM0Len = gfx0_len >> 5; - - if (gfx0_len) DrvGfxDecode(DrvGfxROM0, gfx0_len); - if (gfx1_len) DrvGfxDecode(DrvGfxROM1, gfx1_len); - - return 0; -} - -void bestbest_ay8910_write_a(UINT32,UINT32) -{ -} - -static void bestbestFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 bestbestSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 6000000; -} - -static INT32 bestbestSyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (6000000.0000 / (nBurnFPS / 100.0000)))); -} - -static INT32 bssoccerSyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (5000000.0000 / (nBurnFPS / 100.0000)))); -} - -static INT32 BestbestInit() -{ - INT32 nLen; - - game_select = 0; - - AllMem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - for (INT32 i = 0; i < 3; i++) { - pAY8910Buffer[i] = pFMBuffer + nBurnSoundLen * i; - } - - if (DrvLoadRoms()) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KROM, 0x040000, 0x07ffff, SM_ROM); - SekMapMemory(Drv68KROM, 0x080000, 0x0bffff, SM_ROM); - SekMapMemory(Drv68KROM, 0x0c0000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KROM + 0x100000, 0x200000, 0x2fffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x540000, 0x540fff, SM_ROM); - SekMapMemory(DrvPalRAM2, 0x541000, 0x54ffff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x580000, 0x58ffff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0x5c0000, 0x5dffff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0x5e0000, 0x5fffff, SM_RAM); - SekSetWriteByteHandler(0, bestbest_write_byte); - SekSetWriteWordHandler(0, bestbest_write_word); - SekSetReadByteHandler(0, bestbest_read_byte); - SekSetReadWordHandler(0, bestbest_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); - ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM0); - ZetSetReadHandler(bestbest_sound0_read); - ZetSetWriteHandler(bestbest_sound0_write); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0xffff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0xffff, 2, DrvZ80ROM1); - ZetSetInHandler(bestbest_sound1_in); - ZetSetOutHandler(bestbest_sound1_out); - ZetClose(); - - BurnYM3526Init(3000000, &bestbestFMIRQHandler, &bestbestSynchroniseStream, 0); - BurnTimerAttachZetYM3526(6000000); - BurnYM3526SetRoute(BURN_SND_YM3526_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, bestbest_ay8910_write_a, NULL); - AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_3, 0.00, BURN_SND_ROUTE_BOTH); // suppressed? - - DACInit(0, 0, 1, bestbestSyncDAC); - DACInit(1, 0, 1, bestbestSyncDAC); - DACInit(2, 0, 1, bestbestSyncDAC); - DACInit(3, 0, 1, bestbestSyncDAC); - DACSetRoute(0, 0.40, BURN_SND_ROUTE_LEFT); - DACSetRoute(1, 0.40, BURN_SND_ROUTE_RIGHT); - DACSetRoute(2, 0.40, BURN_SND_ROUTE_LEFT); - DACSetRoute(3, 0.40, BURN_SND_ROUTE_RIGHT); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - -static INT32 SunaqInit() -{ - INT32 nLen; - - game_select = 1; - - AllMem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (DrvLoadRoms()) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(DrvPalRAM2, 0x540400, 0x540fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x580000, 0x583fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0x5c0000, 0x5dffff, SM_RAM); - SekSetWriteByteHandler(0, sunaq_write_byte); - SekSetWriteWordHandler(0, sunaq_write_word); - SekSetReadByteHandler(0, sunaq_read_byte); - SekSetReadWordHandler(0, sunaq_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM0); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM0); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM0); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM0); - ZetSetWriteHandler(sunaq_sound0_write); - ZetSetReadHandler(bssoccer_sound0_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM1); - ZetMapArea(0x1000, 0xffff, 0, DrvZ80ROM1 + 0x1000); - ZetMapArea(0x1000, 0xffff, 2, DrvZ80ROM1 + 0x1000); - ZetSetInHandler(bssoccer_sound1_in); - ZetSetOutHandler(bssoccer_sound1_out); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - - DACInit(0, 0, 2, bestbestSyncDAC); - DACInit(1, 0, 2, bestbestSyncDAC); - DACSetRoute(0, 0.50, BURN_SND_ROUTE_LEFT); - DACSetRoute(1, 0.50, BURN_SND_ROUTE_RIGHT); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - - -static INT32 UballoonInit() -{ - INT32 nLen; - - game_select = 2; - - AllMem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (DrvLoadRoms()) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(DrvPalRAM2, 0x200400, 0x200fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0x400000, 0x41ffff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0x5c0000, 0x5dffff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x800000, 0x803fff, SM_RAM); - SekSetWriteByteHandler(0, uballoon_write_byte); - SekSetWriteWordHandler(0, uballoon_write_word); - SekSetReadByteHandler(0, uballoon_read_byte); - SekSetReadWordHandler(0, uballoon_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM0); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM0); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM0); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM0); - ZetSetWriteHandler(sunaq_sound0_write); - ZetSetReadHandler(bssoccer_sound0_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x03ff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x03ff, 2, DrvZ80ROM1); - ZetMapArea(0x0400, 0xffff, 0, DrvZ80ROM1 + 0x400); - ZetMapArea(0x0400, 0xffff, 2, DrvZ80ROM1 + 0x400); - ZetSetInHandler(uballoon_sound1_in); - ZetSetOutHandler(uballoon_sound1_out); - ZetMemEnd(); - ZetClose(); - - // Patch out the protection checks - *((UINT16*)(Drv68KROM + 0x0113c)) = BURN_ENDIAN_SWAP_INT16(0x4e71); - *((UINT16*)(Drv68KROM + 0x0113e)) = BURN_ENDIAN_SWAP_INT16(0x4e71); - *((UINT16*)(Drv68KROM + 0x01784)) = BURN_ENDIAN_SWAP_INT16(0x600c); - *((UINT16*)(Drv68KROM + 0x018e2)) = BURN_ENDIAN_SWAP_INT16(0x600c); - *((UINT16*)(Drv68KROM + 0x03c54)) = BURN_ENDIAN_SWAP_INT16(0x600c); - *((UINT16*)(Drv68KROM + 0x126a0)) = BURN_ENDIAN_SWAP_INT16(0x4e71); - - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); - - DACInit(0, 0, 1, bssoccerSyncDAC); - DACInit(1, 0, 1, bssoccerSyncDAC); - DACSetRoute(0, 0.50, BURN_SND_ROUTE_LEFT); - DACSetRoute(1, 0.50, BURN_SND_ROUTE_RIGHT); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 BssoccerInit() -{ - INT32 nLen; - - game_select = 3; - - AllMem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (DrvLoadRoms()) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x203fff, SM_RAM); - SekMapMemory(DrvPalRAM2, 0x400400, 0x400fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0x600000, 0x61ffff, SM_RAM); - SekSetWriteByteHandler(0, bssoccer_write_byte); - SekSetWriteWordHandler(0, bssoccer_write_word); - SekSetReadByteHandler(0, bssoccer_read_byte); - SekSetReadWordHandler(0, bssoccer_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM0); - ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM0); - ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM0); - ZetSetWriteHandler(bssoccer_sound0_write); - ZetSetReadHandler(bssoccer_sound0_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM1); - ZetMapArea(0x1000, 0xffff, 0, DrvZ80ROM1 + 0x1000); - ZetMapArea(0x1000, 0xffff, 2, DrvZ80ROM1 + 0x1000); - ZetSetInHandler(bssoccer_sound1_in); - ZetSetOutHandler(bssoccer_sound1_out); - ZetMemEnd(); - ZetClose(); - - ZetInit(2); - ZetOpen(2); - ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM2); - ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM2); - ZetMapArea(0x1000, 0xffff, 0, DrvZ80ROM2 + 0x1000); - ZetMapArea(0x1000, 0xffff, 2, DrvZ80ROM2 + 0x1000); - ZetSetInHandler(bssoccer_sound2_in); - ZetSetOutHandler(bssoccer_sound2_out); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(3579545); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.20, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.20, BURN_SND_ROUTE_RIGHT); - - DACInit(0, 0, 1, bssoccerSyncDAC); - DACInit(1, 0, 1, bssoccerSyncDAC); - DACInit(2, 0, 1, bssoccerSyncDAC); - DACInit(3, 0, 1, bssoccerSyncDAC); - DACSetRoute(0, 0.40, BURN_SND_ROUTE_LEFT); - DACSetRoute(1, 0.40, BURN_SND_ROUTE_RIGHT); - DACSetRoute(2, 0.40, BURN_SND_ROUTE_LEFT); - DACSetRoute(3, 0.40, BURN_SND_ROUTE_RIGHT); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - BurnFree (AllMem); - - if (game_select) { - BurnYM2151Exit(); - } else { - AY8910Exit(0); - BurnYM3526Exit(); - } - - DACExit(); - - SekExit(); - ZetExit(); - - GenericTilesExit(); - - return 0; -} - - -//------------------------------------------------------------------------------------------------- -// Drawing & CPU/sound emulation routines - - -static void draw_sprites(UINT16 *sprites, UINT8 *gfx_base, INT32 max_tile) -{ - INT32 offs; - - INT32 max_x = (256 - 0) - 8; - INT32 max_y = (256 - 0) - 8; - - for (offs = 0xfc00/2; offs < 0x10000/2 ; offs += 4/2) - { - INT32 srcpg, srcx,srcy, dimx,dimy; - INT32 tile_x, tile_xinc, tile_xstart; - INT32 tile_y, tile_yinc; - INT32 dx, dy; - INT32 flipx, y0; - - INT32 y = BURN_ENDIAN_SWAP_INT16(sprites[ offs + 0 + 0x00000 / 2 ]); - INT32 x = BURN_ENDIAN_SWAP_INT16(sprites[ offs + 1 + 0x00000 / 2 ]); - INT32 dim = BURN_ENDIAN_SWAP_INT16(sprites[ offs + 0 + 0x10000 / 2 ]); - - INT32 bank = (x >> 12) & 0xf; - - srcpg = ((y & 0xf000) >> 12) + ((x & 0x0200) >> 5); - srcx = ((y >> 8) & 0xf) * 2; - srcy = ((dim >> 0) & 0xf) * 2; - - switch ( (dim >> 4) & 0xc ) - { - case 0x0: dimx = 2; dimy = 2; y0 = 0x100; break; - case 0x4: dimx = 4; dimy = 4; y0 = 0x100; break; - case 0x8: dimx = 2; dimy = 32; y0 = 0x130; break; - default: - case 0xc: dimx = 4; dimy = 32; y0 = 0x120; break; - } - - if (dimx==4) { flipx = srcx & 2; srcx &= ~2; } - else { flipx = 0; } - - x = (x & 0xff) - (x & 0x100); - y = (y0 - (y & 0xff) - dimy*8 ) & 0xff; - - if (flipx) { tile_xstart = dimx-1; tile_xinc = -1; } - else { tile_xstart = 0; tile_xinc = +1; } - - tile_y = 0; tile_yinc = +1; - - for (dy = 0; dy < dimy * 8; dy += 8) - { - tile_x = tile_xstart; - - for (dx = 0; dx < dimx * 8; dx += 8) - { - INT32 addr = (srcpg * 0x20 * 0x20) + - ((srcx + tile_x) & 0x1f) * 0x20 + - ((srcy + tile_y) & 0x1f); - - INT32 tile = BURN_ENDIAN_SWAP_INT16(sprites[ addr + 0x00000 / 2 ]); - INT32 color = BURN_ENDIAN_SWAP_INT16(sprites[ addr + 0x10000 / 2 ]); - - INT32 sx = x + dx; - INT32 sy = (y + dy) & 0xff; - - INT32 tile_flipx = tile & 0x4000; - INT32 tile_flipy = tile & 0x8000; - - if (flipx) tile_flipx ^= 0x4000; - - if (flipscreen) - { - sx = max_x - sx; - sy = max_y - sy; - tile_flipx ^= 0x4000; - tile_flipy ^= 0x8000; - } - - tile = (tile & 0x3fff) | (bank << 14); - color += (color_bank << 4); - color &= 0x7f; - tile %= max_tile; - - sy -= 16; - - tile_x += tile_xinc; - - if (sy < -15 || sy > (nScreenHeight - 1) || sx < -15 || sx > (nScreenWidth - 1)) { - continue; - } - - if (tile_flipy) { - if (tile_flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, tile, sx, sy, color, 4, 0x0f, 0, gfx_base); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, tile, sx, sy, color, 4, 0x0f, 0, gfx_base); - } - } else { - if (tile_flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, tile, sx, sy, color, 4, 0x0f, 0, gfx_base); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, tile, sx, sy, color, 4, 0x0f, 0, gfx_base); - } - } - } - - tile_y += tile_yinc; - } - - } - -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x1000; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0xff; - } - - draw_sprites((UINT16*)DrvSprRAM0, DrvGfxROM0, nGfxROM0Len); - if (!game_select) { - draw_sprites((UINT16*)DrvSprRAM1, DrvGfxROM1, 0x20000); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static inline void AssembleInputs() -{ - memset (DrvInputs, 0xff, 6 * sizeof(UINT16)); - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= DrvJoy1[i] << i; - DrvInputs[1] ^= DrvJoy2[i] << i; - DrvInputs[2] ^= DrvJoy3[i] << i; - DrvInputs[3] ^= DrvJoy4[i] << i; - DrvInputs[4] ^= DrvJoy5[i] << i; - DrvInputs[5] ^= DrvJoy6[i] << i; - } - - switch (game_select) - { - case 0: // bestbest - { - DrvInputs[2] = (DrvDips[1] << 8) | DrvDips[0]; - } - return; - - case 1: // sunaq - { - DrvInputs[2] = DrvDips[0]; - } - return; - - case 2: // uballoon - { - DrvInputs[1] = (DrvInputs[1] & 0xff) | (DrvDips[0] << 8); - DrvInputs[2] = DrvDips[1]; - DrvInputs[3] = DrvDips[2]; - } - return; - - case 3: // bssoccer - { - DrvInputs[4] = (DrvDips[1] << 8) | DrvDips[0]; - DrvInputs[5] = ((DrvInputs[5] & 0xfe) | (DrvDips[2] & 0x01)) | 0xff00; - } - return; - } - - return; -} - -static INT32 BestbestFrame() -{ - INT32 nCyclesTotal[3]; - - INT32 nInterleave = 50; - INT32 nSoundBufferPos = 0; - - if (DrvReset) { - DrvDoReset(); - } - - AssembleInputs(); - - nCyclesTotal[0] = 6000000 / 60; - nCyclesTotal[1] = 6000000 / 60; - nCyclesTotal[2] = 6000000 / 60; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - - SekRun(nCyclesTotal[0] / nInterleave); - if (i == (nInterleave / 2)-1) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - if (i == (nInterleave )-1) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - - ZetOpen(0); - BurnTimerUpdateYM3526(i * (nCyclesTotal[1] / nInterleave)); - ZetClose(); - - ZetOpen(1); - ZetRun(nCyclesTotal[2] / nInterleave); - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pSoundBuffer + (nSoundBufferPos << 1); - - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - - nSoundBufferPos += nSegmentLength; - } - } - SekClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pSoundBuffer + (nSoundBufferPos << 1); - - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - - ZetOpen(0); - BurnTimerEndFrameYM3526(nCyclesTotal[1]); - if (pBurnSoundOut) { - BurnYM3526Update(pBurnSoundOut, nBurnSoundLen); - for (INT32 i = 0; i < nBurnSoundLen; i++) { - pBurnSoundOut[(i << 1) + 0] += pSoundBuffer[(i << 1) + 0]; - pBurnSoundOut[(i << 1) + 1] += pSoundBuffer[(i << 1) + 1]; - } - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 SunaqFrame() -{ - INT32 nInterleave = 50; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[3]; - - if (DrvReset) { - DrvDoReset(); - } - - AssembleInputs(); - - nCyclesTotal[0] = 6000000 / 60; - nCyclesTotal[1] = 3579500 / 60; - nCyclesTotal[2] = 6000000 / 60; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - SekRun(nCyclesTotal[0] / nInterleave); - if (i == (nInterleave )-1) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - for (INT32 j = 0; j < 2; j++) { - ZetOpen(j); - ZetRun(nCyclesTotal[j+1] / nInterleave); - ZetClose(); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - - nSoundBufferPos += nSegmentLength; - } - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 UballoonFrame() -{ - INT32 nInterleave = 50; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[3]; - - if (DrvReset) { - DrvDoReset(); - } - - AssembleInputs(); - - nCyclesTotal[0] = 8000000 / 60; - nCyclesTotal[1] = 3579500 / 60; - nCyclesTotal[2] = 5000000 / 60; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - SekRun(nCyclesTotal[0] / nInterleave); - if (i == (nInterleave )-1) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - for (INT32 j = 0; j < 2; j++) { - ZetOpen(j); - ZetRun(nCyclesTotal[j+1] / nInterleave); - ZetClose(); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - -static INT32 BssoccerFrame() -{ - INT32 nInterleave = 50; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[4]; - - if (DrvReset) { - DrvDoReset(); - } - - AssembleInputs(); - - nCyclesTotal[0] = 8000000 / 60; - nCyclesTotal[1] = 3579500 / 60; - nCyclesTotal[2] = 5000000 / 60; - nCyclesTotal[3] = 5000000 / 60; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - SekRun(nCyclesTotal[0] / nInterleave); - if (i == (nInterleave / 2)-1) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - if (i == (nInterleave )-1) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - for (INT32 j = 0; j < 3; j++) { - ZetOpen(j); - ZetRun(nCyclesTotal[j+1] / nInterleave); - ZetClose(); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029692; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - DACScan(nAction, pnMin); - - if (game_select) { - BurnYM2151Scan(nAction); - } else { - AY8910Scan(nAction, pnMin); - } - - SCAN_VAR(soundlatch); - SCAN_VAR(soundlatch2); - SCAN_VAR(soundlatch3); - SCAN_VAR(flipscreen); - SCAN_VAR(color_bank); - SCAN_VAR(bestofbest_prot); - - SCAN_VAR(z80bankdata[0]); - SCAN_VAR(z80bankdata[1]); - } - - if (game_select == 3) { - ZetOpen(1); - bssoccer_bankswitch_w(DrvZ80ROM1, 0, z80bankdata[0]); - ZetClose(); - ZetOpen(2); - bssoccer_bankswitch_w(DrvZ80ROM2, 1, z80bankdata[1]); - ZetClose(); - } - - if (game_select == 2) { - ZetOpen(1); - uballoon_bankswitch(z80bankdata[0]); - ZetClose(); - } - - return 0; -} - - - -//------------------------------------------------------------------------------------------------- -// Drivers - - -// Best Of Best - -static struct BurnRomInfo bestbestRomDesc[] = { - { "4.bin", 0x20000, 0x06741994, 1 | BRF_ESS | BRF_PRG }, // 0 - 68K Code - { "2.bin", 0x20000, 0x42843dec, 1 | BRF_ESS | BRF_PRG }, // 1 - { "3.bin", 0x80000, 0xe2bb8f26, 1 | BRF_ESS | BRF_PRG }, // 2 - { "1.bin", 0x80000, 0xd365e20a, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "5.bin", 0x10000, 0xbb9265e6, 2 | BRF_ESS | BRF_PRG }, // 4 - Z80 #0 Code - - { "6.bin", 0x10000, 0xdd445f6b, 3 | BRF_ESS | BRF_PRG }, // 5 - Z80 #1 Code - - { "9.bin", 0x80000, 0xb11994ea, 5 | BRF_GRA }, // 6 - Sprites (Chip 0) - { "10.bin", 0x80000, 0x37b41ef5, 5 | BRF_GRA }, // 7 - { "7.bin", 0x80000, 0x16188b73, 5 | BRF_GRA }, // 8 - { "8.bin", 0x80000, 0x765ce06b, 5 | BRF_GRA }, // 9 - - { "16.bin", 0x80000, 0xdc46cdea, 6 | BRF_GRA }, // 10 - Sprites (Chip 1) - { "17.bin", 0x80000, 0xc6fadd57, 6 | BRF_GRA }, // 11 - { "13.bin", 0x80000, 0x23283ac4, 6 | BRF_GRA }, // 12 - { "18.bin", 0x80000, 0x674c4609, 6 | BRF_GRA }, // 13 - { "14.bin", 0x80000, 0xc210fb53, 6 | BRF_GRA }, // 14 - { "15.bin", 0x80000, 0x3b1166c7, 6 | BRF_GRA }, // 15 - { "11.bin", 0x80000, 0x323eebc3, 6 | BRF_GRA }, // 16 - { "12.bin", 0x80000, 0xca7c8176, 6 | BRF_GRA }, // 17 - - { "82s129.5", 0x00100, 0x10bfcebb, 0 | BRF_OPT }, // 18 - PROMs (not used) - { "82s129.6", 0x00100, 0x10bfcebb, 0 | BRF_OPT }, // 19 -}; - -STD_ROM_PICK(bestbest) -STD_ROM_FN(bestbest) - -struct BurnDriver BurnDrvBestbest = { - "bestbest", NULL, NULL, NULL, "1994", - "Best Of Best\0", NULL, "SunA", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, bestbestRomInfo, bestbestRomName, NULL, NULL, BestbestInputInfo, bestbestDIPInfo, - BestbestInit, DrvExit, BestbestFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// SunA Quiz 6000 Academy (940620-6) - -static struct BurnRomInfo sunaqRomDesc[] = { - { "prog2.bin", 0x80000, 0xa92bce45, 1 | BRF_ESS | BRF_PRG }, // 0 - 68K Code - { "prog1.bin", 0x80000, 0xff690e7e, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "audio1.bin", 0x10000, 0x3df42f82, 2 | BRF_ESS | BRF_PRG }, // 2 - Z80 #0 Code - - { "audio2.bin", 0x80000, 0xcac85ba9, 3 | BRF_ESS | BRF_PRG }, // 3 - Z80 #1 Code - - { "gfx1.bin", 0x80000, 0x0bde5acf, 5 | BRF_GRA }, // 4 - Sprites - { "gfx2.bin", 0x80000, 0x24b74826, 5 | BRF_GRA }, // 5 -}; - -STD_ROM_PICK(sunaq) -STD_ROM_FN(sunaq) - -struct BurnDriver BurnDrvSunaq = { - "sunaq", NULL, NULL, NULL, "1994", - "SunA Quiz 6000 Academy (940620-6)\0", NULL, "SunA", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, - NULL, sunaqRomInfo, sunaqRomName, NULL, NULL, SunaqInputInfo, sunaqDIPInfo, - SunaqInit, DrvExit, SunaqFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Ultra Balloon - -static struct BurnRomInfo uballoonRomDesc[] = { - { "prg2.rom", 0x80000, 0x72ab80ea, 1 | BRF_ESS | BRF_PRG }, // 0 - 68K Code - { "prg1.rom", 0x80000, 0x27a04f55, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "audio1.rom", 0x10000, 0xc771f2b4, 2 | BRF_ESS | BRF_PRG }, // 2 - Z80 #0 Code - - { "audio2.rom", 0x20000, 0xc7f75347, 3 | BRF_ESS | BRF_PRG }, // 3 - Z80 #1 Code - - { "gfx1.rom", 0x80000, 0xfd2ec297, 5 | BRF_GRA }, // 4 - Sprites - { "gfx2.rom", 0x80000, 0x6307aa60, 5 | BRF_GRA }, // 5 - { "gfx3.rom", 0x80000, 0x718f3150, 5 | BRF_GRA }, // 6 - { "gfx4.rom", 0x80000, 0xaf7e057e, 5 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(uballoon) -STD_ROM_FN(uballoon) - -struct BurnDriver BurnDrvUballoon = { - "uballoon", NULL, NULL, NULL, "1996", - "Ultra Balloon\0", NULL, "SunA", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, uballoonRomInfo, uballoonRomName, NULL, NULL, UballoonInputInfo, uballoonDIPInfo, - UballoonInit, DrvExit, UballoonFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; - - -// Back Street Soccer - -static struct BurnRomInfo bssoccerRomDesc[] = { - { "02", 0x080000, 0x32871005, 1 | BRF_ESS | BRF_PRG }, // 0 - 68K Code - { "01", 0x080000, 0xace00db6, 1 | BRF_ESS | BRF_PRG }, // 1 - { "04", 0x080000, 0x25ee404d, 1 | BRF_ESS | BRF_PRG }, // 2 - { "03", 0x080000, 0x1a131014, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "11", 0x010000, 0xdf7ae9bc, 2 | BRF_ESS | BRF_PRG }, // 4 - Z80 #0 Code - - { "13", 0x080000, 0x2b273dca, 3 | BRF_ESS | BRF_PRG }, // 5 - Z80 #1 Code - - { "12", 0x080000, 0x6b73b87b, 4 | BRF_ESS | BRF_PRG }, // 6 - Z80 #0 Code - - { "05", 0x080000, 0xa5245bd4, 5 | BRF_GRA }, // 7 - Sprites - { "07", 0x080000, 0xfdb765c2, 5 | BRF_GRA }, // 8 - { "09", 0x080000, 0x0e82277f, 5 | BRF_GRA }, // 9 - { "06", 0x080000, 0xd42ce84b, 5 | BRF_GRA }, // 10 - { "08", 0x080000, 0x96cd2136, 5 | BRF_GRA }, // 11 - { "10", 0x080000, 0x1ca94d21, 5 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(bssoccer) -STD_ROM_FN(bssoccer) - -struct BurnDriver BurnDrvBssoccer = { - "bssoccer", NULL, NULL, NULL, "1996", - "Back Street Soccer\0", "graphics issues?", "SunA", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_MISC_POST90S, GBF_SPORTSFOOTBALL, 0, - NULL, bssoccerRomInfo, bssoccerRomName, NULL, NULL, BssoccerInputInfo, bssoccerDIPInfo, - BssoccerInit, DrvExit, BssoccerFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, - 256, 224, 4, 3 -}; +// FB Alpha SunA 16-bit hardware driver module +// Based on MAME driver by Luca Elia + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "burn_ym3526.h" +#include "driver.h" +#include "dac.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvZ80ROM2; +static UINT8 *DrvGfxROM0; +static UINT32 nGfxROM0Len; +static UINT8 *DrvGfxROM1; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvSprRAM0; +static UINT8 *DrvSprRAM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvPalRAM2; +static UINT32 *Palette; +static UINT32 *DrvPalette; + +static INT16 *pFMBuffer; +static INT16 *pAY8910Buffer[3]; +static INT16 *pSoundBuffer; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy3[16]; +static UINT8 DrvJoy4[16]; +static UINT8 DrvJoy5[16]; +static UINT8 DrvJoy6[16]; + +static UINT8 DrvDips[3]; +static UINT8 DrvReset; + +static UINT16 DrvInputs[6]; + +static INT32 game_select = 0; + +static UINT8 soundlatch; +static UINT8 soundlatch2; +static UINT8 soundlatch3; +static UINT8 flipscreen; +static UINT8 color_bank; + +static UINT8 bestofbest_prot = 0; + +static UINT8 z80bankdata[2]; + +static struct BurnInputInfo BestbestInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 15, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 15, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 14, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 3"}, + {"P1 Button 4" , BIT_DIGITAL , DrvJoy1 + 9, "p1 fire 4"}, + {"P1 Button 5" , BIT_DIGITAL , DrvJoy1 + 10, "p1 fire 5"}, + {"P1 Button 6" , BIT_DIGITAL , DrvJoy1 + 11, "p1 fire 6"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 14, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 3"}, + {"P2 Button 4" , BIT_DIGITAL , DrvJoy2 + 9, "p2 fire 4"}, + {"P2 Button 5" , BIT_DIGITAL , DrvJoy2 + 10, "p2 fire 5"}, + {"P2 Button 6" , BIT_DIGITAL , DrvJoy2 + 11, "p2 fire 6"}, + + {"Service" , BIT_DIGITAL , DrvJoy3 + 6, "service" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Bestbest) + +static struct BurnInputInfo UballoonInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 15, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 15, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 14, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 14, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2"}, + + {"Service" , BIT_DIGITAL , DrvJoy1 + 12, "service" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Uballoon) + +static struct BurnInputInfo BssoccerInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy6 + 4, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy6 + 5, "p2 coin" }, + {"Coin 3" , BIT_DIGITAL , DrvJoy6 + 6, "p3 coin" }, + {"Coin 4" , BIT_DIGITAL , DrvJoy6 + 7, "p4 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 7, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 7, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 6, "p2 fire 3"}, + + {"P3 Start" , BIT_DIGITAL , DrvJoy3 + 7, "p3 start" }, + {"P3 Up" , BIT_DIGITAL , DrvJoy3 + 0, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , DrvJoy3 + 1, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , DrvJoy3 + 2, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , DrvJoy3 + 3, "p3 right" }, + {"P3 Button 1" , BIT_DIGITAL , DrvJoy3 + 4, "p3 fire 1"}, + {"P3 Button 2" , BIT_DIGITAL , DrvJoy3 + 5, "p3 fire 2"}, + {"P3 Button 3" , BIT_DIGITAL , DrvJoy3 + 6, "p3 fire 3"}, + + {"P4 Start" , BIT_DIGITAL , DrvJoy4 + 7, "p4 start" }, + {"P4 Up" , BIT_DIGITAL , DrvJoy4 + 0, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , DrvJoy4 + 1, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , DrvJoy4 + 2, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , DrvJoy4 + 3, "p4 right" }, + {"P4 Button 1" , BIT_DIGITAL , DrvJoy4 + 4, "p4 fire 1"}, + {"P4 Button 2" , BIT_DIGITAL , DrvJoy4 + 5, "p4 fire 2"}, + {"P4 Button 3" , BIT_DIGITAL , DrvJoy4 + 6, "p4 fire 3"}, + + {"Service" , BIT_DIGITAL , DrvJoy3 + 6, "service" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip 3", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Bssoccer) + +static struct BurnInputInfo SunaqInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 7, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 7, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 6, "p1 start" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 0, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 1, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 2, "p1 fire 3"}, + {"P1 Button 4" , BIT_DIGITAL , DrvJoy1 + 3, "p1 fire 4"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 6, "p2 start" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 0, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy2 + 2, "p2 fire 3"}, + {"P2 Button 4" , BIT_DIGITAL , DrvJoy2 + 3, "p2 fire 4"}, + + {"Service" , BIT_DIGITAL , DrvJoy3 + 6, "service" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Sunaq) + +static struct BurnDIPInfo bestbestDIPList[]= +{ + {0x1a, 0xff, 0xff, 0xff, NULL }, + {0x1b, 0xff, 0xff, 0xff, NULL }, + + {0x1a, 0xfe, 0, 8, "Coinage" }, + {0x1a, 0x01, 0x07, 0x00, "5C 1C" }, + {0x1a, 0x01, 0x07, 0x01, "4C 1C" }, + {0x1a, 0x01, 0x07, 0x02, "3C 1C" }, + {0x1a, 0x01, 0x07, 0x03, "2C 1C" }, + {0x1a, 0x01, 0x07, 0x07, "1C 1C" }, + {0x1a, 0x01, 0x07, 0x06, "1C 2C" }, + {0x1a, 0x01, 0x07, 0x05, "1C 3C" }, + {0x1a, 0x01, 0x07, 0x04, "1C 4C" }, + + {0x1a, 0xfe, 0, 4, "Difficulty" }, + {0x1a, 0x01, 0x18, 0x18, "Easy" }, + {0x1a, 0x01, 0x18, 0x10, "Normal" }, + {0x1a, 0x01, 0x18, 0x08, "Hard" }, + {0x1a, 0x01, 0x18, 0x00, "Hardest" }, + + {0x1a, 0xfe, 0, 2, "Display Combos" }, + {0x1a, 0x01, 0x20, 0x00, "Off" }, + {0x1a, 0x01, 0x20, 0x20, "On" }, + + {0x1a, 0xfe, 0, 2, "Demo Sounds" }, + {0x1a, 0x01, 0x80, 0x80, "Off" }, + {0x1a, 0x01, 0x80, 0x00, "On" }, + + {0x1b, 0xfe, 0, 2, "Flip Screen" }, + {0x1b, 0x01, 0x01, 0x01, "Off" }, + {0x1b, 0x01, 0x01, 0x00, "On" }, + + {0x1b, 0xfe, 0, 4, "Play Time" }, + {0x1b, 0x01, 0x06, 0x06, "1:10" }, + {0x1b, 0x01, 0x06, 0x04, "1:20" }, + {0x1b, 0x01, 0x06, 0x02, "1:30" }, + {0x1b, 0x01, 0x06, 0x00, "1:40" }, +}; + +STDDIPINFO(bestbest) + +static struct BurnDIPInfo bssoccerDIPList[]= +{ + {0x26, 0xff, 0xff, 0xff, NULL }, + {0x27, 0xff, 0xff, 0xff, NULL }, + {0x28, 0xff, 0xff, 0xff, NULL }, + + {0x26, 0xfe, 0, 8, "Coinage" }, + {0x26, 0x01, 0x07, 0x00, "4C 1C" }, + {0x26, 0x01, 0x07, 0x01, "3C 1C" }, + {0x26, 0x01, 0x07, 0x02, "2C 1C" }, + {0x26, 0x01, 0x07, 0x07, "1C 1C" }, + {0x26, 0x01, 0x07, 0x06, "1C 2C" }, + {0x26, 0x01, 0x07, 0x05, "1C 3C" }, + {0x26, 0x01, 0x07, 0x04, "1C 4C" }, + {0x26, 0x01, 0x07, 0x03, "1C 5C" }, + + {0x26, 0xfe, 0, 4, "Difficulty" }, + {0x26, 0x01, 0x18, 0x10, "Easy" }, + {0x26, 0x01, 0x18, 0x18, "Normal" }, + {0x26, 0x01, 0x18, 0x08, "Hard" }, + {0x26, 0x01, 0x18, 0x00, "Hardest?" }, + + {0x26, 0xfe, 0, 2, "Demo Sounds" }, + {0x26, 0x01, 0x20, 0x00, "Off" }, + {0x26, 0x01, 0x20, 0x20, "On" }, + + {0x26, 0xfe, 0, 2, "Flip Screen" }, + {0x26, 0x01, 0x40, 0x40, "Off" }, + {0x26, 0x01, 0x40, 0x00, "On" }, + + {0x27, 0xfe, 0, 4, "Play Time P1" }, + {0x27, 0x01, 0x03, 0x03, "1:30" }, + {0x27, 0x01, 0x03, 0x02, "1:45" }, + {0x27, 0x01, 0x03, 0x01, "2:00" }, + {0x27, 0x01, 0x03, 0x00, "2:15" }, + + {0x27, 0xfe, 0, 4, "Play Time P2" }, + {0x27, 0x01, 0x0c, 0x0c, "1:30" }, + {0x27, 0x01, 0x0c, 0x08, "1:45" }, + {0x27, 0x01, 0x0c, 0x04, "2:00" }, + {0x27, 0x01, 0x0c, 0x00, "2:15" }, + + {0x27, 0xfe, 0, 4, "Play Time P3" }, + {0x27, 0x01, 0x30, 0x30, "1:30" }, + {0x27, 0x01, 0x30, 0x20, "1:45" }, + {0x27, 0x01, 0x30, 0x10, "2:00" }, + {0x27, 0x01, 0x30, 0x00, "2:15" }, + + {0x27, 0xfe, 0, 4, "Play Time P4" }, + {0x27, 0x01, 0xc0, 0xc0, "1:30" }, + {0x27, 0x01, 0xc0, 0x80, "1:45" }, + {0x27, 0x01, 0xc0, 0x40, "2:00" }, + {0x27, 0x01, 0xc0, 0x00, "2:15" }, + + {0x28, 0xfe, 0, 2, "Copyright" }, + {0x28, 0x01, 0x01, 0x01, "Distributer Unico" }, + {0x28, 0x01, 0x01, 0x00, "All Rights Reserved" }, +}; + +STDDIPINFO(bssoccer) + + +static struct BurnDIPInfo sunaqDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xcf, NULL }, + + {0x0e, 0xfe, 0, 8, "Coinage" }, + {0x0e, 0x01, 0x07, 0x00, "5C 1C" }, + {0x0e, 0x01, 0x07, 0x01, "4C 1C" }, + {0x0e, 0x01, 0x07, 0x02, "3C 1C" }, + {0x0e, 0x01, 0x07, 0x03, "2C 1C" }, + {0x0e, 0x01, 0x07, 0x07, "1C 1C" }, + {0x0e, 0x01, 0x07, 0x06, "1C 2C" }, + {0x0e, 0x01, 0x07, 0x05, "1C 3C" }, + {0x0e, 0x01, 0x07, 0x04, "1C 4C" }, + + {0x0e, 0xfe, 0, 4, "Difficulty" }, + {0x0e, 0x01, 0x18, 0x00, "Easy" }, + {0x0e, 0x01, 0x18, 0x08, "Normal" }, + {0x0e, 0x01, 0x18, 0x10, "Hard" }, + {0x0e, 0x01, 0x18, 0x18, "Hardest" }, + + {0x0e, 0xfe, 0, 2, "Demo Sounds" }, + {0x0e, 0x01, 0x20, 0x20, "Off" }, + {0x0e, 0x01, 0x20, 0x00, "On" }, + + {0x0e, 0xfe, 0, 2, "Flip Screen" }, + {0x0e, 0x01, 0x40, 0x40, "Off" }, + {0x0e, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(sunaq) + + +static struct BurnDIPInfo uballoonDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0x12, 0xfe, 0, 2, "Copyright" }, + {0x12, 0x01, 0x30, 0x30, "Distributer Unico" }, + {0x12, 0x01, 0x30, 0x20, "All Rights Reserved" }, +// {0x12, 0x01, 0x30, 0x10, "Distributer Unico" }, +// {0x12, 0x01, 0x30, 0x00, "All Rights Reserved" }, + + {0x13, 0xfe, 0, 8, "Coinage" }, + {0x13, 0x01, 0x07, 0x00, "5C 1C" }, + {0x13, 0x01, 0x07, 0x01, "4C 1C" }, + {0x13, 0x01, 0x07, 0x02, "3C 1C" }, + {0x13, 0x01, 0x07, 0x03, "2C 1C" }, + {0x13, 0x01, 0x07, 0x07, "1C 1C" }, + {0x13, 0x01, 0x07, 0x06, "1C 2C" }, + {0x13, 0x01, 0x07, 0x05, "1C 3C" }, + {0x13, 0x01, 0x07, 0x04, "1C 4C" }, + + {0x13, 0xfe, 0, 4, "Lives" }, + {0x13, 0x01, 0x18, 0x10, "2" }, + {0x13, 0x01, 0x18, 0x18, "3" }, + {0x13, 0x01, 0x18, 0x08, "4" }, + {0x13, 0x01, 0x18, 0x00, "5" }, + + {0x13, 0xfe, 0, 4, "Difficulty" }, + {0x13, 0x01, 0x60, 0x40, "Easy" }, + {0x13, 0x01, 0x60, 0x60, "Normal" }, + {0x13, 0x01, 0x60, 0x20, "Hard" }, + {0x13, 0x01, 0x60, 0x00, "Hardest" }, + + {0x14, 0xfe, 0, 2, "Flip Screen" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0x14, 0xfe, 0, 2, "Cabinet" }, + {0x14, 0x01, 0x02, 0x02, "Upright" }, + {0x14, 0x01, 0x02, 0x00, "Cocktail" }, + + {0x14, 0xfe, 0, 8, "Bonus Life" }, + {0x14, 0x01, 0x1c, 0x1c, "200K" }, + {0x14, 0x01, 0x1c, 0x10, "300K, 1000K" }, + {0x14, 0x01, 0x1c, 0x18, "400K" }, + {0x14, 0x01, 0x1c, 0x0c, "500K, 1500K" }, + {0x14, 0x01, 0x1c, 0x08, "500K, 2000K" }, + {0x14, 0x01, 0x1c, 0x04, "500K, 3000K" }, + {0x14, 0x01, 0x1c, 0x14, "600K" }, + {0x14, 0x01, 0x1c, 0x00, "None" }, + + {0x14, 0xfe, 0, 2, "Demo Sounds" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(uballoon) + + +//------------------------------------------------------------------------------------------------- +// Generic functions + +static void suna_palette_write(INT32 offset) +{ + UINT8 r, b, g; + UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset))); + + r = (data >> 0) & 0x1f; + r = (r << 3) | (r >> 2); + + g = (data >> 5) & 0x1f; + g = (g << 3) | (g >> 2); + + b = (data >> 10) & 0x1f; + b = (b << 3) | (b >> 2); + + Palette[offset>>1] = (r << 16) | (g << 8) | b; + DrvPalette[offset>>1] = BurnHighCol(r, g, b, 0); + + return; +} + +//------------------------------------------------------------------------------------------------- +// Memory handlers + + +//---------------------------------------------------------------- +// Best of Best + + +//------------------ +// 68k + +UINT16 __fastcall bestbest_read_word(UINT32 address) +{ + switch (address & ~1) + { + case 0x500000: + return DrvInputs[0]; + + case 0x500002: + return DrvInputs[1]; + + case 0x500004: + return DrvInputs[2]; + } + + return 0; +} + +UINT8 __fastcall bestbest_read_byte(UINT32 address) +{ + switch (address) + { + case 0x500000: + case 0x500001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x500002: + case 0x500003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x500004: + case 0x500005: + return DrvInputs[2] >> ((~address & 1) << 3); + + case 0x500019: + return bestofbest_prot; + } + + return 0; +} + +void __fastcall bestbest_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfff000) == 0x540000) { + *((UINT16*)(DrvPalRAM + (address & 0x0fff))) = BURN_ENDIAN_SWAP_INT16(data); + suna_palette_write(address & 0xffe); + return; + } + + switch (address & ~1) + { + case 0x500000: + soundlatch = data; + return; + + case 0x500002: + flipscreen = data & 0x10; + return; + } + + return; +} + +void __fastcall bestbest_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfff000) == 0x540000) { + DrvPalRAM[address & 0xfff] = data; + suna_palette_write(address & 0xffe); + return; + } + + switch (address) + { + case 0x500000: + case 0x500001: + soundlatch = data; + return; + + case 0x500002: + case 0x500003: + flipscreen = data & 0x10; + return; + + case 0x500008: + case 0x500009: + switch (data & 0xff) { + case 0x00: bestofbest_prot ^= 0x09; break; + case 0x08: bestofbest_prot ^= 0x02; break; + case 0x0c: bestofbest_prot ^= 0x03; break; + } + return; + } + + return; +} + +//------------------ +// Z80 #0 + +void __fastcall bestbest_sound0_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc000: + case 0xc001: + BurnYM3526Write(address & 1, data); + return; + + case 0xc002: + case 0xc003: + AY8910Write(0, address & 1, data); + return; + + case 0xf000: + soundlatch2 = data; + return; + } + + return; +} + +UINT8 __fastcall bestbest_sound0_read(UINT16 address) +{ + switch (address) + { + case 0xf800: + return soundlatch; + } + + return 0; +} + +//------------------ +// Z80 #1 + +void __fastcall bestbest_sound1_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: { DACWrite(0, (data & 0xf) * 0x11); return; } + case 0x01: { DACWrite(1, (data & 0xf) * 0x11); return; } + + case 0x02: { DACWrite(2, (data & 0xf) * 0x11); return; } + case 0x03: { DACWrite(3, (data & 0xf) * 0x11); return; } + } + + return; +} + +UINT8 __fastcall bestbest_sound1_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return soundlatch2; + } + + return 0; +} + + +//---------------------------------------------------------------- +// SunA Quiz + + +//------------------ +// 68k + +UINT16 __fastcall sunaq_read_word(UINT32 address) +{ + if ((address & 0xfff000) == 0x540000) { + if (address & 0x200) { + return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM2 + (address & 0xffe)))); + } else { + address += color_bank << 9; + return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + (address & 0xffe)))); + } + } + + switch (address & ~1) + { + case 0x500000: + return DrvInputs[0]; + + case 0x500002: + return DrvInputs[1]; + + case 0x500004: + return DrvInputs[2]; + + case 0x500006: + return DrvInputs[3]; + } + + return 0; +} + +UINT8 __fastcall sunaq_read_byte(UINT32 address) +{ + if ((address & 0xfff000) == 0x540000) { + if (address & 0x200) { + return DrvPalRAM2[address & 0xffe]; + } else { + address += color_bank << 9; + return DrvPalRAM[address & 0xffe]; + } + } + + switch (address) + { + case 0x500000: + case 0x500001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x500002: + case 0x500003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x500004: + case 0x500005: + return DrvInputs[2] >> ((~address & 1) << 3); + + case 0x500006: + case 0x500007: + return DrvInputs[3] >> ((~address & 1) << 3); + } + + return 0; +} + +void __fastcall sunaq_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfff000) == 0x540000) { + if (address & 0x200) { + *((UINT16*)(DrvPalRAM2 + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); + } else { + address += color_bank << 9; + *((UINT16*)(DrvPalRAM + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); + suna_palette_write(address & 0xffff); + } + return; + } + + switch (address & ~1) + { + case 0x500000: + soundlatch = data; + return; + + case 0x500002: + flipscreen = data & 0x01; + color_bank = (data >> 2) & 1; + return; + + case 0x500004: + // coin counter + return; + } + return; +} + +void __fastcall sunaq_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfff000) == 0x540000) { + if (address & 0x200) { + DrvPalRAM2[address & 0xfff] = data; + } else { + address += color_bank << 9; + DrvPalRAM[address & 0xfff] = data; + suna_palette_write(address & 0xffe); + } + + return; + } + + switch (address) + { + case 0x500000: + case 0x500001: + soundlatch = data; + return; + + case 0x500002: + case 0x500003: + flipscreen = data & 0x01; + color_bank = (data >> 2) & 1; + return; + + case 0x500004: + case 0x500005: + // coin counter + return; + } + return; +} + +//------------------ +// Z80 #0 + +void __fastcall sunaq_sound0_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf800: + BurnYM2151SelectRegister(data); + return; + + case 0xf801: + BurnYM2151WriteRegister(data); + return; + + case 0xfc00: + soundlatch2 = data; + return; + } + + return; +} + + +//---------------------------------------------------------------- +// Ultra Balloon + + +//------------------ +// 68k + +UINT16 __fastcall uballoon_read_word(UINT32 address) +{ + if ((address & 0xfff000) == 0x200000) { + if (address & 0x200) { + return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM2 + (address & 0xffe)))); + } else { + address += color_bank << 9; + return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + (address & 0xffe)))); + } + } + + switch (address & ~1) + { + case 0x600000: + return DrvInputs[0]; + + case 0x600002: + return DrvInputs[1]; + + case 0x600004: + return DrvInputs[2]; + + case 0x600006: + return DrvInputs[3]; + } + + return 0; +} + +UINT8 __fastcall uballoon_read_byte(UINT32 address) +{ + if ((address & 0xfff000) == 0x200000) { + if (address & 0x200) { + return DrvPalRAM2[address & 0xffe]; + } else { + address += color_bank << 9; + return DrvPalRAM[address & 0xffe]; + } + } + + switch (address) + { + case 0x600000: + case 0x600001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x600002: + case 0x600003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x600004: + case 0x600005: + return DrvInputs[2] >> ((~address & 1) << 3); + + case 0x600006: + case 0x600007: + return DrvInputs[3] >> ((~address & 1) << 3); + } + + return 0; +} + +void __fastcall uballoon_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfff000) == 0x200000) { + if (address & 0x200) { + *((UINT16*)(DrvPalRAM2 + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); + } else { + address += color_bank << 9; + *((UINT16*)(DrvPalRAM + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); + suna_palette_write(address & 0xffff); + } + return; + } + + switch (address & ~1) + { + case 0x600000: + soundlatch = data; + return; + + case 0x600004: + flipscreen = data & 0x01; + color_bank = (data >> 2) & 1; + return; + } + return; +} + +void __fastcall uballoon_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfff000) == 0x200000) { + if (address & 0x200) { + DrvPalRAM2[address & 0xfff] = data; + } else { + address += color_bank << 9; + DrvPalRAM[address & 0xfff] = data; + suna_palette_write(address & 0xffe); + } + return; + } + + switch (address) + { + case 0x600000: + case 0x600001: + soundlatch = data; + return; + + case 0x600004: + case 0x600005: + flipscreen = data & 0x01; + color_bank = (data >> 2) & 1; + return; + } + return; +} + +//------------------ +// Z80 #1 + +static void uballoon_bankswitch(INT32 data) +{ + z80bankdata[0] = data; + + INT32 bank = ((data & 1) << 16) | 0x400; + + ZetMapArea(0x0400, 0xffff, 0, DrvZ80ROM1 + bank); + ZetMapArea(0x0400, 0xffff, 2, DrvZ80ROM1 + bank); +} + +void __fastcall uballoon_sound1_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: { DACWrite(0, (data & 0xf) * 0x11); return; } + case 0x01: { DACWrite(1, (data & 0xf) * 0x11); return; } + + case 0x03: + uballoon_bankswitch(data); + return; + } + + return; +} + +UINT8 __fastcall uballoon_sound1_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return soundlatch2; + } + + return 0; +} + + +//---------------------------------------------------------------- +// Back Street Soccer + + +//------------------ +// 68k + +UINT16 __fastcall bssoccer_read_word(UINT32 address) +{ + if ((address & 0xfff000) == 0x400000) { + if (address & 0x200) { + return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM2 + (address & 0xffe)))); + } else { + address += color_bank << 9; + return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + (address & 0xffe)))); + } + } + + switch (address & ~1) + { + case 0xa00000: + return DrvInputs[0]; + + case 0xa00002: + return DrvInputs[1]; + + case 0xa00004: + return DrvInputs[2]; + + case 0xa00006: + return DrvInputs[3]; + + case 0xa00008: + return DrvInputs[4]; + + case 0xa0000a: + return DrvInputs[5]; + + } + + return 0; +} + +UINT8 __fastcall bssoccer_read_byte(UINT32 address) +{ + if ((address & 0xfff000) == 0x400000) { + if (address & 0x200) { + return DrvPalRAM2[address & 0xffe]; + } else { + address += color_bank << 9; + return DrvPalRAM[address & 0xffe]; + } + } + + switch (address) + { + case 0xa00000: + case 0xa00001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0xa00002: + case 0xa00003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0xa00004: + case 0xa00005: + return DrvInputs[2] >> ((~address & 1) << 3); + + case 0xa00006: + case 0xa00007: + return DrvInputs[3] >> ((~address & 1) << 3); + + case 0xa00008: + case 0xa00009: + return DrvInputs[4] >> ((~address & 1) << 3); + + case 0xa0000a: + case 0xa0000b: + return DrvInputs[5] >> ((~address & 1) << 3); + } + + return 0; +} + +void __fastcall bssoccer_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfff000) == 0x400000) { + if (address & 0x200) { + *((UINT16*)(DrvPalRAM2 + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); + } else { + address += color_bank << 9; + *((UINT16*)(DrvPalRAM + (address & 0xffff))) = BURN_ENDIAN_SWAP_INT16(data); + suna_palette_write(address & 0xffff); + } + return; + } + + switch (address & ~1) + { + case 0xa00000: + soundlatch = data; + return; + + case 0xa00002: + flipscreen = data & 0x01; + color_bank = (data >> 2) & 1; + return; + } + return; +} + +void __fastcall bssoccer_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfff000) == 0x400000) { + if (address & 0x200) { + DrvPalRAM[address & 0xfff] = data; + } else { + address += color_bank << 9; + DrvPalRAM[address & 0xfff] = data; + suna_palette_write(address & 0xffe); + } + return; + } + + switch (address) + { + case 0xa00000: + case 0xa00001: + soundlatch = data; + return; + + case 0xa00002: + case 0xa00003: + flipscreen = data & 0x01; + color_bank = (data >> 2) & 1; + return; + } + return; +} + +//------------------ +// Z80 #0 + +static void bssoccer_bankswitch_w(UINT8 *z80data, INT32 p, INT32 data) +{ + z80bankdata[p] = data; + + INT32 bank = ((data & 7) << 16) | 0x1000; + + ZetMapArea(0x1000, 0xffff, 0, z80data + bank); + ZetMapArea(0x1000, 0xffff, 2, z80data + bank); +} + +void __fastcall bssoccer_sound0_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf800: + BurnYM2151SelectRegister(data); + return; + + case 0xf801: + BurnYM2151WriteRegister(data); + return; + + case 0xfd00: + soundlatch2 = data; + return; + + case 0xfe00: + soundlatch3 = data; + return; + } + + return; +} + +UINT8 __fastcall bssoccer_sound0_read(UINT16 address) +{ + switch (address) + { + case 0xf801: + return BurnYM2151ReadStatus(); + + case 0xfc00: + return soundlatch; + } + + return 0; +} + +//------------------ +// Z80 #1 + +void __fastcall bssoccer_sound1_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: { DACWrite(0, (data & 0xf) * 0x11); return; } + case 0x01: { DACWrite(1, (data & 0xf) * 0x11); return; } + + case 0x03: + bssoccer_bankswitch_w(DrvZ80ROM1, 0, data); + return; + } + + return; +} + +UINT8 __fastcall bssoccer_sound1_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return soundlatch2; + } + + return 0; +} + +//------------------ +// Z80 #2 + +void __fastcall bssoccer_sound2_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: { DACWrite(2, (data & 0xf) * 0x11); return; } + case 0x01: { DACWrite(3, (data & 0xf) * 0x11); return; } + return; + + case 0x03: + bssoccer_bankswitch_w(DrvZ80ROM2, 1, data); + return; + } + + return; +} + +UINT8 __fastcall bssoccer_sound2_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return soundlatch3; + } + + return 0; +} + + +//------------------------------------------------------------------------------------------------- +// Initialization routines + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + for (INT32 j = 0; j < 2; j++) { + ZetOpen(j); + ZetReset(); + ZetClose(); + } + + if (game_select == 3) { + ZetOpen(2); + ZetReset(); + ZetClose(); + } + + soundlatch = 0; + soundlatch2 = 0; + soundlatch3 = 0; + color_bank = 0; + bestofbest_prot = 0; + flipscreen = 0; + + z80bankdata[0] = z80bankdata[1] = 0; + + if (game_select == 3) { + ZetOpen(1); + bssoccer_bankswitch_w(DrvZ80ROM1, 0, z80bankdata[0]); + ZetClose(); + ZetOpen(2); + bssoccer_bankswitch_w(DrvZ80ROM2, 1, z80bankdata[1]); + ZetClose(); + } + + if (game_select == 2) { + ZetOpen(1); + uballoon_bankswitch(z80bankdata[0]); + ZetClose(); + } + + if (game_select == 1) { + ZetOpen(1); + bssoccer_bankswitch_w(DrvZ80ROM1, 0, z80bankdata[0]); + ZetClose(); + } + + if (game_select) { + BurnYM2151Reset(); + } else { + BurnYM3526Reset(); + AY8910Reset(0); + } + + DACReset(); + + return 0; +} + + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x0200000; + DrvZ80ROM0 = Next; Next += 0x0010000; + DrvZ80ROM1 = Next; Next += 0x0080000; + DrvZ80ROM2 = Next; Next += 0x0080000; + + DrvGfxROM0 = Next; Next += 0x0600000; + if (game_select == 0) { + DrvGfxROM1 = Next; Next += 0x0800000; + } + + DrvPalette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); + + pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 3 * sizeof(INT16); + pSoundBuffer = (INT16*)Next; Next += nBurnSoundLen * 2 * sizeof(INT16); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x0010000; + +// DrvZ80RAM0 = Next; Next += 0x0000800; + DrvZ80RAM0 = Next; Next += 0x0001000; + + DrvSprRAM0 = Next; Next += 0x0020000; + DrvSprRAM1 = Next; Next += 0x0020000; + + DrvPalRAM = Next; Next += 0x0001000; + DrvPalRAM2 = Next; Next += 0x0010000; + + Palette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode(UINT8 *gfx_base, INT32 len) +{ + INT32 Plane[4] = {(len << 2) + 0, (len << 2) + 4, 0, 4 }; + INT32 XOffs[8] = { 3, 2, 1, 0, 11, 10, 9, 8 }; + INT32 YOffs[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(len); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < len; i++) tmp[i] = gfx_base[i] ^ 0xff; // copy & invert + + GfxDecode(((len * 8) / 4) / 64, 4, 8, 8, Plane, XOffs, YOffs, 0x80, tmp, gfx_base); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvLoadRoms() +{ + char* pRomName; + struct BurnRomInfo ri; + + UINT8 *Load68K = Drv68KROM; + UINT8 *Loadz0 = DrvZ80ROM0; + UINT8 *Loadz1 = DrvZ80ROM1; + UINT8 *Loadz2 = DrvZ80ROM2; + UINT8 *Loadg0 = DrvGfxROM0; + UINT8 *Loadg1 = DrvGfxROM1; + + INT32 gfx0_len = 0; + INT32 gfx1_len = 0; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & 7) == 1) { + + if (BurnLoadRom(Load68K + 1, i + 0, 2)) return 1; + if (BurnLoadRom(Load68K + 0, i + 1, 2)) return 1; + + Load68K += 0x100000; + + i++; + + continue; + } + + if ((ri.nType & 7) == 2) { + if (BurnLoadRom(Loadz0, i, 1)) return 1; + continue; + } + + if ((ri.nType & 7) == 3) { + if (BurnLoadRom(Loadz1, i, 1)) return 1; + continue; + } + + if ((ri.nType & 7) == 4) { + if (BurnLoadRom(Loadz2, i, 1)) return 1; + continue; + } + + if ((ri.nType & 7) == 5) { + if (BurnLoadRom(Loadg0, i, 1)) return 1; + + Loadg0 += ri.nLen; + gfx0_len += ri.nLen; + + continue; + } + + if ((ri.nType & 7) == 6) { + if (BurnLoadRom(Loadg1, i, 1)) return 1; + + Loadg1 += ri.nLen; + gfx1_len += ri.nLen; + + continue; + } + } + + nGfxROM0Len = gfx0_len >> 5; + + if (gfx0_len) DrvGfxDecode(DrvGfxROM0, gfx0_len); + if (gfx1_len) DrvGfxDecode(DrvGfxROM1, gfx1_len); + + return 0; +} + +void bestbest_ay8910_write_a(UINT32,UINT32) +{ +} + +static void bestbestFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 bestbestSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 6000000; +} + +static INT32 bestbestSyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (6000000.0000 / (nBurnFPS / 100.0000)))); +} + +static INT32 bssoccerSyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (5000000.0000 / (nBurnFPS / 100.0000)))); +} + +static INT32 BestbestInit() +{ + INT32 nLen; + + game_select = 0; + + AllMem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + for (INT32 i = 0; i < 3; i++) { + pAY8910Buffer[i] = pFMBuffer + nBurnSoundLen * i; + } + + if (DrvLoadRoms()) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KROM, 0x040000, 0x07ffff, SM_ROM); + SekMapMemory(Drv68KROM, 0x080000, 0x0bffff, SM_ROM); + SekMapMemory(Drv68KROM, 0x0c0000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KROM + 0x100000, 0x200000, 0x2fffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x540000, 0x540fff, SM_ROM); + SekMapMemory(DrvPalRAM2, 0x541000, 0x54ffff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x580000, 0x58ffff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0x5c0000, 0x5dffff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0x5e0000, 0x5fffff, SM_RAM); + SekSetWriteByteHandler(0, bestbest_write_byte); + SekSetWriteWordHandler(0, bestbest_write_word); + SekSetReadByteHandler(0, bestbest_read_byte); + SekSetReadWordHandler(0, bestbest_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); + ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM0); + ZetSetReadHandler(bestbest_sound0_read); + ZetSetWriteHandler(bestbest_sound0_write); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0xffff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0xffff, 2, DrvZ80ROM1); + ZetSetInHandler(bestbest_sound1_in); + ZetSetOutHandler(bestbest_sound1_out); + ZetClose(); + + BurnYM3526Init(3000000, &bestbestFMIRQHandler, &bestbestSynchroniseStream, 0); + BurnTimerAttachZetYM3526(6000000); + BurnYM3526SetRoute(BURN_SND_YM3526_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + AY8910Init(0, 1500000, nBurnSoundRate, NULL, NULL, bestbest_ay8910_write_a, NULL); + AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_3, 0.00, BURN_SND_ROUTE_BOTH); // suppressed? + + DACInit(0, 0, 1, bestbestSyncDAC); + DACInit(1, 0, 1, bestbestSyncDAC); + DACInit(2, 0, 1, bestbestSyncDAC); + DACInit(3, 0, 1, bestbestSyncDAC); + DACSetRoute(0, 0.40, BURN_SND_ROUTE_LEFT); + DACSetRoute(1, 0.40, BURN_SND_ROUTE_RIGHT); + DACSetRoute(2, 0.40, BURN_SND_ROUTE_LEFT); + DACSetRoute(3, 0.40, BURN_SND_ROUTE_RIGHT); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + +static INT32 SunaqInit() +{ + INT32 nLen; + + game_select = 1; + + AllMem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (DrvLoadRoms()) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(DrvPalRAM2, 0x540400, 0x540fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x580000, 0x583fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0x5c0000, 0x5dffff, SM_RAM); + SekSetWriteByteHandler(0, sunaq_write_byte); + SekSetWriteWordHandler(0, sunaq_write_word); + SekSetReadByteHandler(0, sunaq_read_byte); + SekSetReadWordHandler(0, sunaq_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM0); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM0); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM0); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM0); + ZetSetWriteHandler(sunaq_sound0_write); + ZetSetReadHandler(bssoccer_sound0_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM1); + ZetMapArea(0x1000, 0xffff, 0, DrvZ80ROM1 + 0x1000); + ZetMapArea(0x1000, 0xffff, 2, DrvZ80ROM1 + 0x1000); + ZetSetInHandler(bssoccer_sound1_in); + ZetSetOutHandler(bssoccer_sound1_out); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + + DACInit(0, 0, 2, bestbestSyncDAC); + DACInit(1, 0, 2, bestbestSyncDAC); + DACSetRoute(0, 0.50, BURN_SND_ROUTE_LEFT); + DACSetRoute(1, 0.50, BURN_SND_ROUTE_RIGHT); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + + +static INT32 UballoonInit() +{ + INT32 nLen; + + game_select = 2; + + AllMem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (DrvLoadRoms()) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(DrvPalRAM2, 0x200400, 0x200fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0x400000, 0x41ffff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0x5c0000, 0x5dffff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x800000, 0x803fff, SM_RAM); + SekSetWriteByteHandler(0, uballoon_write_byte); + SekSetWriteWordHandler(0, uballoon_write_word); + SekSetReadByteHandler(0, uballoon_read_byte); + SekSetReadWordHandler(0, uballoon_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM0); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM0); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM0); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM0); + ZetSetWriteHandler(sunaq_sound0_write); + ZetSetReadHandler(bssoccer_sound0_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x03ff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x03ff, 2, DrvZ80ROM1); + ZetMapArea(0x0400, 0xffff, 0, DrvZ80ROM1 + 0x400); + ZetMapArea(0x0400, 0xffff, 2, DrvZ80ROM1 + 0x400); + ZetSetInHandler(uballoon_sound1_in); + ZetSetOutHandler(uballoon_sound1_out); + ZetClose(); + + // Patch out the protection checks + *((UINT16*)(Drv68KROM + 0x0113c)) = BURN_ENDIAN_SWAP_INT16(0x4e71); + *((UINT16*)(Drv68KROM + 0x0113e)) = BURN_ENDIAN_SWAP_INT16(0x4e71); + *((UINT16*)(Drv68KROM + 0x01784)) = BURN_ENDIAN_SWAP_INT16(0x600c); + *((UINT16*)(Drv68KROM + 0x018e2)) = BURN_ENDIAN_SWAP_INT16(0x600c); + *((UINT16*)(Drv68KROM + 0x03c54)) = BURN_ENDIAN_SWAP_INT16(0x600c); + *((UINT16*)(Drv68KROM + 0x126a0)) = BURN_ENDIAN_SWAP_INT16(0x4e71); + + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); + + DACInit(0, 0, 1, bssoccerSyncDAC); + DACInit(1, 0, 1, bssoccerSyncDAC); + DACSetRoute(0, 0.50, BURN_SND_ROUTE_LEFT); + DACSetRoute(1, 0.50, BURN_SND_ROUTE_RIGHT); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 BssoccerInit() +{ + INT32 nLen; + + game_select = 3; + + AllMem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (DrvLoadRoms()) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x203fff, SM_RAM); + SekMapMemory(DrvPalRAM2, 0x400400, 0x400fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0x600000, 0x61ffff, SM_RAM); + SekSetWriteByteHandler(0, bssoccer_write_byte); + SekSetWriteWordHandler(0, bssoccer_write_word); + SekSetReadByteHandler(0, bssoccer_read_byte); + SekSetReadWordHandler(0, bssoccer_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM0); + ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM0); + ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM0); + ZetSetWriteHandler(bssoccer_sound0_write); + ZetSetReadHandler(bssoccer_sound0_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM1); + ZetMapArea(0x1000, 0xffff, 0, DrvZ80ROM1 + 0x1000); + ZetMapArea(0x1000, 0xffff, 2, DrvZ80ROM1 + 0x1000); + ZetSetInHandler(bssoccer_sound1_in); + ZetSetOutHandler(bssoccer_sound1_out); + ZetClose(); + + ZetInit(2); + ZetOpen(2); + ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM2); + ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM2); + ZetMapArea(0x1000, 0xffff, 0, DrvZ80ROM2 + 0x1000); + ZetMapArea(0x1000, 0xffff, 2, DrvZ80ROM2 + 0x1000); + ZetSetInHandler(bssoccer_sound2_in); + ZetSetOutHandler(bssoccer_sound2_out); + ZetClose(); + + BurnYM2151Init(3579545); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.20, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.20, BURN_SND_ROUTE_RIGHT); + + DACInit(0, 0, 1, bssoccerSyncDAC); + DACInit(1, 0, 1, bssoccerSyncDAC); + DACInit(2, 0, 1, bssoccerSyncDAC); + DACInit(3, 0, 1, bssoccerSyncDAC); + DACSetRoute(0, 0.40, BURN_SND_ROUTE_LEFT); + DACSetRoute(1, 0.40, BURN_SND_ROUTE_RIGHT); + DACSetRoute(2, 0.40, BURN_SND_ROUTE_LEFT); + DACSetRoute(3, 0.40, BURN_SND_ROUTE_RIGHT); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + BurnFree (AllMem); + + if (game_select) { + BurnYM2151Exit(); + } else { + AY8910Exit(0); + BurnYM3526Exit(); + } + + DACExit(); + + SekExit(); + ZetExit(); + + GenericTilesExit(); + + return 0; +} + + +//------------------------------------------------------------------------------------------------- +// Drawing & CPU/sound emulation routines + + +static void draw_sprites(UINT16 *sprites, UINT8 *gfx_base, INT32 max_tile) +{ + INT32 offs; + + INT32 max_x = (256 - 0) - 8; + INT32 max_y = (256 - 0) - 8; + + for (offs = 0xfc00/2; offs < 0x10000/2 ; offs += 4/2) + { + INT32 srcpg, srcx,srcy, dimx,dimy; + INT32 tile_x, tile_xinc, tile_xstart; + INT32 tile_y, tile_yinc; + INT32 dx, dy; + INT32 flipx, y0; + + INT32 y = BURN_ENDIAN_SWAP_INT16(sprites[ offs + 0 + 0x00000 / 2 ]); + INT32 x = BURN_ENDIAN_SWAP_INT16(sprites[ offs + 1 + 0x00000 / 2 ]); + INT32 dim = BURN_ENDIAN_SWAP_INT16(sprites[ offs + 0 + 0x10000 / 2 ]); + + INT32 bank = (x >> 12) & 0xf; + + srcpg = ((y & 0xf000) >> 12) + ((x & 0x0200) >> 5); + srcx = ((y >> 8) & 0xf) * 2; + srcy = ((dim >> 0) & 0xf) * 2; + + switch ( (dim >> 4) & 0xc ) + { + case 0x0: dimx = 2; dimy = 2; y0 = 0x100; break; + case 0x4: dimx = 4; dimy = 4; y0 = 0x100; break; + case 0x8: dimx = 2; dimy = 32; y0 = 0x130; break; + default: + case 0xc: dimx = 4; dimy = 32; y0 = 0x120; break; + } + + if (dimx==4) { flipx = srcx & 2; srcx &= ~2; } + else { flipx = 0; } + + x = (x & 0xff) - (x & 0x100); + y = (y0 - (y & 0xff) - dimy*8 ) & 0xff; + + if (flipx) { tile_xstart = dimx-1; tile_xinc = -1; } + else { tile_xstart = 0; tile_xinc = +1; } + + tile_y = 0; tile_yinc = +1; + + for (dy = 0; dy < dimy * 8; dy += 8) + { + tile_x = tile_xstart; + + for (dx = 0; dx < dimx * 8; dx += 8) + { + INT32 addr = (srcpg * 0x20 * 0x20) + + ((srcx + tile_x) & 0x1f) * 0x20 + + ((srcy + tile_y) & 0x1f); + + INT32 tile = BURN_ENDIAN_SWAP_INT16(sprites[ addr + 0x00000 / 2 ]); + INT32 color = BURN_ENDIAN_SWAP_INT16(sprites[ addr + 0x10000 / 2 ]); + + INT32 sx = x + dx; + INT32 sy = (y + dy) & 0xff; + + INT32 tile_flipx = tile & 0x4000; + INT32 tile_flipy = tile & 0x8000; + + if (flipx) tile_flipx ^= 0x4000; + + if (flipscreen) + { + sx = max_x - sx; + sy = max_y - sy; + tile_flipx ^= 0x4000; + tile_flipy ^= 0x8000; + } + + tile = (tile & 0x3fff) | (bank << 14); + color += (color_bank << 4); + color &= 0x7f; + tile %= max_tile; + + sy -= 16; + + tile_x += tile_xinc; + + if (sy < -15 || sy > (nScreenHeight - 1) || sx < -15 || sx > (nScreenWidth - 1)) { + continue; + } + + if (tile_flipy) { + if (tile_flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, tile, sx, sy, color, 4, 0x0f, 0, gfx_base); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, tile, sx, sy, color, 4, 0x0f, 0, gfx_base); + } + } else { + if (tile_flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, tile, sx, sy, color, 4, 0x0f, 0, gfx_base); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, tile, sx, sy, color, 4, 0x0f, 0, gfx_base); + } + } + } + + tile_y += tile_yinc; + } + + } + +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x1000; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0xff; + } + + draw_sprites((UINT16*)DrvSprRAM0, DrvGfxROM0, nGfxROM0Len); + if (!game_select) { + draw_sprites((UINT16*)DrvSprRAM1, DrvGfxROM1, 0x20000); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static inline void AssembleInputs() +{ + memset (DrvInputs, 0xff, 6 * sizeof(UINT16)); + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= DrvJoy1[i] << i; + DrvInputs[1] ^= DrvJoy2[i] << i; + DrvInputs[2] ^= DrvJoy3[i] << i; + DrvInputs[3] ^= DrvJoy4[i] << i; + DrvInputs[4] ^= DrvJoy5[i] << i; + DrvInputs[5] ^= DrvJoy6[i] << i; + } + + switch (game_select) + { + case 0: // bestbest + { + DrvInputs[2] = (DrvDips[1] << 8) | DrvDips[0]; + } + return; + + case 1: // sunaq + { + DrvInputs[2] = DrvDips[0]; + } + return; + + case 2: // uballoon + { + DrvInputs[1] = (DrvInputs[1] & 0xff) | (DrvDips[0] << 8); + DrvInputs[2] = DrvDips[1]; + DrvInputs[3] = DrvDips[2]; + } + return; + + case 3: // bssoccer + { + DrvInputs[4] = (DrvDips[1] << 8) | DrvDips[0]; + DrvInputs[5] = ((DrvInputs[5] & 0xfe) | (DrvDips[2] & 0x01)) | 0xff00; + } + return; + } + + return; +} + +static INT32 BestbestFrame() +{ + INT32 nCyclesTotal[3]; + + INT32 nInterleave = 50; + INT32 nSoundBufferPos = 0; + + if (DrvReset) { + DrvDoReset(); + } + + AssembleInputs(); + + nCyclesTotal[0] = 6000000 / 60; + nCyclesTotal[1] = 6000000 / 60; + nCyclesTotal[2] = 6000000 / 60; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + + SekRun(nCyclesTotal[0] / nInterleave); + if (i == (nInterleave / 2)-1) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + if (i == (nInterleave )-1) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + + ZetOpen(0); + BurnTimerUpdateYM3526(i * (nCyclesTotal[1] / nInterleave)); + ZetClose(); + + ZetOpen(1); + ZetRun(nCyclesTotal[2] / nInterleave); + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pSoundBuffer + (nSoundBufferPos << 1); + + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + + nSoundBufferPos += nSegmentLength; + } + } + SekClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pSoundBuffer + (nSoundBufferPos << 1); + + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + + ZetOpen(0); + BurnTimerEndFrameYM3526(nCyclesTotal[1]); + if (pBurnSoundOut) { + BurnYM3526Update(pBurnSoundOut, nBurnSoundLen); + for (INT32 i = 0; i < nBurnSoundLen; i++) { + pBurnSoundOut[(i << 1) + 0] += pSoundBuffer[(i << 1) + 0]; + pBurnSoundOut[(i << 1) + 1] += pSoundBuffer[(i << 1) + 1]; + } + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 SunaqFrame() +{ + INT32 nInterleave = 50; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[3]; + + if (DrvReset) { + DrvDoReset(); + } + + AssembleInputs(); + + nCyclesTotal[0] = 6000000 / 60; + nCyclesTotal[1] = 3579500 / 60; + nCyclesTotal[2] = 6000000 / 60; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + SekRun(nCyclesTotal[0] / nInterleave); + if (i == (nInterleave )-1) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + for (INT32 j = 0; j < 2; j++) { + ZetOpen(j); + ZetRun(nCyclesTotal[j+1] / nInterleave); + ZetClose(); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + + nSoundBufferPos += nSegmentLength; + } + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 UballoonFrame() +{ + INT32 nInterleave = 50; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[3]; + + if (DrvReset) { + DrvDoReset(); + } + + AssembleInputs(); + + nCyclesTotal[0] = 8000000 / 60; + nCyclesTotal[1] = 3579500 / 60; + nCyclesTotal[2] = 5000000 / 60; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + SekRun(nCyclesTotal[0] / nInterleave); + if (i == (nInterleave )-1) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + for (INT32 j = 0; j < 2; j++) { + ZetOpen(j); + ZetRun(nCyclesTotal[j+1] / nInterleave); + ZetClose(); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + +static INT32 BssoccerFrame() +{ + INT32 nInterleave = 50; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[4]; + + if (DrvReset) { + DrvDoReset(); + } + + AssembleInputs(); + + nCyclesTotal[0] = 8000000 / 60; + nCyclesTotal[1] = 3579500 / 60; + nCyclesTotal[2] = 5000000 / 60; + nCyclesTotal[3] = 5000000 / 60; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + SekRun(nCyclesTotal[0] / nInterleave); + if (i == (nInterleave / 2)-1) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + if (i == (nInterleave )-1) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + for (INT32 j = 0; j < 3; j++) { + ZetOpen(j); + ZetRun(nCyclesTotal[j+1] / nInterleave); + ZetClose(); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029692; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + DACScan(nAction, pnMin); + + if (game_select) { + BurnYM2151Scan(nAction); + } else { + AY8910Scan(nAction, pnMin); + } + + SCAN_VAR(soundlatch); + SCAN_VAR(soundlatch2); + SCAN_VAR(soundlatch3); + SCAN_VAR(flipscreen); + SCAN_VAR(color_bank); + SCAN_VAR(bestofbest_prot); + + SCAN_VAR(z80bankdata[0]); + SCAN_VAR(z80bankdata[1]); + } + + if (game_select == 3) { + ZetOpen(1); + bssoccer_bankswitch_w(DrvZ80ROM1, 0, z80bankdata[0]); + ZetClose(); + ZetOpen(2); + bssoccer_bankswitch_w(DrvZ80ROM2, 1, z80bankdata[1]); + ZetClose(); + } + + if (game_select == 2) { + ZetOpen(1); + uballoon_bankswitch(z80bankdata[0]); + ZetClose(); + } + + return 0; +} + + + +//------------------------------------------------------------------------------------------------- +// Drivers + + +// Best Of Best + +static struct BurnRomInfo bestbestRomDesc[] = { + { "4.bin", 0x20000, 0x06741994, 1 | BRF_ESS | BRF_PRG }, // 0 - 68K Code + { "2.bin", 0x20000, 0x42843dec, 1 | BRF_ESS | BRF_PRG }, // 1 + { "3.bin", 0x80000, 0xe2bb8f26, 1 | BRF_ESS | BRF_PRG }, // 2 + { "1.bin", 0x80000, 0xd365e20a, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "5.bin", 0x10000, 0xbb9265e6, 2 | BRF_ESS | BRF_PRG }, // 4 - Z80 #0 Code + + { "6.bin", 0x10000, 0xdd445f6b, 3 | BRF_ESS | BRF_PRG }, // 5 - Z80 #1 Code + + { "9.bin", 0x80000, 0xb11994ea, 5 | BRF_GRA }, // 6 - Sprites (Chip 0) + { "10.bin", 0x80000, 0x37b41ef5, 5 | BRF_GRA }, // 7 + { "7.bin", 0x80000, 0x16188b73, 5 | BRF_GRA }, // 8 + { "8.bin", 0x80000, 0x765ce06b, 5 | BRF_GRA }, // 9 + + { "16.bin", 0x80000, 0xdc46cdea, 6 | BRF_GRA }, // 10 - Sprites (Chip 1) + { "17.bin", 0x80000, 0xc6fadd57, 6 | BRF_GRA }, // 11 + { "13.bin", 0x80000, 0x23283ac4, 6 | BRF_GRA }, // 12 + { "18.bin", 0x80000, 0x674c4609, 6 | BRF_GRA }, // 13 + { "14.bin", 0x80000, 0xc210fb53, 6 | BRF_GRA }, // 14 + { "15.bin", 0x80000, 0x3b1166c7, 6 | BRF_GRA }, // 15 + { "11.bin", 0x80000, 0x323eebc3, 6 | BRF_GRA }, // 16 + { "12.bin", 0x80000, 0xca7c8176, 6 | BRF_GRA }, // 17 + + { "82s129.5", 0x00100, 0x10bfcebb, 0 | BRF_OPT }, // 18 - PROMs (not used) + { "82s129.6", 0x00100, 0x10bfcebb, 0 | BRF_OPT }, // 19 +}; + +STD_ROM_PICK(bestbest) +STD_ROM_FN(bestbest) + +struct BurnDriver BurnDrvBestbest = { + "bestbest", NULL, NULL, NULL, "1994", + "Best Of Best\0", NULL, "SunA", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, bestbestRomInfo, bestbestRomName, NULL, NULL, BestbestInputInfo, bestbestDIPInfo, + BestbestInit, DrvExit, BestbestFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// SunA Quiz 6000 Academy (940620-6) + +static struct BurnRomInfo sunaqRomDesc[] = { + { "prog2.bin", 0x80000, 0xa92bce45, 1 | BRF_ESS | BRF_PRG }, // 0 - 68K Code + { "prog1.bin", 0x80000, 0xff690e7e, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "audio1.bin", 0x10000, 0x3df42f82, 2 | BRF_ESS | BRF_PRG }, // 2 - Z80 #0 Code + + { "audio2.bin", 0x80000, 0xcac85ba9, 3 | BRF_ESS | BRF_PRG }, // 3 - Z80 #1 Code + + { "gfx1.bin", 0x80000, 0x0bde5acf, 5 | BRF_GRA }, // 4 - Sprites + { "gfx2.bin", 0x80000, 0x24b74826, 5 | BRF_GRA }, // 5 +}; + +STD_ROM_PICK(sunaq) +STD_ROM_FN(sunaq) + +struct BurnDriver BurnDrvSunaq = { + "sunaq", NULL, NULL, NULL, "1994", + "SunA Quiz 6000 Academy (940620-6)\0", NULL, "SunA", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, + NULL, sunaqRomInfo, sunaqRomName, NULL, NULL, SunaqInputInfo, sunaqDIPInfo, + SunaqInit, DrvExit, SunaqFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Ultra Balloon + +static struct BurnRomInfo uballoonRomDesc[] = { + { "prg2.rom", 0x80000, 0x72ab80ea, 1 | BRF_ESS | BRF_PRG }, // 0 - 68K Code + { "prg1.rom", 0x80000, 0x27a04f55, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "audio1.rom", 0x10000, 0xc771f2b4, 2 | BRF_ESS | BRF_PRG }, // 2 - Z80 #0 Code + + { "audio2.rom", 0x20000, 0xc7f75347, 3 | BRF_ESS | BRF_PRG }, // 3 - Z80 #1 Code + + { "gfx1.rom", 0x80000, 0xfd2ec297, 5 | BRF_GRA }, // 4 - Sprites + { "gfx2.rom", 0x80000, 0x6307aa60, 5 | BRF_GRA }, // 5 + { "gfx3.rom", 0x80000, 0x718f3150, 5 | BRF_GRA }, // 6 + { "gfx4.rom", 0x80000, 0xaf7e057e, 5 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(uballoon) +STD_ROM_FN(uballoon) + +struct BurnDriver BurnDrvUballoon = { + "uballoon", NULL, NULL, NULL, "1996", + "Ultra Balloon\0", NULL, "SunA", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, uballoonRomInfo, uballoonRomName, NULL, NULL, UballoonInputInfo, uballoonDIPInfo, + UballoonInit, DrvExit, UballoonFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; + + +// Back Street Soccer + +static struct BurnRomInfo bssoccerRomDesc[] = { + { "02", 0x080000, 0x32871005, 1 | BRF_ESS | BRF_PRG }, // 0 - 68K Code + { "01", 0x080000, 0xace00db6, 1 | BRF_ESS | BRF_PRG }, // 1 + { "04", 0x080000, 0x25ee404d, 1 | BRF_ESS | BRF_PRG }, // 2 + { "03", 0x080000, 0x1a131014, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "11", 0x010000, 0xdf7ae9bc, 2 | BRF_ESS | BRF_PRG }, // 4 - Z80 #0 Code + + { "13", 0x080000, 0x2b273dca, 3 | BRF_ESS | BRF_PRG }, // 5 - Z80 #1 Code + + { "12", 0x080000, 0x6b73b87b, 4 | BRF_ESS | BRF_PRG }, // 6 - Z80 #0 Code + + { "05", 0x080000, 0xa5245bd4, 5 | BRF_GRA }, // 7 - Sprites + { "07", 0x080000, 0xfdb765c2, 5 | BRF_GRA }, // 8 + { "09", 0x080000, 0x0e82277f, 5 | BRF_GRA }, // 9 + { "06", 0x080000, 0xd42ce84b, 5 | BRF_GRA }, // 10 + { "08", 0x080000, 0x96cd2136, 5 | BRF_GRA }, // 11 + { "10", 0x080000, 0x1ca94d21, 5 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(bssoccer) +STD_ROM_FN(bssoccer) + +struct BurnDriver BurnDrvBssoccer = { + "bssoccer", NULL, NULL, NULL, "1996", + "Back Street Soccer\0", "graphics issues?", "SunA", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_MISC_POST90S, GBF_SPORTSFOOTBALL, 0, + NULL, bssoccerRomInfo, bssoccerRomName, NULL, NULL, BssoccerInputInfo, bssoccerDIPInfo, + BssoccerInit, DrvExit, BssoccerFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000, + 256, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_taotaido.cpp b/src/burn/drv/pst90s/d_taotaido.cpp index 627aff242..b30cb0ecf 100644 --- a/src/burn/drv/pst90s/d_taotaido.cpp +++ b/src/burn/drv/pst90s/d_taotaido.cpp @@ -1,1031 +1,1030 @@ -// FB Alpha "Tao Taido" driver module -// Based on MAME driver by David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2610.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *DrvPalRAM; -static UINT8 *DrvBgRAM; -static UINT8 *DrvSprRAM0; -static UINT8 *DrvSprRAM1; -static UINT8 *DrvSpr0Buf0; -static UINT8 *DrvSpr1Buf0; -static UINT8 *DrvSpr0Buf1; -static UINT8 *DrvSpr1Buf1; -static UINT8 *DrvScrollRAM; -static UINT8 *taotaido_tileregs; -static UINT8 *taotaido_spritebank; -static UINT32 *DrvPalette; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvDip[4]; -static UINT16 DrvInps[5]; -static UINT8 DrvReset; - -static UINT8 *nDrvZ80Bank; -static UINT8 *pending_command; -static UINT8 *soundlatch; - -static INT32 nCyclesTotal[2]; - -static struct BurnInputInfo TaotaidoInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 6, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 5, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDip + 2, "dip" }, - {"Region", BIT_DIPSWITCH, DrvDip + 3, "dip" }, -}; - -STDINPUTINFO(Taotaido) - -static struct BurnInputInfo TaotaidoaInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Weak Punch", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Medium Punch", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Strong Punch", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - {"P1 Weak Kick", BIT_DIGITAL, DrvJoy4 + 0, "p1 fire 4" }, - {"P1 Medium Kick", BIT_DIGITAL, DrvJoy4 + 1, "p1 fire 5" }, - {"P1 Strong Kick", BIT_DIGITAL, DrvJoy4 + 2, "p1 fire 6" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Weak Punch", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Medium Punch", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Strong Punch", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - {"P2 Weak Kick", BIT_DIGITAL, DrvJoy5 + 0, "p2 fire 4" }, - {"P2 Medium Kick", BIT_DIGITAL, DrvJoy5 + 1, "p2 fire 5" }, - {"P2 Strong Kick", BIT_DIGITAL, DrvJoy5 + 2, "p2 fire 6" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 6, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 5, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDip + 2, "dip" }, - {"Region", BIT_DIPSWITCH, DrvDip + 3, "dip" }, -}; - -STDINPUTINFO(Taotaidoa) - -static struct BurnDIPInfo TaotaidoDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - {0x18, 0xff, 0xff, 0x08, NULL }, - - {0 , 0xfe, 0 , 2, "Coin Slot" }, - {0x15, 0x01, 0x01, 0x01, "Same" }, - {0x15, 0x01, 0x01, 0x00, "Individual" }, - - // Coinage condition: Coin Slot Individual - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x15, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, - {0x15, 0x00, 0x01, 0x00, NULL}, - {0x15, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, - {0x15, 0x00, 0x01, 0x00, NULL}, - {0x15, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, - {0x15, 0x00, 0x01, 0x00, NULL}, - {0x15, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, - {0x15, 0x00, 0x01, 0x00, NULL}, - {0x15, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, - {0x15, 0x00, 0x01, 0x00, NULL}, - {0x15, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, - {0x15, 0x00, 0x01, 0x00, NULL}, - {0x15, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, - {0x15, 0x00, 0x01, 0x00, NULL}, - {0x15, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, - {0x15, 0x00, 0x01, 0x00, NULL}, - - // Coin 1 condition: Coin Slot Same - {0 , 0xfe, 0 , 8, "Coin 1" }, - {0x15, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - - // Coin 2 condition: Coin Slot Same - {0 , 0xfe, 0 , 8, "Coin 2" }, - {0x15, 0x02, 0x70, 0x50, "3 Coins 1 Credit" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x70, 0x40, "1 Coin 2 Credits" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x70, 0x30, "1 Coin 3 Credits" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x70, 0x20, "1 Coin 4 Credits" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x70, 0x10, "1 Coin 5 Credits" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x70, 0x00, "1 Coin 6 Credits" }, - {0x15, 0x00, 0x01, 0x01, NULL}, - - {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x16, 0x01, 0x01, 0x01, "Off" }, -// {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x16, 0x01, 0x02, 0x00, "Off" }, - {0x16, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x18, 0x10, "Easy" }, - {0x16, 0x01, 0x18, 0x18, "Normal" }, - {0x16, 0x01, 0x18, 0x08, "Hard" }, - {0x16, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x16, 0x01, 0x20, 0x20, "Off" }, - {0x16, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Join In (1 Credit)" }, - {0x17, 0x01, 0x01, 0x00, "Off" }, - {0x17, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2, "Buy In" }, - {0x17, 0x01, 0x02, 0x00, "No" }, - {0x17, 0x01, 0x02, 0x02, "Yes" }, - - {0 , 0xfe, 0 , 5, "Country" }, - {0x18, 0x01, 0x0f, 0x00, "US" }, - {0x18, 0x01, 0x0f, 0x01, "Japan" }, - {0x18, 0x01, 0x0f, 0x02, "Hong-Kong/Taiwan" }, - {0x18, 0x01, 0x0f, 0x04, "Korea" }, - {0x18, 0x01, 0x0f, 0x08, "World" }, -}; - -STDDIPINFO(Taotaido) - -static struct BurnDIPInfo TaotaidoaDIPList[]= -{ - // Default Values - {0x1b, 0xff, 0xff, 0xff, NULL }, - {0x1c, 0xff, 0xff, 0xff, NULL }, - {0x1d, 0xff, 0xff, 0xff, NULL }, - {0x1e, 0xff, 0xff, 0x08, NULL }, - - {0 , 0xfe, 0 , 2, "Coin Slot" }, - {0x1b, 0x01, 0x01, 0x01, "Same" }, - {0x1b, 0x01, 0x01, 0x00, "Individual" }, - - // Coinage condition: Coin Slot Individual - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x1b, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, - {0x1b, 0x00, 0x01, 0x00, NULL}, - {0x1b, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, - {0x1b, 0x00, 0x01, 0x00, NULL}, - {0x1b, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, - {0x1b, 0x00, 0x01, 0x00, NULL}, - {0x1b, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, - {0x1b, 0x00, 0x01, 0x00, NULL}, - {0x1b, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, - {0x1b, 0x00, 0x01, 0x00, NULL}, - {0x1b, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, - {0x1b, 0x00, 0x01, 0x00, NULL}, - {0x1b, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, - {0x1b, 0x00, 0x01, 0x00, NULL}, - {0x1b, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, - {0x1b, 0x00, 0x01, 0x00, NULL}, - - // Coin 1 condition: Coin Slot Same - {0 , 0xfe, 0 , 8, "Coin 1" }, - {0x1b, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - - // Coin 2 condition: Coin Slot Same - {0 , 0xfe, 0 , 8, "Coin 2" }, - {0x1b, 0x02, 0x70, 0x50, "3 Coins 1 Credit" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x70, 0x40, "1 Coin 2 Credits" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x70, 0x30, "1 Coin 3 Credits" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x70, 0x20, "1 Coin 4 Credits" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x70, 0x10, "1 Coin 5 Credits" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - {0x1b, 0x02, 0x70, 0x00, "1 Coin 6 Credits" }, - {0x1b, 0x00, 0x01, 0x01, NULL}, - - {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, - {0x1b, 0x01, 0x80, 0x80, "Off" }, - {0x1b, 0x01, 0x80, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x1c, 0x01, 0x01, 0x01, "Off" }, -// {0x1c, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x1c, 0x01, 0x02, 0x00, "Off" }, - {0x1c, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x1c, 0x01, 0x04, 0x04, "Off" }, - {0x1c, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x1c, 0x01, 0x18, 0x10, "Easy" }, - {0x1c, 0x01, 0x18, 0x18, "Normal" }, - {0x1c, 0x01, 0x18, 0x08, "Hard" }, - {0x1c, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x1c, 0x01, 0x20, 0x20, "Off" }, - {0x1c, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Join In (1 Credit)" }, - {0x1d, 0x01, 0x01, 0x01, "Off" }, - {0x1d, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Buy In" }, - {0x1d, 0x01, 0x02, 0x00, "No" }, - {0x1d, 0x01, 0x02, 0x02, "Yes" }, - - {0 , 0xfe, 0 , 5, "Country" }, - {0x1e, 0x01, 0x0f, 0x00, "US" }, - {0x1e, 0x01, 0x0f, 0x01, "Japan" }, - {0x1e, 0x01, 0x0f, 0x02, "Hong-Kong/Taiwan" }, - {0x1e, 0x01, 0x0f, 0x04, "Korea" }, - {0x1e, 0x01, 0x0f, 0x08, "World" }, -}; - -STDDIPINFO(Taotaidoa) - -static void palette_write(INT32 offset) -{ - UINT8 r, g, b; - UINT16 data = *((UINT16*)(DrvPalRAM + offset)); - - r = (data >> 10) & 0x1f; - r = (r << 3) | (r >> 2); - g = (data >> 5) & 0x1f; - g = (g << 3) | (g >> 2); - b = (data >> 0) & 0x1f; - b = (b << 3) | (b >> 2); - - DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); -} - -UINT8 __fastcall taotaido_read_byte(UINT32 address) -{ - if (address < 0xffff00) return 0; - - switch (address) - { - case 0xffff80: - case 0xffff81: - return DrvInps[0] >> ((~address & 1) << 3); - - case 0xffff82: - case 0xffff83: - return DrvInps[1] >> ((~address & 1) << 3); - - case 0xffff84: - case 0xffff85: - return DrvInps[2] >> ((~address & 1) << 3); - - case 0xffff87: - return DrvDip[0]; - - case 0xffff89: - return DrvDip[1]; - - case 0xffff8b: - return DrvDip[2]; - - case 0xffff8f: - return DrvDip[3]; - - case 0xffffa0: // p3 - case 0xffffa1: - return DrvInps[3] >> ((~address & 1) << 3); - - case 0xffffa2: // p4 - case 0xffffa3: - return DrvInps[4] >> ((~address & 1) << 3); - - case 0xffffe1: - return *pending_command; - } - - return 0; -} - -UINT16 __fastcall taotaido_read_word(UINT32 address) -{ - if (address < 0xffff00) return 0; - - switch (address) - { - case 0xffff80: - return DrvInps[0]; - - case 0xffff82: - return DrvInps[1]; - - case 0xffff84: - return DrvInps[2]; - - case 0xffffa0: // p3 - return DrvInps[3]; - - case 0xffffa2: // p4 - return DrvInps[4]; - } - - return 0; -} - -void __fastcall taotaido_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfff000) == 0xffc000) { - DrvPalRAM[(address & 0xfff) ^ 1] = data; - palette_write(address & 0xffe); - return; - } - - if (address < 0xffff00) return; - - switch (address) - { - case 0xffff08: - case 0xffff09: - case 0xffff0a: - case 0xffff0b: - case 0xffff0c: - case 0xffff0d: - case 0xffff0e: - case 0xffff0f: - taotaido_tileregs[address & 0x07] = data; - return; - - case 0xffff40: - case 0xffff41: - case 0xffff42: - case 0xffff43: - case 0xffff44: - case 0xffff45: - case 0xffff46: - case 0xffff47: - taotaido_spritebank[address & 7] = data; - return; - - case 0xffffc1: - { - INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]); - if (nCycles <= ZetTotalCycles()) return; - - BurnTimerUpdate(nCycles); - - *pending_command = 1; - *soundlatch = data; - ZetNmi(); - } - return; - } -} - -void __fastcall taotaido_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfff000) == 0xffc000) { - *((UINT16*)(DrvPalRAM + (address & 0xffe))) = data; - palette_write(address & 0xffe); - return; - } - - if (address < 0xffff00) return; - - switch (address) - { - case 0xffff08: - case 0xffff0a: - case 0xffff0c: - case 0xffff0e: - *((UINT16*)(taotaido_tileregs + (address & 0x06))) = data; - return; - - case 0xffff40: - case 0xffff42: - case 0xffff44: - case 0xffff46: - *((UINT16*)(taotaido_spritebank + (address & 6))) = data; - return; - } -} - -static void taotaido_sound_bankswitch(INT32 data) -{ - *nDrvZ80Bank = data & 3; - - ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + 0x8000 * *nDrvZ80Bank); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + 0x8000 * *nDrvZ80Bank); -} - -void __fastcall taotaido_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - BurnYM2610Write(port & 3, data); - return; - - case 0x04: - if (*nDrvZ80Bank != (data & 3)) { - taotaido_sound_bankswitch(data); - } - return; - - case 0x08: - *pending_command = 0; - return; - } -} - -UINT8 __fastcall taotaido_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return BurnYM2610Read(0); - - - case 0x02: - return BurnYM2610Read(2); - - case 0x0c: - return *soundlatch; - } - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[ 4] = { - 0x000, 0x001, 0x002, 0x003 - }; - - INT32 XOffs[16] = { - 0x004, 0x000, 0x00c, 0x008, 0x014, 0x010, 0x01c, 0x018, - 0x024, 0x020, 0x02c, 0x028, 0x034, 0x030, 0x03c, 0x038 - }; - - INT32 YOffs[16] = { - 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, - 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 - }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x600000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x600000); - - GfxDecode(0xc000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x200000); - - GfxDecode(0x4000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - taotaido_sound_bankswitch(1); - ZetClose(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x100000; - DrvZ80ROM = Next; Next += 0x020000; - - DrvGfxROM0 = Next; Next += 0xc00000; - DrvGfxROM1 = Next; Next += 0x400000; - - DrvSndROM0 = Next; Next += 0x100000; - DrvSndROM1 = Next; Next += 0x200000; - - DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x001000; - DrvBgRAM = Next; Next += 0x004000; - DrvSprRAM0 = Next; Next += 0x002000; - DrvSprRAM1 = Next; Next += 0x010000; - DrvScrollRAM = Next; Next += 0x000400; - DrvSpr0Buf0 = Next; Next += 0x002000; - DrvSpr1Buf0 = Next; Next += 0x010000; - DrvSpr0Buf1 = Next; Next += 0x002000; - DrvSpr1Buf1 = Next; Next += 0x010000; - - taotaido_tileregs = Next; Next += 0x000010; - taotaido_spritebank = Next; Next += 0x000010; - - pending_command = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - nDrvZ80Bank = Next; Next += 0x000001; - - DrvZ80RAM = Next; Next += 0x000800; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void taotaidoFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 taotaidoSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 5000000; -} - -static double taotaidoGetTime() -{ - return (double)ZetTotalCycles() / 5000000.0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; - if (BurnLoadRom(Drv68KROM + 0x080000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x400000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x000000, 8, 1)) return 1; - - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(DrvBgRAM, 0x800000, 0x803fff, SM_RAM); - SekMapMemory(DrvSprRAM0, 0xa00000, 0xa01fff, SM_RAM); - SekMapMemory(DrvSprRAM1, 0xc00000, 0xc0ffff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xfe0000, 0xfeffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xffc000, 0xffcfff, SM_ROM); - SekMapMemory(DrvScrollRAM, 0xffe000, 0xffe3ff, SM_RAM); - SekSetWriteByteHandler(0, taotaido_write_byte); - SekSetWriteWordHandler(0, taotaido_write_word); - SekSetReadByteHandler(0, taotaido_read_byte); - SekSetReadWordHandler(0, taotaido_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x77ff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x77ff, 2, DrvZ80ROM); - ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); - ZetSetInHandler(taotaido_sound_in); - ZetSetOutHandler(taotaido_sound_out); - ZetMemEnd(); - ZetClose(); - - INT32 nDrvSndROM0Size = 0x100000; - INT32 nDrvSndROM1Size = 0x200000; - BurnYM2610Init(8000000, DrvSndROM1, &nDrvSndROM1Size, DrvSndROM0, &nDrvSndROM0Size, &taotaidoFMIRQHandler, taotaidoSynchroniseStream, taotaidoGetTime, 0); - BurnTimerAttachZet(5000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM2610Exit(); - - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_layer() -{ - UINT16 *vram = (UINT16*)DrvBgRAM; - UINT16 *scroll = (UINT16*)DrvScrollRAM; - - for (INT32 line = 0; line < 224; line++) - { - INT32 scrolly = ((scroll[(line << 1) | 1] >> 4) + 0) & 0x3ff; - INT32 scrollx = ((scroll[(line << 1) | 0] >> 4) + 30) & 0x7ff; - - INT32 sy = scrolly >> 4; - - for (INT32 col = 0; col < (320 / 16) + 1; col++) - { - INT32 sx = (scrollx >> 4) + col; - INT32 ofst = (sy << 6) + (sx & 0x3f) + ((sx & 0x40) << 6); - - INT32 code = vram[ofst]; - INT32 bank = (code >> 9) & 7; - INT32 color = ((code >> 12) << 4) | 0x300; - - code = (code & 0x1ff) | (taotaido_tileregs[bank] << 9); - - UINT8 *src = DrvGfxROM1 + (code << 8) + ((scrolly & 0x0f) << 4); - - for (INT32 x = 0; x < 16; x++) { - INT32 xx = (x + (col << 4)) - (scrollx & 0x0f); - if (xx < 0 || xx >= nScreenWidth) continue; - pTransDraw[(line * nScreenWidth) + xx] = src[x] | color; - } - } - } -} - -static void draw_sprite(INT32 spriteno) -{ - UINT16 *source = (UINT16*)DrvSpr0Buf1; - UINT16 *source1 = (UINT16*)DrvSpr1Buf1; - source += spriteno*4; - - INT32 yzoom = (source[0] & 0xf000) >> 12; - INT32 xzoom = (source[1] & 0xf000) >> 12; - - INT32 ysize = (source[0] & 0x0e00) >> 9; - INT32 xsize = (source[1] & 0x0e00) >> 9; - - INT32 ypos = source[0] & 0x01ff; - INT32 xpos = source[1] & 0x01ff; - - INT32 yflip = source[2] & 0x8000; - INT32 xflip = source[2] & 0x4000; - INT32 color = (source[2] & 0x1f00) >> 8; - - INT32 tile = source[3] & 0xffff; - - xpos += (xsize*xzoom+2)/4; - ypos += (ysize*yzoom+2)/4; - - xzoom = 32 - xzoom; - yzoom = 32 - yzoom; - - for (INT32 y = 0;y <= ysize;y++) - { - INT32 sx,sy; - - if (yflip) sy = ((ypos + yzoom * (ysize - y)/2 + 16) & 0x1ff) - 16; - else sy = ((ypos + yzoom * y / 2 + 16) & 0x1ff) - 16; - - for (INT32 x = 0;x <= xsize;x++) - { - INT32 realtile = source1[tile & 0x7fff]; - - if (realtile > 0x3fff) - { - INT32 block; - - block = (realtile & 0x3800)>>11; - - realtile &= 0x07ff; - realtile |= taotaido_spritebank[block] * 0x800; - } - - if (xflip) sx = ((xpos + xzoom * (xsize - x) / 2 + 16) & 0x1ff) - 16; - else sx = ((xpos + xzoom * x / 2 + 16) & 0x1ff) - 16; - - if (yflip) { - if (xflip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, realtile, sx, sy, color, 4, 15, 0, DrvGfxROM0); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, realtile, sx, sy, color, 4, 15, 0, DrvGfxROM0); - } - } else { - if (xflip) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, realtile, sx, sy, color, 4, 15, 0, DrvGfxROM0); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, realtile, sx, sy, color, 4, 15, 0, DrvGfxROM0); - } - } - - tile++; - } - } -} - -static void draw_sprites() -{ - UINT16 *source = (UINT16*)DrvSpr0Buf1; - UINT16 *finish = source + 0x2000/2; - - while (source < finish) - { - if (source[0] == 0x4000) break; - - draw_sprite(source[0] & 0x3ff); - - source++; - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x1000; i+=2) { - palette_write(i); - } - } - - draw_layer(); - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - SekNewFrame(); - ZetNewFrame(); - - { - memset (DrvInps, 0xff, 5 * sizeof(UINT16)); - for (INT32 i = 0; i < 8; i++) { - DrvInps[0] ^= (DrvJoy1[i] & 1) << i; - DrvInps[1] ^= (DrvJoy2[i] & 1) << i; - DrvInps[2] ^= (DrvJoy3[i] & 1) << i; - DrvInps[3] ^= (DrvJoy4[i] & 1) << i; - DrvInps[4] ^= (DrvJoy5[i] & 1) << i; - } - } - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = (INT32)(5000000.0 / 60.0); - - SekOpen(0); - ZetOpen(0); - - SekRun(nCyclesTotal[0]); - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrame(nCyclesTotal[1]); - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - memcpy (DrvSpr0Buf1, DrvSpr0Buf0, 0x02000); - memcpy (DrvSpr1Buf1, DrvSpr1Buf0, 0x10000); - memcpy (DrvSpr0Buf0, DrvSprRAM0, 0x02000); - memcpy (DrvSpr1Buf0, DrvSprRAM1, 0x10000); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029698; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2610Scan(nAction, pnMin); - } - - ZetOpen(0); - taotaido_sound_bankswitch(*nDrvZ80Bank); - ZetClose(); - - return 0; -} - - -// Tao Taido (set 1) - -static struct BurnRomInfo taotaidoRomDesc[] = { - { "1-u90.bin", 0x080000, 0xa3ee30da, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "2-u91.bin", 0x080000, 0x30b7e4fb, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "3-u113.bin", 0x020000, 0xa167c4e4, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "u86.bin", 0x200000, 0x908e251e, 3 | BRF_GRA }, // 3 Sprites - { "u87.bin", 0x200000, 0xc4290ba6, 3 | BRF_GRA }, // 4 - { "u88.bin", 0x200000, 0x407d9aeb, 3 | BRF_GRA }, // 5 - - { "u15.bin", 0x200000, 0xe95823e9, 4 | BRF_GRA }, // 6 Background Tiles - - { "u104.bin", 0x100000, 0xe89387a9, 5 | BRF_SND }, // 7 Samples - { "u127.bin", 0x200000, 0x0cf0cb23, 6 | BRF_SND }, // 8 -}; - -STD_ROM_PICK(taotaido) -STD_ROM_FN(taotaido) - -struct BurnDriver BurnDrvTaotaido = { - "taotaido", NULL, NULL, NULL, "1993", - "Tao Taido (set 1)\0", NULL, "Video System Co.", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MISC, 0, - NULL, taotaidoRomInfo, taotaidoRomName, NULL, NULL, TaotaidoInputInfo, TaotaidoDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 224, 4, 3 -}; - - -// Tao Taido (set 2) - -static struct BurnRomInfo taotaidoaRomDesc[] = { - { "tt0-u90.bin", 0x080000, 0x69d4cca7, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "tt1-u91.bin", 0x080000, 0x41025469, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "3-u113.bin", 0x020000, 0xa167c4e4, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "u86.bin", 0x200000, 0x908e251e, 3 | BRF_GRA }, // 3 Sprites - { "u87.bin", 0x200000, 0xc4290ba6, 3 | BRF_GRA }, // 4 - { "u88.bin", 0x200000, 0x407d9aeb, 3 | BRF_GRA }, // 5 - - { "u15.bin", 0x200000, 0xe95823e9, 4 | BRF_GRA }, // 6 Background Tiles - - { "u104.bin", 0x100000, 0xe89387a9, 5 | BRF_SND }, // 7 Samples - { "u127.bin", 0x200000, 0x0cf0cb23, 6 | BRF_SND }, // 8 -}; - -STD_ROM_PICK(taotaidoa) -STD_ROM_FN(taotaidoa) - -struct BurnDriver BurnDrvTaotaidoa = { - "taotaidoa", "taotaido", NULL, NULL, "1993", - "Tao Taido (set 2)\0", NULL, "Video System Co.", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, taotaidoaRomInfo, taotaidoaRomName, NULL, NULL, TaotaidoaInputInfo, TaotaidoaDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 224, 4, 3 -}; +// FB Alpha "Tao Taido" driver module +// Based on MAME driver by David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2610.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *DrvPalRAM; +static UINT8 *DrvBgRAM; +static UINT8 *DrvSprRAM0; +static UINT8 *DrvSprRAM1; +static UINT8 *DrvSpr0Buf0; +static UINT8 *DrvSpr1Buf0; +static UINT8 *DrvSpr0Buf1; +static UINT8 *DrvSpr1Buf1; +static UINT8 *DrvScrollRAM; +static UINT8 *taotaido_tileregs; +static UINT8 *taotaido_spritebank; +static UINT32 *DrvPalette; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvDip[4]; +static UINT16 DrvInps[5]; +static UINT8 DrvReset; + +static UINT8 *nDrvZ80Bank; +static UINT8 *pending_command; +static UINT8 *soundlatch; + +static INT32 nCyclesTotal[2]; + +static struct BurnInputInfo TaotaidoInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 6, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 5, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDip + 2, "dip" }, + {"Region", BIT_DIPSWITCH, DrvDip + 3, "dip" }, +}; + +STDINPUTINFO(Taotaido) + +static struct BurnInputInfo TaotaidoaInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Weak Punch", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Medium Punch", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Strong Punch", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + {"P1 Weak Kick", BIT_DIGITAL, DrvJoy4 + 0, "p1 fire 4" }, + {"P1 Medium Kick", BIT_DIGITAL, DrvJoy4 + 1, "p1 fire 5" }, + {"P1 Strong Kick", BIT_DIGITAL, DrvJoy4 + 2, "p1 fire 6" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Weak Punch", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Medium Punch", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Strong Punch", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + {"P2 Weak Kick", BIT_DIGITAL, DrvJoy5 + 0, "p2 fire 4" }, + {"P2 Medium Kick", BIT_DIGITAL, DrvJoy5 + 1, "p2 fire 5" }, + {"P2 Strong Kick", BIT_DIGITAL, DrvJoy5 + 2, "p2 fire 6" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 6, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 5, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDip + 2, "dip" }, + {"Region", BIT_DIPSWITCH, DrvDip + 3, "dip" }, +}; + +STDINPUTINFO(Taotaidoa) + +static struct BurnDIPInfo TaotaidoDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + {0x18, 0xff, 0xff, 0x08, NULL }, + + {0 , 0xfe, 0 , 2, "Coin Slot" }, + {0x15, 0x01, 0x01, 0x01, "Same" }, + {0x15, 0x01, 0x01, 0x00, "Individual" }, + + // Coinage condition: Coin Slot Individual + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x15, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, + {0x15, 0x00, 0x01, 0x00, NULL}, + {0x15, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, + {0x15, 0x00, 0x01, 0x00, NULL}, + {0x15, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, + {0x15, 0x00, 0x01, 0x00, NULL}, + {0x15, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, + {0x15, 0x00, 0x01, 0x00, NULL}, + {0x15, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, + {0x15, 0x00, 0x01, 0x00, NULL}, + {0x15, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, + {0x15, 0x00, 0x01, 0x00, NULL}, + {0x15, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, + {0x15, 0x00, 0x01, 0x00, NULL}, + {0x15, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, + {0x15, 0x00, 0x01, 0x00, NULL}, + + // Coin 1 condition: Coin Slot Same + {0 , 0xfe, 0 , 8, "Coin 1" }, + {0x15, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + + // Coin 2 condition: Coin Slot Same + {0 , 0xfe, 0 , 8, "Coin 2" }, + {0x15, 0x02, 0x70, 0x50, "3 Coins 1 Credit" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x70, 0x40, "1 Coin 2 Credits" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x70, 0x30, "1 Coin 3 Credits" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x70, 0x20, "1 Coin 4 Credits" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x70, 0x10, "1 Coin 5 Credits" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x70, 0x00, "1 Coin 6 Credits" }, + {0x15, 0x00, 0x01, 0x01, NULL}, + + {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x16, 0x01, 0x01, 0x01, "Off" }, +// {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x16, 0x01, 0x02, 0x00, "Off" }, + {0x16, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x18, 0x10, "Easy" }, + {0x16, 0x01, 0x18, 0x18, "Normal" }, + {0x16, 0x01, 0x18, 0x08, "Hard" }, + {0x16, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x16, 0x01, 0x20, 0x20, "Off" }, + {0x16, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Join In (1 Credit)" }, + {0x17, 0x01, 0x01, 0x00, "Off" }, + {0x17, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2, "Buy In" }, + {0x17, 0x01, 0x02, 0x00, "No" }, + {0x17, 0x01, 0x02, 0x02, "Yes" }, + + {0 , 0xfe, 0 , 5, "Country" }, + {0x18, 0x01, 0x0f, 0x00, "US" }, + {0x18, 0x01, 0x0f, 0x01, "Japan" }, + {0x18, 0x01, 0x0f, 0x02, "Hong-Kong/Taiwan" }, + {0x18, 0x01, 0x0f, 0x04, "Korea" }, + {0x18, 0x01, 0x0f, 0x08, "World" }, +}; + +STDDIPINFO(Taotaido) + +static struct BurnDIPInfo TaotaidoaDIPList[]= +{ + // Default Values + {0x1b, 0xff, 0xff, 0xff, NULL }, + {0x1c, 0xff, 0xff, 0xff, NULL }, + {0x1d, 0xff, 0xff, 0xff, NULL }, + {0x1e, 0xff, 0xff, 0x08, NULL }, + + {0 , 0xfe, 0 , 2, "Coin Slot" }, + {0x1b, 0x01, 0x01, 0x01, "Same" }, + {0x1b, 0x01, 0x01, 0x00, "Individual" }, + + // Coinage condition: Coin Slot Individual + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x1b, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, + {0x1b, 0x00, 0x01, 0x00, NULL}, + {0x1b, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, + {0x1b, 0x00, 0x01, 0x00, NULL}, + {0x1b, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, + {0x1b, 0x00, 0x01, 0x00, NULL}, + {0x1b, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, + {0x1b, 0x00, 0x01, 0x00, NULL}, + {0x1b, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, + {0x1b, 0x00, 0x01, 0x00, NULL}, + {0x1b, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, + {0x1b, 0x00, 0x01, 0x00, NULL}, + {0x1b, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, + {0x1b, 0x00, 0x01, 0x00, NULL}, + {0x1b, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, + {0x1b, 0x00, 0x01, 0x00, NULL}, + + // Coin 1 condition: Coin Slot Same + {0 , 0xfe, 0 , 8, "Coin 1" }, + {0x1b, 0x02, 0x0e, 0x0a, "3 Coins 1 Credit" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x0e, 0x0c, "2 Coins 1 Credit" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x0e, 0x0e, "1 Coin 1 Credit" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x0e, 0x08, "1 Coin 2 Credits" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x0e, 0x06, "1 Coin 3 Credits" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x0e, 0x04, "1 Coin 4 Credits" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x0e, 0x02, "1 Coin 5 Credits" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x0e, 0x00, "1 Coin 6 Credits" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + + // Coin 2 condition: Coin Slot Same + {0 , 0xfe, 0 , 8, "Coin 2" }, + {0x1b, 0x02, 0x70, 0x50, "3 Coins 1 Credit" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x70, 0x40, "1 Coin 2 Credits" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x70, 0x30, "1 Coin 3 Credits" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x70, 0x20, "1 Coin 4 Credits" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x70, 0x10, "1 Coin 5 Credits" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + {0x1b, 0x02, 0x70, 0x00, "1 Coin 6 Credits" }, + {0x1b, 0x00, 0x01, 0x01, NULL}, + + {0 , 0xfe, 0 , 2, "2 Coins to Start, 1 to Continue" }, + {0x1b, 0x01, 0x80, 0x80, "Off" }, + {0x1b, 0x01, 0x80, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x1c, 0x01, 0x01, 0x01, "Off" }, +// {0x1c, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x1c, 0x01, 0x02, 0x00, "Off" }, + {0x1c, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x1c, 0x01, 0x04, 0x04, "Off" }, + {0x1c, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x1c, 0x01, 0x18, 0x10, "Easy" }, + {0x1c, 0x01, 0x18, 0x18, "Normal" }, + {0x1c, 0x01, 0x18, 0x08, "Hard" }, + {0x1c, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x1c, 0x01, 0x20, 0x20, "Off" }, + {0x1c, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Join In (1 Credit)" }, + {0x1d, 0x01, 0x01, 0x01, "Off" }, + {0x1d, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Buy In" }, + {0x1d, 0x01, 0x02, 0x00, "No" }, + {0x1d, 0x01, 0x02, 0x02, "Yes" }, + + {0 , 0xfe, 0 , 5, "Country" }, + {0x1e, 0x01, 0x0f, 0x00, "US" }, + {0x1e, 0x01, 0x0f, 0x01, "Japan" }, + {0x1e, 0x01, 0x0f, 0x02, "Hong-Kong/Taiwan" }, + {0x1e, 0x01, 0x0f, 0x04, "Korea" }, + {0x1e, 0x01, 0x0f, 0x08, "World" }, +}; + +STDDIPINFO(Taotaidoa) + +static void palette_write(INT32 offset) +{ + UINT8 r, g, b; + UINT16 data = *((UINT16*)(DrvPalRAM + offset)); + + r = (data >> 10) & 0x1f; + r = (r << 3) | (r >> 2); + g = (data >> 5) & 0x1f; + g = (g << 3) | (g >> 2); + b = (data >> 0) & 0x1f; + b = (b << 3) | (b >> 2); + + DrvPalette[offset/2] = BurnHighCol(r, g, b, 0); +} + +UINT8 __fastcall taotaido_read_byte(UINT32 address) +{ + if (address < 0xffff00) return 0; + + switch (address) + { + case 0xffff80: + case 0xffff81: + return DrvInps[0] >> ((~address & 1) << 3); + + case 0xffff82: + case 0xffff83: + return DrvInps[1] >> ((~address & 1) << 3); + + case 0xffff84: + case 0xffff85: + return DrvInps[2] >> ((~address & 1) << 3); + + case 0xffff87: + return DrvDip[0]; + + case 0xffff89: + return DrvDip[1]; + + case 0xffff8b: + return DrvDip[2]; + + case 0xffff8f: + return DrvDip[3]; + + case 0xffffa0: // p3 + case 0xffffa1: + return DrvInps[3] >> ((~address & 1) << 3); + + case 0xffffa2: // p4 + case 0xffffa3: + return DrvInps[4] >> ((~address & 1) << 3); + + case 0xffffe1: + return *pending_command; + } + + return 0; +} + +UINT16 __fastcall taotaido_read_word(UINT32 address) +{ + if (address < 0xffff00) return 0; + + switch (address) + { + case 0xffff80: + return DrvInps[0]; + + case 0xffff82: + return DrvInps[1]; + + case 0xffff84: + return DrvInps[2]; + + case 0xffffa0: // p3 + return DrvInps[3]; + + case 0xffffa2: // p4 + return DrvInps[4]; + } + + return 0; +} + +void __fastcall taotaido_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfff000) == 0xffc000) { + DrvPalRAM[(address & 0xfff) ^ 1] = data; + palette_write(address & 0xffe); + return; + } + + if (address < 0xffff00) return; + + switch (address) + { + case 0xffff08: + case 0xffff09: + case 0xffff0a: + case 0xffff0b: + case 0xffff0c: + case 0xffff0d: + case 0xffff0e: + case 0xffff0f: + taotaido_tileregs[address & 0x07] = data; + return; + + case 0xffff40: + case 0xffff41: + case 0xffff42: + case 0xffff43: + case 0xffff44: + case 0xffff45: + case 0xffff46: + case 0xffff47: + taotaido_spritebank[address & 7] = data; + return; + + case 0xffffc1: + { + INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]); + if (nCycles <= ZetTotalCycles()) return; + + BurnTimerUpdate(nCycles); + + *pending_command = 1; + *soundlatch = data; + ZetNmi(); + } + return; + } +} + +void __fastcall taotaido_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfff000) == 0xffc000) { + *((UINT16*)(DrvPalRAM + (address & 0xffe))) = data; + palette_write(address & 0xffe); + return; + } + + if (address < 0xffff00) return; + + switch (address) + { + case 0xffff08: + case 0xffff0a: + case 0xffff0c: + case 0xffff0e: + *((UINT16*)(taotaido_tileregs + (address & 0x06))) = data; + return; + + case 0xffff40: + case 0xffff42: + case 0xffff44: + case 0xffff46: + *((UINT16*)(taotaido_spritebank + (address & 6))) = data; + return; + } +} + +static void taotaido_sound_bankswitch(INT32 data) +{ + *nDrvZ80Bank = data & 3; + + ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + 0x8000 * *nDrvZ80Bank); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + 0x8000 * *nDrvZ80Bank); +} + +void __fastcall taotaido_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + BurnYM2610Write(port & 3, data); + return; + + case 0x04: + if (*nDrvZ80Bank != (data & 3)) { + taotaido_sound_bankswitch(data); + } + return; + + case 0x08: + *pending_command = 0; + return; + } +} + +UINT8 __fastcall taotaido_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return BurnYM2610Read(0); + + + case 0x02: + return BurnYM2610Read(2); + + case 0x0c: + return *soundlatch; + } + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[ 4] = { + 0x000, 0x001, 0x002, 0x003 + }; + + INT32 XOffs[16] = { + 0x004, 0x000, 0x00c, 0x008, 0x014, 0x010, 0x01c, 0x018, + 0x024, 0x020, 0x02c, 0x028, 0x034, 0x030, 0x03c, 0x038 + }; + + INT32 YOffs[16] = { + 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0 + }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x600000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x600000); + + GfxDecode(0xc000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x200000); + + GfxDecode(0x4000, 4, 16, 16, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + taotaido_sound_bankswitch(1); + ZetClose(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x100000; + DrvZ80ROM = Next; Next += 0x020000; + + DrvGfxROM0 = Next; Next += 0xc00000; + DrvGfxROM1 = Next; Next += 0x400000; + + DrvSndROM0 = Next; Next += 0x100000; + DrvSndROM1 = Next; Next += 0x200000; + + DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x001000; + DrvBgRAM = Next; Next += 0x004000; + DrvSprRAM0 = Next; Next += 0x002000; + DrvSprRAM1 = Next; Next += 0x010000; + DrvScrollRAM = Next; Next += 0x000400; + DrvSpr0Buf0 = Next; Next += 0x002000; + DrvSpr1Buf0 = Next; Next += 0x010000; + DrvSpr0Buf1 = Next; Next += 0x002000; + DrvSpr1Buf1 = Next; Next += 0x010000; + + taotaido_tileregs = Next; Next += 0x000010; + taotaido_spritebank = Next; Next += 0x000010; + + pending_command = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + nDrvZ80Bank = Next; Next += 0x000001; + + DrvZ80RAM = Next; Next += 0x000800; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void taotaidoFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 taotaidoSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 5000000; +} + +static double taotaidoGetTime() +{ + return (double)ZetTotalCycles() / 5000000.0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1; + if (BurnLoadRom(Drv68KROM + 0x080000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x400000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x000000, 7, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x000000, 8, 1)) return 1; + + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(DrvBgRAM, 0x800000, 0x803fff, SM_RAM); + SekMapMemory(DrvSprRAM0, 0xa00000, 0xa01fff, SM_RAM); + SekMapMemory(DrvSprRAM1, 0xc00000, 0xc0ffff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xfe0000, 0xfeffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xffc000, 0xffcfff, SM_ROM); + SekMapMemory(DrvScrollRAM, 0xffe000, 0xffe3ff, SM_RAM); + SekSetWriteByteHandler(0, taotaido_write_byte); + SekSetWriteWordHandler(0, taotaido_write_word); + SekSetReadByteHandler(0, taotaido_read_byte); + SekSetReadWordHandler(0, taotaido_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x77ff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x77ff, 2, DrvZ80ROM); + ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); + ZetSetInHandler(taotaido_sound_in); + ZetSetOutHandler(taotaido_sound_out); + ZetClose(); + + INT32 nDrvSndROM0Size = 0x100000; + INT32 nDrvSndROM1Size = 0x200000; + BurnYM2610Init(8000000, DrvSndROM1, &nDrvSndROM1Size, DrvSndROM0, &nDrvSndROM0Size, &taotaidoFMIRQHandler, taotaidoSynchroniseStream, taotaidoGetTime, 0); + BurnTimerAttachZet(5000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM2610Exit(); + + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_layer() +{ + UINT16 *vram = (UINT16*)DrvBgRAM; + UINT16 *scroll = (UINT16*)DrvScrollRAM; + + for (INT32 line = 0; line < 224; line++) + { + INT32 scrolly = ((scroll[(line << 1) | 1] >> 4) + 0) & 0x3ff; + INT32 scrollx = ((scroll[(line << 1) | 0] >> 4) + 30) & 0x7ff; + + INT32 sy = scrolly >> 4; + + for (INT32 col = 0; col < (320 / 16) + 1; col++) + { + INT32 sx = (scrollx >> 4) + col; + INT32 ofst = (sy << 6) + (sx & 0x3f) + ((sx & 0x40) << 6); + + INT32 code = vram[ofst]; + INT32 bank = (code >> 9) & 7; + INT32 color = ((code >> 12) << 4) | 0x300; + + code = (code & 0x1ff) | (taotaido_tileregs[bank] << 9); + + UINT8 *src = DrvGfxROM1 + (code << 8) + ((scrolly & 0x0f) << 4); + + for (INT32 x = 0; x < 16; x++) { + INT32 xx = (x + (col << 4)) - (scrollx & 0x0f); + if (xx < 0 || xx >= nScreenWidth) continue; + pTransDraw[(line * nScreenWidth) + xx] = src[x] | color; + } + } + } +} + +static void draw_sprite(INT32 spriteno) +{ + UINT16 *source = (UINT16*)DrvSpr0Buf1; + UINT16 *source1 = (UINT16*)DrvSpr1Buf1; + source += spriteno*4; + + INT32 yzoom = (source[0] & 0xf000) >> 12; + INT32 xzoom = (source[1] & 0xf000) >> 12; + + INT32 ysize = (source[0] & 0x0e00) >> 9; + INT32 xsize = (source[1] & 0x0e00) >> 9; + + INT32 ypos = source[0] & 0x01ff; + INT32 xpos = source[1] & 0x01ff; + + INT32 yflip = source[2] & 0x8000; + INT32 xflip = source[2] & 0x4000; + INT32 color = (source[2] & 0x1f00) >> 8; + + INT32 tile = source[3] & 0xffff; + + xpos += (xsize*xzoom+2)/4; + ypos += (ysize*yzoom+2)/4; + + xzoom = 32 - xzoom; + yzoom = 32 - yzoom; + + for (INT32 y = 0;y <= ysize;y++) + { + INT32 sx,sy; + + if (yflip) sy = ((ypos + yzoom * (ysize - y)/2 + 16) & 0x1ff) - 16; + else sy = ((ypos + yzoom * y / 2 + 16) & 0x1ff) - 16; + + for (INT32 x = 0;x <= xsize;x++) + { + INT32 realtile = source1[tile & 0x7fff]; + + if (realtile > 0x3fff) + { + INT32 block; + + block = (realtile & 0x3800)>>11; + + realtile &= 0x07ff; + realtile |= taotaido_spritebank[block] * 0x800; + } + + if (xflip) sx = ((xpos + xzoom * (xsize - x) / 2 + 16) & 0x1ff) - 16; + else sx = ((xpos + xzoom * x / 2 + 16) & 0x1ff) - 16; + + if (yflip) { + if (xflip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, realtile, sx, sy, color, 4, 15, 0, DrvGfxROM0); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, realtile, sx, sy, color, 4, 15, 0, DrvGfxROM0); + } + } else { + if (xflip) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, realtile, sx, sy, color, 4, 15, 0, DrvGfxROM0); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, realtile, sx, sy, color, 4, 15, 0, DrvGfxROM0); + } + } + + tile++; + } + } +} + +static void draw_sprites() +{ + UINT16 *source = (UINT16*)DrvSpr0Buf1; + UINT16 *finish = source + 0x2000/2; + + while (source < finish) + { + if (source[0] == 0x4000) break; + + draw_sprite(source[0] & 0x3ff); + + source++; + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x1000; i+=2) { + palette_write(i); + } + } + + draw_layer(); + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + SekNewFrame(); + ZetNewFrame(); + + { + memset (DrvInps, 0xff, 5 * sizeof(UINT16)); + for (INT32 i = 0; i < 8; i++) { + DrvInps[0] ^= (DrvJoy1[i] & 1) << i; + DrvInps[1] ^= (DrvJoy2[i] & 1) << i; + DrvInps[2] ^= (DrvJoy3[i] & 1) << i; + DrvInps[3] ^= (DrvJoy4[i] & 1) << i; + DrvInps[4] ^= (DrvJoy5[i] & 1) << i; + } + } + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = (INT32)(5000000.0 / 60.0); + + SekOpen(0); + ZetOpen(0); + + SekRun(nCyclesTotal[0]); + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrame(nCyclesTotal[1]); + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + memcpy (DrvSpr0Buf1, DrvSpr0Buf0, 0x02000); + memcpy (DrvSpr1Buf1, DrvSpr1Buf0, 0x10000); + memcpy (DrvSpr0Buf0, DrvSprRAM0, 0x02000); + memcpy (DrvSpr1Buf0, DrvSprRAM1, 0x10000); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029698; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2610Scan(nAction, pnMin); + } + + ZetOpen(0); + taotaido_sound_bankswitch(*nDrvZ80Bank); + ZetClose(); + + return 0; +} + + +// Tao Taido (set 1) + +static struct BurnRomInfo taotaidoRomDesc[] = { + { "1-u90.bin", 0x080000, 0xa3ee30da, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "2-u91.bin", 0x080000, 0x30b7e4fb, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "3-u113.bin", 0x020000, 0xa167c4e4, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "u86.bin", 0x200000, 0x908e251e, 3 | BRF_GRA }, // 3 Sprites + { "u87.bin", 0x200000, 0xc4290ba6, 3 | BRF_GRA }, // 4 + { "u88.bin", 0x200000, 0x407d9aeb, 3 | BRF_GRA }, // 5 + + { "u15.bin", 0x200000, 0xe95823e9, 4 | BRF_GRA }, // 6 Background Tiles + + { "u104.bin", 0x100000, 0xe89387a9, 5 | BRF_SND }, // 7 Samples + { "u127.bin", 0x200000, 0x0cf0cb23, 6 | BRF_SND }, // 8 +}; + +STD_ROM_PICK(taotaido) +STD_ROM_FN(taotaido) + +struct BurnDriver BurnDrvTaotaido = { + "taotaido", NULL, NULL, NULL, "1993", + "Tao Taido (set 1)\0", NULL, "Video System Co.", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MISC, 0, + NULL, taotaidoRomInfo, taotaidoRomName, NULL, NULL, TaotaidoInputInfo, TaotaidoDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 224, 4, 3 +}; + + +// Tao Taido (set 2) + +static struct BurnRomInfo taotaidoaRomDesc[] = { + { "tt0-u90.bin", 0x080000, 0x69d4cca7, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "tt1-u91.bin", 0x080000, 0x41025469, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "3-u113.bin", 0x020000, 0xa167c4e4, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "u86.bin", 0x200000, 0x908e251e, 3 | BRF_GRA }, // 3 Sprites + { "u87.bin", 0x200000, 0xc4290ba6, 3 | BRF_GRA }, // 4 + { "u88.bin", 0x200000, 0x407d9aeb, 3 | BRF_GRA }, // 5 + + { "u15.bin", 0x200000, 0xe95823e9, 4 | BRF_GRA }, // 6 Background Tiles + + { "u104.bin", 0x100000, 0xe89387a9, 5 | BRF_SND }, // 7 Samples + { "u127.bin", 0x200000, 0x0cf0cb23, 6 | BRF_SND }, // 8 +}; + +STD_ROM_PICK(taotaidoa) +STD_ROM_FN(taotaidoa) + +struct BurnDriver BurnDrvTaotaidoa = { + "taotaidoa", "taotaido", NULL, NULL, "1993", + "Tao Taido (set 2)\0", NULL, "Video System Co.", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, taotaidoaRomInfo, taotaidoaRomName, NULL, NULL, TaotaidoaInputInfo, TaotaidoaDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_tecmosys.cpp b/src/burn/drv/pst90s/d_tecmosys.cpp index 06b8cb11b..1065fdf1b 100644 --- a/src/burn/drv/pst90s/d_tecmosys.cpp +++ b/src/burn/drv/pst90s/d_tecmosys.cpp @@ -1,1491 +1,1490 @@ -// FB Alpha Tecmo System driver module -// Based on MAME driver by Farfetch, David Haywood, Tomasz Slanina, and nuapete - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "msm6295.h" -#include "eeprom.h" -#include "ymz280b.h" -// ymf262 - -//#define ENABLE_SOUND_HARDWARE // no sound without ymf262 core anyway... - -#ifdef ENABLE_SOUND_HARDWARE -#include "z80_intf.h" -#endif - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvSprROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; - -static UINT8 *Drv68KRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvTxtRAM; -static UINT8 *DrvBgRAM0; -static UINT8 *DrvBgRAM1; -static UINT8 *DrvBgRAM2; -static UINT8 *DrvBgScrRAM0; -static UINT8 *DrvBgScrRAM1; -static UINT8 *DrvBgScrRAM2; -static UINT8 *spritelist_select; -static UINT8 *Drv88Regs; -static UINT8 *DrvA8Regs; -static UINT8 *DrvB0Regs; -static UINT8 *DrvC0Regs; -static UINT8 *DrvC8Regs; - -#ifdef ENABLE_SOUND_HARDWARE -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *DrvOkiBank; -static UINT8 *DrvZ80Bank; -static UINT8 *soundlatch; -static UINT8 *soundlatch2; -#endif - -static UINT8 protection_read_pointer; -static UINT8 protection_status; -static UINT8 protection_value; - -static UINT16 *DrvTmpSprites; - -static UINT32 *DrvPalette; -static UINT32 *DrvPalette24; -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvReset; -static UINT16 DrvInputs[2]; - -static INT32 vblank; -static INT32 watchdog; -static INT32 deroon; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 10, "p1 fire 4" }, - - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 10, "p2 fire 4" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service 1", BIT_DIGITAL, DrvJoy1 + 9, "service" }, - {"Service 2", BIT_DIGITAL, DrvJoy2 + 9, "service" }, -}; - -STDINPUTINFO(Drv) - -struct prot_data -{ - UINT8 passwd_len; - const UINT8* passwd; - const UINT8* code; - UINT8 checksums[4]; -}; - -static const struct prot_data *protection_data; - -static const UINT8 deroon_passwd[] = { 'L', 'U', 'N', 'A', 0 }; -static const UINT8 deroon_upload[] = { 0x02, 0x4e, 0x75, 0x00 }; -static const struct prot_data deroon_data = { 0x05, deroon_passwd, deroon_upload, { 0xa6, 0x29, 0x4b, 0x3f } }; - -static const UINT8 tkdensho_passwd[] = { 'A','G','E','P','R','O','T','E','C','T',' ','S','T','A','R','T', 0 }; -static const UINT8 tkdensho_upload[] = { 0x06, 0x4e, 0xf9, 0x00, 0x00, 0x22, 0xc4, 0x00 }; -static const struct prot_data tkdensho_data = { 0x11, tkdensho_passwd, tkdensho_upload, { 0xbf, 0xfa, 0xda, 0xda } }; -static const struct prot_data tkdenshoa_data = { 0x11, tkdensho_passwd, tkdensho_upload, { 0xbf, 0xfa, 0x21, 0x5d } }; - -static void protection_reset() -{ - protection_read_pointer = 0; - protection_status = 0; // idle - protection_value = 0xff; -} - -static void tecmosys_prot_data_write(INT32 data) -{ - static const UINT8 ranges[] = { - 0x10,0x11,0x12,0x13,0x24,0x25,0x26,0x27,0x38,0x39,0x3a,0x3b,0x4c,0x4d,0x4e,0x4f, 0x00 - }; - - switch (protection_status) - { - case 0: // idle - if (data == 0x13) - { - protection_status = 1; // login - protection_value = protection_data->passwd_len; - protection_read_pointer = 0; - break; - } - break; - - case 1: // login - if (protection_read_pointer >= protection_data->passwd_len) - { - protection_status = 2; // send code - protection_value = protection_data->code[0]; - protection_read_pointer = 1; - } - else - protection_value = protection_data->passwd[protection_read_pointer++] == data ? 0 : 0xff; - break; - - case 2: // send code - if (protection_read_pointer >= protection_data->code[0]+2) - { - protection_status = 3; // send address - protection_value = ranges[0]; - protection_read_pointer = 1; - } - else - protection_value = data == protection_data->code[protection_read_pointer-1] ? protection_data->code[protection_read_pointer++] : 0xff; - break; - - case 3: // send address - if (protection_read_pointer >= 17) - { - protection_status = 4; // send checksum - protection_value = 0; - protection_read_pointer = 0; - } - else - { - protection_value = data == ranges[protection_read_pointer-1] ? ranges[protection_read_pointer++] : 0xff; - } - break; - - case 4: // send checksum - if (protection_read_pointer >= 5) - { - protection_status = 5; // done - protection_value = 0; - } - else - protection_value = data == protection_data->checksums[protection_read_pointer] ? protection_data->checksums[protection_read_pointer++] : 0xff; - break; - - case 5: // done - break; - } -} - -void __fastcall tecmosys_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x880000: - case 0x880002: - *((UINT16*)(Drv88Regs + (address & 0x02))) = data; - return; - - case 0x880008: - *spritelist_select = data & 0x03; - return; - - case 0x880022: - watchdog = 0; - return; - - case 0xa00000: - EEPROMWrite((data & 0x0400), (data & 0x0200), (data & 0x0800)); - return; - - case 0xa80000: - case 0xa80002: - case 0xa80004: - *((UINT16*)(DrvA8Regs + (address & 0x06))) = data; - return; - - case 0xb00000: - case 0xb00002: - case 0xb00004: - *((UINT16*)(DrvB0Regs + (address & 0x06))) = data; - return; - - case 0xb80000: // protection status - does nothing - return; - - case 0xc00000: - case 0xc00002: - case 0xc00004: - *((UINT16*)(DrvC0Regs + (address & 0x06))) = data; - return; - - case 0xc80000: - case 0xc80002: - case 0xc80004: - *((UINT16*)(DrvC8Regs + (address & 0x06))) = data; - return; - - case 0xe00000: -#ifdef ENABLE_SOUND_HARDWARE - ZetRun((SekTotalCycles() / 2) - ZetTotalCycles()); - *soundlatch = data & 0xff; - ZetNmi(); -#endif - return; - - case 0xe80000: - tecmosys_prot_data_write(data >> 8); - return; - } -} - -void __fastcall tecmosys_main_write_byte(UINT32 /*address*/, UINT8 /*data*/) -{ - -} - -UINT16 __fastcall tecmosys_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x880000: - return vblank; - - case 0xd00000: - return DrvInputs[0]; - - case 0xd00002: - return DrvInputs[1]; - - case 0xd80000: - return (EEPROMRead() & 1) << 11; - - case 0xf00000: -#ifdef ENABLE_SOUND_HARDWARE - ZetRun((SekTotalCycles() / 2) - ZetTotalCycles()); - return *soundlatch2; -#else - return 0; -#endif - - case 0xf80000: - INT32 ret = protection_value; - protection_value = 0xff; - return ret << 8; - } - - return 0; -} - -UINT8 __fastcall tecmosys_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0xb80000: - return 0x00; // protection status - } - - return 0; -} - -static inline void palette_update(INT32 pal) -{ - UINT16 p = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + pal * 2))); - - INT32 r = (p >> 5) & 0x1f; - INT32 g = (p >> 10) & 0x1f; - INT32 b = (p >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[pal] = BurnHighCol(r, g, b, 0); - DrvPalette24[pal] = (r << 16) + (g << 8) + b; -} - -void __fastcall tecmosys_palette_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xff8000) == 0x900000) { - *((UINT16 *)(DrvPalRAM + 0x0000 + (address & 0x7ffe))) = BURN_ENDIAN_SWAP_INT16(data); - palette_update((0x0000 + (address & 0x7ffe)) / 2); - return; - } - - if ((address & 0xfff000) == 0x980000) { - *((UINT16 *)(DrvPalRAM + 0x8000 + (address & 0x0ffe))) = BURN_ENDIAN_SWAP_INT16(data); - palette_update((0x8000 + (address & 0x0ffe)) / 2); - return; - } -} - -void __fastcall tecmosys_palette_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xff8000) == 0x900000) { - DrvPalRAM[(0x0000 + (address & 0x7fff)) ^ 1] = data; - palette_update((0x0000 + (address & 0x7ffe)) / 2); - return; - } - - if ((address & 0xfff000) == 0x980000) { - DrvPalRAM[(0x8000 + (address & 0x0fff)) ^ 1] = data; - palette_update((0x8000 + (address & 0x0ffe)) / 2); - return; - } -} - -#ifdef ENABLE_SOUND_HARDWARE - -static void bankswitch(INT32 data) -{ - if ((data & 0x0f) != *DrvZ80Bank) { - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + (data & 0x0f) * 0x4000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + (data & 0x0f) * 0x4000); - } - - *DrvZ80Bank = data & 0x0f; -} - -static void oki_bankswitch(INT32 data) -{ - if ((data & 0x33) != *DrvOkiBank) { - - INT32 upperbank = (data & 0x30) >> 4; - INT32 lowerbank = (data & 0x03) >> 0; - - if (lowerbank != ((*DrvOkiBank & 0x0f) >> 0)) { - memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x80000 + lowerbank * 0x20000, 0x20000); - } - - if (upperbank != ((*DrvOkiBank & 0xf0) >> 4)) { - memcpy (DrvSndROM0 +0x20000, DrvSndROM0 + 0x80000 + upperbank * 0x20000, 0x20000); - } - } - - *DrvOkiBank = data & 0x33; -} - -void __fastcall tecmosys_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - // ymf262_w - return; - - case 0x10: - MSM6295Command(0, data); - return; - - case 0x20: - oki_bankswitch(data); - return; - - case 0x30: - bankswitch(data); - return; - - case 0x50: - *soundlatch2 = data; - return; - - case 0x60: - YMZ280BSelectRegister(data); - return; - - case 0x61: - YMZ280BWriteRegister(data); - return; - } -} - -UINT8 __fastcall tecmosys_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - return 0; // ymf262_r - - case 0x10: - return MSM6295ReadStatus(0); - - case 0x40: - return *soundlatch; - - case 0x60: - case 0x61: - return YMZ280BReadStatus(); - } - - return 0; -} - -/* -static void DrvIrqHandler(INT32 irq) // for ymf262 -{ - if (irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} -*/ - -#endif - -static INT32 DrvDoReset(INT32 full_reset) -{ - if (full_reset) { - memset (AllRam, 0, RamEnd - AllRam); - } - - SekOpen(0); - SekReset(); - SekClose(); - - EEPROMReset(); - - protection_reset(); - - watchdog = 0; - -#ifdef ENABLE_SOUND_HARDWARE - ZetOpen(0); - ZetReset(); - ZetClose(); - - // ymf262 - YMZ280BReset(); - MSM6295Reset(0); - - *DrvOkiBank = *DrvZ80Bank = ~0; -#endif - - return 0; -} - -#ifdef ENABLE_SOUND_HARDWARE -static INT32 MemIndex(INT32 sndlen) -#else -static INT32 MemIndex(INT32 /*sndlen*/) -#endif -{ - - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x100000; - - DrvGfxROM0 = Next; Next += 0x200000; - DrvGfxROM1 = Next; Next += 0x200000; - DrvGfxROM2 = Next; Next += 0x200000; - DrvGfxROM3 = Next; Next += 0x200000; - -#ifdef ENABLE_SOUND_HARDWARE - DrvZ80ROM = Next; Next += 0x040000; - - MSM6295ROM = Next; - DrvSndROM0 = Next; Next += 0x100000; - - YMZ280BROM = Next; - DrvSndROM1 = Next; Next += sndlen; -#endif - - DrvPalette = (UINT32*)Next; Next += 0x4800 * sizeof(UINT32); - DrvPalette24 = (UINT32*)Next; Next += 0x4800 * sizeof(UINT32); - - DrvTmpSprites = (UINT16*)Next; Next += 320 * 240 * sizeof(UINT16); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvSprRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x009000; - - DrvTxtRAM = Next; Next += 0x004000; - - DrvBgRAM0 = Next; Next += 0x001000; - DrvBgScrRAM0 = Next; Next += 0x000400; - DrvBgRAM1 = Next; Next += 0x001000; - DrvBgScrRAM1 = Next; Next += 0x000400; - DrvBgRAM2 = Next; Next += 0x001000; - DrvBgScrRAM2 = Next; Next += 0x000400; - - -#ifdef ENABLE_SOUND_HARDWARE - DrvOkiBank = Next; Next += 0x000001; - DrvZ80Bank = Next; Next += 0x000001; - - DrvZ80RAM = Next; Next += 0x001800; - - soundlatch = Next; Next += 0x000001; - soundlatch2 = Next; Next += 0x000001; -#endif - spritelist_select = Next; Next += 0x000001; - - Drv88Regs = Next; Next += 0x000004; - DrvA8Regs = Next; Next += 0x000006; - DrvB0Regs = Next; Next += 0x000006; - DrvC0Regs = Next; Next += 0x000006; - DrvC8Regs = Next; Next += 0x000006; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void descramble_sprites(INT32 len) -{ - UINT8 *src = DrvSprROM; - UINT8 tmp[4]; - - for (INT32 i=0; i < len; i+=4) - { - tmp[0] = ((src[i+2]&0xf0)>>0) | ((src[i+3]&0xf0)>>4); - tmp[1] = ((src[i+2]&0x0f)<<4) | ((src[i+3]&0x0f)>>0); - tmp[2] = ((src[i+0]&0xf0)>>0) | ((src[i+1]&0xf0)>>4); - tmp[3] = ((src[i+0]&0x0f)<<4) | ((src[i+1]&0x0f)<<0); - - memcpy (src + i, tmp, 4); - } -} - -static void expand_characters() -{ - for (INT32 i = 0x100000 - 1; i >= 0; i--) { - DrvGfxROM0[i * 2 + 0] = DrvGfxROM0[i] >> 4; - DrvGfxROM0[i * 2 + 1] = DrvGfxROM0[i] & 0x0f; - } -} - -static void expand_tiles(UINT8 *rom, INT32 len) -{ - INT32 Planes[4] = { 0, 1, 2, 3 }; - INT32 XOffs[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, 0x100, 0x104, 0x108, 0x10c, 0x110, 0x114, 0x118, 0x11c }; - INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(len); - - memcpy (tmp, rom, len); - - GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Planes, XOffs, YOffs, 128*8, tmp, rom); - - BurnFree (tmp); -} - -static INT32 CommonInit(INT32 (*pRomLoadCallback)(), INT32 spritelen, INT32 sndlen, const struct prot_data *dev_data_pointer, INT32 game) -{ - AllMem = NULL; - MemIndex(sndlen); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(sndlen); - - DrvSprROM = (UINT8*)BurnMalloc(spritelen); - if (DrvSprROM == NULL) return 1; - - if (pRomLoadCallback) { - if (pRomLoadCallback()) return 1; - } - - descramble_sprites(spritelen); - expand_characters(); - expand_tiles(DrvGfxROM1, 0x100000); - expand_tiles(DrvGfxROM2, 0x100000); - expand_tiles(DrvGfxROM3, 0x100000); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(DrvBgRAM0, 0x300000, 0x300fff, SM_RAM); - SekMapMemory(DrvBgScrRAM0, 0x301000, 0x3013ff, SM_RAM); - SekMapMemory(DrvBgRAM1, 0x400000, 0x400fff, SM_RAM); - SekMapMemory(DrvBgScrRAM1, 0x401000, 0x4013ff, SM_RAM); - SekMapMemory(DrvBgRAM2, 0x500000, 0x500fff, SM_RAM); - SekMapMemory(DrvBgScrRAM2, 0x501000, 0x5013ff, SM_RAM); - SekMapMemory(DrvTxtRAM, 0x700000, 0x703fff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x800000, 0x80ffff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x900000, 0x907fff, SM_ROM); - SekMapMemory(DrvPalRAM + 0x8000,0x980000, 0x980fff, SM_ROM); - SekSetWriteWordHandler(0, tecmosys_main_write_word); - SekSetWriteByteHandler(0, tecmosys_main_write_byte); - SekSetReadWordHandler(0, tecmosys_main_read_word); - SekSetReadByteHandler(0, tecmosys_main_read_byte); - - SekMapHandler(1, 0x900000, 0x980fff, SM_WRITE); - SekSetWriteWordHandler(1, tecmosys_palette_write_word); - SekSetWriteByteHandler(1, tecmosys_palette_write_byte); - SekClose(); - - deroon = game; - protection_data = dev_data_pointer; - - EEPROMInit(&eeprom_interface_93C46); - - BurnSetRefreshRate(57.4458); - -#ifdef ENABLE_SOUND_HARDWARE - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0xe000, 0xf7ff, 0, DrvZ80RAM); - ZetMapArea(0xe000, 0xf7ff, 1, DrvZ80RAM); - ZetMapArea(0xe000, 0xf7ff, 2, DrvZ80RAM); - ZetSetOutHandler(tecmosys_sound_out); - ZetSetInHandler(tecmosys_sound_in); - ZetMemEnd(); - ZetClose(); - - // ymf262 - - YMZ280BInit(16900000, NULL); - YMZ280BSetRoute(BURN_SND_YMZ280B_YMZ280B_ROUTE_1, 0.30, BURN_SND_ROUTE_LEFT); - YMZ280BSetRoute(BURN_SND_YMZ280B_YMZ280B_ROUTE_2, 0.30, BURN_SND_ROUTE_RIGHT); - - MSM6295Init(0, 2000000 / 132, 1); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); -#endif - - GenericTilesInit(); - - DrvDoReset(1); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - EEPROMExit(); - - SekExit(); - -#ifdef ENABLE_SOUND_HARDWARE - ZetExit(); - - // ymf262 - - MSM6295Exit(0); - MSM6295ROM = NULL; - - YMZ280BExit(); - YMZ280BROM = NULL; -#endif - - BurnFree (DrvSprROM); - BurnFree (AllMem); - - return 0; -} - -static void draw_character_layer() -{ - UINT16 *vram = (UINT16*)DrvTxtRAM; - - for (INT32 offs = 0; offs < 64 * 64; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]); - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & 0x7fff; - INT32 color = attr & 0x003f; - INT32 flipy = attr & 0x0080; - INT32 flipx = attr & 0x0040; - - if (code == 0) continue; // Should save some cycles - - if (sx >= 0 && sx <= (nScreenWidth - 8) && sy >= 0 && sy <= (nScreenHeight - 8)) { - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); - } else { - Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); - } else { - Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); - } - } - } else { - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); - } - } - } - } -} - -static void draw_background_layer(UINT8 *ram, UINT8 *gfx, UINT8 *regs, INT32 yoff, INT32 xoff, INT32 priority) -{ - UINT16 *vram = (UINT16*)ram; - - INT32 scrollx = (*((UINT16*)(regs + 0)) + xoff) & 0x1ff; - INT32 scrolly = (*((UINT16*)(regs + 2)) + yoff) & 0x1ff; - - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 4; - INT32 sy = (offs >> 5) << 4; - - sx -= scrollx; - if (sx < -15) sx += 512; - sy -= scrolly; - if (sy < -15) sy += 512; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]); - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & 0x1fff; - INT32 color = attr & 0x003f; - INT32 flipy = attr & 0x0080; - INT32 flipx = attr & 0x0040; - - if (!code) continue; // Should save some cycles - - if (sx >= 0 && sx <= (nScreenWidth - 16) && sy >= 0 && sy <= (nScreenHeight - 16)) { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); - } else { - Render16x16Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); - } else { - Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); - } - } - } else { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); - } - } - } - } -} - -static void draw_sprite_zoomed(INT32 addr, INT32 color, INT32 x, INT32 y, INT32 flipx, INT32 flipy, INT32 xsize, INT32 ysize, INT32 zoomx, INT32 zoomy) -{ - if (y >= nScreenHeight || x >= nScreenWidth) return; - - INT32 drawx, drawy; - UINT8 *rom = DrvSprROM + addr; - - for (INT32 ycnt = 0; ycnt < ysize; ycnt++, rom += xsize) - { - if (flipy) - drawy = y + (((ysize * zoomy) / 256) - 1) - ((ycnt * zoomy) / 256); - else - drawy = y + ((ycnt * zoomy) / 256); - - if (drawy < 0 || drawy >= 240) continue; - - UINT16 *dstptr = DrvTmpSprites + drawy * nScreenWidth; - - for (INT32 xcnt = 0; xcnt < xsize; xcnt++) - { - if (flipx) - drawx = x + (((xsize * zoomx) / 256) - 1) - ((xcnt * zoomx) / 256); - else - drawx = x + ((xcnt * zoomx) / 256); - - if (drawx >= 0 && drawx < 320) - { - INT32 data = rom[xcnt]; - - if (data) dstptr[drawx] = data + color; - } - } - } -} - -static void draw_sprite_nozoom(INT32 addr, INT32 color, INT32 x, INT32 y, INT32 flipx, INT32 flipy, INT32 xsize, INT32 ysize) -{ - if (y >= nScreenHeight || x >= nScreenWidth) return; - - INT32 drawx, drawy; - UINT8 *rom = DrvSprROM + addr; - - for (INT32 ycnt = 0; ycnt < ysize; ycnt++, rom += xsize) - { - if (flipy) - drawy = y + (ysize - 1) - ycnt; - else - drawy = y + ycnt; - - if (drawy < 0 || drawy >= 240) continue; - - UINT16 *dstptr = DrvTmpSprites + drawy * nScreenWidth; - - if (x >= 0 && (x + xsize) < nScreenWidth) { - if (flipx) { - drawx = x + (xsize - 1); - - for (INT32 xcnt = 0; xcnt < xsize; xcnt++) - { - INT32 data = rom[xcnt]; - - if (data) dstptr[drawx - xcnt] = data + color; - } - } else { - dstptr += x; - - for (INT32 xcnt = 0; xcnt < xsize; xcnt++) - { - INT32 data = rom[xcnt]; - - if (data) dstptr[xcnt] = data + color; - } - } - } else { - for (INT32 xcnt = 0; xcnt < xsize; xcnt++) - { - if (flipx) - drawx = x + (xsize - 1) - xcnt; - else - drawx = x + xcnt; - - if (drawx >= 0 && drawx < 320) - { - INT32 data = rom[xcnt]; - - if (data) dstptr[drawx] = data + color; - } - } - } - } -} - -static void draw_sprites() -{ - INT32 extrax = (*((UINT16*)(Drv88Regs + 0))); - INT32 extray = (*((UINT16*)(Drv88Regs + 2))); - - memset (DrvTmpSprites, 0, 320 * 240 * sizeof(INT16)); - - UINT16 *spriteram = (UINT16*)(DrvSprRAM + (*spritelist_select * 0x4000)); - - for (INT32 i = 0; i < 0x4000/2; i+=8) - { - INT32 x = ((BURN_ENDIAN_SWAP_INT16(spriteram[i+0]) + 386) - extrax) & 0x3ff; - INT32 y = ((BURN_ENDIAN_SWAP_INT16(spriteram[i+1]) + 1) - extray) & 0x1ff; - INT32 zoomx = BURN_ENDIAN_SWAP_INT16(spriteram[i+2]) & 0x0fff; - INT32 zoomy = BURN_ENDIAN_SWAP_INT16(spriteram[i+3]) & 0x0fff; - INT32 prio =(BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x0030) << 10; - INT32 flipx = BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x0040; - INT32 flipy = BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x0080; - INT32 color = BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x3f00; - INT32 addr =(BURN_ENDIAN_SWAP_INT16(spriteram[i+5]) | ((BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x000f) << 16)) << 8; - INT32 ysize =(BURN_ENDIAN_SWAP_INT16(spriteram[i+6]) & 0x00ff) << 4; - INT32 xsize =(BURN_ENDIAN_SWAP_INT16(spriteram[i+6]) & 0xff00) >> 4; - - if ((BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x8000) || !zoomx || !zoomy) continue; - - if (x & 0x200) x -= 0x400; // positions are signed - if (y & 0x100) y -= 0x200; - - if (zoomx == 0x100 && zoomy == 0x100) { - draw_sprite_nozoom(addr, color + prio, x, y, flipx, flipy, xsize, ysize); - } else { - draw_sprite_zoomed(addr, color + prio, x, y, flipx, flipy, xsize, ysize, zoomx, zoomy); - } - } -} - -static void blend_sprites_and_transfer() -{ - UINT16 *srcptr = pTransDraw; - UINT16 *srcptr2 = DrvTmpSprites; - UINT8 *dstptr = pBurnDraw; - UINT16 *palram = (UINT16*)DrvPalRAM; - - for (INT32 z = 0; z < 320 * 240; z++) - { - if (!(srcptr2[z] & 0x3fff)) // tiles only, copy - { - PutPix(dstptr + z * nBurnBpp, DrvPalette[(srcptr[z] & 0x7ff) + 0x4000]); - continue; - } - - // check for blend/priority - - INT32 pxl =(srcptr [z] & 0x07ff) + 0x4000; - INT32 pxl2 =(srcptr2[z] & 0x3fff); - - if ((BURN_ENDIAN_SWAP_INT16(palram[pxl]) & 0x8000) && (BURN_ENDIAN_SWAP_INT16(palram[pxl2]) & 0x8000)) // blend - { - INT32 colour = DrvPalette24[pxl]; - INT32 colour2 = DrvPalette24[pxl2]; - - INT32 b = ((colour & 0x000000ff) + (colour2 & 0x000000ff)) >> 1; - INT32 g = ((colour & 0x0000ff00) + (colour2 & 0x0000ff00)) >> 9; - INT32 r = ((colour & 0x00ff0000) + (colour2 & 0x00ff0000)) >> 17; - - PutPix(dstptr + z * nBurnBpp, BurnHighCol(r, g, b, 0)); - } - else if ((srcptr2[z] & 0xc000) >= (srcptr[z] & 0xc000)) - { - PutPix(dstptr + z * nBurnBpp, DrvPalette[pxl2]); - } - else - { - PutPix(dstptr + z * nBurnBpp, DrvPalette[pxl]); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x9000/2; i++) { - palette_update(i); - } - DrvRecalc = 0; - } - - BurnTransferClear(); - - if (!deroon) { // deroon does not have tiles for this layer, so don't bother drawing it... - draw_background_layer(DrvBgRAM0, DrvGfxROM1, DrvC8Regs, 16, 104, 0x0000); - } - draw_background_layer(DrvBgRAM1, DrvGfxROM2, DrvA8Regs, 17, 106, 0x4000); - draw_background_layer(DrvBgRAM2, DrvGfxROM3, DrvB0Regs, 17, 106, 0x8000); - draw_character_layer(); - - blend_sprites_and_transfer(); - - draw_sprites(); // draw next frame's sprites - - return 0; -} - -static INT32 DrvFrame() -{ - SekNewFrame(); -#ifdef ENABLE_SOUND_HARDWARE - ZetNewFrame(); -#endif - - watchdog++; - if (watchdog >= 400) { //? - DrvDoReset(0); - } - - if (DrvReset) { - DrvDoReset(1); - } - - { - memset (DrvInputs, 0xff, 2 * sizeof(UINT16)); - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - - // clear opposites - if ((DrvInputs[0] & 0x03) == 0x00) DrvInputs[0] |= 0x03; - if ((DrvInputs[0] & 0x0c) == 0x00) DrvInputs[0] |= 0x0c; - if ((DrvInputs[1] & 0x03) == 0x00) DrvInputs[1] |= 0x03; - if ((DrvInputs[1] & 0x0c) == 0x00) DrvInputs[1] |= 0x0c; - } - - INT32 nSegment; - INT32 nInterleave = 256; -#ifdef ENABLE_SOUND_HARDWARE - INT32 nSoundBufferPos = 0; -#endif - INT32 nCyclesTotal[2] = { 1600000000 / 5745, 800000000 / 5745 }; // 57.4458hz - INT32 nCyclesDone[2] = { 0, 0 }; - - nCyclesTotal[0] = (INT32)((INT64)nCyclesTotal[0] * nBurnCPUSpeedAdjust / 0x0100); - nCyclesTotal[1] = (INT32)((INT64)nCyclesTotal[1] * nBurnCPUSpeedAdjust / 0x0100); - - SekOpen(0); -#ifdef ENABLE_SOUND_HARDWARE - ZetOpen(0); -#endif - - vblank = 1; - - for (INT32 i = 0; i < nInterleave; i++) - { - if (i == 240) { - vblank = 0; - SekSetIRQLine(1, SEK_IRQSTATUS_ACK); - } - - nSegment = nCyclesTotal[0] / nInterleave; - nCyclesDone[0] += SekRun(nSegment); - -#ifdef ENABLE_SOUND_HARDWARE - nCyclesDone[1] += ZetRun((SekTotalCycles() / 2) - ZetTotalCycles()); - - if (pBurnSoundOut) { - nSegment = nBurnSoundLen / nInterleave; - YMZ280BRender(pBurnSoundOut + nSoundBufferPos, nSegment); - MSM6295Render(0, pBurnSoundOut + nSoundBufferPos, nSegment); - - nSoundBufferPos += nSegment << 1; - } -#endif - } - - SekSetIRQLine(1, SEK_IRQSTATUS_NONE); - -#ifdef ENABLE_SOUND_HARDWARE - if (pBurnSoundOut) { - nSegment = nBurnSoundLen - nSoundBufferPos; - if (nSegment > 0) { - YMZ280BRender(pBurnSoundOut + nSoundBufferPos, nSegment); - MSM6295Render(0, pBurnSoundOut + nSoundBufferPos, nSegment); - } - } - - ZetClose(); -#endif - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - DrvRecalc = 1; - - if (nAction & ACB_MEMORY_ROM) { - ba.Data = Drv68KROM; - ba.nLen = 0x100000; - ba.nAddress = 0; - ba.szName = "68K ROM"; - BurnAcb(&ba); - } - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = Drv68KRAM; - ba.nLen = 0x010000; - ba.nAddress = 0x200000; - ba.szName = "68K RAM"; - BurnAcb(&ba); - - ba.Data = DrvBgRAM0; - ba.nLen = 0x0001000; - ba.nAddress = 0x300000; - ba.szName = "Background RAM"; - BurnAcb(&ba); - - ba.Data = DrvBgScrRAM0; - ba.nLen = 0x000400; - ba.nAddress = 0x301000; - ba.szName = "Background Scroll RAM"; - BurnAcb(&ba); - - ba.Data = DrvBgRAM1; - ba.nLen = 0x0001000; - ba.nAddress = 0x400000; - ba.szName = "Midground RAM"; - BurnAcb(&ba); - - ba.Data = DrvBgScrRAM1; - ba.nLen = 0x000400; - ba.nAddress = 0x401000; - ba.szName = "Midground Scroll RAM"; - BurnAcb(&ba); - - ba.Data = DrvBgRAM2; - ba.nLen = 0x0001000; - ba.nAddress = 0x500000; - ba.szName = "Foreground RAM"; - BurnAcb(&ba); - - ba.Data = DrvBgScrRAM2; - ba.nLen = 0x000400; - ba.nAddress = 0x501000; - ba.szName = "Foreground Scroll RAM"; - BurnAcb(&ba); - - ba.Data = DrvTxtRAM; - ba.nLen = 0x004000; - ba.nAddress = 0x700000; - ba.szName = "Text RAM"; - BurnAcb(&ba); - - ba.Data = DrvSprRAM; - ba.nLen = 0x001000; - ba.nAddress = 0x800000; - ba.szName = "Sprite RAM"; - BurnAcb(&ba); - - ba.Data = Drv88Regs; - ba.nLen = 0x000004; - ba.nAddress = 0x880000; - ba.szName = "880000 Registers"; - BurnAcb(&ba); - - ba.Data = DrvPalRAM; - ba.nLen = 0x008000; - ba.nAddress = 0x900000; - ba.szName = "Sprite Palette RAM"; - BurnAcb(&ba); - - ba.Data = DrvPalRAM; - ba.nLen = 0x001000; - ba.nAddress = 0x980000; - ba.szName = "Layer Palette RAM"; - BurnAcb(&ba); - - ba.Data = DrvA8Regs; - ba.nLen = 0x000006; - ba.nAddress = 0xa80000; - ba.szName = "A80000 Registers"; - BurnAcb(&ba); - - ba.Data = DrvB0Regs; - ba.nLen = 0x000006; - ba.nAddress = 0xb00000; - ba.szName = "B00000 Registers"; - BurnAcb(&ba); - - ba.Data = DrvC0Regs; - ba.nLen = 0x000006; - ba.nAddress = 0xc00000; - ba.szName = "C00000 Registers"; - BurnAcb(&ba); - - ba.Data = DrvC8Regs; - ba.nLen = 0x000006; - ba.nAddress = 0xc80000; - ba.szName = "C80000 Registers"; - BurnAcb(&ba); - -#ifdef ENABLE_SOUND_HARDWARE - ba.Data = DrvZ80RAM; - ba.nLen = 0x001800; - ba.nAddress = 0xff0000; - ba.szName = "Z80 RAM (Not accessible)"; - BurnAcb(&ba); -#endif - } - - if (nAction & ACB_DRIVER_DATA) { - - SekScan(nAction); -#ifdef ENABLE_SOUND_HARDWARE - ZetScan(nAction); - - // ymf262 - YMZ280BScan(); - MSM6295Scan(0, nAction); -#endif - - EEPROMScan(nAction, pnMin); - - SCAN_VAR(protection_read_pointer); - SCAN_VAR(protection_status); - SCAN_VAR(protection_value); - - } - - if (nAction & ACB_WRITE) { -#ifdef ENABLE_SOUND_HARDWARE - INT32 bank; - - ZetOpen(0); - bank = *DrvZ80Bank; - *DrvZ80Bank = ~0; - bankswitch(bank); - ZetClose(); - - bank = *DrvOkiBank; - *DrvOkiBank = ~0; - oki_bankswitch(*DrvOkiBank); -#endif - } - - return 0; -} - - -// Deroon DeroDero - -static struct BurnRomInfo deroonRomDesc[] = { - { "t001.upau1", 0x080000, 0x14b92c18, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "t002.upal1", 0x080000, 0x0fb05c68, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "t003.uz1", 0x040000, 0x8bdfafa0, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "t101.uah1", 0x200000, 0x74baf845, 3 | BRF_GRA }, // 3 Sprites - { "t102.ual1", 0x200000, 0x1a02c4a3, 3 | BRF_GRA }, // 4 - { "t103.ubl1", 0x400000, 0x84e7da88, 3 | BRF_GRA }, // 5 - { "t104.ucl1", 0x200000, 0x66eb611a, 3 | BRF_GRA }, // 6 - - { "t301.ubd1", 0x100000, 0x8b026177, 4 | BRF_GRA }, // 7 Character Tiles - - { "t201.ubb1", 0x100000, 0xd5a087ac, 6 | BRF_GRA }, // 8 Midground Layer - - { "t202.ubc1", 0x100000, 0xf051dae1, 7 | BRF_GRA }, // 9 Foreground Layer - - { "t401.uya1", 0x200000, 0x92111992, 8 | BRF_SND }, // 10 YMZ280B Samples - - { "t501.uad1", 0x080000, 0x2fbcfe27, 9 | BRF_SND }, // 11 OKI6295 Samples - - { "deroon_68hc11a8.rom", 0x002000, 0x00000000, 0 | BRF_NODUMP }, // 12 68HC11A8 Code - { "deroon_68hc11a8.eeprom", 0x000200, 0x00000000, 0 | BRF_NODUMP }, // 13 68HC11A8 EEPROM -}; - -STD_ROM_PICK(deroon) -STD_ROM_FN(deroon) - -static INT32 DeroonRomCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x0000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x0000000, 1, 2)) return 1; - -#ifdef ENABLE_SOUND_HARDWARE - if (BurnLoadRom(DrvZ80ROM + 0x0000000, 2, 1)) return 1; -#endif - - if (BurnLoadRom(DrvSprROM + 0x0000000, 3, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x0000001, 4, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x0800001, 5, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x1000001, 6, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x0000000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x0000000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x0000000, 9, 1)) return 1; - -#ifdef ENABLE_SOUND_HARDWARE - if (BurnLoadRom(DrvSndROM1 + 0x0000000, 10, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x0080000, 11, 1)) return 1; -#endif - - return 0; -} - -static INT32 DeroonInit() -{ - return CommonInit(DeroonRomCallback, 0x2000000, 0x200000, &deroon_data, 1); -} - -struct BurnDriver BurnDrvDeroon = { - "deroon", NULL, NULL, NULL, "1995", - "Deroon DeroDero\0", "No sound", "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, deroonRomInfo, deroonRomName, NULL, NULL, DrvInputInfo, NULL, - DeroonInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4800, - 320, 240, 4, 3 -}; - - -// Toukidenshou - Angel Eyes (VER. 960614) - -static struct BurnRomInfo tkdenshoRomDesc[] = { - { "aeprge-2.pal", 0x080000, 0x25e453d6, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "aeprgo-2.pau", 0x080000, 0x22d59510, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "aesprg-2.z1", 0x020000, 0x43550ab6, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "ae100h.ah1", 0x400000, 0x06be252b, 3 | BRF_GRA }, // 3 Sprites - { "ae100.al1", 0x400000, 0x009cdff4, 3 | BRF_GRA }, // 4 - { "ae101h.bh1", 0x400000, 0xf2469eff, 3 | BRF_GRA }, // 5 - { "ae101.bl1", 0x400000, 0xdb7791bb, 3 | BRF_GRA }, // 6 - { "ae102h.ch1", 0x200000, 0xf9d2a343, 3 | BRF_GRA }, // 7 - { "ae102.cl1", 0x200000, 0x681be889, 3 | BRF_GRA }, // 8 - { "ae104.el1", 0x400000, 0xe431b798, 3 | BRF_GRA }, // 9 - { "ae105.fl1", 0x400000, 0xb7f9ebc1, 3 | BRF_GRA }, // 10 - { "ae106.gl1", 0x200000, 0x7c50374b, 3 | BRF_GRA }, // 11 - - { "ae300w36.bd1", 0x080000, 0xe829f29e, 4 | BRF_GRA }, // 12 Character Tiles - - { "ae200w74.ba1", 0x100000, 0xc1645041, 5 | BRF_GRA }, // 13 Background Tiles - - { "ae201w75.bb1", 0x100000, 0x3f63bdff, 6 | BRF_GRA }, // 14 Midground Tiles - - { "ae202w76.bc1", 0x100000, 0x5cc857ca, 7 | BRF_GRA }, // 15 Foreground Tiles - - { "ae400t23.ya1", 0x200000, 0xc6ffb043, 8 | BRF_SND }, // 16 YMZ280B Samples - { "ae401t24.yb1", 0x200000, 0xd83f1a73, 8 | BRF_SND }, // 17 - - { "ae500w07.ad1", 0x080000, 0x3734f92c, 9 | BRF_SND }, // 18 OKI6295 Samples - - { "tkdensho_68hc11a8.rom", 0x002000, 0x00000000, 0 | BRF_NODUMP }, // 19 68HC11A8 Code - { "tkdensho_68hc11a8.eeprom", 0x000200, 0x00000000, 0 | BRF_NODUMP }, // 20 68HC11A8 EEPROM -}; - -STD_ROM_PICK(tkdensho) -STD_ROM_FN(tkdensho) - -static INT32 TkdenshoRomCallback() -{ - if (BurnLoadRom(Drv68KROM + 0x0000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x0000000, 1, 2)) return 1; - -#ifdef ENABLE_SOUND_HARDWARE - if (BurnLoadRom(DrvZ80ROM + 0x0000000, 2, 1)) return 1; - memcpy (DrvZ80ROM + 0x20000, DrvZ80ROM, 0x20000); -#endif - - if (BurnLoadRom(DrvSprROM + 0x0000000, 3, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x0000001, 4, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x0800000, 5, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x0800001, 6, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x1000000, 7, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x1000001, 8, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x2000001, 9, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x2800001, 10, 2)) return 1; - if (BurnLoadRom(DrvSprROM + 0x3000001, 11, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x0000000, 12, 1)) return 1; - memcpy (DrvGfxROM0 + 0x80000, DrvGfxROM0, 0x80000); // double here rather than mask later - - if (BurnLoadRom(DrvGfxROM1 + 0x0000000, 13, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x0000000, 14, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x0000000, 15, 1)) return 1; - -#ifdef ENABLE_SOUND_HARDWARE - if (BurnLoadRom(DrvSndROM1 + 0x0000000, 16, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x0200000, 17, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0 + 0x0080000, 18, 1)) return 1; -#endif - - return 0; -} - -static INT32 TkdenshoInit() -{ - return CommonInit(TkdenshoRomCallback, 0x4000000, 0x400000, &tkdensho_data, 0); -} - -struct BurnDriver BurnDrvTkdensho = { - "tkdensho", NULL, NULL, NULL, "1996", - "Toukidenshou - Angel Eyes (VER. 960614)\0", "No sound", "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, tkdenshoRomInfo, tkdenshoRomName, NULL, NULL, DrvInputInfo, NULL, - TkdenshoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4800, - 320, 240, 4, 3 -}; - - -// Toukidenshou - Angel Eyes (VER. 960427) - -static struct BurnRomInfo tkdenshoaRomDesc[] = { - { "aeprge.pal", 0x080000, 0x17a209ff, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "aeprgo.pau", 0x080000, 0xd265e6a1, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "aesprg-2.z1", 0x020000, 0x43550ab6, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "ae100h.ah1", 0x400000, 0x06be252b, 3 | BRF_GRA }, // 3 Sprites - { "ae100.al1", 0x400000, 0x009cdff4, 3 | BRF_GRA }, // 4 - { "ae101h.bh1", 0x400000, 0xf2469eff, 3 | BRF_GRA }, // 5 - { "ae101.bl1", 0x400000, 0xdb7791bb, 3 | BRF_GRA }, // 6 - { "ae102h.ch1", 0x200000, 0xf9d2a343, 3 | BRF_GRA }, // 7 - { "ae102.cl1", 0x200000, 0x681be889, 3 | BRF_GRA }, // 8 - { "ae104.el1", 0x400000, 0xe431b798, 3 | BRF_GRA }, // 9 - { "ae105.fl1", 0x400000, 0xb7f9ebc1, 3 | BRF_GRA }, // 10 - { "ae106.gl1", 0x200000, 0x7c50374b, 3 | BRF_GRA }, // 11 - - { "ae300w36.bd1", 0x080000, 0xe829f29e, 4 | BRF_GRA }, // 12 Character Tiles - - { "ae200w74.ba1", 0x100000, 0xc1645041, 5 | BRF_GRA }, // 13 Background Tiles - - { "ae201w75.bb1", 0x100000, 0x3f63bdff, 6 | BRF_GRA }, // 14 Midground Tiles - - { "ae202w76.bc1", 0x100000, 0x5cc857ca, 7 | BRF_GRA }, // 15 Foreground Tiles - - { "ae400t23.ya1", 0x200000, 0xc6ffb043, 8 | BRF_SND }, // 16 YMZ280B Samples - { "ae401t24.yb1", 0x200000, 0xd83f1a73, 8 | BRF_SND }, // 17 - - { "ae500w07.ad1", 0x080000, 0x3734f92c, 9 | BRF_SND }, // 18 OKI6295 Samples - - { "tkdensho_68hc11a8.rom", 0x002000, 0x00000000, 0 | BRF_NODUMP }, // 19 68HC11A8 Code - { "tkdensho_68hc11a8.eeprom", 0x000200, 0x00000000, 0 | BRF_NODUMP }, // 20 68HC11A8 EEPROM -}; - -STD_ROM_PICK(tkdenshoa) -STD_ROM_FN(tkdenshoa) - -static INT32 TkdenshoaInit() -{ - return CommonInit(TkdenshoRomCallback, 0x4000000, 0x400000, &tkdenshoa_data, 0); -} - -struct BurnDriver BurnDrvTkdenshoa = { - "tkdenshoa", "tkdensho", NULL, NULL, "1996", - "Toukidenshou - Angel Eyes (VER. 960427)\0", "No sound", "Tecmo", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, tkdenshoaRomInfo, tkdenshoaRomName, NULL, NULL, DrvInputInfo, NULL, - TkdenshoaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4800, - 320, 240, 4, 3 -}; +// FB Alpha Tecmo System driver module +// Based on MAME driver by Farfetch, David Haywood, Tomasz Slanina, and nuapete + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "msm6295.h" +#include "eeprom.h" +#include "ymz280b.h" +// ymf262 + +//#define ENABLE_SOUND_HARDWARE // no sound without ymf262 core anyway... + +#ifdef ENABLE_SOUND_HARDWARE +#include "z80_intf.h" +#endif + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvSprROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; + +static UINT8 *Drv68KRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvTxtRAM; +static UINT8 *DrvBgRAM0; +static UINT8 *DrvBgRAM1; +static UINT8 *DrvBgRAM2; +static UINT8 *DrvBgScrRAM0; +static UINT8 *DrvBgScrRAM1; +static UINT8 *DrvBgScrRAM2; +static UINT8 *spritelist_select; +static UINT8 *Drv88Regs; +static UINT8 *DrvA8Regs; +static UINT8 *DrvB0Regs; +static UINT8 *DrvC0Regs; +static UINT8 *DrvC8Regs; + +#ifdef ENABLE_SOUND_HARDWARE +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *DrvOkiBank; +static UINT8 *DrvZ80Bank; +static UINT8 *soundlatch; +static UINT8 *soundlatch2; +#endif + +static UINT8 protection_read_pointer; +static UINT8 protection_status; +static UINT8 protection_value; + +static UINT16 *DrvTmpSprites; + +static UINT32 *DrvPalette; +static UINT32 *DrvPalette24; +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvReset; +static UINT16 DrvInputs[2]; + +static INT32 vblank; +static INT32 watchdog; +static INT32 deroon; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 8, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 10, "p1 fire 4" }, + + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, DrvJoy2 + 10, "p2 fire 4" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service 1", BIT_DIGITAL, DrvJoy1 + 9, "service" }, + {"Service 2", BIT_DIGITAL, DrvJoy2 + 9, "service" }, +}; + +STDINPUTINFO(Drv) + +struct prot_data +{ + UINT8 passwd_len; + const UINT8* passwd; + const UINT8* code; + UINT8 checksums[4]; +}; + +static const struct prot_data *protection_data; + +static const UINT8 deroon_passwd[] = { 'L', 'U', 'N', 'A', 0 }; +static const UINT8 deroon_upload[] = { 0x02, 0x4e, 0x75, 0x00 }; +static const struct prot_data deroon_data = { 0x05, deroon_passwd, deroon_upload, { 0xa6, 0x29, 0x4b, 0x3f } }; + +static const UINT8 tkdensho_passwd[] = { 'A','G','E','P','R','O','T','E','C','T',' ','S','T','A','R','T', 0 }; +static const UINT8 tkdensho_upload[] = { 0x06, 0x4e, 0xf9, 0x00, 0x00, 0x22, 0xc4, 0x00 }; +static const struct prot_data tkdensho_data = { 0x11, tkdensho_passwd, tkdensho_upload, { 0xbf, 0xfa, 0xda, 0xda } }; +static const struct prot_data tkdenshoa_data = { 0x11, tkdensho_passwd, tkdensho_upload, { 0xbf, 0xfa, 0x21, 0x5d } }; + +static void protection_reset() +{ + protection_read_pointer = 0; + protection_status = 0; // idle + protection_value = 0xff; +} + +static void tecmosys_prot_data_write(INT32 data) +{ + static const UINT8 ranges[] = { + 0x10,0x11,0x12,0x13,0x24,0x25,0x26,0x27,0x38,0x39,0x3a,0x3b,0x4c,0x4d,0x4e,0x4f, 0x00 + }; + + switch (protection_status) + { + case 0: // idle + if (data == 0x13) + { + protection_status = 1; // login + protection_value = protection_data->passwd_len; + protection_read_pointer = 0; + break; + } + break; + + case 1: // login + if (protection_read_pointer >= protection_data->passwd_len) + { + protection_status = 2; // send code + protection_value = protection_data->code[0]; + protection_read_pointer = 1; + } + else + protection_value = protection_data->passwd[protection_read_pointer++] == data ? 0 : 0xff; + break; + + case 2: // send code + if (protection_read_pointer >= protection_data->code[0]+2) + { + protection_status = 3; // send address + protection_value = ranges[0]; + protection_read_pointer = 1; + } + else + protection_value = data == protection_data->code[protection_read_pointer-1] ? protection_data->code[protection_read_pointer++] : 0xff; + break; + + case 3: // send address + if (protection_read_pointer >= 17) + { + protection_status = 4; // send checksum + protection_value = 0; + protection_read_pointer = 0; + } + else + { + protection_value = data == ranges[protection_read_pointer-1] ? ranges[protection_read_pointer++] : 0xff; + } + break; + + case 4: // send checksum + if (protection_read_pointer >= 5) + { + protection_status = 5; // done + protection_value = 0; + } + else + protection_value = data == protection_data->checksums[protection_read_pointer] ? protection_data->checksums[protection_read_pointer++] : 0xff; + break; + + case 5: // done + break; + } +} + +void __fastcall tecmosys_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x880000: + case 0x880002: + *((UINT16*)(Drv88Regs + (address & 0x02))) = data; + return; + + case 0x880008: + *spritelist_select = data & 0x03; + return; + + case 0x880022: + watchdog = 0; + return; + + case 0xa00000: + EEPROMWrite((data & 0x0400), (data & 0x0200), (data & 0x0800)); + return; + + case 0xa80000: + case 0xa80002: + case 0xa80004: + *((UINT16*)(DrvA8Regs + (address & 0x06))) = data; + return; + + case 0xb00000: + case 0xb00002: + case 0xb00004: + *((UINT16*)(DrvB0Regs + (address & 0x06))) = data; + return; + + case 0xb80000: // protection status - does nothing + return; + + case 0xc00000: + case 0xc00002: + case 0xc00004: + *((UINT16*)(DrvC0Regs + (address & 0x06))) = data; + return; + + case 0xc80000: + case 0xc80002: + case 0xc80004: + *((UINT16*)(DrvC8Regs + (address & 0x06))) = data; + return; + + case 0xe00000: +#ifdef ENABLE_SOUND_HARDWARE + ZetRun((SekTotalCycles() / 2) - ZetTotalCycles()); + *soundlatch = data & 0xff; + ZetNmi(); +#endif + return; + + case 0xe80000: + tecmosys_prot_data_write(data >> 8); + return; + } +} + +void __fastcall tecmosys_main_write_byte(UINT32 /*address*/, UINT8 /*data*/) +{ + +} + +UINT16 __fastcall tecmosys_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x880000: + return vblank; + + case 0xd00000: + return DrvInputs[0]; + + case 0xd00002: + return DrvInputs[1]; + + case 0xd80000: + return (EEPROMRead() & 1) << 11; + + case 0xf00000: +#ifdef ENABLE_SOUND_HARDWARE + ZetRun((SekTotalCycles() / 2) - ZetTotalCycles()); + return *soundlatch2; +#else + return 0; +#endif + + case 0xf80000: + INT32 ret = protection_value; + protection_value = 0xff; + return ret << 8; + } + + return 0; +} + +UINT8 __fastcall tecmosys_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0xb80000: + return 0x00; // protection status + } + + return 0; +} + +static inline void palette_update(INT32 pal) +{ + UINT16 p = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + pal * 2))); + + INT32 r = (p >> 5) & 0x1f; + INT32 g = (p >> 10) & 0x1f; + INT32 b = (p >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[pal] = BurnHighCol(r, g, b, 0); + DrvPalette24[pal] = (r << 16) + (g << 8) + b; +} + +void __fastcall tecmosys_palette_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xff8000) == 0x900000) { + *((UINT16 *)(DrvPalRAM + 0x0000 + (address & 0x7ffe))) = BURN_ENDIAN_SWAP_INT16(data); + palette_update((0x0000 + (address & 0x7ffe)) / 2); + return; + } + + if ((address & 0xfff000) == 0x980000) { + *((UINT16 *)(DrvPalRAM + 0x8000 + (address & 0x0ffe))) = BURN_ENDIAN_SWAP_INT16(data); + palette_update((0x8000 + (address & 0x0ffe)) / 2); + return; + } +} + +void __fastcall tecmosys_palette_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xff8000) == 0x900000) { + DrvPalRAM[(0x0000 + (address & 0x7fff)) ^ 1] = data; + palette_update((0x0000 + (address & 0x7ffe)) / 2); + return; + } + + if ((address & 0xfff000) == 0x980000) { + DrvPalRAM[(0x8000 + (address & 0x0fff)) ^ 1] = data; + palette_update((0x8000 + (address & 0x0ffe)) / 2); + return; + } +} + +#ifdef ENABLE_SOUND_HARDWARE + +static void bankswitch(INT32 data) +{ + if ((data & 0x0f) != *DrvZ80Bank) { + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + (data & 0x0f) * 0x4000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + (data & 0x0f) * 0x4000); + } + + *DrvZ80Bank = data & 0x0f; +} + +static void oki_bankswitch(INT32 data) +{ + if ((data & 0x33) != *DrvOkiBank) { + + INT32 upperbank = (data & 0x30) >> 4; + INT32 lowerbank = (data & 0x03) >> 0; + + if (lowerbank != ((*DrvOkiBank & 0x0f) >> 0)) { + memcpy (DrvSndROM0 + 0x00000, DrvSndROM0 + 0x80000 + lowerbank * 0x20000, 0x20000); + } + + if (upperbank != ((*DrvOkiBank & 0xf0) >> 4)) { + memcpy (DrvSndROM0 +0x20000, DrvSndROM0 + 0x80000 + upperbank * 0x20000, 0x20000); + } + } + + *DrvOkiBank = data & 0x33; +} + +void __fastcall tecmosys_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + // ymf262_w + return; + + case 0x10: + MSM6295Command(0, data); + return; + + case 0x20: + oki_bankswitch(data); + return; + + case 0x30: + bankswitch(data); + return; + + case 0x50: + *soundlatch2 = data; + return; + + case 0x60: + YMZ280BSelectRegister(data); + return; + + case 0x61: + YMZ280BWriteRegister(data); + return; + } +} + +UINT8 __fastcall tecmosys_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + return 0; // ymf262_r + + case 0x10: + return MSM6295ReadStatus(0); + + case 0x40: + return *soundlatch; + + case 0x60: + case 0x61: + return YMZ280BReadStatus(); + } + + return 0; +} + +/* +static void DrvIrqHandler(INT32 irq) // for ymf262 +{ + if (irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} +*/ + +#endif + +static INT32 DrvDoReset(INT32 full_reset) +{ + if (full_reset) { + memset (AllRam, 0, RamEnd - AllRam); + } + + SekOpen(0); + SekReset(); + SekClose(); + + EEPROMReset(); + + protection_reset(); + + watchdog = 0; + +#ifdef ENABLE_SOUND_HARDWARE + ZetOpen(0); + ZetReset(); + ZetClose(); + + // ymf262 + YMZ280BReset(); + MSM6295Reset(0); + + *DrvOkiBank = *DrvZ80Bank = ~0; +#endif + + return 0; +} + +#ifdef ENABLE_SOUND_HARDWARE +static INT32 MemIndex(INT32 sndlen) +#else +static INT32 MemIndex(INT32 /*sndlen*/) +#endif +{ + + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x100000; + + DrvGfxROM0 = Next; Next += 0x200000; + DrvGfxROM1 = Next; Next += 0x200000; + DrvGfxROM2 = Next; Next += 0x200000; + DrvGfxROM3 = Next; Next += 0x200000; + +#ifdef ENABLE_SOUND_HARDWARE + DrvZ80ROM = Next; Next += 0x040000; + + MSM6295ROM = Next; + DrvSndROM0 = Next; Next += 0x100000; + + YMZ280BROM = Next; + DrvSndROM1 = Next; Next += sndlen; +#endif + + DrvPalette = (UINT32*)Next; Next += 0x4800 * sizeof(UINT32); + DrvPalette24 = (UINT32*)Next; Next += 0x4800 * sizeof(UINT32); + + DrvTmpSprites = (UINT16*)Next; Next += 320 * 240 * sizeof(UINT16); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvSprRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x009000; + + DrvTxtRAM = Next; Next += 0x004000; + + DrvBgRAM0 = Next; Next += 0x001000; + DrvBgScrRAM0 = Next; Next += 0x000400; + DrvBgRAM1 = Next; Next += 0x001000; + DrvBgScrRAM1 = Next; Next += 0x000400; + DrvBgRAM2 = Next; Next += 0x001000; + DrvBgScrRAM2 = Next; Next += 0x000400; + + +#ifdef ENABLE_SOUND_HARDWARE + DrvOkiBank = Next; Next += 0x000001; + DrvZ80Bank = Next; Next += 0x000001; + + DrvZ80RAM = Next; Next += 0x001800; + + soundlatch = Next; Next += 0x000001; + soundlatch2 = Next; Next += 0x000001; +#endif + spritelist_select = Next; Next += 0x000001; + + Drv88Regs = Next; Next += 0x000004; + DrvA8Regs = Next; Next += 0x000006; + DrvB0Regs = Next; Next += 0x000006; + DrvC0Regs = Next; Next += 0x000006; + DrvC8Regs = Next; Next += 0x000006; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void descramble_sprites(INT32 len) +{ + UINT8 *src = DrvSprROM; + UINT8 tmp[4]; + + for (INT32 i=0; i < len; i+=4) + { + tmp[0] = ((src[i+2]&0xf0)>>0) | ((src[i+3]&0xf0)>>4); + tmp[1] = ((src[i+2]&0x0f)<<4) | ((src[i+3]&0x0f)>>0); + tmp[2] = ((src[i+0]&0xf0)>>0) | ((src[i+1]&0xf0)>>4); + tmp[3] = ((src[i+0]&0x0f)<<4) | ((src[i+1]&0x0f)<<0); + + memcpy (src + i, tmp, 4); + } +} + +static void expand_characters() +{ + for (INT32 i = 0x100000 - 1; i >= 0; i--) { + DrvGfxROM0[i * 2 + 0] = DrvGfxROM0[i] >> 4; + DrvGfxROM0[i * 2 + 1] = DrvGfxROM0[i] & 0x0f; + } +} + +static void expand_tiles(UINT8 *rom, INT32 len) +{ + INT32 Planes[4] = { 0, 1, 2, 3 }; + INT32 XOffs[16] = { 0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c, 0x100, 0x104, 0x108, 0x10c, 0x110, 0x114, 0x118, 0x11c }; + INT32 YOffs[16] = { 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(len); + + memcpy (tmp, rom, len); + + GfxDecode((len * 2) / (16 * 16), 4, 16, 16, Planes, XOffs, YOffs, 128*8, tmp, rom); + + BurnFree (tmp); +} + +static INT32 CommonInit(INT32 (*pRomLoadCallback)(), INT32 spritelen, INT32 sndlen, const struct prot_data *dev_data_pointer, INT32 game) +{ + AllMem = NULL; + MemIndex(sndlen); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(sndlen); + + DrvSprROM = (UINT8*)BurnMalloc(spritelen); + if (DrvSprROM == NULL) return 1; + + if (pRomLoadCallback) { + if (pRomLoadCallback()) return 1; + } + + descramble_sprites(spritelen); + expand_characters(); + expand_tiles(DrvGfxROM1, 0x100000); + expand_tiles(DrvGfxROM2, 0x100000); + expand_tiles(DrvGfxROM3, 0x100000); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(DrvBgRAM0, 0x300000, 0x300fff, SM_RAM); + SekMapMemory(DrvBgScrRAM0, 0x301000, 0x3013ff, SM_RAM); + SekMapMemory(DrvBgRAM1, 0x400000, 0x400fff, SM_RAM); + SekMapMemory(DrvBgScrRAM1, 0x401000, 0x4013ff, SM_RAM); + SekMapMemory(DrvBgRAM2, 0x500000, 0x500fff, SM_RAM); + SekMapMemory(DrvBgScrRAM2, 0x501000, 0x5013ff, SM_RAM); + SekMapMemory(DrvTxtRAM, 0x700000, 0x703fff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x800000, 0x80ffff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x900000, 0x907fff, SM_ROM); + SekMapMemory(DrvPalRAM + 0x8000,0x980000, 0x980fff, SM_ROM); + SekSetWriteWordHandler(0, tecmosys_main_write_word); + SekSetWriteByteHandler(0, tecmosys_main_write_byte); + SekSetReadWordHandler(0, tecmosys_main_read_word); + SekSetReadByteHandler(0, tecmosys_main_read_byte); + + SekMapHandler(1, 0x900000, 0x980fff, SM_WRITE); + SekSetWriteWordHandler(1, tecmosys_palette_write_word); + SekSetWriteByteHandler(1, tecmosys_palette_write_byte); + SekClose(); + + deroon = game; + protection_data = dev_data_pointer; + + EEPROMInit(&eeprom_interface_93C46); + + BurnSetRefreshRate(57.4458); + +#ifdef ENABLE_SOUND_HARDWARE + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0xe000, 0xf7ff, 0, DrvZ80RAM); + ZetMapArea(0xe000, 0xf7ff, 1, DrvZ80RAM); + ZetMapArea(0xe000, 0xf7ff, 2, DrvZ80RAM); + ZetSetOutHandler(tecmosys_sound_out); + ZetSetInHandler(tecmosys_sound_in); + ZetClose(); + + // ymf262 + + YMZ280BInit(16900000, NULL); + YMZ280BSetRoute(BURN_SND_YMZ280B_YMZ280B_ROUTE_1, 0.30, BURN_SND_ROUTE_LEFT); + YMZ280BSetRoute(BURN_SND_YMZ280B_YMZ280B_ROUTE_2, 0.30, BURN_SND_ROUTE_RIGHT); + + MSM6295Init(0, 2000000 / 132, 1); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); +#endif + + GenericTilesInit(); + + DrvDoReset(1); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + EEPROMExit(); + + SekExit(); + +#ifdef ENABLE_SOUND_HARDWARE + ZetExit(); + + // ymf262 + + MSM6295Exit(0); + MSM6295ROM = NULL; + + YMZ280BExit(); + YMZ280BROM = NULL; +#endif + + BurnFree (DrvSprROM); + BurnFree (AllMem); + + return 0; +} + +static void draw_character_layer() +{ + UINT16 *vram = (UINT16*)DrvTxtRAM; + + for (INT32 offs = 0; offs < 64 * 64; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]); + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & 0x7fff; + INT32 color = attr & 0x003f; + INT32 flipy = attr & 0x0080; + INT32 flipx = attr & 0x0040; + + if (code == 0) continue; // Should save some cycles + + if (sx >= 0 && sx <= (nScreenWidth - 8) && sy >= 0 && sy <= (nScreenHeight - 8)) { + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); + } else { + Render8x8Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); + } else { + Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); + } + } + } else { + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0xc400, DrvGfxROM0); + } + } + } + } +} + +static void draw_background_layer(UINT8 *ram, UINT8 *gfx, UINT8 *regs, INT32 yoff, INT32 xoff, INT32 priority) +{ + UINT16 *vram = (UINT16*)ram; + + INT32 scrollx = (*((UINT16*)(regs + 0)) + xoff) & 0x1ff; + INT32 scrolly = (*((UINT16*)(regs + 2)) + yoff) & 0x1ff; + + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 4; + INT32 sy = (offs >> 5) << 4; + + sx -= scrollx; + if (sx < -15) sx += 512; + sy -= scrolly; + if (sy < -15) sy += 512; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]); + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & 0x1fff; + INT32 color = attr & 0x003f; + INT32 flipy = attr & 0x0080; + INT32 flipx = attr & 0x0040; + + if (!code) continue; // Should save some cycles + + if (sx >= 0 && sx <= (nScreenWidth - 16) && sy >= 0 && sy <= (nScreenHeight - 16)) { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); + } else { + Render16x16Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); + } else { + Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); + } + } + } else { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, priority, gfx); + } + } + } + } +} + +static void draw_sprite_zoomed(INT32 addr, INT32 color, INT32 x, INT32 y, INT32 flipx, INT32 flipy, INT32 xsize, INT32 ysize, INT32 zoomx, INT32 zoomy) +{ + if (y >= nScreenHeight || x >= nScreenWidth) return; + + INT32 drawx, drawy; + UINT8 *rom = DrvSprROM + addr; + + for (INT32 ycnt = 0; ycnt < ysize; ycnt++, rom += xsize) + { + if (flipy) + drawy = y + (((ysize * zoomy) / 256) - 1) - ((ycnt * zoomy) / 256); + else + drawy = y + ((ycnt * zoomy) / 256); + + if (drawy < 0 || drawy >= 240) continue; + + UINT16 *dstptr = DrvTmpSprites + drawy * nScreenWidth; + + for (INT32 xcnt = 0; xcnt < xsize; xcnt++) + { + if (flipx) + drawx = x + (((xsize * zoomx) / 256) - 1) - ((xcnt * zoomx) / 256); + else + drawx = x + ((xcnt * zoomx) / 256); + + if (drawx >= 0 && drawx < 320) + { + INT32 data = rom[xcnt]; + + if (data) dstptr[drawx] = data + color; + } + } + } +} + +static void draw_sprite_nozoom(INT32 addr, INT32 color, INT32 x, INT32 y, INT32 flipx, INT32 flipy, INT32 xsize, INT32 ysize) +{ + if (y >= nScreenHeight || x >= nScreenWidth) return; + + INT32 drawx, drawy; + UINT8 *rom = DrvSprROM + addr; + + for (INT32 ycnt = 0; ycnt < ysize; ycnt++, rom += xsize) + { + if (flipy) + drawy = y + (ysize - 1) - ycnt; + else + drawy = y + ycnt; + + if (drawy < 0 || drawy >= 240) continue; + + UINT16 *dstptr = DrvTmpSprites + drawy * nScreenWidth; + + if (x >= 0 && (x + xsize) < nScreenWidth) { + if (flipx) { + drawx = x + (xsize - 1); + + for (INT32 xcnt = 0; xcnt < xsize; xcnt++) + { + INT32 data = rom[xcnt]; + + if (data) dstptr[drawx - xcnt] = data + color; + } + } else { + dstptr += x; + + for (INT32 xcnt = 0; xcnt < xsize; xcnt++) + { + INT32 data = rom[xcnt]; + + if (data) dstptr[xcnt] = data + color; + } + } + } else { + for (INT32 xcnt = 0; xcnt < xsize; xcnt++) + { + if (flipx) + drawx = x + (xsize - 1) - xcnt; + else + drawx = x + xcnt; + + if (drawx >= 0 && drawx < 320) + { + INT32 data = rom[xcnt]; + + if (data) dstptr[drawx] = data + color; + } + } + } + } +} + +static void draw_sprites() +{ + INT32 extrax = (*((UINT16*)(Drv88Regs + 0))); + INT32 extray = (*((UINT16*)(Drv88Regs + 2))); + + memset (DrvTmpSprites, 0, 320 * 240 * sizeof(INT16)); + + UINT16 *spriteram = (UINT16*)(DrvSprRAM + (*spritelist_select * 0x4000)); + + for (INT32 i = 0; i < 0x4000/2; i+=8) + { + INT32 x = ((BURN_ENDIAN_SWAP_INT16(spriteram[i+0]) + 386) - extrax) & 0x3ff; + INT32 y = ((BURN_ENDIAN_SWAP_INT16(spriteram[i+1]) + 1) - extray) & 0x1ff; + INT32 zoomx = BURN_ENDIAN_SWAP_INT16(spriteram[i+2]) & 0x0fff; + INT32 zoomy = BURN_ENDIAN_SWAP_INT16(spriteram[i+3]) & 0x0fff; + INT32 prio =(BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x0030) << 10; + INT32 flipx = BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x0040; + INT32 flipy = BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x0080; + INT32 color = BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x3f00; + INT32 addr =(BURN_ENDIAN_SWAP_INT16(spriteram[i+5]) | ((BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x000f) << 16)) << 8; + INT32 ysize =(BURN_ENDIAN_SWAP_INT16(spriteram[i+6]) & 0x00ff) << 4; + INT32 xsize =(BURN_ENDIAN_SWAP_INT16(spriteram[i+6]) & 0xff00) >> 4; + + if ((BURN_ENDIAN_SWAP_INT16(spriteram[i+4]) & 0x8000) || !zoomx || !zoomy) continue; + + if (x & 0x200) x -= 0x400; // positions are signed + if (y & 0x100) y -= 0x200; + + if (zoomx == 0x100 && zoomy == 0x100) { + draw_sprite_nozoom(addr, color + prio, x, y, flipx, flipy, xsize, ysize); + } else { + draw_sprite_zoomed(addr, color + prio, x, y, flipx, flipy, xsize, ysize, zoomx, zoomy); + } + } +} + +static void blend_sprites_and_transfer() +{ + UINT16 *srcptr = pTransDraw; + UINT16 *srcptr2 = DrvTmpSprites; + UINT8 *dstptr = pBurnDraw; + UINT16 *palram = (UINT16*)DrvPalRAM; + + for (INT32 z = 0; z < 320 * 240; z++) + { + if (!(srcptr2[z] & 0x3fff)) // tiles only, copy + { + PutPix(dstptr + z * nBurnBpp, DrvPalette[(srcptr[z] & 0x7ff) + 0x4000]); + continue; + } + + // check for blend/priority + + INT32 pxl =(srcptr [z] & 0x07ff) + 0x4000; + INT32 pxl2 =(srcptr2[z] & 0x3fff); + + if ((BURN_ENDIAN_SWAP_INT16(palram[pxl]) & 0x8000) && (BURN_ENDIAN_SWAP_INT16(palram[pxl2]) & 0x8000)) // blend + { + INT32 colour = DrvPalette24[pxl]; + INT32 colour2 = DrvPalette24[pxl2]; + + INT32 b = ((colour & 0x000000ff) + (colour2 & 0x000000ff)) >> 1; + INT32 g = ((colour & 0x0000ff00) + (colour2 & 0x0000ff00)) >> 9; + INT32 r = ((colour & 0x00ff0000) + (colour2 & 0x00ff0000)) >> 17; + + PutPix(dstptr + z * nBurnBpp, BurnHighCol(r, g, b, 0)); + } + else if ((srcptr2[z] & 0xc000) >= (srcptr[z] & 0xc000)) + { + PutPix(dstptr + z * nBurnBpp, DrvPalette[pxl2]); + } + else + { + PutPix(dstptr + z * nBurnBpp, DrvPalette[pxl]); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x9000/2; i++) { + palette_update(i); + } + DrvRecalc = 0; + } + + BurnTransferClear(); + + if (!deroon) { // deroon does not have tiles for this layer, so don't bother drawing it... + draw_background_layer(DrvBgRAM0, DrvGfxROM1, DrvC8Regs, 16, 104, 0x0000); + } + draw_background_layer(DrvBgRAM1, DrvGfxROM2, DrvA8Regs, 17, 106, 0x4000); + draw_background_layer(DrvBgRAM2, DrvGfxROM3, DrvB0Regs, 17, 106, 0x8000); + draw_character_layer(); + + blend_sprites_and_transfer(); + + draw_sprites(); // draw next frame's sprites + + return 0; +} + +static INT32 DrvFrame() +{ + SekNewFrame(); +#ifdef ENABLE_SOUND_HARDWARE + ZetNewFrame(); +#endif + + watchdog++; + if (watchdog >= 400) { //? + DrvDoReset(0); + } + + if (DrvReset) { + DrvDoReset(1); + } + + { + memset (DrvInputs, 0xff, 2 * sizeof(UINT16)); + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + + // clear opposites + if ((DrvInputs[0] & 0x03) == 0x00) DrvInputs[0] |= 0x03; + if ((DrvInputs[0] & 0x0c) == 0x00) DrvInputs[0] |= 0x0c; + if ((DrvInputs[1] & 0x03) == 0x00) DrvInputs[1] |= 0x03; + if ((DrvInputs[1] & 0x0c) == 0x00) DrvInputs[1] |= 0x0c; + } + + INT32 nSegment; + INT32 nInterleave = 256; +#ifdef ENABLE_SOUND_HARDWARE + INT32 nSoundBufferPos = 0; +#endif + INT32 nCyclesTotal[2] = { 1600000000 / 5745, 800000000 / 5745 }; // 57.4458hz + INT32 nCyclesDone[2] = { 0, 0 }; + + nCyclesTotal[0] = (INT32)((INT64)nCyclesTotal[0] * nBurnCPUSpeedAdjust / 0x0100); + nCyclesTotal[1] = (INT32)((INT64)nCyclesTotal[1] * nBurnCPUSpeedAdjust / 0x0100); + + SekOpen(0); +#ifdef ENABLE_SOUND_HARDWARE + ZetOpen(0); +#endif + + vblank = 1; + + for (INT32 i = 0; i < nInterleave; i++) + { + if (i == 240) { + vblank = 0; + SekSetIRQLine(1, SEK_IRQSTATUS_ACK); + } + + nSegment = nCyclesTotal[0] / nInterleave; + nCyclesDone[0] += SekRun(nSegment); + +#ifdef ENABLE_SOUND_HARDWARE + nCyclesDone[1] += ZetRun((SekTotalCycles() / 2) - ZetTotalCycles()); + + if (pBurnSoundOut) { + nSegment = nBurnSoundLen / nInterleave; + YMZ280BRender(pBurnSoundOut + nSoundBufferPos, nSegment); + MSM6295Render(0, pBurnSoundOut + nSoundBufferPos, nSegment); + + nSoundBufferPos += nSegment << 1; + } +#endif + } + + SekSetIRQLine(1, SEK_IRQSTATUS_NONE); + +#ifdef ENABLE_SOUND_HARDWARE + if (pBurnSoundOut) { + nSegment = nBurnSoundLen - nSoundBufferPos; + if (nSegment > 0) { + YMZ280BRender(pBurnSoundOut + nSoundBufferPos, nSegment); + MSM6295Render(0, pBurnSoundOut + nSoundBufferPos, nSegment); + } + } + + ZetClose(); +#endif + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + DrvRecalc = 1; + + if (nAction & ACB_MEMORY_ROM) { + ba.Data = Drv68KROM; + ba.nLen = 0x100000; + ba.nAddress = 0; + ba.szName = "68K ROM"; + BurnAcb(&ba); + } + + if (nAction & ACB_MEMORY_RAM) { + ba.Data = Drv68KRAM; + ba.nLen = 0x010000; + ba.nAddress = 0x200000; + ba.szName = "68K RAM"; + BurnAcb(&ba); + + ba.Data = DrvBgRAM0; + ba.nLen = 0x0001000; + ba.nAddress = 0x300000; + ba.szName = "Background RAM"; + BurnAcb(&ba); + + ba.Data = DrvBgScrRAM0; + ba.nLen = 0x000400; + ba.nAddress = 0x301000; + ba.szName = "Background Scroll RAM"; + BurnAcb(&ba); + + ba.Data = DrvBgRAM1; + ba.nLen = 0x0001000; + ba.nAddress = 0x400000; + ba.szName = "Midground RAM"; + BurnAcb(&ba); + + ba.Data = DrvBgScrRAM1; + ba.nLen = 0x000400; + ba.nAddress = 0x401000; + ba.szName = "Midground Scroll RAM"; + BurnAcb(&ba); + + ba.Data = DrvBgRAM2; + ba.nLen = 0x0001000; + ba.nAddress = 0x500000; + ba.szName = "Foreground RAM"; + BurnAcb(&ba); + + ba.Data = DrvBgScrRAM2; + ba.nLen = 0x000400; + ba.nAddress = 0x501000; + ba.szName = "Foreground Scroll RAM"; + BurnAcb(&ba); + + ba.Data = DrvTxtRAM; + ba.nLen = 0x004000; + ba.nAddress = 0x700000; + ba.szName = "Text RAM"; + BurnAcb(&ba); + + ba.Data = DrvSprRAM; + ba.nLen = 0x001000; + ba.nAddress = 0x800000; + ba.szName = "Sprite RAM"; + BurnAcb(&ba); + + ba.Data = Drv88Regs; + ba.nLen = 0x000004; + ba.nAddress = 0x880000; + ba.szName = "880000 Registers"; + BurnAcb(&ba); + + ba.Data = DrvPalRAM; + ba.nLen = 0x008000; + ba.nAddress = 0x900000; + ba.szName = "Sprite Palette RAM"; + BurnAcb(&ba); + + ba.Data = DrvPalRAM; + ba.nLen = 0x001000; + ba.nAddress = 0x980000; + ba.szName = "Layer Palette RAM"; + BurnAcb(&ba); + + ba.Data = DrvA8Regs; + ba.nLen = 0x000006; + ba.nAddress = 0xa80000; + ba.szName = "A80000 Registers"; + BurnAcb(&ba); + + ba.Data = DrvB0Regs; + ba.nLen = 0x000006; + ba.nAddress = 0xb00000; + ba.szName = "B00000 Registers"; + BurnAcb(&ba); + + ba.Data = DrvC0Regs; + ba.nLen = 0x000006; + ba.nAddress = 0xc00000; + ba.szName = "C00000 Registers"; + BurnAcb(&ba); + + ba.Data = DrvC8Regs; + ba.nLen = 0x000006; + ba.nAddress = 0xc80000; + ba.szName = "C80000 Registers"; + BurnAcb(&ba); + +#ifdef ENABLE_SOUND_HARDWARE + ba.Data = DrvZ80RAM; + ba.nLen = 0x001800; + ba.nAddress = 0xff0000; + ba.szName = "Z80 RAM (Not accessible)"; + BurnAcb(&ba); +#endif + } + + if (nAction & ACB_DRIVER_DATA) { + + SekScan(nAction); +#ifdef ENABLE_SOUND_HARDWARE + ZetScan(nAction); + + // ymf262 + YMZ280BScan(); + MSM6295Scan(0, nAction); +#endif + + EEPROMScan(nAction, pnMin); + + SCAN_VAR(protection_read_pointer); + SCAN_VAR(protection_status); + SCAN_VAR(protection_value); + + } + + if (nAction & ACB_WRITE) { +#ifdef ENABLE_SOUND_HARDWARE + INT32 bank; + + ZetOpen(0); + bank = *DrvZ80Bank; + *DrvZ80Bank = ~0; + bankswitch(bank); + ZetClose(); + + bank = *DrvOkiBank; + *DrvOkiBank = ~0; + oki_bankswitch(*DrvOkiBank); +#endif + } + + return 0; +} + + +// Deroon DeroDero + +static struct BurnRomInfo deroonRomDesc[] = { + { "t001.upau1", 0x080000, 0x14b92c18, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "t002.upal1", 0x080000, 0x0fb05c68, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "t003.uz1", 0x040000, 0x8bdfafa0, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "t101.uah1", 0x200000, 0x74baf845, 3 | BRF_GRA }, // 3 Sprites + { "t102.ual1", 0x200000, 0x1a02c4a3, 3 | BRF_GRA }, // 4 + { "t103.ubl1", 0x400000, 0x84e7da88, 3 | BRF_GRA }, // 5 + { "t104.ucl1", 0x200000, 0x66eb611a, 3 | BRF_GRA }, // 6 + + { "t301.ubd1", 0x100000, 0x8b026177, 4 | BRF_GRA }, // 7 Character Tiles + + { "t201.ubb1", 0x100000, 0xd5a087ac, 6 | BRF_GRA }, // 8 Midground Layer + + { "t202.ubc1", 0x100000, 0xf051dae1, 7 | BRF_GRA }, // 9 Foreground Layer + + { "t401.uya1", 0x200000, 0x92111992, 8 | BRF_SND }, // 10 YMZ280B Samples + + { "t501.uad1", 0x080000, 0x2fbcfe27, 9 | BRF_SND }, // 11 OKI6295 Samples + + { "deroon_68hc11a8.rom", 0x002000, 0x00000000, 0 | BRF_NODUMP }, // 12 68HC11A8 Code + { "deroon_68hc11a8.eeprom", 0x000200, 0x00000000, 0 | BRF_NODUMP }, // 13 68HC11A8 EEPROM +}; + +STD_ROM_PICK(deroon) +STD_ROM_FN(deroon) + +static INT32 DeroonRomCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x0000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x0000000, 1, 2)) return 1; + +#ifdef ENABLE_SOUND_HARDWARE + if (BurnLoadRom(DrvZ80ROM + 0x0000000, 2, 1)) return 1; +#endif + + if (BurnLoadRom(DrvSprROM + 0x0000000, 3, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x0000001, 4, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x0800001, 5, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x1000001, 6, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x0000000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x0000000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x0000000, 9, 1)) return 1; + +#ifdef ENABLE_SOUND_HARDWARE + if (BurnLoadRom(DrvSndROM1 + 0x0000000, 10, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x0080000, 11, 1)) return 1; +#endif + + return 0; +} + +static INT32 DeroonInit() +{ + return CommonInit(DeroonRomCallback, 0x2000000, 0x200000, &deroon_data, 1); +} + +struct BurnDriver BurnDrvDeroon = { + "deroon", NULL, NULL, NULL, "1995", + "Deroon DeroDero\0", "No sound", "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, deroonRomInfo, deroonRomName, NULL, NULL, DrvInputInfo, NULL, + DeroonInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4800, + 320, 240, 4, 3 +}; + + +// Toukidenshou - Angel Eyes (VER. 960614) + +static struct BurnRomInfo tkdenshoRomDesc[] = { + { "aeprge-2.pal", 0x080000, 0x25e453d6, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "aeprgo-2.pau", 0x080000, 0x22d59510, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "aesprg-2.z1", 0x020000, 0x43550ab6, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "ae100h.ah1", 0x400000, 0x06be252b, 3 | BRF_GRA }, // 3 Sprites + { "ae100.al1", 0x400000, 0x009cdff4, 3 | BRF_GRA }, // 4 + { "ae101h.bh1", 0x400000, 0xf2469eff, 3 | BRF_GRA }, // 5 + { "ae101.bl1", 0x400000, 0xdb7791bb, 3 | BRF_GRA }, // 6 + { "ae102h.ch1", 0x200000, 0xf9d2a343, 3 | BRF_GRA }, // 7 + { "ae102.cl1", 0x200000, 0x681be889, 3 | BRF_GRA }, // 8 + { "ae104.el1", 0x400000, 0xe431b798, 3 | BRF_GRA }, // 9 + { "ae105.fl1", 0x400000, 0xb7f9ebc1, 3 | BRF_GRA }, // 10 + { "ae106.gl1", 0x200000, 0x7c50374b, 3 | BRF_GRA }, // 11 + + { "ae300w36.bd1", 0x080000, 0xe829f29e, 4 | BRF_GRA }, // 12 Character Tiles + + { "ae200w74.ba1", 0x100000, 0xc1645041, 5 | BRF_GRA }, // 13 Background Tiles + + { "ae201w75.bb1", 0x100000, 0x3f63bdff, 6 | BRF_GRA }, // 14 Midground Tiles + + { "ae202w76.bc1", 0x100000, 0x5cc857ca, 7 | BRF_GRA }, // 15 Foreground Tiles + + { "ae400t23.ya1", 0x200000, 0xc6ffb043, 8 | BRF_SND }, // 16 YMZ280B Samples + { "ae401t24.yb1", 0x200000, 0xd83f1a73, 8 | BRF_SND }, // 17 + + { "ae500w07.ad1", 0x080000, 0x3734f92c, 9 | BRF_SND }, // 18 OKI6295 Samples + + { "tkdensho_68hc11a8.rom", 0x002000, 0x00000000, 0 | BRF_NODUMP }, // 19 68HC11A8 Code + { "tkdensho_68hc11a8.eeprom", 0x000200, 0x00000000, 0 | BRF_NODUMP }, // 20 68HC11A8 EEPROM +}; + +STD_ROM_PICK(tkdensho) +STD_ROM_FN(tkdensho) + +static INT32 TkdenshoRomCallback() +{ + if (BurnLoadRom(Drv68KROM + 0x0000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x0000000, 1, 2)) return 1; + +#ifdef ENABLE_SOUND_HARDWARE + if (BurnLoadRom(DrvZ80ROM + 0x0000000, 2, 1)) return 1; + memcpy (DrvZ80ROM + 0x20000, DrvZ80ROM, 0x20000); +#endif + + if (BurnLoadRom(DrvSprROM + 0x0000000, 3, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x0000001, 4, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x0800000, 5, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x0800001, 6, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x1000000, 7, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x1000001, 8, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x2000001, 9, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x2800001, 10, 2)) return 1; + if (BurnLoadRom(DrvSprROM + 0x3000001, 11, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x0000000, 12, 1)) return 1; + memcpy (DrvGfxROM0 + 0x80000, DrvGfxROM0, 0x80000); // double here rather than mask later + + if (BurnLoadRom(DrvGfxROM1 + 0x0000000, 13, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x0000000, 14, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x0000000, 15, 1)) return 1; + +#ifdef ENABLE_SOUND_HARDWARE + if (BurnLoadRom(DrvSndROM1 + 0x0000000, 16, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x0200000, 17, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0 + 0x0080000, 18, 1)) return 1; +#endif + + return 0; +} + +static INT32 TkdenshoInit() +{ + return CommonInit(TkdenshoRomCallback, 0x4000000, 0x400000, &tkdensho_data, 0); +} + +struct BurnDriver BurnDrvTkdensho = { + "tkdensho", NULL, NULL, NULL, "1996", + "Toukidenshou - Angel Eyes (VER. 960614)\0", "No sound", "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, tkdenshoRomInfo, tkdenshoRomName, NULL, NULL, DrvInputInfo, NULL, + TkdenshoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4800, + 320, 240, 4, 3 +}; + + +// Toukidenshou - Angel Eyes (VER. 960427) + +static struct BurnRomInfo tkdenshoaRomDesc[] = { + { "aeprge.pal", 0x080000, 0x17a209ff, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "aeprgo.pau", 0x080000, 0xd265e6a1, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "aesprg-2.z1", 0x020000, 0x43550ab6, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "ae100h.ah1", 0x400000, 0x06be252b, 3 | BRF_GRA }, // 3 Sprites + { "ae100.al1", 0x400000, 0x009cdff4, 3 | BRF_GRA }, // 4 + { "ae101h.bh1", 0x400000, 0xf2469eff, 3 | BRF_GRA }, // 5 + { "ae101.bl1", 0x400000, 0xdb7791bb, 3 | BRF_GRA }, // 6 + { "ae102h.ch1", 0x200000, 0xf9d2a343, 3 | BRF_GRA }, // 7 + { "ae102.cl1", 0x200000, 0x681be889, 3 | BRF_GRA }, // 8 + { "ae104.el1", 0x400000, 0xe431b798, 3 | BRF_GRA }, // 9 + { "ae105.fl1", 0x400000, 0xb7f9ebc1, 3 | BRF_GRA }, // 10 + { "ae106.gl1", 0x200000, 0x7c50374b, 3 | BRF_GRA }, // 11 + + { "ae300w36.bd1", 0x080000, 0xe829f29e, 4 | BRF_GRA }, // 12 Character Tiles + + { "ae200w74.ba1", 0x100000, 0xc1645041, 5 | BRF_GRA }, // 13 Background Tiles + + { "ae201w75.bb1", 0x100000, 0x3f63bdff, 6 | BRF_GRA }, // 14 Midground Tiles + + { "ae202w76.bc1", 0x100000, 0x5cc857ca, 7 | BRF_GRA }, // 15 Foreground Tiles + + { "ae400t23.ya1", 0x200000, 0xc6ffb043, 8 | BRF_SND }, // 16 YMZ280B Samples + { "ae401t24.yb1", 0x200000, 0xd83f1a73, 8 | BRF_SND }, // 17 + + { "ae500w07.ad1", 0x080000, 0x3734f92c, 9 | BRF_SND }, // 18 OKI6295 Samples + + { "tkdensho_68hc11a8.rom", 0x002000, 0x00000000, 0 | BRF_NODUMP }, // 19 68HC11A8 Code + { "tkdensho_68hc11a8.eeprom", 0x000200, 0x00000000, 0 | BRF_NODUMP }, // 20 68HC11A8 EEPROM +}; + +STD_ROM_PICK(tkdenshoa) +STD_ROM_FN(tkdenshoa) + +static INT32 TkdenshoaInit() +{ + return CommonInit(TkdenshoRomCallback, 0x4000000, 0x400000, &tkdenshoa_data, 0); +} + +struct BurnDriver BurnDrvTkdenshoa = { + "tkdenshoa", "tkdensho", NULL, NULL, "1996", + "Toukidenshou - Angel Eyes (VER. 960427)\0", "No sound", "Tecmo", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, tkdenshoaRomInfo, tkdenshoaRomName, NULL, NULL, DrvInputInfo, NULL, + TkdenshoaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4800, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_tumbleb.cpp b/src/burn/drv/pst90s/d_tumbleb.cpp index a78c4c27a..79be8b66f 100644 --- a/src/burn/drv/pst90s/d_tumbleb.cpp +++ b/src/burn/drv/pst90s/d_tumbleb.cpp @@ -1,4734 +1,4731 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm6295.h" -#include "burn_ym3812.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[2] = {0, 0}; -static UINT8 DrvInput[3] = {0, 0, 0}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Drv68KRom = NULL; -static UINT8 *Drv68KRam = NULL; -static UINT8 *DrvZ80Rom = NULL; -static UINT8 *DrvZ80Ram = NULL; -static UINT8 *DrvProtData = NULL; -static UINT8 *DrvMSM6295ROMSrc = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvPf1Ram = NULL; -static UINT8 *DrvPf2Ram = NULL; -static UINT8 *DrvPaletteRam = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; -static UINT16 *DrvControl = NULL; - -static UINT8 DrvVBlank; -static UINT8 DrvOkiBank; -static UINT8 DrvZ80Bank; -static UINT16 DrvTileBank; -static INT32 DrvSoundLatch; -static INT32 Tumbleb2MusicCommand; -static INT32 Tumbleb2MusicBank; -static INT32 Tumbleb2MusicIsPlaying; - -static INT32 DrvSpriteXOffset; -static INT32 DrvSpriteYOffset; -static INT32 DrvSpriteRamSize; -static INT32 DrvSpriteMask; -static INT32 DrvSpriteColourMask; -static INT32 DrvYM2151Freq; -static INT32 DrvNumSprites; -static INT32 DrvNumChars; -static INT32 DrvNumTiles; -static INT32 DrvHasZ80; -static INT32 DrvHasYM2151; -static INT32 DrvHasYM3812; -static INT32 DrvHasProt; -static INT32 Tumbleb2; -static INT32 Jumpkids; -static INT32 Chokchok; -static INT32 Wlstar; -static INT32 Wondl96; -static INT32 Bcstry; -static INT32 Semibase; -static INT32 SemicomSoundCommand; -static INT32 Pf1XOffset; -static INT32 Pf1YOffset; -static INT32 Pf2XOffset; -static INT32 Pf2YOffset; - -typedef INT32 (*LoadRoms)(); -static LoadRoms DrvLoadRoms; -typedef void (*Map68k)(); -static Map68k DrvMap68k; -typedef void (*MapZ80)(); -static MapZ80 DrvMapZ80; -typedef void (*Render)(); -static Render DrvRender; - -static void DrvDraw(); -static void PangpangDraw(); -static void SuprtrioDraw(); -static void HtchctchDraw(); -static void FncywldDraw(); -static void SdfightDraw(); -static void JumppopDraw(); - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo TumblebInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort2 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Tumbleb) - -static struct BurnInputInfo MetlsavrInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Metlsavr) - -static struct BurnInputInfo SuprtrioInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, -}; - -STDINPUTINFO(Suprtrio) - -static struct BurnInputInfo HtchctchInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Htchctch) - -static struct BurnInputInfo FncywldInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort2 + 2, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Fncywld) - -static struct BurnInputInfo SemibaseInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, - {"Coin 3" , BIT_DIGITAL , DrvInputPort2 + 2, "p3 coin" }, - {"Coin 4" , BIT_DIGITAL , DrvInputPort2 + 3, "p4 coin" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Semibase) - -static struct BurnInputInfo JumppopInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Jumppop) - -static struct BurnDIPInfo TumblebDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x12, 0x01, 0xe0, 0x00, "3 Coins 1 Credit" }, - {0x12, 0x01, 0xe0, 0x80, "2 Coins 1 Credit" }, - {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, - {0x12, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xe0, 0xc0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xe0, 0x40, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x12, 0x01, 0x1c, 0x00, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x1c, 0x10, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x1c, 0x18, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x1c, 0x08, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x12, 0x01, 0x02, 0x02, "Off" }, - {0x12, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "2 Coins to Start, 1 to Continue" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0xc0, 0x80, "1" }, - {0x13, 0x01, 0xc0, 0x00, "2" }, - {0x13, 0x01, 0xc0, 0xc0, "3" }, - {0x13, 0x01, 0xc0, 0x40, "4" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x30, 0x10, "Easy" }, - {0x13, 0x01, 0x30, 0x30, "Normal" }, - {0x13, 0x01, 0x30, 0x20, "Hard" }, - {0x13, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, -}; - -STDDIPINFO(Tumbleb) - -static struct BurnDIPInfo MetlsavrDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x0c, 0x00, "2" }, - {0x13, 0x01, 0x0c, 0x0c, "3" }, - {0x13, 0x01, 0x0c, 0x08, "4" }, - {0x13, 0x01, 0x0c, 0x04, "5" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x13, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x10, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x30, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x70, 0x60, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x70, 0x50, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x70, 0x40, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x00, "Off" }, - {0x13, 0x01, 0x80, 0x80, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Language" }, - {0x14, 0x01, 0x08, 0x08, "English" }, - {0x14, 0x01, 0x08, 0x00, "Korean" }, - - {0 , 0xfe, 0 , 4 , "Life Meter" }, - {0x14, 0x01, 0x30, 0x00, "66%" }, - {0x14, 0x01, 0x30, 0x30, "100%" }, - {0x14, 0x01, 0x30, 0x20, "133%" }, - {0x14, 0x01, 0x30, 0x10, "166%" }, - - {0 , 0xfe, 0 , 4 , "Time" }, - {0x14, 0x01, 0xc0, 0x40, "30 Seconds" }, - {0x14, 0x01, 0xc0, 0x80, "40 Seconds" }, - {0x14, 0x01, 0xc0, 0xc0, "60 Seconds" }, - {0x14, 0x01, 0xc0, 0x00, "80 Seconds" }, -}; - -STDDIPINFO(Metlsavr) - -static struct BurnDIPInfo SuprtrioDIPList[]= -{ - // Default Values - {0x12, 0xff, 0xff, 0x10, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x12, 0x01, 0x07, 0x06, "5 Coins 1 Credit" }, - {0x12, 0x01, 0x07, 0x05, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x07, 0x04, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x07, 0x03, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x07, 0x00, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x07, 0x01, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x07, "Free Play" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x18, 0x00, "1" }, - {0x12, 0x01, 0x18, 0x08, "2" }, - {0x12, 0x01, 0x18, 0x10, "3" }, - {0x12, 0x01, 0x18, 0x18, "5" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x12, 0x01, 0x20, 0x00, "Normal" }, - {0x12, 0x01, 0x20, 0x20, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x12, 0x01, 0x40, 0x00, "50000" }, - {0x12, 0x01, 0x40, 0x40, "60000" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x80, 0x00, "Off" }, - {0x12, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Suprtrio) - -static struct BurnDIPInfo HtchctchDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x06, 0x00, "Easy" }, - {0x12, 0x01, 0x06, 0x06, "Normal" }, - {0x12, 0x01, 0x06, 0x02, "Hard" }, - {0x12, 0x01, 0x06, 0x04, "Very Hard" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x12, 0x01, 0x38, 0x00, "5 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x30, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x38, 0x28, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x08, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 2 , "Stage Skip" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Htchctch) - -static struct BurnDIPInfo CookbibDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x06, 0x00, "Easy" }, - {0x12, 0x01, 0x06, 0x06, "Normal" }, - {0x12, 0x01, 0x06, 0x02, "Hard" }, - {0x12, 0x01, 0x06, 0x04, "Very Hard" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x12, 0x01, 0x38, 0x00, "5 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x30, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x38, 0x28, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x08, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 2 , "Winning Rounds (vs mode)"}, - {0x12, 0x01, 0x40, 0x00, "1" }, - {0x12, 0x01, 0x40, 0x40, "2" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Cookbib) - -static struct BurnDIPInfo ChokchokDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Winning Rounds (vs mode)"}, - {0x11, 0x01, 0x01, 0x00, "2" }, - {0x11, 0x01, 0x01, 0x01, "3" }, - - {0 , 0xfe, 0 , 2 , "Time" }, - {0x11, 0x01, 0x20, 0x20, "60 Seconds" }, - {0x11, 0x01, 0x20, 0x00, "90 Seconds" }, - - {0 , 0xfe, 0 , 4 , "Starting Balls" }, - {0x11, 0x01, 0xc0, 0x00, "3" }, - {0x11, 0x01, 0xc0, 0xc0, "4" }, - {0x11, 0x01, 0xc0, 0x40, "5" }, - {0x11, 0x01, 0xc0, 0x80, "6" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x06, 0x00, "Easy" }, - {0x12, 0x01, 0x06, 0x06, "Normal" }, - {0x12, 0x01, 0x06, 0x02, "Hard" }, - {0x12, 0x01, 0x06, 0x04, "Very Hard" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x12, 0x01, 0x38, 0x00, "5 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x20, "4 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x30, "2 Coins 1 Credit" }, - {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, - {0x12, 0x01, 0x38, 0x28, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x38, 0x08, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Chokchok) - -static struct BurnDIPInfo WlstarDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "2 Players Game" }, - {0x13, 0x01, 0x10, 0x00, "1 Credit" }, - {0x13, 0x01, 0x10, 0x10, "2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0xc0, 0x00, "Easy" }, - {0x13, 0x01, 0xc0, 0xc0, "Normal" }, - {0x13, 0x01, 0xc0, 0x40, "Hard" }, - {0x13, 0x01, 0xc0, 0x80, "Hardest" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Last Inning" }, - {0x14, 0x01, 0x01, 0x00, "9" }, - {0x14, 0x01, 0x01, 0x01, "12" }, - - {0 , 0xfe, 0 , 2 , "Versus CPU Game Ends" }, - {0x14, 0x01, 0x02, 0x02, "+10" }, - {0x14, 0x01, 0x02, 0x00, "+7" }, - - {0 , 0xfe, 0 , 2 , "Versus Game" }, - {0x14, 0x01, 0x04, 0x00, "1 Credit / 2 Innings" }, - {0x14, 0x01, 0x04, 0x04, "1 Credit / 3 Innings" }, - - {0 , 0xfe, 0 , 2 , "Full 2 Players Game" }, - {0x14, 0x01, 0x08, 0x00, "4 Credits" }, - {0x14, 0x01, 0x08, 0x08, "6 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x14, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, - {0x14, 0x01, 0x70, 0x40, "4 Coins 1 Credit" }, - {0x14, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Wlstar) - -static struct BurnDIPInfo Wondl96DIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0x7f, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Field Colour" }, - {0x13, 0x01, 0x10, 0x10, "Blue" }, - {0x13, 0x01, 0x10, 0x00, "Green" }, - - {0 , 0xfe, 0 , 2 , "Versus CPU Game Ends" }, - {0x13, 0x01, 0x20, 0x20, "+10" }, - {0x13, 0x01, 0x20, 0x00, "+7" }, - - {0 , 0xfe, 0 , 2 , "Versus Game" }, - {0x13, 0x01, 0x40, 0x00, "1 Credit / 2 Innings" }, - {0x13, 0x01, 0x40, 0x40, "1 Credit / 3 Innings" }, - - {0 , 0xfe, 0 , 2 , "Full 2 Players Game" }, - {0x13, 0x01, 0x80, 0x80, "4 Credits" }, - {0x13, 0x01, 0x80, 0x00, "6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x14, 0x01, 0x0e, 0x04, "Level 1" }, - {0x14, 0x01, 0x0e, 0x08, "Level 2" }, - {0x14, 0x01, 0x0e, 0x00, "Level 3" }, - {0x14, 0x01, 0x0e, 0x0e, "Level 4" }, - {0x14, 0x01, 0x0e, 0x06, "Level 5" }, - {0x14, 0x01, 0x0e, 0x0a, "Level 6" }, - {0x14, 0x01, 0x0e, 0x02, "Level 7" }, - {0x14, 0x01, 0x0e, 0x0c, "Level 8" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x14, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, - {0x14, 0x01, 0x70, 0x40, "4 Coins 1 Credit" }, - {0x14, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, -}; - -STDDIPINFO(Wondl96) - -static struct BurnDIPInfo FncywldDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xf7, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x14, 0x01, 0xe0, 0x20, "4 Coins 1 Credit" }, - {0x14, 0x01, 0xe0, 0x40, "3 Coins 1 Credit" }, - {0x14, 0x01, 0xe0, 0x60, "2 Coins 1 Credit" }, - {0x14, 0x01, 0xe0, 0x00, "2 Coins 1 Credit" }, - {0x14, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, - {0x14, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xe0, 0x80, "1 Coin 4 Credits" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x10, 0x00, "Off" }, - {0x14, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x08, 0x08, "Off" }, - {0x14, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x14, 0x01, 0x04, 0x04, "English" }, - {0x14, 0x01, 0x04, 0x00, "Korean" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "2 Coins to Start, 1 to Continue" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0xc0, 0x80, "1" }, - {0x15, 0x01, 0xc0, 0x00, "2" }, - {0x15, 0x01, 0xc0, 0xc0, "3" }, - {0x15, 0x01, 0xc0, 0x40, "4" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x30, 0x30, "Easy" }, - {0x15, 0x01, 0x30, 0x20, "Normal" }, - {0x15, 0x01, 0x30, 0x10, "Hard" }, - {0x15, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Freeze" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, -}; - -STDDIPINFO(Fncywld) - -static struct BurnDIPInfo SdfightDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0x7f, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x13, 0x01, 0x0e, 0x04, "1" }, - {0x13, 0x01, 0x0e, 0x08, "2" }, - {0x13, 0x01, 0x0e, 0x00, "3" }, - {0x13, 0x01, 0x0e, 0x0e, "4" }, - {0x13, 0x01, 0x0e, 0x06, "5" }, - {0x13, 0x01, 0x0e, 0x0a, "6" }, - {0x13, 0x01, 0x0e, 0x02, "7" }, - {0x13, 0x01, 0x0e, 0x0c, "8" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x13, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x40, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Winning Rounds" }, - {0x14, 0x01, 0x08, 0x08, "2" }, - {0x14, 0x01, 0x08, 0x00, "3" }, - - {0 , 0xfe, 0 , 4 , "Time" }, - {0x14, 0x01, 0xc0, 0x40, "30" }, - {0x14, 0x01, 0xc0, 0x80, "50" }, - {0x14, 0x01, 0xc0, 0xc0, "70" }, - {0x14, 0x01, 0xc0, 0x00, "90" }, -}; - -STDDIPINFO(Sdfight) - -static struct BurnDIPInfo BcstryDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0x7f, NULL }, - {0x14, 0xff, 0xff, 0xdf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x13, 0x01, 0x0e, 0x04, "1" }, - {0x13, 0x01, 0x0e, 0x08, "2" }, - {0x13, 0x01, 0x0e, 0x00, "3" }, - {0x13, 0x01, 0x0e, 0x0e, "4" }, - {0x13, 0x01, 0x0e, 0x06, "5" }, - {0x13, 0x01, 0x0e, 0x0a, "6" }, - {0x13, 0x01, 0x0e, 0x02, "7" }, - {0x13, 0x01, 0x0e, 0x0c, "8" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x13, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x40, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Event Selection" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Control Type" }, - {0x14, 0x01, 0x40, 0x40, "Joysticks & Buttons" }, - {0x14, 0x01, 0x40, 0x00, "Buttons" }, - - {0 , 0xfe, 0 , 2 , "Debug Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Bcstry) - -static struct BurnDIPInfo SemibaseDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0x7f, NULL }, - {0x16, 0xff, 0xff, 0xdf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x15, 0x01, 0x0e, 0x04, "1" }, - {0x15, 0x01, 0x0e, 0x08, "2" }, - {0x15, 0x01, 0x0e, 0x00, "3" }, - {0x15, 0x01, 0x0e, 0x0e, "4" }, - {0x15, 0x01, 0x0e, 0x06, "5" }, - {0x15, 0x01, 0x0e, 0x0a, "6" }, - {0x15, 0x01, 0x0e, 0x02, "7" }, - {0x15, 0x01, 0x0e, 0x0c, "8" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x15, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, - {0x15, 0x01, 0x70, 0x40, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, - {0x15, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "vs CPU Game Ends" }, - {0x16, 0x01, 0x20, 0x20, "+10" }, - {0x16, 0x01, 0x20, 0x00, "+7" }, - - {0 , 0xfe, 0 , 2 , "Vs Game" }, - {0x16, 0x01, 0x40, 0x40, "1 Credit / 2 Innings" }, - {0x16, 0x01, 0x40, 0x00, "1 Credit / 3 Innings" }, - - {0 , 0xfe, 0 , 2 , "Full 2 Players Game" }, - {0x16, 0x01, 0x80, 0x00, "4 Credits" }, - {0x16, 0x01, 0x80, 0x80, "6 Credits" }, -}; - -STDDIPINFO(Semibase) - -static struct BurnDIPInfo DquizgoDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0x7f, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x13, 0x01, 0x0e, 0x04, "1" }, - {0x13, 0x01, 0x0e, 0x08, "2" }, - {0x13, 0x01, 0x0e, 0x00, "3" }, - {0x13, 0x01, 0x0e, 0x0e, "4" }, - {0x13, 0x01, 0x0e, 0x06, "5" }, - {0x13, 0x01, 0x0e, 0x0a, "6" }, - {0x13, 0x01, 0x0e, 0x02, "7" }, - {0x13, 0x01, 0x0e, 0x0c, "8" }, - - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x13, 0x01, 0x70, 0x00, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x40, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0xc0, 0x00, "2" }, - {0x14, 0x01, 0xc0, 0xc0, "3" }, - {0x14, 0x01, 0xc0, 0x40, "4" }, - {0x14, 0x01, 0xc0, 0x80, "5" }, -}; - -STDDIPINFO(Dquizgo) - -static struct BurnDIPInfo JumppopDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x11, 0x01, 0xe0, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0xe0, 0x80, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, - {0x11, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, - {0x11, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, - {0x11, 0x01, 0xe0, 0xc0, "1 Coin 5 Credits" }, - {0x11, 0x01, 0xe0, 0x40, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x11, 0x01, 0x1c, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x1c, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x1c, 0x18, "1 Coin 5 Credits" }, - {0x11, 0x01, 0x1c, 0x08, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x01, 0x01, "Off" }, - {0x12, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Picture Viewer" }, - {0x12, 0x01, 0x04, 0x04, "Off" }, - {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Background Type" }, - {0x12, 0x01, 0x08, 0x08, "1" }, - {0x12, 0x01, 0x08, 0x00, "2" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x30, 0x20, "Easy" }, - {0x12, 0x01, 0x30, 0x30, "Normal" }, - {0x12, 0x01, 0x30, 0x10, "Hard" }, - {0x12, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0xc0, 0x80, "1" }, - {0x12, 0x01, 0xc0, 0x00, "2" }, - {0x12, 0x01, 0xc0, 0xc0, "3" }, - {0x12, 0x01, 0xc0, 0x40, "4" }, -}; - -STDDIPINFO(Jumppop) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - } - - // Clear Opposites - DrvClearOpposites(&DrvInput[0]); - DrvClearOpposites(&DrvInput[1]); -} - -static struct BurnRomInfo TumblebRomDesc[] = { - { "thumbpop.12", 0x40000, 0x0c984703, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "thumbpop.13", 0x40000, 0x864c4053, BRF_ESS | BRF_PRG }, // 1 - - { "thumbpop.19", 0x40000, 0x0795aab4, BRF_GRA }, // 2 Tiles - { "thumbpop.18", 0x40000, 0xad58df43, BRF_GRA }, // 3 - - { "map-01.rom", 0x80000, 0xe81ffa09, BRF_GRA }, // 4 Sprites - { "map-00.rom", 0x80000, 0x8c879cfe, BRF_GRA }, // 5 - - { "thumbpop.snd", 0x80000, 0xfabbf15d, BRF_SND }, // 6 Samples -}; - -STD_ROM_PICK(Tumbleb) -STD_ROM_FN(Tumbleb) - -static struct BurnRomInfo Tumbleb2RomDesc[] = { - { "thumbpop.2", 0x40000, 0x34b016e1, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "thumbpop.3", 0x40000, 0x89501c71, BRF_ESS | BRF_PRG }, // 1 - - { "thumbpop.19", 0x40000, 0x0795aab4, BRF_GRA }, // 2 Tiles - { "thumbpop.18", 0x40000, 0xad58df43, BRF_GRA }, // 3 - - { "map-01.rom", 0x80000, 0xe81ffa09, BRF_GRA }, // 4 Sprites - { "map-00.rom", 0x80000, 0x8c879cfe, BRF_GRA }, // 5 - - { "thumbpop.snd", 0x80000, 0xfabbf15d, BRF_SND }, // 6 Samples - - { "pic_16c57", 0x02d4c, 0x00000000, BRF_NODUMP }, -}; - -STD_ROM_PICK(Tumbleb2) -STD_ROM_FN(Tumbleb2) - -static struct BurnRomInfo JumpkidsRomDesc[] = { - { "23-ic29.15c", 0x40000, 0x6ba11e91, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "24-ic30.17c", 0x40000, 0x5795d98b, BRF_ESS | BRF_PRG }, // 1 - - { "22-ic19.3c", 0x08000, 0xbd619530, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "30-ic125.15j", 0x40000, 0x44b9a089, BRF_GRA }, // 3 Tiles - { "29-ic124.13j", 0x40000, 0x3f98ec69, BRF_GRA }, // 4 - - { "25-ic69.1g", 0x40000, 0x176ae857, BRF_GRA }, // 5 Sprites - { "28-ic131.1l", 0x40000, 0xed837757, BRF_GRA }, // 6 - { "26-ic70.2g", 0x40000, 0xe8b34980, BRF_GRA }, // 7 - { "27-ic100.1j", 0x40000, 0x3918dda3, BRF_GRA }, // 8 - - { "21-ic17.1c", 0x80000, 0xe5094f75, BRF_SND }, // 9 Samples - { "ic18.2c", 0x20000, 0xa63736c3, BRF_SND }, // 10 -}; - -STD_ROM_PICK(Jumpkids) -STD_ROM_FN(Jumpkids) - -static struct BurnRomInfo MetlsavrRomDesc[] = { - { "first-4.ub17", 0x40000, 0x667a494d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "first-3.ub18", 0x40000, 0x87bf4ed2, BRF_ESS | BRF_PRG }, // 1 - - { "first-2.ua7", 0x10000, 0x49505edf, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "protdata.bin", 0x00200, 0x17aa17a9, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data - - { "first-5.rom5", 0x40000, 0xdd4af746, BRF_GRA }, // 4 Tiles - { "first-6.rom6", 0x40000, 0x808b0e0b, BRF_GRA }, // 5 - - { "first-7.uor1", 0x80000, 0xa6816747, BRF_GRA }, // 6 Sprites - { "first-8.uor2", 0x80000, 0x377020e5, BRF_GRA }, // 7 - { "first-9.uor3", 0x80000, 0xfccf1bb7, BRF_GRA }, // 8 - { "first-10.uor4", 0x80000, 0xa22b587b, BRF_GRA }, // 9 - - { "first-1.uc1", 0x40000, 0xe943dacb, BRF_SND }, // 10 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 11 -}; - -STD_ROM_PICK(Metlsavr) -STD_ROM_FN(Metlsavr) - -static struct BurnRomInfo PangpangRomDesc[] = { - { "2.bin", 0x40000, 0x45436666, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "3.bin", 0x40000, 0x2725cbe7, BRF_ESS | BRF_PRG }, // 1 - - { "11.bin", 0x40000, 0xa2b9fec8, BRF_GRA }, // 2 Tiles - { "10.bin", 0x40000, 0x4f59d7b9, BRF_GRA }, // 3 - { "6.bin", 0x40000, 0x1ebbc4f1, BRF_GRA }, // 4 - { "7.bin", 0x40000, 0xcd544173, BRF_GRA }, // 5 - - { "8.bin", 0x40000, 0xea0fa1e0, BRF_GRA }, // 6 Sprites - { "9.bin", 0x40000, 0x1da5fe49, BRF_GRA }, // 7 - { "4.bin", 0x40000, 0x4f282eb1, BRF_GRA }, // 8 - { "5.bin", 0x40000, 0x00694df9, BRF_GRA }, // 9 - - { "1.bin", 0x80000, 0xe722bb02, BRF_SND }, // 10 Samples - - { "pic_16c57", 0x02d4c, 0x1ca515b4, BRF_OPT }, -}; - -STD_ROM_PICK(Pangpang) -STD_ROM_FN(Pangpang) - -static struct BurnRomInfo SuprtrioRomDesc[] = { - { "rom2", 0x40000, 0x4102e59d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "rom1", 0x40000, 0xcc3a83c3, BRF_ESS | BRF_PRG }, // 1 - - { "rom4l", 0x10000, 0x466aa96d, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "rom4", 0x80000, 0xcd2dfae4, BRF_GRA }, // 3 Tiles - { "rom5", 0x80000, 0x4e64da64, BRF_GRA }, // 4 - - { "rom9l", 0x40000, 0xcc45f437, BRF_GRA }, // 5 Sprites - { "rom8l", 0x40000, 0x9bc90169, BRF_GRA }, // 6 - { "rom7l", 0x40000, 0xbfc7c756, BRF_GRA }, // 7 - { "rom6l", 0x40000, 0xbb3499af, BRF_GRA }, // 8 - - { "rom3h", 0x80000, 0x34ea7ec9, BRF_SND }, // 9 Samples - { "rom3l", 0x20000, 0x1b73233b, BRF_SND }, // 10 -}; - -STD_ROM_PICK(Suprtrio) -STD_ROM_FN(Suprtrio) - -static struct BurnRomInfo HtchctchRomDesc[] = { - { "p04.b17", 0x20000, 0x6991483a, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "p03.b16", 0x20000, 0xeff14c40, BRF_ESS | BRF_PRG }, // 1 - - { "p02.b5", 0x10000, 0xc5a03186, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "protdata.bin", 0x00200, 0x5b27adb6, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data - - { "p06srom5.bin", 0x40000, 0x3d2cbb0d, BRF_GRA }, // 4 Tiles - { "p07srom6.bin", 0x40000, 0x0207949c, BRF_GRA }, // 5 - - { "p08uor1.bin", 0x20000, 0x6811e7b6, BRF_GRA }, // 6 Sprites - { "p09uor2.bin", 0x20000, 0x1c6549cf, BRF_GRA }, // 7 - { "p10uor3.bin", 0x20000, 0x6462e6e0, BRF_GRA }, // 8 - { "p11uor4.bin", 0x20000, 0x9c511d98, BRF_GRA }, // 9 - - { "p01.c1", 0x20000, 0x18c06829, BRF_SND }, // 10 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 11 -}; - -STD_ROM_PICK(Htchctch) -STD_ROM_FN(Htchctch) - -static struct BurnRomInfo CookbibRomDesc[] = { - { "prg2.ub17", 0x20000, 0x2664a335, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "prg1.ub16", 0x20000, 0xcda6335f, BRF_ESS | BRF_PRG }, // 1 - - { "prg-s.ub5", 0x10000, 0x547d6ea3, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "protdata.bin", 0x00200, 0xa77d13f4, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data - - { "srom5.bin", 0x40000, 0x73a46e43, BRF_GRA }, // 4 Tiles - { "srom6.bin", 0x40000, 0xade2dbec, BRF_GRA }, // 5 - - { "uor1.bin", 0x20000, 0xa7d91f23, BRF_GRA }, // 6 Sprites - { "uor2.bin", 0x20000, 0x9aacbec2, BRF_GRA }, // 7 - { "uor3.bin", 0x20000, 0x3fee0c3c, BRF_GRA }, // 8 - { "uor4.bin", 0x20000, 0xbed9ed2d, BRF_GRA }, // 9 - - { "sound.uc1", 0x20000, 0x545e19b6, BRF_SND }, // 10 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 11 -}; - -STD_ROM_PICK(Cookbib) -STD_ROM_FN(Cookbib) - -static struct BurnRomInfo ChokchokRomDesc[] = { - { "ub17.bin", 0x40000, 0xecdb45ca, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ub18.bin", 0x40000, 0xb183852a, BRF_ESS | BRF_PRG }, // 1 - - { "ub5.bin", 0x10000, 0x30c2171d, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "protdata.bin", 0x00200, 0x0bd39834, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data - - { "srom5.bin", 0x80000, 0x836608b8, BRF_GRA }, // 4 Tiles - { "srom6.bin", 0x80000, 0x31d5715d, BRF_GRA }, // 5 - - { "uor1.bin", 0x80000, 0xded6642a, BRF_GRA }, // 6 Sprites - { "uor2.bin", 0x80000, 0x493f9516, BRF_GRA }, // 7 - { "uor3.bin", 0x80000, 0xe2dc3e12, BRF_GRA }, // 8 - { "uor4.bin", 0x80000, 0x6f377530, BRF_GRA }, // 9 - - { "uc1.bin", 0x40000, 0xf3f57abd, BRF_SND }, // 10 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 11 -}; - -STD_ROM_PICK(Chokchok) -STD_ROM_FN(Chokchok) - -static struct BurnRomInfo WlstarRomDesc[] = { - { "n-4.u817", 0x40000, 0xfc3e829b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "n-3.u818", 0x40000, 0xf01bc623, BRF_ESS | BRF_PRG }, // 1 - - { "ua7", 0x10000, 0x90cafa5f, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - -#if !defined (ROM_VERIFY) - { "protdata.bin", 0x00200, 0xb7ffde5b, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data -#else - { "87c52.mcu", 0x02000, 0xab5e2a7e, BRF_ESS | BRF_PRG }, // 3 MCU Program Code -#endif - - { "5.srom5", 0x80000, 0xf7f8c859, BRF_GRA }, // 4 Tiles - { "6.srom6", 0x80000, 0x34ace2a8, BRF_GRA }, // 5 - - { "7.udr1", 0x80000, 0x6e47c31d, BRF_GRA }, // 6 Sprites - { "8.udr2", 0x80000, 0x09c5d57c, BRF_GRA }, // 7 - { "9.udr3", 0x80000, 0x3ec064f0, BRF_GRA }, // 8 - { "10.udr4", 0x80000, 0xb4693cdd, BRF_GRA }, // 9 - - { "ua1", 0x40000, 0xde217d30, BRF_SND }, // 10 Samples -}; - -STD_ROM_PICK(Wlstar) -STD_ROM_FN(Wlstar) - -static struct BurnRomInfo Wondl96RomDesc[] = { - { "ub17.bin", 0x40000, 0x41d8e03c, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ub18.bin", 0x40000, 0x0e4963af, BRF_ESS | BRF_PRG }, // 1 - - { "ub5.bin", 0x10000, 0xd99d19c4, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - -#if !defined (ROM_VERIFY) - { "protdata.bin", 0x00200, 0xd7578b1e, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data -#else - { "87c52.mcu", 0x02000, 0x6f4c659a, BRF_ESS | BRF_PRG }, // 3 MCU Program Code -#endif - - { "srom5.bin", 0x80000, 0xdb8010c3, BRF_GRA }, // 4 Tiles - { "srom6.bin", 0x80000, 0x2f364e54, BRF_GRA }, // 5 - - { "uor1.bin", 0x80000, 0xe1e9eebb, BRF_GRA }, // 6 Sprites - { "uor2.bin", 0x80000, 0xddebfe83, BRF_GRA }, // 7 - { "uor3.bin", 0x80000, 0x7efe4d67, BRF_GRA }, // 8 - { "uor4.bin", 0x80000, 0x7b1596d1, BRF_GRA }, // 9 - - { "uc1.bin", 0x40000, 0x0e7913e6, BRF_SND }, // 10 Samples -}; - -STD_ROM_PICK(Wondl96) -STD_ROM_FN(Wondl96) - -static struct BurnRomInfo FncywldRomDesc[] = { - { "01_fw02.bin", 0x80000, 0xecb978c1, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "02_fw03.bin", 0x80000, 0x2d233b42, BRF_ESS | BRF_PRG }, // 1 - - { "08_fw09.bin", 0x40000, 0xa4a00de9, BRF_GRA }, // 2 Tiles - { "07_fw08.bin", 0x40000, 0xb48cd1d4, BRF_GRA }, // 3 - { "10_fw11.bin", 0x40000, 0xf21bab48, BRF_GRA }, // 4 - { "09_fw10.bin", 0x40000, 0x6aea8e0f, BRF_GRA }, // 5 - - { "05_fw06.bin", 0x40000, 0xe141ecdc, BRF_GRA }, // 6 Sprites - { "06_fw07.bin", 0x40000, 0x0058a812, BRF_GRA }, // 7 - { "03_fw04.bin", 0x40000, 0x6ad38c14, BRF_GRA }, // 8 - { "04_fw05.bin", 0x40000, 0xb8d079a6, BRF_GRA }, // 9 - - { "00_fw01.bin", 0x40000, 0xb395fe01, BRF_SND }, // 10 Samples -}; - -STD_ROM_PICK(Fncywld) -STD_ROM_FN(Fncywld) - -static struct BurnRomInfo SdfightRomDesc[] = { - { "u817", 0x80000, 0x9f284f4d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "u818", 0x80000, 0xa60e5b22, BRF_ESS | BRF_PRG }, // 1 - - { "ua7", 0x10000, 0xc3d36da4, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "protdata.bin", 0x00200, 0xefb8b822, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data - - { "9.ug11", 0x80000, 0xbf809ccd, BRF_GRA }, // 4 Tiles - { "10.ug12", 0x80000, 0xa5a3bfa2, BRF_GRA }, // 5 - { "15.ui11", 0x80000, 0x3bc8aa6d, BRF_GRA }, // 6 - { "16.ui12", 0x80000, 0x71e6b78d, BRF_GRA }, // 7 - - { "11.uk2", 0x80000, 0xd006fadc, BRF_GRA }, // 8 Sprites - { "12.uk3", 0x80000, 0x2a2f4153, BRF_GRA }, // 9 - { "5.uj2", 0x80000, 0xf1246cbf, BRF_GRA }, // 10 - { "6.uj3", 0x80000, 0xd346878c, BRF_GRA }, // 11 - { "13.uk4", 0x80000, 0x9bc40774, BRF_GRA }, // 12 - { "14.uk5", 0x80000, 0xa1e61674, BRF_GRA }, // 13 - { "7.uj4", 0x80000, 0xdbdece8a, BRF_GRA }, // 14 - { "8.uj5", 0x80000, 0x60be7dd1, BRF_GRA }, // 15 - - { "uc1", 0x40000, 0x535cae2c, BRF_SND }, // 16 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 17 -}; - -STD_ROM_PICK(Sdfight) -STD_ROM_FN(Sdfight) - -static struct BurnRomInfo BcstryRomDesc[] = { - { "bcstry_u.62", 0x40000, 0x7f7aa244, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "bcstry_u.35", 0x40000, 0xd25b80a4, BRF_ESS | BRF_PRG }, // 1 - - { "bcstry_u.21", 0x10000, 0x3ba072d4, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "protdata.bin", 0x00200, 0xe84e328c, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data - - { "bcstry_u.109", 0x80000, 0xeb04d37a, BRF_GRA }, // 4 Tiles - { "bcstry_u.113", 0x80000, 0x746ecdd7, BRF_GRA }, // 5 - { "bcstry_u.110", 0x80000, 0x1bfe65c3, BRF_GRA }, // 6 - { "bcstry_u.111", 0x80000, 0xc8bf3a3c, BRF_GRA }, // 7 - - { "bcstry_u.100", 0x80000, 0x8c11cbed, BRF_GRA }, // 8 Sprites - { "bcstry_u.106", 0x80000, 0x5219bcbf, BRF_GRA }, // 9 - { "bcstry_u.99", 0x80000, 0xcdb1af87, BRF_GRA }, // 10 - { "bcstry_u.105", 0x80000, 0x8166b596, BRF_GRA }, // 11 - { "bcstry_u.104", 0x80000, 0x377c0c71, BRF_GRA }, // 12 - { "bcstry_u.108", 0x80000, 0x442307ed, BRF_GRA }, // 13 - { "bcstry_u.102", 0x80000, 0x71b40ece, BRF_GRA }, // 14 - { "bcstry_u.107", 0x80000, 0xab3c923a, BRF_GRA }, // 15 - - { "bcstry_u.64", 0x40000, 0x23f0e0fe, BRF_SND }, // 16 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 17 -}; - -STD_ROM_PICK(Bcstry) -STD_ROM_FN(Bcstry) - -static struct BurnRomInfo BcstryaRomDesc[] = { - { "prg2.ic62", 0x40000, 0xf54c0a96, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "prg1.ic35", 0x40000, 0x2c55100a, BRF_ESS | BRF_PRG }, // 1 - - { "bcstry_u.21", 0x10000, 0x3ba072d4, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "protdata.bin", 0x00200, 0xe84e328c, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data - - { "bcstry_u.109", 0x80000, 0xeb04d37a, BRF_GRA }, // 4 Tiles - { "bcstry_u.113", 0x80000, 0x746ecdd7, BRF_GRA }, // 5 - { "bcstry_u.110", 0x80000, 0x1bfe65c3, BRF_GRA }, // 6 - { "bcstry_u.111", 0x80000, 0xc8bf3a3c, BRF_GRA }, // 7 - - { "bcstry_u.100", 0x80000, 0x8c11cbed, BRF_GRA }, // 8 Sprites - { "bcstry_u.106", 0x80000, 0x5219bcbf, BRF_GRA }, // 9 - { "bcstry_u.99", 0x80000, 0xcdb1af87, BRF_GRA }, // 10 - { "bcstry_u.105", 0x80000, 0x8166b596, BRF_GRA }, // 11 - { "bcstry_u.104", 0x80000, 0x377c0c71, BRF_GRA }, // 12 - { "bcstry_u.108", 0x80000, 0x442307ed, BRF_GRA }, // 13 - { "bcstry_u.102", 0x80000, 0x71b40ece, BRF_GRA }, // 14 - { "bcstry_u.107", 0x80000, 0xab3c923a, BRF_GRA }, // 15 - - { "bcstry_u.64", 0x40000, 0x23f0e0fe, BRF_SND }, // 16 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 17 -}; - -STD_ROM_PICK(Bcstrya) -STD_ROM_FN(Bcstrya) - -static struct BurnRomInfo SemibaseRomDesc[] = { - { "ic62.68k", 0x40000, 0x85ea81c3, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ic35.68k", 0x40000, 0xd2249605, BRF_ESS | BRF_PRG }, // 1 - - { "ic21.z80", 0x10000, 0xd95c64d0, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "protdata.bin", 0x00200, 0xecbf2163, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data - - { "ic109.gfx", 0x80000, 0x2b86e983, BRF_GRA }, // 4 Tiles - { "ic113.gfx", 0x80000, 0xe39b6610, BRF_GRA }, // 5 - { "ic110.gfx", 0x80000, 0xbba4a015, BRF_GRA }, // 6 - { "ic111.gfx", 0x80000, 0x61133b63, BRF_GRA }, // 7 - - { "ic100.gfx", 0x80000, 0x01c3d12a, BRF_GRA }, // 8 Sprites - { "ic106.gfx", 0x80000, 0xdb282ac2, BRF_GRA }, // 9 - { "ic99.gfx", 0x80000, 0x349df821, BRF_GRA }, // 10 - { "ic105.gfx", 0x80000, 0xf7caa81c, BRF_GRA }, // 11 - { "ic104.gfx", 0x80000, 0x51a5d38a, BRF_GRA }, // 12 - { "ic108.gfx", 0x80000, 0xb253d60e, BRF_GRA }, // 13 - { "ic102.gfx", 0x80000, 0x3caefe97, BRF_GRA }, // 14 - { "ic107.gfx", 0x80000, 0x68109898, BRF_GRA }, // 15 - - { "ic64.snd", 0x40000, 0x8a60649c, BRF_SND }, // 16 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 17 -}; - -STD_ROM_PICK(Semibase) -STD_ROM_FN(Semibase) - -static struct BurnRomInfo DquizgoRomDesc[] = { - { "ub17", 0x80000, 0x0b96ab14, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "ub18", 0x80000, 0x07f869f2, BRF_ESS | BRF_PRG }, // 1 - - { "ub5", 0x10000, 0xe40481da, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "protdata.bin", 0x00200, 0x6064b9e0, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data - - { "srom5", 0x80000, 0xf1cdd21d, BRF_GRA }, // 4 Tiles - { "srom6", 0x80000, 0xf848939e, BRF_GRA }, // 5 - - { "uor1", 0x80000, 0xb4912bf6, BRF_GRA }, // 6 Sprites - { "uor2", 0x80000, 0xb011cf93, BRF_GRA }, // 7 - { "uor3", 0x80000, 0xd96c3582, BRF_GRA }, // 8 - { "uor4", 0x80000, 0x77ff23eb, BRF_GRA }, // 9 - - { "uc1", 0x40000, 0xd0f4c4ba, BRF_SND }, // 10 Samples - - { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 11 -}; - -STD_ROM_PICK(Dquizgo) -STD_ROM_FN(Dquizgo) - -static struct BurnRomInfo JumppopRomDesc[] = { - { "68k_prg.bin", 0x080000, 0x123536b9, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - - { "z80_prg.bin", 0x040000, 0xa88d4424, BRF_ESS | BRF_PRG }, // 1 Z80 Program Code - - { "bg0.bin", 0x100000, 0x35a1363d, BRF_GRA }, // 2 Tiles - { "bg1.bin", 0x100000, 0x5b37f943, BRF_GRA }, // 3 - - { "sp0.bin", 0x100000, 0x7c5d0633, BRF_GRA }, // 4 Sprites - { "sp1.bin", 0x100000, 0x7eae782e, BRF_GRA }, // 5 - - { "samples.bin", 0x040000, 0x066f30a7, BRF_SND }, // 6 Samples -}; - -STD_ROM_PICK(Jumppop) -STD_ROM_FN(Jumppop) - -static struct BurnRomInfo JumppopeRomDesc[] = { - { "esd2.cu02", 0x040000, 0x302dd093, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "esd1.cu03", 0x040000, 0x883392ba, BRF_ESS | BRF_PRG }, // 1 - - { "at27c020.su06", 0x040000, 0xa88d4424, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code - - { "esd7.ju03", 0x040000, 0x9c2970e0, BRF_GRA }, // 3 Tiles - { "esd8.ju04", 0x040000, 0x33bf99b0, BRF_GRA }, // 4 - { "esd9.ju05", 0x040000, 0x671d21fd, BRF_GRA }, // 5 - { "esd10.ju06", 0x040000, 0x85a3cc73, BRF_GRA }, // 6 - - { "esd5.fu28", 0x080000, 0x0d47f821, BRF_GRA }, // 7 Sprites - { "esd6.fu29", 0x080000, 0xc01af40d, BRF_GRA }, // 8 - { "esd4.fu26", 0x080000, 0x97b409be, BRF_GRA }, // 9 - { "esd3.fu27", 0x080000, 0x3358a693, BRF_GRA }, // 10 - - { "at27c020.su10", 0x040000, 0x066f30a7, BRF_SND }, // 11 Samples -}; - -STD_ROM_PICK(Jumppope) -STD_ROM_FN(Jumppope) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x100000; - if (DrvHasZ80)DrvZ80Rom = Next; Next += 0x010000; - if (DrvHasProt) DrvProtData = Next; Next += 0x000200; - MSM6295ROM = Next; Next += 0x040000; - DrvMSM6295ROMSrc = Next; Next += 0x100000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x010800; - if (DrvHasZ80)DrvZ80Ram = Next; Next += 0x000800; - DrvSpriteRam = Next; Next += DrvSpriteRamSize; - DrvPf1Ram = Next; Next += 0x002000; - DrvPf2Ram = Next; Next += 0x002000; - DrvPaletteRam = Next; Next += 0x001000; - DrvControl = (UINT16*)Next; Next += 8 * sizeof(UINT16); - - RamEnd = Next; - - DrvChars = Next; Next += DrvNumChars * 8 * 8; - DrvTiles = Next; Next += DrvNumTiles * 16 * 16; - DrvSprites = Next; Next += DrvNumSprites * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 JumppopMemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x080000; - DrvZ80Rom = Next; Next += 0x040000; - MSM6295ROM = Next; Next += 0x040000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x0c0000; - DrvZ80Ram = Next; Next += 0x000800; - DrvSpriteRam = Next; Next += DrvSpriteRamSize; - DrvPf1Ram = Next; Next += 0x004000; - DrvPf2Ram = Next; Next += 0x004000; - DrvPaletteRam = Next; Next += 0x000800; - DrvControl = (UINT16*)Next; Next += 8 * sizeof(UINT16); - - RamEnd = Next; - - DrvChars = Next; Next += DrvNumChars * 8 * 8; - DrvTiles = Next; Next += DrvNumTiles * 16 * 16; - DrvSprites = Next; Next += DrvNumSprites * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - if (DrvHasProt == 1) memcpy(Drv68KRam + 0x000, DrvProtData, 0x200); - if (DrvHasProt == 2) memcpy(Drv68KRam + 0x200, DrvProtData, 0x200); - - SekOpen(0); - SekReset(); - SekClose(); - - if (DrvHasZ80) { - ZetOpen(0); - ZetReset(); - ZetClose(); - } - - if (DrvHasYM2151) BurnYM2151Reset(); - if (DrvHasYM3812) BurnYM3812Reset(); - - MSM6295Reset(0); - - DrvVBlank = 0; - DrvOkiBank = 0; - DrvTileBank = 0; - DrvSoundLatch = 0; - Tumbleb2MusicCommand = 0; - Tumbleb2MusicBank = 0; - Tumbleb2MusicIsPlaying = 0; - memset(DrvControl, 0, 8); - - return 0; -} - -static const INT32 Tumbleb2SoundLookup[256] = { - /*0 1 2 3 4 5 6 7 8 9 a b c d e f*/ - 0x00, -2, 0x00, 0x00, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 0x00, -2, /* 0 */ - -2, 0x00, -2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, /* 2 */ - 0x19, 0x00, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 3 */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, /* 4 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 5 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* f */ -}; - -static void Tumbleb2PlayMusic() -{ - INT32 Status = MSM6295ReadStatus(0); - - if (Tumbleb2MusicIsPlaying) - { - if ((Status & 0x08) == 0) { - MSM6295Command(0, 0x80 | Tumbleb2MusicCommand); - MSM6295Command(0, 0x00 | 0x82); - } - } -} - -static void Tumbleb2SetMusicBank(INT32 Bank) -{ - memcpy(MSM6295ROM + 0x38000, DrvMSM6295ROMSrc + 0x38000 + (Bank * 0x8000), 0x8000); -} - -static void Tumbleb2PlaySound(UINT16 data) -{ - INT32 Status = MSM6295ReadStatus(0); - - if ((Status & 0x01) == 0) { - MSM6295Command(0, 0x80 | data); - MSM6295Command(0, 0x00 | 0x12); - } else { - if ((Status & 0x02) == 0) { - MSM6295Command(0, 0x80 | data); - MSM6295Command(0, 0x00 | 0x22); - } else { - if ((Status & 0x04) == 0) { - MSM6295Command(0, 0x80 | data); - MSM6295Command(0, 0x00 | 0x42); - } - } - } -} - -static void Tumbleb2ProcessMusicCommand(UINT16 data) -{ - INT32 Status = MSM6295ReadStatus(0); - - if (data == 1) { - if ((Status & 0x08) == 0x08) { - MSM6295Command(0, 0x40); - Tumbleb2MusicIsPlaying = 0; - } - } else { - if (Tumbleb2MusicIsPlaying != data) { - Tumbleb2MusicIsPlaying = data; - - MSM6295Command(0, 0x40); - - switch (data) { - case 0x04: // map screen - Tumbleb2MusicBank = 1; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x05: // america - Tumbleb2MusicBank = 6; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x06: // asia - Tumbleb2MusicBank = 2; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x07: // africa/egypt -- don't seem to have a tune for this one - Tumbleb2MusicBank = 4; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x08: // antartica - Tumbleb2MusicBank = 3; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x09: // brazil / south america - Tumbleb2MusicBank = 4; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x0a: // japan -- don't seem to have a tune - Tumbleb2MusicBank = 2; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x0b: // australia - Tumbleb2MusicBank = 5; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x0c: // france/europe - Tumbleb2MusicBank = 6; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x0d: // how to play - Tumbleb2MusicBank = 7; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x0f: // stage clear - Tumbleb2MusicBank = 0; - Tumbleb2MusicCommand = 0x33; - break; - - case 0x10: // boss stage - Tumbleb2MusicBank = 8; - Tumbleb2MusicCommand = 0x38; - break; - - case 0x12: // world clear - Tumbleb2MusicBank = 0; - Tumbleb2MusicCommand = 0x34; - break; - - default: // anything else.. - Tumbleb2MusicBank = 8; - Tumbleb2MusicCommand = 0x38; - break; - } - - Tumbleb2SetMusicBank(Tumbleb2MusicBank); - Tumbleb2PlayMusic(); - } - } -} - -static void Tumbleb2SoundMCUCommand(UINT16 data) -{ - INT32 Sound = Tumbleb2SoundLookup[data & 0xff]; - - if (Sound == 0) { - - } else { - if (Sound == -2) { - Tumbleb2ProcessMusicCommand(data); - } else { - Tumbleb2PlaySound(Sound); - } - } -} - -UINT8 __fastcall Tumbleb68KReadByte(UINT32 a) -{ - switch (a) { - case 0x100001: { - return ~0; - } - - case 0x180002: { - return DrvDip[1]; - } - - case 0x180003: { - return DrvDip[0]; - } - - case 0x180009: { - if (Semibase) return 0xff - DrvInput[2]; - if (DrvVBlank) { - if (Wondl96) { - return 0xf3 - DrvInput[2]; - } else { - return 0xf7 - DrvInput[2]; - } - } - if (Wondl96) return 0xfb - DrvInput[2]; - return 0xff - DrvInput[2]; - } - - case 0x18000a: { - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Tumbleb68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x100000: { - if (Tumbleb2) { - Tumbleb2SoundMCUCommand(d); - return; - } else { - MSM6295Command(0, d); - return; - } - } - - case 0x100001: { - if (SemicomSoundCommand) DrvSoundLatch = d; - return; - } - - case 0x100002: { - if (Chokchok) DrvTileBank = (d << 8) << 1; - if (Bcstry) DrvTileBank = d << 8; - return; - } - - case 0x100003: { - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Tumbleb68KReadWord(UINT32 a) -{ - switch (a) { - case 0x100004: { - return rand() % 0x10000; - } - - case 0x180000: { - return ((0xff - DrvInput[1]) << 8) | (0xff - DrvInput[0]); - } - - case 0x180002: { - return (DrvDip[1] << 8) | DrvDip[0]; - } - - case 0x180004: { - return -0; - } - - case 0x180006: { - return -0; - } - - case 0x180008: { - if (Bcstry && (SekGetPC(0) == 0x560)) { - return 0x1a0; - } else { - if (Semibase) return 0xffff - DrvInput[2]; - if (DrvVBlank) { - if (Wondl96) { - return 0xfff3 - DrvInput[2]; - } else { - return 0xfff7 - DrvInput[2]; - } - } - } - if (Wondl96) return 0xfff3 - DrvInput[2]; - return 0xffff - DrvInput[2]; - } - - case 0x18000a: { - return 0; - } - - case 0x18000c: { - return 0; - } - - case 0x18000e: { - return -0; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Tumbleb68KWriteWord(UINT32 a, UINT16 d) -{ -#if 1 && defined FBA_DEBUG - if (a >= 0x160800 && a <= 0x160807) return; - if (a >= 0x198000 && a <= 0x1a8015) return; - if (a >= 0x321000 && a <= 0x321fff) return; - if (a >= 0x323000 && a <= 0x331fff) return; - if (a >= 0x340000 && a <= 0x3401ff) return; - if (a >= 0x340400 && a <= 0x34047f) return; - if (a >= 0x342000 && a <= 0x3421ff) return; - if (a >= 0x342400 && a <= 0x34247f) return; -#endif - - if (a >= 0x300000 && a <= 0x30000f) { - DrvControl[(a - 0x300000) >> 1] = d; - return; - } - - switch (a) { - case 0x100000: { - if (Tumbleb2) { - Tumbleb2SoundMCUCommand(d); - return; - } else { - if (Jumpkids) { - DrvSoundLatch = d & 0xff; - ZetOpen(0); - ZetRaiseIrq(0); - ZetClose(); - return; - } else { - if (SemicomSoundCommand) { - if (d & 0xff) DrvSoundLatch = d & 0xff; - return; - } else { - MSM6295Command(0, d & 0xff); - return; - } - } - } - } - - case 0x100002: { - if (Wlstar) DrvTileBank = d & 0x4000; - return; - } - - case 0x18000c: { - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT16 __fastcall Suprtrio68KReadWord(UINT32 a) -{ - switch (a) { - case 0xe00000: { - return ((0xff - DrvInput[1]) << 8) | (0xff - DrvInput[0]); - } - - case 0xe40000: { - return 0xffff - DrvInput[2]; - } - - case 0xe80002: { - return 0xff00 | DrvDip[0]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Suprtrio68KWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0xa00000 && a <= 0xa0000f) { - DrvControl[(a - 0xa00000) >> 1] = d; - return; - } - - switch (a) { - case 0xe00000: { - DrvTileBank = d << 14; - return; - } - - case 0xec0000: { - if (SemicomSoundCommand) { - if (d & 0xff) DrvSoundLatch = d & 0xff; - } - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Fncywld68KReadByte(UINT32 a) -{ - switch (a) { - case 0x100003: { - return 0; - } - - case 0x100005: { - return MSM6295ReadStatus(0); - } - - case 0x180002: { - return DrvDip[1]; - } - - case 0x180005: { - return -0; - } - - case 0x180009: { - if (DrvVBlank) return 0xf7 - DrvInput[2]; - return 0xff - DrvInput[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Fncywld68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x100001: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x100003: { - BurnYM2151WriteRegister(d); - return; - } - - case 0x100005: { - MSM6295Command(0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Fncywld68KReadWord(UINT32 a) -{ - switch (a) { - case 0x180000: { - return ((0xff - DrvInput[1]) << 8) | (0xff - DrvInput[0]); - } - - case 0x180002: { - return (DrvDip[1] << 8) | DrvDip[0]; - } - - case 0x180004: { - return -0; - } - - case 0x180006: { - return -0; - } - - case 0x180008: { - if (DrvVBlank) return 0xfff7 - DrvInput[2]; - return 0xffff - DrvInput[2]; - } - - case 0x18000a: { - return 0; - } - - case 0x18000c: { - return 0; - } - - case 0x18000e: { - return -0; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Fncywld68KWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x160800 && a <= 0x160807) return; - - if (a >= 0x300000 && a <= 0x30000f) { - DrvControl[(a - 0x300000) >> 1] = d; - return; - } - - switch (a) { - case 0x100000: { - BurnYM2151SelectRegister(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT16 __fastcall Jumppop68KReadWord(UINT32 a) -{ - switch (a) { - case 0x180002: { - return ((0xff - DrvInput[1]) << 8) | (0xff - DrvInput[0]); - } - - case 0x180004: { - return 0xffff - DrvInput[2]; - } - - case 0x180006: { - return (DrvDip[1] << 8) | DrvDip[0]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Jumppop68KWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x380000 && a <= 0x38000f) { - DrvControl[(a - 0x380000) >> 1] = d; - return; - } - - switch (a) { - case 0x180000: { - // NOP - return; - } - - case 0x18000c: { - DrvSoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - - case 0x180008: - case 0x18000a: { - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall JumpkidsZ80Read(UINT16 a) -{ - switch (a) { - case 0x9800: { - return MSM6295ReadStatus(0); - } - - case 0xa000: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall JumpkidsZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x9000: { - DrvOkiBank = d & 3; - memcpy(MSM6295ROM + 0x20000, DrvMSM6295ROMSrc + (DrvOkiBank * 0x20000), 0x20000); - return; - } - - case 0x9800: { - MSM6295Command(0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall SemicomZ80Read(UINT16 a) -{ - switch (a) { - case 0xf001: { - return BurnYM2151ReadStatus(); - } - - case 0xf002: { - return MSM6295ReadStatus(0); - } - - case 0xf008: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall SemicomZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xf000: { - BurnYM2151SelectRegister(d); - return; - } - - case 0xf001: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xf002: { - MSM6295Command(0, d); - return; - } - - case 0xf006: { - return; - } - - case 0xf00e: { - DrvOkiBank = d; - memcpy(MSM6295ROM + 0x30000, DrvMSM6295ROMSrc + 0x30000 + (DrvOkiBank * 0x10000), 0x10000); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall JumppopZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x02: { - return MSM6295ReadStatus(0); - } - - case 0x03: { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return DrvSoundLatch; - } - - case 0x06: { - // NOP - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Read -> %02X\n"), a); - } - } - - return 0; -} - -void __fastcall JumppopZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - BurnYM3812Write(0, d); - return; - } - - case 0x01: { - BurnYM3812Write(1, d); - return; - } - - case 0x02: { - MSM6295Command(0, d); - return; - } - - case 0x04: { - // NOP - return; - } - - case 0x05: { - DrvZ80Bank = d; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + (DrvZ80Bank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + (DrvZ80Bank * 0x4000)); - return; - } - - case 0x06: { - // NOP - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Port Write -> %02X, %02x\n"), a, d); - } - } -} - -static INT32 CharPlaneOffsets[4] = { 0x200008, 0x200000, 8, 0 }; -static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; -static INT32 SpritePlaneOffsets[4] = { 0x400008, 0x400000, 8, 0 }; -static INT32 Sprite2PlaneOffsets[4] = { 0x800008, 0x800000, 8, 0 }; -static INT32 Sprite3PlaneOffsets[4] = { 0x1000008, 0x1000000, 8, 0 }; -static INT32 SpriteXOffsets[16] = { 256, 257, 258, 259, 260, 261, 262, 263, 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; -static INT32 SuprtrioPlaneOffsets[4] = { 0x400000, 0, 0x600000, 0x200000 }; -static INT32 SuprtrioXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 SuprtrioYOffsets[16] = { 8, 0, 16, 24, 40, 32, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; -static INT32 JpCharPlaneOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 JpCharXOffsets[8] = { 0x800000, 0x800008, 0, 8, 0x800010, 0x800018, 16, 24 }; -static INT32 JpCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 JpeCharPlaneOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 JpeCharXOffsets[8] = { 0, 16, 8, 24, 32, 48, 40, 56 }; -static INT32 JpeCharYOffsets[8] = { 0, 64, 128, 192, 256, 320, 384, 448 }; -static INT32 JpTilePlaneOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 JpTileXOffsets[16] = { 0x800000, 0x800008, 0, 8, 0x800010, 0x800018, 16, 24, 0x800100, 0x800108, 256, 264, 0x800110, 0x800118, 272, 280 }; -static INT32 JpTileYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; -static INT32 JpeTilePlaneOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 JpeTileXOffsets[16] = { 0, 16, 8, 24, 32, 48, 40, 56, 512, 528, 520, 536, 544, 560, 552, 568 }; -static INT32 JpeTileYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472 }; - -static void TumblebTilesRearrange() -{ - UINT8 *rom = DrvTempRom; - INT32 len = DrvNumTiles * 128; - INT32 i; - - /* gfx data is in the wrong order */ - for (i = 0;i < len;i++) - { - if ((i & 0x20) == 0) - { - INT32 t = rom[i]; rom[i] = rom[i + 0x20]; rom[i + 0x20] = t; - } - } - /* low/high half are also swapped */ - for (i = 0;i < len/2;i++) - { - INT32 t = rom[i]; rom[i] = rom[i + len/2]; rom[i + len/2] = t; - } -} - -static INT32 TumblebLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 3, 2); if (nRet != 0) return 1; - TumblebTilesRearrange(); - GfxDecode(DrvNumChars, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 4, 16, 16, CharPlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 5, 1); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 6, 1); if (nRet != 0) return 1; - if (Tumbleb2) nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x80000, 6, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 JumpkidsLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 4, 2); if (nRet != 0) return 1; - TumblebTilesRearrange(); - GfxDecode(DrvNumChars, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 4, 16, 16, CharPlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080001, 8, 2); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(MSM6295ROM + 0x00000, 10, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 MetlsavrLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x200000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load Shared RAM data - nRet = BurnLoadRom(DrvProtData, 3, 1); if (nRet) return 1; - BurnByteswap(DrvProtData, 0x200); - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000001, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 2); if (nRet != 0) return 1; - TumblebTilesRearrange(); - GfxDecode(DrvNumChars, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 4, 16, 16, CharPlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100001, 9, 2); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(MSM6295ROM, 10, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 PangpangLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080001, 5, 2); if (nRet != 0) return 1; - UINT8 *pTemp = (UINT8*)BurnMalloc(0x100000); - memcpy(pTemp, DrvTempRom, 0x100000); - memset(DrvTempRom, 0, 0x100000); - memcpy(DrvTempRom + 0x000000, pTemp + 0x000000, 0x40000); - memcpy(DrvTempRom + 0x080000, pTemp + 0x040000, 0x40000); - memcpy(DrvTempRom + 0x040000, pTemp + 0x080000, 0x40000); - memcpy(DrvTempRom + 0x0c0000, pTemp + 0x0c0000, 0x40000); - BurnFree(pTemp); - TumblebTilesRearrange(); - GfxDecode(DrvNumChars, 4, 8, 8, SpritePlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080001, 9, 2); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 10, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); - - BurnFree(DrvTempRom); - - return 0; -} - -static void SuprtrioDecrypt68KRom() -{ - UINT16 *Rom = (UINT16*)Drv68KRom; - UINT16 *pTemp = (UINT16*)BurnMalloc(0x80000); - INT32 i; - - memcpy(pTemp, Rom, 0x80000); - for (i = 0; i < 0x40000; i++) { - INT32 j = i ^ 0x06; - if ((i & 1) == 0) j ^= 0x02; - if ((i & 3) == 0) j ^= 0x08; - Rom[i] = pTemp[j]; - } - BurnFree(pTemp); -} - -static void SuprtrioDecryptTiles() -{ - UINT16 *Rom = (UINT16*)DrvTempRom; - UINT16 *pTemp = (UINT16*)BurnMalloc(0x100000); - INT32 i; - - memcpy(pTemp, Rom, 0x100000); - for (i = 0; i < 0x80000; i++) { - INT32 j = i ^ 0x02; - if (i & 1) j ^= 0x04; - Rom[i] = pTemp[j]; - } - BurnFree(pTemp); -} - -static INT32 SuprtrioLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - SuprtrioDecrypt68KRom(); - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 4, 1); if (nRet != 0) return 1; - UINT8 *pTemp = (UINT8*)BurnMalloc(0x100000); - memcpy(pTemp, DrvTempRom, 0x100000); - memset(DrvTempRom, 0, 0x100000); - memcpy(DrvTempRom + 0x000000, pTemp + 0x000000, 0x20000); - memcpy(DrvTempRom + 0x040000, pTemp + 0x020000, 0x20000); - memcpy(DrvTempRom + 0x020000, pTemp + 0x040000, 0x20000); - memcpy(DrvTempRom + 0x060000, pTemp + 0x060000, 0x20000); - memcpy(DrvTempRom + 0x080000, pTemp + 0x080000, 0x20000); - memcpy(DrvTempRom + 0x0c0000, pTemp + 0x0a0000, 0x20000); - memcpy(DrvTempRom + 0x0a0000, pTemp + 0x0c0000, 0x20000); - memcpy(DrvTempRom + 0x0e0000, pTemp + 0x0e0000, 0x20000); - BurnFree(pTemp); - SuprtrioDecryptTiles(); - GfxDecode(DrvNumTiles, 4, 16, 16, SuprtrioPlaneOffsets, SuprtrioXOffsets, SuprtrioYOffsets, 0x100, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080001, 8, 2); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x80000, 10, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 HtchctchLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load Shared RAM data - nRet = BurnLoadRom(DrvProtData, 3, 1); if (nRet) return 1; - BurnByteswap(DrvProtData, 0x200); - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000001, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 2); if (nRet != 0) return 1; - TumblebTilesRearrange(); - GfxDecode(DrvNumChars, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 4, 16, 16, CharPlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x040000, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x040001, 9, 2); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, CharPlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(MSM6295ROM, 10, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 ChokchokLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x200000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load Shared RAM data - nRet = BurnLoadRom(DrvProtData, 3, 1); if (nRet) return 1; - BurnByteswap(DrvProtData, 0x200); - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000001, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 2); if (nRet != 0) return 1; - UINT8 *pTemp = (UINT8*)BurnMalloc(0x100000); - memcpy(pTemp, DrvTempRom, 0x100000); - memset(DrvTempRom, 0, 0x200000); - memcpy(DrvTempRom + 0x000000, pTemp + 0x000000, 0x40000); - memcpy(DrvTempRom + 0x100000, pTemp + 0x040000, 0x40000); - memcpy(DrvTempRom + 0x040000, pTemp + 0x080000, 0x40000); - memcpy(DrvTempRom + 0x140000, pTemp + 0x0c0000, 0x40000); - BurnFree(pTemp); - TumblebTilesRearrange(); - GfxDecode(DrvNumChars, 4, 8, 8, Sprite2PlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100001, 9, 2); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(MSM6295ROM, 10, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 FncywldLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x100000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080001, 5, 2); if (nRet != 0) return 1; - TumblebTilesRearrange(); - GfxDecode(DrvNumChars, 4, 8, 8, SpritePlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x100000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080000, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x080001, 9, 2); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(MSM6295ROM + 0x00000, 10, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 SdfightLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x400000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(DrvTempRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x00000, 1, 2); if (nRet != 0) return 1; - memcpy(Drv68KRom + 0xc0000, DrvTempRom + 0x00000, 0x40000); - memcpy(Drv68KRom + 0x80000, DrvTempRom + 0x40000, 0x40000); - memcpy(Drv68KRom + 0x40000, DrvTempRom + 0x80000, 0x40000); - memcpy(Drv68KRom + 0x00000, DrvTempRom + 0xc0000, 0x40000); - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load Shared RAM data - nRet = BurnLoadRom(DrvProtData, 3, 1); if (nRet) return 1; - BurnByteswap(DrvProtData, 0x200); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x400000); - nRet = BurnLoadRom(DrvTempRom + 0x200001, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200000, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300001, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300000, 7, 2); if (nRet != 0) return 1; - memcpy(DrvTempRom + 0x000000, DrvTempRom + 0x200000, 0x40000); - memcpy(DrvTempRom + 0x100000, DrvTempRom + 0x240000, 0x40000); - memcpy(DrvTempRom + 0x040000, DrvTempRom + 0x280000, 0x40000); - memcpy(DrvTempRom + 0x140000, DrvTempRom + 0x2c0000, 0x40000); - memcpy(DrvTempRom + 0x080000, DrvTempRom + 0x300000, 0x40000); - memcpy(DrvTempRom + 0x180000, DrvTempRom + 0x340000, 0x40000); - memcpy(DrvTempRom + 0x0c0000, DrvTempRom + 0x380000, 0x40000); - memcpy(DrvTempRom + 0x1c0000, DrvTempRom + 0x3c0000, 0x40000); - TumblebTilesRearrange(); - GfxDecode(DrvNumChars, 4, 8, 8, Sprite2PlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 9, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 10, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100001, 11, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200000, 12, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200001, 13, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300000, 14, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300001, 15, 2); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, Sprite3PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(MSM6295ROM, 16, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 BcstryLoadRoms() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x400000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(DrvTempRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x00000, 1, 2); if (nRet != 0) return 1; - memcpy(Drv68KRom + 0x40000, DrvTempRom + 0x00000, 0x40000); - memcpy(Drv68KRom + 0x00000, DrvTempRom + 0x40000, 0x40000); - - // Load Z80 Program Roms - memset(DrvTempRom, 0, 0x400000); - nRet = BurnLoadRom(DrvTempRom, 2, 1); if (nRet != 0) return 1; - memcpy(DrvZ80Rom + 0x04000, DrvTempRom + 0x00000, 0x04000); - memcpy(DrvZ80Rom + 0x00000, DrvTempRom + 0x04000, 0x04000); - memcpy(DrvZ80Rom + 0x0c000, DrvTempRom + 0x08000, 0x04000); - memcpy(DrvZ80Rom + 0x08000, DrvTempRom + 0x0c000, 0x04000); - - // Load Shared RAM data - memset(DrvTempRom, 0, 0x400000); - nRet = BurnLoadRom(DrvProtData, 3, 1); if (nRet) return 1; - BurnByteswap(DrvProtData, 0x200); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x400000); - nRet = BurnLoadRom(DrvTempRom + 0x200000, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200001, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300001, 7, 2); if (nRet != 0) return 1; - memcpy(DrvTempRom + 0x000000, DrvTempRom + 0x200000, 0x40000); - memcpy(DrvTempRom + 0x100000, DrvTempRom + 0x240000, 0x40000); - memcpy(DrvTempRom + 0x040000, DrvTempRom + 0x280000, 0x40000); - memcpy(DrvTempRom + 0x140000, DrvTempRom + 0x2c0000, 0x40000); - memcpy(DrvTempRom + 0x080000, DrvTempRom + 0x300000, 0x40000); - memcpy(DrvTempRom + 0x180000, DrvTempRom + 0x340000, 0x40000); - memcpy(DrvTempRom + 0x0c0000, DrvTempRom + 0x380000, 0x40000); - memcpy(DrvTempRom + 0x1c0000, DrvTempRom + 0x3c0000, 0x40000); - TumblebTilesRearrange(); - GfxDecode(DrvNumChars, 4, 8, 8, Sprite2PlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 8, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 9, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 10, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100001, 11, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200000, 12, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200001, 13, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300000, 14, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300001, 15, 2); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, Sprite3PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(MSM6295ROM, 16, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static void TumblebMap68k() -{ - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x120000, 0x123fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x140000, 0x1407ff, SM_RAM); - SekMapMemory(DrvSpriteRam , 0x160000, 0x1607ff, SM_RAM); - SekMapMemory(Drv68KRam + 0x4000 , 0x1a0000, 0x1a07ff, SM_RAM); - SekMapMemory(DrvPf1Ram , 0x320000, 0x320fff, SM_RAM); - SekMapMemory(DrvPf2Ram , 0x322000, 0x322fff, SM_RAM); - SekSetReadWordHandler(0, Tumbleb68KReadWord); - SekSetWriteWordHandler(0, Tumbleb68KWriteWord); - SekSetReadByteHandler(0, Tumbleb68KReadByte); - SekSetWriteByteHandler(0, Tumbleb68KWriteByte); - SekClose(); -} - -static void PangpangMap68k() -{ - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x120000, 0x123fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x140000, 0x1407ff, SM_RAM); - SekMapMemory(DrvSpriteRam , 0x160000, 0x1607ff, SM_RAM); - SekMapMemory(Drv68KRam + 0x4000 , 0x1a0000, 0x1a07ff, SM_RAM); - SekMapMemory(DrvPf1Ram , 0x320000, 0x321fff, SM_RAM); - SekMapMemory(DrvPf2Ram , 0x340000, 0x341fff, SM_RAM); - SekSetReadWordHandler(0, Tumbleb68KReadWord); - SekSetWriteWordHandler(0, Tumbleb68KWriteWord); - SekSetReadByteHandler(0, Tumbleb68KReadByte); - SekSetWriteByteHandler(0, Tumbleb68KWriteByte); - SekClose(); -} - -static void SuprtrioMap68k() -{ - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvSpriteRam , 0x700000, 0x7007ff, SM_RAM); - SekMapMemory(DrvPf1Ram , 0xa20000, 0xa20fff, SM_RAM); - SekMapMemory(DrvPf2Ram , 0xa22000, 0xa22fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0xcf0000, 0xcf05ff, SM_RAM); - SekMapMemory(Drv68KRam , 0xf00000, 0xf07fff, SM_RAM); - SekSetReadWordHandler(0, Suprtrio68KReadWord); - SekSetWriteWordHandler(0, Suprtrio68KWriteWord); - SekClose(); -} - -static void HtchctchMap68k() -{ - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x120000, 0x123fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x140000, 0x1407ff, SM_RAM); - SekMapMemory(DrvSpriteRam , 0x160000, 0x160fff, SM_RAM); - SekMapMemory(Drv68KRam + 0x4000 , 0x1a0000, 0x1a0fff, SM_RAM); - SekMapMemory(DrvPf1Ram , 0x320000, 0x321fff, SM_RAM); - SekMapMemory(DrvPf2Ram , 0x322000, 0x322fff, SM_RAM); - SekMapMemory(Drv68KRam + 0x5000 , 0x341000, 0x342fff, SM_RAM); - SekSetReadWordHandler(0, Tumbleb68KReadWord); - SekSetWriteWordHandler(0, Tumbleb68KWriteWord); - SekSetReadByteHandler(0, Tumbleb68KReadByte); - SekSetWriteByteHandler(0, Tumbleb68KWriteByte); - SekClose(); -} - -static void FncywldMap68k() -{ - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(DrvPaletteRam , 0x140000, 0x140fff, SM_RAM); - SekMapMemory(DrvSpriteRam , 0x160000, 0x1607ff, SM_RAM); - SekMapMemory(DrvPf1Ram , 0x320000, 0x321fff, SM_RAM); - SekMapMemory(DrvPf2Ram , 0x322000, 0x323fff, SM_RAM); - SekMapMemory(Drv68KRam , 0xff0000, 0xffffff, SM_RAM); - SekSetReadWordHandler(0, Fncywld68KReadWord); - SekSetWriteWordHandler(0, Fncywld68KWriteWord); - SekSetReadByteHandler(0, Fncywld68KReadByte); - SekSetWriteByteHandler(0, Fncywld68KWriteByte); - SekClose(); -} - -static void JumpkidsMapZ80() -{ - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(JumpkidsZ80Read); - ZetSetWriteHandler(JumpkidsZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram ); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); -} - -static void SemicomMapZ80() -{ - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(SemicomZ80Read); - ZetSetWriteHandler(SemicomZ80Write); - ZetMapArea(0x0000, 0xcfff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xcfff, 2, DrvZ80Rom ); - ZetMapArea(0xd000, 0xd7ff, 0, DrvZ80Ram ); - ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80Ram ); - ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); -} - -static void SemicomYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvInit(bool bReset, INT32 SpriteRamSize, INT32 SpriteMask, INT32 SpriteXOffset, INT32 SpriteYOffset, INT32 NumSprites, INT32 NumChars, INT32 NumTiles, double Refresh, INT32 OkiFreq) -{ - INT32 nRet = 0, nLen; - - DrvSpriteRamSize = SpriteRamSize; - DrvNumSprites = NumSprites, - DrvNumChars = NumChars, - DrvNumTiles = NumTiles, - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - nRet = DrvLoadRoms(); - - DrvMap68k(); - - if (DrvHasZ80) DrvMapZ80(); - - if (DrvHasYM2151) { - if (!DrvYM2151Freq) DrvYM2151Freq = 3427190; - BurnYM2151Init(DrvYM2151Freq); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.10, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.10, BURN_SND_ROUTE_RIGHT); - if (DrvHasZ80) { - BurnYM2151SetIrqHandler(&SemicomYM2151IrqHandler); - } - } - - // Setup the OKIM6295 emulation - if (DrvHasYM2151) { - MSM6295Init(0, OkiFreq / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - } else { - MSM6295Init(0, OkiFreq / 132, 0); - MSM6295SetRoute(0, 0.70, BURN_SND_ROUTE_BOTH); - } - - BurnSetRefreshRate(Refresh); - - nCyclesTotal[0] = 14000000 / 60; - - DrvSpriteXOffset = SpriteXOffset; - DrvSpriteYOffset = SpriteYOffset; - DrvSpriteMask = SpriteMask; - DrvSpriteColourMask = 0x0f; - Pf1XOffset = -5; - Pf1YOffset = 0; - Pf2XOffset = -1; - Pf2YOffset = 0; - - GenericTilesInit(); - - // Reset the driver - if (bReset) DrvDoReset(); - - return 0; -} - -static INT32 TumblebInit() -{ - DrvLoadRoms = TumblebLoadRoms; - DrvMap68k = TumblebMap68k; - DrvRender = DrvDraw; - - return DrvInit(1, 0x800, 0x3fff, -1, 0, 0x2000, 0x4000, 0x1000, 58.0, 8000000 / 10); -} - -static INT32 Tumbleb2Init() -{ - Tumbleb2 = 1; - return TumblebInit(); -} - -static INT32 JumpkidsInit() -{ - INT32 nRet; - - Jumpkids = 1; - DrvHasZ80 = 1; - DrvLoadRoms = JumpkidsLoadRoms; - DrvMap68k = TumblebMap68k; - DrvMapZ80 = JumpkidsMapZ80; - DrvRender = DrvDraw; - - nRet = DrvInit(1, 0x800, 0x7fff, -1, 0, 0x2000, 0x4000, 0x1000, 60.0, 8000000 / 8); - - nCyclesTotal[0] = 12000000 / 60; - nCyclesTotal[1] = (8000000 / 2) / 60; - - return nRet; -} - -static INT32 MetlsavrInit() -{ - INT32 nRet; - - DrvHasZ80 = 1; - DrvHasYM2151 = 1; - DrvHasProt = 1; - SemicomSoundCommand = 1; - DrvLoadRoms = MetlsavrLoadRoms; - DrvMap68k = HtchctchMap68k; - DrvMapZ80 = SemicomMapZ80; - DrvRender = DrvDraw; - - nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x4000, 0x4000, 0x1000, 60.0, 1024000); - - nCyclesTotal[0] = 15000000 / 60; - nCyclesTotal[1] = (15000000 / 4) / 60; - - return nRet; -} - -static INT32 PangpangInit() -{ - Tumbleb2 = 1; - DrvLoadRoms = PangpangLoadRoms; - DrvMap68k = PangpangMap68k; - DrvRender = PangpangDraw; - - INT32 nRet = DrvInit(1, 0x800, 0x7fff, -1, 0, 0x2000, 0x8000, 0x2000, 58.0, 8000000 / 10); - - MSM6295SetRoute(0, 0.70, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -static INT32 SuprtrioInit() -{ - INT32 nRet; - - DrvHasZ80 = 1; - SemicomSoundCommand = 1; - DrvLoadRoms = SuprtrioLoadRoms; - DrvMap68k = SuprtrioMap68k; - DrvMapZ80 = SemicomMapZ80; - DrvRender = SuprtrioDraw; - - nRet = DrvInit(1, 0x800, 0x7fff, 0, 0, 0x2000, 0x8000, 0x2000, 60.0, 875000); - - Pf1XOffset = -6; - Pf2XOffset = -2; - nCyclesTotal[1] = 8000000 / 60; - - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -static INT32 HtchctchInit() -{ - INT32 nRet; - - DrvHasZ80 = 1; - DrvHasYM2151 = 1; - DrvHasProt = 1; - SemicomSoundCommand = 1; - DrvLoadRoms = HtchctchLoadRoms; - DrvMap68k = HtchctchMap68k; - DrvMapZ80 = SemicomMapZ80; - DrvRender = HtchctchDraw; - - nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x1000, 0x4000, 0x1000, 60.0, 1024000); - - nCyclesTotal[0] = 15000000 / 60; - nCyclesTotal[1] = (15000000 / 4) / 60; - - return nRet; -} - -static INT32 CookbibInit() -{ - INT32 nRet = HtchctchInit(); - - Pf1XOffset = -5; - Pf1YOffset = 0; - Pf2XOffset = -1; - Pf2YOffset = 2; - - return nRet; -} - -static INT32 ChokchokInit() -{ - INT32 nRet; - - Chokchok = 1; - DrvHasZ80 = 1; - DrvHasYM2151 = 1; - DrvHasProt = 1; - SemicomSoundCommand = 1; - DrvLoadRoms = ChokchokLoadRoms; - DrvMap68k = HtchctchMap68k; - DrvMapZ80 = SemicomMapZ80; - DrvRender = DrvDraw; - - nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x4000, 0x10000, 0x4000, 60.0, 1024000); - - nCyclesTotal[0] = 15000000 / 60; - nCyclesTotal[1] = (15000000 / 4) / 60; - - Pf1XOffset = -5; - Pf1YOffset = 0; - Pf2XOffset = -1; - Pf2YOffset = 2; - - return nRet; -} - -static INT32 WlstarInit() -{ - INT32 nRet; - - Wlstar = 1; - DrvHasZ80 = 1; - DrvHasYM2151 = 1; - DrvHasProt = 1; - SemicomSoundCommand = 1; - DrvLoadRoms = ChokchokLoadRoms; - DrvMap68k = HtchctchMap68k; - DrvMapZ80 = SemicomMapZ80; - DrvRender = HtchctchDraw; - - nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x4000, 0x10000, 0x4000, 60.0, 1024000); - - nCyclesTotal[0] = 15000000 / 60; - nCyclesTotal[1] = (15000000 / 4) / 60; - - Pf1XOffset = -5; - Pf1YOffset = 0; - Pf2XOffset = -1; - Pf2YOffset = 2; - - return nRet; -} - -static INT32 Wondl96Init() -{ - INT32 nRet; - - Wlstar = 1; - Wondl96 = 1; - DrvHasZ80 = 1; - DrvHasYM2151 = 1; - DrvHasProt = 2; - SemicomSoundCommand = 1; - DrvLoadRoms = ChokchokLoadRoms; - DrvMap68k = HtchctchMap68k; - DrvMapZ80 = SemicomMapZ80; - DrvRender = HtchctchDraw; - - nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x4000, 0x10000, 0x4000, 60.0, 1024000); - - nCyclesTotal[0] = 15000000 / 60; - nCyclesTotal[1] = (15000000 / 4) / 60; - - Pf1XOffset = -5; - Pf1YOffset = 0; - Pf2XOffset = -1; - Pf2YOffset = 2; - - return nRet; -} - -static INT32 FncywldInit() -{ - INT32 nRet; - - DrvHasYM2151 = 1; - DrvHasZ80 = 0; - DrvYM2151Freq = 32220000 / 9; - DrvLoadRoms = FncywldLoadRoms; - DrvMap68k = FncywldMap68k; - DrvRender = FncywldDraw; - - nRet = DrvInit(1, 0x800, 0x3fff, -1, 0, 0x2000, 0x8000, 0x2000, 60.0, 1023924); - - nCyclesTotal[0] = 12000000 / 60; - DrvSpriteColourMask = 0x3f; - - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.20, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.20, BURN_SND_ROUTE_RIGHT); - - return nRet; -} - -static INT32 SdfightInit() -{ - INT32 nRet; - - Bcstry = 1; - DrvHasZ80 = 1; - DrvHasYM2151 = 1; - DrvYM2151Freq = 3427190; - DrvHasProt = 1; - SemicomSoundCommand = 1; - DrvLoadRoms = SdfightLoadRoms; - DrvMap68k = HtchctchMap68k; - DrvMapZ80 = SemicomMapZ80; - DrvRender = SdfightDraw; - - nRet = DrvInit(1, 0x1000, 0x7fff, 0, 1, 0x8000, 0x10000, 0x4000, 60.0, 1024000); - - nCyclesTotal[0] = 15000000 / 60; - nCyclesTotal[1] = (15000000 / 4) / 60; - - Pf1XOffset = -5; - Pf1YOffset = -16; - Pf2XOffset = -1; - Pf2YOffset = 0; - - return nRet; -} - -static INT32 BcstryInit() -{ - INT32 nRet; - - Bcstry = 1; - DrvHasZ80 = 1; - DrvHasYM2151 = 1; - DrvYM2151Freq = 3427190; - DrvHasProt = 1; - SemicomSoundCommand = 1; - DrvLoadRoms = BcstryLoadRoms; - DrvMap68k = HtchctchMap68k; - DrvMapZ80 = SemicomMapZ80; - DrvRender = HtchctchDraw; - - nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x8000, 0x10000, 0x4000, 60.0, 1024000); - - nCyclesTotal[0] = 15000000 / 60; - nCyclesTotal[1] = (15000000 / 4) / 60; - - //Pf1XOffset = 8; - Pf1XOffset = -5; - Pf1YOffset = 0; - //Pf2XOffset = 8; - Pf2XOffset = -1; - Pf2YOffset = 0; - - return nRet; -} - -static INT32 SemibaseInit() -{ - INT32 nRet; - - Semibase = 1; - Bcstry = 1; - DrvHasZ80 = 1; - DrvHasYM2151 = 1; - DrvYM2151Freq = 3427190; - DrvHasProt = 1; - SemicomSoundCommand = 1; - DrvLoadRoms = BcstryLoadRoms; - DrvMap68k = HtchctchMap68k; - DrvMapZ80 = SemicomMapZ80; - DrvRender = HtchctchDraw; - - nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x8000, 0x10000, 0x4000, 60.0, 1024000); - - nCyclesTotal[0] = 15000000 / 60; - nCyclesTotal[1] = (15000000 / 4) / 60; - - Pf1XOffset = -2; - Pf1YOffset = 0; - Pf2XOffset = -1; - Pf2YOffset = 0; - - return nRet; -} - -static INT32 DquizgoInit() -{ - INT32 nRet; - - DrvHasZ80 = 1; - DrvHasYM2151 = 1; - DrvHasProt = 2; - SemicomSoundCommand = 1; - DrvLoadRoms = MetlsavrLoadRoms; - DrvMap68k = HtchctchMap68k; - DrvMapZ80 = SemicomMapZ80; - DrvRender = HtchctchDraw; - - nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x4000, 0x4000, 0x1000, 60.0, 1024000); - - nCyclesTotal[0] = 15000000 / 60; - nCyclesTotal[1] = (15000000 / 4) / 60; - - Pf1XOffset = -5; - Pf1YOffset = 0; - Pf2XOffset = -1; - Pf2YOffset = 2; - - return nRet; -} - -inline static INT32 JumppopSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(ZetTotalCycles() * nSoundRate / 3500000); -} - -static INT32 JumppopInit() -{ - INT32 nRet = 0, nLen; - - DrvSpriteRamSize = 0x1000; - DrvNumSprites = 0x4000, - DrvNumChars = 0x8000, - DrvNumTiles = 0x2000, - - DrvHasZ80 = 1; - DrvHasYM3812 = 1; - - // Allocate and Blank all required memory - Mem = NULL; - JumppopMemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - JumppopMemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x200000); - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "jumppope")) { - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 7, 4); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 8, 4); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000002, 9, 4); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000003, 10, 4); if (nRet != 0) return 1; - GfxDecode(DrvNumChars, 8, 8, 8, JpeCharPlaneOffsets, JpeCharXOffsets, JpeCharYOffsets, 0x200, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 8, 16, 16, JpeTilePlaneOffsets, JpeTileXOffsets, JpeTileYOffsets, 0x800, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100001, 6, 2); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(MSM6295ROM, 11, 1); if (nRet != 0) return 1; - } else { - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 1); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 1, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 3, 1); if (nRet != 0) return 1; - GfxDecode(DrvNumChars, 8, 8, 8, JpCharPlaneOffsets, JpCharXOffsets, JpCharYOffsets, 0x100, DrvTempRom, DrvChars); - GfxDecode(DrvNumTiles, 8, 16, 16, JpTilePlaneOffsets, JpTileXOffsets, JpTileYOffsets, 0x400, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x200000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 5, 1); if (nRet != 0) return 1; - GfxDecode(DrvNumSprites, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(MSM6295ROM, 6, 1); if (nRet != 0) return 1; - } - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Drv68KRam , 0x120000, 0x123fff, SM_RAM); - SekMapMemory(DrvPaletteRam , 0x140000, 0x1407ff, SM_RAM); - SekMapMemory(DrvSpriteRam , 0x160000, 0x160fff, SM_RAM); - SekMapMemory(Drv68KRam + 0x4000 , 0x1a0000, 0x1a7fff, SM_RAM); - SekMapMemory(DrvPf1Ram , 0x320000, 0x323fff, SM_RAM); - SekMapMemory(DrvPf2Ram , 0x300000, 0x303fff, SM_RAM); - SekSetReadWordHandler(0, Jumppop68KReadWord); - SekSetWriteWordHandler(0, Jumppop68KWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetInHandler(JumppopZ80PortRead); - ZetSetOutHandler(JumppopZ80PortWrite); - ZetMapArea(0x0000, 0x2fff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0x2fff, 2, DrvZ80Rom ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x8000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x8000 ); - ZetMapArea(0xf800, 0xffff, 0, DrvZ80Ram ); - ZetMapArea(0xf800, 0xffff, 1, DrvZ80Ram ); - ZetMapArea(0xf800, 0xffff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - BurnYM3812Init(3500000, NULL, JumppopSynchroniseStream, 0); - BurnTimerAttachZetYM3812(3500000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 0.70, BURN_SND_ROUTE_BOTH); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 875000 / 132, 1); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - - BurnSetRefreshRate(60.0); - - nCyclesTotal[0] = 16000000 / 60; - nCyclesTotal[1] = 3500000 / 60; - - DrvSpriteXOffset = 1; - DrvSpriteYOffset = 0; - DrvSpriteMask = 0x7fff; - DrvSpriteColourMask = 0x0f; - Pf1XOffset = -0x3a0; - Pf1YOffset = 0; - Pf2XOffset = -0x3a2; - Pf2YOffset = 0; - - GenericTilesInit(); - DrvRender = JumppopDraw; - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - SekExit(); - if (DrvHasZ80) ZetExit(); - if (DrvHasYM2151) BurnYM2151Exit(); - MSM6295Exit(0); - - GenericTilesExit(); - - DrvVBlank = 0; - DrvOkiBank = 0; - DrvZ80Bank = 0; - DrvTileBank = 0; - DrvSoundLatch = 0; - Tumbleb2MusicCommand = 0; - Tumbleb2MusicBank = 0; - Tumbleb2MusicIsPlaying = 0; - - DrvSpriteXOffset = 0; - DrvSpriteYOffset = 0; - DrvSpriteRamSize = 0; - DrvSpriteMask = 0; - DrvSpriteColourMask = 0; - DrvYM2151Freq = 0; - DrvNumSprites = 0; - DrvNumChars = 0; - DrvNumTiles = 0; - DrvHasZ80 = 0; - DrvHasYM2151 = 0; - DrvHasYM3812 = 0; - DrvHasProt = 0; - Tumbleb2 = 0; - Jumpkids = 0; - Chokchok = 0; - Wlstar = 0; - Wondl96 = 0; - Bcstry = 0; - Semibase = 0; - SemicomSoundCommand = 0; - Pf1XOffset = 0; - Pf1YOffset = 0; - Pf2XOffset = 0; - Pf2YOffset = 0; - - DrvLoadRoms = NULL; - DrvMap68k = NULL; - DrvMapZ80 = NULL; - DrvRender = NULL; - - BurnFree(Mem); - - return 0; -} - -static INT32 JumppopExit() -{ - BurnYM3812Exit(); - return DrvExit(); -} - -static inline UINT8 pal4bit(UINT8 bits) -{ - bits &= 0x0f; - return (bits << 4) | bits; -} - -static inline UINT8 pal5bit(UINT8 bits) -{ - bits &= 0x1f; - return (bits << 3) | (bits >> 2); -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(nColour >> 0); - g = pal4bit(nColour >> 4); - b = pal4bit(nColour >> 8); - - return BurnHighCol(r, g, b, 0); -} - -inline static UINT32 HtchctchCalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal5bit(nColour >> 0); - g = pal5bit(nColour >> 5); - b = pal5bit(nColour >> 10); - - return BurnHighCol(r, g, b, 0); -} - -inline static UINT32 FncywldCalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(nColour >> 8); - g = pal4bit(nColour >> 4); - b = pal4bit(nColour >> 0); - - return BurnHighCol(r, g, b, 0); -} - -inline static UINT32 JumppopCalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal5bit(nColour >> 10); - g = pal5bit(nColour >> 5); - b = pal5bit(nColour >> 0); - - return BurnHighCol(r, g, b, 0); -} - -static void DrvCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x400; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } -} - -static void HtchctchCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x400; i++, ps++, pd++) { - *pd = HtchctchCalcCol(*ps); - } -} - -static void FncywldCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x800; i++, ps++, pd++) { - *pd = FncywldCalcCol(*ps); - } -} - -static void JumppopCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x400; i++, ps++, pd++) { - *pd = JumppopCalcCol(*ps); - } -} - -static void DrvRenderPf2Layer(INT32 ScrollX, INT32 ScrollY) -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; - - UINT16 *VideoRam = (UINT16*)DrvPf2Ram; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); - Attr = VideoRam[TileIndex]; - Code = (Attr & 0xfff) | (DrvTileBank >> 2); - Colour = Attr >> 12; - - Code &= (DrvNumTiles - 1); - - x = 16 * mx; - y = 16 * my; - - x -= ((ScrollX + Pf2XOffset) & 0x3ff); - y -= ((ScrollY + Pf2YOffset) & 0x1ff); - if (x < -16) x += 1024; - if (y < -16) y += 512; - - y -= 8; - - if (x > 0 && x < 304 && y > 0 && y < 224) { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); - } - } - } -} - -static void PangpangRenderPf2Layer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; - - UINT16 *VideoRam = (UINT16*)DrvPf2Ram; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); - Attr = VideoRam[TileIndex * 2 + 0]; - Code = VideoRam[TileIndex * 2 + 1] & 0xfff; - Code |= 0x1000; - Colour = (Attr >> 12) & 0x0f; - - Code &= (DrvNumTiles - 1); - - x = 16 * mx; - y = 16 * my; - - x -= ((DrvControl[3] + Pf2XOffset) & 0x3ff); - y -= ((DrvControl[4] + Pf2YOffset) & 0x1ff); - if (x < -16) x += 1024; - if (y < -16) y += 512; - - y -= 8; - - if (x > 0 && x < 304 && y > 0 && y < 224) { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); - } - } - } -} - -static void FncywldRenderPf2Layer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; - - UINT16 *VideoRam = (UINT16*)DrvPf2Ram; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); - Attr = VideoRam[TileIndex * 2 + 1]; - Code = VideoRam[TileIndex * 2 + 0]; - Colour = Attr & 0x1f; - - Code &= (DrvNumTiles - 1); - - x = 16 * mx; - y = 16 * my; - - x -= ((DrvControl[3] + Pf2XOffset) & 0x3ff); - y -= ((DrvControl[4] + Pf2YOffset) & 0x1ff); - if (x < -16) x += 1024; - if (y < -16) y += 512; - - y -= 8; - - if (x > 0 && x < 304 && y > 0 && y < 224) { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0x400, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0x400, DrvTiles); - } - } - } -} - -static void JumppopRenderPf2Layer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvPf2Ram; - - for (my = 0; my < 64; my++) { - for (mx = 0; mx < 64; mx++) { - Code = VideoRam[TileIndex]; - Code &= (DrvNumTiles - 1); - Colour = 0; - - x = 16 * mx; - y = 16 * my; - - x -= ((DrvControl[0] + Pf2XOffset) & 0x3ff); - y -= ((DrvControl[1] + Pf2YOffset) & 0x3ff); - if (x < -16) x += 1024; - if (y < -16) y += 1024; - - y -= 8; - - if (x > 0 && x < 304 && y > 0 && y < 224) { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 8, 512, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 8, 512, DrvTiles); - } - - TileIndex++; - } - } -} - -static void JumppopRenderPf2AltLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvPf2Ram; - - for (my = 0; my < 64; my++) { - for (mx = 0; mx < 128; mx++) { - Code = VideoRam[TileIndex]; - Colour = 0; - - x = 8 * mx; - y = 8 * my; - - x -= ((DrvControl[0] + Pf2XOffset) & 0x3ff); - y -= ((DrvControl[1] + Pf2YOffset) & 0x1ff); - if (x < -8) x += 1024; - if (y < -8) y += 512; - - y -= 8; - - if (x > 0 && x < 312 && y > 0 && y < 232) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 8, 0, 512, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 8, 0, 512, DrvChars); - } - - TileIndex++; - } - } -} - -static void DrvRenderPf1Layer(INT32 ScrollX, INT32 ScrollY) -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; - - UINT16 *VideoRam = (UINT16*)DrvPf1Ram; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); - Attr = VideoRam[TileIndex]; - Code = (Attr & 0xfff) | (DrvTileBank >> 2); - Colour = Attr >> 12; - - Code &= (DrvNumTiles - 1); - - x = 16 * mx; - y = 16 * my; - - x -= ((ScrollX + Pf1XOffset) & 0x3ff); - y -= ((ScrollY + Pf1YOffset) & 0x1ff); - if (x < -16) x += 1024; - if (y < -16) y += 512; - - y -= 8; - - if (x > 0 && x < 304 && y > 0 && y < 224) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); - } - } - } -} - -static void PangpangRenderPf1Layer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; - - UINT16 *VideoRam = (UINT16*)DrvPf1Ram; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); - Attr = VideoRam[TileIndex * 2 + 0]; - Code = VideoRam[TileIndex * 2 + 1]; - Colour = (Attr >> 12) & 0x0f; - - Code &= (DrvNumTiles - 1); - - x = 16 * mx; - y = 16 * my; - - x -= ((DrvControl[1] + Pf1XOffset) & 0x3ff); - y -= ((DrvControl[2] + Pf1YOffset) & 0x1ff); - if (x < -16) x += 1024; - if (y < -16) y += 512; - - y -= 8; - - if (x > 0 && x < 304 && y > 0 && y < 224) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); - } - } - } -} - -static void FncywldRenderPf1Layer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; - - UINT16 *VideoRam = (UINT16*)DrvPf1Ram; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); - Attr = VideoRam[TileIndex * 2 + 1]; - Code = VideoRam[TileIndex * 2 + 0]; - Colour = Attr & 0x1f; - - Code &= (DrvNumTiles - 1); - - x = 16 * mx; - y = 16 * my; - - x -= ((DrvControl[1] + Pf1XOffset) & 0x3ff); - y -= ((DrvControl[2] + Pf1YOffset) & 0x1ff); - if (x < -16) x += 1024; - if (y < -16) y += 512; - - y -= 8; - - if (x > 0 && x < 304 && y > 0 && y < 224) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x200, DrvTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x200, DrvTiles); - } - } - } -} - -static void JumppopRenderPf1Layer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvPf1Ram; - - for (my = 0; my < 64; my++) { - for (mx = 0; mx < 64; mx++) { - Code = VideoRam[TileIndex] & 0x1fff; - Code &= (DrvNumTiles - 1); - Colour = 0; - - x = 16 * mx; - y = 16 * my; - - x -= ((DrvControl[2] + Pf1XOffset) & 0x3ff); - y -= ((DrvControl[3] + Pf1YOffset) & 0x3ff); - if (x < -16) x += 1024; - if (y < -16) y += 1024; - - y -= 8; - - if (x > 0 && x < 304 && y > 0 && y < 224) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 8, 0, 256, DrvTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 8, 0, 256, DrvTiles); - } - - TileIndex++; - } - } -} - -static void DrvRenderCharLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvPf1Ram; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = VideoRam[TileIndex]; - Code = (Attr & 0xfff) | DrvTileBank; - Colour = Attr >> 12; - Code &= (DrvNumChars - 1); - - x = 8 * mx; - y = 8 * my; - - x -= ((DrvControl[1] + Pf1XOffset) & 0x1ff); - y -= ((DrvControl[2] + Pf1YOffset) & 0xff); - if (x < -8) x += 512; - if (y < -8) y += 256; - - y -= 8; - - if (x > 0 && x < 312 && y > 0 && y < 232) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); - } - - TileIndex++; - } - } -} - -static void PangpangRenderCharLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvPf1Ram; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = VideoRam[TileIndex * 2 + 0]; - Code = VideoRam[TileIndex * 2 + 1] & 0x1fff; - Colour = (Attr >> 12) & 0x1f; - Code &= (DrvNumChars - 1); - - x = 8 * mx; - y = 8 * my; - - x -= ((DrvControl[1] + Pf1XOffset) & 0x1ff); - y -= ((DrvControl[2] + Pf1YOffset) & 0xff); - if (x < -8) x += 512; - if (y < -8) y += 256; - - y -= 8; - - if (x > 0 && x < 312 && y > 0 && y < 232) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); - } - - TileIndex++; - } - } -} - -static void FncywldRenderCharLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvPf1Ram; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = VideoRam[TileIndex * 2 + 1]; - Code = VideoRam[TileIndex * 2 + 0] & 0x1fff; - if (Code) { - Colour = Attr & 0x1f; - Code &= (DrvNumChars - 1); - - x = 8 * mx; - y = 8 * my; - - x -= ((DrvControl[1] + Pf1XOffset) & 0x1ff); - y -= ((DrvControl[2] + Pf1YOffset) & 0xff); - if (x < -8) x += 512; - if (y < -8) y += 256; - - y -= 8; - - if (x > 0 && x < 312 && y > 0 && y < 232) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x400, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x400, DrvChars); - } - } - - TileIndex++; - } - } -} - -static void SdfightRenderCharLayer() -{ - INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvPf1Ram; - - for (my = 0; my < 64; my++) { - for (mx = 0; mx < 64; mx++) { - Attr = VideoRam[TileIndex]; - Code = (Attr & 0xfff) | DrvTileBank; - Colour = Attr >> 12; - Code &= (DrvNumChars - 1); - - x = 8 * mx; - y = 8 * my; - - x -= ((DrvControl[1] + Pf1XOffset) & 0x1ff); - y -= ((DrvControl[2] + Pf1YOffset) & 0x1ff); - if (x < -8) x += 512; - if (y < -8) y += 512; - - y -= 8; - - if (x > 0 && x < 312 && y > 0 && y < 232) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); - } - - TileIndex++; - } - } -} - -static void JumppopRenderCharLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvPf1Ram; - - for (my = 0; my < 64; my++) { - for (mx = 0; mx < 128; mx++) { - Code = VideoRam[TileIndex]; - Colour = 0; - - x = 8 * mx; - y = 8 * my; - - x -= ((DrvControl[2] + Pf1XOffset) & 0x3ff); - y -= ((DrvControl[3] + Pf1YOffset) & 0x1ff); - if (x < -8) x += 1024; - if (y < -8) y += 512; - - y -= 8; - - if (x > 0 && x < 312 && y > 0 && y < 232) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 8, 0, 256, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 8, 0, 256, DrvChars); - } - - TileIndex++; - } - } -} - -static void DrvRenderSprites(INT32 MaskColour, INT32 xFlipped) -{ - INT32 Offset; - UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; - - for (Offset = 0; Offset < DrvSpriteRamSize / 2; Offset += 4) { - INT32 x, y, Code, Colour, Flash, Multi, xFlip, yFlip, Inc, Mult; - - Code = SpriteRam[Offset + 1] & DrvSpriteMask; - if (!Code) continue; - - y = SpriteRam[Offset]; - Flash = y & 0x1000; - if (Flash && (GetCurrentFrame() & 1)) continue; - - x = SpriteRam[Offset + 2]; - Colour = (x >> 9) & DrvSpriteColourMask; - xFlip = y & 0x2000; - yFlip = y & 0x4000; - - Multi = (1 << ((y & 0x600) >> 9)) - 1; - - x &= 0x1ff; - y &= 0x1ff; - if (x >= 320) x -= 512; - if (y >= 256) y -= 512; - y = 240 - y; - x = 304 - x; - - y -= 8; - - if (yFlip) { - Inc = -1; - } else { - Code += Multi; - Inc = 1; - } - - if (xFlipped) { - xFlip = !xFlip; - x = 304 - x; - } - - Mult = -16; - - while (Multi >= 0) { - INT32 RenderCode = Code - (Multi * Inc); - INT32 RenderX = DrvSpriteXOffset + x; - INT32 RenderY = DrvSpriteYOffset + y + (Mult * Multi); - RenderCode &= (DrvNumSprites - 1); - - if (RenderX > 16 && RenderX < 304 && RenderY > 16 && RenderY < 224) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); - } else { - Render16x16Tile_Mask(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); - } - } - } - - Multi--; - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - DrvRenderPf2Layer(DrvControl[3], DrvControl[4]); - - if (DrvControl[6] & 0x80) { - DrvRenderCharLayer(); - } else { - DrvRenderPf1Layer(DrvControl[1], DrvControl[2]); - } - - DrvRenderSprites(0, 0); - BurnTransferCopy(DrvPalette); -} - -static void PangpangDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - PangpangRenderPf2Layer(); - - if (DrvControl[6] & 0x80) { - PangpangRenderCharLayer(); - } else { - PangpangRenderPf1Layer(); - } - - DrvRenderSprites(0, 0); - BurnTransferCopy(DrvPalette); -} - -static void SuprtrioDraw() -{ - BurnTransferClear(); - HtchctchCalcPalette(); - DrvRenderPf2Layer(-DrvControl[3], -DrvControl[4]); - DrvRenderPf1Layer(-DrvControl[1], -DrvControl[2]); - DrvRenderSprites(0, 0); - BurnTransferCopy(DrvPalette); -} - -static void HtchctchDraw() -{ - BurnTransferClear(); - HtchctchCalcPalette(); - DrvRenderPf2Layer(DrvControl[3], DrvControl[4]); - - if (DrvControl[6] & 0x80) { - DrvRenderCharLayer(); - } else { - DrvRenderPf1Layer(DrvControl[1], DrvControl[2]); - } - - DrvRenderSprites(0, 0); - BurnTransferCopy(DrvPalette); -} - -static void FncywldDraw() -{ - BurnTransferClear(); - FncywldCalcPalette(); - FncywldRenderPf2Layer(); - - if (DrvControl[6] & 0x80) { - FncywldRenderCharLayer(); - } else { - FncywldRenderPf1Layer(); - } - - DrvRenderSprites(0x0f, 0); - BurnTransferCopy(DrvPalette); -} - -static void SdfightDraw() -{ - BurnTransferClear(); - HtchctchCalcPalette(); - DrvRenderPf2Layer(DrvControl[3], DrvControl[4]); - - if (DrvControl[6] & 0x80) { - SdfightRenderCharLayer(); - } else { - DrvRenderPf1Layer(DrvControl[1], DrvControl[2]); - } - - DrvRenderSprites(0, 0); - BurnTransferCopy(DrvPalette); -} - -static void JumppopDraw() -{ - BurnTransferClear(); - JumppopCalcPalette(); - - if (DrvControl[7] & 0x01) { - JumppopRenderPf2Layer(); - } else { - JumppopRenderPf2AltLayer(); - } - - if (DrvControl[7] & 0x02) { - JumppopRenderPf1Layer(); - } else { - JumppopRenderCharLayer(); - } - - DrvRenderSprites(0, 1); - BurnTransferCopy(DrvPalette); -} - -#define NUM_SCANLINES 315 -#define SCANLINE_VBLANK_START 37 -#define SCANLINE_VBLANK_END SCANLINE_VBLANK_START + 240 - -static INT32 DrvFrame() -{ - INT32 nInterleave = NUM_SCANLINES; - INT32 nSoundBufferPos = 0; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - if (DrvHasZ80) ZetNewFrame(); - - DrvVBlank = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == SCANLINE_VBLANK_START) DrvVBlank = 1; - if (i == SCANLINE_VBLANK_END) DrvVBlank = 0; - if (i == NUM_SCANLINES - 1) { - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - if (Tumbleb2) Tumbleb2PlayMusic(); - } - SekClose(); - - if (DrvHasZ80) { - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (DrvHasYM2151) { - if (DrvHasZ80) ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - if (DrvHasZ80) ZetClose(); - } - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - if (DrvHasYM2151) { - if (DrvHasZ80) ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - if (DrvHasZ80) ZetClose(); - } - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) DrvRender(); - - return 0; -} - -static INT32 JumppopFrame() -{ - INT32 nInterleave = 1953 / 60; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == (nInterleave - 1)) { - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - } - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - BurnTimerUpdateYM3812(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - ZetNmi(); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - - if (pBurnDraw) JumppopDraw(); - - return 0; -} - -#undef NUM_SCANLINES -#undef SCANLINE_VBLANK_START -#undef SCANLINE_VBLANK_END - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029676; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - if (DrvHasZ80) ZetScan(nAction); - if (DrvHasYM2151) BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(DrvDip); - SCAN_VAR(DrvInput); - SCAN_VAR(DrvVBlank); - SCAN_VAR(DrvOkiBank); - SCAN_VAR(DrvZ80Bank); - SCAN_VAR(DrvTileBank); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(Tumbleb2MusicCommand); - SCAN_VAR(Tumbleb2MusicBank); - SCAN_VAR(Tumbleb2MusicIsPlaying); - } - - if (nAction & ACB_WRITE) { - if (DrvOkiBank) { - if (Jumpkids) { - memcpy(MSM6295ROM + 0x20000, DrvMSM6295ROMSrc + (DrvOkiBank * 0x20000), 0x20000); - } else { - memcpy(MSM6295ROM + 0x30000, DrvMSM6295ROMSrc + 0x30000 + (DrvOkiBank * 0x10000), 0x10000); - } - } - - if (DrvZ80Bank) { - ZetOpen(0); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + (DrvZ80Bank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + (DrvZ80Bank * 0x4000)); - ZetClose(); - } - } - - return 0; -} - -struct BurnDriver BurnDrvTumbleb = { - "tumbleb", "tumblep", NULL, NULL, "1991", - "Tumble Pop (bootleg set 1)\0", NULL, "Data East Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, TumblebRomInfo, TumblebRomName, NULL, NULL, TumblebInputInfo, TumblebDIPInfo, - TumblebInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvTumbleb2 = { - "tumbleb2", "tumblep", NULL, NULL, "1991", - "Tumble Pop (bootleg set 2)\0", NULL, "Data East Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, Tumbleb2RomInfo, Tumbleb2RomName, NULL, NULL, TumblebInputInfo, TumblebDIPInfo, - Tumbleb2Init, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvJumpkids = { - "jumpkids", NULL, NULL, NULL, "1993", - "Jump Kids\0", NULL, "Comad", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, JumpkidsRomInfo, JumpkidsRomName, NULL, NULL, TumblebInputInfo, TumblebDIPInfo, - JumpkidsInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvMetlsavr = { - "metlsavr", NULL, NULL, NULL, "1994", - "Metal Saver\0", NULL, "First Amusement", "Miscellaneous", - L"Metal Saver\0\uBA54\uD0C8\uC138\uC774\uBC84\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, MetlsavrRomInfo, MetlsavrRomName, NULL, NULL, MetlsavrInputInfo, MetlsavrDIPInfo, - MetlsavrInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPangpang = { - "pangpang", NULL, NULL, NULL, "1994", - "Pang Pang\0", NULL, "Dong Gue La Mi Ltd.", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, PangpangRomInfo, PangpangRomName, NULL, NULL, TumblebInputInfo, TumblebDIPInfo, - PangpangInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSuprtrio = { - "suprtrio", NULL, NULL, NULL, "1994", - "Super Trio\0", NULL, "Gameace", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, SuprtrioRomInfo, SuprtrioRomName, NULL, NULL, SuprtrioInputInfo, SuprtrioDIPInfo, - SuprtrioInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvHtchctch = { - "htchctch", NULL, NULL, NULL, "1995", - "Hatch Catch\0", NULL, "SemiCom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, HtchctchRomInfo, HtchctchRomName, NULL, NULL, HtchctchInputInfo, HtchctchDIPInfo, - HtchctchInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvCookbib = { - "cookbib", NULL, NULL, NULL, "1995", - "Cookie & Bibi\0", NULL, "SemiCom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, CookbibRomInfo, CookbibRomName, NULL, NULL, HtchctchInputInfo, CookbibDIPInfo, - CookbibInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvChokChok = { - "chokchok", NULL, NULL, NULL, "1995", - "Choky! Choky!\0", NULL, "SemiCom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, ChokchokRomInfo, ChokchokRomName, NULL, NULL, HtchctchInputInfo, ChokchokDIPInfo, - ChokchokInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvWlstar = { - "wlstar", NULL, NULL, NULL, "1995", - "Wonder League Star - Sok-Magicball Fighting (Korea)\0", NULL, "Mijin", "Miscellaneous", - L"\uC6D0\uB354\uB9AC\uADF8\uC2A4\uD0C0 - \uC18D \uB9E4\uC9C1\uBCFC \uD30C\uC774\uD305 (Korea)\0Wonder League Star - Sok-Magicball Fighting\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, - NULL, WlstarRomInfo, WlstarRomName, NULL, NULL, MetlsavrInputInfo, WlstarDIPInfo, - WlstarInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvWondl96 = { - "wondl96", NULL, NULL, NULL, "1995", - "Wonder League '96 (Korea)\0", NULL, "SemiCom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, - NULL, Wondl96RomInfo, Wondl96RomName, NULL, NULL, MetlsavrInputInfo, Wondl96DIPInfo, - Wondl96Init, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvFancywld = { - "fncywld", NULL, NULL, NULL, "1996", - "Fancy World - Earth of Crisis\0", NULL, "Unico", "Miscellaneous", - L"Fancy World - Earth of Crisis\0\uD39C\uC2DC\uC6D4\uB4DC \uD658\uC0C1\uC758 \uC138\uACC4 - Earth of Crisis\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, FncywldRomInfo, FncywldRomName, NULL, NULL, FncywldInputInfo, FncywldDIPInfo, - FncywldInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSdfight = { - "sdfight", NULL, NULL, NULL, "1996", - "SD Fighters (Korea)\0", NULL, "SemiCom", "Miscellaneous", - L"\uFF33\uFF24 \uD30C\uC774\uD130\uC988 (Korea)\0SD Fighters\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, SdfightRomInfo, SdfightRomName, NULL, NULL, MetlsavrInputInfo, SdfightDIPInfo, - SdfightInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvBcstry = { - "bcstry", NULL, NULL, NULL, "1997", - "B.C. Story (set 1)\0", NULL, "SemiCom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, - NULL, BcstryRomInfo, BcstryRomName, NULL, NULL, MetlsavrInputInfo, BcstryDIPInfo, - BcstryInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvBcstrya = { - "bcstrya", "bcstry", NULL, NULL, "1997", - "B.C. Story (set 2)\0", NULL, "SemiCom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, - NULL, BcstryaRomInfo, BcstryaRomName, NULL, NULL, MetlsavrInputInfo, BcstryDIPInfo, - BcstryInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSemibase = { - "semibase", NULL, NULL, NULL, "1997", - "MuHanSeungBu (SemiCom Baseball) (Korea)\0", NULL, "SemiCom", "Miscellaneous", - L"\u7121\u9650\u52DD\u8CA0\0\uC804\uC6D0 \uAD6D\uC81C\uB9AC\uADF8 \uC804 (SemiCom Baseball) (Korea)\0MuHanSeungBu\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, - NULL, SemibaseRomInfo, SemibaseRomName, NULL, NULL, SemibaseInputInfo, SemibaseDIPInfo, - SemibaseInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvDquizgo = { - "dquizgo", NULL, NULL, NULL, "1998", - "Date Quiz Go Go (Korea)\0", NULL, "SemiCom", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, - NULL, DquizgoRomInfo, DquizgoRomName, NULL, NULL, MetlsavrInputInfo, DquizgoDIPInfo, - DquizgoInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x800, 320, 240, 4, 3 -}; - -// these should actually be in d_esd16.cpp (similar hardware) -struct BurnDriver BurnDrvJumppop = { - "jumppop", NULL, NULL, NULL, "2001", - "Jumping Pop (set 1)\0", NULL, "ESD", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, JumppopRomInfo, JumppopRomName, NULL, NULL, JumppopInputInfo, JumppopDIPInfo, - JumppopInit, JumppopExit, JumppopFrame, NULL, DrvScan, - NULL, 0x400, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvJumppope = { - "jumppope", "jumppop", NULL, NULL, "2001", - "Jumping Pop (set 2)\0", NULL, "Emag Soft", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, JumppopeRomInfo, JumppopeRomName, NULL, NULL, JumppopInputInfo, JumppopDIPInfo, - JumppopInit, JumppopExit, JumppopFrame, NULL, DrvScan, - NULL, 0x400, 320, 240, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm6295.h" +#include "burn_ym3812.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[2] = {0, 0}; +static UINT8 DrvInput[3] = {0, 0, 0}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Drv68KRom = NULL; +static UINT8 *Drv68KRam = NULL; +static UINT8 *DrvZ80Rom = NULL; +static UINT8 *DrvZ80Ram = NULL; +static UINT8 *DrvProtData = NULL; +static UINT8 *DrvMSM6295ROMSrc = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvPf1Ram = NULL; +static UINT8 *DrvPf2Ram = NULL; +static UINT8 *DrvPaletteRam = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; +static UINT16 *DrvControl = NULL; + +static UINT8 DrvVBlank; +static UINT8 DrvOkiBank; +static UINT8 DrvZ80Bank; +static UINT16 DrvTileBank; +static INT32 DrvSoundLatch; +static INT32 Tumbleb2MusicCommand; +static INT32 Tumbleb2MusicBank; +static INT32 Tumbleb2MusicIsPlaying; + +static INT32 DrvSpriteXOffset; +static INT32 DrvSpriteYOffset; +static INT32 DrvSpriteRamSize; +static INT32 DrvSpriteMask; +static INT32 DrvSpriteColourMask; +static INT32 DrvYM2151Freq; +static INT32 DrvNumSprites; +static INT32 DrvNumChars; +static INT32 DrvNumTiles; +static INT32 DrvHasZ80; +static INT32 DrvHasYM2151; +static INT32 DrvHasYM3812; +static INT32 DrvHasProt; +static INT32 Tumbleb2; +static INT32 Jumpkids; +static INT32 Chokchok; +static INT32 Wlstar; +static INT32 Wondl96; +static INT32 Bcstry; +static INT32 Semibase; +static INT32 SemicomSoundCommand; +static INT32 Pf1XOffset; +static INT32 Pf1YOffset; +static INT32 Pf2XOffset; +static INT32 Pf2YOffset; + +typedef INT32 (*LoadRoms)(); +static LoadRoms DrvLoadRoms; +typedef void (*Map68k)(); +static Map68k DrvMap68k; +typedef void (*MapZ80)(); +static MapZ80 DrvMapZ80; +typedef void (*Render)(); +static Render DrvRender; + +static void DrvDraw(); +static void PangpangDraw(); +static void SuprtrioDraw(); +static void HtchctchDraw(); +static void FncywldDraw(); +static void SdfightDraw(); +static void JumppopDraw(); + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo TumblebInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort2 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Tumbleb) + +static struct BurnInputInfo MetlsavrInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Metlsavr) + +static struct BurnInputInfo SuprtrioInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, +}; + +STDINPUTINFO(Suprtrio) + +static struct BurnInputInfo HtchctchInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Htchctch) + +static struct BurnInputInfo FncywldInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort2 + 2, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Fncywld) + +static struct BurnInputInfo SemibaseInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, + {"Coin 3" , BIT_DIGITAL , DrvInputPort2 + 2, "p3 coin" }, + {"Coin 4" , BIT_DIGITAL , DrvInputPort2 + 3, "p4 coin" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Semibase) + +static struct BurnInputInfo JumppopInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort2 + 2, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 3, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Jumppop) + +static struct BurnDIPInfo TumblebDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x12, 0x01, 0xe0, 0x00, "3 Coins 1 Credit" }, + {0x12, 0x01, 0xe0, 0x80, "2 Coins 1 Credit" }, + {0x12, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, + {0x12, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xe0, 0xc0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xe0, 0x40, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x12, 0x01, 0x1c, 0x00, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x1c, 0x10, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x1c, 0x18, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x1c, 0x08, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x12, 0x01, 0x02, 0x02, "Off" }, + {0x12, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "2 Coins to Start, 1 to Continue" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0xc0, 0x80, "1" }, + {0x13, 0x01, 0xc0, 0x00, "2" }, + {0x13, 0x01, 0xc0, 0xc0, "3" }, + {0x13, 0x01, 0xc0, 0x40, "4" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x30, 0x10, "Easy" }, + {0x13, 0x01, 0x30, 0x30, "Normal" }, + {0x13, 0x01, 0x30, 0x20, "Hard" }, + {0x13, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, +}; + +STDDIPINFO(Tumbleb) + +static struct BurnDIPInfo MetlsavrDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x0c, 0x00, "2" }, + {0x13, 0x01, 0x0c, 0x0c, "3" }, + {0x13, 0x01, 0x0c, 0x08, "4" }, + {0x13, 0x01, 0x0c, 0x04, "5" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x13, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x10, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x30, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x70, 0x60, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x70, 0x50, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x70, 0x40, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x00, "Off" }, + {0x13, 0x01, 0x80, 0x80, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Language" }, + {0x14, 0x01, 0x08, 0x08, "English" }, + {0x14, 0x01, 0x08, 0x00, "Korean" }, + + {0 , 0xfe, 0 , 4 , "Life Meter" }, + {0x14, 0x01, 0x30, 0x00, "66%" }, + {0x14, 0x01, 0x30, 0x30, "100%" }, + {0x14, 0x01, 0x30, 0x20, "133%" }, + {0x14, 0x01, 0x30, 0x10, "166%" }, + + {0 , 0xfe, 0 , 4 , "Time" }, + {0x14, 0x01, 0xc0, 0x40, "30 Seconds" }, + {0x14, 0x01, 0xc0, 0x80, "40 Seconds" }, + {0x14, 0x01, 0xc0, 0xc0, "60 Seconds" }, + {0x14, 0x01, 0xc0, 0x00, "80 Seconds" }, +}; + +STDDIPINFO(Metlsavr) + +static struct BurnDIPInfo SuprtrioDIPList[]= +{ + // Default Values + {0x12, 0xff, 0xff, 0x10, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x12, 0x01, 0x07, 0x06, "5 Coins 1 Credit" }, + {0x12, 0x01, 0x07, 0x05, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x07, 0x04, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x07, 0x03, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x07, 0x00, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x07, 0x01, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x02, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x07, "Free Play" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x18, 0x00, "1" }, + {0x12, 0x01, 0x18, 0x08, "2" }, + {0x12, 0x01, 0x18, 0x10, "3" }, + {0x12, 0x01, 0x18, 0x18, "5" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x12, 0x01, 0x20, 0x00, "Normal" }, + {0x12, 0x01, 0x20, 0x20, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x12, 0x01, 0x40, 0x00, "50000" }, + {0x12, 0x01, 0x40, 0x40, "60000" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x80, 0x00, "Off" }, + {0x12, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Suprtrio) + +static struct BurnDIPInfo HtchctchDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x06, 0x00, "Easy" }, + {0x12, 0x01, 0x06, 0x06, "Normal" }, + {0x12, 0x01, 0x06, 0x02, "Hard" }, + {0x12, 0x01, 0x06, 0x04, "Very Hard" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x12, 0x01, 0x38, 0x00, "5 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x30, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x38, 0x28, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x08, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 2 , "Stage Skip" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Htchctch) + +static struct BurnDIPInfo CookbibDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x06, 0x00, "Easy" }, + {0x12, 0x01, 0x06, 0x06, "Normal" }, + {0x12, 0x01, 0x06, 0x02, "Hard" }, + {0x12, 0x01, 0x06, 0x04, "Very Hard" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x12, 0x01, 0x38, 0x00, "5 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x30, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x38, 0x28, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x08, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 2 , "Winning Rounds (vs mode)"}, + {0x12, 0x01, 0x40, 0x00, "1" }, + {0x12, 0x01, 0x40, 0x40, "2" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Cookbib) + +static struct BurnDIPInfo ChokchokDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Winning Rounds (vs mode)"}, + {0x11, 0x01, 0x01, 0x00, "2" }, + {0x11, 0x01, 0x01, 0x01, "3" }, + + {0 , 0xfe, 0 , 2 , "Time" }, + {0x11, 0x01, 0x20, 0x20, "60 Seconds" }, + {0x11, 0x01, 0x20, 0x00, "90 Seconds" }, + + {0 , 0xfe, 0 , 4 , "Starting Balls" }, + {0x11, 0x01, 0xc0, 0x00, "3" }, + {0x11, 0x01, 0xc0, 0xc0, "4" }, + {0x11, 0x01, 0xc0, 0x40, "5" }, + {0x11, 0x01, 0xc0, 0x80, "6" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x06, 0x00, "Easy" }, + {0x12, 0x01, 0x06, 0x06, "Normal" }, + {0x12, 0x01, 0x06, 0x02, "Hard" }, + {0x12, 0x01, 0x06, 0x04, "Very Hard" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x12, 0x01, 0x38, 0x00, "5 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x20, "4 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x10, "3 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x30, "2 Coins 1 Credit" }, + {0x12, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, + {0x12, 0x01, 0x38, 0x28, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x38, 0x18, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x38, 0x08, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Chokchok) + +static struct BurnDIPInfo WlstarDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "2 Players Game" }, + {0x13, 0x01, 0x10, 0x00, "1 Credit" }, + {0x13, 0x01, 0x10, 0x10, "2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0xc0, 0x00, "Easy" }, + {0x13, 0x01, 0xc0, 0xc0, "Normal" }, + {0x13, 0x01, 0xc0, 0x40, "Hard" }, + {0x13, 0x01, 0xc0, 0x80, "Hardest" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Last Inning" }, + {0x14, 0x01, 0x01, 0x00, "9" }, + {0x14, 0x01, 0x01, 0x01, "12" }, + + {0 , 0xfe, 0 , 2 , "Versus CPU Game Ends" }, + {0x14, 0x01, 0x02, 0x02, "+10" }, + {0x14, 0x01, 0x02, 0x00, "+7" }, + + {0 , 0xfe, 0 , 2 , "Versus Game" }, + {0x14, 0x01, 0x04, 0x00, "1 Credit / 2 Innings" }, + {0x14, 0x01, 0x04, 0x04, "1 Credit / 3 Innings" }, + + {0 , 0xfe, 0 , 2 , "Full 2 Players Game" }, + {0x14, 0x01, 0x08, 0x00, "4 Credits" }, + {0x14, 0x01, 0x08, 0x08, "6 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x14, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, + {0x14, 0x01, 0x70, 0x40, "4 Coins 1 Credit" }, + {0x14, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Wlstar) + +static struct BurnDIPInfo Wondl96DIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0x7f, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Field Colour" }, + {0x13, 0x01, 0x10, 0x10, "Blue" }, + {0x13, 0x01, 0x10, 0x00, "Green" }, + + {0 , 0xfe, 0 , 2 , "Versus CPU Game Ends" }, + {0x13, 0x01, 0x20, 0x20, "+10" }, + {0x13, 0x01, 0x20, 0x00, "+7" }, + + {0 , 0xfe, 0 , 2 , "Versus Game" }, + {0x13, 0x01, 0x40, 0x00, "1 Credit / 2 Innings" }, + {0x13, 0x01, 0x40, 0x40, "1 Credit / 3 Innings" }, + + {0 , 0xfe, 0 , 2 , "Full 2 Players Game" }, + {0x13, 0x01, 0x80, 0x80, "4 Credits" }, + {0x13, 0x01, 0x80, 0x00, "6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x14, 0x01, 0x0e, 0x04, "Level 1" }, + {0x14, 0x01, 0x0e, 0x08, "Level 2" }, + {0x14, 0x01, 0x0e, 0x00, "Level 3" }, + {0x14, 0x01, 0x0e, 0x0e, "Level 4" }, + {0x14, 0x01, 0x0e, 0x06, "Level 5" }, + {0x14, 0x01, 0x0e, 0x0a, "Level 6" }, + {0x14, 0x01, 0x0e, 0x02, "Level 7" }, + {0x14, 0x01, 0x0e, 0x0c, "Level 8" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x14, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, + {0x14, 0x01, 0x70, 0x40, "4 Coins 1 Credit" }, + {0x14, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, +}; + +STDDIPINFO(Wondl96) + +static struct BurnDIPInfo FncywldDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xf7, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x14, 0x01, 0xe0, 0x20, "4 Coins 1 Credit" }, + {0x14, 0x01, 0xe0, 0x40, "3 Coins 1 Credit" }, + {0x14, 0x01, 0xe0, 0x60, "2 Coins 1 Credit" }, + {0x14, 0x01, 0xe0, 0x00, "2 Coins 1 Credit" }, + {0x14, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, + {0x14, 0x01, 0xe0, 0xc0, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xe0, 0x80, "1 Coin 4 Credits" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x10, 0x00, "Off" }, + {0x14, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x08, 0x08, "Off" }, + {0x14, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x14, 0x01, 0x04, 0x04, "English" }, + {0x14, 0x01, 0x04, 0x00, "Korean" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "2 Coins to Start, 1 to Continue" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0xc0, 0x80, "1" }, + {0x15, 0x01, 0xc0, 0x00, "2" }, + {0x15, 0x01, 0xc0, 0xc0, "3" }, + {0x15, 0x01, 0xc0, 0x40, "4" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x30, 0x30, "Easy" }, + {0x15, 0x01, 0x30, 0x20, "Normal" }, + {0x15, 0x01, 0x30, 0x10, "Hard" }, + {0x15, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Freeze" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, +}; + +STDDIPINFO(Fncywld) + +static struct BurnDIPInfo SdfightDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0x7f, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x13, 0x01, 0x0e, 0x04, "1" }, + {0x13, 0x01, 0x0e, 0x08, "2" }, + {0x13, 0x01, 0x0e, 0x00, "3" }, + {0x13, 0x01, 0x0e, 0x0e, "4" }, + {0x13, 0x01, 0x0e, 0x06, "5" }, + {0x13, 0x01, 0x0e, 0x0a, "6" }, + {0x13, 0x01, 0x0e, 0x02, "7" }, + {0x13, 0x01, 0x0e, 0x0c, "8" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x13, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x40, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Winning Rounds" }, + {0x14, 0x01, 0x08, 0x08, "2" }, + {0x14, 0x01, 0x08, 0x00, "3" }, + + {0 , 0xfe, 0 , 4 , "Time" }, + {0x14, 0x01, 0xc0, 0x40, "30" }, + {0x14, 0x01, 0xc0, 0x80, "50" }, + {0x14, 0x01, 0xc0, 0xc0, "70" }, + {0x14, 0x01, 0xc0, 0x00, "90" }, +}; + +STDDIPINFO(Sdfight) + +static struct BurnDIPInfo BcstryDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0x7f, NULL }, + {0x14, 0xff, 0xff, 0xdf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x13, 0x01, 0x0e, 0x04, "1" }, + {0x13, 0x01, 0x0e, 0x08, "2" }, + {0x13, 0x01, 0x0e, 0x00, "3" }, + {0x13, 0x01, 0x0e, 0x0e, "4" }, + {0x13, 0x01, 0x0e, 0x06, "5" }, + {0x13, 0x01, 0x0e, 0x0a, "6" }, + {0x13, 0x01, 0x0e, 0x02, "7" }, + {0x13, 0x01, 0x0e, 0x0c, "8" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x13, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x40, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Event Selection" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Control Type" }, + {0x14, 0x01, 0x40, 0x40, "Joysticks & Buttons" }, + {0x14, 0x01, 0x40, 0x00, "Buttons" }, + + {0 , 0xfe, 0 , 2 , "Debug Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Bcstry) + +static struct BurnDIPInfo SemibaseDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0x7f, NULL }, + {0x16, 0xff, 0xff, 0xdf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x15, 0x01, 0x0e, 0x04, "1" }, + {0x15, 0x01, 0x0e, 0x08, "2" }, + {0x15, 0x01, 0x0e, 0x00, "3" }, + {0x15, 0x01, 0x0e, 0x0e, "4" }, + {0x15, 0x01, 0x0e, 0x06, "5" }, + {0x15, 0x01, 0x0e, 0x0a, "6" }, + {0x15, 0x01, 0x0e, 0x02, "7" }, + {0x15, 0x01, 0x0e, 0x0c, "8" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x15, 0x01, 0x70, 0x00, "5 Coins 1 Credit" }, + {0x15, 0x01, 0x70, 0x40, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, + {0x15, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "vs CPU Game Ends" }, + {0x16, 0x01, 0x20, 0x20, "+10" }, + {0x16, 0x01, 0x20, 0x00, "+7" }, + + {0 , 0xfe, 0 , 2 , "Vs Game" }, + {0x16, 0x01, 0x40, 0x40, "1 Credit / 2 Innings" }, + {0x16, 0x01, 0x40, 0x00, "1 Credit / 3 Innings" }, + + {0 , 0xfe, 0 , 2 , "Full 2 Players Game" }, + {0x16, 0x01, 0x80, 0x00, "4 Credits" }, + {0x16, 0x01, 0x80, 0x80, "6 Credits" }, +}; + +STDDIPINFO(Semibase) + +static struct BurnDIPInfo DquizgoDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0x7f, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x13, 0x01, 0x0e, 0x04, "1" }, + {0x13, 0x01, 0x0e, 0x08, "2" }, + {0x13, 0x01, 0x0e, 0x00, "3" }, + {0x13, 0x01, 0x0e, 0x0e, "4" }, + {0x13, 0x01, 0x0e, 0x06, "5" }, + {0x13, 0x01, 0x0e, 0x0a, "6" }, + {0x13, 0x01, 0x0e, 0x02, "7" }, + {0x13, 0x01, 0x0e, 0x0c, "8" }, + + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x13, 0x01, 0x70, 0x00, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x40, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x20, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x60, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x70, 0x70, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x70, 0x50, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x70, 0x30, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x70, 0x10, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0xc0, 0x00, "2" }, + {0x14, 0x01, 0xc0, 0xc0, "3" }, + {0x14, 0x01, 0xc0, 0x40, "4" }, + {0x14, 0x01, 0xc0, 0x80, "5" }, +}; + +STDDIPINFO(Dquizgo) + +static struct BurnDIPInfo JumppopDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x11, 0x01, 0xe0, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0xe0, 0x80, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xe0, 0xe0, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" }, + {0x11, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" }, + {0x11, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" }, + {0x11, 0x01, 0xe0, 0xc0, "1 Coin 5 Credits" }, + {0x11, 0x01, 0xe0, 0x40, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x11, 0x01, 0x1c, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x1c, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x1c, 0x1c, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x1c, 0x18, "1 Coin 5 Credits" }, + {0x11, 0x01, 0x1c, 0x08, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x01, 0x01, "Off" }, + {0x12, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Picture Viewer" }, + {0x12, 0x01, 0x04, 0x04, "Off" }, + {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Background Type" }, + {0x12, 0x01, 0x08, 0x08, "1" }, + {0x12, 0x01, 0x08, 0x00, "2" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x30, 0x20, "Easy" }, + {0x12, 0x01, 0x30, 0x30, "Normal" }, + {0x12, 0x01, 0x30, 0x10, "Hard" }, + {0x12, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0xc0, 0x80, "1" }, + {0x12, 0x01, 0xc0, 0x00, "2" }, + {0x12, 0x01, 0xc0, 0xc0, "3" }, + {0x12, 0x01, 0xc0, 0x40, "4" }, +}; + +STDDIPINFO(Jumppop) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = DrvInput[2] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + } + + // Clear Opposites + DrvClearOpposites(&DrvInput[0]); + DrvClearOpposites(&DrvInput[1]); +} + +static struct BurnRomInfo TumblebRomDesc[] = { + { "thumbpop.12", 0x40000, 0x0c984703, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "thumbpop.13", 0x40000, 0x864c4053, BRF_ESS | BRF_PRG }, // 1 + + { "thumbpop.19", 0x40000, 0x0795aab4, BRF_GRA }, // 2 Tiles + { "thumbpop.18", 0x40000, 0xad58df43, BRF_GRA }, // 3 + + { "map-01.rom", 0x80000, 0xe81ffa09, BRF_GRA }, // 4 Sprites + { "map-00.rom", 0x80000, 0x8c879cfe, BRF_GRA }, // 5 + + { "thumbpop.snd", 0x80000, 0xfabbf15d, BRF_SND }, // 6 Samples +}; + +STD_ROM_PICK(Tumbleb) +STD_ROM_FN(Tumbleb) + +static struct BurnRomInfo Tumbleb2RomDesc[] = { + { "thumbpop.2", 0x40000, 0x34b016e1, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "thumbpop.3", 0x40000, 0x89501c71, BRF_ESS | BRF_PRG }, // 1 + + { "thumbpop.19", 0x40000, 0x0795aab4, BRF_GRA }, // 2 Tiles + { "thumbpop.18", 0x40000, 0xad58df43, BRF_GRA }, // 3 + + { "map-01.rom", 0x80000, 0xe81ffa09, BRF_GRA }, // 4 Sprites + { "map-00.rom", 0x80000, 0x8c879cfe, BRF_GRA }, // 5 + + { "thumbpop.snd", 0x80000, 0xfabbf15d, BRF_SND }, // 6 Samples + + { "pic_16c57", 0x02d4c, 0x00000000, BRF_NODUMP }, +}; + +STD_ROM_PICK(Tumbleb2) +STD_ROM_FN(Tumbleb2) + +static struct BurnRomInfo JumpkidsRomDesc[] = { + { "23-ic29.15c", 0x40000, 0x6ba11e91, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "24-ic30.17c", 0x40000, 0x5795d98b, BRF_ESS | BRF_PRG }, // 1 + + { "22-ic19.3c", 0x08000, 0xbd619530, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "30-ic125.15j", 0x40000, 0x44b9a089, BRF_GRA }, // 3 Tiles + { "29-ic124.13j", 0x40000, 0x3f98ec69, BRF_GRA }, // 4 + + { "25-ic69.1g", 0x40000, 0x176ae857, BRF_GRA }, // 5 Sprites + { "28-ic131.1l", 0x40000, 0xed837757, BRF_GRA }, // 6 + { "26-ic70.2g", 0x40000, 0xe8b34980, BRF_GRA }, // 7 + { "27-ic100.1j", 0x40000, 0x3918dda3, BRF_GRA }, // 8 + + { "21-ic17.1c", 0x80000, 0xe5094f75, BRF_SND }, // 9 Samples + { "ic18.2c", 0x20000, 0xa63736c3, BRF_SND }, // 10 +}; + +STD_ROM_PICK(Jumpkids) +STD_ROM_FN(Jumpkids) + +static struct BurnRomInfo MetlsavrRomDesc[] = { + { "first-4.ub17", 0x40000, 0x667a494d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "first-3.ub18", 0x40000, 0x87bf4ed2, BRF_ESS | BRF_PRG }, // 1 + + { "first-2.ua7", 0x10000, 0x49505edf, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "protdata.bin", 0x00200, 0x17aa17a9, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data + + { "first-5.rom5", 0x40000, 0xdd4af746, BRF_GRA }, // 4 Tiles + { "first-6.rom6", 0x40000, 0x808b0e0b, BRF_GRA }, // 5 + + { "first-7.uor1", 0x80000, 0xa6816747, BRF_GRA }, // 6 Sprites + { "first-8.uor2", 0x80000, 0x377020e5, BRF_GRA }, // 7 + { "first-9.uor3", 0x80000, 0xfccf1bb7, BRF_GRA }, // 8 + { "first-10.uor4", 0x80000, 0xa22b587b, BRF_GRA }, // 9 + + { "first-1.uc1", 0x40000, 0xe943dacb, BRF_SND }, // 10 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 11 +}; + +STD_ROM_PICK(Metlsavr) +STD_ROM_FN(Metlsavr) + +static struct BurnRomInfo PangpangRomDesc[] = { + { "2.bin", 0x40000, 0x45436666, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "3.bin", 0x40000, 0x2725cbe7, BRF_ESS | BRF_PRG }, // 1 + + { "11.bin", 0x40000, 0xa2b9fec8, BRF_GRA }, // 2 Tiles + { "10.bin", 0x40000, 0x4f59d7b9, BRF_GRA }, // 3 + { "6.bin", 0x40000, 0x1ebbc4f1, BRF_GRA }, // 4 + { "7.bin", 0x40000, 0xcd544173, BRF_GRA }, // 5 + + { "8.bin", 0x40000, 0xea0fa1e0, BRF_GRA }, // 6 Sprites + { "9.bin", 0x40000, 0x1da5fe49, BRF_GRA }, // 7 + { "4.bin", 0x40000, 0x4f282eb1, BRF_GRA }, // 8 + { "5.bin", 0x40000, 0x00694df9, BRF_GRA }, // 9 + + { "1.bin", 0x80000, 0xe722bb02, BRF_SND }, // 10 Samples + + { "pic_16c57", 0x02d4c, 0x1ca515b4, BRF_OPT }, +}; + +STD_ROM_PICK(Pangpang) +STD_ROM_FN(Pangpang) + +static struct BurnRomInfo SuprtrioRomDesc[] = { + { "rom2", 0x40000, 0x4102e59d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "rom1", 0x40000, 0xcc3a83c3, BRF_ESS | BRF_PRG }, // 1 + + { "rom4l", 0x10000, 0x466aa96d, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "rom4", 0x80000, 0xcd2dfae4, BRF_GRA }, // 3 Tiles + { "rom5", 0x80000, 0x4e64da64, BRF_GRA }, // 4 + + { "rom9l", 0x40000, 0xcc45f437, BRF_GRA }, // 5 Sprites + { "rom8l", 0x40000, 0x9bc90169, BRF_GRA }, // 6 + { "rom7l", 0x40000, 0xbfc7c756, BRF_GRA }, // 7 + { "rom6l", 0x40000, 0xbb3499af, BRF_GRA }, // 8 + + { "rom3h", 0x80000, 0x34ea7ec9, BRF_SND }, // 9 Samples + { "rom3l", 0x20000, 0x1b73233b, BRF_SND }, // 10 +}; + +STD_ROM_PICK(Suprtrio) +STD_ROM_FN(Suprtrio) + +static struct BurnRomInfo HtchctchRomDesc[] = { + { "p04.b17", 0x20000, 0x6991483a, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "p03.b16", 0x20000, 0xeff14c40, BRF_ESS | BRF_PRG }, // 1 + + { "p02.b5", 0x10000, 0xc5a03186, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "protdata.bin", 0x00200, 0x5b27adb6, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data + + { "p06srom5.bin", 0x40000, 0x3d2cbb0d, BRF_GRA }, // 4 Tiles + { "p07srom6.bin", 0x40000, 0x0207949c, BRF_GRA }, // 5 + + { "p08uor1.bin", 0x20000, 0x6811e7b6, BRF_GRA }, // 6 Sprites + { "p09uor2.bin", 0x20000, 0x1c6549cf, BRF_GRA }, // 7 + { "p10uor3.bin", 0x20000, 0x6462e6e0, BRF_GRA }, // 8 + { "p11uor4.bin", 0x20000, 0x9c511d98, BRF_GRA }, // 9 + + { "p01.c1", 0x20000, 0x18c06829, BRF_SND }, // 10 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 11 +}; + +STD_ROM_PICK(Htchctch) +STD_ROM_FN(Htchctch) + +static struct BurnRomInfo CookbibRomDesc[] = { + { "prg2.ub17", 0x20000, 0x2664a335, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "prg1.ub16", 0x20000, 0xcda6335f, BRF_ESS | BRF_PRG }, // 1 + + { "prg-s.ub5", 0x10000, 0x547d6ea3, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "protdata.bin", 0x00200, 0xa77d13f4, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data + + { "srom5.bin", 0x40000, 0x73a46e43, BRF_GRA }, // 4 Tiles + { "srom6.bin", 0x40000, 0xade2dbec, BRF_GRA }, // 5 + + { "uor1.bin", 0x20000, 0xa7d91f23, BRF_GRA }, // 6 Sprites + { "uor2.bin", 0x20000, 0x9aacbec2, BRF_GRA }, // 7 + { "uor3.bin", 0x20000, 0x3fee0c3c, BRF_GRA }, // 8 + { "uor4.bin", 0x20000, 0xbed9ed2d, BRF_GRA }, // 9 + + { "sound.uc1", 0x20000, 0x545e19b6, BRF_SND }, // 10 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 11 +}; + +STD_ROM_PICK(Cookbib) +STD_ROM_FN(Cookbib) + +static struct BurnRomInfo ChokchokRomDesc[] = { + { "ub17.bin", 0x40000, 0xecdb45ca, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ub18.bin", 0x40000, 0xb183852a, BRF_ESS | BRF_PRG }, // 1 + + { "ub5.bin", 0x10000, 0x30c2171d, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "protdata.bin", 0x00200, 0x0bd39834, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data + + { "srom5.bin", 0x80000, 0x836608b8, BRF_GRA }, // 4 Tiles + { "srom6.bin", 0x80000, 0x31d5715d, BRF_GRA }, // 5 + + { "uor1.bin", 0x80000, 0xded6642a, BRF_GRA }, // 6 Sprites + { "uor2.bin", 0x80000, 0x493f9516, BRF_GRA }, // 7 + { "uor3.bin", 0x80000, 0xe2dc3e12, BRF_GRA }, // 8 + { "uor4.bin", 0x80000, 0x6f377530, BRF_GRA }, // 9 + + { "uc1.bin", 0x40000, 0xf3f57abd, BRF_SND }, // 10 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 11 +}; + +STD_ROM_PICK(Chokchok) +STD_ROM_FN(Chokchok) + +static struct BurnRomInfo WlstarRomDesc[] = { + { "n-4.u817", 0x40000, 0xfc3e829b, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "n-3.u818", 0x40000, 0xf01bc623, BRF_ESS | BRF_PRG }, // 1 + + { "ua7", 0x10000, 0x90cafa5f, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + +#if !defined (ROM_VERIFY) + { "protdata.bin", 0x00200, 0xb7ffde5b, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data +#else + { "87c52.mcu", 0x02000, 0xab5e2a7e, BRF_ESS | BRF_PRG }, // 3 MCU Program Code +#endif + + { "5.srom5", 0x80000, 0xf7f8c859, BRF_GRA }, // 4 Tiles + { "6.srom6", 0x80000, 0x34ace2a8, BRF_GRA }, // 5 + + { "7.udr1", 0x80000, 0x6e47c31d, BRF_GRA }, // 6 Sprites + { "8.udr2", 0x80000, 0x09c5d57c, BRF_GRA }, // 7 + { "9.udr3", 0x80000, 0x3ec064f0, BRF_GRA }, // 8 + { "10.udr4", 0x80000, 0xb4693cdd, BRF_GRA }, // 9 + + { "ua1", 0x40000, 0xde217d30, BRF_SND }, // 10 Samples +}; + +STD_ROM_PICK(Wlstar) +STD_ROM_FN(Wlstar) + +static struct BurnRomInfo Wondl96RomDesc[] = { + { "ub17.bin", 0x40000, 0x41d8e03c, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ub18.bin", 0x40000, 0x0e4963af, BRF_ESS | BRF_PRG }, // 1 + + { "ub5.bin", 0x10000, 0xd99d19c4, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + +#if !defined (ROM_VERIFY) + { "protdata.bin", 0x00200, 0xd7578b1e, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data +#else + { "87c52.mcu", 0x02000, 0x6f4c659a, BRF_ESS | BRF_PRG }, // 3 MCU Program Code +#endif + + { "srom5.bin", 0x80000, 0xdb8010c3, BRF_GRA }, // 4 Tiles + { "srom6.bin", 0x80000, 0x2f364e54, BRF_GRA }, // 5 + + { "uor1.bin", 0x80000, 0xe1e9eebb, BRF_GRA }, // 6 Sprites + { "uor2.bin", 0x80000, 0xddebfe83, BRF_GRA }, // 7 + { "uor3.bin", 0x80000, 0x7efe4d67, BRF_GRA }, // 8 + { "uor4.bin", 0x80000, 0x7b1596d1, BRF_GRA }, // 9 + + { "uc1.bin", 0x40000, 0x0e7913e6, BRF_SND }, // 10 Samples +}; + +STD_ROM_PICK(Wondl96) +STD_ROM_FN(Wondl96) + +static struct BurnRomInfo FncywldRomDesc[] = { + { "01_fw02.bin", 0x80000, 0xecb978c1, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "02_fw03.bin", 0x80000, 0x2d233b42, BRF_ESS | BRF_PRG }, // 1 + + { "08_fw09.bin", 0x40000, 0xa4a00de9, BRF_GRA }, // 2 Tiles + { "07_fw08.bin", 0x40000, 0xb48cd1d4, BRF_GRA }, // 3 + { "10_fw11.bin", 0x40000, 0xf21bab48, BRF_GRA }, // 4 + { "09_fw10.bin", 0x40000, 0x6aea8e0f, BRF_GRA }, // 5 + + { "05_fw06.bin", 0x40000, 0xe141ecdc, BRF_GRA }, // 6 Sprites + { "06_fw07.bin", 0x40000, 0x0058a812, BRF_GRA }, // 7 + { "03_fw04.bin", 0x40000, 0x6ad38c14, BRF_GRA }, // 8 + { "04_fw05.bin", 0x40000, 0xb8d079a6, BRF_GRA }, // 9 + + { "00_fw01.bin", 0x40000, 0xb395fe01, BRF_SND }, // 10 Samples +}; + +STD_ROM_PICK(Fncywld) +STD_ROM_FN(Fncywld) + +static struct BurnRomInfo SdfightRomDesc[] = { + { "u817", 0x80000, 0x9f284f4d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "u818", 0x80000, 0xa60e5b22, BRF_ESS | BRF_PRG }, // 1 + + { "ua7", 0x10000, 0xc3d36da4, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "protdata.bin", 0x00200, 0xefb8b822, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data + + { "9.ug11", 0x80000, 0xbf809ccd, BRF_GRA }, // 4 Tiles + { "10.ug12", 0x80000, 0xa5a3bfa2, BRF_GRA }, // 5 + { "15.ui11", 0x80000, 0x3bc8aa6d, BRF_GRA }, // 6 + { "16.ui12", 0x80000, 0x71e6b78d, BRF_GRA }, // 7 + + { "11.uk2", 0x80000, 0xd006fadc, BRF_GRA }, // 8 Sprites + { "12.uk3", 0x80000, 0x2a2f4153, BRF_GRA }, // 9 + { "5.uj2", 0x80000, 0xf1246cbf, BRF_GRA }, // 10 + { "6.uj3", 0x80000, 0xd346878c, BRF_GRA }, // 11 + { "13.uk4", 0x80000, 0x9bc40774, BRF_GRA }, // 12 + { "14.uk5", 0x80000, 0xa1e61674, BRF_GRA }, // 13 + { "7.uj4", 0x80000, 0xdbdece8a, BRF_GRA }, // 14 + { "8.uj5", 0x80000, 0x60be7dd1, BRF_GRA }, // 15 + + { "uc1", 0x40000, 0x535cae2c, BRF_SND }, // 16 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 17 +}; + +STD_ROM_PICK(Sdfight) +STD_ROM_FN(Sdfight) + +static struct BurnRomInfo BcstryRomDesc[] = { + { "bcstry_u.62", 0x40000, 0x7f7aa244, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "bcstry_u.35", 0x40000, 0xd25b80a4, BRF_ESS | BRF_PRG }, // 1 + + { "bcstry_u.21", 0x10000, 0x3ba072d4, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "protdata.bin", 0x00200, 0xe84e328c, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data + + { "bcstry_u.109", 0x80000, 0xeb04d37a, BRF_GRA }, // 4 Tiles + { "bcstry_u.113", 0x80000, 0x746ecdd7, BRF_GRA }, // 5 + { "bcstry_u.110", 0x80000, 0x1bfe65c3, BRF_GRA }, // 6 + { "bcstry_u.111", 0x80000, 0xc8bf3a3c, BRF_GRA }, // 7 + + { "bcstry_u.100", 0x80000, 0x8c11cbed, BRF_GRA }, // 8 Sprites + { "bcstry_u.106", 0x80000, 0x5219bcbf, BRF_GRA }, // 9 + { "bcstry_u.99", 0x80000, 0xcdb1af87, BRF_GRA }, // 10 + { "bcstry_u.105", 0x80000, 0x8166b596, BRF_GRA }, // 11 + { "bcstry_u.104", 0x80000, 0x377c0c71, BRF_GRA }, // 12 + { "bcstry_u.108", 0x80000, 0x442307ed, BRF_GRA }, // 13 + { "bcstry_u.102", 0x80000, 0x71b40ece, BRF_GRA }, // 14 + { "bcstry_u.107", 0x80000, 0xab3c923a, BRF_GRA }, // 15 + + { "bcstry_u.64", 0x40000, 0x23f0e0fe, BRF_SND }, // 16 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 17 +}; + +STD_ROM_PICK(Bcstry) +STD_ROM_FN(Bcstry) + +static struct BurnRomInfo BcstryaRomDesc[] = { + { "prg2.ic62", 0x40000, 0xf54c0a96, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "prg1.ic35", 0x40000, 0x2c55100a, BRF_ESS | BRF_PRG }, // 1 + + { "bcstry_u.21", 0x10000, 0x3ba072d4, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "protdata.bin", 0x00200, 0xe84e328c, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data + + { "bcstry_u.109", 0x80000, 0xeb04d37a, BRF_GRA }, // 4 Tiles + { "bcstry_u.113", 0x80000, 0x746ecdd7, BRF_GRA }, // 5 + { "bcstry_u.110", 0x80000, 0x1bfe65c3, BRF_GRA }, // 6 + { "bcstry_u.111", 0x80000, 0xc8bf3a3c, BRF_GRA }, // 7 + + { "bcstry_u.100", 0x80000, 0x8c11cbed, BRF_GRA }, // 8 Sprites + { "bcstry_u.106", 0x80000, 0x5219bcbf, BRF_GRA }, // 9 + { "bcstry_u.99", 0x80000, 0xcdb1af87, BRF_GRA }, // 10 + { "bcstry_u.105", 0x80000, 0x8166b596, BRF_GRA }, // 11 + { "bcstry_u.104", 0x80000, 0x377c0c71, BRF_GRA }, // 12 + { "bcstry_u.108", 0x80000, 0x442307ed, BRF_GRA }, // 13 + { "bcstry_u.102", 0x80000, 0x71b40ece, BRF_GRA }, // 14 + { "bcstry_u.107", 0x80000, 0xab3c923a, BRF_GRA }, // 15 + + { "bcstry_u.64", 0x40000, 0x23f0e0fe, BRF_SND }, // 16 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 17 +}; + +STD_ROM_PICK(Bcstrya) +STD_ROM_FN(Bcstrya) + +static struct BurnRomInfo SemibaseRomDesc[] = { + { "ic62.68k", 0x40000, 0x85ea81c3, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ic35.68k", 0x40000, 0xd2249605, BRF_ESS | BRF_PRG }, // 1 + + { "ic21.z80", 0x10000, 0xd95c64d0, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "protdata.bin", 0x00200, 0xecbf2163, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data + + { "ic109.gfx", 0x80000, 0x2b86e983, BRF_GRA }, // 4 Tiles + { "ic113.gfx", 0x80000, 0xe39b6610, BRF_GRA }, // 5 + { "ic110.gfx", 0x80000, 0xbba4a015, BRF_GRA }, // 6 + { "ic111.gfx", 0x80000, 0x61133b63, BRF_GRA }, // 7 + + { "ic100.gfx", 0x80000, 0x01c3d12a, BRF_GRA }, // 8 Sprites + { "ic106.gfx", 0x80000, 0xdb282ac2, BRF_GRA }, // 9 + { "ic99.gfx", 0x80000, 0x349df821, BRF_GRA }, // 10 + { "ic105.gfx", 0x80000, 0xf7caa81c, BRF_GRA }, // 11 + { "ic104.gfx", 0x80000, 0x51a5d38a, BRF_GRA }, // 12 + { "ic108.gfx", 0x80000, 0xb253d60e, BRF_GRA }, // 13 + { "ic102.gfx", 0x80000, 0x3caefe97, BRF_GRA }, // 14 + { "ic107.gfx", 0x80000, 0x68109898, BRF_GRA }, // 15 + + { "ic64.snd", 0x40000, 0x8a60649c, BRF_SND }, // 16 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 17 +}; + +STD_ROM_PICK(Semibase) +STD_ROM_FN(Semibase) + +static struct BurnRomInfo DquizgoRomDesc[] = { + { "ub17", 0x80000, 0x0b96ab14, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "ub18", 0x80000, 0x07f869f2, BRF_ESS | BRF_PRG }, // 1 + + { "ub5", 0x10000, 0xe40481da, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "protdata.bin", 0x00200, 0x6064b9e0, BRF_ESS | BRF_PRG }, // 3 Shared RAM Data + + { "srom5", 0x80000, 0xf1cdd21d, BRF_GRA }, // 4 Tiles + { "srom6", 0x80000, 0xf848939e, BRF_GRA }, // 5 + + { "uor1", 0x80000, 0xb4912bf6, BRF_GRA }, // 6 Sprites + { "uor2", 0x80000, 0xb011cf93, BRF_GRA }, // 7 + { "uor3", 0x80000, 0xd96c3582, BRF_GRA }, // 8 + { "uor4", 0x80000, 0x77ff23eb, BRF_GRA }, // 9 + + { "uc1", 0x40000, 0xd0f4c4ba, BRF_SND }, // 10 Samples + + { "87c52.mcu", 0x10000, 0x00000000, BRF_NODUMP }, // 11 +}; + +STD_ROM_PICK(Dquizgo) +STD_ROM_FN(Dquizgo) + +static struct BurnRomInfo JumppopRomDesc[] = { + { "68k_prg.bin", 0x080000, 0x123536b9, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + + { "z80_prg.bin", 0x040000, 0xa88d4424, BRF_ESS | BRF_PRG }, // 1 Z80 Program Code + + { "bg0.bin", 0x100000, 0x35a1363d, BRF_GRA }, // 2 Tiles + { "bg1.bin", 0x100000, 0x5b37f943, BRF_GRA }, // 3 + + { "sp0.bin", 0x100000, 0x7c5d0633, BRF_GRA }, // 4 Sprites + { "sp1.bin", 0x100000, 0x7eae782e, BRF_GRA }, // 5 + + { "samples.bin", 0x040000, 0x066f30a7, BRF_SND }, // 6 Samples +}; + +STD_ROM_PICK(Jumppop) +STD_ROM_FN(Jumppop) + +static struct BurnRomInfo JumppopeRomDesc[] = { + { "esd2.cu02", 0x040000, 0x302dd093, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "esd1.cu03", 0x040000, 0x883392ba, BRF_ESS | BRF_PRG }, // 1 + + { "at27c020.su06", 0x040000, 0xa88d4424, BRF_ESS | BRF_PRG }, // 2 Z80 Program Code + + { "esd7.ju03", 0x040000, 0x9c2970e0, BRF_GRA }, // 3 Tiles + { "esd8.ju04", 0x040000, 0x33bf99b0, BRF_GRA }, // 4 + { "esd9.ju05", 0x040000, 0x671d21fd, BRF_GRA }, // 5 + { "esd10.ju06", 0x040000, 0x85a3cc73, BRF_GRA }, // 6 + + { "esd5.fu28", 0x080000, 0x0d47f821, BRF_GRA }, // 7 Sprites + { "esd6.fu29", 0x080000, 0xc01af40d, BRF_GRA }, // 8 + { "esd4.fu26", 0x080000, 0x97b409be, BRF_GRA }, // 9 + { "esd3.fu27", 0x080000, 0x3358a693, BRF_GRA }, // 10 + + { "at27c020.su10", 0x040000, 0x066f30a7, BRF_SND }, // 11 Samples +}; + +STD_ROM_PICK(Jumppope) +STD_ROM_FN(Jumppope) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x100000; + if (DrvHasZ80)DrvZ80Rom = Next; Next += 0x010000; + if (DrvHasProt) DrvProtData = Next; Next += 0x000200; + MSM6295ROM = Next; Next += 0x040000; + DrvMSM6295ROMSrc = Next; Next += 0x100000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x010800; + if (DrvHasZ80)DrvZ80Ram = Next; Next += 0x000800; + DrvSpriteRam = Next; Next += DrvSpriteRamSize; + DrvPf1Ram = Next; Next += 0x002000; + DrvPf2Ram = Next; Next += 0x002000; + DrvPaletteRam = Next; Next += 0x001000; + DrvControl = (UINT16*)Next; Next += 8 * sizeof(UINT16); + + RamEnd = Next; + + DrvChars = Next; Next += DrvNumChars * 8 * 8; + DrvTiles = Next; Next += DrvNumTiles * 16 * 16; + DrvSprites = Next; Next += DrvNumSprites * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 JumppopMemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x080000; + DrvZ80Rom = Next; Next += 0x040000; + MSM6295ROM = Next; Next += 0x040000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x0c0000; + DrvZ80Ram = Next; Next += 0x000800; + DrvSpriteRam = Next; Next += DrvSpriteRamSize; + DrvPf1Ram = Next; Next += 0x004000; + DrvPf2Ram = Next; Next += 0x004000; + DrvPaletteRam = Next; Next += 0x000800; + DrvControl = (UINT16*)Next; Next += 8 * sizeof(UINT16); + + RamEnd = Next; + + DrvChars = Next; Next += DrvNumChars * 8 * 8; + DrvTiles = Next; Next += DrvNumTiles * 16 * 16; + DrvSprites = Next; Next += DrvNumSprites * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + if (DrvHasProt == 1) memcpy(Drv68KRam + 0x000, DrvProtData, 0x200); + if (DrvHasProt == 2) memcpy(Drv68KRam + 0x200, DrvProtData, 0x200); + + SekOpen(0); + SekReset(); + SekClose(); + + if (DrvHasZ80) { + ZetOpen(0); + ZetReset(); + ZetClose(); + } + + if (DrvHasYM2151) BurnYM2151Reset(); + if (DrvHasYM3812) BurnYM3812Reset(); + + MSM6295Reset(0); + + DrvVBlank = 0; + DrvOkiBank = 0; + DrvTileBank = 0; + DrvSoundLatch = 0; + Tumbleb2MusicCommand = 0; + Tumbleb2MusicBank = 0; + Tumbleb2MusicIsPlaying = 0; + memset(DrvControl, 0, 8); + + return 0; +} + +static const INT32 Tumbleb2SoundLookup[256] = { + /*0 1 2 3 4 5 6 7 8 9 a b c d e f*/ + 0x00, -2, 0x00, 0x00, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 0x00, -2, /* 0 */ + -2, 0x00, -2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, /* 2 */ + 0x19, 0x00, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 3 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, /* 4 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 5 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* f */ +}; + +static void Tumbleb2PlayMusic() +{ + INT32 Status = MSM6295ReadStatus(0); + + if (Tumbleb2MusicIsPlaying) + { + if ((Status & 0x08) == 0) { + MSM6295Command(0, 0x80 | Tumbleb2MusicCommand); + MSM6295Command(0, 0x00 | 0x82); + } + } +} + +static void Tumbleb2SetMusicBank(INT32 Bank) +{ + memcpy(MSM6295ROM + 0x38000, DrvMSM6295ROMSrc + 0x38000 + (Bank * 0x8000), 0x8000); +} + +static void Tumbleb2PlaySound(UINT16 data) +{ + INT32 Status = MSM6295ReadStatus(0); + + if ((Status & 0x01) == 0) { + MSM6295Command(0, 0x80 | data); + MSM6295Command(0, 0x00 | 0x12); + } else { + if ((Status & 0x02) == 0) { + MSM6295Command(0, 0x80 | data); + MSM6295Command(0, 0x00 | 0x22); + } else { + if ((Status & 0x04) == 0) { + MSM6295Command(0, 0x80 | data); + MSM6295Command(0, 0x00 | 0x42); + } + } + } +} + +static void Tumbleb2ProcessMusicCommand(UINT16 data) +{ + INT32 Status = MSM6295ReadStatus(0); + + if (data == 1) { + if ((Status & 0x08) == 0x08) { + MSM6295Command(0, 0x40); + Tumbleb2MusicIsPlaying = 0; + } + } else { + if (Tumbleb2MusicIsPlaying != data) { + Tumbleb2MusicIsPlaying = data; + + MSM6295Command(0, 0x40); + + switch (data) { + case 0x04: // map screen + Tumbleb2MusicBank = 1; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x05: // america + Tumbleb2MusicBank = 6; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x06: // asia + Tumbleb2MusicBank = 2; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x07: // africa/egypt -- don't seem to have a tune for this one + Tumbleb2MusicBank = 4; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x08: // antartica + Tumbleb2MusicBank = 3; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x09: // brazil / south america + Tumbleb2MusicBank = 4; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x0a: // japan -- don't seem to have a tune + Tumbleb2MusicBank = 2; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x0b: // australia + Tumbleb2MusicBank = 5; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x0c: // france/europe + Tumbleb2MusicBank = 6; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x0d: // how to play + Tumbleb2MusicBank = 7; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x0f: // stage clear + Tumbleb2MusicBank = 0; + Tumbleb2MusicCommand = 0x33; + break; + + case 0x10: // boss stage + Tumbleb2MusicBank = 8; + Tumbleb2MusicCommand = 0x38; + break; + + case 0x12: // world clear + Tumbleb2MusicBank = 0; + Tumbleb2MusicCommand = 0x34; + break; + + default: // anything else.. + Tumbleb2MusicBank = 8; + Tumbleb2MusicCommand = 0x38; + break; + } + + Tumbleb2SetMusicBank(Tumbleb2MusicBank); + Tumbleb2PlayMusic(); + } + } +} + +static void Tumbleb2SoundMCUCommand(UINT16 data) +{ + INT32 Sound = Tumbleb2SoundLookup[data & 0xff]; + + if (Sound == 0) { + + } else { + if (Sound == -2) { + Tumbleb2ProcessMusicCommand(data); + } else { + Tumbleb2PlaySound(Sound); + } + } +} + +UINT8 __fastcall Tumbleb68KReadByte(UINT32 a) +{ + switch (a) { + case 0x100001: { + return ~0; + } + + case 0x180002: { + return DrvDip[1]; + } + + case 0x180003: { + return DrvDip[0]; + } + + case 0x180009: { + if (Semibase) return 0xff - DrvInput[2]; + if (DrvVBlank) { + if (Wondl96) { + return 0xf3 - DrvInput[2]; + } else { + return 0xf7 - DrvInput[2]; + } + } + if (Wondl96) return 0xfb - DrvInput[2]; + return 0xff - DrvInput[2]; + } + + case 0x18000a: { + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Tumbleb68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x100000: { + if (Tumbleb2) { + Tumbleb2SoundMCUCommand(d); + return; + } else { + MSM6295Command(0, d); + return; + } + } + + case 0x100001: { + if (SemicomSoundCommand) DrvSoundLatch = d; + return; + } + + case 0x100002: { + if (Chokchok) DrvTileBank = (d << 8) << 1; + if (Bcstry) DrvTileBank = d << 8; + return; + } + + case 0x100003: { + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Tumbleb68KReadWord(UINT32 a) +{ + switch (a) { + case 0x100004: { + return rand() % 0x10000; + } + + case 0x180000: { + return ((0xff - DrvInput[1]) << 8) | (0xff - DrvInput[0]); + } + + case 0x180002: { + return (DrvDip[1] << 8) | DrvDip[0]; + } + + case 0x180004: { + return -0; + } + + case 0x180006: { + return -0; + } + + case 0x180008: { + if (Bcstry && (SekGetPC(0) == 0x560)) { + return 0x1a0; + } else { + if (Semibase) return 0xffff - DrvInput[2]; + if (DrvVBlank) { + if (Wondl96) { + return 0xfff3 - DrvInput[2]; + } else { + return 0xfff7 - DrvInput[2]; + } + } + } + if (Wondl96) return 0xfff3 - DrvInput[2]; + return 0xffff - DrvInput[2]; + } + + case 0x18000a: { + return 0; + } + + case 0x18000c: { + return 0; + } + + case 0x18000e: { + return -0; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Tumbleb68KWriteWord(UINT32 a, UINT16 d) +{ +#if 1 && defined FBA_DEBUG + if (a >= 0x160800 && a <= 0x160807) return; + if (a >= 0x198000 && a <= 0x1a8015) return; + if (a >= 0x321000 && a <= 0x321fff) return; + if (a >= 0x323000 && a <= 0x331fff) return; + if (a >= 0x340000 && a <= 0x3401ff) return; + if (a >= 0x340400 && a <= 0x34047f) return; + if (a >= 0x342000 && a <= 0x3421ff) return; + if (a >= 0x342400 && a <= 0x34247f) return; +#endif + + if (a >= 0x300000 && a <= 0x30000f) { + DrvControl[(a - 0x300000) >> 1] = d; + return; + } + + switch (a) { + case 0x100000: { + if (Tumbleb2) { + Tumbleb2SoundMCUCommand(d); + return; + } else { + if (Jumpkids) { + DrvSoundLatch = d & 0xff; + ZetOpen(0); + ZetRaiseIrq(0); + ZetClose(); + return; + } else { + if (SemicomSoundCommand) { + if (d & 0xff) DrvSoundLatch = d & 0xff; + return; + } else { + MSM6295Command(0, d & 0xff); + return; + } + } + } + } + + case 0x100002: { + if (Wlstar) DrvTileBank = d & 0x4000; + return; + } + + case 0x18000c: { + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT16 __fastcall Suprtrio68KReadWord(UINT32 a) +{ + switch (a) { + case 0xe00000: { + return ((0xff - DrvInput[1]) << 8) | (0xff - DrvInput[0]); + } + + case 0xe40000: { + return 0xffff - DrvInput[2]; + } + + case 0xe80002: { + return 0xff00 | DrvDip[0]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Suprtrio68KWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0xa00000 && a <= 0xa0000f) { + DrvControl[(a - 0xa00000) >> 1] = d; + return; + } + + switch (a) { + case 0xe00000: { + DrvTileBank = d << 14; + return; + } + + case 0xec0000: { + if (SemicomSoundCommand) { + if (d & 0xff) DrvSoundLatch = d & 0xff; + } + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Fncywld68KReadByte(UINT32 a) +{ + switch (a) { + case 0x100003: { + return 0; + } + + case 0x100005: { + return MSM6295ReadStatus(0); + } + + case 0x180002: { + return DrvDip[1]; + } + + case 0x180005: { + return -0; + } + + case 0x180009: { + if (DrvVBlank) return 0xf7 - DrvInput[2]; + return 0xff - DrvInput[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Fncywld68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x100001: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x100003: { + BurnYM2151WriteRegister(d); + return; + } + + case 0x100005: { + MSM6295Command(0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Fncywld68KReadWord(UINT32 a) +{ + switch (a) { + case 0x180000: { + return ((0xff - DrvInput[1]) << 8) | (0xff - DrvInput[0]); + } + + case 0x180002: { + return (DrvDip[1] << 8) | DrvDip[0]; + } + + case 0x180004: { + return -0; + } + + case 0x180006: { + return -0; + } + + case 0x180008: { + if (DrvVBlank) return 0xfff7 - DrvInput[2]; + return 0xffff - DrvInput[2]; + } + + case 0x18000a: { + return 0; + } + + case 0x18000c: { + return 0; + } + + case 0x18000e: { + return -0; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Fncywld68KWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x160800 && a <= 0x160807) return; + + if (a >= 0x300000 && a <= 0x30000f) { + DrvControl[(a - 0x300000) >> 1] = d; + return; + } + + switch (a) { + case 0x100000: { + BurnYM2151SelectRegister(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT16 __fastcall Jumppop68KReadWord(UINT32 a) +{ + switch (a) { + case 0x180002: { + return ((0xff - DrvInput[1]) << 8) | (0xff - DrvInput[0]); + } + + case 0x180004: { + return 0xffff - DrvInput[2]; + } + + case 0x180006: { + return (DrvDip[1] << 8) | DrvDip[0]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Jumppop68KWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x380000 && a <= 0x38000f) { + DrvControl[(a - 0x380000) >> 1] = d; + return; + } + + switch (a) { + case 0x180000: { + // NOP + return; + } + + case 0x18000c: { + DrvSoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + + case 0x180008: + case 0x18000a: { + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall JumpkidsZ80Read(UINT16 a) +{ + switch (a) { + case 0x9800: { + return MSM6295ReadStatus(0); + } + + case 0xa000: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall JumpkidsZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x9000: { + DrvOkiBank = d & 3; + memcpy(MSM6295ROM + 0x20000, DrvMSM6295ROMSrc + (DrvOkiBank * 0x20000), 0x20000); + return; + } + + case 0x9800: { + MSM6295Command(0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall SemicomZ80Read(UINT16 a) +{ + switch (a) { + case 0xf001: { + return BurnYM2151ReadStatus(); + } + + case 0xf002: { + return MSM6295ReadStatus(0); + } + + case 0xf008: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall SemicomZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xf000: { + BurnYM2151SelectRegister(d); + return; + } + + case 0xf001: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xf002: { + MSM6295Command(0, d); + return; + } + + case 0xf006: { + return; + } + + case 0xf00e: { + DrvOkiBank = d; + memcpy(MSM6295ROM + 0x30000, DrvMSM6295ROMSrc + 0x30000 + (DrvOkiBank * 0x10000), 0x10000); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall JumppopZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x02: { + return MSM6295ReadStatus(0); + } + + case 0x03: { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return DrvSoundLatch; + } + + case 0x06: { + // NOP + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Read -> %02X\n"), a); + } + } + + return 0; +} + +void __fastcall JumppopZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + BurnYM3812Write(0, d); + return; + } + + case 0x01: { + BurnYM3812Write(1, d); + return; + } + + case 0x02: { + MSM6295Command(0, d); + return; + } + + case 0x04: { + // NOP + return; + } + + case 0x05: { + DrvZ80Bank = d; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + (DrvZ80Bank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + (DrvZ80Bank * 0x4000)); + return; + } + + case 0x06: { + // NOP + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Port Write -> %02X, %02x\n"), a, d); + } + } +} + +static INT32 CharPlaneOffsets[4] = { 0x200008, 0x200000, 8, 0 }; +static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 CharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; +static INT32 SpritePlaneOffsets[4] = { 0x400008, 0x400000, 8, 0 }; +static INT32 Sprite2PlaneOffsets[4] = { 0x800008, 0x800000, 8, 0 }; +static INT32 Sprite3PlaneOffsets[4] = { 0x1000008, 0x1000000, 8, 0 }; +static INT32 SpriteXOffsets[16] = { 256, 257, 258, 259, 260, 261, 262, 263, 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; +static INT32 SuprtrioPlaneOffsets[4] = { 0x400000, 0, 0x600000, 0x200000 }; +static INT32 SuprtrioXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 SuprtrioYOffsets[16] = { 8, 0, 16, 24, 40, 32, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; +static INT32 JpCharPlaneOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 JpCharXOffsets[8] = { 0x800000, 0x800008, 0, 8, 0x800010, 0x800018, 16, 24 }; +static INT32 JpCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 JpeCharPlaneOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 JpeCharXOffsets[8] = { 0, 16, 8, 24, 32, 48, 40, 56 }; +static INT32 JpeCharYOffsets[8] = { 0, 64, 128, 192, 256, 320, 384, 448 }; +static INT32 JpTilePlaneOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 JpTileXOffsets[16] = { 0x800000, 0x800008, 0, 8, 0x800010, 0x800018, 16, 24, 0x800100, 0x800108, 256, 264, 0x800110, 0x800118, 272, 280 }; +static INT32 JpTileYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; +static INT32 JpeTilePlaneOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 JpeTileXOffsets[16] = { 0, 16, 8, 24, 32, 48, 40, 56, 512, 528, 520, 536, 544, 560, 552, 568 }; +static INT32 JpeTileYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472 }; + +static void TumblebTilesRearrange() +{ + UINT8 *rom = DrvTempRom; + INT32 len = DrvNumTiles * 128; + INT32 i; + + /* gfx data is in the wrong order */ + for (i = 0;i < len;i++) + { + if ((i & 0x20) == 0) + { + INT32 t = rom[i]; rom[i] = rom[i + 0x20]; rom[i + 0x20] = t; + } + } + /* low/high half are also swapped */ + for (i = 0;i < len/2;i++) + { + INT32 t = rom[i]; rom[i] = rom[i + len/2]; rom[i + len/2] = t; + } +} + +static INT32 TumblebLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 3, 2); if (nRet != 0) return 1; + TumblebTilesRearrange(); + GfxDecode(DrvNumChars, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 4, 16, 16, CharPlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 5, 1); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 6, 1); if (nRet != 0) return 1; + if (Tumbleb2) nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x80000, 6, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 JumpkidsLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 4, 2); if (nRet != 0) return 1; + TumblebTilesRearrange(); + GfxDecode(DrvNumChars, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 4, 16, 16, CharPlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080001, 8, 2); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(MSM6295ROM + 0x00000, 10, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 MetlsavrLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x200000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load Shared RAM data + nRet = BurnLoadRom(DrvProtData, 3, 1); if (nRet) return 1; + BurnByteswap(DrvProtData, 0x200); + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000001, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 2); if (nRet != 0) return 1; + TumblebTilesRearrange(); + GfxDecode(DrvNumChars, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 4, 16, 16, CharPlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100001, 9, 2); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(MSM6295ROM, 10, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 PangpangLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080001, 5, 2); if (nRet != 0) return 1; + UINT8 *pTemp = (UINT8*)BurnMalloc(0x100000); + memcpy(pTemp, DrvTempRom, 0x100000); + memset(DrvTempRom, 0, 0x100000); + memcpy(DrvTempRom + 0x000000, pTemp + 0x000000, 0x40000); + memcpy(DrvTempRom + 0x080000, pTemp + 0x040000, 0x40000); + memcpy(DrvTempRom + 0x040000, pTemp + 0x080000, 0x40000); + memcpy(DrvTempRom + 0x0c0000, pTemp + 0x0c0000, 0x40000); + BurnFree(pTemp); + TumblebTilesRearrange(); + GfxDecode(DrvNumChars, 4, 8, 8, SpritePlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080001, 9, 2); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 10, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); + + BurnFree(DrvTempRom); + + return 0; +} + +static void SuprtrioDecrypt68KRom() +{ + UINT16 *Rom = (UINT16*)Drv68KRom; + UINT16 *pTemp = (UINT16*)BurnMalloc(0x80000); + INT32 i; + + memcpy(pTemp, Rom, 0x80000); + for (i = 0; i < 0x40000; i++) { + INT32 j = i ^ 0x06; + if ((i & 1) == 0) j ^= 0x02; + if ((i & 3) == 0) j ^= 0x08; + Rom[i] = pTemp[j]; + } + BurnFree(pTemp); +} + +static void SuprtrioDecryptTiles() +{ + UINT16 *Rom = (UINT16*)DrvTempRom; + UINT16 *pTemp = (UINT16*)BurnMalloc(0x100000); + INT32 i; + + memcpy(pTemp, Rom, 0x100000); + for (i = 0; i < 0x80000; i++) { + INT32 j = i ^ 0x02; + if (i & 1) j ^= 0x04; + Rom[i] = pTemp[j]; + } + BurnFree(pTemp); +} + +static INT32 SuprtrioLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + SuprtrioDecrypt68KRom(); + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 4, 1); if (nRet != 0) return 1; + UINT8 *pTemp = (UINT8*)BurnMalloc(0x100000); + memcpy(pTemp, DrvTempRom, 0x100000); + memset(DrvTempRom, 0, 0x100000); + memcpy(DrvTempRom + 0x000000, pTemp + 0x000000, 0x20000); + memcpy(DrvTempRom + 0x040000, pTemp + 0x020000, 0x20000); + memcpy(DrvTempRom + 0x020000, pTemp + 0x040000, 0x20000); + memcpy(DrvTempRom + 0x060000, pTemp + 0x060000, 0x20000); + memcpy(DrvTempRom + 0x080000, pTemp + 0x080000, 0x20000); + memcpy(DrvTempRom + 0x0c0000, pTemp + 0x0a0000, 0x20000); + memcpy(DrvTempRom + 0x0a0000, pTemp + 0x0c0000, 0x20000); + memcpy(DrvTempRom + 0x0e0000, pTemp + 0x0e0000, 0x20000); + BurnFree(pTemp); + SuprtrioDecryptTiles(); + GfxDecode(DrvNumTiles, 4, 16, 16, SuprtrioPlaneOffsets, SuprtrioXOffsets, SuprtrioYOffsets, 0x100, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080001, 8, 2); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x80000, 10, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 HtchctchLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load Shared RAM data + nRet = BurnLoadRom(DrvProtData, 3, 1); if (nRet) return 1; + BurnByteswap(DrvProtData, 0x200); + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000001, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 2); if (nRet != 0) return 1; + TumblebTilesRearrange(); + GfxDecode(DrvNumChars, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 4, 16, 16, CharPlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x040000, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x040001, 9, 2); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, CharPlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(MSM6295ROM, 10, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 ChokchokLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x200000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load Shared RAM data + nRet = BurnLoadRom(DrvProtData, 3, 1); if (nRet) return 1; + BurnByteswap(DrvProtData, 0x200); + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000001, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 2); if (nRet != 0) return 1; + UINT8 *pTemp = (UINT8*)BurnMalloc(0x100000); + memcpy(pTemp, DrvTempRom, 0x100000); + memset(DrvTempRom, 0, 0x200000); + memcpy(DrvTempRom + 0x000000, pTemp + 0x000000, 0x40000); + memcpy(DrvTempRom + 0x100000, pTemp + 0x040000, 0x40000); + memcpy(DrvTempRom + 0x040000, pTemp + 0x080000, 0x40000); + memcpy(DrvTempRom + 0x140000, pTemp + 0x0c0000, 0x40000); + BurnFree(pTemp); + TumblebTilesRearrange(); + GfxDecode(DrvNumChars, 4, 8, 8, Sprite2PlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100001, 9, 2); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(MSM6295ROM, 10, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 FncywldLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x100000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080001, 5, 2); if (nRet != 0) return 1; + TumblebTilesRearrange(); + GfxDecode(DrvNumChars, 4, 8, 8, SpritePlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x100000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080000, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x080001, 9, 2); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(MSM6295ROM + 0x00000, 10, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 SdfightLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x400000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(DrvTempRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x00000, 1, 2); if (nRet != 0) return 1; + memcpy(Drv68KRom + 0xc0000, DrvTempRom + 0x00000, 0x40000); + memcpy(Drv68KRom + 0x80000, DrvTempRom + 0x40000, 0x40000); + memcpy(Drv68KRom + 0x40000, DrvTempRom + 0x80000, 0x40000); + memcpy(Drv68KRom + 0x00000, DrvTempRom + 0xc0000, 0x40000); + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load Shared RAM data + nRet = BurnLoadRom(DrvProtData, 3, 1); if (nRet) return 1; + BurnByteswap(DrvProtData, 0x200); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x400000); + nRet = BurnLoadRom(DrvTempRom + 0x200001, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200000, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300001, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300000, 7, 2); if (nRet != 0) return 1; + memcpy(DrvTempRom + 0x000000, DrvTempRom + 0x200000, 0x40000); + memcpy(DrvTempRom + 0x100000, DrvTempRom + 0x240000, 0x40000); + memcpy(DrvTempRom + 0x040000, DrvTempRom + 0x280000, 0x40000); + memcpy(DrvTempRom + 0x140000, DrvTempRom + 0x2c0000, 0x40000); + memcpy(DrvTempRom + 0x080000, DrvTempRom + 0x300000, 0x40000); + memcpy(DrvTempRom + 0x180000, DrvTempRom + 0x340000, 0x40000); + memcpy(DrvTempRom + 0x0c0000, DrvTempRom + 0x380000, 0x40000); + memcpy(DrvTempRom + 0x1c0000, DrvTempRom + 0x3c0000, 0x40000); + TumblebTilesRearrange(); + GfxDecode(DrvNumChars, 4, 8, 8, Sprite2PlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 9, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 10, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100001, 11, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200000, 12, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200001, 13, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300000, 14, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300001, 15, 2); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, Sprite3PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(MSM6295ROM, 16, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 BcstryLoadRoms() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x400000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(DrvTempRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x00000, 1, 2); if (nRet != 0) return 1; + memcpy(Drv68KRom + 0x40000, DrvTempRom + 0x00000, 0x40000); + memcpy(Drv68KRom + 0x00000, DrvTempRom + 0x40000, 0x40000); + + // Load Z80 Program Roms + memset(DrvTempRom, 0, 0x400000); + nRet = BurnLoadRom(DrvTempRom, 2, 1); if (nRet != 0) return 1; + memcpy(DrvZ80Rom + 0x04000, DrvTempRom + 0x00000, 0x04000); + memcpy(DrvZ80Rom + 0x00000, DrvTempRom + 0x04000, 0x04000); + memcpy(DrvZ80Rom + 0x0c000, DrvTempRom + 0x08000, 0x04000); + memcpy(DrvZ80Rom + 0x08000, DrvTempRom + 0x0c000, 0x04000); + + // Load Shared RAM data + memset(DrvTempRom, 0, 0x400000); + nRet = BurnLoadRom(DrvProtData, 3, 1); if (nRet) return 1; + BurnByteswap(DrvProtData, 0x200); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x400000); + nRet = BurnLoadRom(DrvTempRom + 0x200000, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200001, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300001, 7, 2); if (nRet != 0) return 1; + memcpy(DrvTempRom + 0x000000, DrvTempRom + 0x200000, 0x40000); + memcpy(DrvTempRom + 0x100000, DrvTempRom + 0x240000, 0x40000); + memcpy(DrvTempRom + 0x040000, DrvTempRom + 0x280000, 0x40000); + memcpy(DrvTempRom + 0x140000, DrvTempRom + 0x2c0000, 0x40000); + memcpy(DrvTempRom + 0x080000, DrvTempRom + 0x300000, 0x40000); + memcpy(DrvTempRom + 0x180000, DrvTempRom + 0x340000, 0x40000); + memcpy(DrvTempRom + 0x0c0000, DrvTempRom + 0x380000, 0x40000); + memcpy(DrvTempRom + 0x1c0000, DrvTempRom + 0x3c0000, 0x40000); + TumblebTilesRearrange(); + GfxDecode(DrvNumChars, 4, 8, 8, Sprite2PlaneOffsets, CharXOffsets, CharYOffsets, 0x80, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 8, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 9, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 10, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100001, 11, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200000, 12, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200001, 13, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300000, 14, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300001, 15, 2); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, Sprite3PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(MSM6295ROM, 16, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static void TumblebMap68k() +{ + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x120000, 0x123fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x140000, 0x1407ff, SM_RAM); + SekMapMemory(DrvSpriteRam , 0x160000, 0x1607ff, SM_RAM); + SekMapMemory(Drv68KRam + 0x4000 , 0x1a0000, 0x1a07ff, SM_RAM); + SekMapMemory(DrvPf1Ram , 0x320000, 0x320fff, SM_RAM); + SekMapMemory(DrvPf2Ram , 0x322000, 0x322fff, SM_RAM); + SekSetReadWordHandler(0, Tumbleb68KReadWord); + SekSetWriteWordHandler(0, Tumbleb68KWriteWord); + SekSetReadByteHandler(0, Tumbleb68KReadByte); + SekSetWriteByteHandler(0, Tumbleb68KWriteByte); + SekClose(); +} + +static void PangpangMap68k() +{ + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x120000, 0x123fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x140000, 0x1407ff, SM_RAM); + SekMapMemory(DrvSpriteRam , 0x160000, 0x1607ff, SM_RAM); + SekMapMemory(Drv68KRam + 0x4000 , 0x1a0000, 0x1a07ff, SM_RAM); + SekMapMemory(DrvPf1Ram , 0x320000, 0x321fff, SM_RAM); + SekMapMemory(DrvPf2Ram , 0x340000, 0x341fff, SM_RAM); + SekSetReadWordHandler(0, Tumbleb68KReadWord); + SekSetWriteWordHandler(0, Tumbleb68KWriteWord); + SekSetReadByteHandler(0, Tumbleb68KReadByte); + SekSetWriteByteHandler(0, Tumbleb68KWriteByte); + SekClose(); +} + +static void SuprtrioMap68k() +{ + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvSpriteRam , 0x700000, 0x7007ff, SM_RAM); + SekMapMemory(DrvPf1Ram , 0xa20000, 0xa20fff, SM_RAM); + SekMapMemory(DrvPf2Ram , 0xa22000, 0xa22fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0xcf0000, 0xcf05ff, SM_RAM); + SekMapMemory(Drv68KRam , 0xf00000, 0xf07fff, SM_RAM); + SekSetReadWordHandler(0, Suprtrio68KReadWord); + SekSetWriteWordHandler(0, Suprtrio68KWriteWord); + SekClose(); +} + +static void HtchctchMap68k() +{ + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x120000, 0x123fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x140000, 0x1407ff, SM_RAM); + SekMapMemory(DrvSpriteRam , 0x160000, 0x160fff, SM_RAM); + SekMapMemory(Drv68KRam + 0x4000 , 0x1a0000, 0x1a0fff, SM_RAM); + SekMapMemory(DrvPf1Ram , 0x320000, 0x321fff, SM_RAM); + SekMapMemory(DrvPf2Ram , 0x322000, 0x322fff, SM_RAM); + SekMapMemory(Drv68KRam + 0x5000 , 0x341000, 0x342fff, SM_RAM); + SekSetReadWordHandler(0, Tumbleb68KReadWord); + SekSetWriteWordHandler(0, Tumbleb68KWriteWord); + SekSetReadByteHandler(0, Tumbleb68KReadByte); + SekSetWriteByteHandler(0, Tumbleb68KWriteByte); + SekClose(); +} + +static void FncywldMap68k() +{ + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(DrvPaletteRam , 0x140000, 0x140fff, SM_RAM); + SekMapMemory(DrvSpriteRam , 0x160000, 0x1607ff, SM_RAM); + SekMapMemory(DrvPf1Ram , 0x320000, 0x321fff, SM_RAM); + SekMapMemory(DrvPf2Ram , 0x322000, 0x323fff, SM_RAM); + SekMapMemory(Drv68KRam , 0xff0000, 0xffffff, SM_RAM); + SekSetReadWordHandler(0, Fncywld68KReadWord); + SekSetWriteWordHandler(0, Fncywld68KWriteWord); + SekSetReadByteHandler(0, Fncywld68KReadByte); + SekSetWriteByteHandler(0, Fncywld68KWriteByte); + SekClose(); +} + +static void JumpkidsMapZ80() +{ + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(JumpkidsZ80Read); + ZetSetWriteHandler(JumpkidsZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom ); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram ); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram ); + ZetClose(); +} + +static void SemicomMapZ80() +{ + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(SemicomZ80Read); + ZetSetWriteHandler(SemicomZ80Write); + ZetMapArea(0x0000, 0xcfff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xcfff, 2, DrvZ80Rom ); + ZetMapArea(0xd000, 0xd7ff, 0, DrvZ80Ram ); + ZetMapArea(0xd000, 0xd7ff, 1, DrvZ80Ram ); + ZetMapArea(0xd000, 0xd7ff, 2, DrvZ80Ram ); + ZetClose(); +} + +static void SemicomYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvInit(bool bReset, INT32 SpriteRamSize, INT32 SpriteMask, INT32 SpriteXOffset, INT32 SpriteYOffset, INT32 NumSprites, INT32 NumChars, INT32 NumTiles, double Refresh, INT32 OkiFreq) +{ + INT32 nRet = 0, nLen; + + DrvSpriteRamSize = SpriteRamSize; + DrvNumSprites = NumSprites, + DrvNumChars = NumChars, + DrvNumTiles = NumTiles, + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + nRet = DrvLoadRoms(); + + DrvMap68k(); + + if (DrvHasZ80) DrvMapZ80(); + + if (DrvHasYM2151) { + if (!DrvYM2151Freq) DrvYM2151Freq = 3427190; + BurnYM2151Init(DrvYM2151Freq); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.10, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.10, BURN_SND_ROUTE_RIGHT); + if (DrvHasZ80) { + BurnYM2151SetIrqHandler(&SemicomYM2151IrqHandler); + } + } + + // Setup the OKIM6295 emulation + if (DrvHasYM2151) { + MSM6295Init(0, OkiFreq / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + } else { + MSM6295Init(0, OkiFreq / 132, 0); + MSM6295SetRoute(0, 0.70, BURN_SND_ROUTE_BOTH); + } + + BurnSetRefreshRate(Refresh); + + nCyclesTotal[0] = 14000000 / 60; + + DrvSpriteXOffset = SpriteXOffset; + DrvSpriteYOffset = SpriteYOffset; + DrvSpriteMask = SpriteMask; + DrvSpriteColourMask = 0x0f; + Pf1XOffset = -5; + Pf1YOffset = 0; + Pf2XOffset = -1; + Pf2YOffset = 0; + + GenericTilesInit(); + + // Reset the driver + if (bReset) DrvDoReset(); + + return 0; +} + +static INT32 TumblebInit() +{ + DrvLoadRoms = TumblebLoadRoms; + DrvMap68k = TumblebMap68k; + DrvRender = DrvDraw; + + return DrvInit(1, 0x800, 0x3fff, -1, 0, 0x2000, 0x4000, 0x1000, 58.0, 8000000 / 10); +} + +static INT32 Tumbleb2Init() +{ + Tumbleb2 = 1; + return TumblebInit(); +} + +static INT32 JumpkidsInit() +{ + INT32 nRet; + + Jumpkids = 1; + DrvHasZ80 = 1; + DrvLoadRoms = JumpkidsLoadRoms; + DrvMap68k = TumblebMap68k; + DrvMapZ80 = JumpkidsMapZ80; + DrvRender = DrvDraw; + + nRet = DrvInit(1, 0x800, 0x7fff, -1, 0, 0x2000, 0x4000, 0x1000, 60.0, 8000000 / 8); + + nCyclesTotal[0] = 12000000 / 60; + nCyclesTotal[1] = (8000000 / 2) / 60; + + return nRet; +} + +static INT32 MetlsavrInit() +{ + INT32 nRet; + + DrvHasZ80 = 1; + DrvHasYM2151 = 1; + DrvHasProt = 1; + SemicomSoundCommand = 1; + DrvLoadRoms = MetlsavrLoadRoms; + DrvMap68k = HtchctchMap68k; + DrvMapZ80 = SemicomMapZ80; + DrvRender = DrvDraw; + + nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x4000, 0x4000, 0x1000, 60.0, 1024000); + + nCyclesTotal[0] = 15000000 / 60; + nCyclesTotal[1] = (15000000 / 4) / 60; + + return nRet; +} + +static INT32 PangpangInit() +{ + Tumbleb2 = 1; + DrvLoadRoms = PangpangLoadRoms; + DrvMap68k = PangpangMap68k; + DrvRender = PangpangDraw; + + INT32 nRet = DrvInit(1, 0x800, 0x7fff, -1, 0, 0x2000, 0x8000, 0x2000, 58.0, 8000000 / 10); + + MSM6295SetRoute(0, 0.70, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +static INT32 SuprtrioInit() +{ + INT32 nRet; + + DrvHasZ80 = 1; + SemicomSoundCommand = 1; + DrvLoadRoms = SuprtrioLoadRoms; + DrvMap68k = SuprtrioMap68k; + DrvMapZ80 = SemicomMapZ80; + DrvRender = SuprtrioDraw; + + nRet = DrvInit(1, 0x800, 0x7fff, 0, 0, 0x2000, 0x8000, 0x2000, 60.0, 875000); + + Pf1XOffset = -6; + Pf2XOffset = -2; + nCyclesTotal[1] = 8000000 / 60; + + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +static INT32 HtchctchInit() +{ + INT32 nRet; + + DrvHasZ80 = 1; + DrvHasYM2151 = 1; + DrvHasProt = 1; + SemicomSoundCommand = 1; + DrvLoadRoms = HtchctchLoadRoms; + DrvMap68k = HtchctchMap68k; + DrvMapZ80 = SemicomMapZ80; + DrvRender = HtchctchDraw; + + nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x1000, 0x4000, 0x1000, 60.0, 1024000); + + nCyclesTotal[0] = 15000000 / 60; + nCyclesTotal[1] = (15000000 / 4) / 60; + + return nRet; +} + +static INT32 CookbibInit() +{ + INT32 nRet = HtchctchInit(); + + Pf1XOffset = -5; + Pf1YOffset = 0; + Pf2XOffset = -1; + Pf2YOffset = 2; + + return nRet; +} + +static INT32 ChokchokInit() +{ + INT32 nRet; + + Chokchok = 1; + DrvHasZ80 = 1; + DrvHasYM2151 = 1; + DrvHasProt = 1; + SemicomSoundCommand = 1; + DrvLoadRoms = ChokchokLoadRoms; + DrvMap68k = HtchctchMap68k; + DrvMapZ80 = SemicomMapZ80; + DrvRender = DrvDraw; + + nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x4000, 0x10000, 0x4000, 60.0, 1024000); + + nCyclesTotal[0] = 15000000 / 60; + nCyclesTotal[1] = (15000000 / 4) / 60; + + Pf1XOffset = -5; + Pf1YOffset = 0; + Pf2XOffset = -1; + Pf2YOffset = 2; + + return nRet; +} + +static INT32 WlstarInit() +{ + INT32 nRet; + + Wlstar = 1; + DrvHasZ80 = 1; + DrvHasYM2151 = 1; + DrvHasProt = 1; + SemicomSoundCommand = 1; + DrvLoadRoms = ChokchokLoadRoms; + DrvMap68k = HtchctchMap68k; + DrvMapZ80 = SemicomMapZ80; + DrvRender = HtchctchDraw; + + nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x4000, 0x10000, 0x4000, 60.0, 1024000); + + nCyclesTotal[0] = 15000000 / 60; + nCyclesTotal[1] = (15000000 / 4) / 60; + + Pf1XOffset = -5; + Pf1YOffset = 0; + Pf2XOffset = -1; + Pf2YOffset = 2; + + return nRet; +} + +static INT32 Wondl96Init() +{ + INT32 nRet; + + Wlstar = 1; + Wondl96 = 1; + DrvHasZ80 = 1; + DrvHasYM2151 = 1; + DrvHasProt = 2; + SemicomSoundCommand = 1; + DrvLoadRoms = ChokchokLoadRoms; + DrvMap68k = HtchctchMap68k; + DrvMapZ80 = SemicomMapZ80; + DrvRender = HtchctchDraw; + + nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x4000, 0x10000, 0x4000, 60.0, 1024000); + + nCyclesTotal[0] = 15000000 / 60; + nCyclesTotal[1] = (15000000 / 4) / 60; + + Pf1XOffset = -5; + Pf1YOffset = 0; + Pf2XOffset = -1; + Pf2YOffset = 2; + + return nRet; +} + +static INT32 FncywldInit() +{ + INT32 nRet; + + DrvHasYM2151 = 1; + DrvHasZ80 = 0; + DrvYM2151Freq = 32220000 / 9; + DrvLoadRoms = FncywldLoadRoms; + DrvMap68k = FncywldMap68k; + DrvRender = FncywldDraw; + + nRet = DrvInit(1, 0x800, 0x3fff, -1, 0, 0x2000, 0x8000, 0x2000, 60.0, 1023924); + + nCyclesTotal[0] = 12000000 / 60; + DrvSpriteColourMask = 0x3f; + + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.20, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.20, BURN_SND_ROUTE_RIGHT); + + return nRet; +} + +static INT32 SdfightInit() +{ + INT32 nRet; + + Bcstry = 1; + DrvHasZ80 = 1; + DrvHasYM2151 = 1; + DrvYM2151Freq = 3427190; + DrvHasProt = 1; + SemicomSoundCommand = 1; + DrvLoadRoms = SdfightLoadRoms; + DrvMap68k = HtchctchMap68k; + DrvMapZ80 = SemicomMapZ80; + DrvRender = SdfightDraw; + + nRet = DrvInit(1, 0x1000, 0x7fff, 0, 1, 0x8000, 0x10000, 0x4000, 60.0, 1024000); + + nCyclesTotal[0] = 15000000 / 60; + nCyclesTotal[1] = (15000000 / 4) / 60; + + Pf1XOffset = -5; + Pf1YOffset = -16; + Pf2XOffset = -1; + Pf2YOffset = 0; + + return nRet; +} + +static INT32 BcstryInit() +{ + INT32 nRet; + + Bcstry = 1; + DrvHasZ80 = 1; + DrvHasYM2151 = 1; + DrvYM2151Freq = 3427190; + DrvHasProt = 1; + SemicomSoundCommand = 1; + DrvLoadRoms = BcstryLoadRoms; + DrvMap68k = HtchctchMap68k; + DrvMapZ80 = SemicomMapZ80; + DrvRender = HtchctchDraw; + + nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x8000, 0x10000, 0x4000, 60.0, 1024000); + + nCyclesTotal[0] = 15000000 / 60; + nCyclesTotal[1] = (15000000 / 4) / 60; + + //Pf1XOffset = 8; + Pf1XOffset = -5; + Pf1YOffset = 0; + //Pf2XOffset = 8; + Pf2XOffset = -1; + Pf2YOffset = 0; + + return nRet; +} + +static INT32 SemibaseInit() +{ + INT32 nRet; + + Semibase = 1; + Bcstry = 1; + DrvHasZ80 = 1; + DrvHasYM2151 = 1; + DrvYM2151Freq = 3427190; + DrvHasProt = 1; + SemicomSoundCommand = 1; + DrvLoadRoms = BcstryLoadRoms; + DrvMap68k = HtchctchMap68k; + DrvMapZ80 = SemicomMapZ80; + DrvRender = HtchctchDraw; + + nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x8000, 0x10000, 0x4000, 60.0, 1024000); + + nCyclesTotal[0] = 15000000 / 60; + nCyclesTotal[1] = (15000000 / 4) / 60; + + Pf1XOffset = -2; + Pf1YOffset = 0; + Pf2XOffset = -1; + Pf2YOffset = 0; + + return nRet; +} + +static INT32 DquizgoInit() +{ + INT32 nRet; + + DrvHasZ80 = 1; + DrvHasYM2151 = 1; + DrvHasProt = 2; + SemicomSoundCommand = 1; + DrvLoadRoms = MetlsavrLoadRoms; + DrvMap68k = HtchctchMap68k; + DrvMapZ80 = SemicomMapZ80; + DrvRender = HtchctchDraw; + + nRet = DrvInit(1, 0x1000, 0x7fff, -1, 0, 0x4000, 0x4000, 0x1000, 60.0, 1024000); + + nCyclesTotal[0] = 15000000 / 60; + nCyclesTotal[1] = (15000000 / 4) / 60; + + Pf1XOffset = -5; + Pf1YOffset = 0; + Pf2XOffset = -1; + Pf2YOffset = 2; + + return nRet; +} + +inline static INT32 JumppopSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(ZetTotalCycles() * nSoundRate / 3500000); +} + +static INT32 JumppopInit() +{ + INT32 nRet = 0, nLen; + + DrvSpriteRamSize = 0x1000; + DrvNumSprites = 0x4000, + DrvNumChars = 0x8000, + DrvNumTiles = 0x2000, + + DrvHasZ80 = 1; + DrvHasYM3812 = 1; + + // Allocate and Blank all required memory + Mem = NULL; + JumppopMemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + JumppopMemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x200000); + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "jumppope")) { + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00001, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00000, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 7, 4); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 8, 4); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000002, 9, 4); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000003, 10, 4); if (nRet != 0) return 1; + GfxDecode(DrvNumChars, 8, 8, 8, JpeCharPlaneOffsets, JpeCharXOffsets, JpeCharYOffsets, 0x200, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 8, 16, 16, JpeTilePlaneOffsets, JpeTileXOffsets, JpeTileYOffsets, 0x800, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100001, 6, 2); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(MSM6295ROM, 11, 1); if (nRet != 0) return 1; + } else { + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 1); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 1, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 3, 1); if (nRet != 0) return 1; + GfxDecode(DrvNumChars, 8, 8, 8, JpCharPlaneOffsets, JpCharXOffsets, JpCharYOffsets, 0x100, DrvTempRom, DrvChars); + GfxDecode(DrvNumTiles, 8, 16, 16, JpTilePlaneOffsets, JpTileXOffsets, JpTileYOffsets, 0x400, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x200000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 5, 1); if (nRet != 0) return 1; + GfxDecode(DrvNumSprites, 4, 16, 16, Sprite2PlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x200, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(MSM6295ROM, 6, 1); if (nRet != 0) return 1; + } + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Drv68KRam , 0x120000, 0x123fff, SM_RAM); + SekMapMemory(DrvPaletteRam , 0x140000, 0x1407ff, SM_RAM); + SekMapMemory(DrvSpriteRam , 0x160000, 0x160fff, SM_RAM); + SekMapMemory(Drv68KRam + 0x4000 , 0x1a0000, 0x1a7fff, SM_RAM); + SekMapMemory(DrvPf1Ram , 0x320000, 0x323fff, SM_RAM); + SekMapMemory(DrvPf2Ram , 0x300000, 0x303fff, SM_RAM); + SekSetReadWordHandler(0, Jumppop68KReadWord); + SekSetWriteWordHandler(0, Jumppop68KWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetInHandler(JumppopZ80PortRead); + ZetSetOutHandler(JumppopZ80PortWrite); + ZetMapArea(0x0000, 0x2fff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0x2fff, 2, DrvZ80Rom ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + 0x8000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + 0x8000 ); + ZetMapArea(0xf800, 0xffff, 0, DrvZ80Ram ); + ZetMapArea(0xf800, 0xffff, 1, DrvZ80Ram ); + ZetMapArea(0xf800, 0xffff, 2, DrvZ80Ram ); + ZetClose(); + + BurnYM3812Init(3500000, NULL, JumppopSynchroniseStream, 0); + BurnTimerAttachZetYM3812(3500000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 0.70, BURN_SND_ROUTE_BOTH); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 875000 / 132, 1); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + + BurnSetRefreshRate(60.0); + + nCyclesTotal[0] = 16000000 / 60; + nCyclesTotal[1] = 3500000 / 60; + + DrvSpriteXOffset = 1; + DrvSpriteYOffset = 0; + DrvSpriteMask = 0x7fff; + DrvSpriteColourMask = 0x0f; + Pf1XOffset = -0x3a0; + Pf1YOffset = 0; + Pf2XOffset = -0x3a2; + Pf2YOffset = 0; + + GenericTilesInit(); + DrvRender = JumppopDraw; + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + SekExit(); + if (DrvHasZ80) ZetExit(); + if (DrvHasYM2151) BurnYM2151Exit(); + MSM6295Exit(0); + + GenericTilesExit(); + + DrvVBlank = 0; + DrvOkiBank = 0; + DrvZ80Bank = 0; + DrvTileBank = 0; + DrvSoundLatch = 0; + Tumbleb2MusicCommand = 0; + Tumbleb2MusicBank = 0; + Tumbleb2MusicIsPlaying = 0; + + DrvSpriteXOffset = 0; + DrvSpriteYOffset = 0; + DrvSpriteRamSize = 0; + DrvSpriteMask = 0; + DrvSpriteColourMask = 0; + DrvYM2151Freq = 0; + DrvNumSprites = 0; + DrvNumChars = 0; + DrvNumTiles = 0; + DrvHasZ80 = 0; + DrvHasYM2151 = 0; + DrvHasYM3812 = 0; + DrvHasProt = 0; + Tumbleb2 = 0; + Jumpkids = 0; + Chokchok = 0; + Wlstar = 0; + Wondl96 = 0; + Bcstry = 0; + Semibase = 0; + SemicomSoundCommand = 0; + Pf1XOffset = 0; + Pf1YOffset = 0; + Pf2XOffset = 0; + Pf2YOffset = 0; + + DrvLoadRoms = NULL; + DrvMap68k = NULL; + DrvMapZ80 = NULL; + DrvRender = NULL; + + BurnFree(Mem); + + return 0; +} + +static INT32 JumppopExit() +{ + BurnYM3812Exit(); + return DrvExit(); +} + +static inline UINT8 pal4bit(UINT8 bits) +{ + bits &= 0x0f; + return (bits << 4) | bits; +} + +static inline UINT8 pal5bit(UINT8 bits) +{ + bits &= 0x1f; + return (bits << 3) | (bits >> 2); +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(nColour >> 0); + g = pal4bit(nColour >> 4); + b = pal4bit(nColour >> 8); + + return BurnHighCol(r, g, b, 0); +} + +inline static UINT32 HtchctchCalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal5bit(nColour >> 0); + g = pal5bit(nColour >> 5); + b = pal5bit(nColour >> 10); + + return BurnHighCol(r, g, b, 0); +} + +inline static UINT32 FncywldCalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(nColour >> 8); + g = pal4bit(nColour >> 4); + b = pal4bit(nColour >> 0); + + return BurnHighCol(r, g, b, 0); +} + +inline static UINT32 JumppopCalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal5bit(nColour >> 10); + g = pal5bit(nColour >> 5); + b = pal5bit(nColour >> 0); + + return BurnHighCol(r, g, b, 0); +} + +static void DrvCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x400; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } +} + +static void HtchctchCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x400; i++, ps++, pd++) { + *pd = HtchctchCalcCol(*ps); + } +} + +static void FncywldCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x800; i++, ps++, pd++) { + *pd = FncywldCalcCol(*ps); + } +} + +static void JumppopCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x400; i++, ps++, pd++) { + *pd = JumppopCalcCol(*ps); + } +} + +static void DrvRenderPf2Layer(INT32 ScrollX, INT32 ScrollY) +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; + + UINT16 *VideoRam = (UINT16*)DrvPf2Ram; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); + Attr = VideoRam[TileIndex]; + Code = (Attr & 0xfff) | (DrvTileBank >> 2); + Colour = Attr >> 12; + + Code &= (DrvNumTiles - 1); + + x = 16 * mx; + y = 16 * my; + + x -= ((ScrollX + Pf2XOffset) & 0x3ff); + y -= ((ScrollY + Pf2YOffset) & 0x1ff); + if (x < -16) x += 1024; + if (y < -16) y += 512; + + y -= 8; + + if (x > 0 && x < 304 && y > 0 && y < 224) { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); + } + } + } +} + +static void PangpangRenderPf2Layer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; + + UINT16 *VideoRam = (UINT16*)DrvPf2Ram; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); + Attr = VideoRam[TileIndex * 2 + 0]; + Code = VideoRam[TileIndex * 2 + 1] & 0xfff; + Code |= 0x1000; + Colour = (Attr >> 12) & 0x0f; + + Code &= (DrvNumTiles - 1); + + x = 16 * mx; + y = 16 * my; + + x -= ((DrvControl[3] + Pf2XOffset) & 0x3ff); + y -= ((DrvControl[4] + Pf2YOffset) & 0x1ff); + if (x < -16) x += 1024; + if (y < -16) y += 512; + + y -= 8; + + if (x > 0 && x < 304 && y > 0 && y < 224) { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 512, DrvTiles); + } + } + } +} + +static void FncywldRenderPf2Layer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; + + UINT16 *VideoRam = (UINT16*)DrvPf2Ram; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); + Attr = VideoRam[TileIndex * 2 + 1]; + Code = VideoRam[TileIndex * 2 + 0]; + Colour = Attr & 0x1f; + + Code &= (DrvNumTiles - 1); + + x = 16 * mx; + y = 16 * my; + + x -= ((DrvControl[3] + Pf2XOffset) & 0x3ff); + y -= ((DrvControl[4] + Pf2YOffset) & 0x1ff); + if (x < -16) x += 1024; + if (y < -16) y += 512; + + y -= 8; + + if (x > 0 && x < 304 && y > 0 && y < 224) { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0x400, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0x400, DrvTiles); + } + } + } +} + +static void JumppopRenderPf2Layer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvPf2Ram; + + for (my = 0; my < 64; my++) { + for (mx = 0; mx < 64; mx++) { + Code = VideoRam[TileIndex]; + Code &= (DrvNumTiles - 1); + Colour = 0; + + x = 16 * mx; + y = 16 * my; + + x -= ((DrvControl[0] + Pf2XOffset) & 0x3ff); + y -= ((DrvControl[1] + Pf2YOffset) & 0x3ff); + if (x < -16) x += 1024; + if (y < -16) y += 1024; + + y -= 8; + + if (x > 0 && x < 304 && y > 0 && y < 224) { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 8, 512, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 8, 512, DrvTiles); + } + + TileIndex++; + } + } +} + +static void JumppopRenderPf2AltLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvPf2Ram; + + for (my = 0; my < 64; my++) { + for (mx = 0; mx < 128; mx++) { + Code = VideoRam[TileIndex]; + Colour = 0; + + x = 8 * mx; + y = 8 * my; + + x -= ((DrvControl[0] + Pf2XOffset) & 0x3ff); + y -= ((DrvControl[1] + Pf2YOffset) & 0x1ff); + if (x < -8) x += 1024; + if (y < -8) y += 512; + + y -= 8; + + if (x > 0 && x < 312 && y > 0 && y < 232) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 8, 0, 512, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 8, 0, 512, DrvChars); + } + + TileIndex++; + } + } +} + +static void DrvRenderPf1Layer(INT32 ScrollX, INT32 ScrollY) +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; + + UINT16 *VideoRam = (UINT16*)DrvPf1Ram; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); + Attr = VideoRam[TileIndex]; + Code = (Attr & 0xfff) | (DrvTileBank >> 2); + Colour = Attr >> 12; + + Code &= (DrvNumTiles - 1); + + x = 16 * mx; + y = 16 * my; + + x -= ((ScrollX + Pf1XOffset) & 0x3ff); + y -= ((ScrollY + Pf1YOffset) & 0x1ff); + if (x < -16) x += 1024; + if (y < -16) y += 512; + + y -= 8; + + if (x > 0 && x < 304 && y > 0 && y < 224) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); + } + } + } +} + +static void PangpangRenderPf1Layer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; + + UINT16 *VideoRam = (UINT16*)DrvPf1Ram; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); + Attr = VideoRam[TileIndex * 2 + 0]; + Code = VideoRam[TileIndex * 2 + 1]; + Colour = (Attr >> 12) & 0x0f; + + Code &= (DrvNumTiles - 1); + + x = 16 * mx; + y = 16 * my; + + x -= ((DrvControl[1] + Pf1XOffset) & 0x3ff); + y -= ((DrvControl[2] + Pf1YOffset) & 0x1ff); + if (x < -16) x += 1024; + if (y < -16) y += 512; + + y -= 8; + + if (x > 0 && x < 304 && y > 0 && y < 224) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvTiles); + } + } + } +} + +static void FncywldRenderPf1Layer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex; + + UINT16 *VideoRam = (UINT16*)DrvPf1Ram; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + TileIndex = (mx & 0x1f) + ((my & 0x1f) << 5) + ((mx & 0x60) << 5); + Attr = VideoRam[TileIndex * 2 + 1]; + Code = VideoRam[TileIndex * 2 + 0]; + Colour = Attr & 0x1f; + + Code &= (DrvNumTiles - 1); + + x = 16 * mx; + y = 16 * my; + + x -= ((DrvControl[1] + Pf1XOffset) & 0x3ff); + y -= ((DrvControl[2] + Pf1YOffset) & 0x1ff); + if (x < -16) x += 1024; + if (y < -16) y += 512; + + y -= 8; + + if (x > 0 && x < 304 && y > 0 && y < 224) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x200, DrvTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x200, DrvTiles); + } + } + } +} + +static void JumppopRenderPf1Layer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvPf1Ram; + + for (my = 0; my < 64; my++) { + for (mx = 0; mx < 64; mx++) { + Code = VideoRam[TileIndex] & 0x1fff; + Code &= (DrvNumTiles - 1); + Colour = 0; + + x = 16 * mx; + y = 16 * my; + + x -= ((DrvControl[2] + Pf1XOffset) & 0x3ff); + y -= ((DrvControl[3] + Pf1YOffset) & 0x3ff); + if (x < -16) x += 1024; + if (y < -16) y += 1024; + + y -= 8; + + if (x > 0 && x < 304 && y > 0 && y < 224) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 8, 0, 256, DrvTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 8, 0, 256, DrvTiles); + } + + TileIndex++; + } + } +} + +static void DrvRenderCharLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvPf1Ram; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = VideoRam[TileIndex]; + Code = (Attr & 0xfff) | DrvTileBank; + Colour = Attr >> 12; + Code &= (DrvNumChars - 1); + + x = 8 * mx; + y = 8 * my; + + x -= ((DrvControl[1] + Pf1XOffset) & 0x1ff); + y -= ((DrvControl[2] + Pf1YOffset) & 0xff); + if (x < -8) x += 512; + if (y < -8) y += 256; + + y -= 8; + + if (x > 0 && x < 312 && y > 0 && y < 232) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); + } + + TileIndex++; + } + } +} + +static void PangpangRenderCharLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvPf1Ram; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = VideoRam[TileIndex * 2 + 0]; + Code = VideoRam[TileIndex * 2 + 1] & 0x1fff; + Colour = (Attr >> 12) & 0x1f; + Code &= (DrvNumChars - 1); + + x = 8 * mx; + y = 8 * my; + + x -= ((DrvControl[1] + Pf1XOffset) & 0x1ff); + y -= ((DrvControl[2] + Pf1YOffset) & 0xff); + if (x < -8) x += 512; + if (y < -8) y += 256; + + y -= 8; + + if (x > 0 && x < 312 && y > 0 && y < 232) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); + } + + TileIndex++; + } + } +} + +static void FncywldRenderCharLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvPf1Ram; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = VideoRam[TileIndex * 2 + 1]; + Code = VideoRam[TileIndex * 2 + 0] & 0x1fff; + if (Code) { + Colour = Attr & 0x1f; + Code &= (DrvNumChars - 1); + + x = 8 * mx; + y = 8 * my; + + x -= ((DrvControl[1] + Pf1XOffset) & 0x1ff); + y -= ((DrvControl[2] + Pf1YOffset) & 0xff); + if (x < -8) x += 512; + if (y < -8) y += 256; + + y -= 8; + + if (x > 0 && x < 312 && y > 0 && y < 232) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x400, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0f, 0x400, DrvChars); + } + } + + TileIndex++; + } + } +} + +static void SdfightRenderCharLayer() +{ + INT32 mx, my, Attr, Code, Colour, x, y, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvPf1Ram; + + for (my = 0; my < 64; my++) { + for (mx = 0; mx < 64; mx++) { + Attr = VideoRam[TileIndex]; + Code = (Attr & 0xfff) | DrvTileBank; + Colour = Attr >> 12; + Code &= (DrvNumChars - 1); + + x = 8 * mx; + y = 8 * my; + + x -= ((DrvControl[1] + Pf1XOffset) & 0x1ff); + y -= ((DrvControl[2] + Pf1YOffset) & 0x1ff); + if (x < -8) x += 512; + if (y < -8) y += 512; + + y -= 8; + + if (x > 0 && x < 312 && y > 0 && y < 232) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 256, DrvChars); + } + + TileIndex++; + } + } +} + +static void JumppopRenderCharLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvPf1Ram; + + for (my = 0; my < 64; my++) { + for (mx = 0; mx < 128; mx++) { + Code = VideoRam[TileIndex]; + Colour = 0; + + x = 8 * mx; + y = 8 * my; + + x -= ((DrvControl[2] + Pf1XOffset) & 0x3ff); + y -= ((DrvControl[3] + Pf1YOffset) & 0x1ff); + if (x < -8) x += 1024; + if (y < -8) y += 512; + + y -= 8; + + if (x > 0 && x < 312 && y > 0 && y < 232) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 8, 0, 256, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 8, 0, 256, DrvChars); + } + + TileIndex++; + } + } +} + +static void DrvRenderSprites(INT32 MaskColour, INT32 xFlipped) +{ + INT32 Offset; + UINT16 *SpriteRam = (UINT16*)DrvSpriteRam; + + for (Offset = 0; Offset < DrvSpriteRamSize / 2; Offset += 4) { + INT32 x, y, Code, Colour, Flash, Multi, xFlip, yFlip, Inc, Mult; + + Code = SpriteRam[Offset + 1] & DrvSpriteMask; + if (!Code) continue; + + y = SpriteRam[Offset]; + Flash = y & 0x1000; + if (Flash && (GetCurrentFrame() & 1)) continue; + + x = SpriteRam[Offset + 2]; + Colour = (x >> 9) & DrvSpriteColourMask; + xFlip = y & 0x2000; + yFlip = y & 0x4000; + + Multi = (1 << ((y & 0x600) >> 9)) - 1; + + x &= 0x1ff; + y &= 0x1ff; + if (x >= 320) x -= 512; + if (y >= 256) y -= 512; + y = 240 - y; + x = 304 - x; + + y -= 8; + + if (yFlip) { + Inc = -1; + } else { + Code += Multi; + Inc = 1; + } + + if (xFlipped) { + xFlip = !xFlip; + x = 304 - x; + } + + Mult = -16; + + while (Multi >= 0) { + INT32 RenderCode = Code - (Multi * Inc); + INT32 RenderX = DrvSpriteXOffset + x; + INT32 RenderY = DrvSpriteYOffset + y + (Mult * Multi); + RenderCode &= (DrvNumSprites - 1); + + if (RenderX > 16 && RenderX < 304 && RenderY > 16 && RenderY < 224) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); + } else { + Render16x16Tile_Mask(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, RenderCode, RenderX, RenderY, Colour, 4, MaskColour, 0, DrvSprites); + } + } + } + + Multi--; + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + DrvRenderPf2Layer(DrvControl[3], DrvControl[4]); + + if (DrvControl[6] & 0x80) { + DrvRenderCharLayer(); + } else { + DrvRenderPf1Layer(DrvControl[1], DrvControl[2]); + } + + DrvRenderSprites(0, 0); + BurnTransferCopy(DrvPalette); +} + +static void PangpangDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + PangpangRenderPf2Layer(); + + if (DrvControl[6] & 0x80) { + PangpangRenderCharLayer(); + } else { + PangpangRenderPf1Layer(); + } + + DrvRenderSprites(0, 0); + BurnTransferCopy(DrvPalette); +} + +static void SuprtrioDraw() +{ + BurnTransferClear(); + HtchctchCalcPalette(); + DrvRenderPf2Layer(-DrvControl[3], -DrvControl[4]); + DrvRenderPf1Layer(-DrvControl[1], -DrvControl[2]); + DrvRenderSprites(0, 0); + BurnTransferCopy(DrvPalette); +} + +static void HtchctchDraw() +{ + BurnTransferClear(); + HtchctchCalcPalette(); + DrvRenderPf2Layer(DrvControl[3], DrvControl[4]); + + if (DrvControl[6] & 0x80) { + DrvRenderCharLayer(); + } else { + DrvRenderPf1Layer(DrvControl[1], DrvControl[2]); + } + + DrvRenderSprites(0, 0); + BurnTransferCopy(DrvPalette); +} + +static void FncywldDraw() +{ + BurnTransferClear(); + FncywldCalcPalette(); + FncywldRenderPf2Layer(); + + if (DrvControl[6] & 0x80) { + FncywldRenderCharLayer(); + } else { + FncywldRenderPf1Layer(); + } + + DrvRenderSprites(0x0f, 0); + BurnTransferCopy(DrvPalette); +} + +static void SdfightDraw() +{ + BurnTransferClear(); + HtchctchCalcPalette(); + DrvRenderPf2Layer(DrvControl[3], DrvControl[4]); + + if (DrvControl[6] & 0x80) { + SdfightRenderCharLayer(); + } else { + DrvRenderPf1Layer(DrvControl[1], DrvControl[2]); + } + + DrvRenderSprites(0, 0); + BurnTransferCopy(DrvPalette); +} + +static void JumppopDraw() +{ + BurnTransferClear(); + JumppopCalcPalette(); + + if (DrvControl[7] & 0x01) { + JumppopRenderPf2Layer(); + } else { + JumppopRenderPf2AltLayer(); + } + + if (DrvControl[7] & 0x02) { + JumppopRenderPf1Layer(); + } else { + JumppopRenderCharLayer(); + } + + DrvRenderSprites(0, 1); + BurnTransferCopy(DrvPalette); +} + +#define NUM_SCANLINES 315 +#define SCANLINE_VBLANK_START 37 +#define SCANLINE_VBLANK_END SCANLINE_VBLANK_START + 240 + +static INT32 DrvFrame() +{ + INT32 nInterleave = NUM_SCANLINES; + INT32 nSoundBufferPos = 0; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + if (DrvHasZ80) ZetNewFrame(); + + DrvVBlank = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == SCANLINE_VBLANK_START) DrvVBlank = 1; + if (i == SCANLINE_VBLANK_END) DrvVBlank = 0; + if (i == NUM_SCANLINES - 1) { + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + if (Tumbleb2) Tumbleb2PlayMusic(); + } + SekClose(); + + if (DrvHasZ80) { + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (DrvHasYM2151) { + if (DrvHasZ80) ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + if (DrvHasZ80) ZetClose(); + } + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + if (DrvHasYM2151) { + if (DrvHasZ80) ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + if (DrvHasZ80) ZetClose(); + } + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) DrvRender(); + + return 0; +} + +static INT32 JumppopFrame() +{ + INT32 nInterleave = 1953 / 60; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == (nInterleave - 1)) { + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + } + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + BurnTimerUpdateYM3812(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + ZetNmi(); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + + if (pBurnDraw) JumppopDraw(); + + return 0; +} + +#undef NUM_SCANLINES +#undef SCANLINE_VBLANK_START +#undef SCANLINE_VBLANK_END + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029676; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + if (DrvHasZ80) ZetScan(nAction); + if (DrvHasYM2151) BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(DrvDip); + SCAN_VAR(DrvInput); + SCAN_VAR(DrvVBlank); + SCAN_VAR(DrvOkiBank); + SCAN_VAR(DrvZ80Bank); + SCAN_VAR(DrvTileBank); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(Tumbleb2MusicCommand); + SCAN_VAR(Tumbleb2MusicBank); + SCAN_VAR(Tumbleb2MusicIsPlaying); + } + + if (nAction & ACB_WRITE) { + if (DrvOkiBank) { + if (Jumpkids) { + memcpy(MSM6295ROM + 0x20000, DrvMSM6295ROMSrc + (DrvOkiBank * 0x20000), 0x20000); + } else { + memcpy(MSM6295ROM + 0x30000, DrvMSM6295ROMSrc + 0x30000 + (DrvOkiBank * 0x10000), 0x10000); + } + } + + if (DrvZ80Bank) { + ZetOpen(0); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom + (DrvZ80Bank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom + (DrvZ80Bank * 0x4000)); + ZetClose(); + } + } + + return 0; +} + +struct BurnDriver BurnDrvTumbleb = { + "tumbleb", "tumblep", NULL, NULL, "1991", + "Tumble Pop (bootleg set 1)\0", NULL, "Data East Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, TumblebRomInfo, TumblebRomName, NULL, NULL, TumblebInputInfo, TumblebDIPInfo, + TumblebInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvTumbleb2 = { + "tumbleb2", "tumblep", NULL, NULL, "1991", + "Tumble Pop (bootleg set 2)\0", NULL, "Data East Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, Tumbleb2RomInfo, Tumbleb2RomName, NULL, NULL, TumblebInputInfo, TumblebDIPInfo, + Tumbleb2Init, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvJumpkids = { + "jumpkids", NULL, NULL, NULL, "1993", + "Jump Kids\0", NULL, "Comad", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, JumpkidsRomInfo, JumpkidsRomName, NULL, NULL, TumblebInputInfo, TumblebDIPInfo, + JumpkidsInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvMetlsavr = { + "metlsavr", NULL, NULL, NULL, "1994", + "Metal Saver\0", NULL, "First Amusement", "Miscellaneous", + L"Metal Saver\0\uBA54\uD0C8\uC138\uC774\uBC84\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, MetlsavrRomInfo, MetlsavrRomName, NULL, NULL, MetlsavrInputInfo, MetlsavrDIPInfo, + MetlsavrInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPangpang = { + "pangpang", NULL, NULL, NULL, "1994", + "Pang Pang\0", NULL, "Dong Gue La Mi Ltd.", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, PangpangRomInfo, PangpangRomName, NULL, NULL, TumblebInputInfo, TumblebDIPInfo, + PangpangInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSuprtrio = { + "suprtrio", NULL, NULL, NULL, "1994", + "Super Trio\0", NULL, "Gameace", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, SuprtrioRomInfo, SuprtrioRomName, NULL, NULL, SuprtrioInputInfo, SuprtrioDIPInfo, + SuprtrioInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvHtchctch = { + "htchctch", NULL, NULL, NULL, "1995", + "Hatch Catch\0", NULL, "SemiCom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, HtchctchRomInfo, HtchctchRomName, NULL, NULL, HtchctchInputInfo, HtchctchDIPInfo, + HtchctchInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvCookbib = { + "cookbib", NULL, NULL, NULL, "1995", + "Cookie & Bibi\0", NULL, "SemiCom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, CookbibRomInfo, CookbibRomName, NULL, NULL, HtchctchInputInfo, CookbibDIPInfo, + CookbibInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvChokChok = { + "chokchok", NULL, NULL, NULL, "1995", + "Choky! Choky!\0", NULL, "SemiCom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, ChokchokRomInfo, ChokchokRomName, NULL, NULL, HtchctchInputInfo, ChokchokDIPInfo, + ChokchokInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvWlstar = { + "wlstar", NULL, NULL, NULL, "1995", + "Wonder League Star - Sok-Magicball Fighting (Korea)\0", NULL, "Mijin", "Miscellaneous", + L"\uC6D0\uB354\uB9AC\uADF8\uC2A4\uD0C0 - \uC18D \uB9E4\uC9C1\uBCFC \uD30C\uC774\uD305 (Korea)\0Wonder League Star - Sok-Magicball Fighting\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, + NULL, WlstarRomInfo, WlstarRomName, NULL, NULL, MetlsavrInputInfo, WlstarDIPInfo, + WlstarInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvWondl96 = { + "wondl96", NULL, NULL, NULL, "1995", + "Wonder League '96 (Korea)\0", NULL, "SemiCom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, + NULL, Wondl96RomInfo, Wondl96RomName, NULL, NULL, MetlsavrInputInfo, Wondl96DIPInfo, + Wondl96Init, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvFancywld = { + "fncywld", NULL, NULL, NULL, "1996", + "Fancy World - Earth of Crisis\0", NULL, "Unico", "Miscellaneous", + L"Fancy World - Earth of Crisis\0\uD39C\uC2DC\uC6D4\uB4DC \uD658\uC0C1\uC758 \uC138\uACC4 - Earth of Crisis\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, FncywldRomInfo, FncywldRomName, NULL, NULL, FncywldInputInfo, FncywldDIPInfo, + FncywldInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSdfight = { + "sdfight", NULL, NULL, NULL, "1996", + "SD Fighters (Korea)\0", NULL, "SemiCom", "Miscellaneous", + L"\uFF33\uFF24 \uD30C\uC774\uD130\uC988 (Korea)\0SD Fighters\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, SdfightRomInfo, SdfightRomName, NULL, NULL, MetlsavrInputInfo, SdfightDIPInfo, + SdfightInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvBcstry = { + "bcstry", NULL, NULL, NULL, "1997", + "B.C. Story (set 1)\0", NULL, "SemiCom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, + NULL, BcstryRomInfo, BcstryRomName, NULL, NULL, MetlsavrInputInfo, BcstryDIPInfo, + BcstryInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvBcstrya = { + "bcstrya", "bcstry", NULL, NULL, "1997", + "B.C. Story (set 2)\0", NULL, "SemiCom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, + NULL, BcstryaRomInfo, BcstryaRomName, NULL, NULL, MetlsavrInputInfo, BcstryDIPInfo, + BcstryInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSemibase = { + "semibase", NULL, NULL, NULL, "1997", + "MuHanSeungBu (SemiCom Baseball) (Korea)\0", NULL, "SemiCom", "Miscellaneous", + L"\u7121\u9650\u52DD\u8CA0\0\uC804\uC6D0 \uAD6D\uC81C\uB9AC\uADF8 \uC804 (SemiCom Baseball) (Korea)\0MuHanSeungBu\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SPORTSMISC, 0, + NULL, SemibaseRomInfo, SemibaseRomName, NULL, NULL, SemibaseInputInfo, SemibaseDIPInfo, + SemibaseInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvDquizgo = { + "dquizgo", NULL, NULL, NULL, "1998", + "Date Quiz Go Go (Korea)\0", NULL, "SemiCom", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, + NULL, DquizgoRomInfo, DquizgoRomName, NULL, NULL, MetlsavrInputInfo, DquizgoDIPInfo, + DquizgoInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x800, 320, 240, 4, 3 +}; + +// these should actually be in d_esd16.cpp (similar hardware) +struct BurnDriver BurnDrvJumppop = { + "jumppop", NULL, NULL, NULL, "2001", + "Jumping Pop (set 1)\0", NULL, "ESD", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, JumppopRomInfo, JumppopRomName, NULL, NULL, JumppopInputInfo, JumppopDIPInfo, + JumppopInit, JumppopExit, JumppopFrame, NULL, DrvScan, + NULL, 0x400, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvJumppope = { + "jumppope", "jumppop", NULL, NULL, "2001", + "Jumping Pop (set 2)\0", NULL, "Emag Soft", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, JumppopeRomInfo, JumppopeRomName, NULL, NULL, JumppopInputInfo, JumppopDIPInfo, + JumppopInit, JumppopExit, JumppopFrame, NULL, DrvScan, + NULL, 0x400, 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_welltris.cpp b/src/burn/drv/pst90s/d_welltris.cpp index a2e143ef3..c4bcf7068 100644 --- a/src/burn/drv/pst90s/d_welltris.cpp +++ b/src/burn/drv/pst90s/d_welltris.cpp @@ -1,965 +1,964 @@ -// FB Alpha Welltris driver module -// Based on MAME driver David Haywood - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2610.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvSndROM0; -static UINT8 *DrvSndROM1; -static UINT8 *Drv68KRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvPxlRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *soundlatch; -static UINT8 *pending_command; - -static UINT8 *flipscreen; -static UINT8 *sound_bank; -static UINT8 *gfx_bank; -static UINT8 *spritepalbank; -static UINT8 *pixelpalbank; -static UINT8 *charpalbank; - -static UINT16 *scroll; - -static UINT8 DrvInputs[6]; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvJoy6[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; - -static INT32 screen_y_offset; - -static struct BurnInputInfo WelltrisInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - -/* {"P3 Coin", BIT_DIGITAL, DrvJoy6 + 0, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, DrvJoy6 + 2, "p3 start" }, - {"P3 Up", BIT_DIGITAL, DrvJoy4 + 0, "p3 up" }, - {"P3 Down", BIT_DIGITAL, DrvJoy4 + 1, "p3 down" }, - {"P3 Left", BIT_DIGITAL, DrvJoy4 + 2, "p3 left" }, - {"P3 Right", BIT_DIGITAL, DrvJoy4 + 3, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p3 fire 2" }, - - {"P4 Coin", BIT_DIGITAL, DrvJoy6 + 1, "p4 coin" }, - {"P4 Start", BIT_DIGITAL, DrvJoy6 + 3, "p4 start" }, - {"P4 Up", BIT_DIGITAL, DrvJoy5 + 0, "p4 up" }, - {"P4 Down", BIT_DIGITAL, DrvJoy5 + 1, "p4 down" }, - {"P4 Left", BIT_DIGITAL, DrvJoy5 + 2, "p4 left" }, - {"P4 Right", BIT_DIGITAL, DrvJoy5 + 3, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, DrvJoy5 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, DrvJoy5 + 5, "p4 fire 2" },*/ - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Test", BIT_DIGITAL, DrvJoy1 + 4, "diag" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, -// {"Tilt", BIT_DIGITAL, DrvJoy1 + 5, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Welltris) - -static struct BurnInputInfo Quiz18kInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Quiz18k) - -static struct BurnDIPInfo WelltrisDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x13, 0x01, 0x0f, 0x06, "5 Coins 1 Credit" }, - {0x13, 0x01, 0x0f, 0x07, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x0f, 0x08, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x0f, 0x09, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x0f, 0x04, "2-1, 4-2, 5-3, 6-4" }, - {0x13, 0x01, 0x0f, 0x03, "2-1, 4-3" }, - {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x0f, 0x01, "1-1, 2-2, 3-3, 4-5" }, - {0x13, 0x01, 0x0f, 0x02, "1-1, 2-2, 3-3, 4-4, 5-6" }, - {0x13, 0x01, 0x0f, 0x00, "1-1, 2-3" }, - {0x13, 0x01, 0x0f, 0x05, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x13, 0x01, 0xf0, 0x60, "5 Coins 1 Credit" }, - {0x13, 0x01, 0xf0, 0x70, "4 Coins 1 Credit" }, - {0x13, 0x01, 0xf0, 0x80, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xf0, 0x90, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xf0, 0x40, "2-1, 4-2, 5-3, 6-4" }, - {0x13, 0x01, 0xf0, 0x30, "2-1, 4-3" }, - {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xf0, 0x10, "1-1, 2-2, 3-3, 4-5" }, - {0x13, 0x01, 0xf0, 0x20, "1-1, 2-2, 3-3, 4-4, 5-6" }, - {0x13, 0x01, 0xf0, 0x00, "1-1, 2-3" }, - {0x13, 0x01, 0xf0, 0x50, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Normal" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x14, 0x01, 0x04, 0x04, "Mono Player" }, - {0x14, 0x01, 0x04, 0x00, "Many Player" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x08, 0x00, "Off" }, - {0x14, 0x01, 0x08, 0x08, "On" }, - -// {0 , 0xfe, 0 , 2, "DIPSW 2-5 (see notes)" }, -// {0x14, 0x01, 0x10, 0x10, "Off" }, -// {0x14, 0x01, 0x10, 0x00, "On" }, - -// {0 , 0xfe, 0 , 2, "4 Players Mode" }, -// {0x14, 0x01, 0x30, 0x30, "Off" }, -// {0x14, 0x01, 0x30, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Welltris) - -static struct BurnDIPInfo Quiz18kDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xfd, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Title Logo Type" }, - {0x15, 0x01, 0x20, 0x20, "1" }, - {0x15, 0x01, 0x20, 0x00, "2" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Quiz18k) - -inline void WelltrisClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static void cpu_sync() -{ - UINT32 cycles = (SekTotalCycles() * 2) - (ZetTotalCycles() * 5); - - if (cycles > 5) { - BurnTimerUpdate(cycles / 5); - } -} - -static inline void sprite_hack(INT32 offset) -{ - UINT16 *ram = (UINT16*)DrvSprRAM; - - if (offset == 0x3fc) { - if (ram[0x1fc] == 0 && ram[0x1fd] == 0 && ram[0x1ff] == 0) { - memset (DrvSprRAM, 0, 0x3fc); - } - } -} - -static inline void palette_write(INT32 offset) -{ - UINT16 p = *((UINT16*)(DrvPalRAM + offset)); - - INT32 r = (p >> 10) & 0x1f; - INT32 g = (p >> 5) & 0x1f; - INT32 b = (p >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[offset / 2] = BurnHighCol(r, g, b, 0); -} - -void __fastcall welltris_main_write_byte(UINT32 address, UINT8 data) -{ - if ((address & 0xfffffc00) == 0xffc000) { - DrvSprRAM[(address & 0x3ff) ^ 1] = data; - sprite_hack(address & 0x3fe); - return; - } - - if ((address & 0xfffff000) == 0xffe000) { - DrvPalRAM[(address & 0xfff) ^ 1] = data; - palette_write(address & 0xffe); - return; - } - - switch (address) - { - case 0xfff001: - *charpalbank = data & 0x03; - *pixelpalbank =(data & 0x08) >> 3; - *spritepalbank =(data & 0x20) >> 5; - *flipscreen = data & 0x80; - return; - - case 0xfff003: - gfx_bank[0] = data >> 4; - gfx_bank[1] = data & 0x0f; - return; - - case 0xfff009: - cpu_sync(); - *pending_command = 0x80; - *soundlatch = data; - ZetNmi(); - return; - } -} - -void __fastcall welltris_main_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfffffc00) == 0xffc000) { - *((UINT16*)(DrvSprRAM + (address & 0x3fe))) = data; - sprite_hack(address & 0x3fe); - return; - } - - if ((address & 0xfffff000) == 0xffe000) { - *((UINT16*)(DrvPalRAM + (address & 0xffe))) = data; - palette_write(address & 0xffe); - return; - } - - switch (address) - { - case 0xfff004: - scroll[0] = data - 14; - return; - - case 0xfff006: - scroll[1] = data; - return; - } -} - -UINT8 __fastcall welltris_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0xfff001: - return ~DrvInputs[1]; - - case 0xfff003: - return ~DrvInputs[2]; - - case 0xfff005: - return ~DrvInputs[3]; - - case 0xfff007: - return ~DrvInputs[4]; - - case 0xfff009: - cpu_sync(); - return (DrvInputs[0] & 0x7f) | *pending_command; - - case 0xfff00b: - return ~DrvInputs[5]; - - case 0xfff00d: - return DrvDips[0]; - - case 0xfff00f: - return DrvDips[1]; - } - - return 0; -} - -UINT16 __fastcall welltris_main_read_word(UINT32 ) -{ - return 0; -} - -static void bankswitch(INT32 data) -{ - sound_bank[0] = data; - - ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + (data & 0x03) * 0x8000); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + (data & 0x03) * 0x8000); -} - -void __fastcall welltris_sound_write_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - bankswitch(data); - return; - - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - BurnYM2610Write(port & 3, data); - return; - - case 0x18: - *pending_command = 0; - return; - } -} - -UINT8 __fastcall welltris_sound_read_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x08: - return BurnYM2610Read(0); - - case 0x0a: - return BurnYM2610Read(2); - - case 0x10: - return *soundlatch; - } - - return 0; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000.0; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2610Reset(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x180000; - DrvZ80ROM = Next; Next += 0x020000; - - DrvGfxROM0 = Next; Next += 0x300000; - DrvGfxROM1 = Next; Next += 0x200000; - - DrvSndROM0 = Next; Next += 0x080000; - DrvSndROM1 = Next; Next += 0x100000; - - DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x004000; - DrvPalRAM = Next; Next += 0x001000; - DrvSprRAM = Next; Next += 0x000400; - DrvVidRAM = Next; Next += 0x001000; - DrvPxlRAM = Next; Next += 0x020000; - - DrvZ80RAM = Next; Next += 0x000800; - - soundlatch = Next; Next += 0x000001; - pending_command = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - sound_bank = Next; Next += 0x000001; - - gfx_bank = Next; Next += 0x000002; - - charpalbank = Next; Next += 0x000001; - spritepalbank = Next; Next += 0x000001; - pixelpalbank = Next; Next += 0x000001; - - scroll = (UINT16*)Next; Next += 0x000002 * sizeof(UINT16); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void DrvGfxExpand(UINT8 *gfx, INT32 len) // gfx0 - 0, gfx1 - 600 -{ - for (INT32 i = len - 1; i >= 0; i--) { - gfx[i * 2 + 1] = gfx[i] >> 4; - gfx[i * 2 + 0] = gfx[i] & 0x0f; - } -} - -static void DrvFixSprites() -{ - for (INT32 i = 0; i < 0x100000; i+=4) { - INT32 t = DrvGfxROM1[i + 1]; - DrvGfxROM1[i + 1] = DrvGfxROM1[i + 2]; - DrvGfxROM1[i + 2] = t; - } -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - screen_y_offset = (strncmp(BurnDrvGetTextA(DRV_NAME), "welltris", 8) == 0) ? 8 : 0; - - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x100001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x100000, 3, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 4, 1)) return 1; - - if (BurnLoadRom(DrvSndROM0, 5, 1)) return 1; - - if (BurnLoadRom(DrvSndROM1 + 0x00000, 6, 1)) return 1; - if (BurnLoadRom(DrvSndROM1 + 0x80000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 2)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x00001, 9, 2)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 10, 1)) return 1; - - if (screen_y_offset == 0) { - if (BurnLoadRom(DrvGfxROM0 + 0x080000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x100000, 12, 1)) return 1; - } else { - // welltris 4 player hack (change ori 0030 to 0000 - *((UINT16 *)(Drv68KROM + 0xB91E)) = 0x0000; - } - - DrvFixSprites(); - DrvGfxExpand(DrvGfxROM0, 0x180000); - DrvGfxExpand(DrvGfxROM1, 0x100000); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM + 0x000000, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Drv68KROM + 0x100000, 0x100000, 0x17ffff, SM_ROM); - SekMapMemory(DrvPxlRAM, 0x800000, 0x81ffff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xff8000, 0xffbfff, SM_RAM); - SekMapMemory(DrvSprRAM, 0xffc000, 0xffc3ff, SM_ROM); - SekMapMemory(DrvVidRAM, 0xffd000, 0xffdfff, SM_RAM); - SekMapMemory(DrvPalRAM, 0xffe000, 0xffefff, SM_ROM); - SekSetWriteByteHandler(0, welltris_main_write_byte); - SekSetWriteWordHandler(0, welltris_main_write_word); - SekSetReadByteHandler(0, welltris_main_read_byte); - SekSetReadWordHandler(0, welltris_main_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x77ff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x77ff, 2, DrvZ80ROM); - ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); - ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); - ZetSetOutHandler(welltris_sound_write_port); - ZetSetInHandler(welltris_sound_read_port); - ZetMemEnd(); - ZetClose(); - - INT32 DrvSndROMLen1 = 0x100000; - INT32 DrvSndROMLen0 = 0x080000; - - BurnYM2610Init(8000000, DrvSndROM1, &DrvSndROMLen1, DrvSndROM0, &DrvSndROMLen0, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 0.75, BURN_SND_ROUTE_BOTH); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 0.75, BURN_SND_ROUTE_BOTH); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - BurnYM2610Exit(); - - ZetExit(); - SekExit(); - - BurnFree(AllMem); - - return 0; -} - -static void draw_sprites() -{ - UINT16 *ram = (UINT16*)DrvSprRAM; - static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; - - for (INT32 offs = 0; offs < 0x200 - 4; offs += 4) { - INT32 data0 = ram[offs + 0]; - INT32 data1 = ram[offs + 1]; - INT32 data2 = ram[offs + 2]; - INT32 data3 = ram[offs + 3]; - - INT32 code = data3 & 0x1fff; - INT32 color = (data2 & 0x0f) + (0x10 * *spritepalbank) + 0x60; - INT32 y = (data0 & 0x1ff) + 1 - screen_y_offset; - INT32 x = (data1 & 0x1ff) + 6 - 15; - INT32 yzoom = (data0 >> 12) & 15; - INT32 xzoom = (data1 >> 12) & 15; - INT32 zoomed = (xzoom | yzoom); - INT32 ytiles = ((data2 >> 12) & 7) + 1; - INT32 xtiles = ((data2 >> 8) & 7) + 1; - INT32 yflip = (data2 >> 15) & 1; - INT32 xflip = (data2 >> 11) & 1; - INT32 xt, yt; - - if (!(ram[offs + 2] & 0x0080)) continue; - - xzoom = 16 - zoomtable[xzoom] / 8; - yzoom = 16 - zoomtable[yzoom] / 8; - - if (x >= 0x200) x -= 0x200; - if (y >= 0x200) y -= 0x200; - - if (!xflip && !yflip) { - for (yt = 0; yt < ytiles; yt++) { - for (xt = 0; xt < xtiles; xt++, code++) { - if (!zoomed) - Render16x16Tile_Mask_Clip(pTransDraw, code, x + xt * 16, y + yt * 16, color, 4, 15, 0, DrvGfxROM1); - else - RenderZoomedTile(pTransDraw, DrvGfxROM1, code, color << 4, 15, x + xt * xzoom, y + yt * yzoom, 0, 0, 16, 16, 0x1000 * xzoom, 0x1000 * yzoom); - } - if (xtiles == 3) code += 1; - if (xtiles == 5) code += 3; - if (xtiles == 6) code += 2; - if (xtiles == 7) code += 1; - } - } - else if (xflip && !yflip) { - for (yt = 0; yt < ytiles; yt++) { - for (xt = 0; xt < xtiles; xt++, code++) { - if (!zoomed) - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x + (xtiles - 1 - xt) * 16, y + yt * 16, color, 4, 15, 0, DrvGfxROM1); - else - RenderZoomedTile(pTransDraw, DrvGfxROM1, code, color << 4, 15, x + (xtiles - 1 - xt) * xzoom, y + yt * yzoom, 1, 0, 16, 16, 0x1000 * xzoom, 0x1000 * yzoom); - } - if (xtiles == 3) code += 1; - if (xtiles == 5) code += 3; - if (xtiles == 6) code += 2; - if (xtiles == 7) code += 1; - } - } - else if (!xflip && yflip) { - for (yt = 0; yt < ytiles; yt++) { - for (xt = 0; xt < xtiles; xt++, code++) { - if (!zoomed) - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x + xt * 16, y + (ytiles - 1 - yt) * 16, color, 4, 15, 0, DrvGfxROM1); - else - RenderZoomedTile(pTransDraw, DrvGfxROM1, code, color << 4, 15, x + xt * xzoom, y + (ytiles - 1 - yt) * yzoom, 0, 1, 16, 16, 0x1000 * xzoom, 0x1000 * yzoom); - } - if (xtiles == 3) code += 1; - if (xtiles == 5) code += 3; - if (xtiles == 6) code += 2; - if (xtiles == 7) code += 1; - } - } - else { - for (yt = 0; yt < ytiles; yt++) { - for (xt = 0; xt < xtiles; xt++, code++) { - if (!zoomed) - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x + (xtiles - 1 - xt) * 16, y + (ytiles - 1 - yt) * 16, color, 4, 15, 0, DrvGfxROM1); - else - RenderZoomedTile(pTransDraw, DrvGfxROM1, code, color << 4, 15, x + (xtiles - 1 - xt) * xzoom, y + (ytiles - 1 - yt) * yzoom, 1, 1, 16, 16, 0x1000 * xzoom, 0x1000 * yzoom); - } - if (xtiles == 3) code += 1; - if (xtiles == 5) code += 3; - if (xtiles == 6) code += 2; - if (xtiles == 7) code += 1; - } - } - } -} - -static void draw_foreground() -{ - INT32 color_bank = *charpalbank << 3; - INT32 scrollx = scroll[0] & 0x1ff; - INT32 scrolly = scroll[1] & 0x0ff; - - UINT16 *vram = (UINT16*)DrvVidRAM; - - for (INT32 offs = 0; offs < 64 * 32; offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - sx -= scrollx; - if (sx < -7) sx += 512; - sy -= scrolly; - if (sy < -7) sy += 256; - - INT32 attr = vram[offs]; - INT32 code = (attr & 0xfff) | (gfx_bank[(attr >> 12) & 1] << 12); - INT32 color = (attr >> 13) | color_bank; - - Render8x8Tile_Mask_Clip(pTransDraw, code, sx - 15, sy - screen_y_offset, color & 0x7f, 4, 15, 0, DrvGfxROM0); - } -} - -static void draw_background() -{ - INT32 color_bank = 0x400 + (*pixelpalbank << 8); - - UINT16 *vram = (UINT16*)DrvPxlRAM; - - for (INT32 offs = (screen_y_offset * 256); offs < 256 * 256; offs++) - { - INT32 sx = ((offs & 0xff) << 1) - 15; - INT32 sy = (offs >> 8) - screen_y_offset; - - INT32 pxl = vram[offs]; - - if (sy < nScreenHeight && sy >= 0) { - if (sx >= 0 && sx < nScreenWidth) pTransDraw[sy * nScreenWidth + sx++] = color_bank | (pxl >> 8); - if (sx >= 0 && sx < nScreenWidth) pTransDraw[sy * nScreenWidth + sx ] = color_bank | (pxl & 0xff); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x1000; i+=2) { - palette_write(i); - } - DrvRecalc = 0; - } - - BurnTransferClear(); - - draw_background(); - draw_foreground(); - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - SekNewFrame(); - ZetNewFrame(); - - { - DrvInputs[0] = 0xff; - DrvInputs[1] = 0x00; - DrvInputs[2] = 0x00; - DrvInputs[3] = 0x00; - DrvInputs[4] = 0x00; - DrvInputs[5] = 0x00; - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] |= (DrvJoy2[i] & 1) << i; - DrvInputs[2] |= (DrvJoy3[i] & 1) << i; - DrvInputs[3] |= (DrvJoy4[i] & 1) << i; - DrvInputs[4] |= (DrvJoy5[i] & 1) << i; - DrvInputs[5] |= (DrvJoy6[i] & 1) << i; - } - } - - // Clear Opposites - WelltrisClearOpposites(&DrvInputs[1]); - WelltrisClearOpposites(&DrvInputs[2]); -// WelltrisClearOpposites(&DrvInputs[3]); -// WelltrisClearOpposites(&DrvInputs[4]); - - SekOpen(0); - ZetOpen(0); - - SekRun(10000000 / 60); - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrame(4000000 / 60); - - if (pBurnSoundOut) { - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029707; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2610Scan(nAction, pnMin); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - bankswitch(sound_bank[0]); - ZetClose(); - } - - return 0; -} - - -// Welltris - Alexey Pajitnov's (World?, 2 players) - -static struct BurnRomInfo welltrisRomDesc[] = { - { "j2u.8", 0x20000, 0x7488fe94, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "j1u.7", 0x20000, 0x571413ac, 1 | BRF_PRG | BRF_ESS }, // 1 - { "lh532j10.10", 0x40000, 0x1187c665, 1 | BRF_PRG | BRF_ESS }, // 2 - { "lh532j11.9", 0x40000, 0x18eda9e5, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "3.144", 0x20000, 0xae8f763e, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "lh534j11.126", 0x80000, 0xbf85fb0d, 3 | BRF_SND }, // 5 ADPCM-B Samples - - { "lh534j09.123", 0x80000, 0x6c2ce9a5, 4 | BRF_SND }, // 6 ADPCM-A Samples - { "lh534j10.124", 0x80000, 0xe3682221, 4 | BRF_SND }, // 7 - - { "046.93", 0x40000, 0x31d96d77, 5 | BRF_GRA }, // 8 Sprites - { "048.94", 0x40000, 0xbb4643da, 5 | BRF_GRA }, // 9 - - { "lh534j12.77", 0x80000, 0xb61a8b74, 6 | BRF_GRA }, // 10 Tiles -}; - -STD_ROM_PICK(welltris) -STD_ROM_FN(welltris) - -struct BurnDriver BurnDrvWelltris = { - "welltris", NULL, NULL, NULL, "1991", - "Welltris - Alexey Pajitnov's (World?, 2 players)\0", NULL, "Video System Co.", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, welltrisRomInfo, welltrisRomName, NULL, NULL, WelltrisInputInfo, WelltrisDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 352, 240, 4, 3 -}; - - -// Welltris - Alexey Pajitnov's (Japan, 2 players) - -static struct BurnRomInfo welltrisjRomDesc[] = { - { "j2.8", 0x20000, 0x68ec5691, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu - { "j1.7", 0x20000, 0x1598ea2c, 1 | BRF_PRG | BRF_ESS }, // 1 - { "lh532j10.10", 0x40000, 0x1187c665, 1 | BRF_PRG | BRF_ESS }, // 2 - { "lh532j11.9", 0x40000, 0x18eda9e5, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "3.144", 0x20000, 0xae8f763e, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "lh534j11.126", 0x80000, 0xbf85fb0d, 3 | BRF_SND }, // 5 ADPCM-B Samples - - { "lh534j09.123", 0x80000, 0x6c2ce9a5, 4 | BRF_SND }, // 6 ADPCM-A Samples - { "lh534j10.124", 0x80000, 0xe3682221, 4 | BRF_SND }, // 7 - - { "046.93", 0x40000, 0x31d96d77, 5 | BRF_GRA }, // 8 Sprites - { "048.94", 0x40000, 0xbb4643da, 5 | BRF_GRA }, // 9 - - { "lh534j12.77", 0x80000, 0xb61a8b74, 6 | BRF_GRA }, // 10 Tiles -}; - -STD_ROM_PICK(welltrisj) -STD_ROM_FN(welltrisj) - -struct BurnDriver BurnDrvWelltrisj = { - "welltrisj", "welltris", NULL, NULL, "1991", - "Welltris - Alexey Pajitnov's (Japan, 2 players)\0", NULL, "Video System Co.", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, welltrisjRomInfo, welltrisjRomName, NULL, NULL, WelltrisInputInfo, WelltrisDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 352, 240, 4, 3 -}; - - -// Miyasu Nonki no Quiz 18-Kin - -static struct BurnRomInfo quiz18kRomDesc[] = { - { "1-ic8.bin", 0x20000, 0x10a64336, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code - { "2-ic7.bin", 0x20000, 0x8b21b431, 1 | BRF_PRG | BRF_ESS }, // 1 - { "ic10.bin", 0x40000, 0x501453a3, 1 | BRF_PRG | BRF_ESS }, // 2 - { "ic9.bin", 0x40000, 0x99b6840f, 1 | BRF_PRG | BRF_ESS }, // 3 - - { "3-ic144.bin", 0x20000, 0x72d372e3, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code - - { "ic126.bin", 0x40000, 0x7a92fbc9, 3 | BRF_SND }, // 5 ADPCM-B Samples - - { "ic123.bin", 0x80000, 0xee4995cf, 4 | BRF_SND }, // 6 ADPCM-A Samples - { "ic124.bin", 0x40000, 0x076f58c3, 4 | BRF_SND }, // 7 - - { "ic93.bin", 0x80000, 0x4d387c5e, 5 | BRF_GRA }, // 8 Sprites - { "ic94.bin", 0x80000, 0x6be2f164, 5 | BRF_GRA }, // 9 - - { "ic77.bin", 0x80000, 0xaf3b6fd1, 6 | BRF_GRA }, // 10 Tiles - { "ic78.bin", 0x80000, 0x44bbdef3, 6 | BRF_GRA }, // 11 - { "ic79.bin", 0x80000, 0xd721e169, 6 | BRF_GRA }, // 12 -}; - -STD_ROM_PICK(quiz18k) -STD_ROM_FN(quiz18k) - -struct BurnDriver BurnDrvQuiz18k = { - "quiz18k", NULL, NULL, NULL, "1992", - "Miyasu Nonki no Quiz 18-Kin\0", NULL, "EIM", "Miscellaneous", - L"\u307F\u3084\u3059\u306E\u3093\u304D\u306E \u30AF\u30A4\u30BA\uFF11\uFF18\u7981 \uFF24\uFF52\uFF0E \u30A8\u30C3\u3061\u3083\u3093\u306E\u8A3A\u5BDF\u5BA4\0Miyasu Nonki no Quiz 18-Kin\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, - NULL, quiz18kRomInfo, quiz18kRomName, NULL, NULL, Quiz18kInputInfo, Quiz18kDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, - 320, 224, 4, 3 -}; +// FB Alpha Welltris driver module +// Based on MAME driver David Haywood + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2610.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvSndROM0; +static UINT8 *DrvSndROM1; +static UINT8 *Drv68KRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvPxlRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *soundlatch; +static UINT8 *pending_command; + +static UINT8 *flipscreen; +static UINT8 *sound_bank; +static UINT8 *gfx_bank; +static UINT8 *spritepalbank; +static UINT8 *pixelpalbank; +static UINT8 *charpalbank; + +static UINT16 *scroll; + +static UINT8 DrvInputs[6]; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvJoy6[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; + +static INT32 screen_y_offset; + +static struct BurnInputInfo WelltrisInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + +/* {"P3 Coin", BIT_DIGITAL, DrvJoy6 + 0, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, DrvJoy6 + 2, "p3 start" }, + {"P3 Up", BIT_DIGITAL, DrvJoy4 + 0, "p3 up" }, + {"P3 Down", BIT_DIGITAL, DrvJoy4 + 1, "p3 down" }, + {"P3 Left", BIT_DIGITAL, DrvJoy4 + 2, "p3 left" }, + {"P3 Right", BIT_DIGITAL, DrvJoy4 + 3, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p3 fire 2" }, + + {"P4 Coin", BIT_DIGITAL, DrvJoy6 + 1, "p4 coin" }, + {"P4 Start", BIT_DIGITAL, DrvJoy6 + 3, "p4 start" }, + {"P4 Up", BIT_DIGITAL, DrvJoy5 + 0, "p4 up" }, + {"P4 Down", BIT_DIGITAL, DrvJoy5 + 1, "p4 down" }, + {"P4 Left", BIT_DIGITAL, DrvJoy5 + 2, "p4 left" }, + {"P4 Right", BIT_DIGITAL, DrvJoy5 + 3, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, DrvJoy5 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, DrvJoy5 + 5, "p4 fire 2" },*/ + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Test", BIT_DIGITAL, DrvJoy1 + 4, "diag" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, +// {"Tilt", BIT_DIGITAL, DrvJoy1 + 5, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Welltris) + +static struct BurnInputInfo Quiz18kInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Quiz18k) + +static struct BurnDIPInfo WelltrisDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x13, 0x01, 0x0f, 0x06, "5 Coins 1 Credit" }, + {0x13, 0x01, 0x0f, 0x07, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x0f, 0x08, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x0f, 0x09, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x0f, 0x04, "2-1, 4-2, 5-3, 6-4" }, + {0x13, 0x01, 0x0f, 0x03, "2-1, 4-3" }, + {0x13, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x0f, 0x01, "1-1, 2-2, 3-3, 4-5" }, + {0x13, 0x01, 0x0f, 0x02, "1-1, 2-2, 3-3, 4-4, 5-6" }, + {0x13, 0x01, 0x0f, 0x00, "1-1, 2-3" }, + {0x13, 0x01, 0x0f, 0x05, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x13, 0x01, 0xf0, 0x60, "5 Coins 1 Credit" }, + {0x13, 0x01, 0xf0, 0x70, "4 Coins 1 Credit" }, + {0x13, 0x01, 0xf0, 0x80, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xf0, 0x90, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xf0, 0x40, "2-1, 4-2, 5-3, 6-4" }, + {0x13, 0x01, 0xf0, 0x30, "2-1, 4-3" }, + {0x13, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xf0, 0x10, "1-1, 2-2, 3-3, 4-5" }, + {0x13, 0x01, 0xf0, 0x20, "1-1, 2-2, 3-3, 4-4, 5-6" }, + {0x13, 0x01, 0xf0, 0x00, "1-1, 2-3" }, + {0x13, 0x01, 0xf0, 0x50, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Normal" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x14, 0x01, 0x04, 0x04, "Mono Player" }, + {0x14, 0x01, 0x04, 0x00, "Many Player" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x08, 0x00, "Off" }, + {0x14, 0x01, 0x08, 0x08, "On" }, + +// {0 , 0xfe, 0 , 2, "DIPSW 2-5 (see notes)" }, +// {0x14, 0x01, 0x10, 0x10, "Off" }, +// {0x14, 0x01, 0x10, 0x00, "On" }, + +// {0 , 0xfe, 0 , 2, "4 Players Mode" }, +// {0x14, 0x01, 0x30, 0x30, "Off" }, +// {0x14, 0x01, 0x30, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Welltris) + +static struct BurnDIPInfo Quiz18kDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xfd, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Title Logo Type" }, + {0x15, 0x01, 0x20, 0x20, "1" }, + {0x15, 0x01, 0x20, 0x00, "2" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Quiz18k) + +inline void WelltrisClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static void cpu_sync() +{ + UINT32 cycles = (SekTotalCycles() * 2) - (ZetTotalCycles() * 5); + + if (cycles > 5) { + BurnTimerUpdate(cycles / 5); + } +} + +static inline void sprite_hack(INT32 offset) +{ + UINT16 *ram = (UINT16*)DrvSprRAM; + + if (offset == 0x3fc) { + if (ram[0x1fc] == 0 && ram[0x1fd] == 0 && ram[0x1ff] == 0) { + memset (DrvSprRAM, 0, 0x3fc); + } + } +} + +static inline void palette_write(INT32 offset) +{ + UINT16 p = *((UINT16*)(DrvPalRAM + offset)); + + INT32 r = (p >> 10) & 0x1f; + INT32 g = (p >> 5) & 0x1f; + INT32 b = (p >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[offset / 2] = BurnHighCol(r, g, b, 0); +} + +void __fastcall welltris_main_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfffffc00) == 0xffc000) { + DrvSprRAM[(address & 0x3ff) ^ 1] = data; + sprite_hack(address & 0x3fe); + return; + } + + if ((address & 0xfffff000) == 0xffe000) { + DrvPalRAM[(address & 0xfff) ^ 1] = data; + palette_write(address & 0xffe); + return; + } + + switch (address) + { + case 0xfff001: + *charpalbank = data & 0x03; + *pixelpalbank =(data & 0x08) >> 3; + *spritepalbank =(data & 0x20) >> 5; + *flipscreen = data & 0x80; + return; + + case 0xfff003: + gfx_bank[0] = data >> 4; + gfx_bank[1] = data & 0x0f; + return; + + case 0xfff009: + cpu_sync(); + *pending_command = 0x80; + *soundlatch = data; + ZetNmi(); + return; + } +} + +void __fastcall welltris_main_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfffffc00) == 0xffc000) { + *((UINT16*)(DrvSprRAM + (address & 0x3fe))) = data; + sprite_hack(address & 0x3fe); + return; + } + + if ((address & 0xfffff000) == 0xffe000) { + *((UINT16*)(DrvPalRAM + (address & 0xffe))) = data; + palette_write(address & 0xffe); + return; + } + + switch (address) + { + case 0xfff004: + scroll[0] = data - 14; + return; + + case 0xfff006: + scroll[1] = data; + return; + } +} + +UINT8 __fastcall welltris_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0xfff001: + return ~DrvInputs[1]; + + case 0xfff003: + return ~DrvInputs[2]; + + case 0xfff005: + return ~DrvInputs[3]; + + case 0xfff007: + return ~DrvInputs[4]; + + case 0xfff009: + cpu_sync(); + return (DrvInputs[0] & 0x7f) | *pending_command; + + case 0xfff00b: + return ~DrvInputs[5]; + + case 0xfff00d: + return DrvDips[0]; + + case 0xfff00f: + return DrvDips[1]; + } + + return 0; +} + +UINT16 __fastcall welltris_main_read_word(UINT32 ) +{ + return 0; +} + +static void bankswitch(INT32 data) +{ + sound_bank[0] = data; + + ZetMapArea(0x8000, 0xffff, 0, DrvZ80ROM + (data & 0x03) * 0x8000); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80ROM + (data & 0x03) * 0x8000); +} + +void __fastcall welltris_sound_write_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + bankswitch(data); + return; + + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + BurnYM2610Write(port & 3, data); + return; + + case 0x18: + *pending_command = 0; + return; + } +} + +UINT8 __fastcall welltris_sound_read_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x08: + return BurnYM2610Read(0); + + case 0x0a: + return BurnYM2610Read(2); + + case 0x10: + return *soundlatch; + } + + return 0; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000.0; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2610Reset(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x180000; + DrvZ80ROM = Next; Next += 0x020000; + + DrvGfxROM0 = Next; Next += 0x300000; + DrvGfxROM1 = Next; Next += 0x200000; + + DrvSndROM0 = Next; Next += 0x080000; + DrvSndROM1 = Next; Next += 0x100000; + + DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x004000; + DrvPalRAM = Next; Next += 0x001000; + DrvSprRAM = Next; Next += 0x000400; + DrvVidRAM = Next; Next += 0x001000; + DrvPxlRAM = Next; Next += 0x020000; + + DrvZ80RAM = Next; Next += 0x000800; + + soundlatch = Next; Next += 0x000001; + pending_command = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + sound_bank = Next; Next += 0x000001; + + gfx_bank = Next; Next += 0x000002; + + charpalbank = Next; Next += 0x000001; + spritepalbank = Next; Next += 0x000001; + pixelpalbank = Next; Next += 0x000001; + + scroll = (UINT16*)Next; Next += 0x000002 * sizeof(UINT16); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void DrvGfxExpand(UINT8 *gfx, INT32 len) // gfx0 - 0, gfx1 - 600 +{ + for (INT32 i = len - 1; i >= 0; i--) { + gfx[i * 2 + 1] = gfx[i] >> 4; + gfx[i * 2 + 0] = gfx[i] & 0x0f; + } +} + +static void DrvFixSprites() +{ + for (INT32 i = 0; i < 0x100000; i+=4) { + INT32 t = DrvGfxROM1[i + 1]; + DrvGfxROM1[i + 1] = DrvGfxROM1[i + 2]; + DrvGfxROM1[i + 2] = t; + } +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + screen_y_offset = (strncmp(BurnDrvGetTextA(DRV_NAME), "welltris", 8) == 0) ? 8 : 0; + + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x100001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x100000, 3, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 4, 1)) return 1; + + if (BurnLoadRom(DrvSndROM0, 5, 1)) return 1; + + if (BurnLoadRom(DrvSndROM1 + 0x00000, 6, 1)) return 1; + if (BurnLoadRom(DrvSndROM1 + 0x80000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 2)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x00001, 9, 2)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 10, 1)) return 1; + + if (screen_y_offset == 0) { + if (BurnLoadRom(DrvGfxROM0 + 0x080000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x100000, 12, 1)) return 1; + } else { + // welltris 4 player hack (change ori 0030 to 0000 + *((UINT16 *)(Drv68KROM + 0xB91E)) = 0x0000; + } + + DrvFixSprites(); + DrvGfxExpand(DrvGfxROM0, 0x180000); + DrvGfxExpand(DrvGfxROM1, 0x100000); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM + 0x000000, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Drv68KROM + 0x100000, 0x100000, 0x17ffff, SM_ROM); + SekMapMemory(DrvPxlRAM, 0x800000, 0x81ffff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xff8000, 0xffbfff, SM_RAM); + SekMapMemory(DrvSprRAM, 0xffc000, 0xffc3ff, SM_ROM); + SekMapMemory(DrvVidRAM, 0xffd000, 0xffdfff, SM_RAM); + SekMapMemory(DrvPalRAM, 0xffe000, 0xffefff, SM_ROM); + SekSetWriteByteHandler(0, welltris_main_write_byte); + SekSetWriteWordHandler(0, welltris_main_write_word); + SekSetReadByteHandler(0, welltris_main_read_byte); + SekSetReadWordHandler(0, welltris_main_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x77ff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x77ff, 2, DrvZ80ROM); + ZetMapArea(0x7800, 0x7fff, 0, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 1, DrvZ80RAM); + ZetMapArea(0x7800, 0x7fff, 2, DrvZ80RAM); + ZetSetOutHandler(welltris_sound_write_port); + ZetSetInHandler(welltris_sound_read_port); + ZetClose(); + + INT32 DrvSndROMLen1 = 0x100000; + INT32 DrvSndROMLen0 = 0x080000; + + BurnYM2610Init(8000000, DrvSndROM1, &DrvSndROMLen1, DrvSndROM0, &DrvSndROMLen0, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 0.75, BURN_SND_ROUTE_BOTH); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 0.75, BURN_SND_ROUTE_BOTH); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + BurnYM2610Exit(); + + ZetExit(); + SekExit(); + + BurnFree(AllMem); + + return 0; +} + +static void draw_sprites() +{ + UINT16 *ram = (UINT16*)DrvSprRAM; + static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; + + for (INT32 offs = 0; offs < 0x200 - 4; offs += 4) { + INT32 data0 = ram[offs + 0]; + INT32 data1 = ram[offs + 1]; + INT32 data2 = ram[offs + 2]; + INT32 data3 = ram[offs + 3]; + + INT32 code = data3 & 0x1fff; + INT32 color = (data2 & 0x0f) + (0x10 * *spritepalbank) + 0x60; + INT32 y = (data0 & 0x1ff) + 1 - screen_y_offset; + INT32 x = (data1 & 0x1ff) + 6 - 15; + INT32 yzoom = (data0 >> 12) & 15; + INT32 xzoom = (data1 >> 12) & 15; + INT32 zoomed = (xzoom | yzoom); + INT32 ytiles = ((data2 >> 12) & 7) + 1; + INT32 xtiles = ((data2 >> 8) & 7) + 1; + INT32 yflip = (data2 >> 15) & 1; + INT32 xflip = (data2 >> 11) & 1; + INT32 xt, yt; + + if (!(ram[offs + 2] & 0x0080)) continue; + + xzoom = 16 - zoomtable[xzoom] / 8; + yzoom = 16 - zoomtable[yzoom] / 8; + + if (x >= 0x200) x -= 0x200; + if (y >= 0x200) y -= 0x200; + + if (!xflip && !yflip) { + for (yt = 0; yt < ytiles; yt++) { + for (xt = 0; xt < xtiles; xt++, code++) { + if (!zoomed) + Render16x16Tile_Mask_Clip(pTransDraw, code, x + xt * 16, y + yt * 16, color, 4, 15, 0, DrvGfxROM1); + else + RenderZoomedTile(pTransDraw, DrvGfxROM1, code, color << 4, 15, x + xt * xzoom, y + yt * yzoom, 0, 0, 16, 16, 0x1000 * xzoom, 0x1000 * yzoom); + } + if (xtiles == 3) code += 1; + if (xtiles == 5) code += 3; + if (xtiles == 6) code += 2; + if (xtiles == 7) code += 1; + } + } + else if (xflip && !yflip) { + for (yt = 0; yt < ytiles; yt++) { + for (xt = 0; xt < xtiles; xt++, code++) { + if (!zoomed) + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x + (xtiles - 1 - xt) * 16, y + yt * 16, color, 4, 15, 0, DrvGfxROM1); + else + RenderZoomedTile(pTransDraw, DrvGfxROM1, code, color << 4, 15, x + (xtiles - 1 - xt) * xzoom, y + yt * yzoom, 1, 0, 16, 16, 0x1000 * xzoom, 0x1000 * yzoom); + } + if (xtiles == 3) code += 1; + if (xtiles == 5) code += 3; + if (xtiles == 6) code += 2; + if (xtiles == 7) code += 1; + } + } + else if (!xflip && yflip) { + for (yt = 0; yt < ytiles; yt++) { + for (xt = 0; xt < xtiles; xt++, code++) { + if (!zoomed) + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x + xt * 16, y + (ytiles - 1 - yt) * 16, color, 4, 15, 0, DrvGfxROM1); + else + RenderZoomedTile(pTransDraw, DrvGfxROM1, code, color << 4, 15, x + xt * xzoom, y + (ytiles - 1 - yt) * yzoom, 0, 1, 16, 16, 0x1000 * xzoom, 0x1000 * yzoom); + } + if (xtiles == 3) code += 1; + if (xtiles == 5) code += 3; + if (xtiles == 6) code += 2; + if (xtiles == 7) code += 1; + } + } + else { + for (yt = 0; yt < ytiles; yt++) { + for (xt = 0; xt < xtiles; xt++, code++) { + if (!zoomed) + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x + (xtiles - 1 - xt) * 16, y + (ytiles - 1 - yt) * 16, color, 4, 15, 0, DrvGfxROM1); + else + RenderZoomedTile(pTransDraw, DrvGfxROM1, code, color << 4, 15, x + (xtiles - 1 - xt) * xzoom, y + (ytiles - 1 - yt) * yzoom, 1, 1, 16, 16, 0x1000 * xzoom, 0x1000 * yzoom); + } + if (xtiles == 3) code += 1; + if (xtiles == 5) code += 3; + if (xtiles == 6) code += 2; + if (xtiles == 7) code += 1; + } + } + } +} + +static void draw_foreground() +{ + INT32 color_bank = *charpalbank << 3; + INT32 scrollx = scroll[0] & 0x1ff; + INT32 scrolly = scroll[1] & 0x0ff; + + UINT16 *vram = (UINT16*)DrvVidRAM; + + for (INT32 offs = 0; offs < 64 * 32; offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + sx -= scrollx; + if (sx < -7) sx += 512; + sy -= scrolly; + if (sy < -7) sy += 256; + + INT32 attr = vram[offs]; + INT32 code = (attr & 0xfff) | (gfx_bank[(attr >> 12) & 1] << 12); + INT32 color = (attr >> 13) | color_bank; + + Render8x8Tile_Mask_Clip(pTransDraw, code, sx - 15, sy - screen_y_offset, color & 0x7f, 4, 15, 0, DrvGfxROM0); + } +} + +static void draw_background() +{ + INT32 color_bank = 0x400 + (*pixelpalbank << 8); + + UINT16 *vram = (UINT16*)DrvPxlRAM; + + for (INT32 offs = (screen_y_offset * 256); offs < 256 * 256; offs++) + { + INT32 sx = ((offs & 0xff) << 1) - 15; + INT32 sy = (offs >> 8) - screen_y_offset; + + INT32 pxl = vram[offs]; + + if (sy < nScreenHeight && sy >= 0) { + if (sx >= 0 && sx < nScreenWidth) pTransDraw[sy * nScreenWidth + sx++] = color_bank | (pxl >> 8); + if (sx >= 0 && sx < nScreenWidth) pTransDraw[sy * nScreenWidth + sx ] = color_bank | (pxl & 0xff); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x1000; i+=2) { + palette_write(i); + } + DrvRecalc = 0; + } + + BurnTransferClear(); + + draw_background(); + draw_foreground(); + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + SekNewFrame(); + ZetNewFrame(); + + { + DrvInputs[0] = 0xff; + DrvInputs[1] = 0x00; + DrvInputs[2] = 0x00; + DrvInputs[3] = 0x00; + DrvInputs[4] = 0x00; + DrvInputs[5] = 0x00; + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] |= (DrvJoy2[i] & 1) << i; + DrvInputs[2] |= (DrvJoy3[i] & 1) << i; + DrvInputs[3] |= (DrvJoy4[i] & 1) << i; + DrvInputs[4] |= (DrvJoy5[i] & 1) << i; + DrvInputs[5] |= (DrvJoy6[i] & 1) << i; + } + } + + // Clear Opposites + WelltrisClearOpposites(&DrvInputs[1]); + WelltrisClearOpposites(&DrvInputs[2]); +// WelltrisClearOpposites(&DrvInputs[3]); +// WelltrisClearOpposites(&DrvInputs[4]); + + SekOpen(0); + ZetOpen(0); + + SekRun(10000000 / 60); + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrame(4000000 / 60); + + if (pBurnSoundOut) { + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029707; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2610Scan(nAction, pnMin); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + bankswitch(sound_bank[0]); + ZetClose(); + } + + return 0; +} + + +// Welltris - Alexey Pajitnov's (World?, 2 players) + +static struct BurnRomInfo welltrisRomDesc[] = { + { "j2u.8", 0x20000, 0x7488fe94, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "j1u.7", 0x20000, 0x571413ac, 1 | BRF_PRG | BRF_ESS }, // 1 + { "lh532j10.10", 0x40000, 0x1187c665, 1 | BRF_PRG | BRF_ESS }, // 2 + { "lh532j11.9", 0x40000, 0x18eda9e5, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "3.144", 0x20000, 0xae8f763e, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "lh534j11.126", 0x80000, 0xbf85fb0d, 3 | BRF_SND }, // 5 ADPCM-B Samples + + { "lh534j09.123", 0x80000, 0x6c2ce9a5, 4 | BRF_SND }, // 6 ADPCM-A Samples + { "lh534j10.124", 0x80000, 0xe3682221, 4 | BRF_SND }, // 7 + + { "046.93", 0x40000, 0x31d96d77, 5 | BRF_GRA }, // 8 Sprites + { "048.94", 0x40000, 0xbb4643da, 5 | BRF_GRA }, // 9 + + { "lh534j12.77", 0x80000, 0xb61a8b74, 6 | BRF_GRA }, // 10 Tiles +}; + +STD_ROM_PICK(welltris) +STD_ROM_FN(welltris) + +struct BurnDriver BurnDrvWelltris = { + "welltris", NULL, NULL, NULL, "1991", + "Welltris - Alexey Pajitnov's (World?, 2 players)\0", NULL, "Video System Co.", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, welltrisRomInfo, welltrisRomName, NULL, NULL, WelltrisInputInfo, WelltrisDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 352, 240, 4, 3 +}; + + +// Welltris - Alexey Pajitnov's (Japan, 2 players) + +static struct BurnRomInfo welltrisjRomDesc[] = { + { "j2.8", 0x20000, 0x68ec5691, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu + { "j1.7", 0x20000, 0x1598ea2c, 1 | BRF_PRG | BRF_ESS }, // 1 + { "lh532j10.10", 0x40000, 0x1187c665, 1 | BRF_PRG | BRF_ESS }, // 2 + { "lh532j11.9", 0x40000, 0x18eda9e5, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "3.144", 0x20000, 0xae8f763e, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "lh534j11.126", 0x80000, 0xbf85fb0d, 3 | BRF_SND }, // 5 ADPCM-B Samples + + { "lh534j09.123", 0x80000, 0x6c2ce9a5, 4 | BRF_SND }, // 6 ADPCM-A Samples + { "lh534j10.124", 0x80000, 0xe3682221, 4 | BRF_SND }, // 7 + + { "046.93", 0x40000, 0x31d96d77, 5 | BRF_GRA }, // 8 Sprites + { "048.94", 0x40000, 0xbb4643da, 5 | BRF_GRA }, // 9 + + { "lh534j12.77", 0x80000, 0xb61a8b74, 6 | BRF_GRA }, // 10 Tiles +}; + +STD_ROM_PICK(welltrisj) +STD_ROM_FN(welltrisj) + +struct BurnDriver BurnDrvWelltrisj = { + "welltrisj", "welltris", NULL, NULL, "1991", + "Welltris - Alexey Pajitnov's (Japan, 2 players)\0", NULL, "Video System Co.", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, welltrisjRomInfo, welltrisjRomName, NULL, NULL, WelltrisInputInfo, WelltrisDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 352, 240, 4, 3 +}; + + +// Miyasu Nonki no Quiz 18-Kin + +static struct BurnRomInfo quiz18kRomDesc[] = { + { "1-ic8.bin", 0x20000, 0x10a64336, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code + { "2-ic7.bin", 0x20000, 0x8b21b431, 1 | BRF_PRG | BRF_ESS }, // 1 + { "ic10.bin", 0x40000, 0x501453a3, 1 | BRF_PRG | BRF_ESS }, // 2 + { "ic9.bin", 0x40000, 0x99b6840f, 1 | BRF_PRG | BRF_ESS }, // 3 + + { "3-ic144.bin", 0x20000, 0x72d372e3, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code + + { "ic126.bin", 0x40000, 0x7a92fbc9, 3 | BRF_SND }, // 5 ADPCM-B Samples + + { "ic123.bin", 0x80000, 0xee4995cf, 4 | BRF_SND }, // 6 ADPCM-A Samples + { "ic124.bin", 0x40000, 0x076f58c3, 4 | BRF_SND }, // 7 + + { "ic93.bin", 0x80000, 0x4d387c5e, 5 | BRF_GRA }, // 8 Sprites + { "ic94.bin", 0x80000, 0x6be2f164, 5 | BRF_GRA }, // 9 + + { "ic77.bin", 0x80000, 0xaf3b6fd1, 6 | BRF_GRA }, // 10 Tiles + { "ic78.bin", 0x80000, 0x44bbdef3, 6 | BRF_GRA }, // 11 + { "ic79.bin", 0x80000, 0xd721e169, 6 | BRF_GRA }, // 12 +}; + +STD_ROM_PICK(quiz18k) +STD_ROM_FN(quiz18k) + +struct BurnDriver BurnDrvQuiz18k = { + "quiz18k", NULL, NULL, NULL, "1992", + "Miyasu Nonki no Quiz 18-Kin\0", NULL, "EIM", "Miscellaneous", + L"\u307F\u3084\u3059\u306E\u3093\u304D\u306E \u30AF\u30A4\u30BA\uFF11\uFF18\u7981 \uFF24\uFF52\uFF0E \u30A8\u30C3\u3061\u3083\u3093\u306E\u8A3A\u5BDF\u5BA4\0Miyasu Nonki no Quiz 18-Kin\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_QUIZ, 0, + NULL, quiz18kRomInfo, quiz18kRomName, NULL, NULL, Quiz18kInputInfo, Quiz18kDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_wwfwfest.cpp b/src/burn/drv/pst90s/d_wwfwfest.cpp index 7f0eec890..f60285866 100644 --- a/src/burn/drv/pst90s/d_wwfwfest.cpp +++ b/src/burn/drv/pst90s/d_wwfwfest.cpp @@ -1,1207 +1,1206 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "msm6295.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort4[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[2] = {0, 0}; -static UINT8 DrvInput[5] = {0, 0, 0, 0, 0}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *Drv68KRom = NULL; -static UINT8 *Drv68KRam = NULL; -static UINT8 *DrvZ80Rom = NULL; -static UINT8 *DrvZ80Ram = NULL; -static UINT8 *DrvMSM6295ROMSrc = NULL; -static UINT8 *DrvCharVideoRam = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvSpriteRamBuff = NULL; -static UINT8 *DrvBg0VideoRam = NULL; -static UINT8 *DrvBg1VideoRam = NULL; -static UINT8 *DrvPaletteRam = NULL; -static UINT8 *DrvChars = NULL; -static UINT8 *DrvTiles = NULL; -static UINT8 *DrvSprites = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT8 DrvVBlank; -static UINT8 DrvOkiBank; -static UINT8 DrvSoundLatch; -static UINT16 DrvBg0ScrollX; -static UINT16 DrvBg0ScrollY; -static UINT16 DrvBg1ScrollX; -static UINT16 DrvBg1ScrollY; -static UINT16 DrvVReg; - -static INT32 DrvSpriteXOffset; -static INT32 DrvBg0XOffset; -static INT32 DrvBg1XOffset[2]; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -static struct BurnInputInfo DrvInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort4 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, - {"Start 3" , BIT_DIGITAL , DrvInputPort2 + 7, "p3 start" }, - {"Start 4" , BIT_DIGITAL , DrvInputPort3 + 7, "p4 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, - - {"P3 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , DrvInputPort2 + 1, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , DrvInputPort2 + 0, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p3 fire 2" }, - - {"P4 Up" , BIT_DIGITAL , DrvInputPort3 + 2, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , DrvInputPort3 + 3, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , DrvInputPort3 + 1, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , DrvInputPort3 + 0, "p4 right" }, - {"P4 Fire 1" , BIT_DIGITAL , DrvInputPort3 + 4, "p4 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , DrvInputPort3 + 5, "p4 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort4 + 1, "service" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Drv) - -static inline void DrvClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x03) == 0x03) { - *nJoystickInputs &= ~0x03; - } - if ((*nJoystickInputs & 0x0c) == 0x0c) { - *nJoystickInputs &= ~0x0c; - } -} - -static inline void DrvMakeInputs() -{ - // Reset Inputs - DrvInput[0] = DrvInput[1] = DrvInput[2] = DrvInput[3] = DrvInput[4] = 0x00; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvInputPort0[i] & 1) << i; - DrvInput[1] |= (DrvInputPort1[i] & 1) << i; - DrvInput[2] |= (DrvInputPort2[i] & 1) << i; - DrvInput[3] |= (DrvInputPort3[i] & 1) << i; - DrvInput[4] |= (DrvInputPort4[i] & 1) << i; - } - - // Clear Opposites - DrvClearOpposites(&DrvInput[0]); - DrvClearOpposites(&DrvInput[1]); - DrvClearOpposites(&DrvInput[2]); - DrvClearOpposites(&DrvInput[3]); -} - -static struct BurnDIPInfo DrvDIPList[]= -{ - // Default Values - {0x1f, 0xff, 0xff, 0xef, NULL }, - {0x20, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x1f, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x1f, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x1f, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x1f, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Buy In Price" }, - {0x1f, 0x01, 0x04, 0x04, "1 Coin" }, - {0x1f, 0x01, 0x04, 0x00, "As Start Price" }, - - {0 , 0xfe, 0 , 2 , "Regain Power Price" }, - {0x1f, 0x01, 0x08, 0x08, "1 Coin" }, - {0x1f, 0x01, 0x08, 0x00, "As Start Price" }, - - {0 , 0xfe, 0 , 2 , "Continue Price" }, - {0x1f, 0x01, 0x10, 0x10, "1 Coin" }, - {0x1f, 0x01, 0x10, 0x00, "As Start Price" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x1f, 0x01, 0x20, 0x00, "Off" }, - {0x1f, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x1f, 0x01, 0x40, 0x40, "Off" }, - {0x1f, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "FBI Logo" }, - {0x1f, 0x01, 0x80, 0x00, "Off" }, - {0x1f, 0x01, 0x80, 0x80, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x20, 0x01, 0x03, 0x02, "Easy" }, - {0x20, 0x01, 0x03, 0x03, "Normal" }, - {0x20, 0x01, 0x03, 0x01, "Hard" }, - {0x20, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 3 , "Number of Players" }, - {0x20, 0x01, 0x0c, 0x04, "2" }, - {0x20, 0x01, 0x0c, 0x08, "3" }, - {0x20, 0x01, 0x0c, 0x0c, "4" }, - - {0 , 0xfe, 0 , 4 , "Clear Stage Power Up" }, - {0x20, 0x01, 0x60, 0x00, "0" }, - {0x20, 0x01, 0x60, 0x20, "12" }, - {0x20, 0x01, 0x60, 0x60, "24" }, - {0x20, 0x01, 0x60, 0x40, "32" }, - - {0 , 0xfe, 0 , 2 , "Championship Game" }, - {0x20, 0x01, 0x80, 0x00, "4th" }, - {0x20, 0x01, 0x80, 0x80, "5th" }, -}; - -STDDIPINFO(Drv) - -static struct BurnRomInfo DrvRomDesc[] = { - { "31a13-2.ic19", 0x040000, 0x7175bca7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "31a14-2.ic18", 0x040000, 0x5d06bfd1, BRF_ESS | BRF_PRG }, // 1 - - { "31a11-2.ic42", 0x010000, 0x5ddebfea, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "31a12-0.ic33", 0x020000, 0xd0803e20, BRF_GRA }, // 3 Chars - - { "31j0.ic1", 0x040000, 0x8a12b450, BRF_GRA }, // 4 Tiles - { "31j1.ic2", 0x040000, 0x82ed7155, BRF_GRA }, // 5 - - { "31j3.ic9", 0x100000, 0xe395cf1d, BRF_GRA }, // 6 Sprites - { "31j2.ic8", 0x100000, 0xb5a97465, BRF_GRA }, // 7 - { "31j5.ic11", 0x100000, 0x2ce545e8, BRF_GRA }, // 8 - { "31j4.ic10", 0x100000, 0x00edb66a, BRF_GRA }, // 9 - { "31j6.ic12", 0x100000, 0x79956cf8, BRF_GRA }, // 10 - { "31j7.ic13", 0x100000, 0x74d774c3, BRF_GRA }, // 11 - { "31j9.ic15", 0x100000, 0xdd387289, BRF_GRA }, // 12 - { "31j8.ic14", 0x100000, 0x44abe127, BRF_GRA }, // 13 - - { "31j10.ic73", 0x080000, 0x6c522edb, BRF_SND }, // 14 Samples -}; - -STD_ROM_PICK(Drv) -STD_ROM_FN(Drv) - -static struct BurnRomInfo DrvaRomDesc[] = { - { "wf_19.rom", 0x040000, 0xbd02e3c4, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "wf_18.rom", 0x040000, 0x933ea1a0, BRF_ESS | BRF_PRG }, // 1 - - { "31a11-2.ic42", 0x010000, 0x5ddebfea, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "wf_33.rom", 0x020000, 0x06f22615, BRF_GRA }, // 3 Chars - - { "31j0.ic1", 0x040000, 0x8a12b450, BRF_GRA }, // 4 Tiles - { "31j1.ic2", 0x040000, 0x82ed7155, BRF_GRA }, // 5 - - { "31j3.ic9", 0x100000, 0xe395cf1d, BRF_GRA }, // 6 Sprites - { "31j2.ic8", 0x100000, 0xb5a97465, BRF_GRA }, // 7 - { "31j5.ic11", 0x100000, 0x2ce545e8, BRF_GRA }, // 8 - { "31j4.ic10", 0x100000, 0x00edb66a, BRF_GRA }, // 9 - { "31j6.ic12", 0x100000, 0x79956cf8, BRF_GRA }, // 10 - { "31j7.ic13", 0x100000, 0x74d774c3, BRF_GRA }, // 11 - { "31j9.ic15", 0x100000, 0xdd387289, BRF_GRA }, // 12 - { "31j8.ic14", 0x100000, 0x44abe127, BRF_GRA }, // 13 - - { "31j10.ic73", 0x080000, 0x6c522edb, BRF_SND }, // 14 Samples -}; - -STD_ROM_PICK(Drva) -STD_ROM_FN(Drva) - -static struct BurnRomInfo DrvbRomDesc[] = { - { "2", 0x040000, 0x632bb3a4, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "3", 0x040000, 0xea73369c, BRF_ESS | BRF_PRG }, // 1 - - { "1", 0x010000, 0xd9e8cda2, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "4", 0x020000, 0x520ef575, BRF_GRA }, // 3 Chars - - { "5", 0x020000, 0x35e4d6eb, BRF_GRA }, // 4 Tiles - { "6", 0x020000, 0xa054a5b2, BRF_GRA }, // 5 - { "7", 0x020000, 0x101f0136, BRF_GRA }, // 6 - { "8", 0x020000, 0x7b2ecba7, BRF_GRA }, // 7 - - { "wf_09.rom", 0x100000, 0xe395cf1d, BRF_GRA }, // 8 Sprites - { "wf_08.rom", 0x100000, 0xb5a97465, BRF_GRA }, // 9 - { "wf_11.rom", 0x100000, 0x2ce545e8, BRF_GRA }, // 10 - { "wf_10.rom", 0x100000, 0x00edb66a, BRF_GRA }, // 11 - { "wf_12.rom", 0x100000, 0x79956cf8, BRF_GRA }, // 12 - { "wf_13.rom", 0x100000, 0x74d774c3, BRF_GRA }, // 13 - { "wf_15.rom", 0x100000, 0xdd387289, BRF_GRA }, // 14 - { "wf_14.rom", 0x100000, 0x44abe127, BRF_GRA }, // 15 - - { "wf_73a.rom", 0x080000, 0x6c522edb, BRF_SND }, // 16 Samples -}; - -STD_ROM_PICK(Drvb) -STD_ROM_FN(Drvb) - -static struct BurnRomInfo DrvjRomDesc[] = { - { "31j13-0.ic19", 0x040000, 0x2147780d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code - { "31j14-0.ic18", 0x040000, 0xd76fc747, BRF_ESS | BRF_PRG }, // 1 - - { "31a11-2.ic42", 0x010000, 0x5ddebfea, BRF_ESS | BRF_PRG }, // 2 Z80 Program - - { "31j12-0.ic33", 0x020000, 0xf4821fe0, BRF_GRA }, // 3 Chars - - { "31j0.ic1", 0x040000, 0x8a12b450, BRF_GRA }, // 4 Tiles - { "31j1.ic2", 0x040000, 0x82ed7155, BRF_GRA }, // 5 - - { "31j3.ic9", 0x100000, 0xe395cf1d, BRF_GRA }, // 6 Sprites - { "31j2.ic8", 0x100000, 0xb5a97465, BRF_GRA }, // 7 - { "31j5.ic11", 0x100000, 0x2ce545e8, BRF_GRA }, // 8 - { "31j4.ic10", 0x100000, 0x00edb66a, BRF_GRA }, // 9 - { "31j6.ic12", 0x100000, 0x79956cf8, BRF_GRA }, // 10 - { "31j7.ic13", 0x100000, 0x74d774c3, BRF_GRA }, // 11 - { "31j9.ic15", 0x100000, 0xdd387289, BRF_GRA }, // 12 - { "31j8.ic14", 0x100000, 0x44abe127, BRF_GRA }, // 13 - - { "31j10.ic73", 0x080000, 0x6c522edb, BRF_SND }, // 14 Samples -}; - -STD_ROM_PICK(Drvj) -STD_ROM_FN(Drvj) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - Drv68KRom = Next; Next += 0x80000; - DrvZ80Rom = Next; Next += 0x10000; - MSM6295ROM = Next; Next += 0x40000; - DrvMSM6295ROMSrc = Next; Next += 0x80000; - - RamStart = Next; - - Drv68KRam = Next; Next += 0x04000; - DrvZ80Ram = Next; Next += 0x00800; - DrvCharVideoRam = Next; Next += 0x02000; - DrvSpriteRam = Next; Next += 0x02000; - DrvSpriteRamBuff = Next; Next += 0x02000; - DrvBg0VideoRam = Next; Next += 0x01000; - DrvBg1VideoRam = Next; Next += 0x01000; - DrvPaletteRam = Next; Next += 0x04000; - - RamEnd = Next; - - DrvChars = Next; Next += 0x01000 * 8 * 8; - DrvTiles = Next; Next += 0x01000 * 16 * 16; - DrvSprites = Next; Next += 0x10000 * 16 * 16; - DrvPalette = (UINT32*)Next; Next += 0x02000 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM2151Reset(); - MSM6295Reset(0); - - DrvVBlank = 0; - DrvBg0ScrollX = 0; - DrvBg0ScrollY = 0; - DrvBg1ScrollX = 0; - DrvBg1ScrollY = 0; - DrvVReg = 0; - DrvOkiBank = 0; - DrvSoundLatch = 0; - - return 0; -} - -UINT8 __fastcall Wwfwfest68KReadByte(UINT32 a) -{ - switch (a) { - case 0x140020: { - return (0xcf - DrvInput[4]) | ((DrvDip[1] & 0xc0) >> 2); - } - - case 0x140021: { - return 0xff - DrvInput[0]; - } - - case 0x140023: { - return 0xff - DrvInput[1]; - } - - case 0x140025: { - return 0xff - DrvInput[2]; - } - - case 0x140026: { - UINT8 Temp = 0xfc; - if (DrvVBlank) Temp = 0xfb; - Temp |= (DrvDip[0] & 0xc0) >> 6; - return Temp; - } - - case 0x140027: { - return 0xff - DrvInput[3]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Wwfwfest68KWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x0c0000 && a <= 0x0c1fff) { - UINT16 *CharRam = (UINT16*)DrvCharVideoRam; - CharRam[(a - 0x0c0000) >> 1] = d; - return; - } - - switch (a) { - case 0x140011: { - DrvVReg = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Wwfwfest68KReadWord(UINT32 a) -{ - if (a >= 0x180000 && a <= 0x18ffff) { - UINT16 *PaletteRam = (UINT16*)DrvPaletteRam; - INT32 Offset = (a - 0x180000) >> 1; - Offset = (Offset & 0x0f) | (Offset & 0x7fc0) >> 2; - return PaletteRam[Offset]; - } - - switch (a) { - case 0x140020: { - UINT16 Temp = (0xff - DrvInput[0]) | ((0xff - DrvInput[4]) << 8); - Temp &= 0xcfff; - Temp |= ((DrvDip[1] & 0xc0) << 6); - return Temp; - } - - case 0x140022: { - UINT16 Temp = 0xff - DrvInput[1]; - Temp |= ((DrvDip[1] & 0x3f) << 8); - return Temp; - } - - case 0x140024: { - UINT16 Temp = 0xff - DrvInput[2]; - Temp |= ((DrvDip[0] & 0x3f) << 8); - return Temp; - } - - case 0x140026: { - UINT16 Temp = 0xff - DrvInput[3]; - if (DrvVBlank) { - Temp |= (0xfb << 8); - } else { - Temp |= (0xff << 8); - } - Temp &= 0xfcff; - Temp |= ((DrvDip[0] & 0xc0) << 2); - return Temp; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Wwfwfest68KWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x0c0000 && a <= 0x0c1fff) { - UINT16 *CharRam = (UINT16*)DrvCharVideoRam; - CharRam[(a - 0x0c0000) >> 1] = d; - return; - } - - if (a >= 0x180000 && a <= 0x18ffff) { - UINT16 *PaletteRam = (UINT16*)DrvPaletteRam; - INT32 Offset = (a - 0x180000) >> 1; - Offset = (Offset & 0x0f) | (Offset & 0x7fc0) >> 2; - PaletteRam[Offset] = d; - return; - } - - if (a >= 0x120000 && a <= 0x121fff) { - return; - } - - switch (a) { - case 0x100000: { - DrvBg0ScrollX = d & 0x1ff; - return; - } - - case 0x100002: { - DrvBg0ScrollY = d & 0x1ff; - return; - } - - case 0x100004: { - DrvBg1ScrollX = d & 0x1ff; - return; - } - - case 0x100006: { - DrvBg1ScrollY = d & 0x1ff; - return; - } - - case 0x140010: { - DrvVReg = d; - return; - } - - case 0x14000c: { - DrvSoundLatch = d & 0xff; - ZetOpen(0); - ZetNmi(); - nCyclesDone[1] += ZetRun(100); - ZetClose(); - return; - } - - case 0x100008: { - // ??? - return; - } - - case 0x10000c: { - // ??? - return; - } - - case 0x140000: - case 0x140002: { - // NOP - return; - } - - case 0x140006: - case 0x140008: - case 0x140012: - case 0x140014: - case 0x140016: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall WwfwfestZ80Read(UINT16 a) -{ - switch (a) { - case 0xc801: { - return BurnYM2151ReadStatus(); - } - - case 0xd800: { - return MSM6295ReadStatus(0); - } - - case 0xe000: { - return DrvSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall WwfwfestZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xc800: { - BurnYM2151SelectRegister(d); - return; - } - - case 0xc801: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xd800: { - MSM6295Command(0, d); - return; - } - - case 0xe800: { - DrvOkiBank = d & 1; - memcpy(MSM6295ROM + 0x00000, DrvMSM6295ROMSrc + (0x40000 * DrvOkiBank), 0x40000); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 CharPlaneOffsets[4] = { 0, 2, 4, 6 }; -static INT32 CharXOffsets[8] = { 1, 0, 65, 64, 129, 128, 193, 192 }; -static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 TilePlaneOffsets[4] = { 8, 0, 0x200008, 0x200000 }; -static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 256, 257, 258, 259, 260, 261, 262, 263 }; -static INT32 TileYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; -static INT32 SpritePlaneOffsets[4] = { 0, 0x1000000, 0x2000000, 0x3000000 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; - -static void DrvYM2151IrqHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvInit() -{ - INT32 nRet = 0, nLen, RomOffset; - - RomOffset = 0; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "wwfwfestb")) RomOffset = 2; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - DrvTempRom = (UINT8 *)BurnMalloc(0x800000); - - // Load 68000 Program Roms - nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(Drv68KRom + 0x00001, 1, 2); if (nRet != 0) return 1; - - // Load Z80 Program Roms - nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; - - // Load and decode the chars - nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 1); if (nRet != 0) return 1; - GfxDecode(0x1000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); - - // Load and decode the tiles - memset(DrvTempRom, 0, 0x800000); - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "wwfwfestb")) { - nRet = BurnLoadRom(DrvTempRom + 0x040000, 4, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x040001, 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; - } else { - nRet = BurnLoadRom(DrvTempRom + 0x040000, 4, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 1); if (nRet != 0) return 1; - } - GfxDecode(0x1000, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); - - // Load and decode the sprites - memset(DrvTempRom, 0, 0x800000); - nRet = BurnLoadRom(DrvTempRom + 0x000000, 6 + RomOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x100000, 7 + RomOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x200000, 8 + RomOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x300000, 9 + RomOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x400000, 10 + RomOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x500000, 11 + RomOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x600000, 12 + RomOffset, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x700000, 13 + RomOffset, 1); if (nRet != 0) return 1; - GfxDecode(0x10000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); - - // Load Sample Roms - nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 14 + RomOffset, 1); if (nRet != 0) return 1; - memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); - - BurnFree(DrvTempRom); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvBg0VideoRam , 0x080000, 0x080fff, SM_RAM); - SekMapMemory(DrvBg1VideoRam , 0x082000, 0x082fff, SM_RAM); - SekMapMemory(DrvCharVideoRam , 0x0c0000, 0x0c1fff, SM_ROM); - SekMapMemory(DrvSpriteRam , 0x0c2000, 0x0c3fff, SM_RAM); - SekMapMemory(Drv68KRam , 0x1c0000, 0x1c3fff, SM_RAM); - SekSetReadWordHandler(0, Wwfwfest68KReadWord); - SekSetWriteWordHandler(0, Wwfwfest68KWriteWord); - SekSetReadByteHandler(0, Wwfwfest68KReadByte); - SekSetWriteByteHandler(0, Wwfwfest68KWriteByte); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(WwfwfestZ80Read); - ZetSetWriteHandler(WwfwfestZ80Write); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom ); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom ); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); - ZetMemEnd(); - ZetClose(); - - // Setup the YM2151 emulation - BurnYM2151Init(3579545); - BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); - BurnYM2151SetAllRoutes(0.45, BURN_SND_ROUTE_BOTH); - - // Setup the OKIM6295 emulation - MSM6295Init(0, 1024188 / 132, 1); - MSM6295SetRoute(0, 0.90, BURN_SND_ROUTE_BOTH); - - DrvSpriteXOffset = 0; - DrvBg0XOffset = 0; - DrvBg1XOffset[0] = 0; - DrvBg1XOffset[1] = 0; - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "wwfwfestb")) { - DrvSpriteXOffset = 2; - DrvBg0XOffset = -4; - DrvBg1XOffset[0] = -4; - DrvBg1XOffset[1] = -2; - } - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - SekExit(); - ZetExit(); - - BurnYM2151Exit(); - MSM6295Exit(0); - - GenericTilesExit(); - - DrvVBlank = 0; - DrvBg0ScrollX = 0; - DrvBg0ScrollY = 0; - DrvBg1ScrollX = 0; - DrvBg1ScrollY = 0; - DrvVReg = 0; - DrvOkiBank = 0; - DrvSoundLatch = 0; - - DrvSpriteXOffset = 0; - DrvBg0XOffset = 0; - DrvBg1XOffset[0] = 0; - DrvBg1XOffset[1] = 0; - - BurnFree(Mem); - - return 0; -} - -static inline UINT8 pal4bit(UINT8 bits) -{ - bits &= 0x0f; - return (bits << 4) | bits; -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(nColour >> 0); - g = pal4bit(nColour >> 4); - b = pal4bit(nColour >> 8); - - return BurnHighCol(r, g, b, 0); -} - -static void DrvCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x2000; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } -} - -static void DrvRenderBg0Layer(INT32 Opaque) -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0, xScroll, yScroll, Flip, xFlip, yFlip; - - UINT16 *VideoRam = (UINT16*)DrvBg0VideoRam; - UINT16 *TileBase; - - if (DrvVReg == 0x78) { - xScroll = DrvBg0ScrollX + DrvBg0XOffset; - yScroll = DrvBg0ScrollY; - } else { - xScroll = DrvBg1ScrollX + DrvBg0XOffset; - yScroll = DrvBg1ScrollY; - } - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - TileBase = &VideoRam[TileIndex * 2]; - Code = TileBase[1] & 0xfff; - Colour = TileBase[0] & 0x0f; - Flip = (TileBase[0] & 0xc0) >> 6; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - - x = 16 * mx; - y = 16 * my; - - x -= xScroll; - y -= yScroll; - if (x < -16) x += 512; - if (y < -16) y += 512; - - y -= 8; - - if (Opaque) { - if (x > 16 && x < 304 && y > 16 && y < 224) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); - } else { - Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); - } else { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); - } else { - Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); - } - } - } - } else { - if (x > 16 && x < 304 && y > 16 && y < 224) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); - } - } - } - } - - TileIndex++; - } - } -} - -static void DrvRenderBg1Layer(INT32 Opaque) -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0, xScroll, yScroll; - - UINT16 *VideoRam = (UINT16*)DrvBg1VideoRam; - UINT16 *TileBase; - - if (DrvVReg == 0x78) { - xScroll = DrvBg1ScrollX + DrvBg1XOffset[0]; - yScroll = DrvBg1ScrollY; - } else { - xScroll = DrvBg0ScrollX + DrvBg1XOffset[1]; - yScroll = DrvBg0ScrollY; - } - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 32; mx++) { - TileBase = &VideoRam[TileIndex]; - Code = TileBase[0] & 0xfff; - Colour = (TileBase[0] & 0xf000) >> 12; - - x = 16 * mx; - y = 16 * my; - - x -= xScroll; - y -= yScroll; - if (x < -16) x += 512; - if (y < -16) y += 512; - - y -= 8; - - if (Opaque) { - if (x > 0 && x < 304 && y > 0 && y < 224) { - Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0x0c00, DrvTiles); - } else { - Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0c00, DrvTiles); - } - } else { - if (x > 0 && x < 304 && y > 0 && y < 224) { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0x0c00, DrvTiles); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x0c00, DrvTiles); - } - } - - TileIndex++; - } - } -} - -static void DrvRenderSprites() -{ - UINT16 *Source = (UINT16*)DrvSpriteRamBuff; - UINT16 *Finish = (UINT16*)DrvSpriteRamBuff + 0x1000; - - while (Source < Finish) { - INT32 x, y, Colour, xFlip, yFlip, Chain, Enable, Code, Count; - - Enable = Source[1] & 1; - - if (Enable) { - x = +(Source[5] & 0x00ff) | (Source[1] & 0x0004) << 6; - if (x > 512 - 16) x -= 512; - x += DrvSpriteXOffset; - y = (Source[0] & 0x00ff) | (Source[1] & 0x0002) << 7; - y = (256 - y) & 0x1ff; - y -= 16; - y -= 8; - xFlip = (Source[1] & 0x0010) >> 4; - yFlip = (Source[1] & 0x0008) >> 3; - Chain = (Source[1] & 0x00e0) >> 5; - Chain += 1; - Code = (Source[2] & 0x00ff) | (Source[3] & 0x00ff) << 8; - Colour = (Source[4] & 0x000f); - - for (Count = 0; Count < Chain; Count++) { - INT32 yPos; - yPos = y - 16 * Count; - if (yFlip) yPos = y - (16 * (Chain - 1)) + (16 * Count); - - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code + Count, x, yPos, Colour, 4, 0, 0x400, DrvSprites); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code + Count, x, yPos, Colour, 4, 0, 0x400, DrvSprites); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code + Count, x, yPos, Colour, 4, 0, 0x400, DrvSprites); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code + Count, x, yPos, Colour, 4, 0, 0x400, DrvSprites); - } - } - } - } - - Source += 8; - } -} - -static void DrvRenderCharLayer() -{ - INT32 mx, my, Code, Colour, x, y, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)DrvCharVideoRam; - UINT16 *TileBase; - - for (my = 0; my < 32; my++) { - for (mx = 0; mx < 64; mx++) { - TileBase = &VideoRam[TileIndex * 2]; - Code = (TileBase[0] & 0xff) | ((TileBase[1] & 0x0f) << 8); - Colour = (TileBase[1] & 0xf0) >> 4; - - x = 8 * mx; - y = 8 * my; - - y -= 8; - - if (x > 0 && x < 312 && y > 0 && y < 232) { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvChars); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvChars); - } - - TileIndex++; - } - } -} - -static void DrvDraw() -{ - BurnTransferClear(); - DrvCalcPalette(); - - if (DrvVReg == 0x7b) { - DrvRenderBg0Layer(1); - DrvRenderBg1Layer(0); - DrvRenderSprites(); - DrvRenderCharLayer(); - } - - if (DrvVReg == 0x7c) { - DrvRenderBg0Layer(1); - DrvRenderSprites(); - DrvRenderBg1Layer(0); - DrvRenderCharLayer(); - } - - if (DrvVReg == 0x78) { - DrvRenderBg1Layer(1); - DrvRenderBg0Layer(0); - DrvRenderSprites(); - DrvRenderCharLayer(); - } - - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - - if (DrvReset) DrvDoReset(); - - DrvMakeInputs(); - - nCyclesTotal[0] = (24000000 / 2) / 60; - nCyclesTotal[1] = 3579545 / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - DrvVBlank = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 5) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - if (i == 5) DrvVBlank = 1; - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - SekOpen(0); - SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) DrvDraw(); - - memcpy(DrvSpriteRamBuff, DrvSpriteRam, 0x2000); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029674; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); // Scan Z80 - BurnYM2151Scan(nAction); - MSM6295Scan(0, nAction); - - // Scan critical driver variables - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(DrvDip); - SCAN_VAR(DrvInput); - SCAN_VAR(DrvVBlank); - SCAN_VAR(DrvOkiBank); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(DrvBg0ScrollX); - SCAN_VAR(DrvBg0ScrollY); - SCAN_VAR(DrvBg1ScrollX); - SCAN_VAR(DrvBg1ScrollY); - SCAN_VAR(DrvVReg); - } - - if (nAction & ACB_WRITE) { - memcpy(MSM6295ROM + 0x00000, DrvMSM6295ROMSrc + (0x40000 * DrvOkiBank), 0x40000); - } - - return 0; -} - -struct BurnDriver BurnDrvWwfwfest = { - "wwfwfest", NULL, NULL, NULL, "1991", - "WWF WrestleFest (US set 1)\0", NULL, "Technos Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, - NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvWwfwfesta = { - "wwfwfesta", "wwfwfest", NULL, NULL, "1991", - "WWF WrestleFest (US Tecmo)\0", NULL, "Technos Japan (Tecmo License)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, - NULL, DrvaRomInfo, DrvaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvWwfwfestb = { - "wwfwfestb", "wwfwfest", NULL, NULL, "1991", - "WWF WrestleFest (US bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 4, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, - NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvWwfwfestj = { - "wwfwfestj", "wwfwfest", NULL, NULL, "1991", - "WWF WrestleFest (Japan)\0", NULL, "Technos Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, - NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, NULL, DrvScan, - NULL, 0x2000, 320, 240, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "msm6295.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort4[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[2] = {0, 0}; +static UINT8 DrvInput[5] = {0, 0, 0, 0, 0}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *Drv68KRom = NULL; +static UINT8 *Drv68KRam = NULL; +static UINT8 *DrvZ80Rom = NULL; +static UINT8 *DrvZ80Ram = NULL; +static UINT8 *DrvMSM6295ROMSrc = NULL; +static UINT8 *DrvCharVideoRam = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvSpriteRamBuff = NULL; +static UINT8 *DrvBg0VideoRam = NULL; +static UINT8 *DrvBg1VideoRam = NULL; +static UINT8 *DrvPaletteRam = NULL; +static UINT8 *DrvChars = NULL; +static UINT8 *DrvTiles = NULL; +static UINT8 *DrvSprites = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT8 DrvVBlank; +static UINT8 DrvOkiBank; +static UINT8 DrvSoundLatch; +static UINT16 DrvBg0ScrollX; +static UINT16 DrvBg0ScrollY; +static UINT16 DrvBg1ScrollX; +static UINT16 DrvBg1ScrollY; +static UINT16 DrvVReg; + +static INT32 DrvSpriteXOffset; +static INT32 DrvBg0XOffset; +static INT32 DrvBg1XOffset[2]; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +static struct BurnInputInfo DrvInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort4 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 7, "p1 start" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 7, "p2 start" }, + {"Start 3" , BIT_DIGITAL , DrvInputPort2 + 7, "p3 start" }, + {"Start 4" , BIT_DIGITAL , DrvInputPort3 + 7, "p4 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , DrvInputPort1 + 2, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvInputPort1 + 3, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 2" }, + + {"P3 Up" , BIT_DIGITAL , DrvInputPort2 + 2, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , DrvInputPort2 + 3, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , DrvInputPort2 + 1, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , DrvInputPort2 + 0, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 5, "p3 fire 2" }, + + {"P4 Up" , BIT_DIGITAL , DrvInputPort3 + 2, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , DrvInputPort3 + 3, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , DrvInputPort3 + 1, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , DrvInputPort3 + 0, "p4 right" }, + {"P4 Fire 1" , BIT_DIGITAL , DrvInputPort3 + 4, "p4 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , DrvInputPort3 + 5, "p4 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort4 + 1, "service" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Drv) + +static inline void DrvClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x03) == 0x03) { + *nJoystickInputs &= ~0x03; + } + if ((*nJoystickInputs & 0x0c) == 0x0c) { + *nJoystickInputs &= ~0x0c; + } +} + +static inline void DrvMakeInputs() +{ + // Reset Inputs + DrvInput[0] = DrvInput[1] = DrvInput[2] = DrvInput[3] = DrvInput[4] = 0x00; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvInputPort0[i] & 1) << i; + DrvInput[1] |= (DrvInputPort1[i] & 1) << i; + DrvInput[2] |= (DrvInputPort2[i] & 1) << i; + DrvInput[3] |= (DrvInputPort3[i] & 1) << i; + DrvInput[4] |= (DrvInputPort4[i] & 1) << i; + } + + // Clear Opposites + DrvClearOpposites(&DrvInput[0]); + DrvClearOpposites(&DrvInput[1]); + DrvClearOpposites(&DrvInput[2]); + DrvClearOpposites(&DrvInput[3]); +} + +static struct BurnDIPInfo DrvDIPList[]= +{ + // Default Values + {0x1f, 0xff, 0xff, 0xef, NULL }, + {0x20, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x1f, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x1f, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x1f, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x1f, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Buy In Price" }, + {0x1f, 0x01, 0x04, 0x04, "1 Coin" }, + {0x1f, 0x01, 0x04, 0x00, "As Start Price" }, + + {0 , 0xfe, 0 , 2 , "Regain Power Price" }, + {0x1f, 0x01, 0x08, 0x08, "1 Coin" }, + {0x1f, 0x01, 0x08, 0x00, "As Start Price" }, + + {0 , 0xfe, 0 , 2 , "Continue Price" }, + {0x1f, 0x01, 0x10, 0x10, "1 Coin" }, + {0x1f, 0x01, 0x10, 0x00, "As Start Price" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x1f, 0x01, 0x20, 0x00, "Off" }, + {0x1f, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x1f, 0x01, 0x40, 0x40, "Off" }, + {0x1f, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "FBI Logo" }, + {0x1f, 0x01, 0x80, 0x00, "Off" }, + {0x1f, 0x01, 0x80, 0x80, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x20, 0x01, 0x03, 0x02, "Easy" }, + {0x20, 0x01, 0x03, 0x03, "Normal" }, + {0x20, 0x01, 0x03, 0x01, "Hard" }, + {0x20, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 3 , "Number of Players" }, + {0x20, 0x01, 0x0c, 0x04, "2" }, + {0x20, 0x01, 0x0c, 0x08, "3" }, + {0x20, 0x01, 0x0c, 0x0c, "4" }, + + {0 , 0xfe, 0 , 4 , "Clear Stage Power Up" }, + {0x20, 0x01, 0x60, 0x00, "0" }, + {0x20, 0x01, 0x60, 0x20, "12" }, + {0x20, 0x01, 0x60, 0x60, "24" }, + {0x20, 0x01, 0x60, 0x40, "32" }, + + {0 , 0xfe, 0 , 2 , "Championship Game" }, + {0x20, 0x01, 0x80, 0x00, "4th" }, + {0x20, 0x01, 0x80, 0x80, "5th" }, +}; + +STDDIPINFO(Drv) + +static struct BurnRomInfo DrvRomDesc[] = { + { "31a13-2.ic19", 0x040000, 0x7175bca7, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "31a14-2.ic18", 0x040000, 0x5d06bfd1, BRF_ESS | BRF_PRG }, // 1 + + { "31a11-2.ic42", 0x010000, 0x5ddebfea, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "31a12-0.ic33", 0x020000, 0xd0803e20, BRF_GRA }, // 3 Chars + + { "31j0.ic1", 0x040000, 0x8a12b450, BRF_GRA }, // 4 Tiles + { "31j1.ic2", 0x040000, 0x82ed7155, BRF_GRA }, // 5 + + { "31j3.ic9", 0x100000, 0xe395cf1d, BRF_GRA }, // 6 Sprites + { "31j2.ic8", 0x100000, 0xb5a97465, BRF_GRA }, // 7 + { "31j5.ic11", 0x100000, 0x2ce545e8, BRF_GRA }, // 8 + { "31j4.ic10", 0x100000, 0x00edb66a, BRF_GRA }, // 9 + { "31j6.ic12", 0x100000, 0x79956cf8, BRF_GRA }, // 10 + { "31j7.ic13", 0x100000, 0x74d774c3, BRF_GRA }, // 11 + { "31j9.ic15", 0x100000, 0xdd387289, BRF_GRA }, // 12 + { "31j8.ic14", 0x100000, 0x44abe127, BRF_GRA }, // 13 + + { "31j10.ic73", 0x080000, 0x6c522edb, BRF_SND }, // 14 Samples +}; + +STD_ROM_PICK(Drv) +STD_ROM_FN(Drv) + +static struct BurnRomInfo DrvaRomDesc[] = { + { "wf_19.rom", 0x040000, 0xbd02e3c4, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "wf_18.rom", 0x040000, 0x933ea1a0, BRF_ESS | BRF_PRG }, // 1 + + { "31a11-2.ic42", 0x010000, 0x5ddebfea, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "wf_33.rom", 0x020000, 0x06f22615, BRF_GRA }, // 3 Chars + + { "31j0.ic1", 0x040000, 0x8a12b450, BRF_GRA }, // 4 Tiles + { "31j1.ic2", 0x040000, 0x82ed7155, BRF_GRA }, // 5 + + { "31j3.ic9", 0x100000, 0xe395cf1d, BRF_GRA }, // 6 Sprites + { "31j2.ic8", 0x100000, 0xb5a97465, BRF_GRA }, // 7 + { "31j5.ic11", 0x100000, 0x2ce545e8, BRF_GRA }, // 8 + { "31j4.ic10", 0x100000, 0x00edb66a, BRF_GRA }, // 9 + { "31j6.ic12", 0x100000, 0x79956cf8, BRF_GRA }, // 10 + { "31j7.ic13", 0x100000, 0x74d774c3, BRF_GRA }, // 11 + { "31j9.ic15", 0x100000, 0xdd387289, BRF_GRA }, // 12 + { "31j8.ic14", 0x100000, 0x44abe127, BRF_GRA }, // 13 + + { "31j10.ic73", 0x080000, 0x6c522edb, BRF_SND }, // 14 Samples +}; + +STD_ROM_PICK(Drva) +STD_ROM_FN(Drva) + +static struct BurnRomInfo DrvbRomDesc[] = { + { "2", 0x040000, 0x632bb3a4, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "3", 0x040000, 0xea73369c, BRF_ESS | BRF_PRG }, // 1 + + { "1", 0x010000, 0xd9e8cda2, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "4", 0x020000, 0x520ef575, BRF_GRA }, // 3 Chars + + { "5", 0x020000, 0x35e4d6eb, BRF_GRA }, // 4 Tiles + { "6", 0x020000, 0xa054a5b2, BRF_GRA }, // 5 + { "7", 0x020000, 0x101f0136, BRF_GRA }, // 6 + { "8", 0x020000, 0x7b2ecba7, BRF_GRA }, // 7 + + { "wf_09.rom", 0x100000, 0xe395cf1d, BRF_GRA }, // 8 Sprites + { "wf_08.rom", 0x100000, 0xb5a97465, BRF_GRA }, // 9 + { "wf_11.rom", 0x100000, 0x2ce545e8, BRF_GRA }, // 10 + { "wf_10.rom", 0x100000, 0x00edb66a, BRF_GRA }, // 11 + { "wf_12.rom", 0x100000, 0x79956cf8, BRF_GRA }, // 12 + { "wf_13.rom", 0x100000, 0x74d774c3, BRF_GRA }, // 13 + { "wf_15.rom", 0x100000, 0xdd387289, BRF_GRA }, // 14 + { "wf_14.rom", 0x100000, 0x44abe127, BRF_GRA }, // 15 + + { "wf_73a.rom", 0x080000, 0x6c522edb, BRF_SND }, // 16 Samples +}; + +STD_ROM_PICK(Drvb) +STD_ROM_FN(Drvb) + +static struct BurnRomInfo DrvjRomDesc[] = { + { "31j13-0.ic19", 0x040000, 0x2147780d, BRF_ESS | BRF_PRG }, // 0 68000 Program Code + { "31j14-0.ic18", 0x040000, 0xd76fc747, BRF_ESS | BRF_PRG }, // 1 + + { "31a11-2.ic42", 0x010000, 0x5ddebfea, BRF_ESS | BRF_PRG }, // 2 Z80 Program + + { "31j12-0.ic33", 0x020000, 0xf4821fe0, BRF_GRA }, // 3 Chars + + { "31j0.ic1", 0x040000, 0x8a12b450, BRF_GRA }, // 4 Tiles + { "31j1.ic2", 0x040000, 0x82ed7155, BRF_GRA }, // 5 + + { "31j3.ic9", 0x100000, 0xe395cf1d, BRF_GRA }, // 6 Sprites + { "31j2.ic8", 0x100000, 0xb5a97465, BRF_GRA }, // 7 + { "31j5.ic11", 0x100000, 0x2ce545e8, BRF_GRA }, // 8 + { "31j4.ic10", 0x100000, 0x00edb66a, BRF_GRA }, // 9 + { "31j6.ic12", 0x100000, 0x79956cf8, BRF_GRA }, // 10 + { "31j7.ic13", 0x100000, 0x74d774c3, BRF_GRA }, // 11 + { "31j9.ic15", 0x100000, 0xdd387289, BRF_GRA }, // 12 + { "31j8.ic14", 0x100000, 0x44abe127, BRF_GRA }, // 13 + + { "31j10.ic73", 0x080000, 0x6c522edb, BRF_SND }, // 14 Samples +}; + +STD_ROM_PICK(Drvj) +STD_ROM_FN(Drvj) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + Drv68KRom = Next; Next += 0x80000; + DrvZ80Rom = Next; Next += 0x10000; + MSM6295ROM = Next; Next += 0x40000; + DrvMSM6295ROMSrc = Next; Next += 0x80000; + + RamStart = Next; + + Drv68KRam = Next; Next += 0x04000; + DrvZ80Ram = Next; Next += 0x00800; + DrvCharVideoRam = Next; Next += 0x02000; + DrvSpriteRam = Next; Next += 0x02000; + DrvSpriteRamBuff = Next; Next += 0x02000; + DrvBg0VideoRam = Next; Next += 0x01000; + DrvBg1VideoRam = Next; Next += 0x01000; + DrvPaletteRam = Next; Next += 0x04000; + + RamEnd = Next; + + DrvChars = Next; Next += 0x01000 * 8 * 8; + DrvTiles = Next; Next += 0x01000 * 16 * 16; + DrvSprites = Next; Next += 0x10000 * 16 * 16; + DrvPalette = (UINT32*)Next; Next += 0x02000 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM2151Reset(); + MSM6295Reset(0); + + DrvVBlank = 0; + DrvBg0ScrollX = 0; + DrvBg0ScrollY = 0; + DrvBg1ScrollX = 0; + DrvBg1ScrollY = 0; + DrvVReg = 0; + DrvOkiBank = 0; + DrvSoundLatch = 0; + + return 0; +} + +UINT8 __fastcall Wwfwfest68KReadByte(UINT32 a) +{ + switch (a) { + case 0x140020: { + return (0xcf - DrvInput[4]) | ((DrvDip[1] & 0xc0) >> 2); + } + + case 0x140021: { + return 0xff - DrvInput[0]; + } + + case 0x140023: { + return 0xff - DrvInput[1]; + } + + case 0x140025: { + return 0xff - DrvInput[2]; + } + + case 0x140026: { + UINT8 Temp = 0xfc; + if (DrvVBlank) Temp = 0xfb; + Temp |= (DrvDip[0] & 0xc0) >> 6; + return Temp; + } + + case 0x140027: { + return 0xff - DrvInput[3]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Wwfwfest68KWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x0c0000 && a <= 0x0c1fff) { + UINT16 *CharRam = (UINT16*)DrvCharVideoRam; + CharRam[(a - 0x0c0000) >> 1] = d; + return; + } + + switch (a) { + case 0x140011: { + DrvVReg = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Wwfwfest68KReadWord(UINT32 a) +{ + if (a >= 0x180000 && a <= 0x18ffff) { + UINT16 *PaletteRam = (UINT16*)DrvPaletteRam; + INT32 Offset = (a - 0x180000) >> 1; + Offset = (Offset & 0x0f) | (Offset & 0x7fc0) >> 2; + return PaletteRam[Offset]; + } + + switch (a) { + case 0x140020: { + UINT16 Temp = (0xff - DrvInput[0]) | ((0xff - DrvInput[4]) << 8); + Temp &= 0xcfff; + Temp |= ((DrvDip[1] & 0xc0) << 6); + return Temp; + } + + case 0x140022: { + UINT16 Temp = 0xff - DrvInput[1]; + Temp |= ((DrvDip[1] & 0x3f) << 8); + return Temp; + } + + case 0x140024: { + UINT16 Temp = 0xff - DrvInput[2]; + Temp |= ((DrvDip[0] & 0x3f) << 8); + return Temp; + } + + case 0x140026: { + UINT16 Temp = 0xff - DrvInput[3]; + if (DrvVBlank) { + Temp |= (0xfb << 8); + } else { + Temp |= (0xff << 8); + } + Temp &= 0xfcff; + Temp |= ((DrvDip[0] & 0xc0) << 2); + return Temp; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Wwfwfest68KWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x0c0000 && a <= 0x0c1fff) { + UINT16 *CharRam = (UINT16*)DrvCharVideoRam; + CharRam[(a - 0x0c0000) >> 1] = d; + return; + } + + if (a >= 0x180000 && a <= 0x18ffff) { + UINT16 *PaletteRam = (UINT16*)DrvPaletteRam; + INT32 Offset = (a - 0x180000) >> 1; + Offset = (Offset & 0x0f) | (Offset & 0x7fc0) >> 2; + PaletteRam[Offset] = d; + return; + } + + if (a >= 0x120000 && a <= 0x121fff) { + return; + } + + switch (a) { + case 0x100000: { + DrvBg0ScrollX = d & 0x1ff; + return; + } + + case 0x100002: { + DrvBg0ScrollY = d & 0x1ff; + return; + } + + case 0x100004: { + DrvBg1ScrollX = d & 0x1ff; + return; + } + + case 0x100006: { + DrvBg1ScrollY = d & 0x1ff; + return; + } + + case 0x140010: { + DrvVReg = d; + return; + } + + case 0x14000c: { + DrvSoundLatch = d & 0xff; + ZetOpen(0); + ZetNmi(); + nCyclesDone[1] += ZetRun(100); + ZetClose(); + return; + } + + case 0x100008: { + // ??? + return; + } + + case 0x10000c: { + // ??? + return; + } + + case 0x140000: + case 0x140002: { + // NOP + return; + } + + case 0x140006: + case 0x140008: + case 0x140012: + case 0x140014: + case 0x140016: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall WwfwfestZ80Read(UINT16 a) +{ + switch (a) { + case 0xc801: { + return BurnYM2151ReadStatus(); + } + + case 0xd800: { + return MSM6295ReadStatus(0); + } + + case 0xe000: { + return DrvSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall WwfwfestZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xc800: { + BurnYM2151SelectRegister(d); + return; + } + + case 0xc801: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xd800: { + MSM6295Command(0, d); + return; + } + + case 0xe800: { + DrvOkiBank = d & 1; + memcpy(MSM6295ROM + 0x00000, DrvMSM6295ROMSrc + (0x40000 * DrvOkiBank), 0x40000); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 CharPlaneOffsets[4] = { 0, 2, 4, 6 }; +static INT32 CharXOffsets[8] = { 1, 0, 65, 64, 129, 128, 193, 192 }; +static INT32 CharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 TilePlaneOffsets[4] = { 8, 0, 0x200008, 0x200000 }; +static INT32 TileXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 256, 257, 258, 259, 260, 261, 262, 263 }; +static INT32 TileYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 }; +static INT32 SpritePlaneOffsets[4] = { 0, 0x1000000, 0x2000000, 0x3000000 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 SpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; + +static void DrvYM2151IrqHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvInit() +{ + INT32 nRet = 0, nLen, RomOffset; + + RomOffset = 0; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "wwfwfestb")) RomOffset = 2; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + DrvTempRom = (UINT8 *)BurnMalloc(0x800000); + + // Load 68000 Program Roms + nRet = BurnLoadRom(Drv68KRom + 0x00000, 0, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(Drv68KRom + 0x00001, 1, 2); if (nRet != 0) return 1; + + // Load Z80 Program Roms + nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1; + + // Load and decode the chars + nRet = BurnLoadRom(DrvTempRom + 0x000000, 3, 1); if (nRet != 0) return 1; + GfxDecode(0x1000, 4, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x100, DrvTempRom, DrvChars); + + // Load and decode the tiles + memset(DrvTempRom, 0, 0x800000); + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "wwfwfestb")) { + nRet = BurnLoadRom(DrvTempRom + 0x040000, 4, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x040001, 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000000, 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000001, 7, 2); if (nRet != 0) return 1; + } else { + nRet = BurnLoadRom(DrvTempRom + 0x040000, 4, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x000000, 5, 1); if (nRet != 0) return 1; + } + GfxDecode(0x1000, 4, 16, 16, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x200, DrvTempRom, DrvTiles); + + // Load and decode the sprites + memset(DrvTempRom, 0, 0x800000); + nRet = BurnLoadRom(DrvTempRom + 0x000000, 6 + RomOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x100000, 7 + RomOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x200000, 8 + RomOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x300000, 9 + RomOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x400000, 10 + RomOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x500000, 11 + RomOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x600000, 12 + RomOffset, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x700000, 13 + RomOffset, 1); if (nRet != 0) return 1; + GfxDecode(0x10000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x100, DrvTempRom, DrvSprites); + + // Load Sample Roms + nRet = BurnLoadRom(DrvMSM6295ROMSrc + 0x00000, 14 + RomOffset, 1); if (nRet != 0) return 1; + memcpy(MSM6295ROM, DrvMSM6295ROMSrc, 0x40000); + + BurnFree(DrvTempRom); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KRom , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvBg0VideoRam , 0x080000, 0x080fff, SM_RAM); + SekMapMemory(DrvBg1VideoRam , 0x082000, 0x082fff, SM_RAM); + SekMapMemory(DrvCharVideoRam , 0x0c0000, 0x0c1fff, SM_ROM); + SekMapMemory(DrvSpriteRam , 0x0c2000, 0x0c3fff, SM_RAM); + SekMapMemory(Drv68KRam , 0x1c0000, 0x1c3fff, SM_RAM); + SekSetReadWordHandler(0, Wwfwfest68KReadWord); + SekSetWriteWordHandler(0, Wwfwfest68KWriteWord); + SekSetReadByteHandler(0, Wwfwfest68KReadByte); + SekSetWriteByteHandler(0, Wwfwfest68KWriteByte); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(WwfwfestZ80Read); + ZetSetWriteHandler(WwfwfestZ80Write); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80Rom ); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80Rom ); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80Ram ); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram ); + ZetClose(); + + // Setup the YM2151 emulation + BurnYM2151Init(3579545); + BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler); + BurnYM2151SetAllRoutes(0.45, BURN_SND_ROUTE_BOTH); + + // Setup the OKIM6295 emulation + MSM6295Init(0, 1024188 / 132, 1); + MSM6295SetRoute(0, 0.90, BURN_SND_ROUTE_BOTH); + + DrvSpriteXOffset = 0; + DrvBg0XOffset = 0; + DrvBg1XOffset[0] = 0; + DrvBg1XOffset[1] = 0; + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "wwfwfestb")) { + DrvSpriteXOffset = 2; + DrvBg0XOffset = -4; + DrvBg1XOffset[0] = -4; + DrvBg1XOffset[1] = -2; + } + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + SekExit(); + ZetExit(); + + BurnYM2151Exit(); + MSM6295Exit(0); + + GenericTilesExit(); + + DrvVBlank = 0; + DrvBg0ScrollX = 0; + DrvBg0ScrollY = 0; + DrvBg1ScrollX = 0; + DrvBg1ScrollY = 0; + DrvVReg = 0; + DrvOkiBank = 0; + DrvSoundLatch = 0; + + DrvSpriteXOffset = 0; + DrvBg0XOffset = 0; + DrvBg1XOffset[0] = 0; + DrvBg1XOffset[1] = 0; + + BurnFree(Mem); + + return 0; +} + +static inline UINT8 pal4bit(UINT8 bits) +{ + bits &= 0x0f; + return (bits << 4) | bits; +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(nColour >> 0); + g = pal4bit(nColour >> 4); + b = pal4bit(nColour >> 8); + + return BurnHighCol(r, g, b, 0); +} + +static void DrvCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x2000; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } +} + +static void DrvRenderBg0Layer(INT32 Opaque) +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0, xScroll, yScroll, Flip, xFlip, yFlip; + + UINT16 *VideoRam = (UINT16*)DrvBg0VideoRam; + UINT16 *TileBase; + + if (DrvVReg == 0x78) { + xScroll = DrvBg0ScrollX + DrvBg0XOffset; + yScroll = DrvBg0ScrollY; + } else { + xScroll = DrvBg1ScrollX + DrvBg0XOffset; + yScroll = DrvBg1ScrollY; + } + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + TileBase = &VideoRam[TileIndex * 2]; + Code = TileBase[1] & 0xfff; + Colour = TileBase[0] & 0x0f; + Flip = (TileBase[0] & 0xc0) >> 6; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + + x = 16 * mx; + y = 16 * my; + + x -= xScroll; + y -= yScroll; + if (x < -16) x += 512; + if (y < -16) y += 512; + + y -= 8; + + if (Opaque) { + if (x > 16 && x < 304 && y > 16 && y < 224) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); + } else { + Render16x16Tile_FlipX(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); + } else { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); + } else { + Render16x16Tile_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0x1000, DrvTiles); + } + } + } + } else { + if (x > 16 && x < 304 && y > 16 && y < 224) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); + } else { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x1000, DrvTiles); + } + } + } + } + + TileIndex++; + } + } +} + +static void DrvRenderBg1Layer(INT32 Opaque) +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0, xScroll, yScroll; + + UINT16 *VideoRam = (UINT16*)DrvBg1VideoRam; + UINT16 *TileBase; + + if (DrvVReg == 0x78) { + xScroll = DrvBg1ScrollX + DrvBg1XOffset[0]; + yScroll = DrvBg1ScrollY; + } else { + xScroll = DrvBg0ScrollX + DrvBg1XOffset[1]; + yScroll = DrvBg0ScrollY; + } + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 32; mx++) { + TileBase = &VideoRam[TileIndex]; + Code = TileBase[0] & 0xfff; + Colour = (TileBase[0] & 0xf000) >> 12; + + x = 16 * mx; + y = 16 * my; + + x -= xScroll; + y -= yScroll; + if (x < -16) x += 512; + if (y < -16) y += 512; + + y -= 8; + + if (Opaque) { + if (x > 0 && x < 304 && y > 0 && y < 224) { + Render16x16Tile(pTransDraw, Code, x, y, Colour, 4, 0x0c00, DrvTiles); + } else { + Render16x16Tile_Clip(pTransDraw, Code, x, y, Colour, 4, 0x0c00, DrvTiles); + } + } else { + if (x > 0 && x < 304 && y > 0 && y < 224) { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0x0c00, DrvTiles); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0x0c00, DrvTiles); + } + } + + TileIndex++; + } + } +} + +static void DrvRenderSprites() +{ + UINT16 *Source = (UINT16*)DrvSpriteRamBuff; + UINT16 *Finish = (UINT16*)DrvSpriteRamBuff + 0x1000; + + while (Source < Finish) { + INT32 x, y, Colour, xFlip, yFlip, Chain, Enable, Code, Count; + + Enable = Source[1] & 1; + + if (Enable) { + x = +(Source[5] & 0x00ff) | (Source[1] & 0x0004) << 6; + if (x > 512 - 16) x -= 512; + x += DrvSpriteXOffset; + y = (Source[0] & 0x00ff) | (Source[1] & 0x0002) << 7; + y = (256 - y) & 0x1ff; + y -= 16; + y -= 8; + xFlip = (Source[1] & 0x0010) >> 4; + yFlip = (Source[1] & 0x0008) >> 3; + Chain = (Source[1] & 0x00e0) >> 5; + Chain += 1; + Code = (Source[2] & 0x00ff) | (Source[3] & 0x00ff) << 8; + Colour = (Source[4] & 0x000f); + + for (Count = 0; Count < Chain; Count++) { + INT32 yPos; + yPos = y - 16 * Count; + if (yFlip) yPos = y - (16 * (Chain - 1)) + (16 * Count); + + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code + Count, x, yPos, Colour, 4, 0, 0x400, DrvSprites); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code + Count, x, yPos, Colour, 4, 0, 0x400, DrvSprites); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code + Count, x, yPos, Colour, 4, 0, 0x400, DrvSprites); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code + Count, x, yPos, Colour, 4, 0, 0x400, DrvSprites); + } + } + } + } + + Source += 8; + } +} + +static void DrvRenderCharLayer() +{ + INT32 mx, my, Code, Colour, x, y, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)DrvCharVideoRam; + UINT16 *TileBase; + + for (my = 0; my < 32; my++) { + for (mx = 0; mx < 64; mx++) { + TileBase = &VideoRam[TileIndex * 2]; + Code = (TileBase[0] & 0xff) | ((TileBase[1] & 0x0f) << 8); + Colour = (TileBase[1] & 0xf0) >> 4; + + x = 8 * mx; + y = 8 * my; + + y -= 8; + + if (x > 0 && x < 312 && y > 0 && y < 232) { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvChars); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, DrvChars); + } + + TileIndex++; + } + } +} + +static void DrvDraw() +{ + BurnTransferClear(); + DrvCalcPalette(); + + if (DrvVReg == 0x7b) { + DrvRenderBg0Layer(1); + DrvRenderBg1Layer(0); + DrvRenderSprites(); + DrvRenderCharLayer(); + } + + if (DrvVReg == 0x7c) { + DrvRenderBg0Layer(1); + DrvRenderSprites(); + DrvRenderBg1Layer(0); + DrvRenderCharLayer(); + } + + if (DrvVReg == 0x78) { + DrvRenderBg1Layer(1); + DrvRenderBg0Layer(0); + DrvRenderSprites(); + DrvRenderCharLayer(); + } + + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + + if (DrvReset) DrvDoReset(); + + DrvMakeInputs(); + + nCyclesTotal[0] = (24000000 / 2) / 60; + nCyclesTotal[1] = 3579545 / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + DrvVBlank = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 5) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + if (i == 5) DrvVBlank = 1; + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + SekOpen(0); + SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) DrvDraw(); + + memcpy(DrvSpriteRamBuff, DrvSpriteRam, 0x2000); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029674; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); // Scan Z80 + BurnYM2151Scan(nAction); + MSM6295Scan(0, nAction); + + // Scan critical driver variables + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(DrvDip); + SCAN_VAR(DrvInput); + SCAN_VAR(DrvVBlank); + SCAN_VAR(DrvOkiBank); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(DrvBg0ScrollX); + SCAN_VAR(DrvBg0ScrollY); + SCAN_VAR(DrvBg1ScrollX); + SCAN_VAR(DrvBg1ScrollY); + SCAN_VAR(DrvVReg); + } + + if (nAction & ACB_WRITE) { + memcpy(MSM6295ROM + 0x00000, DrvMSM6295ROMSrc + (0x40000 * DrvOkiBank), 0x40000); + } + + return 0; +} + +struct BurnDriver BurnDrvWwfwfest = { + "wwfwfest", NULL, NULL, NULL, "1991", + "WWF WrestleFest (US set 1)\0", NULL, "Technos Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, + NULL, DrvRomInfo, DrvRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvWwfwfesta = { + "wwfwfesta", "wwfwfest", NULL, NULL, "1991", + "WWF WrestleFest (US Tecmo)\0", NULL, "Technos Japan (Tecmo License)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, + NULL, DrvaRomInfo, DrvaRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvWwfwfestb = { + "wwfwfestb", "wwfwfest", NULL, NULL, "1991", + "WWF WrestleFest (US bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 4, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, + NULL, DrvbRomInfo, DrvbRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvWwfwfestj = { + "wwfwfestj", "wwfwfest", NULL, NULL, "1991", + "WWF WrestleFest (Japan)\0", NULL, "Technos Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TECHNOS, GBF_VSFIGHT, 0, + NULL, DrvjRomInfo, DrvjRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, NULL, DrvScan, + NULL, 0x2000, 320, 240, 4, 3 +}; diff --git a/src/burn/drv/pst90s/d_yunsun16.cpp b/src/burn/drv/pst90s/d_yunsun16.cpp index 9c10a0c12..55730391a 100644 --- a/src/burn/drv/pst90s/d_yunsun16.cpp +++ b/src/burn/drv/pst90s/d_yunsun16.cpp @@ -1,1117 +1,1116 @@ -// FB Alpha Yun Sung 16 Bit Games driver module -// Based on MAME driver by Luca Elia - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym3812.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvSndROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvVidRAM0; -static UINT8 *DrvVidRAM1; -static UINT8 *DrvSprRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static INT32 soundbank; -static UINT16 *scroll; -static UINT8 *soundlatch; -static UINT8 *video_priority; - -static UINT16 DrvInputs[2]; -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; - -static INT32 is_magicbub = 0; - -static struct BurnInputInfo MagicbubInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 4, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 5, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 11, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 10, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 9, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 8, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Magicbub) - -static struct BurnInputInfo BombkickInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy2 + 4, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 5, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy1 + 11, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy1 + 10, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy1 + 9, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy1 + 8, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 14, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Bombkick) - -static struct BurnDIPInfo MagicbubDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xbf, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x0e, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x0e, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, - {0x0e, 0x01, 0x07, 0x01, "3 Coins 2 Credits" }, - {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x0e, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x0e, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x0e, 0x01, 0x18, 0x10, "Easy" }, - {0x0e, 0x01, 0x18, 0x18, "Normal" }, - {0x0e, 0x01, 0x18, 0x08, "Hard" }, - {0x0e, 0x01, 0x18, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 0, "Demo Sounds" }, - {0x0e, 0x01, 0x40, 0x40, "Off" }, - {0x0e, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 0, "Service Mode" }, - {0x0e, 0x01, 0x80, 0x80, "Off" }, - {0x0e, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "1P Vs 2P Rounds (Start)" }, - {0x0f, 0x01, 0x0c, 0x08, "Best of 1" }, - {0x0f, 0x01, 0x0c, 0x0c, "Best of 3" }, - {0x0f, 0x01, 0x0c, 0x04, "Best of 5" }, - {0x0f, 0x01, 0x0c, 0x00, "Best of 7" }, - - {0 , 0xfe, 0 , 0, "1P Vs 2P Rounds (Join-in)" }, - {0x0f, 0x01, 0x10, 0x00, "Best of 1" }, - {0x0f, 0x01, 0x10, 0x10, "Best of 3" }, -}; - -STDDIPINFO(Magicbub) - -static struct BurnDIPInfo MagicbubaDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xbf, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x0e, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x0e, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, - {0x0e, 0x01, 0x07, 0x01, "3 Coins 2 Credits" }, - {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x0e, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x0e, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x0e, 0x01, 0x18, 0x10, "Easy" }, - {0x0e, 0x01, 0x18, 0x18, "Normal" }, - {0x0e, 0x01, 0x18, 0x08, "Hard" }, - {0x0e, 0x01, 0x18, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 0, "Demo Sounds" }, - {0x0e, 0x01, 0x40, 0x40, "Off" }, - {0x0e, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0e, 0x01, 0x80, 0x80, "Off" }, - {0x0e, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Nudity" }, - {0x0f, 0x01, 0x03, 0x03, "Soft only" }, - {0x0f, 0x01, 0x03, 0x00, "Hard only" }, - {0x0f, 0x01, 0x03, 0x01, "Soft and Hard" }, - {0x0f, 0x01, 0x03, 0x02, "Soft then Hard" }, - - {0 , 0xfe, 0 , 4, "1P Vs 2P Rounds (Start)" }, - {0x0f, 0x01, 0x0c, 0x08, "Best of 1" }, - {0x0f, 0x01, 0x0c, 0x0c, "Best of 3" }, - {0x0f, 0x01, 0x0c, 0x04, "Best of 5" }, - {0x0f, 0x01, 0x0c, 0x00, "Best of 7" }, - - {0 , 0xfe, 0 , 4, "1P Vs 2P Rounds (Join-in)" }, - {0x0f, 0x01, 0x10, 0x00, "Best of 1" }, - {0x0f, 0x01, 0x10, 0x10, "Best of 3" }, -}; - -STDDIPINFO(Magicbuba) - -static struct BurnDIPInfo ShockingDIPList[]= -{ - {0x0e, 0xff, 0xff, 0xff, NULL }, - {0x0f, 0xff, 0xff, 0xbf, NULL }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x0e, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, - {0x0e, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, - {0x0e, 0x01, 0x07, 0x03, "3 Coins 2 Credits" }, - {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x0e, 0x01, 0x07, 0x04, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x0e, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 0, "Difficulty" }, - {0x0f, 0x01, 0x07, 0x04, "Easiest" }, - {0x0f, 0x01, 0x07, 0x05, "Easier" }, - {0x0f, 0x01, 0x07, 0x06, "Easy" }, - {0x0f, 0x01, 0x07, 0x07, "Normal" }, - {0x0f, 0x01, 0x07, 0x03, "Medium" }, - {0x0f, 0x01, 0x07, 0x02, "Hard" }, - {0x0f, 0x01, 0x07, 0x01, "Harder" }, - {0x0f, 0x01, 0x07, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 0, "Lives" }, - {0x0f, 0x01, 0x30, 0x20, "2" }, - {0x0f, 0x01, 0x30, 0x30, "3" }, - {0x0f, 0x01, 0x30, 0x10, "4" }, - {0x0f, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 0, "Demo Sounds" }, - {0x0f, 0x01, 0x40, 0x40, "Off" }, - {0x0f, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x0f, 0x01, 0x80, 0x80, "Off" }, - {0x0f, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Shocking) - -static struct BurnDIPInfo BombkickDIPList[]= -{ - {0x12, 0xff, 0xff, 0x9f, NULL }, - {0x13, 0xff, 0xff, 0xaf, NULL }, - - {0 , 0xfe, 0 , 8, "Coinage" }, - {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x07, 0x01, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x07, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x12, 0x01, 0x18, 0x10, "Easy" }, - {0x12, 0x01, 0x18, 0x18, "Normal" }, - {0x12, 0x01, 0x18, 0x08, "Hard" }, - {0x12, 0x01, 0x18, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Special Powers" }, - {0x12, 0x01, 0x20, 0x20, "2" }, - {0x12, 0x01, 0x20, 0x00, "3" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x40, 0x40, "Off" }, - {0x12, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x80, 0x80, "Off" }, - {0x12, 0x01, 0x80, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x03, 0x00, "2" }, - {0x13, 0x01, 0x03, 0x03, "3" }, - {0x13, 0x01, 0x03, 0x02, "4" }, - {0x13, 0x01, 0x03, 0x01, "5" }, - -}; - -STDDIPINFO(Bombkick) - -static struct BurnDIPInfo PaprazziDIPList[]= -{ - {0x0e, 0xff, 0xff, 0x9b, NULL }, - {0x0f, 0xff, 0xff, 0xa7, NULL }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x0e, 0x01, 0x03, 0x00, "3 Coins 1 Credits" }, - {0x0e, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, - {0x0e, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, - {0x0e, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x0e, 0x01, 0x08, 0x00, "Korean" }, - {0x0e, 0x01, 0x08, 0x08, "English" }, - - {0 , 0xfe, 0 , 2, "Enemies" }, - {0x0e, 0x01, 0x10, 0x00, "Type 1" }, - {0x0e, 0x01, 0x10, 0x10, "Type 2" }, - - {0 , 0xfe, 0 , 4, "Time" }, - {0x0e, 0x01, 0xc0, 0x00, "80" }, - {0x0e, 0x01, 0xc0, 0x40, "100" }, - {0x0e, 0x01, 0xc0, 0x80, "120" }, - {0x0e, 0x01, 0xc0, 0xc0, "150" }, - - {0 , 0xfe, 0 , 8, "Difficulty" }, - {0x0f, 0x01, 0x07, 0x04, "Easiest" }, - {0x0f, 0x01, 0x07, 0x05, "Easier" }, - {0x0f, 0x01, 0x07, 0x06, "Easy" }, - {0x0f, 0x01, 0x07, 0x07, "Normal" }, - {0x0f, 0x01, 0x07, 0x03, "Medium" }, - {0x0f, 0x01, 0x07, 0x02, "Hard" }, - {0x0f, 0x01, 0x07, 0x01, "Harder" }, - {0x0f, 0x01, 0x07, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x0f, 0x01, 0x30, 0x20, "3" }, - {0x0f, 0x01, 0x30, 0x30, "2" }, - {0x0f, 0x01, 0x30, 0x10, "4" }, - {0x0f, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x0f, 0x01, 0x40, 0x40, "Off" }, - {0x0f, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Gfx Viewer" }, - {0x0f, 0x01, 0x80, 0x80, "Off" }, - {0x0f, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Paprazzi) - -static void set_sample_bank(INT32 bank) -{ - if (bank != soundbank) { - soundbank = bank; - memcpy(DrvSndROM + 0x20000, DrvSndROM + 0x40000 + (soundbank * 0x20000), 0x20000); - } -} - -void __fastcall magicbub_main_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x80010c: - case 0x80010e: - scroll[2 + ((address >> 1) & 1)] = data & 0x3ff; - return; - - case 0x800114: - case 0x800116: - scroll[0 + ((address >> 1) & 1)] = data & 0x3ff; - return; - - case 0x800154: - *video_priority = data & 0xff; - return; - - } -} - -void __fastcall magicbub_main_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x800180: - case 0x800181: - set_sample_bank(data & 3); - return; - - case 0x800188: - case 0x800189: - if (is_magicbub) { - if (data != 0x3a) { - *soundlatch = data; -// ZetNmi(); - Z80SetIrqLine(Z80_INPUT_LINE_NMI, 1); - } - } else { - MSM6295Command(0, data); - } - return; - } -} - -UINT16 __fastcall magicbub_main_read_word(UINT32 address) -{ - switch (address) - { - case 0x800000: - return DrvInputs[0]; - - case 0x800018: - return DrvInputs[1]; - } - - return 0; -} - -UINT8 __fastcall magicbub_main_read_byte(UINT32 address) -{ - switch (address) - { - case 0x800000: - case 0x800001: - return (DrvInputs[0] >> ((~address & 1) << 3)); - - case 0x800018: - case 0x800019: - return (DrvInputs[1] >> ((~address & 1) << 3)); - - case 0x80001a: - case 0x80001b: - return DrvDips[0]; - - case 0x80001c: - case 0x80001d: - return DrvDips[1]; - - case 0x800188: - case 0x800189: - return MSM6295ReadStatus(0); - } - - return 0; -} - -void __fastcall magicbub_sound_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x10: - BurnYM3812Write(0, data); - return; - - case 0x11: - BurnYM3812Write(1, data); - return; - - case 0x1c: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall magicbub_sound_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x10: - return BurnYM3812Read(0); - - case 0x11: - return BurnYM3812Read(1); - - case 0x18: - Z80SetIrqLine(Z80_INPUT_LINE_NMI, 0); - return *soundlatch; - - case 0x1c: - return MSM6295ReadStatus(0); - } - - return 0; -} - - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3000000; -} - -static void DrvYM3812IrqHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM3812Reset(); - - memcpy (DrvSndROM, DrvSndROM + 0x40000, 0x40000); - soundbank = 1; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x080000; - DrvZ80ROM = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x400000; - DrvGfxROM1 = Next; Next += 0x200000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x080000 + 0x40000; - - DrvPalette = (UINT32*)Next; Next += 0x2000 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvVidRAM0 = Next; Next += 0x004000; - DrvVidRAM1 = Next; Next += 0x004000; - DrvSprRAM = Next; Next += 0x001000; - DrvPalRAM = Next; Next += 0x004000; - - DrvZ80RAM = Next; Next += 0x000800; - - scroll = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); - soundlatch = Next; Next += 0x000001; - video_priority = Next; Next += 0x000001; - - RamEnd = Next; - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[8] = { 0x030, 0x020, 0x010, 0x000, 0x038, 0x028, 0x018, 0x008 }; - INT32 Plane1[4] = { 0x600000, 0x200000, 0x400000, 0x000000 }; - INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x040, 0x041, 0x042, 0x043, 0x044, 0x045, 0x046, 0x047 }; - INT32 XOffs1[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f }; - INT32 YOffs0[16] = { 0x000, 0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, - 0x400, 0x480, 0x500, 0x580, 0x600, 0x680, 0x700, 0x780 }; - INT32 YOffs1[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, - 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x400000); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x400000; i++) { - tmp[i] = DrvGfxROM0[(i & ~7) | ((i & 6) >> 1) | ((i & 1) << 2)]; - } - - GfxDecode(0x4000, 8, 16, 16, Plane0, XOffs0, YOffs0, 0x800, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x100000); - - GfxDecode(0x2000, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit(INT32 game_select) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - INT32 offset = 0; - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - memset (DrvGfxROM0, 0xff, 0x400000); - - switch (game_select) - { - case 0: // magicbub - { - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000002, 5, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000003, 6, 4)) return 1; - offset = 7; - - is_magicbub = 1; - } - break; - - case 1: // magicbuba - { - if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000002, 5, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000003, 6, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200000, 7, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200001, 8, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200002, 9, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200003, 10, 4)) return 1; - offset = 11; - - is_magicbub = 1; - } - break; - - case 2: // paprazzi - { - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 3, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000002, 4, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000003, 5, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200000, 6, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200001, 7, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200002, 8, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x200003, 9, 4)) return 1; - offset = 10; - } - break; - - case 3: // shocking, bombkick - { - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000001, 3, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000002, 4, 4)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x000003, 5, 4)) return 1; - offset = 6; - } - break; - } - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, offset + 0, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x040000, offset + 1, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x080000, offset + 2, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, offset + 3, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x040000, offset + 4, 1)) return 1; - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x900000, 0x903fff, SM_RAM); - SekMapMemory(DrvVidRAM1, 0x908000, 0x90bfff, SM_RAM); - SekMapMemory(DrvVidRAM0, 0x90c000, 0x90ffff, SM_RAM); - SekMapMemory(DrvSprRAM, 0x910000, 0x910fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0xff0000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, magicbub_main_write_word); - SekSetWriteByteHandler(0, magicbub_main_write_byte); - SekSetReadWordHandler(0, magicbub_main_read_word); - SekSetReadByteHandler(0, magicbub_main_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xdfff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xdfff, 2, DrvZ80ROM); - ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM); - ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM); - ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM); - ZetSetOutHandler(magicbub_sound_out); - ZetSetInHandler(magicbub_sound_in); - ZetMemEnd(); - ZetClose(); - - BurnYM3812Init(4000000, &DrvYM3812IrqHandler, &DrvSynchroniseStream, 0); - BurnTimerAttachZetYM3812(3000000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 0.80, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, (is_magicbub ? 1056000 : 1000000) / 132, is_magicbub); - MSM6295SetRoute(0, (is_magicbub ? 0.80 : 1.00), BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - MSM6295Exit(0); - BurnYM3812Exit(); - - SekExit(); - ZetExit(); - GenericTilesExit(); - - BurnFree (AllMem); - - is_magicbub = 0; - - return 0; -} - -static inline void DrvRecalcPal() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - for (INT32 i = 0; i < 0x2000; i++) { - if (i == 0x200) i = 0x1000; - INT32 d = p[i]; - - r = (d >> 10) & 0x1f; - g = (d >> 5) & 0x1f; - b = (d >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static void draw_layer(INT32 scr, INT32 pri) -{ - INT32 scrollx = scroll[scr * 2 + 0] + ((scr) ? 0x38 : 0x34) + ((is_magicbub) ? 32 : 0); - INT32 scrolly = scroll[scr * 2 + 1] + 0x10; - - UINT16 *vram = (UINT16*)(scr ? DrvVidRAM1 : DrvVidRAM0); - - for (INT32 offs = 0; offs < 64 * 64; offs++) - { - INT32 sx = (offs & 0x3f) << 4; - INT32 sy = (offs >> 6) << 4; - - sx -= scrollx; - if (sx < -15) sx += 1024; - sy -= scrolly; - if (sy < -15) sy += 1024; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 ofst = (offs & 0xc00) + ((offs << 4) & 0x300) + ((offs >> 6) & 0x0f) + ((offs & 0x0f) << 4); - - INT32 code = vram[ofst * 2 + 0] & 0x3fff; - INT32 attr = vram[ofst * 2 + 1]; - - if (pri) { - if (attr & 0x20) { - Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 8, 0x1000, DrvGfxROM0); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 8, 0x1000, DrvGfxROM0); - } - } else { - if (attr & 0x20) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 8, 0xff, 0x1000, DrvGfxROM0); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 8, 0xff, 0x1000, DrvGfxROM0); - } - } - } -} - -static void draw_sprites(INT32 pri) -{ - if ((*video_priority & 3) != pri) return; - - INT32 x_offset = is_magicbub ? 96 : 64; - UINT16 *vram = (UINT16*)DrvSprRAM; - - for (INT32 offs = 0; offs < 0x1000 / 2; offs += 8 / 2) - { - INT32 sx = vram[offs + 0] - x_offset; - INT32 sy = vram[offs + 1] - 0x0f; - INT32 code = vram[offs + 2] & 0x1fff; - INT32 attr = vram[offs + 3]; - INT32 flipx = attr & 0x20; - INT32 flipy = attr & 0x40; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, attr & 0x1f, 4, 15, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, attr & 0x1f, 4, 15, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, attr & 0x1f, 4, 15, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, attr & 0x1f, 4, 15, 0, DrvGfxROM1); - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvRecalcPal(); - } - - if ((*video_priority & 0x0c) == 0x04) { - draw_layer(0, 1); - - if (nSpriteEnable & 1) draw_sprites(1); - - if (nBurnLayer & 2) draw_layer(0, 0); - if (nSpriteEnable & 2 )draw_sprites(2); - - if (nBurnLayer & 4) draw_layer(1, 0); - - if (nSpriteEnable & 4) { - draw_sprites(3); - draw_sprites(0); - } - } else if ((*video_priority & 0x0c) == 0x08) { - draw_layer(1, 1); - - if (nSpriteEnable & 1) draw_sprites(1); - - if (nBurnLayer & 2) draw_layer(1, 0); - - if (nSpriteEnable & 2)draw_sprites(2); - - if (nBurnLayer & 4) draw_layer(0, 0); - - if (nSpriteEnable & 4) { - draw_sprites(3); - draw_sprites(0); - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - memset (DrvInputs, 0xff, 2 * sizeof(UINT16)); - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= DrvJoy1[i] << i; - DrvInputs[1] ^= DrvJoy2[i] << i; - } - } - - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { 16000000 / 60, 3000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nSegment = nCyclesTotal[0] / nInterleave; - nCyclesDone[0] += SekRun(nSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - - if (is_magicbub == 0) continue; - - nSegment = nCyclesTotal[1] / nInterleave; - BurnTimerUpdateYM3812((1 + i) * nSegment); - } - - if (is_magicbub) { - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - } - - if (pBurnSoundOut) { - if (is_magicbub) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - } - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029707; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM3812Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - - SCAN_VAR(soundbank); - - INT32 bank = soundbank; - soundbank = -1; - set_sample_bank(bank); - } - - return 0; -} - - -// Magic Bubble - -static struct BurnRomInfo magicbubRomDesc[] = { - { "magbuble.u33", 0x40000, 0x18fdd582, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "magbuble.u32", 0x40000, 0xf6ea7004, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "magbuble.143", 0x10000, 0x04192753, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "magbuble.u67", 0x80000, 0x6355e57d, 3 | BRF_GRA }, // 3 Background Tiles - { "magbuble.u68", 0x80000, 0x53ae6c2b, 3 | BRF_GRA }, // 4 - { "magbuble.u69", 0x80000, 0xb892e64c, 3 | BRF_GRA }, // 5 - { "magbuble.u70", 0x80000, 0x37794837, 3 | BRF_GRA }, // 6 - - { "magbuble.u20", 0x20000, 0xf70e3b8c, 4 | BRF_GRA }, // 7 Sprites - { "magbuble.u21", 0x20000, 0xad082cf3, 4 | BRF_GRA }, // 8 - { "magbuble.u22", 0x20000, 0x7c68df7a, 4 | BRF_GRA }, // 9 - { "magbuble.u23", 0x20000, 0xc7763fc1, 4 | BRF_GRA }, // 10 - - { "magbuble.131", 0x20000, 0x03e04e89, 5 | BRF_SND }, // 11 Samples -}; - -STD_ROM_PICK(magicbub) -STD_ROM_FN(magicbub) - -static INT32 MagicbubInit() -{ - return DrvInit(0); -} - -struct BurnDriver BurnDrvMagicbub = { - "magicbub", NULL, NULL, NULL, "199?", - "Magic Bubble\0", NULL, "Yun Sung", "Yun Sung 16 Bit", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, magicbubRomInfo, magicbubRomName, NULL, NULL, MagicbubInputInfo, MagicbubDIPInfo, - MagicbubInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, - 320, 224, 4, 3 -}; - - -// Magic Bubble (Adult version) - -static struct BurnRomInfo magicbubaRomDesc[] = { - { "u33.bin", 0x40000, 0xa8164a02, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "u32.bin", 0x40000, 0x58f885ad, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "magbuble.143", 0x10000, 0x04192753, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code - - { "u67.bin", 0x80000, 0x89523dcd, 3 | BRF_GRA }, // 3 Background Tiles - { "u68.bin", 0x80000, 0x30e01a70, 3 | BRF_GRA }, // 4 - { "u69.bin", 0x80000, 0xfe357f52, 3 | BRF_GRA }, // 5 - { "u70.bin", 0x80000, 0x1398a473, 3 | BRF_GRA }, // 6 - { "u71.bin", 0x80000, 0x0844e017, 3 | BRF_GRA }, // 7 - { "u72.bin", 0x80000, 0x591db1cb, 3 | BRF_GRA }, // 8 - { "u73.bin", 0x80000, 0xcb4f3c3c, 3 | BRF_GRA }, // 9 - { "u74.bin", 0x80000, 0x81ff4910, 3 | BRF_GRA }, // 10 - - { "magbuble.u20", 0x20000, 0xf70e3b8c, 4 | BRF_GRA }, // 11 Sprites - { "magbuble.u21", 0x20000, 0xad082cf3, 4 | BRF_GRA }, // 12 - { "magbuble.u22", 0x20000, 0x7c68df7a, 4 | BRF_GRA }, // 13 - { "magbuble.u23", 0x20000, 0xc7763fc1, 4 | BRF_GRA }, // 14 - - { "magbuble.131", 0x20000, 0x03e04e89, 5 | BRF_SND }, // 15 Samples -}; - -STD_ROM_PICK(magicbuba) -STD_ROM_FN(magicbuba) - -static INT32 MagicbubaInit() -{ - return DrvInit(1); -} - -struct BurnDriver BurnDrvMagicbuba = { - "magicbuba", "magicbub", NULL, NULL, "199?", - "Magic Bubble (Adult version)\0", NULL, "Yun Sung", "Yun Sung 16 Bit", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, - NULL, magicbubaRomInfo, magicbubaRomName, NULL, NULL, MagicbubInputInfo, MagicbubaDIPInfo, - MagicbubaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, - 320, 224, 4, 3 -}; - - -// Paparazzi - -static struct BurnRomInfo paprazziRomDesc[] = { - { "u33.bin", 0x20000, 0x91f33abd, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "u32.bin", 0x20000, 0xad5a3fec, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "u67.bin", 0x80000, 0xea0b9e27, 3 | BRF_GRA }, // 2 Background Tiles - { "u68.bin", 0x80000, 0x6b7ff4dd, 3 | BRF_GRA }, // 3 - { "u69.bin", 0x80000, 0x06749294, 3 | BRF_GRA }, // 4 - { "u70.bin", 0x80000, 0x0adacdf8, 3 | BRF_GRA }, // 5 - { "u71.bin", 0x80000, 0x69178fc4, 3 | BRF_GRA }, // 6 - { "u72.bin", 0x80000, 0x7c3384b9, 3 | BRF_GRA }, // 7 - { "u73.bin", 0x80000, 0x73fbc13e, 3 | BRF_GRA }, // 8 - { "u74.bin", 0x80000, 0xf1afda11, 3 | BRF_GRA }, // 9 - - { "u20.bin", 0x40000, 0xccb0ad6b, 4 | BRF_GRA }, // 10 Sprites - { "u21.bin", 0x40000, 0x125badf0, 4 | BRF_GRA }, // 11 - { "u22.bin", 0x40000, 0x436499c7, 4 | BRF_GRA }, // 12 - { "u23.bin", 0x40000, 0x358280fe, 4 | BRF_GRA }, // 13 - - { "u131.bin", 0x80000, 0xbcf7aa12, 5 | BRF_SND }, // 14 Samples -}; - -STD_ROM_PICK(paprazzi) -STD_ROM_FN(paprazzi) - -static INT32 PaprazziInit() -{ - return DrvInit(2); -} - -struct BurnDriver BurnDrvPaprazzi = { - "paprazzi", NULL, NULL, NULL, "1996", - "Paparazzi\0", NULL, "Yun Sung", "Yun Sung 16 Bit", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_MISC, 0, - NULL, paprazziRomInfo, paprazziRomName, NULL, NULL, MagicbubInputInfo, PaprazziDIPInfo, - PaprazziInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, - 224, 384, 3, 4 -}; - - -// Shocking - -static struct BurnRomInfo shockingRomDesc[] = { - { "yunsun16.u33", 0x40000, 0x8a155521, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "yunsun16.u32", 0x40000, 0xc4998c10, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "yunsun16.u67", 0x80000, 0xe30fb2c4, 3 | BRF_GRA }, // 2 Background Tiles - { "yunsun16.u68", 0x80000, 0x7d702538, 3 | BRF_GRA }, // 3 - { "yunsun16.u69", 0x80000, 0x97447fec, 3 | BRF_GRA }, // 4 - { "yunsun16.u70", 0x80000, 0x1b1f7895, 3 | BRF_GRA }, // 5 - - { "yunsun16.u20", 0x40000, 0x124699d0, 4 | BRF_GRA }, // 6 Sprites - { "yunsun16.u21", 0x40000, 0x4eea29a2, 4 | BRF_GRA }, // 7 - { "yunsun16.u22", 0x40000, 0xd6db0388, 4 | BRF_GRA }, // 8 - { "yunsun16.u23", 0x40000, 0x1fa33b2e, 4 | BRF_GRA }, // 9 - - { "yunsun16.131", 0x80000, 0xd0a1bb8c, 5 | BRF_SND }, // 10 Samples -}; - -STD_ROM_PICK(shocking) -STD_ROM_FN(shocking) - -static INT32 ShockingInit() -{ - return DrvInit(3); -} - -struct BurnDriver BurnDrvShocking = { - "shocking", NULL, NULL, NULL, "1997", - "Shocking\0", NULL, "Yun Sung", "Yun Sung 16 Bit", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, - NULL, shockingRomInfo, shockingRomName, NULL, NULL, MagicbubInputInfo, ShockingDIPInfo, - ShockingInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, - 384, 224, 4, 3 -}; - - -// Bomb Kick - -static struct BurnRomInfo bombkickRomDesc[] = { - { "bk_u33", 0x40000, 0xd6eb50bf, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "bk_u32", 0x40000, 0xd55388a2, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "bk_u67", 0x80000, 0x1962f536, 3 | BRF_GRA }, // 2 Background Tiles - { "bk_u68", 0x80000, 0xd80c75a4, 3 | BRF_GRA }, // 3 - { "bk_u69", 0x80000, 0x615e1e6f, 3 | BRF_GRA }, // 4 - { "bk_u70", 0x80000, 0x59817ef1, 3 | BRF_GRA }, // 5 - - { "bk_u20", 0x40000, 0xc2b83e3f, 4 | BRF_GRA }, // 6 Sprites - { "bk_u21", 0x40000, 0xd6890192, 4 | BRF_GRA }, // 7 - { "bk_u22", 0x40000, 0x9538c46c, 4 | BRF_GRA }, // 8 - { "bk_u23", 0x40000, 0xe3831f3d, 4 | BRF_GRA }, // 9 - - { "bk_u131", 0x80000, 0x22cc5732, 5 | BRF_SND }, // 10 Samples -}; - -STD_ROM_PICK(bombkick) -STD_ROM_FN(bombkick) - -struct BurnDriver BurnDrvBombkick = { - "bombkick", NULL, NULL, NULL, "1998", - "Bomb Kick\0", NULL, "Yun Sung", "Yun Sung 16 Bit", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, - NULL, bombkickRomInfo, bombkickRomName, NULL, NULL, BombkickInputInfo, BombkickDIPInfo, - ShockingInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, - 384, 224, 4, 3 -}; - +// FB Alpha Yun Sung 16 Bit Games driver module +// Based on MAME driver by Luca Elia + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym3812.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvSndROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvVidRAM0; +static UINT8 *DrvVidRAM1; +static UINT8 *DrvSprRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static INT32 soundbank; +static UINT16 *scroll; +static UINT8 *soundlatch; +static UINT8 *video_priority; + +static UINT16 DrvInputs[2]; +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; + +static INT32 is_magicbub = 0; + +static struct BurnInputInfo MagicbubInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 4, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 5, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 11, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 10, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 9, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 8, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Magicbub) + +static struct BurnInputInfo BombkickInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy2 + 4, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 5, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy1 + 11, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy1 + 10, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy1 + 9, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy1 + 8, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 13, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 12, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 14, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Bombkick) + +static struct BurnDIPInfo MagicbubDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xbf, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x0e, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x0e, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, + {0x0e, 0x01, 0x07, 0x01, "3 Coins 2 Credits" }, + {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x0e, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x0e, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x0e, 0x01, 0x18, 0x10, "Easy" }, + {0x0e, 0x01, 0x18, 0x18, "Normal" }, + {0x0e, 0x01, 0x18, 0x08, "Hard" }, + {0x0e, 0x01, 0x18, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 0, "Demo Sounds" }, + {0x0e, 0x01, 0x40, 0x40, "Off" }, + {0x0e, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 0, "Service Mode" }, + {0x0e, 0x01, 0x80, 0x80, "Off" }, + {0x0e, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "1P Vs 2P Rounds (Start)" }, + {0x0f, 0x01, 0x0c, 0x08, "Best of 1" }, + {0x0f, 0x01, 0x0c, 0x0c, "Best of 3" }, + {0x0f, 0x01, 0x0c, 0x04, "Best of 5" }, + {0x0f, 0x01, 0x0c, 0x00, "Best of 7" }, + + {0 , 0xfe, 0 , 0, "1P Vs 2P Rounds (Join-in)" }, + {0x0f, 0x01, 0x10, 0x00, "Best of 1" }, + {0x0f, 0x01, 0x10, 0x10, "Best of 3" }, +}; + +STDDIPINFO(Magicbub) + +static struct BurnDIPInfo MagicbubaDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xbf, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x0e, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x0e, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, + {0x0e, 0x01, 0x07, 0x01, "3 Coins 2 Credits" }, + {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x0e, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x0e, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x0e, 0x01, 0x18, 0x10, "Easy" }, + {0x0e, 0x01, 0x18, 0x18, "Normal" }, + {0x0e, 0x01, 0x18, 0x08, "Hard" }, + {0x0e, 0x01, 0x18, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 0, "Demo Sounds" }, + {0x0e, 0x01, 0x40, 0x40, "Off" }, + {0x0e, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0e, 0x01, 0x80, 0x80, "Off" }, + {0x0e, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Nudity" }, + {0x0f, 0x01, 0x03, 0x03, "Soft only" }, + {0x0f, 0x01, 0x03, 0x00, "Hard only" }, + {0x0f, 0x01, 0x03, 0x01, "Soft and Hard" }, + {0x0f, 0x01, 0x03, 0x02, "Soft then Hard" }, + + {0 , 0xfe, 0 , 4, "1P Vs 2P Rounds (Start)" }, + {0x0f, 0x01, 0x0c, 0x08, "Best of 1" }, + {0x0f, 0x01, 0x0c, 0x0c, "Best of 3" }, + {0x0f, 0x01, 0x0c, 0x04, "Best of 5" }, + {0x0f, 0x01, 0x0c, 0x00, "Best of 7" }, + + {0 , 0xfe, 0 , 4, "1P Vs 2P Rounds (Join-in)" }, + {0x0f, 0x01, 0x10, 0x00, "Best of 1" }, + {0x0f, 0x01, 0x10, 0x10, "Best of 3" }, +}; + +STDDIPINFO(Magicbuba) + +static struct BurnDIPInfo ShockingDIPList[]= +{ + {0x0e, 0xff, 0xff, 0xff, NULL }, + {0x0f, 0xff, 0xff, 0xbf, NULL }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x0e, 0x01, 0x07, 0x01, "3 Coins 1 Credits" }, + {0x0e, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, + {0x0e, 0x01, 0x07, 0x03, "3 Coins 2 Credits" }, + {0x0e, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x0e, 0x01, 0x07, 0x04, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x0e, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x0e, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 0, "Difficulty" }, + {0x0f, 0x01, 0x07, 0x04, "Easiest" }, + {0x0f, 0x01, 0x07, 0x05, "Easier" }, + {0x0f, 0x01, 0x07, 0x06, "Easy" }, + {0x0f, 0x01, 0x07, 0x07, "Normal" }, + {0x0f, 0x01, 0x07, 0x03, "Medium" }, + {0x0f, 0x01, 0x07, 0x02, "Hard" }, + {0x0f, 0x01, 0x07, 0x01, "Harder" }, + {0x0f, 0x01, 0x07, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 0, "Lives" }, + {0x0f, 0x01, 0x30, 0x20, "2" }, + {0x0f, 0x01, 0x30, 0x30, "3" }, + {0x0f, 0x01, 0x30, 0x10, "4" }, + {0x0f, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 0, "Demo Sounds" }, + {0x0f, 0x01, 0x40, 0x40, "Off" }, + {0x0f, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x0f, 0x01, 0x80, 0x80, "Off" }, + {0x0f, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Shocking) + +static struct BurnDIPInfo BombkickDIPList[]= +{ + {0x12, 0xff, 0xff, 0x9f, NULL }, + {0x13, 0xff, 0xff, 0xaf, NULL }, + + {0 , 0xfe, 0 , 8, "Coinage" }, + {0x12, 0x01, 0x07, 0x02, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x04, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x07, 0x01, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x07, 0x07, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x07, 0x03, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x07, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x12, 0x01, 0x18, 0x10, "Easy" }, + {0x12, 0x01, 0x18, 0x18, "Normal" }, + {0x12, 0x01, 0x18, 0x08, "Hard" }, + {0x12, 0x01, 0x18, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Special Powers" }, + {0x12, 0x01, 0x20, 0x20, "2" }, + {0x12, 0x01, 0x20, 0x00, "3" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x40, 0x40, "Off" }, + {0x12, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x80, 0x80, "Off" }, + {0x12, 0x01, 0x80, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x03, 0x00, "2" }, + {0x13, 0x01, 0x03, 0x03, "3" }, + {0x13, 0x01, 0x03, 0x02, "4" }, + {0x13, 0x01, 0x03, 0x01, "5" }, + +}; + +STDDIPINFO(Bombkick) + +static struct BurnDIPInfo PaprazziDIPList[]= +{ + {0x0e, 0xff, 0xff, 0x9b, NULL }, + {0x0f, 0xff, 0xff, 0xa7, NULL }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x0e, 0x01, 0x03, 0x00, "3 Coins 1 Credits" }, + {0x0e, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, + {0x0e, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, + {0x0e, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x0e, 0x01, 0x08, 0x00, "Korean" }, + {0x0e, 0x01, 0x08, 0x08, "English" }, + + {0 , 0xfe, 0 , 2, "Enemies" }, + {0x0e, 0x01, 0x10, 0x00, "Type 1" }, + {0x0e, 0x01, 0x10, 0x10, "Type 2" }, + + {0 , 0xfe, 0 , 4, "Time" }, + {0x0e, 0x01, 0xc0, 0x00, "80" }, + {0x0e, 0x01, 0xc0, 0x40, "100" }, + {0x0e, 0x01, 0xc0, 0x80, "120" }, + {0x0e, 0x01, 0xc0, 0xc0, "150" }, + + {0 , 0xfe, 0 , 8, "Difficulty" }, + {0x0f, 0x01, 0x07, 0x04, "Easiest" }, + {0x0f, 0x01, 0x07, 0x05, "Easier" }, + {0x0f, 0x01, 0x07, 0x06, "Easy" }, + {0x0f, 0x01, 0x07, 0x07, "Normal" }, + {0x0f, 0x01, 0x07, 0x03, "Medium" }, + {0x0f, 0x01, 0x07, 0x02, "Hard" }, + {0x0f, 0x01, 0x07, 0x01, "Harder" }, + {0x0f, 0x01, 0x07, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x0f, 0x01, 0x30, 0x20, "3" }, + {0x0f, 0x01, 0x30, 0x30, "2" }, + {0x0f, 0x01, 0x30, 0x10, "4" }, + {0x0f, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x0f, 0x01, 0x40, 0x40, "Off" }, + {0x0f, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Gfx Viewer" }, + {0x0f, 0x01, 0x80, 0x80, "Off" }, + {0x0f, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Paprazzi) + +static void set_sample_bank(INT32 bank) +{ + if (bank != soundbank) { + soundbank = bank; + memcpy(DrvSndROM + 0x20000, DrvSndROM + 0x40000 + (soundbank * 0x20000), 0x20000); + } +} + +void __fastcall magicbub_main_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x80010c: + case 0x80010e: + scroll[2 + ((address >> 1) & 1)] = data & 0x3ff; + return; + + case 0x800114: + case 0x800116: + scroll[0 + ((address >> 1) & 1)] = data & 0x3ff; + return; + + case 0x800154: + *video_priority = data & 0xff; + return; + + } +} + +void __fastcall magicbub_main_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x800180: + case 0x800181: + set_sample_bank(data & 3); + return; + + case 0x800188: + case 0x800189: + if (is_magicbub) { + if (data != 0x3a) { + *soundlatch = data; +// ZetNmi(); + Z80SetIrqLine(Z80_INPUT_LINE_NMI, 1); + } + } else { + MSM6295Command(0, data); + } + return; + } +} + +UINT16 __fastcall magicbub_main_read_word(UINT32 address) +{ + switch (address) + { + case 0x800000: + return DrvInputs[0]; + + case 0x800018: + return DrvInputs[1]; + } + + return 0; +} + +UINT8 __fastcall magicbub_main_read_byte(UINT32 address) +{ + switch (address) + { + case 0x800000: + case 0x800001: + return (DrvInputs[0] >> ((~address & 1) << 3)); + + case 0x800018: + case 0x800019: + return (DrvInputs[1] >> ((~address & 1) << 3)); + + case 0x80001a: + case 0x80001b: + return DrvDips[0]; + + case 0x80001c: + case 0x80001d: + return DrvDips[1]; + + case 0x800188: + case 0x800189: + return MSM6295ReadStatus(0); + } + + return 0; +} + +void __fastcall magicbub_sound_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x10: + BurnYM3812Write(0, data); + return; + + case 0x11: + BurnYM3812Write(1, data); + return; + + case 0x1c: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall magicbub_sound_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x10: + return BurnYM3812Read(0); + + case 0x11: + return BurnYM3812Read(1); + + case 0x18: + Z80SetIrqLine(Z80_INPUT_LINE_NMI, 0); + return *soundlatch; + + case 0x1c: + return MSM6295ReadStatus(0); + } + + return 0; +} + + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3000000; +} + +static void DrvYM3812IrqHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM3812Reset(); + + memcpy (DrvSndROM, DrvSndROM + 0x40000, 0x40000); + soundbank = 1; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x080000; + DrvZ80ROM = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x400000; + DrvGfxROM1 = Next; Next += 0x200000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x080000 + 0x40000; + + DrvPalette = (UINT32*)Next; Next += 0x2000 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvVidRAM0 = Next; Next += 0x004000; + DrvVidRAM1 = Next; Next += 0x004000; + DrvSprRAM = Next; Next += 0x001000; + DrvPalRAM = Next; Next += 0x004000; + + DrvZ80RAM = Next; Next += 0x000800; + + scroll = (UINT16*)Next; Next += 0x000004 * sizeof(UINT16); + soundlatch = Next; Next += 0x000001; + video_priority = Next; Next += 0x000001; + + RamEnd = Next; + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[8] = { 0x030, 0x020, 0x010, 0x000, 0x038, 0x028, 0x018, 0x008 }; + INT32 Plane1[4] = { 0x600000, 0x200000, 0x400000, 0x000000 }; + INT32 XOffs0[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x040, 0x041, 0x042, 0x043, 0x044, 0x045, 0x046, 0x047 }; + INT32 XOffs1[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, + 0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f }; + INT32 YOffs0[16] = { 0x000, 0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, + 0x400, 0x480, 0x500, 0x580, 0x600, 0x680, 0x700, 0x780 }; + INT32 YOffs1[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, + 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x400000); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x400000; i++) { + tmp[i] = DrvGfxROM0[(i & ~7) | ((i & 6) >> 1) | ((i & 1) << 2)]; + } + + GfxDecode(0x4000, 8, 16, 16, Plane0, XOffs0, YOffs0, 0x800, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x100000); + + GfxDecode(0x2000, 4, 16, 16, Plane1, XOffs1, YOffs1, 0x100, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit(INT32 game_select) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + INT32 offset = 0; + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + memset (DrvGfxROM0, 0xff, 0x400000); + + switch (game_select) + { + case 0: // magicbub + { + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000002, 5, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000003, 6, 4)) return 1; + offset = 7; + + is_magicbub = 1; + } + break; + + case 1: // magicbuba + { + if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000002, 5, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000003, 6, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200000, 7, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200001, 8, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200002, 9, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200003, 10, 4)) return 1; + offset = 11; + + is_magicbub = 1; + } + break; + + case 2: // paprazzi + { + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 3, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000002, 4, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000003, 5, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200000, 6, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200001, 7, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200002, 8, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x200003, 9, 4)) return 1; + offset = 10; + } + break; + + case 3: // shocking, bombkick + { + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 2, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000001, 3, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000002, 4, 4)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x000003, 5, 4)) return 1; + offset = 6; + } + break; + } + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, offset + 0, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x040000, offset + 1, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x080000, offset + 2, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, offset + 3, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x040000, offset + 4, 1)) return 1; + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x900000, 0x903fff, SM_RAM); + SekMapMemory(DrvVidRAM1, 0x908000, 0x90bfff, SM_RAM); + SekMapMemory(DrvVidRAM0, 0x90c000, 0x90ffff, SM_RAM); + SekMapMemory(DrvSprRAM, 0x910000, 0x910fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0xff0000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, magicbub_main_write_word); + SekSetWriteByteHandler(0, magicbub_main_write_byte); + SekSetReadWordHandler(0, magicbub_main_read_word); + SekSetReadByteHandler(0, magicbub_main_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xdfff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xdfff, 2, DrvZ80ROM); + ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM); + ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM); + ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM); + ZetSetOutHandler(magicbub_sound_out); + ZetSetInHandler(magicbub_sound_in); + ZetClose(); + + BurnYM3812Init(4000000, &DrvYM3812IrqHandler, &DrvSynchroniseStream, 0); + BurnTimerAttachZetYM3812(3000000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 0.80, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, (is_magicbub ? 1056000 : 1000000) / 132, is_magicbub); + MSM6295SetRoute(0, (is_magicbub ? 0.80 : 1.00), BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + MSM6295Exit(0); + BurnYM3812Exit(); + + SekExit(); + ZetExit(); + GenericTilesExit(); + + BurnFree (AllMem); + + is_magicbub = 0; + + return 0; +} + +static inline void DrvRecalcPal() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + for (INT32 i = 0; i < 0x2000; i++) { + if (i == 0x200) i = 0x1000; + INT32 d = p[i]; + + r = (d >> 10) & 0x1f; + g = (d >> 5) & 0x1f; + b = (d >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static void draw_layer(INT32 scr, INT32 pri) +{ + INT32 scrollx = scroll[scr * 2 + 0] + ((scr) ? 0x38 : 0x34) + ((is_magicbub) ? 32 : 0); + INT32 scrolly = scroll[scr * 2 + 1] + 0x10; + + UINT16 *vram = (UINT16*)(scr ? DrvVidRAM1 : DrvVidRAM0); + + for (INT32 offs = 0; offs < 64 * 64; offs++) + { + INT32 sx = (offs & 0x3f) << 4; + INT32 sy = (offs >> 6) << 4; + + sx -= scrollx; + if (sx < -15) sx += 1024; + sy -= scrolly; + if (sy < -15) sy += 1024; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 ofst = (offs & 0xc00) + ((offs << 4) & 0x300) + ((offs >> 6) & 0x0f) + ((offs & 0x0f) << 4); + + INT32 code = vram[ofst * 2 + 0] & 0x3fff; + INT32 attr = vram[ofst * 2 + 1]; + + if (pri) { + if (attr & 0x20) { + Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 8, 0x1000, DrvGfxROM0); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 8, 0x1000, DrvGfxROM0); + } + } else { + if (attr & 0x20) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 8, 0xff, 0x1000, DrvGfxROM0); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 8, 0xff, 0x1000, DrvGfxROM0); + } + } + } +} + +static void draw_sprites(INT32 pri) +{ + if ((*video_priority & 3) != pri) return; + + INT32 x_offset = is_magicbub ? 96 : 64; + UINT16 *vram = (UINT16*)DrvSprRAM; + + for (INT32 offs = 0; offs < 0x1000 / 2; offs += 8 / 2) + { + INT32 sx = vram[offs + 0] - x_offset; + INT32 sy = vram[offs + 1] - 0x0f; + INT32 code = vram[offs + 2] & 0x1fff; + INT32 attr = vram[offs + 3]; + INT32 flipx = attr & 0x20; + INT32 flipy = attr & 0x40; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, attr & 0x1f, 4, 15, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, attr & 0x1f, 4, 15, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, attr & 0x1f, 4, 15, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, attr & 0x1f, 4, 15, 0, DrvGfxROM1); + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvRecalcPal(); + } + + if ((*video_priority & 0x0c) == 0x04) { + draw_layer(0, 1); + + if (nSpriteEnable & 1) draw_sprites(1); + + if (nBurnLayer & 2) draw_layer(0, 0); + if (nSpriteEnable & 2 )draw_sprites(2); + + if (nBurnLayer & 4) draw_layer(1, 0); + + if (nSpriteEnable & 4) { + draw_sprites(3); + draw_sprites(0); + } + } else if ((*video_priority & 0x0c) == 0x08) { + draw_layer(1, 1); + + if (nSpriteEnable & 1) draw_sprites(1); + + if (nBurnLayer & 2) draw_layer(1, 0); + + if (nSpriteEnable & 2)draw_sprites(2); + + if (nBurnLayer & 4) draw_layer(0, 0); + + if (nSpriteEnable & 4) { + draw_sprites(3); + draw_sprites(0); + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + memset (DrvInputs, 0xff, 2 * sizeof(UINT16)); + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= DrvJoy1[i] << i; + DrvInputs[1] ^= DrvJoy2[i] << i; + } + } + + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { 16000000 / 60, 3000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nSegment = nCyclesTotal[0] / nInterleave; + nCyclesDone[0] += SekRun(nSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + + if (is_magicbub == 0) continue; + + nSegment = nCyclesTotal[1] / nInterleave; + BurnTimerUpdateYM3812((1 + i) * nSegment); + } + + if (is_magicbub) { + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + } + + if (pBurnSoundOut) { + if (is_magicbub) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + } + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029707; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM3812Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + + SCAN_VAR(soundbank); + + INT32 bank = soundbank; + soundbank = -1; + set_sample_bank(bank); + } + + return 0; +} + + +// Magic Bubble + +static struct BurnRomInfo magicbubRomDesc[] = { + { "magbuble.u33", 0x40000, 0x18fdd582, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "magbuble.u32", 0x40000, 0xf6ea7004, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "magbuble.143", 0x10000, 0x04192753, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "magbuble.u67", 0x80000, 0x6355e57d, 3 | BRF_GRA }, // 3 Background Tiles + { "magbuble.u68", 0x80000, 0x53ae6c2b, 3 | BRF_GRA }, // 4 + { "magbuble.u69", 0x80000, 0xb892e64c, 3 | BRF_GRA }, // 5 + { "magbuble.u70", 0x80000, 0x37794837, 3 | BRF_GRA }, // 6 + + { "magbuble.u20", 0x20000, 0xf70e3b8c, 4 | BRF_GRA }, // 7 Sprites + { "magbuble.u21", 0x20000, 0xad082cf3, 4 | BRF_GRA }, // 8 + { "magbuble.u22", 0x20000, 0x7c68df7a, 4 | BRF_GRA }, // 9 + { "magbuble.u23", 0x20000, 0xc7763fc1, 4 | BRF_GRA }, // 10 + + { "magbuble.131", 0x20000, 0x03e04e89, 5 | BRF_SND }, // 11 Samples +}; + +STD_ROM_PICK(magicbub) +STD_ROM_FN(magicbub) + +static INT32 MagicbubInit() +{ + return DrvInit(0); +} + +struct BurnDriver BurnDrvMagicbub = { + "magicbub", NULL, NULL, NULL, "199?", + "Magic Bubble\0", NULL, "Yun Sung", "Yun Sung 16 Bit", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, magicbubRomInfo, magicbubRomName, NULL, NULL, MagicbubInputInfo, MagicbubDIPInfo, + MagicbubInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, + 320, 224, 4, 3 +}; + + +// Magic Bubble (Adult version) + +static struct BurnRomInfo magicbubaRomDesc[] = { + { "u33.bin", 0x40000, 0xa8164a02, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "u32.bin", 0x40000, 0x58f885ad, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "magbuble.143", 0x10000, 0x04192753, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code + + { "u67.bin", 0x80000, 0x89523dcd, 3 | BRF_GRA }, // 3 Background Tiles + { "u68.bin", 0x80000, 0x30e01a70, 3 | BRF_GRA }, // 4 + { "u69.bin", 0x80000, 0xfe357f52, 3 | BRF_GRA }, // 5 + { "u70.bin", 0x80000, 0x1398a473, 3 | BRF_GRA }, // 6 + { "u71.bin", 0x80000, 0x0844e017, 3 | BRF_GRA }, // 7 + { "u72.bin", 0x80000, 0x591db1cb, 3 | BRF_GRA }, // 8 + { "u73.bin", 0x80000, 0xcb4f3c3c, 3 | BRF_GRA }, // 9 + { "u74.bin", 0x80000, 0x81ff4910, 3 | BRF_GRA }, // 10 + + { "magbuble.u20", 0x20000, 0xf70e3b8c, 4 | BRF_GRA }, // 11 Sprites + { "magbuble.u21", 0x20000, 0xad082cf3, 4 | BRF_GRA }, // 12 + { "magbuble.u22", 0x20000, 0x7c68df7a, 4 | BRF_GRA }, // 13 + { "magbuble.u23", 0x20000, 0xc7763fc1, 4 | BRF_GRA }, // 14 + + { "magbuble.131", 0x20000, 0x03e04e89, 5 | BRF_SND }, // 15 Samples +}; + +STD_ROM_PICK(magicbuba) +STD_ROM_FN(magicbuba) + +static INT32 MagicbubaInit() +{ + return DrvInit(1); +} + +struct BurnDriver BurnDrvMagicbuba = { + "magicbuba", "magicbub", NULL, NULL, "199?", + "Magic Bubble (Adult version)\0", NULL, "Yun Sung", "Yun Sung 16 Bit", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PUZZLE, 0, + NULL, magicbubaRomInfo, magicbubaRomName, NULL, NULL, MagicbubInputInfo, MagicbubaDIPInfo, + MagicbubaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, + 320, 224, 4, 3 +}; + + +// Paparazzi + +static struct BurnRomInfo paprazziRomDesc[] = { + { "u33.bin", 0x20000, 0x91f33abd, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "u32.bin", 0x20000, 0xad5a3fec, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "u67.bin", 0x80000, 0xea0b9e27, 3 | BRF_GRA }, // 2 Background Tiles + { "u68.bin", 0x80000, 0x6b7ff4dd, 3 | BRF_GRA }, // 3 + { "u69.bin", 0x80000, 0x06749294, 3 | BRF_GRA }, // 4 + { "u70.bin", 0x80000, 0x0adacdf8, 3 | BRF_GRA }, // 5 + { "u71.bin", 0x80000, 0x69178fc4, 3 | BRF_GRA }, // 6 + { "u72.bin", 0x80000, 0x7c3384b9, 3 | BRF_GRA }, // 7 + { "u73.bin", 0x80000, 0x73fbc13e, 3 | BRF_GRA }, // 8 + { "u74.bin", 0x80000, 0xf1afda11, 3 | BRF_GRA }, // 9 + + { "u20.bin", 0x40000, 0xccb0ad6b, 4 | BRF_GRA }, // 10 Sprites + { "u21.bin", 0x40000, 0x125badf0, 4 | BRF_GRA }, // 11 + { "u22.bin", 0x40000, 0x436499c7, 4 | BRF_GRA }, // 12 + { "u23.bin", 0x40000, 0x358280fe, 4 | BRF_GRA }, // 13 + + { "u131.bin", 0x80000, 0xbcf7aa12, 5 | BRF_SND }, // 14 Samples +}; + +STD_ROM_PICK(paprazzi) +STD_ROM_FN(paprazzi) + +static INT32 PaprazziInit() +{ + return DrvInit(2); +} + +struct BurnDriver BurnDrvPaprazzi = { + "paprazzi", NULL, NULL, NULL, "1996", + "Paparazzi\0", NULL, "Yun Sung", "Yun Sung 16 Bit", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_POST90S, GBF_MISC, 0, + NULL, paprazziRomInfo, paprazziRomName, NULL, NULL, MagicbubInputInfo, PaprazziDIPInfo, + PaprazziInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, + 224, 384, 3, 4 +}; + + +// Shocking + +static struct BurnRomInfo shockingRomDesc[] = { + { "yunsun16.u33", 0x40000, 0x8a155521, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "yunsun16.u32", 0x40000, 0xc4998c10, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "yunsun16.u67", 0x80000, 0xe30fb2c4, 3 | BRF_GRA }, // 2 Background Tiles + { "yunsun16.u68", 0x80000, 0x7d702538, 3 | BRF_GRA }, // 3 + { "yunsun16.u69", 0x80000, 0x97447fec, 3 | BRF_GRA }, // 4 + { "yunsun16.u70", 0x80000, 0x1b1f7895, 3 | BRF_GRA }, // 5 + + { "yunsun16.u20", 0x40000, 0x124699d0, 4 | BRF_GRA }, // 6 Sprites + { "yunsun16.u21", 0x40000, 0x4eea29a2, 4 | BRF_GRA }, // 7 + { "yunsun16.u22", 0x40000, 0xd6db0388, 4 | BRF_GRA }, // 8 + { "yunsun16.u23", 0x40000, 0x1fa33b2e, 4 | BRF_GRA }, // 9 + + { "yunsun16.131", 0x80000, 0xd0a1bb8c, 5 | BRF_SND }, // 10 Samples +}; + +STD_ROM_PICK(shocking) +STD_ROM_FN(shocking) + +static INT32 ShockingInit() +{ + return DrvInit(3); +} + +struct BurnDriver BurnDrvShocking = { + "shocking", NULL, NULL, NULL, "1997", + "Shocking\0", NULL, "Yun Sung", "Yun Sung 16 Bit", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MAZE, 0, + NULL, shockingRomInfo, shockingRomName, NULL, NULL, MagicbubInputInfo, ShockingDIPInfo, + ShockingInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, + 384, 224, 4, 3 +}; + + +// Bomb Kick + +static struct BurnRomInfo bombkickRomDesc[] = { + { "bk_u33", 0x40000, 0xd6eb50bf, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "bk_u32", 0x40000, 0xd55388a2, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "bk_u67", 0x80000, 0x1962f536, 3 | BRF_GRA }, // 2 Background Tiles + { "bk_u68", 0x80000, 0xd80c75a4, 3 | BRF_GRA }, // 3 + { "bk_u69", 0x80000, 0x615e1e6f, 3 | BRF_GRA }, // 4 + { "bk_u70", 0x80000, 0x59817ef1, 3 | BRF_GRA }, // 5 + + { "bk_u20", 0x40000, 0xc2b83e3f, 4 | BRF_GRA }, // 6 Sprites + { "bk_u21", 0x40000, 0xd6890192, 4 | BRF_GRA }, // 7 + { "bk_u22", 0x40000, 0x9538c46c, 4 | BRF_GRA }, // 8 + { "bk_u23", 0x40000, 0xe3831f3d, 4 | BRF_GRA }, // 9 + + { "bk_u131", 0x80000, 0x22cc5732, 5 | BRF_SND }, // 10 Samples +}; + +STD_ROM_PICK(bombkick) +STD_ROM_FN(bombkick) + +struct BurnDriver BurnDrvBombkick = { + "bombkick", NULL, NULL, NULL, "1998", + "Bomb Kick\0", NULL, "Yun Sung", "Yun Sung 16 Bit", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0, + NULL, bombkickRomInfo, bombkickRomName, NULL, NULL, BombkickInputInfo, BombkickDIPInfo, + ShockingInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x2000, + 384, 224, 4, 3 +}; + diff --git a/src/burn/drv/pst90s/d_zerozone.cpp b/src/burn/drv/pst90s/d_zerozone.cpp index 5a5e9caeb..3e17f02c6 100644 --- a/src/burn/drv/pst90s/d_zerozone.cpp +++ b/src/burn/drv/pst90s/d_zerozone.cpp @@ -1,555 +1,554 @@ -// FB Alpha Zero Zone driver module -// Based on MAME driver by Brad Oliver - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "msm6295.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvSndROM; -static UINT8 *DrvGfxROM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvVidRAM; -static UINT32 *DrvPalette; -static UINT32 *Palette; - -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvJoy4[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; -static UINT16 DrvInputs[4]; - -static UINT8 soundlatch; -static UINT8 tilebank; - -static struct BurnInputInfo DrvInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 1, "p2 coin" }, - - {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 3, "p1 start" }, - {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, - {"P1 Score Line (cheat)" , BIT_DIGITAL , DrvJoy2 + 6, "p1 fire 3"}, - - {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 4, "p2 start" }, - {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 11, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 10, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 9, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 8, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 12, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 13, "p2 fire 2"}, - {"P2 Score Line (cheat)" , BIT_DIGITAL , DrvJoy2 + 14, "p2 fire 3"}, - - {"Service" , BIT_DIGITAL , DrvJoy4 + 7, "service" }, - - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnDIPInfo DrvDIPList[]= -{ - {0x14, 0xff, 0xff, 0xdf, NULL }, - {0x15, 0xff, 0xff, 0xf7, NULL }, - - {0x14, 0xfe, 0, 8, "Coinage" }, - {0x14, 0x01, 0x07, 0x00, "5C 1C" }, - {0x14, 0x01, 0x07, 0x01, "4C 1C" }, - {0x14, 0x01, 0x07, 0x02, "3C 1C" }, - {0x14, 0x01, 0x07, 0x03, "2C 1C" }, - {0x14, 0x01, 0x07, 0x07, "1C 1C" }, - {0x14, 0x01, 0x07, 0x06, "1C 2C" }, - {0x14, 0x01, 0x07, 0x05, "1C 3C" }, - {0x14, 0x01, 0x07, 0x04, "1C 4C" }, - - {0x14, 0xfe, 0, 2, "Difficulty" }, - {0x14, 0x01, 0x08, 0x08, "In Game Default" }, - {0x14, 0x01, 0x08, 0x00, "Always Hard" }, - - {0x14, 0xfe, 0, 2, "Speed" }, - {0x14, 0x01, 0x10, 0x10, "Normal" }, - {0x14, 0x01, 0x10, 0x00, "Fast" }, - - {0x14, 0xfe, 0, 2, "Demo Sounds" }, - {0x14, 0x01, 0x20, 0x00, "Off" }, - {0x14, 0x01, 0x20, 0x20, "On" }, - - {0x15, 0xfe, 0, 2, "Helps" }, - {0x15, 0x01, 0x04, 0x04, "1" }, - {0x15, 0x01, 0x04, 0x00, "2" }, - - {0x15, 0xfe, 0, 2, "Bonus Help" }, - {0x15, 0x01, 0x08, 0x00, "30000" }, - {0x15, 0x01, 0x08, 0x08, "None" }, - - {0x15, 0xfe, 0, 2, "Activate 'Score Line'? (Cheat)" }, - {0x15, 0x01, 0x10, 0x10, "No" }, - {0x15, 0x01, 0x10, 0x00, "Yes" }, -}; - -STDDIPINFO(Drv) - -UINT8 __fastcall zerozone_read_byte(UINT32 address) -{ - switch (address) - { - case 0x080000: - case 0x080001: - return DrvInputs[0] >> ((~address & 1) << 3); - - case 0x080002: - case 0x080003: - return DrvInputs[1] >> ((~address & 1) << 3); - - case 0x080008: - case 0x080009: - return DrvInputs[2] >> ((~address & 1) << 3); - - case 0x08000a: - case 0x08000b: - return DrvInputs[3] >> ((~address & 1) << 3); - } - - return 0; -} - -UINT16 __fastcall zerozone_read_word(UINT32 address) -{ - switch (address) - { - case 0x080000: - return DrvInputs[0]; - - case 0x080002: - return DrvInputs[1]; - - case 0x080008: - return DrvInputs[2]; - - case 0x08000a: - return DrvInputs[3]; - } - - return 0; -} - -static void palette_write(INT32 offset) -{ - UINT8 r, b, g; - UINT16 data = *((UINT16*)(DrvPalRAM + offset)); - - r = (data >> 11) & 0x1e; - r |= (data >> 3) & 0x01; - r = (r << 3) | (r >> 2); - - g = (data >> 7) & 0x1e; - g |= (data >> 2) & 0x01; - g = (g << 3) | (g >> 2); - - b = (data >> 3) & 0x1e; - b |= (data >> 1) & 0x01; - b = (b << 3) | (b >> 2); - - Palette[offset>>1] = (r << 16) | (g << 8) | b; - DrvPalette[offset>>1] = BurnHighCol(r, g, b, 0); - - return; -} - -void __fastcall zerozone_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xffe00) == 0x88000) { - *((UINT16*)(DrvPalRAM + (address & 0x1fe))) = data; - palette_write(address & 0x1fe); - return; - } - - switch (address) - { - case 0x84000: - soundlatch = data >> 8; - ZetRaiseIrq(0xff); - return; - - case 0xb4000: - tilebank = data & 7; - return; - } - - return; -} - -void __fastcall zerozone_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x84000: - soundlatch = data; - ZetRaiseIrq(0xff); - return; - - case 0xb4001: - tilebank = data & 7; - return; - } - - return; -} - -void __fastcall zerozone_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x9800: - MSM6295Command(0, data); - return; - } -} - -UINT8 __fastcall zerozone_sound_read(UINT16 address) -{ - switch (address) - { - case 0x9800: - return MSM6295ReadStatus(0); - - case 0xa000: - return soundlatch; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - soundlatch = 0; - tilebank = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x020000; - DrvZ80ROM = Next; Next += 0x008000; - - DrvGfxROM = Next; Next += 0x100000; - - MSM6295ROM = Next; - DrvSndROM = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x010000; - DrvPalRAM = Next; Next += 0x000200; - DrvVidRAM = Next; Next += 0x004000; - - DrvZ80RAM = Next; Next += 0x000800; - - Palette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0, 1, 2, 3 }; - INT32 XOffs[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; - INT32 YOffs[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x80000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM, 0x80000); - - GfxDecode(0x4000, 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM, 3, 1)) return 1; - - if (BurnLoadRom(DrvSndROM, 4, 1)) return 1; - if (BurnLoadRom(DrvSndROM + 0x20000, 5, 1)) return 1; - - DrvGfxDecode(); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x01ffff, SM_ROM); - SekMapMemory(DrvPalRAM, 0x088000, 0x0881ff, SM_ROM); - SekMapMemory(DrvVidRAM, 0x09ce00, 0x09ffff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x0c0000, 0x0cffff, SM_RAM); - SekSetWriteByteHandler(0, zerozone_write_byte); - SekSetWriteWordHandler(0, zerozone_write_word); - SekSetReadByteHandler(0, zerozone_read_byte); - SekSetReadWordHandler(0, zerozone_read_word); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetWriteHandler(zerozone_sound_write); - ZetSetReadHandler(zerozone_sound_read); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 1056000 / 132, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - MSM6295Exit(0); - SekExit(); - ZetExit(); - - BurnFree (AllMem); - - MSM6295ROM = NULL; - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x100; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - } - - UINT16 *vram = (UINT16*)DrvVidRAM; - - for (INT32 offs = 0; offs < 0x800; offs++) - { - INT32 sy = (offs & 0x1f) << 3; - INT32 sx = (offs >> 5) << 3; - - sy -= 16; - sx -= 8; - if (sy < 0 || sx < 0 || sy >= nScreenHeight || sx >= nScreenWidth) continue; - - INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x7ff; - INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs]) >> 12; - - code += tilebank * (BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x800); - - Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = ~0; - DrvInputs[1] = ~0; - DrvInputs[2] = 0x00ff | (DrvDips[1] << 8); - DrvInputs[3] = 0xff00 | DrvDips[0]; - - for (INT32 i = 0; i < 16; i++) - { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - } - } - - INT32 nSegment; - INT32 nInterleave = 10; - INT32 nTotalCycles[2] = { 10000000 / 60, 1000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); - - nCyclesDone[0] += SekRun(nSegment); - - nSegment = (nTotalCycles[1] - nCyclesDone[1]) / (nInterleave - i); - - nCyclesDone[1] += ZetRun(nSegment); - } - - if (pBurnSoundOut) { - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029692; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - MSM6295Scan(0, nAction); - - SCAN_VAR(soundlatch); - SCAN_VAR(tilebank); - } - - return 0; -} - - -// Zero Zone - -static struct BurnRomInfo zerozoneRomDesc[] = { - { "zz-4.rom", 0x10000, 0x83718b9b, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "zz-5.rom", 0x10000, 0x18557f41, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "zz-1.rom", 0x08000, 0x223ccce5, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "zz-6.rom", 0x80000, 0xc8b906b9, 3 | BRF_GRA }, // 3 - Tiles - - { "zz-2.rom", 0x20000, 0xc7551e81, 4 | BRF_SND }, // 4 - MSM6295 Samples - { "zz-3.rom", 0x20000, 0xe348ff5e, 4 | BRF_SND }, // 5 -}; - -STD_ROM_PICK(zerozone) -STD_ROM_FN(zerozone) - -struct BurnDriver BurnDrvZerozone = { - "zerozone", NULL, NULL, NULL, "1993", - "Zero Zone\0", NULL, "Comad", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, zerozoneRomInfo, zerozoneRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 368, 224, 4, 3 -}; - - -// Las Vegas Girl (Girl '94) - -static struct BurnRomInfo lvgirl94RomDesc[] = { - { "rom4", 0x10000, 0xc4fb449e, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code - { "rom5", 0x10000, 0x5d446a1a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "rom1", 0x08000, 0x223ccce5, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code - - { "rom6", 0x40000, 0xeeeb94ba, 3 | BRF_GRA }, // 3 - Tiles - - { "rom2", 0x20000, 0xc7551e81, 4 | BRF_SND }, // 4 - MSM6295 Samples - { "rom3", 0x20000, 0xe348ff5e, 4 | BRF_SND }, // 5 -}; - -STD_ROM_PICK(lvgirl94) -STD_ROM_FN(lvgirl94) - -struct BurnDriver BurnDrvLvgirl94 = { - "lvgirl94", NULL, NULL, NULL, "1994", - "Las Vegas Girl (Girl '94)\0", NULL, "Comad", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, - NULL, lvgirl94RomInfo, lvgirl94RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, - 368, 224, 4, 3 -}; +// FB Alpha Zero Zone driver module +// Based on MAME driver by Brad Oliver + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "msm6295.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvSndROM; +static UINT8 *DrvGfxROM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvVidRAM; +static UINT32 *DrvPalette; +static UINT32 *Palette; + +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvJoy4[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; +static UINT16 DrvInputs[4]; + +static UINT8 soundlatch; +static UINT8 tilebank; + +static struct BurnInputInfo DrvInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 1, "p2 coin" }, + + {"P1 Start" , BIT_DIGITAL , DrvJoy1 + 3, "p1 start" }, + {"P1 Up" , BIT_DIGITAL , DrvJoy2 + 3, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy2 + 1, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy2 + 0, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy2 + 5, "p1 fire 2"}, + {"P1 Score Line (cheat)" , BIT_DIGITAL , DrvJoy2 + 6, "p1 fire 3"}, + + {"P2 Start" , BIT_DIGITAL , DrvJoy1 + 4, "p2 start" }, + {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 11, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 10, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 9, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 8, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 12, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 13, "p2 fire 2"}, + {"P2 Score Line (cheat)" , BIT_DIGITAL , DrvJoy2 + 14, "p2 fire 3"}, + + {"Service" , BIT_DIGITAL , DrvJoy4 + 7, "service" }, + + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnDIPInfo DrvDIPList[]= +{ + {0x14, 0xff, 0xff, 0xdf, NULL }, + {0x15, 0xff, 0xff, 0xf7, NULL }, + + {0x14, 0xfe, 0, 8, "Coinage" }, + {0x14, 0x01, 0x07, 0x00, "5C 1C" }, + {0x14, 0x01, 0x07, 0x01, "4C 1C" }, + {0x14, 0x01, 0x07, 0x02, "3C 1C" }, + {0x14, 0x01, 0x07, 0x03, "2C 1C" }, + {0x14, 0x01, 0x07, 0x07, "1C 1C" }, + {0x14, 0x01, 0x07, 0x06, "1C 2C" }, + {0x14, 0x01, 0x07, 0x05, "1C 3C" }, + {0x14, 0x01, 0x07, 0x04, "1C 4C" }, + + {0x14, 0xfe, 0, 2, "Difficulty" }, + {0x14, 0x01, 0x08, 0x08, "In Game Default" }, + {0x14, 0x01, 0x08, 0x00, "Always Hard" }, + + {0x14, 0xfe, 0, 2, "Speed" }, + {0x14, 0x01, 0x10, 0x10, "Normal" }, + {0x14, 0x01, 0x10, 0x00, "Fast" }, + + {0x14, 0xfe, 0, 2, "Demo Sounds" }, + {0x14, 0x01, 0x20, 0x00, "Off" }, + {0x14, 0x01, 0x20, 0x20, "On" }, + + {0x15, 0xfe, 0, 2, "Helps" }, + {0x15, 0x01, 0x04, 0x04, "1" }, + {0x15, 0x01, 0x04, 0x00, "2" }, + + {0x15, 0xfe, 0, 2, "Bonus Help" }, + {0x15, 0x01, 0x08, 0x00, "30000" }, + {0x15, 0x01, 0x08, 0x08, "None" }, + + {0x15, 0xfe, 0, 2, "Activate 'Score Line'? (Cheat)" }, + {0x15, 0x01, 0x10, 0x10, "No" }, + {0x15, 0x01, 0x10, 0x00, "Yes" }, +}; + +STDDIPINFO(Drv) + +UINT8 __fastcall zerozone_read_byte(UINT32 address) +{ + switch (address) + { + case 0x080000: + case 0x080001: + return DrvInputs[0] >> ((~address & 1) << 3); + + case 0x080002: + case 0x080003: + return DrvInputs[1] >> ((~address & 1) << 3); + + case 0x080008: + case 0x080009: + return DrvInputs[2] >> ((~address & 1) << 3); + + case 0x08000a: + case 0x08000b: + return DrvInputs[3] >> ((~address & 1) << 3); + } + + return 0; +} + +UINT16 __fastcall zerozone_read_word(UINT32 address) +{ + switch (address) + { + case 0x080000: + return DrvInputs[0]; + + case 0x080002: + return DrvInputs[1]; + + case 0x080008: + return DrvInputs[2]; + + case 0x08000a: + return DrvInputs[3]; + } + + return 0; +} + +static void palette_write(INT32 offset) +{ + UINT8 r, b, g; + UINT16 data = *((UINT16*)(DrvPalRAM + offset)); + + r = (data >> 11) & 0x1e; + r |= (data >> 3) & 0x01; + r = (r << 3) | (r >> 2); + + g = (data >> 7) & 0x1e; + g |= (data >> 2) & 0x01; + g = (g << 3) | (g >> 2); + + b = (data >> 3) & 0x1e; + b |= (data >> 1) & 0x01; + b = (b << 3) | (b >> 2); + + Palette[offset>>1] = (r << 16) | (g << 8) | b; + DrvPalette[offset>>1] = BurnHighCol(r, g, b, 0); + + return; +} + +void __fastcall zerozone_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xffe00) == 0x88000) { + *((UINT16*)(DrvPalRAM + (address & 0x1fe))) = data; + palette_write(address & 0x1fe); + return; + } + + switch (address) + { + case 0x84000: + soundlatch = data >> 8; + ZetRaiseIrq(0xff); + return; + + case 0xb4000: + tilebank = data & 7; + return; + } + + return; +} + +void __fastcall zerozone_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x84000: + soundlatch = data; + ZetRaiseIrq(0xff); + return; + + case 0xb4001: + tilebank = data & 7; + return; + } + + return; +} + +void __fastcall zerozone_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x9800: + MSM6295Command(0, data); + return; + } +} + +UINT8 __fastcall zerozone_sound_read(UINT16 address) +{ + switch (address) + { + case 0x9800: + return MSM6295ReadStatus(0); + + case 0xa000: + return soundlatch; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + soundlatch = 0; + tilebank = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x020000; + DrvZ80ROM = Next; Next += 0x008000; + + DrvGfxROM = Next; Next += 0x100000; + + MSM6295ROM = Next; + DrvSndROM = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x010000; + DrvPalRAM = Next; Next += 0x000200; + DrvVidRAM = Next; Next += 0x004000; + + DrvZ80RAM = Next; Next += 0x000800; + + Palette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0, 1, 2, 3 }; + INT32 XOffs[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; + INT32 YOffs[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x80000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM, 0x80000); + + GfxDecode(0x4000, 4, 8, 8, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM, 3, 1)) return 1; + + if (BurnLoadRom(DrvSndROM, 4, 1)) return 1; + if (BurnLoadRom(DrvSndROM + 0x20000, 5, 1)) return 1; + + DrvGfxDecode(); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x01ffff, SM_ROM); + SekMapMemory(DrvPalRAM, 0x088000, 0x0881ff, SM_ROM); + SekMapMemory(DrvVidRAM, 0x09ce00, 0x09ffff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x0c0000, 0x0cffff, SM_RAM); + SekSetWriteByteHandler(0, zerozone_write_byte); + SekSetWriteWordHandler(0, zerozone_write_word); + SekSetReadByteHandler(0, zerozone_read_byte); + SekSetReadWordHandler(0, zerozone_read_word); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetWriteHandler(zerozone_sound_write); + ZetSetReadHandler(zerozone_sound_read); + ZetClose(); + + MSM6295Init(0, 1056000 / 132, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + MSM6295Exit(0); + SekExit(); + ZetExit(); + + BurnFree (AllMem); + + MSM6295ROM = NULL; + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x100; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + } + + UINT16 *vram = (UINT16*)DrvVidRAM; + + for (INT32 offs = 0; offs < 0x800; offs++) + { + INT32 sy = (offs & 0x1f) << 3; + INT32 sx = (offs >> 5) << 3; + + sy -= 16; + sx -= 8; + if (sy < 0 || sx < 0 || sy >= nScreenHeight || sx >= nScreenWidth) continue; + + INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x7ff; + INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs]) >> 12; + + code += tilebank * (BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x800); + + Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = ~0; + DrvInputs[1] = ~0; + DrvInputs[2] = 0x00ff | (DrvDips[1] << 8); + DrvInputs[3] = 0xff00 | DrvDips[0]; + + for (INT32 i = 0; i < 16; i++) + { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + } + } + + INT32 nSegment; + INT32 nInterleave = 10; + INT32 nTotalCycles[2] = { 10000000 / 60, 1000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = (nTotalCycles[0] - nCyclesDone[0]) / (nInterleave - i); + + nCyclesDone[0] += SekRun(nSegment); + + nSegment = (nTotalCycles[1] - nCyclesDone[1]) / (nInterleave - i); + + nCyclesDone[1] += ZetRun(nSegment); + } + + if (pBurnSoundOut) { + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029692; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + MSM6295Scan(0, nAction); + + SCAN_VAR(soundlatch); + SCAN_VAR(tilebank); + } + + return 0; +} + + +// Zero Zone + +static struct BurnRomInfo zerozoneRomDesc[] = { + { "zz-4.rom", 0x10000, 0x83718b9b, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "zz-5.rom", 0x10000, 0x18557f41, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "zz-1.rom", 0x08000, 0x223ccce5, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "zz-6.rom", 0x80000, 0xc8b906b9, 3 | BRF_GRA }, // 3 - Tiles + + { "zz-2.rom", 0x20000, 0xc7551e81, 4 | BRF_SND }, // 4 - MSM6295 Samples + { "zz-3.rom", 0x20000, 0xe348ff5e, 4 | BRF_SND }, // 5 +}; + +STD_ROM_PICK(zerozone) +STD_ROM_FN(zerozone) + +struct BurnDriver BurnDrvZerozone = { + "zerozone", NULL, NULL, NULL, "1993", + "Zero Zone\0", NULL, "Comad", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, zerozoneRomInfo, zerozoneRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 368, 224, 4, 3 +}; + + +// Las Vegas Girl (Girl '94) + +static struct BurnRomInfo lvgirl94RomDesc[] = { + { "rom4", 0x10000, 0xc4fb449e, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code + { "rom5", 0x10000, 0x5d446a1a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "rom1", 0x08000, 0x223ccce5, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code + + { "rom6", 0x40000, 0xeeeb94ba, 3 | BRF_GRA }, // 3 - Tiles + + { "rom2", 0x20000, 0xc7551e81, 4 | BRF_SND }, // 4 - MSM6295 Samples + { "rom3", 0x20000, 0xe348ff5e, 4 | BRF_SND }, // 5 +}; + +STD_ROM_PICK(lvgirl94) +STD_ROM_FN(lvgirl94) + +struct BurnDriver BurnDrvLvgirl94 = { + "lvgirl94", NULL, NULL, NULL, "1994", + "Las Vegas Girl (Girl '94)\0", NULL, "Comad", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_VSFIGHT, 0, + NULL, lvgirl94RomInfo, lvgirl94RomName, NULL, NULL, DrvInputInfo, DrvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x100, + 368, 224, 4, 3 +}; diff --git a/src/burn/drv/sega/d_angelkds.cpp b/src/burn/drv/sega/d_angelkds.cpp index e546c54b6..5ea161f34 100644 --- a/src/burn/drv/sega/d_angelkds.cpp +++ b/src/burn/drv/sega/d_angelkds.cpp @@ -1,1039 +1,1037 @@ -// FB Alpha Angel Kids driver module -// Based on MAME driver by David Haywood - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2203.h" -#include "bitswap.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROMDec; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvPalRAM; -static UINT8 *DrvBgtRAM; -static UINT8 *DrvBgbRAM; -static UINT8 *DrvTxtRAM; -static UINT8 *DrvSprRAM; -static UINT32 *DrvPalette; - -static UINT16 *pTempDraw; - -static UINT8 *main_to_sound; -static UINT8 *sound_to_main; - -static UINT8 bgtopbank; -static UINT8 bgbotbank; -static UINT8 bgtopscroll; -static UINT8 bgbotscroll; -static UINT8 txbank; -static UINT8 layer_ctrl; - -static INT32 DrvZ80Bank0; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvReset; -static UINT16 DrvInputs[3]; - -static struct BurnInputInfo AngelkdsInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Left Stick Up", BIT_DIGITAL, DrvJoy2 + 4, "p3 up" }, - {"P1 Left Stick Down", BIT_DIGITAL, DrvJoy2 + 5, "p3 down" }, - {"P1 Left Stick Left", BIT_DIGITAL, DrvJoy2 + 6, "p3 left" }, - {"P1 Left Stick Right", BIT_DIGITAL, DrvJoy2 + 7, "p3 right" }, - {"P1 Right Stick Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Right Stick Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, - {"P1 Right Stick Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right Stick Right",BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Left Stick Up", BIT_DIGITAL, DrvJoy3 + 4, "p4 up" }, - {"P2 Left Stick Down", BIT_DIGITAL, DrvJoy3 + 5, "p4 down" }, - {"P2 Left Stick Left", BIT_DIGITAL, DrvJoy3 + 6, "p4 left" }, - {"P2 Left Stick Right", BIT_DIGITAL, DrvJoy3 + 7, "p4 right" }, - {"P2 Right Stick Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" }, - {"P2 Right Stick Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" }, - {"P2 Right Stick Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, - {"P2 Right Stick Right",BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Angelkds) - -static struct BurnInputInfo SpcpostnInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Spcpostn) - -static struct BurnDIPInfo AngelkdsDIPList[]= -{ - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xf8, NULL }, - {0x18, 0xff, 0xff, 0x80, NULL }, - - {0 , 0xfe, 0 , 10, "Coin B" }, - {0x16, 0x01, 0x0f, 0x07, "4 Coins 1 Credits" }, - {0x16, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, - {0x16, 0x01, 0x0f, 0x09, "2 Coins 1 Credits" }, - {0x16, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x16, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x16, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x16, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x16, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x16, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x16, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 10, "Coin A" }, - {0x16, 0x01, 0xf0, 0x70, "4 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0x90, "2 Coins 1 Credits" }, - {0x16, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x16, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x16, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x16, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x16, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x16, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x16, 0x01, 0xf0, 0x00, "Free Play" }, - -// not supported -// {0 , 0xfe, 0 , 2, "Cabinet" }, -// {0x17, 0x01, 0x01, 0x00, "Upright" }, -// {0x17, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "High Score Characters" }, - {0x17, 0x01, 0x02, 0x00, "3" }, - {0x17, 0x01, 0x02, 0x02, "10" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x17, 0x01, 0x0c, 0x0c, "20k, 50k, 100k, 200k and 500k" }, - {0x17, 0x01, 0x0c, 0x08, "50k, 100k, 200k and 500k" }, - {0x17, 0x01, 0x0c, 0x04, "100k, 200k and 500k" }, - {0x17, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x17, 0x01, 0x30, 0x30, "3" }, - {0x17, 0x01, 0x30, 0x20, "4" }, - {0x17, 0x01, 0x30, 0x10, "5" }, - {0x17, 0x01, 0x30, 0x00, "99 (Cheat)" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x17, 0x01, 0xc0, 0xc0, "Very Easy" }, - {0x17, 0x01, 0xc0, 0x40, "Easy" }, - {0x17, 0x01, 0xc0, 0x80, "Hard" }, - {0x17, 0x01, 0xc0, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x18, 0x01, 0x80, 0x00, "On" }, - {0x18, 0x01, 0x80, 0x80, "Off" }, -}; - -STDDIPINFO(Angelkds) - -static struct BurnDIPInfo SpcpostnDIPList[]= -{ - {0x12, 0xff, 0xff, 0xff, NULL }, - {0x13, 0xff, 0xff, 0xab, NULL }, - {0x14, 0xff, 0xff, 0x80, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credits" }, - {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credits" }, - {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, - {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, - {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, - {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, - {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, - {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, - {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, - {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, - {0x12, 0x01, 0x0f, 0x00, "Free Play" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x12, 0x01, 0xf0, 0x00, "Off" }, - {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, - {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, - {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, - {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, - {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, - {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, - {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, - {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, - {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, - {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, - {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x13, 0x01, 0x01, 0x01, "No" }, - {0x13, 0x01, 0x01, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2, "Obstruction Car" }, - {0x13, 0x01, 0x02, 0x02, "Normal" }, - {0x13, 0x01, 0x02, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 4, "Time Limit" }, - {0x13, 0x01, 0x0c, 0x00, "1:10" }, - {0x13, 0x01, 0x0c, 0x04, "1:20" }, - {0x13, 0x01, 0x0c, 0x08, "1:30" }, - {0x13, 0x01, 0x0c, 0x0c, "1:40" }, - - {0 , 0xfe, 0 , 4, "Power Down" }, - {0x13, 0x01, 0x30, 0x30, "Slow" }, - {0x13, 0x01, 0x30, 0x20, "Normal" }, - {0x13, 0x01, 0x30, 0x10, "Fast" }, - {0x13, 0x01, 0x30, 0x00, "Fastest" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Spcpostn) - -static void bankswitch(INT32 data) -{ - DrvZ80Bank0 = (data & 0x0f); - - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + 0x10000 + DrvZ80Bank0 * 0x4000); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + 0x10000 + DrvZ80Bank0 * 0x4000); -} - -void __fastcall angelkds_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf000: - bgtopbank = data; - return; - - case 0xf001: - bgtopscroll = data; - return; - - case 0xf002: - bgbotbank = data; - return; - - case 0xf003: - bgbotscroll = data; - return; - - case 0xf004: - txbank = data; - return; - - case 0xf005: - layer_ctrl = data; - return; - } -} - -void __fastcall angelkds_out_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: // nop - case 0x43: - case 0x83: - return; - - case 0x42: - bankswitch(data); - return; - - case 0xc0: - case 0xc1: - case 0xc2: - case 0xc3: - main_to_sound[port & 3] = data; - return; - } -} - -UINT8 __fastcall angelkds_in_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x40: - return DrvDips[0]; - - case 0x41: - return DrvDips[1]; - - case 0x42: - return 0xff; - - case 0x80: - case 0x81: - case 0x82: - return DrvInputs[port & 3]; - - case 0xc0: - case 0xc1: - case 0xc2: - case 0xc3: - return sound_to_main[port & 3]; - } - - return 0; -} - -void __fastcall main_to_sound_out_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - BurnYM2203Write(0, port & 1, data); - return; - - case 0x40: - case 0x41: - BurnYM2203Write(1, port & 1, data); - return; - - case 0x80: - case 0x81: - case 0x82: - case 0x83: - sound_to_main[port & 3] = data; - return; - } -} - -UINT8 __fastcall main_to_sound_in_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - case 0x01: - return BurnYM2203Read(0, port & 1); - - case 0x40: - case 0x41: - return BurnYM2203Read(1, port & 1); - - case 0x80: - case 0x81: - case 0x82: - case 0x83: - return main_to_sound[port & 3]; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - bankswitch(0); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - BurnYM2203Reset(); - - bgtopbank = 0; - bgbotbank = 0; - bgtopscroll = 0; - bgbotscroll = 0; - txbank = 0; - layer_ctrl = 0; - - return 0; -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000.0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x040000; - DrvZ80ROMDec = Next; Next += 0x00c000; - DrvZ80ROM1 = Next; Next += 0x010000; - - DrvGfxROM0 = Next; Next += 0x010000; - DrvGfxROM1 = Next; Next += 0x020000; - DrvGfxROM2 = Next; Next += 0x080000; - DrvGfxROM3 = Next; Next += 0x080000; - - DrvPalette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); - - pTempDraw = (UINT16*)Next; Next += 240 * 256 * sizeof(UINT16); - - AllRam = Next; - - DrvZ80RAM0 = Next; Next += 0x002000; - DrvBgtRAM = Next; Next += 0x000400; - DrvBgbRAM = Next; Next += 0x000400; - DrvTxtRAM = Next; Next += 0x000400; - DrvSprRAM = Next; Next += 0x000100; - DrvPalRAM = Next; Next += 0x000400; - - DrvZ80RAM1 = Next; Next += 0x000800; - - sound_to_main = Next; Next += 0x000004; - main_to_sound = Next; Next += 0x000004; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void DrvGfxExpand(UINT8 *gfx, INT32 len) -{ - for (INT32 i = (len - 1); i >= 0; i--) { - gfx[i * 2 + 1] = gfx[i] & 0x0f; - gfx[i * 2 + 0] = gfx[i] >> 4; - } -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x00000, 0x00004, 0x40000, 0x40004 }; - INT32 XOffs[16] = { 0x00000, 0x00001, 0x00002, 0x00003, 0x00008, 0x00009, 0x0000a, 0x0000b, - 0x00010, 0x00011, 0x00012, 0x00013, 0x00018, 0x00019, 0x0001a, 0x0001b }; - INT32 YOffs[16] = { 0x00000, 0x00020, 0x00040, 0x00060, 0x00080, 0x000a0, 0x000c0, 0x000e0, - 0x00100, 0x00120, 0x00140, 0x00160, 0x00180, 0x001a0, 0x001c0, 0x001e0 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x010000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM1, 0x10000); - - GfxDecode(0x0200, 4, 16, 16, Plane, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); - - BurnFree (tmp); - - DrvGfxExpand(DrvGfxROM0, 0x08000); - DrvGfxExpand(DrvGfxROM2, 0x40000); - DrvGfxExpand(DrvGfxROM3, 0x40000); - - return 0; -} - -//----------------------------------------------------------------------------------------------------- -// space position -/* -static void sega_decode_2(UINT8 *rom, UINT8 *decrypted, - const UINT8 opcode_xor[64],const INT32 opcode_swap_select[64], - const UINT8 data_xor[64],const INT32 data_swap_select[64]) -{ - static const UINT8 swaptable[24][4] = - { - { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 }, - { 6,2,4,0 }, { 6,0,2,4 }, { 6,4,0,2 }, { 2,6,4,0 }, - { 4,2,6,0 }, { 4,6,0,2 }, { 6,0,4,2 }, { 0,6,4,2 }, - { 4,0,6,2 }, { 0,4,6,2 }, { 6,2,0,4 }, { 2,6,0,4 }, - { 0,6,2,4 }, { 2,0,6,4 }, { 0,2,6,4 }, { 4,2,0,6 }, - { 2,4,0,6 }, { 4,0,2,6 }, { 2,0,4,6 }, { 0,2,4,6 }, - }; - - for (INT32 A = 0x0000;A < 0x8000;A++) - { - const UINT8 *tbl; - - INT32 src = rom[A]; - - // pick the translation table from bits 0, 3, 6, 9, 12 and 14 of the address - INT32 row = (A & 1) + (((A >> 3) & 1) << 1) + (((A >> 6) & 1) << 2) - + (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5); - - // decode opcodes - tbl = swaptable[opcode_swap_select[row]]; - decrypted[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ opcode_xor[row]; - - // decode data - tbl = swaptable[data_swap_select[row]]; - rom[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ data_xor[row]; - } -} - -static void sega_decode_317(UINT8 *src, UINT8 *dst, INT32 order, INT32 opcode_shift, INT32 data_shift) -{ - static const UINT8 xor1_317[1+64] = - { - 0x54, - 0x14,0x15,0x41,0x14,0x50,0x55,0x05,0x41,0x01,0x10,0x51,0x05,0x11,0x05,0x14,0x55, - 0x41,0x05,0x04,0x41,0x14,0x10,0x45,0x50,0x00,0x45,0x00,0x00,0x00,0x45,0x00,0x00, - 0x54,0x04,0x15,0x10,0x04,0x05,0x11,0x44,0x04,0x01,0x05,0x00,0x44,0x15,0x40,0x45, - 0x10,0x15,0x51,0x50,0x00,0x15,0x51,0x44,0x15,0x04,0x44,0x44,0x50,0x10,0x04,0x04, - }; - - static const UINT8 xor2_317[2+64] = - { - 0x04, - 0x44, - 0x15,0x51,0x41,0x10,0x15,0x54,0x04,0x51,0x05,0x55,0x05,0x54,0x45,0x04,0x10,0x01, - 0x51,0x55,0x45,0x55,0x45,0x04,0x55,0x40,0x11,0x15,0x01,0x40,0x01,0x11,0x45,0x44, - 0x40,0x05,0x15,0x15,0x01,0x50,0x00,0x44,0x04,0x50,0x51,0x45,0x50,0x54,0x41,0x40, - 0x14,0x40,0x50,0x45,0x10,0x05,0x50,0x01,0x40,0x01,0x50,0x50,0x50,0x44,0x40,0x10, - }; - - static const INT32 swap1_317[1+64] = - { - 7, - 1,11,23,17,23, 0,15,19, - 20,12,10, 0,18,18, 5,20, - 13, 0,18,14, 5, 6,10,21, - 1,11, 9, 3,21, 4, 1,17, - 5, 7,16,13,19,23,20, 2, - 10,23,23,15,10,12, 0,22, - 14, 6,15,11,17,15,21, 0, - 6, 1, 1,18, 5,15,15,20, - }; - - static const INT32 swap2_317[2+64] = - { - 7, - 12, - 18, 8,21, 0,22,21,13,21, - 20,13,20,14, 6, 3, 5,20, - 8,20, 4, 8,17,22, 0, 0, - 6,17,17, 9, 0,16,13,21, - 3, 2,18, 6,11, 3, 3,18, - 18,19, 3, 0, 5, 0,11, 8, - 8, 1, 7, 2,10, 8,10, 2, - 1, 3,12,16, 0,17,10, 1, - }; - - if (order) sega_decode_2(src, dst, xor2_317+opcode_shift, swap2_317+opcode_shift, xor1_317+data_shift, swap1_317+data_shift); - else sega_decode_2(src, dst, xor1_317+opcode_shift, swap1_317+opcode_shift, xor2_317+data_shift, swap2_317+data_shift); -}*/ - -// This is used in Sega System 1 (d_sys1.cpp) -void sega_decode_317(UINT8 *pDest, UINT8 *pDestDec, INT32 order, INT32 opcode_shift, INT32 data_shift); - -static void spcpostn_decode() -{ - sega_decode_317(DrvZ80ROM0, DrvZ80ROMDec, 0, 0, 1); -} - -//----------------------------------------------------------------------------------------------------- - -static INT32 DrvInit(INT32 game) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (game == 1) // angelkds - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - - memcpy (DrvZ80ROMDec, DrvZ80ROM0, 0x08000); - - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x18000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x28000, 4, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x08000, 8, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x08000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x10000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x18000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x20000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x28000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x30000, 15, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x38000, 16, 1)) return 1; - - memcpy (DrvGfxROM3, DrvGfxROM2, 0x40000); // the data is the same in both gfx regions... - } - else // spcpostn - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - - spcpostn_decode(); - - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x18000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x28000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x30000, 5, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 6, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x08000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x08000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x10000, 12, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x00000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x08000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x10000, 15, 1)) return 1; - } - - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROMDec, DrvZ80ROM0); - ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM0); - ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM0); - ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe3ff, 0, DrvBgtRAM); - ZetMapArea(0xe000, 0xe3ff, 1, DrvBgtRAM); - ZetMapArea(0xe000, 0xe3ff, 2, DrvBgtRAM); - ZetMapArea(0xe400, 0xe7ff, 0, DrvBgbRAM); - ZetMapArea(0xe400, 0xe7ff, 1, DrvBgbRAM); - ZetMapArea(0xe400, 0xe7ff, 2, DrvBgbRAM); - ZetMapArea(0xe800, 0xebff, 0, DrvTxtRAM); - ZetMapArea(0xe800, 0xebff, 1, DrvTxtRAM); - ZetMapArea(0xe800, 0xebff, 2, DrvTxtRAM); - ZetMapArea(0xec00, 0xecff, 0, DrvSprRAM); - ZetMapArea(0xec00, 0xecff, 1, DrvSprRAM); - ZetMapArea(0xec00, 0xecff, 2, DrvSprRAM); - ZetMapArea(0xed00, 0xefff, 0, DrvPalRAM); - ZetMapArea(0xed00, 0xefff, 1, DrvPalRAM); - ZetMapArea(0xed00, 0xefff, 2, DrvPalRAM); - ZetSetWriteHandler(angelkds_write); - ZetSetOutHandler(angelkds_out_port); - ZetSetInHandler(angelkds_in_port); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); - ZetSetOutHandler(main_to_sound_out_port); - ZetSetInHandler(main_to_sound_in_port); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.45, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.65, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.65, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.65, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.45, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.65, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.65, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.65, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - BurnYM2203Exit(); - GenericTilesExit(); - - ZetExit(); - - BurnFree (AllMem); - - return 0; -} - -static void DrvPaletteRecalc() -{ - UINT8 r,g,b; - for (INT32 i = 0; i < 0x100; i++) { - r = DrvPalRAM[i + 0x000] & 0x0f; - g = DrvPalRAM[i + 0x000] >> 4; - b = DrvPalRAM[i + 0x100] & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static void draw_sprites(UINT16 *dest, INT32 enable) -{ - for (INT32 offs = 0x100 - 4; offs >= 0; offs-=4) - { - INT32 attr = DrvSprRAM[offs + 1]; - INT32 sy = DrvSprRAM[offs + 2] ^ 0xff; - INT32 sx = DrvSprRAM[offs + 3]; - INT32 code = DrvSprRAM[offs + 0] + ((attr & 0x08) << 5); - - INT32 color = ((attr & 0x03) << 2) + 0x02; - INT32 flipx = attr & 0x10; - INT32 flipy = attr & 0x20; - - if (attr & enable) - { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(dest, code, sx, sy - 8, color, 4, 15, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(dest, code, sx, sy - 8, color, 4, 15, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(dest, code, sx, sy - 8, color, 4, 15, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(dest, code, sx, sy - 8, color, 4, 15, 0, DrvGfxROM1); - } - } - } - } -} - -static void draw_layer(UINT16 *dest, UINT8 *ram, UINT8 *gfx, INT32 bank, INT32 coloffs, INT32 scrollx, INT32 trans) -{ - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = ((offs >> 5) << 3) - 8; - - sx -= scrollx; - if (sx < -7) sx += 0x100; - - INT32 code = ram[offs] | (bank << 8); - INT32 color = coloffs; - - Render8x8Tile_Mask_Clip(dest, code, sx, sy, color, 4, trans, 0, gfx); - if (sx < 0) Render8x8Tile_Mask_Clip(dest, code, sx + 256, sy, color, 4, trans, 0, gfx); - } -} - -static INT32 DrvDraw() -{ - DrvPaletteRecalc(); - - // top half - x = 0 -> 127 - { - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) pTransDraw[i] = 0x003f; - - if (~layer_ctrl & 0x80) draw_layer(pTransDraw, DrvBgtRAM, DrvGfxROM2, bgtopbank, 0, bgtopscroll, 15); - - draw_sprites(pTransDraw, 0x80); - - if (~layer_ctrl & 0x20) draw_layer(pTransDraw, DrvTxtRAM, DrvGfxROM0, txbank, 3, 0, 0); - } - - // bottom half - x = 128 -> 256 - { - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) pTempDraw[i] = 0x003f; - - if (~layer_ctrl & 0x40) draw_layer(pTempDraw, DrvBgbRAM, DrvGfxROM3, bgbotbank, 0, bgbotscroll, 15); - - draw_sprites(pTempDraw, 0x40); - - if (~layer_ctrl & 0x20) draw_layer(pTempDraw, DrvTxtRAM, DrvGfxROM0, txbank, 3, 0, 0); - } - - // copy bottom half into place - { - UINT16 *source = pTempDraw + 128; - UINT16 *dest = pTransDraw + 128; - for (INT32 y = 0; y < nScreenHeight; y++) { - memcpy (dest, source, 128 * sizeof(UINT16)); - dest += 256, source += 256; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - - DrvInputs[0] = (DrvInputs[0] & 0x7f) | (DrvDips[2] & 0x80); - } - - INT32 nSegment; - INT32 nInterleave = 10; - INT32 nCyclesTotal[2] = { 8000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - nSegment = nCyclesTotal[0] / nInterleave; - - ZetOpen(0); - nCyclesDone[0] += ZetRun(nSegment); - if (i == (nInterleave - 1)) ZetRaiseIrq(0); - ZetClose(); - - ZetOpen(1); - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - ZetClose(); - } - - ZetOpen(1); - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029702; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - - SCAN_VAR(bgtopbank); - SCAN_VAR(bgbotbank); - SCAN_VAR(bgtopscroll); - SCAN_VAR(bgbotscroll); - SCAN_VAR(txbank); - SCAN_VAR(layer_ctrl); - - SCAN_VAR(DrvZ80Bank0); - - if (nAction & ACB_WRITE) { - ZetOpen(0); - bankswitch(DrvZ80Bank0); - ZetClose(); - } - } - - return 0; -} - - -// Angel Kids (Japan) - -static struct BurnRomInfo angelkdsRomDesc[] = { - { "11428.c10", 0x8000, 0x90daacd2, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "11424.c1", 0x8000, 0xb55997f6, 1 | BRF_PRG | BRF_ESS }, // 1 - { "11425.c2", 0x8000, 0x299359de, 1 | BRF_PRG | BRF_ESS }, // 2 - { "11426.c3", 0x8000, 0x5fad8bd3, 1 | BRF_PRG | BRF_ESS }, // 3 - { "11427.c4", 0x8000, 0xef920c74, 1 | BRF_PRG | BRF_ESS }, // 4 - - { "11429.d4", 0x8000, 0x0ca50a66, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 #1 Code - - { "11446", 0x8000, 0x45052470, 3 | BRF_GRA }, // 6 Text Tiles - - { "11448.h7", 0x8000, 0x05dab626, 4 | BRF_GRA }, // 7 Sprites - { "11447.f7", 0x8000, 0xb3afc5b3, 4 | BRF_GRA }, // 8 - - { "11437", 0x8000, 0xa520b628, 5 | BRF_GRA }, // 9 Background (Top) Tiles - { "11436", 0x8000, 0x469ab216, 5 | BRF_GRA }, // 10 - { "11435", 0x8000, 0xb0f8c245, 5 | BRF_GRA }, // 11 - { "11434", 0x8000, 0xcbde81f5, 5 | BRF_GRA }, // 12 - { "11433", 0x8000, 0xb63fa414, 5 | BRF_GRA }, // 13 - { "11432", 0x8000, 0x00dc747b, 5 | BRF_GRA }, // 14 - { "11431", 0x8000, 0xac2025af, 5 | BRF_GRA }, // 15 - { "11430", 0x8000, 0xd640f89e, 5 | BRF_GRA }, // 16 - - { "11445", 0x8000, 0xa520b628, 6 | BRF_GRA }, // 17 Background (Bottom) Tiles - { "11444", 0x8000, 0x469ab216, 6 | BRF_GRA }, // 18 - { "11443", 0x8000, 0xb0f8c245, 6 | BRF_GRA }, // 19 - { "11442", 0x8000, 0xcbde81f5, 6 | BRF_GRA }, // 20 - { "11441", 0x8000, 0xb63fa414, 6 | BRF_GRA }, // 21 - { "11440", 0x8000, 0x00dc747b, 6 | BRF_GRA }, // 22 - { "11439", 0x8000, 0xac2025af, 6 | BRF_GRA }, // 23 - { "11438", 0x8000, 0xd640f89e, 6 | BRF_GRA }, // 24 - - { "63s081n.u5", 0x0020, 0x36b98627, 7 | BRF_OPT }, // 25 PROM -}; - -STD_ROM_PICK(angelkds) -STD_ROM_FN(angelkds) - -static INT32 angelkdsInit() -{ - return DrvInit(1); -} - -struct BurnDriver BurnDrvAngelkds = { - "angelkds", NULL, NULL, NULL, "1988", - "Angel Kids (Japan)\0", NULL, "Sega / Nasco?", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_SEGA_MISC, GBF_MISC, 0, - NULL, angelkdsRomInfo, angelkdsRomName, NULL, NULL, AngelkdsInputInfo, AngelkdsDIPInfo, - angelkdsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x100, - 240, 256, 3, 4 -}; - - -// Space Position (Japan) - -static struct BurnRomInfo spcpostnRomDesc[] = { - { "epr10125.c10", 0x8000, 0xbffd38c6, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "epr10120.c1", 0x8000, 0xd6399f99, 1 | BRF_PRG | BRF_ESS }, // 1 - { "epr10121.c2", 0x8000, 0xd4861560, 1 | BRF_PRG | BRF_ESS }, // 2 - { "epr10122.c3", 0x8000, 0x7a1bff1b, 1 | BRF_PRG | BRF_ESS }, // 3 - { "epr10123.c4", 0x8000, 0x6aed2925, 1 | BRF_PRG | BRF_ESS }, // 4 - { "epr10124.c5", 0x8000, 0xa1d7ae6b, 1 | BRF_PRG | BRF_ESS }, // 5 - - { "epr10126.d4", 0x8000, 0xab17f852, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 #1 Code - - { "epr10133.17", 0x8000, 0x642e6609, 3 | BRF_GRA }, // 7 Text Tiles - - { "epr10135.19", 0x8000, 0x0685c4fa, 4 | BRF_GRA }, // 8 Sprites - { "epr10134.18", 0x8000, 0xc674ff88, 4 | BRF_GRA }, // 9 - - { "epr10132.16", 0x8000, 0x2df8b1bd, 5 | BRF_GRA }, // 10 Background (Top) Tiles - { "epr10131.15", 0x8000, 0xde223817, 5 | BRF_GRA }, // 11 - { "epr10130.14", 0x8000, 0xb68fcb36, 5 | BRF_GRA }, // 12 - - { "epr10129.08", 0x8000, 0xa6f21023, 6 | BRF_GRA }, // 13 Background (Bottom) Tiles - { "epr10128.07", 0x8000, 0xde223817, 6 | BRF_GRA }, // 14 - { "epr10127.06", 0x8000, 0xb68fcb36, 6 | BRF_GRA }, // 15 - - { "63s081n.u5", 0x0020, 0x36b98627, 0 | BRF_OPT }, // 16 PROM -}; - -STD_ROM_PICK(spcpostn) -STD_ROM_FN(spcpostn) - -static INT32 spcpostnInit() -{ - return DrvInit(2); -} - -struct BurnDriver BurnDrvSpcpostn = { - "spcpostn", NULL, NULL, NULL, "1986", - "Space Position (Japan)\0", NULL, "Sega / Nasco", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_SEGA_MISC, GBF_RACING, 0, - NULL, spcpostnRomInfo, spcpostnRomName, NULL, NULL, SpcpostnInputInfo, SpcpostnDIPInfo, - spcpostnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x100, - 240, 256, 3, 4 -}; +// FB Alpha Angel Kids driver module +// Based on MAME driver by David Haywood + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2203.h" +#include "bitswap.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROMDec; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvPalRAM; +static UINT8 *DrvBgtRAM; +static UINT8 *DrvBgbRAM; +static UINT8 *DrvTxtRAM; +static UINT8 *DrvSprRAM; +static UINT32 *DrvPalette; + +static UINT16 *pTempDraw; + +static UINT8 *main_to_sound; +static UINT8 *sound_to_main; + +static UINT8 bgtopbank; +static UINT8 bgbotbank; +static UINT8 bgtopscroll; +static UINT8 bgbotscroll; +static UINT8 txbank; +static UINT8 layer_ctrl; + +static INT32 DrvZ80Bank0; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvReset; +static UINT16 DrvInputs[3]; + +static struct BurnInputInfo AngelkdsInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Left Stick Up", BIT_DIGITAL, DrvJoy2 + 4, "p3 up" }, + {"P1 Left Stick Down", BIT_DIGITAL, DrvJoy2 + 5, "p3 down" }, + {"P1 Left Stick Left", BIT_DIGITAL, DrvJoy2 + 6, "p3 left" }, + {"P1 Left Stick Right", BIT_DIGITAL, DrvJoy2 + 7, "p3 right" }, + {"P1 Right Stick Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Right Stick Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, + {"P1 Right Stick Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right Stick Right",BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Left Stick Up", BIT_DIGITAL, DrvJoy3 + 4, "p4 up" }, + {"P2 Left Stick Down", BIT_DIGITAL, DrvJoy3 + 5, "p4 down" }, + {"P2 Left Stick Left", BIT_DIGITAL, DrvJoy3 + 6, "p4 left" }, + {"P2 Left Stick Right", BIT_DIGITAL, DrvJoy3 + 7, "p4 right" }, + {"P2 Right Stick Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" }, + {"P2 Right Stick Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" }, + {"P2 Right Stick Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, + {"P2 Right Stick Right",BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Angelkds) + +static struct BurnInputInfo SpcpostnInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Spcpostn) + +static struct BurnDIPInfo AngelkdsDIPList[]= +{ + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xf8, NULL }, + {0x18, 0xff, 0xff, 0x80, NULL }, + + {0 , 0xfe, 0 , 10, "Coin B" }, + {0x16, 0x01, 0x0f, 0x07, "4 Coins 1 Credits" }, + {0x16, 0x01, 0x0f, 0x08, "3 Coins 1 Credits" }, + {0x16, 0x01, 0x0f, 0x09, "2 Coins 1 Credits" }, + {0x16, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x16, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x16, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x16, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x16, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x16, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x16, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 10, "Coin A" }, + {0x16, 0x01, 0xf0, 0x70, "4 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0x80, "3 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0x90, "2 Coins 1 Credits" }, + {0x16, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x16, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x16, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x16, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x16, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x16, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x16, 0x01, 0xf0, 0x00, "Free Play" }, + +// not supported +// {0 , 0xfe, 0 , 2, "Cabinet" }, +// {0x17, 0x01, 0x01, 0x00, "Upright" }, +// {0x17, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "High Score Characters" }, + {0x17, 0x01, 0x02, 0x00, "3" }, + {0x17, 0x01, 0x02, 0x02, "10" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x17, 0x01, 0x0c, 0x0c, "20k, 50k, 100k, 200k and 500k" }, + {0x17, 0x01, 0x0c, 0x08, "50k, 100k, 200k and 500k" }, + {0x17, 0x01, 0x0c, 0x04, "100k, 200k and 500k" }, + {0x17, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x17, 0x01, 0x30, 0x30, "3" }, + {0x17, 0x01, 0x30, 0x20, "4" }, + {0x17, 0x01, 0x30, 0x10, "5" }, + {0x17, 0x01, 0x30, 0x00, "99 (Cheat)" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x17, 0x01, 0xc0, 0xc0, "Very Easy" }, + {0x17, 0x01, 0xc0, 0x40, "Easy" }, + {0x17, 0x01, 0xc0, 0x80, "Hard" }, + {0x17, 0x01, 0xc0, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x18, 0x01, 0x80, 0x00, "On" }, + {0x18, 0x01, 0x80, 0x80, "Off" }, +}; + +STDDIPINFO(Angelkds) + +static struct BurnDIPInfo SpcpostnDIPList[]= +{ + {0x12, 0xff, 0xff, 0xff, NULL }, + {0x13, 0xff, 0xff, 0xab, NULL }, + {0x14, 0xff, 0xff, 0x80, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credits" }, + {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credits" }, + {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" }, + {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" }, + {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, + {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, + {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, + {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, + {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, + {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" }, + {0x12, 0x01, 0x0f, 0x00, "Free Play" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x12, 0x01, 0xf0, 0x00, "Off" }, + {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, + {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" }, + {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" }, + {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" }, + {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" }, + {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, + {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" }, + {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, + {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, + {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, + {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x13, 0x01, 0x01, 0x01, "No" }, + {0x13, 0x01, 0x01, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2, "Obstruction Car" }, + {0x13, 0x01, 0x02, 0x02, "Normal" }, + {0x13, 0x01, 0x02, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 4, "Time Limit" }, + {0x13, 0x01, 0x0c, 0x00, "1:10" }, + {0x13, 0x01, 0x0c, 0x04, "1:20" }, + {0x13, 0x01, 0x0c, 0x08, "1:30" }, + {0x13, 0x01, 0x0c, 0x0c, "1:40" }, + + {0 , 0xfe, 0 , 4, "Power Down" }, + {0x13, 0x01, 0x30, 0x30, "Slow" }, + {0x13, 0x01, 0x30, 0x20, "Normal" }, + {0x13, 0x01, 0x30, 0x10, "Fast" }, + {0x13, 0x01, 0x30, 0x00, "Fastest" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Spcpostn) + +static void bankswitch(INT32 data) +{ + DrvZ80Bank0 = (data & 0x0f); + + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + 0x10000 + DrvZ80Bank0 * 0x4000); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + 0x10000 + DrvZ80Bank0 * 0x4000); +} + +void __fastcall angelkds_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf000: + bgtopbank = data; + return; + + case 0xf001: + bgtopscroll = data; + return; + + case 0xf002: + bgbotbank = data; + return; + + case 0xf003: + bgbotscroll = data; + return; + + case 0xf004: + txbank = data; + return; + + case 0xf005: + layer_ctrl = data; + return; + } +} + +void __fastcall angelkds_out_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: // nop + case 0x43: + case 0x83: + return; + + case 0x42: + bankswitch(data); + return; + + case 0xc0: + case 0xc1: + case 0xc2: + case 0xc3: + main_to_sound[port & 3] = data; + return; + } +} + +UINT8 __fastcall angelkds_in_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x40: + return DrvDips[0]; + + case 0x41: + return DrvDips[1]; + + case 0x42: + return 0xff; + + case 0x80: + case 0x81: + case 0x82: + return DrvInputs[port & 3]; + + case 0xc0: + case 0xc1: + case 0xc2: + case 0xc3: + return sound_to_main[port & 3]; + } + + return 0; +} + +void __fastcall main_to_sound_out_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + BurnYM2203Write(0, port & 1, data); + return; + + case 0x40: + case 0x41: + BurnYM2203Write(1, port & 1, data); + return; + + case 0x80: + case 0x81: + case 0x82: + case 0x83: + sound_to_main[port & 3] = data; + return; + } +} + +UINT8 __fastcall main_to_sound_in_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + case 0x01: + return BurnYM2203Read(0, port & 1); + + case 0x40: + case 0x41: + return BurnYM2203Read(1, port & 1); + + case 0x80: + case 0x81: + case 0x82: + case 0x83: + return main_to_sound[port & 3]; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + bankswitch(0); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + BurnYM2203Reset(); + + bgtopbank = 0; + bgbotbank = 0; + bgtopscroll = 0; + bgbotscroll = 0; + txbank = 0; + layer_ctrl = 0; + + return 0; +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000.0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x040000; + DrvZ80ROMDec = Next; Next += 0x00c000; + DrvZ80ROM1 = Next; Next += 0x010000; + + DrvGfxROM0 = Next; Next += 0x010000; + DrvGfxROM1 = Next; Next += 0x020000; + DrvGfxROM2 = Next; Next += 0x080000; + DrvGfxROM3 = Next; Next += 0x080000; + + DrvPalette = (UINT32*)Next; Next += 0x0100 * sizeof(UINT32); + + pTempDraw = (UINT16*)Next; Next += 240 * 256 * sizeof(UINT16); + + AllRam = Next; + + DrvZ80RAM0 = Next; Next += 0x002000; + DrvBgtRAM = Next; Next += 0x000400; + DrvBgbRAM = Next; Next += 0x000400; + DrvTxtRAM = Next; Next += 0x000400; + DrvSprRAM = Next; Next += 0x000100; + DrvPalRAM = Next; Next += 0x000400; + + DrvZ80RAM1 = Next; Next += 0x000800; + + sound_to_main = Next; Next += 0x000004; + main_to_sound = Next; Next += 0x000004; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void DrvGfxExpand(UINT8 *gfx, INT32 len) +{ + for (INT32 i = (len - 1); i >= 0; i--) { + gfx[i * 2 + 1] = gfx[i] & 0x0f; + gfx[i * 2 + 0] = gfx[i] >> 4; + } +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x00000, 0x00004, 0x40000, 0x40004 }; + INT32 XOffs[16] = { 0x00000, 0x00001, 0x00002, 0x00003, 0x00008, 0x00009, 0x0000a, 0x0000b, + 0x00010, 0x00011, 0x00012, 0x00013, 0x00018, 0x00019, 0x0001a, 0x0001b }; + INT32 YOffs[16] = { 0x00000, 0x00020, 0x00040, 0x00060, 0x00080, 0x000a0, 0x000c0, 0x000e0, + 0x00100, 0x00120, 0x00140, 0x00160, 0x00180, 0x001a0, 0x001c0, 0x001e0 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x010000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM1, 0x10000); + + GfxDecode(0x0200, 4, 16, 16, Plane, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); + + BurnFree (tmp); + + DrvGfxExpand(DrvGfxROM0, 0x08000); + DrvGfxExpand(DrvGfxROM2, 0x40000); + DrvGfxExpand(DrvGfxROM3, 0x40000); + + return 0; +} + +//----------------------------------------------------------------------------------------------------- +// space position +/* +static void sega_decode_2(UINT8 *rom, UINT8 *decrypted, + const UINT8 opcode_xor[64],const INT32 opcode_swap_select[64], + const UINT8 data_xor[64],const INT32 data_swap_select[64]) +{ + static const UINT8 swaptable[24][4] = + { + { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 }, + { 6,2,4,0 }, { 6,0,2,4 }, { 6,4,0,2 }, { 2,6,4,0 }, + { 4,2,6,0 }, { 4,6,0,2 }, { 6,0,4,2 }, { 0,6,4,2 }, + { 4,0,6,2 }, { 0,4,6,2 }, { 6,2,0,4 }, { 2,6,0,4 }, + { 0,6,2,4 }, { 2,0,6,4 }, { 0,2,6,4 }, { 4,2,0,6 }, + { 2,4,0,6 }, { 4,0,2,6 }, { 2,0,4,6 }, { 0,2,4,6 }, + }; + + for (INT32 A = 0x0000;A < 0x8000;A++) + { + const UINT8 *tbl; + + INT32 src = rom[A]; + + // pick the translation table from bits 0, 3, 6, 9, 12 and 14 of the address + INT32 row = (A & 1) + (((A >> 3) & 1) << 1) + (((A >> 6) & 1) << 2) + + (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5); + + // decode opcodes + tbl = swaptable[opcode_swap_select[row]]; + decrypted[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ opcode_xor[row]; + + // decode data + tbl = swaptable[data_swap_select[row]]; + rom[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ data_xor[row]; + } +} + +static void sega_decode_317(UINT8 *src, UINT8 *dst, INT32 order, INT32 opcode_shift, INT32 data_shift) +{ + static const UINT8 xor1_317[1+64] = + { + 0x54, + 0x14,0x15,0x41,0x14,0x50,0x55,0x05,0x41,0x01,0x10,0x51,0x05,0x11,0x05,0x14,0x55, + 0x41,0x05,0x04,0x41,0x14,0x10,0x45,0x50,0x00,0x45,0x00,0x00,0x00,0x45,0x00,0x00, + 0x54,0x04,0x15,0x10,0x04,0x05,0x11,0x44,0x04,0x01,0x05,0x00,0x44,0x15,0x40,0x45, + 0x10,0x15,0x51,0x50,0x00,0x15,0x51,0x44,0x15,0x04,0x44,0x44,0x50,0x10,0x04,0x04, + }; + + static const UINT8 xor2_317[2+64] = + { + 0x04, + 0x44, + 0x15,0x51,0x41,0x10,0x15,0x54,0x04,0x51,0x05,0x55,0x05,0x54,0x45,0x04,0x10,0x01, + 0x51,0x55,0x45,0x55,0x45,0x04,0x55,0x40,0x11,0x15,0x01,0x40,0x01,0x11,0x45,0x44, + 0x40,0x05,0x15,0x15,0x01,0x50,0x00,0x44,0x04,0x50,0x51,0x45,0x50,0x54,0x41,0x40, + 0x14,0x40,0x50,0x45,0x10,0x05,0x50,0x01,0x40,0x01,0x50,0x50,0x50,0x44,0x40,0x10, + }; + + static const INT32 swap1_317[1+64] = + { + 7, + 1,11,23,17,23, 0,15,19, + 20,12,10, 0,18,18, 5,20, + 13, 0,18,14, 5, 6,10,21, + 1,11, 9, 3,21, 4, 1,17, + 5, 7,16,13,19,23,20, 2, + 10,23,23,15,10,12, 0,22, + 14, 6,15,11,17,15,21, 0, + 6, 1, 1,18, 5,15,15,20, + }; + + static const INT32 swap2_317[2+64] = + { + 7, + 12, + 18, 8,21, 0,22,21,13,21, + 20,13,20,14, 6, 3, 5,20, + 8,20, 4, 8,17,22, 0, 0, + 6,17,17, 9, 0,16,13,21, + 3, 2,18, 6,11, 3, 3,18, + 18,19, 3, 0, 5, 0,11, 8, + 8, 1, 7, 2,10, 8,10, 2, + 1, 3,12,16, 0,17,10, 1, + }; + + if (order) sega_decode_2(src, dst, xor2_317+opcode_shift, swap2_317+opcode_shift, xor1_317+data_shift, swap1_317+data_shift); + else sega_decode_2(src, dst, xor1_317+opcode_shift, swap1_317+opcode_shift, xor2_317+data_shift, swap2_317+data_shift); +}*/ + +// This is used in Sega System 1 (d_sys1.cpp) +void sega_decode_317(UINT8 *pDest, UINT8 *pDestDec, INT32 order, INT32 opcode_shift, INT32 data_shift); + +static void spcpostn_decode() +{ + sega_decode_317(DrvZ80ROM0, DrvZ80ROMDec, 0, 0, 1); +} + +//----------------------------------------------------------------------------------------------------- + +static INT32 DrvInit(INT32 game) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (game == 1) // angelkds + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + + memcpy (DrvZ80ROMDec, DrvZ80ROM0, 0x08000); + + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x18000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x28000, 4, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x08000, 8, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x08000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x10000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x18000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x20000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x28000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x30000, 15, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x38000, 16, 1)) return 1; + + memcpy (DrvGfxROM3, DrvGfxROM2, 0x40000); // the data is the same in both gfx regions... + } + else // spcpostn + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + + spcpostn_decode(); + + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x18000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x28000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x30000, 5, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 6, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x08000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x08000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x10000, 12, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x00000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x08000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x10000, 15, 1)) return 1; + } + + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROMDec, DrvZ80ROM0); + ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM0); + ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM0); + ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe3ff, 0, DrvBgtRAM); + ZetMapArea(0xe000, 0xe3ff, 1, DrvBgtRAM); + ZetMapArea(0xe000, 0xe3ff, 2, DrvBgtRAM); + ZetMapArea(0xe400, 0xe7ff, 0, DrvBgbRAM); + ZetMapArea(0xe400, 0xe7ff, 1, DrvBgbRAM); + ZetMapArea(0xe400, 0xe7ff, 2, DrvBgbRAM); + ZetMapArea(0xe800, 0xebff, 0, DrvTxtRAM); + ZetMapArea(0xe800, 0xebff, 1, DrvTxtRAM); + ZetMapArea(0xe800, 0xebff, 2, DrvTxtRAM); + ZetMapArea(0xec00, 0xecff, 0, DrvSprRAM); + ZetMapArea(0xec00, 0xecff, 1, DrvSprRAM); + ZetMapArea(0xec00, 0xecff, 2, DrvSprRAM); + ZetMapArea(0xed00, 0xefff, 0, DrvPalRAM); + ZetMapArea(0xed00, 0xefff, 1, DrvPalRAM); + ZetMapArea(0xed00, 0xefff, 2, DrvPalRAM); + ZetSetWriteHandler(angelkds_write); + ZetSetOutHandler(angelkds_out_port); + ZetSetInHandler(angelkds_in_port); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); + ZetSetOutHandler(main_to_sound_out_port); + ZetSetInHandler(main_to_sound_in_port); + ZetClose(); + + BurnYM2203Init(2, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.45, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.65, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.65, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.65, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.45, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.65, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.65, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.65, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + BurnYM2203Exit(); + GenericTilesExit(); + + ZetExit(); + + BurnFree (AllMem); + + return 0; +} + +static void DrvPaletteRecalc() +{ + UINT8 r,g,b; + for (INT32 i = 0; i < 0x100; i++) { + r = DrvPalRAM[i + 0x000] & 0x0f; + g = DrvPalRAM[i + 0x000] >> 4; + b = DrvPalRAM[i + 0x100] & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static void draw_sprites(UINT16 *dest, INT32 enable) +{ + for (INT32 offs = 0x100 - 4; offs >= 0; offs-=4) + { + INT32 attr = DrvSprRAM[offs + 1]; + INT32 sy = DrvSprRAM[offs + 2] ^ 0xff; + INT32 sx = DrvSprRAM[offs + 3]; + INT32 code = DrvSprRAM[offs + 0] + ((attr & 0x08) << 5); + + INT32 color = ((attr & 0x03) << 2) + 0x02; + INT32 flipx = attr & 0x10; + INT32 flipy = attr & 0x20; + + if (attr & enable) + { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(dest, code, sx, sy - 8, color, 4, 15, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(dest, code, sx, sy - 8, color, 4, 15, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(dest, code, sx, sy - 8, color, 4, 15, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(dest, code, sx, sy - 8, color, 4, 15, 0, DrvGfxROM1); + } + } + } + } +} + +static void draw_layer(UINT16 *dest, UINT8 *ram, UINT8 *gfx, INT32 bank, INT32 coloffs, INT32 scrollx, INT32 trans) +{ + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = ((offs >> 5) << 3) - 8; + + sx -= scrollx; + if (sx < -7) sx += 0x100; + + INT32 code = ram[offs] | (bank << 8); + INT32 color = coloffs; + + Render8x8Tile_Mask_Clip(dest, code, sx, sy, color, 4, trans, 0, gfx); + if (sx < 0) Render8x8Tile_Mask_Clip(dest, code, sx + 256, sy, color, 4, trans, 0, gfx); + } +} + +static INT32 DrvDraw() +{ + DrvPaletteRecalc(); + + // top half - x = 0 -> 127 + { + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) pTransDraw[i] = 0x003f; + + if (~layer_ctrl & 0x80) draw_layer(pTransDraw, DrvBgtRAM, DrvGfxROM2, bgtopbank, 0, bgtopscroll, 15); + + draw_sprites(pTransDraw, 0x80); + + if (~layer_ctrl & 0x20) draw_layer(pTransDraw, DrvTxtRAM, DrvGfxROM0, txbank, 3, 0, 0); + } + + // bottom half - x = 128 -> 256 + { + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) pTempDraw[i] = 0x003f; + + if (~layer_ctrl & 0x40) draw_layer(pTempDraw, DrvBgbRAM, DrvGfxROM3, bgbotbank, 0, bgbotscroll, 15); + + draw_sprites(pTempDraw, 0x40); + + if (~layer_ctrl & 0x20) draw_layer(pTempDraw, DrvTxtRAM, DrvGfxROM0, txbank, 3, 0, 0); + } + + // copy bottom half into place + { + UINT16 *source = pTempDraw + 128; + UINT16 *dest = pTransDraw + 128; + for (INT32 y = 0; y < nScreenHeight; y++) { + memcpy (dest, source, 128 * sizeof(UINT16)); + dest += 256, source += 256; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + + DrvInputs[0] = (DrvInputs[0] & 0x7f) | (DrvDips[2] & 0x80); + } + + INT32 nSegment; + INT32 nInterleave = 10; + INT32 nCyclesTotal[2] = { 8000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + nSegment = nCyclesTotal[0] / nInterleave; + + ZetOpen(0); + nCyclesDone[0] += ZetRun(nSegment); + if (i == (nInterleave - 1)) ZetRaiseIrq(0); + ZetClose(); + + ZetOpen(1); + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + ZetClose(); + } + + ZetOpen(1); + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029702; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + + SCAN_VAR(bgtopbank); + SCAN_VAR(bgbotbank); + SCAN_VAR(bgtopscroll); + SCAN_VAR(bgbotscroll); + SCAN_VAR(txbank); + SCAN_VAR(layer_ctrl); + + SCAN_VAR(DrvZ80Bank0); + + if (nAction & ACB_WRITE) { + ZetOpen(0); + bankswitch(DrvZ80Bank0); + ZetClose(); + } + } + + return 0; +} + + +// Angel Kids (Japan) + +static struct BurnRomInfo angelkdsRomDesc[] = { + { "11428.c10", 0x8000, 0x90daacd2, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "11424.c1", 0x8000, 0xb55997f6, 1 | BRF_PRG | BRF_ESS }, // 1 + { "11425.c2", 0x8000, 0x299359de, 1 | BRF_PRG | BRF_ESS }, // 2 + { "11426.c3", 0x8000, 0x5fad8bd3, 1 | BRF_PRG | BRF_ESS }, // 3 + { "11427.c4", 0x8000, 0xef920c74, 1 | BRF_PRG | BRF_ESS }, // 4 + + { "11429.d4", 0x8000, 0x0ca50a66, 2 | BRF_PRG | BRF_ESS }, // 5 Z80 #1 Code + + { "11446", 0x8000, 0x45052470, 3 | BRF_GRA }, // 6 Text Tiles + + { "11448.h7", 0x8000, 0x05dab626, 4 | BRF_GRA }, // 7 Sprites + { "11447.f7", 0x8000, 0xb3afc5b3, 4 | BRF_GRA }, // 8 + + { "11437", 0x8000, 0xa520b628, 5 | BRF_GRA }, // 9 Background (Top) Tiles + { "11436", 0x8000, 0x469ab216, 5 | BRF_GRA }, // 10 + { "11435", 0x8000, 0xb0f8c245, 5 | BRF_GRA }, // 11 + { "11434", 0x8000, 0xcbde81f5, 5 | BRF_GRA }, // 12 + { "11433", 0x8000, 0xb63fa414, 5 | BRF_GRA }, // 13 + { "11432", 0x8000, 0x00dc747b, 5 | BRF_GRA }, // 14 + { "11431", 0x8000, 0xac2025af, 5 | BRF_GRA }, // 15 + { "11430", 0x8000, 0xd640f89e, 5 | BRF_GRA }, // 16 + + { "11445", 0x8000, 0xa520b628, 6 | BRF_GRA }, // 17 Background (Bottom) Tiles + { "11444", 0x8000, 0x469ab216, 6 | BRF_GRA }, // 18 + { "11443", 0x8000, 0xb0f8c245, 6 | BRF_GRA }, // 19 + { "11442", 0x8000, 0xcbde81f5, 6 | BRF_GRA }, // 20 + { "11441", 0x8000, 0xb63fa414, 6 | BRF_GRA }, // 21 + { "11440", 0x8000, 0x00dc747b, 6 | BRF_GRA }, // 22 + { "11439", 0x8000, 0xac2025af, 6 | BRF_GRA }, // 23 + { "11438", 0x8000, 0xd640f89e, 6 | BRF_GRA }, // 24 + + { "63s081n.u5", 0x0020, 0x36b98627, 7 | BRF_OPT }, // 25 PROM +}; + +STD_ROM_PICK(angelkds) +STD_ROM_FN(angelkds) + +static INT32 angelkdsInit() +{ + return DrvInit(1); +} + +struct BurnDriver BurnDrvAngelkds = { + "angelkds", NULL, NULL, NULL, "1988", + "Angel Kids (Japan)\0", NULL, "Sega / Nasco?", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_SEGA_MISC, GBF_MISC, 0, + NULL, angelkdsRomInfo, angelkdsRomName, NULL, NULL, AngelkdsInputInfo, AngelkdsDIPInfo, + angelkdsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x100, + 240, 256, 3, 4 +}; + + +// Space Position (Japan) + +static struct BurnRomInfo spcpostnRomDesc[] = { + { "epr10125.c10", 0x8000, 0xbffd38c6, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "epr10120.c1", 0x8000, 0xd6399f99, 1 | BRF_PRG | BRF_ESS }, // 1 + { "epr10121.c2", 0x8000, 0xd4861560, 1 | BRF_PRG | BRF_ESS }, // 2 + { "epr10122.c3", 0x8000, 0x7a1bff1b, 1 | BRF_PRG | BRF_ESS }, // 3 + { "epr10123.c4", 0x8000, 0x6aed2925, 1 | BRF_PRG | BRF_ESS }, // 4 + { "epr10124.c5", 0x8000, 0xa1d7ae6b, 1 | BRF_PRG | BRF_ESS }, // 5 + + { "epr10126.d4", 0x8000, 0xab17f852, 2 | BRF_PRG | BRF_ESS }, // 6 Z80 #1 Code + + { "epr10133.17", 0x8000, 0x642e6609, 3 | BRF_GRA }, // 7 Text Tiles + + { "epr10135.19", 0x8000, 0x0685c4fa, 4 | BRF_GRA }, // 8 Sprites + { "epr10134.18", 0x8000, 0xc674ff88, 4 | BRF_GRA }, // 9 + + { "epr10132.16", 0x8000, 0x2df8b1bd, 5 | BRF_GRA }, // 10 Background (Top) Tiles + { "epr10131.15", 0x8000, 0xde223817, 5 | BRF_GRA }, // 11 + { "epr10130.14", 0x8000, 0xb68fcb36, 5 | BRF_GRA }, // 12 + + { "epr10129.08", 0x8000, 0xa6f21023, 6 | BRF_GRA }, // 13 Background (Bottom) Tiles + { "epr10128.07", 0x8000, 0xde223817, 6 | BRF_GRA }, // 14 + { "epr10127.06", 0x8000, 0xb68fcb36, 6 | BRF_GRA }, // 15 + + { "63s081n.u5", 0x0020, 0x36b98627, 0 | BRF_OPT }, // 16 PROM +}; + +STD_ROM_PICK(spcpostn) +STD_ROM_FN(spcpostn) + +static INT32 spcpostnInit() +{ + return DrvInit(2); +} + +struct BurnDriver BurnDrvSpcpostn = { + "spcpostn", NULL, NULL, NULL, "1986", + "Space Position (Japan)\0", NULL, "Sega / Nasco", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_SEGA_MISC, GBF_RACING, 0, + NULL, spcpostnRomInfo, spcpostnRomName, NULL, NULL, SpcpostnInputInfo, SpcpostnDIPInfo, + spcpostnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x100, + 240, 256, 3, 4 +}; diff --git a/src/burn/drv/sega/d_bankp.cpp b/src/burn/drv/sega/d_bankp.cpp index 859484de1..d019998de 100644 --- a/src/burn/drv/sega/d_bankp.cpp +++ b/src/burn/drv/sega/d_bankp.cpp @@ -1,614 +1,613 @@ -// FB Alpha Bank Panic Driver Module -// Based on MAME driver by Nicola Salmoria - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "sn76496.h" - -static UINT8 *Mem, *Rom, *Gfx0, *Gfx1, *Prom; -static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvReset, DrvDips; -static INT32 *Palette; - -static UINT8 scroll_x, priority, flipscreen, interrupt_enable; - -static struct BurnInputInfo bankpInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 5, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 6, "p2 coin" }, - {"Coin 3" , BIT_DIGITAL , DrvJoy3 + 2, "p3 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy2 + 5, "p1 start" }, - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 6, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 7, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 3"}, - - {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 7, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 1, "p2 fire 3"}, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, &DrvDips, "dip" }, -}; - -STDINPUTINFO(bankp) - -static struct BurnInputInfo combhInputList[] = { - {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 5, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 6, "p2 coin" }, - {"Coin 3" , BIT_DIGITAL , DrvJoy3 + 2, "p3 coin" }, - {"P1 Start" , BIT_DIGITAL , DrvJoy2 + 5, "p1 start" }, - {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 6, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 2, "p1 down" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 7, "p1 fire 2"}, - {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 3"}, - - {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p2 down" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 7, "p2 fire 2"}, - {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 1, "p2 fire 3"}, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, &DrvDips, "dip" }, - -}; - -STDINPUTINFO(combh) - -static struct BurnDIPInfo bankpDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0xc0, NULL }, - - {0 , 0xfe, 0 , 4 , "Coin A/B" }, - {0x10, 0x01, 0x03, 0x03, "3C 1C" }, - {0x10, 0x01, 0x03, 0x02, "2C 1C" }, - {0x10, 0x01, 0x03, 0x00, "1C 1C" }, - {0x10, 0x01, 0x03, 0x01, "1C 2C" }, - - {0 , 0xfe, 0 , 2 , "Coin C" }, - {0x10, 0x01, 0x04, 0x04, "2C 1C" }, - {0x10, 0x01, 0x04, 0x00, "1C 1C" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x10, 0x01, 0x08, 0x00, "3" }, - {0x10, 0x01, 0x08, 0x08, "4" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x10, 0x00, "70K 200K 500K..." }, - {0x10, 0x01, 0x10, 0x10, "100K 400K 800K..." }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x10, 0x01, 0x20, 0x00, "Easy" }, - {0x10, 0x01, 0x20, 0x20, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x10, 0x01, 0x40, 0x00, "Off" }, - {0x10, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x80, 0x80, "Upright" }, - {0x10, 0x01, 0x80, 0x00, "Cocktail" }, -}; - -STDDIPINFO(bankp) - -static struct BurnDIPInfo combhDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0x10, NULL }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x10, 0x01, 0x01, 0x00, "Off" }, - {0x10, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x10, 0x01, 0x06, 0x06, "2C 1C" }, - {0x10, 0x01, 0x06, 0x00, "1C 1C" }, - {0x10, 0x01, 0x06, 0x02, "1C 2C" }, - {0x10, 0x01, 0x06, 0x04, "1C 3C" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x10, 0x01, 0x08, 0x00, "3" }, - {0x10, 0x01, 0x08, 0x08, "4" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x10, 0x10, "Upright" }, - {0x10, 0x01, 0x10, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x10, 0x01, 0x40, 0x00, "Easy" }, - {0x10, 0x01, 0x40, 0x40, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Fuel" }, - {0x10, 0x01, 0x80, 0x00, "120 Units" }, - {0x10, 0x01, 0x80, 0x80, "90 Units" }, -}; - -STDDIPINFO(combh) - -UINT8 __fastcall bankp_in(UINT16 address) -{ - UINT8 ret = 0; - - switch (address & 0xff) - { - case 0x00: - { - for (INT32 i = 0; i < 8; i++) ret |= DrvJoy1[i] << i; - - // limit controls to 2-way - if ((ret & 0x05) == 0x05) ret &= 0xfa; - if ((ret & 0x0a) == 0x0a) ret &= 0xf5; - - return ret; - } - - case 0x01: - { - for (INT32 i = 0; i < 8; i++) ret |= DrvJoy2[i] << i; - - // limit controls to 2-way - if ((ret & 0x05) == 0x05) ret &= 0xfa; - if ((ret & 0x0a) == 0x0a) ret &= 0xf5; - - return ret; - } - - case 0x02: - { - for (INT32 i = 0; i < 8; i++) ret |= DrvJoy3[i] << i; - - return ret; - } - - case 0x04: - return DrvDips; - } - - return 0; -} - -void __fastcall bankp_out(UINT16 address, UINT8 data) -{ - switch (address & 0xff) - { - case 0x00: - SN76496Write(0, data); - break; - - case 0x01: - SN76496Write(1, data); - break; - - case 0x02: - SN76496Write(2, data); - break; - - case 0x05: - scroll_x = data; - break; - - case 0x07: - { - priority = data & 0x03; - - interrupt_enable = (data >> 4) & 1; - - flipscreen = data & 0x20; - } - break; - } -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (Mem + 0xe000, 0, 0x2000); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - scroll_x = 0, priority = 0, flipscreen = 0; - interrupt_enable = 0; - - return 0; -} - -static INT32 bankp_palette_init() -{ - INT32 i; - - UINT32 t_pal[32]; - UINT8 *color_prom = Prom; - - for (i = 0;i < 32;i++) - { - INT32 bit0,bit1,bit2,r,g,b; - - bit0 = (*color_prom >> 0) & 0x01; - bit1 = (*color_prom >> 1) & 0x01; - bit2 = (*color_prom >> 2) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (*color_prom >> 3) & 0x01; - bit1 = (*color_prom >> 4) & 0x01; - bit2 = (*color_prom >> 5) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = 0; - bit1 = (*color_prom >> 6) & 0x01; - bit2 = (*color_prom >> 7) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - t_pal[i] = (r << 16) | (g << 8) | b; - - color_prom++; - } - - for (i = 0;i < 32 * 4;i++) { - Palette[i] = t_pal[*color_prom & 0x0f]; - color_prom++; - } - - color_prom += 128; - - for (i = 0;i < 16 * 8;i++) { - Palette[i + 0x80] = t_pal[*color_prom & 0x0f]; - color_prom++; - } - - return 0; -} - -static INT32 bankp_gfx_decode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, Gfx0, 0x10000); - - static INT32 Char1PlaneOffsets[2] = { 0x00, 0x04 }; - static INT32 Char2PlaneOffsets[3] = { 0x00, 0x20000, 0x40000 }; - static INT32 Char1XOffsets[8] = { 0x43, 0x42, 0x41, 0x40, 0x03, 0x02, 0x01, 0x00 }; - static INT32 Char2XOffsets[8] = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }; - static INT32 CharYOffsets[8] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38 }; - - GfxDecode(0x400, 2, 8, 8, Char1PlaneOffsets, Char1XOffsets, CharYOffsets, 0x080, tmp, Gfx0); - - memcpy (tmp, Gfx1, 0x10000); - - GfxDecode(0x800, 3, 8, 8, Char2PlaneOffsets, Char2XOffsets, CharYOffsets, 0x040, tmp, Gfx1); - - for (INT32 i = 0; i < 0x20000; i++) { - Gfx1[i] |= 0x80; - } - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - Mem = (UINT8*)BurnMalloc(0x10000 + 0x10000 + 0x20000 + 0x200 + (0x100 * sizeof(INT32))); - if (Mem == NULL) { - return 1; - } - - Rom = Mem + 0x00000; - Gfx0 = Mem + 0x10000; - Gfx1 = Mem + 0x20000; - Prom = Mem + 0x40000; - Palette = (INT32*)(Mem + 0x40200); - - { - for (INT32 i = 0; i < 4; i++) - if (BurnLoadRom(Rom + i * 0x4000, i + 0, 1)) return 1; - - if (BurnLoadRom(Gfx0 + 0x0000, 4, 1)) return 1; - if (BurnLoadRom(Gfx0 + 0x2000, 5, 1)) return 1; - - for (INT32 i = 0; i < 6; i++) - if (BurnLoadRom(Gfx1 + i * 0x2000, i + 6, 1)) return 1; - - if (BurnLoadRom(Prom + 0x0000, 12, 1)) return 1; - if (BurnLoadRom(Prom + 0x0020, 13, 1)) return 1; - if (BurnLoadRom(Prom + 0x0120, 14, 1)) return 1; - - if (bankp_gfx_decode()) return 1; - bankp_palette_init(); - } - - ZetInit(0); - ZetOpen(0); - ZetSetInHandler(bankp_in); - ZetSetOutHandler(bankp_out); - ZetMapArea(0x0000, 0xdfff, 0, Rom + 0x0000); - ZetMapArea(0x0000, 0xdfff, 2, Rom + 0x0000); - ZetMapArea(0xe000, 0xefff, 0, Rom + 0xe000); - ZetMapArea(0xe000, 0xefff, 1, Rom + 0xe000); - ZetMapArea(0xe000, 0xefff, 2, Rom + 0xe000); - ZetMapArea(0xf000, 0xffff, 0, Rom + 0xf000); - ZetMapArea(0xf000, 0xffff, 1, Rom + 0xf000); - ZetMemEnd(); - ZetClose(); - - SN76489Init(0, 15468000 / 6, 0); - SN76489Init(1, 15468000 / 6, 1); - SN76489Init(2, 15468000 / 6, 1); - SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(2, 1.00, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - - SN76496Exit(); - - BurnFree (Mem); - - scroll_x = priority = flipscreen = interrupt_enable = 0; - - Rom = Gfx0 = Gfx1 = Prom = NULL; - Palette = NULL; - - return 0; -} - - -static void bankp_plot_pixel(INT32 x, INT32 y, INT32 color, UINT8 src, INT32 transp) -{ - if (x > 223 || x < 0 || y > 223 || y < 0) return; - - INT32 pxl = Palette[color | src]; - if (transp && !pxl) return; - - PutPix(pBurnDraw + (y * 224 + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); -} - - -static void draw_8x8_tiles(UINT8 *gfx_base, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 transp) -{ - UINT8 *src = gfx_base + (code << 6); - - if (flipy) - { - for (INT32 y = sy + 7; y >= sy; y--) - { - if (flipx) - { - for (INT32 x = sx + 7; x >= sx; x--, src++) { - bankp_plot_pixel(x, y, color, *src, transp); - } - } else { - for (INT32 x = sx; x < sx + 8; x++, src++) { - bankp_plot_pixel(x, y, color, *src, transp); - } - } - } - } else { - for (INT32 y = sy; y < sy + 8; y++) - { - if (flipx) - { - for (INT32 x = sx + 7; x >= sx; x--, src++) { - bankp_plot_pixel(x, y, color, *src, transp); - - } - } else { - for (INT32 x = sx; x < sx + 8; x++, src++) { - bankp_plot_pixel(x, y, color, *src, transp); - - } - } - } - } -} - -static void draw_bg_tiles(INT32 prio) -{ - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 code, color, flipx, sx, sy; - - code = Rom[0xf800 + offs] | ((Rom[0xfc00 + offs] & 7) << 8); - color = (Rom[0xfc00 + offs] >> 1) & 0x78; - flipx = Rom[0xfc00 + offs] & 0x08; - - if (flipscreen) { - sx = (~offs << 3) & 0xf8; - sy = (~offs >> 2) & 0xf8; - flipx ^= 0x08; - } else { - sx = ( offs << 3) & 0xf8; - sy = ( offs >> 2) & 0xf8; - } - - draw_8x8_tiles(Gfx1, code, color, sx - 24, sy - 16, flipx, flipscreen, prio); - } -} - -static void draw_fg_tiles(INT32 prio) -{ - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 code, color, flipx, sx, sy; - - code = Rom[0xf000 + offs] | ((Rom[0xf400 + offs] & 3) << 8); - color = (Rom[0xf400 + offs] >> 1) & 0x7c; - flipx = Rom[0xf400 + offs] & 0x04; - - if (flipscreen) { - sx = ((~offs << 3) - scroll_x) & 0xff; - sy = (~offs >> 2) & 0xf8; - flipx ^= 4; - } else { - sx = (( offs << 3) - scroll_x) & 0xff; - sy = ( offs >> 2) & 0xf8; - } - - draw_8x8_tiles(Gfx0, code, color, sx - 24, sy - 16, flipx, flipscreen, prio); - } -} - -static INT32 DrvDraw() -{ - if (priority & 0x02) - { - draw_fg_tiles(0); - draw_bg_tiles(1); - } else { - draw_bg_tiles(0); - draw_fg_tiles(1); - } - - return 0; -} - - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetOpen(0); - ZetRun(2578000 / 60); - if (interrupt_enable) ZetNmi(); - ZetClose(); - - SN76496Update(0, pBurnSoundOut, nBurnSoundLen); - SN76496Update(1, pBurnSoundOut, nBurnSoundLen); - SN76496Update(2, pBurnSoundOut, nBurnSoundLen); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = Rom + 0xe000; - ba.nLen = 0x2000; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - SN76496Scan(nAction, pnMin); - - SCAN_VAR(scroll_x); - SCAN_VAR(priority); - SCAN_VAR(flipscreen); - SCAN_VAR(interrupt_enable); - } - - return 0; -} - -// Bank Panic - -static struct BurnRomInfo bankpRomDesc[] = { - { "epr-6175.7e", 0x4000, 0x044552b8, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "epr-6174.7f", 0x4000, 0xd29b1598, 1 | BRF_ESS | BRF_PRG }, // 1 - { "epr-6173.7h", 0x4000, 0xb8405d38, 1 | BRF_ESS | BRF_PRG }, // 2 - { "epr-6176.7d", 0x2000, 0xc98ac200, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "epr-6165.5l", 0x2000, 0xaef34a93, 2 | BRF_GRA }, // 4 Playfield #1 chars - { "epr-6166.5k", 0x2000, 0xca13cb11, 2 | BRF_GRA }, // 5 - - { "epr-6172.5b", 0x2000, 0xc4c4878b, 3 | BRF_GRA }, // 6 Playfield #2 chars - { "epr-6171.5d", 0x2000, 0xa18165a1, 3 | BRF_GRA }, // 7 - { "epr-6170.5e", 0x2000, 0xb58aa8fa, 3 | BRF_GRA }, // 8 - { "epr-6169.5f", 0x2000, 0x1aa37fce, 3 | BRF_GRA }, // 9 - { "epr-6168.5h", 0x2000, 0x05f3a867, 3 | BRF_GRA }, // 10 - { "epr-6167.5i", 0x2000, 0x3fa337e1, 3 | BRF_GRA }, // 11 - - { "pr-6177.8a", 0x0020, 0xeb70c5ae, 4 | BRF_GRA }, // 12 (UINT32*)Palette - { "pr-6178.6f", 0x0100, 0x0acca001, 4 | BRF_GRA }, // 13 Charset #1 lut - { "pr-6179.5a", 0x0100, 0xe53bafdb, 4 | BRF_GRA }, // 14 Charset #2 lut - - { "315-5074.2c.bin", 0x025b, 0x2e57bbba, 0 | BRF_OPT }, // 15 - { "315-5073.pal16l4", 0x0001, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 16 read protected -}; - -STD_ROM_PICK(bankp) -STD_ROM_FN(bankp) - -struct BurnDriver BurnDrvbankp = { - "bankp", NULL, NULL, NULL, "1984", - "Bank Panic\0", NULL, "[Sanritsu] Sega", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 3, HARDWARE_SEGA_MISC, GBF_MISC, 0, - NULL, bankpRomInfo, bankpRomName, NULL, NULL, bankpInputInfo, bankpDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x100, - 224, 224, 4, 3 -}; - -// Combat Hawk - -static struct BurnRomInfo combhRomDesc[] = { - { "epr-10904.7e", 0x4000, 0x4b106335, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "epr-10905.7f", 0x4000, 0xa76fc390, 1 | BRF_ESS | BRF_PRG }, // 1 - { "epr-10906.7h", 0x4000, 0x16d54885, 1 | BRF_ESS | BRF_PRG }, // 2 - { "epr-10903.7d", 0x2000, 0xb7a59cab, 1 | BRF_ESS | BRF_PRG }, // 3 - - { "epr-10914.5l", 0x2000, 0x7d7a2340, 2 | BRF_GRA }, // 4 Playfield #1 chars - { "epr-10913.5k", 0x2000, 0xd5c1a8ae, 2 | BRF_GRA }, // 5 - - { "epr-10907.5b", 0x2000, 0x08e5eea3, 3 | BRF_GRA }, // 6 Playfield #2 chars - { "epr-10908.5d", 0x2000, 0xd9e413f5, 3 | BRF_GRA }, // 7 - { "epr-10909.5e", 0x2000, 0xfec7962c, 3 | BRF_GRA }, // 8 - { "epr-10910.5f", 0x2000, 0x33db0fa7, 3 | BRF_GRA }, // 9 - { "epr-10911.5h", 0x2000, 0x565d9e6d, 3 | BRF_GRA }, // 10 - { "epr-10912.5i", 0x2000, 0xcbe22738, 3 | BRF_GRA }, // 11 - - { "pr-10900.8a", 0x0020, 0xf95fcd66, 4 | BRF_GRA }, // 12 (UINT32*)Palette - { "pr-10901.6f", 0x0100, 0x6fd981c8, 4 | BRF_GRA }, // 13 Charset #1 lut - { "pr-10902.5a", 0x0100, 0x84d6bded, 4 | BRF_GRA }, // 14 Charset #2 lut - - { "315-5074.2c.bin", 0x025b, 0x2e57bbba, 0 | BRF_OPT }, // 15 - { "315-5073.pal16l4", 0x0001, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 16 read protected -}; - -STD_ROM_PICK(combh) -STD_ROM_FN(combh) - -struct BurnDriver BurnDrvcombh = { - "combh", NULL, NULL, NULL, "1987", - "Combat Hawk\0", NULL, "Sega / Sanritsu", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 3, HARDWARE_SEGA_MISC, GBF_MISC, 0, - NULL, combhRomInfo, combhRomName, NULL, NULL, combhInputInfo, combhDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x100, - 224, 224, 3, 4 -}; - +// FB Alpha Bank Panic Driver Module +// Based on MAME driver by Nicola Salmoria + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "sn76496.h" + +static UINT8 *Mem, *Rom, *Gfx0, *Gfx1, *Prom; +static UINT8 DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvReset, DrvDips; +static INT32 *Palette; + +static UINT8 scroll_x, priority, flipscreen, interrupt_enable; + +static struct BurnInputInfo bankpInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 5, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 6, "p2 coin" }, + {"Coin 3" , BIT_DIGITAL , DrvJoy3 + 2, "p3 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy2 + 5, "p1 start" }, + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 6, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 7, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 3"}, + + {"P2 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 7, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 1, "p2 fire 3"}, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, &DrvDips, "dip" }, +}; + +STDINPUTINFO(bankp) + +static struct BurnInputInfo combhInputList[] = { + {"Coin 1" , BIT_DIGITAL , DrvJoy1 + 5, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , DrvJoy1 + 6, "p2 coin" }, + {"Coin 3" , BIT_DIGITAL , DrvJoy3 + 2, "p3 coin" }, + {"P1 Start" , BIT_DIGITAL , DrvJoy2 + 5, "p1 start" }, + {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 6, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 2, "p1 down" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 7, "p1 fire 2"}, + {"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 3"}, + + {"P2 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p2 down" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 7, "p2 fire 2"}, + {"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 1, "p2 fire 3"}, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, &DrvDips, "dip" }, + +}; + +STDINPUTINFO(combh) + +static struct BurnDIPInfo bankpDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0xc0, NULL }, + + {0 , 0xfe, 0 , 4 , "Coin A/B" }, + {0x10, 0x01, 0x03, 0x03, "3C 1C" }, + {0x10, 0x01, 0x03, 0x02, "2C 1C" }, + {0x10, 0x01, 0x03, 0x00, "1C 1C" }, + {0x10, 0x01, 0x03, 0x01, "1C 2C" }, + + {0 , 0xfe, 0 , 2 , "Coin C" }, + {0x10, 0x01, 0x04, 0x04, "2C 1C" }, + {0x10, 0x01, 0x04, 0x00, "1C 1C" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x10, 0x01, 0x08, 0x00, "3" }, + {0x10, 0x01, 0x08, 0x08, "4" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x10, 0x00, "70K 200K 500K..." }, + {0x10, 0x01, 0x10, 0x10, "100K 400K 800K..." }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x10, 0x01, 0x20, 0x00, "Easy" }, + {0x10, 0x01, 0x20, 0x20, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x10, 0x01, 0x40, 0x00, "Off" }, + {0x10, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x80, 0x80, "Upright" }, + {0x10, 0x01, 0x80, 0x00, "Cocktail" }, +}; + +STDDIPINFO(bankp) + +static struct BurnDIPInfo combhDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0x10, NULL }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x10, 0x01, 0x01, 0x00, "Off" }, + {0x10, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x10, 0x01, 0x06, 0x06, "2C 1C" }, + {0x10, 0x01, 0x06, 0x00, "1C 1C" }, + {0x10, 0x01, 0x06, 0x02, "1C 2C" }, + {0x10, 0x01, 0x06, 0x04, "1C 3C" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x10, 0x01, 0x08, 0x00, "3" }, + {0x10, 0x01, 0x08, 0x08, "4" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x10, 0x10, "Upright" }, + {0x10, 0x01, 0x10, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x10, 0x01, 0x40, 0x00, "Easy" }, + {0x10, 0x01, 0x40, 0x40, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Fuel" }, + {0x10, 0x01, 0x80, 0x00, "120 Units" }, + {0x10, 0x01, 0x80, 0x80, "90 Units" }, +}; + +STDDIPINFO(combh) + +UINT8 __fastcall bankp_in(UINT16 address) +{ + UINT8 ret = 0; + + switch (address & 0xff) + { + case 0x00: + { + for (INT32 i = 0; i < 8; i++) ret |= DrvJoy1[i] << i; + + // limit controls to 2-way + if ((ret & 0x05) == 0x05) ret &= 0xfa; + if ((ret & 0x0a) == 0x0a) ret &= 0xf5; + + return ret; + } + + case 0x01: + { + for (INT32 i = 0; i < 8; i++) ret |= DrvJoy2[i] << i; + + // limit controls to 2-way + if ((ret & 0x05) == 0x05) ret &= 0xfa; + if ((ret & 0x0a) == 0x0a) ret &= 0xf5; + + return ret; + } + + case 0x02: + { + for (INT32 i = 0; i < 8; i++) ret |= DrvJoy3[i] << i; + + return ret; + } + + case 0x04: + return DrvDips; + } + + return 0; +} + +void __fastcall bankp_out(UINT16 address, UINT8 data) +{ + switch (address & 0xff) + { + case 0x00: + SN76496Write(0, data); + break; + + case 0x01: + SN76496Write(1, data); + break; + + case 0x02: + SN76496Write(2, data); + break; + + case 0x05: + scroll_x = data; + break; + + case 0x07: + { + priority = data & 0x03; + + interrupt_enable = (data >> 4) & 1; + + flipscreen = data & 0x20; + } + break; + } +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (Mem + 0xe000, 0, 0x2000); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + scroll_x = 0, priority = 0, flipscreen = 0; + interrupt_enable = 0; + + return 0; +} + +static INT32 bankp_palette_init() +{ + INT32 i; + + UINT32 t_pal[32]; + UINT8 *color_prom = Prom; + + for (i = 0;i < 32;i++) + { + INT32 bit0,bit1,bit2,r,g,b; + + bit0 = (*color_prom >> 0) & 0x01; + bit1 = (*color_prom >> 1) & 0x01; + bit2 = (*color_prom >> 2) & 0x01; + r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (*color_prom >> 3) & 0x01; + bit1 = (*color_prom >> 4) & 0x01; + bit2 = (*color_prom >> 5) & 0x01; + g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = 0; + bit1 = (*color_prom >> 6) & 0x01; + bit2 = (*color_prom >> 7) & 0x01; + b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + t_pal[i] = (r << 16) | (g << 8) | b; + + color_prom++; + } + + for (i = 0;i < 32 * 4;i++) { + Palette[i] = t_pal[*color_prom & 0x0f]; + color_prom++; + } + + color_prom += 128; + + for (i = 0;i < 16 * 8;i++) { + Palette[i + 0x80] = t_pal[*color_prom & 0x0f]; + color_prom++; + } + + return 0; +} + +static INT32 bankp_gfx_decode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, Gfx0, 0x10000); + + static INT32 Char1PlaneOffsets[2] = { 0x00, 0x04 }; + static INT32 Char2PlaneOffsets[3] = { 0x00, 0x20000, 0x40000 }; + static INT32 Char1XOffsets[8] = { 0x43, 0x42, 0x41, 0x40, 0x03, 0x02, 0x01, 0x00 }; + static INT32 Char2XOffsets[8] = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }; + static INT32 CharYOffsets[8] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38 }; + + GfxDecode(0x400, 2, 8, 8, Char1PlaneOffsets, Char1XOffsets, CharYOffsets, 0x080, tmp, Gfx0); + + memcpy (tmp, Gfx1, 0x10000); + + GfxDecode(0x800, 3, 8, 8, Char2PlaneOffsets, Char2XOffsets, CharYOffsets, 0x040, tmp, Gfx1); + + for (INT32 i = 0; i < 0x20000; i++) { + Gfx1[i] |= 0x80; + } + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + Mem = (UINT8*)BurnMalloc(0x10000 + 0x10000 + 0x20000 + 0x200 + (0x100 * sizeof(INT32))); + if (Mem == NULL) { + return 1; + } + + Rom = Mem + 0x00000; + Gfx0 = Mem + 0x10000; + Gfx1 = Mem + 0x20000; + Prom = Mem + 0x40000; + Palette = (INT32*)(Mem + 0x40200); + + { + for (INT32 i = 0; i < 4; i++) + if (BurnLoadRom(Rom + i * 0x4000, i + 0, 1)) return 1; + + if (BurnLoadRom(Gfx0 + 0x0000, 4, 1)) return 1; + if (BurnLoadRom(Gfx0 + 0x2000, 5, 1)) return 1; + + for (INT32 i = 0; i < 6; i++) + if (BurnLoadRom(Gfx1 + i * 0x2000, i + 6, 1)) return 1; + + if (BurnLoadRom(Prom + 0x0000, 12, 1)) return 1; + if (BurnLoadRom(Prom + 0x0020, 13, 1)) return 1; + if (BurnLoadRom(Prom + 0x0120, 14, 1)) return 1; + + if (bankp_gfx_decode()) return 1; + bankp_palette_init(); + } + + ZetInit(0); + ZetOpen(0); + ZetSetInHandler(bankp_in); + ZetSetOutHandler(bankp_out); + ZetMapArea(0x0000, 0xdfff, 0, Rom + 0x0000); + ZetMapArea(0x0000, 0xdfff, 2, Rom + 0x0000); + ZetMapArea(0xe000, 0xefff, 0, Rom + 0xe000); + ZetMapArea(0xe000, 0xefff, 1, Rom + 0xe000); + ZetMapArea(0xe000, 0xefff, 2, Rom + 0xe000); + ZetMapArea(0xf000, 0xffff, 0, Rom + 0xf000); + ZetMapArea(0xf000, 0xffff, 1, Rom + 0xf000); + ZetClose(); + + SN76489Init(0, 15468000 / 6, 0); + SN76489Init(1, 15468000 / 6, 1); + SN76489Init(2, 15468000 / 6, 1); + SN76496SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(2, 1.00, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + + SN76496Exit(); + + BurnFree (Mem); + + scroll_x = priority = flipscreen = interrupt_enable = 0; + + Rom = Gfx0 = Gfx1 = Prom = NULL; + Palette = NULL; + + return 0; +} + + +static void bankp_plot_pixel(INT32 x, INT32 y, INT32 color, UINT8 src, INT32 transp) +{ + if (x > 223 || x < 0 || y > 223 || y < 0) return; + + INT32 pxl = Palette[color | src]; + if (transp && !pxl) return; + + PutPix(pBurnDraw + (y * 224 + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0)); +} + + +static void draw_8x8_tiles(UINT8 *gfx_base, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 transp) +{ + UINT8 *src = gfx_base + (code << 6); + + if (flipy) + { + for (INT32 y = sy + 7; y >= sy; y--) + { + if (flipx) + { + for (INT32 x = sx + 7; x >= sx; x--, src++) { + bankp_plot_pixel(x, y, color, *src, transp); + } + } else { + for (INT32 x = sx; x < sx + 8; x++, src++) { + bankp_plot_pixel(x, y, color, *src, transp); + } + } + } + } else { + for (INT32 y = sy; y < sy + 8; y++) + { + if (flipx) + { + for (INT32 x = sx + 7; x >= sx; x--, src++) { + bankp_plot_pixel(x, y, color, *src, transp); + + } + } else { + for (INT32 x = sx; x < sx + 8; x++, src++) { + bankp_plot_pixel(x, y, color, *src, transp); + + } + } + } + } +} + +static void draw_bg_tiles(INT32 prio) +{ + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 code, color, flipx, sx, sy; + + code = Rom[0xf800 + offs] | ((Rom[0xfc00 + offs] & 7) << 8); + color = (Rom[0xfc00 + offs] >> 1) & 0x78; + flipx = Rom[0xfc00 + offs] & 0x08; + + if (flipscreen) { + sx = (~offs << 3) & 0xf8; + sy = (~offs >> 2) & 0xf8; + flipx ^= 0x08; + } else { + sx = ( offs << 3) & 0xf8; + sy = ( offs >> 2) & 0xf8; + } + + draw_8x8_tiles(Gfx1, code, color, sx - 24, sy - 16, flipx, flipscreen, prio); + } +} + +static void draw_fg_tiles(INT32 prio) +{ + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 code, color, flipx, sx, sy; + + code = Rom[0xf000 + offs] | ((Rom[0xf400 + offs] & 3) << 8); + color = (Rom[0xf400 + offs] >> 1) & 0x7c; + flipx = Rom[0xf400 + offs] & 0x04; + + if (flipscreen) { + sx = ((~offs << 3) - scroll_x) & 0xff; + sy = (~offs >> 2) & 0xf8; + flipx ^= 4; + } else { + sx = (( offs << 3) - scroll_x) & 0xff; + sy = ( offs >> 2) & 0xf8; + } + + draw_8x8_tiles(Gfx0, code, color, sx - 24, sy - 16, flipx, flipscreen, prio); + } +} + +static INT32 DrvDraw() +{ + if (priority & 0x02) + { + draw_fg_tiles(0); + draw_bg_tiles(1); + } else { + draw_bg_tiles(0); + draw_fg_tiles(1); + } + + return 0; +} + + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetOpen(0); + ZetRun(2578000 / 60); + if (interrupt_enable) ZetNmi(); + ZetClose(); + + SN76496Update(0, pBurnSoundOut, nBurnSoundLen); + SN76496Update(1, pBurnSoundOut, nBurnSoundLen); + SN76496Update(2, pBurnSoundOut, nBurnSoundLen); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = Rom + 0xe000; + ba.nLen = 0x2000; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + SN76496Scan(nAction, pnMin); + + SCAN_VAR(scroll_x); + SCAN_VAR(priority); + SCAN_VAR(flipscreen); + SCAN_VAR(interrupt_enable); + } + + return 0; +} + +// Bank Panic + +static struct BurnRomInfo bankpRomDesc[] = { + { "epr-6175.7e", 0x4000, 0x044552b8, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "epr-6174.7f", 0x4000, 0xd29b1598, 1 | BRF_ESS | BRF_PRG }, // 1 + { "epr-6173.7h", 0x4000, 0xb8405d38, 1 | BRF_ESS | BRF_PRG }, // 2 + { "epr-6176.7d", 0x2000, 0xc98ac200, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "epr-6165.5l", 0x2000, 0xaef34a93, 2 | BRF_GRA }, // 4 Playfield #1 chars + { "epr-6166.5k", 0x2000, 0xca13cb11, 2 | BRF_GRA }, // 5 + + { "epr-6172.5b", 0x2000, 0xc4c4878b, 3 | BRF_GRA }, // 6 Playfield #2 chars + { "epr-6171.5d", 0x2000, 0xa18165a1, 3 | BRF_GRA }, // 7 + { "epr-6170.5e", 0x2000, 0xb58aa8fa, 3 | BRF_GRA }, // 8 + { "epr-6169.5f", 0x2000, 0x1aa37fce, 3 | BRF_GRA }, // 9 + { "epr-6168.5h", 0x2000, 0x05f3a867, 3 | BRF_GRA }, // 10 + { "epr-6167.5i", 0x2000, 0x3fa337e1, 3 | BRF_GRA }, // 11 + + { "pr-6177.8a", 0x0020, 0xeb70c5ae, 4 | BRF_GRA }, // 12 (UINT32*)Palette + { "pr-6178.6f", 0x0100, 0x0acca001, 4 | BRF_GRA }, // 13 Charset #1 lut + { "pr-6179.5a", 0x0100, 0xe53bafdb, 4 | BRF_GRA }, // 14 Charset #2 lut + + { "315-5074.2c.bin", 0x025b, 0x2e57bbba, 0 | BRF_OPT }, // 15 + { "315-5073.pal16l4", 0x0001, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 16 read protected +}; + +STD_ROM_PICK(bankp) +STD_ROM_FN(bankp) + +struct BurnDriver BurnDrvbankp = { + "bankp", NULL, NULL, NULL, "1984", + "Bank Panic\0", NULL, "[Sanritsu] Sega", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 3, HARDWARE_SEGA_MISC, GBF_MISC, 0, + NULL, bankpRomInfo, bankpRomName, NULL, NULL, bankpInputInfo, bankpDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x100, + 224, 224, 4, 3 +}; + +// Combat Hawk + +static struct BurnRomInfo combhRomDesc[] = { + { "epr-10904.7e", 0x4000, 0x4b106335, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "epr-10905.7f", 0x4000, 0xa76fc390, 1 | BRF_ESS | BRF_PRG }, // 1 + { "epr-10906.7h", 0x4000, 0x16d54885, 1 | BRF_ESS | BRF_PRG }, // 2 + { "epr-10903.7d", 0x2000, 0xb7a59cab, 1 | BRF_ESS | BRF_PRG }, // 3 + + { "epr-10914.5l", 0x2000, 0x7d7a2340, 2 | BRF_GRA }, // 4 Playfield #1 chars + { "epr-10913.5k", 0x2000, 0xd5c1a8ae, 2 | BRF_GRA }, // 5 + + { "epr-10907.5b", 0x2000, 0x08e5eea3, 3 | BRF_GRA }, // 6 Playfield #2 chars + { "epr-10908.5d", 0x2000, 0xd9e413f5, 3 | BRF_GRA }, // 7 + { "epr-10909.5e", 0x2000, 0xfec7962c, 3 | BRF_GRA }, // 8 + { "epr-10910.5f", 0x2000, 0x33db0fa7, 3 | BRF_GRA }, // 9 + { "epr-10911.5h", 0x2000, 0x565d9e6d, 3 | BRF_GRA }, // 10 + { "epr-10912.5i", 0x2000, 0xcbe22738, 3 | BRF_GRA }, // 11 + + { "pr-10900.8a", 0x0020, 0xf95fcd66, 4 | BRF_GRA }, // 12 (UINT32*)Palette + { "pr-10901.6f", 0x0100, 0x6fd981c8, 4 | BRF_GRA }, // 13 Charset #1 lut + { "pr-10902.5a", 0x0100, 0x84d6bded, 4 | BRF_GRA }, // 14 Charset #2 lut + + { "315-5074.2c.bin", 0x025b, 0x2e57bbba, 0 | BRF_OPT }, // 15 + { "315-5073.pal16l4", 0x0001, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 16 read protected +}; + +STD_ROM_PICK(combh) +STD_ROM_FN(combh) + +struct BurnDriver BurnDrvcombh = { + "combh", NULL, NULL, NULL, "1987", + "Combat Hawk\0", NULL, "Sega / Sanritsu", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 3, HARDWARE_SEGA_MISC, GBF_MISC, 0, + NULL, combhRomInfo, combhRomName, NULL, NULL, combhInputInfo, combhDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x100, + 224, 224, 3, 4 +}; + diff --git a/src/burn/drv/sega/d_dotrikun.cpp b/src/burn/drv/sega/d_dotrikun.cpp index 28a70c3de..8131c127f 100644 --- a/src/burn/drv/sega/d_dotrikun.cpp +++ b/src/burn/drv/sega/d_dotrikun.cpp @@ -1,250 +1,249 @@ -// FB Alpha Dottori Kun driver module -// Based on MAME driver by Takahiro Nogi - -#include "tiles_generic.h" -#include "z80_intf.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvReset; -static UINT8 DrvInputs[1]; - -static UINT8 *nColor; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down", }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 start", BIT_DIGITAL, DrvJoy1 + 6, "p1 start" }, - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, -}; - -STDINPUTINFO(Drv) - -UINT8 __fastcall dotrikun_in_port(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return DrvInputs[0]; - } - - return 0; -} - -void __fastcall dotrikun_out_port(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - *nColor = data; - return; - } -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x010000; - - DrvPalette = (UINT32*)Next; Next += 0x000002 * sizeof (UINT32); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x000800; - - nColor = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM, 0, 1)) return 1; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea (0x0000, 0x3fff, 0, DrvZ80ROM); - ZetMapArea (0x0000, 0x3fff, 2, DrvZ80ROM); - ZetMapArea (0x8000, 0x87ff, 0, DrvZ80RAM); - ZetMapArea (0x8000, 0x87ff, 1, DrvZ80RAM); - ZetMapArea (0x8000, 0x87ff, 2, DrvZ80RAM); - ZetSetOutHandler(dotrikun_out_port); - ZetSetInHandler(dotrikun_in_port); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvPalette[0] = BurnHighCol((*nColor & 0x08) ? 0xff : 0, (*nColor & 0x10) ? 0xff : 0, (*nColor & 0x20) ? 0xff : 0, 0); - DrvPalette[1] = BurnHighCol((*nColor & 0x01) ? 0xff : 0, (*nColor & 0x02) ? 0xff : 0, (*nColor & 0x04) ? 0xff : 0, 0); - } - - for (INT32 offs = 0; offs < 0x0600; offs++) - { - INT32 sx = (offs & 0x0f) << 4; - INT32 sy = (offs >> 4) << 1; - INT32 px = DrvZ80RAM[offs]; - - for (INT32 i = 0; i < 8; i++, sx+=2) - { - INT32 pen = (px >> (7 - i)) & 1; - - if (sx > nScreenWidth || sy >= nScreenHeight) continue; - - pTransDraw[((sy + 0) << 8) | (sx + 0)] = pen; - pTransDraw[((sy + 0) << 8) | (sx + 1)] = pen; - pTransDraw[((sy + 1) << 8) | (sx + 0)] = pen; - pTransDraw[((sy + 1) << 8) | (sx + 1)] = pen; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = 0xff; - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - } - } - - ZetOpen(0); - ZetRun(4000000 / 60); - ZetRaiseIrq(0); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - } - - return 0; -} - - -// Dottori Kun (new version) - -static struct BurnRomInfo dotrikunRomDesc[] = { - { "14479a.mpr", 0x4000, 0xb77a50db, BRF_ESS | BRF_PRG }, // Z80 code -}; - -STD_ROM_PICK(dotrikun) -STD_ROM_FN(dotrikun) - -struct BurnDriver BurnDrvdotrikun = { - "dotrikun", NULL, NULL, NULL, "1990", - "Dottori Kun (new version)\0", NULL, "Sega", "Test Hardware", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 1, HARDWARE_SEGA_MISC, GBF_MAZE, 0, - NULL, dotrikunRomInfo, dotrikunRomName, NULL, NULL, DrvInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x02, - 256, 192, 4, 3 -}; - - -// Dottori Kun (old version) - -static struct BurnRomInfo dotriku2RomDesc[] = { - { "14479.mpr", 0x4000, 0xa6aa7fa5, BRF_ESS | BRF_PRG }, // Z80 code -}; - -STD_ROM_PICK(dotriku2) -STD_ROM_FN(dotriku2) - -struct BurnDriver BurnDrvdotriku2 = { - "dotrikun2", "dotrikun", NULL, NULL, "1990", - "Dottori Kun (old version)\0", NULL, "Sega", "Test Hardware", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 1, HARDWARE_SEGA_MISC, GBF_MAZE, 0, - NULL, dotriku2RomInfo, dotriku2RomName, NULL, NULL, DrvInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x02, - 256, 192, 4, 3 -}; +// FB Alpha Dottori Kun driver module +// Based on MAME driver by Takahiro Nogi + +#include "tiles_generic.h" +#include "z80_intf.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvReset; +static UINT8 DrvInputs[1]; + +static UINT8 *nColor; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down", }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 start", BIT_DIGITAL, DrvJoy1 + 6, "p1 start" }, + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 7, "p1 coin" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, +}; + +STDINPUTINFO(Drv) + +UINT8 __fastcall dotrikun_in_port(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return DrvInputs[0]; + } + + return 0; +} + +void __fastcall dotrikun_out_port(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + *nColor = data; + return; + } +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x010000; + + DrvPalette = (UINT32*)Next; Next += 0x000002 * sizeof (UINT32); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x000800; + + nColor = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM, 0, 1)) return 1; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea (0x0000, 0x3fff, 0, DrvZ80ROM); + ZetMapArea (0x0000, 0x3fff, 2, DrvZ80ROM); + ZetMapArea (0x8000, 0x87ff, 0, DrvZ80RAM); + ZetMapArea (0x8000, 0x87ff, 1, DrvZ80RAM); + ZetMapArea (0x8000, 0x87ff, 2, DrvZ80RAM); + ZetSetOutHandler(dotrikun_out_port); + ZetSetInHandler(dotrikun_in_port); + ZetClose(); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvPalette[0] = BurnHighCol((*nColor & 0x08) ? 0xff : 0, (*nColor & 0x10) ? 0xff : 0, (*nColor & 0x20) ? 0xff : 0, 0); + DrvPalette[1] = BurnHighCol((*nColor & 0x01) ? 0xff : 0, (*nColor & 0x02) ? 0xff : 0, (*nColor & 0x04) ? 0xff : 0, 0); + } + + for (INT32 offs = 0; offs < 0x0600; offs++) + { + INT32 sx = (offs & 0x0f) << 4; + INT32 sy = (offs >> 4) << 1; + INT32 px = DrvZ80RAM[offs]; + + for (INT32 i = 0; i < 8; i++, sx+=2) + { + INT32 pen = (px >> (7 - i)) & 1; + + if (sx > nScreenWidth || sy >= nScreenHeight) continue; + + pTransDraw[((sy + 0) << 8) | (sx + 0)] = pen; + pTransDraw[((sy + 0) << 8) | (sx + 1)] = pen; + pTransDraw[((sy + 1) << 8) | (sx + 0)] = pen; + pTransDraw[((sy + 1) << 8) | (sx + 1)] = pen; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = 0xff; + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + } + } + + ZetOpen(0); + ZetRun(4000000 / 60); + ZetRaiseIrq(0); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + } + + return 0; +} + + +// Dottori Kun (new version) + +static struct BurnRomInfo dotrikunRomDesc[] = { + { "14479a.mpr", 0x4000, 0xb77a50db, BRF_ESS | BRF_PRG }, // Z80 code +}; + +STD_ROM_PICK(dotrikun) +STD_ROM_FN(dotrikun) + +struct BurnDriver BurnDrvdotrikun = { + "dotrikun", NULL, NULL, NULL, "1990", + "Dottori Kun (new version)\0", NULL, "Sega", "Test Hardware", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 1, HARDWARE_SEGA_MISC, GBF_MAZE, 0, + NULL, dotrikunRomInfo, dotrikunRomName, NULL, NULL, DrvInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x02, + 256, 192, 4, 3 +}; + + +// Dottori Kun (old version) + +static struct BurnRomInfo dotriku2RomDesc[] = { + { "14479.mpr", 0x4000, 0xa6aa7fa5, BRF_ESS | BRF_PRG }, // Z80 code +}; + +STD_ROM_PICK(dotriku2) +STD_ROM_FN(dotriku2) + +struct BurnDriver BurnDrvdotriku2 = { + "dotrikun2", "dotrikun", NULL, NULL, "1990", + "Dottori Kun (old version)\0", NULL, "Sega", "Test Hardware", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 1, HARDWARE_SEGA_MISC, GBF_MAZE, 0, + NULL, dotriku2RomInfo, dotriku2RomName, NULL, NULL, DrvInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x02, + 256, 192, 4, 3 +}; diff --git a/src/burn/drv/sega/d_suprloco.cpp b/src/burn/drv/sega/d_suprloco.cpp index 73ff55c78..4801a1067 100644 --- a/src/burn/drv/sega/d_suprloco.cpp +++ b/src/burn/drv/sega/d_suprloco.cpp @@ -415,7 +415,6 @@ static INT32 DrvInit() ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM0); ZetSetWriteHandler(suprloco_main_write); ZetSetReadHandler(suprloco_main_read); - ZetMemEnd(); ZetClose(); ZetInit(1); @@ -427,7 +426,6 @@ static INT32 DrvInit() ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); ZetSetWriteHandler(suprloco_sound_write); ZetSetReadHandler(suprloco_sound_read); - ZetMemEnd(); ZetClose(); SN76496Init(0, 4000000, 0); diff --git a/src/burn/drv/sega/d_sys1.cpp b/src/burn/drv/sega/d_sys1.cpp index e1b850a20..5df6c3711 100644 --- a/src/burn/drv/sega/d_sys1.cpp +++ b/src/burn/drv/sega/d_sys1.cpp @@ -1,5611 +1,5609 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "sn76496.h" -#include "bitswap.h" -#include "mc8123.h" - -static UINT8 System1InputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 System1InputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 System1InputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 System1Dip[2] = {0, 0}; -static UINT8 System1Input[3] = {0x00, 0x00, 0x00 }; -static UINT8 System1Reset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *System1Rom1 = NULL; -static UINT8 *System1Rom2 = NULL; -static UINT8 *System1PromRed = NULL; -static UINT8 *System1PromGreen = NULL; -static UINT8 *System1PromBlue = NULL; -static UINT8 *System1Ram1 = NULL; -static UINT8 *System1Ram2 = NULL; -static UINT8 *System1SpriteRam = NULL; -static UINT8 *System1PaletteRam = NULL; -static UINT8 *System1BgRam = NULL; -static UINT8 *System1VideoRam = NULL; -static UINT8 *System1BgCollisionRam = NULL; -static UINT8 *System1SprCollisionRam = NULL; -static UINT8 *System1deRam = NULL; -static UINT8 *System1efRam = NULL; -static UINT8 *System1f4Ram = NULL; -static UINT8 *System1fcRam = NULL; -static UINT32 *System1Palette = NULL; -static UINT8 *System1Tiles = NULL; -static UINT8 *System1Sprites = NULL; -static UINT8 *System1TempRom = NULL; -static UINT8 *SpriteOnScreenMap = NULL; -static UINT8 *System1Fetch1 = NULL; -static UINT8 *System1MC8123Key = NULL; -static UINT32 *System1TilesPenUsage = NULL; - -static UINT8 System1ScrollX[2]; -static UINT8 System1ScrollY; -static INT32 System1BgScrollX; -static INT32 System1BgScrollY; -static INT32 System1VideoMode; -static INT32 System1FlipScreen; -static INT32 System1SoundLatch; -static INT32 System1RomBank; -static INT32 NoboranbInp16Step; -static INT32 NoboranbInp17Step; -static INT32 NoboranbInp23Step; -static UINT8 BlockgalDial1; -static UINT8 BlockgalDial2; - -static INT32 System1SpriteRomSize; -static INT32 System1NumTiles; -static INT32 System1SpriteXOffset; -static INT32 System1ColourProms = 0; -static INT32 System1BankedRom = 0; - -typedef void (*Decode)(); -static Decode DecodeFunction; -static Decode TileDecodeFunction; - -typedef void (*Render)(); -static Render System1Draw; -static void System1Render(); -//static void WbmlRender(); - -typedef void (*MakeInputs)(); -static MakeInputs MakeInputsFunction; - -static INT32 nCyclesDone[2], nCyclesTotal[2]; -static INT32 nCyclesSegment; - -/*============================================================================================== -Input Definitions -===============================================================================================*/ - -static struct BurnInputInfo BlockgalInputList[] = { - {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System1InputPort2 + 6, "p1 fire 1" }, - - {"P2 Left" , BIT_DIGITAL , System1InputPort0 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System1InputPort0 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System1InputPort2 + 7, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, - {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, - {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Blockgal) - -static struct BurnInputInfo FlickyInputList[] = { - {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 1" }, - - {"P2 Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, - {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, - {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, - {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Flicky) - -static struct BurnInputInfo MyheroInputList[] = { - {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System1InputPort0 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System1InputPort0 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System1InputPort0 + 1, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , System1InputPort1 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System1InputPort1 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System1InputPort1 + 1, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, - {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, - {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, - {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Myhero) - -static struct BurnInputInfo SeganinjInputList[] = { - {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System1InputPort0 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System1InputPort0 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System1InputPort0 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System1InputPort0 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , System1InputPort1 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System1InputPort1 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System1InputPort1 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System1InputPort1 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, - {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, - {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, - {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Seganinj) - -static struct BurnInputInfo UpndownInputList[] = { - {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System1InputPort0 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System1InputPort0 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 1" }, - - {"P2 Up" , BIT_DIGITAL , System1InputPort1 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System1InputPort1 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, - {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, - {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, - {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Upndown) - -static struct BurnInputInfo WboyInputList[] = { - {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System1InputPort0 + 1, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 2" }, - - {"P2 Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System1InputPort1 + 1, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, - {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, - {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, - {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Wboy) - -static struct BurnInputInfo WmatchInputList[] = { - {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, - - {"P1 Left Up" , BIT_DIGITAL , System1InputPort0 + 5, "p1 up" }, - {"P1 Left Down" , BIT_DIGITAL , System1InputPort0 + 4, "p1 down" }, - {"P1 Left Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, - {"P1 Left Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, - {"P1 Right Up" , BIT_DIGITAL , System1InputPort0 + 1, "p1 fire 1" }, - {"P1 Right Down" , BIT_DIGITAL , System1InputPort0 + 0, "p1 fire 2" }, - {"P1 Right Left" , BIT_DIGITAL , System1InputPort0 + 3, "p1 fire 3" }, - {"P1 Right Right" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 4" }, - {"P1 Fire 1" , BIT_DIGITAL , System1InputPort2 + 6, "p1 fire 5" }, - - {"P2 Left Up" , BIT_DIGITAL , System1InputPort1 + 5, "p2 up" }, - {"P2 Left Down" , BIT_DIGITAL , System1InputPort1 + 4, "p2 down" }, - {"P2 Left Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, - {"P2 Left Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, - {"P2 Right Up" , BIT_DIGITAL , System1InputPort1 + 1, "p2 fire 1" }, - {"P2 Right Down" , BIT_DIGITAL , System1InputPort1 + 0, "p2 fire 2" }, - {"P2 Right Left" , BIT_DIGITAL , System1InputPort1 + 3, "p2 fire 3" }, - {"P2 Right Right" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 4" }, - {"P2 Fire 1" , BIT_DIGITAL , System1InputPort2 + 7, "p2 fire 5" }, - - {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, - {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, - {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, - {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Wmatch) - -inline void System1ClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x30) == 0x30) { - *nJoystickInputs &= ~0x30; - } - if ((*nJoystickInputs & 0xc0) == 0xc0) { - *nJoystickInputs &= ~0xc0; - } -} - -static inline void System1MakeInputs() -{ - // Reset Inputs - System1Input[0] = System1Input[1] = System1Input[2] = 0x00; - - // Compile Digital Inputs - for (int i = 0; i < 8; i++) { - System1Input[0] |= (System1InputPort0[i] & 1) << i; - System1Input[1] |= (System1InputPort1[i] & 1) << i; - System1Input[2] |= (System1InputPort2[i] & 1) << i; - } - - // Clear Opposites - System1ClearOpposites(&System1Input[0]); - System1ClearOpposites(&System1Input[1]); -} - -static inline void BlockgalMakeInputs() -{ - System1Input[2] = 0x00; - - for (int i = 0; i < 8; i++) { - System1Input[2] |= (System1InputPort2[i] & 1) << i; - } - - if (System1InputPort0[0]) BlockgalDial1 += 0x04; - if (System1InputPort0[1]) BlockgalDial1 -= 0x04; - - if (System1InputPort0[2]) BlockgalDial2 += 0x04; - if (System1InputPort0[3]) BlockgalDial2 -= 0x04;; -} - -#define SYSTEM1_COINAGE(dipval) \ - {0 , 0xfe, 0 , 16 , "Coin A" }, \ - {dipval, 0x01, 0x0f, 0x07, "4 Coins 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x08, "3 Coins 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x09, "2 Coins 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x05, "2 Coins 1 Credit 4/2 5/3 6/4"}, \ - {dipval, 0x01, 0x0f, 0x04, "2 Coins 1 Credit 4/3" }, \ - {dipval, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x00, "1 Coin 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x03, "1 Coin 1 Credit 5/6" }, \ - {dipval, 0x01, 0x0f, 0x02, "1 Coin 1 Credit 4/5" }, \ - {dipval, 0x01, 0x0f, 0x01, "1 Coin 1 Credit 2/3" }, \ - {dipval, 0x01, 0x0f, 0x06, "2 Coins 3 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, \ - \ - {0 , 0xfe, 0 , 16 , "Coin B" }, \ - {dipval, 0x01, 0xf0, 0x70, "4 Coins 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x80, "3 Coins 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x90, "2 Coins 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x50, "2 Coins 1 Credit 4/2 5/3 6/4"}, \ - {dipval, 0x01, 0xf0, 0x40, "2 Coins 1 Credit 4/3" }, \ - {dipval, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x00, "1 Coin 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x30, "1 Coin 1 Credit 5/6" }, \ - {dipval, 0x01, 0xf0, 0x20, "1 Coin 1 Credit 4/5" }, \ - {dipval, 0x01, 0xf0, 0x10, "1 Coin 1 Credit 2/3" }, \ - {dipval, 0x01, 0xf0, 0x60, "2 Coins 3 Credits" }, \ - {dipval, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, \ - {dipval, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, \ - {dipval, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, \ - {dipval, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, \ - {dipval, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, - -static struct BurnDIPInfo FourdwarrioDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x06, 0x06, "3" }, - {0x14, 0x01, 0x06, 0x04, "4" }, - {0x14, 0x01, 0x06, 0x02, "5" }, - {0x14, 0x01, 0x06, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x14, 0x01, 0x38, 0x38, "30k" }, - {0x14, 0x01, 0x38, 0x30, "40k" }, - {0x14, 0x01, 0x38, 0x28, "50k" }, - {0x14, 0x01, 0x38, 0x20, "60k" }, - {0x14, 0x01, 0x38, 0x18, "70k" }, - {0x14, 0x01, 0x38, 0x10, "80k" }, - {0x14, 0x01, 0x38, 0x08, "90k" }, - {0x14, 0x01, 0x38, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x40, 0x40, "Easy" }, - {0x14, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Fourdwarrio) - -static struct BurnDIPInfo BlockgalDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0xd7, NULL }, - {0x0d, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0c, 0x01, 0x01, 0x00, "Upright" }, - {0x0c, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0c, 0x01, 0x02, 0x00, "Off" }, - {0x0c, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0c, 0x01, 0x08, 0x08, "2" }, - {0x0c, 0x01, 0x08, 0x00, "3" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0c, 0x01, 0x10, 0x10, "10k 30k 60k 100k 150k" }, - {0x0c, 0x01, 0x10, 0x00, "30k 50k 100k 200k 300k" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0c, 0x01, 0x20, 0x20, "Off" }, - {0x0c, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x80, 0x80, "Off" }, - {0x0c, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - SYSTEM1_COINAGE(0x0d) -}; - -STDDIPINFO(Blockgal) - -static struct BurnDIPInfo BrainDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, -}; - -STDDIPINFO(Brain) - -static struct BurnDIPInfo BullfgtDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "30k" }, - {0x14, 0x01, 0x30, 0x20, "50k" }, - {0x14, 0x01, 0x30, 0x10, "70k" }, - {0x14, 0x01, 0x30, 0x00, "None" }, -}; - -STDDIPINFO(Bullfgt) - -static struct BurnDIPInfo FlickyDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0xff, NULL }, - {0x0e, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x0d) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x01, 0x00, "Upright" }, - {0x0e, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0e, 0x01, 0x0c, 0x0c, "2" }, - {0x0e, 0x01, 0x0c, 0x08, "3" }, - {0x0e, 0x01, 0x0c, 0x04, "4" }, - {0x0e, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0e, 0x01, 0x30, 0x30, "30k 80k 160k" }, - {0x0e, 0x01, 0x30, 0x20, "30k 100k 200k" }, - {0x0e, 0x01, 0x30, 0x10, "40k 120k 240k" }, - {0x0e, 0x01, 0x30, 0x00, "40k 140k 280k" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0e, 0x01, 0x40, 0x40, "Easy" }, - {0x0e, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Flicky) - -static struct BurnDIPInfo GardiaDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0x7c, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, " 5k 20k 30k" }, - {0x14, 0x01, 0x30, 0x20, "10k 25k 50k" }, - {0x14, 0x01, 0x30, 0x10, "15k 30k 60k" }, - {0x14, 0x01, 0x30, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x40, 0x40, "Easy" }, - {0x14, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Gardia) - -static struct BurnDIPInfo HvymetalDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "50k, 100k" }, - {0x14, 0x01, 0x30, 0x20, "60k, 120k" }, - {0x14, 0x01, 0x30, 0x10, "70k, 150k" }, - {0x14, 0x01, 0x30, 0x00, "100k" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x40, 0x40, "Easy" }, - {0x14, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Hvymetal) - -static struct BurnDIPInfo ImsorryDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "30k" }, - {0x14, 0x01, 0x30, 0x20, "40k" }, - {0x14, 0x01, 0x30, 0x10, "50k" }, - {0x14, 0x01, 0x30, 0x00, "None" }, -}; - -STDDIPINFO(Imsorry) - -static struct BurnDIPInfo MrvikingDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0x7c, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Maximum Credit" }, - {0x14, 0x01, 0x02, 0x02, "9" }, - {0x14, 0x01, 0x02, 0x00, "99" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "10k, 30k then every 30k"}, - {0x14, 0x01, 0x30, 0x20, "20k, 40k then every 30k"}, - {0x14, 0x01, 0x30, 0x10, "30k, then every 30k" }, - {0x14, 0x01, 0x30, 0x00, "40k, then every 30k" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x40, 0x40, "Easy" }, - {0x14, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Mrviking) - -static struct BurnDIPInfo MrvikngjDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0x7c, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "10k, 30k then every 30k"}, - {0x14, 0x01, 0x30, 0x20, "20k, 40k then every 30k"}, - {0x14, 0x01, 0x30, 0x10, "30k, then every 30k" }, - {0x14, 0x01, 0x30, 0x00, "40k, then every 30k" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x40, 0x40, "Easy" }, - {0x14, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Mrvikngj) - -static struct BurnDIPInfo MyheroDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "30k" }, - {0x14, 0x01, 0x30, 0x20, "50k" }, - {0x14, 0x01, 0x30, 0x10, "70k" }, - {0x14, 0x01, 0x30, 0x00, "90k" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x40, 0x40, "Easy" }, - {0x14, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Myhero) - -static struct BurnDIPInfo NobbDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0x2f, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x03, 0x00, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0x0c, 0x00, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0c, 0x04, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x13, 0x01, 0x30, 0x20, "Easy" }, - {0x13, 0x01, 0x30, 0x30, "Medium" }, - {0x13, 0x01, 0x30, 0x10, "Hard" }, - {0x13, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x40, 0x00, "Upright" }, - {0x13, 0x01, 0x40, 0x40, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x80, 0x00, "Off" }, - {0x13, 0x01, 0x80, 0x80, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x03, 0x02, "2" }, - {0x14, 0x01, 0x03, 0x03, "3" }, - {0x14, 0x01, 0x03, 0x01, "5" }, - {0x14, 0x01, 0x03, 0x00, "99" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "40k, 80k, 120k, 160k" }, - {0x14, 0x01, 0x0c, 0x0c, "50k, 100k, 150k" }, - {0x14, 0x01, 0x0c, 0x04, "60k, 120k, 180k" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x10, 0x00, "Off" }, - {0x14, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, -}; - -STDDIPINFO(Nobb) - -static struct BurnDIPInfo Pitfall2DIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xdc, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x14, 0x01, 0x10, 0x10, "20k 50k" }, - {0x14, 0x01, 0x10, 0x00, "30k 70k" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Time" }, - {0x14, 0x01, 0x40, 0x00, "2 minutes" }, - {0x14, 0x01, 0x40, 0x40, "3 minutes" }, -}; - -STDDIPINFO(Pitfall2) - -static struct BurnDIPInfo PitfalluDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xde, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x06, 0x06, "3" }, - {0x14, 0x01, 0x06, 0x04, "4" }, - {0x14, 0x01, 0x06, 0x02, "5" }, - {0x14, 0x01, 0x06, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Starting Stage" }, - {0x14, 0x01, 0x18, 0x18, "1" }, - {0x14, 0x01, 0x18, 0x10, "2" }, - {0x14, 0x01, 0x18, 0x08, "3" }, - {0x14, 0x01, 0x18, 0x00, "4" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x20, 0x20, "Off" }, - {0x14, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Time" }, - {0x14, 0x01, 0x40, 0x00, "2 minutes" }, - {0x14, 0x01, 0x40, 0x40, "3 minutes" }, -}; - -STDDIPINFO(Pitfallu) - -static struct BurnDIPInfo RaflesiaDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "20k, 70k and 120k" }, - {0x14, 0x01, 0x30, 0x20, "30k, 80k and 150k" }, - {0x14, 0x01, 0x30, 0x10, "50k, 100k and 200k" }, - {0x14, 0x01, 0x30, 0x00, "None" }, -}; - -STDDIPINFO(Raflesia) - -static struct BurnDIPInfo RegulusDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0x7e, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x40, 0x40, "Easy" }, - {0x14, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x80, 0x80, "Off" }, - {0x14, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Regulus) - -static struct BurnDIPInfo RegulusoDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x40, 0x40, "Easy" }, - {0x14, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Reguluso) - -static struct BurnDIPInfo SeganinjDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xdc, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x15) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x16, 0x01, 0x01, 0x00, "Upright" }, - {0x16, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x16, 0x01, 0x02, 0x02, "Off" }, - {0x16, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x0c, 0x08, "2" }, - {0x16, 0x01, 0x0c, 0x0c, "3" }, - {0x16, 0x01, 0x0c, 0x04, "4" }, - {0x16, 0x01, 0x0c, 0x00, "240" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x16, 0x01, 0x10, 0x10, "20k 70k 120k 170k" }, - {0x16, 0x01, 0x10, 0x00, "50k 100k 150k 200k" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x20, 0x20, "Off" }, - {0x16, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x16, 0x01, 0x40, 0x40, "Easy" }, - {0x16, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Seganinj) - -static struct BurnDIPInfo SpatterDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x08, "2" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x04, "4" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "40k, 120k and 480k" }, - {0x14, 0x01, 0x30, 0x20, "50k and 200k" }, - {0x14, 0x01, 0x30, 0x10, "100k only" }, - {0x14, 0x01, 0x30, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Reset Timer/Objects on Life Loss" }, - {0x14, 0x01, 0x40, 0x40, "No" }, - {0x14, 0x01, 0x40, 0x00, "Yes" }, -}; - -STDDIPINFO(Spatter) - -static struct BurnDIPInfo StarjackDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xf6, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x06, 0x06, "3" }, - {0x14, 0x01, 0x06, 0x04, "4" }, - {0x14, 0x01, 0x06, 0x02, "5" }, - {0x14, 0x01, 0x06, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x14, 0x01, 0x38, 0x38, "Every 20k" }, - {0x14, 0x01, 0x38, 0x28, "Every 30k" }, - {0x14, 0x01, 0x38, 0x18, "Every 40k" }, - {0x14, 0x01, 0x38, 0x08, "Every 50k" }, - {0x14, 0x01, 0x38, 0x30, "20k, then every 30k" }, - {0x14, 0x01, 0x38, 0x20, "30k, then every 40k" }, - {0x14, 0x01, 0x38, 0x10, "40k, then every 50k" }, - {0x14, 0x01, 0x38, 0x00, "50k, then every 60k" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0xc0, 0xc0, "Easy" }, - {0x14, 0x01, 0xc0, 0x80, "Medium" }, - {0x14, 0x01, 0xc0, 0x40, "Hard" }, - {0x14, 0x01, 0xc0, 0x00, "Hardest" }, -}; - -STDDIPINFO(Starjack) - -static struct BurnDIPInfo StarjacsDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x06, 0x06, "3" }, - {0x14, 0x01, 0x06, 0x04, "4" }, - {0x14, 0x01, 0x06, 0x02, "5" }, - {0x14, 0x01, 0x06, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 2 , "Ship" }, - {0x14, 0x01, 0x08, 0x08, "Single" }, - {0x14, 0x01, 0x08, 0x00, "Multi" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "30k, then every 40k" }, - {0x14, 0x01, 0x30, 0x20, "40k, then every 50k" }, - {0x14, 0x01, 0x30, 0x10, "50k, then every 60k" }, - {0x14, 0x01, 0x30, 0x00, "60k, then every 70k" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0xc0, 0xc0, "Easy" }, - {0x14, 0x01, 0xc0, 0x80, "Medium" }, - {0x14, 0x01, 0xc0, 0x40, "Hard" }, - {0x14, 0x01, 0xc0, 0x00, "Hardest" }, -}; - -STDDIPINFO(Starjacs) - -static struct BurnDIPInfo SwatDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x06, 0x06, "3" }, - {0x14, 0x01, 0x06, 0x04, "4" }, - {0x14, 0x01, 0x06, 0x02, "5" }, - {0x14, 0x01, 0x06, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x14, 0x01, 0x38, 0x38, "30k" }, - {0x14, 0x01, 0x38, 0x30, "40k" }, - {0x14, 0x01, 0x38, 0x28, "50k" }, - {0x14, 0x01, 0x38, 0x20, "60k" }, - {0x14, 0x01, 0x38, 0x18, "70k" }, - {0x14, 0x01, 0x38, 0x10, "80k" }, - {0x14, 0x01, 0x38, 0x08, "90k" }, - {0x14, 0x01, 0x38, 0x00, "None" }, -}; - -STDDIPINFO(Swat) - -static struct BurnDIPInfo TeddybbDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x00, "Off" }, - {0x14, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x08, "2" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x04, "4" }, - {0x14, 0x01, 0x0c, 0x00, "252" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "100k 400k" }, - {0x14, 0x01, 0x30, 0x20, "200k 600k" }, - {0x14, 0x01, 0x30, 0x10, "400k 800k" }, - {0x14, 0x01, 0x30, 0x00, "600k" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x40, 0x40, "Easy" }, - {0x14, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Teddybb) - -static struct BurnDIPInfo UpndownDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x11) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x12, 0x01, 0x01, 0x00, "Upright" }, - {0x12, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x06, 0x06, "3" }, - {0x12, 0x01, 0x06, 0x04, "4" }, - {0x12, 0x01, 0x06, 0x02, "5" }, - {0x12, 0x01, 0x06, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 8 , "Bonus Life" }, - {0x12, 0x01, 0x38, 0x38, "10k" }, - {0x12, 0x01, 0x38, 0x30, "20k" }, - {0x12, 0x01, 0x38, 0x28, "30k" }, - {0x12, 0x01, 0x38, 0x20, "40k" }, - {0x12, 0x01, 0x38, 0x18, "50k" }, - {0x12, 0x01, 0x38, 0x10, "60k" }, - {0x12, 0x01, 0x38, 0x08, "70k" }, - {0x12, 0x01, 0x38, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0xc0, 0xc0, "Easy" }, - {0x12, 0x01, 0xc0, 0x80, "Medium" }, - {0x12, 0x01, 0xc0, 0x40, "Hard" }, - {0x12, 0x01, 0xc0, 0x00, "Hardest" }, -}; - -STDDIPINFO(Upndown) - -static struct BurnDIPInfo WboyDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xec, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x0f) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x01, 0x00, "Upright" }, - {0x10, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x10, 0x01, 0x02, 0x02, "Off" }, - {0x10, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x0c, 0x0c, "3" }, - {0x10, 0x01, 0x0c, 0x08, "4" }, - {0x10, 0x01, 0x0c, 0x04, "5" }, - {0x10, 0x01, 0x0c, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x10, 0x10, "30k 100k 170k 240k" }, - {0x10, 0x01, 0x10, 0x00, "30k 120k 210k 300k" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x10, 0x01, 0x20, 0x00, "Off" }, - {0x10, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x10, 0x01, 0x40, 0x40, "Easy" }, - {0x10, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Wboy) - -static struct BurnDIPInfo Wboy3DIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xec, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x0f) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x01, 0x00, "Upright" }, - {0x10, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x10, 0x01, 0x02, 0x02, "Off" }, - {0x10, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x0c, 0x0c, "1" }, - {0x10, 0x01, 0x0c, 0x08, "2" }, - {0x10, 0x01, 0x0c, 0x04, "3" }, - {0x10, 0x01, 0x0c, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x10, 0x10, "30k 100k 170k 240k" }, - {0x10, 0x01, 0x10, 0x00, "30k 120k 210k 300k" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x10, 0x01, 0x20, 0x00, "Off" }, - {0x10, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x10, 0x01, 0x40, 0x40, "Easy" }, - {0x10, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Wboy3) - -static struct BurnDIPInfo WboyuDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xbe, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x01, 0x00, "Upright" }, - {0x0f, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x06, 0x00, "2" }, - {0x0f, 0x01, 0x06, 0x06, "3" }, - {0x0f, 0x01, 0x06, 0x04, "4" }, - {0x0f, 0x01, 0x06, 0x02, "5" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x40, 0x40, "Off" }, - {0x0f, 0x01, 0x40, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 8 , "Coinage" }, - {0x10, 0x01, 0x07, 0x04, "4 Coins 1 Credit" }, - {0x10, 0x01, 0x07, 0x05, "3 Coins 1 Credit" }, - {0x10, 0x01, 0x07, 0x00, "4 Coins 2 Credits" }, - {0x10, 0x01, 0x07, 0x06, "2 Coins 1 Credit" }, - {0x10, 0x01, 0x07, 0x01, "3 Coins 2 Credits" }, - {0x10, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, - {0x10, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, - {0x10, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x10, 0x01, 0x10, 0x00, "Off" }, - {0x10, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 4 , "Mode" }, - {0x10, 0x01, 0xc0, 0xc0, "Normal Game" }, - {0x10, 0x01, 0xc0, 0x80, "Free Play" }, - {0x10, 0x01, 0xc0, 0x40, "Test Mode" }, - {0x10, 0x01, 0xc0, 0x00, "Endless Game" }, -}; - -STDDIPINFO(Wboyu) - -static struct BurnDIPInfo WbdeluxeDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0x7c, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x0f) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x10, 0x01, 0x01, 0x00, "Upright" }, - {0x10, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x10, 0x01, 0x02, 0x02, "Off" }, - {0x10, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x0c, 0x0c, "3" }, - {0x10, 0x01, 0x0c, 0x08, "4" }, - {0x10, 0x01, 0x0c, 0x04, "5" }, - {0x10, 0x01, 0x0c, 0x00, "Freeplay" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x10, 0x10, "30k 100k 170k 240k" }, - {0x10, 0x01, 0x10, 0x00, "30k 120k 210k 300k" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x10, 0x01, 0x20, 0x00, "Off" }, - {0x10, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x10, 0x01, 0x40, 0x40, "Easy" }, - {0x10, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Energy Consumption" }, - {0x10, 0x01, 0x80, 0x00, "Slow" }, - {0x10, 0x01, 0x80, 0x80, "Fast" }, -}; - -STDDIPINFO(Wbdeluxe) - -static struct BurnDIPInfo WmatchDIPList[]= -{ - // Default Values - {0x19, 0xff, 0xff, 0xff, NULL }, - {0x1a, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM1_COINAGE(0x19) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x1a, 0x01, 0x01, 0x00, "Upright" }, - {0x1a, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x1a, 0x01, 0x02, 0x02, "Off" }, - {0x1a, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Time" }, - {0x1a, 0x01, 0x0c, 0x0c, "Normal" }, - {0x1a, 0x01, 0x0c, 0x08, "Fast" }, - {0x1a, 0x01, 0x0c, 0x04, "Faster" }, - {0x1a, 0x01, 0x0c, 0x00, "Fastest" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x1a, 0x01, 0x10, 0x10, "20k 50k" }, - {0x1a, 0x01, 0x10, 0x00, "30k 70k" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x1a, 0x01, 0x40, 0x40, "Easy" }, - {0x1a, 0x01, 0x40, 0x00, "Hard" }, -}; - -STDDIPINFO(Wmatch) - -#undef SYSTEM1_COINAGE - -/*============================================================================================== -ROM Descriptions -===============================================================================================*/ - -static struct BurnRomInfo FourdwarrioRomDesc[] = { - { "4d.116", 0x004000, 0x546d1bc7, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "4d.109", 0x004000, 0xf1074ec3, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "4d.96", 0x004000, 0x387c1e8f, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "4d.120", 0x002000, 0x5241c009, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "4d.62", 0x002000, 0xf31b2e09, BRF_GRA }, // 4 Tiles - { "4d.61", 0x002000, 0x5430e925, BRF_GRA }, // 5 Tiles - { "4d.64", 0x002000, 0x9f442351, BRF_GRA }, // 6 Tiles - { "4d.63", 0x002000, 0x633232bd, BRF_GRA }, // 7 Tiles - { "4d.66", 0x002000, 0x52bfa2ed, BRF_GRA }, // 8 Tiles - { "4d.65", 0x002000, 0xe9ba4658, BRF_GRA }, // 9 Tiles - - { "4d.117", 0x004000, 0x436e4141, BRF_GRA }, // 10 Sprites - { "4d.04", 0x004000, 0x8b7cecef, BRF_GRA }, // 11 Sprites - { "4d.110", 0x004000, 0x6ec5990a, BRF_GRA }, // 12 Sprites - { "4d.05", 0x004000, 0xf31a1e6a, BRF_GRA }, // 13 Sprites - - { "pr5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Fourdwarrio) -STD_ROM_FN(Fourdwarrio) - -static struct BurnRomInfo BlockgalRomDesc[] = { - { "bg.116", 0x004000, 0xa99b231a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bg.109", 0x004000, 0xa6b573d5, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "bg.120", 0x002000, 0xd848faff, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - - { "bg.62", 0x002000, 0x7e3ea4eb, BRF_GRA }, // 3 Tiles - { "bg.61", 0x002000, 0x4dd3d39d, BRF_GRA }, // 4 Tiles - { "bg.64", 0x002000, 0x17368663, BRF_GRA }, // 5 Tiles - { "bg.63", 0x002000, 0x0c8bc404, BRF_GRA }, // 6 Tiles - { "bg.66", 0x002000, 0x2b7dc4fa, BRF_GRA }, // 7 Tiles - { "bg.65", 0x002000, 0xed121306, BRF_GRA }, // 8 Tiles - - { "bg.117", 0x004000, 0xe99cc920, BRF_GRA }, // 9 Sprites - { "bg.04", 0x004000, 0x213057f8, BRF_GRA }, // 10 Sprites - { "bg.110", 0x004000, 0x064c812c, BRF_GRA }, // 11 Sprites - { "bg.05", 0x004000, 0x02e0b040, BRF_GRA }, // 12 Sprites - - { "pr5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 13 Timing PROM - - { "317-0029.key", 0x002000, 0x350d7f93, BRF_ESS | BRF_PRG }, // 14 MC8123 Key -}; - -STD_ROM_PICK(Blockgal) -STD_ROM_FN(Blockgal) - -static struct BurnRomInfo BrainRomDesc[] = { - { "brain.1", 0x008000, 0x2d2aec31, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "brain.2", 0x008000, 0x810a8ab5, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "brain.3", 0x008000, 0x9a225634, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "brain.120", 0x008000, 0xc7e50278, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "brain.62", 0x004000, 0x7dce2302, BRF_GRA }, // 4 Tiles - { "brain.64", 0x004000, 0x7ce03fd3, BRF_GRA }, // 5 Tiles - { "brain.66", 0x004000, 0xea54323f, BRF_GRA }, // 6 Tiles - - { "brain.117", 0x008000, 0x92ff71a4, BRF_GRA }, // 7 Sprites - { "brain.110", 0x008000, 0xa1b847ec, BRF_GRA }, // 8 Sprites - { "brain.4", 0x008000, 0xfd2ea53b, BRF_GRA }, // 9 Sprites - - { "bprom.3", 0x000100, 0x8eee0f72, BRF_GRA }, // 10 Red PROM - { "bprom.2", 0x000100, 0x3e7babd7, BRF_GRA }, // 11 Green PROM - { "bprom.1", 0x000100, 0x371c44a6, BRF_GRA }, // 12 Blue PROM - { "pr5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 13 Timing PROM -}; - -STD_ROM_PICK(Brain) -STD_ROM_FN(Brain) - -static struct BurnRomInfo BullfgtRomDesc[] = { - { "epr-.129", 0x002000, 0x29f19156, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-.130", 0x002000, 0xe37d2b95, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-.131", 0x002000, 0xeaf5773d, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-.132", 0x002000, 0x72c3c712, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-.133", 0x002000, 0x7d9fa4cd, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-.134", 0x002000, 0x061f2797, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-6077.120", 0x002000, 0x02a37602, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-.82", 0x002000, 0xb71c349f, BRF_GRA }, // 7 Tiles - { "epr-.65", 0x002000, 0x86deafa8, BRF_GRA }, // 8 Tiles - { "epr-6087.81", 0x002000, 0x2677742c, BRF_GRA }, // 9 Tiles - { "epr-.64", 0x002000, 0x6f0a62be, BRF_GRA }, // 10 Tiles - { "epr-6085.80", 0x002000, 0x9c3ddc62, BRF_GRA }, // 11 Tiles - { "epr-.63", 0x002000, 0xc0fce57c, BRF_GRA }, // 12 Tiles - - { "epr-6069.86", 0x004000, 0xfe691e41, BRF_GRA }, // 13 Sprites - { "epr-6070.93", 0x004000, 0x34f080df, BRF_GRA }, // 14 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Bullfgt) -STD_ROM_FN(Bullfgt) - -static struct BurnRomInfo ThetogyuRomDesc[] = { - { "epr-6071.116", 0x004000, 0x96b57df9, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6072.109", 0x004000, 0xf7baadd0, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6073.96", 0x004000, 0x721af166, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6077.120", 0x002000, 0x02a37602, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-6089.62", 0x002000, 0xa183e5ff, BRF_GRA }, // 7 Tiles - { "epr-6088.61", 0x002000, 0xb919b4a6, BRF_GRA }, // 8 Tiles - { "epr-6087.64", 0x002000, 0x2677742c, BRF_GRA }, // 9 Tiles - { "epr-6086.63", 0x002000, 0x76b5a084, BRF_GRA }, // 10 Tiles - { "epr-6085.66", 0x002000, 0x9c3ddc62, BRF_GRA }, // 11 Tiles - { "epr-6084.65", 0x002000, 0x90e1fa5f, BRF_GRA }, // 12 Tiles - - { "epr-6069.117", 0x004000, 0xfe691e41, BRF_GRA }, // 13 Sprites - { "epr-6070.110", 0x004000, 0x34f080df, BRF_GRA }, // 14 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Thetogyu) -STD_ROM_FN(Thetogyu) - -static struct BurnRomInfo FlickyRomDesc[] = { - { "epr5978a.116", 0x004000, 0x296f1492, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr5979a.109", 0x004000, 0x64b03ef9, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - - { "epr-5868.62", 0x002000, 0x7402256b, BRF_GRA }, // 3 Tiles - { "epr-5867.61", 0x002000, 0x2f5ce930, BRF_GRA }, // 4 Tiles - { "epr-5866.64", 0x002000, 0x967f1d9a, BRF_GRA }, // 5 Tiles - { "epr-5865.63", 0x002000, 0x03d9a34c, BRF_GRA }, // 6 Tiles - { "epr-5864.66", 0x002000, 0xe659f358, BRF_GRA }, // 7 Tiles - { "epr-5863.65", 0x002000, 0xa496ca15, BRF_GRA }, // 8 Tiles - - { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 9 Sprites - { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 10 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 11 Timing PROM -}; - -STD_ROM_PICK(Flicky) -STD_ROM_FN(Flicky) - -static struct BurnRomInfo FlickygRomDesc[] = { - { "epr5978a.116", 0x004000, 0x296f1492, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr5979a.109", 0x004000, 0x64b03ef9, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - - { "66xx.ic62", 0x004000, 0xf1a75200, BRF_GRA }, // 3 Tiles - { "66x0.ic64", 0x004000, 0x299aefb7, BRF_GRA }, // 4 Tiles - { "5999.ic66", 0x004000, 0x1ca53157, BRF_GRA }, // 5 Tiles - - { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 8 Sprites - { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 9 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 10 Timing PROM -}; - -STD_ROM_PICK(Flickyg) -STD_ROM_FN(Flickyg) - -static struct BurnRomInfo Flickys1RomDesc[] = { - { "ic129", 0x002000, 0x7011275c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ic130", 0x002000, 0xe7ed012d, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "ic131", 0x002000, 0xc5e98cd1, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "ic132", 0x002000, 0x0e5122c2, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - - { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code - - { "epr-5868.62", 0x002000, 0x7402256b, BRF_GRA }, // 5 Tiles - { "epr-5867.61", 0x002000, 0x2f5ce930, BRF_GRA }, // 6 Tiles - { "epr-5866.64", 0x002000, 0x967f1d9a, BRF_GRA }, // 7 Tiles - { "epr-5865.63", 0x002000, 0x03d9a34c, BRF_GRA }, // 8 Tiles - { "epr-5864.66", 0x002000, 0xe659f358, BRF_GRA }, // 9 Tiles - { "epr-5863.65", 0x002000, 0xa496ca15, BRF_GRA }, // 10 Tiles - - { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 11 Sprites - { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 12 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 13 Timing PROM -}; - -STD_ROM_PICK(Flickys1) -STD_ROM_FN(Flickys1) - -static struct BurnRomInfo Flickys2RomDesc[] = { - { "epr-6621.bin", 0x004000, 0xb21ff546, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6622.bin", 0x004000, 0x133a8bf1, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - - { "epr-5868.62", 0x002000, 0x7402256b, BRF_GRA }, // 3 Tiles - { "epr-5867.61", 0x002000, 0x2f5ce930, BRF_GRA }, // 4 Tiles - { "epr-5866.64", 0x002000, 0x967f1d9a, BRF_GRA }, // 5 Tiles - { "epr-5865.63", 0x002000, 0x03d9a34c, BRF_GRA }, // 6 Tiles - { "epr-5864.66", 0x002000, 0xe659f358, BRF_GRA }, // 7 Tiles - { "epr-5863.65", 0x002000, 0xa496ca15, BRF_GRA }, // 8 Tiles - - { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 9 Sprites - { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 10 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 11 Timing PROM -}; - -STD_ROM_PICK(Flickys2) -STD_ROM_FN(Flickys2) - -static struct BurnRomInfo Flickys2gRomDesc[] = { - { "epr-6621.bin", 0x004000, 0xb21ff546, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6622.bin", 0x004000, 0x133a8bf1, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - - { "66xx.ic62", 0x004000, 0xf1a75200, BRF_GRA }, // 3 Tiles - { "66x0.ic64", 0x004000, 0x299aefb7, BRF_GRA }, // 4 Tiles - { "5999.ic66", 0x004000, 0x1ca53157, BRF_GRA }, // 5 Tiles - - { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 6 Sprites - { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 7 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 8 Timing PROM -}; - -STD_ROM_PICK(Flickys2g) -STD_ROM_FN(Flickys2g) - -static struct BurnRomInfo FlickyoRomDesc[] = { - { "epr-5857.bin", 0x002000, 0xa65ac88e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr5858a.bin", 0x002000, 0x18b412f4, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-5859.bin", 0x002000, 0xa5558d7e, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-5860.bin", 0x002000, 0x1b35fef1, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - - { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code - - { "epr-5868.62", 0x002000, 0x7402256b, BRF_GRA }, // 5 Tiles - { "epr-5867.61", 0x002000, 0x2f5ce930, BRF_GRA }, // 6 Tiles - { "epr-5866.64", 0x002000, 0x967f1d9a, BRF_GRA }, // 7 Tiles - { "epr-5865.63", 0x002000, 0x03d9a34c, BRF_GRA }, // 8 Tiles - { "epr-5864.66", 0x002000, 0xe659f358, BRF_GRA }, // 9 Tiles - { "epr-5863.65", 0x002000, 0xa496ca15, BRF_GRA }, // 10 Tiles - - { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 11 Sprites - { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 12 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 13 Timing PROM -}; - -STD_ROM_PICK(Flickyo) -STD_ROM_FN(Flickyo) - -static struct BurnRomInfo GardiaRomDesc[] = { - { "epr10255.1", 0x008000, 0x89282a6b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr10254.2", 0x008000, 0x2826b6d8, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr10253.3", 0x008000, 0x7911260f, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr10243.120", 0x004000, 0x87220660, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr10249.61", 0x004000, 0x4e0ad0f2, BRF_GRA }, // 4 Tiles - { "epr10248.64", 0x004000, 0x3515d124, BRF_GRA }, // 5 Tiles - { "epr10247.66", 0x004000, 0x541e1555, BRF_GRA }, // 6 Tiles - - { "epr10234.117", 0x008000, 0x8a6aed33, BRF_GRA }, // 7 Sprites - { "epr10233.110", 0x008000, 0xc52784d3, BRF_GRA }, // 8 Sprites - { "epr10236.04", 0x008000, 0xb35ab227, BRF_GRA }, // 9 Sprites - { "epr10235.5", 0x008000, 0x006a3151, BRF_GRA }, // 10 Sprites - - { "bprom.3", 0x000100, 0x8eee0f72, BRF_GRA }, // 11 Red PROM - { "bprom.2", 0x000100, 0x3e7babd7, BRF_GRA }, // 12 Green PROM - { "bprom.1", 0x000100, 0x371c44a6, BRF_GRA }, // 13 Blue PROM - { "pr5317.4", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Gardia) -STD_ROM_FN(Gardia) - -static struct BurnRomInfo GardiabRomDesc[] = { - { "gardiabl.5", 0x008000, 0x207f9cbb, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "gardiabl.6", 0x008000, 0xb2ed05dc, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "gardiabl.7", 0x008000, 0x0a490588, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr10243.120", 0x004000, 0x87220660, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "gardiabl.8", 0x004000, 0x367c9a17, BRF_GRA }, // 4 Tiles - { "gardiabl.9", 0x004000, 0x1540fd30, BRF_GRA }, // 5 Tiles - { "gardiabl.10", 0x004000, 0xe5c9af10, BRF_GRA }, // 6 Tiles - - { "epr10234.117", 0x008000, 0x8a6aed33, BRF_GRA }, // 7 Sprites - { "epr10233.110", 0x008000, 0xc52784d3, BRF_GRA }, // 8 Sprites - { "epr10236.04", 0x008000, 0xb35ab227, BRF_GRA }, // 9 Sprites - { "epr10235.5", 0x008000, 0x006a3151, BRF_GRA }, // 10 Sprites - - { "bprom.3", 0x000100, 0x8eee0f72, BRF_GRA }, // 11 Red PROM - { "bprom.2", 0x000100, 0x3e7babd7, BRF_GRA }, // 12 Green PROM - { "bprom.1", 0x000100, 0x371c44a6, BRF_GRA }, // 13 Blue PROM - { "pr5317.4", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Gardiab) -STD_ROM_FN(Gardiab) - -static struct BurnRomInfo HvymetalRomDesc[] = { - { "epra6790.1", 0x008000, 0x59195bb9, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epra6789.2", 0x008000, 0x83e1d18a, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epra6788.3", 0x008000, 0x6ecefd57, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr6787.120", 0x008000, 0xb64ac7f0, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr6795.62", 0x004000, 0x58a3d038, BRF_GRA }, // 4 Tiles - { "epr6796.61", 0x004000, 0xd8b08a55, BRF_GRA }, // 5 Tiles - { "epr6793.64", 0x004000, 0x487407c2, BRF_GRA }, // 6 Tiles - { "epr6794.63", 0x004000, 0x89eb3793, BRF_GRA }, // 7 Tiles - { "epr6791.66", 0x004000, 0xa7dcd042, BRF_GRA }, // 8 Tiles - { "epr6792.65", 0x004000, 0xd0be5e33, BRF_GRA }, // 9 Tiles - - { "epr6778.117", 0x008000, 0x0af61aee, BRF_GRA }, // 10 Sprites - { "epr6777.110", 0x008000, 0x91d7a197, BRF_GRA }, // 11 Sprites - { "epr6780.4", 0x008000, 0x55b31df5, BRF_GRA }, // 12 Sprites - { "epr6779.5", 0x008000, 0xe03a2b28, BRF_GRA }, // 13 Sprites - - { "pr7036.3", 0x000100, 0x146f16fb, BRF_GRA }, // 14 Red PROM - { "pr7035.2", 0x000100, 0x50b201ed, BRF_GRA }, // 15 Green PROM - { "pr7034.1", 0x000100, 0xdfb5f139, BRF_GRA }, // 16 Blue PROM - - { "pr5317p.4", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM -}; - -STD_ROM_PICK(Hvymetal) -STD_ROM_FN(Hvymetal) - -static struct BurnRomInfo ImsorryRomDesc[] = { - { "epr-6676.116", 0x004000, 0xeb087d7f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6677.109", 0x004000, 0xbd244bee, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6678.96", 0x004000, 0x2e16b9fd, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6656.120", 0x002000, 0x25e3d685, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6684.62", 0x002000, 0x2c8df377, BRF_GRA }, // 4 Tiles - { "epr-6683.61", 0x002000, 0x89431c48, BRF_GRA }, // 5 Tiles - { "epr-6682.64", 0x002000, 0x256a9246, BRF_GRA }, // 6 Tiles - { "epr-6681.63", 0x002000, 0x6974d189, BRF_GRA }, // 7 Tiles - { "epr-6680.66", 0x002000, 0x10a629d6, BRF_GRA }, // 8 Tiles - { "epr-6674.65", 0x002000, 0x143d883c, BRF_GRA }, // 9 Tiles - - { "epr-6645.117", 0x004000, 0x1ba167ee, BRF_GRA }, // 10 Sprites - { "epr-6646.04", 0x004000, 0xedda7ad6, BRF_GRA }, // 11 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 12 Timing PROM -}; - -STD_ROM_PICK(Imsorry) -STD_ROM_FN(Imsorry) - -static struct BurnRomInfo ImsorryjRomDesc[] = { - { "epr-6647.116", 0x004000, 0xcc5d915d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6648.109", 0x004000, 0x37574d60, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6649.96", 0x004000, 0x5f59bdee, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6656.120", 0x002000, 0x25e3d685, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6655.62", 0x002000, 0xbe1f762f, BRF_GRA }, // 4 Tiles - { "epr-6654.61", 0x002000, 0xed5f7fc8, BRF_GRA }, // 5 Tiles - { "epr-6653.64", 0x002000, 0x8b4845a7, BRF_GRA }, // 6 Tiles - { "epr-6652.63", 0x002000, 0x001d68cb, BRF_GRA }, // 7 Tiles - { "epr-6651.66", 0x002000, 0x4ee9b5e6, BRF_GRA }, // 8 Tiles - { "epr-6650.65", 0x002000, 0x3fca4414, BRF_GRA }, // 9 Tiles - - { "epr-6645.117", 0x004000, 0x1ba167ee, BRF_GRA }, // 10 Sprites - { "epr-6646.04", 0x004000, 0xedda7ad6, BRF_GRA }, // 11 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 12 Timing PROM -}; - -STD_ROM_PICK(Imsorryj) -STD_ROM_FN(Imsorryj) - -static struct BurnRomInfo MrvikingRomDesc[] = { - { "epr-5873.129", 0x002000, 0x14d21624, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-5874.130", 0x002000, 0x6df7de87, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-5875.131", 0x002000, 0xac226100, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-5876.132", 0x002000, 0xe77db1dc, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-5755.133", 0x002000, 0xedd62ae1, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-5756.134", 0x002000, 0x11974040, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-5763.3", 0x002000, 0xd712280d, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-5762.82", 0x002000, 0x4a91d08a, BRF_GRA }, // 7 Tiles - { "epr-5761.65", 0x002000, 0xf7d61b65, BRF_GRA }, // 8 Tiles - { "epr-5760.81", 0x002000, 0x95045820, BRF_GRA }, // 9 Tiles - { "epr-5759.64", 0x002000, 0x5f9bae4e, BRF_GRA }, // 10 Tiles - { "epr-5758.80", 0x002000, 0x808ee706, BRF_GRA }, // 11 Tiles - { "epr-5757.63", 0x002000, 0x480f7074, BRF_GRA }, // 12 Tiles - - { "epr-5749.86", 0x004000, 0xe24682cd, BRF_GRA }, // 13 Sprites - { "epr-5750.93", 0x004000, 0x6564d1ad, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Mrviking) -STD_ROM_FN(Mrviking) - -static struct BurnRomInfo MrvikingjRomDesc[] = { - { "epr-5751.129", 0x002000, 0xae97a4c5, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-5752.130", 0x002000, 0xd48e6726, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-5753.131", 0x002000, 0x28c60887, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-5754.132", 0x002000, 0x1f47ed02, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-5755.133", 0x002000, 0xedd62ae1, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-5756.134", 0x002000, 0x11974040, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-5763.3", 0x002000, 0xd712280d, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-5762.82", 0x002000, 0x4a91d08a, BRF_GRA }, // 7 Tiles - { "epr-5761.65", 0x002000, 0xf7d61b65, BRF_GRA }, // 8 Tiles - { "epr-5760.81", 0x002000, 0x95045820, BRF_GRA }, // 9 Tiles - { "epr-5759.64", 0x002000, 0x5f9bae4e, BRF_GRA }, // 10 Tiles - { "epr-5758.80", 0x002000, 0x808ee706, BRF_GRA }, // 11 Tiles - { "epr-5757.63", 0x002000, 0x480f7074, BRF_GRA }, // 12 Tiles - - { "epr-5749.86", 0x004000, 0xe24682cd, BRF_GRA }, // 13 Sprites - { "epr-5750.93", 0x004000, 0x6564d1ad, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Mrvikingj) -STD_ROM_FN(Mrvikingj) - -static struct BurnRomInfo MyheroRomDesc[] = { - { "epr6963b.116", 0x004000, 0x4daf89d4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr6964a.109", 0x004000, 0xc26188e5, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6927.96", 0x004000, 0x3cbbaf64, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-69xx.120", 0x002000, 0x0039e1e9, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6966.62", 0x002000, 0x157f0401, BRF_GRA }, // 4 Tiles - { "epr-6961.61", 0x002000, 0xbe53ce47, BRF_GRA }, // 5 Tiles - { "epr-6960.64", 0x002000, 0xbd381baa, BRF_GRA }, // 6 Tiles - { "epr-6959.63", 0x002000, 0xbc04e79a, BRF_GRA }, // 7 Tiles - { "epr-6958.66", 0x002000, 0x714f2c26, BRF_GRA }, // 8 Tiles - { "epr-6957.65", 0x002000, 0x80920112, BRF_GRA }, // 9 Tiles - - { "epr-6921.117", 0x004000, 0xf19e05a1, BRF_GRA }, // 10 Sprites - { "epr-6923.04", 0x004000, 0x7988adc3, BRF_GRA }, // 11 Sprites - { "epr-6922.110", 0x004000, 0x37f77a78, BRF_GRA }, // 12 Sprites - { "epr-6924.05", 0x004000, 0x42bdc8f6, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Myhero) -STD_ROM_FN(Myhero) - -static struct BurnRomInfo SscandalRomDesc[] = { - { "epr6925b.116", 0x004000, 0xff54dcec, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr6926a.109", 0x004000, 0x5c41eea8, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6927.96", 0x004000, 0x3cbbaf64, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6934.120", 0x002000, 0xaf467223, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6933.62", 0x002000, 0xe7304036, BRF_GRA }, // 4 Tiles - { "epr-6932.61", 0x002000, 0xf5cfbfda, BRF_GRA }, // 5 Tiles - { "epr-6931.64", 0x002000, 0x599d7f87, BRF_GRA }, // 6 Tiles - { "epr-6930.63", 0x002000, 0xcb6616c2, BRF_GRA }, // 7 Tiles - { "epr-6929.66", 0x002000, 0x27a16856, BRF_GRA }, // 8 Tiles - { "epr-6928.65", 0x002000, 0xc0c9cfa4, BRF_GRA }, // 9 Tiles - - { "epr-6921.117", 0x004000, 0xf19e05a1, BRF_GRA }, // 10 Sprites - { "epr-6923.04", 0x004000, 0x7988adc3, BRF_GRA }, // 11 Sprites - { "epr-6922.110", 0x004000, 0x37f77a78, BRF_GRA }, // 12 Sprites - { "epr-6924.05", 0x004000, 0x42bdc8f6, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Sscandal) -STD_ROM_FN(Sscandal) - -static struct BurnRomInfo MyherokRomDesc[] = { - { "ry-11.rom", 0x004000, 0x6f4c8ee5, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ry-09.rom", 0x004000, 0x369302a1, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "ry-07.rom", 0x004000, 0xb8e9922e, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6934.120", 0x002000, 0xaf467223, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "ry-04.rom", 0x004000, 0xdfb75143, BRF_GRA }, // 4 Tiles - { "ry-03.rom", 0x004000, 0xcf68b4a2, BRF_GRA }, // 5 Tiles - { "ry-02.rom", 0x004000, 0xd100eaef, BRF_GRA }, // 6 Tiles - - { "epr-6921.117", 0x004000, 0xf19e05a1, BRF_GRA }, // 7 Sprites - { "epr-6923.04", 0x004000, 0x7988adc3, BRF_GRA }, // 8 Sprites - { "epr-6922.110", 0x004000, 0x37f77a78, BRF_GRA }, // 9 Sprites - { "epr-6924.05", 0x004000, 0x42bdc8f6, BRF_GRA }, // 10 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 11 Timing PROM -}; - -STD_ROM_PICK(Myherok) -STD_ROM_FN(Myherok) - -static struct BurnRomInfo NobRomDesc[] = { - { "dm08.1f", 0x008000, 0x98d602d6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "dm10.1k", 0x008000, 0xe7c06663, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "dm09.1h", 0x008000, 0xdc4c872f, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "dm03.9h", 0x004000, 0x415adf76, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "dm01.12b", 0x008000, 0x446fbcdd, BRF_GRA }, // 4 Tiles - { "dm02.13b", 0x008000, 0xf12df039, BRF_GRA }, // 5 Tiles - { "dm00.10b", 0x008000, 0x35f396df, BRF_GRA }, // 6 Tiles - - { "dm04.5f", 0x008000, 0x2442b86d, BRF_GRA }, // 7 Sprites - { "dm06.5k", 0x008000, 0xe33743a6, BRF_GRA }, // 8 Sprites - { "dm05.5h", 0x008000, 0x7fbba01d, BRF_GRA }, // 9 Sprites - { "dm07.5l", 0x008000, 0x85e7a29f, BRF_GRA }, // 10 Sprites - - { "nobo_pr.16d", 0x000100, 0x95010ac2, BRF_GRA }, // 11 Red PROM - { "nobo_pr.15d", 0x000100, 0xc55aac0c, BRF_GRA }, // 12 Green PROM - { "dm-12.ic3", 0x000100, 0xde394cee, BRF_GRA }, // 13 Blue PROM - { "dc-11.6a", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM - - { "dm.bin", 0x001000, 0x6fde9dcb, BRF_PRG | BRF_OPT }, // 15 MCU -}; - -STD_ROM_PICK(Nob) -STD_ROM_FN(Nob) - -static struct BurnRomInfo NobbRomDesc[] = { - { "nobo-t.bin", 0x008000, 0x176fd168, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "nobo-r.bin", 0x008000, 0xd61cf3c9, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "nobo-s.bin", 0x008000, 0xb0e7697f, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "nobo-m.bin", 0x004000, 0x415adf76, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "nobo-k.bin", 0x008000, 0x446fbcdd, BRF_GRA }, // 4 Tiles - { "nobo-j.bin", 0x008000, 0xf12df039, BRF_GRA }, // 5 Tiles - { "nobo-l.bin", 0x008000, 0x35f396df, BRF_GRA }, // 6 Tiles - - { "nobo-q.bin", 0x008000, 0x2442b86d, BRF_GRA }, // 7 Sprites - { "nobo-o.bin", 0x008000, 0xe33743a6, BRF_GRA }, // 8 Sprites - { "nobo-p.bin", 0x008000, 0x7fbba01d, BRF_GRA }, // 9 Sprites - { "nobo-n.bin", 0x008000, 0x85e7a29f, BRF_GRA }, // 10 Sprites - - { "nobo_pr.16d", 0x000100, 0x95010ac2, BRF_GRA }, // 11 Red PROM - { "nobo_pr.15d", 0x000100, 0xc55aac0c, BRF_GRA }, // 12 Green PROM - { "nobo_pr.14d", 0x000100, 0xde394cee, BRF_GRA }, // 13 Blue PROM - { "nobo_pr.13a", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Nobb) -STD_ROM_FN(Nobb) - -static struct BurnRomInfo Pitfall2RomDesc[] = { - { "epr6456a.116", 0x004000, 0xbcc8406b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr6457a.109", 0x004000, 0xa016fd2a, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr6458a.96", 0x004000, 0x5c30b3e8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6462.120", 0x002000, 0x86bb9185, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr6474a.62", 0x002000, 0x9f1711b9, BRF_GRA }, // 4 Tiles - { "epr6473a.61", 0x002000, 0x8e53b8dd, BRF_GRA }, // 5 Tiles - { "epr6472a.64", 0x002000, 0xe0f34a11, BRF_GRA }, // 6 Tiles - { "epr6471a.63", 0x002000, 0xd5bc805c, BRF_GRA }, // 7 Tiles - { "epr6470a.66", 0x002000, 0x1439729f, BRF_GRA }, // 8 Tiles - { "epr6469a.65", 0x002000, 0xe4ac6921, BRF_GRA }, // 9 Tiles - - { "epr6454a.117", 0x004000, 0xa5d96780, BRF_GRA }, // 10 Sprites - { "epr-6455.05", 0x004000, 0x32ee64a1, BRF_GRA }, // 11 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 12 Timing PROM -}; - -STD_ROM_PICK(Pitfall2) -STD_ROM_FN(Pitfall2) - -static struct BurnRomInfo Pitfall2aRomDesc[] = { - { "epr-6505", 0x004000, 0xb6769739, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6506", 0x004000, 0x1ce6aec4, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr6458a.96", 0x004000, 0x5c30b3e8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6462.120", 0x002000, 0x86bb9185, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr6474a.62", 0x002000, 0x9f1711b9, BRF_GRA }, // 4 Tiles - { "epr6473a.61", 0x002000, 0x8e53b8dd, BRF_GRA }, // 5 Tiles - { "epr6472a.64", 0x002000, 0xe0f34a11, BRF_GRA }, // 6 Tiles - { "epr6471a.63", 0x002000, 0xd5bc805c, BRF_GRA }, // 7 Tiles - { "epr6470a.66", 0x002000, 0x1439729f, BRF_GRA }, // 8 Tiles - { "epr6469a.65", 0x002000, 0xe4ac6921, BRF_GRA }, // 9 Tiles - - { "epr6454a.117", 0x004000, 0xa5d96780, BRF_GRA }, // 10 Sprites - { "epr-6455.05", 0x004000, 0x32ee64a1, BRF_GRA }, // 11 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 12 Timing PROM -}; - -STD_ROM_PICK(Pitfall2a) -STD_ROM_FN(Pitfall2a) - -static struct BurnRomInfo Pitfall2uRomDesc[] = { - { "epr-6623.116", 0x004000, 0xbcb47ed6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr6624a.109", 0x004000, 0x6e8b09c1, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6625.96", 0x004000, 0xdc5484ba, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6462.120", 0x002000, 0x86bb9185, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr6474a.62", 0x002000, 0x9f1711b9, BRF_GRA }, // 4 Tiles - { "epr6473a.61", 0x002000, 0x8e53b8dd, BRF_GRA }, // 5 Tiles - { "epr6472a.64", 0x002000, 0xe0f34a11, BRF_GRA }, // 6 Tiles - { "epr6471a.63", 0x002000, 0xd5bc805c, BRF_GRA }, // 7 Tiles - { "epr6470a.66", 0x002000, 0x1439729f, BRF_GRA }, // 8 Tiles - { "epr6469a.65", 0x002000, 0xe4ac6921, BRF_GRA }, // 9 Tiles - - { "epr6454a.117", 0x004000, 0xa5d96780, BRF_GRA }, // 10 Sprites - { "epr-6455.05", 0x004000, 0x32ee64a1, BRF_GRA }, // 11 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 12 Timing PROM -}; - -STD_ROM_PICK(Pitfall2u) -STD_ROM_FN(Pitfall2u) - -static struct BurnRomInfo RaflesiaRomDesc[] = { - { "epr-7411.116", 0x004000, 0x88a0c6c6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-7412.109", 0x004000, 0xd3b8cddf, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-7413.96", 0x004000, 0xb7e688b3, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-7420.120", 0x002000, 0x14387666, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-7419.62", 0x002000, 0xbfd5f34c, BRF_GRA }, // 4 Tiles - { "epr-7418.61", 0x002000, 0xf8cbc9b6, BRF_GRA }, // 5 Tiles - { "epr-7417.64", 0x002000, 0xe63501bc, BRF_GRA }, // 6 Tiles - { "epr-7416.63", 0x002000, 0x093e5693, BRF_GRA }, // 7 Tiles - { "epr-7415.66", 0x002000, 0x1a8d6bd6, BRF_GRA }, // 8 Tiles - { "epr-7414.65", 0x002000, 0x5d20f218, BRF_GRA }, // 9 Tiles - - { "epr-7407.117", 0x004000, 0xf09fc057, BRF_GRA }, // 10 Sprites - { "epr-7409.04", 0x004000, 0x819fedb8, BRF_GRA }, // 11 Sprites - { "epr-7408.110", 0x004000, 0x3189f33c, BRF_GRA }, // 12 Sprites - { "epr-7410.05", 0x004000, 0xced74789, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Raflesia) -STD_ROM_FN(Raflesia) - -static struct BurnRomInfo RegulusRomDesc[] = { - { "epr-5640a.129", 0x002000, 0xdafb1528, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-5641a.130", 0x002000, 0x0fcc850e, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-5642a.131", 0x002000, 0x4feffa17, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-5643a.132", 0x002000, 0xb8ac7eb4, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-5644.133", 0x002000, 0xffd05b7d, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-5645a.134", 0x002000, 0x6b4bf77c, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-5652.3", 0x002000, 0x74edcb98, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-5651.82", 0x002000, 0xf07f3e82, BRF_GRA }, // 7 Tiles - { "epr-5650.65", 0x002000, 0x84c1baa2, BRF_GRA }, // 8 Tiles - { "epr-5649.81", 0x002000, 0x6774c895, BRF_GRA }, // 9 Tiles - { "epr-5648.64", 0x002000, 0x0c69e92a, BRF_GRA }, // 10 Tiles - { "epr-5647.80", 0x002000, 0x9330f7b5, BRF_GRA }, // 11 Tiles - { "epr-5646.63", 0x002000, 0x4dfacbbc, BRF_GRA }, // 12 Tiles - - { "epr-5638.86", 0x004000, 0x617363dd, BRF_GRA }, // 13 Sprites - { "epr-5639.93", 0x004000, 0xa4ec5131, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Regulus) -STD_ROM_FN(Regulus) - -static struct BurnRomInfo RegulusoRomDesc[] = { - { "epr-5640.129", 0x002000, 0x8324d0d4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-5641.130", 0x002000, 0x0a09f5c7, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-5642.131", 0x002000, 0xff27b2f6, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-5643.132", 0x002000, 0x0d867df0, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-5644.133", 0x002000, 0xffd05b7d, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-5645.134", 0x002000, 0x57a2b4b4, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-5652.3", 0x002000, 0x74edcb98, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-5651.82", 0x002000, 0xf07f3e82, BRF_GRA }, // 7 Tiles - { "epr-5650.65", 0x002000, 0x84c1baa2, BRF_GRA }, // 8 Tiles - { "epr-5649.81", 0x002000, 0x6774c895, BRF_GRA }, // 9 Tiles - { "epr-5648.64", 0x002000, 0x0c69e92a, BRF_GRA }, // 10 Tiles - { "epr-5647.80", 0x002000, 0x9330f7b5, BRF_GRA }, // 11 Tiles - { "epr-5646.63", 0x002000, 0x4dfacbbc, BRF_GRA }, // 12 Tiles - - { "epr-5638.86", 0x004000, 0x617363dd, BRF_GRA }, // 13 Sprites - { "epr-5639.93", 0x004000, 0xa4ec5131, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Reguluso) -STD_ROM_FN(Reguluso) - -static struct BurnRomInfo RegulusuRomDesc[] = { - { "epr-5950.129", 0x002000, 0x3b047b67, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-5951.130", 0x002000, 0xd66453ab, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-5952.131", 0x002000, 0xf3d0158a, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-5953.132", 0x002000, 0xa9ad4f44, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-5644.133", 0x002000, 0xffd05b7d, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-5955.134", 0x002000, 0x65ddb2a3, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-5652.3", 0x002000, 0x74edcb98, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-5651.82", 0x002000, 0xf07f3e82, BRF_GRA }, // 7 Tiles - { "epr-5650.65", 0x002000, 0x84c1baa2, BRF_GRA }, // 8 Tiles - { "epr-5649.81", 0x002000, 0x6774c895, BRF_GRA }, // 9 Tiles - { "epr-5648.64", 0x002000, 0x0c69e92a, BRF_GRA }, // 10 Tiles - { "epr-5647.80", 0x002000, 0x9330f7b5, BRF_GRA }, // 11 Tiles - { "epr-5646.63", 0x002000, 0x4dfacbbc, BRF_GRA }, // 12 Tiles - - { "epr-5638.86", 0x004000, 0x617363dd, BRF_GRA }, // 13 Sprites - { "epr-5639.93", 0x004000, 0xa4ec5131, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Regulusu) -STD_ROM_FN(Regulusu) - -static struct BurnRomInfo SeganinjRomDesc[] = { - { "epr-.116", 0x004000, 0xa5d0c9d0, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-.109", 0x004000, 0xb9e6775c, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6552.96", 0x004000, 0xf2eeb0d8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 4 Tiles - { "epr-6592.61", 0x002000, 0x7804db86, BRF_GRA }, // 5 Tiles - { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 6 Tiles - { "epr-6590.63", 0x002000, 0xbf858cad, BRF_GRA }, // 7 Tiles - { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 8 Tiles - { "epr-6588.65", 0x002000, 0xdc931dbb, BRF_GRA }, // 9 Tiles - - { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 10 Sprites - { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 11 Sprites - { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 12 Sprites - { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Seganinj) -STD_ROM_FN(Seganinj) - -static struct BurnRomInfo SeganinjuRomDesc[] = { - { "epr-7149.116", 0x004000, 0xcd9fade7, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-7150.109", 0x004000, 0xc36351e2, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6552.96", 0x004000, 0xf2eeb0d8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 4 Tiles - { "epr-6592.61", 0x002000, 0x7804db86, BRF_GRA }, // 5 Tiles - { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 6 Tiles - { "epr-6590.63", 0x002000, 0xbf858cad, BRF_GRA }, // 7 Tiles - { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 8 Tiles - { "epr-6588.65", 0x002000, 0xdc931dbb, BRF_GRA }, // 9 Tiles - - { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 10 Sprites - { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 11 Sprites - { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 12 Sprites - { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Seganinju) -STD_ROM_FN(Seganinju) - -static struct BurnRomInfo NinjaRomDesc[] = { - { "epr6594.bin", 0x004000, 0x3ef0e5fc, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr6595.bin", 0x004000, 0xb16f13cd, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6552.96", 0x004000, 0xf2eeb0d8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 4 Tiles - { "epr6592.bin", 0x002000, 0x88d0c7a1, BRF_GRA }, // 5 Tiles - { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 6 Tiles - { "epr6590.bin", 0x002000, 0x956e3b61, BRF_GRA }, // 7 Tiles - { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 8 Tiles - { "epr6588.bin", 0x002000, 0x023a14a3, BRF_GRA }, // 9 Tiles - - { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 10 Sprites - { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 11 Sprites - { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 12 Sprites - { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Ninja) -STD_ROM_FN(Ninja) - -static struct BurnRomInfo NprincesRomDesc[] = { - { "epr-6612.129", 0x002000, 0x1b30976f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6613.130", 0x002000, 0x18281f27, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6614.131", 0x002000, 0x69fc3d73, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-6615.132", 0x002000, 0x1d0374c8, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-6577.133", 0x002000, 0x73616e03, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-6617.134", 0x002000, 0x20b6f895, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 7 Tiles - { "epr-6557.61", 0x002000, 0x6eb131d0, BRF_GRA }, // 8 Tiles - { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 9 Tiles - { "epr-6555.63", 0x002000, 0x7f669aac, BRF_GRA }, // 10 Tiles - { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 11 Tiles - { "epr-6553.65", 0x002000, 0xeb82a8fe, BRF_GRA }, // 12 Tiles - - { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 13 Sprites - { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 14 Sprites - { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 15 Sprites - { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 16 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM -}; - -STD_ROM_PICK(Nprinces) -STD_ROM_FN(Nprinces) - -static struct BurnRomInfo NprincesoRomDesc[] = { - { "epr-6550.116", 0x004000, 0x5f6d59f1, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6551.109", 0x004000, 0x1af133b2, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6552.96", 0x004000, 0xf2eeb0d8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 4 Tiles - { "epr-6557.61", 0x002000, 0x6eb131d0, BRF_GRA }, // 5 Tiles - { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 6 Tiles - { "epr-6555.63", 0x002000, 0x7f669aac, BRF_GRA }, // 7 Tiles - { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 8 Tiles - { "epr-6553.65", 0x002000, 0xeb82a8fe, BRF_GRA }, // 9 Tiles - - { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 10 Sprites - { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 11 Sprites - { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 12 Sprites - { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Nprinceso) -STD_ROM_FN(Nprinceso) - -static struct BurnRomInfo NprincesuRomDesc[] = { - { "epr-6573.129", 0x002000, 0xd2919c7d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6574.130", 0x002000, 0x5a132833, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6575.131", 0x002000, 0xa94b0bd4, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-6576.132", 0x002000, 0x27d3bbdb, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-6577.133", 0x002000, 0x73616e03, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-6578.134", 0x002000, 0xab68499f, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 7 Tiles - { "epr-6557.61", 0x002000, 0x6eb131d0, BRF_GRA }, // 8 Tiles - { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 9 Tiles - { "epr-6555.63", 0x002000, 0x7f669aac, BRF_GRA }, // 10 Tiles - { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 11 Tiles - { "epr-6553.65", 0x002000, 0xeb82a8fe, BRF_GRA }, // 12 Tiles - - { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 13 Sprites - { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 14 Sprites - { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 15 Sprites - { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 16 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM -}; - -STD_ROM_PICK(Nprincesu) -STD_ROM_FN(Nprincesu) - -static struct BurnRomInfo NprincesbRomDesc[] = { - { "nprinces.001", 0x004000, 0xe0de073c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "nprinces.002", 0x004000, 0x27219c7f, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6552.96", 0x004000, 0xf2eeb0d8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 4 Tiles - { "epr-6557.61", 0x002000, 0x6eb131d0, BRF_GRA }, // 5 Tiles - { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 6 Tiles - { "epr-6555.63", 0x002000, 0x7f669aac, BRF_GRA }, // 7 Tiles - { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 8 Tiles - { "epr-6553.65", 0x002000, 0xeb82a8fe, BRF_GRA }, // 9 Tiles - - { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 10 Sprites - { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 11 Sprites - { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 12 Sprites - { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM - { "nprinces.129", 0x000100, 0xae765f62, BRF_PRG }, // 15 Decryption Table - { "nprinces.123", 0x000020, 0xed5146e9, BRF_PRG }, // 15 Decryption Table -}; - -STD_ROM_PICK(Nprincesb) -STD_ROM_FN(Nprincesb) - -static struct BurnRomInfo SpatterRomDesc[] = { - { "epr-6392.116", 0x004000, 0x329b4506, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6393.109", 0x004000, 0x3b56e25f, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6394.96", 0x004000, 0x647c1301, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6316.120", 0x002000, 0x1df95511, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6328.62", 0x002000, 0xa2bf2832, BRF_GRA }, // 4 Tiles - { "epr-6397.61", 0x002000, 0xc60d4471, BRF_GRA }, // 5 Tiles - { "epr-6326.64", 0x002000, 0x269fbb4c, BRF_GRA }, // 6 Tiles - { "epr-6396.63", 0x002000, 0xc15ccf3b, BRF_GRA }, // 7 Tiles - { "epr-6324.66", 0x002000, 0x8ab3b563, BRF_GRA }, // 8 Tiles - { "epr-6395.65", 0x002000, 0x3f083065, BRF_GRA }, // 9 Tiles - - { "epr-6306.04", 0x004000, 0xe871e132, BRF_GRA }, // 10 Sprites - { "epr-6308.117", 0x004000, 0x99c2d90e, BRF_GRA }, // 11 Sprites - { "epr-6307.05", 0x004000, 0x0a5ad543, BRF_GRA }, // 12 Sprites - { "epr-6309.110", 0x004000, 0x7423ad98, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Spatter) -STD_ROM_FN(Spatter) - -static struct BurnRomInfo SsanchanRomDesc[] = { - { "epr-6310.116", 0x004000, 0x26b43701, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6311.109", 0x004000, 0xcb2bc620, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6312.96", 0x004000, 0x71b15b47, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6316.120", 0x002000, 0x1df95511, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6328.62", 0x002000, 0xa2bf2832, BRF_GRA }, // 4 Tiles - { "epr-6327.61", 0x002000, 0x53298109, BRF_GRA }, // 5 Tiles - { "epr-6326.64", 0x002000, 0x269fbb4c, BRF_GRA }, // 6 Tiles - { "epr-6325.63", 0x002000, 0xbf038745, BRF_GRA }, // 7 Tiles - { "epr-6324.66", 0x002000, 0x8ab3b563, BRF_GRA }, // 8 Tiles - { "epr-6323.65", 0x002000, 0x0394673c, BRF_GRA }, // 9 Tiles - - { "epr-6306.04", 0x004000, 0xe871e132, BRF_GRA }, // 10 Sprites - { "epr-6308.117", 0x004000, 0x99c2d90e, BRF_GRA }, // 11 Sprites - { "epr-6307.05", 0x004000, 0x0a5ad543, BRF_GRA }, // 12 Sprites - { "epr-6309.110", 0x004000, 0x7423ad98, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Ssanchan) -STD_ROM_FN(Ssanchan) - -static struct BurnRomInfo StarjackRomDesc[] = { - { "epr5320b.129", 0x002000, 0x7ab72ecd, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr5321a.130", 0x002000, 0x38b99050, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr5322a.131", 0x002000, 0x103a595b, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-5323.132", 0x002000, 0x46af0d58, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-5324.133", 0x002000, 0x1e89efe2, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-5325.134", 0x002000, 0xd6e379a1, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-5332.3", 0x002000, 0x7a72ab3d, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-5331.82", 0x002000, 0x251d898f, BRF_GRA }, // 7 Tiles - { "epr-5330.65", 0x002000, 0xeb048745, BRF_GRA }, // 8 Tiles - { "epr-5329.81", 0x002000, 0x3e8bcaed, BRF_GRA }, // 9 Tiles - { "epr-5328.64", 0x002000, 0x9ed7849f, BRF_GRA }, // 10 Tiles - { "epr-5327.80", 0x002000, 0x79e92cb1, BRF_GRA }, // 11 Tiles - { "epr-5326.63", 0x002000, 0xba7e2b47, BRF_GRA }, // 12 Tiles - - { "epr-5318.86", 0x004000, 0x6f2e1fd3, BRF_GRA }, // 13 Sprites - { "epr-5319.93", 0x004000, 0xebee4999, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Starjack) -STD_ROM_FN(Starjack) - -static struct BurnRomInfo StarjacksRomDesc[] = { - { "a1_ic29.129", 0x002000, 0x59a22a1f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a1_ic30.130", 0x002000, 0x7f4597dc, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "a1_ic31.131", 0x002000, 0x6074c046, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "a1_ic32.132", 0x002000, 0x1c48a3fa, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "a1_ic33.133", 0x002000, 0x7598bd51, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "a1_ic34.134", 0x002000, 0xf66fa604, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-5332.3", 0x002000, 0x7a72ab3d, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-5331.82", 0x002000, 0x251d898f, BRF_GRA }, // 7 Tiles - { "a1_ic65.65", 0x002000, 0x0ab1893c, BRF_GRA }, // 8 Tiles - { "epr-5329.81", 0x002000, 0x3e8bcaed, BRF_GRA }, // 9 Tiles - { "a1_ic64.64", 0x002000, 0x7f628ae6, BRF_GRA }, // 10 Tiles - { "epr-5327.80", 0x002000, 0x79e92cb1, BRF_GRA }, // 11 Tiles - { "a1_ic63.63", 0x002000, 0x5bcb253e, BRF_GRA }, // 12 Tiles - - { "a1_ic86.86", 0x004000, 0x6f2e1fd3, BRF_GRA }, // 13 Sprites - { "a1_ic93.93", 0x004000, 0x07987244, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Starjacks) -STD_ROM_FN(Starjacks) - -static struct BurnRomInfo SwatRomDesc[] = { - { "epr5807b.129", 0x002000, 0x93db9c9f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-5808.130", 0x002000, 0x67116665, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-5809.131", 0x002000, 0xfd792fc9, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-5810.132", 0x002000, 0xdc2b279d, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-5811.133", 0x002000, 0x093e3ab1, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-5812.134", 0x002000, 0x5bfd692f, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-5819.3", 0x002000, 0xf6afd0fd, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-5818.82", 0x002000, 0xb22033d9, BRF_GRA }, // 7 Tiles - { "epr-5817.65", 0x002000, 0xfd942797, BRF_GRA }, // 8 Tiles - { "epr-5816.81", 0x002000, 0x4384376d, BRF_GRA }, // 9 Tiles - { "epr-5815.64", 0x002000, 0x16ad046c, BRF_GRA }, // 10 Tiles - { "epr-5814.80", 0x002000, 0xbe721c99, BRF_GRA }, // 11 Tiles - { "epr-5813.63", 0x002000, 0x0d42c27e, BRF_GRA }, // 12 Tiles - - { "epr-5805.86", 0x004000, 0x5a732865, BRF_GRA }, // 13 Sprites - { "epr-5806.93", 0x004000, 0x26ac258c, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Swat) -STD_ROM_FN(Swat) - -static struct BurnRomInfo TeddybbRomDesc[] = { - { "epr-6768.116", 0x004000, 0x5939817e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6769.109", 0x004000, 0x14a98ddd, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6770.96", 0x004000, 0x67b0c7c2, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr6748x.120", 0x002000, 0xc2a1b89d, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6747.62", 0x002000, 0xa0e5aca7, BRF_GRA }, // 4 Tiles - { "epr-6746.61", 0x002000, 0xcdb77e51, BRF_GRA }, // 5 Tiles - { "epr-6745.64", 0x002000, 0x0cab75c3, BRF_GRA }, // 6 Tiles - { "epr-6744.63", 0x002000, 0x0ef8d2cd, BRF_GRA }, // 7 Tiles - { "epr-6743.66", 0x002000, 0xc33062b5, BRF_GRA }, // 8 Tiles - { "epr-6742.65", 0x002000, 0xc457e8c5, BRF_GRA }, // 9 Tiles - - { "epr-6735.117", 0x004000, 0x1be35a97, BRF_GRA }, // 10 Sprites - { "epr-6737.04", 0x004000, 0x6b53aa7a, BRF_GRA }, // 11 Sprites - { "epr-6736.110", 0x004000, 0x565c25d0, BRF_GRA }, // 12 Sprites - { "epr-6738.05", 0x004000, 0xe116285f, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Teddybb) -STD_ROM_FN(Teddybb) - -static struct BurnRomInfo TeddybboRomDesc[] = { - { "epr-6739.116", 0x004000, 0x81a37e69, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-6740.109", 0x004000, 0x715388a9, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-6741.96", 0x004000, 0xe5a74f5f, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-6748.120", 0x002000, 0x9325a1cf, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-6747.62", 0x002000, 0xa0e5aca7, BRF_GRA }, // 4 Tiles - { "epr-6746.61", 0x002000, 0xcdb77e51, BRF_GRA }, // 5 Tiles - { "epr-6745.64", 0x002000, 0x0cab75c3, BRF_GRA }, // 6 Tiles - { "epr-6744.63", 0x002000, 0x0ef8d2cd, BRF_GRA }, // 7 Tiles - { "epr-6743.66", 0x002000, 0xc33062b5, BRF_GRA }, // 8 Tiles - { "epr-6742.65", 0x002000, 0xc457e8c5, BRF_GRA }, // 9 Tiles - - { "epr-6735.117", 0x004000, 0x1be35a97, BRF_GRA }, // 10 Sprites - { "epr-6737.04", 0x004000, 0x6b53aa7a, BRF_GRA }, // 11 Sprites - { "epr-6736.110", 0x004000, 0x565c25d0, BRF_GRA }, // 12 Sprites - { "epr-6738.05", 0x004000, 0xe116285f, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Teddybbo) -STD_ROM_FN(Teddybbo) - -static struct BurnRomInfo UpndownRomDesc[] = { - { "epr5516a.129", 0x002000, 0x038c82da, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr5517a.130", 0x002000, 0x6930e1de, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-5518.131", 0x002000, 0x2a370c99, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-5519.132", 0x002000, 0x9d664a58, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-5520.133", 0x002000, 0x208dfbdf, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-5521.134", 0x002000, 0xe7b8d87a, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-5535.3", 0x002000, 0xcf4e4c45, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-5527.82", 0x002000, 0xb2d616f1, BRF_GRA }, // 7 Tiles - { "epr-5526.65", 0x002000, 0x8a8b33c2, BRF_GRA }, // 8 Tiles - { "epr-5525.81", 0x002000, 0xe749c5ef, BRF_GRA }, // 9 Tiles - { "epr-5524.64", 0x002000, 0x8b886952, BRF_GRA }, // 10 Tiles - { "epr-5523.80", 0x002000, 0xdede35d9, BRF_GRA }, // 11 Tiles - { "epr-5522.63", 0x002000, 0x5e6d9dff, BRF_GRA }, // 12 Tiles - - { "epr-5514.86", 0x004000, 0xfcc0a88b, BRF_GRA }, // 13 Sprites - { "epr-5515.93", 0x004000, 0x60908838, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Upndown) -STD_ROM_FN(Upndown) - -static struct BurnRomInfo UpndownuRomDesc[] = { - { "epr-5679.129", 0x002000, 0xc4f2f9c2, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-5680.130", 0x002000, 0x837f021c, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-5681.131", 0x002000, 0xe1c7ff7e, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-5682.132", 0x002000, 0x4a5edc1e, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-5520.133", 0x002000, 0x208dfbdf, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-5684.133", 0x002000, 0x32fa95da, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-5528.3", 0x002000, 0x00cd44ab, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-5527.82", 0x002000, 0xb2d616f1, BRF_GRA }, // 7 Tiles - { "epr-5526.65", 0x002000, 0x8a8b33c2, BRF_GRA }, // 8 Tiles - { "epr-5525.81", 0x002000, 0xe749c5ef, BRF_GRA }, // 9 Tiles - { "epr-5524.64", 0x002000, 0x8b886952, BRF_GRA }, // 10 Tiles - { "epr-5523.80", 0x002000, 0xdede35d9, BRF_GRA }, // 11 Tiles - { "epr-5522.63", 0x002000, 0x5e6d9dff, BRF_GRA }, // 12 Tiles - - { "epr-5514.86", 0x004000, 0xfcc0a88b, BRF_GRA }, // 13 Sprites - { "epr-5515.93", 0x004000, 0x60908838, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Upndownu) -STD_ROM_FN(Upndownu) - -static struct BurnRomInfo WboyRomDesc[] = { - { "epr-7489.116", 0x004000, 0x130f4b70, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-7490.109", 0x004000, 0x9e656733, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-7491.96", 0x004000, 0x1f7d0efe, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 4 Tiles - { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 5 Tiles - { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 6 Tiles - { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 7 Tiles - { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 8 Tiles - { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 9 Tiles - - { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 10 Sprites - { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 11 Sprites - { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 12 Sprites - { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Wboy) -STD_ROM_FN(Wboy) - -static struct BurnRomInfo WboyoRomDesc[] = { - { "epr-.116", 0x004000, 0x51d27534, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-.109", 0x004000, 0xe29d1cd1, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-7491.96", 0x004000, 0x1f7d0efe, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 4 Tiles - { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 5 Tiles - { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 6 Tiles - { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 7 Tiles - { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 8 Tiles - { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 9 Tiles - - { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 10 Sprites - { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 11 Sprites - { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 12 Sprites - { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Wboyo) -STD_ROM_FN(Wboyo) - -static struct BurnRomInfo Wboy2RomDesc[] = { - { "epr-7587.129", 0x002000, 0x1bbb7354, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "epr-7588.130", 0x002000, 0x21007413, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "epr-7589.131", 0x002000, 0x44b30433, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "epr-7590.132", 0x002000, 0xbb525a0b, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-7591.133", 0x002000, 0x8379aa23, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-7592.134", 0x002000, 0xc767a5d7, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 7 Tiles - { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 8 Tiles - { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 9 Tiles - { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 10 Tiles - { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 11 Tiles - { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 12 Tiles - - { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 13 Sprites - { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 14 Sprites - { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 15 Sprites - { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 16 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM -}; - -STD_ROM_PICK(Wboy2) -STD_ROM_FN(Wboy2) - -static struct BurnRomInfo Wboy2uRomDesc[] = { - { "ic129_02.bin", 0x002000, 0x32c4b709, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ic130_03.bin", 0x002000, 0x56463ede, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "ic131_04.bin", 0x002000, 0x775ed392, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "ic132_05.bin", 0x002000, 0x7b922708, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "epr-7591.133", 0x002000, 0x8379aa23, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "epr-7592.134", 0x002000, 0xc767a5d7, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr7498a.3", 0x002000, 0xc198205c, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 7 Tiles - { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 8 Tiles - { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 9 Tiles - { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 10 Tiles - { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 11 Tiles - { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 12 Tiles - - { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 13 Sprites - { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 14 Sprites - { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 15 Sprites - { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 16 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM -}; - -STD_ROM_PICK(Wboy2u) -STD_ROM_FN(Wboy2u) - -static struct BurnRomInfo Wboy3RomDesc[] = { - { "wb_1", 0x004000, 0xbd6fef49, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "wb_2", 0x004000, 0x4081b624, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "wb_3", 0x004000, 0xc48a0e36, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 4 Tiles - { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 5 Tiles - { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 6 Tiles - { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 7 Tiles - { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 8 Tiles - { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 9 Tiles - - { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 10 Sprites - { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 11 Sprites - { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 12 Sprites - { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Wboy3) -STD_ROM_FN(Wboy3) - -static struct BurnRomInfo Wboy4RomDesc[] = { - { "ic2.bin", 0x008000, 0x48b2c006, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ic3.bin", 0x008000, 0x466cae31, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - - { "7583.126", 0x008000, 0x99334b3c, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code - - { "epr7610.ic62", 0x004000, 0x1685d26a, BRF_GRA }, // 3 Tiles - { "epr7609.ic64", 0x004000, 0x87ecba53, BRF_GRA }, // 4 Tiles - { "epr7608.ic66", 0x004000, 0xe812b3ec, BRF_GRA }, // 5 Tiles - - { "7578.87", 0x008000, 0x6ff1637f, BRF_GRA }, // 6 Sprites - { "7577.86", 0x008000, 0x58b3705e, BRF_GRA }, // 7 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 8 Timing PROM -}; - -STD_ROM_PICK(Wboy4) -STD_ROM_FN(Wboy4) - -static struct BurnRomInfo Wboy5RomDesc[] = { - { "wb1.ic116", 0x004000, 0x6c67407c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "wb_2", 0x004000, 0x4081b624, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "wb_3", 0x004000, 0xc48a0e36, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 4 Tiles - { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 5 Tiles - { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 6 Tiles - { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 7 Tiles - { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 8 Tiles - { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 9 Tiles - - { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 10 Sprites - { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 11 Sprites - { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 12 Sprites - { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Wboy5) -STD_ROM_FN(Wboy5) - -static struct BurnRomInfo WboyuRomDesc[] = { - { "ic116_89.bin", 0x004000, 0x73d8cef0, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ic109_90.bin", 0x004000, 0x29546828, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "ic096_91.bin", 0x004000, 0xc7145c2a, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - - { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code - - { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 4 Tiles - { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 5 Tiles - { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 6 Tiles - { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 7 Tiles - { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 8 Tiles - { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 9 Tiles - - { "ic117_85.bin", 0x004000, 0x1ee96ae8, BRF_GRA }, // 10 Sprites - { "ic004_87.bin", 0x004000, 0x119735bb, BRF_GRA }, // 11 Sprites - { "ic110_86.bin", 0x004000, 0x26d0fac4, BRF_GRA }, // 12 Sprites - { "ic005_88.bin", 0x004000, 0x2602e519, BRF_GRA }, // 13 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM -}; - -STD_ROM_PICK(Wboyu) -STD_ROM_FN(Wboyu) - -static struct BurnRomInfo WbdeluxeRomDesc[] = { - { "wbd1.bin", 0x002000, 0xa1bedbd7, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "ic130_03.bin", 0x002000, 0x56463ede, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "wbd3.bin", 0x002000, 0x6fcdbd4c, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "ic132_05.bin", 0x002000, 0x7b922708, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "wbd5.bin", 0x002000, 0xf6b02902, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "wbd6.bin", 0x002000, 0x43df21fe, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "epr7498a.3", 0x002000, 0xc198205c, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 7 Tiles - { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 8 Tiles - { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 9 Tiles - { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 10 Tiles - { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 11 Tiles - { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 12 Tiles - - { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 13 Sprites - { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 14 Sprites - { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 15 Sprites - { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 16 Sprites - - { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM -}; - -STD_ROM_PICK(Wbdeluxe) -STD_ROM_FN(Wbdeluxe) - -static struct BurnRomInfo WmatchRomDesc[] = { - { "wm.129", 0x002000, 0xb6db4442, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "wm.130", 0x002000, 0x59a0a7a0, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code - { "wm.131", 0x002000, 0x4cb3856a, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code - { "wm.132", 0x002000, 0xe2e44b29, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code - { "wm.133", 0x002000, 0x43a36445, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code - { "wm.134", 0x002000, 0x5624794c, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code - - { "wm.3", 0x002000, 0x50d2afb7, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code - - { "wm.82", 0x002000, 0x540f0bf3, BRF_GRA }, // 7 Tiles - { "wm.65", 0x002000, 0x92c1e39e, BRF_GRA }, // 8 Tiles - { "wm.81", 0x002000, 0x6a01ff2a, BRF_GRA }, // 9 Tiles - { "wm.64", 0x002000, 0xaae6449b, BRF_GRA }, // 10 Tiles - { "wm.80", 0x002000, 0xfc3f0bd4, BRF_GRA }, // 11 Tiles - { "wm.63", 0x002000, 0xc2ce9b93, BRF_GRA }, // 12 Tiles - - { "wm.86", 0x004000, 0x238ae0e5, BRF_GRA }, // 13 Sprites - { "wm.93", 0x004000, 0xa2f19170, BRF_GRA }, // 14 Sprites - - { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM -}; - -STD_ROM_PICK(Wmatch) -STD_ROM_FN(Wmatch) - -/*============================================================================================== -Decode Functions -===============================================================================================*/ - -static void sega_decode(const UINT8 convtable[32][4]) -{ - INT32 A; - - INT32 length = 0x10000; - INT32 cryptlen = 0x8000; - UINT8 *rom = System1Rom1; - UINT8 *decrypted = System1Fetch1; - - for (A = 0x0000;A < cryptlen;A++) - { - INT32 xorval = 0; - - UINT8 src = rom[A]; - - /* pick the translation table from bits 0, 4, 8 and 12 of the address */ - INT32 row = (A & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2) + (((A >> 12) & 1) << 3); - - /* pick the offset in the table from bits 3 and 5 of the source data */ - INT32 col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1); - /* the bottom half of the translation table is the mirror image of the top */ - if (src & 0x80) - { - col = 3 - col; - xorval = 0xa8; - } - - /* decode the opcodes */ - decrypted[A] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval); - - /* decode the data */ - rom[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval); - - if (convtable[2*row][col] == 0xff) /* table incomplete! (for development) */ - decrypted[A] = 0xee; - if (convtable[2*row+1][col] == 0xff) /* table incomplete! (for development) */ - rom[A] = 0xee; - } - - /* this is a kludge to catch anyone who has code that crosses the encrypted/ */ - /* decrypted boundary. ssanchan does it */ - if (length > 0x8000) - { - INT32 bytes = 0x4000; - memcpy(&decrypted[0x8000], &rom[0x8000], bytes); - } -} - -void bullfgtj_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0xa0,0xa8,0x20,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...0...0...0...0 */ - { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...0...0...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...0...1...0 */ - { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...0 */ - { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...1...1...0 */ - { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */ - { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */ - { 0x88,0x08,0xa8,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...0...1 */ - { 0x28,0xa8,0x20,0xa0 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */ - { 0x28,0xa8,0x20,0xa0 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */ - { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */ - { 0x88,0x08,0xa8,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...1 */ - { 0x08,0x28,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */ - { 0x08,0x28,0x00,0x20 }, { 0x88,0x08,0xa8,0x28 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -static void flicky_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x08,0x88,0x00,0x80 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ - { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0x20,0x00 }, /* ...0...0...1...0 */ - { 0x28,0x08,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ - { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...1...0...0 */ - { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ - { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...0...1...1...0 */ - { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */ - { 0x08,0x88,0x00,0x80 }, { 0xa8,0x88,0x28,0x08 }, /* ...1...0...0...0 */ - { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...1 */ - { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */ - { 0xa8,0x88,0x28,0x08 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...1 */ - { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...0 */ - { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...1 */ - { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...1...1...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x88,0x80,0x08,0x00 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -static void hvymetal_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */ - { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ - { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */ - { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...0 */ - { 0xa0,0x20,0xa8,0x28 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...1...0...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...1...0 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -void imsorry_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0x08,0x80,0x00 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...0...0 */ - { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...1 */ - { 0x88,0x08,0xa8,0x28 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...1...0 */ - { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */ - { 0x00,0x20,0x80,0xa0 }, { 0x08,0x00,0x88,0x80 }, /* ...0...1...0...0 */ - { 0x00,0x20,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...0...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...0 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */ - { 0x88,0x08,0x80,0x00 }, { 0x08,0x00,0x88,0x80 }, /* ...1...0...0...0 */ - { 0x08,0x00,0x88,0x80 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...0...1 */ - { 0x08,0x28,0x00,0x20 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...1 */ - { 0x08,0x28,0x00,0x20 }, { 0x08,0x00,0x88,0x80 }, /* ...1...1...0...0 */ - { 0x08,0x28,0x00,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 }, /* ...1...1...1...0 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -void mrviking_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...1...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...1...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -void myheroj_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...0 */ - { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...1 */ - { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...1...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */ - { 0x20,0x00,0xa0,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...0 */ - { 0x80,0xa0,0x88,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...1 */ - { 0x80,0xa0,0x88,0xa8 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...0 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ - { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -void myherok_decode(void) -{ - UINT8 *rom = System1Rom1; - - for (INT32 A = 0; A < 0xc000; A++) - rom[A] = (rom[A] & 0xfc) | ((rom[A] & 1) << 1) | ((rom[A] & 2) >> 1); - - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...0 */ - { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...1 */ - { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...1...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */ - { 0x20,0x00,0xa0,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...0 */ - { 0x80,0xa0,0x88,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...1 */ - { 0x80,0xa0,0x88,0xa8 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...0 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ - { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -static void nprinces_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x08,0x88,0x00,0x80 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...0...0...0 */ - { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...1...0...0 */ - { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */ - { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...0...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -static void pitfall2_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ - { 0x08,0x88,0x28,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...0...0...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...1...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...0 */ - { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...0 */ - { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...1...0...1...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...1...0...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...1...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -static void regulus_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...1...0 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */ - { 0x80,0xa0,0x00,0x20 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */ - { 0x80,0xa0,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */ - { 0x80,0xa0,0x00,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -static void seganinj_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...1 */ - { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...0...1...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...1...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...1...1 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ - { 0xa0,0xa8,0x80,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...0...1 */ - { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */ - { 0xa8,0xa0,0x28,0x20 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...1...0 */ - { 0xa8,0xa0,0x28,0x20 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -void spatter_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0x08,0x80,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...0...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ - { 0x00,0x08,0x20,0x28 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0x80,0x88,0x00,0x08 }, /* ...0...1...0...1 */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0x80,0x88,0x00,0x08 }, /* ...1...0...0...0 */ - { 0x80,0x88,0x00,0x08 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...0 */ - { 0x00,0x08,0x20,0x28 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ - { 0x80,0x88,0x00,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ - { 0x80,0xa0,0x88,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...1...1...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -void swat_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */ - { 0xa0,0xa8,0x80,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ - { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...0 */ - { 0xa0,0x20,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */ - { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...0 */ - { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...1...0...1 */ - { 0xa0,0xa8,0x80,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...1...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -static void teddybb_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x20,0x28,0x00,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...0...0...0 */ - { 0x20,0x28,0x00,0x08 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ - { 0x20,0x28,0x00,0x08 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */ - { 0x80,0x00,0xa0,0x20 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...0 */ - { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...1 */ - { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...1 */ - { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...1 */ - { 0x80,0x00,0xa0,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -void wmatch_decode(void) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...0...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...0...1...0 */ - { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...1 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...0 */ - { 0x08,0x88,0x00,0x80 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...1 */ - { 0xa8,0x28,0x88,0x08 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...1...0 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...1...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...0...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...0 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...1...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...0 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...1...0 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 } /* ...1...1...1...1 */ - }; - - sega_decode(convtable); -} - -static void sega_decode_2(UINT8 *pDest, UINT8 *pDestDec, const UINT8 opcode_xor[64],const INT32 opcode_swap_select[64], - const UINT8 data_xor[64],const INT32 data_swap_select[64]) -{ - INT32 A; - static const UINT8 swaptable[24][4] = - { - { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 }, - { 6,2,4,0 }, { 6,0,2,4 }, { 6,4,0,2 }, { 2,6,4,0 }, - { 4,2,6,0 }, { 4,6,0,2 }, { 6,0,4,2 }, { 0,6,4,2 }, - { 4,0,6,2 }, { 0,4,6,2 }, { 6,2,0,4 }, { 2,6,0,4 }, - { 0,6,2,4 }, { 2,0,6,4 }, { 0,2,6,4 }, { 4,2,0,6 }, - { 2,4,0,6 }, { 4,0,2,6 }, { 2,0,4,6 }, { 0,2,4,6 }, - }; - - - UINT8 *rom = pDest; - UINT8 *decrypted = pDestDec; - - for (A = 0x0000;A < 0x8000;A++) - { - INT32 row; - UINT8 src; - const UINT8 *tbl; - - - src = rom[A]; - - /* pick the translation table from bits 0, 3, 6, 9, 12 and 14 of the address */ - row = (A & 1) + (((A >> 3) & 1) << 1) + (((A >> 6) & 1) << 2) - + (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5); - - /* decode the opcodes */ - tbl = swaptable[opcode_swap_select[row]]; - decrypted[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ opcode_xor[row]; - - /* decode the data */ - tbl = swaptable[data_swap_select[row]]; - rom[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ data_xor[row]; - } - - memcpy(pDestDec + 0x8000, pDest + 0x8000, 0x4000); -} - -static void astrofl_decode(void) -{ - static const UINT8 opcode_xor[64] = - { - 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45, - 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45, - 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50, - 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45, - 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45, - 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50, - }; - - static const UINT8 data_xor[64] = - { - 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40, - 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40, - 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14, - 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40, - 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40, - 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14, - }; - - static const INT32 opcode_swap_select[64] = - { - 0,0,1,1,1,2,2,3,3,4,4,4,5,5,6,6, - 6,7,7,8,8,9,9,9,10,10,11,11,11,12,12,13, - - 8,8,9,9,9,10,10,11,11,12,12,12,13,13,14,14, - 14,15,15,16,16,17,17,17,18,18,19,19,19,20,20,21, - }; - - static const INT32 data_swap_select[64] = - { - 0,0,1,1,2,2,2,3,3,4,4,5,5,5,6,6, - 7,7,7,8,8,9,9,10,10,10,11,11,12,12,12,13, - - 8,8,9,9,10,10,10,11,11,12,12,13,13,13,14,14, - 15,15,15,16,16,17,17,18,18,18,19,19,20,20,20,21, - }; - - sega_decode_2(System1Rom1, System1Fetch1, opcode_xor,opcode_swap_select,data_xor,data_swap_select); -} - -void fdwarrio_decode(void) -{ - static const UINT8 opcode_xor[64] = - { - 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, - 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, - 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, - 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, - 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, - 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, - 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, - 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, - }; - - static const UINT8 data_xor[64] = - { - 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, - 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, - 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, - 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, - 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, - 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, - 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, - 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, - }; - - static const INT32 opcode_swap_select[64] = - { - 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7, - 8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, - 10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11, - }; - - static const INT32 data_swap_select[64] = - { - 4,4,4,4,4,4,4,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7, - 8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, - 10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11, - 12, - }; - - sega_decode_2(System1Rom1, System1Fetch1, opcode_xor,opcode_swap_select,data_xor,data_swap_select); -} - -static void wboy2_decode(void) -{ - static const UINT8 opcode_xor[64] = - { - 0x00,0x45,0x11,0x01,0x44,0x10,0x55,0x05,0x41,0x14,0x04,0x40,0x15,0x51, - 0x01,0x44,0x10,0x00,0x45,0x11,0x54,0x04,0x40,0x15,0x05,0x41,0x14,0x50, - 0x00,0x45,0x11,0x01, - 0x00,0x45,0x11,0x01,0x44,0x10,0x55,0x05,0x41,0x14,0x04,0x40,0x15,0x51, - 0x01,0x44,0x10,0x00,0x45,0x11,0x54,0x04,0x40,0x15,0x05,0x41,0x14,0x50, - 0x00,0x45,0x11,0x01, - }; - - static const UINT8 data_xor[64] = - { - 0x55,0x05,0x41,0x14,0x50,0x00,0x15,0x51,0x01,0x44,0x10,0x55,0x05,0x11, - 0x54,0x04,0x40,0x15,0x51,0x01,0x14,0x50,0x00,0x45,0x11,0x54,0x04,0x10, - 0x55,0x05,0x41,0x14, - 0x55,0x05,0x41,0x14,0x50,0x00,0x15,0x51,0x01,0x44,0x10,0x55,0x05,0x11, - 0x54,0x04,0x40,0x15,0x51,0x01,0x14,0x50,0x00,0x45,0x11,0x54,0x04,0x10, - 0x55,0x05,0x41,0x14, - }; - - static const INT32 opcode_swap_select[64] = - { - 2, - 5,1,5,1,5, - 0,4,0,4,0,4, - 7,3,7,3,7,3, - 6,2,6,2,6, - 1,5,1,5,1,5, - 0,4,0, - - 10, - 13,9,13,9,13, - 8,12,8,12,8,12, - 15,11,15,11,15,11, - 14,10,14,10,14, - 9,13,9,13,9,13, - 8,12,8, - }; - - static const INT32 data_swap_select[64] = - { - 3,7,3,7,3,7, - 2,6,2,6,2, - 5,1,5,1,5,1, - 4,0,4,0,4, - 8, - 3,7,3,7,3, - 6,2,6,2, - - 11,15,11,15,11,15, - 10,14,10,14,10, - 13,9,13,9,13,9, - 12,8,12,8,12, - 16, - 11,15,11,15,11, - 14,10,14,10, - }; - - sega_decode_2(System1Rom1, System1Fetch1, opcode_xor,opcode_swap_select,data_xor,data_swap_select); -} - -void sega_decode_317(UINT8 *pDest, UINT8 *pDestDec, INT32 order, INT32 opcode_shift, INT32 data_shift) -{ - static const UINT8 xor1_317[1+64] = - { - 0x54, - 0x14,0x15,0x41,0x14,0x50,0x55,0x05,0x41,0x01,0x10,0x51,0x05,0x11,0x05,0x14,0x55, - 0x41,0x05,0x04,0x41,0x14,0x10,0x45,0x50,0x00,0x45,0x00,0x00,0x00,0x45,0x00,0x00, - 0x54,0x04,0x15,0x10,0x04,0x05,0x11,0x44,0x04,0x01,0x05,0x00,0x44,0x15,0x40,0x45, - 0x10,0x15,0x51,0x50,0x00,0x15,0x51,0x44,0x15,0x04,0x44,0x44,0x50,0x10,0x04,0x04, - }; - - static const UINT8 xor2_317[2+64] = - { - 0x04, - 0x44, - 0x15,0x51,0x41,0x10,0x15,0x54,0x04,0x51,0x05,0x55,0x05,0x54,0x45,0x04,0x10,0x01, - 0x51,0x55,0x45,0x55,0x45,0x04,0x55,0x40,0x11,0x15,0x01,0x40,0x01,0x11,0x45,0x44, - 0x40,0x05,0x15,0x15,0x01,0x50,0x00,0x44,0x04,0x50,0x51,0x45,0x50,0x54,0x41,0x40, - 0x14,0x40,0x50,0x45,0x10,0x05,0x50,0x01,0x40,0x01,0x50,0x50,0x50,0x44,0x40,0x10, - }; - - static const INT32 swap1_317[1+64] = - { - 7, - 1,11,23,17,23, 0,15,19, - 20,12,10, 0,18,18, 5,20, - 13, 0,18,14, 5, 6,10,21, - 1,11, 9, 3,21, 4, 1,17, - 5, 7,16,13,19,23,20, 2, - 10,23,23,15,10,12, 0,22, - 14, 6,15,11,17,15,21, 0, - 6, 1, 1,18, 5,15,15,20, - }; - - static const INT32 swap2_317[2+64] = - { - 7, - 12, - 18, 8,21, 0,22,21,13,21, - 20,13,20,14, 6, 3, 5,20, - 8,20, 4, 8,17,22, 0, 0, - 6,17,17, 9, 0,16,13,21, - 3, 2,18, 6,11, 3, 3,18, - 18,19, 3, 0, 5, 0,11, 8, - 8, 1, 7, 2,10, 8,10, 2, - 1, 3,12,16, 0,17,10, 1, - }; - - if (order) - sega_decode_2( pDest, pDestDec, xor2_317+opcode_shift, swap2_317+opcode_shift, xor1_317+data_shift, swap1_317+data_shift ); - else - sega_decode_2( pDest, pDestDec, xor1_317+opcode_shift, swap1_317+opcode_shift, xor2_317+data_shift, swap2_317+data_shift ); -} - -static void gardia_decode() -{ - sega_decode_317( System1Rom1, System1Fetch1, 1, 1, 1 ); -} - -static void gardiab_decode() -{ - sega_decode_317( System1Rom1, System1Fetch1, 0, 1, 2 ); -} - -static void blockgal_decode() -{ - mc8123_decrypt_rom(0, 0, System1Rom1, System1Fetch1, System1MC8123Key); -} - -static void myherok_tile_decode() -{ - INT32 A; - UINT8 *rom = System1TempRom; - - /* the first ROM has data lines D0 and D6 swapped. */ - for (A = 0x0000;A < 0x4000;A++) - rom[A] = (rom[A] & 0xbe) | ((rom[A] & 0x01) << 6) | ((rom[A] & 0x40) >> 6); - - /* the second ROM has data lines D1 and D5 swapped. */ - for (A = 0x4000;A < 0x8000;A++) - rom[A] = (rom[A] & 0xdd) | ((rom[A] & 0x02) << 4) | ((rom[A] & 0x20) >> 4); - - /* the third ROM has data lines D0 and D6 swapped. */ - for (A = 0x8000;A < 0xc000;A++) - rom[A] = (rom[A] & 0xbe) | ((rom[A] & 0x01) << 6) | ((rom[A] & 0x40) >> 6); - - /* also, all three ROMs have address lines A4 and A5 swapped. */ - for (A = 0;A < 0xc000;A++) - { - INT32 A1; - UINT8 temp; - - A1 = (A & 0xffcf) | ((A & 0x0010) << 1) | ((A & 0x0020) >> 1); - if (A < A1) - { - temp = rom[A]; - rom[A] = rom[A1]; - rom[A1] = temp; - } - } -} - -/*============================================================================================== -Allocate Memory -===============================================================================================*/ - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - System1Rom1 = Next; Next += 0x020000; - System1Fetch1 = Next; Next += 0x010000; - System1Rom2 = Next; Next += 0x008000; - System1PromRed = Next; Next += 0x000100; - System1PromGreen = Next; Next += 0x000100; - System1PromBlue = Next; Next += 0x000100; - - RamStart = Next; - - System1Ram1 = Next; Next += 0x0020fd; - System1Ram2 = Next; Next += 0x000800; - System1SpriteRam = Next; Next += 0x000200; - System1PaletteRam = Next; Next += 0x000600; - System1BgRam = Next; Next += 0x000800; - System1VideoRam = Next; Next += 0x000700; - System1BgCollisionRam = Next; Next += 0x000400; - System1SprCollisionRam = Next; Next += 0x000400; - System1deRam = Next; Next += 0x000200; - System1efRam = Next; Next += 0x000100; - System1f4Ram = Next; Next += 0x000400; - System1fcRam = Next; Next += 0x000400; - SpriteOnScreenMap = Next; Next += (256 * 256); - - RamEnd = Next; - - System1Sprites = Next; Next += System1SpriteRomSize; - System1Tiles = Next; Next += (System1NumTiles * 8 * 8); - System1TilesPenUsage = (UINT32*)Next; Next += System1NumTiles * sizeof(UINT32); - System1Palette = (UINT32*)Next; Next += 0x000600 * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -/*============================================================================================== -Reset Functions -===============================================================================================*/ - -static INT32 System1DoReset() -{ - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - System1ScrollX[0] = System1ScrollX[1] = System1ScrollY = 0; - System1BgScrollX = 0; - System1BgScrollY = 0; - System1VideoMode = 0; - System1FlipScreen = 0; - System1SoundLatch = 0; - System1RomBank = 0; - NoboranbInp16Step = 0; - NoboranbInp17Step = 0; - NoboranbInp23Step = 0; - BlockgalDial1 = 0; - BlockgalDial2 = 0; - - return 0; -} - -/*============================================================================================== -Memory Handlers -===============================================================================================*/ - -static void System1BankRom() -{ - INT32 BankAddress = (System1RomBank * 0x4000) + 0x10000; - ZetMapArea(0x8000, 0xbfff, 0, System1Rom1 + BankAddress); - ZetMapArea(0x8000, 0xbfff, 2, System1Rom1 + BankAddress); -} - -UINT8 __fastcall System1Z801PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return 0xff - System1Input[0]; - } - - case 0x04: { - return 0xff - System1Input[1]; - } - - case 0x08: { - return 0xff - System1Input[2]; - } - - case 0x0c: { - return System1Dip[0]; - } - - case 0x0d: { - return System1Dip[1]; - } - - case 0x10: { - return System1Dip[1]; - } - - case 0x11: { - return System1Dip[0]; - } - - case 0x15: { - return System1VideoMode; - } - - case 0x19: { - return System1VideoMode; - } - } - - bprintf(PRINT_NORMAL, _T("IO Read %x\n"), a); - return 0; -} - -UINT8 __fastcall BlockgalZ801PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return BlockgalDial1; - } - - case 0x04: { - return BlockgalDial2; - } - - case 0x08: { - return 0xff - System1Input[2]; - } - - case 0x0c: { - return System1Dip[0]; - } - - case 0x0d: { - return System1Dip[1]; - } - - case 0x10: { - return System1Dip[1]; - } - - case 0x11: { - return System1Dip[0]; - } - - case 0x15: { - return System1VideoMode; - } - - case 0x19: { - return System1VideoMode; - } - } - - bprintf(PRINT_NORMAL, _T("IO Read %x\n"), a); - return 0; -} - -UINT8 __fastcall NoboranbZ801PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return 0xff - System1Input[0]; - } - - case 0x04: { - return 0xff - System1Input[1]; - } - - case 0x08: { - return 0xff - System1Input[2]; - } - - case 0x0c: { - return System1Dip[0]; - } - - case 0x0d: { - return System1Dip[1]; - } - - case 0x15: { - return System1VideoMode; - } - - case 0x16: { - return NoboranbInp16Step; - } - - case 0x1c: { - return 0x80; - } - - case 0x22: { - return NoboranbInp17Step; - } - - case 0x23: { - return NoboranbInp23Step; - } - } - - bprintf(PRINT_NORMAL, _T("IO Read %x\n"), a); - return 0; -} - -void __fastcall System1Z801PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x14: - case 0x18: { - System1SoundLatch = d; - - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - return; - } - - case 0x15: - case 0x19: { - System1VideoMode = d; - System1FlipScreen = d & 0x80; - return; - } - } - - bprintf(PRINT_NORMAL, _T("IO Write %x, %x\n"), a, d); -} - -void __fastcall BrainZ801PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x14: - case 0x18: { - System1SoundLatch = d; - - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - return; - } - - case 0x15: - case 0x19: { - System1VideoMode = d; - System1FlipScreen = d & 0x80; - - System1RomBank = ((d & 0x04) >> 2) + ((d & 0x40) >> 5); - System1BankRom(); - return; - } - } - - bprintf(PRINT_NORMAL, _T("IO Write %x, %x\n"), a, d); -} - -void __fastcall NoboranbZ801PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x14: - case 0x18: { - System1SoundLatch = d; - - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - return; - } - - case 0x15: { - System1VideoMode = d; - System1FlipScreen = d & 0x80; - - System1RomBank = ((d & 0x04) >> 2) + ((d & 0x40) >> 5); - System1BankRom(); - return; - } - - case 0x16: { - NoboranbInp16Step = d; - return; - } - - case 0x17: { - NoboranbInp17Step = d; - return; - } - - case 0x24: { - NoboranbInp23Step = d; - return; - } - } - - bprintf(PRINT_NORMAL, _T("IO Write %x, %x\n"), a, d); -} - -void __fastcall System1Z801ProgWrite(UINT16 a, UINT8 d) -{ - if (a >= 0xf000 && a <= 0xf3ff) { System1BgCollisionRam[a - 0xf000] = 0x7e; return; } - if (a >= 0xf800 && a <= 0xfbff) { System1SprCollisionRam[a - 0xf800] = 0x7e; return; } - - switch (a) { - case 0xefbd: { - System1ScrollY = d; - break; - } - - case 0xeffc: { - System1ScrollX[0] = d; - break; - } - - case 0xeffd: { - System1ScrollX[1] = d; - break; - } - } - - if (a >= 0xef00 && a <= 0xefff) { - System1efRam[a - 0xef00] = d; - return; - } - - bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); -} - -void __fastcall NoboranbZ801ProgWrite(UINT16 a, UINT8 d) -{ - if (a >= 0xc000 && a <= 0xc3ff) { System1BgCollisionRam[a - 0xc000] = 0x7e; return; } - if (a >= 0xc800 && a <= 0xcbff) { System1SprCollisionRam[a - 0xc800] = 0x7e; return; } - - switch (a) { - case 0xefbd: { - System1ScrollY = d; - break; - } - - case 0xeffc: { - System1ScrollX[0] = d; - break; - } - - case 0xeffd: { - System1ScrollX[1] = d; - break; - } - } - - if (a >= 0xef00 && a <= 0xefff) { - System1efRam[a - 0xef00] = d; - return; - } - - bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); -} - -UINT8 __fastcall System1Z802ProgRead(UINT16 a) -{ - switch (a) { - case 0xe000: { - return System1SoundLatch; - } - - case 0xffff: { - return System1SoundLatch; - } - } - - bprintf(PRINT_NORMAL, _T("Z80 2 Prog Read %x\n"), a); - return 0; -} - -void __fastcall System1Z802ProgWrite(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xa000: - case 0xa001: - case 0xa002: - case 0xa003: { - SN76496Write(0, d); - return; - } - - case 0xc000: - case 0xc001: - case 0xc002: - case 0xc003: { - SN76496Write(1, d); - return; - } - } - - bprintf(PRINT_NORMAL, _T("Z80 2 Prog Write %x, %x\n"), a, d); -} - -/*============================================================================================== -Driver Inits -===============================================================================================*/ - -static void CalcPenUsage() -{ - INT32 i, x, y; - UINT32 Usage; - UINT8 *dp = NULL; - - for (i = 0; i < System1NumTiles; i++) { - dp = System1Tiles + (i * 64); - Usage = 0; - for (y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) { - Usage |= 1 << dp[x]; - } - - dp += 8; - } - - System1TilesPenUsage[i] = Usage; - } -} - -static INT32 TilePlaneOffsets[3] = { 0, 0x20000, 0x40000 }; -static INT32 NoboranbTilePlaneOffsets[3] = { 0, 0x40000, 0x80000 }; -static INT32 TileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 TileYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; - -static INT32 System1Init(INT32 nZ80Rom1Num, INT32 nZ80Rom1Size, INT32 nZ80Rom2Num, INT32 nZ80Rom2Size, INT32 nTileRomNum, INT32 nTileRomSize, INT32 nSpriteRomNum, INT32 nSpriteRomSize, bool bReset) -{ - INT32 nRet = 0, nLen, i, RomOffset; - - System1NumTiles = (nTileRomNum * nTileRomSize) / 24; - System1SpriteRomSize = nSpriteRomNum * nSpriteRomSize; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - System1TempRom = (UINT8*)BurnMalloc(0x18000); - - // Load Z80 #1 Program roms - RomOffset = 0; - for (i = 0; i < nZ80Rom1Num; i++) { - nRet = BurnLoadRom(System1Rom1 + (i * nZ80Rom1Size), i + RomOffset, 1); if (nRet != 0) return 1; - } - - if (System1BankedRom) { - memcpy(System1TempRom, System1Rom1, 0x18000); - memset(System1Rom1, 0, 0x18000); - memcpy(System1Rom1 + 0x00000, System1TempRom + 0x00000, 0x8000); - memcpy(System1Rom1 + 0x10000, System1TempRom + 0x08000, 0x8000); - memcpy(System1Rom1 + 0x08000, System1TempRom + 0x08000, 0x8000); - memcpy(System1Rom1 + 0x18000, System1TempRom + 0x10000, 0x8000); - } - - if (DecodeFunction) DecodeFunction(); - - // Load Z80 #2 Program roms - RomOffset += nZ80Rom1Num; - for (i = 0; i < nZ80Rom2Num; i++) { - nRet = BurnLoadRom(System1Rom2 + (i * nZ80Rom2Size), i + RomOffset, 1); if (nRet != 0) return 1; - } - - // Load and decode tiles - memset(System1TempRom, 0, 0x18000); - RomOffset += nZ80Rom2Num; - for (i = 0; i < nTileRomNum; i++) { - nRet = BurnLoadRom(System1TempRom + (i * nTileRomSize), i + RomOffset, 1); - } - if (TileDecodeFunction) TileDecodeFunction(); - if (System1NumTiles > 0x800) { - GfxDecode(System1NumTiles, 3, 8, 8, NoboranbTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, System1TempRom, System1Tiles); - } else { - GfxDecode(System1NumTiles, 3, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, System1TempRom, System1Tiles); - } - CalcPenUsage(); - BurnFree(System1TempRom); - - // Load Sprite roms - RomOffset += nTileRomNum; - for (i = 0; i < nSpriteRomNum; i++) { - nRet = BurnLoadRom(System1Sprites + (i * nSpriteRomSize), i + RomOffset, 1); - } - - // Load Colour proms - if (System1ColourProms) { - RomOffset += nSpriteRomNum; - nRet = BurnLoadRom(System1PromRed, 0 + RomOffset, 1); - nRet = BurnLoadRom(System1PromGreen, 1 + RomOffset, 1); - nRet = BurnLoadRom(System1PromBlue, 2 + RomOffset, 1); - } - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetWriteHandler(System1Z801ProgWrite); - ZetSetInHandler(System1Z801PortRead); - ZetSetOutHandler(System1Z801PortWrite); - ZetMapArea(0x0000, 0x7fff, 0, System1Rom1); - ZetMapArea(0x8000, 0xbfff, 0, System1Rom1 + 0x8000); - if (DecodeFunction) { - ZetMapArea(0x0000, 0x7fff, 2, System1Fetch1, System1Rom1); - ZetMapArea(0x8000, 0xbfff, 2, System1Fetch1 + 0x8000, System1Rom1 + 0x8000); - } else { - ZetMapArea(0x0000, 0x7fff, 2, System1Rom1); - ZetMapArea(0x8000, 0xbfff, 2, System1Rom1 + 0x8000); - } - ZetMapArea(0xc000, 0xcfff, 0, System1Ram1); - ZetMapArea(0xc000, 0xcfff, 1, System1Ram1); - ZetMapArea(0xc000, 0xcfff, 2, System1Ram1); - ZetMapArea(0xd000, 0xd1ff, 0, System1SpriteRam); - ZetMapArea(0xd000, 0xd1ff, 1, System1SpriteRam); - ZetMapArea(0xd000, 0xd1ff, 2, System1SpriteRam); - ZetMapArea(0xd200, 0xd7ff, 0, System1Ram1 + 0x1000); - ZetMapArea(0xd200, 0xd7ff, 1, System1Ram1 + 0x1000); - ZetMapArea(0xd200, 0xd7ff, 2, System1Ram1 + 0x1000); - ZetMapArea(0xd800, 0xddff, 0, System1PaletteRam); - ZetMapArea(0xd800, 0xddff, 1, System1PaletteRam); - ZetMapArea(0xd800, 0xddff, 2, System1PaletteRam); - ZetMapArea(0xde00, 0xdfff, 0, System1deRam); - ZetMapArea(0xde00, 0xdfff, 1, System1deRam); - ZetMapArea(0xde00, 0xdfff, 2, System1deRam); - ZetMapArea(0xe000, 0xe7ff, 0, System1BgRam); - ZetMapArea(0xe000, 0xe7ff, 1, System1BgRam); - ZetMapArea(0xe000, 0xe7ff, 2, System1BgRam); - ZetMapArea(0xe800, 0xeeff, 0, System1VideoRam); - ZetMapArea(0xe800, 0xeeff, 1, System1VideoRam); - ZetMapArea(0xe800, 0xeeff, 2, System1VideoRam); - ZetMapArea(0xef00, 0xefff, 0, System1efRam); - ZetMapArea(0xef00, 0xefff, 2, System1efRam); - ZetMapArea(0xf000, 0xf3ff, 0, System1BgCollisionRam); - ZetMapArea(0xf000, 0xf3ff, 2, System1BgCollisionRam); - ZetMapArea(0xf400, 0xf7ff, 0, System1f4Ram); - ZetMapArea(0xf400, 0xf7ff, 1, System1f4Ram); - ZetMapArea(0xf400, 0xf7ff, 2, System1f4Ram); - ZetMapArea(0xf800, 0xfbff, 0, System1SprCollisionRam); - ZetMapArea(0xf800, 0xfbff, 2, System1SprCollisionRam); - ZetMapArea(0xfc00, 0xffff, 0, System1fcRam); - ZetMapArea(0xfc00, 0xffff, 1, System1fcRam); - ZetMapArea(0xfc00, 0xffff, 2, System1fcRam); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(System1Z802ProgRead); - ZetSetWriteHandler(System1Z802ProgWrite); - ZetMapArea(0x0000, 0x7fff, 0, System1Rom2); - ZetMapArea(0x0000, 0x7fff, 2, System1Rom2); - ZetMapArea(0x8000, 0x87ff, 0, System1Ram2); - ZetMapArea(0x8000, 0x87ff, 1, System1Ram2); - ZetMapArea(0x8000, 0x87ff, 2, System1Ram2); - ZetMemEnd(); - ZetClose(); - - memset(SpriteOnScreenMap, 255, 256 * 256); - - System1SpriteXOffset = 1; - - nCyclesTotal[0] = 4000000 / 60; - nCyclesTotal[1] = 4000000 / 60; - - SN76489AInit(0, 2000000, 0); - SN76489AInit(1, 4000000, 1); - SN76496SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - MakeInputsFunction = System1MakeInputs; - System1Draw = System1Render; - - // Reset the driver - if (bReset) System1DoReset(); - - return 0; -} - -static INT32 FourdwarrioInit() -{ - DecodeFunction = fdwarrio_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 BlockgalInit() -{ - INT32 nRet; - - System1MC8123Key = (UINT8*)BurnMalloc(0x2000); - BurnLoadRom(System1MC8123Key, 14, 1); - - DecodeFunction = blockgal_decode; - - nRet = System1Init(2, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); - BurnFree(System1MC8123Key); - - ZetOpen(0); - ZetSetInHandler(BlockgalZ801PortRead); - ZetClose(); - MakeInputsFunction = BlockgalMakeInputs; - - return nRet; -} - -static INT32 BrainInit() -{ - INT32 nRet; - - System1ColourProms = 1; - System1BankedRom = 1; - - nRet = System1Init(3, 0x8000, 1, 0x8000, 3, 0x4000, 3, 0x8000, 0); - - ZetOpen(0); - ZetSetOutHandler(BrainZ801PortWrite); - ZetClose(); - - System1DoReset(); - - return nRet; -} - -static INT32 BullfgtInit() -{ - DecodeFunction = bullfgtj_decode; - - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 ThetogyuInit() -{ - DecodeFunction = bullfgtj_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 FlickyInit() -{ - DecodeFunction = flicky_decode; - - return System1Init(2, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 FlickygInit() -{ - DecodeFunction = flicky_decode; - - return System1Init(2, 0x4000, 1, 0x2000, 3, 0x4000, 2, 0x4000, 1); -} - -static INT32 Flicks1Init() -{ - DecodeFunction = flicky_decode; - - return System1Init(4, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 Flicks2Init() -{ - return System1Init(2, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 Flicks2gInit() -{ - return System1Init(2, 0x4000, 1, 0x2000, 3, 0x4000, 2, 0x4000, 1); -} - -static INT32 GardiaInit() -{ - INT32 nRet; - - System1ColourProms = 1; - System1BankedRom = 1; - - DecodeFunction = gardia_decode; - - nRet = System1Init(3, 0x8000, 1, 0x4000, 3, 0x4000, 4, 0x8000, 0); - - ZetOpen(0); - ZetSetOutHandler(BrainZ801PortWrite); - ZetClose(); - - System1DoReset(); - - return nRet; -} - -static INT32 GardiabInit() -{ - INT32 nRet; - - System1ColourProms = 1; - System1BankedRom = 1; - - DecodeFunction = gardiab_decode; - - nRet = System1Init(3, 0x8000, 1, 0x4000, 3, 0x4000, 4, 0x8000, 0); - - ZetOpen(0); - ZetSetOutHandler(BrainZ801PortWrite); - ZetClose(); - - System1DoReset(); - - return nRet; -} - -static INT32 HvymetalInit() -{ - INT32 nRet; - - System1ColourProms = 1; - System1BankedRom = 1; - - DecodeFunction = hvymetal_decode; - - nRet = System1Init(3, 0x8000, 1, 0x8000, 6, 0x4000, 4, 0x8000, 0); - - ZetOpen(0); - ZetSetOutHandler(BrainZ801PortWrite); - ZetClose(); - - System1DoReset(); - - return nRet; -} - -static INT32 ImsorryInit() -{ - DecodeFunction = imsorry_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 MrvikingInit() -{ - DecodeFunction = mrviking_decode; - - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 MyheroInit() -{ - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 SscandalInit() -{ - DecodeFunction = myheroj_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 MyherokInit() -{ - DecodeFunction = myherok_decode; - TileDecodeFunction = myherok_tile_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 3, 0x4000, 4, 0x4000, 1); -} - -static INT32 NobbInit() -{ - INT32 nRet; - - System1ColourProms = 1; - System1BankedRom = 1; - - nRet = System1Init(3, 0x8000, 1, 0x4000, 3, 0x8000, 4, 0x8000, 0); - nCyclesTotal[0] = 8000000 / 60; - System1Rom2[0x02f9] = 0x28; - - ZetOpen(0); - ZetSetWriteHandler(NoboranbZ801ProgWrite); - ZetSetInHandler(NoboranbZ801PortRead); - ZetSetOutHandler(NoboranbZ801PortWrite); - ZetMemCallback(0xc000, 0xffff, 0); - ZetMemCallback(0xc000, 0xffff, 1); - ZetMemCallback(0xc000, 0xffff, 2); - ZetMapArea(0xc000, 0xc3ff, 0, System1BgCollisionRam); - ZetMapArea(0xc000, 0xc3ff, 2, System1BgCollisionRam); - ZetMapArea(0xc400, 0xc7ff, 0, System1f4Ram); - ZetMapArea(0xc400, 0xc7ff, 1, System1f4Ram); - ZetMapArea(0xc400, 0xc7ff, 2, System1f4Ram); - ZetMapArea(0xc800, 0xcbff, 0, System1SprCollisionRam); - ZetMapArea(0xc800, 0xcbff, 2, System1SprCollisionRam); - ZetMapArea(0xcc00, 0xcfff, 0, System1fcRam); - ZetMapArea(0xcc00, 0xcfff, 1, System1fcRam); - ZetMapArea(0xcc00, 0xcfff, 2, System1fcRam); - ZetMapArea(0xd000, 0xd1ff, 0, System1SpriteRam); - ZetMapArea(0xd000, 0xd1ff, 1, System1SpriteRam); - ZetMapArea(0xd000, 0xd1ff, 2, System1SpriteRam); - ZetMapArea(0xd200, 0xd7ff, 0, System1Ram1 + 0x1000); - ZetMapArea(0xd200, 0xd7ff, 1, System1Ram1 + 0x1000); - ZetMapArea(0xd200, 0xd7ff, 2, System1Ram1 + 0x1000); - ZetMapArea(0xd800, 0xddff, 0, System1PaletteRam); - ZetMapArea(0xd800, 0xddff, 1, System1PaletteRam); - ZetMapArea(0xd800, 0xddff, 2, System1PaletteRam); - ZetMapArea(0xde00, 0xdfff, 0, System1deRam); - ZetMapArea(0xde00, 0xdfff, 1, System1deRam); - ZetMapArea(0xde00, 0xdfff, 2, System1deRam); - ZetMapArea(0xe000, 0xe7ff, 0, System1BgRam); - ZetMapArea(0xe000, 0xe7ff, 1, System1BgRam); - ZetMapArea(0xe000, 0xe7ff, 2, System1BgRam); - ZetMapArea(0xe800, 0xeeff, 0, System1VideoRam); - ZetMapArea(0xe800, 0xeeff, 1, System1VideoRam); - ZetMapArea(0xe800, 0xeeff, 2, System1VideoRam); - ZetMapArea(0xef00, 0xefff, 0, System1efRam); - ZetMapArea(0xef00, 0xefff, 2, System1efRam); - ZetMapArea(0xf000, 0xffff, 0, System1Ram1); - ZetMapArea(0xf000, 0xffff, 1, System1Ram1); - ZetMapArea(0xf000, 0xffff, 2, System1Ram1); - ZetClose(); - - System1DoReset(); - - return nRet; -} - -static INT32 Pitfall2Init() -{ - INT32 nRet; - - DecodeFunction = pitfall2_decode; - - nRet = System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); - nCyclesTotal[0] = 3600000 / 60; - - return nRet; -} - -static INT32 PitfalluInit() -{ - INT32 nRet; - - nRet = System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); - nCyclesTotal[0] = 3600000 / 60; - - return nRet; -} - -static INT32 RaflesiaInit() -{ - DecodeFunction = fdwarrio_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 RegulusInit() -{ - DecodeFunction = regulus_decode; - - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 RegulusuInit() -{ - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 SeganinjInit() -{ - DecodeFunction = seganinj_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 SeganinuInit() -{ - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 NprincesInit() -{ - DecodeFunction = flicky_decode; - - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 NprincsoInit() -{ - DecodeFunction = nprinces_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 NprincsuInit() -{ - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 NprincsbInit() -{ - DecodeFunction = flicky_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 SpatterInit() -{ - DecodeFunction = spatter_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 StarjackInit() -{ - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 SwatInit() -{ - DecodeFunction = swat_decode; - - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 TeddybbInit() -{ - DecodeFunction = teddybb_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 UpndownInit() -{ - DecodeFunction = nprinces_decode; - - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 UpndownuInit() -{ - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 WboyInit() -{ - DecodeFunction = astrofl_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 WboyoInit() -{ - DecodeFunction = hvymetal_decode; - - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 Wboy2Init() -{ - DecodeFunction = wboy2_decode; - - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 Wboy2uInit() -{ - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 Wboy4Init() -{ - DecodeFunction = fdwarrio_decode; - - return System1Init(2, 0x8000, 1, 0x8000, 3, 0x4000, 2, 0x8000, 1); -} - -static INT32 WboyuInit() -{ - return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); -} - -static INT32 WmatchInit() -{ - DecodeFunction = wmatch_decode; - - return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); -} - -static INT32 System1Exit() -{ - ZetExit(); - - SN76496Exit(); - - GenericTilesExit(); - - BurnFree(Mem); - - System1SoundLatch = 0; - System1ScrollX[0] = System1ScrollX[1] = System1ScrollY = 0; - System1BgScrollX = 0; - System1BgScrollY = 0; - System1VideoMode = 0; - System1FlipScreen = 0; - System1RomBank = 0; - NoboranbInp16Step = 0; - NoboranbInp17Step = 0; - NoboranbInp23Step = 0; - BlockgalDial1 = 0; - BlockgalDial2 = 0; - - System1SpriteRomSize = 0; - System1NumTiles = 0; - System1SpriteXOffset = 0; - System1ColourProms = 0; - System1BankedRom = 0; - - DecodeFunction = NULL; - TileDecodeFunction = NULL; - MakeInputsFunction = NULL; - System1Draw = NULL; - - return 0; -} - -/*============================================================================================== -Graphics Rendering -===============================================================================================*/ - -static void DrawPixel(INT32 x, INT32 y, INT32 SpriteNum, INT32 Colour) -{ - INT32 xr, yr, SpriteOnScreen, dx, dy; - - dx = x; - dy = y; - if (nScreenWidth == 240) dx -= 8; - - if (x < 0 || x > 255 || y < 0 || y > 255) return; - - if (SpriteOnScreenMap[(y * 256) + x] != 255) { - SpriteOnScreen = SpriteOnScreenMap[(y * 256) + x]; - System1SprCollisionRam[SpriteOnScreen + (32 * SpriteNum)] = 0xff; - } - - SpriteOnScreenMap[(y * 256) + x] = SpriteNum; - - if (dx >= 0 && dx < nScreenWidth && dy >= 0 && dy < nScreenHeight) { - UINT16 *pPixel = pTransDraw + (dy * nScreenWidth); - pPixel[dx] = Colour; - } - - xr = ((x - System1BgScrollX) & 0xff) / 8; - yr = ((y - System1BgScrollY) & 0xff) / 8; - - if (System1BgRam[2 * (32 * yr + xr) + 1] & 0x10) { - System1BgCollisionRam[0x20 + SpriteNum] = 0xff; - } -} - -static void DrawSprite(INT32 Num) -{ - INT32 Src, Bank, Height, sy, Row; - INT16 Skip; - UINT8 *SpriteBase; - UINT32 *SpritePalette; - - SpriteBase = System1SpriteRam + (0x10 * Num); - Src = (SpriteBase[7] << 8) | SpriteBase[6]; - Bank = 0x8000 * (((SpriteBase[3] & 0x80) >> 7) + ((SpriteBase[3] & 0x40) >> 5)); - Bank &= (System1SpriteRomSize - 1); - Skip = (SpriteBase[5] << 8) | SpriteBase[4]; - - Height = SpriteBase[1] - SpriteBase[0]; - SpritePalette = System1Palette + (0x10 * Num); - - sy = SpriteBase[0] + 1; - - for (Row = 0; Row < Height; Row++) { - INT32 x, y, Src2; - - Src = Src2 = Src + Skip; - x = ((SpriteBase[3] & 0x01) << 8) + SpriteBase[2] + System1SpriteXOffset; - y = sy + Row; - - x /= 2; - - while(1) { - INT32 Colour1, Colour2, Data; - - Data = System1Sprites[Bank + (Src2 & 0x7fff)]; - - if (Src & 0x8000) { - Src2--; - Colour1 = Data & 0x0f; - Colour2 = Data >> 4; - } else { - Src2++; - Colour1 = Data >> 4; - Colour2 = Data & 0x0f; - } - - if (Colour1 == 0x0f) break; - if (Colour1) DrawPixel(x, y, Num, Colour1 + (0x10 * Num)); - x++; - - if (Colour2 == 0x0f) break; - if (Colour2) DrawPixel(x, y, Num, Colour2 + (0x10 * Num)); - x++; - } - } -} - -static void System1DrawSprites() -{ - INT32 i, SpriteBottomY, SpriteTopY; - UINT8 *SpriteBase; - - memset(SpriteOnScreenMap, 255, 256 * 256); - - for (i = 0; i < 32; i++) { - SpriteBase = System1SpriteRam + (0x10 * i); - SpriteTopY = SpriteBase[0]; - SpriteBottomY = SpriteBase[1]; - if (SpriteBottomY && (SpriteBottomY - SpriteTopY > 0)) { - DrawSprite(i); - } - } -} - -static void System1DrawBgLayer(INT32 PriorityDraw) -{ - INT32 Offs, sx, sy; - - System1BgScrollX = ((System1ScrollX[0] >> 1) + ((System1ScrollX[1] & 1) << 7) + 14) & 0xff; - System1BgScrollY = (-System1ScrollY & 0xff); - - if (PriorityDraw == -1) { - for (Offs = 0; Offs < 0x800; Offs += 2) { - INT32 Code, Colour; - - Code = (System1BgRam[Offs + 1] << 8) | System1BgRam[Offs + 0]; - Code = ((Code >> 4) & 0x800) | (Code & 0x7ff); - Colour = ((Code >> 5) & 0x3f); - - sx = (Offs >> 1) % 32; - sy = (Offs >> 1) / 32; - - sx = 8 * sx + System1BgScrollX; - sy = 8 * sy + System1BgScrollY; - - if (nScreenWidth == 240) sx -= 8; - - Code &= (System1NumTiles - 1); - - Render8x8Tile_Clip(pTransDraw, Code, sx , sy , Colour, 3, 512 * 2, System1Tiles); - Render8x8Tile_Clip(pTransDraw, Code, sx - 256, sy , Colour, 3, 512 * 2, System1Tiles); - Render8x8Tile_Clip(pTransDraw, Code, sx , sy - 256, Colour, 3, 512 * 2, System1Tiles); - Render8x8Tile_Clip(pTransDraw, Code, sx - 256, sy - 256, Colour, 3, 512 * 2, System1Tiles); - } - } else { - PriorityDraw <<= 3; - - for (Offs = 0; Offs < 0x800; Offs += 2) { - if ((System1BgRam[Offs + 1] & 0x08) == PriorityDraw) { - INT32 Code, Colour; - - Code = (System1BgRam[Offs + 1] << 8) | System1BgRam[Offs + 0]; - Code = ((Code >> 4) & 0x800) | (Code & 0x7ff); - Colour = ((Code >> 5) & 0x3f); - - INT32 ColourOffs = 0x40; - if (Colour >= 0x10 && Colour <= 0x1f) ColourOffs += 0x10; - if (Colour >= 0x20 && Colour <= 0x2f) ColourOffs += 0x20; - if (Colour >= 0x30 && Colour <= 0x3f) ColourOffs += 0x30; - - sx = (Offs >> 1) % 32; - sy = (Offs >> 1) / 32; - - sx = 8 * sx + System1BgScrollX; - sy = 8 * sy + System1BgScrollY; - - if (nScreenWidth == 240) sx -= 8; - - Code &= (System1NumTiles - 1); - - Render8x8Tile_Mask_Clip(pTransDraw, Code, sx , sy , Colour, 3, 0, 512 * 2, System1Tiles); - Render8x8Tile_Mask_Clip(pTransDraw, Code, sx - 256, sy , Colour, 3, 0, 512 * 2, System1Tiles); - Render8x8Tile_Mask_Clip(pTransDraw, Code, sx , sy - 256, Colour, 3, 0, 512 * 2, System1Tiles); - Render8x8Tile_Mask_Clip(pTransDraw, Code, sx - 256, sy - 256, Colour, 3, 0, 512 * 2, System1Tiles); - } - } - } -} - -static void System1DrawFgLayer(INT32 PriorityDraw) -{ - INT32 Offs, sx, sy; - - PriorityDraw <<= 3; - - for (Offs = 0; Offs < 0x700; Offs += 2) { - INT32 Code, Colour; - - if ((System1VideoRam[Offs + 1] & 0x08) == PriorityDraw) { - Code = (System1VideoRam[Offs + 1] << 8) | System1VideoRam[Offs + 0]; - Code = ((Code >> 4) & 0x800) | (Code & 0x7ff); - Colour = (Code >> 5) & 0x3f; - - sx = (Offs >> 1) % 32; - sy = (Offs >> 1) / 32; - - sx *= 8; - sy *= 8; - - if (nScreenWidth == 240) sx -= 8; - - Code %= System1NumTiles; - Code &= (System1NumTiles - 1); - - if (System1TilesPenUsage[Code] & ~1) { - Render8x8Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 3, 0, 512, System1Tiles); - } - } - } -} - -static inline UINT8 pal2bit(UINT8 bits) -{ - bits &= 3; - return (bits << 6) | (bits << 4) | (bits << 2) | bits; -} - -static inline UINT8 pal3bit(UINT8 bits) -{ - bits &= 7; - return (bits << 5) | (bits << 2) | (bits >> 1); -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal3bit(nColour >> 0); - g = pal3bit(nColour >> 3); - b = pal2bit(nColour >> 6); - - return BurnHighCol(r, g, b, 0); -} - -static INT32 System1CalcPalette() -{ - if (System1ColourProms) { - INT32 i; - for (i = 0; i < 0x600; i++) { - INT32 bit0, bit1, bit2, bit3, r, g, b, val; - - val = System1PromRed[System1PaletteRam[i]]; - bit0 = (val >> 0) & 0x01; - bit1 = (val >> 1) & 0x01; - bit2 = (val >> 2) & 0x01; - bit3 = (val >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - val = System1PromGreen[System1PaletteRam[i]]; - bit0 = (val >> 0) & 0x01; - bit1 = (val >> 1) & 0x01; - bit2 = (val >> 2) & 0x01; - bit3 = (val >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - val = System1PromBlue[System1PaletteRam[i]]; - bit0 = (val >> 0) & 0x01; - bit1 = (val >> 1) & 0x01; - bit2 = (val >> 2) & 0x01; - bit3 = (val >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - System1Palette[i] = BurnHighCol(r, g, b, 0); - } - } else { - for (INT32 i = 0; i < 0x600; i++) { - System1Palette[i] = CalcCol(System1PaletteRam[i]); - } - } - - return 0; -} - -static void System1Render() -{ - BurnTransferClear(); - System1CalcPalette(); - System1DrawBgLayer(-1); - System1DrawFgLayer(0); - System1DrawBgLayer(0); - System1DrawSprites(); - System1DrawBgLayer(1); - System1DrawFgLayer(1); - if (System1VideoMode & 0x010) BurnTransferClear(); - BurnTransferCopy(System1Palette); -} -/* -static void WbmlRender() -{ - BurnTransferClear(); - System1CalcPalette(); - System1DrawSprites(); - if (System1VideoMode & 0x010) BurnTransferClear(); - BurnTransferCopy(System1Palette); -} -*/ -/*============================================================================================== -Frame functions -===============================================================================================*/ - -INT32 System1Frame() -{ - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - - if (System1Reset) System1DoReset(); - - MakeInputsFunction(); - - nCyclesDone[0] = nCyclesDone[1] = 0; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 9) ZetRaiseIrq(0); - ZetClose(); - - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 2 || i == 4 || i == 6 || i == 8) ZetRaiseIrq(0); - ZetClose(); - - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - SN76496Update(0, pSoundBuf, nSegmentLength); - SN76496Update(1, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - SN76496Update(0, pSoundBuf, nSegmentLength); - SN76496Update(1, pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) System1Draw(); - - return 0; -} - -/*============================================================================================== -Scan Driver -===============================================================================================*/ - -static INT32 System1Scan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029675; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - SN76496Scan(nAction, pnMin); - - ScanVar(System1ScrollX, 2, "ScrollX"); - - SCAN_VAR(nCyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(System1Dip); - SCAN_VAR(System1Input); - SCAN_VAR(System1ScrollY); - SCAN_VAR(System1BgScrollX); - SCAN_VAR(System1BgScrollY); - SCAN_VAR(System1VideoMode); - SCAN_VAR(System1FlipScreen); - SCAN_VAR(System1SoundLatch); - SCAN_VAR(System1RomBank); - SCAN_VAR(NoboranbInp16Step); - SCAN_VAR(NoboranbInp17Step); - SCAN_VAR(NoboranbInp23Step); - SCAN_VAR(BlockgalDial1); - SCAN_VAR(BlockgalDial2); - - if (nAction & ACB_WRITE) { - if (System1BankedRom) { - ZetOpen(0); - System1BankRom(); - ZetClose(); - } - } - } - - return 0; -} - -/*============================================================================================== -Driver defs -===============================================================================================*/ - -struct BurnDriver BurnDrvFourdwarrio = { - "4dwarrio", NULL, NULL, NULL, "1985", - "4-D Warriors (315-5162)\0", NULL, "Coreland / Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_HORSHOOT, 0, - NULL, FourdwarrioRomInfo, FourdwarrioRomName, NULL, NULL, MyheroInputInfo, FourdwarrioDIPInfo, - FourdwarrioInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBlockgal = { - "blockgal", NULL, NULL, NULL, "1987", - "Block Gal (MC-8123B, 317-0029)\0", NULL, "Sega / Vic Tokai", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_SEGA_SYSTEM1, GBF_PUZZLE, 0, - NULL, BlockgalRomInfo, BlockgalRomName, NULL, NULL, BlockgalInputInfo, BlockgalDIPInfo, - BlockgalInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvBrain = { - "brain", NULL, NULL, NULL, "1986", - "Brain\0", NULL, "Coreland / Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_HORSHOOT, 0, - NULL, BrainRomInfo, BrainRomName, NULL, NULL, MyheroInputInfo, BrainDIPInfo, - BrainInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBullfgt = { - "bullfgt", NULL, NULL, NULL, "1984", - "Bullfight (315-5065)\0", NULL, "Coreland / Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_MISC, 0, - NULL, BullfgtRomInfo, BullfgtRomName, NULL, NULL, MyheroInputInfo, BullfgtDIPInfo, - BullfgtInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvThetogyu = { - "thetogyu", "bullfgt", NULL, NULL, "1984", - "The Togyu (315-5065, Japan)\0", NULL, "Coreland / Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_MISC, 0, - NULL, ThetogyuRomInfo, ThetogyuRomName, NULL, NULL, MyheroInputInfo, BullfgtDIPInfo, - ThetogyuInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFlicky = { - "flicky", NULL, NULL, NULL, "1984", - "Flicky (128k Version, System 2, 315-5051)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, FlickyRomInfo, FlickyRomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, - FlickyInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFlickyg = { - "flickyg", "flicky", NULL, NULL, "1984", - "Flicky (128k Version, System 2, 315-5051, alt graphics)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, FlickygRomInfo, FlickygRomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, - FlickygInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFlickys1 = { - "flickys1", "flicky", NULL, NULL, "1984", - "Flicky (64k Version, System 1, 315-5051, set 2)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Flickys1RomInfo, Flickys1RomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, - Flicks1Init, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFlickys2 = { - "flickys2", "flicky", NULL, NULL, "1984", - "Flicky (128k Version, System 2, not encrypted)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Flickys2RomInfo, Flickys2RomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, - Flicks2Init, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFlickys2g = { - "flickys2g", "flicky", NULL, NULL, "1984", - "Flicky (128k Version, System 2, not encrypted, alt graphics)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Flickys2gRomInfo, Flickys2gRomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, - Flicks2gInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFlickyo = { - "flickyo", "flicky", NULL, NULL, "1984", - "Flicky (64k Version, System 1, 315-5051, set 1)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, FlickyoRomInfo, FlickyoRomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, - Flicks1Init, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGardia = { - "gardia", NULL, NULL, NULL, "1986", - "Gardia (317-0006)\0", NULL, "Sega / Coreland", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, GardiaRomInfo, GardiaRomName, NULL, NULL, MyheroInputInfo, GardiaDIPInfo, - GardiaInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriverD BurnDrvGardiab = { - "gardiab", "gardia", NULL, NULL, "1986", - "Gardia (317-0007?, bootleg)\0", NULL, "Sega / Coreland", "System 1", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, GardiabRomInfo, GardiabRomName, NULL, NULL, MyheroInputInfo, GardiaDIPInfo, - GardiabInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvHvymetal = { - "hvymetal", NULL, NULL, NULL, "1985", - "Heavy Metal (315-5135)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, HvymetalRomInfo, HvymetalRomName, NULL, NULL, MyheroInputInfo, HvymetalDIPInfo, - HvymetalInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvImsorry = { - "imsorry", NULL, NULL, NULL, "1985", - "I'm Sorry (315-5110, US)\0", NULL, "Coreland / Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_MAZE, 0, - NULL, ImsorryRomInfo, ImsorryRomName, NULL, NULL, MyheroInputInfo, ImsorryDIPInfo, - ImsorryInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvImsorryj = { - "imsorryj", "imsorry", NULL, NULL, "1985", - "Gonbee no I'm Sorry (315-5110, Japan)\0", NULL, "Coreland / Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_MAZE, 0, - NULL, ImsorryjRomInfo, ImsorryjRomName, NULL, NULL, MyheroInputInfo, ImsorryDIPInfo, - ImsorryInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMrviking = { - "mrviking", NULL, NULL, NULL, "1984", - "Mister Viking (315-5041)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, MrvikingRomInfo, MrvikingRomName, NULL, NULL, MyheroInputInfo, MrvikingDIPInfo, - MrvikingInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 240, 3, 4 -}; - -struct BurnDriver BurnDrvMrvikingj = { - "mrvikingj", "mrviking", NULL, NULL, "1984", - "Mister Viking (315-5041, Japan)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, MrvikingjRomInfo, MrvikingjRomName, NULL, NULL, MyheroInputInfo, MrvikngjDIPInfo, - MrvikingInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 240, 3, 4 -}; - -struct BurnDriver BurnDrvMyhero = { - "myhero", NULL, NULL, NULL, "1985", - "My Hero (US, not encrypted)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, MyheroRomInfo, MyheroRomName, NULL, NULL, MyheroInputInfo, MyheroDIPInfo, - MyheroInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSscandal = { - "sscandal", "myhero", NULL, NULL, "1985", - "Seishun Scandal (315-5132, Japan)\0", NULL, "Coreland / Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, SscandalRomInfo, SscandalRomName, NULL, NULL, MyheroInputInfo, MyheroDIPInfo, - SscandalInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMyherok = { - "myherok", "myhero", NULL, NULL, "1985", - "My Hero (Korea)\0", NULL, "Coreland / Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, MyherokRomInfo, MyherokRomName, NULL, NULL, MyheroInputInfo, MyheroDIPInfo, - MyherokInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNob = { - "nob", NULL, NULL, NULL, "1986", - "Noboranka (Japan)\0", NULL, "Data East Corporation", "System 1", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, NobRomInfo, NobRomName, NULL, NULL, MyheroInputInfo, NobbDIPInfo, - NobbInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 240, 3, 4 -}; - -struct BurnDriver BurnDrvNobb = { - "nobb", "nob", NULL, NULL, "1986", - "Noboranka (Japan, bootleg)\0", NULL, "bootleg", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, NobbRomInfo, NobbRomName, NULL, NULL, MyheroInputInfo, NobbDIPInfo, - NobbInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 240, 3, 4 -}; - -struct BurnDriver BurnDrvPitfall2 = { - "pitfall2", NULL, NULL, NULL, "1985", - "Pitfall II (315-5093)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Pitfall2RomInfo, Pitfall2RomName, NULL, NULL, MyheroInputInfo, Pitfall2DIPInfo, - Pitfall2Init, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPitfall2a = { - "pitfall2a", "pitfall2", NULL, NULL, "1985", - "Pitfall II (315-5093, Flicky Conversion)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Pitfall2aRomInfo, Pitfall2aRomName, NULL, NULL, MyheroInputInfo, Pitfall2DIPInfo, - Pitfall2Init, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPitfall2u = { - "pitfall2u", "pitfall2", NULL, NULL, "1985", - "Pitfall II (not encrypted)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Pitfall2uRomInfo, Pitfall2uRomName, NULL, NULL, MyheroInputInfo, PitfalluDIPInfo, - PitfalluInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvRaflesia = { - "raflesia", NULL, NULL, NULL, "1986", - "Rafflesia (315-5162)\0", NULL, "Coreland / Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, RaflesiaRomInfo, RaflesiaRomName, NULL, NULL, MyheroInputInfo, RaflesiaDIPInfo, - RaflesiaInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvRegulus = { - "regulus", NULL, NULL, NULL, "1983", - "Regulus (315-5033, rev. A)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, RegulusRomInfo, RegulusRomName, NULL, NULL, MyheroInputInfo, RegulusDIPInfo, - RegulusInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 240, 3, 4 -}; - -struct BurnDriver BurnDrvReguluso = { - "reguluso", "regulus", NULL, NULL, "1983", - "Regulus (315-5033)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, RegulusoRomInfo, RegulusoRomName, NULL, NULL, MyheroInputInfo, RegulusoDIPInfo, - RegulusInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 240, 3, 4 -}; - -struct BurnDriver BurnDrvRegulusu = { - "regulusu", "regulus", NULL, NULL, "1983", - "Regulus (not encrypted)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, RegulusuRomInfo, RegulusuRomName, NULL, NULL, MyheroInputInfo, RegulusDIPInfo, - RegulusuInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 240, 3, 4 -}; - -struct BurnDriver BurnDrvSeganinj = { - "seganinj", NULL, NULL, NULL, "1985", - "Sega Ninja (315-5102)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, SeganinjRomInfo, SeganinjRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, - SeganinjInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSeganinju = { - "seganinju", "seganinj", NULL, NULL, "1985", - "Sega Ninja (not encrypted)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, SeganinjuRomInfo, SeganinjuRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, - SeganinuInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNinja = { - "ninja", "seganinj", NULL, NULL, "1985", - "Ninja (315-5102)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, NinjaRomInfo, NinjaRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, - SeganinjInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNprinces = { - "nprinces", "seganinj", NULL, NULL, "1985", - "Ninja Princess (315-5051, 64k Ver. bootleg?)\0", NULL, "bootleg?", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, NprincesRomInfo, NprincesRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, - NprincesInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNprinceso = { - "nprinceso", "seganinj", NULL, NULL, "1985", - "Ninja Princess (315-5098, 128k Ver.)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, NprincesoRomInfo, NprincesoRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, - NprincsoInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNprincesu = { - "nprincesu", "seganinj", NULL, NULL, "1985", - "Ninja Princess (64k Ver. not encrypted)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, NprincesuRomInfo, NprincesuRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, - NprincsuInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNprincesb = { - "nprincesb", "seganinj", NULL, NULL, "1985", - "Ninja Princess (315-5051?, 128k Ver. bootleg?)\0", NULL, "bootleg?", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, NprincesbRomInfo, NprincesbRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, - NprincsbInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSpatter = { - "spatter", NULL, NULL, NULL, "1984", - "Spatter\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_MAZE, 0, - NULL, SpatterRomInfo, SpatterRomName, NULL, NULL, MyheroInputInfo, SpatterDIPInfo, - SpatterInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 240, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsanchan = { - "ssanchan", "spatter", NULL, NULL, "1984", - "Sanrin San Chan (Japan)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_MAZE, 0, - NULL, SsanchanRomInfo, SsanchanRomName, NULL, NULL, MyheroInputInfo, SpatterDIPInfo, - SpatterInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 240, 224, 4, 3 -}; - -struct BurnDriver BurnDrvStarjack = { - "starjack", NULL, NULL, NULL, "1983", - "Star Jacker (Sega)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, StarjackRomInfo, StarjackRomName, NULL, NULL, MyheroInputInfo, StarjackDIPInfo, - StarjackInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 240, 3, 4 -}; - -struct BurnDriver BurnDrvStarjacks = { - "starjacks", "starjack", NULL, NULL, "1983", - "Star Jacker (Stern)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, - NULL, StarjacksRomInfo, StarjacksRomName, NULL, NULL, MyheroInputInfo, StarjacsDIPInfo, - StarjackInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 240, 3, 4 -}; - -struct BurnDriver BurnDrvSwat = { - "swat", NULL, NULL, NULL, "1984", - "SWAT (315-5048)\0", NULL, "Coreland / Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_MISC, 0, - NULL, SwatRomInfo, SwatRomName, NULL, NULL, MyheroInputInfo, SwatDIPInfo, - SwatInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTeddybb = { - "teddybb", NULL, NULL, NULL, "1985", - "TeddyBoy Blues (315-5115, New Ver.)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, TeddybbRomInfo, TeddybbRomName, NULL, NULL, MyheroInputInfo, TeddybbDIPInfo, - TeddybbInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTeddybbo = { - "teddybbo", "teddybb", NULL, NULL, "1985", - "TeddyBoy Blues (315-5115, Old Ver.)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, TeddybboRomInfo, TeddybboRomName, NULL, NULL, MyheroInputInfo, TeddybbDIPInfo, - TeddybbInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvUpndown = { - "upndown", NULL, NULL, NULL, "1983", - "Up'n Down (315-5030)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_MISC, 0, - NULL, UpndownRomInfo, UpndownRomName, NULL, NULL, UpndownInputInfo, UpndownDIPInfo, - UpndownInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvUpndownu = { - "upndownu", "upndown", NULL, NULL, "1983", - "Up'n Down (not encrypted)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_MISC, 0, - NULL, UpndownuRomInfo, UpndownuRomName, NULL, NULL, UpndownInputInfo, UpndownDIPInfo, - UpndownuInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvWboy = { - "wboy", NULL, NULL, NULL, "1986", - "Wonder Boy (set 1, 315-5177)\0", NULL, "Sega (Escape License)", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, WboyRomInfo, WboyRomName, NULL, NULL, WboyInputInfo, WboyDIPInfo, - WboyInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWboyo = { - "wboyo", "wboy", NULL, NULL, "1986", - "Wonder Boy (set 1, 315-5135)\0", NULL, "Sega (Escape License)", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, WboyoRomInfo, WboyoRomName, NULL, NULL, WboyInputInfo, WboyDIPInfo, - WboyoInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWboy2 = { - "wboy2", "wboy", NULL, NULL, "1986", - "Wonder Boy (set 2, 315-5178)\0", NULL, "Sega (Escape License)", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Wboy2RomInfo, Wboy2RomName, NULL, NULL, WboyInputInfo, WboyDIPInfo, - Wboy2Init, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWboy2u = { - "wboy2u", "wboy", NULL, NULL, "1986", - "Wonder Boy (set 2, not encrypted)\0", NULL, "Sega (Escape License)", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Wboy2uRomInfo, Wboy2uRomName, NULL, NULL, WboyInputInfo, WboyDIPInfo, - Wboy2uInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWboy3 = { - "wboy3", "wboy", NULL, NULL, "1986", - "Wonder Boy (set 3, 315-5135)\0", NULL, "Sega (Escape License)", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Wboy3RomInfo, Wboy3RomName, NULL, NULL, WboyInputInfo, Wboy3DIPInfo, - WboyoInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWboy4 = { - "wboy4", "wboy", NULL, NULL, "1986", - "Wonder Boy (set 4, 315-5162)\0", NULL, "Sega (Escape License)", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Wboy4RomInfo, Wboy4RomName, NULL, NULL, WboyInputInfo, WboyDIPInfo, - Wboy4Init, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWboy5 = { - "wboy5", "wboy", NULL, NULL, "1986", - "Wonder Boy (set 5, bootleg)\0", NULL, "bootleg", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, Wboy5RomInfo, Wboy5RomName, NULL, NULL, WboyInputInfo, Wboy3DIPInfo, - WboyoInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWboyu = { - "wboyu", "wboy", NULL, NULL, "1986", - "Wonder Boy (not encrypted)\0", NULL, "Sega (Escape License)", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, WboyuRomInfo, WboyuRomName, NULL, NULL, WboyInputInfo, WboyuDIPInfo, - WboyuInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWbdeluxe = { - "wbdeluxe", "wboy", NULL, NULL, "1986", - "Wonder Boy Deluxe\0", NULL, "Sega (Escape License)", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, - NULL, WbdeluxeRomInfo, WbdeluxeRomName, NULL, NULL, WboyInputInfo, WbdeluxeDIPInfo, - Wboy2uInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWmatch = { - "wmatch", NULL, NULL, NULL, "1984", - "Water Match (315-5064)\0", NULL, "Sega", "System 1", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_SPORTSMISC, 0, - NULL, WmatchRomInfo, WmatchRomName, NULL, NULL, WmatchInputInfo, WmatchDIPInfo, - WmatchInit, System1Exit, System1Frame, NULL, System1Scan, - NULL, 0x600, 224, 240, 3, 4 -}; - - - -// hvymetal -// shtngmst and clones -// chplft and clones -// wboysys2 -// blckgalb -// tokisens -// wbml and clones -// dakkochn -// ufosensi +#include "tiles_generic.h" +#include "z80_intf.h" +#include "sn76496.h" +#include "bitswap.h" +#include "mc8123.h" + +static UINT8 System1InputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 System1InputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 System1InputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 System1Dip[2] = {0, 0}; +static UINT8 System1Input[3] = {0x00, 0x00, 0x00 }; +static UINT8 System1Reset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *System1Rom1 = NULL; +static UINT8 *System1Rom2 = NULL; +static UINT8 *System1PromRed = NULL; +static UINT8 *System1PromGreen = NULL; +static UINT8 *System1PromBlue = NULL; +static UINT8 *System1Ram1 = NULL; +static UINT8 *System1Ram2 = NULL; +static UINT8 *System1SpriteRam = NULL; +static UINT8 *System1PaletteRam = NULL; +static UINT8 *System1BgRam = NULL; +static UINT8 *System1VideoRam = NULL; +static UINT8 *System1BgCollisionRam = NULL; +static UINT8 *System1SprCollisionRam = NULL; +static UINT8 *System1deRam = NULL; +static UINT8 *System1efRam = NULL; +static UINT8 *System1f4Ram = NULL; +static UINT8 *System1fcRam = NULL; +static UINT32 *System1Palette = NULL; +static UINT8 *System1Tiles = NULL; +static UINT8 *System1Sprites = NULL; +static UINT8 *System1TempRom = NULL; +static UINT8 *SpriteOnScreenMap = NULL; +static UINT8 *System1Fetch1 = NULL; +static UINT8 *System1MC8123Key = NULL; +static UINT32 *System1TilesPenUsage = NULL; + +static UINT8 System1ScrollX[2]; +static UINT8 System1ScrollY; +static INT32 System1BgScrollX; +static INT32 System1BgScrollY; +static INT32 System1VideoMode; +static INT32 System1FlipScreen; +static INT32 System1SoundLatch; +static INT32 System1RomBank; +static INT32 NoboranbInp16Step; +static INT32 NoboranbInp17Step; +static INT32 NoboranbInp23Step; +static UINT8 BlockgalDial1; +static UINT8 BlockgalDial2; + +static INT32 System1SpriteRomSize; +static INT32 System1NumTiles; +static INT32 System1SpriteXOffset; +static INT32 System1ColourProms = 0; +static INT32 System1BankedRom = 0; + +typedef void (*Decode)(); +static Decode DecodeFunction; +static Decode TileDecodeFunction; + +typedef void (*Render)(); +static Render System1Draw; +static void System1Render(); +//static void WbmlRender(); + +typedef void (*MakeInputs)(); +static MakeInputs MakeInputsFunction; + +static INT32 nCyclesDone[2], nCyclesTotal[2]; +static INT32 nCyclesSegment; + +/*============================================================================================== +Input Definitions +===============================================================================================*/ + +static struct BurnInputInfo BlockgalInputList[] = { + {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System1InputPort2 + 6, "p1 fire 1" }, + + {"P2 Left" , BIT_DIGITAL , System1InputPort0 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System1InputPort0 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System1InputPort2 + 7, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, + {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, + {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Blockgal) + +static struct BurnInputInfo FlickyInputList[] = { + {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 1" }, + + {"P2 Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, + {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, + {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, + {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Flicky) + +static struct BurnInputInfo MyheroInputList[] = { + {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System1InputPort0 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System1InputPort0 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System1InputPort0 + 1, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , System1InputPort1 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System1InputPort1 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System1InputPort1 + 1, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, + {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, + {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, + {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Myhero) + +static struct BurnInputInfo SeganinjInputList[] = { + {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System1InputPort0 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System1InputPort0 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System1InputPort0 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System1InputPort0 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , System1InputPort1 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System1InputPort1 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System1InputPort1 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System1InputPort1 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, + {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, + {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, + {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Seganinj) + +static struct BurnInputInfo UpndownInputList[] = { + {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System1InputPort0 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System1InputPort0 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 1" }, + + {"P2 Up" , BIT_DIGITAL , System1InputPort1 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System1InputPort1 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, + {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, + {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, + {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Upndown) + +static struct BurnInputInfo WboyInputList[] = { + {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System1InputPort0 + 1, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 2" }, + + {"P2 Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System1InputPort1 + 1, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, + {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, + {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, + {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Wboy) + +static struct BurnInputInfo WmatchInputList[] = { + {"Coin 1" , BIT_DIGITAL , System1InputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System1InputPort2 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System1InputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System1InputPort2 + 5, "p2 start" }, + + {"P1 Left Up" , BIT_DIGITAL , System1InputPort0 + 5, "p1 up" }, + {"P1 Left Down" , BIT_DIGITAL , System1InputPort0 + 4, "p1 down" }, + {"P1 Left Left" , BIT_DIGITAL , System1InputPort0 + 7, "p1 left" }, + {"P1 Left Right" , BIT_DIGITAL , System1InputPort0 + 6, "p1 right" }, + {"P1 Right Up" , BIT_DIGITAL , System1InputPort0 + 1, "p1 fire 1" }, + {"P1 Right Down" , BIT_DIGITAL , System1InputPort0 + 0, "p1 fire 2" }, + {"P1 Right Left" , BIT_DIGITAL , System1InputPort0 + 3, "p1 fire 3" }, + {"P1 Right Right" , BIT_DIGITAL , System1InputPort0 + 2, "p1 fire 4" }, + {"P1 Fire 1" , BIT_DIGITAL , System1InputPort2 + 6, "p1 fire 5" }, + + {"P2 Left Up" , BIT_DIGITAL , System1InputPort1 + 5, "p2 up" }, + {"P2 Left Down" , BIT_DIGITAL , System1InputPort1 + 4, "p2 down" }, + {"P2 Left Left" , BIT_DIGITAL , System1InputPort1 + 7, "p2 left" }, + {"P2 Left Right" , BIT_DIGITAL , System1InputPort1 + 6, "p2 right" }, + {"P2 Right Up" , BIT_DIGITAL , System1InputPort1 + 1, "p2 fire 1" }, + {"P2 Right Down" , BIT_DIGITAL , System1InputPort1 + 0, "p2 fire 2" }, + {"P2 Right Left" , BIT_DIGITAL , System1InputPort1 + 3, "p2 fire 3" }, + {"P2 Right Right" , BIT_DIGITAL , System1InputPort1 + 2, "p2 fire 4" }, + {"P2 Fire 1" , BIT_DIGITAL , System1InputPort2 + 7, "p2 fire 5" }, + + {"Reset" , BIT_DIGITAL , &System1Reset , "reset" }, + {"Service" , BIT_DIGITAL , System1InputPort2 + 3, "service" }, + {"Test" , BIT_DIGITAL , System1InputPort2 + 2, "diag" }, + {"Dip 1" , BIT_DIPSWITCH, System1Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System1Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Wmatch) + +inline void System1ClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x30) == 0x30) { + *nJoystickInputs &= ~0x30; + } + if ((*nJoystickInputs & 0xc0) == 0xc0) { + *nJoystickInputs &= ~0xc0; + } +} + +static inline void System1MakeInputs() +{ + // Reset Inputs + System1Input[0] = System1Input[1] = System1Input[2] = 0x00; + + // Compile Digital Inputs + for (int i = 0; i < 8; i++) { + System1Input[0] |= (System1InputPort0[i] & 1) << i; + System1Input[1] |= (System1InputPort1[i] & 1) << i; + System1Input[2] |= (System1InputPort2[i] & 1) << i; + } + + // Clear Opposites + System1ClearOpposites(&System1Input[0]); + System1ClearOpposites(&System1Input[1]); +} + +static inline void BlockgalMakeInputs() +{ + System1Input[2] = 0x00; + + for (int i = 0; i < 8; i++) { + System1Input[2] |= (System1InputPort2[i] & 1) << i; + } + + if (System1InputPort0[0]) BlockgalDial1 += 0x04; + if (System1InputPort0[1]) BlockgalDial1 -= 0x04; + + if (System1InputPort0[2]) BlockgalDial2 += 0x04; + if (System1InputPort0[3]) BlockgalDial2 -= 0x04;; +} + +#define SYSTEM1_COINAGE(dipval) \ + {0 , 0xfe, 0 , 16 , "Coin A" }, \ + {dipval, 0x01, 0x0f, 0x07, "4 Coins 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x08, "3 Coins 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x09, "2 Coins 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x05, "2 Coins 1 Credit 4/2 5/3 6/4"}, \ + {dipval, 0x01, 0x0f, 0x04, "2 Coins 1 Credit 4/3" }, \ + {dipval, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x00, "1 Coin 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x03, "1 Coin 1 Credit 5/6" }, \ + {dipval, 0x01, 0x0f, 0x02, "1 Coin 1 Credit 4/5" }, \ + {dipval, 0x01, 0x0f, 0x01, "1 Coin 1 Credit 2/3" }, \ + {dipval, 0x01, 0x0f, 0x06, "2 Coins 3 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, \ + \ + {0 , 0xfe, 0 , 16 , "Coin B" }, \ + {dipval, 0x01, 0xf0, 0x70, "4 Coins 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x80, "3 Coins 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x90, "2 Coins 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x50, "2 Coins 1 Credit 4/2 5/3 6/4"}, \ + {dipval, 0x01, 0xf0, 0x40, "2 Coins 1 Credit 4/3" }, \ + {dipval, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x00, "1 Coin 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x30, "1 Coin 1 Credit 5/6" }, \ + {dipval, 0x01, 0xf0, 0x20, "1 Coin 1 Credit 4/5" }, \ + {dipval, 0x01, 0xf0, 0x10, "1 Coin 1 Credit 2/3" }, \ + {dipval, 0x01, 0xf0, 0x60, "2 Coins 3 Credits" }, \ + {dipval, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, \ + {dipval, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, \ + {dipval, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, \ + {dipval, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, \ + {dipval, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, + +static struct BurnDIPInfo FourdwarrioDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x06, 0x06, "3" }, + {0x14, 0x01, 0x06, 0x04, "4" }, + {0x14, 0x01, 0x06, 0x02, "5" }, + {0x14, 0x01, 0x06, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x14, 0x01, 0x38, 0x38, "30k" }, + {0x14, 0x01, 0x38, 0x30, "40k" }, + {0x14, 0x01, 0x38, 0x28, "50k" }, + {0x14, 0x01, 0x38, 0x20, "60k" }, + {0x14, 0x01, 0x38, 0x18, "70k" }, + {0x14, 0x01, 0x38, 0x10, "80k" }, + {0x14, 0x01, 0x38, 0x08, "90k" }, + {0x14, 0x01, 0x38, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x40, 0x40, "Easy" }, + {0x14, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Fourdwarrio) + +static struct BurnDIPInfo BlockgalDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0xd7, NULL }, + {0x0d, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0c, 0x01, 0x01, 0x00, "Upright" }, + {0x0c, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0c, 0x01, 0x02, 0x00, "Off" }, + {0x0c, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0c, 0x01, 0x08, 0x08, "2" }, + {0x0c, 0x01, 0x08, 0x00, "3" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0c, 0x01, 0x10, 0x10, "10k 30k 60k 100k 150k" }, + {0x0c, 0x01, 0x10, 0x00, "30k 50k 100k 200k 300k" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0c, 0x01, 0x20, 0x20, "Off" }, + {0x0c, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x80, 0x80, "Off" }, + {0x0c, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + SYSTEM1_COINAGE(0x0d) +}; + +STDDIPINFO(Blockgal) + +static struct BurnDIPInfo BrainDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, +}; + +STDDIPINFO(Brain) + +static struct BurnDIPInfo BullfgtDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "30k" }, + {0x14, 0x01, 0x30, 0x20, "50k" }, + {0x14, 0x01, 0x30, 0x10, "70k" }, + {0x14, 0x01, 0x30, 0x00, "None" }, +}; + +STDDIPINFO(Bullfgt) + +static struct BurnDIPInfo FlickyDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0xff, NULL }, + {0x0e, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x0d) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x01, 0x00, "Upright" }, + {0x0e, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0e, 0x01, 0x0c, 0x0c, "2" }, + {0x0e, 0x01, 0x0c, 0x08, "3" }, + {0x0e, 0x01, 0x0c, 0x04, "4" }, + {0x0e, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0e, 0x01, 0x30, 0x30, "30k 80k 160k" }, + {0x0e, 0x01, 0x30, 0x20, "30k 100k 200k" }, + {0x0e, 0x01, 0x30, 0x10, "40k 120k 240k" }, + {0x0e, 0x01, 0x30, 0x00, "40k 140k 280k" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0e, 0x01, 0x40, 0x40, "Easy" }, + {0x0e, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Flicky) + +static struct BurnDIPInfo GardiaDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0x7c, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, " 5k 20k 30k" }, + {0x14, 0x01, 0x30, 0x20, "10k 25k 50k" }, + {0x14, 0x01, 0x30, 0x10, "15k 30k 60k" }, + {0x14, 0x01, 0x30, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x40, 0x40, "Easy" }, + {0x14, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Gardia) + +static struct BurnDIPInfo HvymetalDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "50k, 100k" }, + {0x14, 0x01, 0x30, 0x20, "60k, 120k" }, + {0x14, 0x01, 0x30, 0x10, "70k, 150k" }, + {0x14, 0x01, 0x30, 0x00, "100k" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x40, 0x40, "Easy" }, + {0x14, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Hvymetal) + +static struct BurnDIPInfo ImsorryDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "30k" }, + {0x14, 0x01, 0x30, 0x20, "40k" }, + {0x14, 0x01, 0x30, 0x10, "50k" }, + {0x14, 0x01, 0x30, 0x00, "None" }, +}; + +STDDIPINFO(Imsorry) + +static struct BurnDIPInfo MrvikingDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0x7c, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Maximum Credit" }, + {0x14, 0x01, 0x02, 0x02, "9" }, + {0x14, 0x01, 0x02, 0x00, "99" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "10k, 30k then every 30k"}, + {0x14, 0x01, 0x30, 0x20, "20k, 40k then every 30k"}, + {0x14, 0x01, 0x30, 0x10, "30k, then every 30k" }, + {0x14, 0x01, 0x30, 0x00, "40k, then every 30k" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x40, 0x40, "Easy" }, + {0x14, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Mrviking) + +static struct BurnDIPInfo MrvikngjDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0x7c, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "10k, 30k then every 30k"}, + {0x14, 0x01, 0x30, 0x20, "20k, 40k then every 30k"}, + {0x14, 0x01, 0x30, 0x10, "30k, then every 30k" }, + {0x14, 0x01, 0x30, 0x00, "40k, then every 30k" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x40, 0x40, "Easy" }, + {0x14, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Mrvikngj) + +static struct BurnDIPInfo MyheroDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "30k" }, + {0x14, 0x01, 0x30, 0x20, "50k" }, + {0x14, 0x01, 0x30, 0x10, "70k" }, + {0x14, 0x01, 0x30, 0x00, "90k" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x40, 0x40, "Easy" }, + {0x14, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Myhero) + +static struct BurnDIPInfo NobbDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0x2f, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x03, 0x00, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0x0c, 0x00, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0c, 0x04, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x13, 0x01, 0x30, 0x20, "Easy" }, + {0x13, 0x01, 0x30, 0x30, "Medium" }, + {0x13, 0x01, 0x30, 0x10, "Hard" }, + {0x13, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x40, 0x00, "Upright" }, + {0x13, 0x01, 0x40, 0x40, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x80, 0x00, "Off" }, + {0x13, 0x01, 0x80, 0x80, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x03, 0x02, "2" }, + {0x14, 0x01, 0x03, 0x03, "3" }, + {0x14, 0x01, 0x03, 0x01, "5" }, + {0x14, 0x01, 0x03, 0x00, "99" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "40k, 80k, 120k, 160k" }, + {0x14, 0x01, 0x0c, 0x0c, "50k, 100k, 150k" }, + {0x14, 0x01, 0x0c, 0x04, "60k, 120k, 180k" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x10, 0x00, "Off" }, + {0x14, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, +}; + +STDDIPINFO(Nobb) + +static struct BurnDIPInfo Pitfall2DIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xdc, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x14, 0x01, 0x10, 0x10, "20k 50k" }, + {0x14, 0x01, 0x10, 0x00, "30k 70k" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Time" }, + {0x14, 0x01, 0x40, 0x00, "2 minutes" }, + {0x14, 0x01, 0x40, 0x40, "3 minutes" }, +}; + +STDDIPINFO(Pitfall2) + +static struct BurnDIPInfo PitfalluDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xde, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x06, 0x06, "3" }, + {0x14, 0x01, 0x06, 0x04, "4" }, + {0x14, 0x01, 0x06, 0x02, "5" }, + {0x14, 0x01, 0x06, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Starting Stage" }, + {0x14, 0x01, 0x18, 0x18, "1" }, + {0x14, 0x01, 0x18, 0x10, "2" }, + {0x14, 0x01, 0x18, 0x08, "3" }, + {0x14, 0x01, 0x18, 0x00, "4" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x20, 0x20, "Off" }, + {0x14, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Time" }, + {0x14, 0x01, 0x40, 0x00, "2 minutes" }, + {0x14, 0x01, 0x40, 0x40, "3 minutes" }, +}; + +STDDIPINFO(Pitfallu) + +static struct BurnDIPInfo RaflesiaDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "20k, 70k and 120k" }, + {0x14, 0x01, 0x30, 0x20, "30k, 80k and 150k" }, + {0x14, 0x01, 0x30, 0x10, "50k, 100k and 200k" }, + {0x14, 0x01, 0x30, 0x00, "None" }, +}; + +STDDIPINFO(Raflesia) + +static struct BurnDIPInfo RegulusDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0x7e, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x40, 0x40, "Easy" }, + {0x14, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x80, 0x80, "Off" }, + {0x14, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Regulus) + +static struct BurnDIPInfo RegulusoDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x40, 0x40, "Easy" }, + {0x14, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Reguluso) + +static struct BurnDIPInfo SeganinjDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xdc, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x15) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x16, 0x01, 0x01, 0x00, "Upright" }, + {0x16, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x16, 0x01, 0x02, 0x02, "Off" }, + {0x16, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x0c, 0x08, "2" }, + {0x16, 0x01, 0x0c, 0x0c, "3" }, + {0x16, 0x01, 0x0c, 0x04, "4" }, + {0x16, 0x01, 0x0c, 0x00, "240" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x16, 0x01, 0x10, 0x10, "20k 70k 120k 170k" }, + {0x16, 0x01, 0x10, 0x00, "50k 100k 150k 200k" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x20, 0x20, "Off" }, + {0x16, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x16, 0x01, 0x40, 0x40, "Easy" }, + {0x16, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Seganinj) + +static struct BurnDIPInfo SpatterDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x08, "2" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x04, "4" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "40k, 120k and 480k" }, + {0x14, 0x01, 0x30, 0x20, "50k and 200k" }, + {0x14, 0x01, 0x30, 0x10, "100k only" }, + {0x14, 0x01, 0x30, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Reset Timer/Objects on Life Loss" }, + {0x14, 0x01, 0x40, 0x40, "No" }, + {0x14, 0x01, 0x40, 0x00, "Yes" }, +}; + +STDDIPINFO(Spatter) + +static struct BurnDIPInfo StarjackDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xf6, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x06, 0x06, "3" }, + {0x14, 0x01, 0x06, 0x04, "4" }, + {0x14, 0x01, 0x06, 0x02, "5" }, + {0x14, 0x01, 0x06, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x14, 0x01, 0x38, 0x38, "Every 20k" }, + {0x14, 0x01, 0x38, 0x28, "Every 30k" }, + {0x14, 0x01, 0x38, 0x18, "Every 40k" }, + {0x14, 0x01, 0x38, 0x08, "Every 50k" }, + {0x14, 0x01, 0x38, 0x30, "20k, then every 30k" }, + {0x14, 0x01, 0x38, 0x20, "30k, then every 40k" }, + {0x14, 0x01, 0x38, 0x10, "40k, then every 50k" }, + {0x14, 0x01, 0x38, 0x00, "50k, then every 60k" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0xc0, 0xc0, "Easy" }, + {0x14, 0x01, 0xc0, 0x80, "Medium" }, + {0x14, 0x01, 0xc0, 0x40, "Hard" }, + {0x14, 0x01, 0xc0, 0x00, "Hardest" }, +}; + +STDDIPINFO(Starjack) + +static struct BurnDIPInfo StarjacsDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x06, 0x06, "3" }, + {0x14, 0x01, 0x06, 0x04, "4" }, + {0x14, 0x01, 0x06, 0x02, "5" }, + {0x14, 0x01, 0x06, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 2 , "Ship" }, + {0x14, 0x01, 0x08, 0x08, "Single" }, + {0x14, 0x01, 0x08, 0x00, "Multi" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "30k, then every 40k" }, + {0x14, 0x01, 0x30, 0x20, "40k, then every 50k" }, + {0x14, 0x01, 0x30, 0x10, "50k, then every 60k" }, + {0x14, 0x01, 0x30, 0x00, "60k, then every 70k" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0xc0, 0xc0, "Easy" }, + {0x14, 0x01, 0xc0, 0x80, "Medium" }, + {0x14, 0x01, 0xc0, 0x40, "Hard" }, + {0x14, 0x01, 0xc0, 0x00, "Hardest" }, +}; + +STDDIPINFO(Starjacs) + +static struct BurnDIPInfo SwatDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x06, 0x06, "3" }, + {0x14, 0x01, 0x06, 0x04, "4" }, + {0x14, 0x01, 0x06, 0x02, "5" }, + {0x14, 0x01, 0x06, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x14, 0x01, 0x38, 0x38, "30k" }, + {0x14, 0x01, 0x38, 0x30, "40k" }, + {0x14, 0x01, 0x38, 0x28, "50k" }, + {0x14, 0x01, 0x38, 0x20, "60k" }, + {0x14, 0x01, 0x38, 0x18, "70k" }, + {0x14, 0x01, 0x38, 0x10, "80k" }, + {0x14, 0x01, 0x38, 0x08, "90k" }, + {0x14, 0x01, 0x38, 0x00, "None" }, +}; + +STDDIPINFO(Swat) + +static struct BurnDIPInfo TeddybbDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x00, "Off" }, + {0x14, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x08, "2" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x04, "4" }, + {0x14, 0x01, 0x0c, 0x00, "252" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "100k 400k" }, + {0x14, 0x01, 0x30, 0x20, "200k 600k" }, + {0x14, 0x01, 0x30, 0x10, "400k 800k" }, + {0x14, 0x01, 0x30, 0x00, "600k" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x40, 0x40, "Easy" }, + {0x14, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Teddybb) + +static struct BurnDIPInfo UpndownDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x11) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x12, 0x01, 0x01, 0x00, "Upright" }, + {0x12, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x06, 0x06, "3" }, + {0x12, 0x01, 0x06, 0x04, "4" }, + {0x12, 0x01, 0x06, 0x02, "5" }, + {0x12, 0x01, 0x06, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 8 , "Bonus Life" }, + {0x12, 0x01, 0x38, 0x38, "10k" }, + {0x12, 0x01, 0x38, 0x30, "20k" }, + {0x12, 0x01, 0x38, 0x28, "30k" }, + {0x12, 0x01, 0x38, 0x20, "40k" }, + {0x12, 0x01, 0x38, 0x18, "50k" }, + {0x12, 0x01, 0x38, 0x10, "60k" }, + {0x12, 0x01, 0x38, 0x08, "70k" }, + {0x12, 0x01, 0x38, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0xc0, 0xc0, "Easy" }, + {0x12, 0x01, 0xc0, 0x80, "Medium" }, + {0x12, 0x01, 0xc0, 0x40, "Hard" }, + {0x12, 0x01, 0xc0, 0x00, "Hardest" }, +}; + +STDDIPINFO(Upndown) + +static struct BurnDIPInfo WboyDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xec, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x0f) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x01, 0x00, "Upright" }, + {0x10, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x10, 0x01, 0x02, 0x02, "Off" }, + {0x10, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x0c, 0x0c, "3" }, + {0x10, 0x01, 0x0c, 0x08, "4" }, + {0x10, 0x01, 0x0c, 0x04, "5" }, + {0x10, 0x01, 0x0c, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x10, 0x10, "30k 100k 170k 240k" }, + {0x10, 0x01, 0x10, 0x00, "30k 120k 210k 300k" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x10, 0x01, 0x20, 0x00, "Off" }, + {0x10, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x10, 0x01, 0x40, 0x40, "Easy" }, + {0x10, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Wboy) + +static struct BurnDIPInfo Wboy3DIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xec, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x0f) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x01, 0x00, "Upright" }, + {0x10, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x10, 0x01, 0x02, 0x02, "Off" }, + {0x10, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x0c, 0x0c, "1" }, + {0x10, 0x01, 0x0c, 0x08, "2" }, + {0x10, 0x01, 0x0c, 0x04, "3" }, + {0x10, 0x01, 0x0c, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x10, 0x10, "30k 100k 170k 240k" }, + {0x10, 0x01, 0x10, 0x00, "30k 120k 210k 300k" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x10, 0x01, 0x20, 0x00, "Off" }, + {0x10, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x10, 0x01, 0x40, 0x40, "Easy" }, + {0x10, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Wboy3) + +static struct BurnDIPInfo WboyuDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xbe, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x01, 0x00, "Upright" }, + {0x0f, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x06, 0x00, "2" }, + {0x0f, 0x01, 0x06, 0x06, "3" }, + {0x0f, 0x01, 0x06, 0x04, "4" }, + {0x0f, 0x01, 0x06, 0x02, "5" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x40, 0x40, "Off" }, + {0x0f, 0x01, 0x40, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 8 , "Coinage" }, + {0x10, 0x01, 0x07, 0x04, "4 Coins 1 Credit" }, + {0x10, 0x01, 0x07, 0x05, "3 Coins 1 Credit" }, + {0x10, 0x01, 0x07, 0x00, "4 Coins 2 Credits" }, + {0x10, 0x01, 0x07, 0x06, "2 Coins 1 Credit" }, + {0x10, 0x01, 0x07, 0x01, "3 Coins 2 Credits" }, + {0x10, 0x01, 0x07, 0x02, "2 Coins 1 Credits" }, + {0x10, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, + {0x10, 0x01, 0x07, 0x03, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x10, 0x01, 0x10, 0x00, "Off" }, + {0x10, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 4 , "Mode" }, + {0x10, 0x01, 0xc0, 0xc0, "Normal Game" }, + {0x10, 0x01, 0xc0, 0x80, "Free Play" }, + {0x10, 0x01, 0xc0, 0x40, "Test Mode" }, + {0x10, 0x01, 0xc0, 0x00, "Endless Game" }, +}; + +STDDIPINFO(Wboyu) + +static struct BurnDIPInfo WbdeluxeDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0x7c, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x0f) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x10, 0x01, 0x01, 0x00, "Upright" }, + {0x10, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x10, 0x01, 0x02, 0x02, "Off" }, + {0x10, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x0c, 0x0c, "3" }, + {0x10, 0x01, 0x0c, 0x08, "4" }, + {0x10, 0x01, 0x0c, 0x04, "5" }, + {0x10, 0x01, 0x0c, 0x00, "Freeplay" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x10, 0x10, "30k 100k 170k 240k" }, + {0x10, 0x01, 0x10, 0x00, "30k 120k 210k 300k" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x10, 0x01, 0x20, 0x00, "Off" }, + {0x10, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x10, 0x01, 0x40, 0x40, "Easy" }, + {0x10, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Energy Consumption" }, + {0x10, 0x01, 0x80, 0x00, "Slow" }, + {0x10, 0x01, 0x80, 0x80, "Fast" }, +}; + +STDDIPINFO(Wbdeluxe) + +static struct BurnDIPInfo WmatchDIPList[]= +{ + // Default Values + {0x19, 0xff, 0xff, 0xff, NULL }, + {0x1a, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM1_COINAGE(0x19) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x1a, 0x01, 0x01, 0x00, "Upright" }, + {0x1a, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x1a, 0x01, 0x02, 0x02, "Off" }, + {0x1a, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Time" }, + {0x1a, 0x01, 0x0c, 0x0c, "Normal" }, + {0x1a, 0x01, 0x0c, 0x08, "Fast" }, + {0x1a, 0x01, 0x0c, 0x04, "Faster" }, + {0x1a, 0x01, 0x0c, 0x00, "Fastest" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x1a, 0x01, 0x10, 0x10, "20k 50k" }, + {0x1a, 0x01, 0x10, 0x00, "30k 70k" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x1a, 0x01, 0x40, 0x40, "Easy" }, + {0x1a, 0x01, 0x40, 0x00, "Hard" }, +}; + +STDDIPINFO(Wmatch) + +#undef SYSTEM1_COINAGE + +/*============================================================================================== +ROM Descriptions +===============================================================================================*/ + +static struct BurnRomInfo FourdwarrioRomDesc[] = { + { "4d.116", 0x004000, 0x546d1bc7, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "4d.109", 0x004000, 0xf1074ec3, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "4d.96", 0x004000, 0x387c1e8f, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "4d.120", 0x002000, 0x5241c009, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "4d.62", 0x002000, 0xf31b2e09, BRF_GRA }, // 4 Tiles + { "4d.61", 0x002000, 0x5430e925, BRF_GRA }, // 5 Tiles + { "4d.64", 0x002000, 0x9f442351, BRF_GRA }, // 6 Tiles + { "4d.63", 0x002000, 0x633232bd, BRF_GRA }, // 7 Tiles + { "4d.66", 0x002000, 0x52bfa2ed, BRF_GRA }, // 8 Tiles + { "4d.65", 0x002000, 0xe9ba4658, BRF_GRA }, // 9 Tiles + + { "4d.117", 0x004000, 0x436e4141, BRF_GRA }, // 10 Sprites + { "4d.04", 0x004000, 0x8b7cecef, BRF_GRA }, // 11 Sprites + { "4d.110", 0x004000, 0x6ec5990a, BRF_GRA }, // 12 Sprites + { "4d.05", 0x004000, 0xf31a1e6a, BRF_GRA }, // 13 Sprites + + { "pr5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Fourdwarrio) +STD_ROM_FN(Fourdwarrio) + +static struct BurnRomInfo BlockgalRomDesc[] = { + { "bg.116", 0x004000, 0xa99b231a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bg.109", 0x004000, 0xa6b573d5, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "bg.120", 0x002000, 0xd848faff, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + + { "bg.62", 0x002000, 0x7e3ea4eb, BRF_GRA }, // 3 Tiles + { "bg.61", 0x002000, 0x4dd3d39d, BRF_GRA }, // 4 Tiles + { "bg.64", 0x002000, 0x17368663, BRF_GRA }, // 5 Tiles + { "bg.63", 0x002000, 0x0c8bc404, BRF_GRA }, // 6 Tiles + { "bg.66", 0x002000, 0x2b7dc4fa, BRF_GRA }, // 7 Tiles + { "bg.65", 0x002000, 0xed121306, BRF_GRA }, // 8 Tiles + + { "bg.117", 0x004000, 0xe99cc920, BRF_GRA }, // 9 Sprites + { "bg.04", 0x004000, 0x213057f8, BRF_GRA }, // 10 Sprites + { "bg.110", 0x004000, 0x064c812c, BRF_GRA }, // 11 Sprites + { "bg.05", 0x004000, 0x02e0b040, BRF_GRA }, // 12 Sprites + + { "pr5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 13 Timing PROM + + { "317-0029.key", 0x002000, 0x350d7f93, BRF_ESS | BRF_PRG }, // 14 MC8123 Key +}; + +STD_ROM_PICK(Blockgal) +STD_ROM_FN(Blockgal) + +static struct BurnRomInfo BrainRomDesc[] = { + { "brain.1", 0x008000, 0x2d2aec31, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "brain.2", 0x008000, 0x810a8ab5, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "brain.3", 0x008000, 0x9a225634, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "brain.120", 0x008000, 0xc7e50278, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "brain.62", 0x004000, 0x7dce2302, BRF_GRA }, // 4 Tiles + { "brain.64", 0x004000, 0x7ce03fd3, BRF_GRA }, // 5 Tiles + { "brain.66", 0x004000, 0xea54323f, BRF_GRA }, // 6 Tiles + + { "brain.117", 0x008000, 0x92ff71a4, BRF_GRA }, // 7 Sprites + { "brain.110", 0x008000, 0xa1b847ec, BRF_GRA }, // 8 Sprites + { "brain.4", 0x008000, 0xfd2ea53b, BRF_GRA }, // 9 Sprites + + { "bprom.3", 0x000100, 0x8eee0f72, BRF_GRA }, // 10 Red PROM + { "bprom.2", 0x000100, 0x3e7babd7, BRF_GRA }, // 11 Green PROM + { "bprom.1", 0x000100, 0x371c44a6, BRF_GRA }, // 12 Blue PROM + { "pr5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 13 Timing PROM +}; + +STD_ROM_PICK(Brain) +STD_ROM_FN(Brain) + +static struct BurnRomInfo BullfgtRomDesc[] = { + { "epr-.129", 0x002000, 0x29f19156, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-.130", 0x002000, 0xe37d2b95, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-.131", 0x002000, 0xeaf5773d, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-.132", 0x002000, 0x72c3c712, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-.133", 0x002000, 0x7d9fa4cd, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-.134", 0x002000, 0x061f2797, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-6077.120", 0x002000, 0x02a37602, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-.82", 0x002000, 0xb71c349f, BRF_GRA }, // 7 Tiles + { "epr-.65", 0x002000, 0x86deafa8, BRF_GRA }, // 8 Tiles + { "epr-6087.81", 0x002000, 0x2677742c, BRF_GRA }, // 9 Tiles + { "epr-.64", 0x002000, 0x6f0a62be, BRF_GRA }, // 10 Tiles + { "epr-6085.80", 0x002000, 0x9c3ddc62, BRF_GRA }, // 11 Tiles + { "epr-.63", 0x002000, 0xc0fce57c, BRF_GRA }, // 12 Tiles + + { "epr-6069.86", 0x004000, 0xfe691e41, BRF_GRA }, // 13 Sprites + { "epr-6070.93", 0x004000, 0x34f080df, BRF_GRA }, // 14 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Bullfgt) +STD_ROM_FN(Bullfgt) + +static struct BurnRomInfo ThetogyuRomDesc[] = { + { "epr-6071.116", 0x004000, 0x96b57df9, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6072.109", 0x004000, 0xf7baadd0, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6073.96", 0x004000, 0x721af166, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6077.120", 0x002000, 0x02a37602, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-6089.62", 0x002000, 0xa183e5ff, BRF_GRA }, // 7 Tiles + { "epr-6088.61", 0x002000, 0xb919b4a6, BRF_GRA }, // 8 Tiles + { "epr-6087.64", 0x002000, 0x2677742c, BRF_GRA }, // 9 Tiles + { "epr-6086.63", 0x002000, 0x76b5a084, BRF_GRA }, // 10 Tiles + { "epr-6085.66", 0x002000, 0x9c3ddc62, BRF_GRA }, // 11 Tiles + { "epr-6084.65", 0x002000, 0x90e1fa5f, BRF_GRA }, // 12 Tiles + + { "epr-6069.117", 0x004000, 0xfe691e41, BRF_GRA }, // 13 Sprites + { "epr-6070.110", 0x004000, 0x34f080df, BRF_GRA }, // 14 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Thetogyu) +STD_ROM_FN(Thetogyu) + +static struct BurnRomInfo FlickyRomDesc[] = { + { "epr5978a.116", 0x004000, 0x296f1492, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr5979a.109", 0x004000, 0x64b03ef9, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + + { "epr-5868.62", 0x002000, 0x7402256b, BRF_GRA }, // 3 Tiles + { "epr-5867.61", 0x002000, 0x2f5ce930, BRF_GRA }, // 4 Tiles + { "epr-5866.64", 0x002000, 0x967f1d9a, BRF_GRA }, // 5 Tiles + { "epr-5865.63", 0x002000, 0x03d9a34c, BRF_GRA }, // 6 Tiles + { "epr-5864.66", 0x002000, 0xe659f358, BRF_GRA }, // 7 Tiles + { "epr-5863.65", 0x002000, 0xa496ca15, BRF_GRA }, // 8 Tiles + + { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 9 Sprites + { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 10 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 11 Timing PROM +}; + +STD_ROM_PICK(Flicky) +STD_ROM_FN(Flicky) + +static struct BurnRomInfo FlickygRomDesc[] = { + { "epr5978a.116", 0x004000, 0x296f1492, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr5979a.109", 0x004000, 0x64b03ef9, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + + { "66xx.ic62", 0x004000, 0xf1a75200, BRF_GRA }, // 3 Tiles + { "66x0.ic64", 0x004000, 0x299aefb7, BRF_GRA }, // 4 Tiles + { "5999.ic66", 0x004000, 0x1ca53157, BRF_GRA }, // 5 Tiles + + { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 8 Sprites + { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 9 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 10 Timing PROM +}; + +STD_ROM_PICK(Flickyg) +STD_ROM_FN(Flickyg) + +static struct BurnRomInfo Flickys1RomDesc[] = { + { "ic129", 0x002000, 0x7011275c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ic130", 0x002000, 0xe7ed012d, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "ic131", 0x002000, 0xc5e98cd1, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "ic132", 0x002000, 0x0e5122c2, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + + { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code + + { "epr-5868.62", 0x002000, 0x7402256b, BRF_GRA }, // 5 Tiles + { "epr-5867.61", 0x002000, 0x2f5ce930, BRF_GRA }, // 6 Tiles + { "epr-5866.64", 0x002000, 0x967f1d9a, BRF_GRA }, // 7 Tiles + { "epr-5865.63", 0x002000, 0x03d9a34c, BRF_GRA }, // 8 Tiles + { "epr-5864.66", 0x002000, 0xe659f358, BRF_GRA }, // 9 Tiles + { "epr-5863.65", 0x002000, 0xa496ca15, BRF_GRA }, // 10 Tiles + + { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 11 Sprites + { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 12 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 13 Timing PROM +}; + +STD_ROM_PICK(Flickys1) +STD_ROM_FN(Flickys1) + +static struct BurnRomInfo Flickys2RomDesc[] = { + { "epr-6621.bin", 0x004000, 0xb21ff546, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6622.bin", 0x004000, 0x133a8bf1, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + + { "epr-5868.62", 0x002000, 0x7402256b, BRF_GRA }, // 3 Tiles + { "epr-5867.61", 0x002000, 0x2f5ce930, BRF_GRA }, // 4 Tiles + { "epr-5866.64", 0x002000, 0x967f1d9a, BRF_GRA }, // 5 Tiles + { "epr-5865.63", 0x002000, 0x03d9a34c, BRF_GRA }, // 6 Tiles + { "epr-5864.66", 0x002000, 0xe659f358, BRF_GRA }, // 7 Tiles + { "epr-5863.65", 0x002000, 0xa496ca15, BRF_GRA }, // 8 Tiles + + { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 9 Sprites + { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 10 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 11 Timing PROM +}; + +STD_ROM_PICK(Flickys2) +STD_ROM_FN(Flickys2) + +static struct BurnRomInfo Flickys2gRomDesc[] = { + { "epr-6621.bin", 0x004000, 0xb21ff546, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6622.bin", 0x004000, 0x133a8bf1, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + + { "66xx.ic62", 0x004000, 0xf1a75200, BRF_GRA }, // 3 Tiles + { "66x0.ic64", 0x004000, 0x299aefb7, BRF_GRA }, // 4 Tiles + { "5999.ic66", 0x004000, 0x1ca53157, BRF_GRA }, // 5 Tiles + + { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 6 Sprites + { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 7 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 8 Timing PROM +}; + +STD_ROM_PICK(Flickys2g) +STD_ROM_FN(Flickys2g) + +static struct BurnRomInfo FlickyoRomDesc[] = { + { "epr-5857.bin", 0x002000, 0xa65ac88e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr5858a.bin", 0x002000, 0x18b412f4, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-5859.bin", 0x002000, 0xa5558d7e, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-5860.bin", 0x002000, 0x1b35fef1, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + + { "epr-5869.120", 0x002000, 0x6d220d4e, BRF_ESS | BRF_PRG }, // 4 Z80 #2 Program Code + + { "epr-5868.62", 0x002000, 0x7402256b, BRF_GRA }, // 5 Tiles + { "epr-5867.61", 0x002000, 0x2f5ce930, BRF_GRA }, // 6 Tiles + { "epr-5866.64", 0x002000, 0x967f1d9a, BRF_GRA }, // 7 Tiles + { "epr-5865.63", 0x002000, 0x03d9a34c, BRF_GRA }, // 8 Tiles + { "epr-5864.66", 0x002000, 0xe659f358, BRF_GRA }, // 9 Tiles + { "epr-5863.65", 0x002000, 0xa496ca15, BRF_GRA }, // 10 Tiles + + { "epr-5855.117", 0x004000, 0xb5f894a1, BRF_GRA }, // 11 Sprites + { "epr-5856.110", 0x004000, 0x266af78f, BRF_GRA }, // 12 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 13 Timing PROM +}; + +STD_ROM_PICK(Flickyo) +STD_ROM_FN(Flickyo) + +static struct BurnRomInfo GardiaRomDesc[] = { + { "epr10255.1", 0x008000, 0x89282a6b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr10254.2", 0x008000, 0x2826b6d8, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr10253.3", 0x008000, 0x7911260f, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr10243.120", 0x004000, 0x87220660, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr10249.61", 0x004000, 0x4e0ad0f2, BRF_GRA }, // 4 Tiles + { "epr10248.64", 0x004000, 0x3515d124, BRF_GRA }, // 5 Tiles + { "epr10247.66", 0x004000, 0x541e1555, BRF_GRA }, // 6 Tiles + + { "epr10234.117", 0x008000, 0x8a6aed33, BRF_GRA }, // 7 Sprites + { "epr10233.110", 0x008000, 0xc52784d3, BRF_GRA }, // 8 Sprites + { "epr10236.04", 0x008000, 0xb35ab227, BRF_GRA }, // 9 Sprites + { "epr10235.5", 0x008000, 0x006a3151, BRF_GRA }, // 10 Sprites + + { "bprom.3", 0x000100, 0x8eee0f72, BRF_GRA }, // 11 Red PROM + { "bprom.2", 0x000100, 0x3e7babd7, BRF_GRA }, // 12 Green PROM + { "bprom.1", 0x000100, 0x371c44a6, BRF_GRA }, // 13 Blue PROM + { "pr5317.4", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Gardia) +STD_ROM_FN(Gardia) + +static struct BurnRomInfo GardiabRomDesc[] = { + { "gardiabl.5", 0x008000, 0x207f9cbb, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "gardiabl.6", 0x008000, 0xb2ed05dc, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "gardiabl.7", 0x008000, 0x0a490588, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr10243.120", 0x004000, 0x87220660, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "gardiabl.8", 0x004000, 0x367c9a17, BRF_GRA }, // 4 Tiles + { "gardiabl.9", 0x004000, 0x1540fd30, BRF_GRA }, // 5 Tiles + { "gardiabl.10", 0x004000, 0xe5c9af10, BRF_GRA }, // 6 Tiles + + { "epr10234.117", 0x008000, 0x8a6aed33, BRF_GRA }, // 7 Sprites + { "epr10233.110", 0x008000, 0xc52784d3, BRF_GRA }, // 8 Sprites + { "epr10236.04", 0x008000, 0xb35ab227, BRF_GRA }, // 9 Sprites + { "epr10235.5", 0x008000, 0x006a3151, BRF_GRA }, // 10 Sprites + + { "bprom.3", 0x000100, 0x8eee0f72, BRF_GRA }, // 11 Red PROM + { "bprom.2", 0x000100, 0x3e7babd7, BRF_GRA }, // 12 Green PROM + { "bprom.1", 0x000100, 0x371c44a6, BRF_GRA }, // 13 Blue PROM + { "pr5317.4", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Gardiab) +STD_ROM_FN(Gardiab) + +static struct BurnRomInfo HvymetalRomDesc[] = { + { "epra6790.1", 0x008000, 0x59195bb9, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epra6789.2", 0x008000, 0x83e1d18a, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epra6788.3", 0x008000, 0x6ecefd57, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr6787.120", 0x008000, 0xb64ac7f0, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr6795.62", 0x004000, 0x58a3d038, BRF_GRA }, // 4 Tiles + { "epr6796.61", 0x004000, 0xd8b08a55, BRF_GRA }, // 5 Tiles + { "epr6793.64", 0x004000, 0x487407c2, BRF_GRA }, // 6 Tiles + { "epr6794.63", 0x004000, 0x89eb3793, BRF_GRA }, // 7 Tiles + { "epr6791.66", 0x004000, 0xa7dcd042, BRF_GRA }, // 8 Tiles + { "epr6792.65", 0x004000, 0xd0be5e33, BRF_GRA }, // 9 Tiles + + { "epr6778.117", 0x008000, 0x0af61aee, BRF_GRA }, // 10 Sprites + { "epr6777.110", 0x008000, 0x91d7a197, BRF_GRA }, // 11 Sprites + { "epr6780.4", 0x008000, 0x55b31df5, BRF_GRA }, // 12 Sprites + { "epr6779.5", 0x008000, 0xe03a2b28, BRF_GRA }, // 13 Sprites + + { "pr7036.3", 0x000100, 0x146f16fb, BRF_GRA }, // 14 Red PROM + { "pr7035.2", 0x000100, 0x50b201ed, BRF_GRA }, // 15 Green PROM + { "pr7034.1", 0x000100, 0xdfb5f139, BRF_GRA }, // 16 Blue PROM + + { "pr5317p.4", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM +}; + +STD_ROM_PICK(Hvymetal) +STD_ROM_FN(Hvymetal) + +static struct BurnRomInfo ImsorryRomDesc[] = { + { "epr-6676.116", 0x004000, 0xeb087d7f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6677.109", 0x004000, 0xbd244bee, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6678.96", 0x004000, 0x2e16b9fd, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6656.120", 0x002000, 0x25e3d685, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6684.62", 0x002000, 0x2c8df377, BRF_GRA }, // 4 Tiles + { "epr-6683.61", 0x002000, 0x89431c48, BRF_GRA }, // 5 Tiles + { "epr-6682.64", 0x002000, 0x256a9246, BRF_GRA }, // 6 Tiles + { "epr-6681.63", 0x002000, 0x6974d189, BRF_GRA }, // 7 Tiles + { "epr-6680.66", 0x002000, 0x10a629d6, BRF_GRA }, // 8 Tiles + { "epr-6674.65", 0x002000, 0x143d883c, BRF_GRA }, // 9 Tiles + + { "epr-6645.117", 0x004000, 0x1ba167ee, BRF_GRA }, // 10 Sprites + { "epr-6646.04", 0x004000, 0xedda7ad6, BRF_GRA }, // 11 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 12 Timing PROM +}; + +STD_ROM_PICK(Imsorry) +STD_ROM_FN(Imsorry) + +static struct BurnRomInfo ImsorryjRomDesc[] = { + { "epr-6647.116", 0x004000, 0xcc5d915d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6648.109", 0x004000, 0x37574d60, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6649.96", 0x004000, 0x5f59bdee, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6656.120", 0x002000, 0x25e3d685, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6655.62", 0x002000, 0xbe1f762f, BRF_GRA }, // 4 Tiles + { "epr-6654.61", 0x002000, 0xed5f7fc8, BRF_GRA }, // 5 Tiles + { "epr-6653.64", 0x002000, 0x8b4845a7, BRF_GRA }, // 6 Tiles + { "epr-6652.63", 0x002000, 0x001d68cb, BRF_GRA }, // 7 Tiles + { "epr-6651.66", 0x002000, 0x4ee9b5e6, BRF_GRA }, // 8 Tiles + { "epr-6650.65", 0x002000, 0x3fca4414, BRF_GRA }, // 9 Tiles + + { "epr-6645.117", 0x004000, 0x1ba167ee, BRF_GRA }, // 10 Sprites + { "epr-6646.04", 0x004000, 0xedda7ad6, BRF_GRA }, // 11 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 12 Timing PROM +}; + +STD_ROM_PICK(Imsorryj) +STD_ROM_FN(Imsorryj) + +static struct BurnRomInfo MrvikingRomDesc[] = { + { "epr-5873.129", 0x002000, 0x14d21624, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-5874.130", 0x002000, 0x6df7de87, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-5875.131", 0x002000, 0xac226100, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-5876.132", 0x002000, 0xe77db1dc, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-5755.133", 0x002000, 0xedd62ae1, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-5756.134", 0x002000, 0x11974040, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-5763.3", 0x002000, 0xd712280d, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-5762.82", 0x002000, 0x4a91d08a, BRF_GRA }, // 7 Tiles + { "epr-5761.65", 0x002000, 0xf7d61b65, BRF_GRA }, // 8 Tiles + { "epr-5760.81", 0x002000, 0x95045820, BRF_GRA }, // 9 Tiles + { "epr-5759.64", 0x002000, 0x5f9bae4e, BRF_GRA }, // 10 Tiles + { "epr-5758.80", 0x002000, 0x808ee706, BRF_GRA }, // 11 Tiles + { "epr-5757.63", 0x002000, 0x480f7074, BRF_GRA }, // 12 Tiles + + { "epr-5749.86", 0x004000, 0xe24682cd, BRF_GRA }, // 13 Sprites + { "epr-5750.93", 0x004000, 0x6564d1ad, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Mrviking) +STD_ROM_FN(Mrviking) + +static struct BurnRomInfo MrvikingjRomDesc[] = { + { "epr-5751.129", 0x002000, 0xae97a4c5, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-5752.130", 0x002000, 0xd48e6726, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-5753.131", 0x002000, 0x28c60887, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-5754.132", 0x002000, 0x1f47ed02, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-5755.133", 0x002000, 0xedd62ae1, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-5756.134", 0x002000, 0x11974040, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-5763.3", 0x002000, 0xd712280d, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-5762.82", 0x002000, 0x4a91d08a, BRF_GRA }, // 7 Tiles + { "epr-5761.65", 0x002000, 0xf7d61b65, BRF_GRA }, // 8 Tiles + { "epr-5760.81", 0x002000, 0x95045820, BRF_GRA }, // 9 Tiles + { "epr-5759.64", 0x002000, 0x5f9bae4e, BRF_GRA }, // 10 Tiles + { "epr-5758.80", 0x002000, 0x808ee706, BRF_GRA }, // 11 Tiles + { "epr-5757.63", 0x002000, 0x480f7074, BRF_GRA }, // 12 Tiles + + { "epr-5749.86", 0x004000, 0xe24682cd, BRF_GRA }, // 13 Sprites + { "epr-5750.93", 0x004000, 0x6564d1ad, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Mrvikingj) +STD_ROM_FN(Mrvikingj) + +static struct BurnRomInfo MyheroRomDesc[] = { + { "epr6963b.116", 0x004000, 0x4daf89d4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr6964a.109", 0x004000, 0xc26188e5, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6927.96", 0x004000, 0x3cbbaf64, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-69xx.120", 0x002000, 0x0039e1e9, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6966.62", 0x002000, 0x157f0401, BRF_GRA }, // 4 Tiles + { "epr-6961.61", 0x002000, 0xbe53ce47, BRF_GRA }, // 5 Tiles + { "epr-6960.64", 0x002000, 0xbd381baa, BRF_GRA }, // 6 Tiles + { "epr-6959.63", 0x002000, 0xbc04e79a, BRF_GRA }, // 7 Tiles + { "epr-6958.66", 0x002000, 0x714f2c26, BRF_GRA }, // 8 Tiles + { "epr-6957.65", 0x002000, 0x80920112, BRF_GRA }, // 9 Tiles + + { "epr-6921.117", 0x004000, 0xf19e05a1, BRF_GRA }, // 10 Sprites + { "epr-6923.04", 0x004000, 0x7988adc3, BRF_GRA }, // 11 Sprites + { "epr-6922.110", 0x004000, 0x37f77a78, BRF_GRA }, // 12 Sprites + { "epr-6924.05", 0x004000, 0x42bdc8f6, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Myhero) +STD_ROM_FN(Myhero) + +static struct BurnRomInfo SscandalRomDesc[] = { + { "epr6925b.116", 0x004000, 0xff54dcec, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr6926a.109", 0x004000, 0x5c41eea8, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6927.96", 0x004000, 0x3cbbaf64, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6934.120", 0x002000, 0xaf467223, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6933.62", 0x002000, 0xe7304036, BRF_GRA }, // 4 Tiles + { "epr-6932.61", 0x002000, 0xf5cfbfda, BRF_GRA }, // 5 Tiles + { "epr-6931.64", 0x002000, 0x599d7f87, BRF_GRA }, // 6 Tiles + { "epr-6930.63", 0x002000, 0xcb6616c2, BRF_GRA }, // 7 Tiles + { "epr-6929.66", 0x002000, 0x27a16856, BRF_GRA }, // 8 Tiles + { "epr-6928.65", 0x002000, 0xc0c9cfa4, BRF_GRA }, // 9 Tiles + + { "epr-6921.117", 0x004000, 0xf19e05a1, BRF_GRA }, // 10 Sprites + { "epr-6923.04", 0x004000, 0x7988adc3, BRF_GRA }, // 11 Sprites + { "epr-6922.110", 0x004000, 0x37f77a78, BRF_GRA }, // 12 Sprites + { "epr-6924.05", 0x004000, 0x42bdc8f6, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Sscandal) +STD_ROM_FN(Sscandal) + +static struct BurnRomInfo MyherokRomDesc[] = { + { "ry-11.rom", 0x004000, 0x6f4c8ee5, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ry-09.rom", 0x004000, 0x369302a1, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "ry-07.rom", 0x004000, 0xb8e9922e, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6934.120", 0x002000, 0xaf467223, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "ry-04.rom", 0x004000, 0xdfb75143, BRF_GRA }, // 4 Tiles + { "ry-03.rom", 0x004000, 0xcf68b4a2, BRF_GRA }, // 5 Tiles + { "ry-02.rom", 0x004000, 0xd100eaef, BRF_GRA }, // 6 Tiles + + { "epr-6921.117", 0x004000, 0xf19e05a1, BRF_GRA }, // 7 Sprites + { "epr-6923.04", 0x004000, 0x7988adc3, BRF_GRA }, // 8 Sprites + { "epr-6922.110", 0x004000, 0x37f77a78, BRF_GRA }, // 9 Sprites + { "epr-6924.05", 0x004000, 0x42bdc8f6, BRF_GRA }, // 10 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 11 Timing PROM +}; + +STD_ROM_PICK(Myherok) +STD_ROM_FN(Myherok) + +static struct BurnRomInfo NobRomDesc[] = { + { "dm08.1f", 0x008000, 0x98d602d6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "dm10.1k", 0x008000, 0xe7c06663, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "dm09.1h", 0x008000, 0xdc4c872f, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "dm03.9h", 0x004000, 0x415adf76, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "dm01.12b", 0x008000, 0x446fbcdd, BRF_GRA }, // 4 Tiles + { "dm02.13b", 0x008000, 0xf12df039, BRF_GRA }, // 5 Tiles + { "dm00.10b", 0x008000, 0x35f396df, BRF_GRA }, // 6 Tiles + + { "dm04.5f", 0x008000, 0x2442b86d, BRF_GRA }, // 7 Sprites + { "dm06.5k", 0x008000, 0xe33743a6, BRF_GRA }, // 8 Sprites + { "dm05.5h", 0x008000, 0x7fbba01d, BRF_GRA }, // 9 Sprites + { "dm07.5l", 0x008000, 0x85e7a29f, BRF_GRA }, // 10 Sprites + + { "nobo_pr.16d", 0x000100, 0x95010ac2, BRF_GRA }, // 11 Red PROM + { "nobo_pr.15d", 0x000100, 0xc55aac0c, BRF_GRA }, // 12 Green PROM + { "dm-12.ic3", 0x000100, 0xde394cee, BRF_GRA }, // 13 Blue PROM + { "dc-11.6a", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM + + { "dm.bin", 0x001000, 0x6fde9dcb, BRF_PRG | BRF_OPT }, // 15 MCU +}; + +STD_ROM_PICK(Nob) +STD_ROM_FN(Nob) + +static struct BurnRomInfo NobbRomDesc[] = { + { "nobo-t.bin", 0x008000, 0x176fd168, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "nobo-r.bin", 0x008000, 0xd61cf3c9, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "nobo-s.bin", 0x008000, 0xb0e7697f, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "nobo-m.bin", 0x004000, 0x415adf76, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "nobo-k.bin", 0x008000, 0x446fbcdd, BRF_GRA }, // 4 Tiles + { "nobo-j.bin", 0x008000, 0xf12df039, BRF_GRA }, // 5 Tiles + { "nobo-l.bin", 0x008000, 0x35f396df, BRF_GRA }, // 6 Tiles + + { "nobo-q.bin", 0x008000, 0x2442b86d, BRF_GRA }, // 7 Sprites + { "nobo-o.bin", 0x008000, 0xe33743a6, BRF_GRA }, // 8 Sprites + { "nobo-p.bin", 0x008000, 0x7fbba01d, BRF_GRA }, // 9 Sprites + { "nobo-n.bin", 0x008000, 0x85e7a29f, BRF_GRA }, // 10 Sprites + + { "nobo_pr.16d", 0x000100, 0x95010ac2, BRF_GRA }, // 11 Red PROM + { "nobo_pr.15d", 0x000100, 0xc55aac0c, BRF_GRA }, // 12 Green PROM + { "nobo_pr.14d", 0x000100, 0xde394cee, BRF_GRA }, // 13 Blue PROM + { "nobo_pr.13a", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Nobb) +STD_ROM_FN(Nobb) + +static struct BurnRomInfo Pitfall2RomDesc[] = { + { "epr6456a.116", 0x004000, 0xbcc8406b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr6457a.109", 0x004000, 0xa016fd2a, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr6458a.96", 0x004000, 0x5c30b3e8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6462.120", 0x002000, 0x86bb9185, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr6474a.62", 0x002000, 0x9f1711b9, BRF_GRA }, // 4 Tiles + { "epr6473a.61", 0x002000, 0x8e53b8dd, BRF_GRA }, // 5 Tiles + { "epr6472a.64", 0x002000, 0xe0f34a11, BRF_GRA }, // 6 Tiles + { "epr6471a.63", 0x002000, 0xd5bc805c, BRF_GRA }, // 7 Tiles + { "epr6470a.66", 0x002000, 0x1439729f, BRF_GRA }, // 8 Tiles + { "epr6469a.65", 0x002000, 0xe4ac6921, BRF_GRA }, // 9 Tiles + + { "epr6454a.117", 0x004000, 0xa5d96780, BRF_GRA }, // 10 Sprites + { "epr-6455.05", 0x004000, 0x32ee64a1, BRF_GRA }, // 11 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 12 Timing PROM +}; + +STD_ROM_PICK(Pitfall2) +STD_ROM_FN(Pitfall2) + +static struct BurnRomInfo Pitfall2aRomDesc[] = { + { "epr-6505", 0x004000, 0xb6769739, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6506", 0x004000, 0x1ce6aec4, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr6458a.96", 0x004000, 0x5c30b3e8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6462.120", 0x002000, 0x86bb9185, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr6474a.62", 0x002000, 0x9f1711b9, BRF_GRA }, // 4 Tiles + { "epr6473a.61", 0x002000, 0x8e53b8dd, BRF_GRA }, // 5 Tiles + { "epr6472a.64", 0x002000, 0xe0f34a11, BRF_GRA }, // 6 Tiles + { "epr6471a.63", 0x002000, 0xd5bc805c, BRF_GRA }, // 7 Tiles + { "epr6470a.66", 0x002000, 0x1439729f, BRF_GRA }, // 8 Tiles + { "epr6469a.65", 0x002000, 0xe4ac6921, BRF_GRA }, // 9 Tiles + + { "epr6454a.117", 0x004000, 0xa5d96780, BRF_GRA }, // 10 Sprites + { "epr-6455.05", 0x004000, 0x32ee64a1, BRF_GRA }, // 11 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 12 Timing PROM +}; + +STD_ROM_PICK(Pitfall2a) +STD_ROM_FN(Pitfall2a) + +static struct BurnRomInfo Pitfall2uRomDesc[] = { + { "epr-6623.116", 0x004000, 0xbcb47ed6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr6624a.109", 0x004000, 0x6e8b09c1, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6625.96", 0x004000, 0xdc5484ba, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6462.120", 0x002000, 0x86bb9185, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr6474a.62", 0x002000, 0x9f1711b9, BRF_GRA }, // 4 Tiles + { "epr6473a.61", 0x002000, 0x8e53b8dd, BRF_GRA }, // 5 Tiles + { "epr6472a.64", 0x002000, 0xe0f34a11, BRF_GRA }, // 6 Tiles + { "epr6471a.63", 0x002000, 0xd5bc805c, BRF_GRA }, // 7 Tiles + { "epr6470a.66", 0x002000, 0x1439729f, BRF_GRA }, // 8 Tiles + { "epr6469a.65", 0x002000, 0xe4ac6921, BRF_GRA }, // 9 Tiles + + { "epr6454a.117", 0x004000, 0xa5d96780, BRF_GRA }, // 10 Sprites + { "epr-6455.05", 0x004000, 0x32ee64a1, BRF_GRA }, // 11 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 12 Timing PROM +}; + +STD_ROM_PICK(Pitfall2u) +STD_ROM_FN(Pitfall2u) + +static struct BurnRomInfo RaflesiaRomDesc[] = { + { "epr-7411.116", 0x004000, 0x88a0c6c6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-7412.109", 0x004000, 0xd3b8cddf, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-7413.96", 0x004000, 0xb7e688b3, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-7420.120", 0x002000, 0x14387666, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-7419.62", 0x002000, 0xbfd5f34c, BRF_GRA }, // 4 Tiles + { "epr-7418.61", 0x002000, 0xf8cbc9b6, BRF_GRA }, // 5 Tiles + { "epr-7417.64", 0x002000, 0xe63501bc, BRF_GRA }, // 6 Tiles + { "epr-7416.63", 0x002000, 0x093e5693, BRF_GRA }, // 7 Tiles + { "epr-7415.66", 0x002000, 0x1a8d6bd6, BRF_GRA }, // 8 Tiles + { "epr-7414.65", 0x002000, 0x5d20f218, BRF_GRA }, // 9 Tiles + + { "epr-7407.117", 0x004000, 0xf09fc057, BRF_GRA }, // 10 Sprites + { "epr-7409.04", 0x004000, 0x819fedb8, BRF_GRA }, // 11 Sprites + { "epr-7408.110", 0x004000, 0x3189f33c, BRF_GRA }, // 12 Sprites + { "epr-7410.05", 0x004000, 0xced74789, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Raflesia) +STD_ROM_FN(Raflesia) + +static struct BurnRomInfo RegulusRomDesc[] = { + { "epr-5640a.129", 0x002000, 0xdafb1528, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-5641a.130", 0x002000, 0x0fcc850e, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-5642a.131", 0x002000, 0x4feffa17, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-5643a.132", 0x002000, 0xb8ac7eb4, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-5644.133", 0x002000, 0xffd05b7d, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-5645a.134", 0x002000, 0x6b4bf77c, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-5652.3", 0x002000, 0x74edcb98, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-5651.82", 0x002000, 0xf07f3e82, BRF_GRA }, // 7 Tiles + { "epr-5650.65", 0x002000, 0x84c1baa2, BRF_GRA }, // 8 Tiles + { "epr-5649.81", 0x002000, 0x6774c895, BRF_GRA }, // 9 Tiles + { "epr-5648.64", 0x002000, 0x0c69e92a, BRF_GRA }, // 10 Tiles + { "epr-5647.80", 0x002000, 0x9330f7b5, BRF_GRA }, // 11 Tiles + { "epr-5646.63", 0x002000, 0x4dfacbbc, BRF_GRA }, // 12 Tiles + + { "epr-5638.86", 0x004000, 0x617363dd, BRF_GRA }, // 13 Sprites + { "epr-5639.93", 0x004000, 0xa4ec5131, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Regulus) +STD_ROM_FN(Regulus) + +static struct BurnRomInfo RegulusoRomDesc[] = { + { "epr-5640.129", 0x002000, 0x8324d0d4, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-5641.130", 0x002000, 0x0a09f5c7, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-5642.131", 0x002000, 0xff27b2f6, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-5643.132", 0x002000, 0x0d867df0, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-5644.133", 0x002000, 0xffd05b7d, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-5645.134", 0x002000, 0x57a2b4b4, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-5652.3", 0x002000, 0x74edcb98, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-5651.82", 0x002000, 0xf07f3e82, BRF_GRA }, // 7 Tiles + { "epr-5650.65", 0x002000, 0x84c1baa2, BRF_GRA }, // 8 Tiles + { "epr-5649.81", 0x002000, 0x6774c895, BRF_GRA }, // 9 Tiles + { "epr-5648.64", 0x002000, 0x0c69e92a, BRF_GRA }, // 10 Tiles + { "epr-5647.80", 0x002000, 0x9330f7b5, BRF_GRA }, // 11 Tiles + { "epr-5646.63", 0x002000, 0x4dfacbbc, BRF_GRA }, // 12 Tiles + + { "epr-5638.86", 0x004000, 0x617363dd, BRF_GRA }, // 13 Sprites + { "epr-5639.93", 0x004000, 0xa4ec5131, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Reguluso) +STD_ROM_FN(Reguluso) + +static struct BurnRomInfo RegulusuRomDesc[] = { + { "epr-5950.129", 0x002000, 0x3b047b67, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-5951.130", 0x002000, 0xd66453ab, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-5952.131", 0x002000, 0xf3d0158a, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-5953.132", 0x002000, 0xa9ad4f44, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-5644.133", 0x002000, 0xffd05b7d, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-5955.134", 0x002000, 0x65ddb2a3, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-5652.3", 0x002000, 0x74edcb98, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-5651.82", 0x002000, 0xf07f3e82, BRF_GRA }, // 7 Tiles + { "epr-5650.65", 0x002000, 0x84c1baa2, BRF_GRA }, // 8 Tiles + { "epr-5649.81", 0x002000, 0x6774c895, BRF_GRA }, // 9 Tiles + { "epr-5648.64", 0x002000, 0x0c69e92a, BRF_GRA }, // 10 Tiles + { "epr-5647.80", 0x002000, 0x9330f7b5, BRF_GRA }, // 11 Tiles + { "epr-5646.63", 0x002000, 0x4dfacbbc, BRF_GRA }, // 12 Tiles + + { "epr-5638.86", 0x004000, 0x617363dd, BRF_GRA }, // 13 Sprites + { "epr-5639.93", 0x004000, 0xa4ec5131, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Regulusu) +STD_ROM_FN(Regulusu) + +static struct BurnRomInfo SeganinjRomDesc[] = { + { "epr-.116", 0x004000, 0xa5d0c9d0, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-.109", 0x004000, 0xb9e6775c, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6552.96", 0x004000, 0xf2eeb0d8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 4 Tiles + { "epr-6592.61", 0x002000, 0x7804db86, BRF_GRA }, // 5 Tiles + { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 6 Tiles + { "epr-6590.63", 0x002000, 0xbf858cad, BRF_GRA }, // 7 Tiles + { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 8 Tiles + { "epr-6588.65", 0x002000, 0xdc931dbb, BRF_GRA }, // 9 Tiles + + { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 10 Sprites + { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 11 Sprites + { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 12 Sprites + { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Seganinj) +STD_ROM_FN(Seganinj) + +static struct BurnRomInfo SeganinjuRomDesc[] = { + { "epr-7149.116", 0x004000, 0xcd9fade7, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-7150.109", 0x004000, 0xc36351e2, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6552.96", 0x004000, 0xf2eeb0d8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 4 Tiles + { "epr-6592.61", 0x002000, 0x7804db86, BRF_GRA }, // 5 Tiles + { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 6 Tiles + { "epr-6590.63", 0x002000, 0xbf858cad, BRF_GRA }, // 7 Tiles + { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 8 Tiles + { "epr-6588.65", 0x002000, 0xdc931dbb, BRF_GRA }, // 9 Tiles + + { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 10 Sprites + { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 11 Sprites + { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 12 Sprites + { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Seganinju) +STD_ROM_FN(Seganinju) + +static struct BurnRomInfo NinjaRomDesc[] = { + { "epr6594.bin", 0x004000, 0x3ef0e5fc, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr6595.bin", 0x004000, 0xb16f13cd, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6552.96", 0x004000, 0xf2eeb0d8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 4 Tiles + { "epr6592.bin", 0x002000, 0x88d0c7a1, BRF_GRA }, // 5 Tiles + { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 6 Tiles + { "epr6590.bin", 0x002000, 0x956e3b61, BRF_GRA }, // 7 Tiles + { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 8 Tiles + { "epr6588.bin", 0x002000, 0x023a14a3, BRF_GRA }, // 9 Tiles + + { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 10 Sprites + { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 11 Sprites + { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 12 Sprites + { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Ninja) +STD_ROM_FN(Ninja) + +static struct BurnRomInfo NprincesRomDesc[] = { + { "epr-6612.129", 0x002000, 0x1b30976f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6613.130", 0x002000, 0x18281f27, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6614.131", 0x002000, 0x69fc3d73, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-6615.132", 0x002000, 0x1d0374c8, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-6577.133", 0x002000, 0x73616e03, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-6617.134", 0x002000, 0x20b6f895, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 7 Tiles + { "epr-6557.61", 0x002000, 0x6eb131d0, BRF_GRA }, // 8 Tiles + { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 9 Tiles + { "epr-6555.63", 0x002000, 0x7f669aac, BRF_GRA }, // 10 Tiles + { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 11 Tiles + { "epr-6553.65", 0x002000, 0xeb82a8fe, BRF_GRA }, // 12 Tiles + + { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 13 Sprites + { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 14 Sprites + { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 15 Sprites + { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 16 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM +}; + +STD_ROM_PICK(Nprinces) +STD_ROM_FN(Nprinces) + +static struct BurnRomInfo NprincesoRomDesc[] = { + { "epr-6550.116", 0x004000, 0x5f6d59f1, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6551.109", 0x004000, 0x1af133b2, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6552.96", 0x004000, 0xf2eeb0d8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 4 Tiles + { "epr-6557.61", 0x002000, 0x6eb131d0, BRF_GRA }, // 5 Tiles + { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 6 Tiles + { "epr-6555.63", 0x002000, 0x7f669aac, BRF_GRA }, // 7 Tiles + { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 8 Tiles + { "epr-6553.65", 0x002000, 0xeb82a8fe, BRF_GRA }, // 9 Tiles + + { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 10 Sprites + { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 11 Sprites + { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 12 Sprites + { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Nprinceso) +STD_ROM_FN(Nprinceso) + +static struct BurnRomInfo NprincesuRomDesc[] = { + { "epr-6573.129", 0x002000, 0xd2919c7d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6574.130", 0x002000, 0x5a132833, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6575.131", 0x002000, 0xa94b0bd4, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-6576.132", 0x002000, 0x27d3bbdb, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-6577.133", 0x002000, 0x73616e03, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-6578.134", 0x002000, 0xab68499f, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 7 Tiles + { "epr-6557.61", 0x002000, 0x6eb131d0, BRF_GRA }, // 8 Tiles + { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 9 Tiles + { "epr-6555.63", 0x002000, 0x7f669aac, BRF_GRA }, // 10 Tiles + { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 11 Tiles + { "epr-6553.65", 0x002000, 0xeb82a8fe, BRF_GRA }, // 12 Tiles + + { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 13 Sprites + { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 14 Sprites + { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 15 Sprites + { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 16 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM +}; + +STD_ROM_PICK(Nprincesu) +STD_ROM_FN(Nprincesu) + +static struct BurnRomInfo NprincesbRomDesc[] = { + { "nprinces.001", 0x004000, 0xe0de073c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "nprinces.002", 0x004000, 0x27219c7f, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6552.96", 0x004000, 0xf2eeb0d8, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6559.120", 0x002000, 0x5a1570ee, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6558.62", 0x002000, 0x2af9eaeb, BRF_GRA }, // 4 Tiles + { "epr-6557.61", 0x002000, 0x6eb131d0, BRF_GRA }, // 5 Tiles + { "epr-6556.64", 0x002000, 0x79fd26f7, BRF_GRA }, // 6 Tiles + { "epr-6555.63", 0x002000, 0x7f669aac, BRF_GRA }, // 7 Tiles + { "epr-6554.66", 0x002000, 0x5ac9d205, BRF_GRA }, // 8 Tiles + { "epr-6553.65", 0x002000, 0xeb82a8fe, BRF_GRA }, // 9 Tiles + + { "epr-6546.117", 0x004000, 0xa4785692, BRF_GRA }, // 10 Sprites + { "epr-6548.04", 0x004000, 0xbdf278c1, BRF_GRA }, // 11 Sprites + { "epr-6547.110", 0x004000, 0x34451b08, BRF_GRA }, // 12 Sprites + { "epr-6549.05", 0x004000, 0xd2057668, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM + { "nprinces.129", 0x000100, 0xae765f62, BRF_PRG }, // 15 Decryption Table + { "nprinces.123", 0x000020, 0xed5146e9, BRF_PRG }, // 15 Decryption Table +}; + +STD_ROM_PICK(Nprincesb) +STD_ROM_FN(Nprincesb) + +static struct BurnRomInfo SpatterRomDesc[] = { + { "epr-6392.116", 0x004000, 0x329b4506, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6393.109", 0x004000, 0x3b56e25f, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6394.96", 0x004000, 0x647c1301, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6316.120", 0x002000, 0x1df95511, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6328.62", 0x002000, 0xa2bf2832, BRF_GRA }, // 4 Tiles + { "epr-6397.61", 0x002000, 0xc60d4471, BRF_GRA }, // 5 Tiles + { "epr-6326.64", 0x002000, 0x269fbb4c, BRF_GRA }, // 6 Tiles + { "epr-6396.63", 0x002000, 0xc15ccf3b, BRF_GRA }, // 7 Tiles + { "epr-6324.66", 0x002000, 0x8ab3b563, BRF_GRA }, // 8 Tiles + { "epr-6395.65", 0x002000, 0x3f083065, BRF_GRA }, // 9 Tiles + + { "epr-6306.04", 0x004000, 0xe871e132, BRF_GRA }, // 10 Sprites + { "epr-6308.117", 0x004000, 0x99c2d90e, BRF_GRA }, // 11 Sprites + { "epr-6307.05", 0x004000, 0x0a5ad543, BRF_GRA }, // 12 Sprites + { "epr-6309.110", 0x004000, 0x7423ad98, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Spatter) +STD_ROM_FN(Spatter) + +static struct BurnRomInfo SsanchanRomDesc[] = { + { "epr-6310.116", 0x004000, 0x26b43701, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6311.109", 0x004000, 0xcb2bc620, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6312.96", 0x004000, 0x71b15b47, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6316.120", 0x002000, 0x1df95511, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6328.62", 0x002000, 0xa2bf2832, BRF_GRA }, // 4 Tiles + { "epr-6327.61", 0x002000, 0x53298109, BRF_GRA }, // 5 Tiles + { "epr-6326.64", 0x002000, 0x269fbb4c, BRF_GRA }, // 6 Tiles + { "epr-6325.63", 0x002000, 0xbf038745, BRF_GRA }, // 7 Tiles + { "epr-6324.66", 0x002000, 0x8ab3b563, BRF_GRA }, // 8 Tiles + { "epr-6323.65", 0x002000, 0x0394673c, BRF_GRA }, // 9 Tiles + + { "epr-6306.04", 0x004000, 0xe871e132, BRF_GRA }, // 10 Sprites + { "epr-6308.117", 0x004000, 0x99c2d90e, BRF_GRA }, // 11 Sprites + { "epr-6307.05", 0x004000, 0x0a5ad543, BRF_GRA }, // 12 Sprites + { "epr-6309.110", 0x004000, 0x7423ad98, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Ssanchan) +STD_ROM_FN(Ssanchan) + +static struct BurnRomInfo StarjackRomDesc[] = { + { "epr5320b.129", 0x002000, 0x7ab72ecd, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr5321a.130", 0x002000, 0x38b99050, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr5322a.131", 0x002000, 0x103a595b, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-5323.132", 0x002000, 0x46af0d58, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-5324.133", 0x002000, 0x1e89efe2, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-5325.134", 0x002000, 0xd6e379a1, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-5332.3", 0x002000, 0x7a72ab3d, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-5331.82", 0x002000, 0x251d898f, BRF_GRA }, // 7 Tiles + { "epr-5330.65", 0x002000, 0xeb048745, BRF_GRA }, // 8 Tiles + { "epr-5329.81", 0x002000, 0x3e8bcaed, BRF_GRA }, // 9 Tiles + { "epr-5328.64", 0x002000, 0x9ed7849f, BRF_GRA }, // 10 Tiles + { "epr-5327.80", 0x002000, 0x79e92cb1, BRF_GRA }, // 11 Tiles + { "epr-5326.63", 0x002000, 0xba7e2b47, BRF_GRA }, // 12 Tiles + + { "epr-5318.86", 0x004000, 0x6f2e1fd3, BRF_GRA }, // 13 Sprites + { "epr-5319.93", 0x004000, 0xebee4999, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Starjack) +STD_ROM_FN(Starjack) + +static struct BurnRomInfo StarjacksRomDesc[] = { + { "a1_ic29.129", 0x002000, 0x59a22a1f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a1_ic30.130", 0x002000, 0x7f4597dc, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "a1_ic31.131", 0x002000, 0x6074c046, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "a1_ic32.132", 0x002000, 0x1c48a3fa, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "a1_ic33.133", 0x002000, 0x7598bd51, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "a1_ic34.134", 0x002000, 0xf66fa604, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-5332.3", 0x002000, 0x7a72ab3d, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-5331.82", 0x002000, 0x251d898f, BRF_GRA }, // 7 Tiles + { "a1_ic65.65", 0x002000, 0x0ab1893c, BRF_GRA }, // 8 Tiles + { "epr-5329.81", 0x002000, 0x3e8bcaed, BRF_GRA }, // 9 Tiles + { "a1_ic64.64", 0x002000, 0x7f628ae6, BRF_GRA }, // 10 Tiles + { "epr-5327.80", 0x002000, 0x79e92cb1, BRF_GRA }, // 11 Tiles + { "a1_ic63.63", 0x002000, 0x5bcb253e, BRF_GRA }, // 12 Tiles + + { "a1_ic86.86", 0x004000, 0x6f2e1fd3, BRF_GRA }, // 13 Sprites + { "a1_ic93.93", 0x004000, 0x07987244, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Starjacks) +STD_ROM_FN(Starjacks) + +static struct BurnRomInfo SwatRomDesc[] = { + { "epr5807b.129", 0x002000, 0x93db9c9f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-5808.130", 0x002000, 0x67116665, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-5809.131", 0x002000, 0xfd792fc9, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-5810.132", 0x002000, 0xdc2b279d, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-5811.133", 0x002000, 0x093e3ab1, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-5812.134", 0x002000, 0x5bfd692f, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-5819.3", 0x002000, 0xf6afd0fd, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-5818.82", 0x002000, 0xb22033d9, BRF_GRA }, // 7 Tiles + { "epr-5817.65", 0x002000, 0xfd942797, BRF_GRA }, // 8 Tiles + { "epr-5816.81", 0x002000, 0x4384376d, BRF_GRA }, // 9 Tiles + { "epr-5815.64", 0x002000, 0x16ad046c, BRF_GRA }, // 10 Tiles + { "epr-5814.80", 0x002000, 0xbe721c99, BRF_GRA }, // 11 Tiles + { "epr-5813.63", 0x002000, 0x0d42c27e, BRF_GRA }, // 12 Tiles + + { "epr-5805.86", 0x004000, 0x5a732865, BRF_GRA }, // 13 Sprites + { "epr-5806.93", 0x004000, 0x26ac258c, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Swat) +STD_ROM_FN(Swat) + +static struct BurnRomInfo TeddybbRomDesc[] = { + { "epr-6768.116", 0x004000, 0x5939817e, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6769.109", 0x004000, 0x14a98ddd, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6770.96", 0x004000, 0x67b0c7c2, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr6748x.120", 0x002000, 0xc2a1b89d, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6747.62", 0x002000, 0xa0e5aca7, BRF_GRA }, // 4 Tiles + { "epr-6746.61", 0x002000, 0xcdb77e51, BRF_GRA }, // 5 Tiles + { "epr-6745.64", 0x002000, 0x0cab75c3, BRF_GRA }, // 6 Tiles + { "epr-6744.63", 0x002000, 0x0ef8d2cd, BRF_GRA }, // 7 Tiles + { "epr-6743.66", 0x002000, 0xc33062b5, BRF_GRA }, // 8 Tiles + { "epr-6742.65", 0x002000, 0xc457e8c5, BRF_GRA }, // 9 Tiles + + { "epr-6735.117", 0x004000, 0x1be35a97, BRF_GRA }, // 10 Sprites + { "epr-6737.04", 0x004000, 0x6b53aa7a, BRF_GRA }, // 11 Sprites + { "epr-6736.110", 0x004000, 0x565c25d0, BRF_GRA }, // 12 Sprites + { "epr-6738.05", 0x004000, 0xe116285f, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Teddybb) +STD_ROM_FN(Teddybb) + +static struct BurnRomInfo TeddybboRomDesc[] = { + { "epr-6739.116", 0x004000, 0x81a37e69, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-6740.109", 0x004000, 0x715388a9, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-6741.96", 0x004000, 0xe5a74f5f, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-6748.120", 0x002000, 0x9325a1cf, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-6747.62", 0x002000, 0xa0e5aca7, BRF_GRA }, // 4 Tiles + { "epr-6746.61", 0x002000, 0xcdb77e51, BRF_GRA }, // 5 Tiles + { "epr-6745.64", 0x002000, 0x0cab75c3, BRF_GRA }, // 6 Tiles + { "epr-6744.63", 0x002000, 0x0ef8d2cd, BRF_GRA }, // 7 Tiles + { "epr-6743.66", 0x002000, 0xc33062b5, BRF_GRA }, // 8 Tiles + { "epr-6742.65", 0x002000, 0xc457e8c5, BRF_GRA }, // 9 Tiles + + { "epr-6735.117", 0x004000, 0x1be35a97, BRF_GRA }, // 10 Sprites + { "epr-6737.04", 0x004000, 0x6b53aa7a, BRF_GRA }, // 11 Sprites + { "epr-6736.110", 0x004000, 0x565c25d0, BRF_GRA }, // 12 Sprites + { "epr-6738.05", 0x004000, 0xe116285f, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Teddybbo) +STD_ROM_FN(Teddybbo) + +static struct BurnRomInfo UpndownRomDesc[] = { + { "epr5516a.129", 0x002000, 0x038c82da, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr5517a.130", 0x002000, 0x6930e1de, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-5518.131", 0x002000, 0x2a370c99, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-5519.132", 0x002000, 0x9d664a58, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-5520.133", 0x002000, 0x208dfbdf, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-5521.134", 0x002000, 0xe7b8d87a, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-5535.3", 0x002000, 0xcf4e4c45, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-5527.82", 0x002000, 0xb2d616f1, BRF_GRA }, // 7 Tiles + { "epr-5526.65", 0x002000, 0x8a8b33c2, BRF_GRA }, // 8 Tiles + { "epr-5525.81", 0x002000, 0xe749c5ef, BRF_GRA }, // 9 Tiles + { "epr-5524.64", 0x002000, 0x8b886952, BRF_GRA }, // 10 Tiles + { "epr-5523.80", 0x002000, 0xdede35d9, BRF_GRA }, // 11 Tiles + { "epr-5522.63", 0x002000, 0x5e6d9dff, BRF_GRA }, // 12 Tiles + + { "epr-5514.86", 0x004000, 0xfcc0a88b, BRF_GRA }, // 13 Sprites + { "epr-5515.93", 0x004000, 0x60908838, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Upndown) +STD_ROM_FN(Upndown) + +static struct BurnRomInfo UpndownuRomDesc[] = { + { "epr-5679.129", 0x002000, 0xc4f2f9c2, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-5680.130", 0x002000, 0x837f021c, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-5681.131", 0x002000, 0xe1c7ff7e, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-5682.132", 0x002000, 0x4a5edc1e, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-5520.133", 0x002000, 0x208dfbdf, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-5684.133", 0x002000, 0x32fa95da, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-5528.3", 0x002000, 0x00cd44ab, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-5527.82", 0x002000, 0xb2d616f1, BRF_GRA }, // 7 Tiles + { "epr-5526.65", 0x002000, 0x8a8b33c2, BRF_GRA }, // 8 Tiles + { "epr-5525.81", 0x002000, 0xe749c5ef, BRF_GRA }, // 9 Tiles + { "epr-5524.64", 0x002000, 0x8b886952, BRF_GRA }, // 10 Tiles + { "epr-5523.80", 0x002000, 0xdede35d9, BRF_GRA }, // 11 Tiles + { "epr-5522.63", 0x002000, 0x5e6d9dff, BRF_GRA }, // 12 Tiles + + { "epr-5514.86", 0x004000, 0xfcc0a88b, BRF_GRA }, // 13 Sprites + { "epr-5515.93", 0x004000, 0x60908838, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Upndownu) +STD_ROM_FN(Upndownu) + +static struct BurnRomInfo WboyRomDesc[] = { + { "epr-7489.116", 0x004000, 0x130f4b70, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-7490.109", 0x004000, 0x9e656733, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-7491.96", 0x004000, 0x1f7d0efe, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 4 Tiles + { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 5 Tiles + { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 6 Tiles + { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 7 Tiles + { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 8 Tiles + { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 9 Tiles + + { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 10 Sprites + { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 11 Sprites + { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 12 Sprites + { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Wboy) +STD_ROM_FN(Wboy) + +static struct BurnRomInfo WboyoRomDesc[] = { + { "epr-.116", 0x004000, 0x51d27534, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-.109", 0x004000, 0xe29d1cd1, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-7491.96", 0x004000, 0x1f7d0efe, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 4 Tiles + { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 5 Tiles + { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 6 Tiles + { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 7 Tiles + { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 8 Tiles + { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 9 Tiles + + { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 10 Sprites + { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 11 Sprites + { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 12 Sprites + { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Wboyo) +STD_ROM_FN(Wboyo) + +static struct BurnRomInfo Wboy2RomDesc[] = { + { "epr-7587.129", 0x002000, 0x1bbb7354, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "epr-7588.130", 0x002000, 0x21007413, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "epr-7589.131", 0x002000, 0x44b30433, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "epr-7590.132", 0x002000, 0xbb525a0b, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-7591.133", 0x002000, 0x8379aa23, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-7592.134", 0x002000, 0xc767a5d7, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 7 Tiles + { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 8 Tiles + { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 9 Tiles + { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 10 Tiles + { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 11 Tiles + { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 12 Tiles + + { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 13 Sprites + { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 14 Sprites + { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 15 Sprites + { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 16 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM +}; + +STD_ROM_PICK(Wboy2) +STD_ROM_FN(Wboy2) + +static struct BurnRomInfo Wboy2uRomDesc[] = { + { "ic129_02.bin", 0x002000, 0x32c4b709, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ic130_03.bin", 0x002000, 0x56463ede, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "ic131_04.bin", 0x002000, 0x775ed392, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "ic132_05.bin", 0x002000, 0x7b922708, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "epr-7591.133", 0x002000, 0x8379aa23, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "epr-7592.134", 0x002000, 0xc767a5d7, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr7498a.3", 0x002000, 0xc198205c, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 7 Tiles + { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 8 Tiles + { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 9 Tiles + { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 10 Tiles + { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 11 Tiles + { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 12 Tiles + + { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 13 Sprites + { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 14 Sprites + { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 15 Sprites + { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 16 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM +}; + +STD_ROM_PICK(Wboy2u) +STD_ROM_FN(Wboy2u) + +static struct BurnRomInfo Wboy3RomDesc[] = { + { "wb_1", 0x004000, 0xbd6fef49, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "wb_2", 0x004000, 0x4081b624, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "wb_3", 0x004000, 0xc48a0e36, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 4 Tiles + { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 5 Tiles + { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 6 Tiles + { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 7 Tiles + { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 8 Tiles + { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 9 Tiles + + { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 10 Sprites + { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 11 Sprites + { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 12 Sprites + { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Wboy3) +STD_ROM_FN(Wboy3) + +static struct BurnRomInfo Wboy4RomDesc[] = { + { "ic2.bin", 0x008000, 0x48b2c006, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ic3.bin", 0x008000, 0x466cae31, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + + { "7583.126", 0x008000, 0x99334b3c, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program Code + + { "epr7610.ic62", 0x004000, 0x1685d26a, BRF_GRA }, // 3 Tiles + { "epr7609.ic64", 0x004000, 0x87ecba53, BRF_GRA }, // 4 Tiles + { "epr7608.ic66", 0x004000, 0xe812b3ec, BRF_GRA }, // 5 Tiles + + { "7578.87", 0x008000, 0x6ff1637f, BRF_GRA }, // 6 Sprites + { "7577.86", 0x008000, 0x58b3705e, BRF_GRA }, // 7 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 8 Timing PROM +}; + +STD_ROM_PICK(Wboy4) +STD_ROM_FN(Wboy4) + +static struct BurnRomInfo Wboy5RomDesc[] = { + { "wb1.ic116", 0x004000, 0x6c67407c, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "wb_2", 0x004000, 0x4081b624, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "wb_3", 0x004000, 0xc48a0e36, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 4 Tiles + { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 5 Tiles + { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 6 Tiles + { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 7 Tiles + { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 8 Tiles + { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 9 Tiles + + { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 10 Sprites + { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 11 Sprites + { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 12 Sprites + { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Wboy5) +STD_ROM_FN(Wboy5) + +static struct BurnRomInfo WboyuRomDesc[] = { + { "ic116_89.bin", 0x004000, 0x73d8cef0, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ic109_90.bin", 0x004000, 0x29546828, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "ic096_91.bin", 0x004000, 0xc7145c2a, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + + { "epr-7498.120", 0x002000, 0x78ae1e7b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program Code + + { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 4 Tiles + { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 5 Tiles + { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 6 Tiles + { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 7 Tiles + { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 8 Tiles + { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 9 Tiles + + { "ic117_85.bin", 0x004000, 0x1ee96ae8, BRF_GRA }, // 10 Sprites + { "ic004_87.bin", 0x004000, 0x119735bb, BRF_GRA }, // 11 Sprites + { "ic110_86.bin", 0x004000, 0x26d0fac4, BRF_GRA }, // 12 Sprites + { "ic005_88.bin", 0x004000, 0x2602e519, BRF_GRA }, // 13 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 14 Timing PROM +}; + +STD_ROM_PICK(Wboyu) +STD_ROM_FN(Wboyu) + +static struct BurnRomInfo WbdeluxeRomDesc[] = { + { "wbd1.bin", 0x002000, 0xa1bedbd7, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "ic130_03.bin", 0x002000, 0x56463ede, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "wbd3.bin", 0x002000, 0x6fcdbd4c, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "ic132_05.bin", 0x002000, 0x7b922708, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "wbd5.bin", 0x002000, 0xf6b02902, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "wbd6.bin", 0x002000, 0x43df21fe, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "epr7498a.3", 0x002000, 0xc198205c, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "epr-7497.62", 0x002000, 0x08d609ca, BRF_GRA }, // 7 Tiles + { "epr-7496.61", 0x002000, 0x6f61fdf1, BRF_GRA }, // 8 Tiles + { "epr-7495.64", 0x002000, 0x6a0d2c2d, BRF_GRA }, // 9 Tiles + { "epr-7494.63", 0x002000, 0xa8e281c7, BRF_GRA }, // 10 Tiles + { "epr-7493.66", 0x002000, 0x89305df4, BRF_GRA }, // 11 Tiles + { "epr-7492.65", 0x002000, 0x60f806b1, BRF_GRA }, // 12 Tiles + + { "epr-7485.117", 0x004000, 0xc2891722, BRF_GRA }, // 13 Sprites + { "epr-7487.04", 0x004000, 0x2d3a421b, BRF_GRA }, // 14 Sprites + { "epr-7486.110", 0x004000, 0x8d622c50, BRF_GRA }, // 15 Sprites + { "epr-7488.05", 0x004000, 0x007c2f1b, BRF_GRA }, // 16 Sprites + + { "pr-5317.76", 0x000100, 0x648350b8, BRF_OPT }, // 17 Timing PROM +}; + +STD_ROM_PICK(Wbdeluxe) +STD_ROM_FN(Wbdeluxe) + +static struct BurnRomInfo WmatchRomDesc[] = { + { "wm.129", 0x002000, 0xb6db4442, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "wm.130", 0x002000, 0x59a0a7a0, BRF_ESS | BRF_PRG }, // 1 Z80 #1 Program Code + { "wm.131", 0x002000, 0x4cb3856a, BRF_ESS | BRF_PRG }, // 2 Z80 #1 Program Code + { "wm.132", 0x002000, 0xe2e44b29, BRF_ESS | BRF_PRG }, // 3 Z80 #1 Program Code + { "wm.133", 0x002000, 0x43a36445, BRF_ESS | BRF_PRG }, // 4 Z80 #1 Program Code + { "wm.134", 0x002000, 0x5624794c, BRF_ESS | BRF_PRG }, // 5 Z80 #1 Program Code + + { "wm.3", 0x002000, 0x50d2afb7, BRF_ESS | BRF_PRG }, // 6 Z80 #2 Program Code + + { "wm.82", 0x002000, 0x540f0bf3, BRF_GRA }, // 7 Tiles + { "wm.65", 0x002000, 0x92c1e39e, BRF_GRA }, // 8 Tiles + { "wm.81", 0x002000, 0x6a01ff2a, BRF_GRA }, // 9 Tiles + { "wm.64", 0x002000, 0xaae6449b, BRF_GRA }, // 10 Tiles + { "wm.80", 0x002000, 0xfc3f0bd4, BRF_GRA }, // 11 Tiles + { "wm.63", 0x002000, 0xc2ce9b93, BRF_GRA }, // 12 Tiles + + { "wm.86", 0x004000, 0x238ae0e5, BRF_GRA }, // 13 Sprites + { "wm.93", 0x004000, 0xa2f19170, BRF_GRA }, // 14 Sprites + + { "pr-5317.106", 0x000100, 0x648350b8, BRF_OPT }, // 15 Timing PROM +}; + +STD_ROM_PICK(Wmatch) +STD_ROM_FN(Wmatch) + +/*============================================================================================== +Decode Functions +===============================================================================================*/ + +static void sega_decode(const UINT8 convtable[32][4]) +{ + INT32 A; + + INT32 length = 0x10000; + INT32 cryptlen = 0x8000; + UINT8 *rom = System1Rom1; + UINT8 *decrypted = System1Fetch1; + + for (A = 0x0000;A < cryptlen;A++) + { + INT32 xorval = 0; + + UINT8 src = rom[A]; + + /* pick the translation table from bits 0, 4, 8 and 12 of the address */ + INT32 row = (A & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2) + (((A >> 12) & 1) << 3); + + /* pick the offset in the table from bits 3 and 5 of the source data */ + INT32 col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1); + /* the bottom half of the translation table is the mirror image of the top */ + if (src & 0x80) + { + col = 3 - col; + xorval = 0xa8; + } + + /* decode the opcodes */ + decrypted[A] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval); + + /* decode the data */ + rom[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval); + + if (convtable[2*row][col] == 0xff) /* table incomplete! (for development) */ + decrypted[A] = 0xee; + if (convtable[2*row+1][col] == 0xff) /* table incomplete! (for development) */ + rom[A] = 0xee; + } + + /* this is a kludge to catch anyone who has code that crosses the encrypted/ */ + /* decrypted boundary. ssanchan does it */ + if (length > 0x8000) + { + INT32 bytes = 0x4000; + memcpy(&decrypted[0x8000], &rom[0x8000], bytes); + } +} + +void bullfgtj_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0xa0,0xa8,0x20,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...0...0...0...0 */ + { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...0...0...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...0...1...0 */ + { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...0 */ + { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...1...1...0 */ + { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */ + { 0x88,0x08,0xa8,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...0...1 */ + { 0x28,0xa8,0x20,0xa0 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */ + { 0x28,0xa8,0x20,0xa0 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */ + { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */ + { 0x88,0x08,0xa8,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...1 */ + { 0x08,0x28,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */ + { 0x08,0x28,0x00,0x20 }, { 0x88,0x08,0xa8,0x28 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +static void flicky_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x08,0x88,0x00,0x80 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ + { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0x20,0x00 }, /* ...0...0...1...0 */ + { 0x28,0x08,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ + { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...1...0...0 */ + { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ + { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...0...1...1...0 */ + { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */ + { 0x08,0x88,0x00,0x80 }, { 0xa8,0x88,0x28,0x08 }, /* ...1...0...0...0 */ + { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...1 */ + { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */ + { 0xa8,0x88,0x28,0x08 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...1 */ + { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...0 */ + { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...1 */ + { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...1...1...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x88,0x80,0x08,0x00 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +static void hvymetal_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...0 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...1...0...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...1...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +void imsorry_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0x08,0x80,0x00 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...0...0 */ + { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...1 */ + { 0x88,0x08,0xa8,0x28 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...1...0 */ + { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */ + { 0x00,0x20,0x80,0xa0 }, { 0x08,0x00,0x88,0x80 }, /* ...0...1...0...0 */ + { 0x00,0x20,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...0...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...0 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */ + { 0x88,0x08,0x80,0x00 }, { 0x08,0x00,0x88,0x80 }, /* ...1...0...0...0 */ + { 0x08,0x00,0x88,0x80 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...0...1 */ + { 0x08,0x28,0x00,0x20 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...1 */ + { 0x08,0x28,0x00,0x20 }, { 0x08,0x00,0x88,0x80 }, /* ...1...1...0...0 */ + { 0x08,0x28,0x00,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 }, /* ...1...1...1...0 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +void mrviking_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...1...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +void myheroj_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...1 */ + { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...0 */ + { 0x80,0xa0,0x88,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...1 */ + { 0x80,0xa0,0x88,0xa8 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...0 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ + { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +void myherok_decode(void) +{ + UINT8 *rom = System1Rom1; + + for (INT32 A = 0; A < 0xc000; A++) + rom[A] = (rom[A] & 0xfc) | ((rom[A] & 1) << 1) | ((rom[A] & 2) >> 1); + + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...1 */ + { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...0 */ + { 0x80,0xa0,0x88,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...1 */ + { 0x80,0xa0,0x88,0xa8 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...0 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ + { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +static void nprinces_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x08,0x88,0x00,0x80 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...0...0...0 */ + { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...1...0...0 */ + { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...0...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +static void pitfall2_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ + { 0x08,0x88,0x28,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...0...0...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...1...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...0 */ + { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...0 */ + { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...1...0...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...1...0...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...1...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +static void regulus_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */ + { 0x80,0xa0,0x00,0x20 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */ + { 0x80,0xa0,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */ + { 0x80,0xa0,0x00,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +static void seganinj_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...1 */ + { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...0...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...1...1 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ + { 0xa0,0xa8,0x80,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...0...1 */ + { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */ + { 0xa8,0xa0,0x28,0x20 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...1...0 */ + { 0xa8,0xa0,0x28,0x20 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +void spatter_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0x08,0x80,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...0...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ + { 0x00,0x08,0x20,0x28 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0x80,0x88,0x00,0x08 }, /* ...0...1...0...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0x80,0x88,0x00,0x08 }, /* ...1...0...0...0 */ + { 0x80,0x88,0x00,0x08 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...0 */ + { 0x00,0x08,0x20,0x28 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ + { 0x80,0x88,0x00,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ + { 0x80,0xa0,0x88,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...1...1...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +void swat_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */ + { 0xa0,0xa8,0x80,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...0 */ + { 0xa0,0x20,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...0 */ + { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...1...0...1 */ + { 0xa0,0xa8,0x80,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...1...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +static void teddybb_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x20,0x28,0x00,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...0...0...0 */ + { 0x20,0x28,0x00,0x08 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ + { 0x20,0x28,0x00,0x08 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */ + { 0x80,0x00,0xa0,0x20 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...0 */ + { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...1 */ + { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...1 */ + { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...1 */ + { 0x80,0x00,0xa0,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +void wmatch_decode(void) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...0...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...0...1...0 */ + { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...1 */ + { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...0 */ + { 0x08,0x88,0x00,0x80 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...1 */ + { 0xa8,0x28,0x88,0x08 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...1...0 */ + { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...1...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...0...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...0 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...0 */ + { 0xa8,0x28,0x88,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...1...0 */ + { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 } /* ...1...1...1...1 */ + }; + + sega_decode(convtable); +} + +static void sega_decode_2(UINT8 *pDest, UINT8 *pDestDec, const UINT8 opcode_xor[64],const INT32 opcode_swap_select[64], + const UINT8 data_xor[64],const INT32 data_swap_select[64]) +{ + INT32 A; + static const UINT8 swaptable[24][4] = + { + { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 }, + { 6,2,4,0 }, { 6,0,2,4 }, { 6,4,0,2 }, { 2,6,4,0 }, + { 4,2,6,0 }, { 4,6,0,2 }, { 6,0,4,2 }, { 0,6,4,2 }, + { 4,0,6,2 }, { 0,4,6,2 }, { 6,2,0,4 }, { 2,6,0,4 }, + { 0,6,2,4 }, { 2,0,6,4 }, { 0,2,6,4 }, { 4,2,0,6 }, + { 2,4,0,6 }, { 4,0,2,6 }, { 2,0,4,6 }, { 0,2,4,6 }, + }; + + + UINT8 *rom = pDest; + UINT8 *decrypted = pDestDec; + + for (A = 0x0000;A < 0x8000;A++) + { + INT32 row; + UINT8 src; + const UINT8 *tbl; + + + src = rom[A]; + + /* pick the translation table from bits 0, 3, 6, 9, 12 and 14 of the address */ + row = (A & 1) + (((A >> 3) & 1) << 1) + (((A >> 6) & 1) << 2) + + (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5); + + /* decode the opcodes */ + tbl = swaptable[opcode_swap_select[row]]; + decrypted[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ opcode_xor[row]; + + /* decode the data */ + tbl = swaptable[data_swap_select[row]]; + rom[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ data_xor[row]; + } + + memcpy(pDestDec + 0x8000, pDest + 0x8000, 0x4000); +} + +static void astrofl_decode(void) +{ + static const UINT8 opcode_xor[64] = + { + 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45, + 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45, + 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50, + 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45, + 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45, + 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50, + }; + + static const UINT8 data_xor[64] = + { + 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40, + 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40, + 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14, + 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40, + 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40, + 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14, + }; + + static const INT32 opcode_swap_select[64] = + { + 0,0,1,1,1,2,2,3,3,4,4,4,5,5,6,6, + 6,7,7,8,8,9,9,9,10,10,11,11,11,12,12,13, + + 8,8,9,9,9,10,10,11,11,12,12,12,13,13,14,14, + 14,15,15,16,16,17,17,17,18,18,19,19,19,20,20,21, + }; + + static const INT32 data_swap_select[64] = + { + 0,0,1,1,2,2,2,3,3,4,4,5,5,5,6,6, + 7,7,7,8,8,9,9,10,10,10,11,11,12,12,12,13, + + 8,8,9,9,10,10,10,11,11,12,12,13,13,13,14,14, + 15,15,15,16,16,17,17,18,18,18,19,19,20,20,20,21, + }; + + sega_decode_2(System1Rom1, System1Fetch1, opcode_xor,opcode_swap_select,data_xor,data_swap_select); +} + +void fdwarrio_decode(void) +{ + static const UINT8 opcode_xor[64] = + { + 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, + 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, + 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, + 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, + 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, + 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, + 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, + 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55, + }; + + static const UINT8 data_xor[64] = + { + 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, + 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, + 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, + 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, + 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, + 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, + 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, + 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00, + }; + + static const INT32 opcode_swap_select[64] = + { + 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, + 10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11, + }; + + static const INT32 data_swap_select[64] = + { + 4,4,4,4,4,4,4,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, + 10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11, + 12, + }; + + sega_decode_2(System1Rom1, System1Fetch1, opcode_xor,opcode_swap_select,data_xor,data_swap_select); +} + +static void wboy2_decode(void) +{ + static const UINT8 opcode_xor[64] = + { + 0x00,0x45,0x11,0x01,0x44,0x10,0x55,0x05,0x41,0x14,0x04,0x40,0x15,0x51, + 0x01,0x44,0x10,0x00,0x45,0x11,0x54,0x04,0x40,0x15,0x05,0x41,0x14,0x50, + 0x00,0x45,0x11,0x01, + 0x00,0x45,0x11,0x01,0x44,0x10,0x55,0x05,0x41,0x14,0x04,0x40,0x15,0x51, + 0x01,0x44,0x10,0x00,0x45,0x11,0x54,0x04,0x40,0x15,0x05,0x41,0x14,0x50, + 0x00,0x45,0x11,0x01, + }; + + static const UINT8 data_xor[64] = + { + 0x55,0x05,0x41,0x14,0x50,0x00,0x15,0x51,0x01,0x44,0x10,0x55,0x05,0x11, + 0x54,0x04,0x40,0x15,0x51,0x01,0x14,0x50,0x00,0x45,0x11,0x54,0x04,0x10, + 0x55,0x05,0x41,0x14, + 0x55,0x05,0x41,0x14,0x50,0x00,0x15,0x51,0x01,0x44,0x10,0x55,0x05,0x11, + 0x54,0x04,0x40,0x15,0x51,0x01,0x14,0x50,0x00,0x45,0x11,0x54,0x04,0x10, + 0x55,0x05,0x41,0x14, + }; + + static const INT32 opcode_swap_select[64] = + { + 2, + 5,1,5,1,5, + 0,4,0,4,0,4, + 7,3,7,3,7,3, + 6,2,6,2,6, + 1,5,1,5,1,5, + 0,4,0, + + 10, + 13,9,13,9,13, + 8,12,8,12,8,12, + 15,11,15,11,15,11, + 14,10,14,10,14, + 9,13,9,13,9,13, + 8,12,8, + }; + + static const INT32 data_swap_select[64] = + { + 3,7,3,7,3,7, + 2,6,2,6,2, + 5,1,5,1,5,1, + 4,0,4,0,4, + 8, + 3,7,3,7,3, + 6,2,6,2, + + 11,15,11,15,11,15, + 10,14,10,14,10, + 13,9,13,9,13,9, + 12,8,12,8,12, + 16, + 11,15,11,15,11, + 14,10,14,10, + }; + + sega_decode_2(System1Rom1, System1Fetch1, opcode_xor,opcode_swap_select,data_xor,data_swap_select); +} + +void sega_decode_317(UINT8 *pDest, UINT8 *pDestDec, INT32 order, INT32 opcode_shift, INT32 data_shift) +{ + static const UINT8 xor1_317[1+64] = + { + 0x54, + 0x14,0x15,0x41,0x14,0x50,0x55,0x05,0x41,0x01,0x10,0x51,0x05,0x11,0x05,0x14,0x55, + 0x41,0x05,0x04,0x41,0x14,0x10,0x45,0x50,0x00,0x45,0x00,0x00,0x00,0x45,0x00,0x00, + 0x54,0x04,0x15,0x10,0x04,0x05,0x11,0x44,0x04,0x01,0x05,0x00,0x44,0x15,0x40,0x45, + 0x10,0x15,0x51,0x50,0x00,0x15,0x51,0x44,0x15,0x04,0x44,0x44,0x50,0x10,0x04,0x04, + }; + + static const UINT8 xor2_317[2+64] = + { + 0x04, + 0x44, + 0x15,0x51,0x41,0x10,0x15,0x54,0x04,0x51,0x05,0x55,0x05,0x54,0x45,0x04,0x10,0x01, + 0x51,0x55,0x45,0x55,0x45,0x04,0x55,0x40,0x11,0x15,0x01,0x40,0x01,0x11,0x45,0x44, + 0x40,0x05,0x15,0x15,0x01,0x50,0x00,0x44,0x04,0x50,0x51,0x45,0x50,0x54,0x41,0x40, + 0x14,0x40,0x50,0x45,0x10,0x05,0x50,0x01,0x40,0x01,0x50,0x50,0x50,0x44,0x40,0x10, + }; + + static const INT32 swap1_317[1+64] = + { + 7, + 1,11,23,17,23, 0,15,19, + 20,12,10, 0,18,18, 5,20, + 13, 0,18,14, 5, 6,10,21, + 1,11, 9, 3,21, 4, 1,17, + 5, 7,16,13,19,23,20, 2, + 10,23,23,15,10,12, 0,22, + 14, 6,15,11,17,15,21, 0, + 6, 1, 1,18, 5,15,15,20, + }; + + static const INT32 swap2_317[2+64] = + { + 7, + 12, + 18, 8,21, 0,22,21,13,21, + 20,13,20,14, 6, 3, 5,20, + 8,20, 4, 8,17,22, 0, 0, + 6,17,17, 9, 0,16,13,21, + 3, 2,18, 6,11, 3, 3,18, + 18,19, 3, 0, 5, 0,11, 8, + 8, 1, 7, 2,10, 8,10, 2, + 1, 3,12,16, 0,17,10, 1, + }; + + if (order) + sega_decode_2( pDest, pDestDec, xor2_317+opcode_shift, swap2_317+opcode_shift, xor1_317+data_shift, swap1_317+data_shift ); + else + sega_decode_2( pDest, pDestDec, xor1_317+opcode_shift, swap1_317+opcode_shift, xor2_317+data_shift, swap2_317+data_shift ); +} + +static void gardia_decode() +{ + sega_decode_317( System1Rom1, System1Fetch1, 1, 1, 1 ); +} + +static void gardiab_decode() +{ + sega_decode_317( System1Rom1, System1Fetch1, 0, 1, 2 ); +} + +static void blockgal_decode() +{ + mc8123_decrypt_rom(0, 0, System1Rom1, System1Fetch1, System1MC8123Key); +} + +static void myherok_tile_decode() +{ + INT32 A; + UINT8 *rom = System1TempRom; + + /* the first ROM has data lines D0 and D6 swapped. */ + for (A = 0x0000;A < 0x4000;A++) + rom[A] = (rom[A] & 0xbe) | ((rom[A] & 0x01) << 6) | ((rom[A] & 0x40) >> 6); + + /* the second ROM has data lines D1 and D5 swapped. */ + for (A = 0x4000;A < 0x8000;A++) + rom[A] = (rom[A] & 0xdd) | ((rom[A] & 0x02) << 4) | ((rom[A] & 0x20) >> 4); + + /* the third ROM has data lines D0 and D6 swapped. */ + for (A = 0x8000;A < 0xc000;A++) + rom[A] = (rom[A] & 0xbe) | ((rom[A] & 0x01) << 6) | ((rom[A] & 0x40) >> 6); + + /* also, all three ROMs have address lines A4 and A5 swapped. */ + for (A = 0;A < 0xc000;A++) + { + INT32 A1; + UINT8 temp; + + A1 = (A & 0xffcf) | ((A & 0x0010) << 1) | ((A & 0x0020) >> 1); + if (A < A1) + { + temp = rom[A]; + rom[A] = rom[A1]; + rom[A1] = temp; + } + } +} + +/*============================================================================================== +Allocate Memory +===============================================================================================*/ + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + System1Rom1 = Next; Next += 0x020000; + System1Fetch1 = Next; Next += 0x010000; + System1Rom2 = Next; Next += 0x008000; + System1PromRed = Next; Next += 0x000100; + System1PromGreen = Next; Next += 0x000100; + System1PromBlue = Next; Next += 0x000100; + + RamStart = Next; + + System1Ram1 = Next; Next += 0x0020fd; + System1Ram2 = Next; Next += 0x000800; + System1SpriteRam = Next; Next += 0x000200; + System1PaletteRam = Next; Next += 0x000600; + System1BgRam = Next; Next += 0x000800; + System1VideoRam = Next; Next += 0x000700; + System1BgCollisionRam = Next; Next += 0x000400; + System1SprCollisionRam = Next; Next += 0x000400; + System1deRam = Next; Next += 0x000200; + System1efRam = Next; Next += 0x000100; + System1f4Ram = Next; Next += 0x000400; + System1fcRam = Next; Next += 0x000400; + SpriteOnScreenMap = Next; Next += (256 * 256); + + RamEnd = Next; + + System1Sprites = Next; Next += System1SpriteRomSize; + System1Tiles = Next; Next += (System1NumTiles * 8 * 8); + System1TilesPenUsage = (UINT32*)Next; Next += System1NumTiles * sizeof(UINT32); + System1Palette = (UINT32*)Next; Next += 0x000600 * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +/*============================================================================================== +Reset Functions +===============================================================================================*/ + +static INT32 System1DoReset() +{ + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + System1ScrollX[0] = System1ScrollX[1] = System1ScrollY = 0; + System1BgScrollX = 0; + System1BgScrollY = 0; + System1VideoMode = 0; + System1FlipScreen = 0; + System1SoundLatch = 0; + System1RomBank = 0; + NoboranbInp16Step = 0; + NoboranbInp17Step = 0; + NoboranbInp23Step = 0; + BlockgalDial1 = 0; + BlockgalDial2 = 0; + + return 0; +} + +/*============================================================================================== +Memory Handlers +===============================================================================================*/ + +static void System1BankRom() +{ + INT32 BankAddress = (System1RomBank * 0x4000) + 0x10000; + ZetMapArea(0x8000, 0xbfff, 0, System1Rom1 + BankAddress); + ZetMapArea(0x8000, 0xbfff, 2, System1Rom1 + BankAddress); +} + +UINT8 __fastcall System1Z801PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return 0xff - System1Input[0]; + } + + case 0x04: { + return 0xff - System1Input[1]; + } + + case 0x08: { + return 0xff - System1Input[2]; + } + + case 0x0c: { + return System1Dip[0]; + } + + case 0x0d: { + return System1Dip[1]; + } + + case 0x10: { + return System1Dip[1]; + } + + case 0x11: { + return System1Dip[0]; + } + + case 0x15: { + return System1VideoMode; + } + + case 0x19: { + return System1VideoMode; + } + } + + bprintf(PRINT_NORMAL, _T("IO Read %x\n"), a); + return 0; +} + +UINT8 __fastcall BlockgalZ801PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return BlockgalDial1; + } + + case 0x04: { + return BlockgalDial2; + } + + case 0x08: { + return 0xff - System1Input[2]; + } + + case 0x0c: { + return System1Dip[0]; + } + + case 0x0d: { + return System1Dip[1]; + } + + case 0x10: { + return System1Dip[1]; + } + + case 0x11: { + return System1Dip[0]; + } + + case 0x15: { + return System1VideoMode; + } + + case 0x19: { + return System1VideoMode; + } + } + + bprintf(PRINT_NORMAL, _T("IO Read %x\n"), a); + return 0; +} + +UINT8 __fastcall NoboranbZ801PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return 0xff - System1Input[0]; + } + + case 0x04: { + return 0xff - System1Input[1]; + } + + case 0x08: { + return 0xff - System1Input[2]; + } + + case 0x0c: { + return System1Dip[0]; + } + + case 0x0d: { + return System1Dip[1]; + } + + case 0x15: { + return System1VideoMode; + } + + case 0x16: { + return NoboranbInp16Step; + } + + case 0x1c: { + return 0x80; + } + + case 0x22: { + return NoboranbInp17Step; + } + + case 0x23: { + return NoboranbInp23Step; + } + } + + bprintf(PRINT_NORMAL, _T("IO Read %x\n"), a); + return 0; +} + +void __fastcall System1Z801PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x14: + case 0x18: { + System1SoundLatch = d; + + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + return; + } + + case 0x15: + case 0x19: { + System1VideoMode = d; + System1FlipScreen = d & 0x80; + return; + } + } + + bprintf(PRINT_NORMAL, _T("IO Write %x, %x\n"), a, d); +} + +void __fastcall BrainZ801PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x14: + case 0x18: { + System1SoundLatch = d; + + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + return; + } + + case 0x15: + case 0x19: { + System1VideoMode = d; + System1FlipScreen = d & 0x80; + + System1RomBank = ((d & 0x04) >> 2) + ((d & 0x40) >> 5); + System1BankRom(); + return; + } + } + + bprintf(PRINT_NORMAL, _T("IO Write %x, %x\n"), a, d); +} + +void __fastcall NoboranbZ801PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x14: + case 0x18: { + System1SoundLatch = d; + + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + return; + } + + case 0x15: { + System1VideoMode = d; + System1FlipScreen = d & 0x80; + + System1RomBank = ((d & 0x04) >> 2) + ((d & 0x40) >> 5); + System1BankRom(); + return; + } + + case 0x16: { + NoboranbInp16Step = d; + return; + } + + case 0x17: { + NoboranbInp17Step = d; + return; + } + + case 0x24: { + NoboranbInp23Step = d; + return; + } + } + + bprintf(PRINT_NORMAL, _T("IO Write %x, %x\n"), a, d); +} + +void __fastcall System1Z801ProgWrite(UINT16 a, UINT8 d) +{ + if (a >= 0xf000 && a <= 0xf3ff) { System1BgCollisionRam[a - 0xf000] = 0x7e; return; } + if (a >= 0xf800 && a <= 0xfbff) { System1SprCollisionRam[a - 0xf800] = 0x7e; return; } + + switch (a) { + case 0xefbd: { + System1ScrollY = d; + break; + } + + case 0xeffc: { + System1ScrollX[0] = d; + break; + } + + case 0xeffd: { + System1ScrollX[1] = d; + break; + } + } + + if (a >= 0xef00 && a <= 0xefff) { + System1efRam[a - 0xef00] = d; + return; + } + + bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); +} + +void __fastcall NoboranbZ801ProgWrite(UINT16 a, UINT8 d) +{ + if (a >= 0xc000 && a <= 0xc3ff) { System1BgCollisionRam[a - 0xc000] = 0x7e; return; } + if (a >= 0xc800 && a <= 0xcbff) { System1SprCollisionRam[a - 0xc800] = 0x7e; return; } + + switch (a) { + case 0xefbd: { + System1ScrollY = d; + break; + } + + case 0xeffc: { + System1ScrollX[0] = d; + break; + } + + case 0xeffd: { + System1ScrollX[1] = d; + break; + } + } + + if (a >= 0xef00 && a <= 0xefff) { + System1efRam[a - 0xef00] = d; + return; + } + + bprintf(PRINT_NORMAL, _T("Prog Write %x, %x\n"), a, d); +} + +UINT8 __fastcall System1Z802ProgRead(UINT16 a) +{ + switch (a) { + case 0xe000: { + return System1SoundLatch; + } + + case 0xffff: { + return System1SoundLatch; + } + } + + bprintf(PRINT_NORMAL, _T("Z80 2 Prog Read %x\n"), a); + return 0; +} + +void __fastcall System1Z802ProgWrite(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xa000: + case 0xa001: + case 0xa002: + case 0xa003: { + SN76496Write(0, d); + return; + } + + case 0xc000: + case 0xc001: + case 0xc002: + case 0xc003: { + SN76496Write(1, d); + return; + } + } + + bprintf(PRINT_NORMAL, _T("Z80 2 Prog Write %x, %x\n"), a, d); +} + +/*============================================================================================== +Driver Inits +===============================================================================================*/ + +static void CalcPenUsage() +{ + INT32 i, x, y; + UINT32 Usage; + UINT8 *dp = NULL; + + for (i = 0; i < System1NumTiles; i++) { + dp = System1Tiles + (i * 64); + Usage = 0; + for (y = 0; y < 8; y++) { + for (x = 0; x < 8; x++) { + Usage |= 1 << dp[x]; + } + + dp += 8; + } + + System1TilesPenUsage[i] = Usage; + } +} + +static INT32 TilePlaneOffsets[3] = { 0, 0x20000, 0x40000 }; +static INT32 NoboranbTilePlaneOffsets[3] = { 0, 0x40000, 0x80000 }; +static INT32 TileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 TileYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; + +static INT32 System1Init(INT32 nZ80Rom1Num, INT32 nZ80Rom1Size, INT32 nZ80Rom2Num, INT32 nZ80Rom2Size, INT32 nTileRomNum, INT32 nTileRomSize, INT32 nSpriteRomNum, INT32 nSpriteRomSize, bool bReset) +{ + INT32 nRet = 0, nLen, i, RomOffset; + + System1NumTiles = (nTileRomNum * nTileRomSize) / 24; + System1SpriteRomSize = nSpriteRomNum * nSpriteRomSize; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + System1TempRom = (UINT8*)BurnMalloc(0x18000); + + // Load Z80 #1 Program roms + RomOffset = 0; + for (i = 0; i < nZ80Rom1Num; i++) { + nRet = BurnLoadRom(System1Rom1 + (i * nZ80Rom1Size), i + RomOffset, 1); if (nRet != 0) return 1; + } + + if (System1BankedRom) { + memcpy(System1TempRom, System1Rom1, 0x18000); + memset(System1Rom1, 0, 0x18000); + memcpy(System1Rom1 + 0x00000, System1TempRom + 0x00000, 0x8000); + memcpy(System1Rom1 + 0x10000, System1TempRom + 0x08000, 0x8000); + memcpy(System1Rom1 + 0x08000, System1TempRom + 0x08000, 0x8000); + memcpy(System1Rom1 + 0x18000, System1TempRom + 0x10000, 0x8000); + } + + if (DecodeFunction) DecodeFunction(); + + // Load Z80 #2 Program roms + RomOffset += nZ80Rom1Num; + for (i = 0; i < nZ80Rom2Num; i++) { + nRet = BurnLoadRom(System1Rom2 + (i * nZ80Rom2Size), i + RomOffset, 1); if (nRet != 0) return 1; + } + + // Load and decode tiles + memset(System1TempRom, 0, 0x18000); + RomOffset += nZ80Rom2Num; + for (i = 0; i < nTileRomNum; i++) { + nRet = BurnLoadRom(System1TempRom + (i * nTileRomSize), i + RomOffset, 1); + } + if (TileDecodeFunction) TileDecodeFunction(); + if (System1NumTiles > 0x800) { + GfxDecode(System1NumTiles, 3, 8, 8, NoboranbTilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, System1TempRom, System1Tiles); + } else { + GfxDecode(System1NumTiles, 3, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x40, System1TempRom, System1Tiles); + } + CalcPenUsage(); + BurnFree(System1TempRom); + + // Load Sprite roms + RomOffset += nTileRomNum; + for (i = 0; i < nSpriteRomNum; i++) { + nRet = BurnLoadRom(System1Sprites + (i * nSpriteRomSize), i + RomOffset, 1); + } + + // Load Colour proms + if (System1ColourProms) { + RomOffset += nSpriteRomNum; + nRet = BurnLoadRom(System1PromRed, 0 + RomOffset, 1); + nRet = BurnLoadRom(System1PromGreen, 1 + RomOffset, 1); + nRet = BurnLoadRom(System1PromBlue, 2 + RomOffset, 1); + } + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetWriteHandler(System1Z801ProgWrite); + ZetSetInHandler(System1Z801PortRead); + ZetSetOutHandler(System1Z801PortWrite); + ZetMapArea(0x0000, 0x7fff, 0, System1Rom1); + ZetMapArea(0x8000, 0xbfff, 0, System1Rom1 + 0x8000); + if (DecodeFunction) { + ZetMapArea(0x0000, 0x7fff, 2, System1Fetch1, System1Rom1); + ZetMapArea(0x8000, 0xbfff, 2, System1Fetch1 + 0x8000, System1Rom1 + 0x8000); + } else { + ZetMapArea(0x0000, 0x7fff, 2, System1Rom1); + ZetMapArea(0x8000, 0xbfff, 2, System1Rom1 + 0x8000); + } + ZetMapArea(0xc000, 0xcfff, 0, System1Ram1); + ZetMapArea(0xc000, 0xcfff, 1, System1Ram1); + ZetMapArea(0xc000, 0xcfff, 2, System1Ram1); + ZetMapArea(0xd000, 0xd1ff, 0, System1SpriteRam); + ZetMapArea(0xd000, 0xd1ff, 1, System1SpriteRam); + ZetMapArea(0xd000, 0xd1ff, 2, System1SpriteRam); + ZetMapArea(0xd200, 0xd7ff, 0, System1Ram1 + 0x1000); + ZetMapArea(0xd200, 0xd7ff, 1, System1Ram1 + 0x1000); + ZetMapArea(0xd200, 0xd7ff, 2, System1Ram1 + 0x1000); + ZetMapArea(0xd800, 0xddff, 0, System1PaletteRam); + ZetMapArea(0xd800, 0xddff, 1, System1PaletteRam); + ZetMapArea(0xd800, 0xddff, 2, System1PaletteRam); + ZetMapArea(0xde00, 0xdfff, 0, System1deRam); + ZetMapArea(0xde00, 0xdfff, 1, System1deRam); + ZetMapArea(0xde00, 0xdfff, 2, System1deRam); + ZetMapArea(0xe000, 0xe7ff, 0, System1BgRam); + ZetMapArea(0xe000, 0xe7ff, 1, System1BgRam); + ZetMapArea(0xe000, 0xe7ff, 2, System1BgRam); + ZetMapArea(0xe800, 0xeeff, 0, System1VideoRam); + ZetMapArea(0xe800, 0xeeff, 1, System1VideoRam); + ZetMapArea(0xe800, 0xeeff, 2, System1VideoRam); + ZetMapArea(0xef00, 0xefff, 0, System1efRam); + ZetMapArea(0xef00, 0xefff, 2, System1efRam); + ZetMapArea(0xf000, 0xf3ff, 0, System1BgCollisionRam); + ZetMapArea(0xf000, 0xf3ff, 2, System1BgCollisionRam); + ZetMapArea(0xf400, 0xf7ff, 0, System1f4Ram); + ZetMapArea(0xf400, 0xf7ff, 1, System1f4Ram); + ZetMapArea(0xf400, 0xf7ff, 2, System1f4Ram); + ZetMapArea(0xf800, 0xfbff, 0, System1SprCollisionRam); + ZetMapArea(0xf800, 0xfbff, 2, System1SprCollisionRam); + ZetMapArea(0xfc00, 0xffff, 0, System1fcRam); + ZetMapArea(0xfc00, 0xffff, 1, System1fcRam); + ZetMapArea(0xfc00, 0xffff, 2, System1fcRam); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(System1Z802ProgRead); + ZetSetWriteHandler(System1Z802ProgWrite); + ZetMapArea(0x0000, 0x7fff, 0, System1Rom2); + ZetMapArea(0x0000, 0x7fff, 2, System1Rom2); + ZetMapArea(0x8000, 0x87ff, 0, System1Ram2); + ZetMapArea(0x8000, 0x87ff, 1, System1Ram2); + ZetMapArea(0x8000, 0x87ff, 2, System1Ram2); + ZetClose(); + + memset(SpriteOnScreenMap, 255, 256 * 256); + + System1SpriteXOffset = 1; + + nCyclesTotal[0] = 4000000 / 60; + nCyclesTotal[1] = 4000000 / 60; + + SN76489AInit(0, 2000000, 0); + SN76489AInit(1, 4000000, 1); + SN76496SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + MakeInputsFunction = System1MakeInputs; + System1Draw = System1Render; + + // Reset the driver + if (bReset) System1DoReset(); + + return 0; +} + +static INT32 FourdwarrioInit() +{ + DecodeFunction = fdwarrio_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 BlockgalInit() +{ + INT32 nRet; + + System1MC8123Key = (UINT8*)BurnMalloc(0x2000); + BurnLoadRom(System1MC8123Key, 14, 1); + + DecodeFunction = blockgal_decode; + + nRet = System1Init(2, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); + BurnFree(System1MC8123Key); + + ZetOpen(0); + ZetSetInHandler(BlockgalZ801PortRead); + ZetClose(); + MakeInputsFunction = BlockgalMakeInputs; + + return nRet; +} + +static INT32 BrainInit() +{ + INT32 nRet; + + System1ColourProms = 1; + System1BankedRom = 1; + + nRet = System1Init(3, 0x8000, 1, 0x8000, 3, 0x4000, 3, 0x8000, 0); + + ZetOpen(0); + ZetSetOutHandler(BrainZ801PortWrite); + ZetClose(); + + System1DoReset(); + + return nRet; +} + +static INT32 BullfgtInit() +{ + DecodeFunction = bullfgtj_decode; + + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 ThetogyuInit() +{ + DecodeFunction = bullfgtj_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 FlickyInit() +{ + DecodeFunction = flicky_decode; + + return System1Init(2, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 FlickygInit() +{ + DecodeFunction = flicky_decode; + + return System1Init(2, 0x4000, 1, 0x2000, 3, 0x4000, 2, 0x4000, 1); +} + +static INT32 Flicks1Init() +{ + DecodeFunction = flicky_decode; + + return System1Init(4, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 Flicks2Init() +{ + return System1Init(2, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 Flicks2gInit() +{ + return System1Init(2, 0x4000, 1, 0x2000, 3, 0x4000, 2, 0x4000, 1); +} + +static INT32 GardiaInit() +{ + INT32 nRet; + + System1ColourProms = 1; + System1BankedRom = 1; + + DecodeFunction = gardia_decode; + + nRet = System1Init(3, 0x8000, 1, 0x4000, 3, 0x4000, 4, 0x8000, 0); + + ZetOpen(0); + ZetSetOutHandler(BrainZ801PortWrite); + ZetClose(); + + System1DoReset(); + + return nRet; +} + +static INT32 GardiabInit() +{ + INT32 nRet; + + System1ColourProms = 1; + System1BankedRom = 1; + + DecodeFunction = gardiab_decode; + + nRet = System1Init(3, 0x8000, 1, 0x4000, 3, 0x4000, 4, 0x8000, 0); + + ZetOpen(0); + ZetSetOutHandler(BrainZ801PortWrite); + ZetClose(); + + System1DoReset(); + + return nRet; +} + +static INT32 HvymetalInit() +{ + INT32 nRet; + + System1ColourProms = 1; + System1BankedRom = 1; + + DecodeFunction = hvymetal_decode; + + nRet = System1Init(3, 0x8000, 1, 0x8000, 6, 0x4000, 4, 0x8000, 0); + + ZetOpen(0); + ZetSetOutHandler(BrainZ801PortWrite); + ZetClose(); + + System1DoReset(); + + return nRet; +} + +static INT32 ImsorryInit() +{ + DecodeFunction = imsorry_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 MrvikingInit() +{ + DecodeFunction = mrviking_decode; + + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 MyheroInit() +{ + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 SscandalInit() +{ + DecodeFunction = myheroj_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 MyherokInit() +{ + DecodeFunction = myherok_decode; + TileDecodeFunction = myherok_tile_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 3, 0x4000, 4, 0x4000, 1); +} + +static INT32 NobbInit() +{ + INT32 nRet; + + System1ColourProms = 1; + System1BankedRom = 1; + + nRet = System1Init(3, 0x8000, 1, 0x4000, 3, 0x8000, 4, 0x8000, 0); + nCyclesTotal[0] = 8000000 / 60; + System1Rom2[0x02f9] = 0x28; + + ZetOpen(0); + ZetSetWriteHandler(NoboranbZ801ProgWrite); + ZetSetInHandler(NoboranbZ801PortRead); + ZetSetOutHandler(NoboranbZ801PortWrite); + ZetMemCallback(0xc000, 0xffff, 0); + ZetMemCallback(0xc000, 0xffff, 1); + ZetMemCallback(0xc000, 0xffff, 2); + ZetMapArea(0xc000, 0xc3ff, 0, System1BgCollisionRam); + ZetMapArea(0xc000, 0xc3ff, 2, System1BgCollisionRam); + ZetMapArea(0xc400, 0xc7ff, 0, System1f4Ram); + ZetMapArea(0xc400, 0xc7ff, 1, System1f4Ram); + ZetMapArea(0xc400, 0xc7ff, 2, System1f4Ram); + ZetMapArea(0xc800, 0xcbff, 0, System1SprCollisionRam); + ZetMapArea(0xc800, 0xcbff, 2, System1SprCollisionRam); + ZetMapArea(0xcc00, 0xcfff, 0, System1fcRam); + ZetMapArea(0xcc00, 0xcfff, 1, System1fcRam); + ZetMapArea(0xcc00, 0xcfff, 2, System1fcRam); + ZetMapArea(0xd000, 0xd1ff, 0, System1SpriteRam); + ZetMapArea(0xd000, 0xd1ff, 1, System1SpriteRam); + ZetMapArea(0xd000, 0xd1ff, 2, System1SpriteRam); + ZetMapArea(0xd200, 0xd7ff, 0, System1Ram1 + 0x1000); + ZetMapArea(0xd200, 0xd7ff, 1, System1Ram1 + 0x1000); + ZetMapArea(0xd200, 0xd7ff, 2, System1Ram1 + 0x1000); + ZetMapArea(0xd800, 0xddff, 0, System1PaletteRam); + ZetMapArea(0xd800, 0xddff, 1, System1PaletteRam); + ZetMapArea(0xd800, 0xddff, 2, System1PaletteRam); + ZetMapArea(0xde00, 0xdfff, 0, System1deRam); + ZetMapArea(0xde00, 0xdfff, 1, System1deRam); + ZetMapArea(0xde00, 0xdfff, 2, System1deRam); + ZetMapArea(0xe000, 0xe7ff, 0, System1BgRam); + ZetMapArea(0xe000, 0xe7ff, 1, System1BgRam); + ZetMapArea(0xe000, 0xe7ff, 2, System1BgRam); + ZetMapArea(0xe800, 0xeeff, 0, System1VideoRam); + ZetMapArea(0xe800, 0xeeff, 1, System1VideoRam); + ZetMapArea(0xe800, 0xeeff, 2, System1VideoRam); + ZetMapArea(0xef00, 0xefff, 0, System1efRam); + ZetMapArea(0xef00, 0xefff, 2, System1efRam); + ZetMapArea(0xf000, 0xffff, 0, System1Ram1); + ZetMapArea(0xf000, 0xffff, 1, System1Ram1); + ZetMapArea(0xf000, 0xffff, 2, System1Ram1); + ZetClose(); + + System1DoReset(); + + return nRet; +} + +static INT32 Pitfall2Init() +{ + INT32 nRet; + + DecodeFunction = pitfall2_decode; + + nRet = System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); + nCyclesTotal[0] = 3600000 / 60; + + return nRet; +} + +static INT32 PitfalluInit() +{ + INT32 nRet; + + nRet = System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); + nCyclesTotal[0] = 3600000 / 60; + + return nRet; +} + +static INT32 RaflesiaInit() +{ + DecodeFunction = fdwarrio_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 RegulusInit() +{ + DecodeFunction = regulus_decode; + + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 RegulusuInit() +{ + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 SeganinjInit() +{ + DecodeFunction = seganinj_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 SeganinuInit() +{ + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 NprincesInit() +{ + DecodeFunction = flicky_decode; + + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 NprincsoInit() +{ + DecodeFunction = nprinces_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 NprincsuInit() +{ + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 NprincsbInit() +{ + DecodeFunction = flicky_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 SpatterInit() +{ + DecodeFunction = spatter_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 StarjackInit() +{ + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 SwatInit() +{ + DecodeFunction = swat_decode; + + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 TeddybbInit() +{ + DecodeFunction = teddybb_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 UpndownInit() +{ + DecodeFunction = nprinces_decode; + + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 UpndownuInit() +{ + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 WboyInit() +{ + DecodeFunction = astrofl_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 WboyoInit() +{ + DecodeFunction = hvymetal_decode; + + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 Wboy2Init() +{ + DecodeFunction = wboy2_decode; + + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 Wboy2uInit() +{ + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 Wboy4Init() +{ + DecodeFunction = fdwarrio_decode; + + return System1Init(2, 0x8000, 1, 0x8000, 3, 0x4000, 2, 0x8000, 1); +} + +static INT32 WboyuInit() +{ + return System1Init(3, 0x4000, 1, 0x2000, 6, 0x2000, 4, 0x4000, 1); +} + +static INT32 WmatchInit() +{ + DecodeFunction = wmatch_decode; + + return System1Init(6, 0x2000, 1, 0x2000, 6, 0x2000, 2, 0x4000, 1); +} + +static INT32 System1Exit() +{ + ZetExit(); + + SN76496Exit(); + + GenericTilesExit(); + + BurnFree(Mem); + + System1SoundLatch = 0; + System1ScrollX[0] = System1ScrollX[1] = System1ScrollY = 0; + System1BgScrollX = 0; + System1BgScrollY = 0; + System1VideoMode = 0; + System1FlipScreen = 0; + System1RomBank = 0; + NoboranbInp16Step = 0; + NoboranbInp17Step = 0; + NoboranbInp23Step = 0; + BlockgalDial1 = 0; + BlockgalDial2 = 0; + + System1SpriteRomSize = 0; + System1NumTiles = 0; + System1SpriteXOffset = 0; + System1ColourProms = 0; + System1BankedRom = 0; + + DecodeFunction = NULL; + TileDecodeFunction = NULL; + MakeInputsFunction = NULL; + System1Draw = NULL; + + return 0; +} + +/*============================================================================================== +Graphics Rendering +===============================================================================================*/ + +static void DrawPixel(INT32 x, INT32 y, INT32 SpriteNum, INT32 Colour) +{ + INT32 xr, yr, SpriteOnScreen, dx, dy; + + dx = x; + dy = y; + if (nScreenWidth == 240) dx -= 8; + + if (x < 0 || x > 255 || y < 0 || y > 255) return; + + if (SpriteOnScreenMap[(y * 256) + x] != 255) { + SpriteOnScreen = SpriteOnScreenMap[(y * 256) + x]; + System1SprCollisionRam[SpriteOnScreen + (32 * SpriteNum)] = 0xff; + } + + SpriteOnScreenMap[(y * 256) + x] = SpriteNum; + + if (dx >= 0 && dx < nScreenWidth && dy >= 0 && dy < nScreenHeight) { + UINT16 *pPixel = pTransDraw + (dy * nScreenWidth); + pPixel[dx] = Colour; + } + + xr = ((x - System1BgScrollX) & 0xff) / 8; + yr = ((y - System1BgScrollY) & 0xff) / 8; + + if (System1BgRam[2 * (32 * yr + xr) + 1] & 0x10) { + System1BgCollisionRam[0x20 + SpriteNum] = 0xff; + } +} + +static void DrawSprite(INT32 Num) +{ + INT32 Src, Bank, Height, sy, Row; + INT16 Skip; + UINT8 *SpriteBase; + UINT32 *SpritePalette; + + SpriteBase = System1SpriteRam + (0x10 * Num); + Src = (SpriteBase[7] << 8) | SpriteBase[6]; + Bank = 0x8000 * (((SpriteBase[3] & 0x80) >> 7) + ((SpriteBase[3] & 0x40) >> 5)); + Bank &= (System1SpriteRomSize - 1); + Skip = (SpriteBase[5] << 8) | SpriteBase[4]; + + Height = SpriteBase[1] - SpriteBase[0]; + SpritePalette = System1Palette + (0x10 * Num); + + sy = SpriteBase[0] + 1; + + for (Row = 0; Row < Height; Row++) { + INT32 x, y, Src2; + + Src = Src2 = Src + Skip; + x = ((SpriteBase[3] & 0x01) << 8) + SpriteBase[2] + System1SpriteXOffset; + y = sy + Row; + + x /= 2; + + while(1) { + INT32 Colour1, Colour2, Data; + + Data = System1Sprites[Bank + (Src2 & 0x7fff)]; + + if (Src & 0x8000) { + Src2--; + Colour1 = Data & 0x0f; + Colour2 = Data >> 4; + } else { + Src2++; + Colour1 = Data >> 4; + Colour2 = Data & 0x0f; + } + + if (Colour1 == 0x0f) break; + if (Colour1) DrawPixel(x, y, Num, Colour1 + (0x10 * Num)); + x++; + + if (Colour2 == 0x0f) break; + if (Colour2) DrawPixel(x, y, Num, Colour2 + (0x10 * Num)); + x++; + } + } +} + +static void System1DrawSprites() +{ + INT32 i, SpriteBottomY, SpriteTopY; + UINT8 *SpriteBase; + + memset(SpriteOnScreenMap, 255, 256 * 256); + + for (i = 0; i < 32; i++) { + SpriteBase = System1SpriteRam + (0x10 * i); + SpriteTopY = SpriteBase[0]; + SpriteBottomY = SpriteBase[1]; + if (SpriteBottomY && (SpriteBottomY - SpriteTopY > 0)) { + DrawSprite(i); + } + } +} + +static void System1DrawBgLayer(INT32 PriorityDraw) +{ + INT32 Offs, sx, sy; + + System1BgScrollX = ((System1ScrollX[0] >> 1) + ((System1ScrollX[1] & 1) << 7) + 14) & 0xff; + System1BgScrollY = (-System1ScrollY & 0xff); + + if (PriorityDraw == -1) { + for (Offs = 0; Offs < 0x800; Offs += 2) { + INT32 Code, Colour; + + Code = (System1BgRam[Offs + 1] << 8) | System1BgRam[Offs + 0]; + Code = ((Code >> 4) & 0x800) | (Code & 0x7ff); + Colour = ((Code >> 5) & 0x3f); + + sx = (Offs >> 1) % 32; + sy = (Offs >> 1) / 32; + + sx = 8 * sx + System1BgScrollX; + sy = 8 * sy + System1BgScrollY; + + if (nScreenWidth == 240) sx -= 8; + + Code &= (System1NumTiles - 1); + + Render8x8Tile_Clip(pTransDraw, Code, sx , sy , Colour, 3, 512 * 2, System1Tiles); + Render8x8Tile_Clip(pTransDraw, Code, sx - 256, sy , Colour, 3, 512 * 2, System1Tiles); + Render8x8Tile_Clip(pTransDraw, Code, sx , sy - 256, Colour, 3, 512 * 2, System1Tiles); + Render8x8Tile_Clip(pTransDraw, Code, sx - 256, sy - 256, Colour, 3, 512 * 2, System1Tiles); + } + } else { + PriorityDraw <<= 3; + + for (Offs = 0; Offs < 0x800; Offs += 2) { + if ((System1BgRam[Offs + 1] & 0x08) == PriorityDraw) { + INT32 Code, Colour; + + Code = (System1BgRam[Offs + 1] << 8) | System1BgRam[Offs + 0]; + Code = ((Code >> 4) & 0x800) | (Code & 0x7ff); + Colour = ((Code >> 5) & 0x3f); + + INT32 ColourOffs = 0x40; + if (Colour >= 0x10 && Colour <= 0x1f) ColourOffs += 0x10; + if (Colour >= 0x20 && Colour <= 0x2f) ColourOffs += 0x20; + if (Colour >= 0x30 && Colour <= 0x3f) ColourOffs += 0x30; + + sx = (Offs >> 1) % 32; + sy = (Offs >> 1) / 32; + + sx = 8 * sx + System1BgScrollX; + sy = 8 * sy + System1BgScrollY; + + if (nScreenWidth == 240) sx -= 8; + + Code &= (System1NumTiles - 1); + + Render8x8Tile_Mask_Clip(pTransDraw, Code, sx , sy , Colour, 3, 0, 512 * 2, System1Tiles); + Render8x8Tile_Mask_Clip(pTransDraw, Code, sx - 256, sy , Colour, 3, 0, 512 * 2, System1Tiles); + Render8x8Tile_Mask_Clip(pTransDraw, Code, sx , sy - 256, Colour, 3, 0, 512 * 2, System1Tiles); + Render8x8Tile_Mask_Clip(pTransDraw, Code, sx - 256, sy - 256, Colour, 3, 0, 512 * 2, System1Tiles); + } + } + } +} + +static void System1DrawFgLayer(INT32 PriorityDraw) +{ + INT32 Offs, sx, sy; + + PriorityDraw <<= 3; + + for (Offs = 0; Offs < 0x700; Offs += 2) { + INT32 Code, Colour; + + if ((System1VideoRam[Offs + 1] & 0x08) == PriorityDraw) { + Code = (System1VideoRam[Offs + 1] << 8) | System1VideoRam[Offs + 0]; + Code = ((Code >> 4) & 0x800) | (Code & 0x7ff); + Colour = (Code >> 5) & 0x3f; + + sx = (Offs >> 1) % 32; + sy = (Offs >> 1) / 32; + + sx *= 8; + sy *= 8; + + if (nScreenWidth == 240) sx -= 8; + + Code %= System1NumTiles; + Code &= (System1NumTiles - 1); + + if (System1TilesPenUsage[Code] & ~1) { + Render8x8Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 3, 0, 512, System1Tiles); + } + } + } +} + +static inline UINT8 pal2bit(UINT8 bits) +{ + bits &= 3; + return (bits << 6) | (bits << 4) | (bits << 2) | bits; +} + +static inline UINT8 pal3bit(UINT8 bits) +{ + bits &= 7; + return (bits << 5) | (bits << 2) | (bits >> 1); +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal3bit(nColour >> 0); + g = pal3bit(nColour >> 3); + b = pal2bit(nColour >> 6); + + return BurnHighCol(r, g, b, 0); +} + +static INT32 System1CalcPalette() +{ + if (System1ColourProms) { + INT32 i; + for (i = 0; i < 0x600; i++) { + INT32 bit0, bit1, bit2, bit3, r, g, b, val; + + val = System1PromRed[System1PaletteRam[i]]; + bit0 = (val >> 0) & 0x01; + bit1 = (val >> 1) & 0x01; + bit2 = (val >> 2) & 0x01; + bit3 = (val >> 3) & 0x01; + r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + val = System1PromGreen[System1PaletteRam[i]]; + bit0 = (val >> 0) & 0x01; + bit1 = (val >> 1) & 0x01; + bit2 = (val >> 2) & 0x01; + bit3 = (val >> 3) & 0x01; + g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + val = System1PromBlue[System1PaletteRam[i]]; + bit0 = (val >> 0) & 0x01; + bit1 = (val >> 1) & 0x01; + bit2 = (val >> 2) & 0x01; + bit3 = (val >> 3) & 0x01; + b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + System1Palette[i] = BurnHighCol(r, g, b, 0); + } + } else { + for (INT32 i = 0; i < 0x600; i++) { + System1Palette[i] = CalcCol(System1PaletteRam[i]); + } + } + + return 0; +} + +static void System1Render() +{ + BurnTransferClear(); + System1CalcPalette(); + System1DrawBgLayer(-1); + System1DrawFgLayer(0); + System1DrawBgLayer(0); + System1DrawSprites(); + System1DrawBgLayer(1); + System1DrawFgLayer(1); + if (System1VideoMode & 0x010) BurnTransferClear(); + BurnTransferCopy(System1Palette); +} +/* +static void WbmlRender() +{ + BurnTransferClear(); + System1CalcPalette(); + System1DrawSprites(); + if (System1VideoMode & 0x010) BurnTransferClear(); + BurnTransferCopy(System1Palette); +} +*/ +/*============================================================================================== +Frame functions +===============================================================================================*/ + +INT32 System1Frame() +{ + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + + if (System1Reset) System1DoReset(); + + MakeInputsFunction(); + + nCyclesDone[0] = nCyclesDone[1] = 0; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 9) ZetRaiseIrq(0); + ZetClose(); + + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 2 || i == 4 || i == 6 || i == 8) ZetRaiseIrq(0); + ZetClose(); + + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + SN76496Update(0, pSoundBuf, nSegmentLength); + SN76496Update(1, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + SN76496Update(0, pSoundBuf, nSegmentLength); + SN76496Update(1, pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) System1Draw(); + + return 0; +} + +/*============================================================================================== +Scan Driver +===============================================================================================*/ + +static INT32 System1Scan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029675; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + SN76496Scan(nAction, pnMin); + + ScanVar(System1ScrollX, 2, "ScrollX"); + + SCAN_VAR(nCyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(System1Dip); + SCAN_VAR(System1Input); + SCAN_VAR(System1ScrollY); + SCAN_VAR(System1BgScrollX); + SCAN_VAR(System1BgScrollY); + SCAN_VAR(System1VideoMode); + SCAN_VAR(System1FlipScreen); + SCAN_VAR(System1SoundLatch); + SCAN_VAR(System1RomBank); + SCAN_VAR(NoboranbInp16Step); + SCAN_VAR(NoboranbInp17Step); + SCAN_VAR(NoboranbInp23Step); + SCAN_VAR(BlockgalDial1); + SCAN_VAR(BlockgalDial2); + + if (nAction & ACB_WRITE) { + if (System1BankedRom) { + ZetOpen(0); + System1BankRom(); + ZetClose(); + } + } + } + + return 0; +} + +/*============================================================================================== +Driver defs +===============================================================================================*/ + +struct BurnDriver BurnDrvFourdwarrio = { + "4dwarrio", NULL, NULL, NULL, "1985", + "4-D Warriors (315-5162)\0", NULL, "Coreland / Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_HORSHOOT, 0, + NULL, FourdwarrioRomInfo, FourdwarrioRomName, NULL, NULL, MyheroInputInfo, FourdwarrioDIPInfo, + FourdwarrioInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBlockgal = { + "blockgal", NULL, NULL, NULL, "1987", + "Block Gal (MC-8123B, 317-0029)\0", NULL, "Sega / Vic Tokai", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_SEGA_SYSTEM1, GBF_PUZZLE, 0, + NULL, BlockgalRomInfo, BlockgalRomName, NULL, NULL, BlockgalInputInfo, BlockgalDIPInfo, + BlockgalInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvBrain = { + "brain", NULL, NULL, NULL, "1986", + "Brain\0", NULL, "Coreland / Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_HORSHOOT, 0, + NULL, BrainRomInfo, BrainRomName, NULL, NULL, MyheroInputInfo, BrainDIPInfo, + BrainInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBullfgt = { + "bullfgt", NULL, NULL, NULL, "1984", + "Bullfight (315-5065)\0", NULL, "Coreland / Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_MISC, 0, + NULL, BullfgtRomInfo, BullfgtRomName, NULL, NULL, MyheroInputInfo, BullfgtDIPInfo, + BullfgtInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvThetogyu = { + "thetogyu", "bullfgt", NULL, NULL, "1984", + "The Togyu (315-5065, Japan)\0", NULL, "Coreland / Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_MISC, 0, + NULL, ThetogyuRomInfo, ThetogyuRomName, NULL, NULL, MyheroInputInfo, BullfgtDIPInfo, + ThetogyuInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFlicky = { + "flicky", NULL, NULL, NULL, "1984", + "Flicky (128k Version, System 2, 315-5051)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, FlickyRomInfo, FlickyRomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, + FlickyInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFlickyg = { + "flickyg", "flicky", NULL, NULL, "1984", + "Flicky (128k Version, System 2, 315-5051, alt graphics)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, FlickygRomInfo, FlickygRomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, + FlickygInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFlickys1 = { + "flickys1", "flicky", NULL, NULL, "1984", + "Flicky (64k Version, System 1, 315-5051, set 2)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Flickys1RomInfo, Flickys1RomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, + Flicks1Init, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFlickys2 = { + "flickys2", "flicky", NULL, NULL, "1984", + "Flicky (128k Version, System 2, not encrypted)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Flickys2RomInfo, Flickys2RomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, + Flicks2Init, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFlickys2g = { + "flickys2g", "flicky", NULL, NULL, "1984", + "Flicky (128k Version, System 2, not encrypted, alt graphics)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Flickys2gRomInfo, Flickys2gRomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, + Flicks2gInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFlickyo = { + "flickyo", "flicky", NULL, NULL, "1984", + "Flicky (64k Version, System 1, 315-5051, set 1)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, FlickyoRomInfo, FlickyoRomName, NULL, NULL, FlickyInputInfo, FlickyDIPInfo, + Flicks1Init, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGardia = { + "gardia", NULL, NULL, NULL, "1986", + "Gardia (317-0006)\0", NULL, "Sega / Coreland", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, GardiaRomInfo, GardiaRomName, NULL, NULL, MyheroInputInfo, GardiaDIPInfo, + GardiaInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriverD BurnDrvGardiab = { + "gardiab", "gardia", NULL, NULL, "1986", + "Gardia (317-0007?, bootleg)\0", NULL, "Sega / Coreland", "System 1", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, GardiabRomInfo, GardiabRomName, NULL, NULL, MyheroInputInfo, GardiaDIPInfo, + GardiabInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvHvymetal = { + "hvymetal", NULL, NULL, NULL, "1985", + "Heavy Metal (315-5135)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, HvymetalRomInfo, HvymetalRomName, NULL, NULL, MyheroInputInfo, HvymetalDIPInfo, + HvymetalInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvImsorry = { + "imsorry", NULL, NULL, NULL, "1985", + "I'm Sorry (315-5110, US)\0", NULL, "Coreland / Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_MAZE, 0, + NULL, ImsorryRomInfo, ImsorryRomName, NULL, NULL, MyheroInputInfo, ImsorryDIPInfo, + ImsorryInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvImsorryj = { + "imsorryj", "imsorry", NULL, NULL, "1985", + "Gonbee no I'm Sorry (315-5110, Japan)\0", NULL, "Coreland / Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_MAZE, 0, + NULL, ImsorryjRomInfo, ImsorryjRomName, NULL, NULL, MyheroInputInfo, ImsorryDIPInfo, + ImsorryInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMrviking = { + "mrviking", NULL, NULL, NULL, "1984", + "Mister Viking (315-5041)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, MrvikingRomInfo, MrvikingRomName, NULL, NULL, MyheroInputInfo, MrvikingDIPInfo, + MrvikingInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 240, 3, 4 +}; + +struct BurnDriver BurnDrvMrvikingj = { + "mrvikingj", "mrviking", NULL, NULL, "1984", + "Mister Viking (315-5041, Japan)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, MrvikingjRomInfo, MrvikingjRomName, NULL, NULL, MyheroInputInfo, MrvikngjDIPInfo, + MrvikingInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 240, 3, 4 +}; + +struct BurnDriver BurnDrvMyhero = { + "myhero", NULL, NULL, NULL, "1985", + "My Hero (US, not encrypted)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, MyheroRomInfo, MyheroRomName, NULL, NULL, MyheroInputInfo, MyheroDIPInfo, + MyheroInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSscandal = { + "sscandal", "myhero", NULL, NULL, "1985", + "Seishun Scandal (315-5132, Japan)\0", NULL, "Coreland / Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, SscandalRomInfo, SscandalRomName, NULL, NULL, MyheroInputInfo, MyheroDIPInfo, + SscandalInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMyherok = { + "myherok", "myhero", NULL, NULL, "1985", + "My Hero (Korea)\0", NULL, "Coreland / Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, MyherokRomInfo, MyherokRomName, NULL, NULL, MyheroInputInfo, MyheroDIPInfo, + MyherokInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNob = { + "nob", NULL, NULL, NULL, "1986", + "Noboranka (Japan)\0", NULL, "Data East Corporation", "System 1", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, NobRomInfo, NobRomName, NULL, NULL, MyheroInputInfo, NobbDIPInfo, + NobbInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 240, 3, 4 +}; + +struct BurnDriver BurnDrvNobb = { + "nobb", "nob", NULL, NULL, "1986", + "Noboranka (Japan, bootleg)\0", NULL, "bootleg", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, NobbRomInfo, NobbRomName, NULL, NULL, MyheroInputInfo, NobbDIPInfo, + NobbInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 240, 3, 4 +}; + +struct BurnDriver BurnDrvPitfall2 = { + "pitfall2", NULL, NULL, NULL, "1985", + "Pitfall II (315-5093)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Pitfall2RomInfo, Pitfall2RomName, NULL, NULL, MyheroInputInfo, Pitfall2DIPInfo, + Pitfall2Init, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPitfall2a = { + "pitfall2a", "pitfall2", NULL, NULL, "1985", + "Pitfall II (315-5093, Flicky Conversion)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Pitfall2aRomInfo, Pitfall2aRomName, NULL, NULL, MyheroInputInfo, Pitfall2DIPInfo, + Pitfall2Init, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPitfall2u = { + "pitfall2u", "pitfall2", NULL, NULL, "1985", + "Pitfall II (not encrypted)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Pitfall2uRomInfo, Pitfall2uRomName, NULL, NULL, MyheroInputInfo, PitfalluDIPInfo, + PitfalluInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvRaflesia = { + "raflesia", NULL, NULL, NULL, "1986", + "Rafflesia (315-5162)\0", NULL, "Coreland / Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, RaflesiaRomInfo, RaflesiaRomName, NULL, NULL, MyheroInputInfo, RaflesiaDIPInfo, + RaflesiaInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvRegulus = { + "regulus", NULL, NULL, NULL, "1983", + "Regulus (315-5033, rev. A)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, RegulusRomInfo, RegulusRomName, NULL, NULL, MyheroInputInfo, RegulusDIPInfo, + RegulusInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 240, 3, 4 +}; + +struct BurnDriver BurnDrvReguluso = { + "reguluso", "regulus", NULL, NULL, "1983", + "Regulus (315-5033)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, RegulusoRomInfo, RegulusoRomName, NULL, NULL, MyheroInputInfo, RegulusoDIPInfo, + RegulusInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 240, 3, 4 +}; + +struct BurnDriver BurnDrvRegulusu = { + "regulusu", "regulus", NULL, NULL, "1983", + "Regulus (not encrypted)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, RegulusuRomInfo, RegulusuRomName, NULL, NULL, MyheroInputInfo, RegulusDIPInfo, + RegulusuInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 240, 3, 4 +}; + +struct BurnDriver BurnDrvSeganinj = { + "seganinj", NULL, NULL, NULL, "1985", + "Sega Ninja (315-5102)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, SeganinjRomInfo, SeganinjRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, + SeganinjInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSeganinju = { + "seganinju", "seganinj", NULL, NULL, "1985", + "Sega Ninja (not encrypted)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, SeganinjuRomInfo, SeganinjuRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, + SeganinuInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNinja = { + "ninja", "seganinj", NULL, NULL, "1985", + "Ninja (315-5102)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, NinjaRomInfo, NinjaRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, + SeganinjInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNprinces = { + "nprinces", "seganinj", NULL, NULL, "1985", + "Ninja Princess (315-5051, 64k Ver. bootleg?)\0", NULL, "bootleg?", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, NprincesRomInfo, NprincesRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, + NprincesInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNprinceso = { + "nprinceso", "seganinj", NULL, NULL, "1985", + "Ninja Princess (315-5098, 128k Ver.)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, NprincesoRomInfo, NprincesoRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, + NprincsoInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNprincesu = { + "nprincesu", "seganinj", NULL, NULL, "1985", + "Ninja Princess (64k Ver. not encrypted)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, NprincesuRomInfo, NprincesuRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, + NprincsuInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNprincesb = { + "nprincesb", "seganinj", NULL, NULL, "1985", + "Ninja Princess (315-5051?, 128k Ver. bootleg?)\0", NULL, "bootleg?", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, NprincesbRomInfo, NprincesbRomName, NULL, NULL, SeganinjInputInfo, SeganinjDIPInfo, + NprincsbInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSpatter = { + "spatter", NULL, NULL, NULL, "1984", + "Spatter\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_MAZE, 0, + NULL, SpatterRomInfo, SpatterRomName, NULL, NULL, MyheroInputInfo, SpatterDIPInfo, + SpatterInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 240, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsanchan = { + "ssanchan", "spatter", NULL, NULL, "1984", + "Sanrin San Chan (Japan)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_MAZE, 0, + NULL, SsanchanRomInfo, SsanchanRomName, NULL, NULL, MyheroInputInfo, SpatterDIPInfo, + SpatterInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 240, 224, 4, 3 +}; + +struct BurnDriver BurnDrvStarjack = { + "starjack", NULL, NULL, NULL, "1983", + "Star Jacker (Sega)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, StarjackRomInfo, StarjackRomName, NULL, NULL, MyheroInputInfo, StarjackDIPInfo, + StarjackInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 240, 3, 4 +}; + +struct BurnDriver BurnDrvStarjacks = { + "starjacks", "starjack", NULL, NULL, "1983", + "Star Jacker (Stern)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_VERSHOOT, 0, + NULL, StarjacksRomInfo, StarjacksRomName, NULL, NULL, MyheroInputInfo, StarjacsDIPInfo, + StarjackInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 240, 3, 4 +}; + +struct BurnDriver BurnDrvSwat = { + "swat", NULL, NULL, NULL, "1984", + "SWAT (315-5048)\0", NULL, "Coreland / Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_MISC, 0, + NULL, SwatRomInfo, SwatRomName, NULL, NULL, MyheroInputInfo, SwatDIPInfo, + SwatInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTeddybb = { + "teddybb", NULL, NULL, NULL, "1985", + "TeddyBoy Blues (315-5115, New Ver.)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, TeddybbRomInfo, TeddybbRomName, NULL, NULL, MyheroInputInfo, TeddybbDIPInfo, + TeddybbInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTeddybbo = { + "teddybbo", "teddybb", NULL, NULL, "1985", + "TeddyBoy Blues (315-5115, Old Ver.)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, TeddybboRomInfo, TeddybboRomName, NULL, NULL, MyheroInputInfo, TeddybbDIPInfo, + TeddybbInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvUpndown = { + "upndown", NULL, NULL, NULL, "1983", + "Up'n Down (315-5030)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_MISC, 0, + NULL, UpndownRomInfo, UpndownRomName, NULL, NULL, UpndownInputInfo, UpndownDIPInfo, + UpndownInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvUpndownu = { + "upndownu", "upndown", NULL, NULL, "1983", + "Up'n Down (not encrypted)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_MISC, 0, + NULL, UpndownuRomInfo, UpndownuRomName, NULL, NULL, UpndownInputInfo, UpndownDIPInfo, + UpndownuInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvWboy = { + "wboy", NULL, NULL, NULL, "1986", + "Wonder Boy (set 1, 315-5177)\0", NULL, "Sega (Escape License)", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, WboyRomInfo, WboyRomName, NULL, NULL, WboyInputInfo, WboyDIPInfo, + WboyInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWboyo = { + "wboyo", "wboy", NULL, NULL, "1986", + "Wonder Boy (set 1, 315-5135)\0", NULL, "Sega (Escape License)", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, WboyoRomInfo, WboyoRomName, NULL, NULL, WboyInputInfo, WboyDIPInfo, + WboyoInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWboy2 = { + "wboy2", "wboy", NULL, NULL, "1986", + "Wonder Boy (set 2, 315-5178)\0", NULL, "Sega (Escape License)", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Wboy2RomInfo, Wboy2RomName, NULL, NULL, WboyInputInfo, WboyDIPInfo, + Wboy2Init, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWboy2u = { + "wboy2u", "wboy", NULL, NULL, "1986", + "Wonder Boy (set 2, not encrypted)\0", NULL, "Sega (Escape License)", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Wboy2uRomInfo, Wboy2uRomName, NULL, NULL, WboyInputInfo, WboyDIPInfo, + Wboy2uInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWboy3 = { + "wboy3", "wboy", NULL, NULL, "1986", + "Wonder Boy (set 3, 315-5135)\0", NULL, "Sega (Escape License)", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Wboy3RomInfo, Wboy3RomName, NULL, NULL, WboyInputInfo, Wboy3DIPInfo, + WboyoInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWboy4 = { + "wboy4", "wboy", NULL, NULL, "1986", + "Wonder Boy (set 4, 315-5162)\0", NULL, "Sega (Escape License)", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Wboy4RomInfo, Wboy4RomName, NULL, NULL, WboyInputInfo, WboyDIPInfo, + Wboy4Init, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWboy5 = { + "wboy5", "wboy", NULL, NULL, "1986", + "Wonder Boy (set 5, bootleg)\0", NULL, "bootleg", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, Wboy5RomInfo, Wboy5RomName, NULL, NULL, WboyInputInfo, Wboy3DIPInfo, + WboyoInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWboyu = { + "wboyu", "wboy", NULL, NULL, "1986", + "Wonder Boy (not encrypted)\0", NULL, "Sega (Escape License)", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, WboyuRomInfo, WboyuRomName, NULL, NULL, WboyInputInfo, WboyuDIPInfo, + WboyuInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWbdeluxe = { + "wbdeluxe", "wboy", NULL, NULL, "1986", + "Wonder Boy Deluxe\0", NULL, "Sega (Escape License)", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM1, GBF_PLATFORM, 0, + NULL, WbdeluxeRomInfo, WbdeluxeRomName, NULL, NULL, WboyInputInfo, WbdeluxeDIPInfo, + Wboy2uInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWmatch = { + "wmatch", NULL, NULL, NULL, "1984", + "Water Match (315-5064)\0", NULL, "Sega", "System 1", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM1, GBF_SPORTSMISC, 0, + NULL, WmatchRomInfo, WmatchRomName, NULL, NULL, WmatchInputInfo, WmatchDIPInfo, + WmatchInit, System1Exit, System1Frame, NULL, System1Scan, + NULL, 0x600, 224, 240, 3, 4 +}; + + + +// hvymetal +// shtngmst and clones +// chplft and clones +// wboysys2 +// blckgalb +// tokisens +// wbml and clones +// dakkochn +// ufosensi diff --git a/src/burn/drv/sega/d_sys16a.cpp b/src/burn/drv/sega/d_sys16a.cpp index 40f259828..b8158e6fc 100644 --- a/src/burn/drv/sega/d_sys16a.cpp +++ b/src/burn/drv/sega/d_sys16a.cpp @@ -1,3259 +1,3258 @@ -#include "sys16.h" - -/*==================================================== -Input defs -====================================================*/ - -#define A(a, b, c, d) {a, b, (UINT8*)(c), d} - -static struct BurnInputInfo System16aInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 2" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(System16a) - -static struct BurnInputInfo System16afire1InputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(System16afire1) - -static struct BurnInputInfo System16afire3InputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 3" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(System16afire3) - -static struct BurnInputInfo System16aDip3InputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 2" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, System16Dip + 2 , "dip" }, -}; - -STDINPUTINFO(System16aDip3) - -static struct BurnInputInfo AceattacaInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort3 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort3 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort3 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort3 + 1, "p1 right" }, - {"P1 Dial Left" , BIT_DIGITAL , System16InputPort4 + 0, "p1 fire 14"}, - {"P1 Dial Right" , BIT_DIGITAL , System16InputPort4 + 1, "p1 fire 15"}, - {"P1 Block" , BIT_DIGITAL , System16InputPort0 + 6, "p1 fire 1" }, - {"P1 Select" , BIT_DIGITAL , System16InputPort1 + 4, "p1 fire 2" }, - {"P1 Attack Dir0" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 3" }, - {"P1 Attack Dir1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 4" }, - {"P1 Attack Dir2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 5" }, - {"P1 Attack Dir3" , BIT_DIGITAL , System16InputPort1 + 3, "p1 fire 6" }, - {"P1 Attack Dir4" , BIT_DIGITAL , System16InputPort1 + 4, "p1 fire 7" }, - {"P1 Attack Dir5" , BIT_DIGITAL , System16InputPort1 + 5, "p1 fire 8" }, - {"P1 Attack Dir6" , BIT_DIGITAL , System16InputPort1 + 6, "p1 fire 9" }, - {"P1 Attack Dir7" , BIT_DIGITAL , System16InputPort1 + 7, "p1 fire 10"}, - {"P1 Attack Pow0" , BIT_DIGITAL , System16InputPort2 + 4, "p1 fire 11"}, - {"P1 Attack Pow1" , BIT_DIGITAL , System16InputPort2 + 5, "p1 fire 12"}, - {"P1 Attack Pow2" , BIT_DIGITAL , System16InputPort2 + 6, "p1 fire 13"}, - - {"P2 Up" , BIT_DIGITAL , System16InputPort3 + 6, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort3 + 7, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort3 + 4, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort3 + 5, "p2 right" }, - {"P2 Dial Left" , BIT_DIGITAL , System16InputPort4 + 2, "p2 fire 14"}, - {"P2 Dial Right" , BIT_DIGITAL , System16InputPort4 + 3, "p2 fire 15"}, - {"P2 Block" , BIT_DIGITAL , System16InputPort0 + 7, "p2 fire 1" }, - {"P2 Select" , BIT_DIGITAL , System16InputPort5 + 4, "p2 fire 2" }, - {"P2 Attack Dir0" , BIT_DIGITAL , System16InputPort5 + 0, "p2 fire 3" }, - {"P2 Attack Dir1" , BIT_DIGITAL , System16InputPort5 + 1, "p2 fire 4" }, - {"P2 Attack Dir2" , BIT_DIGITAL , System16InputPort5 + 2, "p2 fire 5" }, - {"P2 Attack Dir3" , BIT_DIGITAL , System16InputPort5 + 3, "p2 fire 6" }, - {"P2 Attack Dir4" , BIT_DIGITAL , System16InputPort5 + 4, "p2 fire 7" }, - {"P2 Attack Dir5" , BIT_DIGITAL , System16InputPort5 + 5, "p2 fire 8" }, - {"P2 Attack Dir6" , BIT_DIGITAL , System16InputPort5 + 6, "p2 fire 9" }, - {"P2 Attack Dir7" , BIT_DIGITAL , System16InputPort5 + 7, "p2 fire 10"}, - {"P2 Attack Pow0" , BIT_DIGITAL , System16InputPort6 + 4, "p2 fire 11"}, - {"P2 Attack Pow1" , BIT_DIGITAL , System16InputPort6 + 5, "p2 fire 12"}, - {"P2 Attack Pow2" , BIT_DIGITAL , System16InputPort6 + 6, "p2 fire 13"}, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Aceattaca) - -static struct BurnInputInfo MjleagueInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort3 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort3 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort3 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort3 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 7, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 4" }, - {"P1 Fire 5" , BIT_DIGITAL , System16InputPort1 + 3, "p1 fire 5" }, - A("P1 Bat Swing" , BIT_ANALOG_REL, &System16AnalogPort0, "p1 z-axis" ), - - {"P1 Up" , BIT_DIGITAL , System16InputPort3 + 6, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort3 + 7, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort3 + 4, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort3 + 5, "p1 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 7, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 0, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 4" }, - {"P2 Fire 5" , BIT_DIGITAL , System16InputPort2 + 3, "p2 fire 5" }, - A("P2 Bat Swing" , BIT_ANALOG_REL, &System16AnalogPort1, "p2 z-axis" ), - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Mjleague) - -static struct BurnInputInfo Passsht16aInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - {"Start 3" , BIT_DIGITAL , System16InputPort0 + 6, "p3 start" }, - {"Start 4" , BIT_DIGITAL , System16InputPort0 + 7, "p4 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 1, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 0, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 3, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 2, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 6, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , System16InputPort1 + 7, "p1 fire 4" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 1, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 0, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 3, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 2, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 6, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , System16InputPort2 + 7, "p2 fire 4" }, - - {"P3 Up" , BIT_DIGITAL , System16InputPort3 + 1, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , System16InputPort3 + 0, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , System16InputPort3 + 3, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , System16InputPort3 + 2, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , System16InputPort3 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , System16InputPort3 + 5, "p3 fire 2" }, - {"P3 Fire 3" , BIT_DIGITAL , System16InputPort3 + 6, "p3 fire 3" }, - {"P3 Fire 4" , BIT_DIGITAL , System16InputPort3 + 7, "p3 fire 4" }, - - {"P4 Up" , BIT_DIGITAL , System16InputPort4 + 1, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , System16InputPort4 + 0, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , System16InputPort4 + 3, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , System16InputPort4 + 2, "p4 right" }, - {"P4 Fire 1" , BIT_DIGITAL , System16InputPort4 + 4, "p4 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , System16InputPort4 + 5, "p4 fire 2" }, - {"P4 Fire 3" , BIT_DIGITAL , System16InputPort4 + 6, "p4 fire 3" }, - {"P4 Fire 4" , BIT_DIGITAL , System16InputPort4 + 7, "p4 fire 4" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Passsht16a) - -static struct BurnInputInfo QuartetInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 6, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort1 + 6, "p2 coin" }, - {"Coin 3" , BIT_DIGITAL , System16InputPort2 + 6, "p3 coin" }, - {"Coin 4" , BIT_DIGITAL , System16InputPort3 + 6, "p4 coin" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort0 + 1, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort0 + 0, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort0 + 3, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort0 + 2, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort1 + 1, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort1 + 0, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort1 + 3, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort1 + 2, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort1 + 5, "p2 fire 2" }, - - {"P3 Up" , BIT_DIGITAL , System16InputPort2 + 1, "p1 up" }, - {"P3 Down" , BIT_DIGITAL , System16InputPort2 + 0, "p1 down" }, - {"P3 Left" , BIT_DIGITAL , System16InputPort2 + 3, "p1 left" }, - {"P3 Right" , BIT_DIGITAL , System16InputPort2 + 2, "p1 right" }, - {"P3 Fire 1" , BIT_DIGITAL , System16InputPort2 + 4, "p1 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , System16InputPort2 + 5, "p1 fire 2" }, - - {"P4 Up" , BIT_DIGITAL , System16InputPort3 + 1, "p2 up" }, - {"P4 Down" , BIT_DIGITAL , System16InputPort3 + 0, "p2 down" }, - {"P4 Left" , BIT_DIGITAL , System16InputPort3 + 3, "p2 left" }, - {"P4 Right" , BIT_DIGITAL , System16InputPort3 + 2, "p2 right" }, - {"P4 Fire 1" , BIT_DIGITAL , System16InputPort3 + 4, "p2 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , System16InputPort3 + 5, "p2 fire 2" }, - - {"Service 1" , BIT_DIGITAL , System16InputPort0 + 7 , "service" }, - {"Service 2" , BIT_DIGITAL , System16InputPort1 + 7 , "service2" }, - {"Service 3" , BIT_DIGITAL , System16InputPort2 + 7 , "service3" }, - {"Service 4" , BIT_DIGITAL , System16InputPort3 + 7 , "service4" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Quartet) - -static struct BurnInputInfo SdiInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 1, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 0, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 3, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 2, "p1 right" }, - A("Target Left/Right", BIT_ANALOG_REL, &System16AnalogPort0, "mouse x-axis" ), - A("Target Up/Down" , BIT_ANALOG_REL, &System16AnalogPort1, "mouse y-axis" ), - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort0 + 6, "mouse button 1"}, - - {"P2 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p2 right" }, - A("Target Left/Right", BIT_ANALOG_REL, &System16AnalogPort2, "p2 x-axis" ), - A("Target Up/Down" , BIT_ANALOG_REL, &System16AnalogPort3, "p2 y-axis" ), - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort0 + 7, "p2 fire 1" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Sdi) - -static struct BurnInputInfo Sjryuko1InputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - - {"Mahjong A" , BIT_DIGITAL , System16InputPort1 + 0, "mah a" }, - {"Mahjong B" , BIT_DIGITAL , System16InputPort1 + 1, "mah b" }, - {"Mahjong C" , BIT_DIGITAL , System16InputPort1 + 2, "mah c" }, - {"Mahjong D" , BIT_DIGITAL , System16InputPort1 + 3, "mah d" }, - {"Mahjong E" , BIT_DIGITAL , System16InputPort2 + 0, "mah e" }, - {"Mahjong F" , BIT_DIGITAL , System16InputPort2 + 1, "mah f" }, - {"Mahjong G" , BIT_DIGITAL , System16InputPort2 + 2, "mah g" }, - {"Mahjong H" , BIT_DIGITAL , System16InputPort2 + 3, "mah h" }, - {"Mahjong I" , BIT_DIGITAL , System16InputPort3 + 0, "mah i" }, - {"Mahjong J" , BIT_DIGITAL , System16InputPort3 + 1, "mah j" }, - {"Mahjong K" , BIT_DIGITAL , System16InputPort3 + 2, "mah k" }, - {"Mahjong L" , BIT_DIGITAL , System16InputPort3 + 3, "mah l" }, - {"Mahjong M" , BIT_DIGITAL , System16InputPort4 + 0, "mah m" }, - {"Mahjong N" , BIT_DIGITAL , System16InputPort4 + 1, "mah n" }, - {"Mahjong Kan" , BIT_DIGITAL , System16InputPort6 + 0, "mah kan" }, - {"Mahjong Pon" , BIT_DIGITAL , System16InputPort4 + 3, "mah pon" }, - {"Mahjong Chi" , BIT_DIGITAL , System16InputPort4 + 2, "mah chi" }, - {"Mahjong Reach" , BIT_DIGITAL , System16InputPort6 + 1, "mah reach" }, - {"Mahjong Ron" , BIT_DIGITAL , System16InputPort6 + 2, "mah ron" }, - {"Mahjong Bet" , BIT_DIGITAL , System16InputPort5 + 1, "mah bet" }, - {"Mahjong Last Chance", BIT_DIGITAL , System16InputPort1 + 4, "mah lc" }, - {"Mahjong Score" , BIT_DIGITAL , System16InputPort5 + 0, "mah score" }, - {"Mahjong Flip Flop" , BIT_DIGITAL , System16InputPort4 + 4, "mah ff" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Sjryuko1) - -#undef A - -/*==================================================== -Dip defs -====================================================*/ - -#define SYSTEM16A_COINAGE(dipval) \ - {0 , 0xfe, 0 , 16 , "Coin A" }, \ - {dipval, 0x01, 0x0f, 0x07, "4 Coins 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x08, "3 Coins 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x09, "2 Coins 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x05, "2 Coins 1 Credit 5/3 6/4" }, \ - {dipval, 0x01, 0x0f, 0x04, "2 Coins 1 Credit 4/3" }, \ - {dipval, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x01, "1 Coin 1 Credit 2/3" }, \ - {dipval, 0x01, 0x0f, 0x02, "1 Coin 1 Credit 4/5" }, \ - {dipval, 0x01, 0x0f, 0x03, "1 Coin 1 Credit 5/6" }, \ - {dipval, 0x01, 0x0f, 0x06, "2 Coins 3 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, \ - {dipval, 0x01, 0x0f, 0x00, "Free Play (if coin B too) or 1C/1C" }, \ - \ - {0 , 0xfe, 0 , 16 , "Coin B" }, \ - {dipval, 0x01, 0xf0, 0x70, "4 Coins 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x80, "3 Coins 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x90, "2 Coins 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x50, "2 Coins 1 Credit 5/3 6/4" }, \ - {dipval, 0x01, 0xf0, 0x40, "2 Coins 1 Credit 4/3" }, \ - {dipval, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x10, "1 Coin 1 Credit 2/3" }, \ - {dipval, 0x01, 0xf0, 0x20, "1 Coin 1 Credit 4/5" }, \ - {dipval, 0x01, 0xf0, 0x30, "1 Coin 1 Credit 5/6" }, \ - {dipval, 0x01, 0xf0, 0x60, "2 Coins 3 Credits" }, \ - {dipval, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, \ - {dipval, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, \ - {dipval, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, \ - {dipval, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, \ - {dipval, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, \ - {dipval, 0x01, 0xf0, 0x00, "Free Play (if coin A too) or 1C/1C" }, - -static struct BurnDIPInfo AceattacaDIPList[]= -{ - // Default Values - {0x2d, 0xff, 0xff, 0xff, NULL }, - {0x2e, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x2d) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x2e, 0x01, 0x01, 0x01, "Off" }, - {0x2e, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Starting Points" }, - {0x2e, 0x01, 0x0e, 0x06, "2000" }, - {0x2e, 0x01, 0x0e, 0x0a, "3000" }, - {0x2e, 0x01, 0x0e, 0x0c, "4000" }, - {0x2e, 0x01, 0x0e, 0x0e, "5000" }, - {0x2e, 0x01, 0x0e, 0x08, "6000" }, - {0x2e, 0x01, 0x0e, 0x04, "7000" }, - {0x2e, 0x01, 0x0e, 0x02, "8000" }, - {0x2e, 0x01, 0x0e, 0x00, "9000" }, -}; - -STDDIPINFO(Aceattaca) - -static struct BurnDIPInfo AfighterDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x08, "2" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x04, "4" }, - {0x14, 0x01, 0x0c, 0x00, "Infinite" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x30, "10000 - 20000" }, - {0x14, 0x01, 0x30, 0x20, "20000 - 40000" }, - {0x14, 0x01, 0x30, 0x10, "30000 - 60000" }, - {0x14, 0x01, 0x30, 0x00, "40000 - 80000" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x40, 0x40, "Normal" }, - {0x14, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x80, 0x00, "No" }, - {0x14, 0x01, 0x80, 0x80, "Yes" }, -}; - -STDDIPINFO(Afighter) - -static struct BurnDIPInfo AlexkiddDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Continues" }, - {0x14, 0x01, 0x01, 0x01, "Only before level 5" }, - {0x14, 0x01, 0x01, 0x00, "Unlimited" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - {0x14, 0x01, 0x0c, 0x00, "240" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x30, 0x20, "10000" }, - {0x14, 0x01, 0x30, 0x30, "20000" }, - {0x14, 0x01, 0x30, 0x10, "40000" }, - {0x14, 0x01, 0x30, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Timer Adjust" }, - {0x14, 0x01, 0xc0, 0x80, "70" }, - {0x14, 0x01, 0xc0, 0xc0, "60" }, - {0x14, 0x01, 0xc0, 0x40, "50" }, - {0x14, 0x01, 0xc0, 0x00, "40" }, -}; - -STDDIPINFO(Alexkidd) - -static struct BurnDIPInfo AliensynDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x11) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x02, "Off" }, - {0x12, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x0c, 0x08, "2" }, - {0x12, 0x01, 0x0c, 0x0c, "3" }, - {0x12, 0x01, 0x0c, 0x04, "4" }, - {0x12, 0x01, 0x0c, 0x00, "127" }, - - {0 , 0xfe, 0 , 4 , "Timer" }, - {0x12, 0x01, 0x30, 0x00, "150" }, - {0x12, 0x01, 0x30, 0x10, "160" }, - {0x12, 0x01, 0x30, 0x20, "170" }, - {0x12, 0x01, 0x30, 0x30, "180" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0xc0, 0x80, "Easy" }, - {0x12, 0x01, 0xc0, 0xc0, "Normal" }, - {0x12, 0x01, 0xc0, 0x40, "Hard" }, - {0x12, 0x01, 0xc0, 0x00, "Hardest" }, -}; - -STDDIPINFO(Aliensyn) - -static struct BurnDIPInfo BodyslamDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, -}; - -STDDIPINFO(Bodyslam) - -static struct BurnDIPInfo FantzoneDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Upright" }, - {0x14, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x08, "2" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x04, "4" }, - {0x14, 0x01, 0x0c, 0x00, "240" }, - - {0 , 0xfe, 0 , 4 , "Extra Ship Cost" }, - {0x14, 0x01, 0x30, 0x30, "5000" }, - {0x14, 0x01, 0x30, 0x20, "10000" }, - {0x14, 0x01, 0x30, 0x10, "15000" }, - {0x14, 0x01, 0x30, 0x00, "20000" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0xc0, 0x80, "Easy" }, - {0x14, 0x01, 0xc0, 0xc0, "Normal" }, - {0x14, 0x01, 0xc0, 0x40, "Hard" }, - {0x14, 0x01, 0xc0, 0x00, "Hardest" }, -}; - -STDDIPINFO(Fantzone) - -static struct BurnDIPInfo MjleagueDIPList[]= -{ - // Default Values - {0x1b, 0xff, 0xff, 0xff, NULL }, - {0x1c, 0xff, 0xff, 0xf0, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x1b) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x1c, 0x01, 0x01, 0x00, "Upright" }, - {0x1c, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x1c, 0x01, 0x02, 0x02, "Off" }, - {0x1c, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Starting Points" }, - {0x1c, 0x01, 0x0c, 0x0c, "2000" }, - {0x1c, 0x01, 0x0c, 0x08, "3000" }, - {0x1c, 0x01, 0x0c, 0x04, "5000" }, - {0x1c, 0x01, 0x0c, 0x00, "10000" }, - - {0 , 0xfe, 0 , 2 , "Team Select" }, - {0x1c, 0x01, 0x10, 0x02, "Off" }, - {0x1c, 0x01, 0x10, 0x10, "On" }, -}; - -STDDIPINFO(Mjleague) - -static struct BurnDIPInfo Passsht16aDIPList[]= -{ - // Default Values - {0x29, 0xff, 0xff, 0xff, NULL }, - {0x2a, 0xff, 0xff, 0xf0, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x29) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x2a, 0x01, 0x01, 0x01, "Off" }, - {0x2a, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Initial Point" }, - {0x2a, 0x01, 0x0e, 0x06, "2000" }, - {0x2a, 0x01, 0x0e, 0x0a, "3000" }, - {0x2a, 0x01, 0x0e, 0x0c, "4000" }, - {0x2a, 0x01, 0x0e, 0x0e, "5000" }, - {0x2a, 0x01, 0x0e, 0x08, "6000" }, - {0x2a, 0x01, 0x0e, 0x04, "7000" }, - {0x2a, 0x01, 0x0e, 0x02, "8000" }, - {0x2a, 0x01, 0x0e, 0x00, "9000" }, - - {0 , 0xfe, 0 , 4 , "Point Table" }, - {0x2a, 0x01, 0x30, 0x20, "Easy" }, - {0x2a, 0x01, 0x30, 0x30, "Normal" }, - {0x2a, 0x01, 0x30, 0x10, "Hard" }, - {0x2a, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x2a, 0x01, 0xc0, 0x80, "Easy" }, - {0x2a, 0x01, 0xc0, 0xc0, "Normal" }, - {0x2a, 0x01, 0xc0, 0x40, "Hard" }, - {0x2a, 0x01, 0xc0, 0x00, "Hardest" }, -}; - -STDDIPINFO(Passsht16a) - -static struct BurnDIPInfo QuartetDIPList[]= -{ - // Default Values - {0x21, 0xff, 0xff, 0xff, NULL }, - {0x22, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x21) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x22, 0x01, 0x01, 0x01, "Off" }, - {0x22, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Credit Power" }, - {0x22, 0x01, 0x06, 0x04, "500" }, - {0x22, 0x01, 0x06, 0x06, "1000" }, - {0x22, 0x01, 0x06, 0x02, "2000" }, - {0x22, 0x01, 0x06, 0x00, "9000" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x22, 0x01, 0x18, 0x10, "Easy" }, - {0x22, 0x01, 0x18, 0x18, "Normal" }, - {0x22, 0x01, 0x18, 0x08, "Hard" }, - {0x22, 0x01, 0x18, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Coin During Game" }, - {0x22, 0x01, 0x20, 0x20, "Power" }, - {0x22, 0x01, 0x20, 0x00, "Credit" }, - - {0 , 0xfe, 0 , 2 , "Free Play" }, - {0x22, 0x01, 0x40, 0x40, "Off" }, - {0x22, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x22, 0x01, 0x80, 0x80, "Off" }, - {0x22, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Quartet) - -static struct BurnDIPInfo Quart2DIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x01, 0x01, "Off" }, - {0x14, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Credit Power" }, - {0x14, 0x01, 0x06, 0x04, "500" }, - {0x14, 0x01, 0x06, 0x06, "1000" }, - {0x14, 0x01, 0x06, 0x02, "2000" }, - {0x14, 0x01, 0x06, 0x00, "9000" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x18, 0x10, "Easy" }, - {0x14, 0x01, 0x18, 0x18, "Normal" }, - {0x14, 0x01, 0x18, 0x08, "Hard" }, - {0x14, 0x01, 0x18, 0x00, "Hardest" }, -}; - -STDDIPINFO(Quart2) - -static struct BurnDIPInfo SdiDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x15) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x01, 0x01, "No" }, - {0x16, 0x01, 0x01, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x16, 0x01, 0x02, 0x02, "Off" }, - {0x16, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x0c, 0x08, "2" }, - {0x16, 0x01, 0x0c, 0x0c, "3" }, - {0x16, 0x01, 0x0c, 0x04, "4" }, - {0x16, 0x01, 0x0c, 0x00, "Free" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x30, 0x20, "Easy" }, - {0x16, 0x01, 0x30, 0x30, "Normal" }, - {0x16, 0x01, 0x30, 0x10, "Hard" }, - {0x16, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x16, 0x01, 0xc0, 0x80, "Every 50000" }, - {0x16, 0x01, 0xc0, 0xc0, "50000" }, - {0x16, 0x01, 0xc0, 0x40, "100000" }, - {0x16, 0x01, 0xc0, 0x00, "None" }, -}; - -STDDIPINFO(Sdi) - -static struct BurnDIPInfo ShinobiDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x15) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x16, 0x01, 0x01, 0x00, "Upright" }, - {0x16, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x16, 0x01, 0x02, 0x02, "Off" }, - {0x16, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x0c, 0x08, "2" }, - {0x16, 0x01, 0x0c, 0x0c, "3" }, - {0x16, 0x01, 0x0c, 0x04, "5" }, - {0x16, 0x01, 0x0c, 0x00, "240" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x30, 0x20, "Easy" }, - {0x16, 0x01, 0x30, 0x30, "Normal" }, - {0x16, 0x01, 0x30, 0x10, "Hard" }, - {0x16, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Enemy Bullet Speed" }, - {0x16, 0x01, 0x40, 0x40, "Slow" }, - {0x16, 0x01, 0x40, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x16, 0x01, 0x80, 0x80, "Japanese" }, - {0x16, 0x01, 0x80, 0x00, "English" }, -}; - -STDDIPINFO(Shinobi) - -static struct BurnDIPInfo Sjryuko1DIPList[]= -{ - // Default Values - {0x1c, 0xff, 0xff, 0xff, NULL }, - {0x1d, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x1c) - - // Dip 2 -}; - -STDDIPINFO(Sjryuko1) - -static struct BurnDIPInfo TetrisDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xfd, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x11) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x02, 0x02, "Off" }, - {0x12, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x30, 0x20, "Easy" }, - {0x12, 0x01, 0x30, 0x30, "Normal" }, - {0x12, 0x01, 0x30, 0x10, "Hard" }, - {0x12, 0x01, 0x30, 0x00, "Hardest" }, -}; - -STDDIPINFO(Tetris) - -static struct BurnDIPInfo TimescanDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xf5, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x14, 0x01, 0x01, 0x00, "Cocktail" }, - {0x14, 0x01, 0x01, 0x01, "Upright" }, - - {0 , 0xfe, 0 , 16 , "Bonus" }, - {0x14, 0x01, 0x1e, 0x16, "Replay 1000000/2000000" }, - {0x14, 0x01, 0x1e, 0x14, "Replay 1200000/2500000" }, - {0x14, 0x01, 0x1e, 0x12, "Replay 1500000/3000000" }, - {0x14, 0x01, 0x1e, 0x10, "Replay 2000000/4000000" }, - {0x14, 0x01, 0x1e, 0x1c, "Replay 1000000" }, - {0x14, 0x01, 0x1e, 0x1e, "Replay 1200000" }, - {0x14, 0x01, 0x1e, 0x1a, "Replay 1500000" }, - {0x14, 0x01, 0x1e, 0x18, "Replay 1800000" }, - {0x14, 0x01, 0x1e, 0x0e, "Extra Ball 100000" }, - {0x14, 0x01, 0x1e, 0x0c, "Extra Ball 200000" }, - {0x14, 0x01, 0x1e, 0x0a, "Extra Ball 300000" }, - {0x14, 0x01, 0x1e, 0x08, "Extra Ball 400000" }, - {0x14, 0x01, 0x1e, 0x06, "Extra Ball 500000" }, - {0x14, 0x01, 0x1e, 0x04, "Extra Ball 600000" }, - {0x14, 0x01, 0x1e, 0x02, "Extra Ball 700000" }, - {0x14, 0x01, 0x1e, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Match" }, - {0x14, 0x01, 0x20, 0x00, "Off" }, - {0x14, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Pin Rebound" }, - {0x14, 0x01, 0x40, 0x40, "Well" }, - {0x14, 0x01, 0x40, 0x00, "A Little" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x14, 0x01, 0x80, 0x80, "3" }, - {0x14, 0x01, 0x80, 0x00, "5" }, - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Out Lane Pin" }, - {0x15, 0x01, 0x02, 0x02, "Near" }, - {0x15, 0x01, 0x02, 0x00, "Far" }, - - {0 , 0xfe, 0 , 4 , "Special" }, - {0x15, 0x01, 0x0c, 0x08, "7 Credits" }, - {0x15, 0x01, 0x0c, 0x0c, "3 Credits" }, - {0x15, 0x01, 0x0c, 0x04, "1 Credit" }, - {0x15, 0x01, 0x0c, 0x00, "2000000 Points" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x10, 0x00, "No" }, - {0x15, 0x01, 0x10, 0x10, "Yes" }, -}; - -STDDIPINFO(Timescan) - -static struct BurnDIPInfo Wb31DIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - // Dip 1 - SYSTEM16A_COINAGE(0x13) - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x0c, 0x00, "2" }, - {0x14, 0x01, 0x0c, 0x0c, "3" }, - {0x14, 0x01, 0x0c, 0x08, "4" }, - {0x14, 0x01, 0x0c, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x14, 0x01, 0x10, 0x10, "5k, 10k, 18k, 30k" }, - {0x14, 0x01, 0x10, 0x00, "5k, 15k, 30k" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x14, 0x01, 0x20, 0x20, "Normal" }, - {0x14, 0x01, 0x20, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Invincible Mode" }, - {0x14, 0x01, 0x40, 0x40, "No" }, - {0x14, 0x01, 0x40, 0x00, "Yes" }, -}; - -STDDIPINFO(Wb31) - -#undef SYSTEM16A_COINAGE - -/*==================================================== -Rom defs -====================================================*/ - -static struct BurnRomInfo AceattacaRomDesc[] = { - { "epr-11573.43", 0x10000, 0xca116367, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11571.26", 0x10000, 0x5631d1d6, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11574.42", 0x10000, 0x8d3ed7bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11572.25", 0x10000, 0x35c27c25, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11575.95", 0x10000, 0xbab9fbf3, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11576.94", 0x10000, 0x067ed682, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11577.93", 0x10000, 0xf67cf331, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11501.10", 0x10000, 0x09179ead, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11505.11", 0x10000, 0xb67f1ecf, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11502.17", 0x10000, 0x7464bae4, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11506.18", 0x10000, 0xb0104def, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11503.23", 0x10000, 0x344c0692, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11507.24", 0x10000, 0xa2af710a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11504.29", 0x10000, 0x42b4a5f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11508.30", 0x10000, 0x5cbb833c, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11578.12", 0x08000, 0x3d58e39a, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-11579.1", 0x08000, 0x1a994135, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-11580.2", 0x08000, 0x961646ed, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-11581.4", 0x08000, 0xd271a6e5, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-11582.5", 0x08000, 0xbcbe3d8a, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0060.key", 0x02000, 0xf4ee940f, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Aceattaca) -STD_ROM_FN(Aceattaca) - -static struct BurnRomInfo AfighterRomDesc[] = { - { "epr-10353", 0x08000, 0x5a757dc9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10350", 0x08000, 0xf2cd6b3f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10352", 0x08000, 0xf8abb143, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10349", 0x08000, 0x4b434c37, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10351", 0x08000, 0xede21d8d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10348", 0x08000, 0xe51e3012, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10281.95", 0x10000, 0x30e92cda, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10282.94", 0x10000, 0xb67b8910, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10283.93", 0x10000, 0xe7dbfd2d, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10285", 0x08000, 0x98aa3d04, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10289", 0x08000, 0xc59d1b98, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10286", 0x08000, 0x8da050cf, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10290", 0x08000, 0x39354223, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10287", 0x08000, 0x7989b74a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10291", 0x08000, 0x6e4b245c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10288", 0x08000, 0xd3ce551a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10292", 0x08000, 0xcef289a3, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10284.12", 0x08000, 0x8ff09116, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0018.key", 0x02000, 0xfee04be8, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Afighter) -STD_ROM_FN(Afighter) - -static struct BurnRomInfo AlexkiddRomDesc[] = { - { "epr-10447.43", 0x10000, 0x29e87f71, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10445.26", 0x10000, 0x25ce5b6f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10448.42", 0x10000, 0x05baedb5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10446.25", 0x10000, 0xcd61d23c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10431.95", 0x08000, 0xa7962c39, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10432.94", 0x08000, 0xdb8cd24e, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10433.93", 0x08000, 0xe163c8c2, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10437.10", 0x08000, 0x522f7618, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10441.11", 0x08000, 0x74e3a35c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10438.17", 0x08000, 0x738a6362, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10442.18", 0x08000, 0x86cb9c14, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10439.23", 0x08000, 0xb391aca7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10443.24", 0x08000, 0x95d32635, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10440.29", 0x08000, 0x23939508, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10444.30", 0x08000, 0x82115823, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10434.12", 0x08000, 0x77141cce, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-10435.1", 0x08000, 0xad89f6e3, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-10436.2", 0x08000, 0x96c76613, SYS16_ROM_7751DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Alexkidd) -STD_ROM_FN(Alexkidd) - -static struct BurnRomInfo Alexkidd1RomDesc[] = { - { "epr-10429.43", 0x10000, 0xbdf49eca, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10427.26", 0x10000, 0xf6e3dd29, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10430.42", 0x10000, 0x89e3439f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10428.25", 0x10000, 0xdbed3210, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10431.95", 0x08000, 0xa7962c39, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10432.94", 0x08000, 0xdb8cd24e, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10433.93", 0x08000, 0xe163c8c2, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10437.10", 0x08000, 0x522f7618, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10441.11", 0x08000, 0x74e3a35c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10438.17", 0x08000, 0x738a6362, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10442.18", 0x08000, 0x86cb9c14, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10439.23", 0x08000, 0xb391aca7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10443.24", 0x08000, 0x95d32635, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10440.29", 0x08000, 0x23939508, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10444.30", 0x08000, 0x82115823, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10434.12", 0x08000, 0x77141cce, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-10435.1", 0x08000, 0xad89f6e3, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-10436.2", 0x08000, 0x96c76613, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0021.key", 0x02000, 0x85be8eac, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Alexkidd1) -STD_ROM_FN(Alexkidd1) - -static struct BurnRomInfo AliensynjoRomDesc[] = { - { "epr-10699.43", 0x08000, 0x3fd38d17, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10696.26", 0x08000, 0xd734f19f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10700.42", 0x08000, 0x3b04b252, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10697.25", 0x08000, 0xf2bc123d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10701.41", 0x08000, 0x92171751, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10698.24", 0x08000, 0xc1e4fdc0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10739.95", 0x10000, 0xa29ec207, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10740.94", 0x10000, 0x47f93015, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10741.93", 0x10000, 0x4970739c, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10709.10", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10713.11", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10710.17", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10714.18", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10711.23", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10715.24", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10712.29", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10716.30", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10705.12", 0x08000, 0x777b749e, SYS16_ROM_Z80PROG | BRF_ESS |BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-10706.1", 0x08000, 0xaa114acc, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-10707.2", 0x08000, 0x800c1d82, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-10708.4", 0x08000, 0x5921ef52, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0033.key", 0x02000, 0x49e882e5, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Aliensynjo) -STD_ROM_FN(Aliensynjo) - -static struct BurnRomInfo Aliensyn2RomDesc[] = { - { "epr-10808", 0x08000, 0xe669929f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10806", 0x08000, 0x9f7f8fdd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10809", 0x08000, 0x9a424919, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10807", 0x08000, 0x3d2c3530, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10701", 0x08000, 0x92171751, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10698", 0x08000, 0xc1e4fdc0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "10739", 0x10000, 0xa29ec207, SYS16_ROM_TILES | BRF_GRA }, - { "10740", 0x10000, 0x47f93015, SYS16_ROM_TILES | BRF_GRA }, - { "10741", 0x10000, 0x4970739c, SYS16_ROM_TILES | BRF_GRA }, - - { "10709.b1", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, - { "10713.b5", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, - { "10710.b2", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, - { "10714.b6", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, - { "10711.b3", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, - { "10715.b7", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, - { "10712.b4", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, - { "10716.b8", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, - - { "10705", 0x08000, 0x777b749e, SYS16_ROM_Z80PROG | BRF_ESS |BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "10706", 0x08000, 0xaa114acc, SYS16_ROM_7751DATA | BRF_SND }, - { "10707", 0x08000, 0x800c1d82, SYS16_ROM_7751DATA | BRF_SND }, - { "10708", 0x08000, 0x5921ef52, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0033.key", 0x02000, 0x49e882e5, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Aliensyn2) -STD_ROM_FN(Aliensyn2) - -static struct BurnRomInfo Aliensyn5RomDesc[] = { - { "epr-10804.43", 0x08000, 0x23f78b83, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10802.26", 0x08000, 0x996768bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10805.42", 0x08000, 0x53d7fe50, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10803.25", 0x08000, 0x0536dd33, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10732.41", 0x08000, 0xc5712bfc, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10729.24", 0x08000, 0x3e520e30, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10739.95", 0x10000, 0xa29ec207, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10740.94", 0x10000, 0x47f93015, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10741.93", 0x10000, 0x4970739c, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10709.10", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10713.11", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10710.17", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10714.18", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10711.23", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10715.24", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10712.29", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10716.30", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10705.12", 0x08000, 0x777b749e, SYS16_ROM_Z80PROG | BRF_ESS |BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-10706.1", 0x08000, 0xaa114acc, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-10707.2", 0x08000, 0x800c1d82, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-10708.4", 0x08000, 0x5921ef52, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0037.key", 0x02000, 0x49e882e5, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Aliensyn5) -STD_ROM_FN(Aliensyn5) - -static struct BurnRomInfo BodyslamRomDesc[] = { - { "epr-10066.b9", 0x08000, 0x6cd53290, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10063.b6", 0x08000, 0xdd849a16, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10067.b10", 0x08000, 0xdb22a5ce, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10064.b7", 0x08000, 0x53d6b7e0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10068.b11", 0x08000, 0x15ccc665, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10065.b8", 0x08000, 0x0e5fa314, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10321.c9", 0x08000, 0xcd3e7cba, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10322.c10", 0x08000, 0xb53d3217, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10323.c11", 0x08000, 0x915a3e61, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10012.c5", 0x08000, 0x990824e8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10016.b2", 0x08000, 0xaf5dc72f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10013.c6", 0x08000, 0x9a0919c5, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10017.b3", 0x08000, 0x62aafd95, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10027.c7", 0x08000, 0x3f1c57c7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10028.b4", 0x08000, 0x80d4946d, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10015.c8", 0x08000, 0x582d3b6a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10019.b5", 0x08000, 0xe020c38b, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10026.b1", 0x08000, 0x123b69b8, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-10029.c1", 0x08000, 0x7e4aca83, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-10030.c2", 0x08000, 0xdcc1df0b, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-10031.c3", 0x08000, 0xea3c4472, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-10032.c4", 0x08000, 0x0aabebce, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0015.bin", 0x01000, 0x833869e2, BRF_PRG | BRF_OPT }, -}; - - -STD_ROM_PICK(Bodyslam) -STD_ROM_FN(Bodyslam) - -static struct BurnRomInfo DumpmtmtRomDesc[] = { - { "epr-7704a.b9", 0x08000, 0x96de6c7b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7701a.b6", 0x08000, 0x786d1009, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7705a.b10", 0x08000, 0xfc584391, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7702a.b7", 0x08000, 0x2241a8fd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7706a.b11", 0x08000, 0x6bbcc9d0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7703a.b8", 0x08000, 0xfcb0cd40, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-7707a.c9", 0x08000, 0x45318738, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7708a.c10", 0x08000, 0x411be9a4, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7709a.c11", 0x08000, 0x74ceb5a8, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-7715.c5", 0x08000, 0xbf47e040, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7719.b2", 0x08000, 0xfa5c5d6c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10013.c6", 0x08000, 0x9a0919c5, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10017.b3", 0x08000, 0x62aafd95, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7717.c7", 0x08000, 0xfa64c86d, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7721.b4", 0x08000, 0x62a9143e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10015.c8", 0x08000, 0x582d3b6a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10019.b5", 0x08000, 0xe020c38b, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-7710a.b1", 0x08000, 0xa19b8ba8, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-7711.c1", 0x08000, 0xefa9aabd, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7712.c2", 0x08000, 0x7bcd85cf, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7713.c3", 0x08000, 0x33f292e7, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7714.c4", 0x08000, 0x8fd48c47, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0011a.mcu", 0x01000, 0x00000000, BRF_NODUMP }, -}; - - -STD_ROM_PICK(Dumpmtmt) -STD_ROM_FN(Dumpmtmt) - -static struct BurnRomInfo FantzoneRomDesc[] = { - { "epr-7385a.43", 0x08000, 0x4091af42, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7382a.26", 0x08000, 0x77d67bfd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7386a.42", 0x08000, 0xb0a67cd0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7383a.25", 0x08000, 0x5f79b2a9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7387.41", 0x08000, 0x0acd335d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7384.24", 0x08000, 0xfd909341, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-7388.95", 0x08000, 0x8eb02f6b, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7389.94", 0x08000, 0x2f4f71b8, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7390.93", 0x08000, 0xd90609c6, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-7392.10", 0x08000, 0x5bb7c8b6, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7396.11", 0x08000, 0x74ae4b57, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7393.17", 0x08000, 0x14fc7e82, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7397.18", 0x08000, 0xe05a1e25, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7394.23", 0x08000, 0x531ca13f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7398.24", 0x08000, 0x68807b49, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-7535a.12", 0x08000, 0xbc1374fa, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Fantzone) -STD_ROM_FN(Fantzone) - -static struct BurnRomInfo Fantzone1RomDesc[] = { - { "epr-7385.43", 0x08000, 0x5cb64450, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7382.26", 0x08000, 0x3fda7416, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7386.42", 0x08000, 0x15810ace, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7383.25", 0x08000, 0xa001e10a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7387.41", 0x08000, 0x0acd335d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7384.24", 0x08000, 0xfd909341, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-7388.95", 0x08000, 0x8eb02f6b, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7389.94", 0x08000, 0x2f4f71b8, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7390.93", 0x08000, 0xd90609c6, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-7392.10", 0x08000, 0x5bb7c8b6, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7396.11", 0x08000, 0x74ae4b57, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7393.17", 0x08000, 0x14fc7e82, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7397.18", 0x08000, 0xe05a1e25, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7394.23", 0x08000, 0x531ca13f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7398.24", 0x08000, 0x68807b49, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-7535.12", 0x08000, 0x0cb2126a, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Fantzone1) -STD_ROM_FN(Fantzone1) - -static struct BurnRomInfo FantzonepRomDesc[] = { - { "epr-7385.43", 0x08000, 0x5cb64450, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7382.26", 0x08000, 0x3fda7416, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7386.42", 0x08000, 0x15810ace, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7383.25", 0x08000, 0xa001e10a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7387.41", 0x08000, 0x0acd335d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7384.24", 0x08000, 0xfd909341, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-7388.95", 0x08000, 0x8eb02f6b, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7389.94", 0x08000, 0x2f4f71b8, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7390.93", 0x08000, 0xd90609c6, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-7392.10", 0x08000, 0x5bb7c8b6, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7396.11", 0x08000, 0x74ae4b57, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7393.17", 0x08000, 0x14fc7e82, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7397.18", 0x08000, 0xe05a1e25, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7394.23", 0x08000, 0x531ca13f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7398.24", 0x08000, 0x68807b49, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-7391.12", 0x08000, 0xc03e155e, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Fantzonep) -STD_ROM_FN(Fantzonep) - -static struct BurnRomInfo MjleagueRomDesc[] = { - { "epr-7404.9b", 0x08000, 0xec1655b5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7401.6b", 0x08000, 0x2befa5e0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7405.10b", 0x08000, 0x7a4f4e38, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7402.7b", 0x08000, 0xb7bef762, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7406a.11b", 0x08000, 0xbb743639, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7403a.8b", 0x08000, 0x0a39a4d0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-7051.9a", 0x08000, 0x10ca255a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7052.10a", 0x08000, 0x2550db0e, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7053.11a", 0x08000, 0x5bfea038, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-7055.5a", 0x08000, 0x1fb860bd, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7059.2b", 0x08000, 0x3d14091d, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7056.6a", 0x08000, 0xb35dd968, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7060.3b", 0x08000, 0x61bb3757, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7057.7a", 0x08000, 0x3e5a2b6f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7061.4b", 0x08000, 0xc808dad5, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7058.8a", 0x08000, 0xb543675f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7062.5b", 0x08000, 0x9168eb47, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-7054c.1b", 0x08000, 0x4443b744, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-7063.1a", 0x08000, 0x45d8908a, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7065.2a", 0x08000, 0x8c8f8cff, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7064.3a", 0x08000, 0x159f6636, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7066.4a", 0x08000, 0xf5cfa91f, SYS16_ROM_7751DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Mjleague) -STD_ROM_FN(Mjleague) - -static struct BurnRomInfo Passsht16aRomDesc[] = { - { "epr-11833.43", 0x10000, 0x5eb1405c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11832.26", 0x10000, 0x718a3fe4, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11834.95", 0x10000, 0xdf4e18ab, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11835.94", 0x10000, 0x6a07acc0, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11836.93", 0x10000, 0x93c74928, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11842.10", 0x10000, 0xb6e94727, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11845.11", 0x10000, 0x17e8d5d5, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11843.17", 0x10000, 0x3e670098, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11846.18", 0x10000, 0x50eb71cc, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11844.23", 0x10000, 0x05733ca8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11847.24", 0x10000, 0x81e49697, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11837.12", 0x08000, 0x74d11552, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-11838.1", 0x08000, 0xa465cd69, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-11839.2", 0x08000, 0x99de6197, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-11840.4", 0x08000, 0x9854e8b3, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-11841.5", 0x08000, 0x1e89877e, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0071.key", 0x02000, 0xc69949ec, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Passsht16a) -STD_ROM_FN(Passsht16a) - -static struct BurnRomInfo QuartetRomDesc[] = { - { "epr-7458a.9b", 0x08000, 0x42e7b23e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7455a.6b", 0x08000, 0x01631ab2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7459a.10b", 0x08000, 0x6b540637, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7456a.7b", 0x08000, 0x31ca583e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7460.11b", 0x08000, 0xa444ea13, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7457.8b", 0x08000, 0x3b282c23, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-7461.9c", 0x08000, 0xf6af07f2, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7462.10c", 0x08000, 0x7914af28, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7463.11c", 0x08000, 0x827c5603, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-7465.5c", 0x08000, 0x8a1ab7d7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7469.2b", 0x08000, 0xcb65ae4f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7466.6c", 0x08000, 0xb2d3f4f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7470.3b", 0x08000, 0x16fc67b1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7467.7c", 0x08000, 0x0af68de2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7471.4b", 0x08000, 0x13fad5ac, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7468.8c", 0x08000, 0xddfd40c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7472.5b", 0x08000, 0x8e2762ec, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-7464.1b", 0x08000, 0x9f291306, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-7473.1c", 0x08000, 0x06ec75fa, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7475.2c", 0x08000, 0x7abd1206, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7474.3c", 0x08000, 0xdbf853b8, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7476.4c", 0x08000, 0x5eba655a, SYS16_ROM_7751DATA | BRF_SND }, - - { "315-5194.mcu", 0x01000, 0x00000000, BRF_NODUMP }, - - { "pal16r6a.22g", 0x00104, 0x00000000, BRF_NODUMP }, // PLD - { "pal16r6a.23g", 0x00104, 0x00000000, BRF_NODUMP }, // PLD - { "pls153.8j", 0x000eb, 0x0fe1eefd, BRF_OPT }, // PLD -}; - - -STD_ROM_PICK(Quartet) -STD_ROM_FN(Quartet) - -static struct BurnRomInfo QuartetaRomDesc[] = { - { "epr-7458.9b", 0x08000, 0x0096499f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7455.6b", 0x08000, 0xda934390, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7459.10b", 0x08000, 0xd130cf61, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7456.7b", 0x08000, 0x7847149f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7460.11b", 0x08000, 0xa444ea13, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7457.8b", 0x08000, 0x3b282c23, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-7461.9c", 0x08000, 0xf6af07f2, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7462.10c", 0x08000, 0x7914af28, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7463.11c", 0x08000, 0x827c5603, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-7465.5c", 0x08000, 0x8a1ab7d7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7469.2b", 0x08000, 0xcb65ae4f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7466.6c", 0x08000, 0xb2d3f4f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7470.3b", 0x08000, 0x16fc67b1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7467.7c", 0x08000, 0x0af68de2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7471.4b", 0x08000, 0x13fad5ac, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7468.8c", 0x08000, 0xddfd40c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7472.5b", 0x08000, 0x8e2762ec, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-7464.1b", 0x08000, 0x9f291306, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-7473.1c", 0x08000, 0x06ec75fa, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7475.2c", 0x08000, 0x7abd1206, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7474.3c", 0x08000, 0xdbf853b8, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7476.4c", 0x08000, 0x5eba655a, SYS16_ROM_7751DATA | BRF_SND }, - - { "315-5194.mcu", 0x01000, 0x00000000, BRF_NODUMP }, - - { "pal16r6a.22g", 0x00104, 0x00000000, BRF_NODUMP }, // PLD - { "pal16r6a.23g", 0x00104, 0x00000000, BRF_NODUMP }, // PLD - { "pls153.8j", 0x000eb, 0x0fe1eefd, BRF_OPT }, // PLD -}; - - -STD_ROM_PICK(Quarteta) -STD_ROM_FN(Quarteta) - -static struct BurnRomInfo Quartet2RomDesc[] = { - { "epr-7695.b9", 0x08000, 0x67177cd8, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7692.b6", 0x08000, 0x50f50b08, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7696.b10", 0x08000, 0x4273c3b7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7693.b7", 0x08000, 0x0aa337bb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7697.b11", 0x08000, 0x3a6a375d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7694.b8", 0x08000, 0xd87b2ca2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-7698.c9", 0x08000, 0x547a6058, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7699.c10", 0x08000, 0x77ec901d, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7700.c11", 0x08000, 0x7e348cce, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-7465.5c", 0x08000, 0x8a1ab7d7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7469.2b", 0x08000, 0xcb65ae4f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7466.6c", 0x08000, 0xb2d3f4f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7470.3b", 0x08000, 0x16fc67b1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7467.7c", 0x08000, 0x0af68de2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7471.4b", 0x08000, 0x13fad5ac, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7468.8c", 0x08000, 0xddfd40c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7472.5b", 0x08000, 0x8e2762ec, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-7464.1b", 0x08000, 0x9f291306, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-7473.1c", 0x08000, 0x06ec75fa, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7475.2c", 0x08000, 0x7abd1206, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7474.3c", 0x08000, 0xdbf853b8, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7476.4c", 0x08000, 0x5eba655a, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0010.bin", 0x01000, 0x8c2033ea, BRF_PRG | BRF_OPT }, -}; - - -STD_ROM_PICK(Quartet2) -STD_ROM_FN(Quartet2) - -static struct BurnRomInfo Quartet2aRomDesc[] = { - { "epr-7728.b9", 0x08000, 0x56a8c88e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7725.b6", 0x08000, 0xee15fcc9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7729.b10", 0x08000, 0xbc242123, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7726.b7", 0x08000, 0x9d1c48e7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7697.b11", 0x08000, 0x3a6a375d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-7694.b8", 0x08000, 0xd87b2ca2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-7698.c9", 0x08000, 0x547a6058, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7699.c10", 0x08000, 0x77ec901d, SYS16_ROM_TILES | BRF_GRA }, - { "epr-7700.c11", 0x08000, 0x7e348cce, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-7465.5c", 0x08000, 0x8a1ab7d7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7469.2b", 0x08000, 0xcb65ae4f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7466.6c", 0x08000, 0xb2d3f4f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7470.3b", 0x08000, 0x16fc67b1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7467.7c", 0x08000, 0x0af68de2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7471.4b", 0x08000, 0x13fad5ac, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7468.8c", 0x08000, 0xddfd40c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-7472.5b", 0x08000, 0x8e2762ec, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-7464.1b", 0x08000, 0x9f291306, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-7473.1c", 0x08000, 0x06ec75fa, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7475.2c", 0x08000, 0x7abd1206, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7474.3c", 0x08000, 0xdbf853b8, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-7476.4c", 0x08000, 0x5eba655a, SYS16_ROM_7751DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Quartet2a) -STD_ROM_FN(Quartet2a) - -static struct BurnRomInfo SdiRomDesc[] = { - { "epr-10970.43", 0x08000, 0xb8fa4a2c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10968.26", 0x08000, 0xa3f97793, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10971.42", 0x08000, 0xc44a0328, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10969.25", 0x08000, 0x455d15bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10755.41", 0x08000, 0x405e3969, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10752.24", 0x08000, 0x77453740, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10756.95", 0x10000, 0x44d8a506, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10757.94", 0x10000, 0x497e1740, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10758.93", 0x10000, 0x61d61486, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10760.10", 0x10000, 0x30e2c50a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10763.11", 0x10000, 0x794e3e8b, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10761.17", 0x10000, 0x6a8b3fd0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10764.18", 0x10000, 0x602da5d5, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10762.23", 0x10000, 0xb9de3aeb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10765.24", 0x10000, 0x0a73a057, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10759.12", 0x08000, 0xd7f9649f, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0027.key", 0x02000, 0x9a5307b2, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Sdi) -STD_ROM_FN(Sdi) - -static struct BurnRomInfo ShinobiRomDesc[] = { - { "epr-12010.43", 0x10000, 0x7df7f4a2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12008.26", 0x10000, 0xf5ae64cd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12011.42", 0x10000, 0x9d46e707, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12009.25", 0x10000, 0x7961d07e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11264.95", 0x10000, 0x46627e7d, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11265.94", 0x10000, 0x87d0f321, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11266.93", 0x10000, 0xefb4af87, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11290.10", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11294.11", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11291.17", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11295.18", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11292.23", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11296.24", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11293.29", 0x10000, 0x41f41063, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11297.30", 0x10000, 0xb6e1fd72, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11267.12", 0x08000, 0xdd50b745, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-11268.1", 0x08000, 0x6d7966da, SYS16_ROM_7751DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Shinobi) -STD_ROM_FN(Shinobi) - -static struct BurnRomInfo Shinobi1RomDesc[] = { - { "epr-11262.42", 0x10000, 0xd4b8df12, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11260.27", 0x10000, 0x2835c95d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11263.43", 0x10000, 0xa2a620bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11261.25", 0x10000, 0xa3ceda52, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11264.95", 0x10000, 0x46627e7d, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11265.94", 0x10000, 0x87d0f321, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11266.93", 0x10000, 0xefb4af87, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11290.10", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11294.11", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11291.17", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11295.18", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11292.23", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11296.24", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11293.29", 0x10000, 0x41f41063, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11297.30", 0x10000, 0xb6e1fd72, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11267.12", 0x08000, 0xdd50b745, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-11268.1", 0x08000, 0x6d7966da, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0050.key", 0x02000, 0x82c39ced, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Shinobi1) -STD_ROM_FN(Shinobi1) - -static struct BurnRomInfo ShinoblsRomDesc[] = { - { "b3", 0x10000, 0x38e59646, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "b1", 0x10000, 0x8529d192, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "b4", 0x10000, 0xa2a620bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "b2", 0x10000, 0xa3ceda52, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "b5", 0x10000, 0x46627e7d, SYS16_ROM_TILES | BRF_GRA }, - { "b6", 0x10000, 0x87d0f321, SYS16_ROM_TILES | BRF_GRA }, - { "b7", 0x10000, 0xefb4af87, SYS16_ROM_TILES | BRF_GRA }, - - { "b10", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, - { "b14", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, - { "b11", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "b15", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, - { "b12", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, - { "b16", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "b13", 0x10000, 0x7e98bd36, SYS16_ROM_SPRITES | BRF_GRA }, - { "b17", 0x10000, 0x0315cf42, SYS16_ROM_SPRITES | BRF_GRA }, - - { "b8", 0x08000, 0xdd50b745, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "b9", 0x08000, 0x6d7966da, SYS16_ROM_7751DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Shinobls) -STD_ROM_FN(Shinobls) - -static struct BurnRomInfo ShinoblbRomDesc[] = { - { "4.3k", 0x10000, 0xc178a39c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "2.3n", 0x10000, 0x5ad8ebf2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "5.2k", 0x10000, 0xa2a620bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "3.2n", 0x10000, 0xa3ceda52, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "8.3b", 0x10000, 0x46627e7d, SYS16_ROM_TILES | BRF_GRA }, - { "7.4b", 0x10000, 0x87d0f321, SYS16_ROM_TILES | BRF_GRA }, - { "6.5b", 0x10000, 0xefb4af87, SYS16_ROM_TILES | BRF_GRA }, - - { "9.6r", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, - { "13.8r", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, - { "10.6q", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "14.8q", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, - { "11.6p", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, - { "15.8p", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "12.6n", 0x10000, 0x41f41063, SYS16_ROM_SPRITES | BRF_GRA }, - { "16.8n", 0x10000, 0xb6e1fd72, SYS16_ROM_SPRITES | BRF_GRA }, - - { "1.5s", 0x08000, 0xdd50b745, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "b9", 0x08000, 0x6d7966da, SYS16_ROM_7751DATA | BRF_SND }, - - { "17.6u", 0x08000, 0xb7a6890c, BRF_SND | BRF_OPT }, -}; - - -STD_ROM_PICK(Shinoblb) -STD_ROM_FN(Shinoblb) - -static struct BurnRomInfo Sjryuko1RomDesc[] = { - { "epr-12251.43", 0x08000, 0x1af3cd0b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12249.26", 0x08000, 0x743d467d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12252.42", 0x08000, 0x7ae309d6, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12250.25", 0x08000, 0x52c40f19, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "12224-95.b9", 0x08000, 0xeac17ba1, SYS16_ROM_TILES | BRF_GRA }, - { "12225-94.b10", 0x08000, 0x2310fc98, SYS16_ROM_TILES | BRF_GRA }, - { "12226-93.b11", 0x08000, 0x210e6999, SYS16_ROM_TILES | BRF_GRA }, - - { "12232-10.b1", 0x10000, 0x0adec62b, SYS16_ROM_SPRITES | BRF_GRA }, - { "12236-11.b5", 0x10000, 0x286b9af8, SYS16_ROM_SPRITES | BRF_GRA }, - { "12233-17.b2", 0x10000, 0x3e45969c, SYS16_ROM_SPRITES | BRF_GRA }, - { "12237-18.b6", 0x10000, 0xe5058e96, SYS16_ROM_SPRITES | BRF_GRA }, - { "12234-23.b3", 0x10000, 0x8c8d54ef, SYS16_ROM_SPRITES | BRF_GRA }, - { "12238-24.b7", 0x10000, 0x7ada3304, SYS16_ROM_SPRITES | BRF_GRA }, - { "12235-29.b4", 0x10000, 0xfa45d511, SYS16_ROM_SPRITES | BRF_GRA }, - { "12239-30.b8", 0x10000, 0x91f70c8b, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12227.12", 0x08000, 0x5b12409d, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-12228.1", 0x08000, 0x6b2e6aef, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-12229.2", 0x08000, 0xb7aa015c, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-12230.4", 0x08000, 0xd0f61fd4, SYS16_ROM_7751DATA | BRF_SND }, - { "epr-12231.5", 0x08000, 0x780bdc57, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-5021.key", 0x02000, 0x4a3422e4, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Sjryuko1) -STD_ROM_FN(Sjryuko1) - -static struct BurnRomInfo TetrisRomDesc[] = { - { "epr-12201.rom", 0x08000, 0x338e9b51, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12200.rom", 0x08000, 0xfb058779, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12202.rom", 0x10000, 0x2f7da741, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12203.rom", 0x10000, 0xa6e58ec5, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12204.rom", 0x10000, 0x0ae98e23, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-12169.b1", 0x08000, 0xdacc6165, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12170.b5", 0x08000, 0x87354e42, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12205.rom", 0x08000, 0x6695dc99, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0093.key", 0x02000, 0xe0064442, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Tetris) -STD_ROM_FN(Tetris) - -static struct BurnRomInfo Tetris3RomDesc[] = { - { "epr-12201a.43", 0x08000, 0x9250e5cf, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12200a.26", 0x08000, 0x85d4b0ff, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12202.rom", 0x10000, 0x2f7da741, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12203.rom", 0x10000, 0xa6e58ec5, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12204.rom", 0x10000, 0x0ae98e23, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-12169.b1", 0x08000, 0xdacc6165, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12170.b5", 0x08000, 0x87354e42, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12205.rom", 0x08000, 0x6695dc99, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0093a.key", 0x02000, 0x7ca4a8ee, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Tetris3) -STD_ROM_FN(Tetris3) - -static struct BurnRomInfo Timescan1RomDesc[] = { - { "epr-10540a.43", 0x08000, 0x76848b0b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10537a.26", 0x08000, 0x4ddc434a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10541.42", 0x08000, 0xcc6d945e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10538.25", 0x08000, 0x68379473, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10542.41", 0x08000, 0x10217dfa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10539.24", 0x08000, 0x10943b2e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10543.95", 0x08000, 0x07dccc37, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10544.94", 0x08000, 0x84fb9a3a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10545.93", 0x08000, 0xc8694bc0, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10548.10", 0x08000, 0xaa150735, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10552.11", 0x08000, 0x6fcbb9f7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10549.17", 0x08000, 0x2f59f067, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10553.18", 0x08000, 0x8a220a9f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10550.23", 0x08000, 0xf05069ff, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10554.24", 0x08000, 0xdc64f809, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10551.29", 0x08000, 0x435d811f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10555.30", 0x08000, 0x2143c471, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10546.12", 0x08000, 0x1ebee5cc, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, - - { "epr-10547.1", 0x08000, 0xd24ffc4b, SYS16_ROM_7751DATA | BRF_SND }, - - { "317-0024.key", 0x02000, 0xee42ec18, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Timescan1) -STD_ROM_FN(Timescan1) - -static struct BurnRomInfo Wb31RomDesc[] = { - { "epr-12084.bin", 0x10000, 0xb6deb654, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12082.bin", 0x10000, 0x38dc5b15, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12085.bin", 0x10000, 0x0962098b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12083.bin", 0x10000, 0x3d631a8e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12086.bin", 0x10000, 0x45b949df, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12087.bin", 0x10000, 0x6f0396b7, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12088.bin", 0x10000, 0xba8c0749, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12089.bin", 0x08000, 0x8321eb0b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0084.key", 0x02000, 0x2c58dafa, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Wb31) -STD_ROM_FN(Wb31) - -/*==================================================== -Memory Handlers -====================================================*/ - -static bool Mjleague = false; - -void System16APPI0WritePortA(UINT8 data) -{ - System16SoundLatch = data & 0xff; -} - -void System16APPI0WritePortB(UINT8 data) -{ - System16VideoControl = data; - System16VideoEnable = data & 0x10; - if (Mjleague) System16ScreenFlip = data & 0x80; -} - -void System16APPI0WritePortC(UINT8 data) -{ - if (!(data & 0x80)) { - ZetOpen(0); - ZetNmi(); - ZetClose(); - } - System16ColScroll = ~data & 0x04; - System16RowScroll = ~data & 0x02; -} - -UINT16 __fastcall System16AReadWord(UINT32 a) -{ - switch (a) { - case 0xc40000: - case 0xc40002: - case 0xc40004: - case 0xc40006: - case 0xc41000: - case 0xc41002: - case 0xc41004: - case 0xc41006: - case 0xc42000: - case 0xc42002: - case 0xc42004: - case 0xc42006: { - SEK_DEF_READ_WORD(0, a); - } - - case 0xc60000: { - return 0; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Read Word -> 0x%06X\n"), a); -#endif - - return 0xffff; -} - -UINT8 __fastcall System16AReadByte(UINT32 a) -{ - switch (a) { - case 0xc40001: - case 0xc40003: - case 0xc40005: - case 0xc40007: { - return ppi8255_r(0, (a - 0xc40000) >> 1); - } - - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - return 0xff - System16Input[1]; - } - - case 0xc41005: { - return System16Dip[2]; - } - - case 0xc41007: { - return 0xff - System16Input[2]; - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - - case 0xc60000: { - return 0; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); -#endif - - return 0xff; -} - -void __fastcall System16AWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16ATileWordWrite(a - 0x400000, d); - return; - } - - switch (a) { - case 0xc40000: - case 0xc40002: - case 0xc40004: - case 0xc40006: { - SEK_DEF_WRITE_WORD(0, a, d); - return; - } - - case 0xc60000: { - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X\n"), a, d); -#endif -} - -void __fastcall System16AWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16ATileByteWrite((a - 0x400000) ^ 1, d); - return; - } - - switch (a) { - case 0xc40001: - case 0xc40003: - case 0xc40005: - case 0xc40007: { - ppi8255_w(0, (a - 0xc40000) >> 1, d & 0xff); - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); -#endif -} - -static INT16 AceattacaTrack1X = 0; -static INT16 AceattacaTrack1Y = 0; -static INT16 AceattacaTrack2X = 0; -static INT16 AceattacaTrack2Y = 0; -static INT8 AceattacaDial1 = 0; -static INT8 AceattacaDial2 = 0; - -void AceattacaMakeAnalogInputs() -{ - if (System16InputPort3[0]) AceattacaTrack1X += 0x40; - if (System16InputPort3[1]) AceattacaTrack1X -= 0x40; - if (AceattacaTrack1X >= 0x100) AceattacaTrack1X = 0; - if (AceattacaTrack1X < 0) AceattacaTrack1X = 0xfd; - - if (System16InputPort3[2]) AceattacaTrack1Y -= 0x40; - if (System16InputPort3[3]) AceattacaTrack1Y += 0x40; - if (AceattacaTrack1Y >= 0x100) AceattacaTrack1Y = 0; - if (AceattacaTrack1Y < 0) AceattacaTrack1Y = 0xfd; - - if (System16InputPort4[0]) AceattacaDial1 += 0x01; - if (System16InputPort4[1]) AceattacaDial1 -= 0x01; - if (AceattacaDial1 >= 0x10) AceattacaDial1 = 0; - if (AceattacaDial1 < 0) AceattacaDial1 = 0x0f; - - if (System16InputPort3[4]) AceattacaTrack2X += 0x40; - if (System16InputPort3[5]) AceattacaTrack2X -= 0x40; - if (AceattacaTrack2X >= 0x100) AceattacaTrack2X = 0; - if (AceattacaTrack2X < 0) AceattacaTrack2X = 0xfd; - - if (System16InputPort3[6]) AceattacaTrack2Y -= 0x40; - if (System16InputPort3[7]) AceattacaTrack2Y += 0x40; - if (AceattacaTrack2Y >= 0x100) AceattacaTrack2Y = 0; - if (AceattacaTrack2Y < 0) AceattacaTrack2Y = 0xfd; - - if (System16InputPort4[2]) AceattacaDial2 += 0x01; - if (System16InputPort4[3]) AceattacaDial2 -= 0x01; - if (AceattacaDial2 >= 0x10) AceattacaDial2 = 0; - if (AceattacaDial2 < 0) AceattacaDial2 = 0x0f; -} - -UINT8 __fastcall AceattacaReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - if (System16VideoControl == 0x10) return 0xff - System16Input[1]; - if (System16VideoControl == 0x14) return AceattacaTrack1X; - if (System16VideoControl == 0x18) return AceattacaTrack1Y; - if (System16VideoControl == 0x1c) return System16Input[2]; - return 0xff; - } - - case 0xc41005: { - return AceattacaDial1 | (AceattacaDial2 << 4); - } - - case 0xc41007: { - if (System16VideoControl == 0x10) return 0xff - System16Input[5]; - if (System16VideoControl == 0x14) return AceattacaTrack2X; - if (System16VideoControl == 0x18) return AceattacaTrack2Y; - if (System16VideoControl == 0x1c) return System16Input[6]; - return 0xff; - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - - case 0xc60000: { - return 0; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); -#endif - - return 0xff; -} - -static INT16 MjleagueTrack1X = 0; -static INT16 MjleagueTrack1Y = 0; -static INT16 MjleagueTrack2X = 0; -static INT16 MjleagueTrack2Y = 0; -static INT16 MjleagueBat1 = 0; -static INT16 MjleagueBat2 = 0; - -void MjleagueMakeAnalogInputs() -{ - if (System16InputPort3[0]) MjleagueTrack1X -= 0x04; - if (System16InputPort3[1]) MjleagueTrack1X += 0x04; - if (MjleagueTrack1X >= 0x100) MjleagueTrack1X = 0; - if (MjleagueTrack1X < 0) MjleagueTrack1X = 0xfc; - - if (System16InputPort3[2]) MjleagueTrack1Y -= 0x04; - if (System16InputPort3[3]) MjleagueTrack1Y += 0x04; - if (MjleagueTrack1Y >= 0x100) MjleagueTrack1Y = 0; - if (MjleagueTrack1Y < 0) MjleagueTrack1Y = 0xfc; - - if (System16InputPort3[4]) MjleagueTrack2X -= 0x04; - if (System16InputPort3[5]) MjleagueTrack2X += 0x04; - if (MjleagueTrack2X >= 0x100) MjleagueTrack2X = 0; - if (MjleagueTrack2X < 0) MjleagueTrack2X = 0xfc; - - if (System16InputPort3[6]) MjleagueTrack2Y -= 0x04; - if (System16InputPort3[7]) MjleagueTrack2Y += 0x04; - if (MjleagueTrack2Y >= 0x100) MjleagueTrack2Y = 0; - if (MjleagueTrack2Y < 0) MjleagueTrack2Y = 0xfc; - - MjleagueBat1 = 0x80 + (System16AnalogPort0 >> 4); - MjleagueBat2 = 0x80 + (System16AnalogPort1 >> 4); -} - -UINT8 __fastcall MjleagueReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - UINT8 buttons = 0x3f - System16Input[0]; - UINT8 analog1 = (System16VideoControl & 4) ? MjleagueTrack1Y : MjleagueTrack1X; - UINT8 analog2 = (System16VideoControl & 4) ? MjleagueTrack2Y : MjleagueTrack2X; - - buttons |= (analog1 & 0x80) >> 1; - buttons |= (analog2 & 0x80); - - return buttons; - } - - case 0xc41003: { - UINT8 analog = (System16VideoControl & 4) ? MjleagueTrack1Y : MjleagueTrack1X; - return ((0xff - System16Input[1]) & 0x80) | (analog & 0x7f); - } - - case 0xc41005: { - if (System16VideoControl & 4) { - return (MjleagueBat1 >> 4) | (MjleagueBat2 & 0xf0); - } else { - static UINT8 last_buttons1 = 0; - static UINT8 last_buttons2 = 0; - UINT8 buttons1 = 0xff - System16Input[1]; - UINT8 buttons2 = 0xff - System16Input[2]; - - if (!(buttons1 & 0x01)) - last_buttons1 = 0; - else if (!(buttons1 & 0x02)) - last_buttons1 = 1; - else if (!(buttons1 & 0x04)) - last_buttons1 = 2; - else if (!(buttons1 & 0x08)) - last_buttons1 = 3; - - if (!(buttons2 & 0x01)) - last_buttons2 = 0; - else if (!(buttons2 & 0x02)) - last_buttons2 = 1; - else if (!(buttons2 & 0x04)) - last_buttons2 = 2; - else if (!(buttons2 & 0x08)) - last_buttons2 = 3; - - return last_buttons1 | (last_buttons2 << 4); - } - } - - case 0xc41007: { - UINT8 analog = (System16VideoControl & 4) ? MjleagueTrack2Y : MjleagueTrack2X; - return ((0xff - System16Input[2]) & 0x80) | (analog & 0x7f); - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - } - - return 0xff; -} - -UINT8 __fastcall Passsht16aReadByte(UINT32 a) -{ - static INT32 PortNum = 0; - - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - switch ((PortNum++) & 3) { - case 0: return 0xff - System16Input[1]; - case 1: return 0xff - System16Input[2]; - case 2: return 0xff - System16Input[3]; - case 3: return 0xff - System16Input[4]; - } - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - - case 0xc60000: { - return 0; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); -#endif - - return 0xff; -} - -UINT8 __fastcall QuartetReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - return 0xff - System16Input[1]; - } - - case 0xc41005: { - return 0xff - System16Input[2]; - } - - case 0xc41007: { - return 0xff - System16Input[3]; - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - - case 0xc60000: { - return 0; - } - } - - return 0xff; -} - -static INT16 SdiTrack1X = 0; -static INT16 SdiTrack1Y = 0; -static INT16 SdiTrack2X = 0; -static INT16 SdiTrack2Y = 0; - -void SdiMakeAnalogInputs() -{ - SdiTrack1X += (System16AnalogPort0 >> 8) & 0xff; - SdiTrack1Y -= (System16AnalogPort1 >> 8) & 0xff; - - SdiTrack2X += (System16AnalogPort2 >> 8) & 0xff; - SdiTrack2Y -= (System16AnalogPort3 >> 8) & 0xff; -} - -UINT8 __fastcall SdiReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - return (System16VideoControl & 4) ? SdiTrack1Y : SdiTrack1X; - } - - case 0xc41005: { - return 0xff - System16Input[1]; - } - - case 0xc41007: { - return (System16VideoControl & 4) ? SdiTrack2Y : SdiTrack2X; - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - - case 0xc60000: { - return 0xff; - } - } - - return 0xff; -} - -static UINT8 MahjongInputNum; - -UINT16 __fastcall Sjryuko1ReadWord(UINT32 a) -{ - SEK_DEF_READ_WORD(0, a); - - return 0xffff; -} - -UINT8 __fastcall Sjryuko1ReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - if (System16Input[MahjongInputNum + 1] != 0xff) return 0xff & ~(1 << MahjongInputNum); - return 0xff; - } - - case 0xc41005: { - return 0xff - System16Input[MahjongInputNum + 1]; - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - } - - return 0xff; -} - -void __fastcall Sjryuko1WriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16ATileByteWrite((a - 0x400000) ^ 1, d); - return; - } - - switch (a) { - case 0xc40001: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetNmi(); - ZetClose(); - return; - } - - case 0xc40003: { - if ((System16VideoControl ^ d) & 0xc) { - if (((System16VideoControl ^ d) & 4) && (d & 4)) MahjongInputNum = (MahjongInputNum + 1) % 6; - } - System16VideoControl = d; - System16VideoEnable = d & 0x10; - return; - } - } -} - -/*==================================================== -Driver Inits -====================================================*/ - -static INT32 AceattacaInit() -{ - System16MakeAnalogInputsDo = AceattacaMakeAnalogInputs; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, AceattacaReadByte); - SekClose(); - - // Handle different sprite rom layout - UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); - if (pTemp) { - memcpy(pTemp, System16Sprites, System16SpriteRomSize); - memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); - memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); - memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); - memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); - memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); - memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); - memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); - memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 AceattacaExit() -{ - AceattacaTrack1X = 0; - AceattacaTrack1Y = 0; - AceattacaTrack2X = 0; - AceattacaTrack2Y = 0; - AceattacaDial1 = 0; - AceattacaDial2 = 0; - - return System16Exit(); -} - -static INT32 AceattacaScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029660; - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(AceattacaTrack1X); - SCAN_VAR(AceattacaTrack1Y); - SCAN_VAR(AceattacaTrack2X); - SCAN_VAR(AceattacaTrack2Y); - SCAN_VAR(AceattacaDial1); - SCAN_VAR(AceattacaDial2); - } - - return System16Scan(nAction, pnMin);; -} - -static INT32 AliensynjoInit() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - // Handle different sprite rom layout - UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); - if (pTemp) { - memcpy(pTemp, System16Sprites, System16SpriteRomSize); - memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); - memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); - memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); - memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); - memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); - memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); - memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); - memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Aliensyn5Init() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - // Handle different sprite rom layout - UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); - if (pTemp) { - memcpy(pTemp, System16Sprites, System16SpriteRomSize); - memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); - memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); - memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); - memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); - memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); - memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); - memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); - memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -void Bodyslam_Sim8751() -{ - UINT8 flag = ((System16Ram[0x200 + 1] << 8) | System16Ram[0x200 + 0]) >> 8; - UINT8 tick = ((System16Ram[0x200 + 1] << 8) | System16Ram[0x200 + 0]) & 0xff; - UINT8 sec = ((System16Ram[0x202 + 1] << 8) | System16Ram[0x202 + 0]) >> 8; - UINT8 min = ((System16Ram[0x202 + 1] << 8) | System16Ram[0x202 + 0]) & 0xff; - - /* out of time? set the flag */ - if (tick == 0 && sec == 0 && min == 0) - flag = 1; - else - { - if (tick != 0) - tick--; - else - { - /* the game counts 64 ticks per second */ - tick = 0x40; - - /* seconds are counted in BCD */ - if (sec != 0) - sec = (sec & 0xf) ? sec - 1 : (sec - 0x10) + 9; - else - { - sec = 0x59; - - /* minutes are counted normally */ - if (min != 0) - min--; - else - { - flag = 1; - tick = sec = min = 0; - } - } - } - } - - *((UINT16*)(System16Ram + 0x200)) = BURN_ENDIAN_SWAP_INT16((flag << 8) + tick); - *((UINT16*)(System16Ram + 0x202)) = BURN_ENDIAN_SWAP_INT16((sec << 8) + min); -} - -static INT32 BodyslamInit() -{ - Simulate8751 = Bodyslam_Sim8751; - - return System16Init(); -} - -static void SegaDecode2(const UINT8 xor_table[128],const int swap_table[128]) -{ - INT32 A; - static const UINT8 swaptable[24][4] = - { - { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 }, - { 6,2,4,0 }, { 6,0,2,4 }, { 6,4,0,2 }, { 2,6,4,0 }, - { 4,2,6,0 }, { 4,6,0,2 }, { 6,0,4,2 }, { 0,6,4,2 }, - { 4,0,6,2 }, { 0,4,6,2 }, { 6,2,0,4 }, { 2,6,0,4 }, - { 0,6,2,4 }, { 2,0,6,4 }, { 0,2,6,4 }, { 4,2,0,6 }, - { 2,4,0,6 }, { 4,0,2,6 }, { 2,0,4,6 }, { 0,2,4,6 }, - }; - - UINT8 *rom = System16Z80Rom; - UINT8 *decrypted = System16Z80Code; - - for (A = 0x0000;A < 0x8000;A++) - { - INT32 row; - UINT8 src; - const UINT8 *tbl; - - - src = rom[A]; - - /* pick the translation table from bits 0, 3, 6, 9, 12 and 14 of the address */ - row = (A & 1) + (((A >> 3) & 1) << 1) + (((A >> 6) & 1) << 2) - + (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5); - - /* decode the opcodes */ - tbl = swaptable[swap_table[2*row]]; - decrypted[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row]; - - /* decode the data */ - tbl = swaptable[swap_table[2*row+1]]; - rom[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row+1]; - } -} - -static INT32 FantzonepDecryptZ80() -{ - System16Z80Code = (UINT8*)BurnMalloc(0x8000); - - static const UINT8 xor_table[128] = - { - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14, - - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14, - }; - - static const INT32 swap_table[128] = - { - 0,0,0,0, - 1,1,1,1,1, - 2,2,2,2,2, - 3,3,3,3, - 4,4,4,4,4, - 5,5,5,5,5, - 6,6,6,6,6, - 7,7,7,7,7, - 8,8,8,8, - 9,9,9,9,9, - 10,10,10,10,10, - 11,11,11,11,11, - 12,12,12,12,12, - 13,13, - - 8,8,8,8, - 9,9,9,9,9, - 10,10,10,10,10, - 11,11,11,11, - 12,12,12,12,12, - 13,13,13,13,13, - 14,14,14,14,14, - 15,15,15,15,15, - 16,16,16,16, - 17,17,17,17,17, - 18,18,18,18,18, - 19,19,19,19,19, - 20,20,20,20,20, - 21,21, - }; - - SegaDecode2(xor_table, swap_table); - - return 0; -} - -static void FantzonepMapZ80() -{ - ZetMapArea(0x0000, 0x7fff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0x7fff, 2, System16Z80Code, System16Z80Rom); - - ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); - ZetMemEnd(); - - ZetSetInHandler(System16PPIZ80PortRead); - ZetSetOutHandler(System16Z80PortWrite); -} - -static INT32 FantzonepInit() -{ - System16CustomLoadRomDo = FantzonepDecryptZ80; - System16MapZ80Do = FantzonepMapZ80; - - return System16Init(); -} - -static INT32 FantzonepExit() -{ - BurnFree(System16Z80Code); - - return System16Exit(); -} - -static INT32 MjleagueInit() -{ - System16MakeAnalogInputsDo = MjleagueMakeAnalogInputs; - - Mjleague = true; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, MjleagueReadByte); - SekClose(); - } - - return nRet; -} - -static INT32 MjleagueExit() -{ - MjleagueTrack1X = 0; - MjleagueTrack1Y = 0; - MjleagueTrack2X = 0; - MjleagueTrack2Y = 0; - MjleagueBat1 = 0; - MjleagueBat2 = 0; - - Mjleague = false; - - return System16Exit(); -} - -static INT32 MjleagueScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029660; - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(MjleagueTrack1X); - SCAN_VAR(MjleagueTrack1Y); - SCAN_VAR(MjleagueTrack2X); - SCAN_VAR(MjleagueTrack2Y); - SCAN_VAR(MjleagueBat1); - SCAN_VAR(MjleagueBat2); - } - - return System16Scan(nAction, pnMin);; -} - -void Quartet_Sim8751() -{ - // X-Scroll Values - *((UINT16*)(System16TextRam + 0xff8)) = BURN_ENDIAN_SWAP_INT16(((System16Ram[0x0d14 + 1] << 8) | System16Ram[0x0d14 + 0])); - *((UINT16*)(System16TextRam + 0xffa)) = BURN_ENDIAN_SWAP_INT16(((System16Ram[0x0d18 + 1] << 8) | System16Ram[0x0d18 + 0])); - - // Page Values - *((UINT16*)(System16TextRam + 0xe9e)) = BURN_ENDIAN_SWAP_INT16(((System16Ram[0x0d1c + 1] << 8) | System16Ram[0x0d1c + 0])); - *((UINT16*)(System16TextRam + 0xe9c)) = BURN_ENDIAN_SWAP_INT16(((System16Ram[0x0d1e + 1] << 8) | System16Ram[0x0d1e + 0])); -} - -static INT32 Passsht16aInit() -{ - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x70000 - 0x60000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, Passsht16aReadByte); - SekClose(); - - // Handle different sprite rom layout - UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); - if (pTemp) { - memcpy(pTemp, System16Sprites, System16SpriteRomSize); - memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); - memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); - memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); - memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); - memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); - memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 QuartetInit() -{ - Simulate8751 = Quartet_Sim8751; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, QuartetReadByte); - SekClose(); - } - - return nRet; -} - -static INT32 SdiInit() -{ - System16MakeAnalogInputsDo = SdiMakeAnalogInputs; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x70000 - 0x60000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, SdiReadByte); - SekClose(); - - // Handle different sprite rom layout - UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); - if (pTemp) { - memcpy(pTemp, System16Sprites, System16SpriteRomSize); - memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); - memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); - memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); - memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); - memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); - memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 SdiExit() -{ - SdiTrack1X = 0; - SdiTrack1Y = 0; - SdiTrack2X = 0; - SdiTrack2Y = 0; - - return System16Exit(); -} - -static INT32 SdiScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029660; - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(SdiTrack1X); - SCAN_VAR(SdiTrack1Y); - SCAN_VAR(SdiTrack2X); - SCAN_VAR(SdiTrack2Y); - } - - return System16Scan(nAction, pnMin);; -} - -static INT32 ShinobiInit() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - // Handle different sprite rom layout - UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); - if (pTemp) { - memcpy(pTemp, System16Sprites, System16SpriteRomSize); - memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); - memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); - memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); - memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); - memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); - memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); - memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); - memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Sjryuko1Init() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetWriteByteHandler(0, Sjryuko1WriteByte); - SekSetReadByteHandler(0, Sjryuko1ReadByte); - SekSetReadWordHandler(0, Sjryuko1ReadWord); - SekClose(); - - // Handle different sprite rom layout - UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); - if (pTemp) { - memcpy(pTemp, System16Sprites, System16SpriteRomSize); - memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); - memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); - memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); - memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); - memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); - memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); - memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); - memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Sjryuko1Exit() -{ - MahjongInputNum = 0; - - return System16Exit(); -} - -static INT32 Sjryuko1Scan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029660; - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(MahjongInputNum); - } - - return System16Scan(nAction, pnMin);; -} - -static INT32 Wb31Init() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - // Handle different sprite rom layout - UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); - if (pTemp) { - memcpy(pTemp, System16Sprites, System16SpriteRomSize); - memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); - memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); - memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); - memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); - memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); - memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); - memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); - memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -/*==================================================== -Driver defs -====================================================*/ - -struct BurnDriver BurnDrvAceattaca = { - "aceattaca", "aceattac", NULL, NULL, "1986", - "Ace Attacker (Japan, System 16A, FD1094 317-0060)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_SPORTSMISC, 0, - NULL, AceattacaRomInfo, AceattacaRomName, NULL, NULL, AceattacaInputInfo, AceattacaDIPInfo, - AceattacaInit, AceattacaExit, System16AFrame, NULL, AceattacaScan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvAFighter = { - "afighter", NULL, NULL, NULL, "1986", - "Action Fighter, FD1089A 317-0018\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089A_ENC, GBF_RACING, 0, - NULL, AfighterRomInfo, AfighterRomName, NULL, NULL, System16aInputInfo, AfighterDIPInfo, - System16Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvAlexkidd = { - "alexkidd", NULL, NULL, NULL, "1986", - "Alex Kidd: The Lost Stars (set 2, unprotected)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, - NULL, AlexkiddRomInfo, AlexkiddRomName, NULL, NULL, System16aInputInfo, AlexkiddDIPInfo, - System16Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAlexkidd1 = { - "alexkidd1", "alexkidd", NULL, NULL, "1986", - "Alex Kidd: The Lost Stars (set 1, FD1089A 317-unknown)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089A_ENC, GBF_PLATFORM, 0, - NULL, Alexkidd1RomInfo, Alexkidd1RomName, NULL, NULL, System16aInputInfo, AlexkiddDIPInfo, - System16Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAliensynjo = { - "aliensynjo", "aliensyn", NULL, NULL, "1987", - "Alien Syndrome (set 1, Japan, old, System 16A, FD1089A 317-0033)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089A_ENC, GBF_MAZE, 0, - NULL, AliensynjoRomInfo, AliensynjoRomName, NULL, NULL, System16afire1InputInfo, AliensynDIPInfo, - AliensynjoInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAliensyn2 = { - "aliensyn2", "aliensyn", NULL, NULL, "1987", - "Alien Syndrome (set 2, System 16A, FD1089A 317-0033)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089A_ENC, GBF_MAZE, 0, - NULL, Aliensyn2RomInfo, Aliensyn2RomName, NULL, NULL, System16afire1InputInfo, AliensynDIPInfo, - AliensynjoInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAliensyn5 = { - "aliensyn5", "aliensyn", NULL, NULL, "1987", - "Alien Syndrome (set 5, System 16A, FD1089B 317-0037)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089B_ENC, GBF_MAZE, 0, - NULL, Aliensyn5RomInfo, Aliensyn5RomName, NULL, NULL, System16afire1InputInfo, AliensynDIPInfo, - Aliensyn5Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBodyslam = { - "bodyslam", NULL, NULL, NULL, "1986", - "Body Slam (8751 317-0015)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A, GBF_VSFIGHT, 0, - NULL, BodyslamRomInfo, BodyslamRomName, NULL, NULL, System16aInputInfo, BodyslamDIPInfo, - BodyslamInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDumpmtmt = { - "dumpmtmt", "bodyslam", NULL, NULL, "1986", - "Dump Matsumoto (Japan, 8751 317-unknown)\0", NULL, "Sega", "System 16A", - L"Dump Matsumoto (Japan, 8751 317-unknown)\0\u30C0\u30F3\u30D7\u677E\u672C\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A, GBF_VSFIGHT, 0, - NULL, DumpmtmtRomInfo, DumpmtmtRomName, NULL, NULL, System16aInputInfo, BodyslamDIPInfo, - BodyslamInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFantzone = { - "fantzone", NULL, NULL, NULL, "1986", - "Fantasy Zone (Rev A, unprotected)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A, GBF_HORSHOOT, 0, - NULL, FantzoneRomInfo, FantzoneRomName, NULL, NULL, System16aInputInfo, FantzoneDIPInfo, - System16Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFantzone1 = { - "fantzone1", "fantzone", NULL, NULL, "1986", - "Fantasy Zone (unprotected)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A, GBF_HORSHOOT, 0, - NULL, Fantzone1RomInfo, Fantzone1RomName, NULL, NULL, System16aInputInfo, FantzoneDIPInfo, - System16Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFantzonep = { - "fantzonep", "fantzone", NULL, NULL, "1986", - "Fantasy Zone (317-5000)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A, GBF_HORSHOOT, 0, - NULL, FantzonepRomInfo, FantzonepRomName, NULL, NULL, System16aInputInfo, FantzoneDIPInfo, - FantzonepInit, FantzonepExit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMjleague = { - "mjleague", NULL, NULL, NULL, "1985", - "Major League\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16A, GBF_SPORTSMISC, 0, - NULL, MjleagueRomInfo, MjleagueRomName, NULL, NULL, MjleagueInputInfo, MjleagueDIPInfo, - MjleagueInit, MjleagueExit, System16AFrame, NULL, MjleagueScan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvPasssht16a = { - "passsht16a", "passsht", NULL, NULL, "1988", - "Passing Shot (Japan, 4 Players, System 16A, FD1094 317-0071)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 4, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_SPORTSMISC, 0, - NULL, Passsht16aRomInfo, Passsht16aRomName, NULL, NULL, Passsht16aInputInfo, Passsht16aDIPInfo, - Passsht16aInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvQuartet = { - "quartet", NULL, NULL, NULL, "1986", - "Quartet (Rev A, 8751 317-unknown)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, - NULL, QuartetRomInfo, QuartetRomName, NULL, NULL, QuartetInputInfo, QuartetDIPInfo, - QuartetInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQuarteta = { - "quarteta", "quartet", NULL, NULL, "1986", - "Quartet (8751 315-5194)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, - NULL, QuartetaRomInfo, QuartetaRomName, NULL, NULL, QuartetInputInfo, QuartetDIPInfo, - QuartetInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQuartet2 = { - "quartet2", "quartet", NULL, NULL, "1986", - "Quartet 2 (8751 317-0010)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, - NULL, Quartet2RomInfo, Quartet2RomName, NULL, NULL, System16aInputInfo, Quart2DIPInfo, - QuartetInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQuartet2a = { - "quartet2a", "quartet", NULL, NULL, "1986", - "Quartet 2 (unprotected)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, - NULL, Quartet2aRomInfo, Quartet2aRomName, NULL, NULL, System16aInputInfo, Quart2DIPInfo, - System16Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSdi = { - "sdi", NULL, NULL, NULL, "1987", - "SDI - Strategic Defense Initiative (Japan, old, System 16A, FD1089B 317-0027)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089B_ENC, GBF_SHOOT, 0, - NULL, SdiRomInfo, SdiRomName, NULL, NULL, SdiInputInfo, SdiDIPInfo, - SdiInit, SdiExit, System16AFrame, NULL, SdiScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvShinobi = { - "shinobi", NULL, NULL, NULL, "1987", - "Shinobi (set 6, System 16A, unprotected)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, - NULL, ShinobiRomInfo, ShinobiRomName, NULL, NULL, System16afire3InputInfo, ShinobiDIPInfo, - ShinobiInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvShinobi1 = { - "shinobi1", "shinobi", NULL, NULL, "1987", - "Shinobi (set 1, System 16A, FD1094 317-0050)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, Shinobi1RomInfo, Shinobi1RomName, NULL, NULL, System16afire3InputInfo, ShinobiDIPInfo, - ShinobiInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvShinobls = { - "shinobls", "shinobi", NULL, NULL, "1987", - "Shinobi (Star bootleg, System 16A)\0", NULL, "bootleg", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, - NULL, ShinoblsRomInfo, ShinoblsRomName, NULL, NULL, System16afire3InputInfo, ShinobiDIPInfo, - ShinobiInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvShinoblb = { - "shinoblb", "shinobi", NULL, NULL, "1987", - "Shinobi (beta bootleg, System 16A)\0", NULL, "bootleg", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, - NULL, ShinoblbRomInfo, ShinoblbRomName, NULL, NULL, System16afire3InputInfo, ShinobiDIPInfo, - ShinobiInit, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSjryuko1 = { - "sjryuko1", "sjryuko", NULL, NULL, "1987", - "Sukeban Jansi Ryuko (set 1, System 16A, FD1089B 317-5021)\0", NULL, "White Board", "System 16A", - L"Sukeban Jansi Ryuko (set 1, System 16A, FD1089B 317-5021)\0\u30B9\u30B1\u30D0\u30F3\u96C0\u58EB \u7ADC\u5B50\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089B_ENC, GBF_MAHJONG, 0, - NULL, Sjryuko1RomInfo, Sjryuko1RomName, NULL, NULL, Sjryuko1InputInfo, Sjryuko1DIPInfo, - Sjryuko1Init, Sjryuko1Exit, System16AFrame, NULL, Sjryuko1Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTetris = { - "tetris", NULL, NULL, NULL, "1988", - "Tetris (set 4, Japan, System 16A, FD1094 317-0093)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, - NULL, TetrisRomInfo, TetrisRomName, NULL, NULL, System16afire1InputInfo, TetrisDIPInfo, - System16Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTetris3 = { - "tetris3", "tetris", NULL, NULL, "1988", - "Tetris (set 3, Japan, System 16A, FD1094 317-0093a)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, - NULL, Tetris3RomInfo, Tetris3RomName, NULL, NULL, System16afire1InputInfo, TetrisDIPInfo, - System16Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTimescan1 = { - "timescan1", "timescan", NULL, NULL, "1987", - "Time Scanner (set 1, System 16A, FD1089B 317-0024)\0", NULL, "Sega", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089B_ENC, GBF_PINBALL, 0, - NULL, Timescan1RomInfo, Timescan1RomName, NULL, NULL, System16aDip3InputInfo, TimescanDIPInfo, - System16Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvWb31 = { - "wb31", "wb3", NULL, NULL, "1988", - "Wonder Boy III - Monster Lair (set 1, System 16A, FD1094 317-0084)\0", NULL, "Sega / Westone", "System 16A", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, Wb31RomInfo, Wb31RomName, NULL, NULL, System16aInputInfo, Wb31DIPInfo, - Wb31Init, System16Exit, System16AFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; +#include "sys16.h" + +/*==================================================== +Input defs +====================================================*/ + +#define A(a, b, c, d) {a, b, (UINT8*)(c), d} + +static struct BurnInputInfo System16aInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 2" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(System16a) + +static struct BurnInputInfo System16afire1InputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(System16afire1) + +static struct BurnInputInfo System16afire3InputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 3" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(System16afire3) + +static struct BurnInputInfo System16aDip3InputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 2" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, System16Dip + 2 , "dip" }, +}; + +STDINPUTINFO(System16aDip3) + +static struct BurnInputInfo AceattacaInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort3 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort3 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort3 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort3 + 1, "p1 right" }, + {"P1 Dial Left" , BIT_DIGITAL , System16InputPort4 + 0, "p1 fire 14"}, + {"P1 Dial Right" , BIT_DIGITAL , System16InputPort4 + 1, "p1 fire 15"}, + {"P1 Block" , BIT_DIGITAL , System16InputPort0 + 6, "p1 fire 1" }, + {"P1 Select" , BIT_DIGITAL , System16InputPort1 + 4, "p1 fire 2" }, + {"P1 Attack Dir0" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 3" }, + {"P1 Attack Dir1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 4" }, + {"P1 Attack Dir2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 5" }, + {"P1 Attack Dir3" , BIT_DIGITAL , System16InputPort1 + 3, "p1 fire 6" }, + {"P1 Attack Dir4" , BIT_DIGITAL , System16InputPort1 + 4, "p1 fire 7" }, + {"P1 Attack Dir5" , BIT_DIGITAL , System16InputPort1 + 5, "p1 fire 8" }, + {"P1 Attack Dir6" , BIT_DIGITAL , System16InputPort1 + 6, "p1 fire 9" }, + {"P1 Attack Dir7" , BIT_DIGITAL , System16InputPort1 + 7, "p1 fire 10"}, + {"P1 Attack Pow0" , BIT_DIGITAL , System16InputPort2 + 4, "p1 fire 11"}, + {"P1 Attack Pow1" , BIT_DIGITAL , System16InputPort2 + 5, "p1 fire 12"}, + {"P1 Attack Pow2" , BIT_DIGITAL , System16InputPort2 + 6, "p1 fire 13"}, + + {"P2 Up" , BIT_DIGITAL , System16InputPort3 + 6, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort3 + 7, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort3 + 4, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort3 + 5, "p2 right" }, + {"P2 Dial Left" , BIT_DIGITAL , System16InputPort4 + 2, "p2 fire 14"}, + {"P2 Dial Right" , BIT_DIGITAL , System16InputPort4 + 3, "p2 fire 15"}, + {"P2 Block" , BIT_DIGITAL , System16InputPort0 + 7, "p2 fire 1" }, + {"P2 Select" , BIT_DIGITAL , System16InputPort5 + 4, "p2 fire 2" }, + {"P2 Attack Dir0" , BIT_DIGITAL , System16InputPort5 + 0, "p2 fire 3" }, + {"P2 Attack Dir1" , BIT_DIGITAL , System16InputPort5 + 1, "p2 fire 4" }, + {"P2 Attack Dir2" , BIT_DIGITAL , System16InputPort5 + 2, "p2 fire 5" }, + {"P2 Attack Dir3" , BIT_DIGITAL , System16InputPort5 + 3, "p2 fire 6" }, + {"P2 Attack Dir4" , BIT_DIGITAL , System16InputPort5 + 4, "p2 fire 7" }, + {"P2 Attack Dir5" , BIT_DIGITAL , System16InputPort5 + 5, "p2 fire 8" }, + {"P2 Attack Dir6" , BIT_DIGITAL , System16InputPort5 + 6, "p2 fire 9" }, + {"P2 Attack Dir7" , BIT_DIGITAL , System16InputPort5 + 7, "p2 fire 10"}, + {"P2 Attack Pow0" , BIT_DIGITAL , System16InputPort6 + 4, "p2 fire 11"}, + {"P2 Attack Pow1" , BIT_DIGITAL , System16InputPort6 + 5, "p2 fire 12"}, + {"P2 Attack Pow2" , BIT_DIGITAL , System16InputPort6 + 6, "p2 fire 13"}, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Aceattaca) + +static struct BurnInputInfo MjleagueInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort3 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort3 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort3 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort3 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 7, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 4" }, + {"P1 Fire 5" , BIT_DIGITAL , System16InputPort1 + 3, "p1 fire 5" }, + A("P1 Bat Swing" , BIT_ANALOG_REL, &System16AnalogPort0, "p1 z-axis" ), + + {"P1 Up" , BIT_DIGITAL , System16InputPort3 + 6, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort3 + 7, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort3 + 4, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort3 + 5, "p1 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 7, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 0, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 4" }, + {"P2 Fire 5" , BIT_DIGITAL , System16InputPort2 + 3, "p2 fire 5" }, + A("P2 Bat Swing" , BIT_ANALOG_REL, &System16AnalogPort1, "p2 z-axis" ), + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Mjleague) + +static struct BurnInputInfo Passsht16aInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + {"Start 3" , BIT_DIGITAL , System16InputPort0 + 6, "p3 start" }, + {"Start 4" , BIT_DIGITAL , System16InputPort0 + 7, "p4 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 1, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 0, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 3, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 2, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 6, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , System16InputPort1 + 7, "p1 fire 4" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 1, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 0, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 3, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 2, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 6, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , System16InputPort2 + 7, "p2 fire 4" }, + + {"P3 Up" , BIT_DIGITAL , System16InputPort3 + 1, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , System16InputPort3 + 0, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , System16InputPort3 + 3, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , System16InputPort3 + 2, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , System16InputPort3 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , System16InputPort3 + 5, "p3 fire 2" }, + {"P3 Fire 3" , BIT_DIGITAL , System16InputPort3 + 6, "p3 fire 3" }, + {"P3 Fire 4" , BIT_DIGITAL , System16InputPort3 + 7, "p3 fire 4" }, + + {"P4 Up" , BIT_DIGITAL , System16InputPort4 + 1, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , System16InputPort4 + 0, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , System16InputPort4 + 3, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , System16InputPort4 + 2, "p4 right" }, + {"P4 Fire 1" , BIT_DIGITAL , System16InputPort4 + 4, "p4 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , System16InputPort4 + 5, "p4 fire 2" }, + {"P4 Fire 3" , BIT_DIGITAL , System16InputPort4 + 6, "p4 fire 3" }, + {"P4 Fire 4" , BIT_DIGITAL , System16InputPort4 + 7, "p4 fire 4" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Passsht16a) + +static struct BurnInputInfo QuartetInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 6, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort1 + 6, "p2 coin" }, + {"Coin 3" , BIT_DIGITAL , System16InputPort2 + 6, "p3 coin" }, + {"Coin 4" , BIT_DIGITAL , System16InputPort3 + 6, "p4 coin" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort0 + 1, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort0 + 0, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort0 + 3, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort0 + 2, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort1 + 1, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort1 + 0, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort1 + 3, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort1 + 2, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort1 + 5, "p2 fire 2" }, + + {"P3 Up" , BIT_DIGITAL , System16InputPort2 + 1, "p1 up" }, + {"P3 Down" , BIT_DIGITAL , System16InputPort2 + 0, "p1 down" }, + {"P3 Left" , BIT_DIGITAL , System16InputPort2 + 3, "p1 left" }, + {"P3 Right" , BIT_DIGITAL , System16InputPort2 + 2, "p1 right" }, + {"P3 Fire 1" , BIT_DIGITAL , System16InputPort2 + 4, "p1 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , System16InputPort2 + 5, "p1 fire 2" }, + + {"P4 Up" , BIT_DIGITAL , System16InputPort3 + 1, "p2 up" }, + {"P4 Down" , BIT_DIGITAL , System16InputPort3 + 0, "p2 down" }, + {"P4 Left" , BIT_DIGITAL , System16InputPort3 + 3, "p2 left" }, + {"P4 Right" , BIT_DIGITAL , System16InputPort3 + 2, "p2 right" }, + {"P4 Fire 1" , BIT_DIGITAL , System16InputPort3 + 4, "p2 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , System16InputPort3 + 5, "p2 fire 2" }, + + {"Service 1" , BIT_DIGITAL , System16InputPort0 + 7 , "service" }, + {"Service 2" , BIT_DIGITAL , System16InputPort1 + 7 , "service2" }, + {"Service 3" , BIT_DIGITAL , System16InputPort2 + 7 , "service3" }, + {"Service 4" , BIT_DIGITAL , System16InputPort3 + 7 , "service4" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Quartet) + +static struct BurnInputInfo SdiInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 1, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 0, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 3, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 2, "p1 right" }, + A("Target Left/Right", BIT_ANALOG_REL, &System16AnalogPort0, "mouse x-axis" ), + A("Target Up/Down" , BIT_ANALOG_REL, &System16AnalogPort1, "mouse y-axis" ), + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort0 + 6, "mouse button 1"}, + + {"P2 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p2 right" }, + A("Target Left/Right", BIT_ANALOG_REL, &System16AnalogPort2, "p2 x-axis" ), + A("Target Up/Down" , BIT_ANALOG_REL, &System16AnalogPort3, "p2 y-axis" ), + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort0 + 7, "p2 fire 1" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Sdi) + +static struct BurnInputInfo Sjryuko1InputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + + {"Mahjong A" , BIT_DIGITAL , System16InputPort1 + 0, "mah a" }, + {"Mahjong B" , BIT_DIGITAL , System16InputPort1 + 1, "mah b" }, + {"Mahjong C" , BIT_DIGITAL , System16InputPort1 + 2, "mah c" }, + {"Mahjong D" , BIT_DIGITAL , System16InputPort1 + 3, "mah d" }, + {"Mahjong E" , BIT_DIGITAL , System16InputPort2 + 0, "mah e" }, + {"Mahjong F" , BIT_DIGITAL , System16InputPort2 + 1, "mah f" }, + {"Mahjong G" , BIT_DIGITAL , System16InputPort2 + 2, "mah g" }, + {"Mahjong H" , BIT_DIGITAL , System16InputPort2 + 3, "mah h" }, + {"Mahjong I" , BIT_DIGITAL , System16InputPort3 + 0, "mah i" }, + {"Mahjong J" , BIT_DIGITAL , System16InputPort3 + 1, "mah j" }, + {"Mahjong K" , BIT_DIGITAL , System16InputPort3 + 2, "mah k" }, + {"Mahjong L" , BIT_DIGITAL , System16InputPort3 + 3, "mah l" }, + {"Mahjong M" , BIT_DIGITAL , System16InputPort4 + 0, "mah m" }, + {"Mahjong N" , BIT_DIGITAL , System16InputPort4 + 1, "mah n" }, + {"Mahjong Kan" , BIT_DIGITAL , System16InputPort6 + 0, "mah kan" }, + {"Mahjong Pon" , BIT_DIGITAL , System16InputPort4 + 3, "mah pon" }, + {"Mahjong Chi" , BIT_DIGITAL , System16InputPort4 + 2, "mah chi" }, + {"Mahjong Reach" , BIT_DIGITAL , System16InputPort6 + 1, "mah reach" }, + {"Mahjong Ron" , BIT_DIGITAL , System16InputPort6 + 2, "mah ron" }, + {"Mahjong Bet" , BIT_DIGITAL , System16InputPort5 + 1, "mah bet" }, + {"Mahjong Last Chance", BIT_DIGITAL , System16InputPort1 + 4, "mah lc" }, + {"Mahjong Score" , BIT_DIGITAL , System16InputPort5 + 0, "mah score" }, + {"Mahjong Flip Flop" , BIT_DIGITAL , System16InputPort4 + 4, "mah ff" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Sjryuko1) + +#undef A + +/*==================================================== +Dip defs +====================================================*/ + +#define SYSTEM16A_COINAGE(dipval) \ + {0 , 0xfe, 0 , 16 , "Coin A" }, \ + {dipval, 0x01, 0x0f, 0x07, "4 Coins 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x08, "3 Coins 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x09, "2 Coins 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x05, "2 Coins 1 Credit 5/3 6/4" }, \ + {dipval, 0x01, 0x0f, 0x04, "2 Coins 1 Credit 4/3" }, \ + {dipval, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x01, "1 Coin 1 Credit 2/3" }, \ + {dipval, 0x01, 0x0f, 0x02, "1 Coin 1 Credit 4/5" }, \ + {dipval, 0x01, 0x0f, 0x03, "1 Coin 1 Credit 5/6" }, \ + {dipval, 0x01, 0x0f, 0x06, "2 Coins 3 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, \ + {dipval, 0x01, 0x0f, 0x00, "Free Play (if coin B too) or 1C/1C" }, \ + \ + {0 , 0xfe, 0 , 16 , "Coin B" }, \ + {dipval, 0x01, 0xf0, 0x70, "4 Coins 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x80, "3 Coins 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x90, "2 Coins 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x50, "2 Coins 1 Credit 5/3 6/4" }, \ + {dipval, 0x01, 0xf0, 0x40, "2 Coins 1 Credit 4/3" }, \ + {dipval, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x10, "1 Coin 1 Credit 2/3" }, \ + {dipval, 0x01, 0xf0, 0x20, "1 Coin 1 Credit 4/5" }, \ + {dipval, 0x01, 0xf0, 0x30, "1 Coin 1 Credit 5/6" }, \ + {dipval, 0x01, 0xf0, 0x60, "2 Coins 3 Credits" }, \ + {dipval, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, \ + {dipval, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, \ + {dipval, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, \ + {dipval, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, \ + {dipval, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, \ + {dipval, 0x01, 0xf0, 0x00, "Free Play (if coin A too) or 1C/1C" }, + +static struct BurnDIPInfo AceattacaDIPList[]= +{ + // Default Values + {0x2d, 0xff, 0xff, 0xff, NULL }, + {0x2e, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x2d) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x2e, 0x01, 0x01, 0x01, "Off" }, + {0x2e, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Starting Points" }, + {0x2e, 0x01, 0x0e, 0x06, "2000" }, + {0x2e, 0x01, 0x0e, 0x0a, "3000" }, + {0x2e, 0x01, 0x0e, 0x0c, "4000" }, + {0x2e, 0x01, 0x0e, 0x0e, "5000" }, + {0x2e, 0x01, 0x0e, 0x08, "6000" }, + {0x2e, 0x01, 0x0e, 0x04, "7000" }, + {0x2e, 0x01, 0x0e, 0x02, "8000" }, + {0x2e, 0x01, 0x0e, 0x00, "9000" }, +}; + +STDDIPINFO(Aceattaca) + +static struct BurnDIPInfo AfighterDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x08, "2" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x04, "4" }, + {0x14, 0x01, 0x0c, 0x00, "Infinite" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x30, "10000 - 20000" }, + {0x14, 0x01, 0x30, 0x20, "20000 - 40000" }, + {0x14, 0x01, 0x30, 0x10, "30000 - 60000" }, + {0x14, 0x01, 0x30, 0x00, "40000 - 80000" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x40, 0x40, "Normal" }, + {0x14, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x80, 0x00, "No" }, + {0x14, 0x01, 0x80, 0x80, "Yes" }, +}; + +STDDIPINFO(Afighter) + +static struct BurnDIPInfo AlexkiddDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Continues" }, + {0x14, 0x01, 0x01, 0x01, "Only before level 5" }, + {0x14, 0x01, 0x01, 0x00, "Unlimited" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + {0x14, 0x01, 0x0c, 0x00, "240" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x30, 0x20, "10000" }, + {0x14, 0x01, 0x30, 0x30, "20000" }, + {0x14, 0x01, 0x30, 0x10, "40000" }, + {0x14, 0x01, 0x30, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Timer Adjust" }, + {0x14, 0x01, 0xc0, 0x80, "70" }, + {0x14, 0x01, 0xc0, 0xc0, "60" }, + {0x14, 0x01, 0xc0, 0x40, "50" }, + {0x14, 0x01, 0xc0, 0x00, "40" }, +}; + +STDDIPINFO(Alexkidd) + +static struct BurnDIPInfo AliensynDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x11) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x02, "Off" }, + {0x12, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x0c, 0x08, "2" }, + {0x12, 0x01, 0x0c, 0x0c, "3" }, + {0x12, 0x01, 0x0c, 0x04, "4" }, + {0x12, 0x01, 0x0c, 0x00, "127" }, + + {0 , 0xfe, 0 , 4 , "Timer" }, + {0x12, 0x01, 0x30, 0x00, "150" }, + {0x12, 0x01, 0x30, 0x10, "160" }, + {0x12, 0x01, 0x30, 0x20, "170" }, + {0x12, 0x01, 0x30, 0x30, "180" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0xc0, 0x80, "Easy" }, + {0x12, 0x01, 0xc0, 0xc0, "Normal" }, + {0x12, 0x01, 0xc0, 0x40, "Hard" }, + {0x12, 0x01, 0xc0, 0x00, "Hardest" }, +}; + +STDDIPINFO(Aliensyn) + +static struct BurnDIPInfo BodyslamDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, +}; + +STDDIPINFO(Bodyslam) + +static struct BurnDIPInfo FantzoneDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Upright" }, + {0x14, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x08, "2" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x04, "4" }, + {0x14, 0x01, 0x0c, 0x00, "240" }, + + {0 , 0xfe, 0 , 4 , "Extra Ship Cost" }, + {0x14, 0x01, 0x30, 0x30, "5000" }, + {0x14, 0x01, 0x30, 0x20, "10000" }, + {0x14, 0x01, 0x30, 0x10, "15000" }, + {0x14, 0x01, 0x30, 0x00, "20000" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0xc0, 0x80, "Easy" }, + {0x14, 0x01, 0xc0, 0xc0, "Normal" }, + {0x14, 0x01, 0xc0, 0x40, "Hard" }, + {0x14, 0x01, 0xc0, 0x00, "Hardest" }, +}; + +STDDIPINFO(Fantzone) + +static struct BurnDIPInfo MjleagueDIPList[]= +{ + // Default Values + {0x1b, 0xff, 0xff, 0xff, NULL }, + {0x1c, 0xff, 0xff, 0xf0, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x1b) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x1c, 0x01, 0x01, 0x00, "Upright" }, + {0x1c, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x1c, 0x01, 0x02, 0x02, "Off" }, + {0x1c, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Starting Points" }, + {0x1c, 0x01, 0x0c, 0x0c, "2000" }, + {0x1c, 0x01, 0x0c, 0x08, "3000" }, + {0x1c, 0x01, 0x0c, 0x04, "5000" }, + {0x1c, 0x01, 0x0c, 0x00, "10000" }, + + {0 , 0xfe, 0 , 2 , "Team Select" }, + {0x1c, 0x01, 0x10, 0x02, "Off" }, + {0x1c, 0x01, 0x10, 0x10, "On" }, +}; + +STDDIPINFO(Mjleague) + +static struct BurnDIPInfo Passsht16aDIPList[]= +{ + // Default Values + {0x29, 0xff, 0xff, 0xff, NULL }, + {0x2a, 0xff, 0xff, 0xf0, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x29) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x2a, 0x01, 0x01, 0x01, "Off" }, + {0x2a, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Initial Point" }, + {0x2a, 0x01, 0x0e, 0x06, "2000" }, + {0x2a, 0x01, 0x0e, 0x0a, "3000" }, + {0x2a, 0x01, 0x0e, 0x0c, "4000" }, + {0x2a, 0x01, 0x0e, 0x0e, "5000" }, + {0x2a, 0x01, 0x0e, 0x08, "6000" }, + {0x2a, 0x01, 0x0e, 0x04, "7000" }, + {0x2a, 0x01, 0x0e, 0x02, "8000" }, + {0x2a, 0x01, 0x0e, 0x00, "9000" }, + + {0 , 0xfe, 0 , 4 , "Point Table" }, + {0x2a, 0x01, 0x30, 0x20, "Easy" }, + {0x2a, 0x01, 0x30, 0x30, "Normal" }, + {0x2a, 0x01, 0x30, 0x10, "Hard" }, + {0x2a, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x2a, 0x01, 0xc0, 0x80, "Easy" }, + {0x2a, 0x01, 0xc0, 0xc0, "Normal" }, + {0x2a, 0x01, 0xc0, 0x40, "Hard" }, + {0x2a, 0x01, 0xc0, 0x00, "Hardest" }, +}; + +STDDIPINFO(Passsht16a) + +static struct BurnDIPInfo QuartetDIPList[]= +{ + // Default Values + {0x21, 0xff, 0xff, 0xff, NULL }, + {0x22, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x21) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x22, 0x01, 0x01, 0x01, "Off" }, + {0x22, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Credit Power" }, + {0x22, 0x01, 0x06, 0x04, "500" }, + {0x22, 0x01, 0x06, 0x06, "1000" }, + {0x22, 0x01, 0x06, 0x02, "2000" }, + {0x22, 0x01, 0x06, 0x00, "9000" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x22, 0x01, 0x18, 0x10, "Easy" }, + {0x22, 0x01, 0x18, 0x18, "Normal" }, + {0x22, 0x01, 0x18, 0x08, "Hard" }, + {0x22, 0x01, 0x18, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Coin During Game" }, + {0x22, 0x01, 0x20, 0x20, "Power" }, + {0x22, 0x01, 0x20, 0x00, "Credit" }, + + {0 , 0xfe, 0 , 2 , "Free Play" }, + {0x22, 0x01, 0x40, 0x40, "Off" }, + {0x22, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x22, 0x01, 0x80, 0x80, "Off" }, + {0x22, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Quartet) + +static struct BurnDIPInfo Quart2DIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x01, 0x01, "Off" }, + {0x14, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Credit Power" }, + {0x14, 0x01, 0x06, 0x04, "500" }, + {0x14, 0x01, 0x06, 0x06, "1000" }, + {0x14, 0x01, 0x06, 0x02, "2000" }, + {0x14, 0x01, 0x06, 0x00, "9000" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x18, 0x10, "Easy" }, + {0x14, 0x01, 0x18, 0x18, "Normal" }, + {0x14, 0x01, 0x18, 0x08, "Hard" }, + {0x14, 0x01, 0x18, 0x00, "Hardest" }, +}; + +STDDIPINFO(Quart2) + +static struct BurnDIPInfo SdiDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x15) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x01, 0x01, "No" }, + {0x16, 0x01, 0x01, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x16, 0x01, 0x02, 0x02, "Off" }, + {0x16, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x0c, 0x08, "2" }, + {0x16, 0x01, 0x0c, 0x0c, "3" }, + {0x16, 0x01, 0x0c, 0x04, "4" }, + {0x16, 0x01, 0x0c, 0x00, "Free" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x30, 0x20, "Easy" }, + {0x16, 0x01, 0x30, 0x30, "Normal" }, + {0x16, 0x01, 0x30, 0x10, "Hard" }, + {0x16, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x16, 0x01, 0xc0, 0x80, "Every 50000" }, + {0x16, 0x01, 0xc0, 0xc0, "50000" }, + {0x16, 0x01, 0xc0, 0x40, "100000" }, + {0x16, 0x01, 0xc0, 0x00, "None" }, +}; + +STDDIPINFO(Sdi) + +static struct BurnDIPInfo ShinobiDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x15) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x16, 0x01, 0x01, 0x00, "Upright" }, + {0x16, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x16, 0x01, 0x02, 0x02, "Off" }, + {0x16, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x0c, 0x08, "2" }, + {0x16, 0x01, 0x0c, 0x0c, "3" }, + {0x16, 0x01, 0x0c, 0x04, "5" }, + {0x16, 0x01, 0x0c, 0x00, "240" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x30, 0x20, "Easy" }, + {0x16, 0x01, 0x30, 0x30, "Normal" }, + {0x16, 0x01, 0x30, 0x10, "Hard" }, + {0x16, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Enemy Bullet Speed" }, + {0x16, 0x01, 0x40, 0x40, "Slow" }, + {0x16, 0x01, 0x40, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x16, 0x01, 0x80, 0x80, "Japanese" }, + {0x16, 0x01, 0x80, 0x00, "English" }, +}; + +STDDIPINFO(Shinobi) + +static struct BurnDIPInfo Sjryuko1DIPList[]= +{ + // Default Values + {0x1c, 0xff, 0xff, 0xff, NULL }, + {0x1d, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x1c) + + // Dip 2 +}; + +STDDIPINFO(Sjryuko1) + +static struct BurnDIPInfo TetrisDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xfd, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x11) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x02, 0x02, "Off" }, + {0x12, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x30, 0x20, "Easy" }, + {0x12, 0x01, 0x30, 0x30, "Normal" }, + {0x12, 0x01, 0x30, 0x10, "Hard" }, + {0x12, 0x01, 0x30, 0x00, "Hardest" }, +}; + +STDDIPINFO(Tetris) + +static struct BurnDIPInfo TimescanDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xf5, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x14, 0x01, 0x01, 0x00, "Cocktail" }, + {0x14, 0x01, 0x01, 0x01, "Upright" }, + + {0 , 0xfe, 0 , 16 , "Bonus" }, + {0x14, 0x01, 0x1e, 0x16, "Replay 1000000/2000000" }, + {0x14, 0x01, 0x1e, 0x14, "Replay 1200000/2500000" }, + {0x14, 0x01, 0x1e, 0x12, "Replay 1500000/3000000" }, + {0x14, 0x01, 0x1e, 0x10, "Replay 2000000/4000000" }, + {0x14, 0x01, 0x1e, 0x1c, "Replay 1000000" }, + {0x14, 0x01, 0x1e, 0x1e, "Replay 1200000" }, + {0x14, 0x01, 0x1e, 0x1a, "Replay 1500000" }, + {0x14, 0x01, 0x1e, 0x18, "Replay 1800000" }, + {0x14, 0x01, 0x1e, 0x0e, "Extra Ball 100000" }, + {0x14, 0x01, 0x1e, 0x0c, "Extra Ball 200000" }, + {0x14, 0x01, 0x1e, 0x0a, "Extra Ball 300000" }, + {0x14, 0x01, 0x1e, 0x08, "Extra Ball 400000" }, + {0x14, 0x01, 0x1e, 0x06, "Extra Ball 500000" }, + {0x14, 0x01, 0x1e, 0x04, "Extra Ball 600000" }, + {0x14, 0x01, 0x1e, 0x02, "Extra Ball 700000" }, + {0x14, 0x01, 0x1e, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Match" }, + {0x14, 0x01, 0x20, 0x00, "Off" }, + {0x14, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Pin Rebound" }, + {0x14, 0x01, 0x40, 0x40, "Well" }, + {0x14, 0x01, 0x40, 0x00, "A Little" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x14, 0x01, 0x80, 0x80, "3" }, + {0x14, 0x01, 0x80, 0x00, "5" }, + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Out Lane Pin" }, + {0x15, 0x01, 0x02, 0x02, "Near" }, + {0x15, 0x01, 0x02, 0x00, "Far" }, + + {0 , 0xfe, 0 , 4 , "Special" }, + {0x15, 0x01, 0x0c, 0x08, "7 Credits" }, + {0x15, 0x01, 0x0c, 0x0c, "3 Credits" }, + {0x15, 0x01, 0x0c, 0x04, "1 Credit" }, + {0x15, 0x01, 0x0c, 0x00, "2000000 Points" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x10, 0x00, "No" }, + {0x15, 0x01, 0x10, 0x10, "Yes" }, +}; + +STDDIPINFO(Timescan) + +static struct BurnDIPInfo Wb31DIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + // Dip 1 + SYSTEM16A_COINAGE(0x13) + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x0c, 0x00, "2" }, + {0x14, 0x01, 0x0c, 0x0c, "3" }, + {0x14, 0x01, 0x0c, 0x08, "4" }, + {0x14, 0x01, 0x0c, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x14, 0x01, 0x10, 0x10, "5k, 10k, 18k, 30k" }, + {0x14, 0x01, 0x10, 0x00, "5k, 15k, 30k" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x14, 0x01, 0x20, 0x20, "Normal" }, + {0x14, 0x01, 0x20, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Invincible Mode" }, + {0x14, 0x01, 0x40, 0x40, "No" }, + {0x14, 0x01, 0x40, 0x00, "Yes" }, +}; + +STDDIPINFO(Wb31) + +#undef SYSTEM16A_COINAGE + +/*==================================================== +Rom defs +====================================================*/ + +static struct BurnRomInfo AceattacaRomDesc[] = { + { "epr-11573.43", 0x10000, 0xca116367, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11571.26", 0x10000, 0x5631d1d6, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11574.42", 0x10000, 0x8d3ed7bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11572.25", 0x10000, 0x35c27c25, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11575.95", 0x10000, 0xbab9fbf3, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11576.94", 0x10000, 0x067ed682, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11577.93", 0x10000, 0xf67cf331, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11501.10", 0x10000, 0x09179ead, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11505.11", 0x10000, 0xb67f1ecf, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11502.17", 0x10000, 0x7464bae4, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11506.18", 0x10000, 0xb0104def, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11503.23", 0x10000, 0x344c0692, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11507.24", 0x10000, 0xa2af710a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11504.29", 0x10000, 0x42b4a5f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11508.30", 0x10000, 0x5cbb833c, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11578.12", 0x08000, 0x3d58e39a, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-11579.1", 0x08000, 0x1a994135, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-11580.2", 0x08000, 0x961646ed, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-11581.4", 0x08000, 0xd271a6e5, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-11582.5", 0x08000, 0xbcbe3d8a, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0060.key", 0x02000, 0xf4ee940f, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Aceattaca) +STD_ROM_FN(Aceattaca) + +static struct BurnRomInfo AfighterRomDesc[] = { + { "epr-10353", 0x08000, 0x5a757dc9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10350", 0x08000, 0xf2cd6b3f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10352", 0x08000, 0xf8abb143, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10349", 0x08000, 0x4b434c37, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10351", 0x08000, 0xede21d8d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10348", 0x08000, 0xe51e3012, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10281.95", 0x10000, 0x30e92cda, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10282.94", 0x10000, 0xb67b8910, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10283.93", 0x10000, 0xe7dbfd2d, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10285", 0x08000, 0x98aa3d04, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10289", 0x08000, 0xc59d1b98, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10286", 0x08000, 0x8da050cf, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10290", 0x08000, 0x39354223, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10287", 0x08000, 0x7989b74a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10291", 0x08000, 0x6e4b245c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10288", 0x08000, 0xd3ce551a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10292", 0x08000, 0xcef289a3, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10284.12", 0x08000, 0x8ff09116, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0018.key", 0x02000, 0xfee04be8, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Afighter) +STD_ROM_FN(Afighter) + +static struct BurnRomInfo AlexkiddRomDesc[] = { + { "epr-10447.43", 0x10000, 0x29e87f71, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10445.26", 0x10000, 0x25ce5b6f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10448.42", 0x10000, 0x05baedb5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10446.25", 0x10000, 0xcd61d23c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10431.95", 0x08000, 0xa7962c39, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10432.94", 0x08000, 0xdb8cd24e, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10433.93", 0x08000, 0xe163c8c2, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10437.10", 0x08000, 0x522f7618, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10441.11", 0x08000, 0x74e3a35c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10438.17", 0x08000, 0x738a6362, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10442.18", 0x08000, 0x86cb9c14, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10439.23", 0x08000, 0xb391aca7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10443.24", 0x08000, 0x95d32635, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10440.29", 0x08000, 0x23939508, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10444.30", 0x08000, 0x82115823, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10434.12", 0x08000, 0x77141cce, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-10435.1", 0x08000, 0xad89f6e3, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-10436.2", 0x08000, 0x96c76613, SYS16_ROM_7751DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Alexkidd) +STD_ROM_FN(Alexkidd) + +static struct BurnRomInfo Alexkidd1RomDesc[] = { + { "epr-10429.43", 0x10000, 0xbdf49eca, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10427.26", 0x10000, 0xf6e3dd29, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10430.42", 0x10000, 0x89e3439f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10428.25", 0x10000, 0xdbed3210, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10431.95", 0x08000, 0xa7962c39, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10432.94", 0x08000, 0xdb8cd24e, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10433.93", 0x08000, 0xe163c8c2, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10437.10", 0x08000, 0x522f7618, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10441.11", 0x08000, 0x74e3a35c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10438.17", 0x08000, 0x738a6362, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10442.18", 0x08000, 0x86cb9c14, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10439.23", 0x08000, 0xb391aca7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10443.24", 0x08000, 0x95d32635, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10440.29", 0x08000, 0x23939508, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10444.30", 0x08000, 0x82115823, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10434.12", 0x08000, 0x77141cce, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-10435.1", 0x08000, 0xad89f6e3, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-10436.2", 0x08000, 0x96c76613, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0021.key", 0x02000, 0x85be8eac, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Alexkidd1) +STD_ROM_FN(Alexkidd1) + +static struct BurnRomInfo AliensynjoRomDesc[] = { + { "epr-10699.43", 0x08000, 0x3fd38d17, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10696.26", 0x08000, 0xd734f19f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10700.42", 0x08000, 0x3b04b252, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10697.25", 0x08000, 0xf2bc123d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10701.41", 0x08000, 0x92171751, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10698.24", 0x08000, 0xc1e4fdc0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10739.95", 0x10000, 0xa29ec207, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10740.94", 0x10000, 0x47f93015, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10741.93", 0x10000, 0x4970739c, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10709.10", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10713.11", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10710.17", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10714.18", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10711.23", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10715.24", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10712.29", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10716.30", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10705.12", 0x08000, 0x777b749e, SYS16_ROM_Z80PROG | BRF_ESS |BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-10706.1", 0x08000, 0xaa114acc, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-10707.2", 0x08000, 0x800c1d82, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-10708.4", 0x08000, 0x5921ef52, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0033.key", 0x02000, 0x49e882e5, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Aliensynjo) +STD_ROM_FN(Aliensynjo) + +static struct BurnRomInfo Aliensyn2RomDesc[] = { + { "epr-10808", 0x08000, 0xe669929f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10806", 0x08000, 0x9f7f8fdd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10809", 0x08000, 0x9a424919, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10807", 0x08000, 0x3d2c3530, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10701", 0x08000, 0x92171751, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10698", 0x08000, 0xc1e4fdc0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "10739", 0x10000, 0xa29ec207, SYS16_ROM_TILES | BRF_GRA }, + { "10740", 0x10000, 0x47f93015, SYS16_ROM_TILES | BRF_GRA }, + { "10741", 0x10000, 0x4970739c, SYS16_ROM_TILES | BRF_GRA }, + + { "10709.b1", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, + { "10713.b5", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, + { "10710.b2", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, + { "10714.b6", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, + { "10711.b3", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, + { "10715.b7", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, + { "10712.b4", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, + { "10716.b8", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, + + { "10705", 0x08000, 0x777b749e, SYS16_ROM_Z80PROG | BRF_ESS |BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "10706", 0x08000, 0xaa114acc, SYS16_ROM_7751DATA | BRF_SND }, + { "10707", 0x08000, 0x800c1d82, SYS16_ROM_7751DATA | BRF_SND }, + { "10708", 0x08000, 0x5921ef52, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0033.key", 0x02000, 0x49e882e5, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Aliensyn2) +STD_ROM_FN(Aliensyn2) + +static struct BurnRomInfo Aliensyn5RomDesc[] = { + { "epr-10804.43", 0x08000, 0x23f78b83, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10802.26", 0x08000, 0x996768bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10805.42", 0x08000, 0x53d7fe50, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10803.25", 0x08000, 0x0536dd33, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10732.41", 0x08000, 0xc5712bfc, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10729.24", 0x08000, 0x3e520e30, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10739.95", 0x10000, 0xa29ec207, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10740.94", 0x10000, 0x47f93015, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10741.93", 0x10000, 0x4970739c, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10709.10", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10713.11", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10710.17", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10714.18", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10711.23", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10715.24", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10712.29", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10716.30", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10705.12", 0x08000, 0x777b749e, SYS16_ROM_Z80PROG | BRF_ESS |BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-10706.1", 0x08000, 0xaa114acc, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-10707.2", 0x08000, 0x800c1d82, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-10708.4", 0x08000, 0x5921ef52, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0037.key", 0x02000, 0x49e882e5, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Aliensyn5) +STD_ROM_FN(Aliensyn5) + +static struct BurnRomInfo BodyslamRomDesc[] = { + { "epr-10066.b9", 0x08000, 0x6cd53290, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10063.b6", 0x08000, 0xdd849a16, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10067.b10", 0x08000, 0xdb22a5ce, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10064.b7", 0x08000, 0x53d6b7e0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10068.b11", 0x08000, 0x15ccc665, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10065.b8", 0x08000, 0x0e5fa314, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10321.c9", 0x08000, 0xcd3e7cba, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10322.c10", 0x08000, 0xb53d3217, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10323.c11", 0x08000, 0x915a3e61, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10012.c5", 0x08000, 0x990824e8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10016.b2", 0x08000, 0xaf5dc72f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10013.c6", 0x08000, 0x9a0919c5, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10017.b3", 0x08000, 0x62aafd95, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10027.c7", 0x08000, 0x3f1c57c7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10028.b4", 0x08000, 0x80d4946d, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10015.c8", 0x08000, 0x582d3b6a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10019.b5", 0x08000, 0xe020c38b, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10026.b1", 0x08000, 0x123b69b8, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-10029.c1", 0x08000, 0x7e4aca83, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-10030.c2", 0x08000, 0xdcc1df0b, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-10031.c3", 0x08000, 0xea3c4472, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-10032.c4", 0x08000, 0x0aabebce, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0015.bin", 0x01000, 0x833869e2, BRF_PRG | BRF_OPT }, +}; + + +STD_ROM_PICK(Bodyslam) +STD_ROM_FN(Bodyslam) + +static struct BurnRomInfo DumpmtmtRomDesc[] = { + { "epr-7704a.b9", 0x08000, 0x96de6c7b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7701a.b6", 0x08000, 0x786d1009, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7705a.b10", 0x08000, 0xfc584391, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7702a.b7", 0x08000, 0x2241a8fd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7706a.b11", 0x08000, 0x6bbcc9d0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7703a.b8", 0x08000, 0xfcb0cd40, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-7707a.c9", 0x08000, 0x45318738, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7708a.c10", 0x08000, 0x411be9a4, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7709a.c11", 0x08000, 0x74ceb5a8, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-7715.c5", 0x08000, 0xbf47e040, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7719.b2", 0x08000, 0xfa5c5d6c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10013.c6", 0x08000, 0x9a0919c5, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10017.b3", 0x08000, 0x62aafd95, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7717.c7", 0x08000, 0xfa64c86d, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7721.b4", 0x08000, 0x62a9143e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10015.c8", 0x08000, 0x582d3b6a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10019.b5", 0x08000, 0xe020c38b, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-7710a.b1", 0x08000, 0xa19b8ba8, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-7711.c1", 0x08000, 0xefa9aabd, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7712.c2", 0x08000, 0x7bcd85cf, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7713.c3", 0x08000, 0x33f292e7, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7714.c4", 0x08000, 0x8fd48c47, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0011a.mcu", 0x01000, 0x00000000, BRF_NODUMP }, +}; + + +STD_ROM_PICK(Dumpmtmt) +STD_ROM_FN(Dumpmtmt) + +static struct BurnRomInfo FantzoneRomDesc[] = { + { "epr-7385a.43", 0x08000, 0x4091af42, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7382a.26", 0x08000, 0x77d67bfd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7386a.42", 0x08000, 0xb0a67cd0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7383a.25", 0x08000, 0x5f79b2a9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7387.41", 0x08000, 0x0acd335d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7384.24", 0x08000, 0xfd909341, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-7388.95", 0x08000, 0x8eb02f6b, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7389.94", 0x08000, 0x2f4f71b8, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7390.93", 0x08000, 0xd90609c6, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-7392.10", 0x08000, 0x5bb7c8b6, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7396.11", 0x08000, 0x74ae4b57, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7393.17", 0x08000, 0x14fc7e82, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7397.18", 0x08000, 0xe05a1e25, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7394.23", 0x08000, 0x531ca13f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7398.24", 0x08000, 0x68807b49, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-7535a.12", 0x08000, 0xbc1374fa, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Fantzone) +STD_ROM_FN(Fantzone) + +static struct BurnRomInfo Fantzone1RomDesc[] = { + { "epr-7385.43", 0x08000, 0x5cb64450, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7382.26", 0x08000, 0x3fda7416, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7386.42", 0x08000, 0x15810ace, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7383.25", 0x08000, 0xa001e10a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7387.41", 0x08000, 0x0acd335d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7384.24", 0x08000, 0xfd909341, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-7388.95", 0x08000, 0x8eb02f6b, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7389.94", 0x08000, 0x2f4f71b8, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7390.93", 0x08000, 0xd90609c6, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-7392.10", 0x08000, 0x5bb7c8b6, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7396.11", 0x08000, 0x74ae4b57, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7393.17", 0x08000, 0x14fc7e82, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7397.18", 0x08000, 0xe05a1e25, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7394.23", 0x08000, 0x531ca13f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7398.24", 0x08000, 0x68807b49, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-7535.12", 0x08000, 0x0cb2126a, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Fantzone1) +STD_ROM_FN(Fantzone1) + +static struct BurnRomInfo FantzonepRomDesc[] = { + { "epr-7385.43", 0x08000, 0x5cb64450, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7382.26", 0x08000, 0x3fda7416, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7386.42", 0x08000, 0x15810ace, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7383.25", 0x08000, 0xa001e10a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7387.41", 0x08000, 0x0acd335d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7384.24", 0x08000, 0xfd909341, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-7388.95", 0x08000, 0x8eb02f6b, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7389.94", 0x08000, 0x2f4f71b8, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7390.93", 0x08000, 0xd90609c6, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-7392.10", 0x08000, 0x5bb7c8b6, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7396.11", 0x08000, 0x74ae4b57, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7393.17", 0x08000, 0x14fc7e82, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7397.18", 0x08000, 0xe05a1e25, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7394.23", 0x08000, 0x531ca13f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7398.24", 0x08000, 0x68807b49, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-7391.12", 0x08000, 0xc03e155e, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Fantzonep) +STD_ROM_FN(Fantzonep) + +static struct BurnRomInfo MjleagueRomDesc[] = { + { "epr-7404.9b", 0x08000, 0xec1655b5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7401.6b", 0x08000, 0x2befa5e0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7405.10b", 0x08000, 0x7a4f4e38, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7402.7b", 0x08000, 0xb7bef762, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7406a.11b", 0x08000, 0xbb743639, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7403a.8b", 0x08000, 0x0a39a4d0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-7051.9a", 0x08000, 0x10ca255a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7052.10a", 0x08000, 0x2550db0e, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7053.11a", 0x08000, 0x5bfea038, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-7055.5a", 0x08000, 0x1fb860bd, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7059.2b", 0x08000, 0x3d14091d, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7056.6a", 0x08000, 0xb35dd968, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7060.3b", 0x08000, 0x61bb3757, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7057.7a", 0x08000, 0x3e5a2b6f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7061.4b", 0x08000, 0xc808dad5, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7058.8a", 0x08000, 0xb543675f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7062.5b", 0x08000, 0x9168eb47, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-7054c.1b", 0x08000, 0x4443b744, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-7063.1a", 0x08000, 0x45d8908a, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7065.2a", 0x08000, 0x8c8f8cff, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7064.3a", 0x08000, 0x159f6636, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7066.4a", 0x08000, 0xf5cfa91f, SYS16_ROM_7751DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Mjleague) +STD_ROM_FN(Mjleague) + +static struct BurnRomInfo Passsht16aRomDesc[] = { + { "epr-11833.43", 0x10000, 0x5eb1405c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11832.26", 0x10000, 0x718a3fe4, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11834.95", 0x10000, 0xdf4e18ab, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11835.94", 0x10000, 0x6a07acc0, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11836.93", 0x10000, 0x93c74928, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11842.10", 0x10000, 0xb6e94727, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11845.11", 0x10000, 0x17e8d5d5, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11843.17", 0x10000, 0x3e670098, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11846.18", 0x10000, 0x50eb71cc, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11844.23", 0x10000, 0x05733ca8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11847.24", 0x10000, 0x81e49697, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11837.12", 0x08000, 0x74d11552, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-11838.1", 0x08000, 0xa465cd69, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-11839.2", 0x08000, 0x99de6197, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-11840.4", 0x08000, 0x9854e8b3, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-11841.5", 0x08000, 0x1e89877e, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0071.key", 0x02000, 0xc69949ec, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Passsht16a) +STD_ROM_FN(Passsht16a) + +static struct BurnRomInfo QuartetRomDesc[] = { + { "epr-7458a.9b", 0x08000, 0x42e7b23e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7455a.6b", 0x08000, 0x01631ab2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7459a.10b", 0x08000, 0x6b540637, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7456a.7b", 0x08000, 0x31ca583e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7460.11b", 0x08000, 0xa444ea13, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7457.8b", 0x08000, 0x3b282c23, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-7461.9c", 0x08000, 0xf6af07f2, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7462.10c", 0x08000, 0x7914af28, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7463.11c", 0x08000, 0x827c5603, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-7465.5c", 0x08000, 0x8a1ab7d7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7469.2b", 0x08000, 0xcb65ae4f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7466.6c", 0x08000, 0xb2d3f4f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7470.3b", 0x08000, 0x16fc67b1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7467.7c", 0x08000, 0x0af68de2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7471.4b", 0x08000, 0x13fad5ac, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7468.8c", 0x08000, 0xddfd40c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7472.5b", 0x08000, 0x8e2762ec, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-7464.1b", 0x08000, 0x9f291306, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-7473.1c", 0x08000, 0x06ec75fa, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7475.2c", 0x08000, 0x7abd1206, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7474.3c", 0x08000, 0xdbf853b8, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7476.4c", 0x08000, 0x5eba655a, SYS16_ROM_7751DATA | BRF_SND }, + + { "315-5194.mcu", 0x01000, 0x00000000, BRF_NODUMP }, + + { "pal16r6a.22g", 0x00104, 0x00000000, BRF_NODUMP }, // PLD + { "pal16r6a.23g", 0x00104, 0x00000000, BRF_NODUMP }, // PLD + { "pls153.8j", 0x000eb, 0x0fe1eefd, BRF_OPT }, // PLD +}; + + +STD_ROM_PICK(Quartet) +STD_ROM_FN(Quartet) + +static struct BurnRomInfo QuartetaRomDesc[] = { + { "epr-7458.9b", 0x08000, 0x0096499f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7455.6b", 0x08000, 0xda934390, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7459.10b", 0x08000, 0xd130cf61, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7456.7b", 0x08000, 0x7847149f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7460.11b", 0x08000, 0xa444ea13, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7457.8b", 0x08000, 0x3b282c23, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-7461.9c", 0x08000, 0xf6af07f2, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7462.10c", 0x08000, 0x7914af28, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7463.11c", 0x08000, 0x827c5603, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-7465.5c", 0x08000, 0x8a1ab7d7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7469.2b", 0x08000, 0xcb65ae4f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7466.6c", 0x08000, 0xb2d3f4f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7470.3b", 0x08000, 0x16fc67b1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7467.7c", 0x08000, 0x0af68de2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7471.4b", 0x08000, 0x13fad5ac, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7468.8c", 0x08000, 0xddfd40c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7472.5b", 0x08000, 0x8e2762ec, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-7464.1b", 0x08000, 0x9f291306, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-7473.1c", 0x08000, 0x06ec75fa, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7475.2c", 0x08000, 0x7abd1206, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7474.3c", 0x08000, 0xdbf853b8, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7476.4c", 0x08000, 0x5eba655a, SYS16_ROM_7751DATA | BRF_SND }, + + { "315-5194.mcu", 0x01000, 0x00000000, BRF_NODUMP }, + + { "pal16r6a.22g", 0x00104, 0x00000000, BRF_NODUMP }, // PLD + { "pal16r6a.23g", 0x00104, 0x00000000, BRF_NODUMP }, // PLD + { "pls153.8j", 0x000eb, 0x0fe1eefd, BRF_OPT }, // PLD +}; + + +STD_ROM_PICK(Quarteta) +STD_ROM_FN(Quarteta) + +static struct BurnRomInfo Quartet2RomDesc[] = { + { "epr-7695.b9", 0x08000, 0x67177cd8, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7692.b6", 0x08000, 0x50f50b08, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7696.b10", 0x08000, 0x4273c3b7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7693.b7", 0x08000, 0x0aa337bb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7697.b11", 0x08000, 0x3a6a375d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7694.b8", 0x08000, 0xd87b2ca2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-7698.c9", 0x08000, 0x547a6058, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7699.c10", 0x08000, 0x77ec901d, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7700.c11", 0x08000, 0x7e348cce, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-7465.5c", 0x08000, 0x8a1ab7d7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7469.2b", 0x08000, 0xcb65ae4f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7466.6c", 0x08000, 0xb2d3f4f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7470.3b", 0x08000, 0x16fc67b1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7467.7c", 0x08000, 0x0af68de2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7471.4b", 0x08000, 0x13fad5ac, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7468.8c", 0x08000, 0xddfd40c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7472.5b", 0x08000, 0x8e2762ec, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-7464.1b", 0x08000, 0x9f291306, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-7473.1c", 0x08000, 0x06ec75fa, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7475.2c", 0x08000, 0x7abd1206, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7474.3c", 0x08000, 0xdbf853b8, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7476.4c", 0x08000, 0x5eba655a, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0010.bin", 0x01000, 0x8c2033ea, BRF_PRG | BRF_OPT }, +}; + + +STD_ROM_PICK(Quartet2) +STD_ROM_FN(Quartet2) + +static struct BurnRomInfo Quartet2aRomDesc[] = { + { "epr-7728.b9", 0x08000, 0x56a8c88e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7725.b6", 0x08000, 0xee15fcc9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7729.b10", 0x08000, 0xbc242123, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7726.b7", 0x08000, 0x9d1c48e7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7697.b11", 0x08000, 0x3a6a375d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-7694.b8", 0x08000, 0xd87b2ca2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-7698.c9", 0x08000, 0x547a6058, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7699.c10", 0x08000, 0x77ec901d, SYS16_ROM_TILES | BRF_GRA }, + { "epr-7700.c11", 0x08000, 0x7e348cce, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-7465.5c", 0x08000, 0x8a1ab7d7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7469.2b", 0x08000, 0xcb65ae4f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7466.6c", 0x08000, 0xb2d3f4f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7470.3b", 0x08000, 0x16fc67b1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7467.7c", 0x08000, 0x0af68de2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7471.4b", 0x08000, 0x13fad5ac, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7468.8c", 0x08000, 0xddfd40c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-7472.5b", 0x08000, 0x8e2762ec, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-7464.1b", 0x08000, 0x9f291306, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-7473.1c", 0x08000, 0x06ec75fa, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7475.2c", 0x08000, 0x7abd1206, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7474.3c", 0x08000, 0xdbf853b8, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-7476.4c", 0x08000, 0x5eba655a, SYS16_ROM_7751DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Quartet2a) +STD_ROM_FN(Quartet2a) + +static struct BurnRomInfo SdiRomDesc[] = { + { "epr-10970.43", 0x08000, 0xb8fa4a2c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10968.26", 0x08000, 0xa3f97793, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10971.42", 0x08000, 0xc44a0328, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10969.25", 0x08000, 0x455d15bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10755.41", 0x08000, 0x405e3969, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10752.24", 0x08000, 0x77453740, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10756.95", 0x10000, 0x44d8a506, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10757.94", 0x10000, 0x497e1740, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10758.93", 0x10000, 0x61d61486, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10760.10", 0x10000, 0x30e2c50a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10763.11", 0x10000, 0x794e3e8b, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10761.17", 0x10000, 0x6a8b3fd0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10764.18", 0x10000, 0x602da5d5, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10762.23", 0x10000, 0xb9de3aeb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10765.24", 0x10000, 0x0a73a057, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10759.12", 0x08000, 0xd7f9649f, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0027.key", 0x02000, 0x9a5307b2, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Sdi) +STD_ROM_FN(Sdi) + +static struct BurnRomInfo ShinobiRomDesc[] = { + { "epr-12010.43", 0x10000, 0x7df7f4a2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12008.26", 0x10000, 0xf5ae64cd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12011.42", 0x10000, 0x9d46e707, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12009.25", 0x10000, 0x7961d07e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11264.95", 0x10000, 0x46627e7d, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11265.94", 0x10000, 0x87d0f321, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11266.93", 0x10000, 0xefb4af87, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11290.10", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11294.11", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11291.17", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11295.18", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11292.23", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11296.24", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11293.29", 0x10000, 0x41f41063, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11297.30", 0x10000, 0xb6e1fd72, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11267.12", 0x08000, 0xdd50b745, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-11268.1", 0x08000, 0x6d7966da, SYS16_ROM_7751DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Shinobi) +STD_ROM_FN(Shinobi) + +static struct BurnRomInfo Shinobi1RomDesc[] = { + { "epr-11262.42", 0x10000, 0xd4b8df12, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11260.27", 0x10000, 0x2835c95d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11263.43", 0x10000, 0xa2a620bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11261.25", 0x10000, 0xa3ceda52, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11264.95", 0x10000, 0x46627e7d, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11265.94", 0x10000, 0x87d0f321, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11266.93", 0x10000, 0xefb4af87, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11290.10", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11294.11", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11291.17", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11295.18", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11292.23", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11296.24", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11293.29", 0x10000, 0x41f41063, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11297.30", 0x10000, 0xb6e1fd72, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11267.12", 0x08000, 0xdd50b745, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-11268.1", 0x08000, 0x6d7966da, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0050.key", 0x02000, 0x82c39ced, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Shinobi1) +STD_ROM_FN(Shinobi1) + +static struct BurnRomInfo ShinoblsRomDesc[] = { + { "b3", 0x10000, 0x38e59646, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "b1", 0x10000, 0x8529d192, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "b4", 0x10000, 0xa2a620bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "b2", 0x10000, 0xa3ceda52, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "b5", 0x10000, 0x46627e7d, SYS16_ROM_TILES | BRF_GRA }, + { "b6", 0x10000, 0x87d0f321, SYS16_ROM_TILES | BRF_GRA }, + { "b7", 0x10000, 0xefb4af87, SYS16_ROM_TILES | BRF_GRA }, + + { "b10", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, + { "b14", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, + { "b11", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "b15", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, + { "b12", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, + { "b16", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "b13", 0x10000, 0x7e98bd36, SYS16_ROM_SPRITES | BRF_GRA }, + { "b17", 0x10000, 0x0315cf42, SYS16_ROM_SPRITES | BRF_GRA }, + + { "b8", 0x08000, 0xdd50b745, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "b9", 0x08000, 0x6d7966da, SYS16_ROM_7751DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Shinobls) +STD_ROM_FN(Shinobls) + +static struct BurnRomInfo ShinoblbRomDesc[] = { + { "4.3k", 0x10000, 0xc178a39c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "2.3n", 0x10000, 0x5ad8ebf2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "5.2k", 0x10000, 0xa2a620bd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "3.2n", 0x10000, 0xa3ceda52, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "8.3b", 0x10000, 0x46627e7d, SYS16_ROM_TILES | BRF_GRA }, + { "7.4b", 0x10000, 0x87d0f321, SYS16_ROM_TILES | BRF_GRA }, + { "6.5b", 0x10000, 0xefb4af87, SYS16_ROM_TILES | BRF_GRA }, + + { "9.6r", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, + { "13.8r", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, + { "10.6q", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "14.8q", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, + { "11.6p", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, + { "15.8p", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "12.6n", 0x10000, 0x41f41063, SYS16_ROM_SPRITES | BRF_GRA }, + { "16.8n", 0x10000, 0xb6e1fd72, SYS16_ROM_SPRITES | BRF_GRA }, + + { "1.5s", 0x08000, 0xdd50b745, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "b9", 0x08000, 0x6d7966da, SYS16_ROM_7751DATA | BRF_SND }, + + { "17.6u", 0x08000, 0xb7a6890c, BRF_SND | BRF_OPT }, +}; + + +STD_ROM_PICK(Shinoblb) +STD_ROM_FN(Shinoblb) + +static struct BurnRomInfo Sjryuko1RomDesc[] = { + { "epr-12251.43", 0x08000, 0x1af3cd0b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12249.26", 0x08000, 0x743d467d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12252.42", 0x08000, 0x7ae309d6, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12250.25", 0x08000, 0x52c40f19, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "12224-95.b9", 0x08000, 0xeac17ba1, SYS16_ROM_TILES | BRF_GRA }, + { "12225-94.b10", 0x08000, 0x2310fc98, SYS16_ROM_TILES | BRF_GRA }, + { "12226-93.b11", 0x08000, 0x210e6999, SYS16_ROM_TILES | BRF_GRA }, + + { "12232-10.b1", 0x10000, 0x0adec62b, SYS16_ROM_SPRITES | BRF_GRA }, + { "12236-11.b5", 0x10000, 0x286b9af8, SYS16_ROM_SPRITES | BRF_GRA }, + { "12233-17.b2", 0x10000, 0x3e45969c, SYS16_ROM_SPRITES | BRF_GRA }, + { "12237-18.b6", 0x10000, 0xe5058e96, SYS16_ROM_SPRITES | BRF_GRA }, + { "12234-23.b3", 0x10000, 0x8c8d54ef, SYS16_ROM_SPRITES | BRF_GRA }, + { "12238-24.b7", 0x10000, 0x7ada3304, SYS16_ROM_SPRITES | BRF_GRA }, + { "12235-29.b4", 0x10000, 0xfa45d511, SYS16_ROM_SPRITES | BRF_GRA }, + { "12239-30.b8", 0x10000, 0x91f70c8b, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12227.12", 0x08000, 0x5b12409d, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-12228.1", 0x08000, 0x6b2e6aef, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-12229.2", 0x08000, 0xb7aa015c, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-12230.4", 0x08000, 0xd0f61fd4, SYS16_ROM_7751DATA | BRF_SND }, + { "epr-12231.5", 0x08000, 0x780bdc57, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-5021.key", 0x02000, 0x4a3422e4, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Sjryuko1) +STD_ROM_FN(Sjryuko1) + +static struct BurnRomInfo TetrisRomDesc[] = { + { "epr-12201.rom", 0x08000, 0x338e9b51, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12200.rom", 0x08000, 0xfb058779, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12202.rom", 0x10000, 0x2f7da741, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12203.rom", 0x10000, 0xa6e58ec5, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12204.rom", 0x10000, 0x0ae98e23, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-12169.b1", 0x08000, 0xdacc6165, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12170.b5", 0x08000, 0x87354e42, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12205.rom", 0x08000, 0x6695dc99, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0093.key", 0x02000, 0xe0064442, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Tetris) +STD_ROM_FN(Tetris) + +static struct BurnRomInfo Tetris3RomDesc[] = { + { "epr-12201a.43", 0x08000, 0x9250e5cf, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12200a.26", 0x08000, 0x85d4b0ff, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12202.rom", 0x10000, 0x2f7da741, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12203.rom", 0x10000, 0xa6e58ec5, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12204.rom", 0x10000, 0x0ae98e23, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-12169.b1", 0x08000, 0xdacc6165, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12170.b5", 0x08000, 0x87354e42, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12205.rom", 0x08000, 0x6695dc99, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0093a.key", 0x02000, 0x7ca4a8ee, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Tetris3) +STD_ROM_FN(Tetris3) + +static struct BurnRomInfo Timescan1RomDesc[] = { + { "epr-10540a.43", 0x08000, 0x76848b0b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10537a.26", 0x08000, 0x4ddc434a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10541.42", 0x08000, 0xcc6d945e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10538.25", 0x08000, 0x68379473, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10542.41", 0x08000, 0x10217dfa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10539.24", 0x08000, 0x10943b2e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10543.95", 0x08000, 0x07dccc37, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10544.94", 0x08000, 0x84fb9a3a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10545.93", 0x08000, 0xc8694bc0, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10548.10", 0x08000, 0xaa150735, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10552.11", 0x08000, 0x6fcbb9f7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10549.17", 0x08000, 0x2f59f067, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10553.18", 0x08000, 0x8a220a9f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10550.23", 0x08000, 0xf05069ff, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10554.24", 0x08000, 0xdc64f809, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10551.29", 0x08000, 0x435d811f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10555.30", 0x08000, 0x2143c471, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10546.12", 0x08000, 0x1ebee5cc, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "7751.bin", 0x00400, 0x6a9534fc, SYS16_ROM_7751PROG | BRF_ESS | BRF_PRG }, + + { "epr-10547.1", 0x08000, 0xd24ffc4b, SYS16_ROM_7751DATA | BRF_SND }, + + { "317-0024.key", 0x02000, 0xee42ec18, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Timescan1) +STD_ROM_FN(Timescan1) + +static struct BurnRomInfo Wb31RomDesc[] = { + { "epr-12084.bin", 0x10000, 0xb6deb654, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12082.bin", 0x10000, 0x38dc5b15, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12085.bin", 0x10000, 0x0962098b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12083.bin", 0x10000, 0x3d631a8e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12086.bin", 0x10000, 0x45b949df, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12087.bin", 0x10000, 0x6f0396b7, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12088.bin", 0x10000, 0xba8c0749, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12089.bin", 0x08000, 0x8321eb0b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0084.key", 0x02000, 0x2c58dafa, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Wb31) +STD_ROM_FN(Wb31) + +/*==================================================== +Memory Handlers +====================================================*/ + +static bool Mjleague = false; + +void System16APPI0WritePortA(UINT8 data) +{ + System16SoundLatch = data & 0xff; +} + +void System16APPI0WritePortB(UINT8 data) +{ + System16VideoControl = data; + System16VideoEnable = data & 0x10; + if (Mjleague) System16ScreenFlip = data & 0x80; +} + +void System16APPI0WritePortC(UINT8 data) +{ + if (!(data & 0x80)) { + ZetOpen(0); + ZetNmi(); + ZetClose(); + } + System16ColScroll = ~data & 0x04; + System16RowScroll = ~data & 0x02; +} + +UINT16 __fastcall System16AReadWord(UINT32 a) +{ + switch (a) { + case 0xc40000: + case 0xc40002: + case 0xc40004: + case 0xc40006: + case 0xc41000: + case 0xc41002: + case 0xc41004: + case 0xc41006: + case 0xc42000: + case 0xc42002: + case 0xc42004: + case 0xc42006: { + SEK_DEF_READ_WORD(0, a); + } + + case 0xc60000: { + return 0; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Read Word -> 0x%06X\n"), a); +#endif + + return 0xffff; +} + +UINT8 __fastcall System16AReadByte(UINT32 a) +{ + switch (a) { + case 0xc40001: + case 0xc40003: + case 0xc40005: + case 0xc40007: { + return ppi8255_r(0, (a - 0xc40000) >> 1); + } + + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + return 0xff - System16Input[1]; + } + + case 0xc41005: { + return System16Dip[2]; + } + + case 0xc41007: { + return 0xff - System16Input[2]; + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + + case 0xc60000: { + return 0; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); +#endif + + return 0xff; +} + +void __fastcall System16AWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16ATileWordWrite(a - 0x400000, d); + return; + } + + switch (a) { + case 0xc40000: + case 0xc40002: + case 0xc40004: + case 0xc40006: { + SEK_DEF_WRITE_WORD(0, a, d); + return; + } + + case 0xc60000: { + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X\n"), a, d); +#endif +} + +void __fastcall System16AWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16ATileByteWrite((a - 0x400000) ^ 1, d); + return; + } + + switch (a) { + case 0xc40001: + case 0xc40003: + case 0xc40005: + case 0xc40007: { + ppi8255_w(0, (a - 0xc40000) >> 1, d & 0xff); + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); +#endif +} + +static INT16 AceattacaTrack1X = 0; +static INT16 AceattacaTrack1Y = 0; +static INT16 AceattacaTrack2X = 0; +static INT16 AceattacaTrack2Y = 0; +static INT8 AceattacaDial1 = 0; +static INT8 AceattacaDial2 = 0; + +void AceattacaMakeAnalogInputs() +{ + if (System16InputPort3[0]) AceattacaTrack1X += 0x40; + if (System16InputPort3[1]) AceattacaTrack1X -= 0x40; + if (AceattacaTrack1X >= 0x100) AceattacaTrack1X = 0; + if (AceattacaTrack1X < 0) AceattacaTrack1X = 0xfd; + + if (System16InputPort3[2]) AceattacaTrack1Y -= 0x40; + if (System16InputPort3[3]) AceattacaTrack1Y += 0x40; + if (AceattacaTrack1Y >= 0x100) AceattacaTrack1Y = 0; + if (AceattacaTrack1Y < 0) AceattacaTrack1Y = 0xfd; + + if (System16InputPort4[0]) AceattacaDial1 += 0x01; + if (System16InputPort4[1]) AceattacaDial1 -= 0x01; + if (AceattacaDial1 >= 0x10) AceattacaDial1 = 0; + if (AceattacaDial1 < 0) AceattacaDial1 = 0x0f; + + if (System16InputPort3[4]) AceattacaTrack2X += 0x40; + if (System16InputPort3[5]) AceattacaTrack2X -= 0x40; + if (AceattacaTrack2X >= 0x100) AceattacaTrack2X = 0; + if (AceattacaTrack2X < 0) AceattacaTrack2X = 0xfd; + + if (System16InputPort3[6]) AceattacaTrack2Y -= 0x40; + if (System16InputPort3[7]) AceattacaTrack2Y += 0x40; + if (AceattacaTrack2Y >= 0x100) AceattacaTrack2Y = 0; + if (AceattacaTrack2Y < 0) AceattacaTrack2Y = 0xfd; + + if (System16InputPort4[2]) AceattacaDial2 += 0x01; + if (System16InputPort4[3]) AceattacaDial2 -= 0x01; + if (AceattacaDial2 >= 0x10) AceattacaDial2 = 0; + if (AceattacaDial2 < 0) AceattacaDial2 = 0x0f; +} + +UINT8 __fastcall AceattacaReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + if (System16VideoControl == 0x10) return 0xff - System16Input[1]; + if (System16VideoControl == 0x14) return AceattacaTrack1X; + if (System16VideoControl == 0x18) return AceattacaTrack1Y; + if (System16VideoControl == 0x1c) return System16Input[2]; + return 0xff; + } + + case 0xc41005: { + return AceattacaDial1 | (AceattacaDial2 << 4); + } + + case 0xc41007: { + if (System16VideoControl == 0x10) return 0xff - System16Input[5]; + if (System16VideoControl == 0x14) return AceattacaTrack2X; + if (System16VideoControl == 0x18) return AceattacaTrack2Y; + if (System16VideoControl == 0x1c) return System16Input[6]; + return 0xff; + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + + case 0xc60000: { + return 0; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); +#endif + + return 0xff; +} + +static INT16 MjleagueTrack1X = 0; +static INT16 MjleagueTrack1Y = 0; +static INT16 MjleagueTrack2X = 0; +static INT16 MjleagueTrack2Y = 0; +static INT16 MjleagueBat1 = 0; +static INT16 MjleagueBat2 = 0; + +void MjleagueMakeAnalogInputs() +{ + if (System16InputPort3[0]) MjleagueTrack1X -= 0x04; + if (System16InputPort3[1]) MjleagueTrack1X += 0x04; + if (MjleagueTrack1X >= 0x100) MjleagueTrack1X = 0; + if (MjleagueTrack1X < 0) MjleagueTrack1X = 0xfc; + + if (System16InputPort3[2]) MjleagueTrack1Y -= 0x04; + if (System16InputPort3[3]) MjleagueTrack1Y += 0x04; + if (MjleagueTrack1Y >= 0x100) MjleagueTrack1Y = 0; + if (MjleagueTrack1Y < 0) MjleagueTrack1Y = 0xfc; + + if (System16InputPort3[4]) MjleagueTrack2X -= 0x04; + if (System16InputPort3[5]) MjleagueTrack2X += 0x04; + if (MjleagueTrack2X >= 0x100) MjleagueTrack2X = 0; + if (MjleagueTrack2X < 0) MjleagueTrack2X = 0xfc; + + if (System16InputPort3[6]) MjleagueTrack2Y -= 0x04; + if (System16InputPort3[7]) MjleagueTrack2Y += 0x04; + if (MjleagueTrack2Y >= 0x100) MjleagueTrack2Y = 0; + if (MjleagueTrack2Y < 0) MjleagueTrack2Y = 0xfc; + + MjleagueBat1 = 0x80 + (System16AnalogPort0 >> 4); + MjleagueBat2 = 0x80 + (System16AnalogPort1 >> 4); +} + +UINT8 __fastcall MjleagueReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + UINT8 buttons = 0x3f - System16Input[0]; + UINT8 analog1 = (System16VideoControl & 4) ? MjleagueTrack1Y : MjleagueTrack1X; + UINT8 analog2 = (System16VideoControl & 4) ? MjleagueTrack2Y : MjleagueTrack2X; + + buttons |= (analog1 & 0x80) >> 1; + buttons |= (analog2 & 0x80); + + return buttons; + } + + case 0xc41003: { + UINT8 analog = (System16VideoControl & 4) ? MjleagueTrack1Y : MjleagueTrack1X; + return ((0xff - System16Input[1]) & 0x80) | (analog & 0x7f); + } + + case 0xc41005: { + if (System16VideoControl & 4) { + return (MjleagueBat1 >> 4) | (MjleagueBat2 & 0xf0); + } else { + static UINT8 last_buttons1 = 0; + static UINT8 last_buttons2 = 0; + UINT8 buttons1 = 0xff - System16Input[1]; + UINT8 buttons2 = 0xff - System16Input[2]; + + if (!(buttons1 & 0x01)) + last_buttons1 = 0; + else if (!(buttons1 & 0x02)) + last_buttons1 = 1; + else if (!(buttons1 & 0x04)) + last_buttons1 = 2; + else if (!(buttons1 & 0x08)) + last_buttons1 = 3; + + if (!(buttons2 & 0x01)) + last_buttons2 = 0; + else if (!(buttons2 & 0x02)) + last_buttons2 = 1; + else if (!(buttons2 & 0x04)) + last_buttons2 = 2; + else if (!(buttons2 & 0x08)) + last_buttons2 = 3; + + return last_buttons1 | (last_buttons2 << 4); + } + } + + case 0xc41007: { + UINT8 analog = (System16VideoControl & 4) ? MjleagueTrack2Y : MjleagueTrack2X; + return ((0xff - System16Input[2]) & 0x80) | (analog & 0x7f); + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + } + + return 0xff; +} + +UINT8 __fastcall Passsht16aReadByte(UINT32 a) +{ + static INT32 PortNum = 0; + + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + switch ((PortNum++) & 3) { + case 0: return 0xff - System16Input[1]; + case 1: return 0xff - System16Input[2]; + case 2: return 0xff - System16Input[3]; + case 3: return 0xff - System16Input[4]; + } + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + + case 0xc60000: { + return 0; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); +#endif + + return 0xff; +} + +UINT8 __fastcall QuartetReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + return 0xff - System16Input[1]; + } + + case 0xc41005: { + return 0xff - System16Input[2]; + } + + case 0xc41007: { + return 0xff - System16Input[3]; + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + + case 0xc60000: { + return 0; + } + } + + return 0xff; +} + +static INT16 SdiTrack1X = 0; +static INT16 SdiTrack1Y = 0; +static INT16 SdiTrack2X = 0; +static INT16 SdiTrack2Y = 0; + +void SdiMakeAnalogInputs() +{ + SdiTrack1X += (System16AnalogPort0 >> 8) & 0xff; + SdiTrack1Y -= (System16AnalogPort1 >> 8) & 0xff; + + SdiTrack2X += (System16AnalogPort2 >> 8) & 0xff; + SdiTrack2Y -= (System16AnalogPort3 >> 8) & 0xff; +} + +UINT8 __fastcall SdiReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + return (System16VideoControl & 4) ? SdiTrack1Y : SdiTrack1X; + } + + case 0xc41005: { + return 0xff - System16Input[1]; + } + + case 0xc41007: { + return (System16VideoControl & 4) ? SdiTrack2Y : SdiTrack2X; + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + + case 0xc60000: { + return 0xff; + } + } + + return 0xff; +} + +static UINT8 MahjongInputNum; + +UINT16 __fastcall Sjryuko1ReadWord(UINT32 a) +{ + SEK_DEF_READ_WORD(0, a); + + return 0xffff; +} + +UINT8 __fastcall Sjryuko1ReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + if (System16Input[MahjongInputNum + 1] != 0xff) return 0xff & ~(1 << MahjongInputNum); + return 0xff; + } + + case 0xc41005: { + return 0xff - System16Input[MahjongInputNum + 1]; + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + } + + return 0xff; +} + +void __fastcall Sjryuko1WriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16ATileByteWrite((a - 0x400000) ^ 1, d); + return; + } + + switch (a) { + case 0xc40001: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetNmi(); + ZetClose(); + return; + } + + case 0xc40003: { + if ((System16VideoControl ^ d) & 0xc) { + if (((System16VideoControl ^ d) & 4) && (d & 4)) MahjongInputNum = (MahjongInputNum + 1) % 6; + } + System16VideoControl = d; + System16VideoEnable = d & 0x10; + return; + } + } +} + +/*==================================================== +Driver Inits +====================================================*/ + +static INT32 AceattacaInit() +{ + System16MakeAnalogInputsDo = AceattacaMakeAnalogInputs; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, AceattacaReadByte); + SekClose(); + + // Handle different sprite rom layout + UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); + if (pTemp) { + memcpy(pTemp, System16Sprites, System16SpriteRomSize); + memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); + memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); + memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); + memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); + memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); + memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); + memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); + memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 AceattacaExit() +{ + AceattacaTrack1X = 0; + AceattacaTrack1Y = 0; + AceattacaTrack2X = 0; + AceattacaTrack2Y = 0; + AceattacaDial1 = 0; + AceattacaDial2 = 0; + + return System16Exit(); +} + +static INT32 AceattacaScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029660; + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(AceattacaTrack1X); + SCAN_VAR(AceattacaTrack1Y); + SCAN_VAR(AceattacaTrack2X); + SCAN_VAR(AceattacaTrack2Y); + SCAN_VAR(AceattacaDial1); + SCAN_VAR(AceattacaDial2); + } + + return System16Scan(nAction, pnMin);; +} + +static INT32 AliensynjoInit() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + // Handle different sprite rom layout + UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); + if (pTemp) { + memcpy(pTemp, System16Sprites, System16SpriteRomSize); + memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); + memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); + memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); + memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); + memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); + memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); + memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); + memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Aliensyn5Init() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + // Handle different sprite rom layout + UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); + if (pTemp) { + memcpy(pTemp, System16Sprites, System16SpriteRomSize); + memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); + memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); + memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); + memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); + memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); + memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); + memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); + memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +void Bodyslam_Sim8751() +{ + UINT8 flag = ((System16Ram[0x200 + 1] << 8) | System16Ram[0x200 + 0]) >> 8; + UINT8 tick = ((System16Ram[0x200 + 1] << 8) | System16Ram[0x200 + 0]) & 0xff; + UINT8 sec = ((System16Ram[0x202 + 1] << 8) | System16Ram[0x202 + 0]) >> 8; + UINT8 min = ((System16Ram[0x202 + 1] << 8) | System16Ram[0x202 + 0]) & 0xff; + + /* out of time? set the flag */ + if (tick == 0 && sec == 0 && min == 0) + flag = 1; + else + { + if (tick != 0) + tick--; + else + { + /* the game counts 64 ticks per second */ + tick = 0x40; + + /* seconds are counted in BCD */ + if (sec != 0) + sec = (sec & 0xf) ? sec - 1 : (sec - 0x10) + 9; + else + { + sec = 0x59; + + /* minutes are counted normally */ + if (min != 0) + min--; + else + { + flag = 1; + tick = sec = min = 0; + } + } + } + } + + *((UINT16*)(System16Ram + 0x200)) = BURN_ENDIAN_SWAP_INT16((flag << 8) + tick); + *((UINT16*)(System16Ram + 0x202)) = BURN_ENDIAN_SWAP_INT16((sec << 8) + min); +} + +static INT32 BodyslamInit() +{ + Simulate8751 = Bodyslam_Sim8751; + + return System16Init(); +} + +static void SegaDecode2(const UINT8 xor_table[128],const int swap_table[128]) +{ + INT32 A; + static const UINT8 swaptable[24][4] = + { + { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 }, + { 6,2,4,0 }, { 6,0,2,4 }, { 6,4,0,2 }, { 2,6,4,0 }, + { 4,2,6,0 }, { 4,6,0,2 }, { 6,0,4,2 }, { 0,6,4,2 }, + { 4,0,6,2 }, { 0,4,6,2 }, { 6,2,0,4 }, { 2,6,0,4 }, + { 0,6,2,4 }, { 2,0,6,4 }, { 0,2,6,4 }, { 4,2,0,6 }, + { 2,4,0,6 }, { 4,0,2,6 }, { 2,0,4,6 }, { 0,2,4,6 }, + }; + + UINT8 *rom = System16Z80Rom; + UINT8 *decrypted = System16Z80Code; + + for (A = 0x0000;A < 0x8000;A++) + { + INT32 row; + UINT8 src; + const UINT8 *tbl; + + + src = rom[A]; + + /* pick the translation table from bits 0, 3, 6, 9, 12 and 14 of the address */ + row = (A & 1) + (((A >> 3) & 1) << 1) + (((A >> 6) & 1) << 2) + + (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5); + + /* decode the opcodes */ + tbl = swaptable[swap_table[2*row]]; + decrypted[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row]; + + /* decode the data */ + tbl = swaptable[swap_table[2*row+1]]; + rom[A] = BITSWAP08(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row+1]; + } +} + +static INT32 FantzonepDecryptZ80() +{ + System16Z80Code = (UINT8*)BurnMalloc(0x8000); + + static const UINT8 xor_table[128] = + { + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + }; + + static const INT32 swap_table[128] = + { + 0,0,0,0, + 1,1,1,1,1, + 2,2,2,2,2, + 3,3,3,3, + 4,4,4,4,4, + 5,5,5,5,5, + 6,6,6,6,6, + 7,7,7,7,7, + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11,11, + 12,12,12,12,12, + 13,13, + + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11, + 12,12,12,12,12, + 13,13,13,13,13, + 14,14,14,14,14, + 15,15,15,15,15, + 16,16,16,16, + 17,17,17,17,17, + 18,18,18,18,18, + 19,19,19,19,19, + 20,20,20,20,20, + 21,21, + }; + + SegaDecode2(xor_table, swap_table); + + return 0; +} + +static void FantzonepMapZ80() +{ + ZetMapArea(0x0000, 0x7fff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0x7fff, 2, System16Z80Code, System16Z80Rom); + + ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); + + ZetSetInHandler(System16PPIZ80PortRead); + ZetSetOutHandler(System16Z80PortWrite); +} + +static INT32 FantzonepInit() +{ + System16CustomLoadRomDo = FantzonepDecryptZ80; + System16MapZ80Do = FantzonepMapZ80; + + return System16Init(); +} + +static INT32 FantzonepExit() +{ + BurnFree(System16Z80Code); + + return System16Exit(); +} + +static INT32 MjleagueInit() +{ + System16MakeAnalogInputsDo = MjleagueMakeAnalogInputs; + + Mjleague = true; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, MjleagueReadByte); + SekClose(); + } + + return nRet; +} + +static INT32 MjleagueExit() +{ + MjleagueTrack1X = 0; + MjleagueTrack1Y = 0; + MjleagueTrack2X = 0; + MjleagueTrack2Y = 0; + MjleagueBat1 = 0; + MjleagueBat2 = 0; + + Mjleague = false; + + return System16Exit(); +} + +static INT32 MjleagueScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029660; + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(MjleagueTrack1X); + SCAN_VAR(MjleagueTrack1Y); + SCAN_VAR(MjleagueTrack2X); + SCAN_VAR(MjleagueTrack2Y); + SCAN_VAR(MjleagueBat1); + SCAN_VAR(MjleagueBat2); + } + + return System16Scan(nAction, pnMin);; +} + +void Quartet_Sim8751() +{ + // X-Scroll Values + *((UINT16*)(System16TextRam + 0xff8)) = BURN_ENDIAN_SWAP_INT16(((System16Ram[0x0d14 + 1] << 8) | System16Ram[0x0d14 + 0])); + *((UINT16*)(System16TextRam + 0xffa)) = BURN_ENDIAN_SWAP_INT16(((System16Ram[0x0d18 + 1] << 8) | System16Ram[0x0d18 + 0])); + + // Page Values + *((UINT16*)(System16TextRam + 0xe9e)) = BURN_ENDIAN_SWAP_INT16(((System16Ram[0x0d1c + 1] << 8) | System16Ram[0x0d1c + 0])); + *((UINT16*)(System16TextRam + 0xe9c)) = BURN_ENDIAN_SWAP_INT16(((System16Ram[0x0d1e + 1] << 8) | System16Ram[0x0d1e + 0])); +} + +static INT32 Passsht16aInit() +{ + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x70000 - 0x60000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, Passsht16aReadByte); + SekClose(); + + // Handle different sprite rom layout + UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); + if (pTemp) { + memcpy(pTemp, System16Sprites, System16SpriteRomSize); + memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); + memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); + memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); + memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); + memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); + memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 QuartetInit() +{ + Simulate8751 = Quartet_Sim8751; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, QuartetReadByte); + SekClose(); + } + + return nRet; +} + +static INT32 SdiInit() +{ + System16MakeAnalogInputsDo = SdiMakeAnalogInputs; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x70000 - 0x60000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, SdiReadByte); + SekClose(); + + // Handle different sprite rom layout + UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); + if (pTemp) { + memcpy(pTemp, System16Sprites, System16SpriteRomSize); + memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); + memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); + memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); + memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); + memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); + memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 SdiExit() +{ + SdiTrack1X = 0; + SdiTrack1Y = 0; + SdiTrack2X = 0; + SdiTrack2Y = 0; + + return System16Exit(); +} + +static INT32 SdiScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029660; + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(SdiTrack1X); + SCAN_VAR(SdiTrack1Y); + SCAN_VAR(SdiTrack2X); + SCAN_VAR(SdiTrack2Y); + } + + return System16Scan(nAction, pnMin);; +} + +static INT32 ShinobiInit() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + // Handle different sprite rom layout + UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); + if (pTemp) { + memcpy(pTemp, System16Sprites, System16SpriteRomSize); + memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); + memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); + memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); + memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); + memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); + memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); + memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); + memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Sjryuko1Init() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetWriteByteHandler(0, Sjryuko1WriteByte); + SekSetReadByteHandler(0, Sjryuko1ReadByte); + SekSetReadWordHandler(0, Sjryuko1ReadWord); + SekClose(); + + // Handle different sprite rom layout + UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); + if (pTemp) { + memcpy(pTemp, System16Sprites, System16SpriteRomSize); + memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); + memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); + memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); + memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); + memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); + memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); + memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); + memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Sjryuko1Exit() +{ + MahjongInputNum = 0; + + return System16Exit(); +} + +static INT32 Sjryuko1Scan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029660; + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(MahjongInputNum); + } + + return System16Scan(nAction, pnMin);; +} + +static INT32 Wb31Init() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + // Handle different sprite rom layout + UINT8 *pTemp = (UINT8*)BurnMalloc(System16SpriteRomSize); + if (pTemp) { + memcpy(pTemp, System16Sprites, System16SpriteRomSize); + memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); + memcpy(System16Sprites + 0x10000, pTemp + 0x20000, 0x10000); + memcpy(System16Sprites + 0x20000, pTemp + 0x40000, 0x10000); + memcpy(System16Sprites + 0x30000, pTemp + 0x60000, 0x10000); + memcpy(System16Sprites + 0x40000, pTemp + 0x10000, 0x10000); + memcpy(System16Sprites + 0x50000, pTemp + 0x30000, 0x10000); + memcpy(System16Sprites + 0x60000, pTemp + 0x50000, 0x10000); + memcpy(System16Sprites + 0x70000, pTemp + 0x70000, 0x10000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +/*==================================================== +Driver defs +====================================================*/ + +struct BurnDriver BurnDrvAceattaca = { + "aceattaca", "aceattac", NULL, NULL, "1986", + "Ace Attacker (Japan, System 16A, FD1094 317-0060)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_SPORTSMISC, 0, + NULL, AceattacaRomInfo, AceattacaRomName, NULL, NULL, AceattacaInputInfo, AceattacaDIPInfo, + AceattacaInit, AceattacaExit, System16AFrame, NULL, AceattacaScan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvAFighter = { + "afighter", NULL, NULL, NULL, "1986", + "Action Fighter, FD1089A 317-0018\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089A_ENC, GBF_RACING, 0, + NULL, AfighterRomInfo, AfighterRomName, NULL, NULL, System16aInputInfo, AfighterDIPInfo, + System16Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvAlexkidd = { + "alexkidd", NULL, NULL, NULL, "1986", + "Alex Kidd: The Lost Stars (set 2, unprotected)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, + NULL, AlexkiddRomInfo, AlexkiddRomName, NULL, NULL, System16aInputInfo, AlexkiddDIPInfo, + System16Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAlexkidd1 = { + "alexkidd1", "alexkidd", NULL, NULL, "1986", + "Alex Kidd: The Lost Stars (set 1, FD1089A 317-unknown)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089A_ENC, GBF_PLATFORM, 0, + NULL, Alexkidd1RomInfo, Alexkidd1RomName, NULL, NULL, System16aInputInfo, AlexkiddDIPInfo, + System16Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAliensynjo = { + "aliensynjo", "aliensyn", NULL, NULL, "1987", + "Alien Syndrome (set 1, Japan, old, System 16A, FD1089A 317-0033)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089A_ENC, GBF_MAZE, 0, + NULL, AliensynjoRomInfo, AliensynjoRomName, NULL, NULL, System16afire1InputInfo, AliensynDIPInfo, + AliensynjoInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAliensyn2 = { + "aliensyn2", "aliensyn", NULL, NULL, "1987", + "Alien Syndrome (set 2, System 16A, FD1089A 317-0033)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089A_ENC, GBF_MAZE, 0, + NULL, Aliensyn2RomInfo, Aliensyn2RomName, NULL, NULL, System16afire1InputInfo, AliensynDIPInfo, + AliensynjoInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAliensyn5 = { + "aliensyn5", "aliensyn", NULL, NULL, "1987", + "Alien Syndrome (set 5, System 16A, FD1089B 317-0037)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089B_ENC, GBF_MAZE, 0, + NULL, Aliensyn5RomInfo, Aliensyn5RomName, NULL, NULL, System16afire1InputInfo, AliensynDIPInfo, + Aliensyn5Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBodyslam = { + "bodyslam", NULL, NULL, NULL, "1986", + "Body Slam (8751 317-0015)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A, GBF_VSFIGHT, 0, + NULL, BodyslamRomInfo, BodyslamRomName, NULL, NULL, System16aInputInfo, BodyslamDIPInfo, + BodyslamInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDumpmtmt = { + "dumpmtmt", "bodyslam", NULL, NULL, "1986", + "Dump Matsumoto (Japan, 8751 317-unknown)\0", NULL, "Sega", "System 16A", + L"Dump Matsumoto (Japan, 8751 317-unknown)\0\u30C0\u30F3\u30D7\u677E\u672C\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A, GBF_VSFIGHT, 0, + NULL, DumpmtmtRomInfo, DumpmtmtRomName, NULL, NULL, System16aInputInfo, BodyslamDIPInfo, + BodyslamInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFantzone = { + "fantzone", NULL, NULL, NULL, "1986", + "Fantasy Zone (Rev A, unprotected)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A, GBF_HORSHOOT, 0, + NULL, FantzoneRomInfo, FantzoneRomName, NULL, NULL, System16aInputInfo, FantzoneDIPInfo, + System16Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFantzone1 = { + "fantzone1", "fantzone", NULL, NULL, "1986", + "Fantasy Zone (unprotected)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A, GBF_HORSHOOT, 0, + NULL, Fantzone1RomInfo, Fantzone1RomName, NULL, NULL, System16aInputInfo, FantzoneDIPInfo, + System16Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFantzonep = { + "fantzonep", "fantzone", NULL, NULL, "1986", + "Fantasy Zone (317-5000)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A, GBF_HORSHOOT, 0, + NULL, FantzonepRomInfo, FantzonepRomName, NULL, NULL, System16aInputInfo, FantzoneDIPInfo, + FantzonepInit, FantzonepExit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMjleague = { + "mjleague", NULL, NULL, NULL, "1985", + "Major League\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16A, GBF_SPORTSMISC, 0, + NULL, MjleagueRomInfo, MjleagueRomName, NULL, NULL, MjleagueInputInfo, MjleagueDIPInfo, + MjleagueInit, MjleagueExit, System16AFrame, NULL, MjleagueScan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvPasssht16a = { + "passsht16a", "passsht", NULL, NULL, "1988", + "Passing Shot (Japan, 4 Players, System 16A, FD1094 317-0071)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 4, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_SPORTSMISC, 0, + NULL, Passsht16aRomInfo, Passsht16aRomName, NULL, NULL, Passsht16aInputInfo, Passsht16aDIPInfo, + Passsht16aInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvQuartet = { + "quartet", NULL, NULL, NULL, "1986", + "Quartet (Rev A, 8751 317-unknown)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, + NULL, QuartetRomInfo, QuartetRomName, NULL, NULL, QuartetInputInfo, QuartetDIPInfo, + QuartetInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQuarteta = { + "quarteta", "quartet", NULL, NULL, "1986", + "Quartet (8751 315-5194)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, + NULL, QuartetaRomInfo, QuartetaRomName, NULL, NULL, QuartetInputInfo, QuartetDIPInfo, + QuartetInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQuartet2 = { + "quartet2", "quartet", NULL, NULL, "1986", + "Quartet 2 (8751 317-0010)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, + NULL, Quartet2RomInfo, Quartet2RomName, NULL, NULL, System16aInputInfo, Quart2DIPInfo, + QuartetInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQuartet2a = { + "quartet2a", "quartet", NULL, NULL, "1986", + "Quartet 2 (unprotected)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, + NULL, Quartet2aRomInfo, Quartet2aRomName, NULL, NULL, System16aInputInfo, Quart2DIPInfo, + System16Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSdi = { + "sdi", NULL, NULL, NULL, "1987", + "SDI - Strategic Defense Initiative (Japan, old, System 16A, FD1089B 317-0027)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089B_ENC, GBF_SHOOT, 0, + NULL, SdiRomInfo, SdiRomName, NULL, NULL, SdiInputInfo, SdiDIPInfo, + SdiInit, SdiExit, System16AFrame, NULL, SdiScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvShinobi = { + "shinobi", NULL, NULL, NULL, "1987", + "Shinobi (set 6, System 16A, unprotected)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, + NULL, ShinobiRomInfo, ShinobiRomName, NULL, NULL, System16afire3InputInfo, ShinobiDIPInfo, + ShinobiInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvShinobi1 = { + "shinobi1", "shinobi", NULL, NULL, "1987", + "Shinobi (set 1, System 16A, FD1094 317-0050)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, Shinobi1RomInfo, Shinobi1RomName, NULL, NULL, System16afire3InputInfo, ShinobiDIPInfo, + ShinobiInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvShinobls = { + "shinobls", "shinobi", NULL, NULL, "1987", + "Shinobi (Star bootleg, System 16A)\0", NULL, "bootleg", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, + NULL, ShinoblsRomInfo, ShinoblsRomName, NULL, NULL, System16afire3InputInfo, ShinobiDIPInfo, + ShinobiInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvShinoblb = { + "shinoblb", "shinobi", NULL, NULL, "1987", + "Shinobi (beta bootleg, System 16A)\0", NULL, "bootleg", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16A, GBF_PLATFORM, 0, + NULL, ShinoblbRomInfo, ShinoblbRomName, NULL, NULL, System16afire3InputInfo, ShinobiDIPInfo, + ShinobiInit, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSjryuko1 = { + "sjryuko1", "sjryuko", NULL, NULL, "1987", + "Sukeban Jansi Ryuko (set 1, System 16A, FD1089B 317-5021)\0", NULL, "White Board", "System 16A", + L"Sukeban Jansi Ryuko (set 1, System 16A, FD1089B 317-5021)\0\u30B9\u30B1\u30D0\u30F3\u96C0\u58EB \u7ADC\u5B50\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089B_ENC, GBF_MAHJONG, 0, + NULL, Sjryuko1RomInfo, Sjryuko1RomName, NULL, NULL, Sjryuko1InputInfo, Sjryuko1DIPInfo, + Sjryuko1Init, Sjryuko1Exit, System16AFrame, NULL, Sjryuko1Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTetris = { + "tetris", NULL, NULL, NULL, "1988", + "Tetris (set 4, Japan, System 16A, FD1094 317-0093)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, + NULL, TetrisRomInfo, TetrisRomName, NULL, NULL, System16afire1InputInfo, TetrisDIPInfo, + System16Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTetris3 = { + "tetris3", "tetris", NULL, NULL, "1988", + "Tetris (set 3, Japan, System 16A, FD1094 317-0093a)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, + NULL, Tetris3RomInfo, Tetris3RomName, NULL, NULL, System16afire1InputInfo, TetrisDIPInfo, + System16Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTimescan1 = { + "timescan1", "timescan", NULL, NULL, "1987", + "Time Scanner (set 1, System 16A, FD1089B 317-0024)\0", NULL, "Sega", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1089B_ENC, GBF_PINBALL, 0, + NULL, Timescan1RomInfo, Timescan1RomName, NULL, NULL, System16aDip3InputInfo, TimescanDIPInfo, + System16Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvWb31 = { + "wb31", "wb3", NULL, NULL, "1988", + "Wonder Boy III - Monster Lair (set 1, System 16A, FD1094 317-0084)\0", NULL, "Sega / Westone", "System 16A", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16A | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, Wb31RomInfo, Wb31RomName, NULL, NULL, System16aInputInfo, Wb31DIPInfo, + Wb31Init, System16Exit, System16AFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; diff --git a/src/burn/drv/sega/d_sys16b.cpp b/src/burn/drv/sega/d_sys16b.cpp index 2dab97813..c65f38443 100644 --- a/src/burn/drv/sega/d_sys16b.cpp +++ b/src/burn/drv/sega/d_sys16b.cpp @@ -1,9272 +1,9271 @@ -#include "sys16.h" - -/*==================================================== -Input defs -====================================================*/ - -#define A(a, b, c, d) {a, b, (UINT8*)(c), d} - -static struct BurnInputInfo System16bInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 2" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(System16b) - -static struct BurnInputInfo System16bfire1InputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(System16bfire1) - -static struct BurnInputInfo System16bfire3InputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 3" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(System16bfire3) - -static struct BurnInputInfo System16bfire4InputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , System16InputPort1 + 3, "p1 fire 4" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , System16InputPort2 + 3, "p2 fire 4" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(System16bfire4) - -static struct BurnInputInfo System16bDip3InputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 2" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH, System16Dip + 2 , "dip" }, -}; - -STDINPUTINFO(System16bDip3) - -static struct BurnInputInfo AtomicpInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort1 + 7, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 7, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort1 + 6, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Atomicp) - -static struct BurnInputInfo BulletInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - {"Coin 3" , BIT_DIGITAL , System16InputPort0 + 7, "p3 coin" }, - {"Start 3" , BIT_DIGITAL , System16InputPort0 + 6, "p3 start" }, - - {"P1 Up 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 up" }, - {"P1 Down 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 down" }, - {"P1 Left 1" , BIT_DIGITAL , System16InputPort1 + 3, "p1 left" }, - {"P1 Right 1" , BIT_DIGITAL , System16InputPort1 + 2, "p1 right" }, - {"P1 Up 2" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up 2" }, - {"P1 Down 2" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down 2" }, - {"P1 Left 2" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left 2" }, - {"P1 Right 2" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right 2"}, - - {"P2 Up 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 up" }, - {"P2 Down 1" , BIT_DIGITAL , System16InputPort2 + 0, "p2 down" }, - {"P2 Left 1" , BIT_DIGITAL , System16InputPort2 + 3, "p2 left" }, - {"P2 Right 1" , BIT_DIGITAL , System16InputPort2 + 2, "p2 right" }, - {"P2 Up 2" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up 2" }, - {"P2 Down 2" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down 2" }, - {"P2 Left 2" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left 2" }, - {"P2 Right 2" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right 2"}, - - {"P3 Up 1" , BIT_DIGITAL , System16InputPort3 + 1, "p3 up" }, - {"P3 Down 1" , BIT_DIGITAL , System16InputPort3 + 0, "p3 down" }, - {"P3 Left 1" , BIT_DIGITAL , System16InputPort3 + 3, "p3 left" }, - {"P3 Right 1" , BIT_DIGITAL , System16InputPort3 + 2, "p3 right" }, - {"P3 Up 2" , BIT_DIGITAL , System16InputPort3 + 5, "p3 up 2" }, - {"P3 Down 2" , BIT_DIGITAL , System16InputPort3 + 4, "p3 down 2" }, - {"P3 Left 2" , BIT_DIGITAL , System16InputPort3 + 7, "p3 left 2" }, - {"P3 Right 2" , BIT_DIGITAL , System16InputPort3 + 6, "p3 right 2"}, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Bullet) - -static struct BurnInputInfo DunkshotInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - {"Start 3" , BIT_DIGITAL , System16InputPort0 + 6, "p3 start" }, - {"Start 4" , BIT_DIGITAL , System16InputPort0 + 7, "p4 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort2 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort2 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort2 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort2 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 6, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 7, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 4, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 5, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort1 + 2, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort1 + 3, "p2 fire 2" }, - - {"P3 Up" , BIT_DIGITAL , System16InputPort3 + 2, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , System16InputPort3 + 3, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , System16InputPort3 + 0, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , System16InputPort3 + 1, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , System16InputPort1 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , System16InputPort1 + 5, "p3 fire 2" }, - - {"P4 Up" , BIT_DIGITAL , System16InputPort3 + 6, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , System16InputPort3 + 7, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , System16InputPort3 + 4, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , System16InputPort3 + 5, "p4 right" }, - {"P4 Fire 1" , BIT_DIGITAL , System16InputPort1 + 6, "p4 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , System16InputPort1 + 7, "p4 fire 2" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Dunkshot) - -static struct BurnInputInfo ExctleagInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort4 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort4 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort4 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort4 + 1, "p1 right" }, - {"P1 Bant0" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 1" }, - {"P1 Bant1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 2" }, - {"P1 Bant2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 3" }, - {"P1 Swing0" , BIT_DIGITAL , System16InputPort1 + 3, "p1 fire 4" }, - {"P1 Swing1" , BIT_DIGITAL , System16InputPort1 + 4, "p1 fire 5" }, - {"P1 Low" , BIT_DIGITAL , System16InputPort1 + 5, "p1 fire 6" }, - {"P1 Mid" , BIT_DIGITAL , System16InputPort1 + 6, "p1 fire 7" }, - {"P1 Hi" , BIT_DIGITAL , System16InputPort1 + 7, "p1 fire 8" }, - {"P1 Change" , BIT_DIGITAL , System16InputPort3 + 1, "p1 fire 9" }, - {"P1 Select" , BIT_DIGITAL , System16InputPort3 + 2, "p1 fire 10" }, - {"P1 Chase" , BIT_DIGITAL , System16InputPort3 + 0, "p1 fire 11" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort4 + 6, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort4 + 7, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort4 + 4, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort4 + 5, "p2 right" }, - {"P2 Bant0" , BIT_DIGITAL , System16InputPort2 + 0, "p2 fire 1" }, - {"P2 Bant1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 2" }, - {"P2 Bant2" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 3" }, - {"P2 Swing0" , BIT_DIGITAL , System16InputPort2 + 3, "p2 fire 4" }, - {"P2 Swing1" , BIT_DIGITAL , System16InputPort2 + 4, "p2 fire 5" }, - {"P2 Low" , BIT_DIGITAL , System16InputPort2 + 5, "p2 fire 6" }, - {"P2 Mid" , BIT_DIGITAL , System16InputPort2 + 6, "p2 fire 7" }, - {"P2 Hi" , BIT_DIGITAL , System16InputPort2 + 7, "p2 fire 8" }, - {"P2 Change" , BIT_DIGITAL , System16InputPort3 + 5, "p2 fire 9" }, - {"P2 Select" , BIT_DIGITAL , System16InputPort3 + 6, "p2 fire 10" }, - {"P2 Chase" , BIT_DIGITAL , System16InputPort3 + 4, "p2 fire 11" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Exctleag) - -static struct BurnInputInfo FpointblInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 1" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 1" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Fpointbl) - -static struct BurnInputInfo HwchampInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - A("Left/Right" , BIT_ANALOG_REL, &System16AnalogPort0, "p1 x-axis" ), - A("Left" , BIT_ANALOG_REL, &System16AnalogPort1, "p1 fire 1" ), - A("Right" , BIT_ANALOG_REL, &System16AnalogPort2, "p1 fire 2" ), - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Hwchamp) - -static struct BurnInputInfo PassshtInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - {"Start 3" , BIT_DIGITAL , System16InputPort0 + 6, "p3 start" }, - {"Start 4" , BIT_DIGITAL , System16InputPort0 + 7, "p4 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 1, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 0, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 3, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 2, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 6, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , System16InputPort1 + 7, "p1 fire 4" }, - - {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 1, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 0, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 3, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 2, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 6, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , System16InputPort2 + 7, "p2 fire 4" }, - - {"P3 Up" , BIT_DIGITAL , System16InputPort3 + 1, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , System16InputPort3 + 0, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , System16InputPort3 + 3, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , System16InputPort3 + 2, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , System16InputPort3 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , System16InputPort3 + 5, "p3 fire 2" }, - {"P3 Fire 3" , BIT_DIGITAL , System16InputPort3 + 6, "p3 fire 3" }, - {"P3 Fire 4" , BIT_DIGITAL , System16InputPort3 + 7, "p3 fire 4" }, - - {"P4 Up" , BIT_DIGITAL , System16InputPort4 + 1, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , System16InputPort4 + 0, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , System16InputPort4 + 3, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , System16InputPort4 + 2, "p4 right" }, - {"P4 Fire 1" , BIT_DIGITAL , System16InputPort4 + 4, "p4 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , System16InputPort4 + 5, "p4 fire 2" }, - {"P4 Fire 3" , BIT_DIGITAL , System16InputPort4 + 6, "p4 fire 3" }, - {"P4 Fire 4" , BIT_DIGITAL , System16InputPort4 + 7, "p4 fire 4" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Passsht) - -static struct BurnInputInfo RyukyuInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 2" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Ryukyu) - -static struct BurnInputInfo SdiInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 1, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 0, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 3, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 2, "p1 right" }, - A("Target Left/Right", BIT_ANALOG_REL, &System16AnalogPort0, "mouse x-axis" ), - A("Target Up/Down" , BIT_ANALOG_REL, &System16AnalogPort1, "mouse y-axis" ), - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort0 + 6, "mouse button 1"}, - - {"P2 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p2 right" }, - A("Target Left/Right", BIT_ANALOG_REL, &System16AnalogPort2, "p2 x-axis" ), - A("Target Up/Down" , BIT_ANALOG_REL, &System16AnalogPort3, "p2 y-axis" ), - {"P2 Fire 1" , BIT_DIGITAL , System16InputPort0 + 7, "p2 fire 1" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Sdi) - -static struct BurnInputInfo SjryukoInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, - - {"Mahjong A" , BIT_DIGITAL , System16InputPort1 + 0, "mah a" }, - {"Mahjong B" , BIT_DIGITAL , System16InputPort1 + 1, "mah b" }, - {"Mahjong C" , BIT_DIGITAL , System16InputPort1 + 2, "mah c" }, - {"Mahjong D" , BIT_DIGITAL , System16InputPort1 + 3, "mah d" }, - {"Mahjong E" , BIT_DIGITAL , System16InputPort2 + 0, "mah e" }, - {"Mahjong F" , BIT_DIGITAL , System16InputPort2 + 1, "mah f" }, - {"Mahjong G" , BIT_DIGITAL , System16InputPort2 + 2, "mah g" }, - {"Mahjong H" , BIT_DIGITAL , System16InputPort2 + 3, "mah h" }, - {"Mahjong I" , BIT_DIGITAL , System16InputPort3 + 0, "mah i" }, - {"Mahjong J" , BIT_DIGITAL , System16InputPort3 + 1, "mah j" }, - {"Mahjong K" , BIT_DIGITAL , System16InputPort3 + 2, "mah k" }, - {"Mahjong L" , BIT_DIGITAL , System16InputPort3 + 3, "mah l" }, - {"Mahjong M" , BIT_DIGITAL , System16InputPort4 + 0, "mah m" }, - {"Mahjong N" , BIT_DIGITAL , System16InputPort4 + 1, "mah n" }, - {"Mahjong Kan" , BIT_DIGITAL , System16InputPort6 + 0, "mah kan" }, - {"Mahjong Pon" , BIT_DIGITAL , System16InputPort4 + 3, "mah pon" }, - {"Mahjong Chi" , BIT_DIGITAL , System16InputPort4 + 2, "mah chi" }, - {"Mahjong Reach" , BIT_DIGITAL , System16InputPort6 + 1, "mah reach" }, - {"Mahjong Ron" , BIT_DIGITAL , System16InputPort6 + 2, "mah ron" }, - {"Mahjong Bet" , BIT_DIGITAL , System16InputPort5 + 1, "mah bet" }, - {"Mahjong Last Chance", BIT_DIGITAL , System16InputPort1 + 4, "mah lc" }, - {"Mahjong Score" , BIT_DIGITAL , System16InputPort5 + 0, "mah score" }, - {"Mahjong Flip Flop" , BIT_DIGITAL , System16InputPort4 + 4, "mah ff" }, - - {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, - {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Sjryuko) - -static struct BurnInputInfo SnapperInputList[] = { - {"Coin 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 start" }, - - {"P1 Up" , BIT_DIGITAL , System16InputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , System16InputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , System16InputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , System16InputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , System16InputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , System16InputPort0 + 6, "p1 fire 3" }, - - {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, -}; - -STDINPUTINFO(Snapper) - -#undef A - -/*==================================================== -Dip defs -====================================================*/ - -#define SYSTEM16B_COINAGE(dipval) \ - {0 , 0xfe, 0 , 16 , "Coin A" }, \ - {dipval, 0x01, 0x0f, 0x07, "4 Coins 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x08, "3 Coins 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x09, "2 Coins 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x05, "2 Coins 1 Credit 5/3 6/4" }, \ - {dipval, 0x01, 0x0f, 0x04, "2 Coins 1 Credit 4/3" }, \ - {dipval, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, \ - {dipval, 0x01, 0x0f, 0x01, "1 Coin 1 Credit 2/3" }, \ - {dipval, 0x01, 0x0f, 0x02, "1 Coin 1 Credit 4/5" }, \ - {dipval, 0x01, 0x0f, 0x03, "1 Coin 1 Credit 5/6" }, \ - {dipval, 0x01, 0x0f, 0x06, "2 Coins 3 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, \ - {dipval, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, \ - {dipval, 0x01, 0x0f, 0x00, "Free Play (if coin B too) or 1C/1C" }, \ - \ - {0 , 0xfe, 0 , 16 , "Coin B" }, \ - {dipval, 0x01, 0xf0, 0x70, "4 Coins 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x80, "3 Coins 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x90, "2 Coins 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x50, "2 Coins 1 Credit 5/3 6/4" }, \ - {dipval, 0x01, 0xf0, 0x40, "2 Coins 1 Credit 4/3" }, \ - {dipval, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, \ - {dipval, 0x01, 0xf0, 0x10, "1 Coin 1 Credit 2/3" }, \ - {dipval, 0x01, 0xf0, 0x20, "1 Coin 1 Credit 4/5" }, \ - {dipval, 0x01, 0xf0, 0x30, "1 Coin 1 Credit 5/6" }, \ - {dipval, 0x01, 0xf0, 0x60, "2 Coins 3 Credits" }, \ - {dipval, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, \ - {dipval, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, \ - {dipval, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, \ - {dipval, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, \ - {dipval, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, \ - {dipval, 0x01, 0xf0, 0x00, "Free Play (if coin A too) or 1C/1C" }, - -static struct BurnDIPInfo AliensynDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfd, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x0c, 0x08, "2" }, - {0x11, 0x01, 0x0c, 0x0c, "3" }, - {0x11, 0x01, 0x0c, 0x04, "4" }, - {0x11, 0x01, 0x0c, 0x00, "127" }, - - {0 , 0xfe, 0 , 4 , "Timer" }, - {0x11, 0x01, 0x30, 0x00, "120" }, - {0x11, 0x01, 0x30, 0x10, "130" }, - {0x11, 0x01, 0x30, 0x20, "140" }, - {0x11, 0x01, 0x30, 0x30, "150" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0xc0, 0x80, "Easy" }, - {0x11, 0x01, 0xc0, 0xc0, "Normal" }, - {0x11, 0x01, 0xc0, 0x40, "Hard" }, - {0x11, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x12) -}; - -STDDIPINFO(Aliensyn) - -static struct BurnDIPInfo AliensynjDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfd, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0x0c, 0x08, "2" }, - {0x11, 0x01, 0x0c, 0x0c, "3" }, - {0x11, 0x01, 0x0c, 0x04, "4" }, - {0x11, 0x01, 0x0c, 0x00, "127" }, - - {0 , 0xfe, 0 , 4 , "Timer" }, - {0x11, 0x01, 0x30, 0x00, "150" }, - {0x11, 0x01, 0x30, 0x10, "160" }, - {0x11, 0x01, 0x30, 0x20, "170" }, - {0x11, 0x01, 0x30, 0x30, "180" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0xc0, 0x80, "Easy" }, - {0x11, 0x01, 0xc0, 0xc0, "Normal" }, - {0x11, 0x01, 0xc0, 0x40, "Hard" }, - {0x11, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x12) -}; - -STDDIPINFO(Aliensynj) - -static struct BurnDIPInfo AltbeastDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfd, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Credits needed" }, - {0x15, 0x01, 0x01, 0x01, "1 to start, 1 to continue" }, - {0x15, 0x01, 0x01, 0x00, "2 to start, 1 to continue" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x0c, 0x08, "2" }, - {0x15, 0x01, 0x0c, 0x0c, "3" }, - {0x15, 0x01, 0x0c, 0x04, "4" }, - {0x15, 0x01, 0x0c, 0x00, "240" }, - - {0 , 0xfe, 0 , 4 , "Energy Meter" }, - {0x15, 0x01, 0x30, 0x20, "2" }, - {0x15, 0x01, 0x30, 0x30, "3" }, - {0x15, 0x01, 0x30, 0x10, "4" }, - {0x15, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0xc0, 0x80, "Easy" }, - {0x15, 0x01, 0xc0, 0xc0, "Normal" }, - {0x15, 0x01, 0xc0, 0x40, "Hard" }, - {0x15, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x16) -}; - -STDDIPINFO(Altbeast) - -static struct BurnDIPInfo AtomicpDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0x2f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credit" }, - {0x11, 0x01, 0x38, 0x20, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x38, 0x18, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x38, 0x10, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x38, 0x08, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x38, 0x30, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 8 , "Coin B" }, - {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credit" }, - {0x11, 0x01, 0x07, 0x04, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x07, 0x03, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x07, 0x02, "1 Coin 2 Credits" }, - {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x11, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, - {0x11, 0x01, 0x07, 0x06, "1 Coin 5 Credits" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x11, 0x01, 0xc0, 0xc0, "1" }, - {0x11, 0x01, 0xc0, 0x80, "2" }, - {0x11, 0x01, 0xc0, 0x40, "3" }, - {0x11, 0x01, 0xc0, 0x00, "5" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x03, 0x01, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Normal" }, - {0x12, 0x01, 0x03, 0x02, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Level Select" }, - {0x12, 0x01, 0x04, 0x04, "Off" }, - {0x12, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x12, 0x01, 0x10, 0x10, "Off" }, - {0x12, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x12, 0x01, 0x20, 0x00, "Off" }, - {0x12, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Game Mode" }, - {0x12, 0x01, 0x40, 0x40, "Normal Tetris" }, - {0x12, 0x01, 0x40, 0x00, "Atomic Point" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x12, 0x01, 0x80, 0x00, "Off" }, - {0x12, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Atomicp) - -static struct BurnDIPInfo AurailDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfd, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x15, 0x01, 0x01, 0x01, "Upright" }, - {0x15, 0x01, 0x01, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x0c, 0x00, "2" }, - {0x15, 0x01, 0x0c, 0x0c, "3" }, - {0x15, 0x01, 0x0c, 0x08, "4" }, - {0x15, 0x01, 0x0c, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x15, 0x01, 0x10, 0x10, "80k, 200k, 500k, 1000k" }, - {0x15, 0x01, 0x10, 0x00, "100k, 300k, 700k, 1000k" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x15, 0x01, 0x20, 0x20, "Normal" }, - {0x15, 0x01, 0x20, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Controller Select" }, - {0x15, 0x01, 0x40, 0x40, "1 Player Side" }, - {0x15, 0x01, 0x40, 0x00, "2 Players Side" }, - - {0 , 0xfe, 0 , 2 , "Special Function Mode" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x16) -}; - -STDDIPINFO(Aurail) - -static struct BurnDIPInfo BayrouteDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfd, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x01, 0x00, "Off" }, - {0x15, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x0c, 0x04, "1" }, - {0x15, 0x01, 0x0c, 0x0c, "3" }, - {0x15, 0x01, 0x0c, 0x08, "5" }, - {0x15, 0x01, 0x0c, 0x00, "Unlimited" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x15, 0x01, 0x30, 0x30, "100000" }, - {0x15, 0x01, 0x30, 0x20, "150000" }, - {0x15, 0x01, 0x30, 0x10, "200000" }, - {0x15, 0x01, 0x30, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0xc0, 0xc0, "Easy" }, - {0x15, 0x01, 0xc0, 0x80, "Normal" }, - {0x15, 0x01, 0xc0, 0x40, "Hard" }, - {0x15, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x16) -}; - -STDDIPINFO(Bayroute) - -static struct BurnDIPInfo Blox16bDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfe, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, -}; - -STDDIPINFO(Blox16b) - -static struct BurnDIPInfo BulletDIPList[]= -{ - // Default Values - {0x21, 0xff, 0xff, 0xff, NULL }, - {0x22, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - - // Dip 2 - SYSTEM16B_COINAGE(0x22) -}; - -STDDIPINFO(Bullet) - -static struct BurnDIPInfo CottonDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x06, 0x04, "2" }, - {0x13, 0x01, 0x06, 0x06, "3" }, - {0x13, 0x01, 0x06, 0x02, "4" }, - {0x13, 0x01, 0x06, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x18, 0x10, "Easy" }, - {0x13, 0x01, 0x18, 0x18, "Normal" }, - {0x13, 0x01, 0x18, 0x08, "Hard" }, - {0x13, 0x01, 0x18, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x14) -}; - -STDDIPINFO(Cotton) - -static struct BurnDIPInfo DduxDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0x06, 0x04, "Easy" }, - {0x13, 0x01, 0x06, 0x06, "Normal" }, - {0x13, 0x01, 0x06, 0x02, "Hard" }, - {0x13, 0x01, 0x06, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x18, 0x10, "2" }, - {0x13, 0x01, 0x18, 0x18, "3" }, - {0x13, 0x01, 0x18, 0x08, "4" }, - {0x13, 0x01, 0x18, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x60, 0x40, "150000" }, - {0x13, 0x01, 0x60, 0x60, "200000" }, - {0x13, 0x01, 0x60, 0x20, "300000" }, - {0x13, 0x01, 0x60, 0x00, "400000" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x14) -}; - -STDDIPINFO(Ddux) - -static struct BurnDIPInfo DunkshotDIPList[]= -{ - // Default Values - {0x21, 0xff, 0xff, 0xfd, NULL }, - {0x22, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x21, 0x01, 0x02, 0x02, "Off" }, - {0x21, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "VS Time" }, - {0x21, 0x01, 0x0c, 0x08, "2P 1:30 | 3P 2:00 | 4P 2:30" }, - {0x21, 0x01, 0x0c, 0x0c, "2P 2:00 | 3P 2:30 | 4P 3:00" }, - {0x21, 0x01, 0x0c, 0x04, "2P 2:30 | 3P 3:00 | 4P 3:30" }, - {0x21, 0x01, 0x0c, 0x00, "2P 3:00 | 3P 3:30 | 4P 4:00" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x21, 0x01, 0x30, 0x20, "Easy" }, - {0x21, 0x01, 0x30, 0x30, "Normal" }, - {0x21, 0x01, 0x30, 0x10, "Hard" }, - {0x21, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "CPU starts with +6 pts" }, - {0x21, 0x01, 0x40, 0x40, "Off" }, - {0x21, 0x01, 0x40, 0x00, "On" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x22) -}; - -STDDIPINFO(Dunkshot) - -static struct BurnDIPInfo EswatDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfd, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "2 Credits to Start" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Time" }, - {0x15, 0x01, 0x08, 0x08, "Normal" }, - {0x15, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x30, 0x20, "Easy" }, - {0x15, 0x01, 0x30, 0x30, "Normal" }, - {0x15, 0x01, 0x30, 0x10, "Hard" }, - {0x15, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0xc0, 0x00, "1" }, - {0x15, 0x01, 0xc0, 0x40, "2" }, - {0x15, 0x01, 0xc0, 0xc0, "3" }, - {0x15, 0x01, 0xc0, 0x80, "4" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x16) -}; - -STDDIPINFO(Eswat) - -static struct BurnDIPInfo ExctleagDIPList[]= -{ - // Default Values - {0x25, 0xff, 0xff, 0xfe, NULL }, - {0x26, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x25, 0x01, 0x01, 0x01, "Off" }, - {0x25, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Starting Points" }, - {0x25, 0x01, 0x0e, 0x06, "2000" }, - {0x25, 0x01, 0x0e, 0x0a, "3000" }, - {0x25, 0x01, 0x0e, 0x0c, "4000" }, - {0x25, 0x01, 0x0e, 0x0e, "5000" }, - {0x25, 0x01, 0x0e, 0x08, "6000" }, - {0x25, 0x01, 0x0e, 0x04, "7000" }, - {0x25, 0x01, 0x0e, 0x02, "8000" }, - {0x25, 0x01, 0x0e, 0x00, "9000" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x25, 0x01, 0x30, 0x20, "Easy" }, - {0x25, 0x01, 0x30, 0x30, "Normal" }, - {0x25, 0x01, 0x30, 0x10, "Hard" }, - {0x25, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Point Table" }, - {0x25, 0x01, 0xc0, 0x80, "Easy" }, - {0x25, 0x01, 0xc0, 0xc0, "Normal" }, - {0x25, 0x01, 0xc0, 0x40, "Hard" }, - {0x25, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 1 - SYSTEM16B_COINAGE(0x26) -}; - -STDDIPINFO(Exctleag) - -static struct BurnDIPInfo Fantzn2xDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x0c, 0x08, "2" }, - {0x13, 0x01, 0x0c, 0x0c, "3" }, - {0x13, 0x01, 0x0c, 0x04, "4" }, - {0x13, 0x01, 0x0c, 0x00, "240" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0xc0, 0x80, "Easy" }, - {0x13, 0x01, 0xc0, 0xc0, "Normal" }, - {0x13, 0x01, 0xc0, 0x40, "Hard" }, - {0x13, 0x01, 0xc0, 0x00, "Hardest" }, -}; - -STDDIPINFO(Fantzn2x) - -static struct BurnDIPInfo FpointDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfd, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x30, 0x20, "Easy" }, - {0x11, 0x01, 0x30, 0x30, "Normal" }, - {0x11, 0x01, 0x30, 0x10, "Hard" }, - {0x11, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Clear Round Allowed" }, - {0x11, 0x01, 0x40, 0x00, "1" }, - {0x11, 0x01, 0x40, 0x40, "2" }, - - {0 , 0xfe, 0 , 2 , "Cell Move" }, - {0x11, 0x01, 0x80, 0x00, "Off" }, - {0x11, 0x01, 0x80, 0x80, "On" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x12) -}; - -STDDIPINFO(Fpoint) - -static struct BurnDIPInfo GoldnaxeDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfd, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Credits needed" }, - {0x15, 0x01, 0x01, 0x01, "1 to start, 1 to continue" }, - {0x15, 0x01, 0x01, 0x00, "2 to start, 1 to continue" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x0c, 0x08, "1" }, - {0x15, 0x01, 0x0c, 0x0c, "2" }, - {0x15, 0x01, 0x0c, 0x04, "3" }, - {0x15, 0x01, 0x0c, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Energy Meter" }, - {0x15, 0x01, 0x30, 0x20, "2" }, - {0x15, 0x01, 0x30, 0x30, "3" }, - {0x15, 0x01, 0x30, 0x10, "4" }, - {0x15, 0x01, 0x30, 0x00, "5" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x16) -}; - -STDDIPINFO(Goldnaxe) - -static struct BurnDIPInfo HwchampDIPList[]= -{ - // Default Values - {0x0a, 0xff, 0xff, 0xf9, NULL }, - {0x0b, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0a, 0x01, 0x02, 0x02, "Off" }, - {0x0a, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Start Level Select" }, - {0x0a, 0x01, 0x04, 0x04, "Off" }, - {0x0a, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0a, 0x01, 0x08, 0x08, "Off" }, - {0x0a, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0a, 0x01, 0x30, 0x20, "Easy" }, - {0x0a, 0x01, 0x30, 0x30, "Normal" }, - {0x0a, 0x01, 0x30, 0x10, "Hard" }, - {0x0a, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Time Adjust" }, - {0x0a, 0x01, 0xc0, 0x80, "Easy" }, - {0x0a, 0x01, 0xc0, 0xc0, "Normal" }, - {0x0a, 0x01, 0xc0, 0x40, "Hard" }, - {0x0a, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x0b) -}; - -STDDIPINFO(Hwchamp) - -static struct BurnDIPInfo MvpDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfd, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Credits Needed" }, - {0x15, 0x01, 0x01, 0x01, "1 to start, 1 to continue" }, - {0x15, 0x01, 0x01, 0x00, "2 to start, 1 to continue" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Innings" }, - {0x15, 0x01, 0x04, 0x04, "1 Credit 1 Inning Only" }, - {0x15, 0x01, 0x04, 0x0c, "+2 Credits 3 Innings" }, - - {0 , 0xfe, 0 , 8 , "Time Limits" }, - {0x15, 0x01, 0x38, 0x18, "Easy" }, - {0x15, 0x01, 0x38, 0x28, "Easy 2" }, - {0x15, 0x01, 0x38, 0x08, "Easy 3" }, - {0x15, 0x01, 0x38, 0x38, "Normal" }, - {0x15, 0x01, 0x38, 0x30, "Hard" }, - {0x15, 0x01, 0x38, 0x10, "Hard 2" }, - {0x15, 0x01, 0x38, 0x20, "Hard 3" }, - {0x15, 0x01, 0x38, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0xc0, 0x80, "Easy" }, - {0x15, 0x01, 0xc0, 0x40, "Easy 2" }, - {0x15, 0x01, 0xc0, 0xc0, "Normal" }, - {0x15, 0x01, 0xc0, 0x30, "Hard" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x16) -}; - -STDDIPINFO(Mvp) - -static struct BurnDIPInfo PassshtDIPList[]= -{ - // Default Values - {0x17, 0xff, 0xff, 0xf0, NULL }, - {0x18, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x17, 0x01, 0x01, 0x01, "Off" }, - {0x17, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Initial Point" }, - {0x17, 0x01, 0x0e, 0x06, "2000" }, - {0x17, 0x01, 0x0e, 0x0a, "3000" }, - {0x17, 0x01, 0x0e, 0x0c, "4000" }, - {0x17, 0x01, 0x0e, 0x0e, "5000" }, - {0x17, 0x01, 0x0e, 0x08, "6000" }, - {0x17, 0x01, 0x0e, 0x04, "7000" }, - {0x17, 0x01, 0x0e, 0x02, "8000" }, - {0x17, 0x01, 0x0e, 0x00, "9000" }, - - {0 , 0xfe, 0 , 4 , "Point Table" }, - {0x17, 0x01, 0x30, 0x20, "Easy" }, - {0x17, 0x01, 0x30, 0x30, "Normal" }, - {0x17, 0x01, 0x30, 0x10, "Hard" }, - {0x17, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x17, 0x01, 0xc0, 0x80, "Easy" }, - {0x17, 0x01, 0xc0, 0xc0, "Normal" }, - {0x17, 0x01, 0xc0, 0x40, "Hard" }, - {0x17, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x18) -}; - -STDDIPINFO(Passsht) - - -static struct BurnDIPInfo PassshtaDIPList[]= -{ - // Default Values - {0x29, 0xff, 0xff, 0xf0, NULL }, - {0x2a, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x29, 0x01, 0x01, 0x01, "Off" }, - {0x29, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 8 , "Initial Point" }, - {0x29, 0x01, 0x0e, 0x06, "2000" }, - {0x29, 0x01, 0x0e, 0x0a, "3000" }, - {0x29, 0x01, 0x0e, 0x0c, "4000" }, - {0x29, 0x01, 0x0e, 0x0e, "5000" }, - {0x29, 0x01, 0x0e, 0x08, "6000" }, - {0x29, 0x01, 0x0e, 0x04, "7000" }, - {0x29, 0x01, 0x0e, 0x02, "8000" }, - {0x29, 0x01, 0x0e, 0x00, "9000" }, - - {0 , 0xfe, 0 , 4 , "Point Table" }, - {0x29, 0x01, 0x30, 0x20, "Easy" }, - {0x29, 0x01, 0x30, 0x30, "Normal" }, - {0x29, 0x01, 0x30, 0x10, "Hard" }, - {0x29, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x29, 0x01, 0xc0, 0x80, "Easy" }, - {0x29, 0x01, 0xc0, 0xc0, "Normal" }, - {0x29, 0x01, 0xc0, 0x40, "Hard" }, - {0x29, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x2a) -}; - -STDDIPINFO(Passshta) - -static struct BurnDIPInfo RiotcityDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfd, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "2 Credits to Start" }, - {0x13, 0x01, 0x01, 0x01, "Off" }, - {0x13, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x0c, 0x00, "1" }, - {0x13, 0x01, 0x0c, 0x0c, "2" }, - {0x13, 0x01, 0x0c, 0x08, "3" }, - {0x13, 0x01, 0x0c, 0x04, "4" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x30, 0x20, "Easy" }, - {0x13, 0x01, 0x30, 0x30, "Normal" }, - {0x13, 0x01, 0x30, 0x10, "Hard" }, - {0x13, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x13, 0x01, 0x40, 0x40, "Normal" }, - {0x13, 0x01, 0x40, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Attack button to start" }, - {0x13, 0x01, 0x80, 0x80, "Off" }, - {0x13, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x14) -}; - -STDDIPINFO(Riotcity) - -static struct BurnDIPInfo RyukyuDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0xf8, NULL }, - {0x0e, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x01, 0x01, "Off" }, - {0x0d, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Cancel per credit" }, - {0x0d, 0x01, 0x02, 0x00, "2" }, - {0x0d, 0x01, 0x02, 0x02, "3" }, - - {0 , 0xfe, 0 , 2 , "Timer Speed" }, - {0x0d, 0x01, 0x04, 0x04, "20 seconds" }, - {0x0d, 0x01, 0x04, 0x00, "30 seconds" }, - - {0 , 0xfe, 0 , 2 , "PCM Voice" }, - {0x0d, 0x01, 0x08, 0x00, "Off" }, - {0x0d, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Omikuji Difficulty" }, - {0x0d, 0x01, 0x30, 0x20, "Easy" }, - {0x0d, 0x01, 0x30, 0x30, "Normal" }, - {0x0d, 0x01, 0x30, 0x10, "Hard" }, - {0x0d, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0d, 0x01, 0xc0, 0x80, "Easy" }, - {0x0d, 0x01, 0xc0, 0xc0, "Normal" }, - {0x0d, 0x01, 0xc0, 0x40, "Hard" }, - {0x0d, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x0e) -}; - -STDDIPINFO(Ryukyu) - -static struct BurnDIPInfo SdibDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfd, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x01, 0x01, "No" }, - {0x15, 0x01, 0x01, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x0c, 0x08, "2" }, - {0x15, 0x01, 0x0c, 0x0c, "3" }, - {0x15, 0x01, 0x0c, 0x04, "4" }, - {0x15, 0x01, 0x0c, 0x00, "Free" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x30, 0x20, "Easy" }, - {0x15, 0x01, 0x30, 0x30, "Normal" }, - {0x15, 0x01, 0x30, 0x10, "Hard" }, - {0x15, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x15, 0x01, 0xc0, 0x80, "Every 50000" }, - {0x15, 0x01, 0xc0, 0xc0, "50000" }, - {0x15, 0x01, 0xc0, 0x40, "100000" }, - {0x15, 0x01, 0xc0, 0x00, "None" }, - - // Dip 1 - SYSTEM16B_COINAGE(0x16) -}; - -STDDIPINFO(Sdib) - -static struct BurnDIPInfo ShinobiDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfc, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x15, 0x01, 0x01, 0x00, "Upright" }, - {0x15, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x0c, 0x08, "2" }, - {0x15, 0x01, 0x0c, 0x0c, "3" }, - {0x15, 0x01, 0x0c, 0x04, "5" }, - {0x15, 0x01, 0x0c, 0x00, "240" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x30, 0x20, "Easy" }, - {0x15, 0x01, 0x30, 0x30, "Normal" }, - {0x15, 0x01, 0x30, 0x10, "Hard" }, - {0x15, 0x01, 0x30, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Enemy Bullet Speed" }, - {0x15, 0x01, 0x40, 0x40, "Slow" }, - {0x15, 0x01, 0x40, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x15, 0x01, 0x80, 0x80, "Japanese" }, - {0x15, 0x01, 0x80, 0x00, "English" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x16) -}; - -STDDIPINFO(Shinobi) - -static struct BurnDIPInfo SonicbomDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0x7f, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x13, 0x01, 0x07, 0x06, "Easy" }, - {0x13, 0x01, 0x07, 0x07, "Normal" }, - {0x13, 0x01, 0x07, 0x05, "Hard 1" }, - {0x13, 0x01, 0x07, 0x04, "Hard 2" }, - {0x13, 0x01, 0x07, 0x03, "Hard 3" }, - {0x13, 0x01, 0x07, 0x02, "Hard 4" }, - {0x13, 0x01, 0x07, 0x01, "Hard 5" }, - {0x13, 0x01, 0x07, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x18, 0x10, "2" }, - {0x13, 0x01, 0x18, 0x18, "3" }, - {0x13, 0x01, 0x18, 0x08, "4" }, - {0x13, 0x01, 0x18, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x13, 0x01, 0x60, 0x40, "30000" }, - {0x13, 0x01, 0x60, 0x60, "40000" }, - {0x13, 0x01, 0x60, 0x20, "50000" }, - {0x13, 0x01, 0x60, 0x00, "60000" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x80, 0x00, "Upright" }, - {0x13, 0x01, 0x80, 0x80, "Cocktail" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x14) -}; - -STDDIPINFO(Sonicbom) - -static struct BurnDIPInfo SjryukoDIPList[]= -{ - // Default Values - {0x1c, 0xff, 0xff, 0xff, NULL }, - {0x1d, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - - - // Dip 2 - SYSTEM16B_COINAGE(0x1d) -}; - -STDDIPINFO(Sjryuko) - -static struct BurnDIPInfo SnapperDIPList[]= -{ - // Default Values - {0x0a, 0xff, 0xff, 0xff, NULL }, - {0x0b, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 8 , "Coin A" }, - {0x0a, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, - {0x0a, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, - {0x0a, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, - {0x0a, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, - {0x0a, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, - {0x0a, 0x01, 0x07, 0x02, "2 Coins 1 Credit" }, - {0x0a, 0x01, 0x07, 0x01, "3 Coins 1 Credit" }, - {0x0a, 0x01, 0x07, 0x00, "4 Coins 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0a, 0x01, 0x18, 0x10, "3" }, - {0x0a, 0x01, 0x18, 0x18, "4" }, - {0x0a, 0x01, 0x18, 0x08, "5" }, - {0x0a, 0x01, 0x18, 0x00, "6" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x10, 0x00, "Off" }, - {0x0b, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x80, 0x80, "Off" }, - {0x0b, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Snapper) - -static struct BurnDIPInfo TetrisDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfd, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x30, 0x20, "Easy" }, - {0x11, 0x01, 0x30, 0x30, "Normal" }, - {0x11, 0x01, 0x30, 0x10, "Hard" }, - {0x11, 0x01, 0x30, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x12) -}; - -STDDIPINFO(Tetris) - -static struct BurnDIPInfo TimescanDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xf5, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Cocktail" }, - {0x13, 0x01, 0x01, 0x01, "Upright" }, - - {0 , 0xfe, 0 , 16 , "Bonus" }, - {0x13, 0x01, 0x1e, 0x16, "Replay 1000000/2000000" }, - {0x13, 0x01, 0x1e, 0x14, "Replay 1200000/2500000" }, - {0x13, 0x01, 0x1e, 0x12, "Replay 1500000/3000000" }, - {0x13, 0x01, 0x1e, 0x10, "Replay 2000000/4000000" }, - {0x13, 0x01, 0x1e, 0x1c, "Replay 1000000" }, - {0x13, 0x01, 0x1e, 0x1e, "Replay 1200000" }, - {0x13, 0x01, 0x1e, 0x1a, "Replay 1500000" }, - {0x13, 0x01, 0x1e, 0x18, "Replay 1800000" }, - {0x13, 0x01, 0x1e, 0x0e, "Extra Ball 100000" }, - {0x13, 0x01, 0x1e, 0x0c, "Extra Ball 200000" }, - {0x13, 0x01, 0x1e, 0x0a, "Extra Ball 300000" }, - {0x13, 0x01, 0x1e, 0x08, "Extra Ball 400000" }, - {0x13, 0x01, 0x1e, 0x06, "Extra Ball 500000" }, - {0x13, 0x01, 0x1e, 0x04, "Extra Ball 600000" }, - {0x13, 0x01, 0x1e, 0x02, "Extra Ball 700000" }, - {0x13, 0x01, 0x1e, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Match" }, - {0x13, 0x01, 0x20, 0x00, "Off" }, - {0x13, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2 , "Pin Rebound" }, - {0x13, 0x01, 0x40, 0x40, "Well" }, - {0x13, 0x01, 0x40, 0x00, "A Little" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x13, 0x01, 0x80, 0x80, "3" }, - {0x13, 0x01, 0x80, 0x00, "5" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x14) - - // Dip 3 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Out Lane Pin" }, - {0x15, 0x01, 0x02, 0x02, "Near" }, - {0x15, 0x01, 0x02, 0x00, "Far" }, - - {0 , 0xfe, 0 , 4 , "Special" }, - {0x15, 0x01, 0x0c, 0x08, "7 Credits" }, - {0x15, 0x01, 0x0c, 0x0c, "3 Credits" }, - {0x15, 0x01, 0x0c, 0x04, "1 Credit" }, - {0x15, 0x01, 0x0c, 0x00, "2000000 Points" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x10, 0x00, "No" }, - {0x15, 0x01, 0x10, 0x10, "Yes" }, -}; - -STDDIPINFO(Timescan) - -static struct BurnDIPInfo ToryumonDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfe, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x01, 0x01, "Off" }, - {0x11, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "VS-Mode Battle" }, - {0x11, 0x01, 0x10, 0x10, "1" }, - {0x11, 0x01, 0x10, 0x00, "3" }, - - {0 , 0xfe, 0 , 8 , "Difficulty" }, - {0x11, 0x01, 0xe0, 0xc0, "Easy" }, - {0x11, 0x01, 0xe0, 0xe0, "Normal" }, - {0x11, 0x01, 0xe0, 0xa0, "Hard" }, - {0x11, 0x01, 0xe0, 0x80, "Hard+1" }, - {0x11, 0x01, 0xe0, 0x60, "Hard+2" }, - {0x11, 0x01, 0xe0, 0x40, "Hard+3" }, - {0x11, 0x01, 0xe0, 0x20, "Hard+4" }, - {0x11, 0x01, 0xe0, 0x00, "Hard+5" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x12) -}; - -STDDIPINFO(Toryumon) - -static struct BurnDIPInfo TturfDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0x2c, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Continues" }, - {0x15, 0x01, 0x03, 0x00, "None" }, - {0x15, 0x01, 0x03, 0x01, "3" }, - {0x15, 0x01, 0x03, 0x02, "Unlimited" }, - {0x15, 0x01, 0x03, 0x03, "Unlimited" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x0c, 0x08, "Easy" }, - {0x15, 0x01, 0x0c, 0x0c, "Normal" }, - {0x15, 0x01, 0x0c, 0x04, "Hard" }, - {0x15, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Starting Energy" }, - {0x15, 0x01, 0x30, 0x00, "3" }, - {0x15, 0x01, 0x30, 0x10, "4" }, - {0x15, 0x01, 0x30, 0x20, "6" }, - {0x15, 0x01, 0x30, 0x30, "8" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x40, 0x40, "Off" }, - {0x15, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Bonus Energy" }, - {0x15, 0x01, 0x80, 0x80, "1" }, - {0x15, 0x01, 0x80, 0x00, "2" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x16) -}; - -STDDIPINFO(Tturf) - -static struct BurnDIPInfo Wb3DIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfd, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x0c, 0x00, "2" }, - {0x13, 0x01, 0x0c, 0x0c, "3" }, - {0x13, 0x01, 0x0c, 0x08, "4" }, - {0x13, 0x01, 0x0c, 0x04, "5" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x13, 0x01, 0x10, 0x10, "5k, 10k, 18k, 30k" }, - {0x13, 0x01, 0x10, 0x00, "5k, 15k, 30k" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x13, 0x01, 0x20, 0x20, "Normal" }, - {0x13, 0x01, 0x20, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Invincible Mode" }, - {0x13, 0x01, 0x40, 0x40, "No" }, - {0x13, 0x01, 0x40, 0x00, "Yes" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x14) -}; - -STDDIPINFO(Wb3) - -static struct BurnDIPInfo WrestwarDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfd, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Round Time" }, - {0x13, 0x01, 0x0c, 0x00, "100" }, - {0x13, 0x01, 0x0c, 0x0c, "110" }, - {0x13, 0x01, 0x0c, 0x08, "120" }, - {0x13, 0x01, 0x0c, 0x04, "130" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x13, 0x01, 0x20, 0x00, "No" }, - {0x13, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x13, 0x01, 0xc0, 0x80, "Easy" }, - {0x13, 0x01, 0xc0, 0xc0, "Normal" }, - {0x13, 0x01, 0xc0, 0x40, "Hard" }, - {0x13, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 2 - SYSTEM16B_COINAGE(0x14) -}; - -STDDIPINFO(Wrestwar) - -#undef SYSTEM16B_COINAGE - -/*==================================================== -Rom defs -====================================================*/ - -static struct BurnRomInfo AceattacRomDesc[] = { - { "epr-11491.a4", 0x10000, 0xf3c19c36, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11489.a1", 0x10000, 0xbbe623c5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11492.a5", 0x10000, 0xd8bd3139, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11490.a2", 0x10000, 0x38cb3a41, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11493.b9", 0x10000, 0x654485d9, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11494.b10", 0x10000, 0xb67971ab, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11495.b11", 0x10000, 0xb687ab61, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11501.b1", 0x10000, 0x09179ead, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11505.b5", 0x10000, 0xb67f1ecf, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11502.b2", 0x10000, 0xa3ee36b8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11506.b6", 0x10000, 0xb0104def, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11503.b3", 0x10000, 0x344c0692, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11507.b7", 0x10000, 0xa2af710a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11504.b4", 0x10000, 0x7cae7920, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11508.b8", 0x10000, 0x5cbb833c, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11496.a7", 0x08000, 0x82cb40a9, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11497.a8", 0x08000, 0xb04f62cc, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11498.a9", 0x08000, 0x97baf52b, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11499.a10", 0x08000, 0xea332866, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11500.a11", 0x08000, 0x2ddf1c31, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0059.key", 0x02000, 0x00000000, SYS16_ROM_KEY | BRF_ESS | BRF_PRG | BRF_NODUMP }, -}; - - -STD_ROM_PICK(Aceattac) -STD_ROM_FN(Aceattac) - -static struct BurnRomInfo AliensynRomDesc[] = { - { "epr-11083.a4", 0x08000, 0xcb2ad9b3, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11080.a1", 0x08000, 0xfe7378d9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11084.a5", 0x08000, 0x2e1ec7b1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11081.a2", 0x08000, 0x1308ee63, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11085.a6", 0x08000, 0xcff78f39, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11082.a3", 0x08000, 0x9cdc2a14, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10702.b9", 0x10000, 0x393bc813, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10703.b10", 0x10000, 0x6b6dd9f5, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10704.b11", 0x10000, 0x911e7ebc, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10709.b1", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10713.b5", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10710.b2", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10714.b6", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10711.b3", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10715.b7", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10712.b4", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10716.b8", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10723.a7", 0x08000, 0x99953526, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-10724.a8", 0x08000, 0xf971a817, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-10725.a9", 0x08000, 0x6a50e08f, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-10726.a10", 0x08000, 0xd50b7736, SYS16_ROM_UPD7759DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Aliensyn) -STD_ROM_FN(Aliensyn) - -static struct BurnRomInfo Aliensyn3RomDesc[] = { - { "epr-10816.a4", 0x08000, 0x17bf5304, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10814.a1", 0x08000, 0x4cd134df, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10817.a5", 0x08000, 0xc8b791b0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10815.a2", 0x08000, 0xbdcf4a30, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10822a.a6", 0x08000, 0x1d0790aa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10819a.a3", 0x08000, 0x1e7586b7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10702.b9", 0x10000, 0x393bc813, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10703.b10", 0x10000, 0x6b6dd9f5, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10704.b11", 0x10000, 0x911e7ebc, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10709.b1", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10713.b5", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10710.b2", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10714.b6", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10711.b3", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10715.b7", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10712.b4", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10716.b8", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10723.a7", 0x08000, 0x99953526, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-10724.a8", 0x08000, 0xf971a817, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-10725.a9", 0x08000, 0x6a50e08f, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-10726.a10", 0x08000, 0xd50b7736, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0033.key", 0x02000, 0x49e882e5, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Aliensyn3) -STD_ROM_FN(Aliensyn3) - -static struct BurnRomInfo AliensynjRomDesc[] = { - { "epr-10720a.a4", 0x08000, 0x1b920893, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10717a.a1", 0x08000, 0x972ae358, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10721a.a5", 0x08000, 0xf4d2d1c3, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10718a.a2", 0x08000, 0xc79bf61b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10722a.a6", 0x08000, 0x1d0790aa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10719a.a3", 0x08000, 0x1e7586b7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10702.b9", 0x10000, 0x393bc813, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10703.b10", 0x10000, 0x6b6dd9f5, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10704.b11", 0x10000, 0x911e7ebc, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10709.b1", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10713.b5", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10710.b2", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10714.b6", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10711.b3", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10715.b7", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10712.b4", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10716.b8", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10723.a7", 0x08000, 0x99953526, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-10724.a8", 0x08000, 0xf971a817, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-10725.a9", 0x08000, 0x6a50e08f, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-10726.a10", 0x08000, 0xd50b7736, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0033.key", 0x02000, 0x49e882e5, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Aliensynj) -STD_ROM_FN(Aliensynj) - -static struct BurnRomInfo AltbeastRomDesc[] = { - { "epr-11907.a7", 0x20000, 0x29e0c3ad, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11906.a5", 0x20000, 0x4c9e9cd8, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-11674.a14", 0x20000, 0xa57a66d5, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11675.a15", 0x20000, 0x2ef2f144, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11676.a16", 0x20000, 0x0c04acac, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11677.b1", 0x20000, 0xa01425cd, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11681.b5", 0x20000, 0xd9e03363, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11678.b2", 0x20000, 0x17a9fc53, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11682.b6", 0x20000, 0xe3f77c5e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11679.b3", 0x20000, 0x14dcc245, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11683.b7", 0x20000, 0xf9a60f06, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11680.b4", 0x20000, 0xf43dcdec, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11684.b8", 0x20000, 0xb20c0edb, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11671.a10", 0x08000, 0x2b71343b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0078.mcu", 0x01000, 0x00000000, BRF_NODUMP }, -}; - - -STD_ROM_PICK(Altbeast) -STD_ROM_FN(Altbeast) - -static struct BurnRomInfo AltbeastjRomDesc[] = { - { "epr-11885.a7", 0x20000, 0x5bb715aa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11884.a5", 0x20000, 0xe1707090, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11722.a14", 0x10000, 0xadaa8db5, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11736.b14", 0x10000, 0xe9ad5e89, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11723.a15", 0x10000, 0x131a3f9a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11737.b15", 0x10000, 0x2e420023, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11724.a16", 0x10000, 0x6f2ed50a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11738.b16", 0x10000, 0xde3d6d02, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11725.b1", 0x10000, 0xf8b3684e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11729.b5", 0x10000, 0xae3c2793, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11726.b2", 0x10000, 0x3cce5419, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11730.b6", 0x10000, 0x3af62b55, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11727.b3", 0x10000, 0xb0390078, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11731.b7", 0x10000, 0x2a87744a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11728.b4", 0x10000, 0xf3a43fd8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11732.b8", 0x10000, 0x2fb3e355, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11717.a1", 0x10000, 0x676be0cb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11733.b10", 0x10000, 0x802cac94, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11718.a2", 0x10000, 0x882864c2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11734.b11", 0x10000, 0x76c704d2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11719.a3", 0x10000, 0x339987f7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11735.b12", 0x10000, 0x4fe406aa, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11671.a10", 0x08000, 0x2b71343b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0077.mcu", 0x01000, 0x00000000, BRF_NODUMP }, -}; - - -STD_ROM_PICK(Altbeastj) -STD_ROM_FN(Altbeastj) - -static struct BurnRomInfo Altbeast2RomDesc[] = { - { "epr-11705.a7", 0x20000, 0x57dc5c7a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11704.a5", 0x20000, 0x33bbcf07, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-11674.a14", 0x20000, 0xa57a66d5, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11675.a15", 0x20000, 0x2ef2f144, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11676.a16", 0x20000, 0x0c04acac, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11677.b1", 0x20000, 0xa01425cd, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11681.b5", 0x20000, 0xd9e03363, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11678.b2", 0x20000, 0x17a9fc53, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11682.b6", 0x20000, 0xe3f77c5e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11679.b3", 0x20000, 0x14dcc245, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11683.b7", 0x20000, 0xf9a60f06, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11680.b4", 0x20000, 0xf43dcdec, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11684.b8", 0x20000, 0xb20c0edb, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11686.a10", 0x08000, 0x828a45b3, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0066.key", 0x02000, 0xed85a054, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Altbeast2) -STD_ROM_FN(Altbeast2) - -static struct BurnRomInfo Altbeastj3RomDesc[] = { - { "epr-11721.a7", 0x20000, 0x1c5d11de, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11720.a5", 0x20000, 0x735350cf, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11722.a14", 0x10000, 0xadaa8db5, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11736.b14", 0x10000, 0xe9ad5e89, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11723.a15", 0x10000, 0x131a3f9a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11737.b15", 0x10000, 0x2e420023, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11724.a16", 0x10000, 0x6f2ed50a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11738.b16", 0x10000, 0xde3d6d02, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11725.b1", 0x10000, 0xf8b3684e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11729.b5", 0x10000, 0xae3c2793, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11726.b2", 0x10000, 0x3cce5419, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11730.b6", 0x10000, 0x3af62b55, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11727.b3", 0x10000, 0xb0390078, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11731.b7", 0x10000, 0x2a87744a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11728.b4", 0x10000, 0xf3a43fd8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11732.b8", 0x10000, 0x2fb3e355, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11717.a1", 0x10000, 0x676be0cb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11733.b10", 0x10000, 0x802cac94, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11718.a2", 0x10000, 0x882864c2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11734.b11", 0x10000, 0x76c704d2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11719.a3", 0x10000, 0x339987f7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11735.b12", 0x10000, 0x4fe406aa, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11671.a10", 0x08000, 0x2b71343b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0068.key", 0x02000, 0xc1ed4310, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Altbeastj3) -STD_ROM_FN(Altbeastj3) - -static struct BurnRomInfo Altbeast4RomDesc[] = { - { "epr-11740.a7", 0x20000, 0xce227542, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11739.a5", 0x20000, 0xe466eb65, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11722.a14", 0x10000, 0xadaa8db5, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11736.b14", 0x10000, 0xe9ad5e89, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11723.a15", 0x10000, 0x131a3f9a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11737.b15", 0x10000, 0x2e420023, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11724.a16", 0x10000, 0x6f2ed50a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11738.b16", 0x10000, 0xde3d6d02, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11725.b1", 0x10000, 0xf8b3684e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11729.b5", 0x10000, 0xae3c2793, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11726.b2", 0x10000, 0x3cce5419, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11730.b6", 0x10000, 0x3af62b55, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11727.b3", 0x10000, 0xb0390078, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11731.b7", 0x10000, 0x2a87744a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11728.b4", 0x10000, 0xf3a43fd8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11732.b8", 0x10000, 0x2fb3e355, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11717.a1", 0x10000, 0x676be0cb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11733.b10", 0x10000, 0x802cac94, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11718.a2", 0x10000, 0x882864c2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11734.b11", 0x10000, 0x76c704d2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11719.a3", 0x10000, 0x339987f7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11735.b12", 0x10000, 0x4fe406aa, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11686.a10", 0x08000, 0x828a45b3, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0066.key", 0x02000, 0xed85a054, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Altbeast4) -STD_ROM_FN(Altbeast4) - -static struct BurnRomInfo Altbeast5RomDesc[] = { - { "epr-11742.a7", 0x20000, 0x61839534, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11741.a5", 0x20000, 0x9b2159cb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11722.a14", 0x10000, 0xadaa8db5, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11736.b14", 0x10000, 0xe9ad5e89, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11723.a15", 0x10000, 0x131a3f9a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11737.b15", 0x10000, 0x2e420023, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11724.a16", 0x10000, 0x6f2ed50a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11738.b16", 0x10000, 0xde3d6d02, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11725.b1", 0x10000, 0xf8b3684e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11729.b5", 0x10000, 0xae3c2793, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11726.b2", 0x10000, 0x3cce5419, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11730.b6", 0x10000, 0x3af62b55, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11727.b3", 0x10000, 0xb0390078, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11731.b7", 0x10000, 0x2a87744a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11728.b4", 0x10000, 0xf3a43fd8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11732.b8", 0x10000, 0x2fb3e355, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11717.a1", 0x10000, 0x676be0cb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11733.b10", 0x10000, 0x802cac94, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11718.a2", 0x10000, 0x882864c2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11734.b11", 0x10000, 0x76c704d2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11719.a3", 0x10000, 0x339987f7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11735.b12", 0x10000, 0x4fe406aa, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11671.a10", 0x08000, 0x2b71343b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0069.key", 0x02000, 0x959e256a, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Altbeast5) -STD_ROM_FN(Altbeast5) - -static struct BurnRomInfo Altbeast6RomDesc[] = { - { "epr-11883.a7", 0x20000, 0xc5b3e8f7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11882.a5", 0x20000, 0x9c01170b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11722.a14", 0x10000, 0xadaa8db5, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11736.b14", 0x10000, 0xe9ad5e89, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11723.a15", 0x10000, 0x131a3f9a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11737.b15", 0x10000, 0x2e420023, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11724.a16", 0x10000, 0x6f2ed50a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11738.b16", 0x10000, 0xde3d6d02, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11725.b1", 0x10000, 0xf8b3684e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11729.b5", 0x10000, 0xae3c2793, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11726.b2", 0x10000, 0x3cce5419, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11730.b6", 0x10000, 0x3af62b55, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11727.b3", 0x10000, 0xb0390078, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11731.b7", 0x10000, 0x2a87744a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11728.b4", 0x10000, 0xf3a43fd8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11732.b8", 0x10000, 0x2fb3e355, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11717.a1", 0x10000, 0x676be0cb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11733.b10", 0x10000, 0x802cac94, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11718.a2", 0x10000, 0x882864c2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11734.b11", 0x10000, 0x76c704d2, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11719.a3", 0x10000, 0x339987f7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11735.b12", 0x10000, 0x4fe406aa, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11671.a10", 0x08000, 0x2b71343b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0076.mcu", 0x01000, 0x00000000, BRF_NODUMP }, -}; - - -STD_ROM_PICK(Altbeast6) -STD_ROM_FN(Altbeast6) - -static struct BurnRomInfo AtomicpRomDesc[] = { - { "ap-t2.bin", 0x10000, 0x97421047, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "ap-t1.bin", 0x10000, 0x5c65fe56, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "ap-t4.bin", 0x08000, 0x332e58f4, SYS16_ROM_TILES | BRF_GRA }, - { "ap-t3.bin", 0x08000, 0xdddc122c, SYS16_ROM_TILES | BRF_GRA }, - { "ap-t5.bin", 0x08000, 0xef5ecd6b, SYS16_ROM_TILES | BRF_GRA }, -}; - - -STD_ROM_PICK(Atomicp) -STD_ROM_FN(Atomicp) - -static struct BurnRomInfo AurailRomDesc[] = { - { "epr-13577.a7", 0x20000, 0x6701b686, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13576.a5", 0x20000, 0x1e428d94, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13447.a8", 0x20000, 0x70a52167, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13445.a6", 0x20000, 0x28dfc3dd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-13450.a14", 0x20000, 0x0fc4a7a8, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13465.b14", 0x20000, 0xe08135e0, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13451.a15", 0x20000, 0x1c49852f, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13466.b15", 0x20000, 0xe14c6684, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13452.a16", 0x20000, 0x047bde5e, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13467.b16", 0x20000, 0x6309fec4, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-13453.b1", 0x20000, 0x5fa0a9f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13457.b5", 0x20000, 0x0d1b54da, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13454.b2", 0x20000, 0x5f6b33b1, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13458.b6", 0x20000, 0xbad340c3, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13455.b3", 0x20000, 0x4e80520b, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13459.b7", 0x20000, 0x7e9165ac, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13456.b4", 0x20000, 0x5733c428, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13460.b8", 0x20000, 0x66b8f9b3, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13440.a1", 0x20000, 0x4f370b2b, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13461.b10", 0x20000, 0xf76014bf, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13441.a2", 0x20000, 0x37cf9cb4, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13462.b11", 0x20000, 0x1061e7da, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13442.a3", 0x20000, 0x049698ef, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13463.b12", 0x20000, 0x7dbcfbf1, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13443.a4", 0x20000, 0x77a8989e, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13464.b13", 0x20000, 0x551df422, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-13448.a10", 0x08000, 0xb5183fb9, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-13449.a11", 0x20000, 0xd3d9aaf9, SYS16_ROM_UPD7759DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Aurail) -STD_ROM_FN(Aurail) - -static struct BurnRomInfo Aurail1RomDesc[] = { - { "epr-13469.a7", 0x20000, 0xc628b69d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13468.a5", 0x20000, 0xce092218, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13447.a8", 0x20000, 0x70a52167, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13445.a6", 0x20000, 0x28dfc3dd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-13450.a14", 0x20000, 0x0fc4a7a8, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13465.b14", 0x20000, 0xe08135e0, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13451.a15", 0x20000, 0x1c49852f, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13466.b15", 0x20000, 0xe14c6684, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13452.a16", 0x20000, 0x047bde5e, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13467.b16", 0x20000, 0x6309fec4, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-13453.b1", 0x20000, 0x5fa0a9f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13457.b5", 0x20000, 0x0d1b54da, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13454.b2", 0x20000, 0x5f6b33b1, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13458.b6", 0x20000, 0xbad340c3, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13455.b3", 0x20000, 0x4e80520b, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13459.b7", 0x20000, 0x7e9165ac, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13456.b4", 0x20000, 0x5733c428, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13460.b8", 0x20000, 0x66b8f9b3, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13440.a1", 0x20000, 0x4f370b2b, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13461.b10", 0x20000, 0xf76014bf, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13441.a2", 0x20000, 0x37cf9cb4, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13462.b11", 0x20000, 0x1061e7da, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13442.a3", 0x20000, 0x049698ef, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13463.b12", 0x20000, 0x7dbcfbf1, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13443.a4", 0x20000, 0x77a8989e, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13464.b13", 0x20000, 0x551df422, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-13448.a10", 0x08000, 0xb5183fb9, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-13449.a11", 0x20000, 0xd3d9aaf9, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0168.key", 0x02000, 0xbc2d1792, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Aurail1) -STD_ROM_FN(Aurail1) - -static struct BurnRomInfo AurailjRomDesc[] = { - { "epr-13446.a7", 0x20000, 0xd1f57b2a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13444.a5", 0x20000, 0x7a2b045f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13447.a8", 0x20000, 0x70a52167, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13445.a6", 0x20000, 0x28dfc3dd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-13450.a14", 0x20000, 0x0fc4a7a8, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13465.b14", 0x20000, 0xe08135e0, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13451.a15", 0x20000, 0x1c49852f, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13466.b15", 0x20000, 0xe14c6684, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13452.a16", 0x20000, 0x047bde5e, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-13467.b16", 0x20000, 0x6309fec4, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-13453.b1", 0x20000, 0x5fa0a9f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13457.b5", 0x20000, 0x0d1b54da, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13454.b2", 0x20000, 0x5f6b33b1, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13458.b6", 0x20000, 0xbad340c3, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13455.b3", 0x20000, 0x4e80520b, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13459.b7", 0x20000, 0x7e9165ac, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13456.b4", 0x20000, 0x5733c428, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13460.b8", 0x20000, 0x66b8f9b3, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13440.a1", 0x20000, 0x4f370b2b, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13461.b10", 0x20000, 0xf76014bf, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13441.a2", 0x20000, 0x37cf9cb4, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13462.b11", 0x20000, 0x1061e7da, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13442.a3", 0x20000, 0x049698ef, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13463.b12", 0x20000, 0x7dbcfbf1, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13443.a4", 0x20000, 0x77a8989e, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-13464.b13", 0x20000, 0x551df422, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-13448.a10", 0x08000, 0xb5183fb9, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-13449.a11", 0x20000, 0xd3d9aaf9, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0167.key", 0x02000, 0xbc2d1792, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Aurailj) -STD_ROM_FN(Aurailj) - -static struct BurnRomInfo BayrouteRomDesc[] = { - { "epr-12517.a7", 0x20000, 0x436728a9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12516.a5", 0x20000, 0x4ff0353f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12458.a8", 0x20000, 0xe7c7476a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12456.a6", 0x20000, 0x25dc2eaf, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-12462.a14", 0x10000, 0xa19943b5, SYS16_ROM_TILES | BRF_GRA }, - { "opr-12463.a15", 0x10000, 0x62f8200d, SYS16_ROM_TILES | BRF_GRA }, - { "opr-12464.a16", 0x10000, 0xc8c59703, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12465.b1", 0x20000, 0x11d61b45, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12467.b5", 0x20000, 0xc3b4e4c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12466.b2", 0x20000, 0xa57f236f, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12468.b6", 0x20000, 0xd89c77de, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12459.a10", 0x08000, 0x3e1d29d0, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12460.a11", 0x20000, 0x0bae570d, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "mpr-12461.a12", 0x20000, 0xb03b8b46, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0116.key", 0x02000, 0x8778ee49, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Bayroute) -STD_ROM_FN(Bayroute) - -static struct BurnRomInfo BayroutejRomDesc[] = { - { "epr-12457.a7", 0x20000, 0xbc726255, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12455.a5", 0x20000, 0xb6a722eb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12458.a8", 0x20000, 0xe7c7476a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12456.a6", 0x20000, 0x25dc2eaf, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-12462.a14", 0x10000, 0xa19943b5, SYS16_ROM_TILES | BRF_GRA }, - { "opr-12463.a15", 0x10000, 0x62f8200d, SYS16_ROM_TILES | BRF_GRA }, - { "opr-12464.a16", 0x10000, 0xc8c59703, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12465.b1", 0x20000, 0x11d61b45, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12467.b5", 0x20000, 0xc3b4e4c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12466.b2", 0x20000, 0xa57f236f, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12468.b6", 0x20000, 0xd89c77de, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12459.a10", 0x08000, 0x3e1d29d0, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12460.a11", 0x20000, 0x0bae570d, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "mpr-12461.a12", 0x20000, 0xb03b8b46, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0115.key", 0x02000, 0x75a55614, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Bayroutej) -STD_ROM_FN(Bayroutej) - -static struct BurnRomInfo Bayroute1RomDesc[] = { - { "br.a4", 0x10000, 0x91c6424b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "br.a1", 0x10000, 0x76954bf3, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "br.a5", 0x10000, 0x9d6fd183, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "br.a2", 0x10000, 0x5ca1e3d2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "br.a6", 0x10000, 0xed97ad4c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "br.a3", 0x10000, 0x0d362905, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-12462.a14", 0x10000, 0xa19943b5, SYS16_ROM_TILES | BRF_GRA }, - { "opr-12463.a15", 0x10000, 0x62f8200d, SYS16_ROM_TILES | BRF_GRA }, - { "opr-12464.a16", 0x10000, 0xc8c59703, SYS16_ROM_TILES | BRF_GRA }, - - { "br_obj0o.b1", 0x10000, 0x098a5e82, SYS16_ROM_SPRITES | BRF_GRA }, - { "br_obj0e.b5", 0x10000, 0x85238af9, SYS16_ROM_SPRITES | BRF_GRA }, - { "br_obj1o.b2", 0x10000, 0xcc641da1, SYS16_ROM_SPRITES | BRF_GRA }, - { "br_obj1e.b6", 0x10000, 0xd3123315, SYS16_ROM_SPRITES | BRF_GRA }, - { "br_obj2o.b3", 0x10000, 0x84efac1f, SYS16_ROM_SPRITES | BRF_GRA }, - { "br_obj2e.b7", 0x10000, 0xb73b12cb, SYS16_ROM_SPRITES | BRF_GRA }, - { "br_obj3o.b4", 0x10000, 0xa2e238ac, SYS16_ROM_SPRITES | BRF_GRA }, - { "br.b8", 0x10000, 0xd8de78ff, SYS16_ROM_SPRITES | BRF_GRA }, - - { "sound.a7", 0x08000, 0x00000000, SYS16_ROM_Z80PROG | BRF_NODUMP | BRF_PRG }, - - { "sound.a8", 0x10000, 0x00000000, SYS16_ROM_UPD7759DATA | BRF_NODUMP | BRF_SND }, - { "sound.a9", 0x10000, 0x00000000, SYS16_ROM_UPD7759DATA | BRF_NODUMP | BRF_SND }, - { "sound.a10", 0x10000, 0x00000000, SYS16_ROM_UPD7759DATA | BRF_NODUMP | BRF_SND }, - { "sound.a11", 0x10000, 0x00000000, SYS16_ROM_UPD7759DATA | BRF_NODUMP | BRF_SND }, -}; - - -STD_ROM_PICK(Bayroute1) -STD_ROM_FN(Bayroute1) - -static struct BurnRomInfo Blox16bRomDesc[] = { - { "bs16b.p00", 0x040000, 0xfd1978b9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "bs16b.scr", 0x040000, 0x1de4e95b, SYS16_ROM_TILES | BRF_GRA }, - - { "bs16b.obj", 0x020000, 0x05076220, SYS16_ROM_SPRITES | BRF_GRA }, - - { "bs16b.snd", 0x018000, 0x930c7e7b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Blox16b) -STD_ROM_FN(Blox16b) - -static struct BurnRomInfo BulletRomDesc[] = { - { "epr-11010.a4", 0x08000, 0xdd9001de, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11007.a1", 0x08000, 0xd9e08110, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11011.a5", 0x08000, 0x7f446b9f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11008.a2", 0x08000, 0x34824d3b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11012.a6", 0x08000, 0x3992f159, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11009.a3", 0x08000, 0xdf199999, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10994.b9", 0x10000, 0x3035468a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10995.b10", 0x10000, 0x6b97aff1, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10996.b11", 0x10000, 0x501bddd6, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10999.b1", 0x10000, 0x119f0008, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11003.b5", 0x10000, 0x2f429089, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11000.b2", 0x10000, 0xf5482bbe, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11004.b6", 0x10000, 0x8c886df0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11001.b3", 0x10000, 0x65ea71e0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11005.b7", 0x10000, 0xea2f9d50, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11002.b4", 0x10000, 0x9e25042b, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11006.b8", 0x10000, 0x6b7384f2, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10997.a7", 0x08000, 0x5dd9cab5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-10998.a8", 0x08000, 0xf971a817, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0041.key", 0x02000, 0x4cd4861a, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Bullet) -STD_ROM_FN(Bullet) - -static struct BurnRomInfo CottonRomDesc[] = { - { "epr-13921a.a7", 0x20000, 0xf047a037, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13919a.a5", 0x20000, 0x651108b1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13922a.a8", 0x20000, 0x1ca248c5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13920a.a6", 0x20000, 0xfa3610f9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-13862.a14", 0x20000, 0xa47354b6, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13877.b14", 0x20000, 0xd38424b5, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13863.a15", 0x20000, 0x8c990026, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13878.b15", 0x20000, 0x21c15b8a, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13864.a16", 0x20000, 0xd2b175bf, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13879.b16", 0x20000, 0xb9d62531, SYS16_ROM_TILES | BRF_GRA }, - - { "opr-13865.b1", 0x20000, 0x7024f404, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13869.b5", 0x20000, 0xab4b3468, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13866.b2", 0x20000, 0x6169bba4, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13870.b6", 0x20000, 0x69b41ac3, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13867.b3", 0x20000, 0xb014f02d, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13871.b7", 0x20000, 0x0801cf02, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13868.b4", 0x20000, 0xe62a7cd6, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13872.b8", 0x20000, 0xf066f315, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13852.a1", 0x20000, 0x943aba8b, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13873.b10", 0x20000, 0x1bd145f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13853.a2", 0x20000, 0x7ea93200, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13874.b11", 0x20000, 0x4fd59bff, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13891.a3", 0x20000, 0xc6b3c414, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13894.b12", 0x20000, 0xe3d0bee2, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13855.a4", 0x20000, 0x856f3ee2, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13876.b13", 0x20000, 0x1c5ffad8, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-13892.a10", 0x08000, 0xfdfbe6ad, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-13893.a11", 0x20000, 0x384233df, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0181a.key", 0x02000, 0x5c419b36, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Cotton) -STD_ROM_FN(Cotton) - -static struct BurnRomInfo CottonuRomDesc[] = { - { "cotton.a7", 0x20000, 0xe7ef7d10, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "cotton.a5", 0x20000, 0xabe4f83e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "cotton.a8", 0x20000, 0xfc0f4401, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "cotton.a6", 0x20000, 0xf50f1ea2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-13862.a14", 0x20000, 0xa47354b6, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13877.b14", 0x20000, 0xd38424b5, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13863.a15", 0x20000, 0x8c990026, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13878.b15", 0x20000, 0x21c15b8a, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13864.a16", 0x20000, 0xd2b175bf, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13879.b16", 0x20000, 0xb9d62531, SYS16_ROM_TILES | BRF_GRA }, - - { "opr-13865.b1", 0x20000, 0x7024f404, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13869.b5", 0x20000, 0xab4b3468, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13866.b2", 0x20000, 0x6169bba4, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13870.b6", 0x20000, 0x69b41ac3, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13867.b3", 0x20000, 0xb014f02d, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13871.b7", 0x20000, 0x0801cf02, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13868.b4", 0x20000, 0xe62a7cd6, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13872.b8", 0x20000, 0xf066f315, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13852.a1", 0x20000, 0x943aba8b, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13873.b10", 0x20000, 0x1bd145f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13853.a2", 0x20000, 0x7ea93200, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13874.b11", 0x20000, 0x4fd59bff, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13891.a3", 0x20000, 0xc6b3c414, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13894.b12", 0x20000, 0xe3d0bee2, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13855.a4", 0x20000, 0x856f3ee2, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13876.b13", 0x20000, 0x1c5ffad8, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-13892.a10", 0x08000, 0xfdfbe6ad, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-13893.a11", 0x20000, 0x384233df, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0180.key", 0x02000, 0xa236b915, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Cottonu) -STD_ROM_FN(Cottonu) - -static struct BurnRomInfo CottonjRomDesc[] = { - { "epr-13858a.a7", 0x20000, 0x276f42fe, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13856a.a5", 0x20000, 0x14e6b5e7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13859a.a8", 0x20000, 0x4703ef9d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13857a.a6", 0x20000, 0xde37e527, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-13862.a14", 0x20000, 0xa47354b6, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13877.b14", 0x20000, 0xd38424b5, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13863.a15", 0x20000, 0x8c990026, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13878.b15", 0x20000, 0x21c15b8a, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13864.a16", 0x20000, 0xd2b175bf, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13879.b16", 0x20000, 0xb9d62531, SYS16_ROM_TILES | BRF_GRA }, - - { "opr-13865.b1", 0x20000, 0x7024f404, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13869.b5", 0x20000, 0xab4b3468, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13866.b2", 0x20000, 0x6169bba4, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13870.b6", 0x20000, 0x69b41ac3, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13867.b3", 0x20000, 0xb014f02d, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13871.b7", 0x20000, 0x0801cf02, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13868.b4", 0x20000, 0xe62a7cd6, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13872.b8", 0x20000, 0xf066f315, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13852.a1", 0x20000, 0x943aba8b, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13873.b10", 0x20000, 0x1bd145f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13853.a2", 0x20000, 0x7ea93200, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13874.b11", 0x20000, 0x4fd59bff, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13854.a3", 0x20000, 0x1c942190, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13875.b12", 0x20000, 0x6a66868d, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13855.a4", 0x20000, 0x856f3ee2, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13876.b13", 0x20000, 0x1c5ffad8, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-13860.a10", 0x08000, 0x6a57b027, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-13061.a11", 0x20000, 0x4d21153f, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0179a.key", 0x02000, 0x488096d3, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Cottonj) -STD_ROM_FN(Cottonj) - -static struct BurnRomInfo DduxRomDesc[] = { - { "epr-11191.a7", 0x20000, 0x500e400a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11190.a5", 0x20000, 0x2a698308, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11915.a8", 0x20000, 0xd8ed3132, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11913.a6", 0x20000, 0x30c6cb92, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-11917.a14", 0x10000, 0x6f772190, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-11918.a15", 0x10000, 0xc731db95, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-11919.a16", 0x10000, 0x64d5a491, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-11920.b1", 0x20000, 0xe5d1e3cd, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11922.b5", 0x20000, 0x70b0c4dd, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11921.b2", 0x20000, 0x61d2358c, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11923.b6", 0x20000, 0xc9ffe47d, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11916.a10", 0x08000, 0x7ab541cf, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0096.key", 0x02000, 0x6fd7d26e, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Ddux) -STD_ROM_FN(Ddux) - -static struct BurnRomInfo Ddux1RomDesc[] = { - { "epr-12189.a7", 0x20000, 0x558e9b5d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12188.a5", 0x20000, 0x802a240f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11915.a8", 0x20000, 0xd8ed3132, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11913.a6", 0x20000, 0x30c6cb92, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-11917.a14", 0x10000, 0x6f772190, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-11918.a15", 0x10000, 0xc731db95, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-11919.a16", 0x10000, 0x64d5a491, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-11920.b1", 0x20000, 0xe5d1e3cd, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11922.b5", 0x20000, 0x70b0c4dd, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11921.b2", 0x20000, 0x61d2358c, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11923.b6", 0x20000, 0xc9ffe47d, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11916.a10", 0x08000, 0x7ab541cf, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0095.bin", 0x01000, 0x00000000, BRF_NODUMP }, -}; - - -STD_ROM_PICK(Ddux1) -STD_ROM_FN(Ddux1) - -static struct BurnRomInfo DduxblRomDesc[] = { - { "dduxb03.bin", 0x20000, 0xe7526012, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "dduxb05.bin", 0x20000, 0x459d1237, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "dduxb02.bin", 0x20000, 0xd8ed3132, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "dduxb04.bin", 0x20000, 0x30c6cb92, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "dduxb14.bin", 0x10000, 0x664bd135, SYS16_ROM_TILES | BRF_GRA }, - { "dduxb15.bin", 0x10000, 0xce0d2b30, SYS16_ROM_TILES | BRF_GRA }, - { "dduxb16.bin", 0x10000, 0x6de95434, SYS16_ROM_TILES | BRF_GRA }, - - { "dduxb10.bin", 0x10000, 0x0be3aee5, SYS16_ROM_SPRITES | BRF_GRA }, - { "dduxb06.bin", 0x10000, 0xb0079e99, SYS16_ROM_SPRITES | BRF_GRA }, - { "dduxb11.bin", 0x10000, 0xcfb2af18, SYS16_ROM_SPRITES | BRF_GRA }, - { "dduxb07.bin", 0x10000, 0x0217369c, SYS16_ROM_SPRITES | BRF_GRA }, - { "dduxb12.bin", 0x10000, 0x28ce9b15, SYS16_ROM_SPRITES | BRF_GRA }, - { "dduxb08.bin", 0x10000, 0x8844f336, SYS16_ROM_SPRITES | BRF_GRA }, - { "dduxb13.bin", 0x10000, 0xefe57759, SYS16_ROM_SPRITES | BRF_GRA }, - { "dduxb09.bin", 0x10000, 0x6b64f665, SYS16_ROM_SPRITES | BRF_GRA }, - - { "dduxb01.bin", 0x08000, 0x0dbef0d7, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Dduxbl) -STD_ROM_FN(Dduxbl) - -static struct BurnRomInfo DunkshotRomDesc[] = { - { "epr-10470.a4", 0x08000, 0x8c60761f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10467.a1", 0x08000, 0x29774114, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10471.a5", 0x08000, 0x22777314, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10468.a2", 0x08000, 0xe2d5f97a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10472.a6", 0x08000, 0x206027a6, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10469.a3", 0x08000, 0xaa442b81, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10485.b9", 0x08000, 0xf16dda29, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10486.b10", 0x08000, 0x311d973c, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10487.b11", 0x08000, 0xa8fb179f, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10477.b1", 0x08000, 0xf9d3b2cb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10481.b5", 0x08000, 0xfeb04bc9, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10478.b2", 0x08000, 0x5b5c5c92, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10482.b6", 0x08000, 0x5bc07618, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10479.b3", 0x08000, 0xe84190a0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10483.b7", 0x08000, 0x7cab4f9e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10480.b4", 0x08000, 0x5dffd9dd, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10484.b8", 0x08000, 0xbcb5fcc9, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10473.a7", 0x08000, 0x7f1f5a27, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-10474.a8", 0x08000, 0x419a656e, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-10475.a9", 0x08000, 0x17d55e85, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-10476.a10", 0x08000, 0xa6be0956, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0022.key", 0x02000, 0x4eedc66d, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Dunkshot) -STD_ROM_FN(Dunkshot) - -static struct BurnRomInfo EswatRomDesc[] = { - { "epr-12659.bin", 0x40000, 0xc5ab2db9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12658.bin", 0x40000, 0xaf40bd71, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12624.b11", 0x40000, 0x375a5ec4, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12625.b12", 0x40000, 0x3b8c757e, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12626.b13", 0x40000, 0x3efca25c, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12618.b1", 0x40000, 0x0d1530bf, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12621.b4", 0x40000, 0x18ff0799, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12619.b2", 0x40000, 0x32069246, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12622.b5", 0x40000, 0xa3dfe436, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12620.b3", 0x40000, 0xf6b096e0, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12623.b6", 0x40000, 0x6773fef6, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12617.a13", 0x08000, 0x7efecf23, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12616.a11", 0x40000, 0x254347c2, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0130.key", 0x02000, 0xba7b717b, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Eswat) -STD_ROM_FN(Eswat) - -static struct BurnRomInfo EswatjRomDesc[] = { - { "epr-12615.a2", 0x40000, 0x388c2ea7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12614.a1", 0x40000, 0xd5f0fb47, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12624.b11", 0x40000, 0x375a5ec4, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12625.b12", 0x40000, 0x3b8c757e, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12626.b13", 0x40000, 0x3efca25c, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12618.b1", 0x40000, 0x0d1530bf, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12621.b4", 0x40000, 0x18ff0799, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12619.b2", 0x40000, 0x32069246, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12622.b5", 0x40000, 0xa3dfe436, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12620.b3", 0x40000, 0xf6b096e0, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12623.b6", 0x40000, 0x6773fef6, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12617.a13", 0x08000, 0x7efecf23, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12616.a11", 0x40000, 0x254347c2, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0128.key", 0x02000, 0x95f96277, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Eswatj) -STD_ROM_FN(Eswatj) - -static struct BurnRomInfo EswatuRomDesc[] = { - { "epr-12657.a2", 0x40000, 0x43ca72aa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12656.a1", 0x40000, 0x5f018967, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12624.b11", 0x40000, 0x375a5ec4, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12625.b12", 0x40000, 0x3b8c757e, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12626.b13", 0x40000, 0x3efca25c, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12618.b1", 0x40000, 0x0d1530bf, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12621.b4", 0x40000, 0x18ff0799, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12619.b2", 0x40000, 0x32069246, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12622.b5", 0x40000, 0xa3dfe436, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12620.b3", 0x40000, 0xf6b096e0, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12623.b6", 0x40000, 0x6773fef6, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12617.a13", 0x08000, 0x7efecf23, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12616.a11", 0x40000, 0x254347c2, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0129.key", 0x02000, 0x128302c7, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Eswatu) -STD_ROM_FN(Eswatu) - -static struct BurnRomInfo EswatblRomDesc[] = { - { "eswat_c.rom", 0x10000, 0x1028cc81, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "eswat_f.rom", 0x10000, 0xf7b2d388, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "eswat_b.rom", 0x10000, 0x87c6b1b5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "eswat_e.rom", 0x10000, 0x937ddf9a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "eswat_a.rom", 0x08000, 0x2af4fc62, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "eswat_d.rom", 0x08000, 0xb4751e19, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr12624.b11", 0x40000, 0x375a5ec4, SYS16_ROM_TILES | BRF_GRA }, - { "mpr12625.b12", 0x40000, 0x3b8c757e, SYS16_ROM_TILES | BRF_GRA }, - { "mpr12626.b13", 0x40000, 0x3efca25c, SYS16_ROM_TILES | BRF_GRA }, - - { "ic9", 0x40000, 0x0d1530bf, SYS16_ROM_SPRITES | BRF_GRA }, - { "ic12", 0x40000, 0x18ff0799, SYS16_ROM_SPRITES | BRF_GRA }, - { "ic10", 0x40000, 0x32069246, SYS16_ROM_SPRITES | BRF_GRA }, - { "ic13", 0x40000, 0xa3dfe436, SYS16_ROM_SPRITES | BRF_GRA }, - { "ic11", 0x40000, 0xf6b096e0, SYS16_ROM_SPRITES | BRF_GRA }, - { "ic14", 0x40000, 0x6773fef6, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr12617.a13", 0x08000, 0x7efecf23, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr12616.a11", 0x40000, 0x254347c2, SYS16_ROM_UPD7759DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Eswatbl) -STD_ROM_FN(Eswatbl) - -static struct BurnRomInfo ExctleagRomDesc[] = { - { "epr-11939.a04", 0x10000, 0x117dd98f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11936.a01", 0x10000, 0x0863de60, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11940.a05", 0x10000, 0xdec83274, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11937.a02", 0x10000, 0x4ebda367, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11941.a06", 0x10000, 0x4df2d451, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11938.a03", 0x10000, 0x07c08d47, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11942.b09", 0x10000, 0xeb70e827, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11943.b10", 0x10000, 0xd97c8982, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11944.b11", 0x10000, 0xa75cae80, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11950.b01", 0x10000, 0xaf497849, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11954.b05", 0x10000, 0x5fa2106c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11951.b02", 0x10000, 0xc04fa974, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11955.b06", 0x10000, 0x86a0c368, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11952.b03", 0x10000, 0xe64a9761, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11956.b07", 0x10000, 0xaff5c2fa, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11953.b04", 0x10000, 0x4cae3999, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11957.b08", 0x10000, 0x218f835b, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11945.a07", 0x08000, 0xc2a83012, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11140.a08", 0x08000, 0xb297371b, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11141.a09", 0x08000, 0x19756aa6, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11142.a10", 0x08000, 0x25d26c66, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11143.a11", 0x08000, 0x848b7b77, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0079.key", 0x02000, 0xeffefa1c, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Exctleag) -STD_ROM_FN(Exctleag) - -static struct BurnRomInfo Fantzn2xRomDesc[] = { - { "fz2.a7", 0x020000, 0x94c05f0b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "fz2.a5", 0x020000, 0xf3526895, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "fz2.a8", 0x020000, 0xb2ebb209, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "fz2.a6", 0x020000, 0x6833f546, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "fz2.a14", 0x020000, 0x1c0a4537, SYS16_ROM_TILES | BRF_GRA }, - { "fz2.a15", 0x020000, 0x2b933344, SYS16_ROM_TILES | BRF_GRA }, - { "fz2.a16", 0x020000, 0xe63281a1, SYS16_ROM_TILES | BRF_GRA }, - - { "fz2.b1", 0x020000, 0x46bba615, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.b5", 0x020000, 0xbebeee5d, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.b2", 0x020000, 0x6681a7b6, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.b6", 0x020000, 0x42d3241f, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.b3", 0x020000, 0x5863926f, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.b7", 0x020000, 0xcd830510, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.b4", 0x020000, 0xb98fa5b6, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.b8", 0x020000, 0xe8248f68, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.a1", 0x020000, 0x9d2f41f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.b10", 0x020000, 0x7686ea33, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.a2", 0x020000, 0x3b4050b7, SYS16_ROM_SPRITES | BRF_GRA }, - { "fz2.b11", 0x020000, 0xda8a95dc, SYS16_ROM_SPRITES | BRF_GRA }, - - { "fz2.a10", 0x008000, 0x92c92924, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "fz2.a11", 0x020000, 0x8c641bb9, SYS16_ROM_UPD7759DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Fantzn2x) -STD_ROM_FN(Fantzn2x) - -static struct BurnRomInfo Fantzn2xpRomDesc[] = { - { "cpu1b.bin", 0x020000, 0xd23ef944, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "cpu1a.bin", 0x020000, 0x407490e4, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "cpu1d.bin", 0x020000, 0xc8c7716b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "cpu1c.bin", 0x020000, 0x242e7b6e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "tilea.bin", 0x020000, 0x47e0e5ce, SYS16_ROM_TILES | BRF_GRA }, - { "tileb.bin", 0x020000, 0x59e181b7, SYS16_ROM_TILES | BRF_GRA }, - { "tilec.bin", 0x020000, 0x375d354c, SYS16_ROM_TILES | BRF_GRA }, - - { "obja.bin", 0x020000, 0x9af87a4d, SYS16_ROM_SPRITES | BRF_GRA }, - { "objb.bin", 0x020000, 0x2fdbca68, SYS16_ROM_SPRITES | BRF_GRA }, - { "objc.bin", 0x020000, 0x2587487a, SYS16_ROM_SPRITES | BRF_GRA }, - { "objd.bin", 0x020000, 0x8de4e7aa, SYS16_ROM_SPRITES | BRF_GRA }, - { "obje.bin", 0x020000, 0xdfada4ff, SYS16_ROM_SPRITES | BRF_GRA }, - { "objf.bin", 0x020000, 0x65e5d23d, SYS16_ROM_SPRITES | BRF_GRA }, - { "objg.bin", 0x020000, 0xdc9fbb75, SYS16_ROM_SPRITES | BRF_GRA }, - { "objh.bin", 0x020000, 0x97bb7c19, SYS16_ROM_SPRITES | BRF_GRA }, - { "obji.bin", 0x020000, 0xc7790fee, SYS16_ROM_SPRITES | BRF_GRA }, - { "objj.bin", 0x020000, 0x4535eb0e, SYS16_ROM_SPRITES | BRF_GRA }, - - { "cpu2a.bin", 0x008000, 0x92c92924, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "cpu2b.bin", 0x020000, 0x2c8ad475, SYS16_ROM_UPD7759DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Fantzn2xp) -STD_ROM_FN(Fantzn2xp) - -static struct BurnRomInfo Fantzn2xps2RomDesc[] = { - { "fz2_s16c.p00", 0x040000, 0xb7d16c1d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "fz2_s16c.p01", 0x040000, 0x2c47487c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "fz2_s16c.scr", 0x080000, 0xed3b1ac0, SYS16_ROM_TILES | BRF_GRA }, - - { "fz2_s16c.spr", 0x200000, 0x14d06fee, SYS16_ROM_SPRITES | BRF_GRA }, - - { "fz2_s16c.snd", 0x030000, 0x0ed30ec1, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Fantzn2xps2) -STD_ROM_FN(Fantzn2xps2) - -static struct BurnRomInfo FantzntaRomDesc[] = { - { "fz1_s16b_ta.p00",0x040000, 0xbad0537a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "fz1_s16b.scr", 0x040000, 0x10ecd8b9, SYS16_ROM_TILES | BRF_GRA }, - - { "fz1_s16b_ta.obj",0x200000, 0x51fd438f, SYS16_ROM_SPRITES | BRF_GRA }, - - { "fz1_s16b.snd", 0x020000, 0xa00701fb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Fantznta) -STD_ROM_FN(Fantznta) - -static struct BurnRomInfo FpointRomDesc[] = { - { "epr-12599b.a4", 0x10000, 0x26e3f354, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12598b.a1", 0x10000, 0xc0f2c97d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-12593.a14", 0x10000, 0xcc0582d8, SYS16_ROM_TILES | BRF_GRA }, - { "opr-12594.a15", 0x10000, 0x8bfc4815, SYS16_ROM_TILES | BRF_GRA }, - { "opr-12595.a16", 0x10000, 0x5b18d60b, SYS16_ROM_TILES | BRF_GRA }, - - { "opr-12596.b1", 0x10000, 0x4a4041f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12597.b5", 0x10000, 0x6961e676, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12592.a10", 0x08000, 0x9a8c11bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0127a.key", 0x02000, 0x5adb0042, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Fpoint) -STD_ROM_FN(Fpoint) - -static struct BurnRomInfo Fpoint1RomDesc[] = { - { "epr-12591b.a7", 0x10000, 0x248b3e1b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12590b.a5", 0x10000, 0x75256e3d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-12593.a14", 0x10000, 0xcc0582d8, SYS16_ROM_TILES | BRF_GRA }, - { "opr-12594.a15", 0x10000, 0x8bfc4815, SYS16_ROM_TILES | BRF_GRA }, - { "opr-12595.a16", 0x10000, 0x5b18d60b, SYS16_ROM_TILES | BRF_GRA }, - - { "opr-12596.b1", 0x10000, 0x4a4041f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12597.b5", 0x10000, 0x6961e676, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12592.a10", 0x08000, 0x9a8c11bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0127a.key", 0x02000, 0x5adb0042, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Fpoint1) -STD_ROM_FN(Fpoint1) - -static struct BurnRomInfo FpointblRomDesc[] = { - { "flpoint.003", 0x10000, 0x4d6df514, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "flpoint.002", 0x10000, 0x4dff2ee8, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "flpoint.006", 0x10000, 0xc539727d, SYS16_ROM_TILES | BRF_GRA }, - { "flpoint.005", 0x10000, 0x82c0b8b0, SYS16_ROM_TILES | BRF_GRA }, - { "flpoint.004", 0x10000, 0x522426ae, SYS16_ROM_TILES | BRF_GRA }, - - { "12596.bin", 0x10000, 0x4a4041f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "12597.bin", 0x10000, 0x6961e676, SYS16_ROM_SPRITES | BRF_GRA }, - - { "flpoint.001", 0x08000, 0xc5b8e0fe, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Fpointbl) -STD_ROM_FN(Fpointbl) - -static struct BurnRomInfo FpointbjRomDesc[] = { - { "boot2.003", 0x10000, 0x6c00d1b0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "boot2.002", 0x10000, 0xc1fcd704, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "flpoint.006", 0x10000, 0xc539727d, SYS16_ROM_TILES | BRF_GRA }, - { "flpoint.005", 0x10000, 0x82c0b8b0, SYS16_ROM_TILES | BRF_GRA }, - { "flpoint.004", 0x10000, 0x522426ae, SYS16_ROM_TILES | BRF_GRA }, - - { "12596.bin", 0x10000, 0x4a4041f3, SYS16_ROM_SPRITES | BRF_GRA }, - { "12597.bin", 0x10000, 0x6961e676, SYS16_ROM_SPRITES | BRF_GRA }, - - { "flpoint.001", 0x08000, 0xc5b8e0fe, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "82s129.1", 0x00100, 0xa7c22d96, BRF_OPT }, - { "82s123.2", 0x00020, 0x58bcf8bd, BRF_OPT }, - { "fpointbj_gal16v8_1.bin", 0x00117, 0xba7f292c, BRF_OPT }, - { "fpointbj_gal16v8_3.bin", 0x00117, 0xce1ab1e1, BRF_OPT }, - { "fpointbj_gal20v8.bin", 0x00400, 0x00000000, BRF_OPT | BRF_NODUMP }, -}; - - -STD_ROM_PICK(Fpointbj) -STD_ROM_FN(Fpointbj) - -static struct BurnRomInfo GoldnaxeRomDesc[] = { - { "epr-12545.ic2", 0x40000, 0xa97c4e4d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12544.ic1", 0x40000, 0x5e38f668, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12385.ic19", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12386.ic20", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12387.ic21", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12378.ic9", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12379.ic12", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12380.ic10", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12381.ic13", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12382.ic11", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12383.ic14", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12390.ic8", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12384.ic6", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0123a.bin", 0x01000, 0x00000000, BRF_NODUMP }, -}; - - -STD_ROM_PICK(Goldnaxe) -STD_ROM_FN(Goldnaxe) - -static struct BurnRomInfo Goldnaxe1RomDesc[] = { - { "epr-12389.ic2", 0x40000, 0x35d5fa77, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12388.ic1", 0x40000, 0x72952a93, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12385.ic19", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12386.ic20", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12387.ic21", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12378.ic9", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12379.ic12", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12380.ic10", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12381.ic13", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12382.ic11", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12383.ic14", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12390.ic8", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12384.ic6", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0110.key", 0x02000, 0xcd517dc6, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Goldnaxe1) -STD_ROM_FN(Goldnaxe1) - -static struct BurnRomInfo Goldnaxe2RomDesc[] = { - { "epr-12523.a7", 0x20000, 0x8e6128d7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12522.a5", 0x20000, 0xb6c35160, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12521.a8", 0x20000, 0x5001d713, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12519.a6", 0x20000, 0x4438ca8e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12385.a14", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12386.a15", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12387.a16", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12378.b1", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12379.b5", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12380.b2", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12381.b6", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12382.b3", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12383.b7", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12390.a10", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12384.a11", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0112.bin", 0x01000, 0x00000000, BRF_NODUMP }, -}; - - -STD_ROM_PICK(Goldnaxe2) -STD_ROM_FN(Goldnaxe2) - -static struct BurnRomInfo Goldnaxe3RomDesc[] = { - { "epr-12525.a7", 0x20000, 0x48332c76, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12524.a5", 0x20000, 0x8e58f342, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12521.a8", 0x20000, 0x5001d713, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12519.a6", 0x20000, 0x4438ca8e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12385.a14", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12386.a15", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12387.a16", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12378.b1", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12379.b5", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12380.b2", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12381.b6", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12382.b3", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12383.b7", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12390.a10", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12384.a11", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0120.key", 0x02000, 0x946e9fa6, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Goldnaxe3) -STD_ROM_FN(Goldnaxe3) - -static struct BurnRomInfo GoldnaxejRomDesc[] = { - { "epr-12540.a7", 0x20000, 0x0c7ccc6d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12539.a5", 0x20000, 0x1f24f7d0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12521.a8", 0x20000, 0x5001d713, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12519.a6", 0x20000, 0x4438ca8e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12385.a14", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12386.a15", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12387.a16", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12378.b1", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12379.b5", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12380.b2", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12381.b6", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12382.b3", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12383.b7", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12390.a10", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12384.a11", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0121.key", 0x02000, 0x72afed01, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Goldnaxej) -STD_ROM_FN(Goldnaxej) - -static struct BurnRomInfo GoldnaxeuRomDesc[] = { - { "epr-12543.ic2", 0x40000, 0xb0df9ca4, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12542.ic1", 0x40000, 0xb7994d3c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12385.ic19", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12386.ic20", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12387.ic21", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12378.ic9", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12379.ic12", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12380.ic10", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12381.ic13", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12382.ic11", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12383.ic14", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12390.ic8", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12384.ic6", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0122.key", 0x02000, 0xf123c2fb, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Goldnaxeu) -STD_ROM_FN(Goldnaxeu) - -static struct BurnRomInfo HwchampRomDesc[] = { - { "epr-11239.a7", 0x20000, 0xe5abfed7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11238.a5", 0x20000, 0x25180124, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-11241.a14", 0x20000, 0xfc586a86, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-11166.b14", 0x20000, 0xaeaaa9d8, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-11242.a15", 0x20000, 0x7715a742, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-11167.b15", 0x20000, 0x63a82afa, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-11243.a16", 0x20000, 0xf30cd5fd, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-11168.b16", 0x20000, 0x5b8494a8, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-11158.b1", 0x20000, 0xfc098a13, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11162.b5", 0x20000, 0x5db934a8, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11159.b2", 0x20000, 0x1f27ee74, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11163.b6", 0x20000, 0x8a6a5cf1, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11160.b3", 0x20000, 0xc0b2ba82, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11164.b7", 0x20000, 0xd6c7917b, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11161.b4", 0x20000, 0x35c9e44b, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-11165.b8", 0x20000, 0x57e8f9d2, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11240.a10", 0x08000, 0x96a12d9d, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-11244.a11", 0x20000, 0x4191c03d, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "mpr-11245.a12", 0x20000, 0xa4d53f7b, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "pls153.bin", 0x000eb, 0x39b47212, BRF_OPT }, // PLD -}; - - -STD_ROM_PICK(Hwchamp) -STD_ROM_FN(Hwchamp) - -static struct BurnRomInfo HwchampjRomDesc[] = { - { "epr-11152.a7", 0x20000, 0x8ab0ce62, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11153.a5", 0x20000, 0x84a743de, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11202.a14", 0x20000, 0x7c94ede3, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11213.b14", 0x20000, 0xaeaaa9d8, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11203.a15", 0x20000, 0x327754f7, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11214.b15", 0x20000, 0x63a82afa, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11204.a16", 0x20000, 0xdfc4cd33, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11215.b16", 0x20000, 0x5b8494a8, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11205.b1", 0x20000, 0xfc098a13, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11209.b5", 0x20000, 0x5db934a8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11206.b2", 0x20000, 0x1f27ee74, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11210.b6", 0x20000, 0x8a6a5cf1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11207.b3", 0x20000, 0xc0b2ba82, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11211.b7", 0x20000, 0xd6c7917b, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11208.b4", 0x20000, 0x35c9e44b, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11212.b8", 0x20000, 0x57e8f9d2, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11154.a10", 0x08000, 0x65791275, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11200.a11", 0x20000, 0x5c41a68a, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11201.a12", 0x20000, 0x9a993120, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0046.key", 0x02000, 0x488b3f8b, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, - - { "pls153.bin", 0x000eb, 0x39b47212, BRF_OPT }, // PLD -}; - - -STD_ROM_PICK(Hwchampj) -STD_ROM_FN(Hwchampj) - -static struct BurnRomInfo MvpRomDesc[] = { - { "13000.rom", 0x40000, 0x2e0e21ec, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "12999.rom", 0x40000, 0xfd213d28, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "13011.rom", 0x40000, 0x1cb871fc, SYS16_ROM_TILES | BRF_GRA }, - { "13012.rom", 0x40000, 0xb75e6821, SYS16_ROM_TILES | BRF_GRA }, - { "13013.rom", 0x40000, 0xf1944a3c, SYS16_ROM_TILES | BRF_GRA }, - - { "13003.rom", 0x40000, 0x21424151, SYS16_ROM_SPRITES | BRF_GRA }, - { "13006.rom", 0x40000, 0x2e9afd2f, SYS16_ROM_SPRITES | BRF_GRA }, - { "13004.rom", 0x40000, 0x0aa09dd3, SYS16_ROM_SPRITES | BRF_GRA }, - { "13007.rom", 0x40000, 0x55c8605b, SYS16_ROM_SPRITES | BRF_GRA }, - { "13005.rom", 0x40000, 0xc899c810, SYS16_ROM_SPRITES | BRF_GRA }, - { "13008.rom", 0x40000, 0xb3d46dfc, SYS16_ROM_SPRITES | BRF_GRA }, - { "13009.rom", 0x40000, 0x126d2e37, SYS16_ROM_SPRITES | BRF_GRA }, - { "13010.rom", 0x40000, 0xdf37c567, SYS16_ROM_SPRITES | BRF_GRA }, - - { "13002.rom", 0x08000, 0x1b6e1515, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "13001.rom", 0x40000, 0xe8cace8c, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0143.key", 0x02000, 0xfba2e8da, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Mvp) -STD_ROM_FN(Mvp) - -static struct BurnRomInfo MvpjRomDesc[] = { - { "epr-12967.a7", 0x20000, 0xe53ac137, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12965.a5", 0x20000, 0x4266cb9e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12968.a8", 0x20000, 0x91c772ac, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12966.a6", 0x20000, 0x39365a79, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12971.a14", 0x20000, 0x245dcd1f, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12983.b14", 0x20000, 0xf3570fc9, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12972.a15", 0x20000, 0xff7c4278, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12984.b15", 0x20000, 0xd37d1876, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12973.a16", 0x20000, 0x8dc9b9ea, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12985.b16", 0x20000, 0xe3f33a8a, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-12974.b1", 0x20000, 0xe1da5597, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12977.b5", 0x20000, 0xb9eb9762, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12975.b2", 0x20000, 0x364d51d1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12978.b6", 0x20000, 0x014b5442, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12976.b3", 0x20000, 0x43b549c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12979.b7", 0x20000, 0x20f603f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12962.a1", 0x20000, 0x9b678da3, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12980.b10", 0x20000, 0x883b792a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12963.a2", 0x20000, 0x8870f95a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12981.b11", 0x20000, 0x48636cb0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12964.a3", 0x20000, 0xf9148c5d, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12982.b12", 0x20000, 0xc4453292, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12969.a10", 0x08000, 0xec621893, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-12970.a11", 0x20000, 0x8f7d7657, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0142.key", 0x02000, 0x90468045, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Mvpj) -STD_ROM_FN(Mvpj) - -static struct BurnRomInfo PassshtRomDesc[] = { - { "epr-11871.a4", 0x10000, 0x0f9ccea5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11870.a1", 0x10000, 0xdf43ebcf, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-11854.b9", 0x10000, 0xd31c0b6c, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11855.b10", 0x10000, 0xb78762b4, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11856.b11", 0x10000, 0xea49f666, SYS16_ROM_TILES | BRF_GRA }, - - { "opr-11862.b1", 0x10000, 0xb6e94727, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11865.b5", 0x10000, 0x17e8d5d5, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11863.b2", 0x10000, 0x3e670098, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11866.b6", 0x10000, 0x50eb71cc, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11864.b3", 0x10000, 0x05733ca8, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11867.b7", 0x10000, 0x81e49697, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11857.a7", 0x08000, 0x789edc06, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11858.a8", 0x08000, 0x08ab0018, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11859.a9", 0x08000, 0x8673e01b, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11860.a10", 0x08000, 0x10263746, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11861.a11", 0x08000, 0x38b54a71, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0080.key", 0x02000, 0x222d016f, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Passsht) -STD_ROM_FN(Passsht) - -static struct BurnRomInfo PassshtaRomDesc[] = { - { "8.4a", 0x10000, 0xb84dc139, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "5.1a", 0x10000, 0xeffe29df, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-11854.b9", 0x10000, 0xd31c0b6c, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11855.b10", 0x10000, 0xb78762b4, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11856.b11", 0x10000, 0xea49f666, SYS16_ROM_TILES | BRF_GRA }, - - { "opr-11862.b1", 0x10000, 0xb6e94727, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11865.b5", 0x10000, 0x17e8d5d5, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11863.b2", 0x10000, 0x3e670098, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11866.b6", 0x10000, 0x50eb71cc, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11864.b3", 0x10000, 0x05733ca8, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11867.b7", 0x10000, 0x81e49697, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11857.a7", 0x08000, 0x789edc06, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11858.a8", 0x08000, 0x08ab0018, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11859.a9", 0x08000, 0x8673e01b, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11860.a10", 0x08000, 0x10263746, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11861.a11", 0x08000, 0x38b54a71, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0074.key", 0x02000, 0x71bd232d, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Passshta) -STD_ROM_FN(Passshta) - -static struct BurnRomInfo PassshtjRomDesc[] = { - { "epr-11853.a4", 0x10000, 0xfab337e7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11852.a1", 0x10000, 0x892a81fc, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-11854.b9", 0x10000, 0xd31c0b6c, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11855.b10", 0x10000, 0xb78762b4, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11856.b11", 0x10000, 0xea49f666, SYS16_ROM_TILES | BRF_GRA }, - - { "opr-11862.b1", 0x10000, 0xb6e94727, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11865.b5", 0x10000, 0x17e8d5d5, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11863.b2", 0x10000, 0x3e670098, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11866.b6", 0x10000, 0x50eb71cc, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11864.b3", 0x10000, 0x05733ca8, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11867.b7", 0x10000, 0x81e49697, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11857.a7", 0x08000, 0x789edc06, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11858.a8", 0x08000, 0x08ab0018, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11859.a9", 0x08000, 0x8673e01b, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11860.a10", 0x08000, 0x10263746, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11861.a11", 0x08000, 0x38b54a71, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0070.key", 0x02000, 0x5d0308aa, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Passshtj) -STD_ROM_FN(Passshtj) - -static struct BurnRomInfo PassshtbRomDesc[] = { - { "pass3_2p.bin", 0x10000, 0x26bb9299, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "pass4_2p.bin", 0x10000, 0x06ac6d5d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr11854.b9", 0x10000, 0xd31c0b6c, SYS16_ROM_TILES | BRF_GRA }, - { "opr11855.b10", 0x10000, 0xb78762b4, SYS16_ROM_TILES | BRF_GRA }, - { "opr11856.b11", 0x10000, 0xea49f666, SYS16_ROM_TILES | BRF_GRA }, - - { "opr11862.b1", 0x10000, 0xb6e94727, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr11865.b5", 0x10000, 0x17e8d5d5, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr11863.b2", 0x10000, 0x3e670098, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr11866.b6", 0x10000, 0x50eb71cc, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr11864.b3", 0x10000, 0x05733ca8, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr11867.b7", 0x10000, 0x81e49697, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr11857.a7", 0x08000, 0x789edc06, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr11858.a8", 0x08000, 0x08ab0018, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr11859.a9", 0x08000, 0x8673e01b, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr11860.a10", 0x08000, 0x10263746, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr11861.a11", 0x08000, 0x38b54a71, SYS16_ROM_UPD7759DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Passshtb) -STD_ROM_FN(Passshtb) - -static struct BurnRomInfo RiotcityRomDesc[] = { - { "epr-14612.bin", 0x20000, 0xa1b331ec, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-14610.bin", 0x20000, 0xcd4f2c50, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-14613.bin", 0x20000, 0x0659df4c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-14611.bin", 0x20000, 0xd9e6f80b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-14616.bin", 0x20000, 0x46d30368, SYS16_ROM_TILES | BRF_GRA }, - { "epr-14625.bin", 0x20000, 0xabfb80fe, SYS16_ROM_TILES | BRF_GRA }, - { "epr-14617.bin", 0x20000, 0x884e40f9, SYS16_ROM_TILES | BRF_GRA }, - { "epr-14626.bin", 0x20000, 0x4ef55846, SYS16_ROM_TILES | BRF_GRA }, - { "epr-14618.bin", 0x20000, 0x00eb260e, SYS16_ROM_TILES | BRF_GRA }, - { "epr-14627.bin", 0x20000, 0x961e5f82, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-14619.bin", 0x40000, 0x6f2b5ef7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-14622.bin", 0x40000, 0x7ca7e40d, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-14620.bin", 0x40000, 0x66183333, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-14623.bin", 0x40000, 0x98630049, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-14621.bin", 0x40000, 0xc0f2820e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-14624.bin", 0x40000, 0xd1a68448, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-14614.bin", 0x10000, 0xc65cc69a, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-14615.bin", 0x20000, 0x46653db1, SYS16_ROM_UPD7759DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Riotcity) -STD_ROM_FN(Riotcity) - -static struct BurnRomInfo RyukyuRomDesc[] = { - { "epr-13348.a7", 0x10000, 0x5f0e0c86, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-13347.a5", 0x10000, 0x398031fa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-13351.a14", 0x20000, 0xa68a4e6d, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13352.a15", 0x20000, 0x5e5531e4, SYS16_ROM_TILES | BRF_GRA }, - { "opr-13353.a16", 0x20000, 0x6d23dfd8, SYS16_ROM_TILES | BRF_GRA }, - - { "opr-13354.b1", 0x20000, 0xf07aad99, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13356.b5", 0x20000, 0x5498290b, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13355.b2", 0x20000, 0x67890019, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-13357.b6", 0x20000, 0xf9e7cf03, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-13349.a10", 0x08000, 0xb83183f8, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "opr-13350.a11", 0x20000, 0x3c59a658, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-5023.key", 0x02000, 0x43704331, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Ryukyu) -STD_ROM_FN(Ryukyu) - -static struct BurnRomInfo SdibRomDesc[] = { - { "epr-10986a.a4", 0x08000, 0x3e136215, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10984a.a1", 0x08000, 0x44bf3cf5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10987a.a5", 0x08000, 0xcfd79404, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10985a.a2", 0x08000, 0x1c21a03f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10829.a6", 0x08000, 0xa431ab08, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10826.a3", 0x08000, 0x2ed8e4b7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10772.b9", 0x10000, 0x182b6301, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10773.b10", 0x10000, 0x8f7129a2, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10774.b11", 0x10000, 0x4409411f, SYS16_ROM_TILES | BRF_GRA }, - - { "10760.b1", 0x10000, 0x70de327b, SYS16_ROM_SPRITES | BRF_GRA }, - { "10763.b5", 0x10000, 0x99ec5cb5, SYS16_ROM_SPRITES | BRF_GRA }, - { "10761.b2", 0x10000, 0x4e80f80d, SYS16_ROM_SPRITES | BRF_GRA }, - { "10764.b6", 0x10000, 0x602da5d5, SYS16_ROM_SPRITES | BRF_GRA }, - { "10762.b3", 0x10000, 0x464b5f78, SYS16_ROM_SPRITES | BRF_GRA }, - { "10765.b7", 0x10000, 0x0a73a057, SYS16_ROM_SPRITES | BRF_GRA }, - - { "10775.a7", 0x08000, 0x4cbd55a8, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0028.key", 0x02000, 0x9a5307b2, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Sdib) -STD_ROM_FN(Sdib) - -static struct BurnRomInfo SdiblRomDesc[] = { - { "a4.rom", 0x08000, 0xf2c41dd6, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "a1.rom", 0x08000, 0xa9f816ef, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "a5.rom", 0x08000, 0x7952e27e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "a2.rom", 0x08000, 0x369af326, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "a6.rom", 0x08000, 0x8ee2c287, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "a3.rom", 0x08000, 0x193e4231, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10772.b9", 0x10000, 0x182b6301, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10773.b10", 0x10000, 0x8f7129a2, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10774.b11", 0x10000, 0x4409411f, SYS16_ROM_TILES | BRF_GRA }, - - { "b1.rom", 0x10000, 0x30e2c50a, SYS16_ROM_SPRITES | BRF_GRA }, - { "b5.rom", 0x10000, 0x794e3e8b, SYS16_ROM_SPRITES | BRF_GRA }, - { "b2.rom", 0x10000, 0x6a8b3fd0, SYS16_ROM_SPRITES | BRF_GRA }, - { "10764.b6", 0x10000, 0x602da5d5, SYS16_ROM_SPRITES | BRF_GRA }, - { "b3.rom", 0x10000, 0xb9de3aeb, SYS16_ROM_SPRITES | BRF_GRA }, - { "10765.b7", 0x10000, 0x0a73a057, SYS16_ROM_SPRITES | BRF_GRA }, - - { "a7.rom", 0x08000, 0x793f9f7f, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Sdibl) -STD_ROM_FN(Sdibl) - -static struct BurnRomInfo DefenseRomDesc[] = { - { "epr-10917a.a4", 0x08000, 0xd91ac47c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10915.a1", 0x08000, 0x7344c510, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10918a.a5", 0x08000, 0xe41befcd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10916a.a2", 0x08000, 0x7f58ba12, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10829.a6", 0x08000, 0xa431ab08, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10826.a3", 0x08000, 0x2ed8e4b7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "10919.b9", 0x10000, 0x23b88f82, SYS16_ROM_TILES | BRF_GRA }, - { "10920.b10", 0x10000, 0x22b1fb4c, SYS16_ROM_TILES | BRF_GRA }, - { "10921.b11", 0x10000, 0x7788f55d, SYS16_ROM_TILES | BRF_GRA }, - - { "10760.b1", 0x10000, 0x70de327b, SYS16_ROM_SPRITES | BRF_GRA }, - { "10763.b5", 0x10000, 0x99ec5cb5, SYS16_ROM_SPRITES | BRF_GRA }, - { "10761.b2", 0x10000, 0x4e80f80d, SYS16_ROM_SPRITES | BRF_GRA }, - { "10764.b6", 0x10000, 0x602da5d5, SYS16_ROM_SPRITES | BRF_GRA }, - { "10762.b3", 0x10000, 0x464b5f78, SYS16_ROM_SPRITES | BRF_GRA }, - { "10765.b7", 0x10000, 0x0a73a057, SYS16_ROM_SPRITES | BRF_GRA }, - - { "10775.a7", 0x08000, 0x4cbd55a8, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0028.key", 0x02000, 0x9a5307b2, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Defense) -STD_ROM_FN(Defense) - -static struct BurnRomInfo Shinobi2RomDesc[] = { - { "epr-11282.a4", 0x10000, 0x5f2e5524, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11280.a1", 0x10000, 0xbdfe5c38, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11283.a5", 0x10000, 0x9d46e707, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11281.a2", 0x10000, 0x7961d07e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11284.b9", 0x10000, 0x5f62e163, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11285.b10", 0x10000, 0x75f8fbc9, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11286.b11", 0x10000, 0x06508bb9, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11290.b1", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11294.b5", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11291.b2", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11295.b6", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11292.b3", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11296.b7", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11293.b4", 0x10000, 0x41f41063, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11297.b8", 0x10000, 0xb6e1fd72, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11287.a7", 0x08000, 0xe8cccd42, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11288.a8", 0x08000, 0xc8df8460, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11289.a9", 0x08000, 0xe5a4cf30, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0049.key", 0x02000, 0x8fac824f, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Shinobi2) -STD_ROM_FN(Shinobi2) - -static struct BurnRomInfo Shinobi3RomDesc[] = { - { "epr-11299.a4", 0x10000, 0xb930399d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11298.a1", 0x10000, 0x343f4c46, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11283.a5", 0x10000, 0x9d46e707, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11281.a2", 0x10000, 0x7961d07e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11284.b9", 0x10000, 0x5f62e163, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11285.b10", 0x10000, 0x75f8fbc9, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11286.b11", 0x10000, 0x06508bb9, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11290.b1", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11294.b5", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11291.b2", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11295.b6", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11292.b3", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11296.b7", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11293.b4", 0x10000, 0x41f41063, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11297.b8", 0x10000, 0xb6e1fd72, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11372.a7", 0x08000, 0x0824269a, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11288.a8", 0x08000, 0xc8df8460, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11289.a9", 0x08000, 0xe5a4cf30, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0054.key", 0x02000, 0x39fd4535, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Shinobi3) -STD_ROM_FN(Shinobi3) - -static struct BurnRomInfo Shinobi4RomDesc[] = { - { "epr-11360.a7", 0x20000, 0xb1f67ab9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11359.a5", 0x20000, 0x0f0306e1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11363.a14", 0x20000, 0x40914168, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11364.a15", 0x20000, 0xe63649a4, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11365.a16", 0x20000, 0x1ef55d20, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11366.b1", 0x20000, 0x319ede73, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11368.b5", 0x20000, 0x0377d7ce, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11367.b2", 0x20000, 0x1d06c5c7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11369.b6", 0x20000, 0xd751d2a2, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11377.a10", 0x08000, 0x0fb6af34, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11362.a11", 0x20000, 0x256af749, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0054.key", 0x02000, 0x39fd4535, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Shinobi4) -STD_ROM_FN(Shinobi4) - -static struct BurnRomInfo Shinobi5RomDesc[] = { - { "epr-11360.a7", 0x20000, 0xb1f67ab9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11359.a5", 0x20000, 0x0f0306e1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11363.a14", 0x20000, 0x40914168, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11364.a15", 0x20000, 0xe63649a4, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11365.a16", 0x20000, 0x1ef55d20, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11366.b1", 0x20000, 0x319ede73, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11368.b5", 0x20000, 0x0377d7ce, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11367.b2", 0x20000, 0x1d06c5c7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11369.b6", 0x20000, 0xd751d2a2, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11361.a10", 0x08000, 0x1f47ebcb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11362.a11", 0x20000, 0x256af749, SYS16_ROM_UPD7759DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Shinobi5) -STD_ROM_FN(Shinobi5) - -static struct BurnRomInfo SjryukoRomDesc[] = { - { "epr-12256.a4", 0x08000, 0x5987ee1b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12253.a1", 0x08000, 0x26a822df, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12257.a5", 0x08000, 0x3a2acc3f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12254.a2", 0x08000, 0x7e908217, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12224-95.b9", 0x08000, 0xeac17ba1, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12225-94.b10", 0x08000, 0x2310fc98, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12226-93.b11", 0x08000, 0x210e6999, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-12232-10.b1", 0x10000, 0x0adec62b, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12236-11.b5", 0x10000, 0x286b9af8, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12233-17.b2", 0x10000, 0x3e45969c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12237-18.b6", 0x10000, 0xe5058e96, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12234-23.b3", 0x10000, 0x8c8d54ef, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12238-24.b7", 0x10000, 0x7ada3304, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12235-29.b4", 0x10000, 0xfa45d511, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12239-30.b8", 0x10000, 0x91f70c8b, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12244.a7", 0x08000, 0xcb2a47e5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-12245.a8", 0x08000, 0x66164134, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-12246.a9", 0x08000, 0xf1242582, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-12247.a10", 0x08000, 0xef8a64c6, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-12248.a11", 0x08000, 0xd1eabdab, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-5021.key", 0x02000, 0x4a3422e4, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Sjryuko) -STD_ROM_FN(Sjryuko) - -static struct BurnRomInfo SnapperRomDesc[] = { - { "snap2.r01", 0x10000, 0x9a9e4ed3, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "snap1.r02", 0x10000, 0xcd468d6a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "snap4.r03", 0x08000, 0x0f848e1e, SYS16_ROM_TILES | BRF_GRA }, - { "snap3.r04", 0x08000, 0xc7f8cf0e, SYS16_ROM_TILES | BRF_GRA }, - { "snap5.r05", 0x08000, 0x378e08eb, SYS16_ROM_TILES | BRF_GRA }, -}; - - -STD_ROM_PICK(Snapper) -STD_ROM_FN(Snapper) - -static struct BurnRomInfo SonicbomRomDesc[] = { - { "epr-11342.a4", 0x10000, 0x454693f1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11340.a1", 0x10000, 0x03ba3fed, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11343.a5", 0x10000, 0xedfeb7d4, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11341.a2", 0x10000, 0x0338f771, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "opr-11344.b9", 0x10000, 0x59a9f940, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11345.b10", 0x10000, 0xb44c068b, SYS16_ROM_TILES | BRF_GRA }, - { "opr-11346.b11", 0x10000, 0xe5ada66c, SYS16_ROM_TILES | BRF_GRA }, - - { "opr-11350.b1", 0x10000, 0x525ba1df, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11354.b5", 0x10000, 0x793fa3ac, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11351.b2", 0x10000, 0x63b1f1ca, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11355.b6", 0x10000, 0xfe0fa332, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11352.b3", 0x10000, 0x047fa4b0, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11356.b7", 0x10000, 0xaea3c39d, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11353.b4", 0x10000, 0x4e0791f8, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-11357.b8", 0x10000, 0xa7c5ea41, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11347.a7", 0x08000, 0xb41f0ced, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11348.a8", 0x08000, 0x89924588, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11349.a9", 0x08000, 0x8e4b6204, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0053.key", 0x02000, 0x91c80c88, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Sonicbom) -STD_ROM_FN(Sonicbom) - -static struct BurnRomInfo SuprleagRomDesc[] = { - { "epr-11133.a04", 0x10000, 0xeed72f37, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11130.a01", 0x10000, 0xe2451676, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11134.a05", 0x10000, 0xccd857f5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11131.a02", 0x10000, 0x9b78c2cc, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11135.a06", 0x10000, 0x3735e0e1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-11132.a03", 0x10000, 0xff199325, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-11136.b09", 0x10000, 0xc3860ce4, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11137.b10", 0x10000, 0x92d96187, SYS16_ROM_TILES | BRF_GRA }, - { "epr-11138.b11", 0x10000, 0xc01dc773, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-11144.b01", 0x10000, 0xb31de51c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11148.b05", 0x10000, 0x126e1309, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11145.b02", 0x10000, 0x4223d2c3, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11149.b06", 0x10000, 0x694d3765, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11146.b03", 0x10000, 0xbf0359b6, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11150.b07", 0x10000, 0x9fc0aded, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11147.b04", 0x10000, 0x3e592772, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-11151.b08", 0x10000, 0x9de95169, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-11139.a07", 0x08000, 0x9cbd99da, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-11140.a08", 0x08000, 0xb297371b, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11141.a09", 0x08000, 0x19756aa6, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11142.a10", 0x08000, 0x25d26c66, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-11143.a11", 0x08000, 0x848b7b77, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0045.key", 0x02000, 0x0594cc2e, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Suprleag) -STD_ROM_FN(Suprleag) - -static struct BurnRomInfo Tetris1RomDesc[] = { - { "epr-12164.a4", 0x08000, 0xb329cd6f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12163.a1", 0x08000, 0xd372d3f3, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12165.b9", 0x10000, 0x62640221, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12166.b10", 0x10000, 0x9abd183b, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12167.b11", 0x10000, 0x2495fd4e, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-12169.b1", 0x08000, 0xdacc6165, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12170.b5", 0x08000, 0x87354e42, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12168.a7", 0x08000, 0xbd9ba01b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0091.key", 0x02000, 0xa7937661, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Tetris1) -STD_ROM_FN(Tetris1) - -static struct BurnRomInfo Tetris2RomDesc[] = { - { "epr-12193.a7", 0x20000, 0x44466ed4, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12192.a5", 0x20000, 0xa1c8af00, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12165.b9", 0x10000, 0x62640221, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12166.b10", 0x10000, 0x9abd183b, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12167.b11", 0x10000, 0x2495fd4e, SYS16_ROM_TILES | BRF_GRA }, - - { "obj0-o.rom", 0x10000, 0x2fb38880, SYS16_ROM_SPRITES | BRF_GRA }, - { "obj0-e.rom", 0x10000, 0xd6a02cba, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12168.a7", 0x08000, 0xbd9ba01b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0092.key", 0x02000, 0xd10e1ad9, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Tetris2) -STD_ROM_FN(Tetris2) - -static struct BurnRomInfo TetrisblRomDesc[] = { - { "rom2.bin", 0x10000, 0x4d165c38, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "rom1.bin", 0x10000, 0x1e912131, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr12165.b9", 0x10000, 0x62640221, SYS16_ROM_TILES | BRF_GRA }, - { "epr12166.b10", 0x10000, 0x9abd183b, SYS16_ROM_TILES | BRF_GRA }, - { "epr12167.b11", 0x10000, 0x2495fd4e, SYS16_ROM_TILES | BRF_GRA }, - - { "obj0-o.rom", 0x10000, 0x2fb38880, SYS16_ROM_SPRITES | BRF_GRA }, - { "obj0-e.rom", 0x10000, 0xd6a02cba, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr12168.a7", 0x08000, 0xbd9ba01b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Tetrisbl) -STD_ROM_FN(Tetrisbl) - -static struct BurnRomInfo TimescanRomDesc[] = { - { "epr-10853.a4", 0x08000, 0x24d7c5fb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10850.a1", 0x08000, 0xf1575732, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10854.a5", 0x08000, 0x82d0b237, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10851.a2", 0x08000, 0xf5ce271b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10855.a6", 0x08000, 0x63e95a53, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-10852.a3", 0x08000, 0x7cd1382b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-10543.b9", 0x08000, 0x07dccc37, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10544.b10", 0x08000, 0x84fb9a3a, SYS16_ROM_TILES | BRF_GRA }, - { "epr-10545.b11", 0x08000, 0xc8694bc0, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-10548.b1", 0x08000, 0xaa150735, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10552.b5", 0x08000, 0x6fcbb9f7, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10549.b2", 0x08000, 0x2f59f067, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10553.b6", 0x08000, 0x8a220a9f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10550.b3", 0x08000, 0xf05069ff, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10554.b7", 0x08000, 0xdc64f809, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10551.b4", 0x08000, 0x435d811f, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-10555.b8", 0x08000, 0x2143c471, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-10562.a7", 0x08000, 0x3f5028bf, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-10563.a8", 0x08000, 0x9db7eddf, SYS16_ROM_UPD7759DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Timescan) -STD_ROM_FN(Timescan) - -static struct BurnRomInfo ToryumonRomDesc[] = { - { "epr-17689.a2", 0x20000, 0x4f0dee19, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-17688.a1", 0x20000, 0x717d81c7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-17700.b11", 0x40000, 0x8f288b37, SYS16_ROM_TILES | BRF_GRA }, - { "epr-17701.b12", 0x40000, 0x6dfb025b, SYS16_ROM_TILES | BRF_GRA }, - { "epr-17702.b13", 0x40000, 0xae0b7eab, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-17692.b1", 0x20000, 0x543c4327, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-17695.b4", 0x20000, 0xee60f244, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-17693.b2", 0x20000, 0x4a350b3e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-17696.b5", 0x20000, 0x6edb54f1, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-17694.b3", 0x20000, 0xb296d71d, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-17697.b6", 0x20000, 0x6ccb7b28, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-17698.b7", 0x20000, 0xcd4dfb82, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-17699.b8", 0x20000, 0x2694ecce, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-17691.a13", 0x08000, 0x14205388, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-17690.a11", 0x40000, 0x4f9ba4e4, SYS16_ROM_UPD7759DATA | BRF_SND }, -}; - - -STD_ROM_PICK(Toryumon) -STD_ROM_FN(Toryumon) - -static struct BurnRomInfo TturfRomDesc[] = { - { "12327.a7", 0x20000, 0x0376c593, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "12326.a5", 0x20000, 0xf998862b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "12268.a14", 0x10000, 0xe0dac07f, SYS16_ROM_TILES | BRF_GRA }, - { "12269.a15", 0x10000, 0x457a8790, SYS16_ROM_TILES | BRF_GRA }, - { "12270.a16", 0x10000, 0x69fc025b, SYS16_ROM_TILES | BRF_GRA }, - - { "12279.b1", 0x10000, 0x7a169fb1, SYS16_ROM_SPRITES | BRF_GRA }, - { "12283.b5", 0x10000, 0xae0fa085, SYS16_ROM_SPRITES | BRF_GRA }, - { "12278.b2", 0x10000, 0x961d06b7, SYS16_ROM_SPRITES | BRF_GRA }, - { "12282.b6", 0x10000, 0xe8671ee1, SYS16_ROM_SPRITES | BRF_GRA }, - { "12277.b3", 0x10000, 0xf16b6ba2, SYS16_ROM_SPRITES | BRF_GRA }, - { "12281.b7", 0x10000, 0x1ef1077f, SYS16_ROM_SPRITES | BRF_GRA }, - { "12276.b4", 0x10000, 0x838bd71f, SYS16_ROM_SPRITES | BRF_GRA }, - { "12280.b8", 0x10000, 0x639a57cb, SYS16_ROM_SPRITES | BRF_GRA }, - - { "12328.a10", 0x08000, 0x00000000, SYS16_ROM_Z80PROG | BRF_NODUMP | BRF_PRG }, - - { "12329.a11", 0x10000, 0xed9a686d, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "12330.a12", 0x10000, 0xfb762bca, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0104.bin", 0x01000, 0x00000000, BRF_NODUMP }, -}; - - -STD_ROM_PICK(Tturf) -STD_ROM_FN(Tturf) - -static struct BurnRomInfo TturfuRomDesc[] = { - { "epr-12266.bin", 0x10000, 0xf549def8, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12264.bin", 0x10000, 0xf7cdb289, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12267.bin", 0x10000, 0x3c3ce191, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12265.bin", 0x10000, 0x8cdadd9a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "12268.a14", 0x10000, 0xe0dac07f, SYS16_ROM_TILES | BRF_GRA }, - { "12269.a15", 0x10000, 0x457a8790, SYS16_ROM_TILES | BRF_GRA }, - { "12270.a16", 0x10000, 0x69fc025b, SYS16_ROM_TILES | BRF_GRA }, - - { "12276.b4", 0x10000, 0x838bd71f, SYS16_ROM_SPRITES | BRF_GRA }, - { "12280.b8", 0x10000, 0x639a57cb, SYS16_ROM_SPRITES | BRF_GRA }, - { "12277.b3", 0x10000, 0xf16b6ba2, SYS16_ROM_SPRITES | BRF_GRA }, - { "12281.b7", 0x10000, 0x1ef1077f, SYS16_ROM_SPRITES | BRF_GRA }, - { "12278.b2", 0x10000, 0x961d06b7, SYS16_ROM_SPRITES | BRF_GRA }, - { "12282.b6", 0x10000, 0xe8671ee1, SYS16_ROM_SPRITES | BRF_GRA }, - { "12279.b1", 0x10000, 0x7a169fb1, SYS16_ROM_SPRITES | BRF_GRA }, - { "12283.b5", 0x10000, 0xae0fa085, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12271.a7", 0x08000, 0x99671e52, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "epr-12272.a8", 0x08000, 0x7cf7e69f, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-12273.a9", 0x08000, 0x28f0bb8b, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-12274.a10", 0x08000, 0x8207f0c4, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "epr-12275.a11", 0x08000, 0x182f3c3d, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0099.bin", 0x01000, 0xf676e3e4, BRF_OPT }, -}; - - -STD_ROM_PICK(Tturfu) -STD_ROM_FN(Tturfu) - -static struct BurnRomInfo Wb3RomDesc[] = { - { "epr-12259.a7", 0x20000, 0x54927c7e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12258.a5", 0x20000, 0x01f5898c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12124.a14", 0x10000, 0xdacefb6f, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12125.a15", 0x10000, 0x9fc36df7, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12126.a16", 0x10000, 0xa693fd94, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12127.a10", 0x08000, 0x0bb901bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0098.bin", 0x01000, 0x00000000, BRF_NODUMP }, -}; - - -STD_ROM_PICK(Wb3) -STD_ROM_FN(Wb3) - -static struct BurnRomInfo Wb32RomDesc[] = { - { "epr-12100.a6", 0x10000, 0xf5ca4abc, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12098.a1", 0x10000, 0xd998e5e5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12101.a5", 0x10000, 0x6146492b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12099.a2", 0x10000, 0x3e243b45, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12124.b9", 0x10000, 0xdacefb6f, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12125.b10", 0x10000, 0x9fc36df7, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12126.b11", 0x10000, 0xa693fd94, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12127.a7", 0x08000, 0x0bb901bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0085.key", 0x02000, 0x8150f38d, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Wb32) -STD_ROM_FN(Wb32) - -static struct BurnRomInfo Wb33RomDesc[] = { - { "epr-12137.a7", 0x20000, 0x6f81238e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12136.a5", 0x20000, 0x4cf05003, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12124.a14", 0x10000, 0xdacefb6f, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12125.a15", 0x10000, 0x9fc36df7, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12126.a16", 0x10000, 0xa693fd94, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12127.a10", 0x08000, 0x0bb901bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0089.key", 0x02000, 0x597d30d3, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Wb33) -STD_ROM_FN(Wb33) - -static struct BurnRomInfo Wb34RomDesc[] = { - { "epr-12131.a7", 0x20000, 0xb95ecf88, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12128.a5", 0x20000, 0xb711372b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "epr-12124.a14", 0x10000, 0xdacefb6f, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12125.a15", 0x10000, 0x9fc36df7, SYS16_ROM_TILES | BRF_GRA }, - { "epr-12126.a16", 0x10000, 0xa693fd94, SYS16_ROM_TILES | BRF_GRA }, - - { "epr-12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr-12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12127.a10", 0x08000, 0x0bb901bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "317-0087.key", 0x02000, 0x162cb531, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Wb34) -STD_ROM_FN(Wb34) - -static struct BurnRomInfo Wb3bblRomDesc[] = { - { "wb3_03", 0x10000, 0x0019ab3b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "wb3_05", 0x10000, 0x196e17ee, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "wb3_02", 0x10000, 0xc87350cb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "wb3_04", 0x10000, 0x565d5035, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "wb3_14", 0x10000, 0xd3f20bca, SYS16_ROM_TILES | BRF_GRA }, - { "wb3_15", 0x10000, 0x96ff9d52, SYS16_ROM_TILES | BRF_GRA }, - { "wb3_16", 0x10000, 0xafaf0d31, SYS16_ROM_TILES | BRF_GRA }, - - { "epr12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, - { "epr12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr12127.a10", 0x08000, 0x0bb901bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Wb3bbl) -STD_ROM_FN(Wb3bbl) - -static struct BurnRomInfo WrestwarRomDesc[] = { - { "epr-12372.a7", 0x20000, 0xeeaba126, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12371.a5", 0x20000, 0x6714600a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12146.a8", 0x20000, 0xb77ba665, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12144.a6", 0x20000, 0xddf075cb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12150.a14", 0x20000, 0x6a821ab9, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12151.a15", 0x20000, 0x2b1a0751, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12152.a16", 0x20000, 0xf6e190fe, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12153.b1", 0x20000, 0xffa7d368, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12157.b5", 0x20000, 0x8d7794c1, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12154.b2", 0x20000, 0x0ed343f2, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12158.b6", 0x20000, 0x99458d58, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12155.b3", 0x20000, 0x3087104d, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12159.b7", 0x20000, 0xabcf9bed, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12156.b4", 0x20000, 0x41b6068b, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12160.b8", 0x20000, 0x97eac164, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12141.a1", 0x20000, 0x260311c5, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12161.b10", 0x20000, 0x35a4b1b1, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12142.a2", 0x10000, 0x12e38a5c, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12162.b11", 0x10000, 0xfa06fd24, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12147.a10", 0x08000, 0xc3609607, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12148.a11", 0x20000, 0xfb9a7f29, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "mpr-12149.a12", 0x20000, 0xd6617b19, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0103.bin", 0x01000, 0xaa0710f5, BRF_OPT } -}; - - -STD_ROM_PICK(Wrestwar) -STD_ROM_FN(Wrestwar) - -static struct BurnRomInfo Wrestwar1RomDesc[] = { - { "epr-12145.a7", 0x20000, 0x2af51e2e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12143.a5", 0x20000, 0x4131e345, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12146.a8", 0x20000, 0xb77ba665, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12144.a6", 0x20000, 0xddf075cb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12150.a14", 0x20000, 0x6a821ab9, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12151.a15", 0x20000, 0x2b1a0751, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12152.a16", 0x20000, 0xf6e190fe, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12153.b1", 0x20000, 0xffa7d368, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12157.b5", 0x20000, 0x8d7794c1, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12154.b2", 0x20000, 0x0ed343f2, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12158.b6", 0x20000, 0x99458d58, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12155.b3", 0x20000, 0x3087104d, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12159.b7", 0x20000, 0xabcf9bed, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12156.b4", 0x20000, 0x41b6068b, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12160.b8", 0x20000, 0x97eac164, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12141.a1", 0x20000, 0x260311c5, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12161.b10", 0x20000, 0x35a4b1b1, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12142.a2", 0x10000, 0x12e38a5c, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12162.b11", 0x10000, 0xfa06fd24, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12147.a10", 0x08000, 0xc3609607, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12148.a11", 0x20000, 0xfb9a7f29, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "mpr-12149.a12", 0x20000, 0xd6617b19, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0090.key", 0x02000, 0xb7c24c4a, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Wrestwar1) -STD_ROM_FN(Wrestwar1) - -static struct BurnRomInfo Wrestwar2RomDesc[] = { - { "epr-12370.a7", 0x20000, 0xcb5dbb76, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12369.a5", 0x20000, 0x6f47dd2f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12146.a8", 0x20000, 0xb77ba665, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - { "epr-12144.a6", 0x20000, 0xddf075cb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12150.a14", 0x20000, 0x6a821ab9, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12151.a15", 0x20000, 0x2b1a0751, SYS16_ROM_TILES | BRF_GRA }, - { "mpr-12152.a16", 0x20000, 0xf6e190fe, SYS16_ROM_TILES | BRF_GRA }, - - { "mpr-12153.b1", 0x20000, 0xffa7d368, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12157.b5", 0x20000, 0x8d7794c1, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12154.b2", 0x20000, 0x0ed343f2, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12158.b6", 0x20000, 0x99458d58, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12155.b3", 0x20000, 0x3087104d, SYS16_ROM_SPRITES | BRF_GRA }, - { "mpr-12159.b7", 0x20000, 0xabcf9bed, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12156.b4", 0x20000, 0x41b6068b, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12160.b8", 0x20000, 0x97eac164, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12141.a1", 0x20000, 0x260311c5, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12161.b10", 0x20000, 0x35a4b1b1, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12142.a2", 0x10000, 0x12e38a5c, SYS16_ROM_SPRITES | BRF_GRA }, - { "opr-12162.b11", 0x10000, 0xfa06fd24, SYS16_ROM_SPRITES | BRF_GRA }, - - { "epr-12147.a10", 0x08000, 0xc3609607, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, - - { "mpr-12148.a11", 0x20000, 0xfb9a7f29, SYS16_ROM_UPD7759DATA | BRF_SND }, - { "mpr-12149.a12", 0x20000, 0xd6617b19, SYS16_ROM_UPD7759DATA | BRF_SND }, - - { "317-0102.key", 0x02000, 0x28ba1bf0, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, -}; - - -STD_ROM_PICK(Wrestwar2) -STD_ROM_FN(Wrestwar2) - -/*==================================================== -Bootleg Z80 Handling -====================================================*/ - -UINT8 __fastcall BootlegZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x01: { - return BurnYM2151ReadStatus(); - } - - case 0x40: - case 0xc0: { - return System16SoundLatch; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); -#endif - - return 0; -} - -void __fastcall BootlegZ80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - d &= 0xff; - - switch (a) { - case 0x00: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x01: { - BurnYM2151WriteRegister(d); - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Write Port -> %02X, %02X\n"), a, d); -#endif -} - -UINT8 __fastcall BootlegZ80Read(UINT16 a) -{ - switch (a) { - case 0xe000: - case 0xe800: { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return System16SoundLatch; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); -#endif - - return 0; -} - -#if 0 && defined FBA_DEBUG -void __fastcall BootlegZ80Write(UINT16 a, UINT8 d) -{ - - bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); -} -#endif - -void BootlegMapZ80() -{ - ZetMapArea(0x0000, 0x7fff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0x7fff, 2, System16Z80Rom); - - ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); - ZetMemEnd(); - - ZetSetReadHandler(BootlegZ80Read); -#if 0 && defined FBA_DEBUG - ZetSetWriteHandler(BootlegZ80Write); -#endif - ZetSetInHandler(BootlegZ80PortRead); - ZetSetOutHandler(BootlegZ80PortWrite); -} - -/*==================================================== -Memory Handlers -====================================================*/ - -UINT8 __fastcall System16BReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - return 0xff - System16Input[1]; - } - - case 0xc41005: { - return System16Dip[2]; - } - - case 0xc41007: { - return 0xff - System16Input[2]; - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); -#endif - - return 0xff; -} - -void __fastcall System16BWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16BTileByteWrite((a - 0x400000) ^ 1, d); - return; - } - - switch (a) { - case 0xc40001: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - return; - } - - case 0xfe0007: { - System16SoundLatch = d; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); -#endif -} - -void __fastcall System16BWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16BTileWordWrite(a - 0x400000, d); - return; - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X\n"), a, d); -#endif -} - -void __fastcall AliensynWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xc00007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -UINT8 __fastcall AtomicpReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - return 0xff - System16Input[1]; - } - - case 0xc41005: { - return System16Dip[0]; - } - - case 0xc41007: { - return System16Dip[1]; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); -#endif - - return 0xff; -} - -void __fastcall AtomicpWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16BTileByteWrite((a - 0x400000) ^ 1, d); - return; - } - - switch (a) { - case 0x123407: { - // ??? - return; - } - - case 0x3f0001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3f0003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x080000: { - BurnYM2413Write(0, d); - return; - } - - case 0x080002: { - BurnYM2413Write(1, d); - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); -#endif -} - -void __fastcall AurailWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xfc0001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0xfc0003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - } -} - -UINT8 __fastcall BayrouteReadByte(UINT32 a) -{ - switch (a) { - case 0x901001: { - return 0xff - System16Input[0]; - } - - case 0x901003: { - return 0xff - System16Input[1]; - } - - case 0x901007: { - return 0xff - System16Input[2]; - } - - case 0x902001: { - return System16Dip[0]; - } - - case 0x902003: { - return System16Dip[1]; - } - } - - return 0xff; -} - -void __fastcall BayrouteWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x700000 && a <= 0x70ffff) { - System16BTileByteWrite((a - 0x700000) ^ 1, d); - return; - } - - switch (a) { - case 0x900001: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - return; - } - - case 0xff0007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -void __fastcall BayrouteWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x700000 && a <= 0x70ffff) { - System16BTileWordWrite(a - 0x700000, d); - return; - } -} - -UINT8 __fastcall BulletReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - return 0xff - System16Input[1]; - } - - case 0xc41005: { - return 0xff - System16Input[3]; - } - - case 0xc41007: { - return 0xff - System16Input[2]; - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - } - - return 0xff; -} - -void __fastcall BulletWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xc00007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -UINT8 __fastcall CottonReadByte(UINT32 a) -{ - switch (a) { - case 0x601001: { - return 0xff - System16Input[0]; - } - - case 0x601003: { - return 0xff - System16Input[1]; - } - - case 0x601005: { - return 0xff; - } - - case 0x601007: { - return 0xff - System16Input[2]; - } - - case 0x602001: { - return System16Dip[0]; - } - - case 0x602003: { - return System16Dip[1]; - } - - case 0x7038f7: { - return (System16Rom[SekGetPC(0) + 1] << 8) | System16Rom[SekGetPC(0) + 0]; - } - } - - return 0xff; -} - -void __fastcall CottonWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16BTileByteWrite((a - 0x400000) ^ 1, d); - return; - } - - switch (a) { - case 0x100001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x100003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x600001: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - return; - } - - case 0xff0007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -void __fastcall CottonWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16BTileWordWrite(a - 0x400000, d); - return; - } -} - -void __fastcall DduxWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x3f0001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3f0003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - } -} - -void __fastcall DduxblGfxWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xc46021: { - BootlegFgPage[1] = d & 0xf; - BootlegBgPage[1] = (d >> 4) & 0xf; - return; - } - - case 0xc46023: { - BootlegFgPage[0] = d & 0xf; - BootlegBgPage[0] = (d >> 4) & 0xf; - return; - } - - case 0xc46025: { - BootlegFgPage[3] = d & 0xf; - BootlegBgPage[3] = (d >> 4) & 0xf; - return; - } - - case 0xc46027: { - BootlegFgPage[2] = d & 0xf; - BootlegBgPage[2] = (d >> 4) & 0xf; - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); -#endif -} - -void __fastcall DduxblGfxWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0xc46000: { - System16ScrollY[1] = d; - return; - } - - case 0xc46008: { - System16ScrollX[1] = (d ^ 0xffff) & 0x1ff; - return; - } - - case 0xc46010: { - System16ScrollY[0] = d; - return; - } - - case 0xc46018: { - System16ScrollX[0] = (d ^ 0xffff) & 0x1ff; - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X\n"), a, d); -#endif -} - -void __fastcall DduxblWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xc40001: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - return; - } - - case 0xc40007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); -#endif -} - -static INT16 DunkshotTrack1X = 0; -static INT16 DunkshotTrack1Y = 0; -static INT16 DunkshotTrack2X = 0; -static INT16 DunkshotTrack2Y = 0; -static INT16 DunkshotTrack3X = 0; -static INT16 DunkshotTrack3Y = 0; -static INT16 DunkshotTrack4X = 0; -static INT16 DunkshotTrack4Y = 0; - -void DunkshotMakeAnalogInputs() -{ - if (System16InputPort2[0]) DunkshotTrack1X += 0x40; - if (System16InputPort2[1]) DunkshotTrack1X -= 0x40; - if (DunkshotTrack1X >= 0x1000) DunkshotTrack1X = 0; - if (DunkshotTrack1X < 0) DunkshotTrack1X = 0xfc0; - - if (System16InputPort2[2]) DunkshotTrack1Y -= 0x40; - if (System16InputPort2[3]) DunkshotTrack1Y += 0x40; - if (DunkshotTrack1Y >= 0x1000) DunkshotTrack1Y = 0; - if (DunkshotTrack1Y < 0) DunkshotTrack1Y = 0xfc0; - - if (System16InputPort2[4]) DunkshotTrack2X += 0x40; - if (System16InputPort2[5]) DunkshotTrack2X -= 0x40; - if (DunkshotTrack2X >= 0x1000) DunkshotTrack2X = 0; - if (DunkshotTrack2X < 0) DunkshotTrack2X = 0xfc0; - - if (System16InputPort2[6]) DunkshotTrack2Y -= 0x40; - if (System16InputPort2[7]) DunkshotTrack2Y += 0x40; - if (DunkshotTrack2Y >= 0x1000) DunkshotTrack2Y = 0; - if (DunkshotTrack2Y < 0) DunkshotTrack2Y = 0xfc0; - - if (System16InputPort3[0]) DunkshotTrack3X += 0x40; - if (System16InputPort3[1]) DunkshotTrack3X -= 0x40; - if (DunkshotTrack3X >= 0x1000) DunkshotTrack3X = 0; - if (DunkshotTrack3X < 0) DunkshotTrack3X = 0xfc0; - - if (System16InputPort3[2]) DunkshotTrack3Y -= 0x40; - if (System16InputPort3[3]) DunkshotTrack3Y += 0x40; - if (DunkshotTrack3Y >= 0x1000) DunkshotTrack3Y = 0; - if (DunkshotTrack3Y < 0) DunkshotTrack3Y = 0xfc0; - - if (System16InputPort3[4]) DunkshotTrack4X += 0x40; - if (System16InputPort3[5]) DunkshotTrack4X -= 0x40; - if (DunkshotTrack4X >= 0x1000) DunkshotTrack4X = 0; - if (DunkshotTrack4X < 0) DunkshotTrack4X = 0xfc0; - - if (System16InputPort3[6]) DunkshotTrack4Y -= 0x40; - if (System16InputPort3[7]) DunkshotTrack4Y += 0x40; - if (DunkshotTrack4Y >= 0x1000) DunkshotTrack4Y = 0; - if (DunkshotTrack4Y < 0) DunkshotTrack4Y = 0xfc0; -} - -UINT8 __fastcall DunkshotReadByte(UINT32 a) -{ - switch (a) { - case 0xc43001: { - return DunkshotTrack1X & 0xff; - } - - case 0xc43003: { - return DunkshotTrack1X >> 8; - } - - case 0xc43005: { - return DunkshotTrack1Y & 0xff; - } - - case 0xc43007: { - return DunkshotTrack1Y >> 8; - } - - case 0xc43009: { - return DunkshotTrack2X & 0xff; - } - - case 0xc4300b: { - return DunkshotTrack2X >> 8; - } - - case 0xc4300d: { - return DunkshotTrack2Y & 0xff; - } - - case 0xc4300f: { - return DunkshotTrack2Y >> 8; - } - - case 0xc43011: { - return DunkshotTrack3X & 0xff; - } - - case 0xc43013: { - return DunkshotTrack3X >> 8; - } - - case 0xc43015: { - return DunkshotTrack3Y & 0xff; - } - - case 0xc43017: { - return DunkshotTrack3Y >> 8; - } - - case 0xc43019: { - return DunkshotTrack4X & 0xff; - } - - case 0xc4301b: { - return DunkshotTrack4X >> 8; - } - - case 0xc4301d: { - return DunkshotTrack4Y & 0xff; - } - - case 0xc4301f: { - return DunkshotTrack4Y >> 8; - } - } - - return 0xff; -} - -UINT16 __fastcall EswatMultiply0ReadWord(UINT32 a) -{ - return System16MultiplyChipRead(0, (a - 0x3e0000) >> 1); -} - -void __fastcall EswatMultiply0WriteWord(UINT32 a, UINT16 d) -{ - System16MultiplyChipWrite(0, (a - 0x3e0000) >> 1, d); -} - -UINT16 __fastcall EswatCompare0ReadWord(UINT32 a) -{ - return System16CompareTimerChipRead(0, (a - 0x3e1000) >> 1); -} - -void __fastcall EswatCompare0WriteWord(UINT32 a, UINT16 d) -{ - System16CompareTimerChipWrite(0, (a - 0x3e1000) >> 1, d); -} - -void __fastcall EswatSoundWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x123407: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -void __fastcall EswatWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x3e2001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3e2003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - } -} - -void __fastcall EswatblSoundWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xc42007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -void __fastcall EswatblGfxWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x418031: { - System16TileBanks[1] = d & 7; - return; - } - } -} - -void __fastcall EswatblGfxWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x418000: { - System16ScrollY[0] = d; - return; - } - - case 0x418008: { - System16ScrollX[0] = (d ^ 0xffff); - return; - } - - case 0x418010: { - System16ScrollY[1] = d; - return; - } - - case 0x418018: { - System16ScrollX[1] = (d ^ 0xffff); - return; - } - - case 0x418020: { - BootlegFgPage[3] = (d >> 12) & 0xf; - BootlegFgPage[2] = (d >> 8) & 0xf; - BootlegFgPage[1] = (d >> 4) & 0xf; - BootlegFgPage[0] = (d >> 0) & 0xf; - return; - } - - case 0x418028: { - BootlegBgPage[3] = (d >> 12) & 0xf; - BootlegBgPage[2] = (d >> 8) & 0xf; - BootlegBgPage[1] = (d >> 4) & 0xf; - BootlegBgPage[0] = (d >> 0) & 0xf; - return; - } - } -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X\n"), a, d); -#endif -} - -static INT16 ExctleagTrack1X = 0; -static INT16 ExctleagTrack1Y = 0; -static INT16 ExctleagTrack2X = 0; -static INT16 ExctleagTrack2Y = 0; - -void ExctleagMakeAnalogInputs() -{ - if (System16InputPort4[0]) ExctleagTrack1X += 0x1; - if (System16InputPort4[1]) ExctleagTrack1X -= 0x1; - if (ExctleagTrack1X >= 0x100) ExctleagTrack1X = 0; - if (ExctleagTrack1X < 0) ExctleagTrack1X = 0xff; - - if (System16InputPort4[2]) ExctleagTrack1Y -= 0x1; - if (System16InputPort4[3]) ExctleagTrack1Y += 0x1; - if (ExctleagTrack1Y >= 0x100) ExctleagTrack1Y = 0; - if (ExctleagTrack1Y < 0) ExctleagTrack1Y = 0xff; - - if (System16InputPort4[4]) ExctleagTrack2X += 0x4; - if (System16InputPort4[5]) ExctleagTrack2X -= 0x4; - if (ExctleagTrack2X >= 0x100) ExctleagTrack2X = 0; - if (ExctleagTrack2X < 0) ExctleagTrack2X = 0xfc; - - if (System16InputPort4[6]) ExctleagTrack2Y -= 0x4; - if (System16InputPort4[7]) ExctleagTrack2Y += 0x4; - if (ExctleagTrack2Y >= 0x100) ExctleagTrack2Y = 0; - if (ExctleagTrack2Y < 0) ExctleagTrack2Y = 0xfc; -} - -UINT8 __fastcall ExctleagReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - return 0xff - System16Input[1]; - } - - case 0xc41005: { - return 0xff - System16Input[3]; - } - - case 0xc41007: { - return 0xff - System16Input[2]; - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - - case 0xc43001: - case 0xc43003: { - return ExctleagTrack1X; - } - - case 0xc43005: - case 0xc43007: { - return ExctleagTrack1Y; - } - - case 0xc43009: - case 0xc4300b: { - return ExctleagTrack2X; - } - - case 0xc4300d: - case 0xc4300f: { - return ExctleagTrack2Y; - } - } - - return 0xff; -} - -void __fastcall Fantzn2xWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x3f0001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3f0003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); -#endif -} - -UINT8 __fastcall FpointblReadByte(UINT32 a) -{ - switch (a) { - case 0x601001: { - return 0xff - System16Input[0]; - } - - case 0x601003: { - return 0xff - System16Input[1]; - } - - case 0x601005: { - return 0xff - System16Input[2]; - } - - case 0x600001: { - return System16Dip[0]; - } - - case 0x600003: { - return System16Dip[1]; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); -#endif - - return 0xff; -} - -void __fastcall FpointblWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x600007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - - } - - case 0x843001: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); -#endif -} - -void __fastcall FpointblGfxWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0xc46000: { - System16ScrollY[0] = d; - return; - } - - case 0xc46008: { - System16ScrollX[0] = (d ^ 0xffff); - return; - } - - case 0xc46010: { - System16ScrollY[1] = d + 2; - return; - } - - case 0xc46018: { - System16ScrollX[1] = (d ^ 0xffff); - return; - } - - case 0xc46022: { - BootlegFgPage[3] = (d >> 12) & 0xf; - BootlegFgPage[2] = (d >> 8) & 0xf; - BootlegFgPage[1] = (d >> 4) & 0xf; - BootlegFgPage[0] = (d >> 0) & 0xf; - return; - } - - case 0xc46026: { - BootlegBgPage[0] = (d >> 12) & 0xf; - BootlegBgPage[1] = (d >> 8) & 0xf; - BootlegBgPage[2] = (d >> 4) & 0xf; - BootlegBgPage[3] = (d >> 0) & 0xf; - return; - } - } -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X, 0x%04X\n"), a, d, d ^ 0xffff); -#endif -} - -void __fastcall GoldnaxeTileWriteByte(UINT32 a, UINT8 d) -{ - System16BTileByteWrite((a - 0x100000) ^ 1, d); -} - -void __fastcall GoldnaxeTileWriteWord(UINT32 a, UINT16 d) -{ - System16BTileWordWrite(a - 0x100000, d); -} - -UINT16 __fastcall GoldnaxeMultiply0ReadWord(UINT32 a) -{ - return System16MultiplyChipRead(0, (a - 0x1f0000) >> 1); -} - -void __fastcall GoldnaxeMultiply0WriteWord(UINT32 a, UINT16 d) -{ - System16MultiplyChipWrite(0, (a - 0x1f0000) >> 1, d); -} - -UINT16 __fastcall GoldnaxeCompare0ReadWord(UINT32 a) -{ - return System16CompareTimerChipRead(0, (a - 0x1f1000) >> 1); -} - -void __fastcall GoldnaxeCompare0WriteWord(UINT32 a, UINT16 d) -{ - System16CompareTimerChipWrite(0, (a - 0x1f1000) >> 1, d); -} - -UINT16 __fastcall GoldnaxeCompare1ReadWord(UINT32 a) -{ - return System16CompareTimerChipRead(1, (a - 0x1e0000) >> 1); -} - -void __fastcall GoldnaxeCompare1WriteWord(UINT32 a, UINT16 d) -{ - System16CompareTimerChipWrite(1, (a - 0x1e0000) >> 1, d); -} - -void __fastcall Goldnaxe1WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x1f2001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x1f2003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - } -} - -void __fastcall Goldnaxe3WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x1f0001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x1f0003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - } -} - -static UINT8 HwchampInputVal; - -UINT16 __fastcall HwchampCtrlReadWord(UINT32 a) -{ - UINT16 result; - - switch (a) { - case 0xc43020: - case 0xc43022: - case 0xc43024: { - result = (HwchampInputVal & 0x80) >> 7; - HwchampInputVal <<= 1; - return result; - } - } - - return 0xffff; -} - -void __fastcall HwchampCtrlWriteWord(UINT32 a, UINT16 /*d*/) -{ - UINT8 temp = 0; - - switch (a) { - case 0xc43020: { - temp = 0x80 + (System16AnalogPort0 >> 4); - if (temp < 0x01) temp = 0x01; - if (temp > 0xfe) temp = 0xfe; - HwchampInputVal = temp; - return; - } - - case 0xc43022: { - temp = 0x26; - if (System16AnalogPort2 > 1) temp = 0xfe; - HwchampInputVal = temp; - return; - } - - case 0xc43024: { - temp = 0x26; - if (System16AnalogPort1 > 1) temp = 0xfe; - HwchampInputVal = temp; - return; - } - } -} - -void __fastcall HwchampWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x3f0001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3f0003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - } -} - -void __fastcall MvpWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x3f2001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3f2003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - } -} - -void __fastcall MvpjWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x3f0001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3f0003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - } -} - -void __fastcall PassshtWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xc00007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -UINT8 __fastcall PassshtaReadByte(UINT32 a) -{ - switch (a) { - case 0xc43001: { - return 0xff - System16Input[1]; - } - - case 0xc43003: { - return 0xff - System16Input[2]; - } - - case 0xc43005: { - return 0xff - System16Input[3]; - } - - case 0xc43007: { - return 0xff - System16Input[4]; - } - } - - return 0xff; -} - -void __fastcall PassshtbGfxWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0xc46000: { - System16ScrollY[0] = d; - return; - } - - case 0xc46002: { - System16ScrollX[0] = (d ^ 0xffff) & 0x1ff; - return; - } - - case 0xc46004: { - System16ScrollY[1] = d; - return; - } - - case 0xc46006: { - System16ScrollX[1] = (d ^ 0xffff) & 0x1ff; - return; - } - -/* case 0xc46022: { - BootlegFgPage[3] = (d >> 12) & 0xf; - BootlegFgPage[2] = (d >> 8) & 0xf; - BootlegFgPage[1] = (d >> 4) & 0xf; - BootlegFgPage[0] = (d >> 0) & 0xf; - return; - } - - case 0xc46026: { - BootlegBgPage[0] = (d >> 12) & 0xf; - BootlegBgPage[1] = (d >> 8) & 0xf; - BootlegBgPage[2] = (d >> 4) & 0xf; - BootlegBgPage[3] = (d >> 0) & 0xf; - return; - }*/ - } -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X, 0x%04X\n"), a, d, (d ^ 0xffff) & 0x1ff); -#endif -} - -UINT8 __fastcall RiotcityReadByte(UINT32 a) -{ - switch (a) { - case 0xf81001: { - return 0xff - System16Input[0]; - } - - case 0xf81003: { - return 0xff - System16Input[1]; - } - - case 0xf81007: { - return 0xff - System16Input[2]; - } - - case 0xf82001: { - return System16Dip[0]; - } - - case 0xf82003: { - return System16Dip[1]; - } - } - - return 0xff; -} - -void __fastcall RiotcityWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0xfa0000 && a <= 0xfaffff) { - System16BTileByteWrite((a - 0xfa0000) ^ 1, d); - return; - } - - switch (a) { - case 0xf00007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - - case 0xf20001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0xf20003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0xf80001: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - return; - } - } -} - -void __fastcall RiotcityWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0xfa0000 && a <= 0xfaffff) { - System16BTileWordWrite(a - 0xfa0000, d); - return; - } -} - -UINT16 __fastcall RyukyuReadWord(UINT32 a) -{ - switch (a) { - case 0x601000: { - return 0xff - System16Input[0]; - } - - case 0x601002: { - return 0xff - System16Input[1]; - } - - case 0x602000: { - return System16Dip[0]; - } - - case 0x602002: { - return System16Dip[1]; - } - } - - return 0xffff; -} - -void __fastcall RyukyuWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16BTileWordWrite(a - 0x400000, d); - return; - } - - switch (a) { - case 0x100000: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x100002: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x600000: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - return; - } - } -} - -void __fastcall RyukyuWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xff0007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -static INT16 SdiTrack1X = 0; -static INT16 SdiTrack1Y = 0; -static INT16 SdiTrack2X = 0; -static INT16 SdiTrack2Y = 0; - -void SdibMakeAnalogInputs() -{ - SdiTrack1X -= (System16AnalogPort0 >> 8) & 0xff; - SdiTrack1Y += (System16AnalogPort1 >> 8) & 0xff; - - SdiTrack2X -= (System16AnalogPort2 >> 8) & 0xff; - SdiTrack2Y += (System16AnalogPort3 >> 8) & 0xff; -} - -UINT8 __fastcall SdibReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41005: { - return 0xff - System16Input[1]; - } - - case 0xc42003: { - return System16Dip[1]; - } - - case 0xc42005: { - return System16Dip[0]; - } - - case 0xc43001: { - return SdiTrack1X; - } - - case 0xc43005: { - return SdiTrack1Y; - } - - case 0xc43009: { - return SdiTrack2X; - } - - case 0xc4300d: { - return SdiTrack2Y; - } - } - - return 0xff; -} - -void __fastcall SdibSoundWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x123407: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -static UINT8 MahjongInputNum; - -UINT16 __fastcall SjryukoReadWord(UINT32 a) -{ - SEK_DEF_READ_WORD(0, a); - - return 0xffff; -} - -UINT8 __fastcall SjryukoReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - if (System16Input[MahjongInputNum + 1] != 0xff) return 0xff & ~(1 << MahjongInputNum); - return 0xff; - } - - case 0xc41005: { - return 0xff - System16Input[MahjongInputNum + 1]; - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - } - - return 0xff; -} - -void __fastcall SjryukoWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xc40003: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - if (d & 4) MahjongInputNum = (MahjongInputNum + 1) % 6; - return; - } - - case 0xc00007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -UINT16 __fastcall SonicbomReadWord(UINT32 a) -{ - switch (a) { - case 0xc42000: { - return (0xff << 8) | System16Dip[0]; - } - - case 0xc42002: { - return (0xff << 8) | System16Dip[1]; - } - } - - return 0xffff; -} - -void __fastcall SonicbomWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x123407: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -void __fastcall TetrisblGfxWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x418000: { - System16ScrollY[0] = d; - return; - } - - case 0x418008: { - System16ScrollX[0] = (d ^ 0xffff) & 0x3ff; - return; - } - - case 0x418010: { - System16ScrollY[1] = d; - return; - } - - case 0x418018: { - System16ScrollX[1] = ((d ^ 0xffff) & 0x3ff) + 2; - return; - } - - case 0x418020: { - BootlegFgPage[3] = (d >> 12) & 0xf; - BootlegFgPage[2] = (d >> 8) & 0xf; - BootlegFgPage[1] = (d >> 4) & 0xf; - BootlegFgPage[0] = (d >> 0) & 0xf; - return; - } - - case 0x418028: { - BootlegBgPage[0] = (d >> 12) & 0xf; - BootlegBgPage[1] = (d >> 8) & 0xf; - BootlegBgPage[2] = (d >> 4) & 0xf; - BootlegBgPage[3] = (d >> 0) & 0xf; - return; - } - } -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X, 0x%04X\n"), a, d, (d ^ 0xffff) & 0x3ff); -#endif -} - -void __fastcall TetrisblSndWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xc42007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -UINT8 __fastcall ToryumonReadByte(UINT32 a) -{ - switch (a) { - case 0xe41001: { - return 0xff - System16Input[0]; - } - - case 0xe41003: { - return 0xff - System16Input[1]; - } - - case 0xe41005: { - return 0; - } - - case 0xe41007: { - return 0xff - System16Input[2]; - } - - case 0xe42001: { - return System16Dip[0]; - } - - case 0xe42003: { - return System16Dip[1]; - } - } - - return 0xff; -} - -void __fastcall ToryumonWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x3e2001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3e2003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0xe40001: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - return; - } - - case 0xfe0007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -UINT8 __fastcall TturfReadByte(UINT32 a) -{ - switch (a) { - case 0x602001: { - return System16Dip[0]; - } - - case 0x602003: { - return System16Dip[1]; - } - } - - return 0xff; -} - -void __fastcall TturfWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16BTileByteWrite((a - 0x400000) ^ 1, d); - return; - } - - switch (a) { - case 0x600001: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - return; - } - } -} - -void __fastcall Wb3WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xdf0007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -void __fastcall Wb3bblGfxWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0xc46000: { - System16ScrollY[0] = d; - return; - } - - case 0xc46002: { - System16ScrollX[0] = (d ^ 0xffff) & 0x3ff; - return; - } - - case 0xc46004: { - System16ScrollY[1] = d; - return; - } - - case 0xc46006: { - System16ScrollX[1] = (d ^ 0xffff) & 0x3ff; - return; - } - -/* case 0xc46022: { - BootlegFgPage[3] = (d >> 12) & 0xf; - BootlegFgPage[2] = (d >> 8) & 0xf; - BootlegFgPage[1] = (d >> 4) & 0xf; - BootlegFgPage[0] = (d >> 0) & 0xf; - return; - } - - case 0xc46026: { - BootlegBgPage[0] = (d >> 12) & 0xf; - BootlegBgPage[1] = (d >> 8) & 0xf; - BootlegBgPage[2] = (d >> 4) & 0xf; - BootlegBgPage[3] = (d >> 0) & 0xf; - return; - }*/ - } -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X, 0x%04X\n"), a, d, d ^ 0xffff); -#endif -} - -void __fastcall WrestwarTileWriteByte(UINT32 a, UINT8 d) -{ - System16BTileByteWrite((a - 0x100000) ^ 1, d); -} - -void __fastcall WrestwarTileWriteWord(UINT32 a, UINT16 d) -{ - System16BTileWordWrite(a - 0x100000, d); -} - -void __fastcall WrestwarWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x400001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x400003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - } -} - -/*==================================================== -Driver Inits -====================================================*/ - -static INT32 Fantzn2xPlaneOffsets[3] = { 1, 2, 3 }; -static INT32 Fantzn2xXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; -static INT32 Fantzn2xYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; - -static INT32 AliensynInit() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xc00006, 0xc00007, SM_WRITE); - SekSetWriteByteHandler(1, AliensynWriteByte); - SekClose(); - } - - return nRet; -} - -static INT32 Aliensyn3Init() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xc00006, 0xc00007, SM_WRITE); - SekSetWriteByteHandler(1, AliensynWriteByte); - SekClose(); - } - - return nRet; -} - -void Altbeast_Sim8751() -{ - // System Inputs - *((UINT16*)(System16Ram + 0x30c2)) = BURN_ENDIAN_SWAP_INT16((UINT16)(System16Input[0] << 8)); - - // Tile Banking - System16TileBanks[1] = ((System16Ram[0x3094 + 1] << 8) | System16Ram[0x3094 + 0]) & 7; - - // Sound command - UINT16 temp = (System16Ram[0x30c4 + 1] << 8) | System16Ram[0x30c4 + 0]; - if ((temp & 0xff00) != 0x0000) { - System16SoundLatch = temp >> 8; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - *((UINT16*)(System16Ram + 0x30c4)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); - } -} - -void Altbeastj_Sim8751() -{ - // System Inputs - *((UINT16*)(System16Ram + 0x30d0)) = BURN_ENDIAN_SWAP_INT16((UINT16)(System16Input[0] << 8)); - - // Tile Banking - System16TileBanks[1] = ((System16Ram[0x3094 + 1] << 8) | System16Ram[0x3094 + 0]) & 7; - - // Sound command - UINT16 temp = (System16Ram[0x30d4 + 1] << 8) | System16Ram[0x30d4 + 0]; - if ((temp & 0xff00) != 0x0000) { - System16SoundLatch = temp >> 8; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - *((UINT16*)(System16Ram + 0x30d4)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); - } -} - -void Altbeast6_Sim8751() -{ - // System Inputs - *((UINT16*)(System16Ram + 0x3096)) = BURN_ENDIAN_SWAP_INT16((UINT16)(System16Input[0] << 8)); - - // Tile Banking - System16TileBanks[1] = ((System16Ram[0x3094 + 1] << 8) | System16Ram[0x3094 + 0]) & 7; - - // Sound command - UINT16 temp = (System16Ram[0x3098 + 1] << 8) | System16Ram[0x3098 + 0]; - if ((temp & 0xff00) != 0x0000) { - System16SoundLatch = temp >> 8; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - *((UINT16*)(System16Ram + 0x3098)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); - } -} - -static INT32 AltbeastInit() -{ - Simulate8751 = Altbeast_Sim8751; - - return System16Init(); -} - -static INT32 AltbeastjInit() -{ - Simulate8751 = Altbeastj_Sim8751; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1a0000 - 0xe0000; - - INT32 nRet = System16Init(); - - if (!nRet) { - UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0xe0000); - memset(System16Sprites, 0, 0x1a0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); - memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); - memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); - memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); - memcpy(System16Sprites + 0x100000, pTemp + 0x80000, 0x20000); - memcpy(System16Sprites + 0x140000, pTemp + 0xa0000, 0x20000); - memcpy(System16Sprites + 0x180000, pTemp + 0xc0000, 0x20000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Altbeast6Init() -{ - Simulate8751 = Altbeast6_Sim8751; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1a0000 - 0xe0000; - - INT32 nRet = System16Init(); - - if (!nRet) { - UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0xe0000); - memset(System16Sprites, 0, 0x1a0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); - memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); - memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); - memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); - memcpy(System16Sprites + 0x100000, pTemp + 0x80000, 0x20000); - memcpy(System16Sprites + 0x140000, pTemp + 0xa0000, 0x20000); - memcpy(System16Sprites + 0x180000, pTemp + 0xc0000, 0x20000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Altbeastj3Init() -{ - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1a0000 - 0xe0000; - - INT32 nRet = System16Init(); - - if (!nRet) { - UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0xe0000); - memset(System16Sprites, 0, 0x1a0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); - memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); - memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); - memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); - memcpy(System16Sprites + 0x100000, pTemp + 0x80000, 0x20000); - memcpy(System16Sprites + 0x140000, pTemp + 0xa0000, 0x20000); - memcpy(System16Sprites + 0x180000, pTemp + 0xc0000, 0x20000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Altbeast4Init() -{ - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1a0000 - 0xe0000; - - INT32 nRet = System16Init(); - - if (!nRet) { - UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0xe0000); - memset(System16Sprites, 0, 0x1a0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); - memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); - memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); - memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); - memcpy(System16Sprites + 0x100000, pTemp + 0x80000, 0x20000); - memcpy(System16Sprites + 0x140000, pTemp + 0xa0000, 0x20000); - memcpy(System16Sprites + 0x180000, pTemp + 0xc0000, 0x20000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -void AtomicpMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x01ffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x01ffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, System16BWriteWord); - SekSetReadByteHandler(0, AtomicpReadByte); - SekSetWriteByteHandler(0, AtomicpWriteByte); - SekClose(); -} - -static INT32 AtomicpInit() -{ - System16Map68KDo = AtomicpMap68K; - - INT32 nRet = System16Init(); - - System16IgnoreVideoEnable = 1; - System16YM2413IRQInterval = 166; - - return nRet; -} - -static INT32 AurailInit() -{ - System16CustomLoadRomDo = CustomLoadRom40000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xfc0000, 0xfc0003, SM_WRITE); - SekSetWriteByteHandler(1, AurailWriteByte); - SekClose(); - } - - return nRet; -} - -static INT32 Aurail1Init() -{ - System16CustomLoadRomDo = CustomLoadRom40000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xfc0000, 0xfc0003, SM_WRITE); - SekSetWriteByteHandler(1, AurailWriteByte); - SekClose(); - } - - return nRet; -} - -static INT32 AurailjInit() -{ - System16CustomLoadRomDo = CustomLoadRom40000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xfc0000, 0xfc0003, SM_WRITE); - SekSetWriteByteHandler(1, AurailWriteByte); - SekClose(); - } - - return nRet; -} - -void BayrouteMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); - SekMapMemory(System16Ram , 0x500000, 0x503fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x600000, 0x6007ff, SM_RAM); - SekMapMemory(System16TileRam , 0x700000, 0x70ffff, SM_READ); - SekMapMemory(System16TextRam , 0x710000, 0x710fff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x800000, 0x800fff, SM_RAM); - SekSetReadByteHandler(0, BayrouteReadByte); - SekSetWriteByteHandler(0, BayrouteWriteByte); - SekSetWriteWordHandler(0, BayrouteWriteWord); - SekClose(); -} - -static INT32 BayrouteInit() -{ - System16Map68KDo = BayrouteMap68K; - System16CustomLoadRomDo = CustomLoadRom40000; - - return System16Init(); -} - -static INT32 Bayroute1Init() -{ - System16Map68KDo = BayrouteMap68K; - System16CustomLoadRomDo = CustomLoadRom20000; - - return System16Init(); -} - -void Blox16bMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, System16BWriteWord); - SekSetReadByteHandler(0, System16BReadByte); - SekSetWriteByteHandler(0, System16BWriteByte); - SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); - SekSetWriteByteHandler(1, Fantzn2xWriteByte); - SekClose(); -} - -static INT32 Blox16bLoadRom() -{ - if (BurnLoadRom(System16Rom + 0x00000, 0, 1)) return 1; - - System16TempGfx = (UINT8*)BurnMalloc(System16TileRomSize); - BurnLoadRom(System16TempGfx, 1, 1); - GfxDecode(0x2000, 3, 8, 8, Fantzn2xPlaneOffsets, Fantzn2xXOffsets, Fantzn2xYOffsets, 0x100, System16TempGfx, System16Tiles); - System16NumTiles = 0x2000; - BurnFree(System16TempGfx); - - BurnLoadRom(System16Sprites, 2, 1); - BurnByteswap(System16Sprites, System16SpriteRomSize); - - if (BurnLoadRom(System16Z80Rom, 3, 1)) return 1; - memcpy(System16UPD7759Data, System16Z80Rom + 0x10000, 0x08000); - - return 0; -} - -static INT32 Blox16bInit() -{ - System16Map68KDo = Blox16bMap68K; - System16CustomLoadRomDo = Blox16bLoadRom; - System16UPD7759DataSize = 0x08000; - - return System16Init(); -} - -static INT32 BulletInit() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, BulletReadByte); - SekMapHandler(1, 0xc00006, 0xc00007, SM_WRITE); - SekSetWriteByteHandler(1, BulletWriteByte); - SekClose(); - } - return nRet; -} - -void CottonMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0fffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x300000, 0x3007ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x500000, 0x500fff, SM_RAM); - SekMapMemory(System16Ram , 0x200000, 0x203fff, SM_RAM); - SekSetReadByteHandler(0, CottonReadByte); - SekSetWriteByteHandler(0, CottonWriteByte); - SekSetWriteWordHandler(0, CottonWriteWord); - SekClose(); -} - -static INT32 CottonInit() -{ - System16Map68KDo = CottonMap68K; - System16CustomLoadRomDo = CustomLoadRom40000; - - return System16Init(); -} - -void Ddux_Sim8751() -{ - // Sound command - UINT16 temp = (System16Ram[0x0bd0 + 1] << 8) | System16Ram[0x0bd0 + 0]; - if ((temp & 0xff00) != 0x0000) { - System16SoundLatch = temp >> 8; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - *((UINT16*)(System16Ram + 0x0bd0)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); - } -} - -static INT32 DduxInit() -{ - System16CustomLoadRomDo = CustomLoadRom40000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); - SekSetWriteByteHandler(1, DduxWriteByte); - SekClose(); - } - - return nRet; -} - -static INT32 Ddux1Init() -{ - Simulate8751 = Ddux_Sim8751; - System16CustomLoadRomDo = CustomLoadRom40000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); - SekSetWriteByteHandler(1, DduxWriteByte); - SekClose(); - } - - return nRet; -} - -static INT32 DduxblInit() -{ - System16CustomLoadRomDo = CustomLoadRom40000; - - System16SpriteXOffset = 112; - - System16MapZ80Do = BootlegMapZ80; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetWriteByteHandler(0, DduxblWriteByte); - SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); - SekSetWriteByteHandler(1, DduxWriteByte); - SekMapHandler(2, 0xc46000, 0xc46027, SM_WRITE); - SekSetWriteByteHandler(2, DduxblGfxWriteByte); - SekSetWriteWordHandler(2, DduxblGfxWriteWord); - SekClose(); - - bSystem16BootlegRender = true; - } - - return nRet; -} - -static INT32 DunkshotInit() -{ - System16MakeAnalogInputsDo = DunkshotMakeAnalogInputs; - - System16BTileAlt = true; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x80000 - 0x40000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xc43000, 0xc4301f, SM_READ); - SekSetReadByteHandler(1, DunkshotReadByte); - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x80000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x80000); - memset(System16Sprites, 0, 0x80000); - memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); - memcpy(System16Sprites + 0x10000, pTemp + 0x00000, 0x10000); - memcpy(System16Sprites + 0x20000, pTemp + 0x10000, 0x10000); - memcpy(System16Sprites + 0x30000, pTemp + 0x10000, 0x10000); - memcpy(System16Sprites + 0x40000, pTemp + 0x20000, 0x10000); - memcpy(System16Sprites + 0x50000, pTemp + 0x20000, 0x10000); - memcpy(System16Sprites + 0x60000, pTemp + 0x30000, 0x10000); - memcpy(System16Sprites + 0x70000, pTemp + 0x30000, 0x10000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 DunkshotExit() -{ - DunkshotTrack1X = 0; - DunkshotTrack1Y = 0; - DunkshotTrack2X = 0; - DunkshotTrack2Y = 0; - DunkshotTrack3X = 0; - DunkshotTrack3Y = 0; - DunkshotTrack4X = 0; - DunkshotTrack4Y = 0; - - return System16Exit(); -} - -static INT32 DunkshotScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029660; - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(DunkshotTrack1X); - SCAN_VAR(DunkshotTrack1Y); - SCAN_VAR(DunkshotTrack2X); - SCAN_VAR(DunkshotTrack2Y); - SCAN_VAR(DunkshotTrack3X); - SCAN_VAR(DunkshotTrack3Y); - SCAN_VAR(DunkshotTrack4X); - SCAN_VAR(DunkshotTrack4Y); - } - - return System16Scan(nAction, pnMin);; -} - -void EswatMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - SekSetReadByteHandler(0, System16BReadByte); - SekSetWriteByteHandler(0, System16BWriteByte); - SekSetWriteWordHandler(0, System16BWriteWord); - SekClose(); -} - -static INT32 EswatInit() -{ - System16Map68KDo = EswatMap68K; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1c0000 - 0x180000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0x123406, 0x123407, SM_WRITE); - SekSetWriteByteHandler(1, EswatSoundWriteByte); - - SekMapHandler(2, 0x3e0000, 0x3e0fff, SM_RAM); - SekSetReadWordHandler(2, EswatMultiply0ReadWord); - SekSetWriteWordHandler(2, EswatMultiply0WriteWord); - - SekMapHandler(3, 0x3e1000, 0x3e1fff, SM_RAM); - SekSetReadWordHandler(3, EswatCompare0ReadWord); - SekSetWriteWordHandler(3, EswatCompare0WriteWord); - - SekMapHandler(4, 0x3e2000, 0x3e2003, SM_WRITE); - SekSetWriteByteHandler(4, EswatWriteByte); - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x1c0000); - memset(System16Sprites, 0, 0x1c0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); - memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); - memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); - memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); - memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); - memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 EswatblInit() -{ - System16Map68KDo = EswatMap68K; - - System16SpriteXOffset = 124; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1c0000 - 0x180000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0x418000, 0x418031, SM_WRITE); - SekSetWriteWordHandler(1, EswatblGfxWriteWord); - SekSetWriteByteHandler(1, EswatblGfxWriteByte); - - SekMapHandler(2, 0xc42006, 0xc42007, SM_WRITE); - SekSetWriteByteHandler(2, EswatblSoundWriteByte); - - SekMapHandler(3, 0x3e2000, 0x3e2003, SM_WRITE); - SekSetWriteByteHandler(3, EswatWriteByte); - - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x1c0000); - memset(System16Sprites, 0, 0x1c0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); - memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); - memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); - memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); - memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); - memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); - } else { - nRet = 1; - } - BurnFree(pTemp); - - bSystem16BootlegRender = true; - } - - return nRet; -} - -static INT32 ExctleagInit() -{ - System16MakeAnalogInputsDo = ExctleagMakeAnalogInputs; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, ExctleagReadByte); - SekClose(); - } - - return nRet; -} - -static INT32 ExctleagExit() -{ - ExctleagTrack1X = 0; - ExctleagTrack1Y = 0; - ExctleagTrack2X = 0; - ExctleagTrack2Y = 0; - - return System16Exit(); -} - -static INT32 ExctleagScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029660; - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(ExctleagTrack1X); - SCAN_VAR(ExctleagTrack1Y); - SCAN_VAR(ExctleagTrack2X); - SCAN_VAR(ExctleagTrack2Y); - } - - return System16Scan(nAction, pnMin);; -} - -void Fantzn2xMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0fffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); - SekMapMemory(System16Ram , 0x200000, 0x23ffff, SM_RAM); - SekSetWriteWordHandler(0, System16BWriteWord); - SekSetReadByteHandler(0, System16BReadByte); - SekSetWriteByteHandler(0, System16BWriteByte); - SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); - SekSetWriteByteHandler(1, Fantzn2xWriteByte); - SekClose(); -} - -static INT32 Fantzn2xLoadRom() -{ - INT32 nRet = System16LoadRoms(1); - - memcpy(System16Rom + 0x80000, System16Rom + 0x40000, 0x40000); - memset(System16Rom + 0x40000, 0, 0x40000); - memcpy(System16Code + 0x80000, System16Code + 0x40000, 0x40000); - memset(System16Code + 0x40000, 0, 0x40000); - - return nRet; -} - -static INT32 Fantzn2xps2LoadRom() -{ - if (BurnLoadRom(System16Rom + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(System16Rom + 0x80000, 1, 1)) return 1; - - memcpy(System16Code, System16Rom, 0x100000); - - System16TempGfx = (UINT8*)BurnMalloc(System16TileRomSize); - BurnLoadRom(System16TempGfx, 2, 1); - GfxDecode(0x4000, 3, 8, 8, Fantzn2xPlaneOffsets, Fantzn2xXOffsets, Fantzn2xYOffsets, 0x100, System16TempGfx, System16Tiles); - System16NumTiles = 0x4000; - BurnFree(System16TempGfx); - - BurnLoadRom(System16Sprites, 3, 1); - - if (BurnLoadRom(System16Z80Rom, 4, 1)) return 1; - memcpy(System16UPD7759Data, System16Z80Rom + 0x10000, 0x20000); - - return 0; -} - -static INT32 Fantzn2xInit() -{ - System16Map68KDo = Fantzn2xMap68K; - System16CustomLoadRomDo = Fantzn2xLoadRom; - - return System16Init(); -} - -static INT32 Fantzn2xps2Init() -{ - System16Map68KDo = Fantzn2xMap68K; - System16CustomLoadRomDo = Fantzn2xps2LoadRom; - System16UPD7759DataSize = 0x20000; - - return System16Init(); -} - -void FantzntaMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - SekSetWriteWordHandler(0, System16BWriteWord); - SekSetReadByteHandler(0, System16BReadByte); - SekSetWriteByteHandler(0, System16BWriteByte); - SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); - SekSetWriteByteHandler(1, Fantzn2xWriteByte); - SekClose(); -} - -static INT32 FantzntaLoadRom() -{ - if (BurnLoadRom(System16Rom + 0x00000, 0, 1)) return 1; - - System16TempGfx = (UINT8*)BurnMalloc(System16TileRomSize); - BurnLoadRom(System16TempGfx, 1, 1); - GfxDecode(0x2000, 3, 8, 8, Fantzn2xPlaneOffsets, Fantzn2xXOffsets, Fantzn2xYOffsets, 0x100, System16TempGfx, System16Tiles); - System16NumTiles = 0x2000; - BurnFree(System16TempGfx); - - BurnLoadRom(System16Sprites, 2, 1); - BurnByteswap(System16Sprites, System16SpriteRomSize); - - if (BurnLoadRom(System16Z80Rom, 3, 1)) return 1; - memcpy(System16UPD7759Data, System16Z80Rom + 0x10000, 0x10000); - - return 0; -} - -static INT32 FantzntaInit() -{ - System16Map68KDo = FantzntaMap68K; - System16CustomLoadRomDo = FantzntaLoadRom; - System16UPD7759DataSize = 0x10000; - - return System16Init(); -} - -static INT32 FpointblInit() -{ - System16MapZ80Do = BootlegMapZ80; - - INT32 nRet = System16Init(); - - System16SpriteXOffset = 109; - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, FpointblReadByte); - SekSetWriteByteHandler(0, FpointblWriteByte); - - SekMapHandler(1, 0xc46000, 0xc46031, SM_WRITE); - SekSetWriteWordHandler(1, FpointblGfxWriteWord); - SekClose(); - - bSystem16BootlegRender = true; - } - - return nRet; -} - -void GoldnaxeMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x100000, 0x10ffff, SM_READ); - SekMapMemory(System16TextRam , 0x110000, 0x110fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x200000, 0x2007ff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x300000, 0x3007ff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x400000, 0x4007ff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x500000, 0x5007ff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x700000, 0x7007ff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x800000, 0x8007ff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x900000, 0x9007ff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x600000, 0x6007ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x140000, 0x140fff, SM_RAM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - SekSetReadByteHandler(0, System16BReadByte); - SekSetWriteByteHandler(0, System16BWriteByte); - - SekMapHandler(1, 0x100000, 0x10ffff, SM_WRITE); - SekSetWriteByteHandler(1, GoldnaxeTileWriteByte); - SekSetWriteWordHandler(1, GoldnaxeTileWriteWord); - SekClose(); -} - -void Goldnaxe_Sim8751() -{ - // Protection MCU - UINT16 temp1 = (System16Ram[0x2cd8 + 1] << 8) | System16Ram[0x2cd8 + 0]; - UINT16 temp2 = (System16Ram[0x2cda + 1] << 8) | System16Ram[0x2cda + 0]; - UINT16 temp3 = (System16Ram[0x2cdc + 1] << 8) | System16Ram[0x2cdc + 0]; - UINT16 temp4 = (System16Ram[0x2cde + 1] << 8) | System16Ram[0x2cde + 0]; - if (temp1 == 0 && temp2 == 0 && temp3 == 0 && temp4 == 0) { - *((UINT16*)(System16Ram + 0x2cd8)) = BURN_ENDIAN_SWAP_INT16(0x048c); - *((UINT16*)(System16Ram + 0x2cda)) = BURN_ENDIAN_SWAP_INT16(0x159d); - *((UINT16*)(System16Ram + 0x2cdc)) = BURN_ENDIAN_SWAP_INT16(0x26ae); - *((UINT16*)(System16Ram + 0x2cde)) = BURN_ENDIAN_SWAP_INT16(0x37bf); - } - - // Sound command - UINT16 temp = (System16Ram[0x2cfc + 1] << 8) | System16Ram[0x2cfc + 0]; - if ((temp & 0xff00) != 0x0000) { - System16SoundLatch = temp >> 8; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - *((UINT16*)(System16Ram + 0x2cfc)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); - } - - // Inputs - *((UINT16*)(System16Ram + 0x2cd0)) = BURN_ENDIAN_SWAP_INT16((UINT16)(~((System16Input[1] << 8) | System16Input[2]))); - *((UINT16*)(System16Ram + 0x2c96)) = BURN_ENDIAN_SWAP_INT16((UINT16)(~System16Input[0] << 8)); -} - -static INT32 GoldnaxeInit() -{ - Simulate8751 = Goldnaxe_Sim8751; - System16Map68KDo = GoldnaxeMap68K; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1c0000 - 0x180000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(2, 0x1e0000, 0x1e0fff, SM_RAM); - SekSetReadWordHandler(2, GoldnaxeCompare1ReadWord); - SekSetWriteWordHandler(2, GoldnaxeCompare1WriteWord); - - SekMapHandler(3, 0x1f0000, 0x1f0fff, SM_RAM); - SekSetReadWordHandler(3, GoldnaxeMultiply0ReadWord); - SekSetWriteWordHandler(3, GoldnaxeMultiply0WriteWord); - - SekMapHandler(4, 0x1f1000, 0x1f1fff, SM_RAM); - SekSetReadWordHandler(4, GoldnaxeCompare0ReadWord); - SekSetWriteWordHandler(4, GoldnaxeCompare0WriteWord); - - SekMapHandler(5, 0x1f2000, 0x1f2003, SM_WRITE); - SekSetWriteByteHandler(5, Goldnaxe1WriteByte); - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x1c0000); - memset(System16Sprites, 0, 0x1c0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); - memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); - memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); - memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); - memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); - memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Goldnaxe1Init() -{ - System16Map68KDo = GoldnaxeMap68K; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1c0000 - 0x180000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(2, 0x1e0000, 0x1e0fff, SM_RAM); - SekSetReadWordHandler(2, GoldnaxeCompare1ReadWord); - SekSetWriteWordHandler(2, GoldnaxeCompare1WriteWord); - - SekMapHandler(3, 0x1f0000, 0x1f0fff, SM_RAM); - SekSetReadWordHandler(3, GoldnaxeMultiply0ReadWord); - SekSetWriteWordHandler(3, GoldnaxeMultiply0WriteWord); - - SekMapHandler(4, 0x1f1000, 0x1f1fff, SM_RAM); - SekSetReadWordHandler(4, GoldnaxeCompare0ReadWord); - SekSetWriteWordHandler(4, GoldnaxeCompare0WriteWord); - - SekMapHandler(5, 0x1f2000, 0x1f2003, SM_WRITE); - SekSetWriteByteHandler(5, Goldnaxe1WriteByte); - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x1c0000); - memset(System16Sprites, 0, 0x1c0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); - memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); - memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); - memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); - memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); - memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Goldnaxe2Init() -{ - Simulate8751 = Goldnaxe_Sim8751; - System16Map68KDo = GoldnaxeMap68K; - System16CustomLoadRomDo = CustomLoadRom40000; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1c0000 - 0x180000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(2, 0x1f0000, 0x1f0003, SM_WRITE); - SekSetWriteByteHandler(2, Goldnaxe3WriteByte); - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x1c0000); - memset(System16Sprites, 0, 0x1c0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); - memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); - memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); - memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); - memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); - memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Goldnaxe3Init() -{ - System16Map68KDo = GoldnaxeMap68K; - System16CustomLoadRomDo = CustomLoadRom40000; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1c0000 - 0x180000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(2, 0x1f0000, 0x1f0003, SM_WRITE); - SekSetWriteByteHandler(2, Goldnaxe3WriteByte); - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x1c0000); - memset(System16Sprites, 0, 0x1c0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); - memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); - memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); - memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); - memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); - memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 HwchampInit() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); - SekSetWriteByteHandler(1, HwchampWriteByte); - - SekMapHandler(2, 0xc43020, 0xc43025, SM_RAM); - SekSetReadWordHandler(2, HwchampCtrlReadWord); - SekSetWriteWordHandler(2, HwchampCtrlWriteWord); - SekClose(); - } - - return nRet; -} - -static INT32 HwchampExit() -{ - HwchampInputVal = 0; - - return System16Exit(); -} - -static INT32 HwchampScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029660; - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(HwchampInputVal); - } - - return System16Scan(nAction, pnMin);; -} - -static INT32 MvpInit() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0x3f2000, 0x3f2003, SM_WRITE); - SekSetWriteByteHandler(1, MvpWriteByte); - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x200000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x200000); - memset(System16Sprites, 0, 0x200000); - memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); - memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); - memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); - memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); - memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); - memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); - memcpy(System16Sprites + 0x0c0000, pTemp + 0x180000, 0x40000); - memcpy(System16Sprites + 0x1c0000, pTemp + 0x1c0000, 0x40000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 MvpjInit() -{ - System16CustomLoadRomDo = CustomLoadRom40000; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x200000 - 0x180000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); - SekSetWriteByteHandler(1, MvpjWriteByte); - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0x200000); - if (pTemp) { - memset(pTemp, 0, 0x200000); - memcpy(pTemp, System16Sprites, 0x200000); - memset(System16Sprites, 0, 0x200000); - memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0xc0000); - memcpy(System16Sprites + 0x100000, pTemp + 0x0c0000, 0xc0000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 PassshtInit() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xc00006, 0xc00007, SM_WRITE); - SekSetWriteByteHandler(1, PassshtWriteByte); - SekClose(); - } - - return nRet; -} - -static INT32 PassshtaInit() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xc00006, 0xc00007, SM_WRITE); - SekSetWriteByteHandler(1, PassshtWriteByte); - SekMapHandler(2, 0xc43000, 0xc43007, SM_READ); - SekSetReadByteHandler(2, PassshtaReadByte); - SekClose(); - } - - return nRet; -} - -static INT32 PassshtbInit() -{ - INT32 nRet = System16Init(); - -// System16SpriteXOffset = 114; - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xc46000, 0xc46031, SM_WRITE); - SekSetWriteWordHandler(1, PassshtbGfxWriteWord); - -// SekMapHandler(2, 0x842000, 0x842001, SM_READ); -// SekSetReadByteHandler(2, PassshtbReadByte); - -// SekMapHandler(2, 0xc42006, 0xc42007, SM_WRITE); -// SekSetWriteByteHandler(2, TetrisblSndWriteByte); - SekClose(); - - bSystem16BootlegRender = true; - } - - return nRet; -} - -void RiotcityMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); - SekMapMemory(System16TileRam , 0xfa0000, 0xfaffff, SM_READ); - SekMapMemory(System16TextRam , 0xfb0000, 0xfb0fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0xf40000, 0xf407ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0xf60000, 0xf60fff, SM_RAM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - SekSetReadByteHandler(0, RiotcityReadByte); - SekSetWriteByteHandler(0, RiotcityWriteByte); - SekSetWriteWordHandler(0, RiotcityWriteWord); - SekClose(); -} - -static INT32 RiotcityInit() -{ - System16Map68KDo = RiotcityMap68K; - System16CustomLoadRomDo = CustomLoadRom40000; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x1c0000 - 0x180000; - - INT32 nRet = System16Init(); - - if (!nRet) { - UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x1c0000); - memset(System16Sprites, 0, 0x1c0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); - memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); - memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); - memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); - memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); - memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -void RyukyuMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x300000, 0x3007ff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x300800, 0x300fff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x500000, 0x500fff, SM_RAM); - SekMapMemory(System16Ram , 0x200000, 0x203fff, SM_RAM); - SekSetReadWordHandler(0, RyukyuReadWord); - SekSetWriteWordHandler(0, RyukyuWriteWord); - SekSetReadByteHandler(0, System16BReadByte); - SekSetWriteByteHandler(0, RyukyuWriteByte); - SekClose(); -} - -static INT32 RyukyuInit() -{ - System16Map68KDo = RyukyuMap68K; - - return System16Init(); -} - -static INT32 SdibInit() -{ - System16MakeAnalogInputsDo = SdibMakeAnalogInputs; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, SdibReadByte); - SekMapHandler(1, 0x123406, 0x123407, SM_WRITE); - SekSetWriteByteHandler(1, SdibSoundWriteByte); - SekClose(); - } - - return nRet; -} - -static INT32 SdiblInit() -{ - System16MakeAnalogInputsDo = SdibMakeAnalogInputs; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, SdibReadByte); - SekMapHandler(1, 0x123406, 0x123407, SM_WRITE); - SekSetWriteByteHandler(1, SdibSoundWriteByte); - SekClose(); - } - - return nRet; -} - -static INT32 SdibExit() -{ - SdiTrack1X = 0; - SdiTrack1Y = 0; - SdiTrack2X = 0; - SdiTrack2Y = 0; - - return System16Exit(); -} - -static INT32 SdibScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029660; - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(SdiTrack1X); - SCAN_VAR(SdiTrack1Y); - SCAN_VAR(SdiTrack2X); - SCAN_VAR(SdiTrack2Y); - } - - return System16Scan(nAction, pnMin);; -} - -static INT32 SjryukoInit() -{ - System16BTileAlt = true; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetWriteByteHandler(0, SjryukoWriteByte); - SekSetReadByteHandler(0, SjryukoReadByte); - SekSetReadWordHandler(0, SjryukoReadWord); - SekClose(); - } - - return nRet; -} - -static INT32 SjryukoExit() -{ - MahjongInputNum = 0; - - return System16Exit(); -} - -static INT32 SjryukoScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029660; - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(MahjongInputNum); - } - - return System16Scan(nAction, pnMin);; -} - -static INT32 SnapperInit() -{ - System16Map68KDo = AtomicpMap68K; - - INT32 nRet = System16Init(); - - System16IgnoreVideoEnable = 1; - System16YM2413IRQInterval = 41; - - return nRet; -} - -static INT32 SonicbomInit() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0x123406, 0x123407, SM_WRITE); - SekSetWriteByteHandler(1, SonicbomWriteByte); - SekMapHandler(2, 0xc42000, 0xc42003, SM_READ); - SekSetReadWordHandler(2, SonicbomReadWord); - SekClose(); - } - - return nRet; -} - -static INT32 TetrisblInit() -{ - INT32 nRet = System16Init(); - - System16SpriteXOffset = 114; - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0x418000, 0x418031, SM_WRITE); - SekSetWriteWordHandler(1, TetrisblGfxWriteWord); - - SekMapHandler(2, 0xc42006, 0xc42007, SM_WRITE); - SekSetWriteByteHandler(2, TetrisblSndWriteByte); - SekClose(); - - bSystem16BootlegRender = true; - } - - return nRet; -} - -static INT32 TimescanInit() -{ - System16BTileAlt = true; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0x80000 - 0x40000; - - INT32 nRet = System16Init(); - - if (!nRet) { - UINT8 *pTemp = (UINT8*)BurnMalloc(0x80000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x40000); - memset(System16Sprites, 0, 0x80000); - memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); - memcpy(System16Sprites + 0x020000, pTemp + 0x10000, 0x20000); - memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); - memcpy(System16Sprites + 0x060000, pTemp + 0x30000, 0x20000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 ToryumonInit() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekSetReadByteHandler(0, ToryumonReadByte); - SekSetWriteByteHandler(0, ToryumonWriteByte); - SekMapMemory(System16Ram, 0xff0000, 0xff3fff, SM_RAM); - SekMapMemory(System16Ram, 0xff4000, 0xff7fff, SM_RAM); - SekMapMemory(System16Ram, 0xff8000, 0xffbfff, SM_RAM); - SekClose(); - } - - return nRet; -} - -void TturfMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x300000, 0x3007ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x500000, 0x500fff, SM_RAM); - SekMapMemory(System16Ram , 0x200000, 0x203fff, SM_RAM); - SekSetReadByteHandler(0, TturfReadByte); - SekSetWriteByteHandler(0, TturfWriteByte); - SekSetWriteWordHandler(0, System16BWriteWord); - SekClose(); -} - -void Tturf_Sim8751() -{ - // Inputs - *((UINT16*)(System16Ram + 0x01e6)) = BURN_ENDIAN_SWAP_INT16((UINT16)(~System16Input[0] << 8)); - *((UINT16*)(System16Ram + 0x01e8)) = BURN_ENDIAN_SWAP_INT16((UINT16)(~System16Input[1] << 8)); - *((UINT16*)(System16Ram + 0x01ea)) = BURN_ENDIAN_SWAP_INT16((UINT16)(~System16Input[2] << 8)); - - // Sound command - UINT16 temp = (System16Ram[0x01d0 + 1] << 8) | System16Ram[0x01d0 + 0]; - if ((temp & 0xff00) != 0x0000) { - System16SoundLatch = temp & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - *((UINT16*)(System16Ram + 0x01d0)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); - } -} - -static INT32 TturfInit() -{ - Simulate8751 = Tturf_Sim8751; - System16Map68KDo = TturfMap68K; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0xe0000 - 0x80000; - - INT32 nRet = System16Init(); - - if (!nRet) { - UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x80000); - memset(System16Sprites, 0, 0xe0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); - memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); - memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); - memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 TturfuInit() -{ - Simulate8751 = Tturf_Sim8751; - System16Map68KDo = TturfMap68K; - - return System16Init(); -} - -void Wb3_Sim8751() -{ - // Sound command - UINT16 temp = (System16Ram[0x0008 + 1] << 8) | System16Ram[0x0008 + 0]; - if ((temp & 0xff00) != 0x0000) { - System16SoundLatch = temp >> 8; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - *((UINT16*)(System16Ram + 0x0008)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); - } -} - -static INT32 Wb3Init() -{ - Simulate8751 = Wb3_Sim8751; - - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0xe0000 - 0x80000; - - INT32 nRet = System16Init(); - - if (!nRet) { - UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x80000); - memset(System16Sprites, 0, 0xe0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); - memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); - memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); - memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Wb32Init() -{ - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xdf0006, 0xdf0007, SM_WRITE); - SekSetWriteByteHandler(1, Wb3WriteByte); - SekClose(); - } - - return nRet; -} - -static INT32 Wb33Init() -{ - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0xe0000 - 0x80000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xdf0006, 0xdf0007, SM_WRITE); - SekSetWriteByteHandler(1, Wb3WriteByte); - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x80000); - memset(System16Sprites, 0, 0xe0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); - memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); - memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); - memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); - } else { - nRet = 1; - } - BurnFree(pTemp); - } - - return nRet; -} - -static INT32 Wb3bblInit() -{ - // Start off with some sprite rom and let the load routine add on the rest - System16SpriteRomSize = 0xe0000 - 0x80000; - - INT32 nRet = System16Init(); - - if (!nRet) { - SekOpen(0); - SekMapHandler(1, 0xc44000, 0xc46031, SM_WRITE); - SekSetWriteWordHandler(1, Wb3bblGfxWriteWord); - SekClose(); - - UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); - if (pTemp) { - memcpy(pTemp, System16Sprites, 0x80000); - memset(System16Sprites, 0, 0xe0000); - memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); - memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); - memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); - memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); - } else { - nRet = 1; - } - BurnFree(pTemp); - - bSystem16BootlegRender = true; - } - - return nRet; -} - -void WrestwarMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x100000, 0x10ffff, SM_READ); - SekMapMemory(System16TextRam , 0x110000, 0x110fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x200000, 0x2007ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x300000, 0x300fff, SM_RAM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - SekSetReadByteHandler(0, System16BReadByte); - SekSetWriteByteHandler(0, System16BWriteByte); - SekMapHandler(1, 0x400000, 0x400003, SM_WRITE); - SekSetWriteByteHandler(1, WrestwarWriteByte); - SekMapHandler(2, 0x100000, 0x10ffff, SM_WRITE); - SekSetWriteByteHandler(2, WrestwarTileWriteByte); - SekSetWriteWordHandler(2, WrestwarTileWriteWord); - SekClose(); -} - -void Wrestwar_Sim8751() -{ - // System Inputs - *((UINT16*)(System16Ram + 0x2082)) = BURN_ENDIAN_SWAP_INT16((UINT16)~System16Input[0]); - - // Sound command - UINT16 temp = (System16Ram[0x208e + 1] << 8) | System16Ram[0x208e + 0]; - if ((temp & 0xff00) != 0x0000) { - System16SoundLatch = temp & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - *((UINT16*)(System16Ram + 0x208e)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); - } -} - -static INT32 WrestwarInit() -{ - Simulate8751 = Wrestwar_Sim8751; - System16Map68KDo = WrestwarMap68K; - System16CustomLoadRomDo = CustomLoadRom40000; - - return System16Init(); -} - -static INT32 Wrestwar1Init() -{ - System16Map68KDo = WrestwarMap68K; - System16CustomLoadRomDo = CustomLoadRom40000; - - return System16Init(); -} - -/*==================================================== -Driver defs -====================================================*/ - -struct BurnDriver BurnDrvAceattac = { - "aceattac", NULL, NULL, NULL, "1988", - "Ace Attacker (FD1094 317-0059)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1094_ENC, GBF_SPORTSMISC, 0, - NULL, AceattacRomInfo, AceattacRomName, NULL, NULL, System16bDip3InputInfo, NULL, - System16Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvAliensyn = { - "aliensyn", NULL, NULL, NULL, "1987", - "Alien Syndrome (set 4, System 16B, unprotected)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_MAZE, 0, - NULL, AliensynRomInfo, AliensynRomName, NULL, NULL, System16bfire1InputInfo, AliensynDIPInfo, - AliensynInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAliensyn3 = { - "aliensyn3", "aliensyn", NULL, NULL, "1987", - "Alien Syndrome (set 3, System 16B, FD1089A 317-0033)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1089A_ENC, GBF_MAZE, 0, - NULL, Aliensyn3RomInfo, Aliensyn3RomName, NULL, NULL, System16bfire1InputInfo, AliensynDIPInfo, - Aliensyn3Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAliensynj = { - "aliensynj", "aliensyn", NULL, NULL, "1987", - "Alien Syndrome (set 6, Japan, new, System 16B, FD1089A 317-0033)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1089A_ENC, GBF_MAZE, 0, - NULL, AliensynjRomInfo, AliensynjRomName, NULL, NULL, System16bfire1InputInfo, AliensynjDIPInfo, - Aliensyn3Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAltbeast = { - "altbeast", NULL, NULL, NULL, "1988", - "Altered Beast (set 8, 8751 317-0078)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, - NULL, AltbeastRomInfo, AltbeastRomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, - AltbeastInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAltbeastj = { - "altbeastj", "altbeast", NULL, NULL, "1988", - "Juuouki (set 7, Japan, 8751 317-0077)\0", NULL, "Sega", "System 16B", - L"Juuoki (set 7, Japan, 8751 317-0077)\0\u7363\u738B\u8A18\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, - NULL, AltbeastjRomInfo, AltbeastjRomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, - AltbeastjInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAltbeast2 = { - "altbeast2", "altbeast", NULL, NULL, "1988", - "Altered Beast (set 2, MC-8123B 317-0066)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_MC8123_ENC, GBF_SCRFIGHT, 0, - NULL, Altbeast2RomInfo, Altbeast2RomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, - System16Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAltbeastj3 = { - "altbeastj3", "altbeast", NULL, NULL, "1988", - "Juuouki (set 3, Japan, FD1094 317-0068)\0", NULL, "Sega", "System 16B", - L"Juuoki (set 3, Japan, FD1094 317-0068)\0\u7363\u738B\u8A18\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, - NULL, Altbeastj3RomInfo, Altbeastj3RomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, - Altbeastj3Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAltbeast4 = { - "altbeast4", "altbeast", NULL, NULL, "1988", - "Altered Beast (set 4, MC-8123B 317-0066)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_MC8123_ENC, GBF_SCRFIGHT, 0, - NULL, Altbeast4RomInfo, Altbeast4RomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, - Altbeast4Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAltbeast5 = { - "altbeast5", "altbeast", NULL, NULL, "1988", - "Altered Beast (set 5, FD1094 317-0069)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, - NULL, Altbeast5RomInfo, Altbeast5RomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, - Altbeast4Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAltbeast6 = { - "altbeast6", "altbeast", NULL, NULL, "1988", - "Altered Beast (set 6, 8751 317-0076)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, - NULL, Altbeast6RomInfo, Altbeast6RomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, - Altbeast6Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAtomicp = { - "atomicp", NULL, NULL, NULL, "1990", - "Atomic Point (Korea)\0", NULL, "Philco", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_YM2413, GBF_MISC, 0, - NULL, AtomicpRomInfo, AtomicpRomName, NULL, NULL, AtomicpInputInfo, AtomicpDIPInfo, - AtomicpInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAurail = { - "aurail", NULL, NULL, NULL, "1990", - "Aurail (set 3, US, unprotected)\0", NULL, "Sega / Westone", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_VERSHOOT, 0, - NULL, AurailRomInfo, AurailRomName, NULL, NULL, System16bfire3InputInfo, AurailDIPInfo, - AurailInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAurail1 = { - "aurail1", "aurail", NULL, NULL, "1990", - "Aurail (set 2, World, FD1089B 317-0168)\0", NULL, "Sega / Westone", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1089B_ENC, GBF_VERSHOOT, 0, - NULL, Aurail1RomInfo, Aurail1RomName, NULL, NULL, System16bfire3InputInfo, AurailDIPInfo, - Aurail1Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvAurailj = { - "aurailj", "aurail", NULL, NULL, "1990", - "Aurail (set 1, Japan, FD1089A 317-0167)\0", NULL, "Sega / Westone", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1089A_ENC, GBF_VERSHOOT, 0, - NULL, AurailjRomInfo, AurailjRomName, NULL, NULL, System16bfire3InputInfo, AurailDIPInfo, - AurailjInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBayroute = { - "bayroute", NULL, NULL, NULL, "1989", - "Bay Route (set 3, World, FD1094 317-0116)\0", NULL, "Sunsoft / Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, BayrouteRomInfo, BayrouteRomName, NULL, NULL, System16bfire3InputInfo, BayrouteDIPInfo, - BayrouteInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBayroutej = { - "bayroutej", "bayroute", NULL, NULL, "1989", - "Bay Route (set 2, Japan, FD1094 317-0115)\0", NULL, "Sunsoft / Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, BayroutejRomInfo, BayroutejRomName, NULL, NULL, System16bfire3InputInfo, BayrouteDIPInfo, - BayrouteInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBayroute1 = { - "bayroute1", "bayroute", NULL, NULL, "1989", - "Bay Route (set 1, US, unprotected)\0", "No Sound, Missing Z80 Program ROM", "Sunsoft / Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_PLATFORM, 0, - NULL, Bayroute1RomInfo, Bayroute1RomName, NULL, NULL, System16bfire3InputInfo, BayrouteDIPInfo, - Bayroute1Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBlox16b = { - "blox16b", "bloxeed", NULL, NULL, "2008", - "Bloxeed (System 16B, PS2 data file)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5704_PS2, GBF_PUZZLE, 0, - NULL, Blox16bRomInfo, Blox16bRomName, NULL, NULL, System16bfire3InputInfo, Blox16bDIPInfo, - Blox16bInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBullet = { - "bullet", NULL, NULL, NULL, "1987", - "Bullet (FD1094 317-0041)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 3, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_VERSHOOT, 0, - NULL, BulletRomInfo, BulletRomName, NULL, NULL, BulletInputInfo, BulletDIPInfo, - BulletInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvCotton = { - "cotton", NULL, NULL, NULL, "1991", - "Cotton (set 3, World, FD1094 317-0181a)\0", NULL, "Sega / Success", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_HORSHOOT, 0, - NULL, CottonRomInfo, CottonRomName, NULL, NULL, System16bInputInfo, CottonDIPInfo, - CottonInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvCottonu = { - "cottonu", "cotton", NULL, NULL, "1991", - "Cotton (set 2, US, FD1094 317-0180)\0", NULL, "Sega / Success", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_HORSHOOT, 0, - NULL, CottonuRomInfo, CottonuRomName, NULL, NULL, System16bInputInfo, CottonDIPInfo, - CottonInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvCottonj = { - "cottonj", "cotton", NULL, NULL, "1991", - "Cotton (set 1, Japan, FD1094 317-0179a))\0", NULL, "Sega / Success", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_HORSHOOT, 0, - NULL, CottonjRomInfo, CottonjRomName, NULL, NULL, System16bInputInfo, CottonDIPInfo, - CottonInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDdux = { - "ddux", NULL, NULL, NULL, "1989", - "Dynamite Dux (set 2, FD1094 317-0096)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, - NULL, DduxRomInfo, DduxRomName, NULL, NULL, System16bInputInfo, DduxDIPInfo, - DduxInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDdux1 = { - "ddux1", "ddux", NULL, NULL, "1989", - "Dynamite Dux (set 1, 8751 317-0095)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, - NULL, Ddux1RomInfo, Ddux1RomName, NULL, NULL, System16bInputInfo, DduxDIPInfo, - Ddux1Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDduxbl = { - "dduxbl", "ddux", NULL, NULL, "1989", - "Dynamite Dux (bootleg)\0", NULL, "bootleg", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_INVERT_TILES | HARDWARE_SEGA_5358, GBF_SCRFIGHT, 0, - NULL, DduxblRomInfo, DduxblRomName, NULL, NULL, System16bInputInfo, DduxDIPInfo, - DduxblInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDunkshot = { - "dunkshot", NULL, NULL, NULL, "1986", - "Dunk Shot (FD1089 317-0022)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1089A_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, - NULL, DunkshotRomInfo, DunkshotRomName, NULL, NULL, DunkshotInputInfo, DunkshotDIPInfo, - DunkshotInit, DunkshotExit, System16BFrame, NULL, DunkshotScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvEswat = { - "eswat", NULL, NULL, NULL, "1989", - "E-Swat - Cyber Police (set 3, World, FD1094 317-0130)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, EswatRomInfo, EswatRomName, NULL, NULL, System16bfire3InputInfo, EswatDIPInfo, - EswatInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvEswatj = { - "eswatj", "eswat", NULL, NULL, "1989", - "E-Swat - Cyber Police (set 1, Japan, FD1094 317-0128)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, EswatjRomInfo, EswatjRomName, NULL, NULL, System16bfire3InputInfo, EswatDIPInfo, - EswatInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvEswatu = { - "eswatu", "eswat", NULL, NULL, "1989", - "E-Swat - Cyber Police (set 2, US, FD1094 317-0129)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, EswatuRomInfo, EswatuRomName, NULL, NULL, System16bfire3InputInfo, EswatDIPInfo, - EswatInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvEswatbl = { - "eswatbl", "eswat", NULL, NULL, "1989", - "E-Swat - Cyber Police (bootleg)\0", NULL, "bootleg", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797, GBF_PLATFORM, 0, - NULL, EswatblRomInfo, EswatblRomName, NULL, NULL, System16bfire3InputInfo, EswatDIPInfo, - EswatblInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvExctleag = { - "exctleag", NULL, NULL, NULL, "1989", - "Excite League (FD1094 317-0079)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, - NULL, ExctleagRomInfo, ExctleagRomName, NULL, NULL, ExctleagInputInfo, ExctleagDIPInfo, - ExctleagInit, ExctleagExit, System16BFrame, NULL, ExctleagScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFantzn2x = { - "fantzn2x", NULL, NULL, NULL, "2008", - "Fantasy Zone II - The Tears of Opa-Opa (System 16C)\0", NULL, "Sega / M2", "System 16C", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5704_PS2, GBF_HORSHOOT, 0, - NULL, Fantzn2xRomInfo, Fantzn2xRomName, NULL, NULL, System16bInputInfo, Fantzn2xDIPInfo, - Fantzn2xInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFantzn2xp = { - "fantzn2xp", "fantzn2x", NULL, NULL, "2008", - "Fantasy Zone II - The Tears of Opa-Opa (System 16C, prototype)\0", NULL, "Sega / M2", "System 16C", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5704_PS2, GBF_HORSHOOT, 0, - NULL, Fantzn2xpRomInfo, Fantzn2xpRomName, NULL, NULL, System16bInputInfo, Fantzn2xDIPInfo, - Fantzn2xInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFantzn2xps2 = { - "fantzn2xps2", "fantzn2x", NULL, NULL, "2008", - "Fantasy Zone II - The Tears of Opa-Opa (System 16C, PS2 data file)\0", NULL, "Sega / M2", "System 16C", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5704_PS2, GBF_HORSHOOT, 0, - NULL, Fantzn2xps2RomInfo, Fantzn2xps2RomName, NULL, NULL, System16bInputInfo, Fantzn2xDIPInfo, - Fantzn2xps2Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFantznta = { - "fantznta", "fantzn2x", NULL, NULL, "2008", - "Fantasy Zone Time Attack (System 16B, PS2 data file)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5704_PS2, GBF_HORSHOOT, 0, - NULL, FantzntaRomInfo, FantzntaRomName, NULL, NULL, System16bInputInfo, Fantzn2xDIPInfo, - FantzntaInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFpoint = { - "fpoint", NULL, NULL, NULL, "1989", - "Flash Point (set 2, Japan, FD1094 317-0127A)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_PUZZLE, 0, - NULL, FpointRomInfo, FpointRomName, NULL, NULL, System16bfire1InputInfo, FpointDIPInfo, - System16Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFpoint1 = { - "fpoint1", "fpoint", NULL, NULL, "1989", - "Flash Point (set 1, Japan, FD1094 317-0127A)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, - NULL, Fpoint1RomInfo, Fpoint1RomName, NULL, NULL, System16bfire1InputInfo, FpointDIPInfo, - System16Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFpointbl = { - "fpointbl", "fpoint", NULL, NULL, "1989", - "Flash Point (World, bootleg)\0", NULL, "bootleg", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_INVERT_TILES, GBF_PUZZLE, 0, - NULL, FpointblRomInfo, FpointblRomName, NULL, NULL, FpointblInputInfo, FpointDIPInfo, - FpointblInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFpointbj = { - "fpointbj", "fpoint", NULL, NULL, "1989", - "Flash Point (Japan, bootleg)\0", NULL, "bootleg", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_INVERT_TILES, GBF_PUZZLE, 0, - NULL, FpointbjRomInfo, FpointbjRomName, NULL, NULL, FpointblInputInfo, FpointDIPInfo, - FpointblInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGoldnaxe = { - "goldnaxe", NULL, NULL, NULL, "1989", - "Golden Axe (set 6, US, 8751 317-123A)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797, GBF_SCRFIGHT, 0, - NULL, GoldnaxeRomInfo, GoldnaxeRomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, - GoldnaxeInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGoldnaxe1 = { - "goldnaxe1", "goldnaxe", NULL, NULL, "1989", - "Golden Axe (set 1, World, FD1094 317-0110)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, - NULL, Goldnaxe1RomInfo, Goldnaxe1RomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, - Goldnaxe1Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGoldnaxe2 = { - "goldnaxe2", "goldnaxe", NULL, NULL, "1989", - "Golden Axe (set 2, US, 8751 317-0112)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, - NULL, Goldnaxe2RomInfo, Goldnaxe2RomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, - Goldnaxe2Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGoldnaxe3 = { - "goldnaxe3", "goldnaxe", NULL, NULL, "1989", - "Golden Axe (set 3, World, FD1094 317-0120)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, - NULL, Goldnaxe3RomInfo, Goldnaxe3RomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, - Goldnaxe3Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGoldnaxej = { - "goldnaxej", "goldnaxe", NULL, NULL, "1989", - "Golden Axe (set 4, Japan, FD1094 317-0121)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, - NULL, GoldnaxejRomInfo, GoldnaxejRomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, - Goldnaxe3Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGoldnaxeu = { - "goldnaxeu", "goldnaxe", NULL, NULL, "1989", - "Golden Axe (set 5, US, FD1094 317-0122)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, - NULL, GoldnaxeuRomInfo, GoldnaxeuRomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, - Goldnaxe1Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvHwchamp = { - "hwchamp", NULL, NULL, NULL, "1987", - "Heavyweight Champ\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_VSFIGHT, 0, - NULL, HwchampRomInfo, HwchampRomName, NULL, NULL, HwchampInputInfo, HwchampDIPInfo, - HwchampInit, HwchampExit, System16BFrame, NULL, HwchampScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvHwchampj = { - "hwchampj", "hwchamp", NULL, NULL, "1987", - "Heavyweight Champ (Japan, FD1094 317-0046)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_VSFIGHT, 0, - NULL, HwchampjRomInfo, HwchampjRomName, NULL, NULL, HwchampInputInfo, HwchampDIPInfo, - HwchampInit, HwchampExit, System16BFrame, NULL, HwchampScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMvp = { - "mvp", NULL, NULL, NULL, "1989", - "MVP (set 2, US, FD1094 317-0143)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_SPORTSMISC, 0, - NULL, MvpRomInfo, MvpRomName, NULL, NULL, System16bfire3InputInfo, MvpDIPInfo, - MvpInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMvpj = { - "mvpj", "mvp", NULL, NULL, "1989", - "MVP (set 1, Japan, FD1094 317-0142)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SPORTSMISC, 0, - NULL, MvpjRomInfo, MvpjRomName, NULL, NULL, System16bfire3InputInfo, MvpDIPInfo, - MvpjInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPasssht = { - "passsht", NULL, NULL, NULL, "1988", - "Passing Shot (World, 2 Players, FD1094 317-0080)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, - NULL, PassshtRomInfo, PassshtRomName, NULL, NULL, System16bfire4InputInfo, PassshtDIPInfo, - PassshtInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvPassshta = { - "passshta", "passsht", NULL, NULL, "1988", - "Passing Shot (World, 4 Players, FD1094 317-0074)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 4, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, - NULL, PassshtaRomInfo, PassshtaRomName, NULL, NULL, PassshtInputInfo, PassshtaDIPInfo, - PassshtaInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvPassshtj = { - "passshtj", "passsht", NULL, NULL, "1988", - "Passing Shot (Japan, 4 Players, FD1094 317-0070)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 4, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, - NULL, PassshtjRomInfo, PassshtjRomName, NULL, NULL, PassshtInputInfo, PassshtaDIPInfo, - PassshtaInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriverD BurnDrvPassshtb = { - "passshtb", "passsht", NULL, NULL, "1988", - "Passing Shot (bootleg, 2 Players)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, - NULL, PassshtbRomInfo, PassshtbRomName, NULL, NULL, PassshtInputInfo, PassshtDIPInfo, - PassshtbInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvRiotcity = { - "riotcity", NULL, NULL, NULL, "1991", - "Riot City (Japan)\0", NULL, "Sega / Westone", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, - NULL, RiotcityRomInfo, RiotcityRomName, NULL, NULL, System16bInputInfo, RiotcityDIPInfo, - RiotcityInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvRyukyu = { - "ryukyu", NULL, NULL, NULL, "1990", - "RyuKyu (Japan, FD1094 317-5023)\0", NULL, "Success / Sega", "System 16B", - L"RyuKyu \u7409\u7403 (Japan, FD1094 317-5023)\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, - NULL, RyukyuRomInfo, RyukyuRomName, NULL, NULL, RyukyuInputInfo, RyukyuDIPInfo, - RyukyuInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSdib = { - "sdib", "sdi", NULL, NULL, "1987", - "SDI - Strategic Defense Initiative (System 16B, FD1089A 317-0028)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1089A_ENC | HARDWARE_SEGA_5358, GBF_SHOOT, 0, - NULL, SdibRomInfo, SdibRomName, NULL, NULL, SdiInputInfo, SdibDIPInfo, - SdibInit, SdibExit, System16BFrame, NULL, SdibScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSdibl = { - "sdibl", "sdi", NULL, NULL, "1987", - "SDI - Strategic Defense Initiative (bootleg)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_SHOOT, 0, - NULL, SdiblRomInfo, SdiblRomName, NULL, NULL, SdiInputInfo, SdibDIPInfo, - SdiblInit, SdibExit, System16BFrame, NULL, SdibScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDefense = { - "defense", "sdi", NULL, NULL, "1987", - "Defense (System 16B, FD1089A 317-0028)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1089A_ENC | HARDWARE_SEGA_5358, GBF_SHOOT, 0, - NULL, DefenseRomInfo, DefenseRomName, NULL, NULL, SdiInputInfo, SdibDIPInfo, - SdibInit, SdibExit, System16BFrame, NULL, SdibScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvShinobi2 = { - "shinobi2", "shinobi", NULL, NULL, "1987", - "Shinobi (set 2, System 16B, FD1094 317-0049)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, Shinobi2RomInfo, Shinobi2RomName, NULL, NULL, System16bfire3InputInfo, ShinobiDIPInfo, - System16Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvShinobi3 = { - "shinobi3", "shinobi", NULL, NULL, "1987", - "Shinobi (set 3, System 16B, MC-8123B 317-0054)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_MC8123_ENC, GBF_PLATFORM, 0, - NULL, Shinobi3RomInfo, Shinobi3RomName, NULL, NULL, System16bfire3InputInfo, ShinobiDIPInfo, - System16Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvShinobi4 = { - "shinobi4", "shinobi", NULL, NULL, "1987", - "Shinobi (set 4, System 16B, MC-8123B 317-0054)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_MC8123_ENC, GBF_PLATFORM, 0, - NULL, Shinobi4RomInfo, Shinobi4RomName, NULL, NULL, System16bfire3InputInfo, ShinobiDIPInfo, - System16Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvShinobi5 = { - "shinobi5", "shinobi", NULL, NULL, "1987", - "Shinobi (set 5, System 16B, unprotected)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_PLATFORM, 0, - NULL, Shinobi5RomInfo, Shinobi5RomName, NULL, NULL, System16bfire3InputInfo, ShinobiDIPInfo, - System16Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSjryuko = { - "sjryuko", NULL, NULL, NULL, "1987", - "Sukeban Jansi Ryuko (set 2, System 16B, FD1089B 317-5021)\0", NULL, "White Board", "System 16B", - L"Sukeban Jansi Ryuko (set 2, System 16B, FD1089B 317-5021)\0\u30B9\u30B1\u30D0\u30F3\u96C0\u58EB \u7ADC\u5B50\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1089B_ENC | HARDWARE_SEGA_5358, GBF_MAHJONG, 0, - NULL, SjryukoRomInfo, SjryukoRomName, NULL, NULL, SjryukoInputInfo, SjryukoDIPInfo, - SjryukoInit, SjryukoExit, System16BFrame, NULL, SjryukoScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSnapper = { - "snapper", NULL, NULL, NULL, "1990", - "Snapper (Korea)\0", NULL, "Philko", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_YM2413, GBF_MISC, 0, - NULL, SnapperRomInfo, SnapperRomName, NULL, NULL, SnapperInputInfo, SnapperDIPInfo, - SnapperInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSonicbom = { - "sonicbom", NULL, NULL, NULL, "1987", - "Sonic Boom (FD1094 317-0053)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1094_ENC, GBF_VERSHOOT, 0, - NULL, SonicbomRomInfo, SonicbomRomName, NULL, NULL, System16bInputInfo, SonicbomDIPInfo, - SonicbomInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvSuprleag = { - "suprleag", NULL, NULL, NULL, "1987", - "Super League (FD1094 317-0045)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, - NULL, SuprleagRomInfo, SuprleagRomName, NULL, NULL, ExctleagInputInfo, ExctleagDIPInfo, - ExctleagInit, ExctleagExit, System16BFrame, NULL, ExctleagScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTetris1 = { - "tetris1", "tetris", NULL, NULL, "1988", - "Tetris (set 1, Japan, System 16B, FD1094 317-0091)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, - NULL, Tetris1RomInfo, Tetris1RomName, NULL, NULL, System16bfire1InputInfo, TetrisDIPInfo, - System16Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTetris2 = { - "tetris2", "tetris", NULL, NULL, "1988", - "Tetris (set 2, Japan, System 16B, FD1094 317-0092)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, - NULL, Tetris2RomInfo, Tetris2RomName, NULL, NULL, System16bfire1InputInfo, TetrisDIPInfo, - System16Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTetrisbl = { - "tetrisbl", "tetris", NULL, NULL, "1988", - "Tetris (bootleg)\0", NULL, "bootleg", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B, GBF_PUZZLE, 0, - NULL, TetrisblRomInfo, TetrisblRomName, NULL, NULL, System16bfire1InputInfo, TetrisDIPInfo, - TetrisblInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTimescan = { - "timescan", NULL, NULL, NULL, "1987", - "Time Scanner (set 2, System 16B)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_PINBALL, 0, - NULL, TimescanRomInfo, TimescanRomName, NULL, NULL, System16bDip3InputInfo, TimescanDIPInfo, - TimescanInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvToryumon = { - "toryumon", NULL, NULL, NULL, "1994", - "Toryumon\0", NULL, "Sega / Westone", "System 16B", - L"Toryumon\0\u767B\u9F8D\u9580\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797, GBF_PUZZLE, 0, - NULL, ToryumonRomInfo, ToryumonRomName, NULL, NULL, System16bfire1InputInfo, ToryumonDIPInfo, - ToryumonInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTturf = { - "tturf", NULL, NULL, NULL, "1989", - "Tough Turf (set 2, Japan, 8751 317-0104)\0", "No Sound, Missing Z80 Program", "Sega / Sunsoft", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, - NULL, TturfRomInfo, TturfRomName, NULL, NULL, System16bfire3InputInfo, TturfDIPInfo, - TturfInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTturfu = { - "tturfu", "tturf", NULL, NULL, "1989", - "Tough Turf (set 1, US, 8751 317-0099)\0", NULL, "Sega / Sunsoft", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_SCRFIGHT, 0, - NULL, TturfuRomInfo, TturfuRomName, NULL, NULL, System16bfire3InputInfo, TturfDIPInfo, - TturfuInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWb3 = { - "wb3", NULL, NULL, NULL, "1988", - "Wonder Boy III - Monster Lair (set 5, World, System 16B, 8751 317-0098)\0", NULL, "Sega / Westone", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_PLATFORM, 0, - NULL, Wb3RomInfo, Wb3RomName, NULL, NULL, System16bInputInfo, Wb3DIPInfo, - Wb3Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWb32 = { - "wb32", "wb3", NULL, NULL, "1988", - "Wonder Boy III - Monster Lair (set 2, Japan, System 16B, FD1094 317-0085)\0", NULL, "Sega / Westone", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, Wb32RomInfo, Wb32RomName, NULL, NULL, System16bInputInfo, Wb3DIPInfo, - Wb32Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWb33 = { - "wb33", "wb3", NULL, NULL, "1988", - "Wonder Boy III - Monster Lair (set 3, World, System 16B, FD1094 317-0089)\0", NULL, "Sega / Westone", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, Wb33RomInfo, Wb33RomName, NULL, NULL, System16bInputInfo, Wb3DIPInfo, - Wb33Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWb34 = { - "wb34", "wb3", NULL, NULL, "1988", - "Wonder Boy III - Monster Lair (set 4, Japan, System 16B, FD1094 317-0087)\0", NULL, "Sega / Westone", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, - NULL, Wb34RomInfo, Wb34RomName, NULL, NULL, System16bInputInfo, Wb3DIPInfo, - Wb33Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriverD BurnDrvWb3bbl = { - "wb3bbl", "wb3", NULL, NULL, "1988", - "Wonder Boy III - Monster Lair (bootleg)\0", NULL, "bootleg", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_INVERT_TILES, GBF_PLATFORM, 0, - NULL, Wb3bblRomInfo, Wb3bblRomName, NULL, NULL, System16bInputInfo, Wb3DIPInfo, - Wb3bblInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvWrestwar = { - "wrestwar", NULL, NULL, NULL, "1988", - "Wrestle War (set 3, World, 8751 317-0103)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_VSFIGHT, 0, - NULL, WrestwarRomInfo, WrestwarRomName, NULL, NULL, System16bInputInfo, WrestwarDIPInfo, - WrestwarInit, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvWrestwar1 = { - "wrestwar1", "wrestwar", NULL, NULL, "1988", - "Wrestle War (set 1, Japan, FD1094 317-0090)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_VSFIGHT, 0, - NULL, Wrestwar1RomInfo, Wrestwar1RomName, NULL, NULL, System16bInputInfo, WrestwarDIPInfo, - Wrestwar1Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvWrestwar2 = { - "wrestwar2", "wrestwar", NULL, NULL, "1988", - "Wrestle War (set 2, World, FD1094 317-0102)\0", NULL, "Sega", "System 16B", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_VSFIGHT, 0, - NULL, Wrestwar2RomInfo, Wrestwar2RomName, NULL, NULL, System16bInputInfo, WrestwarDIPInfo, - Wrestwar1Init, System16Exit, System16BFrame, NULL, System16Scan, - NULL, 0x1800, 224, 320, 3, 4 -}; - -// ISG Selection Master Type 2006 hardware - -static UINT16 IsgsmCartAddrLatch; -static UINT32 IsgsmCartAddr; -static INT32 IsgsmType = 0; -static UINT32 IsgsmAddr; -static UINT8 IsgsmMode; -static UINT16 IsgsmAddrLatch; -static UINT32 IsgsmSecurity; -static UINT16 IsgsmSecurityLatch; -static UINT8 IsgsmRleControlPosition = 8; -static UINT8 IsgsmRleControlByte; -static INT32 IsgsmRleLatched; -static UINT8 IsgsmRleByte; -static UINT8 IsgsmReadXor; -static UINT32 nCartSize; -static INT32 GameRomMapped = 0; - -typedef UINT32 (*isgsm_security_callback)(UINT32 input); -isgsm_security_callback IsgsmSecurityCallback; - -static INT32 IsgsmTilePlaneOffsets[3] = { 0x200000, 0x100000, 0 }; -static INT32 IsgsmTileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 IsgsmTileYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; - -static struct BurnDIPInfo ShinfzDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfc, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x13, 0x01, 0x0c, 0x08, "2" }, - {0x13, 0x01, 0x0c, 0x0c, "3" }, - {0x13, 0x01, 0x0c, 0x04, "4" }, - {0x13, 0x01, 0x0c, 0x00, "240" }, - - {0 , 0xfe, 0 , 4 , "Extra Ship Cost" }, - {0x13, 0x01, 0x30, 0x30, "5000" }, - {0x13, 0x01, 0x30, 0x20, "10000" }, - {0x13, 0x01, 0x30, 0x10, "15000" }, - {0x13, 0x01, 0x30, 0x00, "20000" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x13, 0x01, 0xc0, 0x80, "Easy" }, - {0x13, 0x01, 0xc0, 0xc0, "Normal" }, - {0x13, 0x01, 0xc0, 0x40, "Hard" }, - {0x13, 0x01, 0xc0, 0x00, "Hardest" }, - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 3 , "Game Select" }, - {0x15, 0x01, 0x03, 0x00, "Shinobi Ninja Game" }, - {0x15, 0x01, 0x03, 0x01, "FZ-2006 Game I" }, - {0x15, 0x01, 0x03, 0x02, "FZ-2006 Game II" }, -}; - -STDDIPINFO(Shinfz) - -static struct BurnDIPInfo TetrbxDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0x00, NULL }, - - // Dip 1 - - // Dip 2 - - // Dip 3 - {0 , 0xfe, 0 , 3 , "Game Select" }, - {0x15, 0x01, 0x03, 0x00, "Tetris" }, - {0x15, 0x01, 0x03, 0x01, "Tetris II (Blox)" }, - {0x15, 0x01, 0x03, 0x02, "Tetris Turbo" }, -}; - -STDDIPINFO(Tetrbx) - -static struct BurnRomInfo emptyRomDesc[] = { - { "", 0, 0, 0 }, -}; - -static struct BurnRomInfo IsgsmRomDesc[] = { - { "ism2006v00.u1", 0x020000, 0x2292585c, BRF_ESS | BRF_PRG | BRF_BIOS }, -}; - -STD_ROM_PICK(Isgsm) -STD_ROM_FN(Isgsm) - -static struct BurnRomInfo ShinfzRomDesc[] = { - { "shin06.u13", 0x200000, 0x39d773e9, BRF_ESS | BRF_PRG }, -}; - -STDROMPICKEXT(Shinfz, Shinfz, Isgsm) -STD_ROM_FN(Shinfz) - -static struct BurnRomInfo TetrbxRomDesc[] = { - { "tetr06.u13", 0x080000, 0x884dd693, BRF_ESS | BRF_PRG }, -}; - -STDROMPICKEXT(Tetrbx, Tetrbx, Isgsm) -STD_ROM_FN(Tetrbx) - -static UINT32 ShinfzSecurity(UINT32 input) -{ - return BITSWAP32(input, 19, 20, 25, 26, 15, 0, 16, 2, 8, 9, 13, 14, 31, 21, 7, 18, 11, 30, 22, 17, 3, 4, 12, 28, 29, 5, 27, 10, 23, 24, 1, 6); -} - -static UINT32 TetrbxSecurity(UINT32 input) -{ - return input; -} - -UINT8 __fastcall IsgsmReadByte(UINT32 a) -{ - switch (a) { - case 0xc41001: { - return 0xff - System16Input[0]; - } - - case 0xc41003: { - return 0xff - System16Input[1]; - } - - case 0xc41007: { - return 0xff - System16Input[2]; - } - - case 0xc42001: { - return System16Dip[0]; - } - - case 0xc42003: { - return System16Dip[1]; - } - - case 0xe80001: { - UINT32 Address; - UINT8 Data; - - IsgsmCartAddr++; - Address = (IsgsmCartAddr & (nCartSize - 1)); - Data = System16Rom[(0x100000 + Address) ^ 1] ^ IsgsmReadXor; - - return Data; - } - - case 0xe80003: { - return System16Dip[2]; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); -#endif - - return 0xff; -} - -void __fastcall IsgsmWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16BTileByteWrite((a - 0x400000) ^ 1, d); - return; - } - - switch (a) { - case 0x3f0001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3f0003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3f2001: { - if (System16TileBanks[0] != (d & 0x07)) { - System16TileBanks[0] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0x3f2003: { - if (System16TileBanks[1] != (d & 0x07)) { - System16TileBanks[1] = d & 0x07; - System16RecalcBgTileMap = 1; - System16RecalcBgAltTileMap = 1; - System16RecalcFgTileMap = 1; - System16RecalcFgAltTileMap = 1; - } - return; - } - - case 0xc40001: { - System16VideoEnable = d & 0x20; - System16ScreenFlip = d & 0x40; - return; - } - - case 0xc43001: { - // ???? - return; - } - - case 0xe00001: { - UINT8 *pDest = 0; - int AddressMask = 0; - - switch (IsgsmType & 0x0f) { - case 0x00: { - pDest = System16Sprites; - AddressMask = 0x1fffff; - break; - } - - case 0x01: { - pDest = System16TempGfx; - AddressMask = 0xfffff; - break; - } - - case 0x02: { - pDest = System16Z80Rom; - AddressMask = 0x3ffff; - break; - } - - case 0x03: { - pDest = System16Rom + 0x300000; - AddressMask = 0xfffff; - break; - } - } - - if ((IsgsmType & 0x10) == 0x00) { - switch (IsgsmType & 0xe0) { - case 0x00: d = BITSWAP08(d, 0, 7, 6, 5, 4, 3, 2, 1); break; - case 0x20: d = BITSWAP08(d, 7, 6, 5, 4, 3, 2, 1, 0); break; - case 0x40: d = BITSWAP08(d, 6, 5, 4, 3, 2, 1, 0, 7); break; - case 0x60: d = BITSWAP08(d, 5, 4, 3, 2, 1, 0, 7, 6); break; - case 0x80: d = BITSWAP08(d, 4, 3, 2, 1, 0, 7, 6, 5); break; - case 0xa0: d = BITSWAP08(d, 3, 2, 1, 0, 7, 6, 5, 4); break; - case 0xc0: d = BITSWAP08(d, 2, 1, 0, 7, 6, 5, 4, 3); break; - case 0xe0: d = BITSWAP08(d, 1, 0, 7, 6, 5, 4, 3, 2); break; - } - } - - if (pDest) { - INT32 BytesToWrite; - BytesToWrite = 1; - - if (IsgsmMode & 0x04) { - if (!IsgsmRleLatched) { - if (IsgsmRleControlPosition == 8) { - IsgsmRleControlByte = d; - IsgsmRleControlPosition = 0; - BytesToWrite = 0; - } else { - if (((IsgsmRleControlByte << IsgsmRleControlPosition) & 0x80) == 0) { - IsgsmRleByte = d; - IsgsmRleLatched = 1; - } else { - BytesToWrite = 1; - } - - IsgsmRleControlPosition++; - } - } else { - IsgsmRleLatched = 0; - BytesToWrite = d + 2; - d = IsgsmRleByte; - } - } - - for (INT32 i = 0; i < BytesToWrite; i++) { - UINT8 Byte = 0; - - if (IsgsmMode & 0x08) { - IsgsmAddr++; - IsgsmAddr &= 0xfffffff; - } else { - IsgsmAddr--; - IsgsmAddr &= 0xfffffff; - } - - switch (IsgsmMode & 0x03) { - case 0x00: Byte = d; break; - case 0x01: Byte = pDest[IsgsmAddr & AddressMask] ^ d; break; - case 0x02: Byte = pDest[IsgsmAddr & AddressMask] | d; break; - case 0x03: Byte = pDest[IsgsmAddr & AddressMask] & d; break; - } - - if ((IsgsmType & 0x10) == 0x10) { - switch (IsgsmType & 0xe0) { - case 0x00: Byte = BITSWAP08(Byte, 0, 7, 6, 5, 4, 3, 2, 1); break; - case 0x20: Byte = BITSWAP08(Byte, 7, 6, 5, 4, 3, 2, 1, 0); break; - case 0x40: Byte = BITSWAP08(Byte, 6, 5, 4, 3, 2, 1, 0, 7); break; - case 0x60: Byte = BITSWAP08(Byte, 5, 4, 3, 2, 1, 0, 7, 6); break; - case 0x80: Byte = BITSWAP08(Byte, 4, 3, 2, 1, 0, 7, 6, 5); break; - case 0xa0: Byte = BITSWAP08(Byte, 3, 2, 1, 0, 7, 6, 5, 4); break; - case 0xc0: Byte = BITSWAP08(Byte, 2, 1, 0, 7, 6, 5, 4, 3); break; - case 0xe0: Byte = BITSWAP08(Byte, 1, 0, 7, 6, 5, 4, 3, 2); break; - } - } - - if ((IsgsmType & 0x0f) == 0x01) { - if (IsgsmAddr < System16TileRomSize) { - pDest[IsgsmAddr] = Byte; - GfxDecodeSingle((IsgsmAddr & 0x1ffff) / 8, 3, 8, 8, IsgsmTilePlaneOffsets, IsgsmTileXOffsets, IsgsmTileYOffsets, 0x40, System16TempGfx, System16Tiles); - } - } else { - pDest[IsgsmAddr & AddressMask] = Byte; - } - } - } - - return; - } - - case 0xe00003: { - IsgsmType = d; - return; - } - - case 0xfe0007: { - System16SoundLatch = d & 0xff; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - - case 0xfe0009: { - if (d == 0) { - ZetOpen(0); - ZetReset(); - ZetClose(); - System16Z80Enable = true; - } - - if (d == 1) { - ZetOpen(0); - ZetReset(); - ZetClose(); - System16Z80Enable = false; - } - - return; - } - - case 0xfe000b: { - SekMapMemory(System16Rom + 0x300000, 0x000000, 0x0fffff, SM_ROM); - GameRomMapped = 1; - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); -#endif -} - -UINT16 __fastcall IsgsmReadWord(UINT32 a) -{ - switch (a) { - case 0xe80008: { - return (IsgsmSecurity >> 16) & 0xffff; - } - - case 0xe8000a: { - return IsgsmSecurity & 0xffff; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Read Word -> 0x%06X\n"), a); -#endif - - return 0xffff; -} - -void __fastcall IsgsmWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x400000 && a <= 0x40ffff) { - System16BTileWordWrite(a - 0x400000, d); - return; - } - - switch (a) { - case 0xe00004: { - IsgsmAddrLatch = d; - return; - } - - case 0xe00006: { - IsgsmMode = (IsgsmAddrLatch & 0xf000) >> 12; - IsgsmAddr = d | ((IsgsmAddrLatch & 0x0fff) << 16); - - IsgsmRleControlPosition = 8; - IsgsmRleControlByte = 0; - IsgsmRleLatched = 0; - return; - } - - case 0xe80004: { - IsgsmCartAddrLatch = d; - return; - } - - case 0xe80006: { - IsgsmCartAddr = d | IsgsmCartAddrLatch << 16; - return; - } - - case 0xe80008: { - IsgsmSecurityLatch = d; - return; - } - - case 0xe8000a: { - IsgsmSecurity = d | IsgsmSecurityLatch << 16; - if (IsgsmSecurityCallback) IsgsmSecurity = IsgsmSecurityCallback(IsgsmSecurity); - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X\n"), a, d); -#endif -} - -static void IsgsmMap68K() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(System16ExtraRam , 0x200000, 0x23ffff, SM_RAM); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); - SekMapMemory(System16Rom + 0x100000 , 0xee0000, 0xefffff, SM_ROM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - SekSetReadWordHandler(0, IsgsmReadWord); - SekSetWriteWordHandler(0, IsgsmWriteWord); - SekSetReadByteHandler(0, IsgsmReadByte); - SekSetWriteByteHandler(0, IsgsmWriteByte); - SekClose(); -} - -static INT32 IsgsmInit() -{ - System16RomSize = 0x400000; - System16TileRomSize = 0x60000; - System16SpriteRomSize = 0x200000; - System16UPD7759DataSize = 0x30000; - - System16Map68KDo = IsgsmMap68K; - - INT32 nRet = System16Init(); - - if (!nRet) { - memset(System16Rom, 0, 0x400000); - - // Load and Decrypt BIOS - UINT16 *pTemp = (UINT16*)BurnMalloc(0x20000); - memset(pTemp, 0, 0x20000); - UINT16 *Rom = (UINT16*)System16Rom; - - nRet = BurnLoadRom(System16Rom, 0x80, 1); if (nRet) return 1; - - for (UINT32 i = 0; i < 0x10000; i++) { - pTemp[i ^ 0x4127] = BITSWAP16(Rom[i], 6, 14, 4, 2, 12, 10, 8, 0, 1, 9, 11, 13, 3, 5, 7, 15); - } - - memcpy(Rom, pTemp, 0x20000); - BurnFree(pTemp); - - // Load program ROM - nRet = BurnLoadRom(System16Rom + 0x100000, 0, 1); if (nRet) return 1; - - System16TempGfx = (UINT8*)BurnMalloc(System16TileRomSize); - memset(System16TempGfx, 0, System16TileRomSize); - memset(System16Tiles, 0, System16NumTiles * 8 * 8); - memset(System16Sprites, 0, System16TileRomSize); - - System16UPD7759Data = (UINT8*)(System16Z80Rom + 0x10000); - } - - System16ClockSpeed = 16000000; - - return nRet; -} - -static INT32 ShinfzInit() -{ - INT32 nRet = IsgsmInit(); - - if (!nRet) { - nCartSize = 0x200000; - UINT16 *pTemp = (UINT16*)BurnMalloc(0x200000); - memset(pTemp, 0, 0x200000); - UINT16 *Rom = (UINT16*)(System16Rom + 0x100000); - - for (UINT32 i = 0; i < 0x100000; i++) { - pTemp[i ^ 0x68956] = BITSWAP16(Rom[i], 8, 4, 12, 3, 6, 7, 1, 0, 15, 11, 5, 14, 10, 2, 9, 13); - } - - memcpy(Rom, pTemp, 0x200000); - BurnFree(pTemp); - - IsgsmReadXor = 0x66; - IsgsmSecurityCallback = ShinfzSecurity; - } - - return nRet; -} - -static INT32 TetrbxInit() -{ - INT32 nRet = IsgsmInit(); - - if (!nRet) { - nCartSize = 0x80000; - UINT16 *pTemp = (UINT16*)BurnMalloc(nCartSize); - memset(pTemp, 0, nCartSize); - UINT16 *Rom = (UINT16*)(System16Rom + 0x100000); - - for (UINT32 i = 0; i < nCartSize >> 1; i++) { - pTemp[i ^ 0x2a6e6] = BITSWAP16(Rom[i], 4, 0, 12, 5, 7, 3, 1, 14, 10, 11, 9, 6, 15, 2, 13, 8); - } - - memcpy(Rom, pTemp, nCartSize); - BurnFree(pTemp); - - IsgsmReadXor = 0x73; - IsgsmSecurityCallback = TetrbxSecurity; - } - - return nRet; -} - -static INT32 IsgsmExit() -{ - INT32 nRet = System16Exit(); - - BurnFree(System16TempGfx); - - IsgsmCartAddrLatch = 0; - IsgsmCartAddr = 0; - IsgsmType = 0; - IsgsmAddr = 0; - IsgsmMode = 0; - IsgsmAddrLatch = 0; - IsgsmSecurity = 0; - IsgsmSecurityLatch = 0; - IsgsmRleControlPosition = 0; - IsgsmRleControlByte = 0; - IsgsmRleLatched = 0; - IsgsmRleByte = 0; - IsgsmReadXor = 0; - nCartSize = 0; - IsgsmSecurityCallback = NULL; - GameRomMapped = 0; - - return nRet; -} - -static INT32 IsgsmScan(INT32 nAction,INT32 *pnMin) -{ - if (pnMin != NULL) { - *pnMin = 0x029719; - } - - struct BurnArea ba; - - if (nAction & ACB_DRIVER_DATA) { - memset(&ba, 0, sizeof(ba)); - ba.Data = System16Sprites; - ba.nLen = System16SpriteRomSize - 1; - ba.nAddress = 0; - ba.szName = "SpriteROM"; - BurnAcb(&ba); - - memset(&ba, 0, sizeof(ba)); - ba.Data = System16TempGfx; - ba.nLen = System16TileRomSize - 1; - ba.nAddress = 0; - ba.szName = "TileROM"; - BurnAcb(&ba); - - memset(&ba, 0, sizeof(ba)); - ba.Data = System16Z80Rom; - ba.nLen = 0x3ffff; - ba.nAddress = 0; - ba.szName = "Z80ROM"; - BurnAcb(&ba); - - memset(&ba, 0, sizeof(ba)); - ba.Data = System16Rom + 0x300000; - ba.nLen = 0xfffff; - ba.nAddress = 0; - ba.szName = "GameROM"; - BurnAcb(&ba); - - SCAN_VAR(IsgsmCartAddrLatch); - SCAN_VAR(IsgsmCartAddr); - SCAN_VAR(IsgsmType); - SCAN_VAR(IsgsmAddr); - SCAN_VAR(IsgsmMode); - SCAN_VAR(IsgsmAddrLatch); - SCAN_VAR(IsgsmSecurity); - SCAN_VAR(IsgsmSecurityLatch); - SCAN_VAR(IsgsmRleControlPosition); - SCAN_VAR(IsgsmRleControlByte); - SCAN_VAR(IsgsmRleLatched); - SCAN_VAR(IsgsmRleByte); - SCAN_VAR(GameRomMapped); - - if (nAction & ACB_WRITE) { - if (GameRomMapped) { - SekOpen(0); - SekMapMemory(System16Rom + 0x300000, 0x000000, 0x0fffff, SM_ROM); - SekClose(); - } - - for (UINT32 i = 0; i < System16TileRomSize; i++) { - GfxDecodeSingle((i & 0x1ffff) / 8, 3, 8, 8, IsgsmTilePlaneOffsets, IsgsmTileXOffsets, IsgsmTileYOffsets, 0x40, System16TempGfx, System16Tiles); - } - } - } - - return System16Scan(nAction, pnMin); -} - -struct BurnDriver BurnDrvIsgsm = { - "isgsm", NULL, NULL, NULL, "2006", - "ISG Selection Master Type 2006 System BIOS\0", "BIOS only", "ISG", "ISG Selection Master Type 2006", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_BOARDROM, 0, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_ISGSM | HARDWARE_SEGA_5521, GBF_BIOS, 0, - NULL, IsgsmRomInfo, IsgsmRomName, NULL, NULL, System16bDip3InputInfo, NULL, - IsgsmInit, IsgsmExit, System16BFrame, NULL, IsgsmScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvShinfz = { - "shinfz", NULL, "isgsm", NULL, "2006", - "Shinobi / FZ-2006 (Korean System 16 bootleg) (ISG Selection Master Type 2006)\0", NULL, "ISG", "ISG Selection Master Type 2006", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_ISGSM | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, - NULL, ShinfzRomInfo, ShinfzRomName, NULL, NULL, System16bDip3InputInfo, ShinfzDIPInfo, - ShinfzInit, IsgsmExit, System16BFrame, NULL, IsgsmScan, - NULL, 0x1800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTetrbx = { - "tetrbx", NULL, "isgsm", NULL, "2006", - "Tetris / Bloxeed (Korean System 16 bootleg) (ISG Selection Master Type 2006)\0", NULL, "ISG", "ISG Selection Master Type 2006", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_ISGSM | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, - NULL, TetrbxRomInfo, TetrbxRomName, NULL, NULL, System16bDip3InputInfo, TetrbxDIPInfo, - TetrbxInit, IsgsmExit, System16BFrame, NULL, IsgsmScan, - NULL, 0x1800, 320, 224, 4, 3 -}; +#include "sys16.h" + +/*==================================================== +Input defs +====================================================*/ + +#define A(a, b, c, d) {a, b, (UINT8*)(c), d} + +static struct BurnInputInfo System16bInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 2" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(System16b) + +static struct BurnInputInfo System16bfire1InputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(System16bfire1) + +static struct BurnInputInfo System16bfire3InputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 3" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(System16bfire3) + +static struct BurnInputInfo System16bfire4InputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , System16InputPort1 + 3, "p1 fire 4" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , System16InputPort2 + 3, "p2 fire 4" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(System16bfire4) + +static struct BurnInputInfo System16bDip3InputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 2" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH, System16Dip + 2 , "dip" }, +}; + +STDINPUTINFO(System16bDip3) + +static struct BurnInputInfo AtomicpInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort1 + 7, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 7, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort1 + 6, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Atomicp) + +static struct BurnInputInfo BulletInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + {"Coin 3" , BIT_DIGITAL , System16InputPort0 + 7, "p3 coin" }, + {"Start 3" , BIT_DIGITAL , System16InputPort0 + 6, "p3 start" }, + + {"P1 Up 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 up" }, + {"P1 Down 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 down" }, + {"P1 Left 1" , BIT_DIGITAL , System16InputPort1 + 3, "p1 left" }, + {"P1 Right 1" , BIT_DIGITAL , System16InputPort1 + 2, "p1 right" }, + {"P1 Up 2" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up 2" }, + {"P1 Down 2" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down 2" }, + {"P1 Left 2" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left 2" }, + {"P1 Right 2" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right 2"}, + + {"P2 Up 1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 up" }, + {"P2 Down 1" , BIT_DIGITAL , System16InputPort2 + 0, "p2 down" }, + {"P2 Left 1" , BIT_DIGITAL , System16InputPort2 + 3, "p2 left" }, + {"P2 Right 1" , BIT_DIGITAL , System16InputPort2 + 2, "p2 right" }, + {"P2 Up 2" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up 2" }, + {"P2 Down 2" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down 2" }, + {"P2 Left 2" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left 2" }, + {"P2 Right 2" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right 2"}, + + {"P3 Up 1" , BIT_DIGITAL , System16InputPort3 + 1, "p3 up" }, + {"P3 Down 1" , BIT_DIGITAL , System16InputPort3 + 0, "p3 down" }, + {"P3 Left 1" , BIT_DIGITAL , System16InputPort3 + 3, "p3 left" }, + {"P3 Right 1" , BIT_DIGITAL , System16InputPort3 + 2, "p3 right" }, + {"P3 Up 2" , BIT_DIGITAL , System16InputPort3 + 5, "p3 up 2" }, + {"P3 Down 2" , BIT_DIGITAL , System16InputPort3 + 4, "p3 down 2" }, + {"P3 Left 2" , BIT_DIGITAL , System16InputPort3 + 7, "p3 left 2" }, + {"P3 Right 2" , BIT_DIGITAL , System16InputPort3 + 6, "p3 right 2"}, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Bullet) + +static struct BurnInputInfo DunkshotInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + {"Start 3" , BIT_DIGITAL , System16InputPort0 + 6, "p3 start" }, + {"Start 4" , BIT_DIGITAL , System16InputPort0 + 7, "p4 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort2 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort2 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort2 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort2 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 6, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 7, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 4, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 5, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort1 + 2, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort1 + 3, "p2 fire 2" }, + + {"P3 Up" , BIT_DIGITAL , System16InputPort3 + 2, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , System16InputPort3 + 3, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , System16InputPort3 + 0, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , System16InputPort3 + 1, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , System16InputPort1 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , System16InputPort1 + 5, "p3 fire 2" }, + + {"P4 Up" , BIT_DIGITAL , System16InputPort3 + 6, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , System16InputPort3 + 7, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , System16InputPort3 + 4, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , System16InputPort3 + 5, "p4 right" }, + {"P4 Fire 1" , BIT_DIGITAL , System16InputPort1 + 6, "p4 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , System16InputPort1 + 7, "p4 fire 2" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Dunkshot) + +static struct BurnInputInfo ExctleagInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort4 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort4 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort4 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort4 + 1, "p1 right" }, + {"P1 Bant0" , BIT_DIGITAL , System16InputPort1 + 0, "p1 fire 1" }, + {"P1 Bant1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 2" }, + {"P1 Bant2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 3" }, + {"P1 Swing0" , BIT_DIGITAL , System16InputPort1 + 3, "p1 fire 4" }, + {"P1 Swing1" , BIT_DIGITAL , System16InputPort1 + 4, "p1 fire 5" }, + {"P1 Low" , BIT_DIGITAL , System16InputPort1 + 5, "p1 fire 6" }, + {"P1 Mid" , BIT_DIGITAL , System16InputPort1 + 6, "p1 fire 7" }, + {"P1 Hi" , BIT_DIGITAL , System16InputPort1 + 7, "p1 fire 8" }, + {"P1 Change" , BIT_DIGITAL , System16InputPort3 + 1, "p1 fire 9" }, + {"P1 Select" , BIT_DIGITAL , System16InputPort3 + 2, "p1 fire 10" }, + {"P1 Chase" , BIT_DIGITAL , System16InputPort3 + 0, "p1 fire 11" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort4 + 6, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort4 + 7, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort4 + 4, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort4 + 5, "p2 right" }, + {"P2 Bant0" , BIT_DIGITAL , System16InputPort2 + 0, "p2 fire 1" }, + {"P2 Bant1" , BIT_DIGITAL , System16InputPort2 + 1, "p2 fire 2" }, + {"P2 Bant2" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 3" }, + {"P2 Swing0" , BIT_DIGITAL , System16InputPort2 + 3, "p2 fire 4" }, + {"P2 Swing1" , BIT_DIGITAL , System16InputPort2 + 4, "p2 fire 5" }, + {"P2 Low" , BIT_DIGITAL , System16InputPort2 + 5, "p2 fire 6" }, + {"P2 Mid" , BIT_DIGITAL , System16InputPort2 + 6, "p2 fire 7" }, + {"P2 Hi" , BIT_DIGITAL , System16InputPort2 + 7, "p2 fire 8" }, + {"P2 Change" , BIT_DIGITAL , System16InputPort3 + 5, "p2 fire 9" }, + {"P2 Select" , BIT_DIGITAL , System16InputPort3 + 6, "p2 fire 10" }, + {"P2 Chase" , BIT_DIGITAL , System16InputPort3 + 4, "p2 fire 11" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Exctleag) + +static struct BurnInputInfo FpointblInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 1" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 2, "p2 fire 1" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Fpointbl) + +static struct BurnInputInfo HwchampInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + A("Left/Right" , BIT_ANALOG_REL, &System16AnalogPort0, "p1 x-axis" ), + A("Left" , BIT_ANALOG_REL, &System16AnalogPort1, "p1 fire 1" ), + A("Right" , BIT_ANALOG_REL, &System16AnalogPort2, "p1 fire 2" ), + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Hwchamp) + +static struct BurnInputInfo PassshtInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + {"Start 3" , BIT_DIGITAL , System16InputPort0 + 6, "p3 start" }, + {"Start 4" , BIT_DIGITAL , System16InputPort0 + 7, "p4 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 1, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 0, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 3, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 2, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , System16InputPort1 + 6, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , System16InputPort1 + 7, "p1 fire 4" }, + + {"P2 Up" , BIT_DIGITAL , System16InputPort2 + 1, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort2 + 0, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort2 + 3, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort2 + 2, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , System16InputPort2 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , System16InputPort2 + 6, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , System16InputPort2 + 7, "p2 fire 4" }, + + {"P3 Up" , BIT_DIGITAL , System16InputPort3 + 1, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , System16InputPort3 + 0, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , System16InputPort3 + 3, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , System16InputPort3 + 2, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , System16InputPort3 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , System16InputPort3 + 5, "p3 fire 2" }, + {"P3 Fire 3" , BIT_DIGITAL , System16InputPort3 + 6, "p3 fire 3" }, + {"P3 Fire 4" , BIT_DIGITAL , System16InputPort3 + 7, "p3 fire 4" }, + + {"P4 Up" , BIT_DIGITAL , System16InputPort4 + 1, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , System16InputPort4 + 0, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , System16InputPort4 + 3, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , System16InputPort4 + 2, "p4 right" }, + {"P4 Fire 1" , BIT_DIGITAL , System16InputPort4 + 4, "p4 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , System16InputPort4 + 5, "p4 fire 2" }, + {"P4 Fire 3" , BIT_DIGITAL , System16InputPort4 + 6, "p4 fire 3" }, + {"P4 Fire 4" , BIT_DIGITAL , System16InputPort4 + 7, "p4 fire 4" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Passsht) + +static struct BurnInputInfo RyukyuInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort1 + 2, "p1 fire 2" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Ryukyu) + +static struct BurnInputInfo SdiInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , System16InputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort1 + 1, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort1 + 0, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort1 + 3, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort1 + 2, "p1 right" }, + A("Target Left/Right", BIT_ANALOG_REL, &System16AnalogPort0, "mouse x-axis" ), + A("Target Up/Down" , BIT_ANALOG_REL, &System16AnalogPort1, "mouse y-axis" ), + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort0 + 6, "mouse button 1"}, + + {"P2 Up" , BIT_DIGITAL , System16InputPort1 + 5, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , System16InputPort1 + 4, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , System16InputPort1 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , System16InputPort1 + 6, "p2 right" }, + A("Target Left/Right", BIT_ANALOG_REL, &System16AnalogPort2, "p2 x-axis" ), + A("Target Up/Down" , BIT_ANALOG_REL, &System16AnalogPort3, "p2 y-axis" ), + {"P2 Fire 1" , BIT_DIGITAL , System16InputPort0 + 7, "p2 fire 1" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Sdi) + +static struct BurnInputInfo SjryukoInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort0 + 0, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , System16InputPort0 + 1, "p2 coin" }, + + {"Mahjong A" , BIT_DIGITAL , System16InputPort1 + 0, "mah a" }, + {"Mahjong B" , BIT_DIGITAL , System16InputPort1 + 1, "mah b" }, + {"Mahjong C" , BIT_DIGITAL , System16InputPort1 + 2, "mah c" }, + {"Mahjong D" , BIT_DIGITAL , System16InputPort1 + 3, "mah d" }, + {"Mahjong E" , BIT_DIGITAL , System16InputPort2 + 0, "mah e" }, + {"Mahjong F" , BIT_DIGITAL , System16InputPort2 + 1, "mah f" }, + {"Mahjong G" , BIT_DIGITAL , System16InputPort2 + 2, "mah g" }, + {"Mahjong H" , BIT_DIGITAL , System16InputPort2 + 3, "mah h" }, + {"Mahjong I" , BIT_DIGITAL , System16InputPort3 + 0, "mah i" }, + {"Mahjong J" , BIT_DIGITAL , System16InputPort3 + 1, "mah j" }, + {"Mahjong K" , BIT_DIGITAL , System16InputPort3 + 2, "mah k" }, + {"Mahjong L" , BIT_DIGITAL , System16InputPort3 + 3, "mah l" }, + {"Mahjong M" , BIT_DIGITAL , System16InputPort4 + 0, "mah m" }, + {"Mahjong N" , BIT_DIGITAL , System16InputPort4 + 1, "mah n" }, + {"Mahjong Kan" , BIT_DIGITAL , System16InputPort6 + 0, "mah kan" }, + {"Mahjong Pon" , BIT_DIGITAL , System16InputPort4 + 3, "mah pon" }, + {"Mahjong Chi" , BIT_DIGITAL , System16InputPort4 + 2, "mah chi" }, + {"Mahjong Reach" , BIT_DIGITAL , System16InputPort6 + 1, "mah reach" }, + {"Mahjong Ron" , BIT_DIGITAL , System16InputPort6 + 2, "mah ron" }, + {"Mahjong Bet" , BIT_DIGITAL , System16InputPort5 + 1, "mah bet" }, + {"Mahjong Last Chance", BIT_DIGITAL , System16InputPort1 + 4, "mah lc" }, + {"Mahjong Score" , BIT_DIGITAL , System16InputPort5 + 0, "mah score" }, + {"Mahjong Flip Flop" , BIT_DIGITAL , System16InputPort4 + 4, "mah ff" }, + + {"Service" , BIT_DIGITAL , System16InputPort0 + 3 , "service" }, + {"Diagnostics" , BIT_DIGITAL , System16InputPort0 + 2 , "diag" }, + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Sjryuko) + +static struct BurnInputInfo SnapperInputList[] = { + {"Coin 1" , BIT_DIGITAL , System16InputPort1 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , System16InputPort1 + 1, "p1 start" }, + + {"P1 Up" , BIT_DIGITAL , System16InputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , System16InputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , System16InputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , System16InputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , System16InputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , System16InputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , System16InputPort0 + 6, "p1 fire 3" }, + + {"Reset" , BIT_DIGITAL , &System16Reset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH, System16Dip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, System16Dip + 1 , "dip" }, +}; + +STDINPUTINFO(Snapper) + +#undef A + +/*==================================================== +Dip defs +====================================================*/ + +#define SYSTEM16B_COINAGE(dipval) \ + {0 , 0xfe, 0 , 16 , "Coin A" }, \ + {dipval, 0x01, 0x0f, 0x07, "4 Coins 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x08, "3 Coins 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x09, "2 Coins 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x05, "2 Coins 1 Credit 5/3 6/4" }, \ + {dipval, 0x01, 0x0f, 0x04, "2 Coins 1 Credit 4/3" }, \ + {dipval, 0x01, 0x0f, 0x0f, "1 Coin 1 Credit" }, \ + {dipval, 0x01, 0x0f, 0x01, "1 Coin 1 Credit 2/3" }, \ + {dipval, 0x01, 0x0f, 0x02, "1 Coin 1 Credit 4/5" }, \ + {dipval, 0x01, 0x0f, 0x03, "1 Coin 1 Credit 5/6" }, \ + {dipval, 0x01, 0x0f, 0x06, "2 Coins 3 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" }, \ + {dipval, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" }, \ + {dipval, 0x01, 0x0f, 0x00, "Free Play (if coin B too) or 1C/1C" }, \ + \ + {0 , 0xfe, 0 , 16 , "Coin B" }, \ + {dipval, 0x01, 0xf0, 0x70, "4 Coins 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x80, "3 Coins 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x90, "2 Coins 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x50, "2 Coins 1 Credit 5/3 6/4" }, \ + {dipval, 0x01, 0xf0, 0x40, "2 Coins 1 Credit 4/3" }, \ + {dipval, 0x01, 0xf0, 0xf0, "1 Coin 1 Credit" }, \ + {dipval, 0x01, 0xf0, 0x10, "1 Coin 1 Credit 2/3" }, \ + {dipval, 0x01, 0xf0, 0x20, "1 Coin 1 Credit 4/5" }, \ + {dipval, 0x01, 0xf0, 0x30, "1 Coin 1 Credit 5/6" }, \ + {dipval, 0x01, 0xf0, 0x60, "2 Coins 3 Credits" }, \ + {dipval, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" }, \ + {dipval, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" }, \ + {dipval, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" }, \ + {dipval, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" }, \ + {dipval, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" }, \ + {dipval, 0x01, 0xf0, 0x00, "Free Play (if coin A too) or 1C/1C" }, + +static struct BurnDIPInfo AliensynDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfd, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x0c, 0x08, "2" }, + {0x11, 0x01, 0x0c, 0x0c, "3" }, + {0x11, 0x01, 0x0c, 0x04, "4" }, + {0x11, 0x01, 0x0c, 0x00, "127" }, + + {0 , 0xfe, 0 , 4 , "Timer" }, + {0x11, 0x01, 0x30, 0x00, "120" }, + {0x11, 0x01, 0x30, 0x10, "130" }, + {0x11, 0x01, 0x30, 0x20, "140" }, + {0x11, 0x01, 0x30, 0x30, "150" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0xc0, 0x80, "Easy" }, + {0x11, 0x01, 0xc0, 0xc0, "Normal" }, + {0x11, 0x01, 0xc0, 0x40, "Hard" }, + {0x11, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x12) +}; + +STDDIPINFO(Aliensyn) + +static struct BurnDIPInfo AliensynjDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfd, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0x0c, 0x08, "2" }, + {0x11, 0x01, 0x0c, 0x0c, "3" }, + {0x11, 0x01, 0x0c, 0x04, "4" }, + {0x11, 0x01, 0x0c, 0x00, "127" }, + + {0 , 0xfe, 0 , 4 , "Timer" }, + {0x11, 0x01, 0x30, 0x00, "150" }, + {0x11, 0x01, 0x30, 0x10, "160" }, + {0x11, 0x01, 0x30, 0x20, "170" }, + {0x11, 0x01, 0x30, 0x30, "180" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0xc0, 0x80, "Easy" }, + {0x11, 0x01, 0xc0, 0xc0, "Normal" }, + {0x11, 0x01, 0xc0, 0x40, "Hard" }, + {0x11, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x12) +}; + +STDDIPINFO(Aliensynj) + +static struct BurnDIPInfo AltbeastDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfd, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Credits needed" }, + {0x15, 0x01, 0x01, 0x01, "1 to start, 1 to continue" }, + {0x15, 0x01, 0x01, 0x00, "2 to start, 1 to continue" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x0c, 0x08, "2" }, + {0x15, 0x01, 0x0c, 0x0c, "3" }, + {0x15, 0x01, 0x0c, 0x04, "4" }, + {0x15, 0x01, 0x0c, 0x00, "240" }, + + {0 , 0xfe, 0 , 4 , "Energy Meter" }, + {0x15, 0x01, 0x30, 0x20, "2" }, + {0x15, 0x01, 0x30, 0x30, "3" }, + {0x15, 0x01, 0x30, 0x10, "4" }, + {0x15, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0xc0, 0x80, "Easy" }, + {0x15, 0x01, 0xc0, 0xc0, "Normal" }, + {0x15, 0x01, 0xc0, 0x40, "Hard" }, + {0x15, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x16) +}; + +STDDIPINFO(Altbeast) + +static struct BurnDIPInfo AtomicpDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0x2f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x11, 0x01, 0x38, 0x00, "4 Coins 1 Credit" }, + {0x11, 0x01, 0x38, 0x20, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x38, 0x18, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x38, 0x38, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x38, 0x10, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x38, 0x28, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x38, 0x08, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x38, 0x30, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 8 , "Coin B" }, + {0x11, 0x01, 0x07, 0x00, "4 Coins 1 Credit" }, + {0x11, 0x01, 0x07, 0x04, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x07, 0x03, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x07, 0x02, "1 Coin 2 Credits" }, + {0x11, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x11, 0x01, 0x07, 0x01, "1 Coin 4 Credits" }, + {0x11, 0x01, 0x07, 0x06, "1 Coin 5 Credits" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x11, 0x01, 0xc0, 0xc0, "1" }, + {0x11, 0x01, 0xc0, 0x80, "2" }, + {0x11, 0x01, 0xc0, 0x40, "3" }, + {0x11, 0x01, 0xc0, 0x00, "5" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x03, 0x01, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Normal" }, + {0x12, 0x01, 0x03, 0x02, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Level Select" }, + {0x12, 0x01, 0x04, 0x04, "Off" }, + {0x12, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x12, 0x01, 0x10, 0x10, "Off" }, + {0x12, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x12, 0x01, 0x20, 0x00, "Off" }, + {0x12, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Game Mode" }, + {0x12, 0x01, 0x40, 0x40, "Normal Tetris" }, + {0x12, 0x01, 0x40, 0x00, "Atomic Point" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x12, 0x01, 0x80, 0x00, "Off" }, + {0x12, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Atomicp) + +static struct BurnDIPInfo AurailDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfd, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x15, 0x01, 0x01, 0x01, "Upright" }, + {0x15, 0x01, 0x01, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x0c, 0x00, "2" }, + {0x15, 0x01, 0x0c, 0x0c, "3" }, + {0x15, 0x01, 0x0c, 0x08, "4" }, + {0x15, 0x01, 0x0c, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x15, 0x01, 0x10, 0x10, "80k, 200k, 500k, 1000k" }, + {0x15, 0x01, 0x10, 0x00, "100k, 300k, 700k, 1000k" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x15, 0x01, 0x20, 0x20, "Normal" }, + {0x15, 0x01, 0x20, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Controller Select" }, + {0x15, 0x01, 0x40, 0x40, "1 Player Side" }, + {0x15, 0x01, 0x40, 0x00, "2 Players Side" }, + + {0 , 0xfe, 0 , 2 , "Special Function Mode" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x16) +}; + +STDDIPINFO(Aurail) + +static struct BurnDIPInfo BayrouteDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfd, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x01, 0x00, "Off" }, + {0x15, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x0c, 0x04, "1" }, + {0x15, 0x01, 0x0c, 0x0c, "3" }, + {0x15, 0x01, 0x0c, 0x08, "5" }, + {0x15, 0x01, 0x0c, 0x00, "Unlimited" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x15, 0x01, 0x30, 0x30, "100000" }, + {0x15, 0x01, 0x30, 0x20, "150000" }, + {0x15, 0x01, 0x30, 0x10, "200000" }, + {0x15, 0x01, 0x30, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0xc0, 0xc0, "Easy" }, + {0x15, 0x01, 0xc0, 0x80, "Normal" }, + {0x15, 0x01, 0xc0, 0x40, "Hard" }, + {0x15, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x16) +}; + +STDDIPINFO(Bayroute) + +static struct BurnDIPInfo Blox16bDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfe, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, +}; + +STDDIPINFO(Blox16b) + +static struct BurnDIPInfo BulletDIPList[]= +{ + // Default Values + {0x21, 0xff, 0xff, 0xff, NULL }, + {0x22, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + + // Dip 2 + SYSTEM16B_COINAGE(0x22) +}; + +STDDIPINFO(Bullet) + +static struct BurnDIPInfo CottonDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x06, 0x04, "2" }, + {0x13, 0x01, 0x06, 0x06, "3" }, + {0x13, 0x01, 0x06, 0x02, "4" }, + {0x13, 0x01, 0x06, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x18, 0x10, "Easy" }, + {0x13, 0x01, 0x18, 0x18, "Normal" }, + {0x13, 0x01, 0x18, 0x08, "Hard" }, + {0x13, 0x01, 0x18, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x14) +}; + +STDDIPINFO(Cotton) + +static struct BurnDIPInfo DduxDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0x06, 0x04, "Easy" }, + {0x13, 0x01, 0x06, 0x06, "Normal" }, + {0x13, 0x01, 0x06, 0x02, "Hard" }, + {0x13, 0x01, 0x06, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x18, 0x10, "2" }, + {0x13, 0x01, 0x18, 0x18, "3" }, + {0x13, 0x01, 0x18, 0x08, "4" }, + {0x13, 0x01, 0x18, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x60, 0x40, "150000" }, + {0x13, 0x01, 0x60, 0x60, "200000" }, + {0x13, 0x01, 0x60, 0x20, "300000" }, + {0x13, 0x01, 0x60, 0x00, "400000" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x14) +}; + +STDDIPINFO(Ddux) + +static struct BurnDIPInfo DunkshotDIPList[]= +{ + // Default Values + {0x21, 0xff, 0xff, 0xfd, NULL }, + {0x22, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x21, 0x01, 0x02, 0x02, "Off" }, + {0x21, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "VS Time" }, + {0x21, 0x01, 0x0c, 0x08, "2P 1:30 | 3P 2:00 | 4P 2:30" }, + {0x21, 0x01, 0x0c, 0x0c, "2P 2:00 | 3P 2:30 | 4P 3:00" }, + {0x21, 0x01, 0x0c, 0x04, "2P 2:30 | 3P 3:00 | 4P 3:30" }, + {0x21, 0x01, 0x0c, 0x00, "2P 3:00 | 3P 3:30 | 4P 4:00" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x21, 0x01, 0x30, 0x20, "Easy" }, + {0x21, 0x01, 0x30, 0x30, "Normal" }, + {0x21, 0x01, 0x30, 0x10, "Hard" }, + {0x21, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "CPU starts with +6 pts" }, + {0x21, 0x01, 0x40, 0x40, "Off" }, + {0x21, 0x01, 0x40, 0x00, "On" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x22) +}; + +STDDIPINFO(Dunkshot) + +static struct BurnDIPInfo EswatDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfd, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "2 Credits to Start" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Time" }, + {0x15, 0x01, 0x08, 0x08, "Normal" }, + {0x15, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x30, 0x20, "Easy" }, + {0x15, 0x01, 0x30, 0x30, "Normal" }, + {0x15, 0x01, 0x30, 0x10, "Hard" }, + {0x15, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0xc0, 0x00, "1" }, + {0x15, 0x01, 0xc0, 0x40, "2" }, + {0x15, 0x01, 0xc0, 0xc0, "3" }, + {0x15, 0x01, 0xc0, 0x80, "4" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x16) +}; + +STDDIPINFO(Eswat) + +static struct BurnDIPInfo ExctleagDIPList[]= +{ + // Default Values + {0x25, 0xff, 0xff, 0xfe, NULL }, + {0x26, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x25, 0x01, 0x01, 0x01, "Off" }, + {0x25, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Starting Points" }, + {0x25, 0x01, 0x0e, 0x06, "2000" }, + {0x25, 0x01, 0x0e, 0x0a, "3000" }, + {0x25, 0x01, 0x0e, 0x0c, "4000" }, + {0x25, 0x01, 0x0e, 0x0e, "5000" }, + {0x25, 0x01, 0x0e, 0x08, "6000" }, + {0x25, 0x01, 0x0e, 0x04, "7000" }, + {0x25, 0x01, 0x0e, 0x02, "8000" }, + {0x25, 0x01, 0x0e, 0x00, "9000" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x25, 0x01, 0x30, 0x20, "Easy" }, + {0x25, 0x01, 0x30, 0x30, "Normal" }, + {0x25, 0x01, 0x30, 0x10, "Hard" }, + {0x25, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Point Table" }, + {0x25, 0x01, 0xc0, 0x80, "Easy" }, + {0x25, 0x01, 0xc0, 0xc0, "Normal" }, + {0x25, 0x01, 0xc0, 0x40, "Hard" }, + {0x25, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 1 + SYSTEM16B_COINAGE(0x26) +}; + +STDDIPINFO(Exctleag) + +static struct BurnDIPInfo Fantzn2xDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x0c, 0x08, "2" }, + {0x13, 0x01, 0x0c, 0x0c, "3" }, + {0x13, 0x01, 0x0c, 0x04, "4" }, + {0x13, 0x01, 0x0c, 0x00, "240" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0xc0, 0x80, "Easy" }, + {0x13, 0x01, 0xc0, 0xc0, "Normal" }, + {0x13, 0x01, 0xc0, 0x40, "Hard" }, + {0x13, 0x01, 0xc0, 0x00, "Hardest" }, +}; + +STDDIPINFO(Fantzn2x) + +static struct BurnDIPInfo FpointDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfd, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x30, 0x20, "Easy" }, + {0x11, 0x01, 0x30, 0x30, "Normal" }, + {0x11, 0x01, 0x30, 0x10, "Hard" }, + {0x11, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Clear Round Allowed" }, + {0x11, 0x01, 0x40, 0x00, "1" }, + {0x11, 0x01, 0x40, 0x40, "2" }, + + {0 , 0xfe, 0 , 2 , "Cell Move" }, + {0x11, 0x01, 0x80, 0x00, "Off" }, + {0x11, 0x01, 0x80, 0x80, "On" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x12) +}; + +STDDIPINFO(Fpoint) + +static struct BurnDIPInfo GoldnaxeDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfd, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Credits needed" }, + {0x15, 0x01, 0x01, 0x01, "1 to start, 1 to continue" }, + {0x15, 0x01, 0x01, 0x00, "2 to start, 1 to continue" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x0c, 0x08, "1" }, + {0x15, 0x01, 0x0c, 0x0c, "2" }, + {0x15, 0x01, 0x0c, 0x04, "3" }, + {0x15, 0x01, 0x0c, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Energy Meter" }, + {0x15, 0x01, 0x30, 0x20, "2" }, + {0x15, 0x01, 0x30, 0x30, "3" }, + {0x15, 0x01, 0x30, 0x10, "4" }, + {0x15, 0x01, 0x30, 0x00, "5" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x16) +}; + +STDDIPINFO(Goldnaxe) + +static struct BurnDIPInfo HwchampDIPList[]= +{ + // Default Values + {0x0a, 0xff, 0xff, 0xf9, NULL }, + {0x0b, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0a, 0x01, 0x02, 0x02, "Off" }, + {0x0a, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Start Level Select" }, + {0x0a, 0x01, 0x04, 0x04, "Off" }, + {0x0a, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0a, 0x01, 0x08, 0x08, "Off" }, + {0x0a, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0a, 0x01, 0x30, 0x20, "Easy" }, + {0x0a, 0x01, 0x30, 0x30, "Normal" }, + {0x0a, 0x01, 0x30, 0x10, "Hard" }, + {0x0a, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Time Adjust" }, + {0x0a, 0x01, 0xc0, 0x80, "Easy" }, + {0x0a, 0x01, 0xc0, 0xc0, "Normal" }, + {0x0a, 0x01, 0xc0, 0x40, "Hard" }, + {0x0a, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x0b) +}; + +STDDIPINFO(Hwchamp) + +static struct BurnDIPInfo MvpDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfd, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Credits Needed" }, + {0x15, 0x01, 0x01, 0x01, "1 to start, 1 to continue" }, + {0x15, 0x01, 0x01, 0x00, "2 to start, 1 to continue" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Innings" }, + {0x15, 0x01, 0x04, 0x04, "1 Credit 1 Inning Only" }, + {0x15, 0x01, 0x04, 0x0c, "+2 Credits 3 Innings" }, + + {0 , 0xfe, 0 , 8 , "Time Limits" }, + {0x15, 0x01, 0x38, 0x18, "Easy" }, + {0x15, 0x01, 0x38, 0x28, "Easy 2" }, + {0x15, 0x01, 0x38, 0x08, "Easy 3" }, + {0x15, 0x01, 0x38, 0x38, "Normal" }, + {0x15, 0x01, 0x38, 0x30, "Hard" }, + {0x15, 0x01, 0x38, 0x10, "Hard 2" }, + {0x15, 0x01, 0x38, 0x20, "Hard 3" }, + {0x15, 0x01, 0x38, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0xc0, 0x80, "Easy" }, + {0x15, 0x01, 0xc0, 0x40, "Easy 2" }, + {0x15, 0x01, 0xc0, 0xc0, "Normal" }, + {0x15, 0x01, 0xc0, 0x30, "Hard" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x16) +}; + +STDDIPINFO(Mvp) + +static struct BurnDIPInfo PassshtDIPList[]= +{ + // Default Values + {0x17, 0xff, 0xff, 0xf0, NULL }, + {0x18, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x17, 0x01, 0x01, 0x01, "Off" }, + {0x17, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Initial Point" }, + {0x17, 0x01, 0x0e, 0x06, "2000" }, + {0x17, 0x01, 0x0e, 0x0a, "3000" }, + {0x17, 0x01, 0x0e, 0x0c, "4000" }, + {0x17, 0x01, 0x0e, 0x0e, "5000" }, + {0x17, 0x01, 0x0e, 0x08, "6000" }, + {0x17, 0x01, 0x0e, 0x04, "7000" }, + {0x17, 0x01, 0x0e, 0x02, "8000" }, + {0x17, 0x01, 0x0e, 0x00, "9000" }, + + {0 , 0xfe, 0 , 4 , "Point Table" }, + {0x17, 0x01, 0x30, 0x20, "Easy" }, + {0x17, 0x01, 0x30, 0x30, "Normal" }, + {0x17, 0x01, 0x30, 0x10, "Hard" }, + {0x17, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x17, 0x01, 0xc0, 0x80, "Easy" }, + {0x17, 0x01, 0xc0, 0xc0, "Normal" }, + {0x17, 0x01, 0xc0, 0x40, "Hard" }, + {0x17, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x18) +}; + +STDDIPINFO(Passsht) + + +static struct BurnDIPInfo PassshtaDIPList[]= +{ + // Default Values + {0x29, 0xff, 0xff, 0xf0, NULL }, + {0x2a, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x29, 0x01, 0x01, 0x01, "Off" }, + {0x29, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 8 , "Initial Point" }, + {0x29, 0x01, 0x0e, 0x06, "2000" }, + {0x29, 0x01, 0x0e, 0x0a, "3000" }, + {0x29, 0x01, 0x0e, 0x0c, "4000" }, + {0x29, 0x01, 0x0e, 0x0e, "5000" }, + {0x29, 0x01, 0x0e, 0x08, "6000" }, + {0x29, 0x01, 0x0e, 0x04, "7000" }, + {0x29, 0x01, 0x0e, 0x02, "8000" }, + {0x29, 0x01, 0x0e, 0x00, "9000" }, + + {0 , 0xfe, 0 , 4 , "Point Table" }, + {0x29, 0x01, 0x30, 0x20, "Easy" }, + {0x29, 0x01, 0x30, 0x30, "Normal" }, + {0x29, 0x01, 0x30, 0x10, "Hard" }, + {0x29, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x29, 0x01, 0xc0, 0x80, "Easy" }, + {0x29, 0x01, 0xc0, 0xc0, "Normal" }, + {0x29, 0x01, 0xc0, 0x40, "Hard" }, + {0x29, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x2a) +}; + +STDDIPINFO(Passshta) + +static struct BurnDIPInfo RiotcityDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfd, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "2 Credits to Start" }, + {0x13, 0x01, 0x01, 0x01, "Off" }, + {0x13, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x0c, 0x00, "1" }, + {0x13, 0x01, 0x0c, 0x0c, "2" }, + {0x13, 0x01, 0x0c, 0x08, "3" }, + {0x13, 0x01, 0x0c, 0x04, "4" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x30, 0x20, "Easy" }, + {0x13, 0x01, 0x30, 0x30, "Normal" }, + {0x13, 0x01, 0x30, 0x10, "Hard" }, + {0x13, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x13, 0x01, 0x40, 0x40, "Normal" }, + {0x13, 0x01, 0x40, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Attack button to start" }, + {0x13, 0x01, 0x80, 0x80, "Off" }, + {0x13, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x14) +}; + +STDDIPINFO(Riotcity) + +static struct BurnDIPInfo RyukyuDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0xf8, NULL }, + {0x0e, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x01, 0x01, "Off" }, + {0x0d, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Cancel per credit" }, + {0x0d, 0x01, 0x02, 0x00, "2" }, + {0x0d, 0x01, 0x02, 0x02, "3" }, + + {0 , 0xfe, 0 , 2 , "Timer Speed" }, + {0x0d, 0x01, 0x04, 0x04, "20 seconds" }, + {0x0d, 0x01, 0x04, 0x00, "30 seconds" }, + + {0 , 0xfe, 0 , 2 , "PCM Voice" }, + {0x0d, 0x01, 0x08, 0x00, "Off" }, + {0x0d, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Omikuji Difficulty" }, + {0x0d, 0x01, 0x30, 0x20, "Easy" }, + {0x0d, 0x01, 0x30, 0x30, "Normal" }, + {0x0d, 0x01, 0x30, 0x10, "Hard" }, + {0x0d, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0d, 0x01, 0xc0, 0x80, "Easy" }, + {0x0d, 0x01, 0xc0, 0xc0, "Normal" }, + {0x0d, 0x01, 0xc0, 0x40, "Hard" }, + {0x0d, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x0e) +}; + +STDDIPINFO(Ryukyu) + +static struct BurnDIPInfo SdibDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfd, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x01, 0x01, "No" }, + {0x15, 0x01, 0x01, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x0c, 0x08, "2" }, + {0x15, 0x01, 0x0c, 0x0c, "3" }, + {0x15, 0x01, 0x0c, 0x04, "4" }, + {0x15, 0x01, 0x0c, 0x00, "Free" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x30, 0x20, "Easy" }, + {0x15, 0x01, 0x30, 0x30, "Normal" }, + {0x15, 0x01, 0x30, 0x10, "Hard" }, + {0x15, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x15, 0x01, 0xc0, 0x80, "Every 50000" }, + {0x15, 0x01, 0xc0, 0xc0, "50000" }, + {0x15, 0x01, 0xc0, 0x40, "100000" }, + {0x15, 0x01, 0xc0, 0x00, "None" }, + + // Dip 1 + SYSTEM16B_COINAGE(0x16) +}; + +STDDIPINFO(Sdib) + +static struct BurnDIPInfo ShinobiDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfc, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x15, 0x01, 0x01, 0x00, "Upright" }, + {0x15, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x0c, 0x08, "2" }, + {0x15, 0x01, 0x0c, 0x0c, "3" }, + {0x15, 0x01, 0x0c, 0x04, "5" }, + {0x15, 0x01, 0x0c, 0x00, "240" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x30, 0x20, "Easy" }, + {0x15, 0x01, 0x30, 0x30, "Normal" }, + {0x15, 0x01, 0x30, 0x10, "Hard" }, + {0x15, 0x01, 0x30, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Enemy Bullet Speed" }, + {0x15, 0x01, 0x40, 0x40, "Slow" }, + {0x15, 0x01, 0x40, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x15, 0x01, 0x80, 0x80, "Japanese" }, + {0x15, 0x01, 0x80, 0x00, "English" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x16) +}; + +STDDIPINFO(Shinobi) + +static struct BurnDIPInfo SonicbomDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0x7f, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x13, 0x01, 0x07, 0x06, "Easy" }, + {0x13, 0x01, 0x07, 0x07, "Normal" }, + {0x13, 0x01, 0x07, 0x05, "Hard 1" }, + {0x13, 0x01, 0x07, 0x04, "Hard 2" }, + {0x13, 0x01, 0x07, 0x03, "Hard 3" }, + {0x13, 0x01, 0x07, 0x02, "Hard 4" }, + {0x13, 0x01, 0x07, 0x01, "Hard 5" }, + {0x13, 0x01, 0x07, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x18, 0x10, "2" }, + {0x13, 0x01, 0x18, 0x18, "3" }, + {0x13, 0x01, 0x18, 0x08, "4" }, + {0x13, 0x01, 0x18, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x13, 0x01, 0x60, 0x40, "30000" }, + {0x13, 0x01, 0x60, 0x60, "40000" }, + {0x13, 0x01, 0x60, 0x20, "50000" }, + {0x13, 0x01, 0x60, 0x00, "60000" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x80, 0x00, "Upright" }, + {0x13, 0x01, 0x80, 0x80, "Cocktail" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x14) +}; + +STDDIPINFO(Sonicbom) + +static struct BurnDIPInfo SjryukoDIPList[]= +{ + // Default Values + {0x1c, 0xff, 0xff, 0xff, NULL }, + {0x1d, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + + + // Dip 2 + SYSTEM16B_COINAGE(0x1d) +}; + +STDDIPINFO(Sjryuko) + +static struct BurnDIPInfo SnapperDIPList[]= +{ + // Default Values + {0x0a, 0xff, 0xff, 0xff, NULL }, + {0x0b, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 8 , "Coin A" }, + {0x0a, 0x01, 0x07, 0x07, "1 Coin 1 Credit" }, + {0x0a, 0x01, 0x07, 0x06, "1 Coin 2 Credits" }, + {0x0a, 0x01, 0x07, 0x05, "1 Coin 3 Credits" }, + {0x0a, 0x01, 0x07, 0x04, "1 Coin 4 Credits" }, + {0x0a, 0x01, 0x07, 0x03, "1 Coin 5 Credits" }, + {0x0a, 0x01, 0x07, 0x02, "2 Coins 1 Credit" }, + {0x0a, 0x01, 0x07, 0x01, "3 Coins 1 Credit" }, + {0x0a, 0x01, 0x07, 0x00, "4 Coins 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0a, 0x01, 0x18, 0x10, "3" }, + {0x0a, 0x01, 0x18, 0x18, "4" }, + {0x0a, 0x01, 0x18, 0x08, "5" }, + {0x0a, 0x01, 0x18, 0x00, "6" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x10, 0x00, "Off" }, + {0x0b, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x80, 0x80, "Off" }, + {0x0b, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Snapper) + +static struct BurnDIPInfo TetrisDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfd, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x30, 0x20, "Easy" }, + {0x11, 0x01, 0x30, 0x30, "Normal" }, + {0x11, 0x01, 0x30, 0x10, "Hard" }, + {0x11, 0x01, 0x30, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x12) +}; + +STDDIPINFO(Tetris) + +static struct BurnDIPInfo TimescanDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xf5, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Cocktail" }, + {0x13, 0x01, 0x01, 0x01, "Upright" }, + + {0 , 0xfe, 0 , 16 , "Bonus" }, + {0x13, 0x01, 0x1e, 0x16, "Replay 1000000/2000000" }, + {0x13, 0x01, 0x1e, 0x14, "Replay 1200000/2500000" }, + {0x13, 0x01, 0x1e, 0x12, "Replay 1500000/3000000" }, + {0x13, 0x01, 0x1e, 0x10, "Replay 2000000/4000000" }, + {0x13, 0x01, 0x1e, 0x1c, "Replay 1000000" }, + {0x13, 0x01, 0x1e, 0x1e, "Replay 1200000" }, + {0x13, 0x01, 0x1e, 0x1a, "Replay 1500000" }, + {0x13, 0x01, 0x1e, 0x18, "Replay 1800000" }, + {0x13, 0x01, 0x1e, 0x0e, "Extra Ball 100000" }, + {0x13, 0x01, 0x1e, 0x0c, "Extra Ball 200000" }, + {0x13, 0x01, 0x1e, 0x0a, "Extra Ball 300000" }, + {0x13, 0x01, 0x1e, 0x08, "Extra Ball 400000" }, + {0x13, 0x01, 0x1e, 0x06, "Extra Ball 500000" }, + {0x13, 0x01, 0x1e, 0x04, "Extra Ball 600000" }, + {0x13, 0x01, 0x1e, 0x02, "Extra Ball 700000" }, + {0x13, 0x01, 0x1e, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Match" }, + {0x13, 0x01, 0x20, 0x00, "Off" }, + {0x13, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2 , "Pin Rebound" }, + {0x13, 0x01, 0x40, 0x40, "Well" }, + {0x13, 0x01, 0x40, 0x00, "A Little" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x13, 0x01, 0x80, 0x80, "3" }, + {0x13, 0x01, 0x80, 0x00, "5" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x14) + + // Dip 3 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Out Lane Pin" }, + {0x15, 0x01, 0x02, 0x02, "Near" }, + {0x15, 0x01, 0x02, 0x00, "Far" }, + + {0 , 0xfe, 0 , 4 , "Special" }, + {0x15, 0x01, 0x0c, 0x08, "7 Credits" }, + {0x15, 0x01, 0x0c, 0x0c, "3 Credits" }, + {0x15, 0x01, 0x0c, 0x04, "1 Credit" }, + {0x15, 0x01, 0x0c, 0x00, "2000000 Points" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x10, 0x00, "No" }, + {0x15, 0x01, 0x10, 0x10, "Yes" }, +}; + +STDDIPINFO(Timescan) + +static struct BurnDIPInfo ToryumonDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfe, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x01, 0x01, "Off" }, + {0x11, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "VS-Mode Battle" }, + {0x11, 0x01, 0x10, 0x10, "1" }, + {0x11, 0x01, 0x10, 0x00, "3" }, + + {0 , 0xfe, 0 , 8 , "Difficulty" }, + {0x11, 0x01, 0xe0, 0xc0, "Easy" }, + {0x11, 0x01, 0xe0, 0xe0, "Normal" }, + {0x11, 0x01, 0xe0, 0xa0, "Hard" }, + {0x11, 0x01, 0xe0, 0x80, "Hard+1" }, + {0x11, 0x01, 0xe0, 0x60, "Hard+2" }, + {0x11, 0x01, 0xe0, 0x40, "Hard+3" }, + {0x11, 0x01, 0xe0, 0x20, "Hard+4" }, + {0x11, 0x01, 0xe0, 0x00, "Hard+5" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x12) +}; + +STDDIPINFO(Toryumon) + +static struct BurnDIPInfo TturfDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0x2c, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Continues" }, + {0x15, 0x01, 0x03, 0x00, "None" }, + {0x15, 0x01, 0x03, 0x01, "3" }, + {0x15, 0x01, 0x03, 0x02, "Unlimited" }, + {0x15, 0x01, 0x03, 0x03, "Unlimited" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x0c, 0x08, "Easy" }, + {0x15, 0x01, 0x0c, 0x0c, "Normal" }, + {0x15, 0x01, 0x0c, 0x04, "Hard" }, + {0x15, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Starting Energy" }, + {0x15, 0x01, 0x30, 0x00, "3" }, + {0x15, 0x01, 0x30, 0x10, "4" }, + {0x15, 0x01, 0x30, 0x20, "6" }, + {0x15, 0x01, 0x30, 0x30, "8" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x40, 0x40, "Off" }, + {0x15, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Bonus Energy" }, + {0x15, 0x01, 0x80, 0x80, "1" }, + {0x15, 0x01, 0x80, 0x00, "2" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x16) +}; + +STDDIPINFO(Tturf) + +static struct BurnDIPInfo Wb3DIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfd, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x0c, 0x00, "2" }, + {0x13, 0x01, 0x0c, 0x0c, "3" }, + {0x13, 0x01, 0x0c, 0x08, "4" }, + {0x13, 0x01, 0x0c, 0x04, "5" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x13, 0x01, 0x10, 0x10, "5k, 10k, 18k, 30k" }, + {0x13, 0x01, 0x10, 0x00, "5k, 15k, 30k" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x13, 0x01, 0x20, 0x20, "Normal" }, + {0x13, 0x01, 0x20, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Invincible Mode" }, + {0x13, 0x01, 0x40, 0x40, "No" }, + {0x13, 0x01, 0x40, 0x00, "Yes" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x14) +}; + +STDDIPINFO(Wb3) + +static struct BurnDIPInfo WrestwarDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfd, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Round Time" }, + {0x13, 0x01, 0x0c, 0x00, "100" }, + {0x13, 0x01, 0x0c, 0x0c, "110" }, + {0x13, 0x01, 0x0c, 0x08, "120" }, + {0x13, 0x01, 0x0c, 0x04, "130" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x13, 0x01, 0x20, 0x00, "No" }, + {0x13, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x13, 0x01, 0xc0, 0x80, "Easy" }, + {0x13, 0x01, 0xc0, 0xc0, "Normal" }, + {0x13, 0x01, 0xc0, 0x40, "Hard" }, + {0x13, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 2 + SYSTEM16B_COINAGE(0x14) +}; + +STDDIPINFO(Wrestwar) + +#undef SYSTEM16B_COINAGE + +/*==================================================== +Rom defs +====================================================*/ + +static struct BurnRomInfo AceattacRomDesc[] = { + { "epr-11491.a4", 0x10000, 0xf3c19c36, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11489.a1", 0x10000, 0xbbe623c5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11492.a5", 0x10000, 0xd8bd3139, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11490.a2", 0x10000, 0x38cb3a41, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11493.b9", 0x10000, 0x654485d9, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11494.b10", 0x10000, 0xb67971ab, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11495.b11", 0x10000, 0xb687ab61, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11501.b1", 0x10000, 0x09179ead, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11505.b5", 0x10000, 0xb67f1ecf, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11502.b2", 0x10000, 0xa3ee36b8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11506.b6", 0x10000, 0xb0104def, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11503.b3", 0x10000, 0x344c0692, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11507.b7", 0x10000, 0xa2af710a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11504.b4", 0x10000, 0x7cae7920, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11508.b8", 0x10000, 0x5cbb833c, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11496.a7", 0x08000, 0x82cb40a9, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11497.a8", 0x08000, 0xb04f62cc, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11498.a9", 0x08000, 0x97baf52b, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11499.a10", 0x08000, 0xea332866, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11500.a11", 0x08000, 0x2ddf1c31, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0059.key", 0x02000, 0x00000000, SYS16_ROM_KEY | BRF_ESS | BRF_PRG | BRF_NODUMP }, +}; + + +STD_ROM_PICK(Aceattac) +STD_ROM_FN(Aceattac) + +static struct BurnRomInfo AliensynRomDesc[] = { + { "epr-11083.a4", 0x08000, 0xcb2ad9b3, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11080.a1", 0x08000, 0xfe7378d9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11084.a5", 0x08000, 0x2e1ec7b1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11081.a2", 0x08000, 0x1308ee63, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11085.a6", 0x08000, 0xcff78f39, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11082.a3", 0x08000, 0x9cdc2a14, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10702.b9", 0x10000, 0x393bc813, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10703.b10", 0x10000, 0x6b6dd9f5, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10704.b11", 0x10000, 0x911e7ebc, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10709.b1", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10713.b5", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10710.b2", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10714.b6", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10711.b3", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10715.b7", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10712.b4", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10716.b8", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10723.a7", 0x08000, 0x99953526, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-10724.a8", 0x08000, 0xf971a817, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-10725.a9", 0x08000, 0x6a50e08f, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-10726.a10", 0x08000, 0xd50b7736, SYS16_ROM_UPD7759DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Aliensyn) +STD_ROM_FN(Aliensyn) + +static struct BurnRomInfo Aliensyn3RomDesc[] = { + { "epr-10816.a4", 0x08000, 0x17bf5304, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10814.a1", 0x08000, 0x4cd134df, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10817.a5", 0x08000, 0xc8b791b0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10815.a2", 0x08000, 0xbdcf4a30, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10822a.a6", 0x08000, 0x1d0790aa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10819a.a3", 0x08000, 0x1e7586b7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10702.b9", 0x10000, 0x393bc813, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10703.b10", 0x10000, 0x6b6dd9f5, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10704.b11", 0x10000, 0x911e7ebc, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10709.b1", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10713.b5", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10710.b2", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10714.b6", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10711.b3", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10715.b7", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10712.b4", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10716.b8", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10723.a7", 0x08000, 0x99953526, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-10724.a8", 0x08000, 0xf971a817, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-10725.a9", 0x08000, 0x6a50e08f, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-10726.a10", 0x08000, 0xd50b7736, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0033.key", 0x02000, 0x49e882e5, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Aliensyn3) +STD_ROM_FN(Aliensyn3) + +static struct BurnRomInfo AliensynjRomDesc[] = { + { "epr-10720a.a4", 0x08000, 0x1b920893, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10717a.a1", 0x08000, 0x972ae358, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10721a.a5", 0x08000, 0xf4d2d1c3, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10718a.a2", 0x08000, 0xc79bf61b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10722a.a6", 0x08000, 0x1d0790aa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10719a.a3", 0x08000, 0x1e7586b7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10702.b9", 0x10000, 0x393bc813, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10703.b10", 0x10000, 0x6b6dd9f5, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10704.b11", 0x10000, 0x911e7ebc, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10709.b1", 0x10000, 0xaddf0a90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10713.b5", 0x10000, 0xececde3a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10710.b2", 0x10000, 0x992369eb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10714.b6", 0x10000, 0x91bf42fb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10711.b3", 0x10000, 0x29166ef6, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10715.b7", 0x10000, 0xa7c57384, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10712.b4", 0x10000, 0x876ad019, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10716.b8", 0x10000, 0x40ba1d48, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10723.a7", 0x08000, 0x99953526, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-10724.a8", 0x08000, 0xf971a817, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-10725.a9", 0x08000, 0x6a50e08f, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-10726.a10", 0x08000, 0xd50b7736, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0033.key", 0x02000, 0x49e882e5, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Aliensynj) +STD_ROM_FN(Aliensynj) + +static struct BurnRomInfo AltbeastRomDesc[] = { + { "epr-11907.a7", 0x20000, 0x29e0c3ad, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11906.a5", 0x20000, 0x4c9e9cd8, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-11674.a14", 0x20000, 0xa57a66d5, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11675.a15", 0x20000, 0x2ef2f144, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11676.a16", 0x20000, 0x0c04acac, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11677.b1", 0x20000, 0xa01425cd, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11681.b5", 0x20000, 0xd9e03363, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11678.b2", 0x20000, 0x17a9fc53, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11682.b6", 0x20000, 0xe3f77c5e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11679.b3", 0x20000, 0x14dcc245, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11683.b7", 0x20000, 0xf9a60f06, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11680.b4", 0x20000, 0xf43dcdec, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11684.b8", 0x20000, 0xb20c0edb, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11671.a10", 0x08000, 0x2b71343b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0078.mcu", 0x01000, 0x00000000, BRF_NODUMP }, +}; + + +STD_ROM_PICK(Altbeast) +STD_ROM_FN(Altbeast) + +static struct BurnRomInfo AltbeastjRomDesc[] = { + { "epr-11885.a7", 0x20000, 0x5bb715aa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11884.a5", 0x20000, 0xe1707090, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11722.a14", 0x10000, 0xadaa8db5, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11736.b14", 0x10000, 0xe9ad5e89, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11723.a15", 0x10000, 0x131a3f9a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11737.b15", 0x10000, 0x2e420023, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11724.a16", 0x10000, 0x6f2ed50a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11738.b16", 0x10000, 0xde3d6d02, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11725.b1", 0x10000, 0xf8b3684e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11729.b5", 0x10000, 0xae3c2793, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11726.b2", 0x10000, 0x3cce5419, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11730.b6", 0x10000, 0x3af62b55, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11727.b3", 0x10000, 0xb0390078, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11731.b7", 0x10000, 0x2a87744a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11728.b4", 0x10000, 0xf3a43fd8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11732.b8", 0x10000, 0x2fb3e355, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11717.a1", 0x10000, 0x676be0cb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11733.b10", 0x10000, 0x802cac94, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11718.a2", 0x10000, 0x882864c2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11734.b11", 0x10000, 0x76c704d2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11719.a3", 0x10000, 0x339987f7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11735.b12", 0x10000, 0x4fe406aa, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11671.a10", 0x08000, 0x2b71343b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0077.mcu", 0x01000, 0x00000000, BRF_NODUMP }, +}; + + +STD_ROM_PICK(Altbeastj) +STD_ROM_FN(Altbeastj) + +static struct BurnRomInfo Altbeast2RomDesc[] = { + { "epr-11705.a7", 0x20000, 0x57dc5c7a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11704.a5", 0x20000, 0x33bbcf07, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-11674.a14", 0x20000, 0xa57a66d5, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11675.a15", 0x20000, 0x2ef2f144, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11676.a16", 0x20000, 0x0c04acac, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11677.b1", 0x20000, 0xa01425cd, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11681.b5", 0x20000, 0xd9e03363, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11678.b2", 0x20000, 0x17a9fc53, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11682.b6", 0x20000, 0xe3f77c5e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11679.b3", 0x20000, 0x14dcc245, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11683.b7", 0x20000, 0xf9a60f06, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11680.b4", 0x20000, 0xf43dcdec, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11684.b8", 0x20000, 0xb20c0edb, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11686.a10", 0x08000, 0x828a45b3, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0066.key", 0x02000, 0xed85a054, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Altbeast2) +STD_ROM_FN(Altbeast2) + +static struct BurnRomInfo Altbeastj3RomDesc[] = { + { "epr-11721.a7", 0x20000, 0x1c5d11de, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11720.a5", 0x20000, 0x735350cf, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11722.a14", 0x10000, 0xadaa8db5, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11736.b14", 0x10000, 0xe9ad5e89, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11723.a15", 0x10000, 0x131a3f9a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11737.b15", 0x10000, 0x2e420023, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11724.a16", 0x10000, 0x6f2ed50a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11738.b16", 0x10000, 0xde3d6d02, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11725.b1", 0x10000, 0xf8b3684e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11729.b5", 0x10000, 0xae3c2793, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11726.b2", 0x10000, 0x3cce5419, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11730.b6", 0x10000, 0x3af62b55, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11727.b3", 0x10000, 0xb0390078, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11731.b7", 0x10000, 0x2a87744a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11728.b4", 0x10000, 0xf3a43fd8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11732.b8", 0x10000, 0x2fb3e355, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11717.a1", 0x10000, 0x676be0cb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11733.b10", 0x10000, 0x802cac94, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11718.a2", 0x10000, 0x882864c2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11734.b11", 0x10000, 0x76c704d2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11719.a3", 0x10000, 0x339987f7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11735.b12", 0x10000, 0x4fe406aa, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11671.a10", 0x08000, 0x2b71343b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0068.key", 0x02000, 0xc1ed4310, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Altbeastj3) +STD_ROM_FN(Altbeastj3) + +static struct BurnRomInfo Altbeast4RomDesc[] = { + { "epr-11740.a7", 0x20000, 0xce227542, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11739.a5", 0x20000, 0xe466eb65, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11722.a14", 0x10000, 0xadaa8db5, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11736.b14", 0x10000, 0xe9ad5e89, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11723.a15", 0x10000, 0x131a3f9a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11737.b15", 0x10000, 0x2e420023, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11724.a16", 0x10000, 0x6f2ed50a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11738.b16", 0x10000, 0xde3d6d02, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11725.b1", 0x10000, 0xf8b3684e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11729.b5", 0x10000, 0xae3c2793, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11726.b2", 0x10000, 0x3cce5419, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11730.b6", 0x10000, 0x3af62b55, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11727.b3", 0x10000, 0xb0390078, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11731.b7", 0x10000, 0x2a87744a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11728.b4", 0x10000, 0xf3a43fd8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11732.b8", 0x10000, 0x2fb3e355, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11717.a1", 0x10000, 0x676be0cb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11733.b10", 0x10000, 0x802cac94, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11718.a2", 0x10000, 0x882864c2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11734.b11", 0x10000, 0x76c704d2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11719.a3", 0x10000, 0x339987f7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11735.b12", 0x10000, 0x4fe406aa, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11686.a10", 0x08000, 0x828a45b3, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0066.key", 0x02000, 0xed85a054, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Altbeast4) +STD_ROM_FN(Altbeast4) + +static struct BurnRomInfo Altbeast5RomDesc[] = { + { "epr-11742.a7", 0x20000, 0x61839534, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11741.a5", 0x20000, 0x9b2159cb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11722.a14", 0x10000, 0xadaa8db5, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11736.b14", 0x10000, 0xe9ad5e89, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11723.a15", 0x10000, 0x131a3f9a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11737.b15", 0x10000, 0x2e420023, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11724.a16", 0x10000, 0x6f2ed50a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11738.b16", 0x10000, 0xde3d6d02, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11725.b1", 0x10000, 0xf8b3684e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11729.b5", 0x10000, 0xae3c2793, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11726.b2", 0x10000, 0x3cce5419, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11730.b6", 0x10000, 0x3af62b55, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11727.b3", 0x10000, 0xb0390078, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11731.b7", 0x10000, 0x2a87744a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11728.b4", 0x10000, 0xf3a43fd8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11732.b8", 0x10000, 0x2fb3e355, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11717.a1", 0x10000, 0x676be0cb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11733.b10", 0x10000, 0x802cac94, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11718.a2", 0x10000, 0x882864c2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11734.b11", 0x10000, 0x76c704d2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11719.a3", 0x10000, 0x339987f7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11735.b12", 0x10000, 0x4fe406aa, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11671.a10", 0x08000, 0x2b71343b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0069.key", 0x02000, 0x959e256a, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Altbeast5) +STD_ROM_FN(Altbeast5) + +static struct BurnRomInfo Altbeast6RomDesc[] = { + { "epr-11883.a7", 0x20000, 0xc5b3e8f7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11882.a5", 0x20000, 0x9c01170b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11722.a14", 0x10000, 0xadaa8db5, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11736.b14", 0x10000, 0xe9ad5e89, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11723.a15", 0x10000, 0x131a3f9a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11737.b15", 0x10000, 0x2e420023, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11724.a16", 0x10000, 0x6f2ed50a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11738.b16", 0x10000, 0xde3d6d02, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11725.b1", 0x10000, 0xf8b3684e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11729.b5", 0x10000, 0xae3c2793, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11726.b2", 0x10000, 0x3cce5419, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11730.b6", 0x10000, 0x3af62b55, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11727.b3", 0x10000, 0xb0390078, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11731.b7", 0x10000, 0x2a87744a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11728.b4", 0x10000, 0xf3a43fd8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11732.b8", 0x10000, 0x2fb3e355, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11717.a1", 0x10000, 0x676be0cb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11733.b10", 0x10000, 0x802cac94, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11718.a2", 0x10000, 0x882864c2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11734.b11", 0x10000, 0x76c704d2, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11719.a3", 0x10000, 0x339987f7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11735.b12", 0x10000, 0x4fe406aa, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11671.a10", 0x08000, 0x2b71343b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-11672.a11", 0x20000, 0xbbd7f460, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "opr-11673.a12", 0x20000, 0x400c4a36, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0076.mcu", 0x01000, 0x00000000, BRF_NODUMP }, +}; + + +STD_ROM_PICK(Altbeast6) +STD_ROM_FN(Altbeast6) + +static struct BurnRomInfo AtomicpRomDesc[] = { + { "ap-t2.bin", 0x10000, 0x97421047, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "ap-t1.bin", 0x10000, 0x5c65fe56, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "ap-t4.bin", 0x08000, 0x332e58f4, SYS16_ROM_TILES | BRF_GRA }, + { "ap-t3.bin", 0x08000, 0xdddc122c, SYS16_ROM_TILES | BRF_GRA }, + { "ap-t5.bin", 0x08000, 0xef5ecd6b, SYS16_ROM_TILES | BRF_GRA }, +}; + + +STD_ROM_PICK(Atomicp) +STD_ROM_FN(Atomicp) + +static struct BurnRomInfo AurailRomDesc[] = { + { "epr-13577.a7", 0x20000, 0x6701b686, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13576.a5", 0x20000, 0x1e428d94, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13447.a8", 0x20000, 0x70a52167, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13445.a6", 0x20000, 0x28dfc3dd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-13450.a14", 0x20000, 0x0fc4a7a8, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13465.b14", 0x20000, 0xe08135e0, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13451.a15", 0x20000, 0x1c49852f, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13466.b15", 0x20000, 0xe14c6684, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13452.a16", 0x20000, 0x047bde5e, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13467.b16", 0x20000, 0x6309fec4, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-13453.b1", 0x20000, 0x5fa0a9f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13457.b5", 0x20000, 0x0d1b54da, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13454.b2", 0x20000, 0x5f6b33b1, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13458.b6", 0x20000, 0xbad340c3, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13455.b3", 0x20000, 0x4e80520b, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13459.b7", 0x20000, 0x7e9165ac, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13456.b4", 0x20000, 0x5733c428, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13460.b8", 0x20000, 0x66b8f9b3, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13440.a1", 0x20000, 0x4f370b2b, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13461.b10", 0x20000, 0xf76014bf, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13441.a2", 0x20000, 0x37cf9cb4, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13462.b11", 0x20000, 0x1061e7da, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13442.a3", 0x20000, 0x049698ef, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13463.b12", 0x20000, 0x7dbcfbf1, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13443.a4", 0x20000, 0x77a8989e, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13464.b13", 0x20000, 0x551df422, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-13448.a10", 0x08000, 0xb5183fb9, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-13449.a11", 0x20000, 0xd3d9aaf9, SYS16_ROM_UPD7759DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Aurail) +STD_ROM_FN(Aurail) + +static struct BurnRomInfo Aurail1RomDesc[] = { + { "epr-13469.a7", 0x20000, 0xc628b69d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13468.a5", 0x20000, 0xce092218, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13447.a8", 0x20000, 0x70a52167, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13445.a6", 0x20000, 0x28dfc3dd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-13450.a14", 0x20000, 0x0fc4a7a8, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13465.b14", 0x20000, 0xe08135e0, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13451.a15", 0x20000, 0x1c49852f, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13466.b15", 0x20000, 0xe14c6684, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13452.a16", 0x20000, 0x047bde5e, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13467.b16", 0x20000, 0x6309fec4, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-13453.b1", 0x20000, 0x5fa0a9f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13457.b5", 0x20000, 0x0d1b54da, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13454.b2", 0x20000, 0x5f6b33b1, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13458.b6", 0x20000, 0xbad340c3, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13455.b3", 0x20000, 0x4e80520b, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13459.b7", 0x20000, 0x7e9165ac, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13456.b4", 0x20000, 0x5733c428, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13460.b8", 0x20000, 0x66b8f9b3, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13440.a1", 0x20000, 0x4f370b2b, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13461.b10", 0x20000, 0xf76014bf, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13441.a2", 0x20000, 0x37cf9cb4, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13462.b11", 0x20000, 0x1061e7da, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13442.a3", 0x20000, 0x049698ef, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13463.b12", 0x20000, 0x7dbcfbf1, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13443.a4", 0x20000, 0x77a8989e, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13464.b13", 0x20000, 0x551df422, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-13448.a10", 0x08000, 0xb5183fb9, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-13449.a11", 0x20000, 0xd3d9aaf9, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0168.key", 0x02000, 0xbc2d1792, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Aurail1) +STD_ROM_FN(Aurail1) + +static struct BurnRomInfo AurailjRomDesc[] = { + { "epr-13446.a7", 0x20000, 0xd1f57b2a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13444.a5", 0x20000, 0x7a2b045f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13447.a8", 0x20000, 0x70a52167, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13445.a6", 0x20000, 0x28dfc3dd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-13450.a14", 0x20000, 0x0fc4a7a8, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13465.b14", 0x20000, 0xe08135e0, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13451.a15", 0x20000, 0x1c49852f, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13466.b15", 0x20000, 0xe14c6684, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13452.a16", 0x20000, 0x047bde5e, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-13467.b16", 0x20000, 0x6309fec4, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-13453.b1", 0x20000, 0x5fa0a9f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13457.b5", 0x20000, 0x0d1b54da, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13454.b2", 0x20000, 0x5f6b33b1, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13458.b6", 0x20000, 0xbad340c3, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13455.b3", 0x20000, 0x4e80520b, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13459.b7", 0x20000, 0x7e9165ac, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13456.b4", 0x20000, 0x5733c428, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13460.b8", 0x20000, 0x66b8f9b3, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13440.a1", 0x20000, 0x4f370b2b, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13461.b10", 0x20000, 0xf76014bf, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13441.a2", 0x20000, 0x37cf9cb4, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13462.b11", 0x20000, 0x1061e7da, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13442.a3", 0x20000, 0x049698ef, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13463.b12", 0x20000, 0x7dbcfbf1, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13443.a4", 0x20000, 0x77a8989e, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-13464.b13", 0x20000, 0x551df422, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-13448.a10", 0x08000, 0xb5183fb9, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-13449.a11", 0x20000, 0xd3d9aaf9, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0167.key", 0x02000, 0xbc2d1792, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Aurailj) +STD_ROM_FN(Aurailj) + +static struct BurnRomInfo BayrouteRomDesc[] = { + { "epr-12517.a7", 0x20000, 0x436728a9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12516.a5", 0x20000, 0x4ff0353f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12458.a8", 0x20000, 0xe7c7476a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12456.a6", 0x20000, 0x25dc2eaf, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-12462.a14", 0x10000, 0xa19943b5, SYS16_ROM_TILES | BRF_GRA }, + { "opr-12463.a15", 0x10000, 0x62f8200d, SYS16_ROM_TILES | BRF_GRA }, + { "opr-12464.a16", 0x10000, 0xc8c59703, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12465.b1", 0x20000, 0x11d61b45, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12467.b5", 0x20000, 0xc3b4e4c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12466.b2", 0x20000, 0xa57f236f, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12468.b6", 0x20000, 0xd89c77de, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12459.a10", 0x08000, 0x3e1d29d0, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12460.a11", 0x20000, 0x0bae570d, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "mpr-12461.a12", 0x20000, 0xb03b8b46, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0116.key", 0x02000, 0x8778ee49, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Bayroute) +STD_ROM_FN(Bayroute) + +static struct BurnRomInfo BayroutejRomDesc[] = { + { "epr-12457.a7", 0x20000, 0xbc726255, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12455.a5", 0x20000, 0xb6a722eb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12458.a8", 0x20000, 0xe7c7476a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12456.a6", 0x20000, 0x25dc2eaf, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-12462.a14", 0x10000, 0xa19943b5, SYS16_ROM_TILES | BRF_GRA }, + { "opr-12463.a15", 0x10000, 0x62f8200d, SYS16_ROM_TILES | BRF_GRA }, + { "opr-12464.a16", 0x10000, 0xc8c59703, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12465.b1", 0x20000, 0x11d61b45, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12467.b5", 0x20000, 0xc3b4e4c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12466.b2", 0x20000, 0xa57f236f, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12468.b6", 0x20000, 0xd89c77de, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12459.a10", 0x08000, 0x3e1d29d0, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12460.a11", 0x20000, 0x0bae570d, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "mpr-12461.a12", 0x20000, 0xb03b8b46, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0115.key", 0x02000, 0x75a55614, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Bayroutej) +STD_ROM_FN(Bayroutej) + +static struct BurnRomInfo Bayroute1RomDesc[] = { + { "br.a4", 0x10000, 0x91c6424b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "br.a1", 0x10000, 0x76954bf3, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "br.a5", 0x10000, 0x9d6fd183, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "br.a2", 0x10000, 0x5ca1e3d2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "br.a6", 0x10000, 0xed97ad4c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "br.a3", 0x10000, 0x0d362905, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-12462.a14", 0x10000, 0xa19943b5, SYS16_ROM_TILES | BRF_GRA }, + { "opr-12463.a15", 0x10000, 0x62f8200d, SYS16_ROM_TILES | BRF_GRA }, + { "opr-12464.a16", 0x10000, 0xc8c59703, SYS16_ROM_TILES | BRF_GRA }, + + { "br_obj0o.b1", 0x10000, 0x098a5e82, SYS16_ROM_SPRITES | BRF_GRA }, + { "br_obj0e.b5", 0x10000, 0x85238af9, SYS16_ROM_SPRITES | BRF_GRA }, + { "br_obj1o.b2", 0x10000, 0xcc641da1, SYS16_ROM_SPRITES | BRF_GRA }, + { "br_obj1e.b6", 0x10000, 0xd3123315, SYS16_ROM_SPRITES | BRF_GRA }, + { "br_obj2o.b3", 0x10000, 0x84efac1f, SYS16_ROM_SPRITES | BRF_GRA }, + { "br_obj2e.b7", 0x10000, 0xb73b12cb, SYS16_ROM_SPRITES | BRF_GRA }, + { "br_obj3o.b4", 0x10000, 0xa2e238ac, SYS16_ROM_SPRITES | BRF_GRA }, + { "br.b8", 0x10000, 0xd8de78ff, SYS16_ROM_SPRITES | BRF_GRA }, + + { "sound.a7", 0x08000, 0x00000000, SYS16_ROM_Z80PROG | BRF_NODUMP | BRF_PRG }, + + { "sound.a8", 0x10000, 0x00000000, SYS16_ROM_UPD7759DATA | BRF_NODUMP | BRF_SND }, + { "sound.a9", 0x10000, 0x00000000, SYS16_ROM_UPD7759DATA | BRF_NODUMP | BRF_SND }, + { "sound.a10", 0x10000, 0x00000000, SYS16_ROM_UPD7759DATA | BRF_NODUMP | BRF_SND }, + { "sound.a11", 0x10000, 0x00000000, SYS16_ROM_UPD7759DATA | BRF_NODUMP | BRF_SND }, +}; + + +STD_ROM_PICK(Bayroute1) +STD_ROM_FN(Bayroute1) + +static struct BurnRomInfo Blox16bRomDesc[] = { + { "bs16b.p00", 0x040000, 0xfd1978b9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "bs16b.scr", 0x040000, 0x1de4e95b, SYS16_ROM_TILES | BRF_GRA }, + + { "bs16b.obj", 0x020000, 0x05076220, SYS16_ROM_SPRITES | BRF_GRA }, + + { "bs16b.snd", 0x018000, 0x930c7e7b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Blox16b) +STD_ROM_FN(Blox16b) + +static struct BurnRomInfo BulletRomDesc[] = { + { "epr-11010.a4", 0x08000, 0xdd9001de, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11007.a1", 0x08000, 0xd9e08110, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11011.a5", 0x08000, 0x7f446b9f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11008.a2", 0x08000, 0x34824d3b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11012.a6", 0x08000, 0x3992f159, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11009.a3", 0x08000, 0xdf199999, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10994.b9", 0x10000, 0x3035468a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10995.b10", 0x10000, 0x6b97aff1, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10996.b11", 0x10000, 0x501bddd6, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10999.b1", 0x10000, 0x119f0008, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11003.b5", 0x10000, 0x2f429089, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11000.b2", 0x10000, 0xf5482bbe, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11004.b6", 0x10000, 0x8c886df0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11001.b3", 0x10000, 0x65ea71e0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11005.b7", 0x10000, 0xea2f9d50, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11002.b4", 0x10000, 0x9e25042b, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11006.b8", 0x10000, 0x6b7384f2, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10997.a7", 0x08000, 0x5dd9cab5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-10998.a8", 0x08000, 0xf971a817, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0041.key", 0x02000, 0x4cd4861a, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Bullet) +STD_ROM_FN(Bullet) + +static struct BurnRomInfo CottonRomDesc[] = { + { "epr-13921a.a7", 0x20000, 0xf047a037, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13919a.a5", 0x20000, 0x651108b1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13922a.a8", 0x20000, 0x1ca248c5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13920a.a6", 0x20000, 0xfa3610f9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-13862.a14", 0x20000, 0xa47354b6, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13877.b14", 0x20000, 0xd38424b5, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13863.a15", 0x20000, 0x8c990026, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13878.b15", 0x20000, 0x21c15b8a, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13864.a16", 0x20000, 0xd2b175bf, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13879.b16", 0x20000, 0xb9d62531, SYS16_ROM_TILES | BRF_GRA }, + + { "opr-13865.b1", 0x20000, 0x7024f404, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13869.b5", 0x20000, 0xab4b3468, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13866.b2", 0x20000, 0x6169bba4, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13870.b6", 0x20000, 0x69b41ac3, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13867.b3", 0x20000, 0xb014f02d, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13871.b7", 0x20000, 0x0801cf02, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13868.b4", 0x20000, 0xe62a7cd6, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13872.b8", 0x20000, 0xf066f315, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13852.a1", 0x20000, 0x943aba8b, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13873.b10", 0x20000, 0x1bd145f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13853.a2", 0x20000, 0x7ea93200, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13874.b11", 0x20000, 0x4fd59bff, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13891.a3", 0x20000, 0xc6b3c414, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13894.b12", 0x20000, 0xe3d0bee2, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13855.a4", 0x20000, 0x856f3ee2, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13876.b13", 0x20000, 0x1c5ffad8, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-13892.a10", 0x08000, 0xfdfbe6ad, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-13893.a11", 0x20000, 0x384233df, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0181a.key", 0x02000, 0x5c419b36, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Cotton) +STD_ROM_FN(Cotton) + +static struct BurnRomInfo CottonuRomDesc[] = { + { "cotton.a7", 0x20000, 0xe7ef7d10, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "cotton.a5", 0x20000, 0xabe4f83e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "cotton.a8", 0x20000, 0xfc0f4401, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "cotton.a6", 0x20000, 0xf50f1ea2, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-13862.a14", 0x20000, 0xa47354b6, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13877.b14", 0x20000, 0xd38424b5, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13863.a15", 0x20000, 0x8c990026, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13878.b15", 0x20000, 0x21c15b8a, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13864.a16", 0x20000, 0xd2b175bf, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13879.b16", 0x20000, 0xb9d62531, SYS16_ROM_TILES | BRF_GRA }, + + { "opr-13865.b1", 0x20000, 0x7024f404, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13869.b5", 0x20000, 0xab4b3468, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13866.b2", 0x20000, 0x6169bba4, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13870.b6", 0x20000, 0x69b41ac3, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13867.b3", 0x20000, 0xb014f02d, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13871.b7", 0x20000, 0x0801cf02, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13868.b4", 0x20000, 0xe62a7cd6, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13872.b8", 0x20000, 0xf066f315, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13852.a1", 0x20000, 0x943aba8b, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13873.b10", 0x20000, 0x1bd145f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13853.a2", 0x20000, 0x7ea93200, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13874.b11", 0x20000, 0x4fd59bff, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13891.a3", 0x20000, 0xc6b3c414, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13894.b12", 0x20000, 0xe3d0bee2, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13855.a4", 0x20000, 0x856f3ee2, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13876.b13", 0x20000, 0x1c5ffad8, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-13892.a10", 0x08000, 0xfdfbe6ad, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-13893.a11", 0x20000, 0x384233df, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0180.key", 0x02000, 0xa236b915, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Cottonu) +STD_ROM_FN(Cottonu) + +static struct BurnRomInfo CottonjRomDesc[] = { + { "epr-13858a.a7", 0x20000, 0x276f42fe, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13856a.a5", 0x20000, 0x14e6b5e7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13859a.a8", 0x20000, 0x4703ef9d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13857a.a6", 0x20000, 0xde37e527, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-13862.a14", 0x20000, 0xa47354b6, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13877.b14", 0x20000, 0xd38424b5, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13863.a15", 0x20000, 0x8c990026, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13878.b15", 0x20000, 0x21c15b8a, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13864.a16", 0x20000, 0xd2b175bf, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13879.b16", 0x20000, 0xb9d62531, SYS16_ROM_TILES | BRF_GRA }, + + { "opr-13865.b1", 0x20000, 0x7024f404, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13869.b5", 0x20000, 0xab4b3468, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13866.b2", 0x20000, 0x6169bba4, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13870.b6", 0x20000, 0x69b41ac3, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13867.b3", 0x20000, 0xb014f02d, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13871.b7", 0x20000, 0x0801cf02, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13868.b4", 0x20000, 0xe62a7cd6, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13872.b8", 0x20000, 0xf066f315, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13852.a1", 0x20000, 0x943aba8b, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13873.b10", 0x20000, 0x1bd145f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13853.a2", 0x20000, 0x7ea93200, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13874.b11", 0x20000, 0x4fd59bff, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13854.a3", 0x20000, 0x1c942190, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13875.b12", 0x20000, 0x6a66868d, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13855.a4", 0x20000, 0x856f3ee2, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13876.b13", 0x20000, 0x1c5ffad8, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-13860.a10", 0x08000, 0x6a57b027, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-13061.a11", 0x20000, 0x4d21153f, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0179a.key", 0x02000, 0x488096d3, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Cottonj) +STD_ROM_FN(Cottonj) + +static struct BurnRomInfo DduxRomDesc[] = { + { "epr-11191.a7", 0x20000, 0x500e400a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11190.a5", 0x20000, 0x2a698308, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11915.a8", 0x20000, 0xd8ed3132, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11913.a6", 0x20000, 0x30c6cb92, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-11917.a14", 0x10000, 0x6f772190, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-11918.a15", 0x10000, 0xc731db95, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-11919.a16", 0x10000, 0x64d5a491, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-11920.b1", 0x20000, 0xe5d1e3cd, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11922.b5", 0x20000, 0x70b0c4dd, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11921.b2", 0x20000, 0x61d2358c, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11923.b6", 0x20000, 0xc9ffe47d, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11916.a10", 0x08000, 0x7ab541cf, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0096.key", 0x02000, 0x6fd7d26e, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Ddux) +STD_ROM_FN(Ddux) + +static struct BurnRomInfo Ddux1RomDesc[] = { + { "epr-12189.a7", 0x20000, 0x558e9b5d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12188.a5", 0x20000, 0x802a240f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11915.a8", 0x20000, 0xd8ed3132, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11913.a6", 0x20000, 0x30c6cb92, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-11917.a14", 0x10000, 0x6f772190, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-11918.a15", 0x10000, 0xc731db95, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-11919.a16", 0x10000, 0x64d5a491, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-11920.b1", 0x20000, 0xe5d1e3cd, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11922.b5", 0x20000, 0x70b0c4dd, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11921.b2", 0x20000, 0x61d2358c, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11923.b6", 0x20000, 0xc9ffe47d, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11916.a10", 0x08000, 0x7ab541cf, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0095.bin", 0x01000, 0x00000000, BRF_NODUMP }, +}; + + +STD_ROM_PICK(Ddux1) +STD_ROM_FN(Ddux1) + +static struct BurnRomInfo DduxblRomDesc[] = { + { "dduxb03.bin", 0x20000, 0xe7526012, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "dduxb05.bin", 0x20000, 0x459d1237, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "dduxb02.bin", 0x20000, 0xd8ed3132, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "dduxb04.bin", 0x20000, 0x30c6cb92, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "dduxb14.bin", 0x10000, 0x664bd135, SYS16_ROM_TILES | BRF_GRA }, + { "dduxb15.bin", 0x10000, 0xce0d2b30, SYS16_ROM_TILES | BRF_GRA }, + { "dduxb16.bin", 0x10000, 0x6de95434, SYS16_ROM_TILES | BRF_GRA }, + + { "dduxb10.bin", 0x10000, 0x0be3aee5, SYS16_ROM_SPRITES | BRF_GRA }, + { "dduxb06.bin", 0x10000, 0xb0079e99, SYS16_ROM_SPRITES | BRF_GRA }, + { "dduxb11.bin", 0x10000, 0xcfb2af18, SYS16_ROM_SPRITES | BRF_GRA }, + { "dduxb07.bin", 0x10000, 0x0217369c, SYS16_ROM_SPRITES | BRF_GRA }, + { "dduxb12.bin", 0x10000, 0x28ce9b15, SYS16_ROM_SPRITES | BRF_GRA }, + { "dduxb08.bin", 0x10000, 0x8844f336, SYS16_ROM_SPRITES | BRF_GRA }, + { "dduxb13.bin", 0x10000, 0xefe57759, SYS16_ROM_SPRITES | BRF_GRA }, + { "dduxb09.bin", 0x10000, 0x6b64f665, SYS16_ROM_SPRITES | BRF_GRA }, + + { "dduxb01.bin", 0x08000, 0x0dbef0d7, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Dduxbl) +STD_ROM_FN(Dduxbl) + +static struct BurnRomInfo DunkshotRomDesc[] = { + { "epr-10470.a4", 0x08000, 0x8c60761f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10467.a1", 0x08000, 0x29774114, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10471.a5", 0x08000, 0x22777314, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10468.a2", 0x08000, 0xe2d5f97a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10472.a6", 0x08000, 0x206027a6, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10469.a3", 0x08000, 0xaa442b81, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10485.b9", 0x08000, 0xf16dda29, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10486.b10", 0x08000, 0x311d973c, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10487.b11", 0x08000, 0xa8fb179f, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10477.b1", 0x08000, 0xf9d3b2cb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10481.b5", 0x08000, 0xfeb04bc9, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10478.b2", 0x08000, 0x5b5c5c92, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10482.b6", 0x08000, 0x5bc07618, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10479.b3", 0x08000, 0xe84190a0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10483.b7", 0x08000, 0x7cab4f9e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10480.b4", 0x08000, 0x5dffd9dd, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10484.b8", 0x08000, 0xbcb5fcc9, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10473.a7", 0x08000, 0x7f1f5a27, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-10474.a8", 0x08000, 0x419a656e, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-10475.a9", 0x08000, 0x17d55e85, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-10476.a10", 0x08000, 0xa6be0956, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0022.key", 0x02000, 0x4eedc66d, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Dunkshot) +STD_ROM_FN(Dunkshot) + +static struct BurnRomInfo EswatRomDesc[] = { + { "epr-12659.bin", 0x40000, 0xc5ab2db9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12658.bin", 0x40000, 0xaf40bd71, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12624.b11", 0x40000, 0x375a5ec4, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12625.b12", 0x40000, 0x3b8c757e, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12626.b13", 0x40000, 0x3efca25c, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12618.b1", 0x40000, 0x0d1530bf, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12621.b4", 0x40000, 0x18ff0799, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12619.b2", 0x40000, 0x32069246, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12622.b5", 0x40000, 0xa3dfe436, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12620.b3", 0x40000, 0xf6b096e0, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12623.b6", 0x40000, 0x6773fef6, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12617.a13", 0x08000, 0x7efecf23, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12616.a11", 0x40000, 0x254347c2, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0130.key", 0x02000, 0xba7b717b, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Eswat) +STD_ROM_FN(Eswat) + +static struct BurnRomInfo EswatjRomDesc[] = { + { "epr-12615.a2", 0x40000, 0x388c2ea7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12614.a1", 0x40000, 0xd5f0fb47, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12624.b11", 0x40000, 0x375a5ec4, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12625.b12", 0x40000, 0x3b8c757e, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12626.b13", 0x40000, 0x3efca25c, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12618.b1", 0x40000, 0x0d1530bf, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12621.b4", 0x40000, 0x18ff0799, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12619.b2", 0x40000, 0x32069246, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12622.b5", 0x40000, 0xa3dfe436, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12620.b3", 0x40000, 0xf6b096e0, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12623.b6", 0x40000, 0x6773fef6, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12617.a13", 0x08000, 0x7efecf23, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12616.a11", 0x40000, 0x254347c2, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0128.key", 0x02000, 0x95f96277, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Eswatj) +STD_ROM_FN(Eswatj) + +static struct BurnRomInfo EswatuRomDesc[] = { + { "epr-12657.a2", 0x40000, 0x43ca72aa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12656.a1", 0x40000, 0x5f018967, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12624.b11", 0x40000, 0x375a5ec4, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12625.b12", 0x40000, 0x3b8c757e, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12626.b13", 0x40000, 0x3efca25c, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12618.b1", 0x40000, 0x0d1530bf, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12621.b4", 0x40000, 0x18ff0799, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12619.b2", 0x40000, 0x32069246, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12622.b5", 0x40000, 0xa3dfe436, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12620.b3", 0x40000, 0xf6b096e0, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12623.b6", 0x40000, 0x6773fef6, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12617.a13", 0x08000, 0x7efecf23, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12616.a11", 0x40000, 0x254347c2, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0129.key", 0x02000, 0x128302c7, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Eswatu) +STD_ROM_FN(Eswatu) + +static struct BurnRomInfo EswatblRomDesc[] = { + { "eswat_c.rom", 0x10000, 0x1028cc81, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "eswat_f.rom", 0x10000, 0xf7b2d388, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "eswat_b.rom", 0x10000, 0x87c6b1b5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "eswat_e.rom", 0x10000, 0x937ddf9a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "eswat_a.rom", 0x08000, 0x2af4fc62, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "eswat_d.rom", 0x08000, 0xb4751e19, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr12624.b11", 0x40000, 0x375a5ec4, SYS16_ROM_TILES | BRF_GRA }, + { "mpr12625.b12", 0x40000, 0x3b8c757e, SYS16_ROM_TILES | BRF_GRA }, + { "mpr12626.b13", 0x40000, 0x3efca25c, SYS16_ROM_TILES | BRF_GRA }, + + { "ic9", 0x40000, 0x0d1530bf, SYS16_ROM_SPRITES | BRF_GRA }, + { "ic12", 0x40000, 0x18ff0799, SYS16_ROM_SPRITES | BRF_GRA }, + { "ic10", 0x40000, 0x32069246, SYS16_ROM_SPRITES | BRF_GRA }, + { "ic13", 0x40000, 0xa3dfe436, SYS16_ROM_SPRITES | BRF_GRA }, + { "ic11", 0x40000, 0xf6b096e0, SYS16_ROM_SPRITES | BRF_GRA }, + { "ic14", 0x40000, 0x6773fef6, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr12617.a13", 0x08000, 0x7efecf23, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr12616.a11", 0x40000, 0x254347c2, SYS16_ROM_UPD7759DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Eswatbl) +STD_ROM_FN(Eswatbl) + +static struct BurnRomInfo ExctleagRomDesc[] = { + { "epr-11939.a04", 0x10000, 0x117dd98f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11936.a01", 0x10000, 0x0863de60, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11940.a05", 0x10000, 0xdec83274, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11937.a02", 0x10000, 0x4ebda367, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11941.a06", 0x10000, 0x4df2d451, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11938.a03", 0x10000, 0x07c08d47, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11942.b09", 0x10000, 0xeb70e827, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11943.b10", 0x10000, 0xd97c8982, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11944.b11", 0x10000, 0xa75cae80, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11950.b01", 0x10000, 0xaf497849, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11954.b05", 0x10000, 0x5fa2106c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11951.b02", 0x10000, 0xc04fa974, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11955.b06", 0x10000, 0x86a0c368, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11952.b03", 0x10000, 0xe64a9761, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11956.b07", 0x10000, 0xaff5c2fa, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11953.b04", 0x10000, 0x4cae3999, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11957.b08", 0x10000, 0x218f835b, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11945.a07", 0x08000, 0xc2a83012, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11140.a08", 0x08000, 0xb297371b, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11141.a09", 0x08000, 0x19756aa6, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11142.a10", 0x08000, 0x25d26c66, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11143.a11", 0x08000, 0x848b7b77, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0079.key", 0x02000, 0xeffefa1c, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Exctleag) +STD_ROM_FN(Exctleag) + +static struct BurnRomInfo Fantzn2xRomDesc[] = { + { "fz2.a7", 0x020000, 0x94c05f0b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "fz2.a5", 0x020000, 0xf3526895, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "fz2.a8", 0x020000, 0xb2ebb209, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "fz2.a6", 0x020000, 0x6833f546, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "fz2.a14", 0x020000, 0x1c0a4537, SYS16_ROM_TILES | BRF_GRA }, + { "fz2.a15", 0x020000, 0x2b933344, SYS16_ROM_TILES | BRF_GRA }, + { "fz2.a16", 0x020000, 0xe63281a1, SYS16_ROM_TILES | BRF_GRA }, + + { "fz2.b1", 0x020000, 0x46bba615, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.b5", 0x020000, 0xbebeee5d, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.b2", 0x020000, 0x6681a7b6, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.b6", 0x020000, 0x42d3241f, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.b3", 0x020000, 0x5863926f, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.b7", 0x020000, 0xcd830510, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.b4", 0x020000, 0xb98fa5b6, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.b8", 0x020000, 0xe8248f68, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.a1", 0x020000, 0x9d2f41f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.b10", 0x020000, 0x7686ea33, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.a2", 0x020000, 0x3b4050b7, SYS16_ROM_SPRITES | BRF_GRA }, + { "fz2.b11", 0x020000, 0xda8a95dc, SYS16_ROM_SPRITES | BRF_GRA }, + + { "fz2.a10", 0x008000, 0x92c92924, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "fz2.a11", 0x020000, 0x8c641bb9, SYS16_ROM_UPD7759DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Fantzn2x) +STD_ROM_FN(Fantzn2x) + +static struct BurnRomInfo Fantzn2xpRomDesc[] = { + { "cpu1b.bin", 0x020000, 0xd23ef944, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "cpu1a.bin", 0x020000, 0x407490e4, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "cpu1d.bin", 0x020000, 0xc8c7716b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "cpu1c.bin", 0x020000, 0x242e7b6e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "tilea.bin", 0x020000, 0x47e0e5ce, SYS16_ROM_TILES | BRF_GRA }, + { "tileb.bin", 0x020000, 0x59e181b7, SYS16_ROM_TILES | BRF_GRA }, + { "tilec.bin", 0x020000, 0x375d354c, SYS16_ROM_TILES | BRF_GRA }, + + { "obja.bin", 0x020000, 0x9af87a4d, SYS16_ROM_SPRITES | BRF_GRA }, + { "objb.bin", 0x020000, 0x2fdbca68, SYS16_ROM_SPRITES | BRF_GRA }, + { "objc.bin", 0x020000, 0x2587487a, SYS16_ROM_SPRITES | BRF_GRA }, + { "objd.bin", 0x020000, 0x8de4e7aa, SYS16_ROM_SPRITES | BRF_GRA }, + { "obje.bin", 0x020000, 0xdfada4ff, SYS16_ROM_SPRITES | BRF_GRA }, + { "objf.bin", 0x020000, 0x65e5d23d, SYS16_ROM_SPRITES | BRF_GRA }, + { "objg.bin", 0x020000, 0xdc9fbb75, SYS16_ROM_SPRITES | BRF_GRA }, + { "objh.bin", 0x020000, 0x97bb7c19, SYS16_ROM_SPRITES | BRF_GRA }, + { "obji.bin", 0x020000, 0xc7790fee, SYS16_ROM_SPRITES | BRF_GRA }, + { "objj.bin", 0x020000, 0x4535eb0e, SYS16_ROM_SPRITES | BRF_GRA }, + + { "cpu2a.bin", 0x008000, 0x92c92924, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "cpu2b.bin", 0x020000, 0x2c8ad475, SYS16_ROM_UPD7759DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Fantzn2xp) +STD_ROM_FN(Fantzn2xp) + +static struct BurnRomInfo Fantzn2xps2RomDesc[] = { + { "fz2_s16c.p00", 0x040000, 0xb7d16c1d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "fz2_s16c.p01", 0x040000, 0x2c47487c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "fz2_s16c.scr", 0x080000, 0xed3b1ac0, SYS16_ROM_TILES | BRF_GRA }, + + { "fz2_s16c.spr", 0x200000, 0x14d06fee, SYS16_ROM_SPRITES | BRF_GRA }, + + { "fz2_s16c.snd", 0x030000, 0x0ed30ec1, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Fantzn2xps2) +STD_ROM_FN(Fantzn2xps2) + +static struct BurnRomInfo FantzntaRomDesc[] = { + { "fz1_s16b_ta.p00",0x040000, 0xbad0537a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "fz1_s16b.scr", 0x040000, 0x10ecd8b9, SYS16_ROM_TILES | BRF_GRA }, + + { "fz1_s16b_ta.obj",0x200000, 0x51fd438f, SYS16_ROM_SPRITES | BRF_GRA }, + + { "fz1_s16b.snd", 0x020000, 0xa00701fb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Fantznta) +STD_ROM_FN(Fantznta) + +static struct BurnRomInfo FpointRomDesc[] = { + { "epr-12599b.a4", 0x10000, 0x26e3f354, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12598b.a1", 0x10000, 0xc0f2c97d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-12593.a14", 0x10000, 0xcc0582d8, SYS16_ROM_TILES | BRF_GRA }, + { "opr-12594.a15", 0x10000, 0x8bfc4815, SYS16_ROM_TILES | BRF_GRA }, + { "opr-12595.a16", 0x10000, 0x5b18d60b, SYS16_ROM_TILES | BRF_GRA }, + + { "opr-12596.b1", 0x10000, 0x4a4041f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12597.b5", 0x10000, 0x6961e676, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12592.a10", 0x08000, 0x9a8c11bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0127a.key", 0x02000, 0x5adb0042, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Fpoint) +STD_ROM_FN(Fpoint) + +static struct BurnRomInfo Fpoint1RomDesc[] = { + { "epr-12591b.a7", 0x10000, 0x248b3e1b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12590b.a5", 0x10000, 0x75256e3d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-12593.a14", 0x10000, 0xcc0582d8, SYS16_ROM_TILES | BRF_GRA }, + { "opr-12594.a15", 0x10000, 0x8bfc4815, SYS16_ROM_TILES | BRF_GRA }, + { "opr-12595.a16", 0x10000, 0x5b18d60b, SYS16_ROM_TILES | BRF_GRA }, + + { "opr-12596.b1", 0x10000, 0x4a4041f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12597.b5", 0x10000, 0x6961e676, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12592.a10", 0x08000, 0x9a8c11bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0127a.key", 0x02000, 0x5adb0042, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Fpoint1) +STD_ROM_FN(Fpoint1) + +static struct BurnRomInfo FpointblRomDesc[] = { + { "flpoint.003", 0x10000, 0x4d6df514, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "flpoint.002", 0x10000, 0x4dff2ee8, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "flpoint.006", 0x10000, 0xc539727d, SYS16_ROM_TILES | BRF_GRA }, + { "flpoint.005", 0x10000, 0x82c0b8b0, SYS16_ROM_TILES | BRF_GRA }, + { "flpoint.004", 0x10000, 0x522426ae, SYS16_ROM_TILES | BRF_GRA }, + + { "12596.bin", 0x10000, 0x4a4041f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "12597.bin", 0x10000, 0x6961e676, SYS16_ROM_SPRITES | BRF_GRA }, + + { "flpoint.001", 0x08000, 0xc5b8e0fe, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Fpointbl) +STD_ROM_FN(Fpointbl) + +static struct BurnRomInfo FpointbjRomDesc[] = { + { "boot2.003", 0x10000, 0x6c00d1b0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "boot2.002", 0x10000, 0xc1fcd704, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "flpoint.006", 0x10000, 0xc539727d, SYS16_ROM_TILES | BRF_GRA }, + { "flpoint.005", 0x10000, 0x82c0b8b0, SYS16_ROM_TILES | BRF_GRA }, + { "flpoint.004", 0x10000, 0x522426ae, SYS16_ROM_TILES | BRF_GRA }, + + { "12596.bin", 0x10000, 0x4a4041f3, SYS16_ROM_SPRITES | BRF_GRA }, + { "12597.bin", 0x10000, 0x6961e676, SYS16_ROM_SPRITES | BRF_GRA }, + + { "flpoint.001", 0x08000, 0xc5b8e0fe, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "82s129.1", 0x00100, 0xa7c22d96, BRF_OPT }, + { "82s123.2", 0x00020, 0x58bcf8bd, BRF_OPT }, + { "fpointbj_gal16v8_1.bin", 0x00117, 0xba7f292c, BRF_OPT }, + { "fpointbj_gal16v8_3.bin", 0x00117, 0xce1ab1e1, BRF_OPT }, + { "fpointbj_gal20v8.bin", 0x00400, 0x00000000, BRF_OPT | BRF_NODUMP }, +}; + + +STD_ROM_PICK(Fpointbj) +STD_ROM_FN(Fpointbj) + +static struct BurnRomInfo GoldnaxeRomDesc[] = { + { "epr-12545.ic2", 0x40000, 0xa97c4e4d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12544.ic1", 0x40000, 0x5e38f668, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12385.ic19", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12386.ic20", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12387.ic21", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12378.ic9", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12379.ic12", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12380.ic10", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12381.ic13", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12382.ic11", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12383.ic14", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12390.ic8", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12384.ic6", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0123a.bin", 0x01000, 0x00000000, BRF_NODUMP }, +}; + + +STD_ROM_PICK(Goldnaxe) +STD_ROM_FN(Goldnaxe) + +static struct BurnRomInfo Goldnaxe1RomDesc[] = { + { "epr-12389.ic2", 0x40000, 0x35d5fa77, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12388.ic1", 0x40000, 0x72952a93, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12385.ic19", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12386.ic20", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12387.ic21", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12378.ic9", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12379.ic12", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12380.ic10", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12381.ic13", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12382.ic11", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12383.ic14", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12390.ic8", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12384.ic6", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0110.key", 0x02000, 0xcd517dc6, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Goldnaxe1) +STD_ROM_FN(Goldnaxe1) + +static struct BurnRomInfo Goldnaxe2RomDesc[] = { + { "epr-12523.a7", 0x20000, 0x8e6128d7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12522.a5", 0x20000, 0xb6c35160, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12521.a8", 0x20000, 0x5001d713, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12519.a6", 0x20000, 0x4438ca8e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12385.a14", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12386.a15", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12387.a16", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12378.b1", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12379.b5", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12380.b2", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12381.b6", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12382.b3", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12383.b7", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12390.a10", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12384.a11", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0112.bin", 0x01000, 0x00000000, BRF_NODUMP }, +}; + + +STD_ROM_PICK(Goldnaxe2) +STD_ROM_FN(Goldnaxe2) + +static struct BurnRomInfo Goldnaxe3RomDesc[] = { + { "epr-12525.a7", 0x20000, 0x48332c76, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12524.a5", 0x20000, 0x8e58f342, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12521.a8", 0x20000, 0x5001d713, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12519.a6", 0x20000, 0x4438ca8e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12385.a14", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12386.a15", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12387.a16", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12378.b1", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12379.b5", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12380.b2", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12381.b6", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12382.b3", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12383.b7", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12390.a10", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12384.a11", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0120.key", 0x02000, 0x946e9fa6, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Goldnaxe3) +STD_ROM_FN(Goldnaxe3) + +static struct BurnRomInfo GoldnaxejRomDesc[] = { + { "epr-12540.a7", 0x20000, 0x0c7ccc6d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12539.a5", 0x20000, 0x1f24f7d0, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12521.a8", 0x20000, 0x5001d713, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12519.a6", 0x20000, 0x4438ca8e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12385.a14", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12386.a15", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12387.a16", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12378.b1", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12379.b5", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12380.b2", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12381.b6", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12382.b3", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12383.b7", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12390.a10", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12384.a11", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0121.key", 0x02000, 0x72afed01, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Goldnaxej) +STD_ROM_FN(Goldnaxej) + +static struct BurnRomInfo GoldnaxeuRomDesc[] = { + { "epr-12543.ic2", 0x40000, 0xb0df9ca4, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12542.ic1", 0x40000, 0xb7994d3c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12385.ic19", 0x20000, 0xb8a4e7e0, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12386.ic20", 0x20000, 0x25d7d779, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12387.ic21", 0x20000, 0xc7fcadf3, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12378.ic9", 0x40000, 0x119e5a82, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12379.ic12", 0x40000, 0x1a0e8c57, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12380.ic10", 0x40000, 0xbb2c0853, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12381.ic13", 0x40000, 0x81ba6ecc, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12382.ic11", 0x40000, 0x81601c6f, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12383.ic14", 0x40000, 0x5dbacf7a, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12390.ic8", 0x08000, 0x399fc5f5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12384.ic6", 0x20000, 0x6218d8e7, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0122.key", 0x02000, 0xf123c2fb, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Goldnaxeu) +STD_ROM_FN(Goldnaxeu) + +static struct BurnRomInfo HwchampRomDesc[] = { + { "epr-11239.a7", 0x20000, 0xe5abfed7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11238.a5", 0x20000, 0x25180124, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-11241.a14", 0x20000, 0xfc586a86, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-11166.b14", 0x20000, 0xaeaaa9d8, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-11242.a15", 0x20000, 0x7715a742, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-11167.b15", 0x20000, 0x63a82afa, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-11243.a16", 0x20000, 0xf30cd5fd, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-11168.b16", 0x20000, 0x5b8494a8, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-11158.b1", 0x20000, 0xfc098a13, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11162.b5", 0x20000, 0x5db934a8, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11159.b2", 0x20000, 0x1f27ee74, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11163.b6", 0x20000, 0x8a6a5cf1, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11160.b3", 0x20000, 0xc0b2ba82, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11164.b7", 0x20000, 0xd6c7917b, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11161.b4", 0x20000, 0x35c9e44b, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-11165.b8", 0x20000, 0x57e8f9d2, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11240.a10", 0x08000, 0x96a12d9d, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-11244.a11", 0x20000, 0x4191c03d, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "mpr-11245.a12", 0x20000, 0xa4d53f7b, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "pls153.bin", 0x000eb, 0x39b47212, BRF_OPT }, // PLD +}; + + +STD_ROM_PICK(Hwchamp) +STD_ROM_FN(Hwchamp) + +static struct BurnRomInfo HwchampjRomDesc[] = { + { "epr-11152.a7", 0x20000, 0x8ab0ce62, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11153.a5", 0x20000, 0x84a743de, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11202.a14", 0x20000, 0x7c94ede3, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11213.b14", 0x20000, 0xaeaaa9d8, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11203.a15", 0x20000, 0x327754f7, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11214.b15", 0x20000, 0x63a82afa, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11204.a16", 0x20000, 0xdfc4cd33, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11215.b16", 0x20000, 0x5b8494a8, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11205.b1", 0x20000, 0xfc098a13, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11209.b5", 0x20000, 0x5db934a8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11206.b2", 0x20000, 0x1f27ee74, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11210.b6", 0x20000, 0x8a6a5cf1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11207.b3", 0x20000, 0xc0b2ba82, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11211.b7", 0x20000, 0xd6c7917b, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11208.b4", 0x20000, 0x35c9e44b, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11212.b8", 0x20000, 0x57e8f9d2, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11154.a10", 0x08000, 0x65791275, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11200.a11", 0x20000, 0x5c41a68a, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11201.a12", 0x20000, 0x9a993120, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0046.key", 0x02000, 0x488b3f8b, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, + + { "pls153.bin", 0x000eb, 0x39b47212, BRF_OPT }, // PLD +}; + + +STD_ROM_PICK(Hwchampj) +STD_ROM_FN(Hwchampj) + +static struct BurnRomInfo MvpRomDesc[] = { + { "13000.rom", 0x40000, 0x2e0e21ec, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "12999.rom", 0x40000, 0xfd213d28, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "13011.rom", 0x40000, 0x1cb871fc, SYS16_ROM_TILES | BRF_GRA }, + { "13012.rom", 0x40000, 0xb75e6821, SYS16_ROM_TILES | BRF_GRA }, + { "13013.rom", 0x40000, 0xf1944a3c, SYS16_ROM_TILES | BRF_GRA }, + + { "13003.rom", 0x40000, 0x21424151, SYS16_ROM_SPRITES | BRF_GRA }, + { "13006.rom", 0x40000, 0x2e9afd2f, SYS16_ROM_SPRITES | BRF_GRA }, + { "13004.rom", 0x40000, 0x0aa09dd3, SYS16_ROM_SPRITES | BRF_GRA }, + { "13007.rom", 0x40000, 0x55c8605b, SYS16_ROM_SPRITES | BRF_GRA }, + { "13005.rom", 0x40000, 0xc899c810, SYS16_ROM_SPRITES | BRF_GRA }, + { "13008.rom", 0x40000, 0xb3d46dfc, SYS16_ROM_SPRITES | BRF_GRA }, + { "13009.rom", 0x40000, 0x126d2e37, SYS16_ROM_SPRITES | BRF_GRA }, + { "13010.rom", 0x40000, 0xdf37c567, SYS16_ROM_SPRITES | BRF_GRA }, + + { "13002.rom", 0x08000, 0x1b6e1515, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "13001.rom", 0x40000, 0xe8cace8c, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0143.key", 0x02000, 0xfba2e8da, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Mvp) +STD_ROM_FN(Mvp) + +static struct BurnRomInfo MvpjRomDesc[] = { + { "epr-12967.a7", 0x20000, 0xe53ac137, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12965.a5", 0x20000, 0x4266cb9e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12968.a8", 0x20000, 0x91c772ac, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12966.a6", 0x20000, 0x39365a79, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12971.a14", 0x20000, 0x245dcd1f, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12983.b14", 0x20000, 0xf3570fc9, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12972.a15", 0x20000, 0xff7c4278, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12984.b15", 0x20000, 0xd37d1876, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12973.a16", 0x20000, 0x8dc9b9ea, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12985.b16", 0x20000, 0xe3f33a8a, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-12974.b1", 0x20000, 0xe1da5597, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12977.b5", 0x20000, 0xb9eb9762, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12975.b2", 0x20000, 0x364d51d1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12978.b6", 0x20000, 0x014b5442, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12976.b3", 0x20000, 0x43b549c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12979.b7", 0x20000, 0x20f603f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12962.a1", 0x20000, 0x9b678da3, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12980.b10", 0x20000, 0x883b792a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12963.a2", 0x20000, 0x8870f95a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12981.b11", 0x20000, 0x48636cb0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12964.a3", 0x20000, 0xf9148c5d, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12982.b12", 0x20000, 0xc4453292, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12969.a10", 0x08000, 0xec621893, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-12970.a11", 0x20000, 0x8f7d7657, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0142.key", 0x02000, 0x90468045, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Mvpj) +STD_ROM_FN(Mvpj) + +static struct BurnRomInfo PassshtRomDesc[] = { + { "epr-11871.a4", 0x10000, 0x0f9ccea5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11870.a1", 0x10000, 0xdf43ebcf, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-11854.b9", 0x10000, 0xd31c0b6c, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11855.b10", 0x10000, 0xb78762b4, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11856.b11", 0x10000, 0xea49f666, SYS16_ROM_TILES | BRF_GRA }, + + { "opr-11862.b1", 0x10000, 0xb6e94727, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11865.b5", 0x10000, 0x17e8d5d5, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11863.b2", 0x10000, 0x3e670098, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11866.b6", 0x10000, 0x50eb71cc, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11864.b3", 0x10000, 0x05733ca8, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11867.b7", 0x10000, 0x81e49697, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11857.a7", 0x08000, 0x789edc06, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11858.a8", 0x08000, 0x08ab0018, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11859.a9", 0x08000, 0x8673e01b, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11860.a10", 0x08000, 0x10263746, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11861.a11", 0x08000, 0x38b54a71, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0080.key", 0x02000, 0x222d016f, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Passsht) +STD_ROM_FN(Passsht) + +static struct BurnRomInfo PassshtaRomDesc[] = { + { "8.4a", 0x10000, 0xb84dc139, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "5.1a", 0x10000, 0xeffe29df, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-11854.b9", 0x10000, 0xd31c0b6c, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11855.b10", 0x10000, 0xb78762b4, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11856.b11", 0x10000, 0xea49f666, SYS16_ROM_TILES | BRF_GRA }, + + { "opr-11862.b1", 0x10000, 0xb6e94727, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11865.b5", 0x10000, 0x17e8d5d5, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11863.b2", 0x10000, 0x3e670098, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11866.b6", 0x10000, 0x50eb71cc, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11864.b3", 0x10000, 0x05733ca8, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11867.b7", 0x10000, 0x81e49697, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11857.a7", 0x08000, 0x789edc06, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11858.a8", 0x08000, 0x08ab0018, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11859.a9", 0x08000, 0x8673e01b, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11860.a10", 0x08000, 0x10263746, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11861.a11", 0x08000, 0x38b54a71, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0074.key", 0x02000, 0x71bd232d, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Passshta) +STD_ROM_FN(Passshta) + +static struct BurnRomInfo PassshtjRomDesc[] = { + { "epr-11853.a4", 0x10000, 0xfab337e7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11852.a1", 0x10000, 0x892a81fc, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-11854.b9", 0x10000, 0xd31c0b6c, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11855.b10", 0x10000, 0xb78762b4, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11856.b11", 0x10000, 0xea49f666, SYS16_ROM_TILES | BRF_GRA }, + + { "opr-11862.b1", 0x10000, 0xb6e94727, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11865.b5", 0x10000, 0x17e8d5d5, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11863.b2", 0x10000, 0x3e670098, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11866.b6", 0x10000, 0x50eb71cc, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11864.b3", 0x10000, 0x05733ca8, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11867.b7", 0x10000, 0x81e49697, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11857.a7", 0x08000, 0x789edc06, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11858.a8", 0x08000, 0x08ab0018, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11859.a9", 0x08000, 0x8673e01b, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11860.a10", 0x08000, 0x10263746, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11861.a11", 0x08000, 0x38b54a71, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0070.key", 0x02000, 0x5d0308aa, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Passshtj) +STD_ROM_FN(Passshtj) + +static struct BurnRomInfo PassshtbRomDesc[] = { + { "pass3_2p.bin", 0x10000, 0x26bb9299, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "pass4_2p.bin", 0x10000, 0x06ac6d5d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr11854.b9", 0x10000, 0xd31c0b6c, SYS16_ROM_TILES | BRF_GRA }, + { "opr11855.b10", 0x10000, 0xb78762b4, SYS16_ROM_TILES | BRF_GRA }, + { "opr11856.b11", 0x10000, 0xea49f666, SYS16_ROM_TILES | BRF_GRA }, + + { "opr11862.b1", 0x10000, 0xb6e94727, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr11865.b5", 0x10000, 0x17e8d5d5, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr11863.b2", 0x10000, 0x3e670098, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr11866.b6", 0x10000, 0x50eb71cc, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr11864.b3", 0x10000, 0x05733ca8, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr11867.b7", 0x10000, 0x81e49697, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr11857.a7", 0x08000, 0x789edc06, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr11858.a8", 0x08000, 0x08ab0018, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr11859.a9", 0x08000, 0x8673e01b, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr11860.a10", 0x08000, 0x10263746, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr11861.a11", 0x08000, 0x38b54a71, SYS16_ROM_UPD7759DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Passshtb) +STD_ROM_FN(Passshtb) + +static struct BurnRomInfo RiotcityRomDesc[] = { + { "epr-14612.bin", 0x20000, 0xa1b331ec, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-14610.bin", 0x20000, 0xcd4f2c50, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-14613.bin", 0x20000, 0x0659df4c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-14611.bin", 0x20000, 0xd9e6f80b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-14616.bin", 0x20000, 0x46d30368, SYS16_ROM_TILES | BRF_GRA }, + { "epr-14625.bin", 0x20000, 0xabfb80fe, SYS16_ROM_TILES | BRF_GRA }, + { "epr-14617.bin", 0x20000, 0x884e40f9, SYS16_ROM_TILES | BRF_GRA }, + { "epr-14626.bin", 0x20000, 0x4ef55846, SYS16_ROM_TILES | BRF_GRA }, + { "epr-14618.bin", 0x20000, 0x00eb260e, SYS16_ROM_TILES | BRF_GRA }, + { "epr-14627.bin", 0x20000, 0x961e5f82, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-14619.bin", 0x40000, 0x6f2b5ef7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-14622.bin", 0x40000, 0x7ca7e40d, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-14620.bin", 0x40000, 0x66183333, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-14623.bin", 0x40000, 0x98630049, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-14621.bin", 0x40000, 0xc0f2820e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-14624.bin", 0x40000, 0xd1a68448, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-14614.bin", 0x10000, 0xc65cc69a, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-14615.bin", 0x20000, 0x46653db1, SYS16_ROM_UPD7759DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Riotcity) +STD_ROM_FN(Riotcity) + +static struct BurnRomInfo RyukyuRomDesc[] = { + { "epr-13348.a7", 0x10000, 0x5f0e0c86, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-13347.a5", 0x10000, 0x398031fa, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-13351.a14", 0x20000, 0xa68a4e6d, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13352.a15", 0x20000, 0x5e5531e4, SYS16_ROM_TILES | BRF_GRA }, + { "opr-13353.a16", 0x20000, 0x6d23dfd8, SYS16_ROM_TILES | BRF_GRA }, + + { "opr-13354.b1", 0x20000, 0xf07aad99, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13356.b5", 0x20000, 0x5498290b, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13355.b2", 0x20000, 0x67890019, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-13357.b6", 0x20000, 0xf9e7cf03, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-13349.a10", 0x08000, 0xb83183f8, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "opr-13350.a11", 0x20000, 0x3c59a658, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-5023.key", 0x02000, 0x43704331, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Ryukyu) +STD_ROM_FN(Ryukyu) + +static struct BurnRomInfo SdibRomDesc[] = { + { "epr-10986a.a4", 0x08000, 0x3e136215, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10984a.a1", 0x08000, 0x44bf3cf5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10987a.a5", 0x08000, 0xcfd79404, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10985a.a2", 0x08000, 0x1c21a03f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10829.a6", 0x08000, 0xa431ab08, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10826.a3", 0x08000, 0x2ed8e4b7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10772.b9", 0x10000, 0x182b6301, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10773.b10", 0x10000, 0x8f7129a2, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10774.b11", 0x10000, 0x4409411f, SYS16_ROM_TILES | BRF_GRA }, + + { "10760.b1", 0x10000, 0x70de327b, SYS16_ROM_SPRITES | BRF_GRA }, + { "10763.b5", 0x10000, 0x99ec5cb5, SYS16_ROM_SPRITES | BRF_GRA }, + { "10761.b2", 0x10000, 0x4e80f80d, SYS16_ROM_SPRITES | BRF_GRA }, + { "10764.b6", 0x10000, 0x602da5d5, SYS16_ROM_SPRITES | BRF_GRA }, + { "10762.b3", 0x10000, 0x464b5f78, SYS16_ROM_SPRITES | BRF_GRA }, + { "10765.b7", 0x10000, 0x0a73a057, SYS16_ROM_SPRITES | BRF_GRA }, + + { "10775.a7", 0x08000, 0x4cbd55a8, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0028.key", 0x02000, 0x9a5307b2, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Sdib) +STD_ROM_FN(Sdib) + +static struct BurnRomInfo SdiblRomDesc[] = { + { "a4.rom", 0x08000, 0xf2c41dd6, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "a1.rom", 0x08000, 0xa9f816ef, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "a5.rom", 0x08000, 0x7952e27e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "a2.rom", 0x08000, 0x369af326, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "a6.rom", 0x08000, 0x8ee2c287, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "a3.rom", 0x08000, 0x193e4231, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10772.b9", 0x10000, 0x182b6301, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10773.b10", 0x10000, 0x8f7129a2, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10774.b11", 0x10000, 0x4409411f, SYS16_ROM_TILES | BRF_GRA }, + + { "b1.rom", 0x10000, 0x30e2c50a, SYS16_ROM_SPRITES | BRF_GRA }, + { "b5.rom", 0x10000, 0x794e3e8b, SYS16_ROM_SPRITES | BRF_GRA }, + { "b2.rom", 0x10000, 0x6a8b3fd0, SYS16_ROM_SPRITES | BRF_GRA }, + { "10764.b6", 0x10000, 0x602da5d5, SYS16_ROM_SPRITES | BRF_GRA }, + { "b3.rom", 0x10000, 0xb9de3aeb, SYS16_ROM_SPRITES | BRF_GRA }, + { "10765.b7", 0x10000, 0x0a73a057, SYS16_ROM_SPRITES | BRF_GRA }, + + { "a7.rom", 0x08000, 0x793f9f7f, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Sdibl) +STD_ROM_FN(Sdibl) + +static struct BurnRomInfo DefenseRomDesc[] = { + { "epr-10917a.a4", 0x08000, 0xd91ac47c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10915.a1", 0x08000, 0x7344c510, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10918a.a5", 0x08000, 0xe41befcd, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10916a.a2", 0x08000, 0x7f58ba12, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10829.a6", 0x08000, 0xa431ab08, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10826.a3", 0x08000, 0x2ed8e4b7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "10919.b9", 0x10000, 0x23b88f82, SYS16_ROM_TILES | BRF_GRA }, + { "10920.b10", 0x10000, 0x22b1fb4c, SYS16_ROM_TILES | BRF_GRA }, + { "10921.b11", 0x10000, 0x7788f55d, SYS16_ROM_TILES | BRF_GRA }, + + { "10760.b1", 0x10000, 0x70de327b, SYS16_ROM_SPRITES | BRF_GRA }, + { "10763.b5", 0x10000, 0x99ec5cb5, SYS16_ROM_SPRITES | BRF_GRA }, + { "10761.b2", 0x10000, 0x4e80f80d, SYS16_ROM_SPRITES | BRF_GRA }, + { "10764.b6", 0x10000, 0x602da5d5, SYS16_ROM_SPRITES | BRF_GRA }, + { "10762.b3", 0x10000, 0x464b5f78, SYS16_ROM_SPRITES | BRF_GRA }, + { "10765.b7", 0x10000, 0x0a73a057, SYS16_ROM_SPRITES | BRF_GRA }, + + { "10775.a7", 0x08000, 0x4cbd55a8, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0028.key", 0x02000, 0x9a5307b2, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Defense) +STD_ROM_FN(Defense) + +static struct BurnRomInfo Shinobi2RomDesc[] = { + { "epr-11282.a4", 0x10000, 0x5f2e5524, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11280.a1", 0x10000, 0xbdfe5c38, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11283.a5", 0x10000, 0x9d46e707, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11281.a2", 0x10000, 0x7961d07e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11284.b9", 0x10000, 0x5f62e163, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11285.b10", 0x10000, 0x75f8fbc9, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11286.b11", 0x10000, 0x06508bb9, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11290.b1", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11294.b5", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11291.b2", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11295.b6", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11292.b3", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11296.b7", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11293.b4", 0x10000, 0x41f41063, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11297.b8", 0x10000, 0xb6e1fd72, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11287.a7", 0x08000, 0xe8cccd42, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11288.a8", 0x08000, 0xc8df8460, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11289.a9", 0x08000, 0xe5a4cf30, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0049.key", 0x02000, 0x8fac824f, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Shinobi2) +STD_ROM_FN(Shinobi2) + +static struct BurnRomInfo Shinobi3RomDesc[] = { + { "epr-11299.a4", 0x10000, 0xb930399d, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11298.a1", 0x10000, 0x343f4c46, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11283.a5", 0x10000, 0x9d46e707, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11281.a2", 0x10000, 0x7961d07e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11284.b9", 0x10000, 0x5f62e163, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11285.b10", 0x10000, 0x75f8fbc9, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11286.b11", 0x10000, 0x06508bb9, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11290.b1", 0x10000, 0x611f413a, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11294.b5", 0x10000, 0x5eb00fc1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11291.b2", 0x10000, 0x3c0797c0, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11295.b6", 0x10000, 0x25307ef8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11292.b3", 0x10000, 0xc29ac34e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11296.b7", 0x10000, 0x04a437f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11293.b4", 0x10000, 0x41f41063, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11297.b8", 0x10000, 0xb6e1fd72, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11372.a7", 0x08000, 0x0824269a, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11288.a8", 0x08000, 0xc8df8460, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11289.a9", 0x08000, 0xe5a4cf30, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0054.key", 0x02000, 0x39fd4535, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Shinobi3) +STD_ROM_FN(Shinobi3) + +static struct BurnRomInfo Shinobi4RomDesc[] = { + { "epr-11360.a7", 0x20000, 0xb1f67ab9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11359.a5", 0x20000, 0x0f0306e1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11363.a14", 0x20000, 0x40914168, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11364.a15", 0x20000, 0xe63649a4, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11365.a16", 0x20000, 0x1ef55d20, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11366.b1", 0x20000, 0x319ede73, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11368.b5", 0x20000, 0x0377d7ce, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11367.b2", 0x20000, 0x1d06c5c7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11369.b6", 0x20000, 0xd751d2a2, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11377.a10", 0x08000, 0x0fb6af34, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11362.a11", 0x20000, 0x256af749, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0054.key", 0x02000, 0x39fd4535, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Shinobi4) +STD_ROM_FN(Shinobi4) + +static struct BurnRomInfo Shinobi5RomDesc[] = { + { "epr-11360.a7", 0x20000, 0xb1f67ab9, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11359.a5", 0x20000, 0x0f0306e1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11363.a14", 0x20000, 0x40914168, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11364.a15", 0x20000, 0xe63649a4, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11365.a16", 0x20000, 0x1ef55d20, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11366.b1", 0x20000, 0x319ede73, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11368.b5", 0x20000, 0x0377d7ce, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11367.b2", 0x20000, 0x1d06c5c7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11369.b6", 0x20000, 0xd751d2a2, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11361.a10", 0x08000, 0x1f47ebcb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11362.a11", 0x20000, 0x256af749, SYS16_ROM_UPD7759DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Shinobi5) +STD_ROM_FN(Shinobi5) + +static struct BurnRomInfo SjryukoRomDesc[] = { + { "epr-12256.a4", 0x08000, 0x5987ee1b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12253.a1", 0x08000, 0x26a822df, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12257.a5", 0x08000, 0x3a2acc3f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12254.a2", 0x08000, 0x7e908217, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12224-95.b9", 0x08000, 0xeac17ba1, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12225-94.b10", 0x08000, 0x2310fc98, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12226-93.b11", 0x08000, 0x210e6999, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-12232-10.b1", 0x10000, 0x0adec62b, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12236-11.b5", 0x10000, 0x286b9af8, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12233-17.b2", 0x10000, 0x3e45969c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12237-18.b6", 0x10000, 0xe5058e96, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12234-23.b3", 0x10000, 0x8c8d54ef, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12238-24.b7", 0x10000, 0x7ada3304, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12235-29.b4", 0x10000, 0xfa45d511, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12239-30.b8", 0x10000, 0x91f70c8b, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12244.a7", 0x08000, 0xcb2a47e5, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-12245.a8", 0x08000, 0x66164134, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-12246.a9", 0x08000, 0xf1242582, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-12247.a10", 0x08000, 0xef8a64c6, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-12248.a11", 0x08000, 0xd1eabdab, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-5021.key", 0x02000, 0x4a3422e4, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Sjryuko) +STD_ROM_FN(Sjryuko) + +static struct BurnRomInfo SnapperRomDesc[] = { + { "snap2.r01", 0x10000, 0x9a9e4ed3, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "snap1.r02", 0x10000, 0xcd468d6a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "snap4.r03", 0x08000, 0x0f848e1e, SYS16_ROM_TILES | BRF_GRA }, + { "snap3.r04", 0x08000, 0xc7f8cf0e, SYS16_ROM_TILES | BRF_GRA }, + { "snap5.r05", 0x08000, 0x378e08eb, SYS16_ROM_TILES | BRF_GRA }, +}; + + +STD_ROM_PICK(Snapper) +STD_ROM_FN(Snapper) + +static struct BurnRomInfo SonicbomRomDesc[] = { + { "epr-11342.a4", 0x10000, 0x454693f1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11340.a1", 0x10000, 0x03ba3fed, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11343.a5", 0x10000, 0xedfeb7d4, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11341.a2", 0x10000, 0x0338f771, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "opr-11344.b9", 0x10000, 0x59a9f940, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11345.b10", 0x10000, 0xb44c068b, SYS16_ROM_TILES | BRF_GRA }, + { "opr-11346.b11", 0x10000, 0xe5ada66c, SYS16_ROM_TILES | BRF_GRA }, + + { "opr-11350.b1", 0x10000, 0x525ba1df, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11354.b5", 0x10000, 0x793fa3ac, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11351.b2", 0x10000, 0x63b1f1ca, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11355.b6", 0x10000, 0xfe0fa332, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11352.b3", 0x10000, 0x047fa4b0, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11356.b7", 0x10000, 0xaea3c39d, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11353.b4", 0x10000, 0x4e0791f8, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-11357.b8", 0x10000, 0xa7c5ea41, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11347.a7", 0x08000, 0xb41f0ced, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11348.a8", 0x08000, 0x89924588, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11349.a9", 0x08000, 0x8e4b6204, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0053.key", 0x02000, 0x91c80c88, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Sonicbom) +STD_ROM_FN(Sonicbom) + +static struct BurnRomInfo SuprleagRomDesc[] = { + { "epr-11133.a04", 0x10000, 0xeed72f37, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11130.a01", 0x10000, 0xe2451676, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11134.a05", 0x10000, 0xccd857f5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11131.a02", 0x10000, 0x9b78c2cc, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11135.a06", 0x10000, 0x3735e0e1, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-11132.a03", 0x10000, 0xff199325, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-11136.b09", 0x10000, 0xc3860ce4, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11137.b10", 0x10000, 0x92d96187, SYS16_ROM_TILES | BRF_GRA }, + { "epr-11138.b11", 0x10000, 0xc01dc773, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-11144.b01", 0x10000, 0xb31de51c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11148.b05", 0x10000, 0x126e1309, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11145.b02", 0x10000, 0x4223d2c3, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11149.b06", 0x10000, 0x694d3765, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11146.b03", 0x10000, 0xbf0359b6, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11150.b07", 0x10000, 0x9fc0aded, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11147.b04", 0x10000, 0x3e592772, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-11151.b08", 0x10000, 0x9de95169, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-11139.a07", 0x08000, 0x9cbd99da, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-11140.a08", 0x08000, 0xb297371b, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11141.a09", 0x08000, 0x19756aa6, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11142.a10", 0x08000, 0x25d26c66, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-11143.a11", 0x08000, 0x848b7b77, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0045.key", 0x02000, 0x0594cc2e, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Suprleag) +STD_ROM_FN(Suprleag) + +static struct BurnRomInfo Tetris1RomDesc[] = { + { "epr-12164.a4", 0x08000, 0xb329cd6f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12163.a1", 0x08000, 0xd372d3f3, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12165.b9", 0x10000, 0x62640221, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12166.b10", 0x10000, 0x9abd183b, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12167.b11", 0x10000, 0x2495fd4e, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-12169.b1", 0x08000, 0xdacc6165, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12170.b5", 0x08000, 0x87354e42, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12168.a7", 0x08000, 0xbd9ba01b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0091.key", 0x02000, 0xa7937661, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Tetris1) +STD_ROM_FN(Tetris1) + +static struct BurnRomInfo Tetris2RomDesc[] = { + { "epr-12193.a7", 0x20000, 0x44466ed4, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12192.a5", 0x20000, 0xa1c8af00, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12165.b9", 0x10000, 0x62640221, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12166.b10", 0x10000, 0x9abd183b, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12167.b11", 0x10000, 0x2495fd4e, SYS16_ROM_TILES | BRF_GRA }, + + { "obj0-o.rom", 0x10000, 0x2fb38880, SYS16_ROM_SPRITES | BRF_GRA }, + { "obj0-e.rom", 0x10000, 0xd6a02cba, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12168.a7", 0x08000, 0xbd9ba01b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0092.key", 0x02000, 0xd10e1ad9, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Tetris2) +STD_ROM_FN(Tetris2) + +static struct BurnRomInfo TetrisblRomDesc[] = { + { "rom2.bin", 0x10000, 0x4d165c38, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "rom1.bin", 0x10000, 0x1e912131, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr12165.b9", 0x10000, 0x62640221, SYS16_ROM_TILES | BRF_GRA }, + { "epr12166.b10", 0x10000, 0x9abd183b, SYS16_ROM_TILES | BRF_GRA }, + { "epr12167.b11", 0x10000, 0x2495fd4e, SYS16_ROM_TILES | BRF_GRA }, + + { "obj0-o.rom", 0x10000, 0x2fb38880, SYS16_ROM_SPRITES | BRF_GRA }, + { "obj0-e.rom", 0x10000, 0xd6a02cba, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr12168.a7", 0x08000, 0xbd9ba01b, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Tetrisbl) +STD_ROM_FN(Tetrisbl) + +static struct BurnRomInfo TimescanRomDesc[] = { + { "epr-10853.a4", 0x08000, 0x24d7c5fb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10850.a1", 0x08000, 0xf1575732, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10854.a5", 0x08000, 0x82d0b237, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10851.a2", 0x08000, 0xf5ce271b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10855.a6", 0x08000, 0x63e95a53, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-10852.a3", 0x08000, 0x7cd1382b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-10543.b9", 0x08000, 0x07dccc37, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10544.b10", 0x08000, 0x84fb9a3a, SYS16_ROM_TILES | BRF_GRA }, + { "epr-10545.b11", 0x08000, 0xc8694bc0, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-10548.b1", 0x08000, 0xaa150735, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10552.b5", 0x08000, 0x6fcbb9f7, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10549.b2", 0x08000, 0x2f59f067, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10553.b6", 0x08000, 0x8a220a9f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10550.b3", 0x08000, 0xf05069ff, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10554.b7", 0x08000, 0xdc64f809, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10551.b4", 0x08000, 0x435d811f, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-10555.b8", 0x08000, 0x2143c471, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-10562.a7", 0x08000, 0x3f5028bf, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-10563.a8", 0x08000, 0x9db7eddf, SYS16_ROM_UPD7759DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Timescan) +STD_ROM_FN(Timescan) + +static struct BurnRomInfo ToryumonRomDesc[] = { + { "epr-17689.a2", 0x20000, 0x4f0dee19, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-17688.a1", 0x20000, 0x717d81c7, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-17700.b11", 0x40000, 0x8f288b37, SYS16_ROM_TILES | BRF_GRA }, + { "epr-17701.b12", 0x40000, 0x6dfb025b, SYS16_ROM_TILES | BRF_GRA }, + { "epr-17702.b13", 0x40000, 0xae0b7eab, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-17692.b1", 0x20000, 0x543c4327, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-17695.b4", 0x20000, 0xee60f244, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-17693.b2", 0x20000, 0x4a350b3e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-17696.b5", 0x20000, 0x6edb54f1, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-17694.b3", 0x20000, 0xb296d71d, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-17697.b6", 0x20000, 0x6ccb7b28, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-17698.b7", 0x20000, 0xcd4dfb82, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-17699.b8", 0x20000, 0x2694ecce, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-17691.a13", 0x08000, 0x14205388, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-17690.a11", 0x40000, 0x4f9ba4e4, SYS16_ROM_UPD7759DATA | BRF_SND }, +}; + + +STD_ROM_PICK(Toryumon) +STD_ROM_FN(Toryumon) + +static struct BurnRomInfo TturfRomDesc[] = { + { "12327.a7", 0x20000, 0x0376c593, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "12326.a5", 0x20000, 0xf998862b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "12268.a14", 0x10000, 0xe0dac07f, SYS16_ROM_TILES | BRF_GRA }, + { "12269.a15", 0x10000, 0x457a8790, SYS16_ROM_TILES | BRF_GRA }, + { "12270.a16", 0x10000, 0x69fc025b, SYS16_ROM_TILES | BRF_GRA }, + + { "12279.b1", 0x10000, 0x7a169fb1, SYS16_ROM_SPRITES | BRF_GRA }, + { "12283.b5", 0x10000, 0xae0fa085, SYS16_ROM_SPRITES | BRF_GRA }, + { "12278.b2", 0x10000, 0x961d06b7, SYS16_ROM_SPRITES | BRF_GRA }, + { "12282.b6", 0x10000, 0xe8671ee1, SYS16_ROM_SPRITES | BRF_GRA }, + { "12277.b3", 0x10000, 0xf16b6ba2, SYS16_ROM_SPRITES | BRF_GRA }, + { "12281.b7", 0x10000, 0x1ef1077f, SYS16_ROM_SPRITES | BRF_GRA }, + { "12276.b4", 0x10000, 0x838bd71f, SYS16_ROM_SPRITES | BRF_GRA }, + { "12280.b8", 0x10000, 0x639a57cb, SYS16_ROM_SPRITES | BRF_GRA }, + + { "12328.a10", 0x08000, 0x00000000, SYS16_ROM_Z80PROG | BRF_NODUMP | BRF_PRG }, + + { "12329.a11", 0x10000, 0xed9a686d, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "12330.a12", 0x10000, 0xfb762bca, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0104.bin", 0x01000, 0x00000000, BRF_NODUMP }, +}; + + +STD_ROM_PICK(Tturf) +STD_ROM_FN(Tturf) + +static struct BurnRomInfo TturfuRomDesc[] = { + { "epr-12266.bin", 0x10000, 0xf549def8, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12264.bin", 0x10000, 0xf7cdb289, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12267.bin", 0x10000, 0x3c3ce191, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12265.bin", 0x10000, 0x8cdadd9a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "12268.a14", 0x10000, 0xe0dac07f, SYS16_ROM_TILES | BRF_GRA }, + { "12269.a15", 0x10000, 0x457a8790, SYS16_ROM_TILES | BRF_GRA }, + { "12270.a16", 0x10000, 0x69fc025b, SYS16_ROM_TILES | BRF_GRA }, + + { "12276.b4", 0x10000, 0x838bd71f, SYS16_ROM_SPRITES | BRF_GRA }, + { "12280.b8", 0x10000, 0x639a57cb, SYS16_ROM_SPRITES | BRF_GRA }, + { "12277.b3", 0x10000, 0xf16b6ba2, SYS16_ROM_SPRITES | BRF_GRA }, + { "12281.b7", 0x10000, 0x1ef1077f, SYS16_ROM_SPRITES | BRF_GRA }, + { "12278.b2", 0x10000, 0x961d06b7, SYS16_ROM_SPRITES | BRF_GRA }, + { "12282.b6", 0x10000, 0xe8671ee1, SYS16_ROM_SPRITES | BRF_GRA }, + { "12279.b1", 0x10000, 0x7a169fb1, SYS16_ROM_SPRITES | BRF_GRA }, + { "12283.b5", 0x10000, 0xae0fa085, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12271.a7", 0x08000, 0x99671e52, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "epr-12272.a8", 0x08000, 0x7cf7e69f, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-12273.a9", 0x08000, 0x28f0bb8b, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-12274.a10", 0x08000, 0x8207f0c4, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "epr-12275.a11", 0x08000, 0x182f3c3d, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0099.bin", 0x01000, 0xf676e3e4, BRF_OPT }, +}; + + +STD_ROM_PICK(Tturfu) +STD_ROM_FN(Tturfu) + +static struct BurnRomInfo Wb3RomDesc[] = { + { "epr-12259.a7", 0x20000, 0x54927c7e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12258.a5", 0x20000, 0x01f5898c, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12124.a14", 0x10000, 0xdacefb6f, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12125.a15", 0x10000, 0x9fc36df7, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12126.a16", 0x10000, 0xa693fd94, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12127.a10", 0x08000, 0x0bb901bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0098.bin", 0x01000, 0x00000000, BRF_NODUMP }, +}; + + +STD_ROM_PICK(Wb3) +STD_ROM_FN(Wb3) + +static struct BurnRomInfo Wb32RomDesc[] = { + { "epr-12100.a6", 0x10000, 0xf5ca4abc, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12098.a1", 0x10000, 0xd998e5e5, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12101.a5", 0x10000, 0x6146492b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12099.a2", 0x10000, 0x3e243b45, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12124.b9", 0x10000, 0xdacefb6f, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12125.b10", 0x10000, 0x9fc36df7, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12126.b11", 0x10000, 0xa693fd94, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12127.a7", 0x08000, 0x0bb901bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0085.key", 0x02000, 0x8150f38d, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Wb32) +STD_ROM_FN(Wb32) + +static struct BurnRomInfo Wb33RomDesc[] = { + { "epr-12137.a7", 0x20000, 0x6f81238e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12136.a5", 0x20000, 0x4cf05003, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12124.a14", 0x10000, 0xdacefb6f, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12125.a15", 0x10000, 0x9fc36df7, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12126.a16", 0x10000, 0xa693fd94, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12127.a10", 0x08000, 0x0bb901bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0089.key", 0x02000, 0x597d30d3, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Wb33) +STD_ROM_FN(Wb33) + +static struct BurnRomInfo Wb34RomDesc[] = { + { "epr-12131.a7", 0x20000, 0xb95ecf88, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12128.a5", 0x20000, 0xb711372b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "epr-12124.a14", 0x10000, 0xdacefb6f, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12125.a15", 0x10000, 0x9fc36df7, SYS16_ROM_TILES | BRF_GRA }, + { "epr-12126.a16", 0x10000, 0xa693fd94, SYS16_ROM_TILES | BRF_GRA }, + + { "epr-12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr-12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12127.a10", 0x08000, 0x0bb901bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "317-0087.key", 0x02000, 0x162cb531, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Wb34) +STD_ROM_FN(Wb34) + +static struct BurnRomInfo Wb3bblRomDesc[] = { + { "wb3_03", 0x10000, 0x0019ab3b, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "wb3_05", 0x10000, 0x196e17ee, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "wb3_02", 0x10000, 0xc87350cb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "wb3_04", 0x10000, 0x565d5035, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "wb3_14", 0x10000, 0xd3f20bca, SYS16_ROM_TILES | BRF_GRA }, + { "wb3_15", 0x10000, 0x96ff9d52, SYS16_ROM_TILES | BRF_GRA }, + { "wb3_16", 0x10000, 0xafaf0d31, SYS16_ROM_TILES | BRF_GRA }, + + { "epr12090.b1", 0x10000, 0xaeeecfca, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr12094.b5", 0x10000, 0x615e4927, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr12091.b2", 0x10000, 0x8409a243, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr12095.b6", 0x10000, 0xe774ec2c, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr12092.b3", 0x10000, 0x5c2f0d90, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr12096.b7", 0x10000, 0x0cd59d6e, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr12093.b4", 0x10000, 0x4891e7bb, SYS16_ROM_SPRITES | BRF_GRA }, + { "epr12097.b8", 0x10000, 0xe645902c, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr12127.a10", 0x08000, 0x0bb901bb, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Wb3bbl) +STD_ROM_FN(Wb3bbl) + +static struct BurnRomInfo WrestwarRomDesc[] = { + { "epr-12372.a7", 0x20000, 0xeeaba126, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12371.a5", 0x20000, 0x6714600a, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12146.a8", 0x20000, 0xb77ba665, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12144.a6", 0x20000, 0xddf075cb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12150.a14", 0x20000, 0x6a821ab9, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12151.a15", 0x20000, 0x2b1a0751, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12152.a16", 0x20000, 0xf6e190fe, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12153.b1", 0x20000, 0xffa7d368, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12157.b5", 0x20000, 0x8d7794c1, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12154.b2", 0x20000, 0x0ed343f2, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12158.b6", 0x20000, 0x99458d58, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12155.b3", 0x20000, 0x3087104d, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12159.b7", 0x20000, 0xabcf9bed, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12156.b4", 0x20000, 0x41b6068b, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12160.b8", 0x20000, 0x97eac164, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12141.a1", 0x20000, 0x260311c5, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12161.b10", 0x20000, 0x35a4b1b1, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12142.a2", 0x10000, 0x12e38a5c, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12162.b11", 0x10000, 0xfa06fd24, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12147.a10", 0x08000, 0xc3609607, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12148.a11", 0x20000, 0xfb9a7f29, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "mpr-12149.a12", 0x20000, 0xd6617b19, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0103.bin", 0x01000, 0xaa0710f5, BRF_OPT } +}; + + +STD_ROM_PICK(Wrestwar) +STD_ROM_FN(Wrestwar) + +static struct BurnRomInfo Wrestwar1RomDesc[] = { + { "epr-12145.a7", 0x20000, 0x2af51e2e, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12143.a5", 0x20000, 0x4131e345, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12146.a8", 0x20000, 0xb77ba665, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12144.a6", 0x20000, 0xddf075cb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12150.a14", 0x20000, 0x6a821ab9, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12151.a15", 0x20000, 0x2b1a0751, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12152.a16", 0x20000, 0xf6e190fe, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12153.b1", 0x20000, 0xffa7d368, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12157.b5", 0x20000, 0x8d7794c1, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12154.b2", 0x20000, 0x0ed343f2, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12158.b6", 0x20000, 0x99458d58, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12155.b3", 0x20000, 0x3087104d, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12159.b7", 0x20000, 0xabcf9bed, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12156.b4", 0x20000, 0x41b6068b, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12160.b8", 0x20000, 0x97eac164, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12141.a1", 0x20000, 0x260311c5, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12161.b10", 0x20000, 0x35a4b1b1, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12142.a2", 0x10000, 0x12e38a5c, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12162.b11", 0x10000, 0xfa06fd24, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12147.a10", 0x08000, 0xc3609607, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12148.a11", 0x20000, 0xfb9a7f29, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "mpr-12149.a12", 0x20000, 0xd6617b19, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0090.key", 0x02000, 0xb7c24c4a, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Wrestwar1) +STD_ROM_FN(Wrestwar1) + +static struct BurnRomInfo Wrestwar2RomDesc[] = { + { "epr-12370.a7", 0x20000, 0xcb5dbb76, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12369.a5", 0x20000, 0x6f47dd2f, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12146.a8", 0x20000, 0xb77ba665, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + { "epr-12144.a6", 0x20000, 0xddf075cb, SYS16_ROM_PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12150.a14", 0x20000, 0x6a821ab9, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12151.a15", 0x20000, 0x2b1a0751, SYS16_ROM_TILES | BRF_GRA }, + { "mpr-12152.a16", 0x20000, 0xf6e190fe, SYS16_ROM_TILES | BRF_GRA }, + + { "mpr-12153.b1", 0x20000, 0xffa7d368, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12157.b5", 0x20000, 0x8d7794c1, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12154.b2", 0x20000, 0x0ed343f2, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12158.b6", 0x20000, 0x99458d58, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12155.b3", 0x20000, 0x3087104d, SYS16_ROM_SPRITES | BRF_GRA }, + { "mpr-12159.b7", 0x20000, 0xabcf9bed, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12156.b4", 0x20000, 0x41b6068b, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12160.b8", 0x20000, 0x97eac164, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12141.a1", 0x20000, 0x260311c5, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12161.b10", 0x20000, 0x35a4b1b1, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12142.a2", 0x10000, 0x12e38a5c, SYS16_ROM_SPRITES | BRF_GRA }, + { "opr-12162.b11", 0x10000, 0xfa06fd24, SYS16_ROM_SPRITES | BRF_GRA }, + + { "epr-12147.a10", 0x08000, 0xc3609607, SYS16_ROM_Z80PROG | BRF_ESS | BRF_PRG }, + + { "mpr-12148.a11", 0x20000, 0xfb9a7f29, SYS16_ROM_UPD7759DATA | BRF_SND }, + { "mpr-12149.a12", 0x20000, 0xd6617b19, SYS16_ROM_UPD7759DATA | BRF_SND }, + + { "317-0102.key", 0x02000, 0x28ba1bf0, SYS16_ROM_KEY | BRF_ESS | BRF_PRG }, +}; + + +STD_ROM_PICK(Wrestwar2) +STD_ROM_FN(Wrestwar2) + +/*==================================================== +Bootleg Z80 Handling +====================================================*/ + +UINT8 __fastcall BootlegZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x01: { + return BurnYM2151ReadStatus(); + } + + case 0x40: + case 0xc0: { + return System16SoundLatch; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); +#endif + + return 0; +} + +void __fastcall BootlegZ80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + d &= 0xff; + + switch (a) { + case 0x00: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x01: { + BurnYM2151WriteRegister(d); + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Write Port -> %02X, %02X\n"), a, d); +#endif +} + +UINT8 __fastcall BootlegZ80Read(UINT16 a) +{ + switch (a) { + case 0xe000: + case 0xe800: { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return System16SoundLatch; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); +#endif + + return 0; +} + +#if 0 && defined FBA_DEBUG +void __fastcall BootlegZ80Write(UINT16 a, UINT8 d) +{ + + bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); +} +#endif + +void BootlegMapZ80() +{ + ZetMapArea(0x0000, 0x7fff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0x7fff, 2, System16Z80Rom); + + ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); + + ZetSetReadHandler(BootlegZ80Read); +#if 0 && defined FBA_DEBUG + ZetSetWriteHandler(BootlegZ80Write); +#endif + ZetSetInHandler(BootlegZ80PortRead); + ZetSetOutHandler(BootlegZ80PortWrite); +} + +/*==================================================== +Memory Handlers +====================================================*/ + +UINT8 __fastcall System16BReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + return 0xff - System16Input[1]; + } + + case 0xc41005: { + return System16Dip[2]; + } + + case 0xc41007: { + return 0xff - System16Input[2]; + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); +#endif + + return 0xff; +} + +void __fastcall System16BWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16BTileByteWrite((a - 0x400000) ^ 1, d); + return; + } + + switch (a) { + case 0xc40001: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + return; + } + + case 0xfe0007: { + System16SoundLatch = d; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); +#endif +} + +void __fastcall System16BWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16BTileWordWrite(a - 0x400000, d); + return; + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X\n"), a, d); +#endif +} + +void __fastcall AliensynWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xc00007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +UINT8 __fastcall AtomicpReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + return 0xff - System16Input[1]; + } + + case 0xc41005: { + return System16Dip[0]; + } + + case 0xc41007: { + return System16Dip[1]; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); +#endif + + return 0xff; +} + +void __fastcall AtomicpWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16BTileByteWrite((a - 0x400000) ^ 1, d); + return; + } + + switch (a) { + case 0x123407: { + // ??? + return; + } + + case 0x3f0001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3f0003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x080000: { + BurnYM2413Write(0, d); + return; + } + + case 0x080002: { + BurnYM2413Write(1, d); + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); +#endif +} + +void __fastcall AurailWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xfc0001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0xfc0003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + } +} + +UINT8 __fastcall BayrouteReadByte(UINT32 a) +{ + switch (a) { + case 0x901001: { + return 0xff - System16Input[0]; + } + + case 0x901003: { + return 0xff - System16Input[1]; + } + + case 0x901007: { + return 0xff - System16Input[2]; + } + + case 0x902001: { + return System16Dip[0]; + } + + case 0x902003: { + return System16Dip[1]; + } + } + + return 0xff; +} + +void __fastcall BayrouteWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x700000 && a <= 0x70ffff) { + System16BTileByteWrite((a - 0x700000) ^ 1, d); + return; + } + + switch (a) { + case 0x900001: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + return; + } + + case 0xff0007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +void __fastcall BayrouteWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x700000 && a <= 0x70ffff) { + System16BTileWordWrite(a - 0x700000, d); + return; + } +} + +UINT8 __fastcall BulletReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + return 0xff - System16Input[1]; + } + + case 0xc41005: { + return 0xff - System16Input[3]; + } + + case 0xc41007: { + return 0xff - System16Input[2]; + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + } + + return 0xff; +} + +void __fastcall BulletWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xc00007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +UINT8 __fastcall CottonReadByte(UINT32 a) +{ + switch (a) { + case 0x601001: { + return 0xff - System16Input[0]; + } + + case 0x601003: { + return 0xff - System16Input[1]; + } + + case 0x601005: { + return 0xff; + } + + case 0x601007: { + return 0xff - System16Input[2]; + } + + case 0x602001: { + return System16Dip[0]; + } + + case 0x602003: { + return System16Dip[1]; + } + + case 0x7038f7: { + return (System16Rom[SekGetPC(0) + 1] << 8) | System16Rom[SekGetPC(0) + 0]; + } + } + + return 0xff; +} + +void __fastcall CottonWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16BTileByteWrite((a - 0x400000) ^ 1, d); + return; + } + + switch (a) { + case 0x100001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x100003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x600001: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + return; + } + + case 0xff0007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +void __fastcall CottonWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16BTileWordWrite(a - 0x400000, d); + return; + } +} + +void __fastcall DduxWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x3f0001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3f0003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + } +} + +void __fastcall DduxblGfxWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xc46021: { + BootlegFgPage[1] = d & 0xf; + BootlegBgPage[1] = (d >> 4) & 0xf; + return; + } + + case 0xc46023: { + BootlegFgPage[0] = d & 0xf; + BootlegBgPage[0] = (d >> 4) & 0xf; + return; + } + + case 0xc46025: { + BootlegFgPage[3] = d & 0xf; + BootlegBgPage[3] = (d >> 4) & 0xf; + return; + } + + case 0xc46027: { + BootlegFgPage[2] = d & 0xf; + BootlegBgPage[2] = (d >> 4) & 0xf; + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); +#endif +} + +void __fastcall DduxblGfxWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0xc46000: { + System16ScrollY[1] = d; + return; + } + + case 0xc46008: { + System16ScrollX[1] = (d ^ 0xffff) & 0x1ff; + return; + } + + case 0xc46010: { + System16ScrollY[0] = d; + return; + } + + case 0xc46018: { + System16ScrollX[0] = (d ^ 0xffff) & 0x1ff; + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X\n"), a, d); +#endif +} + +void __fastcall DduxblWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xc40001: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + return; + } + + case 0xc40007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); +#endif +} + +static INT16 DunkshotTrack1X = 0; +static INT16 DunkshotTrack1Y = 0; +static INT16 DunkshotTrack2X = 0; +static INT16 DunkshotTrack2Y = 0; +static INT16 DunkshotTrack3X = 0; +static INT16 DunkshotTrack3Y = 0; +static INT16 DunkshotTrack4X = 0; +static INT16 DunkshotTrack4Y = 0; + +void DunkshotMakeAnalogInputs() +{ + if (System16InputPort2[0]) DunkshotTrack1X += 0x40; + if (System16InputPort2[1]) DunkshotTrack1X -= 0x40; + if (DunkshotTrack1X >= 0x1000) DunkshotTrack1X = 0; + if (DunkshotTrack1X < 0) DunkshotTrack1X = 0xfc0; + + if (System16InputPort2[2]) DunkshotTrack1Y -= 0x40; + if (System16InputPort2[3]) DunkshotTrack1Y += 0x40; + if (DunkshotTrack1Y >= 0x1000) DunkshotTrack1Y = 0; + if (DunkshotTrack1Y < 0) DunkshotTrack1Y = 0xfc0; + + if (System16InputPort2[4]) DunkshotTrack2X += 0x40; + if (System16InputPort2[5]) DunkshotTrack2X -= 0x40; + if (DunkshotTrack2X >= 0x1000) DunkshotTrack2X = 0; + if (DunkshotTrack2X < 0) DunkshotTrack2X = 0xfc0; + + if (System16InputPort2[6]) DunkshotTrack2Y -= 0x40; + if (System16InputPort2[7]) DunkshotTrack2Y += 0x40; + if (DunkshotTrack2Y >= 0x1000) DunkshotTrack2Y = 0; + if (DunkshotTrack2Y < 0) DunkshotTrack2Y = 0xfc0; + + if (System16InputPort3[0]) DunkshotTrack3X += 0x40; + if (System16InputPort3[1]) DunkshotTrack3X -= 0x40; + if (DunkshotTrack3X >= 0x1000) DunkshotTrack3X = 0; + if (DunkshotTrack3X < 0) DunkshotTrack3X = 0xfc0; + + if (System16InputPort3[2]) DunkshotTrack3Y -= 0x40; + if (System16InputPort3[3]) DunkshotTrack3Y += 0x40; + if (DunkshotTrack3Y >= 0x1000) DunkshotTrack3Y = 0; + if (DunkshotTrack3Y < 0) DunkshotTrack3Y = 0xfc0; + + if (System16InputPort3[4]) DunkshotTrack4X += 0x40; + if (System16InputPort3[5]) DunkshotTrack4X -= 0x40; + if (DunkshotTrack4X >= 0x1000) DunkshotTrack4X = 0; + if (DunkshotTrack4X < 0) DunkshotTrack4X = 0xfc0; + + if (System16InputPort3[6]) DunkshotTrack4Y -= 0x40; + if (System16InputPort3[7]) DunkshotTrack4Y += 0x40; + if (DunkshotTrack4Y >= 0x1000) DunkshotTrack4Y = 0; + if (DunkshotTrack4Y < 0) DunkshotTrack4Y = 0xfc0; +} + +UINT8 __fastcall DunkshotReadByte(UINT32 a) +{ + switch (a) { + case 0xc43001: { + return DunkshotTrack1X & 0xff; + } + + case 0xc43003: { + return DunkshotTrack1X >> 8; + } + + case 0xc43005: { + return DunkshotTrack1Y & 0xff; + } + + case 0xc43007: { + return DunkshotTrack1Y >> 8; + } + + case 0xc43009: { + return DunkshotTrack2X & 0xff; + } + + case 0xc4300b: { + return DunkshotTrack2X >> 8; + } + + case 0xc4300d: { + return DunkshotTrack2Y & 0xff; + } + + case 0xc4300f: { + return DunkshotTrack2Y >> 8; + } + + case 0xc43011: { + return DunkshotTrack3X & 0xff; + } + + case 0xc43013: { + return DunkshotTrack3X >> 8; + } + + case 0xc43015: { + return DunkshotTrack3Y & 0xff; + } + + case 0xc43017: { + return DunkshotTrack3Y >> 8; + } + + case 0xc43019: { + return DunkshotTrack4X & 0xff; + } + + case 0xc4301b: { + return DunkshotTrack4X >> 8; + } + + case 0xc4301d: { + return DunkshotTrack4Y & 0xff; + } + + case 0xc4301f: { + return DunkshotTrack4Y >> 8; + } + } + + return 0xff; +} + +UINT16 __fastcall EswatMultiply0ReadWord(UINT32 a) +{ + return System16MultiplyChipRead(0, (a - 0x3e0000) >> 1); +} + +void __fastcall EswatMultiply0WriteWord(UINT32 a, UINT16 d) +{ + System16MultiplyChipWrite(0, (a - 0x3e0000) >> 1, d); +} + +UINT16 __fastcall EswatCompare0ReadWord(UINT32 a) +{ + return System16CompareTimerChipRead(0, (a - 0x3e1000) >> 1); +} + +void __fastcall EswatCompare0WriteWord(UINT32 a, UINT16 d) +{ + System16CompareTimerChipWrite(0, (a - 0x3e1000) >> 1, d); +} + +void __fastcall EswatSoundWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x123407: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +void __fastcall EswatWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x3e2001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3e2003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + } +} + +void __fastcall EswatblSoundWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xc42007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +void __fastcall EswatblGfxWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x418031: { + System16TileBanks[1] = d & 7; + return; + } + } +} + +void __fastcall EswatblGfxWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x418000: { + System16ScrollY[0] = d; + return; + } + + case 0x418008: { + System16ScrollX[0] = (d ^ 0xffff); + return; + } + + case 0x418010: { + System16ScrollY[1] = d; + return; + } + + case 0x418018: { + System16ScrollX[1] = (d ^ 0xffff); + return; + } + + case 0x418020: { + BootlegFgPage[3] = (d >> 12) & 0xf; + BootlegFgPage[2] = (d >> 8) & 0xf; + BootlegFgPage[1] = (d >> 4) & 0xf; + BootlegFgPage[0] = (d >> 0) & 0xf; + return; + } + + case 0x418028: { + BootlegBgPage[3] = (d >> 12) & 0xf; + BootlegBgPage[2] = (d >> 8) & 0xf; + BootlegBgPage[1] = (d >> 4) & 0xf; + BootlegBgPage[0] = (d >> 0) & 0xf; + return; + } + } +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X\n"), a, d); +#endif +} + +static INT16 ExctleagTrack1X = 0; +static INT16 ExctleagTrack1Y = 0; +static INT16 ExctleagTrack2X = 0; +static INT16 ExctleagTrack2Y = 0; + +void ExctleagMakeAnalogInputs() +{ + if (System16InputPort4[0]) ExctleagTrack1X += 0x1; + if (System16InputPort4[1]) ExctleagTrack1X -= 0x1; + if (ExctleagTrack1X >= 0x100) ExctleagTrack1X = 0; + if (ExctleagTrack1X < 0) ExctleagTrack1X = 0xff; + + if (System16InputPort4[2]) ExctleagTrack1Y -= 0x1; + if (System16InputPort4[3]) ExctleagTrack1Y += 0x1; + if (ExctleagTrack1Y >= 0x100) ExctleagTrack1Y = 0; + if (ExctleagTrack1Y < 0) ExctleagTrack1Y = 0xff; + + if (System16InputPort4[4]) ExctleagTrack2X += 0x4; + if (System16InputPort4[5]) ExctleagTrack2X -= 0x4; + if (ExctleagTrack2X >= 0x100) ExctleagTrack2X = 0; + if (ExctleagTrack2X < 0) ExctleagTrack2X = 0xfc; + + if (System16InputPort4[6]) ExctleagTrack2Y -= 0x4; + if (System16InputPort4[7]) ExctleagTrack2Y += 0x4; + if (ExctleagTrack2Y >= 0x100) ExctleagTrack2Y = 0; + if (ExctleagTrack2Y < 0) ExctleagTrack2Y = 0xfc; +} + +UINT8 __fastcall ExctleagReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + return 0xff - System16Input[1]; + } + + case 0xc41005: { + return 0xff - System16Input[3]; + } + + case 0xc41007: { + return 0xff - System16Input[2]; + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + + case 0xc43001: + case 0xc43003: { + return ExctleagTrack1X; + } + + case 0xc43005: + case 0xc43007: { + return ExctleagTrack1Y; + } + + case 0xc43009: + case 0xc4300b: { + return ExctleagTrack2X; + } + + case 0xc4300d: + case 0xc4300f: { + return ExctleagTrack2Y; + } + } + + return 0xff; +} + +void __fastcall Fantzn2xWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x3f0001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3f0003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); +#endif +} + +UINT8 __fastcall FpointblReadByte(UINT32 a) +{ + switch (a) { + case 0x601001: { + return 0xff - System16Input[0]; + } + + case 0x601003: { + return 0xff - System16Input[1]; + } + + case 0x601005: { + return 0xff - System16Input[2]; + } + + case 0x600001: { + return System16Dip[0]; + } + + case 0x600003: { + return System16Dip[1]; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); +#endif + + return 0xff; +} + +void __fastcall FpointblWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x600007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + + } + + case 0x843001: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); +#endif +} + +void __fastcall FpointblGfxWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0xc46000: { + System16ScrollY[0] = d; + return; + } + + case 0xc46008: { + System16ScrollX[0] = (d ^ 0xffff); + return; + } + + case 0xc46010: { + System16ScrollY[1] = d + 2; + return; + } + + case 0xc46018: { + System16ScrollX[1] = (d ^ 0xffff); + return; + } + + case 0xc46022: { + BootlegFgPage[3] = (d >> 12) & 0xf; + BootlegFgPage[2] = (d >> 8) & 0xf; + BootlegFgPage[1] = (d >> 4) & 0xf; + BootlegFgPage[0] = (d >> 0) & 0xf; + return; + } + + case 0xc46026: { + BootlegBgPage[0] = (d >> 12) & 0xf; + BootlegBgPage[1] = (d >> 8) & 0xf; + BootlegBgPage[2] = (d >> 4) & 0xf; + BootlegBgPage[3] = (d >> 0) & 0xf; + return; + } + } +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X, 0x%04X\n"), a, d, d ^ 0xffff); +#endif +} + +void __fastcall GoldnaxeTileWriteByte(UINT32 a, UINT8 d) +{ + System16BTileByteWrite((a - 0x100000) ^ 1, d); +} + +void __fastcall GoldnaxeTileWriteWord(UINT32 a, UINT16 d) +{ + System16BTileWordWrite(a - 0x100000, d); +} + +UINT16 __fastcall GoldnaxeMultiply0ReadWord(UINT32 a) +{ + return System16MultiplyChipRead(0, (a - 0x1f0000) >> 1); +} + +void __fastcall GoldnaxeMultiply0WriteWord(UINT32 a, UINT16 d) +{ + System16MultiplyChipWrite(0, (a - 0x1f0000) >> 1, d); +} + +UINT16 __fastcall GoldnaxeCompare0ReadWord(UINT32 a) +{ + return System16CompareTimerChipRead(0, (a - 0x1f1000) >> 1); +} + +void __fastcall GoldnaxeCompare0WriteWord(UINT32 a, UINT16 d) +{ + System16CompareTimerChipWrite(0, (a - 0x1f1000) >> 1, d); +} + +UINT16 __fastcall GoldnaxeCompare1ReadWord(UINT32 a) +{ + return System16CompareTimerChipRead(1, (a - 0x1e0000) >> 1); +} + +void __fastcall GoldnaxeCompare1WriteWord(UINT32 a, UINT16 d) +{ + System16CompareTimerChipWrite(1, (a - 0x1e0000) >> 1, d); +} + +void __fastcall Goldnaxe1WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x1f2001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x1f2003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + } +} + +void __fastcall Goldnaxe3WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x1f0001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x1f0003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + } +} + +static UINT8 HwchampInputVal; + +UINT16 __fastcall HwchampCtrlReadWord(UINT32 a) +{ + UINT16 result; + + switch (a) { + case 0xc43020: + case 0xc43022: + case 0xc43024: { + result = (HwchampInputVal & 0x80) >> 7; + HwchampInputVal <<= 1; + return result; + } + } + + return 0xffff; +} + +void __fastcall HwchampCtrlWriteWord(UINT32 a, UINT16 /*d*/) +{ + UINT8 temp = 0; + + switch (a) { + case 0xc43020: { + temp = 0x80 + (System16AnalogPort0 >> 4); + if (temp < 0x01) temp = 0x01; + if (temp > 0xfe) temp = 0xfe; + HwchampInputVal = temp; + return; + } + + case 0xc43022: { + temp = 0x26; + if (System16AnalogPort2 > 1) temp = 0xfe; + HwchampInputVal = temp; + return; + } + + case 0xc43024: { + temp = 0x26; + if (System16AnalogPort1 > 1) temp = 0xfe; + HwchampInputVal = temp; + return; + } + } +} + +void __fastcall HwchampWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x3f0001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3f0003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + } +} + +void __fastcall MvpWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x3f2001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3f2003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + } +} + +void __fastcall MvpjWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x3f0001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3f0003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + } +} + +void __fastcall PassshtWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xc00007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +UINT8 __fastcall PassshtaReadByte(UINT32 a) +{ + switch (a) { + case 0xc43001: { + return 0xff - System16Input[1]; + } + + case 0xc43003: { + return 0xff - System16Input[2]; + } + + case 0xc43005: { + return 0xff - System16Input[3]; + } + + case 0xc43007: { + return 0xff - System16Input[4]; + } + } + + return 0xff; +} + +void __fastcall PassshtbGfxWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0xc46000: { + System16ScrollY[0] = d; + return; + } + + case 0xc46002: { + System16ScrollX[0] = (d ^ 0xffff) & 0x1ff; + return; + } + + case 0xc46004: { + System16ScrollY[1] = d; + return; + } + + case 0xc46006: { + System16ScrollX[1] = (d ^ 0xffff) & 0x1ff; + return; + } + +/* case 0xc46022: { + BootlegFgPage[3] = (d >> 12) & 0xf; + BootlegFgPage[2] = (d >> 8) & 0xf; + BootlegFgPage[1] = (d >> 4) & 0xf; + BootlegFgPage[0] = (d >> 0) & 0xf; + return; + } + + case 0xc46026: { + BootlegBgPage[0] = (d >> 12) & 0xf; + BootlegBgPage[1] = (d >> 8) & 0xf; + BootlegBgPage[2] = (d >> 4) & 0xf; + BootlegBgPage[3] = (d >> 0) & 0xf; + return; + }*/ + } +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X, 0x%04X\n"), a, d, (d ^ 0xffff) & 0x1ff); +#endif +} + +UINT8 __fastcall RiotcityReadByte(UINT32 a) +{ + switch (a) { + case 0xf81001: { + return 0xff - System16Input[0]; + } + + case 0xf81003: { + return 0xff - System16Input[1]; + } + + case 0xf81007: { + return 0xff - System16Input[2]; + } + + case 0xf82001: { + return System16Dip[0]; + } + + case 0xf82003: { + return System16Dip[1]; + } + } + + return 0xff; +} + +void __fastcall RiotcityWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0xfa0000 && a <= 0xfaffff) { + System16BTileByteWrite((a - 0xfa0000) ^ 1, d); + return; + } + + switch (a) { + case 0xf00007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + + case 0xf20001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0xf20003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0xf80001: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + return; + } + } +} + +void __fastcall RiotcityWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0xfa0000 && a <= 0xfaffff) { + System16BTileWordWrite(a - 0xfa0000, d); + return; + } +} + +UINT16 __fastcall RyukyuReadWord(UINT32 a) +{ + switch (a) { + case 0x601000: { + return 0xff - System16Input[0]; + } + + case 0x601002: { + return 0xff - System16Input[1]; + } + + case 0x602000: { + return System16Dip[0]; + } + + case 0x602002: { + return System16Dip[1]; + } + } + + return 0xffff; +} + +void __fastcall RyukyuWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16BTileWordWrite(a - 0x400000, d); + return; + } + + switch (a) { + case 0x100000: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x100002: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x600000: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + return; + } + } +} + +void __fastcall RyukyuWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xff0007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +static INT16 SdiTrack1X = 0; +static INT16 SdiTrack1Y = 0; +static INT16 SdiTrack2X = 0; +static INT16 SdiTrack2Y = 0; + +void SdibMakeAnalogInputs() +{ + SdiTrack1X -= (System16AnalogPort0 >> 8) & 0xff; + SdiTrack1Y += (System16AnalogPort1 >> 8) & 0xff; + + SdiTrack2X -= (System16AnalogPort2 >> 8) & 0xff; + SdiTrack2Y += (System16AnalogPort3 >> 8) & 0xff; +} + +UINT8 __fastcall SdibReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41005: { + return 0xff - System16Input[1]; + } + + case 0xc42003: { + return System16Dip[1]; + } + + case 0xc42005: { + return System16Dip[0]; + } + + case 0xc43001: { + return SdiTrack1X; + } + + case 0xc43005: { + return SdiTrack1Y; + } + + case 0xc43009: { + return SdiTrack2X; + } + + case 0xc4300d: { + return SdiTrack2Y; + } + } + + return 0xff; +} + +void __fastcall SdibSoundWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x123407: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +static UINT8 MahjongInputNum; + +UINT16 __fastcall SjryukoReadWord(UINT32 a) +{ + SEK_DEF_READ_WORD(0, a); + + return 0xffff; +} + +UINT8 __fastcall SjryukoReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + if (System16Input[MahjongInputNum + 1] != 0xff) return 0xff & ~(1 << MahjongInputNum); + return 0xff; + } + + case 0xc41005: { + return 0xff - System16Input[MahjongInputNum + 1]; + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + } + + return 0xff; +} + +void __fastcall SjryukoWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xc40003: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + if (d & 4) MahjongInputNum = (MahjongInputNum + 1) % 6; + return; + } + + case 0xc00007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +UINT16 __fastcall SonicbomReadWord(UINT32 a) +{ + switch (a) { + case 0xc42000: { + return (0xff << 8) | System16Dip[0]; + } + + case 0xc42002: { + return (0xff << 8) | System16Dip[1]; + } + } + + return 0xffff; +} + +void __fastcall SonicbomWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x123407: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +void __fastcall TetrisblGfxWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x418000: { + System16ScrollY[0] = d; + return; + } + + case 0x418008: { + System16ScrollX[0] = (d ^ 0xffff) & 0x3ff; + return; + } + + case 0x418010: { + System16ScrollY[1] = d; + return; + } + + case 0x418018: { + System16ScrollX[1] = ((d ^ 0xffff) & 0x3ff) + 2; + return; + } + + case 0x418020: { + BootlegFgPage[3] = (d >> 12) & 0xf; + BootlegFgPage[2] = (d >> 8) & 0xf; + BootlegFgPage[1] = (d >> 4) & 0xf; + BootlegFgPage[0] = (d >> 0) & 0xf; + return; + } + + case 0x418028: { + BootlegBgPage[0] = (d >> 12) & 0xf; + BootlegBgPage[1] = (d >> 8) & 0xf; + BootlegBgPage[2] = (d >> 4) & 0xf; + BootlegBgPage[3] = (d >> 0) & 0xf; + return; + } + } +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X, 0x%04X\n"), a, d, (d ^ 0xffff) & 0x3ff); +#endif +} + +void __fastcall TetrisblSndWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xc42007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +UINT8 __fastcall ToryumonReadByte(UINT32 a) +{ + switch (a) { + case 0xe41001: { + return 0xff - System16Input[0]; + } + + case 0xe41003: { + return 0xff - System16Input[1]; + } + + case 0xe41005: { + return 0; + } + + case 0xe41007: { + return 0xff - System16Input[2]; + } + + case 0xe42001: { + return System16Dip[0]; + } + + case 0xe42003: { + return System16Dip[1]; + } + } + + return 0xff; +} + +void __fastcall ToryumonWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x3e2001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3e2003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0xe40001: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + return; + } + + case 0xfe0007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +UINT8 __fastcall TturfReadByte(UINT32 a) +{ + switch (a) { + case 0x602001: { + return System16Dip[0]; + } + + case 0x602003: { + return System16Dip[1]; + } + } + + return 0xff; +} + +void __fastcall TturfWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16BTileByteWrite((a - 0x400000) ^ 1, d); + return; + } + + switch (a) { + case 0x600001: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + return; + } + } +} + +void __fastcall Wb3WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xdf0007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +void __fastcall Wb3bblGfxWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0xc46000: { + System16ScrollY[0] = d; + return; + } + + case 0xc46002: { + System16ScrollX[0] = (d ^ 0xffff) & 0x3ff; + return; + } + + case 0xc46004: { + System16ScrollY[1] = d; + return; + } + + case 0xc46006: { + System16ScrollX[1] = (d ^ 0xffff) & 0x3ff; + return; + } + +/* case 0xc46022: { + BootlegFgPage[3] = (d >> 12) & 0xf; + BootlegFgPage[2] = (d >> 8) & 0xf; + BootlegFgPage[1] = (d >> 4) & 0xf; + BootlegFgPage[0] = (d >> 0) & 0xf; + return; + } + + case 0xc46026: { + BootlegBgPage[0] = (d >> 12) & 0xf; + BootlegBgPage[1] = (d >> 8) & 0xf; + BootlegBgPage[2] = (d >> 4) & 0xf; + BootlegBgPage[3] = (d >> 0) & 0xf; + return; + }*/ + } +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X, 0x%04X\n"), a, d, d ^ 0xffff); +#endif +} + +void __fastcall WrestwarTileWriteByte(UINT32 a, UINT8 d) +{ + System16BTileByteWrite((a - 0x100000) ^ 1, d); +} + +void __fastcall WrestwarTileWriteWord(UINT32 a, UINT16 d) +{ + System16BTileWordWrite(a - 0x100000, d); +} + +void __fastcall WrestwarWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x400001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x400003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + } +} + +/*==================================================== +Driver Inits +====================================================*/ + +static INT32 Fantzn2xPlaneOffsets[3] = { 1, 2, 3 }; +static INT32 Fantzn2xXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; +static INT32 Fantzn2xYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; + +static INT32 AliensynInit() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xc00006, 0xc00007, SM_WRITE); + SekSetWriteByteHandler(1, AliensynWriteByte); + SekClose(); + } + + return nRet; +} + +static INT32 Aliensyn3Init() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xc00006, 0xc00007, SM_WRITE); + SekSetWriteByteHandler(1, AliensynWriteByte); + SekClose(); + } + + return nRet; +} + +void Altbeast_Sim8751() +{ + // System Inputs + *((UINT16*)(System16Ram + 0x30c2)) = BURN_ENDIAN_SWAP_INT16((UINT16)(System16Input[0] << 8)); + + // Tile Banking + System16TileBanks[1] = ((System16Ram[0x3094 + 1] << 8) | System16Ram[0x3094 + 0]) & 7; + + // Sound command + UINT16 temp = (System16Ram[0x30c4 + 1] << 8) | System16Ram[0x30c4 + 0]; + if ((temp & 0xff00) != 0x0000) { + System16SoundLatch = temp >> 8; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + *((UINT16*)(System16Ram + 0x30c4)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); + } +} + +void Altbeastj_Sim8751() +{ + // System Inputs + *((UINT16*)(System16Ram + 0x30d0)) = BURN_ENDIAN_SWAP_INT16((UINT16)(System16Input[0] << 8)); + + // Tile Banking + System16TileBanks[1] = ((System16Ram[0x3094 + 1] << 8) | System16Ram[0x3094 + 0]) & 7; + + // Sound command + UINT16 temp = (System16Ram[0x30d4 + 1] << 8) | System16Ram[0x30d4 + 0]; + if ((temp & 0xff00) != 0x0000) { + System16SoundLatch = temp >> 8; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + *((UINT16*)(System16Ram + 0x30d4)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); + } +} + +void Altbeast6_Sim8751() +{ + // System Inputs + *((UINT16*)(System16Ram + 0x3096)) = BURN_ENDIAN_SWAP_INT16((UINT16)(System16Input[0] << 8)); + + // Tile Banking + System16TileBanks[1] = ((System16Ram[0x3094 + 1] << 8) | System16Ram[0x3094 + 0]) & 7; + + // Sound command + UINT16 temp = (System16Ram[0x3098 + 1] << 8) | System16Ram[0x3098 + 0]; + if ((temp & 0xff00) != 0x0000) { + System16SoundLatch = temp >> 8; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + *((UINT16*)(System16Ram + 0x3098)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); + } +} + +static INT32 AltbeastInit() +{ + Simulate8751 = Altbeast_Sim8751; + + return System16Init(); +} + +static INT32 AltbeastjInit() +{ + Simulate8751 = Altbeastj_Sim8751; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1a0000 - 0xe0000; + + INT32 nRet = System16Init(); + + if (!nRet) { + UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0xe0000); + memset(System16Sprites, 0, 0x1a0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); + memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); + memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); + memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); + memcpy(System16Sprites + 0x100000, pTemp + 0x80000, 0x20000); + memcpy(System16Sprites + 0x140000, pTemp + 0xa0000, 0x20000); + memcpy(System16Sprites + 0x180000, pTemp + 0xc0000, 0x20000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Altbeast6Init() +{ + Simulate8751 = Altbeast6_Sim8751; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1a0000 - 0xe0000; + + INT32 nRet = System16Init(); + + if (!nRet) { + UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0xe0000); + memset(System16Sprites, 0, 0x1a0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); + memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); + memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); + memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); + memcpy(System16Sprites + 0x100000, pTemp + 0x80000, 0x20000); + memcpy(System16Sprites + 0x140000, pTemp + 0xa0000, 0x20000); + memcpy(System16Sprites + 0x180000, pTemp + 0xc0000, 0x20000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Altbeastj3Init() +{ + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1a0000 - 0xe0000; + + INT32 nRet = System16Init(); + + if (!nRet) { + UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0xe0000); + memset(System16Sprites, 0, 0x1a0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); + memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); + memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); + memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); + memcpy(System16Sprites + 0x100000, pTemp + 0x80000, 0x20000); + memcpy(System16Sprites + 0x140000, pTemp + 0xa0000, 0x20000); + memcpy(System16Sprites + 0x180000, pTemp + 0xc0000, 0x20000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Altbeast4Init() +{ + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1a0000 - 0xe0000; + + INT32 nRet = System16Init(); + + if (!nRet) { + UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0xe0000); + memset(System16Sprites, 0, 0x1a0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); + memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); + memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); + memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); + memcpy(System16Sprites + 0x100000, pTemp + 0x80000, 0x20000); + memcpy(System16Sprites + 0x140000, pTemp + 0xa0000, 0x20000); + memcpy(System16Sprites + 0x180000, pTemp + 0xc0000, 0x20000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +void AtomicpMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x01ffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x01ffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, System16BWriteWord); + SekSetReadByteHandler(0, AtomicpReadByte); + SekSetWriteByteHandler(0, AtomicpWriteByte); + SekClose(); +} + +static INT32 AtomicpInit() +{ + System16Map68KDo = AtomicpMap68K; + + INT32 nRet = System16Init(); + + System16IgnoreVideoEnable = 1; + System16YM2413IRQInterval = 166; + + return nRet; +} + +static INT32 AurailInit() +{ + System16CustomLoadRomDo = CustomLoadRom40000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xfc0000, 0xfc0003, SM_WRITE); + SekSetWriteByteHandler(1, AurailWriteByte); + SekClose(); + } + + return nRet; +} + +static INT32 Aurail1Init() +{ + System16CustomLoadRomDo = CustomLoadRom40000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xfc0000, 0xfc0003, SM_WRITE); + SekSetWriteByteHandler(1, AurailWriteByte); + SekClose(); + } + + return nRet; +} + +static INT32 AurailjInit() +{ + System16CustomLoadRomDo = CustomLoadRom40000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xfc0000, 0xfc0003, SM_WRITE); + SekSetWriteByteHandler(1, AurailWriteByte); + SekClose(); + } + + return nRet; +} + +void BayrouteMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); + SekMapMemory(System16Ram , 0x500000, 0x503fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x600000, 0x6007ff, SM_RAM); + SekMapMemory(System16TileRam , 0x700000, 0x70ffff, SM_READ); + SekMapMemory(System16TextRam , 0x710000, 0x710fff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x800000, 0x800fff, SM_RAM); + SekSetReadByteHandler(0, BayrouteReadByte); + SekSetWriteByteHandler(0, BayrouteWriteByte); + SekSetWriteWordHandler(0, BayrouteWriteWord); + SekClose(); +} + +static INT32 BayrouteInit() +{ + System16Map68KDo = BayrouteMap68K; + System16CustomLoadRomDo = CustomLoadRom40000; + + return System16Init(); +} + +static INT32 Bayroute1Init() +{ + System16Map68KDo = BayrouteMap68K; + System16CustomLoadRomDo = CustomLoadRom20000; + + return System16Init(); +} + +void Blox16bMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, System16BWriteWord); + SekSetReadByteHandler(0, System16BReadByte); + SekSetWriteByteHandler(0, System16BWriteByte); + SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); + SekSetWriteByteHandler(1, Fantzn2xWriteByte); + SekClose(); +} + +static INT32 Blox16bLoadRom() +{ + if (BurnLoadRom(System16Rom + 0x00000, 0, 1)) return 1; + + System16TempGfx = (UINT8*)BurnMalloc(System16TileRomSize); + BurnLoadRom(System16TempGfx, 1, 1); + GfxDecode(0x2000, 3, 8, 8, Fantzn2xPlaneOffsets, Fantzn2xXOffsets, Fantzn2xYOffsets, 0x100, System16TempGfx, System16Tiles); + System16NumTiles = 0x2000; + BurnFree(System16TempGfx); + + BurnLoadRom(System16Sprites, 2, 1); + BurnByteswap(System16Sprites, System16SpriteRomSize); + + if (BurnLoadRom(System16Z80Rom, 3, 1)) return 1; + memcpy(System16UPD7759Data, System16Z80Rom + 0x10000, 0x08000); + + return 0; +} + +static INT32 Blox16bInit() +{ + System16Map68KDo = Blox16bMap68K; + System16CustomLoadRomDo = Blox16bLoadRom; + System16UPD7759DataSize = 0x08000; + + return System16Init(); +} + +static INT32 BulletInit() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, BulletReadByte); + SekMapHandler(1, 0xc00006, 0xc00007, SM_WRITE); + SekSetWriteByteHandler(1, BulletWriteByte); + SekClose(); + } + return nRet; +} + +void CottonMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0fffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x300000, 0x3007ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x500000, 0x500fff, SM_RAM); + SekMapMemory(System16Ram , 0x200000, 0x203fff, SM_RAM); + SekSetReadByteHandler(0, CottonReadByte); + SekSetWriteByteHandler(0, CottonWriteByte); + SekSetWriteWordHandler(0, CottonWriteWord); + SekClose(); +} + +static INT32 CottonInit() +{ + System16Map68KDo = CottonMap68K; + System16CustomLoadRomDo = CustomLoadRom40000; + + return System16Init(); +} + +void Ddux_Sim8751() +{ + // Sound command + UINT16 temp = (System16Ram[0x0bd0 + 1] << 8) | System16Ram[0x0bd0 + 0]; + if ((temp & 0xff00) != 0x0000) { + System16SoundLatch = temp >> 8; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + *((UINT16*)(System16Ram + 0x0bd0)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); + } +} + +static INT32 DduxInit() +{ + System16CustomLoadRomDo = CustomLoadRom40000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); + SekSetWriteByteHandler(1, DduxWriteByte); + SekClose(); + } + + return nRet; +} + +static INT32 Ddux1Init() +{ + Simulate8751 = Ddux_Sim8751; + System16CustomLoadRomDo = CustomLoadRom40000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); + SekSetWriteByteHandler(1, DduxWriteByte); + SekClose(); + } + + return nRet; +} + +static INT32 DduxblInit() +{ + System16CustomLoadRomDo = CustomLoadRom40000; + + System16SpriteXOffset = 112; + + System16MapZ80Do = BootlegMapZ80; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetWriteByteHandler(0, DduxblWriteByte); + SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); + SekSetWriteByteHandler(1, DduxWriteByte); + SekMapHandler(2, 0xc46000, 0xc46027, SM_WRITE); + SekSetWriteByteHandler(2, DduxblGfxWriteByte); + SekSetWriteWordHandler(2, DduxblGfxWriteWord); + SekClose(); + + bSystem16BootlegRender = true; + } + + return nRet; +} + +static INT32 DunkshotInit() +{ + System16MakeAnalogInputsDo = DunkshotMakeAnalogInputs; + + System16BTileAlt = true; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x80000 - 0x40000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xc43000, 0xc4301f, SM_READ); + SekSetReadByteHandler(1, DunkshotReadByte); + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x80000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x80000); + memset(System16Sprites, 0, 0x80000); + memcpy(System16Sprites + 0x00000, pTemp + 0x00000, 0x10000); + memcpy(System16Sprites + 0x10000, pTemp + 0x00000, 0x10000); + memcpy(System16Sprites + 0x20000, pTemp + 0x10000, 0x10000); + memcpy(System16Sprites + 0x30000, pTemp + 0x10000, 0x10000); + memcpy(System16Sprites + 0x40000, pTemp + 0x20000, 0x10000); + memcpy(System16Sprites + 0x50000, pTemp + 0x20000, 0x10000); + memcpy(System16Sprites + 0x60000, pTemp + 0x30000, 0x10000); + memcpy(System16Sprites + 0x70000, pTemp + 0x30000, 0x10000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 DunkshotExit() +{ + DunkshotTrack1X = 0; + DunkshotTrack1Y = 0; + DunkshotTrack2X = 0; + DunkshotTrack2Y = 0; + DunkshotTrack3X = 0; + DunkshotTrack3Y = 0; + DunkshotTrack4X = 0; + DunkshotTrack4Y = 0; + + return System16Exit(); +} + +static INT32 DunkshotScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029660; + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(DunkshotTrack1X); + SCAN_VAR(DunkshotTrack1Y); + SCAN_VAR(DunkshotTrack2X); + SCAN_VAR(DunkshotTrack2Y); + SCAN_VAR(DunkshotTrack3X); + SCAN_VAR(DunkshotTrack3Y); + SCAN_VAR(DunkshotTrack4X); + SCAN_VAR(DunkshotTrack4Y); + } + + return System16Scan(nAction, pnMin);; +} + +void EswatMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + SekSetReadByteHandler(0, System16BReadByte); + SekSetWriteByteHandler(0, System16BWriteByte); + SekSetWriteWordHandler(0, System16BWriteWord); + SekClose(); +} + +static INT32 EswatInit() +{ + System16Map68KDo = EswatMap68K; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1c0000 - 0x180000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0x123406, 0x123407, SM_WRITE); + SekSetWriteByteHandler(1, EswatSoundWriteByte); + + SekMapHandler(2, 0x3e0000, 0x3e0fff, SM_RAM); + SekSetReadWordHandler(2, EswatMultiply0ReadWord); + SekSetWriteWordHandler(2, EswatMultiply0WriteWord); + + SekMapHandler(3, 0x3e1000, 0x3e1fff, SM_RAM); + SekSetReadWordHandler(3, EswatCompare0ReadWord); + SekSetWriteWordHandler(3, EswatCompare0WriteWord); + + SekMapHandler(4, 0x3e2000, 0x3e2003, SM_WRITE); + SekSetWriteByteHandler(4, EswatWriteByte); + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x1c0000); + memset(System16Sprites, 0, 0x1c0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); + memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); + memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); + memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); + memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); + memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 EswatblInit() +{ + System16Map68KDo = EswatMap68K; + + System16SpriteXOffset = 124; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1c0000 - 0x180000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0x418000, 0x418031, SM_WRITE); + SekSetWriteWordHandler(1, EswatblGfxWriteWord); + SekSetWriteByteHandler(1, EswatblGfxWriteByte); + + SekMapHandler(2, 0xc42006, 0xc42007, SM_WRITE); + SekSetWriteByteHandler(2, EswatblSoundWriteByte); + + SekMapHandler(3, 0x3e2000, 0x3e2003, SM_WRITE); + SekSetWriteByteHandler(3, EswatWriteByte); + + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x1c0000); + memset(System16Sprites, 0, 0x1c0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); + memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); + memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); + memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); + memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); + memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); + } else { + nRet = 1; + } + BurnFree(pTemp); + + bSystem16BootlegRender = true; + } + + return nRet; +} + +static INT32 ExctleagInit() +{ + System16MakeAnalogInputsDo = ExctleagMakeAnalogInputs; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, ExctleagReadByte); + SekClose(); + } + + return nRet; +} + +static INT32 ExctleagExit() +{ + ExctleagTrack1X = 0; + ExctleagTrack1Y = 0; + ExctleagTrack2X = 0; + ExctleagTrack2Y = 0; + + return System16Exit(); +} + +static INT32 ExctleagScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029660; + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(ExctleagTrack1X); + SCAN_VAR(ExctleagTrack1Y); + SCAN_VAR(ExctleagTrack2X); + SCAN_VAR(ExctleagTrack2Y); + } + + return System16Scan(nAction, pnMin);; +} + +void Fantzn2xMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0fffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); + SekMapMemory(System16Ram , 0x200000, 0x23ffff, SM_RAM); + SekSetWriteWordHandler(0, System16BWriteWord); + SekSetReadByteHandler(0, System16BReadByte); + SekSetWriteByteHandler(0, System16BWriteByte); + SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); + SekSetWriteByteHandler(1, Fantzn2xWriteByte); + SekClose(); +} + +static INT32 Fantzn2xLoadRom() +{ + INT32 nRet = System16LoadRoms(1); + + memcpy(System16Rom + 0x80000, System16Rom + 0x40000, 0x40000); + memset(System16Rom + 0x40000, 0, 0x40000); + memcpy(System16Code + 0x80000, System16Code + 0x40000, 0x40000); + memset(System16Code + 0x40000, 0, 0x40000); + + return nRet; +} + +static INT32 Fantzn2xps2LoadRom() +{ + if (BurnLoadRom(System16Rom + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(System16Rom + 0x80000, 1, 1)) return 1; + + memcpy(System16Code, System16Rom, 0x100000); + + System16TempGfx = (UINT8*)BurnMalloc(System16TileRomSize); + BurnLoadRom(System16TempGfx, 2, 1); + GfxDecode(0x4000, 3, 8, 8, Fantzn2xPlaneOffsets, Fantzn2xXOffsets, Fantzn2xYOffsets, 0x100, System16TempGfx, System16Tiles); + System16NumTiles = 0x4000; + BurnFree(System16TempGfx); + + BurnLoadRom(System16Sprites, 3, 1); + + if (BurnLoadRom(System16Z80Rom, 4, 1)) return 1; + memcpy(System16UPD7759Data, System16Z80Rom + 0x10000, 0x20000); + + return 0; +} + +static INT32 Fantzn2xInit() +{ + System16Map68KDo = Fantzn2xMap68K; + System16CustomLoadRomDo = Fantzn2xLoadRom; + + return System16Init(); +} + +static INT32 Fantzn2xps2Init() +{ + System16Map68KDo = Fantzn2xMap68K; + System16CustomLoadRomDo = Fantzn2xps2LoadRom; + System16UPD7759DataSize = 0x20000; + + return System16Init(); +} + +void FantzntaMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + SekSetWriteWordHandler(0, System16BWriteWord); + SekSetReadByteHandler(0, System16BReadByte); + SekSetWriteByteHandler(0, System16BWriteByte); + SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); + SekSetWriteByteHandler(1, Fantzn2xWriteByte); + SekClose(); +} + +static INT32 FantzntaLoadRom() +{ + if (BurnLoadRom(System16Rom + 0x00000, 0, 1)) return 1; + + System16TempGfx = (UINT8*)BurnMalloc(System16TileRomSize); + BurnLoadRom(System16TempGfx, 1, 1); + GfxDecode(0x2000, 3, 8, 8, Fantzn2xPlaneOffsets, Fantzn2xXOffsets, Fantzn2xYOffsets, 0x100, System16TempGfx, System16Tiles); + System16NumTiles = 0x2000; + BurnFree(System16TempGfx); + + BurnLoadRom(System16Sprites, 2, 1); + BurnByteswap(System16Sprites, System16SpriteRomSize); + + if (BurnLoadRom(System16Z80Rom, 3, 1)) return 1; + memcpy(System16UPD7759Data, System16Z80Rom + 0x10000, 0x10000); + + return 0; +} + +static INT32 FantzntaInit() +{ + System16Map68KDo = FantzntaMap68K; + System16CustomLoadRomDo = FantzntaLoadRom; + System16UPD7759DataSize = 0x10000; + + return System16Init(); +} + +static INT32 FpointblInit() +{ + System16MapZ80Do = BootlegMapZ80; + + INT32 nRet = System16Init(); + + System16SpriteXOffset = 109; + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, FpointblReadByte); + SekSetWriteByteHandler(0, FpointblWriteByte); + + SekMapHandler(1, 0xc46000, 0xc46031, SM_WRITE); + SekSetWriteWordHandler(1, FpointblGfxWriteWord); + SekClose(); + + bSystem16BootlegRender = true; + } + + return nRet; +} + +void GoldnaxeMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x100000, 0x10ffff, SM_READ); + SekMapMemory(System16TextRam , 0x110000, 0x110fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x200000, 0x2007ff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x300000, 0x3007ff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x400000, 0x4007ff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x500000, 0x5007ff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x700000, 0x7007ff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x800000, 0x8007ff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x900000, 0x9007ff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x600000, 0x6007ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x140000, 0x140fff, SM_RAM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + SekSetReadByteHandler(0, System16BReadByte); + SekSetWriteByteHandler(0, System16BWriteByte); + + SekMapHandler(1, 0x100000, 0x10ffff, SM_WRITE); + SekSetWriteByteHandler(1, GoldnaxeTileWriteByte); + SekSetWriteWordHandler(1, GoldnaxeTileWriteWord); + SekClose(); +} + +void Goldnaxe_Sim8751() +{ + // Protection MCU + UINT16 temp1 = (System16Ram[0x2cd8 + 1] << 8) | System16Ram[0x2cd8 + 0]; + UINT16 temp2 = (System16Ram[0x2cda + 1] << 8) | System16Ram[0x2cda + 0]; + UINT16 temp3 = (System16Ram[0x2cdc + 1] << 8) | System16Ram[0x2cdc + 0]; + UINT16 temp4 = (System16Ram[0x2cde + 1] << 8) | System16Ram[0x2cde + 0]; + if (temp1 == 0 && temp2 == 0 && temp3 == 0 && temp4 == 0) { + *((UINT16*)(System16Ram + 0x2cd8)) = BURN_ENDIAN_SWAP_INT16(0x048c); + *((UINT16*)(System16Ram + 0x2cda)) = BURN_ENDIAN_SWAP_INT16(0x159d); + *((UINT16*)(System16Ram + 0x2cdc)) = BURN_ENDIAN_SWAP_INT16(0x26ae); + *((UINT16*)(System16Ram + 0x2cde)) = BURN_ENDIAN_SWAP_INT16(0x37bf); + } + + // Sound command + UINT16 temp = (System16Ram[0x2cfc + 1] << 8) | System16Ram[0x2cfc + 0]; + if ((temp & 0xff00) != 0x0000) { + System16SoundLatch = temp >> 8; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + *((UINT16*)(System16Ram + 0x2cfc)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); + } + + // Inputs + *((UINT16*)(System16Ram + 0x2cd0)) = BURN_ENDIAN_SWAP_INT16((UINT16)(~((System16Input[1] << 8) | System16Input[2]))); + *((UINT16*)(System16Ram + 0x2c96)) = BURN_ENDIAN_SWAP_INT16((UINT16)(~System16Input[0] << 8)); +} + +static INT32 GoldnaxeInit() +{ + Simulate8751 = Goldnaxe_Sim8751; + System16Map68KDo = GoldnaxeMap68K; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1c0000 - 0x180000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(2, 0x1e0000, 0x1e0fff, SM_RAM); + SekSetReadWordHandler(2, GoldnaxeCompare1ReadWord); + SekSetWriteWordHandler(2, GoldnaxeCompare1WriteWord); + + SekMapHandler(3, 0x1f0000, 0x1f0fff, SM_RAM); + SekSetReadWordHandler(3, GoldnaxeMultiply0ReadWord); + SekSetWriteWordHandler(3, GoldnaxeMultiply0WriteWord); + + SekMapHandler(4, 0x1f1000, 0x1f1fff, SM_RAM); + SekSetReadWordHandler(4, GoldnaxeCompare0ReadWord); + SekSetWriteWordHandler(4, GoldnaxeCompare0WriteWord); + + SekMapHandler(5, 0x1f2000, 0x1f2003, SM_WRITE); + SekSetWriteByteHandler(5, Goldnaxe1WriteByte); + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x1c0000); + memset(System16Sprites, 0, 0x1c0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); + memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); + memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); + memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); + memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); + memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Goldnaxe1Init() +{ + System16Map68KDo = GoldnaxeMap68K; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1c0000 - 0x180000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(2, 0x1e0000, 0x1e0fff, SM_RAM); + SekSetReadWordHandler(2, GoldnaxeCompare1ReadWord); + SekSetWriteWordHandler(2, GoldnaxeCompare1WriteWord); + + SekMapHandler(3, 0x1f0000, 0x1f0fff, SM_RAM); + SekSetReadWordHandler(3, GoldnaxeMultiply0ReadWord); + SekSetWriteWordHandler(3, GoldnaxeMultiply0WriteWord); + + SekMapHandler(4, 0x1f1000, 0x1f1fff, SM_RAM); + SekSetReadWordHandler(4, GoldnaxeCompare0ReadWord); + SekSetWriteWordHandler(4, GoldnaxeCompare0WriteWord); + + SekMapHandler(5, 0x1f2000, 0x1f2003, SM_WRITE); + SekSetWriteByteHandler(5, Goldnaxe1WriteByte); + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x1c0000); + memset(System16Sprites, 0, 0x1c0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); + memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); + memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); + memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); + memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); + memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Goldnaxe2Init() +{ + Simulate8751 = Goldnaxe_Sim8751; + System16Map68KDo = GoldnaxeMap68K; + System16CustomLoadRomDo = CustomLoadRom40000; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1c0000 - 0x180000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(2, 0x1f0000, 0x1f0003, SM_WRITE); + SekSetWriteByteHandler(2, Goldnaxe3WriteByte); + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x1c0000); + memset(System16Sprites, 0, 0x1c0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); + memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); + memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); + memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); + memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); + memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Goldnaxe3Init() +{ + System16Map68KDo = GoldnaxeMap68K; + System16CustomLoadRomDo = CustomLoadRom40000; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1c0000 - 0x180000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(2, 0x1f0000, 0x1f0003, SM_WRITE); + SekSetWriteByteHandler(2, Goldnaxe3WriteByte); + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x1c0000); + memset(System16Sprites, 0, 0x1c0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); + memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); + memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); + memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); + memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); + memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 HwchampInit() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); + SekSetWriteByteHandler(1, HwchampWriteByte); + + SekMapHandler(2, 0xc43020, 0xc43025, SM_RAM); + SekSetReadWordHandler(2, HwchampCtrlReadWord); + SekSetWriteWordHandler(2, HwchampCtrlWriteWord); + SekClose(); + } + + return nRet; +} + +static INT32 HwchampExit() +{ + HwchampInputVal = 0; + + return System16Exit(); +} + +static INT32 HwchampScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029660; + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(HwchampInputVal); + } + + return System16Scan(nAction, pnMin);; +} + +static INT32 MvpInit() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0x3f2000, 0x3f2003, SM_WRITE); + SekSetWriteByteHandler(1, MvpWriteByte); + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x200000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x200000); + memset(System16Sprites, 0, 0x200000); + memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); + memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); + memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); + memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); + memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); + memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); + memcpy(System16Sprites + 0x0c0000, pTemp + 0x180000, 0x40000); + memcpy(System16Sprites + 0x1c0000, pTemp + 0x1c0000, 0x40000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 MvpjInit() +{ + System16CustomLoadRomDo = CustomLoadRom40000; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x200000 - 0x180000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0x3f0000, 0x3f0003, SM_WRITE); + SekSetWriteByteHandler(1, MvpjWriteByte); + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0x200000); + if (pTemp) { + memset(pTemp, 0, 0x200000); + memcpy(pTemp, System16Sprites, 0x200000); + memset(System16Sprites, 0, 0x200000); + memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0xc0000); + memcpy(System16Sprites + 0x100000, pTemp + 0x0c0000, 0xc0000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 PassshtInit() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xc00006, 0xc00007, SM_WRITE); + SekSetWriteByteHandler(1, PassshtWriteByte); + SekClose(); + } + + return nRet; +} + +static INT32 PassshtaInit() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xc00006, 0xc00007, SM_WRITE); + SekSetWriteByteHandler(1, PassshtWriteByte); + SekMapHandler(2, 0xc43000, 0xc43007, SM_READ); + SekSetReadByteHandler(2, PassshtaReadByte); + SekClose(); + } + + return nRet; +} + +static INT32 PassshtbInit() +{ + INT32 nRet = System16Init(); + +// System16SpriteXOffset = 114; + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xc46000, 0xc46031, SM_WRITE); + SekSetWriteWordHandler(1, PassshtbGfxWriteWord); + +// SekMapHandler(2, 0x842000, 0x842001, SM_READ); +// SekSetReadByteHandler(2, PassshtbReadByte); + +// SekMapHandler(2, 0xc42006, 0xc42007, SM_WRITE); +// SekSetWriteByteHandler(2, TetrisblSndWriteByte); + SekClose(); + + bSystem16BootlegRender = true; + } + + return nRet; +} + +void RiotcityMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); + SekMapMemory(System16TileRam , 0xfa0000, 0xfaffff, SM_READ); + SekMapMemory(System16TextRam , 0xfb0000, 0xfb0fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0xf40000, 0xf407ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0xf60000, 0xf60fff, SM_RAM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + SekSetReadByteHandler(0, RiotcityReadByte); + SekSetWriteByteHandler(0, RiotcityWriteByte); + SekSetWriteWordHandler(0, RiotcityWriteWord); + SekClose(); +} + +static INT32 RiotcityInit() +{ + System16Map68KDo = RiotcityMap68K; + System16CustomLoadRomDo = CustomLoadRom40000; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x1c0000 - 0x180000; + + INT32 nRet = System16Init(); + + if (!nRet) { + UINT8 *pTemp = (UINT8*)BurnMalloc(0x1c0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x1c0000); + memset(System16Sprites, 0, 0x1c0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x000000, 0x40000); + memcpy(System16Sprites + 0x100000, pTemp + 0x040000, 0x40000); + memcpy(System16Sprites + 0x040000, pTemp + 0x080000, 0x40000); + memcpy(System16Sprites + 0x140000, pTemp + 0x0c0000, 0x40000); + memcpy(System16Sprites + 0x080000, pTemp + 0x100000, 0x40000); + memcpy(System16Sprites + 0x180000, pTemp + 0x140000, 0x40000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +void RyukyuMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x300000, 0x3007ff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x300800, 0x300fff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x500000, 0x500fff, SM_RAM); + SekMapMemory(System16Ram , 0x200000, 0x203fff, SM_RAM); + SekSetReadWordHandler(0, RyukyuReadWord); + SekSetWriteWordHandler(0, RyukyuWriteWord); + SekSetReadByteHandler(0, System16BReadByte); + SekSetWriteByteHandler(0, RyukyuWriteByte); + SekClose(); +} + +static INT32 RyukyuInit() +{ + System16Map68KDo = RyukyuMap68K; + + return System16Init(); +} + +static INT32 SdibInit() +{ + System16MakeAnalogInputsDo = SdibMakeAnalogInputs; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, SdibReadByte); + SekMapHandler(1, 0x123406, 0x123407, SM_WRITE); + SekSetWriteByteHandler(1, SdibSoundWriteByte); + SekClose(); + } + + return nRet; +} + +static INT32 SdiblInit() +{ + System16MakeAnalogInputsDo = SdibMakeAnalogInputs; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, SdibReadByte); + SekMapHandler(1, 0x123406, 0x123407, SM_WRITE); + SekSetWriteByteHandler(1, SdibSoundWriteByte); + SekClose(); + } + + return nRet; +} + +static INT32 SdibExit() +{ + SdiTrack1X = 0; + SdiTrack1Y = 0; + SdiTrack2X = 0; + SdiTrack2Y = 0; + + return System16Exit(); +} + +static INT32 SdibScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029660; + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(SdiTrack1X); + SCAN_VAR(SdiTrack1Y); + SCAN_VAR(SdiTrack2X); + SCAN_VAR(SdiTrack2Y); + } + + return System16Scan(nAction, pnMin);; +} + +static INT32 SjryukoInit() +{ + System16BTileAlt = true; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetWriteByteHandler(0, SjryukoWriteByte); + SekSetReadByteHandler(0, SjryukoReadByte); + SekSetReadWordHandler(0, SjryukoReadWord); + SekClose(); + } + + return nRet; +} + +static INT32 SjryukoExit() +{ + MahjongInputNum = 0; + + return System16Exit(); +} + +static INT32 SjryukoScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029660; + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(MahjongInputNum); + } + + return System16Scan(nAction, pnMin);; +} + +static INT32 SnapperInit() +{ + System16Map68KDo = AtomicpMap68K; + + INT32 nRet = System16Init(); + + System16IgnoreVideoEnable = 1; + System16YM2413IRQInterval = 41; + + return nRet; +} + +static INT32 SonicbomInit() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0x123406, 0x123407, SM_WRITE); + SekSetWriteByteHandler(1, SonicbomWriteByte); + SekMapHandler(2, 0xc42000, 0xc42003, SM_READ); + SekSetReadWordHandler(2, SonicbomReadWord); + SekClose(); + } + + return nRet; +} + +static INT32 TetrisblInit() +{ + INT32 nRet = System16Init(); + + System16SpriteXOffset = 114; + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0x418000, 0x418031, SM_WRITE); + SekSetWriteWordHandler(1, TetrisblGfxWriteWord); + + SekMapHandler(2, 0xc42006, 0xc42007, SM_WRITE); + SekSetWriteByteHandler(2, TetrisblSndWriteByte); + SekClose(); + + bSystem16BootlegRender = true; + } + + return nRet; +} + +static INT32 TimescanInit() +{ + System16BTileAlt = true; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0x80000 - 0x40000; + + INT32 nRet = System16Init(); + + if (!nRet) { + UINT8 *pTemp = (UINT8*)BurnMalloc(0x80000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x40000); + memset(System16Sprites, 0, 0x80000); + memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); + memcpy(System16Sprites + 0x020000, pTemp + 0x10000, 0x20000); + memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); + memcpy(System16Sprites + 0x060000, pTemp + 0x30000, 0x20000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 ToryumonInit() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekSetReadByteHandler(0, ToryumonReadByte); + SekSetWriteByteHandler(0, ToryumonWriteByte); + SekMapMemory(System16Ram, 0xff0000, 0xff3fff, SM_RAM); + SekMapMemory(System16Ram, 0xff4000, 0xff7fff, SM_RAM); + SekMapMemory(System16Ram, 0xff8000, 0xffbfff, SM_RAM); + SekClose(); + } + + return nRet; +} + +void TturfMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x300000, 0x3007ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x500000, 0x500fff, SM_RAM); + SekMapMemory(System16Ram , 0x200000, 0x203fff, SM_RAM); + SekSetReadByteHandler(0, TturfReadByte); + SekSetWriteByteHandler(0, TturfWriteByte); + SekSetWriteWordHandler(0, System16BWriteWord); + SekClose(); +} + +void Tturf_Sim8751() +{ + // Inputs + *((UINT16*)(System16Ram + 0x01e6)) = BURN_ENDIAN_SWAP_INT16((UINT16)(~System16Input[0] << 8)); + *((UINT16*)(System16Ram + 0x01e8)) = BURN_ENDIAN_SWAP_INT16((UINT16)(~System16Input[1] << 8)); + *((UINT16*)(System16Ram + 0x01ea)) = BURN_ENDIAN_SWAP_INT16((UINT16)(~System16Input[2] << 8)); + + // Sound command + UINT16 temp = (System16Ram[0x01d0 + 1] << 8) | System16Ram[0x01d0 + 0]; + if ((temp & 0xff00) != 0x0000) { + System16SoundLatch = temp & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + *((UINT16*)(System16Ram + 0x01d0)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); + } +} + +static INT32 TturfInit() +{ + Simulate8751 = Tturf_Sim8751; + System16Map68KDo = TturfMap68K; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0xe0000 - 0x80000; + + INT32 nRet = System16Init(); + + if (!nRet) { + UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x80000); + memset(System16Sprites, 0, 0xe0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); + memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); + memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); + memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 TturfuInit() +{ + Simulate8751 = Tturf_Sim8751; + System16Map68KDo = TturfMap68K; + + return System16Init(); +} + +void Wb3_Sim8751() +{ + // Sound command + UINT16 temp = (System16Ram[0x0008 + 1] << 8) | System16Ram[0x0008 + 0]; + if ((temp & 0xff00) != 0x0000) { + System16SoundLatch = temp >> 8; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + *((UINT16*)(System16Ram + 0x0008)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); + } +} + +static INT32 Wb3Init() +{ + Simulate8751 = Wb3_Sim8751; + + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0xe0000 - 0x80000; + + INT32 nRet = System16Init(); + + if (!nRet) { + UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x80000); + memset(System16Sprites, 0, 0xe0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); + memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); + memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); + memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Wb32Init() +{ + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xdf0006, 0xdf0007, SM_WRITE); + SekSetWriteByteHandler(1, Wb3WriteByte); + SekClose(); + } + + return nRet; +} + +static INT32 Wb33Init() +{ + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0xe0000 - 0x80000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xdf0006, 0xdf0007, SM_WRITE); + SekSetWriteByteHandler(1, Wb3WriteByte); + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x80000); + memset(System16Sprites, 0, 0xe0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); + memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); + memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); + memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); + } else { + nRet = 1; + } + BurnFree(pTemp); + } + + return nRet; +} + +static INT32 Wb3bblInit() +{ + // Start off with some sprite rom and let the load routine add on the rest + System16SpriteRomSize = 0xe0000 - 0x80000; + + INT32 nRet = System16Init(); + + if (!nRet) { + SekOpen(0); + SekMapHandler(1, 0xc44000, 0xc46031, SM_WRITE); + SekSetWriteWordHandler(1, Wb3bblGfxWriteWord); + SekClose(); + + UINT8 *pTemp = (UINT8*)BurnMalloc(0xe0000); + if (pTemp) { + memcpy(pTemp, System16Sprites, 0x80000); + memset(System16Sprites, 0, 0xe0000); + memcpy(System16Sprites + 0x000000, pTemp + 0x00000, 0x20000); + memcpy(System16Sprites + 0x040000, pTemp + 0x20000, 0x20000); + memcpy(System16Sprites + 0x080000, pTemp + 0x40000, 0x20000); + memcpy(System16Sprites + 0x0c0000, pTemp + 0x60000, 0x20000); + } else { + nRet = 1; + } + BurnFree(pTemp); + + bSystem16BootlegRender = true; + } + + return nRet; +} + +void WrestwarMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0bffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0bffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x100000, 0x10ffff, SM_READ); + SekMapMemory(System16TextRam , 0x110000, 0x110fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x200000, 0x2007ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x300000, 0x300fff, SM_RAM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + SekSetReadByteHandler(0, System16BReadByte); + SekSetWriteByteHandler(0, System16BWriteByte); + SekMapHandler(1, 0x400000, 0x400003, SM_WRITE); + SekSetWriteByteHandler(1, WrestwarWriteByte); + SekMapHandler(2, 0x100000, 0x10ffff, SM_WRITE); + SekSetWriteByteHandler(2, WrestwarTileWriteByte); + SekSetWriteWordHandler(2, WrestwarTileWriteWord); + SekClose(); +} + +void Wrestwar_Sim8751() +{ + // System Inputs + *((UINT16*)(System16Ram + 0x2082)) = BURN_ENDIAN_SWAP_INT16((UINT16)~System16Input[0]); + + // Sound command + UINT16 temp = (System16Ram[0x208e + 1] << 8) | System16Ram[0x208e + 0]; + if ((temp & 0xff00) != 0x0000) { + System16SoundLatch = temp & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + *((UINT16*)(System16Ram + 0x208e)) = BURN_ENDIAN_SWAP_INT16((UINT16)(temp & 0xff)); + } +} + +static INT32 WrestwarInit() +{ + Simulate8751 = Wrestwar_Sim8751; + System16Map68KDo = WrestwarMap68K; + System16CustomLoadRomDo = CustomLoadRom40000; + + return System16Init(); +} + +static INT32 Wrestwar1Init() +{ + System16Map68KDo = WrestwarMap68K; + System16CustomLoadRomDo = CustomLoadRom40000; + + return System16Init(); +} + +/*==================================================== +Driver defs +====================================================*/ + +struct BurnDriver BurnDrvAceattac = { + "aceattac", NULL, NULL, NULL, "1988", + "Ace Attacker (FD1094 317-0059)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1094_ENC, GBF_SPORTSMISC, 0, + NULL, AceattacRomInfo, AceattacRomName, NULL, NULL, System16bDip3InputInfo, NULL, + System16Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvAliensyn = { + "aliensyn", NULL, NULL, NULL, "1987", + "Alien Syndrome (set 4, System 16B, unprotected)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_MAZE, 0, + NULL, AliensynRomInfo, AliensynRomName, NULL, NULL, System16bfire1InputInfo, AliensynDIPInfo, + AliensynInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAliensyn3 = { + "aliensyn3", "aliensyn", NULL, NULL, "1987", + "Alien Syndrome (set 3, System 16B, FD1089A 317-0033)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1089A_ENC, GBF_MAZE, 0, + NULL, Aliensyn3RomInfo, Aliensyn3RomName, NULL, NULL, System16bfire1InputInfo, AliensynDIPInfo, + Aliensyn3Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAliensynj = { + "aliensynj", "aliensyn", NULL, NULL, "1987", + "Alien Syndrome (set 6, Japan, new, System 16B, FD1089A 317-0033)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1089A_ENC, GBF_MAZE, 0, + NULL, AliensynjRomInfo, AliensynjRomName, NULL, NULL, System16bfire1InputInfo, AliensynjDIPInfo, + Aliensyn3Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAltbeast = { + "altbeast", NULL, NULL, NULL, "1988", + "Altered Beast (set 8, 8751 317-0078)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, + NULL, AltbeastRomInfo, AltbeastRomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, + AltbeastInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAltbeastj = { + "altbeastj", "altbeast", NULL, NULL, "1988", + "Juuouki (set 7, Japan, 8751 317-0077)\0", NULL, "Sega", "System 16B", + L"Juuoki (set 7, Japan, 8751 317-0077)\0\u7363\u738B\u8A18\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, + NULL, AltbeastjRomInfo, AltbeastjRomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, + AltbeastjInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAltbeast2 = { + "altbeast2", "altbeast", NULL, NULL, "1988", + "Altered Beast (set 2, MC-8123B 317-0066)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_MC8123_ENC, GBF_SCRFIGHT, 0, + NULL, Altbeast2RomInfo, Altbeast2RomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, + System16Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAltbeastj3 = { + "altbeastj3", "altbeast", NULL, NULL, "1988", + "Juuouki (set 3, Japan, FD1094 317-0068)\0", NULL, "Sega", "System 16B", + L"Juuoki (set 3, Japan, FD1094 317-0068)\0\u7363\u738B\u8A18\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, + NULL, Altbeastj3RomInfo, Altbeastj3RomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, + Altbeastj3Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAltbeast4 = { + "altbeast4", "altbeast", NULL, NULL, "1988", + "Altered Beast (set 4, MC-8123B 317-0066)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_MC8123_ENC, GBF_SCRFIGHT, 0, + NULL, Altbeast4RomInfo, Altbeast4RomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, + Altbeast4Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAltbeast5 = { + "altbeast5", "altbeast", NULL, NULL, "1988", + "Altered Beast (set 5, FD1094 317-0069)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, + NULL, Altbeast5RomInfo, Altbeast5RomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, + Altbeast4Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAltbeast6 = { + "altbeast6", "altbeast", NULL, NULL, "1988", + "Altered Beast (set 6, 8751 317-0076)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, + NULL, Altbeast6RomInfo, Altbeast6RomName, NULL, NULL, System16bfire3InputInfo, AltbeastDIPInfo, + Altbeast6Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAtomicp = { + "atomicp", NULL, NULL, NULL, "1990", + "Atomic Point (Korea)\0", NULL, "Philco", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_YM2413, GBF_MISC, 0, + NULL, AtomicpRomInfo, AtomicpRomName, NULL, NULL, AtomicpInputInfo, AtomicpDIPInfo, + AtomicpInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAurail = { + "aurail", NULL, NULL, NULL, "1990", + "Aurail (set 3, US, unprotected)\0", NULL, "Sega / Westone", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_VERSHOOT, 0, + NULL, AurailRomInfo, AurailRomName, NULL, NULL, System16bfire3InputInfo, AurailDIPInfo, + AurailInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAurail1 = { + "aurail1", "aurail", NULL, NULL, "1990", + "Aurail (set 2, World, FD1089B 317-0168)\0", NULL, "Sega / Westone", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1089B_ENC, GBF_VERSHOOT, 0, + NULL, Aurail1RomInfo, Aurail1RomName, NULL, NULL, System16bfire3InputInfo, AurailDIPInfo, + Aurail1Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvAurailj = { + "aurailj", "aurail", NULL, NULL, "1990", + "Aurail (set 1, Japan, FD1089A 317-0167)\0", NULL, "Sega / Westone", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1089A_ENC, GBF_VERSHOOT, 0, + NULL, AurailjRomInfo, AurailjRomName, NULL, NULL, System16bfire3InputInfo, AurailDIPInfo, + AurailjInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBayroute = { + "bayroute", NULL, NULL, NULL, "1989", + "Bay Route (set 3, World, FD1094 317-0116)\0", NULL, "Sunsoft / Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, BayrouteRomInfo, BayrouteRomName, NULL, NULL, System16bfire3InputInfo, BayrouteDIPInfo, + BayrouteInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBayroutej = { + "bayroutej", "bayroute", NULL, NULL, "1989", + "Bay Route (set 2, Japan, FD1094 317-0115)\0", NULL, "Sunsoft / Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, BayroutejRomInfo, BayroutejRomName, NULL, NULL, System16bfire3InputInfo, BayrouteDIPInfo, + BayrouteInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBayroute1 = { + "bayroute1", "bayroute", NULL, NULL, "1989", + "Bay Route (set 1, US, unprotected)\0", "No Sound, Missing Z80 Program ROM", "Sunsoft / Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_PLATFORM, 0, + NULL, Bayroute1RomInfo, Bayroute1RomName, NULL, NULL, System16bfire3InputInfo, BayrouteDIPInfo, + Bayroute1Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBlox16b = { + "blox16b", "bloxeed", NULL, NULL, "2008", + "Bloxeed (System 16B, PS2 data file)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5704_PS2, GBF_PUZZLE, 0, + NULL, Blox16bRomInfo, Blox16bRomName, NULL, NULL, System16bfire3InputInfo, Blox16bDIPInfo, + Blox16bInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBullet = { + "bullet", NULL, NULL, NULL, "1987", + "Bullet (FD1094 317-0041)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 3, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_VERSHOOT, 0, + NULL, BulletRomInfo, BulletRomName, NULL, NULL, BulletInputInfo, BulletDIPInfo, + BulletInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvCotton = { + "cotton", NULL, NULL, NULL, "1991", + "Cotton (set 3, World, FD1094 317-0181a)\0", NULL, "Sega / Success", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_HORSHOOT, 0, + NULL, CottonRomInfo, CottonRomName, NULL, NULL, System16bInputInfo, CottonDIPInfo, + CottonInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvCottonu = { + "cottonu", "cotton", NULL, NULL, "1991", + "Cotton (set 2, US, FD1094 317-0180)\0", NULL, "Sega / Success", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_HORSHOOT, 0, + NULL, CottonuRomInfo, CottonuRomName, NULL, NULL, System16bInputInfo, CottonDIPInfo, + CottonInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvCottonj = { + "cottonj", "cotton", NULL, NULL, "1991", + "Cotton (set 1, Japan, FD1094 317-0179a))\0", NULL, "Sega / Success", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_HORSHOOT, 0, + NULL, CottonjRomInfo, CottonjRomName, NULL, NULL, System16bInputInfo, CottonDIPInfo, + CottonInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDdux = { + "ddux", NULL, NULL, NULL, "1989", + "Dynamite Dux (set 2, FD1094 317-0096)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, + NULL, DduxRomInfo, DduxRomName, NULL, NULL, System16bInputInfo, DduxDIPInfo, + DduxInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDdux1 = { + "ddux1", "ddux", NULL, NULL, "1989", + "Dynamite Dux (set 1, 8751 317-0095)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, + NULL, Ddux1RomInfo, Ddux1RomName, NULL, NULL, System16bInputInfo, DduxDIPInfo, + Ddux1Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDduxbl = { + "dduxbl", "ddux", NULL, NULL, "1989", + "Dynamite Dux (bootleg)\0", NULL, "bootleg", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_INVERT_TILES | HARDWARE_SEGA_5358, GBF_SCRFIGHT, 0, + NULL, DduxblRomInfo, DduxblRomName, NULL, NULL, System16bInputInfo, DduxDIPInfo, + DduxblInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDunkshot = { + "dunkshot", NULL, NULL, NULL, "1986", + "Dunk Shot (FD1089 317-0022)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1089A_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, + NULL, DunkshotRomInfo, DunkshotRomName, NULL, NULL, DunkshotInputInfo, DunkshotDIPInfo, + DunkshotInit, DunkshotExit, System16BFrame, NULL, DunkshotScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvEswat = { + "eswat", NULL, NULL, NULL, "1989", + "E-Swat - Cyber Police (set 3, World, FD1094 317-0130)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, EswatRomInfo, EswatRomName, NULL, NULL, System16bfire3InputInfo, EswatDIPInfo, + EswatInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvEswatj = { + "eswatj", "eswat", NULL, NULL, "1989", + "E-Swat - Cyber Police (set 1, Japan, FD1094 317-0128)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, EswatjRomInfo, EswatjRomName, NULL, NULL, System16bfire3InputInfo, EswatDIPInfo, + EswatInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvEswatu = { + "eswatu", "eswat", NULL, NULL, "1989", + "E-Swat - Cyber Police (set 2, US, FD1094 317-0129)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, EswatuRomInfo, EswatuRomName, NULL, NULL, System16bfire3InputInfo, EswatDIPInfo, + EswatInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvEswatbl = { + "eswatbl", "eswat", NULL, NULL, "1989", + "E-Swat - Cyber Police (bootleg)\0", NULL, "bootleg", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797, GBF_PLATFORM, 0, + NULL, EswatblRomInfo, EswatblRomName, NULL, NULL, System16bfire3InputInfo, EswatDIPInfo, + EswatblInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvExctleag = { + "exctleag", NULL, NULL, NULL, "1989", + "Excite League (FD1094 317-0079)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, + NULL, ExctleagRomInfo, ExctleagRomName, NULL, NULL, ExctleagInputInfo, ExctleagDIPInfo, + ExctleagInit, ExctleagExit, System16BFrame, NULL, ExctleagScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFantzn2x = { + "fantzn2x", NULL, NULL, NULL, "2008", + "Fantasy Zone II - The Tears of Opa-Opa (System 16C)\0", NULL, "Sega / M2", "System 16C", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5704_PS2, GBF_HORSHOOT, 0, + NULL, Fantzn2xRomInfo, Fantzn2xRomName, NULL, NULL, System16bInputInfo, Fantzn2xDIPInfo, + Fantzn2xInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFantzn2xp = { + "fantzn2xp", "fantzn2x", NULL, NULL, "2008", + "Fantasy Zone II - The Tears of Opa-Opa (System 16C, prototype)\0", NULL, "Sega / M2", "System 16C", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5704_PS2, GBF_HORSHOOT, 0, + NULL, Fantzn2xpRomInfo, Fantzn2xpRomName, NULL, NULL, System16bInputInfo, Fantzn2xDIPInfo, + Fantzn2xInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFantzn2xps2 = { + "fantzn2xps2", "fantzn2x", NULL, NULL, "2008", + "Fantasy Zone II - The Tears of Opa-Opa (System 16C, PS2 data file)\0", NULL, "Sega / M2", "System 16C", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5704_PS2, GBF_HORSHOOT, 0, + NULL, Fantzn2xps2RomInfo, Fantzn2xps2RomName, NULL, NULL, System16bInputInfo, Fantzn2xDIPInfo, + Fantzn2xps2Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFantznta = { + "fantznta", "fantzn2x", NULL, NULL, "2008", + "Fantasy Zone Time Attack (System 16B, PS2 data file)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5704_PS2, GBF_HORSHOOT, 0, + NULL, FantzntaRomInfo, FantzntaRomName, NULL, NULL, System16bInputInfo, Fantzn2xDIPInfo, + FantzntaInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFpoint = { + "fpoint", NULL, NULL, NULL, "1989", + "Flash Point (set 2, Japan, FD1094 317-0127A)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_PUZZLE, 0, + NULL, FpointRomInfo, FpointRomName, NULL, NULL, System16bfire1InputInfo, FpointDIPInfo, + System16Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFpoint1 = { + "fpoint1", "fpoint", NULL, NULL, "1989", + "Flash Point (set 1, Japan, FD1094 317-0127A)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, + NULL, Fpoint1RomInfo, Fpoint1RomName, NULL, NULL, System16bfire1InputInfo, FpointDIPInfo, + System16Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFpointbl = { + "fpointbl", "fpoint", NULL, NULL, "1989", + "Flash Point (World, bootleg)\0", NULL, "bootleg", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_INVERT_TILES, GBF_PUZZLE, 0, + NULL, FpointblRomInfo, FpointblRomName, NULL, NULL, FpointblInputInfo, FpointDIPInfo, + FpointblInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFpointbj = { + "fpointbj", "fpoint", NULL, NULL, "1989", + "Flash Point (Japan, bootleg)\0", NULL, "bootleg", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_INVERT_TILES, GBF_PUZZLE, 0, + NULL, FpointbjRomInfo, FpointbjRomName, NULL, NULL, FpointblInputInfo, FpointDIPInfo, + FpointblInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGoldnaxe = { + "goldnaxe", NULL, NULL, NULL, "1989", + "Golden Axe (set 6, US, 8751 317-123A)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797, GBF_SCRFIGHT, 0, + NULL, GoldnaxeRomInfo, GoldnaxeRomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, + GoldnaxeInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGoldnaxe1 = { + "goldnaxe1", "goldnaxe", NULL, NULL, "1989", + "Golden Axe (set 1, World, FD1094 317-0110)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, + NULL, Goldnaxe1RomInfo, Goldnaxe1RomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, + Goldnaxe1Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGoldnaxe2 = { + "goldnaxe2", "goldnaxe", NULL, NULL, "1989", + "Golden Axe (set 2, US, 8751 317-0112)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, + NULL, Goldnaxe2RomInfo, Goldnaxe2RomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, + Goldnaxe2Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGoldnaxe3 = { + "goldnaxe3", "goldnaxe", NULL, NULL, "1989", + "Golden Axe (set 3, World, FD1094 317-0120)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, + NULL, Goldnaxe3RomInfo, Goldnaxe3RomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, + Goldnaxe3Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGoldnaxej = { + "goldnaxej", "goldnaxe", NULL, NULL, "1989", + "Golden Axe (set 4, Japan, FD1094 317-0121)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, + NULL, GoldnaxejRomInfo, GoldnaxejRomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, + Goldnaxe3Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGoldnaxeu = { + "goldnaxeu", "goldnaxe", NULL, NULL, "1989", + "Golden Axe (set 5, US, FD1094 317-0122)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_SCRFIGHT, 0, + NULL, GoldnaxeuRomInfo, GoldnaxeuRomName, NULL, NULL, System16bfire3InputInfo, GoldnaxeDIPInfo, + Goldnaxe1Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvHwchamp = { + "hwchamp", NULL, NULL, NULL, "1987", + "Heavyweight Champ\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_VSFIGHT, 0, + NULL, HwchampRomInfo, HwchampRomName, NULL, NULL, HwchampInputInfo, HwchampDIPInfo, + HwchampInit, HwchampExit, System16BFrame, NULL, HwchampScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvHwchampj = { + "hwchampj", "hwchamp", NULL, NULL, "1987", + "Heavyweight Champ (Japan, FD1094 317-0046)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_VSFIGHT, 0, + NULL, HwchampjRomInfo, HwchampjRomName, NULL, NULL, HwchampInputInfo, HwchampDIPInfo, + HwchampInit, HwchampExit, System16BFrame, NULL, HwchampScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMvp = { + "mvp", NULL, NULL, NULL, "1989", + "MVP (set 2, US, FD1094 317-0143)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797 | HARDWARE_SEGA_FD1094_ENC, GBF_SPORTSMISC, 0, + NULL, MvpRomInfo, MvpRomName, NULL, NULL, System16bfire3InputInfo, MvpDIPInfo, + MvpInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMvpj = { + "mvpj", "mvp", NULL, NULL, "1989", + "MVP (set 1, Japan, FD1094 317-0142)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_SPORTSMISC, 0, + NULL, MvpjRomInfo, MvpjRomName, NULL, NULL, System16bfire3InputInfo, MvpDIPInfo, + MvpjInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPasssht = { + "passsht", NULL, NULL, NULL, "1988", + "Passing Shot (World, 2 Players, FD1094 317-0080)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, + NULL, PassshtRomInfo, PassshtRomName, NULL, NULL, System16bfire4InputInfo, PassshtDIPInfo, + PassshtInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvPassshta = { + "passshta", "passsht", NULL, NULL, "1988", + "Passing Shot (World, 4 Players, FD1094 317-0074)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 4, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, + NULL, PassshtaRomInfo, PassshtaRomName, NULL, NULL, PassshtInputInfo, PassshtaDIPInfo, + PassshtaInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvPassshtj = { + "passshtj", "passsht", NULL, NULL, "1988", + "Passing Shot (Japan, 4 Players, FD1094 317-0070)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 4, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, + NULL, PassshtjRomInfo, PassshtjRomName, NULL, NULL, PassshtInputInfo, PassshtaDIPInfo, + PassshtaInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriverD BurnDrvPassshtb = { + "passshtb", "passsht", NULL, NULL, "1988", + "Passing Shot (bootleg, 2 Players)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, + NULL, PassshtbRomInfo, PassshtbRomName, NULL, NULL, PassshtInputInfo, PassshtDIPInfo, + PassshtbInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvRiotcity = { + "riotcity", NULL, NULL, NULL, "1991", + "Riot City (Japan)\0", NULL, "Sega / Westone", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, + NULL, RiotcityRomInfo, RiotcityRomName, NULL, NULL, System16bInputInfo, RiotcityDIPInfo, + RiotcityInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvRyukyu = { + "ryukyu", NULL, NULL, NULL, "1990", + "RyuKyu (Japan, FD1094 317-5023)\0", NULL, "Success / Sega", "System 16B", + L"RyuKyu \u7409\u7403 (Japan, FD1094 317-5023)\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, + NULL, RyukyuRomInfo, RyukyuRomName, NULL, NULL, RyukyuInputInfo, RyukyuDIPInfo, + RyukyuInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSdib = { + "sdib", "sdi", NULL, NULL, "1987", + "SDI - Strategic Defense Initiative (System 16B, FD1089A 317-0028)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1089A_ENC | HARDWARE_SEGA_5358, GBF_SHOOT, 0, + NULL, SdibRomInfo, SdibRomName, NULL, NULL, SdiInputInfo, SdibDIPInfo, + SdibInit, SdibExit, System16BFrame, NULL, SdibScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSdibl = { + "sdibl", "sdi", NULL, NULL, "1987", + "SDI - Strategic Defense Initiative (bootleg)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_SHOOT, 0, + NULL, SdiblRomInfo, SdiblRomName, NULL, NULL, SdiInputInfo, SdibDIPInfo, + SdiblInit, SdibExit, System16BFrame, NULL, SdibScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDefense = { + "defense", "sdi", NULL, NULL, "1987", + "Defense (System 16B, FD1089A 317-0028)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1089A_ENC | HARDWARE_SEGA_5358, GBF_SHOOT, 0, + NULL, DefenseRomInfo, DefenseRomName, NULL, NULL, SdiInputInfo, SdibDIPInfo, + SdibInit, SdibExit, System16BFrame, NULL, SdibScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvShinobi2 = { + "shinobi2", "shinobi", NULL, NULL, "1987", + "Shinobi (set 2, System 16B, FD1094 317-0049)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, Shinobi2RomInfo, Shinobi2RomName, NULL, NULL, System16bfire3InputInfo, ShinobiDIPInfo, + System16Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvShinobi3 = { + "shinobi3", "shinobi", NULL, NULL, "1987", + "Shinobi (set 3, System 16B, MC-8123B 317-0054)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_MC8123_ENC, GBF_PLATFORM, 0, + NULL, Shinobi3RomInfo, Shinobi3RomName, NULL, NULL, System16bfire3InputInfo, ShinobiDIPInfo, + System16Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvShinobi4 = { + "shinobi4", "shinobi", NULL, NULL, "1987", + "Shinobi (set 4, System 16B, MC-8123B 317-0054)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_MC8123_ENC, GBF_PLATFORM, 0, + NULL, Shinobi4RomInfo, Shinobi4RomName, NULL, NULL, System16bfire3InputInfo, ShinobiDIPInfo, + System16Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvShinobi5 = { + "shinobi5", "shinobi", NULL, NULL, "1987", + "Shinobi (set 5, System 16B, unprotected)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_PLATFORM, 0, + NULL, Shinobi5RomInfo, Shinobi5RomName, NULL, NULL, System16bfire3InputInfo, ShinobiDIPInfo, + System16Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSjryuko = { + "sjryuko", NULL, NULL, NULL, "1987", + "Sukeban Jansi Ryuko (set 2, System 16B, FD1089B 317-5021)\0", NULL, "White Board", "System 16B", + L"Sukeban Jansi Ryuko (set 2, System 16B, FD1089B 317-5021)\0\u30B9\u30B1\u30D0\u30F3\u96C0\u58EB \u7ADC\u5B50\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1089B_ENC | HARDWARE_SEGA_5358, GBF_MAHJONG, 0, + NULL, SjryukoRomInfo, SjryukoRomName, NULL, NULL, SjryukoInputInfo, SjryukoDIPInfo, + SjryukoInit, SjryukoExit, System16BFrame, NULL, SjryukoScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSnapper = { + "snapper", NULL, NULL, NULL, "1990", + "Snapper (Korea)\0", NULL, "Philko", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_YM2413, GBF_MISC, 0, + NULL, SnapperRomInfo, SnapperRomName, NULL, NULL, SnapperInputInfo, SnapperDIPInfo, + SnapperInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSonicbom = { + "sonicbom", NULL, NULL, NULL, "1987", + "Sonic Boom (FD1094 317-0053)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1094_ENC, GBF_VERSHOOT, 0, + NULL, SonicbomRomInfo, SonicbomRomName, NULL, NULL, System16bInputInfo, SonicbomDIPInfo, + SonicbomInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvSuprleag = { + "suprleag", NULL, NULL, NULL, "1987", + "Super League (FD1094 317-0045)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_FD1094_ENC | HARDWARE_SEGA_5358, GBF_SPORTSMISC, 0, + NULL, SuprleagRomInfo, SuprleagRomName, NULL, NULL, ExctleagInputInfo, ExctleagDIPInfo, + ExctleagInit, ExctleagExit, System16BFrame, NULL, ExctleagScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTetris1 = { + "tetris1", "tetris", NULL, NULL, "1988", + "Tetris (set 1, Japan, System 16B, FD1094 317-0091)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, + NULL, Tetris1RomInfo, Tetris1RomName, NULL, NULL, System16bfire1InputInfo, TetrisDIPInfo, + System16Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTetris2 = { + "tetris2", "tetris", NULL, NULL, "1988", + "Tetris (set 2, Japan, System 16B, FD1094 317-0092)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PUZZLE, 0, + NULL, Tetris2RomInfo, Tetris2RomName, NULL, NULL, System16bfire1InputInfo, TetrisDIPInfo, + System16Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTetrisbl = { + "tetrisbl", "tetris", NULL, NULL, "1988", + "Tetris (bootleg)\0", NULL, "bootleg", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B, GBF_PUZZLE, 0, + NULL, TetrisblRomInfo, TetrisblRomName, NULL, NULL, System16bfire1InputInfo, TetrisDIPInfo, + TetrisblInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTimescan = { + "timescan", NULL, NULL, NULL, "1987", + "Time Scanner (set 2, System 16B)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_PINBALL, 0, + NULL, TimescanRomInfo, TimescanRomName, NULL, NULL, System16bDip3InputInfo, TimescanDIPInfo, + TimescanInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvToryumon = { + "toryumon", NULL, NULL, NULL, "1994", + "Toryumon\0", NULL, "Sega / Westone", "System 16B", + L"Toryumon\0\u767B\u9F8D\u9580\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5797, GBF_PUZZLE, 0, + NULL, ToryumonRomInfo, ToryumonRomName, NULL, NULL, System16bfire1InputInfo, ToryumonDIPInfo, + ToryumonInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTturf = { + "tturf", NULL, NULL, NULL, "1989", + "Tough Turf (set 2, Japan, 8751 317-0104)\0", "No Sound, Missing Z80 Program", "Sega / Sunsoft", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, + NULL, TturfRomInfo, TturfRomName, NULL, NULL, System16bfire3InputInfo, TturfDIPInfo, + TturfInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTturfu = { + "tturfu", "tturf", NULL, NULL, "1989", + "Tough Turf (set 1, US, 8751 317-0099)\0", NULL, "Sega / Sunsoft", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358, GBF_SCRFIGHT, 0, + NULL, TturfuRomInfo, TturfuRomName, NULL, NULL, System16bfire3InputInfo, TturfDIPInfo, + TturfuInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWb3 = { + "wb3", NULL, NULL, NULL, "1988", + "Wonder Boy III - Monster Lair (set 5, World, System 16B, 8751 317-0098)\0", NULL, "Sega / Westone", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_PLATFORM, 0, + NULL, Wb3RomInfo, Wb3RomName, NULL, NULL, System16bInputInfo, Wb3DIPInfo, + Wb3Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWb32 = { + "wb32", "wb3", NULL, NULL, "1988", + "Wonder Boy III - Monster Lair (set 2, Japan, System 16B, FD1094 317-0085)\0", NULL, "Sega / Westone", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5358 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, Wb32RomInfo, Wb32RomName, NULL, NULL, System16bInputInfo, Wb3DIPInfo, + Wb32Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWb33 = { + "wb33", "wb3", NULL, NULL, "1988", + "Wonder Boy III - Monster Lair (set 3, World, System 16B, FD1094 317-0089)\0", NULL, "Sega / Westone", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, Wb33RomInfo, Wb33RomName, NULL, NULL, System16bInputInfo, Wb3DIPInfo, + Wb33Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWb34 = { + "wb34", "wb3", NULL, NULL, "1988", + "Wonder Boy III - Monster Lair (set 4, Japan, System 16B, FD1094 317-0087)\0", NULL, "Sega / Westone", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_PLATFORM, 0, + NULL, Wb34RomInfo, Wb34RomName, NULL, NULL, System16bInputInfo, Wb3DIPInfo, + Wb33Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriverD BurnDrvWb3bbl = { + "wb3bbl", "wb3", NULL, NULL, "1988", + "Wonder Boy III - Monster Lair (bootleg)\0", NULL, "bootleg", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_INVERT_TILES, GBF_PLATFORM, 0, + NULL, Wb3bblRomInfo, Wb3bblRomName, NULL, NULL, System16bInputInfo, Wb3DIPInfo, + Wb3bblInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvWrestwar = { + "wrestwar", NULL, NULL, NULL, "1988", + "Wrestle War (set 3, World, 8751 317-0103)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521, GBF_VSFIGHT, 0, + NULL, WrestwarRomInfo, WrestwarRomName, NULL, NULL, System16bInputInfo, WrestwarDIPInfo, + WrestwarInit, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvWrestwar1 = { + "wrestwar1", "wrestwar", NULL, NULL, "1988", + "Wrestle War (set 1, Japan, FD1094 317-0090)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_VSFIGHT, 0, + NULL, Wrestwar1RomInfo, Wrestwar1RomName, NULL, NULL, System16bInputInfo, WrestwarDIPInfo, + Wrestwar1Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvWrestwar2 = { + "wrestwar2", "wrestwar", NULL, NULL, "1988", + "Wrestle War (set 2, World, FD1094 317-0102)\0", NULL, "Sega", "System 16B", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_5521 | HARDWARE_SEGA_FD1094_ENC, GBF_VSFIGHT, 0, + NULL, Wrestwar2RomInfo, Wrestwar2RomName, NULL, NULL, System16bInputInfo, WrestwarDIPInfo, + Wrestwar1Init, System16Exit, System16BFrame, NULL, System16Scan, + NULL, 0x1800, 224, 320, 3, 4 +}; + +// ISG Selection Master Type 2006 hardware + +static UINT16 IsgsmCartAddrLatch; +static UINT32 IsgsmCartAddr; +static INT32 IsgsmType = 0; +static UINT32 IsgsmAddr; +static UINT8 IsgsmMode; +static UINT16 IsgsmAddrLatch; +static UINT32 IsgsmSecurity; +static UINT16 IsgsmSecurityLatch; +static UINT8 IsgsmRleControlPosition = 8; +static UINT8 IsgsmRleControlByte; +static INT32 IsgsmRleLatched; +static UINT8 IsgsmRleByte; +static UINT8 IsgsmReadXor; +static UINT32 nCartSize; +static INT32 GameRomMapped = 0; + +typedef UINT32 (*isgsm_security_callback)(UINT32 input); +isgsm_security_callback IsgsmSecurityCallback; + +static INT32 IsgsmTilePlaneOffsets[3] = { 0x200000, 0x100000, 0 }; +static INT32 IsgsmTileXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 IsgsmTileYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; + +static struct BurnDIPInfo ShinfzDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfc, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x13, 0x01, 0x0c, 0x08, "2" }, + {0x13, 0x01, 0x0c, 0x0c, "3" }, + {0x13, 0x01, 0x0c, 0x04, "4" }, + {0x13, 0x01, 0x0c, 0x00, "240" }, + + {0 , 0xfe, 0 , 4 , "Extra Ship Cost" }, + {0x13, 0x01, 0x30, 0x30, "5000" }, + {0x13, 0x01, 0x30, 0x20, "10000" }, + {0x13, 0x01, 0x30, 0x10, "15000" }, + {0x13, 0x01, 0x30, 0x00, "20000" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x13, 0x01, 0xc0, 0x80, "Easy" }, + {0x13, 0x01, 0xc0, 0xc0, "Normal" }, + {0x13, 0x01, 0xc0, 0x40, "Hard" }, + {0x13, 0x01, 0xc0, 0x00, "Hardest" }, + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 3 , "Game Select" }, + {0x15, 0x01, 0x03, 0x00, "Shinobi Ninja Game" }, + {0x15, 0x01, 0x03, 0x01, "FZ-2006 Game I" }, + {0x15, 0x01, 0x03, 0x02, "FZ-2006 Game II" }, +}; + +STDDIPINFO(Shinfz) + +static struct BurnDIPInfo TetrbxDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0x00, NULL }, + + // Dip 1 + + // Dip 2 + + // Dip 3 + {0 , 0xfe, 0 , 3 , "Game Select" }, + {0x15, 0x01, 0x03, 0x00, "Tetris" }, + {0x15, 0x01, 0x03, 0x01, "Tetris II (Blox)" }, + {0x15, 0x01, 0x03, 0x02, "Tetris Turbo" }, +}; + +STDDIPINFO(Tetrbx) + +static struct BurnRomInfo emptyRomDesc[] = { + { "", 0, 0, 0 }, +}; + +static struct BurnRomInfo IsgsmRomDesc[] = { + { "ism2006v00.u1", 0x020000, 0x2292585c, BRF_ESS | BRF_PRG | BRF_BIOS }, +}; + +STD_ROM_PICK(Isgsm) +STD_ROM_FN(Isgsm) + +static struct BurnRomInfo ShinfzRomDesc[] = { + { "shin06.u13", 0x200000, 0x39d773e9, BRF_ESS | BRF_PRG }, +}; + +STDROMPICKEXT(Shinfz, Shinfz, Isgsm) +STD_ROM_FN(Shinfz) + +static struct BurnRomInfo TetrbxRomDesc[] = { + { "tetr06.u13", 0x080000, 0x884dd693, BRF_ESS | BRF_PRG }, +}; + +STDROMPICKEXT(Tetrbx, Tetrbx, Isgsm) +STD_ROM_FN(Tetrbx) + +static UINT32 ShinfzSecurity(UINT32 input) +{ + return BITSWAP32(input, 19, 20, 25, 26, 15, 0, 16, 2, 8, 9, 13, 14, 31, 21, 7, 18, 11, 30, 22, 17, 3, 4, 12, 28, 29, 5, 27, 10, 23, 24, 1, 6); +} + +static UINT32 TetrbxSecurity(UINT32 input) +{ + return input; +} + +UINT8 __fastcall IsgsmReadByte(UINT32 a) +{ + switch (a) { + case 0xc41001: { + return 0xff - System16Input[0]; + } + + case 0xc41003: { + return 0xff - System16Input[1]; + } + + case 0xc41007: { + return 0xff - System16Input[2]; + } + + case 0xc42001: { + return System16Dip[0]; + } + + case 0xc42003: { + return System16Dip[1]; + } + + case 0xe80001: { + UINT32 Address; + UINT8 Data; + + IsgsmCartAddr++; + Address = (IsgsmCartAddr & (nCartSize - 1)); + Data = System16Rom[(0x100000 + Address) ^ 1] ^ IsgsmReadXor; + + return Data; + } + + case 0xe80003: { + return System16Dip[2]; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Read Byte -> 0x%06X\n"), a); +#endif + + return 0xff; +} + +void __fastcall IsgsmWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16BTileByteWrite((a - 0x400000) ^ 1, d); + return; + } + + switch (a) { + case 0x3f0001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3f0003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3f2001: { + if (System16TileBanks[0] != (d & 0x07)) { + System16TileBanks[0] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0x3f2003: { + if (System16TileBanks[1] != (d & 0x07)) { + System16TileBanks[1] = d & 0x07; + System16RecalcBgTileMap = 1; + System16RecalcBgAltTileMap = 1; + System16RecalcFgTileMap = 1; + System16RecalcFgAltTileMap = 1; + } + return; + } + + case 0xc40001: { + System16VideoEnable = d & 0x20; + System16ScreenFlip = d & 0x40; + return; + } + + case 0xc43001: { + // ???? + return; + } + + case 0xe00001: { + UINT8 *pDest = 0; + int AddressMask = 0; + + switch (IsgsmType & 0x0f) { + case 0x00: { + pDest = System16Sprites; + AddressMask = 0x1fffff; + break; + } + + case 0x01: { + pDest = System16TempGfx; + AddressMask = 0xfffff; + break; + } + + case 0x02: { + pDest = System16Z80Rom; + AddressMask = 0x3ffff; + break; + } + + case 0x03: { + pDest = System16Rom + 0x300000; + AddressMask = 0xfffff; + break; + } + } + + if ((IsgsmType & 0x10) == 0x00) { + switch (IsgsmType & 0xe0) { + case 0x00: d = BITSWAP08(d, 0, 7, 6, 5, 4, 3, 2, 1); break; + case 0x20: d = BITSWAP08(d, 7, 6, 5, 4, 3, 2, 1, 0); break; + case 0x40: d = BITSWAP08(d, 6, 5, 4, 3, 2, 1, 0, 7); break; + case 0x60: d = BITSWAP08(d, 5, 4, 3, 2, 1, 0, 7, 6); break; + case 0x80: d = BITSWAP08(d, 4, 3, 2, 1, 0, 7, 6, 5); break; + case 0xa0: d = BITSWAP08(d, 3, 2, 1, 0, 7, 6, 5, 4); break; + case 0xc0: d = BITSWAP08(d, 2, 1, 0, 7, 6, 5, 4, 3); break; + case 0xe0: d = BITSWAP08(d, 1, 0, 7, 6, 5, 4, 3, 2); break; + } + } + + if (pDest) { + INT32 BytesToWrite; + BytesToWrite = 1; + + if (IsgsmMode & 0x04) { + if (!IsgsmRleLatched) { + if (IsgsmRleControlPosition == 8) { + IsgsmRleControlByte = d; + IsgsmRleControlPosition = 0; + BytesToWrite = 0; + } else { + if (((IsgsmRleControlByte << IsgsmRleControlPosition) & 0x80) == 0) { + IsgsmRleByte = d; + IsgsmRleLatched = 1; + } else { + BytesToWrite = 1; + } + + IsgsmRleControlPosition++; + } + } else { + IsgsmRleLatched = 0; + BytesToWrite = d + 2; + d = IsgsmRleByte; + } + } + + for (INT32 i = 0; i < BytesToWrite; i++) { + UINT8 Byte = 0; + + if (IsgsmMode & 0x08) { + IsgsmAddr++; + IsgsmAddr &= 0xfffffff; + } else { + IsgsmAddr--; + IsgsmAddr &= 0xfffffff; + } + + switch (IsgsmMode & 0x03) { + case 0x00: Byte = d; break; + case 0x01: Byte = pDest[IsgsmAddr & AddressMask] ^ d; break; + case 0x02: Byte = pDest[IsgsmAddr & AddressMask] | d; break; + case 0x03: Byte = pDest[IsgsmAddr & AddressMask] & d; break; + } + + if ((IsgsmType & 0x10) == 0x10) { + switch (IsgsmType & 0xe0) { + case 0x00: Byte = BITSWAP08(Byte, 0, 7, 6, 5, 4, 3, 2, 1); break; + case 0x20: Byte = BITSWAP08(Byte, 7, 6, 5, 4, 3, 2, 1, 0); break; + case 0x40: Byte = BITSWAP08(Byte, 6, 5, 4, 3, 2, 1, 0, 7); break; + case 0x60: Byte = BITSWAP08(Byte, 5, 4, 3, 2, 1, 0, 7, 6); break; + case 0x80: Byte = BITSWAP08(Byte, 4, 3, 2, 1, 0, 7, 6, 5); break; + case 0xa0: Byte = BITSWAP08(Byte, 3, 2, 1, 0, 7, 6, 5, 4); break; + case 0xc0: Byte = BITSWAP08(Byte, 2, 1, 0, 7, 6, 5, 4, 3); break; + case 0xe0: Byte = BITSWAP08(Byte, 1, 0, 7, 6, 5, 4, 3, 2); break; + } + } + + if ((IsgsmType & 0x0f) == 0x01) { + if (IsgsmAddr < System16TileRomSize) { + pDest[IsgsmAddr] = Byte; + GfxDecodeSingle((IsgsmAddr & 0x1ffff) / 8, 3, 8, 8, IsgsmTilePlaneOffsets, IsgsmTileXOffsets, IsgsmTileYOffsets, 0x40, System16TempGfx, System16Tiles); + } + } else { + pDest[IsgsmAddr & AddressMask] = Byte; + } + } + } + + return; + } + + case 0xe00003: { + IsgsmType = d; + return; + } + + case 0xfe0007: { + System16SoundLatch = d & 0xff; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + + case 0xfe0009: { + if (d == 0) { + ZetOpen(0); + ZetReset(); + ZetClose(); + System16Z80Enable = true; + } + + if (d == 1) { + ZetOpen(0); + ZetReset(); + ZetClose(); + System16Z80Enable = false; + } + + return; + } + + case 0xfe000b: { + SekMapMemory(System16Rom + 0x300000, 0x000000, 0x0fffff, SM_ROM); + GameRomMapped = 1; + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Byte -> 0x%06X, 0x%02X\n"), a, d); +#endif +} + +UINT16 __fastcall IsgsmReadWord(UINT32 a) +{ + switch (a) { + case 0xe80008: { + return (IsgsmSecurity >> 16) & 0xffff; + } + + case 0xe8000a: { + return IsgsmSecurity & 0xffff; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Read Word -> 0x%06X\n"), a); +#endif + + return 0xffff; +} + +void __fastcall IsgsmWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x400000 && a <= 0x40ffff) { + System16BTileWordWrite(a - 0x400000, d); + return; + } + + switch (a) { + case 0xe00004: { + IsgsmAddrLatch = d; + return; + } + + case 0xe00006: { + IsgsmMode = (IsgsmAddrLatch & 0xf000) >> 12; + IsgsmAddr = d | ((IsgsmAddrLatch & 0x0fff) << 16); + + IsgsmRleControlPosition = 8; + IsgsmRleControlByte = 0; + IsgsmRleLatched = 0; + return; + } + + case 0xe80004: { + IsgsmCartAddrLatch = d; + return; + } + + case 0xe80006: { + IsgsmCartAddr = d | IsgsmCartAddrLatch << 16; + return; + } + + case 0xe80008: { + IsgsmSecurityLatch = d; + return; + } + + case 0xe8000a: { + IsgsmSecurity = d | IsgsmSecurityLatch << 16; + if (IsgsmSecurityCallback) IsgsmSecurity = IsgsmSecurityCallback(IsgsmSecurity); + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68000 Write Word -> 0x%06X, 0x%04X\n"), a, d); +#endif +} + +static void IsgsmMap68K() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(System16ExtraRam , 0x200000, 0x23ffff, SM_RAM); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); + SekMapMemory(System16Rom + 0x100000 , 0xee0000, 0xefffff, SM_ROM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + SekSetReadWordHandler(0, IsgsmReadWord); + SekSetWriteWordHandler(0, IsgsmWriteWord); + SekSetReadByteHandler(0, IsgsmReadByte); + SekSetWriteByteHandler(0, IsgsmWriteByte); + SekClose(); +} + +static INT32 IsgsmInit() +{ + System16RomSize = 0x400000; + System16TileRomSize = 0x60000; + System16SpriteRomSize = 0x200000; + System16UPD7759DataSize = 0x30000; + + System16Map68KDo = IsgsmMap68K; + + INT32 nRet = System16Init(); + + if (!nRet) { + memset(System16Rom, 0, 0x400000); + + // Load and Decrypt BIOS + UINT16 *pTemp = (UINT16*)BurnMalloc(0x20000); + memset(pTemp, 0, 0x20000); + UINT16 *Rom = (UINT16*)System16Rom; + + nRet = BurnLoadRom(System16Rom, 0x80, 1); if (nRet) return 1; + + for (UINT32 i = 0; i < 0x10000; i++) { + pTemp[i ^ 0x4127] = BITSWAP16(Rom[i], 6, 14, 4, 2, 12, 10, 8, 0, 1, 9, 11, 13, 3, 5, 7, 15); + } + + memcpy(Rom, pTemp, 0x20000); + BurnFree(pTemp); + + // Load program ROM + nRet = BurnLoadRom(System16Rom + 0x100000, 0, 1); if (nRet) return 1; + + System16TempGfx = (UINT8*)BurnMalloc(System16TileRomSize); + memset(System16TempGfx, 0, System16TileRomSize); + memset(System16Tiles, 0, System16NumTiles * 8 * 8); + memset(System16Sprites, 0, System16TileRomSize); + + System16UPD7759Data = (UINT8*)(System16Z80Rom + 0x10000); + } + + System16ClockSpeed = 16000000; + + return nRet; +} + +static INT32 ShinfzInit() +{ + INT32 nRet = IsgsmInit(); + + if (!nRet) { + nCartSize = 0x200000; + UINT16 *pTemp = (UINT16*)BurnMalloc(0x200000); + memset(pTemp, 0, 0x200000); + UINT16 *Rom = (UINT16*)(System16Rom + 0x100000); + + for (UINT32 i = 0; i < 0x100000; i++) { + pTemp[i ^ 0x68956] = BITSWAP16(Rom[i], 8, 4, 12, 3, 6, 7, 1, 0, 15, 11, 5, 14, 10, 2, 9, 13); + } + + memcpy(Rom, pTemp, 0x200000); + BurnFree(pTemp); + + IsgsmReadXor = 0x66; + IsgsmSecurityCallback = ShinfzSecurity; + } + + return nRet; +} + +static INT32 TetrbxInit() +{ + INT32 nRet = IsgsmInit(); + + if (!nRet) { + nCartSize = 0x80000; + UINT16 *pTemp = (UINT16*)BurnMalloc(nCartSize); + memset(pTemp, 0, nCartSize); + UINT16 *Rom = (UINT16*)(System16Rom + 0x100000); + + for (UINT32 i = 0; i < nCartSize >> 1; i++) { + pTemp[i ^ 0x2a6e6] = BITSWAP16(Rom[i], 4, 0, 12, 5, 7, 3, 1, 14, 10, 11, 9, 6, 15, 2, 13, 8); + } + + memcpy(Rom, pTemp, nCartSize); + BurnFree(pTemp); + + IsgsmReadXor = 0x73; + IsgsmSecurityCallback = TetrbxSecurity; + } + + return nRet; +} + +static INT32 IsgsmExit() +{ + INT32 nRet = System16Exit(); + + BurnFree(System16TempGfx); + + IsgsmCartAddrLatch = 0; + IsgsmCartAddr = 0; + IsgsmType = 0; + IsgsmAddr = 0; + IsgsmMode = 0; + IsgsmAddrLatch = 0; + IsgsmSecurity = 0; + IsgsmSecurityLatch = 0; + IsgsmRleControlPosition = 0; + IsgsmRleControlByte = 0; + IsgsmRleLatched = 0; + IsgsmRleByte = 0; + IsgsmReadXor = 0; + nCartSize = 0; + IsgsmSecurityCallback = NULL; + GameRomMapped = 0; + + return nRet; +} + +static INT32 IsgsmScan(INT32 nAction,INT32 *pnMin) +{ + if (pnMin != NULL) { + *pnMin = 0x029719; + } + + struct BurnArea ba; + + if (nAction & ACB_DRIVER_DATA) { + memset(&ba, 0, sizeof(ba)); + ba.Data = System16Sprites; + ba.nLen = System16SpriteRomSize - 1; + ba.nAddress = 0; + ba.szName = "SpriteROM"; + BurnAcb(&ba); + + memset(&ba, 0, sizeof(ba)); + ba.Data = System16TempGfx; + ba.nLen = System16TileRomSize - 1; + ba.nAddress = 0; + ba.szName = "TileROM"; + BurnAcb(&ba); + + memset(&ba, 0, sizeof(ba)); + ba.Data = System16Z80Rom; + ba.nLen = 0x3ffff; + ba.nAddress = 0; + ba.szName = "Z80ROM"; + BurnAcb(&ba); + + memset(&ba, 0, sizeof(ba)); + ba.Data = System16Rom + 0x300000; + ba.nLen = 0xfffff; + ba.nAddress = 0; + ba.szName = "GameROM"; + BurnAcb(&ba); + + SCAN_VAR(IsgsmCartAddrLatch); + SCAN_VAR(IsgsmCartAddr); + SCAN_VAR(IsgsmType); + SCAN_VAR(IsgsmAddr); + SCAN_VAR(IsgsmMode); + SCAN_VAR(IsgsmAddrLatch); + SCAN_VAR(IsgsmSecurity); + SCAN_VAR(IsgsmSecurityLatch); + SCAN_VAR(IsgsmRleControlPosition); + SCAN_VAR(IsgsmRleControlByte); + SCAN_VAR(IsgsmRleLatched); + SCAN_VAR(IsgsmRleByte); + SCAN_VAR(GameRomMapped); + + if (nAction & ACB_WRITE) { + if (GameRomMapped) { + SekOpen(0); + SekMapMemory(System16Rom + 0x300000, 0x000000, 0x0fffff, SM_ROM); + SekClose(); + } + + for (UINT32 i = 0; i < System16TileRomSize; i++) { + GfxDecodeSingle((i & 0x1ffff) / 8, 3, 8, 8, IsgsmTilePlaneOffsets, IsgsmTileXOffsets, IsgsmTileYOffsets, 0x40, System16TempGfx, System16Tiles); + } + } + } + + return System16Scan(nAction, pnMin); +} + +struct BurnDriver BurnDrvIsgsm = { + "isgsm", NULL, NULL, NULL, "2006", + "ISG Selection Master Type 2006 System BIOS\0", "BIOS only", "ISG", "ISG Selection Master Type 2006", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_BOARDROM, 0, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_ISGSM | HARDWARE_SEGA_5521, GBF_BIOS, 0, + NULL, IsgsmRomInfo, IsgsmRomName, NULL, NULL, System16bDip3InputInfo, NULL, + IsgsmInit, IsgsmExit, System16BFrame, NULL, IsgsmScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvShinfz = { + "shinfz", NULL, "isgsm", NULL, "2006", + "Shinobi / FZ-2006 (Korean System 16 bootleg) (ISG Selection Master Type 2006)\0", NULL, "ISG", "ISG Selection Master Type 2006", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_ISGSM | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, + NULL, ShinfzRomInfo, ShinfzRomName, NULL, NULL, System16bDip3InputInfo, ShinfzDIPInfo, + ShinfzInit, IsgsmExit, System16BFrame, NULL, IsgsmScan, + NULL, 0x1800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTetrbx = { + "tetrbx", NULL, "isgsm", NULL, "2006", + "Tetris / Bloxeed (Korean System 16 bootleg) (ISG Selection Master Type 2006)\0", NULL, "ISG", "ISG Selection Master Type 2006", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_SEGA_SYSTEM16B | HARDWARE_SEGA_ISGSM | HARDWARE_SEGA_5521, GBF_SCRFIGHT, 0, + NULL, TetrbxRomInfo, TetrbxRomName, NULL, NULL, System16bDip3InputInfo, TetrbxDIPInfo, + TetrbxInit, IsgsmExit, System16BFrame, NULL, IsgsmScan, + NULL, 0x1800, 320, 224, 4, 3 +}; diff --git a/src/burn/drv/sega/sys16_run.cpp b/src/burn/drv/sega/sys16_run.cpp index 44b4ca8b6..a5439a606 100644 --- a/src/burn/drv/sega/sys16_run.cpp +++ b/src/burn/drv/sega/sys16_run.cpp @@ -1,3467 +1,3458 @@ -#include "sys16.h" -#include "dac.h" -#include "i8039.h" -#include "mc8123.h" -#include "upd7759.h" -#include "segapcm.h" - -UINT8 System16InputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 System16InputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 System16InputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 System16InputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 System16InputPort4[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 System16InputPort5[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 System16InputPort6[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -UINT8 System16Gear = 0; -INT32 System16AnalogPort0 = 0; -INT32 System16AnalogPort1 = 0; -INT32 System16AnalogPort2 = 0; -INT32 System16AnalogPort3 = 0; -INT32 System16AnalogPort4 = 0; -INT32 System16AnalogPort5 = 0; -INT32 System16AnalogSelect = 0; -UINT8 System16Dip[3] = {0, 0, 0}; -UINT8 System16Input[7] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -UINT8 System16Reset = 0; - -UINT8 *Mem = NULL; -UINT8 *MemEnd = NULL; -UINT8 *RamStart = NULL; -UINT8 *RamEnd = NULL; -UINT8 *System16Rom = NULL; -UINT8 *System16Code = NULL; -UINT8 *System16Rom2 = NULL; -UINT8 *System16Rom3 = NULL; -UINT8 *System16Z80Rom = NULL; -UINT8 *System16Z80Code = NULL; -UINT8 *System16Z80Rom2 = NULL; -UINT8 *System16Z80Rom3 = NULL; -UINT8 *System16Z80Rom4 = NULL; -UINT8 *System167751Prog = NULL; -UINT8 *System167751Data = NULL; -UINT8 *System16UPD7759Data = NULL; -UINT8 *System16PCMData = NULL; -UINT8 *System16PCM2Data = NULL; -UINT8 *System16RF5C68Data = NULL; -UINT8 *System16Prom = NULL; -UINT8 *System16Key = NULL; -UINT8 *System16Ram = NULL; -UINT8 *System16ExtraRam = NULL; -UINT8 *System16ExtraRam2 = NULL; -UINT8 *System16ExtraRam3 = NULL; -UINT8 *System16BackupRam = NULL; -UINT8 *System16BackupRam2 = NULL; -UINT8 *System16Z80Ram = NULL; -UINT8 *System16Z80Ram2 = NULL; -UINT8 *System16TileRam = NULL; -UINT8 *System16TextRam = NULL; -UINT8 *System16SpriteRam = NULL; -UINT8 *System16SpriteRamBuff = NULL; -UINT8 *System16SpriteRam2 = NULL; -UINT8 *System16RotateRam = NULL; -UINT8 *System16RotateRamBuff = NULL; -UINT8 *System16PaletteRam = NULL; -UINT8 *System16RoadRam = NULL; -UINT8 *System16RoadRamBuff = NULL; -UINT8 *System16Tiles = NULL; -UINT8 *System16Sprites = NULL; -UINT8 *System16Sprites2 = NULL; -UINT8 *System16Roads = NULL; -UINT32 *System16Palette = NULL; -UINT8 *System16TempGfx = NULL; - -UINT32 System16RomSize = 0; -UINT32 System16RomNum = 0; -UINT32 System16Rom2Size = 0; -UINT32 System16Rom2Num = 0; -UINT32 System16Rom3Size = 0; -UINT32 System16Rom3Num = 0; -UINT32 System16TileRomSize = 0; -UINT32 System16TileRomNum = 0; -UINT32 System16NumTiles = 0; -UINT32 System16SpriteRomSize = 0; -UINT32 System16SpriteRomNum = 0; -UINT32 System16Sprite2RomSize = 0; -UINT32 System16Sprite2RomNum = 0; -UINT32 System16RoadRomSize = 0; -UINT32 System16RoadRomNum = 0; -UINT32 System16Z80RomSize = 0; -UINT32 System16Z80RomNum = 0; -UINT32 System16Z80Rom2Size = 0; -UINT32 System16Z80Rom2Num = 0; -UINT32 System16Z80Rom3Size = 0; -UINT32 System16Z80Rom3Num = 0; -UINT32 System16Z80Rom4Size = 0; -UINT32 System16Z80Rom4Num = 0; -UINT32 System167751ProgSize = 0; -UINT32 System167751ProgNum = 0; -UINT32 System167751DataSize = 0; -UINT32 System167751DataNum = 0; -UINT32 System16UPD7759DataSize = 0; -UINT32 System16UPD7759DataNum = 0; -UINT32 System16PCMDataSize = 0; -UINT32 System16PCMDataNum = 0; -UINT32 System16PCMDataSizePreAllocate = 0; -UINT32 System16PCM2DataSize = 0; -UINT32 System16PCM2DataNum = 0; -UINT32 System16RF5C68DataSize = 0; -UINT32 System16RF5C68DataNum = 0; -UINT32 System16PromSize = 0; -UINT32 System16PromNum = 0; -UINT32 System16KeySize = 0; -UINT32 System16RamSize = 0; -UINT32 System16ExtraRamSize = 0; -UINT32 System16ExtraRam2Size = 0; -UINT32 System16ExtraRam3Size = 0; -UINT32 System16SpriteRamSize = 0; -UINT32 System16SpriteRam2Size = 0; -UINT32 System16RotateRamSize = 0; -UINT32 System16BackupRamSize = 0; -UINT32 System16BackupRam2Size = 0; - -static INT32 System16LastGear; -bool System16HasGears = false; - -UINT8 System16VideoControl; -INT32 System16SoundLatch; -bool System16BTileAlt = false; -bool Shangon = false; -bool Hangon = false; -bool System16Z80Enable = true; - -INT32 nSystem16CyclesDone[4]; -static INT32 nCyclesTotal[4]; -static INT32 nCyclesSegment; -UINT32 System16ClockSpeed = 0; - -INT32 System16YM2413IRQInterval; - -static bool bUseAsm68KCoreOldValue = false; - -static UINT8 N7751Command; -static UINT32 N7751RomAddress; -static UINT32 UPD7759BankAddress; -static UINT32 RF5C68PCMBankAddress; - -Sim8751 Simulate8751; -System16Map68K System16Map68KDo; -System16MapZ80 System16MapZ80Do; -System16CustomLoadRom System16CustomLoadRomDo; -System16CustomDecryptOpCode System16CustomDecryptOpCodeDo; -System16ProcessAnalogControls System16ProcessAnalogControlsDo; -System16MakeAnalogInputs System16MakeAnalogInputsDo; - -/*==================================================== -Inputs -====================================================*/ - -inline static void System16ClearOpposites(UINT8* nJoystickInputs) -{ - if ((*nJoystickInputs & 0x30) == 0x30) { - *nJoystickInputs &= ~0x30; - } - if ((*nJoystickInputs & 0xc0) == 0xc0) { - *nJoystickInputs &= ~0xc0; - } -} - -inline static void System16MakeInputs() -{ - // Reset Inputs - System16Input[0] = System16Input[1] = System16Input[2] = System16Input[3] = System16Input[4] = System16Input[5] = System16Input[6] = 0; - - // Compile Digital Inputs - for (int i = 0; i < 8; i++) { - System16Input[0] |= (System16InputPort0[i] & 1) << i; - System16Input[1] |= (System16InputPort1[i] & 1) << i; - System16Input[2] |= (System16InputPort2[i] & 1) << i; - System16Input[3] |= (System16InputPort3[i] & 1) << i; - System16Input[4] |= (System16InputPort4[i] & 1) << i; - System16Input[5] |= (System16InputPort5[i] & 1) << i; - System16Input[6] |= (System16InputPort6[i] & 1) << i; - } - - if (System16MakeAnalogInputsDo) System16MakeAnalogInputsDo(); -} - -inline static void OutrunMakeInputs() -{ - // Reset Inputs - System16Input[0] = 0; - - if (System16Gear && System16LastGear == 0) System16InputPort0[4] ^= 1; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - System16Input[0] |= (System16InputPort0[i] & 1) << i; - } - - System16LastGear = System16Gear; -} - -inline static void PdriftMakeInputs() -{ - // Reset Inputs - System16Input[0] = 0; - - if (System16Gear && System16LastGear == 0) System16InputPort0[5] ^= 1; - - // Compile Digital Inputs - for (INT32 i = 0; i < 8; i++) { - System16Input[0] |= (System16InputPort0[i] & 1) << i; - } - - System16LastGear = System16Gear; -} - -static void System16GunMakeInputs() -{ - if (nBurnGunNumPlayers) BurnGunMakeInputs(0, (INT16)System16AnalogPort0, (INT16)System16AnalogPort1); - if (nBurnGunNumPlayers >= 2) BurnGunMakeInputs(1, (INT16)System16AnalogPort2, (INT16)System16AnalogPort3); - if (nBurnGunNumPlayers >= 3) BurnGunMakeInputs(2, (INT16)System16AnalogPort4, (INT16)System16AnalogPort5); -} - -/*==================================================== -Reset Driver -====================================================*/ - -static INT32 System16DoReset() -{ - INT32 i; - - if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC_CPU2)) { - fd1094_machine_init(); - } - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM) { - SekOpen(0); - SekMapMemory(System16Rom, 0x000000, 0x0fffff, SM_ROM); - SekClose(); - } - - SekOpen(0); - SekReset(); - SekClose(); - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMY) { - SekOpen(1); - SekReset(); - SekClose(); - - System16LastGear = 0; - System16RoadControl = 0; - System16AnalogSelect = 0; - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN) { - // Start in low gear - if (System16HasGears) System16InputPort0[4] = 1; - } - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMY) { - SekOpen(2); - SekReset(); - SekClose(); - - // Start in low gear - if (System16HasGears) System16InputPort0[5] = 1; - } - - if (System16Z80RomNum || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM)) { - ZetOpen(0); - ZetReset(); - ZetClose(); - } - - if (System16Z80Rom2Num) { - ZetOpen(1); - ZetReset(); - ZetClose(); - } - - if (System167751ProgSize) { - N7751Reset(); - DACReset(); - N7751Command = 0; - N7751RomAddress = 0; - } - - if (System16UPD7759DataSize) { - UPD7759Reset(); - UPD7759BankAddress = 0; - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { - BurnYM3438Reset(); - RF5C68PCMReset(); - } else { - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { - BurnYM2203Reset(); - } else { - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { - BurnYM2413Reset(); - } else { - BurnYM2151Reset(); - } - } - } - - // Reset Variables - for (i = 0; i < 4; i++) { - System16Page[i] = 0; - System16OldPage[i] = 0; - System16ScrollX[i] = 0; - System16ScrollY[i] = 0; - BootlegBgPage[i] = 0; - BootlegFgPage[i] = 0; - } - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_5358) { - System16SpriteBanks[ 0] = 0; - System16SpriteBanks[ 1] = 255; - System16SpriteBanks[ 2] = 255; - System16SpriteBanks[ 3] = 255; - System16SpriteBanks[ 4] = 255; - System16SpriteBanks[ 5] = 255; - System16SpriteBanks[ 6] = 255; - System16SpriteBanks[ 7] = 3; - System16SpriteBanks[ 8] = 255; - System16SpriteBanks[ 9] = 255; - System16SpriteBanks[10] = 255; - System16SpriteBanks[11] = 2; - System16SpriteBanks[12] = 255; - System16SpriteBanks[13] = 1; - System16SpriteBanks[14] = 0; - System16SpriteBanks[15] = 255; - } else { - for (i = 0; i < 16; i++) { - System16SpriteBanks[i] = i; - } - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16B || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18 || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX) { - for (i = 0; i < 8; i++) { - System16TileBanks[i] = i; - System16OldTileBanks[i] = i; - } - } - - System16VideoEnable = 0; - System18VdpEnable = 0; - System18VdpMixing = 0; - System16VideoControl = 0; - System16ScreenFlip = 0; - System16SoundLatch = 0; - System16ColScroll = 0; - System16RowScroll = 0;; - - return 0; -} - -INT32 __fastcall OutrunResetCallback() -{ - INT32 nLastCPU = nSekActive; - SekClose(); - - SekOpen(1); - SekReset(); - SekClose(); - - SekOpen(nLastCPU); - - return 0; -} - -/*==================================================== -Z80 Memory Handlers -====================================================*/ - -UINT8 __fastcall System16Z80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x01: { - return BurnYM2151ReadStatus(); - } - - case 0x40: - case 0xc0: { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return System16SoundLatch; - } - - case 0x80: { - if (System16UPD7759DataSize) { - return UPD7759BusyRead(0) << 7; - } - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); -#endif - - return 0; -} - -UINT8 __fastcall System16PPIZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x01: { - return BurnYM2151ReadStatus(); - } - - case 0x40: - case 0xc0: { - ppi8255_set_portC(0, 0x00); - return System16SoundLatch; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); -#endif - - return 0; -} - -UINT8 __fastcall SystemXZ80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x01: { - return BurnYM2151ReadStatus(); - } - - case 0x40: - case 0xc0: { - return System16SoundLatch; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); -#endif - - return 0; -} - -UINT8 __fastcall System16Z80PortRead2(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x40: - case 0xc0: { - return System16SoundLatch; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); -#endif - - return 0; -} - -void __fastcall System16Z80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - d &= 0xff; - - switch (a) { - case 0x00: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x01: { - BurnYM2151WriteRegister(d); - return; - } - - case 0x40: { - if (System16UPD7759DataSize) { - UPD7759StartWrite(0,d & 0x80); - UPD7759ResetWrite(0,d & 0x40); - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_5358) { - if (!(d & 0x04)) UPD7759BankAddress = 0x00000; - if (!(d & 0x08)) UPD7759BankAddress = 0x10000; - if (!(d & 0x10)) UPD7759BankAddress = 0x20000; - if (!(d & 0x20)) UPD7759BankAddress = 0x30000; - UPD7759BankAddress += (d & 0x03) * 0x4000; - - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_5521) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_5704_PS2)) { - UPD7759BankAddress = ((d & 0x08) >> 3) * 0x20000; - UPD7759BankAddress += (d & 0x07) * 0x4000; - } - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_5797) { - UPD7759BankAddress = ((d & 0x08) >> 3) * 0x40000; - UPD7759BankAddress += ((d & 0x10) >> 4) * 0x20000; - UPD7759BankAddress += (d & 0x07) * 0x04000; - } - - UPD7759BankAddress %= System16UPD7759DataSize; - - ZetMapArea(0x8000, 0xdfff, 0, System16UPD7759Data + UPD7759BankAddress); - ZetMapArea(0x8000, 0xdfff, 2, System16UPD7759Data + UPD7759BankAddress); - return; - } - } - - case 0x80: { - if (System167751ProgSize) { - N7751RomAddress &= 0x3fff; - N7751RomAddress |= (d & 0x01) << 14; - if (!(d & 0x02) && System167751DataNum >= 1) N7751RomAddress |= 0x00000; - if (!(d & 0x04) && System167751DataNum >= 2) N7751RomAddress |= 0x08000; - if (!(d & 0x08) && System167751DataNum >= 3) N7751RomAddress |= 0x10000; - if (!(d & 0x10) && System167751DataNum >= 4) N7751RomAddress |= 0x18000; - N7751Command = d >> 5; - return; - } - - if (System16UPD7759DataSize) { - UPD7759PortWrite(0,d); - return; - } - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Write Port -> %02X, %02X\n"), a, d); -#endif -} - -#if 0 && defined FBA_DEBUG -UINT8 __fastcall System16Z80Read(UINT16 a) -{ - bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); - - return 0; -} -#endif - -#if 0 && defined FBA_DEBUG -void __fastcall System16Z80Write(UINT16 a, UINT8 d) -{ - bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); -} -#endif - -UINT8 __fastcall System16Z80PCMRead(UINT16 a) -{ - if (a >= 0xf000 && a <= 0xf0ff) { - return SegaPCMRead(0, a - 0xf000); - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); -#endif - - return 0; -} - -void __fastcall System16Z80PCMWrite(UINT16 a, UINT8 d) -{ - if (a >= 0xf000 && a <= 0xf0ff) { - SegaPCMWrite(0, a - 0xf000, d); - return; - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); -#endif -} - -UINT8 __fastcall System16Z802203PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x40: { - ppi8255_set_portC(0, 0x00); - return System16SoundLatch; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); -#endif - - return 0; -} - -UINT8 __fastcall System16Z802203Read(UINT16 a) -{ - if (a >= 0xe000 && a <= 0xe0ff) { - return SegaPCMRead(0, a - 0xe000); - } - - switch (a) { - case 0xd000: { - return BurnYM2203Read(0, 0); - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); -#endif - - return 0; -} - -void __fastcall System16Z802203Write(UINT16 a, UINT8 d) -{ - if (a >= 0xe000 && a <= 0xe0ff) { - SegaPCMWrite(0, a - 0xe000, d); - return; - } - - switch (a) { - case 0xd000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0xd001: { - BurnYM2203Write(0, 1, d); - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); -#endif -} - -UINT8 __fastcall System16Z80Read2(UINT16 a) -{ - if (a >= 0xf000 && a <= 0xf0ff) { - return SegaPCMRead(1, a - 0xf000); - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); -#endif - - return 0; -} - -void __fastcall System16Z80Write2(UINT16 a, UINT8 d) -{ - if (a >= 0xf000 && a <= 0xf0ff) { - SegaPCMWrite(1, a - 0xf000, d); - return; - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); -#endif -} - -UINT8 __fastcall System18Z80PortRead(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x80: { - return BurnYM3438Read(0, 0); - } - - case 0xc0: { - return System16SoundLatch; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); -#endif - - return 0; -} - -void __fastcall System18Z80PortWrite(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x80: { - BurnYM3438Write(0, 0, d); - return; - } - - case 0x81: { - BurnYM3438Write(0, 1, d); - return; - } - - case 0x82: { - BurnYM3438Write(0, 2, d); - return; - } - - case 0x83: { - BurnYM3438Write(0, 3, d); - return; - } - - case 0x90: { - BurnYM3438Write(1, 0, d); - return; - } - - case 0x91: { - BurnYM3438Write(1, 1, d); - return; - } - - case 0x92: { - BurnYM3438Write(1, 2, d); - return; - } - - case 0x93: { - BurnYM3438Write(1, 3, d); - return; - } - - case 0xa0: { - RF5C68PCMBankAddress = d * 0x2000; - ZetMapArea(0xa000, 0xbfff, 0, System16Z80Rom + 0x10000 + RF5C68PCMBankAddress); - ZetMapArea(0xa000, 0xbfff, 2, System16Z80Rom + 0x10000 + RF5C68PCMBankAddress); - return; - } - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Write Port -> %02X, %02X\n"), a, d); -#endif -} - -UINT8 __fastcall System18Z80Read(UINT16 a) -{ - if (a >= 0xd000 && a <= 0xdfff) { - return RF5C68PCMRead(a - 0xd000); - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); -#endif - - return 0; -} - -void __fastcall System18Z80Write(UINT16 a, UINT8 d) -{ - if (a >= 0xc000 && a <= 0xc00f) { - RF5C68PCMRegWrite(a - 0xc000, d); - return; - } - - if (a >= 0xd000 && a <= 0xdfff) { - RF5C68PCMWrite(a - 0xd000, d); - return; - } - -#if 0 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); -#endif -} - -void System16N7751ControlWrite(UINT32 Port, UINT32 Data) -{ - if (!(Data & 0x01)) { - N7751Reset(); - return; - } - - if (!(Data & 0x02)) { - N7751SetIrqState(1); - return; - } - - if (Data & 0x02) { - N7751SetIrqState(0); - return; - } - - bprintf(PRINT_NORMAL, _T("YM2151 Write Port %x, %02X\n"), Port, Data); -} - -UINT8 __fastcall N7751ReadIo(UINT32 Port) -{ - switch (Port) { - case 0x102: { - return 0x80 | ((N7751Command & 0x07) << 4); - } - - case 0x120: { - return System167751Data[N7751RomAddress]; - } - } - - return 0; -} - -void __fastcall N7751WriteIo(UINT32 Port, UINT8 Value) -{ - switch (Port) { - case 0x101: { - DACWrite(0, Value); - return; - } - - case 0x102: { - return; - } - - case 0x104: - case 0x105: - case 0x106: - case 0x107: { - INT32 Offset = Port - 0x104; - INT32 Mask = (0xf << (4 * Offset)) & 0x3fff; - INT32 NewData = (Value << (4 * Offset)) & Mask; - N7751RomAddress = (N7751RomAddress & ~Mask) | NewData; - return; - } - } -} - -UINT8 __fastcall N7751Read(UINT32 Address) -{ - if (Address < 0x400) return System167751Prog[Address]; - return 0; -} - -/*==================================================== -Allocate Memory -====================================================*/ - -static INT32 System16MemIndex() -{ - UINT8 *Next; Next = Mem; - - System16PaletteEntries = 0x800; - System16RamSize = 0x4000; - System16ExtraRamSize = 0; - System16ExtraRam2Size = 0; - System16ExtraRam3Size = 0; - System16SpriteRamSize = 0x800; - System16SpriteRam2Size = 0; - System16RotateRamSize = 0; - System16BackupRamSize = 0; - System16BackupRam2Size = 0; - bool SpriteBuffer = false; - bool HasRoad = false; - bool UseTempDraw = false; - INT32 Z80RomSize = 0x10000; - INT32 Z80RamSize = 0x00800; - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { - Z80RomSize = 0x210000; - Z80RamSize = 0x2000; - UseTempDraw = true; - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON) { - System16ExtraRamSize = 0x4000; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "hangon") || !strcmp(BurnDrvGetTextA(DRV_NAME), "shangupb")) { - System16RamSize = 0x10000; - } else { - System16SpriteRamSize = 0x1000; - } - HasRoad = true; - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN) { - System16PaletteEntries = 0x1000; - System16RamSize = 0x8000; - System16ExtraRamSize = 0x8000; - System16SpriteRamSize = 0x1000; - SpriteBuffer = true; - HasRoad = true; - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX) { - System16PaletteEntries = 0x2000; - System16RamSize = 0x8000; - System16SpriteRamSize = 0x1000; - System16BackupRamSize = 0x4000; - System16BackupRam2Size = 0x4000; - SpriteBuffer = true; - HasRoad = true; - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMY) { - System16PaletteEntries = 0x2000; - System16RamSize = 0x10000; - System16ExtraRamSize = 0x10000; - System16ExtraRam2Size = 0x10000; - System16ExtraRam3Size = 0x10000; - System16SpriteRamSize = 0x1000; - System16BackupRamSize = 0x4000; - System16SpriteRam2Size = 0x10000; - System16RotateRamSize = 0x800; - UseTempDraw = true; - } - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM) { - System16ExtraRamSize = 0x40000; - Z80RomSize = 0x40000; - } - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_5704_PS2) { - System16RamSize = 0x40000; - } - - System16Rom = Next; Next += (System16RomSize > 0x100000) ? System16RomSize : 0x100000; - System16Code = Next; Next += (System16RomSize > 0x100000) ? System16RomSize : 0x100000; - System16Rom2 = Next; (System16Rom2Size) ? Next += 0x080000 : Next += 0; - System16Rom3 = Next; (System16Rom3Size) ? Next += 0x080000 : Next += 0; - System16Z80Rom = Next; Next += Z80RomSize; - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MC8123_ENC) { - System16Z80Code = Next; Next += Z80RomSize; - } - System16Z80Rom2 = Next; Next += System16Z80Rom2Size; - System16Z80Rom3 = Next; Next += System16Z80Rom3Size; - System16Z80Rom4 = Next; Next += System16Z80Rom4Size; - System167751Prog = Next; Next += System167751ProgSize; - System167751Data = Next; Next += System167751DataSize; - System16UPD7759Data = Next; Next += System16UPD7759DataSize; - System16PCMData = Next; Next += System16PCMDataSize; - System16PCM2Data = Next; Next += System16PCM2DataSize; - System16RF5C68Data = Next; Next += System16RF5C68DataSize; - System16Key = Next; Next += System16KeySize; - System16Prom = Next; Next += System16PromSize; - - RamStart = Next; - - System16Ram = Next; Next += System16RamSize; - System16ExtraRam = Next; Next += System16ExtraRamSize; - System16ExtraRam2 = Next; Next += System16ExtraRam2Size; - System16ExtraRam3 = Next; Next += System16ExtraRam3Size; - System16TileRam = Next; (System16TileRomSize) ? Next += 0x10000 : Next += 0; - System16TextRam = Next; (System16TileRomSize) ? Next += 0x01000 : Next += 0; - System16SpriteRam = Next; Next += System16SpriteRamSize; - System16SpriteRam2 = Next; Next += System16SpriteRam2Size; - System16RotateRam = Next; Next += System16RotateRamSize; - System16RotateRamBuff= Next; Next += System16RotateRamSize; - if (SpriteBuffer) System16SpriteRamBuff = Next; Next += System16SpriteRamSize; - System16PaletteRam = Next; Next += System16PaletteEntries * 2; - - if (HasRoad) { - System16RoadRam = Next; Next += 0x01000; - System16RoadRamBuff = Next; Next += 0x01000; - } - - System16BackupRam = Next; Next += System16BackupRamSize; - System16BackupRam2 = Next; Next += System16BackupRam2Size; - - System16Z80Ram = Next; Next += Z80RamSize; - - if (System16Z80Rom2Num) { - System16Z80Ram2 = Next; Next += 0x800; - } - - RamEnd = Next; - - System16Tiles = Next; Next += (System16NumTiles * 8 * 8); - System16Sprites = Next; Next += System16SpriteRomSize; - System16Sprites2 = Next; Next += System16Sprite2RomSize; - - if (HasRoad) { - System16Roads = Next; Next += 0x40000; - } - - System16Palette = (UINT32*)Next; Next += System16PaletteEntries * 3 * sizeof(UINT32) + (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) ? (0x40 * sizeof(UINT32)) : 0); - - if (UseTempDraw) pTempDraw = (UINT16*)Next; Next += (512 * 512 * sizeof(UINT16)); - - MemEnd = Next; - - return 0; -} - -/*==================================================== -Rom Loading -====================================================*/ - -INT32 System16LoadRoms(bool bLoad) -{ - struct BurnRomInfo ri; - ri.nType = 0; - ri.nLen = 0; - INT32 nOffset = -1; - UINT32 i; - INT32 nRet = 0; - - if (!bLoad) { - do { - ri.nLen = 0; - ri.nType = 0; - BurnDrvGetRomInfo(&ri, ++nOffset); - if ((ri.nType & 0xff) == SYS16_ROM_PROG) { - System16RomSize += ri.nLen; - System16RomNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_PROG2) { - System16Rom2Size += ri.nLen; - System16Rom2Num++; - } - if ((ri.nType & 0xff) == SYS16_ROM_PROG3) { - System16Rom3Size += ri.nLen; - System16Rom3Num++; - } - if ((ri.nType & 0xff) == SYS16_ROM_TILES) { - System16TileRomSize += ri.nLen; - System16TileRomNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_SPRITES) { - System16SpriteRomSize += ri.nLen; - System16SpriteRomNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_SPRITES2) { - System16Sprite2RomSize += ri.nLen; - System16Sprite2RomNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_ROAD) { - System16RoadRomSize += ri.nLen; - System16RoadRomNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_Z80PROG) { - System16Z80RomSize += ri.nLen; - System16Z80RomNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_Z80PROG2) { - System16Z80Rom2Size += ri.nLen; - System16Z80Rom2Num++; - } - if ((ri.nType & 0xff) == SYS16_ROM_Z80PROG3) { - System16Z80Rom3Size += ri.nLen; - System16Z80Rom3Num++; - } - if ((ri.nType & 0xff) == SYS16_ROM_Z80PROG4) { - System16Z80Rom4Size += ri.nLen; - System16Z80Rom4Num++; - } - if ((ri.nType & 0xff) == SYS16_ROM_7751PROG) { - System167751ProgSize += ri.nLen; - System167751ProgNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_7751DATA) { - System167751DataSize += ri.nLen; - System167751DataNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_UPD7759DATA) { - if (ri.nLen < 0x10000) { - System16UPD7759DataSize += 0x10000; - } else { - System16UPD7759DataSize += ri.nLen; - } - System16UPD7759DataNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_PCMDATA) { - if (System16PCMDataSizePreAllocate) { - System16PCMDataSize = System16PCMDataSizePreAllocate; - } else { - System16PCMDataSize += ri.nLen; - } - - System16PCMDataNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_PCM2DATA) { - System16PCM2DataSize += ri.nLen; - System16PCM2DataNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_RF5C68DATA) { - System16RF5C68DataNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_PROM) { - System16PromSize += ri.nLen; - System16PromNum++; - } - if ((ri.nType & 0xff) == SYS16_ROM_KEY) { - System16KeySize += ri.nLen; - } - } while (ri.nLen); - - System16NumTiles = System16TileRomSize / 24; - if (System16RF5C68DataNum) { - System16Z80RomNum += System16RF5C68DataNum; - System16Z80RomSize = 0x210000; - } - -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("68K Rom Size: 0x%X (%i roms)\n"), System16RomSize, System16RomNum); - if (System16Rom2Size) bprintf(PRINT_NORMAL, _T("68K #2 Rom Size: 0x%X (%i roms)\n"), System16Rom2Size, System16Rom2Num); - if (System16Rom3Size) bprintf(PRINT_NORMAL, _T("68K #3 Rom Size: 0x%X (%i roms)\n"), System16Rom3Size, System16Rom3Num); - bprintf(PRINT_NORMAL, _T("Tile Rom Size: 0x%X (%i roms, 0x%X Tiles)\n"), System16TileRomSize, System16TileRomNum, System16NumTiles); - bprintf(PRINT_NORMAL, _T("Sprite Rom Size: 0x%X (%i roms)\n"), System16SpriteRomSize, System16SpriteRomNum); - if (System16Sprite2RomSize) bprintf(PRINT_NORMAL, _T("Sprite Rom 2 Size: 0x%X (%i roms)\n"), System16Sprite2RomSize, System16Sprite2RomNum); - bprintf(PRINT_NORMAL, _T("Z80 Rom Size: 0x%X (%i roms)\n"), System16Z80RomSize, System16Z80RomNum); - if (System16Z80Rom2Size) bprintf(PRINT_NORMAL, _T("Z80 #2 Rom Size: 0x%X (%i roms)\n"), System16Z80Rom2Size, System16Z80Rom2Num); - if (System16Z80Rom3Size) bprintf(PRINT_NORMAL, _T("Z80 #3 Rom Size: 0x%X (%i roms)\n"), System16Z80Rom3Size, System16Z80Rom3Num); - if (System16Z80Rom4Size) bprintf(PRINT_NORMAL, _T("Z80 #4 Rom Size: 0x%X (%i roms)\n"), System16Z80Rom4Size, System16Z80Rom4Num); - if (System16RoadRomSize) bprintf(PRINT_NORMAL, _T("Road Rom Size: 0x%X (%i roms)\n"), System16RoadRomSize, System16RoadRomNum); - if (System167751ProgSize) bprintf(PRINT_NORMAL, _T("7751 Prog Size: 0x%X (%i roms)\n"), System167751ProgSize, System167751ProgNum); - if (System167751DataSize) bprintf(PRINT_NORMAL, _T("7751 Data Size: 0x%X (%i roms)\n"), System167751DataSize, System167751DataNum); - if (System16UPD7759DataSize) bprintf(PRINT_NORMAL, _T("UPD7759 Data Size: 0x%X (%i roms)\n"), System16UPD7759DataSize, System16UPD7759DataNum); - if (System16PCMDataSize) bprintf(PRINT_NORMAL, _T("PCM Data Size: 0x%X (%i roms)\n"), System16PCMDataSize, System16PCMDataNum); - if (System16PCM2DataSize) bprintf(PRINT_NORMAL, _T("PCM Data #2 Size: 0x%X (%i roms)\n"), System16PCM2DataSize, System16PCM2DataNum); - if (System16PromSize) bprintf(PRINT_NORMAL, _T("PROM Rom Size: 0x%X (%i roms)\n"), System16PromSize, System16PromNum); - if (System16KeySize) bprintf(PRINT_NORMAL, _T("Encryption Key Size: 0x%X\n"), System16KeySize); -#endif - } - - if (bLoad) { - INT32 Offset; - - // 68000 Program Roms - Offset = 0; - for (i = 0; i < System16RomNum; i += 2) { - nRet = BurnLoadRom(System16Rom + Offset + 1, i + 0, 2); if (nRet) return 1; - nRet = BurnLoadRom(System16Rom + Offset + 0, i + 1, 2); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 1); - Offset += ri.nLen; - } - - // 68000 #2 Program Roms - if (System16Rom2Size) { - Offset = 0; - for (i = System16RomNum; i < System16RomNum + System16Rom2Num; i += 2) { - nRet = BurnLoadRom(System16Rom2 + Offset + 1, i + 0, 2); if (nRet) return 1; - nRet = BurnLoadRom(System16Rom2 + Offset + 0, i + 1, 2); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 1); - Offset += ri.nLen; - } - } - - // 68000 #3 Program Roms - if (System16Rom3Size) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num; i < System16RomNum + System16Rom2Num + System16Rom3Num; i += 2) { - nRet = BurnLoadRom(System16Rom3 + Offset + 1, i + 0, 2); if (nRet) return 1; - nRet = BurnLoadRom(System16Rom3 + Offset + 0, i + 1, 2); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 1); - Offset += ri.nLen; - } - } - - // Tile Roms - Offset = 0; - System16TempGfx = (UINT8*)BurnMalloc(System16TileRomSize); - for (i = System16RomNum + System16Rom2Num + System16Rom3Num; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum; i++) { - nRet = BurnLoadRom(System16TempGfx + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_INVERT_TILES) { - for (i = 0; i < System16TileRomSize; i++) { - System16TempGfx[i] ^= 0xff; - } - } - System16Decode8x8Tiles(System16Tiles, System16NumTiles, System16TileRomSize * 2 / 3, System16TileRomSize * 1 / 3, 0); - BurnFree(System16TempGfx); - - // Sprite Roms - Offset = 0; - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_SPRITE_LOAD32) { - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum; i += 4) { - nRet = BurnLoadRom(System16Sprites + Offset + 0, i + 0, 4); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites + Offset + 1, i + 1, 4); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites + Offset + 2, i + 2, 4); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites + Offset + 3, i + 3, 4); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 1); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 2); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 3); - Offset += ri.nLen; - } - } else { - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum; i += 2) { - nRet = BurnLoadRom(System16Sprites + Offset + 0, i + 0, 2); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites + Offset + 1, i + 1, 2); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 1); - Offset += ri.nLen; - } - } - - // Sprite 2 Roms - if (System16Sprite2RomSize) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum; i += 8) { - nRet = BurnLoadRom(System16Sprites2 + Offset + 7, i + 0, 8); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites2 + Offset + 6, i + 1, 8); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites2 + Offset + 5, i + 2, 8); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites2 + Offset + 4, i + 3, 8); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites2 + Offset + 3, i + 4, 8); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites2 + Offset + 2, i + 5, 8); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites2 + Offset + 1, i + 6, 8); if (nRet) return 1; - nRet = BurnLoadRom(System16Sprites2 + Offset + 0, i + 7, 8); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 1); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 2); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 3); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 4); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 5); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 6); - Offset += ri.nLen; - BurnDrvGetRomInfo(&ri, i + 7); - Offset += ri.nLen; - } - } - - // Road Roms - if (System16RoadRomSize) { - Offset = 0; - System16TempGfx = (UINT8*)BurnMalloc(System16RoadRomSize); - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum; i++) { - nRet = BurnLoadRom(System16TempGfx + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX) OutrunDecodeRoad(); - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON) HangonDecodeRoad(); - BurnFree(System16TempGfx); - } - - // Z80 Program Roms - Offset = 0; - if (System16RF5C68DataNum) Offset = 0x10000; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum; i++) { - nRet = BurnLoadRom(System16Z80Rom + Offset, i, 1); - if (nRet) { - // Fill with 0xff - memset(System16Z80Rom, 0xff, System16Z80RomSize); - - nRet = 0; - } - - BurnDrvGetRomInfo(&ri, i + 0); - if (System16RF5C68DataNum) { - Offset += 0x80000; - } else { - Offset += ri.nLen; - } - } - if (System16RF5C68DataNum) { - memcpy(System16Z80Rom, System16Z80Rom + 0x10000, 0x10000); - System16RF5C68DataNum = 0; - } - - // Z80 #2 Program Roms - if (System16Z80Rom2Size) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum+ System16Z80RomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num; i++) { - nRet = BurnLoadRom(System16Z80Rom2 + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // Z80 #3 Program Roms - if (System16Z80Rom3Size) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num; i++) { - nRet = BurnLoadRom(System16Z80Rom3 + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // Z80 #4 Program Roms - if (System16Z80Rom4Size) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num; i++) { - nRet = BurnLoadRom(System16Z80Rom4 + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // 7751 Program Roms - if (System167751ProgSize) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum; i++) { - nRet = BurnLoadRom(System167751Prog + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // 7751 Data Roms - if (System167751DataSize) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum; i++) { - nRet = BurnLoadRom(System167751Data + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // UPD7759 Data Roms - if (System16UPD7759DataSize) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum; i++) { - nRet = BurnLoadRom(System16UPD7759Data + Offset, i, 1); - - if (nRet) { - memset(System16UPD7759Data, 0xff, System16UPD7759DataSize); - - nRet = 0; - } - - BurnDrvGetRomInfo(&ri, i + 0); - if (ri.nLen < 0x10000) { - Offset += 0x10000; - } else { - Offset += ri.nLen; - } - } - } - - // PCM Data Roms - if (System16PCMDataSize) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum; i++) { - nRet = BurnLoadRom(System16PCMData + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // PCM2 Data Roms - if (System16PCM2DataSize) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum + System16PCM2DataNum; i++) { - nRet = BurnLoadRom(System16PCM2Data + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // PROMs - if (System16PromSize) { - Offset = 0; - for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum + System16PCM2DataNum + System16RF5C68DataNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum + System16PCM2DataNum + System16RF5C68DataNum + System16PromNum; i++) { - nRet = BurnLoadRom(System16Prom + Offset, i, 1); if (nRet) return 1; - - BurnDrvGetRomInfo(&ri, i + 0); - Offset += ri.nLen; - } - } - - // Encryption Key - if (System16KeySize) { - Offset = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum + System16PCM2DataNum + System16RF5C68DataNum + System16PromNum; - nRet = BurnLoadRom(System16Key, Offset, 1); if (nRet) return 1; - } - } - - return nRet; -} - -INT32 CustomLoadRom20000() -{ - INT32 nRet = 1; - UINT8 *pTemp = (UINT8*)BurnMalloc(0xc0000); - - if (pTemp) { - memcpy(pTemp, System16Rom, 0xc0000); - memset(System16Rom, 0, 0xc0000); - memcpy(System16Rom + 0x00000, pTemp + 0x00000, 0x20000); - memcpy(System16Rom + 0x80000, pTemp + 0x20000, 0x40000); - BurnFree(pTemp); - nRet = 0; - } - - return nRet; -} - -INT32 CustomLoadRom40000() -{ - INT32 nRet = 1; - UINT8 *pTemp = (UINT8*)BurnMalloc(0xc0000); - - if (pTemp) { - memcpy(pTemp, System16Rom, 0xc0000); - memset(System16Rom, 0, 0xc0000); - memcpy(System16Rom + 0x00000, pTemp + 0x00000, 0x40000); - memcpy(System16Rom + 0x80000, pTemp + 0x40000, 0x40000); - BurnFree(pTemp); - nRet = 0; - } - - return nRet; -} - -/*==================================================== -Sound Support Functions -====================================================*/ - -inline static INT32 System16SndGetBank(INT32 Reg86) -{ - return (Reg86>>4)&7; -} - -inline static INT32 PdriftSndGetBank(INT32 Reg86) -{ - return (Reg86>>3)&0x1f; -} - -inline void System16YM2151IRQHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -inline static void System16YM2203IRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -inline static INT32 System16SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -inline static double System16GetTime() -{ - return (double)ZetTotalCycles() / 4000000; -} - -inline static INT32 System18SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 8000000; -} - -inline static double System18GetTime() -{ - return (double)ZetTotalCycles() / 8000000; -} - -static void System16UPD7759DrqCallback(INT32 state) -{ - if (state) ZetNmi(); -} - -static INT32 System16ASyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (I8039TotalCycles() / ((6000000.0000 / 15) / (nBurnFPS / 100.0000)))); -} - -/*==================================================== -Multiply Protection Chip Emulation -====================================================*/ - -struct multiply_chip -{ - UINT16 regs[4]; -}; - -static struct multiply_chip multiply[3]; - -UINT16 System16MultiplyChipRead(INT32 which, INT32 offset) -{ - offset &= 3; - switch (offset) { - case 0: { - return multiply[which].regs[0]; - } - - case 1: { - return multiply[which].regs[1]; - } - - case 2: { - return ((INT16)multiply[which].regs[0] * (INT16)multiply[which].regs[1]) >> 16; - } - - case 3: { - return ((INT16)multiply[which].regs[0] * (INT16)multiply[which].regs[1]) & 0xffff; - } - } - - return 0xffff; -} - -void System16MultiplyChipWrite(INT32 which, INT32 offset, UINT16 data) -{ - offset &= 3; - switch (offset) { - case 0: { - multiply[which].regs[0] = data; - return; - } - - case 1: { - multiply[which].regs[1] = data; - return; - } - - case 2: { - multiply[which].regs[0] = data; - return; - } - - case 3: { - multiply[which].regs[1] = data; - return; - } - } -} - -/*==================================================== -Divide Protection Chip Emulation -====================================================*/ - -struct divide_chip -{ - UINT16 regs[8]; -}; - -static struct divide_chip divide[3]; - -static void update_divide(INT32 which, INT32 mode) -{ - /* clear the flags by default */ - divide[which].regs[6] = 0; - - /* if mode 0, store quotient/remainder */ - if (mode == 0) - { - INT32 dividend = (INT32)((divide[which].regs[0] << 16) | divide[which].regs[1]); - INT32 divisor = (INT16)divide[which].regs[2]; - INT32 quotient, remainder; - - /* perform signed divide */ - if (divisor == 0) - { - quotient = dividend;//((INT32)(dividend ^ divisor) < 0) ? 0x8000 : 0x7fff; - divide[which].regs[6] |= 0x4000; - } - else - quotient = dividend / divisor; - remainder = dividend - quotient * divisor; - - /* clamp to 16-bit signed */ - if (quotient < -32768) - { - quotient = -32768; - divide[which].regs[6] |= 0x8000; - } - else if (quotient > 32767) - { - quotient = 32767; - divide[which].regs[6] |= 0x8000; - } - - /* store quotient and remainder */ - divide[which].regs[4] = quotient; - divide[which].regs[5] = remainder; - } - - /* if mode 1, store 32-bit quotient */ - else - { - UINT32 dividend = (UINT32)((divide[which].regs[0] << 16) | divide[which].regs[1]); - UINT32 divisor = (UINT16)divide[which].regs[2]; - UINT32 quotient; - - /* perform unsigned divide */ - if (divisor == 0) - { - quotient = dividend;//0x7fffffff; - divide[which].regs[6] |= 0x4000; - } - else - quotient = dividend / divisor; - - /* store 32-bit quotient */ - divide[which].regs[4] = quotient >> 16; - divide[which].regs[5] = quotient & 0xffff; - } -} - -UINT16 System16DivideChipRead(INT32 which, INT32 offset) -{ - offset &= 7; - switch (offset) { - case 0: { - return divide[which].regs[0]; - } - - case 1: { - return divide[which].regs[1]; - } - - case 2: { - return divide[which].regs[2]; - } - - case 4: { - return divide[which].regs[4]; - } - - case 5: { - return divide[which].regs[5]; - } - - case 6: { - return divide[which].regs[6]; - } - } - - return 0xffff; -} - -void System16DivideChipWrite(INT32 which, INT32 offset, UINT16 data) -{ - INT32 a4 = offset & 8; - INT32 a3 = offset & 4; - - offset &= 3; - switch (offset) { - case 0: { - divide[which].regs[0] = data; - break; - } - - case 1: { - divide[which].regs[1] = data; - break; - } - - case 2: { - divide[which].regs[2] = data; - break; - } - - case 3: { - break; - } - } - - if (a4) update_divide(which, a3); -} - -/*==================================================== -Compare Timer Protection Chip Emulation -====================================================*/ - -struct compare_timer_chip -{ - UINT16 regs[16]; - UINT16 counter; - UINT8 bit; -}; - -static struct compare_timer_chip compare_timer[2]; - -inline static INT32 segaic16_compare_timer_clock(INT32 which) -{ - INT32 old_counter = compare_timer[which].counter; - INT32 result = 0; - - /* if we're enabled, clock the upcounter */ - if (compare_timer[which].regs[10] & 1) - compare_timer[which].counter++; - - /* regardless of the enable, a value of 0xfff will generate the IRQ */ - if (old_counter == 0xfff) - { - result = 1; - compare_timer[which].counter = compare_timer[which].regs[8] & 0xfff; - } - return result; -} - -inline static void update_compare(INT32 which, INT32 update_history) -{ - INT32 bound1 = (INT16)compare_timer[which].regs[0]; - INT32 bound2 = (INT16)compare_timer[which].regs[1]; - INT32 value = (INT16)compare_timer[which].regs[2]; - INT32 min = (bound1 < bound2) ? bound1 : bound2; - INT32 max = (bound1 > bound2) ? bound1 : bound2; - - if (value < min) - { - compare_timer[which].regs[7] = min; - compare_timer[which].regs[3] = 0x8000; - } - else if (value > max) - { - compare_timer[which].regs[7] = max; - compare_timer[which].regs[3] = 0x4000; - } - else - { - compare_timer[which].regs[7] = value; - compare_timer[which].regs[3] = 0x0000; - } - - if (update_history) - compare_timer[which].regs[4] |= (compare_timer[which].regs[3] == 0) << compare_timer[which].bit++; -} - -UINT16 System16CompareTimerChipRead(INT32 which, INT32 offset) -{ - offset &= 0xf; - switch (offset) { - case 0x0: return compare_timer[which].regs[0]; - case 0x1: return compare_timer[which].regs[1]; - case 0x2: return compare_timer[which].regs[2]; - case 0x3: return compare_timer[which].regs[3]; - case 0x4: return compare_timer[which].regs[4]; - case 0x5: return compare_timer[which].regs[1]; - case 0x6: return compare_timer[which].regs[2]; - case 0x7: return compare_timer[which].regs[7]; - } - - return 0xffff; -} - -void System16CompareTimerChipWrite(INT32 which, INT32 offset, UINT16 data) -{ - offset &= 0xf; - switch (offset) { - case 0x0: compare_timer[which].regs[0] = data; update_compare(which, 0); break; - case 0x1: compare_timer[which].regs[1] = data; update_compare(which, 0); break; - case 0x2: compare_timer[which].regs[2] = data; update_compare(which, 1); break; - case 0x4: compare_timer[which].regs[4] = 0; compare_timer[which].bit = 0; break; - case 0x6: compare_timer[which].regs[2] = data; update_compare(which, 0); break; - case 0x8: - case 0xc: compare_timer[which].regs[8] = data; break; - case 0xa: - case 0xe: compare_timer[which].regs[10] = data; break; - case 0xb: - case 0xf: - compare_timer[which].regs[11] = data; - break; - } -} - -/*==================================================== -Main Driver Init function -====================================================*/ - -INT32 System16Init() -{ - INT32 nRet = 0, nLen; - - // Allocate and Blank all required memory - Mem = NULL; - System16LoadRoms(0); // Get required rom sizes - System16MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - System16MemIndex(); - - // Load Roms - if (!(BurnDrvGetHardwareCode() & HARDWARE_SEGA_5704_PS2)) { - nRet = System16LoadRoms(1); if (nRet) return 1; - } - if (System16CustomLoadRomDo) { nRet = System16CustomLoadRomDo(); if (nRet) return 1; } - - // Copy the first 68000 rom to code (FETCH) - memcpy(System16Code, System16Rom, System16RomSize); - - // Handle any op-code decryption - if (System16CustomDecryptOpCodeDo) { nRet = System16CustomDecryptOpCodeDo(); if (nRet) return 1; } - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1089A_ENC || BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1089B_ENC) { - FD1089Decrypt(); - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC_CPU2)) { - // Make sure we use Musashi - if (bBurnUseASMCPUEmulation) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); -#endif - bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; - bBurnUseASMCPUEmulation = false; - } - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC) fd1094_driver_init(0); - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC_CPU2) fd1094_driver_init(1); - } - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MC8123_ENC) { - mc8123_decrypt_rom(0, 0, System16Z80Rom, System16Z80Code, System16Key); - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16A) { - if (System16Map68KDo) { - System16Map68KDo(); - } else { - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0fffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - - SekSetReadWordHandler(0, System16AReadWord); - SekSetWriteWordHandler(0, System16AWriteWord); - SekSetReadByteHandler(0, System16AReadByte); - SekSetWriteByteHandler(0, System16AWriteByte); - SekClose(); - } - - if (System16MapZ80Do) { - ZetInit(0); - ZetOpen(0); - System16MapZ80Do(); - ZetClose(); - } else { - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); - - ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); - ZetMemEnd(); - -#if 0 && defined FBA_DEBUG - ZetSetReadHandler(System16Z80Read); - ZetSetWriteHandler(System16Z80Write); -#endif - ZetSetInHandler(System16PPIZ80PortRead); - ZetSetOutHandler(System16Z80PortWrite); - ZetClose(); - } - - if (PPI0PortWriteA == NULL) PPI0PortWriteA = System16APPI0WritePortA; - if (PPI0PortWriteB == NULL) PPI0PortWriteB = System16APPI0WritePortB; - if (PPI0PortWriteC == NULL) PPI0PortWriteC = System16APPI0WritePortC; - ppi8255_init(1); - - BurnYM2151Init(4000000); - BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - - if (System167751ProgSize) { - N7751Init(NULL); - - N7751SetIOReadHandler(N7751ReadIo); - N7751SetIOWriteHandler(N7751WriteIo); - N7751SetProgramReadHandler(N7751Read); - N7751SetCPUOpReadHandler(N7751Read); - N7751SetCPUOpReadArgHandler(N7751Read); - - YM2151SetPortWriteHandler(0, &System16N7751ControlWrite); - BurnYM2151SetAllRoutes(0.43, BURN_SND_ROUTE_BOTH); - DACInit(0, 0, 1, System16ASyncDAC); - DACSetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); - } - - System16TileBankSize = 0x1000; - System16CreateOpaqueTileMaps = 1; - System16ATileMapsInit(1); - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16B) { - if (System16Map68KDo) { - System16Map68KDo(); - } else { - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0fffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - - SekSetReadByteHandler(0, System16BReadByte); - SekSetWriteByteHandler(0, System16BWriteByte); - SekSetWriteWordHandler(0, System16BWriteWord); - SekClose(); - } - - if (System16Z80RomNum || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM)) { - if (System16MapZ80Do) { - ZetInit(0); - ZetOpen(0); - System16MapZ80Do(); - ZetClose(); - } else { - ZetInit(0); - ZetOpen(0); - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MC8123_ENC) { - ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0xdfff, 2, System16Z80Code, System16Z80Rom); - } else { - ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); - } - - ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); - ZetMemEnd(); - -#if 0 && defined FBA_DEBUG - ZetSetReadHandler(System16Z80Read); - ZetSetWriteHandler(System16Z80Write); -#endif - ZetSetInHandler(System16Z80PortRead); - ZetSetOutHandler(System16Z80PortWrite); - ZetClose(); - } - } - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { - BurnYM2413Init(5000000); - BurnYM2413SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - } else { - BurnYM2151Init(4000000); - BurnYM2151SetAllRoutes(0.43, BURN_SND_ROUTE_BOTH); - } - - if (System16UPD7759DataSize) { - UPD7759Init(0,UPD7759_STANDARD_CLOCK, NULL); - UPD7759SetDrqCallback(0,System16UPD7759DrqCallback); - UPD7759SetRoute(0, 0.48, BURN_SND_ROUTE_BOTH); - } - - System16TileBankSize = 0x1000; - System16CreateOpaqueTileMaps = 1; - System16BTileMapsInit(1); - System16ClockSpeed = 10000000; - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { - if (System16Map68KDo) { - System16Map68KDo(); - } else { - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x0fffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); - SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); - - SekSetReadWordHandler(0, System18ReadWord); - SekSetWriteWordHandler(0, System18WriteWord); - SekSetReadByteHandler(0, System18ReadByte); - SekSetWriteByteHandler(0, System18WriteByte); - SekClose(); - } - - if (System16MapZ80Do) { - ZetInit(0); - ZetOpen(0); - System16MapZ80Do(); - ZetClose(); - } else { - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x9fff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0x9fff, 2, System16Z80Rom); - - ZetMapArea(0xa000, 0xbfff, 0, System16Z80Rom + 0xa000); - ZetMapArea(0xa000, 0xbfff, 2, System16Z80Rom + 0xa000); - - ZetMapArea(0xe000, 0xffff, 0, System16Z80Ram); - ZetMapArea(0xe000, 0xffff, 1, System16Z80Ram); - ZetMapArea(0xe000, 0xffff, 2, System16Z80Ram); - ZetMemEnd(); - - ZetSetReadHandler(System18Z80Read); - ZetSetWriteHandler(System18Z80Write); - ZetSetInHandler(System18Z80PortRead); - ZetSetOutHandler(System18Z80PortWrite); - ZetClose(); - } - - BurnYM3438Init(2, 8000000, NULL, System18SynchroniseStream, System18GetTime, 1); - BurnTimerAttachZet(8000000); - BurnYM3438SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM3438SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); - - RF5C68PCMInit(10000000); - RF5C68PCMSetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - - System16TileBankSize = 0x400; - System16CreateOpaqueTileMaps = 1; - System16BTileMapsInit(1); - - StartGenesisVDP(0, System16Palette); - GenesisPaletteBase = 0x1800; - GenesisBgPalLookup[0] = GenesisSpPalLookup[0] = 0x1800; - GenesisBgPalLookup[1] = GenesisSpPalLookup[1] = 0x1810; - GenesisBgPalLookup[2] = GenesisSpPalLookup[2] = 0x1820; - GenesisBgPalLookup[3] = GenesisSpPalLookup[3] = 0x1830; - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON) { - if (System16Map68KDo) { - System16Map68KDo(); - } else { - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x03ffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x03ffff, SM_FETCH); - SekMapMemory(System16Ram , 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(System16TileRam , 0x400000, 0x403fff, SM_READ); - SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x600000, 0x607fff, SM_RAM); - SekMapMemory(System16PaletteRam , 0xa00000, 0xa00fff, SM_RAM); - SekMapMemory(System16Rom2 , 0xc00000, 0xc3ffff, SM_READ); - SekMapMemory(System16RoadRam , 0xc68000, 0xc68fff, SM_RAM); - SekMapMemory(System16ExtraRam , 0xc7c000, 0xc7ffff, SM_RAM); - - SekSetReadWordHandler(0, HangonReadWord); - SekSetReadByteHandler(0, HangonReadByte); - SekSetWriteByteHandler(0, HangonWriteByte); - SekSetWriteWordHandler(0, HangonWriteWord); - SekClose(); - } - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(System16Rom2 , 0x000000, 0x03ffff, SM_READ); - SekMapMemory(System16Rom2 , 0x000000, 0x03ffff, SM_FETCH); - SekMapMemory(System16RoadRam , 0xc68000, 0xc68fff, SM_RAM); - SekMapMemory(System16ExtraRam , 0xc7c000, 0xc7ffff, SM_RAM); - SekClose(); - - if (System16MapZ80Do) { - ZetInit(0); - ZetOpen(0); - System16MapZ80Do(); - ZetClose(); - } else { - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0x7fff, 2, System16Z80Rom); - - ZetMapArea(0xc000, 0xc7ff, 0, System16Z80Ram); - ZetMapArea(0xc000, 0xc7ff, 1, System16Z80Ram); - ZetMapArea(0xc000, 0xc7ff, 2, System16Z80Ram); - ZetMemEnd(); - - ZetSetReadHandler(System16Z802203Read); - ZetSetWriteHandler(System16Z802203Write); - ZetSetInHandler(System16Z802203PortRead); - ZetClose(); - } else { - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); - - ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); - ZetMemEnd(); - - ZetSetReadHandler(System16Z80PCMRead); - ZetSetWriteHandler(System16Z80PCMWrite); - ZetSetInHandler(System16PPIZ80PortRead); - ZetSetOutHandler(System16Z80PortWrite); - ZetClose(); - } - } - - if (PPI0PortWriteA == NULL) PPI0PortWriteA = HangonPPI0WritePortA; - if (PPI0PortWriteB == NULL) PPI0PortWriteB = HangonPPI0WritePortB; - if (PPI0PortWriteC == NULL) PPI0PortWriteC = HangonPPI0WritePortC; - if (PPI1PortReadC == NULL) PPI1PortReadC = HangonPPI1ReadPortC; - if (PPI1PortWriteA == NULL) PPI1PortWriteA = HangonPPI1WritePortA; - ppi8255_init(2); - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { - BurnYM2203Init(1, 4000000, &System16YM2203IRQHandler, System16SynchroniseStream, System16GetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.37, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.13, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.13, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.13, BURN_SND_ROUTE_BOTH); - } else { - BurnYM2151Init(4000000); - BurnYM2151SetIrqHandler(&System16YM2151IRQHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.43, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.43, BURN_SND_ROUTE_RIGHT); - } - - if (System16PCMDataSize) { - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { - SegaPCMInit(0, 8000000, BANK_512, System16PCMData, System16PCMDataSize); - } else { - SegaPCMInit(0, 4000000, BANK_512, System16PCMData, System16PCMDataSize); - } - SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_1, 1.0, BURN_SND_ROUTE_LEFT); - SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_2, 1.0, BURN_SND_ROUTE_RIGHT); - } - - System16TileBankSize = 0x1000; - System16ATileMapsInit(0); - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN) { - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x05ffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x05ffff, SM_FETCH); - SekMapMemory(System16ExtraRam , 0x060000, 0x067fff, SM_RAM); - SekMapMemory(System16TileRam , 0x100000, 0x10ffff, SM_READ); - SekMapMemory(System16TextRam , 0x110000, 0x110fff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x120000, 0x121fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x130000, 0x130fff, SM_RAM); - SekMapMemory(System16Rom2 , 0x200000, 0x23ffff, SM_READ); - SekMapMemory(System16Ram , 0x260000, 0x267fff, SM_RAM); - SekMapMemory(System16RoadRam , 0x280000, 0x280fff, SM_RAM); - SekSetResetCallback(OutrunResetCallback); - SekSetReadWordHandler(0, OutrunReadWord); - SekSetWriteWordHandler(0, OutrunWriteWord); - SekSetReadByteHandler(0, OutrunReadByte); - SekSetWriteByteHandler(0, OutrunWriteByte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(System16Rom2 , 0x000000, 0x03ffff, SM_READ); - SekMapMemory(System16Rom2 , 0x000000, 0x03ffff, SM_FETCH); - SekMapMemory(System16Ram , 0x060000, 0x067fff, SM_RAM); - SekMapMemory(System16RoadRam , 0x080000, 0x080fff, SM_RAM); - SekSetWriteWordHandler(0, Outrun2WriteWord); - SekSetReadByteHandler(0, Outrun2ReadByte); - SekSetWriteByteHandler(0, Outrun2WriteByte); - SekClose(); - - if (System16MapZ80Do) { - ZetInit(0); - ZetOpen(0); - System16MapZ80Do(); - ZetClose(); - } else { - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); - - ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); - ZetMemEnd(); - - ZetSetReadHandler(System16Z80PCMRead); - ZetSetWriteHandler(System16Z80PCMWrite); - ZetSetInHandler(System16PPIZ80PortRead); - ZetSetOutHandler(System16Z80PortWrite); - ZetClose(); - } - - if (PPI0PortWriteC == NULL) PPI0PortWriteC = OutrunPPI0WritePortC; - ppi8255_init(1); - - BurnYM2151Init(4000000); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.43, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.43, BURN_SND_ROUTE_RIGHT); - - if (System16PCMDataSize) { - SegaPCMInit(0, 4000000, BANK_512, System16PCMData, System16PCMDataSize); - SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_1, 1.0, BURN_SND_ROUTE_LEFT); - SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_2, 1.0, BURN_SND_ROUTE_RIGHT); - } - - System16RoadColorOffset1 = 0x400; - System16RoadColorOffset2 = 0x420; - System16RoadColorOffset3 = 0x780; - - System16TileBankSize = 0x1000; - System16BTileMapsInit(0); - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX) { - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x07ffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x07ffff, SM_FETCH); - SekMapMemory(System16TileRam , 0x0c0000, 0x0cffff, SM_READ); - SekMapMemory(System16TextRam , 0x0d0000, 0x0d0fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x100000, 0x100fff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x101000, 0x101fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x102000, 0x102fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x103000, 0x103fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x104000, 0x104fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x105000, 0x105fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x106000, 0x106fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x107000, 0x107fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x108000, 0x108fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x109000, 0x109fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x10a000, 0x10afff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x10b000, 0x10bfff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x10c000, 0x10cfff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x10d000, 0x10dfff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x10e000, 0x10efff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16SpriteRam , 0x10f000, 0x10ffff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) - SekMapMemory(System16PaletteRam , 0x120000, 0x123fff, SM_RAM); - SekMapMemory(System16Rom2 , 0x200000, 0x27ffff, SM_READ); - SekMapMemory(System16Ram , 0x29c000, 0x2a3fff, SM_RAM); - SekMapMemory(System16RoadRam , 0x2ec000, 0x2ecfff, SM_RAM); - SekMapMemory(System16RoadRam , 0x2ed000, 0x2edfff, SM_RAM); // Tests past Road RAM in mem tests (mirror?) - SekMapMemory(System16BackupRam2 , 0xff4000, 0xff7fff, SM_RAM); - SekMapMemory(System16BackupRam , 0xff8000, 0xffffff, SM_RAM); - SekMapMemory(System16BackupRam2 , 0xffc000, 0xffffff, SM_RAM); - SekSetResetCallback(OutrunResetCallback); - SekSetReadWordHandler(0, XBoardReadWord); - SekSetWriteWordHandler(0, XBoardWriteWord); - SekSetReadByteHandler(0, XBoardReadByte); - SekSetWriteByteHandler(0, XBoardWriteByte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(System16Rom2 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(System16Ram , 0x09c000, 0x0a3fff, SM_RAM); - SekMapMemory(System16RoadRam , 0x0ec000, 0x0ecfff, SM_RAM); - SekMapMemory(System16Rom2 , 0x200000, 0x27ffff, SM_ROM); - SekMapMemory(System16Ram , 0x29c000, 0x2a3fff, SM_RAM); - SekMapMemory(System16RoadRam , 0x2ec000, 0x2ecfff, SM_RAM); - SekSetReadWordHandler(0, XBoard2ReadWord); - SekSetWriteWordHandler(0, XBoard2WriteWord); - SekSetReadByteHandler(0, XBoard2ReadByte); - SekSetWriteByteHandler(0, XBoard2WriteByte); - SekClose(); - - if (System16MapZ80Do) { - ZetInit(0); - ZetOpen(0); - System16MapZ80Do(); - ZetClose(); - } else { - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); - - ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); - ZetMemEnd(); - - ZetSetReadHandler(System16Z80PCMRead); - ZetSetWriteHandler(System16Z80PCMWrite); - ZetSetInHandler(SystemXZ80PortRead); - ZetSetOutHandler(System16Z80PortWrite); - ZetClose(); - } - - if (System16Z80Rom2Num) { - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0xefff, 0, System16Z80Rom2); - ZetMapArea(0x0000, 0xefff, 2, System16Z80Rom2); - - ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram2); - ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram2); - ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram2); - ZetMemEnd(); - - ZetSetReadHandler(System16Z80Read2); - ZetSetWriteHandler(System16Z80Write2); - ZetSetInHandler(System16Z80PortRead2); - ZetClose(); - } - - BurnYM2151Init(4000000); - BurnYM2151SetIrqHandler(&System16YM2151IRQHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.43, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.43, BURN_SND_ROUTE_RIGHT); - - if (System16PCMDataSize) { - SegaPCMInit(0, 4000000, BANK_512, System16PCMData, System16PCMDataSize); - SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - } - - if (System16PCM2DataSize) { - SegaPCMInit(1, 4000000, BANK_512, System16PCM2Data, System16PCM2DataSize); - SegaPCMSetRoute(1, BURN_SND_SEGAPCM_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - SegaPCMSetRoute(1, BURN_SND_SEGAPCM_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - } - - System16RoadColorOffset1 = 0x1700; - System16RoadColorOffset2 = 0x1720; - System16RoadColorOffset3 = 0x1780; - System16RoadXOffset = -166; - System16RoadPriority = 1; - System16TilemapColorOffset = 0x1c00; - - System16TileBankSize = 0x1000; - System16BTileMapsInit(0); - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMY) { - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(System16Rom , 0x000000, 0x07ffff, SM_READ); - SekMapMemory(System16Code , 0x000000, 0x07ffff, SM_FETCH); - SekMapMemory(System16Ram , 0x0c0000, 0x0cffff, SM_RAM); - SekMapMemory(System16ExtraRam , 0xff0000, 0xffffff, SM_RAM); - SekSetReadWordHandler(0, YBoardReadWord); - SekSetWriteWordHandler(0, YBoardWriteWord); - SekSetReadByteHandler(0, YBoardReadByte); - SekSetWriteByteHandler(0, YBoardWriteByte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(System16Rom2 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(System16Ram , 0x0c0000, 0x0cffff, SM_RAM); - SekMapMemory(System16SpriteRam2 , 0x180000, 0x18ffff, SM_RAM); - SekMapMemory(System16ExtraRam2 , 0xff0000, 0xffbfff, SM_RAM); - SekMapMemory(System16BackupRam , 0xffc000, 0xffffff, SM_RAM); - SekSetReadWordHandler(0, YBoard2ReadWord); - SekSetWriteWordHandler(0, YBoard2WriteWord); - SekClose(); - - SekInit(2, 0x68000); - SekOpen(2); - SekMapMemory(System16Rom3 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(System16Ram , 0x0c0000, 0x0cffff, SM_RAM); - SekMapMemory(System16RotateRam , 0x180000, 0x1807ff, SM_RAM); - SekMapMemory(System16SpriteRam , 0x188000, 0x188fff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x190000, 0x193fff, SM_RAM); - SekMapMemory(System16PaletteRam , 0x194000, 0x197fff, SM_RAM); - SekMapMemory(System16ExtraRam3 , 0xff0000, 0xffffff, SM_RAM); - SekSetReadWordHandler(0, YBoard3ReadWord); - SekSetWriteWordHandler(0, YBoard3WriteWord); - SekSetReadByteHandler(0, YBoard3ReadByte); - SekClose(); - - if (System16MapZ80Do) { - ZetInit(0); - ZetOpen(0); - System16MapZ80Do(); - ZetClose(); - } else { - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); - ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); - - ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); - ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); - ZetMemEnd(); - - ZetSetReadHandler(System16Z80PCMRead); - ZetSetWriteHandler(System16Z80PCMWrite); - ZetSetInHandler(SystemXZ80PortRead); - ZetSetOutHandler(System16Z80PortWrite); - ZetClose(); - } - - BurnYM2151Init(32215900 / 8); - BurnYM2151SetIrqHandler(&System16YM2151IRQHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.43, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.43, BURN_SND_ROUTE_RIGHT); - - if (System16PCMDataSize) { - SegaPCMInit(0, 32215900 / 8, BANK_12M | BANK_MASKF8, System16PCMData, System16PCMDataSize); - SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_1, 1.0, BURN_SND_ROUTE_LEFT); - SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_2, 1.0, BURN_SND_ROUTE_RIGHT); - } - } - - GenericTilesInit(); - bSystem16BootlegRender = false; - - // Reset the driver - System16DoReset(); - - return 0; -} - -/*==================================================== -Exit Function -====================================================*/ - -INT32 System16Exit() -{ - INT32 i; - - SekExit(); - if (System16Z80RomNum || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM)) ZetExit(); - if (System167751ProgSize) { - N7751Exit(); - DACExit(); - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { - BurnYM3438Exit(); - RF5C68PCMExit(); - } else { - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { - BurnYM2203Exit(); - } else { - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { - BurnYM2413Exit(); - } else { - BurnYM2151Exit(); - } - } - } - - if (System16PCMDataSize) SegaPCMExit(); - if (System16UPD7759DataSize) UPD7759Exit(); - - if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16A) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN)) { - ppi8255_exit(); - } - - if (nBurnGunNumPlayers) BurnGunExit(); - - GenericTilesExit(); - System16TileMapsExit(); - - BurnFree(Mem); - - // Reset Variables - for (i = 0; i < 4; i++) { - System16Page[i] = 0; - System16OldPage[i] = 0; - System16ScrollX[i] = 0; - System16ScrollY[i] = 0; - BootlegBgPage[i] = 0; - BootlegFgPage[i] = 0; - } - - for (i = 0; i < 16; i++) { - System16SpriteBanks[i] = 0; - } - - for (i = 0; i < 8; i++) { - System16TileBanks[i] = 0; - System16OldTileBanks[i] = 0; - } - - System16VideoEnable = 0; - System18VdpEnable = 0; - System18VdpMixing = 0; - System16ScreenFlip = 0; - System16SpriteShadow = 0; - System16SpriteXOffset = 0; - System16VideoControl = 0; - System16SoundLatch = 0; - System16ColScroll = 0; - System16RowScroll = 0; - System16IgnoreVideoEnable = 0; - - System16LastGear = 0; - System16HasGears = false; - - System16RoadControl = 0; - System16RoadColorOffset1 = 0; - System16RoadColorOffset2 = 0; - System16RoadColorOffset3 = 0; - System16RoadXOffset = 0; - System16RoadPriority = 0; - System16AnalogSelect = 0; - - System16ClockSpeed = 0; - - System16PaletteEntries = 0; - System16RamSize = 0; - System16ExtraRamSize = 0; - System16ExtraRam2Size = 0; - System16ExtraRam3Size = 0; - System16SpriteRamSize = 0; - System16SpriteRam2Size = 0; - System16RotateRamSize = 0; - System16TilemapColorOffset = 0; - System16TileBankSize = 0; - System16RecalcBgTileMap = 0; - System16RecalcBgAltTileMap = 0; - System16RecalcFgTileMap = 0; - System16RecalcFgAltTileMap = 0; - System16CreateOpaqueTileMaps = 0; - - System16BTileAlt = false; - Shangon = false; - Hangon = false; - bSystem16BootlegRender = false; - - System16YM2413IRQInterval = 0; - - UPD7759BankAddress = 0; - N7751Command = 0; - N7751RomAddress = 0; - - System16RomSize = 0; - System16RomNum = 0; - System16Rom2Size = 0; - System16Rom2Num = 0; - System16Rom3Size = 0; - System16Rom3Num = 0; - System16TileRomSize = 0; - System16TileRomNum = 0; - System16NumTiles = 0; - System16SpriteRomSize = 0; - System16SpriteRomNum = 0; - System16Sprite2RomSize = 0; - System16Sprite2RomNum = 0; - System16RoadRomSize = 0; - System16RoadRomNum = 0; - System16Z80RomSize = 0; - System16Z80RomNum = 0; - System16Z80Rom2Size = 0; - System16Z80Rom2Num = 0; - System16Z80Rom3Size = 0; - System16Z80Rom3Num = 0; - System16Z80Rom4Size = 0; - System16Z80Rom4Num = 0; - System167751ProgSize = 0; - System167751ProgNum = 0; - System167751DataSize = 0; - System167751DataNum = 0; - System16UPD7759DataSize = 0; - System16UPD7759DataNum = 0; - System16PCMDataSizePreAllocate = 0; - System16PCMDataSize = 0; - System16PCMDataNum = 0; - System16PCM2DataSize = 0; - System16PCM2DataNum = 0; - System16RF5C68DataSize = 0; - System16RF5C68DataNum = 0; - System16PromSize = 0; - System16PromNum = 0; - System16KeySize = 0; - - Simulate8751 = NULL; - System16Map68KDo = NULL; - System16MapZ80Do = NULL; - System16CustomLoadRomDo = NULL; - System16CustomDecryptOpCodeDo = NULL; - System16ProcessAnalogControlsDo = NULL; - System16MakeAnalogInputsDo = NULL; - - memset(multiply, 0, sizeof(multiply)); - memset(divide, 0, sizeof(divide)); - memset(compare_timer, 0, sizeof(compare_timer)); - - if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC_CPU2)) { - fd1094_exit(); - - // Switch back CPU core if needed - if (bUseAsm68KCoreOldValue) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); -#endif - bUseAsm68KCoreOldValue = false; - bBurnUseASMCPUEmulation = true; - } - } - - return 0; -} - -/*==================================================== -Frame Functions -====================================================*/ - -INT32 System16AFrame() -{ - INT32 nInterleave = 100; // alien syndrome needs high interleave for the DAC sounds to be processed - - if (System16Reset) System16DoReset(); - - System16MakeInputs(); - - nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = 4000000 / 60; - nCyclesTotal[2] = (6000000 / 15) / 60; - nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - ZetNewFrame(); - I8039NewFrame(); - - SekOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (System167751ProgSize) { - nCurrentCPU = 2; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = N7751Run(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - ZetClose(); - } - } - - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - if (Simulate8751) Simulate8751(); - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - } - - if (System167751ProgSize) DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) System16ARender(); - - return 0; -} - -INT32 System16BFrame() -{ - INT32 nInterleave = (nBurnSoundRate <= 44100) ? 183 : 200; // For the UPD7759 - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) nInterleave = System16YM2413IRQInterval; - - if (System16Reset) System16DoReset(); - - System16MakeInputs(); - - nCyclesTotal[0] = (INT32)((INT64)System16ClockSpeed * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = 5000000 / 60; - nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - if (System16Z80RomNum || ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM) && System16Z80Enable)) ZetNewFrame(); - - SekOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { - SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - } - - // Run Z80 - if (System16Z80RomNum || ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM) && System16Z80Enable)) { - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { - BurnYM2413Render(pSoundBuf, nSegmentLength); - } else { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - if (System16UPD7759DataSize) UPD7759Update(0,pSoundBuf, nSegmentLength); - ZetClose(); - } - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { - BurnYM2413Render(pSoundBuf, nSegmentLength); - } else { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - if (System16UPD7759DataSize) UPD7759Update(0,pSoundBuf, nSegmentLength); - ZetClose(); - } - } - } - - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - if (Simulate8751) Simulate8751(); - - if (pBurnDraw) { - if (System16BTileAlt) { - System16BAltRender(); - } else { - if (bSystem16BootlegRender) { - System16BootlegRender(); - } else { - System16BRender(); - } - } - } - - return 0; -} - -INT32 System18Frame() -{ - INT32 nInterleave = nBurnSoundLen; - - if (System16Reset) System16DoReset(); - - System16MakeInputs(); - - if (nBurnGunNumPlayers) System16GunMakeInputs(); - - nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = 8000000 / 60; - nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - - nCurrentCPU = 1; - ZetOpen(0); - BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - RF5C68PCMUpdate(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - ZetOpen(0); - BurnTimerEndFrame(nCyclesTotal[1]); - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - RF5C68PCMUpdate(pSoundBuf, nSegmentLength); - } - } - - ZetOpen(0); - if (pBurnSoundOut) BurnYM3438Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) { - System18Render(); - } - - return 0; -} - -INT32 HangonFrame() -{ - INT32 nInterleave = 10, i; - - if (System16Reset) System16DoReset(); - - System16MakeInputs(); - - nCyclesTotal[0] = (INT32)((INT64)System16ClockSpeed * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = (INT32)((INT64)System16ClockSpeed * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[2] = 4000000 / 60; - nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 #1 - nCurrentCPU = 0; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - SekClose(); - - // Run 68000 #2 - nCurrentCPU = 1; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = SekRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - SekClose(); - - // Run Z80 - nCurrentCPU = 2; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - SegaPCMUpdate(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - SegaPCMUpdate(pSoundBuf, nSegmentLength); - } - } - - SekOpen(0); - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - if (Simulate8751) Simulate8751(); - - if (pBurnDraw) { - HangonRender(); - } - - return 0; -} - -INT32 HangonYM2203Frame() -{ - INT32 nInterleave = 100, i; - - if (System16Reset) System16DoReset(); - - System16MakeInputs(); - - nCyclesTotal[0] = (INT32)((INT64)System16ClockSpeed * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = (INT32)((INT64)System16ClockSpeed * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[2] = 4000000 / 60; - nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 #1 - nCurrentCPU = 0; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - SekClose(); - - // Run 68000 #2 - nCurrentCPU = 1; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = SekRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - SekClose(); - - ZetOpen(0); - BurnTimerUpdate(i * (nCyclesTotal[2] / nInterleave)); - ZetClose(); - } - - SekOpen(0); - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - ZetOpen(0); - BurnTimerEndFrame(nCyclesTotal[2]); - ZetClose(); - - if (pBurnSoundOut) { - ZetOpen(0); - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - SegaPCMUpdate(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - } - - if (Simulate8751) Simulate8751(); - - if (pBurnDraw) { - if (Hangon) { - HangonAltRender(); - } else { - HangonRender(); - } - } - - return 0; -} - -INT32 OutrunFrame() -{ - INT32 nInterleave = 10, i; - - if (System16Reset) System16DoReset(); - - if (System16HasGears) { - OutrunMakeInputs(); - } else { - System16MakeInputs(); - } - - nCyclesTotal[0] = (INT32)((INT64)(40000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = (INT32)((INT64)(40000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[2] = (16000000 / 4) / 60; - nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 #1 - nCurrentCPU = 0; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 2 || i == 6 || i == 8) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run 68000 #2 - nCurrentCPU = 1; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = SekRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - SekClose(); - - // Run Z80 - nCurrentCPU = 2; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - SegaPCMUpdate(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - SegaPCMUpdate(pSoundBuf, nSegmentLength); - } - } - - for (i = 0; i < 2; i++) { - SekOpen(i); - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - } - - if (pBurnDraw) { - if (!Shangon) { - OutrunRender(); - } else { - ShangonRender(); - } - } - - return 0; -} - -INT32 XBoardFrame() -{ - INT32 nInterleave = 100, i; - - if (System16Reset) System16DoReset(); - - System16MakeInputs(); - - if (nBurnGunNumPlayers) System16GunMakeInputs(); - - nCyclesTotal[0] = (INT32)((INT64)(50000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = (INT32)((INT64)(50000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[2] = (16000000 / 4) / 60; - nCyclesTotal[3] = (16000000 / 4) / 60; - nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = nSystem16CyclesDone[3] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 #1 - nCurrentCPU = 0; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 20 || i == 40 || i == 60 || i == 80) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - if (i == 99) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run 68000 #2 - nCurrentCPU = 1; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = SekRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 99) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run Z80 - nCurrentCPU = 2; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - // Run Z80 #2 - if (System16Z80Rom2Num) { - nCurrentCPU = 3; - ZetOpen(1); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - if (System16PCMDataSize) SegaPCMUpdate(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - if (System16PCMDataSize) SegaPCMUpdate(pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) { - XBoardRender(); - } - - return 0; -} - -INT32 YBoardFrame() -{ - INT32 nInterleave = 262, i; - - if (System16Reset) System16DoReset(); - - if (System16HasGears) { - PdriftMakeInputs(); - } else { - System16MakeInputs(); - } - - if (nBurnGunNumPlayers) System16GunMakeInputs(); - - nCyclesTotal[0] = (INT32)((INT64)(50000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = (INT32)((INT64)(50000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[2] = (INT32)((INT64)(50000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[3] = (32215900 / 8) / 60; - nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = nSystem16CyclesDone[3] = 0; - - INT32 nSoundBufferPos = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 #1 - nCurrentCPU = 0; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - if (i == 170) SekSetIRQLine(2, SEK_IRQSTATUS_ACK); - if (i == 171) SekSetIRQLine(2, SEK_IRQSTATUS_NONE); - if (i == 223) SekSetIRQLine(4, SEK_IRQSTATUS_ACK); - if (i == 224) SekSetIRQLine(4, SEK_IRQSTATUS_NONE); - SekClose(); - - // Run 68000 #2 - nCurrentCPU = 1; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = SekRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 170) SekSetIRQLine(2, SEK_IRQSTATUS_ACK); - if (i == 171) SekSetIRQLine(2, SEK_IRQSTATUS_NONE); - if (i == 223) SekSetIRQLine(4, SEK_IRQSTATUS_ACK); - if (i == 224) SekSetIRQLine(4, SEK_IRQSTATUS_NONE); - SekClose(); - - // Run 68000 #3 - nCurrentCPU = 2; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = SekRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 170) SekSetIRQLine(2, SEK_IRQSTATUS_ACK); - if (i == 171) SekSetIRQLine(2, SEK_IRQSTATUS_NONE); - if (i == 223) SekSetIRQLine(4, SEK_IRQSTATUS_ACK); - if (i == 224) SekSetIRQLine(4, SEK_IRQSTATUS_NONE); - SekClose(); - - // Run Z80 - nCurrentCPU = 3; - ZetOpen(0); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; - ZetClose(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - SegaPCMUpdate(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - SegaPCMUpdate(pSoundBuf, nSegmentLength); - } - } - - if (pBurnDraw) { - YBoardRender(); - } - - return 0; -} - -/*==================================================== -Driver Scan -====================================================*/ - -INT32 System16Scan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029719; - } - - if (nAction & ACB_NVRAM) { - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMY) { - if (System16BackupRamSize) { - memset(&ba, 0, sizeof(ba)); - ba.Data = System16BackupRam; - ba.nLen = System16BackupRamSize; - ba.szName = "Backup Ram 1"; - BurnAcb(&ba); - } - - if (System16BackupRam2Size) { - memset(&ba, 0, sizeof(ba)); - ba.Data = System16BackupRam2; - ba.nLen = System16BackupRam2Size; - ba.szName = "Backup Ram 2"; - BurnAcb(&ba); - } - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16B || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16A || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { - memset(&ba, 0, sizeof(ba)); - ba.Data = System16Ram; - ba.nLen = System16RamSize; - ba.szName = "Work Ram"; - BurnAcb(&ba); - } - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - if (System16Z80RomNum || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM)) { - ZetScan(nAction); - } - - if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC_CPU2)) { - fd1094_scan(nAction); - } - - if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16A) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN)) { - ppi8255_scan(); - } - - if (nBurnGunNumPlayers) BurnGunScan(); - - SCAN_VAR(System16SoundLatch); - SCAN_VAR(System16Input); - SCAN_VAR(System16Dip); - SCAN_VAR(System16VideoEnable); - SCAN_VAR(System16ScreenFlip); - SCAN_VAR(System16ScrollX); - SCAN_VAR(System16ScrollY); - SCAN_VAR(System16ColScroll); - SCAN_VAR(System16RowScroll); - SCAN_VAR(System16SpriteBanks); - SCAN_VAR(System16TileBanks); - SCAN_VAR(System16Page); - SCAN_VAR(BootlegBgPage); - SCAN_VAR(BootlegFgPage); - SCAN_VAR(System16AnalogSelect); - SCAN_VAR(System16LastGear); - SCAN_VAR(nSystem16CyclesDone); - SCAN_VAR(nCyclesSegment); - SCAN_VAR(System16RoadControl); - SCAN_VAR(multiply); - SCAN_VAR(divide); - SCAN_VAR(compare_timer); - SCAN_VAR(N7751Command); - SCAN_VAR(N7751RomAddress); - SCAN_VAR(UPD7759BankAddress); - SCAN_VAR(System18VdpMixing); - SCAN_VAR(System18VdpEnable); - SCAN_VAR(RF5C68PCMBankAddress); - SCAN_VAR(System16Z80Enable); - - if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { - BurnYM3438Scan(nAction, pnMin); - RF5C68PCMScan(nAction); - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0xa000, 0xbfff, 0, System16Z80Rom + 0x10000 + RF5C68PCMBankAddress); - ZetMapArea(0xa000, 0xbfff, 2, System16Z80Rom + 0x10000 + RF5C68PCMBankAddress); - ZetClose(); - } - } else { - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { - BurnYM2203Scan(nAction, pnMin); - } else { - if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { - BurnYM2413Scan(nAction); - } else { - BurnYM2151Scan(nAction); - } - } - } - - if (System16UPD7759DataSize) { - UPD7759Scan(0,nAction, pnMin); - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x8000, 0xdfff, 0, System16UPD7759Data + UPD7759BankAddress); - ZetMapArea(0x8000, 0xdfff, 2, System16UPD7759Data + UPD7759BankAddress); - ZetClose(); - } - } - - if (System167751ProgSize) { - N7751Scan(nAction, pnMin); - DACScan(nAction, pnMin); - } - - if (System16PCMDataSize) { - SegaPCMScan(nAction, pnMin); - } - - System16GfxScan(nAction); - } - - return 0; -} +#include "sys16.h" +#include "dac.h" +#include "i8039.h" +#include "mc8123.h" +#include "upd7759.h" +#include "segapcm.h" + +UINT8 System16InputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 System16InputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 System16InputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 System16InputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 System16InputPort4[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 System16InputPort5[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 System16InputPort6[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +UINT8 System16Gear = 0; +INT32 System16AnalogPort0 = 0; +INT32 System16AnalogPort1 = 0; +INT32 System16AnalogPort2 = 0; +INT32 System16AnalogPort3 = 0; +INT32 System16AnalogPort4 = 0; +INT32 System16AnalogPort5 = 0; +INT32 System16AnalogSelect = 0; +UINT8 System16Dip[3] = {0, 0, 0}; +UINT8 System16Input[7] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +UINT8 System16Reset = 0; + +UINT8 *Mem = NULL; +UINT8 *MemEnd = NULL; +UINT8 *RamStart = NULL; +UINT8 *RamEnd = NULL; +UINT8 *System16Rom = NULL; +UINT8 *System16Code = NULL; +UINT8 *System16Rom2 = NULL; +UINT8 *System16Rom3 = NULL; +UINT8 *System16Z80Rom = NULL; +UINT8 *System16Z80Code = NULL; +UINT8 *System16Z80Rom2 = NULL; +UINT8 *System16Z80Rom3 = NULL; +UINT8 *System16Z80Rom4 = NULL; +UINT8 *System167751Prog = NULL; +UINT8 *System167751Data = NULL; +UINT8 *System16UPD7759Data = NULL; +UINT8 *System16PCMData = NULL; +UINT8 *System16PCM2Data = NULL; +UINT8 *System16RF5C68Data = NULL; +UINT8 *System16Prom = NULL; +UINT8 *System16Key = NULL; +UINT8 *System16Ram = NULL; +UINT8 *System16ExtraRam = NULL; +UINT8 *System16ExtraRam2 = NULL; +UINT8 *System16ExtraRam3 = NULL; +UINT8 *System16BackupRam = NULL; +UINT8 *System16BackupRam2 = NULL; +UINT8 *System16Z80Ram = NULL; +UINT8 *System16Z80Ram2 = NULL; +UINT8 *System16TileRam = NULL; +UINT8 *System16TextRam = NULL; +UINT8 *System16SpriteRam = NULL; +UINT8 *System16SpriteRamBuff = NULL; +UINT8 *System16SpriteRam2 = NULL; +UINT8 *System16RotateRam = NULL; +UINT8 *System16RotateRamBuff = NULL; +UINT8 *System16PaletteRam = NULL; +UINT8 *System16RoadRam = NULL; +UINT8 *System16RoadRamBuff = NULL; +UINT8 *System16Tiles = NULL; +UINT8 *System16Sprites = NULL; +UINT8 *System16Sprites2 = NULL; +UINT8 *System16Roads = NULL; +UINT32 *System16Palette = NULL; +UINT8 *System16TempGfx = NULL; + +UINT32 System16RomSize = 0; +UINT32 System16RomNum = 0; +UINT32 System16Rom2Size = 0; +UINT32 System16Rom2Num = 0; +UINT32 System16Rom3Size = 0; +UINT32 System16Rom3Num = 0; +UINT32 System16TileRomSize = 0; +UINT32 System16TileRomNum = 0; +UINT32 System16NumTiles = 0; +UINT32 System16SpriteRomSize = 0; +UINT32 System16SpriteRomNum = 0; +UINT32 System16Sprite2RomSize = 0; +UINT32 System16Sprite2RomNum = 0; +UINT32 System16RoadRomSize = 0; +UINT32 System16RoadRomNum = 0; +UINT32 System16Z80RomSize = 0; +UINT32 System16Z80RomNum = 0; +UINT32 System16Z80Rom2Size = 0; +UINT32 System16Z80Rom2Num = 0; +UINT32 System16Z80Rom3Size = 0; +UINT32 System16Z80Rom3Num = 0; +UINT32 System16Z80Rom4Size = 0; +UINT32 System16Z80Rom4Num = 0; +UINT32 System167751ProgSize = 0; +UINT32 System167751ProgNum = 0; +UINT32 System167751DataSize = 0; +UINT32 System167751DataNum = 0; +UINT32 System16UPD7759DataSize = 0; +UINT32 System16UPD7759DataNum = 0; +UINT32 System16PCMDataSize = 0; +UINT32 System16PCMDataNum = 0; +UINT32 System16PCMDataSizePreAllocate = 0; +UINT32 System16PCM2DataSize = 0; +UINT32 System16PCM2DataNum = 0; +UINT32 System16RF5C68DataSize = 0; +UINT32 System16RF5C68DataNum = 0; +UINT32 System16PromSize = 0; +UINT32 System16PromNum = 0; +UINT32 System16KeySize = 0; +UINT32 System16RamSize = 0; +UINT32 System16ExtraRamSize = 0; +UINT32 System16ExtraRam2Size = 0; +UINT32 System16ExtraRam3Size = 0; +UINT32 System16SpriteRamSize = 0; +UINT32 System16SpriteRam2Size = 0; +UINT32 System16RotateRamSize = 0; +UINT32 System16BackupRamSize = 0; +UINT32 System16BackupRam2Size = 0; + +static INT32 System16LastGear; +bool System16HasGears = false; + +UINT8 System16VideoControl; +INT32 System16SoundLatch; +bool System16BTileAlt = false; +bool Shangon = false; +bool Hangon = false; +bool System16Z80Enable = true; + +INT32 nSystem16CyclesDone[4]; +static INT32 nCyclesTotal[4]; +static INT32 nCyclesSegment; +UINT32 System16ClockSpeed = 0; + +INT32 System16YM2413IRQInterval; + +static bool bUseAsm68KCoreOldValue = false; + +static UINT8 N7751Command; +static UINT32 N7751RomAddress; +static UINT32 UPD7759BankAddress; +static UINT32 RF5C68PCMBankAddress; + +Sim8751 Simulate8751; +System16Map68K System16Map68KDo; +System16MapZ80 System16MapZ80Do; +System16CustomLoadRom System16CustomLoadRomDo; +System16CustomDecryptOpCode System16CustomDecryptOpCodeDo; +System16ProcessAnalogControls System16ProcessAnalogControlsDo; +System16MakeAnalogInputs System16MakeAnalogInputsDo; + +/*==================================================== +Inputs +====================================================*/ + +inline static void System16ClearOpposites(UINT8* nJoystickInputs) +{ + if ((*nJoystickInputs & 0x30) == 0x30) { + *nJoystickInputs &= ~0x30; + } + if ((*nJoystickInputs & 0xc0) == 0xc0) { + *nJoystickInputs &= ~0xc0; + } +} + +inline static void System16MakeInputs() +{ + // Reset Inputs + System16Input[0] = System16Input[1] = System16Input[2] = System16Input[3] = System16Input[4] = System16Input[5] = System16Input[6] = 0; + + // Compile Digital Inputs + for (int i = 0; i < 8; i++) { + System16Input[0] |= (System16InputPort0[i] & 1) << i; + System16Input[1] |= (System16InputPort1[i] & 1) << i; + System16Input[2] |= (System16InputPort2[i] & 1) << i; + System16Input[3] |= (System16InputPort3[i] & 1) << i; + System16Input[4] |= (System16InputPort4[i] & 1) << i; + System16Input[5] |= (System16InputPort5[i] & 1) << i; + System16Input[6] |= (System16InputPort6[i] & 1) << i; + } + + if (System16MakeAnalogInputsDo) System16MakeAnalogInputsDo(); +} + +inline static void OutrunMakeInputs() +{ + // Reset Inputs + System16Input[0] = 0; + + if (System16Gear && System16LastGear == 0) System16InputPort0[4] ^= 1; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + System16Input[0] |= (System16InputPort0[i] & 1) << i; + } + + System16LastGear = System16Gear; +} + +inline static void PdriftMakeInputs() +{ + // Reset Inputs + System16Input[0] = 0; + + if (System16Gear && System16LastGear == 0) System16InputPort0[5] ^= 1; + + // Compile Digital Inputs + for (INT32 i = 0; i < 8; i++) { + System16Input[0] |= (System16InputPort0[i] & 1) << i; + } + + System16LastGear = System16Gear; +} + +static void System16GunMakeInputs() +{ + if (nBurnGunNumPlayers) BurnGunMakeInputs(0, (INT16)System16AnalogPort0, (INT16)System16AnalogPort1); + if (nBurnGunNumPlayers >= 2) BurnGunMakeInputs(1, (INT16)System16AnalogPort2, (INT16)System16AnalogPort3); + if (nBurnGunNumPlayers >= 3) BurnGunMakeInputs(2, (INT16)System16AnalogPort4, (INT16)System16AnalogPort5); +} + +/*==================================================== +Reset Driver +====================================================*/ + +static INT32 System16DoReset() +{ + INT32 i; + + if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC_CPU2)) { + fd1094_machine_init(); + } + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM) { + SekOpen(0); + SekMapMemory(System16Rom, 0x000000, 0x0fffff, SM_ROM); + SekClose(); + } + + SekOpen(0); + SekReset(); + SekClose(); + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMY) { + SekOpen(1); + SekReset(); + SekClose(); + + System16LastGear = 0; + System16RoadControl = 0; + System16AnalogSelect = 0; + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN) { + // Start in low gear + if (System16HasGears) System16InputPort0[4] = 1; + } + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMY) { + SekOpen(2); + SekReset(); + SekClose(); + + // Start in low gear + if (System16HasGears) System16InputPort0[5] = 1; + } + + if (System16Z80RomNum || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM)) { + ZetOpen(0); + ZetReset(); + ZetClose(); + } + + if (System16Z80Rom2Num) { + ZetOpen(1); + ZetReset(); + ZetClose(); + } + + if (System167751ProgSize) { + N7751Reset(); + DACReset(); + N7751Command = 0; + N7751RomAddress = 0; + } + + if (System16UPD7759DataSize) { + UPD7759Reset(); + UPD7759BankAddress = 0; + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { + BurnYM3438Reset(); + RF5C68PCMReset(); + } else { + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { + BurnYM2203Reset(); + } else { + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { + BurnYM2413Reset(); + } else { + BurnYM2151Reset(); + } + } + } + + // Reset Variables + for (i = 0; i < 4; i++) { + System16Page[i] = 0; + System16OldPage[i] = 0; + System16ScrollX[i] = 0; + System16ScrollY[i] = 0; + BootlegBgPage[i] = 0; + BootlegFgPage[i] = 0; + } + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_5358) { + System16SpriteBanks[ 0] = 0; + System16SpriteBanks[ 1] = 255; + System16SpriteBanks[ 2] = 255; + System16SpriteBanks[ 3] = 255; + System16SpriteBanks[ 4] = 255; + System16SpriteBanks[ 5] = 255; + System16SpriteBanks[ 6] = 255; + System16SpriteBanks[ 7] = 3; + System16SpriteBanks[ 8] = 255; + System16SpriteBanks[ 9] = 255; + System16SpriteBanks[10] = 255; + System16SpriteBanks[11] = 2; + System16SpriteBanks[12] = 255; + System16SpriteBanks[13] = 1; + System16SpriteBanks[14] = 0; + System16SpriteBanks[15] = 255; + } else { + for (i = 0; i < 16; i++) { + System16SpriteBanks[i] = i; + } + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16B || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18 || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX) { + for (i = 0; i < 8; i++) { + System16TileBanks[i] = i; + System16OldTileBanks[i] = i; + } + } + + System16VideoEnable = 0; + System18VdpEnable = 0; + System18VdpMixing = 0; + System16VideoControl = 0; + System16ScreenFlip = 0; + System16SoundLatch = 0; + System16ColScroll = 0; + System16RowScroll = 0;; + + return 0; +} + +INT32 __fastcall OutrunResetCallback() +{ + INT32 nLastCPU = nSekActive; + SekClose(); + + SekOpen(1); + SekReset(); + SekClose(); + + SekOpen(nLastCPU); + + return 0; +} + +/*==================================================== +Z80 Memory Handlers +====================================================*/ + +UINT8 __fastcall System16Z80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x01: { + return BurnYM2151ReadStatus(); + } + + case 0x40: + case 0xc0: { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return System16SoundLatch; + } + + case 0x80: { + if (System16UPD7759DataSize) { + return UPD7759BusyRead(0) << 7; + } + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); +#endif + + return 0; +} + +UINT8 __fastcall System16PPIZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x01: { + return BurnYM2151ReadStatus(); + } + + case 0x40: + case 0xc0: { + ppi8255_set_portC(0, 0x00); + return System16SoundLatch; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); +#endif + + return 0; +} + +UINT8 __fastcall SystemXZ80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x01: { + return BurnYM2151ReadStatus(); + } + + case 0x40: + case 0xc0: { + return System16SoundLatch; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); +#endif + + return 0; +} + +UINT8 __fastcall System16Z80PortRead2(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x40: + case 0xc0: { + return System16SoundLatch; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); +#endif + + return 0; +} + +void __fastcall System16Z80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + d &= 0xff; + + switch (a) { + case 0x00: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x01: { + BurnYM2151WriteRegister(d); + return; + } + + case 0x40: { + if (System16UPD7759DataSize) { + UPD7759StartWrite(0,d & 0x80); + UPD7759ResetWrite(0,d & 0x40); + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_5358) { + if (!(d & 0x04)) UPD7759BankAddress = 0x00000; + if (!(d & 0x08)) UPD7759BankAddress = 0x10000; + if (!(d & 0x10)) UPD7759BankAddress = 0x20000; + if (!(d & 0x20)) UPD7759BankAddress = 0x30000; + UPD7759BankAddress += (d & 0x03) * 0x4000; + + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_5521) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_5704_PS2)) { + UPD7759BankAddress = ((d & 0x08) >> 3) * 0x20000; + UPD7759BankAddress += (d & 0x07) * 0x4000; + } + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_5797) { + UPD7759BankAddress = ((d & 0x08) >> 3) * 0x40000; + UPD7759BankAddress += ((d & 0x10) >> 4) * 0x20000; + UPD7759BankAddress += (d & 0x07) * 0x04000; + } + + UPD7759BankAddress %= System16UPD7759DataSize; + + ZetMapArea(0x8000, 0xdfff, 0, System16UPD7759Data + UPD7759BankAddress); + ZetMapArea(0x8000, 0xdfff, 2, System16UPD7759Data + UPD7759BankAddress); + return; + } + } + + case 0x80: { + if (System167751ProgSize) { + N7751RomAddress &= 0x3fff; + N7751RomAddress |= (d & 0x01) << 14; + if (!(d & 0x02) && System167751DataNum >= 1) N7751RomAddress |= 0x00000; + if (!(d & 0x04) && System167751DataNum >= 2) N7751RomAddress |= 0x08000; + if (!(d & 0x08) && System167751DataNum >= 3) N7751RomAddress |= 0x10000; + if (!(d & 0x10) && System167751DataNum >= 4) N7751RomAddress |= 0x18000; + N7751Command = d >> 5; + return; + } + + if (System16UPD7759DataSize) { + UPD7759PortWrite(0,d); + return; + } + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Write Port -> %02X, %02X\n"), a, d); +#endif +} + +#if 0 && defined FBA_DEBUG +UINT8 __fastcall System16Z80Read(UINT16 a) +{ + bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); + + return 0; +} +#endif + +#if 0 && defined FBA_DEBUG +void __fastcall System16Z80Write(UINT16 a, UINT8 d) +{ + bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); +} +#endif + +UINT8 __fastcall System16Z80PCMRead(UINT16 a) +{ + if (a >= 0xf000 && a <= 0xf0ff) { + return SegaPCMRead(0, a - 0xf000); + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); +#endif + + return 0; +} + +void __fastcall System16Z80PCMWrite(UINT16 a, UINT8 d) +{ + if (a >= 0xf000 && a <= 0xf0ff) { + SegaPCMWrite(0, a - 0xf000, d); + return; + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); +#endif +} + +UINT8 __fastcall System16Z802203PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x40: { + ppi8255_set_portC(0, 0x00); + return System16SoundLatch; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); +#endif + + return 0; +} + +UINT8 __fastcall System16Z802203Read(UINT16 a) +{ + if (a >= 0xe000 && a <= 0xe0ff) { + return SegaPCMRead(0, a - 0xe000); + } + + switch (a) { + case 0xd000: { + return BurnYM2203Read(0, 0); + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); +#endif + + return 0; +} + +void __fastcall System16Z802203Write(UINT16 a, UINT8 d) +{ + if (a >= 0xe000 && a <= 0xe0ff) { + SegaPCMWrite(0, a - 0xe000, d); + return; + } + + switch (a) { + case 0xd000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0xd001: { + BurnYM2203Write(0, 1, d); + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); +#endif +} + +UINT8 __fastcall System16Z80Read2(UINT16 a) +{ + if (a >= 0xf000 && a <= 0xf0ff) { + return SegaPCMRead(1, a - 0xf000); + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); +#endif + + return 0; +} + +void __fastcall System16Z80Write2(UINT16 a, UINT8 d) +{ + if (a >= 0xf000 && a <= 0xf0ff) { + SegaPCMWrite(1, a - 0xf000, d); + return; + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); +#endif +} + +UINT8 __fastcall System18Z80PortRead(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x80: { + return BurnYM3438Read(0, 0); + } + + case 0xc0: { + return System16SoundLatch; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read Port -> %02X\n"), a); +#endif + + return 0; +} + +void __fastcall System18Z80PortWrite(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x80: { + BurnYM3438Write(0, 0, d); + return; + } + + case 0x81: { + BurnYM3438Write(0, 1, d); + return; + } + + case 0x82: { + BurnYM3438Write(0, 2, d); + return; + } + + case 0x83: { + BurnYM3438Write(0, 3, d); + return; + } + + case 0x90: { + BurnYM3438Write(1, 0, d); + return; + } + + case 0x91: { + BurnYM3438Write(1, 1, d); + return; + } + + case 0x92: { + BurnYM3438Write(1, 2, d); + return; + } + + case 0x93: { + BurnYM3438Write(1, 3, d); + return; + } + + case 0xa0: { + RF5C68PCMBankAddress = d * 0x2000; + ZetMapArea(0xa000, 0xbfff, 0, System16Z80Rom + 0x10000 + RF5C68PCMBankAddress); + ZetMapArea(0xa000, 0xbfff, 2, System16Z80Rom + 0x10000 + RF5C68PCMBankAddress); + return; + } + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Write Port -> %02X, %02X\n"), a, d); +#endif +} + +UINT8 __fastcall System18Z80Read(UINT16 a) +{ + if (a >= 0xd000 && a <= 0xdfff) { + return RF5C68PCMRead(a - 0xd000); + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Read -> %04X\n"), a); +#endif + + return 0; +} + +void __fastcall System18Z80Write(UINT16 a, UINT8 d) +{ + if (a >= 0xc000 && a <= 0xc00f) { + RF5C68PCMRegWrite(a - 0xc000, d); + return; + } + + if (a >= 0xd000 && a <= 0xdfff) { + RF5C68PCMWrite(a - 0xd000, d); + return; + } + +#if 0 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Z80 Write -> %04X, %02X\n"), a, d); +#endif +} + +void System16N7751ControlWrite(UINT32 Port, UINT32 Data) +{ + if (!(Data & 0x01)) { + N7751Reset(); + return; + } + + if (!(Data & 0x02)) { + N7751SetIrqState(1); + return; + } + + if (Data & 0x02) { + N7751SetIrqState(0); + return; + } + + bprintf(PRINT_NORMAL, _T("YM2151 Write Port %x, %02X\n"), Port, Data); +} + +UINT8 __fastcall N7751ReadIo(UINT32 Port) +{ + switch (Port) { + case 0x102: { + return 0x80 | ((N7751Command & 0x07) << 4); + } + + case 0x120: { + return System167751Data[N7751RomAddress]; + } + } + + return 0; +} + +void __fastcall N7751WriteIo(UINT32 Port, UINT8 Value) +{ + switch (Port) { + case 0x101: { + DACWrite(0, Value); + return; + } + + case 0x102: { + return; + } + + case 0x104: + case 0x105: + case 0x106: + case 0x107: { + INT32 Offset = Port - 0x104; + INT32 Mask = (0xf << (4 * Offset)) & 0x3fff; + INT32 NewData = (Value << (4 * Offset)) & Mask; + N7751RomAddress = (N7751RomAddress & ~Mask) | NewData; + return; + } + } +} + +UINT8 __fastcall N7751Read(UINT32 Address) +{ + if (Address < 0x400) return System167751Prog[Address]; + return 0; +} + +/*==================================================== +Allocate Memory +====================================================*/ + +static INT32 System16MemIndex() +{ + UINT8 *Next; Next = Mem; + + System16PaletteEntries = 0x800; + System16RamSize = 0x4000; + System16ExtraRamSize = 0; + System16ExtraRam2Size = 0; + System16ExtraRam3Size = 0; + System16SpriteRamSize = 0x800; + System16SpriteRam2Size = 0; + System16RotateRamSize = 0; + System16BackupRamSize = 0; + System16BackupRam2Size = 0; + bool SpriteBuffer = false; + bool HasRoad = false; + bool UseTempDraw = false; + INT32 Z80RomSize = 0x10000; + INT32 Z80RamSize = 0x00800; + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { + Z80RomSize = 0x210000; + Z80RamSize = 0x2000; + UseTempDraw = true; + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON) { + System16ExtraRamSize = 0x4000; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "hangon") || !strcmp(BurnDrvGetTextA(DRV_NAME), "shangupb")) { + System16RamSize = 0x10000; + } else { + System16SpriteRamSize = 0x1000; + } + HasRoad = true; + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN) { + System16PaletteEntries = 0x1000; + System16RamSize = 0x8000; + System16ExtraRamSize = 0x8000; + System16SpriteRamSize = 0x1000; + SpriteBuffer = true; + HasRoad = true; + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX) { + System16PaletteEntries = 0x2000; + System16RamSize = 0x8000; + System16SpriteRamSize = 0x1000; + System16BackupRamSize = 0x4000; + System16BackupRam2Size = 0x4000; + SpriteBuffer = true; + HasRoad = true; + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMY) { + System16PaletteEntries = 0x2000; + System16RamSize = 0x10000; + System16ExtraRamSize = 0x10000; + System16ExtraRam2Size = 0x10000; + System16ExtraRam3Size = 0x10000; + System16SpriteRamSize = 0x1000; + System16BackupRamSize = 0x4000; + System16SpriteRam2Size = 0x10000; + System16RotateRamSize = 0x800; + UseTempDraw = true; + } + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM) { + System16ExtraRamSize = 0x40000; + Z80RomSize = 0x40000; + } + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_5704_PS2) { + System16RamSize = 0x40000; + } + + System16Rom = Next; Next += (System16RomSize > 0x100000) ? System16RomSize : 0x100000; + System16Code = Next; Next += (System16RomSize > 0x100000) ? System16RomSize : 0x100000; + System16Rom2 = Next; (System16Rom2Size) ? Next += 0x080000 : Next += 0; + System16Rom3 = Next; (System16Rom3Size) ? Next += 0x080000 : Next += 0; + System16Z80Rom = Next; Next += Z80RomSize; + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MC8123_ENC) { + System16Z80Code = Next; Next += Z80RomSize; + } + System16Z80Rom2 = Next; Next += System16Z80Rom2Size; + System16Z80Rom3 = Next; Next += System16Z80Rom3Size; + System16Z80Rom4 = Next; Next += System16Z80Rom4Size; + System167751Prog = Next; Next += System167751ProgSize; + System167751Data = Next; Next += System167751DataSize; + System16UPD7759Data = Next; Next += System16UPD7759DataSize; + System16PCMData = Next; Next += System16PCMDataSize; + System16PCM2Data = Next; Next += System16PCM2DataSize; + System16RF5C68Data = Next; Next += System16RF5C68DataSize; + System16Key = Next; Next += System16KeySize; + System16Prom = Next; Next += System16PromSize; + + RamStart = Next; + + System16Ram = Next; Next += System16RamSize; + System16ExtraRam = Next; Next += System16ExtraRamSize; + System16ExtraRam2 = Next; Next += System16ExtraRam2Size; + System16ExtraRam3 = Next; Next += System16ExtraRam3Size; + System16TileRam = Next; (System16TileRomSize) ? Next += 0x10000 : Next += 0; + System16TextRam = Next; (System16TileRomSize) ? Next += 0x01000 : Next += 0; + System16SpriteRam = Next; Next += System16SpriteRamSize; + System16SpriteRam2 = Next; Next += System16SpriteRam2Size; + System16RotateRam = Next; Next += System16RotateRamSize; + System16RotateRamBuff= Next; Next += System16RotateRamSize; + if (SpriteBuffer) System16SpriteRamBuff = Next; Next += System16SpriteRamSize; + System16PaletteRam = Next; Next += System16PaletteEntries * 2; + + if (HasRoad) { + System16RoadRam = Next; Next += 0x01000; + System16RoadRamBuff = Next; Next += 0x01000; + } + + System16BackupRam = Next; Next += System16BackupRamSize; + System16BackupRam2 = Next; Next += System16BackupRam2Size; + + System16Z80Ram = Next; Next += Z80RamSize; + + if (System16Z80Rom2Num) { + System16Z80Ram2 = Next; Next += 0x800; + } + + RamEnd = Next; + + System16Tiles = Next; Next += (System16NumTiles * 8 * 8); + System16Sprites = Next; Next += System16SpriteRomSize; + System16Sprites2 = Next; Next += System16Sprite2RomSize; + + if (HasRoad) { + System16Roads = Next; Next += 0x40000; + } + + System16Palette = (UINT32*)Next; Next += System16PaletteEntries * 3 * sizeof(UINT32) + (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) ? (0x40 * sizeof(UINT32)) : 0); + + if (UseTempDraw) pTempDraw = (UINT16*)Next; Next += (512 * 512 * sizeof(UINT16)); + + MemEnd = Next; + + return 0; +} + +/*==================================================== +Rom Loading +====================================================*/ + +INT32 System16LoadRoms(bool bLoad) +{ + struct BurnRomInfo ri; + ri.nType = 0; + ri.nLen = 0; + INT32 nOffset = -1; + UINT32 i; + INT32 nRet = 0; + + if (!bLoad) { + do { + ri.nLen = 0; + ri.nType = 0; + BurnDrvGetRomInfo(&ri, ++nOffset); + if ((ri.nType & 0xff) == SYS16_ROM_PROG) { + System16RomSize += ri.nLen; + System16RomNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_PROG2) { + System16Rom2Size += ri.nLen; + System16Rom2Num++; + } + if ((ri.nType & 0xff) == SYS16_ROM_PROG3) { + System16Rom3Size += ri.nLen; + System16Rom3Num++; + } + if ((ri.nType & 0xff) == SYS16_ROM_TILES) { + System16TileRomSize += ri.nLen; + System16TileRomNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_SPRITES) { + System16SpriteRomSize += ri.nLen; + System16SpriteRomNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_SPRITES2) { + System16Sprite2RomSize += ri.nLen; + System16Sprite2RomNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_ROAD) { + System16RoadRomSize += ri.nLen; + System16RoadRomNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_Z80PROG) { + System16Z80RomSize += ri.nLen; + System16Z80RomNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_Z80PROG2) { + System16Z80Rom2Size += ri.nLen; + System16Z80Rom2Num++; + } + if ((ri.nType & 0xff) == SYS16_ROM_Z80PROG3) { + System16Z80Rom3Size += ri.nLen; + System16Z80Rom3Num++; + } + if ((ri.nType & 0xff) == SYS16_ROM_Z80PROG4) { + System16Z80Rom4Size += ri.nLen; + System16Z80Rom4Num++; + } + if ((ri.nType & 0xff) == SYS16_ROM_7751PROG) { + System167751ProgSize += ri.nLen; + System167751ProgNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_7751DATA) { + System167751DataSize += ri.nLen; + System167751DataNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_UPD7759DATA) { + if (ri.nLen < 0x10000) { + System16UPD7759DataSize += 0x10000; + } else { + System16UPD7759DataSize += ri.nLen; + } + System16UPD7759DataNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_PCMDATA) { + if (System16PCMDataSizePreAllocate) { + System16PCMDataSize = System16PCMDataSizePreAllocate; + } else { + System16PCMDataSize += ri.nLen; + } + + System16PCMDataNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_PCM2DATA) { + System16PCM2DataSize += ri.nLen; + System16PCM2DataNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_RF5C68DATA) { + System16RF5C68DataNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_PROM) { + System16PromSize += ri.nLen; + System16PromNum++; + } + if ((ri.nType & 0xff) == SYS16_ROM_KEY) { + System16KeySize += ri.nLen; + } + } while (ri.nLen); + + System16NumTiles = System16TileRomSize / 24; + if (System16RF5C68DataNum) { + System16Z80RomNum += System16RF5C68DataNum; + System16Z80RomSize = 0x210000; + } + +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("68K Rom Size: 0x%X (%i roms)\n"), System16RomSize, System16RomNum); + if (System16Rom2Size) bprintf(PRINT_NORMAL, _T("68K #2 Rom Size: 0x%X (%i roms)\n"), System16Rom2Size, System16Rom2Num); + if (System16Rom3Size) bprintf(PRINT_NORMAL, _T("68K #3 Rom Size: 0x%X (%i roms)\n"), System16Rom3Size, System16Rom3Num); + bprintf(PRINT_NORMAL, _T("Tile Rom Size: 0x%X (%i roms, 0x%X Tiles)\n"), System16TileRomSize, System16TileRomNum, System16NumTiles); + bprintf(PRINT_NORMAL, _T("Sprite Rom Size: 0x%X (%i roms)\n"), System16SpriteRomSize, System16SpriteRomNum); + if (System16Sprite2RomSize) bprintf(PRINT_NORMAL, _T("Sprite Rom 2 Size: 0x%X (%i roms)\n"), System16Sprite2RomSize, System16Sprite2RomNum); + bprintf(PRINT_NORMAL, _T("Z80 Rom Size: 0x%X (%i roms)\n"), System16Z80RomSize, System16Z80RomNum); + if (System16Z80Rom2Size) bprintf(PRINT_NORMAL, _T("Z80 #2 Rom Size: 0x%X (%i roms)\n"), System16Z80Rom2Size, System16Z80Rom2Num); + if (System16Z80Rom3Size) bprintf(PRINT_NORMAL, _T("Z80 #3 Rom Size: 0x%X (%i roms)\n"), System16Z80Rom3Size, System16Z80Rom3Num); + if (System16Z80Rom4Size) bprintf(PRINT_NORMAL, _T("Z80 #4 Rom Size: 0x%X (%i roms)\n"), System16Z80Rom4Size, System16Z80Rom4Num); + if (System16RoadRomSize) bprintf(PRINT_NORMAL, _T("Road Rom Size: 0x%X (%i roms)\n"), System16RoadRomSize, System16RoadRomNum); + if (System167751ProgSize) bprintf(PRINT_NORMAL, _T("7751 Prog Size: 0x%X (%i roms)\n"), System167751ProgSize, System167751ProgNum); + if (System167751DataSize) bprintf(PRINT_NORMAL, _T("7751 Data Size: 0x%X (%i roms)\n"), System167751DataSize, System167751DataNum); + if (System16UPD7759DataSize) bprintf(PRINT_NORMAL, _T("UPD7759 Data Size: 0x%X (%i roms)\n"), System16UPD7759DataSize, System16UPD7759DataNum); + if (System16PCMDataSize) bprintf(PRINT_NORMAL, _T("PCM Data Size: 0x%X (%i roms)\n"), System16PCMDataSize, System16PCMDataNum); + if (System16PCM2DataSize) bprintf(PRINT_NORMAL, _T("PCM Data #2 Size: 0x%X (%i roms)\n"), System16PCM2DataSize, System16PCM2DataNum); + if (System16PromSize) bprintf(PRINT_NORMAL, _T("PROM Rom Size: 0x%X (%i roms)\n"), System16PromSize, System16PromNum); + if (System16KeySize) bprintf(PRINT_NORMAL, _T("Encryption Key Size: 0x%X\n"), System16KeySize); +#endif + } + + if (bLoad) { + INT32 Offset; + + // 68000 Program Roms + Offset = 0; + for (i = 0; i < System16RomNum; i += 2) { + nRet = BurnLoadRom(System16Rom + Offset + 1, i + 0, 2); if (nRet) return 1; + nRet = BurnLoadRom(System16Rom + Offset + 0, i + 1, 2); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 1); + Offset += ri.nLen; + } + + // 68000 #2 Program Roms + if (System16Rom2Size) { + Offset = 0; + for (i = System16RomNum; i < System16RomNum + System16Rom2Num; i += 2) { + nRet = BurnLoadRom(System16Rom2 + Offset + 1, i + 0, 2); if (nRet) return 1; + nRet = BurnLoadRom(System16Rom2 + Offset + 0, i + 1, 2); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 1); + Offset += ri.nLen; + } + } + + // 68000 #3 Program Roms + if (System16Rom3Size) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num; i < System16RomNum + System16Rom2Num + System16Rom3Num; i += 2) { + nRet = BurnLoadRom(System16Rom3 + Offset + 1, i + 0, 2); if (nRet) return 1; + nRet = BurnLoadRom(System16Rom3 + Offset + 0, i + 1, 2); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 1); + Offset += ri.nLen; + } + } + + // Tile Roms + Offset = 0; + System16TempGfx = (UINT8*)BurnMalloc(System16TileRomSize); + for (i = System16RomNum + System16Rom2Num + System16Rom3Num; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum; i++) { + nRet = BurnLoadRom(System16TempGfx + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_INVERT_TILES) { + for (i = 0; i < System16TileRomSize; i++) { + System16TempGfx[i] ^= 0xff; + } + } + System16Decode8x8Tiles(System16Tiles, System16NumTiles, System16TileRomSize * 2 / 3, System16TileRomSize * 1 / 3, 0); + BurnFree(System16TempGfx); + + // Sprite Roms + Offset = 0; + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_SPRITE_LOAD32) { + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum; i += 4) { + nRet = BurnLoadRom(System16Sprites + Offset + 0, i + 0, 4); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites + Offset + 1, i + 1, 4); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites + Offset + 2, i + 2, 4); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites + Offset + 3, i + 3, 4); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 1); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 2); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 3); + Offset += ri.nLen; + } + } else { + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum; i += 2) { + nRet = BurnLoadRom(System16Sprites + Offset + 0, i + 0, 2); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites + Offset + 1, i + 1, 2); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 1); + Offset += ri.nLen; + } + } + + // Sprite 2 Roms + if (System16Sprite2RomSize) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum; i += 8) { + nRet = BurnLoadRom(System16Sprites2 + Offset + 7, i + 0, 8); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites2 + Offset + 6, i + 1, 8); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites2 + Offset + 5, i + 2, 8); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites2 + Offset + 4, i + 3, 8); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites2 + Offset + 3, i + 4, 8); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites2 + Offset + 2, i + 5, 8); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites2 + Offset + 1, i + 6, 8); if (nRet) return 1; + nRet = BurnLoadRom(System16Sprites2 + Offset + 0, i + 7, 8); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 1); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 2); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 3); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 4); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 5); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 6); + Offset += ri.nLen; + BurnDrvGetRomInfo(&ri, i + 7); + Offset += ri.nLen; + } + } + + // Road Roms + if (System16RoadRomSize) { + Offset = 0; + System16TempGfx = (UINT8*)BurnMalloc(System16RoadRomSize); + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum; i++) { + nRet = BurnLoadRom(System16TempGfx + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX) OutrunDecodeRoad(); + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON) HangonDecodeRoad(); + BurnFree(System16TempGfx); + } + + // Z80 Program Roms + Offset = 0; + if (System16RF5C68DataNum) Offset = 0x10000; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum; i++) { + nRet = BurnLoadRom(System16Z80Rom + Offset, i, 1); + if (nRet) { + // Fill with 0xff + memset(System16Z80Rom, 0xff, System16Z80RomSize); + + nRet = 0; + } + + BurnDrvGetRomInfo(&ri, i + 0); + if (System16RF5C68DataNum) { + Offset += 0x80000; + } else { + Offset += ri.nLen; + } + } + if (System16RF5C68DataNum) { + memcpy(System16Z80Rom, System16Z80Rom + 0x10000, 0x10000); + System16RF5C68DataNum = 0; + } + + // Z80 #2 Program Roms + if (System16Z80Rom2Size) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum+ System16Z80RomNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num; i++) { + nRet = BurnLoadRom(System16Z80Rom2 + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // Z80 #3 Program Roms + if (System16Z80Rom3Size) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num; i++) { + nRet = BurnLoadRom(System16Z80Rom3 + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // Z80 #4 Program Roms + if (System16Z80Rom4Size) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num; i++) { + nRet = BurnLoadRom(System16Z80Rom4 + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // 7751 Program Roms + if (System167751ProgSize) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum; i++) { + nRet = BurnLoadRom(System167751Prog + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // 7751 Data Roms + if (System167751DataSize) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum; i++) { + nRet = BurnLoadRom(System167751Data + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // UPD7759 Data Roms + if (System16UPD7759DataSize) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum; i++) { + nRet = BurnLoadRom(System16UPD7759Data + Offset, i, 1); + + if (nRet) { + memset(System16UPD7759Data, 0xff, System16UPD7759DataSize); + + nRet = 0; + } + + BurnDrvGetRomInfo(&ri, i + 0); + if (ri.nLen < 0x10000) { + Offset += 0x10000; + } else { + Offset += ri.nLen; + } + } + } + + // PCM Data Roms + if (System16PCMDataSize) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum; i++) { + nRet = BurnLoadRom(System16PCMData + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // PCM2 Data Roms + if (System16PCM2DataSize) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum + System16PCM2DataNum; i++) { + nRet = BurnLoadRom(System16PCM2Data + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // PROMs + if (System16PromSize) { + Offset = 0; + for (i = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum + System16PCM2DataNum + System16RF5C68DataNum; i < System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum + System16PCM2DataNum + System16RF5C68DataNum + System16PromNum; i++) { + nRet = BurnLoadRom(System16Prom + Offset, i, 1); if (nRet) return 1; + + BurnDrvGetRomInfo(&ri, i + 0); + Offset += ri.nLen; + } + } + + // Encryption Key + if (System16KeySize) { + Offset = System16RomNum + System16Rom2Num + System16Rom3Num + System16TileRomNum + System16SpriteRomNum + System16Sprite2RomNum + System16RoadRomNum + System16Z80RomNum + System16Z80Rom2Num + System16Z80Rom3Num + System16Z80Rom4Num + System167751ProgNum + System167751DataNum + System16UPD7759DataNum + System16PCMDataNum + System16PCM2DataNum + System16RF5C68DataNum + System16PromNum; + nRet = BurnLoadRom(System16Key, Offset, 1); if (nRet) return 1; + } + } + + return nRet; +} + +INT32 CustomLoadRom20000() +{ + INT32 nRet = 1; + UINT8 *pTemp = (UINT8*)BurnMalloc(0xc0000); + + if (pTemp) { + memcpy(pTemp, System16Rom, 0xc0000); + memset(System16Rom, 0, 0xc0000); + memcpy(System16Rom + 0x00000, pTemp + 0x00000, 0x20000); + memcpy(System16Rom + 0x80000, pTemp + 0x20000, 0x40000); + BurnFree(pTemp); + nRet = 0; + } + + return nRet; +} + +INT32 CustomLoadRom40000() +{ + INT32 nRet = 1; + UINT8 *pTemp = (UINT8*)BurnMalloc(0xc0000); + + if (pTemp) { + memcpy(pTemp, System16Rom, 0xc0000); + memset(System16Rom, 0, 0xc0000); + memcpy(System16Rom + 0x00000, pTemp + 0x00000, 0x40000); + memcpy(System16Rom + 0x80000, pTemp + 0x40000, 0x40000); + BurnFree(pTemp); + nRet = 0; + } + + return nRet; +} + +/*==================================================== +Sound Support Functions +====================================================*/ + +inline static INT32 System16SndGetBank(INT32 Reg86) +{ + return (Reg86>>4)&7; +} + +inline static INT32 PdriftSndGetBank(INT32 Reg86) +{ + return (Reg86>>3)&0x1f; +} + +inline void System16YM2151IRQHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +inline static void System16YM2203IRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +inline static INT32 System16SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +inline static double System16GetTime() +{ + return (double)ZetTotalCycles() / 4000000; +} + +inline static INT32 System18SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 8000000; +} + +inline static double System18GetTime() +{ + return (double)ZetTotalCycles() / 8000000; +} + +static void System16UPD7759DrqCallback(INT32 state) +{ + if (state) ZetNmi(); +} + +static INT32 System16ASyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (I8039TotalCycles() / ((6000000.0000 / 15) / (nBurnFPS / 100.0000)))); +} + +/*==================================================== +Multiply Protection Chip Emulation +====================================================*/ + +struct multiply_chip +{ + UINT16 regs[4]; +}; + +static struct multiply_chip multiply[3]; + +UINT16 System16MultiplyChipRead(INT32 which, INT32 offset) +{ + offset &= 3; + switch (offset) { + case 0: { + return multiply[which].regs[0]; + } + + case 1: { + return multiply[which].regs[1]; + } + + case 2: { + return ((INT16)multiply[which].regs[0] * (INT16)multiply[which].regs[1]) >> 16; + } + + case 3: { + return ((INT16)multiply[which].regs[0] * (INT16)multiply[which].regs[1]) & 0xffff; + } + } + + return 0xffff; +} + +void System16MultiplyChipWrite(INT32 which, INT32 offset, UINT16 data) +{ + offset &= 3; + switch (offset) { + case 0: { + multiply[which].regs[0] = data; + return; + } + + case 1: { + multiply[which].regs[1] = data; + return; + } + + case 2: { + multiply[which].regs[0] = data; + return; + } + + case 3: { + multiply[which].regs[1] = data; + return; + } + } +} + +/*==================================================== +Divide Protection Chip Emulation +====================================================*/ + +struct divide_chip +{ + UINT16 regs[8]; +}; + +static struct divide_chip divide[3]; + +static void update_divide(INT32 which, INT32 mode) +{ + /* clear the flags by default */ + divide[which].regs[6] = 0; + + /* if mode 0, store quotient/remainder */ + if (mode == 0) + { + INT32 dividend = (INT32)((divide[which].regs[0] << 16) | divide[which].regs[1]); + INT32 divisor = (INT16)divide[which].regs[2]; + INT32 quotient, remainder; + + /* perform signed divide */ + if (divisor == 0) + { + quotient = dividend;//((INT32)(dividend ^ divisor) < 0) ? 0x8000 : 0x7fff; + divide[which].regs[6] |= 0x4000; + } + else + quotient = dividend / divisor; + remainder = dividend - quotient * divisor; + + /* clamp to 16-bit signed */ + if (quotient < -32768) + { + quotient = -32768; + divide[which].regs[6] |= 0x8000; + } + else if (quotient > 32767) + { + quotient = 32767; + divide[which].regs[6] |= 0x8000; + } + + /* store quotient and remainder */ + divide[which].regs[4] = quotient; + divide[which].regs[5] = remainder; + } + + /* if mode 1, store 32-bit quotient */ + else + { + UINT32 dividend = (UINT32)((divide[which].regs[0] << 16) | divide[which].regs[1]); + UINT32 divisor = (UINT16)divide[which].regs[2]; + UINT32 quotient; + + /* perform unsigned divide */ + if (divisor == 0) + { + quotient = dividend;//0x7fffffff; + divide[which].regs[6] |= 0x4000; + } + else + quotient = dividend / divisor; + + /* store 32-bit quotient */ + divide[which].regs[4] = quotient >> 16; + divide[which].regs[5] = quotient & 0xffff; + } +} + +UINT16 System16DivideChipRead(INT32 which, INT32 offset) +{ + offset &= 7; + switch (offset) { + case 0: { + return divide[which].regs[0]; + } + + case 1: { + return divide[which].regs[1]; + } + + case 2: { + return divide[which].regs[2]; + } + + case 4: { + return divide[which].regs[4]; + } + + case 5: { + return divide[which].regs[5]; + } + + case 6: { + return divide[which].regs[6]; + } + } + + return 0xffff; +} + +void System16DivideChipWrite(INT32 which, INT32 offset, UINT16 data) +{ + INT32 a4 = offset & 8; + INT32 a3 = offset & 4; + + offset &= 3; + switch (offset) { + case 0: { + divide[which].regs[0] = data; + break; + } + + case 1: { + divide[which].regs[1] = data; + break; + } + + case 2: { + divide[which].regs[2] = data; + break; + } + + case 3: { + break; + } + } + + if (a4) update_divide(which, a3); +} + +/*==================================================== +Compare Timer Protection Chip Emulation +====================================================*/ + +struct compare_timer_chip +{ + UINT16 regs[16]; + UINT16 counter; + UINT8 bit; +}; + +static struct compare_timer_chip compare_timer[2]; + +inline static INT32 segaic16_compare_timer_clock(INT32 which) +{ + INT32 old_counter = compare_timer[which].counter; + INT32 result = 0; + + /* if we're enabled, clock the upcounter */ + if (compare_timer[which].regs[10] & 1) + compare_timer[which].counter++; + + /* regardless of the enable, a value of 0xfff will generate the IRQ */ + if (old_counter == 0xfff) + { + result = 1; + compare_timer[which].counter = compare_timer[which].regs[8] & 0xfff; + } + return result; +} + +inline static void update_compare(INT32 which, INT32 update_history) +{ + INT32 bound1 = (INT16)compare_timer[which].regs[0]; + INT32 bound2 = (INT16)compare_timer[which].regs[1]; + INT32 value = (INT16)compare_timer[which].regs[2]; + INT32 min = (bound1 < bound2) ? bound1 : bound2; + INT32 max = (bound1 > bound2) ? bound1 : bound2; + + if (value < min) + { + compare_timer[which].regs[7] = min; + compare_timer[which].regs[3] = 0x8000; + } + else if (value > max) + { + compare_timer[which].regs[7] = max; + compare_timer[which].regs[3] = 0x4000; + } + else + { + compare_timer[which].regs[7] = value; + compare_timer[which].regs[3] = 0x0000; + } + + if (update_history) + compare_timer[which].regs[4] |= (compare_timer[which].regs[3] == 0) << compare_timer[which].bit++; +} + +UINT16 System16CompareTimerChipRead(INT32 which, INT32 offset) +{ + offset &= 0xf; + switch (offset) { + case 0x0: return compare_timer[which].regs[0]; + case 0x1: return compare_timer[which].regs[1]; + case 0x2: return compare_timer[which].regs[2]; + case 0x3: return compare_timer[which].regs[3]; + case 0x4: return compare_timer[which].regs[4]; + case 0x5: return compare_timer[which].regs[1]; + case 0x6: return compare_timer[which].regs[2]; + case 0x7: return compare_timer[which].regs[7]; + } + + return 0xffff; +} + +void System16CompareTimerChipWrite(INT32 which, INT32 offset, UINT16 data) +{ + offset &= 0xf; + switch (offset) { + case 0x0: compare_timer[which].regs[0] = data; update_compare(which, 0); break; + case 0x1: compare_timer[which].regs[1] = data; update_compare(which, 0); break; + case 0x2: compare_timer[which].regs[2] = data; update_compare(which, 1); break; + case 0x4: compare_timer[which].regs[4] = 0; compare_timer[which].bit = 0; break; + case 0x6: compare_timer[which].regs[2] = data; update_compare(which, 0); break; + case 0x8: + case 0xc: compare_timer[which].regs[8] = data; break; + case 0xa: + case 0xe: compare_timer[which].regs[10] = data; break; + case 0xb: + case 0xf: + compare_timer[which].regs[11] = data; + break; + } +} + +/*==================================================== +Main Driver Init function +====================================================*/ + +INT32 System16Init() +{ + INT32 nRet = 0, nLen; + + // Allocate and Blank all required memory + Mem = NULL; + System16LoadRoms(0); // Get required rom sizes + System16MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + System16MemIndex(); + + // Load Roms + if (!(BurnDrvGetHardwareCode() & HARDWARE_SEGA_5704_PS2)) { + nRet = System16LoadRoms(1); if (nRet) return 1; + } + if (System16CustomLoadRomDo) { nRet = System16CustomLoadRomDo(); if (nRet) return 1; } + + // Copy the first 68000 rom to code (FETCH) + memcpy(System16Code, System16Rom, System16RomSize); + + // Handle any op-code decryption + if (System16CustomDecryptOpCodeDo) { nRet = System16CustomDecryptOpCodeDo(); if (nRet) return 1; } + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1089A_ENC || BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1089B_ENC) { + FD1089Decrypt(); + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC_CPU2)) { + // Make sure we use Musashi + if (bBurnUseASMCPUEmulation) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); +#endif + bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; + bBurnUseASMCPUEmulation = false; + } + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC) fd1094_driver_init(0); + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC_CPU2) fd1094_driver_init(1); + } + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MC8123_ENC) { + mc8123_decrypt_rom(0, 0, System16Z80Rom, System16Z80Code, System16Key); + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16A) { + if (System16Map68KDo) { + System16Map68KDo(); + } else { + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0fffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + + SekSetReadWordHandler(0, System16AReadWord); + SekSetWriteWordHandler(0, System16AWriteWord); + SekSetReadByteHandler(0, System16AReadByte); + SekSetWriteByteHandler(0, System16AWriteByte); + SekClose(); + } + + if (System16MapZ80Do) { + ZetInit(0); + ZetOpen(0); + System16MapZ80Do(); + ZetClose(); + } else { + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); + + ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); + +#if 0 && defined FBA_DEBUG + ZetSetReadHandler(System16Z80Read); + ZetSetWriteHandler(System16Z80Write); +#endif + ZetSetInHandler(System16PPIZ80PortRead); + ZetSetOutHandler(System16Z80PortWrite); + ZetClose(); + } + + if (PPI0PortWriteA == NULL) PPI0PortWriteA = System16APPI0WritePortA; + if (PPI0PortWriteB == NULL) PPI0PortWriteB = System16APPI0WritePortB; + if (PPI0PortWriteC == NULL) PPI0PortWriteC = System16APPI0WritePortC; + ppi8255_init(1); + + BurnYM2151Init(4000000); + BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + + if (System167751ProgSize) { + N7751Init(NULL); + + N7751SetIOReadHandler(N7751ReadIo); + N7751SetIOWriteHandler(N7751WriteIo); + N7751SetProgramReadHandler(N7751Read); + N7751SetCPUOpReadHandler(N7751Read); + N7751SetCPUOpReadArgHandler(N7751Read); + + YM2151SetPortWriteHandler(0, &System16N7751ControlWrite); + BurnYM2151SetAllRoutes(0.43, BURN_SND_ROUTE_BOTH); + DACInit(0, 0, 1, System16ASyncDAC); + DACSetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); + } + + System16TileBankSize = 0x1000; + System16CreateOpaqueTileMaps = 1; + System16ATileMapsInit(1); + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16B) { + if (System16Map68KDo) { + System16Map68KDo(); + } else { + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0fffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + + SekSetReadByteHandler(0, System16BReadByte); + SekSetWriteByteHandler(0, System16BWriteByte); + SekSetWriteWordHandler(0, System16BWriteWord); + SekClose(); + } + + if (System16Z80RomNum || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM)) { + if (System16MapZ80Do) { + ZetInit(0); + ZetOpen(0); + System16MapZ80Do(); + ZetClose(); + } else { + ZetInit(0); + ZetOpen(0); + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_MC8123_ENC) { + ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0xdfff, 2, System16Z80Code, System16Z80Rom); + } else { + ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); + } + + ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); + +#if 0 && defined FBA_DEBUG + ZetSetReadHandler(System16Z80Read); + ZetSetWriteHandler(System16Z80Write); +#endif + ZetSetInHandler(System16Z80PortRead); + ZetSetOutHandler(System16Z80PortWrite); + ZetClose(); + } + } + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { + BurnYM2413Init(5000000); + BurnYM2413SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + } else { + BurnYM2151Init(4000000); + BurnYM2151SetAllRoutes(0.43, BURN_SND_ROUTE_BOTH); + } + + if (System16UPD7759DataSize) { + UPD7759Init(0,UPD7759_STANDARD_CLOCK, NULL); + UPD7759SetDrqCallback(0,System16UPD7759DrqCallback); + UPD7759SetRoute(0, 0.48, BURN_SND_ROUTE_BOTH); + } + + System16TileBankSize = 0x1000; + System16CreateOpaqueTileMaps = 1; + System16BTileMapsInit(1); + System16ClockSpeed = 10000000; + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { + if (System16Map68KDo) { + System16Map68KDo(); + } else { + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x0fffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x0fffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x440000, 0x4407ff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x840000, 0x840fff, SM_RAM); + SekMapMemory(System16Ram , 0xffc000, 0xffffff, SM_RAM); + + SekSetReadWordHandler(0, System18ReadWord); + SekSetWriteWordHandler(0, System18WriteWord); + SekSetReadByteHandler(0, System18ReadByte); + SekSetWriteByteHandler(0, System18WriteByte); + SekClose(); + } + + if (System16MapZ80Do) { + ZetInit(0); + ZetOpen(0); + System16MapZ80Do(); + ZetClose(); + } else { + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x9fff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0x9fff, 2, System16Z80Rom); + + ZetMapArea(0xa000, 0xbfff, 0, System16Z80Rom + 0xa000); + ZetMapArea(0xa000, 0xbfff, 2, System16Z80Rom + 0xa000); + + ZetMapArea(0xe000, 0xffff, 0, System16Z80Ram); + ZetMapArea(0xe000, 0xffff, 1, System16Z80Ram); + ZetMapArea(0xe000, 0xffff, 2, System16Z80Ram); + + ZetSetReadHandler(System18Z80Read); + ZetSetWriteHandler(System18Z80Write); + ZetSetInHandler(System18Z80PortRead); + ZetSetOutHandler(System18Z80PortWrite); + ZetClose(); + } + + BurnYM3438Init(2, 8000000, NULL, System18SynchroniseStream, System18GetTime, 1); + BurnTimerAttachZet(8000000); + BurnYM3438SetAllRoutes(0, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM3438SetAllRoutes(1, 0.40, BURN_SND_ROUTE_BOTH); + + RF5C68PCMInit(10000000); + RF5C68PCMSetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + + System16TileBankSize = 0x400; + System16CreateOpaqueTileMaps = 1; + System16BTileMapsInit(1); + + StartGenesisVDP(0, System16Palette); + GenesisPaletteBase = 0x1800; + GenesisBgPalLookup[0] = GenesisSpPalLookup[0] = 0x1800; + GenesisBgPalLookup[1] = GenesisSpPalLookup[1] = 0x1810; + GenesisBgPalLookup[2] = GenesisSpPalLookup[2] = 0x1820; + GenesisBgPalLookup[3] = GenesisSpPalLookup[3] = 0x1830; + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON) { + if (System16Map68KDo) { + System16Map68KDo(); + } else { + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x03ffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x03ffff, SM_FETCH); + SekMapMemory(System16Ram , 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(System16TileRam , 0x400000, 0x403fff, SM_READ); + SekMapMemory(System16TextRam , 0x410000, 0x410fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x600000, 0x607fff, SM_RAM); + SekMapMemory(System16PaletteRam , 0xa00000, 0xa00fff, SM_RAM); + SekMapMemory(System16Rom2 , 0xc00000, 0xc3ffff, SM_READ); + SekMapMemory(System16RoadRam , 0xc68000, 0xc68fff, SM_RAM); + SekMapMemory(System16ExtraRam , 0xc7c000, 0xc7ffff, SM_RAM); + + SekSetReadWordHandler(0, HangonReadWord); + SekSetReadByteHandler(0, HangonReadByte); + SekSetWriteByteHandler(0, HangonWriteByte); + SekSetWriteWordHandler(0, HangonWriteWord); + SekClose(); + } + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(System16Rom2 , 0x000000, 0x03ffff, SM_READ); + SekMapMemory(System16Rom2 , 0x000000, 0x03ffff, SM_FETCH); + SekMapMemory(System16RoadRam , 0xc68000, 0xc68fff, SM_RAM); + SekMapMemory(System16ExtraRam , 0xc7c000, 0xc7ffff, SM_RAM); + SekClose(); + + if (System16MapZ80Do) { + ZetInit(0); + ZetOpen(0); + System16MapZ80Do(); + ZetClose(); + } else { + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0x7fff, 2, System16Z80Rom); + + ZetMapArea(0xc000, 0xc7ff, 0, System16Z80Ram); + ZetMapArea(0xc000, 0xc7ff, 1, System16Z80Ram); + ZetMapArea(0xc000, 0xc7ff, 2, System16Z80Ram); + + ZetSetReadHandler(System16Z802203Read); + ZetSetWriteHandler(System16Z802203Write); + ZetSetInHandler(System16Z802203PortRead); + ZetClose(); + } else { + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); + + ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); + + ZetSetReadHandler(System16Z80PCMRead); + ZetSetWriteHandler(System16Z80PCMWrite); + ZetSetInHandler(System16PPIZ80PortRead); + ZetSetOutHandler(System16Z80PortWrite); + ZetClose(); + } + } + + if (PPI0PortWriteA == NULL) PPI0PortWriteA = HangonPPI0WritePortA; + if (PPI0PortWriteB == NULL) PPI0PortWriteB = HangonPPI0WritePortB; + if (PPI0PortWriteC == NULL) PPI0PortWriteC = HangonPPI0WritePortC; + if (PPI1PortReadC == NULL) PPI1PortReadC = HangonPPI1ReadPortC; + if (PPI1PortWriteA == NULL) PPI1PortWriteA = HangonPPI1WritePortA; + ppi8255_init(2); + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { + BurnYM2203Init(1, 4000000, &System16YM2203IRQHandler, System16SynchroniseStream, System16GetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.37, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.13, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.13, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.13, BURN_SND_ROUTE_BOTH); + } else { + BurnYM2151Init(4000000); + BurnYM2151SetIrqHandler(&System16YM2151IRQHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.43, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.43, BURN_SND_ROUTE_RIGHT); + } + + if (System16PCMDataSize) { + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { + SegaPCMInit(0, 8000000, BANK_512, System16PCMData, System16PCMDataSize); + } else { + SegaPCMInit(0, 4000000, BANK_512, System16PCMData, System16PCMDataSize); + } + SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_1, 1.0, BURN_SND_ROUTE_LEFT); + SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_2, 1.0, BURN_SND_ROUTE_RIGHT); + } + + System16TileBankSize = 0x1000; + System16ATileMapsInit(0); + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN) { + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x05ffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x05ffff, SM_FETCH); + SekMapMemory(System16ExtraRam , 0x060000, 0x067fff, SM_RAM); + SekMapMemory(System16TileRam , 0x100000, 0x10ffff, SM_READ); + SekMapMemory(System16TextRam , 0x110000, 0x110fff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x120000, 0x121fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x130000, 0x130fff, SM_RAM); + SekMapMemory(System16Rom2 , 0x200000, 0x23ffff, SM_READ); + SekMapMemory(System16Ram , 0x260000, 0x267fff, SM_RAM); + SekMapMemory(System16RoadRam , 0x280000, 0x280fff, SM_RAM); + SekSetResetCallback(OutrunResetCallback); + SekSetReadWordHandler(0, OutrunReadWord); + SekSetWriteWordHandler(0, OutrunWriteWord); + SekSetReadByteHandler(0, OutrunReadByte); + SekSetWriteByteHandler(0, OutrunWriteByte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(System16Rom2 , 0x000000, 0x03ffff, SM_READ); + SekMapMemory(System16Rom2 , 0x000000, 0x03ffff, SM_FETCH); + SekMapMemory(System16Ram , 0x060000, 0x067fff, SM_RAM); + SekMapMemory(System16RoadRam , 0x080000, 0x080fff, SM_RAM); + SekSetWriteWordHandler(0, Outrun2WriteWord); + SekSetReadByteHandler(0, Outrun2ReadByte); + SekSetWriteByteHandler(0, Outrun2WriteByte); + SekClose(); + + if (System16MapZ80Do) { + ZetInit(0); + ZetOpen(0); + System16MapZ80Do(); + ZetClose(); + } else { + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); + + ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); + + ZetSetReadHandler(System16Z80PCMRead); + ZetSetWriteHandler(System16Z80PCMWrite); + ZetSetInHandler(System16PPIZ80PortRead); + ZetSetOutHandler(System16Z80PortWrite); + ZetClose(); + } + + if (PPI0PortWriteC == NULL) PPI0PortWriteC = OutrunPPI0WritePortC; + ppi8255_init(1); + + BurnYM2151Init(4000000); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.43, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.43, BURN_SND_ROUTE_RIGHT); + + if (System16PCMDataSize) { + SegaPCMInit(0, 4000000, BANK_512, System16PCMData, System16PCMDataSize); + SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_1, 1.0, BURN_SND_ROUTE_LEFT); + SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_2, 1.0, BURN_SND_ROUTE_RIGHT); + } + + System16RoadColorOffset1 = 0x400; + System16RoadColorOffset2 = 0x420; + System16RoadColorOffset3 = 0x780; + + System16TileBankSize = 0x1000; + System16BTileMapsInit(0); + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX) { + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x07ffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x07ffff, SM_FETCH); + SekMapMemory(System16TileRam , 0x0c0000, 0x0cffff, SM_READ); + SekMapMemory(System16TextRam , 0x0d0000, 0x0d0fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x100000, 0x100fff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x101000, 0x101fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x102000, 0x102fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x103000, 0x103fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x104000, 0x104fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x105000, 0x105fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x106000, 0x106fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x107000, 0x107fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x108000, 0x108fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x109000, 0x109fff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x10a000, 0x10afff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x10b000, 0x10bfff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x10c000, 0x10cfff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x10d000, 0x10dfff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x10e000, 0x10efff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16SpriteRam , 0x10f000, 0x10ffff, SM_RAM); // Tests past Sprite RAM in mem tests (mirror?) + SekMapMemory(System16PaletteRam , 0x120000, 0x123fff, SM_RAM); + SekMapMemory(System16Rom2 , 0x200000, 0x27ffff, SM_READ); + SekMapMemory(System16Ram , 0x29c000, 0x2a3fff, SM_RAM); + SekMapMemory(System16RoadRam , 0x2ec000, 0x2ecfff, SM_RAM); + SekMapMemory(System16RoadRam , 0x2ed000, 0x2edfff, SM_RAM); // Tests past Road RAM in mem tests (mirror?) + SekMapMemory(System16BackupRam2 , 0xff4000, 0xff7fff, SM_RAM); + SekMapMemory(System16BackupRam , 0xff8000, 0xffffff, SM_RAM); + SekMapMemory(System16BackupRam2 , 0xffc000, 0xffffff, SM_RAM); + SekSetResetCallback(OutrunResetCallback); + SekSetReadWordHandler(0, XBoardReadWord); + SekSetWriteWordHandler(0, XBoardWriteWord); + SekSetReadByteHandler(0, XBoardReadByte); + SekSetWriteByteHandler(0, XBoardWriteByte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(System16Rom2 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(System16Ram , 0x09c000, 0x0a3fff, SM_RAM); + SekMapMemory(System16RoadRam , 0x0ec000, 0x0ecfff, SM_RAM); + SekMapMemory(System16Rom2 , 0x200000, 0x27ffff, SM_ROM); + SekMapMemory(System16Ram , 0x29c000, 0x2a3fff, SM_RAM); + SekMapMemory(System16RoadRam , 0x2ec000, 0x2ecfff, SM_RAM); + SekSetReadWordHandler(0, XBoard2ReadWord); + SekSetWriteWordHandler(0, XBoard2WriteWord); + SekSetReadByteHandler(0, XBoard2ReadByte); + SekSetWriteByteHandler(0, XBoard2WriteByte); + SekClose(); + + if (System16MapZ80Do) { + ZetInit(0); + ZetOpen(0); + System16MapZ80Do(); + ZetClose(); + } else { + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); + + ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); + + ZetSetReadHandler(System16Z80PCMRead); + ZetSetWriteHandler(System16Z80PCMWrite); + ZetSetInHandler(SystemXZ80PortRead); + ZetSetOutHandler(System16Z80PortWrite); + ZetClose(); + } + + if (System16Z80Rom2Num) { + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0xefff, 0, System16Z80Rom2); + ZetMapArea(0x0000, 0xefff, 2, System16Z80Rom2); + + ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram2); + ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram2); + ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram2); + + ZetSetReadHandler(System16Z80Read2); + ZetSetWriteHandler(System16Z80Write2); + ZetSetInHandler(System16Z80PortRead2); + ZetClose(); + } + + BurnYM2151Init(4000000); + BurnYM2151SetIrqHandler(&System16YM2151IRQHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.43, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.43, BURN_SND_ROUTE_RIGHT); + + if (System16PCMDataSize) { + SegaPCMInit(0, 4000000, BANK_512, System16PCMData, System16PCMDataSize); + SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + } + + if (System16PCM2DataSize) { + SegaPCMInit(1, 4000000, BANK_512, System16PCM2Data, System16PCM2DataSize); + SegaPCMSetRoute(1, BURN_SND_SEGAPCM_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + SegaPCMSetRoute(1, BURN_SND_SEGAPCM_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + } + + System16RoadColorOffset1 = 0x1700; + System16RoadColorOffset2 = 0x1720; + System16RoadColorOffset3 = 0x1780; + System16RoadXOffset = -166; + System16RoadPriority = 1; + System16TilemapColorOffset = 0x1c00; + + System16TileBankSize = 0x1000; + System16BTileMapsInit(0); + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMY) { + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(System16Rom , 0x000000, 0x07ffff, SM_READ); + SekMapMemory(System16Code , 0x000000, 0x07ffff, SM_FETCH); + SekMapMemory(System16Ram , 0x0c0000, 0x0cffff, SM_RAM); + SekMapMemory(System16ExtraRam , 0xff0000, 0xffffff, SM_RAM); + SekSetReadWordHandler(0, YBoardReadWord); + SekSetWriteWordHandler(0, YBoardWriteWord); + SekSetReadByteHandler(0, YBoardReadByte); + SekSetWriteByteHandler(0, YBoardWriteByte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(System16Rom2 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(System16Ram , 0x0c0000, 0x0cffff, SM_RAM); + SekMapMemory(System16SpriteRam2 , 0x180000, 0x18ffff, SM_RAM); + SekMapMemory(System16ExtraRam2 , 0xff0000, 0xffbfff, SM_RAM); + SekMapMemory(System16BackupRam , 0xffc000, 0xffffff, SM_RAM); + SekSetReadWordHandler(0, YBoard2ReadWord); + SekSetWriteWordHandler(0, YBoard2WriteWord); + SekClose(); + + SekInit(2, 0x68000); + SekOpen(2); + SekMapMemory(System16Rom3 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(System16Ram , 0x0c0000, 0x0cffff, SM_RAM); + SekMapMemory(System16RotateRam , 0x180000, 0x1807ff, SM_RAM); + SekMapMemory(System16SpriteRam , 0x188000, 0x188fff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x190000, 0x193fff, SM_RAM); + SekMapMemory(System16PaletteRam , 0x194000, 0x197fff, SM_RAM); + SekMapMemory(System16ExtraRam3 , 0xff0000, 0xffffff, SM_RAM); + SekSetReadWordHandler(0, YBoard3ReadWord); + SekSetWriteWordHandler(0, YBoard3WriteWord); + SekSetReadByteHandler(0, YBoard3ReadByte); + SekClose(); + + if (System16MapZ80Do) { + ZetInit(0); + ZetOpen(0); + System16MapZ80Do(); + ZetClose(); + } else { + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xdfff, 0, System16Z80Rom); + ZetMapArea(0x0000, 0xdfff, 2, System16Z80Rom); + + ZetMapArea(0xf800, 0xffff, 0, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 1, System16Z80Ram); + ZetMapArea(0xf800, 0xffff, 2, System16Z80Ram); + + ZetSetReadHandler(System16Z80PCMRead); + ZetSetWriteHandler(System16Z80PCMWrite); + ZetSetInHandler(SystemXZ80PortRead); + ZetSetOutHandler(System16Z80PortWrite); + ZetClose(); + } + + BurnYM2151Init(32215900 / 8); + BurnYM2151SetIrqHandler(&System16YM2151IRQHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.43, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.43, BURN_SND_ROUTE_RIGHT); + + if (System16PCMDataSize) { + SegaPCMInit(0, 32215900 / 8, BANK_12M | BANK_MASKF8, System16PCMData, System16PCMDataSize); + SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_1, 1.0, BURN_SND_ROUTE_LEFT); + SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_2, 1.0, BURN_SND_ROUTE_RIGHT); + } + } + + GenericTilesInit(); + bSystem16BootlegRender = false; + + // Reset the driver + System16DoReset(); + + return 0; +} + +/*==================================================== +Exit Function +====================================================*/ + +INT32 System16Exit() +{ + INT32 i; + + SekExit(); + if (System16Z80RomNum || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM)) ZetExit(); + if (System167751ProgSize) { + N7751Exit(); + DACExit(); + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { + BurnYM3438Exit(); + RF5C68PCMExit(); + } else { + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { + BurnYM2203Exit(); + } else { + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { + BurnYM2413Exit(); + } else { + BurnYM2151Exit(); + } + } + } + + if (System16PCMDataSize) SegaPCMExit(); + if (System16UPD7759DataSize) UPD7759Exit(); + + if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16A) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN)) { + ppi8255_exit(); + } + + if (nBurnGunNumPlayers) BurnGunExit(); + + GenericTilesExit(); + System16TileMapsExit(); + + BurnFree(Mem); + + // Reset Variables + for (i = 0; i < 4; i++) { + System16Page[i] = 0; + System16OldPage[i] = 0; + System16ScrollX[i] = 0; + System16ScrollY[i] = 0; + BootlegBgPage[i] = 0; + BootlegFgPage[i] = 0; + } + + for (i = 0; i < 16; i++) { + System16SpriteBanks[i] = 0; + } + + for (i = 0; i < 8; i++) { + System16TileBanks[i] = 0; + System16OldTileBanks[i] = 0; + } + + System16VideoEnable = 0; + System18VdpEnable = 0; + System18VdpMixing = 0; + System16ScreenFlip = 0; + System16SpriteShadow = 0; + System16SpriteXOffset = 0; + System16VideoControl = 0; + System16SoundLatch = 0; + System16ColScroll = 0; + System16RowScroll = 0; + System16IgnoreVideoEnable = 0; + + System16LastGear = 0; + System16HasGears = false; + + System16RoadControl = 0; + System16RoadColorOffset1 = 0; + System16RoadColorOffset2 = 0; + System16RoadColorOffset3 = 0; + System16RoadXOffset = 0; + System16RoadPriority = 0; + System16AnalogSelect = 0; + + System16ClockSpeed = 0; + + System16PaletteEntries = 0; + System16RamSize = 0; + System16ExtraRamSize = 0; + System16ExtraRam2Size = 0; + System16ExtraRam3Size = 0; + System16SpriteRamSize = 0; + System16SpriteRam2Size = 0; + System16RotateRamSize = 0; + System16TilemapColorOffset = 0; + System16TileBankSize = 0; + System16RecalcBgTileMap = 0; + System16RecalcBgAltTileMap = 0; + System16RecalcFgTileMap = 0; + System16RecalcFgAltTileMap = 0; + System16CreateOpaqueTileMaps = 0; + + System16BTileAlt = false; + Shangon = false; + Hangon = false; + bSystem16BootlegRender = false; + + System16YM2413IRQInterval = 0; + + UPD7759BankAddress = 0; + N7751Command = 0; + N7751RomAddress = 0; + + System16RomSize = 0; + System16RomNum = 0; + System16Rom2Size = 0; + System16Rom2Num = 0; + System16Rom3Size = 0; + System16Rom3Num = 0; + System16TileRomSize = 0; + System16TileRomNum = 0; + System16NumTiles = 0; + System16SpriteRomSize = 0; + System16SpriteRomNum = 0; + System16Sprite2RomSize = 0; + System16Sprite2RomNum = 0; + System16RoadRomSize = 0; + System16RoadRomNum = 0; + System16Z80RomSize = 0; + System16Z80RomNum = 0; + System16Z80Rom2Size = 0; + System16Z80Rom2Num = 0; + System16Z80Rom3Size = 0; + System16Z80Rom3Num = 0; + System16Z80Rom4Size = 0; + System16Z80Rom4Num = 0; + System167751ProgSize = 0; + System167751ProgNum = 0; + System167751DataSize = 0; + System167751DataNum = 0; + System16UPD7759DataSize = 0; + System16UPD7759DataNum = 0; + System16PCMDataSizePreAllocate = 0; + System16PCMDataSize = 0; + System16PCMDataNum = 0; + System16PCM2DataSize = 0; + System16PCM2DataNum = 0; + System16RF5C68DataSize = 0; + System16RF5C68DataNum = 0; + System16PromSize = 0; + System16PromNum = 0; + System16KeySize = 0; + + Simulate8751 = NULL; + System16Map68KDo = NULL; + System16MapZ80Do = NULL; + System16CustomLoadRomDo = NULL; + System16CustomDecryptOpCodeDo = NULL; + System16ProcessAnalogControlsDo = NULL; + System16MakeAnalogInputsDo = NULL; + + memset(multiply, 0, sizeof(multiply)); + memset(divide, 0, sizeof(divide)); + memset(compare_timer, 0, sizeof(compare_timer)); + + if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC_CPU2)) { + fd1094_exit(); + + // Switch back CPU core if needed + if (bUseAsm68KCoreOldValue) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); +#endif + bUseAsm68KCoreOldValue = false; + bBurnUseASMCPUEmulation = true; + } + } + + return 0; +} + +/*==================================================== +Frame Functions +====================================================*/ + +INT32 System16AFrame() +{ + INT32 nInterleave = 100; // alien syndrome needs high interleave for the DAC sounds to be processed + + if (System16Reset) System16DoReset(); + + System16MakeInputs(); + + nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = 4000000 / 60; + nCyclesTotal[2] = (6000000 / 15) / 60; + nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + ZetNewFrame(); + I8039NewFrame(); + + SekOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (System167751ProgSize) { + nCurrentCPU = 2; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = N7751Run(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + ZetClose(); + } + } + + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + if (Simulate8751) Simulate8751(); + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + } + + if (System167751ProgSize) DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) System16ARender(); + + return 0; +} + +INT32 System16BFrame() +{ + INT32 nInterleave = (nBurnSoundRate <= 44100) ? 183 : 200; // For the UPD7759 + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) nInterleave = System16YM2413IRQInterval; + + if (System16Reset) System16DoReset(); + + System16MakeInputs(); + + nCyclesTotal[0] = (INT32)((INT64)System16ClockSpeed * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = 5000000 / 60; + nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + if (System16Z80RomNum || ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM) && System16Z80Enable)) ZetNewFrame(); + + SekOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { + SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + } + + // Run Z80 + if (System16Z80RomNum || ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM) && System16Z80Enable)) { + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { + BurnYM2413Render(pSoundBuf, nSegmentLength); + } else { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + if (System16UPD7759DataSize) UPD7759Update(0,pSoundBuf, nSegmentLength); + ZetClose(); + } + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { + BurnYM2413Render(pSoundBuf, nSegmentLength); + } else { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + if (System16UPD7759DataSize) UPD7759Update(0,pSoundBuf, nSegmentLength); + ZetClose(); + } + } + } + + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + if (Simulate8751) Simulate8751(); + + if (pBurnDraw) { + if (System16BTileAlt) { + System16BAltRender(); + } else { + if (bSystem16BootlegRender) { + System16BootlegRender(); + } else { + System16BRender(); + } + } + } + + return 0; +} + +INT32 System18Frame() +{ + INT32 nInterleave = nBurnSoundLen; + + if (System16Reset) System16DoReset(); + + System16MakeInputs(); + + if (nBurnGunNumPlayers) System16GunMakeInputs(); + + nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = 8000000 / 60; + nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + + nCurrentCPU = 1; + ZetOpen(0); + BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + RF5C68PCMUpdate(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + ZetOpen(0); + BurnTimerEndFrame(nCyclesTotal[1]); + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + RF5C68PCMUpdate(pSoundBuf, nSegmentLength); + } + } + + ZetOpen(0); + if (pBurnSoundOut) BurnYM3438Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) { + System18Render(); + } + + return 0; +} + +INT32 HangonFrame() +{ + INT32 nInterleave = 10, i; + + if (System16Reset) System16DoReset(); + + System16MakeInputs(); + + nCyclesTotal[0] = (INT32)((INT64)System16ClockSpeed * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = (INT32)((INT64)System16ClockSpeed * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[2] = 4000000 / 60; + nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 #1 + nCurrentCPU = 0; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + SekClose(); + + // Run 68000 #2 + nCurrentCPU = 1; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = SekRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + SekClose(); + + // Run Z80 + nCurrentCPU = 2; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + SegaPCMUpdate(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + SegaPCMUpdate(pSoundBuf, nSegmentLength); + } + } + + SekOpen(0); + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + if (Simulate8751) Simulate8751(); + + if (pBurnDraw) { + HangonRender(); + } + + return 0; +} + +INT32 HangonYM2203Frame() +{ + INT32 nInterleave = 100, i; + + if (System16Reset) System16DoReset(); + + System16MakeInputs(); + + nCyclesTotal[0] = (INT32)((INT64)System16ClockSpeed * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = (INT32)((INT64)System16ClockSpeed * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[2] = 4000000 / 60; + nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 #1 + nCurrentCPU = 0; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + SekClose(); + + // Run 68000 #2 + nCurrentCPU = 1; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = SekRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + SekClose(); + + ZetOpen(0); + BurnTimerUpdate(i * (nCyclesTotal[2] / nInterleave)); + ZetClose(); + } + + SekOpen(0); + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + ZetOpen(0); + BurnTimerEndFrame(nCyclesTotal[2]); + ZetClose(); + + if (pBurnSoundOut) { + ZetOpen(0); + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + SegaPCMUpdate(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + } + + if (Simulate8751) Simulate8751(); + + if (pBurnDraw) { + if (Hangon) { + HangonAltRender(); + } else { + HangonRender(); + } + } + + return 0; +} + +INT32 OutrunFrame() +{ + INT32 nInterleave = 10, i; + + if (System16Reset) System16DoReset(); + + if (System16HasGears) { + OutrunMakeInputs(); + } else { + System16MakeInputs(); + } + + nCyclesTotal[0] = (INT32)((INT64)(40000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = (INT32)((INT64)(40000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[2] = (16000000 / 4) / 60; + nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 #1 + nCurrentCPU = 0; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 2 || i == 6 || i == 8) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run 68000 #2 + nCurrentCPU = 1; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = SekRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + SekClose(); + + // Run Z80 + nCurrentCPU = 2; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + SegaPCMUpdate(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + SegaPCMUpdate(pSoundBuf, nSegmentLength); + } + } + + for (i = 0; i < 2; i++) { + SekOpen(i); + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + } + + if (pBurnDraw) { + if (!Shangon) { + OutrunRender(); + } else { + ShangonRender(); + } + } + + return 0; +} + +INT32 XBoardFrame() +{ + INT32 nInterleave = 100, i; + + if (System16Reset) System16DoReset(); + + System16MakeInputs(); + + if (nBurnGunNumPlayers) System16GunMakeInputs(); + + nCyclesTotal[0] = (INT32)((INT64)(50000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = (INT32)((INT64)(50000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[2] = (16000000 / 4) / 60; + nCyclesTotal[3] = (16000000 / 4) / 60; + nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = nSystem16CyclesDone[3] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 #1 + nCurrentCPU = 0; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 20 || i == 40 || i == 60 || i == 80) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + if (i == 99) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run 68000 #2 + nCurrentCPU = 1; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = SekRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 99) SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run Z80 + nCurrentCPU = 2; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + // Run Z80 #2 + if (System16Z80Rom2Num) { + nCurrentCPU = 3; + ZetOpen(1); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + if (System16PCMDataSize) SegaPCMUpdate(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + if (System16PCMDataSize) SegaPCMUpdate(pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) { + XBoardRender(); + } + + return 0; +} + +INT32 YBoardFrame() +{ + INT32 nInterleave = 262, i; + + if (System16Reset) System16DoReset(); + + if (System16HasGears) { + PdriftMakeInputs(); + } else { + System16MakeInputs(); + } + + if (nBurnGunNumPlayers) System16GunMakeInputs(); + + nCyclesTotal[0] = (INT32)((INT64)(50000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = (INT32)((INT64)(50000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[2] = (INT32)((INT64)(50000000 / 4) * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[3] = (32215900 / 8) / 60; + nSystem16CyclesDone[0] = nSystem16CyclesDone[1] = nSystem16CyclesDone[2] = nSystem16CyclesDone[3] = 0; + + INT32 nSoundBufferPos = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 #1 + nCurrentCPU = 0; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nSystem16CyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + if (i == 170) SekSetIRQLine(2, SEK_IRQSTATUS_ACK); + if (i == 171) SekSetIRQLine(2, SEK_IRQSTATUS_NONE); + if (i == 223) SekSetIRQLine(4, SEK_IRQSTATUS_ACK); + if (i == 224) SekSetIRQLine(4, SEK_IRQSTATUS_NONE); + SekClose(); + + // Run 68000 #2 + nCurrentCPU = 1; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = SekRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 170) SekSetIRQLine(2, SEK_IRQSTATUS_ACK); + if (i == 171) SekSetIRQLine(2, SEK_IRQSTATUS_NONE); + if (i == 223) SekSetIRQLine(4, SEK_IRQSTATUS_ACK); + if (i == 224) SekSetIRQLine(4, SEK_IRQSTATUS_NONE); + SekClose(); + + // Run 68000 #3 + nCurrentCPU = 2; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = SekRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 170) SekSetIRQLine(2, SEK_IRQSTATUS_ACK); + if (i == 171) SekSetIRQLine(2, SEK_IRQSTATUS_NONE); + if (i == 223) SekSetIRQLine(4, SEK_IRQSTATUS_ACK); + if (i == 224) SekSetIRQLine(4, SEK_IRQSTATUS_NONE); + SekClose(); + + // Run Z80 + nCurrentCPU = 3; + ZetOpen(0); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nSystem16CyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nSystem16CyclesDone[nCurrentCPU] += nCyclesSegment; + ZetClose(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + SegaPCMUpdate(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + SegaPCMUpdate(pSoundBuf, nSegmentLength); + } + } + + if (pBurnDraw) { + YBoardRender(); + } + + return 0; +} + +/*==================================================== +Driver Scan +====================================================*/ + +INT32 System16Scan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029719; + } + + if (nAction & ACB_NVRAM) { + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMX || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEMY) { + if (System16BackupRamSize) { + memset(&ba, 0, sizeof(ba)); + ba.Data = System16BackupRam; + ba.nLen = System16BackupRamSize; + ba.szName = "Backup Ram 1"; + BurnAcb(&ba); + } + + if (System16BackupRam2Size) { + memset(&ba, 0, sizeof(ba)); + ba.Data = System16BackupRam2; + ba.nLen = System16BackupRam2Size; + ba.szName = "Backup Ram 2"; + BurnAcb(&ba); + } + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16B || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16A || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { + memset(&ba, 0, sizeof(ba)); + ba.Data = System16Ram; + ba.nLen = System16RamSize; + ba.szName = "Work Ram"; + BurnAcb(&ba); + } + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + if (System16Z80RomNum || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_ISGSM)) { + ZetScan(nAction); + } + + if ((BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC) || (BurnDrvGetHardwareCode() & HARDWARE_SEGA_FD1094_ENC_CPU2)) { + fd1094_scan(nAction); + } + + if (((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM16A) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_HANGON) || ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_OUTRUN)) { + ppi8255_scan(); + } + + if (nBurnGunNumPlayers) BurnGunScan(); + + SCAN_VAR(System16SoundLatch); + SCAN_VAR(System16Input); + SCAN_VAR(System16Dip); + SCAN_VAR(System16VideoEnable); + SCAN_VAR(System16ScreenFlip); + SCAN_VAR(System16ScrollX); + SCAN_VAR(System16ScrollY); + SCAN_VAR(System16ColScroll); + SCAN_VAR(System16RowScroll); + SCAN_VAR(System16SpriteBanks); + SCAN_VAR(System16TileBanks); + SCAN_VAR(System16Page); + SCAN_VAR(BootlegBgPage); + SCAN_VAR(BootlegFgPage); + SCAN_VAR(System16AnalogSelect); + SCAN_VAR(System16LastGear); + SCAN_VAR(nSystem16CyclesDone); + SCAN_VAR(nCyclesSegment); + SCAN_VAR(System16RoadControl); + SCAN_VAR(multiply); + SCAN_VAR(divide); + SCAN_VAR(compare_timer); + SCAN_VAR(N7751Command); + SCAN_VAR(N7751RomAddress); + SCAN_VAR(UPD7759BankAddress); + SCAN_VAR(System18VdpMixing); + SCAN_VAR(System18VdpEnable); + SCAN_VAR(RF5C68PCMBankAddress); + SCAN_VAR(System16Z80Enable); + + if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_SYSTEM18) { + BurnYM3438Scan(nAction, pnMin); + RF5C68PCMScan(nAction); + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0xa000, 0xbfff, 0, System16Z80Rom + 0x10000 + RF5C68PCMBankAddress); + ZetMapArea(0xa000, 0xbfff, 2, System16Z80Rom + 0x10000 + RF5C68PCMBankAddress); + ZetClose(); + } + } else { + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2203) { + BurnYM2203Scan(nAction, pnMin); + } else { + if (BurnDrvGetHardwareCode() & HARDWARE_SEGA_YM2413) { + BurnYM2413Scan(nAction); + } else { + BurnYM2151Scan(nAction); + } + } + } + + if (System16UPD7759DataSize) { + UPD7759Scan(0,nAction, pnMin); + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x8000, 0xdfff, 0, System16UPD7759Data + UPD7759BankAddress); + ZetMapArea(0x8000, 0xdfff, 2, System16UPD7759Data + UPD7759BankAddress); + ZetClose(); + } + } + + if (System167751ProgSize) { + N7751Scan(nAction, pnMin); + DACScan(nAction, pnMin); + } + + if (System16PCMDataSize) { + SegaPCMScan(nAction, pnMin); + } + + System16GfxScan(nAction); + } + + return 0; +} diff --git a/src/burn/drv/taito/d_arkanoid.cpp b/src/burn/drv/taito/d_arkanoid.cpp index fe4f3e363..e77ad0ad9 100644 --- a/src/burn/drv/taito/d_arkanoid.cpp +++ b/src/burn/drv/taito/d_arkanoid.cpp @@ -1,1978 +1,1977 @@ -// FB Alpha Arkanoid driver module -// Based on MAME driver by Brad Oliver and MANY others. - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "taito_m68705.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvMcuROM; -static UINT8 *DrvGfxROM; -static UINT8 *DrvColPROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvMcuRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvSprRAM; -static INT16 *pAY8910Buffer[3]; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *flipscreen; -static UINT8 *gfxbank; -static UINT8 *palettebank; -static UINT8 *paddleselect; -static UINT8 *bankselect; - -static UINT8 DrvInputs[4]; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvDips[1]; -static UINT8 DrvReset; -static UINT16 DrvAxis[2]; -static UINT32 nAnalogAxis[2] = {0,0}; - -static INT32 arkanoid_bootleg_id; -static INT32 use_mcu; - -static UINT8 arkanoid_bootleg_cmd; - -enum { - ARKUNK=0, - ARKANGC, - ARKANGC2, - ARKBLOCK, - ARKBLOC2, - ARKGCBL, - PADDLE2, - HEXA, - TETRSARK -}; - -#define A(a, b, c, d) { a, b, (UINT8*)(c), d } - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 4, "p1 coin" }, - {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 1"}, - - A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 x-axis"), - - {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 5, "p2 coin" }, - {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, - {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 2, "p2 fire 1"}, - - A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 1, "p1 x-axis"), - - {"Tilt", BIT_DIGITAL, DrvJoy1 + 3, "tilt" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "diag" }, - {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(Drv) - -static struct BurnInputInfo tetrsarkInputList[] = { - {"P1 Coin" , BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, - {"P1 Start" , BIT_DIGITAL, DrvJoy1 + 4, "p1 start" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 0, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1"}, - - {"P2 Coin" , BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, - {"P2 start" , BIT_DIGITAL, DrvJoy1 + 5, "p2 start" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 0, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, -}; - -STDINPUTINFO(tetrsark) - -static struct BurnInputInfo HexaInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 5, "p1 start"}, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, -}; - -STDINPUTINFO(Hexa) - -static struct BurnDIPInfo arkanoidDIPList[]= -{ - {0x0b, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0b, 0x01, 0x01, 0x01, "No" }, - {0x0b, 0x01, 0x01, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0b, 0x01, 0x02, 0x02, "Off" }, - {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0b, 0x01, 0x08, 0x08, "Easy" }, - {0x0b, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0b, 0x01, 0x10, 0x10, "20K 60K 60K+" }, - {0x0b, 0x01, 0x10, 0x00, "20K" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0b, 0x01, 0x20, 0x20, "3" }, - {0x0b, 0x01, 0x20, 0x00, "5" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - {0x0b, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, -}; - -STDDIPINFO(arkanoid) - -static struct BurnDIPInfo arknoidjDIPList[]= -{ - {0x0b, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0b, 0x01, 0x01, 0x01, "No" }, - {0x0b, 0x01, 0x01, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0b, 0x01, 0x02, 0x02, "Off" }, - {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0b, 0x01, 0x08, 0x08, "Easy" }, - {0x0b, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0b, 0x01, 0x10, 0x10, "20K 60K 60K+" }, - {0x0b, 0x01, 0x10, 0x00, "20K" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0b, 0x01, 0x20, 0x20, "3" }, - {0x0b, 0x01, 0x20, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x40, 0x00, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x80, 0x00, "Upright" }, - {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(arknoidj) - -static struct BurnDIPInfo ark1ballDIPList[]= -{ - {0x0b, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0b, 0x01, 0x01, 0x01, "No" }, - {0x0b, 0x01, 0x01, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0b, 0x01, 0x02, 0x02, "Off" }, - {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0b, 0x01, 0x08, 0x08, "Easy" }, - {0x0b, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0b, 0x01, 0x10, 0x10, "60K 100K 60K+" }, - {0x0b, 0x01, 0x10, 0x00, "60K" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0b, 0x01, 0x20, 0x20, "1" }, - {0x0b, 0x01, 0x20, 0x00, "2" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x40, 0x00, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x80, 0x00, "Upright" }, - {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(ark1ball) - -static struct BurnDIPInfo arkangcDIPList[]= -{ - {0x0b, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 2 , "Ball Speed" }, - {0x0b, 0x01, 0x01, 0x01, "Normal" }, - {0x0b, 0x01, 0x01, 0x00, "Faster" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0b, 0x01, 0x02, 0x02, "Off" }, - {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0b, 0x01, 0x08, 0x08, "Easy" }, - {0x0b, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0b, 0x01, 0x10, 0x10, "20K 60K 60K+" }, - {0x0b, 0x01, 0x10, 0x00, "20K" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0b, 0x01, 0x20, 0x20, "3" }, - {0x0b, 0x01, 0x20, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x40, 0x00, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x80, 0x00, "Upright" }, - {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(arkangc) - -static struct BurnDIPInfo arkangc2DIPList[]= -{ - {0x0b, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 2 , "Ball Speed" }, - {0x0b, 0x01, 0x01, 0x01, "Slower" }, - {0x0b, 0x01, 0x01, 0x00, "Normal" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0b, 0x01, 0x02, 0x02, "Off" }, - {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0b, 0x01, 0x08, 0x08, "Easy" }, - {0x0b, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0b, 0x01, 0x10, 0x10, "20K 60K 60K+" }, - {0x0b, 0x01, 0x10, 0x00, "20K" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0b, 0x01, 0x20, 0x20, "3" }, - {0x0b, 0x01, 0x20, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x40, 0x00, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x80, 0x00, "Upright" }, - {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(arkangc2) - -static struct BurnDIPInfo arkgcblDIPList[]= -{ - {0x0b, 0xff, 0xff, 0x5f, NULL }, - - {0 , 0xfe, 0 , 2 , "Round Select" }, - {0x0b, 0x01, 0x01, 0x01, "Off" }, - {0x0b, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0b, 0x01, 0x02, 0x02, "Off" }, - {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0b, 0x01, 0x08, 0x08, "Easy" }, - {0x0b, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0b, 0x01, 0x10, 0x10, "60K 100K 60K+" }, - {0x0b, 0x01, 0x10, 0x00, "60K" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0b, 0x01, 0x20, 0x00, "2" }, - {0x0b, 0x01, 0x20, 0x20, "3" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x80, 0x00, "Upright" }, - {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(arkgcbl) - -static struct BurnDIPInfo paddle2DIPList[]= -{ - {0x0b, 0xff, 0xff, 0x5f, NULL }, - - {0 , 0xfe, 0 , 2 , "Round Select" }, - {0x0b, 0x01, 0x01, 0x01, "Off" }, - {0x0b, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0b, 0x01, 0x02, 0x02, "Off" }, - {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Controls ?" }, - {0x0b, 0x01, 0x04, 0x04, "Normal" }, - {0x0b, 0x01, 0x04, 0x00, "Alternate" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0b, 0x01, 0x08, 0x08, "Easy" }, - {0x0b, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0b, 0x01, 0x10, 0x10, "60K 60K 60K+" }, - {0x0b, 0x01, 0x10, 0x00, "60K" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0b, 0x01, 0x20, 0x00, "2" }, - {0x0b, 0x01, 0x20, 0x20, "3" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x40, 0x00, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x80, 0x00, "Upright" }, - {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(paddle2) - -static struct BurnDIPInfo arktayt2DIPList[]= -{ - {0x0b, 0xff, 0xff, 0x3f, NULL }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0b, 0x01, 0x01, 0x01, "No" }, - {0x0b, 0x01, 0x01, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0b, 0x01, 0x02, 0x02, "Off" }, - {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Difficulty" }, - {0x0b, 0x01, 0x08, 0x08, "Easy" }, - {0x0b, 0x01, 0x08, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0b, 0x01, 0x10, 0x10, "60K 60K 60K+" }, - {0x0b, 0x01, 0x10, 0x00, "60K" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x0b, 0x01, 0x20, 0x20, "2" }, - {0x0b, 0x01, 0x20, 0x00, "3" }, - - {0 , 0xfe, 0 , 2 , "Coinage" }, - {0x0b, 0x01, 0x40, 0x00, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x80, 0x00, "Upright" }, - {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, -}; - -STDDIPINFO(arktayt2) - -static struct BurnDIPInfo tetrsarkDIPList[]= -{ - {0x0d, 0xff, 0xff, 0xf0, NULL }, - - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x10, 0x10, "Upright" }, - {0x0d, 0x01, 0x10, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x20, 0x20, "Off" }, - {0x0d, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - {0x0d, 0x01, 0xc0, 0x40, "1C 3C" }, - {0x0d, 0x01, 0xc0, 0x00, "1C 5C" }, -}; - -STDDIPINFO(tetrsark) - -static struct BurnDIPInfo HexaDIPList[]= -{ - {0x09, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x09, 0x01, 0x03, 0x00, "3 Coins 1 Credits" }, - {0x09, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, - {0x09, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, - {0x09, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2, "Naughty Pics" }, - {0x09, 0x01, 0x04, 0x04, "Off" }, - {0x09, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x09, 0x01, 0x08, 0x08, "Off" }, - {0x09, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty?" }, - {0x09, 0x01, 0x30, 0x30, "Easy?" }, - {0x09, 0x01, 0x30, 0x20, "Medium?" }, - {0x09, 0x01, 0x30, 0x10, "Hard?" }, - {0x09, 0x01, 0x30, 0x00, "Hardest?" }, - - {0 , 0xfe, 0 , 2, "Pobys" }, - {0x09, 0x01, 0x40, 0x40, "2" }, - {0x09, 0x01, 0x40, 0x00, "4" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x09, 0x01, 0x80, 0x00, "Off" }, - {0x09, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Hexa) - -static UINT8 arkanoid_bootleg_f002_read() -{ - UINT8 arkanoid_bootleg_val = 0x00; - - switch (arkanoid_bootleg_id) - { - case ARKANGC: - case ARKBLOCK: - case ARKBLOC2: - case ARKANGC2: - break; - - case ARKGCBL: - switch (arkanoid_bootleg_cmd) - { - case 0x8a: - arkanoid_bootleg_val = 0xa5; - break; - case 0xff: - arkanoid_bootleg_val = 0xe2; - break; - default: - break; - } - break; - - case PADDLE2: - switch (arkanoid_bootleg_cmd) - { - case 0x24: // Avoid bad jump to 0x0066 - arkanoid_bootleg_val = 0x9b; - break; - case 0x36: // Avoid "BAD HARDWARE " message - arkanoid_bootleg_val = 0x2d; - break; - case 0x38: // Start of levels table (fixed offset) - arkanoid_bootleg_val = 0xf3; - break; - case 0x8a: // Current level (fixed routine) - arkanoid_bootleg_val = 0xa5; - break; - case 0xc3: // Avoid bad jump to 0xf000 - arkanoid_bootleg_val = 0x1d; - break; - case 0xe3: // Number of bricks left (fixed offset) - arkanoid_bootleg_val = 0x61; - break; - case 0xf7: // Avoid "U69" message - arkanoid_bootleg_val = 0x00; - break; - case 0xff: // Avoid "BAD HARDWARE " message (fixed routine) - arkanoid_bootleg_val = 0xe2; - break; - default: - break; - } - break; - } - - return arkanoid_bootleg_val; -} - -static void arkanoid_bootleg_d018_write(UINT8 data) -{ - arkanoid_bootleg_cmd = 0x00; - - switch (arkanoid_bootleg_id) - { - case ARKANGC: - case ARKBLOCK: - switch (data) - { - case 0x36: // unneeded value : no call 0x2050, unused A and overwritten HL (0x0313 -> 0x0340) - if (ZetPc(-1) == 0x7c47) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x38: // unneeded value : no call 0x2050, unused A and fixed HL (0x7bd5) - if (ZetPc(-1) == 0x7b87) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x8a: // unneeded value : no call 0x2050, unused A and overwritten HL (0x7b77 -> 0x7c1c) - if (ZetPc(-1) == 0x9661) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xe3: // unneeded value : call 0x2050 but fixed A (0x00) and fixed HL (0xed83) - if (ZetPc(-1) == 0x67e3) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xf7: // unneeded value : 3 * 'NOP' at 0x034f + 2 * 'NOP' at 0x35b - if (ZetPc(-1) == 0x0349) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xff: // unneeded value : no call 0x2050, unused A and overwritten HL (0x7c4f -> 0x7d31) - if (ZetPc(-1) == 0x9670) - arkanoid_bootleg_cmd = 0x00; - break; - default: - arkanoid_bootleg_cmd = 0x00; - break; - } - break; - - case ARKANGC2: - switch (data) - { - case 0x36: // unneeded value : call 0x2050 but fixed A (0x2d) - if (ZetPc(-1) == 0x7c4c) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x38: // unneeded value : call 0x2050 but fixed A (0xf3) - if (ZetPc(-1) == 0x7b87) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x88: // unneeded value : no read back - if (ZetPc(-1) == 0x67e3) - arkanoid_bootleg_cmd = 0x00; - if (ZetPc(-1) == 0x7c47) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x89: // unneeded value : no read back - if (ZetPc(-1) == 0x67e5) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x8a: // unneeded value : call 0x2050 but fixed A (0xa5) - if (ZetPc(-1) == 0x9661) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xc0: // unneeded value : no read back - if (ZetPc(-1) == 0x67e7) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xe3: // unneeded value : call 0x2050 but fixed A (0x61) - if (ZetPc(-1) == 0x67e9) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xff: // unneeded value : call 0x2050 but fixed A (0xe2) - if (ZetPc(-1) == 0x9670) - arkanoid_bootleg_cmd = 0x00; - break; - default: - arkanoid_bootleg_cmd = 0x00; - break; - } - break; - - case ARKBLOC2: - switch (data) - { - case 0x36: // unneeded value : call 0x2050 but fixed A (0x2d) - if (ZetPc(-1) == 0x7c4c) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x38: // unneeded value : call 0x2050 but fixed A (0xf3) - if (ZetPc(-1) == 0x7b87) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x88: // unneeded value : no read back - if (ZetPc(-1) == 0x67e3) - arkanoid_bootleg_cmd = 0x00; - if (ZetPc(-1) == 0x7c47) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x89: // unneeded value : no read back - if (ZetPc(-1) == 0x67e5) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x8a: // unneeded value : call 0x2050 but unused HL and fixed DE (0x7c1c) - if (ZetPc(-1) == 0x9661) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xc0: // unneeded value : no read back - if (ZetPc(-1) == 0x67e7) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xe3: // unneeded value : call 0x2050 but fixed A (0x61) - if (ZetPc(-1) == 0x67e9) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xf7: // unneeded value : call 0x2050 but never called (check code at 0x0340) - if (ZetPc(-1) == 0x0349) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xff: // unneeded value : no call 0x2050, unused A and fixed HL (0x7d31) - if (ZetPc(-1) == 0x9670) - arkanoid_bootleg_cmd = 0x00; - break; - default: - arkanoid_bootleg_cmd = 0x00; - break; - } - break; - - case ARKGCBL: - switch (data) - { - case 0x36: // unneeded value : call 0x2050 but fixed A (0x2d) - if (ZetPc(-1) == 0x7c4c) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x38: // unneeded value : call 0x2050 but fixed A (0xf3) - if (ZetPc(-1) == 0x7b87) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x88: // unneeded value : no read back - if (ZetPc(-1) == 0x67e3) - arkanoid_bootleg_cmd = 0x00; - if (ZetPc(-1) == 0x7c47) - arkanoid_bootleg_cmd = 0x00; - case 0x89: // unneeded value : no read back - if (ZetPc(-1) == 0x67e5) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x8a: // call 0x2050 with A read from 0xf002 and wrong HL - if (ZetPc(-1) == 0x9661) - arkanoid_bootleg_cmd = data; - break; - case 0xc0: // unneeded value : no read back - if (ZetPc(-1) == 0x67e7) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xe3: // unneeded value : call 0x2050 but fixed A (0x61) - if (ZetPc(-1) == 0x67e9) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xf7: // unneeded value : 3 * 'NOP' at 0x034f + 'JR NZ,$035D' at 0x35b - if (ZetPc(-1) == 0x0349) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xff: // call 0x2050 with A read from 0xf002 and wrong HL - if (ZetPc(-1) == 0x9670) - arkanoid_bootleg_cmd = data; - break; - default: - arkanoid_bootleg_cmd = 0x00; - break; - } - break; - - case PADDLE2: - switch (data) - { - case 0x24: // A read from 0xf002 (expected to be 0x9b) - if (ZetPc(-1) == 0xbd7a) - arkanoid_bootleg_cmd = data; - break; - case 0x36: // call 0x2050 with A read from 0xf002 and wrong HL - if (ZetPc(-1) == 0x7c4c) - arkanoid_bootleg_cmd = data; - break; - case 0x38: // call 0x2050 with A read from 0xf002 and wrong HL - if (ZetPc(-1) == 0x7b87) - arkanoid_bootleg_cmd = data; - break; - case 0x88: // unneeded value : no read back - if (ZetPc(-1) == 0x67e3) - arkanoid_bootleg_cmd = 0x00; - if (ZetPc(-1) == 0x7c47) - arkanoid_bootleg_cmd = 0x00; - case 0x89: // unneeded value : no read back - if (ZetPc(-1) == 0x67e5) - arkanoid_bootleg_cmd = 0x00; - break; - case 0x8a: // call 0x2050 with A read from 0xf002 and wrong HL - if (ZetPc(-1) == 0x9661) - arkanoid_bootleg_cmd = data; - break; - case 0xc0: // unneeded value : no read back - if (ZetPc(-1) == 0x67e7) - arkanoid_bootleg_cmd = 0x00; - break; - case 0xc3: // A read from 0xf002 (expected to be 0x1d) - if (ZetPc(-1) == 0xbd8a) - arkanoid_bootleg_cmd = data; - break; - case 0xe3: // call 0x2050 with A read from 0xf002 and wrong HL - if (ZetPc(-1) == 0x67e9) - arkanoid_bootleg_cmd = data; - break; - case 0xf7: // call 0x2050 with A read from 0xf002 and wrong HL - if (ZetPc(-1) == 0x0349) - arkanoid_bootleg_cmd = data; - break; - case 0xff: // call 0x2050 with A read from 0xf002 and wrong HL - if (ZetPc(-1) == 0x9670) - arkanoid_bootleg_cmd = data; - break; - default: - arkanoid_bootleg_cmd = 0x00; - break; - } - break; - - default: - break; - } -} - -static UINT8 arkanoid_bootleg_d008_read() -{ - switch (arkanoid_bootleg_id) - { - case ARKANGC: - case ARKBLOCK: - return 0x00; - - case ARKANGC2: - return 0x02; - - case ARKBLOC2: - return (DrvInputs[2] < 0x40) << 5; - - case ARKGCBL: - return ((DrvInputs[2] < 0x40) << 5) | 0x02; - - case PADDLE2: - return ((DrvInputs[2] < 0x40) << 5) | 0x0f; - - default: - return 0x00; - } - - return 0; -} - -UINT8 __fastcall arkanoid_read(UINT16 address) -{ - switch (address) - { - case 0xd001: - return AY8910Read(0); - - case 0xd008: - return arkanoid_bootleg_d008_read(); - - case 0xd00c: - { - INT32 ret = DrvInputs[0]; - if (use_mcu) { - ret &= 0x3f; - - if (!main_sent) ret |= 0x40; - if (!mcu_sent ) ret |= 0x80; - } - return ret; - } - - case 0xd010: - return DrvInputs[1]; - - case 0xd018: - if (use_mcu) { - return standard_taito_mcu_read(); - } else { - return DrvInputs[2]; - } - - case 0xf002: - return arkanoid_bootleg_f002_read(); - } - - if (address >= 0xf000) return DrvZ80ROM[address]; - - return 0; -} - -void __fastcall arkanoid_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xd000: - case 0xd001: - AY8910Write(0, address & 1, data); - break; - - case 0xd008: - { - *flipscreen = (data >> 0) & 3; - *gfxbank = (data >> 5) & 1; - *palettebank = (data >> 6) & 1; - *paddleselect= (data >> 2) & 1; - } - break; - - case 0xd010: // watchdog - break; - - case 0xd018: - if (use_mcu) { - from_main = data; - main_sent = 1; - } else { - arkanoid_bootleg_d018_write(data); - } - break; - } -} - -static void bankswitch(INT32 data) -{ - bankselect[0] = data; - - INT32 bank = 0x8000 + ((data & 0x10) >> 4) * 0x4000; - - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + bank); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + bank); -} - -void __fastcall hexa_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xd000: - case 0xd001: - AY8910Write(0, address & 1, data); - return; - - case 0xd008: - *flipscreen = data & 0x03; // flipx & flipy - *gfxbank =(data & 0x20) >> 5; - bankswitch(data); - return; - } -} - -static void arkanoid_m68705_portC_write(UINT8 *data) -{ - if ((ddrC & 0x04) && (~*data & 0x04) && (portC_out & 0x04)) - { - main_sent = 0; - portA_in = from_main; - } - if ((ddrC & 0x08) && (~*data & 0x08) && (portC_out & 0x08)) - { - mcu_sent = 1; - from_mcu = portA_out; - } - - portC_out = *data; -} - -static void arkanoid_m68705_portB_read() -{ - ddrB = 0xff; - portB_out = (*paddleselect) ? DrvInputs[3] : DrvInputs[2]; -} - -static m68705_interface arkanoid_m68705_interface = { - NULL, - NULL, - arkanoid_m68705_portC_write, - NULL, - NULL, - NULL, - NULL, - arkanoid_m68705_portB_read, - standard_m68705_portC_in -}; - -static UINT8 ay8910_read_port_4(UINT32) -{ - INT32 ret = DrvDips[0]; - if (arkanoid_bootleg_id == TETRSARK) ret |= DrvInputs[1]; - - return ret; -} - -static UINT8 ay8910_read_port_5(UINT32) -{ - return DrvInputs[0]; -} - -static void DrvPaletteInit() -{ - INT32 len = BurnDrvGetPaletteEntries(); - - for (INT32 i = 0; i < len; i++) - { - INT32 bit0,bit1,bit2,bit3,r,g,b; - - bit0 = (DrvColPROM[i + len * 0] >> 0) & 0x01; - bit1 = (DrvColPROM[i + len * 0] >> 1) & 0x01; - bit2 = (DrvColPROM[i + len * 0] >> 2) & 0x01; - bit3 = (DrvColPROM[i + len * 0] >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvColPROM[i + len * 1] >> 0) & 0x01; - bit1 = (DrvColPROM[i + len * 1] >> 1) & 0x01; - bit2 = (DrvColPROM[i + len * 1] >> 2) & 0x01; - bit3 = (DrvColPROM[i + len * 1] >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (DrvColPROM[i + len * 2] >> 0) & 0x01; - bit1 = (DrvColPROM[i + len * 2] >> 1) & 0x01; - bit2 = (DrvColPROM[i + len * 2] >> 2) & 0x01; - bit3 = (DrvColPROM[i + len * 2] >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static void DrvGfxDecode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); - for (INT32 i = 0; i < 0x40000; i++) { - tmp[i] = ((DrvGfxROM[(i / 8) + 0x00000] >> (i & 7)) & 1) << 0; - tmp[i] |= ((DrvGfxROM[(i / 8) + 0x08000] >> (i & 7)) & 1) << 1; - tmp[i] |= ((DrvGfxROM[(i / 8) + 0x10000] >> (i & 7)) & 1) << 2; - } - - memcpy (DrvGfxROM, tmp, 0x40000); - BurnFree (tmp); -} - -static INT32 GetRoms() -{ - char* pRomName; - struct BurnRomInfo ri; - UINT8 *RomLoad = DrvZ80ROM; - UINT8 *GfxLoad = DrvGfxROM; - UINT8 *PrmLoad = DrvColPROM; - use_mcu = 0; - - for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { - - BurnDrvGetRomInfo(&ri, i); - - if ((ri.nType & 7) == 1) { - if (BurnLoadRom(RomLoad, i, 1)) return 1; - RomLoad += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 2) { - if (BurnLoadRom(DrvMcuROM, i, 1)) return 1; - use_mcu = 1; - continue; - } - - if ((ri.nType & 7) == 3) { - if (BurnLoadRom(GfxLoad, i, 1)) return 1; - GfxLoad += ri.nLen; - continue; - } - - if ((ri.nType & 7) == 4) { - if (BurnLoadRom(PrmLoad, i, 1)) return 1; - PrmLoad += ri.nLen; - continue; - } - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - m67805_taito_reset(); - - AY8910Reset(0); - - nAnalogAxis[0] = 0; - nAnalogAxis[1] = 0; - arkanoid_bootleg_cmd = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x010000; - DrvMcuROM = Next; Next += 0x000800; - - DrvGfxROM = Next; Next += 0x040000; - - DrvColPROM = Next; Next += 0x000800; - - DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x000800; - DrvMcuRAM = Next; Next += 0x000080; - DrvVidRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x000800; - - flipscreen = Next; Next += 0x000001; - gfxbank = Next; Next += 0x000001; - palettebank = Next; Next += 0x000001; - paddleselect = Next; Next += 0x000001; - bankselect = Next; Next += 0x000001; - - RamEnd = Next; - - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - if (GetRoms()) return 1; - - DrvGfxDecode(); - DrvPaletteInit(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); - ZetMapArea(0xe000, 0xe7ff, 0, DrvVidRAM); - ZetMapArea(0xe000, 0xe7ff, 1, DrvVidRAM); - ZetMapArea(0xe000, 0xe7ff, 2, DrvVidRAM); - ZetMapArea(0xe800, 0xefff, 0, DrvSprRAM); - ZetMapArea(0xe800, 0xefff, 1, DrvSprRAM); - ZetMapArea(0xe800, 0xefff, 2, DrvSprRAM); - ZetMapArea(0xf000, 0xffff, 2, DrvZ80ROM + 0xf000); - if (arkanoid_bootleg_id == HEXA) { - ZetSetWriteHandler(hexa_write); - } else { - ZetSetWriteHandler(arkanoid_write); - } - ZetSetReadHandler(arkanoid_read); - ZetMemEnd(); - ZetClose(); - - m67805_taito_init(DrvMcuROM, DrvMcuRAM, &arkanoid_m68705_interface); - - AY8910Init(0, 1500000, nBurnSoundRate, &ay8910_read_port_5, &ay8910_read_port_4, NULL, NULL); - AY8910SetAllRoutes(0, 0.33, BURN_SND_ROUTE_BOTH); - if (arkanoid_bootleg_id == HEXA) AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - m67805_taito_exit(); - - AY8910Exit(0); - - BurnFree (AllMem); - - arkanoid_bootleg_id = 0; - - return 0; -} - -static void draw_background_layer() -{ - for (INT32 offs = 0; offs < 32 * 30; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - if (*flipscreen) { - sx ^= 0xf8; - sy ^= 0xf8; - } - - sy -= 16; - - if (sy < 0 || sy >= nScreenHeight) continue; - - INT32 attr = DrvVidRAM[offs * 2 + 0]; - INT32 code = DrvVidRAM[offs * 2 + 1] | ((attr & 0x07) << 8) | (*gfxbank << 11); - INT32 color = ((attr & 0xf8) >> 3) | (*palettebank << 5); - - if (*flipscreen) { - Render8x8Tile_FlipY(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM); - } else { - Render8x8Tile_FlipX(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM); - } - } -} - -static void draw_sprites() -{ - for (INT32 offs = 0; offs < 0x40; offs+=4) - { - INT32 sx = DrvSprRAM[offs + 0]; - INT32 sy = 248 - DrvSprRAM[offs + 1]; - INT32 attr = DrvSprRAM[offs + 2]; - INT32 code = DrvSprRAM[offs + 3] | ((attr & 0x03) << 8) | (*gfxbank << 10); - INT32 color = ((attr & 0xf8) >> 3) | (*palettebank << 5); - - if (*flipscreen) { - sx = 248 - sx; - sy = 248 - sy; - - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code * 2 + 0, sx, sy - 8, color, 3, 0, 0, DrvGfxROM); - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code * 2 + 1, sx, sy - 16, color, 3, 0, 0, DrvGfxROM); - } else { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code * 2 + 0, sx, sy - 24, color, 3, 0, 0, DrvGfxROM); - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code * 2 + 1, sx, sy - 16, color, 3, 0, 0, DrvGfxROM); - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvPaletteInit(); - DrvRecalc = 0; - } - - draw_background_layer(); - draw_sprites(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 2); - - if (arkanoid_bootleg_id != HEXA) DrvInputs[0] = 0x4f; - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - - nAnalogAxis[0] -= DrvAxis[0]; - DrvInputs[2] = (~nAnalogAxis[0] >> 8) & 0xfe; - - nAnalogAxis[1] -= DrvAxis[1]; - DrvInputs[3] = (~nAnalogAxis[1] >> 8) & 0xfe; - } - - INT32 nInterleave = 100; - INT32 nCyclesTotal[2] = { 6000000 / 60, 3000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - ZetOpen(0); - m6805Open(0); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nSegment = nCyclesTotal[0] / nInterleave; - nCyclesDone[0] += ZetRun(nSegment); - - if (use_mcu) { - nSegment = nCyclesTotal[1] / nInterleave; - nCyclesDone[1] += m6805Run(nSegment); - } - } - - ZetRaiseIrq(0); - - m6805Close(); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029707; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - if (use_mcu) { - m68705_taito_scan(nAction); - } - - AY8910Scan(nAction, pnMin); - - SCAN_VAR(nAnalogAxis[0]); - SCAN_VAR(nAnalogAxis[1]); - SCAN_VAR(arkanoid_bootleg_cmd); - } - - return 0; -} - -static INT32 HexaScan(INT32 nAction, INT32 *pnMin) -{ - DrvScan(nAction, pnMin); - - if (nAction & ACB_WRITE) { - ZetOpen(0); - bankswitch(*bankselect); - ZetClose(); - } - - return 0; -} - - -// Arkanoid (World) - -static struct BurnRomInfo arkanoidRomDesc[] = { - { "a75-01-1.ic17",0x8000, 0x5bcda3b0, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "a75-11.ic16", 0x8000, 0xeafd7191, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU - - { "a75-03.ic64", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics - { "a75-04.ic63", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 - { "a75-05.ic62", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 - - { "a75-07.ic24", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms - { "a75-08.ic23", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 - { "a75-09.ic22", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 - - { "arkanoid1_68705p3.ic14", 0x0800, 0x1b68e2d8, 0 | BRF_PRG | BRF_OPT }, // 9 Decapped roms - { "arkanoid_mcu.ic14", 0x0800, 0x4e44b50a, 0 | BRF_PRG | BRF_OPT }, // 10 - { "arkanoid_68705p5.ic14", 0x0800, 0x0be83647, 0 | BRF_PRG | BRF_OPT }, // 11 -}; - -STD_ROM_PICK(arkanoid) -STD_ROM_FN(arkanoid) - -struct BurnDriver BurnDrvarkanoid = { - "arkanoid", NULL, NULL, NULL, "1986", - "Arkanoid (World)\0", NULL, "Taito Corporation Japan", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkanoidRomInfo, arkanoidRomName, NULL, NULL, DrvInputInfo, arkanoidDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (US) - -static struct BurnRomInfo arknoiduRomDesc[] = { - { "a75-19.ic17", 0x8000, 0xd3ad37d7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "a75-18.ic16", 0x8000, 0xcdc08301, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-20.ic14", 0x0800, 0xde518e47, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU - - { "a75-03.ic64", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics - { "a75-04.ic63", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 - { "a75-05.ic62", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 - - { "a75-07.ic24", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms - { "a75-08.ic23", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 - { "a75-09.ic22", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(arknoidu) -STD_ROM_FN(arknoidu) - -struct BurnDriver BurnDrvarknoidu = { - "arkanoidu", "arkanoid", NULL, NULL, "1986", - "Arkanoid (US)\0", NULL, "Taito America Corporation (Romstar license)", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arknoiduRomInfo, arknoiduRomName, NULL, NULL, DrvInputInfo, arkanoidDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (US, older) - -static struct BurnRomInfo arknoiuoRomDesc[] = { - { "a75-01-1.ic17",0x8000, 0x5bcda3b0, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "a75-10.ic16", 0x8000, 0xa1769e15, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU - - { "a75-03.ic64", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics - { "a75-04.ic63", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 - { "a75-05.ic62", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 - - { "a75-07.ic24", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms - { "a75-08.ic23", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 - { "a75-09.ic23", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(arknoiuo) -STD_ROM_FN(arknoiuo) - -struct BurnDriver BurnDrvarknoiuo = { - "arkanoiduo", "arkanoid", NULL, NULL, "1986", - "Arkanoid (US, older)\0", NULL, "Taito America Corporation (Romstar license)", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arknoiuoRomInfo, arknoiuoRomName, NULL, NULL, DrvInputInfo, arkanoidDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Tournament Arkanoid (US) - -static struct BurnRomInfo arkatourRomDesc[] = { - { "a75-27.ic17", 0x8000, 0xe3b8faf5, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "a75-28.ic16", 0x8000, 0x326aca4d, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-32.ic14", 0x0800, 0xd3249559, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU - - { "a75-29.ic64", 0x8000, 0x5ddea3cf, 3 | BRF_GRA }, // 3 Graphics - { "a75-30.ic63", 0x8000, 0x5fcf2e85, 3 | BRF_GRA }, // 4 - { "a75-31.ic62", 0x8000, 0x7b76b192, 3 | BRF_GRA }, // 5 - - { "a75-33.ic24", 0x0200, 0xb4bf3c81, 4 | BRF_GRA }, // 6 Color Proms - { "a75-34.ic23", 0x0200, 0xde85a803, 4 | BRF_GRA }, // 7 - { "a75-35.ic22", 0x0200, 0x38acfd3b, 4 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(arkatour) -STD_ROM_FN(arkatour) - -struct BurnDriver BurnDrvarkatour = { - "arkatour", "arkanoid", NULL, NULL, "1987", - "Tournament Arkanoid (US)\0", NULL, "Taito America Corporation (Romstar license)", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkatourRomInfo, arkatourRomName, NULL, NULL, DrvInputInfo, arkanoidDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (Japan) - -static struct BurnRomInfo arknoidjRomDesc[] = { - { "a75-21.ic17", 0x8000, 0xbf0455fc, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "a75-22.ic16", 0x8000, 0x3a2688d3, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-23.ic14", 0x0800, 0x0a4abef6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU - - { "a75-03.ic64", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics - { "a75-04.ic63", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 - { "a75-05.ic62", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 - - { "a75-07.ic24", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms - { "a75-08.ic23", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 - { "a75-09.ic22", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(arknoidj) -STD_ROM_FN(arknoidj) - -struct BurnDriver BurnDrvarknoidj = { - "arkanoidj", "arkanoid", NULL, NULL, "1986", - "Arkanoid (Japan)\0", NULL, "Taito Corporation", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arknoidjRomInfo, arknoidjRomName, NULL, NULL, DrvInputInfo, arknoidjDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (bootleg with MCU set 1) - -static struct BurnRomInfo arkmcublRomDesc[] = { - { "e1.6d", 0x8000, 0xdd4f2b72, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "e2.6f", 0x8000, 0xbbc33ceb, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU - - { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics - { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 - { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 - - { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms - { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 - { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 - - { "68705p3.6i", 0x0800, 0x389a8cfb, 0 | BRF_OPT | BRF_PRG }, // 9 Another MCU? -}; - -STD_ROM_PICK(arkmcubl) -STD_ROM_FN(arkmcubl) - -struct BurnDriver BurnDrvarkmcubl = { - "arkanoidjb", "arkanoid", NULL, NULL, "1986", - "Arkanoid (bootleg with MCU set 1)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkmcublRomInfo, arkmcublRomName, NULL, NULL, DrvInputInfo, arknoidjDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - - -// Arkanoid (bootleg with MCU set 2) - -static struct BurnRomInfo arkanoidjb2RomDesc[] = { - { "1.ic81", 0x8000, 0x9ff93dc2, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "2.ic82", 0x8000, 0xbbc33ceb, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU - - { "a75-03.ic64", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics - { "a75-04.ic63", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 - { "a75-05.ic62", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 - - { "a75-07.ic24", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms - { "a75-08.ic23", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 - { "a75-09.ic23", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(arkanoidjb2) -STD_ROM_FN(arkanoidjb2) - -struct BurnDriver BurnDrvarkanoidjb2 = { - "arkanoidjb2", "arkanoid", NULL, NULL, "1986", - "Arkanoid (bootleg with MCU set 2)\0", NULL, "bootleg (Beta)", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkanoidjb2RomInfo, arkanoidjb2RomName, NULL, NULL, DrvInputInfo, arknoidjDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (bootleg with MCU, alt) -// f205v id 318 - -static struct BurnRomInfo arkmcublaRomDesc[] = { - { "1.3f.ic81", 0x8000, 0x9ff93dc2, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "2.4f.ic82", 0x8000, 0xbbc33ceb, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU - - { "3.1c.ic33", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics - { "4.3c.ic34", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 - { "5.4c.ic35", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 - - { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms - { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 - { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 - - { "68705p3.6i", 0x0800, 0x389a8cfb, 0 | BRF_OPT | BRF_PRG }, // 9 Another MCU? -}; - -STD_ROM_PICK(arkmcubla) -STD_ROM_FN(arkmcubla) - -struct BurnDriver BurnDrvarkmcubla = { - "arkanoidjba", "arkanoid", NULL, NULL, "1986", - "Arkanoid (bootleg with MCU, alt)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkmcublaRomInfo, arkmcublaRomName, NULL, NULL, DrvInputInfo, arknoidjDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (bootleg with MCU, harder) - -static struct BurnRomInfo ark1ballRomDesc[] = { - { "a-1.7d", 0x8000, 0xdd4f2b72, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "2palline.7f", 0x8000, 0xed6b62ab, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU - - { "a-3.3a", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics - { "a-4.3d", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 - { "a-5.3f", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 - - { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms - { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 - { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(ark1ball) -STD_ROM_FN(ark1ball) - -struct BurnDriver BurnDrvark1ball = { - "ark1ball", "arkanoid", NULL, NULL, "1986", - "Arkanoid (bootleg with MCU, harder)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, ark1ballRomInfo, ark1ballRomName, NULL, NULL, DrvInputInfo, ark1ballDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (bootleg with MCU, harder, alt) -// f205v id 196 - -static struct BurnRomInfo ark1ballaRomDesc[] = { - { "6c.bin", 0x8000, 0x9ff93dc2, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "6f.bin", 0x8000, 0xed6b62ab, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU - - { "3b.bin", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics - { "3c.bin", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 - { "3f.bin", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 - - { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms - { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 - { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(ark1balla) -STD_ROM_FN(ark1balla) - -struct BurnDriver BurnDrvark1balla = { - "ark1balla", "arkanoid", NULL, NULL, "1986", - "Arkanoid (bootleg with MCU, harder, alt)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, ark1ballaRomInfo, ark1ballaRomName, NULL, NULL, DrvInputInfo, ark1ballDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (Game Corporation bootleg, set 1) - -static struct BurnRomInfo arkangcRomDesc[] = { - { "arkgc.1", 0x8000, 0xc54232e6, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "arkgc.2", 0x8000, 0x9f0d4754, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics - { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 - { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 - - { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms - { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 - { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(arkangc) -STD_ROM_FN(arkangc) - -static INT32 arkangcInit() -{ - arkanoid_bootleg_id = ARKANGC; - - return DrvInit(); -} - -struct BurnDriver BurnDrvarkangc = { - "arkangc", "arkanoid", NULL, NULL, "1986", - "Arkanoid (Game Corporation bootleg, set 1)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkangcRomInfo, arkangcRomName, NULL, NULL, DrvInputInfo, arkangcDIPInfo, - arkangcInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (Game Corporation bootleg, set 2) - -static struct BurnRomInfo arkangc2RomDesc[] = { - { "1.81", 0x8000, 0xbd6eb996, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "2.82", 0x8000, 0x29dbe452, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics - { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 - { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 - - { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms - { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 - { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(arkangc2) -STD_ROM_FN(arkangc2) - -static INT32 arkangc2Init() -{ - arkanoid_bootleg_id = ARKANGC2; - - return DrvInit(); -} - -struct BurnDriver BurnDrvarkangc2 = { - "arkangc2", "arkanoid", NULL, NULL, "1986", - "Arkanoid (Game Corporation bootleg, set 2)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkangc2RomInfo, arkangc2RomName, NULL, NULL, DrvInputInfo, arkangc2DIPInfo, - arkangc2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Block (Game Corporation bootleg, set 1) - -static struct BurnRomInfo arkblockRomDesc[] = { - { "ark-6.bin", 0x8000, 0x0be015de, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "arkgc.2", 0x8000, 0x9f0d4754, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics - { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 - { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 - - { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms - { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 - { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(arkblock) -STD_ROM_FN(arkblock) - -static INT32 arkblockInit() -{ - arkanoid_bootleg_id = ARKBLOCK; - - return DrvInit(); -} - -struct BurnDriver BurnDrvarkblock = { - "arkblock", "arkanoid", NULL, NULL, "1986", - "Block (Game Corporation bootleg, set 1)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkblockRomInfo, arkblockRomName, NULL, NULL, DrvInputInfo, arkangcDIPInfo, - arkblockInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Block (Game Corporation bootleg, set 2) - -static struct BurnRomInfo arkbloc2RomDesc[] = { - { "block01.bin", 0x8000, 0x5be667e1, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "block02.bin", 0x8000, 0x4f883ef1, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics - { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 - { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 - - { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms - { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 - { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(arkbloc2) -STD_ROM_FN(arkbloc2) - -static INT32 arkbloc2Init() -{ - arkanoid_bootleg_id = ARKBLOC2; - - return DrvInit(); -} - -struct BurnDriver BurnDrvarkbloc2 = { - "arkbloc2", "arkanoid", NULL, NULL, "1986", - "Block (Game Corporation bootleg, set 2)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkbloc2RomInfo, arkbloc2RomName, NULL, NULL, DrvInputInfo, arkangcDIPInfo, - arkbloc2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (bootleg on Block hardware) - -static struct BurnRomInfo arkgcblRomDesc[] = { - { "16.6e", 0x8000, 0xb0f73900, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "17.6f", 0x8000, 0x9827f297, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics - { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 - { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 - - { "82s129.5k", 0x0100, 0xfa70b64d, 4 | BRF_GRA }, // 5 Color Proms - { "82s129.5jk", 0x0100, 0xcca69884, 4 | BRF_GRA }, // 6 - { "82s129.5l", 0x0100, 0x3e4d2bf5, 4 | BRF_GRA }, // 7 - { "82s129.5kl", 0x0100, 0x085d625a, 4 | BRF_GRA }, // 8 - { "82s129.5mn", 0x0100, 0x0fe0b108, 4 | BRF_GRA }, // 9 - { "63s141.5m", 0x0100, 0x5553f675, 4 | BRF_GRA }, // 10 - - { "pal16r8.5f", 0x0104, 0x36471917, 0 | BRF_OPT | BRF_GRA }, // 11 PAL -}; - -STD_ROM_PICK(arkgcbl) -STD_ROM_FN(arkgcbl) - -static INT32 arkgcblInit() -{ - arkanoid_bootleg_id = ARKGCBL; - - return DrvInit(); -} - -struct BurnDriver BurnDrvarkgcbl = { - "arkgcbl", "arkanoid", NULL, NULL, "1986", - "Arkanoid (bootleg on Block hardware)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkgcblRomInfo, arkgcblRomName, NULL, NULL, DrvInputInfo, arkgcblDIPInfo, - arkgcblInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Paddle 2 (bootleg on Block hardware) - -static struct BurnRomInfo paddle2RomDesc[] = { - { "paddle2.16", 0x8000, 0xa286333c, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "paddle2.17", 0x8000, 0x04c2acb5, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics - { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 - { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 - - { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms - { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 - { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(paddle2) -STD_ROM_FN(paddle2) - -static INT32 paddle2Init() -{ - arkanoid_bootleg_id = PADDLE2; - - return DrvInit(); -} - -struct BurnDriver BurnDrvpaddle2 = { - "paddle2", "arkanoid", NULL, NULL, "1986", - "Paddle 2 (bootleg on Block hardware)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, paddle2RomInfo, paddle2RomName, NULL, NULL, DrvInputInfo, paddle2DIPInfo, - paddle2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (Tayto bootleg) - -static struct BurnRomInfo arkataytRomDesc[] = { - { "ic81-v.3f", 0x8000, 0x154e2c6f, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ic82-w.5f", 0x8000, 0x4fa8cefa, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "1-ic33.2c", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics - { "2-ic34.3c", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 - { "3-ic35.5c", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 - - { "ic73.11e", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms - { "ic74.12e", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 - { "ic75.13e", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(arkatayt) -STD_ROM_FN(arkatayt) - -struct BurnDriver BurnDrvarkatayt = { - "arkatayt", "arkanoid", NULL, NULL, "1986", - "Arkanoid (Tayto bootleg)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arkataytRomInfo, arkataytRomName, NULL, NULL, DrvInputInfo, arknoidjDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid (Tayto bootleg, harder) - -static struct BurnRomInfo arktayt2RomDesc[] = { - { "ic81.3f", 0x8000, 0x6e0a2b6f, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ic82.5f", 0x8000, 0x5a97dd56, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "1-ic33.2c", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics - { "2-ic34.3c", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 - { "3-ic35.5c", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 - - { "ic73.11e", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms - { "ic74.12e", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 - { "ic75.13e", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(arktayt2) -STD_ROM_FN(arktayt2) - -struct BurnDriver BurnDrvarktayt2 = { - "arktayt2", "arkanoid", NULL, NULL, "1986", - "Arkanoid (Tayto bootleg, harder)\0", NULL, "bootleg", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, arktayt2RomInfo, arktayt2RomName, NULL, NULL, DrvInputInfo, arktayt2DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Tetris (D.R. Korea) - -static struct BurnRomInfo tetrsarkRomDesc[] = { - { "ic17.1", 0x8000, 0x1a505eda, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "ic16.2", 0x8000, 0x157bc4df, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "ic64.3", 0x8000, 0xc3e9b290, 3 | BRF_GRA }, // 2 Graphics - { "ic63.4", 0x8000, 0xde9a368f, 3 | BRF_GRA }, // 3 - { "ic62.5", 0x8000, 0xc8e80a00, 3 | BRF_GRA }, // 4 - - { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms - { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 - { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(tetrsark) -STD_ROM_FN(tetrsark) - -static INT32 tetrsarkInit() -{ - arkanoid_bootleg_id = TETRSARK; - - INT32 nRet = DrvInit(); - - if (nRet == 0) { - for (INT32 i = 0; i < 0x8000; i++) { - DrvZ80ROM[i] ^= 0x94; - } - } - - return nRet; -} - -struct BurnDriver BurnDrvtetrsark = { - "tetrsark", NULL, NULL, NULL, "198?", - "Tetris (D.R. Korea)\0", "Wrong colors", "D.R. Korea", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, - NULL, tetrsarkRomInfo, tetrsarkRomName, NULL, NULL, tetrsarkInputInfo, tetrsarkDIPInfo, - tetrsarkInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Hexa - -static struct BurnRomInfo hexaRomDesc[] = { - { "hexa.20", 0x8000, 0x98b00586, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code - { "hexa.21", 0x8000, 0x3d5d006c, 1 | BRF_ESS | BRF_PRG }, // 1 - - { "hexa.17", 0x8000, 0xf6911dd6, 3 | BRF_GRA }, // 2 Graphics - { "hexa.18", 0x8000, 0x6e3d95d2, 3 | BRF_GRA }, // 3 - { "hexa.19", 0x8000, 0xffe97a31, 3 | BRF_GRA }, // 4 - - { "hexa.001", 0x0100, 0x88a055b4, 4 | BRF_GRA }, // 5 Color Proms - { "hexa.003", 0x0100, 0x3e9d4932, 4 | BRF_GRA }, // 6 - { "hexa.002", 0x0100, 0xff15366c, 4 | BRF_GRA }, // 7 -}; - -STD_ROM_PICK(hexa) -STD_ROM_FN(hexa) - -static INT32 HexaInit() -{ - arkanoid_bootleg_id = HEXA; - - return DrvInit(); -} - -struct BurnDriver BurnDrvHexa = { - "hexa", NULL, NULL, NULL, "199?", - "Hexa\0", NULL, "D. R. Korea", "Arkanoid", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 1, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, - NULL, hexaRomInfo, hexaRomName, NULL, NULL, HexaInputInfo, HexaDIPInfo, - HexaInit, DrvExit, DrvFrame, DrvDraw, HexaScan, &DrvRecalc, 0x100, - 256, 224, 4, 3 -}; - +// FB Alpha Arkanoid driver module +// Based on MAME driver by Brad Oliver and MANY others. + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "taito_m68705.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvMcuROM; +static UINT8 *DrvGfxROM; +static UINT8 *DrvColPROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvMcuRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvSprRAM; +static INT16 *pAY8910Buffer[3]; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *flipscreen; +static UINT8 *gfxbank; +static UINT8 *palettebank; +static UINT8 *paddleselect; +static UINT8 *bankselect; + +static UINT8 DrvInputs[4]; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvDips[1]; +static UINT8 DrvReset; +static UINT16 DrvAxis[2]; +static UINT32 nAnalogAxis[2] = {0,0}; + +static INT32 arkanoid_bootleg_id; +static INT32 use_mcu; + +static UINT8 arkanoid_bootleg_cmd; + +enum { + ARKUNK=0, + ARKANGC, + ARKANGC2, + ARKBLOCK, + ARKBLOC2, + ARKGCBL, + PADDLE2, + HEXA, + TETRSARK +}; + +#define A(a, b, c, d) { a, b, (UINT8*)(c), d } + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 4, "p1 coin" }, + {"P1 start" , BIT_DIGITAL , DrvJoy1 + 0, "p1 start" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 fire 1"}, + + A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 x-axis"), + + {"P2 Coin" , BIT_DIGITAL , DrvJoy1 + 5, "p2 coin" }, + {"P2 start" , BIT_DIGITAL , DrvJoy1 + 1, "p2 start" }, + {"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 2, "p2 fire 1"}, + + A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 1, "p1 x-axis"), + + {"Tilt", BIT_DIGITAL, DrvJoy1 + 3, "tilt" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "diag" }, + {"Reset", BIT_DIGITAL , &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(Drv) + +static struct BurnInputInfo tetrsarkInputList[] = { + {"P1 Coin" , BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, + {"P1 Start" , BIT_DIGITAL, DrvJoy1 + 4, "p1 start" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 0, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1"}, + + {"P2 Coin" , BIT_DIGITAL, DrvJoy1 + 7, "p2 coin" }, + {"P2 start" , BIT_DIGITAL, DrvJoy1 + 5, "p2 start" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 0, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" }, +}; + +STDINPUTINFO(tetrsark) + +static struct BurnInputInfo HexaInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 5, "p1 start"}, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, +}; + +STDINPUTINFO(Hexa) + +static struct BurnDIPInfo arkanoidDIPList[]= +{ + {0x0b, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0b, 0x01, 0x01, 0x01, "No" }, + {0x0b, 0x01, 0x01, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0b, 0x01, 0x02, 0x02, "Off" }, + {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0b, 0x01, 0x08, 0x08, "Easy" }, + {0x0b, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0b, 0x01, 0x10, 0x10, "20K 60K 60K+" }, + {0x0b, 0x01, 0x10, 0x00, "20K" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0b, 0x01, 0x20, 0x20, "3" }, + {0x0b, 0x01, 0x20, 0x00, "5" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + {0x0b, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, +}; + +STDDIPINFO(arkanoid) + +static struct BurnDIPInfo arknoidjDIPList[]= +{ + {0x0b, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0b, 0x01, 0x01, 0x01, "No" }, + {0x0b, 0x01, 0x01, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0b, 0x01, 0x02, 0x02, "Off" }, + {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0b, 0x01, 0x08, 0x08, "Easy" }, + {0x0b, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0b, 0x01, 0x10, 0x10, "20K 60K 60K+" }, + {0x0b, 0x01, 0x10, 0x00, "20K" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0b, 0x01, 0x20, 0x20, "3" }, + {0x0b, 0x01, 0x20, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x40, 0x00, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x80, 0x00, "Upright" }, + {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(arknoidj) + +static struct BurnDIPInfo ark1ballDIPList[]= +{ + {0x0b, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0b, 0x01, 0x01, 0x01, "No" }, + {0x0b, 0x01, 0x01, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0b, 0x01, 0x02, 0x02, "Off" }, + {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0b, 0x01, 0x08, 0x08, "Easy" }, + {0x0b, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0b, 0x01, 0x10, 0x10, "60K 100K 60K+" }, + {0x0b, 0x01, 0x10, 0x00, "60K" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0b, 0x01, 0x20, 0x20, "1" }, + {0x0b, 0x01, 0x20, 0x00, "2" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x40, 0x00, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x80, 0x00, "Upright" }, + {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(ark1ball) + +static struct BurnDIPInfo arkangcDIPList[]= +{ + {0x0b, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 2 , "Ball Speed" }, + {0x0b, 0x01, 0x01, 0x01, "Normal" }, + {0x0b, 0x01, 0x01, 0x00, "Faster" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0b, 0x01, 0x02, 0x02, "Off" }, + {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0b, 0x01, 0x08, 0x08, "Easy" }, + {0x0b, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0b, 0x01, 0x10, 0x10, "20K 60K 60K+" }, + {0x0b, 0x01, 0x10, 0x00, "20K" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0b, 0x01, 0x20, 0x20, "3" }, + {0x0b, 0x01, 0x20, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x40, 0x00, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x80, 0x00, "Upright" }, + {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(arkangc) + +static struct BurnDIPInfo arkangc2DIPList[]= +{ + {0x0b, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 2 , "Ball Speed" }, + {0x0b, 0x01, 0x01, 0x01, "Slower" }, + {0x0b, 0x01, 0x01, 0x00, "Normal" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0b, 0x01, 0x02, 0x02, "Off" }, + {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0b, 0x01, 0x08, 0x08, "Easy" }, + {0x0b, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0b, 0x01, 0x10, 0x10, "20K 60K 60K+" }, + {0x0b, 0x01, 0x10, 0x00, "20K" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0b, 0x01, 0x20, 0x20, "3" }, + {0x0b, 0x01, 0x20, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x40, 0x00, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x80, 0x00, "Upright" }, + {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(arkangc2) + +static struct BurnDIPInfo arkgcblDIPList[]= +{ + {0x0b, 0xff, 0xff, 0x5f, NULL }, + + {0 , 0xfe, 0 , 2 , "Round Select" }, + {0x0b, 0x01, 0x01, 0x01, "Off" }, + {0x0b, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0b, 0x01, 0x02, 0x02, "Off" }, + {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0b, 0x01, 0x08, 0x08, "Easy" }, + {0x0b, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0b, 0x01, 0x10, 0x10, "60K 100K 60K+" }, + {0x0b, 0x01, 0x10, 0x00, "60K" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0b, 0x01, 0x20, 0x00, "2" }, + {0x0b, 0x01, 0x20, 0x20, "3" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x80, 0x00, "Upright" }, + {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(arkgcbl) + +static struct BurnDIPInfo paddle2DIPList[]= +{ + {0x0b, 0xff, 0xff, 0x5f, NULL }, + + {0 , 0xfe, 0 , 2 , "Round Select" }, + {0x0b, 0x01, 0x01, 0x01, "Off" }, + {0x0b, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0b, 0x01, 0x02, 0x02, "Off" }, + {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Controls ?" }, + {0x0b, 0x01, 0x04, 0x04, "Normal" }, + {0x0b, 0x01, 0x04, 0x00, "Alternate" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0b, 0x01, 0x08, 0x08, "Easy" }, + {0x0b, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0b, 0x01, 0x10, 0x10, "60K 60K 60K+" }, + {0x0b, 0x01, 0x10, 0x00, "60K" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0b, 0x01, 0x20, 0x00, "2" }, + {0x0b, 0x01, 0x20, 0x20, "3" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x40, 0x00, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x80, 0x00, "Upright" }, + {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(paddle2) + +static struct BurnDIPInfo arktayt2DIPList[]= +{ + {0x0b, 0xff, 0xff, 0x3f, NULL }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0b, 0x01, 0x01, 0x01, "No" }, + {0x0b, 0x01, 0x01, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0b, 0x01, 0x02, 0x02, "Off" }, + {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Difficulty" }, + {0x0b, 0x01, 0x08, 0x08, "Easy" }, + {0x0b, 0x01, 0x08, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0b, 0x01, 0x10, 0x10, "60K 60K 60K+" }, + {0x0b, 0x01, 0x10, 0x00, "60K" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x0b, 0x01, 0x20, 0x20, "2" }, + {0x0b, 0x01, 0x20, 0x00, "3" }, + + {0 , 0xfe, 0 , 2 , "Coinage" }, + {0x0b, 0x01, 0x40, 0x00, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x40, 0x40, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x80, 0x00, "Upright" }, + {0x0b, 0x01, 0x80, 0x80, "Cocktail" }, +}; + +STDDIPINFO(arktayt2) + +static struct BurnDIPInfo tetrsarkDIPList[]= +{ + {0x0d, 0xff, 0xff, 0xf0, NULL }, + + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x10, 0x10, "Upright" }, + {0x0d, 0x01, 0x10, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x20, 0x20, "Off" }, + {0x0d, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + {0x0d, 0x01, 0xc0, 0x40, "1C 3C" }, + {0x0d, 0x01, 0xc0, 0x00, "1C 5C" }, +}; + +STDDIPINFO(tetrsark) + +static struct BurnDIPInfo HexaDIPList[]= +{ + {0x09, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x09, 0x01, 0x03, 0x00, "3 Coins 1 Credits" }, + {0x09, 0x01, 0x03, 0x01, "2 Coins 1 Credits" }, + {0x09, 0x01, 0x03, 0x03, "1 Coin 1 Credits" }, + {0x09, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2, "Naughty Pics" }, + {0x09, 0x01, 0x04, 0x04, "Off" }, + {0x09, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x09, 0x01, 0x08, 0x08, "Off" }, + {0x09, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty?" }, + {0x09, 0x01, 0x30, 0x30, "Easy?" }, + {0x09, 0x01, 0x30, 0x20, "Medium?" }, + {0x09, 0x01, 0x30, 0x10, "Hard?" }, + {0x09, 0x01, 0x30, 0x00, "Hardest?" }, + + {0 , 0xfe, 0 , 2, "Pobys" }, + {0x09, 0x01, 0x40, 0x40, "2" }, + {0x09, 0x01, 0x40, 0x00, "4" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x09, 0x01, 0x80, 0x00, "Off" }, + {0x09, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Hexa) + +static UINT8 arkanoid_bootleg_f002_read() +{ + UINT8 arkanoid_bootleg_val = 0x00; + + switch (arkanoid_bootleg_id) + { + case ARKANGC: + case ARKBLOCK: + case ARKBLOC2: + case ARKANGC2: + break; + + case ARKGCBL: + switch (arkanoid_bootleg_cmd) + { + case 0x8a: + arkanoid_bootleg_val = 0xa5; + break; + case 0xff: + arkanoid_bootleg_val = 0xe2; + break; + default: + break; + } + break; + + case PADDLE2: + switch (arkanoid_bootleg_cmd) + { + case 0x24: // Avoid bad jump to 0x0066 + arkanoid_bootleg_val = 0x9b; + break; + case 0x36: // Avoid "BAD HARDWARE " message + arkanoid_bootleg_val = 0x2d; + break; + case 0x38: // Start of levels table (fixed offset) + arkanoid_bootleg_val = 0xf3; + break; + case 0x8a: // Current level (fixed routine) + arkanoid_bootleg_val = 0xa5; + break; + case 0xc3: // Avoid bad jump to 0xf000 + arkanoid_bootleg_val = 0x1d; + break; + case 0xe3: // Number of bricks left (fixed offset) + arkanoid_bootleg_val = 0x61; + break; + case 0xf7: // Avoid "U69" message + arkanoid_bootleg_val = 0x00; + break; + case 0xff: // Avoid "BAD HARDWARE " message (fixed routine) + arkanoid_bootleg_val = 0xe2; + break; + default: + break; + } + break; + } + + return arkanoid_bootleg_val; +} + +static void arkanoid_bootleg_d018_write(UINT8 data) +{ + arkanoid_bootleg_cmd = 0x00; + + switch (arkanoid_bootleg_id) + { + case ARKANGC: + case ARKBLOCK: + switch (data) + { + case 0x36: // unneeded value : no call 0x2050, unused A and overwritten HL (0x0313 -> 0x0340) + if (ZetPc(-1) == 0x7c47) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x38: // unneeded value : no call 0x2050, unused A and fixed HL (0x7bd5) + if (ZetPc(-1) == 0x7b87) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x8a: // unneeded value : no call 0x2050, unused A and overwritten HL (0x7b77 -> 0x7c1c) + if (ZetPc(-1) == 0x9661) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xe3: // unneeded value : call 0x2050 but fixed A (0x00) and fixed HL (0xed83) + if (ZetPc(-1) == 0x67e3) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xf7: // unneeded value : 3 * 'NOP' at 0x034f + 2 * 'NOP' at 0x35b + if (ZetPc(-1) == 0x0349) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xff: // unneeded value : no call 0x2050, unused A and overwritten HL (0x7c4f -> 0x7d31) + if (ZetPc(-1) == 0x9670) + arkanoid_bootleg_cmd = 0x00; + break; + default: + arkanoid_bootleg_cmd = 0x00; + break; + } + break; + + case ARKANGC2: + switch (data) + { + case 0x36: // unneeded value : call 0x2050 but fixed A (0x2d) + if (ZetPc(-1) == 0x7c4c) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x38: // unneeded value : call 0x2050 but fixed A (0xf3) + if (ZetPc(-1) == 0x7b87) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x88: // unneeded value : no read back + if (ZetPc(-1) == 0x67e3) + arkanoid_bootleg_cmd = 0x00; + if (ZetPc(-1) == 0x7c47) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x89: // unneeded value : no read back + if (ZetPc(-1) == 0x67e5) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x8a: // unneeded value : call 0x2050 but fixed A (0xa5) + if (ZetPc(-1) == 0x9661) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xc0: // unneeded value : no read back + if (ZetPc(-1) == 0x67e7) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xe3: // unneeded value : call 0x2050 but fixed A (0x61) + if (ZetPc(-1) == 0x67e9) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xff: // unneeded value : call 0x2050 but fixed A (0xe2) + if (ZetPc(-1) == 0x9670) + arkanoid_bootleg_cmd = 0x00; + break; + default: + arkanoid_bootleg_cmd = 0x00; + break; + } + break; + + case ARKBLOC2: + switch (data) + { + case 0x36: // unneeded value : call 0x2050 but fixed A (0x2d) + if (ZetPc(-1) == 0x7c4c) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x38: // unneeded value : call 0x2050 but fixed A (0xf3) + if (ZetPc(-1) == 0x7b87) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x88: // unneeded value : no read back + if (ZetPc(-1) == 0x67e3) + arkanoid_bootleg_cmd = 0x00; + if (ZetPc(-1) == 0x7c47) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x89: // unneeded value : no read back + if (ZetPc(-1) == 0x67e5) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x8a: // unneeded value : call 0x2050 but unused HL and fixed DE (0x7c1c) + if (ZetPc(-1) == 0x9661) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xc0: // unneeded value : no read back + if (ZetPc(-1) == 0x67e7) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xe3: // unneeded value : call 0x2050 but fixed A (0x61) + if (ZetPc(-1) == 0x67e9) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xf7: // unneeded value : call 0x2050 but never called (check code at 0x0340) + if (ZetPc(-1) == 0x0349) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xff: // unneeded value : no call 0x2050, unused A and fixed HL (0x7d31) + if (ZetPc(-1) == 0x9670) + arkanoid_bootleg_cmd = 0x00; + break; + default: + arkanoid_bootleg_cmd = 0x00; + break; + } + break; + + case ARKGCBL: + switch (data) + { + case 0x36: // unneeded value : call 0x2050 but fixed A (0x2d) + if (ZetPc(-1) == 0x7c4c) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x38: // unneeded value : call 0x2050 but fixed A (0xf3) + if (ZetPc(-1) == 0x7b87) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x88: // unneeded value : no read back + if (ZetPc(-1) == 0x67e3) + arkanoid_bootleg_cmd = 0x00; + if (ZetPc(-1) == 0x7c47) + arkanoid_bootleg_cmd = 0x00; + case 0x89: // unneeded value : no read back + if (ZetPc(-1) == 0x67e5) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x8a: // call 0x2050 with A read from 0xf002 and wrong HL + if (ZetPc(-1) == 0x9661) + arkanoid_bootleg_cmd = data; + break; + case 0xc0: // unneeded value : no read back + if (ZetPc(-1) == 0x67e7) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xe3: // unneeded value : call 0x2050 but fixed A (0x61) + if (ZetPc(-1) == 0x67e9) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xf7: // unneeded value : 3 * 'NOP' at 0x034f + 'JR NZ,$035D' at 0x35b + if (ZetPc(-1) == 0x0349) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xff: // call 0x2050 with A read from 0xf002 and wrong HL + if (ZetPc(-1) == 0x9670) + arkanoid_bootleg_cmd = data; + break; + default: + arkanoid_bootleg_cmd = 0x00; + break; + } + break; + + case PADDLE2: + switch (data) + { + case 0x24: // A read from 0xf002 (expected to be 0x9b) + if (ZetPc(-1) == 0xbd7a) + arkanoid_bootleg_cmd = data; + break; + case 0x36: // call 0x2050 with A read from 0xf002 and wrong HL + if (ZetPc(-1) == 0x7c4c) + arkanoid_bootleg_cmd = data; + break; + case 0x38: // call 0x2050 with A read from 0xf002 and wrong HL + if (ZetPc(-1) == 0x7b87) + arkanoid_bootleg_cmd = data; + break; + case 0x88: // unneeded value : no read back + if (ZetPc(-1) == 0x67e3) + arkanoid_bootleg_cmd = 0x00; + if (ZetPc(-1) == 0x7c47) + arkanoid_bootleg_cmd = 0x00; + case 0x89: // unneeded value : no read back + if (ZetPc(-1) == 0x67e5) + arkanoid_bootleg_cmd = 0x00; + break; + case 0x8a: // call 0x2050 with A read from 0xf002 and wrong HL + if (ZetPc(-1) == 0x9661) + arkanoid_bootleg_cmd = data; + break; + case 0xc0: // unneeded value : no read back + if (ZetPc(-1) == 0x67e7) + arkanoid_bootleg_cmd = 0x00; + break; + case 0xc3: // A read from 0xf002 (expected to be 0x1d) + if (ZetPc(-1) == 0xbd8a) + arkanoid_bootleg_cmd = data; + break; + case 0xe3: // call 0x2050 with A read from 0xf002 and wrong HL + if (ZetPc(-1) == 0x67e9) + arkanoid_bootleg_cmd = data; + break; + case 0xf7: // call 0x2050 with A read from 0xf002 and wrong HL + if (ZetPc(-1) == 0x0349) + arkanoid_bootleg_cmd = data; + break; + case 0xff: // call 0x2050 with A read from 0xf002 and wrong HL + if (ZetPc(-1) == 0x9670) + arkanoid_bootleg_cmd = data; + break; + default: + arkanoid_bootleg_cmd = 0x00; + break; + } + break; + + default: + break; + } +} + +static UINT8 arkanoid_bootleg_d008_read() +{ + switch (arkanoid_bootleg_id) + { + case ARKANGC: + case ARKBLOCK: + return 0x00; + + case ARKANGC2: + return 0x02; + + case ARKBLOC2: + return (DrvInputs[2] < 0x40) << 5; + + case ARKGCBL: + return ((DrvInputs[2] < 0x40) << 5) | 0x02; + + case PADDLE2: + return ((DrvInputs[2] < 0x40) << 5) | 0x0f; + + default: + return 0x00; + } + + return 0; +} + +UINT8 __fastcall arkanoid_read(UINT16 address) +{ + switch (address) + { + case 0xd001: + return AY8910Read(0); + + case 0xd008: + return arkanoid_bootleg_d008_read(); + + case 0xd00c: + { + INT32 ret = DrvInputs[0]; + if (use_mcu) { + ret &= 0x3f; + + if (!main_sent) ret |= 0x40; + if (!mcu_sent ) ret |= 0x80; + } + return ret; + } + + case 0xd010: + return DrvInputs[1]; + + case 0xd018: + if (use_mcu) { + return standard_taito_mcu_read(); + } else { + return DrvInputs[2]; + } + + case 0xf002: + return arkanoid_bootleg_f002_read(); + } + + if (address >= 0xf000) return DrvZ80ROM[address]; + + return 0; +} + +void __fastcall arkanoid_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xd000: + case 0xd001: + AY8910Write(0, address & 1, data); + break; + + case 0xd008: + { + *flipscreen = (data >> 0) & 3; + *gfxbank = (data >> 5) & 1; + *palettebank = (data >> 6) & 1; + *paddleselect= (data >> 2) & 1; + } + break; + + case 0xd010: // watchdog + break; + + case 0xd018: + if (use_mcu) { + from_main = data; + main_sent = 1; + } else { + arkanoid_bootleg_d018_write(data); + } + break; + } +} + +static void bankswitch(INT32 data) +{ + bankselect[0] = data; + + INT32 bank = 0x8000 + ((data & 0x10) >> 4) * 0x4000; + + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + bank); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + bank); +} + +void __fastcall hexa_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xd000: + case 0xd001: + AY8910Write(0, address & 1, data); + return; + + case 0xd008: + *flipscreen = data & 0x03; // flipx & flipy + *gfxbank =(data & 0x20) >> 5; + bankswitch(data); + return; + } +} + +static void arkanoid_m68705_portC_write(UINT8 *data) +{ + if ((ddrC & 0x04) && (~*data & 0x04) && (portC_out & 0x04)) + { + main_sent = 0; + portA_in = from_main; + } + if ((ddrC & 0x08) && (~*data & 0x08) && (portC_out & 0x08)) + { + mcu_sent = 1; + from_mcu = portA_out; + } + + portC_out = *data; +} + +static void arkanoid_m68705_portB_read() +{ + ddrB = 0xff; + portB_out = (*paddleselect) ? DrvInputs[3] : DrvInputs[2]; +} + +static m68705_interface arkanoid_m68705_interface = { + NULL, + NULL, + arkanoid_m68705_portC_write, + NULL, + NULL, + NULL, + NULL, + arkanoid_m68705_portB_read, + standard_m68705_portC_in +}; + +static UINT8 ay8910_read_port_4(UINT32) +{ + INT32 ret = DrvDips[0]; + if (arkanoid_bootleg_id == TETRSARK) ret |= DrvInputs[1]; + + return ret; +} + +static UINT8 ay8910_read_port_5(UINT32) +{ + return DrvInputs[0]; +} + +static void DrvPaletteInit() +{ + INT32 len = BurnDrvGetPaletteEntries(); + + for (INT32 i = 0; i < len; i++) + { + INT32 bit0,bit1,bit2,bit3,r,g,b; + + bit0 = (DrvColPROM[i + len * 0] >> 0) & 0x01; + bit1 = (DrvColPROM[i + len * 0] >> 1) & 0x01; + bit2 = (DrvColPROM[i + len * 0] >> 2) & 0x01; + bit3 = (DrvColPROM[i + len * 0] >> 3) & 0x01; + r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvColPROM[i + len * 1] >> 0) & 0x01; + bit1 = (DrvColPROM[i + len * 1] >> 1) & 0x01; + bit2 = (DrvColPROM[i + len * 1] >> 2) & 0x01; + bit3 = (DrvColPROM[i + len * 1] >> 3) & 0x01; + g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + bit0 = (DrvColPROM[i + len * 2] >> 0) & 0x01; + bit1 = (DrvColPROM[i + len * 2] >> 1) & 0x01; + bit2 = (DrvColPROM[i + len * 2] >> 2) & 0x01; + bit3 = (DrvColPROM[i + len * 2] >> 3) & 0x01; + b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static void DrvGfxDecode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); + for (INT32 i = 0; i < 0x40000; i++) { + tmp[i] = ((DrvGfxROM[(i / 8) + 0x00000] >> (i & 7)) & 1) << 0; + tmp[i] |= ((DrvGfxROM[(i / 8) + 0x08000] >> (i & 7)) & 1) << 1; + tmp[i] |= ((DrvGfxROM[(i / 8) + 0x10000] >> (i & 7)) & 1) << 2; + } + + memcpy (DrvGfxROM, tmp, 0x40000); + BurnFree (tmp); +} + +static INT32 GetRoms() +{ + char* pRomName; + struct BurnRomInfo ri; + UINT8 *RomLoad = DrvZ80ROM; + UINT8 *GfxLoad = DrvGfxROM; + UINT8 *PrmLoad = DrvColPROM; + use_mcu = 0; + + for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) { + + BurnDrvGetRomInfo(&ri, i); + + if ((ri.nType & 7) == 1) { + if (BurnLoadRom(RomLoad, i, 1)) return 1; + RomLoad += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 2) { + if (BurnLoadRom(DrvMcuROM, i, 1)) return 1; + use_mcu = 1; + continue; + } + + if ((ri.nType & 7) == 3) { + if (BurnLoadRom(GfxLoad, i, 1)) return 1; + GfxLoad += ri.nLen; + continue; + } + + if ((ri.nType & 7) == 4) { + if (BurnLoadRom(PrmLoad, i, 1)) return 1; + PrmLoad += ri.nLen; + continue; + } + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + m67805_taito_reset(); + + AY8910Reset(0); + + nAnalogAxis[0] = 0; + nAnalogAxis[1] = 0; + arkanoid_bootleg_cmd = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x010000; + DrvMcuROM = Next; Next += 0x000800; + + DrvGfxROM = Next; Next += 0x040000; + + DrvColPROM = Next; Next += 0x000800; + + DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x000800; + DrvMcuRAM = Next; Next += 0x000080; + DrvVidRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x000800; + + flipscreen = Next; Next += 0x000001; + gfxbank = Next; Next += 0x000001; + palettebank = Next; Next += 0x000001; + paddleselect = Next; Next += 0x000001; + bankselect = Next; Next += 0x000001; + + RamEnd = Next; + + pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + if (GetRoms()) return 1; + + DrvGfxDecode(); + DrvPaletteInit(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM); + ZetMapArea(0xe000, 0xe7ff, 0, DrvVidRAM); + ZetMapArea(0xe000, 0xe7ff, 1, DrvVidRAM); + ZetMapArea(0xe000, 0xe7ff, 2, DrvVidRAM); + ZetMapArea(0xe800, 0xefff, 0, DrvSprRAM); + ZetMapArea(0xe800, 0xefff, 1, DrvSprRAM); + ZetMapArea(0xe800, 0xefff, 2, DrvSprRAM); + ZetMapArea(0xf000, 0xffff, 2, DrvZ80ROM + 0xf000); + if (arkanoid_bootleg_id == HEXA) { + ZetSetWriteHandler(hexa_write); + } else { + ZetSetWriteHandler(arkanoid_write); + } + ZetSetReadHandler(arkanoid_read); + ZetClose(); + + m67805_taito_init(DrvMcuROM, DrvMcuRAM, &arkanoid_m68705_interface); + + AY8910Init(0, 1500000, nBurnSoundRate, &ay8910_read_port_5, &ay8910_read_port_4, NULL, NULL); + AY8910SetAllRoutes(0, 0.33, BURN_SND_ROUTE_BOTH); + if (arkanoid_bootleg_id == HEXA) AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + m67805_taito_exit(); + + AY8910Exit(0); + + BurnFree (AllMem); + + arkanoid_bootleg_id = 0; + + return 0; +} + +static void draw_background_layer() +{ + for (INT32 offs = 0; offs < 32 * 30; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + if (*flipscreen) { + sx ^= 0xf8; + sy ^= 0xf8; + } + + sy -= 16; + + if (sy < 0 || sy >= nScreenHeight) continue; + + INT32 attr = DrvVidRAM[offs * 2 + 0]; + INT32 code = DrvVidRAM[offs * 2 + 1] | ((attr & 0x07) << 8) | (*gfxbank << 11); + INT32 color = ((attr & 0xf8) >> 3) | (*palettebank << 5); + + if (*flipscreen) { + Render8x8Tile_FlipY(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM); + } else { + Render8x8Tile_FlipX(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM); + } + } +} + +static void draw_sprites() +{ + for (INT32 offs = 0; offs < 0x40; offs+=4) + { + INT32 sx = DrvSprRAM[offs + 0]; + INT32 sy = 248 - DrvSprRAM[offs + 1]; + INT32 attr = DrvSprRAM[offs + 2]; + INT32 code = DrvSprRAM[offs + 3] | ((attr & 0x03) << 8) | (*gfxbank << 10); + INT32 color = ((attr & 0xf8) >> 3) | (*palettebank << 5); + + if (*flipscreen) { + sx = 248 - sx; + sy = 248 - sy; + + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code * 2 + 0, sx, sy - 8, color, 3, 0, 0, DrvGfxROM); + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code * 2 + 1, sx, sy - 16, color, 3, 0, 0, DrvGfxROM); + } else { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code * 2 + 0, sx, sy - 24, color, 3, 0, 0, DrvGfxROM); + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code * 2 + 1, sx, sy - 16, color, 3, 0, 0, DrvGfxROM); + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvPaletteInit(); + DrvRecalc = 0; + } + + draw_background_layer(); + draw_sprites(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 2); + + if (arkanoid_bootleg_id != HEXA) DrvInputs[0] = 0x4f; + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + + nAnalogAxis[0] -= DrvAxis[0]; + DrvInputs[2] = (~nAnalogAxis[0] >> 8) & 0xfe; + + nAnalogAxis[1] -= DrvAxis[1]; + DrvInputs[3] = (~nAnalogAxis[1] >> 8) & 0xfe; + } + + INT32 nInterleave = 100; + INT32 nCyclesTotal[2] = { 6000000 / 60, 3000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + ZetOpen(0); + m6805Open(0); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nSegment = nCyclesTotal[0] / nInterleave; + nCyclesDone[0] += ZetRun(nSegment); + + if (use_mcu) { + nSegment = nCyclesTotal[1] / nInterleave; + nCyclesDone[1] += m6805Run(nSegment); + } + } + + ZetRaiseIrq(0); + + m6805Close(); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029707; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + if (use_mcu) { + m68705_taito_scan(nAction); + } + + AY8910Scan(nAction, pnMin); + + SCAN_VAR(nAnalogAxis[0]); + SCAN_VAR(nAnalogAxis[1]); + SCAN_VAR(arkanoid_bootleg_cmd); + } + + return 0; +} + +static INT32 HexaScan(INT32 nAction, INT32 *pnMin) +{ + DrvScan(nAction, pnMin); + + if (nAction & ACB_WRITE) { + ZetOpen(0); + bankswitch(*bankselect); + ZetClose(); + } + + return 0; +} + + +// Arkanoid (World) + +static struct BurnRomInfo arkanoidRomDesc[] = { + { "a75-01-1.ic17",0x8000, 0x5bcda3b0, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "a75-11.ic16", 0x8000, 0xeafd7191, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU + + { "a75-03.ic64", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics + { "a75-04.ic63", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 + { "a75-05.ic62", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 + + { "a75-07.ic24", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms + { "a75-08.ic23", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 + { "a75-09.ic22", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 + + { "arkanoid1_68705p3.ic14", 0x0800, 0x1b68e2d8, 0 | BRF_PRG | BRF_OPT }, // 9 Decapped roms + { "arkanoid_mcu.ic14", 0x0800, 0x4e44b50a, 0 | BRF_PRG | BRF_OPT }, // 10 + { "arkanoid_68705p5.ic14", 0x0800, 0x0be83647, 0 | BRF_PRG | BRF_OPT }, // 11 +}; + +STD_ROM_PICK(arkanoid) +STD_ROM_FN(arkanoid) + +struct BurnDriver BurnDrvarkanoid = { + "arkanoid", NULL, NULL, NULL, "1986", + "Arkanoid (World)\0", NULL, "Taito Corporation Japan", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkanoidRomInfo, arkanoidRomName, NULL, NULL, DrvInputInfo, arkanoidDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (US) + +static struct BurnRomInfo arknoiduRomDesc[] = { + { "a75-19.ic17", 0x8000, 0xd3ad37d7, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "a75-18.ic16", 0x8000, 0xcdc08301, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-20.ic14", 0x0800, 0xde518e47, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU + + { "a75-03.ic64", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics + { "a75-04.ic63", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 + { "a75-05.ic62", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 + + { "a75-07.ic24", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms + { "a75-08.ic23", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 + { "a75-09.ic22", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(arknoidu) +STD_ROM_FN(arknoidu) + +struct BurnDriver BurnDrvarknoidu = { + "arkanoidu", "arkanoid", NULL, NULL, "1986", + "Arkanoid (US)\0", NULL, "Taito America Corporation (Romstar license)", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arknoiduRomInfo, arknoiduRomName, NULL, NULL, DrvInputInfo, arkanoidDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (US, older) + +static struct BurnRomInfo arknoiuoRomDesc[] = { + { "a75-01-1.ic17",0x8000, 0x5bcda3b0, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "a75-10.ic16", 0x8000, 0xa1769e15, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU + + { "a75-03.ic64", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics + { "a75-04.ic63", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 + { "a75-05.ic62", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 + + { "a75-07.ic24", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms + { "a75-08.ic23", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 + { "a75-09.ic23", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(arknoiuo) +STD_ROM_FN(arknoiuo) + +struct BurnDriver BurnDrvarknoiuo = { + "arkanoiduo", "arkanoid", NULL, NULL, "1986", + "Arkanoid (US, older)\0", NULL, "Taito America Corporation (Romstar license)", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arknoiuoRomInfo, arknoiuoRomName, NULL, NULL, DrvInputInfo, arkanoidDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Tournament Arkanoid (US) + +static struct BurnRomInfo arkatourRomDesc[] = { + { "a75-27.ic17", 0x8000, 0xe3b8faf5, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "a75-28.ic16", 0x8000, 0x326aca4d, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-32.ic14", 0x0800, 0xd3249559, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU + + { "a75-29.ic64", 0x8000, 0x5ddea3cf, 3 | BRF_GRA }, // 3 Graphics + { "a75-30.ic63", 0x8000, 0x5fcf2e85, 3 | BRF_GRA }, // 4 + { "a75-31.ic62", 0x8000, 0x7b76b192, 3 | BRF_GRA }, // 5 + + { "a75-33.ic24", 0x0200, 0xb4bf3c81, 4 | BRF_GRA }, // 6 Color Proms + { "a75-34.ic23", 0x0200, 0xde85a803, 4 | BRF_GRA }, // 7 + { "a75-35.ic22", 0x0200, 0x38acfd3b, 4 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(arkatour) +STD_ROM_FN(arkatour) + +struct BurnDriver BurnDrvarkatour = { + "arkatour", "arkanoid", NULL, NULL, "1987", + "Tournament Arkanoid (US)\0", NULL, "Taito America Corporation (Romstar license)", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkatourRomInfo, arkatourRomName, NULL, NULL, DrvInputInfo, arkanoidDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (Japan) + +static struct BurnRomInfo arknoidjRomDesc[] = { + { "a75-21.ic17", 0x8000, 0xbf0455fc, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "a75-22.ic16", 0x8000, 0x3a2688d3, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-23.ic14", 0x0800, 0x0a4abef6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU + + { "a75-03.ic64", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics + { "a75-04.ic63", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 + { "a75-05.ic62", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 + + { "a75-07.ic24", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms + { "a75-08.ic23", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 + { "a75-09.ic22", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(arknoidj) +STD_ROM_FN(arknoidj) + +struct BurnDriver BurnDrvarknoidj = { + "arkanoidj", "arkanoid", NULL, NULL, "1986", + "Arkanoid (Japan)\0", NULL, "Taito Corporation", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arknoidjRomInfo, arknoidjRomName, NULL, NULL, DrvInputInfo, arknoidjDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (bootleg with MCU set 1) + +static struct BurnRomInfo arkmcublRomDesc[] = { + { "e1.6d", 0x8000, 0xdd4f2b72, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "e2.6f", 0x8000, 0xbbc33ceb, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU + + { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics + { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 + { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 + + { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms + { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 + { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 + + { "68705p3.6i", 0x0800, 0x389a8cfb, 0 | BRF_OPT | BRF_PRG }, // 9 Another MCU? +}; + +STD_ROM_PICK(arkmcubl) +STD_ROM_FN(arkmcubl) + +struct BurnDriver BurnDrvarkmcubl = { + "arkanoidjb", "arkanoid", NULL, NULL, "1986", + "Arkanoid (bootleg with MCU set 1)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkmcublRomInfo, arkmcublRomName, NULL, NULL, DrvInputInfo, arknoidjDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + + +// Arkanoid (bootleg with MCU set 2) + +static struct BurnRomInfo arkanoidjb2RomDesc[] = { + { "1.ic81", 0x8000, 0x9ff93dc2, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "2.ic82", 0x8000, 0xbbc33ceb, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU + + { "a75-03.ic64", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics + { "a75-04.ic63", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 + { "a75-05.ic62", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 + + { "a75-07.ic24", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms + { "a75-08.ic23", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 + { "a75-09.ic23", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(arkanoidjb2) +STD_ROM_FN(arkanoidjb2) + +struct BurnDriver BurnDrvarkanoidjb2 = { + "arkanoidjb2", "arkanoid", NULL, NULL, "1986", + "Arkanoid (bootleg with MCU set 2)\0", NULL, "bootleg (Beta)", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkanoidjb2RomInfo, arkanoidjb2RomName, NULL, NULL, DrvInputInfo, arknoidjDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (bootleg with MCU, alt) +// f205v id 318 + +static struct BurnRomInfo arkmcublaRomDesc[] = { + { "1.3f.ic81", 0x8000, 0x9ff93dc2, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "2.4f.ic82", 0x8000, 0xbbc33ceb, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU + + { "3.1c.ic33", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics + { "4.3c.ic34", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 + { "5.4c.ic35", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 + + { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms + { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 + { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 + + { "68705p3.6i", 0x0800, 0x389a8cfb, 0 | BRF_OPT | BRF_PRG }, // 9 Another MCU? +}; + +STD_ROM_PICK(arkmcubla) +STD_ROM_FN(arkmcubla) + +struct BurnDriver BurnDrvarkmcubla = { + "arkanoidjba", "arkanoid", NULL, NULL, "1986", + "Arkanoid (bootleg with MCU, alt)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkmcublaRomInfo, arkmcublaRomName, NULL, NULL, DrvInputInfo, arknoidjDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (bootleg with MCU, harder) + +static struct BurnRomInfo ark1ballRomDesc[] = { + { "a-1.7d", 0x8000, 0xdd4f2b72, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "2palline.7f", 0x8000, 0xed6b62ab, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU + + { "a-3.3a", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics + { "a-4.3d", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 + { "a-5.3f", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 + + { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms + { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 + { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(ark1ball) +STD_ROM_FN(ark1ball) + +struct BurnDriver BurnDrvark1ball = { + "ark1ball", "arkanoid", NULL, NULL, "1986", + "Arkanoid (bootleg with MCU, harder)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, ark1ballRomInfo, ark1ballRomName, NULL, NULL, DrvInputInfo, ark1ballDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (bootleg with MCU, harder, alt) +// f205v id 196 + +static struct BurnRomInfo ark1ballaRomDesc[] = { + { "6c.bin", 0x8000, 0x9ff93dc2, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "6f.bin", 0x8000, 0xed6b62ab, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-06.ic14", 0x0800, 0x515d77b6, 2 | BRF_ESS | BRF_PRG }, // 2 M68705 MCU + + { "3b.bin", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 3 Graphics + { "3c.bin", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 4 + { "3f.bin", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 5 + + { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 6 Color Proms + { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 7 + { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(ark1balla) +STD_ROM_FN(ark1balla) + +struct BurnDriver BurnDrvark1balla = { + "ark1balla", "arkanoid", NULL, NULL, "1986", + "Arkanoid (bootleg with MCU, harder, alt)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, ark1ballaRomInfo, ark1ballaRomName, NULL, NULL, DrvInputInfo, ark1ballDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (Game Corporation bootleg, set 1) + +static struct BurnRomInfo arkangcRomDesc[] = { + { "arkgc.1", 0x8000, 0xc54232e6, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "arkgc.2", 0x8000, 0x9f0d4754, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics + { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 + { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 + + { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms + { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 + { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(arkangc) +STD_ROM_FN(arkangc) + +static INT32 arkangcInit() +{ + arkanoid_bootleg_id = ARKANGC; + + return DrvInit(); +} + +struct BurnDriver BurnDrvarkangc = { + "arkangc", "arkanoid", NULL, NULL, "1986", + "Arkanoid (Game Corporation bootleg, set 1)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkangcRomInfo, arkangcRomName, NULL, NULL, DrvInputInfo, arkangcDIPInfo, + arkangcInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (Game Corporation bootleg, set 2) + +static struct BurnRomInfo arkangc2RomDesc[] = { + { "1.81", 0x8000, 0xbd6eb996, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "2.82", 0x8000, 0x29dbe452, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics + { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 + { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 + + { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms + { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 + { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(arkangc2) +STD_ROM_FN(arkangc2) + +static INT32 arkangc2Init() +{ + arkanoid_bootleg_id = ARKANGC2; + + return DrvInit(); +} + +struct BurnDriver BurnDrvarkangc2 = { + "arkangc2", "arkanoid", NULL, NULL, "1986", + "Arkanoid (Game Corporation bootleg, set 2)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkangc2RomInfo, arkangc2RomName, NULL, NULL, DrvInputInfo, arkangc2DIPInfo, + arkangc2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Block (Game Corporation bootleg, set 1) + +static struct BurnRomInfo arkblockRomDesc[] = { + { "ark-6.bin", 0x8000, 0x0be015de, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "arkgc.2", 0x8000, 0x9f0d4754, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics + { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 + { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 + + { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms + { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 + { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(arkblock) +STD_ROM_FN(arkblock) + +static INT32 arkblockInit() +{ + arkanoid_bootleg_id = ARKBLOCK; + + return DrvInit(); +} + +struct BurnDriver BurnDrvarkblock = { + "arkblock", "arkanoid", NULL, NULL, "1986", + "Block (Game Corporation bootleg, set 1)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkblockRomInfo, arkblockRomName, NULL, NULL, DrvInputInfo, arkangcDIPInfo, + arkblockInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Block (Game Corporation bootleg, set 2) + +static struct BurnRomInfo arkbloc2RomDesc[] = { + { "block01.bin", 0x8000, 0x5be667e1, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "block02.bin", 0x8000, 0x4f883ef1, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics + { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 + { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 + + { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms + { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 + { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(arkbloc2) +STD_ROM_FN(arkbloc2) + +static INT32 arkbloc2Init() +{ + arkanoid_bootleg_id = ARKBLOC2; + + return DrvInit(); +} + +struct BurnDriver BurnDrvarkbloc2 = { + "arkbloc2", "arkanoid", NULL, NULL, "1986", + "Block (Game Corporation bootleg, set 2)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkbloc2RomInfo, arkbloc2RomName, NULL, NULL, DrvInputInfo, arkangcDIPInfo, + arkbloc2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (bootleg on Block hardware) + +static struct BurnRomInfo arkgcblRomDesc[] = { + { "16.6e", 0x8000, 0xb0f73900, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "17.6f", 0x8000, 0x9827f297, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics + { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 + { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 + + { "82s129.5k", 0x0100, 0xfa70b64d, 4 | BRF_GRA }, // 5 Color Proms + { "82s129.5jk", 0x0100, 0xcca69884, 4 | BRF_GRA }, // 6 + { "82s129.5l", 0x0100, 0x3e4d2bf5, 4 | BRF_GRA }, // 7 + { "82s129.5kl", 0x0100, 0x085d625a, 4 | BRF_GRA }, // 8 + { "82s129.5mn", 0x0100, 0x0fe0b108, 4 | BRF_GRA }, // 9 + { "63s141.5m", 0x0100, 0x5553f675, 4 | BRF_GRA }, // 10 + + { "pal16r8.5f", 0x0104, 0x36471917, 0 | BRF_OPT | BRF_GRA }, // 11 PAL +}; + +STD_ROM_PICK(arkgcbl) +STD_ROM_FN(arkgcbl) + +static INT32 arkgcblInit() +{ + arkanoid_bootleg_id = ARKGCBL; + + return DrvInit(); +} + +struct BurnDriver BurnDrvarkgcbl = { + "arkgcbl", "arkanoid", NULL, NULL, "1986", + "Arkanoid (bootleg on Block hardware)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkgcblRomInfo, arkgcblRomName, NULL, NULL, DrvInputInfo, arkgcblDIPInfo, + arkgcblInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Paddle 2 (bootleg on Block hardware) + +static struct BurnRomInfo paddle2RomDesc[] = { + { "paddle2.16", 0x8000, 0xa286333c, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "paddle2.17", 0x8000, 0x04c2acb5, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "a75-03.rom", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics + { "a75-04.rom", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 + { "a75-05.rom", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 + + { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms + { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 + { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(paddle2) +STD_ROM_FN(paddle2) + +static INT32 paddle2Init() +{ + arkanoid_bootleg_id = PADDLE2; + + return DrvInit(); +} + +struct BurnDriver BurnDrvpaddle2 = { + "paddle2", "arkanoid", NULL, NULL, "1986", + "Paddle 2 (bootleg on Block hardware)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, paddle2RomInfo, paddle2RomName, NULL, NULL, DrvInputInfo, paddle2DIPInfo, + paddle2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (Tayto bootleg) + +static struct BurnRomInfo arkataytRomDesc[] = { + { "ic81-v.3f", 0x8000, 0x154e2c6f, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ic82-w.5f", 0x8000, 0x4fa8cefa, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "1-ic33.2c", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics + { "2-ic34.3c", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 + { "3-ic35.5c", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 + + { "ic73.11e", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms + { "ic74.12e", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 + { "ic75.13e", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(arkatayt) +STD_ROM_FN(arkatayt) + +struct BurnDriver BurnDrvarkatayt = { + "arkatayt", "arkanoid", NULL, NULL, "1986", + "Arkanoid (Tayto bootleg)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arkataytRomInfo, arkataytRomName, NULL, NULL, DrvInputInfo, arknoidjDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid (Tayto bootleg, harder) + +static struct BurnRomInfo arktayt2RomDesc[] = { + { "ic81.3f", 0x8000, 0x6e0a2b6f, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ic82.5f", 0x8000, 0x5a97dd56, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "1-ic33.2c", 0x8000, 0x038b74ba, 3 | BRF_GRA }, // 2 Graphics + { "2-ic34.3c", 0x8000, 0x71fae199, 3 | BRF_GRA }, // 3 + { "3-ic35.5c", 0x8000, 0xc76374e2, 3 | BRF_GRA }, // 4 + + { "ic73.11e", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms + { "ic74.12e", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 + { "ic75.13e", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(arktayt2) +STD_ROM_FN(arktayt2) + +struct BurnDriver BurnDrvarktayt2 = { + "arktayt2", "arkanoid", NULL, NULL, "1986", + "Arkanoid (Tayto bootleg, harder)\0", NULL, "bootleg", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, arktayt2RomInfo, arktayt2RomName, NULL, NULL, DrvInputInfo, arktayt2DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Tetris (D.R. Korea) + +static struct BurnRomInfo tetrsarkRomDesc[] = { + { "ic17.1", 0x8000, 0x1a505eda, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "ic16.2", 0x8000, 0x157bc4df, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "ic64.3", 0x8000, 0xc3e9b290, 3 | BRF_GRA }, // 2 Graphics + { "ic63.4", 0x8000, 0xde9a368f, 3 | BRF_GRA }, // 3 + { "ic62.5", 0x8000, 0xc8e80a00, 3 | BRF_GRA }, // 4 + + { "a75-07.bpr", 0x0200, 0x0af8b289, 4 | BRF_GRA }, // 5 Color Proms + { "a75-08.bpr", 0x0200, 0xabb002fb, 4 | BRF_GRA }, // 6 + { "a75-09.bpr", 0x0200, 0xa7c6c277, 4 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(tetrsark) +STD_ROM_FN(tetrsark) + +static INT32 tetrsarkInit() +{ + arkanoid_bootleg_id = TETRSARK; + + INT32 nRet = DrvInit(); + + if (nRet == 0) { + for (INT32 i = 0; i < 0x8000; i++) { + DrvZ80ROM[i] ^= 0x94; + } + } + + return nRet; +} + +struct BurnDriver BurnDrvtetrsark = { + "tetrsark", NULL, NULL, NULL, "198?", + "Tetris (D.R. Korea)\0", "Wrong colors", "D.R. Korea", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_BREAKOUT, 0, + NULL, tetrsarkRomInfo, tetrsarkRomName, NULL, NULL, tetrsarkInputInfo, tetrsarkDIPInfo, + tetrsarkInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Hexa + +static struct BurnRomInfo hexaRomDesc[] = { + { "hexa.20", 0x8000, 0x98b00586, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code + { "hexa.21", 0x8000, 0x3d5d006c, 1 | BRF_ESS | BRF_PRG }, // 1 + + { "hexa.17", 0x8000, 0xf6911dd6, 3 | BRF_GRA }, // 2 Graphics + { "hexa.18", 0x8000, 0x6e3d95d2, 3 | BRF_GRA }, // 3 + { "hexa.19", 0x8000, 0xffe97a31, 3 | BRF_GRA }, // 4 + + { "hexa.001", 0x0100, 0x88a055b4, 4 | BRF_GRA }, // 5 Color Proms + { "hexa.003", 0x0100, 0x3e9d4932, 4 | BRF_GRA }, // 6 + { "hexa.002", 0x0100, 0xff15366c, 4 | BRF_GRA }, // 7 +}; + +STD_ROM_PICK(hexa) +STD_ROM_FN(hexa) + +static INT32 HexaInit() +{ + arkanoid_bootleg_id = HEXA; + + return DrvInit(); +} + +struct BurnDriver BurnDrvHexa = { + "hexa", NULL, NULL, NULL, "199?", + "Hexa\0", NULL, "D. R. Korea", "Arkanoid", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 1, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, + NULL, hexaRomInfo, hexaRomName, NULL, NULL, HexaInputInfo, HexaDIPInfo, + HexaInit, DrvExit, DrvFrame, DrvDraw, HexaScan, &DrvRecalc, 0x100, + 256, 224, 4, 3 +}; + diff --git a/src/burn/drv/taito/d_ashnojoe.cpp b/src/burn/drv/taito/d_ashnojoe.cpp index d844f4da7..79c9c97b5 100644 --- a/src/burn/drv/taito/d_ashnojoe.cpp +++ b/src/burn/drv/taito/d_ashnojoe.cpp @@ -1,717 +1,716 @@ -// FB Alpha Ashita No Joe / Success Joe driver module -// Based on MAME driver by driver by David Haywood and Pierpaolo Prazzoli - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2203.h" -#include "msm5205.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvGfxROM3; -static UINT8 *DrvGfxROM4; -static UINT8 *DrvZ80Banks; -static UINT8 *DrvPfRAM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvPalRAM; - -static UINT32 *DrvPalette; - -static UINT8 *soundlatch; -static UINT8 *soundstatus; -static UINT8 *tilemap_reg; - -static UINT16 *scrollx; -static UINT16 *scrolly; - -static INT32 flipscreen; - -static UINT8 adpcm_byte = 0; -static UINT8 MSM5205_vclk_toggle = 0; - -static UINT8 DrvJoy1[16]; -static UINT8 DrvJoy2[16]; -static UINT8 DrvDips[2]; -static UINT8 DrvReset; -static UINT16 DrvInputs[2]; - -static struct BurnInputInfo AshnojoeInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 11, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 13, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 12, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 14, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 8, "service" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Ashnojoe) - -static struct BurnDIPInfo AshnojoeDIPList[]= -{ - {0x12, 0xff, 0xff, 0x00, NULL }, - {0x13, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x12, 0x01, 0x01, 0x00, "Upright" }, - {0x12, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x12, 0x01, 0x02, 0x00, "Off" }, - {0x12, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x12, 0x01, 0x04, 0x00, "Off" }, - {0x12, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x12, 0x01, 0x08, 0x08, "Off" }, - {0x12, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x12, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x12, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, - {0x12, 0x01, 0x30, 0x30, "2 Coins 3 Credits" }, - {0x12, 0x01, 0x30, 0x10, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x13, 0x01, 0x03, 0x01, "Easy" }, - {0x13, 0x01, 0x03, 0x00, "Normal" }, - {0x13, 0x01, 0x03, 0x02, "Medium" }, - {0x13, 0x01, 0x03, 0x03, "Hard" }, - - {0 , 0xfe, 0 , 2, "Number of controller" }, - {0x13, 0x01, 0x04, 0x00, "2" }, - {0x13, 0x01, 0x04, 0x04, "1" }, -}; - -STDDIPINFO(Ashnojoe) - -void __fastcall ashnojoe_write_byte(UINT32 a, UINT8 d) -{ - bprintf (0, _T("%5.5x, %2.2x wb\n"), a, d); -} - -void __fastcall ashnojoe_write_word(UINT32 a, UINT16 d) -{ - switch (a) - { - case 0x4a006: - *tilemap_reg = d & 0xff; - return; - - case 0x4a008: - *soundlatch = d & 0xff; - *soundstatus = 1; - return; - - case 0x4a010: - case 0x4a012: - case 0x4a014: - case 0x4a016: - case 0x4a018: - scrollx[(a & 0x0f) / 2] = d; - return; - - case 0x4a020: - case 0x4a022: - case 0x4a024: - case 0x4a026: - case 0x4a028: - scrolly[(a & 0x0f) / 2] = d; - return; - } -} - -UINT8 __fastcall ashnojoe_read_byte(UINT32 a) -{ - bprintf (0, _T("%5.5x, rb\n"), a); - - return 0; -} - -UINT16 __fastcall ashnojoe_read_word(UINT32 a) -{ - switch (a) - { - case 0x4a000: - return DrvInputs[0]; - - case 0x4a002: - return DrvInputs[1]; - - case 0x4a004: - return ((DrvDips[1] << 8) | (DrvDips[0])); - - case 0x4a00a: - return 0; // debug? 1 kills sound - } - - return 0; -} - -void __fastcall ashnojoe_sound_write_port(UINT16 p, UINT8 d) -{ - switch (p & 0xff) - { - case 0x00: - BurnYM2203Write(0, 0, d); - return; - - case 0x01: - BurnYM2203Write(0, 1, d); - return; - - case 0x02: - adpcm_byte = d; - return; - } -} - -UINT8 __fastcall ashnojoe_sound_read_port(UINT16 p) -{ - switch (p & 0xff) - { - case 0x00: - return BurnYM2203Read(0, 0); - - case 0x01: - return BurnYM2203Read(0, 1); - - case 0x04: - *soundstatus = 0; - return *soundlatch; - - case 0x06: - return *soundstatus; - } - - return 0; -} - -void DrvYM2203WritePortA(UINT32, UINT32 d) -{ - MSM5205ResetWrite(0, !(d & 0x01)); -} - -void DrvYM2203WritePortB(UINT32, UINT32 d) -{ - INT32 bank = (d & 0x0f) * 0x8000; - - ZetMapArea(0x8000, 0xffff, 0, DrvZ80Banks + bank); - ZetMapArea(0x8000, 0xffff, 2, DrvZ80Banks + bank); -} - -inline static void DrvIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(double)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000.0; -} - -static void ashnojoe_vclk_cb() -{ - if (MSM5205_vclk_toggle == 0) - { - MSM5205DataWrite(0, adpcm_byte >> 4); - } - else - { - MSM5205DataWrite(0, adpcm_byte & 0xf); - ZetNmi(); - } - - MSM5205_vclk_toggle ^= 1; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - - BurnYM2203Reset(); - MSM5205Reset(); - - ZetClose(); - - adpcm_byte = 0; - MSM5205_vclk_toggle = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x100000; - DrvZ80ROM = Next; Next += 0x010000; - DrvZ80Banks = Next; Next += 0x080000; - - DrvGfxROM0 = Next; Next += 0x040000; - DrvGfxROM1 = Next; Next += 0x040000; - DrvGfxROM2 = Next; Next += 0x040000; - DrvGfxROM3 = Next; Next += 0x200000; - DrvGfxROM4 = Next; Next += 0x600000; - - DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); - - AllRam = Next; - - DrvPfRAM = Next; Next += 0x009000; - Drv68KRAM = Next; Next += 0x004000; - DrvPalRAM = Next; Next += 0x001000; - - DrvZ80RAM = Next; Next += 0x002000; - - soundlatch = Next; Next += 0x000001; - soundstatus = Next; Next += 0x000001; - - tilemap_reg = Next; Next += 0x000001; - - scrollx = (UINT16*)Next; Next += 0x000008 * sizeof(UINT16); - scrolly = (UINT16*)Next; Next += 0x000008 * sizeof(UINT16); - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void DrvGfxExpand(UINT8 *gfx, INT32 len, INT32 bs) //0,1,2 -8x8, 3,4 16x16 -{ - if (bs) BurnByteswap(gfx, len); - - for (INT32 i = len-1; i >= 0; i--) { - gfx[i * 2 + 1] = gfx[i] & 0x0f; - gfx[i * 2 + 0] = gfx[i] >> 4; - } -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x080000, 2, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM + 0x000000, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x010000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x010000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x000000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x010000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM3 + 0x000000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM3 + 0x080000, 11, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM4 + 0x000000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM4 + 0x080000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM4 + 0x100000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM4 + 0x180000, 15, 1)) return 1; - if (BurnLoadRom(DrvGfxROM4 + 0x200000, 16, 1)) return 1; - if (BurnLoadRom(DrvGfxROM4 + 0x280000, 17, 1)) return 1; - - if (BurnLoadRom(DrvZ80Banks + 0x000000, 18, 1)) return 1; - - DrvGfxExpand(DrvGfxROM0, 0x020000, 0); - DrvGfxExpand(DrvGfxROM1, 0x020000, 0); - DrvGfxExpand(DrvGfxROM2, 0x020000, 0); - DrvGfxExpand(DrvGfxROM3, 0x100000, 1); - DrvGfxExpand(DrvGfxROM4, 0x300000, 1); - } - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(DrvPfRAM, 0x040000, 0x048fff, SM_RAM); - SekMapMemory(DrvPalRAM, 0x049000, 0x049fff, SM_RAM); - SekMapMemory(Drv68KRAM, 0x04c000, 0x04ffff, SM_RAM); - SekMapMemory(Drv68KROM + 0x080000, 0x080000, 0x0bffff, SM_ROM); - SekSetWriteWordHandler(0, ashnojoe_write_word); - SekSetWriteByteHandler(0, ashnojoe_write_byte); - SekSetReadWordHandler(0, ashnojoe_read_word); - SekSetReadByteHandler(0, ashnojoe_read_byte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM); - ZetMapArea(0x6000, 0x7fff, 0, DrvZ80RAM); - ZetMapArea(0x6000, 0x7fff, 1, DrvZ80RAM); - ZetMapArea(0x6000, 0x7fff, 2, DrvZ80RAM); - ZetSetOutHandler(ashnojoe_sound_write_port); - ZetSetInHandler(ashnojoe_sound_read_port); - ZetMemEnd(); - - MSM5205Init(0, DrvSynchroniseStream, 384000, ashnojoe_vclk_cb, MSM5205_S48_4B, 1); - MSM5205SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - BurnYM2203Init(1, 4000000, &DrvIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnYM2203SetPorts(0, NULL, NULL, &DrvYM2203WritePortA, &DrvYM2203WritePortB); - BurnTimerAttachZet(4000000); - BurnYM2203SetAllRoutes(0, 0.10, BURN_SND_ROUTE_BOTH); - - ZetClose(); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - SekExit(); - ZetExit(); - - BurnYM2203Exit(); - MSM5205Exit(); - - BurnFree(AllMem); - - return 0; -} - -static inline void DrvRecalcPalette() -{ - UINT8 r,g,b; - UINT16 *p = (UINT16*)DrvPalRAM; - - for (INT32 i = 0; i < 0x1000/2; i++) { - INT32 d = p[i]; - - r = (d >> 10) & 0x1f; - g = (d >> 5) & 0x1f; - b = (d >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static void draw_16x16_layer(UINT8 *ram, UINT8 *gfx, INT32 color_off, INT32 scroll_off, INT32 mask, INT32 transparent) -{ - INT32 xscroll = (scrollx[scroll_off] + 112) & 0x1ff; - INT32 yscroll = (scrolly[scroll_off] + 24) & 0x1ff; - - UINT16 *vram = (UINT16*)ram; - - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 4; - INT32 sy = (offs >> 5) << 4; - - sx -= xscroll; - if (sx < -15) sx += 512; - sy -= yscroll; - if (sy < -15) sy += 512; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 code = vram[offs * 2 + 0] & mask; - INT32 color = ((vram[offs * 2 + 1] >> 8) & 0x1f) + color_off; - - if (flipscreen) { - if (transparent) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, 272 - sx, 192 - sy, color, 4, 15, 0, gfx); - } else { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, 272 - sx, 192 - sy, color, 4, 0, gfx); - } - } else { - if (transparent) { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, gfx); - } - } - } -} - -static void draw_8x8_layer(UINT8 *ram, UINT8 *gfx, INT32 color_off, INT32 scroll_off, INT32 high) -{ - INT32 xscroll = (scrollx[scroll_off] + 112) & 0x1ff; - INT32 yscroll = (scrolly[scroll_off] + 24) & (high ? 0x1ff : 0x0ff); - - UINT16 *vram = (UINT16*)ram; - - for (INT32 offs = 0; offs < 64 * (32 << high); offs++) - { - INT32 sx = (offs & 0x3f) << 3; - INT32 sy = (offs >> 6) << 3; - - sx -= xscroll; - if (sx < -7) sx += 512; - sy -= yscroll; - if (sy < -7) sy += 256 << high; - - if (sx >= nScreenWidth || sy >= nScreenHeight) continue; - - INT32 code = vram[offs] & 0x0fff; - INT32 color = (vram[offs] >> 12) + color_off; - - if (flipscreen) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, 280 - sx, 200 - sy, color, 4, 15, 0, gfx); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); - } - } -} - -static INT32 DrvDraw() -{ - DrvRecalcPalette(); - - flipscreen = *tilemap_reg & 0x01; - - INT32 backlayer = (*tilemap_reg & 0x02) ? 0x7000 : 0x6000; - - if (nSpriteEnable & 0x01) draw_16x16_layer(DrvPfRAM + backlayer, DrvGfxROM3, 0x70, 4, 0x1fff, 0); - - if (nSpriteEnable & 0x02) draw_8x8_layer(DrvPfRAM + 0x2000, DrvGfxROM1, 0x60, 3, 1); - - if (nSpriteEnable & 0x04) draw_16x16_layer(DrvPfRAM + 0x5000, DrvGfxROM4, 0x40, 2, 0x7fff, 1); - - if (nSpriteEnable & 0x08) draw_16x16_layer(DrvPfRAM + 0x4000, DrvGfxROM4, 0x20, 1, 0x7fff, 1); - - if (nSpriteEnable & 0x10) draw_8x8_layer(DrvPfRAM + 0x0000, DrvGfxROM0, 0x10, 0, 1); - - if (nSpriteEnable & 0x20) draw_8x8_layer(DrvPfRAM + 0x8000, DrvGfxROM2, 0x00, 5, 1); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - memset (DrvInputs, 0, 2 * sizeof(INT16)); - - for (INT32 i = 0; i < 16; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - - } - - INT32 nInterleave = MSM5205CalcInterleave(0, 4000000); - INT32 nCyclesTotal[2] = { 8000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - INT32 nNext[2] = { 0, 0 }; - - SekOpen(0); - ZetOpen(0); - - for (INT32 i = 0; i < nInterleave; i++) { - nNext[0] += nCyclesTotal[0] / nInterleave; - - nCyclesDone[0] += SekRun(nNext[0] - nCyclesDone[0]); - if (i == (nInterleave - 1)) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); - - nNext[1] += nCyclesTotal[1] / nInterleave; - BurnTimerUpdate(nNext[1]); - MSM5205Update(); - nCyclesDone[1] += nNext[1]; - } - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029698; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd-AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - MSM5205Scan(nAction, pnMin); - } - - return 0; -} - - -// Success Joe (World) - -static struct BurnRomInfo scessjoeRomDesc[] = { - { "5.4q", 0x10000, 0xc805f9e7, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "6.4s", 0x10000, 0xeda7a537, 1 | BRF_PRG | BRF_ESS }, // 1 - { "sj201-nw.6m", 0x40000, 0x5a64ca42, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "9.8q", 0x08000, 0x8767e212, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 Code - - { "8.5e", 0x10000, 0x9bcb160e, 3 | BRF_GRA }, // 4 Character Tiles - { "7.5c", 0x10000, 0xb250c69d, 3 | BRF_GRA }, // 5 - - { "4.4e", 0x10000, 0xaa6336d3, 4 | BRF_GRA }, // 6 Character Tiles - { "3.4c", 0x10000, 0x7e2d86b5, 4 | BRF_GRA }, // 7 - - { "2.3m", 0x10000, 0xc3254938, 5 | BRF_GRA }, // 8 Character Tiles - { "1.1m", 0x10000, 0x5d16a6fa, 5 | BRF_GRA }, // 9 - - { "sj402-nw.8e", 0x80000, 0xb6d33d06, 6 | BRF_GRA }, // 10 Background Tiles - { "sj403-nw.7e", 0x80000, 0x07143f56, 6 | BRF_GRA }, // 11 - - { "sj404-nw.7a", 0x80000, 0x8f134128, 7 | BRF_GRA }, // 12 Foreground Tiles - { "sj405-nw.7c", 0x80000, 0x6fd81699, 7 | BRF_GRA }, // 13 - { "sj406-nw.7d", 0x80000, 0x634e33e6, 7 | BRF_GRA }, // 14 - { "sj407-nw.7f", 0x80000, 0x5c66ff06, 7 | BRF_GRA }, // 15 - { "sj408-nw.7g", 0x80000, 0x6a3b1ea1, 7 | BRF_GRA }, // 16 - { "sj409-nw.7j", 0x80000, 0xd8764213, 7 | BRF_GRA }, // 17 - - { "sj401-nw.10r", 0x80000, 0x25dfab59, 8 | BRF_PRG | BRF_ESS }, // 18 Z80 Banks -}; - -STD_ROM_PICK(scessjoe) -STD_ROM_FN(scessjoe) - -struct BurnDriver BurnDrvScessjoe = { - "scessjoe", NULL, NULL, NULL, "1990", - "Success Joe (World)\0", "Incomplete sound", "WAVE / Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, scessjoeRomInfo, scessjoeRomName, NULL, NULL, AshnojoeInputInfo, AshnojoeDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x800, - 288, 208, 4, 3 -}; - - -// Ashita no Joe (Japan) - -static struct BurnRomInfo ashnojoeRomDesc[] = { - { "5.bin", 0x10000, 0xc61e1569, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "6.bin", 0x10000, 0xc0a16338, 1 | BRF_PRG | BRF_ESS }, // 1 - { "sj201-nw.6m", 0x40000, 0x5a64ca42, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "9.8q", 0x08000, 0x8767e212, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 Code - - { "8.5e", 0x10000, 0x9bcb160e, 3 | BRF_GRA }, // 4 Character Tiles - { "7.bin", 0x10000, 0x7e1efc42, 3 | BRF_GRA }, // 5 - - { "4.4e", 0x10000, 0xaa6336d3, 4 | BRF_GRA }, // 6 Character Tiles - { "3.4c", 0x10000, 0x7e2d86b5, 4 | BRF_GRA }, // 7 - - { "2.3m", 0x10000, 0xc3254938, 5 | BRF_GRA }, // 8 Character Tiles - { "1.bin", 0x10000, 0x1bf585f0, 5 | BRF_GRA }, // 9 - - { "sj402-nw.8e", 0x80000, 0xb6d33d06, 6 | BRF_GRA }, // 10 Background Tiles - { "sj403-nw.7e", 0x80000, 0x07143f56, 6 | BRF_GRA }, // 11 - - { "sj404-nw.7a", 0x80000, 0x8f134128, 7 | BRF_GRA }, // 12 Foreground Tiles - { "sj405-nw.7c", 0x80000, 0x6fd81699, 7 | BRF_GRA }, // 13 - { "sj406-nw.7d", 0x80000, 0x634e33e6, 7 | BRF_GRA }, // 14 - { "sj407-nw.7f", 0x80000, 0x5c66ff06, 7 | BRF_GRA }, // 15 - { "sj408-nw.7g", 0x80000, 0x6a3b1ea1, 7 | BRF_GRA }, // 16 - { "sj409-nw.7j", 0x80000, 0xd8764213, 7 | BRF_GRA }, // 17 - - { "sj401-nw.10r", 0x80000, 0x25dfab59, 8 | BRF_PRG | BRF_ESS }, // 18 Z80 Banks -}; - -STD_ROM_PICK(ashnojoe) -STD_ROM_FN(ashnojoe) - -struct BurnDriver BurnDrvAshnojoe = { - "ashnojoe", "scessjoe", NULL, NULL, "1990", - "Ashita no Joe (Japan)\0", "Incomplete sound", "WAVE / Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, ashnojoeRomInfo, ashnojoeRomName, NULL, NULL, AshnojoeInputInfo, AshnojoeDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x800, - 288, 208, 4, 3 -}; +// FB Alpha Ashita No Joe / Success Joe driver module +// Based on MAME driver by driver by David Haywood and Pierpaolo Prazzoli + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2203.h" +#include "msm5205.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvGfxROM3; +static UINT8 *DrvGfxROM4; +static UINT8 *DrvZ80Banks; +static UINT8 *DrvPfRAM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvPalRAM; + +static UINT32 *DrvPalette; + +static UINT8 *soundlatch; +static UINT8 *soundstatus; +static UINT8 *tilemap_reg; + +static UINT16 *scrollx; +static UINT16 *scrolly; + +static INT32 flipscreen; + +static UINT8 adpcm_byte = 0; +static UINT8 MSM5205_vclk_toggle = 0; + +static UINT8 DrvJoy1[16]; +static UINT8 DrvJoy2[16]; +static UINT8 DrvDips[2]; +static UINT8 DrvReset; +static UINT16 DrvInputs[2]; + +static struct BurnInputInfo AshnojoeInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 11, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 13, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 12, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 14, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 8, "service" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Ashnojoe) + +static struct BurnDIPInfo AshnojoeDIPList[]= +{ + {0x12, 0xff, 0xff, 0x00, NULL }, + {0x13, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x12, 0x01, 0x01, 0x00, "Upright" }, + {0x12, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x12, 0x01, 0x02, 0x00, "Off" }, + {0x12, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x12, 0x01, 0x04, 0x00, "Off" }, + {0x12, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x12, 0x01, 0x08, 0x08, "Off" }, + {0x12, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x12, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x12, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, + {0x12, 0x01, 0x30, 0x30, "2 Coins 3 Credits" }, + {0x12, 0x01, 0x30, 0x10, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x13, 0x01, 0x03, 0x01, "Easy" }, + {0x13, 0x01, 0x03, 0x00, "Normal" }, + {0x13, 0x01, 0x03, 0x02, "Medium" }, + {0x13, 0x01, 0x03, 0x03, "Hard" }, + + {0 , 0xfe, 0 , 2, "Number of controller" }, + {0x13, 0x01, 0x04, 0x00, "2" }, + {0x13, 0x01, 0x04, 0x04, "1" }, +}; + +STDDIPINFO(Ashnojoe) + +void __fastcall ashnojoe_write_byte(UINT32 a, UINT8 d) +{ + bprintf (0, _T("%5.5x, %2.2x wb\n"), a, d); +} + +void __fastcall ashnojoe_write_word(UINT32 a, UINT16 d) +{ + switch (a) + { + case 0x4a006: + *tilemap_reg = d & 0xff; + return; + + case 0x4a008: + *soundlatch = d & 0xff; + *soundstatus = 1; + return; + + case 0x4a010: + case 0x4a012: + case 0x4a014: + case 0x4a016: + case 0x4a018: + scrollx[(a & 0x0f) / 2] = d; + return; + + case 0x4a020: + case 0x4a022: + case 0x4a024: + case 0x4a026: + case 0x4a028: + scrolly[(a & 0x0f) / 2] = d; + return; + } +} + +UINT8 __fastcall ashnojoe_read_byte(UINT32 a) +{ + bprintf (0, _T("%5.5x, rb\n"), a); + + return 0; +} + +UINT16 __fastcall ashnojoe_read_word(UINT32 a) +{ + switch (a) + { + case 0x4a000: + return DrvInputs[0]; + + case 0x4a002: + return DrvInputs[1]; + + case 0x4a004: + return ((DrvDips[1] << 8) | (DrvDips[0])); + + case 0x4a00a: + return 0; // debug? 1 kills sound + } + + return 0; +} + +void __fastcall ashnojoe_sound_write_port(UINT16 p, UINT8 d) +{ + switch (p & 0xff) + { + case 0x00: + BurnYM2203Write(0, 0, d); + return; + + case 0x01: + BurnYM2203Write(0, 1, d); + return; + + case 0x02: + adpcm_byte = d; + return; + } +} + +UINT8 __fastcall ashnojoe_sound_read_port(UINT16 p) +{ + switch (p & 0xff) + { + case 0x00: + return BurnYM2203Read(0, 0); + + case 0x01: + return BurnYM2203Read(0, 1); + + case 0x04: + *soundstatus = 0; + return *soundlatch; + + case 0x06: + return *soundstatus; + } + + return 0; +} + +void DrvYM2203WritePortA(UINT32, UINT32 d) +{ + MSM5205ResetWrite(0, !(d & 0x01)); +} + +void DrvYM2203WritePortB(UINT32, UINT32 d) +{ + INT32 bank = (d & 0x0f) * 0x8000; + + ZetMapArea(0x8000, 0xffff, 0, DrvZ80Banks + bank); + ZetMapArea(0x8000, 0xffff, 2, DrvZ80Banks + bank); +} + +inline static void DrvIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(double)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000.0; +} + +static void ashnojoe_vclk_cb() +{ + if (MSM5205_vclk_toggle == 0) + { + MSM5205DataWrite(0, adpcm_byte >> 4); + } + else + { + MSM5205DataWrite(0, adpcm_byte & 0xf); + ZetNmi(); + } + + MSM5205_vclk_toggle ^= 1; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + + BurnYM2203Reset(); + MSM5205Reset(); + + ZetClose(); + + adpcm_byte = 0; + MSM5205_vclk_toggle = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x100000; + DrvZ80ROM = Next; Next += 0x010000; + DrvZ80Banks = Next; Next += 0x080000; + + DrvGfxROM0 = Next; Next += 0x040000; + DrvGfxROM1 = Next; Next += 0x040000; + DrvGfxROM2 = Next; Next += 0x040000; + DrvGfxROM3 = Next; Next += 0x200000; + DrvGfxROM4 = Next; Next += 0x600000; + + DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32); + + AllRam = Next; + + DrvPfRAM = Next; Next += 0x009000; + Drv68KRAM = Next; Next += 0x004000; + DrvPalRAM = Next; Next += 0x001000; + + DrvZ80RAM = Next; Next += 0x002000; + + soundlatch = Next; Next += 0x000001; + soundstatus = Next; Next += 0x000001; + + tilemap_reg = Next; Next += 0x000001; + + scrollx = (UINT16*)Next; Next += 0x000008 * sizeof(UINT16); + scrolly = (UINT16*)Next; Next += 0x000008 * sizeof(UINT16); + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void DrvGfxExpand(UINT8 *gfx, INT32 len, INT32 bs) //0,1,2 -8x8, 3,4 16x16 +{ + if (bs) BurnByteswap(gfx, len); + + for (INT32 i = len-1; i >= 0; i--) { + gfx[i * 2 + 1] = gfx[i] & 0x0f; + gfx[i * 2 + 0] = gfx[i] >> 4; + } +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x080000, 2, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM + 0x000000, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x010000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x010000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x000000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x010000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM3 + 0x000000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM3 + 0x080000, 11, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM4 + 0x000000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM4 + 0x080000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM4 + 0x100000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM4 + 0x180000, 15, 1)) return 1; + if (BurnLoadRom(DrvGfxROM4 + 0x200000, 16, 1)) return 1; + if (BurnLoadRom(DrvGfxROM4 + 0x280000, 17, 1)) return 1; + + if (BurnLoadRom(DrvZ80Banks + 0x000000, 18, 1)) return 1; + + DrvGfxExpand(DrvGfxROM0, 0x020000, 0); + DrvGfxExpand(DrvGfxROM1, 0x020000, 0); + DrvGfxExpand(DrvGfxROM2, 0x020000, 0); + DrvGfxExpand(DrvGfxROM3, 0x100000, 1); + DrvGfxExpand(DrvGfxROM4, 0x300000, 1); + } + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(DrvPfRAM, 0x040000, 0x048fff, SM_RAM); + SekMapMemory(DrvPalRAM, 0x049000, 0x049fff, SM_RAM); + SekMapMemory(Drv68KRAM, 0x04c000, 0x04ffff, SM_RAM); + SekMapMemory(Drv68KROM + 0x080000, 0x080000, 0x0bffff, SM_ROM); + SekSetWriteWordHandler(0, ashnojoe_write_word); + SekSetWriteByteHandler(0, ashnojoe_write_byte); + SekSetReadWordHandler(0, ashnojoe_read_word); + SekSetReadByteHandler(0, ashnojoe_read_byte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x5fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x5fff, 2, DrvZ80ROM); + ZetMapArea(0x6000, 0x7fff, 0, DrvZ80RAM); + ZetMapArea(0x6000, 0x7fff, 1, DrvZ80RAM); + ZetMapArea(0x6000, 0x7fff, 2, DrvZ80RAM); + ZetSetOutHandler(ashnojoe_sound_write_port); + ZetSetInHandler(ashnojoe_sound_read_port); + + MSM5205Init(0, DrvSynchroniseStream, 384000, ashnojoe_vclk_cb, MSM5205_S48_4B, 1); + MSM5205SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + BurnYM2203Init(1, 4000000, &DrvIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnYM2203SetPorts(0, NULL, NULL, &DrvYM2203WritePortA, &DrvYM2203WritePortB); + BurnTimerAttachZet(4000000); + BurnYM2203SetAllRoutes(0, 0.10, BURN_SND_ROUTE_BOTH); + + ZetClose(); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + SekExit(); + ZetExit(); + + BurnYM2203Exit(); + MSM5205Exit(); + + BurnFree(AllMem); + + return 0; +} + +static inline void DrvRecalcPalette() +{ + UINT8 r,g,b; + UINT16 *p = (UINT16*)DrvPalRAM; + + for (INT32 i = 0; i < 0x1000/2; i++) { + INT32 d = p[i]; + + r = (d >> 10) & 0x1f; + g = (d >> 5) & 0x1f; + b = (d >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static void draw_16x16_layer(UINT8 *ram, UINT8 *gfx, INT32 color_off, INT32 scroll_off, INT32 mask, INT32 transparent) +{ + INT32 xscroll = (scrollx[scroll_off] + 112) & 0x1ff; + INT32 yscroll = (scrolly[scroll_off] + 24) & 0x1ff; + + UINT16 *vram = (UINT16*)ram; + + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 4; + INT32 sy = (offs >> 5) << 4; + + sx -= xscroll; + if (sx < -15) sx += 512; + sy -= yscroll; + if (sy < -15) sy += 512; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 code = vram[offs * 2 + 0] & mask; + INT32 color = ((vram[offs * 2 + 1] >> 8) & 0x1f) + color_off; + + if (flipscreen) { + if (transparent) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, 272 - sx, 192 - sy, color, 4, 15, 0, gfx); + } else { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, 272 - sx, 192 - sy, color, 4, 0, gfx); + } + } else { + if (transparent) { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, gfx); + } + } + } +} + +static void draw_8x8_layer(UINT8 *ram, UINT8 *gfx, INT32 color_off, INT32 scroll_off, INT32 high) +{ + INT32 xscroll = (scrollx[scroll_off] + 112) & 0x1ff; + INT32 yscroll = (scrolly[scroll_off] + 24) & (high ? 0x1ff : 0x0ff); + + UINT16 *vram = (UINT16*)ram; + + for (INT32 offs = 0; offs < 64 * (32 << high); offs++) + { + INT32 sx = (offs & 0x3f) << 3; + INT32 sy = (offs >> 6) << 3; + + sx -= xscroll; + if (sx < -7) sx += 512; + sy -= yscroll; + if (sy < -7) sy += 256 << high; + + if (sx >= nScreenWidth || sy >= nScreenHeight) continue; + + INT32 code = vram[offs] & 0x0fff; + INT32 color = (vram[offs] >> 12) + color_off; + + if (flipscreen) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, 280 - sx, 200 - sy, color, 4, 15, 0, gfx); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, 0, gfx); + } + } +} + +static INT32 DrvDraw() +{ + DrvRecalcPalette(); + + flipscreen = *tilemap_reg & 0x01; + + INT32 backlayer = (*tilemap_reg & 0x02) ? 0x7000 : 0x6000; + + if (nSpriteEnable & 0x01) draw_16x16_layer(DrvPfRAM + backlayer, DrvGfxROM3, 0x70, 4, 0x1fff, 0); + + if (nSpriteEnable & 0x02) draw_8x8_layer(DrvPfRAM + 0x2000, DrvGfxROM1, 0x60, 3, 1); + + if (nSpriteEnable & 0x04) draw_16x16_layer(DrvPfRAM + 0x5000, DrvGfxROM4, 0x40, 2, 0x7fff, 1); + + if (nSpriteEnable & 0x08) draw_16x16_layer(DrvPfRAM + 0x4000, DrvGfxROM4, 0x20, 1, 0x7fff, 1); + + if (nSpriteEnable & 0x10) draw_8x8_layer(DrvPfRAM + 0x0000, DrvGfxROM0, 0x10, 0, 1); + + if (nSpriteEnable & 0x20) draw_8x8_layer(DrvPfRAM + 0x8000, DrvGfxROM2, 0x00, 5, 1); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + memset (DrvInputs, 0, 2 * sizeof(INT16)); + + for (INT32 i = 0; i < 16; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + + } + + INT32 nInterleave = MSM5205CalcInterleave(0, 4000000); + INT32 nCyclesTotal[2] = { 8000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + INT32 nNext[2] = { 0, 0 }; + + SekOpen(0); + ZetOpen(0); + + for (INT32 i = 0; i < nInterleave; i++) { + nNext[0] += nCyclesTotal[0] / nInterleave; + + nCyclesDone[0] += SekRun(nNext[0] - nCyclesDone[0]); + if (i == (nInterleave - 1)) SekSetIRQLine(1, SEK_IRQSTATUS_AUTO); + + nNext[1] += nCyclesTotal[1] / nInterleave; + BurnTimerUpdate(nNext[1]); + MSM5205Update(); + nCyclesDone[1] += nNext[1]; + } + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029698; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd-AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + MSM5205Scan(nAction, pnMin); + } + + return 0; +} + + +// Success Joe (World) + +static struct BurnRomInfo scessjoeRomDesc[] = { + { "5.4q", 0x10000, 0xc805f9e7, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "6.4s", 0x10000, 0xeda7a537, 1 | BRF_PRG | BRF_ESS }, // 1 + { "sj201-nw.6m", 0x40000, 0x5a64ca42, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "9.8q", 0x08000, 0x8767e212, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 Code + + { "8.5e", 0x10000, 0x9bcb160e, 3 | BRF_GRA }, // 4 Character Tiles + { "7.5c", 0x10000, 0xb250c69d, 3 | BRF_GRA }, // 5 + + { "4.4e", 0x10000, 0xaa6336d3, 4 | BRF_GRA }, // 6 Character Tiles + { "3.4c", 0x10000, 0x7e2d86b5, 4 | BRF_GRA }, // 7 + + { "2.3m", 0x10000, 0xc3254938, 5 | BRF_GRA }, // 8 Character Tiles + { "1.1m", 0x10000, 0x5d16a6fa, 5 | BRF_GRA }, // 9 + + { "sj402-nw.8e", 0x80000, 0xb6d33d06, 6 | BRF_GRA }, // 10 Background Tiles + { "sj403-nw.7e", 0x80000, 0x07143f56, 6 | BRF_GRA }, // 11 + + { "sj404-nw.7a", 0x80000, 0x8f134128, 7 | BRF_GRA }, // 12 Foreground Tiles + { "sj405-nw.7c", 0x80000, 0x6fd81699, 7 | BRF_GRA }, // 13 + { "sj406-nw.7d", 0x80000, 0x634e33e6, 7 | BRF_GRA }, // 14 + { "sj407-nw.7f", 0x80000, 0x5c66ff06, 7 | BRF_GRA }, // 15 + { "sj408-nw.7g", 0x80000, 0x6a3b1ea1, 7 | BRF_GRA }, // 16 + { "sj409-nw.7j", 0x80000, 0xd8764213, 7 | BRF_GRA }, // 17 + + { "sj401-nw.10r", 0x80000, 0x25dfab59, 8 | BRF_PRG | BRF_ESS }, // 18 Z80 Banks +}; + +STD_ROM_PICK(scessjoe) +STD_ROM_FN(scessjoe) + +struct BurnDriver BurnDrvScessjoe = { + "scessjoe", NULL, NULL, NULL, "1990", + "Success Joe (World)\0", "Incomplete sound", "WAVE / Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, scessjoeRomInfo, scessjoeRomName, NULL, NULL, AshnojoeInputInfo, AshnojoeDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x800, + 288, 208, 4, 3 +}; + + +// Ashita no Joe (Japan) + +static struct BurnRomInfo ashnojoeRomDesc[] = { + { "5.bin", 0x10000, 0xc61e1569, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "6.bin", 0x10000, 0xc0a16338, 1 | BRF_PRG | BRF_ESS }, // 1 + { "sj201-nw.6m", 0x40000, 0x5a64ca42, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "9.8q", 0x08000, 0x8767e212, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 Code + + { "8.5e", 0x10000, 0x9bcb160e, 3 | BRF_GRA }, // 4 Character Tiles + { "7.bin", 0x10000, 0x7e1efc42, 3 | BRF_GRA }, // 5 + + { "4.4e", 0x10000, 0xaa6336d3, 4 | BRF_GRA }, // 6 Character Tiles + { "3.4c", 0x10000, 0x7e2d86b5, 4 | BRF_GRA }, // 7 + + { "2.3m", 0x10000, 0xc3254938, 5 | BRF_GRA }, // 8 Character Tiles + { "1.bin", 0x10000, 0x1bf585f0, 5 | BRF_GRA }, // 9 + + { "sj402-nw.8e", 0x80000, 0xb6d33d06, 6 | BRF_GRA }, // 10 Background Tiles + { "sj403-nw.7e", 0x80000, 0x07143f56, 6 | BRF_GRA }, // 11 + + { "sj404-nw.7a", 0x80000, 0x8f134128, 7 | BRF_GRA }, // 12 Foreground Tiles + { "sj405-nw.7c", 0x80000, 0x6fd81699, 7 | BRF_GRA }, // 13 + { "sj406-nw.7d", 0x80000, 0x634e33e6, 7 | BRF_GRA }, // 14 + { "sj407-nw.7f", 0x80000, 0x5c66ff06, 7 | BRF_GRA }, // 15 + { "sj408-nw.7g", 0x80000, 0x6a3b1ea1, 7 | BRF_GRA }, // 16 + { "sj409-nw.7j", 0x80000, 0xd8764213, 7 | BRF_GRA }, // 17 + + { "sj401-nw.10r", 0x80000, 0x25dfab59, 8 | BRF_PRG | BRF_ESS }, // 18 Z80 Banks +}; + +STD_ROM_PICK(ashnojoe) +STD_ROM_FN(ashnojoe) + +struct BurnDriver BurnDrvAshnojoe = { + "ashnojoe", "scessjoe", NULL, NULL, "1990", + "Ashita no Joe (Japan)\0", "Incomplete sound", "WAVE / Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, ashnojoeRomInfo, ashnojoeRomName, NULL, NULL, AshnojoeInputInfo, AshnojoeDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x800, + 288, 208, 4, 3 +}; diff --git a/src/burn/drv/taito/d_asuka.cpp b/src/burn/drv/taito/d_asuka.cpp index 3aeb47011..ea2e71aba 100644 --- a/src/burn/drv/taito/d_asuka.cpp +++ b/src/burn/drv/taito/d_asuka.cpp @@ -1,2159 +1,2157 @@ -// FB Alpha Asuka & Asuka driver module -// Based on MAME driver by David Graves, Brian Troha, and - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "burn_ym2151.h" -#include "burn_ym2610.h" -#include "msm5205.h" -#include "taito_ic.h" -#include "taito.h" - -static UINT8 TaitoInputConfig; -static INT32 AsukaADPCMPos; -static INT32 AsukaADPCMData; - -static struct BurnInputInfo CadashInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 7, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 6, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort1 + 7, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort1 + 6, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, -}; - -STDINPUTINFO(Cadash) - -static struct BurnInputInfo AsukaInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset"}, - {"Service", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, -}; - -STDINPUTINFO(Asuka) - -static struct BurnInputInfo BonzeadvInputList[] = { - {"P1 Coin", BIT_DIGITAL, TaitoInputPort1 + 0, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TaitoInputPort0 + 6, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TaitoInputPort2 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TaitoInputPort2 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TaitoInputPort2 + 4, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TaitoInputPort2 + 5, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TaitoInputPort2 + 6, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TaitoInputPort2 + 7, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, TaitoInputPort1 + 1, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TaitoInputPort0 + 5, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TaitoInputPort3 + 1, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TaitoInputPort3 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TaitoInputPort3 + 3, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TaitoInputPort3 + 4, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TaitoInputPort3 + 5, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TaitoInputPort3 + 6, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, - {"Service", BIT_DIGITAL, TaitoInputPort0 + 7, "service" }, - {"Tilt", BIT_DIGITAL, TaitoInputPort2 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TaitoDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TaitoDip + 1, "dip" }, -}; - -STDINPUTINFO(Bonzeadv) - -static struct BurnDIPInfo CadashDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Starting Time" }, - {0x14, 0x01, 0x0c, 0x00, "5:00" }, - {0x14, 0x01, 0x0c, 0x04, "6:00" }, - {0x14, 0x01, 0x0c, 0x0c, "7:00" }, - {0x14, 0x01, 0x0c, 0x08, "8:00" }, - - {0 , 0xfe, 0 , 4, "Add Time" }, - {0x14, 0x01, 0x30, 0x00, "Default - 2:00" }, - {0x14, 0x01, 0x30, 0x10, "Default - 1:00" }, - {0x14, 0x01, 0x30, 0x30, "Default" }, - {0x14, 0x01, 0x30, 0x20, "Default + 1:00" }, - - {0 , 0xfe, 0 , 3, "Communication Mode" }, - {0x14, 0x01, 0xc0, 0xc0, "Stand alone" }, - {0x14, 0x01, 0xc0, 0x80, "Master" }, - {0x14, 0x01, 0xc0, 0x00, "Slave" }, -}; - -STDDIPINFO(Cadash) - -static struct BurnDIPInfo CadashjDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coins 2 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "2 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 3 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Starting Time" }, - {0x14, 0x01, 0x0c, 0x00, "5:00" }, - {0x14, 0x01, 0x0c, 0x04, "6:00" }, - {0x14, 0x01, 0x0c, 0x0c, "7:00" }, - {0x14, 0x01, 0x0c, 0x08, "8:00" }, - - {0 , 0xfe, 0 , 4, "Add Time" }, - {0x14, 0x01, 0x30, 0x00, "Default - 2:00" }, - {0x14, 0x01, 0x30, 0x10, "Default - 1:00" }, - {0x14, 0x01, 0x30, 0x30, "Default" }, - {0x14, 0x01, 0x30, 0x20, "Default + 1:00" }, - - {0 , 0xfe, 0 , 3, "Communication Mode" }, - {0x14, 0x01, 0xc0, 0xc0, "Stand alone" }, - {0x14, 0x01, 0xc0, 0x80, "Master" }, - {0x14, 0x01, 0xc0, 0x00, "Slave" }, -}; - -STDDIPINFO(Cadashj) - -static struct BurnDIPInfo CadashuDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Price to Continue" }, - {0x13, 0x01, 0xc0, 0xc0, "Same as Start" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "3 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Starting Time" }, - {0x14, 0x01, 0x0c, 0x00, "5:00" }, - {0x14, 0x01, 0x0c, 0x04, "6:00" }, - {0x14, 0x01, 0x0c, 0x0c, "7:00" }, - {0x14, 0x01, 0x0c, 0x08, "8:00" }, - - {0 , 0xfe, 0 , 4, "Add Time (after clear)"}, - {0x14, 0x01, 0x30, 0x00, "Default - 2:00" }, - {0x14, 0x01, 0x30, 0x10, "Default - 1:00" }, - {0x14, 0x01, 0x30, 0x30, "Default" }, - {0x14, 0x01, 0x30, 0x20, "Default + 1:00" }, - - {0 , 0xfe, 0 , 3, "Communication Mode" }, - {0x14, 0x01, 0xc0, 0xc0, "Stand alone" }, - {0x14, 0x01, 0xc0, 0x80, "Master" }, - {0x14, 0x01, 0xc0, 0x00, "Slave" }, -}; - -STDDIPINFO(Cadashu) - - -static struct BurnDIPInfo EtoDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0x03, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Eto) - -static struct BurnDIPInfo AsukaDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xbf, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Points" }, - {0x14, 0x01, 0x0c, 0x0c, "500" }, - {0x14, 0x01, 0x0c, 0x08, "1500" }, - {0x14, 0x01, 0x0c, 0x04, "2000" }, - {0x14, 0x01, 0x0c, 0x00, "2500" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x10, "1" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Allow Continue" }, - {0x14, 0x01, 0xc0, 0x00, "No" }, - {0x14, 0x01, 0xc0, 0xc0, "Up To Level 2" }, - {0x14, 0x01, 0xc0, 0x80, "Up To Level 3" }, - {0x14, 0x01, 0xc0, 0x40, "Yes" }, -}; - -STDDIPINFO(Asuka) - -static struct BurnDIPInfo MofflottDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "20k And Every 50k" }, - {0x14, 0x01, 0x0c, 0x08, "50k And Every 100k" }, - {0x14, 0x01, 0x0c, 0x04, "100k Only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x00, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x10, "4" }, - {0x14, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2, "Invulnerability" }, - {0x14, 0x01, 0x40, 0x40, "Off" }, - {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Number Of Keys" }, - {0x14, 0x01, 0x80, 0x00, "B 14" }, - {0x14, 0x01, 0x80, 0x80, "A 16" }, -}; - -STDDIPINFO(Mofflott) - -static struct BurnDIPInfo GalmedesDIPList[]= -{ - {0x13, 0xff, 0xff, 0xf7, NULL }, - {0x14, 0xff, 0xff, 0xfb, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 8, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "Every 100k" }, - {0x14, 0x01, 0x0c, 0x0c, "100k And Every 200k" }, - {0x14, 0x01, 0x0c, 0x04, "150k And Every 200k" }, - {0x14, 0x01, 0x0c, 0x00, "Every 200k" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x20, "1" }, - {0x14, 0x01, 0x30, 0x10, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "4" }, - - {0 , 0xfe, 0 , 2, "Coin Mode" }, - {0x14, 0x01, 0x80, 0x80, "Mode A (Japan)" }, - {0x14, 0x01, 0x80, 0x00, "Mode B (World)" }, -}; - -STDDIPINFO(Galmedes) - -static struct BurnDIPInfo EarthjkrDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xf3, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x00, "100k and 300k" }, - {0x14, 0x01, 0x0c, 0x08, "100k only" }, - {0x14, 0x01, 0x0c, 0x04, "200k only" }, - {0x14, 0x01, 0x0c, 0x0c, "None" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x00, "1" }, - {0x14, 0x01, 0x30, 0x30, "2" }, - {0x14, 0x01, 0x30, 0x20, "3" }, - {0x14, 0x01, 0x30, 0x10, "4" }, - - {0 , 0xfe, 0 , 2, "Copyright" }, - {0x14, 0x01, 0x40, 0x40, "Visco" }, - {0x14, 0x01, 0x40, 0x00, "Visco (Romstar)" }, -}; - -STDDIPINFO(Earthjkr) - -static struct BurnDIPInfo BonzeadvDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xbc, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "40k 100k" }, - {0x14, 0x01, 0x0c, 0x0c, "50k 150k" }, - {0x14, 0x01, 0x0c, 0x04, "60k 200k" }, - {0x14, 0x01, 0x0c, 0x00, "80k 250k" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x10, "4" }, - {0x14, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x14, 0x01, 0x40, 0x40, "No" }, - {0x14, 0x01, 0x40, 0x00, "Yes" }, -}; - -STDDIPINFO(Bonzeadv) - -static struct BurnDIPInfo JigkmgriDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xbc, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "40k 100k" }, - {0x14, 0x01, 0x0c, 0x0c, "50k 150k" }, - {0x14, 0x01, 0x0c, 0x04, "60k 200k" }, - {0x14, 0x01, 0x0c, 0x00, "80k 250k" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x10, "4" }, - {0x14, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x14, 0x01, 0x40, 0x40, "No" }, - {0x14, 0x01, 0x40, 0x00, "Yes" }, -}; - -STDDIPINFO(Jigkmgri) - -//-------------------------------------------------------------------------------------------------------------------------- - -void __fastcall cadash_write_byte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x900000) - TC0100SCN0ByteWrite_Map(0xc00000, 0xc0ffff) -} - -void __fastcall cadash_write_word(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x900000) - TC0100SCN0WordWrite_Map(0xc00000, 0xc0ffff) - TC0100SCN0CtrlWordWrite_Map(0xc20000) - - switch (a) - { - case 0x080000: - case 0x080002: - PC090OJSpriteCtrl = (d & 0x3c) >> 2; - return; - - case 0xa00000: - case 0xa00002: - case 0xa00004: - TC0110PCRStep14rbgWordWrite(0, (a & 0x0f) / 2, d); - return; - - case 0x0c0000: - TC0140SYTPortWrite(d); - return; - - case 0x0c0002: - ZetClose(); - TC0140SYTCommWrite(d); - ZetOpen(0); - return; - } -} - -UINT8 __fastcall cadash_read_byte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x900000) - - return 0; -} - -UINT16 __fastcall cadash_read_word(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x900000) - if ((a & 0xffffff0) == 0xc20000) return TC0100SCNCtrl[0][(a & 0x0f)/2]; - - switch (a) - { - case 0xa00002: - return TC0110PCRWordRead(0); - - case 0x0c0002: - return TC0140SYTCommRead(); - } - - return 0; -} - -//-------------------------------------------------------------------------------------------------------------------------- - -void __fastcall asuka_write_byte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x400000) - TC0100SCN0ByteWrite_Map(0xc00000, 0xc0ffff) - - switch (a) - { - case 0x3a0001: - PC090OJSpriteCtrl = ((d & 0x3c) >> 2) | ((d & 0x01) << 15); - return; - - case 0x3e0001: - TC0140SYTPortWrite(d); - return; - - case 0x3e0002: - case 0x3e0003: - ZetClose(); - TC0140SYTCommWrite(d); - ZetOpen(0); - return; - } -} - -void __fastcall asuka_write_word(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x400000) - TC0100SCN0WordWrite_Map(0xc00000, 0xc0ffff) - TC0100SCN0CtrlWordWrite_Map(0xc20000) - - switch (a) - { - case 0x3a0000: - PC090OJSpriteCtrl = ((d & 0x3c) >> 2) | ((d & 0x01) << 15); - return; - - case 0x200000: - case 0x200002: - case 0x200004: - TC0110PCRStep1WordWrite(0, (a & 0x0f) / 2, d); - return; - - case 0x3e0000: // galmedes - TC0140SYTPortWrite(d); - return; - - case 0x3e0002: - ZetClose(); - TC0140SYTCommWrite(d); - ZetOpen(0); - return; - } -} - -UINT8 __fastcall asuka_read_byte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x400000) - - switch (a) - { - case 0x3e0002: - case 0x3e0003: - return TC0140SYTCommRead(); - } - - return 0; -} - -UINT16 __fastcall asuka_read_word(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x400000) - if ((a & 0xffffff0) == 0xc20000) return TC0100SCNCtrl[0][(a & 0x0f)/2]; - - switch (a) - { - case 0x1076f0: - return 0; // maze of flott - - case 0x200002: - return TC0110PCRWordRead(0); - - case 0x3e0002: - return TC0140SYTCommRead(); - } - - return 0; -} - -//-------------------------------------------------------------------------------------------------------------------------- - -void __fastcall eto_write_byte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x300000) - TC0220IOCHalfWordWrite_Map(0x400000) - TC0100SCN0ByteWrite_Map(0xd00000, 0xd0ffff) - - if (a >= 0xc04000 && a <= 0xc0ffff) { - INT32 Offset = (a - 0xc00000) ^ 1; - if (TC0100SCNRam[0][Offset] != d) { - TC0100SCNBgLayerUpdate[0] = 1; - TC0100SCNFgLayerUpdate[0] = 1; - } - TC0100SCNRam[0][Offset] = d; - return; - } - - switch (a) - { - case 0x4a0000: - case 0x4a0001: - PC090OJSpriteCtrl = ((d & 0x3c) >> 2) | ((d & 0x01) << 15); - return; - } -} - -void __fastcall eto_write_word(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x300000) - TC0220IOCHalfWordWrite_Map(0x400000) - TC0100SCN0WordWrite_Map(0xd00000, 0xd0ffff) - TC0100SCN0CtrlWordWrite_Map(0xd20000) - - if (a >= 0xc04000 && a <= 0xc0ffff) { - UINT16 *Ram = (UINT16*)TC0100SCNRam[0]; - INT32 Offset = (a - 0xc00000) >> 1; - if (Ram[Offset] != d) { - TC0100SCNBgLayerUpdate[0] = 1; - TC0100SCNFgLayerUpdate[0] = 1; - } - Ram[Offset] = d; - return; - } - - switch (a) - { - case 0x100000: - case 0x100002: - case 0x100004: - TC0110PCRStep1WordWrite(0, (a & 0x0f) / 2, d); - return; - - case 0x4e0000: - TC0140SYTPortWrite(d); - return; - - case 0x4e0002: - ZetClose(); - TC0140SYTCommWrite(d); - ZetOpen(0); - return; - } -} - -UINT8 __fastcall eto_read_byte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x300000) - TC0220IOCHalfWordRead_Map(0x400000) - - switch (a) - { - case 0x4e0002: - case 0x4e0003: - return TC0140SYTCommRead(); - } - - return 0; -} - -UINT16 __fastcall eto_read_word(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x300000) - TC0220IOCHalfWordRead_Map(0x400000) - if ((a & 0xffffff0) == 0xd20000) return TC0100SCNCtrl[0][(a & 0x0f)/2]; - - switch (a) - { - case 0x100002: - return TC0110PCRWordRead(0); - - case 0x4e0002: - return TC0140SYTCommRead(); - } - - return 0; -} - -//-------------------------------------------------------------------------------------------------------------------------- - -void __fastcall bonze_write_byte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0xc00000, 0xc0ffff) - - switch (a) - { - case 0x3a0001: - PC090OJSpriteCtrl = (d & 0x3c) >> 2; - return; - - case 0x3e0001: - TC0140SYTPortWrite(d); - return; - - case 0x3e0003: - ZetClose(); - TC0140SYTCommWrite(d); - ZetOpen(0); - return; - - case 0x800803: // CChip Ctrl - return; - - case 0x800c01: - BonzeWriteCChipBank(d); - return; - } - - if ((a & 0xffff800) == 0x800000) { - BonzeWriteCChipRam(a, d); - return; - } -} - -void __fastcall bonze_write_word(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0xc00000, 0xc0ffff) - TC0100SCN0CtrlWordWrite_Map(0xc20000) - - switch (a) - { - case 0x200000: - case 0x200002: - case 0x200004: - TC0110PCRStep1WordWrite(0, (a & 0x0f) / 2, d); - return; - - case 0x3c0000: - TaitoWatchdog = 0; - return; - } - - if ((a & 0xffffc00) == 0xc10000) return; // nop -} - -UINT8 __fastcall bonze_read_byte(UINT32 a) -{ - switch (a) - { - case 0x3e0003: - return TC0140SYTCommRead(); - - case 0x800803: - return 1; // CChip Status - } - - if ((a & 0xfffff800) == 0x800000) { - return BonzeReadCChipRam(a); - } - - return 0; -} - -UINT16 __fastcall bonze_read_word(UINT32 a) -{ - if ((a & 0xffffff0) == 0xc20000) return TC0100SCNCtrl[0][(a & 0x0f)/2]; - - switch (a) - { - case 0x200002: - return TC0110PCRWordRead(0); - - case 0x390000: - return TaitoDip[0]; - - case 0x3b0000: - return TaitoDip[1]; - - case 0x3d0000: - return 0; // nop - } - - if ((a & 0xfffff800) == 0x800000) { - return BonzeReadCChipRam(a); - } - - return 0; -} - -//-------------------------------------------------------------------------------------------------------------------------- - -void __fastcall cadash_sound_write(UINT16 a, UINT8 d) -{ - switch (a) - { - case 0x9000: - BurnYM2151SelectRegister(d); - return; - - case 0x9001: - BurnYM2151WriteRegister(d); - return; - - case 0xa000: - TC0140SYTSlavePortWrite(d); - return; - - case 0xa001: - TC0140SYTSlaveCommWrite(d); - return; - - case 0xb000: { - if (TaitoNumMSM5205) AsukaADPCMPos = (AsukaADPCMPos & 0x00ff) | (d << 8); - return; - } - - case 0xc000: { - if (TaitoNumMSM5205) MSM5205ResetWrite(0, 0); - return; - } - - case 0xd000: { - if (TaitoNumMSM5205) { - MSM5205ResetWrite(0, 1); - AsukaADPCMPos &= 0xff00; - } - return; - } - } -} - -UINT8 __fastcall cadash_sound_read(UINT16 a) -{ - switch (a) - { - case 0x9000: - case 0x9001: - return BurnYM2151ReadStatus(); - - case 0xa001: - return TC0140SYTSlaveCommRead(); - } - - return 0; -} - -//-------------------------------------------------------------------------------------------------------------------------- - -static void DrvSoundBankSwitch(UINT32, UINT32 bank) -{ - TaitoZ80Bank = bank & 0x03; - - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + TaitoZ80Bank * 0x4000); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + TaitoZ80Bank * 0x4000); -} - -void __fastcall bonze_sound_write(UINT16 a, UINT8 d) -{ - switch (a) - { - case 0xe000: - case 0xe001: - case 0xe002: - case 0xe003: - BurnYM2610Write(a & 3, d); - return; - - case 0xe200: - TC0140SYTSlavePortWrite(d); - return; - - case 0xe201: - TC0140SYTSlaveCommWrite(d); - return; - - case 0xf200: - DrvSoundBankSwitch(0, d); - return; - } -} - -UINT8 __fastcall bonze_sound_read(UINT16 a) -{ - switch (a) - { - case 0xe000: - case 0xe001: - case 0xe002: - case 0xe003: - return BurnYM2610Read(a & 3); - - case 0xe201: - return TC0140SYTSlaveCommRead(); - } - - return 0; -} - -//-------------------------------------------------------------------------------------------------------------------------- - -static void DrvMakeInputs() -{ - memset (TC0220IOCInput, 0xff, 3); - - TC0220IOCInput[2] &= ~TaitoInputConfig; // asuka - - for (INT32 i = 0; i < 8; i++) { - TC0220IOCInput[0] ^= (TC0220IOCInputPort0[i] & 1) << i; - TC0220IOCInput[1] ^= (TC0220IOCInputPort1[i] & 1) << i; - TC0220IOCInput[2] ^= (TC0220IOCInputPort2[i] & 1) << i; - } -} - -static void CadashYM2151IRQHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)(double)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 4000000.0; -} - -static void AsukaMSM5205Vck() -{ - if (AsukaADPCMData != -1) { - MSM5205DataWrite(0, AsukaADPCMData & 0x0f); - AsukaADPCMData = -1; - } else { - AsukaADPCMData = TaitoMSM5205Rom[AsukaADPCMPos]; - AsukaADPCMPos = (AsukaADPCMPos + 1) & 0xffff; - MSM5205DataWrite(0, AsukaADPCMData >> 4); - } -} - -static INT32 DrvDoReset() -{ - memset (TaitoRamStart, 0, TaitoRamEnd - TaitoRamStart); - -#if 0 - // This resets the YM2151 which calls DrvSoundBankSwitch via the port callback - TaitoDoReset(); -#else - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - if (TaitoNumYM2610) BurnYM2610Reset(); - if (TaitoNumMSM5205) MSM5205Reset(); - ZetOpen(0); - if (TaitoNumYM2151) BurnYM2151Reset(); - ZetClose(); -#endif - - ZetOpen(0); - DrvSoundBankSwitch(0, 1); - ZetClose(); - - BonzeCChipReset(); - - AsukaADPCMPos = 0; - AsukaADPCMData = -1; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += 0x100000; - TaitoZ80Rom1 = Next; Next += 0x010000; - - TaitoChars = Next; Next += TaitoCharRomSize * 2; - TaitoSpritesA = Next; Next += TaitoSpriteARomSize * 2; - - TaitoMSM5205Rom = Next; Next += TaitoMSM5205RomSize; - TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x008000; - Taito68KRam2 = Next; Next += 0x001000; - - TaitoZ80Ram1 = Next; Next += 0x002000; - - TaitoRamEnd = Next; - TaitoMemEnd = Next; - - return 0; -} - -static void expand_graphics(UINT8 *src, INT32 len) -{ - for (INT32 i = (len * 2) - 2; i >= 0; i -= 2) { - src[i + 0] = src[(i / 2) ^ 1] >> 4; - src[i + 1] = src[(i / 2) ^ 1] & 0x0f; - } -} - -static void Cadash68KSetup() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1, 0x100000, 0x107fff, SM_RAM); - SekMapMemory(Taito68KRam2, 0x800000, 0x800fff, SM_RAM); // Network RAM - SekMapMemory(PC090OJRam, 0xb00000, 0xb03fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0], 0xc00000, 0xc0ffff, SM_READ); - SekSetWriteByteHandler(0, cadash_write_byte); - SekSetWriteWordHandler(0, cadash_write_word); - SekSetReadByteHandler(0, cadash_read_byte); - SekSetReadWordHandler(0, cadash_read_word); - SekClose(); -} - -static void Eto68KSetup() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRom1 + 0x40000, 0x080000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1, 0x200000, 0x203fff, SM_RAM); - SekMapMemory(PC090OJRam, 0xc00000, 0xc03fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] + 0x4000, 0xc04000, 0xc0ffff, SM_READ); // mirror - SekMapMemory(TC0100SCNRam[0], 0xd00000, 0xd0ffff, SM_READ); - SekSetWriteByteHandler(0, eto_write_byte); - SekSetWriteWordHandler(0, eto_write_word); - SekSetReadByteHandler(0, eto_read_byte); - SekSetReadWordHandler(0, eto_read_word); - SekClose(); -} - -static void Asuka68KSetup() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRom1 + 0x40000, 0x080000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1, 0x100000, 0x103fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0], 0xc00000, 0xc0ffff, SM_READ); - SekMapMemory(PC090OJRam, 0xd00000, 0xd03fff, SM_RAM); - SekSetWriteByteHandler(0, asuka_write_byte); - SekSetWriteWordHandler(0, asuka_write_word); - SekSetReadByteHandler(0, asuka_read_byte); - SekSetReadWordHandler(0, asuka_read_word); - SekClose(); -} - -static void Bonze68KSetup() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRom1 + 0x40000, 0x080000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1, 0x10c000, 0x10ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0], 0xc00000, 0xc0ffff, SM_READ); - SekMapMemory(PC090OJRam, 0xd00000, 0xd03fff, SM_RAM); - SekSetWriteByteHandler(0, bonze_write_byte); - SekSetWriteWordHandler(0, bonze_write_word); - SekSetReadByteHandler(0, bonze_read_byte); - SekSetReadWordHandler(0, bonze_read_word); - SekClose(); -} - -static void CadashZ80Setup() -{ - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1); - ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1); - ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1); - ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1); - ZetSetWriteHandler(cadash_sound_write); - ZetSetReadHandler(cadash_sound_read); - ZetMemEnd(); - ZetClose(); -} - -static void BonzeZ80Setup() -{ - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1); - ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1); - ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1); - ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1); - ZetSetWriteHandler(bonze_sound_write); - ZetSetReadHandler(bonze_sound_read); - ZetMemEnd(); - ZetClose(); -} - -static void CadashSoundSetup() -{ - BurnYM2151Init(4000000); - BurnYM2151SetIrqHandler(&CadashYM2151IRQHandler); - BurnYM2151SetPortHandler(&DrvSoundBankSwitch); - BurnYM2151SetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); - - TaitoNumYM2151 = 1; - TaitoNumYM2610 = 0; - TaitoNumMSM5205 = 0; -} - -static void AsukaSoundSetup() -{ - BurnYM2151Init(4000000); - BurnYM2151SetIrqHandler(&CadashYM2151IRQHandler); - BurnYM2151SetPortHandler(&DrvSoundBankSwitch); - BurnYM2151SetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); - - MSM5205Init(0, DrvSynchroniseStream, 384000, AsukaMSM5205Vck, MSM5205_S48_4B, 1); - MSM5205SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - TaitoNumYM2151 = 1; - TaitoNumMSM5205 = 1; - TaitoNumYM2610 = 0; -} - -static void BonzeSoundSetup() -{ - INT32 DrvSndROMLen = 0x80000; - BurnYM2610Init(8000000, TaitoYM2610ARom, &DrvSndROMLen, TaitoYM2610ARom, &DrvSndROMLen, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - TaitoNumYM2151 = 0; - TaitoNumYM2610 = 1; - TaitoNumMSM5205 = 0; -} - -static INT32 CommonInit(void (*Cpu68KSetup)(), void (*CpuZ80Setup)(), void (*SoundSetup)(), INT32 buffer_sprites) -{ - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoInputConfig = 0; - - TaitoLoadRoms(false); - - TaitoMem = NULL; - MemIndex(); - INT32 nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - TaitoLoadRoms(true); - - expand_graphics(TaitoChars, 0x80000); - expand_graphics(TaitoSpritesA, TaitoSpriteARomSize); - - GenericTilesInit(); - - PC090OJInit((TaitoSpriteARomSize * 2) / 0x100, 0, (256 - nScreenHeight) / 2, buffer_sprites); - TC0100SCNInit(0, (0x80000 * 2) / 0x40, 0, (256 - nScreenHeight) / 2, 0, NULL); - TC0110PCRInit(1, 0x1000); - TC0220IOCInit(); - TaitoMakeInputsFunction = DrvMakeInputs; - TC0140SYTInit(); - - Cpu68KSetup(); - CpuZ80Setup(); - SoundSetup(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); - if ((PC090OJSpriteCtrl & 0x8000)) PC090OJDrawSprites(TaitoSpritesA); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); - if ((PC090OJSpriteCtrl & 0x8000)) PC090OJDrawSprites(TaitoSpritesA); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - if (!(PC090OJSpriteCtrl & 0x8000)) PC090OJDrawSprites(TaitoSpritesA); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - - BurnTransferCopy(TC0110PCRPalette); - - return 0; -} - -static INT32 CadashFrame() -{ - if (TaitoReset) { - DrvDoReset(); - } - - TaitoMakeInputsFunction(); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - INT32 nInterleave = 100; - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 16000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nCycleSegment; - - nCycleSegment = (nCyclesTotal[0] / nInterleave) * (i+1); - if (i == (nInterleave - 1)) nCycleSegment -= 500; //? - nCyclesDone[0] += SekRun(nCycleSegment - SekTotalCycles()); - - nCycleSegment = (nCyclesTotal[1] / nInterleave) * (i+1); - nCyclesDone[1] += ZetRun(nCycleSegment - ZetTotalCycles()); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - SekRun(500); - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 EtoFrame() // Using for asuka too, but needs msm5205 -{ - if (TaitoReset) { - DrvDoReset(); - } - - TaitoMakeInputsFunction(); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - INT32 nInterleave = 100; - if (TaitoNumMSM5205) nInterleave = MSM5205CalcInterleave(0, 4000000); - INT32 nSoundBufferPos = 0; - INT32 nCyclesTotal[2] = { 8000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nCycleSegment; - - nCycleSegment = (nCyclesTotal[0] / nInterleave) * (i+1); - nCyclesDone[0] += SekRun(nCycleSegment - SekTotalCycles()); - - nCycleSegment = (nCyclesTotal[1] / nInterleave) * (i+1); - nCyclesDone[1] += ZetRun(nCycleSegment - ZetTotalCycles()); - if (TaitoNumMSM5205) MSM5205Update(); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - } - - if (TaitoNumMSM5205) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 BonzeFrame() -{ - TaitoWatchdog++; - if (TaitoReset || TaitoWatchdog >= 180) { - DrvDoReset(); - } - - { - memset (TaitoInput, 0xff, 4); - TaitoInput[1] = 0; - - for (INT32 i = 0; i < 8; i++) { - TaitoInput[0] ^= (TaitoInputPort0[i] & 1) << i; - TaitoInput[1] ^= (TaitoInputPort1[i] & 1) << i; - TaitoInput[2] ^= (TaitoInputPort2[i] & 1) << i; - TaitoInput[3] ^= (TaitoInputPort3[i] & 1) << i; - } - } - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - SekRun(8000000 / 60); - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - BurnTimerEndFrame(4000000 / 60); - - if (pBurnSoundOut) { - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029707; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = TaitoRamStart; - ba.nLen = TaitoRamEnd - TaitoRamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - TaitoICScan(nAction); - BonzeCChipScan(nAction); - - if (TaitoNumYM2151) BurnYM2151Scan(nAction); - if (TaitoNumYM2610) BurnYM2610Scan(nAction, pnMin); - if (TaitoNumMSM5205) MSM5205Scan(nAction, pnMin); - - SCAN_VAR(TaitoZ80Bank); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - DrvSoundBankSwitch(0, TaitoZ80Bank); - ZetClose(); - } - - return 0; -} - - -// Cadash (World) - -static struct BurnRomInfo cadashRomDesc[] = { - { "c21-14", 0x20000, 0x5daf13fb, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "c21-16", 0x20000, 0xcbaa2e75, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "c21-13", 0x20000, 0x6b9e0ee9, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 - { "c21-17", 0x20000, 0xbf9a578a, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 - - { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters - - { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites - - { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? - - { "pal16l8b-c21-09.ic34", 0x00104, 0x4b296700, BRF_OPT }, // 8 plds - { "pal16l8b-c21-10.ic45", 0x00104, 0x35642f00, BRF_OPT }, // 9 - { "pal16l8b-c21-11-1.ic46", 0x00104, 0xf4791e24, BRF_OPT }, // 10 - { "pal20l8b-c21-12.ic47", 0x00144, 0xbbc2cc97, BRF_OPT }, // 11 -}; - -STD_ROM_PICK(cadash) -STD_ROM_FN(cadash) - -static INT32 CadashInit() -{ - return CommonInit(Cadash68KSetup, CadashZ80Setup, CadashSoundSetup, 1); -} - -struct BurnDriver BurnDrvCadash = { - "cadash", NULL, NULL, NULL, "1989", - "Cadash (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, cadashRomInfo, cadashRomName, NULL, NULL, CadashInputInfo, CadashDIPInfo, - CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 240, 4, 3 -}; - - -// Cadash (Japan) - -static struct BurnRomInfo cadashjRomDesc[] = { - { "c21-04.11", 0x20000, 0xcc22ebe5, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "c21-06.15", 0x20000, 0x26e03304, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "c21-03.10", 0x20000, 0xc54888ed, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 - { "c21-05.14", 0x20000, 0x834018d2, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 - - { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters - - { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites - - { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? -}; - -STD_ROM_PICK(cadashj) -STD_ROM_FN(cadashj) - -struct BurnDriver BurnDrvCadashj = { - "cadashj", "cadash", NULL, NULL, "1989", - "Cadash (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, cadashjRomInfo, cadashjRomName, NULL, NULL, CadashInputInfo, CadashjDIPInfo, - CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 240, 4, 3 -}; - - -// Cadash (US) - -static struct BurnRomInfo cadashuRomDesc[] = { - { "c21-14-2.11", 0x20000, 0xf823d418, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "c21-16-2.15", 0x20000, 0x90165577, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "c21-13-2.10", 0x20000, 0x92dcc3ae, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 - { "c21-15-2.14", 0x20000, 0xf915d26a, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 - - { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters - - { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites - - { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? -}; - -STD_ROM_PICK(cadashu) -STD_ROM_FN(cadashu) - -struct BurnDriver BurnDrvCadashu = { - "cadashu", "cadash", NULL, NULL, "1989", - "Cadash (US)\0", NULL, "Taito America Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, cadashuRomInfo, cadashuRomName, NULL, NULL, CadashInputInfo, CadashuDIPInfo, - CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 240, 4, 3 -}; - - -// Cadash (Italy) - -static struct BurnRomInfo cadashiRomDesc[] = { - { "c21-14it", 0x20000, 0xd1d9e613, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "c21-16it", 0x20000, 0x142256ef, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "c21-13it", 0x20000, 0xc9cf6e30, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 - { "c21-17it", 0x20000, 0x641fc9dd, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 - - { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters - - { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites - - { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? -}; - -STD_ROM_PICK(cadashi) -STD_ROM_FN(cadashi) - -struct BurnDriver BurnDrvCadashi = { - "cadashi", "cadash", NULL, NULL, "1989", - "Cadash (Italy)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, cadashiRomInfo, cadashiRomName, NULL, NULL, CadashInputInfo, CadashDIPInfo, - CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 240, 4, 3 -}; - - -// Cadash (France) - -static struct BurnRomInfo cadashfRomDesc[] = { - { "c21-19", 0x20000, 0x4d70543b, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "c21-21", 0x20000, 0x0e5b9950, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "c21-18", 0x20000, 0x8a19e59b, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 - { "c21-20", 0x20000, 0xb96acfd9, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 - - { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters - - { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites - - { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? -}; - -STD_ROM_PICK(cadashf) -STD_ROM_FN(cadashf) - -struct BurnDriver BurnDrvCadashf = { - "cadashf", "cadash", NULL, NULL, "1989", - "Cadash (France)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, cadashfRomInfo, cadashfRomName, NULL, NULL, CadashInputInfo, CadashDIPInfo, - CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 240, 4, 3 -}; - - -// Cadash (Germany) - -static struct BurnRomInfo cadashgRomDesc[] = { - { "c21-23-1.12", 0x20000, 0x30ddbabe, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "c21-25-1.16", 0x20000, 0x24e10611, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "c21-22-1.11", 0x20000, 0xdaf58b2d, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 - { "c21-24-1.15", 0x20000, 0x2359b93e, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 - - { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters - - { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites - - { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? -}; - -STD_ROM_PICK(cadashg) -STD_ROM_FN(cadashg) - -struct BurnDriver BurnDrvCadashg = { - "cadashg", "cadash", NULL, NULL, "1989", - "Cadash (Germany)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, cadashgRomInfo, cadashgRomName, NULL, NULL, CadashInputInfo, CadashDIPInfo, - CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 240, 4, 3 -}; - - -// Kokontouzai Eto Monogatari (Japan) - -static struct BurnRomInfo etoRomDesc[] = { - { "eto-1.23", 0x20000, 0x44286597, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "eto-0.8", 0x20000, 0x57b79370, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "eto-2.30", 0x80000, 0x12f46fb5, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 - - { "eto-5.27", 0x10000, 0xb3689da0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code - - { "eto-4.3", 0x80000, 0xa8768939, BRF_GRA | TAITO_CHARS }, // 4 Characters - - { "eto-3.6", 0x80000, 0xdd247397, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites -}; - -STD_ROM_PICK(eto) -STD_ROM_FN(eto) - -static INT32 EtoInit() -{ - INT32 nRet = CommonInit(Eto68KSetup, CadashZ80Setup, CadashSoundSetup, 0); - - if (nRet == 0) { - BurnByteswap(Taito68KRom1 + 0x40000, 0x80000); - } - - return nRet; -} - -struct BurnDriver BurnDrvEto = { - "eto", NULL, NULL, NULL, "1994", - "Kokontouzai Eto Monogatari (Japan)\0", NULL, "Visco", "Taito Misc", - L"\u53E4\u4ECA\u6771\u897F\u5E72\u652F\u7269\u8A9E\0Kokontouzai Eto Monogatari (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, - NULL, etoRomInfo, etoRomName, NULL, NULL, AsukaInputInfo, EtoDIPInfo, - EtoInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 240, 4, 3 -}; - - -// Asuka & Asuka (World) - -static struct BurnRomInfo asukaRomDesc[] = { - { "b68-13.bin", 0x20000, 0x855efb3e, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "b68-12.bin", 0x20000, 0x271eeee9, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "b68-03.bin", 0x80000, 0xd3a59b10, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 - - { "b68-11.bin", 0x10000, 0xc378b508, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code - - { "b68-01.bin", 0x80000, 0x89f32c94, BRF_GRA | TAITO_CHARS }, // 4 Characters - - { "b68-02.bin", 0x80000, 0xf5018cd3, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites - { "b68-07.bin", 0x10000, 0xc113acc8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 6 - { "b68-06.bin", 0x10000, 0xf517e64d, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 7 - - { "b68-10.bin", 0x10000, 0x387aaf40, BRF_SND | TAITO_MSM5205 }, // 8 MSM5205 Samples -}; - -STD_ROM_PICK(asuka) -STD_ROM_FN(asuka) - -static INT32 AsukaInit() -{ - INT32 nRet = CommonInit(Asuka68KSetup, CadashZ80Setup, AsukaSoundSetup, 0); - - if (nRet == 0) { - BurnByteswap(Taito68KRom1 + 0x40000, 0x80000); - } - - TaitoInputConfig = 0x30; - - return nRet; -} - -struct BurnDriver BurnDrvAsuka = { - "asuka", NULL, NULL, NULL, "1988", - "Asuka & Asuka (World)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, - NULL, asukaRomInfo, asukaRomName, NULL, NULL, AsukaInputInfo, AsukaDIPInfo, - AsukaInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, - 240, 320, 3, 4 -}; - - -// Asuka & Asuka (Japan) - -static struct BurnRomInfo asukajRomDesc[] = { - { "b68-09.bin", 0x20000, 0x1eaa1bbb, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "b68-08.bin", 0x20000, 0x8cc96e60, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "b68-03.bin", 0x80000, 0xd3a59b10, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 - - { "b68-11.bin", 0x10000, 0xc378b508, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code - - { "b68-01.bin", 0x80000, 0x89f32c94, BRF_GRA | TAITO_CHARS }, // 4 Characters - - { "b68-02.bin", 0x80000, 0xf5018cd3, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites - { "b68-07.bin", 0x10000, 0xc113acc8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 6 - { "b68-06.bin", 0x10000, 0xf517e64d, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 7 - - { "b68-10.bin", 0x10000, 0x387aaf40, BRF_SND | TAITO_MSM5205 }, // 8 MSM5205 Samples -}; - -STD_ROM_PICK(asukaj) -STD_ROM_FN(asukaj) - -struct BurnDriver BurnDrvAsukaj = { - "asukaj", "asuka", NULL, NULL, "1988", - "Asuka & Asuka (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, - NULL, asukajRomInfo, asukajRomName, NULL, NULL, AsukaInputInfo, AsukaDIPInfo, - AsukaInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, - 240, 320, 3, 4 -}; - - -// Maze of Flott (Japan) - -static struct BurnRomInfo mofflottRomDesc[] = { - { "c17-09.bin", 0x20000, 0x05ee110f, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "c17-08.bin", 0x20000, 0xd0aacffd, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "c17-03.bin", 0x80000, 0x27047fc3, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 - - { "c17-07.bin", 0x10000, 0xcdb7bc2c, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code - - { "c17-01.bin", 0x80000, 0xe9466d42, BRF_GRA | TAITO_CHARS }, // 4 Characters - - { "c17-02.bin", 0x80000, 0x8860a8db, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites - { "c17-05.bin", 0x10000, 0x57ac4741, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 6 - { "c17-04.bin", 0x10000, 0xf4250410, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 7 - - { "c17-06.bin", 0x10000, 0x5c332125, BRF_SND | TAITO_MSM5205 }, // 8 MSM5205 Samples -}; - -STD_ROM_PICK(mofflott) -STD_ROM_FN(mofflott) - -struct BurnDriver BurnDrvMofflott = { - "mofflott", NULL, NULL, NULL, "1989", - "Maze of Flott (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MAZE, 0, - NULL, mofflottRomInfo, mofflottRomName, NULL, NULL, AsukaInputInfo, MofflottDIPInfo, - AsukaInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, - 240, 320, 3, 4 -}; - - -// Galmedes (Japan) - -static struct BurnRomInfo galmedesRomDesc[] = { - { "gm-prg1.bin", 0x20000, 0x32a70753, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "gm-prg0.bin", 0x20000, 0xfae546a4, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "gm-30.rom", 0x80000, 0x4da2a407, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 - - { "gm-snd.bin", 0x10000, 0xd6f56c21, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code - - { "gm-scn.bin", 0x80000, 0x3bab0581, BRF_GRA | TAITO_CHARS }, // 4 Characters - - { "gm-obj.bin", 0x80000, 0x7a4a1315, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites -}; - -STD_ROM_PICK(galmedes) -STD_ROM_FN(galmedes) - -static INT32 GalmedesInit() -{ - INT32 nRet = CommonInit(Asuka68KSetup, CadashZ80Setup, CadashSoundSetup, 0); - - if (nRet == 0) { - BurnByteswap(Taito68KRom1 + 0x40000, 0x80000); - } - - return nRet; -} - -struct BurnDriver BurnDrvGalmedes = { - "galmedes", NULL, NULL, NULL, "1992", - "Galmedes (Japan)\0", NULL, "Visco", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, - NULL, galmedesRomInfo, galmedesRomName, NULL, NULL, AsukaInputInfo, GalmedesDIPInfo, - GalmedesInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, - 240, 320, 3, 4 -}; - - -// U.N. Defense Force: Earth Joker - -static struct BurnRomInfo earthjkrRomDesc[] = { - { "ej_3b.rom", 0x20000, 0xbdd86fc2, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "ej_3a.rom", 0x20000, 0x9c8050c6, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "ej_30e.rom", 0x80000, 0x49d1f77f, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 - - { "ej_2.rom", 0x10000, 0x42ba2566, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code - - { "ej_chr.rom", 0x80000, 0xac675297, BRF_GRA | TAITO_CHARS }, // 4 Characters - - { "ej_obj.rom", 0x80000, 0x5f21ac47, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites - { "ej_1.rom", 0x10000, 0xcb4891db, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 6 - { "ej_0.rom", 0x10000, 0xb612086f, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 7 -}; - -STD_ROM_PICK(earthjkr) -STD_ROM_FN(earthjkr) - -struct BurnDriver BurnDrvEarthjkr = { - "earthjkr", NULL, NULL, NULL, "1993", - "U.N. Defense Force: Earth Joker\0", NULL, "Visco", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, - NULL, earthjkrRomInfo, earthjkrRomName, NULL, NULL, AsukaInputInfo, EarthjkrDIPInfo, - GalmedesInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, - 240, 320, 3, 4 -}; - - -// Bonze Adventure (World, Newer) - -static struct BurnRomInfo bonzeadvRomDesc[] = { - { "b41-09-1.17", 0x10000, 0xaf821fbc, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "b41-11-1.26", 0x10000, 0x823fff00, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "b41-10.16", 0x10000, 0x4ca94d77, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 - { "b41-15.25", 0x10000, 0xaed7a0d0, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 - { "b41-01.15", 0x80000, 0x5d072fa4, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 4 - - { "b41-13.20", 0x10000, 0x9e464254, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 5 Z80 Code - - { "b41-03.1", 0x80000, 0x736d35d0, BRF_GRA | TAITO_CHARS }, // 6 Characters - - { "b41-02.7", 0x80000, 0x29f205d9, BRF_GRA | TAITO_SPRITESA }, // 7 Sprites - - { "b41-04.48", 0x80000, 0xc668638f, BRF_SND | TAITO_YM2610A }, // 8 YM2610 Samples -}; - -STD_ROM_PICK(bonzeadv) -STD_ROM_FN(bonzeadv) - -static INT32 BonzeInit() -{ - return CommonInit(Bonze68KSetup, BonzeZ80Setup, BonzeSoundSetup, 0); -} - -struct BurnDriver BurnDrvBonzeadv = { - "bonzeadv", NULL, NULL, NULL, "1988", - "Bonze Adventure (World, Newer)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, bonzeadvRomInfo, bonzeadvRomName, NULL, NULL, BonzeadvInputInfo, BonzeadvDIPInfo, - BonzeInit, TaitoExit, BonzeFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Bonze Adventure (World, Older) - -static struct BurnRomInfo bonzeadvoRomDesc[] = { - { "b41-09.17", 0x10000, 0x06818710, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "b41-11.26", 0x10000, 0x33c4c2f4, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "b41-10.16", 0x10000, 0x4ca94d77, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 - { "b41-15.25", 0x10000, 0xaed7a0d0, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 - { "b41-01.15", 0x80000, 0x5d072fa4, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 4 - - { "b41-13.20", 0x10000, 0x9e464254, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 5 Z80 Code - - { "b41-03.1", 0x80000, 0x736d35d0, BRF_GRA | TAITO_CHARS }, // 6 Characters - - { "b41-02.7", 0x80000, 0x29f205d9, BRF_GRA | TAITO_SPRITESA }, // 7 Sprites - - { "b41-04.48", 0x80000, 0xc668638f, BRF_SND | TAITO_YM2610A }, // 8 YM2610 Samples -}; - -STD_ROM_PICK(bonzeadvo) -STD_ROM_FN(bonzeadvo) - -struct BurnDriver BurnDrvBonzeadvo = { - "bonzeadvo", "bonzeadv", NULL, NULL, "1988", - "Bonze Adventure (World, Older)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, bonzeadvoRomInfo, bonzeadvoRomName, NULL, NULL, BonzeadvInputInfo, BonzeadvDIPInfo, - BonzeInit, TaitoExit, BonzeFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Bonze Adventure (US) - -static struct BurnRomInfo bonzeadvuRomDesc[] = { - { "b41-09-1.17", 0x10000, 0xaf821fbc, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "b41-11-1.26", 0x10000, 0x823fff00, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "b41-10.16", 0x10000, 0x4ca94d77, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 - { "b41-14.25", 0x10000, 0x37def16a, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 - { "b41-01.15", 0x80000, 0x5d072fa4, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 4 - - { "b41-13.20", 0x10000, 0x9e464254, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 5 Z80 Code - - { "b41-03.1", 0x80000, 0x736d35d0, BRF_GRA | TAITO_CHARS }, // 6 Characters - - { "b41-02.7", 0x80000, 0x29f205d9, BRF_GRA | TAITO_SPRITESA }, // 7 Sprites - - { "b41-04.48", 0x80000, 0xc668638f, BRF_SND | TAITO_YM2610A }, // 8 YM2610 Samples -}; - -STD_ROM_PICK(bonzeadvu) -STD_ROM_FN(bonzeadvu) - -struct BurnDriver BurnDrvBonzeadvu = { - "bonzeadvu", "bonzeadv", NULL, NULL, "1988", - "Bonze Adventure (US)\0", NULL, "Taito America Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, bonzeadvuRomInfo, bonzeadvuRomName, NULL, NULL, BonzeadvInputInfo, JigkmgriDIPInfo, - BonzeInit, TaitoExit, BonzeFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Jigoku Meguri (Japan) - -static struct BurnRomInfo jigkmgriRomDesc[] = { - { "b41-09-1.17", 0x10000, 0xaf821fbc, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code - { "b41-11-1.26", 0x10000, 0x823fff00, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 - { "b41-10.16", 0x10000, 0x4ca94d77, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 - { "b41-12.25", 0x10000, 0x40d9c1fc, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 - { "b41-01.15", 0x80000, 0x5d072fa4, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 4 - - { "b41-13.20", 0x10000, 0x9e464254, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 5 Z80 Code - - { "b41-03.1", 0x80000, 0x736d35d0, BRF_GRA | TAITO_CHARS }, // 6 Characters - - { "b41-02.7", 0x80000, 0x29f205d9, BRF_GRA | TAITO_SPRITESA }, // 7 Sprites - - { "b41-04.48", 0x80000, 0xc668638f, BRF_SND | TAITO_YM2610A }, // 8 YM2610 Samples -}; - -STD_ROM_PICK(jigkmgri) -STD_ROM_FN(jigkmgri) - -struct BurnDriver BurnDrvJigkmgri = { - "jigkmgri", "bonzeadv", NULL, NULL, "1988", - "Jigoku Meguri (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - L"\u5730\u7344\u3081\u3050\u308A\0Jigoku Meguri (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, jigkmgriRomInfo, jigkmgriRomName, NULL, NULL, BonzeadvInputInfo, JigkmgriDIPInfo, - BonzeInit, TaitoExit, BonzeFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; +// FB Alpha Asuka & Asuka driver module +// Based on MAME driver by David Graves, Brian Troha, and + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "burn_ym2151.h" +#include "burn_ym2610.h" +#include "msm5205.h" +#include "taito_ic.h" +#include "taito.h" + +static UINT8 TaitoInputConfig; +static INT32 AsukaADPCMPos; +static INT32 AsukaADPCMData; + +static struct BurnInputInfo CadashInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 7, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 6, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort1 + 7, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort1 + 6, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, +}; + +STDINPUTINFO(Cadash) + +static struct BurnInputInfo AsukaInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset"}, + {"Service", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, +}; + +STDINPUTINFO(Asuka) + +static struct BurnInputInfo BonzeadvInputList[] = { + {"P1 Coin", BIT_DIGITAL, TaitoInputPort1 + 0, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TaitoInputPort0 + 6, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TaitoInputPort2 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TaitoInputPort2 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TaitoInputPort2 + 4, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TaitoInputPort2 + 5, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TaitoInputPort2 + 6, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TaitoInputPort2 + 7, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, TaitoInputPort1 + 1, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TaitoInputPort0 + 5, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TaitoInputPort3 + 1, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TaitoInputPort3 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TaitoInputPort3 + 3, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TaitoInputPort3 + 4, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TaitoInputPort3 + 5, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TaitoInputPort3 + 6, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, + {"Service", BIT_DIGITAL, TaitoInputPort0 + 7, "service" }, + {"Tilt", BIT_DIGITAL, TaitoInputPort2 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TaitoDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TaitoDip + 1, "dip" }, +}; + +STDINPUTINFO(Bonzeadv) + +static struct BurnDIPInfo CadashDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Starting Time" }, + {0x14, 0x01, 0x0c, 0x00, "5:00" }, + {0x14, 0x01, 0x0c, 0x04, "6:00" }, + {0x14, 0x01, 0x0c, 0x0c, "7:00" }, + {0x14, 0x01, 0x0c, 0x08, "8:00" }, + + {0 , 0xfe, 0 , 4, "Add Time" }, + {0x14, 0x01, 0x30, 0x00, "Default - 2:00" }, + {0x14, 0x01, 0x30, 0x10, "Default - 1:00" }, + {0x14, 0x01, 0x30, 0x30, "Default" }, + {0x14, 0x01, 0x30, 0x20, "Default + 1:00" }, + + {0 , 0xfe, 0 , 3, "Communication Mode" }, + {0x14, 0x01, 0xc0, 0xc0, "Stand alone" }, + {0x14, 0x01, 0xc0, 0x80, "Master" }, + {0x14, 0x01, 0xc0, 0x00, "Slave" }, +}; + +STDDIPINFO(Cadash) + +static struct BurnDIPInfo CadashjDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coins 2 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "2 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 3 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Starting Time" }, + {0x14, 0x01, 0x0c, 0x00, "5:00" }, + {0x14, 0x01, 0x0c, 0x04, "6:00" }, + {0x14, 0x01, 0x0c, 0x0c, "7:00" }, + {0x14, 0x01, 0x0c, 0x08, "8:00" }, + + {0 , 0xfe, 0 , 4, "Add Time" }, + {0x14, 0x01, 0x30, 0x00, "Default - 2:00" }, + {0x14, 0x01, 0x30, 0x10, "Default - 1:00" }, + {0x14, 0x01, 0x30, 0x30, "Default" }, + {0x14, 0x01, 0x30, 0x20, "Default + 1:00" }, + + {0 , 0xfe, 0 , 3, "Communication Mode" }, + {0x14, 0x01, 0xc0, 0xc0, "Stand alone" }, + {0x14, 0x01, 0xc0, 0x80, "Master" }, + {0x14, 0x01, 0xc0, 0x00, "Slave" }, +}; + +STDDIPINFO(Cadashj) + +static struct BurnDIPInfo CadashuDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Price to Continue" }, + {0x13, 0x01, 0xc0, 0xc0, "Same as Start" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "3 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Starting Time" }, + {0x14, 0x01, 0x0c, 0x00, "5:00" }, + {0x14, 0x01, 0x0c, 0x04, "6:00" }, + {0x14, 0x01, 0x0c, 0x0c, "7:00" }, + {0x14, 0x01, 0x0c, 0x08, "8:00" }, + + {0 , 0xfe, 0 , 4, "Add Time (after clear)"}, + {0x14, 0x01, 0x30, 0x00, "Default - 2:00" }, + {0x14, 0x01, 0x30, 0x10, "Default - 1:00" }, + {0x14, 0x01, 0x30, 0x30, "Default" }, + {0x14, 0x01, 0x30, 0x20, "Default + 1:00" }, + + {0 , 0xfe, 0 , 3, "Communication Mode" }, + {0x14, 0x01, 0xc0, 0xc0, "Stand alone" }, + {0x14, 0x01, 0xc0, 0x80, "Master" }, + {0x14, 0x01, 0xc0, 0x00, "Slave" }, +}; + +STDDIPINFO(Cadashu) + + +static struct BurnDIPInfo EtoDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0x03, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Eto) + +static struct BurnDIPInfo AsukaDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xbf, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Points" }, + {0x14, 0x01, 0x0c, 0x0c, "500" }, + {0x14, 0x01, 0x0c, 0x08, "1500" }, + {0x14, 0x01, 0x0c, 0x04, "2000" }, + {0x14, 0x01, 0x0c, 0x00, "2500" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x10, "1" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Allow Continue" }, + {0x14, 0x01, 0xc0, 0x00, "No" }, + {0x14, 0x01, 0xc0, 0xc0, "Up To Level 2" }, + {0x14, 0x01, 0xc0, 0x80, "Up To Level 3" }, + {0x14, 0x01, 0xc0, 0x40, "Yes" }, +}; + +STDDIPINFO(Asuka) + +static struct BurnDIPInfo MofflottDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "20k And Every 50k" }, + {0x14, 0x01, 0x0c, 0x08, "50k And Every 100k" }, + {0x14, 0x01, 0x0c, 0x04, "100k Only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x00, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x10, "4" }, + {0x14, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2, "Invulnerability" }, + {0x14, 0x01, 0x40, 0x40, "Off" }, + {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Number Of Keys" }, + {0x14, 0x01, 0x80, 0x00, "B 14" }, + {0x14, 0x01, 0x80, 0x80, "A 16" }, +}; + +STDDIPINFO(Mofflott) + +static struct BurnDIPInfo GalmedesDIPList[]= +{ + {0x13, 0xff, 0xff, 0xf7, NULL }, + {0x14, 0xff, 0xff, 0xfb, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 8, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "Every 100k" }, + {0x14, 0x01, 0x0c, 0x0c, "100k And Every 200k" }, + {0x14, 0x01, 0x0c, 0x04, "150k And Every 200k" }, + {0x14, 0x01, 0x0c, 0x00, "Every 200k" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x20, "1" }, + {0x14, 0x01, 0x30, 0x10, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "4" }, + + {0 , 0xfe, 0 , 2, "Coin Mode" }, + {0x14, 0x01, 0x80, 0x80, "Mode A (Japan)" }, + {0x14, 0x01, 0x80, 0x00, "Mode B (World)" }, +}; + +STDDIPINFO(Galmedes) + +static struct BurnDIPInfo EarthjkrDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xf3, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x00, "100k and 300k" }, + {0x14, 0x01, 0x0c, 0x08, "100k only" }, + {0x14, 0x01, 0x0c, 0x04, "200k only" }, + {0x14, 0x01, 0x0c, 0x0c, "None" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x00, "1" }, + {0x14, 0x01, 0x30, 0x30, "2" }, + {0x14, 0x01, 0x30, 0x20, "3" }, + {0x14, 0x01, 0x30, 0x10, "4" }, + + {0 , 0xfe, 0 , 2, "Copyright" }, + {0x14, 0x01, 0x40, 0x40, "Visco" }, + {0x14, 0x01, 0x40, 0x00, "Visco (Romstar)" }, +}; + +STDDIPINFO(Earthjkr) + +static struct BurnDIPInfo BonzeadvDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xbc, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "40k 100k" }, + {0x14, 0x01, 0x0c, 0x0c, "50k 150k" }, + {0x14, 0x01, 0x0c, 0x04, "60k 200k" }, + {0x14, 0x01, 0x0c, 0x00, "80k 250k" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x10, "4" }, + {0x14, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x14, 0x01, 0x40, 0x40, "No" }, + {0x14, 0x01, 0x40, 0x00, "Yes" }, +}; + +STDDIPINFO(Bonzeadv) + +static struct BurnDIPInfo JigkmgriDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xbc, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "40k 100k" }, + {0x14, 0x01, 0x0c, 0x0c, "50k 150k" }, + {0x14, 0x01, 0x0c, 0x04, "60k 200k" }, + {0x14, 0x01, 0x0c, 0x00, "80k 250k" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x10, "4" }, + {0x14, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x14, 0x01, 0x40, 0x40, "No" }, + {0x14, 0x01, 0x40, 0x00, "Yes" }, +}; + +STDDIPINFO(Jigkmgri) + +//-------------------------------------------------------------------------------------------------------------------------- + +void __fastcall cadash_write_byte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x900000) + TC0100SCN0ByteWrite_Map(0xc00000, 0xc0ffff) +} + +void __fastcall cadash_write_word(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x900000) + TC0100SCN0WordWrite_Map(0xc00000, 0xc0ffff) + TC0100SCN0CtrlWordWrite_Map(0xc20000) + + switch (a) + { + case 0x080000: + case 0x080002: + PC090OJSpriteCtrl = (d & 0x3c) >> 2; + return; + + case 0xa00000: + case 0xa00002: + case 0xa00004: + TC0110PCRStep14rbgWordWrite(0, (a & 0x0f) / 2, d); + return; + + case 0x0c0000: + TC0140SYTPortWrite(d); + return; + + case 0x0c0002: + ZetClose(); + TC0140SYTCommWrite(d); + ZetOpen(0); + return; + } +} + +UINT8 __fastcall cadash_read_byte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x900000) + + return 0; +} + +UINT16 __fastcall cadash_read_word(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x900000) + if ((a & 0xffffff0) == 0xc20000) return TC0100SCNCtrl[0][(a & 0x0f)/2]; + + switch (a) + { + case 0xa00002: + return TC0110PCRWordRead(0); + + case 0x0c0002: + return TC0140SYTCommRead(); + } + + return 0; +} + +//-------------------------------------------------------------------------------------------------------------------------- + +void __fastcall asuka_write_byte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x400000) + TC0100SCN0ByteWrite_Map(0xc00000, 0xc0ffff) + + switch (a) + { + case 0x3a0001: + PC090OJSpriteCtrl = ((d & 0x3c) >> 2) | ((d & 0x01) << 15); + return; + + case 0x3e0001: + TC0140SYTPortWrite(d); + return; + + case 0x3e0002: + case 0x3e0003: + ZetClose(); + TC0140SYTCommWrite(d); + ZetOpen(0); + return; + } +} + +void __fastcall asuka_write_word(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x400000) + TC0100SCN0WordWrite_Map(0xc00000, 0xc0ffff) + TC0100SCN0CtrlWordWrite_Map(0xc20000) + + switch (a) + { + case 0x3a0000: + PC090OJSpriteCtrl = ((d & 0x3c) >> 2) | ((d & 0x01) << 15); + return; + + case 0x200000: + case 0x200002: + case 0x200004: + TC0110PCRStep1WordWrite(0, (a & 0x0f) / 2, d); + return; + + case 0x3e0000: // galmedes + TC0140SYTPortWrite(d); + return; + + case 0x3e0002: + ZetClose(); + TC0140SYTCommWrite(d); + ZetOpen(0); + return; + } +} + +UINT8 __fastcall asuka_read_byte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x400000) + + switch (a) + { + case 0x3e0002: + case 0x3e0003: + return TC0140SYTCommRead(); + } + + return 0; +} + +UINT16 __fastcall asuka_read_word(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x400000) + if ((a & 0xffffff0) == 0xc20000) return TC0100SCNCtrl[0][(a & 0x0f)/2]; + + switch (a) + { + case 0x1076f0: + return 0; // maze of flott + + case 0x200002: + return TC0110PCRWordRead(0); + + case 0x3e0002: + return TC0140SYTCommRead(); + } + + return 0; +} + +//-------------------------------------------------------------------------------------------------------------------------- + +void __fastcall eto_write_byte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x300000) + TC0220IOCHalfWordWrite_Map(0x400000) + TC0100SCN0ByteWrite_Map(0xd00000, 0xd0ffff) + + if (a >= 0xc04000 && a <= 0xc0ffff) { + INT32 Offset = (a - 0xc00000) ^ 1; + if (TC0100SCNRam[0][Offset] != d) { + TC0100SCNBgLayerUpdate[0] = 1; + TC0100SCNFgLayerUpdate[0] = 1; + } + TC0100SCNRam[0][Offset] = d; + return; + } + + switch (a) + { + case 0x4a0000: + case 0x4a0001: + PC090OJSpriteCtrl = ((d & 0x3c) >> 2) | ((d & 0x01) << 15); + return; + } +} + +void __fastcall eto_write_word(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x300000) + TC0220IOCHalfWordWrite_Map(0x400000) + TC0100SCN0WordWrite_Map(0xd00000, 0xd0ffff) + TC0100SCN0CtrlWordWrite_Map(0xd20000) + + if (a >= 0xc04000 && a <= 0xc0ffff) { + UINT16 *Ram = (UINT16*)TC0100SCNRam[0]; + INT32 Offset = (a - 0xc00000) >> 1; + if (Ram[Offset] != d) { + TC0100SCNBgLayerUpdate[0] = 1; + TC0100SCNFgLayerUpdate[0] = 1; + } + Ram[Offset] = d; + return; + } + + switch (a) + { + case 0x100000: + case 0x100002: + case 0x100004: + TC0110PCRStep1WordWrite(0, (a & 0x0f) / 2, d); + return; + + case 0x4e0000: + TC0140SYTPortWrite(d); + return; + + case 0x4e0002: + ZetClose(); + TC0140SYTCommWrite(d); + ZetOpen(0); + return; + } +} + +UINT8 __fastcall eto_read_byte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x300000) + TC0220IOCHalfWordRead_Map(0x400000) + + switch (a) + { + case 0x4e0002: + case 0x4e0003: + return TC0140SYTCommRead(); + } + + return 0; +} + +UINT16 __fastcall eto_read_word(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x300000) + TC0220IOCHalfWordRead_Map(0x400000) + if ((a & 0xffffff0) == 0xd20000) return TC0100SCNCtrl[0][(a & 0x0f)/2]; + + switch (a) + { + case 0x100002: + return TC0110PCRWordRead(0); + + case 0x4e0002: + return TC0140SYTCommRead(); + } + + return 0; +} + +//-------------------------------------------------------------------------------------------------------------------------- + +void __fastcall bonze_write_byte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0xc00000, 0xc0ffff) + + switch (a) + { + case 0x3a0001: + PC090OJSpriteCtrl = (d & 0x3c) >> 2; + return; + + case 0x3e0001: + TC0140SYTPortWrite(d); + return; + + case 0x3e0003: + ZetClose(); + TC0140SYTCommWrite(d); + ZetOpen(0); + return; + + case 0x800803: // CChip Ctrl + return; + + case 0x800c01: + BonzeWriteCChipBank(d); + return; + } + + if ((a & 0xffff800) == 0x800000) { + BonzeWriteCChipRam(a, d); + return; + } +} + +void __fastcall bonze_write_word(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0xc00000, 0xc0ffff) + TC0100SCN0CtrlWordWrite_Map(0xc20000) + + switch (a) + { + case 0x200000: + case 0x200002: + case 0x200004: + TC0110PCRStep1WordWrite(0, (a & 0x0f) / 2, d); + return; + + case 0x3c0000: + TaitoWatchdog = 0; + return; + } + + if ((a & 0xffffc00) == 0xc10000) return; // nop +} + +UINT8 __fastcall bonze_read_byte(UINT32 a) +{ + switch (a) + { + case 0x3e0003: + return TC0140SYTCommRead(); + + case 0x800803: + return 1; // CChip Status + } + + if ((a & 0xfffff800) == 0x800000) { + return BonzeReadCChipRam(a); + } + + return 0; +} + +UINT16 __fastcall bonze_read_word(UINT32 a) +{ + if ((a & 0xffffff0) == 0xc20000) return TC0100SCNCtrl[0][(a & 0x0f)/2]; + + switch (a) + { + case 0x200002: + return TC0110PCRWordRead(0); + + case 0x390000: + return TaitoDip[0]; + + case 0x3b0000: + return TaitoDip[1]; + + case 0x3d0000: + return 0; // nop + } + + if ((a & 0xfffff800) == 0x800000) { + return BonzeReadCChipRam(a); + } + + return 0; +} + +//-------------------------------------------------------------------------------------------------------------------------- + +void __fastcall cadash_sound_write(UINT16 a, UINT8 d) +{ + switch (a) + { + case 0x9000: + BurnYM2151SelectRegister(d); + return; + + case 0x9001: + BurnYM2151WriteRegister(d); + return; + + case 0xa000: + TC0140SYTSlavePortWrite(d); + return; + + case 0xa001: + TC0140SYTSlaveCommWrite(d); + return; + + case 0xb000: { + if (TaitoNumMSM5205) AsukaADPCMPos = (AsukaADPCMPos & 0x00ff) | (d << 8); + return; + } + + case 0xc000: { + if (TaitoNumMSM5205) MSM5205ResetWrite(0, 0); + return; + } + + case 0xd000: { + if (TaitoNumMSM5205) { + MSM5205ResetWrite(0, 1); + AsukaADPCMPos &= 0xff00; + } + return; + } + } +} + +UINT8 __fastcall cadash_sound_read(UINT16 a) +{ + switch (a) + { + case 0x9000: + case 0x9001: + return BurnYM2151ReadStatus(); + + case 0xa001: + return TC0140SYTSlaveCommRead(); + } + + return 0; +} + +//-------------------------------------------------------------------------------------------------------------------------- + +static void DrvSoundBankSwitch(UINT32, UINT32 bank) +{ + TaitoZ80Bank = bank & 0x03; + + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + TaitoZ80Bank * 0x4000); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + TaitoZ80Bank * 0x4000); +} + +void __fastcall bonze_sound_write(UINT16 a, UINT8 d) +{ + switch (a) + { + case 0xe000: + case 0xe001: + case 0xe002: + case 0xe003: + BurnYM2610Write(a & 3, d); + return; + + case 0xe200: + TC0140SYTSlavePortWrite(d); + return; + + case 0xe201: + TC0140SYTSlaveCommWrite(d); + return; + + case 0xf200: + DrvSoundBankSwitch(0, d); + return; + } +} + +UINT8 __fastcall bonze_sound_read(UINT16 a) +{ + switch (a) + { + case 0xe000: + case 0xe001: + case 0xe002: + case 0xe003: + return BurnYM2610Read(a & 3); + + case 0xe201: + return TC0140SYTSlaveCommRead(); + } + + return 0; +} + +//-------------------------------------------------------------------------------------------------------------------------- + +static void DrvMakeInputs() +{ + memset (TC0220IOCInput, 0xff, 3); + + TC0220IOCInput[2] &= ~TaitoInputConfig; // asuka + + for (INT32 i = 0; i < 8; i++) { + TC0220IOCInput[0] ^= (TC0220IOCInputPort0[i] & 1) << i; + TC0220IOCInput[1] ^= (TC0220IOCInputPort1[i] & 1) << i; + TC0220IOCInput[2] ^= (TC0220IOCInputPort2[i] & 1) << i; + } +} + +static void CadashYM2151IRQHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)(double)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 4000000.0; +} + +static void AsukaMSM5205Vck() +{ + if (AsukaADPCMData != -1) { + MSM5205DataWrite(0, AsukaADPCMData & 0x0f); + AsukaADPCMData = -1; + } else { + AsukaADPCMData = TaitoMSM5205Rom[AsukaADPCMPos]; + AsukaADPCMPos = (AsukaADPCMPos + 1) & 0xffff; + MSM5205DataWrite(0, AsukaADPCMData >> 4); + } +} + +static INT32 DrvDoReset() +{ + memset (TaitoRamStart, 0, TaitoRamEnd - TaitoRamStart); + +#if 0 + // This resets the YM2151 which calls DrvSoundBankSwitch via the port callback + TaitoDoReset(); +#else + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + if (TaitoNumYM2610) BurnYM2610Reset(); + if (TaitoNumMSM5205) MSM5205Reset(); + ZetOpen(0); + if (TaitoNumYM2151) BurnYM2151Reset(); + ZetClose(); +#endif + + ZetOpen(0); + DrvSoundBankSwitch(0, 1); + ZetClose(); + + BonzeCChipReset(); + + AsukaADPCMPos = 0; + AsukaADPCMData = -1; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += 0x100000; + TaitoZ80Rom1 = Next; Next += 0x010000; + + TaitoChars = Next; Next += TaitoCharRomSize * 2; + TaitoSpritesA = Next; Next += TaitoSpriteARomSize * 2; + + TaitoMSM5205Rom = Next; Next += TaitoMSM5205RomSize; + TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x008000; + Taito68KRam2 = Next; Next += 0x001000; + + TaitoZ80Ram1 = Next; Next += 0x002000; + + TaitoRamEnd = Next; + TaitoMemEnd = Next; + + return 0; +} + +static void expand_graphics(UINT8 *src, INT32 len) +{ + for (INT32 i = (len * 2) - 2; i >= 0; i -= 2) { + src[i + 0] = src[(i / 2) ^ 1] >> 4; + src[i + 1] = src[(i / 2) ^ 1] & 0x0f; + } +} + +static void Cadash68KSetup() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1, 0x100000, 0x107fff, SM_RAM); + SekMapMemory(Taito68KRam2, 0x800000, 0x800fff, SM_RAM); // Network RAM + SekMapMemory(PC090OJRam, 0xb00000, 0xb03fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0], 0xc00000, 0xc0ffff, SM_READ); + SekSetWriteByteHandler(0, cadash_write_byte); + SekSetWriteWordHandler(0, cadash_write_word); + SekSetReadByteHandler(0, cadash_read_byte); + SekSetReadWordHandler(0, cadash_read_word); + SekClose(); +} + +static void Eto68KSetup() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRom1 + 0x40000, 0x080000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1, 0x200000, 0x203fff, SM_RAM); + SekMapMemory(PC090OJRam, 0xc00000, 0xc03fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] + 0x4000, 0xc04000, 0xc0ffff, SM_READ); // mirror + SekMapMemory(TC0100SCNRam[0], 0xd00000, 0xd0ffff, SM_READ); + SekSetWriteByteHandler(0, eto_write_byte); + SekSetWriteWordHandler(0, eto_write_word); + SekSetReadByteHandler(0, eto_read_byte); + SekSetReadWordHandler(0, eto_read_word); + SekClose(); +} + +static void Asuka68KSetup() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRom1 + 0x40000, 0x080000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1, 0x100000, 0x103fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0], 0xc00000, 0xc0ffff, SM_READ); + SekMapMemory(PC090OJRam, 0xd00000, 0xd03fff, SM_RAM); + SekSetWriteByteHandler(0, asuka_write_byte); + SekSetWriteWordHandler(0, asuka_write_word); + SekSetReadByteHandler(0, asuka_read_byte); + SekSetReadWordHandler(0, asuka_read_word); + SekClose(); +} + +static void Bonze68KSetup() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRom1 + 0x40000, 0x080000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1, 0x10c000, 0x10ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0], 0xc00000, 0xc0ffff, SM_READ); + SekMapMemory(PC090OJRam, 0xd00000, 0xd03fff, SM_RAM); + SekSetWriteByteHandler(0, bonze_write_byte); + SekSetWriteWordHandler(0, bonze_write_word); + SekSetReadByteHandler(0, bonze_read_byte); + SekSetReadWordHandler(0, bonze_read_word); + SekClose(); +} + +static void CadashZ80Setup() +{ + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1); + ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1); + ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1); + ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1); + ZetSetWriteHandler(cadash_sound_write); + ZetSetReadHandler(cadash_sound_read); + ZetClose(); +} + +static void BonzeZ80Setup() +{ + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1); + ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1); + ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1); + ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1); + ZetSetWriteHandler(bonze_sound_write); + ZetSetReadHandler(bonze_sound_read); + ZetClose(); +} + +static void CadashSoundSetup() +{ + BurnYM2151Init(4000000); + BurnYM2151SetIrqHandler(&CadashYM2151IRQHandler); + BurnYM2151SetPortHandler(&DrvSoundBankSwitch); + BurnYM2151SetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); + + TaitoNumYM2151 = 1; + TaitoNumYM2610 = 0; + TaitoNumMSM5205 = 0; +} + +static void AsukaSoundSetup() +{ + BurnYM2151Init(4000000); + BurnYM2151SetIrqHandler(&CadashYM2151IRQHandler); + BurnYM2151SetPortHandler(&DrvSoundBankSwitch); + BurnYM2151SetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); + + MSM5205Init(0, DrvSynchroniseStream, 384000, AsukaMSM5205Vck, MSM5205_S48_4B, 1); + MSM5205SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + TaitoNumYM2151 = 1; + TaitoNumMSM5205 = 1; + TaitoNumYM2610 = 0; +} + +static void BonzeSoundSetup() +{ + INT32 DrvSndROMLen = 0x80000; + BurnYM2610Init(8000000, TaitoYM2610ARom, &DrvSndROMLen, TaitoYM2610ARom, &DrvSndROMLen, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + TaitoNumYM2151 = 0; + TaitoNumYM2610 = 1; + TaitoNumMSM5205 = 0; +} + +static INT32 CommonInit(void (*Cpu68KSetup)(), void (*CpuZ80Setup)(), void (*SoundSetup)(), INT32 buffer_sprites) +{ + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoInputConfig = 0; + + TaitoLoadRoms(false); + + TaitoMem = NULL; + MemIndex(); + INT32 nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + TaitoLoadRoms(true); + + expand_graphics(TaitoChars, 0x80000); + expand_graphics(TaitoSpritesA, TaitoSpriteARomSize); + + GenericTilesInit(); + + PC090OJInit((TaitoSpriteARomSize * 2) / 0x100, 0, (256 - nScreenHeight) / 2, buffer_sprites); + TC0100SCNInit(0, (0x80000 * 2) / 0x40, 0, (256 - nScreenHeight) / 2, 0, NULL); + TC0110PCRInit(1, 0x1000); + TC0220IOCInit(); + TaitoMakeInputsFunction = DrvMakeInputs; + TC0140SYTInit(); + + Cpu68KSetup(); + CpuZ80Setup(); + SoundSetup(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); + if ((PC090OJSpriteCtrl & 0x8000)) PC090OJDrawSprites(TaitoSpritesA); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); + if ((PC090OJSpriteCtrl & 0x8000)) PC090OJDrawSprites(TaitoSpritesA); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + if (!(PC090OJSpriteCtrl & 0x8000)) PC090OJDrawSprites(TaitoSpritesA); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + + BurnTransferCopy(TC0110PCRPalette); + + return 0; +} + +static INT32 CadashFrame() +{ + if (TaitoReset) { + DrvDoReset(); + } + + TaitoMakeInputsFunction(); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + INT32 nInterleave = 100; + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 16000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nCycleSegment; + + nCycleSegment = (nCyclesTotal[0] / nInterleave) * (i+1); + if (i == (nInterleave - 1)) nCycleSegment -= 500; //? + nCyclesDone[0] += SekRun(nCycleSegment - SekTotalCycles()); + + nCycleSegment = (nCyclesTotal[1] / nInterleave) * (i+1); + nCyclesDone[1] += ZetRun(nCycleSegment - ZetTotalCycles()); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + SekRun(500); + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 EtoFrame() // Using for asuka too, but needs msm5205 +{ + if (TaitoReset) { + DrvDoReset(); + } + + TaitoMakeInputsFunction(); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + INT32 nInterleave = 100; + if (TaitoNumMSM5205) nInterleave = MSM5205CalcInterleave(0, 4000000); + INT32 nSoundBufferPos = 0; + INT32 nCyclesTotal[2] = { 8000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nCycleSegment; + + nCycleSegment = (nCyclesTotal[0] / nInterleave) * (i+1); + nCyclesDone[0] += SekRun(nCycleSegment - SekTotalCycles()); + + nCycleSegment = (nCyclesTotal[1] / nInterleave) * (i+1); + nCyclesDone[1] += ZetRun(nCycleSegment - ZetTotalCycles()); + if (TaitoNumMSM5205) MSM5205Update(); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + } + + if (TaitoNumMSM5205) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 BonzeFrame() +{ + TaitoWatchdog++; + if (TaitoReset || TaitoWatchdog >= 180) { + DrvDoReset(); + } + + { + memset (TaitoInput, 0xff, 4); + TaitoInput[1] = 0; + + for (INT32 i = 0; i < 8; i++) { + TaitoInput[0] ^= (TaitoInputPort0[i] & 1) << i; + TaitoInput[1] ^= (TaitoInputPort1[i] & 1) << i; + TaitoInput[2] ^= (TaitoInputPort2[i] & 1) << i; + TaitoInput[3] ^= (TaitoInputPort3[i] & 1) << i; + } + } + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + SekRun(8000000 / 60); + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + BurnTimerEndFrame(4000000 / 60); + + if (pBurnSoundOut) { + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029707; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = TaitoRamStart; + ba.nLen = TaitoRamEnd - TaitoRamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + TaitoICScan(nAction); + BonzeCChipScan(nAction); + + if (TaitoNumYM2151) BurnYM2151Scan(nAction); + if (TaitoNumYM2610) BurnYM2610Scan(nAction, pnMin); + if (TaitoNumMSM5205) MSM5205Scan(nAction, pnMin); + + SCAN_VAR(TaitoZ80Bank); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + DrvSoundBankSwitch(0, TaitoZ80Bank); + ZetClose(); + } + + return 0; +} + + +// Cadash (World) + +static struct BurnRomInfo cadashRomDesc[] = { + { "c21-14", 0x20000, 0x5daf13fb, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "c21-16", 0x20000, 0xcbaa2e75, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "c21-13", 0x20000, 0x6b9e0ee9, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 + { "c21-17", 0x20000, 0xbf9a578a, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 + + { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters + + { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites + + { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? + + { "pal16l8b-c21-09.ic34", 0x00104, 0x4b296700, BRF_OPT }, // 8 plds + { "pal16l8b-c21-10.ic45", 0x00104, 0x35642f00, BRF_OPT }, // 9 + { "pal16l8b-c21-11-1.ic46", 0x00104, 0xf4791e24, BRF_OPT }, // 10 + { "pal20l8b-c21-12.ic47", 0x00144, 0xbbc2cc97, BRF_OPT }, // 11 +}; + +STD_ROM_PICK(cadash) +STD_ROM_FN(cadash) + +static INT32 CadashInit() +{ + return CommonInit(Cadash68KSetup, CadashZ80Setup, CadashSoundSetup, 1); +} + +struct BurnDriver BurnDrvCadash = { + "cadash", NULL, NULL, NULL, "1989", + "Cadash (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, cadashRomInfo, cadashRomName, NULL, NULL, CadashInputInfo, CadashDIPInfo, + CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 240, 4, 3 +}; + + +// Cadash (Japan) + +static struct BurnRomInfo cadashjRomDesc[] = { + { "c21-04.11", 0x20000, 0xcc22ebe5, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "c21-06.15", 0x20000, 0x26e03304, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "c21-03.10", 0x20000, 0xc54888ed, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 + { "c21-05.14", 0x20000, 0x834018d2, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 + + { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters + + { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites + + { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? +}; + +STD_ROM_PICK(cadashj) +STD_ROM_FN(cadashj) + +struct BurnDriver BurnDrvCadashj = { + "cadashj", "cadash", NULL, NULL, "1989", + "Cadash (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, cadashjRomInfo, cadashjRomName, NULL, NULL, CadashInputInfo, CadashjDIPInfo, + CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 240, 4, 3 +}; + + +// Cadash (US) + +static struct BurnRomInfo cadashuRomDesc[] = { + { "c21-14-2.11", 0x20000, 0xf823d418, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "c21-16-2.15", 0x20000, 0x90165577, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "c21-13-2.10", 0x20000, 0x92dcc3ae, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 + { "c21-15-2.14", 0x20000, 0xf915d26a, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 + + { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters + + { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites + + { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? +}; + +STD_ROM_PICK(cadashu) +STD_ROM_FN(cadashu) + +struct BurnDriver BurnDrvCadashu = { + "cadashu", "cadash", NULL, NULL, "1989", + "Cadash (US)\0", NULL, "Taito America Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, cadashuRomInfo, cadashuRomName, NULL, NULL, CadashInputInfo, CadashuDIPInfo, + CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 240, 4, 3 +}; + + +// Cadash (Italy) + +static struct BurnRomInfo cadashiRomDesc[] = { + { "c21-14it", 0x20000, 0xd1d9e613, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "c21-16it", 0x20000, 0x142256ef, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "c21-13it", 0x20000, 0xc9cf6e30, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 + { "c21-17it", 0x20000, 0x641fc9dd, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 + + { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters + + { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites + + { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? +}; + +STD_ROM_PICK(cadashi) +STD_ROM_FN(cadashi) + +struct BurnDriver BurnDrvCadashi = { + "cadashi", "cadash", NULL, NULL, "1989", + "Cadash (Italy)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, cadashiRomInfo, cadashiRomName, NULL, NULL, CadashInputInfo, CadashDIPInfo, + CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 240, 4, 3 +}; + + +// Cadash (France) + +static struct BurnRomInfo cadashfRomDesc[] = { + { "c21-19", 0x20000, 0x4d70543b, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "c21-21", 0x20000, 0x0e5b9950, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "c21-18", 0x20000, 0x8a19e59b, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 + { "c21-20", 0x20000, 0xb96acfd9, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 + + { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters + + { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites + + { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? +}; + +STD_ROM_PICK(cadashf) +STD_ROM_FN(cadashf) + +struct BurnDriver BurnDrvCadashf = { + "cadashf", "cadash", NULL, NULL, "1989", + "Cadash (France)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, cadashfRomInfo, cadashfRomName, NULL, NULL, CadashInputInfo, CadashDIPInfo, + CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 240, 4, 3 +}; + + +// Cadash (Germany) + +static struct BurnRomInfo cadashgRomDesc[] = { + { "c21-23-1.12", 0x20000, 0x30ddbabe, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "c21-25-1.16", 0x20000, 0x24e10611, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "c21-22-1.11", 0x20000, 0xdaf58b2d, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 + { "c21-24-1.15", 0x20000, 0x2359b93e, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 + + { "c21-08.38", 0x10000, 0xdca495a0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c21-02.9", 0x80000, 0x205883b9, BRF_GRA | TAITO_CHARS }, // 5 Characters + + { "c21-01.1", 0x80000, 0x1ff6f39c, BRF_GRA | TAITO_SPRITESA }, // 6 Sprites + + { "c21-07.57", 0x08000, 0xf02292bd, BRF_PRG | BRF_OPT }, // 7 Z180 Code? +}; + +STD_ROM_PICK(cadashg) +STD_ROM_FN(cadashg) + +struct BurnDriver BurnDrvCadashg = { + "cadashg", "cadash", NULL, NULL, "1989", + "Cadash (Germany)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, cadashgRomInfo, cadashgRomName, NULL, NULL, CadashInputInfo, CadashDIPInfo, + CadashInit, TaitoExit, CadashFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 240, 4, 3 +}; + + +// Kokontouzai Eto Monogatari (Japan) + +static struct BurnRomInfo etoRomDesc[] = { + { "eto-1.23", 0x20000, 0x44286597, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "eto-0.8", 0x20000, 0x57b79370, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "eto-2.30", 0x80000, 0x12f46fb5, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 + + { "eto-5.27", 0x10000, 0xb3689da0, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code + + { "eto-4.3", 0x80000, 0xa8768939, BRF_GRA | TAITO_CHARS }, // 4 Characters + + { "eto-3.6", 0x80000, 0xdd247397, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites +}; + +STD_ROM_PICK(eto) +STD_ROM_FN(eto) + +static INT32 EtoInit() +{ + INT32 nRet = CommonInit(Eto68KSetup, CadashZ80Setup, CadashSoundSetup, 0); + + if (nRet == 0) { + BurnByteswap(Taito68KRom1 + 0x40000, 0x80000); + } + + return nRet; +} + +struct BurnDriver BurnDrvEto = { + "eto", NULL, NULL, NULL, "1994", + "Kokontouzai Eto Monogatari (Japan)\0", NULL, "Visco", "Taito Misc", + L"\u53E4\u4ECA\u6771\u897F\u5E72\u652F\u7269\u8A9E\0Kokontouzai Eto Monogatari (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, + NULL, etoRomInfo, etoRomName, NULL, NULL, AsukaInputInfo, EtoDIPInfo, + EtoInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 240, 4, 3 +}; + + +// Asuka & Asuka (World) + +static struct BurnRomInfo asukaRomDesc[] = { + { "b68-13.bin", 0x20000, 0x855efb3e, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "b68-12.bin", 0x20000, 0x271eeee9, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "b68-03.bin", 0x80000, 0xd3a59b10, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 + + { "b68-11.bin", 0x10000, 0xc378b508, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code + + { "b68-01.bin", 0x80000, 0x89f32c94, BRF_GRA | TAITO_CHARS }, // 4 Characters + + { "b68-02.bin", 0x80000, 0xf5018cd3, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites + { "b68-07.bin", 0x10000, 0xc113acc8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 6 + { "b68-06.bin", 0x10000, 0xf517e64d, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 7 + + { "b68-10.bin", 0x10000, 0x387aaf40, BRF_SND | TAITO_MSM5205 }, // 8 MSM5205 Samples +}; + +STD_ROM_PICK(asuka) +STD_ROM_FN(asuka) + +static INT32 AsukaInit() +{ + INT32 nRet = CommonInit(Asuka68KSetup, CadashZ80Setup, AsukaSoundSetup, 0); + + if (nRet == 0) { + BurnByteswap(Taito68KRom1 + 0x40000, 0x80000); + } + + TaitoInputConfig = 0x30; + + return nRet; +} + +struct BurnDriver BurnDrvAsuka = { + "asuka", NULL, NULL, NULL, "1988", + "Asuka & Asuka (World)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, + NULL, asukaRomInfo, asukaRomName, NULL, NULL, AsukaInputInfo, AsukaDIPInfo, + AsukaInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, + 240, 320, 3, 4 +}; + + +// Asuka & Asuka (Japan) + +static struct BurnRomInfo asukajRomDesc[] = { + { "b68-09.bin", 0x20000, 0x1eaa1bbb, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "b68-08.bin", 0x20000, 0x8cc96e60, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "b68-03.bin", 0x80000, 0xd3a59b10, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 + + { "b68-11.bin", 0x10000, 0xc378b508, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code + + { "b68-01.bin", 0x80000, 0x89f32c94, BRF_GRA | TAITO_CHARS }, // 4 Characters + + { "b68-02.bin", 0x80000, 0xf5018cd3, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites + { "b68-07.bin", 0x10000, 0xc113acc8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 6 + { "b68-06.bin", 0x10000, 0xf517e64d, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 7 + + { "b68-10.bin", 0x10000, 0x387aaf40, BRF_SND | TAITO_MSM5205 }, // 8 MSM5205 Samples +}; + +STD_ROM_PICK(asukaj) +STD_ROM_FN(asukaj) + +struct BurnDriver BurnDrvAsukaj = { + "asukaj", "asuka", NULL, NULL, "1988", + "Asuka & Asuka (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, + NULL, asukajRomInfo, asukajRomName, NULL, NULL, AsukaInputInfo, AsukaDIPInfo, + AsukaInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, + 240, 320, 3, 4 +}; + + +// Maze of Flott (Japan) + +static struct BurnRomInfo mofflottRomDesc[] = { + { "c17-09.bin", 0x20000, 0x05ee110f, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "c17-08.bin", 0x20000, 0xd0aacffd, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "c17-03.bin", 0x80000, 0x27047fc3, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 + + { "c17-07.bin", 0x10000, 0xcdb7bc2c, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code + + { "c17-01.bin", 0x80000, 0xe9466d42, BRF_GRA | TAITO_CHARS }, // 4 Characters + + { "c17-02.bin", 0x80000, 0x8860a8db, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites + { "c17-05.bin", 0x10000, 0x57ac4741, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 6 + { "c17-04.bin", 0x10000, 0xf4250410, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 7 + + { "c17-06.bin", 0x10000, 0x5c332125, BRF_SND | TAITO_MSM5205 }, // 8 MSM5205 Samples +}; + +STD_ROM_PICK(mofflott) +STD_ROM_FN(mofflott) + +struct BurnDriver BurnDrvMofflott = { + "mofflott", NULL, NULL, NULL, "1989", + "Maze of Flott (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MAZE, 0, + NULL, mofflottRomInfo, mofflottRomName, NULL, NULL, AsukaInputInfo, MofflottDIPInfo, + AsukaInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, + 240, 320, 3, 4 +}; + + +// Galmedes (Japan) + +static struct BurnRomInfo galmedesRomDesc[] = { + { "gm-prg1.bin", 0x20000, 0x32a70753, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "gm-prg0.bin", 0x20000, 0xfae546a4, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "gm-30.rom", 0x80000, 0x4da2a407, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 + + { "gm-snd.bin", 0x10000, 0xd6f56c21, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code + + { "gm-scn.bin", 0x80000, 0x3bab0581, BRF_GRA | TAITO_CHARS }, // 4 Characters + + { "gm-obj.bin", 0x80000, 0x7a4a1315, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites +}; + +STD_ROM_PICK(galmedes) +STD_ROM_FN(galmedes) + +static INT32 GalmedesInit() +{ + INT32 nRet = CommonInit(Asuka68KSetup, CadashZ80Setup, CadashSoundSetup, 0); + + if (nRet == 0) { + BurnByteswap(Taito68KRom1 + 0x40000, 0x80000); + } + + return nRet; +} + +struct BurnDriver BurnDrvGalmedes = { + "galmedes", NULL, NULL, NULL, "1992", + "Galmedes (Japan)\0", NULL, "Visco", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, + NULL, galmedesRomInfo, galmedesRomName, NULL, NULL, AsukaInputInfo, GalmedesDIPInfo, + GalmedesInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, + 240, 320, 3, 4 +}; + + +// U.N. Defense Force: Earth Joker + +static struct BurnRomInfo earthjkrRomDesc[] = { + { "ej_3b.rom", 0x20000, 0xbdd86fc2, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "ej_3a.rom", 0x20000, 0x9c8050c6, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "ej_30e.rom", 0x80000, 0x49d1f77f, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 2 + + { "ej_2.rom", 0x10000, 0x42ba2566, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 3 Z80 Code + + { "ej_chr.rom", 0x80000, 0xac675297, BRF_GRA | TAITO_CHARS }, // 4 Characters + + { "ej_obj.rom", 0x80000, 0x5f21ac47, BRF_GRA | TAITO_SPRITESA }, // 5 Sprites + { "ej_1.rom", 0x10000, 0xcb4891db, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 6 + { "ej_0.rom", 0x10000, 0xb612086f, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, // 7 +}; + +STD_ROM_PICK(earthjkr) +STD_ROM_FN(earthjkr) + +struct BurnDriver BurnDrvEarthjkr = { + "earthjkr", NULL, NULL, NULL, "1993", + "U.N. Defense Force: Earth Joker\0", NULL, "Visco", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, + NULL, earthjkrRomInfo, earthjkrRomName, NULL, NULL, AsukaInputInfo, EarthjkrDIPInfo, + GalmedesInit, TaitoExit, EtoFrame, DrvDraw, DrvScan, NULL, 0x1000, + 240, 320, 3, 4 +}; + + +// Bonze Adventure (World, Newer) + +static struct BurnRomInfo bonzeadvRomDesc[] = { + { "b41-09-1.17", 0x10000, 0xaf821fbc, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "b41-11-1.26", 0x10000, 0x823fff00, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "b41-10.16", 0x10000, 0x4ca94d77, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 + { "b41-15.25", 0x10000, 0xaed7a0d0, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 + { "b41-01.15", 0x80000, 0x5d072fa4, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 4 + + { "b41-13.20", 0x10000, 0x9e464254, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 5 Z80 Code + + { "b41-03.1", 0x80000, 0x736d35d0, BRF_GRA | TAITO_CHARS }, // 6 Characters + + { "b41-02.7", 0x80000, 0x29f205d9, BRF_GRA | TAITO_SPRITESA }, // 7 Sprites + + { "b41-04.48", 0x80000, 0xc668638f, BRF_SND | TAITO_YM2610A }, // 8 YM2610 Samples +}; + +STD_ROM_PICK(bonzeadv) +STD_ROM_FN(bonzeadv) + +static INT32 BonzeInit() +{ + return CommonInit(Bonze68KSetup, BonzeZ80Setup, BonzeSoundSetup, 0); +} + +struct BurnDriver BurnDrvBonzeadv = { + "bonzeadv", NULL, NULL, NULL, "1988", + "Bonze Adventure (World, Newer)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, bonzeadvRomInfo, bonzeadvRomName, NULL, NULL, BonzeadvInputInfo, BonzeadvDIPInfo, + BonzeInit, TaitoExit, BonzeFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Bonze Adventure (World, Older) + +static struct BurnRomInfo bonzeadvoRomDesc[] = { + { "b41-09.17", 0x10000, 0x06818710, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "b41-11.26", 0x10000, 0x33c4c2f4, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "b41-10.16", 0x10000, 0x4ca94d77, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 + { "b41-15.25", 0x10000, 0xaed7a0d0, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 + { "b41-01.15", 0x80000, 0x5d072fa4, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 4 + + { "b41-13.20", 0x10000, 0x9e464254, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 5 Z80 Code + + { "b41-03.1", 0x80000, 0x736d35d0, BRF_GRA | TAITO_CHARS }, // 6 Characters + + { "b41-02.7", 0x80000, 0x29f205d9, BRF_GRA | TAITO_SPRITESA }, // 7 Sprites + + { "b41-04.48", 0x80000, 0xc668638f, BRF_SND | TAITO_YM2610A }, // 8 YM2610 Samples +}; + +STD_ROM_PICK(bonzeadvo) +STD_ROM_FN(bonzeadvo) + +struct BurnDriver BurnDrvBonzeadvo = { + "bonzeadvo", "bonzeadv", NULL, NULL, "1988", + "Bonze Adventure (World, Older)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, bonzeadvoRomInfo, bonzeadvoRomName, NULL, NULL, BonzeadvInputInfo, BonzeadvDIPInfo, + BonzeInit, TaitoExit, BonzeFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Bonze Adventure (US) + +static struct BurnRomInfo bonzeadvuRomDesc[] = { + { "b41-09-1.17", 0x10000, 0xaf821fbc, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "b41-11-1.26", 0x10000, 0x823fff00, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "b41-10.16", 0x10000, 0x4ca94d77, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 + { "b41-14.25", 0x10000, 0x37def16a, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 + { "b41-01.15", 0x80000, 0x5d072fa4, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 4 + + { "b41-13.20", 0x10000, 0x9e464254, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 5 Z80 Code + + { "b41-03.1", 0x80000, 0x736d35d0, BRF_GRA | TAITO_CHARS }, // 6 Characters + + { "b41-02.7", 0x80000, 0x29f205d9, BRF_GRA | TAITO_SPRITESA }, // 7 Sprites + + { "b41-04.48", 0x80000, 0xc668638f, BRF_SND | TAITO_YM2610A }, // 8 YM2610 Samples +}; + +STD_ROM_PICK(bonzeadvu) +STD_ROM_FN(bonzeadvu) + +struct BurnDriver BurnDrvBonzeadvu = { + "bonzeadvu", "bonzeadv", NULL, NULL, "1988", + "Bonze Adventure (US)\0", NULL, "Taito America Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, bonzeadvuRomInfo, bonzeadvuRomName, NULL, NULL, BonzeadvInputInfo, JigkmgriDIPInfo, + BonzeInit, TaitoExit, BonzeFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Jigoku Meguri (Japan) + +static struct BurnRomInfo jigkmgriRomDesc[] = { + { "b41-09-1.17", 0x10000, 0xaf821fbc, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 0 68K Code + { "b41-11-1.26", 0x10000, 0x823fff00, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 1 + { "b41-10.16", 0x10000, 0x4ca94d77, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 2 + { "b41-12.25", 0x10000, 0x40d9c1fc, BRF_PRG | BRF_ESS | TAITO_68KROM1_BYTESWAP }, // 3 + { "b41-01.15", 0x80000, 0x5d072fa4, BRF_PRG | BRF_ESS | TAITO_68KROM1 }, // 4 + + { "b41-13.20", 0x10000, 0x9e464254, BRF_PRG | BRF_ESS | TAITO_Z80ROM1 }, // 5 Z80 Code + + { "b41-03.1", 0x80000, 0x736d35d0, BRF_GRA | TAITO_CHARS }, // 6 Characters + + { "b41-02.7", 0x80000, 0x29f205d9, BRF_GRA | TAITO_SPRITESA }, // 7 Sprites + + { "b41-04.48", 0x80000, 0xc668638f, BRF_SND | TAITO_YM2610A }, // 8 YM2610 Samples +}; + +STD_ROM_PICK(jigkmgri) +STD_ROM_FN(jigkmgri) + +struct BurnDriver BurnDrvJigkmgri = { + "jigkmgri", "bonzeadv", NULL, NULL, "1988", + "Jigoku Meguri (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + L"\u5730\u7344\u3081\u3050\u308A\0Jigoku Meguri (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, jigkmgriRomInfo, jigkmgriRomName, NULL, NULL, BonzeadvInputInfo, JigkmgriDIPInfo, + BonzeInit, TaitoExit, BonzeFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/taito/d_bublbobl.cpp b/src/burn/drv/taito/d_bublbobl.cpp index 21f3fd5ed..9466d202f 100644 --- a/src/burn/drv/taito/d_bublbobl.cpp +++ b/src/burn/drv/taito/d_bublbobl.cpp @@ -1,2703 +1,2694 @@ -#include "tiles_generic.h" -#include "z80_intf.h" -#include "m6800_intf.h" -#include "taito_m68705.h" -#include "burn_ym2203.h" -#include "burn_ym3526.h" -#include "bitswap.h" - -static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvDip[2] = {0, 0}; -static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; -static UINT8 DrvReset = 0; - -static UINT8 *Mem = NULL; -static UINT8 *MemEnd = NULL; -static UINT8 *RamStart = NULL; -static UINT8 *RamEnd = NULL; -static UINT8 *DrvZ80Rom1 = NULL; -static UINT8 *DrvZ80Rom2 = NULL; -static UINT8 *DrvZ80Rom3 = NULL; -static UINT8 *DrvMcuRom = NULL; -static UINT8 *DrvProm = NULL; -static UINT8 *DrvZ80Ram1 = NULL; -static UINT8 *DrvZ80Ram3 = NULL; -static UINT8 *DrvSharedRam = NULL; -static UINT8 *DrvMcuRam = NULL; -static UINT8 *DrvVideoRam = NULL; -static UINT8 *DrvSpriteRam = NULL; -static UINT8 *DrvPaletteRam = NULL; -static UINT8 *DrvTiles = NULL; -static UINT8 *DrvTempRom = NULL; -static UINT32 *DrvPalette = NULL; - -static UINT8 DrvRomBank; -static UINT8 DrvSlaveCPUActive; -static UINT8 DrvSoundCPUActive; -static UINT8 DrvMCUActive; -static UINT8 DrvVideoEnable; -static UINT8 DrvFlipScreen; -static INT32 IC43A; -static INT32 IC43B; -static INT32 DrvSoundStatus; -static INT32 DrvSoundNmiEnable; -static INT32 DrvSoundNmiPending; -static INT32 DrvSoundLatch; - -static INT32 nCyclesDone[4], nCyclesTotal[4]; -static INT32 nCyclesSegment; - -typedef INT32 (*BublboblCallbackFunc)(); -static BublboblCallbackFunc BublboblCallbackFunction; - -static UINT8 DrvMCUInUse; - -static INT32 mcu_address, mcu_latch; -static UINT8 ddr1, ddr2, ddr3, ddr4; -static UINT8 port1_in, port2_in, port3_in, port4_in; -static UINT8 port1_out, port2_out, port3_out, port4_out; - -static struct BurnInputInfo BublboblInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 2" }, - - {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort0 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , DrvInputPort0 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Bublbobl) - -static struct BurnInputInfo BoblboblInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 2, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 2" }, - - {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, - {"Service" , BIT_DIGITAL , DrvInputPort1 + 3, "service" }, - {"Tilt" , BIT_DIGITAL , DrvInputPort1 + 2, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, -}; - -STDINPUTINFO(Boblbobl) - -static inline void BublboblMakeInputs() -{ - DrvInput[0] = 0xf3; - if (DrvInputPort0[0]) DrvInput[0] -= 0x01; - if (DrvInputPort0[1]) DrvInput[0] -= 0x02; - if (DrvInputPort0[2]) DrvInput[0] |= 0x04; - if (DrvInputPort0[3]) DrvInput[0] |= 0x08; - if (DrvInputPort0[4]) DrvInput[0] -= 0x10; - if (DrvInputPort0[5]) DrvInput[0] -= 0x20; - if (DrvInputPort0[6]) DrvInput[0] -= 0x40; - if (DrvInputPort0[7]) DrvInput[0] -= 0x80; - - DrvInput[1] = 0xff; - DrvInput[2] = 0xff; - for (INT32 i = 0; i < 8; i++) { - DrvInput[1] -= (DrvInputPort1[i] & 1) << i; - DrvInput[2] -= (DrvInputPort2[i] & 1) << i; - } -} - -static struct BurnDIPInfo BublboblDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xfe, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Mode" }, - {0x0f, 0x01, 0x05, 0x04, "Game, English" }, - {0x0f, 0x01, 0x05, 0x05, "Game, Japanese" }, - {0x0f, 0x01, 0x05, 0x01, "Test (Grid and Inputs)" }, - {0x0f, 0x01, 0x05, 0x00, "Test (RAM and Sound)/Pause"}, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x02, 0x02, "Off" }, - {0x0f, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x08, 0x00, "Off" }, - {0x0f, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, - {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Play" }, - {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Plays" }, - {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, - {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Plays" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x10, 0x01, 0x03, 0x02, "Easy" }, - {0x10, 0x01, 0x03, 0x03, "Normal" }, - {0x10, 0x01, 0x03, 0x01, "Hard" }, - {0x10, 0x01, 0x03, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x10, 0x01, 0x0c, 0x08, "20k 80k 300k" }, - {0x10, 0x01, 0x0c, 0x0c, "30k 100k 400k" }, - {0x10, 0x01, 0x0c, 0x04, "40k 200k 500k" }, - {0x10, 0x01, 0x0c, 0x00, "50k 250k 500k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x30, 0x10, "1" }, - {0x10, 0x01, 0x30, 0x00, "2" }, - {0x10, 0x01, 0x30, 0x30, "3" }, - {0x10, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2 , "ROM Type" }, - {0x10, 0x01, 0x80, 0x80, "IC52=512kb, IC53=none" }, - {0x10, 0x01, 0x80, 0x00, "IC52=256kb, IC53=256kb" }, -}; - -STDDIPINFO(Bublbobl) - -static struct BurnDIPInfo BoblboblDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xfe, NULL }, - {0x10, 0xff, 0xff, 0x3f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Mode" }, - {0x0f, 0x01, 0x05, 0x04, "Game, English" }, - {0x0f, 0x01, 0x05, 0x05, "Game, Japanese" }, - {0x0f, 0x01, 0x05, 0x01, "Test (Grid and Inputs)" }, - {0x0f, 0x01, 0x05, 0x00, "Test (RAM and Sound)" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x02, 0x02, "Off" }, - {0x0f, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x08, 0x00, "Off" }, - {0x0f, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, - {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Play" }, - {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Plays" }, - {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, - {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Plays" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x10, 0x01, 0x03, 0x02, "Easy" }, - {0x10, 0x01, 0x03, 0x03, "Normal" }, - {0x10, 0x01, 0x03, 0x01, "Hard" }, - {0x10, 0x01, 0x03, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x10, 0x01, 0x0c, 0x08, "20k 80k 300k" }, - {0x10, 0x01, 0x0c, 0x0c, "30k 100k 400k" }, - {0x10, 0x01, 0x0c, 0x04, "40k 200k 500k" }, - {0x10, 0x01, 0x0c, 0x00, "50k 250k 500k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x30, 0x10, "1" }, - {0x10, 0x01, 0x30, 0x00, "2" }, - {0x10, 0x01, 0x30, 0x30, "3" }, - {0x10, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 4 , "Monster Speed" }, - {0x10, 0x01, 0xc0, 0x00, "Normal" }, - {0x10, 0x01, 0xc0, 0x40, "Medium" }, - {0x10, 0x01, 0xc0, 0x80, "High" }, - {0x10, 0x01, 0xc0, 0xc0, "Very High" }, -}; - -STDDIPINFO(Boblbobl) - -static struct BurnDIPInfo SboblbobDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xfe, NULL }, - {0x10, 0xff, 0xff, 0x3f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Game" }, - {0x0f, 0x01, 0x01, 0x01, "Bobble Bobble" }, - {0x0f, 0x01, 0x01, 0x00, "Super Bobble Bobble" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x02, 0x02, "Off" }, - {0x0f, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0f, 0x01, 0x04, 0x04, "Off" }, - {0x0f, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x08, 0x00, "Off" }, - {0x0f, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, - {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Play" }, - {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Plays" }, - {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, - {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Plays" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x10, 0x01, 0x03, 0x02, "Easy" }, - {0x10, 0x01, 0x03, 0x03, "Normal" }, - {0x10, 0x01, 0x03, 0x01, "Hard" }, - {0x10, 0x01, 0x03, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x10, 0x01, 0x0c, 0x08, "20k 80k 300k" }, - {0x10, 0x01, 0x0c, 0x0c, "30k 100k 400k" }, - {0x10, 0x01, 0x0c, 0x04, "40k 200k 500k" }, - {0x10, 0x01, 0x0c, 0x00, "50k 250k 500k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x30, 0x10, "1" }, - {0x10, 0x01, 0x30, 0x00, "2" }, - {0x10, 0x01, 0x30, 0x30, "3" }, - {0x10, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 4 , "Monster Speed" }, - {0x10, 0x01, 0xc0, 0x00, "Normal" }, - {0x10, 0x01, 0xc0, 0x40, "Medium" }, - {0x10, 0x01, 0xc0, 0x80, "High" }, - {0x10, 0x01, 0xc0, 0xc0, "Very High" }, -}; - -STDDIPINFO(Sboblbob) - -static struct BurnDIPInfo DlandDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0x3f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Game" }, - {0x0f, 0x01, 0x01, 0x01, "Dream Land" }, - {0x0f, 0x01, 0x01, 0x00, "Super Dream Land" }, - - {0 , 0xfe, 0 , 4 , "Mode" }, - {0x0f, 0x01, 0x05, 0x04, "Game, English" }, - {0x0f, 0x01, 0x05, 0x05, "Game, Japanese" }, - {0x0f, 0x01, 0x05, 0x01, "Test (Grid and Inputs)" }, - {0x0f, 0x01, 0x05, 0x00, "Test (RAM and Sound)" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x02, 0x02, "Off" }, - {0x0f, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0f, 0x01, 0x04, 0x00, "Off" }, - {0x0f, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x08, 0x00, "Off" }, - {0x0f, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, - {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Play" }, - {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Plays" }, - {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Plays" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, - {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, - {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Plays" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x10, 0x01, 0x03, 0x02, "Easy" }, - {0x10, 0x01, 0x03, 0x03, "Normal" }, - {0x10, 0x01, 0x03, 0x01, "Hard" }, - {0x10, 0x01, 0x03, 0x00, "Very Hard" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x10, 0x01, 0x0c, 0x08, "20k 80k 300k" }, - {0x10, 0x01, 0x0c, 0x0c, "30k 100k 400k" }, - {0x10, 0x01, 0x0c, 0x04, "40k 200k 500k" }, - {0x10, 0x01, 0x0c, 0x00, "50k 250k 500k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x30, 0x10, "1" }, - {0x10, 0x01, 0x30, 0x00, "2" }, - {0x10, 0x01, 0x30, 0x30, "3" }, - {0x10, 0x01, 0x30, 0x20, "100 (Cheat)" }, - - {0 , 0xfe, 0 , 4 , "Monster Speed" }, - {0x10, 0x01, 0xc0, 0x00, "Normal" }, - {0x10, 0x01, 0xc0, 0x40, "Medium" }, - {0x10, 0x01, 0xc0, 0x80, "High" }, - {0x10, 0x01, 0xc0, 0xc0, "Very High" }, -}; - -STDDIPINFO(Dland) - -static struct BurnInputInfo TokioInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvInputPort0 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvInputPort1 + 6, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvInputPort1 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvInputPort1 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvInputPort1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvInputPort1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvInputPort1 + 5, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvInputPort1 + 4, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvInputPort0 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvInputPort2 + 6, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvInputPort2 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvInputPort2 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvInputPort2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvInputPort2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 5, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvInputPort0 + 1, "service" }, - {"Tilt", BIT_DIGITAL, DrvInputPort0 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, -}; - -STDINPUTINFO(Tokio) - -static struct BurnDIPInfo TokioDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0x7e, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 2, "Enemies" }, - {0x14, 0x01, 0x01, 0x01, "Few (Easy)" }, - {0x14, 0x01, 0x01, 0x00, "Many (Hard)" }, - - {0 , 0xfe, 0 , 2, "Enemy Shots" }, - {0x14, 0x01, 0x02, 0x02, "Few (Easy)" }, - {0x14, 0x01, 0x02, 0x00, "Many (Hard)" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "100K 400K" }, - {0x14, 0x01, 0x0c, 0x08, "200K 400K" }, - {0x14, 0x01, 0x0c, 0x04, "300K 400K" }, - {0x14, 0x01, 0x0c, 0x00, "400K 400K" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - {0x14, 0x01, 0x30, 0x00, "99 (Cheat)" }, - - {0 , 0xfe, 0 , 0, "Language" }, - {0x14, 0x01, 0x80, 0x00, "English" }, - {0x14, 0x01, 0x80, 0x80, "Japanese" }, -}; - -STDDIPINFO(Tokio) - -static struct BurnRomInfo BublboblRomDesc[] = { - { "a78-06-1.51", 0x08000, 0x567934b6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a78-05-1.52", 0x10000, 0x9f8ee242, BRF_ESS | BRF_PRG }, // 1 - - { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 3 Z80 #3 Program - - { "a78-01.17", 0x01000, 0xb1bfb53d, BRF_ESS | BRF_PRG }, // 4 MCU Program - - { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles - { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 - { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 - { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 - { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 - { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 - { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 - { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 - { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 - { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 - { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 - { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 - - { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs - - { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 18 PLDs - { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 19 - { "pal16r4.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 20 -}; - -STD_ROM_PICK(Bublbobl) -STD_ROM_FN(Bublbobl) - -static struct BurnRomInfo Bublbob1RomDesc[] = { - { "a78-06.51", 0x08000, 0x32c8305b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a78-05.52", 0x10000, 0x53f4bc6e, BRF_ESS | BRF_PRG }, // 1 - - { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 3 Z80 #3 Program - - { "a78-01.17", 0x01000, 0xb1bfb53d, BRF_ESS | BRF_PRG }, // 4 MCU Program - - { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles - { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 - { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 - { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 - { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 - { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 - { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 - { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 - { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 - { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 - { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 - { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 - - { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs - - { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 18 PLDs - { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 19 - { "pal16r4.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 20 -}; - -STD_ROM_PICK(Bublbob1) -STD_ROM_FN(Bublbob1) - -static struct BurnRomInfo BublbobrRomDesc[] = { - { "a78-25.51", 0x08000, 0x2d901c9d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a78-24.52", 0x10000, 0xb7afedc4, BRF_ESS | BRF_PRG }, // 1 - - { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 3 Z80 #3 Program - - { "a78-01.17", 0x01000, 0xb1bfb53d, BRF_ESS | BRF_PRG }, // 4 MCU Program - - { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles - { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 - { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 - { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 - { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 - { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 - { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 - { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 - { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 - { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 - { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 - { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 - - { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs - - { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 18 PLDs - { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 19 - { "pal16r4.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 20 -}; - -STD_ROM_PICK(Bublbobr) -STD_ROM_FN(Bublbobr) - -static struct BurnRomInfo Bubbobr1RomDesc[] = { - { "a78-06.51", 0x08000, 0x32c8305b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a78-21.52", 0x10000, 0x2844033d, BRF_ESS | BRF_PRG }, // 1 - - { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program - - { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 3 Z80 #3 Program - - { "a78-01.17", 0x01000, 0xb1bfb53d, BRF_ESS | BRF_PRG }, // 4 MCU Program - - { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles - { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 - { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 - { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 - { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 - { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 - { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 - { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 - { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 - { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 - { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 - { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 - - { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs - - { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 18 PLDs - { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 19 - { "pal16r4.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 20 -}; - -STD_ROM_PICK(Bubbobr1) -STD_ROM_FN(Bubbobr1) - -static struct BurnRomInfo BoblboblRomDesc[] = { - { "bb3", 0x08000, 0x01f81936, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bb5", 0x08000, 0x13118eb1, BRF_ESS | BRF_PRG }, // 1 - { "bb4", 0x08000, 0xafda99d8, BRF_ESS | BRF_PRG }, // 2 - - { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program - - { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles - { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 - { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 - { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 - { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 - { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 - { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 - { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 - { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 - { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 - { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 - { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 - - { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs - - { "pal16r4.u36", 0x00104, 0x22fe26ac, BRF_OPT }, // 18 PLDs - { "pal16l8.u38", 0x00104, 0xc02d9663, BRF_OPT }, // 19 - { "pal16l8.u4", 0x00104, 0x077d20a8, BRF_OPT }, // 20 -}; - -STD_ROM_PICK(Boblbobl) -STD_ROM_FN(Boblbobl) - -static struct BurnRomInfo Boblbobl2RomDesc[] = { - { "cpu2-3.bin", 0x08000, 0x2d9107b6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bb5", 0x08000, 0x13118eb1, BRF_ESS | BRF_PRG }, // 1 - { "cpu2-4.bin", 0x08000, 0x3f9fed10, BRF_ESS | BRF_PRG }, // 2 - - { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program - - { "gfx7.bin", 0x10000, 0x702f61c0, BRF_GRA }, // 5 Tiles - { "gfx8.bin", 0x10000, 0x677840e8, BRF_GRA }, // 6 - { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 7 - { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 8 - { "gfx10.bin", 0x10000, 0xd370f499, BRF_GRA }, // 9 - { "gfx11.bin", 0x10000, 0x76f2b367, BRF_GRA }, // 10 - { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 11 - - { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 12 PROMs -}; - -STD_ROM_PICK(Boblbobl2) -STD_ROM_FN(Boblbobl2) - -static struct BurnRomInfo SboblboaRomDesc[] = { - { "1c.bin", 0x08000, 0xf304152a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "1a.bin", 0x08000, 0x0865209c, BRF_ESS | BRF_PRG }, // 1 - { "1b.bin", 0x08000, 0x1f29b5c0, BRF_ESS | BRF_PRG }, // 2 - - { "1e.rom", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "1d.rom", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program - - { "1l.rom", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles - { "1m.rom", 0x08000, 0x930168a9, BRF_GRA }, // 6 - { "1n.rom", 0x08000, 0x9773e512, BRF_GRA }, // 7 - { "1o.rom", 0x08000, 0xd045549b, BRF_GRA }, // 8 - { "1p.rom", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 - { "1q.rom", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 - { "1f.rom", 0x08000, 0x6b61a413, BRF_GRA }, // 11 - { "1g.rom", 0x08000, 0xb5492d97, BRF_GRA }, // 12 - { "1h.rom", 0x08000, 0xd69762d5, BRF_GRA }, // 13 - { "1i.rom", 0x08000, 0x9f243b68, BRF_GRA }, // 14 - { "1j.rom", 0x08000, 0x66e9438c, BRF_GRA }, // 15 - { "1k.rom", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 - - { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs -}; - -STD_ROM_PICK(Sboblboa) -STD_ROM_FN(Sboblboa) - -static struct BurnRomInfo SboblbobRomDesc[] = { - { "bbb-3.rom", 0x08000, 0xf304152a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "bb5", 0x08000, 0x13118eb1, BRF_ESS | BRF_PRG }, // 1 - { "bbb-4.rom", 0x08000, 0x94c75591, BRF_ESS | BRF_PRG }, // 2 - - { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program - - { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles - { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 - { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 - { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 - { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 - { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 - { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 - { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 - { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 - { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 - { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 - { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 - - { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs -}; - -STD_ROM_PICK(Sboblbob) -STD_ROM_FN(Sboblbob) - -static struct BurnRomInfo Bub68705RomDesc[] = { - { "2.bin", 0x08000, 0x32c8305b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "3-1.bin", 0x08000, 0x980c2615, BRF_ESS | BRF_PRG }, // 1 - { "3.bin", 0x08000, 0xe6c698f2, BRF_ESS | BRF_PRG }, // 2 - - { "4.bin", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "1.bin", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program - - { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles - { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 - { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 - { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 - { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 - { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 - { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 - { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 - { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 - { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 - { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 - { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 - - { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs - - { "68705.bin", 0x00800, 0x78caa635, BRF_ESS | BRF_PRG }, // 18 68705 Program Code -}; - -STD_ROM_PICK(Bub68705) -STD_ROM_FN(Bub68705) - - - -static struct BurnRomInfo DlandRomDesc[] = { - { "dl_3.u69", 0x08000, 0x01eb3e4f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "dl_5.u67", 0x08000, 0x75740b61, BRF_ESS | BRF_PRG }, // 1 - { "dl_4.u68", 0x08000, 0xc6a3776f, BRF_ESS | BRF_PRG }, // 2 - - { "dl_1.u42", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program - - { "dl_2.u74", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program - - { "dl_6.58", 0x10000, 0x6352d3fa, BRF_GRA }, // 5 Tiles - { "dl_7.59", 0x10000, 0x37a38b69, BRF_GRA }, // 6 - { "dl_8.60", 0x10000, 0x509ee5b1, BRF_GRA }, // 7 - { "dl_9.61", 0x10000, 0xae8514d7, BRF_GRA }, // 8 - { "dl_10.62", 0x10000, 0x6d406fb7, BRF_GRA }, // 9 - { "dl_11.63", 0x10000, 0xbdf9c0ab, BRF_GRA }, // 10 - - { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 11 PROMs -}; - -STD_ROM_PICK(Dland) -STD_ROM_FN(Dland) - - -static struct BurnRomInfo tokioRomDesc[] = { - { "a71-02-1.ic4", 0x8000, 0xBB8DABD7, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program - { "a71-03-1.ic5", 0x8000, 0xEE49B383, BRF_ESS | BRF_PRG }, // 1 - { "a71-04.ic6", 0x8000, 0xa0a4ce0e, BRF_ESS | BRF_PRG }, // 2 - { "a71-05.ic7", 0x8000, 0x6da0b945, BRF_ESS | BRF_PRG }, // 3 - { "a71-06-1.ic8", 0x8000, 0x56927b3f, BRF_ESS | BRF_PRG }, // 4 - - { "a71-01.ic1", 0x8000, 0x0867c707, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program - - { "a71-07.ic10", 0x8000, 0xf298cc7b, BRF_ESS | BRF_PRG }, // 6 Z80 #3 Program - - { "a71-08.ic12", 0x8000, 0x0439ab13, BRF_GRA }, // 7 Tiles - { "a71-09.ic13", 0x8000, 0xedb3d2ff, BRF_GRA }, // 8 - { "a71-10.ic14", 0x8000, 0x69f0888c, BRF_GRA }, // 9 - { "a71-11.ic15", 0x8000, 0x4ae07c31, BRF_GRA }, // 10 - { "a71-12.ic16", 0x8000, 0x3f6bd706, BRF_GRA }, // 11 - { "a71-13.ic17", 0x8000, 0xf2c92aaa, BRF_GRA }, // 12 - { "a71-14.ic18", 0x8000, 0xc574b7b2, BRF_GRA }, // 13 - { "a71-15.ic19", 0x8000, 0x12d87e7f, BRF_GRA }, // 14 - { "a71-16.ic30", 0x8000, 0x0bce35b6, BRF_GRA }, // 15 - { "a71-17.ic31", 0x8000, 0xdeda6387, BRF_GRA }, // 16 - { "a71-18.ic32", 0x8000, 0x330cd9d7, BRF_GRA }, // 17 - { "a71-19.ic33", 0x8000, 0xfc4b29e0, BRF_GRA }, // 18 - { "a71-20.ic34", 0x8000, 0x65acb265, BRF_GRA }, // 19 - { "a71-21.ic35", 0x8000, 0x33cde9b2, BRF_GRA }, // 20 - { "a71-22.ic36", 0x8000, 0xfb98eac0, BRF_GRA }, // 21 - { "a71-23.ic37", 0x8000, 0x30bd46ad, BRF_GRA }, // 22 - - { "a71-25.ic41", 0x0100, 0x2d0f8545, BRF_GRA }, // 23 PROMs - - { "a71-24.ic57", 0x0800, 0x00000000, 6 | BRF_NODUMP }, // 24 Mcu Code - - { "a71-26.ic19", 0x0117, 0x4e1f119c, 7 | BRF_OPT }, // 25 PLDs -}; - -STD_ROM_PICK(tokio) -STD_ROM_FN(tokio) - -static struct BurnRomInfo tokiooRomDesc[] = { - { "a71-02.ic4", 0x8000, 0xd556c908, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program - { "a71-03.ic5", 0x8000, 0x69dacf44, BRF_ESS | BRF_PRG }, // 1 - { "a71-04.ic6", 0x8000, 0xa0a4ce0e, BRF_ESS | BRF_PRG }, // 2 - { "a71-05.ic7", 0x8000, 0x6da0b945, BRF_ESS | BRF_PRG }, // 3 - { "a71-06.ic8", 0x8000, 0x447d6779, BRF_ESS | BRF_PRG }, // 4 - - { "a71-01.ic1", 0x8000, 0x0867c707, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program - - { "a71-07.ic10", 0x8000, 0xf298cc7b, BRF_ESS | BRF_PRG }, // 6 Z80 #3 Program - - { "a71-08.ic12", 0x8000, 0x0439ab13, BRF_GRA }, // 7 Tiles - { "a71-09.ic13", 0x8000, 0xedb3d2ff, BRF_GRA }, // 8 - { "a71-10.ic14", 0x8000, 0x69f0888c, BRF_GRA }, // 9 - { "a71-11.ic15", 0x8000, 0x4ae07c31, BRF_GRA }, // 10 - { "a71-12.ic16", 0x8000, 0x3f6bd706, BRF_GRA }, // 11 - { "a71-13.ic17", 0x8000, 0xf2c92aaa, BRF_GRA }, // 12 - { "a71-14.ic18", 0x8000, 0xc574b7b2, BRF_GRA }, // 13 - { "a71-15.ic19", 0x8000, 0x12d87e7f, BRF_GRA }, // 14 - { "a71-16.ic30", 0x8000, 0x0bce35b6, BRF_GRA }, // 15 - { "a71-17.ic31", 0x8000, 0xdeda6387, BRF_GRA }, // 16 - { "a71-18.ic32", 0x8000, 0x330cd9d7, BRF_GRA }, // 17 - { "a71-19.ic33", 0x8000, 0xfc4b29e0, BRF_GRA }, // 18 - { "a71-20.ic34", 0x8000, 0x65acb265, BRF_GRA }, // 19 - { "a71-21.ic35", 0x8000, 0x33cde9b2, BRF_GRA }, // 20 - { "a71-22.ic36", 0x8000, 0xfb98eac0, BRF_GRA }, // 21 - { "a71-23.ic37", 0x8000, 0x30bd46ad, BRF_GRA }, // 22 - - { "a71-25.ic41", 0x0100, 0x2d0f8545, BRF_GRA }, // 23 PROMs - - { "a71-24.ic57", 0x0800, 0x00000000, 6 | BRF_NODUMP }, // 24 Mcu Code - - { "a71-26.ic19", 0x0117, 0x4e1f119c, 7 | BRF_OPT }, // 25 PLDs -}; - -STD_ROM_PICK(tokioo) -STD_ROM_FN(tokioo) - -static struct BurnRomInfo tokiouRomDesc[] = { - { "a71-27-1.ic4", 0x8000, 0x8c180896, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a71-28-1.ic5", 0x8000, 0x1b447527, BRF_ESS | BRF_PRG }, // 1 - { "a71-04.ic6", 0x8000, 0xa0a4ce0e, BRF_ESS | BRF_PRG }, // 2 - { "a71-05.ic7", 0x8000, 0x6da0b945, BRF_ESS | BRF_PRG }, // 3 - { "a71-06-1.ic8", 0x8000, 0x56927b3f, BRF_ESS | BRF_PRG }, // 4 - - { "a71-01.ic1", 0x8000, 0x0867c707, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program - - { "a71-07.ic10", 0x8000, 0xf298cc7b, BRF_ESS | BRF_PRG }, // 6 Z80 #3 Program - - { "a71-08.ic12", 0x8000, 0x0439ab13, BRF_GRA }, // 7 Tiles - { "a71-09.ic13", 0x8000, 0xedb3d2ff, BRF_GRA }, // 8 - { "a71-10.ic14", 0x8000, 0x69f0888c, BRF_GRA }, // 9 - { "a71-11.ic15", 0x8000, 0x4ae07c31, BRF_GRA }, // 10 - { "a71-12.ic16", 0x8000, 0x3f6bd706, BRF_GRA }, // 11 - { "a71-13.ic17", 0x8000, 0xf2c92aaa, BRF_GRA }, // 12 - { "a71-14.ic18", 0x8000, 0xc574b7b2, BRF_GRA }, // 13 - { "a71-15.ic19", 0x8000, 0x12d87e7f, BRF_GRA }, // 14 - { "a71-16.ic30", 0x8000, 0x0bce35b6, BRF_GRA }, // 15 - { "a71-17.ic31", 0x8000, 0xdeda6387, BRF_GRA }, // 16 - { "a71-18.ic32", 0x8000, 0x330cd9d7, BRF_GRA }, // 17 - { "a71-19.ic33", 0x8000, 0xfc4b29e0, BRF_GRA }, // 18 - { "a71-20.ic34", 0x8000, 0x65acb265, BRF_GRA }, // 19 - { "a71-21.ic35", 0x8000, 0x33cde9b2, BRF_GRA }, // 20 - { "a71-22.ic36", 0x8000, 0xfb98eac0, BRF_GRA }, // 21 - { "a71-23.ic37", 0x8000, 0x30bd46ad, BRF_GRA }, // 22 - - { "a71-25.ic41", 0x0100, 0x2d0f8545, BRF_GRA }, // 23 PROMs - - { "a71-24.ic57", 0x0800, 0x00000000, 6 | BRF_NODUMP }, // 24 Mcu Code - - { "a71-26.ic19", 0x0117, 0x4e1f119c, 7 | BRF_OPT }, // 25 PLDs -}; - -STD_ROM_PICK(tokiou) -STD_ROM_FN(tokiou) - -static struct BurnRomInfo tokiobRomDesc[] = { - { "2.ic4", 0x8000, 0xf583b1ef, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code - { "a71-03.ic5", 0x8000, 0x69dacf44, BRF_ESS | BRF_PRG }, // 1 - { "a71-04.ic6", 0x8000, 0xa0a4ce0e, BRF_ESS | BRF_PRG }, // 2 - { "a71-05.ic7", 0x8000, 0x6da0b945, BRF_ESS | BRF_PRG }, // 3 - { "6.ic8", 0x8000, 0x1490e95b, BRF_ESS | BRF_PRG }, // 4 - - { "a71-01.ic1", 0x8000, 0x0867c707, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program - - { "a71-07.ic10", 0x8000, 0xf298cc7b, BRF_ESS | BRF_PRG }, // 6 Z80 #3 Program - - { "a71-08.ic12", 0x8000, 0x0439ab13, BRF_GRA }, // 7 Tiles - { "a71-09.ic13", 0x8000, 0xedb3d2ff, BRF_GRA }, // 8 - { "a71-10.ic14", 0x8000, 0x69f0888c, BRF_GRA }, // 9 - { "a71-11.ic15", 0x8000, 0x4ae07c31, BRF_GRA }, // 10 - { "a71-12.ic16", 0x8000, 0x3f6bd706, BRF_GRA }, // 11 - { "a71-13.ic17", 0x8000, 0xf2c92aaa, BRF_GRA }, // 12 - { "a71-14.ic18", 0x8000, 0xc574b7b2, BRF_GRA }, // 13 - { "a71-15.ic19", 0x8000, 0x12d87e7f, BRF_GRA }, // 14 - { "a71-16.ic30", 0x8000, 0x0bce35b6, BRF_GRA }, // 15 - { "a71-17.ic31", 0x8000, 0xdeda6387, BRF_GRA }, // 16 - { "a71-18.ic32", 0x8000, 0x330cd9d7, BRF_GRA }, // 17 - { "a71-19.ic33", 0x8000, 0xfc4b29e0, BRF_GRA }, // 18 - { "a71-20.ic34", 0x8000, 0x65acb265, BRF_GRA }, // 19 - { "a71-21.ic35", 0x8000, 0x33cde9b2, BRF_GRA }, // 20 - { "a71-22.ic36", 0x8000, 0xfb98eac0, BRF_GRA }, // 21 - { "a71-23.ic37", 0x8000, 0x30bd46ad, BRF_GRA }, // 22 - - { "a71-25.ic41", 0x0100, 0x2d0f8545, BRF_GRA }, // 23 PROMs -}; - -STD_ROM_PICK(tokiob) -STD_ROM_FN(tokiob) - - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - - DrvZ80Rom1 = Next; Next += 0x30000; - DrvZ80Rom2 = Next; Next += 0x08000; - DrvZ80Rom3 = Next; Next += 0x0a000; - DrvProm = Next; Next += 0x00100; - if (DrvMCUInUse) { - DrvMcuRom = Next; Next += 0x01000; - } - - RamStart = Next; - - DrvPaletteRam = Next; Next += 0x00200; - DrvVideoRam = Next; Next += 0x01d00; - DrvZ80Ram1 = Next; Next += 0x00400; - DrvZ80Ram3 = Next; Next += 0x01000; - DrvSharedRam = Next; Next += 0x01800; - DrvMcuRam = Next; Next += 0x000c0; - DrvSpriteRam = Next; Next += 0x00300; - - RamEnd = Next; - - DrvTiles = Next; Next += 0x4000 * 8 * 8; - DrvPalette = (UINT32*)Next; Next += 0x00100 * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvDoReset() -{ - for (INT32 i = 0; i < 3; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - if (DrvMCUInUse == 1) { - M6801Reset(); - } else if (DrvMCUInUse == 2) { - m67805_taito_reset(); - } - - BurnYM3526Reset(); - BurnYM2203Reset(); - - DrvRomBank = 0; - DrvSlaveCPUActive = 0; - DrvSoundCPUActive = 0; - DrvMCUActive = 0; - DrvVideoEnable = 0; - DrvFlipScreen = 0; - IC43A = 0; - IC43B = 0; - DrvSoundStatus = 0; - DrvSoundNmiEnable = 0; - DrvSoundNmiPending = 0; - DrvSoundLatch = 0; - mcu_latch = 0; - mcu_address = 0; - - return 0; -} - -static INT32 TokioDoReset() -{ - for (INT32 i = 0; i < 3; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - BurnYM2203Reset(); - - DrvRomBank = 0; - DrvVideoEnable = 1; - DrvFlipScreen = 0; - DrvSoundStatus = 0; - DrvSoundNmiEnable = 0; - DrvSoundNmiPending = 0; - DrvSoundLatch = 0; - - return 0; -} - -UINT8 __fastcall BublboblRead1(UINT16 a) -{ - switch (a) { - case 0xfa00: { - return DrvSoundStatus; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall BublboblWrite1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xfa00: { - DrvSoundLatch = d; - DrvSoundNmiPending = 1; - return; - } - - case 0xfa03: { - if (d) { - ZetClose(); - ZetOpen(2); - ZetReset(); - ZetClose(); - ZetOpen(0); - DrvSoundCPUActive = 0; - } else { - DrvSoundCPUActive = 1; - } - return; - } - - case 0xfa80: { - // watchdog reset - return; - } - case 0xfb40: { - DrvRomBank = (d ^ 0x04) & 0x07; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - - if (!(d & 0x10)) { - ZetClose(); - ZetOpen(1); - ZetReset(); - ZetClose(); - ZetOpen(0); - DrvSlaveCPUActive = 0; - } else { - DrvSlaveCPUActive = 1; - } - - if (!(d & 0x20)) { - if (DrvMCUInUse == 2) { - m67805_taito_reset(); - } else { - M6801Reset(); - } - DrvMCUActive = 0; - } else { - DrvMCUActive = 1; - } - - DrvVideoEnable = d & 0x40; - DrvFlipScreen = d & 0x80; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall BoblboblRead1(UINT16 a) -{ - switch (a) { - case 0xfe00: { - return IC43A << 4; - } - - case 0xfe01: - case 0xfe02: - case 0xfe03: { - return rand() & 0xff; - } - - case 0xfe80: { - return IC43B << 4; - } - - case 0xfe81: - case 0xfe82: - case 0xfe83: { - return 0xff; - } - - case 0xff00: { - return DrvDip[0]; - } - - case 0xff01: { - return DrvDip[1]; - } - - case 0xff02: { - return DrvInput[0]; - } - - case 0xff03: { - return DrvInput[1]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall BoblboblWrite1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xfa00: { - DrvSoundLatch = d; - DrvSoundNmiPending = 1; - return; - } - - case 0xfa03: { - if (d) { - ZetClose(); - ZetOpen(2); - ZetReset(); - ZetClose(); - ZetOpen(0); - DrvSoundCPUActive = 0; - } else { - DrvSoundCPUActive = 1; - } - return; - } - - case 0xfa80: { - // nop - return; - } - - case 0xfb40: { - DrvRomBank = (d ^ 0x04) & 0x07; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - - if (!(d & 0x10)) { - ZetClose(); - ZetOpen(1); - ZetReset(); - ZetClose(); - ZetOpen(0); - DrvSlaveCPUActive = 0; - } else { - DrvSlaveCPUActive = 1; - } - - DrvVideoEnable = d & 0x40; - DrvFlipScreen = d & 0x80; - return; - } - - case 0xfe00: - case 0xfe01: - case 0xfe02: - case 0xfe03: { - INT32 Res = 0; - INT32 Offset = a - 0xfe00; - - switch (Offset) { - case 0x00: { - if (~IC43A & 8) Res ^= 1; - if (~IC43A & 1) Res ^= 2; - if (~IC43A & 1) Res ^= 4; - if (~IC43A & 2) Res ^= 4; - if (~IC43A & 4) Res ^= 8; - break; - } - - case 0x01: { - if (~IC43A & 8) Res ^= 1; - if (~IC43A & 2) Res ^= 1; - if (~IC43A & 8) Res ^= 2; - if (~IC43A & 1) Res ^= 4; - if (~IC43A & 4) Res ^= 8; - break; - } - - case 0x02: { - if (~IC43A & 4) Res ^= 1; - if (~IC43A & 8) Res ^= 2; - if (~IC43A & 2) Res ^= 4; - if (~IC43A & 1) Res ^= 8; - if (~IC43A & 4) Res ^= 8; - break; - } - - case 0x03: { - if (~IC43A & 2) Res ^= 1; - if (~IC43A & 4) Res ^= 2; - if (~IC43A & 8) Res ^= 2; - if (~IC43A & 8) Res ^= 4; - if (~IC43A & 1) Res ^= 8; - break; - } - } - - IC43A = Res; - return; - } - - case 0xfe80: - case 0xfe81: - case 0xfe82: - case 0xfe83: { - INT32 Offset = a - 0xfe80; - static const INT32 XorVal[4] = { 4, 1, 8, 2 }; - - IC43B = (d >> 4) ^ XorVal[Offset]; - return; - } - - case 0xff94: - case 0xff98: { - // nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall DrvSoundRead3(UINT16 a) -{ - switch (a) { - case 0x9000: { - return BurnYM2203Read(0, 0); - } - - case 0x9001: { - return BurnYM2203Read(0, 1); - } - - case 0xa000: { - return BurnYM3526Read(0); - } - - case 0xb000: { - return DrvSoundLatch; - } - - case 0xb001: { - // nop - return 0; - } - - case 0xe000: { - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #3 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall DrvSoundWrite3(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x9000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0x9001: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0xa000: { - BurnYM3526Write(0, d); - return; - } - - case 0xa001: { - BurnYM3526Write(1, d); - return; - } - - case 0xb000: { - DrvSoundStatus = d; - return; - } - - case 0xb001: { - DrvSoundNmiEnable = 1; - if (DrvSoundNmiPending) { - ZetNmi(); - DrvSoundNmiPending = 0; - } - return; - } - - case 0xb002: { - DrvSoundNmiEnable = 0; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #3 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 BublboblMcuReadByte(UINT16 Address) -{ - if (Address >= 0x0040 && Address <= 0x00ff) { - return DrvMcuRam[Address - 0x0040]; - } - - switch (Address) { - case 0x00: { - return ddr1; - } - - case 0x01: { - return ddr2; - } - - case 0x02: { - port1_in = DrvInput[0]; - return (port1_out & ddr1) | (port1_in & ~ddr1); - } - - case 0x03: { - return (port2_out & ddr2) | (port2_in & ~ddr2); - } - - case 0x04: { - return ddr3; - } - - case 0x05: { - return ddr4; - } - - case 0x06: { - return (port3_out & ddr3) | (port3_in & ~ddr3); - } - - case 0x07: { - return (port4_out & ddr4) | (port4_in & ~ddr4); - } - } - - bprintf(PRINT_NORMAL, _T("M6801 Read Byte -> %04X\n"), Address); - - return 0; -} - -void BublboblMcuWriteByte(UINT16 Address, UINT8 Data) -{ - if (Address >= 0x0040 && Address <= 0x00ff) { - DrvMcuRam[Address - 0x0040] = Data; - return; - } - - if (Address > 7 && Address <= 0x001f) { - m6803_internal_registers_w(Address, Data); - if (Address > 7) return; - } - - switch (Address) { - case 0x00: { - ddr1 = Data; - return; - } - - case 0x01: { - ddr2 = Data; - return; - } - - case 0x02: { - if ((port1_out & 0x40) && (~Data & 0x40)) { - ZetOpen(0); - ZetSetVector(DrvZ80Ram1[0]); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - } - - port1_out = Data; - return; - } - - case 0x03: { - if ((~port2_out & 0x10) && (Data & 0x10)) { - INT32 nAddress = port4_out | ((Data & 0x0f) << 8); - - if (port1_out & 0x80) { - if (nAddress == 0x0000) port3_in = DrvDip[0]; - if (nAddress == 0x0001) port3_in = DrvDip[1]; - if (nAddress == 0x0002) port3_in = DrvInput[1]; - if (nAddress == 0x0003) port3_in = DrvInput[2]; - - if (nAddress >= 0x0c00 && nAddress <= 0x0fff) port3_in = DrvZ80Ram1[nAddress - 0x0c00]; - } else { - if (nAddress >= 0x0c00 && nAddress <= 0x0fff) DrvZ80Ram1[nAddress - 0x0c00] = port3_out; - } - } - - port2_out = Data; - return; - } - - case 0x04: { - ddr3 = Data; - return; - } - - case 0x05: { - ddr4 = Data; - return; - } - - case 0x06: { - port3_out = Data; - return; - } - - case 0x07: { - port4_out = Data; - return; - } - } - - bprintf(PRINT_NORMAL, _T("M6801 Write Byte -> %04X, %02X\n"), Address, Data); -} - -void bublbobl_68705_portB_out(UINT8 *bytevalue) -{ - INT32 data = *bytevalue;//lazy - - if ((ddrB & 0x01) && (~data & 0x01) && (portB_out & 0x01)) - { - portA_in = mcu_latch; - } - if ((ddrB & 0x02) && (data & 0x02) && (~portB_out & 0x02)) - { - mcu_address = (mcu_address & 0xff00) | portA_out; - } - if ((ddrB & 0x04) && (data & 0x04) && (~portB_out & 0x04)) - { - mcu_address = (mcu_address & 0x00ff) | ((portA_out & 0x0f) << 8); - } - if ((ddrB & 0x10) && (~data & 0x10) && (portB_out & 0x10)) - { - if (data & 0x08) /* read */ - { - if ((mcu_address & 0x0800) == 0x0000) - { - switch (mcu_address & 3) { - case 0: mcu_latch = DrvDip[0]; break; - case 1: mcu_latch = DrvDip[1]; break; - case 2: mcu_latch = DrvInput[1]; break; - case 3: mcu_latch = DrvInput[2]; break; - } - } - else if ((mcu_address & 0x0c00) == 0x0c00) - { - mcu_latch = DrvZ80Ram1[mcu_address & 0x03ff]; - } - } - else - { - if ((mcu_address & 0x0c00) == 0x0c00) - { - DrvZ80Ram1[mcu_address & 0x03ff] = portA_out; - } - } - } - if ((ddrB & 0x20) && (~data & 0x20) && (portB_out & 0x20)) - { - ZetOpen(0); - - /* hack to get random EXTEND letters (who is supposed to do this? 68705? PAL?) */ - DrvZ80Ram1[0x7c] = (ZetTotalCycles() ^ ZetPc(-1)) % 6; - - ZetSetVector(DrvZ80Ram1[0]); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - } -} - -static void bublbobl_68705_portC_in() -{ - portC_out = DrvInput[0]; - ddrC = 0xff; -} - -static m68705_interface bub68705_m68705_interface = { - NULL, bublbobl_68705_portB_out, NULL, - NULL, NULL, NULL, - NULL, NULL, bublbobl_68705_portC_in -}; - - -void __fastcall TokioWrite1(UINT16 a, UINT8 d) -{ - switch (a) - { - case 0xfa80: { - DrvRomBank = d & 0x07; - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - return; - } - - case 0xfb00: { - DrvFlipScreen = d & 0x80; - return; - } - - case 0xfb80: { - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - return; - } - - case 0xfc00: { - DrvSoundLatch = d; - DrvSoundNmiPending = 1; - return; - } - } -} - -UINT8 __fastcall TokioRead1(UINT16 a) -{ - switch (a) - { - case 0xfa03: { - return DrvDip[0]; - } - - case 0xfa04: { - return DrvDip[1]; - } - - case 0xfa05: { - return DrvInput[0] & ~0x20; - } - - case 0xfa06: { - return DrvInput[1]; - } - - case 0xfa07: { - return DrvInput[2]; - } - - case 0xfc00: { - return DrvSoundStatus; - } - - case 0xfe00: { - return 0xbf; // Mcu read... - } - } - - return 0; -} - -void __fastcall TokioSoundWrite3(UINT16 a, UINT8 d) -{ - switch (a) - { - case 0x9000: { - DrvSoundStatus = d; - return; - } - - case 0xa000: { - DrvSoundNmiEnable = 0; - return; - } - - case 0xa800: { - DrvSoundNmiEnable = 1; - if (DrvSoundNmiPending) { - ZetNmi(); - DrvSoundNmiPending = 0; - } - return; - } - - case 0xb000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0xb001: { - BurnYM2203Write(0, 1, d); - return; - } - } -} - -UINT8 __fastcall TokioSoundRead3(UINT16 a) -{ - switch (a) - { - case 0x9000: { - return DrvSoundLatch; - } - - case 0xb000: { - return BurnYM2203Read(0, 0); - } - - case 0xb001: { - return BurnYM2203Read(0, 1); - } - } - - return 0; -} - -inline static void DrvYM2203IRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3000000; -} - -inline static INT32 DrvYM3526SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 6000000; -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 3000000; -} - -static INT32 TilePlaneOffsets[4] = { 0, 4, 0x200000, 0x200004 }; -static INT32 TileXOffsets[8] = { 3, 2, 1, 0, 11, 10, 9, 8 }; -static INT32 TileYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; - -static INT32 MachineInit() -{ - INT32 nLen; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(BublboblRead1); - ZetSetWriteHandler(BublboblWrite1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0xc000, 0xdcff, 0, DrvVideoRam ); - ZetMapArea(0xc000, 0xdcff, 1, DrvVideoRam ); - ZetMapArea(0xc000, 0xdcff, 2, DrvVideoRam ); - ZetMapArea(0xdd00, 0xdfff, 0, DrvSpriteRam ); - ZetMapArea(0xdd00, 0xdfff, 1, DrvSpriteRam ); - ZetMapArea(0xdd00, 0xdfff, 2, DrvSpriteRam ); - ZetMapArea(0xe000, 0xf7ff, 0, DrvSharedRam ); - ZetMapArea(0xe000, 0xf7ff, 1, DrvSharedRam ); - ZetMapArea(0xe000, 0xf7ff, 2, DrvSharedRam ); - ZetMapArea(0xf800, 0xf9ff, 0, DrvPaletteRam ); - ZetMapArea(0xf800, 0xf9ff, 1, DrvPaletteRam ); - ZetMapArea(0xf800, 0xf9ff, 2, DrvPaletteRam ); - ZetMapArea(0xfc00, 0xffff, 0, DrvZ80Ram1 ); - ZetMapArea(0xfc00, 0xffff, 1, DrvZ80Ram1 ); - ZetMapArea(0xfc00, 0xffff, 2, DrvZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2 ); - ZetMapArea(0xe000, 0xf7ff, 0, DrvSharedRam ); - ZetMapArea(0xe000, 0xf7ff, 1, DrvSharedRam ); - ZetMapArea(0xe000, 0xf7ff, 2, DrvSharedRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(2); - ZetOpen(2); - ZetSetReadHandler(DrvSoundRead3); - ZetSetWriteHandler(DrvSoundWrite3); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom3 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom3 ); - ZetMapArea(0x8000, 0x8fff, 0, DrvZ80Ram3 ); - ZetMapArea(0x8000, 0x8fff, 1, DrvZ80Ram3 ); - ZetMapArea(0x8000, 0x8fff, 2, DrvZ80Ram3 ); - ZetMemEnd(); - ZetClose(); - - if (DrvMCUInUse == 1) { - M6801Init(1); - M6801MapMemory(DrvMcuRom, 0xf000, 0xffff, M6801_ROM); - M6801SetReadHandler(BublboblMcuReadByte); - M6801SetWriteHandler(BublboblMcuWriteByte); - } else if (DrvMCUInUse == 2) { - - m67805_taito_init(DrvMcuRom, DrvMcuRam, &bub68705_m68705_interface); - } - - BurnYM2203Init(1, 3000000, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - - BurnYM3526Init(3000000, NULL, &DrvYM3526SynchroniseStream, 1); - BurnTimerAttachZetYM3526(6000000); - BurnYM3526SetRoute(BURN_SND_YM3526_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); - - if (BublboblCallbackFunction()) return 1; - - GenericTilesInit(); - - // Reset the driver - DrvDoReset(); - - return 0; -} - -static INT32 BublboblCallback() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #3 Program Roms - nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load MCU Rom - nRet = BurnLoadRom(DrvMcuRom + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x18000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x28000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x48000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x58000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x68000, 16, 1); if (nRet != 0) return 1; - for (INT32 i = 0; i < 0x80000; i++) DrvTempRom[i] ^= 0xff; - GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); - - // Load the PROM - nRet = BurnLoadRom(DrvProm + 0x00000, 17, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 BublboblInit() -{ - BublboblCallbackFunction = BublboblCallback; - - DrvMCUInUse = 1; - - return MachineInit(); -} - -static INT32 BoblboblCallback() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load Z80 #3 Program Roms - nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x18000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x28000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x48000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x58000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x68000, 16, 1); if (nRet != 0) return 1; - for (INT32 i = 0; i < 0x80000; i++) DrvTempRom[i] ^= 0xff; - GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); - - // Load the PROM - nRet = BurnLoadRom(DrvProm + 0x00000, 17, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - ZetOpen(0); - ZetSetReadHandler(BoblboblRead1); - ZetSetWriteHandler(BoblboblWrite1); - ZetMemCallback(0xfe00, 0xffff, 0); - ZetMemCallback(0xfe00, 0xffff, 1); - ZetMemCallback(0xfe00, 0xffff, 2); - ZetMemEnd(); - ZetClose(); - - return 0; -} - -static INT32 Boblbobl2Callback() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load Z80 #3 Program Roms - nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x28000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x68000, 11, 1); if (nRet != 0) return 1; - for (INT32 i = 0; i < 0x80000; i++) DrvTempRom[i] ^= 0xff; - GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); - - // Load the PROM - nRet = BurnLoadRom(DrvProm + 0x00000, 12, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - ZetOpen(0); - ZetSetReadHandler(BoblboblRead1); - ZetSetWriteHandler(BoblboblWrite1); - ZetMemCallback(0xfe00, 0xffff, 0); - ZetMemCallback(0xfe00, 0xffff, 1); - ZetMemCallback(0xfe00, 0xffff, 2); - ZetMemEnd(); - ZetClose(); - - return 0; -} - -static INT32 BoblboblInit() -{ - BublboblCallbackFunction = BoblboblCallback; - - return MachineInit(); -} - -static INT32 Boblbobl2Init() -{ - BublboblCallbackFunction = Boblbobl2Callback; - - return MachineInit(); -} - -static INT32 Bub68705Callback() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load Z80 #3 Program Roms - nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x18000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x28000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x48000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x58000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x68000, 16, 1); if (nRet != 0) return 1; - - for (INT32 i = 0x00000; i < 0x80000; i++) - DrvTempRom[i] ^= 0xff; - - GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); - - // Load the PROM - nRet = BurnLoadRom(DrvProm + 0x00000, 17, 1); if (nRet != 0) return 1; - - // Load the 68705 Rom - nRet = BurnLoadRom(DrvMcuRom + 0x00000, 18, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - return 0; -} - -static INT32 Bub68705Init() -{ - BublboblCallbackFunction = Bub68705Callback; - - DrvMCUInUse = 2; - - return MachineInit(); -} - -static INT32 DlandCallback() -{ - INT32 nRet = 0; - - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 2, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; - - // Load Z80 #3 Program Roms - nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 6, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 10, 1); if (nRet != 0) return 1; - - for (INT32 i = 0x00000; i < 0x40000; i++) - DrvTempRom[i] = BITSWAP08(DrvTempRom[i],7,6,5,4,0,1,2,3) ^ 0xff; - - for (INT32 i = 0x40000; i < 0x80000; i++) - DrvTempRom[i] = BITSWAP08(DrvTempRom[i],7,4,5,6,3,0,1,2) ^ 0xff; - - GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); - - // Load the PROM - nRet = BurnLoadRom(DrvProm + 0x00000, 11, 1); if (nRet != 0) return 1; - - BurnFree(DrvTempRom); - - ZetOpen(0); - ZetSetReadHandler(BoblboblRead1); - ZetSetWriteHandler(BoblboblWrite1); - ZetMemCallback(0xfe00, 0xffff, 0); - ZetMemCallback(0xfe00, 0xffff, 1); - ZetMemCallback(0xfe00, 0xffff, 2); - ZetMemEnd(); - ZetClose(); - - return 0; -} - -static INT32 DlandInit() -{ - BublboblCallbackFunction = DlandCallback; - - return MachineInit(); -} - -static INT32 TokioInit() -{ - INT32 nLen, nRet; - - // Allocate and Blank all required memory - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(Mem, 0, nLen); - MemIndex(); - - { - DrvTempRom = (UINT8 *)BurnMalloc(0x80000); - - // Load Z80 #1 Program Roms - nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 2, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 3, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvZ80Rom1 + 0x28000, 4, 1); if (nRet != 0) return 1; - - // Load Z80 #2 Program Roms - nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 5, 1); if (nRet != 0) return 1; - - // Load Z80 #3 Program Roms - nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 6, 1); if (nRet != 0) return 1; - - // Load and decode the tiles - nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x08000, 8, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x10000, 9, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x18000, 10, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x20000, 11, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x28000, 12, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x30000, 13, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x38000, 14, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x40000, 15, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x48000, 16, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x50000, 17, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x58000, 18, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x60000, 19, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x68000, 20, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x70000, 21, 1); if (nRet != 0) return 1; - nRet = BurnLoadRom(DrvTempRom + 0x78000, 22, 1); if (nRet != 0) return 1; - for (INT32 i = 0; i < 0x80000; i++) DrvTempRom[i] ^= 0xff; - GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); - - // Load the PROM - nRet = BurnLoadRom(DrvProm + 0x00000, 23, 1); if (nRet != 0) return 1; - - // Load MCU Rom - //BurnLoadRom(DrvMcuRom + 0x00000, 24, 1); - - BurnFree(DrvTempRom); - } - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(TokioRead1); - ZetSetWriteHandler(TokioWrite1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); - ZetMapArea(0xc000, 0xdcff, 0, DrvVideoRam ); - ZetMapArea(0xc000, 0xdcff, 1, DrvVideoRam ); - ZetMapArea(0xc000, 0xdcff, 2, DrvVideoRam ); - ZetMapArea(0xdd00, 0xdfff, 0, DrvSpriteRam ); - ZetMapArea(0xdd00, 0xdfff, 1, DrvSpriteRam ); - ZetMapArea(0xdd00, 0xdfff, 2, DrvSpriteRam ); - ZetMapArea(0xe000, 0xf7ff, 0, DrvSharedRam ); - ZetMapArea(0xe000, 0xf7ff, 1, DrvSharedRam ); - ZetMapArea(0xe000, 0xf7ff, 2, DrvSharedRam ); - ZetMapArea(0xf800, 0xf9ff, 0, DrvPaletteRam ); - ZetMapArea(0xf800, 0xf9ff, 1, DrvPaletteRam ); - ZetMapArea(0xf800, 0xf9ff, 2, DrvPaletteRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2 ); - ZetMapArea(0x8000, 0x97ff, 0, DrvSharedRam ); - ZetMapArea(0x8000, 0x97ff, 1, DrvSharedRam ); - ZetMapArea(0x8000, 0x97ff, 2, DrvSharedRam ); - ZetMemEnd(); - ZetClose(); - - ZetInit(2); - ZetOpen(2); - ZetSetReadHandler(TokioSoundRead3); - ZetSetWriteHandler(TokioSoundWrite3); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom3 ); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom3 ); - ZetMapArea(0x8000, 0x8fff, 0, DrvZ80Ram3 ); - ZetMapArea(0x8000, 0x8fff, 1, DrvZ80Ram3 ); - ZetMapArea(0x8000, 0x8fff, 2, DrvZ80Ram3 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(1, 3000000, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(3000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.08, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.08, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.08, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvVideoEnable = 1; - DrvMCUInUse = 0; - - // Reset the driver - TokioDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - ZetExit(); - BurnYM2203Exit(); - - if (DrvMCUInUse == 1) M6800Exit(); - if (DrvMCUInUse == 2) m6805Exit(); - - GenericTilesExit(); - - BurnFree(Mem); - - DrvRomBank = 0; - DrvSlaveCPUActive = 0; - DrvSoundCPUActive = 0; - DrvMCUActive = 0; - DrvVideoEnable = 0; - DrvFlipScreen = 0; - IC43A = 0; - IC43B = 0; - DrvSoundStatus = 0; - DrvSoundNmiEnable = 0; - DrvSoundNmiPending = 0; - DrvSoundLatch = 0; - DrvMCUInUse = 0; - - mcu_latch = 0; - mcu_address = 0; - - BublboblCallbackFunction = NULL; - - return 0; -} - -static INT32 BublboblExit() -{ - BurnYM3526Exit(); - return DrvExit(); -} - -static inline UINT8 pal4bit(UINT8 bits) -{ - bits &= 0x0f; - return (bits << 4) | bits; -} - -inline static INT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(nColour >> 12); - g = pal4bit(nColour >> 8); - b = pal4bit(nColour >> 4); - - return BurnHighCol(r, g, b, 0); -} - -static void DrvCalcPalette() -{ - for (INT32 i = 0; i < 0x200; i += 2) { - DrvPalette[i / 2] = CalcCol(DrvPaletteRam[i | 1] | (DrvPaletteRam[i & ~1] << 8)); - } -} - -static void DrvVideoUpdate() -{ - INT32 sx, sy, xc, yc; - INT32 GfxNum, GfxAttr, GfxOffset; - const UINT8 *Prom; - const UINT8 *PromLine; - - if (!DrvVideoEnable) return; - - sx = 0; - - Prom = DrvProm; - - for (INT32 Offset = 0; Offset < 0x300; Offset += 4) { - if (*(UINT32 *)(&DrvSpriteRam[Offset]) == 0) continue; - - GfxNum = DrvSpriteRam[Offset + 1]; - GfxAttr = DrvSpriteRam[Offset + 3]; - PromLine = Prom + 0x80 + ((GfxNum & 0xe0) >> 1); - - GfxOffset = ((GfxNum & 0x1f) * 0x80); - if ((GfxNum & 0xa0) == 0xa0) GfxOffset |= 0x1000; - - sy = -DrvSpriteRam[Offset + 0]; - - for (yc = 0; yc < 32; yc++) { - if (PromLine[yc / 2] & 0x08) continue; - - if (!(PromLine[yc / 2] & 0x04)) { - sx = DrvSpriteRam[Offset + 2]; - if (GfxAttr & 0x40) sx -= 256; - } - - for (xc = 0; xc < 2; xc++) { - INT32 gOffs, Code, Colour, xFlip, yFlip, x, y, yPos; - - gOffs = GfxOffset + xc * 0x40 + (yc & 7) * 0x02 + (PromLine[yc / 2] & 0x03) * 0x10; - Code = DrvVideoRam[gOffs] + 256 * (DrvVideoRam[gOffs + 1] & 0x03) + 1024 * (GfxAttr & 0x0f); - Colour = (DrvVideoRam[gOffs + 1] & 0x3c) >> 2; - xFlip = DrvVideoRam[gOffs + 1] & 0x40; - yFlip = DrvVideoRam[gOffs + 1] & 0x80; - x = sx + xc * 8; - y = (sy + yc * 8) & 0xff; - - if (DrvFlipScreen) { - x = 248 - x; - y = 248 - y; - xFlip = !xFlip; - yFlip = !yFlip; - } - - yPos = y - 16; - - if (x > 8 && x < (nScreenWidth - 8) && yPos > 8 && yPos < (nScreenHeight - 8)) { - if (xFlip) { - if (yFlip) { - Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); - } else { - Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); - } - } else { - if (yFlip) { - Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); - } else { - Render8x8Tile_Mask(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); - } else { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); - } - } else { - if (yFlip) { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); - } - } - } - } - } - - sx += 16; - } -} - -static void DrvDraw() -{ - for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { - pTransDraw[i] = 0x00ff; - } - - DrvCalcPalette(); - DrvVideoUpdate(); - BurnTransferCopy(DrvPalette); -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 100; - - if (DrvReset) DrvDoReset(); - - BublboblMakeInputs(); - - nCyclesTotal[0] = 6000000 / 60; - nCyclesTotal[1] = 6000000 / 60; - nCyclesTotal[2] = 3000000 / 60; - nCyclesTotal[3] = (DrvMCUInUse == 2) ? (4000000 / 60) : (1000000 / 60); - nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = nCyclesDone[3] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - BurnTimerUpdateYM3526(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - if (i == 98 && !DrvMCUInUse) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == 99 && !DrvMCUInUse) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - // Run Z80 #2 - if (DrvSlaveCPUActive) { - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 98) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == 99) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - } - - // Run Z80 #3 - if (DrvSoundCPUActive) { - nCurrentCPU = 2; - ZetOpen(nCurrentCPU); - BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - if (DrvSoundNmiPending) { - if (DrvSoundNmiEnable) { - ZetNmi(); - DrvSoundNmiPending = 0; - } - } - ZetClose(); - } - - if (DrvMCUInUse) { - if (DrvMCUActive) { - nCurrentCPU = 3; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (DrvMCUInUse == 2) { - nCyclesSegment = m6805Run(nCyclesSegment); - if (i == 49) m68705SetIrqLine(0, 1 /*ASSERT_LINE*/); - if (i == 99) m68705SetIrqLine(0, 0 /*CLEAR_LINE*/); - } else { - nCyclesSegment = M6801Run(nCyclesSegment); - if (i == 98) M6801SetIRQLine(0, M6801_IRQSTATUS_ACK); - if (i == 99) M6801SetIRQLine(0, M6801_IRQSTATUS_NONE); - } - - nCyclesDone[nCurrentCPU] += nCyclesSegment; - } - } - } - - ZetOpen(0); - BurnTimerEndFrameYM3526(nCyclesTotal[0]); - ZetClose(); - - if (DrvSoundCPUActive) { - ZetOpen(2); - BurnTimerEndFrame(nCyclesTotal[2]); - ZetClose(); - } - - if (pBurnSoundOut) { - ZetOpen(2); - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - ZetOpen(0); - BurnYM3526Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - } - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 TokioFrame() -{ - INT32 nInterleave = 100; - - if (DrvReset) TokioDoReset(); - - BublboblMakeInputs(); - - nCyclesTotal[0] = 6000000 / 60; - nCyclesTotal[1] = 6000000 / 60; - nCyclesTotal[2] = 3000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; - - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 98) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == 99) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - // Run Z80 #2 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesSegment = ZetRun(nCyclesSegment); - nCyclesDone[nCurrentCPU] += nCyclesSegment; - if (i == 98) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == 99) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - // Run Z80 #3 - nCurrentCPU = 2; - ZetOpen(nCurrentCPU); - BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - if (DrvSoundNmiPending) { - if (DrvSoundNmiEnable) { - ZetNmi(); - DrvSoundNmiPending = 0; - } - } - ZetClose(); - } - - ZetOpen(2); - BurnTimerEndFrame(nCyclesTotal[2]); - ZetClose(); - - if (pBurnSoundOut) { - ZetOpen(2); - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - } - - if (pBurnDraw) DrvDraw(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029706; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - ZetScan(nAction); - if (DrvMCUInUse == 1) M6801Scan(nAction); - if (DrvMCUInUse == 2) m68705_taito_scan(nAction); - - BurnYM2203Scan(nAction, pnMin); - - if (strncmp(BurnDrvGetTextA(DRV_NAME), "tokio", 5) != 0) { - BurnYM3526Scan(nAction, pnMin); - } - - SCAN_VAR(DrvRomBank); - SCAN_VAR(DrvSlaveCPUActive); - SCAN_VAR(DrvSoundCPUActive); - SCAN_VAR(DrvMCUActive); - SCAN_VAR(DrvVideoEnable); - SCAN_VAR(DrvFlipScreen); - SCAN_VAR(IC43A); - SCAN_VAR(IC43B); - SCAN_VAR(DrvSoundStatus); - SCAN_VAR(DrvSoundNmiEnable); - SCAN_VAR(DrvSoundNmiPending); - SCAN_VAR(DrvSoundLatch); - SCAN_VAR(ddr1); - SCAN_VAR(ddr2); - SCAN_VAR(ddr3); - SCAN_VAR(ddr4); - SCAN_VAR(port1_in); - SCAN_VAR(port2_in); - SCAN_VAR(port3_in); - SCAN_VAR(port4_in); - SCAN_VAR(port1_out); - SCAN_VAR(port2_out); - SCAN_VAR(port3_out); - SCAN_VAR(port4_out); - SCAN_VAR(mcu_latch); - SCAN_VAR(mcu_address); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); - ZetClose(); - } - - return 0; -} - -struct BurnDriver BurnDrvBublbobl = { - "bublbobl", NULL, NULL, NULL, "1986", - "Bubble Bobble\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, BublboblRomInfo, BublboblRomName, NULL, NULL, BublboblInputInfo, BublboblDIPInfo, - BublboblInit, BublboblExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBublbob1 = { - "bublbobl1", "bublbobl", NULL, NULL, "1986", - "Bubble Bobble (older)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, Bublbob1RomInfo, Bublbob1RomName, NULL, NULL, BublboblInputInfo, BublboblDIPInfo, - BublboblInit, BublboblExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBublbobr = { - "bublboblr", "bublbobl", NULL, NULL, "1986", - "Bubble Bobble (US with mode select)\0", NULL, "Taito America Corporation (Romstar license)", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, BublbobrRomInfo, BublbobrRomName, NULL, NULL, BublboblInputInfo, BublboblDIPInfo, - BublboblInit, BublboblExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBubbobr1 = { - "bublboblr1", "bublbobl", NULL, NULL, "1986", - "Bubble Bobble (US)\0", NULL, "Taito America Corporation (Romstar license)", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, Bubbobr1RomInfo, Bubbobr1RomName, NULL, NULL, BublboblInputInfo, BublboblDIPInfo, - BublboblInit, BublboblExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBoblbobl = { - "boblbobl", "bublbobl", NULL, NULL, "1986", - "Bobble Bobble (set 1)\0", NULL, "bootleg", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, BoblboblRomInfo, BoblboblRomName, NULL, NULL, BoblboblInputInfo, BoblboblDIPInfo, - BoblboblInit, BublboblExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriverD BurnDrvBoblbobl2 = { - "boblbobl2", "bublbobl", NULL, NULL, "1986", - "Bobble Bobble (set 2)\0", NULL, "bootleg", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, Boblbobl2RomInfo, Boblbobl2RomName, NULL, NULL, BoblboblInputInfo, BoblboblDIPInfo, - Boblbobl2Init, BublboblExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSboblboa = { - "sboblboa", "bublbobl", NULL, NULL, "1986", - "Super Bobble Bobble (set 1)\0", NULL, "bootleg", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, SboblboaRomInfo, SboblboaRomName, NULL, NULL, BoblboblInputInfo, BoblboblDIPInfo, - BoblboblInit, BublboblExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSboblbob = { - "sboblbob", "bublbobl", NULL, NULL, "1986", - "Super Bobble Bobble (set 2)\0", NULL, "bootleg", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, SboblbobRomInfo, SboblbobRomName, NULL, NULL, BoblboblInputInfo, SboblbobDIPInfo, - BoblboblInit, BublboblExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvBub68705 = { - "bub68705", "bublbobl", NULL, NULL, "1986", - "Bubble Bobble (boolteg with 68705)\0", NULL, "bootleg", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, Bub68705RomInfo, Bub68705RomName, NULL, NULL, BublboblInputInfo, BublboblDIPInfo, - Bub68705Init, BublboblExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDland = { - "dland", "bublbobl", NULL, NULL, "1987", - "Dream Land / Super Dream Land (bootleg of Bubble Bobble)\0", NULL, "bootleg", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, DlandRomInfo, DlandRomName, NULL, NULL, BoblboblInputInfo, DlandDIPInfo, - DlandInit, BublboblExit, DrvFrame, NULL, DrvScan, - NULL, 0x100, 256, 224, 4, 3 -}; - -struct BurnDriver BurnDrvTokio = { - "tokio", NULL, NULL, NULL, "1986", - "Tokio / Scramble Formation (newer)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, - NULL, tokioRomInfo, tokioRomName, NULL, NULL, TokioInputInfo, TokioDIPInfo, - TokioInit, DrvExit, TokioFrame, NULL, DrvScan, - NULL, 0x100, 224, 256, 3, 4 -}; - -struct BurnDriverD BurnDrvTokioo = { - "tokioo", "tokio", NULL, NULL, "1986", - "Tokio / Scramble Formation (older)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, - NULL, tokiooRomInfo, tokiooRomName, NULL, NULL, TokioInputInfo, TokioDIPInfo, - TokioInit, DrvExit, TokioFrame, NULL, DrvScan, - NULL, 0x100, 224, 256, 3, 4 -}; - -struct BurnDriverD BurnDrvTokiou = { - "tokiou", "tokio", NULL, NULL, "1986", - "Tokio / Scramble Formation (US)\0", NULL, "Taito America Corporation (Romstar license)", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, - NULL, tokiouRomInfo, tokiouRomName, NULL, NULL, TokioInputInfo, TokioDIPInfo, - TokioInit, DrvExit, TokioFrame, NULL, DrvScan, - NULL, 0x100, 224, 256, 3, 4 -}; - -struct BurnDriver BurnDrvTokiob = { - "tokiob", "tokio", NULL, NULL, "1986", - "Tokio / Scramble Formation (bootleg)\0", NULL, "bootleg", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, - NULL, tokiobRomInfo, tokiobRomName, NULL, NULL, TokioInputInfo, TokioDIPInfo, - TokioInit, DrvExit, TokioFrame, NULL, DrvScan, - NULL, 0x100, 224, 256, 3, 4 -}; +#include "tiles_generic.h" +#include "z80_intf.h" +#include "m6800_intf.h" +#include "taito_m68705.h" +#include "burn_ym2203.h" +#include "burn_ym3526.h" +#include "bitswap.h" + +static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvDip[2] = {0, 0}; +static UINT8 DrvInput[3] = {0x00, 0x00, 0x00}; +static UINT8 DrvReset = 0; + +static UINT8 *Mem = NULL; +static UINT8 *MemEnd = NULL; +static UINT8 *RamStart = NULL; +static UINT8 *RamEnd = NULL; +static UINT8 *DrvZ80Rom1 = NULL; +static UINT8 *DrvZ80Rom2 = NULL; +static UINT8 *DrvZ80Rom3 = NULL; +static UINT8 *DrvMcuRom = NULL; +static UINT8 *DrvProm = NULL; +static UINT8 *DrvZ80Ram1 = NULL; +static UINT8 *DrvZ80Ram3 = NULL; +static UINT8 *DrvSharedRam = NULL; +static UINT8 *DrvMcuRam = NULL; +static UINT8 *DrvVideoRam = NULL; +static UINT8 *DrvSpriteRam = NULL; +static UINT8 *DrvPaletteRam = NULL; +static UINT8 *DrvTiles = NULL; +static UINT8 *DrvTempRom = NULL; +static UINT32 *DrvPalette = NULL; + +static UINT8 DrvRomBank; +static UINT8 DrvSlaveCPUActive; +static UINT8 DrvSoundCPUActive; +static UINT8 DrvMCUActive; +static UINT8 DrvVideoEnable; +static UINT8 DrvFlipScreen; +static INT32 IC43A; +static INT32 IC43B; +static INT32 DrvSoundStatus; +static INT32 DrvSoundNmiEnable; +static INT32 DrvSoundNmiPending; +static INT32 DrvSoundLatch; + +static INT32 nCyclesDone[4], nCyclesTotal[4]; +static INT32 nCyclesSegment; + +typedef INT32 (*BublboblCallbackFunc)(); +static BublboblCallbackFunc BublboblCallbackFunction; + +static UINT8 DrvMCUInUse; + +static INT32 mcu_address, mcu_latch; +static UINT8 ddr1, ddr2, ddr3, ddr4; +static UINT8 port1_in, port2_in, port3_in, port4_in; +static UINT8 port1_out, port2_out, port3_out, port4_out; + +static struct BurnInputInfo BublboblInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort1 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort2 + 6, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 5, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 4, "p1 fire 2" }, + + {"P2 Left" , BIT_DIGITAL , DrvInputPort2 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort2 + 1, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort2 + 5, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort2 + 4, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort0 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , DrvInputPort0 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Bublbobl) + +static struct BurnInputInfo BoblboblInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , DrvInputPort0 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , DrvInputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , DrvInputPort0 + 2, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , DrvInputPort1 + 6, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , DrvInputPort0 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvInputPort0 + 1, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , DrvInputPort0 + 5, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , DrvInputPort0 + 4, "p1 fire 2" }, + + {"P2 Left" , BIT_DIGITAL , DrvInputPort1 + 0, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , DrvInputPort1 + 1, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , DrvInputPort1 + 5, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , DrvInputPort1 + 4, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, + {"Service" , BIT_DIGITAL , DrvInputPort1 + 3, "service" }, + {"Tilt" , BIT_DIGITAL , DrvInputPort1 + 2, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, DrvDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, DrvDip + 1 , "dip" }, +}; + +STDINPUTINFO(Boblbobl) + +static inline void BublboblMakeInputs() +{ + DrvInput[0] = 0xf3; + if (DrvInputPort0[0]) DrvInput[0] -= 0x01; + if (DrvInputPort0[1]) DrvInput[0] -= 0x02; + if (DrvInputPort0[2]) DrvInput[0] |= 0x04; + if (DrvInputPort0[3]) DrvInput[0] |= 0x08; + if (DrvInputPort0[4]) DrvInput[0] -= 0x10; + if (DrvInputPort0[5]) DrvInput[0] -= 0x20; + if (DrvInputPort0[6]) DrvInput[0] -= 0x40; + if (DrvInputPort0[7]) DrvInput[0] -= 0x80; + + DrvInput[1] = 0xff; + DrvInput[2] = 0xff; + for (INT32 i = 0; i < 8; i++) { + DrvInput[1] -= (DrvInputPort1[i] & 1) << i; + DrvInput[2] -= (DrvInputPort2[i] & 1) << i; + } +} + +static struct BurnDIPInfo BublboblDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xfe, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Mode" }, + {0x0f, 0x01, 0x05, 0x04, "Game, English" }, + {0x0f, 0x01, 0x05, 0x05, "Game, Japanese" }, + {0x0f, 0x01, 0x05, 0x01, "Test (Grid and Inputs)" }, + {0x0f, 0x01, 0x05, 0x00, "Test (RAM and Sound)/Pause"}, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x02, 0x02, "Off" }, + {0x0f, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x08, 0x00, "Off" }, + {0x0f, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, + {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Play" }, + {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Plays" }, + {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, + {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Plays" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x10, 0x01, 0x03, 0x02, "Easy" }, + {0x10, 0x01, 0x03, 0x03, "Normal" }, + {0x10, 0x01, 0x03, 0x01, "Hard" }, + {0x10, 0x01, 0x03, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x10, 0x01, 0x0c, 0x08, "20k 80k 300k" }, + {0x10, 0x01, 0x0c, 0x0c, "30k 100k 400k" }, + {0x10, 0x01, 0x0c, 0x04, "40k 200k 500k" }, + {0x10, 0x01, 0x0c, 0x00, "50k 250k 500k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x30, 0x10, "1" }, + {0x10, 0x01, 0x30, 0x00, "2" }, + {0x10, 0x01, 0x30, 0x30, "3" }, + {0x10, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2 , "ROM Type" }, + {0x10, 0x01, 0x80, 0x80, "IC52=512kb, IC53=none" }, + {0x10, 0x01, 0x80, 0x00, "IC52=256kb, IC53=256kb" }, +}; + +STDDIPINFO(Bublbobl) + +static struct BurnDIPInfo BoblboblDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xfe, NULL }, + {0x10, 0xff, 0xff, 0x3f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Mode" }, + {0x0f, 0x01, 0x05, 0x04, "Game, English" }, + {0x0f, 0x01, 0x05, 0x05, "Game, Japanese" }, + {0x0f, 0x01, 0x05, 0x01, "Test (Grid and Inputs)" }, + {0x0f, 0x01, 0x05, 0x00, "Test (RAM and Sound)" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x02, 0x02, "Off" }, + {0x0f, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x08, 0x00, "Off" }, + {0x0f, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, + {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Play" }, + {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Plays" }, + {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, + {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Plays" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x10, 0x01, 0x03, 0x02, "Easy" }, + {0x10, 0x01, 0x03, 0x03, "Normal" }, + {0x10, 0x01, 0x03, 0x01, "Hard" }, + {0x10, 0x01, 0x03, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x10, 0x01, 0x0c, 0x08, "20k 80k 300k" }, + {0x10, 0x01, 0x0c, 0x0c, "30k 100k 400k" }, + {0x10, 0x01, 0x0c, 0x04, "40k 200k 500k" }, + {0x10, 0x01, 0x0c, 0x00, "50k 250k 500k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x30, 0x10, "1" }, + {0x10, 0x01, 0x30, 0x00, "2" }, + {0x10, 0x01, 0x30, 0x30, "3" }, + {0x10, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 4 , "Monster Speed" }, + {0x10, 0x01, 0xc0, 0x00, "Normal" }, + {0x10, 0x01, 0xc0, 0x40, "Medium" }, + {0x10, 0x01, 0xc0, 0x80, "High" }, + {0x10, 0x01, 0xc0, 0xc0, "Very High" }, +}; + +STDDIPINFO(Boblbobl) + +static struct BurnDIPInfo SboblbobDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xfe, NULL }, + {0x10, 0xff, 0xff, 0x3f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Game" }, + {0x0f, 0x01, 0x01, 0x01, "Bobble Bobble" }, + {0x0f, 0x01, 0x01, 0x00, "Super Bobble Bobble" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x02, 0x02, "Off" }, + {0x0f, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0f, 0x01, 0x04, 0x04, "Off" }, + {0x0f, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x08, 0x00, "Off" }, + {0x0f, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, + {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Play" }, + {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Plays" }, + {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, + {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Plays" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x10, 0x01, 0x03, 0x02, "Easy" }, + {0x10, 0x01, 0x03, 0x03, "Normal" }, + {0x10, 0x01, 0x03, 0x01, "Hard" }, + {0x10, 0x01, 0x03, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x10, 0x01, 0x0c, 0x08, "20k 80k 300k" }, + {0x10, 0x01, 0x0c, 0x0c, "30k 100k 400k" }, + {0x10, 0x01, 0x0c, 0x04, "40k 200k 500k" }, + {0x10, 0x01, 0x0c, 0x00, "50k 250k 500k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x30, 0x10, "1" }, + {0x10, 0x01, 0x30, 0x00, "2" }, + {0x10, 0x01, 0x30, 0x30, "3" }, + {0x10, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 4 , "Monster Speed" }, + {0x10, 0x01, 0xc0, 0x00, "Normal" }, + {0x10, 0x01, 0xc0, 0x40, "Medium" }, + {0x10, 0x01, 0xc0, 0x80, "High" }, + {0x10, 0x01, 0xc0, 0xc0, "Very High" }, +}; + +STDDIPINFO(Sboblbob) + +static struct BurnDIPInfo DlandDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0x3f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Game" }, + {0x0f, 0x01, 0x01, 0x01, "Dream Land" }, + {0x0f, 0x01, 0x01, 0x00, "Super Dream Land" }, + + {0 , 0xfe, 0 , 4 , "Mode" }, + {0x0f, 0x01, 0x05, 0x04, "Game, English" }, + {0x0f, 0x01, 0x05, 0x05, "Game, Japanese" }, + {0x0f, 0x01, 0x05, 0x01, "Test (Grid and Inputs)" }, + {0x0f, 0x01, 0x05, 0x00, "Test (RAM and Sound)" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x02, 0x02, "Off" }, + {0x0f, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0f, 0x01, 0x04, 0x00, "Off" }, + {0x0f, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x08, 0x00, "Off" }, + {0x0f, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Play" }, + {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Play" }, + {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Plays" }, + {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Plays" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Play" }, + {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Play" }, + {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Plays" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Plays" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x10, 0x01, 0x03, 0x02, "Easy" }, + {0x10, 0x01, 0x03, 0x03, "Normal" }, + {0x10, 0x01, 0x03, 0x01, "Hard" }, + {0x10, 0x01, 0x03, 0x00, "Very Hard" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x10, 0x01, 0x0c, 0x08, "20k 80k 300k" }, + {0x10, 0x01, 0x0c, 0x0c, "30k 100k 400k" }, + {0x10, 0x01, 0x0c, 0x04, "40k 200k 500k" }, + {0x10, 0x01, 0x0c, 0x00, "50k 250k 500k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x30, 0x10, "1" }, + {0x10, 0x01, 0x30, 0x00, "2" }, + {0x10, 0x01, 0x30, 0x30, "3" }, + {0x10, 0x01, 0x30, 0x20, "100 (Cheat)" }, + + {0 , 0xfe, 0 , 4 , "Monster Speed" }, + {0x10, 0x01, 0xc0, 0x00, "Normal" }, + {0x10, 0x01, 0xc0, 0x40, "Medium" }, + {0x10, 0x01, 0xc0, 0x80, "High" }, + {0x10, 0x01, 0xc0, 0xc0, "Very High" }, +}; + +STDDIPINFO(Dland) + +static struct BurnInputInfo TokioInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvInputPort0 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvInputPort1 + 6, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvInputPort1 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvInputPort1 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvInputPort1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvInputPort1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvInputPort1 + 5, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvInputPort1 + 4, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvInputPort0 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvInputPort2 + 6, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvInputPort2 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvInputPort2 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvInputPort2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvInputPort2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvInputPort2 + 5, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvInputPort2 + 4, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvInputPort0 + 1, "service" }, + {"Tilt", BIT_DIGITAL, DrvInputPort0 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" }, +}; + +STDINPUTINFO(Tokio) + +static struct BurnDIPInfo TokioDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0x7e, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 2, "Enemies" }, + {0x14, 0x01, 0x01, 0x01, "Few (Easy)" }, + {0x14, 0x01, 0x01, 0x00, "Many (Hard)" }, + + {0 , 0xfe, 0 , 2, "Enemy Shots" }, + {0x14, 0x01, 0x02, 0x02, "Few (Easy)" }, + {0x14, 0x01, 0x02, 0x00, "Many (Hard)" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "100K 400K" }, + {0x14, 0x01, 0x0c, 0x08, "200K 400K" }, + {0x14, 0x01, 0x0c, 0x04, "300K 400K" }, + {0x14, 0x01, 0x0c, 0x00, "400K 400K" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + {0x14, 0x01, 0x30, 0x00, "99 (Cheat)" }, + + {0 , 0xfe, 0 , 0, "Language" }, + {0x14, 0x01, 0x80, 0x00, "English" }, + {0x14, 0x01, 0x80, 0x80, "Japanese" }, +}; + +STDDIPINFO(Tokio) + +static struct BurnRomInfo BublboblRomDesc[] = { + { "a78-06-1.51", 0x08000, 0x567934b6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a78-05-1.52", 0x10000, 0x9f8ee242, BRF_ESS | BRF_PRG }, // 1 + + { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 3 Z80 #3 Program + + { "a78-01.17", 0x01000, 0xb1bfb53d, BRF_ESS | BRF_PRG }, // 4 MCU Program + + { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles + { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 + { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 + { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 + { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 + { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 + { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 + { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 + { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 + { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 + { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 + { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 + + { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs + + { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 18 PLDs + { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 19 + { "pal16r4.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 20 +}; + +STD_ROM_PICK(Bublbobl) +STD_ROM_FN(Bublbobl) + +static struct BurnRomInfo Bublbob1RomDesc[] = { + { "a78-06.51", 0x08000, 0x32c8305b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a78-05.52", 0x10000, 0x53f4bc6e, BRF_ESS | BRF_PRG }, // 1 + + { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 3 Z80 #3 Program + + { "a78-01.17", 0x01000, 0xb1bfb53d, BRF_ESS | BRF_PRG }, // 4 MCU Program + + { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles + { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 + { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 + { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 + { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 + { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 + { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 + { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 + { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 + { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 + { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 + { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 + + { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs + + { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 18 PLDs + { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 19 + { "pal16r4.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 20 +}; + +STD_ROM_PICK(Bublbob1) +STD_ROM_FN(Bublbob1) + +static struct BurnRomInfo BublbobrRomDesc[] = { + { "a78-25.51", 0x08000, 0x2d901c9d, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a78-24.52", 0x10000, 0xb7afedc4, BRF_ESS | BRF_PRG }, // 1 + + { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 3 Z80 #3 Program + + { "a78-01.17", 0x01000, 0xb1bfb53d, BRF_ESS | BRF_PRG }, // 4 MCU Program + + { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles + { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 + { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 + { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 + { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 + { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 + { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 + { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 + { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 + { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 + { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 + { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 + + { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs + + { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 18 PLDs + { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 19 + { "pal16r4.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 20 +}; + +STD_ROM_PICK(Bublbobr) +STD_ROM_FN(Bublbobr) + +static struct BurnRomInfo Bubbobr1RomDesc[] = { + { "a78-06.51", 0x08000, 0x32c8305b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a78-21.52", 0x10000, 0x2844033d, BRF_ESS | BRF_PRG }, // 1 + + { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 2 Z80 #2 Program + + { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 3 Z80 #3 Program + + { "a78-01.17", 0x01000, 0xb1bfb53d, BRF_ESS | BRF_PRG }, // 4 MCU Program + + { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles + { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 + { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 + { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 + { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 + { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 + { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 + { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 + { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 + { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 + { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 + { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 + + { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs + + { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 18 PLDs + { "pal16l8.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 19 + { "pal16r4.bin", 0x00001, 0x00000000, BRF_OPT | BRF_NODUMP }, // 20 +}; + +STD_ROM_PICK(Bubbobr1) +STD_ROM_FN(Bubbobr1) + +static struct BurnRomInfo BoblboblRomDesc[] = { + { "bb3", 0x08000, 0x01f81936, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bb5", 0x08000, 0x13118eb1, BRF_ESS | BRF_PRG }, // 1 + { "bb4", 0x08000, 0xafda99d8, BRF_ESS | BRF_PRG }, // 2 + + { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program + + { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles + { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 + { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 + { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 + { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 + { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 + { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 + { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 + { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 + { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 + { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 + { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 + + { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs + + { "pal16r4.u36", 0x00104, 0x22fe26ac, BRF_OPT }, // 18 PLDs + { "pal16l8.u38", 0x00104, 0xc02d9663, BRF_OPT }, // 19 + { "pal16l8.u4", 0x00104, 0x077d20a8, BRF_OPT }, // 20 +}; + +STD_ROM_PICK(Boblbobl) +STD_ROM_FN(Boblbobl) + +static struct BurnRomInfo Boblbobl2RomDesc[] = { + { "cpu2-3.bin", 0x08000, 0x2d9107b6, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bb5", 0x08000, 0x13118eb1, BRF_ESS | BRF_PRG }, // 1 + { "cpu2-4.bin", 0x08000, 0x3f9fed10, BRF_ESS | BRF_PRG }, // 2 + + { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program + + { "gfx7.bin", 0x10000, 0x702f61c0, BRF_GRA }, // 5 Tiles + { "gfx8.bin", 0x10000, 0x677840e8, BRF_GRA }, // 6 + { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 7 + { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 8 + { "gfx10.bin", 0x10000, 0xd370f499, BRF_GRA }, // 9 + { "gfx11.bin", 0x10000, 0x76f2b367, BRF_GRA }, // 10 + { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 11 + + { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 12 PROMs +}; + +STD_ROM_PICK(Boblbobl2) +STD_ROM_FN(Boblbobl2) + +static struct BurnRomInfo SboblboaRomDesc[] = { + { "1c.bin", 0x08000, 0xf304152a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "1a.bin", 0x08000, 0x0865209c, BRF_ESS | BRF_PRG }, // 1 + { "1b.bin", 0x08000, 0x1f29b5c0, BRF_ESS | BRF_PRG }, // 2 + + { "1e.rom", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "1d.rom", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program + + { "1l.rom", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles + { "1m.rom", 0x08000, 0x930168a9, BRF_GRA }, // 6 + { "1n.rom", 0x08000, 0x9773e512, BRF_GRA }, // 7 + { "1o.rom", 0x08000, 0xd045549b, BRF_GRA }, // 8 + { "1p.rom", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 + { "1q.rom", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 + { "1f.rom", 0x08000, 0x6b61a413, BRF_GRA }, // 11 + { "1g.rom", 0x08000, 0xb5492d97, BRF_GRA }, // 12 + { "1h.rom", 0x08000, 0xd69762d5, BRF_GRA }, // 13 + { "1i.rom", 0x08000, 0x9f243b68, BRF_GRA }, // 14 + { "1j.rom", 0x08000, 0x66e9438c, BRF_GRA }, // 15 + { "1k.rom", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 + + { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs +}; + +STD_ROM_PICK(Sboblboa) +STD_ROM_FN(Sboblboa) + +static struct BurnRomInfo SboblbobRomDesc[] = { + { "bbb-3.rom", 0x08000, 0xf304152a, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "bb5", 0x08000, 0x13118eb1, BRF_ESS | BRF_PRG }, // 1 + { "bbb-4.rom", 0x08000, 0x94c75591, BRF_ESS | BRF_PRG }, // 2 + + { "a78-08.37", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "a78-07.46", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program + + { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles + { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 + { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 + { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 + { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 + { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 + { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 + { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 + { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 + { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 + { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 + { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 + + { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs +}; + +STD_ROM_PICK(Sboblbob) +STD_ROM_FN(Sboblbob) + +static struct BurnRomInfo Bub68705RomDesc[] = { + { "2.bin", 0x08000, 0x32c8305b, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "3-1.bin", 0x08000, 0x980c2615, BRF_ESS | BRF_PRG }, // 1 + { "3.bin", 0x08000, 0xe6c698f2, BRF_ESS | BRF_PRG }, // 2 + + { "4.bin", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "1.bin", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program + + { "a78-09.12", 0x08000, 0x20358c22, BRF_GRA }, // 5 Tiles + { "a78-10.13", 0x08000, 0x930168a9, BRF_GRA }, // 6 + { "a78-11.14", 0x08000, 0x9773e512, BRF_GRA }, // 7 + { "a78-12.15", 0x08000, 0xd045549b, BRF_GRA }, // 8 + { "a78-13.16", 0x08000, 0xd0af35c5, BRF_GRA }, // 9 + { "a78-14.17", 0x08000, 0x7b5369a8, BRF_GRA }, // 10 + { "a78-15.30", 0x08000, 0x6b61a413, BRF_GRA }, // 11 + { "a78-16.31", 0x08000, 0xb5492d97, BRF_GRA }, // 12 + { "a78-17.32", 0x08000, 0xd69762d5, BRF_GRA }, // 13 + { "a78-18.33", 0x08000, 0x9f243b68, BRF_GRA }, // 14 + { "a78-19.34", 0x08000, 0x66e9438c, BRF_GRA }, // 15 + { "a78-20.35", 0x08000, 0x9ef863ad, BRF_GRA }, // 16 + + { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 17 PROMs + + { "68705.bin", 0x00800, 0x78caa635, BRF_ESS | BRF_PRG }, // 18 68705 Program Code +}; + +STD_ROM_PICK(Bub68705) +STD_ROM_FN(Bub68705) + + + +static struct BurnRomInfo DlandRomDesc[] = { + { "dl_3.u69", 0x08000, 0x01eb3e4f, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "dl_5.u67", 0x08000, 0x75740b61, BRF_ESS | BRF_PRG }, // 1 + { "dl_4.u68", 0x08000, 0xc6a3776f, BRF_ESS | BRF_PRG }, // 2 + + { "dl_1.u42", 0x08000, 0xae11a07b, BRF_ESS | BRF_PRG }, // 3 Z80 #2 Program + + { "dl_2.u74", 0x08000, 0x4f9a26e8, BRF_ESS | BRF_PRG }, // 4 Z80 #3 Program + + { "dl_6.58", 0x10000, 0x6352d3fa, BRF_GRA }, // 5 Tiles + { "dl_7.59", 0x10000, 0x37a38b69, BRF_GRA }, // 6 + { "dl_8.60", 0x10000, 0x509ee5b1, BRF_GRA }, // 7 + { "dl_9.61", 0x10000, 0xae8514d7, BRF_GRA }, // 8 + { "dl_10.62", 0x10000, 0x6d406fb7, BRF_GRA }, // 9 + { "dl_11.63", 0x10000, 0xbdf9c0ab, BRF_GRA }, // 10 + + { "a71-25.41", 0x00100, 0x2d0f8545, BRF_GRA }, // 11 PROMs +}; + +STD_ROM_PICK(Dland) +STD_ROM_FN(Dland) + + +static struct BurnRomInfo tokioRomDesc[] = { + { "a71-02-1.ic4", 0x8000, 0xBB8DABD7, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program + { "a71-03-1.ic5", 0x8000, 0xEE49B383, BRF_ESS | BRF_PRG }, // 1 + { "a71-04.ic6", 0x8000, 0xa0a4ce0e, BRF_ESS | BRF_PRG }, // 2 + { "a71-05.ic7", 0x8000, 0x6da0b945, BRF_ESS | BRF_PRG }, // 3 + { "a71-06-1.ic8", 0x8000, 0x56927b3f, BRF_ESS | BRF_PRG }, // 4 + + { "a71-01.ic1", 0x8000, 0x0867c707, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program + + { "a71-07.ic10", 0x8000, 0xf298cc7b, BRF_ESS | BRF_PRG }, // 6 Z80 #3 Program + + { "a71-08.ic12", 0x8000, 0x0439ab13, BRF_GRA }, // 7 Tiles + { "a71-09.ic13", 0x8000, 0xedb3d2ff, BRF_GRA }, // 8 + { "a71-10.ic14", 0x8000, 0x69f0888c, BRF_GRA }, // 9 + { "a71-11.ic15", 0x8000, 0x4ae07c31, BRF_GRA }, // 10 + { "a71-12.ic16", 0x8000, 0x3f6bd706, BRF_GRA }, // 11 + { "a71-13.ic17", 0x8000, 0xf2c92aaa, BRF_GRA }, // 12 + { "a71-14.ic18", 0x8000, 0xc574b7b2, BRF_GRA }, // 13 + { "a71-15.ic19", 0x8000, 0x12d87e7f, BRF_GRA }, // 14 + { "a71-16.ic30", 0x8000, 0x0bce35b6, BRF_GRA }, // 15 + { "a71-17.ic31", 0x8000, 0xdeda6387, BRF_GRA }, // 16 + { "a71-18.ic32", 0x8000, 0x330cd9d7, BRF_GRA }, // 17 + { "a71-19.ic33", 0x8000, 0xfc4b29e0, BRF_GRA }, // 18 + { "a71-20.ic34", 0x8000, 0x65acb265, BRF_GRA }, // 19 + { "a71-21.ic35", 0x8000, 0x33cde9b2, BRF_GRA }, // 20 + { "a71-22.ic36", 0x8000, 0xfb98eac0, BRF_GRA }, // 21 + { "a71-23.ic37", 0x8000, 0x30bd46ad, BRF_GRA }, // 22 + + { "a71-25.ic41", 0x0100, 0x2d0f8545, BRF_GRA }, // 23 PROMs + + { "a71-24.ic57", 0x0800, 0x00000000, 6 | BRF_NODUMP }, // 24 Mcu Code + + { "a71-26.ic19", 0x0117, 0x4e1f119c, 7 | BRF_OPT }, // 25 PLDs +}; + +STD_ROM_PICK(tokio) +STD_ROM_FN(tokio) + +static struct BurnRomInfo tokiooRomDesc[] = { + { "a71-02.ic4", 0x8000, 0xd556c908, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program + { "a71-03.ic5", 0x8000, 0x69dacf44, BRF_ESS | BRF_PRG }, // 1 + { "a71-04.ic6", 0x8000, 0xa0a4ce0e, BRF_ESS | BRF_PRG }, // 2 + { "a71-05.ic7", 0x8000, 0x6da0b945, BRF_ESS | BRF_PRG }, // 3 + { "a71-06.ic8", 0x8000, 0x447d6779, BRF_ESS | BRF_PRG }, // 4 + + { "a71-01.ic1", 0x8000, 0x0867c707, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program + + { "a71-07.ic10", 0x8000, 0xf298cc7b, BRF_ESS | BRF_PRG }, // 6 Z80 #3 Program + + { "a71-08.ic12", 0x8000, 0x0439ab13, BRF_GRA }, // 7 Tiles + { "a71-09.ic13", 0x8000, 0xedb3d2ff, BRF_GRA }, // 8 + { "a71-10.ic14", 0x8000, 0x69f0888c, BRF_GRA }, // 9 + { "a71-11.ic15", 0x8000, 0x4ae07c31, BRF_GRA }, // 10 + { "a71-12.ic16", 0x8000, 0x3f6bd706, BRF_GRA }, // 11 + { "a71-13.ic17", 0x8000, 0xf2c92aaa, BRF_GRA }, // 12 + { "a71-14.ic18", 0x8000, 0xc574b7b2, BRF_GRA }, // 13 + { "a71-15.ic19", 0x8000, 0x12d87e7f, BRF_GRA }, // 14 + { "a71-16.ic30", 0x8000, 0x0bce35b6, BRF_GRA }, // 15 + { "a71-17.ic31", 0x8000, 0xdeda6387, BRF_GRA }, // 16 + { "a71-18.ic32", 0x8000, 0x330cd9d7, BRF_GRA }, // 17 + { "a71-19.ic33", 0x8000, 0xfc4b29e0, BRF_GRA }, // 18 + { "a71-20.ic34", 0x8000, 0x65acb265, BRF_GRA }, // 19 + { "a71-21.ic35", 0x8000, 0x33cde9b2, BRF_GRA }, // 20 + { "a71-22.ic36", 0x8000, 0xfb98eac0, BRF_GRA }, // 21 + { "a71-23.ic37", 0x8000, 0x30bd46ad, BRF_GRA }, // 22 + + { "a71-25.ic41", 0x0100, 0x2d0f8545, BRF_GRA }, // 23 PROMs + + { "a71-24.ic57", 0x0800, 0x00000000, 6 | BRF_NODUMP }, // 24 Mcu Code + + { "a71-26.ic19", 0x0117, 0x4e1f119c, 7 | BRF_OPT }, // 25 PLDs +}; + +STD_ROM_PICK(tokioo) +STD_ROM_FN(tokioo) + +static struct BurnRomInfo tokiouRomDesc[] = { + { "a71-27-1.ic4", 0x8000, 0x8c180896, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a71-28-1.ic5", 0x8000, 0x1b447527, BRF_ESS | BRF_PRG }, // 1 + { "a71-04.ic6", 0x8000, 0xa0a4ce0e, BRF_ESS | BRF_PRG }, // 2 + { "a71-05.ic7", 0x8000, 0x6da0b945, BRF_ESS | BRF_PRG }, // 3 + { "a71-06-1.ic8", 0x8000, 0x56927b3f, BRF_ESS | BRF_PRG }, // 4 + + { "a71-01.ic1", 0x8000, 0x0867c707, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program + + { "a71-07.ic10", 0x8000, 0xf298cc7b, BRF_ESS | BRF_PRG }, // 6 Z80 #3 Program + + { "a71-08.ic12", 0x8000, 0x0439ab13, BRF_GRA }, // 7 Tiles + { "a71-09.ic13", 0x8000, 0xedb3d2ff, BRF_GRA }, // 8 + { "a71-10.ic14", 0x8000, 0x69f0888c, BRF_GRA }, // 9 + { "a71-11.ic15", 0x8000, 0x4ae07c31, BRF_GRA }, // 10 + { "a71-12.ic16", 0x8000, 0x3f6bd706, BRF_GRA }, // 11 + { "a71-13.ic17", 0x8000, 0xf2c92aaa, BRF_GRA }, // 12 + { "a71-14.ic18", 0x8000, 0xc574b7b2, BRF_GRA }, // 13 + { "a71-15.ic19", 0x8000, 0x12d87e7f, BRF_GRA }, // 14 + { "a71-16.ic30", 0x8000, 0x0bce35b6, BRF_GRA }, // 15 + { "a71-17.ic31", 0x8000, 0xdeda6387, BRF_GRA }, // 16 + { "a71-18.ic32", 0x8000, 0x330cd9d7, BRF_GRA }, // 17 + { "a71-19.ic33", 0x8000, 0xfc4b29e0, BRF_GRA }, // 18 + { "a71-20.ic34", 0x8000, 0x65acb265, BRF_GRA }, // 19 + { "a71-21.ic35", 0x8000, 0x33cde9b2, BRF_GRA }, // 20 + { "a71-22.ic36", 0x8000, 0xfb98eac0, BRF_GRA }, // 21 + { "a71-23.ic37", 0x8000, 0x30bd46ad, BRF_GRA }, // 22 + + { "a71-25.ic41", 0x0100, 0x2d0f8545, BRF_GRA }, // 23 PROMs + + { "a71-24.ic57", 0x0800, 0x00000000, 6 | BRF_NODUMP }, // 24 Mcu Code + + { "a71-26.ic19", 0x0117, 0x4e1f119c, 7 | BRF_OPT }, // 25 PLDs +}; + +STD_ROM_PICK(tokiou) +STD_ROM_FN(tokiou) + +static struct BurnRomInfo tokiobRomDesc[] = { + { "2.ic4", 0x8000, 0xf583b1ef, BRF_ESS | BRF_PRG }, // 0 Z80 #1 Program Code + { "a71-03.ic5", 0x8000, 0x69dacf44, BRF_ESS | BRF_PRG }, // 1 + { "a71-04.ic6", 0x8000, 0xa0a4ce0e, BRF_ESS | BRF_PRG }, // 2 + { "a71-05.ic7", 0x8000, 0x6da0b945, BRF_ESS | BRF_PRG }, // 3 + { "6.ic8", 0x8000, 0x1490e95b, BRF_ESS | BRF_PRG }, // 4 + + { "a71-01.ic1", 0x8000, 0x0867c707, BRF_ESS | BRF_PRG }, // 5 Z80 #2 Program + + { "a71-07.ic10", 0x8000, 0xf298cc7b, BRF_ESS | BRF_PRG }, // 6 Z80 #3 Program + + { "a71-08.ic12", 0x8000, 0x0439ab13, BRF_GRA }, // 7 Tiles + { "a71-09.ic13", 0x8000, 0xedb3d2ff, BRF_GRA }, // 8 + { "a71-10.ic14", 0x8000, 0x69f0888c, BRF_GRA }, // 9 + { "a71-11.ic15", 0x8000, 0x4ae07c31, BRF_GRA }, // 10 + { "a71-12.ic16", 0x8000, 0x3f6bd706, BRF_GRA }, // 11 + { "a71-13.ic17", 0x8000, 0xf2c92aaa, BRF_GRA }, // 12 + { "a71-14.ic18", 0x8000, 0xc574b7b2, BRF_GRA }, // 13 + { "a71-15.ic19", 0x8000, 0x12d87e7f, BRF_GRA }, // 14 + { "a71-16.ic30", 0x8000, 0x0bce35b6, BRF_GRA }, // 15 + { "a71-17.ic31", 0x8000, 0xdeda6387, BRF_GRA }, // 16 + { "a71-18.ic32", 0x8000, 0x330cd9d7, BRF_GRA }, // 17 + { "a71-19.ic33", 0x8000, 0xfc4b29e0, BRF_GRA }, // 18 + { "a71-20.ic34", 0x8000, 0x65acb265, BRF_GRA }, // 19 + { "a71-21.ic35", 0x8000, 0x33cde9b2, BRF_GRA }, // 20 + { "a71-22.ic36", 0x8000, 0xfb98eac0, BRF_GRA }, // 21 + { "a71-23.ic37", 0x8000, 0x30bd46ad, BRF_GRA }, // 22 + + { "a71-25.ic41", 0x0100, 0x2d0f8545, BRF_GRA }, // 23 PROMs +}; + +STD_ROM_PICK(tokiob) +STD_ROM_FN(tokiob) + + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + + DrvZ80Rom1 = Next; Next += 0x30000; + DrvZ80Rom2 = Next; Next += 0x08000; + DrvZ80Rom3 = Next; Next += 0x0a000; + DrvProm = Next; Next += 0x00100; + if (DrvMCUInUse) { + DrvMcuRom = Next; Next += 0x01000; + } + + RamStart = Next; + + DrvPaletteRam = Next; Next += 0x00200; + DrvVideoRam = Next; Next += 0x01d00; + DrvZ80Ram1 = Next; Next += 0x00400; + DrvZ80Ram3 = Next; Next += 0x01000; + DrvSharedRam = Next; Next += 0x01800; + DrvMcuRam = Next; Next += 0x000c0; + DrvSpriteRam = Next; Next += 0x00300; + + RamEnd = Next; + + DrvTiles = Next; Next += 0x4000 * 8 * 8; + DrvPalette = (UINT32*)Next; Next += 0x00100 * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvDoReset() +{ + for (INT32 i = 0; i < 3; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + if (DrvMCUInUse == 1) { + M6801Reset(); + } else if (DrvMCUInUse == 2) { + m67805_taito_reset(); + } + + BurnYM3526Reset(); + BurnYM2203Reset(); + + DrvRomBank = 0; + DrvSlaveCPUActive = 0; + DrvSoundCPUActive = 0; + DrvMCUActive = 0; + DrvVideoEnable = 0; + DrvFlipScreen = 0; + IC43A = 0; + IC43B = 0; + DrvSoundStatus = 0; + DrvSoundNmiEnable = 0; + DrvSoundNmiPending = 0; + DrvSoundLatch = 0; + mcu_latch = 0; + mcu_address = 0; + + return 0; +} + +static INT32 TokioDoReset() +{ + for (INT32 i = 0; i < 3; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + BurnYM2203Reset(); + + DrvRomBank = 0; + DrvVideoEnable = 1; + DrvFlipScreen = 0; + DrvSoundStatus = 0; + DrvSoundNmiEnable = 0; + DrvSoundNmiPending = 0; + DrvSoundLatch = 0; + + return 0; +} + +UINT8 __fastcall BublboblRead1(UINT16 a) +{ + switch (a) { + case 0xfa00: { + return DrvSoundStatus; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall BublboblWrite1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xfa00: { + DrvSoundLatch = d; + DrvSoundNmiPending = 1; + return; + } + + case 0xfa03: { + if (d) { + ZetClose(); + ZetOpen(2); + ZetReset(); + ZetClose(); + ZetOpen(0); + DrvSoundCPUActive = 0; + } else { + DrvSoundCPUActive = 1; + } + return; + } + + case 0xfa80: { + // watchdog reset + return; + } + case 0xfb40: { + DrvRomBank = (d ^ 0x04) & 0x07; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + + if (!(d & 0x10)) { + ZetClose(); + ZetOpen(1); + ZetReset(); + ZetClose(); + ZetOpen(0); + DrvSlaveCPUActive = 0; + } else { + DrvSlaveCPUActive = 1; + } + + if (!(d & 0x20)) { + if (DrvMCUInUse == 2) { + m67805_taito_reset(); + } else { + M6801Reset(); + } + DrvMCUActive = 0; + } else { + DrvMCUActive = 1; + } + + DrvVideoEnable = d & 0x40; + DrvFlipScreen = d & 0x80; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall BoblboblRead1(UINT16 a) +{ + switch (a) { + case 0xfe00: { + return IC43A << 4; + } + + case 0xfe01: + case 0xfe02: + case 0xfe03: { + return rand() & 0xff; + } + + case 0xfe80: { + return IC43B << 4; + } + + case 0xfe81: + case 0xfe82: + case 0xfe83: { + return 0xff; + } + + case 0xff00: { + return DrvDip[0]; + } + + case 0xff01: { + return DrvDip[1]; + } + + case 0xff02: { + return DrvInput[0]; + } + + case 0xff03: { + return DrvInput[1]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall BoblboblWrite1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xfa00: { + DrvSoundLatch = d; + DrvSoundNmiPending = 1; + return; + } + + case 0xfa03: { + if (d) { + ZetClose(); + ZetOpen(2); + ZetReset(); + ZetClose(); + ZetOpen(0); + DrvSoundCPUActive = 0; + } else { + DrvSoundCPUActive = 1; + } + return; + } + + case 0xfa80: { + // nop + return; + } + + case 0xfb40: { + DrvRomBank = (d ^ 0x04) & 0x07; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + + if (!(d & 0x10)) { + ZetClose(); + ZetOpen(1); + ZetReset(); + ZetClose(); + ZetOpen(0); + DrvSlaveCPUActive = 0; + } else { + DrvSlaveCPUActive = 1; + } + + DrvVideoEnable = d & 0x40; + DrvFlipScreen = d & 0x80; + return; + } + + case 0xfe00: + case 0xfe01: + case 0xfe02: + case 0xfe03: { + INT32 Res = 0; + INT32 Offset = a - 0xfe00; + + switch (Offset) { + case 0x00: { + if (~IC43A & 8) Res ^= 1; + if (~IC43A & 1) Res ^= 2; + if (~IC43A & 1) Res ^= 4; + if (~IC43A & 2) Res ^= 4; + if (~IC43A & 4) Res ^= 8; + break; + } + + case 0x01: { + if (~IC43A & 8) Res ^= 1; + if (~IC43A & 2) Res ^= 1; + if (~IC43A & 8) Res ^= 2; + if (~IC43A & 1) Res ^= 4; + if (~IC43A & 4) Res ^= 8; + break; + } + + case 0x02: { + if (~IC43A & 4) Res ^= 1; + if (~IC43A & 8) Res ^= 2; + if (~IC43A & 2) Res ^= 4; + if (~IC43A & 1) Res ^= 8; + if (~IC43A & 4) Res ^= 8; + break; + } + + case 0x03: { + if (~IC43A & 2) Res ^= 1; + if (~IC43A & 4) Res ^= 2; + if (~IC43A & 8) Res ^= 2; + if (~IC43A & 8) Res ^= 4; + if (~IC43A & 1) Res ^= 8; + break; + } + } + + IC43A = Res; + return; + } + + case 0xfe80: + case 0xfe81: + case 0xfe82: + case 0xfe83: { + INT32 Offset = a - 0xfe80; + static const INT32 XorVal[4] = { 4, 1, 8, 2 }; + + IC43B = (d >> 4) ^ XorVal[Offset]; + return; + } + + case 0xff94: + case 0xff98: { + // nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall DrvSoundRead3(UINT16 a) +{ + switch (a) { + case 0x9000: { + return BurnYM2203Read(0, 0); + } + + case 0x9001: { + return BurnYM2203Read(0, 1); + } + + case 0xa000: { + return BurnYM3526Read(0); + } + + case 0xb000: { + return DrvSoundLatch; + } + + case 0xb001: { + // nop + return 0; + } + + case 0xe000: { + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #3 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall DrvSoundWrite3(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x9000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0x9001: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0xa000: { + BurnYM3526Write(0, d); + return; + } + + case 0xa001: { + BurnYM3526Write(1, d); + return; + } + + case 0xb000: { + DrvSoundStatus = d; + return; + } + + case 0xb001: { + DrvSoundNmiEnable = 1; + if (DrvSoundNmiPending) { + ZetNmi(); + DrvSoundNmiPending = 0; + } + return; + } + + case 0xb002: { + DrvSoundNmiEnable = 0; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #3 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 BublboblMcuReadByte(UINT16 Address) +{ + if (Address >= 0x0040 && Address <= 0x00ff) { + return DrvMcuRam[Address - 0x0040]; + } + + switch (Address) { + case 0x00: { + return ddr1; + } + + case 0x01: { + return ddr2; + } + + case 0x02: { + port1_in = DrvInput[0]; + return (port1_out & ddr1) | (port1_in & ~ddr1); + } + + case 0x03: { + return (port2_out & ddr2) | (port2_in & ~ddr2); + } + + case 0x04: { + return ddr3; + } + + case 0x05: { + return ddr4; + } + + case 0x06: { + return (port3_out & ddr3) | (port3_in & ~ddr3); + } + + case 0x07: { + return (port4_out & ddr4) | (port4_in & ~ddr4); + } + } + + bprintf(PRINT_NORMAL, _T("M6801 Read Byte -> %04X\n"), Address); + + return 0; +} + +void BublboblMcuWriteByte(UINT16 Address, UINT8 Data) +{ + if (Address >= 0x0040 && Address <= 0x00ff) { + DrvMcuRam[Address - 0x0040] = Data; + return; + } + + if (Address > 7 && Address <= 0x001f) { + m6803_internal_registers_w(Address, Data); + if (Address > 7) return; + } + + switch (Address) { + case 0x00: { + ddr1 = Data; + return; + } + + case 0x01: { + ddr2 = Data; + return; + } + + case 0x02: { + if ((port1_out & 0x40) && (~Data & 0x40)) { + ZetOpen(0); + ZetSetVector(DrvZ80Ram1[0]); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + } + + port1_out = Data; + return; + } + + case 0x03: { + if ((~port2_out & 0x10) && (Data & 0x10)) { + INT32 nAddress = port4_out | ((Data & 0x0f) << 8); + + if (port1_out & 0x80) { + if (nAddress == 0x0000) port3_in = DrvDip[0]; + if (nAddress == 0x0001) port3_in = DrvDip[1]; + if (nAddress == 0x0002) port3_in = DrvInput[1]; + if (nAddress == 0x0003) port3_in = DrvInput[2]; + + if (nAddress >= 0x0c00 && nAddress <= 0x0fff) port3_in = DrvZ80Ram1[nAddress - 0x0c00]; + } else { + if (nAddress >= 0x0c00 && nAddress <= 0x0fff) DrvZ80Ram1[nAddress - 0x0c00] = port3_out; + } + } + + port2_out = Data; + return; + } + + case 0x04: { + ddr3 = Data; + return; + } + + case 0x05: { + ddr4 = Data; + return; + } + + case 0x06: { + port3_out = Data; + return; + } + + case 0x07: { + port4_out = Data; + return; + } + } + + bprintf(PRINT_NORMAL, _T("M6801 Write Byte -> %04X, %02X\n"), Address, Data); +} + +void bublbobl_68705_portB_out(UINT8 *bytevalue) +{ + INT32 data = *bytevalue;//lazy + + if ((ddrB & 0x01) && (~data & 0x01) && (portB_out & 0x01)) + { + portA_in = mcu_latch; + } + if ((ddrB & 0x02) && (data & 0x02) && (~portB_out & 0x02)) + { + mcu_address = (mcu_address & 0xff00) | portA_out; + } + if ((ddrB & 0x04) && (data & 0x04) && (~portB_out & 0x04)) + { + mcu_address = (mcu_address & 0x00ff) | ((portA_out & 0x0f) << 8); + } + if ((ddrB & 0x10) && (~data & 0x10) && (portB_out & 0x10)) + { + if (data & 0x08) /* read */ + { + if ((mcu_address & 0x0800) == 0x0000) + { + switch (mcu_address & 3) { + case 0: mcu_latch = DrvDip[0]; break; + case 1: mcu_latch = DrvDip[1]; break; + case 2: mcu_latch = DrvInput[1]; break; + case 3: mcu_latch = DrvInput[2]; break; + } + } + else if ((mcu_address & 0x0c00) == 0x0c00) + { + mcu_latch = DrvZ80Ram1[mcu_address & 0x03ff]; + } + } + else + { + if ((mcu_address & 0x0c00) == 0x0c00) + { + DrvZ80Ram1[mcu_address & 0x03ff] = portA_out; + } + } + } + if ((ddrB & 0x20) && (~data & 0x20) && (portB_out & 0x20)) + { + ZetOpen(0); + + /* hack to get random EXTEND letters (who is supposed to do this? 68705? PAL?) */ + DrvZ80Ram1[0x7c] = (ZetTotalCycles() ^ ZetPc(-1)) % 6; + + ZetSetVector(DrvZ80Ram1[0]); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + } +} + +static void bublbobl_68705_portC_in() +{ + portC_out = DrvInput[0]; + ddrC = 0xff; +} + +static m68705_interface bub68705_m68705_interface = { + NULL, bublbobl_68705_portB_out, NULL, + NULL, NULL, NULL, + NULL, NULL, bublbobl_68705_portC_in +}; + + +void __fastcall TokioWrite1(UINT16 a, UINT8 d) +{ + switch (a) + { + case 0xfa80: { + DrvRomBank = d & 0x07; + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + return; + } + + case 0xfb00: { + DrvFlipScreen = d & 0x80; + return; + } + + case 0xfb80: { + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + return; + } + + case 0xfc00: { + DrvSoundLatch = d; + DrvSoundNmiPending = 1; + return; + } + } +} + +UINT8 __fastcall TokioRead1(UINT16 a) +{ + switch (a) + { + case 0xfa03: { + return DrvDip[0]; + } + + case 0xfa04: { + return DrvDip[1]; + } + + case 0xfa05: { + return DrvInput[0] & ~0x20; + } + + case 0xfa06: { + return DrvInput[1]; + } + + case 0xfa07: { + return DrvInput[2]; + } + + case 0xfc00: { + return DrvSoundStatus; + } + + case 0xfe00: { + return 0xbf; // Mcu read... + } + } + + return 0; +} + +void __fastcall TokioSoundWrite3(UINT16 a, UINT8 d) +{ + switch (a) + { + case 0x9000: { + DrvSoundStatus = d; + return; + } + + case 0xa000: { + DrvSoundNmiEnable = 0; + return; + } + + case 0xa800: { + DrvSoundNmiEnable = 1; + if (DrvSoundNmiPending) { + ZetNmi(); + DrvSoundNmiPending = 0; + } + return; + } + + case 0xb000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0xb001: { + BurnYM2203Write(0, 1, d); + return; + } + } +} + +UINT8 __fastcall TokioSoundRead3(UINT16 a) +{ + switch (a) + { + case 0x9000: { + return DrvSoundLatch; + } + + case 0xb000: { + return BurnYM2203Read(0, 0); + } + + case 0xb001: { + return BurnYM2203Read(0, 1); + } + } + + return 0; +} + +inline static void DrvYM2203IRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3000000; +} + +inline static INT32 DrvYM3526SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 6000000; +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 3000000; +} + +static INT32 TilePlaneOffsets[4] = { 0, 4, 0x200000, 0x200004 }; +static INT32 TileXOffsets[8] = { 3, 2, 1, 0, 11, 10, 9, 8 }; +static INT32 TileYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; + +static INT32 MachineInit() +{ + INT32 nLen; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(BublboblRead1); + ZetSetWriteHandler(BublboblWrite1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0xc000, 0xdcff, 0, DrvVideoRam ); + ZetMapArea(0xc000, 0xdcff, 1, DrvVideoRam ); + ZetMapArea(0xc000, 0xdcff, 2, DrvVideoRam ); + ZetMapArea(0xdd00, 0xdfff, 0, DrvSpriteRam ); + ZetMapArea(0xdd00, 0xdfff, 1, DrvSpriteRam ); + ZetMapArea(0xdd00, 0xdfff, 2, DrvSpriteRam ); + ZetMapArea(0xe000, 0xf7ff, 0, DrvSharedRam ); + ZetMapArea(0xe000, 0xf7ff, 1, DrvSharedRam ); + ZetMapArea(0xe000, 0xf7ff, 2, DrvSharedRam ); + ZetMapArea(0xf800, 0xf9ff, 0, DrvPaletteRam ); + ZetMapArea(0xf800, 0xf9ff, 1, DrvPaletteRam ); + ZetMapArea(0xf800, 0xf9ff, 2, DrvPaletteRam ); + ZetMapArea(0xfc00, 0xffff, 0, DrvZ80Ram1 ); + ZetMapArea(0xfc00, 0xffff, 1, DrvZ80Ram1 ); + ZetMapArea(0xfc00, 0xffff, 2, DrvZ80Ram1 ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2 ); + ZetMapArea(0xe000, 0xf7ff, 0, DrvSharedRam ); + ZetMapArea(0xe000, 0xf7ff, 1, DrvSharedRam ); + ZetMapArea(0xe000, 0xf7ff, 2, DrvSharedRam ); + ZetClose(); + + ZetInit(2); + ZetOpen(2); + ZetSetReadHandler(DrvSoundRead3); + ZetSetWriteHandler(DrvSoundWrite3); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom3 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom3 ); + ZetMapArea(0x8000, 0x8fff, 0, DrvZ80Ram3 ); + ZetMapArea(0x8000, 0x8fff, 1, DrvZ80Ram3 ); + ZetMapArea(0x8000, 0x8fff, 2, DrvZ80Ram3 ); + ZetClose(); + + if (DrvMCUInUse == 1) { + M6801Init(1); + M6801MapMemory(DrvMcuRom, 0xf000, 0xffff, M6801_ROM); + M6801SetReadHandler(BublboblMcuReadByte); + M6801SetWriteHandler(BublboblMcuWriteByte); + } else if (DrvMCUInUse == 2) { + + m67805_taito_init(DrvMcuRom, DrvMcuRam, &bub68705_m68705_interface); + } + + BurnYM2203Init(1, 3000000, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + + BurnYM3526Init(3000000, NULL, &DrvYM3526SynchroniseStream, 1); + BurnTimerAttachZetYM3526(6000000); + BurnYM3526SetRoute(BURN_SND_YM3526_ROUTE, 0.50, BURN_SND_ROUTE_BOTH); + + if (BublboblCallbackFunction()) return 1; + + GenericTilesInit(); + + // Reset the driver + DrvDoReset(); + + return 0; +} + +static INT32 BublboblCallback() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #3 Program Roms + nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load MCU Rom + nRet = BurnLoadRom(DrvMcuRom + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x18000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x28000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x48000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x58000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x68000, 16, 1); if (nRet != 0) return 1; + for (INT32 i = 0; i < 0x80000; i++) DrvTempRom[i] ^= 0xff; + GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); + + // Load the PROM + nRet = BurnLoadRom(DrvProm + 0x00000, 17, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 BublboblInit() +{ + BublboblCallbackFunction = BublboblCallback; + + DrvMCUInUse = 1; + + return MachineInit(); +} + +static INT32 BoblboblCallback() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load Z80 #3 Program Roms + nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x18000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x28000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x48000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x58000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x68000, 16, 1); if (nRet != 0) return 1; + for (INT32 i = 0; i < 0x80000; i++) DrvTempRom[i] ^= 0xff; + GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); + + // Load the PROM + nRet = BurnLoadRom(DrvProm + 0x00000, 17, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + ZetOpen(0); + ZetSetReadHandler(BoblboblRead1); + ZetSetWriteHandler(BoblboblWrite1); + ZetMemCallback(0xfe00, 0xffff, 0); + ZetMemCallback(0xfe00, 0xffff, 1); + ZetMemCallback(0xfe00, 0xffff, 2); + ZetClose(); + + return 0; +} + +static INT32 Boblbobl2Callback() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load Z80 #3 Program Roms + nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x28000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x68000, 11, 1); if (nRet != 0) return 1; + for (INT32 i = 0; i < 0x80000; i++) DrvTempRom[i] ^= 0xff; + GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); + + // Load the PROM + nRet = BurnLoadRom(DrvProm + 0x00000, 12, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + ZetOpen(0); + ZetSetReadHandler(BoblboblRead1); + ZetSetWriteHandler(BoblboblWrite1); + ZetMemCallback(0xfe00, 0xffff, 0); + ZetMemCallback(0xfe00, 0xffff, 1); + ZetMemCallback(0xfe00, 0xffff, 2); + ZetClose(); + + return 0; +} + +static INT32 BoblboblInit() +{ + BublboblCallbackFunction = BoblboblCallback; + + return MachineInit(); +} + +static INT32 Boblbobl2Init() +{ + BublboblCallbackFunction = Boblbobl2Callback; + + return MachineInit(); +} + +static INT32 Bub68705Callback() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load Z80 #3 Program Roms + nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x18000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x28000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x48000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x58000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x68000, 16, 1); if (nRet != 0) return 1; + + for (INT32 i = 0x00000; i < 0x80000; i++) + DrvTempRom[i] ^= 0xff; + + GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); + + // Load the PROM + nRet = BurnLoadRom(DrvProm + 0x00000, 17, 1); if (nRet != 0) return 1; + + // Load the 68705 Rom + nRet = BurnLoadRom(DrvMcuRom + 0x00000, 18, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + return 0; +} + +static INT32 Bub68705Init() +{ + BublboblCallbackFunction = Bub68705Callback; + + DrvMCUInUse = 2; + + return MachineInit(); +} + +static INT32 DlandCallback() +{ + INT32 nRet = 0; + + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 2, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 3, 1); if (nRet != 0) return 1; + + // Load Z80 #3 Program Roms + nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 4, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x00000, 5, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 6, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 10, 1); if (nRet != 0) return 1; + + for (INT32 i = 0x00000; i < 0x40000; i++) + DrvTempRom[i] = BITSWAP08(DrvTempRom[i],7,6,5,4,0,1,2,3) ^ 0xff; + + for (INT32 i = 0x40000; i < 0x80000; i++) + DrvTempRom[i] = BITSWAP08(DrvTempRom[i],7,4,5,6,3,0,1,2) ^ 0xff; + + GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); + + // Load the PROM + nRet = BurnLoadRom(DrvProm + 0x00000, 11, 1); if (nRet != 0) return 1; + + BurnFree(DrvTempRom); + + ZetOpen(0); + ZetSetReadHandler(BoblboblRead1); + ZetSetWriteHandler(BoblboblWrite1); + ZetMemCallback(0xfe00, 0xffff, 0); + ZetMemCallback(0xfe00, 0xffff, 1); + ZetMemCallback(0xfe00, 0xffff, 2); + ZetClose(); + + return 0; +} + +static INT32 DlandInit() +{ + BublboblCallbackFunction = DlandCallback; + + return MachineInit(); +} + +static INT32 TokioInit() +{ + INT32 nLen, nRet; + + // Allocate and Blank all required memory + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(Mem, 0, nLen); + MemIndex(); + + { + DrvTempRom = (UINT8 *)BurnMalloc(0x80000); + + // Load Z80 #1 Program Roms + nRet = BurnLoadRom(DrvZ80Rom1 + 0x00000, 0, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x10000, 1, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x18000, 2, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x20000, 3, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvZ80Rom1 + 0x28000, 4, 1); if (nRet != 0) return 1; + + // Load Z80 #2 Program Roms + nRet = BurnLoadRom(DrvZ80Rom2 + 0x00000, 5, 1); if (nRet != 0) return 1; + + // Load Z80 #3 Program Roms + nRet = BurnLoadRom(DrvZ80Rom3 + 0x00000, 6, 1); if (nRet != 0) return 1; + + // Load and decode the tiles + nRet = BurnLoadRom(DrvTempRom + 0x00000, 7, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x08000, 8, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x10000, 9, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x18000, 10, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x20000, 11, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x28000, 12, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x30000, 13, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x38000, 14, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x40000, 15, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x48000, 16, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x50000, 17, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x58000, 18, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x60000, 19, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x68000, 20, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x70000, 21, 1); if (nRet != 0) return 1; + nRet = BurnLoadRom(DrvTempRom + 0x78000, 22, 1); if (nRet != 0) return 1; + for (INT32 i = 0; i < 0x80000; i++) DrvTempRom[i] ^= 0xff; + GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x80, DrvTempRom, DrvTiles); + + // Load the PROM + nRet = BurnLoadRom(DrvProm + 0x00000, 23, 1); if (nRet != 0) return 1; + + // Load MCU Rom + //BurnLoadRom(DrvMcuRom + 0x00000, 24, 1); + + BurnFree(DrvTempRom); + } + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(TokioRead1); + ZetSetWriteHandler(TokioWrite1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom1 ); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 ); + ZetMapArea(0xc000, 0xdcff, 0, DrvVideoRam ); + ZetMapArea(0xc000, 0xdcff, 1, DrvVideoRam ); + ZetMapArea(0xc000, 0xdcff, 2, DrvVideoRam ); + ZetMapArea(0xdd00, 0xdfff, 0, DrvSpriteRam ); + ZetMapArea(0xdd00, 0xdfff, 1, DrvSpriteRam ); + ZetMapArea(0xdd00, 0xdfff, 2, DrvSpriteRam ); + ZetMapArea(0xe000, 0xf7ff, 0, DrvSharedRam ); + ZetMapArea(0xe000, 0xf7ff, 1, DrvSharedRam ); + ZetMapArea(0xe000, 0xf7ff, 2, DrvSharedRam ); + ZetMapArea(0xf800, 0xf9ff, 0, DrvPaletteRam ); + ZetMapArea(0xf800, 0xf9ff, 1, DrvPaletteRam ); + ZetMapArea(0xf800, 0xf9ff, 2, DrvPaletteRam ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom2 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom2 ); + ZetMapArea(0x8000, 0x97ff, 0, DrvSharedRam ); + ZetMapArea(0x8000, 0x97ff, 1, DrvSharedRam ); + ZetMapArea(0x8000, 0x97ff, 2, DrvSharedRam ); + ZetClose(); + + ZetInit(2); + ZetOpen(2); + ZetSetReadHandler(TokioSoundRead3); + ZetSetWriteHandler(TokioSoundWrite3); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom3 ); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom3 ); + ZetMapArea(0x8000, 0x8fff, 0, DrvZ80Ram3 ); + ZetMapArea(0x8000, 0x8fff, 1, DrvZ80Ram3 ); + ZetMapArea(0x8000, 0x8fff, 2, DrvZ80Ram3 ); + ZetClose(); + + BurnYM2203Init(1, 3000000, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(3000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.10, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.08, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.08, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.08, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvVideoEnable = 1; + DrvMCUInUse = 0; + + // Reset the driver + TokioDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + ZetExit(); + BurnYM2203Exit(); + + if (DrvMCUInUse == 1) M6800Exit(); + if (DrvMCUInUse == 2) m6805Exit(); + + GenericTilesExit(); + + BurnFree(Mem); + + DrvRomBank = 0; + DrvSlaveCPUActive = 0; + DrvSoundCPUActive = 0; + DrvMCUActive = 0; + DrvVideoEnable = 0; + DrvFlipScreen = 0; + IC43A = 0; + IC43B = 0; + DrvSoundStatus = 0; + DrvSoundNmiEnable = 0; + DrvSoundNmiPending = 0; + DrvSoundLatch = 0; + DrvMCUInUse = 0; + + mcu_latch = 0; + mcu_address = 0; + + BublboblCallbackFunction = NULL; + + return 0; +} + +static INT32 BublboblExit() +{ + BurnYM3526Exit(); + return DrvExit(); +} + +static inline UINT8 pal4bit(UINT8 bits) +{ + bits &= 0x0f; + return (bits << 4) | bits; +} + +inline static INT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(nColour >> 12); + g = pal4bit(nColour >> 8); + b = pal4bit(nColour >> 4); + + return BurnHighCol(r, g, b, 0); +} + +static void DrvCalcPalette() +{ + for (INT32 i = 0; i < 0x200; i += 2) { + DrvPalette[i / 2] = CalcCol(DrvPaletteRam[i | 1] | (DrvPaletteRam[i & ~1] << 8)); + } +} + +static void DrvVideoUpdate() +{ + INT32 sx, sy, xc, yc; + INT32 GfxNum, GfxAttr, GfxOffset; + const UINT8 *Prom; + const UINT8 *PromLine; + + if (!DrvVideoEnable) return; + + sx = 0; + + Prom = DrvProm; + + for (INT32 Offset = 0; Offset < 0x300; Offset += 4) { + if (*(UINT32 *)(&DrvSpriteRam[Offset]) == 0) continue; + + GfxNum = DrvSpriteRam[Offset + 1]; + GfxAttr = DrvSpriteRam[Offset + 3]; + PromLine = Prom + 0x80 + ((GfxNum & 0xe0) >> 1); + + GfxOffset = ((GfxNum & 0x1f) * 0x80); + if ((GfxNum & 0xa0) == 0xa0) GfxOffset |= 0x1000; + + sy = -DrvSpriteRam[Offset + 0]; + + for (yc = 0; yc < 32; yc++) { + if (PromLine[yc / 2] & 0x08) continue; + + if (!(PromLine[yc / 2] & 0x04)) { + sx = DrvSpriteRam[Offset + 2]; + if (GfxAttr & 0x40) sx -= 256; + } + + for (xc = 0; xc < 2; xc++) { + INT32 gOffs, Code, Colour, xFlip, yFlip, x, y, yPos; + + gOffs = GfxOffset + xc * 0x40 + (yc & 7) * 0x02 + (PromLine[yc / 2] & 0x03) * 0x10; + Code = DrvVideoRam[gOffs] + 256 * (DrvVideoRam[gOffs + 1] & 0x03) + 1024 * (GfxAttr & 0x0f); + Colour = (DrvVideoRam[gOffs + 1] & 0x3c) >> 2; + xFlip = DrvVideoRam[gOffs + 1] & 0x40; + yFlip = DrvVideoRam[gOffs + 1] & 0x80; + x = sx + xc * 8; + y = (sy + yc * 8) & 0xff; + + if (DrvFlipScreen) { + x = 248 - x; + y = 248 - y; + xFlip = !xFlip; + yFlip = !yFlip; + } + + yPos = y - 16; + + if (x > 8 && x < (nScreenWidth - 8) && yPos > 8 && yPos < (nScreenHeight - 8)) { + if (xFlip) { + if (yFlip) { + Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); + } else { + Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); + } + } else { + if (yFlip) { + Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); + } else { + Render8x8Tile_Mask(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); + } else { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); + } + } else { + if (yFlip) { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, yPos, Colour, 4, 15, 0, DrvTiles); + } + } + } + } + } + + sx += 16; + } +} + +static void DrvDraw() +{ + for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { + pTransDraw[i] = 0x00ff; + } + + DrvCalcPalette(); + DrvVideoUpdate(); + BurnTransferCopy(DrvPalette); +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 100; + + if (DrvReset) DrvDoReset(); + + BublboblMakeInputs(); + + nCyclesTotal[0] = 6000000 / 60; + nCyclesTotal[1] = 6000000 / 60; + nCyclesTotal[2] = 3000000 / 60; + nCyclesTotal[3] = (DrvMCUInUse == 2) ? (4000000 / 60) : (1000000 / 60); + nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = nCyclesDone[3] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + BurnTimerUpdateYM3526(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + if (i == 98 && !DrvMCUInUse) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == 99 && !DrvMCUInUse) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + // Run Z80 #2 + if (DrvSlaveCPUActive) { + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 98) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == 99) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + } + + // Run Z80 #3 + if (DrvSoundCPUActive) { + nCurrentCPU = 2; + ZetOpen(nCurrentCPU); + BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + if (DrvSoundNmiPending) { + if (DrvSoundNmiEnable) { + ZetNmi(); + DrvSoundNmiPending = 0; + } + } + ZetClose(); + } + + if (DrvMCUInUse) { + if (DrvMCUActive) { + nCurrentCPU = 3; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (DrvMCUInUse == 2) { + nCyclesSegment = m6805Run(nCyclesSegment); + if (i == 49) m68705SetIrqLine(0, 1 /*ASSERT_LINE*/); + if (i == 99) m68705SetIrqLine(0, 0 /*CLEAR_LINE*/); + } else { + nCyclesSegment = M6801Run(nCyclesSegment); + if (i == 98) M6801SetIRQLine(0, M6801_IRQSTATUS_ACK); + if (i == 99) M6801SetIRQLine(0, M6801_IRQSTATUS_NONE); + } + + nCyclesDone[nCurrentCPU] += nCyclesSegment; + } + } + } + + ZetOpen(0); + BurnTimerEndFrameYM3526(nCyclesTotal[0]); + ZetClose(); + + if (DrvSoundCPUActive) { + ZetOpen(2); + BurnTimerEndFrame(nCyclesTotal[2]); + ZetClose(); + } + + if (pBurnSoundOut) { + ZetOpen(2); + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + ZetOpen(0); + BurnYM3526Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + } + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 TokioFrame() +{ + INT32 nInterleave = 100; + + if (DrvReset) TokioDoReset(); + + BublboblMakeInputs(); + + nCyclesTotal[0] = 6000000 / 60; + nCyclesTotal[1] = 6000000 / 60; + nCyclesTotal[2] = 3000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; + + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 98) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == 99) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + // Run Z80 #2 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesSegment = ZetRun(nCyclesSegment); + nCyclesDone[nCurrentCPU] += nCyclesSegment; + if (i == 98) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == 99) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + // Run Z80 #3 + nCurrentCPU = 2; + ZetOpen(nCurrentCPU); + BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + if (DrvSoundNmiPending) { + if (DrvSoundNmiEnable) { + ZetNmi(); + DrvSoundNmiPending = 0; + } + } + ZetClose(); + } + + ZetOpen(2); + BurnTimerEndFrame(nCyclesTotal[2]); + ZetClose(); + + if (pBurnSoundOut) { + ZetOpen(2); + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + } + + if (pBurnDraw) DrvDraw(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029706; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + ZetScan(nAction); + if (DrvMCUInUse == 1) M6801Scan(nAction); + if (DrvMCUInUse == 2) m68705_taito_scan(nAction); + + BurnYM2203Scan(nAction, pnMin); + + if (strncmp(BurnDrvGetTextA(DRV_NAME), "tokio", 5) != 0) { + BurnYM3526Scan(nAction, pnMin); + } + + SCAN_VAR(DrvRomBank); + SCAN_VAR(DrvSlaveCPUActive); + SCAN_VAR(DrvSoundCPUActive); + SCAN_VAR(DrvMCUActive); + SCAN_VAR(DrvVideoEnable); + SCAN_VAR(DrvFlipScreen); + SCAN_VAR(IC43A); + SCAN_VAR(IC43B); + SCAN_VAR(DrvSoundStatus); + SCAN_VAR(DrvSoundNmiEnable); + SCAN_VAR(DrvSoundNmiPending); + SCAN_VAR(DrvSoundLatch); + SCAN_VAR(ddr1); + SCAN_VAR(ddr2); + SCAN_VAR(ddr3); + SCAN_VAR(ddr4); + SCAN_VAR(port1_in); + SCAN_VAR(port2_in); + SCAN_VAR(port3_in); + SCAN_VAR(port4_in); + SCAN_VAR(port1_out); + SCAN_VAR(port2_out); + SCAN_VAR(port3_out); + SCAN_VAR(port4_out); + SCAN_VAR(mcu_latch); + SCAN_VAR(mcu_address); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80Rom1 + 0x10000 + (DrvRomBank * 0x4000)); + ZetClose(); + } + + return 0; +} + +struct BurnDriver BurnDrvBublbobl = { + "bublbobl", NULL, NULL, NULL, "1986", + "Bubble Bobble\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, BublboblRomInfo, BublboblRomName, NULL, NULL, BublboblInputInfo, BublboblDIPInfo, + BublboblInit, BublboblExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBublbob1 = { + "bublbobl1", "bublbobl", NULL, NULL, "1986", + "Bubble Bobble (older)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, Bublbob1RomInfo, Bublbob1RomName, NULL, NULL, BublboblInputInfo, BublboblDIPInfo, + BublboblInit, BublboblExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBublbobr = { + "bublboblr", "bublbobl", NULL, NULL, "1986", + "Bubble Bobble (US with mode select)\0", NULL, "Taito America Corporation (Romstar license)", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, BublbobrRomInfo, BublbobrRomName, NULL, NULL, BublboblInputInfo, BublboblDIPInfo, + BublboblInit, BublboblExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBubbobr1 = { + "bublboblr1", "bublbobl", NULL, NULL, "1986", + "Bubble Bobble (US)\0", NULL, "Taito America Corporation (Romstar license)", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, Bubbobr1RomInfo, Bubbobr1RomName, NULL, NULL, BublboblInputInfo, BublboblDIPInfo, + BublboblInit, BublboblExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBoblbobl = { + "boblbobl", "bublbobl", NULL, NULL, "1986", + "Bobble Bobble (set 1)\0", NULL, "bootleg", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, BoblboblRomInfo, BoblboblRomName, NULL, NULL, BoblboblInputInfo, BoblboblDIPInfo, + BoblboblInit, BublboblExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriverD BurnDrvBoblbobl2 = { + "boblbobl2", "bublbobl", NULL, NULL, "1986", + "Bobble Bobble (set 2)\0", NULL, "bootleg", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, Boblbobl2RomInfo, Boblbobl2RomName, NULL, NULL, BoblboblInputInfo, BoblboblDIPInfo, + Boblbobl2Init, BublboblExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSboblboa = { + "sboblboa", "bublbobl", NULL, NULL, "1986", + "Super Bobble Bobble (set 1)\0", NULL, "bootleg", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, SboblboaRomInfo, SboblboaRomName, NULL, NULL, BoblboblInputInfo, BoblboblDIPInfo, + BoblboblInit, BublboblExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSboblbob = { + "sboblbob", "bublbobl", NULL, NULL, "1986", + "Super Bobble Bobble (set 2)\0", NULL, "bootleg", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, SboblbobRomInfo, SboblbobRomName, NULL, NULL, BoblboblInputInfo, SboblbobDIPInfo, + BoblboblInit, BublboblExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvBub68705 = { + "bub68705", "bublbobl", NULL, NULL, "1986", + "Bubble Bobble (boolteg with 68705)\0", NULL, "bootleg", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, Bub68705RomInfo, Bub68705RomName, NULL, NULL, BublboblInputInfo, BublboblDIPInfo, + Bub68705Init, BublboblExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDland = { + "dland", "bublbobl", NULL, NULL, "1987", + "Dream Land / Super Dream Land (bootleg of Bubble Bobble)\0", NULL, "bootleg", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, DlandRomInfo, DlandRomName, NULL, NULL, BoblboblInputInfo, DlandDIPInfo, + DlandInit, BublboblExit, DrvFrame, NULL, DrvScan, + NULL, 0x100, 256, 224, 4, 3 +}; + +struct BurnDriver BurnDrvTokio = { + "tokio", NULL, NULL, NULL, "1986", + "Tokio / Scramble Formation (newer)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, + NULL, tokioRomInfo, tokioRomName, NULL, NULL, TokioInputInfo, TokioDIPInfo, + TokioInit, DrvExit, TokioFrame, NULL, DrvScan, + NULL, 0x100, 224, 256, 3, 4 +}; + +struct BurnDriverD BurnDrvTokioo = { + "tokioo", "tokio", NULL, NULL, "1986", + "Tokio / Scramble Formation (older)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, + NULL, tokiooRomInfo, tokiooRomName, NULL, NULL, TokioInputInfo, TokioDIPInfo, + TokioInit, DrvExit, TokioFrame, NULL, DrvScan, + NULL, 0x100, 224, 256, 3, 4 +}; + +struct BurnDriverD BurnDrvTokiou = { + "tokiou", "tokio", NULL, NULL, "1986", + "Tokio / Scramble Formation (US)\0", NULL, "Taito America Corporation (Romstar license)", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, + NULL, tokiouRomInfo, tokiouRomName, NULL, NULL, TokioInputInfo, TokioDIPInfo, + TokioInit, DrvExit, TokioFrame, NULL, DrvScan, + NULL, 0x100, 224, 256, 3, 4 +}; + +struct BurnDriver BurnDrvTokiob = { + "tokiob", "tokio", NULL, NULL, "1986", + "Tokio / Scramble Formation (bootleg)\0", NULL, "bootleg", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0, + NULL, tokiobRomInfo, tokiobRomName, NULL, NULL, TokioInputInfo, TokioDIPInfo, + TokioInit, DrvExit, TokioFrame, NULL, DrvScan, + NULL, 0x100, 224, 256, 3, 4 +}; diff --git a/src/burn/drv/taito/d_chaknpop.cpp b/src/burn/drv/taito/d_chaknpop.cpp index e83d59d5d..9f79963ba 100644 --- a/src/burn/drv/taito/d_chaknpop.cpp +++ b/src/burn/drv/taito/d_chaknpop.cpp @@ -1,764 +1,763 @@ -// FB Alpha Chack'n Pop driver module -// Based on MAME driver by BUT - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "driver.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvMcuROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvColPROM; -static UINT8 *DrvZ80RAM; -static UINT8 *DrvMcuRAM; -static UINT8 *DrvTxtRAM; -static UINT8 *DrvSprRAM; -static INT16 *pAY8910Buffer[6]; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *gfxmode; -static UINT8 *gfxflip; -static UINT8 *rambank; - -static UINT8 DrvInputs[3]; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvReset; - -static UINT8 mcu_seed; -static UINT8 mcu_result; -static UINT8 mcu_select; - -static struct BurnInputInfo ChaknpopInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 4, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 5, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 7, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Chaknpop) - -static struct BurnDIPInfo ChaknpopDIPList[]= -{ - {0x13, 0xff, 0xff, 0x00, NULL }, - {0x14, 0xff, 0xff, 0x4f, NULL }, - {0x15, 0xff, 0xff, 0x7d, NULL }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x13, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, - {0x13, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, - {0x13, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x13, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, - {0x13, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x13, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, - {0x13, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x13, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, - {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x13, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, - {0x13, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x03, 0x00, "80k and every 100k" }, - {0x14, 0x01, 0x03, 0x01, "60k and every 100k" }, - {0x14, 0x01, 0x03, 0x02, "40k and every 100k" }, - {0x14, 0x01, 0x03, 0x03, "20k and every 100k" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x18, 0x00, "6" }, - {0x14, 0x01, 0x18, 0x08, "3" }, - {0x14, 0x01, 0x18, 0x10, "2" }, - {0x14, 0x01, 0x18, 0x18, "1" }, - - {0 , 0xfe, 0 , 2, "Training/Difficulty" }, - {0x14, 0x01, 0x20, 0x20, "Off/Every 10 Min." }, - {0x14, 0x01, 0x20, 0x00, "On/Every 7 Min." }, - -// {0 , 0xfe, 0 , 2, "Flip Screen" }, -// {0x14, 0x01, 0x40, 0x40, "Off" }, -// {0x14, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x14, 0x01, 0x80, 0x00, "Upright" }, - {0x14, 0x01, 0x80, 0x80, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Language" }, - {0x15, 0x01, 0x01, 0x00, "English" }, - {0x15, 0x01, 0x01, 0x01, "Japanese" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Super Chack'n" }, - {0x15, 0x01, 0x04, 0x04, "pi" }, - {0x15, 0x01, 0x04, 0x00, "1st Chance" }, - - {0 , 0xfe, 0 , 2, "Endless (Cheat)" }, - {0x15, 0x01, 0x08, 0x08, "Off" }, - {0x15, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Credit Info" }, - {0x15, 0x01, 0x10, 0x00, "Off" }, - {0x15, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2, "Show Year" }, - {0x15, 0x01, 0x20, 0x00, "Off" }, - {0x15, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2, "Infinite (Cheat)" }, - {0x15, 0x01, 0x40, 0x40, "Off" }, - {0x15, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x15, 0x01, 0x80, 0x00, "1 Way" }, - {0x15, 0x01, 0x80, 0x80, "2 Way" }, -}; - -STDDIPINFO(Chaknpop) - -static const UINT8 mcu_data[256] = { - 0x3a, 0xe6, 0x80, 0xc6, 0x0e, 0xdd, 0x77, 0xfd, - 0x7e, 0xfe, 0x10, 0x38, 0x10, 0xdd, 0x7e, 0x03, - 0xc6, 0x08, 0xdd, 0x77, 0x03, 0xdd, 0x7e, 0xff, - 0xc6, 0x08, 0xdd, 0x77, 0xff, 0x34, 0x23, 0xc9, - 0x06, 0x10, 0xdd, 0xe5, 0xe1, 0x23, 0x23, 0x23, - 0x4e, 0x23, 0x5e, 0x23, 0x56, 0x23, 0x23, 0x7b, - 0xb2, 0x28, 0x02, 0x79, 0x12, 0x10, 0xf1, 0xc9, - 0xe6, 0x03, 0x87, 0x87, 0x6f, 0x26, 0x00, 0x29, - 0x29, 0x29, 0xe5, 0x29, 0x29, 0x29, 0xc1, 0x09, - 0x01, 0xc3, 0x81, 0x09, 0xe5, 0xdd, 0xe1, 0xc9, - 0x10, 0x00, 0x08, 0x10, 0x20, 0x64, 0x50, 0x00, - 0x08, 0x50, 0xb0, 0x01, 0x34, 0xa0, 0x13, 0x34, - 0xb0, 0x05, 0x34, 0xc0, 0x04, 0x34, 0xd0, 0x02, - 0x34, 0xf0, 0x02, 0x34, 0x00, 0x60, 0x00, 0x00, - 0x3f, 0x00, 0x0c, 0x1f, 0xa0, 0x3f, 0x1e, 0xa2, - 0x01, 0x1e, 0xa1, 0x0a, 0x1e, 0xa2, 0x07, 0x1e, - 0x92, 0x05, 0x1e, 0x02, 0x04, 0x1e, 0x12, 0x09, - 0x3f, 0x22, 0x06, 0x3f, 0x21, 0x03, 0x3f, 0x20, - 0x02, 0x00, 0x00, 0x3f, 0x00, 0x04, 0x02, 0xa0, - 0x40, 0x12, 0xa1, 0x06, 0x12, 0xa2, 0x02, 0x12, - 0xa1, 0x0a, 0x12, 0xa2, 0x07, 0x10, 0x92, 0x05, - 0x10, 0x02, 0x04, 0x12, 0x12, 0x09, 0x12, 0x22, - 0x06, 0x12, 0x21, 0x03, 0x12, 0x20, 0x02, 0x26, - 0x00, 0x14, 0x12, 0x00, 0x00, 0x00, 0x3f, 0x00, - 0x04, 0x1a, 0xa0, 0x40, 0x3f, 0x00, 0x00, 0x00, - 0x3e, 0x3a, 0x87, 0x83, 0x3c, 0x32, 0x87, 0x83, - 0x0f, 0x0f, 0xe6, 0x07, 0xfe, 0x02, 0x20, 0x01, - 0xaf, 0x11, 0x40, 0x98, 0x1d, 0x12, 0x1d, 0x20, - 0xfb, 0x2a, 0x89, 0x83, 0x2b, 0x22, 0x89, 0x83, - 0xc9, 0x3a, 0x5b, 0x81, 0xa7, 0xc0, 0x21, 0x80, - 0x81, 0x11, 0x04, 0x00, 0x06, 0x09, 0x34, 0x19, - 0x10, 0xfc, 0x3e, 0x01, 0x32, 0x5b, 0x81, 0xc9 -}; - -static void mcu_update_seed(UINT8 data) -{ - if (!(data & 0x80)) - { - mcu_seed += 0x83; - mcu_seed = (mcu_seed & 0x80) | (mcu_seed >> 1); - } - - mcu_seed += 0x19; -} - -static void chaknpop_mcu_port_a_write(UINT8 data) -{ - UINT8 mcu_command = data + mcu_seed; - mcu_result = 0; - - if (mcu_command < 0x08) - { - mcu_update_seed(data); - - mcu_result = DrvMcuRAM[mcu_select * 8 + mcu_command] - mcu_seed; - - mcu_update_seed(mcu_result); - } - else if (mcu_command >= 0x28 && mcu_command <= 0x2a) - { - mcu_update_seed(data); - - mcu_result = DrvMcuRAM[0x380 + mcu_command] - mcu_seed; - - mcu_update_seed(mcu_result); - } - else if (mcu_command < 0x80) - { - mcu_update_seed(data); - - if (mcu_command >= 0x40 && mcu_command < 0x60) - { - mcu_select = mcu_command - 0x40; - } - } - else if (mcu_command == 0x9c|| mcu_command == 0xde) - { - mcu_update_seed(data); - } -} - -UINT8 __fastcall chaknpop_read(UINT16 address) -{ - switch (address) - { - case 0x8800: - return mcu_result; - - case 0x8801: - case 0x8802: - return 0xff; // MCU port b & c - - case 0x8804: - case 0x8805: - return AY8910Read(0); - - case 0x8806: - case 0x8807: - return AY8910Read(1); - - case 0x8808: - return DrvDips[2]; - - case 0x8809: - return DrvInputs[1]; - - case 0x880a: - return DrvInputs[0]; - - case 0x880b: - return DrvInputs[2]; - - case 0x880c: - return gfxmode[0]; - } - - return 0; -} - -static void bankswitch(INT32 bank) -{ - if (rambank[0] != bank) { - rambank[0] = bank; - - bank = bank ? 0x4000 : 0; - - ZetMapArea(0xc000, 0xffff, 0, DrvZ80RAM + bank); - ZetMapArea(0xc000, 0xffff, 1, DrvZ80RAM + bank); - ZetMapArea(0xc000, 0xffff, 2, DrvZ80RAM + bank); - } -} - -void __fastcall chaknpop_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x8800: - chaknpop_mcu_port_a_write(data); - return; - - case 0x8801: - case 0x8802: // MCU port b & c - return; - - case 0x8804: - case 0x8805: - AY8910Write(0, address & 1, data); - return; - - case 0x8806: - case 0x8807: - AY8910Write(1, address & 1, data); - return; - - case 0x880c: { - gfxflip[0] = data & 0x01; - gfxflip[1] = data & 0x02; - bankswitch(data & 0x04); - gfxmode[0] = data; - } - return; - - case 0x880d: // coin lockout - return; - } -} - -static UINT8 ay8910_0_read_port_A(UINT32) -{ - return DrvDips[0]; -} - -static UINT8 ay8910_0_read_port_B(UINT32) -{ - return DrvDips[1]; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - AY8910Reset(0); - AY8910Reset(1); - - mcu_seed = 0x81; - mcu_result = 0; - mcu_select = 0; - - rambank[0] = 0xff; - ZetOpen(0); - bankswitch(0); - ZetClose(); - - return 0; -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0; i < 1024; i++) - { - INT32 bit0, bit1, bit2; - - INT32 col = (DrvColPROM[i] & 0x0f) + ((DrvColPROM[i + 1024] & 0x0f) << 4); - - bit0 = (col >> 0) & 0x01; - bit1 = (col >> 1) & 0x01; - bit2 = (col >> 2) & 0x01; - INT32 r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = (col >> 3) & 0x01; - bit1 = (col >> 4) & 0x01; - bit2 = (col >> 5) & 0x01; - INT32 g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - bit0 = 0; - bit1 = (col >> 6) & 0x01; - bit2 = (col >> 7) & 0x01; - INT32 b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - DrvPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[2] = { 0, 0x2000*8 }; - INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7 , 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 }; - INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x4000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x4000); - - GfxDecode(0x0100, 2, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x4000); - - GfxDecode(0x0400, 2, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x00c000; - - DrvMcuROM = Next; Next += 0x000800; - - DrvGfxROM0 = Next; Next += 0x010000; - DrvGfxROM1 = Next; Next += 0x010000; - - DrvColPROM = Next; Next += 0x000800; - - DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); - - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[3] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[4] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[5] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x008000; - DrvTxtRAM = Next; Next += 0x000400; - DrvSprRAM = Next; Next += 0x000100; - DrvMcuRAM = Next; Next += 0x000800; - - gfxflip = Next; Next += 0x000002; - gfxmode = Next; Next += 0x000001; - rambank = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x4000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0x6000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM + 0xa000, 4, 1)) return 1; - - // if (BurnLoadRom(DrvMcuROM + 0x0000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x0000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x2000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x0000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x2000, 9, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x0000, 10, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x0400, 11, 1)) return 1; - - DrvGfxDecode(); - DrvPaletteInit(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0x87ff, 0, DrvMcuRAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvMcuRAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvMcuRAM); - ZetMapArea(0x9000, 0x93ff, 0, DrvTxtRAM); - ZetMapArea(0x9000, 0x93ff, 1, DrvTxtRAM); - ZetMapArea(0x9000, 0x93ff, 2, DrvTxtRAM); - ZetMapArea(0x9800, 0x98ff, 0, DrvSprRAM); - ZetMapArea(0x9800, 0x98ff, 1, DrvSprRAM); - ZetMapArea(0x9800, 0x98ff, 2, DrvSprRAM); - ZetMapArea(0xa000, 0xbfff, 0, DrvZ80ROM + 0xa000); - ZetMapArea(0xa000, 0xbfff, 2, DrvZ80ROM + 0xa000); - bankswitch(0); - ZetSetWriteHandler(chaknpop_write); - ZetSetReadHandler(chaknpop_read); - ZetMemEnd(); - ZetClose(); - - AY8910Init(0, 1536000, nBurnSoundRate, &ay8910_0_read_port_A, &ay8910_0_read_port_B, NULL, NULL); - AY8910Init(1, 1536000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.15, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(0, 0.10, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - ZetExit(); - AY8910Exit(0); - AY8910Exit(1); - - BurnFree (AllMem); - - return 0; -} - -static void draw_sprites() -{ - for (INT32 offs = 0; offs < 0xc0; offs += 4) - { - INT32 sy = 241 - DrvSprRAM[offs + 0x40]; - INT32 attr = DrvSprRAM[offs + 0x41]; - INT32 color = DrvSprRAM[offs + 0x42] & 0x07; - INT32 sx = DrvSprRAM[offs + 0x43]; - INT32 flipx = attr & 0x40; - INT32 flipy = attr & 0x80; - INT32 code = (attr & 0x3f) | ((DrvSprRAM[offs + 0x42] & 0x38) << 3); - - if (gfxflip[0]) { - sx = 240 - sx; - flipx = !flipx; - } - - if (gfxflip[1]) { - sy = 242 - sy; - flipy = !flipy; - } - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy - 16, color, 2, 0, 0, DrvGfxROM0); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy - 16, color, 2, 0, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy - 16, color, 2, 0, 0, DrvGfxROM0); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy - 16, color, 2, 0, 0, DrvGfxROM0); - } - } - } -} - -static void draw_layer() -{ - for (INT32 offs = 32 * 2; offs < 32 * 32 - 32 * 2; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = ((offs >> 5) << 3) - 16; - - INT32 code = DrvTxtRAM[offs]; - INT32 color = (code == 0x74) ? DrvSprRAM[0x0b] : DrvSprRAM[0x01]; - - if (gfxmode[0] & 0x20 && code >= 0xc0) code += 0xc0; - - code |= (gfxmode[0] & 0x80) << 2; - - if (gfxflip[1]) sy = ((sy+16)^0xff)-16; - if (gfxflip[0]) sx ^= 0xff; - - if (gfxflip[1]) { - if (gfxflip[0]) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color+8, 2, 0, DrvGfxROM1); - } else { - Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color+8, 2, 0, DrvGfxROM1); - } - } else { - if (gfxflip[0]) { - Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color+8, 2, 0, DrvGfxROM1); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color+8, 2, 0, DrvGfxROM1); - } - } - } -} - -static void draw_bitmap() -{ - INT32 dx = gfxflip[0] ? -1 : 1; - - for (INT32 offs = 0+(16*32); offs < 0x2000-(16*32); offs++) - { - INT32 x = ((offs & 0x1f) << 3) + 7; - INT32 y = (offs >> 5) - 16; - - if (!gfxflip[0]) x = 255 - x; - if (!gfxflip[1]) y = 255 - y; - - if (y < 0 || y >= nScreenHeight) continue; - - for (INT32 i = 0x80; i > 0; i >>= 1, x += dx) - { - if (x >= nScreenWidth || x < 0) continue; - - UINT32 color = 0; - - if (DrvZ80RAM[0x0000+offs] & i) color |= 0x200; - if (DrvZ80RAM[0x4000+offs] & i) color |= 0x100; - if (DrvZ80RAM[0x2000+offs] & i) color |= 0x080; - if (DrvZ80RAM[0x6000+offs] & i) color |= 0x040; - - if (color) { - pTransDraw[y * nScreenWidth + x] |= color; - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvPaletteInit(); - DrvRecalc = 0; - } - - draw_layer(); - draw_sprites(); - draw_bitmap(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - memset (DrvInputs, 0xff, 3); - - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - } - } - - ZetOpen(0); - ZetRun(2350000 / 60); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - AY8910Scan(nAction, pnMin); - - SCAN_VAR(mcu_seed); - SCAN_VAR(mcu_result); - SCAN_VAR(mcu_select); - } - - if (nAction & ACB_WRITE) { - INT32 bank = rambank[0]; - rambank[0] = 0xff; - ZetOpen(0); - bankswitch(bank); - ZetClose(); - } - - return 0; -} - - -// Chack'n Pop - -static struct BurnRomInfo chaknpopRomDesc[] = { - { "ao4_01.ic28", 0x2000, 0x386fe1c8, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 code - { "ao4_02.ic27", 0x2000, 0x5562a6a7, 1 | BRF_ESS | BRF_PRG }, // 1 - { "ao4_03.ic26", 0x2000, 0x3e2f0a9c, 1 | BRF_ESS | BRF_PRG }, // 2 - { "ao4_04.ic25", 0x2000, 0x5209c7d4, 1 | BRF_ESS | BRF_PRG }, // 3 - { "ao4_05.ic3", 0x2000, 0x8720e024, 1 | BRF_ESS | BRF_PRG }, // 4 - - { "ao4_06.ic23", 0x0800, 0x00000000, 2 | BRF_NODUMP }, // 5 m68705 code (not dumped) - - { "ao4_08.ic14", 0x2000, 0x5575a021, 3 | BRF_GRA }, // 6 Sprites - { "ao4_07.ic15", 0x2000, 0xae687c18, 3 | BRF_GRA }, // 7 - - { "ao4_09.ic98", 0x2000, 0x757a723a, 4 | BRF_GRA }, // 8 Tiles - { "ao4_10.ic97", 0x2000, 0x3e3fd608, 4 | BRF_GRA }, // 9 - - { "ao4-11.ic96", 0x0400, 0x9bf0e85f, 5 | BRF_GRA }, // 10 Color PROMs - { "ao4-12.ic95", 0x0400, 0x954ce8fc, 5 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(chaknpop) -STD_ROM_FN(chaknpop) - -struct BurnDriver BurnDrvChaknpop = { - "chaknpop", NULL, NULL, NULL, "1983", - "Chack'n Pop\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MAZE, 0, - NULL, chaknpopRomInfo, chaknpopRomName, NULL, NULL, ChaknpopInputInfo, ChaknpopDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 256, 224, 4, 3 -}; +// FB Alpha Chack'n Pop driver module +// Based on MAME driver by BUT + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "driver.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvMcuROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvColPROM; +static UINT8 *DrvZ80RAM; +static UINT8 *DrvMcuRAM; +static UINT8 *DrvTxtRAM; +static UINT8 *DrvSprRAM; +static INT16 *pAY8910Buffer[6]; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *gfxmode; +static UINT8 *gfxflip; +static UINT8 *rambank; + +static UINT8 DrvInputs[3]; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvReset; + +static UINT8 mcu_seed; +static UINT8 mcu_result; +static UINT8 mcu_select; + +static struct BurnInputInfo ChaknpopInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 4, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 3, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 2, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 5, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 3, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 2, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 6, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 7, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Chaknpop) + +static struct BurnDIPInfo ChaknpopDIPList[]= +{ + {0x13, 0xff, 0xff, 0x00, NULL }, + {0x14, 0xff, 0xff, 0x4f, NULL }, + {0x15, 0xff, 0xff, 0x7d, NULL }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x13, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, + {0x13, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, + {0x13, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x13, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, + {0x13, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x13, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, + {0x13, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x13, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, + {0x13, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x13, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, + {0x13, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x03, 0x00, "80k and every 100k" }, + {0x14, 0x01, 0x03, 0x01, "60k and every 100k" }, + {0x14, 0x01, 0x03, 0x02, "40k and every 100k" }, + {0x14, 0x01, 0x03, 0x03, "20k and every 100k" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x18, 0x00, "6" }, + {0x14, 0x01, 0x18, 0x08, "3" }, + {0x14, 0x01, 0x18, 0x10, "2" }, + {0x14, 0x01, 0x18, 0x18, "1" }, + + {0 , 0xfe, 0 , 2, "Training/Difficulty" }, + {0x14, 0x01, 0x20, 0x20, "Off/Every 10 Min." }, + {0x14, 0x01, 0x20, 0x00, "On/Every 7 Min." }, + +// {0 , 0xfe, 0 , 2, "Flip Screen" }, +// {0x14, 0x01, 0x40, 0x40, "Off" }, +// {0x14, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x14, 0x01, 0x80, 0x00, "Upright" }, + {0x14, 0x01, 0x80, 0x80, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Language" }, + {0x15, 0x01, 0x01, 0x00, "English" }, + {0x15, 0x01, 0x01, 0x01, "Japanese" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Super Chack'n" }, + {0x15, 0x01, 0x04, 0x04, "pi" }, + {0x15, 0x01, 0x04, 0x00, "1st Chance" }, + + {0 , 0xfe, 0 , 2, "Endless (Cheat)" }, + {0x15, 0x01, 0x08, 0x08, "Off" }, + {0x15, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Credit Info" }, + {0x15, 0x01, 0x10, 0x00, "Off" }, + {0x15, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2, "Show Year" }, + {0x15, 0x01, 0x20, 0x00, "Off" }, + {0x15, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2, "Infinite (Cheat)" }, + {0x15, 0x01, 0x40, 0x40, "Off" }, + {0x15, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x15, 0x01, 0x80, 0x00, "1 Way" }, + {0x15, 0x01, 0x80, 0x80, "2 Way" }, +}; + +STDDIPINFO(Chaknpop) + +static const UINT8 mcu_data[256] = { + 0x3a, 0xe6, 0x80, 0xc6, 0x0e, 0xdd, 0x77, 0xfd, + 0x7e, 0xfe, 0x10, 0x38, 0x10, 0xdd, 0x7e, 0x03, + 0xc6, 0x08, 0xdd, 0x77, 0x03, 0xdd, 0x7e, 0xff, + 0xc6, 0x08, 0xdd, 0x77, 0xff, 0x34, 0x23, 0xc9, + 0x06, 0x10, 0xdd, 0xe5, 0xe1, 0x23, 0x23, 0x23, + 0x4e, 0x23, 0x5e, 0x23, 0x56, 0x23, 0x23, 0x7b, + 0xb2, 0x28, 0x02, 0x79, 0x12, 0x10, 0xf1, 0xc9, + 0xe6, 0x03, 0x87, 0x87, 0x6f, 0x26, 0x00, 0x29, + 0x29, 0x29, 0xe5, 0x29, 0x29, 0x29, 0xc1, 0x09, + 0x01, 0xc3, 0x81, 0x09, 0xe5, 0xdd, 0xe1, 0xc9, + 0x10, 0x00, 0x08, 0x10, 0x20, 0x64, 0x50, 0x00, + 0x08, 0x50, 0xb0, 0x01, 0x34, 0xa0, 0x13, 0x34, + 0xb0, 0x05, 0x34, 0xc0, 0x04, 0x34, 0xd0, 0x02, + 0x34, 0xf0, 0x02, 0x34, 0x00, 0x60, 0x00, 0x00, + 0x3f, 0x00, 0x0c, 0x1f, 0xa0, 0x3f, 0x1e, 0xa2, + 0x01, 0x1e, 0xa1, 0x0a, 0x1e, 0xa2, 0x07, 0x1e, + 0x92, 0x05, 0x1e, 0x02, 0x04, 0x1e, 0x12, 0x09, + 0x3f, 0x22, 0x06, 0x3f, 0x21, 0x03, 0x3f, 0x20, + 0x02, 0x00, 0x00, 0x3f, 0x00, 0x04, 0x02, 0xa0, + 0x40, 0x12, 0xa1, 0x06, 0x12, 0xa2, 0x02, 0x12, + 0xa1, 0x0a, 0x12, 0xa2, 0x07, 0x10, 0x92, 0x05, + 0x10, 0x02, 0x04, 0x12, 0x12, 0x09, 0x12, 0x22, + 0x06, 0x12, 0x21, 0x03, 0x12, 0x20, 0x02, 0x26, + 0x00, 0x14, 0x12, 0x00, 0x00, 0x00, 0x3f, 0x00, + 0x04, 0x1a, 0xa0, 0x40, 0x3f, 0x00, 0x00, 0x00, + 0x3e, 0x3a, 0x87, 0x83, 0x3c, 0x32, 0x87, 0x83, + 0x0f, 0x0f, 0xe6, 0x07, 0xfe, 0x02, 0x20, 0x01, + 0xaf, 0x11, 0x40, 0x98, 0x1d, 0x12, 0x1d, 0x20, + 0xfb, 0x2a, 0x89, 0x83, 0x2b, 0x22, 0x89, 0x83, + 0xc9, 0x3a, 0x5b, 0x81, 0xa7, 0xc0, 0x21, 0x80, + 0x81, 0x11, 0x04, 0x00, 0x06, 0x09, 0x34, 0x19, + 0x10, 0xfc, 0x3e, 0x01, 0x32, 0x5b, 0x81, 0xc9 +}; + +static void mcu_update_seed(UINT8 data) +{ + if (!(data & 0x80)) + { + mcu_seed += 0x83; + mcu_seed = (mcu_seed & 0x80) | (mcu_seed >> 1); + } + + mcu_seed += 0x19; +} + +static void chaknpop_mcu_port_a_write(UINT8 data) +{ + UINT8 mcu_command = data + mcu_seed; + mcu_result = 0; + + if (mcu_command < 0x08) + { + mcu_update_seed(data); + + mcu_result = DrvMcuRAM[mcu_select * 8 + mcu_command] - mcu_seed; + + mcu_update_seed(mcu_result); + } + else if (mcu_command >= 0x28 && mcu_command <= 0x2a) + { + mcu_update_seed(data); + + mcu_result = DrvMcuRAM[0x380 + mcu_command] - mcu_seed; + + mcu_update_seed(mcu_result); + } + else if (mcu_command < 0x80) + { + mcu_update_seed(data); + + if (mcu_command >= 0x40 && mcu_command < 0x60) + { + mcu_select = mcu_command - 0x40; + } + } + else if (mcu_command == 0x9c|| mcu_command == 0xde) + { + mcu_update_seed(data); + } +} + +UINT8 __fastcall chaknpop_read(UINT16 address) +{ + switch (address) + { + case 0x8800: + return mcu_result; + + case 0x8801: + case 0x8802: + return 0xff; // MCU port b & c + + case 0x8804: + case 0x8805: + return AY8910Read(0); + + case 0x8806: + case 0x8807: + return AY8910Read(1); + + case 0x8808: + return DrvDips[2]; + + case 0x8809: + return DrvInputs[1]; + + case 0x880a: + return DrvInputs[0]; + + case 0x880b: + return DrvInputs[2]; + + case 0x880c: + return gfxmode[0]; + } + + return 0; +} + +static void bankswitch(INT32 bank) +{ + if (rambank[0] != bank) { + rambank[0] = bank; + + bank = bank ? 0x4000 : 0; + + ZetMapArea(0xc000, 0xffff, 0, DrvZ80RAM + bank); + ZetMapArea(0xc000, 0xffff, 1, DrvZ80RAM + bank); + ZetMapArea(0xc000, 0xffff, 2, DrvZ80RAM + bank); + } +} + +void __fastcall chaknpop_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x8800: + chaknpop_mcu_port_a_write(data); + return; + + case 0x8801: + case 0x8802: // MCU port b & c + return; + + case 0x8804: + case 0x8805: + AY8910Write(0, address & 1, data); + return; + + case 0x8806: + case 0x8807: + AY8910Write(1, address & 1, data); + return; + + case 0x880c: { + gfxflip[0] = data & 0x01; + gfxflip[1] = data & 0x02; + bankswitch(data & 0x04); + gfxmode[0] = data; + } + return; + + case 0x880d: // coin lockout + return; + } +} + +static UINT8 ay8910_0_read_port_A(UINT32) +{ + return DrvDips[0]; +} + +static UINT8 ay8910_0_read_port_B(UINT32) +{ + return DrvDips[1]; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + AY8910Reset(0); + AY8910Reset(1); + + mcu_seed = 0x81; + mcu_result = 0; + mcu_select = 0; + + rambank[0] = 0xff; + ZetOpen(0); + bankswitch(0); + ZetClose(); + + return 0; +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0; i < 1024; i++) + { + INT32 bit0, bit1, bit2; + + INT32 col = (DrvColPROM[i] & 0x0f) + ((DrvColPROM[i + 1024] & 0x0f) << 4); + + bit0 = (col >> 0) & 0x01; + bit1 = (col >> 1) & 0x01; + bit2 = (col >> 2) & 0x01; + INT32 r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = (col >> 3) & 0x01; + bit1 = (col >> 4) & 0x01; + bit2 = (col >> 5) & 0x01; + INT32 g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + bit0 = 0; + bit1 = (col >> 6) & 0x01; + bit2 = (col >> 7) & 0x01; + INT32 b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + DrvPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[2] = { 0, 0x2000*8 }; + INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7 , 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 }; + INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x4000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x4000); + + GfxDecode(0x0100, 2, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x4000); + + GfxDecode(0x0400, 2, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x00c000; + + DrvMcuROM = Next; Next += 0x000800; + + DrvGfxROM0 = Next; Next += 0x010000; + DrvGfxROM1 = Next; Next += 0x010000; + + DrvColPROM = Next; Next += 0x000800; + + DrvPalette = (UINT32*)Next; Next += 0x0400 * sizeof(UINT32); + + pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[3] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[4] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[5] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x008000; + DrvTxtRAM = Next; Next += 0x000400; + DrvSprRAM = Next; Next += 0x000100; + DrvMcuRAM = Next; Next += 0x000800; + + gfxflip = Next; Next += 0x000002; + gfxmode = Next; Next += 0x000001; + rambank = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x2000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x4000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0x6000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM + 0xa000, 4, 1)) return 1; + + // if (BurnLoadRom(DrvMcuROM + 0x0000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x0000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x2000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x0000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x2000, 9, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x0000, 10, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x0400, 11, 1)) return 1; + + DrvGfxDecode(); + DrvPaletteInit(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0x87ff, 0, DrvMcuRAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvMcuRAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvMcuRAM); + ZetMapArea(0x9000, 0x93ff, 0, DrvTxtRAM); + ZetMapArea(0x9000, 0x93ff, 1, DrvTxtRAM); + ZetMapArea(0x9000, 0x93ff, 2, DrvTxtRAM); + ZetMapArea(0x9800, 0x98ff, 0, DrvSprRAM); + ZetMapArea(0x9800, 0x98ff, 1, DrvSprRAM); + ZetMapArea(0x9800, 0x98ff, 2, DrvSprRAM); + ZetMapArea(0xa000, 0xbfff, 0, DrvZ80ROM + 0xa000); + ZetMapArea(0xa000, 0xbfff, 2, DrvZ80ROM + 0xa000); + bankswitch(0); + ZetSetWriteHandler(chaknpop_write); + ZetSetReadHandler(chaknpop_read); + ZetClose(); + + AY8910Init(0, 1536000, nBurnSoundRate, &ay8910_0_read_port_A, &ay8910_0_read_port_B, NULL, NULL); + AY8910Init(1, 1536000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.15, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(0, 0.10, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + ZetExit(); + AY8910Exit(0); + AY8910Exit(1); + + BurnFree (AllMem); + + return 0; +} + +static void draw_sprites() +{ + for (INT32 offs = 0; offs < 0xc0; offs += 4) + { + INT32 sy = 241 - DrvSprRAM[offs + 0x40]; + INT32 attr = DrvSprRAM[offs + 0x41]; + INT32 color = DrvSprRAM[offs + 0x42] & 0x07; + INT32 sx = DrvSprRAM[offs + 0x43]; + INT32 flipx = attr & 0x40; + INT32 flipy = attr & 0x80; + INT32 code = (attr & 0x3f) | ((DrvSprRAM[offs + 0x42] & 0x38) << 3); + + if (gfxflip[0]) { + sx = 240 - sx; + flipx = !flipx; + } + + if (gfxflip[1]) { + sy = 242 - sy; + flipy = !flipy; + } + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy - 16, color, 2, 0, 0, DrvGfxROM0); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy - 16, color, 2, 0, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy - 16, color, 2, 0, 0, DrvGfxROM0); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy - 16, color, 2, 0, 0, DrvGfxROM0); + } + } + } +} + +static void draw_layer() +{ + for (INT32 offs = 32 * 2; offs < 32 * 32 - 32 * 2; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = ((offs >> 5) << 3) - 16; + + INT32 code = DrvTxtRAM[offs]; + INT32 color = (code == 0x74) ? DrvSprRAM[0x0b] : DrvSprRAM[0x01]; + + if (gfxmode[0] & 0x20 && code >= 0xc0) code += 0xc0; + + code |= (gfxmode[0] & 0x80) << 2; + + if (gfxflip[1]) sy = ((sy+16)^0xff)-16; + if (gfxflip[0]) sx ^= 0xff; + + if (gfxflip[1]) { + if (gfxflip[0]) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color+8, 2, 0, DrvGfxROM1); + } else { + Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color+8, 2, 0, DrvGfxROM1); + } + } else { + if (gfxflip[0]) { + Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color+8, 2, 0, DrvGfxROM1); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color+8, 2, 0, DrvGfxROM1); + } + } + } +} + +static void draw_bitmap() +{ + INT32 dx = gfxflip[0] ? -1 : 1; + + for (INT32 offs = 0+(16*32); offs < 0x2000-(16*32); offs++) + { + INT32 x = ((offs & 0x1f) << 3) + 7; + INT32 y = (offs >> 5) - 16; + + if (!gfxflip[0]) x = 255 - x; + if (!gfxflip[1]) y = 255 - y; + + if (y < 0 || y >= nScreenHeight) continue; + + for (INT32 i = 0x80; i > 0; i >>= 1, x += dx) + { + if (x >= nScreenWidth || x < 0) continue; + + UINT32 color = 0; + + if (DrvZ80RAM[0x0000+offs] & i) color |= 0x200; + if (DrvZ80RAM[0x4000+offs] & i) color |= 0x100; + if (DrvZ80RAM[0x2000+offs] & i) color |= 0x080; + if (DrvZ80RAM[0x6000+offs] & i) color |= 0x040; + + if (color) { + pTransDraw[y * nScreenWidth + x] |= color; + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvPaletteInit(); + DrvRecalc = 0; + } + + draw_layer(); + draw_sprites(); + draw_bitmap(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + memset (DrvInputs, 0xff, 3); + + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + } + } + + ZetOpen(0); + ZetRun(2350000 / 60); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + AY8910Scan(nAction, pnMin); + + SCAN_VAR(mcu_seed); + SCAN_VAR(mcu_result); + SCAN_VAR(mcu_select); + } + + if (nAction & ACB_WRITE) { + INT32 bank = rambank[0]; + rambank[0] = 0xff; + ZetOpen(0); + bankswitch(bank); + ZetClose(); + } + + return 0; +} + + +// Chack'n Pop + +static struct BurnRomInfo chaknpopRomDesc[] = { + { "ao4_01.ic28", 0x2000, 0x386fe1c8, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 code + { "ao4_02.ic27", 0x2000, 0x5562a6a7, 1 | BRF_ESS | BRF_PRG }, // 1 + { "ao4_03.ic26", 0x2000, 0x3e2f0a9c, 1 | BRF_ESS | BRF_PRG }, // 2 + { "ao4_04.ic25", 0x2000, 0x5209c7d4, 1 | BRF_ESS | BRF_PRG }, // 3 + { "ao4_05.ic3", 0x2000, 0x8720e024, 1 | BRF_ESS | BRF_PRG }, // 4 + + { "ao4_06.ic23", 0x0800, 0x00000000, 2 | BRF_NODUMP }, // 5 m68705 code (not dumped) + + { "ao4_08.ic14", 0x2000, 0x5575a021, 3 | BRF_GRA }, // 6 Sprites + { "ao4_07.ic15", 0x2000, 0xae687c18, 3 | BRF_GRA }, // 7 + + { "ao4_09.ic98", 0x2000, 0x757a723a, 4 | BRF_GRA }, // 8 Tiles + { "ao4_10.ic97", 0x2000, 0x3e3fd608, 4 | BRF_GRA }, // 9 + + { "ao4-11.ic96", 0x0400, 0x9bf0e85f, 5 | BRF_GRA }, // 10 Color PROMs + { "ao4-12.ic95", 0x0400, 0x954ce8fc, 5 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(chaknpop) +STD_ROM_FN(chaknpop) + +struct BurnDriver BurnDrvChaknpop = { + "chaknpop", NULL, NULL, NULL, "1983", + "Chack'n Pop\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MAZE, 0, + NULL, chaknpopRomInfo, chaknpopRomName, NULL, NULL, ChaknpopInputInfo, ChaknpopDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 256, 224, 4, 3 +}; diff --git a/src/burn/drv/taito/d_darius2.cpp b/src/burn/drv/taito/d_darius2.cpp index f719f97ba..27c847e6b 100644 --- a/src/burn/drv/taito/d_darius2.cpp +++ b/src/burn/drv/taito/d_darius2.cpp @@ -1,2083 +1,2080 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "taito.h" -#include "taito_ic.h" -#include "burn_ym2610.h" - -static INT32 Ninjaw; - -static double Darius2YM2610Route1MasterVol; -static double Darius2YM2610Route2MasterVol; - -static void Darius2Draw(); -static void Darius2dDraw(); -static void WarriorbDraw(); - -static struct BurnInputInfo Darius2InputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "tilt" }, - {"Freeze" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "freeze" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Darius2) - -static struct BurnInputInfo Darius2dInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "tilt" }, - {"Freeze" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "freeze" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Darius2d) - -static struct BurnInputInfo WarriorbInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 6, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 6, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 7, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "tilt" }, - {"Freeze" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "freeze" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Warriorb) - -static void Darius2MakeInputs() -{ - TC0220IOCInput[0] = 0xe2; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] |= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] |= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; - - for (INT32 i = 0; i < 8; i++) { - TC0220IOCInput[1] -= (TC0220IOCInputPort1[i] & 1) << i; - TC0220IOCInput[2] -= (TC0220IOCInputPort2[i] & 1) << i; - } -} - -static void Darius2dMakeInputs() -{ - TC0220IOCInput[0] = 0xff; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xf7; - - if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; - if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; - if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; - if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] |= 0x08; - if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; - if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; - if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; - if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; - - for (INT32 i = 0; i < 8; i++) { - TC0220IOCInput[0] -= (TC0220IOCInputPort0[i] & 1) << i; - TC0220IOCInput[1] -= (TC0220IOCInputPort1[i] & 1) << i; - } -} - -static void WarriorbMakeInputs() -{ - TC0510NIOInput[0] = 0xff; - TC0510NIOInput[1] = 0xff; - TC0510NIOInput[2] = 0xf7; - - if (TC0510NIOInputPort2[0]) TC0510NIOInput[2] -= 0x01; - if (TC0510NIOInputPort2[1]) TC0510NIOInput[2] -= 0x02; - if (TC0510NIOInputPort2[2]) TC0510NIOInput[2] -= 0x04; - if (TC0510NIOInputPort2[3]) TC0510NIOInput[2] |= 0x08; - if (TC0510NIOInputPort2[4]) TC0510NIOInput[2] -= 0x10; - if (TC0510NIOInputPort2[5]) TC0510NIOInput[2] -= 0x20; - if (TC0510NIOInputPort2[6]) TC0510NIOInput[2] -= 0x40; - if (TC0510NIOInputPort2[7]) TC0510NIOInput[2] -= 0x80; - - for (INT32 i = 0; i < 8; i++) { - TC0510NIOInput[0] -= (TC0510NIOInputPort0[i] & 1) << i; - TC0510NIOInput[1] -= (TC0510NIOInputPort1[i] & 1) << i; - } -} - -static struct BurnDIPInfo Darius2DIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xfe, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Auto Fire" }, - {0x14, 0x01, 0x02, 0x02, "Normal" }, - {0x14, 0x01, 0x02, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x08, 0x00, "Off" }, - {0x14, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x03, 0x02, "Easy" }, - {0x15, 0x01, 0x03, 0x03, "Medium" }, - {0x15, 0x01, 0x03, 0x01, "Hard" }, - {0x15, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x15, 0x01, 0x0c, 0x0c, "every 700k" }, - {0x15, 0x01, 0x0c, 0x08, "every 800k" }, - {0x15, 0x01, 0x0c, 0x04, "every 900k" }, - {0x15, 0x01, 0x0c, 0x00, "every 1000K" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x30, 0x30, "3" }, - {0x15, 0x01, 0x30, 0x20, "4" }, - {0x15, 0x01, 0x30, 0x10, "5" }, - {0x15, 0x01, 0x30, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Invulnerability" }, - {0x15, 0x01, 0x40, 0x40, "Off" }, - {0x15, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x80, 0x00, "Off" }, - {0x15, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Darius2) - -static struct BurnDIPInfo Darius2dDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xfe, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Auto Fire" }, - {0x14, 0x01, 0x02, 0x02, "Normal" }, - {0x14, 0x01, 0x02, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x08, 0x00, "Off" }, - {0x14, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x03, 0x02, "Easy" }, - {0x15, 0x01, 0x03, 0x03, "Medium" }, - {0x15, 0x01, 0x03, 0x01, "Hard" }, - {0x15, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x15, 0x01, 0x0c, 0x0c, "every 700k" }, - {0x15, 0x01, 0x0c, 0x08, "every 800k" }, - {0x15, 0x01, 0x0c, 0x04, "every 900k" }, - {0x15, 0x01, 0x0c, 0x00, "every 1000K" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x15, 0x01, 0x30, 0x30, "3" }, - {0x15, 0x01, 0x30, 0x20, "4" }, - {0x15, 0x01, 0x30, 0x10, "5" }, - {0x15, 0x01, 0x30, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x15, 0x01, 0x80, 0x00, "Off" }, - {0x15, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Darius2d) - -static struct BurnDIPInfo NinjawDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x01, 0x00, "Off" }, - {0x14, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Auto Fire" }, - {0x14, 0x01, 0x02, 0x02, "Normal" }, - {0x14, 0x01, 0x02, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x08, 0x00, "Off" }, - {0x14, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x03, 0x02, "Easy" }, - {0x15, 0x01, 0x03, 0x03, "Medium" }, - {0x15, 0x01, 0x03, 0x01, "Hard" }, - {0x15, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Ninjaw) - -static struct BurnDIPInfo NinjawjDIPList[]= -{ - // Default Values - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x01, 0x00, "Off" }, - {0x14, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Auto Fire" }, - {0x14, 0x01, 0x02, 0x02, "Normal" }, - {0x14, 0x01, 0x02, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x14, 0x01, 0x08, 0x00, "Off" }, - {0x14, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x14, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x14, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x14, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x14, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x03, 0x02, "Easy" }, - {0x15, 0x01, 0x03, 0x03, "Medium" }, - {0x15, 0x01, 0x03, 0x01, "Hard" }, - {0x15, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Ninjawj) - -static struct BurnDIPInfo WarriorbDIPList[]= -{ - // Default Values - {0x16, 0xff, 0xff, 0xff, NULL }, - {0x17, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Vitality Recovery" }, - {0x16, 0x01, 0x03, 0x02, "Less" }, - {0x16, 0x01, 0x03, 0x03, "Normal" }, - {0x16, 0x01, 0x03, 0x01, "More" }, - {0x16, 0x01, 0x03, 0x00, "Most" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x16, 0x01, 0x08, 0x00, "Off" }, - {0x16, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x16, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x16, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x16, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x16, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x16, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x16, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x16, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x16, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x17, 0x01, 0x03, 0x02, "Easy" }, - {0x17, 0x01, 0x03, 0x03, "Medium" }, - {0x17, 0x01, 0x03, 0x01, "Hard" }, - {0x17, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Gold Sheep at" }, - {0x17, 0x01, 0x04, 0x04, "50k only" }, - {0x17, 0x01, 0x04, 0x00, "50k, then every 70k" }, - - {0 , 0xfe, 0 , 2 , "Magic Energy Loss" }, - {0x17, 0x01, 0x08, 0x08, "Always Player" }, - {0x17, 0x01, 0x08, 0x00, "Player or Magician" }, - - {0 , 0xfe, 0 , 2 , "Player Starting Strength" }, - {0x17, 0x01, 0x10, 0x10, "Normal" }, - {0x17, 0x01, 0x10, 0x00, "Full" }, - - {0 , 0xfe, 0 , 2 , "Magician appears" }, - {0x17, 0x01, 0x20, 0x20, "When you get a crystal" }, - {0x17, 0x01, 0x20, 0x00, "Always" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x17, 0x01, 0x40, 0x00, "Off" }, - {0x17, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Rounds" }, - {0x17, 0x01, 0x80, 0x80, "Normal (10-14, depends on skill"}, - {0x17, 0x01, 0x80, 0x00, "Long (14)" }, -}; - -STDDIPINFO(Warriorb) - -static struct BurnRomInfo Darius2RomDesc[] = { - { "c07-32-1", 0x10000, 0x216c8f6a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07-29-1", 0x10000, 0x48de567f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07-31-1", 0x10000, 0x8279d2f8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07-30-1", 0x10000, 0x6122e400, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07-27", 0x20000, 0x0a6f7b6c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07-25", 0x20000, 0x059f40ce, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07-26", 0x20000, 0x1f411242, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07-24", 0x20000, 0x486c9c20, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c07-35-1", 0x10000, 0xdd8c4723, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c07-38-1", 0x10000, 0x46afb85c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c07-34-1", 0x10000, 0x296984b8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c07-37-1", 0x10000, 0x8b7d461f, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c07-33-1", 0x10000, 0x2da03a3f, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c07-36-1", 0x10000, 0x02cf2b1c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c07-28", 0x20000, 0xda304bc5, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c07-03.12", 0x80000, 0x189bafce, BRF_GRA | TAITO_CHARS }, - { "c07-04.11", 0x80000, 0x50421e81, BRF_GRA | TAITO_CHARS }, - - { "c07-01", 0x80000, 0x3cf0f050, BRF_GRA | TAITO_SPRITESA }, - { "c07-02", 0x80000, 0x75d16d4b, BRF_GRA | TAITO_SPRITESA }, - - { "c07-10.95", 0x80000, 0x4bbe0ed9, BRF_SND | TAITO_YM2610A }, - { "c07-11.96", 0x80000, 0x3c815699, BRF_SND | TAITO_YM2610A }, - - { "c07-12.107", 0x80000, 0xe0b71258, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Darius2) -STD_ROM_FN(Darius2) - -static struct BurnRomInfo Darius2dRomDesc[] = { - { "c07_20-2.74", 0x20000, 0xa0f345b8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07_19-2.73", 0x20000, 0x925412c6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07_21-2.76", 0x20000, 0xbdd60e37, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07_18-2.71", 0x20000, 0x23fcd89b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07-09.75", 0x80000, 0xcc69c2ce, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "c07_17.69", 0x20000, 0xae16c905, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c07-03.12", 0x80000, 0x189bafce, BRF_GRA | TAITO_CHARS }, - { "c07-04.11", 0x80000, 0x50421e81, BRF_GRA | TAITO_CHARS }, - - { "c07-06.27", 0x80000, 0x5eebbcd6, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c07-05.24", 0x80000, 0xfb6d0550, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c07-08.25", 0x80000, 0xa07dc846, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c07-07.26", 0x80000, 0xfd9f9e74, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c07-10.95", 0x80000, 0x4bbe0ed9, BRF_SND | TAITO_YM2610A }, - { "c07-11.96", 0x80000, 0x3c815699, BRF_SND | TAITO_YM2610A }, - - { "c07-12.107", 0x80000, 0xe0b71258, BRF_SND | TAITO_YM2610B }, - - { "c07-13.37", 0x00400, 0x3ca18eb3, BRF_OPT }, - { "c07-14.38", 0x00400, 0xbaf2a193, BRF_OPT }, -}; - -STD_ROM_PICK(Darius2d) -STD_ROM_FN(Darius2d) - -static struct BurnRomInfo Darius2doRomDesc[] = { - { "c07_20-1.74", 0x20000, 0x48b0804a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07_19-1.73", 0x20000, 0x1f9a4f83, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07_21-1.76", 0x20000, 0xb491b0ca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07_18-1.71", 0x20000, 0xc552e42f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c07-09.75", 0x80000, 0xcc69c2ce, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "c07_17.69", 0x20000, 0xae16c905, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c07-03.12", 0x80000, 0x189bafce, BRF_GRA | TAITO_CHARS }, - { "c07-04.11", 0x80000, 0x50421e81, BRF_GRA | TAITO_CHARS }, - - { "c07-06.27", 0x80000, 0x5eebbcd6, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c07-05.24", 0x80000, 0xfb6d0550, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c07-08.25", 0x80000, 0xa07dc846, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c07-07.26", 0x80000, 0xfd9f9e74, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c07-10.95", 0x80000, 0x4bbe0ed9, BRF_SND | TAITO_YM2610A }, - { "c07-11.96", 0x80000, 0x3c815699, BRF_SND | TAITO_YM2610A }, - - { "c07-12.107", 0x80000, 0xe0b71258, BRF_SND | TAITO_YM2610B }, - - { "c07-13.37", 0x00400, 0x3ca18eb3, BRF_OPT }, - { "c07-14.38", 0x00400, 0xbaf2a193, BRF_OPT }, -}; - -STD_ROM_PICK(Darius2do) -STD_ROM_FN(Darius2do) - -static struct BurnRomInfo NinjawRomDesc[] = { - { "b31_45.35", 0x10000, 0x107902c3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_47.32", 0x10000, 0xbd536b1e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_29.34", 0x10000, 0xf2941a37, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_27.31", 0x10000, 0x2f3ff642, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_41.5", 0x20000, 0x0daef28a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_39.2", 0x20000, 0xe9197c3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_40.6", 0x20000, 0x2ce0f24e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_38.3", 0x20000, 0xbc68cd99, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b31_33.87", 0x10000, 0x6ce9af44, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_36.97", 0x10000, 0xba20b0d4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_32.86", 0x10000, 0xe6025fec, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_35.96", 0x10000, 0x70d9a89f, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_31.85", 0x10000, 0x837f47e2, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_34.95", 0x10000, 0xd6b5fb2a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b31_37.11", 0x20000, 0x0ca5799d, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b31-01.23", 0x80000, 0x8e8237a7, BRF_GRA | TAITO_CHARS }, - { "b31-02.24", 0x80000, 0x4c3b4e33, BRF_GRA | TAITO_CHARS }, - - { "b31-07.176", 0x80000, 0x33568cdb, BRF_GRA | TAITO_SPRITESA }, - { "b31-06.175", 0x80000, 0x0d59439e, BRF_GRA | TAITO_SPRITESA }, - { "b31-05.174", 0x80000, 0x0a1fc9fb, BRF_GRA | TAITO_SPRITESA }, - { "b31-04.173", 0x80000, 0x2e1e4cb5, BRF_GRA | TAITO_SPRITESA }, - - { "b31-09.18", 0x80000, 0x60a73382, BRF_SND | TAITO_YM2610A }, - { "b31-10.17", 0x80000, 0xc6434aef, BRF_SND | TAITO_YM2610A }, - { "b31-11.16", 0x80000, 0x8da531d4, BRF_SND | TAITO_YM2610A }, - - { "b31-08.19", 0x80000, 0xa0a1f87d, BRF_SND | TAITO_YM2610B }, - - { "b31-25.38", 0x00200, 0xa0b4ba48, BRF_OPT }, - { "b31-26.58", 0x00200, 0x13e5fe15, BRF_OPT }, -}; - -STD_ROM_PICK(Ninjaw) -STD_ROM_FN(Ninjaw) - -static struct BurnRomInfo NinjawjRomDesc[] = { - { "b31_30.35", 0x10000, 0x056edd9f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_28.32", 0x10000, 0xcfa7661c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_29.34", 0x10000, 0xf2941a37, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_27.31", 0x10000, 0x2f3ff642, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_41.5", 0x20000, 0x0daef28a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_39.2", 0x20000, 0xe9197c3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_40.6", 0x20000, 0x2ce0f24e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_38.3", 0x20000, 0xbc68cd99, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b31_33.87", 0x10000, 0x6ce9af44, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_36.97", 0x10000, 0xba20b0d4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_32.86", 0x10000, 0xe6025fec, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_35.96", 0x10000, 0x70d9a89f, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_31.85", 0x10000, 0x837f47e2, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_34.95", 0x10000, 0xd6b5fb2a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b31_37.11", 0x20000, 0x0ca5799d, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b31-01.23", 0x80000, 0x8e8237a7, BRF_GRA | TAITO_CHARS }, - { "b31-02.24", 0x80000, 0x4c3b4e33, BRF_GRA | TAITO_CHARS }, - - { "b31-07.176", 0x80000, 0x33568cdb, BRF_GRA | TAITO_SPRITESA }, - { "b31-06.175", 0x80000, 0x0d59439e, BRF_GRA | TAITO_SPRITESA }, - { "b31-05.174", 0x80000, 0x0a1fc9fb, BRF_GRA | TAITO_SPRITESA }, - { "b31-04.173", 0x80000, 0x2e1e4cb5, BRF_GRA | TAITO_SPRITESA }, - - { "b31-09.18", 0x80000, 0x60a73382, BRF_SND | TAITO_YM2610A }, - { "b31-10.17", 0x80000, 0xc6434aef, BRF_SND | TAITO_YM2610A }, - { "b31-11.16", 0x80000, 0x8da531d4, BRF_SND | TAITO_YM2610A }, - - { "b31-08.19", 0x80000, 0xa0a1f87d, BRF_SND | TAITO_YM2610B }, - - { "b31-25.38", 0x00200, 0xa0b4ba48, BRF_OPT }, - { "b31-26.58", 0x00200, 0x13e5fe15, BRF_OPT }, -}; - -STD_ROM_PICK(Ninjawj) -STD_ROM_FN(Ninjawj) - -static struct BurnRomInfo NinjawuRomDesc[] = { - { "b31_49.35", 0x10000, 0xd38b6391, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_48.32", 0x10000, 0x4b5bb3d8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_29.34", 0x10000, 0xf2941a37, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_27.31", 0x10000, 0x2f3ff642, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_41.5", 0x20000, 0x0daef28a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_39.2", 0x20000, 0xe9197c3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_40.6", 0x20000, 0x2ce0f24e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b31_38.3", 0x20000, 0xbc68cd99, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b31_33.87", 0x10000, 0x6ce9af44, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_36.97", 0x10000, 0xba20b0d4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_32.86", 0x10000, 0xe6025fec, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_35.96", 0x10000, 0x70d9a89f, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_31.85", 0x10000, 0x837f47e2, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b31_34.95", 0x10000, 0xd6b5fb2a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b31_37.11", 0x20000, 0x0ca5799d, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b31-01.23", 0x80000, 0x8e8237a7, BRF_GRA | TAITO_CHARS }, - { "b31-02.24", 0x80000, 0x4c3b4e33, BRF_GRA | TAITO_CHARS }, - - { "b31-07.176", 0x80000, 0x33568cdb, BRF_GRA | TAITO_SPRITESA }, - { "b31-06.175", 0x80000, 0x0d59439e, BRF_GRA | TAITO_SPRITESA }, - { "b31-05.174", 0x80000, 0x0a1fc9fb, BRF_GRA | TAITO_SPRITESA }, - { "b31-04.173", 0x80000, 0x2e1e4cb5, BRF_GRA | TAITO_SPRITESA }, - - { "b31-09.18", 0x80000, 0x60a73382, BRF_SND | TAITO_YM2610A }, - { "b31-10.17", 0x80000, 0xc6434aef, BRF_SND | TAITO_YM2610A }, - { "b31-11.16", 0x80000, 0x8da531d4, BRF_SND | TAITO_YM2610A }, - - { "b31-08.19", 0x80000, 0xa0a1f87d, BRF_SND | TAITO_YM2610B }, - - { "b31-25.38", 0x00200, 0xa0b4ba48, BRF_OPT }, - { "b31-26.58", 0x00200, 0x13e5fe15, BRF_OPT }, -}; - -STD_ROM_PICK(Ninjawu) -STD_ROM_FN(Ninjawu) - -static struct BurnRomInfo WarriorbRomDesc[] = { - { "d24_20-1.74", 0x040000, 0x4452dc25, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d24_19-1.73", 0x040000, 0x15c16016, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d24_21-1.76", 0x040000, 0x783ef8e1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d24_18-1.71", 0x040000, 0x4502db60, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d24-09.75", 0x100000, 0xece5cc59, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "d24_17.69", 0x020000, 0xe41e4aae, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d24-02.12", 0x100000, 0x9f50c271, BRF_GRA | TAITO_CHARS }, - { "d24-01.11", 0x100000, 0x326dcca9, BRF_GRA | TAITO_CHARS }, - - { "d24-07.47", 0x100000, 0x9f50c271, BRF_GRA | TAITO_CHARSB }, - { "d24-08.48", 0x100000, 0x1e6d1528, BRF_GRA | TAITO_CHARSB }, - - { "d24-06.27", 0x100000, 0x918486fe, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "d24-03.24", 0x100000, 0x46db9fd7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "d24-04.25", 0x100000, 0x148e0493, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "d24-05.26", 0x100000, 0x9f414317, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "d24-12.107", 0x100000, 0x279203a1, BRF_SND | TAITO_YM2610A }, - { "d24-10.95", 0x100000, 0x0e0c716d, BRF_SND | TAITO_YM2610A }, - { "d24-11.118", 0x100000, 0x15362573, BRF_SND | TAITO_YM2610A }, - - { "d24-13.37", 0x000400, 0x3ca18eb3, BRF_OPT }, - { "d24-14.38", 0x000400, 0xbaf2a193, BRF_OPT }, -}; - -STD_ROM_PICK(Warriorb) -STD_ROM_FN(Warriorb) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += Taito68KRom1Size; - Taito68KRom2 = Next; Next += Taito68KRom2Size; - TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; - TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; - TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x010000; - Taito68KRam2 = Next; Next += 0x010000; - TaitoZ80Ram1 = Next; Next += 0x002000; - TaitoSharedRam = Next; Next += 0x010000; - TaitoSpriteRam = Next; Next += 0x004000; - - TaitoRamEnd = Next; - - TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; - TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; - - TaitoMemEnd = Next; - - return 0; -} - -static INT32 Darius2dMemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += Taito68KRom1Size; - TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; - TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; - TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x010000; - TaitoZ80Ram1 = Next; Next += 0x002000; - TaitoSpriteRam = Next; Next += 0x001400; - - TaitoRamEnd = Next; - - TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; - TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; - - TaitoMemEnd = Next; - - return 0; -} - -static INT32 WarriorbMemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += Taito68KRom1Size; - TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; - TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; - TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x014000; - TaitoZ80Ram1 = Next; Next += 0x002000; - TaitoSpriteRam = Next; Next += 0x001400; - - TaitoRamEnd = Next; - - TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; - TaitoCharsB = Next; Next += TaitoNumCharB * TaitoCharBWidth * TaitoCharBHeight; - TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; - - TaitoMemEnd = Next; - - return 0; -} - -static void Darius2CpuAReset(UINT16 d) -{ - TaitoCpuACtrl = d; - if (!(TaitoCpuACtrl & 1)) { - SekClose(); - SekOpen(1); - SekReset(); - SekClose(); - SekOpen(0); - } -} - -UINT8 __fastcall Darius268K1ReadByte(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius268K1WriteByte(UINT32 a, UINT8 d) -{ - TC0100SCNTripleScreenByteWrite_Map(0x280000, 0x293fff) - TC0100SCN1ByteWrite_Map(0x2c0000, 0x2d3fff) - TC0100SCN2ByteWrite_Map(0x300000, 0x313fff) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Darius268K1ReadWord(UINT32 a) -{ - switch (a) { - case 0x200000: { - return TC0220IOCPortRegRead(); - } - - case 0x200002: { - return TC0220IOCHalfWordPortRead(); - } - - case 0x220002: { - return TC0140SYTCommRead(); - } - - case 0x340002: { - return TC0110PCRWordRead(0); - } - - case 0x350002: { - return TC0110PCRWordRead(1); - } - - case 0x360002: { - return TC0110PCRWordRead(2); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius268K1WriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0CtrlWordWrite_Map(0x2a0000) - TC0100SCN1CtrlWordWrite_Map(0x2e0000) - TC0100SCN2CtrlWordWrite_Map(0x320000) - TC0100SCNTripleScreenWordWrite_Map(0x280000, 0x293fff) - TC0100SCN1WordWrite_Map(0x2c0000, 0x2d3fff) - TC0100SCN2WordWrite_Map(0x300000, 0x313fff) - - switch (a) { - case 0x200000: { - TC0220IOCHalfWordPortRegWrite(d); - return; - } - - case 0x200002: { - TC0220IOCHalfWordPortWrite(d); - return; - } - - case 0x210000: { - Darius2CpuAReset(d); - return; - } - - case 0x220000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x220002: { - TC0140SYTCommWrite(d); - return; - } - - case 0x340000: - case 0x340002: { - TC0110PCRStep1WordWrite(0, (a - 0x340000) >> 1, d); - return; - } - - case 0x350000: - case 0x350002: { - TC0110PCRStep1WordWrite(1, (a - 0x350000) >> 1, d); - return; - } - - case 0x360000: - case 0x360002: { - TC0110PCRStep1WordWrite(2, (a - 0x360000) >> 1, d); - return; - } - - case 0x340004: - case 0x350004: - case 0x360004: { - //nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Darius268K2ReadByte(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius268K2WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Darius268K2ReadWord(UINT32 a) -{ - switch (a) { - case 0x200000: { - return TC0220IOCPortRegRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius268K2WriteWord(UINT32 a, UINT16 d) -{ - TC0100SCNTripleScreenWordWrite_Map(0x280000, 0x293fff) - - switch (a) { - case 0x210000: { - //??? - return; - } - - case 0x340000: - case 0x340002: { - TC0110PCRStep1WordWrite(0, (a - 0x340000) >> 1, d); - return; - } - - case 0x350000: - case 0x350002: { - TC0110PCRStep1WordWrite(1, (a - 0x350000) >> 1, d); - return; - } - - case 0x360000: - case 0x360002: { - TC0110PCRStep1WordWrite(2, (a - 0x360000) >> 1, d); - return; - } - - case 0x340004: - case 0x350004: - case 0x360004: { - //nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Darius2d68KReadByte(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius2d68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCNDualScreenByteWrite_Map(0x200000, 0x213fff) - TC0100SCN1ByteWrite_Map(0x240000, 0x25ffff) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Darius2d68KReadWord(UINT32 a) -{ - switch (a) { - case 0x400002: { - return TC0110PCRWordRead(0); - } - - case 0x420002: { - return TC0110PCRWordRead(1); - } - - case 0x800000: - case 0x800002: - case 0x800004: - case 0x800006: - case 0x800008: - case 0x80000a: - case 0x80000c: - case 0x80000e: { - return TC0220IOCRead((a - 0x800000) >> 1); - } - - case 0x830002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius2d68KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCNDualScreenWordWrite_Map(0x200000, 0x213fff) - - if (a >= 0x214000 && a <= 0x2141ff) return; - - TC0100SCN0CtrlWordWrite_Map(0x220000) - TC0100SCN1CtrlWordWrite_Map(0x260000) - TC0100SCN1WordWrite_Map(0x240000, 0x25ffff) - - switch (a) { - case 0x400000: - case 0x400002: - case 0x400004: { - TC0110PCRStep1WordWrite(0, (a - 0x400000) >> 1, d); - return; - } - - case 0x420000: - case 0x420002: - case 0x420004: { - TC0110PCRStep1WordWrite(1, (a - 0x420000) >> 1, d); - return; - } - - case 0x800000: - case 0x800002: - case 0x800004: - case 0x800006: - case 0x800008: - case 0x80000a: - case 0x80000c: - case 0x80000e: { - TC0220IOCWrite((a - 0x800000) >> 1, d); - return; - } - - case 0x820000: { - // nop - return; - } - - case 0x830000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x830002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Warriorb68KReadByte(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Warriorb68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCNDualScreenByteWrite_Map(0x300000, 0x313fff) - TC0100SCN1ByteWrite_Map(0x340000, 0x35ffff) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Warriorb68KReadWord(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0x800000) - - switch (a) { - case 0x400002: { - return TC0110PCRWordRead(0); - } - - case 0x420002: { - return TC0110PCRWordRead(1); - } - - case 0x830002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Warriorb68KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCNDualScreenWordWrite_Map(0x300000, 0x313fff) - TC0100SCN1WordWrite_Map(0x340000, 0x35ffff) - - TC0100SCN0CtrlWordWrite_Map(0x320000) - TC0100SCN1CtrlWordWrite_Map(0x360000) - - TC0510NIOHalfWordWrite_Map(0x800000) - - switch (a) { - case 0x400000: - case 0x400002: - case 0x400004: { - TC0110PCRStep1WordWrite(0, (a - 0x400000) >> 1, d); - return; - } - - case 0x420000: - case 0x420002: - case 0x420004: { - TC0110PCRStep1WordWrite(1, (a - 0x420000) >> 1, d); - return; - } - - case 0x820000: { - // nop - return; - } - - case 0x830000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x830002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Darius2Z80Read(UINT16 a) -{ - switch (a) { - case 0xe000: { - return BurnYM2610Read(0); - } - - case 0xe002: { - return BurnYM2610Read(2); - } - - case 0xe201: { - return TC0140SYTSlaveCommRead(); - } - - case 0xea00: { - // NOP - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read %04X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius2Z80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe000: { - BurnYM2610Write(0, d); - return; - } - - case 0xe001: { - BurnYM2610Write(1, d); - return; - } - - case 0xe002: { - BurnYM2610Write(2, d); - return; - } - - case 0xe003: { - BurnYM2610Write(3, d); - return; - } - - case 0xe200: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xe201: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xe400: { - BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_1, Darius2YM2610Route1MasterVol * d / 255.0); - return; - } - - case 0xe401: { - BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_1, Darius2YM2610Route1MasterVol * d / 255.0); - return; - } - - case 0xe402: { - BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_2, Darius2YM2610Route1MasterVol * d / 255.0); - return; - } - - case 0xe403: { - BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_2, Darius2YM2610Route1MasterVol * d / 255.0); - return; - } - - case 0xe600: { - //??? - return; - } - - case 0xee00: { - //nop - return; - } - - case 0xf000: { - //nop - return; - } - - case 0xf200: { - TaitoZ80Bank = (d - 1) & 7; - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write %04X, %02X\n"), a, d); - } - } -} - -static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 CharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; -static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 SpritePlaneOffsets[4] = { 8, 12, 0, 4 }; -static INT32 SpriteXOffsets[16] = { 3, 2, 1, 0, 19, 18, 17, 16, 259, 258, 257, 256, 275, 274, 273, 272 }; -static INT32 SpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; -static INT32 Darius2dSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 Darius2dSpriteXOffsets[16] = { 12, 8, 44, 40, 4, 0, 36, 32, 28, 24, 60, 56, 20, 16, 52, 48 }; -static INT32 Darius2dSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; - -static void Darius2FMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 Darius2SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / (16000000 / 4); -} - -static double Darius2GetTime() -{ - return (double)ZetTotalCycles() / (16000000 / 4); -} - -static INT32 Darius2Init() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x8000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x2000; - - if (Ninjaw) TaitoNumSpriteA = 0x4000; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 22, 16, 0, NULL); - TC0100SCNSetClipArea(0, 288, nScreenHeight, 0); - TC0100SCNInit(1, TaitoNumChar, 24, 16, 0, NULL); - TC0100SCNSetClipArea(1, 288, nScreenHeight, 288); - TC0100SCNSetPaletteOffset(1, 0x1000); - TC0100SCNInit(2, TaitoNumChar, 26, 16, 0, NULL); - TC0100SCNSetClipArea(2, 288, nScreenHeight, 576); - TC0100SCNSetPaletteOffset(2, 0x2000); - TC0110PCRInit(3, 0x3000); - TC0140SYTInit(); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x0c0000, 0x0cffff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x240000, 0x24ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x260000, 0x263fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x280000, 0x293fff, SM_READ); - SekMapMemory(TC0100SCNRam[1] , 0x2c0000, 0x2d3fff, SM_READ); - SekMapMemory(TC0100SCNRam[2] , 0x300000, 0x313fff, SM_READ); - SekSetReadByteHandler(0, Darius268K1ReadByte); - SekSetWriteByteHandler(0, Darius268K1WriteByte); - SekSetReadWordHandler(0, Darius268K1ReadWord); - SekSetWriteWordHandler(0, Darius268K1WriteWord); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x080000, 0x08ffff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x240000, 0x24ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x260000, 0x263fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x280000, 0x293fff, SM_READ); - SekSetReadByteHandler(0, Darius268K2ReadByte); - SekSetWriteByteHandler(0, Darius268K2WriteByte); - SekSetReadWordHandler(0, Darius268K2ReadWord); - SekSetWriteWordHandler(0, Darius268K2WriteWord); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Darius2Z80Read); - ZetSetWriteHandler(Darius2Z80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &Darius2FMIRQHandler, Darius2SynchroniseStream, Darius2GetTime, 0); - BurnTimerAttachZet(16000000 / 4); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - Darius2YM2610Route1MasterVol = 1.00; - Darius2YM2610Route2MasterVol = 1.00; - bYM2610UseSeperateVolumes = 1; - - TaitoDrawFunction = Darius2Draw; - TaitoMakeInputsFunction = Darius2MakeInputs; - TaitoIrqLine = 4; - - nTaitoCyclesTotal[0] = (16000000 / 2) / 60; - nTaitoCyclesTotal[1] = (16000000 / 2) / 60; - nTaitoCyclesTotal[2] = (16000000 / 4) / 60; - - TaitoResetFunction = TaitoDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 Darius2dInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x8000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = Darius2dSpritePlaneOffsets; - TaitoSpriteAXOffsets = Darius2dSpriteXOffsets; - TaitoSpriteAYOffsets = Darius2dSpriteYOffsets; - TaitoNumSpriteA = 0x4000; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - Darius2dMemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - Darius2dMemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 4, 24, 0, NULL); - TC0100SCNSetClipArea(0, 320, nScreenHeight, 0); - TC0100SCNInit(1, TaitoNumChar, 4, 24, 0, NULL); - TC0100SCNSetClipArea(1, 320, nScreenHeight, 320); - TC0100SCNSetPaletteOffset(1, 0x1000); - TC0110PCRInit(2, 0x2000); - TC0140SYTInit(); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x200000, 0x213fff, SM_READ); - SekMapMemory(TC0100SCNRam[1] , 0x240000, 0x253fff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x600000, 0x6013ff, SM_RAM); - SekSetReadByteHandler(0, Darius2d68KReadByte); - SekSetWriteByteHandler(0, Darius2d68KWriteByte); - SekSetReadWordHandler(0, Darius2d68KReadWord); - SekSetWriteWordHandler(0, Darius2d68KWriteWord); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Darius2Z80Read); - ZetSetWriteHandler(Darius2Z80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &Darius2FMIRQHandler, Darius2SynchroniseStream, Darius2GetTime, 0); - BurnTimerAttachZet(16000000 / 4); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - Darius2YM2610Route1MasterVol = 12.00; - Darius2YM2610Route2MasterVol = 12.00; - bYM2610UseSeperateVolumes = 1; - - TaitoDrawFunction = Darius2dDraw; - TaitoMakeInputsFunction = Darius2dMakeInputs; - TaitoIrqLine = 4; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = (16000000 / 4) / 60; - - TaitoResetFunction = TaitoDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 NinjawInit() -{ - Ninjaw = 1; - return Darius2Init(); -} - -static INT32 WarriorbInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x10000; - - TaitoCharBModulo = 0x100; - TaitoCharBNumPlanes = 4; - TaitoCharBWidth = 8; - TaitoCharBHeight = 8; - TaitoCharBPlaneOffsets = CharPlaneOffsets; - TaitoCharBXOffsets = CharXOffsets; - TaitoCharBYOffsets = CharYOffsets; - TaitoNumCharB = 0x10000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = Darius2dSpritePlaneOffsets; - TaitoSpriteAXOffsets = Darius2dSpriteXOffsets; - TaitoSpriteAYOffsets = Darius2dSpriteYOffsets; - TaitoNumSpriteA = 0x8000; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - WarriorbMemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - WarriorbMemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 4, 8, 0, NULL); - TC0100SCNSetClipArea(0, 320, nScreenHeight, 0); - TC0100SCNInit(1, TaitoNumCharB, 5, 8, 0, NULL); - TC0100SCNSetClipArea(1, 320, nScreenHeight, 320); - TC0100SCNSetPaletteOffset(1, 0x1000); - TC0110PCRInit(2, 0x2000); - TC0140SYTInit(); - TC0510NIOInit(); - - if (TaitoLoadRoms(1)) return 1; - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x1fffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x200000, 0x213fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x300000, 0x313fff, SM_READ); - SekMapMemory(TC0100SCNRam[1] , 0x340000, 0x353fff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x600000, 0x6013ff, SM_RAM); - SekSetReadByteHandler(0, Warriorb68KReadByte); - SekSetWriteByteHandler(0, Warriorb68KWriteByte); - SekSetReadWordHandler(0, Warriorb68KReadWord); - SekSetWriteWordHandler(0, Warriorb68KWriteWord); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(Darius2Z80Read); - ZetSetWriteHandler(Darius2Z80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &Darius2FMIRQHandler, Darius2SynchroniseStream, Darius2GetTime, 0); - BurnTimerAttachZet(16000000 / 4); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - Darius2YM2610Route1MasterVol = 12.00; - Darius2YM2610Route2MasterVol = 12.00; - bYM2610UseSeperateVolumes = 1; - - TaitoDrawFunction = WarriorbDraw; - TaitoMakeInputsFunction = WarriorbMakeInputs; - TaitoIrqLine = 4; - - nTaitoCyclesTotal[0] = 16000000 / 60; - nTaitoCyclesTotal[1] = (16000000 / 4) / 60; - - TaitoResetFunction = TaitoDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 Darius2Exit() -{ - Ninjaw = 0; - - return TaitoExit(); -} - -static void Darius2RenderSprites(INT32 PriorityDraw) -{ - INT32 Offset, Data, Code, Colour, xFlip, yFlip; - INT32 x, y, Priority; - - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - - for (Offset = 0x2000 - 4; Offset >=0; Offset -= 4) { - Data = SpriteRam[Offset + 2]; - Code = Data & (TaitoNumSpriteA - 1); - - if (!Code) continue; - - Data = SpriteRam[Offset + 0]; - x = (Data - 32) & 0x3ff; - - Data = SpriteRam[Offset + 1]; - y = (Data - 0) & 0x1ff; - - Data = SpriteRam[Offset + 3]; - xFlip = (Data & 0x1); - yFlip = (Data & 0x2) >> 1; - Priority = (Data & 0x4) >> 2; - - if (Priority != PriorityDraw) continue; - - Colour = (Data & 0x7f00) >> 8; - - y -= 16; - - if (x > 0x3c0) x -= 0x400; - if (y > 0x180) y -= 0x200; - - if (x > 16 && x < (nScreenWidth - 16) && y > 16 && y < (nScreenHeight - 16)) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } - } -} - -static void Darius2dRenderSprites(INT32 PriorityDraw) -{ - INT32 Offset, Data, Code, Colour, xFlip, yFlip; - INT32 x, y, Priority; - - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - -// for (Offset = 0; Offset < 0x001400 / 2; Offset += 4) { - for (Offset = (0x1400 / 2) - 4; Offset >= 0; Offset -= 4) { - Data = SpriteRam[Offset + 1]; - Code = Data & (TaitoNumSpriteA - 1); - - Data = SpriteRam[Offset + 0]; - y = (-(Data & 0x1ff) - 24) & 0x1ff; - yFlip = (Data & 0x200) >> 9; - - Data = SpriteRam[Offset + 2]; - Priority = (Data & 0x100) >> 8; - Colour = Data & 0x7f; - - Data = SpriteRam[Offset + 3]; - x = Data & 0x3ff; - xFlip = (Data & 0x400) >> 10; - - if (Priority != PriorityDraw) continue; - - y -= 16; - - if (x > 0x3c0) x -= 0x400; - if (y > 0x180) y -= 0x200; - - if (x > 16 && x < (nScreenWidth - 16) && y > 16 && y < (nScreenHeight - 16)) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } - } -} - -static void Darius2Draw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - INT32 Disable2 = TC0100SCNCtrl[1][6] & 0xf7; - INT32 Disable3 = TC0100SCNCtrl[2][6] & 0xf7; - - BurnTransferClear(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); - if (!(Disable3 & 0x02)) TC0100SCNRenderFgLayer(2, 0, TaitoChars); - Darius2RenderSprites(1); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoChars); - if (!(Disable3 & 0x01)) TC0100SCNRenderBgLayer(2, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoChars); - if (!(Disable3 & 0x01)) TC0100SCNRenderBgLayer(2, 0, TaitoChars); - Darius2RenderSprites(1); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); - if (!(Disable3 & 0x02)) TC0100SCNRenderFgLayer(2, 0, TaitoChars); - } - - Darius2RenderSprites(0); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); - if (!(Disable3 & 0x04)) TC0100SCNRenderCharLayer(2); - BurnTransferCopy(TC0110PCRPalette); -} - -static void Darius2dDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - INT32 Disable2 = TC0100SCNCtrl[1][6] & 0xf7; - - BurnTransferClear(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); - Darius2dRenderSprites(1); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoChars); - Darius2dRenderSprites(1); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); - } - - Darius2dRenderSprites(0); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); - BurnTransferCopy(TC0110PCRPalette); -} - -static void WarriorbDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - INT32 Disable2 = TC0100SCNCtrl[1][6] & 0xf7; - - BurnTransferClear(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoCharsB); - Darius2dRenderSprites(1); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoCharsB); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoCharsB); - Darius2dRenderSprites(1); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoCharsB); - } - - Darius2dRenderSprites(0); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); - BurnTransferCopy(TC0110PCRPalette); -} - -static INT32 Darius2Frame() -{ - INT32 nInterleave = 100; - - if (TaitoReset) TaitoResetFunction(); - - TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 # 1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run 68000 # 2 - if ((TaitoCpuACtrl & 0x01)) { - nCurrentCPU = 1; - SekOpen(1); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - } - - ZetOpen(0); - BurnTimerUpdate(i * (nTaitoCyclesTotal[2] / nInterleave)); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[2]); - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) TaitoDrawFunction(); - - return 0; -} - -static INT32 Darius2dFrame() -{ - INT32 nInterleave = 100; - - if (TaitoReset) TaitoResetFunction(); - - TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[2] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 # 1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - - ZetOpen(0); - BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[1]); - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) TaitoDrawFunction(); - - return 0; -} - -static INT32 Darius2Scan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029684; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = TaitoRamStart; - ba.nLen = TaitoRamEnd-TaitoRamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - TaitoICScan(nAction); - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - if (TaitoNumYM2610) BurnYM2610Scan(nAction, pnMin); - - SCAN_VAR(TaitoInput); - SCAN_VAR(TaitoZ80Bank); - SCAN_VAR(nTaitoCyclesDone); - SCAN_VAR(nTaitoCyclesSegment); - } - - if (nAction & ACB_WRITE && TaitoZ80Bank) { - ZetOpen(0); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetClose(); - } - - return 0; -} - -struct BurnDriver BurnDrvDarius2 = { - "darius2", NULL, NULL, NULL, "1989", - "Darius II (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, - NULL, Darius2RomInfo, Darius2RomName, NULL, NULL, Darius2InputInfo, Darius2DIPInfo, - Darius2Init, Darius2Exit, Darius2Frame, NULL, Darius2Scan, - NULL, 0x3000, 864, 224, 12, 3 -}; - -struct BurnDriver BurnDrvDarius2d = { - "darius2d", "darius2", NULL, NULL, "1989", - "Darius II (dual screen) (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, - NULL, Darius2dRomInfo, Darius2dRomName, NULL, NULL, Darius2dInputInfo, Darius2dDIPInfo, - Darius2dInit, Darius2Exit, Darius2dFrame, NULL, Darius2Scan, - NULL, 0x2000, 640, 224, 8, 3 -}; - -struct BurnDriver BurnDrvDarius2do = { - "darius2do", "darius2", NULL, NULL, "1989", - "Darius II (dual screen) (Japan old version)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, - NULL, Darius2doRomInfo, Darius2doRomName, NULL, NULL, Darius2dInputInfo, Darius2dDIPInfo, - Darius2dInit, Darius2Exit, Darius2dFrame, NULL, Darius2Scan, - NULL, 0x2000, 640, 224, 8, 3 -}; - -struct BurnDriver BurnDrvNinjaw = { - "ninjaw", NULL, NULL, NULL, "1987", - "The Ninja Warriors (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, NinjawRomInfo, NinjawRomName, NULL, NULL, Darius2InputInfo, NinjawDIPInfo, - NinjawInit, Darius2Exit, Darius2Frame, NULL, Darius2Scan, - NULL, 0x3000, 864, 224, 12, 3 -}; - -struct BurnDriver BurnDrvNinjawj = { - "ninjawj", "ninjaw", NULL, NULL, "1987", - "The Ninja Warriors (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, NinjawjRomInfo, NinjawjRomName, NULL, NULL, Darius2InputInfo, NinjawjDIPInfo, - NinjawInit, Darius2Exit, Darius2Frame, NULL, Darius2Scan, - NULL, 0x3000, 864, 224, 12, 3 -}; - -struct BurnDriver BurnDrvNinjawu = { - "ninjawu", "ninjaw", NULL, NULL, "1987", - "The Ninja Warriors (US)\0", NULL, "Taito Corporation America (licensed to Romstar)", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, NinjawuRomInfo, NinjawuRomName, NULL, NULL, Darius2InputInfo, NinjawjDIPInfo, - NinjawInit, Darius2Exit, Darius2Frame, NULL, Darius2Scan, - NULL, 0x3000, 864, 224, 12, 3 -}; - -struct BurnDriver BurnDrvWarriorb = { - "warriorb", NULL, NULL, NULL, "1991", - "Warrior Blade - Rastan Saga Episode III (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, - NULL, WarriorbRomInfo, WarriorbRomName, NULL, NULL, WarriorbInputInfo, WarriorbDIPInfo, - WarriorbInit, Darius2Exit, Darius2dFrame, NULL, Darius2Scan, - NULL, 0x2000, 640, 240, 8, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "taito.h" +#include "taito_ic.h" +#include "burn_ym2610.h" + +static INT32 Ninjaw; + +static double Darius2YM2610Route1MasterVol; +static double Darius2YM2610Route2MasterVol; + +static void Darius2Draw(); +static void Darius2dDraw(); +static void WarriorbDraw(); + +static struct BurnInputInfo Darius2InputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "tilt" }, + {"Freeze" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "freeze" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Darius2) + +static struct BurnInputInfo Darius2dInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "tilt" }, + {"Freeze" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "freeze" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Darius2d) + +static struct BurnInputInfo WarriorbInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 6, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 6, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 7, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "tilt" }, + {"Freeze" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "freeze" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Warriorb) + +static void Darius2MakeInputs() +{ + TC0220IOCInput[0] = 0xe2; + TC0220IOCInput[1] = 0xff; + TC0220IOCInput[2] = 0xff; + + if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] |= 0x01; + if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; + if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; + if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; + if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] |= 0x10; + if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; + if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; + if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; + + for (INT32 i = 0; i < 8; i++) { + TC0220IOCInput[1] -= (TC0220IOCInputPort1[i] & 1) << i; + TC0220IOCInput[2] -= (TC0220IOCInputPort2[i] & 1) << i; + } +} + +static void Darius2dMakeInputs() +{ + TC0220IOCInput[0] = 0xff; + TC0220IOCInput[1] = 0xff; + TC0220IOCInput[2] = 0xf7; + + if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; + if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; + if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; + if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] |= 0x08; + if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; + if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; + if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; + if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; + + for (INT32 i = 0; i < 8; i++) { + TC0220IOCInput[0] -= (TC0220IOCInputPort0[i] & 1) << i; + TC0220IOCInput[1] -= (TC0220IOCInputPort1[i] & 1) << i; + } +} + +static void WarriorbMakeInputs() +{ + TC0510NIOInput[0] = 0xff; + TC0510NIOInput[1] = 0xff; + TC0510NIOInput[2] = 0xf7; + + if (TC0510NIOInputPort2[0]) TC0510NIOInput[2] -= 0x01; + if (TC0510NIOInputPort2[1]) TC0510NIOInput[2] -= 0x02; + if (TC0510NIOInputPort2[2]) TC0510NIOInput[2] -= 0x04; + if (TC0510NIOInputPort2[3]) TC0510NIOInput[2] |= 0x08; + if (TC0510NIOInputPort2[4]) TC0510NIOInput[2] -= 0x10; + if (TC0510NIOInputPort2[5]) TC0510NIOInput[2] -= 0x20; + if (TC0510NIOInputPort2[6]) TC0510NIOInput[2] -= 0x40; + if (TC0510NIOInputPort2[7]) TC0510NIOInput[2] -= 0x80; + + for (INT32 i = 0; i < 8; i++) { + TC0510NIOInput[0] -= (TC0510NIOInputPort0[i] & 1) << i; + TC0510NIOInput[1] -= (TC0510NIOInputPort1[i] & 1) << i; + } +} + +static struct BurnDIPInfo Darius2DIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xfe, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Auto Fire" }, + {0x14, 0x01, 0x02, 0x02, "Normal" }, + {0x14, 0x01, 0x02, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x08, 0x00, "Off" }, + {0x14, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x03, 0x02, "Easy" }, + {0x15, 0x01, 0x03, 0x03, "Medium" }, + {0x15, 0x01, 0x03, 0x01, "Hard" }, + {0x15, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x15, 0x01, 0x0c, 0x0c, "every 700k" }, + {0x15, 0x01, 0x0c, 0x08, "every 800k" }, + {0x15, 0x01, 0x0c, 0x04, "every 900k" }, + {0x15, 0x01, 0x0c, 0x00, "every 1000K" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x30, 0x30, "3" }, + {0x15, 0x01, 0x30, 0x20, "4" }, + {0x15, 0x01, 0x30, 0x10, "5" }, + {0x15, 0x01, 0x30, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Invulnerability" }, + {0x15, 0x01, 0x40, 0x40, "Off" }, + {0x15, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x80, 0x00, "Off" }, + {0x15, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Darius2) + +static struct BurnDIPInfo Darius2dDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xfe, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Auto Fire" }, + {0x14, 0x01, 0x02, 0x02, "Normal" }, + {0x14, 0x01, 0x02, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x08, 0x00, "Off" }, + {0x14, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x03, 0x02, "Easy" }, + {0x15, 0x01, 0x03, 0x03, "Medium" }, + {0x15, 0x01, 0x03, 0x01, "Hard" }, + {0x15, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x15, 0x01, 0x0c, 0x0c, "every 700k" }, + {0x15, 0x01, 0x0c, 0x08, "every 800k" }, + {0x15, 0x01, 0x0c, 0x04, "every 900k" }, + {0x15, 0x01, 0x0c, 0x00, "every 1000K" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x15, 0x01, 0x30, 0x30, "3" }, + {0x15, 0x01, 0x30, 0x20, "4" }, + {0x15, 0x01, 0x30, 0x10, "5" }, + {0x15, 0x01, 0x30, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x15, 0x01, 0x80, 0x00, "Off" }, + {0x15, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Darius2d) + +static struct BurnDIPInfo NinjawDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x01, 0x00, "Off" }, + {0x14, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Auto Fire" }, + {0x14, 0x01, 0x02, 0x02, "Normal" }, + {0x14, 0x01, 0x02, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x08, 0x00, "Off" }, + {0x14, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x03, 0x02, "Easy" }, + {0x15, 0x01, 0x03, 0x03, "Medium" }, + {0x15, 0x01, 0x03, 0x01, "Hard" }, + {0x15, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Ninjaw) + +static struct BurnDIPInfo NinjawjDIPList[]= +{ + // Default Values + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x01, 0x00, "Off" }, + {0x14, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Auto Fire" }, + {0x14, 0x01, 0x02, 0x02, "Normal" }, + {0x14, 0x01, 0x02, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x14, 0x01, 0x08, 0x00, "Off" }, + {0x14, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x14, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x14, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x14, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x14, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x03, 0x02, "Easy" }, + {0x15, 0x01, 0x03, 0x03, "Medium" }, + {0x15, 0x01, 0x03, 0x01, "Hard" }, + {0x15, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Ninjawj) + +static struct BurnDIPInfo WarriorbDIPList[]= +{ + // Default Values + {0x16, 0xff, 0xff, 0xff, NULL }, + {0x17, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Vitality Recovery" }, + {0x16, 0x01, 0x03, 0x02, "Less" }, + {0x16, 0x01, 0x03, 0x03, "Normal" }, + {0x16, 0x01, 0x03, 0x01, "More" }, + {0x16, 0x01, 0x03, 0x00, "Most" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x16, 0x01, 0x08, 0x00, "Off" }, + {0x16, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x16, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x16, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x16, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x16, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x16, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x16, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x16, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x16, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x17, 0x01, 0x03, 0x02, "Easy" }, + {0x17, 0x01, 0x03, 0x03, "Medium" }, + {0x17, 0x01, 0x03, 0x01, "Hard" }, + {0x17, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Gold Sheep at" }, + {0x17, 0x01, 0x04, 0x04, "50k only" }, + {0x17, 0x01, 0x04, 0x00, "50k, then every 70k" }, + + {0 , 0xfe, 0 , 2 , "Magic Energy Loss" }, + {0x17, 0x01, 0x08, 0x08, "Always Player" }, + {0x17, 0x01, 0x08, 0x00, "Player or Magician" }, + + {0 , 0xfe, 0 , 2 , "Player Starting Strength" }, + {0x17, 0x01, 0x10, 0x10, "Normal" }, + {0x17, 0x01, 0x10, 0x00, "Full" }, + + {0 , 0xfe, 0 , 2 , "Magician appears" }, + {0x17, 0x01, 0x20, 0x20, "When you get a crystal" }, + {0x17, 0x01, 0x20, 0x00, "Always" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x17, 0x01, 0x40, 0x00, "Off" }, + {0x17, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Rounds" }, + {0x17, 0x01, 0x80, 0x80, "Normal (10-14, depends on skill"}, + {0x17, 0x01, 0x80, 0x00, "Long (14)" }, +}; + +STDDIPINFO(Warriorb) + +static struct BurnRomInfo Darius2RomDesc[] = { + { "c07-32-1", 0x10000, 0x216c8f6a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07-29-1", 0x10000, 0x48de567f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07-31-1", 0x10000, 0x8279d2f8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07-30-1", 0x10000, 0x6122e400, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07-27", 0x20000, 0x0a6f7b6c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07-25", 0x20000, 0x059f40ce, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07-26", 0x20000, 0x1f411242, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07-24", 0x20000, 0x486c9c20, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c07-35-1", 0x10000, 0xdd8c4723, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c07-38-1", 0x10000, 0x46afb85c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c07-34-1", 0x10000, 0x296984b8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c07-37-1", 0x10000, 0x8b7d461f, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c07-33-1", 0x10000, 0x2da03a3f, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c07-36-1", 0x10000, 0x02cf2b1c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c07-28", 0x20000, 0xda304bc5, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c07-03.12", 0x80000, 0x189bafce, BRF_GRA | TAITO_CHARS }, + { "c07-04.11", 0x80000, 0x50421e81, BRF_GRA | TAITO_CHARS }, + + { "c07-01", 0x80000, 0x3cf0f050, BRF_GRA | TAITO_SPRITESA }, + { "c07-02", 0x80000, 0x75d16d4b, BRF_GRA | TAITO_SPRITESA }, + + { "c07-10.95", 0x80000, 0x4bbe0ed9, BRF_SND | TAITO_YM2610A }, + { "c07-11.96", 0x80000, 0x3c815699, BRF_SND | TAITO_YM2610A }, + + { "c07-12.107", 0x80000, 0xe0b71258, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Darius2) +STD_ROM_FN(Darius2) + +static struct BurnRomInfo Darius2dRomDesc[] = { + { "c07_20-2.74", 0x20000, 0xa0f345b8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07_19-2.73", 0x20000, 0x925412c6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07_21-2.76", 0x20000, 0xbdd60e37, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07_18-2.71", 0x20000, 0x23fcd89b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07-09.75", 0x80000, 0xcc69c2ce, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "c07_17.69", 0x20000, 0xae16c905, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c07-03.12", 0x80000, 0x189bafce, BRF_GRA | TAITO_CHARS }, + { "c07-04.11", 0x80000, 0x50421e81, BRF_GRA | TAITO_CHARS }, + + { "c07-06.27", 0x80000, 0x5eebbcd6, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c07-05.24", 0x80000, 0xfb6d0550, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c07-08.25", 0x80000, 0xa07dc846, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c07-07.26", 0x80000, 0xfd9f9e74, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c07-10.95", 0x80000, 0x4bbe0ed9, BRF_SND | TAITO_YM2610A }, + { "c07-11.96", 0x80000, 0x3c815699, BRF_SND | TAITO_YM2610A }, + + { "c07-12.107", 0x80000, 0xe0b71258, BRF_SND | TAITO_YM2610B }, + + { "c07-13.37", 0x00400, 0x3ca18eb3, BRF_OPT }, + { "c07-14.38", 0x00400, 0xbaf2a193, BRF_OPT }, +}; + +STD_ROM_PICK(Darius2d) +STD_ROM_FN(Darius2d) + +static struct BurnRomInfo Darius2doRomDesc[] = { + { "c07_20-1.74", 0x20000, 0x48b0804a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07_19-1.73", 0x20000, 0x1f9a4f83, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07_21-1.76", 0x20000, 0xb491b0ca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07_18-1.71", 0x20000, 0xc552e42f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c07-09.75", 0x80000, 0xcc69c2ce, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "c07_17.69", 0x20000, 0xae16c905, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c07-03.12", 0x80000, 0x189bafce, BRF_GRA | TAITO_CHARS }, + { "c07-04.11", 0x80000, 0x50421e81, BRF_GRA | TAITO_CHARS }, + + { "c07-06.27", 0x80000, 0x5eebbcd6, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c07-05.24", 0x80000, 0xfb6d0550, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c07-08.25", 0x80000, 0xa07dc846, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c07-07.26", 0x80000, 0xfd9f9e74, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c07-10.95", 0x80000, 0x4bbe0ed9, BRF_SND | TAITO_YM2610A }, + { "c07-11.96", 0x80000, 0x3c815699, BRF_SND | TAITO_YM2610A }, + + { "c07-12.107", 0x80000, 0xe0b71258, BRF_SND | TAITO_YM2610B }, + + { "c07-13.37", 0x00400, 0x3ca18eb3, BRF_OPT }, + { "c07-14.38", 0x00400, 0xbaf2a193, BRF_OPT }, +}; + +STD_ROM_PICK(Darius2do) +STD_ROM_FN(Darius2do) + +static struct BurnRomInfo NinjawRomDesc[] = { + { "b31_45.35", 0x10000, 0x107902c3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_47.32", 0x10000, 0xbd536b1e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_29.34", 0x10000, 0xf2941a37, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_27.31", 0x10000, 0x2f3ff642, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_41.5", 0x20000, 0x0daef28a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_39.2", 0x20000, 0xe9197c3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_40.6", 0x20000, 0x2ce0f24e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_38.3", 0x20000, 0xbc68cd99, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b31_33.87", 0x10000, 0x6ce9af44, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_36.97", 0x10000, 0xba20b0d4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_32.86", 0x10000, 0xe6025fec, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_35.96", 0x10000, 0x70d9a89f, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_31.85", 0x10000, 0x837f47e2, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_34.95", 0x10000, 0xd6b5fb2a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b31_37.11", 0x20000, 0x0ca5799d, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b31-01.23", 0x80000, 0x8e8237a7, BRF_GRA | TAITO_CHARS }, + { "b31-02.24", 0x80000, 0x4c3b4e33, BRF_GRA | TAITO_CHARS }, + + { "b31-07.176", 0x80000, 0x33568cdb, BRF_GRA | TAITO_SPRITESA }, + { "b31-06.175", 0x80000, 0x0d59439e, BRF_GRA | TAITO_SPRITESA }, + { "b31-05.174", 0x80000, 0x0a1fc9fb, BRF_GRA | TAITO_SPRITESA }, + { "b31-04.173", 0x80000, 0x2e1e4cb5, BRF_GRA | TAITO_SPRITESA }, + + { "b31-09.18", 0x80000, 0x60a73382, BRF_SND | TAITO_YM2610A }, + { "b31-10.17", 0x80000, 0xc6434aef, BRF_SND | TAITO_YM2610A }, + { "b31-11.16", 0x80000, 0x8da531d4, BRF_SND | TAITO_YM2610A }, + + { "b31-08.19", 0x80000, 0xa0a1f87d, BRF_SND | TAITO_YM2610B }, + + { "b31-25.38", 0x00200, 0xa0b4ba48, BRF_OPT }, + { "b31-26.58", 0x00200, 0x13e5fe15, BRF_OPT }, +}; + +STD_ROM_PICK(Ninjaw) +STD_ROM_FN(Ninjaw) + +static struct BurnRomInfo NinjawjRomDesc[] = { + { "b31_30.35", 0x10000, 0x056edd9f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_28.32", 0x10000, 0xcfa7661c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_29.34", 0x10000, 0xf2941a37, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_27.31", 0x10000, 0x2f3ff642, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_41.5", 0x20000, 0x0daef28a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_39.2", 0x20000, 0xe9197c3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_40.6", 0x20000, 0x2ce0f24e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_38.3", 0x20000, 0xbc68cd99, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b31_33.87", 0x10000, 0x6ce9af44, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_36.97", 0x10000, 0xba20b0d4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_32.86", 0x10000, 0xe6025fec, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_35.96", 0x10000, 0x70d9a89f, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_31.85", 0x10000, 0x837f47e2, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_34.95", 0x10000, 0xd6b5fb2a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b31_37.11", 0x20000, 0x0ca5799d, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b31-01.23", 0x80000, 0x8e8237a7, BRF_GRA | TAITO_CHARS }, + { "b31-02.24", 0x80000, 0x4c3b4e33, BRF_GRA | TAITO_CHARS }, + + { "b31-07.176", 0x80000, 0x33568cdb, BRF_GRA | TAITO_SPRITESA }, + { "b31-06.175", 0x80000, 0x0d59439e, BRF_GRA | TAITO_SPRITESA }, + { "b31-05.174", 0x80000, 0x0a1fc9fb, BRF_GRA | TAITO_SPRITESA }, + { "b31-04.173", 0x80000, 0x2e1e4cb5, BRF_GRA | TAITO_SPRITESA }, + + { "b31-09.18", 0x80000, 0x60a73382, BRF_SND | TAITO_YM2610A }, + { "b31-10.17", 0x80000, 0xc6434aef, BRF_SND | TAITO_YM2610A }, + { "b31-11.16", 0x80000, 0x8da531d4, BRF_SND | TAITO_YM2610A }, + + { "b31-08.19", 0x80000, 0xa0a1f87d, BRF_SND | TAITO_YM2610B }, + + { "b31-25.38", 0x00200, 0xa0b4ba48, BRF_OPT }, + { "b31-26.58", 0x00200, 0x13e5fe15, BRF_OPT }, +}; + +STD_ROM_PICK(Ninjawj) +STD_ROM_FN(Ninjawj) + +static struct BurnRomInfo NinjawuRomDesc[] = { + { "b31_49.35", 0x10000, 0xd38b6391, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_48.32", 0x10000, 0x4b5bb3d8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_29.34", 0x10000, 0xf2941a37, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_27.31", 0x10000, 0x2f3ff642, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_41.5", 0x20000, 0x0daef28a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_39.2", 0x20000, 0xe9197c3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_40.6", 0x20000, 0x2ce0f24e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b31_38.3", 0x20000, 0xbc68cd99, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b31_33.87", 0x10000, 0x6ce9af44, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_36.97", 0x10000, 0xba20b0d4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_32.86", 0x10000, 0xe6025fec, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_35.96", 0x10000, 0x70d9a89f, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_31.85", 0x10000, 0x837f47e2, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b31_34.95", 0x10000, 0xd6b5fb2a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b31_37.11", 0x20000, 0x0ca5799d, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b31-01.23", 0x80000, 0x8e8237a7, BRF_GRA | TAITO_CHARS }, + { "b31-02.24", 0x80000, 0x4c3b4e33, BRF_GRA | TAITO_CHARS }, + + { "b31-07.176", 0x80000, 0x33568cdb, BRF_GRA | TAITO_SPRITESA }, + { "b31-06.175", 0x80000, 0x0d59439e, BRF_GRA | TAITO_SPRITESA }, + { "b31-05.174", 0x80000, 0x0a1fc9fb, BRF_GRA | TAITO_SPRITESA }, + { "b31-04.173", 0x80000, 0x2e1e4cb5, BRF_GRA | TAITO_SPRITESA }, + + { "b31-09.18", 0x80000, 0x60a73382, BRF_SND | TAITO_YM2610A }, + { "b31-10.17", 0x80000, 0xc6434aef, BRF_SND | TAITO_YM2610A }, + { "b31-11.16", 0x80000, 0x8da531d4, BRF_SND | TAITO_YM2610A }, + + { "b31-08.19", 0x80000, 0xa0a1f87d, BRF_SND | TAITO_YM2610B }, + + { "b31-25.38", 0x00200, 0xa0b4ba48, BRF_OPT }, + { "b31-26.58", 0x00200, 0x13e5fe15, BRF_OPT }, +}; + +STD_ROM_PICK(Ninjawu) +STD_ROM_FN(Ninjawu) + +static struct BurnRomInfo WarriorbRomDesc[] = { + { "d24_20-1.74", 0x040000, 0x4452dc25, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d24_19-1.73", 0x040000, 0x15c16016, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d24_21-1.76", 0x040000, 0x783ef8e1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d24_18-1.71", 0x040000, 0x4502db60, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d24-09.75", 0x100000, 0xece5cc59, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "d24_17.69", 0x020000, 0xe41e4aae, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d24-02.12", 0x100000, 0x9f50c271, BRF_GRA | TAITO_CHARS }, + { "d24-01.11", 0x100000, 0x326dcca9, BRF_GRA | TAITO_CHARS }, + + { "d24-07.47", 0x100000, 0x9f50c271, BRF_GRA | TAITO_CHARSB }, + { "d24-08.48", 0x100000, 0x1e6d1528, BRF_GRA | TAITO_CHARSB }, + + { "d24-06.27", 0x100000, 0x918486fe, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "d24-03.24", 0x100000, 0x46db9fd7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "d24-04.25", 0x100000, 0x148e0493, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "d24-05.26", 0x100000, 0x9f414317, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "d24-12.107", 0x100000, 0x279203a1, BRF_SND | TAITO_YM2610A }, + { "d24-10.95", 0x100000, 0x0e0c716d, BRF_SND | TAITO_YM2610A }, + { "d24-11.118", 0x100000, 0x15362573, BRF_SND | TAITO_YM2610A }, + + { "d24-13.37", 0x000400, 0x3ca18eb3, BRF_OPT }, + { "d24-14.38", 0x000400, 0xbaf2a193, BRF_OPT }, +}; + +STD_ROM_PICK(Warriorb) +STD_ROM_FN(Warriorb) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += Taito68KRom1Size; + Taito68KRom2 = Next; Next += Taito68KRom2Size; + TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; + TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; + TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x010000; + Taito68KRam2 = Next; Next += 0x010000; + TaitoZ80Ram1 = Next; Next += 0x002000; + TaitoSharedRam = Next; Next += 0x010000; + TaitoSpriteRam = Next; Next += 0x004000; + + TaitoRamEnd = Next; + + TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; + TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; + + TaitoMemEnd = Next; + + return 0; +} + +static INT32 Darius2dMemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += Taito68KRom1Size; + TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; + TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; + TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x010000; + TaitoZ80Ram1 = Next; Next += 0x002000; + TaitoSpriteRam = Next; Next += 0x001400; + + TaitoRamEnd = Next; + + TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; + TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; + + TaitoMemEnd = Next; + + return 0; +} + +static INT32 WarriorbMemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += Taito68KRom1Size; + TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; + TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; + TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x014000; + TaitoZ80Ram1 = Next; Next += 0x002000; + TaitoSpriteRam = Next; Next += 0x001400; + + TaitoRamEnd = Next; + + TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; + TaitoCharsB = Next; Next += TaitoNumCharB * TaitoCharBWidth * TaitoCharBHeight; + TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; + + TaitoMemEnd = Next; + + return 0; +} + +static void Darius2CpuAReset(UINT16 d) +{ + TaitoCpuACtrl = d; + if (!(TaitoCpuACtrl & 1)) { + SekClose(); + SekOpen(1); + SekReset(); + SekClose(); + SekOpen(0); + } +} + +UINT8 __fastcall Darius268K1ReadByte(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius268K1WriteByte(UINT32 a, UINT8 d) +{ + TC0100SCNTripleScreenByteWrite_Map(0x280000, 0x293fff) + TC0100SCN1ByteWrite_Map(0x2c0000, 0x2d3fff) + TC0100SCN2ByteWrite_Map(0x300000, 0x313fff) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Darius268K1ReadWord(UINT32 a) +{ + switch (a) { + case 0x200000: { + return TC0220IOCPortRegRead(); + } + + case 0x200002: { + return TC0220IOCHalfWordPortRead(); + } + + case 0x220002: { + return TC0140SYTCommRead(); + } + + case 0x340002: { + return TC0110PCRWordRead(0); + } + + case 0x350002: { + return TC0110PCRWordRead(1); + } + + case 0x360002: { + return TC0110PCRWordRead(2); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius268K1WriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0CtrlWordWrite_Map(0x2a0000) + TC0100SCN1CtrlWordWrite_Map(0x2e0000) + TC0100SCN2CtrlWordWrite_Map(0x320000) + TC0100SCNTripleScreenWordWrite_Map(0x280000, 0x293fff) + TC0100SCN1WordWrite_Map(0x2c0000, 0x2d3fff) + TC0100SCN2WordWrite_Map(0x300000, 0x313fff) + + switch (a) { + case 0x200000: { + TC0220IOCHalfWordPortRegWrite(d); + return; + } + + case 0x200002: { + TC0220IOCHalfWordPortWrite(d); + return; + } + + case 0x210000: { + Darius2CpuAReset(d); + return; + } + + case 0x220000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x220002: { + TC0140SYTCommWrite(d); + return; + } + + case 0x340000: + case 0x340002: { + TC0110PCRStep1WordWrite(0, (a - 0x340000) >> 1, d); + return; + } + + case 0x350000: + case 0x350002: { + TC0110PCRStep1WordWrite(1, (a - 0x350000) >> 1, d); + return; + } + + case 0x360000: + case 0x360002: { + TC0110PCRStep1WordWrite(2, (a - 0x360000) >> 1, d); + return; + } + + case 0x340004: + case 0x350004: + case 0x360004: { + //nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Darius268K2ReadByte(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius268K2WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Darius268K2ReadWord(UINT32 a) +{ + switch (a) { + case 0x200000: { + return TC0220IOCPortRegRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius268K2WriteWord(UINT32 a, UINT16 d) +{ + TC0100SCNTripleScreenWordWrite_Map(0x280000, 0x293fff) + + switch (a) { + case 0x210000: { + //??? + return; + } + + case 0x340000: + case 0x340002: { + TC0110PCRStep1WordWrite(0, (a - 0x340000) >> 1, d); + return; + } + + case 0x350000: + case 0x350002: { + TC0110PCRStep1WordWrite(1, (a - 0x350000) >> 1, d); + return; + } + + case 0x360000: + case 0x360002: { + TC0110PCRStep1WordWrite(2, (a - 0x360000) >> 1, d); + return; + } + + case 0x340004: + case 0x350004: + case 0x360004: { + //nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Darius2d68KReadByte(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius2d68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCNDualScreenByteWrite_Map(0x200000, 0x213fff) + TC0100SCN1ByteWrite_Map(0x240000, 0x25ffff) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Darius2d68KReadWord(UINT32 a) +{ + switch (a) { + case 0x400002: { + return TC0110PCRWordRead(0); + } + + case 0x420002: { + return TC0110PCRWordRead(1); + } + + case 0x800000: + case 0x800002: + case 0x800004: + case 0x800006: + case 0x800008: + case 0x80000a: + case 0x80000c: + case 0x80000e: { + return TC0220IOCRead((a - 0x800000) >> 1); + } + + case 0x830002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius2d68KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCNDualScreenWordWrite_Map(0x200000, 0x213fff) + + if (a >= 0x214000 && a <= 0x2141ff) return; + + TC0100SCN0CtrlWordWrite_Map(0x220000) + TC0100SCN1CtrlWordWrite_Map(0x260000) + TC0100SCN1WordWrite_Map(0x240000, 0x25ffff) + + switch (a) { + case 0x400000: + case 0x400002: + case 0x400004: { + TC0110PCRStep1WordWrite(0, (a - 0x400000) >> 1, d); + return; + } + + case 0x420000: + case 0x420002: + case 0x420004: { + TC0110PCRStep1WordWrite(1, (a - 0x420000) >> 1, d); + return; + } + + case 0x800000: + case 0x800002: + case 0x800004: + case 0x800006: + case 0x800008: + case 0x80000a: + case 0x80000c: + case 0x80000e: { + TC0220IOCWrite((a - 0x800000) >> 1, d); + return; + } + + case 0x820000: { + // nop + return; + } + + case 0x830000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x830002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Warriorb68KReadByte(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Warriorb68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCNDualScreenByteWrite_Map(0x300000, 0x313fff) + TC0100SCN1ByteWrite_Map(0x340000, 0x35ffff) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Warriorb68KReadWord(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0x800000) + + switch (a) { + case 0x400002: { + return TC0110PCRWordRead(0); + } + + case 0x420002: { + return TC0110PCRWordRead(1); + } + + case 0x830002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Warriorb68KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCNDualScreenWordWrite_Map(0x300000, 0x313fff) + TC0100SCN1WordWrite_Map(0x340000, 0x35ffff) + + TC0100SCN0CtrlWordWrite_Map(0x320000) + TC0100SCN1CtrlWordWrite_Map(0x360000) + + TC0510NIOHalfWordWrite_Map(0x800000) + + switch (a) { + case 0x400000: + case 0x400002: + case 0x400004: { + TC0110PCRStep1WordWrite(0, (a - 0x400000) >> 1, d); + return; + } + + case 0x420000: + case 0x420002: + case 0x420004: { + TC0110PCRStep1WordWrite(1, (a - 0x420000) >> 1, d); + return; + } + + case 0x820000: { + // nop + return; + } + + case 0x830000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x830002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Darius2Z80Read(UINT16 a) +{ + switch (a) { + case 0xe000: { + return BurnYM2610Read(0); + } + + case 0xe002: { + return BurnYM2610Read(2); + } + + case 0xe201: { + return TC0140SYTSlaveCommRead(); + } + + case 0xea00: { + // NOP + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read %04X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius2Z80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe000: { + BurnYM2610Write(0, d); + return; + } + + case 0xe001: { + BurnYM2610Write(1, d); + return; + } + + case 0xe002: { + BurnYM2610Write(2, d); + return; + } + + case 0xe003: { + BurnYM2610Write(3, d); + return; + } + + case 0xe200: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xe201: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xe400: { + BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_1, Darius2YM2610Route1MasterVol * d / 255.0); + return; + } + + case 0xe401: { + BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_1, Darius2YM2610Route1MasterVol * d / 255.0); + return; + } + + case 0xe402: { + BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_2, Darius2YM2610Route1MasterVol * d / 255.0); + return; + } + + case 0xe403: { + BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_2, Darius2YM2610Route1MasterVol * d / 255.0); + return; + } + + case 0xe600: { + //??? + return; + } + + case 0xee00: { + //nop + return; + } + + case 0xf000: { + //nop + return; + } + + case 0xf200: { + TaitoZ80Bank = (d - 1) & 7; + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write %04X, %02X\n"), a, d); + } + } +} + +static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 CharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; +static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 SpritePlaneOffsets[4] = { 8, 12, 0, 4 }; +static INT32 SpriteXOffsets[16] = { 3, 2, 1, 0, 19, 18, 17, 16, 259, 258, 257, 256, 275, 274, 273, 272 }; +static INT32 SpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; +static INT32 Darius2dSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 Darius2dSpriteXOffsets[16] = { 12, 8, 44, 40, 4, 0, 36, 32, 28, 24, 60, 56, 20, 16, 52, 48 }; +static INT32 Darius2dSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; + +static void Darius2FMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 Darius2SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / (16000000 / 4); +} + +static double Darius2GetTime() +{ + return (double)ZetTotalCycles() / (16000000 / 4); +} + +static INT32 Darius2Init() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x8000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x2000; + + if (Ninjaw) TaitoNumSpriteA = 0x4000; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 22, 16, 0, NULL); + TC0100SCNSetClipArea(0, 288, nScreenHeight, 0); + TC0100SCNInit(1, TaitoNumChar, 24, 16, 0, NULL); + TC0100SCNSetClipArea(1, 288, nScreenHeight, 288); + TC0100SCNSetPaletteOffset(1, 0x1000); + TC0100SCNInit(2, TaitoNumChar, 26, 16, 0, NULL); + TC0100SCNSetClipArea(2, 288, nScreenHeight, 576); + TC0100SCNSetPaletteOffset(2, 0x2000); + TC0110PCRInit(3, 0x3000); + TC0140SYTInit(); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x0c0000, 0x0cffff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x240000, 0x24ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x260000, 0x263fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x280000, 0x293fff, SM_READ); + SekMapMemory(TC0100SCNRam[1] , 0x2c0000, 0x2d3fff, SM_READ); + SekMapMemory(TC0100SCNRam[2] , 0x300000, 0x313fff, SM_READ); + SekSetReadByteHandler(0, Darius268K1ReadByte); + SekSetWriteByteHandler(0, Darius268K1WriteByte); + SekSetReadWordHandler(0, Darius268K1ReadWord); + SekSetWriteWordHandler(0, Darius268K1WriteWord); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x080000, 0x08ffff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x240000, 0x24ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x260000, 0x263fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x280000, 0x293fff, SM_READ); + SekSetReadByteHandler(0, Darius268K2ReadByte); + SekSetWriteByteHandler(0, Darius268K2WriteByte); + SekSetReadWordHandler(0, Darius268K2ReadWord); + SekSetWriteWordHandler(0, Darius268K2WriteWord); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Darius2Z80Read); + ZetSetWriteHandler(Darius2Z80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &Darius2FMIRQHandler, Darius2SynchroniseStream, Darius2GetTime, 0); + BurnTimerAttachZet(16000000 / 4); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + Darius2YM2610Route1MasterVol = 1.00; + Darius2YM2610Route2MasterVol = 1.00; + bYM2610UseSeperateVolumes = 1; + + TaitoDrawFunction = Darius2Draw; + TaitoMakeInputsFunction = Darius2MakeInputs; + TaitoIrqLine = 4; + + nTaitoCyclesTotal[0] = (16000000 / 2) / 60; + nTaitoCyclesTotal[1] = (16000000 / 2) / 60; + nTaitoCyclesTotal[2] = (16000000 / 4) / 60; + + TaitoResetFunction = TaitoDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 Darius2dInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x8000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = Darius2dSpritePlaneOffsets; + TaitoSpriteAXOffsets = Darius2dSpriteXOffsets; + TaitoSpriteAYOffsets = Darius2dSpriteYOffsets; + TaitoNumSpriteA = 0x4000; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + Darius2dMemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + Darius2dMemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 4, 24, 0, NULL); + TC0100SCNSetClipArea(0, 320, nScreenHeight, 0); + TC0100SCNInit(1, TaitoNumChar, 4, 24, 0, NULL); + TC0100SCNSetClipArea(1, 320, nScreenHeight, 320); + TC0100SCNSetPaletteOffset(1, 0x1000); + TC0110PCRInit(2, 0x2000); + TC0140SYTInit(); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x200000, 0x213fff, SM_READ); + SekMapMemory(TC0100SCNRam[1] , 0x240000, 0x253fff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x600000, 0x6013ff, SM_RAM); + SekSetReadByteHandler(0, Darius2d68KReadByte); + SekSetWriteByteHandler(0, Darius2d68KWriteByte); + SekSetReadWordHandler(0, Darius2d68KReadWord); + SekSetWriteWordHandler(0, Darius2d68KWriteWord); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Darius2Z80Read); + ZetSetWriteHandler(Darius2Z80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &Darius2FMIRQHandler, Darius2SynchroniseStream, Darius2GetTime, 0); + BurnTimerAttachZet(16000000 / 4); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + Darius2YM2610Route1MasterVol = 12.00; + Darius2YM2610Route2MasterVol = 12.00; + bYM2610UseSeperateVolumes = 1; + + TaitoDrawFunction = Darius2dDraw; + TaitoMakeInputsFunction = Darius2dMakeInputs; + TaitoIrqLine = 4; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = (16000000 / 4) / 60; + + TaitoResetFunction = TaitoDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 NinjawInit() +{ + Ninjaw = 1; + return Darius2Init(); +} + +static INT32 WarriorbInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x10000; + + TaitoCharBModulo = 0x100; + TaitoCharBNumPlanes = 4; + TaitoCharBWidth = 8; + TaitoCharBHeight = 8; + TaitoCharBPlaneOffsets = CharPlaneOffsets; + TaitoCharBXOffsets = CharXOffsets; + TaitoCharBYOffsets = CharYOffsets; + TaitoNumCharB = 0x10000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = Darius2dSpritePlaneOffsets; + TaitoSpriteAXOffsets = Darius2dSpriteXOffsets; + TaitoSpriteAYOffsets = Darius2dSpriteYOffsets; + TaitoNumSpriteA = 0x8000; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + WarriorbMemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + WarriorbMemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 4, 8, 0, NULL); + TC0100SCNSetClipArea(0, 320, nScreenHeight, 0); + TC0100SCNInit(1, TaitoNumCharB, 5, 8, 0, NULL); + TC0100SCNSetClipArea(1, 320, nScreenHeight, 320); + TC0100SCNSetPaletteOffset(1, 0x1000); + TC0110PCRInit(2, 0x2000); + TC0140SYTInit(); + TC0510NIOInit(); + + if (TaitoLoadRoms(1)) return 1; + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x1fffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x200000, 0x213fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x300000, 0x313fff, SM_READ); + SekMapMemory(TC0100SCNRam[1] , 0x340000, 0x353fff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x600000, 0x6013ff, SM_RAM); + SekSetReadByteHandler(0, Warriorb68KReadByte); + SekSetWriteByteHandler(0, Warriorb68KWriteByte); + SekSetReadWordHandler(0, Warriorb68KReadWord); + SekSetWriteWordHandler(0, Warriorb68KWriteWord); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(Darius2Z80Read); + ZetSetWriteHandler(Darius2Z80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &Darius2FMIRQHandler, Darius2SynchroniseStream, Darius2GetTime, 0); + BurnTimerAttachZet(16000000 / 4); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + Darius2YM2610Route1MasterVol = 12.00; + Darius2YM2610Route2MasterVol = 12.00; + bYM2610UseSeperateVolumes = 1; + + TaitoDrawFunction = WarriorbDraw; + TaitoMakeInputsFunction = WarriorbMakeInputs; + TaitoIrqLine = 4; + + nTaitoCyclesTotal[0] = 16000000 / 60; + nTaitoCyclesTotal[1] = (16000000 / 4) / 60; + + TaitoResetFunction = TaitoDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 Darius2Exit() +{ + Ninjaw = 0; + + return TaitoExit(); +} + +static void Darius2RenderSprites(INT32 PriorityDraw) +{ + INT32 Offset, Data, Code, Colour, xFlip, yFlip; + INT32 x, y, Priority; + + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + + for (Offset = 0x2000 - 4; Offset >=0; Offset -= 4) { + Data = SpriteRam[Offset + 2]; + Code = Data & (TaitoNumSpriteA - 1); + + if (!Code) continue; + + Data = SpriteRam[Offset + 0]; + x = (Data - 32) & 0x3ff; + + Data = SpriteRam[Offset + 1]; + y = (Data - 0) & 0x1ff; + + Data = SpriteRam[Offset + 3]; + xFlip = (Data & 0x1); + yFlip = (Data & 0x2) >> 1; + Priority = (Data & 0x4) >> 2; + + if (Priority != PriorityDraw) continue; + + Colour = (Data & 0x7f00) >> 8; + + y -= 16; + + if (x > 0x3c0) x -= 0x400; + if (y > 0x180) y -= 0x200; + + if (x > 16 && x < (nScreenWidth - 16) && y > 16 && y < (nScreenHeight - 16)) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } + } + } +} + +static void Darius2dRenderSprites(INT32 PriorityDraw) +{ + INT32 Offset, Data, Code, Colour, xFlip, yFlip; + INT32 x, y, Priority; + + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + +// for (Offset = 0; Offset < 0x001400 / 2; Offset += 4) { + for (Offset = (0x1400 / 2) - 4; Offset >= 0; Offset -= 4) { + Data = SpriteRam[Offset + 1]; + Code = Data & (TaitoNumSpriteA - 1); + + Data = SpriteRam[Offset + 0]; + y = (-(Data & 0x1ff) - 24) & 0x1ff; + yFlip = (Data & 0x200) >> 9; + + Data = SpriteRam[Offset + 2]; + Priority = (Data & 0x100) >> 8; + Colour = Data & 0x7f; + + Data = SpriteRam[Offset + 3]; + x = Data & 0x3ff; + xFlip = (Data & 0x400) >> 10; + + if (Priority != PriorityDraw) continue; + + y -= 16; + + if (x > 0x3c0) x -= 0x400; + if (y > 0x180) y -= 0x200; + + if (x > 16 && x < (nScreenWidth - 16) && y > 16 && y < (nScreenHeight - 16)) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } + } + } +} + +static void Darius2Draw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + INT32 Disable2 = TC0100SCNCtrl[1][6] & 0xf7; + INT32 Disable3 = TC0100SCNCtrl[2][6] & 0xf7; + + BurnTransferClear(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); + if (!(Disable3 & 0x02)) TC0100SCNRenderFgLayer(2, 0, TaitoChars); + Darius2RenderSprites(1); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoChars); + if (!(Disable3 & 0x01)) TC0100SCNRenderBgLayer(2, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoChars); + if (!(Disable3 & 0x01)) TC0100SCNRenderBgLayer(2, 0, TaitoChars); + Darius2RenderSprites(1); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); + if (!(Disable3 & 0x02)) TC0100SCNRenderFgLayer(2, 0, TaitoChars); + } + + Darius2RenderSprites(0); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); + if (!(Disable3 & 0x04)) TC0100SCNRenderCharLayer(2); + BurnTransferCopy(TC0110PCRPalette); +} + +static void Darius2dDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + INT32 Disable2 = TC0100SCNCtrl[1][6] & 0xf7; + + BurnTransferClear(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); + Darius2dRenderSprites(1); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoChars); + Darius2dRenderSprites(1); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); + } + + Darius2dRenderSprites(0); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); + BurnTransferCopy(TC0110PCRPalette); +} + +static void WarriorbDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + INT32 Disable2 = TC0100SCNCtrl[1][6] & 0xf7; + + BurnTransferClear(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoCharsB); + Darius2dRenderSprites(1); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoCharsB); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoCharsB); + Darius2dRenderSprites(1); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoCharsB); + } + + Darius2dRenderSprites(0); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); + BurnTransferCopy(TC0110PCRPalette); +} + +static INT32 Darius2Frame() +{ + INT32 nInterleave = 100; + + if (TaitoReset) TaitoResetFunction(); + + TaitoMakeInputsFunction(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 # 1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run 68000 # 2 + if ((TaitoCpuACtrl & 0x01)) { + nCurrentCPU = 1; + SekOpen(1); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + } + + ZetOpen(0); + BurnTimerUpdate(i * (nTaitoCyclesTotal[2] / nInterleave)); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrame(nTaitoCyclesTotal[2]); + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) TaitoDrawFunction(); + + return 0; +} + +static INT32 Darius2dFrame() +{ + INT32 nInterleave = 100; + + if (TaitoReset) TaitoResetFunction(); + + TaitoMakeInputsFunction(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[2] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 # 1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + + ZetOpen(0); + BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrame(nTaitoCyclesTotal[1]); + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) TaitoDrawFunction(); + + return 0; +} + +static INT32 Darius2Scan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029684; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = TaitoRamStart; + ba.nLen = TaitoRamEnd-TaitoRamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + TaitoICScan(nAction); + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + if (TaitoNumYM2610) BurnYM2610Scan(nAction, pnMin); + + SCAN_VAR(TaitoInput); + SCAN_VAR(TaitoZ80Bank); + SCAN_VAR(nTaitoCyclesDone); + SCAN_VAR(nTaitoCyclesSegment); + } + + if (nAction & ACB_WRITE && TaitoZ80Bank) { + ZetOpen(0); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetClose(); + } + + return 0; +} + +struct BurnDriver BurnDrvDarius2 = { + "darius2", NULL, NULL, NULL, "1989", + "Darius II (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, + NULL, Darius2RomInfo, Darius2RomName, NULL, NULL, Darius2InputInfo, Darius2DIPInfo, + Darius2Init, Darius2Exit, Darius2Frame, NULL, Darius2Scan, + NULL, 0x3000, 864, 224, 12, 3 +}; + +struct BurnDriver BurnDrvDarius2d = { + "darius2d", "darius2", NULL, NULL, "1989", + "Darius II (dual screen) (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, + NULL, Darius2dRomInfo, Darius2dRomName, NULL, NULL, Darius2dInputInfo, Darius2dDIPInfo, + Darius2dInit, Darius2Exit, Darius2dFrame, NULL, Darius2Scan, + NULL, 0x2000, 640, 224, 8, 3 +}; + +struct BurnDriver BurnDrvDarius2do = { + "darius2do", "darius2", NULL, NULL, "1989", + "Darius II (dual screen) (Japan old version)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, + NULL, Darius2doRomInfo, Darius2doRomName, NULL, NULL, Darius2dInputInfo, Darius2dDIPInfo, + Darius2dInit, Darius2Exit, Darius2dFrame, NULL, Darius2Scan, + NULL, 0x2000, 640, 224, 8, 3 +}; + +struct BurnDriver BurnDrvNinjaw = { + "ninjaw", NULL, NULL, NULL, "1987", + "The Ninja Warriors (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, NinjawRomInfo, NinjawRomName, NULL, NULL, Darius2InputInfo, NinjawDIPInfo, + NinjawInit, Darius2Exit, Darius2Frame, NULL, Darius2Scan, + NULL, 0x3000, 864, 224, 12, 3 +}; + +struct BurnDriver BurnDrvNinjawj = { + "ninjawj", "ninjaw", NULL, NULL, "1987", + "The Ninja Warriors (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, NinjawjRomInfo, NinjawjRomName, NULL, NULL, Darius2InputInfo, NinjawjDIPInfo, + NinjawInit, Darius2Exit, Darius2Frame, NULL, Darius2Scan, + NULL, 0x3000, 864, 224, 12, 3 +}; + +struct BurnDriver BurnDrvNinjawu = { + "ninjawu", "ninjaw", NULL, NULL, "1987", + "The Ninja Warriors (US)\0", NULL, "Taito Corporation America (licensed to Romstar)", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, NinjawuRomInfo, NinjawuRomName, NULL, NULL, Darius2InputInfo, NinjawjDIPInfo, + NinjawInit, Darius2Exit, Darius2Frame, NULL, Darius2Scan, + NULL, 0x3000, 864, 224, 12, 3 +}; + +struct BurnDriver BurnDrvWarriorb = { + "warriorb", NULL, NULL, NULL, "1991", + "Warrior Blade - Rastan Saga Episode III (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, + NULL, WarriorbRomInfo, WarriorbRomName, NULL, NULL, WarriorbInputInfo, WarriorbDIPInfo, + WarriorbInit, Darius2Exit, Darius2dFrame, NULL, Darius2Scan, + NULL, 0x2000, 640, 240, 8, 3 +}; diff --git a/src/burn/drv/taito/d_flstory.cpp b/src/burn/drv/taito/d_flstory.cpp index a1ef02061..fcb68fe8b 100644 --- a/src/burn/drv/taito/d_flstory.cpp +++ b/src/burn/drv/taito/d_flstory.cpp @@ -1,1413 +1,1411 @@ -#include "tiles_generic.h" -#include "taito_m68705.h" -#include "z80_intf.h" -#include "driver.h" -#include "dac.h" -extern "C" { -#include "ay8910.h" -} - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvMcuROM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvVidRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvMcuRAM; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static INT16 *pAY8910Buffer[3]; - -static UINT8 snd_data; -static UINT8 snd_flag; -static INT32 nmi_enable; -static INT32 pending_nmi; -static INT32 char_bank = 0; -static INT32 mcu_select; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvJoy4[8]; -static UINT8 DrvJoy5[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[5]; -static UINT8 DrvReset; - -static UINT8 *flipscreen; -static UINT8 *soundlatch; - -static INT32 select_game; - -static struct BurnInputInfo FlstoryInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 3, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Flstory) - -static struct BurnDIPInfo FlstoryDIPList[]= -{ - {0x0f, 0xff, 0xff, 0xec, NULL }, - {0x10, 0xff, 0xff, 0x00, NULL }, - {0x11, 0xff, 0xff, 0xf8, NULL }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x0f, 0x01, 0x03, 0x00, "30000 100000" }, - {0x0f, 0x01, 0x03, 0x01, "30000 150000" }, - {0x0f, 0x01, 0x03, 0x02, "50000 150000" }, - {0x0f, 0x01, 0x03, 0x03, "70000 150000" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x0f, 0x01, 0x04, 0x04, "Off" }, - {0x0f, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x0f, 0x01, 0x18, 0x08, "3" }, - {0x0f, 0x01, 0x18, 0x10, "4" }, - {0x0f, 0x01, 0x18, 0x18, "5" }, - {0x0f, 0x01, 0x18, 0x00, "Infinite (Cheat)" }, - - {0 , 0xfe, 0 , 2, "Debug Mode" }, - {0x0f, 0x01, 0x20, 0x20, "Off" }, - {0x0f, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x0f, 0x01, 0x40, 0x40, "Off" }, - {0x0f, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x0f, 0x01, 0x80, 0x80, "Upright" }, - {0x0f, 0x01, 0x80, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x10, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x10, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, - {0x10, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, - {0x10, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, - {0x10, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x10, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, - {0x10, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x10, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, - {0x10, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x10, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, - {0x10, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, - {0x10, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, - {0x10, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, - {0x10, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x10, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, - {0x10, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x10, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, - {0x10, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x11, 0x01, 0x08, 0x00, "No" }, - {0x11, 0x01, 0x08, 0x08, "Yes" }, - - {0 , 0xfe, 0 , 2, "Attract Animation" }, - {0x11, 0x01, 0x10, 0x00, "Off" }, - {0x11, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2, "Leave Off" }, - {0x11, 0x01, 0x20, 0x20, "Off" }, - {0x11, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)" }, - {0x11, 0x01, 0x40, 0x40, "Off" }, - {0x11, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Slots" }, - {0x11, 0x01, 0x80, 0x00, "1" }, - {0x11, 0x01, 0x80, 0x80, "2" }, -}; - -STDDIPINFO(Flstory) - -static struct BurnInputInfo Onna34roInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 5, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 4, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 5, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 4, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 3, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Onna34ro) - -static struct BurnDIPInfo Onna34roDIPList[]= -{ - {0x13, 0xff, 0xff, 0xe0, NULL }, - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0x80, NULL }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x13, 0x01, 0x03, 0x00, "200000 200000" }, - {0x13, 0x01, 0x03, 0x01, "200000 300000" }, - {0x13, 0x01, 0x03, 0x02, "100000 200000" }, - {0x13, 0x01, 0x03, 0x03, "200000 100000" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x13, 0x01, 0x04, 0x00, "Off" }, - {0x13, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x18, 0x10, "1" }, - {0x13, 0x01, 0x18, 0x08, "2" }, - {0x13, 0x01, 0x18, 0x00, "3" }, - {0x13, 0x01, 0x18, 0x18, "Endless (Cheat)" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x80, 0x80, "Upright" }, - {0x13, 0x01, 0x80, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x14, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x14, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, - {0x14, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x14, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, - {0x14, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, - {0x14, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x14, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, - {0x14, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)"}, - {0x15, 0x01, 0x01, 0x00, "Off" }, - {0x15, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2, "Rack Test" }, - {0x15, 0x01, 0x02, 0x00, "Off" }, - {0x15, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Freeze" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Coinage Display" }, - {0x15, 0x01, 0x10, 0x10, "Off" }, - {0x15, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x60, 0x20, "Easy" }, - {0x15, 0x01, 0x60, 0x00, "Normal" }, - {0x15, 0x01, 0x60, 0x40, "Difficult" }, - {0x15, 0x01, 0x60, 0x60, "Very Difficult" }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x15, 0x01, 0x80, 0x80, "A and B" }, - {0x15, 0x01, 0x80, 0x00, "A only" }, -}; - -STDDIPINFO(Onna34ro) - -static struct BurnInputInfo VictnineInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 5, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 4, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy4 + 2, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, DrvJoy4 + 3, "p1 fire 4" }, - {"P1 Button 5", BIT_DIGITAL, DrvJoy4 + 4, "p1 fire 5" }, - {"P1 Button 6", BIT_DIGITAL, DrvJoy4 + 5, "p1 fire 6" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 5, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 4, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy5 + 2, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, DrvJoy5 + 3, "p2 fire 4" }, - {"P2 Button 5", BIT_DIGITAL, DrvJoy5 + 4, "p2 fire 5" }, - {"P2 Button 6", BIT_DIGITAL, DrvJoy5 + 5, "p2 fire 6" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 3, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Victnine) - -static struct BurnDIPInfo VictnineDIPList[]= -{ - {0x1b, 0xff, 0xff, 0x67, NULL }, - {0x1c, 0xff, 0xff, 0x00, NULL }, - {0x1d, 0xff, 0xff, 0x7f, NULL }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x1b, 0x01, 0x04, 0x04, "Off" }, - {0x1b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x1b, 0x01, 0x40, 0x40, "Off" }, - {0x1b, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 3, "Cabinet" }, - {0x1b, 0x01, 0xa0, 0x20, "Upright" }, - {0x1b, 0x01, 0xa0, 0xa0, "Cocktail" }, - {0x1b, 0x01, 0xa0, 0x00, "MA / MB" }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x1c, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, - {0x1c, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, - {0x1c, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, - {0x1c, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, - {0x1c, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, - {0x1c, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, - {0x1c, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, - {0x1c, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x1c, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, - {0x1c, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, - {0x1c, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, - {0x1c, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x1c, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, - {0x1c, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x1c, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, - {0x1c, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x1c, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, - {0x1c, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, - {0x1c, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, - {0x1c, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, - {0x1c, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x1c, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, - {0x1c, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, - {0x1c, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, - {0x1c, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, - {0x1c, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, - {0x1c, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, - {0x1c, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x1c, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, - {0x1c, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x1c, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, - {0x1c, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 2, "Coinage Display" }, - {0x1d, 0x01, 0x10, 0x00, "Off" }, - {0x1d, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 2, "Show Year" }, - {0x1d, 0x01, 0x20, 0x00, "Off" }, - {0x1d, 0x01, 0x20, 0x20, "On" }, - - {0 , 0xfe, 0 , 2, "No hit" }, - {0x1d, 0x01, 0x40, 0x40, "Off" }, - {0x1d, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x1d, 0x01, 0x80, 0x80, "A and B" }, - {0x1d, 0x01, 0x80, 0x00, "A only" }, -}; - -STDDIPINFO(Victnine) - -static void gfxctrl_write(INT32 data) -{ - char_bank = (data & 0x10) >> 4; - - INT32 bank = (data & 0x20) << 3; - - ZetMapArea(0xdd00, 0xddff, 0, DrvPalRAM + 0x000 + bank); - ZetMapArea(0xdd00, 0xddff, 1, DrvPalRAM + 0x000 + bank); - ZetMapArea(0xde00, 0xdeff, 0, DrvPalRAM + 0x200 + bank); - ZetMapArea(0xde00, 0xdeff, 1, DrvPalRAM + 0x200 + bank); - - if (data & 4) *flipscreen = (~data & 0x01); -} - -static void onna34ro_mcu_write(INT32 data) -{ - INT32 score_adr = (ZetReadByte(0xe29e) << 8) | ZetReadByte(0xe29d); - - mcu_sent = 1; - - switch (data) - { - case 0x0e: - from_mcu = 0xff; - break; - - case 0x01: - from_mcu = 0x6a; - break; - - case 0x40: - from_mcu = ZetReadByte(score_adr); - break; - - case 0x41: - from_mcu = ZetReadByte(score_adr+1); - break; - - case 0x42: - from_mcu = ZetReadByte(score_adr+2) & 0x0f; - break; - - default: - from_mcu = 0x80; - } -} - -static const UINT8 victnine_mcu_data[0x100] = -{ - 0x3e, 0x08, 0xdd, 0x29, 0xcb, 0x14, 0xfd, 0x29, - 0xcb, 0x15, 0xd9, 0x29, 0xd9, 0x30, 0x0d, 0xd9, - 0x19, 0xd9, 0xdd, 0x09, 0x30, 0x01, 0x24, 0xfd, - 0x19, 0x30, 0x01, 0x2c, 0x3d, 0x20, 0xe3, 0xc9, - 0x11, 0x14, 0x00, 0x19, 0x7e, 0x32, 0xed, 0xe4, - 0x2a, 0x52, 0xe5, 0x22, 0xe9, 0xe4, 0x2a, 0x54, - 0xe5, 0x22, 0xeb, 0xe4, 0x21, 0x2a, 0xe6, 0xfe, - 0x06, 0x38, 0x02, 0xcb, 0xc6, 0xcb, 0xce, 0xc9, - 0x06, 0x00, 0x3a, 0xaa, 0xe4, 0x07, 0x07, 0x07, - 0xb0, 0x47, 0x3a, 0xab, 0xe4, 0x07, 0x07, 0xb0, - 0x47, 0x3a, 0xac, 0xe4, 0xe6, 0x03, 0xb0, 0x21, - 0xe3, 0xe6, 0xc9, 0x38, 0xe1, 0x29, 0x07, 0xc9, - 0x23, 0x7e, 0x47, 0xe6, 0x1f, 0x32, 0x0c, 0xe6, - 0x78, 0xe6, 0xe0, 0x07, 0x07, 0x47, 0xe6, 0x03, - 0x28, 0x06, 0xcb, 0x7a, 0x28, 0x02, 0xc6, 0x02, - 0x32, 0x0a, 0xe6, 0x78, 0xe6, 0x80, 0xc9, 0x3a, - 0x21, 0x29, 0xe5, 0x7e, 0xe6, 0xf8, 0xf6, 0x01, - 0x77, 0x23, 0x3a, 0x0a, 0xe6, 0x77, 0x21, 0x08, - 0xe6, 0xcb, 0xc6, 0xcb, 0x8e, 0x3a, 0x2b, 0xe5, - 0x21, 0xff, 0xe5, 0xfe, 0x02, 0xc9, 0x1f, 0xc6, - 0x47, 0x3a, 0xaa, 0xe4, 0xa7, 0x21, 0x00, 0xe5, - 0x28, 0x03, 0x21, 0x1b, 0xe5, 0x70, 0x3a, 0xaa, - 0xe4, 0xee, 0x01, 0x32, 0xaa, 0xe4, 0x21, 0xb0, - 0xe4, 0x34, 0x23, 0x36, 0x00, 0xc9, 0x2b, 0xb2, - 0xaf, 0x77, 0x12, 0x23, 0x13, 0x3c, 0xfe, 0x09, - 0x20, 0xf7, 0x3e, 0x01, 0x32, 0xad, 0xe4, 0x21, - 0x48, 0xe5, 0xcb, 0xfe, 0xc9, 0x32, 0xe5, 0xaa, - 0x21, 0x00, 0x13, 0xe4, 0x47, 0x1b, 0xa1, 0xc9, - 0x00, 0x08, 0x04, 0x0c, 0x05, 0x0d, 0x06, 0x0e, - 0x22, 0x66, 0xaa, 0x22, 0x33, 0x01, 0x11, 0x88, - 0x06, 0x05, 0x03, 0x04, 0x08, 0x01, 0x03, 0x02, - 0x06, 0x07, 0x02, 0x03, 0x15, 0x17, 0x11, 0x13 -}; - -static void victnine_mcu_write(INT32 data) -{ - INT32 seed = ZetReadByte(0xe685); - - if (!seed && (data & 0x37) == 0x37) - { - from_mcu = 0xa6; - } - else - { - data += seed; - - if ((data & ~0x1f) == 0xa0) - { - mcu_select = data & 0x1f; - } - else if (data < 0x20) - { - INT32 offset = mcu_select * 8 + data; - from_mcu = victnine_mcu_data[offset]; - } - else if (data >= 0x38 && data <= 0x3a) - { - from_mcu = ZetReadByte(0xe691 - 0x38 + data); - } - } -} - -void __fastcall flstory_main_write(UINT16 address, UINT8 data) -{ - if ((address & 0xff00) == 0xdc00) { - DrvSprRAM[address & 0xff] = data; - - if (select_game == 2 && address == 0xdce0) { - gfxctrl_write((data ^ 1) & ~0x10); - } - - return; - } - - switch (address) - { - case 0xd000: - if (select_game == 2) { - victnine_mcu_write(data); - } if (select_game == 1) { - onna34ro_mcu_write(data); - } else { - standard_taito_mcu_write(data); - } - return; - - case 0xd400: - { - *soundlatch = data; - - if (nmi_enable) { - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - } else { - pending_nmi = 1; - } - } - return; - - case 0xdf03: - if (select_game != 2) gfxctrl_write(data | 0x04); - return; - } -} - -UINT8 __fastcall flstory_main_read(UINT16 address) -{ - switch (address) - { - case 0xd000: - if (select_game == 2) { - return from_mcu - ZetReadByte(0xe685); - } else { - return standard_taito_mcu_read(); - } - - case 0xd400: - snd_flag = 0; - return snd_data; - - case 0xd401: - return snd_flag | 0xfd; - - case 0xd800: - case 0xd801: - case 0xd802: - return DrvDips[address & 3]; - - case 0xd803: - return DrvInputs[0] & 0x3f; - - case 0xd804: - return DrvInputs[1]; - - case 0xd805: - { - INT32 res = 0; - if (!main_sent) res |= 0x01; - if (mcu_sent) res |= 0x02; - - if (select_game == 2) res |= DrvInputs[3]; - - return res; - } - - case 0xd806: - return DrvInputs[2]; - - case 0xd807: - return DrvInputs[4]; - } - - return 0; -} - -void __fastcall flstory_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xc800: - case 0xc801: - AY8910Write(0, address & 1, data); - return; - - case 0xca00: - case 0xca01: - case 0xca02: - case 0xca03: - case 0xca04: - case 0xca05: - case 0xca06: - case 0xca07: - case 0xca08: - case 0xca09: - case 0xca0a: - case 0xca0b: - case 0xca0c: - case 0xca0d: - // msm5232 - return; - - case 0xd800: - snd_data = data; - snd_flag = 2; - return; - - case 0xda00: - nmi_enable = 1; - if (pending_nmi) - { - ZetNmi(); - pending_nmi = 0; - } - return; - - case 0xdc00: - nmi_enable = 0; - return; - - case 0xde00: - DACSignedWrite(0, data); - return; - } -} - -UINT8 __fastcall flstory_sound_read(UINT16 address) -{ - if (address == 0xd800) { - return *soundlatch; - } - - return 0; -} - -static INT32 flstoryDACSync() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (4000000.000 / (nBurnFPS / 100.000)))); -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - m67805_taito_reset(); - - AY8910Reset(0); - DACReset(); - - snd_data = 0; - snd_flag = 0; - nmi_enable = 0; - pending_nmi = 0; - char_bank = 0; - mcu_select = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x010000; - DrvZ80ROM1 = Next; Next += 0x010000; - - DrvMcuROM = Next; Next += 0x000800; - - DrvGfxROM0 = Next; Next += 0x040000; - DrvGfxROM1 = Next; Next += 0x040000; - - DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); - - AllRam = Next; - - DrvVidRAM = Next; Next += 0x001000; - DrvZ80RAM0 = Next; Next += 0x000800; - DrvZ80RAM1 = Next; Next += 0x000800; - DrvPalRAM = Next; Next += 0x000400; - DrvSprRAM = Next; Next += 0x000100; - - DrvMcuRAM = Next; Next += 0x000080; - - soundlatch = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - - RamEnd = Next; - - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x80000, 0x80004, 0x00000, 0x00004 }; - INT32 XOffs[16] = { 3, 2, 1, 0, 8+3, 8+2, 8+1, 8+0, 16*8+3, 16*8+2, 16*8+1, 16*8+0, 16*8+8+3, 16*8+8+2, 16*8+8+1, 16*8+8+0 }; - INT32 YOffs[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 16*16, 17*16, 18*16, 19*16, 20*16, 21*16, 22*16, 23*16 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x20000); - if (tmp == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x20000; i++) tmp[i] = DrvGfxROM0[i] ^ 0xff; - - GfxDecode(0x1000, 4, 8, 8, Plane, XOffs, YOffs, 0x080, tmp, DrvGfxROM0); - GfxDecode(0x0400, 4, 16, 16, Plane, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (select_game == 0) { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x08000, 2, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x02000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x04000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x08000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0c000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x10000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x14000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x18000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x1c000, 12, 1)) return 1; - - if (BurnLoadRom(DrvMcuROM + 0x00000, 13, 1)) return 1; - } else if (select_game == 1) { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x08000, 2, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x02000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x04000, 5, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x06000, 6, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x08000, 7, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x04000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x08000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x0c000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x10000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x14000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x18000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x1c000, 15, 1)) return 1; - } else if (select_game == 2) { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x06000, 3, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x08000, 4, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x0a000, 5, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 6, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x02000, 7, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x04000, 8, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x06000, 9, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x08000, 10, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM1 + 0x0a000, 11, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 12, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x02000, 13, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x04000, 14, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x06000, 15, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x10000, 16, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x12000, 17, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x14000, 18, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x16000, 19, 1)) return 1; - } - - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); - ZetMapArea(0xc000, 0xcfff, 0, DrvVidRAM); - ZetMapArea(0xc000, 0xcfff, 1, DrvVidRAM); - ZetMapArea(0xc000, 0xcfff, 2, DrvVidRAM); - ZetMapArea(0xdc00, 0xdcff, 0, DrvSprRAM); -// ZetMapArea(0xdc00, 0xdcff, 1, DrvSprRAM); - ZetMapArea(0xdc00, 0xdcff, 2, DrvSprRAM); - ZetMapArea(0xdd00, 0xddff, 0, DrvPalRAM); - ZetMapArea(0xdd00, 0xddff, 1, DrvPalRAM); - ZetMapArea(0xdd00, 0xddff, 2, DrvPalRAM); - ZetMapArea(0xde00, 0xdeff, 0, DrvPalRAM + 0x200); - ZetMapArea(0xde00, 0xdeff, 1, DrvPalRAM + 0x200); - ZetMapArea(0xde00, 0xdeff, 2, DrvPalRAM + 0x200); - ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM0); - ZetSetWriteHandler(flstory_main_write); - ZetSetReadHandler(flstory_main_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM1); - ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM1); - ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM1); - ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM1); - ZetMapArea(0xe000, 0xefff, 0, DrvZ80ROM1 + 0xe000); - ZetMapArea(0xe000, 0xefff, 2, DrvZ80ROM1 + 0xe000); - ZetSetWriteHandler(flstory_sound_write); - ZetSetReadHandler(flstory_sound_read); - ZetMemEnd(); - ZetClose(); - - m67805_taito_init(DrvMcuROM, DrvMcuRAM, &standard_m68705_interface); - - AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); - AY8910SetAllRoutes(0, 0.10, BURN_SND_ROUTE_BOTH); - - DACInit(0, 0, 1, flstoryDACSync); - DACSetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - m67805_taito_exit(); - - AY8910Exit(0); - DACExit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_background_layer(INT32 type, INT32 priority) -{ - INT32 masks[4] = { 0x3fff, 0xc000, 0x8000, 0x7fff }; - INT32 mask = masks[type]; - - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - sy -= DrvSprRAM[0xa0 + (offs & 0x1f)] + 16; - if (sy < -7) sy += 256; - if (sy >= nScreenHeight) continue; - - INT32 attr = DrvVidRAM[offs * 2 + 1]; - INT32 code = DrvVidRAM[offs * 2 + 0] | ((attr & 0xc0) << 2) | 0x400 | (char_bank * 0x800); - - INT32 flipy = attr & 0x10; - INT32 flipx = attr & 0x08; - INT32 color = (attr & 0x0f) << 4; - INT32 prio = (attr & 0x20) >> 5; - if (priority && !prio) continue; - - if (type == 0) { - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 0, DrvGfxROM0); - } else { - Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 0, DrvGfxROM0); - } - } - } - else if (type == 2) { - if (flipy) { - if (flipx) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 15, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 15, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 15, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 15, 0, DrvGfxROM0); - } - } - } - else - { - if (flipy) flipy = 0x38; - if (flipx) flipy |= 0x07; - UINT8 *src = DrvGfxROM0 + (code * 8 * 8); - UINT16 *dst; - - for (INT32 y = 0; y < 8; y++, sy++) { - if (sy < 0 || sy >= nScreenHeight) continue; - dst = pTransDraw + sy * nScreenWidth; - - for (INT32 x = 0; x < 8; x++, sx++) { - if (sx < 0 || sx >= nScreenWidth) continue; - - INT32 pxl = src[((y << 3) | x) ^ flipy]; - if (mask & (1 << pxl)) continue; - - dst[sx] = pxl | color; - } - - sx -= 8; - } - } - } -} - -static void victnine_draw_background_layer() -{ - for (INT32 offs = 0; offs < 32 * 32; offs++) - { - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - sy -= DrvSprRAM[0xa0 + (offs & 0x1f)] + 16; - if (sy < -7) sy += 256; - if (sy >= nScreenHeight) continue; - - INT32 attr = DrvVidRAM[offs * 2 + 1]; - INT32 code = DrvVidRAM[offs * 2 + 0] | ((attr & 0x38) << 5); - - INT32 flipy = attr & 0x80; - INT32 flipx = attr & 0x40; - INT32 color = attr & 0x07; - - if (flipy) { - if (flipx) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } else { - Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } - } else { - if (flipx) { - Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } - } - - } -} - -static void draw_sprites(INT32 pri, INT32 type) -{ - for (INT32 i = 0; i < 0x20; i++) - { - INT32 pr = DrvSprRAM[0xa0-1 -i]; - INT32 offs = (pr & 0x1f) * 4; - - if ((pr & 0x80) == pri || type) - { - INT32 sy = DrvSprRAM[offs + 0]; - INT32 attr = DrvSprRAM[offs + 1]; - INT32 code = DrvSprRAM[offs + 2]; - if (type) { - code += (attr & 0x20) << 3; - } else { - code += ((attr & 0x30) << 4); - } - - INT32 sx = DrvSprRAM[offs + 3]; - INT32 flipx = attr & 0x40; - INT32 flipy = attr & 0x80; - - if (*flipscreen) - { - sx = (240 - sx) & 0xff; - sy = sy - 1; - - flipx ^= 0x40; - flipx ^= 0x80; - } - else - sy = 240 - sy - 1; - - sy -= 16; - - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); - } - } - - if (sx > 240) { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx - 256, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx - 256, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx - 256, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx - 256, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); - } - } - } - } - } -} - -static inline void DrvRecalcPalette() -{ - UINT8 r,g,b; - for (INT32 i = 0; i < 0x200; i++) { - INT32 d = DrvPalRAM[i] | (DrvPalRAM[i + 0x200] << 8); - b = (d >> 8) & 0x0f; - g = (d >> 4) & 0x0f; - r = d & 0x0f; - DrvPalette[i] = BurnHighCol((r << 4) | r, (g << 4) | g, (b << 4) | b, 0); - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - DrvRecalcPalette(); - } - - if (nBurnLayer & 1) draw_background_layer(0, 0); - if (nBurnLayer & 2) draw_background_layer(1, 0); - if (nBurnLayer & 4) draw_background_layer(2, 1); - if (nBurnLayer & 8) draw_background_layer(3, 1); - draw_sprites(0x00, 0); - draw_sprites(0x80, 0); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 victnineDraw() -{ - if (DrvRecalc) { - DrvRecalcPalette(); - } - - victnine_draw_background_layer(); - draw_sprites(0, 1); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - memset (DrvInputs, 0xff, 5); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; - DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; - } - } - - INT32 nInterleave = 100; - INT32 nCyclesTotal[3] = { 5366500 / 60, 4000000 / 60, 3072000 / 60 }; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - if (select_game == 2) nCyclesTotal[0] = nCyclesTotal[1]; - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nSegment = nCyclesTotal[0] / nInterleave; - - ZetOpen(0); - nCyclesDone[0] += ZetRun(nSegment); - if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - ZetOpen(1); - nSegment = nCyclesTotal[1] / nInterleave; - nCyclesDone[1] += ZetRun(nSegment); - if (i == (nInterleave / 2) - 1) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - if (i == (nInterleave / 1) - 1) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - if (select_game == 0) { - m6805Open(0); - nSegment = nCyclesTotal[2] / nInterleave; - nCyclesDone[2] += m6805Run(nSegment); - m6805Close(); - } - } - - ZetOpen(1); - - if (pBurnSoundOut) { - AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); - DACUpdate(pBurnSoundOut, nBurnSoundLen); - } - - ZetClose(); - - if (pBurnDraw) { - BurnDrvRedraw(); - } - - return 0; -} - - -// The FairyLand Story - -static struct BurnRomInfo flstoryRomDesc[] = { - { "cpu-a45.15", 0x4000, 0xf03fc969, 1 }, // 0 maincpu - { "cpu-a45.16", 0x4000, 0x311aa82e, 1 }, // 1 - { "cpu-a45.17", 0x4000, 0xa2b5d17d, 1 }, // 2 - - { "snd.22", 0x2000, 0xd58b201d, 2 }, // 3 audiocpu - { "snd.23", 0x2000, 0x25e7fd9d, 2 }, // 4 - - { "vid-a45.18", 0x4000, 0x6f08f69e, 3 }, // 5 gfx1 - { "vid-a45.06", 0x4000, 0xdc856a75, 3 }, // 6 - { "vid-a45.08", 0x4000, 0xd0b028ca, 3 }, // 7 - { "vid-a45.20", 0x4000, 0x1b0edf34, 3 }, // 8 - { "vid-a45.19", 0x4000, 0x2b572dc9, 3 }, // 9 - { "vid-a45.07", 0x4000, 0xaa4b0762, 3 }, // 10 - { "vid-a45.09", 0x4000, 0x8336be58, 3 }, // 11 - { "vid-a45.21", 0x4000, 0xfc382bd1, 3 }, // 12 - - { "a45.mcu", 0x0800, 0x5378253c, 4 }, // 13 mcu -}; - -STD_ROM_PICK(flstory) -STD_ROM_FN(flstory) - -static INT32 flstoryInit() -{ - select_game = 0; - - return DrvInit(); -} - -struct BurnDriver BurnDrvFlstory = { - "flstory", NULL, NULL, NULL, "1985", - "The FairyLand Story\0", NULL, "Taito", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, flstoryRomInfo, flstoryRomName, NULL, NULL, FlstoryInputInfo, FlstoryDIPInfo, - flstoryInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// The FairyLand Story (Japan) - -static struct BurnRomInfo flstoryjRomDesc[] = { - { "cpu-a45.15", 0x4000, 0xf03fc969, 1 }, // 0 maincpu - { "cpu-a45.16", 0x4000, 0x311aa82e, 1 }, // 1 - { "cpu-a45.17", 0x4000, 0xa2b5d17d, 1 }, // 2 - - { "a45_12.8", 0x2000, 0xd6f593fb, 2 }, // 3 audiocpu - { "a45_13.9", 0x2000, 0x451f92f9, 2 }, // 4 - - { "vid-a45.18", 0x4000, 0x6f08f69e, 3 }, // 5 gfx1 - { "vid-a45.06", 0x4000, 0xdc856a75, 3 }, // 6 - { "vid-a45.08", 0x4000, 0xd0b028ca, 3 }, // 7 - { "vid-a45.20", 0x4000, 0x1b0edf34, 3 }, // 8 - { "vid-a45.19", 0x4000, 0x2b572dc9, 3 }, // 9 - { "vid-a45.07", 0x4000, 0xaa4b0762, 3 }, // 10 - { "vid-a45.09", 0x4000, 0x8336be58, 3 }, // 11 - { "vid-a45.21", 0x4000, 0xfc382bd1, 3 }, // 12 - - { "a45.mcu", 0x0800, 0x5378253c, 4 }, // 13 mcu -}; - -STD_ROM_PICK(flstoryj) -STD_ROM_FN(flstoryj) - -struct BurnDriver BurnDrvFlstoryj = { - "flstoryj", "flstory", NULL, NULL, "1985", - "The FairyLand Story (Japan)\0", NULL, "Taito", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, flstoryjRomInfo, flstoryjRomName, NULL, NULL, FlstoryInputInfo, FlstoryDIPInfo, - flstoryInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Onna Sansirou - Typhoon Gal (set 1) - -static struct BurnRomInfo onna34roRomDesc[] = { - { "a52-01-1.40c", 0x4000, 0xffddcb02, 1 }, // 0 maincpu - { "a52-02-1.41c", 0x4000, 0xda97150d, 1 }, // 1 - { "a52-03-1.42c", 0x4000, 0xb9749a53, 1 }, // 2 - - { "a52-12.08s", 0x2000, 0x28f48096, 2 }, // 3 audiocpu - { "a52-13.09s", 0x2000, 0x4d3b16f3, 2 }, // 4 - { "a52-14.10s", 0x2000, 0x90a6f4e8, 2 }, // 5 - { "a52-15.37s", 0x2000, 0x5afc21d0, 2 }, // 6 - { "a52-16.38s", 0x2000, 0xccf42aee, 2 }, // 7 - - { "a52-04.11v", 0x4000, 0x5b126294, 3 }, // 8 gfx1 - { "a52-06.10v", 0x4000, 0x78114721, 3 }, // 9 - { "a52-08.09v", 0x4000, 0x4a293745, 3 }, // 10 - { "a52-10.08v", 0x4000, 0x8be7b4db, 3 }, // 11 - { "a52-05.35v", 0x4000, 0xa1a99588, 3 }, // 12 - { "a52-07.34v", 0x4000, 0x0bf420f2, 3 }, // 13 - { "a52-09.33v", 0x4000, 0x39c543b5, 3 }, // 14 - { "a52-11.32v", 0x4000, 0xd1dda6b3, 3 }, // 15 - - { "a52-17.54c", 0x0800, 0x00000000, 4 | BRF_NODUMP }, // 16 cpu2 -}; - -STD_ROM_PICK(onna34ro) -STD_ROM_FN(onna34ro) - -static INT32 onna34roInit() -{ - select_game = 1; - - return DrvInit(); -} - -struct BurnDriver BurnDrvOnna34ro = { - "onna34ro", NULL, NULL, NULL, "1985", - "Onna Sansirou - Typhoon Gal (set 1)\0", NULL, "Taito", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, onna34roRomInfo, onna34roRomName, NULL, NULL, Onna34roInputInfo, Onna34roDIPInfo, - onna34roInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Onna Sansirou - Typhoon Gal (set 2) - -static struct BurnRomInfo onna34raRomDesc[] = { - { "ry-08.rom", 0x4000, 0xe4587b85, 1 }, // 0 maincpu - { "ry-07.rom", 0x4000, 0x6ffda515, 1 }, // 1 - { "ry-06.rom", 0x4000, 0x6fefcda8, 1 }, // 2 - - { "a52-12.08s", 0x2000, 0x28f48096, 2 }, // 3 audiocpu - { "a52-13.09s", 0x2000, 0x4d3b16f3, 2 }, // 4 - { "a52-14.10s", 0x2000, 0x90a6f4e8, 2 }, // 5 - { "a52-15.37s", 0x2000, 0x5afc21d0, 2 }, // 6 - { "a52-16.38s", 0x2000, 0xccf42aee, 2 }, // 7 - - { "a52-04.11v", 0x4000, 0x5b126294, 3 }, // 8 gfx1 - { "a52-06.10v", 0x4000, 0x78114721, 3 }, // 9 - { "a52-08.09v", 0x4000, 0x4a293745, 3 }, // 10 - { "a52-10.08v", 0x4000, 0x8be7b4db, 3 }, // 11 - { "a52-05.35v", 0x4000, 0xa1a99588, 3 }, // 12 - { "a52-07.34v", 0x4000, 0x0bf420f2, 3 }, // 13 - { "a52-09.33v", 0x4000, 0x39c543b5, 3 }, // 14 - { "a52-11.32v", 0x4000, 0xd1dda6b3, 3 }, // 15 - - { "a52-17.54c", 0x0800, 0x00000000, 4 | BRF_NODUMP }, // 16 cpu2 -}; - -STD_ROM_PICK(onna34ra) -STD_ROM_FN(onna34ra) - -struct BurnDriver BurnDrvOnna34ra = { - "onna34roa", "onna34ro", NULL, NULL, "1985", - "Onna Sansirou - Typhoon Gal (set 2)\0", NULL, "Taito", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, onna34raRomInfo, onna34raRomName, NULL, NULL, Onna34roInputInfo, Onna34roDIPInfo, - onna34roInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Victorious Nine - -static struct BurnRomInfo victnineRomDesc[] = { - { "a16-19.1", 0x2000, 0xdeb7c439, 1 }, // 0 maincpu - { "a16-20.2", 0x2000, 0x60cdb6ae, 1 }, // 1 - { "a16-21.3", 0x2000, 0x121bea03, 1 }, // 2 - { "a16-22.4", 0x2000, 0xb20e3027, 1 }, // 3 - { "a16-23.5", 0x2000, 0x95fe9cb7, 1 }, // 4 - { "a16-24.6", 0x2000, 0x32b5c155, 1 }, // 5 - - { "a16-12.8", 0x2000, 0x4b9bff43, 2 }, // 6 audiocpu - { "a16-13.9", 0x2000, 0x355121b9, 2 }, // 7 - { "a16-14.10", 0x2000, 0x0f33ef4d, 2 }, // 8 - { "a16-15.37", 0x2000, 0xf91d63dc, 2 }, // 9 - { "a16-16.38", 0x2000, 0x9395351b, 2 }, // 10 - { "a16-17.39", 0x2000, 0x872270b3, 2 }, // 11 - - { "a16-06-1.7", 0x2000, 0xb708134d, 3 }, // 12 gfx1 - { "a16-07-2.8", 0x2000, 0xcdaf7f83, 3 }, // 13 - { "a16-10.90", 0x2000, 0xe8e42454, 3 }, // 14 - { "a16-11-1.91", 0x2000, 0x1f766661, 3 }, // 15 - { "a16-04.5", 0x2000, 0xb2fae99f, 3 }, // 16 - { "a16-05-1.6", 0x2000, 0x85dfbb6e, 3 }, // 17 - { "a16-08.88", 0x2000, 0x1ddb6466, 3 }, // 18 - { "a16-09-1.89", 0x2000, 0x23d4c43c, 3 }, // 19 - - { "a16-18.mcu", 0x0800, 0x00000000, 4 | BRF_NODUMP }, // 20 cpu2 -}; - -STD_ROM_PICK(victnine) -STD_ROM_FN(victnine) - -static INT32 victnineInit() -{ - select_game = 2; - - INT32 nRet = DrvInit(); - - AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); - - return nRet; -} - -struct BurnDriverD BurnDrvVictnine = { - "victnine", NULL, NULL, NULL, "1984", - "Victorious Nine\0", NULL, "Taito", "Miscellaneous", - NULL, NULL, NULL, NULL, - 0, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, victnineRomInfo, victnineRomName, NULL, NULL, VictnineInputInfo, VictnineDIPInfo, - victnineInit, DrvExit, DrvFrame, victnineDraw, NULL, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - +#include "tiles_generic.h" +#include "taito_m68705.h" +#include "z80_intf.h" +#include "driver.h" +#include "dac.h" +extern "C" { +#include "ay8910.h" +} + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvMcuROM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvVidRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvMcuRAM; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static INT16 *pAY8910Buffer[3]; + +static UINT8 snd_data; +static UINT8 snd_flag; +static INT32 nmi_enable; +static INT32 pending_nmi; +static INT32 char_bank = 0; +static INT32 mcu_select; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvJoy4[8]; +static UINT8 DrvJoy5[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[5]; +static UINT8 DrvReset; + +static UINT8 *flipscreen; +static UINT8 *soundlatch; + +static INT32 select_game; + +static struct BurnInputInfo FlstoryInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 3, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Flstory) + +static struct BurnDIPInfo FlstoryDIPList[]= +{ + {0x0f, 0xff, 0xff, 0xec, NULL }, + {0x10, 0xff, 0xff, 0x00, NULL }, + {0x11, 0xff, 0xff, 0xf8, NULL }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x0f, 0x01, 0x03, 0x00, "30000 100000" }, + {0x0f, 0x01, 0x03, 0x01, "30000 150000" }, + {0x0f, 0x01, 0x03, 0x02, "50000 150000" }, + {0x0f, 0x01, 0x03, 0x03, "70000 150000" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x0f, 0x01, 0x04, 0x04, "Off" }, + {0x0f, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x0f, 0x01, 0x18, 0x08, "3" }, + {0x0f, 0x01, 0x18, 0x10, "4" }, + {0x0f, 0x01, 0x18, 0x18, "5" }, + {0x0f, 0x01, 0x18, 0x00, "Infinite (Cheat)" }, + + {0 , 0xfe, 0 , 2, "Debug Mode" }, + {0x0f, 0x01, 0x20, 0x20, "Off" }, + {0x0f, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x0f, 0x01, 0x40, 0x40, "Off" }, + {0x0f, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x0f, 0x01, 0x80, 0x80, "Upright" }, + {0x0f, 0x01, 0x80, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x10, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x10, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, + {0x10, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, + {0x10, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, + {0x10, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x10, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, + {0x10, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x10, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, + {0x10, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x10, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, + {0x10, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, + {0x10, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, + {0x10, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, + {0x10, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x10, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, + {0x10, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x10, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, + {0x10, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x11, 0x01, 0x08, 0x00, "No" }, + {0x11, 0x01, 0x08, 0x08, "Yes" }, + + {0 , 0xfe, 0 , 2, "Attract Animation" }, + {0x11, 0x01, 0x10, 0x00, "Off" }, + {0x11, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2, "Leave Off" }, + {0x11, 0x01, 0x20, 0x20, "Off" }, + {0x11, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)" }, + {0x11, 0x01, 0x40, 0x40, "Off" }, + {0x11, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Slots" }, + {0x11, 0x01, 0x80, 0x00, "1" }, + {0x11, 0x01, 0x80, 0x80, "2" }, +}; + +STDDIPINFO(Flstory) + +static struct BurnInputInfo Onna34roInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 5, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 4, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 5, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 4, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 3, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Onna34ro) + +static struct BurnDIPInfo Onna34roDIPList[]= +{ + {0x13, 0xff, 0xff, 0xe0, NULL }, + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0x80, NULL }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x13, 0x01, 0x03, 0x00, "200000 200000" }, + {0x13, 0x01, 0x03, 0x01, "200000 300000" }, + {0x13, 0x01, 0x03, 0x02, "100000 200000" }, + {0x13, 0x01, 0x03, 0x03, "200000 100000" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x13, 0x01, 0x04, 0x00, "Off" }, + {0x13, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x18, 0x10, "1" }, + {0x13, 0x01, 0x18, 0x08, "2" }, + {0x13, 0x01, 0x18, 0x00, "3" }, + {0x13, 0x01, 0x18, 0x18, "Endless (Cheat)" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x80, 0x80, "Upright" }, + {0x13, 0x01, 0x80, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x14, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x14, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, + {0x14, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x14, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, + {0x14, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, + {0x14, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x14, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, + {0x14, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)"}, + {0x15, 0x01, 0x01, 0x00, "Off" }, + {0x15, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2, "Rack Test" }, + {0x15, 0x01, 0x02, 0x00, "Off" }, + {0x15, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Freeze" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Coinage Display" }, + {0x15, 0x01, 0x10, 0x10, "Off" }, + {0x15, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x60, 0x20, "Easy" }, + {0x15, 0x01, 0x60, 0x00, "Normal" }, + {0x15, 0x01, 0x60, 0x40, "Difficult" }, + {0x15, 0x01, 0x60, 0x60, "Very Difficult" }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x15, 0x01, 0x80, 0x80, "A and B" }, + {0x15, 0x01, 0x80, 0x00, "A only" }, +}; + +STDDIPINFO(Onna34ro) + +static struct BurnInputInfo VictnineInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 5, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 4, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy4 + 2, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, DrvJoy4 + 3, "p1 fire 4" }, + {"P1 Button 5", BIT_DIGITAL, DrvJoy4 + 4, "p1 fire 5" }, + {"P1 Button 6", BIT_DIGITAL, DrvJoy4 + 5, "p1 fire 6" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 5, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 4, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy5 + 2, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, DrvJoy5 + 3, "p2 fire 4" }, + {"P2 Button 5", BIT_DIGITAL, DrvJoy5 + 4, "p2 fire 5" }, + {"P2 Button 6", BIT_DIGITAL, DrvJoy5 + 5, "p2 fire 6" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 3, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Victnine) + +static struct BurnDIPInfo VictnineDIPList[]= +{ + {0x1b, 0xff, 0xff, 0x67, NULL }, + {0x1c, 0xff, 0xff, 0x00, NULL }, + {0x1d, 0xff, 0xff, 0x7f, NULL }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x1b, 0x01, 0x04, 0x04, "Off" }, + {0x1b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x1b, 0x01, 0x40, 0x40, "Off" }, + {0x1b, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 3, "Cabinet" }, + {0x1b, 0x01, 0xa0, 0x20, "Upright" }, + {0x1b, 0x01, 0xa0, 0xa0, "Cocktail" }, + {0x1b, 0x01, 0xa0, 0x00, "MA / MB" }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x1c, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, + {0x1c, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, + {0x1c, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, + {0x1c, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, + {0x1c, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, + {0x1c, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, + {0x1c, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, + {0x1c, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x1c, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, + {0x1c, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, + {0x1c, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, + {0x1c, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x1c, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, + {0x1c, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x1c, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, + {0x1c, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x1c, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, + {0x1c, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, + {0x1c, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, + {0x1c, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, + {0x1c, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x1c, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, + {0x1c, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, + {0x1c, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, + {0x1c, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, + {0x1c, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, + {0x1c, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, + {0x1c, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x1c, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, + {0x1c, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x1c, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, + {0x1c, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 2, "Coinage Display" }, + {0x1d, 0x01, 0x10, 0x00, "Off" }, + {0x1d, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 2, "Show Year" }, + {0x1d, 0x01, 0x20, 0x00, "Off" }, + {0x1d, 0x01, 0x20, 0x20, "On" }, + + {0 , 0xfe, 0 , 2, "No hit" }, + {0x1d, 0x01, 0x40, 0x40, "Off" }, + {0x1d, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x1d, 0x01, 0x80, 0x80, "A and B" }, + {0x1d, 0x01, 0x80, 0x00, "A only" }, +}; + +STDDIPINFO(Victnine) + +static void gfxctrl_write(INT32 data) +{ + char_bank = (data & 0x10) >> 4; + + INT32 bank = (data & 0x20) << 3; + + ZetMapArea(0xdd00, 0xddff, 0, DrvPalRAM + 0x000 + bank); + ZetMapArea(0xdd00, 0xddff, 1, DrvPalRAM + 0x000 + bank); + ZetMapArea(0xde00, 0xdeff, 0, DrvPalRAM + 0x200 + bank); + ZetMapArea(0xde00, 0xdeff, 1, DrvPalRAM + 0x200 + bank); + + if (data & 4) *flipscreen = (~data & 0x01); +} + +static void onna34ro_mcu_write(INT32 data) +{ + INT32 score_adr = (ZetReadByte(0xe29e) << 8) | ZetReadByte(0xe29d); + + mcu_sent = 1; + + switch (data) + { + case 0x0e: + from_mcu = 0xff; + break; + + case 0x01: + from_mcu = 0x6a; + break; + + case 0x40: + from_mcu = ZetReadByte(score_adr); + break; + + case 0x41: + from_mcu = ZetReadByte(score_adr+1); + break; + + case 0x42: + from_mcu = ZetReadByte(score_adr+2) & 0x0f; + break; + + default: + from_mcu = 0x80; + } +} + +static const UINT8 victnine_mcu_data[0x100] = +{ + 0x3e, 0x08, 0xdd, 0x29, 0xcb, 0x14, 0xfd, 0x29, + 0xcb, 0x15, 0xd9, 0x29, 0xd9, 0x30, 0x0d, 0xd9, + 0x19, 0xd9, 0xdd, 0x09, 0x30, 0x01, 0x24, 0xfd, + 0x19, 0x30, 0x01, 0x2c, 0x3d, 0x20, 0xe3, 0xc9, + 0x11, 0x14, 0x00, 0x19, 0x7e, 0x32, 0xed, 0xe4, + 0x2a, 0x52, 0xe5, 0x22, 0xe9, 0xe4, 0x2a, 0x54, + 0xe5, 0x22, 0xeb, 0xe4, 0x21, 0x2a, 0xe6, 0xfe, + 0x06, 0x38, 0x02, 0xcb, 0xc6, 0xcb, 0xce, 0xc9, + 0x06, 0x00, 0x3a, 0xaa, 0xe4, 0x07, 0x07, 0x07, + 0xb0, 0x47, 0x3a, 0xab, 0xe4, 0x07, 0x07, 0xb0, + 0x47, 0x3a, 0xac, 0xe4, 0xe6, 0x03, 0xb0, 0x21, + 0xe3, 0xe6, 0xc9, 0x38, 0xe1, 0x29, 0x07, 0xc9, + 0x23, 0x7e, 0x47, 0xe6, 0x1f, 0x32, 0x0c, 0xe6, + 0x78, 0xe6, 0xe0, 0x07, 0x07, 0x47, 0xe6, 0x03, + 0x28, 0x06, 0xcb, 0x7a, 0x28, 0x02, 0xc6, 0x02, + 0x32, 0x0a, 0xe6, 0x78, 0xe6, 0x80, 0xc9, 0x3a, + 0x21, 0x29, 0xe5, 0x7e, 0xe6, 0xf8, 0xf6, 0x01, + 0x77, 0x23, 0x3a, 0x0a, 0xe6, 0x77, 0x21, 0x08, + 0xe6, 0xcb, 0xc6, 0xcb, 0x8e, 0x3a, 0x2b, 0xe5, + 0x21, 0xff, 0xe5, 0xfe, 0x02, 0xc9, 0x1f, 0xc6, + 0x47, 0x3a, 0xaa, 0xe4, 0xa7, 0x21, 0x00, 0xe5, + 0x28, 0x03, 0x21, 0x1b, 0xe5, 0x70, 0x3a, 0xaa, + 0xe4, 0xee, 0x01, 0x32, 0xaa, 0xe4, 0x21, 0xb0, + 0xe4, 0x34, 0x23, 0x36, 0x00, 0xc9, 0x2b, 0xb2, + 0xaf, 0x77, 0x12, 0x23, 0x13, 0x3c, 0xfe, 0x09, + 0x20, 0xf7, 0x3e, 0x01, 0x32, 0xad, 0xe4, 0x21, + 0x48, 0xe5, 0xcb, 0xfe, 0xc9, 0x32, 0xe5, 0xaa, + 0x21, 0x00, 0x13, 0xe4, 0x47, 0x1b, 0xa1, 0xc9, + 0x00, 0x08, 0x04, 0x0c, 0x05, 0x0d, 0x06, 0x0e, + 0x22, 0x66, 0xaa, 0x22, 0x33, 0x01, 0x11, 0x88, + 0x06, 0x05, 0x03, 0x04, 0x08, 0x01, 0x03, 0x02, + 0x06, 0x07, 0x02, 0x03, 0x15, 0x17, 0x11, 0x13 +}; + +static void victnine_mcu_write(INT32 data) +{ + INT32 seed = ZetReadByte(0xe685); + + if (!seed && (data & 0x37) == 0x37) + { + from_mcu = 0xa6; + } + else + { + data += seed; + + if ((data & ~0x1f) == 0xa0) + { + mcu_select = data & 0x1f; + } + else if (data < 0x20) + { + INT32 offset = mcu_select * 8 + data; + from_mcu = victnine_mcu_data[offset]; + } + else if (data >= 0x38 && data <= 0x3a) + { + from_mcu = ZetReadByte(0xe691 - 0x38 + data); + } + } +} + +void __fastcall flstory_main_write(UINT16 address, UINT8 data) +{ + if ((address & 0xff00) == 0xdc00) { + DrvSprRAM[address & 0xff] = data; + + if (select_game == 2 && address == 0xdce0) { + gfxctrl_write((data ^ 1) & ~0x10); + } + + return; + } + + switch (address) + { + case 0xd000: + if (select_game == 2) { + victnine_mcu_write(data); + } if (select_game == 1) { + onna34ro_mcu_write(data); + } else { + standard_taito_mcu_write(data); + } + return; + + case 0xd400: + { + *soundlatch = data; + + if (nmi_enable) { + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + } else { + pending_nmi = 1; + } + } + return; + + case 0xdf03: + if (select_game != 2) gfxctrl_write(data | 0x04); + return; + } +} + +UINT8 __fastcall flstory_main_read(UINT16 address) +{ + switch (address) + { + case 0xd000: + if (select_game == 2) { + return from_mcu - ZetReadByte(0xe685); + } else { + return standard_taito_mcu_read(); + } + + case 0xd400: + snd_flag = 0; + return snd_data; + + case 0xd401: + return snd_flag | 0xfd; + + case 0xd800: + case 0xd801: + case 0xd802: + return DrvDips[address & 3]; + + case 0xd803: + return DrvInputs[0] & 0x3f; + + case 0xd804: + return DrvInputs[1]; + + case 0xd805: + { + INT32 res = 0; + if (!main_sent) res |= 0x01; + if (mcu_sent) res |= 0x02; + + if (select_game == 2) res |= DrvInputs[3]; + + return res; + } + + case 0xd806: + return DrvInputs[2]; + + case 0xd807: + return DrvInputs[4]; + } + + return 0; +} + +void __fastcall flstory_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xc800: + case 0xc801: + AY8910Write(0, address & 1, data); + return; + + case 0xca00: + case 0xca01: + case 0xca02: + case 0xca03: + case 0xca04: + case 0xca05: + case 0xca06: + case 0xca07: + case 0xca08: + case 0xca09: + case 0xca0a: + case 0xca0b: + case 0xca0c: + case 0xca0d: + // msm5232 + return; + + case 0xd800: + snd_data = data; + snd_flag = 2; + return; + + case 0xda00: + nmi_enable = 1; + if (pending_nmi) + { + ZetNmi(); + pending_nmi = 0; + } + return; + + case 0xdc00: + nmi_enable = 0; + return; + + case 0xde00: + DACSignedWrite(0, data); + return; + } +} + +UINT8 __fastcall flstory_sound_read(UINT16 address) +{ + if (address == 0xd800) { + return *soundlatch; + } + + return 0; +} + +static INT32 flstoryDACSync() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (4000000.000 / (nBurnFPS / 100.000)))); +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + m67805_taito_reset(); + + AY8910Reset(0); + DACReset(); + + snd_data = 0; + snd_flag = 0; + nmi_enable = 0; + pending_nmi = 0; + char_bank = 0; + mcu_select = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x010000; + DrvZ80ROM1 = Next; Next += 0x010000; + + DrvMcuROM = Next; Next += 0x000800; + + DrvGfxROM0 = Next; Next += 0x040000; + DrvGfxROM1 = Next; Next += 0x040000; + + DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); + + AllRam = Next; + + DrvVidRAM = Next; Next += 0x001000; + DrvZ80RAM0 = Next; Next += 0x000800; + DrvZ80RAM1 = Next; Next += 0x000800; + DrvPalRAM = Next; Next += 0x000400; + DrvSprRAM = Next; Next += 0x000100; + + DrvMcuRAM = Next; Next += 0x000080; + + soundlatch = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + + RamEnd = Next; + + pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x80000, 0x80004, 0x00000, 0x00004 }; + INT32 XOffs[16] = { 3, 2, 1, 0, 8+3, 8+2, 8+1, 8+0, 16*8+3, 16*8+2, 16*8+1, 16*8+0, 16*8+8+3, 16*8+8+2, 16*8+8+1, 16*8+8+0 }; + INT32 YOffs[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 16*16, 17*16, 18*16, 19*16, 20*16, 21*16, 22*16, 23*16 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x20000); + if (tmp == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x20000; i++) tmp[i] = DrvGfxROM0[i] ^ 0xff; + + GfxDecode(0x1000, 4, 8, 8, Plane, XOffs, YOffs, 0x080, tmp, DrvGfxROM0); + GfxDecode(0x0400, 4, 16, 16, Plane, XOffs, YOffs, 0x200, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (select_game == 0) { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x08000, 2, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x02000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x04000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x08000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0c000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x10000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x14000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x18000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x1c000, 12, 1)) return 1; + + if (BurnLoadRom(DrvMcuROM + 0x00000, 13, 1)) return 1; + } else if (select_game == 1) { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x08000, 2, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x02000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x04000, 5, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x06000, 6, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x08000, 7, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x04000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x08000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x0c000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x10000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x14000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x18000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x1c000, 15, 1)) return 1; + } else if (select_game == 2) { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x06000, 3, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x08000, 4, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x0a000, 5, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 6, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x02000, 7, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x04000, 8, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x06000, 9, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x08000, 10, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM1 + 0x0a000, 11, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 12, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x02000, 13, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x04000, 14, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x06000, 15, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x10000, 16, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x12000, 17, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x14000, 18, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x16000, 19, 1)) return 1; + } + + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); + ZetMapArea(0xc000, 0xcfff, 0, DrvVidRAM); + ZetMapArea(0xc000, 0xcfff, 1, DrvVidRAM); + ZetMapArea(0xc000, 0xcfff, 2, DrvVidRAM); + ZetMapArea(0xdc00, 0xdcff, 0, DrvSprRAM); +// ZetMapArea(0xdc00, 0xdcff, 1, DrvSprRAM); + ZetMapArea(0xdc00, 0xdcff, 2, DrvSprRAM); + ZetMapArea(0xdd00, 0xddff, 0, DrvPalRAM); + ZetMapArea(0xdd00, 0xddff, 1, DrvPalRAM); + ZetMapArea(0xdd00, 0xddff, 2, DrvPalRAM); + ZetMapArea(0xde00, 0xdeff, 0, DrvPalRAM + 0x200); + ZetMapArea(0xde00, 0xdeff, 1, DrvPalRAM + 0x200); + ZetMapArea(0xde00, 0xdeff, 2, DrvPalRAM + 0x200); + ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM0); + ZetSetWriteHandler(flstory_main_write); + ZetSetReadHandler(flstory_main_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM1); + ZetMapArea(0xc000, 0xc7ff, 0, DrvZ80RAM1); + ZetMapArea(0xc000, 0xc7ff, 1, DrvZ80RAM1); + ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80RAM1); + ZetMapArea(0xe000, 0xefff, 0, DrvZ80ROM1 + 0xe000); + ZetMapArea(0xe000, 0xefff, 2, DrvZ80ROM1 + 0xe000); + ZetSetWriteHandler(flstory_sound_write); + ZetSetReadHandler(flstory_sound_read); + ZetClose(); + + m67805_taito_init(DrvMcuROM, DrvMcuRAM, &standard_m68705_interface); + + AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL); + AY8910SetAllRoutes(0, 0.10, BURN_SND_ROUTE_BOTH); + + DACInit(0, 0, 1, flstoryDACSync); + DACSetRoute(0, 0.20, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + m67805_taito_exit(); + + AY8910Exit(0); + DACExit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_background_layer(INT32 type, INT32 priority) +{ + INT32 masks[4] = { 0x3fff, 0xc000, 0x8000, 0x7fff }; + INT32 mask = masks[type]; + + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + sy -= DrvSprRAM[0xa0 + (offs & 0x1f)] + 16; + if (sy < -7) sy += 256; + if (sy >= nScreenHeight) continue; + + INT32 attr = DrvVidRAM[offs * 2 + 1]; + INT32 code = DrvVidRAM[offs * 2 + 0] | ((attr & 0xc0) << 2) | 0x400 | (char_bank * 0x800); + + INT32 flipy = attr & 0x10; + INT32 flipx = attr & 0x08; + INT32 color = (attr & 0x0f) << 4; + INT32 prio = (attr & 0x20) >> 5; + if (priority && !prio) continue; + + if (type == 0) { + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 0, DrvGfxROM0); + } else { + Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 0, DrvGfxROM0); + } + } + } + else if (type == 2) { + if (flipy) { + if (flipx) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 15, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 15, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 15, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color >> 4, 4, 15, 0, DrvGfxROM0); + } + } + } + else + { + if (flipy) flipy = 0x38; + if (flipx) flipy |= 0x07; + UINT8 *src = DrvGfxROM0 + (code * 8 * 8); + UINT16 *dst; + + for (INT32 y = 0; y < 8; y++, sy++) { + if (sy < 0 || sy >= nScreenHeight) continue; + dst = pTransDraw + sy * nScreenWidth; + + for (INT32 x = 0; x < 8; x++, sx++) { + if (sx < 0 || sx >= nScreenWidth) continue; + + INT32 pxl = src[((y << 3) | x) ^ flipy]; + if (mask & (1 << pxl)) continue; + + dst[sx] = pxl | color; + } + + sx -= 8; + } + } + } +} + +static void victnine_draw_background_layer() +{ + for (INT32 offs = 0; offs < 32 * 32; offs++) + { + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + sy -= DrvSprRAM[0xa0 + (offs & 0x1f)] + 16; + if (sy < -7) sy += 256; + if (sy >= nScreenHeight) continue; + + INT32 attr = DrvVidRAM[offs * 2 + 1]; + INT32 code = DrvVidRAM[offs * 2 + 0] | ((attr & 0x38) << 5); + + INT32 flipy = attr & 0x80; + INT32 flipx = attr & 0x40; + INT32 color = attr & 0x07; + + if (flipy) { + if (flipx) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } else { + Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } + } else { + if (flipx) { + Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } + } + + } +} + +static void draw_sprites(INT32 pri, INT32 type) +{ + for (INT32 i = 0; i < 0x20; i++) + { + INT32 pr = DrvSprRAM[0xa0-1 -i]; + INT32 offs = (pr & 0x1f) * 4; + + if ((pr & 0x80) == pri || type) + { + INT32 sy = DrvSprRAM[offs + 0]; + INT32 attr = DrvSprRAM[offs + 1]; + INT32 code = DrvSprRAM[offs + 2]; + if (type) { + code += (attr & 0x20) << 3; + } else { + code += ((attr & 0x30) << 4); + } + + INT32 sx = DrvSprRAM[offs + 3]; + INT32 flipx = attr & 0x40; + INT32 flipy = attr & 0x80; + + if (*flipscreen) + { + sx = (240 - sx) & 0xff; + sy = sy - 1; + + flipx ^= 0x40; + flipx ^= 0x80; + } + else + sy = 240 - sy - 1; + + sy -= 16; + + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); + } + } + + if (sx > 240) { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx - 256, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx - 256, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx - 256, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx - 256, sy, attr & 0x0f, 4, 15, 0x100, DrvGfxROM1); + } + } + } + } + } +} + +static inline void DrvRecalcPalette() +{ + UINT8 r,g,b; + for (INT32 i = 0; i < 0x200; i++) { + INT32 d = DrvPalRAM[i] | (DrvPalRAM[i + 0x200] << 8); + b = (d >> 8) & 0x0f; + g = (d >> 4) & 0x0f; + r = d & 0x0f; + DrvPalette[i] = BurnHighCol((r << 4) | r, (g << 4) | g, (b << 4) | b, 0); + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + DrvRecalcPalette(); + } + + if (nBurnLayer & 1) draw_background_layer(0, 0); + if (nBurnLayer & 2) draw_background_layer(1, 0); + if (nBurnLayer & 4) draw_background_layer(2, 1); + if (nBurnLayer & 8) draw_background_layer(3, 1); + draw_sprites(0x00, 0); + draw_sprites(0x80, 0); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 victnineDraw() +{ + if (DrvRecalc) { + DrvRecalcPalette(); + } + + victnine_draw_background_layer(); + draw_sprites(0, 1); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + memset (DrvInputs, 0xff, 5); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + DrvInputs[3] ^= (DrvJoy4[i] & 1) << i; + DrvInputs[4] ^= (DrvJoy5[i] & 1) << i; + } + } + + INT32 nInterleave = 100; + INT32 nCyclesTotal[3] = { 5366500 / 60, 4000000 / 60, 3072000 / 60 }; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + if (select_game == 2) nCyclesTotal[0] = nCyclesTotal[1]; + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nSegment = nCyclesTotal[0] / nInterleave; + + ZetOpen(0); + nCyclesDone[0] += ZetRun(nSegment); + if (i == (nInterleave - 1)) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + ZetOpen(1); + nSegment = nCyclesTotal[1] / nInterleave; + nCyclesDone[1] += ZetRun(nSegment); + if (i == (nInterleave / 2) - 1) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + if (i == (nInterleave / 1) - 1) ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + if (select_game == 0) { + m6805Open(0); + nSegment = nCyclesTotal[2] / nInterleave; + nCyclesDone[2] += m6805Run(nSegment); + m6805Close(); + } + } + + ZetOpen(1); + + if (pBurnSoundOut) { + AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0); + DACUpdate(pBurnSoundOut, nBurnSoundLen); + } + + ZetClose(); + + if (pBurnDraw) { + BurnDrvRedraw(); + } + + return 0; +} + + +// The FairyLand Story + +static struct BurnRomInfo flstoryRomDesc[] = { + { "cpu-a45.15", 0x4000, 0xf03fc969, 1 }, // 0 maincpu + { "cpu-a45.16", 0x4000, 0x311aa82e, 1 }, // 1 + { "cpu-a45.17", 0x4000, 0xa2b5d17d, 1 }, // 2 + + { "snd.22", 0x2000, 0xd58b201d, 2 }, // 3 audiocpu + { "snd.23", 0x2000, 0x25e7fd9d, 2 }, // 4 + + { "vid-a45.18", 0x4000, 0x6f08f69e, 3 }, // 5 gfx1 + { "vid-a45.06", 0x4000, 0xdc856a75, 3 }, // 6 + { "vid-a45.08", 0x4000, 0xd0b028ca, 3 }, // 7 + { "vid-a45.20", 0x4000, 0x1b0edf34, 3 }, // 8 + { "vid-a45.19", 0x4000, 0x2b572dc9, 3 }, // 9 + { "vid-a45.07", 0x4000, 0xaa4b0762, 3 }, // 10 + { "vid-a45.09", 0x4000, 0x8336be58, 3 }, // 11 + { "vid-a45.21", 0x4000, 0xfc382bd1, 3 }, // 12 + + { "a45.mcu", 0x0800, 0x5378253c, 4 }, // 13 mcu +}; + +STD_ROM_PICK(flstory) +STD_ROM_FN(flstory) + +static INT32 flstoryInit() +{ + select_game = 0; + + return DrvInit(); +} + +struct BurnDriver BurnDrvFlstory = { + "flstory", NULL, NULL, NULL, "1985", + "The FairyLand Story\0", NULL, "Taito", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, flstoryRomInfo, flstoryRomName, NULL, NULL, FlstoryInputInfo, FlstoryDIPInfo, + flstoryInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// The FairyLand Story (Japan) + +static struct BurnRomInfo flstoryjRomDesc[] = { + { "cpu-a45.15", 0x4000, 0xf03fc969, 1 }, // 0 maincpu + { "cpu-a45.16", 0x4000, 0x311aa82e, 1 }, // 1 + { "cpu-a45.17", 0x4000, 0xa2b5d17d, 1 }, // 2 + + { "a45_12.8", 0x2000, 0xd6f593fb, 2 }, // 3 audiocpu + { "a45_13.9", 0x2000, 0x451f92f9, 2 }, // 4 + + { "vid-a45.18", 0x4000, 0x6f08f69e, 3 }, // 5 gfx1 + { "vid-a45.06", 0x4000, 0xdc856a75, 3 }, // 6 + { "vid-a45.08", 0x4000, 0xd0b028ca, 3 }, // 7 + { "vid-a45.20", 0x4000, 0x1b0edf34, 3 }, // 8 + { "vid-a45.19", 0x4000, 0x2b572dc9, 3 }, // 9 + { "vid-a45.07", 0x4000, 0xaa4b0762, 3 }, // 10 + { "vid-a45.09", 0x4000, 0x8336be58, 3 }, // 11 + { "vid-a45.21", 0x4000, 0xfc382bd1, 3 }, // 12 + + { "a45.mcu", 0x0800, 0x5378253c, 4 }, // 13 mcu +}; + +STD_ROM_PICK(flstoryj) +STD_ROM_FN(flstoryj) + +struct BurnDriver BurnDrvFlstoryj = { + "flstoryj", "flstory", NULL, NULL, "1985", + "The FairyLand Story (Japan)\0", NULL, "Taito", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, flstoryjRomInfo, flstoryjRomName, NULL, NULL, FlstoryInputInfo, FlstoryDIPInfo, + flstoryInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Onna Sansirou - Typhoon Gal (set 1) + +static struct BurnRomInfo onna34roRomDesc[] = { + { "a52-01-1.40c", 0x4000, 0xffddcb02, 1 }, // 0 maincpu + { "a52-02-1.41c", 0x4000, 0xda97150d, 1 }, // 1 + { "a52-03-1.42c", 0x4000, 0xb9749a53, 1 }, // 2 + + { "a52-12.08s", 0x2000, 0x28f48096, 2 }, // 3 audiocpu + { "a52-13.09s", 0x2000, 0x4d3b16f3, 2 }, // 4 + { "a52-14.10s", 0x2000, 0x90a6f4e8, 2 }, // 5 + { "a52-15.37s", 0x2000, 0x5afc21d0, 2 }, // 6 + { "a52-16.38s", 0x2000, 0xccf42aee, 2 }, // 7 + + { "a52-04.11v", 0x4000, 0x5b126294, 3 }, // 8 gfx1 + { "a52-06.10v", 0x4000, 0x78114721, 3 }, // 9 + { "a52-08.09v", 0x4000, 0x4a293745, 3 }, // 10 + { "a52-10.08v", 0x4000, 0x8be7b4db, 3 }, // 11 + { "a52-05.35v", 0x4000, 0xa1a99588, 3 }, // 12 + { "a52-07.34v", 0x4000, 0x0bf420f2, 3 }, // 13 + { "a52-09.33v", 0x4000, 0x39c543b5, 3 }, // 14 + { "a52-11.32v", 0x4000, 0xd1dda6b3, 3 }, // 15 + + { "a52-17.54c", 0x0800, 0x00000000, 4 | BRF_NODUMP }, // 16 cpu2 +}; + +STD_ROM_PICK(onna34ro) +STD_ROM_FN(onna34ro) + +static INT32 onna34roInit() +{ + select_game = 1; + + return DrvInit(); +} + +struct BurnDriver BurnDrvOnna34ro = { + "onna34ro", NULL, NULL, NULL, "1985", + "Onna Sansirou - Typhoon Gal (set 1)\0", NULL, "Taito", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, onna34roRomInfo, onna34roRomName, NULL, NULL, Onna34roInputInfo, Onna34roDIPInfo, + onna34roInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Onna Sansirou - Typhoon Gal (set 2) + +static struct BurnRomInfo onna34raRomDesc[] = { + { "ry-08.rom", 0x4000, 0xe4587b85, 1 }, // 0 maincpu + { "ry-07.rom", 0x4000, 0x6ffda515, 1 }, // 1 + { "ry-06.rom", 0x4000, 0x6fefcda8, 1 }, // 2 + + { "a52-12.08s", 0x2000, 0x28f48096, 2 }, // 3 audiocpu + { "a52-13.09s", 0x2000, 0x4d3b16f3, 2 }, // 4 + { "a52-14.10s", 0x2000, 0x90a6f4e8, 2 }, // 5 + { "a52-15.37s", 0x2000, 0x5afc21d0, 2 }, // 6 + { "a52-16.38s", 0x2000, 0xccf42aee, 2 }, // 7 + + { "a52-04.11v", 0x4000, 0x5b126294, 3 }, // 8 gfx1 + { "a52-06.10v", 0x4000, 0x78114721, 3 }, // 9 + { "a52-08.09v", 0x4000, 0x4a293745, 3 }, // 10 + { "a52-10.08v", 0x4000, 0x8be7b4db, 3 }, // 11 + { "a52-05.35v", 0x4000, 0xa1a99588, 3 }, // 12 + { "a52-07.34v", 0x4000, 0x0bf420f2, 3 }, // 13 + { "a52-09.33v", 0x4000, 0x39c543b5, 3 }, // 14 + { "a52-11.32v", 0x4000, 0xd1dda6b3, 3 }, // 15 + + { "a52-17.54c", 0x0800, 0x00000000, 4 | BRF_NODUMP }, // 16 cpu2 +}; + +STD_ROM_PICK(onna34ra) +STD_ROM_FN(onna34ra) + +struct BurnDriver BurnDrvOnna34ra = { + "onna34roa", "onna34ro", NULL, NULL, "1985", + "Onna Sansirou - Typhoon Gal (set 2)\0", NULL, "Taito", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, onna34raRomInfo, onna34raRomName, NULL, NULL, Onna34roInputInfo, Onna34roDIPInfo, + onna34roInit, DrvExit, DrvFrame, DrvDraw, NULL, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Victorious Nine + +static struct BurnRomInfo victnineRomDesc[] = { + { "a16-19.1", 0x2000, 0xdeb7c439, 1 }, // 0 maincpu + { "a16-20.2", 0x2000, 0x60cdb6ae, 1 }, // 1 + { "a16-21.3", 0x2000, 0x121bea03, 1 }, // 2 + { "a16-22.4", 0x2000, 0xb20e3027, 1 }, // 3 + { "a16-23.5", 0x2000, 0x95fe9cb7, 1 }, // 4 + { "a16-24.6", 0x2000, 0x32b5c155, 1 }, // 5 + + { "a16-12.8", 0x2000, 0x4b9bff43, 2 }, // 6 audiocpu + { "a16-13.9", 0x2000, 0x355121b9, 2 }, // 7 + { "a16-14.10", 0x2000, 0x0f33ef4d, 2 }, // 8 + { "a16-15.37", 0x2000, 0xf91d63dc, 2 }, // 9 + { "a16-16.38", 0x2000, 0x9395351b, 2 }, // 10 + { "a16-17.39", 0x2000, 0x872270b3, 2 }, // 11 + + { "a16-06-1.7", 0x2000, 0xb708134d, 3 }, // 12 gfx1 + { "a16-07-2.8", 0x2000, 0xcdaf7f83, 3 }, // 13 + { "a16-10.90", 0x2000, 0xe8e42454, 3 }, // 14 + { "a16-11-1.91", 0x2000, 0x1f766661, 3 }, // 15 + { "a16-04.5", 0x2000, 0xb2fae99f, 3 }, // 16 + { "a16-05-1.6", 0x2000, 0x85dfbb6e, 3 }, // 17 + { "a16-08.88", 0x2000, 0x1ddb6466, 3 }, // 18 + { "a16-09-1.89", 0x2000, 0x23d4c43c, 3 }, // 19 + + { "a16-18.mcu", 0x0800, 0x00000000, 4 | BRF_NODUMP }, // 20 cpu2 +}; + +STD_ROM_PICK(victnine) +STD_ROM_FN(victnine) + +static INT32 victnineInit() +{ + select_game = 2; + + INT32 nRet = DrvInit(); + + AY8910SetAllRoutes(0, 0.50, BURN_SND_ROUTE_BOTH); + + return nRet; +} + +struct BurnDriverD BurnDrvVictnine = { + "victnine", NULL, NULL, NULL, "1984", + "Victorious Nine\0", NULL, "Taito", "Miscellaneous", + NULL, NULL, NULL, NULL, + 0, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, victnineRomInfo, victnineRomName, NULL, NULL, VictnineInputInfo, VictnineDIPInfo, + victnineInit, DrvExit, DrvFrame, victnineDraw, NULL, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + diff --git a/src/burn/drv/taito/d_lkage.cpp b/src/burn/drv/taito/d_lkage.cpp index 3cc613010..74afe1dae 100644 --- a/src/burn/drv/taito/d_lkage.cpp +++ b/src/burn/drv/taito/d_lkage.cpp @@ -1,1187 +1,1185 @@ -// FB Alpha Legend of Kage driver Module -// Based on MAME driver by Phil Stroffolino - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "taito_m68705.h" -#include "burn_ym2203.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvPortData; -static UINT8 *DrvMcuROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvMcuRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvUnkRAM; -static UINT8 *lkage_scroll; -static UINT8 *DrvVidReg; -static UINT32 *DrvPalette; -static UINT32 *Palette; -static UINT8 DrvRecalc; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvInps[3]; -static UINT8 DrvDips[3]; -static UINT8 DrvReset; - -static UINT8 flipscreen_x; -static UINT8 flipscreen_y; -static UINT8 soundlatch; - -static INT32 DrvNmiEnable; -static INT32 pending_nmi; - -static INT32 use_mcu; -static INT32 Lkageb; -static INT32 FakeMCUVal; - -static struct BurnInputInfo LkageInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy2 + 5, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy2 + 4, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy3 + 5, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy3 + 4, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service"}, - {"Tilt", BIT_DIGITAL, DrvJoy1 + 3, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Lkage) - -static struct BurnDIPInfo LkageDIPList[]= -{ - {0x13, 0xff, 0xff, 0x7f, NULL }, - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0xfe, NULL }, - - {0 , 0xfe, 0 , 4, "Bonus_Life" }, - {0x13, 0x01, 0x03, 0x03, "30000 100000" }, - {0x13, 0x01, 0x03, 0x02, "30000 70000" }, - {0x13, 0x01, 0x03, 0x01, "20000 70000" }, - {0x13, 0x01, 0x03, 0x00, "20000 50000" }, - - {0 , 0xfe, 0 , 2, "Free_Play" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x18, 0x18, "3" }, - {0x13, 0x01, 0x18, 0x10, "4" }, - {0x13, 0x01, 0x18, 0x08, "5" }, - {0x13, 0x01, 0x18, 0x00, "255 (Cheat)" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x40, 0x40, "Off" }, - {0x13, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x80, 0x00, "Upright" }, - {0x13, 0x01, 0x80, 0x80, "Cocktail" }, - - {0 , 0xfe, 0 , 16, "Coin_A" }, - {0x14, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x14, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, - {0x14, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin_B" }, - {0x14, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, - {0x14, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, - {0x14, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x14, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, - {0x14, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x01, 0x01, "Off" }, - {0x15, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Initial Season" }, - {0x15, 0x01, 0x02, 0x02, "Spring" }, - {0x15, 0x01, 0x02, 0x00, "Winter" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x0c, 0x0c, "Easiest" }, - {0x15, 0x01, 0x0c, 0x08, "Easy" }, - {0x15, 0x01, 0x0c, 0x04, "Normal" }, - {0x15, 0x01, 0x0c, 0x00, "Hard" }, - - {0 , 0xfe, 0 , 2, "Coinage Display" }, - {0x15, 0x01, 0x10, 0x10, "Coins/Credits" }, - {0x15, 0x01, 0x10, 0x00, "Insert Coin" }, - - {0 , 0xfe, 0 , 2, "Year Display" }, - {0x15, 0x01, 0x20, 0x00, "1985" }, - {0x15, 0x01, 0x20, 0x20, "MCMLXXXIV" }, - - {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)" }, - {0x15, 0x01, 0x40, 0x40, "Off" }, - {0x15, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Slots" }, - {0x15, 0x01, 0x80, 0x80, "A and B" }, - {0x15, 0x01, 0x80, 0x00, "A only" }, -}; - -STDDIPINFO(Lkage) - -static struct BurnDIPInfo BygoneDIPList[]= -{ - {0x13, 0xff, 0xff, 0x3c, NULL }, - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0x40, NULL }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x13, 0x01, 0x18, 0x18, "3" }, - {0x13, 0x01, 0x18, 0x10, "4" }, - {0x13, 0x01, 0x18, 0x08, "5" }, - {0x13, 0x01, 0x18, 0x00, "255 (Cheat)" }, - - {0 , 0xfe, 0 , 0, "Flip Screen" }, - {0x13, 0x01, 0x40, 0x00, "Off" }, - {0x13, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x80, 0x00, "Upright" }, - {0x13, 0x01, 0x80, 0x80, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Coin A" }, - {0x14, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, - {0x14, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, - {0x14, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, - {0x14, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x14, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, - {0x14, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x14, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, - {0x14, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x14, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, - {0x14, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, - {0x14, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, - {0x14, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x14, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, - {0x14, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)" }, - {0x15, 0x01, 0x40, 0x40, "Off" }, - {0x15, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(Bygone) - -void __fastcall lkage_main_write(UINT16 address, UINT8 data) -{ - if ((address & 0xf800) == 0xe800) { - - DrvPalRAM[address & 0x7ff] = data; - - UINT16 col = (DrvPalRAM[(address & 0x7fe) | 1] << 8) | DrvPalRAM[(address & 0x7fe) | 0]; - - UINT8 r, g, b; - - r = (col >> 8) & 0x0f; - r |= r << 4; - - g = (col >> 4) & 0x0f; - g |= g << 4; - - b = (col >> 0) & 0x0f; - b |= b << 4; - - Palette[(address & 0x7ff) >> 1] = (r << 16) | (g << 8) | b; - DrvPalette[(address & 0x7ff) >> 1] = BurnHighCol(r, g, b, 0); - - return; - } - - switch (address) - { - case 0xf000: - case 0xf001: - case 0xf002: - case 0xf003: - DrvVidReg[address & 3] = data; - return; - - case 0xf060: - soundlatch = data; - if (DrvNmiEnable) { - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - } else { - pending_nmi = 1; - } - return; - - case 0xf061: - case 0xf063: - case 0xf0e1: - return; - - case 0xf062: { - if (Lkageb) { - FakeMCUVal = data; - } else { - standard_taito_mcu_write(data); - } - return; - } - - case 0xf0a0: - case 0xf0a1: - case 0xf0a2: - case 0xf0a3: - DrvUnkRAM[address & 3] = data; - return; - - case 0xf0c0: - case 0xf0c1: - case 0xf0c2: - case 0xf0c3: - case 0xf0c4: - case 0xf0c5: - lkage_scroll[address & 7] = data; - return; - } -} - -UINT8 __fastcall lkage_main_read(UINT16 address) -{ - switch (address) - { - case 0xf000: - case 0xf001: - case 0xf002: - case 0xf003: - return DrvVidReg[address & 3]; - - case 0xf061: - return 0xff; // sound status - - case 0xf062: { - if (Lkageb) { - switch (FakeMCUVal) { - case 0x01: return FakeMCUVal - 0x01; - case 0x90: return FakeMCUVal + 0x43; - case 0xa6: return FakeMCUVal + 0x27; - case 0x34: return FakeMCUVal + 0x7f; - case 0x48: return FakeMCUVal + 0xb7; - default: return FakeMCUVal; - } - } else { - return standard_taito_mcu_read(); - } - } - - case 0xf080: - case 0xf081: - case 0xf082: - return DrvDips[address & 3]; - - case 0xf083: - return DrvInps[0]; - - case 0xf084: - case 0xf085: - return DrvInps[address - 0xf083]; - - case 0xf087: { - if (Lkageb) { - return 0x03; - } else { - INT32 res = 0; - if (!main_sent) res |= 0x01; - if (mcu_sent) res |= 0x02; - return res; - } - } - - case 0xf0a0: - case 0xf0a1: - case 0xf0a2: - case 0xf0a3: - return DrvUnkRAM[address & 3]; - - case 0xf0c0: - case 0xf0c1: - case 0xf0c2: - case 0xf0c3: - case 0xf0c4: - case 0xf0c5: - return lkage_scroll[address & 7]; - } - - return 0; -} - -UINT8 __fastcall lkage_main_in(UINT16 port) -{ - if ((port & 0xc000) == 0x4000) { - return DrvPortData[port & 0x3fff]; - } - - return 0; -} - -UINT8 __fastcall lkage_sound_read(UINT16 address) -{ - switch (address) - { - case 0x9000: - return BurnYM2203Read(0, 0); - - case 0xa000: - return BurnYM2203Read(1, 0); - - case 0xb000: - return soundlatch; - - case 0xb001: - return 0; - } - - return 0; -} - -void __fastcall lkage_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x9000: - case 0x9001: - BurnYM2203Write(0, address & 1, data); - return; - - case 0xa000: - case 0xa001: - BurnYM2203Write(1, address & 1, data); - return; - - case 0xb000: - return; - - case 0xb001: - { - DrvNmiEnable = 1; - if (pending_nmi) { - ZetNmi(); - pending_nmi = 0; - } - } - return; - - case 0xb002: - DrvNmiEnable = 0; - return; - } -} - -inline static void DrvYM2203IRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 6000000; -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 6000000.0; -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - - for (INT32 i = 0; i < 2; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - m67805_taito_reset(); - - BurnYM2203Reset(); - - soundlatch = 0; - flipscreen_x = 0; - flipscreen_y = 0; - - DrvNmiEnable = 0; - pending_nmi = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x010000; - DrvZ80ROM1 = Next; Next += 0x010000; - - DrvMcuROM = Next; Next += 0x000800; - - DrvPortData = Next; Next += 0x004000; - - DrvGfxROM0 = Next; Next += 0x020000; - DrvGfxROM1 = Next; Next += 0x020000; - - DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); - - AllRam = Next; - - DrvVidRAM = Next; Next += 0x000c00; - - DrvZ80RAM0 = Next; Next += 0x000800; - DrvZ80RAM1 = Next; Next += 0x000800; - - DrvPalRAM = Next; Next += 0x000800; - DrvSprRAM = Next; Next += 0x000100; - - DrvUnkRAM = Next; Next += 0x000004; - - DrvMcuRAM = Next; Next += 0x000080; - - lkage_scroll = Next; Next += 0x000006; - DrvVidReg = Next; Next += 0x000004; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane[4] = { 0x20000, 0x00000, 0x60000, 0x40000 }; - INT32 XOffs[16] = { 7, 6, 5, 4, 3, 2, 1, 0, - 64+7, 64+6, 64+5, 64+4, 64+3, 64+2, 64+1, 64+0}; - INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 128+0*8, 128+1*8, 128+2*8, 128+3*8, 128+4*8, 128+5*8, 128+6*8, 128+7*8 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x10000); - - GfxDecode(0x800, 4, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); - GfxDecode(0x200, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); - - BurnFree (tmp); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - use_mcu = ~BurnDrvGetFlags() & BDF_BOOTLEG; - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x0000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x8000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x0000, 2, 1)) return 1; - - if (BurnLoadRom(DrvPortData, 3, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x0000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x4000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0x8000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM0 + 0xc000, 7, 1)) return 1; - - if (use_mcu) { - if (BurnLoadRom(DrvMcuROM + 0x0000, 9, 1)) return 1; - } - - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0xdfff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0xdfff, 2, DrvZ80ROM0); - ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM0); - ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM0); - ZetMapArea(0xe800, 0xefff, 0, DrvPalRAM); -// ZetMapArea(0xe800, 0xefff, 1, DrvPalRAM); - ZetMapArea(0xe800, 0xefff, 2, DrvPalRAM); - ZetMapArea(0xf100, 0xf1ff, 0, DrvSprRAM); // 0xf100 - 0xf15f - ZetMapArea(0xf100, 0xf1ff, 1, DrvSprRAM); - ZetMapArea(0xf100, 0xf1ff, 2, DrvSprRAM); - ZetMapArea(0xf400, 0xffff, 0, DrvVidRAM); - ZetMapArea(0xf400, 0xffff, 1, DrvVidRAM); - ZetMapArea(0xf400, 0xffff, 2, DrvVidRAM); - ZetSetWriteHandler(lkage_main_write); - ZetSetReadHandler(lkage_main_read); - ZetSetInHandler(lkage_main_in); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); - ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); - //ZetMapArea(0xe000, 0xefff, 0, DrvZ80ROM1 + 0xe000); - //ZetMapArea(0xe000, 0xefff, 2, DrvZ80ROM1 + 0xe000); - ZetSetWriteHandler(lkage_sound_write); - ZetSetReadHandler(lkage_sound_read); - ZetMemEnd(); - ZetClose(); - - m67805_taito_init(DrvMcuROM, DrvMcuRAM, &standard_m68705_interface); - - BurnYM2203Init(2, 4000000, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(6000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.40, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - - DrvDoReset(); - - GenericTilesInit(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - m67805_taito_exit(); - - BurnYM2203Exit(); - - BurnFree (AllMem); - - Lkageb = 0; - FakeMCUVal = 0; - - return 0; -} - - -static void draw_sprites(INT32 prio) -{ - INT32 dx = (strcmp ("bygone", BurnDrvGetTextA(DRV_NAME)) == 0) ? 1 : 0; - - const UINT8 *source = DrvSprRAM + 0x60 - 4; - const UINT8 *finish = DrvSprRAM; - - while (source >= finish) - { - INT32 attributes = source[2]; - INT32 priority = attributes >> 7; - if (priority != prio) { - source -= 4; - continue; - } - - INT32 color = (attributes>>4)&7; - INT32 flipx = attributes & 0x01; - INT32 flipy = attributes & 0x02; - INT32 height = (attributes & 0x08) ? 2 : 1; - INT32 sx = source[0]-15+dx; - INT32 sy = 256-16*height-source[1]; - INT32 sprite_number = source[3] + ((attributes & 0x04) << 6); - INT32 y; - - if (flipscreen_x) - { - sx = 239 - sx - 24; - flipx = !flipx; - sx += 16; - } - if (flipscreen_y) - { - sy = 254 - 16*height - sy; - flipy = !flipy; - } - if (height == 2 && !flipy) - { - sprite_number ^= 1; - } - - sx -= 16; - sy -= 16; - - if (sx < -15) sx += 256; - - for (y = 0;y < height;y++) - { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sprite_number ^ y, sx, sy + (y << 4), color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sprite_number ^ y, sx, sy + (y << 4), color, 4, 0, 0, DrvGfxROM1); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sprite_number ^ y, sx, sy + (y << 4), color, 4, 0, 0, DrvGfxROM1); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, sprite_number ^ y, sx, sy + (y << 4), color, 4, 0, 0, DrvGfxROM1); - } - } - } - source -= 4; - } -} - -static void draw_layer(INT32 offset, INT32 bank, INT32 color, INT32 transp, INT32 scrollx, INT32 scrolly) -{ - color >>= 4; - - if (flipscreen_x) { - scrollx *= -1; - } - - if (flipscreen_y) { - scrolly *= -1; - } - - UINT8 *src = DrvVidRAM + offset; - - INT32 x_minus = flipscreen_x ? 24 : 16; - - for (INT32 offs = 0; offs < 0x400; offs++) - { - INT32 code = src[offs] | (bank << 8); - - INT32 sx = (offs & 0x1f) << 3; - INT32 sy = (offs >> 5) << 3; - - if (flipscreen_x) sx ^= 0xf8; - if (flipscreen_y) sy ^= 0xf8; - - sx -= scrollx; - sy -= scrolly; - - sx -= x_minus; - sy -= 16; - - if (sx < -7) sx += 256; - if (sy < -15) sy += 256; - if (sx > 239) sx -= 256; - if (sy > 223) sy -= 256; - - if (transp) { - if (flipscreen_y) { - if (flipscreen_x) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } - } else { - if (flipscreen_x) { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); - } - } - } else { - if (flipscreen_y) { - if (flipscreen_x) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } else { - Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } - } else { - if (flipscreen_x) { - Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); - } - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0x400; i++) { - INT32 rgb = Palette[i]; - DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); - } - DrvRecalc = 0; - } - - flipscreen_x = ~DrvVidReg[2] & 0x01; - flipscreen_y = ~DrvVidReg[2] & 0x02; - - INT32 color_bank = (DrvVidReg[1] & 0xf0); - INT32 bg_bank = ((DrvVidReg[1] & 0x08) >> 1) + 1; - INT32 fg_bank = (DrvVidReg[0] & 0x04) >> 2; - INT32 tx_bank = (DrvVidReg[0] & 0x02) << 1; // bygone - -// if ((DrvVidReg[2] & 0xf0) == 0xf0) // mame - if ((DrvVidReg[2] & 0x0f) == 0x03) // Correct? Seems to give proper results in bygone... - { - draw_layer(0x800, bg_bank, 0x300 | color_bank, 0, lkage_scroll[4]+5, lkage_scroll[5]); - - draw_sprites(1); - - if (~DrvVidReg[1] & 2) draw_sprites(0); - - draw_layer(0x400, fg_bank, 0x200 | color_bank, 1, lkage_scroll[2]+3, lkage_scroll[3]); - - if ( DrvVidReg[1] & 2) draw_sprites(0); - - draw_layer(0x000, tx_bank, 0x110, 1, lkage_scroll[0]+1, lkage_scroll[1]); - } - else - { - if (nBurnLayer & 4)draw_layer(0x000, 0, 0x110, 0, lkage_scroll[0]+1, lkage_scroll[1]); - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - DrvInps[0] = 0x0b; - DrvInps[1] = DrvInps[2] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - DrvInps[0] ^= (DrvJoy1[i] & 1) << i; - DrvInps[1] ^= (DrvJoy2[i] & 1) << i; - DrvInps[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - INT32 nInterleave = 100; - INT32 nCyclesTotal[3] = { 6000000 / 60, 6000000 / 60, 4000000 / 60 }; - INT32 nCyclesDone[3] = { 0, 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext, nCyclesSegment; - - // Run Z80 #1 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == 99) ZetRaiseIrq(0); - ZetClose(); - - // Run Z80 #2 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); - ZetClose(); - - if (use_mcu) { - m6805Open(0); - nCyclesSegment = nCyclesTotal[2] / nInterleave; - nCyclesDone[2] += m6805Run(nCyclesSegment); - m6805Close(); - } - } - - ZetOpen(1); - BurnTimerEndFrame(nCyclesTotal[1]); - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029697; - } - - if (nAction & ACB_VOLATILE) { - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All RAM"; - BurnAcb(&ba); - - ZetScan(nAction); - BurnYM2203Scan(nAction, pnMin); - - SCAN_VAR(soundlatch); - SCAN_VAR(flipscreen_x); - SCAN_VAR(flipscreen_y); - SCAN_VAR(DrvNmiEnable); - SCAN_VAR(pending_nmi); - - DrvRecalc = 1; - } - - return 0; -} - - -// The Legend of Kage - -static struct BurnRomInfo lkageRomDesc[] = { - { "a54-01-2.37", 0x8000, 0x60fd9734, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "a54-02-2.38", 0x8000, 0x878a25ce, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data - - { "a54-05-1.84", 0x4000, 0x0033c06a, 4 | BRF_GRA }, // 4 Graphics - { "a54-06-1.85", 0x4000, 0x9f04d9ad, 4 | BRF_GRA }, // 5 - { "a54-07-1.86", 0x4000, 0xb20561a4, 4 | BRF_GRA }, // 6 - { "a54-08-1.87", 0x4000, 0x3ff3b230, 4 | BRF_GRA }, // 7 - - { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) - - { "a54-09.53", 0x0800, 0x0e8b8846, 6 | BRF_PRG | BRF_OPT }, // 9 68705 Code - - { "pal16l8-a54-11.34", 0x0104, 0x56232113, 7 | BRF_OPT }, // 10 Plds (unused) - { "pal16l8-a54-12.76", 0x0104, 0xe57c3c89, 7 | BRF_OPT }, // 11 - { "pal16l8a-a54-13.27", 0x0104, 0xc9b1938e, 7 | BRF_OPT }, // 12 - { "pal16l8a-a54-14.35", 0x0104, 0xa89c644e, 7 | BRF_OPT }, // 13 -}; - -STD_ROM_PICK(lkage) -STD_ROM_FN(lkage) - -struct BurnDriver BurnDrvLkage = { - "lkage", NULL, NULL, NULL, "1984", - "The Legend of Kage\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, lkageRomInfo, lkageRomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 224, 4, 3 -}; - - -// The Legend of Kage (older) - -static struct BurnRomInfo lkageoRomDesc[] = { - { "a54-01-1.37", 0x8000, 0x973da9c5, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "a54-02-1.38", 0x8000, 0x27b509da, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data - - { "a54-05-1.84", 0x4000, 0x0033c06a, 4 | BRF_GRA }, // 4 Graphics - { "a54-06-1.85", 0x4000, 0x9f04d9ad, 4 | BRF_GRA }, // 5 - { "a54-07-1.86", 0x4000, 0xb20561a4, 4 | BRF_GRA }, // 6 - { "a54-08-1.87", 0x4000, 0x3ff3b230, 4 | BRF_GRA }, // 7 - - { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) - - { "a54-09.53", 0x0800, 0x0e8b8846, 6 | BRF_PRG | BRF_OPT }, // 9 68705 Code - - { "pal16l8-a54-11.34", 0x0104, 0x56232113, 7 | BRF_OPT }, // 10 Plds (unused) - { "pal16l8-a54-12.76", 0x0104, 0xe57c3c89, 7 | BRF_OPT }, // 11 - { "pal16l8a-a54-13.27", 0x0104, 0xc9b1938e, 7 | BRF_OPT }, // 12 - { "pal16l8a-a54-14.35", 0x0104, 0xa89c644e, 7 | BRF_OPT }, // 13 -}; - -STD_ROM_PICK(lkageo) -STD_ROM_FN(lkageo) - -struct BurnDriver BurnDrvLkageo = { - "lkageo", "lkage", NULL, NULL, "1984", - "The Legend of Kage (older)\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, lkageoRomInfo, lkageoRomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 224, 4, 3 -}; - - -// The Legend of Kage (oldest) - -static struct BurnRomInfo lkageooRomDesc[] = { - { "a54-01.37", 0x8000, 0x34eab2c5, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "a54-02.38", 0x8000, 0xea471d8a, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data - - { "a54-05.84", 0x4000, 0x76753e52, 4 | BRF_GRA }, // 4 Graphics - { "a54-06.85", 0x4000, 0xf33c015c, 4 | BRF_GRA }, // 5 - { "a54-07.86", 0x4000, 0x0e02c2e8, 4 | BRF_GRA }, // 6 - { "a54-08.87", 0x4000, 0x4ef5f073, 4 | BRF_GRA }, // 7 - - { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) - - { "a54-09.53", 0x0800, 0x0e8b8846, 6 | BRF_PRG | BRF_OPT }, // 9 68705 Code - - { "pal16l8-a54-11.34", 0x0104, 0x56232113, 7 | BRF_OPT }, // 10 Plds (unused) - { "pal16l8-a54-12.76", 0x0104, 0xe57c3c89, 7 | BRF_OPT }, // 11 - { "pal16l8a-a54-13.27", 0x0104, 0xc9b1938e, 7 | BRF_OPT }, // 12 - { "pal16l8a-a54-14.35", 0x0104, 0xa89c644e, 7 | BRF_OPT }, // 13 -}; - -STD_ROM_PICK(lkageoo) -STD_ROM_FN(lkageoo) - -struct BurnDriver BurnDrvLkageoo = { - "lkageoo", "lkage", NULL, NULL, "1984", - "The Legend of Kage (oldest)\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, lkageooRomInfo, lkageooRomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 224, 4, 3 -}; - - -// The Legend of Kage (bootleg set 1) - -static struct BurnRomInfo lkagebRomDesc[] = { - { "ic37_1", 0x8000, 0x05694f7b, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "ic38_2", 0x8000, 0x22efe29e, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data - - { "ic93_5", 0x4000, 0x76753e52, 4 | BRF_GRA }, // 4 Graphics - { "ic94_6", 0x4000, 0xf33c015c, 4 | BRF_GRA }, // 5 - { "ic95_7", 0x4000, 0x0e02c2e8, 4 | BRF_GRA }, // 6 - { "ic96_8", 0x4000, 0x4ef5f073, 4 | BRF_GRA }, // 7 - - { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) -}; - -STD_ROM_PICK(lkageb) -STD_ROM_FN(lkageb) - -static INT32 LkagebInit() -{ - Lkageb = 1; - - return DrvInit(); -} - -struct BurnDriver BurnDrvLkageb = { - "lkageb", "lkage", NULL, NULL, "1984", - "The Legend of Kage (bootleg set 1)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, lkagebRomInfo, lkagebRomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, - LkagebInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 224, 4, 3 -}; - - -// The Legend of Kage (bootleg set 2) - -static struct BurnRomInfo lkageb2RomDesc[] = { - { "lok.a", 0x8000, 0x866df793, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "lok.b", 0x8000, 0xfba9400f, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data - - { "ic93_5", 0x4000, 0x76753e52, 4 | BRF_GRA }, // 4 Graphics - { "ic94_6", 0x4000, 0xf33c015c, 4 | BRF_GRA }, // 5 - { "ic95_7", 0x4000, 0x0e02c2e8, 4 | BRF_GRA }, // 6 - { "ic96_8", 0x4000, 0x4ef5f073, 4 | BRF_GRA }, // 7 - - { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) -}; - -STD_ROM_PICK(lkageb2) -STD_ROM_FN(lkageb2) - -struct BurnDriver BurnDrvLkageb2 = { - "lkageb2", "lkage", NULL, NULL, "1984", - "The Legend of Kage (bootleg set 2)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, lkageb2RomInfo, lkageb2RomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 224, 4, 3 -}; - - -// The Legend of Kage (bootleg set 3) - -static struct BurnRomInfo lkageb3RomDesc[] = { - { "z1.bin", 0x8000, 0x60cac488, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "z2.bin", 0x8000, 0x22c95f17, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data - - { "ic93_5", 0x4000, 0x76753e52, 4 | BRF_GRA }, // 4 Graphics - { "ic94_6", 0x4000, 0xf33c015c, 4 | BRF_GRA }, // 5 - { "ic95_7", 0x4000, 0x0e02c2e8, 4 | BRF_GRA }, // 6 - { "ic96_8", 0x4000, 0x4ef5f073, 4 | BRF_GRA }, // 7 - - { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) -}; - -STD_ROM_PICK(lkageb3) -STD_ROM_FN(lkageb3) - -struct BurnDriver BurnDrvLkageb3 = { - "lkageb3", "lkage", NULL, NULL, "1984", - "The Legend of Kage (bootleg set 3)\0", NULL, "bootleg", "hardware", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, lkageb3RomInfo, lkageb3RomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 224, 4, 3 -}; - - -// Bygone - -static struct BurnRomInfo bygoneRomDesc[] = { - { "a53_05.ic37", 0x8000, 0x63a3f08b, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "a53_06.ic38", 0x8000, 0xcb0dcb08, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "a53_07.ic54", 0x8000, 0x72f69a77, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "a53_08.ic51", 0x4000, 0xf85139f9, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data - - { "a53_01.ic84", 0x4000, 0x38cf7fb2, 4 | BRF_GRA }, // 4 Graphics - { "a53_02.ic85", 0x4000, 0xdca7adfe, 4 | BRF_GRA }, // 5 - { "a53_03.ic86", 0x4000, 0xaf3eb997, 4 | BRF_GRA }, // 6 - { "a53_04.ic87", 0x4000, 0x65af72d3, 4 | BRF_GRA }, // 7 - - { "a54-10.ic2", 0x0400, 0x369722d9, 5 | BRF_OPT }, // 8 Prom (unused) - - { "a51_09.ic53", 0x0800, 0x0e8b8846, 6 | BRF_PRG | BRF_OPT }, // 9 68705 Code -}; - -STD_ROM_PICK(bygone) -STD_ROM_FN(bygone) - -struct BurnDriver BurnDrvBygone = { - "bygone", NULL, NULL, NULL, "1985", - "Bygone\0", "Imperfect sound", "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, - NULL, bygoneRomInfo, bygoneRomName, NULL, NULL, LkageInputInfo, BygoneDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, - 240, 224, 4, 3 -}; +// FB Alpha Legend of Kage driver Module +// Based on MAME driver by Phil Stroffolino + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "taito_m68705.h" +#include "burn_ym2203.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvPortData; +static UINT8 *DrvMcuROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvMcuRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvUnkRAM; +static UINT8 *lkage_scroll; +static UINT8 *DrvVidReg; +static UINT32 *DrvPalette; +static UINT32 *Palette; +static UINT8 DrvRecalc; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvInps[3]; +static UINT8 DrvDips[3]; +static UINT8 DrvReset; + +static UINT8 flipscreen_x; +static UINT8 flipscreen_y; +static UINT8 soundlatch; + +static INT32 DrvNmiEnable; +static INT32 pending_nmi; + +static INT32 use_mcu; +static INT32 Lkageb; +static INT32 FakeMCUVal; + +static struct BurnInputInfo LkageInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy2 + 5, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy2 + 4, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 1, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy3 + 5, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy3 + 4, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy3 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy3 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service"}, + {"Tilt", BIT_DIGITAL, DrvJoy1 + 3, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Lkage) + +static struct BurnDIPInfo LkageDIPList[]= +{ + {0x13, 0xff, 0xff, 0x7f, NULL }, + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0xfe, NULL }, + + {0 , 0xfe, 0 , 4, "Bonus_Life" }, + {0x13, 0x01, 0x03, 0x03, "30000 100000" }, + {0x13, 0x01, 0x03, 0x02, "30000 70000" }, + {0x13, 0x01, 0x03, 0x01, "20000 70000" }, + {0x13, 0x01, 0x03, 0x00, "20000 50000" }, + + {0 , 0xfe, 0 , 2, "Free_Play" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x18, 0x18, "3" }, + {0x13, 0x01, 0x18, 0x10, "4" }, + {0x13, 0x01, 0x18, 0x08, "5" }, + {0x13, 0x01, 0x18, 0x00, "255 (Cheat)" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x40, 0x40, "Off" }, + {0x13, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x80, 0x00, "Upright" }, + {0x13, 0x01, 0x80, 0x80, "Cocktail" }, + + {0 , 0xfe, 0 , 16, "Coin_A" }, + {0x14, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x14, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, + {0x14, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin_B" }, + {0x14, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, + {0x14, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, + {0x14, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x14, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, + {0x14, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x01, 0x01, "Off" }, + {0x15, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Initial Season" }, + {0x15, 0x01, 0x02, 0x02, "Spring" }, + {0x15, 0x01, 0x02, 0x00, "Winter" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x0c, 0x0c, "Easiest" }, + {0x15, 0x01, 0x0c, 0x08, "Easy" }, + {0x15, 0x01, 0x0c, 0x04, "Normal" }, + {0x15, 0x01, 0x0c, 0x00, "Hard" }, + + {0 , 0xfe, 0 , 2, "Coinage Display" }, + {0x15, 0x01, 0x10, 0x10, "Coins/Credits" }, + {0x15, 0x01, 0x10, 0x00, "Insert Coin" }, + + {0 , 0xfe, 0 , 2, "Year Display" }, + {0x15, 0x01, 0x20, 0x00, "1985" }, + {0x15, 0x01, 0x20, 0x20, "MCMLXXXIV" }, + + {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)" }, + {0x15, 0x01, 0x40, 0x40, "Off" }, + {0x15, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Slots" }, + {0x15, 0x01, 0x80, 0x80, "A and B" }, + {0x15, 0x01, 0x80, 0x00, "A only" }, +}; + +STDDIPINFO(Lkage) + +static struct BurnDIPInfo BygoneDIPList[]= +{ + {0x13, 0xff, 0xff, 0x3c, NULL }, + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0x40, NULL }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x13, 0x01, 0x18, 0x18, "3" }, + {0x13, 0x01, 0x18, 0x10, "4" }, + {0x13, 0x01, 0x18, 0x08, "5" }, + {0x13, 0x01, 0x18, 0x00, "255 (Cheat)" }, + + {0 , 0xfe, 0 , 0, "Flip Screen" }, + {0x13, 0x01, 0x40, 0x00, "Off" }, + {0x13, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x80, 0x00, "Upright" }, + {0x13, 0x01, 0x80, 0x80, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Coin A" }, + {0x14, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, + {0x14, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, + {0x14, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, + {0x14, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x14, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, + {0x14, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x14, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, + {0x14, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x14, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, + {0x14, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, + {0x14, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, + {0x14, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x14, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, + {0x14, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)" }, + {0x15, 0x01, 0x40, 0x40, "Off" }, + {0x15, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(Bygone) + +void __fastcall lkage_main_write(UINT16 address, UINT8 data) +{ + if ((address & 0xf800) == 0xe800) { + + DrvPalRAM[address & 0x7ff] = data; + + UINT16 col = (DrvPalRAM[(address & 0x7fe) | 1] << 8) | DrvPalRAM[(address & 0x7fe) | 0]; + + UINT8 r, g, b; + + r = (col >> 8) & 0x0f; + r |= r << 4; + + g = (col >> 4) & 0x0f; + g |= g << 4; + + b = (col >> 0) & 0x0f; + b |= b << 4; + + Palette[(address & 0x7ff) >> 1] = (r << 16) | (g << 8) | b; + DrvPalette[(address & 0x7ff) >> 1] = BurnHighCol(r, g, b, 0); + + return; + } + + switch (address) + { + case 0xf000: + case 0xf001: + case 0xf002: + case 0xf003: + DrvVidReg[address & 3] = data; + return; + + case 0xf060: + soundlatch = data; + if (DrvNmiEnable) { + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + } else { + pending_nmi = 1; + } + return; + + case 0xf061: + case 0xf063: + case 0xf0e1: + return; + + case 0xf062: { + if (Lkageb) { + FakeMCUVal = data; + } else { + standard_taito_mcu_write(data); + } + return; + } + + case 0xf0a0: + case 0xf0a1: + case 0xf0a2: + case 0xf0a3: + DrvUnkRAM[address & 3] = data; + return; + + case 0xf0c0: + case 0xf0c1: + case 0xf0c2: + case 0xf0c3: + case 0xf0c4: + case 0xf0c5: + lkage_scroll[address & 7] = data; + return; + } +} + +UINT8 __fastcall lkage_main_read(UINT16 address) +{ + switch (address) + { + case 0xf000: + case 0xf001: + case 0xf002: + case 0xf003: + return DrvVidReg[address & 3]; + + case 0xf061: + return 0xff; // sound status + + case 0xf062: { + if (Lkageb) { + switch (FakeMCUVal) { + case 0x01: return FakeMCUVal - 0x01; + case 0x90: return FakeMCUVal + 0x43; + case 0xa6: return FakeMCUVal + 0x27; + case 0x34: return FakeMCUVal + 0x7f; + case 0x48: return FakeMCUVal + 0xb7; + default: return FakeMCUVal; + } + } else { + return standard_taito_mcu_read(); + } + } + + case 0xf080: + case 0xf081: + case 0xf082: + return DrvDips[address & 3]; + + case 0xf083: + return DrvInps[0]; + + case 0xf084: + case 0xf085: + return DrvInps[address - 0xf083]; + + case 0xf087: { + if (Lkageb) { + return 0x03; + } else { + INT32 res = 0; + if (!main_sent) res |= 0x01; + if (mcu_sent) res |= 0x02; + return res; + } + } + + case 0xf0a0: + case 0xf0a1: + case 0xf0a2: + case 0xf0a3: + return DrvUnkRAM[address & 3]; + + case 0xf0c0: + case 0xf0c1: + case 0xf0c2: + case 0xf0c3: + case 0xf0c4: + case 0xf0c5: + return lkage_scroll[address & 7]; + } + + return 0; +} + +UINT8 __fastcall lkage_main_in(UINT16 port) +{ + if ((port & 0xc000) == 0x4000) { + return DrvPortData[port & 0x3fff]; + } + + return 0; +} + +UINT8 __fastcall lkage_sound_read(UINT16 address) +{ + switch (address) + { + case 0x9000: + return BurnYM2203Read(0, 0); + + case 0xa000: + return BurnYM2203Read(1, 0); + + case 0xb000: + return soundlatch; + + case 0xb001: + return 0; + } + + return 0; +} + +void __fastcall lkage_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x9000: + case 0x9001: + BurnYM2203Write(0, address & 1, data); + return; + + case 0xa000: + case 0xa001: + BurnYM2203Write(1, address & 1, data); + return; + + case 0xb000: + return; + + case 0xb001: + { + DrvNmiEnable = 1; + if (pending_nmi) { + ZetNmi(); + pending_nmi = 0; + } + } + return; + + case 0xb002: + DrvNmiEnable = 0; + return; + } +} + +inline static void DrvYM2203IRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 6000000; +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 6000000.0; +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + + for (INT32 i = 0; i < 2; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + m67805_taito_reset(); + + BurnYM2203Reset(); + + soundlatch = 0; + flipscreen_x = 0; + flipscreen_y = 0; + + DrvNmiEnable = 0; + pending_nmi = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x010000; + DrvZ80ROM1 = Next; Next += 0x010000; + + DrvMcuROM = Next; Next += 0x000800; + + DrvPortData = Next; Next += 0x004000; + + DrvGfxROM0 = Next; Next += 0x020000; + DrvGfxROM1 = Next; Next += 0x020000; + + DrvPalette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + Palette = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32); + + AllRam = Next; + + DrvVidRAM = Next; Next += 0x000c00; + + DrvZ80RAM0 = Next; Next += 0x000800; + DrvZ80RAM1 = Next; Next += 0x000800; + + DrvPalRAM = Next; Next += 0x000800; + DrvSprRAM = Next; Next += 0x000100; + + DrvUnkRAM = Next; Next += 0x000004; + + DrvMcuRAM = Next; Next += 0x000080; + + lkage_scroll = Next; Next += 0x000006; + DrvVidReg = Next; Next += 0x000004; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane[4] = { 0x20000, 0x00000, 0x60000, 0x40000 }; + INT32 XOffs[16] = { 7, 6, 5, 4, 3, 2, 1, 0, + 64+7, 64+6, 64+5, 64+4, 64+3, 64+2, 64+1, 64+0}; + INT32 YOffs[16] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, + 128+0*8, 128+1*8, 128+2*8, 128+3*8, 128+4*8, 128+5*8, 128+6*8, 128+7*8 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x10000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x10000); + + GfxDecode(0x800, 4, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM0); + GfxDecode(0x200, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1); + + BurnFree (tmp); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + use_mcu = ~BurnDrvGetFlags() & BDF_BOOTLEG; + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x0000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x8000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x0000, 2, 1)) return 1; + + if (BurnLoadRom(DrvPortData, 3, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x0000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x4000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0x8000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM0 + 0xc000, 7, 1)) return 1; + + if (use_mcu) { + if (BurnLoadRom(DrvMcuROM + 0x0000, 9, 1)) return 1; + } + + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0xdfff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0xdfff, 2, DrvZ80ROM0); + ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM0); + ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM0); + ZetMapArea(0xe800, 0xefff, 0, DrvPalRAM); +// ZetMapArea(0xe800, 0xefff, 1, DrvPalRAM); + ZetMapArea(0xe800, 0xefff, 2, DrvPalRAM); + ZetMapArea(0xf100, 0xf1ff, 0, DrvSprRAM); // 0xf100 - 0xf15f + ZetMapArea(0xf100, 0xf1ff, 1, DrvSprRAM); + ZetMapArea(0xf100, 0xf1ff, 2, DrvSprRAM); + ZetMapArea(0xf400, 0xffff, 0, DrvVidRAM); + ZetMapArea(0xf400, 0xffff, 1, DrvVidRAM); + ZetMapArea(0xf400, 0xffff, 2, DrvVidRAM); + ZetSetWriteHandler(lkage_main_write); + ZetSetReadHandler(lkage_main_read); + ZetSetInHandler(lkage_main_in); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1); + ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1); + //ZetMapArea(0xe000, 0xefff, 0, DrvZ80ROM1 + 0xe000); + //ZetMapArea(0xe000, 0xefff, 2, DrvZ80ROM1 + 0xe000); + ZetSetWriteHandler(lkage_sound_write); + ZetSetReadHandler(lkage_sound_read); + ZetClose(); + + m67805_taito_init(DrvMcuROM, DrvMcuRAM, &standard_m68705_interface); + + BurnYM2203Init(2, 4000000, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(6000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_YM2203_ROUTE, 0.40, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(1, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + + DrvDoReset(); + + GenericTilesInit(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + m67805_taito_exit(); + + BurnYM2203Exit(); + + BurnFree (AllMem); + + Lkageb = 0; + FakeMCUVal = 0; + + return 0; +} + + +static void draw_sprites(INT32 prio) +{ + INT32 dx = (strcmp ("bygone", BurnDrvGetTextA(DRV_NAME)) == 0) ? 1 : 0; + + const UINT8 *source = DrvSprRAM + 0x60 - 4; + const UINT8 *finish = DrvSprRAM; + + while (source >= finish) + { + INT32 attributes = source[2]; + INT32 priority = attributes >> 7; + if (priority != prio) { + source -= 4; + continue; + } + + INT32 color = (attributes>>4)&7; + INT32 flipx = attributes & 0x01; + INT32 flipy = attributes & 0x02; + INT32 height = (attributes & 0x08) ? 2 : 1; + INT32 sx = source[0]-15+dx; + INT32 sy = 256-16*height-source[1]; + INT32 sprite_number = source[3] + ((attributes & 0x04) << 6); + INT32 y; + + if (flipscreen_x) + { + sx = 239 - sx - 24; + flipx = !flipx; + sx += 16; + } + if (flipscreen_y) + { + sy = 254 - 16*height - sy; + flipy = !flipy; + } + if (height == 2 && !flipy) + { + sprite_number ^= 1; + } + + sx -= 16; + sy -= 16; + + if (sx < -15) sx += 256; + + for (y = 0;y < height;y++) + { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, sprite_number ^ y, sx, sy + (y << 4), color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, sprite_number ^ y, sx, sy + (y << 4), color, 4, 0, 0, DrvGfxROM1); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, sprite_number ^ y, sx, sy + (y << 4), color, 4, 0, 0, DrvGfxROM1); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, sprite_number ^ y, sx, sy + (y << 4), color, 4, 0, 0, DrvGfxROM1); + } + } + } + source -= 4; + } +} + +static void draw_layer(INT32 offset, INT32 bank, INT32 color, INT32 transp, INT32 scrollx, INT32 scrolly) +{ + color >>= 4; + + if (flipscreen_x) { + scrollx *= -1; + } + + if (flipscreen_y) { + scrolly *= -1; + } + + UINT8 *src = DrvVidRAM + offset; + + INT32 x_minus = flipscreen_x ? 24 : 16; + + for (INT32 offs = 0; offs < 0x400; offs++) + { + INT32 code = src[offs] | (bank << 8); + + INT32 sx = (offs & 0x1f) << 3; + INT32 sy = (offs >> 5) << 3; + + if (flipscreen_x) sx ^= 0xf8; + if (flipscreen_y) sy ^= 0xf8; + + sx -= scrollx; + sy -= scrolly; + + sx -= x_minus; + sy -= 16; + + if (sx < -7) sx += 256; + if (sy < -15) sy += 256; + if (sx > 239) sx -= 256; + if (sy > 223) sy -= 256; + + if (transp) { + if (flipscreen_y) { + if (flipscreen_x) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } + } else { + if (flipscreen_x) { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0); + } + } + } else { + if (flipscreen_y) { + if (flipscreen_x) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } else { + Render8x8Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } + } else { + if (flipscreen_x) { + Render8x8Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM0); + } + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0x400; i++) { + INT32 rgb = Palette[i]; + DrvPalette[i] = BurnHighCol(rgb >> 16, rgb >> 8, rgb, 0); + } + DrvRecalc = 0; + } + + flipscreen_x = ~DrvVidReg[2] & 0x01; + flipscreen_y = ~DrvVidReg[2] & 0x02; + + INT32 color_bank = (DrvVidReg[1] & 0xf0); + INT32 bg_bank = ((DrvVidReg[1] & 0x08) >> 1) + 1; + INT32 fg_bank = (DrvVidReg[0] & 0x04) >> 2; + INT32 tx_bank = (DrvVidReg[0] & 0x02) << 1; // bygone + +// if ((DrvVidReg[2] & 0xf0) == 0xf0) // mame + if ((DrvVidReg[2] & 0x0f) == 0x03) // Correct? Seems to give proper results in bygone... + { + draw_layer(0x800, bg_bank, 0x300 | color_bank, 0, lkage_scroll[4]+5, lkage_scroll[5]); + + draw_sprites(1); + + if (~DrvVidReg[1] & 2) draw_sprites(0); + + draw_layer(0x400, fg_bank, 0x200 | color_bank, 1, lkage_scroll[2]+3, lkage_scroll[3]); + + if ( DrvVidReg[1] & 2) draw_sprites(0); + + draw_layer(0x000, tx_bank, 0x110, 1, lkage_scroll[0]+1, lkage_scroll[1]); + } + else + { + if (nBurnLayer & 4)draw_layer(0x000, 0, 0x110, 0, lkage_scroll[0]+1, lkage_scroll[1]); + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + DrvInps[0] = 0x0b; + DrvInps[1] = DrvInps[2] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + DrvInps[0] ^= (DrvJoy1[i] & 1) << i; + DrvInps[1] ^= (DrvJoy2[i] & 1) << i; + DrvInps[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + INT32 nInterleave = 100; + INT32 nCyclesTotal[3] = { 6000000 / 60, 6000000 / 60, 4000000 / 60 }; + INT32 nCyclesDone[3] = { 0, 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext, nCyclesSegment; + + // Run Z80 #1 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == 99) ZetRaiseIrq(0); + ZetClose(); + + // Run Z80 #2 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + BurnTimerUpdate(i * (nCyclesTotal[1] / nInterleave)); + ZetClose(); + + if (use_mcu) { + m6805Open(0); + nCyclesSegment = nCyclesTotal[2] / nInterleave; + nCyclesDone[2] += m6805Run(nCyclesSegment); + m6805Close(); + } + } + + ZetOpen(1); + BurnTimerEndFrame(nCyclesTotal[1]); + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029697; + } + + if (nAction & ACB_VOLATILE) { + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All RAM"; + BurnAcb(&ba); + + ZetScan(nAction); + BurnYM2203Scan(nAction, pnMin); + + SCAN_VAR(soundlatch); + SCAN_VAR(flipscreen_x); + SCAN_VAR(flipscreen_y); + SCAN_VAR(DrvNmiEnable); + SCAN_VAR(pending_nmi); + + DrvRecalc = 1; + } + + return 0; +} + + +// The Legend of Kage + +static struct BurnRomInfo lkageRomDesc[] = { + { "a54-01-2.37", 0x8000, 0x60fd9734, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "a54-02-2.38", 0x8000, 0x878a25ce, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data + + { "a54-05-1.84", 0x4000, 0x0033c06a, 4 | BRF_GRA }, // 4 Graphics + { "a54-06-1.85", 0x4000, 0x9f04d9ad, 4 | BRF_GRA }, // 5 + { "a54-07-1.86", 0x4000, 0xb20561a4, 4 | BRF_GRA }, // 6 + { "a54-08-1.87", 0x4000, 0x3ff3b230, 4 | BRF_GRA }, // 7 + + { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) + + { "a54-09.53", 0x0800, 0x0e8b8846, 6 | BRF_PRG | BRF_OPT }, // 9 68705 Code + + { "pal16l8-a54-11.34", 0x0104, 0x56232113, 7 | BRF_OPT }, // 10 Plds (unused) + { "pal16l8-a54-12.76", 0x0104, 0xe57c3c89, 7 | BRF_OPT }, // 11 + { "pal16l8a-a54-13.27", 0x0104, 0xc9b1938e, 7 | BRF_OPT }, // 12 + { "pal16l8a-a54-14.35", 0x0104, 0xa89c644e, 7 | BRF_OPT }, // 13 +}; + +STD_ROM_PICK(lkage) +STD_ROM_FN(lkage) + +struct BurnDriver BurnDrvLkage = { + "lkage", NULL, NULL, NULL, "1984", + "The Legend of Kage\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, lkageRomInfo, lkageRomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 224, 4, 3 +}; + + +// The Legend of Kage (older) + +static struct BurnRomInfo lkageoRomDesc[] = { + { "a54-01-1.37", 0x8000, 0x973da9c5, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "a54-02-1.38", 0x8000, 0x27b509da, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data + + { "a54-05-1.84", 0x4000, 0x0033c06a, 4 | BRF_GRA }, // 4 Graphics + { "a54-06-1.85", 0x4000, 0x9f04d9ad, 4 | BRF_GRA }, // 5 + { "a54-07-1.86", 0x4000, 0xb20561a4, 4 | BRF_GRA }, // 6 + { "a54-08-1.87", 0x4000, 0x3ff3b230, 4 | BRF_GRA }, // 7 + + { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) + + { "a54-09.53", 0x0800, 0x0e8b8846, 6 | BRF_PRG | BRF_OPT }, // 9 68705 Code + + { "pal16l8-a54-11.34", 0x0104, 0x56232113, 7 | BRF_OPT }, // 10 Plds (unused) + { "pal16l8-a54-12.76", 0x0104, 0xe57c3c89, 7 | BRF_OPT }, // 11 + { "pal16l8a-a54-13.27", 0x0104, 0xc9b1938e, 7 | BRF_OPT }, // 12 + { "pal16l8a-a54-14.35", 0x0104, 0xa89c644e, 7 | BRF_OPT }, // 13 +}; + +STD_ROM_PICK(lkageo) +STD_ROM_FN(lkageo) + +struct BurnDriver BurnDrvLkageo = { + "lkageo", "lkage", NULL, NULL, "1984", + "The Legend of Kage (older)\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, lkageoRomInfo, lkageoRomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 224, 4, 3 +}; + + +// The Legend of Kage (oldest) + +static struct BurnRomInfo lkageooRomDesc[] = { + { "a54-01.37", 0x8000, 0x34eab2c5, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "a54-02.38", 0x8000, 0xea471d8a, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data + + { "a54-05.84", 0x4000, 0x76753e52, 4 | BRF_GRA }, // 4 Graphics + { "a54-06.85", 0x4000, 0xf33c015c, 4 | BRF_GRA }, // 5 + { "a54-07.86", 0x4000, 0x0e02c2e8, 4 | BRF_GRA }, // 6 + { "a54-08.87", 0x4000, 0x4ef5f073, 4 | BRF_GRA }, // 7 + + { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) + + { "a54-09.53", 0x0800, 0x0e8b8846, 6 | BRF_PRG | BRF_OPT }, // 9 68705 Code + + { "pal16l8-a54-11.34", 0x0104, 0x56232113, 7 | BRF_OPT }, // 10 Plds (unused) + { "pal16l8-a54-12.76", 0x0104, 0xe57c3c89, 7 | BRF_OPT }, // 11 + { "pal16l8a-a54-13.27", 0x0104, 0xc9b1938e, 7 | BRF_OPT }, // 12 + { "pal16l8a-a54-14.35", 0x0104, 0xa89c644e, 7 | BRF_OPT }, // 13 +}; + +STD_ROM_PICK(lkageoo) +STD_ROM_FN(lkageoo) + +struct BurnDriver BurnDrvLkageoo = { + "lkageoo", "lkage", NULL, NULL, "1984", + "The Legend of Kage (oldest)\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, lkageooRomInfo, lkageooRomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 224, 4, 3 +}; + + +// The Legend of Kage (bootleg set 1) + +static struct BurnRomInfo lkagebRomDesc[] = { + { "ic37_1", 0x8000, 0x05694f7b, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "ic38_2", 0x8000, 0x22efe29e, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data + + { "ic93_5", 0x4000, 0x76753e52, 4 | BRF_GRA }, // 4 Graphics + { "ic94_6", 0x4000, 0xf33c015c, 4 | BRF_GRA }, // 5 + { "ic95_7", 0x4000, 0x0e02c2e8, 4 | BRF_GRA }, // 6 + { "ic96_8", 0x4000, 0x4ef5f073, 4 | BRF_GRA }, // 7 + + { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) +}; + +STD_ROM_PICK(lkageb) +STD_ROM_FN(lkageb) + +static INT32 LkagebInit() +{ + Lkageb = 1; + + return DrvInit(); +} + +struct BurnDriver BurnDrvLkageb = { + "lkageb", "lkage", NULL, NULL, "1984", + "The Legend of Kage (bootleg set 1)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, lkagebRomInfo, lkagebRomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, + LkagebInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 224, 4, 3 +}; + + +// The Legend of Kage (bootleg set 2) + +static struct BurnRomInfo lkageb2RomDesc[] = { + { "lok.a", 0x8000, 0x866df793, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "lok.b", 0x8000, 0xfba9400f, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data + + { "ic93_5", 0x4000, 0x76753e52, 4 | BRF_GRA }, // 4 Graphics + { "ic94_6", 0x4000, 0xf33c015c, 4 | BRF_GRA }, // 5 + { "ic95_7", 0x4000, 0x0e02c2e8, 4 | BRF_GRA }, // 6 + { "ic96_8", 0x4000, 0x4ef5f073, 4 | BRF_GRA }, // 7 + + { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) +}; + +STD_ROM_PICK(lkageb2) +STD_ROM_FN(lkageb2) + +struct BurnDriver BurnDrvLkageb2 = { + "lkageb2", "lkage", NULL, NULL, "1984", + "The Legend of Kage (bootleg set 2)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, lkageb2RomInfo, lkageb2RomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 224, 4, 3 +}; + + +// The Legend of Kage (bootleg set 3) + +static struct BurnRomInfo lkageb3RomDesc[] = { + { "z1.bin", 0x8000, 0x60cac488, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "z2.bin", 0x8000, 0x22c95f17, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "a54-04.54", 0x8000, 0x541faf9a, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "a54-03.51", 0x4000, 0x493e76d8, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data + + { "ic93_5", 0x4000, 0x76753e52, 4 | BRF_GRA }, // 4 Graphics + { "ic94_6", 0x4000, 0xf33c015c, 4 | BRF_GRA }, // 5 + { "ic95_7", 0x4000, 0x0e02c2e8, 4 | BRF_GRA }, // 6 + { "ic96_8", 0x4000, 0x4ef5f073, 4 | BRF_GRA }, // 7 + + { "a54-10.2", 0x0200, 0x17dfbd14, 5 | BRF_OPT }, // 8 Prom (unused) +}; + +STD_ROM_PICK(lkageb3) +STD_ROM_FN(lkageb3) + +struct BurnDriver BurnDrvLkageb3 = { + "lkageb3", "lkage", NULL, NULL, "1984", + "The Legend of Kage (bootleg set 3)\0", NULL, "bootleg", "hardware", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, lkageb3RomInfo, lkageb3RomName, NULL, NULL, LkageInputInfo, LkageDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 224, 4, 3 +}; + + +// Bygone + +static struct BurnRomInfo bygoneRomDesc[] = { + { "a53_05.ic37", 0x8000, 0x63a3f08b, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "a53_06.ic38", 0x8000, 0xcb0dcb08, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "a53_07.ic54", 0x8000, 0x72f69a77, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "a53_08.ic51", 0x4000, 0xf85139f9, 3 | BRF_PRG | BRF_ESS }, // 3 Z80 #0 Data + + { "a53_01.ic84", 0x4000, 0x38cf7fb2, 4 | BRF_GRA }, // 4 Graphics + { "a53_02.ic85", 0x4000, 0xdca7adfe, 4 | BRF_GRA }, // 5 + { "a53_03.ic86", 0x4000, 0xaf3eb997, 4 | BRF_GRA }, // 6 + { "a53_04.ic87", 0x4000, 0x65af72d3, 4 | BRF_GRA }, // 7 + + { "a54-10.ic2", 0x0400, 0x369722d9, 5 | BRF_OPT }, // 8 Prom (unused) + + { "a51_09.ic53", 0x0800, 0x0e8b8846, 6 | BRF_PRG | BRF_OPT }, // 9 68705 Code +}; + +STD_ROM_PICK(bygone) +STD_ROM_FN(bygone) + +struct BurnDriver BurnDrvBygone = { + "bygone", NULL, NULL, NULL, "1985", + "Bygone\0", "Imperfect sound", "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SCRFIGHT, 0, + NULL, bygoneRomInfo, bygoneRomName, NULL, NULL, LkageInputInfo, BygoneDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400, + 240, 224, 4, 3 +}; diff --git a/src/burn/drv/taito/d_minivdr.cpp b/src/burn/drv/taito/d_minivdr.cpp index 7cb416869..add5636b5 100644 --- a/src/burn/drv/taito/d_minivdr.cpp +++ b/src/burn/drv/taito/d_minivdr.cpp @@ -1,198 +1,197 @@ -// FB Alpha Minivader driver module -//Based on MAME Driver by Takahiro Nogi - -#include "tiles_generic.h" -#include "z80_intf.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM; -static UINT8 *DrvZ80RAM; - -static UINT8 DrvJoy1[4]; -static UINT8 DrvInputs[1]; -static UINT8 DrvReset; - -static struct BurnInputInfo DrvInputList[] = { - {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 3, "p1 coin" }, - {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 2, "p1 fire 1"}, - - {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, -}; - -STDINPUTINFO(Drv) - -UINT8 __fastcall minivdr_read(UINT16 address) -{ - if (address == 0xe008) { - return DrvInputs[0]; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM = Next; Next += 0x010000; - - AllRam = Next; - - DrvZ80RAM = Next; Next += 0x002000; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM, 0, 1)) return 1; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea (0x0000, 0x1fff, 0, DrvZ80ROM); - ZetMapArea (0x0000, 0x1fff, 2, DrvZ80ROM); - ZetMapArea (0xa000, 0xbfff, 0, DrvZ80RAM); - ZetMapArea (0xa000, 0xbfff, 1, DrvZ80RAM); - ZetMapArea (0xa000, 0xbfff, 2, DrvZ80RAM); - ZetSetReadHandler(minivdr_read); - ZetMemEnd(); - ZetClose(); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - - BurnFree (AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - UINT32 DrvPalette[2]; - - DrvPalette[0] = 0; - DrvPalette[1] = BurnHighCol(0xff, 0xff, 0xff, 0); - - for (INT32 offs = 0x200; offs < 0x1e00; offs++) - { - INT32 sx = (offs << 3) & 0xf8; - INT32 sy = ((offs >> 5) - 0x10) << 8; - INT32 d = DrvZ80RAM[offs]; - - for (INT32 i = 0; i < 8; i++, sx++) - { - pTransDraw[sx + sy] = (d >> (7 - i)) & 1; - } - } - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - { - DrvInputs[0] = 0xff; - for (INT32 i = 0; i < 4; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - } - } - - ZetOpen(0); - ZetRun(4000000 / 60); - ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029702; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - } - - return 0; -} - - -// Minivader - -static struct BurnRomInfo minivadrRomDesc[] = { - { "d26-01.bin", 0x2000, 0xa96c823d, BRF_ESS | BRF_PRG }, // Z80 code -}; - -STD_ROM_PICK(minivadr) -STD_ROM_FN(minivadr) - -struct BurnDriver BurnDrvminivadr = { - "minivadr", NULL, NULL, NULL, "1990", - "Minivader\0", NULL, "Taito Corporation", "Minivader", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 1, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, minivadrRomInfo, minivadrRomName, NULL, NULL, DrvInputInfo, NULL, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, - 256, 224, 4, 3 -}; +// FB Alpha Minivader driver module +//Based on MAME Driver by Takahiro Nogi + +#include "tiles_generic.h" +#include "z80_intf.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM; +static UINT8 *DrvZ80RAM; + +static UINT8 DrvJoy1[4]; +static UINT8 DrvInputs[1]; +static UINT8 DrvReset; + +static struct BurnInputInfo DrvInputList[] = { + {"P1 Coin" , BIT_DIGITAL , DrvJoy1 + 3, "p1 coin" }, + {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 0, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 2, "p1 fire 1"}, + + {"Reset" , BIT_DIGITAL , &DrvReset , "reset" }, +}; + +STDINPUTINFO(Drv) + +UINT8 __fastcall minivdr_read(UINT16 address) +{ + if (address == 0xe008) { + return DrvInputs[0]; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM = Next; Next += 0x010000; + + AllRam = Next; + + DrvZ80RAM = Next; Next += 0x002000; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM, 0, 1)) return 1; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea (0x0000, 0x1fff, 0, DrvZ80ROM); + ZetMapArea (0x0000, 0x1fff, 2, DrvZ80ROM); + ZetMapArea (0xa000, 0xbfff, 0, DrvZ80RAM); + ZetMapArea (0xa000, 0xbfff, 1, DrvZ80RAM); + ZetMapArea (0xa000, 0xbfff, 2, DrvZ80RAM); + ZetSetReadHandler(minivdr_read); + ZetClose(); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + + BurnFree (AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + UINT32 DrvPalette[2]; + + DrvPalette[0] = 0; + DrvPalette[1] = BurnHighCol(0xff, 0xff, 0xff, 0); + + for (INT32 offs = 0x200; offs < 0x1e00; offs++) + { + INT32 sx = (offs << 3) & 0xf8; + INT32 sy = ((offs >> 5) - 0x10) << 8; + INT32 d = DrvZ80RAM[offs]; + + for (INT32 i = 0; i < 8; i++, sx++) + { + pTransDraw[sx + sy] = (d >> (7 - i)) & 1; + } + } + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + { + DrvInputs[0] = 0xff; + for (INT32 i = 0; i < 4; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + } + } + + ZetOpen(0); + ZetRun(4000000 / 60); + ZetSetIRQLine(0, ZET_IRQSTATUS_AUTO); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029702; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + } + + return 0; +} + + +// Minivader + +static struct BurnRomInfo minivadrRomDesc[] = { + { "d26-01.bin", 0x2000, 0xa96c823d, BRF_ESS | BRF_PRG }, // Z80 code +}; + +STD_ROM_PICK(minivadr) +STD_ROM_FN(minivadr) + +struct BurnDriver BurnDrvminivadr = { + "minivadr", NULL, NULL, NULL, "1990", + "Minivader\0", NULL, "Taito Corporation", "Minivader", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 1, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, minivadrRomInfo, minivadrRomName, NULL, NULL, DrvInputInfo, NULL, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0, + 256, 224, 4, 3 +}; diff --git a/src/burn/drv/taito/d_othunder.cpp b/src/burn/drv/taito/d_othunder.cpp index 66fd8c054..a77cf9efb 100644 --- a/src/burn/drv/taito/d_othunder.cpp +++ b/src/burn/drv/taito/d_othunder.cpp @@ -1,1190 +1,1189 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "taito.h" -#include "taito_ic.h" -#include "burn_ym2610.h" -#include "eeprom.h" -#include "burn_gun.h" - -static void OthunderDraw(); - -static double OthunderYM2610AY8910RouteMasterVol; -static double OthunderYM2610Route1MasterVol; -static double OthunderYM2610Route2MasterVol; -static UINT8 *OthunderPan; - -static bool bUseAsm68KCoreOldValue = false; - -#define A(a, b, c, d) {a, b, (UINT8*)(c), d} - -static struct BurnInputInfo OthunderInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p2 start" }, - - A("P1 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "mouse x-axis" ), - A("P1 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "mouse y-axis" ), - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "mouse button 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "mouse button 2" }, - - A("P2 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort2 , "p2 x-axis" ), - A("P2 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort3 , "p2 y-axis" ), - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, - {"Dip 3" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, -}; - -STDINPUTINFO(Othunder) - -#undef A - -static void TC0220IOCMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0xff; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - TC0220IOCInput[0] -= (TC0220IOCInputPort0[i] & 1) << i; - TC0220IOCInput[1] -= (TC0220IOCInputPort1[i] & 1) << i; - TC0220IOCInput[2] -= (TC0220IOCInputPort2[i] & 1) << i; - } -} - -static void OthunderMakeInputs() -{ - TC0220IOCMakeInputs(); - - BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); - BurnGunMakeInputs(1, (INT16)TaitoAnalogPort2, (INT16)TaitoAnalogPort3); -} - -static struct BurnDIPInfo OthunderDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0xff, NULL }, - {0x0f, 0xff, 0xff, 0x7f, NULL }, - {0x10, 0xff, 0xff, 0x07, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0e, 0x01, 0x02, 0x00, "Off" }, - {0x0e, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0e, 0x01, 0x04, 0x04, "Off" }, - {0x0e, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0e, 0x01, 0x08, 0x00, "Off" }, - {0x0e, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0e, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0e, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0e, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0e, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x0e, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x0e, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x0e, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0f, 0x01, 0x03, 0x02, "Easy" }, - {0x0f, 0x01, 0x03, 0x03, "Medium" }, - {0x0f, 0x01, 0x03, 0x01, "Hard" }, - {0x0f, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Magazines/Rockets" }, - {0x0f, 0x01, 0x0c, 0x0c, "5/3" }, - {0x0f, 0x01, 0x0c, 0x08, "6/4" }, - {0x0f, 0x01, 0x0c, 0x04, "7/5" }, - {0x0f, 0x01, 0x0c, 0x00, "8/6" }, - - {0 , 0xfe, 0 , 4 , "Bullets per Magazine" }, - {0x0f, 0x01, 0x30, 0x00, "30" }, - {0x0f, 0x01, 0x30, 0x10, "35" }, - {0x0f, 0x01, 0x30, 0x30, "40" }, - {0x0f, 0x01, 0x30, 0x20, "50" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x80, 0x00, "English" }, - {0x0f, 0x01, 0x80, 0x80, "Japanese" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Stereo Seperation" }, - {0x10, 0x01, 0x07, 0x07, "Maximum" }, - {0x10, 0x01, 0x07, 0x03, "High" }, - {0x10, 0x01, 0x07, 0x01, "Medium" }, - {0x10, 0x01, 0x07, 0x00, "Low" }, -}; - -STDDIPINFO(Othunder) - -static struct BurnDIPInfo OthunderjDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0xff, NULL }, - {0x0f, 0xff, 0xff, 0x7f, NULL }, - {0x10, 0xff, 0xff, 0x07, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0e, 0x01, 0x02, 0x00, "Off" }, - {0x0e, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0e, 0x01, 0x04, 0x04, "Off" }, - {0x0e, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0e, 0x01, 0x08, 0x00, "Off" }, - {0x0e, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0e, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0e, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0e, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0e, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0f, 0x01, 0x03, 0x02, "Easy" }, - {0x0f, 0x01, 0x03, 0x03, "Medium" }, - {0x0f, 0x01, 0x03, 0x01, "Hard" }, - {0x0f, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Magazines/Rockets" }, - {0x0f, 0x01, 0x0c, 0x0c, "5/3" }, - {0x0f, 0x01, 0x0c, 0x08, "6/4" }, - {0x0f, 0x01, 0x0c, 0x04, "7/5" }, - {0x0f, 0x01, 0x0c, 0x00, "8/6" }, - - {0 , 0xfe, 0 , 4 , "Bullets per Magazine" }, - {0x0f, 0x01, 0x30, 0x00, "30" }, - {0x0f, 0x01, 0x30, 0x10, "35" }, - {0x0f, 0x01, 0x30, 0x30, "40" }, - {0x0f, 0x01, 0x30, 0x20, "50" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x80, 0x00, "English" }, - {0x0f, 0x01, 0x80, 0x80, "Japanese" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Stereo Seperation" }, - {0x10, 0x01, 0x07, 0x07, "Maximum" }, - {0x10, 0x01, 0x07, 0x03, "High" }, - {0x10, 0x01, 0x07, 0x01, "Medium" }, - {0x10, 0x01, 0x07, 0x00, "Low" }, -}; - -STDDIPINFO(Othunderj) - -static struct BurnDIPInfo OthunderuDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0xff, NULL }, - {0x0f, 0xff, 0xff, 0x7f, NULL }, - {0x10, 0xff, 0xff, 0x07, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0e, 0x01, 0x02, 0x00, "Off" }, - {0x0e, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0e, 0x01, 0x04, 0x04, "Off" }, - {0x0e, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0e, 0x01, 0x08, 0x00, "Off" }, - {0x0e, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0e, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0e, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0e, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0e, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0f, 0x01, 0x03, 0x02, "Easy" }, - {0x0f, 0x01, 0x03, 0x03, "Medium" }, - {0x0f, 0x01, 0x03, 0x01, "Hard" }, - {0x0f, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Magazines/Rockets" }, - {0x0f, 0x01, 0x0c, 0x0c, "5/3" }, - {0x0f, 0x01, 0x0c, 0x08, "6/4" }, - {0x0f, 0x01, 0x0c, 0x04, "7/5" }, - {0x0f, 0x01, 0x0c, 0x00, "8/6" }, - - {0 , 0xfe, 0 , 4 , "Bullets per Magazine" }, - {0x0f, 0x01, 0x30, 0x00, "30" }, - {0x0f, 0x01, 0x30, 0x10, "35" }, - {0x0f, 0x01, 0x30, 0x30, "40" }, - {0x0f, 0x01, 0x30, 0x20, "50" }, - - {0 , 0xfe, 0 , 2 , "Continue Price" }, - {0x0f, 0x01, 0x40, 0x00, "1 Coin 1 Credit" }, - {0x0f, 0x01, 0x40, 0x40, "Same as Start" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x80, 0x00, "English" }, - {0x0f, 0x01, 0x80, 0x80, "Japanese" }, - - // Dip 3 - {0 , 0xfe, 0 , 4 , "Stereo Seperation" }, - {0x10, 0x01, 0x07, 0x07, "Maximum" }, - {0x10, 0x01, 0x07, 0x03, "High" }, - {0x10, 0x01, 0x07, 0x01, "Medium" }, - {0x10, 0x01, 0x07, 0x00, "Low" }, -}; - -STDDIPINFO(Othunderu) - -static struct BurnRomInfo OthunderRomDesc[] = { - { "b67-20.63", 0x20000, 0x21439ea2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-23.64", 0x20000, 0x789e9daa, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-14.61", 0x20000, 0x7f3dd724, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-15.62", 0x20000, 0xe84f62d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b67-13.40", 0x10000, 0x2936b4b1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b67-06.66", 0x80000, 0xb9a38d64, BRF_GRA | TAITO_CHARS}, - - { "b67-01", 0x80000, 0x81ad9acb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-02", 0x80000, 0xc20cd2fb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-03", 0x80000, 0xbc9019ed, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-04", 0x80000, 0x2af4c8af, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b67-05.43", 0x80000, 0x9593e42b, BRF_GRA | TAITO_SPRITEMAP }, - - { "b67-08", 0x80000, 0x458f41fb, BRF_SND | TAITO_YM2610A }, - - { "b67-07", 0x80000, 0x4f834357, BRF_SND | TAITO_YM2610B }, - - { "eeprom-othunder.bin", 0x00080, 0x3729b844, BRF_PRG | TAITO_DEFAULT_EEPROM }, - - { "plhs18p8b-b67-09.ic15", 0x00149, 0x62035487, BRF_OPT }, - { "pal16l8a-b67-11.ic36", 0x00104, 0x3177fb06, BRF_OPT }, - { "pal20l8b-b67-12.ic37", 0x00144, 0xa47c2798, BRF_OPT }, - { "pal20l8b-b67-10.ic33", 0x00144, 0x4ced09c7, BRF_OPT }, -}; - -STD_ROM_PICK(Othunder) -STD_ROM_FN(Othunder) - -static struct BurnRomInfo OthunderuRomDesc[] = { - { "b67-20-1.63", 0x20000, 0x851a453b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-22-1.64", 0x20000, 0x19480dc0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-14.61", 0x20000, 0x7f3dd724, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-15.62", 0x20000, 0xe84f62d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b67-13.40", 0x10000, 0x2936b4b1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b67-06.66", 0x80000, 0xb9a38d64, BRF_GRA | TAITO_CHARS}, - - { "b67-01", 0x80000, 0x81ad9acb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-02", 0x80000, 0xc20cd2fb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-03", 0x80000, 0xbc9019ed, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-04", 0x80000, 0x2af4c8af, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b67-05.43", 0x80000, 0x9593e42b, BRF_GRA | TAITO_SPRITEMAP }, - - { "b67-08", 0x80000, 0x458f41fb, BRF_SND | TAITO_YM2610A }, - - { "b67-07", 0x80000, 0x4f834357, BRF_SND | TAITO_YM2610B }, - - { "eeprom-othunder.bin", 0x00080, 0x3729b844, BRF_PRG | TAITO_DEFAULT_EEPROM }, - - { "plhs18p8b-b67-09.ic15", 0x00149, 0x62035487, BRF_OPT }, - { "pal16l8a-b67-11.ic36", 0x00104, 0x3177fb06, BRF_OPT }, - { "pal20l8b-b67-12.ic37", 0x00144, 0xa47c2798, BRF_OPT }, - { "pal20l8b-b67-10.ic33", 0x00144, 0x4ced09c7, BRF_OPT }, -}; - -STD_ROM_PICK(Othunderu) -STD_ROM_FN(Othunderu) - -static struct BurnRomInfo OthunderuoRomDesc[] = { - { "b67-20.63", 0x20000, 0x21439ea2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-22.64", 0x20000, 0x0f99ad3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-14.61", 0x20000, 0x7f3dd724, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-15.62", 0x20000, 0xe84f62d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b67-13.40", 0x10000, 0x2936b4b1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b67-06.66", 0x80000, 0xb9a38d64, BRF_GRA | TAITO_CHARS}, - - { "b67-01", 0x80000, 0x81ad9acb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-02", 0x80000, 0xc20cd2fb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-03", 0x80000, 0xbc9019ed, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-04", 0x80000, 0x2af4c8af, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b67-05.43", 0x80000, 0x9593e42b, BRF_GRA | TAITO_SPRITEMAP }, - - { "b67-08", 0x80000, 0x458f41fb, BRF_SND | TAITO_YM2610A }, - - { "b67-07", 0x80000, 0x4f834357, BRF_SND | TAITO_YM2610B }, - - { "eeprom-othunder.bin", 0x00080, 0x3729b844, BRF_PRG | TAITO_DEFAULT_EEPROM }, - - { "plhs18p8b-b67-09.ic15", 0x00149, 0x62035487, BRF_OPT }, - { "pal16l8a-b67-11.ic36", 0x00104, 0x3177fb06, BRF_OPT }, - { "pal20l8b-b67-12.ic37", 0x00144, 0xa47c2798, BRF_OPT }, - { "pal20l8b-b67-10.ic33", 0x00144, 0x4ced09c7, BRF_OPT }, -}; - -STD_ROM_PICK(Othunderuo) -STD_ROM_FN(Othunderuo) - -static struct BurnRomInfo OthunderjRomDesc[] = { - { "b67-20.63", 0x20000, 0x21439ea2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-21.64", 0x20000, 0x9690fc86, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-14.61", 0x20000, 0x7f3dd724, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b67-15.62", 0x20000, 0xe84f62d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b67-13.40", 0x10000, 0x2936b4b1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b67-06.66", 0x80000, 0xb9a38d64, BRF_GRA | TAITO_CHARS}, - - { "b67-01", 0x80000, 0x81ad9acb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-02", 0x80000, 0xc20cd2fb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-03", 0x80000, 0xbc9019ed, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b67-04", 0x80000, 0x2af4c8af, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b67-05.43", 0x80000, 0x9593e42b, BRF_GRA | TAITO_SPRITEMAP }, - - { "b67-08", 0x80000, 0x458f41fb, BRF_SND | TAITO_YM2610A }, - - { "b67-07", 0x80000, 0x4f834357, BRF_SND | TAITO_YM2610B }, - - { "eeprom-othunder.bin", 0x00080, 0x3729b844, BRF_PRG | TAITO_DEFAULT_EEPROM }, - - { "plhs18p8b-b67-09.ic15", 0x00149, 0x62035487, BRF_OPT }, - { "pal16l8a-b67-11.ic36", 0x00104, 0x3177fb06, BRF_OPT }, - { "pal20l8b-b67-12.ic37", 0x00144, 0xa47c2798, BRF_OPT }, - { "pal20l8b-b67-10.ic33", 0x00144, 0x4ced09c7, BRF_OPT }, -}; - -STD_ROM_PICK(Othunderj) -STD_ROM_FN(Othunderj) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += Taito68KRom1Size; - TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; - TaitoSpriteMapRom = Next; Next += TaitoSpriteMapRomSize; - TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; - TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - TaitoDefaultEEProm = Next; Next += TaitoDefaultEEPromSize; - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x10000; - TaitoZ80Ram1 = Next; Next += 0x02000; - TaitoSpriteRam = Next; Next += 0x00600; - OthunderPan = Next; Next += 0x00004; - - TaitoRamEnd = Next; - - TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; - TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; - TaitoPalette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); - - TaitoMemEnd = Next; - - return 0; -} - -static INT32 OthunderDoReset() -{ - TaitoDoReset(); - - return 0; -} - -static UINT8 OthunderInputBypassRead(INT32 Offset) -{ - switch (Offset) { - case 0x03: { - return (EEPROMRead() & 1) << 7; - } - - default: { - return TC0220IOCRead(Offset); - } - } - - return 0; -} - -static void OthunderInputBypassWrite(INT32 Offset, UINT16 Data) -{ - switch (Offset) { - case 0x03: { - EEPROMWrite(Data & 0x20, Data & 0x10, Data & 0x40); - return; - } - - default: { - TC0220IOCWrite(Offset, Data & 0xff); - } - } -} - -UINT8 __fastcall Othunder68KReadByte(UINT32 a) -{ - switch (a) { - case 0x500001: { - return ~BurnGunReturnX(0); - } - - case 0x500003: { - return BurnGunReturnY(0); - } - - case 0x500005: { - return ~BurnGunReturnX(1); - } - - case 0x500007: { - return BurnGunReturnY(1); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Othunder68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x200000, 0x20ffff) - - switch (a) { - case 0x500001: - case 0x500003: - case 0x500005: - case 0x500007: { - nTaitoCyclesDone[0] += SekRun(10); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Othunder68KReadWord(UINT32 a) -{ - switch (a) { - case 0x090000: - case 0x090002: - case 0x090004: - case 0x090006: - case 0x090008: - case 0x09000a: - case 0x09000c: - case 0x09000e: { - return OthunderInputBypassRead((a - 0x090000) >> 1); - } - - case 0x100002: { - return TC0110PCRWordRead(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Othunder68KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x200000, 0x20ffff) - TC0100SCN0CtrlWordWrite_Map(0x220000) - - switch (a) { - case 0x090000: - case 0x090002: - case 0x090004: - case 0x090006: - case 0x090008: - case 0x09000a: - case 0x09000c: - case 0x09000e: { - OthunderInputBypassWrite((a - 0x090000) >> 1, d); - return; - } - - case 0x100000: - case 0x100002: - case 0x100004: { - TC0110PCRStep1RBSwapWordWrite(0, (a - 0x100000) >> 1, d); - return; - } - - case 0x300000: { - TC0140SYTPortWrite(d & 0xff); - return; - } - - case 0x300002: { - TC0140SYTCommWrite(d & 0xff); - return; - } - - case 0x500000: - case 0x500002: - case 0x500004: - case 0x500006: { - nTaitoCyclesDone[0] += SekRun(10); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - return; - } - - case 0x600000: - case 0x600002: { - // irq ack - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall OthunderZ80Read(UINT16 a) -{ - switch (a) { - case 0xe000: { - return BurnYM2610Read(0); - } - - case 0xe002: { - return BurnYM2610Read(2); - } - - case 0xe201: { - return TC0140SYTSlaveCommRead(); - } - - case 0xea00: { - return TaitoDip[0]; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall OthunderZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe000: { - BurnYM2610Write(0, d); - return; - } - - case 0xe001: { - BurnYM2610Write(1, d); - return; - } - - case 0xe002: { - BurnYM2610Write(2, d); - return; - } - - case 0xe003: { - BurnYM2610Write(3, d); - return; - } - - case 0xe200: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xe201: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xe400: - case 0xe401: - case 0xe402: - case 0xe403: { - INT32 lVol, rVol; - - OthunderPan[a & 0x0003] = d & 0x1f; - - rVol = (OthunderPan[0] + OthunderPan[2]) * 100 / (2 * 0x1f); - lVol = (OthunderPan[1] + OthunderPan[3]) * 100 / (2 * 0x1f); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, OthunderYM2610AY8910RouteMasterVol * lVol / 100.0); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, OthunderYM2610AY8910RouteMasterVol * rVol / 100.0); - - rVol = OthunderPan[0] * 100 / 0x1f; - lVol = OthunderPan[1] * 100 / 0x1f; - BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_1, OthunderYM2610Route1MasterVol * lVol / 100.0); - BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_1, OthunderYM2610Route1MasterVol * rVol / 100.0); - - /* CH2 */ - rVol = OthunderPan[2] * 100 / 0x1f; - lVol = OthunderPan[3] * 100 / 0x1f; - BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_2, OthunderYM2610Route2MasterVol * lVol / 100.0); - BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_2, OthunderYM2610Route2MasterVol * rVol / 100.0); - return; - } - - case 0xe600: { - // nop - return; - } - - case 0xee00: { - // nop - return; - } - - case 0xf000: { - // nop - return; - } - - case 0xf200: { - TaitoZ80Bank = (d - 1) & 7; - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static const eeprom_interface othunder_eeprom_interface = { - 6, /* address bits */ - 16, /* data bits */ - "0110", /* read command */ - "0101", /* write command */ - "0111", /* erase command */ - "0100000000", /* lock command */ - "0100111111", /* unlock command */ - 0, - 0 -}; - -static const UINT8 othunder_default_eeprom[128] = { - 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x41, 0x41, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xf0, 0xf0, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x41, 0x41, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xf0, 0xf0, - 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0xf0, 0x00, - 0x00, 0x01, 0x42, 0x85, 0x00, 0x00, 0xf1, 0xe3, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0xf0, 0x00, - 0x00, 0x01, 0x42, 0x85, 0x00, 0x00, 0xf1, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -}; - -static void OthunderFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 OthunderSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / (16000000 / 4); -} - -static double OthunderGetTime() -{ - return (double)ZetTotalCycles() / (16000000 / 4); -} - -static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 CharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; -static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 SpritePlaneOffsets[4] = { 0, 8, 16, 24 }; -static INT32 SpriteXOffsets[16] = { 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 SpriteYOffsets[8] = { 0, 64, 128, 192, 256, 320, 384, 448 }; - -static void SwitchToMusashi() -{ - if (bBurnUseASMCPUEmulation) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); -#endif - bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; - bBurnUseASMCPUEmulation = false; - } -} - -static INT32 OthunderInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 8; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x8000; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - TaitoNumEEPROM = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 4, 8, 1, NULL); - TC0110PCRInit(1, 0x1000); - TC0140SYTInit(); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x080000, 0x08ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x200000, 0x20ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x400000, 0x4005ff, SM_RAM); - SekSetReadWordHandler(0, Othunder68KReadWord); - SekSetWriteWordHandler(0, Othunder68KWriteWord); - SekSetReadByteHandler(0, Othunder68KReadByte); - SekSetWriteByteHandler(0, Othunder68KWriteByte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(OthunderZ80Read); - ZetSetWriteHandler(OthunderZ80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &OthunderFMIRQHandler, OthunderSynchroniseStream, OthunderGetTime, 0); - BurnTimerAttachZet(16000000 / 4); - OthunderYM2610AY8910RouteMasterVol = 0.25; - OthunderYM2610Route1MasterVol = 1.00; - OthunderYM2610Route2MasterVol = 1.00; - bYM2610UseSeperateVolumes = 1; - - EEPROMInit(&othunder_eeprom_interface); - if (!EEPROMAvailable()) EEPROMFill(TaitoDefaultEEProm, 0, 128); - - TaitoMakeInputsFunction = OthunderMakeInputs; - TaitoDrawFunction = OthunderDraw; - TaitoIrqLine = 5; - TaitoFrameInterleave = 100; - TaitoFlipScreenX = 1; - - nTaitoCyclesTotal[0] = 13000000 / 60; - nTaitoCyclesTotal[1] = (16000000 / 4) / 60; - - BurnGunInit(2, true); - - // Reset the driver - OthunderDoReset(); - - return 0; -} - -static INT32 OthunderExit() -{ - TaitoExit(); - - // Switch back CPU core if needed - if (bUseAsm68KCoreOldValue) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); -#endif - bUseAsm68KCoreOldValue = false; - bBurnUseASMCPUEmulation = true; - } - - return 0; -} - -static void RenderSpriteZoom(INT32 Code, INT32 sx, INT32 sy, INT32 Colour, INT32 xFlip, INT32 yFlip, INT32 xScale, INT32 yScale, UINT8* pSource) -{ - // We can use sprite A for sizes, etc. as only Chase HQ uses sprite B and it has the same sizes and count - - UINT8 *SourceBase = pSource + ((Code % TaitoNumSpriteA) * TaitoSpriteAWidth * TaitoSpriteAHeight); - - INT32 SpriteScreenHeight = (yScale * TaitoSpriteAHeight + 0x8000) >> 16; - INT32 SpriteScreenWidth = (xScale * TaitoSpriteAWidth + 0x8000) >> 16; - - Colour = 0x10 * (Colour % 0x100); - - if (TaitoFlipScreenX) { - xFlip = !xFlip; - sx = 320 - sx - (xScale >> 12); - } - - if (SpriteScreenWidth && SpriteScreenHeight) { - INT32 dx = (TaitoSpriteAWidth << 16) / SpriteScreenWidth; - INT32 dy = (TaitoSpriteAHeight << 16) / SpriteScreenHeight; - - INT32 ex = sx + SpriteScreenWidth; - INT32 ey = sy + SpriteScreenHeight; - - INT32 xIndexBase; - INT32 yIndex; - - if (xFlip) { - xIndexBase = (SpriteScreenWidth - 1) * dx; - dx = -dx; - } else { - xIndexBase = 0; - } - - if (yFlip) { - yIndex = (SpriteScreenHeight - 1) * dy; - dy = -dy; - } else { - yIndex = 0; - } - - if (sx < 0) { - INT32 Pixels = 0 - sx; - sx += Pixels; - xIndexBase += Pixels * dx; - } - - if (sy < 0) { - INT32 Pixels = 0 - sy; - sy += Pixels; - yIndex += Pixels * dy; - } - - if (ex > nScreenWidth) { - INT32 Pixels = ex - nScreenWidth; - ex -= Pixels; - } - - if (ey > nScreenHeight) { - INT32 Pixels = ey - nScreenHeight; - ey -= Pixels; - } - - if (ex > sx) { - INT32 y; - - for (y = sy; y < ey; y++) { - UINT8 *Source = SourceBase + ((yIndex >> 16) * TaitoSpriteAWidth); - UINT16* pPixel = pTransDraw + (y * nScreenWidth); - - INT32 x, xIndex = xIndexBase; - for (x = sx; x < ex; x++) { - INT32 c = Source[xIndex >> 16]; - if (c != 0) { - pPixel[x] = c | Colour; - } - xIndex += dx; - } - - yIndex += dy; - } - } - } -} - -static void OthunderRenderSprites(INT32 PriorityDraw) -{ - UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - INT32 Offset, Data, Tile, Colour, xFlip, yFlip; - INT32 x, y, Priority, xCur, yCur; - INT32 xZoom, yZoom, zx, zy; - INT32 SpriteChunk, MapOffset, Code, j, k, px, py; - INT32 BadChunks; - - for (Offset = 0x300 - 4; Offset >= 0; Offset -= 4) { - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); - Priority = (Data & 0x8000) >> 15; - - if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); - if (Priority != PriorityDraw) continue; - - xFlip = (Data & 0x4000) >> 14; - x = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); - yFlip = (Data & 0x8000) >> 15; - Tile = Data & 0x1fff; - if (!Tile) continue; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); - yZoom = (Data & 0xfe00) >> 9; - y = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); - Colour = (Data & 0xff00) >> 8; - xZoom = (Data & 0x7f); - - MapOffset = Tile << 5; - - xZoom += 1; - yZoom += 1; - - y += 3; - - if (x > 0x140) x -= 0x200; - if (y > 0x140) y -= 0x200; - - BadChunks = 0; - - for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { - k = SpriteChunk % 4; - j = SpriteChunk / 4; - - px = xFlip ? (3 - k) : k; - py = yFlip ? (7 - j) : j; - - Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); - Code &= (TaitoNumSpriteA - 1); - - if (Code == 0xffff) { - BadChunks += 1; - continue; - } - - xCur = x + ((k * xZoom) / 4); - yCur = y + ((j * yZoom) / 8); - - zx = x + (((k + 1) * xZoom) / 4) - xCur; - zy = y + (((j + 1) * yZoom) / 8) - yCur; - - yCur -= 16; - - RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); - } - - } -} - -static void OthunderDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); - OthunderRenderSprites(1); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); - OthunderRenderSprites(1); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - OthunderRenderSprites(0); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TC0110PCRPalette); - - for (INT32 i = 0; i < nBurnGunNumPlayers; i++) { - BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); - } -} - -static INT32 OthunderFrame() -{ - INT32 nInterleave = TaitoFrameInterleave; - - if (TaitoReset) OthunderDoReset(); - - TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 #1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == (TaitoFrameInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - - ZetOpen(0); - BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[1]); - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) TaitoDrawFunction(); - - return 0; -} - -static INT32 OthunderScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029709; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = TaitoRamStart; - ba.nLen = TaitoRamEnd-TaitoRamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - TaitoICScan(nAction); - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2610Scan(nAction, pnMin); - - BurnGunScan(); - - SCAN_VAR(TaitoInput); - SCAN_VAR(TaitoZ80Bank); - SCAN_VAR(nTaitoCyclesDone); - SCAN_VAR(nTaitoCyclesSegment); - } - - if (nAction & ACB_WRITE) { - if (TaitoZ80Bank) { - ZetOpen(0); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetClose(); - } - } - - return 0; -} - -struct BurnDriver BurnDrvOthunder = { - "othunder", NULL, NULL, NULL, "1988", - "Operation Thunderbolt (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, OthunderRomInfo, OthunderRomName, NULL, NULL, OthunderInputInfo, OthunderDIPInfo, - OthunderInit, OthunderExit, OthunderFrame, NULL, OthunderScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvOthunderu = { - "othunderu", "othunder", NULL, NULL, "1988", - "Operation Thunderbolt (US)\0", NULL, "Taito America Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, OthunderuRomInfo, OthunderuRomName, NULL, NULL, OthunderInputInfo, OthunderuDIPInfo, - OthunderInit, OthunderExit, OthunderFrame, NULL, OthunderScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvOthunderuo = { - "othunderuo", "othunder", NULL, NULL, "1988", - "Operation Thunderbolt (US, older)\0", NULL, "Taito America Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, OthunderuoRomInfo, OthunderuoRomName, NULL, NULL, OthunderInputInfo, OthunderuDIPInfo, - OthunderInit, OthunderExit, OthunderFrame, NULL, OthunderScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvOthunderj = { - "othunderj", "othunder", NULL, NULL, "1988", - "Operation Thunderbolt (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, OthunderjRomInfo, OthunderjRomName, NULL, NULL, OthunderInputInfo, OthunderjDIPInfo, - OthunderInit, OthunderExit, OthunderFrame, NULL, OthunderScan, - NULL, 0x1000, 320, 240, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "taito.h" +#include "taito_ic.h" +#include "burn_ym2610.h" +#include "eeprom.h" +#include "burn_gun.h" + +static void OthunderDraw(); + +static double OthunderYM2610AY8910RouteMasterVol; +static double OthunderYM2610Route1MasterVol; +static double OthunderYM2610Route2MasterVol; +static UINT8 *OthunderPan; + +static bool bUseAsm68KCoreOldValue = false; + +#define A(a, b, c, d) {a, b, (UINT8*)(c), d} + +static struct BurnInputInfo OthunderInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p2 start" }, + + A("P1 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "mouse x-axis" ), + A("P1 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "mouse y-axis" ), + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "mouse button 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "mouse button 2" }, + + A("P2 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort2 , "p2 x-axis" ), + A("P2 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort3 , "p2 y-axis" ), + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, + {"Dip 3" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, +}; + +STDINPUTINFO(Othunder) + +#undef A + +static void TC0220IOCMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0xff; + TC0220IOCInput[1] = 0xff; + TC0220IOCInput[2] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + TC0220IOCInput[0] -= (TC0220IOCInputPort0[i] & 1) << i; + TC0220IOCInput[1] -= (TC0220IOCInputPort1[i] & 1) << i; + TC0220IOCInput[2] -= (TC0220IOCInputPort2[i] & 1) << i; + } +} + +static void OthunderMakeInputs() +{ + TC0220IOCMakeInputs(); + + BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); + BurnGunMakeInputs(1, (INT16)TaitoAnalogPort2, (INT16)TaitoAnalogPort3); +} + +static struct BurnDIPInfo OthunderDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0xff, NULL }, + {0x0f, 0xff, 0xff, 0x7f, NULL }, + {0x10, 0xff, 0xff, 0x07, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0e, 0x01, 0x02, 0x00, "Off" }, + {0x0e, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0e, 0x01, 0x04, 0x04, "Off" }, + {0x0e, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0e, 0x01, 0x08, 0x00, "Off" }, + {0x0e, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0e, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0e, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0e, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0e, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x0e, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x0e, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x0e, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0f, 0x01, 0x03, 0x02, "Easy" }, + {0x0f, 0x01, 0x03, 0x03, "Medium" }, + {0x0f, 0x01, 0x03, 0x01, "Hard" }, + {0x0f, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Magazines/Rockets" }, + {0x0f, 0x01, 0x0c, 0x0c, "5/3" }, + {0x0f, 0x01, 0x0c, 0x08, "6/4" }, + {0x0f, 0x01, 0x0c, 0x04, "7/5" }, + {0x0f, 0x01, 0x0c, 0x00, "8/6" }, + + {0 , 0xfe, 0 , 4 , "Bullets per Magazine" }, + {0x0f, 0x01, 0x30, 0x00, "30" }, + {0x0f, 0x01, 0x30, 0x10, "35" }, + {0x0f, 0x01, 0x30, 0x30, "40" }, + {0x0f, 0x01, 0x30, 0x20, "50" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x80, 0x00, "English" }, + {0x0f, 0x01, 0x80, 0x80, "Japanese" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Stereo Seperation" }, + {0x10, 0x01, 0x07, 0x07, "Maximum" }, + {0x10, 0x01, 0x07, 0x03, "High" }, + {0x10, 0x01, 0x07, 0x01, "Medium" }, + {0x10, 0x01, 0x07, 0x00, "Low" }, +}; + +STDDIPINFO(Othunder) + +static struct BurnDIPInfo OthunderjDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0xff, NULL }, + {0x0f, 0xff, 0xff, 0x7f, NULL }, + {0x10, 0xff, 0xff, 0x07, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0e, 0x01, 0x02, 0x00, "Off" }, + {0x0e, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0e, 0x01, 0x04, 0x04, "Off" }, + {0x0e, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0e, 0x01, 0x08, 0x00, "Off" }, + {0x0e, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0e, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0e, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0e, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0e, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0f, 0x01, 0x03, 0x02, "Easy" }, + {0x0f, 0x01, 0x03, 0x03, "Medium" }, + {0x0f, 0x01, 0x03, 0x01, "Hard" }, + {0x0f, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Magazines/Rockets" }, + {0x0f, 0x01, 0x0c, 0x0c, "5/3" }, + {0x0f, 0x01, 0x0c, 0x08, "6/4" }, + {0x0f, 0x01, 0x0c, 0x04, "7/5" }, + {0x0f, 0x01, 0x0c, 0x00, "8/6" }, + + {0 , 0xfe, 0 , 4 , "Bullets per Magazine" }, + {0x0f, 0x01, 0x30, 0x00, "30" }, + {0x0f, 0x01, 0x30, 0x10, "35" }, + {0x0f, 0x01, 0x30, 0x30, "40" }, + {0x0f, 0x01, 0x30, 0x20, "50" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x80, 0x00, "English" }, + {0x0f, 0x01, 0x80, 0x80, "Japanese" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Stereo Seperation" }, + {0x10, 0x01, 0x07, 0x07, "Maximum" }, + {0x10, 0x01, 0x07, 0x03, "High" }, + {0x10, 0x01, 0x07, 0x01, "Medium" }, + {0x10, 0x01, 0x07, 0x00, "Low" }, +}; + +STDDIPINFO(Othunderj) + +static struct BurnDIPInfo OthunderuDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0xff, NULL }, + {0x0f, 0xff, 0xff, 0x7f, NULL }, + {0x10, 0xff, 0xff, 0x07, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0e, 0x01, 0x02, 0x00, "Off" }, + {0x0e, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0e, 0x01, 0x04, 0x04, "Off" }, + {0x0e, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0e, 0x01, 0x08, 0x00, "Off" }, + {0x0e, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0e, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0e, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0e, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0e, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0f, 0x01, 0x03, 0x02, "Easy" }, + {0x0f, 0x01, 0x03, 0x03, "Medium" }, + {0x0f, 0x01, 0x03, 0x01, "Hard" }, + {0x0f, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Magazines/Rockets" }, + {0x0f, 0x01, 0x0c, 0x0c, "5/3" }, + {0x0f, 0x01, 0x0c, 0x08, "6/4" }, + {0x0f, 0x01, 0x0c, 0x04, "7/5" }, + {0x0f, 0x01, 0x0c, 0x00, "8/6" }, + + {0 , 0xfe, 0 , 4 , "Bullets per Magazine" }, + {0x0f, 0x01, 0x30, 0x00, "30" }, + {0x0f, 0x01, 0x30, 0x10, "35" }, + {0x0f, 0x01, 0x30, 0x30, "40" }, + {0x0f, 0x01, 0x30, 0x20, "50" }, + + {0 , 0xfe, 0 , 2 , "Continue Price" }, + {0x0f, 0x01, 0x40, 0x00, "1 Coin 1 Credit" }, + {0x0f, 0x01, 0x40, 0x40, "Same as Start" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x80, 0x00, "English" }, + {0x0f, 0x01, 0x80, 0x80, "Japanese" }, + + // Dip 3 + {0 , 0xfe, 0 , 4 , "Stereo Seperation" }, + {0x10, 0x01, 0x07, 0x07, "Maximum" }, + {0x10, 0x01, 0x07, 0x03, "High" }, + {0x10, 0x01, 0x07, 0x01, "Medium" }, + {0x10, 0x01, 0x07, 0x00, "Low" }, +}; + +STDDIPINFO(Othunderu) + +static struct BurnRomInfo OthunderRomDesc[] = { + { "b67-20.63", 0x20000, 0x21439ea2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-23.64", 0x20000, 0x789e9daa, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-14.61", 0x20000, 0x7f3dd724, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-15.62", 0x20000, 0xe84f62d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b67-13.40", 0x10000, 0x2936b4b1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b67-06.66", 0x80000, 0xb9a38d64, BRF_GRA | TAITO_CHARS}, + + { "b67-01", 0x80000, 0x81ad9acb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-02", 0x80000, 0xc20cd2fb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-03", 0x80000, 0xbc9019ed, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-04", 0x80000, 0x2af4c8af, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b67-05.43", 0x80000, 0x9593e42b, BRF_GRA | TAITO_SPRITEMAP }, + + { "b67-08", 0x80000, 0x458f41fb, BRF_SND | TAITO_YM2610A }, + + { "b67-07", 0x80000, 0x4f834357, BRF_SND | TAITO_YM2610B }, + + { "eeprom-othunder.bin", 0x00080, 0x3729b844, BRF_PRG | TAITO_DEFAULT_EEPROM }, + + { "plhs18p8b-b67-09.ic15", 0x00149, 0x62035487, BRF_OPT }, + { "pal16l8a-b67-11.ic36", 0x00104, 0x3177fb06, BRF_OPT }, + { "pal20l8b-b67-12.ic37", 0x00144, 0xa47c2798, BRF_OPT }, + { "pal20l8b-b67-10.ic33", 0x00144, 0x4ced09c7, BRF_OPT }, +}; + +STD_ROM_PICK(Othunder) +STD_ROM_FN(Othunder) + +static struct BurnRomInfo OthunderuRomDesc[] = { + { "b67-20-1.63", 0x20000, 0x851a453b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-22-1.64", 0x20000, 0x19480dc0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-14.61", 0x20000, 0x7f3dd724, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-15.62", 0x20000, 0xe84f62d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b67-13.40", 0x10000, 0x2936b4b1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b67-06.66", 0x80000, 0xb9a38d64, BRF_GRA | TAITO_CHARS}, + + { "b67-01", 0x80000, 0x81ad9acb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-02", 0x80000, 0xc20cd2fb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-03", 0x80000, 0xbc9019ed, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-04", 0x80000, 0x2af4c8af, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b67-05.43", 0x80000, 0x9593e42b, BRF_GRA | TAITO_SPRITEMAP }, + + { "b67-08", 0x80000, 0x458f41fb, BRF_SND | TAITO_YM2610A }, + + { "b67-07", 0x80000, 0x4f834357, BRF_SND | TAITO_YM2610B }, + + { "eeprom-othunder.bin", 0x00080, 0x3729b844, BRF_PRG | TAITO_DEFAULT_EEPROM }, + + { "plhs18p8b-b67-09.ic15", 0x00149, 0x62035487, BRF_OPT }, + { "pal16l8a-b67-11.ic36", 0x00104, 0x3177fb06, BRF_OPT }, + { "pal20l8b-b67-12.ic37", 0x00144, 0xa47c2798, BRF_OPT }, + { "pal20l8b-b67-10.ic33", 0x00144, 0x4ced09c7, BRF_OPT }, +}; + +STD_ROM_PICK(Othunderu) +STD_ROM_FN(Othunderu) + +static struct BurnRomInfo OthunderuoRomDesc[] = { + { "b67-20.63", 0x20000, 0x21439ea2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-22.64", 0x20000, 0x0f99ad3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-14.61", 0x20000, 0x7f3dd724, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-15.62", 0x20000, 0xe84f62d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b67-13.40", 0x10000, 0x2936b4b1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b67-06.66", 0x80000, 0xb9a38d64, BRF_GRA | TAITO_CHARS}, + + { "b67-01", 0x80000, 0x81ad9acb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-02", 0x80000, 0xc20cd2fb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-03", 0x80000, 0xbc9019ed, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-04", 0x80000, 0x2af4c8af, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b67-05.43", 0x80000, 0x9593e42b, BRF_GRA | TAITO_SPRITEMAP }, + + { "b67-08", 0x80000, 0x458f41fb, BRF_SND | TAITO_YM2610A }, + + { "b67-07", 0x80000, 0x4f834357, BRF_SND | TAITO_YM2610B }, + + { "eeprom-othunder.bin", 0x00080, 0x3729b844, BRF_PRG | TAITO_DEFAULT_EEPROM }, + + { "plhs18p8b-b67-09.ic15", 0x00149, 0x62035487, BRF_OPT }, + { "pal16l8a-b67-11.ic36", 0x00104, 0x3177fb06, BRF_OPT }, + { "pal20l8b-b67-12.ic37", 0x00144, 0xa47c2798, BRF_OPT }, + { "pal20l8b-b67-10.ic33", 0x00144, 0x4ced09c7, BRF_OPT }, +}; + +STD_ROM_PICK(Othunderuo) +STD_ROM_FN(Othunderuo) + +static struct BurnRomInfo OthunderjRomDesc[] = { + { "b67-20.63", 0x20000, 0x21439ea2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-21.64", 0x20000, 0x9690fc86, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-14.61", 0x20000, 0x7f3dd724, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b67-15.62", 0x20000, 0xe84f62d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b67-13.40", 0x10000, 0x2936b4b1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b67-06.66", 0x80000, 0xb9a38d64, BRF_GRA | TAITO_CHARS}, + + { "b67-01", 0x80000, 0x81ad9acb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-02", 0x80000, 0xc20cd2fb, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-03", 0x80000, 0xbc9019ed, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b67-04", 0x80000, 0x2af4c8af, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b67-05.43", 0x80000, 0x9593e42b, BRF_GRA | TAITO_SPRITEMAP }, + + { "b67-08", 0x80000, 0x458f41fb, BRF_SND | TAITO_YM2610A }, + + { "b67-07", 0x80000, 0x4f834357, BRF_SND | TAITO_YM2610B }, + + { "eeprom-othunder.bin", 0x00080, 0x3729b844, BRF_PRG | TAITO_DEFAULT_EEPROM }, + + { "plhs18p8b-b67-09.ic15", 0x00149, 0x62035487, BRF_OPT }, + { "pal16l8a-b67-11.ic36", 0x00104, 0x3177fb06, BRF_OPT }, + { "pal20l8b-b67-12.ic37", 0x00144, 0xa47c2798, BRF_OPT }, + { "pal20l8b-b67-10.ic33", 0x00144, 0x4ced09c7, BRF_OPT }, +}; + +STD_ROM_PICK(Othunderj) +STD_ROM_FN(Othunderj) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += Taito68KRom1Size; + TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; + TaitoSpriteMapRom = Next; Next += TaitoSpriteMapRomSize; + TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; + TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; + TaitoDefaultEEProm = Next; Next += TaitoDefaultEEPromSize; + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x10000; + TaitoZ80Ram1 = Next; Next += 0x02000; + TaitoSpriteRam = Next; Next += 0x00600; + OthunderPan = Next; Next += 0x00004; + + TaitoRamEnd = Next; + + TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; + TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; + TaitoPalette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); + + TaitoMemEnd = Next; + + return 0; +} + +static INT32 OthunderDoReset() +{ + TaitoDoReset(); + + return 0; +} + +static UINT8 OthunderInputBypassRead(INT32 Offset) +{ + switch (Offset) { + case 0x03: { + return (EEPROMRead() & 1) << 7; + } + + default: { + return TC0220IOCRead(Offset); + } + } + + return 0; +} + +static void OthunderInputBypassWrite(INT32 Offset, UINT16 Data) +{ + switch (Offset) { + case 0x03: { + EEPROMWrite(Data & 0x20, Data & 0x10, Data & 0x40); + return; + } + + default: { + TC0220IOCWrite(Offset, Data & 0xff); + } + } +} + +UINT8 __fastcall Othunder68KReadByte(UINT32 a) +{ + switch (a) { + case 0x500001: { + return ~BurnGunReturnX(0); + } + + case 0x500003: { + return BurnGunReturnY(0); + } + + case 0x500005: { + return ~BurnGunReturnX(1); + } + + case 0x500007: { + return BurnGunReturnY(1); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Othunder68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x200000, 0x20ffff) + + switch (a) { + case 0x500001: + case 0x500003: + case 0x500005: + case 0x500007: { + nTaitoCyclesDone[0] += SekRun(10); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Othunder68KReadWord(UINT32 a) +{ + switch (a) { + case 0x090000: + case 0x090002: + case 0x090004: + case 0x090006: + case 0x090008: + case 0x09000a: + case 0x09000c: + case 0x09000e: { + return OthunderInputBypassRead((a - 0x090000) >> 1); + } + + case 0x100002: { + return TC0110PCRWordRead(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Othunder68KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x200000, 0x20ffff) + TC0100SCN0CtrlWordWrite_Map(0x220000) + + switch (a) { + case 0x090000: + case 0x090002: + case 0x090004: + case 0x090006: + case 0x090008: + case 0x09000a: + case 0x09000c: + case 0x09000e: { + OthunderInputBypassWrite((a - 0x090000) >> 1, d); + return; + } + + case 0x100000: + case 0x100002: + case 0x100004: { + TC0110PCRStep1RBSwapWordWrite(0, (a - 0x100000) >> 1, d); + return; + } + + case 0x300000: { + TC0140SYTPortWrite(d & 0xff); + return; + } + + case 0x300002: { + TC0140SYTCommWrite(d & 0xff); + return; + } + + case 0x500000: + case 0x500002: + case 0x500004: + case 0x500006: { + nTaitoCyclesDone[0] += SekRun(10); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + return; + } + + case 0x600000: + case 0x600002: { + // irq ack + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall OthunderZ80Read(UINT16 a) +{ + switch (a) { + case 0xe000: { + return BurnYM2610Read(0); + } + + case 0xe002: { + return BurnYM2610Read(2); + } + + case 0xe201: { + return TC0140SYTSlaveCommRead(); + } + + case 0xea00: { + return TaitoDip[0]; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall OthunderZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe000: { + BurnYM2610Write(0, d); + return; + } + + case 0xe001: { + BurnYM2610Write(1, d); + return; + } + + case 0xe002: { + BurnYM2610Write(2, d); + return; + } + + case 0xe003: { + BurnYM2610Write(3, d); + return; + } + + case 0xe200: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xe201: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xe400: + case 0xe401: + case 0xe402: + case 0xe403: { + INT32 lVol, rVol; + + OthunderPan[a & 0x0003] = d & 0x1f; + + rVol = (OthunderPan[0] + OthunderPan[2]) * 100 / (2 * 0x1f); + lVol = (OthunderPan[1] + OthunderPan[3]) * 100 / (2 * 0x1f); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, OthunderYM2610AY8910RouteMasterVol * lVol / 100.0); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, OthunderYM2610AY8910RouteMasterVol * rVol / 100.0); + + rVol = OthunderPan[0] * 100 / 0x1f; + lVol = OthunderPan[1] * 100 / 0x1f; + BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_1, OthunderYM2610Route1MasterVol * lVol / 100.0); + BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_1, OthunderYM2610Route1MasterVol * rVol / 100.0); + + /* CH2 */ + rVol = OthunderPan[2] * 100 / 0x1f; + lVol = OthunderPan[3] * 100 / 0x1f; + BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_2, OthunderYM2610Route2MasterVol * lVol / 100.0); + BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_2, OthunderYM2610Route2MasterVol * rVol / 100.0); + return; + } + + case 0xe600: { + // nop + return; + } + + case 0xee00: { + // nop + return; + } + + case 0xf000: { + // nop + return; + } + + case 0xf200: { + TaitoZ80Bank = (d - 1) & 7; + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static const eeprom_interface othunder_eeprom_interface = { + 6, /* address bits */ + 16, /* data bits */ + "0110", /* read command */ + "0101", /* write command */ + "0111", /* erase command */ + "0100000000", /* lock command */ + "0100111111", /* unlock command */ + 0, + 0 +}; + +static const UINT8 othunder_default_eeprom[128] = { + 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x41, 0x41, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xf0, 0xf0, + 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x41, 0x41, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xf0, 0xf0, + 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0xf0, 0x00, + 0x00, 0x01, 0x42, 0x85, 0x00, 0x00, 0xf1, 0xe3, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0xf0, 0x00, + 0x00, 0x01, 0x42, 0x85, 0x00, 0x00, 0xf1, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +static void OthunderFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 OthunderSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / (16000000 / 4); +} + +static double OthunderGetTime() +{ + return (double)ZetTotalCycles() / (16000000 / 4); +} + +static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 CharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; +static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 SpritePlaneOffsets[4] = { 0, 8, 16, 24 }; +static INT32 SpriteXOffsets[16] = { 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 SpriteYOffsets[8] = { 0, 64, 128, 192, 256, 320, 384, 448 }; + +static void SwitchToMusashi() +{ + if (bBurnUseASMCPUEmulation) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); +#endif + bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; + bBurnUseASMCPUEmulation = false; + } +} + +static INT32 OthunderInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 8; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x8000; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + TaitoNumEEPROM = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 4, 8, 1, NULL); + TC0110PCRInit(1, 0x1000); + TC0140SYTInit(); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x080000, 0x08ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x200000, 0x20ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x400000, 0x4005ff, SM_RAM); + SekSetReadWordHandler(0, Othunder68KReadWord); + SekSetWriteWordHandler(0, Othunder68KWriteWord); + SekSetReadByteHandler(0, Othunder68KReadByte); + SekSetWriteByteHandler(0, Othunder68KWriteByte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(OthunderZ80Read); + ZetSetWriteHandler(OthunderZ80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &OthunderFMIRQHandler, OthunderSynchroniseStream, OthunderGetTime, 0); + BurnTimerAttachZet(16000000 / 4); + OthunderYM2610AY8910RouteMasterVol = 0.25; + OthunderYM2610Route1MasterVol = 1.00; + OthunderYM2610Route2MasterVol = 1.00; + bYM2610UseSeperateVolumes = 1; + + EEPROMInit(&othunder_eeprom_interface); + if (!EEPROMAvailable()) EEPROMFill(TaitoDefaultEEProm, 0, 128); + + TaitoMakeInputsFunction = OthunderMakeInputs; + TaitoDrawFunction = OthunderDraw; + TaitoIrqLine = 5; + TaitoFrameInterleave = 100; + TaitoFlipScreenX = 1; + + nTaitoCyclesTotal[0] = 13000000 / 60; + nTaitoCyclesTotal[1] = (16000000 / 4) / 60; + + BurnGunInit(2, true); + + // Reset the driver + OthunderDoReset(); + + return 0; +} + +static INT32 OthunderExit() +{ + TaitoExit(); + + // Switch back CPU core if needed + if (bUseAsm68KCoreOldValue) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); +#endif + bUseAsm68KCoreOldValue = false; + bBurnUseASMCPUEmulation = true; + } + + return 0; +} + +static void RenderSpriteZoom(INT32 Code, INT32 sx, INT32 sy, INT32 Colour, INT32 xFlip, INT32 yFlip, INT32 xScale, INT32 yScale, UINT8* pSource) +{ + // We can use sprite A for sizes, etc. as only Chase HQ uses sprite B and it has the same sizes and count + + UINT8 *SourceBase = pSource + ((Code % TaitoNumSpriteA) * TaitoSpriteAWidth * TaitoSpriteAHeight); + + INT32 SpriteScreenHeight = (yScale * TaitoSpriteAHeight + 0x8000) >> 16; + INT32 SpriteScreenWidth = (xScale * TaitoSpriteAWidth + 0x8000) >> 16; + + Colour = 0x10 * (Colour % 0x100); + + if (TaitoFlipScreenX) { + xFlip = !xFlip; + sx = 320 - sx - (xScale >> 12); + } + + if (SpriteScreenWidth && SpriteScreenHeight) { + INT32 dx = (TaitoSpriteAWidth << 16) / SpriteScreenWidth; + INT32 dy = (TaitoSpriteAHeight << 16) / SpriteScreenHeight; + + INT32 ex = sx + SpriteScreenWidth; + INT32 ey = sy + SpriteScreenHeight; + + INT32 xIndexBase; + INT32 yIndex; + + if (xFlip) { + xIndexBase = (SpriteScreenWidth - 1) * dx; + dx = -dx; + } else { + xIndexBase = 0; + } + + if (yFlip) { + yIndex = (SpriteScreenHeight - 1) * dy; + dy = -dy; + } else { + yIndex = 0; + } + + if (sx < 0) { + INT32 Pixels = 0 - sx; + sx += Pixels; + xIndexBase += Pixels * dx; + } + + if (sy < 0) { + INT32 Pixels = 0 - sy; + sy += Pixels; + yIndex += Pixels * dy; + } + + if (ex > nScreenWidth) { + INT32 Pixels = ex - nScreenWidth; + ex -= Pixels; + } + + if (ey > nScreenHeight) { + INT32 Pixels = ey - nScreenHeight; + ey -= Pixels; + } + + if (ex > sx) { + INT32 y; + + for (y = sy; y < ey; y++) { + UINT8 *Source = SourceBase + ((yIndex >> 16) * TaitoSpriteAWidth); + UINT16* pPixel = pTransDraw + (y * nScreenWidth); + + INT32 x, xIndex = xIndexBase; + for (x = sx; x < ex; x++) { + INT32 c = Source[xIndex >> 16]; + if (c != 0) { + pPixel[x] = c | Colour; + } + xIndex += dx; + } + + yIndex += dy; + } + } + } +} + +static void OthunderRenderSprites(INT32 PriorityDraw) +{ + UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + INT32 Offset, Data, Tile, Colour, xFlip, yFlip; + INT32 x, y, Priority, xCur, yCur; + INT32 xZoom, yZoom, zx, zy; + INT32 SpriteChunk, MapOffset, Code, j, k, px, py; + INT32 BadChunks; + + for (Offset = 0x300 - 4; Offset >= 0; Offset -= 4) { + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); + Priority = (Data & 0x8000) >> 15; + + if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); + if (Priority != PriorityDraw) continue; + + xFlip = (Data & 0x4000) >> 14; + x = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); + yFlip = (Data & 0x8000) >> 15; + Tile = Data & 0x1fff; + if (!Tile) continue; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); + yZoom = (Data & 0xfe00) >> 9; + y = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); + Colour = (Data & 0xff00) >> 8; + xZoom = (Data & 0x7f); + + MapOffset = Tile << 5; + + xZoom += 1; + yZoom += 1; + + y += 3; + + if (x > 0x140) x -= 0x200; + if (y > 0x140) y -= 0x200; + + BadChunks = 0; + + for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { + k = SpriteChunk % 4; + j = SpriteChunk / 4; + + px = xFlip ? (3 - k) : k; + py = yFlip ? (7 - j) : j; + + Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); + Code &= (TaitoNumSpriteA - 1); + + if (Code == 0xffff) { + BadChunks += 1; + continue; + } + + xCur = x + ((k * xZoom) / 4); + yCur = y + ((j * yZoom) / 8); + + zx = x + (((k + 1) * xZoom) / 4) - xCur; + zy = y + (((j + 1) * yZoom) / 8) - yCur; + + yCur -= 16; + + RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); + } + + } +} + +static void OthunderDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); + OthunderRenderSprites(1); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); + OthunderRenderSprites(1); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + OthunderRenderSprites(0); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TC0110PCRPalette); + + for (INT32 i = 0; i < nBurnGunNumPlayers; i++) { + BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); + } +} + +static INT32 OthunderFrame() +{ + INT32 nInterleave = TaitoFrameInterleave; + + if (TaitoReset) OthunderDoReset(); + + TaitoMakeInputsFunction(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 #1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == (TaitoFrameInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + + ZetOpen(0); + BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrame(nTaitoCyclesTotal[1]); + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) TaitoDrawFunction(); + + return 0; +} + +static INT32 OthunderScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029709; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = TaitoRamStart; + ba.nLen = TaitoRamEnd-TaitoRamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + TaitoICScan(nAction); + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2610Scan(nAction, pnMin); + + BurnGunScan(); + + SCAN_VAR(TaitoInput); + SCAN_VAR(TaitoZ80Bank); + SCAN_VAR(nTaitoCyclesDone); + SCAN_VAR(nTaitoCyclesSegment); + } + + if (nAction & ACB_WRITE) { + if (TaitoZ80Bank) { + ZetOpen(0); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetClose(); + } + } + + return 0; +} + +struct BurnDriver BurnDrvOthunder = { + "othunder", NULL, NULL, NULL, "1988", + "Operation Thunderbolt (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, OthunderRomInfo, OthunderRomName, NULL, NULL, OthunderInputInfo, OthunderDIPInfo, + OthunderInit, OthunderExit, OthunderFrame, NULL, OthunderScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvOthunderu = { + "othunderu", "othunder", NULL, NULL, "1988", + "Operation Thunderbolt (US)\0", NULL, "Taito America Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, OthunderuRomInfo, OthunderuRomName, NULL, NULL, OthunderInputInfo, OthunderuDIPInfo, + OthunderInit, OthunderExit, OthunderFrame, NULL, OthunderScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvOthunderuo = { + "othunderuo", "othunder", NULL, NULL, "1988", + "Operation Thunderbolt (US, older)\0", NULL, "Taito America Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, OthunderuoRomInfo, OthunderuoRomName, NULL, NULL, OthunderInputInfo, OthunderuDIPInfo, + OthunderInit, OthunderExit, OthunderFrame, NULL, OthunderScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvOthunderj = { + "othunderj", "othunder", NULL, NULL, "1988", + "Operation Thunderbolt (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, OthunderjRomInfo, OthunderjRomName, NULL, NULL, OthunderInputInfo, OthunderjDIPInfo, + OthunderInit, OthunderExit, OthunderFrame, NULL, OthunderScan, + NULL, 0x1000, 320, 240, 4, 3 +}; diff --git a/src/burn/drv/taito/d_retofinv.cpp b/src/burn/drv/taito/d_retofinv.cpp index d7a395c22..ae189eaae 100644 --- a/src/burn/drv/taito/d_retofinv.cpp +++ b/src/burn/drv/taito/d_retofinv.cpp @@ -1,992 +1,990 @@ -// FB Alpha Return of the Invaders driver module -// Based on MAME driver by Jarek Parchanski and Andrea Mazzoleni - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "taito_m68705.h" -#include "bitswap.h" -#include "sn76496.h" - -static UINT8 *AllMem; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *MemEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvZ80ROM2; -static UINT8 *DrvMcuROM; -static UINT8 *DrvGfxROM0; -static UINT8 *DrvGfxROM1; -static UINT8 *DrvGfxROM2; -static UINT8 *DrvColPROM; -static UINT8 *DrvFgVRAM; -static UINT8 *DrvBgVRAM; -static UINT8 *DrvShareRAM; -static UINT8 *DrvZ80RAM2; -static UINT8 *DrvMcuRAM; - -static UINT16 *DrvTileOfst; -static UINT8 *DrvColTable; -static UINT32 *Palette; -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *coinlockout; -static UINT8 *soundlatch; -static UINT8 *soundlatch2; -static UINT8 *flipscreen; -static UINT8 *gfxbank; - -static INT32 enable_interrupt[2]; -static INT32 disable_cpu[3]; - -static INT32 use_mcu; - -static INT32 watchdog; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[3]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static struct BurnInputInfo RetofinvInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 3, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 2, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Retofinv) - -static struct BurnDIPInfo RetofinvDIPList[]= -{ - {0x0d, 0xff, 0xff, 0x6f, NULL }, - {0x0e, 0xff, 0xff, 0x00, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x0d, 0x01, 0x03, 0x03, "30k, 80k & every 80k" }, - {0x0d, 0x01, 0x03, 0x02, "30k, 80k" }, - {0x0d, 0x01, 0x03, 0x01, "30k" }, - {0x0d, 0x01, 0x03, 0x00, "None" }, - - {0 , 0xfe, 0 , 2, "Free Play" }, - {0x0d, 0x01, 0x04, 0x04, "No" }, - {0x0d, 0x01, 0x04, 0x00, "Yes" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x0d, 0x01, 0x18, 0x18, "1" }, - {0x0d, 0x01, 0x18, 0x10, "2" }, - {0x0d, 0x01, 0x18, 0x08, "3" }, - {0x0d, 0x01, 0x18, 0x00, "5 (retofin2 4)" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x0d, 0x01, 0x40, 0x40, "Off" }, - {0x0d, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x0d, 0x01, 0x80, 0x00, "Upright" }, - {0x0d, 0x01, 0x80, 0x80, "Cocktail" }, - - {0 , 0xfe, 0 , 16, "Coin A" }, - {0x0e, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, - {0x0e, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, - {0x0e, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, - {0x0e, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, - {0x0e, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, - {0x0e, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, - {0x0e, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, - {0x0e, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, - {0x0e, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, - {0x0e, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, - {0x0e, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, - {0x0e, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, - {0x0e, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, - {0x0e, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, - {0x0e, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, - {0x0e, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 16, "Coin B" }, - {0x0e, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, - {0x0e, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, - {0x0e, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, - {0x0e, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, - {0x0e, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, - {0x0e, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, - {0x0e, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, - {0x0e, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, - {0x0e, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, - {0x0e, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, - {0x0e, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, - {0x0e, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, - {0x0e, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, - {0x0e, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, - {0x0e, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, - {0x0e, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, - - {0 , 0xfe, 0 , 2, "Push Start to Skip Stage (Cheat)" }, - {0x0f, 0x01, 0x01, 0x01, "Off" }, - {0x0f, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coin Per Play Display" }, - {0x0f, 0x01, 0x10, 0x00, "No" }, - {0x0f, 0x01, 0x10, 0x10, "Yes" }, - - {0 , 0xfe, 0 , 2, "Year Display" }, - {0x0f, 0x01, 0x20, 0x00, "No" }, - {0x0f, 0x01, 0x20, 0x20, "Yes" }, - - {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)" }, - {0x0f, 0x01, 0x40, 0x40, "Off" }, - {0x0f, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x0f, 0x01, 0x80, 0x80, "A and B" }, - {0x0f, 0x01, 0x80, 0x00, "A only" }, -}; - -STDDIPINFO(Retofinv) - -// Reset cpu and keep sync -static inline void retofinv_cpu_reset(INT32 cpu, INT32 data) -{ - INT32 cycles = ZetTotalCycles(); - ZetClose(); - ZetOpen(cpu); - cycles -= ZetTotalCycles(); - if (data) { - ZetIdle(cycles - ZetTotalCycles()); - } else { - ZetRun(cycles); - ZetReset(); - } - disable_cpu[cpu-1] = data; - ZetClose(); - ZetOpen(0); -} - -void __fastcall retofinv_main_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xb800: - *flipscreen = data & 1; - return; - - case 0xb801: - gfxbank[0] = data & 1; - return; - - case 0xb802: - gfxbank[1] = data & 1; - return; - - case 0xc800: - { - data &= 1; - if (!data) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - enable_interrupt[0] = data; - } - return; - - case 0xc801: - *coinlockout = (data & 1) * 0xff; - return; - - case 0xc802: - retofinv_cpu_reset(2, data); - return; - - case 0xc803: - m67805_taito_reset(); - disable_cpu[2] = data; - return; - - case 0xc804: - { - data &= 1; - if (!data) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - enable_interrupt[1] = data; - } - return; - - case 0xc805: - retofinv_cpu_reset(1, data); - return; - - case 0xd000: - watchdog = 0; - return; - - case 0xd800: - { - *soundlatch = data; - ZetClose(); - ZetOpen(2); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(0); - } - return; - - case 0xe800: - standard_taito_mcu_write(data); - return; - } -} - -UINT8 __fastcall retofinv_main_read(UINT16 address) -{ - switch (address) - { - case 0xc000: - return DrvInputs[0]; - - case 0xc001: - return DrvInputs[1]; - - case 0xc002: // must be < 0x80; - return 0; - - case 0xc003: // mcu status - { - INT32 res = 0; - if (!main_sent) res |= 0x10; - if (mcu_sent) res |= 0x20; - return res; - } - - case 0xc004: - return DrvInputs[2] & (*coinlockout | 0xcf); - - case 0xc005: - return DrvDips[0]; - - case 0xc006: - return DrvDips[1]; - - case 0xc007: - return DrvDips[2]; - - case 0xf800: - return *soundlatch2; - - case 0xe000: - return standard_taito_mcu_read(); - } - - return 0; -} - -void __fastcall retofinv_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0x6000: - *soundlatch2 = data; - return; - - case 0x8000: - SN76496Write(0, data); - return; - - case 0xa000: - SN76496Write(1, data); - return; - } -} - -UINT8 __fastcall retofinv_sound_read(UINT16 address) -{ - switch (address) - { - case 0x4000: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - DrvReset = 0; - - memset (AllRam, 0, RamEnd - AllRam); - - for (INT32 i = 0; i < 3; i++) { - ZetOpen(i); - ZetReset(); - ZetClose(); - } - - m67805_taito_reset(); - - enable_interrupt[0] = 0; - enable_interrupt[1] = 0; - disable_cpu[0] = 1; - disable_cpu[1] = 1; - disable_cpu[2] = 1; - - watchdog = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x010000; - DrvZ80ROM1 = Next; Next += 0x010000; - DrvZ80ROM2 = Next; Next += 0x010000; - - DrvMcuROM = Next; Next += 0x000800; - - DrvGfxROM0 = Next; Next += 0x010000; - DrvGfxROM1 = Next; Next += 0x010000; - DrvGfxROM2 = Next; Next += 0x008000; - - DrvColPROM = Next; Next += 0x000b00; - - AllRam = Next; - - DrvFgVRAM = Next; Next += 0x000800; - DrvBgVRAM = Next; Next += 0x000800; - DrvShareRAM = Next; Next += 0x001800; - - DrvZ80RAM2 = Next; Next += 0x000800; - - DrvMcuRAM = Next; Next += 0x000080; - - coinlockout = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - soundlatch2 = Next; Next += 0x000001; - flipscreen = Next; Next += 0x000001; - - gfxbank = Next; Next += 0x000002; - - RamEnd = Next; - - DrvColTable = Next; Next += 0x000a00; - Palette = (UINT32*)Next; Next += 0x0a00 * sizeof(UINT32); - DrvPalette = (UINT32*)Next; Next += 0x0a00 * sizeof(UINT32); - - DrvTileOfst = (UINT16*)Next; Next += 0x0400 * sizeof(UINT16); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvGfxDecode() -{ - INT32 Plane0[1] = { 0x00000 }; - INT32 Plane1[4] = { 0x00000, 0x20004, 0x20000, 0x00004 }; - INT32 XOffs0[8] = { 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000 }; - INT32 XOffs1[16] = { 0x000, 0x001, 0x002, 0x003, 0x040, 0x041, 0x042, 0x043, - 0x080, 0x081, 0x082, 0x083, 0x0c0, 0x0c1, 0x0c2, 0x0c3 }; - INT32 YOffs[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, - 0x100, 0x108, 0x110, 0x118, 0x120, 0x128, 0x130, 0x138 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(0x8000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM0, 0x2000); - - GfxDecode(0x0200, 1, 8, 8, Plane0, XOffs0, YOffs, 0x040, tmp, DrvGfxROM0); - - memcpy (tmp, DrvGfxROM1, 0x8000); - - GfxDecode(0x0100, 4, 16, 16, Plane1, XOffs1, YOffs, 0x200, tmp, DrvGfxROM1); - - memcpy (tmp, DrvGfxROM2, 0x8000); - - GfxDecode(0x0200, 4, 8, 8, Plane1, XOffs1, YOffs, 0x080, tmp, DrvGfxROM2); - - BurnFree (tmp); - - return 0; -} - -static void DrvPaletteInit() -{ - for (INT32 i = 0; i < 0x100; i++) - { - INT32 r = DrvColPROM[i + 0x000] & 0x0f; - INT32 g = DrvColPROM[i + 0x100] & 0x0f; - INT32 b = DrvColPROM[i + 0x200] & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - DrvPalette[i] = (r << 16) | (g << 8) | b; - } - - for (INT32 i = 0; i < 0x200; i++) { // foreground - DrvColTable[i] = (i >> 1) * (i & 1); - Palette[i + 0x000] = DrvPalette[DrvColTable[i]]; - } - - for (INT32 i = 0; i < 0x800; i++) { // everything else - DrvColTable[i + 0x200] = BITSWAP08(DrvColPROM[i + 0x300],4,5,6,7,3,2,1,0); - Palette[i + 0x200] = DrvPalette[DrvColTable[i + 0x200]]; - DrvColTable[i + 0x200] = (DrvColTable[i + 0x200] == 0xff) ? 0 : 1; - } - - DrvRecalc = 1; -} - -// Calculate offsets for tiles on screen -static void DrvCalculateOffsets() -{ - for (INT32 offs = 0; offs < 36 * 28; offs++) { - INT32 col = (offs % 36) - 2; - INT32 row = (offs / 36) + 2; - - if (col & 0x20) - DrvTileOfst[offs] = ((col & 0x1f) << 5) + row; - else - DrvTileOfst[offs] = (row << 5) + col; - } -} - -static INT32 DecodeBoot3PROMs() -{ - UINT8 *tmp = DrvGfxROM2 + 0x8000; // empty before gfx decode - - if (BurnLoadRom(tmp + 0x000, 16, 1)) return 1; - if (BurnLoadRom(tmp + 0x400, 18, 1)) return 1; - if (BurnLoadRom(tmp + 0x800, 15, 1)) return 1; - if (BurnLoadRom(tmp + 0xc00, 17, 1)) return 1; - - for (INT32 i = 0; i < 0x800; i++) { - DrvColPROM[i + 0x300] = (tmp[i] & 0x0f) | (tmp[i + 0x800] << 4); - } - - memset (tmp, 0, 0x1000); - - return 0; -} - -static INT32 DrvInit() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1; - if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM2 + 0x00000, 4, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM1 + 0x00000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x02000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x04000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM1 + 0x06000, 9, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM2 + 0x04000, 11, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00000, 12, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00100, 13, 1)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00200, 14, 1)) return 1; - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "retofin3") == 0) { - DecodeBoot3PROMs(); - } else { - if (BurnLoadRom(DrvColPROM + 0x00300, 15, 1)) return 1; - - if (BurnLoadRom(DrvMcuROM + 0x00000, 16, 1)) return 1; - } - - DrvCalculateOffsets(); - DrvPaletteInit(); - DrvGfxDecode(); - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0x8000, 0x87ff, 0, DrvFgVRAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvFgVRAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvFgVRAM); - ZetMapArea(0x8800, 0x9fff, 0, DrvShareRAM); - ZetMapArea(0x8800, 0x9fff, 1, DrvShareRAM); - ZetMapArea(0x8800, 0x9fff, 2, DrvShareRAM); - ZetMapArea(0xa000, 0xa7ff, 0, DrvBgVRAM); - ZetMapArea(0xa000, 0xa7ff, 1, DrvBgVRAM); - ZetMapArea(0xa000, 0xa7ff, 2, DrvBgVRAM); - ZetSetWriteHandler(retofinv_main_write); - ZetSetReadHandler(retofinv_main_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); - ZetMapArea(0x8000, 0x87ff, 0, DrvFgVRAM); - ZetMapArea(0x8000, 0x87ff, 1, DrvFgVRAM); - ZetMapArea(0x8000, 0x87ff, 2, DrvFgVRAM); - ZetMapArea(0x8800, 0x9fff, 0, DrvShareRAM); - ZetMapArea(0x8800, 0x9fff, 1, DrvShareRAM); - ZetMapArea(0x8800, 0x9fff, 2, DrvShareRAM); - ZetMapArea(0xa000, 0xa7ff, 0, DrvBgVRAM); - ZetMapArea(0xa000, 0xa7ff, 1, DrvBgVRAM); - ZetMapArea(0xa000, 0xa7ff, 2, DrvBgVRAM); - ZetSetWriteHandler(retofinv_main_write); - ZetSetReadHandler(retofinv_main_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(2); - ZetOpen(2); - ZetMapArea(0x0000, 0x1fff, 0, DrvZ80ROM2); - ZetMapArea(0x0000, 0x1fff, 2, DrvZ80ROM2); - ZetMapArea(0x2000, 0x27ff, 0, DrvZ80RAM2); - ZetMapArea(0x2000, 0x27ff, 1, DrvZ80RAM2); - ZetMapArea(0x2000, 0x27ff, 2, DrvZ80RAM2); - ZetMapArea(0xe000, 0xffff, 0, DrvZ80ROM2 + 0xe000); - ZetMapArea(0xe000, 0xffff, 2, DrvZ80ROM2 + 0xe000); - ZetSetWriteHandler(retofinv_sound_write); - ZetSetReadHandler(retofinv_sound_read); - ZetClose(); - - m67805_taito_init(DrvMcuROM, DrvMcuRAM, &standard_m68705_interface); - - use_mcu = ~BurnDrvGetFlags() & BDF_BOOTLEG; - - SN76496Init(0, 18432000 / 6, 0); - SN76496Init(1, 18432000 / 6, 1); - SN76496SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); - SN76496SetRoute(1, 0.80, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - m67805_taito_exit(); - - SN76496Exit(); - - BurnFree (AllMem); - - return 0; -} - -static void draw_background_layer() -{ - for (INT32 offs = 0; offs < 36 * 28; offs++) - { - INT32 sx = (offs % 36) << 3; - INT32 sy = (offs / 36) << 3; - - - INT32 ofst = DrvTileOfst[offs]; - - INT32 code = DrvBgVRAM[ofst] | (gfxbank[1] << 8); - INT32 color = (DrvBgVRAM[ofst + 0x400] & 0x3f) + 0x60; - - if (*flipscreen) { - Render8x8Tile_FlipXY_Clip(pTransDraw, code, 280 - sx, 216 - sy, color, 4, 0, DrvGfxROM2); - } else { - Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM2); - } - } -} - -static void draw_foreground_layer() -{ - INT32 flip = *flipscreen ? 0x3f : 0; - - for (INT32 offs = 0; offs < 36 * 28; offs++) - { - INT32 sx = (offs % 36) << 3; - INT32 sy = (offs / 36) << 3; - - if (*flipscreen) { - sx = 280 - sx; - sy = 216 - sy; - } - - INT32 ofst = DrvTileOfst[offs]; - - INT32 code = DrvFgVRAM[ofst + 0x000] | (gfxbank[0] << 8); - INT32 color = DrvFgVRAM[ofst + 0x400]; - - { - color <<= 1; - UINT8 *src = DrvGfxROM0 + code * 0x40; - UINT16 *dst = pTransDraw + (sy * nScreenWidth) + sx; - - for (INT32 y = 0; y < 8; y++) { - for (INT32 x = 0; x < 8; x++) { - INT32 pxl = src[((y << 3) | x) ^ flip] | color; - - if (DrvColTable[pxl]) { - dst[x] = pxl; - } - } - dst += nScreenWidth; - } - } - } -} - -static inline void draw_masked_sprite(INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 fx, INT32 fy) -{ - UINT16 *dst; - UINT8 *src = DrvGfxROM1 + code * 0x100; - - if (fx) fx = 0x0f; - if (fy) fx |= 0xf0; - - for (INT32 y = 0; y < 16; y++, sy++) { - if (sy < 0 || sy >= nScreenHeight) continue; - - dst = pTransDraw + sy * nScreenWidth; - - for (INT32 x = 0; x < 16; x++, sx++) { - if (sx < 0 || sx >= nScreenWidth) continue; - - INT32 pxl = src[((y << 4) | x) ^ fx] | color; - - if (DrvColTable[pxl]) { - dst[sx] = pxl; - } - } - - sx -= 16; - } -} - -static void draw_sprites() -{ - static const INT32 gfx_offs[2][2] = - { - { 0, 1 }, - { 2, 3 } - }; - - UINT8 *ram0 = DrvShareRAM + 0x780; - UINT8 *ram1 = DrvShareRAM + 0xf80; - UINT8 *ram2 = DrvShareRAM + 0x1780; - - for (INT32 offs = 0; offs < 0x80; offs += 2) - { - INT32 attr = ram2[offs]; - INT32 sprite= ram0[offs+0]; - INT32 color = (ram0[offs+1] & 0x3f) + 0x20; - INT32 sx = ((ram1[offs+1] << 1) + ((ram2[offs+1] & 0x80) >> 7)) - 39; - INT32 sy = 256 - ((ram1[offs] << 1) + ((attr & 0x80) >> 7)) + 1; - INT32 flipx = (attr & 0x01); - INT32 flipy = (attr & 0x02) >> 1; - INT32 sizey = (attr & 0x04) >> 2; - INT32 sizex = (attr & 0x08) >> 3; - - sprite &= ~sizex; - sprite &= ~(sizey << 1); - - if (*flipscreen) - { - flipx ^= 1; - flipy ^= 1; - } - - sy -= sizey << 4; - sy = (sy & 0xff) - 32; - - for (INT32 y = 0; y <= sizey; y++) - { - for (INT32 x = 0; x <= sizex; x++) - { - INT32 code = sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)]; - draw_masked_sprite(code, color << 4, sx + 16*x, sy + 16*y, flipx, flipy); - } - } - } -} - -static INT32 DrvDraw() -{ - if (DrvRecalc) { - for (INT32 i = 0; i < 0xa00; i++) { - INT32 d = Palette[i]; - DrvPalette[i] = BurnHighCol(d >> 16, (d >> 8) & 0xff, d & 0xff, 0); - } - DrvRecalc = 0; - } - - draw_background_layer(); - draw_sprites(); - draw_foreground_layer(); - - BurnTransferCopy(DrvPalette); - - return 0; -} - -static INT32 DrvFrame() -{ - watchdog++; - if (DrvReset || watchdog > 59) { - DrvDoReset(); - } - - ZetNewFrame(); - - { - DrvInputs[0] = 0xff; - DrvInputs[1] = 0xff; - DrvInputs[2] = 0xcf; - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; - DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; - DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; - } - } - - INT32 nInterleave = 100; - INT32 nCyclesTotal[4] = { 3072000 / 60, 3072000 / 60, 3072000 / 60, 3072000 / 60 }; - INT32 nCyclesDone[4] = { 0, 0, 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) - { - INT32 nCycleSegment = (nCyclesTotal[0] / nInterleave); - - ZetOpen(0); - nCyclesDone[0] += ZetRun(nCycleSegment); - if (i == (nInterleave - 1) && enable_interrupt[0]) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - - nCycleSegment *= (i + 1); - - if (disable_cpu[0]) { - ZetOpen(1); - nCyclesDone[1] += ZetRun(nCycleSegment - ZetTotalCycles()); - if (i == (nInterleave - 1) && enable_interrupt[1]) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - } - - if (disable_cpu[1]) { - ZetOpen(2); - nCyclesDone[1] += ZetRun(nCycleSegment - ZetTotalCycles()); - if (i == (nInterleave - 1) || i == (nInterleave / 2)-1) ZetNmi(); - ZetClose(); - } - - if (disable_cpu[2] && use_mcu) { - m6805Open(0); - nCycleSegment = nCyclesTotal[3] / nInterleave; - nCyclesDone[3] += m6805Run(nCycleSegment); - m6805Close(); - } - } - - if (pBurnSoundOut) { - SN76496Update(0, pBurnSoundOut, nBurnSoundLen); - SN76496Update(1, pBurnSoundOut, nBurnSoundLen); - } - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029707; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - SN76496Scan(nAction, pnMin); - - SCAN_VAR(enable_interrupt[0]); - SCAN_VAR(enable_interrupt[1]); - SCAN_VAR(disable_cpu[0]); - SCAN_VAR(disable_cpu[1]); - SCAN_VAR(disable_cpu[2]); - SCAN_VAR(from_main); - SCAN_VAR(from_mcu); - SCAN_VAR(mcu_sent); - SCAN_VAR(main_sent); - } - - return 0; -} - - -// Return of the Invaders - -static struct BurnRomInfo retofinvRomDesc[] = { - { "a37-03.70", 0x2000, 0xeae7459d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "a37-02.71", 0x2000, 0x72895e37, 1 | BRF_PRG | BRF_ESS }, // 1 - { "a37-01.72", 0x2000, 0x505dd20b, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "a37-04.62", 0x2000, 0xd2899cc1, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "a37-05.17", 0x2000, 0x9025abea, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code - - { "a37-16.61", 0x2000, 0x4e3f501c, 4 | BRF_GRA }, // 5 Characters - - { "a37-10.8", 0x2000, 0x6afdeec8, 5 | BRF_GRA }, // 6 Sprites - { "a37-11.9", 0x2000, 0xd3dc9da3, 5 | BRF_GRA }, // 7 - { "a37-12.10", 0x2000, 0xd10b2eed, 5 | BRF_GRA }, // 8 - { "a37-13.11", 0x2000, 0x00ca6b3d, 5 | BRF_GRA }, // 9 - - { "a37-14.55", 0x2000, 0xef7f8651, 6 | BRF_GRA }, // 10 Tiles - { "a37-15.56", 0x2000, 0x03b40905, 6 | BRF_GRA }, // 11 - - { "a37-06.13", 0x0100, 0xe9643b8b, 7 | BRF_GRA }, // 12 Color Proms - { "a37-07.4", 0x0100, 0xe8f34e11, 7 | BRF_GRA }, // 13 - { "a37-08.3", 0x0100, 0x50030af0, 7 | BRF_GRA }, // 14 - { "82s191n", 0x0800, 0x93c891e3, 7 | BRF_GRA }, // 15 - - { "a37-09.37", 0x0800, 0x79bd6ded, 8 | BRF_PRG | BRF_ESS }, // 16 68705 Code -}; - -STD_ROM_PICK(retofinv) -STD_ROM_FN(retofinv) - -struct BurnDriver BurnDrvRetofinv = { - "retofinv", NULL, NULL, NULL, "1985", - "Return of the Invaders\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, retofinvRomInfo, retofinvRomName, NULL, NULL, RetofinvInputInfo, RetofinvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0xa00, - 224, 288, 3, 4 -}; - - -// Return of the Invaders (bootleg set 1) - -static struct BurnRomInfo retofin1RomDesc[] = { - { "roi.02", 0x2000, 0xd98fd462, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "roi.01b", 0x2000, 0x3379f930, 1 | BRF_PRG | BRF_ESS }, // 1 - { "roi.01", 0x2000, 0x57679062, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "a37-04.62", 0x2000, 0xd2899cc1, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "a37-05.17", 0x2000, 0x9025abea, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code - - { "a37-16.61", 0x2000, 0x4e3f501c, 4 | BRF_GRA }, // 5 Characters - - { "a37-10.8", 0x2000, 0x6afdeec8, 5 | BRF_GRA }, // 6 Sprites - { "a37-11.9", 0x2000, 0xd3dc9da3, 5 | BRF_GRA }, // 7 - { "a37-12.10", 0x2000, 0xd10b2eed, 5 | BRF_GRA }, // 8 - { "a37-13.11", 0x2000, 0x00ca6b3d, 5 | BRF_GRA }, // 9 - - { "a37-14.55", 0x2000, 0xef7f8651, 6 | BRF_GRA }, // 10 Tiles - { "a37-15.56", 0x2000, 0x03b40905, 6 | BRF_GRA }, // 11 - - { "a37-06.13", 0x0100, 0xe9643b8b, 7 | BRF_GRA }, // 12 Color Proms - { "a37-07.4", 0x0100, 0xe8f34e11, 7 | BRF_GRA }, // 13 - { "a37-08.3", 0x0100, 0x50030af0, 7 | BRF_GRA }, // 14 - { "82s191n", 0x0800, 0x93c891e3, 7 | BRF_GRA }, // 15 -}; - -STD_ROM_PICK(retofin1) -STD_ROM_FN(retofin1) - -struct BurnDriver BurnDrvRetofin1 = { - "retofinv1", "retofinv", NULL, NULL, "1985", - "Return of the Invaders (bootleg set 1)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, retofin1RomInfo, retofin1RomName, NULL, NULL, RetofinvInputInfo, RetofinvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0xa00, - 224, 288, 3, 4 -}; - - -// Return of the Invaders (bootleg set 2) - -static struct BurnRomInfo retofin2RomDesc[] = { - { "ri-c.1e", 0x2000, 0xe3c31260, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "roi.01b", 0x2000, 0x3379f930, 1 | BRF_PRG | BRF_ESS }, // 1 - { "ri-a.1c", 0x2000, 0x3ae7c530, 1 | BRF_PRG | BRF_ESS }, // 2 - - { "a37-04.62", 0x2000, 0xd2899cc1, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code - - { "a37-05.17", 0x2000, 0x9025abea, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code - - { "a37-16.61", 0x2000, 0x4e3f501c, 4 | BRF_GRA }, // 5 Characters - - { "a37-10.8", 0x2000, 0x6afdeec8, 5 | BRF_GRA }, // 6 Sprites - { "a37-11.9", 0x2000, 0xd3dc9da3, 5 | BRF_GRA }, // 7 - { "a37-12.10", 0x2000, 0xd10b2eed, 5 | BRF_GRA }, // 8 - { "a37-13.11", 0x2000, 0x00ca6b3d, 5 | BRF_GRA }, // 9 - - { "a37-14.55", 0x2000, 0xef7f8651, 6 | BRF_GRA }, // 10 Tiles - { "a37-15.56", 0x2000, 0x03b40905, 6 | BRF_GRA }, // 11 - - { "a37-06.13", 0x0100, 0xe9643b8b, 7 | BRF_GRA }, // 12 Color Proms - { "a37-07.4", 0x0100, 0xe8f34e11, 7 | BRF_GRA }, // 13 - { "a37-08.3", 0x0100, 0x50030af0, 7 | BRF_GRA }, // 14 - { "82s191n", 0x0800, 0x93c891e3, 7 | BRF_GRA }, // 15 -}; - -STD_ROM_PICK(retofin2) -STD_ROM_FN(retofin2) - -struct BurnDriver BurnDrvRetofin2 = { - "retofinv2", "retofinv", NULL, NULL, "1985", - "Return of the Invaders (bootleg set 2)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, retofin2RomInfo, retofin2RomName, NULL, NULL, RetofinvInputInfo, RetofinvDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0xa00, - 224, 288, 3, 4 -}; +// FB Alpha Return of the Invaders driver module +// Based on MAME driver by Jarek Parchanski and Andrea Mazzoleni + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "taito_m68705.h" +#include "bitswap.h" +#include "sn76496.h" + +static UINT8 *AllMem; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *MemEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvZ80ROM2; +static UINT8 *DrvMcuROM; +static UINT8 *DrvGfxROM0; +static UINT8 *DrvGfxROM1; +static UINT8 *DrvGfxROM2; +static UINT8 *DrvColPROM; +static UINT8 *DrvFgVRAM; +static UINT8 *DrvBgVRAM; +static UINT8 *DrvShareRAM; +static UINT8 *DrvZ80RAM2; +static UINT8 *DrvMcuRAM; + +static UINT16 *DrvTileOfst; +static UINT8 *DrvColTable; +static UINT32 *Palette; +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *coinlockout; +static UINT8 *soundlatch; +static UINT8 *soundlatch2; +static UINT8 *flipscreen; +static UINT8 *gfxbank; + +static INT32 enable_interrupt[2]; +static INT32 disable_cpu[3]; + +static INT32 use_mcu; + +static INT32 watchdog; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[3]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static struct BurnInputInfo RetofinvInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 1" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 1" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 3, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 2, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Retofinv) + +static struct BurnDIPInfo RetofinvDIPList[]= +{ + {0x0d, 0xff, 0xff, 0x6f, NULL }, + {0x0e, 0xff, 0xff, 0x00, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x0d, 0x01, 0x03, 0x03, "30k, 80k & every 80k" }, + {0x0d, 0x01, 0x03, 0x02, "30k, 80k" }, + {0x0d, 0x01, 0x03, 0x01, "30k" }, + {0x0d, 0x01, 0x03, 0x00, "None" }, + + {0 , 0xfe, 0 , 2, "Free Play" }, + {0x0d, 0x01, 0x04, 0x04, "No" }, + {0x0d, 0x01, 0x04, 0x00, "Yes" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x0d, 0x01, 0x18, 0x18, "1" }, + {0x0d, 0x01, 0x18, 0x10, "2" }, + {0x0d, 0x01, 0x18, 0x08, "3" }, + {0x0d, 0x01, 0x18, 0x00, "5 (retofin2 4)" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x0d, 0x01, 0x40, 0x40, "Off" }, + {0x0d, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x0d, 0x01, 0x80, 0x00, "Upright" }, + {0x0d, 0x01, 0x80, 0x80, "Cocktail" }, + + {0 , 0xfe, 0 , 16, "Coin A" }, + {0x0e, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits" }, + {0x0e, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits" }, + {0x0e, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits" }, + {0x0e, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits" }, + {0x0e, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" }, + {0x0e, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits" }, + {0x0e, 0x01, 0x0f, 0x09, "3 Coins 1 Credits" }, + {0x0e, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" }, + {0x0e, 0x01, 0x0f, 0x00, "1 Coin 1 Credits" }, + {0x0e, 0x01, 0x0f, 0x01, "1 Coin 2 Credits" }, + {0x0e, 0x01, 0x0f, 0x02, "1 Coin 3 Credits" }, + {0x0e, 0x01, 0x0f, 0x03, "1 Coin 4 Credits" }, + {0x0e, 0x01, 0x0f, 0x04, "1 Coin 5 Credits" }, + {0x0e, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" }, + {0x0e, 0x01, 0x0f, 0x06, "1 Coin 7 Credits" }, + {0x0e, 0x01, 0x0f, 0x07, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 16, "Coin B" }, + {0x0e, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits" }, + {0x0e, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits" }, + {0x0e, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits" }, + {0x0e, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits" }, + {0x0e, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits" }, + {0x0e, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits" }, + {0x0e, 0x01, 0xf0, 0x90, "3 Coins 1 Credits" }, + {0x0e, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" }, + {0x0e, 0x01, 0xf0, 0x00, "1 Coin 1 Credits" }, + {0x0e, 0x01, 0xf0, 0x10, "1 Coin 2 Credits" }, + {0x0e, 0x01, 0xf0, 0x20, "1 Coin 3 Credits" }, + {0x0e, 0x01, 0xf0, 0x30, "1 Coin 4 Credits" }, + {0x0e, 0x01, 0xf0, 0x40, "1 Coin 5 Credits" }, + {0x0e, 0x01, 0xf0, 0x50, "1 Coin 6 Credits" }, + {0x0e, 0x01, 0xf0, 0x60, "1 Coin 7 Credits" }, + {0x0e, 0x01, 0xf0, 0x70, "1 Coin 8 Credits" }, + + {0 , 0xfe, 0 , 2, "Push Start to Skip Stage (Cheat)" }, + {0x0f, 0x01, 0x01, 0x01, "Off" }, + {0x0f, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coin Per Play Display" }, + {0x0f, 0x01, 0x10, 0x00, "No" }, + {0x0f, 0x01, 0x10, 0x10, "Yes" }, + + {0 , 0xfe, 0 , 2, "Year Display" }, + {0x0f, 0x01, 0x20, 0x00, "No" }, + {0x0f, 0x01, 0x20, 0x20, "Yes" }, + + {0 , 0xfe, 0 , 2, "Invulnerability (Cheat)" }, + {0x0f, 0x01, 0x40, 0x40, "Off" }, + {0x0f, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x0f, 0x01, 0x80, 0x80, "A and B" }, + {0x0f, 0x01, 0x80, 0x00, "A only" }, +}; + +STDDIPINFO(Retofinv) + +// Reset cpu and keep sync +static inline void retofinv_cpu_reset(INT32 cpu, INT32 data) +{ + INT32 cycles = ZetTotalCycles(); + ZetClose(); + ZetOpen(cpu); + cycles -= ZetTotalCycles(); + if (data) { + ZetIdle(cycles - ZetTotalCycles()); + } else { + ZetRun(cycles); + ZetReset(); + } + disable_cpu[cpu-1] = data; + ZetClose(); + ZetOpen(0); +} + +void __fastcall retofinv_main_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xb800: + *flipscreen = data & 1; + return; + + case 0xb801: + gfxbank[0] = data & 1; + return; + + case 0xb802: + gfxbank[1] = data & 1; + return; + + case 0xc800: + { + data &= 1; + if (!data) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + enable_interrupt[0] = data; + } + return; + + case 0xc801: + *coinlockout = (data & 1) * 0xff; + return; + + case 0xc802: + retofinv_cpu_reset(2, data); + return; + + case 0xc803: + m67805_taito_reset(); + disable_cpu[2] = data; + return; + + case 0xc804: + { + data &= 1; + if (!data) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + enable_interrupt[1] = data; + } + return; + + case 0xc805: + retofinv_cpu_reset(1, data); + return; + + case 0xd000: + watchdog = 0; + return; + + case 0xd800: + { + *soundlatch = data; + ZetClose(); + ZetOpen(2); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(0); + } + return; + + case 0xe800: + standard_taito_mcu_write(data); + return; + } +} + +UINT8 __fastcall retofinv_main_read(UINT16 address) +{ + switch (address) + { + case 0xc000: + return DrvInputs[0]; + + case 0xc001: + return DrvInputs[1]; + + case 0xc002: // must be < 0x80; + return 0; + + case 0xc003: // mcu status + { + INT32 res = 0; + if (!main_sent) res |= 0x10; + if (mcu_sent) res |= 0x20; + return res; + } + + case 0xc004: + return DrvInputs[2] & (*coinlockout | 0xcf); + + case 0xc005: + return DrvDips[0]; + + case 0xc006: + return DrvDips[1]; + + case 0xc007: + return DrvDips[2]; + + case 0xf800: + return *soundlatch2; + + case 0xe000: + return standard_taito_mcu_read(); + } + + return 0; +} + +void __fastcall retofinv_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0x6000: + *soundlatch2 = data; + return; + + case 0x8000: + SN76496Write(0, data); + return; + + case 0xa000: + SN76496Write(1, data); + return; + } +} + +UINT8 __fastcall retofinv_sound_read(UINT16 address) +{ + switch (address) + { + case 0x4000: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + DrvReset = 0; + + memset (AllRam, 0, RamEnd - AllRam); + + for (INT32 i = 0; i < 3; i++) { + ZetOpen(i); + ZetReset(); + ZetClose(); + } + + m67805_taito_reset(); + + enable_interrupt[0] = 0; + enable_interrupt[1] = 0; + disable_cpu[0] = 1; + disable_cpu[1] = 1; + disable_cpu[2] = 1; + + watchdog = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x010000; + DrvZ80ROM1 = Next; Next += 0x010000; + DrvZ80ROM2 = Next; Next += 0x010000; + + DrvMcuROM = Next; Next += 0x000800; + + DrvGfxROM0 = Next; Next += 0x010000; + DrvGfxROM1 = Next; Next += 0x010000; + DrvGfxROM2 = Next; Next += 0x008000; + + DrvColPROM = Next; Next += 0x000b00; + + AllRam = Next; + + DrvFgVRAM = Next; Next += 0x000800; + DrvBgVRAM = Next; Next += 0x000800; + DrvShareRAM = Next; Next += 0x001800; + + DrvZ80RAM2 = Next; Next += 0x000800; + + DrvMcuRAM = Next; Next += 0x000080; + + coinlockout = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + soundlatch2 = Next; Next += 0x000001; + flipscreen = Next; Next += 0x000001; + + gfxbank = Next; Next += 0x000002; + + RamEnd = Next; + + DrvColTable = Next; Next += 0x000a00; + Palette = (UINT32*)Next; Next += 0x0a00 * sizeof(UINT32); + DrvPalette = (UINT32*)Next; Next += 0x0a00 * sizeof(UINT32); + + DrvTileOfst = (UINT16*)Next; Next += 0x0400 * sizeof(UINT16); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvGfxDecode() +{ + INT32 Plane0[1] = { 0x00000 }; + INT32 Plane1[4] = { 0x00000, 0x20004, 0x20000, 0x00004 }; + INT32 XOffs0[8] = { 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000 }; + INT32 XOffs1[16] = { 0x000, 0x001, 0x002, 0x003, 0x040, 0x041, 0x042, 0x043, + 0x080, 0x081, 0x082, 0x083, 0x0c0, 0x0c1, 0x0c2, 0x0c3 }; + INT32 YOffs[16] = { 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038, + 0x100, 0x108, 0x110, 0x118, 0x120, 0x128, 0x130, 0x138 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(0x8000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM0, 0x2000); + + GfxDecode(0x0200, 1, 8, 8, Plane0, XOffs0, YOffs, 0x040, tmp, DrvGfxROM0); + + memcpy (tmp, DrvGfxROM1, 0x8000); + + GfxDecode(0x0100, 4, 16, 16, Plane1, XOffs1, YOffs, 0x200, tmp, DrvGfxROM1); + + memcpy (tmp, DrvGfxROM2, 0x8000); + + GfxDecode(0x0200, 4, 8, 8, Plane1, XOffs1, YOffs, 0x080, tmp, DrvGfxROM2); + + BurnFree (tmp); + + return 0; +} + +static void DrvPaletteInit() +{ + for (INT32 i = 0; i < 0x100; i++) + { + INT32 r = DrvColPROM[i + 0x000] & 0x0f; + INT32 g = DrvColPROM[i + 0x100] & 0x0f; + INT32 b = DrvColPROM[i + 0x200] & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + DrvPalette[i] = (r << 16) | (g << 8) | b; + } + + for (INT32 i = 0; i < 0x200; i++) { // foreground + DrvColTable[i] = (i >> 1) * (i & 1); + Palette[i + 0x000] = DrvPalette[DrvColTable[i]]; + } + + for (INT32 i = 0; i < 0x800; i++) { // everything else + DrvColTable[i + 0x200] = BITSWAP08(DrvColPROM[i + 0x300],4,5,6,7,3,2,1,0); + Palette[i + 0x200] = DrvPalette[DrvColTable[i + 0x200]]; + DrvColTable[i + 0x200] = (DrvColTable[i + 0x200] == 0xff) ? 0 : 1; + } + + DrvRecalc = 1; +} + +// Calculate offsets for tiles on screen +static void DrvCalculateOffsets() +{ + for (INT32 offs = 0; offs < 36 * 28; offs++) { + INT32 col = (offs % 36) - 2; + INT32 row = (offs / 36) + 2; + + if (col & 0x20) + DrvTileOfst[offs] = ((col & 0x1f) << 5) + row; + else + DrvTileOfst[offs] = (row << 5) + col; + } +} + +static INT32 DecodeBoot3PROMs() +{ + UINT8 *tmp = DrvGfxROM2 + 0x8000; // empty before gfx decode + + if (BurnLoadRom(tmp + 0x000, 16, 1)) return 1; + if (BurnLoadRom(tmp + 0x400, 18, 1)) return 1; + if (BurnLoadRom(tmp + 0x800, 15, 1)) return 1; + if (BurnLoadRom(tmp + 0xc00, 17, 1)) return 1; + + for (INT32 i = 0; i < 0x800; i++) { + DrvColPROM[i + 0x300] = (tmp[i] & 0x0f) | (tmp[i + 0x800] << 4); + } + + memset (tmp, 0, 0x1000); + + return 0; +} + +static INT32 DrvInit() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1; + if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM2 + 0x00000, 4, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM0 + 0x00000, 5, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM1 + 0x00000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x02000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x04000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM1 + 0x06000, 9, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM2 + 0x04000, 11, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00000, 12, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00100, 13, 1)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00200, 14, 1)) return 1; + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "retofin3") == 0) { + DecodeBoot3PROMs(); + } else { + if (BurnLoadRom(DrvColPROM + 0x00300, 15, 1)) return 1; + + if (BurnLoadRom(DrvMcuROM + 0x00000, 16, 1)) return 1; + } + + DrvCalculateOffsets(); + DrvPaletteInit(); + DrvGfxDecode(); + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0x8000, 0x87ff, 0, DrvFgVRAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvFgVRAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvFgVRAM); + ZetMapArea(0x8800, 0x9fff, 0, DrvShareRAM); + ZetMapArea(0x8800, 0x9fff, 1, DrvShareRAM); + ZetMapArea(0x8800, 0x9fff, 2, DrvShareRAM); + ZetMapArea(0xa000, 0xa7ff, 0, DrvBgVRAM); + ZetMapArea(0xa000, 0xa7ff, 1, DrvBgVRAM); + ZetMapArea(0xa000, 0xa7ff, 2, DrvBgVRAM); + ZetSetWriteHandler(retofinv_main_write); + ZetSetReadHandler(retofinv_main_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1); + ZetMapArea(0x8000, 0x87ff, 0, DrvFgVRAM); + ZetMapArea(0x8000, 0x87ff, 1, DrvFgVRAM); + ZetMapArea(0x8000, 0x87ff, 2, DrvFgVRAM); + ZetMapArea(0x8800, 0x9fff, 0, DrvShareRAM); + ZetMapArea(0x8800, 0x9fff, 1, DrvShareRAM); + ZetMapArea(0x8800, 0x9fff, 2, DrvShareRAM); + ZetMapArea(0xa000, 0xa7ff, 0, DrvBgVRAM); + ZetMapArea(0xa000, 0xa7ff, 1, DrvBgVRAM); + ZetMapArea(0xa000, 0xa7ff, 2, DrvBgVRAM); + ZetSetWriteHandler(retofinv_main_write); + ZetSetReadHandler(retofinv_main_read); + ZetClose(); + + ZetInit(2); + ZetOpen(2); + ZetMapArea(0x0000, 0x1fff, 0, DrvZ80ROM2); + ZetMapArea(0x0000, 0x1fff, 2, DrvZ80ROM2); + ZetMapArea(0x2000, 0x27ff, 0, DrvZ80RAM2); + ZetMapArea(0x2000, 0x27ff, 1, DrvZ80RAM2); + ZetMapArea(0x2000, 0x27ff, 2, DrvZ80RAM2); + ZetMapArea(0xe000, 0xffff, 0, DrvZ80ROM2 + 0xe000); + ZetMapArea(0xe000, 0xffff, 2, DrvZ80ROM2 + 0xe000); + ZetSetWriteHandler(retofinv_sound_write); + ZetSetReadHandler(retofinv_sound_read); + ZetClose(); + + m67805_taito_init(DrvMcuROM, DrvMcuRAM, &standard_m68705_interface); + + use_mcu = ~BurnDrvGetFlags() & BDF_BOOTLEG; + + SN76496Init(0, 18432000 / 6, 0); + SN76496Init(1, 18432000 / 6, 1); + SN76496SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH); + SN76496SetRoute(1, 0.80, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + m67805_taito_exit(); + + SN76496Exit(); + + BurnFree (AllMem); + + return 0; +} + +static void draw_background_layer() +{ + for (INT32 offs = 0; offs < 36 * 28; offs++) + { + INT32 sx = (offs % 36) << 3; + INT32 sy = (offs / 36) << 3; + + + INT32 ofst = DrvTileOfst[offs]; + + INT32 code = DrvBgVRAM[ofst] | (gfxbank[1] << 8); + INT32 color = (DrvBgVRAM[ofst + 0x400] & 0x3f) + 0x60; + + if (*flipscreen) { + Render8x8Tile_FlipXY_Clip(pTransDraw, code, 280 - sx, 216 - sy, color, 4, 0, DrvGfxROM2); + } else { + Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM2); + } + } +} + +static void draw_foreground_layer() +{ + INT32 flip = *flipscreen ? 0x3f : 0; + + for (INT32 offs = 0; offs < 36 * 28; offs++) + { + INT32 sx = (offs % 36) << 3; + INT32 sy = (offs / 36) << 3; + + if (*flipscreen) { + sx = 280 - sx; + sy = 216 - sy; + } + + INT32 ofst = DrvTileOfst[offs]; + + INT32 code = DrvFgVRAM[ofst + 0x000] | (gfxbank[0] << 8); + INT32 color = DrvFgVRAM[ofst + 0x400]; + + { + color <<= 1; + UINT8 *src = DrvGfxROM0 + code * 0x40; + UINT16 *dst = pTransDraw + (sy * nScreenWidth) + sx; + + for (INT32 y = 0; y < 8; y++) { + for (INT32 x = 0; x < 8; x++) { + INT32 pxl = src[((y << 3) | x) ^ flip] | color; + + if (DrvColTable[pxl]) { + dst[x] = pxl; + } + } + dst += nScreenWidth; + } + } + } +} + +static inline void draw_masked_sprite(INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 fx, INT32 fy) +{ + UINT16 *dst; + UINT8 *src = DrvGfxROM1 + code * 0x100; + + if (fx) fx = 0x0f; + if (fy) fx |= 0xf0; + + for (INT32 y = 0; y < 16; y++, sy++) { + if (sy < 0 || sy >= nScreenHeight) continue; + + dst = pTransDraw + sy * nScreenWidth; + + for (INT32 x = 0; x < 16; x++, sx++) { + if (sx < 0 || sx >= nScreenWidth) continue; + + INT32 pxl = src[((y << 4) | x) ^ fx] | color; + + if (DrvColTable[pxl]) { + dst[sx] = pxl; + } + } + + sx -= 16; + } +} + +static void draw_sprites() +{ + static const INT32 gfx_offs[2][2] = + { + { 0, 1 }, + { 2, 3 } + }; + + UINT8 *ram0 = DrvShareRAM + 0x780; + UINT8 *ram1 = DrvShareRAM + 0xf80; + UINT8 *ram2 = DrvShareRAM + 0x1780; + + for (INT32 offs = 0; offs < 0x80; offs += 2) + { + INT32 attr = ram2[offs]; + INT32 sprite= ram0[offs+0]; + INT32 color = (ram0[offs+1] & 0x3f) + 0x20; + INT32 sx = ((ram1[offs+1] << 1) + ((ram2[offs+1] & 0x80) >> 7)) - 39; + INT32 sy = 256 - ((ram1[offs] << 1) + ((attr & 0x80) >> 7)) + 1; + INT32 flipx = (attr & 0x01); + INT32 flipy = (attr & 0x02) >> 1; + INT32 sizey = (attr & 0x04) >> 2; + INT32 sizex = (attr & 0x08) >> 3; + + sprite &= ~sizex; + sprite &= ~(sizey << 1); + + if (*flipscreen) + { + flipx ^= 1; + flipy ^= 1; + } + + sy -= sizey << 4; + sy = (sy & 0xff) - 32; + + for (INT32 y = 0; y <= sizey; y++) + { + for (INT32 x = 0; x <= sizex; x++) + { + INT32 code = sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)]; + draw_masked_sprite(code, color << 4, sx + 16*x, sy + 16*y, flipx, flipy); + } + } + } +} + +static INT32 DrvDraw() +{ + if (DrvRecalc) { + for (INT32 i = 0; i < 0xa00; i++) { + INT32 d = Palette[i]; + DrvPalette[i] = BurnHighCol(d >> 16, (d >> 8) & 0xff, d & 0xff, 0); + } + DrvRecalc = 0; + } + + draw_background_layer(); + draw_sprites(); + draw_foreground_layer(); + + BurnTransferCopy(DrvPalette); + + return 0; +} + +static INT32 DrvFrame() +{ + watchdog++; + if (DrvReset || watchdog > 59) { + DrvDoReset(); + } + + ZetNewFrame(); + + { + DrvInputs[0] = 0xff; + DrvInputs[1] = 0xff; + DrvInputs[2] = 0xcf; + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= (DrvJoy1[i] & 1) << i; + DrvInputs[1] ^= (DrvJoy2[i] & 1) << i; + DrvInputs[2] ^= (DrvJoy3[i] & 1) << i; + } + } + + INT32 nInterleave = 100; + INT32 nCyclesTotal[4] = { 3072000 / 60, 3072000 / 60, 3072000 / 60, 3072000 / 60 }; + INT32 nCyclesDone[4] = { 0, 0, 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) + { + INT32 nCycleSegment = (nCyclesTotal[0] / nInterleave); + + ZetOpen(0); + nCyclesDone[0] += ZetRun(nCycleSegment); + if (i == (nInterleave - 1) && enable_interrupt[0]) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + + nCycleSegment *= (i + 1); + + if (disable_cpu[0]) { + ZetOpen(1); + nCyclesDone[1] += ZetRun(nCycleSegment - ZetTotalCycles()); + if (i == (nInterleave - 1) && enable_interrupt[1]) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + } + + if (disable_cpu[1]) { + ZetOpen(2); + nCyclesDone[1] += ZetRun(nCycleSegment - ZetTotalCycles()); + if (i == (nInterleave - 1) || i == (nInterleave / 2)-1) ZetNmi(); + ZetClose(); + } + + if (disable_cpu[2] && use_mcu) { + m6805Open(0); + nCycleSegment = nCyclesTotal[3] / nInterleave; + nCyclesDone[3] += m6805Run(nCycleSegment); + m6805Close(); + } + } + + if (pBurnSoundOut) { + SN76496Update(0, pBurnSoundOut, nBurnSoundLen); + SN76496Update(1, pBurnSoundOut, nBurnSoundLen); + } + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029707; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + SN76496Scan(nAction, pnMin); + + SCAN_VAR(enable_interrupt[0]); + SCAN_VAR(enable_interrupt[1]); + SCAN_VAR(disable_cpu[0]); + SCAN_VAR(disable_cpu[1]); + SCAN_VAR(disable_cpu[2]); + SCAN_VAR(from_main); + SCAN_VAR(from_mcu); + SCAN_VAR(mcu_sent); + SCAN_VAR(main_sent); + } + + return 0; +} + + +// Return of the Invaders + +static struct BurnRomInfo retofinvRomDesc[] = { + { "a37-03.70", 0x2000, 0xeae7459d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "a37-02.71", 0x2000, 0x72895e37, 1 | BRF_PRG | BRF_ESS }, // 1 + { "a37-01.72", 0x2000, 0x505dd20b, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "a37-04.62", 0x2000, 0xd2899cc1, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "a37-05.17", 0x2000, 0x9025abea, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code + + { "a37-16.61", 0x2000, 0x4e3f501c, 4 | BRF_GRA }, // 5 Characters + + { "a37-10.8", 0x2000, 0x6afdeec8, 5 | BRF_GRA }, // 6 Sprites + { "a37-11.9", 0x2000, 0xd3dc9da3, 5 | BRF_GRA }, // 7 + { "a37-12.10", 0x2000, 0xd10b2eed, 5 | BRF_GRA }, // 8 + { "a37-13.11", 0x2000, 0x00ca6b3d, 5 | BRF_GRA }, // 9 + + { "a37-14.55", 0x2000, 0xef7f8651, 6 | BRF_GRA }, // 10 Tiles + { "a37-15.56", 0x2000, 0x03b40905, 6 | BRF_GRA }, // 11 + + { "a37-06.13", 0x0100, 0xe9643b8b, 7 | BRF_GRA }, // 12 Color Proms + { "a37-07.4", 0x0100, 0xe8f34e11, 7 | BRF_GRA }, // 13 + { "a37-08.3", 0x0100, 0x50030af0, 7 | BRF_GRA }, // 14 + { "82s191n", 0x0800, 0x93c891e3, 7 | BRF_GRA }, // 15 + + { "a37-09.37", 0x0800, 0x79bd6ded, 8 | BRF_PRG | BRF_ESS }, // 16 68705 Code +}; + +STD_ROM_PICK(retofinv) +STD_ROM_FN(retofinv) + +struct BurnDriver BurnDrvRetofinv = { + "retofinv", NULL, NULL, NULL, "1985", + "Return of the Invaders\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, retofinvRomInfo, retofinvRomName, NULL, NULL, RetofinvInputInfo, RetofinvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0xa00, + 224, 288, 3, 4 +}; + + +// Return of the Invaders (bootleg set 1) + +static struct BurnRomInfo retofin1RomDesc[] = { + { "roi.02", 0x2000, 0xd98fd462, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "roi.01b", 0x2000, 0x3379f930, 1 | BRF_PRG | BRF_ESS }, // 1 + { "roi.01", 0x2000, 0x57679062, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "a37-04.62", 0x2000, 0xd2899cc1, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "a37-05.17", 0x2000, 0x9025abea, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code + + { "a37-16.61", 0x2000, 0x4e3f501c, 4 | BRF_GRA }, // 5 Characters + + { "a37-10.8", 0x2000, 0x6afdeec8, 5 | BRF_GRA }, // 6 Sprites + { "a37-11.9", 0x2000, 0xd3dc9da3, 5 | BRF_GRA }, // 7 + { "a37-12.10", 0x2000, 0xd10b2eed, 5 | BRF_GRA }, // 8 + { "a37-13.11", 0x2000, 0x00ca6b3d, 5 | BRF_GRA }, // 9 + + { "a37-14.55", 0x2000, 0xef7f8651, 6 | BRF_GRA }, // 10 Tiles + { "a37-15.56", 0x2000, 0x03b40905, 6 | BRF_GRA }, // 11 + + { "a37-06.13", 0x0100, 0xe9643b8b, 7 | BRF_GRA }, // 12 Color Proms + { "a37-07.4", 0x0100, 0xe8f34e11, 7 | BRF_GRA }, // 13 + { "a37-08.3", 0x0100, 0x50030af0, 7 | BRF_GRA }, // 14 + { "82s191n", 0x0800, 0x93c891e3, 7 | BRF_GRA }, // 15 +}; + +STD_ROM_PICK(retofin1) +STD_ROM_FN(retofin1) + +struct BurnDriver BurnDrvRetofin1 = { + "retofinv1", "retofinv", NULL, NULL, "1985", + "Return of the Invaders (bootleg set 1)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, retofin1RomInfo, retofin1RomName, NULL, NULL, RetofinvInputInfo, RetofinvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0xa00, + 224, 288, 3, 4 +}; + + +// Return of the Invaders (bootleg set 2) + +static struct BurnRomInfo retofin2RomDesc[] = { + { "ri-c.1e", 0x2000, 0xe3c31260, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "roi.01b", 0x2000, 0x3379f930, 1 | BRF_PRG | BRF_ESS }, // 1 + { "ri-a.1c", 0x2000, 0x3ae7c530, 1 | BRF_PRG | BRF_ESS }, // 2 + + { "a37-04.62", 0x2000, 0xd2899cc1, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code + + { "a37-05.17", 0x2000, 0x9025abea, 3 | BRF_PRG | BRF_ESS }, // 4 Z80 #2 Code + + { "a37-16.61", 0x2000, 0x4e3f501c, 4 | BRF_GRA }, // 5 Characters + + { "a37-10.8", 0x2000, 0x6afdeec8, 5 | BRF_GRA }, // 6 Sprites + { "a37-11.9", 0x2000, 0xd3dc9da3, 5 | BRF_GRA }, // 7 + { "a37-12.10", 0x2000, 0xd10b2eed, 5 | BRF_GRA }, // 8 + { "a37-13.11", 0x2000, 0x00ca6b3d, 5 | BRF_GRA }, // 9 + + { "a37-14.55", 0x2000, 0xef7f8651, 6 | BRF_GRA }, // 10 Tiles + { "a37-15.56", 0x2000, 0x03b40905, 6 | BRF_GRA }, // 11 + + { "a37-06.13", 0x0100, 0xe9643b8b, 7 | BRF_GRA }, // 12 Color Proms + { "a37-07.4", 0x0100, 0xe8f34e11, 7 | BRF_GRA }, // 13 + { "a37-08.3", 0x0100, 0x50030af0, 7 | BRF_GRA }, // 14 + { "82s191n", 0x0800, 0x93c891e3, 7 | BRF_GRA }, // 15 +}; + +STD_ROM_PICK(retofin2) +STD_ROM_FN(retofin2) + +struct BurnDriver BurnDrvRetofin2 = { + "retofinv2", "retofinv", NULL, NULL, "1985", + "Return of the Invaders (bootleg set 2)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, retofin2RomInfo, retofin2RomName, NULL, NULL, RetofinvInputInfo, RetofinvDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0xa00, + 224, 288, 3, 4 +}; diff --git a/src/burn/drv/taito/d_slapshot.cpp b/src/burn/drv/taito/d_slapshot.cpp index 692d06695..04f982fd9 100644 --- a/src/burn/drv/taito/d_slapshot.cpp +++ b/src/burn/drv/taito/d_slapshot.cpp @@ -1,920 +1,919 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "taito.h" -#include "taito_ic.h" -#include "burn_ym2610.h" -#include "eeprom.h" -#include "burn_gun.h" -#include "timekpr.h" - -static void SlapshotDraw(); -static void Opwolf3Draw(); -static TaitoF2SpriteBufferUpdate TaitoF2SpriteBufferFunction; - -static bool bUseAsm68KCoreOldValue = false; - -#define A(a, b, c, d) {a, b, (UINT8*)(c), d} - -static struct BurnInputInfo SlapshotInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0640FIOInputPort1 + 4, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0640FIOInputPort3 + 4, "p1 start" }, - {"Start 2" , BIT_DIGITAL , TC0640FIOInputPort3 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0640FIOInputPort4 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0640FIOInputPort4 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0640FIOInputPort4 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0640FIOInputPort4 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0640FIOInputPort2 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0640FIOInputPort2 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0640FIOInputPort2 + 2, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , TC0640FIOInputPort4 + 4, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0640FIOInputPort4 + 5, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0640FIOInputPort4 + 6, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0640FIOInputPort4 + 7, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0640FIOInputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0640FIOInputPort2 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0640FIOInputPort2 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0640FIOInputPort3 + 0, "service" }, - {"Tilt" , BIT_DIGITAL , TC0640FIOInputPort1 + 1, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, -}; - -STDINPUTINFO(Slapshot) - -static struct BurnInputInfo Opwolf3InputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0640FIOInputPort1 + 4, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0640FIOInputPort2 + 2, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0640FIOInputPort1 + 5, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0640FIOInputPort2 + 6, "p2 start" }, - {"Coin 3" , BIT_DIGITAL , TC0640FIOInputPort1 + 6, "p3 coin" }, - {"Coin 4" , BIT_DIGITAL , TC0640FIOInputPort1 + 7, "p4 coin" }, - - A("P1 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "mouse x-axis" ), - A("P1 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "mouse y-axis" ), - {"P1 Fire 1" , BIT_DIGITAL , TC0640FIOInputPort2 + 0, "mouse button 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0640FIOInputPort2 + 1, "mouse button 2" }, - - A("P2 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort2 , "p2 x-axis" ), - A("P2 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort3 , "p2 y-axis" ), - {"P2 Fire 1" , BIT_DIGITAL , TC0640FIOInputPort2 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0640FIOInputPort2 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0640FIOInputPort3 + 0, "service" }, - {"Tilt" , BIT_DIGITAL , TC0640FIOInputPort1 + 1, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, -}; - -STDINPUTINFO(Opwolf3) - -#undef A - -static void TC0640FIOMakeInputs() -{ - TC0640FIOInput[0] = 0xff; - TC0640FIOInput[1] = 0xff; - TC0640FIOInput[2] = 0xff; - TC0640FIOInput[3] = 0xff; - TC0640FIOInput[4] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - TC0640FIOInput[0] -= (TC0640FIOInputPort0[i] & 1) << i; - TC0640FIOInput[1] -= (TC0640FIOInputPort1[i] & 1) << i; - TC0640FIOInput[2] -= (TC0640FIOInputPort2[i] & 1) << i; - TC0640FIOInput[3] -= (TC0640FIOInputPort3[i] & 1) << i; - TC0640FIOInput[4] -= (TC0640FIOInputPort4[i] & 1) << i; - } -} - -static void Opwolf3MakeInputs() -{ - TC0640FIOMakeInputs(); - - BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); - BurnGunMakeInputs(1, (INT16)TaitoAnalogPort2, (INT16)TaitoAnalogPort3); -} - -static struct BurnDIPInfo SlapshotDIPList[]= -{ - {0x14, 0xff, 0xff, 0x10, NULL }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x14, 0x01, 0x10, 0x10, "Off" }, - {0x14, 0x01, 0x10, 0x00, "On" }, -}; - -STDDIPINFO(Slapshot) - -static struct BurnDIPInfo Opwolf3DIPList[]= -{ - {0x11, 0xff, 0xff, 0x10, NULL }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x10, 0x10, "Off" }, - {0x11, 0x01, 0x10, 0x00, "On" }, -}; - -STDDIPINFO(Opwolf3) - -static struct BurnRomInfo SlapshotRomDesc[] = { - { "d71-15.3", 0x080000, 0x1470153f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d71-16.1", 0x080000, 0xf13666e0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "d71-07.77", 0x010000, 0xdd5f670c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d71-04.79", 0x080000, 0xb727b81c, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "d71-05.80", 0x080000, 0x7b0f5d6d, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "d71-06.37", 0x080000, 0xf3324188, BRF_SND | TAITO_YM2610A }, - - // Sprites - handled manually - { "d71-01.23", 0x100000, 0x0b1e8c27, BRF_GRA }, - { "d71-02.24", 0x100000, 0xccaaea2d, BRF_GRA }, - { "d71-03.25", 0x100000, 0xdccef9ec, BRF_GRA }, -}; - -STD_ROM_PICK(Slapshot) -STD_ROM_FN(Slapshot) - -static struct BurnRomInfo Opwolf3RomDesc[] = { - { "d74_16.3", 0x080000, 0x198ff1f6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d74_21.1", 0x080000, 0xc61c558b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d74_18.18", 0x080000, 0xbd5d7cdb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d74_17.17", 0x080000, 0xac35a672, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "d74_22.77", 0x010000, 0x118374a6, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d74_05.80", 0x200000, 0x85ea64cc, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "d74_06.81", 0x200000, 0x2fa1e08d, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "d74_01.37", 0x200000, 0x115313e0, BRF_SND | TAITO_YM2610A }, - - // Sprites - handled manually - { "d74_02.23", 0x200000, 0xaab86332, BRF_GRA }, - { "d74_03.24", 0x200000, 0x3f398916, BRF_GRA }, - { "d74_04.25", 0x200000, 0x2f385638, BRF_GRA }, -}; - -STD_ROM_PICK(Opwolf3) -STD_ROM_FN(Opwolf3) - -static struct BurnRomInfo Opwolf3uRomDesc[] = { - { "d74_16.3", 0x080000, 0x198ff1f6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d74_20.1", 0x080000, 0x960fd892, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d74_18.18", 0x080000, 0xbd5d7cdb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d74_17.17", 0x080000, 0xac35a672, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "d74_19.77", 0x010000, 0x05d53f06, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d74_05.80", 0x200000, 0x85ea64cc, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "d74_06.81", 0x200000, 0x2fa1e08d, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "d74_01.37", 0x200000, 0x115313e0, BRF_SND | TAITO_YM2610A }, - - // Sprites - handled manually - { "d74_02.23", 0x200000, 0xaab86332, BRF_GRA }, - { "d74_03.24", 0x200000, 0x3f398916, BRF_GRA }, - { "d74_04.25", 0x200000, 0x2f385638, BRF_GRA }, -}; - -STD_ROM_PICK(Opwolf3u) -STD_ROM_FN(Opwolf3u) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += Taito68KRom1Size; - TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; - TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; - TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x10000; - TaitoZ80Ram1 = Next; Next += 0x02000; - TaitoSpriteRam = Next; Next += 0x10000; - TaitoSpriteRamBuffered = Next; Next += 0x10000; - TaitoSpriteExtension = Next; Next += 0x02000; - TaitoPaletteRam = Next; Next += 0x08000; - - TaitoRamEnd = Next; - - TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; - TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; - TaitoPalette = (UINT32*)Next; Next += 0x02000 * sizeof(UINT32); - TaitoF2SpriteList = (TaitoF2SpriteEntry*)Next; Next += 0x400 * sizeof(TaitoF2SpriteEntry); - - TaitoMemEnd = Next; - - return 0; -} - -static INT32 SlapshotDoReset() -{ - TaitoDoReset(); - - return 0; -} - -UINT8 __fastcall Slapshot68KReadByte(UINT32 a) -{ - if (a >= 0xa00000 && a <= 0xa03fff) { - return TimeKeeperRead((a - 0xa00000) >> 1); - } - - if (a >= 0xc00000 && a <= 0xc0000f) { - return TC0640FIORead((a - 0xc00000) >> 1); - } - - if (a >= 0xc00020 && a <= 0xc0002f) { - if (a == 0xc00027) bprintf(PRINT_IMPORTANT, _T("%x\n"), a); - - if (a == 0xc00026) return (TC0640FIOInput[2] & 0xef) | (TaitoDip[0] & 0x10); - - return TC0640FIORead((a - 0xc00020) >> 1); - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Slapshot68KWriteByte(UINT32 a, UINT8 d) -{ - if (a <= 0x0fffff) return; - - if (a >= 0xa00000 && a <= 0xa03fff) { - TimeKeeperWrite((a - 0xa00000) >> 1, d); - return; - } - - TC0360PRIHalfWordWrite_Map(0xb00000) - - if (a >= 0xc00000 && a <= 0xc0000f) { - TC0640FIOWrite((a - 0xc00000) >> 1, d); - return; - } - - if (a >= 0xc00010 && a <= 0xc0002f) { - return; - } - - switch (a) { - case 0xd00000: { - TC0140SYTPortWrite(d); - return; - } - - case 0xd00002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Slapshot68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Slapshot68KWriteWord(UINT32 a, UINT16 d) -{ - TC0480SCPCtrlWordWrite_Map(0x830000) - - if (a >= 0xc00000 && a <= 0xc0000f) { - TC0640FIOWrite((a - 0xc00000) >> 1, d); - return; - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Opwolf3Gun68KReadByte(UINT32 a) -{ - switch (a) { - case 0xe00000: { - float Temp = (float)~BurnGunReturnX(0) / 256.0; - Temp *= 160.0; - return ((UINT8)Temp - 0x5b) & 0xff; - } - - case 0xe00002: { - float Temp = (float)BurnGunReturnY(0) / 256.0; - Temp *= 112; - return ((UINT8)Temp + 0x08) & 0xff; - } - - case 0xe00004: { - float Temp = (float)~BurnGunReturnX(1) / 256.0; - Temp *= 160.0; - return ((UINT8)Temp - 0x5b) & 0xff; - } - - case 0xe00006: { - float Temp = (float)BurnGunReturnY(1) / 256.0; - Temp *= 112; - return ((UINT8)Temp + 0x08) & 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Opwolf3Gun68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xe00000: - case 0xe00002: - case 0xe00004: - case 0xe00006: { - SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Opwolf3Gun68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Opwolf3Gun68KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall SlapshotZ80Read(UINT16 a) -{ - switch (a) { - case 0xe000: { - return BurnYM2610Read(0); - } - - case 0xe201: { - return TC0140SYTSlaveCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall SlapshotZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe000: { - BurnYM2610Write(0, d); - return; - } - - case 0xe001: { - BurnYM2610Write(1, d); - return; - } - - case 0xe002: { - BurnYM2610Write(2, d); - return; - } - - case 0xe003: { - BurnYM2610Write(3, d); - return; - } - - case 0xe200: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xe201: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xf200: { - TaitoZ80Bank = (d - 1) & 7; - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static void SlapshotFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 SlapshotSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double SlapshotGetTime() -{ - return (double)ZetTotalCycles() / 4000000; -} - -static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 CharXOffsets[16] = { 4, 0, 20, 16, 12, 8, 28, 24, 36, 32, 52, 48, 44, 40, 60, 56 }; -static INT32 CharYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; -static INT32 SpritePlaneOffsets[6] = { 0x1000000, 0x1000001, 0, 1, 2, 3 }; -static INT32 SpriteXOffsets[16] = { 4, 0, 12, 8, 20, 16, 28, 24, 36, 32, 44, 40, 52, 48, 60, 56 }; -static INT32 SpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; -static INT32 Opwolf3SpritePlaneOffsets[6] = { 0x2000000, 0x2000001, 0, 1, 2, 3 }; - -static void SwitchToMusashi() -{ - if (bBurnUseASMCPUEmulation) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); -#endif - bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; - bBurnUseASMCPUEmulation = false; - } -} - -static INT32 MachineInit() -{ - INT32 nLen; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0480SCPInit(TaitoNumChar, 3, 30, 9, -1, 1, -2); - TC0480SCPSetColourBase(256); - TC0140SYTInit(); - TC0360PRIInit(); - TC0640FIOInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, Taito68KRom1Size - 1, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x500000, 0x50ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x600000, 0x60ffff, SM_RAM); - SekMapMemory(TaitoSpriteExtension , 0x700000, 0x701fff, SM_RAM); - SekMapMemory(TC0480SCPRam , 0x800000, 0x80ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x900000, 0x907fff, SM_RAM); - SekSetReadWordHandler(0, Slapshot68KReadWord); - SekSetWriteWordHandler(0, Slapshot68KWriteWord); - SekSetReadByteHandler(0, Slapshot68KReadByte); - SekSetWriteByteHandler(0, Slapshot68KWriteByte); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(SlapshotZ80Read); - ZetSetWriteHandler(SlapshotZ80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2610Init(8000000, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &SlapshotFMIRQHandler, SlapshotSynchroniseStream, SlapshotGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - TaitoMakeInputsFunction = TC0640FIOMakeInputs; - TaitoDrawFunction = SlapshotDraw; - - nTaitoCyclesTotal[0] = 14364000 / 60; - nTaitoCyclesTotal[1] = 4000000 / 60; - - TimeKeeperInit(TIMEKEEPER_MK48T08, NULL); - - TaitoF2SpritesDisabled = 1; - TaitoF2SpritesActiveArea = 0; - TaitoF2SpriteType = 2; - TaitoXOffset = 3; - - TaitoF2SpriteBufferFunction = TaitoF2NoBuffer; - - for (INT32 i = 0; i < 8; i++) { - TaitoF2SpriteBankBuffered[i] = 0x400 * i; - TaitoF2SpriteBank[i] = TaitoF2SpriteBankBuffered[i]; - } - - return 0; -} - -static INT32 SlapshotInit() -{ - TaitoCharModulo = 0x400; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 16; - TaitoCharHeight = 16; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x2000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 6; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x4000; - - if (MachineInit()) return 1; - - INT32 nRet; - UINT8 *TempRom = (UINT8*)BurnMalloc(0x400000); - memset(TempRom, 0, 0x400000); - nRet = BurnLoadRom(TempRom + 0x000000, 6, 2); if (nRet) return 1; - nRet = BurnLoadRom(TempRom + 0x000001, 7, 2); if (nRet) return 1; - nRet = BurnLoadRom(TempRom + 0x300000, 8, 1); if (nRet) return 1; - INT32 Data; - INT32 Offset = 0x400000 / 2; - for (INT32 i = 0x400000 / 2 + 0x400000 / 4; i < 0x400000; i++) { - INT32 d1, d2, d3, d4; - - Data = TempRom[i]; - d1 = (Data >> 0) & 3; - d2 = (Data >> 2) & 3; - d3 = (Data >> 4) & 3; - d4 = (Data >> 6) & 3; - - TempRom[Offset] = (d1 << 2) | (d2 << 6); - Offset++; - - TempRom[Offset] = (d3 << 2) | (d4 << 6); - Offset++; - } - GfxDecode(TaitoNumSpriteA, TaitoSpriteANumPlanes, TaitoSpriteAWidth, TaitoSpriteAHeight, TaitoSpriteAPlaneOffsets, TaitoSpriteAXOffsets, TaitoSpriteAYOffsets, TaitoSpriteAModulo, TempRom, TaitoSpritesA); - BurnFree(TempRom); - - SlapshotDoReset(); - - return 0; -} - -static INT32 Opwolf3Init() -{ - TaitoCharModulo = 0x400; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 16; - TaitoCharHeight = 16; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x8000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 6; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = Opwolf3SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x8000; - - if (MachineInit()) return 1; - - INT32 nRet; - UINT8 *TempRom = (UINT8*)BurnMalloc(0x800000); - memset(TempRom, 0, 0x400000); - nRet = BurnLoadRom(TempRom + 0x000000, 8, 2); if (nRet) return 1; - nRet = BurnLoadRom(TempRom + 0x000001, 9, 2); if (nRet) return 1; - nRet = BurnLoadRom(TempRom + 0x600000, 10, 1); if (nRet) return 1; - INT32 Data; - INT32 Offset = 0x800000 / 2; - for (INT32 i = 0x800000 / 2 + 0x800000 / 4; i < 0x800000; i++) { - INT32 d1, d2, d3, d4; - - Data = TempRom[i]; - d1 = (Data >> 0) & 3; - d2 = (Data >> 2) & 3; - d3 = (Data >> 4) & 3; - d4 = (Data >> 6) & 3; - - TempRom[Offset] = (d1 << 2) | (d2 << 6); - Offset++; - - TempRom[Offset] = (d3 << 2) | (d4 << 6); - Offset++; - } - GfxDecode(TaitoNumSpriteA, TaitoSpriteANumPlanes, TaitoSpriteAWidth, TaitoSpriteAHeight, TaitoSpriteAPlaneOffsets, TaitoSpriteAXOffsets, TaitoSpriteAYOffsets, TaitoSpriteAModulo, TempRom, TaitoSpritesA); - BurnFree(TempRom); - - SekOpen(0); - SekMapHandler(1, 0xe00000, 0xe00007, SM_RAM); - SekSetReadWordHandler(1, Opwolf3Gun68KReadWord); - SekSetWriteWordHandler(1, Opwolf3Gun68KWriteWord); - SekSetReadByteHandler(1, Opwolf3Gun68KReadByte); - SekSetWriteByteHandler(1, Opwolf3Gun68KWriteByte); - SekClose(); - - TaitoMakeInputsFunction = Opwolf3MakeInputs; - TaitoDrawFunction = Opwolf3Draw; - - BurnGunInit(2, true); - - SlapshotDoReset(); - - return 0; -} - -static INT32 SlapshotExit() -{ - TaitoExit(); - - // Switch back CPU core if needed - if (bUseAsm68KCoreOldValue) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); -#endif - bUseAsm68KCoreOldValue = false; - bBurnUseASMCPUEmulation = true; - } - - TimeKeeperExit(); - - return 0; -} - -inline static INT32 CalcCol(INT32 nColour) -{ - INT32 r, g, b; - - r = (BURN_ENDIAN_SWAP_INT32(nColour) & 0x000000ff) >> 0; - g = (BURN_ENDIAN_SWAP_INT32(nColour) & 0xff000000) >> 24; - b = (BURN_ENDIAN_SWAP_INT32(nColour) & 0x00ff0000) >> 16; - - return BurnHighCol(r, g, b, 0); -} - -static void SlapshotCalcPalette() -{ - INT32 i; - UINT32* ps; - UINT32* pd; - - for (i = 0, ps = (UINT32*)TaitoPaletteRam, pd = TaitoPalette; i < 0x2000; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } -} - -static void SlapshotDraw() -{ - UINT8 Layer[4]; - UINT16 Priority = TC0480SCPGetBgPriority(); - - Layer[0] = (Priority & 0xf000) >> 12; - Layer[1] = (Priority & 0x0f00) >> 8; - Layer[2] = (Priority & 0x00f0) >> 4; - Layer[3] = (Priority & 0x000f) >> 0; - - TaitoF2TilePriority[Layer[0]] = TC0360PRIRegs[4] & 0x0f; - TaitoF2TilePriority[Layer[1]] = TC0360PRIRegs[4] >> 4; - TaitoF2TilePriority[Layer[2]] = TC0360PRIRegs[5] & 0x0f; - TaitoF2TilePriority[Layer[3]] = TC0360PRIRegs[5] >> 4; - - TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; - TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; - TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; - TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; - - SlapshotCalcPalette(); - BurnTransferClear(); - - TaitoF2MakeSpriteList(); - - for (INT32 i = 0; i < 16; i++) { - if (TaitoF2TilePriority[0] == i) TC0480SCPTilemapRender(Layer[0], 0, TaitoChars); - if (TaitoF2TilePriority[1] == i) TC0480SCPTilemapRender(Layer[1], 0, TaitoChars); - if (TaitoF2TilePriority[2] == i) TC0480SCPTilemapRender(Layer[2], 0, TaitoChars); - if (TaitoF2TilePriority[3] == i) TC0480SCPTilemapRender(Layer[3], 0, TaitoChars); - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - } - - TC0480SCPRenderCharLayer(); - - BurnTransferCopy(TaitoPalette); -} - -static void Opwolf3Draw() -{ - SlapshotDraw(); - - for (INT32 i = 0; i < nBurnGunNumPlayers; i++) { - BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); - } -} - -static INT32 SlapshotFrame() -{ - INT32 nInterleave = 100; - - if (TaitoReset) SlapshotDoReset(); - - TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - if ((GetCurrentFrame() % 60) == 0) TimeKeeperTick(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 #1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == 10) { SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); nTaitoCyclesDone[0] += SekRun(200000 - 500); } - if (i == (nInterleave - 1)) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - SekClose(); - - ZetOpen(0); - BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[1]); - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - TaitoF2HandleSpriteBuffering(); - - if (pBurnDraw) TaitoDrawFunction(); - - TaitoF2SpriteBufferFunction(); - - return 0; -} - -static INT32 SlapshotScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029709; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = TaitoRamStart; - ba.nLen = TaitoRamEnd-TaitoRamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - TaitoICScan(nAction); - - TimeKeeperScan(nAction); - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2610Scan(nAction, pnMin); - - SCAN_VAR(TC0640FIOInput); - SCAN_VAR(TaitoZ80Bank); - SCAN_VAR(nTaitoCyclesDone); - SCAN_VAR(nTaitoCyclesSegment); - SCAN_VAR(TaitoF2SpriteBank); - SCAN_VAR(TaitoF2SpriteBankBuffered); - } - - if (nAction & ACB_WRITE) { - if (TaitoZ80Bank) { - ZetOpen(0); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetClose(); - } - } - - return 0; -} - -static INT32 Opwolf3Scan(INT32 nAction, INT32 *pnMin) -{ - INT32 nRet = SlapshotScan(nAction, pnMin); - - if (nAction & ACB_DRIVER_DATA) { - BurnGunScan(); - } - - return nRet; -} - -struct BurnDriver BurnDrvSlapshot = { - "slapshot", NULL, NULL, NULL, "1994", - "Slap Shot (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SPORTSMISC, 0, - NULL, SlapshotRomInfo, SlapshotRomName, NULL, NULL, SlapshotInputInfo, SlapshotDIPInfo, - SlapshotInit, SlapshotExit, SlapshotFrame, NULL, SlapshotScan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvOpwolf3 = { - "opwolf3", NULL, NULL, NULL, "1994", - "Operation Wolf 3 (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, Opwolf3RomInfo, Opwolf3RomName, NULL, NULL, Opwolf3InputInfo, Opwolf3DIPInfo, - Opwolf3Init, SlapshotExit, SlapshotFrame, NULL, Opwolf3Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvOpwolf3u = { - "opwolf3u", "opwolf3", NULL, NULL, "1994", - "Operation Wolf 3 (US)\0", NULL, "Taito America Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, Opwolf3uRomInfo, Opwolf3uRomName, NULL, NULL, Opwolf3InputInfo, Opwolf3DIPInfo, - Opwolf3Init, SlapshotExit, SlapshotFrame, NULL, Opwolf3Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "taito.h" +#include "taito_ic.h" +#include "burn_ym2610.h" +#include "eeprom.h" +#include "burn_gun.h" +#include "timekpr.h" + +static void SlapshotDraw(); +static void Opwolf3Draw(); +static TaitoF2SpriteBufferUpdate TaitoF2SpriteBufferFunction; + +static bool bUseAsm68KCoreOldValue = false; + +#define A(a, b, c, d) {a, b, (UINT8*)(c), d} + +static struct BurnInputInfo SlapshotInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0640FIOInputPort1 + 4, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0640FIOInputPort3 + 4, "p1 start" }, + {"Start 2" , BIT_DIGITAL , TC0640FIOInputPort3 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0640FIOInputPort4 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0640FIOInputPort4 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0640FIOInputPort4 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0640FIOInputPort4 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0640FIOInputPort2 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0640FIOInputPort2 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0640FIOInputPort2 + 2, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , TC0640FIOInputPort4 + 4, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0640FIOInputPort4 + 5, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0640FIOInputPort4 + 6, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0640FIOInputPort4 + 7, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0640FIOInputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0640FIOInputPort2 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0640FIOInputPort2 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0640FIOInputPort3 + 0, "service" }, + {"Tilt" , BIT_DIGITAL , TC0640FIOInputPort1 + 1, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, +}; + +STDINPUTINFO(Slapshot) + +static struct BurnInputInfo Opwolf3InputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0640FIOInputPort1 + 4, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0640FIOInputPort2 + 2, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0640FIOInputPort1 + 5, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0640FIOInputPort2 + 6, "p2 start" }, + {"Coin 3" , BIT_DIGITAL , TC0640FIOInputPort1 + 6, "p3 coin" }, + {"Coin 4" , BIT_DIGITAL , TC0640FIOInputPort1 + 7, "p4 coin" }, + + A("P1 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "mouse x-axis" ), + A("P1 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "mouse y-axis" ), + {"P1 Fire 1" , BIT_DIGITAL , TC0640FIOInputPort2 + 0, "mouse button 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0640FIOInputPort2 + 1, "mouse button 2" }, + + A("P2 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort2 , "p2 x-axis" ), + A("P2 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort3 , "p2 y-axis" ), + {"P2 Fire 1" , BIT_DIGITAL , TC0640FIOInputPort2 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0640FIOInputPort2 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0640FIOInputPort3 + 0, "service" }, + {"Tilt" , BIT_DIGITAL , TC0640FIOInputPort1 + 1, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, +}; + +STDINPUTINFO(Opwolf3) + +#undef A + +static void TC0640FIOMakeInputs() +{ + TC0640FIOInput[0] = 0xff; + TC0640FIOInput[1] = 0xff; + TC0640FIOInput[2] = 0xff; + TC0640FIOInput[3] = 0xff; + TC0640FIOInput[4] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + TC0640FIOInput[0] -= (TC0640FIOInputPort0[i] & 1) << i; + TC0640FIOInput[1] -= (TC0640FIOInputPort1[i] & 1) << i; + TC0640FIOInput[2] -= (TC0640FIOInputPort2[i] & 1) << i; + TC0640FIOInput[3] -= (TC0640FIOInputPort3[i] & 1) << i; + TC0640FIOInput[4] -= (TC0640FIOInputPort4[i] & 1) << i; + } +} + +static void Opwolf3MakeInputs() +{ + TC0640FIOMakeInputs(); + + BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); + BurnGunMakeInputs(1, (INT16)TaitoAnalogPort2, (INT16)TaitoAnalogPort3); +} + +static struct BurnDIPInfo SlapshotDIPList[]= +{ + {0x14, 0xff, 0xff, 0x10, NULL }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x14, 0x01, 0x10, 0x10, "Off" }, + {0x14, 0x01, 0x10, 0x00, "On" }, +}; + +STDDIPINFO(Slapshot) + +static struct BurnDIPInfo Opwolf3DIPList[]= +{ + {0x11, 0xff, 0xff, 0x10, NULL }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x10, 0x10, "Off" }, + {0x11, 0x01, 0x10, 0x00, "On" }, +}; + +STDDIPINFO(Opwolf3) + +static struct BurnRomInfo SlapshotRomDesc[] = { + { "d71-15.3", 0x080000, 0x1470153f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d71-16.1", 0x080000, 0xf13666e0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "d71-07.77", 0x010000, 0xdd5f670c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d71-04.79", 0x080000, 0xb727b81c, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "d71-05.80", 0x080000, 0x7b0f5d6d, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "d71-06.37", 0x080000, 0xf3324188, BRF_SND | TAITO_YM2610A }, + + // Sprites - handled manually + { "d71-01.23", 0x100000, 0x0b1e8c27, BRF_GRA }, + { "d71-02.24", 0x100000, 0xccaaea2d, BRF_GRA }, + { "d71-03.25", 0x100000, 0xdccef9ec, BRF_GRA }, +}; + +STD_ROM_PICK(Slapshot) +STD_ROM_FN(Slapshot) + +static struct BurnRomInfo Opwolf3RomDesc[] = { + { "d74_16.3", 0x080000, 0x198ff1f6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d74_21.1", 0x080000, 0xc61c558b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d74_18.18", 0x080000, 0xbd5d7cdb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d74_17.17", 0x080000, 0xac35a672, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "d74_22.77", 0x010000, 0x118374a6, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d74_05.80", 0x200000, 0x85ea64cc, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "d74_06.81", 0x200000, 0x2fa1e08d, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "d74_01.37", 0x200000, 0x115313e0, BRF_SND | TAITO_YM2610A }, + + // Sprites - handled manually + { "d74_02.23", 0x200000, 0xaab86332, BRF_GRA }, + { "d74_03.24", 0x200000, 0x3f398916, BRF_GRA }, + { "d74_04.25", 0x200000, 0x2f385638, BRF_GRA }, +}; + +STD_ROM_PICK(Opwolf3) +STD_ROM_FN(Opwolf3) + +static struct BurnRomInfo Opwolf3uRomDesc[] = { + { "d74_16.3", 0x080000, 0x198ff1f6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d74_20.1", 0x080000, 0x960fd892, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d74_18.18", 0x080000, 0xbd5d7cdb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d74_17.17", 0x080000, 0xac35a672, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "d74_19.77", 0x010000, 0x05d53f06, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d74_05.80", 0x200000, 0x85ea64cc, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "d74_06.81", 0x200000, 0x2fa1e08d, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "d74_01.37", 0x200000, 0x115313e0, BRF_SND | TAITO_YM2610A }, + + // Sprites - handled manually + { "d74_02.23", 0x200000, 0xaab86332, BRF_GRA }, + { "d74_03.24", 0x200000, 0x3f398916, BRF_GRA }, + { "d74_04.25", 0x200000, 0x2f385638, BRF_GRA }, +}; + +STD_ROM_PICK(Opwolf3u) +STD_ROM_FN(Opwolf3u) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += Taito68KRom1Size; + TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; + TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; + TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x10000; + TaitoZ80Ram1 = Next; Next += 0x02000; + TaitoSpriteRam = Next; Next += 0x10000; + TaitoSpriteRamBuffered = Next; Next += 0x10000; + TaitoSpriteExtension = Next; Next += 0x02000; + TaitoPaletteRam = Next; Next += 0x08000; + + TaitoRamEnd = Next; + + TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; + TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; + TaitoPalette = (UINT32*)Next; Next += 0x02000 * sizeof(UINT32); + TaitoF2SpriteList = (TaitoF2SpriteEntry*)Next; Next += 0x400 * sizeof(TaitoF2SpriteEntry); + + TaitoMemEnd = Next; + + return 0; +} + +static INT32 SlapshotDoReset() +{ + TaitoDoReset(); + + return 0; +} + +UINT8 __fastcall Slapshot68KReadByte(UINT32 a) +{ + if (a >= 0xa00000 && a <= 0xa03fff) { + return TimeKeeperRead((a - 0xa00000) >> 1); + } + + if (a >= 0xc00000 && a <= 0xc0000f) { + return TC0640FIORead((a - 0xc00000) >> 1); + } + + if (a >= 0xc00020 && a <= 0xc0002f) { + if (a == 0xc00027) bprintf(PRINT_IMPORTANT, _T("%x\n"), a); + + if (a == 0xc00026) return (TC0640FIOInput[2] & 0xef) | (TaitoDip[0] & 0x10); + + return TC0640FIORead((a - 0xc00020) >> 1); + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Slapshot68KWriteByte(UINT32 a, UINT8 d) +{ + if (a <= 0x0fffff) return; + + if (a >= 0xa00000 && a <= 0xa03fff) { + TimeKeeperWrite((a - 0xa00000) >> 1, d); + return; + } + + TC0360PRIHalfWordWrite_Map(0xb00000) + + if (a >= 0xc00000 && a <= 0xc0000f) { + TC0640FIOWrite((a - 0xc00000) >> 1, d); + return; + } + + if (a >= 0xc00010 && a <= 0xc0002f) { + return; + } + + switch (a) { + case 0xd00000: { + TC0140SYTPortWrite(d); + return; + } + + case 0xd00002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Slapshot68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Slapshot68KWriteWord(UINT32 a, UINT16 d) +{ + TC0480SCPCtrlWordWrite_Map(0x830000) + + if (a >= 0xc00000 && a <= 0xc0000f) { + TC0640FIOWrite((a - 0xc00000) >> 1, d); + return; + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Opwolf3Gun68KReadByte(UINT32 a) +{ + switch (a) { + case 0xe00000: { + float Temp = (float)~BurnGunReturnX(0) / 256.0; + Temp *= 160.0; + return ((UINT8)Temp - 0x5b) & 0xff; + } + + case 0xe00002: { + float Temp = (float)BurnGunReturnY(0) / 256.0; + Temp *= 112; + return ((UINT8)Temp + 0x08) & 0xff; + } + + case 0xe00004: { + float Temp = (float)~BurnGunReturnX(1) / 256.0; + Temp *= 160.0; + return ((UINT8)Temp - 0x5b) & 0xff; + } + + case 0xe00006: { + float Temp = (float)BurnGunReturnY(1) / 256.0; + Temp *= 112; + return ((UINT8)Temp + 0x08) & 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Opwolf3Gun68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xe00000: + case 0xe00002: + case 0xe00004: + case 0xe00006: { + SekSetIRQLine(3, SEK_IRQSTATUS_AUTO); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Opwolf3Gun68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Opwolf3Gun68KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall SlapshotZ80Read(UINT16 a) +{ + switch (a) { + case 0xe000: { + return BurnYM2610Read(0); + } + + case 0xe201: { + return TC0140SYTSlaveCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall SlapshotZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe000: { + BurnYM2610Write(0, d); + return; + } + + case 0xe001: { + BurnYM2610Write(1, d); + return; + } + + case 0xe002: { + BurnYM2610Write(2, d); + return; + } + + case 0xe003: { + BurnYM2610Write(3, d); + return; + } + + case 0xe200: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xe201: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xf200: { + TaitoZ80Bank = (d - 1) & 7; + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static void SlapshotFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 SlapshotSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double SlapshotGetTime() +{ + return (double)ZetTotalCycles() / 4000000; +} + +static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 CharXOffsets[16] = { 4, 0, 20, 16, 12, 8, 28, 24, 36, 32, 52, 48, 44, 40, 60, 56 }; +static INT32 CharYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; +static INT32 SpritePlaneOffsets[6] = { 0x1000000, 0x1000001, 0, 1, 2, 3 }; +static INT32 SpriteXOffsets[16] = { 4, 0, 12, 8, 20, 16, 28, 24, 36, 32, 44, 40, 52, 48, 60, 56 }; +static INT32 SpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; +static INT32 Opwolf3SpritePlaneOffsets[6] = { 0x2000000, 0x2000001, 0, 1, 2, 3 }; + +static void SwitchToMusashi() +{ + if (bBurnUseASMCPUEmulation) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); +#endif + bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; + bBurnUseASMCPUEmulation = false; + } +} + +static INT32 MachineInit() +{ + INT32 nLen; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0480SCPInit(TaitoNumChar, 3, 30, 9, -1, 1, -2); + TC0480SCPSetColourBase(256); + TC0140SYTInit(); + TC0360PRIInit(); + TC0640FIOInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, Taito68KRom1Size - 1, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x500000, 0x50ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x600000, 0x60ffff, SM_RAM); + SekMapMemory(TaitoSpriteExtension , 0x700000, 0x701fff, SM_RAM); + SekMapMemory(TC0480SCPRam , 0x800000, 0x80ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x900000, 0x907fff, SM_RAM); + SekSetReadWordHandler(0, Slapshot68KReadWord); + SekSetWriteWordHandler(0, Slapshot68KWriteWord); + SekSetReadByteHandler(0, Slapshot68KReadByte); + SekSetWriteByteHandler(0, Slapshot68KWriteByte); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(SlapshotZ80Read); + ZetSetWriteHandler(SlapshotZ80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2610Init(8000000, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &SlapshotFMIRQHandler, SlapshotSynchroniseStream, SlapshotGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + TaitoMakeInputsFunction = TC0640FIOMakeInputs; + TaitoDrawFunction = SlapshotDraw; + + nTaitoCyclesTotal[0] = 14364000 / 60; + nTaitoCyclesTotal[1] = 4000000 / 60; + + TimeKeeperInit(TIMEKEEPER_MK48T08, NULL); + + TaitoF2SpritesDisabled = 1; + TaitoF2SpritesActiveArea = 0; + TaitoF2SpriteType = 2; + TaitoXOffset = 3; + + TaitoF2SpriteBufferFunction = TaitoF2NoBuffer; + + for (INT32 i = 0; i < 8; i++) { + TaitoF2SpriteBankBuffered[i] = 0x400 * i; + TaitoF2SpriteBank[i] = TaitoF2SpriteBankBuffered[i]; + } + + return 0; +} + +static INT32 SlapshotInit() +{ + TaitoCharModulo = 0x400; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 16; + TaitoCharHeight = 16; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x2000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 6; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x4000; + + if (MachineInit()) return 1; + + INT32 nRet; + UINT8 *TempRom = (UINT8*)BurnMalloc(0x400000); + memset(TempRom, 0, 0x400000); + nRet = BurnLoadRom(TempRom + 0x000000, 6, 2); if (nRet) return 1; + nRet = BurnLoadRom(TempRom + 0x000001, 7, 2); if (nRet) return 1; + nRet = BurnLoadRom(TempRom + 0x300000, 8, 1); if (nRet) return 1; + INT32 Data; + INT32 Offset = 0x400000 / 2; + for (INT32 i = 0x400000 / 2 + 0x400000 / 4; i < 0x400000; i++) { + INT32 d1, d2, d3, d4; + + Data = TempRom[i]; + d1 = (Data >> 0) & 3; + d2 = (Data >> 2) & 3; + d3 = (Data >> 4) & 3; + d4 = (Data >> 6) & 3; + + TempRom[Offset] = (d1 << 2) | (d2 << 6); + Offset++; + + TempRom[Offset] = (d3 << 2) | (d4 << 6); + Offset++; + } + GfxDecode(TaitoNumSpriteA, TaitoSpriteANumPlanes, TaitoSpriteAWidth, TaitoSpriteAHeight, TaitoSpriteAPlaneOffsets, TaitoSpriteAXOffsets, TaitoSpriteAYOffsets, TaitoSpriteAModulo, TempRom, TaitoSpritesA); + BurnFree(TempRom); + + SlapshotDoReset(); + + return 0; +} + +static INT32 Opwolf3Init() +{ + TaitoCharModulo = 0x400; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 16; + TaitoCharHeight = 16; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x8000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 6; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = Opwolf3SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x8000; + + if (MachineInit()) return 1; + + INT32 nRet; + UINT8 *TempRom = (UINT8*)BurnMalloc(0x800000); + memset(TempRom, 0, 0x400000); + nRet = BurnLoadRom(TempRom + 0x000000, 8, 2); if (nRet) return 1; + nRet = BurnLoadRom(TempRom + 0x000001, 9, 2); if (nRet) return 1; + nRet = BurnLoadRom(TempRom + 0x600000, 10, 1); if (nRet) return 1; + INT32 Data; + INT32 Offset = 0x800000 / 2; + for (INT32 i = 0x800000 / 2 + 0x800000 / 4; i < 0x800000; i++) { + INT32 d1, d2, d3, d4; + + Data = TempRom[i]; + d1 = (Data >> 0) & 3; + d2 = (Data >> 2) & 3; + d3 = (Data >> 4) & 3; + d4 = (Data >> 6) & 3; + + TempRom[Offset] = (d1 << 2) | (d2 << 6); + Offset++; + + TempRom[Offset] = (d3 << 2) | (d4 << 6); + Offset++; + } + GfxDecode(TaitoNumSpriteA, TaitoSpriteANumPlanes, TaitoSpriteAWidth, TaitoSpriteAHeight, TaitoSpriteAPlaneOffsets, TaitoSpriteAXOffsets, TaitoSpriteAYOffsets, TaitoSpriteAModulo, TempRom, TaitoSpritesA); + BurnFree(TempRom); + + SekOpen(0); + SekMapHandler(1, 0xe00000, 0xe00007, SM_RAM); + SekSetReadWordHandler(1, Opwolf3Gun68KReadWord); + SekSetWriteWordHandler(1, Opwolf3Gun68KWriteWord); + SekSetReadByteHandler(1, Opwolf3Gun68KReadByte); + SekSetWriteByteHandler(1, Opwolf3Gun68KWriteByte); + SekClose(); + + TaitoMakeInputsFunction = Opwolf3MakeInputs; + TaitoDrawFunction = Opwolf3Draw; + + BurnGunInit(2, true); + + SlapshotDoReset(); + + return 0; +} + +static INT32 SlapshotExit() +{ + TaitoExit(); + + // Switch back CPU core if needed + if (bUseAsm68KCoreOldValue) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); +#endif + bUseAsm68KCoreOldValue = false; + bBurnUseASMCPUEmulation = true; + } + + TimeKeeperExit(); + + return 0; +} + +inline static INT32 CalcCol(INT32 nColour) +{ + INT32 r, g, b; + + r = (BURN_ENDIAN_SWAP_INT32(nColour) & 0x000000ff) >> 0; + g = (BURN_ENDIAN_SWAP_INT32(nColour) & 0xff000000) >> 24; + b = (BURN_ENDIAN_SWAP_INT32(nColour) & 0x00ff0000) >> 16; + + return BurnHighCol(r, g, b, 0); +} + +static void SlapshotCalcPalette() +{ + INT32 i; + UINT32* ps; + UINT32* pd; + + for (i = 0, ps = (UINT32*)TaitoPaletteRam, pd = TaitoPalette; i < 0x2000; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } +} + +static void SlapshotDraw() +{ + UINT8 Layer[4]; + UINT16 Priority = TC0480SCPGetBgPriority(); + + Layer[0] = (Priority & 0xf000) >> 12; + Layer[1] = (Priority & 0x0f00) >> 8; + Layer[2] = (Priority & 0x00f0) >> 4; + Layer[3] = (Priority & 0x000f) >> 0; + + TaitoF2TilePriority[Layer[0]] = TC0360PRIRegs[4] & 0x0f; + TaitoF2TilePriority[Layer[1]] = TC0360PRIRegs[4] >> 4; + TaitoF2TilePriority[Layer[2]] = TC0360PRIRegs[5] & 0x0f; + TaitoF2TilePriority[Layer[3]] = TC0360PRIRegs[5] >> 4; + + TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; + TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; + TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; + TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; + + SlapshotCalcPalette(); + BurnTransferClear(); + + TaitoF2MakeSpriteList(); + + for (INT32 i = 0; i < 16; i++) { + if (TaitoF2TilePriority[0] == i) TC0480SCPTilemapRender(Layer[0], 0, TaitoChars); + if (TaitoF2TilePriority[1] == i) TC0480SCPTilemapRender(Layer[1], 0, TaitoChars); + if (TaitoF2TilePriority[2] == i) TC0480SCPTilemapRender(Layer[2], 0, TaitoChars); + if (TaitoF2TilePriority[3] == i) TC0480SCPTilemapRender(Layer[3], 0, TaitoChars); + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + } + + TC0480SCPRenderCharLayer(); + + BurnTransferCopy(TaitoPalette); +} + +static void Opwolf3Draw() +{ + SlapshotDraw(); + + for (INT32 i = 0; i < nBurnGunNumPlayers; i++) { + BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); + } +} + +static INT32 SlapshotFrame() +{ + INT32 nInterleave = 100; + + if (TaitoReset) SlapshotDoReset(); + + TaitoMakeInputsFunction(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + if ((GetCurrentFrame() % 60) == 0) TimeKeeperTick(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 #1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == 10) { SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); nTaitoCyclesDone[0] += SekRun(200000 - 500); } + if (i == (nInterleave - 1)) SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + SekClose(); + + ZetOpen(0); + BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrame(nTaitoCyclesTotal[1]); + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + TaitoF2HandleSpriteBuffering(); + + if (pBurnDraw) TaitoDrawFunction(); + + TaitoF2SpriteBufferFunction(); + + return 0; +} + +static INT32 SlapshotScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029709; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = TaitoRamStart; + ba.nLen = TaitoRamEnd-TaitoRamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + TaitoICScan(nAction); + + TimeKeeperScan(nAction); + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2610Scan(nAction, pnMin); + + SCAN_VAR(TC0640FIOInput); + SCAN_VAR(TaitoZ80Bank); + SCAN_VAR(nTaitoCyclesDone); + SCAN_VAR(nTaitoCyclesSegment); + SCAN_VAR(TaitoF2SpriteBank); + SCAN_VAR(TaitoF2SpriteBankBuffered); + } + + if (nAction & ACB_WRITE) { + if (TaitoZ80Bank) { + ZetOpen(0); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetClose(); + } + } + + return 0; +} + +static INT32 Opwolf3Scan(INT32 nAction, INT32 *pnMin) +{ + INT32 nRet = SlapshotScan(nAction, pnMin); + + if (nAction & ACB_DRIVER_DATA) { + BurnGunScan(); + } + + return nRet; +} + +struct BurnDriver BurnDrvSlapshot = { + "slapshot", NULL, NULL, NULL, "1994", + "Slap Shot (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SPORTSMISC, 0, + NULL, SlapshotRomInfo, SlapshotRomName, NULL, NULL, SlapshotInputInfo, SlapshotDIPInfo, + SlapshotInit, SlapshotExit, SlapshotFrame, NULL, SlapshotScan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvOpwolf3 = { + "opwolf3", NULL, NULL, NULL, "1994", + "Operation Wolf 3 (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, Opwolf3RomInfo, Opwolf3RomName, NULL, NULL, Opwolf3InputInfo, Opwolf3DIPInfo, + Opwolf3Init, SlapshotExit, SlapshotFrame, NULL, Opwolf3Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvOpwolf3u = { + "opwolf3u", "opwolf3", NULL, NULL, "1994", + "Operation Wolf 3 (US)\0", NULL, "Taito America Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, Opwolf3uRomInfo, Opwolf3uRomName, NULL, NULL, Opwolf3InputInfo, Opwolf3DIPInfo, + Opwolf3Init, SlapshotExit, SlapshotFrame, NULL, Opwolf3Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; diff --git a/src/burn/drv/taito/d_taitob.cpp b/src/burn/drv/taito/d_taitob.cpp index 1f68c2b37..883d0f2f3 100644 --- a/src/burn/drv/taito/d_taitob.cpp +++ b/src/burn/drv/taito/d_taitob.cpp @@ -1,4137 +1,4135 @@ -// FB Alpha Taito B System driver module -// Based on MAME driver by Jarek Burczynski and various others - -// to do: -// fix rambo alt sets inputs -// master of weapon title screen is incorrect - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "taito.h" -#include "taito_ic.h" -#include "burn_ym2610.h" -#include "msm6295.h" -#include "burn_ym2203.h" -#include "burn_gun.h" -#include "eeprom.h" - -static UINT8 *DrvPxlRAM = NULL; -static UINT16 *DrvPxlScroll = NULL; -static UINT8 *DrvFramebuffer = NULL; - -static INT32 eeprom_latch = 0; -static INT32 coin_control = 0; - -static UINT8 color_config[4]; -static INT32 irq_config[2]; -static INT32 sound_config = 0; -static INT32 cpu_speed[2]; -static UINT8 nTaitoInputConfig[5] = { 0, 0, 0, 0, 0 }; - -static struct BurnInputInfo CommonInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, -}; - -STDINPUTINFO(Common) - -static struct BurnInputInfo PbobbleInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TaitoInputPort3 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TaitoInputPort3 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TaitoInputPort3 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TaitoInputPort3 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TaitoInputPort3 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TaitoInputPort3 + 5, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TaitoInputPort3 + 6, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TaitoInputPort3 + 7, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 fire 3" }, - - {"P3 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 6, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 6, "p3 start" }, - {"P3 Up", BIT_DIGITAL, TaitoInputPort5 + 0, "p3 up" }, - {"P3 Down", BIT_DIGITAL, TaitoInputPort5 + 1, "p3 down" }, - {"P3 Left", BIT_DIGITAL, TaitoInputPort5 + 2, "p3 left" }, - {"P3 Right", BIT_DIGITAL, TaitoInputPort5 + 3, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, TaitoInputPort4 + 0, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, TaitoInputPort4 + 1, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, TaitoInputPort4 + 2, "p3 fire 3" }, - - {"P4 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 7, "p4 coin" }, - {"P4 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 7, "p4 start" }, - {"P4 Up", BIT_DIGITAL, TaitoInputPort5 + 4, "p4 up" }, - {"P4 Down", BIT_DIGITAL, TaitoInputPort5 + 5, "p4 down" }, - {"P4 Left", BIT_DIGITAL, TaitoInputPort5 + 6, "p4 left" }, - {"P4 Right", BIT_DIGITAL, TaitoInputPort5 + 7, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, TaitoInputPort4 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, TaitoInputPort4 + 5, "p4 fire 2" }, - {"P4 Button 3", BIT_DIGITAL, TaitoInputPort4 + 6, "p4 fire 3" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "service" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, -}; - -STDINPUTINFO(Pbobble) - -static struct BurnInputInfo QzshowbyInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, TaitoInputPort3 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TaitoInputPort3 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, TaitoInputPort3 + 3, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, TaitoInputPort3 + 2, "p1 fire 4" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, TaitoInputPort3 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TaitoInputPort3 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, TaitoInputPort3 + 7, "p2 fire 3" }, - {"P2 Button 4", BIT_DIGITAL, TaitoInputPort3 + 6, "p2 fire 4" }, - - {"P3 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 6, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 6, "p3 start" }, - {"P3 Button 1", BIT_DIGITAL, TaitoInputPort5 + 8, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, TaitoInputPort5 + 9, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, TaitoInputPort5 + 11, "p3 fire 3" }, - {"P3 Button 4", BIT_DIGITAL, TaitoInputPort5 + 10, "p3 fire 4" }, - - {"P4 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 7, "p4 coin" }, - {"P4 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 7, "p4 start" }, - {"P4 Button 1", BIT_DIGITAL, TaitoInputPort5 + 12, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, TaitoInputPort5 + 13, "p4 fire 2" }, - {"P4 Button 3", BIT_DIGITAL, TaitoInputPort5 + 15, "p4 fire 3" }, - {"P4 Button 4", BIT_DIGITAL, TaitoInputPort5 + 14, "p4 fire 4" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "service" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, -}; - -STDINPUTINFO(Qzshowby) - -static struct BurnInputInfo SpacedxoInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 fire 3" }, - - {"P3 Coin", BIT_DIGITAL, TaitoInputPort5 + 0, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, TaitoInputPort3 + 0, "p3 start" }, - {"P3 Up", BIT_DIGITAL, TaitoInputPort3 + 3, "p3 up" }, - {"P3 Down", BIT_DIGITAL, TaitoInputPort3 + 4, "p3 down" }, - {"P3 Left", BIT_DIGITAL, TaitoInputPort3 + 1, "p3 left" }, - {"P3 Right", BIT_DIGITAL, TaitoInputPort3 + 2, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, TaitoInputPort3 + 5, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, TaitoInputPort3 + 6, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, TaitoInputPort3 + 7, "p3 fire 3" }, - - {"P4 Coin", BIT_DIGITAL, TaitoInputPort5 + 2, "p4 coin" }, - {"P4 Start", BIT_DIGITAL, TaitoInputPort4 + 0, "p4 start" }, - {"P4 Up", BIT_DIGITAL, TaitoInputPort4 + 3, "p4 up" }, - {"P4 Down", BIT_DIGITAL, TaitoInputPort4 + 4, "p4 down" }, - {"P4 Left", BIT_DIGITAL, TaitoInputPort4 + 1, "p4 left" }, - {"P4 Right", BIT_DIGITAL, TaitoInputPort4 + 2, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, TaitoInputPort4 + 5, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, TaitoInputPort4 + 6, "p4 fire 2" }, - {"P4 Button 3", BIT_DIGITAL, TaitoInputPort4 + 7, "p4 fire 3" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, - {"Service", BIT_DIGITAL, TaitoInputPort5 + 1, "service" }, - {"Service", BIT_DIGITAL, TaitoInputPort5 + 3, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, -}; - -STDINPUTINFO(Spacedxo) - -static struct BurnInputInfo SelfeenaInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset"}, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, -}; - -STDINPUTINFO(Selfeena) - -static struct BurnInputInfo SbmInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p1 fire 3" }, - {"P1 Button 4", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p1 fire 4" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 6, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 7, "p2 right" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, -}; - -STDINPUTINFO(Sbm) - -static struct BurnInputInfo SilentdInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 fire 3" }, - - {"P3 Coin", BIT_DIGITAL, TaitoInputPort5 + 0, "p3 coin" }, - {"P3 Start", BIT_DIGITAL, TaitoInputPort3 + 0, "p3 start" }, - {"P3 Up", BIT_DIGITAL, TaitoInputPort3 + 3, "p3 up" }, - {"P3 Down", BIT_DIGITAL, TaitoInputPort3 + 4, "p3 down" }, - {"P3 Left", BIT_DIGITAL, TaitoInputPort3 + 1, "p3 left" }, - {"P3 Right", BIT_DIGITAL, TaitoInputPort3 + 2, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, TaitoInputPort3 + 5, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, TaitoInputPort3 + 6, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, TaitoInputPort3 + 7, "p3 fire 3" }, - - {"P4 Coin", BIT_DIGITAL, TaitoInputPort5 + 2, "p4 coin" }, - {"P4 Start", BIT_DIGITAL, TaitoInputPort4 + 0, "p4 start" }, - {"P4 Up", BIT_DIGITAL, TaitoInputPort4 + 3, "p4 up" }, - {"P4 Down", BIT_DIGITAL, TaitoInputPort4 + 4, "p4 down" }, - {"P4 Left", BIT_DIGITAL, TaitoInputPort4 + 1, "p4 left" }, - {"P4 Right", BIT_DIGITAL, TaitoInputPort4 + 2, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, TaitoInputPort4 + 5, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, TaitoInputPort4 + 6, "p4 fire 2" }, - {"P4 Button 3", BIT_DIGITAL, TaitoInputPort4 + 7, "p4 fire 3" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, -}; - -STDINPUTINFO(Silentd) - -static struct BurnInputInfo ViofightInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset"}, - {"Service", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, -}; - -STDINPUTINFO(Viofight) - -static struct BurnInputInfo HiticeInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 fire 3" }, - - {"P3 Start", BIT_DIGITAL, TaitoInputPort3 + 7, "p3 start" }, - {"P3 Up", BIT_DIGITAL, TaitoInputPort3 + 0, "p3 up" }, - {"P3 Down", BIT_DIGITAL, TaitoInputPort3 + 1, "p3 down" }, - {"P3 Left", BIT_DIGITAL, TaitoInputPort3 + 2, "p3 left" }, - {"P3 Right", BIT_DIGITAL, TaitoInputPort3 + 3, "p3 right" }, - {"P3 Button 1", BIT_DIGITAL, TaitoInputPort3 + 4, "p3 fire 1" }, - {"P3 Button 2", BIT_DIGITAL, TaitoInputPort3 + 5, "p3 fire 2" }, - {"P3 Button 3", BIT_DIGITAL, TaitoInputPort3 + 6, "p3 fire 3" }, - - {"P4 Start", BIT_DIGITAL, TaitoInputPort4 + 7, "p4 start" }, - {"P4 Up", BIT_DIGITAL, TaitoInputPort4 + 0, "p4 up" }, - {"P4 Down", BIT_DIGITAL, TaitoInputPort4 + 1, "p4 down" }, - {"P4 Left", BIT_DIGITAL, TaitoInputPort4 + 2, "p4 left" }, - {"P4 Right", BIT_DIGITAL, TaitoInputPort4 + 3, "p4 right" }, - {"P4 Button 1", BIT_DIGITAL, TaitoInputPort4 + 4, "p4 fire 1" }, - {"P4 Button 2", BIT_DIGITAL, TaitoInputPort4 + 5, "p4 fire 2" }, - {"P4 Button 3", BIT_DIGITAL, TaitoInputPort4 + 6, "p4 fire 3" }, - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, -}; - -STDINPUTINFO(Hitice) - -#define A(a, b, c, d) {a, b, (UINT8*)(c), d} - -static struct BurnInputInfo Rambo3uInputList[] = { - {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p1 start" }, - {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 fire 2" }, - - A("P1 Trackball X", BIT_ANALOG_REL, &TaitoAnalogPort0, "p1 x-axis" ), - A("P1 Trackball Y", BIT_ANALOG_REL, &TaitoAnalogPort1, "p1 y-axis" ), - - {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 start" }, - {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 up" }, - {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 down" }, - {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 left" }, - {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 fire 2" }, - - A("P2 Trackball X", BIT_ANALOG_REL, &TaitoAnalogPort2, "p2 x-axis" ), - A("P2 Trackball Y", BIT_ANALOG_REL, &TaitoAnalogPort3, "p2 y-axis" ), - - {"Reset", BIT_DIGITAL, &TaitoReset, "reset"}, - {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, - {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, - {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, -}; - -STDINPUTINFO(Rambo3u) - -#undef A - -static struct BurnDIPInfo NastarDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 0, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "100k only" }, - {0x14, 0x01, 0x0c, 0x08, "150k only" }, - {0x14, 0x01, 0x0c, 0x04, "200k only" }, - {0x14, 0x01, 0x0c, 0x00, "250k only" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x20, "1" }, - {0x14, 0x01, 0x30, 0x10, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Nastar) - -static struct BurnDIPInfo Rastsag2DIPList[]= -{ - {0x13, 0xff, 0xff, 0x3f, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 0, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "100k only" }, - {0x14, 0x01, 0x0c, 0x08, "150k only" }, - {0x14, 0x01, 0x0c, 0x04, "200k only" }, - {0x14, 0x01, 0x0c, 0x00, "250k only" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x20, "1" }, - {0x14, 0x01, 0x30, 0x10, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 4, "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Rastsag2) - -static struct BurnDIPInfo NastarwDIPList[]= -{ - {0x13, 0xff, 0xff, 0x3e, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "100k only" }, - {0x14, 0x01, 0x0c, 0x08, "150k only" }, - {0x14, 0x01, 0x0c, 0x04, "200k only" }, - {0x14, 0x01, 0x0c, 0x00, "250k only" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x20, "1" }, - {0x14, 0x01, 0x30, 0x10, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Nastarw) - -static struct BurnDIPInfo AshuraDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "every 100k" }, - {0x14, 0x01, 0x0c, 0x0c, "every 150k" }, - {0x14, 0x01, 0x0c, 0x04, "every 200k" }, - {0x14, 0x01, 0x0c, 0x00, "every 250k" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x00, "1" }, - {0x14, 0x01, 0x30, 0x10, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Ashura) - -static struct BurnDIPInfo AshurajDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "every 100k" }, - {0x14, 0x01, 0x0c, 0x0c, "every 150k" }, - {0x14, 0x01, 0x0c, 0x04, "every 200k" }, - {0x14, 0x01, 0x0c, 0x00, "every 250k" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x00, "1" }, - {0x14, 0x01, 0x30, 0x10, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Ashuraj) - -static struct BurnDIPInfo AshurauDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Continue Price" }, - {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "Same as Start" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "every 100k" }, - {0x14, 0x01, 0x0c, 0x0c, "every 150k" }, - {0x14, 0x01, 0x0c, 0x04, "every 200k" }, - {0x14, 0x01, 0x0c, 0x00, "every 250k" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x00, "1" }, - {0x14, 0x01, 0x30, 0x10, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Ashurau) - -static struct BurnDIPInfo CrimecDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Hi Score" }, - {0x13, 0x01, 0x01, 0x01, "Scribble" }, - {0x13, 0x01, 0x01, 0x00, "3 Characters" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "every 80k" }, - {0x14, 0x01, 0x0c, 0x0c, "80k only" }, - {0x14, 0x01, 0x0c, 0x04, "160k only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x10, "1" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Allow Continue" }, - {0x14, 0x01, 0xc0, 0x00, "Off" }, - {0x14, 0x01, 0xc0, 0x40, "5 Times" }, - {0x14, 0x01, 0xc0, 0x80, "8 Times" }, - {0x14, 0x01, 0xc0, 0xc0, "On" }, -}; - -STDDIPINFO(Crimec) - -static struct BurnDIPInfo CrimecjDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Hi Score" }, - {0x13, 0x01, 0x01, 0x01, "Scribble" }, - {0x13, 0x01, 0x01, 0x00, "3 Characters" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "every 80k" }, - {0x14, 0x01, 0x0c, 0x0c, "80k only" }, - {0x14, 0x01, 0x0c, 0x04, "160k only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x10, "1" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Allow Continue" }, - {0x14, 0x01, 0xc0, 0x00, "Off" }, - {0x14, 0x01, 0xc0, 0x40, "5 Times" }, - {0x14, 0x01, 0xc0, 0x80, "8 Times" }, - {0x14, 0x01, 0xc0, 0xc0, "On" }, -}; - -STDDIPINFO(Crimecj) - -static struct BurnDIPInfo CrimecuDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Hi Score" }, - {0x13, 0x01, 0x01, 0x01, "Scribble" }, - {0x13, 0x01, 0x01, 0x00, "3 Characters" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Price to Continue" }, - {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "Same as Start" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "every 80k" }, - {0x14, 0x01, 0x0c, 0x0c, "80k only" }, - {0x14, 0x01, 0x0c, 0x04, "160k only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x10, "1" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "4" }, - - {0 , 0xfe, 0 , 4, "Allow Continue" }, - {0x14, 0x01, 0xc0, 0x00, "Off" }, - {0x14, 0x01, 0xc0, 0x40, "5 Times" }, - {0x14, 0x01, 0xc0, 0x80, "8 Times" }, - {0x14, 0x01, 0xc0, 0xc0, "On" }, -}; - -STDDIPINFO(Crimecu) - -static struct BurnDIPInfo TetristDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, -}; - -STDDIPINFO(Tetrist) - -static struct BurnDIPInfo Rambo3DIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x14, 0x01, 0x10, 0x00, "Off" }, - {0x14, 0x01, 0x10, 0x10, "On" }, -}; - -STDDIPINFO(Rambo3) - -static struct BurnDIPInfo MasterwDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "500k, 1000k and 1500k"}, - {0x14, 0x01, 0x0c, 0x0c, "500k and 1000k" }, - {0x14, 0x01, 0x0c, 0x04, "500k only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - {0x14, 0x01, 0x30, 0x00, "6" }, - - {0 , 0xfe, 0 , 2, "Ship Type" }, - {0x14, 0x01, 0x80, 0x80, "Space Ship" }, - {0x14, 0x01, 0x80, 0x00, "Hover Cycle" }, -}; - -STDDIPINFO(Masterw) - -static struct BurnDIPInfo PbobbleDIPList[]= -{ - {0x29, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x29, 0x01, 0x80, 0x80, "Off" }, - {0x29, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Pbobble) - -static struct BurnDIPInfo QzshowbyDIPList[]= -{ - {0x1d, 0xff, 0xff, 0x80, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode " }, - {0x1d, 0x01, 0x80, 0x80, "Off" }, - {0x1d, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Qzshowby) - -static struct BurnDIPInfo SpacedxoDIPList[]= -{ - {0x29, 0xff, 0xff, 0xfe, NULL }, - {0x2a, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x29, 0x01, 0x01, 0x00, "Upright" }, - {0x29, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x29, 0x01, 0x02, 0x02, "Off" }, - {0x29, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x29, 0x01, 0x04, 0x04, "Off" }, - {0x29, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x29, 0x01, 0x08, 0x00, "Off" }, - {0x29, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x29, 0x01, 0x30, 0x00, "3 Coins 1 Credits" }, - {0x29, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x29, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x29, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x29, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, - {0x29, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x29, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x29, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x2a, 0x01, 0x03, 0x02, "Easy" }, - {0x2a, 0x01, 0x03, 0x03, "Medium" }, - {0x2a, 0x01, 0x03, 0x01, "Hard" }, - {0x2a, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Match Point" }, - {0x2a, 0x01, 0x0c, 0x08, "4" }, - {0x2a, 0x01, 0x0c, 0x0c, "3" }, - {0x2a, 0x01, 0x0c, 0x04, "5" }, - {0x2a, 0x01, 0x0c, 0x00, "2" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x2a, 0x01, 0x30, 0x30, "3" }, - {0x2a, 0x01, 0x30, 0x20, "4" }, - {0x2a, 0x01, 0x30, 0x10, "5" }, - {0x2a, 0x01, 0x30, 0x00, "6" }, - - {0 , 0xfe, 0 , 2, "Bonus Life" }, - {0x2a, 0x01, 0x40, 0x40, "1500 Points" }, - {0x2a, 0x01, 0x40, 0x00, "1000 Points" }, - - {0 , 0xfe, 0 , 2, "Game Type" }, - {0x2a, 0x01, 0x80, 0x80, "Double Company" }, - {0x2a, 0x01, 0x80, 0x00, "Single Company" }, -}; - -STDDIPINFO(Spacedxo) - -static struct BurnDIPInfo SelfeenaDIPList[]= -{ - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 0, "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 0, "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x0c, "100k only" }, - {0x16, 0x01, 0x0c, 0x08, "200k only" }, - {0x16, 0x01, 0x0c, 0x04, "300k only" }, - {0x16, 0x01, 0x0c, 0x00, "400k only" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x30, 0x00, "1" }, - {0x16, 0x01, 0x30, 0x10, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x20, "4" }, -}; - -STDDIPINFO(Selfeena) - -static struct BurnDIPInfo RyujinDIPList[]= -{ - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x0c, 0x00, "1" }, - {0x16, 0x01, 0x0c, 0x04, "2" }, - {0x16, 0x01, 0x0c, 0x0c, "3" }, - {0x16, 0x01, 0x0c, 0x08, "4" }, -}; - -STDDIPINFO(Ryujin) - -static struct BurnDIPInfo SbmDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xfc, NULL }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coinage" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Sbm) - -static struct BurnDIPInfo SilentdDIPList[]= -{ - {0x27, 0xff, 0xff, 0xff, NULL }, - {0x28, 0xff, 0xff, 0xbf, NULL }, - - {0 , 0xfe, 0 , 0, "Flip Screen" }, - {0x27, 0x01, 0x02, 0x02, "Off" }, - {0x27, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 0, "Service Mode" }, - {0x27, 0x01, 0x04, 0x04, "Off" }, - {0x27, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x27, 0x01, 0x08, 0x00, "Off" }, - {0x27, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x27, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x27, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x27, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x27, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 2, "Difficulty" }, - {0x28, 0x01, 0x03, 0x02, "Easy" }, - {0x28, 0x01, 0x03, 0x03, "Medium" }, - {0x28, 0x01, 0x03, 0x01, "Hard" }, - {0x28, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Invulnerability" }, - {0x28, 0x01, 0x04, 0x04, "Off" }, - {0x28, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Power-Up Bonus" }, - {0x28, 0x01, 0x08, 0x08, "Off" }, - {0x28, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Regain Power" }, - {0x28, 0x01, 0x10, 0x10, "Off" }, - {0x28, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Credits" }, - {0x28, 0x01, 0x20, 0x20, "Combined" }, - {0x28, 0x01, 0x20, 0x00, "Separate" }, - - {0 , 0xfe, 0 , 2, "Cabinet Style" }, - {0x28, 0x01, 0xc0, 0xc0, "3 Players" }, - {0x28, 0x01, 0xc0, 0x80, "2 Players" }, - {0x28, 0x01, 0xc0, 0x40, "4 Players/1 Machine" }, - {0x28, 0x01, 0xc0, 0x00, "4 Players/2 Machines" }, -}; - -STDDIPINFO(Silentd) - -static struct BurnDIPInfo SilentdjDIPList[]= -{ - {0x27, 0xff, 0xff, 0xff, NULL }, - {0x28, 0xff, 0xff, 0xbf, NULL }, - - {0 , 0xfe, 0 , 0, "Flip Screen" }, - {0x27, 0x01, 0x02, 0x02, "Off" }, - {0x27, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 0, "Service Mode" }, - {0x27, 0x01, 0x04, 0x04, "Off" }, - {0x27, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x27, 0x01, 0x08, 0x00, "Off" }, - {0x27, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Coin A" }, - {0x27, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x27, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x27, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x27, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x27, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x27, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x27, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x27, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x28, 0x01, 0x03, 0x02, "Easy" }, - {0x28, 0x01, 0x03, 0x03, "Medium" }, - {0x28, 0x01, 0x03, 0x01, "Hard" }, - {0x28, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Invulnerability" }, - {0x28, 0x01, 0x04, 0x04, "Off" }, - {0x28, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Power-Up Bonus" }, - {0x28, 0x01, 0x08, 0x08, "Off" }, - {0x28, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Regain Power" }, - {0x28, 0x01, 0x10, 0x10, "Off" }, - {0x28, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Credits" }, - {0x28, 0x01, 0x20, 0x20, "Combined" }, - {0x28, 0x01, 0x20, 0x00, "Separate" }, - - {0 , 0xfe, 0 , 2, "Cabinet Style" }, - {0x28, 0x01, 0xc0, 0xc0, "3 Players" }, - {0x28, 0x01, 0xc0, 0x80, "2 Players" }, - {0x28, 0x01, 0xc0, 0x40, "4 Players/1 Machine" }, - {0x28, 0x01, 0xc0, 0x00, "4 Players/2 Machines" }, -}; - -STDDIPINFO(Silentdj) - -static struct BurnDIPInfo ViofightDIPList[]= -{ - {0x14, 0xff, 0xff, 0xff, NULL }, - {0x15, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 0, "Flip Screen" }, - {0x14, 0x01, 0x02, 0x02, "Off" }, - {0x14, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x14, 0x01, 0x04, 0x04, "Off" }, - {0x14, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x14, 0x01, 0x08, 0x00, "Off" }, - {0x14, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Coin A" }, - {0x14, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, - {0x14, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x14, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x14, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x14, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x14, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x14, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x15, 0x01, 0x03, 0x02, "Easy" }, - {0x15, 0x01, 0x03, 0x03, "Medium" }, - {0x15, 0x01, 0x03, 0x01, "Hard" }, - {0x15, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Viofight) - -static struct BurnDIPInfo HiticeDIPList[]= -{ - {0x25, 0xff, 0xff, 0xff, NULL }, - {0x26, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet Style" }, - {0x25, 0x01, 0x01, 0x01, "4 Players" }, - {0x25, 0x01, 0x01, 0x00, "2 Players" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x25, 0x01, 0x04, 0x04, "Off" }, - {0x25, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x25, 0x01, 0x08, 0x00, "Off" }, - {0x25, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x25, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x25, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - {0x25, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x25, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x25, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x25, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, - {0x25, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x25, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x26, 0x01, 0x03, 0x02, "Easy" }, - {0x26, 0x01, 0x03, 0x03, "Medium" }, - {0x26, 0x01, 0x03, 0x01, "Hard" }, - {0x26, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Timer count" }, - {0x26, 0x01, 0x0c, 0x0c, "1 sec = 58/60" }, - {0x26, 0x01, 0x0c, 0x04, "1 sec = 56/60" }, - {0x26, 0x01, 0x0c, 0x08, "1 sec = 62/60" }, - {0x26, 0x01, 0x0c, 0x00, "1 sec = 45/60" }, - - {0 , 0xfe, 0 , 2, "Maximum credits" }, - {0x26, 0x01, 0x80, 0x00, "99" }, - {0x26, 0x01, 0x80, 0x80, "9" }, -}; - -STDDIPINFO(Hitice) - -static struct BurnDIPInfo Rambo3uDIPList[]= -{ - {0x17, 0xff, 0xff, 0xff, NULL }, - {0x18, 0xff, 0xff, 0xff, NULL }, - - {0 , 0xfe, 0 , 0, "Flip Screen" }, - {0x17, 0x01, 0x02, 0x02, "Off" }, - {0x17, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x17, 0x01, 0x04, 0x04, "Off" }, - {0x17, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x17, 0x01, 0x08, 0x00, "Off" }, - {0x17, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 2, "Coinage" }, - {0x17, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, - {0x17, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x17, 0x01, 0x30, 0x00, "4 Coins 3 Credits" }, - {0x17, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Price to Continue" }, - {0x17, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, - {0x17, 0x01, 0xc0, 0x80, "1 Coin 1 Credits" }, - {0x17, 0x01, 0xc0, 0xc0, "Same as Start" }, - {0x17, 0x01, 0xc0, 0x00, "Same as Start or 1C/1C (if Coinage 4C/3C)" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x18, 0x01, 0x03, 0x02, "Easy" }, - {0x18, 0x01, 0x03, 0x03, "Medium" }, - {0x18, 0x01, 0x03, 0x01, "Hard" }, - {0x18, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 1, "Control" }, - {0x18, 0x01, 0x08, 0x08, "8 way Joystick" }, -// {0x18, 0x01, 0x08, 0x00, "Trackball" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x18, 0x01, 0x10, 0x00, "Off" }, - {0x18, 0x01, 0x10, 0x10, "On" }, -}; - -STDDIPINFO(Rambo3u) - -static const eeprom_interface taitob_eeprom_intf = -{ - 6, // address bits - 16, // data bits - "0110", // read command - "0101", // write command - "0111", // erase command - "0100000000", // lock command - "0100110000", // unlock command - 0, - 0 -}; - -static void bankswitch(UINT32, UINT32 data) -{ - TaitoZ80Bank = data & 0x03; - - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + TaitoZ80Bank * 0x4000); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + TaitoZ80Bank * 0x4000); -} - -void __fastcall taitob_sound_write_ym2610(UINT16 a, UINT8 d) -{ - switch (a) - { - case 0xe000: - case 0xe001: - case 0xe002: - case 0xe003: - BurnYM2610Write(a & 3, d); - return; - - case 0xe200: - TC0140SYTSlavePortWrite(d); - return; - - case 0xe201: - TC0140SYTSlaveCommWrite(d); - return; - - case 0xf200: - bankswitch(0, d); - return; - } -} - -UINT8 __fastcall taitob_sound_read_ym2610(UINT16 a) -{ - switch (a) - { - case 0xe000: - case 0xe001: - case 0xe002: - case 0xe003: - return BurnYM2610Read(a & 3); - - case 0xe201: - return TC0140SYTSlaveCommRead(); - } - - return 0; -} - -void __fastcall taitob_sound_write_ym2203(UINT16 a, UINT8 d) -{ - switch (a) - { - case 0x9000: - case 0x9001: - BurnYM2203Write(0, a & 1, d); - return; - - case 0xb000: - case 0xb001: - MSM6295Command(0, d); - return; - - case 0xa000: - TC0140SYTSlavePortWrite(d); - return; - - case 0xa001: - TC0140SYTSlaveCommWrite(d); - return; - } -} - -UINT8 __fastcall taitob_sound_read_ym2203(UINT16 a) -{ - switch (a) - { - case 0x9000: - case 0x9001: - return BurnYM2203Read(0, a & 1); - - case 0xb000: - case 0xb001: - return MSM6295ReadStatus(0); - - case 0xa001: - return TC0140SYTSlaveCommRead(); - } - - return 0; -} - -static void DrvMakeInputs() -{ - memset (TC0220IOCInput, 0xff, 3); - memset (TaitoInput + 3, 0xff, 3); - - for (INT32 i = 0; i < 8; i++) { - TC0220IOCInput[0] ^= (TC0220IOCInputPort0[i] & 1) << i; - TC0220IOCInput[1] ^= (TC0220IOCInputPort1[i] & 1) << i; - TC0220IOCInput[2] ^= (TC0220IOCInputPort2[i] & 1) << i; - TaitoInput[3] ^= (TaitoInputPort3[i] & 1) << i; - TaitoInput[4] ^= (TaitoInputPort4[i] & 1) << i; - TaitoInput[5] ^= (TaitoInputPort5[i] & 1) << i; - } - - // normal coin state is active low, but some games have - // active high buttons or coin inputs - TC0220IOCInput[0] ^= nTaitoInputConfig[0]; - TC0220IOCInput[1] ^= nTaitoInputConfig[1]; - TC0220IOCInput[2] ^= nTaitoInputConfig[2]; - TaitoInput[3] ^= nTaitoInputConfig[3]; - - // set up coin lockout - switch (nTaitoInputConfig[4]) { - case 0: // viofight, sbm, common - if (TaitoCoinLockout[0]) TC0220IOCInput[2] |= (1 << 2); - if (TaitoCoinLockout[1]) TC0220IOCInput[2] |= (1 << 3); - break; - - case 1: // rambo3a, hitice, selfeena - if (TaitoCoinLockout[0]) TC0220IOCInput[1] |= (1 << 4); - if (TaitoCoinLockout[1]) TC0220IOCInput[1] |= (1 << 5); - break; - - case 2: // silentd, spacedxo - if (TaitoCoinLockout[0]) TC0220IOCInput[1] |= (1 << 4); - if (TaitoCoinLockout[1]) TC0220IOCInput[1] |= (1 << 5); - if (TaitoCoinLockout[2]) TaitoInput[5] |= (1 << 0); - if (TaitoCoinLockout[3]) TaitoInput[5] |= (1 << 2); - break; - - case 3: // qzshowby, pbobble - if (TaitoCoinLockout[0]) TC0220IOCInput[0] |= (1 << 4); - if (TaitoCoinLockout[1]) TC0220IOCInput[0] |= (1 << 5); - if (TaitoCoinLockout[2]) TC0220IOCInput[0] |= (1 << 6); - if (TaitoCoinLockout[3]) TC0220IOCInput[0] |= (1 << 7); - break; - } - - // for rambo3a's trackball - if (nBurnGunNumPlayers) BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); - if (nBurnGunNumPlayers) BurnGunMakeInputs(1, (INT16)TaitoAnalogPort2, (INT16)TaitoAnalogPort3); -} - -static void DrvFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / cpu_speed[1]; -} - -static double DrvGetTime() -{ - return (double)ZetTotalCycles() / (cpu_speed[1] * 1.0); -} - -static INT32 DrvDoReset(INT32 reset_ram) -{ - if (reset_ram) { - memset (TaitoRamStart, 0, TaitoRamEnd - TaitoRamStart); - } - - if (DrvFramebuffer) { - memset (DrvFramebuffer, 0, 1024 * 512); - } - - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - if (sound_config == 0) { - BurnYM2610Reset(); - } else { - ZetOpen(0); - BurnYM2203Reset(); - ZetClose(); - MSM6295Reset(0); - } - - TaitoICReset(); - - EEPROMReset(); - - coin_control = 0; - eeprom_latch = 0; - TaitoZ80Bank = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += ((Taito68KRom1Size - 1) | 0x7ffff) + 1; - TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; - - TaitoChars = Next; Next += (TaitoCharRomSize * 8) / 4; - TaitoSpritesA = Next; Next += (TaitoCharRomSize * 8) / 4; - - TaitoMSM6295Rom = Next; Next += TaitoMSM6295RomSize; - TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; - TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - - if (!(TaitoMSM6295RomSize | TaitoYM2610ARomSize | TaitoYM2610ARomSize)) { - Next += 0x040000; // games without samples... - } - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x010000; - TaitoPaletteRam = Next; Next += 0x002000; - TaitoSpriteRam = Next; Next += 0x002000; - - // hit the ice - DrvPxlRAM = Next; Next += 0x080000; - DrvPxlScroll = (UINT16*)Next; Next += 2 * sizeof(UINT16); - - TaitoZ80Ram1 = Next; Next += 0x002000; - - TaitoRamEnd = Next; - - TaitoPalette = (UINT32*)Next; Next += 0x1000 * sizeof(UINT32); - - TaitoMemEnd = Next; - - return 0; -} - -static void DrvGfxDecode(INT32 len, INT32 *tilemask0, INT32 *tilemask1) -{ - if (len == 0) return; // tetrist - - INT32 Planes[4] = { 0, 8, (len * 8) / 2 + 0, (len * 8) / 2 + 8 }; - INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087 }; - INT32 YOffs[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, 0x100, 0x110, 0x120, 0x130, 0x140, 0x150, 0x160, 0x170 }; - - UINT8 *tmp = (UINT8*)BurnMalloc(len); - if (tmp == NULL) { - return; - } - - memcpy (tmp, TaitoChars, len); - - GfxDecode(((len * 8) / 4) / ( 8 * 8), 4, 8, 8, Planes, XOffs, YOffs, 0x080, tmp, TaitoChars); - GfxDecode(((len * 8) / 4) / (16 * 16), 4, 16, 16, Planes, XOffs, YOffs, 0x200, tmp, TaitoSpritesA); - - *tilemask0 = (((len * 8) / 4) / ( 8 * 8)) - 1; - *tilemask1 = (((len * 8) / 4) / (16 * 16)) - 1; - - BurnFree (tmp); -} - -static void common_ym2610_init() -{ - sound_config = 0; - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1); - ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1); - ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1); - ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1); - ZetSetWriteHandler(taitob_sound_write_ym2610); - ZetSetReadHandler(taitob_sound_read_ym2610); - ZetMemEnd(); - ZetClose(); - - TC0140SYTInit(); - - INT32 len0 = TaitoYM2610ARomSize; - INT32 len1 = TaitoYM2610BRomSize; - - BurnYM2610Init(8000000, TaitoYM2610ARom, &len0, TaitoYM2610BRom, &len1, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnTimerAttachZet(cpu_speed[1]); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); -} - -static void common_ym2203_init() -{ - sound_config = 1; - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1); - ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1); - ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1); - ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1); - ZetSetWriteHandler(taitob_sound_write_ym2203); - ZetSetReadHandler(taitob_sound_read_ym2203); - ZetMemEnd(); - ZetClose(); - - TC0140SYTInit(); - - BurnYM2203Init(1, 3000000, DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnYM2203SetPorts(0, NULL, NULL, &bankswitch, NULL); - BurnTimerAttachZet(cpu_speed[1]); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.80, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.25, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.25, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.25, BURN_SND_ROUTE_BOTH); - - MSM6295ROM = TaitoMSM6295Rom; - - MSM6295Init(0, 1056000 / 132, 1); - MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); -} - -static INT32 CommonInit(void (*pInitCallback)(), INT32 sound_type, INT32 color_select, INT32 input_type, INT32 irq0, INT32 irq1) -{ - static const UINT8 color_types[3][4] = { - { 0xc0, 0x80, 0x00, 0x40 }, - { 0x00, 0x40, 0xc0, 0x80 }, - { 0x30, 0x20, 0x00, 0x10 } - }; - - TaitoLoadRoms(false); - - TaitoMem = NULL; - MemIndex(); - INT32 nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(true)) return 1; - - INT32 tilemaskChars = 0, tilemaskSprites = 0; - DrvGfxDecode(TaitoCharRomSize, &tilemaskChars, &tilemaskSprites); - - memcpy (color_config, color_types[color_select], 4); - - irq_config[0] = irq0; - irq_config[1] = irq1; - - cpu_speed[0] = 12000000; - cpu_speed[1] = 4000000; - - nTaitoInputConfig[4] = input_type; - - TC0220IOCInit(); - TaitoMakeInputsFunction = DrvMakeInputs; - - TC0180VCUInit(TaitoChars, tilemaskChars, TaitoSpritesA, tilemaskSprites, 0, 16); - - EEPROMInit(&taitob_eeprom_intf); - - if (pInitCallback) { - pInitCallback(); - } - - if (sound_type) { - common_ym2203_init(); - } else { - common_ym2610_init(); - } - - GenericTilesInit(); - - DrvDoReset(1); - - return 0; -} - -static INT32 DrvExit() -{ - EEPROMExit(); - - SekExit(); - ZetExit(); - - if (sound_config == 0) { - BurnYM2610Exit(); - } else { - BurnYM2203Exit(); - MSM6295Exit(0); - MSM6295ROM = NULL; - } - - BurnFree (DrvFramebuffer); - - memset (nTaitoInputConfig, 0, 5); - - TaitoExit(); - - return 0; -} - -static void DrvPaletteUpdate() -{ - UINT16 *p = (UINT16*)TaitoPaletteRam; - - for (INT32 i = 0; i < 0x2000 / 2; i++) - { - INT32 r = (p[i] >> 12) & 0x0f; - INT32 g = (p[i] >> 8) & 0x0f; - INT32 b = (p[i] >> 4) & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - TaitoPalette[i] = BurnHighCol(r, g, b, 0); - } -} - -static void draw_hitice_framebuffer() -{ - if (DrvFramebuffer == NULL) return; - - INT32 scrollx = -((2 * DrvPxlScroll[0] + 0) & 0x3ff); - INT32 scrolly = -((1 * DrvPxlScroll[1] + 16) & 0x1ff); - - for (INT32 sy = 0; sy < nScreenHeight; sy++) - { - UINT16 *dst = pTransDraw + sy * nScreenWidth; - UINT8 *src = DrvFramebuffer + ((sy + scrolly) & 0x1ff) * 1024; - - for (INT32 sx = 0; sx < nScreenWidth; sx++) { - INT32 pxl = src[(sx + scrollx) & 0x3ff]; - - if (pxl) { - dst[sx] = pxl | 0x800; - } - } - } -} - -static INT32 DrvDraw() -{ - DrvPaletteUpdate(); - - INT32 ctrl = TC0180VCUReadControl(); - - if (~ctrl & 0x20) { - BurnTransferClear(); - BurnTransferCopy(TaitoPalette); - return 0; - } - - if (~nBurnLayer & 1) BurnTransferClear(); - - if (nBurnLayer & 1) TC0180VCUDrawLayer(color_config[0], 1, -1); - - if (nSpriteEnable & 1) TC0180VCUFramebufferDraw(1, color_config[3] << 4); - - if (nBurnLayer & 2) TC0180VCUDrawLayer(color_config[1], 0, 0); - - draw_hitice_framebuffer(); - - if (nSpriteEnable & 2) TC0180VCUFramebufferDraw(0, color_config[3] << 4); - - if (nBurnLayer & 4) TC0180VCUDrawCharLayer(color_config[2]); - - BurnTransferCopy(TaitoPalette); - - TC0180VCUBufferSprites(); - - return 0; -} - -static INT32 DrvFrame() -{ - if (TaitoReset) { - DrvDoReset(1); - } - - SekNewFrame(); - ZetNewFrame(); - - TaitoWatchdog++; - if (TaitoWatchdog > 180) { - DrvDoReset(0); -// bprintf (0, _T("watchdog triggered!\n")); - } - - TaitoMakeInputsFunction(); - - SekOpen(0); - ZetOpen(0); - - INT32 SekSpeed = (INT32)((INT64)cpu_speed[0] * nBurnCPUSpeedAdjust / 0x100); - INT32 ZetSpeed = (INT32)((INT64)cpu_speed[1] * nBurnCPUSpeedAdjust / 0x100); - - INT32 nInterleave = 200; // high so that ym2203 sounds are good, 200 is perfect for irq #0 - INT32 nCyclesTotal[2] = { SekSpeed / 60, ZetSpeed / 60 }; - INT32 nCyclesDone[2] = { 0, 0 }; - INT32 nNext[2] = { 0, 0 }; - - for (INT32 i = 0; i < nInterleave; i++) { - nNext[0] += nCyclesTotal[0] / nInterleave; - nCyclesDone[0] += SekRun(nNext[0] - nCyclesDone[0]); - if (i == 4) SekSetIRQLine(irq_config[0], SEK_IRQSTATUS_AUTO); // Start of frame + 5000 cycles - if (i == (nInterleave / 1) - 1) SekSetIRQLine(irq_config[1], SEK_IRQSTATUS_AUTO); // End of frame - nNext[1] += nCyclesTotal[1] / nInterleave; - BurnTimerUpdate(nNext[1]); - nCyclesDone[1] += nNext[1]; - } - - BurnTimerEndFrame(nCyclesTotal[1]); - - if (pBurnSoundOut) { - if (sound_config == 0) { - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - } else { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - } - - ZetClose(); - SekClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029708; - } - - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - - ba.Data = TaitoRamStart; - ba.nLen = TaitoRamEnd - TaitoRamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - TaitoICScan(nAction); - - if (sound_config == 0) { - BurnYM2610Scan(nAction, pnMin); - } else { - BurnYM2203Scan(nAction, pnMin); - MSM6295Scan(0, nAction); - } - - SCAN_VAR(TaitoZ80Bank); - SCAN_VAR(TaitoWatchdog); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - bankswitch(0, TaitoZ80Bank); - ZetClose(); - } - - return 0; -} - - -//---------------------------------------------------------------------------------------------------------- -// Rastan Saga 2 / Ashura Blaster - -UINT8 __fastcall rastsag2_read_byte(UINT32 a) -{ - TC0180VCUHalfWordRead_Map(0x400000) - TC0220IOCHalfWordRead_Map(0xa00000) - - switch (a) - { - case 0x800002: - return TC0140SYTCommRead(); - } - - return 0; -} - -void __fastcall rastsag2_write_byte(UINT32 a, UINT8 d) -{ - TC0180VCUHalfWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0xa00000) - - switch (a) - { - case 0x800000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0x800002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - } -} - -void __fastcall rastsag2_write_word(UINT32 a, UINT16 d) -{ - TC0180VCUWordWrite_Map(0x400000) -} - -static void NastarInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(TaitoPaletteRam, 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); - SekMapMemory(Taito68KRam1, 0x600000, 0x607fff, SM_RAM); - SekSetWriteByteHandler(0, rastsag2_write_byte); - SekSetWriteWordHandler(0, rastsag2_write_word); - SekSetReadByteHandler(0, rastsag2_read_byte); -// SekSetReadWordHandler(0, rastsag2_read_word); - SekClose(); -} - -//---------------------------------------------------------------------------------------------------------- -// Crime City - -UINT8 __fastcall crimec_read_byte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x200000) - TC0180VCUHalfWordRead_Map(0x400000) - - switch (a) - { - case 0x600002: - return TC0140SYTCommRead(); - } - - return 0; -} - -void __fastcall crimec_write_byte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x200000) - TC0180VCUHalfWordWrite_Map(0x400000) - - switch (a) - { - case 0x600000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0x600002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - } -} - -void __fastcall crimec_write_word(UINT32 a, UINT16 d) -{ - TC0180VCUWordWrite_Map(0x400000) -} - -static void CrimecInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); - SekMapMemory(TaitoPaletteRam, 0x800000, 0x801fff, SM_RAM); - SekMapMemory(Taito68KRam1, 0xa00000, 0xa0ffff, SM_RAM); - SekSetWriteByteHandler(0, crimec_write_byte); - SekSetWriteWordHandler(0, crimec_write_word); - SekSetReadByteHandler(0, crimec_read_byte); -// SekSetReadWordHandler(0, crimec_read_word); - SekClose(); -} - -//---------------------------------------------------------------------------------------------------------- -// Tetris (ym2610) - -UINT8 __fastcall tetrist_read_byte(UINT32 a) -{ - TC0180VCUHalfWordRead_Map(0x400000) - TC0220IOCHalfWordRead_Map(0x600000) - - switch (a) - { - case 0x200002: // not used? - return TC0140SYTCommRead(); - - case 0x600010: { // tracky1_lo_r - INT32 ret = (( TaitoAnalogPort1 >> 4) & 0xffff); - if (ret == 0xffff) return 0; - return (ret+1); - } - - case 0x600014: {// trackx1_lo_r - INT32 ret = ((~TaitoAnalogPort0 >> 4) & 0xffff); - if (ret == 0xffff) return 0; - return (ret+1); - } - - case 0x600018: {// tracky2_lo_r - INT32 ret = (( TaitoAnalogPort3 >> 4) & 0xffff); - if (ret == 0xffff) return 0; - return (ret+1); - } - - case 0x60001c: {// trackx2_lo_r - INT32 ret = ((~TaitoAnalogPort2 >> 4) & 0xffff); - if (ret == 0xffff) return 0; - return (ret+1); - } - } - - return 0; -} - -UINT16 __fastcall tetrist_read_word(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x600000) - - switch (a) - { - case 0x600012: {// tracky1_hi_r - INT32 ret = (( TaitoAnalogPort1 >> 4) & 0xffff); - if (ret == 0xffff) return 0; - return (ret+1); - } - - case 0x600016: {// trackx1_hi_r - INT32 ret = ((~TaitoAnalogPort0 >> 4) & 0xffff); - if (ret == 0xffff) return 0; - return (ret+1); - } - - case 0x60001a: {// tracky2_hi_r - INT32 ret = (( TaitoAnalogPort3 >> 4) & 0xffff); - if (ret == 0xffff) return 0; - return (ret+1); - } - - case 0x60001e: {// trackx2_hi_r - INT32 ret = ((~TaitoAnalogPort2 >> 4) & 0xffff); - if (ret == 0xffff) return 0; - return (ret+1); - } - } - - return 0; -} - -void __fastcall tetrist_write_byte(UINT32 a, UINT8 d) -{ - TC0180VCUHalfWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0x600000) - - switch (a) - { - case 0x200000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0x200002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - } -} - -void __fastcall tetrist_write_word(UINT32 a, UINT16 d) -{ - TC0180VCUWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0x600000) -} - -static void TetristInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); - SekMapMemory(Taito68KRam1, 0x800000, 0x807fff, SM_RAM); - SekMapMemory(TaitoPaletteRam, 0xa00000, 0xa01fff, SM_RAM); - SekSetWriteByteHandler(0, tetrist_write_byte); - SekSetWriteWordHandler(0, tetrist_write_word); - SekSetReadByteHandler(0, tetrist_read_byte); - SekSetReadWordHandler(0, tetrist_read_word); - SekClose(); -} - -//---------------------------------------------------------------------------------------------------------- -// Puzzle Bobble / Space Invaders Dx (v2.1) - -UINT8 __fastcall pbobble_read_byte(UINT32 a) -{ - TC0180VCUHalfWordRead_Map(0x400000) - - switch (a) - { - case 0x500000: - return TC0220IOCDip[0]; - - case 0x500002: - return ((TC0220IOCInput[0] & 0xfe) | (EEPROMRead() & 1)); - - case 0x500004: - return TC0220IOCInput[1]; - - case 0x500006: - return TC0220IOCInput[2]; - - case 0x500008: - return TC0220IOCRead(0x08 / 2); - - case 0x50000e: - return TaitoInput[3]; - - case 0x500024: - return TaitoInput[4]; - - case 0x500026: - return eeprom_latch; - - case 0x50002e: - return TaitoInput[5]; - - case 0x700002: - return TC0140SYTCommRead(); - } - - return 0; -} - -void __fastcall pbobble_write_byte(UINT32 a, UINT8 d) -{ - TC0180VCUHalfWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0x500000) - - switch (a) - { - case 0x500026: - eeprom_latch = d; - EEPROMWrite((d & 0x08), (d & 0x10), (d & 0x04)); - return; - - case 0x500028: - coin_control = d; - TaitoCoinLockout[2] = ~d & 0x01; - TaitoCoinLockout[3] = ~d & 0x02; - // coin counter d & 0x04, d & 0x08 - return; - - case 0x600000: - case 0x600002: // gain - return; - - case 0x700000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0x700002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - } -} - -void __fastcall pbobble_write_word(UINT32 a, UINT16 d) -{ - TC0180VCUWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0x500000) -} - -static void PbobbleInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); - SekMapMemory(TaitoPaletteRam, 0x800000, 0x801fff, SM_RAM); - SekMapMemory(Taito68KRam1, 0x900000, 0x90ffff, SM_RAM); - SekSetWriteByteHandler(0, pbobble_write_byte); - SekSetWriteWordHandler(0, pbobble_write_word); - SekSetReadByteHandler(0, pbobble_read_byte); -// SekSetReadWordHandler(0, pbobble_read_word); - SekClose(); -} - -//---------------------------------------------------------------------------------------------------------- -// Sel Feena / Ryu Jin - -UINT8 __fastcall selfeena_read_byte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x400000) - TC0220IOCHalfWordRead_Map(0x410000) - - if (a >= 0x218000 && a <= 0x21801f) { - return TC0180VCUReadRegs(a); - } - - switch (a) - { - case 0x500002: // not used? - return TC0140SYTCommRead(); - } - - return 0; -} - -void __fastcall selfeena_write_byte(UINT32 a, UINT8 d) -{ - TC0180VCUHalfWordWrite_Map(0x200000) - TC0220IOCHalfWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0x410000) - - switch (a) - { - case 0x500000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0x500002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - } -} - -void __fastcall selfeena_write_word(UINT32 a, UINT16 d) -{ - TC0180VCUWordWrite_Map(0x200000) -} - -static void SelfeenaInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1, 0x100000, 0x103fff, SM_RAM); - SekMapMemory(TC0180VCURAM, 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x210000, 0x2137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x213800, 0x213fff, SM_RAM); - SekMapMemory(TaitoPaletteRam, 0x300000, 0x301fff, SM_RAM); - SekSetWriteByteHandler(0, selfeena_write_byte); - SekSetWriteWordHandler(0, selfeena_write_word); - SekSetReadByteHandler(0, selfeena_read_byte); -// SekSetReadWordHandler(0, selfeena_read_word); - SekClose(); -} - -//---------------------------------------------------------------------------------------------------------- -// Sonic Blast Man - -UINT8 __fastcall sbm_read_byte(UINT32 a) -{ - if ((a & 0xffffff0) == 0x300000) a ^= 2; - TC0220IOCHalfWordRead_Map(0x300000) - TC0180VCUHalfWordRead_Map(0x900000) - - switch (a) - { - case 0x320002: - return TC0140SYTCommRead(); - } - - return 0; -} - -void __fastcall sbm_write_byte(UINT32 a, UINT8 d) -{ - if ((a & 0xffffff0) == 0x300000) a ^= 2; - TC0220IOCHalfWordWrite_Map(0x300000) - TC0180VCUHalfWordWrite_Map(0x900000) - - switch (a) - { - case 0x320000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0x320002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - } -} - -void __fastcall sbm_write_word(UINT32 a, UINT16 d) -{ - if ((a & 0xffffff0) == 0x0300000) a ^= 2; - TC0220IOCHalfWordWrite_Map(0x300000) - TC0180VCUWordWrite_Map(0x900000) -} - -static void SbmInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1, 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam, 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0180VCURAM, 0x900000, 0x90ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x910000, 0x9137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x913800, 0x913fff, SM_RAM); - SekSetWriteByteHandler(0, sbm_write_byte); - SekSetWriteWordHandler(0, sbm_write_word); - SekSetReadByteHandler(0, sbm_read_byte); -// SekSetReadWordHandler(0, sbm_read_word); - SekClose(); -} - -//---------------------------------------------------------------------------------------------------------- -// Silent Dragon - -UINT8 __fastcall silentd_read_byte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x200000) - TC0180VCUHalfWordRead_Map(0x500000) - - switch (a) - { - case 0x100003: // not used? - return TC0140SYTCommRead(); - - case 0x210001: - return TaitoInput[3]; - - case 0x220001: - return TaitoInput[4]; - - case 0x230001: - return TaitoInput[5]; - } - - return 0; -} - -void __fastcall silentd_write_byte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x200000) - TC0180VCUHalfWordWrite_Map(0x500000) - - switch (a) - { - case 0x100000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0x100002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - } -} - -void __fastcall silentd_write_word(UINT32 a, UINT16 d) -{ - TC0180VCUWordWrite_Map(0x500000) -} - -static void SilentdInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(TaitoPaletteRam, 0x300000, 0x301fff, SM_RAM); - SekMapMemory(Taito68KRam1, 0x400000, 0x403fff, SM_RAM); - SekMapMemory(TC0180VCURAM, 0x500000, 0x50ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x510000, 0x5137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x513800, 0x513fff, SM_RAM); - SekSetWriteByteHandler(0, silentd_write_byte); - SekSetWriteWordHandler(0, silentd_write_word); - SekSetReadByteHandler(0, silentd_read_byte); -// SekSetReadWordHandler(0, silentd_read_word); - SekClose(); -} - -//---------------------------------------------------------------------------------------------------------- -// Violence Fight - -UINT8 __fastcall viofight_read_byte(UINT32 a) -{ - TC0180VCUHalfWordRead_Map(0x400000) - TC0220IOCHalfWordRead_Map(0x800000) - - switch (a) - { - case 0x200002: - return TC0140SYTCommRead(); - } - - return 0; -} - -void __fastcall viofight_write_byte(UINT32 a, UINT8 d) -{ - TC0180VCUHalfWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0x800000) - - switch (a) - { - case 0x200000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0x200002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - } -} - -void __fastcall viofight_write_word(UINT32 a, UINT16 d) -{ - TC0180VCUWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0x800000) -} - -static void ViofightInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); - SekMapMemory(TaitoPaletteRam, 0x600000, 0x601fff, SM_RAM); - SekMapMemory(Taito68KRam1, 0xa00000, 0xa03fff, SM_RAM); - SekSetWriteByteHandler(0, viofight_write_byte); - SekSetWriteWordHandler(0, viofight_write_word); - SekSetReadByteHandler(0, viofight_read_byte); -// SekSetReadWordHandler(0, viofight_read_word); - SekClose(); - - memcpy (Taito68KRom1 + 0x40000, Taito68KRom1 + 0x20000, 0x40000); - - cpu_speed[1] = 6000000; // 6mhz -} - -//---------------------------------------------------------------------------------------------------------- -// Hit the Ice - -UINT8 __fastcall hitice_read_byte(UINT32 a) -{ - TC0180VCUHalfWordRead_Map(0x400000) - TC0220IOCHalfWordRead_Map(0x600000) - - switch (a) - { - case 0x610000: - return TC0220IOCInput[4]; - - case 0x610001: - return TC0220IOCInput[3]; - - case 0x700002: - return TC0140SYTCommRead(); - } - - return 0; -} - -static void hiticeFramebufferUpdate(UINT32 offset) -{ - offset &= 0x7fffe; - DrvFramebuffer[offset + 0] = DrvPxlRAM[offset]; - DrvFramebuffer[offset + 1] = DrvPxlRAM[offset]; -} - -void __fastcall hitice_write_byte(UINT32 a, UINT8 d) -{ - TC0180VCUHalfWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0x600000) - - if (a >= 0xb00000 && a <= 0xb7ffff) { - DrvPxlRAM[(a & 0x7ffff)^1] = d; - hiticeFramebufferUpdate(a); - return; - } - - switch (a) - { - case 0x700000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0x700002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - } -} - -void __fastcall hitice_write_word(UINT32 a, UINT16 d) -{ - TC0180VCUWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0x600000) - - if (a >= 0xb00000 && a <= 0xb7ffff) { - *((UINT16*)(DrvPxlRAM + (a & 0x7fffe))) = d; - hiticeFramebufferUpdate(a); - return; - } - - switch (a) - { - case 0xbffff2: - DrvPxlScroll[0] = d; - return; - - case 0xbffff4: - DrvPxlScroll[1] = d; - return; - } -} - -static void HiticeInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); - SekMapMemory(Taito68KRam1, 0x800000, 0x803fff, SM_RAM); - SekMapMemory(TaitoPaletteRam, 0xa00000, 0xa01fff, SM_RAM); - SekMapMemory(DrvPxlRAM, 0xb00000, 0xb7ffff, SM_ROM); - SekSetWriteByteHandler(0, hitice_write_byte); - SekSetWriteWordHandler(0, hitice_write_word); - SekSetReadByteHandler(0, hitice_read_byte); -// SekSetReadWordHandler(0, hitice_read_word); - SekClose(); - - DrvFramebuffer = (UINT8*)BurnMalloc(1024 * 512); -} - -//---------------------------------------------------------------------------------------------------------- -// Tetris (ym2203) - -UINT8 __fastcall tetrista_read_byte(UINT32 a) -{ - TC0180VCUHalfWordRead_Map(0x400000) - - switch (a) - { - case 0x600000: - case 0x800000: - return TC0220IOCPortRegRead(); - - case 0x600002: - case 0x800002: - return TC0220IOCPortRead(); - - case 0xa00002: - return TC0140SYTCommRead(); - } - - return 0; -} - -void __fastcall tetrista_write_byte(UINT32 a, UINT8 d) -{ - TC0180VCUHalfWordWrite_Map(0x400000) - - switch (a) - { - case 0x600000: - case 0x800000: - TaitoWatchdog = 0; - TC0220IOCHalfWordPortRegWrite(d); - return; - - case 0x600002: - case 0x800002: - TC0220IOCHalfWordPortWrite(d); - return; - - case 0xa00000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0xa00002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - } -} - -void __fastcall tetrista_write_word(UINT32 a, UINT16 d) -{ - TC0180VCUWordWrite_Map(0x400000) -} - -static void TetristaInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(TaitoPaletteRam, 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); - SekMapMemory(Taito68KRam1, 0x800000, 0x803fff, SM_RAM); - SekSetWriteByteHandler(0, tetrista_write_byte); - SekSetWriteWordHandler(0, tetrista_write_word); - SekSetReadByteHandler(0, tetrista_read_byte); -// SekSetReadWordHandler(0, tetrista_read_word); - SekClose(); -} - -static void MasterwInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1, 0x200000, 0x203fff, SM_RAM); - SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); - SekMapMemory(TaitoPaletteRam, 0x600000, 0x601fff, SM_RAM); - SekSetWriteByteHandler(0, tetrista_write_byte); - SekSetWriteWordHandler(0, tetrista_write_word); - SekSetReadByteHandler(0, tetrista_read_byte); -// SekSetReadWordHandler(0, tetrista_read_word); - SekClose(); -} - -//---------------------------------------------------------------------------------------------------------- -// Quiz Sekai Wa Show by shobai - - -UINT8 __fastcall qzshowby_read_byte(UINT32 a) -{ - if (a != 0x200002) { - TC0220IOCHalfWordRead_Map(0x200000) - } - - TC0180VCUHalfWordRead_Map(0x400000) - - switch (a) - { - case 0x200002: - return ((TC0220IOCInput[0] & 0xfe) | (EEPROMRead() & 1)); - - case 0x200024: - return TC0220IOCInput[4]; - - case 0x200028: - return coin_control; - - case 0x20002e: - return TC0220IOCInput[5]; - - case 0x600002: - return TC0140SYTCommRead(); - } - - return 0; -} - -void __fastcall qzshowby_write_byte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x200000) - TC0180VCUHalfWordWrite_Map(0x400000) - - switch (a) - { - case 0x200026: - EEPROMWrite((d & 0x08), (d & 0x10), (d & 0x04)); - return; - - case 0x200028: - coin_control = d; - TaitoCoinLockout[2] = ~d & 0x01; - TaitoCoinLockout[3] = ~d & 0x02; - // coin counter d & 0x04, d & 0x08 - return; - - case 0x600000: - TC0140SYTPortWrite(d & 0xff); - return; - - case 0x600002: - ZetClose(); - TC0140SYTCommWrite(d & 0xff); - ZetOpen(0); - return; - - case 0x700000: - case 0x700002: - // gain - return; - } -} - -void __fastcall qzshowby_write_word(UINT32 a, UINT16 d) -{ - TC0180VCUWordWrite_Map(0x400000) - TC0220IOCHalfWordWrite_Map(0x200000) -} - -static void QzshowbyInitCallback() -{ - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1, 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); - SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); - SekMapMemory(TaitoPaletteRam, 0x800000, 0x801fff, SM_RAM); - SekMapMemory(Taito68KRam1, 0x900000, 0x90ffff, SM_RAM); - SekSetWriteByteHandler(0, qzshowby_write_byte); - SekSetWriteWordHandler(0, qzshowby_write_word); - SekSetReadByteHandler(0, qzshowby_read_byte); -// SekSetReadWordHandler(0, qzshowby_read_word); - SekClose(); -} - -//---------------------------------------------------------------------------------------------------------- - - -// Master of Weapon (World) - -static struct BurnRomInfo masterwRomDesc[] = { - { "b72_06.33", 0x020000, 0xae848eff, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "b72_12.24", 0x020000, 0x7176ce70, TAITO_68KROM1_BYTESWAP }, // 1 - { "b72_04.34", 0x020000, 0x141e964c, TAITO_68KROM1_BYTESWAP }, // 2 - { "b72_03.25", 0x020000, 0xf4523496, TAITO_68KROM1_BYTESWAP }, // 3 - - { "b72_07.30", 0x010000, 0x2b1a946f, TAITO_Z80ROM1 }, // 4 Z80 code - - { "b72-02.rom", 0x080000, 0xc519f65a, TAITO_CHARS }, // 5 Graphics Tiles - { "b72-01.5", 0x080000, 0xa24ac26e, TAITO_CHARS }, // 6 -}; - -STD_ROM_PICK(masterw) -STD_ROM_FN(masterw) - -static INT32 MasterwInit() -{ - return CommonInit(MasterwInitCallback, 1, 2, 0, 4, 5); -} - -struct BurnDriver BurnDrvMasterw = { - "masterw", NULL, NULL, NULL, "1989", - "Master of Weapon (World)\0", "Imperfect graphics", "Taito Corporation Japan", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, - NULL, masterwRomInfo, masterwRomName, NULL, NULL, CommonInputInfo, MasterwDIPInfo, - MasterwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 224, 320, 3, 4 -}; - - -// Master of Weapon (US) - -static struct BurnRomInfo masterwuRomDesc[] = { - { "b72_06.33", 0x020000, 0xae848eff, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "b72_11.24", 0x020000, 0x0671fee6, TAITO_68KROM1_BYTESWAP }, // 1 - { "b72_04.34", 0x020000, 0x141e964c, TAITO_68KROM1_BYTESWAP }, // 2 - { "b72_03.25", 0x020000, 0xf4523496, TAITO_68KROM1_BYTESWAP }, // 3 - - { "b72_07.30", 0x010000, 0x2b1a946f, TAITO_Z80ROM1 }, // 4 Z80 code - - { "b72-02.rom", 0x080000, 0xc519f65a, TAITO_CHARS }, // 5 Graphics Tiles - { "b72-01.5", 0x080000, 0xa24ac26e, TAITO_CHARS }, // 6 -}; - -STD_ROM_PICK(masterwu) -STD_ROM_FN(masterwu) - -struct BurnDriver BurnDrvMasterwu = { - "masterwu", "masterw", NULL, NULL, "1989", - "Master of Weapon (US)\0", "Imperfect graphics", "Taito America Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, - NULL, masterwuRomInfo, masterwuRomName, NULL, NULL, CommonInputInfo, MasterwDIPInfo, - MasterwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 224, 320, 3, 4 -}; - - -// Master of Weapon (Japan) - -static struct BurnRomInfo masterwjRomDesc[] = { - { "b72_06.33", 0x020000, 0xae848eff, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "b72_05.24", 0x020000, 0x9f78af5c, TAITO_68KROM1_BYTESWAP }, // 1 - { "b72_04.34", 0x020000, 0x141e964c, TAITO_68KROM1_BYTESWAP }, // 2 - { "b72_03.25", 0x020000, 0xf4523496, TAITO_68KROM1_BYTESWAP }, // 3 - - { "b72_07.30", 0x010000, 0x2b1a946f, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "b72-02.6", 0x080000, 0x843444eb, TAITO_CHARS }, // 5 Graphics Tiles - { "b72-01.5", 0x080000, 0xa24ac26e, TAITO_CHARS }, // 6 -}; - -STD_ROM_PICK(masterwj) -STD_ROM_FN(masterwj) - -struct BurnDriver BurnDrvMasterwj = { - "masterwj", "masterw", NULL, NULL, "1989", - "Master of Weapon (Japan)\0", "Imperfect graphics", "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, - NULL, masterwjRomInfo, masterwjRomName, NULL, NULL, CommonInputInfo, MasterwDIPInfo, - MasterwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 224, 320, 3, 4 -}; - - -// Nastar (World) - -static struct BurnRomInfo nastarRomDesc[] = { - { "b81-08.50", 0x020000, 0xd6da9169, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "b81-13.31", 0x020000, 0x60d176fb, TAITO_68KROM1_BYTESWAP }, // 1 - { "b81-10.49", 0x020000, 0x53f34344, TAITO_68KROM1_BYTESWAP }, // 2 - { "b81-09.30", 0x020000, 0x630d34af, TAITO_68KROM1_BYTESWAP }, // 3 - - { "b81-11.37", 0x010000, 0x3704bf09, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "b81-03.14", 0x080000, 0x551b75e6, TAITO_CHARS }, // 5 Graphics Tiles - { "b81-04.15", 0x080000, 0xcf734e12, TAITO_CHARS }, // 6 - - { "b81-02.2", 0x080000, 0x20ec3b86, TAITO_YM2610A }, // 7 YM2610 A Samples - - { "b81-01.1", 0x080000, 0xb33f796b, TAITO_YM2610B }, // 8 YM2610 B Samples - - { "ampal16l8-b81-05.21", 0x000104, 0x922fd368, BRF_OPT }, // 9 PLDs - { "ampal16l8-b81-06a.22", 0x000104, 0xbb1cec84, BRF_OPT }, // 10 -}; - -STD_ROM_PICK(nastar) -STD_ROM_FN(nastar) - -static INT32 NastarInit() -{ - return CommonInit(NastarInitCallback, 0, 0, 0, 2, 4); -} - -struct BurnDriver BurnDrvNastar = { - "nastar", NULL, NULL, NULL, "1988", - "Nastar (World)\0", NULL, "Taito Corporation Japan", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, - NULL, nastarRomInfo, nastarRomName, NULL, NULL, CommonInputInfo, NastarDIPInfo, - NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Rastan Saga 2 (Japan) - -static struct BurnRomInfo rastsag2RomDesc[] = { - { "b81-08.50", 0x020000, 0xd6da9169, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "b81-07.31", 0x020000, 0x8edf17d7, TAITO_68KROM1_BYTESWAP }, // 1 - { "b81-10.49", 0x020000, 0x53f34344, TAITO_68KROM1_BYTESWAP }, // 2 - { "b81-09.30", 0x020000, 0x630d34af, TAITO_68KROM1_BYTESWAP }, // 3 - - { "b81-11.37", 0x010000, 0x3704bf09, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "b81-03.14", 0x080000, 0x551b75e6, TAITO_CHARS }, // 5 Graphics Tiles - { "b81-04.15", 0x080000, 0xcf734e12, TAITO_CHARS }, // 6 - - { "b81-02.2", 0x080000, 0x20ec3b86, TAITO_YM2610A }, // 7 YM2610 A Samples - - { "b81-01.1", 0x080000, 0xb33f796b, TAITO_YM2610B }, // 8 YM2610 B Samples -}; - -STD_ROM_PICK(rastsag2) -STD_ROM_FN(rastsag2) - -struct BurnDriver BurnDrvRastsag2 = { - "rastsag2", "nastar", NULL, NULL, "1988", - "Rastan Saga 2 (Japan)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, - NULL, rastsag2RomInfo, rastsag2RomName, NULL, NULL, CommonInputInfo, Rastsag2DIPInfo, - NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Nastar Warrior (US) - -static struct BurnRomInfo nastarwRomDesc[] = { - { "b81-08.50", 0x020000, 0xd6da9169, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "b81-12.31", 0x020000, 0xf9d82741, TAITO_68KROM1_BYTESWAP }, // 1 - { "b81-10.49", 0x020000, 0x53f34344, TAITO_68KROM1_BYTESWAP }, // 2 - { "b81-09.30", 0x020000, 0x630d34af, TAITO_68KROM1_BYTESWAP }, // 3 - - { "b81-11.37", 0x010000, 0x3704bf09, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "b81-03.14", 0x080000, 0x551b75e6, TAITO_CHARS }, // 5 Graphics Tiles - { "b81-04.15", 0x080000, 0xcf734e12, TAITO_CHARS }, // 6 - - { "b81-02.2", 0x080000, 0x20ec3b86, TAITO_YM2610A }, // 7 YM2610 A Samples - - { "b81-01.1", 0x080000, 0xb33f796b, TAITO_YM2610B }, // 8 YM2610 B Samples -}; - -STD_ROM_PICK(nastarw) -STD_ROM_FN(nastarw) - -struct BurnDriver BurnDrvNastarw = { - "nastarw", "nastar", NULL, NULL, "1988", - "Nastar Warrior (US)\0", NULL, "Taito America Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, - NULL, nastarwRomInfo, nastarwRomName, NULL, NULL, CommonInputInfo, NastarwDIPInfo, - NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Rambo III (Europe set 1) - -static struct BurnRomInfo rambo3RomDesc[] = { - { "ramb3-11.bin", 0x020000, 0x1cc42247, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "ramb3-14.bin", 0x020000, 0x7d917c21, TAITO_68KROM1_BYTESWAP }, // 1 - { "ramb3-07.bin", 0x020000, 0xc973ff6f, TAITO_68KROM1_BYTESWAP }, // 2 - { "ramb3-06.bin", 0x020000, 0xa83d3fd5, TAITO_68KROM1_BYTESWAP }, // 3 - - { "ramb3-10.bin", 0x010000, 0xb18bc020, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "ramb3-03.bin", 0x080000, 0xf5808c41, TAITO_CHARS }, // 5 Graphics Tiles - { "ramb3-04.bin", 0x080000, 0xc57831ce, TAITO_CHARS }, // 6 - { "ramb3-01.bin", 0x080000, 0xc55fcf54, TAITO_CHARS }, // 7 - { "ramb3-02.bin", 0x080000, 0x9dd014c6, TAITO_CHARS }, // 8 - - { "ramb3-05.bin", 0x080000, 0x0179dc40, TAITO_YM2610A }, // 9 YM2610 A Samples -}; - -STD_ROM_PICK(rambo3) -STD_ROM_FN(rambo3) - -static INT32 Rambo3Init() -{ - nTaitoInputConfig[1] = 0x30; - BurnGunInit(2, false); - - return CommonInit(TetristInitCallback, 0, 2, 0, 1, 6); -} - -struct BurnDriver BurnDrvRambo3 = { - "rambo3", NULL, NULL, NULL, "1989", - "Rambo III (Europe)\0", NULL, "Taito Europe Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, - NULL, rambo3RomInfo, rambo3RomName, NULL, NULL, Rambo3uInputInfo, Rambo3uDIPInfo, - Rambo3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Rambo III (US) - -static struct BurnRomInfo rambo3uRomDesc[] = { - { "ramb3-11.bin", 0x020000, 0x1cc42247, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "ramb3-13.bin", 0x020000, 0x0a964cb7, TAITO_68KROM1_BYTESWAP }, // 1 - { "ramb3-07.bin", 0x020000, 0xc973ff6f, TAITO_68KROM1_BYTESWAP }, // 2 - { "ramb3-06.bin", 0x020000, 0xa83d3fd5, TAITO_68KROM1_BYTESWAP }, // 3 - - { "ramb3-10.bin", 0x010000, 0xb18bc020, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "ramb3-03.bin", 0x080000, 0xf5808c41, TAITO_CHARS }, // 5 Graphics Tiles - { "ramb3-04.bin", 0x080000, 0xc57831ce, TAITO_CHARS }, // 6 - { "ramb3-01.bin", 0x080000, 0xc55fcf54, TAITO_CHARS }, // 7 - { "ramb3-02.bin", 0x080000, 0x9dd014c6, TAITO_CHARS }, // 8 - - { "ramb3-05.bin", 0x080000, 0x0179dc40, TAITO_YM2610A }, // 9 YM2610 A Samples -}; - -STD_ROM_PICK(rambo3u) -STD_ROM_FN(rambo3u) - -struct BurnDriver BurnDrvRambo3u = { - "rambo3u", "rambo3", NULL, NULL, "1989", - "Rambo III (US)\0", NULL, "Taito Europe Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, - NULL, rambo3uRomInfo, rambo3uRomName, NULL, NULL, Rambo3uInputInfo, Rambo3uDIPInfo, - Rambo3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Rambo III (Europe, Proto?) - -static struct BurnRomInfo rambo3pRomDesc[] = { - { "r3-0e.rom", 0x010000, 0x3efa4177, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "r3-0o.rom", 0x010000, 0x55c38d92, TAITO_68KROM1_BYTESWAP }, // 1 - { "r3-1e.rom", 0x020000, 0x40e363c7, TAITO_68KROM1_BYTESWAP }, // 2 - { "r3-1o.rom", 0x020000, 0x7f1fe6ab, TAITO_68KROM1_BYTESWAP }, // 3 - - { "r3-00.rom", 0x010000, 0xdf7a6ed6, TAITO_Z80ROM1 }, // 4 Z80 Code - -// This order is different than that of MAME! This allows use of standard gfx decode. - { "r3-ch1ll.rom", 0x020000, 0xc86ea5fc, TAITO_CHARS_BYTESWAP }, // 5 Graphics Tiles - { "r3-ch1lh.rom", 0x020000, 0x75568cf0, TAITO_CHARS_BYTESWAP }, // 6 - { "r3-ch1hl.rom", 0x020000, 0x7525eb92, TAITO_CHARS_BYTESWAP }, // 7 - { "r3-ch1hh.rom", 0x020000, 0xe39cff37, TAITO_CHARS_BYTESWAP }, // 8 - { "r3-ch3ll.rom", 0x020000, 0xabe54b1e, TAITO_CHARS_BYTESWAP }, // 9 - { "r3-ch3lh.rom", 0x020000, 0x5a155c04, TAITO_CHARS_BYTESWAP }, // 10 - { "r3-ch3hl.rom", 0x020000, 0x80e5647e, TAITO_CHARS_BYTESWAP }, // 11 - { "r3-ch3hh.rom", 0x020000, 0xabe58fdb, TAITO_CHARS_BYTESWAP }, // 12 - { "r3-ch0ll.rom", 0x020000, 0xb416f1bf, TAITO_CHARS_BYTESWAP }, // 13 - { "r3-ch0lh.rom", 0x020000, 0x76a330a2, TAITO_CHARS_BYTESWAP }, // 14 - { "r3-ch0hl.rom", 0x020000, 0xa4cad36d, TAITO_CHARS_BYTESWAP }, // 15 - { "r3-ch0hh.rom", 0x020000, 0x4dc69751, TAITO_CHARS_BYTESWAP }, // 16 - { "r3-ch2ll.rom", 0x020000, 0xd0ce3051, TAITO_CHARS_BYTESWAP }, // 17 - { "r3-ch2lh.rom", 0x020000, 0xdf3bc48f, TAITO_CHARS_BYTESWAP }, // 18 - { "r3-ch2hl.rom", 0x020000, 0x837d8677, TAITO_CHARS_BYTESWAP }, // 19 - { "r3-ch2hh.rom", 0x020000, 0xbf37dfac, TAITO_CHARS_BYTESWAP }, // 20 - - { "r3-a1.rom", 0x020000, 0x4396fa19, TAITO_YM2610A }, // 21 YM2610 A Samples - { "r3-a2.rom", 0x020000, 0x41fe53a8, TAITO_YM2610A }, // 22 - { "r3-a3.rom", 0x020000, 0xe89249ba, TAITO_YM2610A }, // 23 - { "r3-a4.rom", 0x020000, 0x9cf4c21b, TAITO_YM2610A }, // 24 -}; - -STD_ROM_PICK(rambo3p) -STD_ROM_FN(rambo3p) - -static INT32 Rambo3pInit() -{ - INT32 nRet = CommonInit(TetristInitCallback, 0, 0, 0, 1, 6); - - if (nRet == 0) { - memmove (Taito68KRom1 + 0x40000, Taito68KRom1 + 0x20000, 0x40000); - } - - return nRet; -} - -struct BurnDriver BurnDrvRambo3p = { - "rambo3p", "rambo3", NULL, NULL, "1989", - "Rambo III (Europe, Proti?)\0", NULL, "Taito Europe Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SHOOT, 0, - NULL, rambo3pRomInfo, rambo3pRomName, NULL, NULL, CommonInputInfo, Rambo3DIPInfo, - Rambo3pInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Crime City (World) - -static struct BurnRomInfo crimecRomDesc[] = { - { "b99-07.40", 0x020000, 0x26e886e6, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "b99-05.29", 0x020000, 0xff7f9a9d, TAITO_68KROM1_BYTESWAP }, // 1 - { "b99-06.39", 0x020000, 0x1f26aa92, TAITO_68KROM1_BYTESWAP }, // 2 - { "b99-14.28", 0x020000, 0x71c8b4d7, TAITO_68KROM1_BYTESWAP }, // 3 - - { "b99-08.45", 0x010000, 0x26135451, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "b99-02.18", 0x080000, 0x2a5d4a26, TAITO_CHARS }, // 5 Graphics Tiles - { "b99-01.19", 0x080000, 0xa19e373a, TAITO_CHARS }, // 6 - - { "b99-03.37", 0x080000, 0xdda10df7, TAITO_YM2610A }, // 7 YM2610 A Samples -}; - -STD_ROM_PICK(crimec) -STD_ROM_FN(crimec) - -static INT32 CrimecInit() -{ - return CommonInit(CrimecInitCallback, 0, 1, 0, 3, 5); -} - -struct BurnDriver BurnDrvCrimec = { - "crimec", NULL, NULL, NULL, "1989", - "Crime City (World)\0", NULL, "Taito Corporation Japan", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_PLATFORM, 0, - NULL, crimecRomInfo, crimecRomName, NULL, NULL, CommonInputInfo, CrimecDIPInfo, - CrimecInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Crime City (US) - -static struct BurnRomInfo crimecuRomDesc[] = { - { "b99-07.40", 0x020000, 0x26e886e6, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "b99-05.29", 0x020000, 0xff7f9a9d, TAITO_68KROM1_BYTESWAP }, // 1 - { "b99-06.39", 0x020000, 0x1f26aa92, TAITO_68KROM1_BYTESWAP }, // 2 - { "b99-13.28", 0x020000, 0x06cf8441, TAITO_68KROM1_BYTESWAP }, // 3 - - { "b99-08.45", 0x010000, 0x26135451, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "b99-02.18", 0x080000, 0x2a5d4a26, TAITO_CHARS }, // 5 Graphics Tiles - { "b99-01.19", 0x080000, 0xa19e373a, TAITO_CHARS }, // 6 - - { "b99-03.37", 0x080000, 0xdda10df7, TAITO_YM2610A }, // 7 YM2610 A Samples -}; - -STD_ROM_PICK(crimecu) -STD_ROM_FN(crimecu) - -struct BurnDriver BurnDrvCrimecu = { - "crimecu", "crimec", NULL, NULL, "1989", - "Crime City (US)\0", NULL, "Taito America Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_PLATFORM, 0, - NULL, crimecuRomInfo, crimecuRomName, NULL, NULL, CommonInputInfo, CrimecuDIPInfo, - CrimecInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Crime City (Japan) - -static struct BurnRomInfo crimecjRomDesc[] = { - { "b99-07.40", 0x020000, 0x26e886e6, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "b99-05.29", 0x020000, 0xff7f9a9d, TAITO_68KROM1_BYTESWAP }, // 1 - { "b99-06.39", 0x020000, 0x1f26aa92, TAITO_68KROM1_BYTESWAP }, // 2 - { "b99-15.28", 0x020000, 0xe8c1e56d, TAITO_68KROM1_BYTESWAP }, // 3 - - { "b99-08.45", 0x010000, 0x26135451, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "b99-02.18", 0x080000, 0x2a5d4a26, TAITO_CHARS }, // 5 Graphics Tiles - { "b99-01.19", 0x080000, 0xa19e373a, TAITO_CHARS }, // 6 - - { "b99-03.37", 0x080000, 0xdda10df7, TAITO_YM2610A }, // 7 YM2610 A Samples -}; - -STD_ROM_PICK(crimecj) -STD_ROM_FN(crimecj) - -struct BurnDriver BurnDrvCrimecj = { - "crimecj", "crimec", NULL, NULL, "1989", - "Crime City (Japan)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_PLATFORM, 0, - NULL, crimecjRomInfo, crimecjRomName, NULL, NULL, CommonInputInfo, CrimecjDIPInfo, - CrimecInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Tetris (Japan, B-System, YM2610) - -static struct BurnRomInfo tetristRomDesc[] = { - { "c12-03.bin", 0x020000, 0x38f1ed41, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c12-02.bin", 0x020000, 0xed9530bc, TAITO_68KROM1_BYTESWAP }, // 1 - { "c12-05.bin", 0x020000, 0x128e9927, TAITO_68KROM1_BYTESWAP }, // 2 - { "c12-04.bin", 0x020000, 0x5da7a319, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c12-06.bin", 0x010000, 0xf2814b38, TAITO_Z80ROM1 }, // 4 Z80 Code -}; - -STD_ROM_PICK(tetrist) -STD_ROM_FN(tetrist) - -static INT32 TetristInit() -{ - return CommonInit(TetristInitCallback, 0, 0, 0, 2, 4); -} - -struct BurnDriver BurnDrvTetrist = { - "tetrist", "tetris", NULL, NULL, "1989", - "Tetris (Japan, B-System, YM2610)\0", NULL, "Sega", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_PUZZLE, 0, - NULL, tetristRomInfo, tetristRomName, NULL, NULL, CommonInputInfo, TetristDIPInfo, - TetristInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Tetris (Japan, B-System, YM2203) - -static struct BurnRomInfo tetristaRomDesc[] = { - { "c35-04.bin", 0x020000, 0xfa6e42ff, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c35-03.bin", 0x020000, 0xaebd8539, TAITO_68KROM1_BYTESWAP }, // 1 - { "c35-02.bin", 0x020000, 0x128e9927, TAITO_68KROM1_BYTESWAP }, // 2 - { "c35-01.bin", 0x020000, 0x5da7a319, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c35-05.bin", 0x010000, 0x785c63fb, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "b72-02.rom", 0x080000, 0x843444eb, BRF_OPT }, // 5 Graphics Tiles (not used) - { "b72-01.rom", 0x080000, 0xa24ac26e, BRF_OPT }, // 6 -}; - -STD_ROM_PICK(tetrista) -STD_ROM_FN(tetrista) - -static INT32 TetristaInit() -{ - return CommonInit(TetristaInitCallback, 1, 2, 0, 4, 5); -} - -struct BurnDriver BurnDrvTetrista = { - "tetrista", "tetris", NULL, NULL, "1989", - "Tetris (Japan, B-System, YM2203)\0", NULL, "Sega", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_PUZZLE, 0, - NULL, tetristaRomInfo, tetristaRomName, NULL, NULL, CommonInputInfo, TetristDIPInfo, - TetristaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Violence Fight (World) - -static struct BurnRomInfo viofightRomDesc[] = { - { "c16-11.42", 0x010000, 0x23dbd388, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c16-14.23", 0x010000, 0xdc934f6a, TAITO_68KROM1_BYTESWAP }, // 1 - { "c16-07.41", 0x020000, 0x64d1d059, TAITO_68KROM1_BYTESWAP }, // 2 - { "c16-06.22", 0x020000, 0x043761d8, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c16-12.32", 0x010000, 0x6fb028c7, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c16-01.1", 0x080000, 0x7059ce83, TAITO_CHARS }, // 5 Graphics Tiles - { "c16-02.2", 0x080000, 0xb458e905, TAITO_CHARS }, // 6 - { "c16-03.3", 0x080000, 0x515a9431, TAITO_CHARS }, // 7 - { "c16-04.4", 0x080000, 0xebf285e2, TAITO_CHARS }, // 8 - - { "c16-05.47", 0x080000, 0xa49d064a, TAITO_MSM6295 }, // 9 MSM6295 Samples - - { "pal16l8b-c16-08.ic34", 0x000104, 0x9456d278, BRF_OPT }, // 10 PLDs - { "pal16l8b-c16-09.ic35", 0x000104, 0x0965baab, BRF_OPT }, // 11 -}; - -STD_ROM_PICK(viofight) -STD_ROM_FN(viofight) - -static INT32 ViofightInit() -{ - return CommonInit(ViofightInitCallback, 1, 2, 0, 1, 4); -} - -struct BurnDriver BurnDrvViofight = { - "viofight", NULL, NULL, NULL, "1989", - "Violence Fight (World)\0", NULL, "Taito Corporation Japan", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_VSFIGHT, 0, - NULL, viofightRomInfo, viofightRomName, NULL, NULL, ViofightInputInfo, ViofightDIPInfo, - ViofightInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Violence Fight (US) - -static struct BurnRomInfo viofightuRomDesc[] = { - { "c16-11.42", 0x010000, 0x23dbd388, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c16-13.23", 0x010000, 0xab947ffc, TAITO_68KROM1_BYTESWAP }, // 1 - { "c16-07.41", 0x020000, 0x64d1d059, TAITO_68KROM1_BYTESWAP }, // 2 - { "c16-06.22", 0x020000, 0x043761d8, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c16-12.32", 0x010000, 0x6fb028c7, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c16-01.1", 0x080000, 0x7059ce83, TAITO_CHARS }, // 5 Graphics Tiles - { "c16-02.2", 0x080000, 0xb458e905, TAITO_CHARS }, // 6 - { "c16-03.3", 0x080000, 0x515a9431, TAITO_CHARS }, // 7 - { "c16-04.4", 0x080000, 0xebf285e2, TAITO_CHARS }, // 8 - - { "c16-05.47", 0x080000, 0xa49d064a, TAITO_MSM6295 }, // 9 MSM6295 Samples - - { "pal16l8b-c16-08.ic34", 0x000104, 0x9456d278, BRF_OPT }, // 10 PLDs - { "pal16l8b-c16-09.ic35", 0x000104, 0x0965baab, BRF_OPT }, // 11 -}; - -STD_ROM_PICK(viofightu) -STD_ROM_FN(viofightu) - -struct BurnDriver BurnDrvViofightu = { - "viofightu", "viofight", NULL, NULL, "1989", - "Violence Fight (US)\0", NULL, "Taito America Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_VSFIGHT, 0, - NULL, viofightuRomInfo, viofightuRomName, NULL, NULL, ViofightInputInfo, ViofightDIPInfo, - ViofightInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Violence Fight (Japan) - -static struct BurnRomInfo viofightjRomDesc[] = { - { "c16-11.42", 0x010000, 0x23dbd388, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c16-10.23", 0x010000, 0x329d2e46, TAITO_68KROM1_BYTESWAP }, // 1 - { "c16-07.41", 0x020000, 0x64d1d059, TAITO_68KROM1_BYTESWAP }, // 2 - { "c16-06.22", 0x020000, 0x043761d8, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c16-12.32", 0x010000, 0x6fb028c7, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c16-01.1", 0x080000, 0x7059ce83, TAITO_CHARS }, // 5 Graphics Tiles - { "c16-02.2", 0x080000, 0xb458e905, TAITO_CHARS }, // 6 - { "c16-03.3", 0x080000, 0x515a9431, TAITO_CHARS }, // 7 - { "c16-04.4", 0x080000, 0xebf285e2, TAITO_CHARS }, // 8 - - { "c16-05.47", 0x080000, 0xa49d064a, TAITO_MSM6295 }, // 9 MSM6295 Samples - - { "pal16l8b-c16-08.ic34", 0x000104, 0x9456d278, BRF_OPT }, // 10 PLDs - { "pal16l8b-c16-09.ic35", 0x000104, 0x0965baab, BRF_OPT }, // 11 -}; - -STD_ROM_PICK(viofightj) -STD_ROM_FN(viofightj) - -struct BurnDriver BurnDrvViofightj = { - "viofightj", "viofight", NULL, NULL, "1989", - "Violence Fight (Japan)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_VSFIGHT, 0, - NULL, viofightjRomInfo, viofightjRomName, NULL, NULL, ViofightInputInfo, ViofightDIPInfo, - ViofightInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Ashura Blaster (World) - -static struct BurnRomInfo ashuraRomDesc[] = { - { "c43-15.50", 0x020000, 0x5d05d6c6, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c43-13.31", 0x020000, 0x75b7d877, TAITO_68KROM1_BYTESWAP }, // 1 - { "c43-14.49", 0x020000, 0xede7f37d, TAITO_68KROM1_BYTESWAP }, // 2 - { "c43-12.30", 0x020000, 0xb08a4ba0, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c43-16", 0x010000, 0xcb26fce1, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c43-02", 0x080000, 0x105722ae, TAITO_CHARS }, // 5 Graphics Tiles - { "c43-03", 0x080000, 0x426606ba, TAITO_CHARS }, // 6 - - { "c43-01", 0x080000, 0xdb953f37, TAITO_YM2610A }, // 7 YM2610 A Samples -}; - -STD_ROM_PICK(ashura) -STD_ROM_FN(ashura) - -struct BurnDriver BurnDrvAshura = { - "ashura", NULL, NULL, NULL, "1990", - "Ashura Blaster (World)\0", NULL, "Taito Corporation Japan", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, - NULL, ashuraRomInfo, ashuraRomName, NULL, NULL, CommonInputInfo, AshuraDIPInfo, - NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 224, 320, 3, 4 -}; - - -// Ashura Blaster (Japan) - -static struct BurnRomInfo ashurajRomDesc[] = { - { "c43-07-1.50", 0x020000, 0xd5ceb20f, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c43-05-1.31", 0x020000, 0xa6f3bb37, TAITO_68KROM1_BYTESWAP }, // 1 - { "c43-06-1.49", 0x020000, 0x0f331802, TAITO_68KROM1_BYTESWAP }, // 2 - { "c43-04-1.30", 0x020000, 0xe06a2414, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c43-16", 0x010000, 0xcb26fce1, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c43-02", 0x080000, 0x105722ae, TAITO_CHARS }, // 5 Graphics Tiles - { "c43-03", 0x080000, 0x426606ba, TAITO_CHARS }, // 6 - - { "c43-01", 0x080000, 0xdb953f37, TAITO_YM2610A }, // 7 YM2610 A Samples -}; - -STD_ROM_PICK(ashuraj) -STD_ROM_FN(ashuraj) - -struct BurnDriver BurnDrvAshuraj = { - "ashuraj", "ashura", NULL, NULL, "1990", - "Ashura Blaster (Japan)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, - NULL, ashurajRomInfo, ashurajRomName, NULL, NULL, CommonInputInfo, AshurajDIPInfo, - NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 224, 320, 3, 4 -}; - - -// Ashura Blaster (US) - -static struct BurnRomInfo ashurauRomDesc[] = { - { "c43-11.50", 0x020000, 0xd5aefc9b, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c43-09.31", 0x020000, 0xe91d0ab1, TAITO_68KROM1_BYTESWAP }, // 1 - { "c43-10.49", 0x020000, 0xc218e7ea, TAITO_68KROM1_BYTESWAP }, // 2 - { "c43-08.30", 0x020000, 0x5ef4f19f, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c43-16", 0x010000, 0xcb26fce1, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c43-02", 0x080000, 0x105722ae, TAITO_CHARS }, // 5 Graphics Tiles - { "c43-03", 0x080000, 0x426606ba, TAITO_CHARS }, // 6 - - { "c43-01", 0x080000, 0xdb953f37, TAITO_YM2610A }, // 7 YM2610 A Samples -}; - -STD_ROM_PICK(ashurau) -STD_ROM_FN(ashurau) - -struct BurnDriver BurnDrvAshurau = { - "ashurau", "ashura", NULL, NULL, "1990", - "Ashura Blaster (US)\0", NULL, "Taito America Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, - NULL, ashurauRomInfo, ashurauRomName, NULL, NULL, CommonInputInfo, AshurauDIPInfo, - NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 224, 320, 3, 4 -}; - - -// Hit the Ice (US) - -static struct BurnRomInfo hiticeRomDesc[] = { - { "c59-10.42", 0x020000, 0xe4ffad15, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c59-12.64", 0x020000, 0xa080d7af, TAITO_68KROM1_BYTESWAP }, // 1 - { "c59-09.41", 0x010000, 0xe243e3b0, TAITO_68KROM1_BYTESWAP }, // 2 - { "c59-11.63", 0x010000, 0x4d4dfa52, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c59-08.50", 0x010000, 0xd3cbc10b, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c59-03.12", 0x080000, 0x9e513048, TAITO_CHARS }, // 5 Graphics Tiles - { "c59-02.13", 0x080000, 0xaffb5e07, TAITO_CHARS }, // 6 - - { "c59-01.30", 0x020000, 0x46ae291d, TAITO_MSM6295 }, // 7 MSM6295 Samples - - { "pal20l8b-c59-04.25", 0x000144, 0x2ebcf07c, BRF_OPT }, // 8 PLDs - { "pal16l8b-c59-05.26", 0x000104, 0x37b67c5c, BRF_OPT }, // 9 - { "pal20l8b-c59-06.53", 0x000144, 0xbf176875, BRF_OPT }, // 10 - { "pal16r4b-c59-07.61", 0x000104, 0xcf64bd95, BRF_OPT }, // 11 -}; - -STD_ROM_PICK(hitice) -STD_ROM_FN(hitice) - -static INT32 HiticeInit() -{ - return CommonInit(HiticeInitCallback, 1, 0, 1, 6, 4); -} - -struct BurnDriver BurnDrvHitice = { - "hitice", NULL, NULL, NULL, "1990", - "Hit the Ice (US)\0", "Imperfect graphics", "Williams", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_SPORTSMISC, 0, - NULL, hiticeRomInfo, hiticeRomName, NULL, NULL, HiticeInputInfo, HiticeDIPInfo, - HiticeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Hit the Ice (Japan) - -static struct BurnRomInfo hiticejRomDesc[] = { - { "c59-23.42", 0x020000, 0x01958fcc, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c59-25.64", 0x020000, 0x71984c76, TAITO_68KROM1_BYTESWAP }, // 1 - { "c59-22.41", 0x010000, 0xc2c86140, TAITO_68KROM1_BYTESWAP }, // 2 - { "c59-24.63", 0x010000, 0x26c8f409, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c59-08.50", 0x010000, 0xd3cbc10b, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "c59-03.12", 0x080000, 0x9e513048, TAITO_CHARS }, // 5 Graphics Tiles - { "c59-02.13", 0x080000, 0xaffb5e07, TAITO_CHARS }, // 6 - - { "c59-01.30", 0x020000, 0x46ae291d, TAITO_MSM6295 }, // 7 MSM6295 Samples - - { "pal20l8b-c59-04.25", 0x000144, 0x2ebcf07c, BRF_OPT }, // 8 PLDs - { "pal16l8b-c59-05.26", 0x000104, 0x37b67c5c, BRF_OPT }, // 9 - { "pal20l8b-c59-06.53", 0x000144, 0xbf176875, BRF_OPT }, // 10 - { "pal16r4b-c59-07.61", 0x000104, 0xcf64bd95, BRF_OPT }, // 11 -}; - -STD_ROM_PICK(hiticej) -STD_ROM_FN(hiticej) - -struct BurnDriver BurnDrvHiticej = { - "hiticej", "hitice", NULL, NULL, "1990", - "Hit the Ice (Japan)\0", "Imperfect graphics", "Midway/Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SPORTSMISC, 0, - NULL, hiticejRomInfo, hiticejRomName, NULL, NULL, HiticeInputInfo, HiticeDIPInfo, - HiticeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Sel Feena - -static struct BurnRomInfo selfeenaRomDesc[] = { - { "se-02.27", 0x020000, 0x08f0c8e3, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "se-01.26", 0x020000, 0xa06ca64b, TAITO_68KROM1_BYTESWAP }, // 1 - - { "se-03.39", 0x010000, 0x675998be, TAITO_Z80ROM1 }, // 2 Z80 Code - - { "se-04.2", 0x080000, 0x920ad100, TAITO_CHARS }, // 3 Graphics Tiles - { "se-05.1", 0x080000, 0xd297c995, TAITO_CHARS }, // 4 - - { "se-06.11", 0x080000, 0x80d5e772, TAITO_YM2610A }, // 5 YM2610 A Samples -}; - -STD_ROM_PICK(selfeena) -STD_ROM_FN(selfeena) - -static INT32 SelfeenaInit() -{ - return CommonInit(SelfeenaInitCallback, 0, 2, 1, 4, 6); -} - -struct BurnDriver BurnDrvSelfeena = { - "selfeena", NULL, NULL, NULL, "1991", - "Sel Feena\0", NULL, "East Technology", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_MAZE, 0, - NULL, selfeenaRomInfo, selfeenaRomName, NULL, NULL, SelfeenaInputInfo, SelfeenaDIPInfo, - SelfeenaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Silent Dragon (World) - -static struct BurnRomInfo silentdRomDesc[] = { - { "east-12-1.ic32", 0x020000, 0x5883d362, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "east-15-1.ic10", 0x020000, 0x8c0a72ae, TAITO_68KROM1_BYTESWAP }, // 1 - { "east-11.ic31", 0x020000, 0x35da4428, TAITO_68KROM1_BYTESWAP }, // 2 - { "east-09.ic9", 0x020000, 0x2f05b14a, TAITO_68KROM1_BYTESWAP }, // 3 - - { "east-13.ic15", 0x010000, 0x651861ab, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "east-04.ic28", 0x100000, 0x53237217, TAITO_CHARS }, // 5 Graphics Tiles - { "east-06.ic29", 0x100000, 0xe6e6dfa7, TAITO_CHARS }, // 6 - { "east-03.ic39", 0x100000, 0x1b9b2846, TAITO_CHARS }, // 7 - { "east-05.ic40", 0x100000, 0xe02472c5, TAITO_CHARS }, // 8 - - { "east-01.ic1", 0x080000, 0xb41fff1a, TAITO_YM2610A }, // 9 YM2610 A Samples - - { "east-02.ic3", 0x080000, 0xe0de5c39, TAITO_YM2610B }, // 10 YM2610 B Samples -}; - -STD_ROM_PICK(silentd) -STD_ROM_FN(silentd) - -static INT32 SilentdInit() -{ - INT32 nRet = CommonInit(SilentdInitCallback, 0, 2, 2, 4, 6); - - if (nRet == 0) { - cpu_speed[0] = 16000000; // 16mhz - } - - return nRet; -} - -struct BurnDriver BurnDrvSilentd = { - "silentd", NULL, NULL, NULL, "1992", - "Silent Dragon (World)\0", NULL, "Taito Corporation Japan", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, - NULL, silentdRomInfo, silentdRomName, NULL, NULL, SilentdInputInfo, SilentdDIPInfo, - SilentdInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Silent Dragon (Japan) - -static struct BurnRomInfo silentdjRomDesc[] = { - { "east-12-1.ic32", 0x020000, 0x5883d362, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "east-10-1.ic10", 0x020000, 0x584306fc, TAITO_68KROM1_BYTESWAP }, // 1 - { "east-11.ic31", 0x020000, 0x35da4428, TAITO_68KROM1_BYTESWAP }, // 2 - { "east-09.ic9", 0x020000, 0x2f05b14a, TAITO_68KROM1_BYTESWAP }, // 3 - - { "east-13.ic15", 0x010000, 0x651861ab, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "east-04.ic28", 0x100000, 0x53237217, TAITO_CHARS }, // 5 Graphics Tiles - { "east-06.ic29", 0x100000, 0xe6e6dfa7, TAITO_CHARS }, // 6 - { "east-03.ic39", 0x100000, 0x1b9b2846, TAITO_CHARS }, // 7 - { "east-05.ic40", 0x100000, 0xe02472c5, TAITO_CHARS }, // 8 - - { "east-01.ic1", 0x080000, 0xb41fff1a, TAITO_YM2610A }, // 9 YM2610 A Samples - - { "east-02.ic3", 0x080000, 0xe0de5c39, TAITO_YM2610B }, // 10 YM2610 B Samples -}; - -STD_ROM_PICK(silentdj) -STD_ROM_FN(silentdj) - -struct BurnDriver BurnDrvSilentdj = { - "silentdj", "silentd", NULL, NULL, "1992", - "Silent Dragon (Japan)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, - NULL, silentdjRomInfo, silentdjRomName, NULL, NULL, SilentdInputInfo, SilentdjDIPInfo, - SilentdInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Silent Dragon (US) - -static struct BurnRomInfo silentduRomDesc[] = { - { "east-12-1.ic32", 0x020000, 0x5883d362, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "east-14-1.ic10", 0x020000, 0x3267bcd5, TAITO_68KROM1_BYTESWAP }, // 1 - { "east-11.ic31", 0x020000, 0x35da4428, TAITO_68KROM1_BYTESWAP }, // 2 - { "east-09.ic9", 0x020000, 0x2f05b14a, TAITO_68KROM1_BYTESWAP }, // 3 - - { "east-13.ic15", 0x010000, 0x651861ab, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "east-04.ic28", 0x100000, 0x53237217, TAITO_CHARS }, // 5 Graphics Tiles - { "east-06.ic29", 0x100000, 0xe6e6dfa7, TAITO_CHARS }, // 6 - { "east-03.ic39", 0x100000, 0x1b9b2846, TAITO_CHARS }, // 7 - { "east-05.ic40", 0x100000, 0xe02472c5, TAITO_CHARS }, // 8 - - { "east-01.ic1", 0x080000, 0xb41fff1a, TAITO_YM2610A }, // 9 YM2610 A Samples - - { "east-02.ic3", 0x080000, 0xe0de5c39, TAITO_YM2610B }, // 10 YM2610 B Samples -}; - -STD_ROM_PICK(silentdu) -STD_ROM_FN(silentdu) - -struct BurnDriver BurnDrvSilentdu = { - "silentdu", "silentd", NULL, NULL, "1992", - "Silent Dragon (US)\0", NULL, "Taito America Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, - NULL, silentduRomInfo, silentduRomName, NULL, NULL, SilentdInputInfo, SilentdjDIPInfo, - SilentdInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Ryu Jin (Japan) - -static struct BurnRomInfo ryujinRomDesc[] = { - { "ruj02.27", 0x020000, 0x0d223aee, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "ruj01.26", 0x020000, 0xc6bcdd1e, TAITO_68KROM1_BYTESWAP }, // 1 - { "ruj04.29", 0x020000, 0x0c153cab, TAITO_68KROM1_BYTESWAP }, // 2 - { "ruj03.28", 0x020000, 0x7695f89c, TAITO_68KROM1_BYTESWAP }, // 3 - - { "ruj05.39", 0x010000, 0x95270b16, TAITO_Z80ROM1 }, // 4 Z80 Code - - { "ryujin07.2", 0x100000, 0x34f50980, TAITO_CHARS }, // 5 Graphics Tiles - { "ryujin06.1", 0x100000, 0x1b85ff34, TAITO_CHARS }, // 6 - - { "ryujin08.11", 0x080000, 0x480d040d, TAITO_YM2610A }, // 7 YM2610 A Samples -}; - -STD_ROM_PICK(ryujin) -STD_ROM_FN(ryujin) - -struct BurnDriver BurnDrvRyujin = { - "ryujin", NULL, NULL, NULL, "1993", - "Ryu Jin (Japan)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, - NULL, ryujinRomInfo, ryujinRomName, NULL, NULL, SelfeenaInputInfo, RyujinDIPInfo, - SelfeenaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 224, 320, 3, 4 -}; - - -// Quiz Sekai wa SHOW by shobai (Japan) - -static struct BurnRomInfo qzshowbyRomDesc[] = { - { "d72-13.bin", 0x080000, 0xa867759f, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "d72-12.bin", 0x080000, 0x522c09a7, TAITO_68KROM1_BYTESWAP }, // 1 - - { "d72-11.bin", 0x020000, 0x2ca046e2, TAITO_Z80ROM1 }, // 2 Z80 Code - - { "d72-03.bin", 0x200000, 0x1de257d0, TAITO_CHARS }, // 3 Graphics Tiles - { "d72-02.bin", 0x200000, 0xbf0da640, TAITO_CHARS }, // 4 - - { "d72-01.bin", 0x200000, 0xb82b8830, TAITO_YM2610A }, // 5 YM2610 A Samples - - { "pal16l8-d72-05.bin", 0x0104, 0xc3d4cb7e, BRF_OPT }, // 6 PLDs - { "pal16l8-d72-06.bin", 0x0104, 0x27580efc, BRF_OPT }, // 7 - { "palce20v8-d72-07.bin", 0x0157, 0x6359e64c, BRF_OPT }, // 8 - { "palce20v8-d72-08.bin", 0x0157, 0x746a6474, BRF_OPT }, // 9 - { "palce20v8-d72-09.bin", 0x0157, 0x9f680800, BRF_OPT }, // 10 - { "palce16v8-d72-10.bin", 0x0117, 0xa5181ba2, BRF_OPT }, // 11 -}; - -STD_ROM_PICK(qzshowby) -STD_ROM_FN(qzshowby) - -static INT32 QzshowbyInit() -{ - return CommonInit(QzshowbyInitCallback, 0, 1, 3, 5, 3); -} - -struct BurnDriver BurnDrvQzshowby = { - "qzshowby", NULL, NULL, NULL, "1993", - "Quiz Sekai wa SHOW by shobai (Japan)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_QUIZ, 0, - NULL, qzshowbyRomInfo, qzshowbyRomName, NULL, NULL, QzshowbyInputInfo, QzshowbyDIPInfo, - QzshowbyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Puzzle Bobble (Japan, B-System) - -static struct BurnRomInfo pbobbleRomDesc[] = { - { "pb-1c18.bin", 0x040000, 0x5de14f49, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "pb-ic2.bin", 0x040000, 0x2abe07d1, TAITO_68KROM1_BYTESWAP }, // 1 - - { "pb-ic27.bin", 0x020000, 0x26efa4c4, TAITO_Z80ROM1 }, // 2 Z80 Code - - { "pb-ic14.bin", 0x080000, 0x55f90ea4, TAITO_CHARS }, // 3 Graphics Tiles - { "pb-ic9.bin", 0x080000, 0x3253aac9, TAITO_CHARS }, // 4 - - { "pb-ic15.bin", 0x100000, 0x0840cbc4, TAITO_YM2610A }, // 5 YM2610 A Samples -}; - -STD_ROM_PICK(pbobble) -STD_ROM_FN(pbobble) - -static INT32 PbobbleInit() -{ - return CommonInit(PbobbleInitCallback, 0, 1, 3, 5, 3); -} - -struct BurnDriver BurnDrvPbobble = { - "pbobble", NULL, NULL, NULL, "1994", - "Puzzle Bobble (Japan, B-System)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, - NULL, pbobbleRomInfo, pbobbleRomName, NULL, NULL, PbobbleInputInfo, PbobbleDIPInfo, - PbobbleInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Space Invaders DX (US, v2.1) - -static struct BurnRomInfo spacedxRomDesc[] = { - { "d89-06", 0x040000, 0x7122751e, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "d89-xx.ic2", 0x040000, 0x56b0be6c, TAITO_68KROM1_BYTESWAP }, // 1 - - { "d89-07.27", 0x010000, 0xbd743401, TAITO_Z80ROM1 }, // 2 Z80 Code - - { "d89-02.14", 0x080000, 0xc36544b9, TAITO_CHARS }, // 3 Graphics Tiles - { "d89-01.9", 0x080000, 0xfffa0660, TAITO_CHARS }, // 4 - - { "d89-03.15", 0x080000, 0x218f31a4, TAITO_YM2610A }, // 5 YM2610 A Samples - - { "pal16l8-d72-05.ic37", 0x0104, 0xc3d4cb7e, BRF_OPT }, // 6 PLDs - { "pal16l8-d72-06.ic50", 0x0104, 0xe96b7f37, BRF_OPT }, // 7 - { "palce20v8-d72-07.ic28", 0x0157, 0x6359e64c, BRF_OPT }, // 8 - { "palce20v8-d72-09.ic47", 0x0157, 0xde1760fd, BRF_OPT }, // 9 - { "palce16v8-d72-10.ic12", 0x0117, 0xa5181ba2, BRF_OPT }, // 10 - { "pal20l8b-d89-04.ic40", 0x0144, 0x00000000, BRF_OPT | BRF_NODUMP }, // 12 -}; - -STD_ROM_PICK(spacedx) -STD_ROM_FN(spacedx) - -struct BurnDriver BurnDrvSpacedx = { - "spacedx", NULL, NULL, NULL, "1994", - "Space Invaders DX (US, v2.1)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, - NULL, spacedxRomInfo, spacedxRomName, NULL, NULL, PbobbleInputInfo, PbobbleDIPInfo, - PbobbleInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Space Invaders DX (Japan, v2.1) - -static struct BurnRomInfo spacedxjRomDesc[] = { - { "d89-06", 0x040000, 0x7122751e, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "d89-05", 0x040000, 0xbe1638af, TAITO_68KROM1_BYTESWAP }, // 1 - - { "d89-07.27", 0x010000, 0xbd743401, TAITO_Z80ROM1 }, // 2 Z80 Code - - { "d89-02.14", 0x080000, 0xc36544b9, TAITO_CHARS }, // 3 Graphics Tiles - { "d89-01.9", 0x080000, 0xfffa0660, TAITO_CHARS }, // 4 - - { "d89-03.15", 0x080000, 0x218f31a4, TAITO_YM2610A }, // 5 YM2610 A Samples - - { "pal16l8-d72-05.ic37", 0x0104, 0xc3d4cb7e, BRF_OPT }, // 6 PLDs - { "pal16l8-d72-06.ic50", 0x0104, 0xe96b7f37, BRF_OPT }, // 7 - { "palce20v8-d72-07.ic28", 0x0157, 0x6359e64c, BRF_OPT }, // 8 - { "palce20v8-d72-09.ic47", 0x0157, 0xde1760fd, BRF_OPT }, // 9 - { "palce16v8-d72-10.ic12", 0x0117, 0xa5181ba2, BRF_OPT }, // 10 - { "pal20l8b-d89-04.ic40", 0x0144, 0x00000000, BRF_OPT | BRF_NODUMP }, // 12 -}; - -STD_ROM_PICK(spacedxj) -STD_ROM_FN(spacedxj) - -struct BurnDriver BurnDrvSpacedxj = { - "spacedxj", "spacedx", NULL, NULL, "1994", - "Space Invaders DX (Japan, v2.1)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, - NULL, spacedxjRomInfo, spacedxjRomName, NULL, NULL, PbobbleInputInfo, PbobbleDIPInfo, - PbobbleInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Space Invaders DX (Japan, v2.0) - -static struct BurnRomInfo spacedxoRomDesc[] = { - { "d89-08.bin", 0x020000, 0x0c2fe7f9, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "d89-09.bin", 0x020000, 0x7f0a0ba4, TAITO_68KROM1_BYTESWAP }, // 1 - - { "d89-07.27", 0x010000, 0xbd743401, TAITO_Z80ROM1 }, // 2 Z80 Code - - { "d89-12.bin", 0x080000, 0x53df86f1, TAITO_CHARS }, // 3 Graphics Tiles - { "d89-13.bin", 0x080000, 0xc44c1352, TAITO_CHARS }, // 4 - - { "d89-03.15", 0x080000, 0x218f31a4, TAITO_YM2610A }, // 5 YM2610 A Samples -}; - -STD_ROM_PICK(spacedxo) -STD_ROM_FN(spacedxo) - -static INT32 SpacedxoInit() -{ - return CommonInit(SilentdInitCallback, 0, 2, 3, 4, 6); -} - -struct BurnDriver BurnDrvSpacedxo = { - "spacedxo", "spacedx", NULL, NULL, "1994", - "Space Invaders DX (Japan, v2.0)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, - NULL, spacedxoRomInfo, spacedxoRomName, NULL, NULL, SpacedxoInputInfo, SpacedxoDIPInfo, - SpacedxoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; - - -// Sonic Blast Man (Japan) - -static struct BurnRomInfo sbmRomDesc[] = { - { "c69-20-1.10", 0x020000, 0xb40e4910, TAITO_68KROM1_BYTESWAP }, // 0 68k Code - { "c69-22-1.12", 0x020000, 0xecbcf830, TAITO_68KROM1_BYTESWAP }, // 1 - { "c69-19-1.9", 0x020000, 0x5719c158, TAITO_68KROM1_BYTESWAP }, // 2 - { "c69-21-1.11", 0x020000, 0x73562394, TAITO_68KROM1_BYTESWAP }, // 3 - - { "c69-23.28", 0x010000, 0xb2fce13e, TAITO_Z80ROM1 }, // 4 Z80 Code - - // Some roms are repeated to compensate for the way the taito rom loading system in fba works. - { "c69-01.ic5", 0x100000, 0x521fabe3, TAITO_CHARS }, // 5 Graphics Tiles - { "c69-13.ic2", 0x020000, 0xd1550884, TAITO_CHARS_BYTESWAP }, // 6 - { "c69-12.ic1", 0x020000, 0xeb56582c, TAITO_CHARS_BYTESWAP }, // 7 - { "c69-13.ic2", 0x020000, 0xd1550884, TAITO_CHARS_BYTESWAP }, // 8 - { "c69-12.ic1", 0x020000, 0xeb56582c, TAITO_CHARS_BYTESWAP }, // 9 - { "c69-13.ic2", 0x020000, 0xd1550884, TAITO_CHARS_BYTESWAP }, // 10 - { "c69-12.ic1", 0x020000, 0xeb56582c, TAITO_CHARS_BYTESWAP }, // 11 - { "c69-13.ic2", 0x020000, 0xd1550884, TAITO_CHARS_BYTESWAP }, // 12 - { "c69-12.ic1", 0x020000, 0xeb56582c, TAITO_CHARS_BYTESWAP }, // 13 - { "c69-02.ic6", 0x100000, 0xf0e20d35, TAITO_CHARS }, // 14 - { "c69-15.ic4", 0x020000, 0x9761d316, TAITO_CHARS_BYTESWAP }, // 15 - { "c69-14.ic3", 0x020000, 0x0ed0272a, TAITO_CHARS_BYTESWAP }, // 16 - { "c69-15.ic4", 0x020000, 0x9761d316, TAITO_CHARS_BYTESWAP }, // 17 - { "c69-14.ic3", 0x020000, 0x0ed0272a, TAITO_CHARS_BYTESWAP }, // 18 - { "c69-15.ic4", 0x020000, 0x9761d316, TAITO_CHARS_BYTESWAP }, // 19 - { "c69-14.ic3", 0x020000, 0x0ed0272a, TAITO_CHARS_BYTESWAP }, // 20 - { "c69-15.ic4", 0x020000, 0x9761d316, TAITO_CHARS_BYTESWAP }, // 21 - { "c69-14.ic3", 0x020000, 0x0ed0272a, TAITO_CHARS_BYTESWAP }, // 22 - - { "c69-03.36", 0x080000, 0x63e6b6e7, TAITO_YM2610A }, // 23 ymsnd -}; - -STD_ROM_PICK(sbm) -STD_ROM_FN(sbm) - -static INT32 SbmInit() -{ - nTaitoInputConfig[2] = 0x60; - - return CommonInit(SbmInitCallback, 0, 0, 0, 5, 4); -} - -struct BurnDriver BurnDrvSbm = { - "sbm", NULL, NULL, NULL, "1990", - "Sonic Blast Man (Japan)\0", NULL, "Taito Corporation", "Taito B System", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, - NULL, sbmRomInfo, sbmRomName, NULL, NULL, SbmInputInfo, SbmDIPInfo, - SbmInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, - 320, 224, 4, 3 -}; +// FB Alpha Taito B System driver module +// Based on MAME driver by Jarek Burczynski and various others + +// to do: +// fix rambo alt sets inputs +// master of weapon title screen is incorrect + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "taito.h" +#include "taito_ic.h" +#include "burn_ym2610.h" +#include "msm6295.h" +#include "burn_ym2203.h" +#include "burn_gun.h" +#include "eeprom.h" + +static UINT8 *DrvPxlRAM = NULL; +static UINT16 *DrvPxlScroll = NULL; +static UINT8 *DrvFramebuffer = NULL; + +static INT32 eeprom_latch = 0; +static INT32 coin_control = 0; + +static UINT8 color_config[4]; +static INT32 irq_config[2]; +static INT32 sound_config = 0; +static INT32 cpu_speed[2]; +static UINT8 nTaitoInputConfig[5] = { 0, 0, 0, 0, 0 }; + +static struct BurnInputInfo CommonInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, +}; + +STDINPUTINFO(Common) + +static struct BurnInputInfo PbobbleInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TaitoInputPort3 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TaitoInputPort3 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TaitoInputPort3 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TaitoInputPort3 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TaitoInputPort3 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TaitoInputPort3 + 5, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TaitoInputPort3 + 6, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TaitoInputPort3 + 7, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 fire 3" }, + + {"P3 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 6, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 6, "p3 start" }, + {"P3 Up", BIT_DIGITAL, TaitoInputPort5 + 0, "p3 up" }, + {"P3 Down", BIT_DIGITAL, TaitoInputPort5 + 1, "p3 down" }, + {"P3 Left", BIT_DIGITAL, TaitoInputPort5 + 2, "p3 left" }, + {"P3 Right", BIT_DIGITAL, TaitoInputPort5 + 3, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, TaitoInputPort4 + 0, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, TaitoInputPort4 + 1, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, TaitoInputPort4 + 2, "p3 fire 3" }, + + {"P4 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 7, "p4 coin" }, + {"P4 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 7, "p4 start" }, + {"P4 Up", BIT_DIGITAL, TaitoInputPort5 + 4, "p4 up" }, + {"P4 Down", BIT_DIGITAL, TaitoInputPort5 + 5, "p4 down" }, + {"P4 Left", BIT_DIGITAL, TaitoInputPort5 + 6, "p4 left" }, + {"P4 Right", BIT_DIGITAL, TaitoInputPort5 + 7, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, TaitoInputPort4 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, TaitoInputPort4 + 5, "p4 fire 2" }, + {"P4 Button 3", BIT_DIGITAL, TaitoInputPort4 + 6, "p4 fire 3" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "service" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, +}; + +STDINPUTINFO(Pbobble) + +static struct BurnInputInfo QzshowbyInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, TaitoInputPort3 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TaitoInputPort3 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, TaitoInputPort3 + 3, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, TaitoInputPort3 + 2, "p1 fire 4" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, TaitoInputPort3 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TaitoInputPort3 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, TaitoInputPort3 + 7, "p2 fire 3" }, + {"P2 Button 4", BIT_DIGITAL, TaitoInputPort3 + 6, "p2 fire 4" }, + + {"P3 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 6, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 6, "p3 start" }, + {"P3 Button 1", BIT_DIGITAL, TaitoInputPort5 + 8, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, TaitoInputPort5 + 9, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, TaitoInputPort5 + 11, "p3 fire 3" }, + {"P3 Button 4", BIT_DIGITAL, TaitoInputPort5 + 10, "p3 fire 4" }, + + {"P4 Coin", BIT_DIGITAL, TC0220IOCInputPort0 + 7, "p4 coin" }, + {"P4 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 7, "p4 start" }, + {"P4 Button 1", BIT_DIGITAL, TaitoInputPort5 + 12, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, TaitoInputPort5 + 13, "p4 fire 2" }, + {"P4 Button 3", BIT_DIGITAL, TaitoInputPort5 + 15, "p4 fire 3" }, + {"P4 Button 4", BIT_DIGITAL, TaitoInputPort5 + 14, "p4 fire 4" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "service" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, +}; + +STDINPUTINFO(Qzshowby) + +static struct BurnInputInfo SpacedxoInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 fire 3" }, + + {"P3 Coin", BIT_DIGITAL, TaitoInputPort5 + 0, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, TaitoInputPort3 + 0, "p3 start" }, + {"P3 Up", BIT_DIGITAL, TaitoInputPort3 + 3, "p3 up" }, + {"P3 Down", BIT_DIGITAL, TaitoInputPort3 + 4, "p3 down" }, + {"P3 Left", BIT_DIGITAL, TaitoInputPort3 + 1, "p3 left" }, + {"P3 Right", BIT_DIGITAL, TaitoInputPort3 + 2, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, TaitoInputPort3 + 5, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, TaitoInputPort3 + 6, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, TaitoInputPort3 + 7, "p3 fire 3" }, + + {"P4 Coin", BIT_DIGITAL, TaitoInputPort5 + 2, "p4 coin" }, + {"P4 Start", BIT_DIGITAL, TaitoInputPort4 + 0, "p4 start" }, + {"P4 Up", BIT_DIGITAL, TaitoInputPort4 + 3, "p4 up" }, + {"P4 Down", BIT_DIGITAL, TaitoInputPort4 + 4, "p4 down" }, + {"P4 Left", BIT_DIGITAL, TaitoInputPort4 + 1, "p4 left" }, + {"P4 Right", BIT_DIGITAL, TaitoInputPort4 + 2, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, TaitoInputPort4 + 5, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, TaitoInputPort4 + 6, "p4 fire 2" }, + {"P4 Button 3", BIT_DIGITAL, TaitoInputPort4 + 7, "p4 fire 3" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, + {"Service", BIT_DIGITAL, TaitoInputPort5 + 1, "service" }, + {"Service", BIT_DIGITAL, TaitoInputPort5 + 3, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, +}; + +STDINPUTINFO(Spacedxo) + +static struct BurnInputInfo SelfeenaInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset"}, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, +}; + +STDINPUTINFO(Selfeena) + +static struct BurnInputInfo SbmInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p1 fire 3" }, + {"P1 Button 4", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p1 fire 4" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 6, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 7, "p2 right" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, +}; + +STDINPUTINFO(Sbm) + +static struct BurnInputInfo SilentdInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 fire 3" }, + + {"P3 Coin", BIT_DIGITAL, TaitoInputPort5 + 0, "p3 coin" }, + {"P3 Start", BIT_DIGITAL, TaitoInputPort3 + 0, "p3 start" }, + {"P3 Up", BIT_DIGITAL, TaitoInputPort3 + 3, "p3 up" }, + {"P3 Down", BIT_DIGITAL, TaitoInputPort3 + 4, "p3 down" }, + {"P3 Left", BIT_DIGITAL, TaitoInputPort3 + 1, "p3 left" }, + {"P3 Right", BIT_DIGITAL, TaitoInputPort3 + 2, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, TaitoInputPort3 + 5, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, TaitoInputPort3 + 6, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, TaitoInputPort3 + 7, "p3 fire 3" }, + + {"P4 Coin", BIT_DIGITAL, TaitoInputPort5 + 2, "p4 coin" }, + {"P4 Start", BIT_DIGITAL, TaitoInputPort4 + 0, "p4 start" }, + {"P4 Up", BIT_DIGITAL, TaitoInputPort4 + 3, "p4 up" }, + {"P4 Down", BIT_DIGITAL, TaitoInputPort4 + 4, "p4 down" }, + {"P4 Left", BIT_DIGITAL, TaitoInputPort4 + 1, "p4 left" }, + {"P4 Right", BIT_DIGITAL, TaitoInputPort4 + 2, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, TaitoInputPort4 + 5, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, TaitoInputPort4 + 6, "p4 fire 2" }, + {"P4 Button 3", BIT_DIGITAL, TaitoInputPort4 + 7, "p4 fire 3" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, +}; + +STDINPUTINFO(Silentd) + +static struct BurnInputInfo ViofightInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset"}, + {"Service", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, +}; + +STDINPUTINFO(Viofight) + +static struct BurnInputInfo HiticeInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 2, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, TC0220IOCInputPort0 + 5, "p2 fire 3" }, + + {"P3 Start", BIT_DIGITAL, TaitoInputPort3 + 7, "p3 start" }, + {"P3 Up", BIT_DIGITAL, TaitoInputPort3 + 0, "p3 up" }, + {"P3 Down", BIT_DIGITAL, TaitoInputPort3 + 1, "p3 down" }, + {"P3 Left", BIT_DIGITAL, TaitoInputPort3 + 2, "p3 left" }, + {"P3 Right", BIT_DIGITAL, TaitoInputPort3 + 3, "p3 right" }, + {"P3 Button 1", BIT_DIGITAL, TaitoInputPort3 + 4, "p3 fire 1" }, + {"P3 Button 2", BIT_DIGITAL, TaitoInputPort3 + 5, "p3 fire 2" }, + {"P3 Button 3", BIT_DIGITAL, TaitoInputPort3 + 6, "p3 fire 3" }, + + {"P4 Start", BIT_DIGITAL, TaitoInputPort4 + 7, "p4 start" }, + {"P4 Up", BIT_DIGITAL, TaitoInputPort4 + 0, "p4 up" }, + {"P4 Down", BIT_DIGITAL, TaitoInputPort4 + 1, "p4 down" }, + {"P4 Left", BIT_DIGITAL, TaitoInputPort4 + 2, "p4 left" }, + {"P4 Right", BIT_DIGITAL, TaitoInputPort4 + 3, "p4 right" }, + {"P4 Button 1", BIT_DIGITAL, TaitoInputPort4 + 4, "p4 fire 1" }, + {"P4 Button 2", BIT_DIGITAL, TaitoInputPort4 + 5, "p4 fire 2" }, + {"P4 Button 3", BIT_DIGITAL, TaitoInputPort4 + 6, "p4 fire 3" }, + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset" }, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, +}; + +STDINPUTINFO(Hitice) + +#define A(a, b, c, d) {a, b, (UINT8*)(c), d} + +static struct BurnInputInfo Rambo3uInputList[] = { + {"P1 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 2, "p1 start" }, + {"P1 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 0, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 1, "p1 fire 2" }, + + A("P1 Trackball X", BIT_ANALOG_REL, &TaitoAnalogPort0, "p1 x-axis" ), + A("P1 Trackball Y", BIT_ANALOG_REL, &TaitoAnalogPort1, "p1 y-axis" ), + + {"P2 Coin", BIT_DIGITAL, TC0220IOCInputPort1 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, TC0220IOCInputPort1 + 3, "p2 start" }, + {"P2 Up", BIT_DIGITAL, TC0220IOCInputPort2 + 4, "p2 up" }, + {"P2 Down", BIT_DIGITAL, TC0220IOCInputPort2 + 5, "p2 down" }, + {"P2 Left", BIT_DIGITAL, TC0220IOCInputPort2 + 6, "p2 left" }, + {"P2 Right", BIT_DIGITAL, TC0220IOCInputPort2 + 7, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, TC0220IOCInputPort0 + 3, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, TC0220IOCInputPort0 + 4, "p2 fire 2" }, + + A("P2 Trackball X", BIT_ANALOG_REL, &TaitoAnalogPort2, "p2 x-axis" ), + A("P2 Trackball Y", BIT_ANALOG_REL, &TaitoAnalogPort3, "p2 y-axis" ), + + {"Reset", BIT_DIGITAL, &TaitoReset, "reset"}, + {"Service", BIT_DIGITAL, TC0220IOCInputPort1 + 1, "service" }, + {"Tilt", BIT_DIGITAL, TC0220IOCInputPort1 + 0, "tilt" }, + {"Dip A", BIT_DIPSWITCH, TC0220IOCDip + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, TC0220IOCDip + 1, "dip" }, +}; + +STDINPUTINFO(Rambo3u) + +#undef A + +static struct BurnDIPInfo NastarDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 0, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "100k only" }, + {0x14, 0x01, 0x0c, 0x08, "150k only" }, + {0x14, 0x01, 0x0c, 0x04, "200k only" }, + {0x14, 0x01, 0x0c, 0x00, "250k only" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x20, "1" }, + {0x14, 0x01, 0x30, 0x10, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Nastar) + +static struct BurnDIPInfo Rastsag2DIPList[]= +{ + {0x13, 0xff, 0xff, 0x3f, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 0, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "100k only" }, + {0x14, 0x01, 0x0c, 0x08, "150k only" }, + {0x14, 0x01, 0x0c, 0x04, "200k only" }, + {0x14, 0x01, 0x0c, 0x00, "250k only" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x20, "1" }, + {0x14, 0x01, 0x30, 0x10, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 4, "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Rastsag2) + +static struct BurnDIPInfo NastarwDIPList[]= +{ + {0x13, 0xff, 0xff, 0x3e, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "100k only" }, + {0x14, 0x01, 0x0c, 0x08, "150k only" }, + {0x14, 0x01, 0x0c, 0x04, "200k only" }, + {0x14, 0x01, 0x0c, 0x00, "250k only" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x20, "1" }, + {0x14, 0x01, 0x30, 0x10, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Nastarw) + +static struct BurnDIPInfo AshuraDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "every 100k" }, + {0x14, 0x01, 0x0c, 0x0c, "every 150k" }, + {0x14, 0x01, 0x0c, 0x04, "every 200k" }, + {0x14, 0x01, 0x0c, 0x00, "every 250k" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x00, "1" }, + {0x14, 0x01, 0x30, 0x10, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Ashura) + +static struct BurnDIPInfo AshurajDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "every 100k" }, + {0x14, 0x01, 0x0c, 0x0c, "every 150k" }, + {0x14, 0x01, 0x0c, 0x04, "every 200k" }, + {0x14, 0x01, 0x0c, 0x00, "every 250k" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x00, "1" }, + {0x14, 0x01, 0x30, 0x10, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Ashuraj) + +static struct BurnDIPInfo AshurauDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Continue Price" }, + {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "Same as Start" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "every 100k" }, + {0x14, 0x01, 0x0c, 0x0c, "every 150k" }, + {0x14, 0x01, 0x0c, 0x04, "every 200k" }, + {0x14, 0x01, 0x0c, 0x00, "every 250k" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x00, "1" }, + {0x14, 0x01, 0x30, 0x10, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Ashurau) + +static struct BurnDIPInfo CrimecDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Hi Score" }, + {0x13, 0x01, 0x01, 0x01, "Scribble" }, + {0x13, 0x01, 0x01, 0x00, "3 Characters" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "every 80k" }, + {0x14, 0x01, 0x0c, 0x0c, "80k only" }, + {0x14, 0x01, 0x0c, 0x04, "160k only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x10, "1" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Allow Continue" }, + {0x14, 0x01, 0xc0, 0x00, "Off" }, + {0x14, 0x01, 0xc0, 0x40, "5 Times" }, + {0x14, 0x01, 0xc0, 0x80, "8 Times" }, + {0x14, 0x01, 0xc0, 0xc0, "On" }, +}; + +STDDIPINFO(Crimec) + +static struct BurnDIPInfo CrimecjDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Hi Score" }, + {0x13, 0x01, 0x01, 0x01, "Scribble" }, + {0x13, 0x01, 0x01, 0x00, "3 Characters" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "every 80k" }, + {0x14, 0x01, 0x0c, 0x0c, "80k only" }, + {0x14, 0x01, 0x0c, 0x04, "160k only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x10, "1" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Allow Continue" }, + {0x14, 0x01, 0xc0, 0x00, "Off" }, + {0x14, 0x01, 0xc0, 0x40, "5 Times" }, + {0x14, 0x01, 0xc0, 0x80, "8 Times" }, + {0x14, 0x01, 0xc0, 0xc0, "On" }, +}; + +STDDIPINFO(Crimecj) + +static struct BurnDIPInfo CrimecuDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Hi Score" }, + {0x13, 0x01, 0x01, 0x01, "Scribble" }, + {0x13, 0x01, 0x01, 0x00, "3 Characters" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Price to Continue" }, + {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "Same as Start" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "every 80k" }, + {0x14, 0x01, 0x0c, 0x0c, "80k only" }, + {0x14, 0x01, 0x0c, 0x04, "160k only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x10, "1" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "4" }, + + {0 , 0xfe, 0 , 4, "Allow Continue" }, + {0x14, 0x01, 0xc0, 0x00, "Off" }, + {0x14, 0x01, 0xc0, 0x40, "5 Times" }, + {0x14, 0x01, 0xc0, 0x80, "8 Times" }, + {0x14, 0x01, 0xc0, 0xc0, "On" }, +}; + +STDDIPINFO(Crimecu) + +static struct BurnDIPInfo TetristDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, +}; + +STDDIPINFO(Tetrist) + +static struct BurnDIPInfo Rambo3DIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x14, 0x01, 0x10, 0x00, "Off" }, + {0x14, 0x01, 0x10, 0x10, "On" }, +}; + +STDDIPINFO(Rambo3) + +static struct BurnDIPInfo MasterwDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "500k, 1000k and 1500k"}, + {0x14, 0x01, 0x0c, 0x0c, "500k and 1000k" }, + {0x14, 0x01, 0x0c, 0x04, "500k only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + {0x14, 0x01, 0x30, 0x00, "6" }, + + {0 , 0xfe, 0 , 2, "Ship Type" }, + {0x14, 0x01, 0x80, 0x80, "Space Ship" }, + {0x14, 0x01, 0x80, 0x00, "Hover Cycle" }, +}; + +STDDIPINFO(Masterw) + +static struct BurnDIPInfo PbobbleDIPList[]= +{ + {0x29, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x29, 0x01, 0x80, 0x80, "Off" }, + {0x29, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Pbobble) + +static struct BurnDIPInfo QzshowbyDIPList[]= +{ + {0x1d, 0xff, 0xff, 0x80, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode " }, + {0x1d, 0x01, 0x80, 0x80, "Off" }, + {0x1d, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Qzshowby) + +static struct BurnDIPInfo SpacedxoDIPList[]= +{ + {0x29, 0xff, 0xff, 0xfe, NULL }, + {0x2a, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x29, 0x01, 0x01, 0x00, "Upright" }, + {0x29, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x29, 0x01, 0x02, 0x02, "Off" }, + {0x29, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x29, 0x01, 0x04, 0x04, "Off" }, + {0x29, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x29, 0x01, 0x08, 0x00, "Off" }, + {0x29, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x29, 0x01, 0x30, 0x00, "3 Coins 1 Credits" }, + {0x29, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x29, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x29, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x29, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, + {0x29, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x29, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x29, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x2a, 0x01, 0x03, 0x02, "Easy" }, + {0x2a, 0x01, 0x03, 0x03, "Medium" }, + {0x2a, 0x01, 0x03, 0x01, "Hard" }, + {0x2a, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Match Point" }, + {0x2a, 0x01, 0x0c, 0x08, "4" }, + {0x2a, 0x01, 0x0c, 0x0c, "3" }, + {0x2a, 0x01, 0x0c, 0x04, "5" }, + {0x2a, 0x01, 0x0c, 0x00, "2" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x2a, 0x01, 0x30, 0x30, "3" }, + {0x2a, 0x01, 0x30, 0x20, "4" }, + {0x2a, 0x01, 0x30, 0x10, "5" }, + {0x2a, 0x01, 0x30, 0x00, "6" }, + + {0 , 0xfe, 0 , 2, "Bonus Life" }, + {0x2a, 0x01, 0x40, 0x40, "1500 Points" }, + {0x2a, 0x01, 0x40, 0x00, "1000 Points" }, + + {0 , 0xfe, 0 , 2, "Game Type" }, + {0x2a, 0x01, 0x80, 0x80, "Double Company" }, + {0x2a, 0x01, 0x80, 0x00, "Single Company" }, +}; + +STDDIPINFO(Spacedxo) + +static struct BurnDIPInfo SelfeenaDIPList[]= +{ + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 0, "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 0, "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x0c, "100k only" }, + {0x16, 0x01, 0x0c, 0x08, "200k only" }, + {0x16, 0x01, 0x0c, 0x04, "300k only" }, + {0x16, 0x01, 0x0c, 0x00, "400k only" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x30, 0x00, "1" }, + {0x16, 0x01, 0x30, 0x10, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x20, "4" }, +}; + +STDDIPINFO(Selfeena) + +static struct BurnDIPInfo RyujinDIPList[]= +{ + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x0c, 0x00, "1" }, + {0x16, 0x01, 0x0c, 0x04, "2" }, + {0x16, 0x01, 0x0c, 0x0c, "3" }, + {0x16, 0x01, 0x0c, 0x08, "4" }, +}; + +STDDIPINFO(Ryujin) + +static struct BurnDIPInfo SbmDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xfc, NULL }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coinage" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Sbm) + +static struct BurnDIPInfo SilentdDIPList[]= +{ + {0x27, 0xff, 0xff, 0xff, NULL }, + {0x28, 0xff, 0xff, 0xbf, NULL }, + + {0 , 0xfe, 0 , 0, "Flip Screen" }, + {0x27, 0x01, 0x02, 0x02, "Off" }, + {0x27, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 0, "Service Mode" }, + {0x27, 0x01, 0x04, 0x04, "Off" }, + {0x27, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x27, 0x01, 0x08, 0x00, "Off" }, + {0x27, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x27, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x27, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x27, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x27, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 2, "Difficulty" }, + {0x28, 0x01, 0x03, 0x02, "Easy" }, + {0x28, 0x01, 0x03, 0x03, "Medium" }, + {0x28, 0x01, 0x03, 0x01, "Hard" }, + {0x28, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Invulnerability" }, + {0x28, 0x01, 0x04, 0x04, "Off" }, + {0x28, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Power-Up Bonus" }, + {0x28, 0x01, 0x08, 0x08, "Off" }, + {0x28, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Regain Power" }, + {0x28, 0x01, 0x10, 0x10, "Off" }, + {0x28, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Credits" }, + {0x28, 0x01, 0x20, 0x20, "Combined" }, + {0x28, 0x01, 0x20, 0x00, "Separate" }, + + {0 , 0xfe, 0 , 2, "Cabinet Style" }, + {0x28, 0x01, 0xc0, 0xc0, "3 Players" }, + {0x28, 0x01, 0xc0, 0x80, "2 Players" }, + {0x28, 0x01, 0xc0, 0x40, "4 Players/1 Machine" }, + {0x28, 0x01, 0xc0, 0x00, "4 Players/2 Machines" }, +}; + +STDDIPINFO(Silentd) + +static struct BurnDIPInfo SilentdjDIPList[]= +{ + {0x27, 0xff, 0xff, 0xff, NULL }, + {0x28, 0xff, 0xff, 0xbf, NULL }, + + {0 , 0xfe, 0 , 0, "Flip Screen" }, + {0x27, 0x01, 0x02, 0x02, "Off" }, + {0x27, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 0, "Service Mode" }, + {0x27, 0x01, 0x04, 0x04, "Off" }, + {0x27, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x27, 0x01, 0x08, 0x00, "Off" }, + {0x27, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Coin A" }, + {0x27, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x27, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x27, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x27, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x27, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x27, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x27, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x27, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x28, 0x01, 0x03, 0x02, "Easy" }, + {0x28, 0x01, 0x03, 0x03, "Medium" }, + {0x28, 0x01, 0x03, 0x01, "Hard" }, + {0x28, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Invulnerability" }, + {0x28, 0x01, 0x04, 0x04, "Off" }, + {0x28, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Power-Up Bonus" }, + {0x28, 0x01, 0x08, 0x08, "Off" }, + {0x28, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Regain Power" }, + {0x28, 0x01, 0x10, 0x10, "Off" }, + {0x28, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Credits" }, + {0x28, 0x01, 0x20, 0x20, "Combined" }, + {0x28, 0x01, 0x20, 0x00, "Separate" }, + + {0 , 0xfe, 0 , 2, "Cabinet Style" }, + {0x28, 0x01, 0xc0, 0xc0, "3 Players" }, + {0x28, 0x01, 0xc0, 0x80, "2 Players" }, + {0x28, 0x01, 0xc0, 0x40, "4 Players/1 Machine" }, + {0x28, 0x01, 0xc0, 0x00, "4 Players/2 Machines" }, +}; + +STDDIPINFO(Silentdj) + +static struct BurnDIPInfo ViofightDIPList[]= +{ + {0x14, 0xff, 0xff, 0xff, NULL }, + {0x15, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 0, "Flip Screen" }, + {0x14, 0x01, 0x02, 0x02, "Off" }, + {0x14, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x14, 0x01, 0x04, 0x04, "Off" }, + {0x14, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x14, 0x01, 0x08, 0x00, "Off" }, + {0x14, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Coin A" }, + {0x14, 0x01, 0x30, 0x00, "4 Coins 1 Credits" }, + {0x14, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x14, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x14, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x14, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x14, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x14, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x15, 0x01, 0x03, 0x02, "Easy" }, + {0x15, 0x01, 0x03, 0x03, "Medium" }, + {0x15, 0x01, 0x03, 0x01, "Hard" }, + {0x15, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Viofight) + +static struct BurnDIPInfo HiticeDIPList[]= +{ + {0x25, 0xff, 0xff, 0xff, NULL }, + {0x26, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet Style" }, + {0x25, 0x01, 0x01, 0x01, "4 Players" }, + {0x25, 0x01, 0x01, 0x00, "2 Players" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x25, 0x01, 0x04, 0x04, "Off" }, + {0x25, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x25, 0x01, 0x08, 0x00, "Off" }, + {0x25, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x25, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x25, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + {0x25, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x25, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x25, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x25, 0x01, 0xc0, 0xc0, "1 Coin 1 Credits" }, + {0x25, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x25, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x26, 0x01, 0x03, 0x02, "Easy" }, + {0x26, 0x01, 0x03, 0x03, "Medium" }, + {0x26, 0x01, 0x03, 0x01, "Hard" }, + {0x26, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Timer count" }, + {0x26, 0x01, 0x0c, 0x0c, "1 sec = 58/60" }, + {0x26, 0x01, 0x0c, 0x04, "1 sec = 56/60" }, + {0x26, 0x01, 0x0c, 0x08, "1 sec = 62/60" }, + {0x26, 0x01, 0x0c, 0x00, "1 sec = 45/60" }, + + {0 , 0xfe, 0 , 2, "Maximum credits" }, + {0x26, 0x01, 0x80, 0x00, "99" }, + {0x26, 0x01, 0x80, 0x80, "9" }, +}; + +STDDIPINFO(Hitice) + +static struct BurnDIPInfo Rambo3uDIPList[]= +{ + {0x17, 0xff, 0xff, 0xff, NULL }, + {0x18, 0xff, 0xff, 0xff, NULL }, + + {0 , 0xfe, 0 , 0, "Flip Screen" }, + {0x17, 0x01, 0x02, 0x02, "Off" }, + {0x17, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x17, 0x01, 0x04, 0x04, "Off" }, + {0x17, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x17, 0x01, 0x08, 0x00, "Off" }, + {0x17, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 2, "Coinage" }, + {0x17, 0x01, 0x30, 0x10, "3 Coins 1 Credits" }, + {0x17, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x17, 0x01, 0x30, 0x00, "4 Coins 3 Credits" }, + {0x17, 0x01, 0x30, 0x30, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Price to Continue" }, + {0x17, 0x01, 0xc0, 0x40, "2 Coins 1 Credits" }, + {0x17, 0x01, 0xc0, 0x80, "1 Coin 1 Credits" }, + {0x17, 0x01, 0xc0, 0xc0, "Same as Start" }, + {0x17, 0x01, 0xc0, 0x00, "Same as Start or 1C/1C (if Coinage 4C/3C)" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x18, 0x01, 0x03, 0x02, "Easy" }, + {0x18, 0x01, 0x03, 0x03, "Medium" }, + {0x18, 0x01, 0x03, 0x01, "Hard" }, + {0x18, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 1, "Control" }, + {0x18, 0x01, 0x08, 0x08, "8 way Joystick" }, +// {0x18, 0x01, 0x08, 0x00, "Trackball" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x18, 0x01, 0x10, 0x00, "Off" }, + {0x18, 0x01, 0x10, 0x10, "On" }, +}; + +STDDIPINFO(Rambo3u) + +static const eeprom_interface taitob_eeprom_intf = +{ + 6, // address bits + 16, // data bits + "0110", // read command + "0101", // write command + "0111", // erase command + "0100000000", // lock command + "0100110000", // unlock command + 0, + 0 +}; + +static void bankswitch(UINT32, UINT32 data) +{ + TaitoZ80Bank = data & 0x03; + + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + TaitoZ80Bank * 0x4000); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + TaitoZ80Bank * 0x4000); +} + +void __fastcall taitob_sound_write_ym2610(UINT16 a, UINT8 d) +{ + switch (a) + { + case 0xe000: + case 0xe001: + case 0xe002: + case 0xe003: + BurnYM2610Write(a & 3, d); + return; + + case 0xe200: + TC0140SYTSlavePortWrite(d); + return; + + case 0xe201: + TC0140SYTSlaveCommWrite(d); + return; + + case 0xf200: + bankswitch(0, d); + return; + } +} + +UINT8 __fastcall taitob_sound_read_ym2610(UINT16 a) +{ + switch (a) + { + case 0xe000: + case 0xe001: + case 0xe002: + case 0xe003: + return BurnYM2610Read(a & 3); + + case 0xe201: + return TC0140SYTSlaveCommRead(); + } + + return 0; +} + +void __fastcall taitob_sound_write_ym2203(UINT16 a, UINT8 d) +{ + switch (a) + { + case 0x9000: + case 0x9001: + BurnYM2203Write(0, a & 1, d); + return; + + case 0xb000: + case 0xb001: + MSM6295Command(0, d); + return; + + case 0xa000: + TC0140SYTSlavePortWrite(d); + return; + + case 0xa001: + TC0140SYTSlaveCommWrite(d); + return; + } +} + +UINT8 __fastcall taitob_sound_read_ym2203(UINT16 a) +{ + switch (a) + { + case 0x9000: + case 0x9001: + return BurnYM2203Read(0, a & 1); + + case 0xb000: + case 0xb001: + return MSM6295ReadStatus(0); + + case 0xa001: + return TC0140SYTSlaveCommRead(); + } + + return 0; +} + +static void DrvMakeInputs() +{ + memset (TC0220IOCInput, 0xff, 3); + memset (TaitoInput + 3, 0xff, 3); + + for (INT32 i = 0; i < 8; i++) { + TC0220IOCInput[0] ^= (TC0220IOCInputPort0[i] & 1) << i; + TC0220IOCInput[1] ^= (TC0220IOCInputPort1[i] & 1) << i; + TC0220IOCInput[2] ^= (TC0220IOCInputPort2[i] & 1) << i; + TaitoInput[3] ^= (TaitoInputPort3[i] & 1) << i; + TaitoInput[4] ^= (TaitoInputPort4[i] & 1) << i; + TaitoInput[5] ^= (TaitoInputPort5[i] & 1) << i; + } + + // normal coin state is active low, but some games have + // active high buttons or coin inputs + TC0220IOCInput[0] ^= nTaitoInputConfig[0]; + TC0220IOCInput[1] ^= nTaitoInputConfig[1]; + TC0220IOCInput[2] ^= nTaitoInputConfig[2]; + TaitoInput[3] ^= nTaitoInputConfig[3]; + + // set up coin lockout + switch (nTaitoInputConfig[4]) { + case 0: // viofight, sbm, common + if (TaitoCoinLockout[0]) TC0220IOCInput[2] |= (1 << 2); + if (TaitoCoinLockout[1]) TC0220IOCInput[2] |= (1 << 3); + break; + + case 1: // rambo3a, hitice, selfeena + if (TaitoCoinLockout[0]) TC0220IOCInput[1] |= (1 << 4); + if (TaitoCoinLockout[1]) TC0220IOCInput[1] |= (1 << 5); + break; + + case 2: // silentd, spacedxo + if (TaitoCoinLockout[0]) TC0220IOCInput[1] |= (1 << 4); + if (TaitoCoinLockout[1]) TC0220IOCInput[1] |= (1 << 5); + if (TaitoCoinLockout[2]) TaitoInput[5] |= (1 << 0); + if (TaitoCoinLockout[3]) TaitoInput[5] |= (1 << 2); + break; + + case 3: // qzshowby, pbobble + if (TaitoCoinLockout[0]) TC0220IOCInput[0] |= (1 << 4); + if (TaitoCoinLockout[1]) TC0220IOCInput[0] |= (1 << 5); + if (TaitoCoinLockout[2]) TC0220IOCInput[0] |= (1 << 6); + if (TaitoCoinLockout[3]) TC0220IOCInput[0] |= (1 << 7); + break; + } + + // for rambo3a's trackball + if (nBurnGunNumPlayers) BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); + if (nBurnGunNumPlayers) BurnGunMakeInputs(1, (INT16)TaitoAnalogPort2, (INT16)TaitoAnalogPort3); +} + +static void DrvFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / cpu_speed[1]; +} + +static double DrvGetTime() +{ + return (double)ZetTotalCycles() / (cpu_speed[1] * 1.0); +} + +static INT32 DrvDoReset(INT32 reset_ram) +{ + if (reset_ram) { + memset (TaitoRamStart, 0, TaitoRamEnd - TaitoRamStart); + } + + if (DrvFramebuffer) { + memset (DrvFramebuffer, 0, 1024 * 512); + } + + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + if (sound_config == 0) { + BurnYM2610Reset(); + } else { + ZetOpen(0); + BurnYM2203Reset(); + ZetClose(); + MSM6295Reset(0); + } + + TaitoICReset(); + + EEPROMReset(); + + coin_control = 0; + eeprom_latch = 0; + TaitoZ80Bank = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += ((Taito68KRom1Size - 1) | 0x7ffff) + 1; + TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; + + TaitoChars = Next; Next += (TaitoCharRomSize * 8) / 4; + TaitoSpritesA = Next; Next += (TaitoCharRomSize * 8) / 4; + + TaitoMSM6295Rom = Next; Next += TaitoMSM6295RomSize; + TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; + TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; + + if (!(TaitoMSM6295RomSize | TaitoYM2610ARomSize | TaitoYM2610ARomSize)) { + Next += 0x040000; // games without samples... + } + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x010000; + TaitoPaletteRam = Next; Next += 0x002000; + TaitoSpriteRam = Next; Next += 0x002000; + + // hit the ice + DrvPxlRAM = Next; Next += 0x080000; + DrvPxlScroll = (UINT16*)Next; Next += 2 * sizeof(UINT16); + + TaitoZ80Ram1 = Next; Next += 0x002000; + + TaitoRamEnd = Next; + + TaitoPalette = (UINT32*)Next; Next += 0x1000 * sizeof(UINT32); + + TaitoMemEnd = Next; + + return 0; +} + +static void DrvGfxDecode(INT32 len, INT32 *tilemask0, INT32 *tilemask1) +{ + if (len == 0) return; // tetrist + + INT32 Planes[4] = { 0, 8, (len * 8) / 2 + 0, (len * 8) / 2 + 8 }; + INT32 XOffs[16] = { 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087 }; + INT32 YOffs[16] = { 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, 0x100, 0x110, 0x120, 0x130, 0x140, 0x150, 0x160, 0x170 }; + + UINT8 *tmp = (UINT8*)BurnMalloc(len); + if (tmp == NULL) { + return; + } + + memcpy (tmp, TaitoChars, len); + + GfxDecode(((len * 8) / 4) / ( 8 * 8), 4, 8, 8, Planes, XOffs, YOffs, 0x080, tmp, TaitoChars); + GfxDecode(((len * 8) / 4) / (16 * 16), 4, 16, 16, Planes, XOffs, YOffs, 0x200, tmp, TaitoSpritesA); + + *tilemask0 = (((len * 8) / 4) / ( 8 * 8)) - 1; + *tilemask1 = (((len * 8) / 4) / (16 * 16)) - 1; + + BurnFree (tmp); +} + +static void common_ym2610_init() +{ + sound_config = 0; + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1); + ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1); + ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1); + ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1); + ZetSetWriteHandler(taitob_sound_write_ym2610); + ZetSetReadHandler(taitob_sound_read_ym2610); + ZetClose(); + + TC0140SYTInit(); + + INT32 len0 = TaitoYM2610ARomSize; + INT32 len1 = TaitoYM2610BRomSize; + + BurnYM2610Init(8000000, TaitoYM2610ARom, &len0, TaitoYM2610BRom, &len1, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnTimerAttachZet(cpu_speed[1]); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); +} + +static void common_ym2203_init() +{ + sound_config = 1; + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1); + ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1); + ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1); + ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1); + ZetSetWriteHandler(taitob_sound_write_ym2203); + ZetSetReadHandler(taitob_sound_read_ym2203); + ZetClose(); + + TC0140SYTInit(); + + BurnYM2203Init(1, 3000000, DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnYM2203SetPorts(0, NULL, NULL, &bankswitch, NULL); + BurnTimerAttachZet(cpu_speed[1]); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.80, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.25, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.25, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.25, BURN_SND_ROUTE_BOTH); + + MSM6295ROM = TaitoMSM6295Rom; + + MSM6295Init(0, 1056000 / 132, 1); + MSM6295SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH); +} + +static INT32 CommonInit(void (*pInitCallback)(), INT32 sound_type, INT32 color_select, INT32 input_type, INT32 irq0, INT32 irq1) +{ + static const UINT8 color_types[3][4] = { + { 0xc0, 0x80, 0x00, 0x40 }, + { 0x00, 0x40, 0xc0, 0x80 }, + { 0x30, 0x20, 0x00, 0x10 } + }; + + TaitoLoadRoms(false); + + TaitoMem = NULL; + MemIndex(); + INT32 nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(true)) return 1; + + INT32 tilemaskChars = 0, tilemaskSprites = 0; + DrvGfxDecode(TaitoCharRomSize, &tilemaskChars, &tilemaskSprites); + + memcpy (color_config, color_types[color_select], 4); + + irq_config[0] = irq0; + irq_config[1] = irq1; + + cpu_speed[0] = 12000000; + cpu_speed[1] = 4000000; + + nTaitoInputConfig[4] = input_type; + + TC0220IOCInit(); + TaitoMakeInputsFunction = DrvMakeInputs; + + TC0180VCUInit(TaitoChars, tilemaskChars, TaitoSpritesA, tilemaskSprites, 0, 16); + + EEPROMInit(&taitob_eeprom_intf); + + if (pInitCallback) { + pInitCallback(); + } + + if (sound_type) { + common_ym2203_init(); + } else { + common_ym2610_init(); + } + + GenericTilesInit(); + + DrvDoReset(1); + + return 0; +} + +static INT32 DrvExit() +{ + EEPROMExit(); + + SekExit(); + ZetExit(); + + if (sound_config == 0) { + BurnYM2610Exit(); + } else { + BurnYM2203Exit(); + MSM6295Exit(0); + MSM6295ROM = NULL; + } + + BurnFree (DrvFramebuffer); + + memset (nTaitoInputConfig, 0, 5); + + TaitoExit(); + + return 0; +} + +static void DrvPaletteUpdate() +{ + UINT16 *p = (UINT16*)TaitoPaletteRam; + + for (INT32 i = 0; i < 0x2000 / 2; i++) + { + INT32 r = (p[i] >> 12) & 0x0f; + INT32 g = (p[i] >> 8) & 0x0f; + INT32 b = (p[i] >> 4) & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + TaitoPalette[i] = BurnHighCol(r, g, b, 0); + } +} + +static void draw_hitice_framebuffer() +{ + if (DrvFramebuffer == NULL) return; + + INT32 scrollx = -((2 * DrvPxlScroll[0] + 0) & 0x3ff); + INT32 scrolly = -((1 * DrvPxlScroll[1] + 16) & 0x1ff); + + for (INT32 sy = 0; sy < nScreenHeight; sy++) + { + UINT16 *dst = pTransDraw + sy * nScreenWidth; + UINT8 *src = DrvFramebuffer + ((sy + scrolly) & 0x1ff) * 1024; + + for (INT32 sx = 0; sx < nScreenWidth; sx++) { + INT32 pxl = src[(sx + scrollx) & 0x3ff]; + + if (pxl) { + dst[sx] = pxl | 0x800; + } + } + } +} + +static INT32 DrvDraw() +{ + DrvPaletteUpdate(); + + INT32 ctrl = TC0180VCUReadControl(); + + if (~ctrl & 0x20) { + BurnTransferClear(); + BurnTransferCopy(TaitoPalette); + return 0; + } + + if (~nBurnLayer & 1) BurnTransferClear(); + + if (nBurnLayer & 1) TC0180VCUDrawLayer(color_config[0], 1, -1); + + if (nSpriteEnable & 1) TC0180VCUFramebufferDraw(1, color_config[3] << 4); + + if (nBurnLayer & 2) TC0180VCUDrawLayer(color_config[1], 0, 0); + + draw_hitice_framebuffer(); + + if (nSpriteEnable & 2) TC0180VCUFramebufferDraw(0, color_config[3] << 4); + + if (nBurnLayer & 4) TC0180VCUDrawCharLayer(color_config[2]); + + BurnTransferCopy(TaitoPalette); + + TC0180VCUBufferSprites(); + + return 0; +} + +static INT32 DrvFrame() +{ + if (TaitoReset) { + DrvDoReset(1); + } + + SekNewFrame(); + ZetNewFrame(); + + TaitoWatchdog++; + if (TaitoWatchdog > 180) { + DrvDoReset(0); +// bprintf (0, _T("watchdog triggered!\n")); + } + + TaitoMakeInputsFunction(); + + SekOpen(0); + ZetOpen(0); + + INT32 SekSpeed = (INT32)((INT64)cpu_speed[0] * nBurnCPUSpeedAdjust / 0x100); + INT32 ZetSpeed = (INT32)((INT64)cpu_speed[1] * nBurnCPUSpeedAdjust / 0x100); + + INT32 nInterleave = 200; // high so that ym2203 sounds are good, 200 is perfect for irq #0 + INT32 nCyclesTotal[2] = { SekSpeed / 60, ZetSpeed / 60 }; + INT32 nCyclesDone[2] = { 0, 0 }; + INT32 nNext[2] = { 0, 0 }; + + for (INT32 i = 0; i < nInterleave; i++) { + nNext[0] += nCyclesTotal[0] / nInterleave; + nCyclesDone[0] += SekRun(nNext[0] - nCyclesDone[0]); + if (i == 4) SekSetIRQLine(irq_config[0], SEK_IRQSTATUS_AUTO); // Start of frame + 5000 cycles + if (i == (nInterleave / 1) - 1) SekSetIRQLine(irq_config[1], SEK_IRQSTATUS_AUTO); // End of frame + nNext[1] += nCyclesTotal[1] / nInterleave; + BurnTimerUpdate(nNext[1]); + nCyclesDone[1] += nNext[1]; + } + + BurnTimerEndFrame(nCyclesTotal[1]); + + if (pBurnSoundOut) { + if (sound_config == 0) { + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + } else { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + } + + ZetClose(); + SekClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029708; + } + + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + + ba.Data = TaitoRamStart; + ba.nLen = TaitoRamEnd - TaitoRamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + TaitoICScan(nAction); + + if (sound_config == 0) { + BurnYM2610Scan(nAction, pnMin); + } else { + BurnYM2203Scan(nAction, pnMin); + MSM6295Scan(0, nAction); + } + + SCAN_VAR(TaitoZ80Bank); + SCAN_VAR(TaitoWatchdog); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + bankswitch(0, TaitoZ80Bank); + ZetClose(); + } + + return 0; +} + + +//---------------------------------------------------------------------------------------------------------- +// Rastan Saga 2 / Ashura Blaster + +UINT8 __fastcall rastsag2_read_byte(UINT32 a) +{ + TC0180VCUHalfWordRead_Map(0x400000) + TC0220IOCHalfWordRead_Map(0xa00000) + + switch (a) + { + case 0x800002: + return TC0140SYTCommRead(); + } + + return 0; +} + +void __fastcall rastsag2_write_byte(UINT32 a, UINT8 d) +{ + TC0180VCUHalfWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0xa00000) + + switch (a) + { + case 0x800000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0x800002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + } +} + +void __fastcall rastsag2_write_word(UINT32 a, UINT16 d) +{ + TC0180VCUWordWrite_Map(0x400000) +} + +static void NastarInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(TaitoPaletteRam, 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); + SekMapMemory(Taito68KRam1, 0x600000, 0x607fff, SM_RAM); + SekSetWriteByteHandler(0, rastsag2_write_byte); + SekSetWriteWordHandler(0, rastsag2_write_word); + SekSetReadByteHandler(0, rastsag2_read_byte); +// SekSetReadWordHandler(0, rastsag2_read_word); + SekClose(); +} + +//---------------------------------------------------------------------------------------------------------- +// Crime City + +UINT8 __fastcall crimec_read_byte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x200000) + TC0180VCUHalfWordRead_Map(0x400000) + + switch (a) + { + case 0x600002: + return TC0140SYTCommRead(); + } + + return 0; +} + +void __fastcall crimec_write_byte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x200000) + TC0180VCUHalfWordWrite_Map(0x400000) + + switch (a) + { + case 0x600000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0x600002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + } +} + +void __fastcall crimec_write_word(UINT32 a, UINT16 d) +{ + TC0180VCUWordWrite_Map(0x400000) +} + +static void CrimecInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); + SekMapMemory(TaitoPaletteRam, 0x800000, 0x801fff, SM_RAM); + SekMapMemory(Taito68KRam1, 0xa00000, 0xa0ffff, SM_RAM); + SekSetWriteByteHandler(0, crimec_write_byte); + SekSetWriteWordHandler(0, crimec_write_word); + SekSetReadByteHandler(0, crimec_read_byte); +// SekSetReadWordHandler(0, crimec_read_word); + SekClose(); +} + +//---------------------------------------------------------------------------------------------------------- +// Tetris (ym2610) + +UINT8 __fastcall tetrist_read_byte(UINT32 a) +{ + TC0180VCUHalfWordRead_Map(0x400000) + TC0220IOCHalfWordRead_Map(0x600000) + + switch (a) + { + case 0x200002: // not used? + return TC0140SYTCommRead(); + + case 0x600010: { // tracky1_lo_r + INT32 ret = (( TaitoAnalogPort1 >> 4) & 0xffff); + if (ret == 0xffff) return 0; + return (ret+1); + } + + case 0x600014: {// trackx1_lo_r + INT32 ret = ((~TaitoAnalogPort0 >> 4) & 0xffff); + if (ret == 0xffff) return 0; + return (ret+1); + } + + case 0x600018: {// tracky2_lo_r + INT32 ret = (( TaitoAnalogPort3 >> 4) & 0xffff); + if (ret == 0xffff) return 0; + return (ret+1); + } + + case 0x60001c: {// trackx2_lo_r + INT32 ret = ((~TaitoAnalogPort2 >> 4) & 0xffff); + if (ret == 0xffff) return 0; + return (ret+1); + } + } + + return 0; +} + +UINT16 __fastcall tetrist_read_word(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x600000) + + switch (a) + { + case 0x600012: {// tracky1_hi_r + INT32 ret = (( TaitoAnalogPort1 >> 4) & 0xffff); + if (ret == 0xffff) return 0; + return (ret+1); + } + + case 0x600016: {// trackx1_hi_r + INT32 ret = ((~TaitoAnalogPort0 >> 4) & 0xffff); + if (ret == 0xffff) return 0; + return (ret+1); + } + + case 0x60001a: {// tracky2_hi_r + INT32 ret = (( TaitoAnalogPort3 >> 4) & 0xffff); + if (ret == 0xffff) return 0; + return (ret+1); + } + + case 0x60001e: {// trackx2_hi_r + INT32 ret = ((~TaitoAnalogPort2 >> 4) & 0xffff); + if (ret == 0xffff) return 0; + return (ret+1); + } + } + + return 0; +} + +void __fastcall tetrist_write_byte(UINT32 a, UINT8 d) +{ + TC0180VCUHalfWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0x600000) + + switch (a) + { + case 0x200000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0x200002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + } +} + +void __fastcall tetrist_write_word(UINT32 a, UINT16 d) +{ + TC0180VCUWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0x600000) +} + +static void TetristInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); + SekMapMemory(Taito68KRam1, 0x800000, 0x807fff, SM_RAM); + SekMapMemory(TaitoPaletteRam, 0xa00000, 0xa01fff, SM_RAM); + SekSetWriteByteHandler(0, tetrist_write_byte); + SekSetWriteWordHandler(0, tetrist_write_word); + SekSetReadByteHandler(0, tetrist_read_byte); + SekSetReadWordHandler(0, tetrist_read_word); + SekClose(); +} + +//---------------------------------------------------------------------------------------------------------- +// Puzzle Bobble / Space Invaders Dx (v2.1) + +UINT8 __fastcall pbobble_read_byte(UINT32 a) +{ + TC0180VCUHalfWordRead_Map(0x400000) + + switch (a) + { + case 0x500000: + return TC0220IOCDip[0]; + + case 0x500002: + return ((TC0220IOCInput[0] & 0xfe) | (EEPROMRead() & 1)); + + case 0x500004: + return TC0220IOCInput[1]; + + case 0x500006: + return TC0220IOCInput[2]; + + case 0x500008: + return TC0220IOCRead(0x08 / 2); + + case 0x50000e: + return TaitoInput[3]; + + case 0x500024: + return TaitoInput[4]; + + case 0x500026: + return eeprom_latch; + + case 0x50002e: + return TaitoInput[5]; + + case 0x700002: + return TC0140SYTCommRead(); + } + + return 0; +} + +void __fastcall pbobble_write_byte(UINT32 a, UINT8 d) +{ + TC0180VCUHalfWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0x500000) + + switch (a) + { + case 0x500026: + eeprom_latch = d; + EEPROMWrite((d & 0x08), (d & 0x10), (d & 0x04)); + return; + + case 0x500028: + coin_control = d; + TaitoCoinLockout[2] = ~d & 0x01; + TaitoCoinLockout[3] = ~d & 0x02; + // coin counter d & 0x04, d & 0x08 + return; + + case 0x600000: + case 0x600002: // gain + return; + + case 0x700000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0x700002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + } +} + +void __fastcall pbobble_write_word(UINT32 a, UINT16 d) +{ + TC0180VCUWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0x500000) +} + +static void PbobbleInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); + SekMapMemory(TaitoPaletteRam, 0x800000, 0x801fff, SM_RAM); + SekMapMemory(Taito68KRam1, 0x900000, 0x90ffff, SM_RAM); + SekSetWriteByteHandler(0, pbobble_write_byte); + SekSetWriteWordHandler(0, pbobble_write_word); + SekSetReadByteHandler(0, pbobble_read_byte); +// SekSetReadWordHandler(0, pbobble_read_word); + SekClose(); +} + +//---------------------------------------------------------------------------------------------------------- +// Sel Feena / Ryu Jin + +UINT8 __fastcall selfeena_read_byte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x400000) + TC0220IOCHalfWordRead_Map(0x410000) + + if (a >= 0x218000 && a <= 0x21801f) { + return TC0180VCUReadRegs(a); + } + + switch (a) + { + case 0x500002: // not used? + return TC0140SYTCommRead(); + } + + return 0; +} + +void __fastcall selfeena_write_byte(UINT32 a, UINT8 d) +{ + TC0180VCUHalfWordWrite_Map(0x200000) + TC0220IOCHalfWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0x410000) + + switch (a) + { + case 0x500000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0x500002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + } +} + +void __fastcall selfeena_write_word(UINT32 a, UINT16 d) +{ + TC0180VCUWordWrite_Map(0x200000) +} + +static void SelfeenaInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1, 0x100000, 0x103fff, SM_RAM); + SekMapMemory(TC0180VCURAM, 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x210000, 0x2137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x213800, 0x213fff, SM_RAM); + SekMapMemory(TaitoPaletteRam, 0x300000, 0x301fff, SM_RAM); + SekSetWriteByteHandler(0, selfeena_write_byte); + SekSetWriteWordHandler(0, selfeena_write_word); + SekSetReadByteHandler(0, selfeena_read_byte); +// SekSetReadWordHandler(0, selfeena_read_word); + SekClose(); +} + +//---------------------------------------------------------------------------------------------------------- +// Sonic Blast Man + +UINT8 __fastcall sbm_read_byte(UINT32 a) +{ + if ((a & 0xffffff0) == 0x300000) a ^= 2; + TC0220IOCHalfWordRead_Map(0x300000) + TC0180VCUHalfWordRead_Map(0x900000) + + switch (a) + { + case 0x320002: + return TC0140SYTCommRead(); + } + + return 0; +} + +void __fastcall sbm_write_byte(UINT32 a, UINT8 d) +{ + if ((a & 0xffffff0) == 0x300000) a ^= 2; + TC0220IOCHalfWordWrite_Map(0x300000) + TC0180VCUHalfWordWrite_Map(0x900000) + + switch (a) + { + case 0x320000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0x320002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + } +} + +void __fastcall sbm_write_word(UINT32 a, UINT16 d) +{ + if ((a & 0xffffff0) == 0x0300000) a ^= 2; + TC0220IOCHalfWordWrite_Map(0x300000) + TC0180VCUWordWrite_Map(0x900000) +} + +static void SbmInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1, 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam, 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0180VCURAM, 0x900000, 0x90ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x910000, 0x9137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x913800, 0x913fff, SM_RAM); + SekSetWriteByteHandler(0, sbm_write_byte); + SekSetWriteWordHandler(0, sbm_write_word); + SekSetReadByteHandler(0, sbm_read_byte); +// SekSetReadWordHandler(0, sbm_read_word); + SekClose(); +} + +//---------------------------------------------------------------------------------------------------------- +// Silent Dragon + +UINT8 __fastcall silentd_read_byte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x200000) + TC0180VCUHalfWordRead_Map(0x500000) + + switch (a) + { + case 0x100003: // not used? + return TC0140SYTCommRead(); + + case 0x210001: + return TaitoInput[3]; + + case 0x220001: + return TaitoInput[4]; + + case 0x230001: + return TaitoInput[5]; + } + + return 0; +} + +void __fastcall silentd_write_byte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x200000) + TC0180VCUHalfWordWrite_Map(0x500000) + + switch (a) + { + case 0x100000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0x100002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + } +} + +void __fastcall silentd_write_word(UINT32 a, UINT16 d) +{ + TC0180VCUWordWrite_Map(0x500000) +} + +static void SilentdInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(TaitoPaletteRam, 0x300000, 0x301fff, SM_RAM); + SekMapMemory(Taito68KRam1, 0x400000, 0x403fff, SM_RAM); + SekMapMemory(TC0180VCURAM, 0x500000, 0x50ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x510000, 0x5137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x513800, 0x513fff, SM_RAM); + SekSetWriteByteHandler(0, silentd_write_byte); + SekSetWriteWordHandler(0, silentd_write_word); + SekSetReadByteHandler(0, silentd_read_byte); +// SekSetReadWordHandler(0, silentd_read_word); + SekClose(); +} + +//---------------------------------------------------------------------------------------------------------- +// Violence Fight + +UINT8 __fastcall viofight_read_byte(UINT32 a) +{ + TC0180VCUHalfWordRead_Map(0x400000) + TC0220IOCHalfWordRead_Map(0x800000) + + switch (a) + { + case 0x200002: + return TC0140SYTCommRead(); + } + + return 0; +} + +void __fastcall viofight_write_byte(UINT32 a, UINT8 d) +{ + TC0180VCUHalfWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0x800000) + + switch (a) + { + case 0x200000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0x200002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + } +} + +void __fastcall viofight_write_word(UINT32 a, UINT16 d) +{ + TC0180VCUWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0x800000) +} + +static void ViofightInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); + SekMapMemory(TaitoPaletteRam, 0x600000, 0x601fff, SM_RAM); + SekMapMemory(Taito68KRam1, 0xa00000, 0xa03fff, SM_RAM); + SekSetWriteByteHandler(0, viofight_write_byte); + SekSetWriteWordHandler(0, viofight_write_word); + SekSetReadByteHandler(0, viofight_read_byte); +// SekSetReadWordHandler(0, viofight_read_word); + SekClose(); + + memcpy (Taito68KRom1 + 0x40000, Taito68KRom1 + 0x20000, 0x40000); + + cpu_speed[1] = 6000000; // 6mhz +} + +//---------------------------------------------------------------------------------------------------------- +// Hit the Ice + +UINT8 __fastcall hitice_read_byte(UINT32 a) +{ + TC0180VCUHalfWordRead_Map(0x400000) + TC0220IOCHalfWordRead_Map(0x600000) + + switch (a) + { + case 0x610000: + return TC0220IOCInput[4]; + + case 0x610001: + return TC0220IOCInput[3]; + + case 0x700002: + return TC0140SYTCommRead(); + } + + return 0; +} + +static void hiticeFramebufferUpdate(UINT32 offset) +{ + offset &= 0x7fffe; + DrvFramebuffer[offset + 0] = DrvPxlRAM[offset]; + DrvFramebuffer[offset + 1] = DrvPxlRAM[offset]; +} + +void __fastcall hitice_write_byte(UINT32 a, UINT8 d) +{ + TC0180VCUHalfWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0x600000) + + if (a >= 0xb00000 && a <= 0xb7ffff) { + DrvPxlRAM[(a & 0x7ffff)^1] = d; + hiticeFramebufferUpdate(a); + return; + } + + switch (a) + { + case 0x700000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0x700002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + } +} + +void __fastcall hitice_write_word(UINT32 a, UINT16 d) +{ + TC0180VCUWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0x600000) + + if (a >= 0xb00000 && a <= 0xb7ffff) { + *((UINT16*)(DrvPxlRAM + (a & 0x7fffe))) = d; + hiticeFramebufferUpdate(a); + return; + } + + switch (a) + { + case 0xbffff2: + DrvPxlScroll[0] = d; + return; + + case 0xbffff4: + DrvPxlScroll[1] = d; + return; + } +} + +static void HiticeInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); + SekMapMemory(Taito68KRam1, 0x800000, 0x803fff, SM_RAM); + SekMapMemory(TaitoPaletteRam, 0xa00000, 0xa01fff, SM_RAM); + SekMapMemory(DrvPxlRAM, 0xb00000, 0xb7ffff, SM_ROM); + SekSetWriteByteHandler(0, hitice_write_byte); + SekSetWriteWordHandler(0, hitice_write_word); + SekSetReadByteHandler(0, hitice_read_byte); +// SekSetReadWordHandler(0, hitice_read_word); + SekClose(); + + DrvFramebuffer = (UINT8*)BurnMalloc(1024 * 512); +} + +//---------------------------------------------------------------------------------------------------------- +// Tetris (ym2203) + +UINT8 __fastcall tetrista_read_byte(UINT32 a) +{ + TC0180VCUHalfWordRead_Map(0x400000) + + switch (a) + { + case 0x600000: + case 0x800000: + return TC0220IOCPortRegRead(); + + case 0x600002: + case 0x800002: + return TC0220IOCPortRead(); + + case 0xa00002: + return TC0140SYTCommRead(); + } + + return 0; +} + +void __fastcall tetrista_write_byte(UINT32 a, UINT8 d) +{ + TC0180VCUHalfWordWrite_Map(0x400000) + + switch (a) + { + case 0x600000: + case 0x800000: + TaitoWatchdog = 0; + TC0220IOCHalfWordPortRegWrite(d); + return; + + case 0x600002: + case 0x800002: + TC0220IOCHalfWordPortWrite(d); + return; + + case 0xa00000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0xa00002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + } +} + +void __fastcall tetrista_write_word(UINT32 a, UINT16 d) +{ + TC0180VCUWordWrite_Map(0x400000) +} + +static void TetristaInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(TaitoPaletteRam, 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); + SekMapMemory(Taito68KRam1, 0x800000, 0x803fff, SM_RAM); + SekSetWriteByteHandler(0, tetrista_write_byte); + SekSetWriteWordHandler(0, tetrista_write_word); + SekSetReadByteHandler(0, tetrista_read_byte); +// SekSetReadWordHandler(0, tetrista_read_word); + SekClose(); +} + +static void MasterwInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1, 0x200000, 0x203fff, SM_RAM); + SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); + SekMapMemory(TaitoPaletteRam, 0x600000, 0x601fff, SM_RAM); + SekSetWriteByteHandler(0, tetrista_write_byte); + SekSetWriteWordHandler(0, tetrista_write_word); + SekSetReadByteHandler(0, tetrista_read_byte); +// SekSetReadWordHandler(0, tetrista_read_word); + SekClose(); +} + +//---------------------------------------------------------------------------------------------------------- +// Quiz Sekai Wa Show by shobai + + +UINT8 __fastcall qzshowby_read_byte(UINT32 a) +{ + if (a != 0x200002) { + TC0220IOCHalfWordRead_Map(0x200000) + } + + TC0180VCUHalfWordRead_Map(0x400000) + + switch (a) + { + case 0x200002: + return ((TC0220IOCInput[0] & 0xfe) | (EEPROMRead() & 1)); + + case 0x200024: + return TC0220IOCInput[4]; + + case 0x200028: + return coin_control; + + case 0x20002e: + return TC0220IOCInput[5]; + + case 0x600002: + return TC0140SYTCommRead(); + } + + return 0; +} + +void __fastcall qzshowby_write_byte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x200000) + TC0180VCUHalfWordWrite_Map(0x400000) + + switch (a) + { + case 0x200026: + EEPROMWrite((d & 0x08), (d & 0x10), (d & 0x04)); + return; + + case 0x200028: + coin_control = d; + TaitoCoinLockout[2] = ~d & 0x01; + TaitoCoinLockout[3] = ~d & 0x02; + // coin counter d & 0x04, d & 0x08 + return; + + case 0x600000: + TC0140SYTPortWrite(d & 0xff); + return; + + case 0x600002: + ZetClose(); + TC0140SYTCommWrite(d & 0xff); + ZetOpen(0); + return; + + case 0x700000: + case 0x700002: + // gain + return; + } +} + +void __fastcall qzshowby_write_word(UINT32 a, UINT16 d) +{ + TC0180VCUWordWrite_Map(0x400000) + TC0220IOCHalfWordWrite_Map(0x200000) +} + +static void QzshowbyInitCallback() +{ + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1, 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(TC0180VCURAM, 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam, 0x410000, 0x4137ff, SM_RAM); + SekMapMemory(TC0180VCUScrollRAM, 0x413800, 0x413fff, SM_RAM); + SekMapMemory(TaitoPaletteRam, 0x800000, 0x801fff, SM_RAM); + SekMapMemory(Taito68KRam1, 0x900000, 0x90ffff, SM_RAM); + SekSetWriteByteHandler(0, qzshowby_write_byte); + SekSetWriteWordHandler(0, qzshowby_write_word); + SekSetReadByteHandler(0, qzshowby_read_byte); +// SekSetReadWordHandler(0, qzshowby_read_word); + SekClose(); +} + +//---------------------------------------------------------------------------------------------------------- + + +// Master of Weapon (World) + +static struct BurnRomInfo masterwRomDesc[] = { + { "b72_06.33", 0x020000, 0xae848eff, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "b72_12.24", 0x020000, 0x7176ce70, TAITO_68KROM1_BYTESWAP }, // 1 + { "b72_04.34", 0x020000, 0x141e964c, TAITO_68KROM1_BYTESWAP }, // 2 + { "b72_03.25", 0x020000, 0xf4523496, TAITO_68KROM1_BYTESWAP }, // 3 + + { "b72_07.30", 0x010000, 0x2b1a946f, TAITO_Z80ROM1 }, // 4 Z80 code + + { "b72-02.rom", 0x080000, 0xc519f65a, TAITO_CHARS }, // 5 Graphics Tiles + { "b72-01.5", 0x080000, 0xa24ac26e, TAITO_CHARS }, // 6 +}; + +STD_ROM_PICK(masterw) +STD_ROM_FN(masterw) + +static INT32 MasterwInit() +{ + return CommonInit(MasterwInitCallback, 1, 2, 0, 4, 5); +} + +struct BurnDriver BurnDrvMasterw = { + "masterw", NULL, NULL, NULL, "1989", + "Master of Weapon (World)\0", "Imperfect graphics", "Taito Corporation Japan", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, + NULL, masterwRomInfo, masterwRomName, NULL, NULL, CommonInputInfo, MasterwDIPInfo, + MasterwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 224, 320, 3, 4 +}; + + +// Master of Weapon (US) + +static struct BurnRomInfo masterwuRomDesc[] = { + { "b72_06.33", 0x020000, 0xae848eff, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "b72_11.24", 0x020000, 0x0671fee6, TAITO_68KROM1_BYTESWAP }, // 1 + { "b72_04.34", 0x020000, 0x141e964c, TAITO_68KROM1_BYTESWAP }, // 2 + { "b72_03.25", 0x020000, 0xf4523496, TAITO_68KROM1_BYTESWAP }, // 3 + + { "b72_07.30", 0x010000, 0x2b1a946f, TAITO_Z80ROM1 }, // 4 Z80 code + + { "b72-02.rom", 0x080000, 0xc519f65a, TAITO_CHARS }, // 5 Graphics Tiles + { "b72-01.5", 0x080000, 0xa24ac26e, TAITO_CHARS }, // 6 +}; + +STD_ROM_PICK(masterwu) +STD_ROM_FN(masterwu) + +struct BurnDriver BurnDrvMasterwu = { + "masterwu", "masterw", NULL, NULL, "1989", + "Master of Weapon (US)\0", "Imperfect graphics", "Taito America Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, + NULL, masterwuRomInfo, masterwuRomName, NULL, NULL, CommonInputInfo, MasterwDIPInfo, + MasterwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 224, 320, 3, 4 +}; + + +// Master of Weapon (Japan) + +static struct BurnRomInfo masterwjRomDesc[] = { + { "b72_06.33", 0x020000, 0xae848eff, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "b72_05.24", 0x020000, 0x9f78af5c, TAITO_68KROM1_BYTESWAP }, // 1 + { "b72_04.34", 0x020000, 0x141e964c, TAITO_68KROM1_BYTESWAP }, // 2 + { "b72_03.25", 0x020000, 0xf4523496, TAITO_68KROM1_BYTESWAP }, // 3 + + { "b72_07.30", 0x010000, 0x2b1a946f, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "b72-02.6", 0x080000, 0x843444eb, TAITO_CHARS }, // 5 Graphics Tiles + { "b72-01.5", 0x080000, 0xa24ac26e, TAITO_CHARS }, // 6 +}; + +STD_ROM_PICK(masterwj) +STD_ROM_FN(masterwj) + +struct BurnDriver BurnDrvMasterwj = { + "masterwj", "masterw", NULL, NULL, "1989", + "Master of Weapon (Japan)\0", "Imperfect graphics", "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, + NULL, masterwjRomInfo, masterwjRomName, NULL, NULL, CommonInputInfo, MasterwDIPInfo, + MasterwInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 224, 320, 3, 4 +}; + + +// Nastar (World) + +static struct BurnRomInfo nastarRomDesc[] = { + { "b81-08.50", 0x020000, 0xd6da9169, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "b81-13.31", 0x020000, 0x60d176fb, TAITO_68KROM1_BYTESWAP }, // 1 + { "b81-10.49", 0x020000, 0x53f34344, TAITO_68KROM1_BYTESWAP }, // 2 + { "b81-09.30", 0x020000, 0x630d34af, TAITO_68KROM1_BYTESWAP }, // 3 + + { "b81-11.37", 0x010000, 0x3704bf09, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "b81-03.14", 0x080000, 0x551b75e6, TAITO_CHARS }, // 5 Graphics Tiles + { "b81-04.15", 0x080000, 0xcf734e12, TAITO_CHARS }, // 6 + + { "b81-02.2", 0x080000, 0x20ec3b86, TAITO_YM2610A }, // 7 YM2610 A Samples + + { "b81-01.1", 0x080000, 0xb33f796b, TAITO_YM2610B }, // 8 YM2610 B Samples + + { "ampal16l8-b81-05.21", 0x000104, 0x922fd368, BRF_OPT }, // 9 PLDs + { "ampal16l8-b81-06a.22", 0x000104, 0xbb1cec84, BRF_OPT }, // 10 +}; + +STD_ROM_PICK(nastar) +STD_ROM_FN(nastar) + +static INT32 NastarInit() +{ + return CommonInit(NastarInitCallback, 0, 0, 0, 2, 4); +} + +struct BurnDriver BurnDrvNastar = { + "nastar", NULL, NULL, NULL, "1988", + "Nastar (World)\0", NULL, "Taito Corporation Japan", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, + NULL, nastarRomInfo, nastarRomName, NULL, NULL, CommonInputInfo, NastarDIPInfo, + NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Rastan Saga 2 (Japan) + +static struct BurnRomInfo rastsag2RomDesc[] = { + { "b81-08.50", 0x020000, 0xd6da9169, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "b81-07.31", 0x020000, 0x8edf17d7, TAITO_68KROM1_BYTESWAP }, // 1 + { "b81-10.49", 0x020000, 0x53f34344, TAITO_68KROM1_BYTESWAP }, // 2 + { "b81-09.30", 0x020000, 0x630d34af, TAITO_68KROM1_BYTESWAP }, // 3 + + { "b81-11.37", 0x010000, 0x3704bf09, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "b81-03.14", 0x080000, 0x551b75e6, TAITO_CHARS }, // 5 Graphics Tiles + { "b81-04.15", 0x080000, 0xcf734e12, TAITO_CHARS }, // 6 + + { "b81-02.2", 0x080000, 0x20ec3b86, TAITO_YM2610A }, // 7 YM2610 A Samples + + { "b81-01.1", 0x080000, 0xb33f796b, TAITO_YM2610B }, // 8 YM2610 B Samples +}; + +STD_ROM_PICK(rastsag2) +STD_ROM_FN(rastsag2) + +struct BurnDriver BurnDrvRastsag2 = { + "rastsag2", "nastar", NULL, NULL, "1988", + "Rastan Saga 2 (Japan)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, + NULL, rastsag2RomInfo, rastsag2RomName, NULL, NULL, CommonInputInfo, Rastsag2DIPInfo, + NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Nastar Warrior (US) + +static struct BurnRomInfo nastarwRomDesc[] = { + { "b81-08.50", 0x020000, 0xd6da9169, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "b81-12.31", 0x020000, 0xf9d82741, TAITO_68KROM1_BYTESWAP }, // 1 + { "b81-10.49", 0x020000, 0x53f34344, TAITO_68KROM1_BYTESWAP }, // 2 + { "b81-09.30", 0x020000, 0x630d34af, TAITO_68KROM1_BYTESWAP }, // 3 + + { "b81-11.37", 0x010000, 0x3704bf09, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "b81-03.14", 0x080000, 0x551b75e6, TAITO_CHARS }, // 5 Graphics Tiles + { "b81-04.15", 0x080000, 0xcf734e12, TAITO_CHARS }, // 6 + + { "b81-02.2", 0x080000, 0x20ec3b86, TAITO_YM2610A }, // 7 YM2610 A Samples + + { "b81-01.1", 0x080000, 0xb33f796b, TAITO_YM2610B }, // 8 YM2610 B Samples +}; + +STD_ROM_PICK(nastarw) +STD_ROM_FN(nastarw) + +struct BurnDriver BurnDrvNastarw = { + "nastarw", "nastar", NULL, NULL, "1988", + "Nastar Warrior (US)\0", NULL, "Taito America Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, + NULL, nastarwRomInfo, nastarwRomName, NULL, NULL, CommonInputInfo, NastarwDIPInfo, + NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Rambo III (Europe set 1) + +static struct BurnRomInfo rambo3RomDesc[] = { + { "ramb3-11.bin", 0x020000, 0x1cc42247, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "ramb3-14.bin", 0x020000, 0x7d917c21, TAITO_68KROM1_BYTESWAP }, // 1 + { "ramb3-07.bin", 0x020000, 0xc973ff6f, TAITO_68KROM1_BYTESWAP }, // 2 + { "ramb3-06.bin", 0x020000, 0xa83d3fd5, TAITO_68KROM1_BYTESWAP }, // 3 + + { "ramb3-10.bin", 0x010000, 0xb18bc020, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "ramb3-03.bin", 0x080000, 0xf5808c41, TAITO_CHARS }, // 5 Graphics Tiles + { "ramb3-04.bin", 0x080000, 0xc57831ce, TAITO_CHARS }, // 6 + { "ramb3-01.bin", 0x080000, 0xc55fcf54, TAITO_CHARS }, // 7 + { "ramb3-02.bin", 0x080000, 0x9dd014c6, TAITO_CHARS }, // 8 + + { "ramb3-05.bin", 0x080000, 0x0179dc40, TAITO_YM2610A }, // 9 YM2610 A Samples +}; + +STD_ROM_PICK(rambo3) +STD_ROM_FN(rambo3) + +static INT32 Rambo3Init() +{ + nTaitoInputConfig[1] = 0x30; + BurnGunInit(2, false); + + return CommonInit(TetristInitCallback, 0, 2, 0, 1, 6); +} + +struct BurnDriver BurnDrvRambo3 = { + "rambo3", NULL, NULL, NULL, "1989", + "Rambo III (Europe)\0", NULL, "Taito Europe Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, + NULL, rambo3RomInfo, rambo3RomName, NULL, NULL, Rambo3uInputInfo, Rambo3uDIPInfo, + Rambo3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Rambo III (US) + +static struct BurnRomInfo rambo3uRomDesc[] = { + { "ramb3-11.bin", 0x020000, 0x1cc42247, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "ramb3-13.bin", 0x020000, 0x0a964cb7, TAITO_68KROM1_BYTESWAP }, // 1 + { "ramb3-07.bin", 0x020000, 0xc973ff6f, TAITO_68KROM1_BYTESWAP }, // 2 + { "ramb3-06.bin", 0x020000, 0xa83d3fd5, TAITO_68KROM1_BYTESWAP }, // 3 + + { "ramb3-10.bin", 0x010000, 0xb18bc020, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "ramb3-03.bin", 0x080000, 0xf5808c41, TAITO_CHARS }, // 5 Graphics Tiles + { "ramb3-04.bin", 0x080000, 0xc57831ce, TAITO_CHARS }, // 6 + { "ramb3-01.bin", 0x080000, 0xc55fcf54, TAITO_CHARS }, // 7 + { "ramb3-02.bin", 0x080000, 0x9dd014c6, TAITO_CHARS }, // 8 + + { "ramb3-05.bin", 0x080000, 0x0179dc40, TAITO_YM2610A }, // 9 YM2610 A Samples +}; + +STD_ROM_PICK(rambo3u) +STD_ROM_FN(rambo3u) + +struct BurnDriver BurnDrvRambo3u = { + "rambo3u", "rambo3", NULL, NULL, "1989", + "Rambo III (US)\0", NULL, "Taito Europe Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, + NULL, rambo3uRomInfo, rambo3uRomName, NULL, NULL, Rambo3uInputInfo, Rambo3uDIPInfo, + Rambo3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Rambo III (Europe, Proto?) + +static struct BurnRomInfo rambo3pRomDesc[] = { + { "r3-0e.rom", 0x010000, 0x3efa4177, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "r3-0o.rom", 0x010000, 0x55c38d92, TAITO_68KROM1_BYTESWAP }, // 1 + { "r3-1e.rom", 0x020000, 0x40e363c7, TAITO_68KROM1_BYTESWAP }, // 2 + { "r3-1o.rom", 0x020000, 0x7f1fe6ab, TAITO_68KROM1_BYTESWAP }, // 3 + + { "r3-00.rom", 0x010000, 0xdf7a6ed6, TAITO_Z80ROM1 }, // 4 Z80 Code + +// This order is different than that of MAME! This allows use of standard gfx decode. + { "r3-ch1ll.rom", 0x020000, 0xc86ea5fc, TAITO_CHARS_BYTESWAP }, // 5 Graphics Tiles + { "r3-ch1lh.rom", 0x020000, 0x75568cf0, TAITO_CHARS_BYTESWAP }, // 6 + { "r3-ch1hl.rom", 0x020000, 0x7525eb92, TAITO_CHARS_BYTESWAP }, // 7 + { "r3-ch1hh.rom", 0x020000, 0xe39cff37, TAITO_CHARS_BYTESWAP }, // 8 + { "r3-ch3ll.rom", 0x020000, 0xabe54b1e, TAITO_CHARS_BYTESWAP }, // 9 + { "r3-ch3lh.rom", 0x020000, 0x5a155c04, TAITO_CHARS_BYTESWAP }, // 10 + { "r3-ch3hl.rom", 0x020000, 0x80e5647e, TAITO_CHARS_BYTESWAP }, // 11 + { "r3-ch3hh.rom", 0x020000, 0xabe58fdb, TAITO_CHARS_BYTESWAP }, // 12 + { "r3-ch0ll.rom", 0x020000, 0xb416f1bf, TAITO_CHARS_BYTESWAP }, // 13 + { "r3-ch0lh.rom", 0x020000, 0x76a330a2, TAITO_CHARS_BYTESWAP }, // 14 + { "r3-ch0hl.rom", 0x020000, 0xa4cad36d, TAITO_CHARS_BYTESWAP }, // 15 + { "r3-ch0hh.rom", 0x020000, 0x4dc69751, TAITO_CHARS_BYTESWAP }, // 16 + { "r3-ch2ll.rom", 0x020000, 0xd0ce3051, TAITO_CHARS_BYTESWAP }, // 17 + { "r3-ch2lh.rom", 0x020000, 0xdf3bc48f, TAITO_CHARS_BYTESWAP }, // 18 + { "r3-ch2hl.rom", 0x020000, 0x837d8677, TAITO_CHARS_BYTESWAP }, // 19 + { "r3-ch2hh.rom", 0x020000, 0xbf37dfac, TAITO_CHARS_BYTESWAP }, // 20 + + { "r3-a1.rom", 0x020000, 0x4396fa19, TAITO_YM2610A }, // 21 YM2610 A Samples + { "r3-a2.rom", 0x020000, 0x41fe53a8, TAITO_YM2610A }, // 22 + { "r3-a3.rom", 0x020000, 0xe89249ba, TAITO_YM2610A }, // 23 + { "r3-a4.rom", 0x020000, 0x9cf4c21b, TAITO_YM2610A }, // 24 +}; + +STD_ROM_PICK(rambo3p) +STD_ROM_FN(rambo3p) + +static INT32 Rambo3pInit() +{ + INT32 nRet = CommonInit(TetristInitCallback, 0, 0, 0, 1, 6); + + if (nRet == 0) { + memmove (Taito68KRom1 + 0x40000, Taito68KRom1 + 0x20000, 0x40000); + } + + return nRet; +} + +struct BurnDriver BurnDrvRambo3p = { + "rambo3p", "rambo3", NULL, NULL, "1989", + "Rambo III (Europe, Proti?)\0", NULL, "Taito Europe Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SHOOT, 0, + NULL, rambo3pRomInfo, rambo3pRomName, NULL, NULL, CommonInputInfo, Rambo3DIPInfo, + Rambo3pInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Crime City (World) + +static struct BurnRomInfo crimecRomDesc[] = { + { "b99-07.40", 0x020000, 0x26e886e6, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "b99-05.29", 0x020000, 0xff7f9a9d, TAITO_68KROM1_BYTESWAP }, // 1 + { "b99-06.39", 0x020000, 0x1f26aa92, TAITO_68KROM1_BYTESWAP }, // 2 + { "b99-14.28", 0x020000, 0x71c8b4d7, TAITO_68KROM1_BYTESWAP }, // 3 + + { "b99-08.45", 0x010000, 0x26135451, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "b99-02.18", 0x080000, 0x2a5d4a26, TAITO_CHARS }, // 5 Graphics Tiles + { "b99-01.19", 0x080000, 0xa19e373a, TAITO_CHARS }, // 6 + + { "b99-03.37", 0x080000, 0xdda10df7, TAITO_YM2610A }, // 7 YM2610 A Samples +}; + +STD_ROM_PICK(crimec) +STD_ROM_FN(crimec) + +static INT32 CrimecInit() +{ + return CommonInit(CrimecInitCallback, 0, 1, 0, 3, 5); +} + +struct BurnDriver BurnDrvCrimec = { + "crimec", NULL, NULL, NULL, "1989", + "Crime City (World)\0", NULL, "Taito Corporation Japan", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_PLATFORM, 0, + NULL, crimecRomInfo, crimecRomName, NULL, NULL, CommonInputInfo, CrimecDIPInfo, + CrimecInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Crime City (US) + +static struct BurnRomInfo crimecuRomDesc[] = { + { "b99-07.40", 0x020000, 0x26e886e6, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "b99-05.29", 0x020000, 0xff7f9a9d, TAITO_68KROM1_BYTESWAP }, // 1 + { "b99-06.39", 0x020000, 0x1f26aa92, TAITO_68KROM1_BYTESWAP }, // 2 + { "b99-13.28", 0x020000, 0x06cf8441, TAITO_68KROM1_BYTESWAP }, // 3 + + { "b99-08.45", 0x010000, 0x26135451, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "b99-02.18", 0x080000, 0x2a5d4a26, TAITO_CHARS }, // 5 Graphics Tiles + { "b99-01.19", 0x080000, 0xa19e373a, TAITO_CHARS }, // 6 + + { "b99-03.37", 0x080000, 0xdda10df7, TAITO_YM2610A }, // 7 YM2610 A Samples +}; + +STD_ROM_PICK(crimecu) +STD_ROM_FN(crimecu) + +struct BurnDriver BurnDrvCrimecu = { + "crimecu", "crimec", NULL, NULL, "1989", + "Crime City (US)\0", NULL, "Taito America Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_PLATFORM, 0, + NULL, crimecuRomInfo, crimecuRomName, NULL, NULL, CommonInputInfo, CrimecuDIPInfo, + CrimecInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Crime City (Japan) + +static struct BurnRomInfo crimecjRomDesc[] = { + { "b99-07.40", 0x020000, 0x26e886e6, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "b99-05.29", 0x020000, 0xff7f9a9d, TAITO_68KROM1_BYTESWAP }, // 1 + { "b99-06.39", 0x020000, 0x1f26aa92, TAITO_68KROM1_BYTESWAP }, // 2 + { "b99-15.28", 0x020000, 0xe8c1e56d, TAITO_68KROM1_BYTESWAP }, // 3 + + { "b99-08.45", 0x010000, 0x26135451, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "b99-02.18", 0x080000, 0x2a5d4a26, TAITO_CHARS }, // 5 Graphics Tiles + { "b99-01.19", 0x080000, 0xa19e373a, TAITO_CHARS }, // 6 + + { "b99-03.37", 0x080000, 0xdda10df7, TAITO_YM2610A }, // 7 YM2610 A Samples +}; + +STD_ROM_PICK(crimecj) +STD_ROM_FN(crimecj) + +struct BurnDriver BurnDrvCrimecj = { + "crimecj", "crimec", NULL, NULL, "1989", + "Crime City (Japan)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_PLATFORM, 0, + NULL, crimecjRomInfo, crimecjRomName, NULL, NULL, CommonInputInfo, CrimecjDIPInfo, + CrimecInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Tetris (Japan, B-System, YM2610) + +static struct BurnRomInfo tetristRomDesc[] = { + { "c12-03.bin", 0x020000, 0x38f1ed41, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c12-02.bin", 0x020000, 0xed9530bc, TAITO_68KROM1_BYTESWAP }, // 1 + { "c12-05.bin", 0x020000, 0x128e9927, TAITO_68KROM1_BYTESWAP }, // 2 + { "c12-04.bin", 0x020000, 0x5da7a319, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c12-06.bin", 0x010000, 0xf2814b38, TAITO_Z80ROM1 }, // 4 Z80 Code +}; + +STD_ROM_PICK(tetrist) +STD_ROM_FN(tetrist) + +static INT32 TetristInit() +{ + return CommonInit(TetristInitCallback, 0, 0, 0, 2, 4); +} + +struct BurnDriver BurnDrvTetrist = { + "tetrist", "tetris", NULL, NULL, "1989", + "Tetris (Japan, B-System, YM2610)\0", NULL, "Sega", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_PUZZLE, 0, + NULL, tetristRomInfo, tetristRomName, NULL, NULL, CommonInputInfo, TetristDIPInfo, + TetristInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Tetris (Japan, B-System, YM2203) + +static struct BurnRomInfo tetristaRomDesc[] = { + { "c35-04.bin", 0x020000, 0xfa6e42ff, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c35-03.bin", 0x020000, 0xaebd8539, TAITO_68KROM1_BYTESWAP }, // 1 + { "c35-02.bin", 0x020000, 0x128e9927, TAITO_68KROM1_BYTESWAP }, // 2 + { "c35-01.bin", 0x020000, 0x5da7a319, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c35-05.bin", 0x010000, 0x785c63fb, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "b72-02.rom", 0x080000, 0x843444eb, BRF_OPT }, // 5 Graphics Tiles (not used) + { "b72-01.rom", 0x080000, 0xa24ac26e, BRF_OPT }, // 6 +}; + +STD_ROM_PICK(tetrista) +STD_ROM_FN(tetrista) + +static INT32 TetristaInit() +{ + return CommonInit(TetristaInitCallback, 1, 2, 0, 4, 5); +} + +struct BurnDriver BurnDrvTetrista = { + "tetrista", "tetris", NULL, NULL, "1989", + "Tetris (Japan, B-System, YM2203)\0", NULL, "Sega", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_PUZZLE, 0, + NULL, tetristaRomInfo, tetristaRomName, NULL, NULL, CommonInputInfo, TetristDIPInfo, + TetristaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Violence Fight (World) + +static struct BurnRomInfo viofightRomDesc[] = { + { "c16-11.42", 0x010000, 0x23dbd388, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c16-14.23", 0x010000, 0xdc934f6a, TAITO_68KROM1_BYTESWAP }, // 1 + { "c16-07.41", 0x020000, 0x64d1d059, TAITO_68KROM1_BYTESWAP }, // 2 + { "c16-06.22", 0x020000, 0x043761d8, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c16-12.32", 0x010000, 0x6fb028c7, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c16-01.1", 0x080000, 0x7059ce83, TAITO_CHARS }, // 5 Graphics Tiles + { "c16-02.2", 0x080000, 0xb458e905, TAITO_CHARS }, // 6 + { "c16-03.3", 0x080000, 0x515a9431, TAITO_CHARS }, // 7 + { "c16-04.4", 0x080000, 0xebf285e2, TAITO_CHARS }, // 8 + + { "c16-05.47", 0x080000, 0xa49d064a, TAITO_MSM6295 }, // 9 MSM6295 Samples + + { "pal16l8b-c16-08.ic34", 0x000104, 0x9456d278, BRF_OPT }, // 10 PLDs + { "pal16l8b-c16-09.ic35", 0x000104, 0x0965baab, BRF_OPT }, // 11 +}; + +STD_ROM_PICK(viofight) +STD_ROM_FN(viofight) + +static INT32 ViofightInit() +{ + return CommonInit(ViofightInitCallback, 1, 2, 0, 1, 4); +} + +struct BurnDriver BurnDrvViofight = { + "viofight", NULL, NULL, NULL, "1989", + "Violence Fight (World)\0", NULL, "Taito Corporation Japan", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_VSFIGHT, 0, + NULL, viofightRomInfo, viofightRomName, NULL, NULL, ViofightInputInfo, ViofightDIPInfo, + ViofightInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Violence Fight (US) + +static struct BurnRomInfo viofightuRomDesc[] = { + { "c16-11.42", 0x010000, 0x23dbd388, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c16-13.23", 0x010000, 0xab947ffc, TAITO_68KROM1_BYTESWAP }, // 1 + { "c16-07.41", 0x020000, 0x64d1d059, TAITO_68KROM1_BYTESWAP }, // 2 + { "c16-06.22", 0x020000, 0x043761d8, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c16-12.32", 0x010000, 0x6fb028c7, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c16-01.1", 0x080000, 0x7059ce83, TAITO_CHARS }, // 5 Graphics Tiles + { "c16-02.2", 0x080000, 0xb458e905, TAITO_CHARS }, // 6 + { "c16-03.3", 0x080000, 0x515a9431, TAITO_CHARS }, // 7 + { "c16-04.4", 0x080000, 0xebf285e2, TAITO_CHARS }, // 8 + + { "c16-05.47", 0x080000, 0xa49d064a, TAITO_MSM6295 }, // 9 MSM6295 Samples + + { "pal16l8b-c16-08.ic34", 0x000104, 0x9456d278, BRF_OPT }, // 10 PLDs + { "pal16l8b-c16-09.ic35", 0x000104, 0x0965baab, BRF_OPT }, // 11 +}; + +STD_ROM_PICK(viofightu) +STD_ROM_FN(viofightu) + +struct BurnDriver BurnDrvViofightu = { + "viofightu", "viofight", NULL, NULL, "1989", + "Violence Fight (US)\0", NULL, "Taito America Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_VSFIGHT, 0, + NULL, viofightuRomInfo, viofightuRomName, NULL, NULL, ViofightInputInfo, ViofightDIPInfo, + ViofightInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Violence Fight (Japan) + +static struct BurnRomInfo viofightjRomDesc[] = { + { "c16-11.42", 0x010000, 0x23dbd388, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c16-10.23", 0x010000, 0x329d2e46, TAITO_68KROM1_BYTESWAP }, // 1 + { "c16-07.41", 0x020000, 0x64d1d059, TAITO_68KROM1_BYTESWAP }, // 2 + { "c16-06.22", 0x020000, 0x043761d8, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c16-12.32", 0x010000, 0x6fb028c7, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c16-01.1", 0x080000, 0x7059ce83, TAITO_CHARS }, // 5 Graphics Tiles + { "c16-02.2", 0x080000, 0xb458e905, TAITO_CHARS }, // 6 + { "c16-03.3", 0x080000, 0x515a9431, TAITO_CHARS }, // 7 + { "c16-04.4", 0x080000, 0xebf285e2, TAITO_CHARS }, // 8 + + { "c16-05.47", 0x080000, 0xa49d064a, TAITO_MSM6295 }, // 9 MSM6295 Samples + + { "pal16l8b-c16-08.ic34", 0x000104, 0x9456d278, BRF_OPT }, // 10 PLDs + { "pal16l8b-c16-09.ic35", 0x000104, 0x0965baab, BRF_OPT }, // 11 +}; + +STD_ROM_PICK(viofightj) +STD_ROM_FN(viofightj) + +struct BurnDriver BurnDrvViofightj = { + "viofightj", "viofight", NULL, NULL, "1989", + "Violence Fight (Japan)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_VSFIGHT, 0, + NULL, viofightjRomInfo, viofightjRomName, NULL, NULL, ViofightInputInfo, ViofightDIPInfo, + ViofightInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Ashura Blaster (World) + +static struct BurnRomInfo ashuraRomDesc[] = { + { "c43-15.50", 0x020000, 0x5d05d6c6, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c43-13.31", 0x020000, 0x75b7d877, TAITO_68KROM1_BYTESWAP }, // 1 + { "c43-14.49", 0x020000, 0xede7f37d, TAITO_68KROM1_BYTESWAP }, // 2 + { "c43-12.30", 0x020000, 0xb08a4ba0, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c43-16", 0x010000, 0xcb26fce1, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c43-02", 0x080000, 0x105722ae, TAITO_CHARS }, // 5 Graphics Tiles + { "c43-03", 0x080000, 0x426606ba, TAITO_CHARS }, // 6 + + { "c43-01", 0x080000, 0xdb953f37, TAITO_YM2610A }, // 7 YM2610 A Samples +}; + +STD_ROM_PICK(ashura) +STD_ROM_FN(ashura) + +struct BurnDriver BurnDrvAshura = { + "ashura", NULL, NULL, NULL, "1990", + "Ashura Blaster (World)\0", NULL, "Taito Corporation Japan", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, + NULL, ashuraRomInfo, ashuraRomName, NULL, NULL, CommonInputInfo, AshuraDIPInfo, + NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 224, 320, 3, 4 +}; + + +// Ashura Blaster (Japan) + +static struct BurnRomInfo ashurajRomDesc[] = { + { "c43-07-1.50", 0x020000, 0xd5ceb20f, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c43-05-1.31", 0x020000, 0xa6f3bb37, TAITO_68KROM1_BYTESWAP }, // 1 + { "c43-06-1.49", 0x020000, 0x0f331802, TAITO_68KROM1_BYTESWAP }, // 2 + { "c43-04-1.30", 0x020000, 0xe06a2414, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c43-16", 0x010000, 0xcb26fce1, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c43-02", 0x080000, 0x105722ae, TAITO_CHARS }, // 5 Graphics Tiles + { "c43-03", 0x080000, 0x426606ba, TAITO_CHARS }, // 6 + + { "c43-01", 0x080000, 0xdb953f37, TAITO_YM2610A }, // 7 YM2610 A Samples +}; + +STD_ROM_PICK(ashuraj) +STD_ROM_FN(ashuraj) + +struct BurnDriver BurnDrvAshuraj = { + "ashuraj", "ashura", NULL, NULL, "1990", + "Ashura Blaster (Japan)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, + NULL, ashurajRomInfo, ashurajRomName, NULL, NULL, CommonInputInfo, AshurajDIPInfo, + NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 224, 320, 3, 4 +}; + + +// Ashura Blaster (US) + +static struct BurnRomInfo ashurauRomDesc[] = { + { "c43-11.50", 0x020000, 0xd5aefc9b, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c43-09.31", 0x020000, 0xe91d0ab1, TAITO_68KROM1_BYTESWAP }, // 1 + { "c43-10.49", 0x020000, 0xc218e7ea, TAITO_68KROM1_BYTESWAP }, // 2 + { "c43-08.30", 0x020000, 0x5ef4f19f, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c43-16", 0x010000, 0xcb26fce1, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c43-02", 0x080000, 0x105722ae, TAITO_CHARS }, // 5 Graphics Tiles + { "c43-03", 0x080000, 0x426606ba, TAITO_CHARS }, // 6 + + { "c43-01", 0x080000, 0xdb953f37, TAITO_YM2610A }, // 7 YM2610 A Samples +}; + +STD_ROM_PICK(ashurau) +STD_ROM_FN(ashurau) + +struct BurnDriver BurnDrvAshurau = { + "ashurau", "ashura", NULL, NULL, "1990", + "Ashura Blaster (US)\0", NULL, "Taito America Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, + NULL, ashurauRomInfo, ashurauRomName, NULL, NULL, CommonInputInfo, AshurauDIPInfo, + NastarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 224, 320, 3, 4 +}; + + +// Hit the Ice (US) + +static struct BurnRomInfo hiticeRomDesc[] = { + { "c59-10.42", 0x020000, 0xe4ffad15, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c59-12.64", 0x020000, 0xa080d7af, TAITO_68KROM1_BYTESWAP }, // 1 + { "c59-09.41", 0x010000, 0xe243e3b0, TAITO_68KROM1_BYTESWAP }, // 2 + { "c59-11.63", 0x010000, 0x4d4dfa52, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c59-08.50", 0x010000, 0xd3cbc10b, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c59-03.12", 0x080000, 0x9e513048, TAITO_CHARS }, // 5 Graphics Tiles + { "c59-02.13", 0x080000, 0xaffb5e07, TAITO_CHARS }, // 6 + + { "c59-01.30", 0x020000, 0x46ae291d, TAITO_MSM6295 }, // 7 MSM6295 Samples + + { "pal20l8b-c59-04.25", 0x000144, 0x2ebcf07c, BRF_OPT }, // 8 PLDs + { "pal16l8b-c59-05.26", 0x000104, 0x37b67c5c, BRF_OPT }, // 9 + { "pal20l8b-c59-06.53", 0x000144, 0xbf176875, BRF_OPT }, // 10 + { "pal16r4b-c59-07.61", 0x000104, 0xcf64bd95, BRF_OPT }, // 11 +}; + +STD_ROM_PICK(hitice) +STD_ROM_FN(hitice) + +static INT32 HiticeInit() +{ + return CommonInit(HiticeInitCallback, 1, 0, 1, 6, 4); +} + +struct BurnDriver BurnDrvHitice = { + "hitice", NULL, NULL, NULL, "1990", + "Hit the Ice (US)\0", "Imperfect graphics", "Williams", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_SPORTSMISC, 0, + NULL, hiticeRomInfo, hiticeRomName, NULL, NULL, HiticeInputInfo, HiticeDIPInfo, + HiticeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Hit the Ice (Japan) + +static struct BurnRomInfo hiticejRomDesc[] = { + { "c59-23.42", 0x020000, 0x01958fcc, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c59-25.64", 0x020000, 0x71984c76, TAITO_68KROM1_BYTESWAP }, // 1 + { "c59-22.41", 0x010000, 0xc2c86140, TAITO_68KROM1_BYTESWAP }, // 2 + { "c59-24.63", 0x010000, 0x26c8f409, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c59-08.50", 0x010000, 0xd3cbc10b, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "c59-03.12", 0x080000, 0x9e513048, TAITO_CHARS }, // 5 Graphics Tiles + { "c59-02.13", 0x080000, 0xaffb5e07, TAITO_CHARS }, // 6 + + { "c59-01.30", 0x020000, 0x46ae291d, TAITO_MSM6295 }, // 7 MSM6295 Samples + + { "pal20l8b-c59-04.25", 0x000144, 0x2ebcf07c, BRF_OPT }, // 8 PLDs + { "pal16l8b-c59-05.26", 0x000104, 0x37b67c5c, BRF_OPT }, // 9 + { "pal20l8b-c59-06.53", 0x000144, 0xbf176875, BRF_OPT }, // 10 + { "pal16r4b-c59-07.61", 0x000104, 0xcf64bd95, BRF_OPT }, // 11 +}; + +STD_ROM_PICK(hiticej) +STD_ROM_FN(hiticej) + +struct BurnDriver BurnDrvHiticej = { + "hiticej", "hitice", NULL, NULL, "1990", + "Hit the Ice (Japan)\0", "Imperfect graphics", "Midway/Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SPORTSMISC, 0, + NULL, hiticejRomInfo, hiticejRomName, NULL, NULL, HiticeInputInfo, HiticeDIPInfo, + HiticeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Sel Feena + +static struct BurnRomInfo selfeenaRomDesc[] = { + { "se-02.27", 0x020000, 0x08f0c8e3, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "se-01.26", 0x020000, 0xa06ca64b, TAITO_68KROM1_BYTESWAP }, // 1 + + { "se-03.39", 0x010000, 0x675998be, TAITO_Z80ROM1 }, // 2 Z80 Code + + { "se-04.2", 0x080000, 0x920ad100, TAITO_CHARS }, // 3 Graphics Tiles + { "se-05.1", 0x080000, 0xd297c995, TAITO_CHARS }, // 4 + + { "se-06.11", 0x080000, 0x80d5e772, TAITO_YM2610A }, // 5 YM2610 A Samples +}; + +STD_ROM_PICK(selfeena) +STD_ROM_FN(selfeena) + +static INT32 SelfeenaInit() +{ + return CommonInit(SelfeenaInitCallback, 0, 2, 1, 4, 6); +} + +struct BurnDriver BurnDrvSelfeena = { + "selfeena", NULL, NULL, NULL, "1991", + "Sel Feena\0", NULL, "East Technology", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_MAZE, 0, + NULL, selfeenaRomInfo, selfeenaRomName, NULL, NULL, SelfeenaInputInfo, SelfeenaDIPInfo, + SelfeenaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Silent Dragon (World) + +static struct BurnRomInfo silentdRomDesc[] = { + { "east-12-1.ic32", 0x020000, 0x5883d362, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "east-15-1.ic10", 0x020000, 0x8c0a72ae, TAITO_68KROM1_BYTESWAP }, // 1 + { "east-11.ic31", 0x020000, 0x35da4428, TAITO_68KROM1_BYTESWAP }, // 2 + { "east-09.ic9", 0x020000, 0x2f05b14a, TAITO_68KROM1_BYTESWAP }, // 3 + + { "east-13.ic15", 0x010000, 0x651861ab, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "east-04.ic28", 0x100000, 0x53237217, TAITO_CHARS }, // 5 Graphics Tiles + { "east-06.ic29", 0x100000, 0xe6e6dfa7, TAITO_CHARS }, // 6 + { "east-03.ic39", 0x100000, 0x1b9b2846, TAITO_CHARS }, // 7 + { "east-05.ic40", 0x100000, 0xe02472c5, TAITO_CHARS }, // 8 + + { "east-01.ic1", 0x080000, 0xb41fff1a, TAITO_YM2610A }, // 9 YM2610 A Samples + + { "east-02.ic3", 0x080000, 0xe0de5c39, TAITO_YM2610B }, // 10 YM2610 B Samples +}; + +STD_ROM_PICK(silentd) +STD_ROM_FN(silentd) + +static INT32 SilentdInit() +{ + INT32 nRet = CommonInit(SilentdInitCallback, 0, 2, 2, 4, 6); + + if (nRet == 0) { + cpu_speed[0] = 16000000; // 16mhz + } + + return nRet; +} + +struct BurnDriver BurnDrvSilentd = { + "silentd", NULL, NULL, NULL, "1992", + "Silent Dragon (World)\0", NULL, "Taito Corporation Japan", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, + NULL, silentdRomInfo, silentdRomName, NULL, NULL, SilentdInputInfo, SilentdDIPInfo, + SilentdInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Silent Dragon (Japan) + +static struct BurnRomInfo silentdjRomDesc[] = { + { "east-12-1.ic32", 0x020000, 0x5883d362, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "east-10-1.ic10", 0x020000, 0x584306fc, TAITO_68KROM1_BYTESWAP }, // 1 + { "east-11.ic31", 0x020000, 0x35da4428, TAITO_68KROM1_BYTESWAP }, // 2 + { "east-09.ic9", 0x020000, 0x2f05b14a, TAITO_68KROM1_BYTESWAP }, // 3 + + { "east-13.ic15", 0x010000, 0x651861ab, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "east-04.ic28", 0x100000, 0x53237217, TAITO_CHARS }, // 5 Graphics Tiles + { "east-06.ic29", 0x100000, 0xe6e6dfa7, TAITO_CHARS }, // 6 + { "east-03.ic39", 0x100000, 0x1b9b2846, TAITO_CHARS }, // 7 + { "east-05.ic40", 0x100000, 0xe02472c5, TAITO_CHARS }, // 8 + + { "east-01.ic1", 0x080000, 0xb41fff1a, TAITO_YM2610A }, // 9 YM2610 A Samples + + { "east-02.ic3", 0x080000, 0xe0de5c39, TAITO_YM2610B }, // 10 YM2610 B Samples +}; + +STD_ROM_PICK(silentdj) +STD_ROM_FN(silentdj) + +struct BurnDriver BurnDrvSilentdj = { + "silentdj", "silentd", NULL, NULL, "1992", + "Silent Dragon (Japan)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, + NULL, silentdjRomInfo, silentdjRomName, NULL, NULL, SilentdInputInfo, SilentdjDIPInfo, + SilentdInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Silent Dragon (US) + +static struct BurnRomInfo silentduRomDesc[] = { + { "east-12-1.ic32", 0x020000, 0x5883d362, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "east-14-1.ic10", 0x020000, 0x3267bcd5, TAITO_68KROM1_BYTESWAP }, // 1 + { "east-11.ic31", 0x020000, 0x35da4428, TAITO_68KROM1_BYTESWAP }, // 2 + { "east-09.ic9", 0x020000, 0x2f05b14a, TAITO_68KROM1_BYTESWAP }, // 3 + + { "east-13.ic15", 0x010000, 0x651861ab, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "east-04.ic28", 0x100000, 0x53237217, TAITO_CHARS }, // 5 Graphics Tiles + { "east-06.ic29", 0x100000, 0xe6e6dfa7, TAITO_CHARS }, // 6 + { "east-03.ic39", 0x100000, 0x1b9b2846, TAITO_CHARS }, // 7 + { "east-05.ic40", 0x100000, 0xe02472c5, TAITO_CHARS }, // 8 + + { "east-01.ic1", 0x080000, 0xb41fff1a, TAITO_YM2610A }, // 9 YM2610 A Samples + + { "east-02.ic3", 0x080000, 0xe0de5c39, TAITO_YM2610B }, // 10 YM2610 B Samples +}; + +STD_ROM_PICK(silentdu) +STD_ROM_FN(silentdu) + +struct BurnDriver BurnDrvSilentdu = { + "silentdu", "silentd", NULL, NULL, "1992", + "Silent Dragon (US)\0", NULL, "Taito America Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_SCRFIGHT, 0, + NULL, silentduRomInfo, silentduRomName, NULL, NULL, SilentdInputInfo, SilentdjDIPInfo, + SilentdInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Ryu Jin (Japan) + +static struct BurnRomInfo ryujinRomDesc[] = { + { "ruj02.27", 0x020000, 0x0d223aee, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "ruj01.26", 0x020000, 0xc6bcdd1e, TAITO_68KROM1_BYTESWAP }, // 1 + { "ruj04.29", 0x020000, 0x0c153cab, TAITO_68KROM1_BYTESWAP }, // 2 + { "ruj03.28", 0x020000, 0x7695f89c, TAITO_68KROM1_BYTESWAP }, // 3 + + { "ruj05.39", 0x010000, 0x95270b16, TAITO_Z80ROM1 }, // 4 Z80 Code + + { "ryujin07.2", 0x100000, 0x34f50980, TAITO_CHARS }, // 5 Graphics Tiles + { "ryujin06.1", 0x100000, 0x1b85ff34, TAITO_CHARS }, // 6 + + { "ryujin08.11", 0x080000, 0x480d040d, TAITO_YM2610A }, // 7 YM2610 A Samples +}; + +STD_ROM_PICK(ryujin) +STD_ROM_FN(ryujin) + +struct BurnDriver BurnDrvRyujin = { + "ryujin", NULL, NULL, NULL, "1993", + "Ryu Jin (Japan)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOB, GBF_VERSHOOT, 0, + NULL, ryujinRomInfo, ryujinRomName, NULL, NULL, SelfeenaInputInfo, RyujinDIPInfo, + SelfeenaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 224, 320, 3, 4 +}; + + +// Quiz Sekai wa SHOW by shobai (Japan) + +static struct BurnRomInfo qzshowbyRomDesc[] = { + { "d72-13.bin", 0x080000, 0xa867759f, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "d72-12.bin", 0x080000, 0x522c09a7, TAITO_68KROM1_BYTESWAP }, // 1 + + { "d72-11.bin", 0x020000, 0x2ca046e2, TAITO_Z80ROM1 }, // 2 Z80 Code + + { "d72-03.bin", 0x200000, 0x1de257d0, TAITO_CHARS }, // 3 Graphics Tiles + { "d72-02.bin", 0x200000, 0xbf0da640, TAITO_CHARS }, // 4 + + { "d72-01.bin", 0x200000, 0xb82b8830, TAITO_YM2610A }, // 5 YM2610 A Samples + + { "pal16l8-d72-05.bin", 0x0104, 0xc3d4cb7e, BRF_OPT }, // 6 PLDs + { "pal16l8-d72-06.bin", 0x0104, 0x27580efc, BRF_OPT }, // 7 + { "palce20v8-d72-07.bin", 0x0157, 0x6359e64c, BRF_OPT }, // 8 + { "palce20v8-d72-08.bin", 0x0157, 0x746a6474, BRF_OPT }, // 9 + { "palce20v8-d72-09.bin", 0x0157, 0x9f680800, BRF_OPT }, // 10 + { "palce16v8-d72-10.bin", 0x0117, 0xa5181ba2, BRF_OPT }, // 11 +}; + +STD_ROM_PICK(qzshowby) +STD_ROM_FN(qzshowby) + +static INT32 QzshowbyInit() +{ + return CommonInit(QzshowbyInitCallback, 0, 1, 3, 5, 3); +} + +struct BurnDriver BurnDrvQzshowby = { + "qzshowby", NULL, NULL, NULL, "1993", + "Quiz Sekai wa SHOW by shobai (Japan)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_QUIZ, 0, + NULL, qzshowbyRomInfo, qzshowbyRomName, NULL, NULL, QzshowbyInputInfo, QzshowbyDIPInfo, + QzshowbyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Puzzle Bobble (Japan, B-System) + +static struct BurnRomInfo pbobbleRomDesc[] = { + { "pb-1c18.bin", 0x040000, 0x5de14f49, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "pb-ic2.bin", 0x040000, 0x2abe07d1, TAITO_68KROM1_BYTESWAP }, // 1 + + { "pb-ic27.bin", 0x020000, 0x26efa4c4, TAITO_Z80ROM1 }, // 2 Z80 Code + + { "pb-ic14.bin", 0x080000, 0x55f90ea4, TAITO_CHARS }, // 3 Graphics Tiles + { "pb-ic9.bin", 0x080000, 0x3253aac9, TAITO_CHARS }, // 4 + + { "pb-ic15.bin", 0x100000, 0x0840cbc4, TAITO_YM2610A }, // 5 YM2610 A Samples +}; + +STD_ROM_PICK(pbobble) +STD_ROM_FN(pbobble) + +static INT32 PbobbleInit() +{ + return CommonInit(PbobbleInitCallback, 0, 1, 3, 5, 3); +} + +struct BurnDriver BurnDrvPbobble = { + "pbobble", NULL, NULL, NULL, "1994", + "Puzzle Bobble (Japan, B-System)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, + NULL, pbobbleRomInfo, pbobbleRomName, NULL, NULL, PbobbleInputInfo, PbobbleDIPInfo, + PbobbleInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Space Invaders DX (US, v2.1) + +static struct BurnRomInfo spacedxRomDesc[] = { + { "d89-06", 0x040000, 0x7122751e, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "d89-xx.ic2", 0x040000, 0x56b0be6c, TAITO_68KROM1_BYTESWAP }, // 1 + + { "d89-07.27", 0x010000, 0xbd743401, TAITO_Z80ROM1 }, // 2 Z80 Code + + { "d89-02.14", 0x080000, 0xc36544b9, TAITO_CHARS }, // 3 Graphics Tiles + { "d89-01.9", 0x080000, 0xfffa0660, TAITO_CHARS }, // 4 + + { "d89-03.15", 0x080000, 0x218f31a4, TAITO_YM2610A }, // 5 YM2610 A Samples + + { "pal16l8-d72-05.ic37", 0x0104, 0xc3d4cb7e, BRF_OPT }, // 6 PLDs + { "pal16l8-d72-06.ic50", 0x0104, 0xe96b7f37, BRF_OPT }, // 7 + { "palce20v8-d72-07.ic28", 0x0157, 0x6359e64c, BRF_OPT }, // 8 + { "palce20v8-d72-09.ic47", 0x0157, 0xde1760fd, BRF_OPT }, // 9 + { "palce16v8-d72-10.ic12", 0x0117, 0xa5181ba2, BRF_OPT }, // 10 + { "pal20l8b-d89-04.ic40", 0x0144, 0x00000000, BRF_OPT | BRF_NODUMP }, // 12 +}; + +STD_ROM_PICK(spacedx) +STD_ROM_FN(spacedx) + +struct BurnDriver BurnDrvSpacedx = { + "spacedx", NULL, NULL, NULL, "1994", + "Space Invaders DX (US, v2.1)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, + NULL, spacedxRomInfo, spacedxRomName, NULL, NULL, PbobbleInputInfo, PbobbleDIPInfo, + PbobbleInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Space Invaders DX (Japan, v2.1) + +static struct BurnRomInfo spacedxjRomDesc[] = { + { "d89-06", 0x040000, 0x7122751e, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "d89-05", 0x040000, 0xbe1638af, TAITO_68KROM1_BYTESWAP }, // 1 + + { "d89-07.27", 0x010000, 0xbd743401, TAITO_Z80ROM1 }, // 2 Z80 Code + + { "d89-02.14", 0x080000, 0xc36544b9, TAITO_CHARS }, // 3 Graphics Tiles + { "d89-01.9", 0x080000, 0xfffa0660, TAITO_CHARS }, // 4 + + { "d89-03.15", 0x080000, 0x218f31a4, TAITO_YM2610A }, // 5 YM2610 A Samples + + { "pal16l8-d72-05.ic37", 0x0104, 0xc3d4cb7e, BRF_OPT }, // 6 PLDs + { "pal16l8-d72-06.ic50", 0x0104, 0xe96b7f37, BRF_OPT }, // 7 + { "palce20v8-d72-07.ic28", 0x0157, 0x6359e64c, BRF_OPT }, // 8 + { "palce20v8-d72-09.ic47", 0x0157, 0xde1760fd, BRF_OPT }, // 9 + { "palce16v8-d72-10.ic12", 0x0117, 0xa5181ba2, BRF_OPT }, // 10 + { "pal20l8b-d89-04.ic40", 0x0144, 0x00000000, BRF_OPT | BRF_NODUMP }, // 12 +}; + +STD_ROM_PICK(spacedxj) +STD_ROM_FN(spacedxj) + +struct BurnDriver BurnDrvSpacedxj = { + "spacedxj", "spacedx", NULL, NULL, "1994", + "Space Invaders DX (Japan, v2.1)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, + NULL, spacedxjRomInfo, spacedxjRomName, NULL, NULL, PbobbleInputInfo, PbobbleDIPInfo, + PbobbleInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Space Invaders DX (Japan, v2.0) + +static struct BurnRomInfo spacedxoRomDesc[] = { + { "d89-08.bin", 0x020000, 0x0c2fe7f9, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "d89-09.bin", 0x020000, 0x7f0a0ba4, TAITO_68KROM1_BYTESWAP }, // 1 + + { "d89-07.27", 0x010000, 0xbd743401, TAITO_Z80ROM1 }, // 2 Z80 Code + + { "d89-12.bin", 0x080000, 0x53df86f1, TAITO_CHARS }, // 3 Graphics Tiles + { "d89-13.bin", 0x080000, 0xc44c1352, TAITO_CHARS }, // 4 + + { "d89-03.15", 0x080000, 0x218f31a4, TAITO_YM2610A }, // 5 YM2610 A Samples +}; + +STD_ROM_PICK(spacedxo) +STD_ROM_FN(spacedxo) + +static INT32 SpacedxoInit() +{ + return CommonInit(SilentdInitCallback, 0, 2, 3, 4, 6); +} + +struct BurnDriver BurnDrvSpacedxo = { + "spacedxo", "spacedx", NULL, NULL, "1994", + "Space Invaders DX (Japan, v2.0)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, + NULL, spacedxoRomInfo, spacedxoRomName, NULL, NULL, SpacedxoInputInfo, SpacedxoDIPInfo, + SpacedxoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; + + +// Sonic Blast Man (Japan) + +static struct BurnRomInfo sbmRomDesc[] = { + { "c69-20-1.10", 0x020000, 0xb40e4910, TAITO_68KROM1_BYTESWAP }, // 0 68k Code + { "c69-22-1.12", 0x020000, 0xecbcf830, TAITO_68KROM1_BYTESWAP }, // 1 + { "c69-19-1.9", 0x020000, 0x5719c158, TAITO_68KROM1_BYTESWAP }, // 2 + { "c69-21-1.11", 0x020000, 0x73562394, TAITO_68KROM1_BYTESWAP }, // 3 + + { "c69-23.28", 0x010000, 0xb2fce13e, TAITO_Z80ROM1 }, // 4 Z80 Code + + // Some roms are repeated to compensate for the way the taito rom loading system in fba works. + { "c69-01.ic5", 0x100000, 0x521fabe3, TAITO_CHARS }, // 5 Graphics Tiles + { "c69-13.ic2", 0x020000, 0xd1550884, TAITO_CHARS_BYTESWAP }, // 6 + { "c69-12.ic1", 0x020000, 0xeb56582c, TAITO_CHARS_BYTESWAP }, // 7 + { "c69-13.ic2", 0x020000, 0xd1550884, TAITO_CHARS_BYTESWAP }, // 8 + { "c69-12.ic1", 0x020000, 0xeb56582c, TAITO_CHARS_BYTESWAP }, // 9 + { "c69-13.ic2", 0x020000, 0xd1550884, TAITO_CHARS_BYTESWAP }, // 10 + { "c69-12.ic1", 0x020000, 0xeb56582c, TAITO_CHARS_BYTESWAP }, // 11 + { "c69-13.ic2", 0x020000, 0xd1550884, TAITO_CHARS_BYTESWAP }, // 12 + { "c69-12.ic1", 0x020000, 0xeb56582c, TAITO_CHARS_BYTESWAP }, // 13 + { "c69-02.ic6", 0x100000, 0xf0e20d35, TAITO_CHARS }, // 14 + { "c69-15.ic4", 0x020000, 0x9761d316, TAITO_CHARS_BYTESWAP }, // 15 + { "c69-14.ic3", 0x020000, 0x0ed0272a, TAITO_CHARS_BYTESWAP }, // 16 + { "c69-15.ic4", 0x020000, 0x9761d316, TAITO_CHARS_BYTESWAP }, // 17 + { "c69-14.ic3", 0x020000, 0x0ed0272a, TAITO_CHARS_BYTESWAP }, // 18 + { "c69-15.ic4", 0x020000, 0x9761d316, TAITO_CHARS_BYTESWAP }, // 19 + { "c69-14.ic3", 0x020000, 0x0ed0272a, TAITO_CHARS_BYTESWAP }, // 20 + { "c69-15.ic4", 0x020000, 0x9761d316, TAITO_CHARS_BYTESWAP }, // 21 + { "c69-14.ic3", 0x020000, 0x0ed0272a, TAITO_CHARS_BYTESWAP }, // 22 + + { "c69-03.36", 0x080000, 0x63e6b6e7, TAITO_YM2610A }, // 23 ymsnd +}; + +STD_ROM_PICK(sbm) +STD_ROM_FN(sbm) + +static INT32 SbmInit() +{ + nTaitoInputConfig[2] = 0x60; + + return CommonInit(SbmInitCallback, 0, 0, 0, 5, 4); +} + +struct BurnDriver BurnDrvSbm = { + "sbm", NULL, NULL, NULL, "1990", + "Sonic Blast Man (Japan)\0", NULL, "Taito Corporation", "Taito B System", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOB, GBF_MISC, 0, + NULL, sbmRomInfo, sbmRomName, NULL, NULL, SbmInputInfo, SbmDIPInfo, + SbmInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x1000, + 320, 224, 4, 3 +}; diff --git a/src/burn/drv/taito/d_taitof2.cpp b/src/burn/drv/taito/d_taitof2.cpp index 6201cf7ca..311d91497 100644 --- a/src/burn/drv/taito/d_taitof2.cpp +++ b/src/burn/drv/taito/d_taitof2.cpp @@ -1,11261 +1,11258 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "taito.h" -#include "taito_ic.h" -#include "burn_ym2610.h" -#include "burn_ym2203.h" -#include "msm6295.h" - -static INT32 Footchmp; -static INT32 YesnoDip; -static INT32 MjnquestInput; -static INT32 DriveoutSoundNibble; -static INT32 DriveoutOkiBank; - -INT32 TaitoF2SpriteType; -INT32 TaitoF2SpritesFlipScreen; -INT32 TaitoF2PrepareSprites; -INT32 TaitoF2SpritesDisabled, TaitoF2SpritesActiveArea, TaitoF2SpritesMasterScrollX, TaitoF2SpritesMasterScrollY; -INT32 TaitoF2SpriteBlendMode; -UINT16 TaitoF2SpriteBank[8]; -UINT16 TaitoF2SpriteBankBuffered[8]; -UINT8 TaitoF2TilePriority[5]; -UINT8 TaitoF2SpritePriority[4]; -struct TaitoF2SpriteEntry *TaitoF2SpriteList; -static TaitoF2SpriteBufferUpdate TaitoF2SpriteBufferFunction; - -static void TaitoF2Draw(); -static void TaitoF2PivotDraw(); -static void CameltryDraw(); -static void DriftoutDraw(); -static void FinalbDraw(); -static void FootchmpDraw(); -static void MetalbDraw(); -static void PulirulaDraw(); -static void QtorimonDraw(); -static void QzquestDraw(); -static void SsiDraw(); -static void ThundfoxDraw(); -static void YuyugogoDraw(); - -static bool bUseAsm68KCoreOldValue = false; - -#define A(a, b, c, d) {a, b, (UINT8*)(c), d} - -static struct BurnInputInfo CameltryInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, - - A("P1 Paddle" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, - - A("P2 Paddle" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "p2 x-axis" ), - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Cameltry) - -static struct BurnInputInfo DeadconxInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort2 + 4, "service" }, - {"Service 2" , BIT_DIGITAL , TaitoInputPort2 + 5, "service 2" }, - {"Service 3" , BIT_DIGITAL , TaitoInputPort2 + 6, "service 3" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 7, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Deadconx) - -static struct BurnInputInfo DinorexInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Dinorex) - -static struct BurnInputInfo DondokodInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Dondokod) - -static struct BurnInputInfo DriftoutInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - - {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Driftout) - -static struct BurnInputInfo FinalbInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 fire 4" }, - {"P1 Fire 5" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p1 fire 5" }, - - {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p2 fire 4" }, - {"P2 Fire 5" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p2 fire 5" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Finalb) - -static struct BurnInputInfo FootchmpInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, - {"Coin 3" , BIT_DIGITAL , TaitoInputPort2 + 2, "p3 coin" }, - {"Start 3" , BIT_DIGITAL , TaitoInputPort3 + 7, "p3 start" }, - {"Coin 4" , BIT_DIGITAL , TaitoInputPort2 + 3, "p4 coin" }, - {"Start 4" , BIT_DIGITAL , TaitoInputPort4 + 7, "p4 start" }, - - {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, - - {"P3 Up" , BIT_DIGITAL , TaitoInputPort3 + 0, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , TaitoInputPort3 + 1, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , TaitoInputPort3 + 2, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , TaitoInputPort3 + 3, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , TaitoInputPort3 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , TaitoInputPort3 + 5, "p3 fire 2" }, - - {"P4 Up" , BIT_DIGITAL , TaitoInputPort4 + 0, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , TaitoInputPort4 + 1, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , TaitoInputPort4 + 2, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , TaitoInputPort4 + 3, "p4 right" }, - {"P4 Fire 1" , BIT_DIGITAL , TaitoInputPort4 + 4, "p4 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , TaitoInputPort4 + 5, "p4 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort2 + 4, "service" }, - {"Service 2" , BIT_DIGITAL , TaitoInputPort2 + 5, "service 2" }, - {"Service 3" , BIT_DIGITAL , TaitoInputPort2 + 6, "service 3" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 7, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Footchmp) - -static struct BurnInputInfo GrowlInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, - {"Coin 3" , BIT_DIGITAL , TaitoInputPort5 + 0, "p3 coin" }, - {"Start 3" , BIT_DIGITAL , TaitoInputPort3 + 7, "p3 start" }, - {"Coin 4" , BIT_DIGITAL , TaitoInputPort5 + 1, "p4 coin" }, - {"Start 4" , BIT_DIGITAL , TaitoInputPort4 + 7, "p4 start" }, - - {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TaitoInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TaitoInputPort1 + 6, "p2 fire 3" }, - - {"P3 Up" , BIT_DIGITAL , TaitoInputPort3 + 0, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , TaitoInputPort3 + 1, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , TaitoInputPort3 + 2, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , TaitoInputPort3 + 3, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , TaitoInputPort3 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , TaitoInputPort3 + 5, "p3 fire 2" }, - {"P3 Fire 3" , BIT_DIGITAL , TaitoInputPort3 + 6, "p3 fire 3" }, - - {"P4 Up" , BIT_DIGITAL , TaitoInputPort4 + 0, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , TaitoInputPort4 + 1, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , TaitoInputPort4 + 2, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , TaitoInputPort4 + 3, "p4 right" }, - {"P4 Fire 1" , BIT_DIGITAL , TaitoInputPort4 + 4, "p4 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , TaitoInputPort4 + 5, "p4 fire 2" }, - {"P4 Fire 3" , BIT_DIGITAL , TaitoInputPort4 + 6, "p4 fire 3" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort2 + 1, "service" }, - {"Service 2" , BIT_DIGITAL , TaitoInputPort5 + 2, "service 2" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Growl) - -static struct BurnInputInfo GunfrontInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Gunfront) - -static struct BurnInputInfo KoshienInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort2 + 4, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort2 + 5, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort2 + 6, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort2 + 7, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Koshien) - -static struct BurnInputInfo LiquidkInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Liquidk) - -static struct BurnInputInfo MegablstInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Megablst) - -static struct BurnInputInfo MetalbInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Metalb) - -static struct BurnInputInfo MjnquestInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort5 + 1, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort4 + 1, "p2 coin" }, - - {"Mahjong A" , BIT_DIGITAL , TaitoInputPort0 + 0, "mah a" }, - {"Mahjong B" , BIT_DIGITAL , TaitoInputPort1 + 0, "mah b" }, - {"Mahjong C" , BIT_DIGITAL , TaitoInputPort2 + 0, "mah c" }, - {"Mahjong D" , BIT_DIGITAL , TaitoInputPort3 + 0, "mah d" }, - {"Mahjong E" , BIT_DIGITAL , TaitoInputPort0 + 1, "mah e" }, - {"Mahjong F" , BIT_DIGITAL , TaitoInputPort1 + 1, "mah f" }, - {"Mahjong G" , BIT_DIGITAL , TaitoInputPort2 + 1, "mah g" }, - {"Mahjong H" , BIT_DIGITAL , TaitoInputPort3 + 1, "mah h" }, - {"Mahjong I" , BIT_DIGITAL , TaitoInputPort0 + 2, "mah i" }, - {"Mahjong J" , BIT_DIGITAL , TaitoInputPort1 + 2, "mah j" }, - {"Mahjong K" , BIT_DIGITAL , TaitoInputPort2 + 2, "mah k" }, - {"Mahjong L" , BIT_DIGITAL , TaitoInputPort3 + 2, "mah l" }, - {"Mahjong M" , BIT_DIGITAL , TaitoInputPort0 + 3, "mah m" }, - {"Mahjong N" , BIT_DIGITAL , TaitoInputPort1 + 3, "mah n" }, - {"Mahjong Kan" , BIT_DIGITAL , TaitoInputPort0 + 4, "mah kan" }, - {"Mahjong Pon" , BIT_DIGITAL , TaitoInputPort3 + 3, "mah pon" }, - {"Mahjong Chi" , BIT_DIGITAL , TaitoInputPort2 + 3, "mah chi" }, - {"Mahjong Reach" , BIT_DIGITAL , TaitoInputPort1 + 4, "mah reach" }, - {"Mahjong Ron" , BIT_DIGITAL , TaitoInputPort2 + 4, "mah ron" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort5 + 0, "service" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort4 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Mjnquest) - -static struct BurnInputInfo NinjakInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 4, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 5, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, - {"Coin 3" , BIT_DIGITAL , TaitoInputPort2 + 6, "p3 coin" }, - {"Start 3" , BIT_DIGITAL , TaitoInputPort3 + 7, "p3 start" }, - {"Coin 4" , BIT_DIGITAL , TaitoInputPort2 + 7, "p4 coin" }, - {"Start 4" , BIT_DIGITAL , TaitoInputPort4 + 7, "p4 start" }, - - {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, - - {"P3 Up" , BIT_DIGITAL , TaitoInputPort3 + 0, "p3 up" }, - {"P3 Down" , BIT_DIGITAL , TaitoInputPort3 + 1, "p3 down" }, - {"P3 Left" , BIT_DIGITAL , TaitoInputPort3 + 2, "p3 left" }, - {"P3 Right" , BIT_DIGITAL , TaitoInputPort3 + 3, "p3 right" }, - {"P3 Fire 1" , BIT_DIGITAL , TaitoInputPort3 + 4, "p3 fire 1" }, - {"P3 Fire 2" , BIT_DIGITAL , TaitoInputPort3 + 5, "p3 fire 2" }, - - {"P4 Up" , BIT_DIGITAL , TaitoInputPort4 + 0, "p4 up" }, - {"P4 Down" , BIT_DIGITAL , TaitoInputPort4 + 1, "p4 down" }, - {"P4 Left" , BIT_DIGITAL , TaitoInputPort4 + 2, "p4 left" }, - {"P4 Right" , BIT_DIGITAL , TaitoInputPort4 + 3, "p4 right" }, - {"P4 Fire 1" , BIT_DIGITAL , TaitoInputPort4 + 4, "p4 fire 1" }, - {"P4 Fire 2" , BIT_DIGITAL , TaitoInputPort4 + 5, "p4 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort2 + 1, "service" }, - {"Service 2" , BIT_DIGITAL , TaitoInputPort2 + 2, "service 2" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Ninjak) - -static struct BurnInputInfo PulirulaInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Pulirula) - -static struct BurnInputInfo QcrayonInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 4" }, - {"P1 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 5" }, - - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 fire 4" }, - {"P2 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 5" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Qcrayon) - -static struct BurnInputInfo Qcrayon2InputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, - - {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Qcrayon2) - -static struct BurnInputInfo QjinseiInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 4" }, - {"P1 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 5" }, - - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 fire 4" }, - {"P2 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 5" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Qjinsei) - -static struct BurnInputInfo QtorimonInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, - - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 fire 4" }, - - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 fire 4" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Qtorimon) - -static struct BurnInputInfo QuizhqInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, - - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 fire 4" }, - {"P1 Fire 5" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 5" }, - - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 fire 4" }, - {"P2 Fire 5" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 5" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Quizhq) - -static struct BurnInputInfo QzchikyuInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 4" }, - {"P1 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 5" }, - - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 fire 4" }, - {"P2 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p2 fire 5" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Qzchikyu) - -static struct BurnInputInfo QzquestInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 4" }, - {"P1 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 5" }, - - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 fire 4" }, - {"P2 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p2 fire 5" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Qzquest) - -static struct BurnInputInfo SolfigtrInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TaitoInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TaitoInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Solfigtr) - -static struct BurnInputInfo SsiInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Ssi) - -static struct BurnInputInfo ThundfoxInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 fire 3" }, - - {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Thundfox) - -static struct BurnInputInfo YesnojInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort1 + 2, "p1 coin" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 coin" }, - - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 fire 2" }, - - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 2, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 3, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort1 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort1 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Yesnoj) - -static struct BurnInputInfo YuyugogoInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, - - {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 4" }, - {"P1 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 5" }, - - {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 fire 3" }, - {"P2 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 fire 4" }, - {"P2 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 5" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Yuyugogo) - -#undef A - -static void TC0220IOCMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0xff; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - TC0220IOCInput[0] -= (TC0220IOCInputPort0[i] & 1) << i; - TC0220IOCInput[1] -= (TC0220IOCInputPort1[i] & 1) << i; - TC0220IOCInput[2] -= (TC0220IOCInputPort2[i] & 1) << i; - } -} - -static void TC0510NIOMakeInputs() -{ - // Reset Inputs - TC0510NIOInput[0] = 0xff; - TC0510NIOInput[1] = 0xff; - TC0510NIOInput[2] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - TC0510NIOInput[0] -= (TC0510NIOInputPort0[i] & 1) << i; - TC0510NIOInput[1] -= (TC0510NIOInputPort1[i] & 1) << i; - TC0510NIOInput[2] -= (TC0510NIOInputPort2[i] & 1) << i; - } -} - -static void TaitoF2MakeInputs() -{ - // Reset Inputs - TaitoInput[0] = 0xff; - TaitoInput[1] = 0xff; - TaitoInput[2] = 0xff; - TaitoInput[3] = 0xff; - TaitoInput[4] = 0xff; - TaitoInput[5] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - TaitoInput[0] -= (TaitoInputPort0[i] & 1) << i; - TaitoInput[1] -= (TaitoInputPort1[i] & 1) << i; - TaitoInput[2] -= (TaitoInputPort2[i] & 1) << i; - TaitoInput[3] -= (TaitoInputPort3[i] & 1) << i; - TaitoInput[4] -= (TaitoInputPort4[i] & 1) << i; - TaitoInput[5] -= (TaitoInputPort5[i] & 1) << i; - } -} - -static struct BurnDIPInfo CameltryDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xfe, NULL }, - {0x0c, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x01, 0x00, "Upright" }, - {0x0b, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0b, 0x01, 0x02, 0x02, "Off" }, - {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x0b, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0xc0, 0xc0, "Same as start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x03, 0x02, "Easy" }, - {0x0c, 0x01, 0x03, 0x03, "Medium" }, - {0x0c, 0x01, 0x03, 0x01, "Hard" }, - {0x0c, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Start remain time" }, - {0x0c, 0x01, 0x0c, 0x00, "35" }, - {0x0c, 0x01, 0x0c, 0x04, "40" }, - {0x0c, 0x01, 0x0c, 0x0c, "50" }, - {0x0c, 0x01, 0x0c, 0x08, "60" }, - - {0 , 0xfe, 0 , 4 , "Continue play time" }, - {0x0c, 0x01, 0x30, 0x00, "+20" }, - {0x0c, 0x01, 0x30, 0x10, "+25" }, - {0x0c, 0x01, 0x30, 0x30, "+30" }, - {0x0c, 0x01, 0x30, 0x20, "+40" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x0c, 0x01, 0x80, 0x80, "Single" }, - {0x0c, 0x01, 0x80, 0x00, "Dual" }, -}; - -STDDIPINFO(Cameltry) - -static struct BurnDIPInfo CameltrjDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xfe, NULL }, - {0x0c, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x01, 0x00, "Upright" }, - {0x0b, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0b, 0x01, 0x02, 0x02, "Off" }, - {0x0b, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0b, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0b, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x03, 0x02, "Easy" }, - {0x0c, 0x01, 0x03, 0x03, "Medium" }, - {0x0c, 0x01, 0x03, 0x01, "Hard" }, - {0x0c, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Start remain time" }, - {0x0c, 0x01, 0x0c, 0x00, "35" }, - {0x0c, 0x01, 0x0c, 0x04, "40" }, - {0x0c, 0x01, 0x0c, 0x0c, "50" }, - {0x0c, 0x01, 0x0c, 0x08, "60" }, - - {0 , 0xfe, 0 , 4 , "Continue play time" }, - {0x0c, 0x01, 0x30, 0x00, "+20" }, - {0x0c, 0x01, 0x30, 0x10, "+25" }, - {0x0c, 0x01, 0x30, 0x30, "+30" }, - {0x0c, 0x01, 0x30, 0x20, "+40" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x0c, 0x01, 0x80, 0x80, "Single" }, - {0x0c, 0x01, 0x80, 0x00, "Dual" }, -}; - -STDDIPINFO(Cameltrj) - -static struct BurnDIPInfo DeadconxDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfe, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x15, 0x01, 0x01, 0x00, "Upright" }, - {0x15, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Damage" }, - {0x16, 0x01, 0x18, 0x10, "Small" }, - {0x16, 0x01, 0x18, 0x18, "Normal" }, - {0x16, 0x01, 0x18, 0x08, "Big" }, - {0x16, 0x01, 0x18, 0x00, "Biggest" }, - - {0 , 0xfe, 0 , 2 , "Game Type" }, - {0x16, 0x01, 0x80, 0x00, "1 Player Only" }, - {0x16, 0x01, 0x80, 0x80, "Multiplayer" }, -}; - -STDDIPINFO(Deadconx) - -static struct BurnDIPInfo DeadconxjDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfe, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x15, 0x01, 0x01, 0x00, "Upright" }, - {0x15, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x0c, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x03, 0x02, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x03, 0x01, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Damage" }, - {0x16, 0x01, 0x18, 0x10, "Small" }, - {0x16, 0x01, 0x18, 0x18, "Normal" }, - {0x16, 0x01, 0x18, 0x08, "Big" }, - {0x16, 0x01, 0x18, 0x00, "Biggest" }, - - {0 , 0xfe, 0 , 2 , "Game Type" }, - {0x16, 0x01, 0x80, 0x00, "1 Player Only" }, - {0x16, 0x01, 0x80, 0x80, "Multiplayer" }, -}; - -STDDIPINFO(Deadconxj) - -static struct BurnDIPInfo DinorexDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Damage" }, - {0x16, 0x01, 0x0c, 0x08, "Small" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Big" }, - {0x16, 0x01, 0x0c, 0x00, "Biggest" }, - - {0 , 0xfe, 0 , 2 , "Timer Speed" }, - {0x16, 0x01, 0x10, 0x10, "Normal" }, - {0x16, 0x01, 0x10, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Match Type" }, - {0x16, 0x01, 0x20, 0x20, "Best of 3" }, - {0x16, 0x01, 0x20, 0x00, "Single" }, - - {0 , 0xfe, 0 , 2 , "2 Player Mode" }, - {0x16, 0x01, 0x40, 0x40, "Upright" }, - {0x16, 0x01, 0x40, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x16, 0x01, 0x80, 0x00, "Single" }, - {0x16, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Dinorex) - -static struct BurnDIPInfo DinorexjDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x0c, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x03, 0x02, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x03, 0x01, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Damage" }, - {0x16, 0x01, 0x0c, 0x08, "Small" }, - {0x16, 0x01, 0x0c, 0x0c, "Normal" }, - {0x16, 0x01, 0x0c, 0x04, "Big" }, - {0x16, 0x01, 0x0c, 0x00, "Biggest" }, - - {0 , 0xfe, 0 , 2 , "Timer Speed" }, - {0x16, 0x01, 0x10, 0x10, "Normal" }, - {0x16, 0x01, 0x10, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Match Type" }, - {0x16, 0x01, 0x20, 0x20, "Best of 3" }, - {0x16, 0x01, 0x20, 0x00, "Single" }, - - {0 , 0xfe, 0 , 2 , "2 Player Mode" }, - {0x16, 0x01, 0x40, 0x40, "Upright" }, - {0x16, 0x01, 0x40, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x16, 0x01, 0x80, 0x00, "Single" }, - {0x16, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Dinorexj) - -static struct BurnDIPInfo DondokodDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "10k and 100k" }, - {0x14, 0x01, 0x0c, 0x08, "10k and 150k" }, - {0x14, 0x01, 0x0c, 0x04, "10k and 250k" }, - {0x14, 0x01, 0x0c, 0x00, "10k and 350k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, -}; - -STDDIPINFO(Dondokod) - -static struct BurnDIPInfo DondokodjDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "10k and 100k" }, - {0x14, 0x01, 0x0c, 0x08, "10k and 150k" }, - {0x14, 0x01, 0x0c, 0x04, "10k and 250k" }, - {0x14, 0x01, 0x0c, 0x00, "10k and 350k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, -}; - -STDDIPINFO(Dondokodj) - -static struct BurnDIPInfo DondokoduDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "Same as start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "10k and 100k" }, - {0x14, 0x01, 0x0c, 0x08, "10k and 150k" }, - {0x14, 0x01, 0x0c, 0x04, "10k and 250k" }, - {0x14, 0x01, 0x0c, 0x00, "10k and 350k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, -}; - -STDDIPINFO(Dondokodu) - -static struct BurnDIPInfo DriftoutDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0xff, NULL }, - {0x0d, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0c, 0x01, 0x02, 0x02, "Off" }, - {0x0c, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x04, 0x04, "Off" }, - {0x0c, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0c, 0x01, 0x08, 0x00, "Off" }, - {0x0c, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0c, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, - {0x0c, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0c, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0c, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0c, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0c, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0c, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0c, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0d, 0x01, 0x03, 0x02, "Easy" }, - {0x0d, 0x01, 0x03, 0x03, "Medium" }, - {0x0d, 0x01, 0x03, 0x01, "Hard" }, - {0x0d, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Control" }, - {0x0d, 0x01, 0x0c, 0x0c, "Joystick" }, - {0x0d, 0x01, 0x0c, 0x08, "Paddle" }, - {0x0d, 0x01, 0x0c, 0x04, "Joystick" }, - {0x0d, 0x01, 0x0c, 0x00, "Steering Wheel" }, -}; - -STDDIPINFO(Driftout) - -static struct BurnDIPInfo FinalbDIPList[]= -{ - // Default Values - {0x19, 0xff, 0xff, 0xff, NULL }, - {0x1a, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Alternate Controls" }, - {0x19, 0x01, 0x01, 0x01, "Off" }, - {0x19, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x19, 0x01, 0x02, 0x02, "Off" }, - {0x19, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x19, 0x01, 0x04, 0x04, "Off" }, - {0x19, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x19, 0x01, 0x08, 0x00, "Off" }, - {0x19, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x19, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x19, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x19, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x19, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x19, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x19, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x19, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x19, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x1a, 0x01, 0x03, 0x02, "Easy" }, - {0x1a, 0x01, 0x03, 0x03, "Medium" }, - {0x1a, 0x01, 0x03, 0x01, "Hard" }, - {0x1a, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Finalb) - -static struct BurnDIPInfo FinalbjDIPList[]= -{ - // Default Values - {0x19, 0xff, 0xff, 0xff, NULL }, - {0x1a, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Alternate Controls" }, - {0x19, 0x01, 0x01, 0x01, "Off" }, - {0x19, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x19, 0x01, 0x02, 0x02, "Off" }, - {0x19, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x19, 0x01, 0x04, 0x04, "Off" }, - {0x19, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x19, 0x01, 0x08, 0x00, "Off" }, - {0x19, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x19, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, - {0x19, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x19, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x19, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x19, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x19, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x19, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x19, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x1a, 0x01, 0x03, 0x02, "Easy" }, - {0x1a, 0x01, 0x03, 0x03, "Medium" }, - {0x1a, 0x01, 0x03, 0x01, "Hard" }, - {0x1a, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Finalbj) - -static struct BurnDIPInfo FootchmpDIPList[]= -{ - // Default Values - {0x25, 0xff, 0xff, 0xfe, NULL }, - {0x26, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Game Over Type" }, - {0x25, 0x01, 0x01, 0x01, "Both Teams' Games Over" }, - {0x25, 0x01, 0x01, 0x00, "Losing Team's Game is Over" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x25, 0x01, 0x02, 0x02, "Off" }, - {0x25, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x25, 0x01, 0x04, 0x04, "Off" }, - {0x25, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x25, 0x01, 0x08, 0x00, "Off" }, - {0x25, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x25, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x25, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x25, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x25, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x25, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x25, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x25, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x25, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x26, 0x01, 0x03, 0x02, "Easy" }, - {0x26, 0x01, 0x03, 0x03, "Normal" }, - {0x26, 0x01, 0x03, 0x01, "Hard" }, - {0x26, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Game Time" }, - {0x26, 0x01, 0x0c, 0x00, "1 minute 30 seconds" }, - {0x26, 0x01, 0x0c, 0x0c, "2 minutes" }, - {0x26, 0x01, 0x0c, 0x04, "2 minutes 30 seconds" }, - {0x26, 0x01, 0x0c, 0x08, "3 minutes" }, - - {0 , 0xfe, 0 , 4 , "Cabinet" }, - {0x26, 0x01, 0x30, 0x30, "2 Players" }, - {0x26, 0x01, 0x30, 0x20, "4 Players / 4 Coin Slots" }, - {0x26, 0x01, 0x30, 0x10, "4 Players / 2 Cabinets Combined"}, - {0x26, 0x01, 0x30, 0x00, "4 Players / 2 Coin Slots" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x26, 0x01, 0x40, 0x00, "Off" }, - {0x26, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Game Version" }, - {0x26, 0x01, 0x80, 0x00, "Normal" }, - {0x26, 0x01, 0x80, 0x80, "European" }, - -}; - -STDDIPINFO(Footchmp) - -static struct BurnDIPInfo HtheroDIPList[]= -{ - // Default Values - {0x25, 0xff, 0xff, 0x7f, NULL }, - {0x26, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Game Over Type" }, - {0x25, 0x01, 0x80, 0x80, "Both Teams' Games Over" }, - {0x25, 0x01, 0x80, 0x00, "Losing Team's Game is Over" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x25, 0x01, 0x40, 0x40, "Off" }, - {0x25, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x25, 0x01, 0x20, 0x20, "Off" }, - {0x25, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x25, 0x01, 0x10, 0x00, "Off" }, - {0x25, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x25, 0x01, 0x0c, 0x00, "3 Coins 1 Credit" }, - {0x25, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, - {0x25, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - {0x25, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x25, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, - {0x25, 0x01, 0x03, 0x02, "2 Coins 1 Credit" }, - {0x25, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x25, 0x01, 0x03, 0x01, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x26, 0x01, 0xc0, 0x40, "Easy" }, - {0x26, 0x01, 0xc0, 0xc0, "Normal" }, - {0x26, 0x01, 0xc0, 0x80, "Hard" }, - {0x26, 0x01, 0xc0, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Game Time" }, - {0x26, 0x01, 0x30, 0x00, "1 minute 30 seconds" }, - {0x26, 0x01, 0x30, 0x30, "2 minutes" }, - {0x26, 0x01, 0x30, 0x20, "2 minutes 30 seconds" }, - {0x26, 0x01, 0x30, 0x10, "3 minutes" }, - - {0 , 0xfe, 0 , 4 , "Cabinet" }, - {0x26, 0x01, 0x0c, 0x0c, "2 Players" }, - {0x26, 0x01, 0x0c, 0x04, "4 Players / 4 Coin Slots" }, - {0x26, 0x01, 0x0c, 0x08, "4 Players / 2 Cabinets Combined"}, - {0x26, 0x01, 0x0c, 0x00, "4 Players / 2 Coin Slots" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x26, 0x01, 0x02, 0x00, "Off" }, - {0x26, 0x01, 0x02, 0x02, "On" }, -}; - -STDDIPINFO(Hthero) - -static struct BurnDIPInfo GrowlDIPList[]= -{ - // Default Values - {0x28, 0xff, 0xff, 0xff, NULL }, - {0x29, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x28, 0x01, 0x02, 0x02, "Off" }, - {0x28, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x28, 0x01, 0x04, 0x04, "Off" }, - {0x28, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x28, 0x01, 0x08, 0x00, "Off" }, - {0x28, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x28, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x28, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x28, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x28, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x28, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x28, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x28, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x28, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x29, 0x01, 0x03, 0x02, "Easy" }, - {0x29, 0x01, 0x03, 0x03, "Normal" }, - {0x29, 0x01, 0x03, 0x01, "Hard" }, - {0x29, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Cabinet Type" }, - {0x29, 0x01, 0x30, 0x30, "2 Players" }, - {0x29, 0x01, 0x30, 0x20, "4 Players / 4 Coin Slots" }, - {0x29, 0x01, 0x30, 0x10, "4 Players / 2 Cabinets Combined"}, - {0x29, 0x01, 0x30, 0x00, "4 Players / 2 Coin Slots" }, - - {0 , 0xfe, 0 , 2 , "Final Boss Continue" }, - {0x29, 0x01, 0x40, 0x00, "Off" }, - {0x29, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Growl) - -static struct BurnDIPInfo GrowluDIPList[]= -{ - // Default Values - {0x28, 0xff, 0xff, 0xff, NULL }, - {0x29, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x28, 0x01, 0x02, 0x02, "Off" }, - {0x28, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x28, 0x01, 0x04, 0x04, "Off" }, - {0x28, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x28, 0x01, 0x08, 0x00, "Off" }, - {0x28, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x28, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x28, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x28, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x28, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x28, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x28, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x28, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x28, 0x01, 0xc0, 0xc0, "Same as start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x29, 0x01, 0x03, 0x02, "Easy" }, - {0x29, 0x01, 0x03, 0x03, "Normal" }, - {0x29, 0x01, 0x03, 0x01, "Hard" }, - {0x29, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Cabinet Type" }, - {0x29, 0x01, 0x30, 0x30, "2 Players" }, - {0x29, 0x01, 0x30, 0x20, "4 Players / 4 Coin Slots" }, - {0x29, 0x01, 0x30, 0x10, "4 Players / 2 Cabinets Combined"}, - {0x29, 0x01, 0x30, 0x00, "4 Players / 2 Coin Slots" }, - - {0 , 0xfe, 0 , 2 , "Final Boss Continue" }, - {0x29, 0x01, 0x40, 0x00, "Off" }, - {0x29, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Growlu) - -static struct BurnDIPInfo RunarkDIPList[]= -{ - // Default Values - {0x28, 0xff, 0xff, 0xff, NULL }, - {0x29, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x28, 0x01, 0x02, 0x02, "Off" }, - {0x28, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x28, 0x01, 0x04, 0x04, "Off" }, - {0x28, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x28, 0x01, 0x08, 0x00, "Off" }, - {0x28, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x28, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x28, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x28, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x28, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x28, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x28, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x28, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x28, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x29, 0x01, 0x03, 0x02, "Easy" }, - {0x29, 0x01, 0x03, 0x03, "Normal" }, - {0x29, 0x01, 0x03, 0x01, "Hard" }, - {0x29, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Cabinet Type" }, - {0x29, 0x01, 0x30, 0x30, "2 Players" }, - {0x29, 0x01, 0x30, 0x20, "4 Players / 4 Coin Slots" }, - {0x29, 0x01, 0x30, 0x10, "4 Players / 2 Cabinets Combined"}, - {0x29, 0x01, 0x30, 0x00, "4 Players / 2 Coin Slots" }, - - {0 , 0xfe, 0 , 2 , "Final Boss Continue" }, - {0x29, 0x01, 0x40, 0x00, "Off" }, - {0x29, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Runark) - -static struct BurnDIPInfo GunfrontDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "10k and every 80k" }, - {0x14, 0x01, 0x0c, 0x0c, "20k and every 80k" }, - {0x14, 0x01, 0x0c, 0x04, "30k and every 80k" }, - {0x14, 0x01, 0x0c, 0x00, "60k and every 80k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x20, "1" }, - {0x14, 0x01, 0x30, 0x10, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x14, 0x01, 0x80, 0x00, "Single" }, - {0x14, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Gunfront) - -static struct BurnDIPInfo GunfrontjDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "10k and every 80k" }, - {0x14, 0x01, 0x0c, 0x0c, "20k and every 80k" }, - {0x14, 0x01, 0x0c, 0x04, "30k and every 80k" }, - {0x14, 0x01, 0x0c, 0x00, "60k and every 80k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x20, "1" }, - {0x14, 0x01, 0x30, 0x10, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x14, 0x01, 0x80, 0x00, "Single" }, - {0x14, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Gunfrontj) - -static struct BurnDIPInfo KoshienDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Timer" }, - {0x16, 0x01, 0x04, 0x00, "Off" }, - {0x16, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x20, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x10, "4" }, - {0x16, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x40, 0x00, "Off" }, - {0x16, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x16, 0x01, 0x80, 0x00, "Single" }, - {0x16, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Koshien) - -static struct BurnDIPInfo LiquidkDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "30k and 100k" }, - {0x14, 0x01, 0x0c, 0x08, "30k and 150k" }, - {0x14, 0x01, 0x0c, 0x04, "50k and 250k" }, - {0x14, 0x01, 0x0c, 0x00, "50k and 350k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x14, 0x01, 0x80, 0x80, "Single" }, - {0x14, 0x01, 0x80, 0x00, "Dual" }, -}; - -STDDIPINFO(Liquidk) - -static struct BurnDIPInfo LiquidkuDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "Same as start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "30k and 100k" }, - {0x14, 0x01, 0x0c, 0x08, "30k and 150k" }, - {0x14, 0x01, 0x0c, 0x04, "50k and 250k" }, - {0x14, 0x01, 0x0c, 0x00, "50k and 350k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x00, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x14, 0x01, 0x80, 0x80, "Single" }, - {0x14, 0x01, 0x80, 0x00, "Dual" }, -}; - -STDDIPINFO(Liquidku) - -static struct BurnDIPInfo MegablstDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "100k only" }, - {0x14, 0x01, 0x0c, 0x04, "150k only" }, - {0x14, 0x01, 0x0c, 0x08, "200k only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x10, "1" }, - {0x14, 0x01, 0x30, 0x00, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x14, 0x01, 0x40, 0x00, "Single" }, - {0x14, 0x01, 0x40, 0x40, "Dual" }, -}; - -STDDIPINFO(Megablst) - -static struct BurnDIPInfo MegablstjDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "100k only" }, - {0x14, 0x01, 0x0c, 0x04, "150k only" }, - {0x14, 0x01, 0x0c, 0x08, "200k only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x10, "1" }, - {0x14, 0x01, 0x30, 0x00, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x14, 0x01, 0x40, 0x00, "Single" }, - {0x14, 0x01, 0x40, 0x40, "Dual" }, -}; - -STDDIPINFO(Megablstj) - -static struct BurnDIPInfo MegablstuDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "Same as start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "100k only" }, - {0x14, 0x01, 0x0c, 0x04, "150k only" }, - {0x14, 0x01, 0x0c, 0x08, "200k only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x10, "1" }, - {0x14, 0x01, 0x30, 0x00, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x14, 0x01, 0x40, 0x00, "Single" }, - {0x14, 0x01, 0x40, 0x40, "Dual" }, -}; - -STDDIPINFO(Megablstu) - -static struct BurnDIPInfo MetalbDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x08, "50k and every 120k" }, - {0x16, 0x01, 0x0c, 0x0c, "70k and every 150k" }, - {0x16, 0x01, 0x0c, 0x04, "80k and every 160k" }, - {0x16, 0x01, 0x0c, 0x00, "100k and every 200k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x00, "1" }, - {0x16, 0x01, 0x30, 0x10, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x40, 0x00, "Off" }, - {0x16, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x16, 0x01, 0x80, 0x00, "Single" }, - {0x16, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Metalb) - -static struct BurnDIPInfo MetalbjDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x08, "50k and every 120k" }, - {0x16, 0x01, 0x0c, 0x0c, "70k and every 150k" }, - {0x16, 0x01, 0x0c, 0x04, "80k and every 160k" }, - {0x16, 0x01, 0x0c, 0x00, "100k and every 200k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x00, "1" }, - {0x16, 0x01, 0x30, 0x10, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x40, 0x00, "Off" }, - {0x16, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x16, 0x01, 0x80, 0x00, "Single" }, - {0x16, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Metalbj) - -static struct BurnDIPInfo MjnquestDIPList[]= -{ - // Default Values - {0x19, 0xff, 0xff, 0xff, NULL }, - {0x1a, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x19, 0x01, 0x02, 0x02, "Off" }, - {0x19, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x19, 0x01, 0x04, 0x04, "Off" }, - {0x19, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x19, 0x01, 0x08, 0x00, "Off" }, - {0x19, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x19, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x19, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x19, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x19, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x19, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x19, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x19, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x19, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x1a, 0x01, 0x03, 0x02, "Easy" }, - {0x1a, 0x01, 0x03, 0x03, "Medium" }, - {0x1a, 0x01, 0x03, 0x01, "Hard" }, - {0x1a, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Mjnquest) - -static struct BurnDIPInfo NinjakDIPList[]= -{ - // Default Values - {0x24, 0xff, 0xff, 0xff, NULL }, - {0x25, 0xff, 0xff, 0xdf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x24, 0x01, 0x02, 0x02, "Off" }, - {0x24, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x24, 0x01, 0x04, 0x04, "Off" }, - {0x24, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x24, 0x01, 0x08, 0x00, "Off" }, - {0x24, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x24, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x24, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x24, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x24, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x24, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x24, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x24, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x24, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x25, 0x01, 0x03, 0x02, "Easy" }, - {0x25, 0x01, 0x03, 0x03, "Medium" }, - {0x25, 0x01, 0x03, 0x01, "Hard" }, - {0x25, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Cabinet Type" }, - {0x25, 0x01, 0x0c, 0x0c, "2 Players" }, - {0x25, 0x01, 0x0c, 0x08, "TROG (4 Players / 2 Coin Slots" }, - {0x25, 0x01, 0x0c, 0x04, "MTX2 (4 Players / 2 Cabinets" }, - {0x25, 0x01, 0x0c, 0x00, "YMNT (4 Players / 4 Coin Slots" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x25, 0x01, 0x30, 0x20, "2" }, - {0x25, 0x01, 0x30, 0x30, "3" }, - {0x25, 0x01, 0x30, 0x10, "4" }, - {0x25, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x25, 0x01, 0x40, 0x00, "Off" }, - {0x25, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Game Type" }, - {0x25, 0x01, 0x80, 0x00, "1 Player Only" }, - {0x25, 0x01, 0x80, 0x80, "Multiplayer" }, -}; - -STDDIPINFO(Ninjak) - -static struct BurnDIPInfo NinjakjDIPList[]= -{ - // Default Values - {0x24, 0xff, 0xff, 0xff, NULL }, - {0x25, 0xff, 0xff, 0xdf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x24, 0x01, 0x02, 0x02, "Off" }, - {0x24, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x24, 0x01, 0x04, 0x04, "Off" }, - {0x24, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x24, 0x01, 0x08, 0x00, "Off" }, - {0x24, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x24, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x24, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x24, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x24, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x24, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x24, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x24, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x24, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x25, 0x01, 0x03, 0x02, "Easy" }, - {0x25, 0x01, 0x03, 0x03, "Medium" }, - {0x25, 0x01, 0x03, 0x01, "Hard" }, - {0x25, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Cabinet Type" }, - {0x25, 0x01, 0x0c, 0x0c, "2 Players" }, - {0x25, 0x01, 0x0c, 0x08, "TROG (4 Players / 2 Coin Slots" }, - {0x25, 0x01, 0x0c, 0x04, "MTX2 (4 Players / 2 Cabinets" }, - {0x25, 0x01, 0x0c, 0x00, "YMNT (4 Players / 4 Coin Slots" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x25, 0x01, 0x30, 0x20, "2" }, - {0x25, 0x01, 0x30, 0x30, "3" }, - {0x25, 0x01, 0x30, 0x10, "4" }, - {0x25, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x25, 0x01, 0x40, 0x00, "Off" }, - {0x25, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Game Type" }, - {0x25, 0x01, 0x80, 0x00, "1 Player Only" }, - {0x25, 0x01, 0x80, 0x80, "Multiplayer" }, -}; - -STDDIPINFO(Ninjakj) - -static struct BurnDIPInfo NinjakuDIPList[]= -{ - // Default Values - {0x24, 0xff, 0xff, 0xff, NULL }, - {0x25, 0xff, 0xff, 0xdf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x24, 0x01, 0x02, 0x02, "Off" }, - {0x24, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x24, 0x01, 0x04, 0x04, "Off" }, - {0x24, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x24, 0x01, 0x08, 0x00, "Off" }, - {0x24, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x24, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x24, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x24, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x24, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x24, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x24, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x24, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x24, 0x01, 0xc0, 0xc0, "Same as start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x25, 0x01, 0x03, 0x02, "Easy" }, - {0x25, 0x01, 0x03, 0x03, "Medium" }, - {0x25, 0x01, 0x03, 0x01, "Hard" }, - {0x25, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Cabinet Type" }, - {0x25, 0x01, 0x0c, 0x0c, "2 Players" }, - {0x25, 0x01, 0x0c, 0x08, "TROG (4 Players / 2 Coin Slots" }, - {0x25, 0x01, 0x0c, 0x04, "MTX2 (4 Players / 2 Cabinets" }, - {0x25, 0x01, 0x0c, 0x00, "YMNT (4 Players / 4 Coin Slots" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x25, 0x01, 0x30, 0x20, "2" }, - {0x25, 0x01, 0x30, 0x30, "3" }, - {0x25, 0x01, 0x30, 0x10, "4" }, - {0x25, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x25, 0x01, 0x40, 0x00, "Off" }, - {0x25, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Game Type" }, - {0x25, 0x01, 0x80, 0x00, "1 Player Only" }, - {0x25, 0x01, 0x80, 0x80, "Multiplayer" }, -}; - -STDDIPINFO(Ninjaku) - -static struct BurnDIPInfo PulirulaDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 3 , "Magic" }, - {0x16, 0x01, 0x0c, 0x0c, "3" }, - {0x16, 0x01, 0x0c, 0x08, "4" }, - {0x16, 0x01, 0x0c, 0x04, "5" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x20, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x10, "4" }, - {0x16, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x16, 0x01, 0x80, 0x00, "Single" }, - {0x16, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Pulirula) - -static struct BurnDIPInfo PulirulajDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 3 , "Magic" }, - {0x16, 0x01, 0x0c, 0x0c, "3" }, - {0x16, 0x01, 0x0c, 0x08, "4" }, - {0x16, 0x01, 0x0c, 0x04, "5" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x20, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x10, "4" }, - {0x16, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x16, 0x01, 0x80, 0x00, "Single" }, - {0x16, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Pulirulaj) - -static struct BurnDIPInfo QcrayonDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Default Time" }, - {0x12, 0x01, 0x0c, 0x00, "6 seconds" }, - {0x12, 0x01, 0x0c, 0x04, "7 seconds" }, - {0x12, 0x01, 0x0c, 0x08, "8 seconds" }, - {0x12, 0x01, 0x0c, 0x0c, "10 seconds" }, -}; - -STDDIPINFO(Qcrayon) - -static struct BurnDIPInfo Qcrayon2DIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Game Control" }, - {0x12, 0x01, 0x80, 0x80, "Joystick" }, - {0x12, 0x01, 0x80, 0x00, "4 Buttons" }, -}; - -STDDIPINFO(Qcrayon2) - -static struct BurnDIPInfo QjinseiDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Qjinsei) - -static struct BurnDIPInfo QtorimonDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x02, 0x02, "Off" }, - {0x0f, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0f, 0x01, 0x04, 0x04, "Off" }, - {0x0f, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0f, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, - {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x10, 0x01, 0x03, 0x02, "Easy" }, - {0x10, 0x01, 0x03, 0x03, "Medium" }, - {0x10, 0x01, 0x03, 0x01, "Hard" }, - {0x10, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x30, 0x10, "1" }, - {0x10, 0x01, 0x30, 0x20, "2" }, - {0x10, 0x01, 0x30, 0x30, "3" }, - {0x10, 0x01, 0x30, 0x00, "4" }, - - {0 , 0xfe, 0 , 2 , "Show Correct Answer" }, - {0x10, 0x01, 0x40, 0x40, "Off" }, - {0x10, 0x01, 0x40, 0x00, "On" }, -}; - -STDDIPINFO(Qtorimon) - -static struct BurnDIPInfo QuizhqDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Time" }, - {0x12, 0x01, 0x0c, 0x0c, "5 seconds" }, - {0x12, 0x01, 0x0c, 0x08, "10 seconds" }, - {0x12, 0x01, 0x0c, 0x04, "15 seconds" }, - {0x12, 0x01, 0x0c, 0x00, "20 seconds" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x12, 0x01, 0x30, 0x20, "1" }, - {0x12, 0x01, 0x30, 0x30, "2" }, - {0x12, 0x01, 0x30, 0x10, "3" }, - {0x12, 0x01, 0x30, 0x00, "4" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x12, 0x01, 0x40, 0x00, "Off" }, - {0x12, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x12, 0x01, 0x80, 0x00, "Single" }, - {0x12, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Quizhq) - -static struct BurnDIPInfo QzchikyuDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfe, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x01, 0x00, "Upright" }, - {0x11, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Qzchikyu) - -static struct BurnDIPInfo QzquestDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfe, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x01, 0x00, "Upright" }, - {0x11, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Qzquest) - -static struct BurnDIPInfo SolfigtrDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, -}; - -STDDIPINFO(Solfigtr) - -static struct BurnDIPInfo SsiDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Shields" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - {0x14, 0x01, 0x0c, 0x0c, "1" }, - {0x14, 0x01, 0x0c, 0x04, "2" }, - {0x14, 0x01, 0x0c, 0x08, "3" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x14, 0x01, 0x10, 0x00, "2" }, - {0x14, 0x01, 0x10, 0x10, "3" }, - - {0 , 0xfe, 0 , 4 , "2 Player Mode" }, - {0x14, 0x01, 0xa0, 0xa0, "Simultaneous" }, - {0x14, 0x01, 0xa0, 0x80, "Alternate, Single" }, - {0x14, 0x01, 0xa0, 0x00, "Alternate, Dual" }, - {0x14, 0x01, 0xa0, 0x20, "Not Allowed" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Ssi) - -static struct BurnDIPInfo Majest12DIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Shields" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - {0x14, 0x01, 0x0c, 0x0c, "1" }, - {0x14, 0x01, 0x0c, 0x04, "2" }, - {0x14, 0x01, 0x0c, 0x08, "3" }, - - {0 , 0xfe, 0 , 2 , "Lives" }, - {0x14, 0x01, 0x10, 0x00, "2" }, - {0x14, 0x01, 0x10, 0x10, "3" }, - - {0 , 0xfe, 0 , 4 , "2 Player Mode" }, - {0x14, 0x01, 0xa0, 0xa0, "Simultaneous" }, - {0x14, 0x01, 0xa0, 0x80, "Alternate, Single" }, - {0x14, 0x01, 0xa0, 0x00, "Alternate, Dual" }, - {0x14, 0x01, 0xa0, 0x20, "Not Allowed" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Majest12) - -static struct BurnDIPInfo ThundfoxDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Timer" }, - {0x16, 0x01, 0x04, 0x00, "Off" }, - {0x16, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x20, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x10, "4" }, - {0x16, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x40, 0x00, "Off" }, - {0x16, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x16, 0x01, 0x80, 0x00, "Single" }, - {0x16, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Thundfox) - -static struct BurnDIPInfo ThundfoxjDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Timer" }, - {0x16, 0x01, 0x04, 0x00, "Off" }, - {0x16, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x20, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x10, "4" }, - {0x16, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x40, 0x00, "Off" }, - {0x16, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x16, 0x01, 0x80, 0x00, "Single" }, - {0x16, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Thundfoxj) - -static struct BurnDIPInfo ThundfoxuDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xc0, 0xc0, "Same as start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Timer" }, - {0x16, 0x01, 0x04, 0x00, "Off" }, - {0x16, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x20, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x10, "4" }, - {0x16, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x40, 0x00, "Off" }, - {0x16, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Upright Controls" }, - {0x16, 0x01, 0x80, 0x00, "Single" }, - {0x16, 0x01, 0x80, 0x80, "Dual" }, -}; - -STDDIPINFO(Thundfoxu) - -static struct BurnDIPInfo YesnojDIPList[]= -{ - // Default Values - {0x09, 0xff, 0xff, 0xff, NULL }, - {0x0a, 0xff, 0xff, 0xfe, NULL }, - - // Dip 1 - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Results Printer" }, - {0x0a, 0x01, 0x01, 0x00, "Off" }, - {0x0a, 0x01, 0x01, 0x01, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0a, 0x01, 0x02, 0x00, "Off" }, - {0x0a, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0a, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0a, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0a, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0a, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, -}; - -STDDIPINFO(Yesnoj) - -static struct BurnDIPInfo YuyugogoDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xff, NULL }, - {0x12, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x03, 0x02, "Easy" }, - {0x12, 0x01, 0x03, 0x03, "Medium" }, - {0x12, 0x01, 0x03, 0x01, "Hard" }, - {0x12, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x12, 0x01, 0x40, 0x00, "Off" }, - {0x12, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Yuyugogo) - -static struct BurnRomInfo CameltryRomDesc[] = { - { "c38-11", 0x020000, 0xbe172da0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c38-14", 0x020000, 0xffa430de, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c38-08.bin", 0x010000, 0x7ff78873, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c38-01.bin", 0x080000, 0xc170ff36, BRF_GRA | TAITO_SPRITESA }, - - { "c38-03.bin", 0x020000, 0x59fa59a7, BRF_SND | TAITO_YM2610A }, - - { "c38-02.bin", 0x020000, 0x1a11714b, BRF_GRA | TAITO_CHARS_PIVOT }, -}; - -STD_ROM_PICK(Cameltry) -STD_ROM_FN(Cameltry) - -static struct BurnRomInfo CameltryauRomDesc[] = { - { "c38-11", 0x020000, 0xbe172da0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c38-14", 0x020000, 0xffa430de, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c38-15.bin", 0x010000, 0x0e60faac, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c38-01.bin", 0x080000, 0xc170ff36, BRF_GRA | TAITO_SPRITESA }, - - { "c38-02.bin", 0x020000, 0x1a11714b, BRF_GRA | TAITO_CHARS_PIVOT }, - - { "c38-04.bin", 0x020000, 0x53d330bb, BRF_SND | TAITO_MSM6295 }, -}; - -STD_ROM_PICK(Cameltryau) -STD_ROM_FN(Cameltryau) - -static struct BurnRomInfo CameltryaRomDesc[] = { - { "c38-11", 0x020000, 0xbe172da0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c38-16", 0x020000, 0x66ad6164, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c38-15.bin", 0x010000, 0x0e60faac, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c38-01.bin", 0x080000, 0xc170ff36, BRF_GRA | TAITO_SPRITESA }, - - { "c38-02.bin", 0x020000, 0x1a11714b, BRF_GRA | TAITO_CHARS_PIVOT }, - - { "c38-04.bin", 0x020000, 0x53d330bb, BRF_SND | TAITO_MSM6295 }, -}; - -STD_ROM_PICK(Cameltrya) -STD_ROM_FN(Cameltrya) - -static struct BurnRomInfo CameltryjRomDesc[] = { - { "c38-09.bin", 0x020000, 0x2ae01120, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c38-10.bin", 0x020000, 0x48d8ff56, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c38-08.bin", 0x010000, 0x7ff78873, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c38-01.bin", 0x080000, 0xc170ff36, BRF_GRA | TAITO_SPRITESA }, - - { "c38-03.bin", 0x020000, 0x59fa59a7, BRF_SND | TAITO_YM2610A }, - - { "c38-02.bin", 0x020000, 0x1a11714b, BRF_GRA | TAITO_CHARS_PIVOT }, -}; - -STD_ROM_PICK(Cameltryj) -STD_ROM_FN(Cameltryj) - -static struct BurnRomInfo DeadconxRomDesc[] = { - { "d28-06.3", 0x040000, 0x5b4bff51, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d28-12.5", 0x040000, 0x9b74e631, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d28-09.2", 0x040000, 0x143a0cc1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d28-08.4", 0x040000, 0x4c872bd9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "d28-10.6", 0x010000, 0x40805d74, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d28-04.16", 0x080000, 0xdcabc26b, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "d28-05.17", 0x080000, 0x862f9665, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "d28-01.8", 0x100000, 0x181d7b69, BRF_GRA | TAITO_SPRITESA }, - { "d28-02.9", 0x100000, 0xd301771c, BRF_GRA | TAITO_SPRITESA }, - - { "d28-03.10", 0x100000, 0xa1804b52, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Deadconx) -STD_ROM_FN(Deadconx) - -static struct BurnRomInfo DeadconxjRomDesc[] = { - { "d28-06.3", 0x040000, 0x5b4bff51, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d28-07.5", 0x040000, 0x3fb8954c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d28-09.2", 0x040000, 0x143a0cc1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d28-08.4", 0x040000, 0x4c872bd9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "d28-10.6", 0x010000, 0x40805d74, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d28-04.16", 0x080000, 0xdcabc26b, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "d28-05.17", 0x080000, 0x862f9665, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "d28-01.8", 0x100000, 0x181d7b69, BRF_GRA | TAITO_SPRITESA }, - { "d28-02.9", 0x100000, 0xd301771c, BRF_GRA | TAITO_SPRITESA }, - - { "d28-03.10", 0x100000, 0xa1804b52, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Deadconxj) -STD_ROM_FN(Deadconxj) - -static struct BurnRomInfo DinorexRomDesc[] = { - { "d39-14.9", 0x080000, 0xe6aafdac, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d39-16.8", 0x080000, 0xcedc8537, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d39-04.6", 0x100000, 0x3800506d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - { "d39-05.7", 0x100000, 0xe2ec3b5d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "d39-12.5", 0x010000, 0x8292c7c1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d39-06.2", 0x100000, 0x52f62835, BRF_GRA | TAITO_CHARS }, - - { "d39-01.29", 0x200000, 0xd10e9c7d, BRF_GRA | TAITO_SPRITESA }, - { "d39-02.28", 0x200000, 0x6c304403, BRF_GRA | TAITO_SPRITESA }, - { "d39-03.27", 0x200000, 0xfc9cdab4, BRF_GRA | TAITO_SPRITESA }, - - { "d39-07.10", 0x100000, 0x28262816, BRF_SND | TAITO_YM2610A }, - { "d39-08.4", 0x080000, 0x377b8b7b, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Dinorex) -STD_ROM_FN(Dinorex) - -static struct BurnRomInfo DinorexjRomDesc[] = { - { "d39-14.9", 0x080000, 0xe6aafdac, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d39-13.8", 0x080000, 0xae496b2f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d39-04.6", 0x100000, 0x3800506d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - { "d39-05.7", 0x100000, 0xe2ec3b5d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "d39-12.5", 0x010000, 0x8292c7c1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d39-06.2", 0x100000, 0x52f62835, BRF_GRA | TAITO_CHARS }, - - { "d39-01.29", 0x200000, 0xd10e9c7d, BRF_GRA | TAITO_SPRITESA }, - { "d39-02.28", 0x200000, 0x6c304403, BRF_GRA | TAITO_SPRITESA }, - { "d39-03.27", 0x200000, 0xfc9cdab4, BRF_GRA | TAITO_SPRITESA }, - - { "d39-07.10", 0x100000, 0x28262816, BRF_SND | TAITO_YM2610A }, - { "d39-08.4", 0x080000, 0x377b8b7b, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Dinorexj) -STD_ROM_FN(Dinorexj) - -static struct BurnRomInfo DinorexuRomDesc[] = { - { "d39-14.9", 0x080000, 0xe6aafdac, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d39-15.8", 0x080000, 0xfe96723b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d39-04.6", 0x100000, 0x3800506d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - { "d39-05.7", 0x100000, 0xe2ec3b5d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "d39-12.5", 0x010000, 0x8292c7c1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d39-06.2", 0x100000, 0x52f62835, BRF_GRA | TAITO_CHARS }, - - { "d39-01.29", 0x200000, 0xd10e9c7d, BRF_GRA | TAITO_SPRITESA }, - { "d39-02.28", 0x200000, 0x6c304403, BRF_GRA | TAITO_SPRITESA }, - { "d39-03.27", 0x200000, 0xfc9cdab4, BRF_GRA | TAITO_SPRITESA }, - - { "d39-07.10", 0x100000, 0x28262816, BRF_SND | TAITO_YM2610A }, - { "d39-08.4", 0x080000, 0x377b8b7b, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Dinorexu) -STD_ROM_FN(Dinorexu) - -static struct BurnRomInfo DondokodRomDesc[] = { - { "b95-12.bin", 0x020000, 0xd0fce87a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b95-11-1.bin", 0x020000, 0xdad40cd3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b95-10.bin", 0x020000, 0xa46e1f0b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b95-14.bin", 0x020000, 0x6e4e1351, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b95-08.bin", 0x010000, 0xb5aa49e1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b95-02.bin", 0x080000, 0x67b4e979, BRF_GRA | TAITO_CHARS }, - - { "b95-01.bin", 0x080000, 0x51c176ce, BRF_GRA | TAITO_SPRITESA }, - - { "b95-04.bin", 0x080000, 0xac4c1716, BRF_SND | TAITO_YM2610A }, - - { "b95-03.bin", 0x080000, 0x543aa0d1, BRF_GRA | TAITO_CHARS_PIVOT }, -}; - -STD_ROM_PICK(Dondokod) -STD_ROM_FN(Dondokod) - -static struct BurnRomInfo DondokodjRomDesc[] = { - { "b95-12.bin", 0x020000, 0xd0fce87a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b95-11-1.bin", 0x020000, 0xdad40cd3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b95-10.bin", 0x020000, 0xa46e1f0b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b95-09.bin", 0x020000, 0xd8c86d39, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b95-08.bin", 0x010000, 0xb5aa49e1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b95-02.bin", 0x080000, 0x67b4e979, BRF_GRA | TAITO_CHARS }, - - { "b95-01.bin", 0x080000, 0x51c176ce, BRF_GRA | TAITO_SPRITESA }, - - { "b95-04.bin", 0x080000, 0xac4c1716, BRF_SND | TAITO_YM2610A }, - - { "b95-03.bin", 0x080000, 0x543aa0d1, BRF_GRA | TAITO_CHARS_PIVOT }, -}; - -STD_ROM_PICK(Dondokodj) -STD_ROM_FN(Dondokodj) - -static struct BurnRomInfo DondokoduRomDesc[] = { - { "b95-12.bin", 0x020000, 0xd0fce87a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b95-11-1.bin", 0x020000, 0xdad40cd3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b95-10.bin", 0x020000, 0xa46e1f0b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b95-13.bin", 0x020000, 0x350d2c65, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b95-08.bin", 0x010000, 0xb5aa49e1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b95-02.bin", 0x080000, 0x67b4e979, BRF_GRA | TAITO_CHARS }, - - { "b95-01.bin", 0x080000, 0x51c176ce, BRF_GRA | TAITO_SPRITESA }, - - { "b95-04.bin", 0x080000, 0xac4c1716, BRF_SND | TAITO_YM2610A }, - - { "b95-03.bin", 0x080000, 0x543aa0d1, BRF_GRA | TAITO_CHARS_PIVOT }, -}; - -STD_ROM_PICK(Dondokodu) -STD_ROM_FN(Dondokodu) - -static struct BurnRomInfo DriftoutRomDesc[] = { - { "ic46.rom", 0x080000, 0x71303738, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "ic45.rom", 0x080000, 0x43f81eca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "do_50.rom", 0x010000, 0xffe10124, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "do_obj.rom", 0x080000, 0x5491f1c4, BRF_GRA | TAITO_SPRITESA }, - - { "do_snd.rom", 0x080000, 0xf2deb82b, BRF_SND | TAITO_YM2610A }, - - { "do_piv.rom", 0x080000, 0xc4f012f7, BRF_GRA | TAITO_CHARS_PIVOT }, -}; - -STD_ROM_PICK(Driftout) -STD_ROM_FN(Driftout) - -static struct BurnRomInfo DriftoutjRomDesc[] = { - { "do_46.rom", 0x080000, 0xf960363e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "do_45.rom", 0x080000, 0xe3fe66b9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "do_50.rom", 0x010000, 0xffe10124, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "do_obj.rom", 0x080000, 0x5491f1c4, BRF_GRA | TAITO_SPRITESA }, - - { "do_snd.rom", 0x080000, 0xf2deb82b, BRF_SND | TAITO_YM2610A }, - - { "do_piv.rom", 0x080000, 0xc4f012f7, BRF_GRA | TAITO_CHARS_PIVOT }, -}; - -STD_ROM_PICK(Driftoutj) -STD_ROM_FN(Driftoutj) - -static struct BurnRomInfo DriveoutRomDesc[] = { - { "driveout.003", 0x080000, 0xdc431e4e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "driveout.002", 0x080000, 0x6f9063f4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "driveout.020", 0x008000, 0x99aaeb2e, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "driveout.084", 0x040000, 0x530ac420, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "driveout.081", 0x040000, 0x0e9a3e9e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "do_piv.rom", 0x080000, 0xc4f012f7, BRF_GRA | TAITO_CHARS_PIVOT }, - - { "driveout.028", 0x080000, 0xcbde0b66, BRF_SND | TAITO_MSM6295 }, - { "driveout.029", 0x020000, 0x0aba2026, BRF_SND | TAITO_MSM6295 }, -}; - -STD_ROM_PICK(Driveout) -STD_ROM_FN(Driveout) - -static struct BurnRomInfo FinalbRomDesc[] = { - { "b82-09.10", 0x20000, 0x632f1ecd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b82-17.11", 0x20000, 0xe91b2ec9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b82_10.16", 0x10000, 0xa38aaaed, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b82-06.19", 0x20000, 0xfc450a25, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "b82-07.18", 0x20000, 0xec3df577, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "b82-04.4", 0x80000, 0x6346f98e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "b82-03.5", 0x80000, 0xdaa11561, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "b82-05.3", 0x80000, 0xaa90b93a, BRF_GRA | TAITO_SPRITESA }, - - { "b82-02.1", 0x80000, 0x5dd06bdd, BRF_SND | TAITO_YM2610A }, - - { "b82-01.2", 0x80000, 0xf0eb6846, BRF_SND | TAITO_YM2610B }, - - { "tibpal16l8.ic41", 0x00104, 0x11a0a19a, BRF_OPT }, - { "tibpal16l8.ic42", 0x00104, 0xcc53deb8, BRF_OPT }, - { "tibpal16l8.ic51", 0x00104, 0xf2878537, BRF_OPT }, - { "gal16v8.ic13", 0x00117, 0xa4f75fd0, BRF_OPT }, - { "gal16v8.ic35", 0x00117, 0xca4eb3e1, BRF_OPT }, -}; - -STD_ROM_PICK(Finalb) -STD_ROM_FN(Finalb) - -static struct BurnRomInfo FinalbjRomDesc[] = { - { "b82-09.10", 0x20000, 0x632f1ecd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b82-08.11", 0x20000, 0x07154fe5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b82_10.16", 0x10000, 0xa38aaaed, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b82-06.19", 0x20000, 0xfc450a25, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "b82-07.18", 0x20000, 0xec3df577, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "b82-04.4", 0x80000, 0x6346f98e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "b82-03.5", 0x80000, 0xdaa11561, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "b82-05.3", 0x80000, 0xaa90b93a, BRF_GRA | TAITO_SPRITESA }, - - { "b82-02.1", 0x80000, 0x5dd06bdd, BRF_SND | TAITO_YM2610A }, - - { "b82-01.2", 0x80000, 0xf0eb6846, BRF_SND | TAITO_YM2610B }, - - { "tibpal16l8.ic41", 0x00104, 0x11a0a19a, BRF_OPT }, - { "tibpal16l8.ic42", 0x00104, 0xcc53deb8, BRF_OPT }, - { "tibpal16l8.ic51", 0x00104, 0xf2878537, BRF_OPT }, - { "gal16v8.ic13", 0x00117, 0xa4f75fd0, BRF_OPT }, - { "gal16v8.ic35", 0x00117, 0xca4eb3e1, BRF_OPT }, -}; - -STD_ROM_PICK(Finalbj) -STD_ROM_FN(Finalbj) - -static struct BurnRomInfo FinalbuRomDesc[] = { - { "b82-09-1", 0x20000, 0x66729cb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b82-6-14", 0x20000, 0x879387fa, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b82_10.16", 0x10000, 0xa38aaaed, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b82-06.19", 0x20000, 0xfc450a25, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "b82-07.18", 0x20000, 0xec3df577, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "b82-04.4", 0x80000, 0x6346f98e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "b82-03.5", 0x80000, 0xdaa11561, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "b82-05.3", 0x80000, 0xaa90b93a, BRF_GRA | TAITO_SPRITESA }, - - { "b82-02.1", 0x80000, 0x5dd06bdd, BRF_SND | TAITO_YM2610A }, - - { "b82-01.2", 0x80000, 0xf0eb6846, BRF_SND | TAITO_YM2610B }, - - { "tibpal16l8.ic41", 0x00104, 0x11a0a19a, BRF_OPT }, - { "tibpal16l8.ic42", 0x00104, 0xcc53deb8, BRF_OPT }, - { "tibpal16l8.ic51", 0x00104, 0xf2878537, BRF_OPT }, - { "gal16v8.ic13", 0x00117, 0xa4f75fd0, BRF_OPT }, - { "gal16v8.ic35", 0x00117, 0xca4eb3e1, BRF_OPT }, -}; - -STD_ROM_PICK(Finalbu) -STD_ROM_FN(Finalbu) - -static struct BurnRomInfo FootchmpRomDesc[] = { - { "c80-11.6", 0x020000, 0xf78630fb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c80-10.4", 0x020000, 0x32c109cb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c80-12.7", 0x020000, 0x80d46fef, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c80-14.5", 0x020000, 0x40ac4828, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c80-15.70", 0x010000, 0x05aa7fd7, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c80-04.1", 0x080000, 0x9a17fe8c, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "c80-05.2", 0x080000, 0xacde7071, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "c80-01.9", 0x100000, 0xf43782e6, BRF_GRA | TAITO_SPRITESA }, - { "c80-02.10", 0x100000, 0x060a8b61, BRF_GRA | TAITO_SPRITESA }, - - { "c80-03.57", 0x100000, 0x609938d5, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Footchmp) -STD_ROM_FN(Footchmp) - -static struct BurnRomInfo HtheroRomDesc[] = { - { "c80-16.6", 0x020000, 0x4e795b52, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c80-17.4", 0x020000, 0x42c0a838, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c80-12.7", 0x020000, 0x80d46fef, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c80-18.5", 0x020000, 0xaea22904, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c80-15.70", 0x010000, 0x05aa7fd7, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c80-04.1", 0x080000, 0x9a17fe8c, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "c80-05.2", 0x080000, 0xacde7071, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "c80-01.9", 0x100000, 0xf43782e6, BRF_GRA | TAITO_SPRITESA }, - { "c80-02.10", 0x100000, 0x060a8b61, BRF_GRA | TAITO_SPRITESA }, - - { "c80-03.57", 0x100000, 0x609938d5, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Hthero) -STD_ROM_FN(Hthero) - -static struct BurnRomInfo Euroch92RomDesc[] = { - { "ec92_25.rom", 0x020000, 0x98482202, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "ec92_23.rom", 0x020000, 0xae5e75e9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "ec92_26.rom", 0x020000, 0xb986ccb2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "ec92_24.rom", 0x020000, 0xb31d94ac, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "ec92_27.rom", 0x010000, 0x2db48e65, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "ec92_21.rom", 0x080000, 0x5759ed37, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "ec92_22.rom", 0x080000, 0xd9a0d38e, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "ec92_19.rom", 0x100000, 0x219141a5, BRF_GRA | TAITO_SPRITESA }, - { "c80-02.10", 0x100000, 0x060a8b61, BRF_GRA | TAITO_SPRITESA }, - - { "c80-03.57", 0x100000, 0x609938d5, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Euroch92) -STD_ROM_FN(Euroch92) - -static struct BurnRomInfo GrowlRomDesc[] = { - { "c74-10.ic59", 0x040000, 0xca81a20b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c74-08.ic61", 0x040000, 0xaa35dd9e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c74-11.ic58", 0x040000, 0xee3bd6d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c74-14.ic60", 0x040000, 0xb6c24ec7, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c74-12.ic62", 0x010000, 0xbb6ed668, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c74-01.ic34", 0x100000, 0x3434ce80, BRF_GRA | TAITO_CHARS }, - - { "c74-03.ic12", 0x100000, 0x1a0d8951, BRF_GRA | TAITO_SPRITESA }, - { "c74-02.ic11", 0x100000, 0x15a21506, BRF_GRA | TAITO_SPRITESA }, - - { "c74-04.ic28", 0x100000, 0x2d97edf2, BRF_SND | TAITO_YM2610A }, - { "c74-05.ic29", 0x080000, 0xe29c0828, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Growl) -STD_ROM_FN(Growl) - -static struct BurnRomInfo GrowluRomDesc[] = { - { "c74-10.ic59", 0x040000, 0xca81a20b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c74-08.ic61", 0x040000, 0xaa35dd9e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c74-11.ic58", 0x040000, 0xee3bd6d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c74-13.ic60", 0x040000, 0xc1c57e51, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c74-12.ic62", 0x010000, 0xbb6ed668, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c74-01.ic34", 0x100000, 0x3434ce80, BRF_GRA | TAITO_CHARS }, - - { "c74-03.ic12", 0x100000, 0x1a0d8951, BRF_GRA | TAITO_SPRITESA }, - { "c74-02.ic11", 0x100000, 0x15a21506, BRF_GRA | TAITO_SPRITESA }, - - { "c74-04.ic28", 0x100000, 0x2d97edf2, BRF_SND | TAITO_YM2610A }, - { "c74-05.ic29", 0x080000, 0xe29c0828, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Growlu) -STD_ROM_FN(Growlu) - -static struct BurnRomInfo RunarkRomDesc[] = { - { "c74-10.ic59", 0x040000, 0xca81a20b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c74-08.ic61", 0x040000, 0xaa35dd9e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c74-11.ic58", 0x040000, 0xee3bd6d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c74-09.ic14", 0x040000, 0x58cc2feb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c74-12.ic62", 0x010000, 0xbb6ed668, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c74-01.ic34", 0x100000, 0x3434ce80, BRF_GRA | TAITO_CHARS }, - - { "c74-03.ic12", 0x100000, 0x1a0d8951, BRF_GRA | TAITO_SPRITESA }, - { "c74-02.ic11", 0x100000, 0x15a21506, BRF_GRA | TAITO_SPRITESA }, - - { "c74-04.ic28", 0x100000, 0x2d97edf2, BRF_SND | TAITO_YM2610A }, - { "c74-05.ic29", 0x080000, 0xe29c0828, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Runark) -STD_ROM_FN(Runark) - -static struct BurnRomInfo GunfrontRomDesc[] = { - { "c71-09.ic42", 0x020000, 0x10a544a2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c71-08.ic41", 0x020000, 0xc17dc0a0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c71-10.ic40", 0x020000, 0xf39c0a06, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c71-14.ic39", 0x020000, 0x312da036, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c71-16.ic38", 0x020000, 0x1bbcc2d4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c71-15.ic37", 0x020000, 0xdf3e00bb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c71-12.ic49", 0x010000, 0x0038c7f8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c71-02.ic59", 0x100000, 0x2a600c92, BRF_GRA | TAITO_CHARS }, - - { "c71-03.ic19", 0x100000, 0x9133c605, BRF_GRA | TAITO_SPRITESA }, - - { "c71-01.ic29", 0x100000, 0x0e73105a, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Gunfront) -STD_ROM_FN(Gunfront) - -static struct BurnRomInfo GunfrontjRomDesc[] = { - { "c71-09.ic42", 0x020000, 0x10a544a2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c71-08.ic41", 0x020000, 0xc17dc0a0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c71-10.ic40", 0x020000, 0xf39c0a06, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c71-11.ic39", 0x020000, 0xdf23c11a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c71-16.ic38", 0x020000, 0x1bbcc2d4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c71-15.ic37", 0x020000, 0xdf3e00bb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c71-12.ic49", 0x010000, 0x0038c7f8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c71-02.ic59", 0x100000, 0x2a600c92, BRF_GRA | TAITO_CHARS }, - - { "c71-03.ic19", 0x100000, 0x9133c605, BRF_GRA | TAITO_SPRITESA }, - - { "c71-01.ic29", 0x100000, 0x0e73105a, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Gunfrontj) -STD_ROM_FN(Gunfrontj) - -static struct BurnRomInfo KoshienRomDesc[] = { - { "c81-11.bin", 0x020000, 0xb44ea8c9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c81-10.bin", 0x020000, 0x8f98c40a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c81-04.bin", 0x080000, 0x1592b460, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "c81-12.bin", 0x010000, 0x6e8625b6, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c81-03.bin", 0x100000, 0x29bbf492, BRF_GRA | TAITO_CHARS }, - - { "c81-01.bin", 0x100000, 0x64b15d2a, BRF_GRA | TAITO_SPRITESA }, - { "c81-02.bin", 0x100000, 0x962461e8, BRF_GRA | TAITO_SPRITESA }, - - { "c81-05.bin", 0x080000, 0x9c3d71be, BRF_SND | TAITO_YM2610A }, - { "c81-06.bin", 0x080000, 0x927833b4, BRF_SND | TAITO_YM2610B }, - - { "pal16l8b-c81-07.bin",0x000104, 0x46341732, BRF_OPT }, - { "pal16l8b-c81-08.bin",0x000104, 0xe7d2d300, BRF_OPT }, - { "pal16l8b-c81-09.bin",0x000104, 0xe4c012a1, BRF_OPT }, -}; - -STD_ROM_PICK(Koshien) -STD_ROM_FN(Koshien) - -static struct BurnRomInfo LiquidkRomDesc[] = { - { "c49-09.ic47", 0x20000, 0x6ae09eb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c49-11.ic48", 0x20000, 0x42d2be6e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c49-10.ic45", 0x20000, 0x50bef2e0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c49-12.ic46", 0x20000, 0xcb16bad5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c49-08.ic32", 0x10000, 0x413c310c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c49-03.ic76", 0x80000, 0xc3364f9b, BRF_GRA | TAITO_CHARS }, - - { "c49-01.ic54", 0x80000, 0x67cc3163, BRF_GRA | TAITO_SPRITESA }, - { "c49-02.ic53", 0x80000, 0xd2400710, BRF_GRA | TAITO_SPRITESA }, - - { "c49-04.ic33", 0x80000, 0x474d45a4, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Liquidk) -STD_ROM_FN(Liquidk) - -static struct BurnRomInfo LiquidkuRomDesc[] = { - { "c49-09.ic47", 0x20000, 0x6ae09eb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c49-11.ic48", 0x20000, 0x42d2be6e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c49-10.ic45", 0x20000, 0x50bef2e0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c49-14.ic46", 0x20000, 0xbc118a43, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c49-08.ic32", 0x10000, 0x413c310c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c49-03.ic76", 0x80000, 0xc3364f9b, BRF_GRA | TAITO_CHARS }, - - { "c49-01.ic54", 0x80000, 0x67cc3163, BRF_GRA | TAITO_SPRITESA }, - { "c49-02.ic53", 0x80000, 0xd2400710, BRF_GRA | TAITO_SPRITESA }, - - { "c49-04.ic33", 0x80000, 0x474d45a4, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Liquidku) -STD_ROM_FN(Liquidku) - -static struct BurnRomInfo MizubakuRomDesc[] = { - { "c49-09.ic47", 0x20000, 0x6ae09eb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c49-11.ic48", 0x20000, 0x42d2be6e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c49-10.ic45", 0x20000, 0x50bef2e0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c49-13.ic46", 0x20000, 0x2518dbf9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c49-08.ic32", 0x10000, 0x413c310c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c49-03.ic76", 0x80000, 0xc3364f9b, BRF_GRA | TAITO_CHARS }, - - { "c49-01.ic54", 0x80000, 0x67cc3163, BRF_GRA | TAITO_SPRITESA }, - { "c49-02.ic53", 0x80000, 0xd2400710, BRF_GRA | TAITO_SPRITESA }, - - { "c49-04.ic33", 0x80000, 0x474d45a4, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Mizubaku) -STD_ROM_FN(Mizubaku) - -static struct BurnRomInfo MegablstRomDesc[] = { - { "c11-07.55", 0x020000, 0x11d228b6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c11-08.39", 0x020000, 0xa79d4dca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c11-06.54", 0x020000, 0x7c249894, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c11-11.38", 0x020000, 0x263ecbf9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c11-12.3", 0x010000, 0xb11094f1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c11-05.58", 0x080000, 0x733e6d8e, BRF_GRA | TAITO_CHARS }, - - { "c11-03.32", 0x080000, 0x46718c7a, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c11-04.31", 0x080000, 0x663f33cc, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c11-01.29", 0x080000, 0xfd1ea532, BRF_SND | TAITO_YM2610A }, - { "c11-02.30", 0x080000, 0x451cc187, BRF_SND | TAITO_YM2610B }, - - { "pal16l8b-b89-01.ic8", 0x000104, 0x4095b97a, BRF_OPT }, - { "pal16l8b-b89-02.ic28", 0x000104, 0x6430b559, BRF_OPT }, - { "pal16l8b-b89-03.bin", 0x000104, 0x634592e2, BRF_OPT }, - { "palce16v8-b89-04.ic27", 0x000117, 0xfc136ae2, BRF_OPT }, - { "pal16l8b-c11-13.ic13", 0x000104, 0x421d7ea8, BRF_OPT }, - { "pal16l8b-c11-14.ic23", 0x000104, 0x5c740aee, BRF_OPT }, -}; - -STD_ROM_PICK(Megablst) -STD_ROM_FN(Megablst) - -static struct BurnRomInfo MegablstjRomDesc[] = { - { "c11-07.55", 0x020000, 0x11d228b6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c11-08.39", 0x020000, 0xa79d4dca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c11-06.54", 0x020000, 0x7c249894, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c11-09.38", 0x020000, 0xc830aad5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c11-12.3", 0x010000, 0xb11094f1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c11-05.58", 0x080000, 0x733e6d8e, BRF_GRA | TAITO_CHARS }, - - { "c11-03.32", 0x080000, 0x46718c7a, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c11-04.31", 0x080000, 0x663f33cc, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c11-01.29", 0x080000, 0xfd1ea532, BRF_SND | TAITO_YM2610A }, - { "c11-02.30", 0x080000, 0x451cc187, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Megablstj) -STD_ROM_FN(Megablstj) - -static struct BurnRomInfo MegablstuRomDesc[] = { - { "c11-07.55", 0x020000, 0x11d228b6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c11-08.39", 0x020000, 0xa79d4dca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c11-06.54", 0x020000, 0x7c249894, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c11-10.38", 0x020000, 0xbf379a43, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c11-12.3", 0x010000, 0xb11094f1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c11-05.58", 0x080000, 0x733e6d8e, BRF_GRA | TAITO_CHARS }, - - { "c11-03.32", 0x080000, 0x46718c7a, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c11-04.31", 0x080000, 0x663f33cc, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c11-01.29", 0x080000, 0xfd1ea532, BRF_SND | TAITO_YM2610A }, - { "c11-02.30", 0x080000, 0x451cc187, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Megablstu) -STD_ROM_FN(Megablstu) - -static struct BurnRomInfo MetalbRomDesc[] = { - { "d16-16.8", 0x040000, 0x3150be61, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d16-18.7", 0x040000, 0x5216d092, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d12-07.9", 0x020000, 0xe07f5136, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d12-06.6", 0x020000, 0x131df731, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "d12-13.5", 0x020000, 0xbcca2649, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d12-03.14", 0x080000, 0x46b498c0, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "d12-04.13", 0x080000, 0xab66d141, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "d12-01.20", 0x100000, 0xb81523b9, BRF_GRA | TAITO_SPRITESA }, - - { "d12-02.10", 0x100000, 0x79263e74, BRF_SND | TAITO_YM2610A }, - { "d12-05.16", 0x080000, 0x7fd036c5, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Metalb) -STD_ROM_FN(Metalb) - -static struct BurnRomInfo MetalbjRomDesc[] = { - { "d12-12.8", 0x040000, 0x556f82b2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d12-11.7", 0x040000, 0xaf9ee28d, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d12-07.9", 0x020000, 0xe07f5136, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d12-06.6", 0x020000, 0x131df731, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "d12-13.5", 0x020000, 0xbcca2649, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d12-03.14", 0x080000, 0x46b498c0, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "d12-04.13", 0x080000, 0xab66d141, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "d12-01.20", 0x100000, 0xb81523b9, BRF_GRA | TAITO_SPRITESA }, - - { "d12-02.10", 0x100000, 0x79263e74, BRF_SND | TAITO_YM2610A }, - { "d12-05.16", 0x080000, 0x7fd036c5, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Metalbj) -STD_ROM_FN(Metalbj) - -static struct BurnRomInfo MjnquestRomDesc[] = { - { "c77-09", 0x020000, 0x0a005d01, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c77-08", 0x020000, 0x4244f775, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c77-04", 0x080000, 0xc2e7e038, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "c77-10", 0x010000, 0xf16b2c1e, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c77-01", 0x100000, 0x5ba51205, BRF_GRA | TAITO_CHARS }, - { "c77-02", 0x100000, 0x6a6f3040, BRF_GRA | TAITO_CHARS }, - - { "c77-05", 0x080000, 0xc5a54678, BRF_GRA | TAITO_SPRITESA }, - - { "c77-03", 0x080000, 0x312f17b1, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Mjnquest) -STD_ROM_FN(Mjnquest) - -static struct BurnRomInfo MjnquestbRomDesc[] = { - { "c77-09a", 0x020000, 0xfc17f1c2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c77-08", 0x020000, 0x4244f775, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c77-04", 0x080000, 0xc2e7e038, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "c77-10", 0x010000, 0xf16b2c1e, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c77-01", 0x100000, 0x5ba51205, BRF_GRA | TAITO_CHARS }, - { "c77-02", 0x100000, 0x6a6f3040, BRF_GRA | TAITO_CHARS }, - - { "c77-05", 0x080000, 0xc5a54678, BRF_GRA | TAITO_SPRITESA }, - - { "c77-03", 0x080000, 0x312f17b1, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Mjnquestb) -STD_ROM_FN(Mjnquestb) - -static struct BurnRomInfo NinjakRomDesc[] = { - { "c85-10x.ic50", 0x020000, 0xba7e6e74, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c85-13x.ic49", 0x020000, 0x0ac2cba2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c85-07.ic48", 0x020000, 0x3eccfd0a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c85-06.ic47", 0x020000, 0xd126ded1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c85-14.ic54", 0x010000, 0xf2a52a51, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c85-03.ic65", 0x080000, 0x4cc7b9df, BRF_GRA | TAITO_CHARS }, - - { "c85-01.ic19", 0x100000, 0xa711977c, BRF_GRA | TAITO_SPRITESA }, - { "c85-02.ic17", 0x100000, 0xa6ad0f3d, BRF_GRA | TAITO_SPRITESA }, - - { "c85-04.ic31", 0x080000, 0x5afb747e, BRF_SND | TAITO_YM2610A }, - { "c85-05.ic33", 0x080000, 0x3c1b0ed0, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Ninjak) -STD_ROM_FN(Ninjak) - -static struct BurnRomInfo NinjakjRomDesc[] = { - { "c85-10x.ic50", 0x020000, 0xba7e6e74, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c85-11x.ic49", 0x020000, 0xe4ccaa8e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c85-07.ic48", 0x020000, 0x3eccfd0a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c85-06.ic47", 0x020000, 0xd126ded1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c85-14.ic54", 0x010000, 0xf2a52a51, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c85-03.ic65", 0x080000, 0x4cc7b9df, BRF_GRA | TAITO_CHARS }, - - { "c85-01.ic19", 0x100000, 0xa711977c, BRF_GRA | TAITO_SPRITESA }, - { "c85-02.ic17", 0x100000, 0xa6ad0f3d, BRF_GRA | TAITO_SPRITESA }, - - { "c85-04.ic31", 0x080000, 0x5afb747e, BRF_SND | TAITO_YM2610A }, - { "c85-05.ic33", 0x080000, 0x3c1b0ed0, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Ninjakj) -STD_ROM_FN(Ninjakj) - -static struct BurnRomInfo NinjakuRomDesc[] = { - { "c85-15x.ic50", 0x020000, 0x719a481b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c85-12x.ic49", 0x020000, 0x6c3f7e1e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c85-07.ic48", 0x020000, 0x3eccfd0a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c85-06.ic47", 0x020000, 0xd126ded1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c85-14.ic54", 0x010000, 0xf2a52a51, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c85-03.ic65", 0x080000, 0x4cc7b9df, BRF_GRA | TAITO_CHARS }, - - { "c85-01.ic19", 0x100000, 0xa711977c, BRF_GRA | TAITO_SPRITESA }, - { "c85-02.ic17", 0x100000, 0xa6ad0f3d, BRF_GRA | TAITO_SPRITESA }, - - { "c85-04.ic31", 0x080000, 0x5afb747e, BRF_SND | TAITO_YM2610A }, - { "c85-05.ic33", 0x080000, 0x3c1b0ed0, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Ninjaku) -STD_ROM_FN(Ninjaku) - -static struct BurnRomInfo PulirulaRomDesc[] = { - { "c98-12.rom", 0x040000, 0x816d6cde, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c98-16.rom", 0x040000, 0x59df5c77, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c98-06.rom", 0x020000, 0x64a71b45, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c98-07.rom", 0x020000, 0x90195bc0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c98-14.rom", 0x020000, 0xa858e17c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c98-04.rom", 0x100000, 0x0e1fe3b2, BRF_GRA | TAITO_CHARS }, - - { "c98-02.rom", 0x100000, 0x4a2ad2b3, BRF_GRA | TAITO_SPRITESA }, - { "c98-03.rom", 0x100000, 0x589a678f, BRF_GRA | TAITO_SPRITESA }, - - { "c98-01.rom", 0x100000, 0x197f66f5, BRF_SND | TAITO_YM2610A }, - - { "c98-05.rom", 0x080000, 0x9ddd9c39, BRF_GRA | TAITO_CHARS_PIVOT }, -}; - -STD_ROM_PICK(Pulirula) -STD_ROM_FN(Pulirula) - -static struct BurnRomInfo PulirulajRomDesc[] = { - { "c98-12.rom", 0x040000, 0x816d6cde, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c98-13.rom", 0x040000, 0xb7d13d5b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c98-06.rom", 0x020000, 0x64a71b45, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c98-07.rom", 0x020000, 0x90195bc0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c98-14.rom", 0x020000, 0xa858e17c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c98-04.rom", 0x100000, 0x0e1fe3b2, BRF_GRA | TAITO_CHARS }, - - { "c98-02.rom", 0x100000, 0x4a2ad2b3, BRF_GRA | TAITO_SPRITESA }, - { "c98-03.rom", 0x100000, 0x589a678f, BRF_GRA | TAITO_SPRITESA }, - - { "c98-01.rom", 0x100000, 0x197f66f5, BRF_SND | TAITO_YM2610A }, - - { "c98-05.rom", 0x080000, 0x9ddd9c39, BRF_GRA | TAITO_CHARS_PIVOT }, -}; - -STD_ROM_PICK(Pulirulaj) -STD_ROM_FN(Pulirulaj) - -static struct BurnRomInfo QcrayonRomDesc[] = { - { "d55-13", 0x040000, 0x16afbfc7, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d55-14", 0x040000, 0x2fb3057f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d55-03", 0x100000, 0x4d161e76, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "d55-15", 0x010000, 0xba782eff, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d55-02", 0x100000, 0xf3db2f1c, BRF_GRA | TAITO_CHARS }, - - { "d55-05", 0x100000, 0xf0e59902, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "d55-04", 0x100000, 0x412975ce, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "d55-01", 0x100000, 0xa8309af4, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Qcrayon) -STD_ROM_FN(Qcrayon) - -static struct BurnRomInfo Qcrayon2RomDesc[] = { - { "d63-12", 0x040000, 0x0f445a38, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d63-13", 0x040000, 0x74455752, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d63-01", 0x080000, 0x872e38b4, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "d63-11", 0x010000, 0x2c7ac9e5, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d63-03", 0x100000, 0xd24843af, BRF_GRA | TAITO_CHARS }, - - { "d63-06", 0x200000, 0x58b1e4a8, BRF_GRA | TAITO_SPRITESA }, - - { "d63-02", 0x100000, 0x162ae165, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Qcrayon2) -STD_ROM_FN(Qcrayon2) - -static struct BurnRomInfo QjinseiRomDesc[] = { - { "d48-09", 0x040000, 0xa573b68d, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d48-10", 0x040000, 0x37143a5b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d48-03", 0x100000, 0xfb5ea8dc, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "d48-11", 0x010000, 0x656c5b54, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d48-04", 0x100000, 0x61e4b078, BRF_GRA | TAITO_CHARS }, - - { "d48-02", 0x100000, 0xa7b68e63, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "d48-01", 0x100000, 0x72a94b73, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "d48-05", 0x080000, 0x3fefd058, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Qjinsei) -STD_ROM_FN(Qjinsei) - -static struct BurnRomInfo QtorimonRomDesc[] = { - { "c41-04.bin", 0x020000, 0x0fbf5223, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c41-05.bin", 0x020000, 0x174bd5db, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "mask-51.bin", 0x020000, 0x12e14aca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "mask-52.bin", 0x020000, 0xb3ef66f3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c41-06.bin", 0x010000, 0x753a98d8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c41-02.bin", 0x020000, 0x05dcd36d, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c41-01.bin", 0x020000, 0x39ff043c, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c41-03.bin", 0x020000, 0xb2c18e89, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Qtorimon) -STD_ROM_FN(Qtorimon) - -static struct BurnRomInfo QuizhqRomDesc[] = { - { "c53-05.bin", 0x020000, 0xc798fc20, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c53-01.bin", 0x020000, 0xbf44c93e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c53-52.bin", 0x020000, 0x12e14aca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c53-51.bin", 0x020000, 0xb3ef66f3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c53-08.bin", 0x010000, 0x25187e81, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c53-03.bin", 0x020000, 0x47596e70, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c53-07.bin", 0x020000, 0x4f9fa82f, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c53-02.bin", 0x020000, 0xd704c6f4, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c53-06.bin", 0x020000, 0xf77f63fc, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c53-04.bin", 0x020000, 0x99890ad4, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Quizhq) -STD_ROM_FN(Quizhq) - -static struct BurnRomInfo QzchikyuRomDesc[] = { - { "d19-06.8", 0x020000, 0xde8c8e55, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d19-05.7", 0x020000, 0xc6d099d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d19-03.6", 0x080000, 0x5c1b92c0, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "d19-07.5", 0x010000, 0xa8935f84, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d19-02.10", 0x100000, 0xf2dce2f2, BRF_GRA | TAITO_CHARS }, - - { "d19-01.21", 0x100000, 0x6c4342d0, BRF_GRA | TAITO_SPRITESA }, - - { "d19-04.9", 0x080000, 0xd3c44905, BRF_SND | TAITO_YM2610A }, - - { "pal16l8b-d19-08.bin",0x000104, 0xc6240d10, BRF_OPT }, - { "pal16l8b-d19-09.bin",0x000104, 0x576f5db9, BRF_OPT }, - { "pal16l8b-d19-10.bin",0x000104, 0xea1232a5, BRF_OPT }, -}; - -STD_ROM_PICK(Qzchikyu) -STD_ROM_FN(Qzchikyu) - -static struct BurnRomInfo QzquestRomDesc[] = { - { "c92-06.8", 0x020000, 0x424be722, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c92-05.7", 0x020000, 0xda470f93, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c92-03.6", 0x080000, 0x1d697606, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "c92-07.5", 0x010000, 0x3e313db9, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c92-02.10", 0x100000, 0x2daccecf, BRF_GRA | TAITO_CHARS }, - - { "c92-01.21", 0x100000, 0x9976a285, BRF_GRA | TAITO_SPRITESA }, - - { "c92-04.9", 0x080000, 0xe421bb43, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Qzquest) -STD_ROM_FN(Qzquest) - -static struct BurnRomInfo SsiRomDesc[] = { - { "c64_15-1.ic9", 0x040000, 0xce9308a6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c64_16-1.ic8", 0x040000, 0x470a483a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c64-09.13", 0x010000, 0x88d7f65c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c64-01.1", 0x100000, 0xa1b4f486, BRF_GRA | TAITO_SPRITESA }, - - { "c64-02.2", 0x020000, 0x3cb0b907, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Ssi) -STD_ROM_FN(Ssi) - -static struct BurnRomInfo Majest12RomDesc[] = { - { "c64-07.10", 0x020000, 0xf29ed5c9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c64-08.11", 0x020000, 0xddfd33d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c64-06.4", 0x020000, 0x18dc71ac, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c64-05.5", 0x020000, 0xb61866c0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c64-09.13", 0x010000, 0x88d7f65c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c64-01.1", 0x100000, 0xa1b4f486, BRF_GRA | TAITO_SPRITESA }, - - { "c64-02.2", 0x020000, 0x3cb0b907, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Majest12) -STD_ROM_FN(Majest12) - -static struct BurnRomInfo SolfigtrRomDesc[] = { - { "c91-05.59", 0x040000, 0xc1260e7c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c91-09.61", 0x040000, 0xd82b5266, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c91-07.62", 0x010000, 0xe471a05a, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c91-03.34", 0x100000, 0x8965da12, BRF_GRA | TAITO_CHARS }, - - { "c91-01.12", 0x100000, 0x0f3f4e00, BRF_GRA | TAITO_SPRITESA }, - { "c91-02.11", 0x100000, 0xe14ab98e, BRF_GRA | TAITO_SPRITESA }, - - { "c91-04.28", 0x080000, 0x390b1065, BRF_SND | TAITO_YM2610A }, - - { "pal16l8b-c74-06.ic48",0x000104, 0xc868dc16, BRF_OPT }, -}; - -STD_ROM_PICK(Solfigtr) -STD_ROM_FN(Solfigtr) - -static struct BurnRomInfo ThundfoxRomDesc[] = { - { "c28-13-1.51", 0x020000, 0xacb07013, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c28-16-1.40", 0x020000, 0x1e43d55b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c28-08.50", 0x020000, 0x38e038f1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c28-07.39", 0x020000, 0x24419abb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c28-14.3", 0x010000, 0x45ef3616, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c28-02.61", 0x080000, 0x6230a09d, BRF_GRA | TAITO_CHARS }, - - { "c28-01.63", 0x080000, 0x44552b25, BRF_GRA | TAITO_CHARSB }, - - { "c28-03.29", 0x080000, 0x51bdc7af, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c28-04.28", 0x080000, 0xba7ed535, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c28-06.41", 0x080000, 0xdb6983db, BRF_SND | TAITO_YM2610A }, - { "c28-05.42", 0x080000, 0xd3b238fa, BRF_SND | TAITO_YM2610B }, - - { "pal16l8b-b89-01.ic19",0x000104, 0x4095b97a, BRF_OPT }, - { "pal16l8b-b89-03.ic37",0x000104, 0x634592e2, BRF_OPT }, - { "pal16v8b-b89-04.ic33",0x000117, 0xfc136ae2, BRF_OPT }, - { "pal16l8b-c28-09.ic25",0x000104, 0x383e7305, BRF_OPT }, - { "pal16l8b-c28-10.ic26",0x000104, 0x47fccc07, BRF_OPT }, - { "pal16l8b-c28-11.ic35",0x000104, 0x33414fe8, BRF_OPT }, -}; - -STD_ROM_PICK(Thundfox) -STD_ROM_FN(Thundfox) - -static struct BurnRomInfo ThundfoxjRomDesc[] = { - { "c28-13-1.51", 0x020000, 0xacb07013, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c28-12-1.40", 0x020000, 0xf04db477, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c28-08.50", 0x020000, 0x38e038f1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c28-07.39", 0x020000, 0x24419abb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c28-14.3", 0x010000, 0x45ef3616, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c28-02.61", 0x080000, 0x6230a09d, BRF_GRA | TAITO_CHARS }, - - { "c28-01.63", 0x080000, 0x44552b25, BRF_GRA | TAITO_CHARSB }, - - { "c28-03.29", 0x080000, 0x51bdc7af, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c28-04.28", 0x080000, 0xba7ed535, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c28-06.41", 0x080000, 0xdb6983db, BRF_SND | TAITO_YM2610A }, - { "c28-05.42", 0x080000, 0xd3b238fa, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Thundfoxj) -STD_ROM_FN(Thundfoxj) - -static struct BurnRomInfo ThundfoxuRomDesc[] = { - { "c28-13-1.51", 0x020000, 0xacb07013, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c28-15-1.40", 0x020000, 0x874a84e1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c28-08.50", 0x020000, 0x38e038f1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c28-07.39", 0x020000, 0x24419abb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c28-14.3", 0x010000, 0x45ef3616, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c28-02.61", 0x080000, 0x6230a09d, BRF_GRA | TAITO_CHARS }, - - { "c28-01.63", 0x080000, 0x44552b25, BRF_GRA | TAITO_CHARSB }, - - { "c28-03.29", 0x080000, 0x51bdc7af, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c28-04.28", 0x080000, 0xba7ed535, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c28-06.41", 0x080000, 0xdb6983db, BRF_SND | TAITO_YM2610A }, - { "c28-05.42", 0x080000, 0xd3b238fa, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Thundfoxu) -STD_ROM_FN(Thundfoxu) - -static struct BurnRomInfo YesnojRomDesc[] = { - { "d20-05-2.2", 0x040000, 0x68adb929, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d20-04-2.4", 0x040000, 0xa84762f8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "d20-06.5", 0x010000, 0x3eb537dc, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "d20-01.11", 0x080000, 0x9d8a4d57, BRF_GRA | TAITO_CHARS }, - - { "d20-02.12", 0x080000, 0xe71a8e40, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "d20-03.13", 0x080000, 0x6a51a1b4, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, -}; - -STD_ROM_PICK(Yesnoj) -STD_ROM_FN(Yesnoj) - -static struct BurnRomInfo YuyugogoRomDesc[] = { - { "c83-10.3", 0x020000, 0x4d185d03, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c83-09.2", 0x020000, 0xf9892792, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c83-03.10", 0x100000, 0xeed9acc2, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "c83-11.1", 0x010000, 0x461e702a, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c83-05.21", 0x020000, 0xeca57fb1, BRF_GRA | TAITO_CHARS }, - - { "c83-01.12", 0x100000, 0x8bf0d416, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c83-02.11", 0x100000, 0x20bb1c15, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c83-04.5", 0x100000, 0x2600093a, BRF_SND | TAITO_YM2610A }, -}; - -STD_ROM_PICK(Yuyugogo) -STD_ROM_FN(Yuyugogo) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += Taito68KRom1Size; - TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; - TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; - TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - if (TaitoNumMSM6295) MSM6295ROM = Next; Next += 0x40000; - TaitoMSM6295Rom = Next; Next += TaitoMSM6295RomSize; - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x020000; - TaitoZ80Ram1 = Next; Next += 0x002000; - TaitoSpriteRam = Next; Next += 0x010000; - TaitoSpriteRamBuffered = Next; Next += 0x010000; - TaitoSpriteRamDelayed = Next; Next += 0x010000; - TaitoSpriteExtension = Next; Next += 0x004000; - TaitoPaletteRam = Next; Next += 0x004000; - - TaitoRamEnd = Next; - - TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; - if (TaitoNumCharB) TaitoCharsB = Next; Next += TaitoNumCharB * TaitoCharBWidth * TaitoCharBHeight; - TaitoCharsPivot = Next; Next += TaitoNumCharPivot * TaitoCharPivotWidth * TaitoCharPivotHeight; - TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; - TaitoPalette = (UINT32*)Next; Next += 0x02000 * sizeof(UINT32); - TaitoPriorityMap = Next; Next += nScreenWidth * nScreenHeight; - TaitoF2SpriteList = (TaitoF2SpriteEntry*)Next; Next += 0x400 * sizeof(TaitoF2SpriteEntry); - - TaitoMemEnd = Next; - - return 0; -} - -static INT32 TaitoF2DoReset() -{ - TaitoDoReset(); - - YesnoDip = 0; - MjnquestInput = 0; - DriveoutSoundNibble = 0; - DriveoutOkiBank = 0; - - TaitoF2SpritesFlipScreen = 0; - TaitoF2SpriteBlendMode = 0; - TaitoF2TilePriority[0] = TaitoF2TilePriority[1] = TaitoF2TilePriority[2] = TaitoF2TilePriority[3] = TaitoF2TilePriority[4] = 0; - TaitoF2SpritePriority[0] = TaitoF2SpritePriority[1] = TaitoF2SpritePriority[2] = TaitoF2SpritePriority[3] = 0; - - return 0; -} - -static void TaitoF2SpriteBankWrite(INT32 Offset, UINT16 Data) -{ - INT32 i, j; - - if (Offset < 2) return; - if (Offset < 4) { - j = (Offset & 1) << 1; - i = Data << 11; - TaitoF2SpriteBankBuffered[j + 0] = i; - TaitoF2SpriteBankBuffered[j + 1] = i + 0x400; - } else { - i = Data << 10; - TaitoF2SpriteBankBuffered[Offset] = i; - } -} - -UINT8 __fastcall Cameltry68KReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x300000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Cameltry68KWriteByte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x300000) - TC0100SCN0ByteWrite_Map(0x800000, 0x813fff) - - switch (a) { - case 0x320000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x320002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Cameltry68KReadWord(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x300000) - - switch (a) { - case 0x300018: { - INT32 Temp = TaitoAnalogPort0 >> 6; - if (Temp >= 0x14 && Temp < 0x80) Temp = 0x14; - if (Temp <= 0x3ec && Temp > 0x80) Temp = 0x3ec; - return Temp; - } - - case 0x30001c: { - INT32 Temp = TaitoAnalogPort1 >> 6; - if (Temp >= 0x14 && Temp < 0x80) Temp = 0x14; - if (Temp <= 0x3ec && Temp > 0x80) Temp = 0x3ec; - return Temp; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Cameltry68KWriteWord(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x300000) - TC0100SCN0WordWrite_Map(0x800000, 0x813fff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - TC0280GRDCtrlWordWrite_Map(0xa02000) - TC0360PRIHalfWordWrite_Map(0xd00000) - - if (a >= 0x814000 && a <= 0x814fff) return; //??? - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Deadconx68KReadByte(UINT32 a) -{ - switch (a) { - case 0x700001: { - return TaitoDip[0]; - } - - case 0x700003: { - return TaitoDip[1]; - } - - case 0x700005: { - return TaitoInput[2]; - } - - case 0x700007: { - return 0xff; - } - - case 0x70000b: { - return TaitoInput[0]; - } - - case 0x70000d: { - return TaitoInput[1]; - } - - case 0x70000f: { - return 0xff; - } - - case 0x700011: { - return 0xff; - } - - case 0xa00002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Deadconx68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x700007: { - // coin write - return; - } - - case 0xa00000: { - TC0140SYTPortWrite(d); - return; - } - - case 0xa00002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Deadconx68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Deadconx68KWriteWord(UINT32 a, UINT16 d) -{ - TC0480SCPCtrlWordWrite_Map(0x430000) - TC0360PRIHalfWordWrite_Map(0x500000) - - switch (a) { - case 0x300000: - case 0x300002: - case 0x300004: - case 0x300006: - case 0x300008: - case 0x30000a: - case 0x30000c: - case 0x30000e: { - TaitoF2SpriteBankWrite((a - 0x300000) >> 1, d); - return; - } - - case 0x700006: { - // coin write - return; - } - - case 0x700008: - case 0x700012: - case 0x700014: - case 0x700016: - case 0x700018: { - // ??? - return; - } - - case 0x800000: { - // watchdog - return; - } - - case 0x900000: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Dinorex68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0x300000) - - switch (a) { - case 0xa00002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Dinorex68KWriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordWrite_Map(0x300000) - TC0100SCN0ByteWrite_Map(0x900000, 0x90ffff) - - switch (a) { - case 0xa00000: { - TC0140SYTPortWrite(d); - return; - } - - case 0xa00002: { - TC0140SYTCommWrite(d); - return; - } - - case 0xb00000: { - // nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Dinorex68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Dinorex68KWriteWord(UINT32 a, UINT16 d) -{ - TC0510NIOHalfWordWrite_Map(0x300000) - TC0360PRIHalfWordWrite_Map(0x700000) - TC0100SCN0WordWrite_Map(0x900000, 0x90ffff) - TC0100SCN0CtrlWordWrite_Map(0x920000) - - switch (a) { - case 0xb00000: { - // nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Dondokod68KReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x300000) - - switch (a) { - case 0x320002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Dondokod68KWriteByte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x300000) - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - - switch (a) { - case 0x320000: - case 0x320001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x320002: - case 0x320003: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Dondokod68KReadWord(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x300000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Dondokod68KWriteWord(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x300000) - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - TC0280GRDCtrlWordWrite_Map(0xa02000) - TC0360PRIHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0x360000: { - //??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Driftout68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0xb00000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Driftout68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - TC0510NIOHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0x200000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x200002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Driftout68KReadWord(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0xb00000) - - switch (a) { - case 0x200000: { - return 0; - } - - case 0xb00018: - case 0xb0001a: { - //driftout_paddle_r - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Driftout68KWriteWord(UINT32 a, UINT16 d) -{ - TC0430GRWCtrlWordWrite_Map(0x402000) - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - TC0360PRIHalfWordSwapWrite_Map(0xa00000) - TC0510NIOHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0xa00000: { - //??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -void __fastcall Driveout68KWriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0x200000: { - DriveoutSoundNibble = d & 1; - return; - } - - case 0x200002: { - if (!DriveoutSoundNibble) { - TaitoSoundLatch = (d & 0x0f) | (TaitoSoundLatch & 0xf0); - } else { - TaitoSoundLatch = ((d << 4) & 0xf0) | (TaitoSoundLatch & 0x0f); - ZetOpen(0); - ZetRaiseIrq(0); - ZetClose(); - } - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall Finalb68KReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x300000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Finalb68KWriteByte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x300000) - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - - switch (a) { - case 0x320001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x320003: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Finalb68KReadWord(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x300000) - - switch (a) { - case 0x200002: { - return TC0110PCRWordRead(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Finalb68KWriteWord(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x300000) - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - - if (a >= 0x810000 && a <= 0x81ffff) return; // NOP - - switch (a) { - case 0x200000: - case 0x200002: { - TC0110PCRWordWrite(0, (a - 0x200000) >> 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Footchmp68KReadByte(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Footchmp68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0xa00001: { - TC0140SYTPortWrite(d); - return; - } - - case 0xa00003: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Footchmp68KReadWord(UINT32 a) -{ - switch (a) { - case 0x700000: { - return TaitoDip[0]; - } - - case 0x700002: { - return TaitoDip[1]; - } - - case 0x700004: { - return TaitoInput[2]; - } - - case 0x70000a: { - return TaitoInput[0]; - } - - case 0x70000c: { - return TaitoInput[1]; - } - - case 0x70000e: { - return TaitoInput[3]; - } - - case 0x700010: { - return TaitoInput[4]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0xffff; -} - -void __fastcall Footchmp68KWriteWord(UINT32 a, UINT16 d) -{ - TC0480SCPCtrlWordWrite_Map(0x430000) - TC0360PRIHalfWordWrite_Map(0x500000) - - switch (a) { - case 0x300000: - case 0x300002: - case 0x300004: - case 0x300006: - case 0x300008: - case 0x30000a: - case 0x30000c: - case 0x30000e: { - TaitoF2SpriteBankWrite((a - 0x300000) >> 1, d); - return; - } - - case 0x700006: - case 0x700008: - case 0x700012: - case 0x700014: - case 0x700016: - case 0x700018: { - return; - } - - case 0x800000: { - // watchdog - return; - } - - case 0x900000: { - // ???? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Growl68KReadByte(UINT32 a) -{ - switch (a) { - case 0x320001: { - return TaitoInput[0]; - } - - case 0x320003: { - return TaitoInput[1]; - } - - case 0x400002: { - return TC0140SYTCommRead(); - } - - case 0x508000: { - return TaitoInput[4]; - } - - case 0x508001: { - return TaitoInput[3]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Growl68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - - switch (a) { - case 0x400000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x400002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Growl68KReadWord(UINT32 a) -{ - switch (a) { - case 0x300000: { - return TaitoDip[0]; - } - - case 0x300002: { - return TaitoDip[1]; - } - - case 0x320000: { - return TaitoInput[0]; - } - - case 0x320004: { - return TaitoInput[2]; - } - - case 0x50c000: { - return TaitoInput[5]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Growl68KWriteWord(UINT32 a, UINT16 d) -{ - TC0360PRIHalfWordWrite_Map(0xb00000) - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - - switch (a) { - case 0x300004: { - // coin write - return; - } - - case 0x340000: { - // watchdog - return; - } - - case 0x500000: - case 0x500002: - case 0x500004: - case 0x500006: - case 0x500008: - case 0x50000a: - case 0x50000c: - case 0x50000e: { - TaitoF2SpriteBankWrite((a - 0x500000) >> 1, d); - return; - } - - case 0x504000: { - // nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Gunfront68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordSwapRead_Map(0x300000) - - switch (a) { - case 0x320002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Gunfront68KWriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordSwapWrite_Map(0x300000) - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - - switch (a) { - case 0x320000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x320002: { - TC0140SYTCommWrite(d); - return; - } - - case 0xa00000: { - // nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Gunfront68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Gunfront68KWriteWord(UINT32 a, UINT16 d) -{ - TC0510NIOHalfWordSwapWrite_Map(0x300000) - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - TC0360PRIHalfWordWrite_Map(0xb00000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Koshien68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0x300000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Koshien68KWriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordWrite_Map(0x300000) - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - TC0360PRIHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0x320000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x320002: { - TC0140SYTCommWrite(d); - return; - } - - case 0x340000: { - //??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Koshien68KReadWord(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0x300000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Koshien68KWriteWord(UINT32 a, UINT16 d) -{ - TC0510NIOHalfWordWrite_Map(0x300000) - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - TC0360PRIHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0xa20000: { - TaitoF2SpriteBankBuffered[0] = 0x0000; - TaitoF2SpriteBankBuffered[1] = 0x0400; - TaitoF2SpriteBankBuffered[2] = ((d & 0x00f) + 1) * 0x800; - TaitoF2SpriteBankBuffered[4] = (((d & 0x0f0) >> 4) + 1) * 0x800; - TaitoF2SpriteBankBuffered[6] = (((d & 0xf00) >> 8) + 1) * 0x800; - TaitoF2SpriteBankBuffered[3] = TaitoF2SpriteBankBuffered[2] + 0x400; - TaitoF2SpriteBankBuffered[5] = TaitoF2SpriteBankBuffered[4] + 0x400; - TaitoF2SpriteBankBuffered[7] = TaitoF2SpriteBankBuffered[6] + 0x400; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Liquidk68KReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x300000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Liquidk68KWriteByte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x300000) - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - - switch (a) { - case 0x320001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x320003: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Liquidk68KReadWord(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x300000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Liquidk68KWriteWord(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x300000) - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - TC0360PRIHalfWordWrite_Map(0xb00000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Megablst68KReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x120000) - - if (a >= 0x180000 && a <= 0x180fff) { - return MegabCChipRead((a - 0x180000) >> 1); - } - - switch (a) { - case 0x100002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Megablst68KWriteByte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x120000) - TC0360PRIHalfWordWrite_Map(0x400000) - TC0100SCN0ByteWrite_Map(0x600000, 0x60ffff) - - if (a >= 0x180000 && a <= 0x180fff) { - MegabCChipWrite((a - 0x180000) >> 1, d); - return; - } - - switch (a) { - case 0x100000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x100002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Megablst68KReadWord(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x120000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Megablst68KWriteWord(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x120000) - TC0360PRIHalfWordWrite_Map(0x400000) - TC0100SCN0WordWrite_Map(0x600000, 0x60ffff) - TC0100SCN0CtrlWordWrite_Map(0x620000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Metalb68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordSwapRead_Map(0x800000) - - switch (a) { - case 0x900002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Metalb68KWriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordSwapWrite_Map(0x800000) - - switch (a) { - case 0x900000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x900002: { - TC0140SYTCommWrite(d); - return; - } - - case 0xa00000: { - //??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Metalb68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Metalb68KWriteWord(UINT32 a, UINT16 d) -{ - TC0480SCPCtrlWordWrite_Map(0x530000) - TC0360PRIHalfWordWrite_Map(0x600000) - TC0510NIOHalfWordSwapWrite_Map(0x800000) - - switch (a) { - case 0x42000c: - case 0x42000e: { - //??? - return; - } - - case 0xa00000: { - //??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Mjnquest68KReadByte(UINT32 a) -{ - switch (a) { - case 0x300000: { - return TaitoInput[4]; - } - - case 0x300001: { - return TaitoDip[0]; - } - - case 0x300002: { - return TaitoInput[5]; - } - - case 0x300003: { - return TaitoDip[1]; - } - - case 0x360002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Mjnquest68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x400000, 0x40ffff) - - switch (a) { - case 0x330000: - case 0x330001: { - //nop - return; - } - - case 0x360000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x360002: { - TC0140SYTCommWrite(d); - return; - } - - case 0x360005: { - //??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Mjnquest68KReadWord(UINT32 a) -{ - switch (a) { - case 0x310000: { - switch (MjnquestInput) { - case 0x01: return TaitoInput[0]; - case 0x02: return TaitoInput[1]; - case 0x04: return TaitoInput[2]; - case 0x08: return TaitoInput[3]; - case 0x10: return 0xff; - } - return 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Mjnquest68KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x400000, 0x40ffff) - TC0100SCN0CtrlWordWrite_Map(0x420000) - - switch (a) { - case 0x200000: - case 0x200002: { - TC0110PCRWordWrite(0, (a - 0x200000) >> 1, d); - return; - } - - case 0x200004: { - //nop - return; - } - - case 0x300000: { - //??? - return; - } - - case 0x320000: { - MjnquestInput = d >> 6; - return; - } - - case 0x350000: { - //nop - return; - } - - case 0x380000: { - TC0100SCNSetGfxBank(0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Ninjak68KReadByte(UINT32 a) -{ - switch (a) { - case 0x300000: { - return TaitoDip[0]; - } - - case 0x300002: { - return TaitoDip[1]; - } - - case 0x300004: { - return TaitoInput[0]; - } - - case 0x300006: { - return TaitoInput[1]; - } - - case 0x300008: { - return TaitoInput[3]; - } - - case 0x30000a: { - return TaitoInput[4]; - } - - case 0x30000c: { - return TaitoInput[2]; - } - - case 0x400002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ninjak68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - - switch (a) { - case 0x30000e: { - //coin write - return; - } - - case 0x300010: { - //??? - return; - } - - case 0x400000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x400002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Ninjak68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ninjak68KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - TC0360PRIHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0x300000: - case 0x300012: - case 0x300014: - case 0x300016: - case 0x300018: { - //??? - return; - } - - case 0x380000: { - //watchdog - return; - } - - case 0x600000: - case 0x600002: - case 0x600004: - case 0x600006: - case 0x600008: - case 0x60000a: - case 0x60000c: - case 0x60000e: { - TaitoF2SpriteBankWrite((a - 0x600000) >> 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Pulirula68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0xb00000) - - switch (a) { - case 0x200002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Pulirula68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - TC0510NIOHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0x200000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x200002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Pulirula68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Pulirula68KWriteWord(UINT32 a, UINT16 d) -{ - TC0430GRWCtrlWordWrite_Map(0x402000) - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - TC0360PRIHalfWordSwapWrite_Map(0xa00000) - TC0510NIOHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0x500000: { - //??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Qcrayon68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0xa00000) - - switch (a) { - case 0x500002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qcrayon68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x900000, 0x90ffff) - TC0510NIOHalfWordWrite_Map(0xa00000) - - switch (a) { - case 0x200000: { - //??? - return; - } - - case 0x500000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x500002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Qcrayon68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qcrayon68KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x900000, 0x90ffff) - TC0100SCN0CtrlWordWrite_Map(0x920000) - TC0510NIOHalfWordWrite_Map(0xa00000) - TC0360PRIHalfWordWrite_Map(0xb00000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Qcrayon268KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0x700000) - - switch (a) { - case 0xa00002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qcrayon268KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x500000, 0x50ffff) - TC0510NIOHalfWordWrite_Map(0x700000) - - switch (a) { - case 0x800000: { - //??? - return; - } - - case 0xa00000: { - TC0140SYTPortWrite(d); - return; - } - - case 0xa00002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Qcrayon268KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qcrayon268KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x500000, 0x50ffff) - TC0100SCN0CtrlWordWrite_Map(0x520000) - TC0510NIOHalfWordWrite_Map(0x700000) - TC0360PRIHalfWordWrite_Map(0x900000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Qjinsei68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0xb00000) - - switch (a) { - case 0x200002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qjinsei68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - TC0510NIOHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0x200000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x200002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Qjinsei68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qjinsei68KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - TC0360PRIHalfWordWrite_Map(0xa00000) - TC0510NIOHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0x500000: { - //nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Qtorimon68KReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x500000) - - switch (a) { - case 0x600002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qtorimon68KWriteByte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x500000) - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - - switch (a) { - case 0x600000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x600002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Qtorimon68KReadWord(UINT32 a) -{ - switch (a) { - case 0x200002: { - return TC0110PCRWordRead(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qtorimon68KWriteWord(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x500000) - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - - if (a >= 0x810000 && a <= 0x81ffff) return; // NOP - - switch (a) { - case 0x200000: - case 0x200002: { - TC0110PCRWordWrite(0, (a - 0x200000) >> 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Quizhq68KReadByte(UINT32 a) -{ - switch (a) { - case 0x500001: { - return TaitoDip[1]; - } - - case 0x500003: { - return TaitoInput[0]; - } - - case 0x580001: { - return TaitoDip[0]; - } - - case 0x580003: { - return TaitoInput[1]; - } - - case 0x580005: { - return TaitoInput[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Quizhq68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - - switch (a) { - case 0x500005: { - //coin write - return; - } - - case 0x500007: { - //??? - return; - } - - case 0x580007: { - //nop - return; - } - - case 0x600001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x600003: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Quizhq68KReadWord(UINT32 a) -{ - switch (a) { - case 0x500000: { - return TaitoDip[1]; - } - - case 0x500002: { - return TaitoInput[0]; - } - - case 0x580000: { - return TaitoDip[0]; - } - - case 0x580002: { - return TaitoInput[1]; - } - - case 0x580004: { - return TaitoInput[2]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Quizhq68KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - - if (a >= 0x810000 && a <= 0x81ffff) return; // NOP - - switch (a) { - case 0x200000: - case 0x200002: { - TC0110PCRWordWrite(0, (a - 0x200000) >> 1, d); - return; - } - - case 0x680000: { - //nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Qzchikyu68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0x200000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qzchikyu68KWriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordWrite_Map(0x200000) - TC0100SCN0ByteWrite_Map(0x700000, 0x70ffff) - - switch (a) { - case 0x300001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x300003: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Qzchikyu68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qzchikyu68KWriteWord(UINT32 a, UINT16 d) -{ - TC0510NIOHalfWordWrite_Map(0x200000) - TC0100SCN0WordWrite_Map(0x700000, 0x70ffff) - TC0100SCN0CtrlWordWrite_Map(0x720000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Qzquest68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0x200000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qzquest68KWriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordWrite_Map(0x200000) - TC0100SCN0ByteWrite_Map(0x700000, 0x70ffff) - - switch (a) { - case 0x300001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x300003: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Qzquest68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Qzquest68KWriteWord(UINT32 a, UINT16 d) -{ - TC0510NIOHalfWordWrite_Map(0x200000) - TC0100SCN0WordWrite_Map(0x700000, 0x70ffff) - TC0100SCN0CtrlWordWrite_Map(0x720000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Solfigtr68KReadByte(UINT32 a) -{ - switch (a) { - case 0x300001: { - return TaitoDip[0]; - } - - case 0x300003: { - return TaitoDip[1]; - } - - case 0x320001: { - return TaitoInput[0]; - } - - case 0x320003: { - return TaitoInput[1]; - } - - case 0x320005: { - return TaitoInput[2]; - } - - case 0x400002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Solfigtr68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - - switch (a) { - case 0x300005: { - //coin write - return; - } - - case 0x400000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x400002: { - TC0140SYTCommWrite(d); - return; - } - - case 0x504000: { - //nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Solfigtr68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Solfigtr68KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - TC0360PRIHalfWordWrite_Map(0xb00000) - - switch (a) { - case 0x300006: { - //??? - return; - } - - case 0x320006: { - //??? - return; - } - - case 0x340000: { - //watchdog - return; - } - - case 0x500000: - case 0x500002: - case 0x500004: - case 0x500006: - case 0x500008: - case 0x50000a: - case 0x50000c: - case 0x50000e: { - TaitoF2SpriteBankWrite((a - 0x500000) >> 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Ssi68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0x100000) - - switch (a) { - case 0x400002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ssi68KWriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordWrite_Map(0x100000) - TC0100SCN0ByteWrite_Map(0x600000, 0x60ffff) - - switch (a) { - case 0x400000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x400002: { - TC0140SYTCommWrite(d); - return; - } - - case 0x500000: { - // nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Ssi68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Ssi68KWriteWord(UINT32 a, UINT16 d) -{ - TC0510NIOHalfWordWrite_Map(0x100000) - TC0100SCN0ByteWrite_Map(0x600000, 0x60ffff) - TC0100SCN0CtrlWordWrite_Map(0x620000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Thundfox68KReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x200000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Thundfox68KWriteByte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x200000) - TC0100SCN0ByteWrite_Map(0x400000, 0x40ffff) - TC0360PRIHalfWordWrite_Map(0x800000) - - switch (a) { - case 0x220000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x220002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Thundfox68KReadWord(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x200000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Thundfox68KWriteWord(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x200000) - TC0100SCN0WordWrite_Map(0x400000, 0x40ffff) - TC0100SCN0CtrlWordWrite_Map(0x420000) - TC0100SCN1WordWrite_Map(0x500000, 0x50ffff) - TC0100SCN1CtrlWordWrite_Map(0x520000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Yesnoj68KReadByte(UINT32 a) -{ - if (a >= 0x700000 && a <= 0x70001f) return 0; - - switch (a) { - case 0x800002: { - return TC0140SYTCommRead(); - } - - case 0xa00001: { - return TaitoInput[0]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Yesnoj68KWriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x500000, 0x50ffff) - - switch (a) { - case 0x700015: - case 0x70001b: - case 0x70001d: - case 0x70001f: { - //??? - return; - } - - case 0x800000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x800002: { - TC0140SYTCommWrite(d); - return; - } - - case 0x900003: { - //nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Yesnoj68KReadWord(UINT32 a) -{ - switch (a) { - case 0xa00004: { - return TaitoInput[1]; - } - - case 0xb00000: { - YesnoDip = 1 - YesnoDip; - - if (YesnoDip) { - return TaitoDip[0]; - } else { - return TaitoDip[1]; - } - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Yesnoj68KWriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x500000, 0x50ffff) - TC0100SCN0CtrlWordWrite_Map(0x520000) - - switch (a) { - case 0x900002: - case 0x900006: - case 0xa00006: - case 0xc00000: - case 0xd00000: { - //nop - return; - } - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Yuyugogo68KReadByte(UINT32 a) -{ - TC0510NIOHalfWordRead_Map(0x200000) - - switch (a) { - case 0x400002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Yuyugogo68KWriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordWrite_Map(0x200000) - TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) - - switch (a) { - case 0x400000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x400002: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Yuyugogo68KReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Yuyugogo68KWriteWord(UINT32 a, UINT16 d) -{ - TC0510NIOHalfWordWrite_Map(0x200000) - TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) - TC0100SCN0CtrlWordWrite_Map(0x820000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall TaitoF2Z80Read(UINT16 a) -{ - switch (a) { - case 0xe000: { - return BurnYM2610Read(0); - } - - case 0xe002: { - return BurnYM2610Read(2); - } - - case 0xe200: { - // NOP - return 0; - } - - case 0xe201: { - return TC0140SYTSlaveCommRead(); - } - - case 0xea00: { - // NOP - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall TaitoF2Z80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe000: { - BurnYM2610Write(0, d); - return; - } - - case 0xe001: { - BurnYM2610Write(1, d); - return; - } - - case 0xe002: { - BurnYM2610Write(2, d); - return; - } - - case 0xe003: { - BurnYM2610Write(3, d); - return; - } - - case 0xe200: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xe201: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xe400: - case 0xe401: - case 0xe402: - case 0xe403: { - return; - } - - case 0xe600: { - return; - } - - case 0xee00: { - return; - } - - case 0xf000: { - return; - } - - case 0xf200: { - TaitoZ80Bank = (d - 1) & 7; - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall CamltryaZ80Read(UINT16 a) -{ - switch (a) { - case 0x9000: { - return BurnYM2203Read(0, 0); - } - - case 0xa001: { - return TC0140SYTSlaveCommRead(); - } - - case 0xb000: { - return MSM6295ReadStatus(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall CamltryaZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x9000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0x9001: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0xa000: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xa001: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xb000: - case 0xb001: { - MSM6295Command(0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall DriveoutZ80Read(UINT16 a) -{ - switch (a) { - case 0x9800: { - return MSM6295ReadStatus(0); - } - - case 0xa000: { - return TaitoSoundLatch; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall DriveoutZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x9000: { - if ((d & 4)) { - DriveoutOkiBank = (d & 3); - memcpy(MSM6295ROM, TaitoMSM6295Rom + (DriveoutOkiBank * 0x40000), 0x40000); - } - return; - } - - case 0x9800: { - MSM6295Command(0, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 CharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; -static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 PivotPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 PivotXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; -static INT32 PivotYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 YuyugogoCharPlaneOffsets[1] = { 0 }; -static INT32 YuyugogoCharXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 YuyugogoCharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 TC0480SCPCharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 TC0480SCPCharXOffsets[16] = { 4, 0, 20, 16, 12, 8, 28, 24, 36, 32, 52, 48, 44, 40, 60, 56 }; -static INT32 TC0480SCPCharYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; -static INT32 SpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 SpriteXOffsets[16] = { 4, 0, 12, 8, 20, 16, 28, 24, 36, 32, 44, 40, 52, 48, 60, 56 }; -static INT32 SpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; -static INT32 FinalbSpritePlaneOffsets[6] = { 0x800000, 0x800001, 0, 1, 2, 3 }; -static INT32 FinalbSpriteXOffsets[16] = { 12, 8, 4, 0, 28, 24, 20, 16, 44, 40, 36, 32, 60, 56, 52, 48 }; -static INT32 FinalbSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; - -static void TaitoF2FMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 TaitoF2SynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / (24000000 / 6); -} - -static double TaitoF2GetTime() -{ - return (double)ZetTotalCycles() / (24000000 / 6); -} - -static INT32 CamltryaSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / (24000000 / 4); -} - -static double CamltryaGetTime() -{ - return (double)ZetTotalCycles() / (24000000 / 4); -} - -static void TaitoF2SoundInit() -{ - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(TaitoF2Z80Read); - ZetSetWriteHandler(TaitoF2Z80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2610Init(24000000 / 3, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoF2FMIRQHandler, TaitoF2SynchroniseStream, TaitoF2GetTime, 0); - BurnTimerAttachZet(24000000 / 6); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); -} - -static void SwitchToMusashi() -{ - if (bBurnUseASMCPUEmulation) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); -#endif - bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; - bBurnUseASMCPUEmulation = false; - } -} - -static void TaitoF2Init() -{ - GenericTilesInit(); - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoF2SpritesDisabled = 1; - TaitoF2SpritesActiveArea = 0; - TaitoXOffset = 0; - TaitoF2SpriteType = 0; - - TaitoF2SpriteBufferFunction = TaitoF2NoBuffer; - TaitoDrawFunction = TaitoF2Draw; - - for (INT32 i = 0; i < 8; i++) { - TaitoF2SpriteBankBuffered[i] = 0x400 * i; - TaitoF2SpriteBank[i] = TaitoF2SpriteBankBuffered[i]; - } - - nTaitoCyclesTotal[0] = (24000000 / 2) / 60; - nTaitoCyclesTotal[1] = (24000000 / 6) / 60; -} - -static INT32 CameltryInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoCharPivotModulo = 0x100; - TaitoCharPivotNumPlanes = 4; - TaitoCharPivotWidth = 8; - TaitoCharPivotHeight = 8; - TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; - TaitoCharPivotXOffsets = PivotXOffsets; - TaitoCharPivotYOffsets = PivotYOffsets; - TaitoNumCharPivot = 0x1000; - - TaitoNumSpriteA = 0x1000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); - TC0140SYTInit(); - TC0220IOCInit(); - TC0280GRDInit(-16, -16, TaitoCharsPivot); - TC0360PRIInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x813fff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekMapMemory(TC0280GRDRam , 0xa00000, 0xa01fff, SM_RAM); - SekSetReadByteHandler(0, Cameltry68KReadByte); - SekSetWriteByteHandler(0, Cameltry68KWriteByte); - SekSetReadWordHandler(0, Cameltry68KReadWord); - SekSetWriteWordHandler(0, Cameltry68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoDrawFunction = CameltryDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 CamltryaInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumYM2610 = 0; - TaitoNumYM2203 = 1; - TaitoNumMSM6295 = 1; - - TaitoCharPivotModulo = 0x100; - TaitoCharPivotNumPlanes = 4; - TaitoCharPivotWidth = 8; - TaitoCharPivotHeight = 8; - TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; - TaitoCharPivotXOffsets = PivotXOffsets; - TaitoCharPivotYOffsets = PivotYOffsets; - TaitoNumCharPivot = 0x1000; - - TaitoNumSpriteA = 0x1000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); - TC0140SYTInit(); - TC0220IOCInit(); - TC0280GRDInit(-16, -16, TaitoCharsPivot); - TC0360PRIInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x813fff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekMapMemory(TC0280GRDRam , 0xa00000, 0xa01fff, SM_RAM); - SekSetReadByteHandler(0, Cameltry68KReadByte); - SekSetWriteByteHandler(0, Cameltry68KWriteByte); - SekSetReadWordHandler(0, Cameltry68KReadWord); - SekSetWriteWordHandler(0, Cameltry68KWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(CamltryaZ80Read); - ZetSetWriteHandler(CamltryaZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(1, 24000000 / 8, &TaitoF2FMIRQHandler, CamltryaSynchroniseStream, CamltryaGetTime, 0); - BurnTimerAttachZet(24000000 / 4); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, (4224000 / 4) / 132, 1); - MSM6295SetRoute(0, 0.10, BURN_SND_ROUTE_BOTH); - - nTaitoCyclesTotal[1] = (24000000 / 4) / 60; - - TaitoXOffset = 3; - TaitoDrawFunction = CameltryDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 DeadconxInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoCharModulo = 0x400; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 16; - TaitoCharHeight = 16; - TaitoCharPlaneOffsets = TC0480SCPCharPlaneOffsets; - TaitoCharXOffsets = TC0480SCPCharXOffsets; - TaitoCharYOffsets = TC0480SCPCharYOffsets; - TaitoNumChar = 0x2000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "deadconxj")) { - TC0480SCPInit(TaitoNumChar, 3, 0x34, -5, -1, 0, 26); - } else { - TC0480SCPInit(TaitoNumChar, 3, 0x1e, 8, -1, 0, 0); - } - - TC0140SYTInit(); - TC0360PRIInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(TC0480SCPRam , 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x600000, 0x601fff, SM_RAM); - SekSetReadByteHandler(0, Deadconx68KReadByte); - SekSetWriteByteHandler(0, Deadconx68KWriteByte); - SekSetReadWordHandler(0, Deadconx68KReadWord); - SekSetWriteWordHandler(0, Deadconx68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoDrawFunction = FootchmpDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 DinorexInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0xc000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0360PRIInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x2fffff, SM_ROM); - SekMapMemory(TaitoSpriteExtension , 0x400000, 0x400fff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x500000, 0x501fff, SM_RAM); - SekMapMemory(Taito68KRam1 , 0x600000, 0x60ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x800000, 0x80ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x900000, 0x90ffff, SM_READ); - SekSetReadByteHandler(0, Dinorex68KReadByte); - SekSetWriteByteHandler(0, Dinorex68KWriteByte); - SekSetReadWordHandler(0, Dinorex68KReadWord); - SekSetWriteWordHandler(0, Dinorex68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoF2SpriteType = 3; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 DondokodInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoCharPivotModulo = 0x100; - TaitoCharPivotNumPlanes = 4; - TaitoCharPivotWidth = 8; - TaitoCharPivotHeight = 8; - TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; - TaitoCharPivotXOffsets = PivotXOffsets; - TaitoCharPivotYOffsets = PivotYOffsets; - TaitoNumCharPivot = 0x4000; - - TaitoNumChar = 0x4000; - TaitoNumSpriteA = 0x1000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0220IOCInit(); - TC0280GRDInit(-16, -16, TaitoCharsPivot); - TC0360PRIInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekMapMemory(TC0280GRDRam , 0xa00000, 0xa01fff, SM_RAM); - SekSetReadByteHandler(0, Dondokod68KReadByte); - SekSetWriteByteHandler(0, Dondokod68KWriteByte); - SekSetReadWordHandler(0, Dondokod68KReadWord); - SekSetWriteWordHandler(0, Dondokod68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; - TaitoDrawFunction = TaitoF2PivotDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 DriftoutInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoCharPivotModulo = 0x100; - TaitoCharPivotNumPlanes = 4; - TaitoCharPivotWidth = 8; - TaitoCharPivotHeight = 8; - TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; - TaitoCharPivotXOffsets = PivotXOffsets; - TaitoCharPivotYOffsets = PivotYOffsets; - TaitoNumCharPivot = 0x4000; - TaitoNumSpriteA = 0x1000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); - TC0140SYTInit(); - TC0360PRIInit(); - TC0430GRWInit(-16, 0, TaitoCharsPivot); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(TC0430GRWRam , 0x400000, 0x401fff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Driftout68KReadByte); - SekSetWriteByteHandler(0, Driftout68KWriteByte); - SekSetReadWordHandler(0, Driftout68KReadWord); - SekSetWriteWordHandler(0, Driftout68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoDrawFunction = DriftoutDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 DriveoutInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumYM2610 = 0; - TaitoNumMSM6295 = 1; - - TaitoCharPivotModulo = 0x100; - TaitoCharPivotNumPlanes = 4; - TaitoCharPivotWidth = 8; - TaitoCharPivotHeight = 8; - TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; - TaitoCharPivotXOffsets = PivotXOffsets; - TaitoCharPivotYOffsets = PivotYOffsets; - TaitoNumCharPivot = 0x4000; - TaitoNumSpriteA = 0x1000; - - TaitoLoadRoms(0); - - TaitoMSM6295RomSize = 0x100000; - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - UINT8 *TempRom = (UINT8*)BurnMalloc(0x100000); - memcpy(TempRom, TaitoMSM6295Rom, 0x100000); - memset(TaitoMSM6295Rom, 0, 0x100000); - memcpy(TaitoMSM6295Rom + 0x00000, TempRom + 0x00000, 0x20000); - memcpy(TaitoMSM6295Rom + 0x20000, TempRom + 0x80000, 0x20000); - memcpy(TaitoMSM6295Rom + 0x40000, TempRom + 0x20000, 0x20000); - memcpy(TaitoMSM6295Rom + 0x60000, TempRom + 0x80000, 0x20000); - memcpy(TaitoMSM6295Rom + 0x80000, TempRom + 0x40000, 0x20000); - memcpy(TaitoMSM6295Rom + 0xa0000, TempRom + 0x80000, 0x20000); - memcpy(TaitoMSM6295Rom + 0xc0000, TempRom + 0x60000, 0x20000); - memcpy(TaitoMSM6295Rom + 0xe0000, TempRom + 0x80000, 0x20000); - BurnFree(TempRom); - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); - TC0360PRIInit(); - TC0430GRWInit(-16, 0, TaitoCharsPivot); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(TC0430GRWRam , 0x400000, 0x401fff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Driftout68KReadByte); - SekSetWriteByteHandler(0, Driveout68KWriteByte); - SekSetReadWordHandler(0, Driftout68KReadWord); - SekSetWriteWordHandler(0, Driftout68KWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(DriveoutZ80Read); - ZetSetWriteHandler(DriveoutZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x8000, 0x87ff, 0, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x87ff, 1, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x87ff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - MSM6295Init(0, 1056000 / 132, 0); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - TaitoXOffset = 3; - TaitoDrawFunction = DriftoutDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 FinalbInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x2000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 6; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = FinalbSpritePlaneOffsets; - TaitoSpriteAXOffsets = FinalbSpriteXOffsets; - TaitoSpriteAYOffsets = FinalbSpriteYOffsets; - TaitoNumSpriteA = 0x2000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - TaitoNumSpriteA = 0x0000; // Need to load these outside of the usual routine - - if (TaitoLoadRoms(1)) return 1; - - TC0110PCRInit(1, 0x1000); - TC0100SCNInit(0, TaitoNumChar, 1, 8, 0, NULL); - TC0140SYTInit(); - TC0220IOCInit(); - - // Load and decode Sprites - INT32 nRet; - TaitoNumSpriteA = 0x2000; - UINT8 *TempRom = (UINT8*)BurnMalloc(0x200000); - memset(TempRom, 0, 0x200000); - nRet = BurnLoadRom(TempRom + 0x000000 , 5, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(TempRom + 0x000001 , 6, 2); if (nRet != 0) return 1; - nRet = BurnLoadRom(TempRom + 0x180000 , 7, 1); if (nRet != 0) return 1; - - INT32 Offset = 0x100000; - UINT8 Data, d1, d2, d3, d4; - for (INT32 i = 0x180000; i < 0x200000; i++) { - Data = TempRom[i]; - d1 = (Data >> 0) & 3; - d2 = (Data >> 2) & 3; - d3 = (Data >> 4) & 3; - d4 = (Data >> 6) & 3; - - TempRom[Offset] = (d3 << 2) | (d4 << 6); - Offset++; - - TempRom[Offset] = (d1 << 2) | (d2 << 6); - Offset++; - } - GfxDecode(TaitoNumSpriteA, TaitoSpriteANumPlanes, TaitoSpriteAWidth, TaitoSpriteAHeight, FinalbSpritePlaneOffsets, FinalbSpriteXOffsets, FinalbSpriteYOffsets, TaitoSpriteAModulo, TempRom, TaitoSpritesA); - BurnFree(TempRom); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Finalb68KReadByte); - SekSetWriteByteHandler(0, Finalb68KWriteByte); - SekSetReadWordHandler(0, Finalb68KReadWord); - SekSetWriteWordHandler(0, Finalb68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 1; - TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; - TaitoDrawFunction = FinalbDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 FootchmpInit() -{ - INT32 nLen; - - TaitoF2Init(); - - Footchmp = 1; - - TaitoCharModulo = 0x400; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 16; - TaitoCharHeight = 16; - TaitoCharPlaneOffsets = TC0480SCPCharPlaneOffsets; - TaitoCharXOffsets = TC0480SCPCharXOffsets; - TaitoCharYOffsets = TC0480SCPCharYOffsets; - TaitoNumChar = 0x2000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "hthero")) { - TC0480SCPInit(TaitoNumChar, 3, 0x33, -4, -1, 0, 24); - } else { - TC0480SCPInit(TaitoNumChar, 3, 0x1d, 8, -1, 0, 0); - } - TC0140SYTInit(); - TC0360PRIInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(TC0480SCPRam , 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x600000, 0x601fff, SM_RAM); - SekSetReadByteHandler(0, Footchmp68KReadByte); - SekSetWriteByteHandler(0, Footchmp68KWriteByte); - SekSetReadWordHandler(0, Footchmp68KReadWord); - SekSetWriteWordHandler(0, Footchmp68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoF2SpriteBufferFunction = TaitoF2FullBufferDelayed; - TaitoDrawFunction = FootchmpDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 GrowlInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0360PRIInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Growl68KReadByte); - SekSetWriteByteHandler(0, Growl68KWriteByte); - SekSetReadWordHandler(0, Growl68KReadWord); - SekSetWriteWordHandler(0, Growl68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 GunfrontInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0x2000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0360PRIInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Gunfront68KReadByte); - SekSetWriteByteHandler(0, Gunfront68KWriteByte); - SekSetReadWordHandler(0, Gunfront68KReadWord); - SekSetWriteWordHandler(0, Gunfront68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 KoshienInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 1, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0360PRIInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRom1 + 0x40000 , 0x080000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Koshien68KReadByte); - SekSetWriteByteHandler(0, Koshien68KWriteByte); - SekSetReadWordHandler(0, Koshien68KReadWord); - SekSetWriteWordHandler(0, Koshien68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 1; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 LiquidkInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x4000; - TaitoNumSpriteA = 0x2000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0220IOCInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Liquidk68KReadByte); - SekSetWriteByteHandler(0, Liquidk68KWriteByte); - SekSetReadWordHandler(0, Liquidk68KReadWord); - SekSetWriteWordHandler(0, Liquidk68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 MegablstInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x4000; - TaitoNumSpriteA = 0x2000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0220IOCInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x300000, 0x301fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x600000, 0x60ffff, SM_READ); - SekMapMemory(Taito68KRam1 + 0x10000 , 0x610000, 0x61ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x800000, 0x80ffff, SM_RAM); - SekSetReadByteHandler(0, Megablst68KReadByte); - SekSetWriteByteHandler(0, Megablst68KWriteByte); - SekSetReadWordHandler(0, Megablst68KReadWord); - SekSetWriteWordHandler(0, Megablst68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - MegabCChipInit(); - - TaitoXOffset = 3; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 MetalbInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoCharModulo = 0x400; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 16; - TaitoCharHeight = 16; - TaitoCharPlaneOffsets = TC0480SCPCharPlaneOffsets; - TaitoCharXOffsets = TC0480SCPCharXOffsets; - TaitoCharYOffsets = TC0480SCPCharYOffsets; - TaitoNumChar = 0x2000; - - TaitoNumSpriteA = 0x2000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0480SCPInit(TaitoNumChar, 3, 0x32, -4, 1, 0, 24); - TC0480SCPSetColourBase(256); - TC0140SYTInit(); - TC0360PRIInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(TC0480SCPRam , 0x500000, 0x50ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x700000, 0x703fff, SM_RAM); - SekSetReadByteHandler(0, Metalb68KReadByte); - SekSetWriteByteHandler(0, Metalb68KWriteByte); - SekSetReadWordHandler(0, Metalb68KReadWord); - SekSetWriteWordHandler(0, Metalb68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoDrawFunction = MetalbDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 MjnquestInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x10000; - TaitoNumSpriteA = 0x1000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - // Load and decode Sprites - INT32 nRet; - UINT8 *TempRom = (UINT8*)BurnMalloc(TaitoSpriteARomSize); - memset(TempRom, 0, TaitoSpriteARomSize); - nRet = BurnLoadRom(TempRom + 0x000000 , 6, 1); if (nRet != 0) return 1; - for (UINT32 i = 0; i < TaitoSpriteARomSize; i += 2) { - INT32 Temp = TempRom[i]; - TempRom[i + 0] = (TempRom[i + 1] >> 4) | (TempRom[i + 1] << 4); - TempRom[i + 1] = (Temp >> 4) | (Temp << 4); - } - GfxDecode(TaitoNumSpriteA, TaitoSpriteANumPlanes, TaitoSpriteAWidth, TaitoSpriteAHeight, TaitoSpriteAPlaneOffsets, TaitoSpriteAXOffsets, TaitoSpriteAYOffsets, TaitoSpriteAModulo, TempRom, TaitoSpritesA); - BurnFree(TempRom); - - TC0110PCRInit(1, 0x1000); - TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); - TC0100SCNSetGfxMask(0, 0x7fff); - TC0140SYTInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRom1 + 0x40000 , 0x080000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x110000, 0x12ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x500000, 0x50ffff, SM_RAM); - SekSetReadByteHandler(0, Mjnquest68KReadByte); - SekSetWriteByteHandler(0, Mjnquest68KWriteByte); - SekSetReadWordHandler(0, Mjnquest68KReadWord); - SekSetWriteWordHandler(0, Mjnquest68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoDrawFunction = FinalbDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 NinjakInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x4000; - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Ninjak68KReadByte); - SekSetWriteByteHandler(0, Ninjak68KWriteByte); - SekSetReadWordHandler(0, Ninjak68KReadWord); - SekSetWriteWordHandler(0, Ninjak68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 PulirulaInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoCharPivotModulo = 0x100; - TaitoCharPivotNumPlanes = 4; - TaitoCharPivotWidth = 8; - TaitoCharPivotHeight = 8; - TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; - TaitoCharPivotXOffsets = PivotXOffsets; - TaitoCharPivotYOffsets = PivotYOffsets; - TaitoNumCharPivot = 0x4000; - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0360PRIInit(); - TC0430GRWInit(-10, 0, TaitoCharsPivot); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(TC0430GRWRam , 0x400000, 0x401fff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteExtension , 0x600000, 0x603fff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Pulirula68KReadByte); - SekSetWriteByteHandler(0, Pulirula68KWriteByte); - SekSetReadWordHandler(0, Pulirula68KReadWord); - SekSetWriteWordHandler(0, Pulirula68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoF2SpriteType = 2; - TaitoDrawFunction = PulirulaDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 QcrayonInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0360PRIInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(Taito68KRom1 + 0x80000 , 0x300000, 0x3fffff, SM_ROM); - SekMapMemory(TaitoSpriteExtension , 0x600000, 0x603fff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x800000, 0x80ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x900000, 0x90ffff, SM_READ); - SekSetReadByteHandler(0, Qcrayon68KReadByte); - SekSetWriteByteHandler(0, Qcrayon68KWriteByte); - SekSetReadWordHandler(0, Qcrayon68KReadWord); - SekSetWriteWordHandler(0, Qcrayon68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoF2SpriteType = 3; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 Qcrayon2Init() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0360PRIInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x300000, 0x301fff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x500000, 0x50ffff, SM_READ); - SekMapMemory(Taito68KRom1 + 0x80000 , 0x600000, 0x6fffff, SM_ROM); - SekMapMemory(TaitoSpriteExtension , 0xb00000, 0xb017ff, SM_RAM); - SekSetReadByteHandler(0, Qcrayon268KReadByte); - SekSetWriteByteHandler(0, Qcrayon268KWriteByte); - SekSetReadWordHandler(0, Qcrayon268KReadWord); - SekSetWriteWordHandler(0, Qcrayon268KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoF2SpriteType = 3; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 QjinseiInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0360PRIInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRom1 + 0x80000 , 0x100000, 0x1fffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(TaitoSpriteExtension , 0x600000, 0x603fff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Qjinsei68KReadByte); - SekSetWriteByteHandler(0, Qjinsei68KWriteByte); - SekSetReadWordHandler(0, Qjinsei68KReadWord); - SekSetWriteWordHandler(0, Qjinsei68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoF2SpriteType = 3; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 QtorimonInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumSpriteA = 0x0800; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0110PCRInit(1, 0x1000); - TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); - TC0140SYTInit(); - TC0220IOCInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Qtorimon68KReadByte); - SekSetWriteByteHandler(0, Qtorimon68KWriteByte); - SekSetReadWordHandler(0, Qtorimon68KReadWord); - SekSetWriteWordHandler(0, Qtorimon68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; - TaitoDrawFunction = QtorimonDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 QuizhqInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumSpriteA = 0x1000; - - TaitoLoadRoms(0); - - Taito68KRom1Size = 0xc0000; - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - memcpy(Taito68KRom1 + 0x80000, Taito68KRom1 + 0x40000, 0x40000); - memset(Taito68KRom1 + 0x40000, 0, 0x40000); - - TC0110PCRInit(1, 0x1000); - TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); - TC0140SYTInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Quizhq68KReadByte); - SekSetWriteByteHandler(0, Quizhq68KWriteByte); - SekSetReadWordHandler(0, Quizhq68KReadWord); - SekSetWriteWordHandler(0, Quizhq68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; - TaitoDrawFunction = QtorimonDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 QzchikyuInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0x2000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); - TC0140SYTInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRom1 + 0x40000 , 0x100000, 0x17ffff, SM_ROM); - SekMapMemory(TaitoPaletteRam , 0x400000, 0x401fff, SM_RAM); - SekMapMemory(Taito68KRam1 , 0x500000, 0x50ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x600000, 0x60ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x700000, 0x70ffff, SM_READ); - SekSetReadByteHandler(0, Qzchikyu68KReadByte); - SekSetWriteByteHandler(0, Qzchikyu68KWriteByte); - SekSetReadWordHandler(0, Qzchikyu68KReadWord); - SekSetWriteWordHandler(0, Qzchikyu68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayedQzchikyu; - TaitoDrawFunction = QzquestDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 QzquestInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0x2000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); - TC0140SYTInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRom1 + 0x40000 , 0x100000, 0x1fffff, SM_ROM); - SekMapMemory(TaitoPaletteRam , 0x400000, 0x401fff, SM_RAM); - SekMapMemory(Taito68KRam1 , 0x500000, 0x50ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x600000, 0x60ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x700000, 0x70ffff, SM_READ); - SekSetReadByteHandler(0, Qzquest68KReadByte); - SekSetWriteByteHandler(0, Qzquest68KWriteByte); - SekSetReadWordHandler(0, Qzquest68KReadWord); - SekSetWriteWordHandler(0, Qzquest68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; - TaitoDrawFunction = QzquestDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 SolfigtrInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x8000; - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); - TC0140SYTInit(); - TC0360PRIInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekSetReadByteHandler(0, Solfigtr68KReadByte); - SekSetWriteByteHandler(0, Solfigtr68KWriteByte); - SekSetReadWordHandler(0, Solfigtr68KReadWord); - SekSetWriteWordHandler(0, Solfigtr68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 SsiInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumSpriteA = 0x2000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 0, 0, 0, NULL); - TC0140SYTInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x300000, 0x301fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x600000, 0x60ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x800000, 0x80ffff, SM_RAM); - SekSetReadByteHandler(0, Ssi68KReadByte); - SekSetWriteByteHandler(0, Ssi68KWriteByte); - SekSetReadWordHandler(0, Ssi68KReadWord); - SekSetWriteWordHandler(0, Ssi68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayedThundfox; - TaitoDrawFunction = SsiDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 ThundfoxInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoNumChar = 0x4000; - - TaitoCharBModulo = 0x100; - TaitoCharBNumPlanes = 4; - TaitoCharBWidth = 8; - TaitoCharBHeight = 8; - TaitoCharBPlaneOffsets = CharPlaneOffsets; - TaitoCharBXOffsets = CharXOffsets; - TaitoCharBYOffsets = CharYOffsets; - TaitoNumCharB = 0x4000; - - TaitoNumSpriteA = 0x2000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); - TC0100SCNSetClipArea(0, nScreenWidth, nScreenHeight, 0); - TC0100SCNInit(1, TaitoNumCharB, 3, 16, 0, NULL); - TC0100SCNSetClipArea(1, nScreenWidth, nScreenHeight, 0); - TC0140SYTInit(); - TC0220IOCInit(); - TC0360PRIInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(TaitoPaletteRam , 0x100000, 0x101fff, SM_RAM); - SekMapMemory(Taito68KRam1 , 0x300000, 0x30ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x400000, 0x40ffff, SM_READ); - SekMapMemory(TC0100SCNRam[1] , 0x500000, 0x50ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x600000, 0x60ffff, SM_RAM); - SekSetReadByteHandler(0, Thundfox68KReadByte); - SekSetWriteByteHandler(0, Thundfox68KWriteByte); - SekSetReadWordHandler(0, Thundfox68KReadWord); - SekSetWriteWordHandler(0, Thundfox68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoXOffset = 3; - TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayedThundfox; - TaitoDrawFunction = ThundfoxDraw; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 YesnojInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoCharModulo = 0x40; - TaitoCharNumPlanes = 1; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = YuyugogoCharPlaneOffsets; - TaitoCharXOffsets = YuyugogoCharXOffsets; - TaitoCharYOffsets = YuyugogoCharYOffsets; - TaitoNumChar = 0x10000; - - TaitoNumSpriteA = 0x2000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); - TC0140SYTInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x200000, 0x20ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x500000, 0x50ffff, SM_READ); - SekMapMemory(TaitoPaletteRam , 0x600000, 0x601fff, SM_RAM); - SekSetReadByteHandler(0, Yesnoj68KReadByte); - SekSetWriteByteHandler(0, Yesnoj68KWriteByte); - SekSetReadWordHandler(0, Yesnoj68KReadWord); - SekSetWriteWordHandler(0, Yesnoj68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoDrawFunction = YuyugogoDraw; - TaitoXOffset = 3; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 YuyugogoInit() -{ - INT32 nLen; - - TaitoF2Init(); - - TaitoCharModulo = 0x40; - TaitoCharNumPlanes = 1; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = YuyugogoCharPlaneOffsets; - TaitoCharXOffsets = YuyugogoCharXOffsets; - TaitoCharYOffsets = YuyugogoCharYOffsets; - TaitoNumChar = 0x4000; - - TaitoNumSpriteA = 0x4000; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); - TC0140SYTInit(); - TC0510NIOInit(); - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0xa00000, 0xa01fff, SM_RAM); - SekMapMemory(Taito68KRam1 , 0xb00000, 0xb10fff, SM_RAM); - SekMapMemory(TaitoSpriteExtension , 0xc00000, 0xc01fff, SM_RAM); - SekMapMemory(Taito68KRom1 + 0x40000 , 0xd00000, 0xdfffff, SM_ROM); - SekSetReadByteHandler(0, Yuyugogo68KReadByte); - SekSetWriteByteHandler(0, Yuyugogo68KWriteByte); - SekSetReadWordHandler(0, Yuyugogo68KReadWord); - SekSetWriteWordHandler(0, Yuyugogo68KWriteWord); - SekClose(); - - TaitoF2SoundInit(); - - TaitoDrawFunction = YuyugogoDraw; - TaitoF2SpriteType = 1; - TaitoXOffset = 3; - - // Reset the driver - TaitoF2DoReset(); - - return 0; -} - -static INT32 TaitoF2Exit() -{ - TaitoExit(); - - TaitoF2SpritesFlipScreen = 0; - TaitoF2SpriteBlendMode = 0; - TaitoF2TilePriority[0] = TaitoF2TilePriority[1] = TaitoF2TilePriority[2] = TaitoF2TilePriority[3] = TaitoF2TilePriority[4] = 0; - TaitoF2SpritePriority[0] = TaitoF2SpritePriority[1] = TaitoF2SpritePriority[2] = TaitoF2SpritePriority[3] = 0; - - TaitoF2SpriteType = 0; - Footchmp = 0; - YesnoDip = 0; - MjnquestInput = 0; - DriveoutSoundNibble = 0; - DriveoutOkiBank = 0; - - TaitoF2SpriteBufferFunction = NULL; - - // Switch back CPU core if needed - if (bUseAsm68KCoreOldValue) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); -#endif - bUseAsm68KCoreOldValue = false; - bBurnUseASMCPUEmulation = true; - } - - - return 0; -} - -static inline UINT8 pal4bit(UINT8 bits) -{ - bits &= 0x0f; - return (bits << 4) | bits; -} - -static inline UINT8 pal5bit(UINT8 bits) -{ - bits &= 0x1f; - return (bits << 3) | (bits >> 2); -} - - -inline static INT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 12); - g = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 8); - b = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 4); - - return BurnHighCol(r, g, b, 0); -} - -inline static INT32 QzquestCalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 10); - g = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 5); - b = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); - - return BurnHighCol(r, g, b, 0); -} - -static void TaitoF2CalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x1000; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } -} - -static void MetalbCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x2000; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } -} - -static void QzquestCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x1000; i++, ps++, pd++) { - *pd = QzquestCalcCol(*ps); - } -} - -static void UpdateTaitoF2SpriteBanks() -{ - INT32 i; - - for (i = 0; i < 8; i++) { - TaitoF2SpriteBank[i] = TaitoF2SpriteBankBuffered[i]; - } -} - -void TaitoF2HandleSpriteBuffering() -{ - if (TaitoF2PrepareSprites) { - memcpy(TaitoSpriteRamBuffered, TaitoSpriteRam, 0x10000); - TaitoF2PrepareSprites = 0; - } -} - -static void TaitoF2UpdateSpritesActiveArea() -{ - INT32 Off; - UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; - - UpdateTaitoF2SpriteBanks(); - - TaitoF2HandleSpriteBuffering(); - - if (TaitoF2SpritesActiveArea == 0x8000 && SpriteRamBuffered[(0x8000 + 6) / 2] == 0 && SpriteRamBuffered[(0x8000 + 10) / 2] == 0) TaitoF2SpritesActiveArea = 0; - - for (Off = 0; Off < 0x4000; Off += 16) { - INT32 Offs = Off + TaitoF2SpritesActiveArea; - - if (SpriteRamBuffered[(Offs + 6) / 2] & 0x8000) { - TaitoF2SpritesDisabled = SpriteRamBuffered[(Offs + 10) / 2] & 0x1000; - if (Footchmp) { - TaitoF2SpritesActiveArea = 0x8000 * (SpriteRamBuffered[(Offs + 6) / 2] & 0x0001); - } else { - TaitoF2SpritesActiveArea = 0x8000 * (SpriteRamBuffered[(Offs + 10) / 2] & 0x0001); - } - } - - if ((SpriteRamBuffered[(Offs + 4) / 2] & 0xf000) == 0xa000) { - TaitoF2SpritesMasterScrollX = SpriteRamBuffered[(Offs + 4) / 2] & 0xfff; - if (TaitoF2SpritesMasterScrollX >= 0x800) TaitoF2SpritesMasterScrollX -= 0x1000; - - TaitoF2SpritesMasterScrollY = SpriteRamBuffered[(Offs + 6) / 2] & 0xfff; - if (TaitoF2SpritesMasterScrollY >= 0x800) TaitoF2SpritesMasterScrollY -= 0x1000; - } - } -} - -static void RenderSpriteZoom(INT32 Code, INT32 sx, INT32 sy, INT32 Colour, INT32 xFlip, INT32 yFlip, INT32 xScale, INT32 yScale, INT32 Priority, UINT8* pSource) -{ - UINT8 *SourceBase = pSource + ((Code % TaitoNumSpriteA) * TaitoSpriteAWidth * TaitoSpriteAHeight); - - INT32 SpriteScreenHeight = (yScale * TaitoSpriteAHeight + 0x8000) >> 16; - INT32 SpriteScreenWidth = (xScale * TaitoSpriteAWidth + 0x8000) >> 16; - - Colour = 0x10 * (Colour % 0x100); - - if (TaitoF2SpritesFlipScreen) { - xFlip = !xFlip; - sx = 320 - sx - (xScale >> 12); - yFlip = !yFlip; - sy = 256 - sy - (yScale >> 12); - } - - if (SpriteScreenWidth && SpriteScreenHeight) { - INT32 dx = (TaitoSpriteAWidth << 16) / SpriteScreenWidth; - INT32 dy = (TaitoSpriteAHeight << 16) / SpriteScreenHeight; - - INT32 ex = sx + SpriteScreenWidth; - INT32 ey = sy + SpriteScreenHeight; - - INT32 xIndexBase; - INT32 yIndex; - - if (xFlip) { - xIndexBase = (SpriteScreenWidth - 1) * dx; - dx = -dx; - } else { - xIndexBase = 0; - } - - if (yFlip) { - yIndex = (SpriteScreenHeight - 1) * dy; - dy = -dy; - } else { - yIndex = 0; - } - - if (sx < 0) { - INT32 Pixels = 0 - sx; - sx += Pixels; - xIndexBase += Pixels * dx; - } - - if (sy < 0) { - INT32 Pixels = 0 - sy; - sy += Pixels; - yIndex += Pixels * dy; - } - - if (ex > nScreenWidth) { - INT32 Pixels = ex - nScreenWidth; - ex -= Pixels; - } - - if (ey > nScreenHeight) { - INT32 Pixels = ey - nScreenHeight; - ey -= Pixels; - } - - if (ex > sx) { - INT32 y; - - for (y = sy; y < ey; y++) { - UINT8 *Source = SourceBase + ((yIndex >> 16) * TaitoSpriteAWidth); - UINT16* pPixel = pTransDraw + (y * nScreenWidth); - - INT32 x, xIndex = xIndexBase; - for (x = sx; x < ex; x++) { - INT32 c = Source[xIndex >> 16]; - if (c != 0) { - if (TaitoF2SpriteBlendMode) { - INT32 Pri = TaitoPriorityMap[(y * nScreenWidth) + x]; - INT32 TilePri = 0; - - if (TaitoIC_TC0100SCNInUse) { - if (Pri == 1) TilePri = TaitoF2TilePriority[0]; - if (Pri == 2) TilePri = TaitoF2TilePriority[1]; - if (Pri == 4) TilePri = TaitoF2TilePriority[2]; - } - - if (((TaitoF2SpriteBlendMode & 0xc0) == 0xc0) && (Priority == (TilePri - 1))) { - pPixel[x] = ((c | Colour) & 0xfff0) | (pPixel[x] & 0x0f); - } else { - if (((TaitoF2SpriteBlendMode & 0xc0) == 0xc0) && (Priority == (TilePri + 1))) { - if (pPixel[x] & 0x0f) { - pPixel[x] = (pPixel[x] & 0xfff0) | ((c | Colour) & 0x0f); - } else { - pPixel[x] = c | Colour; - } - } else { - if (((TaitoF2SpriteBlendMode & 0xc0) == 0x80) && (Priority == (TilePri - 1))) { - pPixel[x] = pPixel[x] & 0xffef; - } else { - if (((TaitoF2SpriteBlendMode & 0xc0) == 0x80) && (Priority == (TilePri + 1))) { - pPixel[x] = (c | Colour) & 0xffef; - } else { - pPixel[x] = c | Colour; - } - } - } - } - } else { - pPixel[x] = c | Colour; - } - } - xIndex += dx; - } - - yIndex += dy; - } - } - } -} - -void TaitoF2MakeSpriteList() -{ - INT32 i, x, y, Off, ExtOffs; - INT32 Code, Colour, SpriteData, SpriteCont, xFlip, yFlip; - INT32 xCurrent, yCurrent, BigSprite = 0; - INT32 yNum = 0, xNum = 0, xLatch = 0, yLatch = 0, LastContinuationTile = 0; - UINT32 ZoomWord, xZoom, yZoom, zx = 0, zy = 0, xZoomLatch = 0, yZoomLatch = 0; - INT32 xScroll1, yScroll1; - INT32 xScroll = 0, yScroll = 0; - INT32 xCur, yCur; - INT32 xOffset = 0; - - INT32 Disabled = TaitoF2SpritesDisabled; - INT32 MasterScrollX = TaitoF2SpritesMasterScrollX; - INT32 MasterScrollY = TaitoF2SpritesMasterScrollY; - INT32 Area = TaitoF2SpritesActiveArea; - - UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; - UINT16 *SpriteExtension = (UINT16*)TaitoSpriteExtension; - struct TaitoF2SpriteEntry *SpritePtr = TaitoF2SpriteList; - - memset(TaitoF2SpriteList, 0, 0x400 * sizeof(TaitoF2SpriteEntry)); - - xScroll1 = 0; - yScroll1 = 0; - x = y = 0; - xCurrent = yCurrent = 0; - Colour = 0; - - xOffset = TaitoXOffset; - if (TaitoF2SpritesFlipScreen) xOffset = -TaitoXOffset; - - if (Area == 0x8000 && SpriteRamBuffered[(0x8000 + 6) / 2] == 0 && SpriteRamBuffered[(0x8000 + 10) / 2] == 0) Area = 0; - - for (Off = 0; Off < 0x4000; Off += 16) { - INT32 Offs = Off + Area; - - if (SpriteRamBuffered[(Offs + 6) / 2] & 0x8000) { - Disabled = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 10) / 2]) & 0x1000; - TaitoF2SpritesFlipScreen = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 10) / 2]) & 0x2000; - - xOffset = TaitoXOffset; - if (TaitoF2SpritesFlipScreen) xOffset = -TaitoXOffset; - - if (Footchmp) { - Area = 0x8000 * (BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 6) / 2]) & 0x0001); - } else { - Area = 0x8000 * (BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 10) / 2]) & 0x0001); - } - } - - if ((BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]) & 0xf000) == 0xa000) { - MasterScrollX = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]) & 0xfff; - if (MasterScrollX >= 0x800) MasterScrollX -= 0x1000; - - MasterScrollY = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 6) / 2]) & 0xfff; - if (MasterScrollY >= 0x800) MasterScrollY -= 0x1000; - } - - if ((BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]) & 0xf000) == 0x5000) { - xScroll1 = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]) & 0xfff; - if (xScroll1 >= 0x800) xScroll1 -= 0x1000; - - yScroll1 = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 6) / 2]) & 0xfff; - if (yScroll1 >= 0x800) yScroll1 -= 0x1000; - } - - if (Disabled) - continue; - - SpriteData = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 8) / 2]); - - SpriteCont = (SpriteData & 0xff00) >> 8; - - if ((SpriteCont & 0x08) != 0) { - if (BigSprite == 0) { - xLatch = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]) & 0xfff; - yLatch = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 6) / 2]) & 0xfff; - xNum = 0; - yNum = 0; - ZoomWord = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 2) / 2]); - yZoomLatch = (ZoomWord >> 8) & 0xff; - xZoomLatch = (ZoomWord) & 0xff; - BigSprite = 1; - } - } else if (BigSprite) { - LastContinuationTile = 1; - } - - if ((SpriteCont & 0x04) == 0) Colour = SpriteData & 0xff; - - if (BigSprite == 0 || (SpriteCont & 0xf0) == 0) { - x = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]); - - if (x & 0x8000) { - xScroll = -xOffset - 0x60; - yScroll = 0; - } else if (x & 0x4000) { - xScroll = MasterScrollX - xOffset - 0x60; - yScroll = MasterScrollY; - } else { - xScroll = xScroll1 + MasterScrollX - xOffset - 0x60; - yScroll = yScroll1 + MasterScrollY; - } - - x &= 0xfff; - y = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 6) / 2]) & 0xfff; - - xCurrent = x; - yCurrent = y; - } else { - if ((SpriteCont & 0x10) == 0) { - y = yCurrent; - } else if ((SpriteCont & 0x20) != 0) { - y += 16; - yNum++; - } - - if ((SpriteCont & 0x40) == 0) { - x = xCurrent; - } else if ((SpriteCont & 0x80) != 0){ - x += 16; - yNum=0; - xNum++; - } - } - - if (BigSprite) { - xZoom = xZoomLatch; - yZoom = yZoomLatch; - zx = 0x10; - zy = 0x10; - - if (xZoom || yZoom) { - x = xLatch + (xNum * (0x100 - xZoom) + 12) / 16; - y = yLatch + (yNum * (0x100 - yZoom) + 12) / 16; - zx = xLatch + ((xNum + 1) * (0x100 - xZoom) + 12) / 16 - x; - zy = yLatch + ((yNum + 1) * (0x100 - yZoom) + 12) / 16 - y; - } - } else { - ZoomWord = SpriteRamBuffered[(Offs + 2) / 2]; - yZoom = (ZoomWord >> 8) & 0xff; - xZoom = (ZoomWord) & 0xff; - zx = (0x100 - xZoom) / 16; - zy = (0x100 - yZoom) / 16; - } - - if (LastContinuationTile) { - BigSprite = 0; - LastContinuationTile = 0; - } - - Code = 0; - ExtOffs = Offs; - if (ExtOffs >= 0x8000) ExtOffs -= 0x4000; - - if (TaitoF2SpriteType == 0) { - Code = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[Offs / 2]) & 0x1fff; - i = (Code & 0x1c00) >> 10; - Code = TaitoF2SpriteBank[i] + (Code & 0x3ff); - } - - if (TaitoF2SpriteType == 1) { - Code = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[Offs / 2]) & 0x3ff; - i = (BURN_ENDIAN_SWAP_INT16(SpriteExtension[(ExtOffs >> 4)]) & 0x3f) << 10; - Code = (i | Code); - } - - if (TaitoF2SpriteType == 2) { - Code = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[Offs / 2]) & 0xff; - i = (BURN_ENDIAN_SWAP_INT16(SpriteExtension[(ExtOffs >> 4)]) & 0xff00); - Code = (i | Code); - } - - if (TaitoF2SpriteType == 3) { - Code = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[Offs / 2]) & 0xff; - i = (BURN_ENDIAN_SWAP_INT16(SpriteExtension[ExtOffs >> 4]) & 0xff) << 8; - Code = (i | Code); - } - - if (Code == 0) continue; - - xFlip = SpriteCont & 0x01; - yFlip = SpriteCont & 0x02; - - xCur = (x + xScroll) & 0xfff; - if (xCur >= 0x800) xCur -= 0x1000; - - yCur = (y + yScroll) & 0xfff; - if (yCur >= 0x800) yCur -= 0x1000; - - if (TaitoF2SpritesFlipScreen) { - yCur += 16; - } else { - yCur -= 16; - } - - INT32 Priority = (Colour & 0xc0) >> 6; - - SpritePtr->Code = Code; - SpritePtr->x = xCur; - SpritePtr->y = yCur; - SpritePtr->Colour = Colour; - SpritePtr->xFlip = xFlip; - SpritePtr->yFlip = yFlip; - SpritePtr->xZoom = zx << 12; - SpritePtr->yZoom = zy << 12; - SpritePtr->Priority = TaitoF2SpritePriority[Priority]; - SpritePtr++; - } -} - -void TaitoF2RenderSpriteList(INT32 TaitoF2SpritePriorityLevel) -{ - for (INT32 i = 0; i < 0x400; i++) { - if (TaitoF2SpriteList[i].Priority == TaitoF2SpritePriorityLevel) RenderSpriteZoom(TaitoF2SpriteList[i].Code, TaitoF2SpriteList[i].x, TaitoF2SpriteList[i].y, TaitoF2SpriteList[i].Colour, TaitoF2SpriteList[i].xFlip, TaitoF2SpriteList[i].yFlip, TaitoF2SpriteList[i].xZoom, TaitoF2SpriteList[i].yZoom, TaitoF2SpritePriorityLevel, TaitoSpritesA); - } -} - -void TaitoF2NoBuffer() -{ - TaitoF2UpdateSpritesActiveArea(); - TaitoF2PrepareSprites = 1; -} - -void TaitoF2PartialBufferDelayed() -{ - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; - - TaitoF2UpdateSpritesActiveArea(); - TaitoF2PrepareSprites = 0; - memcpy(TaitoSpriteRamBuffered, TaitoSpriteRamDelayed, 0x10000); - for (INT32 i = 0; i < 0x10000 / 2; i += 4) SpriteRamBuffered[i] = SpriteRam[i]; - memcpy(TaitoSpriteRamDelayed, TaitoSpriteRam, 0x10000); -} - -void TaitoF2PartialBufferDelayedQzchikyu() -{ - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; - - TaitoF2UpdateSpritesActiveArea(); - TaitoF2PrepareSprites = 0; - memcpy(TaitoSpriteRamBuffered, TaitoSpriteRamDelayed, 0x10000); - for (INT32 i = 0; i < 0x10000 / 2; i += 8) { - SpriteRamBuffered[i + 0] = SpriteRam[i + 0]; - SpriteRamBuffered[i + 1] = SpriteRam[i + 1]; - SpriteRamBuffered[i + 4] = SpriteRam[i + 4]; - SpriteRamBuffered[i + 5] = SpriteRam[i + 5]; - SpriteRamBuffered[i + 6] = SpriteRam[i + 6]; - SpriteRamBuffered[i + 7] = SpriteRam[i + 7]; - } - memcpy(TaitoSpriteRamDelayed, TaitoSpriteRam, 0x10000); -} - -void TaitoF2PartialBufferDelayedThundfox() -{ - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; - - TaitoF2UpdateSpritesActiveArea(); - TaitoF2PrepareSprites = 0; - memcpy(TaitoSpriteRamBuffered, TaitoSpriteRamDelayed, 0x10000); - for (INT32 i = 0; i < 0x10000 / 2; i += 8) { - SpriteRamBuffered[i + 0] = SpriteRam[i + 0]; - SpriteRamBuffered[i + 1] = SpriteRam[i + 1]; - SpriteRamBuffered[i + 4] = SpriteRam[i + 4]; - } - memcpy(TaitoSpriteRamDelayed, TaitoSpriteRam, 0x10000); -} - -void TaitoF2FullBufferDelayed() -{ - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; - - TaitoF2UpdateSpritesActiveArea(); - TaitoF2PrepareSprites = 0; - memcpy(TaitoSpriteRamBuffered, TaitoSpriteRamDelayed, 0x10000); - for (INT32 i = 0;i < 0x10000 / 2; i++) SpriteRamBuffered[i] = SpriteRam[i]; - memcpy(TaitoSpriteRamDelayed, TaitoSpriteRam, 0x10000); -} - -static void TaitoF2Draw() -{ - INT32 i; - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - INT32 DrawLayer0 = 1; - INT32 DrawLayer1 = 1; - INT32 DrawLayer2 = 1; - - if (TC0100SCNBottomLayer(0)) { - TaitoF2TilePriority[1] = TC0360PRIRegs[5] & 0x0f; - TaitoF2TilePriority[0] = TC0360PRIRegs[5] >> 4; - } else { - TaitoF2TilePriority[0] = TC0360PRIRegs[5] & 0x0f; - TaitoF2TilePriority[1] = TC0360PRIRegs[5] >> 4; - } - TaitoF2TilePriority[2] = TC0360PRIRegs[4] >> 4; - - if (TaitoF2TilePriority[1] < TaitoF2TilePriority[0]) TaitoF2TilePriority[1] = TaitoF2TilePriority[0]; - - TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; - TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; - TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; - TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; - - TaitoF2SpriteBlendMode = TC0360PRIRegs[0] & 0xc0; - - BurnTransferClear(); - TaitoF2CalcPalette(); - - // Detect when we are using sprite blending with the sprite under the tile layer - UINT8 TileAltPriority[3] = { 0xff, 0xff, 0xff }; - if (TaitoF2SpriteBlendMode) { - for (i = 0; i < 4; i++) { - if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[0] - 1) { - TileAltPriority[0] = TaitoF2SpritePriority[i]; - DrawLayer0 = 0; - } - - if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[1] - 1) { - TileAltPriority[1] = TaitoF2SpritePriority[i]; - DrawLayer1 = 0; - } - - if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[2] - 1) { - TileAltPriority[2] = TaitoF2SpritePriority[i]; - DrawLayer2 = 0; - } - } - } - - TaitoF2MakeSpriteList(); - - if (TC0100SCNBottomLayer(0)) { - for (i = 0; i < 16; i++) { - if (TileAltPriority[0] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TileAltPriority[1] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - } - } else { - for (i = 0; i < 16; i++) { - if (TileAltPriority[0] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TileAltPriority[1] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - } - } - - BurnTransferCopy(TaitoPalette); -} - -static void TaitoF2PivotDraw() -{ - INT32 i; - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - INT32 DrawLayer0 = 1; - INT32 DrawLayer1 = 1; - INT32 DrawLayer2 = 1; - INT32 RozPriority; - - if (TC0100SCNBottomLayer(0)) { - TaitoF2TilePriority[1] = TC0360PRIRegs[5] & 0x0f; - TaitoF2TilePriority[0] = TC0360PRIRegs[5] >> 4; - } else { - TaitoF2TilePriority[0] = TC0360PRIRegs[5] & 0x0f; - TaitoF2TilePriority[1] = TC0360PRIRegs[5] >> 4; - } - TaitoF2TilePriority[2] = TC0360PRIRegs[4] >> 4; - - if (TaitoF2TilePriority[1] < TaitoF2TilePriority[0]) TaitoF2TilePriority[1] = TaitoF2TilePriority[0]; - - TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; - TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; - TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; - TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; - - TaitoF2SpriteBlendMode = TC0360PRIRegs[0] & 0xc0; - - RozPriority = (TC0360PRIRegs[1] & 0xc0) >> 6; - RozPriority = (TC0360PRIRegs[8 + (RozPriority / 2)] >> 4 * (RozPriority & 1)) & 0x0f; - TC0280GRDBaseColour = (TC0360PRIRegs[1] & 0x3f) << 2; - -// bprintf(PRINT_NORMAL, _T("TCBL %x, Blend %x, Roz %x, RozBase %x, T0 %x, T1 %x, T2 %x, S0 %x, S1 %x, S2 %x, S3 %x\n"), TC0100SCNBottomLayer(0), TaitoF2SpriteBlendMode, RozPriority, TaitoRozBaseColour, TaitoF2TilePriority[0], TaitoF2TilePriority[1], TaitoF2TilePriority[2], TaitoF2SpritePriority[0], TaitoF2SpritePriority[1], TaitoF2SpritePriority[2], TaitoF2SpritePriority[3]); - - BurnTransferClear(); - TaitoF2CalcPalette(); - - // Detect when we are using sprite blending with the sprite under the tile layer - UINT8 TileAltPriority[3] = { 0xff, 0xff, 0xff }; - if (TaitoF2SpriteBlendMode) { - for (i = 0; i < 4; i++) { - if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[0] - 1) { - TileAltPriority[0] = TaitoF2SpritePriority[i]; - DrawLayer0 = 0; - } - - if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[1] - 1) { - TileAltPriority[1] = TaitoF2SpritePriority[i]; - DrawLayer1 = 0; - } - - if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[2] - 1) { - TileAltPriority[2] = TaitoF2SpritePriority[i]; - DrawLayer2 = 0; - } - } - } - - TaitoF2MakeSpriteList(); - - if (TC0100SCNBottomLayer(0)) { - for (i = 0; i < 16; i++) { - if (TileAltPriority[0] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TileAltPriority[1] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (RozPriority == i) TC0280GRDRenderLayer(); - if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - } - } else { - for (i = 0; i < 16; i++) { - if (TileAltPriority[0] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TileAltPriority[1] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (RozPriority == i) TC0280GRDRenderLayer(); - if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - } - } - - BurnTransferCopy(TaitoPalette); -} - -static void CameltryDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - INT32 i; - - INT32 RozPriority; - - TaitoF2TilePriority[2] = TC0360PRIRegs[4] >> 4; - - TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; - TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; - TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; - TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; - - RozPriority = (TC0360PRIRegs[1] & 0xc0) >> 6; - RozPriority = (TC0360PRIRegs[8 + (RozPriority / 2)] >> 4 * (RozPriority & 1)) & 0x0f; - TC0280GRDBaseColour = (TC0360PRIRegs[1] & 0x3f) << 2; - - BurnTransferClear(); - TaitoF2CalcPalette(); - - TaitoF2MakeSpriteList(); - - for (i = 0; i < 16; i++) { - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (RozPriority == i) TC0280GRDRenderLayer(); - if (TaitoF2TilePriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - } - - BurnTransferCopy(TaitoPalette); -} - -static void DriftoutDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - INT32 i; - - INT32 RozPriority; - - TaitoF2TilePriority[2] = TC0360PRIRegs[4] >> 4; - - TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; - TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; - TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; - TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; - - RozPriority = (TC0360PRIRegs[1] & 0xc0) >> 6; - RozPriority = (TC0360PRIRegs[8 + (RozPriority / 2)] >> 4 * (RozPriority & 1)) & 0x0f; - TC0280GRDBaseColour = (TC0360PRIRegs[1] & 0x3f) << 2; - - BurnTransferClear(); - QzquestCalcPalette(); - - TaitoF2MakeSpriteList(); - - for (i = 0; i < 16; i++) { - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (RozPriority == i) TC0430GRWRenderLayer(); - if (TaitoF2TilePriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - } - - BurnTransferCopy(TaitoPalette); -} - -static void FinalbDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - - TaitoF2SpritePriority[0] = 0; - TaitoF2SpritePriority[1] = 0; - TaitoF2SpritePriority[2] = 0; - TaitoF2SpritePriority[3] = 0; - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - TaitoF2MakeSpriteList(); - - TaitoF2RenderSpriteList(0); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TC0110PCRPalette); -} - -static void FootchmpDraw() -{ - UINT8 Layer[4]; - UINT16 Priority = TC0480SCPGetBgPriority(); - - Layer[0] = (Priority & 0xf000) >> 12; - Layer[1] = (Priority & 0x0f00) >> 8; - Layer[2] = (Priority & 0x00f0) >> 4; - Layer[3] = (Priority & 0x000f) >> 0; - - TaitoF2TilePriority[0] = TC0360PRIRegs[4] >> 4; - TaitoF2TilePriority[1] = TC0360PRIRegs[5] & 0x0f; - TaitoF2TilePriority[2] = TC0360PRIRegs[5] >> 4; - TaitoF2TilePriority[3] = TC0360PRIRegs[4] & 0x0f; - TaitoF2TilePriority[4] = TC0360PRIRegs[7] >> 4; - - TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; - TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; - TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; - TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; - - BurnTransferClear(); - TaitoF2CalcPalette(); - - TaitoF2MakeSpriteList(); - - for (INT32 i = 0; i < 16; i++) { - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (TaitoF2TilePriority[0] == i) TC0480SCPTilemapRender(Layer[0], 0, TaitoChars); - if (TaitoF2TilePriority[1] == i) TC0480SCPTilemapRender(Layer[1], 0, TaitoChars); - if (TaitoF2TilePriority[2] == i) TC0480SCPTilemapRender(Layer[2], 0, TaitoChars); - if (TaitoF2TilePriority[3] == i) TC0480SCPTilemapRender(Layer[3], 0, TaitoChars); - } - - TC0480SCPRenderCharLayer(); - - BurnTransferCopy(TaitoPalette); -} - -static void MetalbDraw() -{ - UINT8 Layer[4]; - UINT16 Priority = TC0480SCPGetBgPriority(); - - Layer[0] = (Priority & 0xf000) >> 12; - Layer[1] = (Priority & 0x0f00) >> 8; - Layer[2] = (Priority & 0x00f0) >> 4; - Layer[3] = (Priority & 0x000f) >> 0; - - TaitoF2TilePriority[Layer[0]] = TC0360PRIRegs[4] & 0x0f; - TaitoF2TilePriority[Layer[1]] = TC0360PRIRegs[4] >> 4; - TaitoF2TilePriority[Layer[2]] = TC0360PRIRegs[5] & 0x0f; - TaitoF2TilePriority[Layer[3]] = TC0360PRIRegs[5] >> 4; - TaitoF2TilePriority[4] = TC0360PRIRegs[9] & 0x0f; - - if (TaitoF2TilePriority[1] < TaitoF2TilePriority[0]) TaitoF2TilePriority[1] = TaitoF2TilePriority[0]; - if (TaitoF2TilePriority[2] < TaitoF2TilePriority[1]) TaitoF2TilePriority[2] = TaitoF2TilePriority[1]; - if (TaitoF2TilePriority[3] < TaitoF2TilePriority[2]) TaitoF2TilePriority[3] = TaitoF2TilePriority[2]; - - TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; - TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; - TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; - TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; - - TaitoF2SpriteBlendMode = TC0360PRIRegs[0] & 0xc0; - -// bprintf(PRINT_IMPORTANT, _T("SPR Bl %x, T0 %x, T1 %x, T2 %x, T3 %x, T4 %x, S0 %x, S1 %x, S2 %x, S3 %x\n"), TaitoF2SpriteBlendMode, TaitoF2TilePriority[0], TaitoF2TilePriority[1], TaitoF2TilePriority[2], TaitoF2TilePriority[3], TaitoF2TilePriority[4], TaitoF2SpritePriority[0], TaitoF2SpritePriority[1], TaitoF2SpritePriority[2], TaitoF2SpritePriority[3]); -// bprintf(PRINT_NORMAL, _T("L0 %x %x, L1 %x %x, L2 %x %x, L3 %x %x\n"), Layer[0], TaitoF2TilePriority[0], Layer[1], TaitoF2TilePriority[1], Layer[2], TaitoF2TilePriority[2], Layer[3], TaitoF2TilePriority[3]); - - BurnTransferClear(); - MetalbCalcPalette(); - - TaitoF2MakeSpriteList(); - - for (INT32 i = 0; i < 16; i++) { - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (TaitoF2TilePriority[0] == i) TC0480SCPTilemapRender(Layer[0], 0, TaitoChars); - if (TaitoF2TilePriority[1] == i) TC0480SCPTilemapRender(Layer[1], 0, TaitoChars); - if (TaitoF2TilePriority[2] == i) TC0480SCPTilemapRender(Layer[2], 0, TaitoChars); - if (TaitoF2TilePriority[3] == i) TC0480SCPTilemapRender(Layer[3], 0, TaitoChars); - } - - TC0480SCPRenderCharLayer(); - - BurnTransferCopy(TaitoPalette); -} - -static void PulirulaDraw() -{ - INT32 i; - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - INT32 DrawLayer0 = 1; - INT32 DrawLayer1 = 1; - INT32 DrawLayer2 = 1; - INT32 RozPriority; - - if (TC0100SCNBottomLayer(0)) { - TaitoF2TilePriority[1] = TC0360PRIRegs[5] & 0x0f; - TaitoF2TilePriority[0] = TC0360PRIRegs[5] >> 4; - } else { - TaitoF2TilePriority[0] = TC0360PRIRegs[5] & 0x0f; - TaitoF2TilePriority[1] = TC0360PRIRegs[5] >> 4; - } - TaitoF2TilePriority[2] = TC0360PRIRegs[4] >> 4; - - if (TaitoF2TilePriority[1] < TaitoF2TilePriority[0]) TaitoF2TilePriority[1] = TaitoF2TilePriority[0]; - - TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; - TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; - TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; - TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; - - TaitoF2SpriteBlendMode = TC0360PRIRegs[0] & 0xc0; - - RozPriority = (TC0360PRIRegs[1] & 0xc0) >> 6; - RozPriority = (TC0360PRIRegs[8 + (RozPriority / 2)] >> 4 * (RozPriority & 1)) & 0x0f; - TC0280GRDBaseColour = (TC0360PRIRegs[1] & 0x3f) << 2; - - bprintf(PRINT_NORMAL, _T("TCBL %x, Blend %x, Roz %x, RozBase %x, T0 %x, T1 %x, T2 %x, S0 %x, S1 %x, S2 %x, S3 %x\n"), TC0100SCNBottomLayer(0), TaitoF2SpriteBlendMode, RozPriority, TC0280GRDBaseColour, TaitoF2TilePriority[0], TaitoF2TilePriority[1], TaitoF2TilePriority[2], TaitoF2SpritePriority[0], TaitoF2SpritePriority[1], TaitoF2SpritePriority[2], TaitoF2SpritePriority[3]); - - BurnTransferClear(); - QzquestCalcPalette(); - - // Detect when we are using sprite blending with the sprite under the tile layer - UINT8 TileAltPriority[3] = { 0xff, 0xff, 0xff }; - if (TaitoF2SpriteBlendMode) { - for (i = 0; i < 4; i++) { - if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[0] - 1) { - TileAltPriority[0] = TaitoF2SpritePriority[i]; - DrawLayer0 = 0; - } - - if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[1] - 1) { - TileAltPriority[1] = TaitoF2SpritePriority[i]; - DrawLayer1 = 0; - } - - if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[2] - 1) { - TileAltPriority[2] = TaitoF2SpritePriority[i]; - DrawLayer2 = 0; - } - } - } - - TaitoF2MakeSpriteList(); - - if (TC0100SCNBottomLayer(0)) { - for (i = 0; i < 16; i++) { - if (TileAltPriority[0] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TileAltPriority[1] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (RozPriority == i) TC0430GRWRenderLayer(); - if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - } - } else { - for (i = 0; i < 16; i++) { - if (TileAltPriority[0] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TileAltPriority[1] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (RozPriority == i) TC0430GRWRenderLayer(); - if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } - if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } - } - } - - BurnTransferCopy(TaitoPalette); -} - -static void QtorimonDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - - TaitoF2SpritePriority[0] = 0; - TaitoF2SpritePriority[1] = 0; - TaitoF2SpritePriority[2] = 0; - TaitoF2SpritePriority[3] = 0; - - TaitoF2MakeSpriteList(); - - TaitoF2RenderSpriteList(0); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TC0110PCRPalette); -} - -static void QzquestDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - QzquestCalcPalette(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - TaitoF2SpritePriority[0] = 0; - TaitoF2SpritePriority[1] = 0; - TaitoF2SpritePriority[2] = 0; - TaitoF2SpritePriority[3] = 0; - - TaitoF2MakeSpriteList(); - - TaitoF2RenderSpriteList(0); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TaitoPalette); -} - -static void SsiDraw() -{ - BurnTransferClear(); - TaitoF2CalcPalette(); - - TaitoF2SpritePriority[0] = 0; - TaitoF2SpritePriority[1] = 0; - TaitoF2SpritePriority[2] = 0; - TaitoF2SpritePriority[3] = 0; - - TaitoF2MakeSpriteList(); - - TaitoF2RenderSpriteList(0); - - BurnTransferCopy(TaitoPalette); -} - -static void ThundfoxDraw() -{ - INT32 Disable1 = TC0100SCNCtrl[0][6] & 0xf7; - INT32 Disable2 = TC0100SCNCtrl[1][6] & 0xf7; - - BurnTransferClear(); - TaitoF2CalcPalette(); - - INT32 TilePri[2][3]; - INT32 Layer[2][3]; - - TaitoF2MakeSpriteList(); - - Layer[0][0] = TC0100SCNBottomLayer(0); - Layer[0][1] = Layer[0][0] ^ 1; - Layer[0][2] = 2; - TilePri[0][Layer[0][0]] = TC0360PRIRegs[5] & 0x0f; - TilePri[0][Layer[0][1]] = TC0360PRIRegs[5] >> 4; - TilePri[0][Layer[0][2]] = TC0360PRIRegs[4] >> 4; - - Layer[1][0] = TC0100SCNBottomLayer(1); - Layer[1][1] = Layer[1][0] ^ 1; - Layer[1][2] = 2; - TilePri[1][Layer[1][0]] = TC0360PRIRegs[9] & 0x0f; - TilePri[1][Layer[1][1]] = TC0360PRIRegs[9] >> 4; - TilePri[1][Layer[1][2]] = TC0360PRIRegs[8] >> 4; - - TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; - TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; - TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; - TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; - -// bprintf(PRINT_NORMAL, _T("Layer0-0 %x, Layer 0-1 %x, Layer 0-2 %x, Layer1-0 %x, Layer 1-1 %x, Layer 1-2 %x, Sprite 0 %x, Sprite 1 %x, Sprite 2 %x, Sprite 3 %x\n"), TilePri[0][0], TilePri[0][1], TilePri[0][2], TilePri[1][0], TilePri[1][1], TilePri[1][2], TaitoF2SpritePriority[0], TaitoF2SpritePriority[1], TaitoF2SpritePriority[2], TaitoF2SpritePriority[3]); - - for (INT32 i = 0; i < 16; i++) { - if (TilePri[1][0] == i) { - if (TC0100SCNBottomLayer(1)) { - if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoCharsB); - } else { - if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoCharsB); - } - } - if (TilePri[0][0] == i) { - if (TC0100SCNBottomLayer(0)) { - if (!(Disable1 & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } else { - if (!(Disable1 & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } - } - if (TilePri[1][1] == i) { - if (!TC0100SCNBottomLayer(1)) { - if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoCharsB); - } else { - if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoCharsB); - } - } - if (TilePri[0][1] == i) { - if (!TC0100SCNBottomLayer(0)) { - if (!(Disable1 & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } else { - if (!(Disable1 & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } - } - if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); - if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); - if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); - if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); - if (TilePri[1][2] == i) { if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); } - if (TilePri[0][2] == i) { if (!(Disable1 & 0x04)) TC0100SCNRenderCharLayer(0); } - } - - BurnTransferCopy(TaitoPalette); -} - -static void YuyugogoDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - TaitoF2CalcPalette(); - - TaitoF2SpritePriority[0] = 0; - TaitoF2SpritePriority[1] = 0; - TaitoF2SpritePriority[2] = 0; - TaitoF2SpritePriority[3] = 0; - - TaitoF2MakeSpriteList(); - - TaitoF2RenderSpriteList(0); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TaitoPalette); -} - -static INT32 TaitoF2Frame() -{ - INT32 nInterleave = 10; - - if (TaitoReset) TaitoF2DoReset(); - - if (TaitoIC_TC0220IOCInUse) { - TC0220IOCMakeInputs(); - } else { - if (TaitoIC_TC0510NIOInUse) { - TC0510NIOMakeInputs(); - } else { - TaitoF2MakeInputs(); - } - } - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 #1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - if (i == 9) nTaitoCyclesSegment -= 500; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == 9) { - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - nTaitoCyclesDone[nCurrentCPU] += SekRun(500); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - } - SekClose(); - - nCurrentCPU = 1; - ZetOpen(0); - BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[1]); - if (pBurnSoundOut) { - if (TaitoNumYM2610) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - if (TaitoNumYM2203) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - if (TaitoNumMSM6295) MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - TaitoF2HandleSpriteBuffering(); - - if (pBurnDraw) TaitoDrawFunction(); - - TaitoF2SpriteBufferFunction(); - - return 0; -} - -static INT32 DriveoutFrame() -{ - INT32 nInterleave = 10; - - if (TaitoReset) TaitoF2DoReset(); - - if (TaitoIC_TC0220IOCInUse) { - TC0220IOCMakeInputs(); - } else { - if (TaitoIC_TC0510NIOInUse) { - TC0510NIOMakeInputs(); - } else { - TaitoF2MakeInputs(); - } - } - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 #1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - if (i == 9) nTaitoCyclesSegment -= 500; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == 9) { - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - nTaitoCyclesDone[nCurrentCPU] += SekRun(500); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - } - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); - nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; - ZetClose(); - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); - } - - TaitoF2HandleSpriteBuffering(); - - if (pBurnDraw) TaitoDrawFunction(); - - TaitoF2SpriteBufferFunction(); - - return 0; -} - -static INT32 TaitoF2Scan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029682; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = TaitoRamStart; - ba.nLen = TaitoRamEnd-TaitoRamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - TaitoICScan(nAction); - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - BurnYM2610Scan(nAction, pnMin); - - SCAN_VAR(TaitoInput); - SCAN_VAR(TaitoZ80Bank); - SCAN_VAR(TaitoF2SpriteBank); - SCAN_VAR(TaitoF2SpriteBankBuffered); - SCAN_VAR(nTaitoCyclesDone); - SCAN_VAR(nTaitoCyclesSegment); - SCAN_VAR(YesnoDip); - SCAN_VAR(MjnquestInput); - SCAN_VAR(DriveoutSoundNibble); - SCAN_VAR(DriveoutOkiBank); - } - - if (nAction & ACB_WRITE) { - if (TaitoZ80Bank) { - ZetOpen(0); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetClose(); - } - - if (DriveoutOkiBank) { - memcpy(MSM6295ROM, TaitoMSM6295Rom + (DriveoutOkiBank * 0x40000), 0x40000); - } - - TaitoF2SpriteBufferFunction(); - TaitoF2HandleSpriteBuffering(); - } - - return 0; -} - -struct BurnDriver BurnDrvCameltry = { - "cameltry", NULL, NULL, NULL, "1989", - "Cameltry (US, YM2610)\0", NULL, "Taito America Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_MAZE, 0, - NULL, CameltryRomInfo, CameltryRomName, NULL, NULL, CameltryInputInfo, CameltryDIPInfo, - CameltryInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvCameltryau = { - "cameltryau", "cameltry", NULL, NULL, "1989", - "Cameltry (World, YM2203 + M6295)\0", NULL, "Taito America Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_MAZE, 0, - NULL, CameltryauRomInfo, CameltryauRomName, NULL, NULL, CameltryInputInfo, CameltryDIPInfo, - CamltryaInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvCameltrya = { - "cameltrya", "cameltry", NULL, NULL, "1989", - "Cameltry (US, YM2203 + M6295)\0", NULL, "Taito America Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_MAZE, 0, - NULL, CameltryaRomInfo, CameltryaRomName, NULL, NULL, CameltryInputInfo, CameltryDIPInfo, - CamltryaInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvCameltryj = { - "cameltryj", "cameltry", NULL, NULL, "1989", - "Cameltry (Japan, YM2610)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_MAZE, 0, - NULL, CameltryjRomInfo, CameltryjRomName, NULL, NULL, CameltryInputInfo, CameltrjDIPInfo, - CameltryInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDeadconx = { - "deadconx", NULL, NULL, NULL, "1992", - "Dead Connection (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_SHOOT, 0, - NULL, DeadconxRomInfo, DeadconxRomName, NULL, NULL, DeadconxInputInfo, DeadconxDIPInfo, - DeadconxInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDeadconxj = { - "deadconxj", "deadconx", NULL, NULL, "1992", - "Dead Connection (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_SHOOT, 0, - NULL, DeadconxjRomInfo, DeadconxjRomName, NULL, NULL, DeadconxInputInfo, DeadconxjDIPInfo, - DeadconxInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDinorex = { - "dinorex", NULL, NULL, NULL, "1992", - "Dino Rex (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, - NULL, DinorexRomInfo, DinorexRomName, NULL, NULL, DinorexInputInfo, DinorexDIPInfo, - DinorexInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDinorexj = { - "dinorexj", "dinorex", NULL, NULL, "1992", - "Dino Rex (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, - NULL, DinorexjRomInfo, DinorexjRomName, NULL, NULL, DinorexInputInfo, DinorexjDIPInfo, - DinorexInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDinorexu = { - "dinorexu", "dinorex", NULL, NULL, "1992", - "Dino Rex (US)\0", NULL, "Taito America Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, - NULL, DinorexuRomInfo, DinorexuRomName, NULL, NULL, DinorexInputInfo, DinorexDIPInfo, - DinorexInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDondokod = { - "dondokod", NULL, NULL, NULL, "1989", - "Don Doko Don (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, - NULL, DondokodRomInfo, DondokodRomName, NULL, NULL, DondokodInputInfo, DondokodDIPInfo, - DondokodInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDondokodj = { - "dondokodj", "dondokod", NULL, NULL, "1989", - "Don Doko Don (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, - NULL, DondokodjRomInfo, DondokodjRomName, NULL, NULL, DondokodInputInfo, DondokodjDIPInfo, - DondokodInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDondokodu = { - "dondokodu", "dondokod", NULL, NULL, "1989", - "Don Doko Don (US)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, - NULL, DondokoduRomInfo, DondokoduRomName, NULL, NULL, DondokodInputInfo, DondokoduDIPInfo, - DondokodInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDriftout = { - "driftout", NULL, NULL, NULL, "1991", - "Drift Out (Europe)\0", NULL, "Visco (Europe)", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOF2, GBF_RACING, 0, - NULL, DriftoutRomInfo, DriftoutRomName, NULL, NULL, DriftoutInputInfo, DriftoutDIPInfo, - DriftoutInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvDriftoutj = { - "driftoutj", "driftout", NULL, NULL, "1991", - "Drift Out (Japan)\0", NULL, "Visco (Japan)", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_RACING, 0, - NULL, DriftoutjRomInfo, DriftoutjRomName, NULL, NULL, DriftoutInputInfo, DriftoutDIPInfo, - DriftoutInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvDriveout = { - "driveout", "driftout", NULL, NULL, "1991", - "Drive Out\0", NULL, "bootleg", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_TAITOF2, GBF_RACING, 0, - NULL, DriveoutRomInfo, DriveoutRomName, NULL, NULL, DriftoutInputInfo, DriftoutDIPInfo, - DriveoutInit, TaitoF2Exit, DriveoutFrame, NULL, TaitoF2Scan, - NULL, 0x2000, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvFinalb = { - "finalb", NULL, NULL, NULL, "1988", - "Final Blow (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, - NULL, FinalbRomInfo, FinalbRomName, NULL, NULL, FinalbInputInfo, FinalbDIPInfo, - FinalbInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFinalbj = { - "finalbj", "finalb", NULL, NULL, "1988", - "Final Blow (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, - NULL, FinalbjRomInfo, FinalbjRomName, NULL, NULL, FinalbInputInfo, FinalbjDIPInfo, - FinalbInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFinalbu = { - "finalbu", "finalb", NULL, NULL, "1988", - "Final Blow (US)\0", NULL, "Taito America Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, - NULL, FinalbuRomInfo, FinalbuRomName, NULL, NULL, FinalbInputInfo, FinalbjDIPInfo, - FinalbInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvFootchmp = { - "footchmp", NULL, NULL, NULL, "1990", - "Football Champ (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_TAITO_TAITOF2, GBF_SPORTSFOOTBALL, 0, - NULL, FootchmpRomInfo, FootchmpRomName, NULL, NULL, FootchmpInputInfo, FootchmpDIPInfo, - FootchmpInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvHthero = { - "hthero", "footchmp", NULL, NULL, "1990", - "Hat Trick Hero (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SPORTSFOOTBALL, 0, - NULL, HtheroRomInfo, HtheroRomName, NULL, NULL, FootchmpInputInfo, HtheroDIPInfo, - FootchmpInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvEuroch92 = { - "euroch92", "footchmp", NULL, NULL, "1992", - "Euro Champ '92 (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SPORTSFOOTBALL, 0, - NULL, Euroch92RomInfo, Euroch92RomName, NULL, NULL, FootchmpInputInfo, FootchmpDIPInfo, - FootchmpInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGrowl = { - "growl", NULL, NULL, NULL, "1990", - "Growl (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, GrowlRomInfo, GrowlRomName, NULL, NULL, GrowlInputInfo, GrowlDIPInfo, - GrowlInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGrowlu = { - "growlu", "growl", NULL, NULL, "1990", - "Growl (US)\0", NULL, "Taito America Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, GrowluRomInfo, GrowluRomName, NULL, NULL, GrowlInputInfo, GrowluDIPInfo, - GrowlInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvRunark = { - "runark", "growl", NULL, NULL, "1990", - "Runark (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, RunarkRomInfo, RunarkRomName, NULL, NULL, GrowlInputInfo, RunarkDIPInfo, - GrowlInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvGunfront = { - "gunfront", NULL, NULL, NULL, "1990", - "Gun & Frontier (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOF2, GBF_VERSHOOT, 0, - NULL, GunfrontRomInfo, GunfrontRomName, NULL, NULL, GunfrontInputInfo, GunfrontDIPInfo, - GunfrontInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvGunfrontj = { - "gunfrontj", "gunfront", NULL, NULL, "1990", - "Gun Frontier (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOF2, GBF_VERSHOOT, 0, - NULL, GunfrontjRomInfo, GunfrontjRomName, NULL, NULL, GunfrontInputInfo, GunfrontjDIPInfo, - GunfrontInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvKoshien = { - "koshien", NULL, NULL, NULL, "1990", - "Ah Eikou no Koshien (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - L"\u7532\u5B50\u5712 \u6804\u5149\u306E \u55DA\u547C (Japan)\0Ah Eikou no Koshien\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_SPORTSMISC, 0, - NULL, KoshienRomInfo, KoshienRomName, NULL, NULL, KoshienInputInfo, KoshienDIPInfo, - KoshienInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvLiquidk = { - "liquidk", NULL, NULL, NULL, "1990", - "Liquid Kids (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, - NULL, LiquidkRomInfo, LiquidkRomName, NULL, NULL, LiquidkInputInfo, LiquidkDIPInfo, - LiquidkInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvLiquidku = { - "liquidku", "liquidk", NULL, NULL, "1990", - "Liquid Kids (US)\0", NULL, "Taito America Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, - NULL, LiquidkuRomInfo, LiquidkuRomName, NULL, NULL, LiquidkInputInfo, LiquidkuDIPInfo, - LiquidkInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMizubaku = { - "mizubaku", "liquidk", NULL, NULL, "1990", - "Mizubaku Daibouken (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - L"\u30DF\u30BA\u30D0\u30AF \u5927\u5192\u967A \u30A2\u30C9\u30D9\u30F3\u30C1\u30E3\u30FC (Japan)\0Mizubaku Daibouken\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, - NULL, MizubakuRomInfo, MizubakuRomName, NULL, NULL, LiquidkInputInfo, LiquidkuDIPInfo, - LiquidkInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMegablst = { - "megablst", NULL, NULL, NULL, "1989", - "Mega Blast (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_HORSHOOT, 0, - NULL, MegablstRomInfo, MegablstRomName, NULL, NULL, MegablstInputInfo, MegablstDIPInfo, - MegablstInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMegablstj = { - "megablstj", "megablst", NULL, NULL, "1989", - "Mega Blast (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_HORSHOOT, 0, - NULL, MegablstjRomInfo, MegablstjRomName, NULL, NULL, MegablstInputInfo, MegablstjDIPInfo, - MegablstInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMegablstu = { - "megablstu", "megablst", NULL, NULL, "1989", - "Mega Blast (US)\0", NULL, "Taito America Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_HORSHOOT, 0, - NULL, MegablstuRomInfo, MegablstuRomName, NULL, NULL, MegablstInputInfo, MegablstuDIPInfo, - MegablstInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMetalb = { - "metalb", NULL, NULL, NULL, "1991", - "Metal Black (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_HORSHOOT, 0, - NULL, MetalbRomInfo, MetalbRomName, NULL, NULL, MetalbInputInfo, MetalbDIPInfo, - MetalbInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMetalbj = { - "metalbj", "metalb", NULL, NULL, "1991", - "Metal Black (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_HORSHOOT, 0, - NULL, MetalbjRomInfo, MetalbjRomName, NULL, NULL, MetalbInputInfo, MetalbjDIPInfo, - MetalbInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMjnquest = { - "mjnquest", NULL, NULL, NULL, "1990", - "Mahjong Quest (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_MAHJONG, 0, - NULL, MjnquestRomInfo, MjnquestRomName, NULL, NULL, MjnquestInputInfo, MjnquestDIPInfo, - MjnquestInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvMjnquestb = { - "mjnquestb", "mjnquest", NULL, NULL, "1990", - "Mahjong Quest (No Nudity)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_MAHJONG, 0, - NULL, MjnquestbRomInfo, MjnquestbRomName, NULL, NULL, MjnquestInputInfo, MjnquestDIPInfo, - MjnquestInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNinjak = { - "ninjak", NULL, NULL, NULL, "1990", - "The Ninja Kids (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, NinjakRomInfo, NinjakRomName, NULL, NULL, NinjakInputInfo, NinjakDIPInfo, - NinjakInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNinjakj = { - "ninjakj", "ninjak", NULL, NULL, "1990", - "The Ninja Kids (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, NinjakjRomInfo, NinjakjRomName, NULL, NULL, NinjakInputInfo, NinjakjDIPInfo, - NinjakInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNinjaku = { - "ninjaku", "ninjak", NULL, NULL, "1990", - "The Ninja Kids (US)\0", NULL, "Taito America Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, NinjakuRomInfo, NinjakuRomName, NULL, NULL, NinjakInputInfo, NinjakuDIPInfo, - NinjakInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPulirula = { - "pulirula", NULL, NULL, NULL, "1991", - "PuLiRuLa (World)\0", "Some priority problems", "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, PulirulaRomInfo, PulirulaRomName, NULL, NULL, PulirulaInputInfo, PulirulaDIPInfo, - PulirulaInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvPulirulaj = { - "pulirulaj", "pulirula", NULL, NULL, "1991", - "PuLiRuLa (Japan)\0", "Some priority problems", "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, PulirulajRomInfo, PulirulajRomName, NULL, NULL, PulirulaInputInfo, PulirulajDIPInfo, - PulirulaInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQcrayon = { - "qcrayon", NULL, NULL, NULL, "1993", - "Quiz Crayon Shinchan (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - L"\u30AF\u30A4\u30BA \u30AF\u30EC\u30E8\u30F3\u3057\u3093\u3061\u3083\u3093 (Japan)\0Quiz Crayon Shinchan\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, - NULL, QcrayonRomInfo, QcrayonRomName, NULL, NULL, QcrayonInputInfo, QcrayonDIPInfo, - QcrayonInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQcrayon2 = { - "qcrayon2", NULL, NULL, NULL, "1993", - "Crayon Shinchan Orato Asobo (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - L"\u30AF\u30EC\u30E8\u30F3\u3057\u3093\u3061\u3083\u3093 \u30AA\u30E9\u3068\u904A\u307C (Japan)\0Crayon Shinchan Orato Asobo\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, - NULL, Qcrayon2RomInfo, Qcrayon2RomName, NULL, NULL, Qcrayon2InputInfo, Qcrayon2DIPInfo, - Qcrayon2Init, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQjinsei = { - "qjinsei", NULL, NULL, NULL, "1992", - "Quiz Jinsei Gekijoh (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - L"\u30AF\u30A4\u30BA \u4EBA\u751F\u5287\u5834 (Japan)\0Quiz Jinsei Gekijoh\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, - NULL, QjinseiRomInfo, QjinseiRomName, NULL, NULL, QjinseiInputInfo, QjinseiDIPInfo, - QjinseiInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQtorimon = { - "qtorimon", NULL, NULL, NULL, "1990", - "Quiz Torimonochou (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - L"\u304F\u3044\u305A \u82E6\u80C3\u982D \u6355\u7269\u5E33 (Japan)\0Quiz Torimonochou\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, - NULL, QtorimonRomInfo, QtorimonRomName, NULL, NULL, QtorimonInputInfo, QtorimonDIPInfo, - QtorimonInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x800, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQuizhq = { - "quizhq", NULL, NULL, NULL, "1990", - "Quiz H.Q. (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, - NULL, QuizhqRomInfo, QuizhqRomName, NULL, NULL, QuizhqInputInfo, QuizhqDIPInfo, - QuizhqInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQzchikyu = { - "qzchikyu", NULL, NULL, NULL, "1991", - "Quiz Chikyu Bouei Gun (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - L"\u30AF\u30A4\u30BA \u5730\u7403\u9632\u885B\u8ECD (Japan)\0Quiz Chikyu Bouei Gun\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, - NULL, QzchikyuRomInfo, QzchikyuRomName, NULL, NULL, QzchikyuInputInfo, QzchikyuDIPInfo, - QzchikyuInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvQzquest = { - "qzquest", NULL, NULL, NULL, "1991", - "Quiz Quest - Hime to Yuusha no Monogatari (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - L"\u30AF\u30A4\u30BA \u30AF\u30A8\u30B9\u30C8 \uFF0D\u59EB\u3068\u52C7\u8005\u306E\u7269\u8A9E\uFF0D (Japan)\0Quiz Quest - Hime to Yuusha no Monogatari\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, - NULL, QzquestRomInfo, QzquestRomName, NULL, NULL, QzquestInputInfo, QzquestDIPInfo, - QzquestInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSolfigtr = { - "solfigtr", NULL, NULL, NULL, "1991", - "Solitary Fighter (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, - NULL, SolfigtrRomInfo, SolfigtrRomName, NULL, NULL, SolfigtrInputInfo, SolfigtrDIPInfo, - SolfigtrInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvSsi = { - "ssi", NULL, NULL, NULL, "1990", - "Super Space Invaders '91 (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOF2, GBF_SHOOT, 0, - NULL, SsiRomInfo, SsiRomName, NULL, NULL, SsiInputInfo, SsiDIPInfo, - SsiInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvMajest12 = { - "majest12", "ssi", NULL, NULL, "1990", - "Majestic Twelve - The Space Invaders Part IV (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOF2, GBF_SHOOT, 0, - NULL, Majest12RomInfo, Majest12RomName, NULL, NULL, SsiInputInfo, Majest12DIPInfo, - SsiInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 224, 320, 3, 4 -}; - -struct BurnDriver BurnDrvThundfox = { - "thundfox", NULL, NULL, NULL, "1990", - "Thunder Fox (World)\0", "NULL", "Taito Corporation Japan", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, ThundfoxRomInfo, ThundfoxRomName, NULL, NULL, ThundfoxInputInfo, ThundfoxDIPInfo, - ThundfoxInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvThundfoxj = { - "thundfoxj", "thundfox", NULL, NULL, "1990", - "Thunder Fox (Japan)\0", "NULL", "Taito Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, ThundfoxjRomInfo, ThundfoxjRomName, NULL, NULL, ThundfoxInputInfo, ThundfoxjDIPInfo, - ThundfoxInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvThundfoxu = { - "thundfoxu", "thundfox", NULL, NULL, "1990", - "Thunder Fox (US)\0", "NULL", "Taito America Corporation", "Taito-F2", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, - NULL, ThundfoxuRomInfo, ThundfoxuRomName, NULL, NULL, ThundfoxInputInfo, ThundfoxuDIPInfo, - ThundfoxInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvYesnoj = { - "yesnoj", NULL, NULL, NULL, "1992", - "Yes/No Sinri Tokimeki Chart\0", NULL, "Taito Corporation", "Taito-F2", - L"\uFF39\uFF45\uFF53.\uFF2E\uFF4F \u5FC3\u7406 \u30C8\u30AD\u30E1\u30AD\u30C1\u30E3\u30FC\u30C8\0Yes/No Sinri Tokimeki Chart\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, - NULL, YesnojRomInfo, YesnojRomName, NULL, NULL, YesnojInputInfo, YesnojDIPInfo, - YesnojInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvYuyugogo = { - "yuyugogo", NULL, NULL, NULL, "1990", - "Yuuyu no Quiz de GO!GO! (Japan)\0", NULL, "Taito Corporation", "Taito-F2", - L"\u3086\u3046\u3086 \u306E\u30AF\u30A4\u30BA\u3067 \uFF27\uFF4F!\uFF27\uFF4F! (Japan)\0Yuuyu no Quiz de GO!GO!\0", NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, - NULL, YuyugogoRomInfo, YuyugogoRomName, NULL, NULL, YuyugogoInputInfo, YuyugogoDIPInfo, - YuyugogoInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, - NULL, 0x2000, 320, 224, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "taito.h" +#include "taito_ic.h" +#include "burn_ym2610.h" +#include "burn_ym2203.h" +#include "msm6295.h" + +static INT32 Footchmp; +static INT32 YesnoDip; +static INT32 MjnquestInput; +static INT32 DriveoutSoundNibble; +static INT32 DriveoutOkiBank; + +INT32 TaitoF2SpriteType; +INT32 TaitoF2SpritesFlipScreen; +INT32 TaitoF2PrepareSprites; +INT32 TaitoF2SpritesDisabled, TaitoF2SpritesActiveArea, TaitoF2SpritesMasterScrollX, TaitoF2SpritesMasterScrollY; +INT32 TaitoF2SpriteBlendMode; +UINT16 TaitoF2SpriteBank[8]; +UINT16 TaitoF2SpriteBankBuffered[8]; +UINT8 TaitoF2TilePriority[5]; +UINT8 TaitoF2SpritePriority[4]; +struct TaitoF2SpriteEntry *TaitoF2SpriteList; +static TaitoF2SpriteBufferUpdate TaitoF2SpriteBufferFunction; + +static void TaitoF2Draw(); +static void TaitoF2PivotDraw(); +static void CameltryDraw(); +static void DriftoutDraw(); +static void FinalbDraw(); +static void FootchmpDraw(); +static void MetalbDraw(); +static void PulirulaDraw(); +static void QtorimonDraw(); +static void QzquestDraw(); +static void SsiDraw(); +static void ThundfoxDraw(); +static void YuyugogoDraw(); + +static bool bUseAsm68KCoreOldValue = false; + +#define A(a, b, c, d) {a, b, (UINT8*)(c), d} + +static struct BurnInputInfo CameltryInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, + + A("P1 Paddle" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, + + A("P2 Paddle" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "p2 x-axis" ), + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Cameltry) + +static struct BurnInputInfo DeadconxInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort2 + 4, "service" }, + {"Service 2" , BIT_DIGITAL , TaitoInputPort2 + 5, "service 2" }, + {"Service 3" , BIT_DIGITAL , TaitoInputPort2 + 6, "service 3" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 7, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Deadconx) + +static struct BurnInputInfo DinorexInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Dinorex) + +static struct BurnInputInfo DondokodInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Dondokod) + +static struct BurnInputInfo DriftoutInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + + {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Driftout) + +static struct BurnInputInfo FinalbInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 fire 4" }, + {"P1 Fire 5" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p1 fire 5" }, + + {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p2 fire 4" }, + {"P2 Fire 5" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p2 fire 5" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Finalb) + +static struct BurnInputInfo FootchmpInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, + {"Coin 3" , BIT_DIGITAL , TaitoInputPort2 + 2, "p3 coin" }, + {"Start 3" , BIT_DIGITAL , TaitoInputPort3 + 7, "p3 start" }, + {"Coin 4" , BIT_DIGITAL , TaitoInputPort2 + 3, "p4 coin" }, + {"Start 4" , BIT_DIGITAL , TaitoInputPort4 + 7, "p4 start" }, + + {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, + + {"P3 Up" , BIT_DIGITAL , TaitoInputPort3 + 0, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , TaitoInputPort3 + 1, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , TaitoInputPort3 + 2, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , TaitoInputPort3 + 3, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , TaitoInputPort3 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , TaitoInputPort3 + 5, "p3 fire 2" }, + + {"P4 Up" , BIT_DIGITAL , TaitoInputPort4 + 0, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , TaitoInputPort4 + 1, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , TaitoInputPort4 + 2, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , TaitoInputPort4 + 3, "p4 right" }, + {"P4 Fire 1" , BIT_DIGITAL , TaitoInputPort4 + 4, "p4 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , TaitoInputPort4 + 5, "p4 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort2 + 4, "service" }, + {"Service 2" , BIT_DIGITAL , TaitoInputPort2 + 5, "service 2" }, + {"Service 3" , BIT_DIGITAL , TaitoInputPort2 + 6, "service 3" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 7, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Footchmp) + +static struct BurnInputInfo GrowlInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, + {"Coin 3" , BIT_DIGITAL , TaitoInputPort5 + 0, "p3 coin" }, + {"Start 3" , BIT_DIGITAL , TaitoInputPort3 + 7, "p3 start" }, + {"Coin 4" , BIT_DIGITAL , TaitoInputPort5 + 1, "p4 coin" }, + {"Start 4" , BIT_DIGITAL , TaitoInputPort4 + 7, "p4 start" }, + + {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TaitoInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TaitoInputPort1 + 6, "p2 fire 3" }, + + {"P3 Up" , BIT_DIGITAL , TaitoInputPort3 + 0, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , TaitoInputPort3 + 1, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , TaitoInputPort3 + 2, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , TaitoInputPort3 + 3, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , TaitoInputPort3 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , TaitoInputPort3 + 5, "p3 fire 2" }, + {"P3 Fire 3" , BIT_DIGITAL , TaitoInputPort3 + 6, "p3 fire 3" }, + + {"P4 Up" , BIT_DIGITAL , TaitoInputPort4 + 0, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , TaitoInputPort4 + 1, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , TaitoInputPort4 + 2, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , TaitoInputPort4 + 3, "p4 right" }, + {"P4 Fire 1" , BIT_DIGITAL , TaitoInputPort4 + 4, "p4 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , TaitoInputPort4 + 5, "p4 fire 2" }, + {"P4 Fire 3" , BIT_DIGITAL , TaitoInputPort4 + 6, "p4 fire 3" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort2 + 1, "service" }, + {"Service 2" , BIT_DIGITAL , TaitoInputPort5 + 2, "service 2" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Growl) + +static struct BurnInputInfo GunfrontInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Gunfront) + +static struct BurnInputInfo KoshienInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort2 + 4, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort2 + 5, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort2 + 6, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort2 + 7, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Koshien) + +static struct BurnInputInfo LiquidkInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Liquidk) + +static struct BurnInputInfo MegablstInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Megablst) + +static struct BurnInputInfo MetalbInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Metalb) + +static struct BurnInputInfo MjnquestInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort5 + 1, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort4 + 1, "p2 coin" }, + + {"Mahjong A" , BIT_DIGITAL , TaitoInputPort0 + 0, "mah a" }, + {"Mahjong B" , BIT_DIGITAL , TaitoInputPort1 + 0, "mah b" }, + {"Mahjong C" , BIT_DIGITAL , TaitoInputPort2 + 0, "mah c" }, + {"Mahjong D" , BIT_DIGITAL , TaitoInputPort3 + 0, "mah d" }, + {"Mahjong E" , BIT_DIGITAL , TaitoInputPort0 + 1, "mah e" }, + {"Mahjong F" , BIT_DIGITAL , TaitoInputPort1 + 1, "mah f" }, + {"Mahjong G" , BIT_DIGITAL , TaitoInputPort2 + 1, "mah g" }, + {"Mahjong H" , BIT_DIGITAL , TaitoInputPort3 + 1, "mah h" }, + {"Mahjong I" , BIT_DIGITAL , TaitoInputPort0 + 2, "mah i" }, + {"Mahjong J" , BIT_DIGITAL , TaitoInputPort1 + 2, "mah j" }, + {"Mahjong K" , BIT_DIGITAL , TaitoInputPort2 + 2, "mah k" }, + {"Mahjong L" , BIT_DIGITAL , TaitoInputPort3 + 2, "mah l" }, + {"Mahjong M" , BIT_DIGITAL , TaitoInputPort0 + 3, "mah m" }, + {"Mahjong N" , BIT_DIGITAL , TaitoInputPort1 + 3, "mah n" }, + {"Mahjong Kan" , BIT_DIGITAL , TaitoInputPort0 + 4, "mah kan" }, + {"Mahjong Pon" , BIT_DIGITAL , TaitoInputPort3 + 3, "mah pon" }, + {"Mahjong Chi" , BIT_DIGITAL , TaitoInputPort2 + 3, "mah chi" }, + {"Mahjong Reach" , BIT_DIGITAL , TaitoInputPort1 + 4, "mah reach" }, + {"Mahjong Ron" , BIT_DIGITAL , TaitoInputPort2 + 4, "mah ron" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort5 + 0, "service" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort4 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Mjnquest) + +static struct BurnInputInfo NinjakInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 4, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 5, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, + {"Coin 3" , BIT_DIGITAL , TaitoInputPort2 + 6, "p3 coin" }, + {"Start 3" , BIT_DIGITAL , TaitoInputPort3 + 7, "p3 start" }, + {"Coin 4" , BIT_DIGITAL , TaitoInputPort2 + 7, "p4 coin" }, + {"Start 4" , BIT_DIGITAL , TaitoInputPort4 + 7, "p4 start" }, + + {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, + + {"P3 Up" , BIT_DIGITAL , TaitoInputPort3 + 0, "p3 up" }, + {"P3 Down" , BIT_DIGITAL , TaitoInputPort3 + 1, "p3 down" }, + {"P3 Left" , BIT_DIGITAL , TaitoInputPort3 + 2, "p3 left" }, + {"P3 Right" , BIT_DIGITAL , TaitoInputPort3 + 3, "p3 right" }, + {"P3 Fire 1" , BIT_DIGITAL , TaitoInputPort3 + 4, "p3 fire 1" }, + {"P3 Fire 2" , BIT_DIGITAL , TaitoInputPort3 + 5, "p3 fire 2" }, + + {"P4 Up" , BIT_DIGITAL , TaitoInputPort4 + 0, "p4 up" }, + {"P4 Down" , BIT_DIGITAL , TaitoInputPort4 + 1, "p4 down" }, + {"P4 Left" , BIT_DIGITAL , TaitoInputPort4 + 2, "p4 left" }, + {"P4 Right" , BIT_DIGITAL , TaitoInputPort4 + 3, "p4 right" }, + {"P4 Fire 1" , BIT_DIGITAL , TaitoInputPort4 + 4, "p4 fire 1" }, + {"P4 Fire 2" , BIT_DIGITAL , TaitoInputPort4 + 5, "p4 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort2 + 1, "service" }, + {"Service 2" , BIT_DIGITAL , TaitoInputPort2 + 2, "service 2" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Ninjak) + +static struct BurnInputInfo PulirulaInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Pulirula) + +static struct BurnInputInfo QcrayonInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 4" }, + {"P1 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 5" }, + + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 fire 4" }, + {"P2 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 5" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Qcrayon) + +static struct BurnInputInfo Qcrayon2InputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, + + {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Qcrayon2) + +static struct BurnInputInfo QjinseiInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 4" }, + {"P1 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 5" }, + + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 fire 4" }, + {"P2 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 5" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Qjinsei) + +static struct BurnInputInfo QtorimonInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, + + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 fire 4" }, + + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 fire 4" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Qtorimon) + +static struct BurnInputInfo QuizhqInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, + + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 fire 4" }, + {"P1 Fire 5" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 5" }, + + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 fire 4" }, + {"P2 Fire 5" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 5" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Quizhq) + +static struct BurnInputInfo QzchikyuInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 4" }, + {"P1 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 5" }, + + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 fire 4" }, + {"P2 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p2 fire 5" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Qzchikyu) + +static struct BurnInputInfo QzquestInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 4" }, + {"P1 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 5" }, + + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 fire 4" }, + {"P2 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p2 fire 5" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Qzquest) + +static struct BurnInputInfo SolfigtrInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TaitoInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TaitoInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Solfigtr) + +static struct BurnInputInfo SsiInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Ssi) + +static struct BurnInputInfo ThundfoxInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 fire 3" }, + + {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Thundfox) + +static struct BurnInputInfo YesnojInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort1 + 2, "p1 coin" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 coin" }, + + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 fire 2" }, + + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 2, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 3, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort1 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort1 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Yesnoj) + +static struct BurnInputInfo YuyugogoInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 3, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 7, "p2 start" }, + + {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 fire 4" }, + {"P1 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "p1 fire 5" }, + + {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p2 fire 3" }, + {"P2 Fire 4" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p2 fire 4" }, + {"P2 Fire 5" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 fire 5" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort2 + 1, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Yuyugogo) + +#undef A + +static void TC0220IOCMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0xff; + TC0220IOCInput[1] = 0xff; + TC0220IOCInput[2] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + TC0220IOCInput[0] -= (TC0220IOCInputPort0[i] & 1) << i; + TC0220IOCInput[1] -= (TC0220IOCInputPort1[i] & 1) << i; + TC0220IOCInput[2] -= (TC0220IOCInputPort2[i] & 1) << i; + } +} + +static void TC0510NIOMakeInputs() +{ + // Reset Inputs + TC0510NIOInput[0] = 0xff; + TC0510NIOInput[1] = 0xff; + TC0510NIOInput[2] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + TC0510NIOInput[0] -= (TC0510NIOInputPort0[i] & 1) << i; + TC0510NIOInput[1] -= (TC0510NIOInputPort1[i] & 1) << i; + TC0510NIOInput[2] -= (TC0510NIOInputPort2[i] & 1) << i; + } +} + +static void TaitoF2MakeInputs() +{ + // Reset Inputs + TaitoInput[0] = 0xff; + TaitoInput[1] = 0xff; + TaitoInput[2] = 0xff; + TaitoInput[3] = 0xff; + TaitoInput[4] = 0xff; + TaitoInput[5] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + TaitoInput[0] -= (TaitoInputPort0[i] & 1) << i; + TaitoInput[1] -= (TaitoInputPort1[i] & 1) << i; + TaitoInput[2] -= (TaitoInputPort2[i] & 1) << i; + TaitoInput[3] -= (TaitoInputPort3[i] & 1) << i; + TaitoInput[4] -= (TaitoInputPort4[i] & 1) << i; + TaitoInput[5] -= (TaitoInputPort5[i] & 1) << i; + } +} + +static struct BurnDIPInfo CameltryDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xfe, NULL }, + {0x0c, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x01, 0x00, "Upright" }, + {0x0b, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0b, 0x01, 0x02, 0x02, "Off" }, + {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x0b, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0xc0, 0xc0, "Same as start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x03, 0x02, "Easy" }, + {0x0c, 0x01, 0x03, 0x03, "Medium" }, + {0x0c, 0x01, 0x03, 0x01, "Hard" }, + {0x0c, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Start remain time" }, + {0x0c, 0x01, 0x0c, 0x00, "35" }, + {0x0c, 0x01, 0x0c, 0x04, "40" }, + {0x0c, 0x01, 0x0c, 0x0c, "50" }, + {0x0c, 0x01, 0x0c, 0x08, "60" }, + + {0 , 0xfe, 0 , 4 , "Continue play time" }, + {0x0c, 0x01, 0x30, 0x00, "+20" }, + {0x0c, 0x01, 0x30, 0x10, "+25" }, + {0x0c, 0x01, 0x30, 0x30, "+30" }, + {0x0c, 0x01, 0x30, 0x20, "+40" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x0c, 0x01, 0x80, 0x80, "Single" }, + {0x0c, 0x01, 0x80, 0x00, "Dual" }, +}; + +STDDIPINFO(Cameltry) + +static struct BurnDIPInfo CameltrjDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xfe, NULL }, + {0x0c, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x01, 0x00, "Upright" }, + {0x0b, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0b, 0x01, 0x02, 0x02, "Off" }, + {0x0b, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0b, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0b, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x03, 0x02, "Easy" }, + {0x0c, 0x01, 0x03, 0x03, "Medium" }, + {0x0c, 0x01, 0x03, 0x01, "Hard" }, + {0x0c, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Start remain time" }, + {0x0c, 0x01, 0x0c, 0x00, "35" }, + {0x0c, 0x01, 0x0c, 0x04, "40" }, + {0x0c, 0x01, 0x0c, 0x0c, "50" }, + {0x0c, 0x01, 0x0c, 0x08, "60" }, + + {0 , 0xfe, 0 , 4 , "Continue play time" }, + {0x0c, 0x01, 0x30, 0x00, "+20" }, + {0x0c, 0x01, 0x30, 0x10, "+25" }, + {0x0c, 0x01, 0x30, 0x30, "+30" }, + {0x0c, 0x01, 0x30, 0x20, "+40" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x0c, 0x01, 0x80, 0x80, "Single" }, + {0x0c, 0x01, 0x80, 0x00, "Dual" }, +}; + +STDDIPINFO(Cameltrj) + +static struct BurnDIPInfo DeadconxDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfe, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x15, 0x01, 0x01, 0x00, "Upright" }, + {0x15, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Damage" }, + {0x16, 0x01, 0x18, 0x10, "Small" }, + {0x16, 0x01, 0x18, 0x18, "Normal" }, + {0x16, 0x01, 0x18, 0x08, "Big" }, + {0x16, 0x01, 0x18, 0x00, "Biggest" }, + + {0 , 0xfe, 0 , 2 , "Game Type" }, + {0x16, 0x01, 0x80, 0x00, "1 Player Only" }, + {0x16, 0x01, 0x80, 0x80, "Multiplayer" }, +}; + +STDDIPINFO(Deadconx) + +static struct BurnDIPInfo DeadconxjDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfe, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x15, 0x01, 0x01, 0x00, "Upright" }, + {0x15, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x0c, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x03, 0x02, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x03, 0x01, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Damage" }, + {0x16, 0x01, 0x18, 0x10, "Small" }, + {0x16, 0x01, 0x18, 0x18, "Normal" }, + {0x16, 0x01, 0x18, 0x08, "Big" }, + {0x16, 0x01, 0x18, 0x00, "Biggest" }, + + {0 , 0xfe, 0 , 2 , "Game Type" }, + {0x16, 0x01, 0x80, 0x00, "1 Player Only" }, + {0x16, 0x01, 0x80, 0x80, "Multiplayer" }, +}; + +STDDIPINFO(Deadconxj) + +static struct BurnDIPInfo DinorexDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Damage" }, + {0x16, 0x01, 0x0c, 0x08, "Small" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Big" }, + {0x16, 0x01, 0x0c, 0x00, "Biggest" }, + + {0 , 0xfe, 0 , 2 , "Timer Speed" }, + {0x16, 0x01, 0x10, 0x10, "Normal" }, + {0x16, 0x01, 0x10, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Match Type" }, + {0x16, 0x01, 0x20, 0x20, "Best of 3" }, + {0x16, 0x01, 0x20, 0x00, "Single" }, + + {0 , 0xfe, 0 , 2 , "2 Player Mode" }, + {0x16, 0x01, 0x40, 0x40, "Upright" }, + {0x16, 0x01, 0x40, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x16, 0x01, 0x80, 0x00, "Single" }, + {0x16, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Dinorex) + +static struct BurnDIPInfo DinorexjDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x0c, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x03, 0x02, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x03, 0x01, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Damage" }, + {0x16, 0x01, 0x0c, 0x08, "Small" }, + {0x16, 0x01, 0x0c, 0x0c, "Normal" }, + {0x16, 0x01, 0x0c, 0x04, "Big" }, + {0x16, 0x01, 0x0c, 0x00, "Biggest" }, + + {0 , 0xfe, 0 , 2 , "Timer Speed" }, + {0x16, 0x01, 0x10, 0x10, "Normal" }, + {0x16, 0x01, 0x10, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Match Type" }, + {0x16, 0x01, 0x20, 0x20, "Best of 3" }, + {0x16, 0x01, 0x20, 0x00, "Single" }, + + {0 , 0xfe, 0 , 2 , "2 Player Mode" }, + {0x16, 0x01, 0x40, 0x40, "Upright" }, + {0x16, 0x01, 0x40, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x16, 0x01, 0x80, 0x00, "Single" }, + {0x16, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Dinorexj) + +static struct BurnDIPInfo DondokodDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "10k and 100k" }, + {0x14, 0x01, 0x0c, 0x08, "10k and 150k" }, + {0x14, 0x01, 0x0c, 0x04, "10k and 250k" }, + {0x14, 0x01, 0x0c, 0x00, "10k and 350k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, +}; + +STDDIPINFO(Dondokod) + +static struct BurnDIPInfo DondokodjDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "10k and 100k" }, + {0x14, 0x01, 0x0c, 0x08, "10k and 150k" }, + {0x14, 0x01, 0x0c, 0x04, "10k and 250k" }, + {0x14, 0x01, 0x0c, 0x00, "10k and 350k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, +}; + +STDDIPINFO(Dondokodj) + +static struct BurnDIPInfo DondokoduDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "Same as start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "10k and 100k" }, + {0x14, 0x01, 0x0c, 0x08, "10k and 150k" }, + {0x14, 0x01, 0x0c, 0x04, "10k and 250k" }, + {0x14, 0x01, 0x0c, 0x00, "10k and 350k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, +}; + +STDDIPINFO(Dondokodu) + +static struct BurnDIPInfo DriftoutDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0xff, NULL }, + {0x0d, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0c, 0x01, 0x02, 0x02, "Off" }, + {0x0c, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x04, 0x04, "Off" }, + {0x0c, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0c, 0x01, 0x08, 0x00, "Off" }, + {0x0c, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0c, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, + {0x0c, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0c, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0c, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0c, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0c, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0c, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0c, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0d, 0x01, 0x03, 0x02, "Easy" }, + {0x0d, 0x01, 0x03, 0x03, "Medium" }, + {0x0d, 0x01, 0x03, 0x01, "Hard" }, + {0x0d, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Control" }, + {0x0d, 0x01, 0x0c, 0x0c, "Joystick" }, + {0x0d, 0x01, 0x0c, 0x08, "Paddle" }, + {0x0d, 0x01, 0x0c, 0x04, "Joystick" }, + {0x0d, 0x01, 0x0c, 0x00, "Steering Wheel" }, +}; + +STDDIPINFO(Driftout) + +static struct BurnDIPInfo FinalbDIPList[]= +{ + // Default Values + {0x19, 0xff, 0xff, 0xff, NULL }, + {0x1a, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Alternate Controls" }, + {0x19, 0x01, 0x01, 0x01, "Off" }, + {0x19, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x19, 0x01, 0x02, 0x02, "Off" }, + {0x19, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x19, 0x01, 0x04, 0x04, "Off" }, + {0x19, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x19, 0x01, 0x08, 0x00, "Off" }, + {0x19, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x19, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x19, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x19, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x19, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x19, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x19, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x19, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x19, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x1a, 0x01, 0x03, 0x02, "Easy" }, + {0x1a, 0x01, 0x03, 0x03, "Medium" }, + {0x1a, 0x01, 0x03, 0x01, "Hard" }, + {0x1a, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Finalb) + +static struct BurnDIPInfo FinalbjDIPList[]= +{ + // Default Values + {0x19, 0xff, 0xff, 0xff, NULL }, + {0x1a, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Alternate Controls" }, + {0x19, 0x01, 0x01, 0x01, "Off" }, + {0x19, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x19, 0x01, 0x02, 0x02, "Off" }, + {0x19, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x19, 0x01, 0x04, 0x04, "Off" }, + {0x19, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x19, 0x01, 0x08, 0x00, "Off" }, + {0x19, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x19, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, + {0x19, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x19, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x19, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x19, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x19, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x19, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x19, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x1a, 0x01, 0x03, 0x02, "Easy" }, + {0x1a, 0x01, 0x03, 0x03, "Medium" }, + {0x1a, 0x01, 0x03, 0x01, "Hard" }, + {0x1a, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Finalbj) + +static struct BurnDIPInfo FootchmpDIPList[]= +{ + // Default Values + {0x25, 0xff, 0xff, 0xfe, NULL }, + {0x26, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Game Over Type" }, + {0x25, 0x01, 0x01, 0x01, "Both Teams' Games Over" }, + {0x25, 0x01, 0x01, 0x00, "Losing Team's Game is Over" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x25, 0x01, 0x02, 0x02, "Off" }, + {0x25, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x25, 0x01, 0x04, 0x04, "Off" }, + {0x25, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x25, 0x01, 0x08, 0x00, "Off" }, + {0x25, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x25, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x25, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x25, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x25, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x25, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x25, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x25, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x25, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x26, 0x01, 0x03, 0x02, "Easy" }, + {0x26, 0x01, 0x03, 0x03, "Normal" }, + {0x26, 0x01, 0x03, 0x01, "Hard" }, + {0x26, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Game Time" }, + {0x26, 0x01, 0x0c, 0x00, "1 minute 30 seconds" }, + {0x26, 0x01, 0x0c, 0x0c, "2 minutes" }, + {0x26, 0x01, 0x0c, 0x04, "2 minutes 30 seconds" }, + {0x26, 0x01, 0x0c, 0x08, "3 minutes" }, + + {0 , 0xfe, 0 , 4 , "Cabinet" }, + {0x26, 0x01, 0x30, 0x30, "2 Players" }, + {0x26, 0x01, 0x30, 0x20, "4 Players / 4 Coin Slots" }, + {0x26, 0x01, 0x30, 0x10, "4 Players / 2 Cabinets Combined"}, + {0x26, 0x01, 0x30, 0x00, "4 Players / 2 Coin Slots" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x26, 0x01, 0x40, 0x00, "Off" }, + {0x26, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Game Version" }, + {0x26, 0x01, 0x80, 0x00, "Normal" }, + {0x26, 0x01, 0x80, 0x80, "European" }, + +}; + +STDDIPINFO(Footchmp) + +static struct BurnDIPInfo HtheroDIPList[]= +{ + // Default Values + {0x25, 0xff, 0xff, 0x7f, NULL }, + {0x26, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Game Over Type" }, + {0x25, 0x01, 0x80, 0x80, "Both Teams' Games Over" }, + {0x25, 0x01, 0x80, 0x00, "Losing Team's Game is Over" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x25, 0x01, 0x40, 0x40, "Off" }, + {0x25, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x25, 0x01, 0x20, 0x20, "Off" }, + {0x25, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x25, 0x01, 0x10, 0x00, "Off" }, + {0x25, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x25, 0x01, 0x0c, 0x00, "3 Coins 1 Credit" }, + {0x25, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, + {0x25, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + {0x25, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x25, 0x01, 0x03, 0x00, "3 Coins 1 Credit" }, + {0x25, 0x01, 0x03, 0x02, "2 Coins 1 Credit" }, + {0x25, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x25, 0x01, 0x03, 0x01, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x26, 0x01, 0xc0, 0x40, "Easy" }, + {0x26, 0x01, 0xc0, 0xc0, "Normal" }, + {0x26, 0x01, 0xc0, 0x80, "Hard" }, + {0x26, 0x01, 0xc0, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Game Time" }, + {0x26, 0x01, 0x30, 0x00, "1 minute 30 seconds" }, + {0x26, 0x01, 0x30, 0x30, "2 minutes" }, + {0x26, 0x01, 0x30, 0x20, "2 minutes 30 seconds" }, + {0x26, 0x01, 0x30, 0x10, "3 minutes" }, + + {0 , 0xfe, 0 , 4 , "Cabinet" }, + {0x26, 0x01, 0x0c, 0x0c, "2 Players" }, + {0x26, 0x01, 0x0c, 0x04, "4 Players / 4 Coin Slots" }, + {0x26, 0x01, 0x0c, 0x08, "4 Players / 2 Cabinets Combined"}, + {0x26, 0x01, 0x0c, 0x00, "4 Players / 2 Coin Slots" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x26, 0x01, 0x02, 0x00, "Off" }, + {0x26, 0x01, 0x02, 0x02, "On" }, +}; + +STDDIPINFO(Hthero) + +static struct BurnDIPInfo GrowlDIPList[]= +{ + // Default Values + {0x28, 0xff, 0xff, 0xff, NULL }, + {0x29, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x28, 0x01, 0x02, 0x02, "Off" }, + {0x28, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x28, 0x01, 0x04, 0x04, "Off" }, + {0x28, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x28, 0x01, 0x08, 0x00, "Off" }, + {0x28, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x28, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x28, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x28, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x28, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x28, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x28, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x28, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x28, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x29, 0x01, 0x03, 0x02, "Easy" }, + {0x29, 0x01, 0x03, 0x03, "Normal" }, + {0x29, 0x01, 0x03, 0x01, "Hard" }, + {0x29, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Cabinet Type" }, + {0x29, 0x01, 0x30, 0x30, "2 Players" }, + {0x29, 0x01, 0x30, 0x20, "4 Players / 4 Coin Slots" }, + {0x29, 0x01, 0x30, 0x10, "4 Players / 2 Cabinets Combined"}, + {0x29, 0x01, 0x30, 0x00, "4 Players / 2 Coin Slots" }, + + {0 , 0xfe, 0 , 2 , "Final Boss Continue" }, + {0x29, 0x01, 0x40, 0x00, "Off" }, + {0x29, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Growl) + +static struct BurnDIPInfo GrowluDIPList[]= +{ + // Default Values + {0x28, 0xff, 0xff, 0xff, NULL }, + {0x29, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x28, 0x01, 0x02, 0x02, "Off" }, + {0x28, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x28, 0x01, 0x04, 0x04, "Off" }, + {0x28, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x28, 0x01, 0x08, 0x00, "Off" }, + {0x28, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x28, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x28, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x28, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x28, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x28, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x28, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x28, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x28, 0x01, 0xc0, 0xc0, "Same as start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x29, 0x01, 0x03, 0x02, "Easy" }, + {0x29, 0x01, 0x03, 0x03, "Normal" }, + {0x29, 0x01, 0x03, 0x01, "Hard" }, + {0x29, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Cabinet Type" }, + {0x29, 0x01, 0x30, 0x30, "2 Players" }, + {0x29, 0x01, 0x30, 0x20, "4 Players / 4 Coin Slots" }, + {0x29, 0x01, 0x30, 0x10, "4 Players / 2 Cabinets Combined"}, + {0x29, 0x01, 0x30, 0x00, "4 Players / 2 Coin Slots" }, + + {0 , 0xfe, 0 , 2 , "Final Boss Continue" }, + {0x29, 0x01, 0x40, 0x00, "Off" }, + {0x29, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Growlu) + +static struct BurnDIPInfo RunarkDIPList[]= +{ + // Default Values + {0x28, 0xff, 0xff, 0xff, NULL }, + {0x29, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x28, 0x01, 0x02, 0x02, "Off" }, + {0x28, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x28, 0x01, 0x04, 0x04, "Off" }, + {0x28, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x28, 0x01, 0x08, 0x00, "Off" }, + {0x28, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x28, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x28, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x28, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x28, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x28, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x28, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x28, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x28, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x29, 0x01, 0x03, 0x02, "Easy" }, + {0x29, 0x01, 0x03, 0x03, "Normal" }, + {0x29, 0x01, 0x03, 0x01, "Hard" }, + {0x29, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Cabinet Type" }, + {0x29, 0x01, 0x30, 0x30, "2 Players" }, + {0x29, 0x01, 0x30, 0x20, "4 Players / 4 Coin Slots" }, + {0x29, 0x01, 0x30, 0x10, "4 Players / 2 Cabinets Combined"}, + {0x29, 0x01, 0x30, 0x00, "4 Players / 2 Coin Slots" }, + + {0 , 0xfe, 0 , 2 , "Final Boss Continue" }, + {0x29, 0x01, 0x40, 0x00, "Off" }, + {0x29, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Runark) + +static struct BurnDIPInfo GunfrontDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "10k and every 80k" }, + {0x14, 0x01, 0x0c, 0x0c, "20k and every 80k" }, + {0x14, 0x01, 0x0c, 0x04, "30k and every 80k" }, + {0x14, 0x01, 0x0c, 0x00, "60k and every 80k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x20, "1" }, + {0x14, 0x01, 0x30, 0x10, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x14, 0x01, 0x80, 0x00, "Single" }, + {0x14, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Gunfront) + +static struct BurnDIPInfo GunfrontjDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "10k and every 80k" }, + {0x14, 0x01, 0x0c, 0x0c, "20k and every 80k" }, + {0x14, 0x01, 0x0c, 0x04, "30k and every 80k" }, + {0x14, 0x01, 0x0c, 0x00, "60k and every 80k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x20, "1" }, + {0x14, 0x01, 0x30, 0x10, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x14, 0x01, 0x80, 0x00, "Single" }, + {0x14, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Gunfrontj) + +static struct BurnDIPInfo KoshienDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Timer" }, + {0x16, 0x01, 0x04, 0x00, "Off" }, + {0x16, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x20, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x10, "4" }, + {0x16, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x40, 0x00, "Off" }, + {0x16, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x16, 0x01, 0x80, 0x00, "Single" }, + {0x16, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Koshien) + +static struct BurnDIPInfo LiquidkDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "30k and 100k" }, + {0x14, 0x01, 0x0c, 0x08, "30k and 150k" }, + {0x14, 0x01, 0x0c, 0x04, "50k and 250k" }, + {0x14, 0x01, 0x0c, 0x00, "50k and 350k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x14, 0x01, 0x80, 0x80, "Single" }, + {0x14, 0x01, 0x80, 0x00, "Dual" }, +}; + +STDDIPINFO(Liquidk) + +static struct BurnDIPInfo LiquidkuDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "Same as start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "30k and 100k" }, + {0x14, 0x01, 0x0c, 0x08, "30k and 150k" }, + {0x14, 0x01, 0x0c, 0x04, "50k and 250k" }, + {0x14, 0x01, 0x0c, 0x00, "50k and 350k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x00, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x14, 0x01, 0x80, 0x80, "Single" }, + {0x14, 0x01, 0x80, 0x00, "Dual" }, +}; + +STDDIPINFO(Liquidku) + +static struct BurnDIPInfo MegablstDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "100k only" }, + {0x14, 0x01, 0x0c, 0x04, "150k only" }, + {0x14, 0x01, 0x0c, 0x08, "200k only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x10, "1" }, + {0x14, 0x01, 0x30, 0x00, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x14, 0x01, 0x40, 0x00, "Single" }, + {0x14, 0x01, 0x40, 0x40, "Dual" }, +}; + +STDDIPINFO(Megablst) + +static struct BurnDIPInfo MegablstjDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "100k only" }, + {0x14, 0x01, 0x0c, 0x04, "150k only" }, + {0x14, 0x01, 0x0c, 0x08, "200k only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x10, "1" }, + {0x14, 0x01, 0x30, 0x00, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x14, 0x01, 0x40, 0x00, "Single" }, + {0x14, 0x01, 0x40, 0x40, "Dual" }, +}; + +STDDIPINFO(Megablstj) + +static struct BurnDIPInfo MegablstuDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "Same as start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "100k only" }, + {0x14, 0x01, 0x0c, 0x04, "150k only" }, + {0x14, 0x01, 0x0c, 0x08, "200k only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x10, "1" }, + {0x14, 0x01, 0x30, 0x00, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x14, 0x01, 0x40, 0x00, "Single" }, + {0x14, 0x01, 0x40, 0x40, "Dual" }, +}; + +STDDIPINFO(Megablstu) + +static struct BurnDIPInfo MetalbDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x08, "50k and every 120k" }, + {0x16, 0x01, 0x0c, 0x0c, "70k and every 150k" }, + {0x16, 0x01, 0x0c, 0x04, "80k and every 160k" }, + {0x16, 0x01, 0x0c, 0x00, "100k and every 200k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x00, "1" }, + {0x16, 0x01, 0x30, 0x10, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x40, 0x00, "Off" }, + {0x16, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x16, 0x01, 0x80, 0x00, "Single" }, + {0x16, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Metalb) + +static struct BurnDIPInfo MetalbjDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x08, "50k and every 120k" }, + {0x16, 0x01, 0x0c, 0x0c, "70k and every 150k" }, + {0x16, 0x01, 0x0c, 0x04, "80k and every 160k" }, + {0x16, 0x01, 0x0c, 0x00, "100k and every 200k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x00, "1" }, + {0x16, 0x01, 0x30, 0x10, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x40, 0x00, "Off" }, + {0x16, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x16, 0x01, 0x80, 0x00, "Single" }, + {0x16, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Metalbj) + +static struct BurnDIPInfo MjnquestDIPList[]= +{ + // Default Values + {0x19, 0xff, 0xff, 0xff, NULL }, + {0x1a, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x19, 0x01, 0x02, 0x02, "Off" }, + {0x19, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x19, 0x01, 0x04, 0x04, "Off" }, + {0x19, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x19, 0x01, 0x08, 0x00, "Off" }, + {0x19, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x19, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x19, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x19, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x19, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x19, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x19, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x19, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x19, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x1a, 0x01, 0x03, 0x02, "Easy" }, + {0x1a, 0x01, 0x03, 0x03, "Medium" }, + {0x1a, 0x01, 0x03, 0x01, "Hard" }, + {0x1a, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Mjnquest) + +static struct BurnDIPInfo NinjakDIPList[]= +{ + // Default Values + {0x24, 0xff, 0xff, 0xff, NULL }, + {0x25, 0xff, 0xff, 0xdf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x24, 0x01, 0x02, 0x02, "Off" }, + {0x24, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x24, 0x01, 0x04, 0x04, "Off" }, + {0x24, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x24, 0x01, 0x08, 0x00, "Off" }, + {0x24, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x24, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x24, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x24, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x24, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x24, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x24, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x24, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x24, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x25, 0x01, 0x03, 0x02, "Easy" }, + {0x25, 0x01, 0x03, 0x03, "Medium" }, + {0x25, 0x01, 0x03, 0x01, "Hard" }, + {0x25, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Cabinet Type" }, + {0x25, 0x01, 0x0c, 0x0c, "2 Players" }, + {0x25, 0x01, 0x0c, 0x08, "TROG (4 Players / 2 Coin Slots" }, + {0x25, 0x01, 0x0c, 0x04, "MTX2 (4 Players / 2 Cabinets" }, + {0x25, 0x01, 0x0c, 0x00, "YMNT (4 Players / 4 Coin Slots" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x25, 0x01, 0x30, 0x20, "2" }, + {0x25, 0x01, 0x30, 0x30, "3" }, + {0x25, 0x01, 0x30, 0x10, "4" }, + {0x25, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x25, 0x01, 0x40, 0x00, "Off" }, + {0x25, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Game Type" }, + {0x25, 0x01, 0x80, 0x00, "1 Player Only" }, + {0x25, 0x01, 0x80, 0x80, "Multiplayer" }, +}; + +STDDIPINFO(Ninjak) + +static struct BurnDIPInfo NinjakjDIPList[]= +{ + // Default Values + {0x24, 0xff, 0xff, 0xff, NULL }, + {0x25, 0xff, 0xff, 0xdf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x24, 0x01, 0x02, 0x02, "Off" }, + {0x24, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x24, 0x01, 0x04, 0x04, "Off" }, + {0x24, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x24, 0x01, 0x08, 0x00, "Off" }, + {0x24, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x24, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x24, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x24, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x24, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x24, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x24, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x24, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x24, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x25, 0x01, 0x03, 0x02, "Easy" }, + {0x25, 0x01, 0x03, 0x03, "Medium" }, + {0x25, 0x01, 0x03, 0x01, "Hard" }, + {0x25, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Cabinet Type" }, + {0x25, 0x01, 0x0c, 0x0c, "2 Players" }, + {0x25, 0x01, 0x0c, 0x08, "TROG (4 Players / 2 Coin Slots" }, + {0x25, 0x01, 0x0c, 0x04, "MTX2 (4 Players / 2 Cabinets" }, + {0x25, 0x01, 0x0c, 0x00, "YMNT (4 Players / 4 Coin Slots" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x25, 0x01, 0x30, 0x20, "2" }, + {0x25, 0x01, 0x30, 0x30, "3" }, + {0x25, 0x01, 0x30, 0x10, "4" }, + {0x25, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x25, 0x01, 0x40, 0x00, "Off" }, + {0x25, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Game Type" }, + {0x25, 0x01, 0x80, 0x00, "1 Player Only" }, + {0x25, 0x01, 0x80, 0x80, "Multiplayer" }, +}; + +STDDIPINFO(Ninjakj) + +static struct BurnDIPInfo NinjakuDIPList[]= +{ + // Default Values + {0x24, 0xff, 0xff, 0xff, NULL }, + {0x25, 0xff, 0xff, 0xdf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x24, 0x01, 0x02, 0x02, "Off" }, + {0x24, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x24, 0x01, 0x04, 0x04, "Off" }, + {0x24, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x24, 0x01, 0x08, 0x00, "Off" }, + {0x24, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x24, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x24, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x24, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x24, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x24, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x24, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x24, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x24, 0x01, 0xc0, 0xc0, "Same as start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x25, 0x01, 0x03, 0x02, "Easy" }, + {0x25, 0x01, 0x03, 0x03, "Medium" }, + {0x25, 0x01, 0x03, 0x01, "Hard" }, + {0x25, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Cabinet Type" }, + {0x25, 0x01, 0x0c, 0x0c, "2 Players" }, + {0x25, 0x01, 0x0c, 0x08, "TROG (4 Players / 2 Coin Slots" }, + {0x25, 0x01, 0x0c, 0x04, "MTX2 (4 Players / 2 Cabinets" }, + {0x25, 0x01, 0x0c, 0x00, "YMNT (4 Players / 4 Coin Slots" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x25, 0x01, 0x30, 0x20, "2" }, + {0x25, 0x01, 0x30, 0x30, "3" }, + {0x25, 0x01, 0x30, 0x10, "4" }, + {0x25, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x25, 0x01, 0x40, 0x00, "Off" }, + {0x25, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Game Type" }, + {0x25, 0x01, 0x80, 0x00, "1 Player Only" }, + {0x25, 0x01, 0x80, 0x80, "Multiplayer" }, +}; + +STDDIPINFO(Ninjaku) + +static struct BurnDIPInfo PulirulaDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 3 , "Magic" }, + {0x16, 0x01, 0x0c, 0x0c, "3" }, + {0x16, 0x01, 0x0c, 0x08, "4" }, + {0x16, 0x01, 0x0c, 0x04, "5" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x20, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x10, "4" }, + {0x16, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x16, 0x01, 0x80, 0x00, "Single" }, + {0x16, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Pulirula) + +static struct BurnDIPInfo PulirulajDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 3 , "Magic" }, + {0x16, 0x01, 0x0c, 0x0c, "3" }, + {0x16, 0x01, 0x0c, 0x08, "4" }, + {0x16, 0x01, 0x0c, 0x04, "5" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x20, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x10, "4" }, + {0x16, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x16, 0x01, 0x80, 0x00, "Single" }, + {0x16, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Pulirulaj) + +static struct BurnDIPInfo QcrayonDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Default Time" }, + {0x12, 0x01, 0x0c, 0x00, "6 seconds" }, + {0x12, 0x01, 0x0c, 0x04, "7 seconds" }, + {0x12, 0x01, 0x0c, 0x08, "8 seconds" }, + {0x12, 0x01, 0x0c, 0x0c, "10 seconds" }, +}; + +STDDIPINFO(Qcrayon) + +static struct BurnDIPInfo Qcrayon2DIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Game Control" }, + {0x12, 0x01, 0x80, 0x80, "Joystick" }, + {0x12, 0x01, 0x80, 0x00, "4 Buttons" }, +}; + +STDDIPINFO(Qcrayon2) + +static struct BurnDIPInfo QjinseiDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Qjinsei) + +static struct BurnDIPInfo QtorimonDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x02, 0x02, "Off" }, + {0x0f, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0f, 0x01, 0x04, 0x04, "Off" }, + {0x0f, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0f, 0x01, 0x30, 0x00, "2 Coins 1 Credit" }, + {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x10, 0x01, 0x03, 0x02, "Easy" }, + {0x10, 0x01, 0x03, 0x03, "Medium" }, + {0x10, 0x01, 0x03, 0x01, "Hard" }, + {0x10, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x30, 0x10, "1" }, + {0x10, 0x01, 0x30, 0x20, "2" }, + {0x10, 0x01, 0x30, 0x30, "3" }, + {0x10, 0x01, 0x30, 0x00, "4" }, + + {0 , 0xfe, 0 , 2 , "Show Correct Answer" }, + {0x10, 0x01, 0x40, 0x40, "Off" }, + {0x10, 0x01, 0x40, 0x00, "On" }, +}; + +STDDIPINFO(Qtorimon) + +static struct BurnDIPInfo QuizhqDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Time" }, + {0x12, 0x01, 0x0c, 0x0c, "5 seconds" }, + {0x12, 0x01, 0x0c, 0x08, "10 seconds" }, + {0x12, 0x01, 0x0c, 0x04, "15 seconds" }, + {0x12, 0x01, 0x0c, 0x00, "20 seconds" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x12, 0x01, 0x30, 0x20, "1" }, + {0x12, 0x01, 0x30, 0x30, "2" }, + {0x12, 0x01, 0x30, 0x10, "3" }, + {0x12, 0x01, 0x30, 0x00, "4" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x12, 0x01, 0x40, 0x00, "Off" }, + {0x12, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x12, 0x01, 0x80, 0x00, "Single" }, + {0x12, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Quizhq) + +static struct BurnDIPInfo QzchikyuDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfe, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x01, 0x00, "Upright" }, + {0x11, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Qzchikyu) + +static struct BurnDIPInfo QzquestDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfe, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x01, 0x00, "Upright" }, + {0x11, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Qzquest) + +static struct BurnDIPInfo SolfigtrDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, +}; + +STDDIPINFO(Solfigtr) + +static struct BurnDIPInfo SsiDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Shields" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + {0x14, 0x01, 0x0c, 0x0c, "1" }, + {0x14, 0x01, 0x0c, 0x04, "2" }, + {0x14, 0x01, 0x0c, 0x08, "3" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x14, 0x01, 0x10, 0x00, "2" }, + {0x14, 0x01, 0x10, 0x10, "3" }, + + {0 , 0xfe, 0 , 4 , "2 Player Mode" }, + {0x14, 0x01, 0xa0, 0xa0, "Simultaneous" }, + {0x14, 0x01, 0xa0, 0x80, "Alternate, Single" }, + {0x14, 0x01, 0xa0, 0x00, "Alternate, Dual" }, + {0x14, 0x01, 0xa0, 0x20, "Not Allowed" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Ssi) + +static struct BurnDIPInfo Majest12DIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Shields" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + {0x14, 0x01, 0x0c, 0x0c, "1" }, + {0x14, 0x01, 0x0c, 0x04, "2" }, + {0x14, 0x01, 0x0c, 0x08, "3" }, + + {0 , 0xfe, 0 , 2 , "Lives" }, + {0x14, 0x01, 0x10, 0x00, "2" }, + {0x14, 0x01, 0x10, 0x10, "3" }, + + {0 , 0xfe, 0 , 4 , "2 Player Mode" }, + {0x14, 0x01, 0xa0, 0xa0, "Simultaneous" }, + {0x14, 0x01, 0xa0, 0x80, "Alternate, Single" }, + {0x14, 0x01, 0xa0, 0x00, "Alternate, Dual" }, + {0x14, 0x01, 0xa0, 0x20, "Not Allowed" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Majest12) + +static struct BurnDIPInfo ThundfoxDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Timer" }, + {0x16, 0x01, 0x04, 0x00, "Off" }, + {0x16, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x20, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x10, "4" }, + {0x16, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x40, 0x00, "Off" }, + {0x16, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x16, 0x01, 0x80, 0x00, "Single" }, + {0x16, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Thundfox) + +static struct BurnDIPInfo ThundfoxjDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Timer" }, + {0x16, 0x01, 0x04, 0x00, "Off" }, + {0x16, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x20, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x10, "4" }, + {0x16, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x40, 0x00, "Off" }, + {0x16, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x16, 0x01, 0x80, 0x00, "Single" }, + {0x16, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Thundfoxj) + +static struct BurnDIPInfo ThundfoxuDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x15, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xc0, 0xc0, "Same as start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Timer" }, + {0x16, 0x01, 0x04, 0x00, "Off" }, + {0x16, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x20, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x10, "4" }, + {0x16, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x40, 0x00, "Off" }, + {0x16, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Upright Controls" }, + {0x16, 0x01, 0x80, 0x00, "Single" }, + {0x16, 0x01, 0x80, 0x80, "Dual" }, +}; + +STDDIPINFO(Thundfoxu) + +static struct BurnDIPInfo YesnojDIPList[]= +{ + // Default Values + {0x09, 0xff, 0xff, 0xff, NULL }, + {0x0a, 0xff, 0xff, 0xfe, NULL }, + + // Dip 1 + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Results Printer" }, + {0x0a, 0x01, 0x01, 0x00, "Off" }, + {0x0a, 0x01, 0x01, 0x01, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0a, 0x01, 0x02, 0x00, "Off" }, + {0x0a, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0a, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0a, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0a, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0a, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, +}; + +STDDIPINFO(Yesnoj) + +static struct BurnDIPInfo YuyugogoDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xff, NULL }, + {0x12, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x03, 0x02, "Easy" }, + {0x12, 0x01, 0x03, 0x03, "Medium" }, + {0x12, 0x01, 0x03, 0x01, "Hard" }, + {0x12, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x12, 0x01, 0x40, 0x00, "Off" }, + {0x12, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Yuyugogo) + +static struct BurnRomInfo CameltryRomDesc[] = { + { "c38-11", 0x020000, 0xbe172da0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c38-14", 0x020000, 0xffa430de, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c38-08.bin", 0x010000, 0x7ff78873, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c38-01.bin", 0x080000, 0xc170ff36, BRF_GRA | TAITO_SPRITESA }, + + { "c38-03.bin", 0x020000, 0x59fa59a7, BRF_SND | TAITO_YM2610A }, + + { "c38-02.bin", 0x020000, 0x1a11714b, BRF_GRA | TAITO_CHARS_PIVOT }, +}; + +STD_ROM_PICK(Cameltry) +STD_ROM_FN(Cameltry) + +static struct BurnRomInfo CameltryauRomDesc[] = { + { "c38-11", 0x020000, 0xbe172da0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c38-14", 0x020000, 0xffa430de, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c38-15.bin", 0x010000, 0x0e60faac, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c38-01.bin", 0x080000, 0xc170ff36, BRF_GRA | TAITO_SPRITESA }, + + { "c38-02.bin", 0x020000, 0x1a11714b, BRF_GRA | TAITO_CHARS_PIVOT }, + + { "c38-04.bin", 0x020000, 0x53d330bb, BRF_SND | TAITO_MSM6295 }, +}; + +STD_ROM_PICK(Cameltryau) +STD_ROM_FN(Cameltryau) + +static struct BurnRomInfo CameltryaRomDesc[] = { + { "c38-11", 0x020000, 0xbe172da0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c38-16", 0x020000, 0x66ad6164, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c38-15.bin", 0x010000, 0x0e60faac, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c38-01.bin", 0x080000, 0xc170ff36, BRF_GRA | TAITO_SPRITESA }, + + { "c38-02.bin", 0x020000, 0x1a11714b, BRF_GRA | TAITO_CHARS_PIVOT }, + + { "c38-04.bin", 0x020000, 0x53d330bb, BRF_SND | TAITO_MSM6295 }, +}; + +STD_ROM_PICK(Cameltrya) +STD_ROM_FN(Cameltrya) + +static struct BurnRomInfo CameltryjRomDesc[] = { + { "c38-09.bin", 0x020000, 0x2ae01120, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c38-10.bin", 0x020000, 0x48d8ff56, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c38-08.bin", 0x010000, 0x7ff78873, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c38-01.bin", 0x080000, 0xc170ff36, BRF_GRA | TAITO_SPRITESA }, + + { "c38-03.bin", 0x020000, 0x59fa59a7, BRF_SND | TAITO_YM2610A }, + + { "c38-02.bin", 0x020000, 0x1a11714b, BRF_GRA | TAITO_CHARS_PIVOT }, +}; + +STD_ROM_PICK(Cameltryj) +STD_ROM_FN(Cameltryj) + +static struct BurnRomInfo DeadconxRomDesc[] = { + { "d28-06.3", 0x040000, 0x5b4bff51, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d28-12.5", 0x040000, 0x9b74e631, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d28-09.2", 0x040000, 0x143a0cc1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d28-08.4", 0x040000, 0x4c872bd9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "d28-10.6", 0x010000, 0x40805d74, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d28-04.16", 0x080000, 0xdcabc26b, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "d28-05.17", 0x080000, 0x862f9665, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "d28-01.8", 0x100000, 0x181d7b69, BRF_GRA | TAITO_SPRITESA }, + { "d28-02.9", 0x100000, 0xd301771c, BRF_GRA | TAITO_SPRITESA }, + + { "d28-03.10", 0x100000, 0xa1804b52, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Deadconx) +STD_ROM_FN(Deadconx) + +static struct BurnRomInfo DeadconxjRomDesc[] = { + { "d28-06.3", 0x040000, 0x5b4bff51, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d28-07.5", 0x040000, 0x3fb8954c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d28-09.2", 0x040000, 0x143a0cc1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d28-08.4", 0x040000, 0x4c872bd9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "d28-10.6", 0x010000, 0x40805d74, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d28-04.16", 0x080000, 0xdcabc26b, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "d28-05.17", 0x080000, 0x862f9665, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "d28-01.8", 0x100000, 0x181d7b69, BRF_GRA | TAITO_SPRITESA }, + { "d28-02.9", 0x100000, 0xd301771c, BRF_GRA | TAITO_SPRITESA }, + + { "d28-03.10", 0x100000, 0xa1804b52, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Deadconxj) +STD_ROM_FN(Deadconxj) + +static struct BurnRomInfo DinorexRomDesc[] = { + { "d39-14.9", 0x080000, 0xe6aafdac, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d39-16.8", 0x080000, 0xcedc8537, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d39-04.6", 0x100000, 0x3800506d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + { "d39-05.7", 0x100000, 0xe2ec3b5d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "d39-12.5", 0x010000, 0x8292c7c1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d39-06.2", 0x100000, 0x52f62835, BRF_GRA | TAITO_CHARS }, + + { "d39-01.29", 0x200000, 0xd10e9c7d, BRF_GRA | TAITO_SPRITESA }, + { "d39-02.28", 0x200000, 0x6c304403, BRF_GRA | TAITO_SPRITESA }, + { "d39-03.27", 0x200000, 0xfc9cdab4, BRF_GRA | TAITO_SPRITESA }, + + { "d39-07.10", 0x100000, 0x28262816, BRF_SND | TAITO_YM2610A }, + { "d39-08.4", 0x080000, 0x377b8b7b, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Dinorex) +STD_ROM_FN(Dinorex) + +static struct BurnRomInfo DinorexjRomDesc[] = { + { "d39-14.9", 0x080000, 0xe6aafdac, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d39-13.8", 0x080000, 0xae496b2f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d39-04.6", 0x100000, 0x3800506d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + { "d39-05.7", 0x100000, 0xe2ec3b5d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "d39-12.5", 0x010000, 0x8292c7c1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d39-06.2", 0x100000, 0x52f62835, BRF_GRA | TAITO_CHARS }, + + { "d39-01.29", 0x200000, 0xd10e9c7d, BRF_GRA | TAITO_SPRITESA }, + { "d39-02.28", 0x200000, 0x6c304403, BRF_GRA | TAITO_SPRITESA }, + { "d39-03.27", 0x200000, 0xfc9cdab4, BRF_GRA | TAITO_SPRITESA }, + + { "d39-07.10", 0x100000, 0x28262816, BRF_SND | TAITO_YM2610A }, + { "d39-08.4", 0x080000, 0x377b8b7b, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Dinorexj) +STD_ROM_FN(Dinorexj) + +static struct BurnRomInfo DinorexuRomDesc[] = { + { "d39-14.9", 0x080000, 0xe6aafdac, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d39-15.8", 0x080000, 0xfe96723b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d39-04.6", 0x100000, 0x3800506d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + { "d39-05.7", 0x100000, 0xe2ec3b5d, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "d39-12.5", 0x010000, 0x8292c7c1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d39-06.2", 0x100000, 0x52f62835, BRF_GRA | TAITO_CHARS }, + + { "d39-01.29", 0x200000, 0xd10e9c7d, BRF_GRA | TAITO_SPRITESA }, + { "d39-02.28", 0x200000, 0x6c304403, BRF_GRA | TAITO_SPRITESA }, + { "d39-03.27", 0x200000, 0xfc9cdab4, BRF_GRA | TAITO_SPRITESA }, + + { "d39-07.10", 0x100000, 0x28262816, BRF_SND | TAITO_YM2610A }, + { "d39-08.4", 0x080000, 0x377b8b7b, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Dinorexu) +STD_ROM_FN(Dinorexu) + +static struct BurnRomInfo DondokodRomDesc[] = { + { "b95-12.bin", 0x020000, 0xd0fce87a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b95-11-1.bin", 0x020000, 0xdad40cd3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b95-10.bin", 0x020000, 0xa46e1f0b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b95-14.bin", 0x020000, 0x6e4e1351, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b95-08.bin", 0x010000, 0xb5aa49e1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b95-02.bin", 0x080000, 0x67b4e979, BRF_GRA | TAITO_CHARS }, + + { "b95-01.bin", 0x080000, 0x51c176ce, BRF_GRA | TAITO_SPRITESA }, + + { "b95-04.bin", 0x080000, 0xac4c1716, BRF_SND | TAITO_YM2610A }, + + { "b95-03.bin", 0x080000, 0x543aa0d1, BRF_GRA | TAITO_CHARS_PIVOT }, +}; + +STD_ROM_PICK(Dondokod) +STD_ROM_FN(Dondokod) + +static struct BurnRomInfo DondokodjRomDesc[] = { + { "b95-12.bin", 0x020000, 0xd0fce87a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b95-11-1.bin", 0x020000, 0xdad40cd3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b95-10.bin", 0x020000, 0xa46e1f0b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b95-09.bin", 0x020000, 0xd8c86d39, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b95-08.bin", 0x010000, 0xb5aa49e1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b95-02.bin", 0x080000, 0x67b4e979, BRF_GRA | TAITO_CHARS }, + + { "b95-01.bin", 0x080000, 0x51c176ce, BRF_GRA | TAITO_SPRITESA }, + + { "b95-04.bin", 0x080000, 0xac4c1716, BRF_SND | TAITO_YM2610A }, + + { "b95-03.bin", 0x080000, 0x543aa0d1, BRF_GRA | TAITO_CHARS_PIVOT }, +}; + +STD_ROM_PICK(Dondokodj) +STD_ROM_FN(Dondokodj) + +static struct BurnRomInfo DondokoduRomDesc[] = { + { "b95-12.bin", 0x020000, 0xd0fce87a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b95-11-1.bin", 0x020000, 0xdad40cd3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b95-10.bin", 0x020000, 0xa46e1f0b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b95-13.bin", 0x020000, 0x350d2c65, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b95-08.bin", 0x010000, 0xb5aa49e1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b95-02.bin", 0x080000, 0x67b4e979, BRF_GRA | TAITO_CHARS }, + + { "b95-01.bin", 0x080000, 0x51c176ce, BRF_GRA | TAITO_SPRITESA }, + + { "b95-04.bin", 0x080000, 0xac4c1716, BRF_SND | TAITO_YM2610A }, + + { "b95-03.bin", 0x080000, 0x543aa0d1, BRF_GRA | TAITO_CHARS_PIVOT }, +}; + +STD_ROM_PICK(Dondokodu) +STD_ROM_FN(Dondokodu) + +static struct BurnRomInfo DriftoutRomDesc[] = { + { "ic46.rom", 0x080000, 0x71303738, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "ic45.rom", 0x080000, 0x43f81eca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "do_50.rom", 0x010000, 0xffe10124, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "do_obj.rom", 0x080000, 0x5491f1c4, BRF_GRA | TAITO_SPRITESA }, + + { "do_snd.rom", 0x080000, 0xf2deb82b, BRF_SND | TAITO_YM2610A }, + + { "do_piv.rom", 0x080000, 0xc4f012f7, BRF_GRA | TAITO_CHARS_PIVOT }, +}; + +STD_ROM_PICK(Driftout) +STD_ROM_FN(Driftout) + +static struct BurnRomInfo DriftoutjRomDesc[] = { + { "do_46.rom", 0x080000, 0xf960363e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "do_45.rom", 0x080000, 0xe3fe66b9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "do_50.rom", 0x010000, 0xffe10124, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "do_obj.rom", 0x080000, 0x5491f1c4, BRF_GRA | TAITO_SPRITESA }, + + { "do_snd.rom", 0x080000, 0xf2deb82b, BRF_SND | TAITO_YM2610A }, + + { "do_piv.rom", 0x080000, 0xc4f012f7, BRF_GRA | TAITO_CHARS_PIVOT }, +}; + +STD_ROM_PICK(Driftoutj) +STD_ROM_FN(Driftoutj) + +static struct BurnRomInfo DriveoutRomDesc[] = { + { "driveout.003", 0x080000, 0xdc431e4e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "driveout.002", 0x080000, 0x6f9063f4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "driveout.020", 0x008000, 0x99aaeb2e, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "driveout.084", 0x040000, 0x530ac420, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "driveout.081", 0x040000, 0x0e9a3e9e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "do_piv.rom", 0x080000, 0xc4f012f7, BRF_GRA | TAITO_CHARS_PIVOT }, + + { "driveout.028", 0x080000, 0xcbde0b66, BRF_SND | TAITO_MSM6295 }, + { "driveout.029", 0x020000, 0x0aba2026, BRF_SND | TAITO_MSM6295 }, +}; + +STD_ROM_PICK(Driveout) +STD_ROM_FN(Driveout) + +static struct BurnRomInfo FinalbRomDesc[] = { + { "b82-09.10", 0x20000, 0x632f1ecd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b82-17.11", 0x20000, 0xe91b2ec9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b82_10.16", 0x10000, 0xa38aaaed, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b82-06.19", 0x20000, 0xfc450a25, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "b82-07.18", 0x20000, 0xec3df577, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "b82-04.4", 0x80000, 0x6346f98e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "b82-03.5", 0x80000, 0xdaa11561, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "b82-05.3", 0x80000, 0xaa90b93a, BRF_GRA | TAITO_SPRITESA }, + + { "b82-02.1", 0x80000, 0x5dd06bdd, BRF_SND | TAITO_YM2610A }, + + { "b82-01.2", 0x80000, 0xf0eb6846, BRF_SND | TAITO_YM2610B }, + + { "tibpal16l8.ic41", 0x00104, 0x11a0a19a, BRF_OPT }, + { "tibpal16l8.ic42", 0x00104, 0xcc53deb8, BRF_OPT }, + { "tibpal16l8.ic51", 0x00104, 0xf2878537, BRF_OPT }, + { "gal16v8.ic13", 0x00117, 0xa4f75fd0, BRF_OPT }, + { "gal16v8.ic35", 0x00117, 0xca4eb3e1, BRF_OPT }, +}; + +STD_ROM_PICK(Finalb) +STD_ROM_FN(Finalb) + +static struct BurnRomInfo FinalbjRomDesc[] = { + { "b82-09.10", 0x20000, 0x632f1ecd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b82-08.11", 0x20000, 0x07154fe5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b82_10.16", 0x10000, 0xa38aaaed, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b82-06.19", 0x20000, 0xfc450a25, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "b82-07.18", 0x20000, 0xec3df577, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "b82-04.4", 0x80000, 0x6346f98e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "b82-03.5", 0x80000, 0xdaa11561, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "b82-05.3", 0x80000, 0xaa90b93a, BRF_GRA | TAITO_SPRITESA }, + + { "b82-02.1", 0x80000, 0x5dd06bdd, BRF_SND | TAITO_YM2610A }, + + { "b82-01.2", 0x80000, 0xf0eb6846, BRF_SND | TAITO_YM2610B }, + + { "tibpal16l8.ic41", 0x00104, 0x11a0a19a, BRF_OPT }, + { "tibpal16l8.ic42", 0x00104, 0xcc53deb8, BRF_OPT }, + { "tibpal16l8.ic51", 0x00104, 0xf2878537, BRF_OPT }, + { "gal16v8.ic13", 0x00117, 0xa4f75fd0, BRF_OPT }, + { "gal16v8.ic35", 0x00117, 0xca4eb3e1, BRF_OPT }, +}; + +STD_ROM_PICK(Finalbj) +STD_ROM_FN(Finalbj) + +static struct BurnRomInfo FinalbuRomDesc[] = { + { "b82-09-1", 0x20000, 0x66729cb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b82-6-14", 0x20000, 0x879387fa, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b82_10.16", 0x10000, 0xa38aaaed, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b82-06.19", 0x20000, 0xfc450a25, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "b82-07.18", 0x20000, 0xec3df577, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "b82-04.4", 0x80000, 0x6346f98e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "b82-03.5", 0x80000, 0xdaa11561, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "b82-05.3", 0x80000, 0xaa90b93a, BRF_GRA | TAITO_SPRITESA }, + + { "b82-02.1", 0x80000, 0x5dd06bdd, BRF_SND | TAITO_YM2610A }, + + { "b82-01.2", 0x80000, 0xf0eb6846, BRF_SND | TAITO_YM2610B }, + + { "tibpal16l8.ic41", 0x00104, 0x11a0a19a, BRF_OPT }, + { "tibpal16l8.ic42", 0x00104, 0xcc53deb8, BRF_OPT }, + { "tibpal16l8.ic51", 0x00104, 0xf2878537, BRF_OPT }, + { "gal16v8.ic13", 0x00117, 0xa4f75fd0, BRF_OPT }, + { "gal16v8.ic35", 0x00117, 0xca4eb3e1, BRF_OPT }, +}; + +STD_ROM_PICK(Finalbu) +STD_ROM_FN(Finalbu) + +static struct BurnRomInfo FootchmpRomDesc[] = { + { "c80-11.6", 0x020000, 0xf78630fb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c80-10.4", 0x020000, 0x32c109cb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c80-12.7", 0x020000, 0x80d46fef, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c80-14.5", 0x020000, 0x40ac4828, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c80-15.70", 0x010000, 0x05aa7fd7, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c80-04.1", 0x080000, 0x9a17fe8c, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "c80-05.2", 0x080000, 0xacde7071, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "c80-01.9", 0x100000, 0xf43782e6, BRF_GRA | TAITO_SPRITESA }, + { "c80-02.10", 0x100000, 0x060a8b61, BRF_GRA | TAITO_SPRITESA }, + + { "c80-03.57", 0x100000, 0x609938d5, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Footchmp) +STD_ROM_FN(Footchmp) + +static struct BurnRomInfo HtheroRomDesc[] = { + { "c80-16.6", 0x020000, 0x4e795b52, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c80-17.4", 0x020000, 0x42c0a838, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c80-12.7", 0x020000, 0x80d46fef, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c80-18.5", 0x020000, 0xaea22904, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c80-15.70", 0x010000, 0x05aa7fd7, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c80-04.1", 0x080000, 0x9a17fe8c, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "c80-05.2", 0x080000, 0xacde7071, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "c80-01.9", 0x100000, 0xf43782e6, BRF_GRA | TAITO_SPRITESA }, + { "c80-02.10", 0x100000, 0x060a8b61, BRF_GRA | TAITO_SPRITESA }, + + { "c80-03.57", 0x100000, 0x609938d5, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Hthero) +STD_ROM_FN(Hthero) + +static struct BurnRomInfo Euroch92RomDesc[] = { + { "ec92_25.rom", 0x020000, 0x98482202, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "ec92_23.rom", 0x020000, 0xae5e75e9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "ec92_26.rom", 0x020000, 0xb986ccb2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "ec92_24.rom", 0x020000, 0xb31d94ac, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "ec92_27.rom", 0x010000, 0x2db48e65, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "ec92_21.rom", 0x080000, 0x5759ed37, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "ec92_22.rom", 0x080000, 0xd9a0d38e, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "ec92_19.rom", 0x100000, 0x219141a5, BRF_GRA | TAITO_SPRITESA }, + { "c80-02.10", 0x100000, 0x060a8b61, BRF_GRA | TAITO_SPRITESA }, + + { "c80-03.57", 0x100000, 0x609938d5, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Euroch92) +STD_ROM_FN(Euroch92) + +static struct BurnRomInfo GrowlRomDesc[] = { + { "c74-10.ic59", 0x040000, 0xca81a20b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c74-08.ic61", 0x040000, 0xaa35dd9e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c74-11.ic58", 0x040000, 0xee3bd6d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c74-14.ic60", 0x040000, 0xb6c24ec7, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c74-12.ic62", 0x010000, 0xbb6ed668, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c74-01.ic34", 0x100000, 0x3434ce80, BRF_GRA | TAITO_CHARS }, + + { "c74-03.ic12", 0x100000, 0x1a0d8951, BRF_GRA | TAITO_SPRITESA }, + { "c74-02.ic11", 0x100000, 0x15a21506, BRF_GRA | TAITO_SPRITESA }, + + { "c74-04.ic28", 0x100000, 0x2d97edf2, BRF_SND | TAITO_YM2610A }, + { "c74-05.ic29", 0x080000, 0xe29c0828, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Growl) +STD_ROM_FN(Growl) + +static struct BurnRomInfo GrowluRomDesc[] = { + { "c74-10.ic59", 0x040000, 0xca81a20b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c74-08.ic61", 0x040000, 0xaa35dd9e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c74-11.ic58", 0x040000, 0xee3bd6d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c74-13.ic60", 0x040000, 0xc1c57e51, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c74-12.ic62", 0x010000, 0xbb6ed668, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c74-01.ic34", 0x100000, 0x3434ce80, BRF_GRA | TAITO_CHARS }, + + { "c74-03.ic12", 0x100000, 0x1a0d8951, BRF_GRA | TAITO_SPRITESA }, + { "c74-02.ic11", 0x100000, 0x15a21506, BRF_GRA | TAITO_SPRITESA }, + + { "c74-04.ic28", 0x100000, 0x2d97edf2, BRF_SND | TAITO_YM2610A }, + { "c74-05.ic29", 0x080000, 0xe29c0828, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Growlu) +STD_ROM_FN(Growlu) + +static struct BurnRomInfo RunarkRomDesc[] = { + { "c74-10.ic59", 0x040000, 0xca81a20b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c74-08.ic61", 0x040000, 0xaa35dd9e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c74-11.ic58", 0x040000, 0xee3bd6d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c74-09.ic14", 0x040000, 0x58cc2feb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c74-12.ic62", 0x010000, 0xbb6ed668, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c74-01.ic34", 0x100000, 0x3434ce80, BRF_GRA | TAITO_CHARS }, + + { "c74-03.ic12", 0x100000, 0x1a0d8951, BRF_GRA | TAITO_SPRITESA }, + { "c74-02.ic11", 0x100000, 0x15a21506, BRF_GRA | TAITO_SPRITESA }, + + { "c74-04.ic28", 0x100000, 0x2d97edf2, BRF_SND | TAITO_YM2610A }, + { "c74-05.ic29", 0x080000, 0xe29c0828, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Runark) +STD_ROM_FN(Runark) + +static struct BurnRomInfo GunfrontRomDesc[] = { + { "c71-09.ic42", 0x020000, 0x10a544a2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c71-08.ic41", 0x020000, 0xc17dc0a0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c71-10.ic40", 0x020000, 0xf39c0a06, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c71-14.ic39", 0x020000, 0x312da036, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c71-16.ic38", 0x020000, 0x1bbcc2d4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c71-15.ic37", 0x020000, 0xdf3e00bb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c71-12.ic49", 0x010000, 0x0038c7f8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c71-02.ic59", 0x100000, 0x2a600c92, BRF_GRA | TAITO_CHARS }, + + { "c71-03.ic19", 0x100000, 0x9133c605, BRF_GRA | TAITO_SPRITESA }, + + { "c71-01.ic29", 0x100000, 0x0e73105a, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Gunfront) +STD_ROM_FN(Gunfront) + +static struct BurnRomInfo GunfrontjRomDesc[] = { + { "c71-09.ic42", 0x020000, 0x10a544a2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c71-08.ic41", 0x020000, 0xc17dc0a0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c71-10.ic40", 0x020000, 0xf39c0a06, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c71-11.ic39", 0x020000, 0xdf23c11a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c71-16.ic38", 0x020000, 0x1bbcc2d4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c71-15.ic37", 0x020000, 0xdf3e00bb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c71-12.ic49", 0x010000, 0x0038c7f8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c71-02.ic59", 0x100000, 0x2a600c92, BRF_GRA | TAITO_CHARS }, + + { "c71-03.ic19", 0x100000, 0x9133c605, BRF_GRA | TAITO_SPRITESA }, + + { "c71-01.ic29", 0x100000, 0x0e73105a, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Gunfrontj) +STD_ROM_FN(Gunfrontj) + +static struct BurnRomInfo KoshienRomDesc[] = { + { "c81-11.bin", 0x020000, 0xb44ea8c9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c81-10.bin", 0x020000, 0x8f98c40a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c81-04.bin", 0x080000, 0x1592b460, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "c81-12.bin", 0x010000, 0x6e8625b6, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c81-03.bin", 0x100000, 0x29bbf492, BRF_GRA | TAITO_CHARS }, + + { "c81-01.bin", 0x100000, 0x64b15d2a, BRF_GRA | TAITO_SPRITESA }, + { "c81-02.bin", 0x100000, 0x962461e8, BRF_GRA | TAITO_SPRITESA }, + + { "c81-05.bin", 0x080000, 0x9c3d71be, BRF_SND | TAITO_YM2610A }, + { "c81-06.bin", 0x080000, 0x927833b4, BRF_SND | TAITO_YM2610B }, + + { "pal16l8b-c81-07.bin",0x000104, 0x46341732, BRF_OPT }, + { "pal16l8b-c81-08.bin",0x000104, 0xe7d2d300, BRF_OPT }, + { "pal16l8b-c81-09.bin",0x000104, 0xe4c012a1, BRF_OPT }, +}; + +STD_ROM_PICK(Koshien) +STD_ROM_FN(Koshien) + +static struct BurnRomInfo LiquidkRomDesc[] = { + { "c49-09.ic47", 0x20000, 0x6ae09eb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c49-11.ic48", 0x20000, 0x42d2be6e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c49-10.ic45", 0x20000, 0x50bef2e0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c49-12.ic46", 0x20000, 0xcb16bad5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c49-08.ic32", 0x10000, 0x413c310c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c49-03.ic76", 0x80000, 0xc3364f9b, BRF_GRA | TAITO_CHARS }, + + { "c49-01.ic54", 0x80000, 0x67cc3163, BRF_GRA | TAITO_SPRITESA }, + { "c49-02.ic53", 0x80000, 0xd2400710, BRF_GRA | TAITO_SPRITESA }, + + { "c49-04.ic33", 0x80000, 0x474d45a4, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Liquidk) +STD_ROM_FN(Liquidk) + +static struct BurnRomInfo LiquidkuRomDesc[] = { + { "c49-09.ic47", 0x20000, 0x6ae09eb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c49-11.ic48", 0x20000, 0x42d2be6e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c49-10.ic45", 0x20000, 0x50bef2e0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c49-14.ic46", 0x20000, 0xbc118a43, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c49-08.ic32", 0x10000, 0x413c310c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c49-03.ic76", 0x80000, 0xc3364f9b, BRF_GRA | TAITO_CHARS }, + + { "c49-01.ic54", 0x80000, 0x67cc3163, BRF_GRA | TAITO_SPRITESA }, + { "c49-02.ic53", 0x80000, 0xd2400710, BRF_GRA | TAITO_SPRITESA }, + + { "c49-04.ic33", 0x80000, 0x474d45a4, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Liquidku) +STD_ROM_FN(Liquidku) + +static struct BurnRomInfo MizubakuRomDesc[] = { + { "c49-09.ic47", 0x20000, 0x6ae09eb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c49-11.ic48", 0x20000, 0x42d2be6e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c49-10.ic45", 0x20000, 0x50bef2e0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c49-13.ic46", 0x20000, 0x2518dbf9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c49-08.ic32", 0x10000, 0x413c310c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c49-03.ic76", 0x80000, 0xc3364f9b, BRF_GRA | TAITO_CHARS }, + + { "c49-01.ic54", 0x80000, 0x67cc3163, BRF_GRA | TAITO_SPRITESA }, + { "c49-02.ic53", 0x80000, 0xd2400710, BRF_GRA | TAITO_SPRITESA }, + + { "c49-04.ic33", 0x80000, 0x474d45a4, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Mizubaku) +STD_ROM_FN(Mizubaku) + +static struct BurnRomInfo MegablstRomDesc[] = { + { "c11-07.55", 0x020000, 0x11d228b6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c11-08.39", 0x020000, 0xa79d4dca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c11-06.54", 0x020000, 0x7c249894, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c11-11.38", 0x020000, 0x263ecbf9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c11-12.3", 0x010000, 0xb11094f1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c11-05.58", 0x080000, 0x733e6d8e, BRF_GRA | TAITO_CHARS }, + + { "c11-03.32", 0x080000, 0x46718c7a, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c11-04.31", 0x080000, 0x663f33cc, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c11-01.29", 0x080000, 0xfd1ea532, BRF_SND | TAITO_YM2610A }, + { "c11-02.30", 0x080000, 0x451cc187, BRF_SND | TAITO_YM2610B }, + + { "pal16l8b-b89-01.ic8", 0x000104, 0x4095b97a, BRF_OPT }, + { "pal16l8b-b89-02.ic28", 0x000104, 0x6430b559, BRF_OPT }, + { "pal16l8b-b89-03.bin", 0x000104, 0x634592e2, BRF_OPT }, + { "palce16v8-b89-04.ic27", 0x000117, 0xfc136ae2, BRF_OPT }, + { "pal16l8b-c11-13.ic13", 0x000104, 0x421d7ea8, BRF_OPT }, + { "pal16l8b-c11-14.ic23", 0x000104, 0x5c740aee, BRF_OPT }, +}; + +STD_ROM_PICK(Megablst) +STD_ROM_FN(Megablst) + +static struct BurnRomInfo MegablstjRomDesc[] = { + { "c11-07.55", 0x020000, 0x11d228b6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c11-08.39", 0x020000, 0xa79d4dca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c11-06.54", 0x020000, 0x7c249894, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c11-09.38", 0x020000, 0xc830aad5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c11-12.3", 0x010000, 0xb11094f1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c11-05.58", 0x080000, 0x733e6d8e, BRF_GRA | TAITO_CHARS }, + + { "c11-03.32", 0x080000, 0x46718c7a, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c11-04.31", 0x080000, 0x663f33cc, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c11-01.29", 0x080000, 0xfd1ea532, BRF_SND | TAITO_YM2610A }, + { "c11-02.30", 0x080000, 0x451cc187, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Megablstj) +STD_ROM_FN(Megablstj) + +static struct BurnRomInfo MegablstuRomDesc[] = { + { "c11-07.55", 0x020000, 0x11d228b6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c11-08.39", 0x020000, 0xa79d4dca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c11-06.54", 0x020000, 0x7c249894, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c11-10.38", 0x020000, 0xbf379a43, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c11-12.3", 0x010000, 0xb11094f1, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c11-05.58", 0x080000, 0x733e6d8e, BRF_GRA | TAITO_CHARS }, + + { "c11-03.32", 0x080000, 0x46718c7a, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c11-04.31", 0x080000, 0x663f33cc, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c11-01.29", 0x080000, 0xfd1ea532, BRF_SND | TAITO_YM2610A }, + { "c11-02.30", 0x080000, 0x451cc187, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Megablstu) +STD_ROM_FN(Megablstu) + +static struct BurnRomInfo MetalbRomDesc[] = { + { "d16-16.8", 0x040000, 0x3150be61, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d16-18.7", 0x040000, 0x5216d092, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d12-07.9", 0x020000, 0xe07f5136, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d12-06.6", 0x020000, 0x131df731, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "d12-13.5", 0x020000, 0xbcca2649, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d12-03.14", 0x080000, 0x46b498c0, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "d12-04.13", 0x080000, 0xab66d141, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "d12-01.20", 0x100000, 0xb81523b9, BRF_GRA | TAITO_SPRITESA }, + + { "d12-02.10", 0x100000, 0x79263e74, BRF_SND | TAITO_YM2610A }, + { "d12-05.16", 0x080000, 0x7fd036c5, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Metalb) +STD_ROM_FN(Metalb) + +static struct BurnRomInfo MetalbjRomDesc[] = { + { "d12-12.8", 0x040000, 0x556f82b2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d12-11.7", 0x040000, 0xaf9ee28d, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d12-07.9", 0x020000, 0xe07f5136, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d12-06.6", 0x020000, 0x131df731, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "d12-13.5", 0x020000, 0xbcca2649, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d12-03.14", 0x080000, 0x46b498c0, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "d12-04.13", 0x080000, 0xab66d141, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "d12-01.20", 0x100000, 0xb81523b9, BRF_GRA | TAITO_SPRITESA }, + + { "d12-02.10", 0x100000, 0x79263e74, BRF_SND | TAITO_YM2610A }, + { "d12-05.16", 0x080000, 0x7fd036c5, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Metalbj) +STD_ROM_FN(Metalbj) + +static struct BurnRomInfo MjnquestRomDesc[] = { + { "c77-09", 0x020000, 0x0a005d01, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c77-08", 0x020000, 0x4244f775, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c77-04", 0x080000, 0xc2e7e038, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "c77-10", 0x010000, 0xf16b2c1e, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c77-01", 0x100000, 0x5ba51205, BRF_GRA | TAITO_CHARS }, + { "c77-02", 0x100000, 0x6a6f3040, BRF_GRA | TAITO_CHARS }, + + { "c77-05", 0x080000, 0xc5a54678, BRF_GRA | TAITO_SPRITESA }, + + { "c77-03", 0x080000, 0x312f17b1, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Mjnquest) +STD_ROM_FN(Mjnquest) + +static struct BurnRomInfo MjnquestbRomDesc[] = { + { "c77-09a", 0x020000, 0xfc17f1c2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c77-08", 0x020000, 0x4244f775, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c77-04", 0x080000, 0xc2e7e038, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "c77-10", 0x010000, 0xf16b2c1e, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c77-01", 0x100000, 0x5ba51205, BRF_GRA | TAITO_CHARS }, + { "c77-02", 0x100000, 0x6a6f3040, BRF_GRA | TAITO_CHARS }, + + { "c77-05", 0x080000, 0xc5a54678, BRF_GRA | TAITO_SPRITESA }, + + { "c77-03", 0x080000, 0x312f17b1, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Mjnquestb) +STD_ROM_FN(Mjnquestb) + +static struct BurnRomInfo NinjakRomDesc[] = { + { "c85-10x.ic50", 0x020000, 0xba7e6e74, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c85-13x.ic49", 0x020000, 0x0ac2cba2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c85-07.ic48", 0x020000, 0x3eccfd0a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c85-06.ic47", 0x020000, 0xd126ded1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c85-14.ic54", 0x010000, 0xf2a52a51, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c85-03.ic65", 0x080000, 0x4cc7b9df, BRF_GRA | TAITO_CHARS }, + + { "c85-01.ic19", 0x100000, 0xa711977c, BRF_GRA | TAITO_SPRITESA }, + { "c85-02.ic17", 0x100000, 0xa6ad0f3d, BRF_GRA | TAITO_SPRITESA }, + + { "c85-04.ic31", 0x080000, 0x5afb747e, BRF_SND | TAITO_YM2610A }, + { "c85-05.ic33", 0x080000, 0x3c1b0ed0, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Ninjak) +STD_ROM_FN(Ninjak) + +static struct BurnRomInfo NinjakjRomDesc[] = { + { "c85-10x.ic50", 0x020000, 0xba7e6e74, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c85-11x.ic49", 0x020000, 0xe4ccaa8e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c85-07.ic48", 0x020000, 0x3eccfd0a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c85-06.ic47", 0x020000, 0xd126ded1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c85-14.ic54", 0x010000, 0xf2a52a51, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c85-03.ic65", 0x080000, 0x4cc7b9df, BRF_GRA | TAITO_CHARS }, + + { "c85-01.ic19", 0x100000, 0xa711977c, BRF_GRA | TAITO_SPRITESA }, + { "c85-02.ic17", 0x100000, 0xa6ad0f3d, BRF_GRA | TAITO_SPRITESA }, + + { "c85-04.ic31", 0x080000, 0x5afb747e, BRF_SND | TAITO_YM2610A }, + { "c85-05.ic33", 0x080000, 0x3c1b0ed0, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Ninjakj) +STD_ROM_FN(Ninjakj) + +static struct BurnRomInfo NinjakuRomDesc[] = { + { "c85-15x.ic50", 0x020000, 0x719a481b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c85-12x.ic49", 0x020000, 0x6c3f7e1e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c85-07.ic48", 0x020000, 0x3eccfd0a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c85-06.ic47", 0x020000, 0xd126ded1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c85-14.ic54", 0x010000, 0xf2a52a51, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c85-03.ic65", 0x080000, 0x4cc7b9df, BRF_GRA | TAITO_CHARS }, + + { "c85-01.ic19", 0x100000, 0xa711977c, BRF_GRA | TAITO_SPRITESA }, + { "c85-02.ic17", 0x100000, 0xa6ad0f3d, BRF_GRA | TAITO_SPRITESA }, + + { "c85-04.ic31", 0x080000, 0x5afb747e, BRF_SND | TAITO_YM2610A }, + { "c85-05.ic33", 0x080000, 0x3c1b0ed0, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Ninjaku) +STD_ROM_FN(Ninjaku) + +static struct BurnRomInfo PulirulaRomDesc[] = { + { "c98-12.rom", 0x040000, 0x816d6cde, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c98-16.rom", 0x040000, 0x59df5c77, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c98-06.rom", 0x020000, 0x64a71b45, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c98-07.rom", 0x020000, 0x90195bc0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c98-14.rom", 0x020000, 0xa858e17c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c98-04.rom", 0x100000, 0x0e1fe3b2, BRF_GRA | TAITO_CHARS }, + + { "c98-02.rom", 0x100000, 0x4a2ad2b3, BRF_GRA | TAITO_SPRITESA }, + { "c98-03.rom", 0x100000, 0x589a678f, BRF_GRA | TAITO_SPRITESA }, + + { "c98-01.rom", 0x100000, 0x197f66f5, BRF_SND | TAITO_YM2610A }, + + { "c98-05.rom", 0x080000, 0x9ddd9c39, BRF_GRA | TAITO_CHARS_PIVOT }, +}; + +STD_ROM_PICK(Pulirula) +STD_ROM_FN(Pulirula) + +static struct BurnRomInfo PulirulajRomDesc[] = { + { "c98-12.rom", 0x040000, 0x816d6cde, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c98-13.rom", 0x040000, 0xb7d13d5b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c98-06.rom", 0x020000, 0x64a71b45, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c98-07.rom", 0x020000, 0x90195bc0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c98-14.rom", 0x020000, 0xa858e17c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c98-04.rom", 0x100000, 0x0e1fe3b2, BRF_GRA | TAITO_CHARS }, + + { "c98-02.rom", 0x100000, 0x4a2ad2b3, BRF_GRA | TAITO_SPRITESA }, + { "c98-03.rom", 0x100000, 0x589a678f, BRF_GRA | TAITO_SPRITESA }, + + { "c98-01.rom", 0x100000, 0x197f66f5, BRF_SND | TAITO_YM2610A }, + + { "c98-05.rom", 0x080000, 0x9ddd9c39, BRF_GRA | TAITO_CHARS_PIVOT }, +}; + +STD_ROM_PICK(Pulirulaj) +STD_ROM_FN(Pulirulaj) + +static struct BurnRomInfo QcrayonRomDesc[] = { + { "d55-13", 0x040000, 0x16afbfc7, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d55-14", 0x040000, 0x2fb3057f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d55-03", 0x100000, 0x4d161e76, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "d55-15", 0x010000, 0xba782eff, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d55-02", 0x100000, 0xf3db2f1c, BRF_GRA | TAITO_CHARS }, + + { "d55-05", 0x100000, 0xf0e59902, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "d55-04", 0x100000, 0x412975ce, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "d55-01", 0x100000, 0xa8309af4, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Qcrayon) +STD_ROM_FN(Qcrayon) + +static struct BurnRomInfo Qcrayon2RomDesc[] = { + { "d63-12", 0x040000, 0x0f445a38, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d63-13", 0x040000, 0x74455752, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d63-01", 0x080000, 0x872e38b4, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "d63-11", 0x010000, 0x2c7ac9e5, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d63-03", 0x100000, 0xd24843af, BRF_GRA | TAITO_CHARS }, + + { "d63-06", 0x200000, 0x58b1e4a8, BRF_GRA | TAITO_SPRITESA }, + + { "d63-02", 0x100000, 0x162ae165, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Qcrayon2) +STD_ROM_FN(Qcrayon2) + +static struct BurnRomInfo QjinseiRomDesc[] = { + { "d48-09", 0x040000, 0xa573b68d, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d48-10", 0x040000, 0x37143a5b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d48-03", 0x100000, 0xfb5ea8dc, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "d48-11", 0x010000, 0x656c5b54, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d48-04", 0x100000, 0x61e4b078, BRF_GRA | TAITO_CHARS }, + + { "d48-02", 0x100000, 0xa7b68e63, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "d48-01", 0x100000, 0x72a94b73, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "d48-05", 0x080000, 0x3fefd058, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Qjinsei) +STD_ROM_FN(Qjinsei) + +static struct BurnRomInfo QtorimonRomDesc[] = { + { "c41-04.bin", 0x020000, 0x0fbf5223, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c41-05.bin", 0x020000, 0x174bd5db, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "mask-51.bin", 0x020000, 0x12e14aca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "mask-52.bin", 0x020000, 0xb3ef66f3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c41-06.bin", 0x010000, 0x753a98d8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c41-02.bin", 0x020000, 0x05dcd36d, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c41-01.bin", 0x020000, 0x39ff043c, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c41-03.bin", 0x020000, 0xb2c18e89, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Qtorimon) +STD_ROM_FN(Qtorimon) + +static struct BurnRomInfo QuizhqRomDesc[] = { + { "c53-05.bin", 0x020000, 0xc798fc20, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c53-01.bin", 0x020000, 0xbf44c93e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c53-52.bin", 0x020000, 0x12e14aca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c53-51.bin", 0x020000, 0xb3ef66f3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c53-08.bin", 0x010000, 0x25187e81, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c53-03.bin", 0x020000, 0x47596e70, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c53-07.bin", 0x020000, 0x4f9fa82f, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c53-02.bin", 0x020000, 0xd704c6f4, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c53-06.bin", 0x020000, 0xf77f63fc, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c53-04.bin", 0x020000, 0x99890ad4, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Quizhq) +STD_ROM_FN(Quizhq) + +static struct BurnRomInfo QzchikyuRomDesc[] = { + { "d19-06.8", 0x020000, 0xde8c8e55, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d19-05.7", 0x020000, 0xc6d099d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d19-03.6", 0x080000, 0x5c1b92c0, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "d19-07.5", 0x010000, 0xa8935f84, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d19-02.10", 0x100000, 0xf2dce2f2, BRF_GRA | TAITO_CHARS }, + + { "d19-01.21", 0x100000, 0x6c4342d0, BRF_GRA | TAITO_SPRITESA }, + + { "d19-04.9", 0x080000, 0xd3c44905, BRF_SND | TAITO_YM2610A }, + + { "pal16l8b-d19-08.bin",0x000104, 0xc6240d10, BRF_OPT }, + { "pal16l8b-d19-09.bin",0x000104, 0x576f5db9, BRF_OPT }, + { "pal16l8b-d19-10.bin",0x000104, 0xea1232a5, BRF_OPT }, +}; + +STD_ROM_PICK(Qzchikyu) +STD_ROM_FN(Qzchikyu) + +static struct BurnRomInfo QzquestRomDesc[] = { + { "c92-06.8", 0x020000, 0x424be722, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c92-05.7", 0x020000, 0xda470f93, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c92-03.6", 0x080000, 0x1d697606, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "c92-07.5", 0x010000, 0x3e313db9, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c92-02.10", 0x100000, 0x2daccecf, BRF_GRA | TAITO_CHARS }, + + { "c92-01.21", 0x100000, 0x9976a285, BRF_GRA | TAITO_SPRITESA }, + + { "c92-04.9", 0x080000, 0xe421bb43, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Qzquest) +STD_ROM_FN(Qzquest) + +static struct BurnRomInfo SsiRomDesc[] = { + { "c64_15-1.ic9", 0x040000, 0xce9308a6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c64_16-1.ic8", 0x040000, 0x470a483a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c64-09.13", 0x010000, 0x88d7f65c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c64-01.1", 0x100000, 0xa1b4f486, BRF_GRA | TAITO_SPRITESA }, + + { "c64-02.2", 0x020000, 0x3cb0b907, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Ssi) +STD_ROM_FN(Ssi) + +static struct BurnRomInfo Majest12RomDesc[] = { + { "c64-07.10", 0x020000, 0xf29ed5c9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c64-08.11", 0x020000, 0xddfd33d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c64-06.4", 0x020000, 0x18dc71ac, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c64-05.5", 0x020000, 0xb61866c0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c64-09.13", 0x010000, 0x88d7f65c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c64-01.1", 0x100000, 0xa1b4f486, BRF_GRA | TAITO_SPRITESA }, + + { "c64-02.2", 0x020000, 0x3cb0b907, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Majest12) +STD_ROM_FN(Majest12) + +static struct BurnRomInfo SolfigtrRomDesc[] = { + { "c91-05.59", 0x040000, 0xc1260e7c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c91-09.61", 0x040000, 0xd82b5266, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c91-07.62", 0x010000, 0xe471a05a, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c91-03.34", 0x100000, 0x8965da12, BRF_GRA | TAITO_CHARS }, + + { "c91-01.12", 0x100000, 0x0f3f4e00, BRF_GRA | TAITO_SPRITESA }, + { "c91-02.11", 0x100000, 0xe14ab98e, BRF_GRA | TAITO_SPRITESA }, + + { "c91-04.28", 0x080000, 0x390b1065, BRF_SND | TAITO_YM2610A }, + + { "pal16l8b-c74-06.ic48",0x000104, 0xc868dc16, BRF_OPT }, +}; + +STD_ROM_PICK(Solfigtr) +STD_ROM_FN(Solfigtr) + +static struct BurnRomInfo ThundfoxRomDesc[] = { + { "c28-13-1.51", 0x020000, 0xacb07013, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c28-16-1.40", 0x020000, 0x1e43d55b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c28-08.50", 0x020000, 0x38e038f1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c28-07.39", 0x020000, 0x24419abb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c28-14.3", 0x010000, 0x45ef3616, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c28-02.61", 0x080000, 0x6230a09d, BRF_GRA | TAITO_CHARS }, + + { "c28-01.63", 0x080000, 0x44552b25, BRF_GRA | TAITO_CHARSB }, + + { "c28-03.29", 0x080000, 0x51bdc7af, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c28-04.28", 0x080000, 0xba7ed535, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c28-06.41", 0x080000, 0xdb6983db, BRF_SND | TAITO_YM2610A }, + { "c28-05.42", 0x080000, 0xd3b238fa, BRF_SND | TAITO_YM2610B }, + + { "pal16l8b-b89-01.ic19",0x000104, 0x4095b97a, BRF_OPT }, + { "pal16l8b-b89-03.ic37",0x000104, 0x634592e2, BRF_OPT }, + { "pal16v8b-b89-04.ic33",0x000117, 0xfc136ae2, BRF_OPT }, + { "pal16l8b-c28-09.ic25",0x000104, 0x383e7305, BRF_OPT }, + { "pal16l8b-c28-10.ic26",0x000104, 0x47fccc07, BRF_OPT }, + { "pal16l8b-c28-11.ic35",0x000104, 0x33414fe8, BRF_OPT }, +}; + +STD_ROM_PICK(Thundfox) +STD_ROM_FN(Thundfox) + +static struct BurnRomInfo ThundfoxjRomDesc[] = { + { "c28-13-1.51", 0x020000, 0xacb07013, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c28-12-1.40", 0x020000, 0xf04db477, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c28-08.50", 0x020000, 0x38e038f1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c28-07.39", 0x020000, 0x24419abb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c28-14.3", 0x010000, 0x45ef3616, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c28-02.61", 0x080000, 0x6230a09d, BRF_GRA | TAITO_CHARS }, + + { "c28-01.63", 0x080000, 0x44552b25, BRF_GRA | TAITO_CHARSB }, + + { "c28-03.29", 0x080000, 0x51bdc7af, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c28-04.28", 0x080000, 0xba7ed535, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c28-06.41", 0x080000, 0xdb6983db, BRF_SND | TAITO_YM2610A }, + { "c28-05.42", 0x080000, 0xd3b238fa, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Thundfoxj) +STD_ROM_FN(Thundfoxj) + +static struct BurnRomInfo ThundfoxuRomDesc[] = { + { "c28-13-1.51", 0x020000, 0xacb07013, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c28-15-1.40", 0x020000, 0x874a84e1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c28-08.50", 0x020000, 0x38e038f1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c28-07.39", 0x020000, 0x24419abb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c28-14.3", 0x010000, 0x45ef3616, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c28-02.61", 0x080000, 0x6230a09d, BRF_GRA | TAITO_CHARS }, + + { "c28-01.63", 0x080000, 0x44552b25, BRF_GRA | TAITO_CHARSB }, + + { "c28-03.29", 0x080000, 0x51bdc7af, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c28-04.28", 0x080000, 0xba7ed535, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c28-06.41", 0x080000, 0xdb6983db, BRF_SND | TAITO_YM2610A }, + { "c28-05.42", 0x080000, 0xd3b238fa, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Thundfoxu) +STD_ROM_FN(Thundfoxu) + +static struct BurnRomInfo YesnojRomDesc[] = { + { "d20-05-2.2", 0x040000, 0x68adb929, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d20-04-2.4", 0x040000, 0xa84762f8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "d20-06.5", 0x010000, 0x3eb537dc, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "d20-01.11", 0x080000, 0x9d8a4d57, BRF_GRA | TAITO_CHARS }, + + { "d20-02.12", 0x080000, 0xe71a8e40, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "d20-03.13", 0x080000, 0x6a51a1b4, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, +}; + +STD_ROM_PICK(Yesnoj) +STD_ROM_FN(Yesnoj) + +static struct BurnRomInfo YuyugogoRomDesc[] = { + { "c83-10.3", 0x020000, 0x4d185d03, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c83-09.2", 0x020000, 0xf9892792, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c83-03.10", 0x100000, 0xeed9acc2, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "c83-11.1", 0x010000, 0x461e702a, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c83-05.21", 0x020000, 0xeca57fb1, BRF_GRA | TAITO_CHARS }, + + { "c83-01.12", 0x100000, 0x8bf0d416, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c83-02.11", 0x100000, 0x20bb1c15, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c83-04.5", 0x100000, 0x2600093a, BRF_SND | TAITO_YM2610A }, +}; + +STD_ROM_PICK(Yuyugogo) +STD_ROM_FN(Yuyugogo) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += Taito68KRom1Size; + TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; + TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; + TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; + if (TaitoNumMSM6295) MSM6295ROM = Next; Next += 0x40000; + TaitoMSM6295Rom = Next; Next += TaitoMSM6295RomSize; + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x020000; + TaitoZ80Ram1 = Next; Next += 0x002000; + TaitoSpriteRam = Next; Next += 0x010000; + TaitoSpriteRamBuffered = Next; Next += 0x010000; + TaitoSpriteRamDelayed = Next; Next += 0x010000; + TaitoSpriteExtension = Next; Next += 0x004000; + TaitoPaletteRam = Next; Next += 0x004000; + + TaitoRamEnd = Next; + + TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; + if (TaitoNumCharB) TaitoCharsB = Next; Next += TaitoNumCharB * TaitoCharBWidth * TaitoCharBHeight; + TaitoCharsPivot = Next; Next += TaitoNumCharPivot * TaitoCharPivotWidth * TaitoCharPivotHeight; + TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; + TaitoPalette = (UINT32*)Next; Next += 0x02000 * sizeof(UINT32); + TaitoPriorityMap = Next; Next += nScreenWidth * nScreenHeight; + TaitoF2SpriteList = (TaitoF2SpriteEntry*)Next; Next += 0x400 * sizeof(TaitoF2SpriteEntry); + + TaitoMemEnd = Next; + + return 0; +} + +static INT32 TaitoF2DoReset() +{ + TaitoDoReset(); + + YesnoDip = 0; + MjnquestInput = 0; + DriveoutSoundNibble = 0; + DriveoutOkiBank = 0; + + TaitoF2SpritesFlipScreen = 0; + TaitoF2SpriteBlendMode = 0; + TaitoF2TilePriority[0] = TaitoF2TilePriority[1] = TaitoF2TilePriority[2] = TaitoF2TilePriority[3] = TaitoF2TilePriority[4] = 0; + TaitoF2SpritePriority[0] = TaitoF2SpritePriority[1] = TaitoF2SpritePriority[2] = TaitoF2SpritePriority[3] = 0; + + return 0; +} + +static void TaitoF2SpriteBankWrite(INT32 Offset, UINT16 Data) +{ + INT32 i, j; + + if (Offset < 2) return; + if (Offset < 4) { + j = (Offset & 1) << 1; + i = Data << 11; + TaitoF2SpriteBankBuffered[j + 0] = i; + TaitoF2SpriteBankBuffered[j + 1] = i + 0x400; + } else { + i = Data << 10; + TaitoF2SpriteBankBuffered[Offset] = i; + } +} + +UINT8 __fastcall Cameltry68KReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x300000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Cameltry68KWriteByte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x300000) + TC0100SCN0ByteWrite_Map(0x800000, 0x813fff) + + switch (a) { + case 0x320000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x320002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Cameltry68KReadWord(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x300000) + + switch (a) { + case 0x300018: { + INT32 Temp = TaitoAnalogPort0 >> 6; + if (Temp >= 0x14 && Temp < 0x80) Temp = 0x14; + if (Temp <= 0x3ec && Temp > 0x80) Temp = 0x3ec; + return Temp; + } + + case 0x30001c: { + INT32 Temp = TaitoAnalogPort1 >> 6; + if (Temp >= 0x14 && Temp < 0x80) Temp = 0x14; + if (Temp <= 0x3ec && Temp > 0x80) Temp = 0x3ec; + return Temp; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Cameltry68KWriteWord(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x300000) + TC0100SCN0WordWrite_Map(0x800000, 0x813fff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + TC0280GRDCtrlWordWrite_Map(0xa02000) + TC0360PRIHalfWordWrite_Map(0xd00000) + + if (a >= 0x814000 && a <= 0x814fff) return; //??? + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Deadconx68KReadByte(UINT32 a) +{ + switch (a) { + case 0x700001: { + return TaitoDip[0]; + } + + case 0x700003: { + return TaitoDip[1]; + } + + case 0x700005: { + return TaitoInput[2]; + } + + case 0x700007: { + return 0xff; + } + + case 0x70000b: { + return TaitoInput[0]; + } + + case 0x70000d: { + return TaitoInput[1]; + } + + case 0x70000f: { + return 0xff; + } + + case 0x700011: { + return 0xff; + } + + case 0xa00002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Deadconx68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x700007: { + // coin write + return; + } + + case 0xa00000: { + TC0140SYTPortWrite(d); + return; + } + + case 0xa00002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Deadconx68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Deadconx68KWriteWord(UINT32 a, UINT16 d) +{ + TC0480SCPCtrlWordWrite_Map(0x430000) + TC0360PRIHalfWordWrite_Map(0x500000) + + switch (a) { + case 0x300000: + case 0x300002: + case 0x300004: + case 0x300006: + case 0x300008: + case 0x30000a: + case 0x30000c: + case 0x30000e: { + TaitoF2SpriteBankWrite((a - 0x300000) >> 1, d); + return; + } + + case 0x700006: { + // coin write + return; + } + + case 0x700008: + case 0x700012: + case 0x700014: + case 0x700016: + case 0x700018: { + // ??? + return; + } + + case 0x800000: { + // watchdog + return; + } + + case 0x900000: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Dinorex68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0x300000) + + switch (a) { + case 0xa00002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Dinorex68KWriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordWrite_Map(0x300000) + TC0100SCN0ByteWrite_Map(0x900000, 0x90ffff) + + switch (a) { + case 0xa00000: { + TC0140SYTPortWrite(d); + return; + } + + case 0xa00002: { + TC0140SYTCommWrite(d); + return; + } + + case 0xb00000: { + // nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Dinorex68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Dinorex68KWriteWord(UINT32 a, UINT16 d) +{ + TC0510NIOHalfWordWrite_Map(0x300000) + TC0360PRIHalfWordWrite_Map(0x700000) + TC0100SCN0WordWrite_Map(0x900000, 0x90ffff) + TC0100SCN0CtrlWordWrite_Map(0x920000) + + switch (a) { + case 0xb00000: { + // nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Dondokod68KReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x300000) + + switch (a) { + case 0x320002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Dondokod68KWriteByte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x300000) + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + + switch (a) { + case 0x320000: + case 0x320001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x320002: + case 0x320003: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Dondokod68KReadWord(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x300000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Dondokod68KWriteWord(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x300000) + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + TC0280GRDCtrlWordWrite_Map(0xa02000) + TC0360PRIHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0x360000: { + //??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Driftout68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0xb00000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Driftout68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + TC0510NIOHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0x200000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x200002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Driftout68KReadWord(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0xb00000) + + switch (a) { + case 0x200000: { + return 0; + } + + case 0xb00018: + case 0xb0001a: { + //driftout_paddle_r + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Driftout68KWriteWord(UINT32 a, UINT16 d) +{ + TC0430GRWCtrlWordWrite_Map(0x402000) + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + TC0360PRIHalfWordSwapWrite_Map(0xa00000) + TC0510NIOHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0xa00000: { + //??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +void __fastcall Driveout68KWriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0x200000: { + DriveoutSoundNibble = d & 1; + return; + } + + case 0x200002: { + if (!DriveoutSoundNibble) { + TaitoSoundLatch = (d & 0x0f) | (TaitoSoundLatch & 0xf0); + } else { + TaitoSoundLatch = ((d << 4) & 0xf0) | (TaitoSoundLatch & 0x0f); + ZetOpen(0); + ZetRaiseIrq(0); + ZetClose(); + } + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall Finalb68KReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x300000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Finalb68KWriteByte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x300000) + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + + switch (a) { + case 0x320001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x320003: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Finalb68KReadWord(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x300000) + + switch (a) { + case 0x200002: { + return TC0110PCRWordRead(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Finalb68KWriteWord(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x300000) + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + + if (a >= 0x810000 && a <= 0x81ffff) return; // NOP + + switch (a) { + case 0x200000: + case 0x200002: { + TC0110PCRWordWrite(0, (a - 0x200000) >> 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Footchmp68KReadByte(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Footchmp68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0xa00001: { + TC0140SYTPortWrite(d); + return; + } + + case 0xa00003: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Footchmp68KReadWord(UINT32 a) +{ + switch (a) { + case 0x700000: { + return TaitoDip[0]; + } + + case 0x700002: { + return TaitoDip[1]; + } + + case 0x700004: { + return TaitoInput[2]; + } + + case 0x70000a: { + return TaitoInput[0]; + } + + case 0x70000c: { + return TaitoInput[1]; + } + + case 0x70000e: { + return TaitoInput[3]; + } + + case 0x700010: { + return TaitoInput[4]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0xffff; +} + +void __fastcall Footchmp68KWriteWord(UINT32 a, UINT16 d) +{ + TC0480SCPCtrlWordWrite_Map(0x430000) + TC0360PRIHalfWordWrite_Map(0x500000) + + switch (a) { + case 0x300000: + case 0x300002: + case 0x300004: + case 0x300006: + case 0x300008: + case 0x30000a: + case 0x30000c: + case 0x30000e: { + TaitoF2SpriteBankWrite((a - 0x300000) >> 1, d); + return; + } + + case 0x700006: + case 0x700008: + case 0x700012: + case 0x700014: + case 0x700016: + case 0x700018: { + return; + } + + case 0x800000: { + // watchdog + return; + } + + case 0x900000: { + // ???? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Growl68KReadByte(UINT32 a) +{ + switch (a) { + case 0x320001: { + return TaitoInput[0]; + } + + case 0x320003: { + return TaitoInput[1]; + } + + case 0x400002: { + return TC0140SYTCommRead(); + } + + case 0x508000: { + return TaitoInput[4]; + } + + case 0x508001: { + return TaitoInput[3]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Growl68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + + switch (a) { + case 0x400000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x400002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Growl68KReadWord(UINT32 a) +{ + switch (a) { + case 0x300000: { + return TaitoDip[0]; + } + + case 0x300002: { + return TaitoDip[1]; + } + + case 0x320000: { + return TaitoInput[0]; + } + + case 0x320004: { + return TaitoInput[2]; + } + + case 0x50c000: { + return TaitoInput[5]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Growl68KWriteWord(UINT32 a, UINT16 d) +{ + TC0360PRIHalfWordWrite_Map(0xb00000) + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + + switch (a) { + case 0x300004: { + // coin write + return; + } + + case 0x340000: { + // watchdog + return; + } + + case 0x500000: + case 0x500002: + case 0x500004: + case 0x500006: + case 0x500008: + case 0x50000a: + case 0x50000c: + case 0x50000e: { + TaitoF2SpriteBankWrite((a - 0x500000) >> 1, d); + return; + } + + case 0x504000: { + // nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Gunfront68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordSwapRead_Map(0x300000) + + switch (a) { + case 0x320002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Gunfront68KWriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordSwapWrite_Map(0x300000) + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + + switch (a) { + case 0x320000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x320002: { + TC0140SYTCommWrite(d); + return; + } + + case 0xa00000: { + // nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Gunfront68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Gunfront68KWriteWord(UINT32 a, UINT16 d) +{ + TC0510NIOHalfWordSwapWrite_Map(0x300000) + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + TC0360PRIHalfWordWrite_Map(0xb00000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Koshien68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0x300000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Koshien68KWriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordWrite_Map(0x300000) + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + TC0360PRIHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0x320000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x320002: { + TC0140SYTCommWrite(d); + return; + } + + case 0x340000: { + //??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Koshien68KReadWord(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0x300000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Koshien68KWriteWord(UINT32 a, UINT16 d) +{ + TC0510NIOHalfWordWrite_Map(0x300000) + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + TC0360PRIHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0xa20000: { + TaitoF2SpriteBankBuffered[0] = 0x0000; + TaitoF2SpriteBankBuffered[1] = 0x0400; + TaitoF2SpriteBankBuffered[2] = ((d & 0x00f) + 1) * 0x800; + TaitoF2SpriteBankBuffered[4] = (((d & 0x0f0) >> 4) + 1) * 0x800; + TaitoF2SpriteBankBuffered[6] = (((d & 0xf00) >> 8) + 1) * 0x800; + TaitoF2SpriteBankBuffered[3] = TaitoF2SpriteBankBuffered[2] + 0x400; + TaitoF2SpriteBankBuffered[5] = TaitoF2SpriteBankBuffered[4] + 0x400; + TaitoF2SpriteBankBuffered[7] = TaitoF2SpriteBankBuffered[6] + 0x400; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Liquidk68KReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x300000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Liquidk68KWriteByte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x300000) + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + + switch (a) { + case 0x320001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x320003: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Liquidk68KReadWord(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x300000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Liquidk68KWriteWord(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x300000) + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + TC0360PRIHalfWordWrite_Map(0xb00000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Megablst68KReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x120000) + + if (a >= 0x180000 && a <= 0x180fff) { + return MegabCChipRead((a - 0x180000) >> 1); + } + + switch (a) { + case 0x100002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Megablst68KWriteByte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x120000) + TC0360PRIHalfWordWrite_Map(0x400000) + TC0100SCN0ByteWrite_Map(0x600000, 0x60ffff) + + if (a >= 0x180000 && a <= 0x180fff) { + MegabCChipWrite((a - 0x180000) >> 1, d); + return; + } + + switch (a) { + case 0x100000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x100002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Megablst68KReadWord(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x120000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Megablst68KWriteWord(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x120000) + TC0360PRIHalfWordWrite_Map(0x400000) + TC0100SCN0WordWrite_Map(0x600000, 0x60ffff) + TC0100SCN0CtrlWordWrite_Map(0x620000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Metalb68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordSwapRead_Map(0x800000) + + switch (a) { + case 0x900002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Metalb68KWriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordSwapWrite_Map(0x800000) + + switch (a) { + case 0x900000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x900002: { + TC0140SYTCommWrite(d); + return; + } + + case 0xa00000: { + //??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Metalb68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Metalb68KWriteWord(UINT32 a, UINT16 d) +{ + TC0480SCPCtrlWordWrite_Map(0x530000) + TC0360PRIHalfWordWrite_Map(0x600000) + TC0510NIOHalfWordSwapWrite_Map(0x800000) + + switch (a) { + case 0x42000c: + case 0x42000e: { + //??? + return; + } + + case 0xa00000: { + //??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Mjnquest68KReadByte(UINT32 a) +{ + switch (a) { + case 0x300000: { + return TaitoInput[4]; + } + + case 0x300001: { + return TaitoDip[0]; + } + + case 0x300002: { + return TaitoInput[5]; + } + + case 0x300003: { + return TaitoDip[1]; + } + + case 0x360002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Mjnquest68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x400000, 0x40ffff) + + switch (a) { + case 0x330000: + case 0x330001: { + //nop + return; + } + + case 0x360000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x360002: { + TC0140SYTCommWrite(d); + return; + } + + case 0x360005: { + //??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Mjnquest68KReadWord(UINT32 a) +{ + switch (a) { + case 0x310000: { + switch (MjnquestInput) { + case 0x01: return TaitoInput[0]; + case 0x02: return TaitoInput[1]; + case 0x04: return TaitoInput[2]; + case 0x08: return TaitoInput[3]; + case 0x10: return 0xff; + } + return 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Mjnquest68KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x400000, 0x40ffff) + TC0100SCN0CtrlWordWrite_Map(0x420000) + + switch (a) { + case 0x200000: + case 0x200002: { + TC0110PCRWordWrite(0, (a - 0x200000) >> 1, d); + return; + } + + case 0x200004: { + //nop + return; + } + + case 0x300000: { + //??? + return; + } + + case 0x320000: { + MjnquestInput = d >> 6; + return; + } + + case 0x350000: { + //nop + return; + } + + case 0x380000: { + TC0100SCNSetGfxBank(0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Ninjak68KReadByte(UINT32 a) +{ + switch (a) { + case 0x300000: { + return TaitoDip[0]; + } + + case 0x300002: { + return TaitoDip[1]; + } + + case 0x300004: { + return TaitoInput[0]; + } + + case 0x300006: { + return TaitoInput[1]; + } + + case 0x300008: { + return TaitoInput[3]; + } + + case 0x30000a: { + return TaitoInput[4]; + } + + case 0x30000c: { + return TaitoInput[2]; + } + + case 0x400002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ninjak68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + + switch (a) { + case 0x30000e: { + //coin write + return; + } + + case 0x300010: { + //??? + return; + } + + case 0x400000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x400002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Ninjak68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ninjak68KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + TC0360PRIHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0x300000: + case 0x300012: + case 0x300014: + case 0x300016: + case 0x300018: { + //??? + return; + } + + case 0x380000: { + //watchdog + return; + } + + case 0x600000: + case 0x600002: + case 0x600004: + case 0x600006: + case 0x600008: + case 0x60000a: + case 0x60000c: + case 0x60000e: { + TaitoF2SpriteBankWrite((a - 0x600000) >> 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Pulirula68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0xb00000) + + switch (a) { + case 0x200002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Pulirula68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + TC0510NIOHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0x200000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x200002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Pulirula68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Pulirula68KWriteWord(UINT32 a, UINT16 d) +{ + TC0430GRWCtrlWordWrite_Map(0x402000) + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + TC0360PRIHalfWordSwapWrite_Map(0xa00000) + TC0510NIOHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0x500000: { + //??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Qcrayon68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0xa00000) + + switch (a) { + case 0x500002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qcrayon68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x900000, 0x90ffff) + TC0510NIOHalfWordWrite_Map(0xa00000) + + switch (a) { + case 0x200000: { + //??? + return; + } + + case 0x500000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x500002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Qcrayon68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qcrayon68KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x900000, 0x90ffff) + TC0100SCN0CtrlWordWrite_Map(0x920000) + TC0510NIOHalfWordWrite_Map(0xa00000) + TC0360PRIHalfWordWrite_Map(0xb00000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Qcrayon268KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0x700000) + + switch (a) { + case 0xa00002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qcrayon268KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x500000, 0x50ffff) + TC0510NIOHalfWordWrite_Map(0x700000) + + switch (a) { + case 0x800000: { + //??? + return; + } + + case 0xa00000: { + TC0140SYTPortWrite(d); + return; + } + + case 0xa00002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Qcrayon268KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qcrayon268KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x500000, 0x50ffff) + TC0100SCN0CtrlWordWrite_Map(0x520000) + TC0510NIOHalfWordWrite_Map(0x700000) + TC0360PRIHalfWordWrite_Map(0x900000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Qjinsei68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0xb00000) + + switch (a) { + case 0x200002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qjinsei68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + TC0510NIOHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0x200000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x200002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Qjinsei68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qjinsei68KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + TC0360PRIHalfWordWrite_Map(0xa00000) + TC0510NIOHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0x500000: { + //nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Qtorimon68KReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x500000) + + switch (a) { + case 0x600002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qtorimon68KWriteByte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x500000) + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + + switch (a) { + case 0x600000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x600002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Qtorimon68KReadWord(UINT32 a) +{ + switch (a) { + case 0x200002: { + return TC0110PCRWordRead(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qtorimon68KWriteWord(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x500000) + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + + if (a >= 0x810000 && a <= 0x81ffff) return; // NOP + + switch (a) { + case 0x200000: + case 0x200002: { + TC0110PCRWordWrite(0, (a - 0x200000) >> 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Quizhq68KReadByte(UINT32 a) +{ + switch (a) { + case 0x500001: { + return TaitoDip[1]; + } + + case 0x500003: { + return TaitoInput[0]; + } + + case 0x580001: { + return TaitoDip[0]; + } + + case 0x580003: { + return TaitoInput[1]; + } + + case 0x580005: { + return TaitoInput[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Quizhq68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + + switch (a) { + case 0x500005: { + //coin write + return; + } + + case 0x500007: { + //??? + return; + } + + case 0x580007: { + //nop + return; + } + + case 0x600001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x600003: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Quizhq68KReadWord(UINT32 a) +{ + switch (a) { + case 0x500000: { + return TaitoDip[1]; + } + + case 0x500002: { + return TaitoInput[0]; + } + + case 0x580000: { + return TaitoDip[0]; + } + + case 0x580002: { + return TaitoInput[1]; + } + + case 0x580004: { + return TaitoInput[2]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Quizhq68KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + + if (a >= 0x810000 && a <= 0x81ffff) return; // NOP + + switch (a) { + case 0x200000: + case 0x200002: { + TC0110PCRWordWrite(0, (a - 0x200000) >> 1, d); + return; + } + + case 0x680000: { + //nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Qzchikyu68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0x200000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qzchikyu68KWriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordWrite_Map(0x200000) + TC0100SCN0ByteWrite_Map(0x700000, 0x70ffff) + + switch (a) { + case 0x300001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x300003: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Qzchikyu68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qzchikyu68KWriteWord(UINT32 a, UINT16 d) +{ + TC0510NIOHalfWordWrite_Map(0x200000) + TC0100SCN0WordWrite_Map(0x700000, 0x70ffff) + TC0100SCN0CtrlWordWrite_Map(0x720000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Qzquest68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0x200000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qzquest68KWriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordWrite_Map(0x200000) + TC0100SCN0ByteWrite_Map(0x700000, 0x70ffff) + + switch (a) { + case 0x300001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x300003: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Qzquest68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Qzquest68KWriteWord(UINT32 a, UINT16 d) +{ + TC0510NIOHalfWordWrite_Map(0x200000) + TC0100SCN0WordWrite_Map(0x700000, 0x70ffff) + TC0100SCN0CtrlWordWrite_Map(0x720000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Solfigtr68KReadByte(UINT32 a) +{ + switch (a) { + case 0x300001: { + return TaitoDip[0]; + } + + case 0x300003: { + return TaitoDip[1]; + } + + case 0x320001: { + return TaitoInput[0]; + } + + case 0x320003: { + return TaitoInput[1]; + } + + case 0x320005: { + return TaitoInput[2]; + } + + case 0x400002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Solfigtr68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + + switch (a) { + case 0x300005: { + //coin write + return; + } + + case 0x400000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x400002: { + TC0140SYTCommWrite(d); + return; + } + + case 0x504000: { + //nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Solfigtr68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Solfigtr68KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + TC0360PRIHalfWordWrite_Map(0xb00000) + + switch (a) { + case 0x300006: { + //??? + return; + } + + case 0x320006: { + //??? + return; + } + + case 0x340000: { + //watchdog + return; + } + + case 0x500000: + case 0x500002: + case 0x500004: + case 0x500006: + case 0x500008: + case 0x50000a: + case 0x50000c: + case 0x50000e: { + TaitoF2SpriteBankWrite((a - 0x500000) >> 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Ssi68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0x100000) + + switch (a) { + case 0x400002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ssi68KWriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordWrite_Map(0x100000) + TC0100SCN0ByteWrite_Map(0x600000, 0x60ffff) + + switch (a) { + case 0x400000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x400002: { + TC0140SYTCommWrite(d); + return; + } + + case 0x500000: { + // nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Ssi68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Ssi68KWriteWord(UINT32 a, UINT16 d) +{ + TC0510NIOHalfWordWrite_Map(0x100000) + TC0100SCN0ByteWrite_Map(0x600000, 0x60ffff) + TC0100SCN0CtrlWordWrite_Map(0x620000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Thundfox68KReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x200000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Thundfox68KWriteByte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x200000) + TC0100SCN0ByteWrite_Map(0x400000, 0x40ffff) + TC0360PRIHalfWordWrite_Map(0x800000) + + switch (a) { + case 0x220000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x220002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Thundfox68KReadWord(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x200000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Thundfox68KWriteWord(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x200000) + TC0100SCN0WordWrite_Map(0x400000, 0x40ffff) + TC0100SCN0CtrlWordWrite_Map(0x420000) + TC0100SCN1WordWrite_Map(0x500000, 0x50ffff) + TC0100SCN1CtrlWordWrite_Map(0x520000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Yesnoj68KReadByte(UINT32 a) +{ + if (a >= 0x700000 && a <= 0x70001f) return 0; + + switch (a) { + case 0x800002: { + return TC0140SYTCommRead(); + } + + case 0xa00001: { + return TaitoInput[0]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Yesnoj68KWriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x500000, 0x50ffff) + + switch (a) { + case 0x700015: + case 0x70001b: + case 0x70001d: + case 0x70001f: { + //??? + return; + } + + case 0x800000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x800002: { + TC0140SYTCommWrite(d); + return; + } + + case 0x900003: { + //nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Yesnoj68KReadWord(UINT32 a) +{ + switch (a) { + case 0xa00004: { + return TaitoInput[1]; + } + + case 0xb00000: { + YesnoDip = 1 - YesnoDip; + + if (YesnoDip) { + return TaitoDip[0]; + } else { + return TaitoDip[1]; + } + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Yesnoj68KWriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x500000, 0x50ffff) + TC0100SCN0CtrlWordWrite_Map(0x520000) + + switch (a) { + case 0x900002: + case 0x900006: + case 0xa00006: + case 0xc00000: + case 0xd00000: { + //nop + return; + } + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Yuyugogo68KReadByte(UINT32 a) +{ + TC0510NIOHalfWordRead_Map(0x200000) + + switch (a) { + case 0x400002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Yuyugogo68KWriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordWrite_Map(0x200000) + TC0100SCN0ByteWrite_Map(0x800000, 0x80ffff) + + switch (a) { + case 0x400000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x400002: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Yuyugogo68KReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Yuyugogo68KWriteWord(UINT32 a, UINT16 d) +{ + TC0510NIOHalfWordWrite_Map(0x200000) + TC0100SCN0WordWrite_Map(0x800000, 0x80ffff) + TC0100SCN0CtrlWordWrite_Map(0x820000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall TaitoF2Z80Read(UINT16 a) +{ + switch (a) { + case 0xe000: { + return BurnYM2610Read(0); + } + + case 0xe002: { + return BurnYM2610Read(2); + } + + case 0xe200: { + // NOP + return 0; + } + + case 0xe201: { + return TC0140SYTSlaveCommRead(); + } + + case 0xea00: { + // NOP + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall TaitoF2Z80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe000: { + BurnYM2610Write(0, d); + return; + } + + case 0xe001: { + BurnYM2610Write(1, d); + return; + } + + case 0xe002: { + BurnYM2610Write(2, d); + return; + } + + case 0xe003: { + BurnYM2610Write(3, d); + return; + } + + case 0xe200: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xe201: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xe400: + case 0xe401: + case 0xe402: + case 0xe403: { + return; + } + + case 0xe600: { + return; + } + + case 0xee00: { + return; + } + + case 0xf000: { + return; + } + + case 0xf200: { + TaitoZ80Bank = (d - 1) & 7; + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall CamltryaZ80Read(UINT16 a) +{ + switch (a) { + case 0x9000: { + return BurnYM2203Read(0, 0); + } + + case 0xa001: { + return TC0140SYTSlaveCommRead(); + } + + case 0xb000: { + return MSM6295ReadStatus(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall CamltryaZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x9000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0x9001: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0xa000: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xa001: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xb000: + case 0xb001: { + MSM6295Command(0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall DriveoutZ80Read(UINT16 a) +{ + switch (a) { + case 0x9800: { + return MSM6295ReadStatus(0); + } + + case 0xa000: { + return TaitoSoundLatch; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall DriveoutZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x9000: { + if ((d & 4)) { + DriveoutOkiBank = (d & 3); + memcpy(MSM6295ROM, TaitoMSM6295Rom + (DriveoutOkiBank * 0x40000), 0x40000); + } + return; + } + + case 0x9800: { + MSM6295Command(0, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 CharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; +static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 PivotPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 PivotXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; +static INT32 PivotYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 YuyugogoCharPlaneOffsets[1] = { 0 }; +static INT32 YuyugogoCharXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 YuyugogoCharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 TC0480SCPCharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 TC0480SCPCharXOffsets[16] = { 4, 0, 20, 16, 12, 8, 28, 24, 36, 32, 52, 48, 44, 40, 60, 56 }; +static INT32 TC0480SCPCharYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; +static INT32 SpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 SpriteXOffsets[16] = { 4, 0, 12, 8, 20, 16, 28, 24, 36, 32, 44, 40, 52, 48, 60, 56 }; +static INT32 SpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; +static INT32 FinalbSpritePlaneOffsets[6] = { 0x800000, 0x800001, 0, 1, 2, 3 }; +static INT32 FinalbSpriteXOffsets[16] = { 12, 8, 4, 0, 28, 24, 20, 16, 44, 40, 36, 32, 60, 56, 52, 48 }; +static INT32 FinalbSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; + +static void TaitoF2FMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 TaitoF2SynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / (24000000 / 6); +} + +static double TaitoF2GetTime() +{ + return (double)ZetTotalCycles() / (24000000 / 6); +} + +static INT32 CamltryaSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / (24000000 / 4); +} + +static double CamltryaGetTime() +{ + return (double)ZetTotalCycles() / (24000000 / 4); +} + +static void TaitoF2SoundInit() +{ + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(TaitoF2Z80Read); + ZetSetWriteHandler(TaitoF2Z80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2610Init(24000000 / 3, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoF2FMIRQHandler, TaitoF2SynchroniseStream, TaitoF2GetTime, 0); + BurnTimerAttachZet(24000000 / 6); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); +} + +static void SwitchToMusashi() +{ + if (bBurnUseASMCPUEmulation) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); +#endif + bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; + bBurnUseASMCPUEmulation = false; + } +} + +static void TaitoF2Init() +{ + GenericTilesInit(); + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoF2SpritesDisabled = 1; + TaitoF2SpritesActiveArea = 0; + TaitoXOffset = 0; + TaitoF2SpriteType = 0; + + TaitoF2SpriteBufferFunction = TaitoF2NoBuffer; + TaitoDrawFunction = TaitoF2Draw; + + for (INT32 i = 0; i < 8; i++) { + TaitoF2SpriteBankBuffered[i] = 0x400 * i; + TaitoF2SpriteBank[i] = TaitoF2SpriteBankBuffered[i]; + } + + nTaitoCyclesTotal[0] = (24000000 / 2) / 60; + nTaitoCyclesTotal[1] = (24000000 / 6) / 60; +} + +static INT32 CameltryInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoCharPivotModulo = 0x100; + TaitoCharPivotNumPlanes = 4; + TaitoCharPivotWidth = 8; + TaitoCharPivotHeight = 8; + TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; + TaitoCharPivotXOffsets = PivotXOffsets; + TaitoCharPivotYOffsets = PivotYOffsets; + TaitoNumCharPivot = 0x1000; + + TaitoNumSpriteA = 0x1000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); + TC0140SYTInit(); + TC0220IOCInit(); + TC0280GRDInit(-16, -16, TaitoCharsPivot); + TC0360PRIInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x813fff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekMapMemory(TC0280GRDRam , 0xa00000, 0xa01fff, SM_RAM); + SekSetReadByteHandler(0, Cameltry68KReadByte); + SekSetWriteByteHandler(0, Cameltry68KWriteByte); + SekSetReadWordHandler(0, Cameltry68KReadWord); + SekSetWriteWordHandler(0, Cameltry68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoDrawFunction = CameltryDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 CamltryaInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumYM2610 = 0; + TaitoNumYM2203 = 1; + TaitoNumMSM6295 = 1; + + TaitoCharPivotModulo = 0x100; + TaitoCharPivotNumPlanes = 4; + TaitoCharPivotWidth = 8; + TaitoCharPivotHeight = 8; + TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; + TaitoCharPivotXOffsets = PivotXOffsets; + TaitoCharPivotYOffsets = PivotYOffsets; + TaitoNumCharPivot = 0x1000; + + TaitoNumSpriteA = 0x1000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); + TC0140SYTInit(); + TC0220IOCInit(); + TC0280GRDInit(-16, -16, TaitoCharsPivot); + TC0360PRIInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x813fff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekMapMemory(TC0280GRDRam , 0xa00000, 0xa01fff, SM_RAM); + SekSetReadByteHandler(0, Cameltry68KReadByte); + SekSetWriteByteHandler(0, Cameltry68KWriteByte); + SekSetReadWordHandler(0, Cameltry68KReadWord); + SekSetWriteWordHandler(0, Cameltry68KWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(CamltryaZ80Read); + ZetSetWriteHandler(CamltryaZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2203Init(1, 24000000 / 8, &TaitoF2FMIRQHandler, CamltryaSynchroniseStream, CamltryaGetTime, 0); + BurnTimerAttachZet(24000000 / 4); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.20, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.20, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, (4224000 / 4) / 132, 1); + MSM6295SetRoute(0, 0.10, BURN_SND_ROUTE_BOTH); + + nTaitoCyclesTotal[1] = (24000000 / 4) / 60; + + TaitoXOffset = 3; + TaitoDrawFunction = CameltryDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 DeadconxInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoCharModulo = 0x400; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 16; + TaitoCharHeight = 16; + TaitoCharPlaneOffsets = TC0480SCPCharPlaneOffsets; + TaitoCharXOffsets = TC0480SCPCharXOffsets; + TaitoCharYOffsets = TC0480SCPCharYOffsets; + TaitoNumChar = 0x2000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "deadconxj")) { + TC0480SCPInit(TaitoNumChar, 3, 0x34, -5, -1, 0, 26); + } else { + TC0480SCPInit(TaitoNumChar, 3, 0x1e, 8, -1, 0, 0); + } + + TC0140SYTInit(); + TC0360PRIInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(TC0480SCPRam , 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x600000, 0x601fff, SM_RAM); + SekSetReadByteHandler(0, Deadconx68KReadByte); + SekSetWriteByteHandler(0, Deadconx68KWriteByte); + SekSetReadWordHandler(0, Deadconx68KReadWord); + SekSetWriteWordHandler(0, Deadconx68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoDrawFunction = FootchmpDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 DinorexInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0xc000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0360PRIInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x2fffff, SM_ROM); + SekMapMemory(TaitoSpriteExtension , 0x400000, 0x400fff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x500000, 0x501fff, SM_RAM); + SekMapMemory(Taito68KRam1 , 0x600000, 0x60ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x800000, 0x80ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x900000, 0x90ffff, SM_READ); + SekSetReadByteHandler(0, Dinorex68KReadByte); + SekSetWriteByteHandler(0, Dinorex68KWriteByte); + SekSetReadWordHandler(0, Dinorex68KReadWord); + SekSetWriteWordHandler(0, Dinorex68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoF2SpriteType = 3; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 DondokodInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoCharPivotModulo = 0x100; + TaitoCharPivotNumPlanes = 4; + TaitoCharPivotWidth = 8; + TaitoCharPivotHeight = 8; + TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; + TaitoCharPivotXOffsets = PivotXOffsets; + TaitoCharPivotYOffsets = PivotYOffsets; + TaitoNumCharPivot = 0x4000; + + TaitoNumChar = 0x4000; + TaitoNumSpriteA = 0x1000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0220IOCInit(); + TC0280GRDInit(-16, -16, TaitoCharsPivot); + TC0360PRIInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekMapMemory(TC0280GRDRam , 0xa00000, 0xa01fff, SM_RAM); + SekSetReadByteHandler(0, Dondokod68KReadByte); + SekSetWriteByteHandler(0, Dondokod68KWriteByte); + SekSetReadWordHandler(0, Dondokod68KReadWord); + SekSetWriteWordHandler(0, Dondokod68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; + TaitoDrawFunction = TaitoF2PivotDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 DriftoutInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoCharPivotModulo = 0x100; + TaitoCharPivotNumPlanes = 4; + TaitoCharPivotWidth = 8; + TaitoCharPivotHeight = 8; + TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; + TaitoCharPivotXOffsets = PivotXOffsets; + TaitoCharPivotYOffsets = PivotYOffsets; + TaitoNumCharPivot = 0x4000; + TaitoNumSpriteA = 0x1000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); + TC0140SYTInit(); + TC0360PRIInit(); + TC0430GRWInit(-16, 0, TaitoCharsPivot); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(TC0430GRWRam , 0x400000, 0x401fff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Driftout68KReadByte); + SekSetWriteByteHandler(0, Driftout68KWriteByte); + SekSetReadWordHandler(0, Driftout68KReadWord); + SekSetWriteWordHandler(0, Driftout68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoDrawFunction = DriftoutDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 DriveoutInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumYM2610 = 0; + TaitoNumMSM6295 = 1; + + TaitoCharPivotModulo = 0x100; + TaitoCharPivotNumPlanes = 4; + TaitoCharPivotWidth = 8; + TaitoCharPivotHeight = 8; + TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; + TaitoCharPivotXOffsets = PivotXOffsets; + TaitoCharPivotYOffsets = PivotYOffsets; + TaitoNumCharPivot = 0x4000; + TaitoNumSpriteA = 0x1000; + + TaitoLoadRoms(0); + + TaitoMSM6295RomSize = 0x100000; + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + UINT8 *TempRom = (UINT8*)BurnMalloc(0x100000); + memcpy(TempRom, TaitoMSM6295Rom, 0x100000); + memset(TaitoMSM6295Rom, 0, 0x100000); + memcpy(TaitoMSM6295Rom + 0x00000, TempRom + 0x00000, 0x20000); + memcpy(TaitoMSM6295Rom + 0x20000, TempRom + 0x80000, 0x20000); + memcpy(TaitoMSM6295Rom + 0x40000, TempRom + 0x20000, 0x20000); + memcpy(TaitoMSM6295Rom + 0x60000, TempRom + 0x80000, 0x20000); + memcpy(TaitoMSM6295Rom + 0x80000, TempRom + 0x40000, 0x20000); + memcpy(TaitoMSM6295Rom + 0xa0000, TempRom + 0x80000, 0x20000); + memcpy(TaitoMSM6295Rom + 0xc0000, TempRom + 0x60000, 0x20000); + memcpy(TaitoMSM6295Rom + 0xe0000, TempRom + 0x80000, 0x20000); + BurnFree(TempRom); + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); + TC0360PRIInit(); + TC0430GRWInit(-16, 0, TaitoCharsPivot); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(TC0430GRWRam , 0x400000, 0x401fff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Driftout68KReadByte); + SekSetWriteByteHandler(0, Driveout68KWriteByte); + SekSetReadWordHandler(0, Driftout68KReadWord); + SekSetWriteWordHandler(0, Driftout68KWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(DriveoutZ80Read); + ZetSetWriteHandler(DriveoutZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x8000, 0x87ff, 0, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x87ff, 1, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x87ff, 2, TaitoZ80Ram1 ); + ZetClose(); + + MSM6295Init(0, 1056000 / 132, 0); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + TaitoXOffset = 3; + TaitoDrawFunction = DriftoutDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 FinalbInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x2000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 6; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = FinalbSpritePlaneOffsets; + TaitoSpriteAXOffsets = FinalbSpriteXOffsets; + TaitoSpriteAYOffsets = FinalbSpriteYOffsets; + TaitoNumSpriteA = 0x2000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + TaitoNumSpriteA = 0x0000; // Need to load these outside of the usual routine + + if (TaitoLoadRoms(1)) return 1; + + TC0110PCRInit(1, 0x1000); + TC0100SCNInit(0, TaitoNumChar, 1, 8, 0, NULL); + TC0140SYTInit(); + TC0220IOCInit(); + + // Load and decode Sprites + INT32 nRet; + TaitoNumSpriteA = 0x2000; + UINT8 *TempRom = (UINT8*)BurnMalloc(0x200000); + memset(TempRom, 0, 0x200000); + nRet = BurnLoadRom(TempRom + 0x000000 , 5, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(TempRom + 0x000001 , 6, 2); if (nRet != 0) return 1; + nRet = BurnLoadRom(TempRom + 0x180000 , 7, 1); if (nRet != 0) return 1; + + INT32 Offset = 0x100000; + UINT8 Data, d1, d2, d3, d4; + for (INT32 i = 0x180000; i < 0x200000; i++) { + Data = TempRom[i]; + d1 = (Data >> 0) & 3; + d2 = (Data >> 2) & 3; + d3 = (Data >> 4) & 3; + d4 = (Data >> 6) & 3; + + TempRom[Offset] = (d3 << 2) | (d4 << 6); + Offset++; + + TempRom[Offset] = (d1 << 2) | (d2 << 6); + Offset++; + } + GfxDecode(TaitoNumSpriteA, TaitoSpriteANumPlanes, TaitoSpriteAWidth, TaitoSpriteAHeight, FinalbSpritePlaneOffsets, FinalbSpriteXOffsets, FinalbSpriteYOffsets, TaitoSpriteAModulo, TempRom, TaitoSpritesA); + BurnFree(TempRom); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Finalb68KReadByte); + SekSetWriteByteHandler(0, Finalb68KWriteByte); + SekSetReadWordHandler(0, Finalb68KReadWord); + SekSetWriteWordHandler(0, Finalb68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 1; + TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; + TaitoDrawFunction = FinalbDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 FootchmpInit() +{ + INT32 nLen; + + TaitoF2Init(); + + Footchmp = 1; + + TaitoCharModulo = 0x400; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 16; + TaitoCharHeight = 16; + TaitoCharPlaneOffsets = TC0480SCPCharPlaneOffsets; + TaitoCharXOffsets = TC0480SCPCharXOffsets; + TaitoCharYOffsets = TC0480SCPCharYOffsets; + TaitoNumChar = 0x2000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "hthero")) { + TC0480SCPInit(TaitoNumChar, 3, 0x33, -4, -1, 0, 24); + } else { + TC0480SCPInit(TaitoNumChar, 3, 0x1d, 8, -1, 0, 0); + } + TC0140SYTInit(); + TC0360PRIInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(TC0480SCPRam , 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x600000, 0x601fff, SM_RAM); + SekSetReadByteHandler(0, Footchmp68KReadByte); + SekSetWriteByteHandler(0, Footchmp68KWriteByte); + SekSetReadWordHandler(0, Footchmp68KReadWord); + SekSetWriteWordHandler(0, Footchmp68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoF2SpriteBufferFunction = TaitoF2FullBufferDelayed; + TaitoDrawFunction = FootchmpDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 GrowlInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0360PRIInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Growl68KReadByte); + SekSetWriteByteHandler(0, Growl68KWriteByte); + SekSetReadWordHandler(0, Growl68KReadWord); + SekSetWriteWordHandler(0, Growl68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 GunfrontInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0x2000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0360PRIInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Gunfront68KReadByte); + SekSetWriteByteHandler(0, Gunfront68KWriteByte); + SekSetReadWordHandler(0, Gunfront68KReadWord); + SekSetWriteWordHandler(0, Gunfront68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 KoshienInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 1, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0360PRIInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRom1 + 0x40000 , 0x080000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Koshien68KReadByte); + SekSetWriteByteHandler(0, Koshien68KWriteByte); + SekSetReadWordHandler(0, Koshien68KReadWord); + SekSetWriteWordHandler(0, Koshien68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 1; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 LiquidkInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x4000; + TaitoNumSpriteA = 0x2000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0220IOCInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Liquidk68KReadByte); + SekSetWriteByteHandler(0, Liquidk68KWriteByte); + SekSetReadWordHandler(0, Liquidk68KReadWord); + SekSetWriteWordHandler(0, Liquidk68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 MegablstInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x4000; + TaitoNumSpriteA = 0x2000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0220IOCInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x300000, 0x301fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x600000, 0x60ffff, SM_READ); + SekMapMemory(Taito68KRam1 + 0x10000 , 0x610000, 0x61ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x800000, 0x80ffff, SM_RAM); + SekSetReadByteHandler(0, Megablst68KReadByte); + SekSetWriteByteHandler(0, Megablst68KWriteByte); + SekSetReadWordHandler(0, Megablst68KReadWord); + SekSetWriteWordHandler(0, Megablst68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + MegabCChipInit(); + + TaitoXOffset = 3; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 MetalbInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoCharModulo = 0x400; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 16; + TaitoCharHeight = 16; + TaitoCharPlaneOffsets = TC0480SCPCharPlaneOffsets; + TaitoCharXOffsets = TC0480SCPCharXOffsets; + TaitoCharYOffsets = TC0480SCPCharYOffsets; + TaitoNumChar = 0x2000; + + TaitoNumSpriteA = 0x2000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0480SCPInit(TaitoNumChar, 3, 0x32, -4, 1, 0, 24); + TC0480SCPSetColourBase(256); + TC0140SYTInit(); + TC0360PRIInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(TC0480SCPRam , 0x500000, 0x50ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x700000, 0x703fff, SM_RAM); + SekSetReadByteHandler(0, Metalb68KReadByte); + SekSetWriteByteHandler(0, Metalb68KWriteByte); + SekSetReadWordHandler(0, Metalb68KReadWord); + SekSetWriteWordHandler(0, Metalb68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoDrawFunction = MetalbDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 MjnquestInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x10000; + TaitoNumSpriteA = 0x1000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + // Load and decode Sprites + INT32 nRet; + UINT8 *TempRom = (UINT8*)BurnMalloc(TaitoSpriteARomSize); + memset(TempRom, 0, TaitoSpriteARomSize); + nRet = BurnLoadRom(TempRom + 0x000000 , 6, 1); if (nRet != 0) return 1; + for (UINT32 i = 0; i < TaitoSpriteARomSize; i += 2) { + INT32 Temp = TempRom[i]; + TempRom[i + 0] = (TempRom[i + 1] >> 4) | (TempRom[i + 1] << 4); + TempRom[i + 1] = (Temp >> 4) | (Temp << 4); + } + GfxDecode(TaitoNumSpriteA, TaitoSpriteANumPlanes, TaitoSpriteAWidth, TaitoSpriteAHeight, TaitoSpriteAPlaneOffsets, TaitoSpriteAXOffsets, TaitoSpriteAYOffsets, TaitoSpriteAModulo, TempRom, TaitoSpritesA); + BurnFree(TempRom); + + TC0110PCRInit(1, 0x1000); + TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); + TC0100SCNSetGfxMask(0, 0x7fff); + TC0140SYTInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRom1 + 0x40000 , 0x080000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x110000, 0x12ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x500000, 0x50ffff, SM_RAM); + SekSetReadByteHandler(0, Mjnquest68KReadByte); + SekSetWriteByteHandler(0, Mjnquest68KWriteByte); + SekSetReadWordHandler(0, Mjnquest68KReadWord); + SekSetWriteWordHandler(0, Mjnquest68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoDrawFunction = FinalbDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 NinjakInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x4000; + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Ninjak68KReadByte); + SekSetWriteByteHandler(0, Ninjak68KWriteByte); + SekSetReadWordHandler(0, Ninjak68KReadWord); + SekSetWriteWordHandler(0, Ninjak68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 PulirulaInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoCharPivotModulo = 0x100; + TaitoCharPivotNumPlanes = 4; + TaitoCharPivotWidth = 8; + TaitoCharPivotHeight = 8; + TaitoCharPivotPlaneOffsets = PivotPlaneOffsets; + TaitoCharPivotXOffsets = PivotXOffsets; + TaitoCharPivotYOffsets = PivotYOffsets; + TaitoNumCharPivot = 0x4000; + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0360PRIInit(); + TC0430GRWInit(-10, 0, TaitoCharsPivot); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(TC0430GRWRam , 0x400000, 0x401fff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteExtension , 0x600000, 0x603fff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Pulirula68KReadByte); + SekSetWriteByteHandler(0, Pulirula68KWriteByte); + SekSetReadWordHandler(0, Pulirula68KReadWord); + SekSetWriteWordHandler(0, Pulirula68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoF2SpriteType = 2; + TaitoDrawFunction = PulirulaDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 QcrayonInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0360PRIInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(Taito68KRom1 + 0x80000 , 0x300000, 0x3fffff, SM_ROM); + SekMapMemory(TaitoSpriteExtension , 0x600000, 0x603fff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x800000, 0x80ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x900000, 0x90ffff, SM_READ); + SekSetReadByteHandler(0, Qcrayon68KReadByte); + SekSetWriteByteHandler(0, Qcrayon68KWriteByte); + SekSetReadWordHandler(0, Qcrayon68KReadWord); + SekSetWriteWordHandler(0, Qcrayon68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoF2SpriteType = 3; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 Qcrayon2Init() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0360PRIInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x300000, 0x301fff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x500000, 0x50ffff, SM_READ); + SekMapMemory(Taito68KRom1 + 0x80000 , 0x600000, 0x6fffff, SM_ROM); + SekMapMemory(TaitoSpriteExtension , 0xb00000, 0xb017ff, SM_RAM); + SekSetReadByteHandler(0, Qcrayon268KReadByte); + SekSetWriteByteHandler(0, Qcrayon268KWriteByte); + SekSetReadWordHandler(0, Qcrayon268KReadWord); + SekSetWriteWordHandler(0, Qcrayon268KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoF2SpriteType = 3; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 QjinseiInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0360PRIInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRom1 + 0x80000 , 0x100000, 0x1fffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(TaitoSpriteExtension , 0x600000, 0x603fff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Qjinsei68KReadByte); + SekSetWriteByteHandler(0, Qjinsei68KWriteByte); + SekSetReadWordHandler(0, Qjinsei68KReadWord); + SekSetWriteWordHandler(0, Qjinsei68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoF2SpriteType = 3; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 QtorimonInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumSpriteA = 0x0800; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0110PCRInit(1, 0x1000); + TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); + TC0140SYTInit(); + TC0220IOCInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Qtorimon68KReadByte); + SekSetWriteByteHandler(0, Qtorimon68KWriteByte); + SekSetReadWordHandler(0, Qtorimon68KReadWord); + SekSetWriteWordHandler(0, Qtorimon68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; + TaitoDrawFunction = QtorimonDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 QuizhqInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumSpriteA = 0x1000; + + TaitoLoadRoms(0); + + Taito68KRom1Size = 0xc0000; + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + memcpy(Taito68KRom1 + 0x80000, Taito68KRom1 + 0x40000, 0x40000); + memset(Taito68KRom1 + 0x40000, 0, 0x40000); + + TC0110PCRInit(1, 0x1000); + TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); + TC0140SYTInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Quizhq68KReadByte); + SekSetWriteByteHandler(0, Quizhq68KWriteByte); + SekSetReadWordHandler(0, Quizhq68KReadWord); + SekSetWriteWordHandler(0, Quizhq68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; + TaitoDrawFunction = QtorimonDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 QzchikyuInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0x2000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); + TC0140SYTInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRom1 + 0x40000 , 0x100000, 0x17ffff, SM_ROM); + SekMapMemory(TaitoPaletteRam , 0x400000, 0x401fff, SM_RAM); + SekMapMemory(Taito68KRam1 , 0x500000, 0x50ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x600000, 0x60ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x700000, 0x70ffff, SM_READ); + SekSetReadByteHandler(0, Qzchikyu68KReadByte); + SekSetWriteByteHandler(0, Qzchikyu68KWriteByte); + SekSetReadWordHandler(0, Qzchikyu68KReadWord); + SekSetWriteWordHandler(0, Qzchikyu68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayedQzchikyu; + TaitoDrawFunction = QzquestDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 QzquestInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0x2000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); + TC0140SYTInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRom1 + 0x40000 , 0x100000, 0x1fffff, SM_ROM); + SekMapMemory(TaitoPaletteRam , 0x400000, 0x401fff, SM_RAM); + SekMapMemory(Taito68KRam1 , 0x500000, 0x50ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x600000, 0x60ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x700000, 0x70ffff, SM_READ); + SekSetReadByteHandler(0, Qzquest68KReadByte); + SekSetWriteByteHandler(0, Qzquest68KWriteByte); + SekSetReadWordHandler(0, Qzquest68KReadWord); + SekSetWriteWordHandler(0, Qzquest68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayed; + TaitoDrawFunction = QzquestDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 SolfigtrInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x8000; + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, TaitoPriorityMap); + TC0140SYTInit(); + TC0360PRIInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x201fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekSetReadByteHandler(0, Solfigtr68KReadByte); + SekSetWriteByteHandler(0, Solfigtr68KWriteByte); + SekSetReadWordHandler(0, Solfigtr68KReadWord); + SekSetWriteWordHandler(0, Solfigtr68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 SsiInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumSpriteA = 0x2000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 0, 0, 0, NULL); + TC0140SYTInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x300000, 0x301fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x600000, 0x60ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x800000, 0x80ffff, SM_RAM); + SekSetReadByteHandler(0, Ssi68KReadByte); + SekSetWriteByteHandler(0, Ssi68KWriteByte); + SekSetReadWordHandler(0, Ssi68KReadWord); + SekSetWriteWordHandler(0, Ssi68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayedThundfox; + TaitoDrawFunction = SsiDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 ThundfoxInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoNumChar = 0x4000; + + TaitoCharBModulo = 0x100; + TaitoCharBNumPlanes = 4; + TaitoCharBWidth = 8; + TaitoCharBHeight = 8; + TaitoCharBPlaneOffsets = CharPlaneOffsets; + TaitoCharBXOffsets = CharXOffsets; + TaitoCharBYOffsets = CharYOffsets; + TaitoNumCharB = 0x4000; + + TaitoNumSpriteA = 0x2000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); + TC0100SCNSetClipArea(0, nScreenWidth, nScreenHeight, 0); + TC0100SCNInit(1, TaitoNumCharB, 3, 16, 0, NULL); + TC0100SCNSetClipArea(1, nScreenWidth, nScreenHeight, 0); + TC0140SYTInit(); + TC0220IOCInit(); + TC0360PRIInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(TaitoPaletteRam , 0x100000, 0x101fff, SM_RAM); + SekMapMemory(Taito68KRam1 , 0x300000, 0x30ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x400000, 0x40ffff, SM_READ); + SekMapMemory(TC0100SCNRam[1] , 0x500000, 0x50ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x600000, 0x60ffff, SM_RAM); + SekSetReadByteHandler(0, Thundfox68KReadByte); + SekSetWriteByteHandler(0, Thundfox68KWriteByte); + SekSetReadWordHandler(0, Thundfox68KReadWord); + SekSetWriteWordHandler(0, Thundfox68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoXOffset = 3; + TaitoF2SpriteBufferFunction = TaitoF2PartialBufferDelayedThundfox; + TaitoDrawFunction = ThundfoxDraw; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 YesnojInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoCharModulo = 0x40; + TaitoCharNumPlanes = 1; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = YuyugogoCharPlaneOffsets; + TaitoCharXOffsets = YuyugogoCharXOffsets; + TaitoCharYOffsets = YuyugogoCharYOffsets; + TaitoNumChar = 0x10000; + + TaitoNumSpriteA = 0x2000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); + TC0140SYTInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x200000, 0x20ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x500000, 0x50ffff, SM_READ); + SekMapMemory(TaitoPaletteRam , 0x600000, 0x601fff, SM_RAM); + SekSetReadByteHandler(0, Yesnoj68KReadByte); + SekSetWriteByteHandler(0, Yesnoj68KWriteByte); + SekSetReadWordHandler(0, Yesnoj68KReadWord); + SekSetWriteWordHandler(0, Yesnoj68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoDrawFunction = YuyugogoDraw; + TaitoXOffset = 3; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 YuyugogoInit() +{ + INT32 nLen; + + TaitoF2Init(); + + TaitoCharModulo = 0x40; + TaitoCharNumPlanes = 1; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = YuyugogoCharPlaneOffsets; + TaitoCharXOffsets = YuyugogoCharXOffsets; + TaitoCharYOffsets = YuyugogoCharYOffsets; + TaitoNumChar = 0x4000; + + TaitoNumSpriteA = 0x4000; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0100SCNInit(0, TaitoNumChar, 3, 8, 0, NULL); + TC0140SYTInit(); + TC0510NIOInit(); + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(TC0100SCNRam[0] , 0x800000, 0x80ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0x900000, 0x90ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0xa00000, 0xa01fff, SM_RAM); + SekMapMemory(Taito68KRam1 , 0xb00000, 0xb10fff, SM_RAM); + SekMapMemory(TaitoSpriteExtension , 0xc00000, 0xc01fff, SM_RAM); + SekMapMemory(Taito68KRom1 + 0x40000 , 0xd00000, 0xdfffff, SM_ROM); + SekSetReadByteHandler(0, Yuyugogo68KReadByte); + SekSetWriteByteHandler(0, Yuyugogo68KWriteByte); + SekSetReadWordHandler(0, Yuyugogo68KReadWord); + SekSetWriteWordHandler(0, Yuyugogo68KWriteWord); + SekClose(); + + TaitoF2SoundInit(); + + TaitoDrawFunction = YuyugogoDraw; + TaitoF2SpriteType = 1; + TaitoXOffset = 3; + + // Reset the driver + TaitoF2DoReset(); + + return 0; +} + +static INT32 TaitoF2Exit() +{ + TaitoExit(); + + TaitoF2SpritesFlipScreen = 0; + TaitoF2SpriteBlendMode = 0; + TaitoF2TilePriority[0] = TaitoF2TilePriority[1] = TaitoF2TilePriority[2] = TaitoF2TilePriority[3] = TaitoF2TilePriority[4] = 0; + TaitoF2SpritePriority[0] = TaitoF2SpritePriority[1] = TaitoF2SpritePriority[2] = TaitoF2SpritePriority[3] = 0; + + TaitoF2SpriteType = 0; + Footchmp = 0; + YesnoDip = 0; + MjnquestInput = 0; + DriveoutSoundNibble = 0; + DriveoutOkiBank = 0; + + TaitoF2SpriteBufferFunction = NULL; + + // Switch back CPU core if needed + if (bUseAsm68KCoreOldValue) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); +#endif + bUseAsm68KCoreOldValue = false; + bBurnUseASMCPUEmulation = true; + } + + + return 0; +} + +static inline UINT8 pal4bit(UINT8 bits) +{ + bits &= 0x0f; + return (bits << 4) | bits; +} + +static inline UINT8 pal5bit(UINT8 bits) +{ + bits &= 0x1f; + return (bits << 3) | (bits >> 2); +} + + +inline static INT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 12); + g = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 8); + b = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 4); + + return BurnHighCol(r, g, b, 0); +} + +inline static INT32 QzquestCalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 10); + g = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 5); + b = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); + + return BurnHighCol(r, g, b, 0); +} + +static void TaitoF2CalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x1000; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } +} + +static void MetalbCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x2000; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } +} + +static void QzquestCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x1000; i++, ps++, pd++) { + *pd = QzquestCalcCol(*ps); + } +} + +static void UpdateTaitoF2SpriteBanks() +{ + INT32 i; + + for (i = 0; i < 8; i++) { + TaitoF2SpriteBank[i] = TaitoF2SpriteBankBuffered[i]; + } +} + +void TaitoF2HandleSpriteBuffering() +{ + if (TaitoF2PrepareSprites) { + memcpy(TaitoSpriteRamBuffered, TaitoSpriteRam, 0x10000); + TaitoF2PrepareSprites = 0; + } +} + +static void TaitoF2UpdateSpritesActiveArea() +{ + INT32 Off; + UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; + + UpdateTaitoF2SpriteBanks(); + + TaitoF2HandleSpriteBuffering(); + + if (TaitoF2SpritesActiveArea == 0x8000 && SpriteRamBuffered[(0x8000 + 6) / 2] == 0 && SpriteRamBuffered[(0x8000 + 10) / 2] == 0) TaitoF2SpritesActiveArea = 0; + + for (Off = 0; Off < 0x4000; Off += 16) { + INT32 Offs = Off + TaitoF2SpritesActiveArea; + + if (SpriteRamBuffered[(Offs + 6) / 2] & 0x8000) { + TaitoF2SpritesDisabled = SpriteRamBuffered[(Offs + 10) / 2] & 0x1000; + if (Footchmp) { + TaitoF2SpritesActiveArea = 0x8000 * (SpriteRamBuffered[(Offs + 6) / 2] & 0x0001); + } else { + TaitoF2SpritesActiveArea = 0x8000 * (SpriteRamBuffered[(Offs + 10) / 2] & 0x0001); + } + } + + if ((SpriteRamBuffered[(Offs + 4) / 2] & 0xf000) == 0xa000) { + TaitoF2SpritesMasterScrollX = SpriteRamBuffered[(Offs + 4) / 2] & 0xfff; + if (TaitoF2SpritesMasterScrollX >= 0x800) TaitoF2SpritesMasterScrollX -= 0x1000; + + TaitoF2SpritesMasterScrollY = SpriteRamBuffered[(Offs + 6) / 2] & 0xfff; + if (TaitoF2SpritesMasterScrollY >= 0x800) TaitoF2SpritesMasterScrollY -= 0x1000; + } + } +} + +static void RenderSpriteZoom(INT32 Code, INT32 sx, INT32 sy, INT32 Colour, INT32 xFlip, INT32 yFlip, INT32 xScale, INT32 yScale, INT32 Priority, UINT8* pSource) +{ + UINT8 *SourceBase = pSource + ((Code % TaitoNumSpriteA) * TaitoSpriteAWidth * TaitoSpriteAHeight); + + INT32 SpriteScreenHeight = (yScale * TaitoSpriteAHeight + 0x8000) >> 16; + INT32 SpriteScreenWidth = (xScale * TaitoSpriteAWidth + 0x8000) >> 16; + + Colour = 0x10 * (Colour % 0x100); + + if (TaitoF2SpritesFlipScreen) { + xFlip = !xFlip; + sx = 320 - sx - (xScale >> 12); + yFlip = !yFlip; + sy = 256 - sy - (yScale >> 12); + } + + if (SpriteScreenWidth && SpriteScreenHeight) { + INT32 dx = (TaitoSpriteAWidth << 16) / SpriteScreenWidth; + INT32 dy = (TaitoSpriteAHeight << 16) / SpriteScreenHeight; + + INT32 ex = sx + SpriteScreenWidth; + INT32 ey = sy + SpriteScreenHeight; + + INT32 xIndexBase; + INT32 yIndex; + + if (xFlip) { + xIndexBase = (SpriteScreenWidth - 1) * dx; + dx = -dx; + } else { + xIndexBase = 0; + } + + if (yFlip) { + yIndex = (SpriteScreenHeight - 1) * dy; + dy = -dy; + } else { + yIndex = 0; + } + + if (sx < 0) { + INT32 Pixels = 0 - sx; + sx += Pixels; + xIndexBase += Pixels * dx; + } + + if (sy < 0) { + INT32 Pixels = 0 - sy; + sy += Pixels; + yIndex += Pixels * dy; + } + + if (ex > nScreenWidth) { + INT32 Pixels = ex - nScreenWidth; + ex -= Pixels; + } + + if (ey > nScreenHeight) { + INT32 Pixels = ey - nScreenHeight; + ey -= Pixels; + } + + if (ex > sx) { + INT32 y; + + for (y = sy; y < ey; y++) { + UINT8 *Source = SourceBase + ((yIndex >> 16) * TaitoSpriteAWidth); + UINT16* pPixel = pTransDraw + (y * nScreenWidth); + + INT32 x, xIndex = xIndexBase; + for (x = sx; x < ex; x++) { + INT32 c = Source[xIndex >> 16]; + if (c != 0) { + if (TaitoF2SpriteBlendMode) { + INT32 Pri = TaitoPriorityMap[(y * nScreenWidth) + x]; + INT32 TilePri = 0; + + if (TaitoIC_TC0100SCNInUse) { + if (Pri == 1) TilePri = TaitoF2TilePriority[0]; + if (Pri == 2) TilePri = TaitoF2TilePriority[1]; + if (Pri == 4) TilePri = TaitoF2TilePriority[2]; + } + + if (((TaitoF2SpriteBlendMode & 0xc0) == 0xc0) && (Priority == (TilePri - 1))) { + pPixel[x] = ((c | Colour) & 0xfff0) | (pPixel[x] & 0x0f); + } else { + if (((TaitoF2SpriteBlendMode & 0xc0) == 0xc0) && (Priority == (TilePri + 1))) { + if (pPixel[x] & 0x0f) { + pPixel[x] = (pPixel[x] & 0xfff0) | ((c | Colour) & 0x0f); + } else { + pPixel[x] = c | Colour; + } + } else { + if (((TaitoF2SpriteBlendMode & 0xc0) == 0x80) && (Priority == (TilePri - 1))) { + pPixel[x] = pPixel[x] & 0xffef; + } else { + if (((TaitoF2SpriteBlendMode & 0xc0) == 0x80) && (Priority == (TilePri + 1))) { + pPixel[x] = (c | Colour) & 0xffef; + } else { + pPixel[x] = c | Colour; + } + } + } + } + } else { + pPixel[x] = c | Colour; + } + } + xIndex += dx; + } + + yIndex += dy; + } + } + } +} + +void TaitoF2MakeSpriteList() +{ + INT32 i, x, y, Off, ExtOffs; + INT32 Code, Colour, SpriteData, SpriteCont, xFlip, yFlip; + INT32 xCurrent, yCurrent, BigSprite = 0; + INT32 yNum = 0, xNum = 0, xLatch = 0, yLatch = 0, LastContinuationTile = 0; + UINT32 ZoomWord, xZoom, yZoom, zx = 0, zy = 0, xZoomLatch = 0, yZoomLatch = 0; + INT32 xScroll1, yScroll1; + INT32 xScroll = 0, yScroll = 0; + INT32 xCur, yCur; + INT32 xOffset = 0; + + INT32 Disabled = TaitoF2SpritesDisabled; + INT32 MasterScrollX = TaitoF2SpritesMasterScrollX; + INT32 MasterScrollY = TaitoF2SpritesMasterScrollY; + INT32 Area = TaitoF2SpritesActiveArea; + + UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; + UINT16 *SpriteExtension = (UINT16*)TaitoSpriteExtension; + struct TaitoF2SpriteEntry *SpritePtr = TaitoF2SpriteList; + + memset(TaitoF2SpriteList, 0, 0x400 * sizeof(TaitoF2SpriteEntry)); + + xScroll1 = 0; + yScroll1 = 0; + x = y = 0; + xCurrent = yCurrent = 0; + Colour = 0; + + xOffset = TaitoXOffset; + if (TaitoF2SpritesFlipScreen) xOffset = -TaitoXOffset; + + if (Area == 0x8000 && SpriteRamBuffered[(0x8000 + 6) / 2] == 0 && SpriteRamBuffered[(0x8000 + 10) / 2] == 0) Area = 0; + + for (Off = 0; Off < 0x4000; Off += 16) { + INT32 Offs = Off + Area; + + if (SpriteRamBuffered[(Offs + 6) / 2] & 0x8000) { + Disabled = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 10) / 2]) & 0x1000; + TaitoF2SpritesFlipScreen = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 10) / 2]) & 0x2000; + + xOffset = TaitoXOffset; + if (TaitoF2SpritesFlipScreen) xOffset = -TaitoXOffset; + + if (Footchmp) { + Area = 0x8000 * (BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 6) / 2]) & 0x0001); + } else { + Area = 0x8000 * (BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 10) / 2]) & 0x0001); + } + } + + if ((BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]) & 0xf000) == 0xa000) { + MasterScrollX = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]) & 0xfff; + if (MasterScrollX >= 0x800) MasterScrollX -= 0x1000; + + MasterScrollY = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 6) / 2]) & 0xfff; + if (MasterScrollY >= 0x800) MasterScrollY -= 0x1000; + } + + if ((BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]) & 0xf000) == 0x5000) { + xScroll1 = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]) & 0xfff; + if (xScroll1 >= 0x800) xScroll1 -= 0x1000; + + yScroll1 = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 6) / 2]) & 0xfff; + if (yScroll1 >= 0x800) yScroll1 -= 0x1000; + } + + if (Disabled) + continue; + + SpriteData = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 8) / 2]); + + SpriteCont = (SpriteData & 0xff00) >> 8; + + if ((SpriteCont & 0x08) != 0) { + if (BigSprite == 0) { + xLatch = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]) & 0xfff; + yLatch = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 6) / 2]) & 0xfff; + xNum = 0; + yNum = 0; + ZoomWord = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 2) / 2]); + yZoomLatch = (ZoomWord >> 8) & 0xff; + xZoomLatch = (ZoomWord) & 0xff; + BigSprite = 1; + } + } else if (BigSprite) { + LastContinuationTile = 1; + } + + if ((SpriteCont & 0x04) == 0) Colour = SpriteData & 0xff; + + if (BigSprite == 0 || (SpriteCont & 0xf0) == 0) { + x = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 4) / 2]); + + if (x & 0x8000) { + xScroll = -xOffset - 0x60; + yScroll = 0; + } else if (x & 0x4000) { + xScroll = MasterScrollX - xOffset - 0x60; + yScroll = MasterScrollY; + } else { + xScroll = xScroll1 + MasterScrollX - xOffset - 0x60; + yScroll = yScroll1 + MasterScrollY; + } + + x &= 0xfff; + y = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[(Offs + 6) / 2]) & 0xfff; + + xCurrent = x; + yCurrent = y; + } else { + if ((SpriteCont & 0x10) == 0) { + y = yCurrent; + } else if ((SpriteCont & 0x20) != 0) { + y += 16; + yNum++; + } + + if ((SpriteCont & 0x40) == 0) { + x = xCurrent; + } else if ((SpriteCont & 0x80) != 0){ + x += 16; + yNum=0; + xNum++; + } + } + + if (BigSprite) { + xZoom = xZoomLatch; + yZoom = yZoomLatch; + zx = 0x10; + zy = 0x10; + + if (xZoom || yZoom) { + x = xLatch + (xNum * (0x100 - xZoom) + 12) / 16; + y = yLatch + (yNum * (0x100 - yZoom) + 12) / 16; + zx = xLatch + ((xNum + 1) * (0x100 - xZoom) + 12) / 16 - x; + zy = yLatch + ((yNum + 1) * (0x100 - yZoom) + 12) / 16 - y; + } + } else { + ZoomWord = SpriteRamBuffered[(Offs + 2) / 2]; + yZoom = (ZoomWord >> 8) & 0xff; + xZoom = (ZoomWord) & 0xff; + zx = (0x100 - xZoom) / 16; + zy = (0x100 - yZoom) / 16; + } + + if (LastContinuationTile) { + BigSprite = 0; + LastContinuationTile = 0; + } + + Code = 0; + ExtOffs = Offs; + if (ExtOffs >= 0x8000) ExtOffs -= 0x4000; + + if (TaitoF2SpriteType == 0) { + Code = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[Offs / 2]) & 0x1fff; + i = (Code & 0x1c00) >> 10; + Code = TaitoF2SpriteBank[i] + (Code & 0x3ff); + } + + if (TaitoF2SpriteType == 1) { + Code = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[Offs / 2]) & 0x3ff; + i = (BURN_ENDIAN_SWAP_INT16(SpriteExtension[(ExtOffs >> 4)]) & 0x3f) << 10; + Code = (i | Code); + } + + if (TaitoF2SpriteType == 2) { + Code = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[Offs / 2]) & 0xff; + i = (BURN_ENDIAN_SWAP_INT16(SpriteExtension[(ExtOffs >> 4)]) & 0xff00); + Code = (i | Code); + } + + if (TaitoF2SpriteType == 3) { + Code = BURN_ENDIAN_SWAP_INT16(SpriteRamBuffered[Offs / 2]) & 0xff; + i = (BURN_ENDIAN_SWAP_INT16(SpriteExtension[ExtOffs >> 4]) & 0xff) << 8; + Code = (i | Code); + } + + if (Code == 0) continue; + + xFlip = SpriteCont & 0x01; + yFlip = SpriteCont & 0x02; + + xCur = (x + xScroll) & 0xfff; + if (xCur >= 0x800) xCur -= 0x1000; + + yCur = (y + yScroll) & 0xfff; + if (yCur >= 0x800) yCur -= 0x1000; + + if (TaitoF2SpritesFlipScreen) { + yCur += 16; + } else { + yCur -= 16; + } + + INT32 Priority = (Colour & 0xc0) >> 6; + + SpritePtr->Code = Code; + SpritePtr->x = xCur; + SpritePtr->y = yCur; + SpritePtr->Colour = Colour; + SpritePtr->xFlip = xFlip; + SpritePtr->yFlip = yFlip; + SpritePtr->xZoom = zx << 12; + SpritePtr->yZoom = zy << 12; + SpritePtr->Priority = TaitoF2SpritePriority[Priority]; + SpritePtr++; + } +} + +void TaitoF2RenderSpriteList(INT32 TaitoF2SpritePriorityLevel) +{ + for (INT32 i = 0; i < 0x400; i++) { + if (TaitoF2SpriteList[i].Priority == TaitoF2SpritePriorityLevel) RenderSpriteZoom(TaitoF2SpriteList[i].Code, TaitoF2SpriteList[i].x, TaitoF2SpriteList[i].y, TaitoF2SpriteList[i].Colour, TaitoF2SpriteList[i].xFlip, TaitoF2SpriteList[i].yFlip, TaitoF2SpriteList[i].xZoom, TaitoF2SpriteList[i].yZoom, TaitoF2SpritePriorityLevel, TaitoSpritesA); + } +} + +void TaitoF2NoBuffer() +{ + TaitoF2UpdateSpritesActiveArea(); + TaitoF2PrepareSprites = 1; +} + +void TaitoF2PartialBufferDelayed() +{ + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; + + TaitoF2UpdateSpritesActiveArea(); + TaitoF2PrepareSprites = 0; + memcpy(TaitoSpriteRamBuffered, TaitoSpriteRamDelayed, 0x10000); + for (INT32 i = 0; i < 0x10000 / 2; i += 4) SpriteRamBuffered[i] = SpriteRam[i]; + memcpy(TaitoSpriteRamDelayed, TaitoSpriteRam, 0x10000); +} + +void TaitoF2PartialBufferDelayedQzchikyu() +{ + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; + + TaitoF2UpdateSpritesActiveArea(); + TaitoF2PrepareSprites = 0; + memcpy(TaitoSpriteRamBuffered, TaitoSpriteRamDelayed, 0x10000); + for (INT32 i = 0; i < 0x10000 / 2; i += 8) { + SpriteRamBuffered[i + 0] = SpriteRam[i + 0]; + SpriteRamBuffered[i + 1] = SpriteRam[i + 1]; + SpriteRamBuffered[i + 4] = SpriteRam[i + 4]; + SpriteRamBuffered[i + 5] = SpriteRam[i + 5]; + SpriteRamBuffered[i + 6] = SpriteRam[i + 6]; + SpriteRamBuffered[i + 7] = SpriteRam[i + 7]; + } + memcpy(TaitoSpriteRamDelayed, TaitoSpriteRam, 0x10000); +} + +void TaitoF2PartialBufferDelayedThundfox() +{ + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; + + TaitoF2UpdateSpritesActiveArea(); + TaitoF2PrepareSprites = 0; + memcpy(TaitoSpriteRamBuffered, TaitoSpriteRamDelayed, 0x10000); + for (INT32 i = 0; i < 0x10000 / 2; i += 8) { + SpriteRamBuffered[i + 0] = SpriteRam[i + 0]; + SpriteRamBuffered[i + 1] = SpriteRam[i + 1]; + SpriteRamBuffered[i + 4] = SpriteRam[i + 4]; + } + memcpy(TaitoSpriteRamDelayed, TaitoSpriteRam, 0x10000); +} + +void TaitoF2FullBufferDelayed() +{ + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + UINT16 *SpriteRamBuffered = (UINT16*)TaitoSpriteRamBuffered; + + TaitoF2UpdateSpritesActiveArea(); + TaitoF2PrepareSprites = 0; + memcpy(TaitoSpriteRamBuffered, TaitoSpriteRamDelayed, 0x10000); + for (INT32 i = 0;i < 0x10000 / 2; i++) SpriteRamBuffered[i] = SpriteRam[i]; + memcpy(TaitoSpriteRamDelayed, TaitoSpriteRam, 0x10000); +} + +static void TaitoF2Draw() +{ + INT32 i; + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + INT32 DrawLayer0 = 1; + INT32 DrawLayer1 = 1; + INT32 DrawLayer2 = 1; + + if (TC0100SCNBottomLayer(0)) { + TaitoF2TilePriority[1] = TC0360PRIRegs[5] & 0x0f; + TaitoF2TilePriority[0] = TC0360PRIRegs[5] >> 4; + } else { + TaitoF2TilePriority[0] = TC0360PRIRegs[5] & 0x0f; + TaitoF2TilePriority[1] = TC0360PRIRegs[5] >> 4; + } + TaitoF2TilePriority[2] = TC0360PRIRegs[4] >> 4; + + if (TaitoF2TilePriority[1] < TaitoF2TilePriority[0]) TaitoF2TilePriority[1] = TaitoF2TilePriority[0]; + + TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; + TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; + TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; + TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; + + TaitoF2SpriteBlendMode = TC0360PRIRegs[0] & 0xc0; + + BurnTransferClear(); + TaitoF2CalcPalette(); + + // Detect when we are using sprite blending with the sprite under the tile layer + UINT8 TileAltPriority[3] = { 0xff, 0xff, 0xff }; + if (TaitoF2SpriteBlendMode) { + for (i = 0; i < 4; i++) { + if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[0] - 1) { + TileAltPriority[0] = TaitoF2SpritePriority[i]; + DrawLayer0 = 0; + } + + if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[1] - 1) { + TileAltPriority[1] = TaitoF2SpritePriority[i]; + DrawLayer1 = 0; + } + + if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[2] - 1) { + TileAltPriority[2] = TaitoF2SpritePriority[i]; + DrawLayer2 = 0; + } + } + } + + TaitoF2MakeSpriteList(); + + if (TC0100SCNBottomLayer(0)) { + for (i = 0; i < 16; i++) { + if (TileAltPriority[0] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TileAltPriority[1] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + } + } else { + for (i = 0; i < 16; i++) { + if (TileAltPriority[0] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TileAltPriority[1] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + } + } + + BurnTransferCopy(TaitoPalette); +} + +static void TaitoF2PivotDraw() +{ + INT32 i; + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + INT32 DrawLayer0 = 1; + INT32 DrawLayer1 = 1; + INT32 DrawLayer2 = 1; + INT32 RozPriority; + + if (TC0100SCNBottomLayer(0)) { + TaitoF2TilePriority[1] = TC0360PRIRegs[5] & 0x0f; + TaitoF2TilePriority[0] = TC0360PRIRegs[5] >> 4; + } else { + TaitoF2TilePriority[0] = TC0360PRIRegs[5] & 0x0f; + TaitoF2TilePriority[1] = TC0360PRIRegs[5] >> 4; + } + TaitoF2TilePriority[2] = TC0360PRIRegs[4] >> 4; + + if (TaitoF2TilePriority[1] < TaitoF2TilePriority[0]) TaitoF2TilePriority[1] = TaitoF2TilePriority[0]; + + TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; + TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; + TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; + TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; + + TaitoF2SpriteBlendMode = TC0360PRIRegs[0] & 0xc0; + + RozPriority = (TC0360PRIRegs[1] & 0xc0) >> 6; + RozPriority = (TC0360PRIRegs[8 + (RozPriority / 2)] >> 4 * (RozPriority & 1)) & 0x0f; + TC0280GRDBaseColour = (TC0360PRIRegs[1] & 0x3f) << 2; + +// bprintf(PRINT_NORMAL, _T("TCBL %x, Blend %x, Roz %x, RozBase %x, T0 %x, T1 %x, T2 %x, S0 %x, S1 %x, S2 %x, S3 %x\n"), TC0100SCNBottomLayer(0), TaitoF2SpriteBlendMode, RozPriority, TaitoRozBaseColour, TaitoF2TilePriority[0], TaitoF2TilePriority[1], TaitoF2TilePriority[2], TaitoF2SpritePriority[0], TaitoF2SpritePriority[1], TaitoF2SpritePriority[2], TaitoF2SpritePriority[3]); + + BurnTransferClear(); + TaitoF2CalcPalette(); + + // Detect when we are using sprite blending with the sprite under the tile layer + UINT8 TileAltPriority[3] = { 0xff, 0xff, 0xff }; + if (TaitoF2SpriteBlendMode) { + for (i = 0; i < 4; i++) { + if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[0] - 1) { + TileAltPriority[0] = TaitoF2SpritePriority[i]; + DrawLayer0 = 0; + } + + if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[1] - 1) { + TileAltPriority[1] = TaitoF2SpritePriority[i]; + DrawLayer1 = 0; + } + + if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[2] - 1) { + TileAltPriority[2] = TaitoF2SpritePriority[i]; + DrawLayer2 = 0; + } + } + } + + TaitoF2MakeSpriteList(); + + if (TC0100SCNBottomLayer(0)) { + for (i = 0; i < 16; i++) { + if (TileAltPriority[0] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TileAltPriority[1] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (RozPriority == i) TC0280GRDRenderLayer(); + if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + } + } else { + for (i = 0; i < 16; i++) { + if (TileAltPriority[0] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TileAltPriority[1] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (RozPriority == i) TC0280GRDRenderLayer(); + if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + } + } + + BurnTransferCopy(TaitoPalette); +} + +static void CameltryDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + INT32 i; + + INT32 RozPriority; + + TaitoF2TilePriority[2] = TC0360PRIRegs[4] >> 4; + + TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; + TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; + TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; + TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; + + RozPriority = (TC0360PRIRegs[1] & 0xc0) >> 6; + RozPriority = (TC0360PRIRegs[8 + (RozPriority / 2)] >> 4 * (RozPriority & 1)) & 0x0f; + TC0280GRDBaseColour = (TC0360PRIRegs[1] & 0x3f) << 2; + + BurnTransferClear(); + TaitoF2CalcPalette(); + + TaitoF2MakeSpriteList(); + + for (i = 0; i < 16; i++) { + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (RozPriority == i) TC0280GRDRenderLayer(); + if (TaitoF2TilePriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + } + + BurnTransferCopy(TaitoPalette); +} + +static void DriftoutDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + INT32 i; + + INT32 RozPriority; + + TaitoF2TilePriority[2] = TC0360PRIRegs[4] >> 4; + + TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; + TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; + TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; + TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; + + RozPriority = (TC0360PRIRegs[1] & 0xc0) >> 6; + RozPriority = (TC0360PRIRegs[8 + (RozPriority / 2)] >> 4 * (RozPriority & 1)) & 0x0f; + TC0280GRDBaseColour = (TC0360PRIRegs[1] & 0x3f) << 2; + + BurnTransferClear(); + QzquestCalcPalette(); + + TaitoF2MakeSpriteList(); + + for (i = 0; i < 16; i++) { + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (RozPriority == i) TC0430GRWRenderLayer(); + if (TaitoF2TilePriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + } + + BurnTransferCopy(TaitoPalette); +} + +static void FinalbDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + + TaitoF2SpritePriority[0] = 0; + TaitoF2SpritePriority[1] = 0; + TaitoF2SpritePriority[2] = 0; + TaitoF2SpritePriority[3] = 0; + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + TaitoF2MakeSpriteList(); + + TaitoF2RenderSpriteList(0); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TC0110PCRPalette); +} + +static void FootchmpDraw() +{ + UINT8 Layer[4]; + UINT16 Priority = TC0480SCPGetBgPriority(); + + Layer[0] = (Priority & 0xf000) >> 12; + Layer[1] = (Priority & 0x0f00) >> 8; + Layer[2] = (Priority & 0x00f0) >> 4; + Layer[3] = (Priority & 0x000f) >> 0; + + TaitoF2TilePriority[0] = TC0360PRIRegs[4] >> 4; + TaitoF2TilePriority[1] = TC0360PRIRegs[5] & 0x0f; + TaitoF2TilePriority[2] = TC0360PRIRegs[5] >> 4; + TaitoF2TilePriority[3] = TC0360PRIRegs[4] & 0x0f; + TaitoF2TilePriority[4] = TC0360PRIRegs[7] >> 4; + + TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; + TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; + TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; + TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; + + BurnTransferClear(); + TaitoF2CalcPalette(); + + TaitoF2MakeSpriteList(); + + for (INT32 i = 0; i < 16; i++) { + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (TaitoF2TilePriority[0] == i) TC0480SCPTilemapRender(Layer[0], 0, TaitoChars); + if (TaitoF2TilePriority[1] == i) TC0480SCPTilemapRender(Layer[1], 0, TaitoChars); + if (TaitoF2TilePriority[2] == i) TC0480SCPTilemapRender(Layer[2], 0, TaitoChars); + if (TaitoF2TilePriority[3] == i) TC0480SCPTilemapRender(Layer[3], 0, TaitoChars); + } + + TC0480SCPRenderCharLayer(); + + BurnTransferCopy(TaitoPalette); +} + +static void MetalbDraw() +{ + UINT8 Layer[4]; + UINT16 Priority = TC0480SCPGetBgPriority(); + + Layer[0] = (Priority & 0xf000) >> 12; + Layer[1] = (Priority & 0x0f00) >> 8; + Layer[2] = (Priority & 0x00f0) >> 4; + Layer[3] = (Priority & 0x000f) >> 0; + + TaitoF2TilePriority[Layer[0]] = TC0360PRIRegs[4] & 0x0f; + TaitoF2TilePriority[Layer[1]] = TC0360PRIRegs[4] >> 4; + TaitoF2TilePriority[Layer[2]] = TC0360PRIRegs[5] & 0x0f; + TaitoF2TilePriority[Layer[3]] = TC0360PRIRegs[5] >> 4; + TaitoF2TilePriority[4] = TC0360PRIRegs[9] & 0x0f; + + if (TaitoF2TilePriority[1] < TaitoF2TilePriority[0]) TaitoF2TilePriority[1] = TaitoF2TilePriority[0]; + if (TaitoF2TilePriority[2] < TaitoF2TilePriority[1]) TaitoF2TilePriority[2] = TaitoF2TilePriority[1]; + if (TaitoF2TilePriority[3] < TaitoF2TilePriority[2]) TaitoF2TilePriority[3] = TaitoF2TilePriority[2]; + + TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; + TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; + TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; + TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; + + TaitoF2SpriteBlendMode = TC0360PRIRegs[0] & 0xc0; + +// bprintf(PRINT_IMPORTANT, _T("SPR Bl %x, T0 %x, T1 %x, T2 %x, T3 %x, T4 %x, S0 %x, S1 %x, S2 %x, S3 %x\n"), TaitoF2SpriteBlendMode, TaitoF2TilePriority[0], TaitoF2TilePriority[1], TaitoF2TilePriority[2], TaitoF2TilePriority[3], TaitoF2TilePriority[4], TaitoF2SpritePriority[0], TaitoF2SpritePriority[1], TaitoF2SpritePriority[2], TaitoF2SpritePriority[3]); +// bprintf(PRINT_NORMAL, _T("L0 %x %x, L1 %x %x, L2 %x %x, L3 %x %x\n"), Layer[0], TaitoF2TilePriority[0], Layer[1], TaitoF2TilePriority[1], Layer[2], TaitoF2TilePriority[2], Layer[3], TaitoF2TilePriority[3]); + + BurnTransferClear(); + MetalbCalcPalette(); + + TaitoF2MakeSpriteList(); + + for (INT32 i = 0; i < 16; i++) { + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (TaitoF2TilePriority[0] == i) TC0480SCPTilemapRender(Layer[0], 0, TaitoChars); + if (TaitoF2TilePriority[1] == i) TC0480SCPTilemapRender(Layer[1], 0, TaitoChars); + if (TaitoF2TilePriority[2] == i) TC0480SCPTilemapRender(Layer[2], 0, TaitoChars); + if (TaitoF2TilePriority[3] == i) TC0480SCPTilemapRender(Layer[3], 0, TaitoChars); + } + + TC0480SCPRenderCharLayer(); + + BurnTransferCopy(TaitoPalette); +} + +static void PulirulaDraw() +{ + INT32 i; + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + INT32 DrawLayer0 = 1; + INT32 DrawLayer1 = 1; + INT32 DrawLayer2 = 1; + INT32 RozPriority; + + if (TC0100SCNBottomLayer(0)) { + TaitoF2TilePriority[1] = TC0360PRIRegs[5] & 0x0f; + TaitoF2TilePriority[0] = TC0360PRIRegs[5] >> 4; + } else { + TaitoF2TilePriority[0] = TC0360PRIRegs[5] & 0x0f; + TaitoF2TilePriority[1] = TC0360PRIRegs[5] >> 4; + } + TaitoF2TilePriority[2] = TC0360PRIRegs[4] >> 4; + + if (TaitoF2TilePriority[1] < TaitoF2TilePriority[0]) TaitoF2TilePriority[1] = TaitoF2TilePriority[0]; + + TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; + TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; + TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; + TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; + + TaitoF2SpriteBlendMode = TC0360PRIRegs[0] & 0xc0; + + RozPriority = (TC0360PRIRegs[1] & 0xc0) >> 6; + RozPriority = (TC0360PRIRegs[8 + (RozPriority / 2)] >> 4 * (RozPriority & 1)) & 0x0f; + TC0280GRDBaseColour = (TC0360PRIRegs[1] & 0x3f) << 2; + + bprintf(PRINT_NORMAL, _T("TCBL %x, Blend %x, Roz %x, RozBase %x, T0 %x, T1 %x, T2 %x, S0 %x, S1 %x, S2 %x, S3 %x\n"), TC0100SCNBottomLayer(0), TaitoF2SpriteBlendMode, RozPriority, TC0280GRDBaseColour, TaitoF2TilePriority[0], TaitoF2TilePriority[1], TaitoF2TilePriority[2], TaitoF2SpritePriority[0], TaitoF2SpritePriority[1], TaitoF2SpritePriority[2], TaitoF2SpritePriority[3]); + + BurnTransferClear(); + QzquestCalcPalette(); + + // Detect when we are using sprite blending with the sprite under the tile layer + UINT8 TileAltPriority[3] = { 0xff, 0xff, 0xff }; + if (TaitoF2SpriteBlendMode) { + for (i = 0; i < 4; i++) { + if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[0] - 1) { + TileAltPriority[0] = TaitoF2SpritePriority[i]; + DrawLayer0 = 0; + } + + if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[1] - 1) { + TileAltPriority[1] = TaitoF2SpritePriority[i]; + DrawLayer1 = 0; + } + + if (TaitoF2SpritePriority[i] == TaitoF2TilePriority[2] - 1) { + TileAltPriority[2] = TaitoF2SpritePriority[i]; + DrawLayer2 = 0; + } + } + } + + TaitoF2MakeSpriteList(); + + if (TC0100SCNBottomLayer(0)) { + for (i = 0; i < 16; i++) { + if (TileAltPriority[0] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TileAltPriority[1] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (RozPriority == i) TC0430GRWRenderLayer(); + if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + } + } else { + for (i = 0; i < 16; i++) { + if (TileAltPriority[0] == i) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TileAltPriority[1] == i) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TileAltPriority[2] == i) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (RozPriority == i) TC0430GRWRenderLayer(); + if (TaitoF2TilePriority[0] == i && DrawLayer0) { if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[1] == i && DrawLayer1) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); } + if (TaitoF2TilePriority[2] == i && DrawLayer2) { if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); } + } + } + + BurnTransferCopy(TaitoPalette); +} + +static void QtorimonDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + + TaitoF2SpritePriority[0] = 0; + TaitoF2SpritePriority[1] = 0; + TaitoF2SpritePriority[2] = 0; + TaitoF2SpritePriority[3] = 0; + + TaitoF2MakeSpriteList(); + + TaitoF2RenderSpriteList(0); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TC0110PCRPalette); +} + +static void QzquestDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + QzquestCalcPalette(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + TaitoF2SpritePriority[0] = 0; + TaitoF2SpritePriority[1] = 0; + TaitoF2SpritePriority[2] = 0; + TaitoF2SpritePriority[3] = 0; + + TaitoF2MakeSpriteList(); + + TaitoF2RenderSpriteList(0); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TaitoPalette); +} + +static void SsiDraw() +{ + BurnTransferClear(); + TaitoF2CalcPalette(); + + TaitoF2SpritePriority[0] = 0; + TaitoF2SpritePriority[1] = 0; + TaitoF2SpritePriority[2] = 0; + TaitoF2SpritePriority[3] = 0; + + TaitoF2MakeSpriteList(); + + TaitoF2RenderSpriteList(0); + + BurnTransferCopy(TaitoPalette); +} + +static void ThundfoxDraw() +{ + INT32 Disable1 = TC0100SCNCtrl[0][6] & 0xf7; + INT32 Disable2 = TC0100SCNCtrl[1][6] & 0xf7; + + BurnTransferClear(); + TaitoF2CalcPalette(); + + INT32 TilePri[2][3]; + INT32 Layer[2][3]; + + TaitoF2MakeSpriteList(); + + Layer[0][0] = TC0100SCNBottomLayer(0); + Layer[0][1] = Layer[0][0] ^ 1; + Layer[0][2] = 2; + TilePri[0][Layer[0][0]] = TC0360PRIRegs[5] & 0x0f; + TilePri[0][Layer[0][1]] = TC0360PRIRegs[5] >> 4; + TilePri[0][Layer[0][2]] = TC0360PRIRegs[4] >> 4; + + Layer[1][0] = TC0100SCNBottomLayer(1); + Layer[1][1] = Layer[1][0] ^ 1; + Layer[1][2] = 2; + TilePri[1][Layer[1][0]] = TC0360PRIRegs[9] & 0x0f; + TilePri[1][Layer[1][1]] = TC0360PRIRegs[9] >> 4; + TilePri[1][Layer[1][2]] = TC0360PRIRegs[8] >> 4; + + TaitoF2SpritePriority[0] = TC0360PRIRegs[6] & 0x0f; + TaitoF2SpritePriority[1] = TC0360PRIRegs[6] >> 4; + TaitoF2SpritePriority[2] = TC0360PRIRegs[7] & 0x0f; + TaitoF2SpritePriority[3] = TC0360PRIRegs[7] >> 4; + +// bprintf(PRINT_NORMAL, _T("Layer0-0 %x, Layer 0-1 %x, Layer 0-2 %x, Layer1-0 %x, Layer 1-1 %x, Layer 1-2 %x, Sprite 0 %x, Sprite 1 %x, Sprite 2 %x, Sprite 3 %x\n"), TilePri[0][0], TilePri[0][1], TilePri[0][2], TilePri[1][0], TilePri[1][1], TilePri[1][2], TaitoF2SpritePriority[0], TaitoF2SpritePriority[1], TaitoF2SpritePriority[2], TaitoF2SpritePriority[3]); + + for (INT32 i = 0; i < 16; i++) { + if (TilePri[1][0] == i) { + if (TC0100SCNBottomLayer(1)) { + if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoCharsB); + } else { + if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoCharsB); + } + } + if (TilePri[0][0] == i) { + if (TC0100SCNBottomLayer(0)) { + if (!(Disable1 & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } else { + if (!(Disable1 & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } + } + if (TilePri[1][1] == i) { + if (!TC0100SCNBottomLayer(1)) { + if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoCharsB); + } else { + if (!(Disable2 & 0x01)) TC0100SCNRenderBgLayer(1, 0, TaitoCharsB); + } + } + if (TilePri[0][1] == i) { + if (!TC0100SCNBottomLayer(0)) { + if (!(Disable1 & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } else { + if (!(Disable1 & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } + } + if (TaitoF2SpritePriority[3] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[3]); + if (TaitoF2SpritePriority[2] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[2]); + if (TaitoF2SpritePriority[1] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[1]); + if (TaitoF2SpritePriority[0] == i) TaitoF2RenderSpriteList(TaitoF2SpritePriority[0]); + if (TilePri[1][2] == i) { if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); } + if (TilePri[0][2] == i) { if (!(Disable1 & 0x04)) TC0100SCNRenderCharLayer(0); } + } + + BurnTransferCopy(TaitoPalette); +} + +static void YuyugogoDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + TaitoF2CalcPalette(); + + TaitoF2SpritePriority[0] = 0; + TaitoF2SpritePriority[1] = 0; + TaitoF2SpritePriority[2] = 0; + TaitoF2SpritePriority[3] = 0; + + TaitoF2MakeSpriteList(); + + TaitoF2RenderSpriteList(0); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TaitoPalette); +} + +static INT32 TaitoF2Frame() +{ + INT32 nInterleave = 10; + + if (TaitoReset) TaitoF2DoReset(); + + if (TaitoIC_TC0220IOCInUse) { + TC0220IOCMakeInputs(); + } else { + if (TaitoIC_TC0510NIOInUse) { + TC0510NIOMakeInputs(); + } else { + TaitoF2MakeInputs(); + } + } + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 #1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + if (i == 9) nTaitoCyclesSegment -= 500; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == 9) { + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + nTaitoCyclesDone[nCurrentCPU] += SekRun(500); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + } + SekClose(); + + nCurrentCPU = 1; + ZetOpen(0); + BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrame(nTaitoCyclesTotal[1]); + if (pBurnSoundOut) { + if (TaitoNumYM2610) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + if (TaitoNumYM2203) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + if (TaitoNumMSM6295) MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + TaitoF2HandleSpriteBuffering(); + + if (pBurnDraw) TaitoDrawFunction(); + + TaitoF2SpriteBufferFunction(); + + return 0; +} + +static INT32 DriveoutFrame() +{ + INT32 nInterleave = 10; + + if (TaitoReset) TaitoF2DoReset(); + + if (TaitoIC_TC0220IOCInUse) { + TC0220IOCMakeInputs(); + } else { + if (TaitoIC_TC0510NIOInUse) { + TC0510NIOMakeInputs(); + } else { + TaitoF2MakeInputs(); + } + } + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 #1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + if (i == 9) nTaitoCyclesSegment -= 500; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == 9) { + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + nTaitoCyclesDone[nCurrentCPU] += SekRun(500); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + } + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); + nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; + ZetClose(); + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + MSM6295Render(0, pBurnSoundOut, nBurnSoundLen); + } + + TaitoF2HandleSpriteBuffering(); + + if (pBurnDraw) TaitoDrawFunction(); + + TaitoF2SpriteBufferFunction(); + + return 0; +} + +static INT32 TaitoF2Scan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029682; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = TaitoRamStart; + ba.nLen = TaitoRamEnd-TaitoRamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + TaitoICScan(nAction); + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + BurnYM2610Scan(nAction, pnMin); + + SCAN_VAR(TaitoInput); + SCAN_VAR(TaitoZ80Bank); + SCAN_VAR(TaitoF2SpriteBank); + SCAN_VAR(TaitoF2SpriteBankBuffered); + SCAN_VAR(nTaitoCyclesDone); + SCAN_VAR(nTaitoCyclesSegment); + SCAN_VAR(YesnoDip); + SCAN_VAR(MjnquestInput); + SCAN_VAR(DriveoutSoundNibble); + SCAN_VAR(DriveoutOkiBank); + } + + if (nAction & ACB_WRITE) { + if (TaitoZ80Bank) { + ZetOpen(0); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetClose(); + } + + if (DriveoutOkiBank) { + memcpy(MSM6295ROM, TaitoMSM6295Rom + (DriveoutOkiBank * 0x40000), 0x40000); + } + + TaitoF2SpriteBufferFunction(); + TaitoF2HandleSpriteBuffering(); + } + + return 0; +} + +struct BurnDriver BurnDrvCameltry = { + "cameltry", NULL, NULL, NULL, "1989", + "Cameltry (US, YM2610)\0", NULL, "Taito America Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_MAZE, 0, + NULL, CameltryRomInfo, CameltryRomName, NULL, NULL, CameltryInputInfo, CameltryDIPInfo, + CameltryInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvCameltryau = { + "cameltryau", "cameltry", NULL, NULL, "1989", + "Cameltry (World, YM2203 + M6295)\0", NULL, "Taito America Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_MAZE, 0, + NULL, CameltryauRomInfo, CameltryauRomName, NULL, NULL, CameltryInputInfo, CameltryDIPInfo, + CamltryaInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvCameltrya = { + "cameltrya", "cameltry", NULL, NULL, "1989", + "Cameltry (US, YM2203 + M6295)\0", NULL, "Taito America Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_MAZE, 0, + NULL, CameltryaRomInfo, CameltryaRomName, NULL, NULL, CameltryInputInfo, CameltryDIPInfo, + CamltryaInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvCameltryj = { + "cameltryj", "cameltry", NULL, NULL, "1989", + "Cameltry (Japan, YM2610)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_MAZE, 0, + NULL, CameltryjRomInfo, CameltryjRomName, NULL, NULL, CameltryInputInfo, CameltrjDIPInfo, + CameltryInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDeadconx = { + "deadconx", NULL, NULL, NULL, "1992", + "Dead Connection (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_SHOOT, 0, + NULL, DeadconxRomInfo, DeadconxRomName, NULL, NULL, DeadconxInputInfo, DeadconxDIPInfo, + DeadconxInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDeadconxj = { + "deadconxj", "deadconx", NULL, NULL, "1992", + "Dead Connection (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_SHOOT, 0, + NULL, DeadconxjRomInfo, DeadconxjRomName, NULL, NULL, DeadconxInputInfo, DeadconxjDIPInfo, + DeadconxInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDinorex = { + "dinorex", NULL, NULL, NULL, "1992", + "Dino Rex (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, + NULL, DinorexRomInfo, DinorexRomName, NULL, NULL, DinorexInputInfo, DinorexDIPInfo, + DinorexInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDinorexj = { + "dinorexj", "dinorex", NULL, NULL, "1992", + "Dino Rex (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, + NULL, DinorexjRomInfo, DinorexjRomName, NULL, NULL, DinorexInputInfo, DinorexjDIPInfo, + DinorexInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDinorexu = { + "dinorexu", "dinorex", NULL, NULL, "1992", + "Dino Rex (US)\0", NULL, "Taito America Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, + NULL, DinorexuRomInfo, DinorexuRomName, NULL, NULL, DinorexInputInfo, DinorexDIPInfo, + DinorexInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDondokod = { + "dondokod", NULL, NULL, NULL, "1989", + "Don Doko Don (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, + NULL, DondokodRomInfo, DondokodRomName, NULL, NULL, DondokodInputInfo, DondokodDIPInfo, + DondokodInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDondokodj = { + "dondokodj", "dondokod", NULL, NULL, "1989", + "Don Doko Don (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, + NULL, DondokodjRomInfo, DondokodjRomName, NULL, NULL, DondokodInputInfo, DondokodjDIPInfo, + DondokodInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDondokodu = { + "dondokodu", "dondokod", NULL, NULL, "1989", + "Don Doko Don (US)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, + NULL, DondokoduRomInfo, DondokoduRomName, NULL, NULL, DondokodInputInfo, DondokoduDIPInfo, + DondokodInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDriftout = { + "driftout", NULL, NULL, NULL, "1991", + "Drift Out (Europe)\0", NULL, "Visco (Europe)", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOF2, GBF_RACING, 0, + NULL, DriftoutRomInfo, DriftoutRomName, NULL, NULL, DriftoutInputInfo, DriftoutDIPInfo, + DriftoutInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvDriftoutj = { + "driftoutj", "driftout", NULL, NULL, "1991", + "Drift Out (Japan)\0", NULL, "Visco (Japan)", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_RACING, 0, + NULL, DriftoutjRomInfo, DriftoutjRomName, NULL, NULL, DriftoutInputInfo, DriftoutDIPInfo, + DriftoutInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvDriveout = { + "driveout", "driftout", NULL, NULL, "1991", + "Drive Out\0", NULL, "bootleg", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_TAITOF2, GBF_RACING, 0, + NULL, DriveoutRomInfo, DriveoutRomName, NULL, NULL, DriftoutInputInfo, DriftoutDIPInfo, + DriveoutInit, TaitoF2Exit, DriveoutFrame, NULL, TaitoF2Scan, + NULL, 0x2000, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvFinalb = { + "finalb", NULL, NULL, NULL, "1988", + "Final Blow (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, + NULL, FinalbRomInfo, FinalbRomName, NULL, NULL, FinalbInputInfo, FinalbDIPInfo, + FinalbInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFinalbj = { + "finalbj", "finalb", NULL, NULL, "1988", + "Final Blow (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, + NULL, FinalbjRomInfo, FinalbjRomName, NULL, NULL, FinalbInputInfo, FinalbjDIPInfo, + FinalbInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFinalbu = { + "finalbu", "finalb", NULL, NULL, "1988", + "Final Blow (US)\0", NULL, "Taito America Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, + NULL, FinalbuRomInfo, FinalbuRomName, NULL, NULL, FinalbInputInfo, FinalbjDIPInfo, + FinalbInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvFootchmp = { + "footchmp", NULL, NULL, NULL, "1990", + "Football Champ (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_TAITO_TAITOF2, GBF_SPORTSFOOTBALL, 0, + NULL, FootchmpRomInfo, FootchmpRomName, NULL, NULL, FootchmpInputInfo, FootchmpDIPInfo, + FootchmpInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvHthero = { + "hthero", "footchmp", NULL, NULL, "1990", + "Hat Trick Hero (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SPORTSFOOTBALL, 0, + NULL, HtheroRomInfo, HtheroRomName, NULL, NULL, FootchmpInputInfo, HtheroDIPInfo, + FootchmpInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvEuroch92 = { + "euroch92", "footchmp", NULL, NULL, "1992", + "Euro Champ '92 (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SPORTSFOOTBALL, 0, + NULL, Euroch92RomInfo, Euroch92RomName, NULL, NULL, FootchmpInputInfo, FootchmpDIPInfo, + FootchmpInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGrowl = { + "growl", NULL, NULL, NULL, "1990", + "Growl (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, GrowlRomInfo, GrowlRomName, NULL, NULL, GrowlInputInfo, GrowlDIPInfo, + GrowlInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGrowlu = { + "growlu", "growl", NULL, NULL, "1990", + "Growl (US)\0", NULL, "Taito America Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, GrowluRomInfo, GrowluRomName, NULL, NULL, GrowlInputInfo, GrowluDIPInfo, + GrowlInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvRunark = { + "runark", "growl", NULL, NULL, "1990", + "Runark (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, RunarkRomInfo, RunarkRomName, NULL, NULL, GrowlInputInfo, RunarkDIPInfo, + GrowlInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvGunfront = { + "gunfront", NULL, NULL, NULL, "1990", + "Gun & Frontier (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOF2, GBF_VERSHOOT, 0, + NULL, GunfrontRomInfo, GunfrontRomName, NULL, NULL, GunfrontInputInfo, GunfrontDIPInfo, + GunfrontInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvGunfrontj = { + "gunfrontj", "gunfront", NULL, NULL, "1990", + "Gun Frontier (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOF2, GBF_VERSHOOT, 0, + NULL, GunfrontjRomInfo, GunfrontjRomName, NULL, NULL, GunfrontInputInfo, GunfrontjDIPInfo, + GunfrontInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvKoshien = { + "koshien", NULL, NULL, NULL, "1990", + "Ah Eikou no Koshien (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + L"\u7532\u5B50\u5712 \u6804\u5149\u306E \u55DA\u547C (Japan)\0Ah Eikou no Koshien\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_SPORTSMISC, 0, + NULL, KoshienRomInfo, KoshienRomName, NULL, NULL, KoshienInputInfo, KoshienDIPInfo, + KoshienInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvLiquidk = { + "liquidk", NULL, NULL, NULL, "1990", + "Liquid Kids (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, + NULL, LiquidkRomInfo, LiquidkRomName, NULL, NULL, LiquidkInputInfo, LiquidkDIPInfo, + LiquidkInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvLiquidku = { + "liquidku", "liquidk", NULL, NULL, "1990", + "Liquid Kids (US)\0", NULL, "Taito America Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, + NULL, LiquidkuRomInfo, LiquidkuRomName, NULL, NULL, LiquidkInputInfo, LiquidkuDIPInfo, + LiquidkInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMizubaku = { + "mizubaku", "liquidk", NULL, NULL, "1990", + "Mizubaku Daibouken (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + L"\u30DF\u30BA\u30D0\u30AF \u5927\u5192\u967A \u30A2\u30C9\u30D9\u30F3\u30C1\u30E3\u30FC (Japan)\0Mizubaku Daibouken\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_PLATFORM, 0, + NULL, MizubakuRomInfo, MizubakuRomName, NULL, NULL, LiquidkInputInfo, LiquidkuDIPInfo, + LiquidkInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMegablst = { + "megablst", NULL, NULL, NULL, "1989", + "Mega Blast (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_HORSHOOT, 0, + NULL, MegablstRomInfo, MegablstRomName, NULL, NULL, MegablstInputInfo, MegablstDIPInfo, + MegablstInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMegablstj = { + "megablstj", "megablst", NULL, NULL, "1989", + "Mega Blast (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_HORSHOOT, 0, + NULL, MegablstjRomInfo, MegablstjRomName, NULL, NULL, MegablstInputInfo, MegablstjDIPInfo, + MegablstInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMegablstu = { + "megablstu", "megablst", NULL, NULL, "1989", + "Mega Blast (US)\0", NULL, "Taito America Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_HORSHOOT, 0, + NULL, MegablstuRomInfo, MegablstuRomName, NULL, NULL, MegablstInputInfo, MegablstuDIPInfo, + MegablstInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMetalb = { + "metalb", NULL, NULL, NULL, "1991", + "Metal Black (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_HORSHOOT, 0, + NULL, MetalbRomInfo, MetalbRomName, NULL, NULL, MetalbInputInfo, MetalbDIPInfo, + MetalbInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMetalbj = { + "metalbj", "metalb", NULL, NULL, "1991", + "Metal Black (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_HORSHOOT, 0, + NULL, MetalbjRomInfo, MetalbjRomName, NULL, NULL, MetalbInputInfo, MetalbjDIPInfo, + MetalbInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMjnquest = { + "mjnquest", NULL, NULL, NULL, "1990", + "Mahjong Quest (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_MAHJONG, 0, + NULL, MjnquestRomInfo, MjnquestRomName, NULL, NULL, MjnquestInputInfo, MjnquestDIPInfo, + MjnquestInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvMjnquestb = { + "mjnquestb", "mjnquest", NULL, NULL, "1990", + "Mahjong Quest (No Nudity)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_MAHJONG, 0, + NULL, MjnquestbRomInfo, MjnquestbRomName, NULL, NULL, MjnquestInputInfo, MjnquestDIPInfo, + MjnquestInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNinjak = { + "ninjak", NULL, NULL, NULL, "1990", + "The Ninja Kids (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, NinjakRomInfo, NinjakRomName, NULL, NULL, NinjakInputInfo, NinjakDIPInfo, + NinjakInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNinjakj = { + "ninjakj", "ninjak", NULL, NULL, "1990", + "The Ninja Kids (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, NinjakjRomInfo, NinjakjRomName, NULL, NULL, NinjakInputInfo, NinjakjDIPInfo, + NinjakInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNinjaku = { + "ninjaku", "ninjak", NULL, NULL, "1990", + "The Ninja Kids (US)\0", NULL, "Taito America Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, NinjakuRomInfo, NinjakuRomName, NULL, NULL, NinjakInputInfo, NinjakuDIPInfo, + NinjakInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPulirula = { + "pulirula", NULL, NULL, NULL, "1991", + "PuLiRuLa (World)\0", "Some priority problems", "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, PulirulaRomInfo, PulirulaRomName, NULL, NULL, PulirulaInputInfo, PulirulaDIPInfo, + PulirulaInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvPulirulaj = { + "pulirulaj", "pulirula", NULL, NULL, "1991", + "PuLiRuLa (Japan)\0", "Some priority problems", "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, PulirulajRomInfo, PulirulajRomName, NULL, NULL, PulirulaInputInfo, PulirulajDIPInfo, + PulirulaInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQcrayon = { + "qcrayon", NULL, NULL, NULL, "1993", + "Quiz Crayon Shinchan (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + L"\u30AF\u30A4\u30BA \u30AF\u30EC\u30E8\u30F3\u3057\u3093\u3061\u3083\u3093 (Japan)\0Quiz Crayon Shinchan\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, + NULL, QcrayonRomInfo, QcrayonRomName, NULL, NULL, QcrayonInputInfo, QcrayonDIPInfo, + QcrayonInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQcrayon2 = { + "qcrayon2", NULL, NULL, NULL, "1993", + "Crayon Shinchan Orato Asobo (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + L"\u30AF\u30EC\u30E8\u30F3\u3057\u3093\u3061\u3083\u3093 \u30AA\u30E9\u3068\u904A\u307C (Japan)\0Crayon Shinchan Orato Asobo\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, + NULL, Qcrayon2RomInfo, Qcrayon2RomName, NULL, NULL, Qcrayon2InputInfo, Qcrayon2DIPInfo, + Qcrayon2Init, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQjinsei = { + "qjinsei", NULL, NULL, NULL, "1992", + "Quiz Jinsei Gekijoh (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + L"\u30AF\u30A4\u30BA \u4EBA\u751F\u5287\u5834 (Japan)\0Quiz Jinsei Gekijoh\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, + NULL, QjinseiRomInfo, QjinseiRomName, NULL, NULL, QjinseiInputInfo, QjinseiDIPInfo, + QjinseiInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQtorimon = { + "qtorimon", NULL, NULL, NULL, "1990", + "Quiz Torimonochou (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + L"\u304F\u3044\u305A \u82E6\u80C3\u982D \u6355\u7269\u5E33 (Japan)\0Quiz Torimonochou\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, + NULL, QtorimonRomInfo, QtorimonRomName, NULL, NULL, QtorimonInputInfo, QtorimonDIPInfo, + QtorimonInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x800, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQuizhq = { + "quizhq", NULL, NULL, NULL, "1990", + "Quiz H.Q. (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, + NULL, QuizhqRomInfo, QuizhqRomName, NULL, NULL, QuizhqInputInfo, QuizhqDIPInfo, + QuizhqInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQzchikyu = { + "qzchikyu", NULL, NULL, NULL, "1991", + "Quiz Chikyu Bouei Gun (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + L"\u30AF\u30A4\u30BA \u5730\u7403\u9632\u885B\u8ECD (Japan)\0Quiz Chikyu Bouei Gun\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, + NULL, QzchikyuRomInfo, QzchikyuRomName, NULL, NULL, QzchikyuInputInfo, QzchikyuDIPInfo, + QzchikyuInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvQzquest = { + "qzquest", NULL, NULL, NULL, "1991", + "Quiz Quest - Hime to Yuusha no Monogatari (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + L"\u30AF\u30A4\u30BA \u30AF\u30A8\u30B9\u30C8 \uFF0D\u59EB\u3068\u52C7\u8005\u306E\u7269\u8A9E\uFF0D (Japan)\0Quiz Quest - Hime to Yuusha no Monogatari\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, + NULL, QzquestRomInfo, QzquestRomName, NULL, NULL, QzquestInputInfo, QzquestDIPInfo, + QzquestInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSolfigtr = { + "solfigtr", NULL, NULL, NULL, "1991", + "Solitary Fighter (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_VSFIGHT, 0, + NULL, SolfigtrRomInfo, SolfigtrRomName, NULL, NULL, SolfigtrInputInfo, SolfigtrDIPInfo, + SolfigtrInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvSsi = { + "ssi", NULL, NULL, NULL, "1990", + "Super Space Invaders '91 (World)\0", NULL, "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOF2, GBF_SHOOT, 0, + NULL, SsiRomInfo, SsiRomName, NULL, NULL, SsiInputInfo, SsiDIPInfo, + SsiInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvMajest12 = { + "majest12", "ssi", NULL, NULL, "1990", + "Majestic Twelve - The Space Invaders Part IV (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOF2, GBF_SHOOT, 0, + NULL, Majest12RomInfo, Majest12RomName, NULL, NULL, SsiInputInfo, Majest12DIPInfo, + SsiInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 224, 320, 3, 4 +}; + +struct BurnDriver BurnDrvThundfox = { + "thundfox", NULL, NULL, NULL, "1990", + "Thunder Fox (World)\0", "NULL", "Taito Corporation Japan", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, ThundfoxRomInfo, ThundfoxRomName, NULL, NULL, ThundfoxInputInfo, ThundfoxDIPInfo, + ThundfoxInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvThundfoxj = { + "thundfoxj", "thundfox", NULL, NULL, "1990", + "Thunder Fox (Japan)\0", "NULL", "Taito Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, ThundfoxjRomInfo, ThundfoxjRomName, NULL, NULL, ThundfoxInputInfo, ThundfoxjDIPInfo, + ThundfoxInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvThundfoxu = { + "thundfoxu", "thundfox", NULL, NULL, "1990", + "Thunder Fox (US)\0", "NULL", "Taito America Corporation", "Taito-F2", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOF2, GBF_SCRFIGHT, 0, + NULL, ThundfoxuRomInfo, ThundfoxuRomName, NULL, NULL, ThundfoxInputInfo, ThundfoxuDIPInfo, + ThundfoxInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvYesnoj = { + "yesnoj", NULL, NULL, NULL, "1992", + "Yes/No Sinri Tokimeki Chart\0", NULL, "Taito Corporation", "Taito-F2", + L"\uFF39\uFF45\uFF53.\uFF2E\uFF4F \u5FC3\u7406 \u30C8\u30AD\u30E1\u30AD\u30C1\u30E3\u30FC\u30C8\0Yes/No Sinri Tokimeki Chart\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, + NULL, YesnojRomInfo, YesnojRomName, NULL, NULL, YesnojInputInfo, YesnojDIPInfo, + YesnojInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvYuyugogo = { + "yuyugogo", NULL, NULL, NULL, "1990", + "Yuuyu no Quiz de GO!GO! (Japan)\0", NULL, "Taito Corporation", "Taito-F2", + L"\u3086\u3046\u3086 \u306E\u30AF\u30A4\u30BA\u3067 \uFF27\uFF4F!\uFF27\uFF4F! (Japan)\0Yuuyu no Quiz de GO!GO!\0", NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOF2, GBF_QUIZ, 0, + NULL, YuyugogoRomInfo, YuyugogoRomName, NULL, NULL, YuyugogoInputInfo, YuyugogoDIPInfo, + YuyugogoInit, TaitoF2Exit, TaitoF2Frame, NULL, TaitoF2Scan, + NULL, 0x2000, 320, 224, 4, 3 +}; diff --git a/src/burn/drv/taito/d_taitomisc.cpp b/src/burn/drv/taito/d_taitomisc.cpp index d7e5d655f..073e7492d 100644 --- a/src/burn/drv/taito/d_taitomisc.cpp +++ b/src/burn/drv/taito/d_taitomisc.cpp @@ -1,6129 +1,6119 @@ -// PC080SN & PC090OJ based games - -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "taito.h" -#include "taito_ic.h" -#include "msm5205.h" -#include "burn_ym2151.h" -#include "burn_ym2203.h" -#include "burn_gun.h" - -static UINT32 RastanADPCMPos; -static INT32 RastanADPCMData; -static UINT8 OpwolfADPCM_B[0x08]; -static UINT8 OpwolfADPCM_C[0x08]; -static UINT32 OpwolfADPCMPos[2]; -static UINT32 OpwolfADPCMEnd[2]; -static INT32 OpwolfADPCMData[2]; -static INT32 OpWolfGunXOffset; -static INT32 OpWolfGunYOffset; - -static UINT8 DariusADPCMCommand; -static INT32 DariusNmiEnable; -static UINT16 DariusCoinWord; -static UINT32 DariusDefVol[0x10]; -static UINT8 DariusVol[8]; -static UINT8 DariusPan[5]; -static double DariusYM2203AY8910RouteMasterVol; -static double DariusYM2203RouteMasterVol; -static double DariusMSM5205RouteMasterVol; - -static UINT16 VolfiedVidCtrl; -static UINT16 VolfiedVidMask; - -static UINT16 *pTopspeedTempDraw = NULL; - -static void DariusDraw(); -static void OpwolfDraw(); -static void RbislandDraw(); -static void JumpingDraw(); -static void RastanDraw(); -static void TopspeedDraw(); -static void VolfiedDraw(); - -#define A(a, b, c, d) {a, b, (UINT8*)(c), d} - -static struct BurnInputInfo DariusInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort2 + 2, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort2 + 3, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort2 + 4, "service" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 5, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Darius) - -static struct BurnInputInfo OpwolfInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort0 + 1, "p2 coin" }, - - A("P1 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "mouse x-axis" ), - A("P1 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "mouse y-axis" ), - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 0, "mouse button 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 1, "mouse button 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort1 + 2, "service" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort1 + 3, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Opwolf) - -static struct BurnInputInfo RbislandInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort1 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , TaitoInputPort2 + 4, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TaitoInputPort2 + 5, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort2 + 6, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort2 + 7, "p1 fire 2" }, - - {"P2 Left" , BIT_DIGITAL , TaitoInputPort3 + 4, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TaitoInputPort3 + 5, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort3 + 6, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort3 + 7, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort0 + 7, "service" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Rbisland) - -static struct BurnInputInfo JumpingInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort0 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p2 start" }, - - {"P1 Left" , BIT_DIGITAL , TaitoInputPort1 + 7, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TaitoInputPort1 + 6, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 1, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 2, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Jumping) - -static struct BurnInputInfo RastanInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort3 + 5, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort3 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort3 + 6, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort3 + 4, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, - - {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort3 + 0, "service" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort3 + 2, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Rastan) - -static struct BurnInputInfo TopspeedInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p2 coin" }, - - A("P1 Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p1 fire 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 fire 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 fire 3" }, - {"P1 Fire 4" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p1 fire 4" }, - {"P1 Fire 5" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p1 fire 5" }, - {"P1 Fire 6" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 6" }, - {"P1 Fire 7" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p1 fire 7" }, - {"P1 Fire 8" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 fire 8" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Topspeed) - -static struct BurnInputInfo VolfiedInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TaitoInputPort1 + 0, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p2 start" }, - - {"P1 Up" , BIT_DIGITAL , TaitoInputPort2 + 2, "p1 up" }, - {"P1 Down" , BIT_DIGITAL , TaitoInputPort2 + 3, "p1 down" }, - {"P1 Left" , BIT_DIGITAL , TaitoInputPort2 + 4, "p1 left" }, - {"P1 Right" , BIT_DIGITAL , TaitoInputPort2 + 5, "p1 right" }, - {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort2 + 6, "p1 fire 1" }, - - {"P2 Up" , BIT_DIGITAL , TaitoInputPort3 + 1, "p2 up" }, - {"P2 Down" , BIT_DIGITAL , TaitoInputPort3 + 2, "p2 down" }, - {"P2 Left" , BIT_DIGITAL , TaitoInputPort3 + 3, "p2 left" }, - {"P2 Right" , BIT_DIGITAL , TaitoInputPort3 + 4, "p2 right" }, - {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort3 + 5, "p2 fire 1" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TaitoInputPort0 + 7, "service" }, - {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Volfied) - -#undef A - -static void DariusMakeInputs() -{ - // Reset Inputs - TaitoInput[0] = 0xff; - TaitoInput[1] = 0xff; - TaitoInput[2] = 0xfc; - TaitoInput[3] = 0xff; - - if (TaitoInputPort0[0]) TaitoInput[0] -= 0x01; - if (TaitoInputPort0[1]) TaitoInput[0] -= 0x02; - if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; - if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; - if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; - if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; - if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; - if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; - - if (TaitoInputPort1[0]) TaitoInput[1] -= 0x01; - if (TaitoInputPort1[1]) TaitoInput[1] -= 0x02; - if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; - if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; - if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; - if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; - if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; - if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; - - if (TaitoInputPort2[0]) TaitoInput[2] |= 0x01; - if (TaitoInputPort2[1]) TaitoInput[2] |= 0x02; - if (TaitoInputPort2[2]) TaitoInput[2] -= 0x04; - if (TaitoInputPort2[3]) TaitoInput[2] -= 0x08; - if (TaitoInputPort2[4]) TaitoInput[2] -= 0x10; - if (TaitoInputPort2[5]) TaitoInput[2] -= 0x20; - if (TaitoInputPort2[6]) TaitoInput[2] -= 0x40; - if (TaitoInputPort2[7]) TaitoInput[2] -= 0x80; -} - -static void OpwolfMakeInputs() -{ - // Reset Inputs - TaitoInput[0] = 0xfc; - TaitoInput[1] = 0xff; - TaitoInput[2] = 0xff; - TaitoInput[3] = 0xff; - - if (TaitoInputPort0[0]) TaitoInput[0] |= 0x01; - if (TaitoInputPort0[1]) TaitoInput[0] |= 0x02; - if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; - if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; - if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; - if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; - if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; - if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; - - if (TaitoInputPort1[0]) TaitoInput[1] -= 0x01; - if (TaitoInputPort1[1]) TaitoInput[1] -= 0x02; - if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; - if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; - if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; - if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; - if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; - if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; - - BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); - - OpwolfCChipUpdate(TaitoInput[0], TaitoInput[1]); -} - -static void OpwolfbMakeInputs() -{ - // Reset Inputs - TaitoInput[0] = 0xfc; - TaitoInput[1] = 0xff; - TaitoInput[2] = 0xff; - TaitoInput[3] = 0xff; - - if (TaitoInputPort0[0]) TaitoInput[0] |= 0x01; - if (TaitoInputPort0[1]) TaitoInput[0] |= 0x02; - if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; - if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; - if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; - if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; - if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; - if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; - - if (TaitoInputPort1[0]) TaitoInput[1] -= 0x01; - if (TaitoInputPort1[1]) TaitoInput[1] -= 0x02; - if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; - if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; - if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; - if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; - if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; - if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; - - BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); -} - -static void RbislandMakeInputs() -{ - // Reset Inputs - TaitoInput[0] = 0xff; - TaitoInput[1] = 0xfc; - TaitoInput[2] = 0xff; - TaitoInput[3] = 0xff; - - if (TaitoInputPort0[0]) TaitoInput[0] -= 0x01; - if (TaitoInputPort0[1]) TaitoInput[0] -= 0x02; - if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; - if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; - if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; - if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; - if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; - if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; - - if (TaitoInputPort1[0]) TaitoInput[1] |= 0x01; - if (TaitoInputPort1[1]) TaitoInput[1] |= 0x02; - if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; - if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; - if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; - if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; - if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; - if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; - - if (TaitoInputPort2[0]) TaitoInput[2] -= 0x01; - if (TaitoInputPort2[1]) TaitoInput[2] -= 0x02; - if (TaitoInputPort2[2]) TaitoInput[2] -= 0x04; - if (TaitoInputPort2[3]) TaitoInput[2] -= 0x08; - if (TaitoInputPort2[4]) TaitoInput[2] -= 0x10; - if (TaitoInputPort2[5]) TaitoInput[2] -= 0x20; - if (TaitoInputPort2[6]) TaitoInput[2] -= 0x40; - if (TaitoInputPort2[7]) TaitoInput[2] -= 0x80; - - if (TaitoInputPort3[0]) TaitoInput[3] -= 0x01; - if (TaitoInputPort3[1]) TaitoInput[3] -= 0x02; - if (TaitoInputPort3[2]) TaitoInput[3] -= 0x04; - if (TaitoInputPort3[3]) TaitoInput[3] -= 0x08; - if (TaitoInputPort3[4]) TaitoInput[3] -= 0x10; - if (TaitoInputPort3[5]) TaitoInput[3] -= 0x20; - if (TaitoInputPort3[6]) TaitoInput[3] -= 0x40; - if (TaitoInputPort3[7]) TaitoInput[3] -= 0x80; - - RainbowCChipUpdate(TaitoInput[0], TaitoInput[1], TaitoInput[2], TaitoInput[3]); -} - -static void JumpingMakeInputs() -{ - // Reset Inputs - TaitoInput[0] = 0xff; - TaitoInput[1] = 0xff; - TaitoInput[2] = 0xff; - TaitoInput[3] = 0xff; - - if (TaitoInputPort0[0]) TaitoInput[0] -= 0x01; - if (TaitoInputPort0[1]) TaitoInput[0] -= 0x02; - if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; - if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; - if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; - if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; - if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; - if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; - - if (TaitoInputPort1[0]) TaitoInput[1] -= 0x01; - if (TaitoInputPort1[1]) TaitoInput[1] -= 0x02; - if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; - if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; - if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; - if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; - if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; - if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; -} - -static void RastanMakeInputs() -{ - // Reset Inputs - TaitoInput[0] = 0xff; - TaitoInput[1] = 0xff; - TaitoInput[2] = 0x8f; - TaitoInput[3] = 0x1f; - - if (TaitoInputPort0[0]) TaitoInput[0] -= 0x01; - if (TaitoInputPort0[1]) TaitoInput[0] -= 0x02; - if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; - if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; - if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; - if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; - if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; - if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; - - if (TaitoInputPort1[0]) TaitoInput[1] -= 0x01; - if (TaitoInputPort1[1]) TaitoInput[1] -= 0x02; - if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; - if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; - if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; - if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; - if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; - if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; - - if (TaitoInputPort3[0]) TaitoInput[3] -= 0x01; - if (TaitoInputPort3[1]) TaitoInput[3] -= 0x02; - if (TaitoInputPort3[2]) TaitoInput[3] -= 0x04; - if (TaitoInputPort3[3]) TaitoInput[3] -= 0x08; - if (TaitoInputPort3[4]) TaitoInput[3] -= 0x10; - if (TaitoInputPort3[5]) TaitoInput[3] |= 0x20; - if (TaitoInputPort3[6]) TaitoInput[3] |= 0x40; - if (TaitoInputPort3[7]) TaitoInput[3] |= 0x80; -} - -static void TopspeedMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0x13; - TC0220IOCInput[1] = 0x0f; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] |= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] |= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] |= 0x80; - - if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; - if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; - if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; - if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; - if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] |= 0x10; - if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] |= 0x20; - if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] |= 0x40; - if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] |= 0x80; - - if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; - if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; - if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; - if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] -= 0x08; - if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; - if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; - if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; - if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; -} - -static void VolfiedMakeInputs() -{ - // Reset Inputs - TaitoInput[0] = 0xff; - TaitoInput[1] = 0xfc; - TaitoInput[2] = 0xff; - TaitoInput[3] = 0xff; - - if (TaitoInputPort0[0]) TaitoInput[0] -= 0x01; - if (TaitoInputPort0[1]) TaitoInput[0] -= 0x02; - if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; - if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; - if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; - if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; - if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; - if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; - - if (TaitoInputPort1[0]) TaitoInput[1] |= 0x01; - if (TaitoInputPort1[1]) TaitoInput[1] |= 0x02; - if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; - if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; - if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; - if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; - if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; - if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; - - if (TaitoInputPort2[0]) TaitoInput[2] -= 0x01; - if (TaitoInputPort2[1]) TaitoInput[2] -= 0x02; - if (TaitoInputPort2[2]) TaitoInput[2] -= 0x04; - if (TaitoInputPort2[3]) TaitoInput[2] -= 0x08; - if (TaitoInputPort2[4]) TaitoInput[2] -= 0x10; - if (TaitoInputPort2[5]) TaitoInput[2] -= 0x20; - if (TaitoInputPort2[6]) TaitoInput[2] -= 0x40; - if (TaitoInputPort2[7]) TaitoInput[2] -= 0x80; - - if (TaitoInputPort3[0]) TaitoInput[3] -= 0x01; - if (TaitoInputPort3[1]) TaitoInput[3] -= 0x02; - if (TaitoInputPort3[2]) TaitoInput[3] -= 0x04; - if (TaitoInputPort3[3]) TaitoInput[3] -= 0x08; - if (TaitoInputPort3[4]) TaitoInput[3] -= 0x10; - if (TaitoInputPort3[5]) TaitoInput[3] -= 0x20; - if (TaitoInputPort3[6]) TaitoInput[3] -= 0x40; - if (TaitoInputPort3[7]) TaitoInput[3] -= 0x80; -} - -static struct BurnDIPInfo DariusDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Auto Fire" }, - {0x13, 0x01, 0x02, 0x02, "Normal" }, - {0x13, 0x01, 0x02, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "Every 600k" }, - {0x14, 0x01, 0x0c, 0x0c, "600k only" }, - {0x14, 0x01, 0x0c, 0x04, "800k only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - {0x14, 0x01, 0x30, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x80, 0x00, "Off" }, - {0x14, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Darius) - -static struct BurnDIPInfo DariuseDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Auto Fire" }, - {0x13, 0x01, 0x02, 0x02, "Normal" }, - {0x13, 0x01, 0x02, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "Every 600k" }, - {0x14, 0x01, 0x0c, 0x0c, "600k only" }, - {0x14, 0x01, 0x0c, 0x04, "800k only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - {0x14, 0x01, 0x30, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x80, 0x00, "Off" }, - {0x14, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Dariuse) - -static struct BurnDIPInfo DariusjDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Auto Fire" }, - {0x13, 0x01, 0x02, 0x02, "Normal" }, - {0x13, 0x01, 0x02, 0x00, "Fast" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "Every 600k" }, - {0x14, 0x01, 0x0c, 0x0c, "600k only" }, - {0x14, 0x01, 0x0c, 0x04, "800k only" }, - {0x14, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - {0x14, 0x01, 0x30, 0x00, "6" }, -}; - -STDDIPINFO(Dariusj) - -static struct BurnDIPInfo OpwolfDIPList[]= -{ - // Default Values - {0x0a, 0xff, 0xff, 0xff, NULL }, - {0x0b, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0a, 0x01, 0x02, 0x02, "Off" }, - {0x0a, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0a, 0x01, 0x04, 0x04, "Off" }, - {0x0a, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0a, 0x01, 0x08, 0x00, "Off" }, - {0x0a, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0a, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0a, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0a, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0a, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0a, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x0a, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x0a, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x0a, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0b, 0x01, 0x03, 0x02, "Easy" }, - {0x0b, 0x01, 0x03, 0x03, "Medium" }, - {0x0b, 0x01, 0x03, 0x01, "Hard" }, - {0x0b, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Ammo Magazines at Start" }, - {0x0b, 0x01, 0x0c, 0x00, "4" }, - {0x0b, 0x01, 0x0c, 0x04, "5" }, - {0x0b, 0x01, 0x0c, 0x0c, "6" }, - {0x0b, 0x01, 0x0c, 0x08, "7" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x0b, 0x01, 0x80, 0x80, "Japanese" }, - {0x0b, 0x01, 0x80, 0x00, "English" }, -}; - -STDDIPINFO(Opwolf) - -static struct BurnDIPInfo OpwolfuDIPList[]= -{ - // Default Values - {0x0a, 0xff, 0xff, 0xff, NULL }, - {0x0b, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0a, 0x01, 0x02, 0x02, "Off" }, - {0x0a, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0a, 0x01, 0x04, 0x04, "Off" }, - {0x0a, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0a, 0x01, 0x08, 0x00, "Off" }, - {0x0a, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0a, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0a, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0a, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0a, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0a, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0a, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0a, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0a, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0b, 0x01, 0x03, 0x02, "Easy" }, - {0x0b, 0x01, 0x03, 0x03, "Medium" }, - {0x0b, 0x01, 0x03, 0x01, "Hard" }, - {0x0b, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Ammo Magazines at Start" }, - {0x0b, 0x01, 0x0c, 0x00, "4" }, - {0x0b, 0x01, 0x0c, 0x04, "5" }, - {0x0b, 0x01, 0x0c, 0x0c, "6" }, - {0x0b, 0x01, 0x0c, 0x08, "7" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x0b, 0x01, 0x80, 0x80, "Japanese" }, - {0x0b, 0x01, 0x80, 0x00, "English" }, -}; - -STDDIPINFO(Opwolfu) - -static struct BurnDIPInfo OpwolfbDIPList[]= -{ - // Default Values - {0x0a, 0xff, 0xff, 0xff, NULL }, - {0x0b, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0a, 0x01, 0x02, 0x02, "Off" }, - {0x0a, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0a, 0x01, 0x04, 0x04, "Off" }, - {0x0a, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0a, 0x01, 0x08, 0x00, "Off" }, - {0x0a, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0a, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0a, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0a, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0a, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0a, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x0a, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x0a, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x0a, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0b, 0x01, 0x03, 0x02, "Easy" }, - {0x0b, 0x01, 0x03, 0x03, "Medium" }, - {0x0b, 0x01, 0x03, 0x01, "Hard" }, - {0x0b, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Ammo Magazines at Start" }, - {0x0b, 0x01, 0x0c, 0x00, "4" }, - {0x0b, 0x01, 0x0c, 0x04, "5" }, - {0x0b, 0x01, 0x0c, 0x0c, "6" }, - {0x0b, 0x01, 0x0c, 0x08, "7" }, -}; - -STDDIPINFO(Opwolfb) - -static struct BurnDIPInfo RbislandDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xfe, NULL }, - {0x10, 0xff, 0xff, 0xbf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0f, 0x01, 0x01, 0x00, "Upright" }, - {0x0f, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x0f, 0x01, 0x02, 0x02, "Off" }, - {0x0f, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0f, 0x01, 0x04, 0x04, "Off" }, - {0x0f, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x08, 0x00, "Off" }, - {0x0f, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x10, 0x01, 0x03, 0x02, "Easy" }, - {0x10, 0x01, 0x03, 0x03, "Medium" }, - {0x10, 0x01, 0x03, 0x01, "Hard" }, - {0x10, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x10, 0x01, 0x04, 0x04, "100k, 1000k" }, - {0x10, 0x01, 0x04, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Complete Bonus" }, - {0x10, 0x01, 0x08, 0x08, "1 Up" }, - {0x10, 0x01, 0x08, 0x00, "100k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x10, 0x01, 0x30, 0x10, "1" }, - {0x10, 0x01, 0x30, 0x00, "2" }, - {0x10, 0x01, 0x30, 0x30, "3" }, - {0x10, 0x01, 0x30, 0x20, "4" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x10, 0x01, 0x40, 0x00, "English" }, - {0x10, 0x01, 0x40, 0x40, "Japanese" }, -}; - -STDDIPINFO(Rbisland) - -static struct BurnDIPInfo JumpingDIPList[]= -{ - // Default Values - {0x09, 0xff, 0xff, 0xfe, NULL }, - {0x0a, 0xff, 0xff, 0xbf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x09, 0x01, 0x08, 0x00, "Off" }, - {0x09, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x09, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x09, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x09, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x09, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x09, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x09, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x09, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x09, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0a, 0x01, 0x03, 0x02, "Easy" }, - {0x0a, 0x01, 0x03, 0x03, "Medium" }, - {0x0a, 0x01, 0x03, 0x01, "Hard" }, - {0x0a, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Bonus Life" }, - {0x0a, 0x01, 0x04, 0x04, "100k, 1000k" }, - {0x0a, 0x01, 0x04, 0x00, "None" }, - - {0 , 0xfe, 0 , 2 , "Complete Bonus" }, - {0x0a, 0x01, 0x08, 0x08, "1 Up" }, - {0x0a, 0x01, 0x08, 0x00, "100k" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0a, 0x01, 0x30, 0x10, "1" }, - {0x0a, 0x01, 0x30, 0x00, "2" }, - {0x0a, 0x01, 0x30, 0x30, "3" }, - {0x0a, 0x01, 0x30, 0x20, "4" }, -}; - -STDDIPINFO(Jumping) - -static struct BurnDIPInfo RastanDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "100k, 200k, 400k, 600k, 800k"}, - {0x14, 0x01, 0x0c, 0x08, "150k, 300k, 600k, 900k, 1200k"}, - {0x14, 0x01, 0x0c, 0x04, "200k, 400k, 800k, 1200k, 1600k"}, - {0x14, 0x01, 0x0c, 0x00, "250k, 500k, 1000k, 1500k, 2000k"}, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - {0x14, 0x01, 0x30, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Rastan) - -static struct BurnDIPInfo RastsagaDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x13, 0x01, 0x01, 0x00, "Upright" }, - {0x13, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "100k, 200k, 400k, 600k, 800k"}, - {0x14, 0x01, 0x0c, 0x08, "150k, 300k, 600k, 900k, 1200k"}, - {0x14, 0x01, 0x0c, 0x04, "200k, 400k, 800k, 1200k, 1600k"}, - {0x14, 0x01, 0x0c, 0x00, "250k, 500k, 1000k, 1500k, 2000k"}, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x20, "4" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - {0x14, 0x01, 0x30, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, -}; - -STDDIPINFO(Rastsaga) - -static struct BurnDIPInfo TopspeedDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Cabinet" }, - {0x0f, 0x01, 0x03, 0x03, "Deluxe Motorized Cabinet" }, - {0x0f, 0x01, 0x03, 0x02, "Upright" }, - {0x0f, 0x01, 0x03, 0x01, "Upright (alt)" }, - {0x0f, 0x01, 0x03, 0x00, "Standard Cockpit" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0f, 0x01, 0x04, 0x04, "Off" }, - {0x0f, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x08, 0x00, "Off" }, - {0x0f, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0f, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0f, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0f, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x0f, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x0f, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Initial Time" }, - {0x10, 0x01, 0x0c, 0x00, "40 seconds" }, - {0x10, 0x01, 0x0c, 0x04, "50 seconds" }, - {0x10, 0x01, 0x0c, 0x0c, "60 seconds" }, - {0x10, 0x01, 0x0c, 0x08, "70 seconds" }, - - {0 , 0xfe, 0 , 4 , "Nitros" }, - {0x10, 0x01, 0x30, 0x20, "2" }, - {0x10, 0x01, 0x30, 0x30, "3" }, - {0x10, 0x01, 0x30, 0x10, "4" }, - {0x10, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x10, 0x01, 0x40, 0x40, "Off" }, - {0x10, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Continue Price" }, - {0x10, 0x01, 0x80, 0x00, "1 Coin 1 Credit" }, - {0x10, 0x01, 0x80, 0x80, "Same as start" }, -}; - -STDDIPINFO(Topspeed) - -static struct BurnDIPInfo FullthrlDIPList[]= -{ - // Default Values - {0x0f, 0xff, 0xff, 0xff, NULL }, - {0x10, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Cabinet" }, - {0x0f, 0x01, 0x03, 0x03, "Deluxe Motorized Cabinet" }, - {0x0f, 0x01, 0x03, 0x02, "Upright" }, - {0x0f, 0x01, 0x03, 0x01, "Upright (alt)" }, - {0x0f, 0x01, 0x03, 0x00, "Standard Cockpit" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0f, 0x01, 0x04, 0x04, "Off" }, - {0x0f, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0f, 0x01, 0x08, 0x00, "Off" }, - {0x0f, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Initial Time" }, - {0x10, 0x01, 0x0c, 0x00, "40 seconds" }, - {0x10, 0x01, 0x0c, 0x04, "50 seconds" }, - {0x10, 0x01, 0x0c, 0x0c, "60 seconds" }, - {0x10, 0x01, 0x0c, 0x08, "70 seconds" }, - - {0 , 0xfe, 0 , 4 , "Nitros" }, - {0x10, 0x01, 0x30, 0x20, "2" }, - {0x10, 0x01, 0x30, 0x30, "3" }, - {0x10, 0x01, 0x30, 0x10, "4" }, - {0x10, 0x01, 0x30, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x10, 0x01, 0x40, 0x40, "Off" }, - {0x10, 0x01, 0x40, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Continue Price" }, - {0x10, 0x01, 0x80, 0x00, "1 Coin 1 Credit" }, - {0x10, 0x01, 0x80, 0x80, "Same as start" }, -}; - -STDDIPINFO(Fullthrl) - -static struct BurnDIPInfo VolfiedDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfe, NULL }, - {0x12, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x01, 0x00, "Upright" }, - {0x11, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x08, 0x00, "Off" }, - {0x11, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x11, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x11, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x12, 0x01, 0x03, 0x02, "20k 40k 120k 480k 2400k" }, - {0x12, 0x01, 0x03, 0x03, "50k 150k 600k 3000k" }, - {0x12, 0x01, 0x03, 0x01, "70k 280k 1400k" }, - {0x12, 0x01, 0x03, 0x00, "100k 500k" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Medium" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 5 , "Lives" }, - {0x12, 0x01, 0x70, 0x70, "3" }, - {0x12, 0x01, 0x70, 0x60, "4" }, - {0x12, 0x01, 0x70, 0x50, "5" }, - {0x12, 0x01, 0x70, 0x40, "6" }, - {0x12, 0x01, 0x70, 0x00, "32768" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x12, 0x01, 0x80, 0x80, "Japanese" }, - {0x12, 0x01, 0x80, 0x00, "English" }, -}; - -STDDIPINFO(Volfied) - -static struct BurnDIPInfo VolfiedjDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfe, NULL }, - {0x12, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x01, 0x00, "Upright" }, - {0x11, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x08, 0x00, "Off" }, - {0x11, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x11, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x11, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x12, 0x01, 0x03, 0x02, "20k 40k 120k 480k 2400k" }, - {0x12, 0x01, 0x03, 0x03, "50k 150k 600k 3000k" }, - {0x12, 0x01, 0x03, 0x01, "70k 280k 1400k" }, - {0x12, 0x01, 0x03, 0x00, "100k 500k" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Medium" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 5 , "Lives" }, - {0x12, 0x01, 0x70, 0x70, "3" }, - {0x12, 0x01, 0x70, 0x60, "4" }, - {0x12, 0x01, 0x70, 0x50, "5" }, - {0x12, 0x01, 0x70, 0x40, "6" }, - {0x12, 0x01, 0x70, 0x00, "32768" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x12, 0x01, 0x80, 0x80, "Japanese" }, - {0x12, 0x01, 0x80, 0x00, "English" }, -}; - -STDDIPINFO(Volfiedj) - -static struct BurnDIPInfo VolfieduDIPList[]= -{ - // Default Values - {0x11, 0xff, 0xff, 0xfe, NULL }, - {0x12, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x11, 0x01, 0x01, 0x00, "Upright" }, - {0x11, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x11, 0x01, 0x02, 0x02, "Off" }, - {0x11, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x11, 0x01, 0x04, 0x04, "Off" }, - {0x11, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x11, 0x01, 0x08, 0x00, "Off" }, - {0x11, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x11, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x12, 0x01, 0x03, 0x02, "20k 40k 120k 480k 2400k" }, - {0x12, 0x01, 0x03, 0x03, "50k 150k 600k 3000k" }, - {0x12, 0x01, 0x03, 0x01, "70k 280k 1400k" }, - {0x12, 0x01, 0x03, 0x00, "100k 500k" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x12, 0x01, 0x0c, 0x08, "Easy" }, - {0x12, 0x01, 0x0c, 0x0c, "Medium" }, - {0x12, 0x01, 0x0c, 0x04, "Hard" }, - {0x12, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 5 , "Lives" }, - {0x12, 0x01, 0x70, 0x70, "3" }, - {0x12, 0x01, 0x70, 0x60, "4" }, - {0x12, 0x01, 0x70, 0x50, "5" }, - {0x12, 0x01, 0x70, 0x40, "6" }, - {0x12, 0x01, 0x70, 0x00, "32768" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x12, 0x01, 0x80, 0x80, "Japanese" }, - {0x12, 0x01, 0x80, 0x00, "English" }, -}; - -STDDIPINFO(Volfiedu) - -static struct BurnRomInfo DariusRomDesc[] = { - { "da-59.bin", 0x10000, 0x11aab4eb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "da-58.bin", 0x10000, 0x5f71e697, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "da-61.bin", 0x10000, 0x4736aa9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "da-66.bin", 0x10000, 0x4ede5f56, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "a96_31.187", 0x10000, 0xe9bb5d89, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "a96_30.154", 0x10000, 0x9eb5e127, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "a96_33-1.190", 0x10000, 0xff186048, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "a96_32-1.157", 0x10000, 0xd9719de8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "a96_35-1.191", 0x10000, 0xb3280193, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "a96_34-1.158", 0x10000, 0xca3b2573, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "a96_57.33", 0x10000, 0x33ceb730, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "a96_56.18", 0x10000, 0x292ef55c, BRF_ESS | BRF_PRG | TAITO_Z80ROM2 }, - - { "a96_48.24", 0x10000, 0x39c9b3aa, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_51.47", 0x10000, 0x1bf8f0d3, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_49.25", 0x10000, 0x37a7d88a, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_52.48", 0x10000, 0x2d9b2128, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_50.26", 0x10000, 0x75d738e4, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_53.49", 0x10000, 0x0173484c, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "a96_54.143", 0x04000, 0x51c02ae2, BRF_GRA | TAITO_CHARSB_BYTESWAP }, - { "a96_55.144", 0x04000, 0x771e4d98, BRF_GRA | TAITO_CHARSB_BYTESWAP }, - - { "a96_44.179", 0x10000, 0xbbc18878, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_45.200", 0x10000, 0x616cdd8b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_46.180", 0x10000, 0xfec35418, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_47.201", 0x10000, 0x8df9286a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_40.177", 0x10000, 0xb699a51e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_41.198", 0x10000, 0x97128a3a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_42.178", 0x10000, 0x7f55ee0f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_43.199", 0x10000, 0xc7cad469, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "da-62.bin", 0x10000, 0x9179862c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "da-63.bin", 0x10000, 0xfa19cfff, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "da-64.bin", 0x10000, 0x814c676f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "da-65.bin", 0x10000, 0x14eee326, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "a96-24.163", 0x00400, 0x0fa8be7f, BRF_OPT }, - { "a96-25.164", 0x00400, 0x265508a6, BRF_OPT }, - { "a96-26.165", 0x00400, 0x4891b9c0, BRF_OPT }, -}; - -STD_ROM_PICK(Darius) -STD_ROM_FN(Darius) - -static struct BurnRomInfo DariusjRomDesc[] = { - { "a96_29-1.185", 0x10000, 0x75486f62, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "a96_28-1.152", 0x10000, 0xfb34d400, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "a96_31.187", 0x10000, 0xe9bb5d89, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "a96_30.154", 0x10000, 0x9eb5e127, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "a96_33-1.190", 0x10000, 0xff186048, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "a96_32-1.157", 0x10000, 0xd9719de8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "a96_35-1.191", 0x10000, 0xb3280193, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "a96_34-1.158", 0x10000, 0xca3b2573, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "a96_57.33", 0x10000, 0x33ceb730, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "a96_56.18", 0x10000, 0x292ef55c, BRF_ESS | BRF_PRG | TAITO_Z80ROM2 }, - - { "a96_48.24", 0x10000, 0x39c9b3aa, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_51.47", 0x10000, 0x1bf8f0d3, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_49.25", 0x10000, 0x37a7d88a, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_52.48", 0x10000, 0x2d9b2128, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_50.26", 0x10000, 0x75d738e4, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_53.49", 0x10000, 0x0173484c, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "a96_54.143", 0x04000, 0x51c02ae2, BRF_GRA | TAITO_CHARSB_BYTESWAP }, - { "a96_55.144", 0x04000, 0x771e4d98, BRF_GRA | TAITO_CHARSB_BYTESWAP }, - - { "a96_44.179", 0x10000, 0xbbc18878, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_45.200", 0x10000, 0x616cdd8b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_46.180", 0x10000, 0xfec35418, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_47.201", 0x10000, 0x8df9286a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_40.177", 0x10000, 0xb699a51e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_41.198", 0x10000, 0x97128a3a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_42.178", 0x10000, 0x7f55ee0f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_43.199", 0x10000, 0xc7cad469, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_36.175", 0x10000, 0xaf598141, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_37.196", 0x10000, 0xb48137c8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_38.176", 0x10000, 0xe4f3e3a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_39.197", 0x10000, 0xea30920f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "a96-24.163", 0x00400, 0x0fa8be7f, BRF_OPT }, - { "a96-25.164", 0x00400, 0x265508a6, BRF_OPT }, - { "a96-26.165", 0x00400, 0x4891b9c0, BRF_OPT }, -}; - -STD_ROM_PICK(Dariusj) -STD_ROM_FN(Dariusj) - -static struct BurnRomInfo DariusoRomDesc[] = { - { "a96-29.185", 0x10000, 0xf775162b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "a96-28.152", 0x10000, 0x4721d667, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "a96_31.187", 0x10000, 0xe9bb5d89, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "a96_30.154", 0x10000, 0x9eb5e127, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "a96-33.190", 0x10000, 0xd2f340d2, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "a96-32.157", 0x10000, 0x044c9848, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "a96-35.191", 0x10000, 0xb8ed718b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "a96-34.158", 0x10000, 0x7556a660, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "a96_57.33", 0x10000, 0x33ceb730, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "a96_56.18", 0x10000, 0x292ef55c, BRF_ESS | BRF_PRG | TAITO_Z80ROM2 }, - - { "a96_48.24", 0x10000, 0x39c9b3aa, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_51.47", 0x10000, 0x1bf8f0d3, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_49.25", 0x10000, 0x37a7d88a, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_52.48", 0x10000, 0x2d9b2128, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_50.26", 0x10000, 0x75d738e4, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_53.49", 0x10000, 0x0173484c, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "a96_54.143", 0x04000, 0x51c02ae2, BRF_GRA | TAITO_CHARSB_BYTESWAP }, - { "a96_55.144", 0x04000, 0x771e4d98, BRF_GRA | TAITO_CHARSB_BYTESWAP }, - - { "a96_44.179", 0x10000, 0xbbc18878, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_45.200", 0x10000, 0x616cdd8b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_46.180", 0x10000, 0xfec35418, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_47.201", 0x10000, 0x8df9286a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_40.177", 0x10000, 0xb699a51e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_41.198", 0x10000, 0x97128a3a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_42.178", 0x10000, 0x7f55ee0f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_43.199", 0x10000, 0xc7cad469, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_36.175", 0x10000, 0xaf598141, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_37.196", 0x10000, 0xb48137c8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_38.176", 0x10000, 0xe4f3e3a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_39.197", 0x10000, 0xea30920f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "a96-24.163", 0x00400, 0x0fa8be7f, BRF_OPT }, - { "a96-25.164", 0x00400, 0x265508a6, BRF_OPT }, - { "a96-26.165", 0x00400, 0x4891b9c0, BRF_OPT }, -}; - -STD_ROM_PICK(Dariuso) -STD_ROM_FN(Dariuso) - -static struct BurnRomInfo DariuseRomDesc[] = { - { "dae-68.bin", 0x10000, 0xed721127, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "dae-67.bin", 0x10000, 0xb99aea8c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "dae-70.bin", 0x10000, 0x54590b31, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "a96_30.154", 0x10000, 0x9eb5e127, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "dae-72.bin", 0x10000, 0x248ca2cc, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "dae-71.bin", 0x10000, 0x65dd0403, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "dae-74.bin", 0x10000, 0x0ea31f60, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "dae-73.bin", 0x10000, 0x27036a4d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "a96_57.33", 0x10000, 0x33ceb730, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "a96_56.18", 0x10000, 0x292ef55c, BRF_ESS | BRF_PRG | TAITO_Z80ROM2 }, - - { "a96_48.24", 0x10000, 0x39c9b3aa, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_51.47", 0x10000, 0x1bf8f0d3, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_49.25", 0x10000, 0x37a7d88a, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_52.48", 0x10000, 0x2d9b2128, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_50.26", 0x10000, 0x75d738e4, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "a96_53.49", 0x10000, 0x0173484c, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "a96_54.143", 0x04000, 0x51c02ae2, BRF_GRA | TAITO_CHARSB_BYTESWAP }, - { "a96_55.144", 0x04000, 0x771e4d98, BRF_GRA | TAITO_CHARSB_BYTESWAP }, - - { "a96_44.179", 0x10000, 0xbbc18878, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_45.200", 0x10000, 0x616cdd8b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_46.180", 0x10000, 0xfec35418, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_47.201", 0x10000, 0x8df9286a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_40.177", 0x10000, 0xb699a51e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_41.198", 0x10000, 0x97128a3a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_42.178", 0x10000, 0x7f55ee0f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_43.199", 0x10000, 0xc7cad469, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_36.175", 0x10000, 0xaf598141, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_37.196", 0x10000, 0xb48137c8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_38.176", 0x10000, 0xe4f3e3a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "a96_39.197", 0x10000, 0xea30920f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "a96-24.163", 0x00400, 0x0fa8be7f, BRF_OPT }, - { "a96-25.164", 0x00400, 0x265508a6, BRF_OPT }, - { "a96-26.165", 0x00400, 0x4891b9c0, BRF_OPT }, -}; - -STD_ROM_PICK(Dariuse) -STD_ROM_FN(Dariuse) - -static struct BurnRomInfo OpwolfRomDesc[] = { - { "b20-05-02.40", 0x10000, 0x3ffbfe3a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-03-02.30", 0x10000, 0xfdabd8a5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-04.39", 0x10000, 0x216b4838, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-20.29", 0x10000, 0xd244431a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b20-07.10", 0x10000, 0x45c7ace3, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b20-13.13", 0x80000, 0xf6acdab1, BRF_GRA | TAITO_CHARS }, - - { "b20-14.72", 0x80000, 0x89f889e5, BRF_GRA | TAITO_SPRITESA }, - - { "b20-08.21", 0x80000, 0xf3e19c64, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Opwolf) -STD_ROM_FN(Opwolf) - -static struct BurnRomInfo OpwolfaRomDesc[] = { - { "b20-05-02.40", 0x10000, 0x3ffbfe3a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-03-02.30", 0x10000, 0xfdabd8a5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-04.39", 0x10000, 0x216b4838, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-17.29", 0x10000, 0x6043188e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b20-07.10", 0x10000, 0x45c7ace3, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b20-13.13", 0x80000, 0xf6acdab1, BRF_GRA | TAITO_CHARS }, - - { "b20-14.72", 0x80000, 0x89f889e5, BRF_GRA | TAITO_SPRITESA }, - - { "b20-08.21", 0x80000, 0xf3e19c64, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Opwolfa) -STD_ROM_FN(Opwolfa) - -static struct BurnRomInfo OpwolfjRomDesc[] = { - { "b20-05-02.40", 0x10000, 0x3ffbfe3a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-03-02.30", 0x10000, 0xfdabd8a5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-04.39", 0x10000, 0x216b4838, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-18.29", 0x10000, 0xfd202470, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b20-07.10", 0x10000, 0x45c7ace3, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b20-13.13", 0x80000, 0xf6acdab1, BRF_GRA | TAITO_CHARS }, - - { "b20-14.72", 0x80000, 0x89f889e5, BRF_GRA | TAITO_SPRITESA }, - - { "b20-08.21", 0x80000, 0xf3e19c64, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Opwolfj) -STD_ROM_FN(Opwolfj) - -static struct BurnRomInfo OpwolfuRomDesc[] = { - { "b20-05-02.40", 0x10000, 0x3ffbfe3a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-03-02.30", 0x10000, 0xfdabd8a5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-04.39", 0x10000, 0x216b4838, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b20-19.29", 0x10000, 0xb71bc44c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b20-07.10", 0x10000, 0x45c7ace3, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b20-13.13", 0x80000, 0xf6acdab1, BRF_GRA | TAITO_CHARS }, - - { "b20-14.72", 0x80000, 0x89f889e5, BRF_GRA | TAITO_SPRITESA }, - - { "b20-08.21", 0x80000, 0xf3e19c64, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Opwolfu) -STD_ROM_FN(Opwolfu) - -static struct BurnRomInfo OpwolfbRomDesc[] = { - { "opwlfb.12", 0x10000, 0xd87e4405, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "opwlfb.10", 0x10000, 0x9ab6f75c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "opwlfb.13", 0x10000, 0x61230c6e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "opwlfb.11", 0x10000, 0x342e318d, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "opwlfb.30", 0x08000, 0x0669b94c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "opwlfb.09", 0x08000, 0xab27a3dd, BRF_ESS | BRF_PRG | TAITO_Z80ROM2 }, - - { "opwlfb.08", 0x10000, 0x134d294e, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "opwlfb.04", 0x10000, 0xde0ca98d, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "opwlfb.06", 0x10000, 0x317d0e66, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "opwlfb.02", 0x10000, 0x6231fdd0, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "opwlfb.07", 0x10000, 0xe1c4095e, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "opwlfb.03", 0x10000, 0xccf8ba80, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "opwlfb.05", 0x10000, 0xfd9e72c8, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "opwlfb.01", 0x10000, 0x0a65f256, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "opwlfb.14", 0x10000, 0x663786eb, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "opwlfb.18", 0x10000, 0xde9ab08e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "opwlfb.15", 0x10000, 0x315b8aa9, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "opwlfb.19", 0x10000, 0x645cf85e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "opwlfb.16", 0x10000, 0xe01099e3, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "opwlfb.20", 0x10000, 0xd80b9cc6, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "opwlfb.17", 0x10000, 0x56fbe61d, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "opwlfb.21", 0x10000, 0x97d25157, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "opwlfb.29", 0x10000, 0x05a9eac0, BRF_SND | TAITO_MSM5205_BYTESWAP }, - { "opwlfb.25", 0x10000, 0x85b87f58, BRF_SND | TAITO_MSM5205_BYTESWAP }, - { "opwlfb.28", 0x10000, 0x281b2175, BRF_SND | TAITO_MSM5205_BYTESWAP }, - { "opwlfb.24", 0x10000, 0x8efc5d4d, BRF_SND | TAITO_MSM5205_BYTESWAP }, - { "opwlfb.27", 0x10000, 0x441211a6, BRF_SND | TAITO_MSM5205_BYTESWAP }, - { "opwlfb.23", 0x10000, 0xa874c703, BRF_SND | TAITO_MSM5205_BYTESWAP }, - { "opwlfb.26", 0x10000, 0x86d1d42d, BRF_SND | TAITO_MSM5205_BYTESWAP }, - { "opwlfb.22", 0x10000, 0x9228481f, BRF_SND | TAITO_MSM5205_BYTESWAP }, - -}; - -STD_ROM_PICK(Opwolfb) -STD_ROM_FN(Opwolfb) - -static struct BurnRomInfo RbislandRomDesc[] = { - { "b22-10-1.19", 0x10000, 0xe34a50ca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-11-1.20", 0x10000, 0x6a31a093, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-08-1.21", 0x10000, 0x15d6e17a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-09-1.22", 0x10000, 0x454e66bc, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-03.23", 0x20000, 0x3ebb0fb8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-04.24", 0x20000, 0x91625e7f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b22-14.43", 0x10000, 0x113c1a5b, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b22-01.2", 0x80000, 0xb76c9168, BRF_GRA | TAITO_CHARS }, - - { "b22-02.5", 0x80000, 0x1b87ecf0, BRF_GRA | TAITO_SPRITESA }, - { "b22-12.7", 0x10000, 0x67a76dc6, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "b22-13.6", 0x10000, 0x2fda099f, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "cchip_b22-15.53", 0x10000, 0x00000000, BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(Rbisland) -STD_ROM_FN(Rbisland) - -static struct BurnRomInfo RbislandoRomDesc[] = { - { "b22-10.19", 0x10000, 0x3b013495, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-11.20", 0x10000, 0x80041a3d, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-08.21", 0x10000, 0x962fb845, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-09.22", 0x10000, 0xf43efa27, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-03.23", 0x20000, 0x3ebb0fb8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-04.24", 0x20000, 0x91625e7f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b22-14.43", 0x10000, 0x113c1a5b, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b22-01.2", 0x80000, 0xb76c9168, BRF_GRA | TAITO_CHARS }, - - { "b22-02.5", 0x80000, 0x1b87ecf0, BRF_GRA | TAITO_SPRITESA }, - { "b22-12.7", 0x10000, 0x67a76dc6, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "b22-13.6", 0x10000, 0x2fda099f, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "cchip_b22-15.53", 0x10000, 0x00000000, BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(Rbislando) -STD_ROM_FN(Rbislando) - -static struct BurnRomInfo RbislandeRomDesc[] = { - { "b39-01.19", 0x10000, 0x50690880, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b39-02.20", 0x10000, 0x4dead71f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b39-03.21", 0x10000, 0x4a4cb785, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b39-04.22", 0x10000, 0x4caa53bd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-03.23", 0x20000, 0x3ebb0fb8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-04.24", 0x20000, 0x91625e7f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b22-14.43", 0x10000, 0x113c1a5b, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b22-01.2", 0x80000, 0xb76c9168, BRF_GRA | TAITO_CHARS }, - - { "b22-02.5", 0x80000, 0x1b87ecf0, BRF_GRA | TAITO_SPRITESA }, - { "b22-12.7", 0x10000, 0x67a76dc6, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "b22-13.6", 0x10000, 0x2fda099f, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "cchip_b39-05.53", 0x10000, 0x00000000, BRF_OPT | BRF_NODUMP }, -}; - -STD_ROM_PICK(Rbislande) -STD_ROM_FN(Rbislande) - -static struct BurnRomInfo JumpingRomDesc[] = { - { "jb1_h4", 0x10000, 0x3fab6b31, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "jb1_h8", 0x10000, 0x8c878827, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "jb1_i4", 0x10000, 0x443492cf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "jb1_i8", 0x10000, 0xed33bae1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-03.23", 0x20000, 0x3ebb0fb8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b22-04.24", 0x20000, 0x91625e7f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "jb1_f89", 0x10000, 0x0810d327, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP_JUMPING }, - - { "jb1_cd67", 0x10000, 0x8527c00e, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "jb2_ic8", 0x10000, 0x65b76309, BRF_GRA | TAITO_CHARS }, - { "jb2_ic7", 0x10000, 0x43a94283, BRF_GRA | TAITO_CHARS }, - { "jb2_ic10", 0x10000, 0xe61933fb, BRF_GRA | TAITO_CHARS }, - { "jb2_ic9", 0x10000, 0xed031eb2, BRF_GRA | TAITO_CHARS }, - { "jb2_ic12", 0x10000, 0x312700ca, BRF_GRA | TAITO_CHARS }, - { "jb2_ic11", 0x10000, 0xde3b0b88, BRF_GRA | TAITO_CHARS }, - { "jb2_ic14", 0x10000, 0x9fdc6c8e, BRF_GRA | TAITO_CHARS }, - { "jb2_ic13", 0x10000, 0x06226492, BRF_GRA | TAITO_CHARS }, - - { "jb2_ic62", 0x10000, 0x8548db6c, BRF_GRA | TAITO_SPRITESA }, - { "jb2_ic61", 0x10000, 0x37c5923b, BRF_GRA | TAITO_SPRITESA }, - { "jb2_ic60", 0x08000, 0x662a2f1e, BRF_GRA | TAITO_SPRITESA }, - { "jb2_ic78", 0x10000, 0x925865e1, BRF_GRA | TAITO_SPRITESA }, - { "jb2_ic77", 0x10000, 0xb09695d1, BRF_GRA | TAITO_SPRITESA }, - { "jb2_ic76", 0x08000, 0x41937743, BRF_GRA | TAITO_SPRITESA }, - { "jb2_ic93", 0x10000, 0xf644eeab, BRF_GRA | TAITO_SPRITESA }, - { "jb2_ic92", 0x10000, 0x3fbccd33, BRF_GRA | TAITO_SPRITESA }, - { "jb2_ic91", 0x08000, 0xd886c014, BRF_GRA | TAITO_SPRITESA }, - { "jb2_i121", 0x10000, 0x93df1e4d, BRF_GRA | TAITO_SPRITESA }, - { "jb2_i120", 0x10000, 0x7c4e893b, BRF_GRA | TAITO_SPRITESA }, - { "jb2_i119", 0x08000, 0x7e1d58d8, BRF_GRA | TAITO_SPRITESA }, -}; - -STD_ROM_PICK(Jumping) -STD_ROM_FN(Jumping) - -static struct BurnRomInfo RastanRomDesc[] = { - { "b04-38.19", 0x10000, 0x1c91dbb1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-37.7", 0x10000, 0xecf20bdd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-40.20", 0x10000, 0x0930d4b3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-39.8", 0x10000, 0xd95ade5e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-42.21", 0x10000, 0x1857a7cb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-43-1.9", 0x10000, 0xca4702ff, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, - { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, - { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, - { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, - - { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, - { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, - { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, - { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, - - { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Rastan) -STD_ROM_FN(Rastan) - -static struct BurnRomInfo RastanaRomDesc[] = { - { "b04-38.19", 0x10000, 0x1c91dbb1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-37.7", 0x10000, 0xecf20bdd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-40.20", 0x10000, 0x0930d4b3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-39.8", 0x10000, 0xd95ade5e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-42.21", 0x10000, 0x1857a7cb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-43.9", 0x10000, 0xc34b9152, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, - { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, - { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, - { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, - - { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, - { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, - { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, - { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, - - { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Rastana) -STD_ROM_FN(Rastana) - -static struct BurnRomInfo RastanuRomDesc[] = { - { "b04-38.19", 0x10000, 0x1c91dbb1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-37.7", 0x10000, 0xecf20bdd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-45.20", 0x10000, 0x362812dd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-44.8", 0x10000, 0x51cc5508, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-42.21", 0x10000, 0x1857a7cb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-41-1.9", 0x10000, 0xbd403269, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, - { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, - { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, - { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, - - { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, - { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, - { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, - { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, - - { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Rastanu) -STD_ROM_FN(Rastanu) - -static struct BurnRomInfo RastanuaRomDesc[] = { - { "b04-38.19", 0x10000, 0x1c91dbb1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-37.7", 0x10000, 0xecf20bdd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-45.20", 0x10000, 0x362812dd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-44.8", 0x10000, 0x51cc5508, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-42.21", 0x10000, 0x1857a7cb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-41.9", 0x10000, 0xb44ca1c4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, - { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, - { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, - { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, - - { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, - { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, - { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, - { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, - - { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Rastanua) -STD_ROM_FN(Rastanua) - -static struct BurnRomInfo RastanubRomDesc[] = { - { "b04-14.19", 0x10000, 0xa38ac909, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-21.7", 0x10000, 0x7c8dde9a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-23.20", 0x10000, 0x254b3dce, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-22.8", 0x10000, 0x98e8edcf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-25.21", 0x10000, 0xd1e5adee, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-24.9", 0x10000, 0xa3dcc106, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, - { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, - { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, - { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, - - { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, - { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, - { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, - { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, - - { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Rastanub) -STD_ROM_FN(Rastanub) - -static struct BurnRomInfo RastsagaRomDesc[] = { - { "b04-14.19", 0x10000, 0xa38ac909, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-13.7", 0x10000, 0xbad60872, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-16-1.20", 0x10000, 0x00b59e60, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-15-1.8", 0x10000, 0xff9e018a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-18-1.21", 0x10000, 0xb626c439, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-17-1.9", 0x10000, 0xc928a516, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, - { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, - { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, - { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, - - { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, - { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, - { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, - { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, - - { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Rastsaga) -STD_ROM_FN(Rastsaga) - -static struct BurnRomInfo RastsagaaRomDesc[] = { - { "b04-14.19", 0x10000, 0xa38ac909, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-13.7", 0x10000, 0xbad60872, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-16.20", 0x10000, 0x6bcf70dc, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-15.8", 0x10000, 0x8838ecc5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-18-1.21", 0x10000, 0xb626c439, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b04-17-1.9", 0x10000, 0xc928a516, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, - { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, - { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, - { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, - - { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, - { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, - { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, - { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, - - { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, -}; - -STD_ROM_PICK(Rastsagaa) -STD_ROM_FN(Rastsagaa) - -static struct BurnRomInfo TopspeedRomDesc[] = { - { "b14-67-1.11", 0x10000, 0x23f17616, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b14-68-1.9", 0x10000, 0x835659d9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b14-54.24", 0x20000, 0x172924d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b14-52.26", 0x20000, 0xe1b5b2a1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b14-55.23", 0x20000, 0xa1f15499, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b14-53.25", 0x20000, 0x04a04f5f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b14-69.80", 0x10000, 0xd652e300, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b14-70.81", 0x10000, 0xb720592b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b14-25.67", 0x10000, 0x9eab28ef, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b14-07.54", 0x20000, 0xc6025fff, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "b14-06.52", 0x20000, 0xb4e2536e, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "b14-48.16", 0x20000, 0x30c7f265, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-49.12", 0x20000, 0x32ba4265, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-50.8", 0x20000, 0xec1ef311, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-51.4", 0x20000, 0x35041c5f, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-44.15", 0x20000, 0x9f6c030e, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-45.11", 0x20000, 0x63e4ce03, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-46.7", 0x20000, 0xd489adf2, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-47.3", 0x20000, 0xb3a1f75b, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-40.14", 0x20000, 0xfa2a3cb3, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-41.10", 0x20000, 0x09455a14, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-42.6", 0x20000, 0xab51f53c, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-43.2", 0x20000, 0x1e6d2b38, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-36.13", 0x20000, 0x20a7c1b8, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-37.9", 0x20000, 0x801b703b, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-38.5", 0x20000, 0xde0c213e, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - { "b14-39.1", 0x20000, 0x798c28c5, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, - - { "b14-30.88" , 0x10000, 0xdccb0c7f, BRF_GRA | TAITO_SPRITEMAP }, - - { "b14-28.103", 0x10000, 0xdf11d0ae, BRF_SND | TAITO_MSM5205 }, - { "b14-29.109", 0x10000, 0x7ad983e7, BRF_SND | TAITO_MSM5205 }, - - { "b14-31.90", 0x02000, 0x5c6b013d, BRF_OPT }, -}; - -STD_ROM_PICK(Topspeed) -STD_ROM_FN(Topspeed) - -static struct BurnRomInfo TopspeeduRomDesc[] = { - { "b14-23", 0x10000, 0xdd0307fd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b14-24", 0x10000, 0xacdf08d4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b14-05", 0x80000, 0x6557e9d8, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "b14-26", 0x10000, 0x659dc872, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b14-56", 0x10000, 0xd165cf1b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b14-25.67", 0x10000, 0x9eab28ef, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b14-07.54", 0x20000, 0xc6025fff, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "b14-06.52", 0x20000, 0xb4e2536e, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "b14-01", 0x80000, 0x84a56f37, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b14-02", 0x80000, 0x6889186b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b14-03", 0x80000, 0xd1ed9e71, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b14-04", 0x80000, 0xb63f0519, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b14-30.88" , 0x10000, 0xdccb0c7f, BRF_GRA | TAITO_SPRITEMAP }, - - { "b14-28.103", 0x10000, 0xdf11d0ae, BRF_SND | TAITO_MSM5205 }, - { "b14-29.109", 0x10000, 0x7ad983e7, BRF_SND | TAITO_MSM5205 }, - - { "b14-31.90", 0x02000, 0x5c6b013d, BRF_OPT }, -}; - -STD_ROM_PICK(Topspeedu) -STD_ROM_FN(Topspeedu) - -static struct BurnRomInfo FullthrlRomDesc[] = { - { "b14-67", 0x10000, 0x284c943f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b14-68", 0x10000, 0x54cf6196, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b14-05", 0x80000, 0x6557e9d8, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, - - { "b14-69.80", 0x10000, 0xd652e300, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b14-71", 0x10000, 0xf7081727, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b14-25.67", 0x10000, 0x9eab28ef, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b14-07.54", 0x20000, 0xc6025fff, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "b14-06.52", 0x20000, 0xb4e2536e, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "b14-01", 0x80000, 0x84a56f37, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b14-02", 0x80000, 0x6889186b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b14-03", 0x80000, 0xd1ed9e71, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b14-04", 0x80000, 0xb63f0519, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b14-30.88" , 0x10000, 0xdccb0c7f, BRF_GRA | TAITO_SPRITEMAP }, - - { "b14-28.103", 0x10000, 0xdf11d0ae, BRF_SND | TAITO_MSM5205 }, - { "b14-29.109", 0x10000, 0x7ad983e7, BRF_SND | TAITO_MSM5205 }, - - { "b14-31.90", 0x02000, 0x5c6b013d, BRF_OPT }, -}; - -STD_ROM_PICK(Fullthrl) -STD_ROM_FN(Fullthrl) - -static struct BurnRomInfo VolfiedRomDesc[] = { - { "c04-12-1.30", 0x10000, 0xafb6a058, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-08-1.10", 0x10000, 0x19f7e66b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-11-1.29", 0x10000, 0x1aaf6e9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-25-1.9", 0x10000, 0xb39e04f9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-20.7", 0x20000, 0x0aea651f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-22.9", 0x20000, 0xf405d465, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-19.6", 0x20000, 0x231493ae, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-21.8", 0x20000, 0x8598d38e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c04-06.71", 0x08000, 0xb70106b2, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c04-16.2", 0x20000, 0x8c2476ef, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-18.4", 0x20000, 0x7665212c, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-15.1", 0x20000, 0x7c50b978, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-17.3", 0x20000, 0xc62fdeb8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c04-4-1.3", 0x00200, 0xab9fae65, BRF_OPT }, - { "c04-5.75", 0x00200, 0x2763ec89, BRF_OPT }, -}; - -STD_ROM_PICK(Volfied) -STD_ROM_FN(Volfied) - -static struct BurnRomInfo VolfiedjRomDesc[] = { - { "c04-12-1.30", 0x10000, 0xafb6a058, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-08-1.10", 0x10000, 0x19f7e66b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-11-1.29", 0x10000, 0x1aaf6e9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-07-1.9", 0x10000, 0x5d9065d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-20.7", 0x20000, 0x0aea651f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-22.9", 0x20000, 0xf405d465, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-19.6", 0x20000, 0x231493ae, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-21.8", 0x20000, 0x8598d38e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c04-06.71", 0x08000, 0xb70106b2, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c04-16.2", 0x20000, 0x8c2476ef, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-18.4", 0x20000, 0x7665212c, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-15.1", 0x20000, 0x7c50b978, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-17.3", 0x20000, 0xc62fdeb8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c04-4-1.3", 0x00200, 0xab9fae65, BRF_OPT }, - { "c04-5.75", 0x00200, 0x2763ec89, BRF_OPT }, -}; - -STD_ROM_PICK(Volfiedj) -STD_ROM_FN(Volfiedj) - -static struct BurnRomInfo VolfiedjoRomDesc[] = { - { "c04-12.30", 0x10000, 0xe319c7ec, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-08.10", 0x10000, 0x81c6f755, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-11.29", 0x10000, 0xf05696a6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-07.9", 0x10000, 0x4eeda184, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-20.7", 0x20000, 0x0aea651f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-22.9", 0x20000, 0xf405d465, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-19.6", 0x20000, 0x231493ae, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-21.8", 0x20000, 0x8598d38e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c04-06.71", 0x08000, 0xb70106b2, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c04-16.2", 0x20000, 0x8c2476ef, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-18.4", 0x20000, 0x7665212c, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-15.1", 0x20000, 0x7c50b978, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-17.3", 0x20000, 0xc62fdeb8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c04-4-1.3", 0x00200, 0xab9fae65, BRF_OPT }, - { "c04-5.75", 0x00200, 0x2763ec89, BRF_OPT }, -}; - -STD_ROM_PICK(Volfiedjo) -STD_ROM_FN(Volfiedjo) - -static struct BurnRomInfo VolfieduRomDesc[] = { - { "c04-12-1.30", 0x10000, 0xafb6a058, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-08-1.10", 0x10000, 0x19f7e66b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-11-1.29", 0x10000, 0x1aaf6e9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-24-1.9", 0x10000, 0xc499346f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-20.7", 0x20000, 0x0aea651f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-22.9", 0x20000, 0xf405d465, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-19.6", 0x20000, 0x231493ae, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c04-21.8", 0x20000, 0x8598d38e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c04-06.71", 0x08000, 0xb70106b2, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c04-16.2", 0x20000, 0x8c2476ef, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-18.4", 0x20000, 0x7665212c, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-15.1", 0x20000, 0x7c50b978, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-17.3", 0x20000, 0xc62fdeb8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, - - { "c04-4-1.3", 0x00200, 0xab9fae65, BRF_OPT }, - { "c04-5.75", 0x00200, 0x2763ec89, BRF_OPT }, -}; - -STD_ROM_PICK(Volfiedu) -STD_ROM_FN(Volfiedu) - -static int MemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += Taito68KRom1Size; - Taito68KRom2 = Next; Next += Taito68KRom2Size; - TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; - TaitoZ80Rom2 = Next; Next += TaitoZ80Rom2Size; - TaitoSpriteMapRom = Next; Next += TaitoSpriteMapRomSize; - TaitoMSM5205Rom = Next; Next += TaitoMSM5205RomSize; - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x018000; - TaitoZ80Ram1 = Next; Next += 0x001000; - if (TaitoNumZ80s == 2) TaitoZ80Ram2 = Next; Next += 0x000800; - TaitoPaletteRam = Next; Next += 0x004000; - TaitoSpriteRam = Next; Next += 0x00f000; - TaitoSharedRam = Next; Next += 0x010000; - TaitoVideoRam = Next; Next += 0x080000; - Taito68KRam2 = Next; Next += 0x010000; - - TaitoRamEnd = Next; - - TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; - TaitoCharsB = Next; Next += TaitoNumCharB * TaitoCharBWidth * TaitoCharBHeight; - TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; - TaitoPalette = (UINT32*)Next; Next += 0x02000 * sizeof(UINT32); - - TaitoMemEnd = Next; - - return 0; -} - -static INT32 DariusDoReset() -{ - INT32 i; - - TaitoDoReset(); - - DariusADPCMCommand = 0; - DariusNmiEnable = 0; - DariusCoinWord = 0; - - for (i = 0; i < 8; i++) DariusVol[i] = 0x00; - - for (i = 0; i < 5; i++) DariusPan[i] = 0x80; - - for (i = 0; i < 0x10; i++) { - DariusDefVol[i] = (INT32)(100.0f / (float)pow(10.0f, (32.0f - (i * (32.0f / (float)(0xf)))) / 20.0f)); - } - - return 0; -} - -static INT32 RbislandDoReset() -{ -#if 0 - // This resets the YM2151 which calls DrvSoundBankSwitch via the port callback - TaitoDoReset(); -#else - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(0); - BurnYM2151Reset(); - ZetClose(); -#endif - - return 0; -} - -static INT32 OpwolfDoReset() -{ -#if 0 - // This resets the YM2151 which calls DrvSoundBankSwitch via the port callback - TaitoDoReset(); -#else - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(0); - BurnYM2151Reset(); - ZetClose(); - MSM5205Reset(); -#endif - - memset(OpwolfADPCM_B, 0, 8); - memset(OpwolfADPCM_C, 0, 8); - OpwolfADPCMPos[0] = OpwolfADPCMPos[1] = 0; - OpwolfADPCMEnd[0] = OpwolfADPCMEnd[1] = 0; - OpwolfADPCMData[0] = OpwolfADPCMData[1] = -1; - - MSM5205ResetWrite(0, 1); - MSM5205ResetWrite(1, 1); - - return 0; -} - -static INT32 RastanDoReset() -{ - TaitoDoReset(); - - RastanADPCMPos = 0; - RastanADPCMData = -1; - - return 0; -} - -static INT32 VolfiedDoReset() -{ - TaitoDoReset(); - - VolfiedVidCtrl = 0; - VolfiedVidMask = 0; - - return 0; -} - -static INT32 TopspeedDoReset() -{ - TaitoDoReset(); - - RastanADPCMPos = 0; - RastanADPCMData = -1; - - return 0; -} - -static void TaitoMiscCpuAReset(UINT16 d) -{ - TaitoCpuACtrl = d; - if (!(TaitoCpuACtrl & 1)) { - SekClose(); - SekOpen(1); - SekReset(); - SekClose(); - SekOpen(0); - } -} - -UINT8 __fastcall Darius68K1ReadByte(UINT32 a) -{ - switch (a) { - case 0xc00010: { - return TaitoDip[1]; - } - - case 0xc00011: { - return TaitoDip[0]; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius68K1WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Darius68K1ReadWord(UINT32 a) -{ - switch (a) { - case 0xc00002: { - return TC0140SYTCommRead(); - } - - case 0xc00008: { - return TaitoInput[0]; - } - - case 0xc0000a: { - return TaitoInput[1]; - } - - case 0xc0000c: { - return TaitoInput[2]; - } - - case 0xc0000e: { - return DariusCoinWord; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius68K1WriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x0a0000: { - TaitoMiscCpuAReset(d); - return; - } - - case 0x0b0000: { - //watchdog - return; - } - - case 0xc00000: { - TC0140SYTPortWrite(d & 0xff); - return; - } - - case 0xc00002: { - TC0140SYTCommWrite(d & 0xff); - return; - } - - case 0xc00020: - case 0xc00022: - case 0xc00024: - case 0xc00030: - case 0xc00032: - case 0xc00034: { - //misc io writes - return; - } - - case 0xc00050: { - //nop - return; - } - - case 0xc00060: { - DariusCoinWord = d; - return; - } - - case 0xd20000: - case 0xd20002: { - PC080SNSetScrollY(0, (a - 0xd20000) >> 1, d); - return; - } - - case 0xd40000: - case 0xd40002: { - PC080SNSetScrollX(0, (a - 0xd40000) >> 1, d); - return; - } - - case 0xd50000: { - PC080SNCtrlWrite(0, (a - 0xd50000) >> 1, d); - return; - } - - case 0xdc0000: { - //??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Darius68K2ReadByte(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius68K2WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Darius68K2ReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Darius68K2WriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0xc00050: { - //nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Opwolf68KReadByte(UINT32 a) -{ - if (a >= 0x0ff000 && a <= 0x0ff7ff) { - return OpwolfCChipDataRead((a - 0x0ff000) >> 1); - } - - switch (a) { - case 0x3e0002: { - return TC0140SYTCommRead(); - } - } - - return 0; -} - -void __fastcall Opwolf68KWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x0ff000 && a <= 0x0ff7ff) { - OpwolfCChipDataWrite(Taito68KRom1, (a - 0x0ff000) >> 1, d); - return; - } - - switch (a) { - case 0x3e0000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x3e0002: { - TC0140SYTCommWrite(d); - return; - } - } -} - -UINT16 __fastcall Opwolf68KReadWord(UINT32 a) -{ - if (a >= 0x0f0000 && a <= 0x0f07ff) { - return OpwolfCChipDataRead((a - 0x0f0000) >> 1); - } - - if (a >= 0x0ff000 && a <= 0x0ff7ff) { - return OpwolfCChipDataRead((a - 0x0ff000) >> 1); - } - - switch (a) { - case 0x3a0000: { - INT32 scaled = (BurnGunReturnX(0) * 320) / 256; - return scaled + 0x15 + OpWolfGunXOffset; - } - - case 0x3a0002: { - return BurnGunReturnY(0) - 0x24 + OpWolfGunYOffset; - } - - case 0x0ff802: { - return OpwolfCChipStatusRead(); - } - - case 0x380000: { - return TaitoDip[0]; - } - - case 0x380002: { - return TaitoDip[1]; - } - } - - return 0; -} - -void __fastcall Opwolf68KWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x0ff000 && a <= 0x0ff7ff) { - OpwolfCChipDataWrite(Taito68KRom1, (a - 0x0ff000) >> 1, d); - return; - } - - switch (a) { - case 0x0ff802: { - OpwolfCChipStatusWrite(); - return; - } - - case 0x0ffc00: { - OpwolfCChipBankWrite(d); - return; - } - - case 0x380000: { - PC090OJSpriteCtrl = (d & 0xe0) >> 5; - return; - } - - case 0x3c0000: { - // nop - return; - } - - case 0xc20000: - case 0xc20002: { - PC080SNSetScrollY(0, (a - 0xc20000) >> 1, d); - return; - } - - case 0xc40000: - case 0xc40002: { - PC080SNSetScrollX(0, (a - 0xc40000) >> 1, d); - return; - } - - case 0xc50000: { - PC080SNCtrlWrite(0, (a - 0xc50000) >> 1, d); - return; - } - } -} - -UINT8 __fastcall Opwolfb68KReadByte(UINT32 a) -{ - if (a >= 0x0ff000 && a <= 0x0fffff) { - return TaitoZ80Ram2[(a - 0x0ff000) >> 1]; - } - - switch (a) { - case 0x3e0002: { - return TC0140SYTCommRead(); - } - } - - return 0; -} - -void __fastcall Opwolfb68KWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x0ff000 && a <= 0x0fffff) { - TaitoZ80Ram2[(a - 0x0ff000) >> 1] = d ; - return; - } - - switch (a) { - case 0x3e0000: { - TC0140SYTPortWrite(d); - return; - } - - case 0x3e0002: { - TC0140SYTCommWrite(d); - return; - } - } -} - -UINT16 __fastcall Opwolfb68KReadWord(UINT32 a) -{ - if (a >= 0x0ff000 && a <= 0x0fffff) { - return TaitoZ80Ram2[(a - 0x0ff000) >> 1]; - } - - switch (a) { - case 0x0f0008: { - return TaitoInput[0]; - } - - case 0x0f000a: { - return TaitoInput[1]; - } - - case 0x380000: { - return TaitoDip[0]; - } - - case 0x380002: { - return TaitoDip[1]; - } - - case 0x3a0000: { - INT32 scaled = (BurnGunReturnX(0) * 320) / 256; - return scaled + 0x15 + OpWolfGunXOffset; - } - - case 0x3a0002: { - return BurnGunReturnY(0) - 0x24 + OpWolfGunYOffset; - } - } - - return 0; -} - -void __fastcall Opwolfb68KWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x0ff000 && a <= 0x0fffff) { - TaitoZ80Ram2[(a - 0x0ff000) >> 1] = d & 0xff; - return; - } - - switch (a) { - case 0x380000: { - PC090OJSpriteCtrl = (d & 0xe0) >> 5; - return; - } - - case 0x3c0000: { - // nop - return; - } - - case 0xc20000: - case 0xc20002: { - PC080SNSetScrollY(0, (a - 0xc20000) >> 1, d); - return; - } - - case 0xc40000: - case 0xc40002: { - PC080SNSetScrollX(0, (a - 0xc40000) >> 1, d); - return; - } - - case 0xc50000: { - PC080SNCtrlWrite(0, (a - 0xc50000) >> 1, d); - return; - } - } -} - -UINT8 __fastcall Rbisland68KReadByte(UINT32 a) -{ - if (a >= 0x800000 && a <= 0x8007ff) { - return RainbowCChipRamRead((a - 0x800000) >> 1); - } - - switch (a) { - case 0x800803: { - return RainbowCChipCtrlRead(); - } - } - - return 0; -} - -void __fastcall Rbisland68KWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x800000 && a <= 0x8007ff) { - RainbowCChipRamWrite((a - 0x800000) >> 1, d); - return; - } - - switch (a) { - case 0x3a0001: { - PC090OJSpriteCtrl = (d & 0xe0) >> 5; - return; - } - - case 0x3e0001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x3e0003: { - TC0140SYTCommWrite(d); - return; - } - - case 0x800803: { - RainbowCChipCtrlWrite(d); - return; - } - - case 0x800c01: { - RainbowCChipBankWrite(d); - return; - } - } -} - -UINT16 __fastcall Rbisland68KReadWord(UINT32 a) -{ - if (a >= 0x800000 && a <= 0x8007ff) { - return RainbowCChipRamRead((a - 0x800000) >> 1); - } - - switch (a) { - case 0x390000: { - return TaitoDip[0]; - } - - case 0x3b0000: { - return TaitoDip[1]; - } - } - - return 0; -} - -void __fastcall Rbisland68KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x3c0000: { - // nop - return; - } - - case 0xc20000: - case 0xc20002: { - PC080SNSetScrollY(0, (a - 0xc20000) >> 1, d); - return; - } - - case 0xc40000: - case 0xc40002: { - PC080SNSetScrollX(0, (a - 0xc40000) >> 1, d); - return; - } - - case 0xc50000: { - PC080SNCtrlWrite(0, (a - 0xc50000) >> 1, d); - return; - } - } -} - -UINT8 __fastcall Jumping68KReadByte(UINT32 a) -{ - switch (a) { - case 0x401001: { - return TaitoInput[0]; - } - - case 0x401003: { - return TaitoInput[1]; - } - - case 0x420000: { - // nop - return 0; - } - } - - return 0; -} - -void __fastcall Jumping68KWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x800000 && a <= 0x80ffff) return; - - switch (a) { - case 0x3a0001: { - PC090OJSpriteCtrl = d; - return; - } - - case 0x400007: { - TaitoSoundLatch = d; - ZetOpen(0); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - return; - } - } -} - -UINT16 __fastcall Jumping68KReadWord(UINT32 a) -{ - switch (a) { - case 0x400000: { - return TaitoDip[0]; - } - - case 0x400002: { - return TaitoDip[0]; - } - } - - return 0; -} - -void __fastcall Jumping68KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x3c0000: { - // nop - return; - } - - case 0x430000: - case 0x430002: { - PC080SNSetScrollY(0, (a - 0x430000) >> 1, d); - return; - } - - case 0xc20000: { - //nop - return; - } - - case 0xc50000: { - //??? - return; - } - } -} - -UINT8 __fastcall Rastan68KReadByte(UINT32 a) -{ - switch (a) { - case 0x390001: { - return TaitoInput[0]; - } - - case 0x390003: { - return TaitoInput[1]; - } - - case 0x390005: { - return TaitoInput[2]; - } - - case 0x390007: { - return TaitoInput[3]; - } - - case 0x390009: { - return TaitoDip[0]; - } - - case 0x39000b: { - return TaitoDip[1]; - } - - case 0x3e0003: { - return TC0140SYTCommRead(); - } - } - - return 0; -} - -void __fastcall Rastan68KWriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x3e0001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x3e0003: { - TC0140SYTCommWrite(d); - return; - } - } -} - -void __fastcall Rastan68KWriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x350008: { - // nop - return; - } - - case 0x380000: { - PC090OJSpriteCtrl = (d & 0xe0) >> 5; - return; - } - - case 0x3c0000: { - // watchdog - return; - } - - case 0xc20000: - case 0xc20002: { - PC080SNSetScrollY(0, (a - 0xc20000) >> 1, d); - return; - } - - case 0xc40000: - case 0xc40002: { - PC080SNSetScrollX(0, (a - 0xc40000) >> 1, d); - return; - } - - case 0xc50000: { - PC080SNCtrlWrite(0, (a - 0xc50000) >> 1, d); - return; - } - } -} - -static UINT8 TopspeedInputBypassRead() -{ - UINT8 Port = TC0220IOCPortRead(); - - INT32 Steer = (TaitoAnalogPort0 >> 4); - - switch (Port) { - case 0x0c: { - return Steer & 0xff; - } - - case 0x0d: { - return Steer >> 8; - } - - default: { - return TC0220IOCPortRegRead(); - } - } -} - -UINT8 __fastcall Topspeed68K1ReadByte(UINT32 a) -{ - switch (a) { - case 0x7e0003: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Topspeed68K1WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x7e0001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x7e0003: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Topspeed68K1ReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Topspeed68K1WriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0xe10000 && a <= 0xe1ffff) { - // ??? - return; - } - - switch (a) { - case 0x600002: { - TaitoMiscCpuAReset(d); - return; - } - - case 0x880002: - case 0x880004: - case 0x880006: { - // ??? - return; - } - - case 0xa20000: - case 0xa20002: { - PC080SNSetScrollY(0, (a - 0xa20000) >> 1, d); - return; - } - - case 0xa40000: - case 0xa40002: { - PC080SNSetScrollX(0, (a - 0xa40000) >> 1, d); - return; - } - - case 0xa50000: { - PC080SNCtrlWrite(0, (a - 0xa50000) >> 1, d); - return; - } - - case 0xb20000: - case 0xb20002: { - PC080SNSetScrollY(1, (a - 0xb20000) >> 1, d); - return; - } - - case 0xb40000: - case 0xb40002: { - PC080SNSetScrollX(1, (a - 0xb40000) >> 1, d); - return; - } - - case 0xb50000: { - PC080SNCtrlWrite(1, (a - 0xb50000) >> 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Topspeed68K2ReadByte(UINT32 a) -{ - if (a >= 0x900000 && a <= 0x9003ff) { - INT32 Offset = (a - 0x900000) >> 1; - - switch (Offset) { - case 0x000: return rand() & 0xff; - case 0x101: return 0x55; - } - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Topspeed68K2WriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x900000 && a <= 0x9003ff) { - return; - } - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Topspeed68K2ReadWord(UINT32 a) -{ - switch (a) { - case 0x880000: { - return TopspeedInputBypassRead(); - } - - case 0x880002: { - return TC0220IOCHalfWordPortRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Topspeed68K2WriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x810000: { - // ??? - return; - } - - case 0x880000: { - TC0220IOCHalfWordPortRegWrite(d); - return; - } - - case 0x880002: { - TC0220IOCHalfWordPortWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Volfied68KReadByte(UINT32 a) -{ - if (a >= 0xf00000 && a <= 0xf007ff) { - INT32 Offset = (a - 0xf00000) >> 1; - return VolfiedCChipRamRead(Offset); - } - - switch (a) { - case 0xd00001: { - return 0x60; - } - - case 0xe00003: { - return TC0140SYTCommRead(); - } - - case 0xf00803: { - return VolfiedCChipCtrlRead() & 0xff; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Volfied68KWriteByte(UINT32 a, UINT8 d) -{ - if (a >= 0x400000 && a <= 0x47ffff) { - INT32 Offset = (a - 0x400000); - INT32 Mask; - if (Offset & 1) { - Mask = VolfiedVidMask >> 8; - } else { - Mask = VolfiedVidMask & 0xff; - } - TaitoVideoRam[Offset ^ 1] = (TaitoVideoRam[Offset ^ 1] & ~Mask) | (d & Mask); - return; - } - - if (a >= 0xf00000 && a <= 0xf007ff) { - INT32 Offset = (a - 0xf00000) >> 1; - VolfiedCChipRamWrite(Offset, d); - return; - } - - switch (a) { - case 0x700001: { - PC090OJSpriteCtrl = (d & 0x3c) >> 2; - return; - } - - case 0xd00001: { - VolfiedVidCtrl = d; - return; - } - - case 0xf00803: { - // cchip ctrl write - ignored - return; - } - - case 0xf00c01: { - VolfiedCChipBankWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Volfied68KReadWord(UINT32 a) -{ - if (a >= 0xf00000 && a <= 0xf007ff) { - INT32 Offset = (a - 0xf00000) >> 1; - return VolfiedCChipRamRead(Offset); - } - - switch (a) { - case 0xd00000: { - return 0x60; - } - - case 0xe00002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Volfied68KWriteWord(UINT32 a, UINT16 d) -{ - if (a >= 0x400000 && a <= 0x47ffff) { - UINT16 *Ram = (UINT16*)TaitoVideoRam; - INT32 Offset = (a - 0x400000) >> 1; - Ram[Offset] = (Ram[Offset] & ~VolfiedVidMask) | (d & VolfiedVidMask); - return; - } - - if (a >= 0xf00000 && a <= 0xf007ff) { - INT32 Offset = (a - 0xf00000) >> 1; - VolfiedCChipRamWrite(Offset, d & 0xff); - return; - } - - switch (a) { - case 0x600000: { - VolfiedVidMask = d; - return; - } - - case 0xd00000: { - VolfiedVidCtrl = d; - return; - } - - case 0xe00000: { - TC0140SYTPortWrite(d & 0xff); - return; - } - - case 0xe00002: { - TC0140SYTCommWrite(d & 0xff); - return; - } - - case 0xf00c00: { - VolfiedCChipBankWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); - } - } -} - -static void DariusUpdateFM0() -{ - INT32 left = (DariusPan[0] * DariusVol[6]) >> 8; - INT32 right = ((0xff - DariusPan[0]) * DariusVol[6]) >> 8; - - BurnYM2203SetLeftVolume(0, BURN_SND_YM2203_YM2203_ROUTE, (left * DariusYM2203RouteMasterVol) / 100.0); - BurnYM2203SetRightVolume(0, BURN_SND_YM2203_YM2203_ROUTE, (right * DariusYM2203RouteMasterVol) / 100.0); -} - -static void DariusUpdateFM1() -{ - INT32 left = (DariusPan[1] * DariusVol[7]) >> 8; - INT32 right = ((0xff - DariusPan[1]) * DariusVol[7]) >> 8; - - BurnYM2203SetLeftVolume(1, BURN_SND_YM2203_YM2203_ROUTE, (left * DariusYM2203RouteMasterVol) / 100.0); - BurnYM2203SetRightVolume(1, BURN_SND_YM2203_YM2203_ROUTE, (right * DariusYM2203RouteMasterVol) / 100.0); -} - -static void DariusUpdatePSG0(INT32 port) -{ - INT32 left, right; - - left = (DariusPan[2] * DariusVol[port - 1]) >> 8; - right = ((0xff - DariusPan[2]) * DariusVol[port - 1]) >> 8; - - BurnYM2203SetLeftVolume(0, port, (left * DariusYM2203AY8910RouteMasterVol) / 100.0); - BurnYM2203SetRightVolume(0, port, (right * DariusYM2203AY8910RouteMasterVol) / 100.0); -} - -static void DariusUpdatePSG1(INT32 port) -{ - INT32 left, right; - - left = (DariusPan[3] * DariusVol[port + 2]) >> 8; - right = ((0xff - DariusPan[3]) * DariusVol[port + 2]) >> 8; - - BurnYM2203SetLeftVolume(1, port, (left * DariusYM2203AY8910RouteMasterVol) / 100.0); - BurnYM2203SetRightVolume(1, port, (right * DariusYM2203AY8910RouteMasterVol) / 100.0); -} - -static void DariusUpdateDa() -{ - INT32 left = DariusDefVol[(DariusPan[4] >> 4) & 0x0f]; - INT32 right = DariusDefVol[(DariusPan[4] >> 0) & 0x0f]; - - MSM5205SetLeftVolume(0, (left * DariusMSM5205RouteMasterVol) / 100.0); - MSM5205SetRightVolume(0, (right * DariusMSM5205RouteMasterVol) / 100.0); -} - -UINT8 __fastcall DariusZ80Read(UINT16 a) -{ - switch (a) { - case 0x9000: { - return BurnYM2203Read(0, 0); - } - - case 0x9001: { - return BurnYM2203Read(0, 1); - } - - case 0xa000: { - return BurnYM2203Read(1, 0); - } - - case 0xa001: { - return BurnYM2203Read(1, 1); - } - - case 0xb001: { - return TC0140SYTSlaveCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read %04X\n"), a); - } - } - - return 0; -} - -void __fastcall DariusZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x9000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0x9001: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0xa000: { - BurnYM2203Write(1, 0, d); - return; - } - - case 0xa001: { - BurnYM2203Write(1, 1, d); - return; - } - - case 0xb000: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xb001: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xc000: { - DariusPan[0] = d; - DariusUpdateFM0(); - return; - } - - case 0xc400: { - DariusPan[1] = d; - DariusUpdateFM1(); - return; - } - - case 0xc800: { - DariusPan[2] = d; - DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_1); - DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_2); - DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_3); - return; - } - - case 0xcc00: { - DariusPan[3] = d; - DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_1); - DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_2); - DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_3); - return; - } - - case 0xd000: { - DariusPan[4] = d; - DariusUpdateDa(); - return; - } - - case 0xd400: { - DariusADPCMCommand = d; - return; - } - - case 0xd800: { - //??? - return; - } - - case 0xdc00: { - TaitoZ80Bank = d & 0x03; - ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 + 0x10000 + (TaitoZ80Bank * 0x8000)); - ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 + 0x10000 + (TaitoZ80Bank * 0x8000)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall DariusZ802ReadPort(UINT16 a) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - return DariusADPCMCommand; - } - - case 0x02: { - //??? - return 0; - } - - case 0x03: { - //??? - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); - } - } - - return 0; -} - -void __fastcall DariusZ802WritePort(UINT16 a, UINT8 d) -{ - a &= 0xff; - - switch (a) { - case 0x00: { - DariusNmiEnable = 0; - return; - } - - case 0x01: { - DariusNmiEnable = 1; - return; - } - - case 0x02: { - MSM5205DataWrite(0, d); - MSM5205ResetWrite(0, !(d & 0x20)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall OpwolfZ80Read(UINT16 a) -{ - switch (a) { - case 0x9001: { - return BurnYM2151ReadStatus(); - } - - case 0xa001: { - return TC0140SYTSlaveCommRead(); - } - } - - return 0; -} - -void __fastcall OpwolfZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x9000: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x9001: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xa000: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xa001: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xb000: - case 0xb001: - case 0xb002: - case 0xb003: - case 0xb004: - case 0xb005: - case 0xb006: { - INT32 nStart; - INT32 nEnd; - INT32 Offset = a - 0xb000; - - OpwolfADPCM_B[Offset] = d; - if (Offset == 0x04) { - nStart = OpwolfADPCM_B[0] + (OpwolfADPCM_B[1] << 8); - nEnd = OpwolfADPCM_B[2] + (OpwolfADPCM_B[3] << 8); - nStart *= 16; - nEnd *= 16; - OpwolfADPCMPos[0] = nStart; - OpwolfADPCMEnd[0] = nEnd; - MSM5205ResetWrite(0, 0); - } - return; - } - - case 0xc000: - case 0xc001: - case 0xc002: - case 0xc003: - case 0xc004: - case 0xc005: - case 0xc006: { - INT32 nStart; - INT32 nEnd; - INT32 Offset = a - 0xc000; - - OpwolfADPCM_C[Offset] = d; - if (Offset == 0x04) { - nStart = OpwolfADPCM_C[0] + (OpwolfADPCM_C[1] << 8); - nEnd = OpwolfADPCM_C[2] + (OpwolfADPCM_C[3] << 8); - nStart *= 16; - nEnd *= 16; - OpwolfADPCMPos[1] = nStart; - OpwolfADPCMEnd[1] = nEnd; - MSM5205ResetWrite(1, 0); - } - return; - } - - case 0xd000: - case 0xe000: { - return; - } - } -} - -UINT8 __fastcall RbislandZ80Read(UINT16 a) -{ - switch (a) { - case 0x9001: { - return BurnYM2151ReadStatus(); - } - - case 0xa001: { - return TC0140SYTSlaveCommRead(); - } - } - - return 0; -} - -void __fastcall RbislandZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x9000: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x9001: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xa000: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xa001: { - TC0140SYTSlaveCommWrite(d); - return; - } - } -} - -UINT8 __fastcall JumpingZ80Read(UINT16 a) -{ - switch (a) { - case 0xb000: { - return BurnYM2203Read(0, 0); - } - - case 0xb400: { - return BurnYM2203Read(1, 0); - } - - case 0xb800: { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return TaitoSoundLatch; - } - } - - return 0; -} - -void __fastcall JumpingZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xb000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0xb001: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0xb400: { - BurnYM2203Write(1, 0, d); - return; - } - - case 0xb401: { - BurnYM2203Write(1, 1, d); - return; - } - - case 0xbc00: { - //nop - return; - } - } -} - -UINT8 __fastcall RastanZ80Read(UINT16 a) -{ - switch (a) { - case 0x9001: { - return BurnYM2151ReadStatus(); - } - - case 0xa001: { - return TC0140SYTSlaveCommRead(); - } - } - - return 0; -} - -void __fastcall RastanZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x9000: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x9001: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xa000: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xa001: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xb000: { - RastanADPCMPos = (RastanADPCMPos & 0x00ff) | (d << 8); - return; - } - - case 0xc000: { - MSM5205ResetWrite(0, 0); - return; - } - - case 0xd000: { - MSM5205ResetWrite(0, 1); - RastanADPCMPos &= 0xff00; - return; - } - } -} - -UINT8 __fastcall TopspeedZ80Read(UINT16 a) -{ - switch (a) { - case 0x9001: { - return BurnYM2151ReadStatus(); - } - - case 0xa001: { - return TC0140SYTSlaveCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read %04X\n"), a); - } - } - - return 0; -} - -void __fastcall TopspeedZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x9000: { - BurnYM2151SelectRegister(d); - return; - } - - case 0x9001: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xa000: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xa001: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xb000: { - RastanADPCMPos = (RastanADPCMPos & 0x00ff) | (d << 8); - MSM5205ResetWrite(0, 0); - return; - } - - case 0xb800: { - MSM5205ResetWrite(0, 1); - RastanADPCMPos &= 0xff00; - return; - } - - case 0xc000: - case 0xc400: - case 0xc800: - case 0xcc00: - case 0xd000: - case 0xd200: - case 0xd400: - case 0xd600: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall VolfiedZ80Read(UINT16 a) -{ - switch (a) { - case 0x8801: { - return TC0140SYTSlaveCommRead(); - } - - case 0x9000: { - return BurnYM2203Read(0, 0); - } - - case 0x9001: { - return BurnYM2203Read(0, 1); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read %04X\n"), a); - } - } - - return 0; -} - -void __fastcall VolfiedZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0x8800: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0x8801: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0x9000: { - BurnYM2203Write(0, 0, d); - return; - } - - case 0x9001: { - BurnYM2203Write(0, 1, d); - return; - } - - case 0x9800: { - // nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall OpwolfbCChipSubZ80Read(UINT16 a) -{ - switch (a) { - case 0x8800: { - return TaitoInput[0]; - } - - case 0x9800: { - return TaitoInput[0]; - } - } - - return 0; -} - -void __fastcall OpwolfbCChipSubZ80Write(UINT16 a, UINT8) -{ - switch (a) { - case 0x9000: - case 0xa000: { - //nop - return; - } - } -} - -static void TaitoYM2151IRQHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static void TaitoYM2203IRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -inline static INT32 TaitoSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)((double)ZetTotalCycles() * nSoundRate / 4000000); -} - -inline static double TaitoGetTime() -{ - return (double)ZetTotalCycles() / 4000000; -} - -static void RbislandBankSwitch(UINT32, UINT32 Data) -{ - TaitoZ80Bank = (Data - 1) & 3; - - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); -} - -static void RastanBankSwitch(UINT32, UINT32 Data) -{ - Data &= 3; - if (Data != 0) { - TaitoZ80Bank = Data - 1; - - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - } -} - -static void DariusAdpcmInt() -{ - if (DariusNmiEnable) ZetNmi(); -} - -static void OpwolfMSM5205Vck0() -{ - if (OpwolfADPCMData[0] != -1) { - MSM5205DataWrite(0, OpwolfADPCMData[0] & 0x0f); - OpwolfADPCMData[0] = -1; - if (OpwolfADPCMPos[0] == OpwolfADPCMEnd[0]) MSM5205ResetWrite(0, 1); - } else { - OpwolfADPCMData[0] = TaitoMSM5205Rom[OpwolfADPCMPos[0]]; - OpwolfADPCMPos[0] = (OpwolfADPCMPos[0] + 1) & 0x7ffff; - MSM5205DataWrite(0, OpwolfADPCMData[0] >> 4); - } -} - -static void OpwolfMSM5205Vck1() -{ - if (OpwolfADPCMData[1] != -1) { - MSM5205DataWrite(1, OpwolfADPCMData[1] & 0x0f); - OpwolfADPCMData[1] = -1; - if (OpwolfADPCMPos[1] == OpwolfADPCMEnd[1]) MSM5205ResetWrite(1, 1); - } else { - OpwolfADPCMData[1] = TaitoMSM5205Rom[OpwolfADPCMPos[1]]; - OpwolfADPCMPos[1] = (OpwolfADPCMPos[1] + 1) & 0x7ffff; - MSM5205DataWrite(1, OpwolfADPCMData[1] >> 4); - } -} - -static void RastanMSM5205Vck() -{ - if (RastanADPCMData != -1) { - MSM5205DataWrite(0, RastanADPCMData & 0x0f); - RastanADPCMData = -1; - } else { - RastanADPCMData = TaitoMSM5205Rom[RastanADPCMPos]; - RastanADPCMPos = (RastanADPCMPos + 1) & 0xffff; - MSM5205DataWrite(0, RastanADPCMData >> 4); - } -} - -static void TopspeedBankSwitch(UINT32, UINT32 Data) -{ - Data &= 3; - if (Data != 0) { - TaitoZ80Bank = Data - 1; - - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - } -} - -static void TopspeedMSM5205Vck() -{ - if (RastanADPCMData != -1) { - MSM5205DataWrite(0, RastanADPCMData & 0x0f); - RastanADPCMData = -1; - } else { - RastanADPCMData = TaitoMSM5205Rom[RastanADPCMPos]; - RastanADPCMPos = (RastanADPCMPos + 1) & 0x1ffff; - MSM5205DataWrite(0, RastanADPCMData >> 4); - } -} - -static UINT8 VolfiedDip1Read(UINT32) -{ - return TaitoDip[0]; -} - -static UINT8 VolfiedDip2Read(UINT32) -{ - return TaitoDip[1]; -} - -static void DariusWritePortA0(UINT32, UINT32 d) -{ - d &= 0xff; - - DariusVol[0] = DariusDefVol[(d >> 4) & 0x0f]; - DariusVol[6] = DariusDefVol[(d >> 0) & 0x0f]; - DariusUpdateFM0(); - DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_1); -} - -static void DariusWritePortA1(UINT32, UINT32 d) -{ - d &= 0xff; - - DariusVol[3] = DariusDefVol[(d >> 4) & 0x0f]; - DariusVol[7] = DariusDefVol[(d >> 0) & 0x0f]; - DariusUpdateFM1(); - DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_1); -} - -static void DariusWritePortB0(UINT32, UINT32 d) -{ - d &= 0xff; - - DariusVol[1] = DariusDefVol[(d >> 4) & 0x0f]; - DariusVol[2] = DariusDefVol[(d >> 0) & 0x0f]; - DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_2); - DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_3); -} - -static void DariusWritePortB1(UINT32, UINT32 d) -{ - d &= 0xff; - - DariusVol[4] = DariusDefVol[(d >> 4) & 0x0f]; - DariusVol[5] = DariusDefVol[(d >> 0) & 0x0f]; - DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_2); - DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_3); -} - -static INT32 DariusCharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 DariusCharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; -static INT32 DariusCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 DariusCharBPlaneOffsets[2] = { 0, 8 }; -static INT32 DariusCharBXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 DariusCharBYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; -static INT32 DariusSpritePlaneOffsets[4] = { 24, 8, 16, 0 }; -static INT32 DariusSpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 256, 257, 258, 259, 260, 261, 262, 263 }; -static INT32 DariusSpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; -static INT32 OpwolfbCharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 OpwolfbCharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; -static INT32 OpwolfbCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 OpwolfbSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 OpwolfbSpriteXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60 }; -static INT32 OpwolfbSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; -static INT32 RbislandCharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 RbislandCharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; -static INT32 RbislandCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 RbislandSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 RbislandSpriteXOffsets[16] = { 8, 12, 0, 4, 24, 28, 16, 20, 40, 44, 32, 36, 56, 60, 48, 52 }; -static INT32 RbislandSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; -static INT32 JumpingCharPlaneOffsets[4] = { 0, 0x20000*8, 0x40000*8, 0x60000*8 }; -static INT32 JumpingCharXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 JumpingCharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; -static INT32 JumpingSpritePlaneOffsets[4] = { 0x78000*8, 0x50000*8, 0x28000*8, 0 }; -static INT32 JumpingSpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 JumpingSpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; -static INT32 RastanCharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 RastanCharXOffsets[8] = { 0, 4, 0x200000, 0x200004, 8, 12, 0x200008, 0x20000c }; -static INT32 RastanCharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; -static INT32 RastanSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 RastanSpriteXOffsets[16] = { 0, 4, 0x200000, 0x200004, 8, 12, 0x200008, 0x20000c, 16, 20, 0x200010, 0x200014, 24, 28, 0x200018, 0x20001c }; -static INT32 RastanSpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; -static INT32 TopspeedCharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 TopspeedCharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; -static INT32 TopspeedCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 TopspeedSpritePlaneOffsets[4] = { 0, 8, 16, 24 }; -static INT32 TopspeedSpriteXOffsets[16] = { 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 TopspeedSpriteYOffsets[8] = { 0, 64, 128, 192, 256, 320, 384, 448 }; -static INT32 VolfiedSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 VolfiedSpriteXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60 }; -static INT32 VolfiedSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; - -static INT32 DariusInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = DariusCharPlaneOffsets; - TaitoCharXOffsets = DariusCharXOffsets; - TaitoCharYOffsets = DariusCharYOffsets; - TaitoNumChar = 0x3000; - - TaitoCharBModulo = 0x80; - TaitoCharBNumPlanes = 2; - TaitoCharBWidth = 8; - TaitoCharBHeight = 8; - TaitoCharBPlaneOffsets = DariusCharBPlaneOffsets; - TaitoCharBXOffsets = DariusCharBXOffsets; - TaitoCharBYOffsets = DariusCharBYOffsets; - TaitoNumCharB = 0x800; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = DariusSpritePlaneOffsets; - TaitoSpriteAXOffsets = DariusSpriteXOffsets; - TaitoSpriteAYOffsets = DariusSpriteYOffsets; - TaitoNumSpriteA = 0x1800; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 2; - TaitoNumYM2203 = 2; - TaitoNumMSM5205 = 1; - - TaitoLoadRoms(0); - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "darius") != 0) Taito68KRom1Size = 0x60000; - TaitoZ80Rom1Size = 0x30000; - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "darius") != 0) { - memcpy(Taito68KRom1 + 0x40000, Taito68KRom1 + 0x20000, 0x20000); - memset(Taito68KRom1 + 0x20000, 0xff, 0x20000); - } - - for (INT32 i = 3; i >= 0; i--) { - memcpy(TaitoZ80Rom1 + 0x8000 * i + 0x10000, TaitoZ80Rom1 , 0x4000); - memcpy(TaitoZ80Rom1 + 0x8000 * i + 0x14000, TaitoZ80Rom1 + 0x4000 * i, 0x4000); - } - - PC080SNInit(0, TaitoNumChar, -16, 0, 0, 1); - TC0140SYTInit(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x080000, 0x08ffff, SM_RAM); - SekMapMemory(PC080SNRam[0] , 0xd00000, 0xd0ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0xd80000, 0xd80fff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0xe00100, 0xe00fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0xe01000, 0xe02fff, SM_RAM); - SekMapMemory(TaitoVideoRam , 0xe08000, 0xe0ffff, SM_RAM); - SekMapMemory(Taito68KRam1 + 0x10000 , 0xe10000, 0xe10fff, SM_RAM); - SekSetReadByteHandler(0, Darius68K1ReadByte); - SekSetWriteByteHandler(0, Darius68K1WriteByte); - SekSetReadWordHandler(0, Darius68K1ReadWord); - SekSetWriteWordHandler(0, Darius68K1WriteWord); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x040000, 0x04ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0xd80000, 0xd80fff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0xe00100, 0xe00fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0xe01000, 0xe02fff, SM_RAM); - SekMapMemory(TaitoVideoRam , 0xe08000, 0xe0ffff, SM_RAM); - SekSetReadByteHandler(0, Darius68K2ReadByte); - SekSetWriteByteHandler(0, Darius68K2WriteByte); - SekSetReadWordHandler(0, Darius68K2ReadWord); - SekSetWriteWordHandler(0, Darius68K2WriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(DariusZ80Read); - ZetSetWriteHandler(DariusZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetInHandler(DariusZ802ReadPort); - ZetSetOutHandler(DariusZ802WritePort); - ZetMapArea(0x0000, 0xffff, 0, TaitoZ80Rom2 ); - ZetMapArea(0x0000, 0xffff, 2, TaitoZ80Rom2 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 4000000, TaitoYM2203IRQHandler, TaitoSynchroniseStream, TaitoGetTime, 0); - BurnTimerAttachZet(8000000 / 2); - BurnYM2203SetPorts(0, NULL, NULL, &DariusWritePortA0, &DariusWritePortB0); - BurnYM2203SetPorts(1, NULL, NULL, &DariusWritePortA1, &DariusWritePortB1); - DariusYM2203AY8910RouteMasterVol = 0.08; - DariusYM2203RouteMasterVol = 0.60; - bYM2203UseSeperateVolumes = 1; - - MSM5205Init(0, TaitoSynchroniseStream, 384000, DariusAdpcmInt, MSM5205_S48_4B, 1); - DariusMSM5205RouteMasterVol = 1.00; - MSM5205SetSeperateVolumes(0, 1); - - GenericTilesInit(); - - TaitoDrawFunction = DariusDraw; - TaitoMakeInputsFunction = DariusMakeInputs; - TaitoIrqLine = 4; - - nTaitoCyclesTotal[0] = (16000000 / 2) / 60; - nTaitoCyclesTotal[1] = (16000000 / 2) / 60; - nTaitoCyclesTotal[2] = (8000000 / 2) / 60; - nTaitoCyclesTotal[3] = (8000000 / 2) / 60; - - // Reset the driver - TaitoResetFunction = DariusDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 OpwolfInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = RbislandCharPlaneOffsets; - TaitoCharXOffsets = RbislandCharXOffsets; - TaitoCharYOffsets = RbislandCharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = RbislandSpritePlaneOffsets; - TaitoSpriteAXOffsets = RbislandSpriteXOffsets; - TaitoSpriteAYOffsets = RbislandSpriteYOffsets; - TaitoNumSpriteA = 0x1000; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoNumYM2151 = 1; - TaitoNumMSM5205 = 2; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - PC080SNInit(0, TaitoNumChar, 0, 8, 0, 0); - PC090OJInit(TaitoNumSpriteA, 0, 8, 0); - TC0140SYTInit(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x107fff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x200fff, SM_RAM); - SekMapMemory(PC080SNRam[0] , 0xc00000, 0xc0ffff, SM_RAM); - SekMapMemory(Taito68KRam1 + 0x8000 , 0xc10000, 0xc1ffff, SM_RAM); - SekMapMemory(PC090OJRam , 0xd00000, 0xd03fff, SM_RAM); - SekSetReadByteHandler(0, Opwolf68KReadByte); - SekSetWriteByteHandler(0, Opwolf68KWriteByte); - SekSetReadWordHandler(0, Opwolf68KReadWord); - SekSetWriteWordHandler(0, Opwolf68KWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(OpwolfZ80Read); - ZetSetWriteHandler(OpwolfZ80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(4000000); - BurnYM2151SetIrqHandler(&TaitoYM2151IRQHandler); - BurnYM2151SetPortHandler(&RbislandBankSwitch); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); - - MSM5205Init(0, TaitoSynchroniseStream, 384000, OpwolfMSM5205Vck0, MSM5205_S48_4B, 1); - MSM5205Init(1, TaitoSynchroniseStream, 384000, OpwolfMSM5205Vck1, MSM5205_S48_4B, 1); - MSM5205SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); - MSM5205SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - BurnGunInit(1, true); - - TaitoDrawFunction = OpwolfDraw; - TaitoMakeInputsFunction = OpwolfMakeInputs; - TaitoIrqLine = 5; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = 4000000 / 60; - - UINT16 *Rom = (UINT16*)Taito68KRom1; - OpWolfGunXOffset = 0xec - (Rom[0x03ffb0 / 2] & 0xff); - OpWolfGunYOffset = 0x1c - (Rom[0x03ffae / 2] & 0xff); - INT32 Region = Rom[0x03fffe / 2] & 0xff; - OpwolfCChipInit(Region); - - // Reset the driver - TaitoResetFunction = OpwolfDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 OpwolfbInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = OpwolfbCharPlaneOffsets; - TaitoCharXOffsets = OpwolfbCharXOffsets; - TaitoCharYOffsets = OpwolfbCharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = OpwolfbSpritePlaneOffsets; - TaitoSpriteAXOffsets = OpwolfbSpriteXOffsets; - TaitoSpriteAYOffsets = OpwolfbSpriteYOffsets; - TaitoNumSpriteA = 0x1000; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 2; - TaitoNumYM2151 = 1; - TaitoNumMSM5205 = 2; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - PC080SNInit(0, TaitoNumChar, 0, 8, 0, 0); - PC090OJInit(TaitoNumSpriteA, 0, 8, 0); - TC0140SYTInit(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x107fff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x200fff, SM_RAM); - SekMapMemory(PC080SNRam[0] , 0xc00000, 0xc0ffff, SM_RAM); - SekMapMemory(Taito68KRam1 + 0x8000 , 0xc10000, 0xc1ffff, SM_RAM); - SekMapMemory(PC090OJRam , 0xd00000, 0xd03fff, SM_RAM); - SekSetReadByteHandler(0, Opwolfb68KReadByte); - SekSetWriteByteHandler(0, Opwolfb68KWriteByte); - SekSetReadWordHandler(0, Opwolfb68KReadWord); - SekSetWriteWordHandler(0, Opwolfb68KWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(OpwolfZ80Read); - ZetSetWriteHandler(OpwolfZ80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetSetReadHandler(OpwolfbCChipSubZ80Read); - ZetSetWriteHandler(OpwolfbCChipSubZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom2 ); - ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom2 ); - ZetMapArea(0xc000, 0xc7ff, 0, TaitoZ80Ram2 ); - ZetMapArea(0xc000, 0xc7ff, 1, TaitoZ80Ram2 ); - ZetMapArea(0xc000, 0xc7ff, 2, TaitoZ80Ram2 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(4000000); - BurnYM2151SetIrqHandler(&TaitoYM2151IRQHandler); - BurnYM2151SetPortHandler(&RbislandBankSwitch); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); - - MSM5205Init(0, TaitoSynchroniseStream, 384000, OpwolfMSM5205Vck0, MSM5205_S48_4B, 1); - MSM5205Init(1, TaitoSynchroniseStream, 384000, OpwolfMSM5205Vck1, MSM5205_S48_4B, 1); - MSM5205SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); - MSM5205SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - BurnGunInit(1, true); - - TaitoDrawFunction = OpwolfDraw; - TaitoMakeInputsFunction = OpwolfbMakeInputs; - TaitoIrqLine = 5; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = 4000000 / 60; - nTaitoCyclesTotal[2] = 4000000 / 60; - - OpWolfGunXOffset = -2; - OpWolfGunYOffset = 17; - - // Reset the driver - TaitoResetFunction = OpwolfDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 RbislandInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = RbislandCharPlaneOffsets; - TaitoCharXOffsets = RbislandCharXOffsets; - TaitoCharYOffsets = RbislandCharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = RbislandSpritePlaneOffsets; - TaitoSpriteAXOffsets = RbislandSpriteXOffsets; - TaitoSpriteAYOffsets = RbislandSpriteYOffsets; - TaitoNumSpriteA = 0x1400; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoNumYM2151 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - PC080SNInit(0, TaitoNumChar, 0, 16, 0, 0); - PC090OJInit(TaitoNumSpriteA, 0, 16, 0); - TC0140SYTInit(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x10c000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x200fff, SM_RAM); - SekMapMemory(Taito68KRam1 + 0x4000 , 0x201000, 0x203fff, SM_RAM); - SekMapMemory(PC080SNRam[0] , 0xc00000, 0xc0ffff, SM_RAM); - SekMapMemory(PC090OJRam , 0xd00000, 0xd03fff, SM_RAM); - SekSetReadByteHandler(0, Rbisland68KReadByte); - SekSetWriteByteHandler(0, Rbisland68KWriteByte); - SekSetReadWordHandler(0, Rbisland68KReadWord); - SekSetWriteWordHandler(0, Rbisland68KWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(RbislandZ80Read); - ZetSetWriteHandler(RbislandZ80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(16000000 / 4); - BurnYM2151SetIrqHandler(&TaitoYM2151IRQHandler); - BurnYM2151SetPortHandler(&RbislandBankSwitch); - BurnYM2151SetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - TaitoDrawFunction = RbislandDraw; - TaitoMakeInputsFunction = RbislandMakeInputs; - TaitoIrqLine = 4; - - nTaitoCyclesTotal[0] = (16000000 / 2) / 60; - nTaitoCyclesTotal[1] = (16000000 / 4) / 60; - - INT32 CChipVer = 0; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "rbislande")) CChipVer = 1; - RainbowCChipInit(CChipVer); - - // Reset the driver - TaitoResetFunction = RbislandDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 JumpingInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x40; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = JumpingCharPlaneOffsets; - TaitoCharXOffsets = JumpingCharXOffsets; - TaitoCharYOffsets = JumpingCharYOffsets; - TaitoNumChar = 16384; - - TaitoSpriteAModulo = 0x100; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = JumpingSpritePlaneOffsets; - TaitoSpriteAXOffsets = JumpingSpriteXOffsets; - TaitoSpriteAYOffsets = JumpingSpriteYOffsets; - TaitoSpriteAInvertRom = 1; - TaitoNumSpriteA = 5120; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoNumYM2203 = 2; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - PC080SNInit(0, TaitoNumChar, 0, 16, 1, 0); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x09ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x10c000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x200fff, SM_RAM); - SekMapMemory(Taito68KRam1 + 0x4000 , 0x201000, 0x203fff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x440000, 0x4407ff, SM_RAM); - SekMapMemory(PC080SNRam[0] , 0xc00000, 0xc0ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam + 0x800 , 0xd00000, 0xd01fff, SM_RAM); - SekSetReadByteHandler(0, Jumping68KReadByte); - SekSetWriteByteHandler(0, Jumping68KWriteByte); - SekSetReadWordHandler(0, Jumping68KReadWord); - SekSetWriteWordHandler(0, Jumping68KWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(JumpingZ80Read); - ZetSetWriteHandler(JumpingZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xffff, 0, TaitoZ80Rom1 + 0xc000 ); - ZetMapArea(0xc000, 0xffff, 2, TaitoZ80Rom1 + 0xc000 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(2, 3579545, NULL, TaitoSynchroniseStream, TaitoGetTime, 0); - BurnTimerAttachZet(4000000); - BurnYM2203SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); - BurnYM2203SetAllRoutes(1, 0.30, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - TaitoDrawFunction = JumpingDraw; - TaitoMakeInputsFunction = JumpingMakeInputs; - TaitoIrqLine = 4; - PC080SNSetFgTransparentPen(0, 0x0f); - - nTaitoCyclesTotal[0] = 8000000 / 60; - nTaitoCyclesTotal[1] = 4000000 / 60; - - // Reset the driver - TaitoResetFunction = TaitoDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 RastanInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x80; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = RastanCharPlaneOffsets; - TaitoCharXOffsets = RastanCharXOffsets; - TaitoCharYOffsets = RastanCharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = RastanSpritePlaneOffsets; - TaitoSpriteAXOffsets = RastanSpriteXOffsets; - TaitoSpriteAYOffsets = RastanSpriteYOffsets; - TaitoNumSpriteA = 0x1000; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoNumYM2151 = 1; - TaitoNumMSM5205 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - PC080SNInit(0, TaitoNumChar, 0, 8, 0, 0); - PC090OJInit(TaitoNumSpriteA, 0, 8, 0); - TC0140SYTInit(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x05ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x10c000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x200000, 0x200fff, SM_RAM); - SekMapMemory(PC080SNRam[0] , 0xc00000, 0xc0ffff, SM_RAM); - SekMapMemory(PC090OJRam , 0xd00000, 0xd03fff, SM_RAM); - SekSetReadByteHandler(0, Rastan68KReadByte); - SekSetWriteByteHandler(0, Rastan68KWriteByte); - SekSetWriteWordHandler(0, Rastan68KWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(RastanZ80Read); - ZetSetWriteHandler(RastanZ80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(16000000 / 4); - BurnYM2151SetIrqHandler(&TaitoYM2151IRQHandler); - BurnYM2151SetPortHandler(&RastanBankSwitch); - BurnYM2151SetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); - - MSM5205Init(0, TaitoSynchroniseStream, 384000, RastanMSM5205Vck, MSM5205_S48_4B, 1); - MSM5205SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - TaitoDrawFunction = RastanDraw; - TaitoMakeInputsFunction = RastanMakeInputs; - TaitoIrqLine = 5; - - nTaitoCyclesTotal[0] = (16000000 / 2) / 60; - nTaitoCyclesTotal[1] = (16000000 / 4) / 60; - - // Reset the driver - TaitoResetFunction = RastanDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 TopspeedInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = TopspeedCharPlaneOffsets; - TaitoCharXOffsets = TopspeedCharXOffsets; - TaitoCharYOffsets = TopspeedCharYOffsets; - TaitoNumChar = 0x2000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 8; - TaitoSpriteAPlaneOffsets = TopspeedSpritePlaneOffsets; - TaitoSpriteAXOffsets = TopspeedSpriteXOffsets; - TaitoSpriteAYOffsets = TopspeedSpriteYOffsets; - TaitoNumSpriteA = 0x8000; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 1; - TaitoNumYM2151 = 1; - TaitoNumMSM5205 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - PC080SNInit(0, TaitoNumChar, 0, 8, 0, 0); - PC080SNInit(1, TaitoNumChar, 0, 8, 0, 0); - TC0140SYTInit(); - TC0220IOCInit(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x01ffff, SM_ROM); - SekMapMemory(Taito68KRom1 + 0x20000 , 0x080000, 0x0fffff, SM_ROM); - SekMapMemory(TaitoSharedRam , 0x400000, 0x40ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x500000, 0x503fff, SM_RAM); - SekMapMemory(Taito68KRam1 , 0x800000, 0x80ffff, SM_RAM); - SekMapMemory(PC080SNRam[0] , 0xa00000, 0xa0ffff, SM_RAM); - SekMapMemory(PC080SNRam[1] , 0xb00000, 0xb0ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0xd00000, 0xd00fff, SM_RAM); - SekMapMemory(TaitoVideoRam , 0xe00000, 0xe0ffff, SM_RAM); - SekSetReadByteHandler(0, Topspeed68K1ReadByte); - SekSetWriteByteHandler(0, Topspeed68K1WriteByte); - SekSetReadWordHandler(0, Topspeed68K1ReadWord); - SekSetWriteWordHandler(0, Topspeed68K1WriteWord); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x01ffff, SM_ROM); - SekMapMemory(TaitoSharedRam , 0x400000, 0x40ffff, SM_RAM); - SekSetReadByteHandler(0, Topspeed68K2ReadByte); - SekSetWriteByteHandler(0, Topspeed68K2WriteByte); - SekSetReadWordHandler(0, Topspeed68K2ReadWord); - SekSetWriteWordHandler(0, Topspeed68K2WriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(TopspeedZ80Read); - ZetSetWriteHandler(TopspeedZ80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2151Init(16000000 / 4); - BurnYM2151SetIrqHandler(&TaitoYM2151IRQHandler); - BurnYM2151SetPortHandler(&TopspeedBankSwitch); - BurnYM2151SetAllRoutes(0.30, BURN_SND_ROUTE_BOTH); - - MSM5205Init(0, TaitoSynchroniseStream, 384000, TopspeedMSM5205Vck, MSM5205_S48_4B, 1); - MSM5205SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - TaitoDrawFunction = TopspeedDraw; - TaitoMakeInputsFunction = TopspeedMakeInputs; - TaitoIrqLine = 5; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = 12000000 / 60; - nTaitoCyclesTotal[2] = 4000000 / 60; - - pTopspeedTempDraw = (UINT16*)BurnMalloc(512 * 512 * sizeof(UINT16)); - - // Reset the driver - TaitoResetFunction = TopspeedDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 VolfiedInit() -{ - INT32 nLen; - - TaitoNumChar = 0; - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = VolfiedSpritePlaneOffsets; - TaitoSpriteAXOffsets = VolfiedSpriteXOffsets; - TaitoSpriteAYOffsets = VolfiedSpriteYOffsets; - TaitoNumSpriteA = 0x1800; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - TaitoNumYM2203 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - PC090OJInit(TaitoNumSpriteA, 0, 8, 0); - PC090OJSetPaletteOffset(256); - TC0140SYTInit(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRom1 + 0x40000 , 0x080000, 0x0fffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(PC090OJRam , 0x200000, 0x203fff, SM_RAM); - SekMapMemory(TaitoVideoRam , 0x400000, 0x47ffff, SM_READ); - SekMapMemory(TaitoPaletteRam , 0x500000, 0x503fff, SM_RAM); - SekSetReadByteHandler(0, Volfied68KReadByte); - SekSetWriteByteHandler(0, Volfied68KWriteByte); - SekSetReadWordHandler(0, Volfied68KReadWord); - SekSetWriteWordHandler(0, Volfied68KWriteWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(VolfiedZ80Read); - ZetSetWriteHandler(VolfiedZ80Write); - ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x8000, 0x87ff, 0, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x87ff, 1, TaitoZ80Ram1 ); - ZetMapArea(0x8000, 0x87ff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(1, 4000000, TaitoYM2203IRQHandler, TaitoSynchroniseStream, TaitoGetTime, 0); - BurnYM2203SetPorts(0, &VolfiedDip1Read, &VolfiedDip2Read, NULL, NULL); - BurnTimerAttachZet(4000000); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - TaitoDrawFunction = VolfiedDraw; - TaitoMakeInputsFunction = VolfiedMakeInputs; - TaitoIrqLine = 4; - - nTaitoCyclesTotal[0] = 8000000 / 60; - nTaitoCyclesTotal[1] = 4000000 / 60; - - VolfiedCChipInit(); - - // Reset the driver - TaitoResetFunction = VolfiedDoReset; - TaitoResetFunction(); - - return 0; -} - -static INT32 TaitoMiscExit() -{ - RastanADPCMPos = 0; - RastanADPCMData = 0; - memset(OpwolfADPCM_B, 0, 8); - memset(OpwolfADPCM_C, 0, 8); - OpwolfADPCMPos[0] = OpwolfADPCMPos[1] = 0; - OpwolfADPCMEnd[0] = OpwolfADPCMEnd[1] = 0; - OpwolfADPCMData[0] = OpwolfADPCMData[1] = 0; - - OpWolfGunXOffset = 0; - OpWolfGunYOffset = 0; - - DariusADPCMCommand = 0; - DariusNmiEnable = 0; - DariusCoinWord = 0; - - VolfiedVidCtrl = 0; - VolfiedVidMask = 0; - - BurnFree(pTopspeedTempDraw); - - return TaitoExit(); -} - -static inline UINT8 pal4bit(UINT8 bits) -{ - bits &= 0x0f; - return (bits << 4) | bits; -} - -static inline UINT8 pal5bit(UINT8 bits) -{ - bits &= 0x1f; - return (bits << 3) | (bits >> 2); -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); - g = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 5); - b = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 10); - - return BurnHighCol(r, g, b, 0); -} - -inline static UINT32 OpwolfCalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 8); - g = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 4); - b = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); - - return BurnHighCol(r, g, b, 0); -} - -inline static UINT32 JumpingCalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); - g = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 4); - b = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 8); - - return BurnHighCol(r, g, b, 0); -} - -static void TaitoMiscCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x2000; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } -} - -static void OpwolfCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x0800; i++, ps++, pd++) { - *pd = OpwolfCalcCol(*ps); - } -} - -static void JumpingCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x0800; i++, ps++, pd++) { - *pd = JumpingCalcCol(*ps); - } -} - -static void DariusDrawSprites(INT32 PriorityDraw) -{ - INT32 Offset, sx, sy; - UINT16 Code, Data; - UINT8 xFlip, yFlip, Colour, Priority; - - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - - for (Offset = 0xf000 / 2 - 4; Offset >= 0; Offset -= 4) - { - Code = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]) & 0x1fff; - - if (Code) { - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); - sy = (256 - Data) & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); - sx = Data & 0x3ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); - xFlip = ((Data & 0x4000) >> 14); - yFlip = ((Data & 0x8000) >> 15); - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); - Priority = (Data & 0x80) >> 7; - if (Priority != PriorityDraw) continue; - - Colour = (Data & 0x7f); - - if (sx > 900) sx -= 1024; - if (sy > 400) sy -= 512; - - sy -= 16; - - if (sx > 16 && sx < (nScreenWidth - 16) && sy > 16 && sy < (nScreenHeight - 16)) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } - } - } -} - -static void DariusDrawCharLayer() -{ - INT32 mx, my, Code, Attr, Colour, x, y, Flip, xFlip, yFlip, TileIndex = 0; - - UINT16 *VideoRam = (UINT16*)TaitoVideoRam; - - for (my = 0; my < 64; my++) { - for (mx = 0; mx < 128; mx++) { - Code = BURN_ENDIAN_SWAP_INT16(VideoRam[TileIndex + 0x2000]) & (TaitoNumCharB - 1); - Attr = BURN_ENDIAN_SWAP_INT16(VideoRam[TileIndex + 0x0000]); - - Colour = (Attr & 0xff) << 2; - Flip = (Attr & 0xc000) >> 14; - xFlip = (Flip >> 0) & 0x01; - yFlip = (Flip >> 1) & 0x01; - - x = 8 * mx; - y = 8 * my; - - if (x > 8 && x < (nScreenWidth - 8) && y > 8 && y < (nScreenHeight - 8)) { - if (xFlip) { - if (yFlip) { - Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); - } else { - Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); - } - } else { - if (yFlip) { - Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); - } else { - Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); - } else { - Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); - } - } else { - if (yFlip) { - Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); - } else { - Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); - } - } - } - - TileIndex++; - } - } -} - -static void JumpingDrawSprites() -{ - INT32 SpriteColBank = (PC090OJSpriteCtrl & 0xe0) >> 1; - - for (INT32 Offs = 0x400 - 8; Offs >= 0; Offs -= 8) { - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - INT32 Tile = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offs]); - if (Tile < 5120) { - INT32 sx, sy, Colour, Data1, xFlip, yFlip; - - sy = ((BURN_ENDIAN_SWAP_INT16(SpriteRam[Offs + 1]) - 0xfff1) ^ 0xffff) & 0x1ff; - if (sy > 400) sy = sy - 512; - sx = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offs + 2]) - 0x38) & 0x1ff; - if (sx > 400) sx = sx - 512; - - Data1 = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offs + 3]); - Colour = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offs + 4]) & 0x0f) | SpriteColBank; - xFlip = Data1 & 0x40; - yFlip = Data1 & 0x80; - - sy += 1; - sy -= 16; - - if (sx > 16 && sx < (nScreenWidth - 16) && sy > 16 && sy < (nScreenHeight - 16)) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); - } - } - } - } - } -} - -static void RenderSpriteZoom(INT32 Code, INT32 sx, INT32 sy, INT32 Colour, INT32 xFlip, INT32 yFlip, INT32 xScale, INT32 yScale, UINT8* pSource) -{ - UINT8 *SourceBase = pSource + ((Code % TaitoNumSpriteA) * TaitoSpriteAWidth * TaitoSpriteAHeight); - - INT32 SpriteScreenHeight = (yScale * TaitoSpriteAHeight + 0x8000) >> 16; - INT32 SpriteScreenWidth = (xScale * TaitoSpriteAWidth + 0x8000) >> 16; - - Colour = 0x10 * (Colour % 0x100); - - if (TaitoFlipScreenX) { - xFlip = !xFlip; - sx = 320 - sx - (xScale >> 12); - } - - if (SpriteScreenWidth && SpriteScreenHeight) { - INT32 dx = (TaitoSpriteAWidth << 16) / SpriteScreenWidth; - INT32 dy = (TaitoSpriteAHeight << 16) / SpriteScreenHeight; - - INT32 ex = sx + SpriteScreenWidth; - INT32 ey = sy + SpriteScreenHeight; - - INT32 xIndexBase; - INT32 yIndex; - - if (xFlip) { - xIndexBase = (SpriteScreenWidth - 1) * dx; - dx = -dx; - } else { - xIndexBase = 0; - } - - if (yFlip) { - yIndex = (SpriteScreenHeight - 1) * dy; - dy = -dy; - } else { - yIndex = 0; - } - - if (sx < 0) { - INT32 Pixels = 0 - sx; - sx += Pixels; - xIndexBase += Pixels * dx; - } - - if (sy < 0) { - INT32 Pixels = 0 - sy; - sy += Pixels; - yIndex += Pixels * dy; - } - - if (ex > nScreenWidth) { - INT32 Pixels = ex - nScreenWidth; - ex -= Pixels; - } - - if (ey > nScreenHeight) { - INT32 Pixels = ey - nScreenHeight; - ey -= Pixels; - } - - if (ex > sx) { - INT32 y; - - for (y = sy; y < ey; y++) { - UINT8 *Source = SourceBase + ((yIndex >> 16) * TaitoSpriteAWidth); - UINT16* pPixel = pTransDraw + (y * nScreenWidth); - - INT32 x, xIndex = xIndexBase; - for (x = sx; x < ex; x++) { - INT32 c = Source[xIndex >> 16]; - if (c != 0) { - pPixel[x] = c | Colour; - } - xIndex += dx; - } - - yIndex += dy; - } - } - } -} - -static void TopspeedDrawSprites(INT32 PriorityDraw) -{ - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - INT32 Offset, MapOffset, x, y, xCur, yCur, SpriteChunk; - UINT16 *SpriteMap = (UINT16*)TaitoVideoRam; - UINT16 Data, TileNum, Code, Colour; - UINT8 xFlip, yFlip, Priority, BadChunks; - UINT8 j, k, px, py, zx, zy, xZoom, yZoom; - - for (Offset = (0x2c0 / 2) - 4; Offset >= 0; Offset -= 4) { - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); - - TileNum = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]) & 0xff; - Colour = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]) & 0xff00) >> 8; - xFlip = (Data & 0x4000) >> 14; - yFlip = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]) & 0x8000) >> 15; - x = Data & 0x1ff; - y = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]) & 0x1ff; - xZoom = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]) & 0x7f); - yZoom = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]) & 0xfe00) >> 9; - Priority = (Data & 0x8000) >> 15; - - if (Priority != PriorityDraw) continue; - - if (y == 0x180) continue; - - MapOffset = TileNum << 7; - - xZoom += 1; - yZoom += 1; - - y += 3 + (128 - yZoom); - - if (x > 0x140) x -= 0x200; - if (y > 0x140) y -= 0x200; - - BadChunks = 0; - - for (SpriteChunk = 0; SpriteChunk < 128; SpriteChunk++) { - k = SpriteChunk % 8; - j = SpriteChunk / 8; - - px = (xFlip) ? (7 - k) : (k); - py = (yFlip) ? (15 - j) : (j); - - Code = SpriteMap[MapOffset + (py << 3) + px]; - - if (Code & 0x8000) { - BadChunks += 1; - continue; - } - - xCur = x + ((k * xZoom) / 8); - yCur = y + ((j * yZoom) / 16); - - zx = x + (((k + 1) * xZoom) / 8) - xCur; - zy = y + (((j + 1) * yZoom) / 16) - yCur; - - RenderSpriteZoom(Code, xCur, yCur - 16, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); - } - } -} - -static void DariusDraw() -{ - BurnTransferClear(); - TaitoMiscCalcPalette(); - PC080SNDrawBgLayer(0, 1, TaitoChars, pTransDraw); - DariusDrawSprites(0); - PC080SNDrawFgLayer(0, 0, TaitoChars, pTransDraw); - DariusDrawSprites(1); - DariusDrawCharLayer(); - BurnTransferCopy(TaitoPalette); -} - -static void OpwolfDraw() -{ - BurnTransferClear(); - OpwolfCalcPalette(); - PC080SNDrawBgLayer(0, 1, TaitoChars, pTransDraw); - PC090OJDrawSprites(TaitoSpritesA); - PC080SNDrawFgLayer(0, 0, TaitoChars, pTransDraw); - BurnTransferCopy(TaitoPalette); - - for (INT32 i = 0; i < nBurnGunNumPlayers; i++) { - BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); - } -} - -static void RbislandDraw() -{ - BurnTransferClear(); - TaitoMiscCalcPalette(); - PC080SNDrawBgLayer(0, 1, TaitoChars, pTransDraw); - PC090OJDrawSprites(TaitoSpritesA); - PC080SNDrawFgLayer(0, 0, TaitoChars, pTransDraw); - BurnTransferCopy(TaitoPalette); -} - -static void JumpingDraw() -{ - BurnTransferClear(); - JumpingCalcPalette(); - PC080SNOverrideFgScroll(0, 16, 0); - PC080SNDrawBgLayer(0, 1, TaitoChars, pTransDraw); - JumpingDrawSprites(); - PC080SNDrawFgLayer(0, 0, TaitoChars, pTransDraw); - BurnTransferCopy(TaitoPalette); -} - -static void RastanDraw() -{ - BurnTransferClear(); - TaitoMiscCalcPalette(); - PC080SNDrawBgLayer(0, 1, TaitoChars, pTransDraw); - PC080SNDrawFgLayer(0, 0, TaitoChars, pTransDraw); - PC090OJDrawSprites(TaitoSpritesA); - BurnTransferCopy(TaitoPalette); -} - -static void TopspeedDraw() -{ - BurnTransferClear(); - TaitoMiscCalcPalette(); - PC080SNDrawFgLayer(1, 1, TaitoChars, pTransDraw); - TopspeedDrawSprites(1); - TopspeedDrawBgLayer(1, TaitoChars, pTopspeedTempDraw, (UINT16*)Taito68KRam1); - TopspeedDrawFgLayer(0, TaitoChars, pTopspeedTempDraw, (UINT16*)(Taito68KRam1 + 0x200)); - TopspeedDrawSprites(0); - PC080SNDrawBgLayer(0, 0, TaitoChars, pTransDraw); - BurnTransferCopy(TaitoPalette); -} - -static void VolfiedDraw() -{ - BurnTransferClear(); - TaitoMiscCalcPalette(); - - UINT16* p = (UINT16*)TaitoVideoRam; - if (VolfiedVidCtrl & 0x01) p += 0x20000; - for (INT32 y = 0; y < nScreenHeight + 8; y++) { - for (INT32 x = 1; x < nScreenWidth + 1; x++) { - INT32 Colour = (p[x] << 2) & 0x700; - - if (p[x] & 0x8000) { - Colour |= 0x800 | ((p[x] >> 9) & 0xf); - - if (p[x] & 0x2000) Colour &= ~0xf; - } else { - Colour |= p[x] & 0xf; - } - - if ((y - 8) >= 0 && (y - 8) < nScreenHeight) { - pTransDraw[((y - 8) * nScreenWidth) + x - 1] = Colour; - } - } - - p += 512; - } - - PC090OJDrawSprites(TaitoSpritesA); - BurnTransferCopy(TaitoPalette); -} - -static INT32 TaitoMiscFrame() -{ - INT32 nInterleave = 10; - if (TaitoNumMSM5205) nInterleave = MSM5205CalcInterleave(0, 8000000 / 2); - INT32 nSoundBufferPos = 0; - - if (TaitoReset) TaitoResetFunction(); - - TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 # 1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == 9) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run Z80 - if (TaitoNumZ80s >= 1) { - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); - nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; - if (TaitoNumMSM5205) MSM5205Update(); - ZetClose(); - } - - if (TaitoNumZ80s == 2) { - nCurrentCPU = 2; - ZetOpen(1); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); - nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; - if (i == 9) ZetRaiseIrq(0); - ZetClose(); - } - - // Render sound segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (TaitoNumZ80s >= 1) ZetOpen(0); - if (TaitoNumYM2151) BurnYM2151Render(pSoundBuf, nSegmentLength); - if (TaitoNumZ80s >= 1) ZetClose(); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - if (TaitoNumZ80s >= 1) ZetOpen(0); - if (TaitoNumYM2151) BurnYM2151Render(pSoundBuf, nSegmentLength); - if (TaitoNumZ80s >= 1) ZetClose(); - } - } - - if (pBurnSoundOut) { - if (TaitoNumZ80s >= 1) ZetOpen(0); - if (TaitoNumMSM5205) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - if (TaitoNumMSM5205 >= 2) MSM5205Render(1, pBurnSoundOut, nBurnSoundLen); - if (TaitoNumZ80s >= 1) ZetClose(); - } - - if (pBurnDraw) TaitoDrawFunction(); - - return 0; -} - -static INT32 DariusFrame() -{ - INT32 nInterleave = MSM5205CalcInterleave(0, 8000000 / 2); - - if (TaitoReset) TaitoResetFunction(); - - TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = nTaitoCyclesDone[3] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 # 1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run 68000 # 2 - if ((TaitoCpuACtrl & 0x01)) { - nCurrentCPU = 1; - SekOpen(1); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - } - - ZetOpen(0); - BurnTimerUpdate(i * (nTaitoCyclesTotal[2] / nInterleave)); - ZetClose(); - - nCurrentCPU = 3; - ZetOpen(1); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); - nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; - MSM5205Update(); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[2]); - if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - ZetOpen(1); - ZetRun(nTaitoCyclesTotal[3] - nTaitoCyclesDone[3]); - if (pBurnSoundOut) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) TaitoDrawFunction(); - - return 0; -} - -static INT32 JumpingFrame() -{ - INT32 nInterleave = 100; - - if (TaitoReset) TaitoResetFunction(); - - TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 # 1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run Z80 - ZetOpen(0); - BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - - if (pBurnDraw) TaitoDrawFunction(); - - return 0; -} - -static INT32 TopspeedFrame() -{ - INT32 nInterleave = 10; - if (TaitoNumMSM5205) nInterleave = MSM5205CalcInterleave(0, 4000000); - INT32 nSoundBufferPos = 0; - - if (TaitoReset) TaitoResetFunction(); - - TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 # 1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == (nInterleave / 2) && (GetCurrentFrame > 0)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - if (i == (nInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run 68000 # 2 - if ((TaitoCpuACtrl & 0x01)) { - nCurrentCPU = 1; - SekOpen(1); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == (nInterleave / 2) && (GetCurrentFrame > 0)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - if (i == (nInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - } - - // Run Z80 - if (TaitoNumZ80s >= 1) { - nCurrentCPU = 2; - ZetOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); - nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; - if (TaitoNumMSM5205) MSM5205Update(); - ZetClose(); - } - - // Render sound segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (TaitoNumZ80s >= 1) ZetOpen(0); - if (TaitoNumYM2151) BurnYM2151Render(pSoundBuf, nSegmentLength); - if (TaitoNumZ80s >= 1) ZetClose(); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - if (TaitoNumZ80s >= 1) ZetOpen(0); - if (TaitoNumYM2151) BurnYM2151Render(pSoundBuf, nSegmentLength); - if (TaitoNumZ80s >= 1) ZetClose(); - } - } - - if (pBurnSoundOut) { - if (TaitoNumZ80s >= 1) ZetOpen(0); - if (TaitoNumMSM5205) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); - if (TaitoNumZ80s >= 1) ZetClose(); - } - - if (pBurnDraw) TaitoDrawFunction(); - - return 0; -} - -static INT32 TaitoMiscScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029683; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = TaitoRamStart; - ba.nLen = TaitoRamEnd-TaitoRamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - TaitoICScan(nAction); - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - if (TaitoNumYM2151) BurnYM2151Scan(nAction); - if (TaitoNumYM2203) BurnYM2203Scan(nAction, pnMin); - if (TaitoNumMSM5205) MSM5205Scan(nAction, pnMin); - - BurnGunScan(); - - SCAN_VAR(TaitoInput); - SCAN_VAR(TaitoAnalogPort0); - SCAN_VAR(TaitoAnalogPort1); - SCAN_VAR(TaitoZ80Bank); - SCAN_VAR(TaitoSoundLatch); - SCAN_VAR(RastanADPCMPos); - SCAN_VAR(RastanADPCMData); - SCAN_VAR(OpwolfADPCM_B); - SCAN_VAR(OpwolfADPCM_C); - SCAN_VAR(OpwolfADPCMPos); - SCAN_VAR(OpwolfADPCMEnd);; - SCAN_VAR(OpwolfADPCMData); - SCAN_VAR(nTaitoCyclesDone); - SCAN_VAR(nTaitoCyclesSegment); - SCAN_VAR(DariusADPCMCommand); - SCAN_VAR(DariusNmiEnable); - SCAN_VAR(DariusCoinWord); - SCAN_VAR(PC090OJSpriteCtrl); // for jumping - } - - if (nAction & ACB_WRITE && TaitoZ80Bank) { - ZetOpen(0); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetClose(); - } - - return 0; -} - -struct BurnDriver BurnDrvDarius = { - "darius", NULL, NULL, NULL, "1986", - "Darius (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, - NULL, DariusRomInfo, DariusRomName, NULL, NULL, DariusInputInfo, DariusDIPInfo, - DariusInit, TaitoMiscExit, DariusFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 864, 224, 12, 3 -}; - -struct BurnDriver BurnDrvDariusj = { - "dariusj", "darius", NULL, NULL, "1986", - "Darius (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, - NULL, DariusjRomInfo, DariusjRomName, NULL, NULL, DariusInputInfo, DariusjDIPInfo, - DariusInit, TaitoMiscExit, DariusFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 864, 224, 12, 3 -}; - -struct BurnDriver BurnDrvDariuso = { - "dariuso", "darius", NULL, NULL, "1986", - "Darius (Japan old version)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, - NULL, DariusoRomInfo, DariusoRomName, NULL, NULL, DariusInputInfo, DariusjDIPInfo, - DariusInit, TaitoMiscExit, DariusFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 864, 224, 12, 3 -}; - -struct BurnDriver BurnDrvDariuse = { - "dariuse", "darius", NULL, NULL, "1986", - "Darius (Extra) (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, - NULL, DariuseRomInfo, DariuseRomName, NULL, NULL, DariusInputInfo, DariuseDIPInfo, - DariusInit, TaitoMiscExit, DariusFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 864, 224, 12, 3 -}; - -struct BurnDriver BurnDrvOpwolf = { - "opwolf", NULL, NULL, NULL, "1987", - "Operation Wolf (World, set 1)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, OpwolfRomInfo, OpwolfRomName, NULL, NULL, OpwolfInputInfo, OpwolfDIPInfo, - OpwolfInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvOpwolfa = { - "opwolfa", "opwolf", NULL, NULL, "1987", - "Operation Wolf (World, set 2)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, OpwolfaRomInfo, OpwolfaRomName, NULL, NULL, OpwolfInputInfo, OpwolfDIPInfo, - OpwolfInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvOpwolfj = { - "opwolfj", "opwolf", NULL, NULL, "1987", - "Operation Wolf (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, OpwolfjRomInfo, OpwolfjRomName, NULL, NULL, OpwolfInputInfo, OpwolfDIPInfo, - OpwolfInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvOpwolfu = { - "opwolfu", "opwolf", NULL, NULL, "1987", - "Operation Wolf (US)\0", NULL, "Taito America Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, OpwolfuRomInfo, OpwolfuRomName, NULL, NULL, OpwolfInputInfo, OpwolfuDIPInfo, - OpwolfInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvOpwolfb = { - "opwolfb", "opwolf", NULL, NULL, "1987", - "Operation Bear\0", NULL, "bootleg", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, - NULL, OpwolfbRomInfo, OpwolfbRomName, NULL, NULL, OpwolfInputInfo, OpwolfbDIPInfo, - OpwolfbInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvRbisland = { - "rbisland", NULL, NULL, NULL, "1987", - "Rainbow Islands (new version)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, RbislandRomInfo, RbislandRomName, NULL, NULL, RbislandInputInfo, RbislandDIPInfo, - RbislandInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvRbislando = { - "rbislando", "rbisland", NULL, NULL, "1987", - "Rainbow Islands (old version)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, RbislandoRomInfo, RbislandoRomName, NULL, NULL, RbislandInputInfo, RbislandDIPInfo, - RbislandInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvRbislande = { - "rbislande", "rbisland", NULL, NULL, "1988", - "Rainbow Islands (Extra)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, RbislandeRomInfo, RbislandeRomName, NULL, NULL, RbislandInputInfo, RbislandDIPInfo, - RbislandInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvJumping = { - "jumping", "rbisland", NULL, NULL, "1989", - "Jumping\0", NULL, "bootleg", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, JumpingRomInfo, JumpingRomName, NULL, NULL, JumpingInputInfo, JumpingDIPInfo, - JumpingInit, TaitoMiscExit, JumpingFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvRastan = { - "rastan", NULL, NULL, NULL, "1987", - "Rastan (World Rev 1)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, RastanRomInfo, RastanRomName, NULL, NULL, RastanInputInfo, RastanDIPInfo, - RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvRastana = { - "rastana", "rastan", NULL, NULL, "1987", - "Rastan (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, RastanaRomInfo, RastanaRomName, NULL, NULL, RastanInputInfo, RastanDIPInfo, - RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvRastanu = { - "rastanu", "rastan", NULL, NULL, "1987", - "Rastan (US Rev 1)\0", NULL, "Taito America Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, RastanuRomInfo, RastanuRomName, NULL, NULL, RastanInputInfo, RastsagaDIPInfo, - RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvRastanua = { - "rastanua", "rastan", NULL, NULL, "1987", - "Rastan (US)\0", NULL, "Taito America Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, RastanuaRomInfo, RastanuaRomName, NULL, NULL, RastanInputInfo, RastsagaDIPInfo, - RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvRastanub = { - "rastanub", "rastan", NULL, NULL, "1987", - "Rastan (US, Earlier code base)\0", NULL, "Taito America Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, RastanubRomInfo, RastanubRomName, NULL, NULL, RastanInputInfo, RastsagaDIPInfo, - RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvRastsaga = { - "rastsaga", "rastan", NULL, NULL, "1987", - "Rastan Saga (Japan Rev 1)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, RastsagaRomInfo, RastsagaRomName, NULL, NULL, RastanInputInfo, RastsagaDIPInfo, - RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvRastsagaa = { - "rastsagaa", "rastan", NULL, NULL, "1987", - "Rastan Saga (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, RastsagaaRomInfo, RastsagaaRomName, NULL, NULL, RastanInputInfo, RastsagaDIPInfo, - RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvTopspeed = { - "topspeed", NULL, NULL, NULL, "1987", - "Top Speed (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0, - NULL, TopspeedRomInfo, TopspeedRomName, NULL, NULL, TopspeedInputInfo, TopspeedDIPInfo, - TopspeedInit, TaitoMiscExit, TopspeedFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvTopspeedu = { - "topspeedu", "topspeed", NULL, NULL, "1987", - "Top Speed (US)\0", NULL, "Taito America Corporation (Romstar license)", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0, - NULL, TopspeeduRomInfo, TopspeeduRomName, NULL, NULL, TopspeedInputInfo, FullthrlDIPInfo, - TopspeedInit, TaitoMiscExit, TopspeedFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvFullthrl = { - "fullthrl", "topspeed", NULL, NULL, "1987", - "Full Throttle (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0, - NULL, FullthrlRomInfo, FullthrlRomName, NULL, NULL, TopspeedInputInfo, FullthrlDIPInfo, - TopspeedInit, TaitoMiscExit, TopspeedFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvVolfied = { - "volfied", NULL, NULL, NULL, "1989", - "Volfied (World, revision 1)\0", NULL, "Taito Corporation Japan", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, - NULL, VolfiedRomInfo, VolfiedRomName, NULL, NULL, VolfiedInputInfo, VolfiedDIPInfo, - VolfiedInit, TaitoMiscExit, JumpingFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvVolfiedj = { - "volfiedj", "volfied", NULL, NULL, "1989", - "Volfied (Japan, revision 1)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, - NULL, VolfiedjRomInfo, VolfiedjRomName, NULL, NULL, VolfiedInputInfo, VolfiedjDIPInfo, - VolfiedInit, TaitoMiscExit, JumpingFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvVolfiedjo = { - "volfiedjo", "volfied", NULL, NULL, "1989", - "Volfied (Japan)\0", NULL, "Taito Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, - NULL, VolfiedjoRomInfo, VolfiedjoRomName, NULL, NULL, VolfiedInputInfo, VolfiedjDIPInfo, - VolfiedInit, TaitoMiscExit, JumpingFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvVolfiedu = { - "volfiedu", "volfied", NULL, NULL, "1989", - "Volfied (US, revision 1)\0", NULL, "Taito America Corporation", "Taito Misc", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, - NULL, VolfieduRomInfo, VolfieduRomName, NULL, NULL, VolfiedInputInfo, VolfieduDIPInfo, - VolfiedInit, TaitoMiscExit, JumpingFrame, NULL, TaitoMiscScan, - NULL, 0x2000, 240, 320, 3, 4 -}; +// PC080SN & PC090OJ based games + +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "taito.h" +#include "taito_ic.h" +#include "msm5205.h" +#include "burn_ym2151.h" +#include "burn_ym2203.h" +#include "burn_gun.h" + +static UINT32 RastanADPCMPos; +static INT32 RastanADPCMData; +static UINT8 OpwolfADPCM_B[0x08]; +static UINT8 OpwolfADPCM_C[0x08]; +static UINT32 OpwolfADPCMPos[2]; +static UINT32 OpwolfADPCMEnd[2]; +static INT32 OpwolfADPCMData[2]; +static INT32 OpWolfGunXOffset; +static INT32 OpWolfGunYOffset; + +static UINT8 DariusADPCMCommand; +static INT32 DariusNmiEnable; +static UINT16 DariusCoinWord; +static UINT32 DariusDefVol[0x10]; +static UINT8 DariusVol[8]; +static UINT8 DariusPan[5]; +static double DariusYM2203AY8910RouteMasterVol; +static double DariusYM2203RouteMasterVol; +static double DariusMSM5205RouteMasterVol; + +static UINT16 VolfiedVidCtrl; +static UINT16 VolfiedVidMask; + +static UINT16 *pTopspeedTempDraw = NULL; + +static void DariusDraw(); +static void OpwolfDraw(); +static void RbislandDraw(); +static void JumpingDraw(); +static void RastanDraw(); +static void TopspeedDraw(); +static void VolfiedDraw(); + +#define A(a, b, c, d) {a, b, (UINT8*)(c), d} + +static struct BurnInputInfo DariusInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort2 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort2 + 2, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort2 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort2 + 3, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort2 + 4, "service" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 5, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Darius) + +static struct BurnInputInfo OpwolfInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort0 + 1, "p2 coin" }, + + A("P1 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "mouse x-axis" ), + A("P1 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "mouse y-axis" ), + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 0, "mouse button 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 1, "mouse button 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort1 + 2, "service" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort1 + 3, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Opwolf) + +static struct BurnInputInfo RbislandInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort1 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , TaitoInputPort2 + 4, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TaitoInputPort2 + 5, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort2 + 6, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort2 + 7, "p1 fire 2" }, + + {"P2 Left" , BIT_DIGITAL , TaitoInputPort3 + 4, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TaitoInputPort3 + 5, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort3 + 6, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort3 + 7, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort0 + 7, "service" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Rbisland) + +static struct BurnInputInfo JumpingInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort0 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p2 start" }, + + {"P1 Left" , BIT_DIGITAL , TaitoInputPort1 + 7, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TaitoInputPort1 + 6, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 1, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 2, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Jumping) + +static struct BurnInputInfo RastanInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort3 + 5, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort3 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort3 + 6, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort3 + 4, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TaitoInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TaitoInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TaitoInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TaitoInputPort0 + 3, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort0 + 4, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p1 fire 2" }, + + {"P2 Up" , BIT_DIGITAL , TaitoInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TaitoInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TaitoInputPort1 + 3, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort1 + 4, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TaitoInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort3 + 0, "service" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort3 + 2, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Rastan) + +static struct BurnInputInfo TopspeedInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p2 coin" }, + + A("P1 Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p1 fire 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 fire 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 fire 3" }, + {"P1 Fire 4" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p1 fire 4" }, + {"P1 Fire 5" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p1 fire 5" }, + {"P1 Fire 6" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 6" }, + {"P1 Fire 7" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p1 fire 7" }, + {"P1 Fire 8" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 fire 8" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Topspeed) + +static struct BurnInputInfo VolfiedInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TaitoInputPort1 + 0, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TaitoInputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TaitoInputPort1 + 1, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TaitoInputPort0 + 5, "p2 start" }, + + {"P1 Up" , BIT_DIGITAL , TaitoInputPort2 + 2, "p1 up" }, + {"P1 Down" , BIT_DIGITAL , TaitoInputPort2 + 3, "p1 down" }, + {"P1 Left" , BIT_DIGITAL , TaitoInputPort2 + 4, "p1 left" }, + {"P1 Right" , BIT_DIGITAL , TaitoInputPort2 + 5, "p1 right" }, + {"P1 Fire 1" , BIT_DIGITAL , TaitoInputPort2 + 6, "p1 fire 1" }, + + {"P2 Up" , BIT_DIGITAL , TaitoInputPort3 + 1, "p2 up" }, + {"P2 Down" , BIT_DIGITAL , TaitoInputPort3 + 2, "p2 down" }, + {"P2 Left" , BIT_DIGITAL , TaitoInputPort3 + 3, "p2 left" }, + {"P2 Right" , BIT_DIGITAL , TaitoInputPort3 + 4, "p2 right" }, + {"P2 Fire 1" , BIT_DIGITAL , TaitoInputPort3 + 5, "p2 fire 1" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TaitoInputPort0 + 7, "service" }, + {"Tilt" , BIT_DIGITAL , TaitoInputPort2 + 0, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Volfied) + +#undef A + +static void DariusMakeInputs() +{ + // Reset Inputs + TaitoInput[0] = 0xff; + TaitoInput[1] = 0xff; + TaitoInput[2] = 0xfc; + TaitoInput[3] = 0xff; + + if (TaitoInputPort0[0]) TaitoInput[0] -= 0x01; + if (TaitoInputPort0[1]) TaitoInput[0] -= 0x02; + if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; + if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; + if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; + if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; + if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; + if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; + + if (TaitoInputPort1[0]) TaitoInput[1] -= 0x01; + if (TaitoInputPort1[1]) TaitoInput[1] -= 0x02; + if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; + if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; + if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; + if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; + if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; + if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; + + if (TaitoInputPort2[0]) TaitoInput[2] |= 0x01; + if (TaitoInputPort2[1]) TaitoInput[2] |= 0x02; + if (TaitoInputPort2[2]) TaitoInput[2] -= 0x04; + if (TaitoInputPort2[3]) TaitoInput[2] -= 0x08; + if (TaitoInputPort2[4]) TaitoInput[2] -= 0x10; + if (TaitoInputPort2[5]) TaitoInput[2] -= 0x20; + if (TaitoInputPort2[6]) TaitoInput[2] -= 0x40; + if (TaitoInputPort2[7]) TaitoInput[2] -= 0x80; +} + +static void OpwolfMakeInputs() +{ + // Reset Inputs + TaitoInput[0] = 0xfc; + TaitoInput[1] = 0xff; + TaitoInput[2] = 0xff; + TaitoInput[3] = 0xff; + + if (TaitoInputPort0[0]) TaitoInput[0] |= 0x01; + if (TaitoInputPort0[1]) TaitoInput[0] |= 0x02; + if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; + if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; + if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; + if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; + if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; + if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; + + if (TaitoInputPort1[0]) TaitoInput[1] -= 0x01; + if (TaitoInputPort1[1]) TaitoInput[1] -= 0x02; + if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; + if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; + if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; + if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; + if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; + if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; + + BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); + + OpwolfCChipUpdate(TaitoInput[0], TaitoInput[1]); +} + +static void OpwolfbMakeInputs() +{ + // Reset Inputs + TaitoInput[0] = 0xfc; + TaitoInput[1] = 0xff; + TaitoInput[2] = 0xff; + TaitoInput[3] = 0xff; + + if (TaitoInputPort0[0]) TaitoInput[0] |= 0x01; + if (TaitoInputPort0[1]) TaitoInput[0] |= 0x02; + if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; + if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; + if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; + if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; + if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; + if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; + + if (TaitoInputPort1[0]) TaitoInput[1] -= 0x01; + if (TaitoInputPort1[1]) TaitoInput[1] -= 0x02; + if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; + if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; + if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; + if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; + if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; + if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; + + BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); +} + +static void RbislandMakeInputs() +{ + // Reset Inputs + TaitoInput[0] = 0xff; + TaitoInput[1] = 0xfc; + TaitoInput[2] = 0xff; + TaitoInput[3] = 0xff; + + if (TaitoInputPort0[0]) TaitoInput[0] -= 0x01; + if (TaitoInputPort0[1]) TaitoInput[0] -= 0x02; + if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; + if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; + if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; + if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; + if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; + if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; + + if (TaitoInputPort1[0]) TaitoInput[1] |= 0x01; + if (TaitoInputPort1[1]) TaitoInput[1] |= 0x02; + if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; + if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; + if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; + if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; + if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; + if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; + + if (TaitoInputPort2[0]) TaitoInput[2] -= 0x01; + if (TaitoInputPort2[1]) TaitoInput[2] -= 0x02; + if (TaitoInputPort2[2]) TaitoInput[2] -= 0x04; + if (TaitoInputPort2[3]) TaitoInput[2] -= 0x08; + if (TaitoInputPort2[4]) TaitoInput[2] -= 0x10; + if (TaitoInputPort2[5]) TaitoInput[2] -= 0x20; + if (TaitoInputPort2[6]) TaitoInput[2] -= 0x40; + if (TaitoInputPort2[7]) TaitoInput[2] -= 0x80; + + if (TaitoInputPort3[0]) TaitoInput[3] -= 0x01; + if (TaitoInputPort3[1]) TaitoInput[3] -= 0x02; + if (TaitoInputPort3[2]) TaitoInput[3] -= 0x04; + if (TaitoInputPort3[3]) TaitoInput[3] -= 0x08; + if (TaitoInputPort3[4]) TaitoInput[3] -= 0x10; + if (TaitoInputPort3[5]) TaitoInput[3] -= 0x20; + if (TaitoInputPort3[6]) TaitoInput[3] -= 0x40; + if (TaitoInputPort3[7]) TaitoInput[3] -= 0x80; + + RainbowCChipUpdate(TaitoInput[0], TaitoInput[1], TaitoInput[2], TaitoInput[3]); +} + +static void JumpingMakeInputs() +{ + // Reset Inputs + TaitoInput[0] = 0xff; + TaitoInput[1] = 0xff; + TaitoInput[2] = 0xff; + TaitoInput[3] = 0xff; + + if (TaitoInputPort0[0]) TaitoInput[0] -= 0x01; + if (TaitoInputPort0[1]) TaitoInput[0] -= 0x02; + if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; + if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; + if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; + if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; + if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; + if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; + + if (TaitoInputPort1[0]) TaitoInput[1] -= 0x01; + if (TaitoInputPort1[1]) TaitoInput[1] -= 0x02; + if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; + if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; + if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; + if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; + if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; + if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; +} + +static void RastanMakeInputs() +{ + // Reset Inputs + TaitoInput[0] = 0xff; + TaitoInput[1] = 0xff; + TaitoInput[2] = 0x8f; + TaitoInput[3] = 0x1f; + + if (TaitoInputPort0[0]) TaitoInput[0] -= 0x01; + if (TaitoInputPort0[1]) TaitoInput[0] -= 0x02; + if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; + if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; + if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; + if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; + if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; + if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; + + if (TaitoInputPort1[0]) TaitoInput[1] -= 0x01; + if (TaitoInputPort1[1]) TaitoInput[1] -= 0x02; + if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; + if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; + if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; + if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; + if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; + if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; + + if (TaitoInputPort3[0]) TaitoInput[3] -= 0x01; + if (TaitoInputPort3[1]) TaitoInput[3] -= 0x02; + if (TaitoInputPort3[2]) TaitoInput[3] -= 0x04; + if (TaitoInputPort3[3]) TaitoInput[3] -= 0x08; + if (TaitoInputPort3[4]) TaitoInput[3] -= 0x10; + if (TaitoInputPort3[5]) TaitoInput[3] |= 0x20; + if (TaitoInputPort3[6]) TaitoInput[3] |= 0x40; + if (TaitoInputPort3[7]) TaitoInput[3] |= 0x80; +} + +static void TopspeedMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0x13; + TC0220IOCInput[1] = 0x0f; + TC0220IOCInput[2] = 0xff; + + if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; + if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; + if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; + if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; + if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; + if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] |= 0x20; + if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] |= 0x40; + if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] |= 0x80; + + if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; + if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; + if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; + if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; + if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] |= 0x10; + if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] |= 0x20; + if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] |= 0x40; + if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] |= 0x80; + + if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; + if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; + if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; + if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] -= 0x08; + if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; + if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; + if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; + if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; +} + +static void VolfiedMakeInputs() +{ + // Reset Inputs + TaitoInput[0] = 0xff; + TaitoInput[1] = 0xfc; + TaitoInput[2] = 0xff; + TaitoInput[3] = 0xff; + + if (TaitoInputPort0[0]) TaitoInput[0] -= 0x01; + if (TaitoInputPort0[1]) TaitoInput[0] -= 0x02; + if (TaitoInputPort0[2]) TaitoInput[0] -= 0x04; + if (TaitoInputPort0[3]) TaitoInput[0] -= 0x08; + if (TaitoInputPort0[4]) TaitoInput[0] -= 0x10; + if (TaitoInputPort0[5]) TaitoInput[0] -= 0x20; + if (TaitoInputPort0[6]) TaitoInput[0] -= 0x40; + if (TaitoInputPort0[7]) TaitoInput[0] -= 0x80; + + if (TaitoInputPort1[0]) TaitoInput[1] |= 0x01; + if (TaitoInputPort1[1]) TaitoInput[1] |= 0x02; + if (TaitoInputPort1[2]) TaitoInput[1] -= 0x04; + if (TaitoInputPort1[3]) TaitoInput[1] -= 0x08; + if (TaitoInputPort1[4]) TaitoInput[1] -= 0x10; + if (TaitoInputPort1[5]) TaitoInput[1] -= 0x20; + if (TaitoInputPort1[6]) TaitoInput[1] -= 0x40; + if (TaitoInputPort1[7]) TaitoInput[1] -= 0x80; + + if (TaitoInputPort2[0]) TaitoInput[2] -= 0x01; + if (TaitoInputPort2[1]) TaitoInput[2] -= 0x02; + if (TaitoInputPort2[2]) TaitoInput[2] -= 0x04; + if (TaitoInputPort2[3]) TaitoInput[2] -= 0x08; + if (TaitoInputPort2[4]) TaitoInput[2] -= 0x10; + if (TaitoInputPort2[5]) TaitoInput[2] -= 0x20; + if (TaitoInputPort2[6]) TaitoInput[2] -= 0x40; + if (TaitoInputPort2[7]) TaitoInput[2] -= 0x80; + + if (TaitoInputPort3[0]) TaitoInput[3] -= 0x01; + if (TaitoInputPort3[1]) TaitoInput[3] -= 0x02; + if (TaitoInputPort3[2]) TaitoInput[3] -= 0x04; + if (TaitoInputPort3[3]) TaitoInput[3] -= 0x08; + if (TaitoInputPort3[4]) TaitoInput[3] -= 0x10; + if (TaitoInputPort3[5]) TaitoInput[3] -= 0x20; + if (TaitoInputPort3[6]) TaitoInput[3] -= 0x40; + if (TaitoInputPort3[7]) TaitoInput[3] -= 0x80; +} + +static struct BurnDIPInfo DariusDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Auto Fire" }, + {0x13, 0x01, 0x02, 0x02, "Normal" }, + {0x13, 0x01, 0x02, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "Every 600k" }, + {0x14, 0x01, 0x0c, 0x0c, "600k only" }, + {0x14, 0x01, 0x0c, 0x04, "800k only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + {0x14, 0x01, 0x30, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x80, 0x00, "Off" }, + {0x14, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Darius) + +static struct BurnDIPInfo DariuseDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Auto Fire" }, + {0x13, 0x01, 0x02, 0x02, "Normal" }, + {0x13, 0x01, 0x02, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "Every 600k" }, + {0x14, 0x01, 0x0c, 0x0c, "600k only" }, + {0x14, 0x01, 0x0c, 0x04, "800k only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + {0x14, 0x01, 0x30, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x80, 0x00, "Off" }, + {0x14, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Dariuse) + +static struct BurnDIPInfo DariusjDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Auto Fire" }, + {0x13, 0x01, 0x02, 0x02, "Normal" }, + {0x13, 0x01, 0x02, 0x00, "Fast" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "Every 600k" }, + {0x14, 0x01, 0x0c, 0x0c, "600k only" }, + {0x14, 0x01, 0x0c, 0x04, "800k only" }, + {0x14, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + {0x14, 0x01, 0x30, 0x00, "6" }, +}; + +STDDIPINFO(Dariusj) + +static struct BurnDIPInfo OpwolfDIPList[]= +{ + // Default Values + {0x0a, 0xff, 0xff, 0xff, NULL }, + {0x0b, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0a, 0x01, 0x02, 0x02, "Off" }, + {0x0a, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0a, 0x01, 0x04, 0x04, "Off" }, + {0x0a, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0a, 0x01, 0x08, 0x00, "Off" }, + {0x0a, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0a, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0a, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0a, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0a, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0a, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x0a, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x0a, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x0a, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0b, 0x01, 0x03, 0x02, "Easy" }, + {0x0b, 0x01, 0x03, 0x03, "Medium" }, + {0x0b, 0x01, 0x03, 0x01, "Hard" }, + {0x0b, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Ammo Magazines at Start" }, + {0x0b, 0x01, 0x0c, 0x00, "4" }, + {0x0b, 0x01, 0x0c, 0x04, "5" }, + {0x0b, 0x01, 0x0c, 0x0c, "6" }, + {0x0b, 0x01, 0x0c, 0x08, "7" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x0b, 0x01, 0x80, 0x80, "Japanese" }, + {0x0b, 0x01, 0x80, 0x00, "English" }, +}; + +STDDIPINFO(Opwolf) + +static struct BurnDIPInfo OpwolfuDIPList[]= +{ + // Default Values + {0x0a, 0xff, 0xff, 0xff, NULL }, + {0x0b, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0a, 0x01, 0x02, 0x02, "Off" }, + {0x0a, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0a, 0x01, 0x04, 0x04, "Off" }, + {0x0a, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0a, 0x01, 0x08, 0x00, "Off" }, + {0x0a, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0a, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0a, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0a, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0a, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0a, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0a, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0a, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0a, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0b, 0x01, 0x03, 0x02, "Easy" }, + {0x0b, 0x01, 0x03, 0x03, "Medium" }, + {0x0b, 0x01, 0x03, 0x01, "Hard" }, + {0x0b, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Ammo Magazines at Start" }, + {0x0b, 0x01, 0x0c, 0x00, "4" }, + {0x0b, 0x01, 0x0c, 0x04, "5" }, + {0x0b, 0x01, 0x0c, 0x0c, "6" }, + {0x0b, 0x01, 0x0c, 0x08, "7" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x0b, 0x01, 0x80, 0x80, "Japanese" }, + {0x0b, 0x01, 0x80, 0x00, "English" }, +}; + +STDDIPINFO(Opwolfu) + +static struct BurnDIPInfo OpwolfbDIPList[]= +{ + // Default Values + {0x0a, 0xff, 0xff, 0xff, NULL }, + {0x0b, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0a, 0x01, 0x02, 0x02, "Off" }, + {0x0a, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0a, 0x01, 0x04, 0x04, "Off" }, + {0x0a, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0a, 0x01, 0x08, 0x00, "Off" }, + {0x0a, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0a, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0a, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0a, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0a, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0a, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x0a, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x0a, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x0a, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0b, 0x01, 0x03, 0x02, "Easy" }, + {0x0b, 0x01, 0x03, 0x03, "Medium" }, + {0x0b, 0x01, 0x03, 0x01, "Hard" }, + {0x0b, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Ammo Magazines at Start" }, + {0x0b, 0x01, 0x0c, 0x00, "4" }, + {0x0b, 0x01, 0x0c, 0x04, "5" }, + {0x0b, 0x01, 0x0c, 0x0c, "6" }, + {0x0b, 0x01, 0x0c, 0x08, "7" }, +}; + +STDDIPINFO(Opwolfb) + +static struct BurnDIPInfo RbislandDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xfe, NULL }, + {0x10, 0xff, 0xff, 0xbf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0f, 0x01, 0x01, 0x00, "Upright" }, + {0x0f, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x0f, 0x01, 0x02, 0x02, "Off" }, + {0x0f, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0f, 0x01, 0x04, 0x04, "Off" }, + {0x0f, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x08, 0x00, "Off" }, + {0x0f, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x10, 0x01, 0x03, 0x02, "Easy" }, + {0x10, 0x01, 0x03, 0x03, "Medium" }, + {0x10, 0x01, 0x03, 0x01, "Hard" }, + {0x10, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x10, 0x01, 0x04, 0x04, "100k, 1000k" }, + {0x10, 0x01, 0x04, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Complete Bonus" }, + {0x10, 0x01, 0x08, 0x08, "1 Up" }, + {0x10, 0x01, 0x08, 0x00, "100k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x10, 0x01, 0x30, 0x10, "1" }, + {0x10, 0x01, 0x30, 0x00, "2" }, + {0x10, 0x01, 0x30, 0x30, "3" }, + {0x10, 0x01, 0x30, 0x20, "4" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x10, 0x01, 0x40, 0x00, "English" }, + {0x10, 0x01, 0x40, 0x40, "Japanese" }, +}; + +STDDIPINFO(Rbisland) + +static struct BurnDIPInfo JumpingDIPList[]= +{ + // Default Values + {0x09, 0xff, 0xff, 0xfe, NULL }, + {0x0a, 0xff, 0xff, 0xbf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x09, 0x01, 0x08, 0x00, "Off" }, + {0x09, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x09, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x09, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x09, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x09, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x09, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x09, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x09, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x09, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0a, 0x01, 0x03, 0x02, "Easy" }, + {0x0a, 0x01, 0x03, 0x03, "Medium" }, + {0x0a, 0x01, 0x03, 0x01, "Hard" }, + {0x0a, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Bonus Life" }, + {0x0a, 0x01, 0x04, 0x04, "100k, 1000k" }, + {0x0a, 0x01, 0x04, 0x00, "None" }, + + {0 , 0xfe, 0 , 2 , "Complete Bonus" }, + {0x0a, 0x01, 0x08, 0x08, "1 Up" }, + {0x0a, 0x01, 0x08, 0x00, "100k" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0a, 0x01, 0x30, 0x10, "1" }, + {0x0a, 0x01, 0x30, 0x00, "2" }, + {0x0a, 0x01, 0x30, 0x30, "3" }, + {0x0a, 0x01, 0x30, 0x20, "4" }, +}; + +STDDIPINFO(Jumping) + +static struct BurnDIPInfo RastanDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "100k, 200k, 400k, 600k, 800k"}, + {0x14, 0x01, 0x0c, 0x08, "150k, 300k, 600k, 900k, 1200k"}, + {0x14, 0x01, 0x0c, 0x04, "200k, 400k, 800k, 1200k, 1600k"}, + {0x14, 0x01, 0x0c, 0x00, "250k, 500k, 1000k, 1500k, 2000k"}, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + {0x14, 0x01, 0x30, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Rastan) + +static struct BurnDIPInfo RastsagaDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x13, 0x01, 0x01, 0x00, "Upright" }, + {0x13, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "100k, 200k, 400k, 600k, 800k"}, + {0x14, 0x01, 0x0c, 0x08, "150k, 300k, 600k, 900k, 1200k"}, + {0x14, 0x01, 0x0c, 0x04, "200k, 400k, 800k, 1200k, 1600k"}, + {0x14, 0x01, 0x0c, 0x00, "250k, 500k, 1000k, 1500k, 2000k"}, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x20, "4" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + {0x14, 0x01, 0x30, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, +}; + +STDDIPINFO(Rastsaga) + +static struct BurnDIPInfo TopspeedDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Cabinet" }, + {0x0f, 0x01, 0x03, 0x03, "Deluxe Motorized Cabinet" }, + {0x0f, 0x01, 0x03, 0x02, "Upright" }, + {0x0f, 0x01, 0x03, 0x01, "Upright (alt)" }, + {0x0f, 0x01, 0x03, 0x00, "Standard Cockpit" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0f, 0x01, 0x04, 0x04, "Off" }, + {0x0f, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x08, 0x00, "Off" }, + {0x0f, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0f, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0f, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0f, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x0f, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x0f, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Initial Time" }, + {0x10, 0x01, 0x0c, 0x00, "40 seconds" }, + {0x10, 0x01, 0x0c, 0x04, "50 seconds" }, + {0x10, 0x01, 0x0c, 0x0c, "60 seconds" }, + {0x10, 0x01, 0x0c, 0x08, "70 seconds" }, + + {0 , 0xfe, 0 , 4 , "Nitros" }, + {0x10, 0x01, 0x30, 0x20, "2" }, + {0x10, 0x01, 0x30, 0x30, "3" }, + {0x10, 0x01, 0x30, 0x10, "4" }, + {0x10, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x10, 0x01, 0x40, 0x40, "Off" }, + {0x10, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Continue Price" }, + {0x10, 0x01, 0x80, 0x00, "1 Coin 1 Credit" }, + {0x10, 0x01, 0x80, 0x80, "Same as start" }, +}; + +STDDIPINFO(Topspeed) + +static struct BurnDIPInfo FullthrlDIPList[]= +{ + // Default Values + {0x0f, 0xff, 0xff, 0xff, NULL }, + {0x10, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Cabinet" }, + {0x0f, 0x01, 0x03, 0x03, "Deluxe Motorized Cabinet" }, + {0x0f, 0x01, 0x03, 0x02, "Upright" }, + {0x0f, 0x01, 0x03, 0x01, "Upright (alt)" }, + {0x0f, 0x01, 0x03, 0x00, "Standard Cockpit" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0f, 0x01, 0x04, 0x04, "Off" }, + {0x0f, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0f, 0x01, 0x08, 0x00, "Off" }, + {0x0f, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0f, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0f, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0f, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0f, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0f, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Initial Time" }, + {0x10, 0x01, 0x0c, 0x00, "40 seconds" }, + {0x10, 0x01, 0x0c, 0x04, "50 seconds" }, + {0x10, 0x01, 0x0c, 0x0c, "60 seconds" }, + {0x10, 0x01, 0x0c, 0x08, "70 seconds" }, + + {0 , 0xfe, 0 , 4 , "Nitros" }, + {0x10, 0x01, 0x30, 0x20, "2" }, + {0x10, 0x01, 0x30, 0x30, "3" }, + {0x10, 0x01, 0x30, 0x10, "4" }, + {0x10, 0x01, 0x30, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x10, 0x01, 0x40, 0x40, "Off" }, + {0x10, 0x01, 0x40, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Continue Price" }, + {0x10, 0x01, 0x80, 0x00, "1 Coin 1 Credit" }, + {0x10, 0x01, 0x80, 0x80, "Same as start" }, +}; + +STDDIPINFO(Fullthrl) + +static struct BurnDIPInfo VolfiedDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfe, NULL }, + {0x12, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x01, 0x00, "Upright" }, + {0x11, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x08, 0x00, "Off" }, + {0x11, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x11, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x11, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x12, 0x01, 0x03, 0x02, "20k 40k 120k 480k 2400k" }, + {0x12, 0x01, 0x03, 0x03, "50k 150k 600k 3000k" }, + {0x12, 0x01, 0x03, 0x01, "70k 280k 1400k" }, + {0x12, 0x01, 0x03, 0x00, "100k 500k" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Medium" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 5 , "Lives" }, + {0x12, 0x01, 0x70, 0x70, "3" }, + {0x12, 0x01, 0x70, 0x60, "4" }, + {0x12, 0x01, 0x70, 0x50, "5" }, + {0x12, 0x01, 0x70, 0x40, "6" }, + {0x12, 0x01, 0x70, 0x00, "32768" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x12, 0x01, 0x80, 0x80, "Japanese" }, + {0x12, 0x01, 0x80, 0x00, "English" }, +}; + +STDDIPINFO(Volfied) + +static struct BurnDIPInfo VolfiedjDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfe, NULL }, + {0x12, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x01, 0x00, "Upright" }, + {0x11, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x08, 0x00, "Off" }, + {0x11, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x11, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x11, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x11, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x11, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x11, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x11, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x11, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x12, 0x01, 0x03, 0x02, "20k 40k 120k 480k 2400k" }, + {0x12, 0x01, 0x03, 0x03, "50k 150k 600k 3000k" }, + {0x12, 0x01, 0x03, 0x01, "70k 280k 1400k" }, + {0x12, 0x01, 0x03, 0x00, "100k 500k" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Medium" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 5 , "Lives" }, + {0x12, 0x01, 0x70, 0x70, "3" }, + {0x12, 0x01, 0x70, 0x60, "4" }, + {0x12, 0x01, 0x70, 0x50, "5" }, + {0x12, 0x01, 0x70, 0x40, "6" }, + {0x12, 0x01, 0x70, 0x00, "32768" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x12, 0x01, 0x80, 0x80, "Japanese" }, + {0x12, 0x01, 0x80, 0x00, "English" }, +}; + +STDDIPINFO(Volfiedj) + +static struct BurnDIPInfo VolfieduDIPList[]= +{ + // Default Values + {0x11, 0xff, 0xff, 0xfe, NULL }, + {0x12, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x11, 0x01, 0x01, 0x00, "Upright" }, + {0x11, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x11, 0x01, 0x02, 0x02, "Off" }, + {0x11, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x11, 0x01, 0x04, 0x04, "Off" }, + {0x11, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x11, 0x01, 0x08, 0x00, "Off" }, + {0x11, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x11, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x11, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x12, 0x01, 0x03, 0x02, "20k 40k 120k 480k 2400k" }, + {0x12, 0x01, 0x03, 0x03, "50k 150k 600k 3000k" }, + {0x12, 0x01, 0x03, 0x01, "70k 280k 1400k" }, + {0x12, 0x01, 0x03, 0x00, "100k 500k" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x12, 0x01, 0x0c, 0x08, "Easy" }, + {0x12, 0x01, 0x0c, 0x0c, "Medium" }, + {0x12, 0x01, 0x0c, 0x04, "Hard" }, + {0x12, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 5 , "Lives" }, + {0x12, 0x01, 0x70, 0x70, "3" }, + {0x12, 0x01, 0x70, 0x60, "4" }, + {0x12, 0x01, 0x70, 0x50, "5" }, + {0x12, 0x01, 0x70, 0x40, "6" }, + {0x12, 0x01, 0x70, 0x00, "32768" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x12, 0x01, 0x80, 0x80, "Japanese" }, + {0x12, 0x01, 0x80, 0x00, "English" }, +}; + +STDDIPINFO(Volfiedu) + +static struct BurnRomInfo DariusRomDesc[] = { + { "da-59.bin", 0x10000, 0x11aab4eb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "da-58.bin", 0x10000, 0x5f71e697, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "da-61.bin", 0x10000, 0x4736aa9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "da-66.bin", 0x10000, 0x4ede5f56, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "a96_31.187", 0x10000, 0xe9bb5d89, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "a96_30.154", 0x10000, 0x9eb5e127, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "a96_33-1.190", 0x10000, 0xff186048, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "a96_32-1.157", 0x10000, 0xd9719de8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "a96_35-1.191", 0x10000, 0xb3280193, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "a96_34-1.158", 0x10000, 0xca3b2573, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "a96_57.33", 0x10000, 0x33ceb730, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "a96_56.18", 0x10000, 0x292ef55c, BRF_ESS | BRF_PRG | TAITO_Z80ROM2 }, + + { "a96_48.24", 0x10000, 0x39c9b3aa, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_51.47", 0x10000, 0x1bf8f0d3, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_49.25", 0x10000, 0x37a7d88a, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_52.48", 0x10000, 0x2d9b2128, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_50.26", 0x10000, 0x75d738e4, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_53.49", 0x10000, 0x0173484c, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "a96_54.143", 0x04000, 0x51c02ae2, BRF_GRA | TAITO_CHARSB_BYTESWAP }, + { "a96_55.144", 0x04000, 0x771e4d98, BRF_GRA | TAITO_CHARSB_BYTESWAP }, + + { "a96_44.179", 0x10000, 0xbbc18878, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_45.200", 0x10000, 0x616cdd8b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_46.180", 0x10000, 0xfec35418, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_47.201", 0x10000, 0x8df9286a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_40.177", 0x10000, 0xb699a51e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_41.198", 0x10000, 0x97128a3a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_42.178", 0x10000, 0x7f55ee0f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_43.199", 0x10000, 0xc7cad469, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "da-62.bin", 0x10000, 0x9179862c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "da-63.bin", 0x10000, 0xfa19cfff, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "da-64.bin", 0x10000, 0x814c676f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "da-65.bin", 0x10000, 0x14eee326, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "a96-24.163", 0x00400, 0x0fa8be7f, BRF_OPT }, + { "a96-25.164", 0x00400, 0x265508a6, BRF_OPT }, + { "a96-26.165", 0x00400, 0x4891b9c0, BRF_OPT }, +}; + +STD_ROM_PICK(Darius) +STD_ROM_FN(Darius) + +static struct BurnRomInfo DariusjRomDesc[] = { + { "a96_29-1.185", 0x10000, 0x75486f62, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "a96_28-1.152", 0x10000, 0xfb34d400, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "a96_31.187", 0x10000, 0xe9bb5d89, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "a96_30.154", 0x10000, 0x9eb5e127, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "a96_33-1.190", 0x10000, 0xff186048, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "a96_32-1.157", 0x10000, 0xd9719de8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "a96_35-1.191", 0x10000, 0xb3280193, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "a96_34-1.158", 0x10000, 0xca3b2573, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "a96_57.33", 0x10000, 0x33ceb730, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "a96_56.18", 0x10000, 0x292ef55c, BRF_ESS | BRF_PRG | TAITO_Z80ROM2 }, + + { "a96_48.24", 0x10000, 0x39c9b3aa, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_51.47", 0x10000, 0x1bf8f0d3, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_49.25", 0x10000, 0x37a7d88a, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_52.48", 0x10000, 0x2d9b2128, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_50.26", 0x10000, 0x75d738e4, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_53.49", 0x10000, 0x0173484c, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "a96_54.143", 0x04000, 0x51c02ae2, BRF_GRA | TAITO_CHARSB_BYTESWAP }, + { "a96_55.144", 0x04000, 0x771e4d98, BRF_GRA | TAITO_CHARSB_BYTESWAP }, + + { "a96_44.179", 0x10000, 0xbbc18878, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_45.200", 0x10000, 0x616cdd8b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_46.180", 0x10000, 0xfec35418, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_47.201", 0x10000, 0x8df9286a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_40.177", 0x10000, 0xb699a51e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_41.198", 0x10000, 0x97128a3a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_42.178", 0x10000, 0x7f55ee0f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_43.199", 0x10000, 0xc7cad469, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_36.175", 0x10000, 0xaf598141, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_37.196", 0x10000, 0xb48137c8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_38.176", 0x10000, 0xe4f3e3a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_39.197", 0x10000, 0xea30920f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "a96-24.163", 0x00400, 0x0fa8be7f, BRF_OPT }, + { "a96-25.164", 0x00400, 0x265508a6, BRF_OPT }, + { "a96-26.165", 0x00400, 0x4891b9c0, BRF_OPT }, +}; + +STD_ROM_PICK(Dariusj) +STD_ROM_FN(Dariusj) + +static struct BurnRomInfo DariusoRomDesc[] = { + { "a96-29.185", 0x10000, 0xf775162b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "a96-28.152", 0x10000, 0x4721d667, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "a96_31.187", 0x10000, 0xe9bb5d89, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "a96_30.154", 0x10000, 0x9eb5e127, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "a96-33.190", 0x10000, 0xd2f340d2, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "a96-32.157", 0x10000, 0x044c9848, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "a96-35.191", 0x10000, 0xb8ed718b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "a96-34.158", 0x10000, 0x7556a660, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "a96_57.33", 0x10000, 0x33ceb730, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "a96_56.18", 0x10000, 0x292ef55c, BRF_ESS | BRF_PRG | TAITO_Z80ROM2 }, + + { "a96_48.24", 0x10000, 0x39c9b3aa, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_51.47", 0x10000, 0x1bf8f0d3, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_49.25", 0x10000, 0x37a7d88a, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_52.48", 0x10000, 0x2d9b2128, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_50.26", 0x10000, 0x75d738e4, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_53.49", 0x10000, 0x0173484c, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "a96_54.143", 0x04000, 0x51c02ae2, BRF_GRA | TAITO_CHARSB_BYTESWAP }, + { "a96_55.144", 0x04000, 0x771e4d98, BRF_GRA | TAITO_CHARSB_BYTESWAP }, + + { "a96_44.179", 0x10000, 0xbbc18878, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_45.200", 0x10000, 0x616cdd8b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_46.180", 0x10000, 0xfec35418, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_47.201", 0x10000, 0x8df9286a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_40.177", 0x10000, 0xb699a51e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_41.198", 0x10000, 0x97128a3a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_42.178", 0x10000, 0x7f55ee0f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_43.199", 0x10000, 0xc7cad469, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_36.175", 0x10000, 0xaf598141, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_37.196", 0x10000, 0xb48137c8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_38.176", 0x10000, 0xe4f3e3a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_39.197", 0x10000, 0xea30920f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "a96-24.163", 0x00400, 0x0fa8be7f, BRF_OPT }, + { "a96-25.164", 0x00400, 0x265508a6, BRF_OPT }, + { "a96-26.165", 0x00400, 0x4891b9c0, BRF_OPT }, +}; + +STD_ROM_PICK(Dariuso) +STD_ROM_FN(Dariuso) + +static struct BurnRomInfo DariuseRomDesc[] = { + { "dae-68.bin", 0x10000, 0xed721127, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "dae-67.bin", 0x10000, 0xb99aea8c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "dae-70.bin", 0x10000, 0x54590b31, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "a96_30.154", 0x10000, 0x9eb5e127, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "dae-72.bin", 0x10000, 0x248ca2cc, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "dae-71.bin", 0x10000, 0x65dd0403, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "dae-74.bin", 0x10000, 0x0ea31f60, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "dae-73.bin", 0x10000, 0x27036a4d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "a96_57.33", 0x10000, 0x33ceb730, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "a96_56.18", 0x10000, 0x292ef55c, BRF_ESS | BRF_PRG | TAITO_Z80ROM2 }, + + { "a96_48.24", 0x10000, 0x39c9b3aa, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_51.47", 0x10000, 0x1bf8f0d3, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_49.25", 0x10000, 0x37a7d88a, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_52.48", 0x10000, 0x2d9b2128, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_50.26", 0x10000, 0x75d738e4, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "a96_53.49", 0x10000, 0x0173484c, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "a96_54.143", 0x04000, 0x51c02ae2, BRF_GRA | TAITO_CHARSB_BYTESWAP }, + { "a96_55.144", 0x04000, 0x771e4d98, BRF_GRA | TAITO_CHARSB_BYTESWAP }, + + { "a96_44.179", 0x10000, 0xbbc18878, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_45.200", 0x10000, 0x616cdd8b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_46.180", 0x10000, 0xfec35418, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_47.201", 0x10000, 0x8df9286a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_40.177", 0x10000, 0xb699a51e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_41.198", 0x10000, 0x97128a3a, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_42.178", 0x10000, 0x7f55ee0f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_43.199", 0x10000, 0xc7cad469, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_36.175", 0x10000, 0xaf598141, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_37.196", 0x10000, 0xb48137c8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_38.176", 0x10000, 0xe4f3e3a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "a96_39.197", 0x10000, 0xea30920f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "a96-24.163", 0x00400, 0x0fa8be7f, BRF_OPT }, + { "a96-25.164", 0x00400, 0x265508a6, BRF_OPT }, + { "a96-26.165", 0x00400, 0x4891b9c0, BRF_OPT }, +}; + +STD_ROM_PICK(Dariuse) +STD_ROM_FN(Dariuse) + +static struct BurnRomInfo OpwolfRomDesc[] = { + { "b20-05-02.40", 0x10000, 0x3ffbfe3a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-03-02.30", 0x10000, 0xfdabd8a5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-04.39", 0x10000, 0x216b4838, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-20.29", 0x10000, 0xd244431a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b20-07.10", 0x10000, 0x45c7ace3, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b20-13.13", 0x80000, 0xf6acdab1, BRF_GRA | TAITO_CHARS }, + + { "b20-14.72", 0x80000, 0x89f889e5, BRF_GRA | TAITO_SPRITESA }, + + { "b20-08.21", 0x80000, 0xf3e19c64, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Opwolf) +STD_ROM_FN(Opwolf) + +static struct BurnRomInfo OpwolfaRomDesc[] = { + { "b20-05-02.40", 0x10000, 0x3ffbfe3a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-03-02.30", 0x10000, 0xfdabd8a5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-04.39", 0x10000, 0x216b4838, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-17.29", 0x10000, 0x6043188e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b20-07.10", 0x10000, 0x45c7ace3, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b20-13.13", 0x80000, 0xf6acdab1, BRF_GRA | TAITO_CHARS }, + + { "b20-14.72", 0x80000, 0x89f889e5, BRF_GRA | TAITO_SPRITESA }, + + { "b20-08.21", 0x80000, 0xf3e19c64, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Opwolfa) +STD_ROM_FN(Opwolfa) + +static struct BurnRomInfo OpwolfjRomDesc[] = { + { "b20-05-02.40", 0x10000, 0x3ffbfe3a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-03-02.30", 0x10000, 0xfdabd8a5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-04.39", 0x10000, 0x216b4838, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-18.29", 0x10000, 0xfd202470, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b20-07.10", 0x10000, 0x45c7ace3, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b20-13.13", 0x80000, 0xf6acdab1, BRF_GRA | TAITO_CHARS }, + + { "b20-14.72", 0x80000, 0x89f889e5, BRF_GRA | TAITO_SPRITESA }, + + { "b20-08.21", 0x80000, 0xf3e19c64, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Opwolfj) +STD_ROM_FN(Opwolfj) + +static struct BurnRomInfo OpwolfuRomDesc[] = { + { "b20-05-02.40", 0x10000, 0x3ffbfe3a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-03-02.30", 0x10000, 0xfdabd8a5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-04.39", 0x10000, 0x216b4838, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b20-19.29", 0x10000, 0xb71bc44c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b20-07.10", 0x10000, 0x45c7ace3, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b20-13.13", 0x80000, 0xf6acdab1, BRF_GRA | TAITO_CHARS }, + + { "b20-14.72", 0x80000, 0x89f889e5, BRF_GRA | TAITO_SPRITESA }, + + { "b20-08.21", 0x80000, 0xf3e19c64, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Opwolfu) +STD_ROM_FN(Opwolfu) + +static struct BurnRomInfo OpwolfbRomDesc[] = { + { "opwlfb.12", 0x10000, 0xd87e4405, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "opwlfb.10", 0x10000, 0x9ab6f75c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "opwlfb.13", 0x10000, 0x61230c6e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "opwlfb.11", 0x10000, 0x342e318d, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "opwlfb.30", 0x08000, 0x0669b94c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "opwlfb.09", 0x08000, 0xab27a3dd, BRF_ESS | BRF_PRG | TAITO_Z80ROM2 }, + + { "opwlfb.08", 0x10000, 0x134d294e, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "opwlfb.04", 0x10000, 0xde0ca98d, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "opwlfb.06", 0x10000, 0x317d0e66, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "opwlfb.02", 0x10000, 0x6231fdd0, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "opwlfb.07", 0x10000, 0xe1c4095e, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "opwlfb.03", 0x10000, 0xccf8ba80, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "opwlfb.05", 0x10000, 0xfd9e72c8, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "opwlfb.01", 0x10000, 0x0a65f256, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "opwlfb.14", 0x10000, 0x663786eb, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "opwlfb.18", 0x10000, 0xde9ab08e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "opwlfb.15", 0x10000, 0x315b8aa9, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "opwlfb.19", 0x10000, 0x645cf85e, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "opwlfb.16", 0x10000, 0xe01099e3, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "opwlfb.20", 0x10000, 0xd80b9cc6, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "opwlfb.17", 0x10000, 0x56fbe61d, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "opwlfb.21", 0x10000, 0x97d25157, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "opwlfb.29", 0x10000, 0x05a9eac0, BRF_SND | TAITO_MSM5205_BYTESWAP }, + { "opwlfb.25", 0x10000, 0x85b87f58, BRF_SND | TAITO_MSM5205_BYTESWAP }, + { "opwlfb.28", 0x10000, 0x281b2175, BRF_SND | TAITO_MSM5205_BYTESWAP }, + { "opwlfb.24", 0x10000, 0x8efc5d4d, BRF_SND | TAITO_MSM5205_BYTESWAP }, + { "opwlfb.27", 0x10000, 0x441211a6, BRF_SND | TAITO_MSM5205_BYTESWAP }, + { "opwlfb.23", 0x10000, 0xa874c703, BRF_SND | TAITO_MSM5205_BYTESWAP }, + { "opwlfb.26", 0x10000, 0x86d1d42d, BRF_SND | TAITO_MSM5205_BYTESWAP }, + { "opwlfb.22", 0x10000, 0x9228481f, BRF_SND | TAITO_MSM5205_BYTESWAP }, + +}; + +STD_ROM_PICK(Opwolfb) +STD_ROM_FN(Opwolfb) + +static struct BurnRomInfo RbislandRomDesc[] = { + { "b22-10-1.19", 0x10000, 0xe34a50ca, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-11-1.20", 0x10000, 0x6a31a093, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-08-1.21", 0x10000, 0x15d6e17a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-09-1.22", 0x10000, 0x454e66bc, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-03.23", 0x20000, 0x3ebb0fb8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-04.24", 0x20000, 0x91625e7f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b22-14.43", 0x10000, 0x113c1a5b, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b22-01.2", 0x80000, 0xb76c9168, BRF_GRA | TAITO_CHARS }, + + { "b22-02.5", 0x80000, 0x1b87ecf0, BRF_GRA | TAITO_SPRITESA }, + { "b22-12.7", 0x10000, 0x67a76dc6, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "b22-13.6", 0x10000, 0x2fda099f, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "cchip_b22-15.53", 0x10000, 0x00000000, BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(Rbisland) +STD_ROM_FN(Rbisland) + +static struct BurnRomInfo RbislandoRomDesc[] = { + { "b22-10.19", 0x10000, 0x3b013495, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-11.20", 0x10000, 0x80041a3d, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-08.21", 0x10000, 0x962fb845, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-09.22", 0x10000, 0xf43efa27, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-03.23", 0x20000, 0x3ebb0fb8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-04.24", 0x20000, 0x91625e7f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b22-14.43", 0x10000, 0x113c1a5b, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b22-01.2", 0x80000, 0xb76c9168, BRF_GRA | TAITO_CHARS }, + + { "b22-02.5", 0x80000, 0x1b87ecf0, BRF_GRA | TAITO_SPRITESA }, + { "b22-12.7", 0x10000, 0x67a76dc6, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "b22-13.6", 0x10000, 0x2fda099f, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "cchip_b22-15.53", 0x10000, 0x00000000, BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(Rbislando) +STD_ROM_FN(Rbislando) + +static struct BurnRomInfo RbislandeRomDesc[] = { + { "b39-01.19", 0x10000, 0x50690880, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b39-02.20", 0x10000, 0x4dead71f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b39-03.21", 0x10000, 0x4a4cb785, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b39-04.22", 0x10000, 0x4caa53bd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-03.23", 0x20000, 0x3ebb0fb8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-04.24", 0x20000, 0x91625e7f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b22-14.43", 0x10000, 0x113c1a5b, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b22-01.2", 0x80000, 0xb76c9168, BRF_GRA | TAITO_CHARS }, + + { "b22-02.5", 0x80000, 0x1b87ecf0, BRF_GRA | TAITO_SPRITESA }, + { "b22-12.7", 0x10000, 0x67a76dc6, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "b22-13.6", 0x10000, 0x2fda099f, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "cchip_b39-05.53", 0x10000, 0x00000000, BRF_OPT | BRF_NODUMP }, +}; + +STD_ROM_PICK(Rbislande) +STD_ROM_FN(Rbislande) + +static struct BurnRomInfo JumpingRomDesc[] = { + { "jb1_h4", 0x10000, 0x3fab6b31, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "jb1_h8", 0x10000, 0x8c878827, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "jb1_i4", 0x10000, 0x443492cf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "jb1_i8", 0x10000, 0xed33bae1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-03.23", 0x20000, 0x3ebb0fb8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b22-04.24", 0x20000, 0x91625e7f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "jb1_f89", 0x10000, 0x0810d327, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP_JUMPING }, + + { "jb1_cd67", 0x10000, 0x8527c00e, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "jb2_ic8", 0x10000, 0x65b76309, BRF_GRA | TAITO_CHARS }, + { "jb2_ic7", 0x10000, 0x43a94283, BRF_GRA | TAITO_CHARS }, + { "jb2_ic10", 0x10000, 0xe61933fb, BRF_GRA | TAITO_CHARS }, + { "jb2_ic9", 0x10000, 0xed031eb2, BRF_GRA | TAITO_CHARS }, + { "jb2_ic12", 0x10000, 0x312700ca, BRF_GRA | TAITO_CHARS }, + { "jb2_ic11", 0x10000, 0xde3b0b88, BRF_GRA | TAITO_CHARS }, + { "jb2_ic14", 0x10000, 0x9fdc6c8e, BRF_GRA | TAITO_CHARS }, + { "jb2_ic13", 0x10000, 0x06226492, BRF_GRA | TAITO_CHARS }, + + { "jb2_ic62", 0x10000, 0x8548db6c, BRF_GRA | TAITO_SPRITESA }, + { "jb2_ic61", 0x10000, 0x37c5923b, BRF_GRA | TAITO_SPRITESA }, + { "jb2_ic60", 0x08000, 0x662a2f1e, BRF_GRA | TAITO_SPRITESA }, + { "jb2_ic78", 0x10000, 0x925865e1, BRF_GRA | TAITO_SPRITESA }, + { "jb2_ic77", 0x10000, 0xb09695d1, BRF_GRA | TAITO_SPRITESA }, + { "jb2_ic76", 0x08000, 0x41937743, BRF_GRA | TAITO_SPRITESA }, + { "jb2_ic93", 0x10000, 0xf644eeab, BRF_GRA | TAITO_SPRITESA }, + { "jb2_ic92", 0x10000, 0x3fbccd33, BRF_GRA | TAITO_SPRITESA }, + { "jb2_ic91", 0x08000, 0xd886c014, BRF_GRA | TAITO_SPRITESA }, + { "jb2_i121", 0x10000, 0x93df1e4d, BRF_GRA | TAITO_SPRITESA }, + { "jb2_i120", 0x10000, 0x7c4e893b, BRF_GRA | TAITO_SPRITESA }, + { "jb2_i119", 0x08000, 0x7e1d58d8, BRF_GRA | TAITO_SPRITESA }, +}; + +STD_ROM_PICK(Jumping) +STD_ROM_FN(Jumping) + +static struct BurnRomInfo RastanRomDesc[] = { + { "b04-38.19", 0x10000, 0x1c91dbb1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-37.7", 0x10000, 0xecf20bdd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-40.20", 0x10000, 0x0930d4b3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-39.8", 0x10000, 0xd95ade5e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-42.21", 0x10000, 0x1857a7cb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-43-1.9", 0x10000, 0xca4702ff, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, + { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, + { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, + { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, + + { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, + { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, + { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, + { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, + + { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Rastan) +STD_ROM_FN(Rastan) + +static struct BurnRomInfo RastanaRomDesc[] = { + { "b04-38.19", 0x10000, 0x1c91dbb1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-37.7", 0x10000, 0xecf20bdd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-40.20", 0x10000, 0x0930d4b3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-39.8", 0x10000, 0xd95ade5e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-42.21", 0x10000, 0x1857a7cb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-43.9", 0x10000, 0xc34b9152, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, + { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, + { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, + { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, + + { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, + { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, + { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, + { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, + + { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Rastana) +STD_ROM_FN(Rastana) + +static struct BurnRomInfo RastanuRomDesc[] = { + { "b04-38.19", 0x10000, 0x1c91dbb1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-37.7", 0x10000, 0xecf20bdd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-45.20", 0x10000, 0x362812dd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-44.8", 0x10000, 0x51cc5508, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-42.21", 0x10000, 0x1857a7cb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-41-1.9", 0x10000, 0xbd403269, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, + { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, + { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, + { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, + + { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, + { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, + { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, + { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, + + { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Rastanu) +STD_ROM_FN(Rastanu) + +static struct BurnRomInfo RastanuaRomDesc[] = { + { "b04-38.19", 0x10000, 0x1c91dbb1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-37.7", 0x10000, 0xecf20bdd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-45.20", 0x10000, 0x362812dd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-44.8", 0x10000, 0x51cc5508, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-42.21", 0x10000, 0x1857a7cb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-41.9", 0x10000, 0xb44ca1c4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, + { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, + { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, + { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, + + { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, + { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, + { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, + { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, + + { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Rastanua) +STD_ROM_FN(Rastanua) + +static struct BurnRomInfo RastanubRomDesc[] = { + { "b04-14.19", 0x10000, 0xa38ac909, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-21.7", 0x10000, 0x7c8dde9a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-23.20", 0x10000, 0x254b3dce, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-22.8", 0x10000, 0x98e8edcf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-25.21", 0x10000, 0xd1e5adee, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-24.9", 0x10000, 0xa3dcc106, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, + { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, + { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, + { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, + + { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, + { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, + { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, + { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, + + { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Rastanub) +STD_ROM_FN(Rastanub) + +static struct BurnRomInfo RastsagaRomDesc[] = { + { "b04-14.19", 0x10000, 0xa38ac909, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-13.7", 0x10000, 0xbad60872, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-16-1.20", 0x10000, 0x00b59e60, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-15-1.8", 0x10000, 0xff9e018a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-18-1.21", 0x10000, 0xb626c439, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-17-1.9", 0x10000, 0xc928a516, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, + { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, + { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, + { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, + + { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, + { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, + { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, + { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, + + { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Rastsaga) +STD_ROM_FN(Rastsaga) + +static struct BurnRomInfo RastsagaaRomDesc[] = { + { "b04-14.19", 0x10000, 0xa38ac909, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-13.7", 0x10000, 0xbad60872, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-16.20", 0x10000, 0x6bcf70dc, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-15.8", 0x10000, 0x8838ecc5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-18-1.21", 0x10000, 0xb626c439, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b04-17-1.9", 0x10000, 0xc928a516, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b04-19.49", 0x10000, 0xee81fdd8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b04-01.40", 0x20000, 0xcd30de19, BRF_GRA | TAITO_CHARS }, + { "b04-03.39", 0x20000, 0xab67e064, BRF_GRA | TAITO_CHARS }, + { "b04-02.67", 0x20000, 0x54040fec, BRF_GRA | TAITO_CHARS }, + { "b04-04.66", 0x20000, 0x94737e93, BRF_GRA | TAITO_CHARS }, + + { "b04-05.15", 0x20000, 0xc22d94ac, BRF_GRA | TAITO_SPRITESA }, + { "b04-07.14", 0x20000, 0xb5632a51, BRF_GRA | TAITO_SPRITESA }, + { "b04-06.28", 0x20000, 0x002ccf39, BRF_GRA | TAITO_SPRITESA }, + { "b04-08.27", 0x20000, 0xfeafca05, BRF_GRA | TAITO_SPRITESA }, + + { "b04-20.76", 0x10000, 0xfd1a34cc, BRF_SND | TAITO_MSM5205 }, +}; + +STD_ROM_PICK(Rastsagaa) +STD_ROM_FN(Rastsagaa) + +static struct BurnRomInfo TopspeedRomDesc[] = { + { "b14-67-1.11", 0x10000, 0x23f17616, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b14-68-1.9", 0x10000, 0x835659d9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b14-54.24", 0x20000, 0x172924d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b14-52.26", 0x20000, 0xe1b5b2a1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b14-55.23", 0x20000, 0xa1f15499, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b14-53.25", 0x20000, 0x04a04f5f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b14-69.80", 0x10000, 0xd652e300, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b14-70.81", 0x10000, 0xb720592b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b14-25.67", 0x10000, 0x9eab28ef, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b14-07.54", 0x20000, 0xc6025fff, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "b14-06.52", 0x20000, 0xb4e2536e, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "b14-48.16", 0x20000, 0x30c7f265, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-49.12", 0x20000, 0x32ba4265, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-50.8", 0x20000, 0xec1ef311, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-51.4", 0x20000, 0x35041c5f, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-44.15", 0x20000, 0x9f6c030e, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-45.11", 0x20000, 0x63e4ce03, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-46.7", 0x20000, 0xd489adf2, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-47.3", 0x20000, 0xb3a1f75b, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-40.14", 0x20000, 0xfa2a3cb3, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-41.10", 0x20000, 0x09455a14, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-42.6", 0x20000, 0xab51f53c, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-43.2", 0x20000, 0x1e6d2b38, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-36.13", 0x20000, 0x20a7c1b8, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-37.9", 0x20000, 0x801b703b, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-38.5", 0x20000, 0xde0c213e, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + { "b14-39.1", 0x20000, 0x798c28c5, BRF_GRA | TAITO_SPRITESA_TOPSPEED }, + + { "b14-30.88" , 0x10000, 0xdccb0c7f, BRF_GRA | TAITO_SPRITEMAP }, + + { "b14-28.103", 0x10000, 0xdf11d0ae, BRF_SND | TAITO_MSM5205 }, + { "b14-29.109", 0x10000, 0x7ad983e7, BRF_SND | TAITO_MSM5205 }, + + { "b14-31.90", 0x02000, 0x5c6b013d, BRF_OPT }, +}; + +STD_ROM_PICK(Topspeed) +STD_ROM_FN(Topspeed) + +static struct BurnRomInfo TopspeeduRomDesc[] = { + { "b14-23", 0x10000, 0xdd0307fd, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b14-24", 0x10000, 0xacdf08d4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b14-05", 0x80000, 0x6557e9d8, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "b14-26", 0x10000, 0x659dc872, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b14-56", 0x10000, 0xd165cf1b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b14-25.67", 0x10000, 0x9eab28ef, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b14-07.54", 0x20000, 0xc6025fff, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "b14-06.52", 0x20000, 0xb4e2536e, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "b14-01", 0x80000, 0x84a56f37, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b14-02", 0x80000, 0x6889186b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b14-03", 0x80000, 0xd1ed9e71, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b14-04", 0x80000, 0xb63f0519, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b14-30.88" , 0x10000, 0xdccb0c7f, BRF_GRA | TAITO_SPRITEMAP }, + + { "b14-28.103", 0x10000, 0xdf11d0ae, BRF_SND | TAITO_MSM5205 }, + { "b14-29.109", 0x10000, 0x7ad983e7, BRF_SND | TAITO_MSM5205 }, + + { "b14-31.90", 0x02000, 0x5c6b013d, BRF_OPT }, +}; + +STD_ROM_PICK(Topspeedu) +STD_ROM_FN(Topspeedu) + +static struct BurnRomInfo FullthrlRomDesc[] = { + { "b14-67", 0x10000, 0x284c943f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b14-68", 0x10000, 0x54cf6196, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b14-05", 0x80000, 0x6557e9d8, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, + + { "b14-69.80", 0x10000, 0xd652e300, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b14-71", 0x10000, 0xf7081727, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b14-25.67", 0x10000, 0x9eab28ef, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b14-07.54", 0x20000, 0xc6025fff, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "b14-06.52", 0x20000, 0xb4e2536e, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "b14-01", 0x80000, 0x84a56f37, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b14-02", 0x80000, 0x6889186b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b14-03", 0x80000, 0xd1ed9e71, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b14-04", 0x80000, 0xb63f0519, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b14-30.88" , 0x10000, 0xdccb0c7f, BRF_GRA | TAITO_SPRITEMAP }, + + { "b14-28.103", 0x10000, 0xdf11d0ae, BRF_SND | TAITO_MSM5205 }, + { "b14-29.109", 0x10000, 0x7ad983e7, BRF_SND | TAITO_MSM5205 }, + + { "b14-31.90", 0x02000, 0x5c6b013d, BRF_OPT }, +}; + +STD_ROM_PICK(Fullthrl) +STD_ROM_FN(Fullthrl) + +static struct BurnRomInfo VolfiedRomDesc[] = { + { "c04-12-1.30", 0x10000, 0xafb6a058, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-08-1.10", 0x10000, 0x19f7e66b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-11-1.29", 0x10000, 0x1aaf6e9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-25-1.9", 0x10000, 0xb39e04f9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-20.7", 0x20000, 0x0aea651f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-22.9", 0x20000, 0xf405d465, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-19.6", 0x20000, 0x231493ae, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-21.8", 0x20000, 0x8598d38e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c04-06.71", 0x08000, 0xb70106b2, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c04-16.2", 0x20000, 0x8c2476ef, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-18.4", 0x20000, 0x7665212c, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-15.1", 0x20000, 0x7c50b978, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-17.3", 0x20000, 0xc62fdeb8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c04-4-1.3", 0x00200, 0xab9fae65, BRF_OPT }, + { "c04-5.75", 0x00200, 0x2763ec89, BRF_OPT }, +}; + +STD_ROM_PICK(Volfied) +STD_ROM_FN(Volfied) + +static struct BurnRomInfo VolfiedjRomDesc[] = { + { "c04-12-1.30", 0x10000, 0xafb6a058, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-08-1.10", 0x10000, 0x19f7e66b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-11-1.29", 0x10000, 0x1aaf6e9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-07-1.9", 0x10000, 0x5d9065d5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-20.7", 0x20000, 0x0aea651f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-22.9", 0x20000, 0xf405d465, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-19.6", 0x20000, 0x231493ae, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-21.8", 0x20000, 0x8598d38e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c04-06.71", 0x08000, 0xb70106b2, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c04-16.2", 0x20000, 0x8c2476ef, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-18.4", 0x20000, 0x7665212c, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-15.1", 0x20000, 0x7c50b978, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-17.3", 0x20000, 0xc62fdeb8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c04-4-1.3", 0x00200, 0xab9fae65, BRF_OPT }, + { "c04-5.75", 0x00200, 0x2763ec89, BRF_OPT }, +}; + +STD_ROM_PICK(Volfiedj) +STD_ROM_FN(Volfiedj) + +static struct BurnRomInfo VolfiedjoRomDesc[] = { + { "c04-12.30", 0x10000, 0xe319c7ec, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-08.10", 0x10000, 0x81c6f755, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-11.29", 0x10000, 0xf05696a6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-07.9", 0x10000, 0x4eeda184, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-20.7", 0x20000, 0x0aea651f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-22.9", 0x20000, 0xf405d465, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-19.6", 0x20000, 0x231493ae, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-21.8", 0x20000, 0x8598d38e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c04-06.71", 0x08000, 0xb70106b2, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c04-16.2", 0x20000, 0x8c2476ef, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-18.4", 0x20000, 0x7665212c, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-15.1", 0x20000, 0x7c50b978, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-17.3", 0x20000, 0xc62fdeb8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c04-4-1.3", 0x00200, 0xab9fae65, BRF_OPT }, + { "c04-5.75", 0x00200, 0x2763ec89, BRF_OPT }, +}; + +STD_ROM_PICK(Volfiedjo) +STD_ROM_FN(Volfiedjo) + +static struct BurnRomInfo VolfieduRomDesc[] = { + { "c04-12-1.30", 0x10000, 0xafb6a058, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-08-1.10", 0x10000, 0x19f7e66b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-11-1.29", 0x10000, 0x1aaf6e9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-24-1.9", 0x10000, 0xc499346f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-20.7", 0x20000, 0x0aea651f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-22.9", 0x20000, 0xf405d465, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-19.6", 0x20000, 0x231493ae, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c04-21.8", 0x20000, 0x8598d38e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c04-06.71", 0x08000, 0xb70106b2, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c04-16.2", 0x20000, 0x8c2476ef, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-18.4", 0x20000, 0x7665212c, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-15.1", 0x20000, 0x7c50b978, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-17.3", 0x20000, 0xc62fdeb8, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-10.15", 0x10000, 0x429b6b49, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + { "c04-09.14", 0x10000, 0xc78cf057, BRF_GRA | TAITO_SPRITESA_BYTESWAP }, + + { "c04-4-1.3", 0x00200, 0xab9fae65, BRF_OPT }, + { "c04-5.75", 0x00200, 0x2763ec89, BRF_OPT }, +}; + +STD_ROM_PICK(Volfiedu) +STD_ROM_FN(Volfiedu) + +static int MemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += Taito68KRom1Size; + Taito68KRom2 = Next; Next += Taito68KRom2Size; + TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; + TaitoZ80Rom2 = Next; Next += TaitoZ80Rom2Size; + TaitoSpriteMapRom = Next; Next += TaitoSpriteMapRomSize; + TaitoMSM5205Rom = Next; Next += TaitoMSM5205RomSize; + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x018000; + TaitoZ80Ram1 = Next; Next += 0x001000; + if (TaitoNumZ80s == 2) TaitoZ80Ram2 = Next; Next += 0x000800; + TaitoPaletteRam = Next; Next += 0x004000; + TaitoSpriteRam = Next; Next += 0x00f000; + TaitoSharedRam = Next; Next += 0x010000; + TaitoVideoRam = Next; Next += 0x080000; + Taito68KRam2 = Next; Next += 0x010000; + + TaitoRamEnd = Next; + + TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; + TaitoCharsB = Next; Next += TaitoNumCharB * TaitoCharBWidth * TaitoCharBHeight; + TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; + TaitoPalette = (UINT32*)Next; Next += 0x02000 * sizeof(UINT32); + + TaitoMemEnd = Next; + + return 0; +} + +static INT32 DariusDoReset() +{ + INT32 i; + + TaitoDoReset(); + + DariusADPCMCommand = 0; + DariusNmiEnable = 0; + DariusCoinWord = 0; + + for (i = 0; i < 8; i++) DariusVol[i] = 0x00; + + for (i = 0; i < 5; i++) DariusPan[i] = 0x80; + + for (i = 0; i < 0x10; i++) { + DariusDefVol[i] = (INT32)(100.0f / (float)pow(10.0f, (32.0f - (i * (32.0f / (float)(0xf)))) / 20.0f)); + } + + return 0; +} + +static INT32 RbislandDoReset() +{ +#if 0 + // This resets the YM2151 which calls DrvSoundBankSwitch via the port callback + TaitoDoReset(); +#else + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(0); + BurnYM2151Reset(); + ZetClose(); +#endif + + return 0; +} + +static INT32 OpwolfDoReset() +{ +#if 0 + // This resets the YM2151 which calls DrvSoundBankSwitch via the port callback + TaitoDoReset(); +#else + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(0); + BurnYM2151Reset(); + ZetClose(); + MSM5205Reset(); +#endif + + memset(OpwolfADPCM_B, 0, 8); + memset(OpwolfADPCM_C, 0, 8); + OpwolfADPCMPos[0] = OpwolfADPCMPos[1] = 0; + OpwolfADPCMEnd[0] = OpwolfADPCMEnd[1] = 0; + OpwolfADPCMData[0] = OpwolfADPCMData[1] = -1; + + MSM5205ResetWrite(0, 1); + MSM5205ResetWrite(1, 1); + + return 0; +} + +static INT32 RastanDoReset() +{ + TaitoDoReset(); + + RastanADPCMPos = 0; + RastanADPCMData = -1; + + return 0; +} + +static INT32 VolfiedDoReset() +{ + TaitoDoReset(); + + VolfiedVidCtrl = 0; + VolfiedVidMask = 0; + + return 0; +} + +static INT32 TopspeedDoReset() +{ + TaitoDoReset(); + + RastanADPCMPos = 0; + RastanADPCMData = -1; + + return 0; +} + +static void TaitoMiscCpuAReset(UINT16 d) +{ + TaitoCpuACtrl = d; + if (!(TaitoCpuACtrl & 1)) { + SekClose(); + SekOpen(1); + SekReset(); + SekClose(); + SekOpen(0); + } +} + +UINT8 __fastcall Darius68K1ReadByte(UINT32 a) +{ + switch (a) { + case 0xc00010: { + return TaitoDip[1]; + } + + case 0xc00011: { + return TaitoDip[0]; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius68K1WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Darius68K1ReadWord(UINT32 a) +{ + switch (a) { + case 0xc00002: { + return TC0140SYTCommRead(); + } + + case 0xc00008: { + return TaitoInput[0]; + } + + case 0xc0000a: { + return TaitoInput[1]; + } + + case 0xc0000c: { + return TaitoInput[2]; + } + + case 0xc0000e: { + return DariusCoinWord; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius68K1WriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x0a0000: { + TaitoMiscCpuAReset(d); + return; + } + + case 0x0b0000: { + //watchdog + return; + } + + case 0xc00000: { + TC0140SYTPortWrite(d & 0xff); + return; + } + + case 0xc00002: { + TC0140SYTCommWrite(d & 0xff); + return; + } + + case 0xc00020: + case 0xc00022: + case 0xc00024: + case 0xc00030: + case 0xc00032: + case 0xc00034: { + //misc io writes + return; + } + + case 0xc00050: { + //nop + return; + } + + case 0xc00060: { + DariusCoinWord = d; + return; + } + + case 0xd20000: + case 0xd20002: { + PC080SNSetScrollY(0, (a - 0xd20000) >> 1, d); + return; + } + + case 0xd40000: + case 0xd40002: { + PC080SNSetScrollX(0, (a - 0xd40000) >> 1, d); + return; + } + + case 0xd50000: { + PC080SNCtrlWrite(0, (a - 0xd50000) >> 1, d); + return; + } + + case 0xdc0000: { + //??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Darius68K2ReadByte(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius68K2WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Darius68K2ReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Darius68K2WriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0xc00050: { + //nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Opwolf68KReadByte(UINT32 a) +{ + if (a >= 0x0ff000 && a <= 0x0ff7ff) { + return OpwolfCChipDataRead((a - 0x0ff000) >> 1); + } + + switch (a) { + case 0x3e0002: { + return TC0140SYTCommRead(); + } + } + + return 0; +} + +void __fastcall Opwolf68KWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x0ff000 && a <= 0x0ff7ff) { + OpwolfCChipDataWrite(Taito68KRom1, (a - 0x0ff000) >> 1, d); + return; + } + + switch (a) { + case 0x3e0000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x3e0002: { + TC0140SYTCommWrite(d); + return; + } + } +} + +UINT16 __fastcall Opwolf68KReadWord(UINT32 a) +{ + if (a >= 0x0f0000 && a <= 0x0f07ff) { + return OpwolfCChipDataRead((a - 0x0f0000) >> 1); + } + + if (a >= 0x0ff000 && a <= 0x0ff7ff) { + return OpwolfCChipDataRead((a - 0x0ff000) >> 1); + } + + switch (a) { + case 0x3a0000: { + INT32 scaled = (BurnGunReturnX(0) * 320) / 256; + return scaled + 0x15 + OpWolfGunXOffset; + } + + case 0x3a0002: { + return BurnGunReturnY(0) - 0x24 + OpWolfGunYOffset; + } + + case 0x0ff802: { + return OpwolfCChipStatusRead(); + } + + case 0x380000: { + return TaitoDip[0]; + } + + case 0x380002: { + return TaitoDip[1]; + } + } + + return 0; +} + +void __fastcall Opwolf68KWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x0ff000 && a <= 0x0ff7ff) { + OpwolfCChipDataWrite(Taito68KRom1, (a - 0x0ff000) >> 1, d); + return; + } + + switch (a) { + case 0x0ff802: { + OpwolfCChipStatusWrite(); + return; + } + + case 0x0ffc00: { + OpwolfCChipBankWrite(d); + return; + } + + case 0x380000: { + PC090OJSpriteCtrl = (d & 0xe0) >> 5; + return; + } + + case 0x3c0000: { + // nop + return; + } + + case 0xc20000: + case 0xc20002: { + PC080SNSetScrollY(0, (a - 0xc20000) >> 1, d); + return; + } + + case 0xc40000: + case 0xc40002: { + PC080SNSetScrollX(0, (a - 0xc40000) >> 1, d); + return; + } + + case 0xc50000: { + PC080SNCtrlWrite(0, (a - 0xc50000) >> 1, d); + return; + } + } +} + +UINT8 __fastcall Opwolfb68KReadByte(UINT32 a) +{ + if (a >= 0x0ff000 && a <= 0x0fffff) { + return TaitoZ80Ram2[(a - 0x0ff000) >> 1]; + } + + switch (a) { + case 0x3e0002: { + return TC0140SYTCommRead(); + } + } + + return 0; +} + +void __fastcall Opwolfb68KWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x0ff000 && a <= 0x0fffff) { + TaitoZ80Ram2[(a - 0x0ff000) >> 1] = d ; + return; + } + + switch (a) { + case 0x3e0000: { + TC0140SYTPortWrite(d); + return; + } + + case 0x3e0002: { + TC0140SYTCommWrite(d); + return; + } + } +} + +UINT16 __fastcall Opwolfb68KReadWord(UINT32 a) +{ + if (a >= 0x0ff000 && a <= 0x0fffff) { + return TaitoZ80Ram2[(a - 0x0ff000) >> 1]; + } + + switch (a) { + case 0x0f0008: { + return TaitoInput[0]; + } + + case 0x0f000a: { + return TaitoInput[1]; + } + + case 0x380000: { + return TaitoDip[0]; + } + + case 0x380002: { + return TaitoDip[1]; + } + + case 0x3a0000: { + INT32 scaled = (BurnGunReturnX(0) * 320) / 256; + return scaled + 0x15 + OpWolfGunXOffset; + } + + case 0x3a0002: { + return BurnGunReturnY(0) - 0x24 + OpWolfGunYOffset; + } + } + + return 0; +} + +void __fastcall Opwolfb68KWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x0ff000 && a <= 0x0fffff) { + TaitoZ80Ram2[(a - 0x0ff000) >> 1] = d & 0xff; + return; + } + + switch (a) { + case 0x380000: { + PC090OJSpriteCtrl = (d & 0xe0) >> 5; + return; + } + + case 0x3c0000: { + // nop + return; + } + + case 0xc20000: + case 0xc20002: { + PC080SNSetScrollY(0, (a - 0xc20000) >> 1, d); + return; + } + + case 0xc40000: + case 0xc40002: { + PC080SNSetScrollX(0, (a - 0xc40000) >> 1, d); + return; + } + + case 0xc50000: { + PC080SNCtrlWrite(0, (a - 0xc50000) >> 1, d); + return; + } + } +} + +UINT8 __fastcall Rbisland68KReadByte(UINT32 a) +{ + if (a >= 0x800000 && a <= 0x8007ff) { + return RainbowCChipRamRead((a - 0x800000) >> 1); + } + + switch (a) { + case 0x800803: { + return RainbowCChipCtrlRead(); + } + } + + return 0; +} + +void __fastcall Rbisland68KWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x800000 && a <= 0x8007ff) { + RainbowCChipRamWrite((a - 0x800000) >> 1, d); + return; + } + + switch (a) { + case 0x3a0001: { + PC090OJSpriteCtrl = (d & 0xe0) >> 5; + return; + } + + case 0x3e0001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x3e0003: { + TC0140SYTCommWrite(d); + return; + } + + case 0x800803: { + RainbowCChipCtrlWrite(d); + return; + } + + case 0x800c01: { + RainbowCChipBankWrite(d); + return; + } + } +} + +UINT16 __fastcall Rbisland68KReadWord(UINT32 a) +{ + if (a >= 0x800000 && a <= 0x8007ff) { + return RainbowCChipRamRead((a - 0x800000) >> 1); + } + + switch (a) { + case 0x390000: { + return TaitoDip[0]; + } + + case 0x3b0000: { + return TaitoDip[1]; + } + } + + return 0; +} + +void __fastcall Rbisland68KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x3c0000: { + // nop + return; + } + + case 0xc20000: + case 0xc20002: { + PC080SNSetScrollY(0, (a - 0xc20000) >> 1, d); + return; + } + + case 0xc40000: + case 0xc40002: { + PC080SNSetScrollX(0, (a - 0xc40000) >> 1, d); + return; + } + + case 0xc50000: { + PC080SNCtrlWrite(0, (a - 0xc50000) >> 1, d); + return; + } + } +} + +UINT8 __fastcall Jumping68KReadByte(UINT32 a) +{ + switch (a) { + case 0x401001: { + return TaitoInput[0]; + } + + case 0x401003: { + return TaitoInput[1]; + } + + case 0x420000: { + // nop + return 0; + } + } + + return 0; +} + +void __fastcall Jumping68KWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x800000 && a <= 0x80ffff) return; + + switch (a) { + case 0x3a0001: { + PC090OJSpriteCtrl = d; + return; + } + + case 0x400007: { + TaitoSoundLatch = d; + ZetOpen(0); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + return; + } + } +} + +UINT16 __fastcall Jumping68KReadWord(UINT32 a) +{ + switch (a) { + case 0x400000: { + return TaitoDip[0]; + } + + case 0x400002: { + return TaitoDip[0]; + } + } + + return 0; +} + +void __fastcall Jumping68KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x3c0000: { + // nop + return; + } + + case 0x430000: + case 0x430002: { + PC080SNSetScrollY(0, (a - 0x430000) >> 1, d); + return; + } + + case 0xc20000: { + //nop + return; + } + + case 0xc50000: { + //??? + return; + } + } +} + +UINT8 __fastcall Rastan68KReadByte(UINT32 a) +{ + switch (a) { + case 0x390001: { + return TaitoInput[0]; + } + + case 0x390003: { + return TaitoInput[1]; + } + + case 0x390005: { + return TaitoInput[2]; + } + + case 0x390007: { + return TaitoInput[3]; + } + + case 0x390009: { + return TaitoDip[0]; + } + + case 0x39000b: { + return TaitoDip[1]; + } + + case 0x3e0003: { + return TC0140SYTCommRead(); + } + } + + return 0; +} + +void __fastcall Rastan68KWriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x3e0001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x3e0003: { + TC0140SYTCommWrite(d); + return; + } + } +} + +void __fastcall Rastan68KWriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x350008: { + // nop + return; + } + + case 0x380000: { + PC090OJSpriteCtrl = (d & 0xe0) >> 5; + return; + } + + case 0x3c0000: { + // watchdog + return; + } + + case 0xc20000: + case 0xc20002: { + PC080SNSetScrollY(0, (a - 0xc20000) >> 1, d); + return; + } + + case 0xc40000: + case 0xc40002: { + PC080SNSetScrollX(0, (a - 0xc40000) >> 1, d); + return; + } + + case 0xc50000: { + PC080SNCtrlWrite(0, (a - 0xc50000) >> 1, d); + return; + } + } +} + +static UINT8 TopspeedInputBypassRead() +{ + UINT8 Port = TC0220IOCPortRead(); + + INT32 Steer = (TaitoAnalogPort0 >> 4); + + switch (Port) { + case 0x0c: { + return Steer & 0xff; + } + + case 0x0d: { + return Steer >> 8; + } + + default: { + return TC0220IOCPortRegRead(); + } + } +} + +UINT8 __fastcall Topspeed68K1ReadByte(UINT32 a) +{ + switch (a) { + case 0x7e0003: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Topspeed68K1WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x7e0001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x7e0003: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Topspeed68K1ReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Topspeed68K1WriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0xe10000 && a <= 0xe1ffff) { + // ??? + return; + } + + switch (a) { + case 0x600002: { + TaitoMiscCpuAReset(d); + return; + } + + case 0x880002: + case 0x880004: + case 0x880006: { + // ??? + return; + } + + case 0xa20000: + case 0xa20002: { + PC080SNSetScrollY(0, (a - 0xa20000) >> 1, d); + return; + } + + case 0xa40000: + case 0xa40002: { + PC080SNSetScrollX(0, (a - 0xa40000) >> 1, d); + return; + } + + case 0xa50000: { + PC080SNCtrlWrite(0, (a - 0xa50000) >> 1, d); + return; + } + + case 0xb20000: + case 0xb20002: { + PC080SNSetScrollY(1, (a - 0xb20000) >> 1, d); + return; + } + + case 0xb40000: + case 0xb40002: { + PC080SNSetScrollX(1, (a - 0xb40000) >> 1, d); + return; + } + + case 0xb50000: { + PC080SNCtrlWrite(1, (a - 0xb50000) >> 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Topspeed68K2ReadByte(UINT32 a) +{ + if (a >= 0x900000 && a <= 0x9003ff) { + INT32 Offset = (a - 0x900000) >> 1; + + switch (Offset) { + case 0x000: return rand() & 0xff; + case 0x101: return 0x55; + } + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Topspeed68K2WriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x900000 && a <= 0x9003ff) { + return; + } + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Topspeed68K2ReadWord(UINT32 a) +{ + switch (a) { + case 0x880000: { + return TopspeedInputBypassRead(); + } + + case 0x880002: { + return TC0220IOCHalfWordPortRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Topspeed68K2WriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x810000: { + // ??? + return; + } + + case 0x880000: { + TC0220IOCHalfWordPortRegWrite(d); + return; + } + + case 0x880002: { + TC0220IOCHalfWordPortWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Volfied68KReadByte(UINT32 a) +{ + if (a >= 0xf00000 && a <= 0xf007ff) { + INT32 Offset = (a - 0xf00000) >> 1; + return VolfiedCChipRamRead(Offset); + } + + switch (a) { + case 0xd00001: { + return 0x60; + } + + case 0xe00003: { + return TC0140SYTCommRead(); + } + + case 0xf00803: { + return VolfiedCChipCtrlRead() & 0xff; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Volfied68KWriteByte(UINT32 a, UINT8 d) +{ + if (a >= 0x400000 && a <= 0x47ffff) { + INT32 Offset = (a - 0x400000); + INT32 Mask; + if (Offset & 1) { + Mask = VolfiedVidMask >> 8; + } else { + Mask = VolfiedVidMask & 0xff; + } + TaitoVideoRam[Offset ^ 1] = (TaitoVideoRam[Offset ^ 1] & ~Mask) | (d & Mask); + return; + } + + if (a >= 0xf00000 && a <= 0xf007ff) { + INT32 Offset = (a - 0xf00000) >> 1; + VolfiedCChipRamWrite(Offset, d); + return; + } + + switch (a) { + case 0x700001: { + PC090OJSpriteCtrl = (d & 0x3c) >> 2; + return; + } + + case 0xd00001: { + VolfiedVidCtrl = d; + return; + } + + case 0xf00803: { + // cchip ctrl write - ignored + return; + } + + case 0xf00c01: { + VolfiedCChipBankWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Volfied68KReadWord(UINT32 a) +{ + if (a >= 0xf00000 && a <= 0xf007ff) { + INT32 Offset = (a - 0xf00000) >> 1; + return VolfiedCChipRamRead(Offset); + } + + switch (a) { + case 0xd00000: { + return 0x60; + } + + case 0xe00002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Volfied68KWriteWord(UINT32 a, UINT16 d) +{ + if (a >= 0x400000 && a <= 0x47ffff) { + UINT16 *Ram = (UINT16*)TaitoVideoRam; + INT32 Offset = (a - 0x400000) >> 1; + Ram[Offset] = (Ram[Offset] & ~VolfiedVidMask) | (d & VolfiedVidMask); + return; + } + + if (a >= 0xf00000 && a <= 0xf007ff) { + INT32 Offset = (a - 0xf00000) >> 1; + VolfiedCChipRamWrite(Offset, d & 0xff); + return; + } + + switch (a) { + case 0x600000: { + VolfiedVidMask = d; + return; + } + + case 0xd00000: { + VolfiedVidCtrl = d; + return; + } + + case 0xe00000: { + TC0140SYTPortWrite(d & 0xff); + return; + } + + case 0xe00002: { + TC0140SYTCommWrite(d & 0xff); + return; + } + + case 0xf00c00: { + VolfiedCChipBankWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d); + } + } +} + +static void DariusUpdateFM0() +{ + INT32 left = (DariusPan[0] * DariusVol[6]) >> 8; + INT32 right = ((0xff - DariusPan[0]) * DariusVol[6]) >> 8; + + BurnYM2203SetLeftVolume(0, BURN_SND_YM2203_YM2203_ROUTE, (left * DariusYM2203RouteMasterVol) / 100.0); + BurnYM2203SetRightVolume(0, BURN_SND_YM2203_YM2203_ROUTE, (right * DariusYM2203RouteMasterVol) / 100.0); +} + +static void DariusUpdateFM1() +{ + INT32 left = (DariusPan[1] * DariusVol[7]) >> 8; + INT32 right = ((0xff - DariusPan[1]) * DariusVol[7]) >> 8; + + BurnYM2203SetLeftVolume(1, BURN_SND_YM2203_YM2203_ROUTE, (left * DariusYM2203RouteMasterVol) / 100.0); + BurnYM2203SetRightVolume(1, BURN_SND_YM2203_YM2203_ROUTE, (right * DariusYM2203RouteMasterVol) / 100.0); +} + +static void DariusUpdatePSG0(INT32 port) +{ + INT32 left, right; + + left = (DariusPan[2] * DariusVol[port - 1]) >> 8; + right = ((0xff - DariusPan[2]) * DariusVol[port - 1]) >> 8; + + BurnYM2203SetLeftVolume(0, port, (left * DariusYM2203AY8910RouteMasterVol) / 100.0); + BurnYM2203SetRightVolume(0, port, (right * DariusYM2203AY8910RouteMasterVol) / 100.0); +} + +static void DariusUpdatePSG1(INT32 port) +{ + INT32 left, right; + + left = (DariusPan[3] * DariusVol[port + 2]) >> 8; + right = ((0xff - DariusPan[3]) * DariusVol[port + 2]) >> 8; + + BurnYM2203SetLeftVolume(1, port, (left * DariusYM2203AY8910RouteMasterVol) / 100.0); + BurnYM2203SetRightVolume(1, port, (right * DariusYM2203AY8910RouteMasterVol) / 100.0); +} + +static void DariusUpdateDa() +{ + INT32 left = DariusDefVol[(DariusPan[4] >> 4) & 0x0f]; + INT32 right = DariusDefVol[(DariusPan[4] >> 0) & 0x0f]; + + MSM5205SetLeftVolume(0, (left * DariusMSM5205RouteMasterVol) / 100.0); + MSM5205SetRightVolume(0, (right * DariusMSM5205RouteMasterVol) / 100.0); +} + +UINT8 __fastcall DariusZ80Read(UINT16 a) +{ + switch (a) { + case 0x9000: { + return BurnYM2203Read(0, 0); + } + + case 0x9001: { + return BurnYM2203Read(0, 1); + } + + case 0xa000: { + return BurnYM2203Read(1, 0); + } + + case 0xa001: { + return BurnYM2203Read(1, 1); + } + + case 0xb001: { + return TC0140SYTSlaveCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read %04X\n"), a); + } + } + + return 0; +} + +void __fastcall DariusZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x9000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0x9001: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0xa000: { + BurnYM2203Write(1, 0, d); + return; + } + + case 0xa001: { + BurnYM2203Write(1, 1, d); + return; + } + + case 0xb000: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xb001: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xc000: { + DariusPan[0] = d; + DariusUpdateFM0(); + return; + } + + case 0xc400: { + DariusPan[1] = d; + DariusUpdateFM1(); + return; + } + + case 0xc800: { + DariusPan[2] = d; + DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_1); + DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_2); + DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_3); + return; + } + + case 0xcc00: { + DariusPan[3] = d; + DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_1); + DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_2); + DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_3); + return; + } + + case 0xd000: { + DariusPan[4] = d; + DariusUpdateDa(); + return; + } + + case 0xd400: { + DariusADPCMCommand = d; + return; + } + + case 0xd800: { + //??? + return; + } + + case 0xdc00: { + TaitoZ80Bank = d & 0x03; + ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 + 0x10000 + (TaitoZ80Bank * 0x8000)); + ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 + 0x10000 + (TaitoZ80Bank * 0x8000)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall DariusZ802ReadPort(UINT16 a) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + return DariusADPCMCommand; + } + + case 0x02: { + //??? + return 0; + } + + case 0x03: { + //??? + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Read => %02X\n"), a); + } + } + + return 0; +} + +void __fastcall DariusZ802WritePort(UINT16 a, UINT8 d) +{ + a &= 0xff; + + switch (a) { + case 0x00: { + DariusNmiEnable = 0; + return; + } + + case 0x01: { + DariusNmiEnable = 1; + return; + } + + case 0x02: { + MSM5205DataWrite(0, d); + MSM5205ResetWrite(0, !(d & 0x20)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 #2 Port Write => %02X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall OpwolfZ80Read(UINT16 a) +{ + switch (a) { + case 0x9001: { + return BurnYM2151ReadStatus(); + } + + case 0xa001: { + return TC0140SYTSlaveCommRead(); + } + } + + return 0; +} + +void __fastcall OpwolfZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x9000: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x9001: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xa000: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xa001: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xb000: + case 0xb001: + case 0xb002: + case 0xb003: + case 0xb004: + case 0xb005: + case 0xb006: { + INT32 nStart; + INT32 nEnd; + INT32 Offset = a - 0xb000; + + OpwolfADPCM_B[Offset] = d; + if (Offset == 0x04) { + nStart = OpwolfADPCM_B[0] + (OpwolfADPCM_B[1] << 8); + nEnd = OpwolfADPCM_B[2] + (OpwolfADPCM_B[3] << 8); + nStart *= 16; + nEnd *= 16; + OpwolfADPCMPos[0] = nStart; + OpwolfADPCMEnd[0] = nEnd; + MSM5205ResetWrite(0, 0); + } + return; + } + + case 0xc000: + case 0xc001: + case 0xc002: + case 0xc003: + case 0xc004: + case 0xc005: + case 0xc006: { + INT32 nStart; + INT32 nEnd; + INT32 Offset = a - 0xc000; + + OpwolfADPCM_C[Offset] = d; + if (Offset == 0x04) { + nStart = OpwolfADPCM_C[0] + (OpwolfADPCM_C[1] << 8); + nEnd = OpwolfADPCM_C[2] + (OpwolfADPCM_C[3] << 8); + nStart *= 16; + nEnd *= 16; + OpwolfADPCMPos[1] = nStart; + OpwolfADPCMEnd[1] = nEnd; + MSM5205ResetWrite(1, 0); + } + return; + } + + case 0xd000: + case 0xe000: { + return; + } + } +} + +UINT8 __fastcall RbislandZ80Read(UINT16 a) +{ + switch (a) { + case 0x9001: { + return BurnYM2151ReadStatus(); + } + + case 0xa001: { + return TC0140SYTSlaveCommRead(); + } + } + + return 0; +} + +void __fastcall RbislandZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x9000: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x9001: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xa000: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xa001: { + TC0140SYTSlaveCommWrite(d); + return; + } + } +} + +UINT8 __fastcall JumpingZ80Read(UINT16 a) +{ + switch (a) { + case 0xb000: { + return BurnYM2203Read(0, 0); + } + + case 0xb400: { + return BurnYM2203Read(1, 0); + } + + case 0xb800: { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return TaitoSoundLatch; + } + } + + return 0; +} + +void __fastcall JumpingZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xb000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0xb001: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0xb400: { + BurnYM2203Write(1, 0, d); + return; + } + + case 0xb401: { + BurnYM2203Write(1, 1, d); + return; + } + + case 0xbc00: { + //nop + return; + } + } +} + +UINT8 __fastcall RastanZ80Read(UINT16 a) +{ + switch (a) { + case 0x9001: { + return BurnYM2151ReadStatus(); + } + + case 0xa001: { + return TC0140SYTSlaveCommRead(); + } + } + + return 0; +} + +void __fastcall RastanZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x9000: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x9001: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xa000: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xa001: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xb000: { + RastanADPCMPos = (RastanADPCMPos & 0x00ff) | (d << 8); + return; + } + + case 0xc000: { + MSM5205ResetWrite(0, 0); + return; + } + + case 0xd000: { + MSM5205ResetWrite(0, 1); + RastanADPCMPos &= 0xff00; + return; + } + } +} + +UINT8 __fastcall TopspeedZ80Read(UINT16 a) +{ + switch (a) { + case 0x9001: { + return BurnYM2151ReadStatus(); + } + + case 0xa001: { + return TC0140SYTSlaveCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read %04X\n"), a); + } + } + + return 0; +} + +void __fastcall TopspeedZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x9000: { + BurnYM2151SelectRegister(d); + return; + } + + case 0x9001: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xa000: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xa001: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xb000: { + RastanADPCMPos = (RastanADPCMPos & 0x00ff) | (d << 8); + MSM5205ResetWrite(0, 0); + return; + } + + case 0xb800: { + MSM5205ResetWrite(0, 1); + RastanADPCMPos &= 0xff00; + return; + } + + case 0xc000: + case 0xc400: + case 0xc800: + case 0xcc00: + case 0xd000: + case 0xd200: + case 0xd400: + case 0xd600: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall VolfiedZ80Read(UINT16 a) +{ + switch (a) { + case 0x8801: { + return TC0140SYTSlaveCommRead(); + } + + case 0x9000: { + return BurnYM2203Read(0, 0); + } + + case 0x9001: { + return BurnYM2203Read(0, 1); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read %04X\n"), a); + } + } + + return 0; +} + +void __fastcall VolfiedZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0x8800: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0x8801: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0x9000: { + BurnYM2203Write(0, 0, d); + return; + } + + case 0x9001: { + BurnYM2203Write(0, 1, d); + return; + } + + case 0x9800: { + // nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall OpwolfbCChipSubZ80Read(UINT16 a) +{ + switch (a) { + case 0x8800: { + return TaitoInput[0]; + } + + case 0x9800: { + return TaitoInput[0]; + } + } + + return 0; +} + +void __fastcall OpwolfbCChipSubZ80Write(UINT16 a, UINT8) +{ + switch (a) { + case 0x9000: + case 0xa000: { + //nop + return; + } + } +} + +static void TaitoYM2151IRQHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static void TaitoYM2203IRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +inline static INT32 TaitoSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)((double)ZetTotalCycles() * nSoundRate / 4000000); +} + +inline static double TaitoGetTime() +{ + return (double)ZetTotalCycles() / 4000000; +} + +static void RbislandBankSwitch(UINT32, UINT32 Data) +{ + TaitoZ80Bank = (Data - 1) & 3; + + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); +} + +static void RastanBankSwitch(UINT32, UINT32 Data) +{ + Data &= 3; + if (Data != 0) { + TaitoZ80Bank = Data - 1; + + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + } +} + +static void DariusAdpcmInt() +{ + if (DariusNmiEnable) ZetNmi(); +} + +static void OpwolfMSM5205Vck0() +{ + if (OpwolfADPCMData[0] != -1) { + MSM5205DataWrite(0, OpwolfADPCMData[0] & 0x0f); + OpwolfADPCMData[0] = -1; + if (OpwolfADPCMPos[0] == OpwolfADPCMEnd[0]) MSM5205ResetWrite(0, 1); + } else { + OpwolfADPCMData[0] = TaitoMSM5205Rom[OpwolfADPCMPos[0]]; + OpwolfADPCMPos[0] = (OpwolfADPCMPos[0] + 1) & 0x7ffff; + MSM5205DataWrite(0, OpwolfADPCMData[0] >> 4); + } +} + +static void OpwolfMSM5205Vck1() +{ + if (OpwolfADPCMData[1] != -1) { + MSM5205DataWrite(1, OpwolfADPCMData[1] & 0x0f); + OpwolfADPCMData[1] = -1; + if (OpwolfADPCMPos[1] == OpwolfADPCMEnd[1]) MSM5205ResetWrite(1, 1); + } else { + OpwolfADPCMData[1] = TaitoMSM5205Rom[OpwolfADPCMPos[1]]; + OpwolfADPCMPos[1] = (OpwolfADPCMPos[1] + 1) & 0x7ffff; + MSM5205DataWrite(1, OpwolfADPCMData[1] >> 4); + } +} + +static void RastanMSM5205Vck() +{ + if (RastanADPCMData != -1) { + MSM5205DataWrite(0, RastanADPCMData & 0x0f); + RastanADPCMData = -1; + } else { + RastanADPCMData = TaitoMSM5205Rom[RastanADPCMPos]; + RastanADPCMPos = (RastanADPCMPos + 1) & 0xffff; + MSM5205DataWrite(0, RastanADPCMData >> 4); + } +} + +static void TopspeedBankSwitch(UINT32, UINT32 Data) +{ + Data &= 3; + if (Data != 0) { + TaitoZ80Bank = Data - 1; + + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + } +} + +static void TopspeedMSM5205Vck() +{ + if (RastanADPCMData != -1) { + MSM5205DataWrite(0, RastanADPCMData & 0x0f); + RastanADPCMData = -1; + } else { + RastanADPCMData = TaitoMSM5205Rom[RastanADPCMPos]; + RastanADPCMPos = (RastanADPCMPos + 1) & 0x1ffff; + MSM5205DataWrite(0, RastanADPCMData >> 4); + } +} + +static UINT8 VolfiedDip1Read(UINT32) +{ + return TaitoDip[0]; +} + +static UINT8 VolfiedDip2Read(UINT32) +{ + return TaitoDip[1]; +} + +static void DariusWritePortA0(UINT32, UINT32 d) +{ + d &= 0xff; + + DariusVol[0] = DariusDefVol[(d >> 4) & 0x0f]; + DariusVol[6] = DariusDefVol[(d >> 0) & 0x0f]; + DariusUpdateFM0(); + DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_1); +} + +static void DariusWritePortA1(UINT32, UINT32 d) +{ + d &= 0xff; + + DariusVol[3] = DariusDefVol[(d >> 4) & 0x0f]; + DariusVol[7] = DariusDefVol[(d >> 0) & 0x0f]; + DariusUpdateFM1(); + DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_1); +} + +static void DariusWritePortB0(UINT32, UINT32 d) +{ + d &= 0xff; + + DariusVol[1] = DariusDefVol[(d >> 4) & 0x0f]; + DariusVol[2] = DariusDefVol[(d >> 0) & 0x0f]; + DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_2); + DariusUpdatePSG0(BURN_SND_YM2203_AY8910_ROUTE_3); +} + +static void DariusWritePortB1(UINT32, UINT32 d) +{ + d &= 0xff; + + DariusVol[4] = DariusDefVol[(d >> 4) & 0x0f]; + DariusVol[5] = DariusDefVol[(d >> 0) & 0x0f]; + DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_2); + DariusUpdatePSG1(BURN_SND_YM2203_AY8910_ROUTE_3); +} + +static INT32 DariusCharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 DariusCharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; +static INT32 DariusCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 DariusCharBPlaneOffsets[2] = { 0, 8 }; +static INT32 DariusCharBXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 DariusCharBYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; +static INT32 DariusSpritePlaneOffsets[4] = { 24, 8, 16, 0 }; +static INT32 DariusSpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 256, 257, 258, 259, 260, 261, 262, 263 }; +static INT32 DariusSpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 }; +static INT32 OpwolfbCharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 OpwolfbCharXOffsets[8] = { 0, 4, 8, 12, 16, 20, 24, 28 }; +static INT32 OpwolfbCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 OpwolfbSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 OpwolfbSpriteXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60 }; +static INT32 OpwolfbSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; +static INT32 RbislandCharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 RbislandCharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; +static INT32 RbislandCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 RbislandSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 RbislandSpriteXOffsets[16] = { 8, 12, 0, 4, 24, 28, 16, 20, 40, 44, 32, 36, 56, 60, 48, 52 }; +static INT32 RbislandSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; +static INT32 JumpingCharPlaneOffsets[4] = { 0, 0x20000*8, 0x40000*8, 0x60000*8 }; +static INT32 JumpingCharXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 JumpingCharYOffsets[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +static INT32 JumpingSpritePlaneOffsets[4] = { 0x78000*8, 0x50000*8, 0x28000*8, 0 }; +static INT32 JumpingSpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 JumpingSpriteYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; +static INT32 RastanCharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 RastanCharXOffsets[8] = { 0, 4, 0x200000, 0x200004, 8, 12, 0x200008, 0x20000c }; +static INT32 RastanCharYOffsets[8] = { 0, 16, 32, 48, 64, 80, 96, 112 }; +static INT32 RastanSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 RastanSpriteXOffsets[16] = { 0, 4, 0x200000, 0x200004, 8, 12, 0x200008, 0x20000c, 16, 20, 0x200010, 0x200014, 24, 28, 0x200018, 0x20001c }; +static INT32 RastanSpriteYOffsets[16] = { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; +static INT32 TopspeedCharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 TopspeedCharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; +static INT32 TopspeedCharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 TopspeedSpritePlaneOffsets[4] = { 0, 8, 16, 24 }; +static INT32 TopspeedSpriteXOffsets[16] = { 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 TopspeedSpriteYOffsets[8] = { 0, 64, 128, 192, 256, 320, 384, 448 }; +static INT32 VolfiedSpritePlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 VolfiedSpriteXOffsets[16] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60 }; +static INT32 VolfiedSpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; + +static INT32 DariusInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = DariusCharPlaneOffsets; + TaitoCharXOffsets = DariusCharXOffsets; + TaitoCharYOffsets = DariusCharYOffsets; + TaitoNumChar = 0x3000; + + TaitoCharBModulo = 0x80; + TaitoCharBNumPlanes = 2; + TaitoCharBWidth = 8; + TaitoCharBHeight = 8; + TaitoCharBPlaneOffsets = DariusCharBPlaneOffsets; + TaitoCharBXOffsets = DariusCharBXOffsets; + TaitoCharBYOffsets = DariusCharBYOffsets; + TaitoNumCharB = 0x800; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = DariusSpritePlaneOffsets; + TaitoSpriteAXOffsets = DariusSpriteXOffsets; + TaitoSpriteAYOffsets = DariusSpriteYOffsets; + TaitoNumSpriteA = 0x1800; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 2; + TaitoNumYM2203 = 2; + TaitoNumMSM5205 = 1; + + TaitoLoadRoms(0); + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "darius") != 0) Taito68KRom1Size = 0x60000; + TaitoZ80Rom1Size = 0x30000; + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "darius") != 0) { + memcpy(Taito68KRom1 + 0x40000, Taito68KRom1 + 0x20000, 0x20000); + memset(Taito68KRom1 + 0x20000, 0xff, 0x20000); + } + + for (INT32 i = 3; i >= 0; i--) { + memcpy(TaitoZ80Rom1 + 0x8000 * i + 0x10000, TaitoZ80Rom1 , 0x4000); + memcpy(TaitoZ80Rom1 + 0x8000 * i + 0x14000, TaitoZ80Rom1 + 0x4000 * i, 0x4000); + } + + PC080SNInit(0, TaitoNumChar, -16, 0, 0, 1); + TC0140SYTInit(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x080000, 0x08ffff, SM_RAM); + SekMapMemory(PC080SNRam[0] , 0xd00000, 0xd0ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0xd80000, 0xd80fff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0xe00100, 0xe00fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0xe01000, 0xe02fff, SM_RAM); + SekMapMemory(TaitoVideoRam , 0xe08000, 0xe0ffff, SM_RAM); + SekMapMemory(Taito68KRam1 + 0x10000 , 0xe10000, 0xe10fff, SM_RAM); + SekSetReadByteHandler(0, Darius68K1ReadByte); + SekSetWriteByteHandler(0, Darius68K1WriteByte); + SekSetReadWordHandler(0, Darius68K1ReadWord); + SekSetWriteWordHandler(0, Darius68K1WriteWord); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x040000, 0x04ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0xd80000, 0xd80fff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0xe00100, 0xe00fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0xe01000, 0xe02fff, SM_RAM); + SekMapMemory(TaitoVideoRam , 0xe08000, 0xe0ffff, SM_RAM); + SekSetReadByteHandler(0, Darius68K2ReadByte); + SekSetWriteByteHandler(0, Darius68K2WriteByte); + SekSetReadWordHandler(0, Darius68K2ReadWord); + SekSetWriteWordHandler(0, Darius68K2WriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(DariusZ80Read); + ZetSetWriteHandler(DariusZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetInHandler(DariusZ802ReadPort); + ZetSetOutHandler(DariusZ802WritePort); + ZetMapArea(0x0000, 0xffff, 0, TaitoZ80Rom2 ); + ZetMapArea(0x0000, 0xffff, 2, TaitoZ80Rom2 ); + ZetClose(); + + BurnYM2203Init(2, 4000000, TaitoYM2203IRQHandler, TaitoSynchroniseStream, TaitoGetTime, 0); + BurnTimerAttachZet(8000000 / 2); + BurnYM2203SetPorts(0, NULL, NULL, &DariusWritePortA0, &DariusWritePortB0); + BurnYM2203SetPorts(1, NULL, NULL, &DariusWritePortA1, &DariusWritePortB1); + DariusYM2203AY8910RouteMasterVol = 0.08; + DariusYM2203RouteMasterVol = 0.60; + bYM2203UseSeperateVolumes = 1; + + MSM5205Init(0, TaitoSynchroniseStream, 384000, DariusAdpcmInt, MSM5205_S48_4B, 1); + DariusMSM5205RouteMasterVol = 1.00; + MSM5205SetSeperateVolumes(0, 1); + + GenericTilesInit(); + + TaitoDrawFunction = DariusDraw; + TaitoMakeInputsFunction = DariusMakeInputs; + TaitoIrqLine = 4; + + nTaitoCyclesTotal[0] = (16000000 / 2) / 60; + nTaitoCyclesTotal[1] = (16000000 / 2) / 60; + nTaitoCyclesTotal[2] = (8000000 / 2) / 60; + nTaitoCyclesTotal[3] = (8000000 / 2) / 60; + + // Reset the driver + TaitoResetFunction = DariusDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 OpwolfInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = RbislandCharPlaneOffsets; + TaitoCharXOffsets = RbislandCharXOffsets; + TaitoCharYOffsets = RbislandCharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = RbislandSpritePlaneOffsets; + TaitoSpriteAXOffsets = RbislandSpriteXOffsets; + TaitoSpriteAYOffsets = RbislandSpriteYOffsets; + TaitoNumSpriteA = 0x1000; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoNumYM2151 = 1; + TaitoNumMSM5205 = 2; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + PC080SNInit(0, TaitoNumChar, 0, 8, 0, 0); + PC090OJInit(TaitoNumSpriteA, 0, 8, 0); + TC0140SYTInit(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x107fff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x200fff, SM_RAM); + SekMapMemory(PC080SNRam[0] , 0xc00000, 0xc0ffff, SM_RAM); + SekMapMemory(Taito68KRam1 + 0x8000 , 0xc10000, 0xc1ffff, SM_RAM); + SekMapMemory(PC090OJRam , 0xd00000, 0xd03fff, SM_RAM); + SekSetReadByteHandler(0, Opwolf68KReadByte); + SekSetWriteByteHandler(0, Opwolf68KWriteByte); + SekSetReadWordHandler(0, Opwolf68KReadWord); + SekSetWriteWordHandler(0, Opwolf68KWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(OpwolfZ80Read); + ZetSetWriteHandler(OpwolfZ80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2151Init(4000000); + BurnYM2151SetIrqHandler(&TaitoYM2151IRQHandler); + BurnYM2151SetPortHandler(&RbislandBankSwitch); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); + + MSM5205Init(0, TaitoSynchroniseStream, 384000, OpwolfMSM5205Vck0, MSM5205_S48_4B, 1); + MSM5205Init(1, TaitoSynchroniseStream, 384000, OpwolfMSM5205Vck1, MSM5205_S48_4B, 1); + MSM5205SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); + MSM5205SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + BurnGunInit(1, true); + + TaitoDrawFunction = OpwolfDraw; + TaitoMakeInputsFunction = OpwolfMakeInputs; + TaitoIrqLine = 5; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = 4000000 / 60; + + UINT16 *Rom = (UINT16*)Taito68KRom1; + OpWolfGunXOffset = 0xec - (Rom[0x03ffb0 / 2] & 0xff); + OpWolfGunYOffset = 0x1c - (Rom[0x03ffae / 2] & 0xff); + INT32 Region = Rom[0x03fffe / 2] & 0xff; + OpwolfCChipInit(Region); + + // Reset the driver + TaitoResetFunction = OpwolfDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 OpwolfbInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = OpwolfbCharPlaneOffsets; + TaitoCharXOffsets = OpwolfbCharXOffsets; + TaitoCharYOffsets = OpwolfbCharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = OpwolfbSpritePlaneOffsets; + TaitoSpriteAXOffsets = OpwolfbSpriteXOffsets; + TaitoSpriteAYOffsets = OpwolfbSpriteYOffsets; + TaitoNumSpriteA = 0x1000; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 2; + TaitoNumYM2151 = 1; + TaitoNumMSM5205 = 2; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + PC080SNInit(0, TaitoNumChar, 0, 8, 0, 0); + PC090OJInit(TaitoNumSpriteA, 0, 8, 0); + TC0140SYTInit(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x107fff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x200fff, SM_RAM); + SekMapMemory(PC080SNRam[0] , 0xc00000, 0xc0ffff, SM_RAM); + SekMapMemory(Taito68KRam1 + 0x8000 , 0xc10000, 0xc1ffff, SM_RAM); + SekMapMemory(PC090OJRam , 0xd00000, 0xd03fff, SM_RAM); + SekSetReadByteHandler(0, Opwolfb68KReadByte); + SekSetWriteByteHandler(0, Opwolfb68KWriteByte); + SekSetReadWordHandler(0, Opwolfb68KReadWord); + SekSetWriteWordHandler(0, Opwolfb68KWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(OpwolfZ80Read); + ZetSetWriteHandler(OpwolfZ80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetSetReadHandler(OpwolfbCChipSubZ80Read); + ZetSetWriteHandler(OpwolfbCChipSubZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom2 ); + ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom2 ); + ZetMapArea(0xc000, 0xc7ff, 0, TaitoZ80Ram2 ); + ZetMapArea(0xc000, 0xc7ff, 1, TaitoZ80Ram2 ); + ZetMapArea(0xc000, 0xc7ff, 2, TaitoZ80Ram2 ); + ZetClose(); + + BurnYM2151Init(4000000); + BurnYM2151SetIrqHandler(&TaitoYM2151IRQHandler); + BurnYM2151SetPortHandler(&RbislandBankSwitch); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT); + + MSM5205Init(0, TaitoSynchroniseStream, 384000, OpwolfMSM5205Vck0, MSM5205_S48_4B, 1); + MSM5205Init(1, TaitoSynchroniseStream, 384000, OpwolfMSM5205Vck1, MSM5205_S48_4B, 1); + MSM5205SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); + MSM5205SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + BurnGunInit(1, true); + + TaitoDrawFunction = OpwolfDraw; + TaitoMakeInputsFunction = OpwolfbMakeInputs; + TaitoIrqLine = 5; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = 4000000 / 60; + nTaitoCyclesTotal[2] = 4000000 / 60; + + OpWolfGunXOffset = -2; + OpWolfGunYOffset = 17; + + // Reset the driver + TaitoResetFunction = OpwolfDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 RbislandInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = RbislandCharPlaneOffsets; + TaitoCharXOffsets = RbislandCharXOffsets; + TaitoCharYOffsets = RbislandCharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = RbislandSpritePlaneOffsets; + TaitoSpriteAXOffsets = RbislandSpriteXOffsets; + TaitoSpriteAYOffsets = RbislandSpriteYOffsets; + TaitoNumSpriteA = 0x1400; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoNumYM2151 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + PC080SNInit(0, TaitoNumChar, 0, 16, 0, 0); + PC090OJInit(TaitoNumSpriteA, 0, 16, 0); + TC0140SYTInit(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x10c000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x200fff, SM_RAM); + SekMapMemory(Taito68KRam1 + 0x4000 , 0x201000, 0x203fff, SM_RAM); + SekMapMemory(PC080SNRam[0] , 0xc00000, 0xc0ffff, SM_RAM); + SekMapMemory(PC090OJRam , 0xd00000, 0xd03fff, SM_RAM); + SekSetReadByteHandler(0, Rbisland68KReadByte); + SekSetWriteByteHandler(0, Rbisland68KWriteByte); + SekSetReadWordHandler(0, Rbisland68KReadWord); + SekSetWriteWordHandler(0, Rbisland68KWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(RbislandZ80Read); + ZetSetWriteHandler(RbislandZ80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2151Init(16000000 / 4); + BurnYM2151SetIrqHandler(&TaitoYM2151IRQHandler); + BurnYM2151SetPortHandler(&RbislandBankSwitch); + BurnYM2151SetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + TaitoDrawFunction = RbislandDraw; + TaitoMakeInputsFunction = RbislandMakeInputs; + TaitoIrqLine = 4; + + nTaitoCyclesTotal[0] = (16000000 / 2) / 60; + nTaitoCyclesTotal[1] = (16000000 / 4) / 60; + + INT32 CChipVer = 0; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "rbislande")) CChipVer = 1; + RainbowCChipInit(CChipVer); + + // Reset the driver + TaitoResetFunction = RbislandDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 JumpingInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x40; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = JumpingCharPlaneOffsets; + TaitoCharXOffsets = JumpingCharXOffsets; + TaitoCharYOffsets = JumpingCharYOffsets; + TaitoNumChar = 16384; + + TaitoSpriteAModulo = 0x100; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = JumpingSpritePlaneOffsets; + TaitoSpriteAXOffsets = JumpingSpriteXOffsets; + TaitoSpriteAYOffsets = JumpingSpriteYOffsets; + TaitoSpriteAInvertRom = 1; + TaitoNumSpriteA = 5120; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoNumYM2203 = 2; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + PC080SNInit(0, TaitoNumChar, 0, 16, 1, 0); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x09ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x10c000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x200fff, SM_RAM); + SekMapMemory(Taito68KRam1 + 0x4000 , 0x201000, 0x203fff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x440000, 0x4407ff, SM_RAM); + SekMapMemory(PC080SNRam[0] , 0xc00000, 0xc0ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam + 0x800 , 0xd00000, 0xd01fff, SM_RAM); + SekSetReadByteHandler(0, Jumping68KReadByte); + SekSetWriteByteHandler(0, Jumping68KWriteByte); + SekSetReadWordHandler(0, Jumping68KReadWord); + SekSetWriteWordHandler(0, Jumping68KWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(JumpingZ80Read); + ZetSetWriteHandler(JumpingZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xffff, 0, TaitoZ80Rom1 + 0xc000 ); + ZetMapArea(0xc000, 0xffff, 2, TaitoZ80Rom1 + 0xc000 ); + ZetClose(); + + BurnYM2203Init(2, 3579545, NULL, TaitoSynchroniseStream, TaitoGetTime, 0); + BurnTimerAttachZet(4000000); + BurnYM2203SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); + BurnYM2203SetAllRoutes(1, 0.30, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + TaitoDrawFunction = JumpingDraw; + TaitoMakeInputsFunction = JumpingMakeInputs; + TaitoIrqLine = 4; + PC080SNSetFgTransparentPen(0, 0x0f); + + nTaitoCyclesTotal[0] = 8000000 / 60; + nTaitoCyclesTotal[1] = 4000000 / 60; + + // Reset the driver + TaitoResetFunction = TaitoDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 RastanInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x80; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = RastanCharPlaneOffsets; + TaitoCharXOffsets = RastanCharXOffsets; + TaitoCharYOffsets = RastanCharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = RastanSpritePlaneOffsets; + TaitoSpriteAXOffsets = RastanSpriteXOffsets; + TaitoSpriteAYOffsets = RastanSpriteYOffsets; + TaitoNumSpriteA = 0x1000; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoNumYM2151 = 1; + TaitoNumMSM5205 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + PC080SNInit(0, TaitoNumChar, 0, 8, 0, 0); + PC090OJInit(TaitoNumSpriteA, 0, 8, 0); + TC0140SYTInit(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x05ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x10c000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x200000, 0x200fff, SM_RAM); + SekMapMemory(PC080SNRam[0] , 0xc00000, 0xc0ffff, SM_RAM); + SekMapMemory(PC090OJRam , 0xd00000, 0xd03fff, SM_RAM); + SekSetReadByteHandler(0, Rastan68KReadByte); + SekSetWriteByteHandler(0, Rastan68KWriteByte); + SekSetWriteWordHandler(0, Rastan68KWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(RastanZ80Read); + ZetSetWriteHandler(RastanZ80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2151Init(16000000 / 4); + BurnYM2151SetIrqHandler(&TaitoYM2151IRQHandler); + BurnYM2151SetPortHandler(&RastanBankSwitch); + BurnYM2151SetAllRoutes(0.50, BURN_SND_ROUTE_BOTH); + + MSM5205Init(0, TaitoSynchroniseStream, 384000, RastanMSM5205Vck, MSM5205_S48_4B, 1); + MSM5205SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + TaitoDrawFunction = RastanDraw; + TaitoMakeInputsFunction = RastanMakeInputs; + TaitoIrqLine = 5; + + nTaitoCyclesTotal[0] = (16000000 / 2) / 60; + nTaitoCyclesTotal[1] = (16000000 / 4) / 60; + + // Reset the driver + TaitoResetFunction = RastanDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 TopspeedInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = TopspeedCharPlaneOffsets; + TaitoCharXOffsets = TopspeedCharXOffsets; + TaitoCharYOffsets = TopspeedCharYOffsets; + TaitoNumChar = 0x2000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 8; + TaitoSpriteAPlaneOffsets = TopspeedSpritePlaneOffsets; + TaitoSpriteAXOffsets = TopspeedSpriteXOffsets; + TaitoSpriteAYOffsets = TopspeedSpriteYOffsets; + TaitoNumSpriteA = 0x8000; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 1; + TaitoNumYM2151 = 1; + TaitoNumMSM5205 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + PC080SNInit(0, TaitoNumChar, 0, 8, 0, 0); + PC080SNInit(1, TaitoNumChar, 0, 8, 0, 0); + TC0140SYTInit(); + TC0220IOCInit(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x01ffff, SM_ROM); + SekMapMemory(Taito68KRom1 + 0x20000 , 0x080000, 0x0fffff, SM_ROM); + SekMapMemory(TaitoSharedRam , 0x400000, 0x40ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x500000, 0x503fff, SM_RAM); + SekMapMemory(Taito68KRam1 , 0x800000, 0x80ffff, SM_RAM); + SekMapMemory(PC080SNRam[0] , 0xa00000, 0xa0ffff, SM_RAM); + SekMapMemory(PC080SNRam[1] , 0xb00000, 0xb0ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0xd00000, 0xd00fff, SM_RAM); + SekMapMemory(TaitoVideoRam , 0xe00000, 0xe0ffff, SM_RAM); + SekSetReadByteHandler(0, Topspeed68K1ReadByte); + SekSetWriteByteHandler(0, Topspeed68K1WriteByte); + SekSetReadWordHandler(0, Topspeed68K1ReadWord); + SekSetWriteWordHandler(0, Topspeed68K1WriteWord); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x01ffff, SM_ROM); + SekMapMemory(TaitoSharedRam , 0x400000, 0x40ffff, SM_RAM); + SekSetReadByteHandler(0, Topspeed68K2ReadByte); + SekSetWriteByteHandler(0, Topspeed68K2WriteByte); + SekSetReadWordHandler(0, Topspeed68K2ReadWord); + SekSetWriteWordHandler(0, Topspeed68K2WriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(TopspeedZ80Read); + ZetSetWriteHandler(TopspeedZ80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x8000, 0x8fff, 0, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 1, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x8fff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2151Init(16000000 / 4); + BurnYM2151SetIrqHandler(&TaitoYM2151IRQHandler); + BurnYM2151SetPortHandler(&TopspeedBankSwitch); + BurnYM2151SetAllRoutes(0.30, BURN_SND_ROUTE_BOTH); + + MSM5205Init(0, TaitoSynchroniseStream, 384000, TopspeedMSM5205Vck, MSM5205_S48_4B, 1); + MSM5205SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + TaitoDrawFunction = TopspeedDraw; + TaitoMakeInputsFunction = TopspeedMakeInputs; + TaitoIrqLine = 5; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = 12000000 / 60; + nTaitoCyclesTotal[2] = 4000000 / 60; + + pTopspeedTempDraw = (UINT16*)BurnMalloc(512 * 512 * sizeof(UINT16)); + + // Reset the driver + TaitoResetFunction = TopspeedDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 VolfiedInit() +{ + INT32 nLen; + + TaitoNumChar = 0; + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = VolfiedSpritePlaneOffsets; + TaitoSpriteAXOffsets = VolfiedSpriteXOffsets; + TaitoSpriteAYOffsets = VolfiedSpriteYOffsets; + TaitoNumSpriteA = 0x1800; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + TaitoNumYM2203 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + PC090OJInit(TaitoNumSpriteA, 0, 8, 0); + PC090OJSetPaletteOffset(256); + TC0140SYTInit(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRom1 + 0x40000 , 0x080000, 0x0fffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(PC090OJRam , 0x200000, 0x203fff, SM_RAM); + SekMapMemory(TaitoVideoRam , 0x400000, 0x47ffff, SM_READ); + SekMapMemory(TaitoPaletteRam , 0x500000, 0x503fff, SM_RAM); + SekSetReadByteHandler(0, Volfied68KReadByte); + SekSetWriteByteHandler(0, Volfied68KWriteByte); + SekSetReadWordHandler(0, Volfied68KReadWord); + SekSetWriteWordHandler(0, Volfied68KWriteWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(VolfiedZ80Read); + ZetSetWriteHandler(VolfiedZ80Write); + ZetMapArea(0x0000, 0x7fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x7fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x8000, 0x87ff, 0, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x87ff, 1, TaitoZ80Ram1 ); + ZetMapArea(0x8000, 0x87ff, 2, TaitoZ80Ram1 ); + ZetClose(); + + BurnYM2203Init(1, 4000000, TaitoYM2203IRQHandler, TaitoSynchroniseStream, TaitoGetTime, 0); + BurnYM2203SetPorts(0, &VolfiedDip1Read, &VolfiedDip2Read, NULL, NULL); + BurnTimerAttachZet(4000000); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.60, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + TaitoDrawFunction = VolfiedDraw; + TaitoMakeInputsFunction = VolfiedMakeInputs; + TaitoIrqLine = 4; + + nTaitoCyclesTotal[0] = 8000000 / 60; + nTaitoCyclesTotal[1] = 4000000 / 60; + + VolfiedCChipInit(); + + // Reset the driver + TaitoResetFunction = VolfiedDoReset; + TaitoResetFunction(); + + return 0; +} + +static INT32 TaitoMiscExit() +{ + RastanADPCMPos = 0; + RastanADPCMData = 0; + memset(OpwolfADPCM_B, 0, 8); + memset(OpwolfADPCM_C, 0, 8); + OpwolfADPCMPos[0] = OpwolfADPCMPos[1] = 0; + OpwolfADPCMEnd[0] = OpwolfADPCMEnd[1] = 0; + OpwolfADPCMData[0] = OpwolfADPCMData[1] = 0; + + OpWolfGunXOffset = 0; + OpWolfGunYOffset = 0; + + DariusADPCMCommand = 0; + DariusNmiEnable = 0; + DariusCoinWord = 0; + + VolfiedVidCtrl = 0; + VolfiedVidMask = 0; + + BurnFree(pTopspeedTempDraw); + + return TaitoExit(); +} + +static inline UINT8 pal4bit(UINT8 bits) +{ + bits &= 0x0f; + return (bits << 4) | bits; +} + +static inline UINT8 pal5bit(UINT8 bits) +{ + bits &= 0x1f; + return (bits << 3) | (bits >> 2); +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); + g = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 5); + b = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 10); + + return BurnHighCol(r, g, b, 0); +} + +inline static UINT32 OpwolfCalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 8); + g = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 4); + b = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); + + return BurnHighCol(r, g, b, 0); +} + +inline static UINT32 JumpingCalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); + g = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 4); + b = pal4bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 8); + + return BurnHighCol(r, g, b, 0); +} + +static void TaitoMiscCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x2000; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } +} + +static void OpwolfCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x0800; i++, ps++, pd++) { + *pd = OpwolfCalcCol(*ps); + } +} + +static void JumpingCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x0800; i++, ps++, pd++) { + *pd = JumpingCalcCol(*ps); + } +} + +static void DariusDrawSprites(INT32 PriorityDraw) +{ + INT32 Offset, sx, sy; + UINT16 Code, Data; + UINT8 xFlip, yFlip, Colour, Priority; + + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + + for (Offset = 0xf000 / 2 - 4; Offset >= 0; Offset -= 4) + { + Code = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]) & 0x1fff; + + if (Code) { + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); + sy = (256 - Data) & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); + sx = Data & 0x3ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); + xFlip = ((Data & 0x4000) >> 14); + yFlip = ((Data & 0x8000) >> 15); + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); + Priority = (Data & 0x80) >> 7; + if (Priority != PriorityDraw) continue; + + Colour = (Data & 0x7f); + + if (sx > 900) sx -= 1024; + if (sy > 400) sy -= 512; + + sy -= 16; + + if (sx > 16 && sx < (nScreenWidth - 16) && sy > 16 && sy < (nScreenHeight - 16)) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } + } + } + } + } +} + +static void DariusDrawCharLayer() +{ + INT32 mx, my, Code, Attr, Colour, x, y, Flip, xFlip, yFlip, TileIndex = 0; + + UINT16 *VideoRam = (UINT16*)TaitoVideoRam; + + for (my = 0; my < 64; my++) { + for (mx = 0; mx < 128; mx++) { + Code = BURN_ENDIAN_SWAP_INT16(VideoRam[TileIndex + 0x2000]) & (TaitoNumCharB - 1); + Attr = BURN_ENDIAN_SWAP_INT16(VideoRam[TileIndex + 0x0000]); + + Colour = (Attr & 0xff) << 2; + Flip = (Attr & 0xc000) >> 14; + xFlip = (Flip >> 0) & 0x01; + yFlip = (Flip >> 1) & 0x01; + + x = 8 * mx; + y = 8 * my; + + if (x > 8 && x < (nScreenWidth - 8) && y > 8 && y < (nScreenHeight - 8)) { + if (xFlip) { + if (yFlip) { + Render8x8Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); + } else { + Render8x8Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); + } + } else { + if (yFlip) { + Render8x8Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); + } else { + Render8x8Tile_Mask(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); + } else { + Render8x8Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); + } + } else { + if (yFlip) { + Render8x8Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); + } else { + Render8x8Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 2, 0, 0, TaitoCharsB); + } + } + } + + TileIndex++; + } + } +} + +static void JumpingDrawSprites() +{ + INT32 SpriteColBank = (PC090OJSpriteCtrl & 0xe0) >> 1; + + for (INT32 Offs = 0x400 - 8; Offs >= 0; Offs -= 8) { + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + INT32 Tile = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offs]); + if (Tile < 5120) { + INT32 sx, sy, Colour, Data1, xFlip, yFlip; + + sy = ((BURN_ENDIAN_SWAP_INT16(SpriteRam[Offs + 1]) - 0xfff1) ^ 0xffff) & 0x1ff; + if (sy > 400) sy = sy - 512; + sx = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offs + 2]) - 0x38) & 0x1ff; + if (sx > 400) sx = sx - 512; + + Data1 = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offs + 3]); + Colour = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offs + 4]) & 0x0f) | SpriteColBank; + xFlip = Data1 & 0x40; + yFlip = Data1 & 0x80; + + sy += 1; + sy -= 16; + + if (sx > 16 && sx < (nScreenWidth - 16) && sy > 16 && sy < (nScreenHeight - 16)) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Tile, sx, sy, Colour, 4, 15, 0, TaitoSpritesA); + } + } + } + } + } +} + +static void RenderSpriteZoom(INT32 Code, INT32 sx, INT32 sy, INT32 Colour, INT32 xFlip, INT32 yFlip, INT32 xScale, INT32 yScale, UINT8* pSource) +{ + UINT8 *SourceBase = pSource + ((Code % TaitoNumSpriteA) * TaitoSpriteAWidth * TaitoSpriteAHeight); + + INT32 SpriteScreenHeight = (yScale * TaitoSpriteAHeight + 0x8000) >> 16; + INT32 SpriteScreenWidth = (xScale * TaitoSpriteAWidth + 0x8000) >> 16; + + Colour = 0x10 * (Colour % 0x100); + + if (TaitoFlipScreenX) { + xFlip = !xFlip; + sx = 320 - sx - (xScale >> 12); + } + + if (SpriteScreenWidth && SpriteScreenHeight) { + INT32 dx = (TaitoSpriteAWidth << 16) / SpriteScreenWidth; + INT32 dy = (TaitoSpriteAHeight << 16) / SpriteScreenHeight; + + INT32 ex = sx + SpriteScreenWidth; + INT32 ey = sy + SpriteScreenHeight; + + INT32 xIndexBase; + INT32 yIndex; + + if (xFlip) { + xIndexBase = (SpriteScreenWidth - 1) * dx; + dx = -dx; + } else { + xIndexBase = 0; + } + + if (yFlip) { + yIndex = (SpriteScreenHeight - 1) * dy; + dy = -dy; + } else { + yIndex = 0; + } + + if (sx < 0) { + INT32 Pixels = 0 - sx; + sx += Pixels; + xIndexBase += Pixels * dx; + } + + if (sy < 0) { + INT32 Pixels = 0 - sy; + sy += Pixels; + yIndex += Pixels * dy; + } + + if (ex > nScreenWidth) { + INT32 Pixels = ex - nScreenWidth; + ex -= Pixels; + } + + if (ey > nScreenHeight) { + INT32 Pixels = ey - nScreenHeight; + ey -= Pixels; + } + + if (ex > sx) { + INT32 y; + + for (y = sy; y < ey; y++) { + UINT8 *Source = SourceBase + ((yIndex >> 16) * TaitoSpriteAWidth); + UINT16* pPixel = pTransDraw + (y * nScreenWidth); + + INT32 x, xIndex = xIndexBase; + for (x = sx; x < ex; x++) { + INT32 c = Source[xIndex >> 16]; + if (c != 0) { + pPixel[x] = c | Colour; + } + xIndex += dx; + } + + yIndex += dy; + } + } + } +} + +static void TopspeedDrawSprites(INT32 PriorityDraw) +{ + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + INT32 Offset, MapOffset, x, y, xCur, yCur, SpriteChunk; + UINT16 *SpriteMap = (UINT16*)TaitoVideoRam; + UINT16 Data, TileNum, Code, Colour; + UINT8 xFlip, yFlip, Priority, BadChunks; + UINT8 j, k, px, py, zx, zy, xZoom, yZoom; + + for (Offset = (0x2c0 / 2) - 4; Offset >= 0; Offset -= 4) { + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); + + TileNum = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]) & 0xff; + Colour = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]) & 0xff00) >> 8; + xFlip = (Data & 0x4000) >> 14; + yFlip = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]) & 0x8000) >> 15; + x = Data & 0x1ff; + y = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]) & 0x1ff; + xZoom = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]) & 0x7f); + yZoom = (BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]) & 0xfe00) >> 9; + Priority = (Data & 0x8000) >> 15; + + if (Priority != PriorityDraw) continue; + + if (y == 0x180) continue; + + MapOffset = TileNum << 7; + + xZoom += 1; + yZoom += 1; + + y += 3 + (128 - yZoom); + + if (x > 0x140) x -= 0x200; + if (y > 0x140) y -= 0x200; + + BadChunks = 0; + + for (SpriteChunk = 0; SpriteChunk < 128; SpriteChunk++) { + k = SpriteChunk % 8; + j = SpriteChunk / 8; + + px = (xFlip) ? (7 - k) : (k); + py = (yFlip) ? (15 - j) : (j); + + Code = SpriteMap[MapOffset + (py << 3) + px]; + + if (Code & 0x8000) { + BadChunks += 1; + continue; + } + + xCur = x + ((k * xZoom) / 8); + yCur = y + ((j * yZoom) / 16); + + zx = x + (((k + 1) * xZoom) / 8) - xCur; + zy = y + (((j + 1) * yZoom) / 16) - yCur; + + RenderSpriteZoom(Code, xCur, yCur - 16, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); + } + } +} + +static void DariusDraw() +{ + BurnTransferClear(); + TaitoMiscCalcPalette(); + PC080SNDrawBgLayer(0, 1, TaitoChars, pTransDraw); + DariusDrawSprites(0); + PC080SNDrawFgLayer(0, 0, TaitoChars, pTransDraw); + DariusDrawSprites(1); + DariusDrawCharLayer(); + BurnTransferCopy(TaitoPalette); +} + +static void OpwolfDraw() +{ + BurnTransferClear(); + OpwolfCalcPalette(); + PC080SNDrawBgLayer(0, 1, TaitoChars, pTransDraw); + PC090OJDrawSprites(TaitoSpritesA); + PC080SNDrawFgLayer(0, 0, TaitoChars, pTransDraw); + BurnTransferCopy(TaitoPalette); + + for (INT32 i = 0; i < nBurnGunNumPlayers; i++) { + BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); + } +} + +static void RbislandDraw() +{ + BurnTransferClear(); + TaitoMiscCalcPalette(); + PC080SNDrawBgLayer(0, 1, TaitoChars, pTransDraw); + PC090OJDrawSprites(TaitoSpritesA); + PC080SNDrawFgLayer(0, 0, TaitoChars, pTransDraw); + BurnTransferCopy(TaitoPalette); +} + +static void JumpingDraw() +{ + BurnTransferClear(); + JumpingCalcPalette(); + PC080SNOverrideFgScroll(0, 16, 0); + PC080SNDrawBgLayer(0, 1, TaitoChars, pTransDraw); + JumpingDrawSprites(); + PC080SNDrawFgLayer(0, 0, TaitoChars, pTransDraw); + BurnTransferCopy(TaitoPalette); +} + +static void RastanDraw() +{ + BurnTransferClear(); + TaitoMiscCalcPalette(); + PC080SNDrawBgLayer(0, 1, TaitoChars, pTransDraw); + PC080SNDrawFgLayer(0, 0, TaitoChars, pTransDraw); + PC090OJDrawSprites(TaitoSpritesA); + BurnTransferCopy(TaitoPalette); +} + +static void TopspeedDraw() +{ + BurnTransferClear(); + TaitoMiscCalcPalette(); + PC080SNDrawFgLayer(1, 1, TaitoChars, pTransDraw); + TopspeedDrawSprites(1); + TopspeedDrawBgLayer(1, TaitoChars, pTopspeedTempDraw, (UINT16*)Taito68KRam1); + TopspeedDrawFgLayer(0, TaitoChars, pTopspeedTempDraw, (UINT16*)(Taito68KRam1 + 0x200)); + TopspeedDrawSprites(0); + PC080SNDrawBgLayer(0, 0, TaitoChars, pTransDraw); + BurnTransferCopy(TaitoPalette); +} + +static void VolfiedDraw() +{ + BurnTransferClear(); + TaitoMiscCalcPalette(); + + UINT16* p = (UINT16*)TaitoVideoRam; + if (VolfiedVidCtrl & 0x01) p += 0x20000; + for (INT32 y = 0; y < nScreenHeight + 8; y++) { + for (INT32 x = 1; x < nScreenWidth + 1; x++) { + INT32 Colour = (p[x] << 2) & 0x700; + + if (p[x] & 0x8000) { + Colour |= 0x800 | ((p[x] >> 9) & 0xf); + + if (p[x] & 0x2000) Colour &= ~0xf; + } else { + Colour |= p[x] & 0xf; + } + + if ((y - 8) >= 0 && (y - 8) < nScreenHeight) { + pTransDraw[((y - 8) * nScreenWidth) + x - 1] = Colour; + } + } + + p += 512; + } + + PC090OJDrawSprites(TaitoSpritesA); + BurnTransferCopy(TaitoPalette); +} + +static INT32 TaitoMiscFrame() +{ + INT32 nInterleave = 10; + if (TaitoNumMSM5205) nInterleave = MSM5205CalcInterleave(0, 8000000 / 2); + INT32 nSoundBufferPos = 0; + + if (TaitoReset) TaitoResetFunction(); + + TaitoMakeInputsFunction(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 # 1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == 9) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run Z80 + if (TaitoNumZ80s >= 1) { + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); + nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; + if (TaitoNumMSM5205) MSM5205Update(); + ZetClose(); + } + + if (TaitoNumZ80s == 2) { + nCurrentCPU = 2; + ZetOpen(1); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); + nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; + if (i == 9) ZetRaiseIrq(0); + ZetClose(); + } + + // Render sound segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (TaitoNumZ80s >= 1) ZetOpen(0); + if (TaitoNumYM2151) BurnYM2151Render(pSoundBuf, nSegmentLength); + if (TaitoNumZ80s >= 1) ZetClose(); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + if (TaitoNumZ80s >= 1) ZetOpen(0); + if (TaitoNumYM2151) BurnYM2151Render(pSoundBuf, nSegmentLength); + if (TaitoNumZ80s >= 1) ZetClose(); + } + } + + if (pBurnSoundOut) { + if (TaitoNumZ80s >= 1) ZetOpen(0); + if (TaitoNumMSM5205) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + if (TaitoNumMSM5205 >= 2) MSM5205Render(1, pBurnSoundOut, nBurnSoundLen); + if (TaitoNumZ80s >= 1) ZetClose(); + } + + if (pBurnDraw) TaitoDrawFunction(); + + return 0; +} + +static INT32 DariusFrame() +{ + INT32 nInterleave = MSM5205CalcInterleave(0, 8000000 / 2); + + if (TaitoReset) TaitoResetFunction(); + + TaitoMakeInputsFunction(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = nTaitoCyclesDone[3] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 # 1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run 68000 # 2 + if ((TaitoCpuACtrl & 0x01)) { + nCurrentCPU = 1; + SekOpen(1); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + } + + ZetOpen(0); + BurnTimerUpdate(i * (nTaitoCyclesTotal[2] / nInterleave)); + ZetClose(); + + nCurrentCPU = 3; + ZetOpen(1); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); + nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; + MSM5205Update(); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrame(nTaitoCyclesTotal[2]); + if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + ZetOpen(1); + ZetRun(nTaitoCyclesTotal[3] - nTaitoCyclesDone[3]); + if (pBurnSoundOut) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) TaitoDrawFunction(); + + return 0; +} + +static INT32 JumpingFrame() +{ + INT32 nInterleave = 100; + + if (TaitoReset) TaitoResetFunction(); + + TaitoMakeInputsFunction(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 # 1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run Z80 + ZetOpen(0); + BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrame(nTaitoCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + + if (pBurnDraw) TaitoDrawFunction(); + + return 0; +} + +static INT32 TopspeedFrame() +{ + INT32 nInterleave = 10; + if (TaitoNumMSM5205) nInterleave = MSM5205CalcInterleave(0, 4000000); + INT32 nSoundBufferPos = 0; + + if (TaitoReset) TaitoResetFunction(); + + TaitoMakeInputsFunction(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 # 1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == (nInterleave / 2) && (GetCurrentFrame > 0)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + if (i == (nInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run 68000 # 2 + if ((TaitoCpuACtrl & 0x01)) { + nCurrentCPU = 1; + SekOpen(1); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == (nInterleave / 2) && (GetCurrentFrame > 0)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + if (i == (nInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + } + + // Run Z80 + if (TaitoNumZ80s >= 1) { + nCurrentCPU = 2; + ZetOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); + nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; + if (TaitoNumMSM5205) MSM5205Update(); + ZetClose(); + } + + // Render sound segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (TaitoNumZ80s >= 1) ZetOpen(0); + if (TaitoNumYM2151) BurnYM2151Render(pSoundBuf, nSegmentLength); + if (TaitoNumZ80s >= 1) ZetClose(); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + if (TaitoNumZ80s >= 1) ZetOpen(0); + if (TaitoNumYM2151) BurnYM2151Render(pSoundBuf, nSegmentLength); + if (TaitoNumZ80s >= 1) ZetClose(); + } + } + + if (pBurnSoundOut) { + if (TaitoNumZ80s >= 1) ZetOpen(0); + if (TaitoNumMSM5205) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen); + if (TaitoNumZ80s >= 1) ZetClose(); + } + + if (pBurnDraw) TaitoDrawFunction(); + + return 0; +} + +static INT32 TaitoMiscScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029683; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = TaitoRamStart; + ba.nLen = TaitoRamEnd-TaitoRamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + TaitoICScan(nAction); + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + if (TaitoNumYM2151) BurnYM2151Scan(nAction); + if (TaitoNumYM2203) BurnYM2203Scan(nAction, pnMin); + if (TaitoNumMSM5205) MSM5205Scan(nAction, pnMin); + + BurnGunScan(); + + SCAN_VAR(TaitoInput); + SCAN_VAR(TaitoAnalogPort0); + SCAN_VAR(TaitoAnalogPort1); + SCAN_VAR(TaitoZ80Bank); + SCAN_VAR(TaitoSoundLatch); + SCAN_VAR(RastanADPCMPos); + SCAN_VAR(RastanADPCMData); + SCAN_VAR(OpwolfADPCM_B); + SCAN_VAR(OpwolfADPCM_C); + SCAN_VAR(OpwolfADPCMPos); + SCAN_VAR(OpwolfADPCMEnd);; + SCAN_VAR(OpwolfADPCMData); + SCAN_VAR(nTaitoCyclesDone); + SCAN_VAR(nTaitoCyclesSegment); + SCAN_VAR(DariusADPCMCommand); + SCAN_VAR(DariusNmiEnable); + SCAN_VAR(DariusCoinWord); + SCAN_VAR(PC090OJSpriteCtrl); // for jumping + } + + if (nAction & ACB_WRITE && TaitoZ80Bank) { + ZetOpen(0); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetClose(); + } + + return 0; +} + +struct BurnDriver BurnDrvDarius = { + "darius", NULL, NULL, NULL, "1986", + "Darius (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, + NULL, DariusRomInfo, DariusRomName, NULL, NULL, DariusInputInfo, DariusDIPInfo, + DariusInit, TaitoMiscExit, DariusFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 864, 224, 12, 3 +}; + +struct BurnDriver BurnDrvDariusj = { + "dariusj", "darius", NULL, NULL, "1986", + "Darius (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, + NULL, DariusjRomInfo, DariusjRomName, NULL, NULL, DariusInputInfo, DariusjDIPInfo, + DariusInit, TaitoMiscExit, DariusFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 864, 224, 12, 3 +}; + +struct BurnDriver BurnDrvDariuso = { + "dariuso", "darius", NULL, NULL, "1986", + "Darius (Japan old version)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, + NULL, DariusoRomInfo, DariusoRomName, NULL, NULL, DariusInputInfo, DariusjDIPInfo, + DariusInit, TaitoMiscExit, DariusFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 864, 224, 12, 3 +}; + +struct BurnDriver BurnDrvDariuse = { + "dariuse", "darius", NULL, NULL, "1986", + "Darius (Extra) (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0, + NULL, DariuseRomInfo, DariuseRomName, NULL, NULL, DariusInputInfo, DariuseDIPInfo, + DariusInit, TaitoMiscExit, DariusFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 864, 224, 12, 3 +}; + +struct BurnDriver BurnDrvOpwolf = { + "opwolf", NULL, NULL, NULL, "1987", + "Operation Wolf (World, set 1)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, OpwolfRomInfo, OpwolfRomName, NULL, NULL, OpwolfInputInfo, OpwolfDIPInfo, + OpwolfInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvOpwolfa = { + "opwolfa", "opwolf", NULL, NULL, "1987", + "Operation Wolf (World, set 2)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, OpwolfaRomInfo, OpwolfaRomName, NULL, NULL, OpwolfInputInfo, OpwolfDIPInfo, + OpwolfInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvOpwolfj = { + "opwolfj", "opwolf", NULL, NULL, "1987", + "Operation Wolf (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, OpwolfjRomInfo, OpwolfjRomName, NULL, NULL, OpwolfInputInfo, OpwolfDIPInfo, + OpwolfInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvOpwolfu = { + "opwolfu", "opwolf", NULL, NULL, "1987", + "Operation Wolf (US)\0", NULL, "Taito America Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, OpwolfuRomInfo, OpwolfuRomName, NULL, NULL, OpwolfInputInfo, OpwolfuDIPInfo, + OpwolfInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvOpwolfb = { + "opwolfb", "opwolf", NULL, NULL, "1987", + "Operation Bear\0", NULL, "bootleg", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0, + NULL, OpwolfbRomInfo, OpwolfbRomName, NULL, NULL, OpwolfInputInfo, OpwolfbDIPInfo, + OpwolfbInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvRbisland = { + "rbisland", NULL, NULL, NULL, "1987", + "Rainbow Islands (new version)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, RbislandRomInfo, RbislandRomName, NULL, NULL, RbislandInputInfo, RbislandDIPInfo, + RbislandInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvRbislando = { + "rbislando", "rbisland", NULL, NULL, "1987", + "Rainbow Islands (old version)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, RbislandoRomInfo, RbislandoRomName, NULL, NULL, RbislandInputInfo, RbislandDIPInfo, + RbislandInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvRbislande = { + "rbislande", "rbisland", NULL, NULL, "1988", + "Rainbow Islands (Extra)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, RbislandeRomInfo, RbislandeRomName, NULL, NULL, RbislandInputInfo, RbislandDIPInfo, + RbislandInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvJumping = { + "jumping", "rbisland", NULL, NULL, "1989", + "Jumping\0", NULL, "bootleg", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, JumpingRomInfo, JumpingRomName, NULL, NULL, JumpingInputInfo, JumpingDIPInfo, + JumpingInit, TaitoMiscExit, JumpingFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvRastan = { + "rastan", NULL, NULL, NULL, "1987", + "Rastan (World Rev 1)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, RastanRomInfo, RastanRomName, NULL, NULL, RastanInputInfo, RastanDIPInfo, + RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvRastana = { + "rastana", "rastan", NULL, NULL, "1987", + "Rastan (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, RastanaRomInfo, RastanaRomName, NULL, NULL, RastanInputInfo, RastanDIPInfo, + RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvRastanu = { + "rastanu", "rastan", NULL, NULL, "1987", + "Rastan (US Rev 1)\0", NULL, "Taito America Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, RastanuRomInfo, RastanuRomName, NULL, NULL, RastanInputInfo, RastsagaDIPInfo, + RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvRastanua = { + "rastanua", "rastan", NULL, NULL, "1987", + "Rastan (US)\0", NULL, "Taito America Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, RastanuaRomInfo, RastanuaRomName, NULL, NULL, RastanInputInfo, RastsagaDIPInfo, + RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvRastanub = { + "rastanub", "rastan", NULL, NULL, "1987", + "Rastan (US, Earlier code base)\0", NULL, "Taito America Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, RastanubRomInfo, RastanubRomName, NULL, NULL, RastanInputInfo, RastsagaDIPInfo, + RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvRastsaga = { + "rastsaga", "rastan", NULL, NULL, "1987", + "Rastan Saga (Japan Rev 1)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, RastsagaRomInfo, RastsagaRomName, NULL, NULL, RastanInputInfo, RastsagaDIPInfo, + RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvRastsagaa = { + "rastsagaa", "rastan", NULL, NULL, "1987", + "Rastan Saga (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, RastsagaaRomInfo, RastsagaaRomName, NULL, NULL, RastanInputInfo, RastsagaDIPInfo, + RastanInit, TaitoMiscExit, TaitoMiscFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvTopspeed = { + "topspeed", NULL, NULL, NULL, "1987", + "Top Speed (World)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0, + NULL, TopspeedRomInfo, TopspeedRomName, NULL, NULL, TopspeedInputInfo, TopspeedDIPInfo, + TopspeedInit, TaitoMiscExit, TopspeedFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvTopspeedu = { + "topspeedu", "topspeed", NULL, NULL, "1987", + "Top Speed (US)\0", NULL, "Taito America Corporation (Romstar license)", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0, + NULL, TopspeeduRomInfo, TopspeeduRomName, NULL, NULL, TopspeedInputInfo, FullthrlDIPInfo, + TopspeedInit, TaitoMiscExit, TopspeedFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvFullthrl = { + "fullthrl", "topspeed", NULL, NULL, "1987", + "Full Throttle (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0, + NULL, FullthrlRomInfo, FullthrlRomName, NULL, NULL, TopspeedInputInfo, FullthrlDIPInfo, + TopspeedInit, TaitoMiscExit, TopspeedFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvVolfied = { + "volfied", NULL, NULL, NULL, "1989", + "Volfied (World, revision 1)\0", NULL, "Taito Corporation Japan", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, + NULL, VolfiedRomInfo, VolfiedRomName, NULL, NULL, VolfiedInputInfo, VolfiedDIPInfo, + VolfiedInit, TaitoMiscExit, JumpingFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvVolfiedj = { + "volfiedj", "volfied", NULL, NULL, "1989", + "Volfied (Japan, revision 1)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, + NULL, VolfiedjRomInfo, VolfiedjRomName, NULL, NULL, VolfiedInputInfo, VolfiedjDIPInfo, + VolfiedInit, TaitoMiscExit, JumpingFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvVolfiedjo = { + "volfiedjo", "volfied", NULL, NULL, "1989", + "Volfied (Japan)\0", NULL, "Taito Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, + NULL, VolfiedjoRomInfo, VolfiedjoRomName, NULL, NULL, VolfiedInputInfo, VolfiedjDIPInfo, + VolfiedInit, TaitoMiscExit, JumpingFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvVolfiedu = { + "volfiedu", "volfied", NULL, NULL, "1989", + "Volfied (US, revision 1)\0", NULL, "Taito America Corporation", "Taito Misc", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_PUZZLE, 0, + NULL, VolfieduRomInfo, VolfieduRomName, NULL, NULL, VolfiedInputInfo, VolfieduDIPInfo, + VolfiedInit, TaitoMiscExit, JumpingFrame, NULL, TaitoMiscScan, + NULL, 0x2000, 240, 320, 3, 4 +}; diff --git a/src/burn/drv/taito/d_taitox.cpp b/src/burn/drv/taito/d_taitox.cpp index 1e2ebc877..bce05b82f 100644 --- a/src/burn/drv/taito/d_taitox.cpp +++ b/src/burn/drv/taito/d_taitox.cpp @@ -1,1734 +1,1733 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "taito.h" -#include "taito_ic.h" -#include "burn_ym2151.h" -#include "burn_ym2610.h" - -static struct BurnInputInfo SupermanInputList[]= -{ - {"P1 Coin" , BIT_DIGITAL, TaitoInputPort2 + 0, "p1 coin" }, - {"P1 Start" , BIT_DIGITAL, TaitoInputPort0 + 7, "p1 start" }, - {"P1 Up" , BIT_DIGITAL, TaitoInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL, TaitoInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL, TaitoInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL, TaitoInputPort0 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL, TaitoInputPort0 + 4, "p1 fire 1" }, - {"P1 Button 2" , BIT_DIGITAL, TaitoInputPort0 + 5, "p1 fire 2" }, - - {"P2 Coin" , BIT_DIGITAL, TaitoInputPort2 + 1, "p2 coin" }, - {"P2 Start" , BIT_DIGITAL, TaitoInputPort1 + 7, "p2 start" }, - {"P2 Up" , BIT_DIGITAL, TaitoInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL, TaitoInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL, TaitoInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL, TaitoInputPort1 + 3, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL, TaitoInputPort1 + 4, "p2 fire 1" }, - {"P2 Button 2" , BIT_DIGITAL, TaitoInputPort1 + 5, "p2 fire 2" }, - - {"Reset" , BIT_DIGITAL, &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL, TaitoInputPort2 + 2, "service" }, - {"Tilt" , BIT_DIGITAL, TaitoInputPort2 + 3, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Superman) - -static struct BurnInputInfo TwinhawkInputList[]= -{ - {"P1 Coin" , BIT_DIGITAL, TaitoInputPort2 + 0, "p1 coin" }, - {"P1 Start" , BIT_DIGITAL, TaitoInputPort0 + 7, "p1 start" }, - {"P1 Up" , BIT_DIGITAL, TaitoInputPort0 + 0, "p1 up" }, - {"P1 Down" , BIT_DIGITAL, TaitoInputPort0 + 1, "p1 down" }, - {"P1 Left" , BIT_DIGITAL, TaitoInputPort0 + 2, "p1 left" }, - {"P1 Right" , BIT_DIGITAL, TaitoInputPort0 + 3, "p1 right" }, - {"P1 Button 1" , BIT_DIGITAL, TaitoInputPort0 + 4, "p1 fire 1" }, - {"P1 Button 2" , BIT_DIGITAL, TaitoInputPort0 + 5, "p1 fire 2" }, - {"P1 Button 3" , BIT_DIGITAL, TaitoInputPort0 + 6, "p1 fire 3" }, - - {"P2 Coin" , BIT_DIGITAL, TaitoInputPort2 + 1, "p2 coin" }, - {"P2 Start" , BIT_DIGITAL, TaitoInputPort1 + 7, "p2 start" }, - {"P2 Up" , BIT_DIGITAL, TaitoInputPort1 + 0, "p2 up" }, - {"P2 Down" , BIT_DIGITAL, TaitoInputPort1 + 1, "p2 down" }, - {"P2 Left" , BIT_DIGITAL, TaitoInputPort1 + 2, "p2 left" }, - {"P2 Right" , BIT_DIGITAL, TaitoInputPort1 + 3, "p2 right" }, - {"P2 Button 1" , BIT_DIGITAL, TaitoInputPort1 + 4, "p2 fire 1" }, - {"P2 Button 2" , BIT_DIGITAL, TaitoInputPort1 + 5, "p2 fire 2" }, - {"P2 Button 3" , BIT_DIGITAL, TaitoInputPort1 + 6, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL, &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL, TaitoInputPort2 + 2, "service" }, - {"Tilt" , BIT_DIGITAL, TaitoInputPort2 + 3, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH, TaitoDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH, TaitoDip + 1 , "dip" }, -}; - -STDINPUTINFO(Twinhawk) - -static void TaitoXMakeInputs() -{ - TaitoInput[0] = TaitoInput[1] = TaitoInput[2] = 0xff; - - for (INT32 i = 0; i < 8; i++) { - TaitoInput[0] -= (TaitoInputPort0[i] & 1) << i; - TaitoInput[1] -= (TaitoInputPort1[i] & 1) << i; - TaitoInput[2] -= (TaitoInputPort2[i] & 1) << i; - - } -} - -static struct BurnDIPInfo BallbrosDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xdf, NULL }, - {0x16, 0xff, 0xff, 0x86, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x03, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0x0c, 0x04, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Medium" }, - {0x15, 0x01, 0x60, 0x20, "Hard" }, - {0x15, 0x01, 0x60, 0x00, "Hardest" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x16, 0x01, 0x02, 0x02, "Off" }, - {0x16, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x04, 0x00, "Off" }, - {0x16, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x16, 0x01, 0x20, 0x00, "English" }, - {0x16, 0x01, 0x20, 0x20, "Japanese" }, - - {0 , 0xfe, 0 , 2 , "Colour Change" }, - {0x16, 0x01, 0x40, 0x00, "Less" }, - {0x16, 0x01, 0x40, 0x40, "More" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Ballbros) - -static struct BurnDIPInfo GigandesDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xdf, NULL }, - {0x16, 0xff, 0xff, 0x98, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x03, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0x0c, 0x04, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Medium" }, - {0x15, 0x01, 0x60, 0x20, "Hard" }, - {0x15, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Debug Mode" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x16, 0x01, 0x02, 0x00, "Off" }, - {0x16, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x18, 0x18, "3" }, - {0x16, 0x01, 0x18, 0x10, "4" }, - {0x16, 0x01, 0x18, 0x08, "5" }, - {0x16, 0x01, 0x18, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Controls" }, - {0x16, 0x01, 0x20, 0x20, "Single" }, - {0x16, 0x01, 0x20, 0x00, "Dual" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x16, 0x01, 0x40, 0x00, "English" }, - {0x16, 0x01, 0x40, 0x40, "Japanese" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Gigandes) - -static struct BurnDIPInfo KyustrkrDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xdf, NULL }, - {0x16, 0xff, 0xff, 0x80, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x03, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0x0c, 0x04, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x15, 0x01, 0x60, 0x60, "Easy" }, - {0x15, 0x01, 0x60, 0x40, "Medium" }, - {0x15, 0x01, 0x60, 0x20, "Hard" }, - {0x15, 0x01, 0x60, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Debug Mode" }, - {0x15, 0x01, 0x80, 0x80, "Off" }, - {0x15, 0x01, 0x80, 0x00, "On" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x16, 0x01, 0x01, 0x01, "Off" }, - {0x16, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x16, 0x01, 0x02, 0x00, "Off" }, - {0x16, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x04, 0x04, "Off" }, - {0x16, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x18, 0x18, "3" }, - {0x16, 0x01, 0x18, 0x10, "4" }, - {0x16, 0x01, 0x18, 0x08, "5" }, - {0x16, 0x01, 0x18, 0x00, "6" }, - - {0 , 0xfe, 0 , 2 , "Controls" }, - {0x16, 0x01, 0x20, 0x20, "Single" }, - {0x16, 0x01, 0x20, 0x00, "Dual" }, - - {0 , 0xfe, 0 , 2 , "Language" }, - {0x16, 0x01, 0x40, 0x00, "English" }, - {0x16, 0x01, 0x40, 0x40, "Japanese" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Kyustrkr) - -static struct BurnDIPInfo SupermanDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x10, "4" }, - {0x14, 0x01, 0x30, 0x00, "5" }, -}; - -STDDIPINFO(Superman) - -static struct BurnDIPInfo SupermanuDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x13, 0x01, 0xc0, 0x00, "3 Coins 2 Credit" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 3 Credit" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "Same as Start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x10, "4" }, - {0x14, 0x01, 0x30, 0x00, "5" }, -}; - -STDDIPINFO(Supermanu) - -static struct BurnDIPInfo SupermanjDIPList[]= -{ - // Default Values - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x13, 0x01, 0x02, 0x02, "Off" }, - {0x13, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x13, 0x01, 0x04, 0x04, "Off" }, - {0x13, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x00, "Off" }, - {0x13, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x14, 0x01, 0x03, 0x02, "Easy" }, - {0x14, 0x01, 0x03, 0x03, "Medium" }, - {0x14, 0x01, 0x03, 0x01, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x30, "3" }, - {0x14, 0x01, 0x30, 0x10, "4" }, - {0x14, 0x01, 0x30, 0x00, "5" }, -}; - -STDDIPINFO(Supermanj) - - -static struct BurnDIPInfo TwinhawkDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x0c, "50k and every 150k" }, - {0x16, 0x01, 0x0c, 0x08, "70k and every 200k" }, - {0x16, 0x01, 0x0c, 0x04, "50k only" }, - {0x16, 0x01, 0x0c, 0x00, "100k only" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x00, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x10, "4" }, - {0x16, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Twinhawk) - -static struct BurnDIPInfo TwinhawkuDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xff, NULL }, - {0x16, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0x00, "4 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0x40, "3 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0x80, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x0c, "50k and every 150k" }, - {0x16, 0x01, 0x0c, 0x08, "70k and every 200k" }, - {0x16, 0x01, 0x0c, 0x04, "50k only" }, - {0x16, 0x01, 0x0c, 0x00, "100k only" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x00, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x10, "4" }, - {0x16, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Twinhawku) - -static struct BurnDIPInfo DaisenpuDIPList[]= -{ - // Default Values - {0x15, 0xff, 0xff, 0xfe, NULL }, - {0x16, 0xff, 0xff, 0x7f, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x15, 0x01, 0x01, 0x00, "Upright" }, - {0x15, 0x01, 0x01, 0x01, "Cocktail" }, - - {0 , 0xfe, 0 , 2 , "Flip Screen" }, - {0x15, 0x01, 0x02, 0x02, "Off" }, - {0x15, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x15, 0x01, 0x04, 0x04, "Off" }, - {0x15, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x00, "Off" }, - {0x15, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x15, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x15, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x16, 0x01, 0x03, 0x02, "Easy" }, - {0x16, 0x01, 0x03, 0x03, "Medium" }, - {0x16, 0x01, 0x03, 0x01, "Hard" }, - {0x16, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x08, "50k and every 150k" }, - {0x16, 0x01, 0x0c, 0x0c, "70k and every 200k" }, - {0x16, 0x01, 0x0c, 0x04, "100k only" }, - {0x16, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x16, 0x01, 0x30, 0x00, "2" }, - {0x16, 0x01, 0x30, 0x30, "3" }, - {0x16, 0x01, 0x30, 0x10, "4" }, - {0x16, 0x01, 0x30, 0x20, "5" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x16, 0x01, 0x80, 0x80, "Off" }, - {0x16, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Daisenpu) - -static struct BurnRomInfo BallbrosRomDesc[] = { - { "10a", 0x20000, 0x4af0e858, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "5a", 0x20000, 0x0b983a69, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "8d", 0x10000, 0xd1c515af, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "3", 0x20000, 0xec3e0537, BRF_GRA | TAITO_SPRITESA }, - { "2", 0x20000, 0xbb441717, BRF_GRA | TAITO_SPRITESA }, - { "1", 0x20000, 0x8196d624, BRF_GRA | TAITO_SPRITESA }, - { "0", 0x20000, 0x1cc584e5, BRF_GRA | TAITO_SPRITESA }, - - { "east-11", 0x80000, 0x92111f96, BRF_SND | TAITO_YM2610A }, - { "east-10", 0x80000, 0xca0ac419, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Ballbros) -STD_ROM_FN(Ballbros) - -static struct BurnRomInfo GigandesRomDesc[] = { - { "east_1.10a", 0x20000, 0xae74e4e5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "east_3.5a", 0x20000, 0x8bcf2116, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "east_2.8a", 0x20000, 0xdd94b4d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "east_4.3a", 0x20000, 0xa647310a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "east_5.17d", 0x10000, 0xb24ab5f4, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "east_8.3f", 0x80000, 0x75eece28, BRF_GRA | TAITO_SPRITESA }, - { "east_7.3h", 0x80000, 0xb179a76a, BRF_GRA | TAITO_SPRITESA }, - { "east_9.3j", 0x80000, 0x5c5e6898, BRF_GRA | TAITO_SPRITESA }, - { "east_6.3k", 0x80000, 0x52db30e9, BRF_GRA | TAITO_SPRITESA }, - - { "east-11.16f", 0x80000, 0x92111f96, BRF_SND | TAITO_YM2610A }, - { "east-10.16e", 0x80000, 0xca0ac419, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Gigandes) -STD_ROM_FN(Gigandes) - -static struct BurnRomInfo GigandesaRomDesc[] = { - { "east-1.10a", 0x20000, 0x290c50e0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "east-3.5a", 0x20000, 0x9cef82af, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "east_2.8a", 0x20000, 0xdd94b4d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "east_4.3a", 0x20000, 0xa647310a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "east_5.17d", 0x10000, 0xb24ab5f4, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "east_8.3f", 0x80000, 0x75eece28, BRF_GRA | TAITO_SPRITESA }, - { "east_7.3h", 0x80000, 0xb179a76a, BRF_GRA | TAITO_SPRITESA }, - { "east_9.3j", 0x80000, 0x5c5e6898, BRF_GRA | TAITO_SPRITESA }, - { "east_6.3k", 0x80000, 0x52db30e9, BRF_GRA | TAITO_SPRITESA }, - - { "east-11.16f", 0x80000, 0x92111f96, BRF_SND | TAITO_YM2610A }, - { "east-10.16e", 0x80000, 0xca0ac419, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Gigandesa) -STD_ROM_FN(Gigandesa) - -static struct BurnRomInfo KyustrkrRomDesc[] = { - { "pe.9a", 0x20000, 0x082b5f96, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "po.4a", 0x20000, 0x0100361e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "ic.18d", 0x10000, 0x92cfb788, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "m-8-3.u3", 0x20000, 0x1c4084e6, BRF_GRA | TAITO_SPRITESA }, - { "m-8-2.u4", 0x20000, 0xada21c4d, BRF_GRA | TAITO_SPRITESA }, - { "m-8-1.u5", 0x20000, 0x9d95aad6, BRF_GRA | TAITO_SPRITESA }, - { "m-8-0.u6", 0x20000, 0x0dfb6ed3, BRF_GRA | TAITO_SPRITESA }, - - { "m-8-5.u2", 0x20000, 0xd9d90e0a, BRF_SND | TAITO_YM2610A }, - { "m-8-4.u1", 0x20000, 0xd3f6047a, BRF_SND | TAITO_YM2610B }, -}; - -STD_ROM_PICK(Kyustrkr) -STD_ROM_FN(Kyustrkr) - -static struct BurnRomInfo SupermanRomDesc[] = { - { "b61_09.a10", 0x20000, 0x640f1d58, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b61_07.a5", 0x20000, 0xfddb9953, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b61_08.a8", 0x20000, 0x79fc028e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b61_13.a3", 0x20000, 0x9f446a44, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b61_10.d18", 0x10000, 0x6efe79e8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b61-14.f1", 0x80000, 0x89368c3e, BRF_GRA | TAITO_SPRITESA }, - { "b61-15.h1", 0x80000, 0x910cc4f9, BRF_GRA | TAITO_SPRITESA }, - { "b61-16.j1", 0x80000, 0x3622ed2f, BRF_GRA | TAITO_SPRITESA }, - { "b61-17.k1", 0x80000, 0xc34f27e0, BRF_GRA | TAITO_SPRITESA }, - - { "b61-01.e18", 0x80000, 0x3cf99786, BRF_SND | TAITO_YM2610B }, - - { "b61_11.m11", 0x10000, 0x00000000, BRF_ESS | BRF_PRG | BRF_NODUMP }, -}; - -STD_ROM_PICK(Superman) -STD_ROM_FN(Superman) - -static struct BurnRomInfo SupermanuRomDesc[] = { - { "b61_09.a10", 0x20000, 0x640f1d58, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b61_07.a5", 0x20000, 0xfddb9953, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b61_08.a8", 0x20000, 0x79fc028e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b61_12.a3", 0x20000, 0x064d3bfe, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b61_10.d18", 0x10000, 0x6efe79e8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b61-14.f1", 0x80000, 0x89368c3e, BRF_GRA | TAITO_SPRITESA }, - { "b61-15.h1", 0x80000, 0x910cc4f9, BRF_GRA | TAITO_SPRITESA }, - { "b61-16.j1", 0x80000, 0x3622ed2f, BRF_GRA | TAITO_SPRITESA }, - { "b61-17.k1", 0x80000, 0xc34f27e0, BRF_GRA | TAITO_SPRITESA }, - - { "b61-01.e18", 0x80000, 0x3cf99786, BRF_SND | TAITO_YM2610B }, - - { "b61_11.m11", 0x10000, 0x00000000, BRF_ESS | BRF_PRG | BRF_NODUMP }, -}; - -STD_ROM_PICK(Supermanu) -STD_ROM_FN(Supermanu) - -static struct BurnRomInfo SupermanjRomDesc[] = { - { "b61_09.a10", 0x20000, 0x640f1d58, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b61_07.a5", 0x20000, 0xfddb9953, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b61_08.a8", 0x20000, 0x79fc028e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b61-06.a3", 0x20000, 0x714a0b68, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b61_10.d18", 0x10000, 0x6efe79e8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b61-14.f1", 0x80000, 0x89368c3e, BRF_GRA | TAITO_SPRITESA }, - { "b61-15.h1", 0x80000, 0x910cc4f9, BRF_GRA | TAITO_SPRITESA }, - { "b61-16.j1", 0x80000, 0x3622ed2f, BRF_GRA | TAITO_SPRITESA }, - { "b61-17.k1", 0x80000, 0xc34f27e0, BRF_GRA | TAITO_SPRITESA }, - - { "b61-01.e18", 0x80000, 0x3cf99786, BRF_SND | TAITO_YM2610B }, - - { "b61_11.m11", 0x10000, 0x00000000, BRF_ESS | BRF_PRG | BRF_NODUMP }, -}; - -STD_ROM_PICK(Supermanj) -STD_ROM_FN(Supermanj) - -static struct BurnRomInfo TwinhawkRomDesc[] = { - { "b87-11.u7", 0x20000, 0xfc84a399, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b87-10.u5", 0x20000, 0x17181706, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b87-07.13e", 0x08000, 0xe2e0efa0, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b87-02.3h", 0x80000, 0x89ad43a0, BRF_GRA | TAITO_SPRITESA }, - { "b87-01.3f", 0x80000, 0x81e82ae1, BRF_GRA | TAITO_SPRITESA }, - { "b87-04.3k", 0x80000, 0x958434b6, BRF_GRA | TAITO_SPRITESA }, - { "b87-03.3j", 0x80000, 0xce155ae0, BRF_GRA | TAITO_SPRITESA }, - -}; - -STD_ROM_PICK(Twinhawk) -STD_ROM_FN(Twinhawk) - -static struct BurnRomInfo TwinhawkuRomDesc[] = { - { "b87-09.u7", 0x20000, 0x7e6267c7, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b87-08.u5", 0x20000, 0x31d9916f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b87-07.13e", 0x08000, 0xe2e0efa0, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b87-02.3h", 0x80000, 0x89ad43a0, BRF_GRA | TAITO_SPRITESA }, - { "b87-01.3f", 0x80000, 0x81e82ae1, BRF_GRA | TAITO_SPRITESA }, - { "b87-04.3k", 0x80000, 0x958434b6, BRF_GRA | TAITO_SPRITESA }, - { "b87-03.3j", 0x80000, 0xce155ae0, BRF_GRA | TAITO_SPRITESA }, - -}; - -STD_ROM_PICK(Twinhawku) -STD_ROM_FN(Twinhawku) - -static struct BurnRomInfo DaisenpuRomDesc[] = { - { "b87-06.u7", 0x20000, 0xcf236100, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b87-05.u5", 0x20000, 0x7f15edc7, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b87-07.13e", 0x08000, 0xe2e0efa0, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b87-02.3h", 0x80000, 0x89ad43a0, BRF_GRA | TAITO_SPRITESA }, - { "b87-01.3f", 0x80000, 0x81e82ae1, BRF_GRA | TAITO_SPRITESA }, - { "b87-04.3k", 0x80000, 0x958434b6, BRF_GRA | TAITO_SPRITESA }, - { "b87-03.3j", 0x80000, 0xce155ae0, BRF_GRA | TAITO_SPRITESA }, - -}; - -STD_ROM_PICK(Daisenpu) -STD_ROM_FN(Daisenpu) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += Taito68KRom1Size; - TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; - TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; - TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x004000; - TaitoZ80Ram1 = Next; Next += 0x002000; - TaitoPaletteRam = Next; Next += 0x001000; - TaitoSpriteRam = Next; Next += 0x000800; - TaitoSpriteRam2 = Next; Next += 0x004000; - - TaitoRamEnd = Next; - - TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; - TaitoPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); - - TaitoMemEnd = Next; - - return 0; -} - -UINT8 __fastcall TaitoX68KReadByte(UINT32 a) -{ - if (TaitoIC_SupermanCChipInUse) { - if (a >= 0x900000 && a <= 0x9007ff) { - return SupermanCChipRamRead((a - 0x900000) >> 1, TaitoInput[0], TaitoInput[1], TaitoInput[2]); - } - } - - switch (a) { - case 0x500001: { - return TaitoDip[0] & 0x0f; - } - - case 0x500003: { - return (TaitoDip[0] & 0xf0) >> 4; - } - - case 0x500005: { - return TaitoDip[1] & 0x0f; - } - - case 0x500007: { - return (TaitoDip[1] & 0xf0) >> 4; - } - - case 0x800003: { - return TC0140SYTCommRead(); - } - - case 0x900001: { - return TaitoInput[0]; - } - - case 0x900003: { - return TaitoInput[1]; - } - - case 0x900005: { - return TaitoInput[2]; - } - - case 0x900803: { - if (TaitoIC_SupermanCChipInUse) return SupermanCChipCtrlRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall TaitoX68KWriteByte(UINT32 a, UINT8 d) -{ - if (TaitoIC_SupermanCChipInUse) { - if (a >= 0x900000 && a <= 0x9007ff) { - SupermanCChipRamWrite((a - 0x900000) >> 1, d); - return; - } - } - - switch (a) { - case 0x300000: - case 0x300001: { - //??? - return; - } - - case 0x400000: - case 0x400001: { - //nop - return; - } - - case 0x600000: - case 0x600001: { - //nop - return; - } - - case 0x700000: - case 0x700001: { - //nop - return; - } - - case 0x800001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x800003: { - TC0140SYTCommWrite(d); - return; - } - - case 0x900009: { - // coin write - return; - } - - case 0x900803: { - if (TaitoIC_SupermanCChipInUse) { - SupermanCChipCtrlWrite(); - return; - } - } - - case 0x900c01: { - if (TaitoIC_SupermanCChipInUse) { - SupermanCChipBankWrite(d); - return; - } - } - - case 0xc00000: - case 0xc00001: { - //??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall TaitoX68KReadWord(UINT32 a) -{ - switch (a) { - case 0x500000: { - return TaitoDip[0] & 0x0f; - } - - case 0x500002: { - return (TaitoDip[0] & 0xf0) >> 4; - } - - case 0x500004: { - return TaitoDip[1] & 0x0f; - } - - case 0x500006: { - return (TaitoDip[1] & 0xf0) >> 4; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -UINT8 __fastcall TaitoXZ80Read(UINT16 a) -{ - switch (a) { - case 0xe000: { - return BurnYM2610Read(0); - } - - case 0xe001: { - return BurnYM2610Read(1); - } - - case 0xe002: { - return BurnYM2610Read(2); - } - - case 0xe201: { - return TC0140SYTSlaveCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall TaitoXZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe000: { - BurnYM2610Write(0, d); - return; - } - - case 0xe001: { - BurnYM2610Write(1, d); - return; - } - - case 0xe002: { - BurnYM2610Write(2, d); - return; - } - - case 0xe003: { - BurnYM2610Write(3, d); - return; - } - - case 0xe200: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xe201: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xe400: - case 0xe401: - case 0xe402: - case 0xe403: { - //nop - return; - } - - case 0xe600: { - //??? - return; - } - - case 0xee00: { - //nop - return; - } - - case 0xf000: { - //nop - return; - } - - case 0xf200: { - TaitoZ80Bank = (d - 1) & 3; - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -UINT8 __fastcall TwinhawkZ80Read(UINT16 a) -{ - switch (a) { - case 0xe001: { - return BurnYM2151ReadStatus(); - } - - case 0xe201: { - return TC0140SYTSlaveCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall TwinhawkZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe000: { - BurnYM2151SelectRegister(d); - return; - } - - case 0xe001: { - BurnYM2151WriteRegister(d); - return; - } - - case 0xe200: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xe201: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xf200: { - TaitoZ80Bank = (d - 1) & 3; - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static void TaitoXFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 TaitoXSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 4000000; -} - -static double TaitoXGetTime() -{ - return (double)ZetTotalCycles() / 4000000; -} - -static void TaitoXYM2151IRQHandler(INT32 Irq) -{ - if (Irq) { - ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 SpritePlaneOffsets[4] = { 0x800008, 0x800000, 8, 0 }; -static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; -static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 256, 272, 288, 304, 320, 336, 352, 368 }; -static INT32 BallbrosPlaneOffsets[4] = { 0x300000, 0x200000, 0x100000, 0 }; -static INT32 BallbrosXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; -static INT32 BallbrosYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; - -static INT32 TaitoXInit(INT32 nSoundType) -{ - INT32 nLen; - - TaitoNum68Ks = 1; - TaitoNumZ80s = 1; - if (nSoundType == 1) { - TaitoNumYM2151 = 1; - } else { - TaitoNumYM2610 = 1; - } - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - if (TaitoLoadRoms(1)) return 1; - - TC0140SYTInit(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, Taito68KRom1Size - 1, SM_ROM); - SekMapMemory(TaitoPaletteRam , 0xb00000, 0xb00fff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0xd00000, 0xd007ff, SM_RAM); - SekMapMemory(TaitoSpriteRam2 , 0xe00000, 0xe03fff, SM_RAM); - SekMapMemory(Taito68KRam1 , 0xf00000, 0xf03fff, SM_RAM); - SekSetReadByteHandler(0, TaitoX68KReadByte); - SekSetWriteByteHandler(0, TaitoX68KWriteByte); - SekSetReadWordHandler(0, TaitoX68KReadWord); - SekClose(); - - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - if (nSoundType == 1) { - ZetSetReadHandler(TwinhawkZ80Read); - ZetSetWriteHandler(TwinhawkZ80Write); - } else { - ZetSetReadHandler(TaitoXZ80Read); - ZetSetWriteHandler(TaitoXZ80Write); - } - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - if (nSoundType == 1) { - BurnYM2151Init(4000000); - BurnYM2151SetIrqHandler(&TaitoXYM2151IRQHandler); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT); - BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT); - } else { - if (nSoundType == 2) { - BurnYM2610Init(8000000, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, NULL, TaitoXSynchroniseStream, TaitoXGetTime, 0); - } else { - BurnYM2610Init(8000000, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, &TaitoXFMIRQHandler, TaitoXSynchroniseStream, TaitoXGetTime, 0); - } - BurnTimerAttachZet(4000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - } - - GenericTilesInit(); - - nTaitoCyclesTotal[0] = (8000000) / 60; - nTaitoCyclesTotal[1] = (4000000) / 60; - - if (nScreenHeight == 224) TaitoYOffset = 16; - if (nScreenHeight == 240) TaitoYOffset = 8; - TaitoIrqLine = 2; - - TaitoDoReset(); - - return 0; -} - -static INT32 BallbrosInit() -{ - TaitoSpriteAModulo = 0x100; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = BallbrosPlaneOffsets; - TaitoSpriteAXOffsets = BallbrosXOffsets; - TaitoSpriteAYOffsets = BallbrosYOffsets; - TaitoNumSpriteA = 0x1000; - - return TaitoXInit(2); -} - -static INT32 GigandesInit() -{ - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x4000; - - return TaitoXInit(2); -} - -static INT32 SupermanInit() -{ - INT32 nRet; - - SupermanCChipInit(); - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x4000; - - nRet = TaitoXInit(0); - - TaitoIrqLine = 6; - - return nRet; -} - -static INT32 TwinhawkInit() -{ - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x4000; - - return TaitoXInit(1); -} - -static INT32 TaitoXExit() -{ - return TaitoExit(); -} - -static inline UINT8 pal5bit(UINT8 bits) -{ - bits &= 0x1f; - return (bits << 3) | (bits >> 2); -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 10); - g = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 5); - b = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); - - return BurnHighCol(r, g, b, 0); -} - -static void TaitoXCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x0800; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } -} - -static void TaitoXDrawBgSprites() -{ - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - UINT16 *SpriteRam2 = (UINT16*)TaitoSpriteRam2; - - INT32 Offs, Col, x, y, Code, Colour, xFlip, yFlip, sx, sy, yOffs; - - INT32 Ctrl = BURN_ENDIAN_SWAP_INT16(SpriteRam[0x300]); - INT32 Ctrl2 = BURN_ENDIAN_SWAP_INT16(SpriteRam[0x301]); - - INT32 Flip = Ctrl & 0x40; - INT32 NumCol = Ctrl2 & 0x000f; - - UINT16 *src = SpriteRam2 + (((Ctrl2 ^ (~Ctrl2 << 1)) & 0x40) ? 0x1000 : 0 ); - - INT32 Upper = (BURN_ENDIAN_SWAP_INT16(SpriteRam[0x302]) & 0xff) + (BURN_ENDIAN_SWAP_INT16(SpriteRam[0x303]) & 0xff) * 256; - INT32 Col0; - switch (Ctrl & 0x0f) { - case 0x01: Col0 = 0x4; break; - case 0x06: Col0 = 0x8; break; - - default: Col0 = 0x0; - } - - yOffs = Flip ? 1 : -1; - - if (NumCol == 1) NumCol = 16; - - for (Col = 0; Col < NumCol; Col++) { - x = BURN_ENDIAN_SWAP_INT16(SpriteRam[(Col * 0x20 + 0x08 + 0x400) / 2]) & 0xff; - y = BURN_ENDIAN_SWAP_INT16(SpriteRam[(Col * 0x20 + 0x00 + 0x400) / 2]) & 0xff; - - for (Offs = 0; Offs < 0x20; Offs++) { - Code = BURN_ENDIAN_SWAP_INT16(src[((Col + Col0) & 0x0f) * 0x20 + Offs + 0x400]); - Colour = BURN_ENDIAN_SWAP_INT16(src[((Col + Col0) & 0x0f) * 0x20 + Offs + 0x600]); - - xFlip = Code & 0x8000; - yFlip = Code & 0x4000; - - sx = x + (Offs & 1) * 16; - sy = -(y + yOffs) + (Offs / 2) * 16; - - if (Upper & (1 << Col)) sx += 256; - - if (Flip) { - sy = 0xf0 - sy; - xFlip = !xFlip; - yFlip = !yFlip; - } - - Colour = (Colour >> (16 - 5)) % 0x100; - Code &= (TaitoNumSpriteA - 1); - - sx = ((sx + 16) & 0x1ff) - 16; - sy = ((sy + 8) & 0xff) - 8; - - sy -= TaitoYOffset; - - if (sx > 16 && sx < (nScreenWidth - 16) && sy > 16 && sy < (nScreenHeight - 16)) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } - } - } -} - -static void TaitoXDrawSprites() -{ - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - UINT16 *SpriteRam2 = (UINT16*)TaitoSpriteRam2; - - INT32 Offset, Code, x, y, xFlip, yFlip, Colour; - INT32 Ctrl = BURN_ENDIAN_SWAP_INT16(SpriteRam[0x300]); - INT32 Ctrl2 = BURN_ENDIAN_SWAP_INT16(SpriteRam[0x301]); - INT32 Flip = Ctrl & 0x40; - UINT16 *src = SpriteRam2 + (((Ctrl2 ^ (~Ctrl2 << 1)) & 0x40) ? 0x1000 : 0); - - for (Offset = (0x400 - 2) / 2; Offset >= 0; Offset-- ) { - Code = BURN_ENDIAN_SWAP_INT16(src[Offset]); - x = BURN_ENDIAN_SWAP_INT16(src[Offset + 0x200]); - y = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]) & 0xff; - xFlip = Code & 0x8000; - yFlip = Code & 0x4000; - - Colour = (x >> (16 - 5) ) % 0x100; - - Code &= (TaitoNumSpriteA - 1); - - if (Flip) { - y = 0xf0 - y; - xFlip = !xFlip; - yFlip = !yFlip; - } - - y = 0xf0 - y; - x = ((x + 16) & 0x1ff) - 16; - y = ((y + 8) & 0xff) - 8; - - y -= TaitoYOffset - 2; - - if (x > 16 && x < (nScreenWidth - 16) && y > 16 && y < (nScreenHeight - 16)) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } - } - -} - -static void TaitoXDraw() -{ - TaitoXCalcPalette(); - - for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { - pTransDraw[i] = 0x1f0; - } - - TaitoXDrawBgSprites(); - TaitoXDrawSprites(); - BurnTransferCopy(TaitoPalette); -} - -static INT32 TaitoXFrame() -{ - INT32 nInterleave = 10; - - if (TaitoReset) TaitoDoReset(); - - TaitoXMakeInputs(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - nCurrentCPU = 0; - SekOpen(nCurrentCPU); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == (nInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - - nCurrentCPU = 1; - ZetOpen(0); - BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); - ZetClose(); - } - - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[1]); - if (pBurnSoundOut) { - BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - } - ZetClose(); - - if (pBurnDraw) TaitoXDraw(); - - return 0; -} - -static INT32 TwinhawkFrame() -{ - INT32 nInterleave = 10; - INT32 nSoundBufferPos = 0; - - if (TaitoReset) TaitoDoReset(); - - TaitoXMakeInputs(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; - - SekNewFrame(); - ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == 9) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run Z80 - nCurrentCPU = 1; - ZetOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); - nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; - ZetClose(); - - // Render sound segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - nSoundBufferPos += nSegmentLength; - } - } - - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - ZetOpen(0); - BurnYM2151Render(pSoundBuf, nSegmentLength); - ZetClose(); - } - } - - if (pBurnDraw) TaitoXDraw(); - - return 0; -} - -static INT32 TaitoXScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029683; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = TaitoRamStart; - ba.nLen = TaitoRamEnd-TaitoRamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - TaitoICScan(nAction); - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - ZetScan(nAction); - - if (TaitoNumYM2610) BurnYM2610Scan(nAction, pnMin); - if (TaitoNumYM2151) BurnYM2151Scan(nAction); - - SCAN_VAR(TaitoInput); - SCAN_VAR(TaitoZ80Bank); - SCAN_VAR(TaitoSoundLatch); - SCAN_VAR(nTaitoCyclesDone); - SCAN_VAR(nTaitoCyclesSegment); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetClose(); - } - - return 0; -} - -struct BurnDriver BurnDrvBallbros = { - "ballbros", NULL, NULL, NULL, "1992", - "Balloon Brothers\0", NULL, "East Technology", "Taito-X", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOX, GBF_PUZZLE, 0, - NULL, BallbrosRomInfo, BallbrosRomName, NULL, NULL, TwinhawkInputInfo, BallbrosDIPInfo, - BallbrosInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGigandes = { - "gigandes", NULL, NULL, NULL, "1989", - "Gigandes\0", NULL, "East Technology", "Taito-X", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOX, GBF_HORSHOOT, 0, - NULL, GigandesRomInfo, GigandesRomName, NULL, NULL, TwinhawkInputInfo, GigandesDIPInfo, - GigandesInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGigandesa = { - "gigandesa", "gigandes", NULL, NULL, "1989", - "Gigandes (earlier)\0", NULL, "East Technology", "Taito-X", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOX, GBF_HORSHOOT, 0, - NULL, GigandesaRomInfo, GigandesaRomName, NULL, NULL, TwinhawkInputInfo, GigandesDIPInfo, - GigandesInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvKyustrkr = { - "kyustrkr", NULL, NULL, NULL, "1989", - "Last Striker / Kyuukyoku no Striker\0", NULL, "East Technology", "Taito-X", - L"Last Striker\0Final \u7A76\u6975 \u306E Striker\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_TAITOX, GBF_SPORTSFOOTBALL, 0, - NULL, KyustrkrRomInfo, KyustrkrRomName, NULL, NULL, TwinhawkInputInfo, KyustrkrDIPInfo, - BallbrosInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSuperman = { - "superman", NULL, NULL, NULL, "1988", - "Superman (World)\0", NULL, "Taito Corporation", "Taito-X", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOX, GBF_SCRFIGHT, 0, - NULL, SupermanRomInfo, SupermanRomName, NULL, NULL, SupermanInputInfo, SupermanDIPInfo, - SupermanInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSupermanu = { - "supermanu", "superman", NULL, NULL, "1988", - "Superman (US)\0", NULL, "Taito Corporation", "Taito-X", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOX, GBF_SCRFIGHT, 0, - NULL, SupermanuRomInfo, SupermanuRomName, NULL, NULL, SupermanInputInfo, SupermanuDIPInfo, - SupermanInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSupermanj = { - "supermanj", "superman", NULL, NULL, "1988", - "Superman (Japan)\0", NULL, "Taito Corporation", "Taito-X", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOX, GBF_SCRFIGHT, 0, - NULL, SupermanjRomInfo, SupermanjRomName, NULL, NULL, SupermanInputInfo, SupermanjDIPInfo, - SupermanInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, - NULL, 0x800, 384, 240, 4, 3 -}; - -struct BurnDriver BurnDrvTwinhawk = { - "twinhawk", NULL, NULL, NULL, "1989", - "Twin Hawk (World)\0", NULL, "Taito Corporation Japan", "Taito-X", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOX, GBF_VERSHOOT, 0, - NULL, TwinhawkRomInfo, TwinhawkRomName, NULL, NULL, TwinhawkInputInfo, TwinhawkDIPInfo, - TwinhawkInit, TaitoXExit, TwinhawkFrame, NULL, TaitoXScan, - NULL, 0x800, 224, 384, 3, 4 -}; - -struct BurnDriver BurnDrvTwinhawku = { - "twinhawku", "twinhawk", NULL, NULL, "1989", - "Twin Hawk (US)\0", NULL, "Taito America Corporation", "Taito-X", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOX, GBF_VERSHOOT, 0, - NULL, TwinhawkuRomInfo, TwinhawkuRomName, NULL, NULL, TwinhawkInputInfo, TwinhawkuDIPInfo, - TwinhawkInit, TaitoXExit, TwinhawkFrame, NULL, TaitoXScan, - NULL, 0x800, 224, 384, 3, 4 -}; - -struct BurnDriver BurnDrvDaisenpu = { - "daisenpu", "twinhawk", NULL, NULL, "1989", - "Daisenpu (Japan)\0", NULL, "Taito Corporation", "Taito-X", - L"\u5927\u65CB\u98A8 (Japan)\0Daisenpu\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOX, GBF_VERSHOOT, 0, - NULL, DaisenpuRomInfo, DaisenpuRomName, NULL, NULL, TwinhawkInputInfo, DaisenpuDIPInfo, - TwinhawkInit, TaitoXExit, TwinhawkFrame, NULL, TaitoXScan, - NULL, 0x800, 224, 384, 3, 4 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "taito.h" +#include "taito_ic.h" +#include "burn_ym2151.h" +#include "burn_ym2610.h" + +static struct BurnInputInfo SupermanInputList[]= +{ + {"P1 Coin" , BIT_DIGITAL, TaitoInputPort2 + 0, "p1 coin" }, + {"P1 Start" , BIT_DIGITAL, TaitoInputPort0 + 7, "p1 start" }, + {"P1 Up" , BIT_DIGITAL, TaitoInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL, TaitoInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL, TaitoInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL, TaitoInputPort0 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL, TaitoInputPort0 + 4, "p1 fire 1" }, + {"P1 Button 2" , BIT_DIGITAL, TaitoInputPort0 + 5, "p1 fire 2" }, + + {"P2 Coin" , BIT_DIGITAL, TaitoInputPort2 + 1, "p2 coin" }, + {"P2 Start" , BIT_DIGITAL, TaitoInputPort1 + 7, "p2 start" }, + {"P2 Up" , BIT_DIGITAL, TaitoInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL, TaitoInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL, TaitoInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL, TaitoInputPort1 + 3, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL, TaitoInputPort1 + 4, "p2 fire 1" }, + {"P2 Button 2" , BIT_DIGITAL, TaitoInputPort1 + 5, "p2 fire 2" }, + + {"Reset" , BIT_DIGITAL, &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL, TaitoInputPort2 + 2, "service" }, + {"Tilt" , BIT_DIGITAL, TaitoInputPort2 + 3, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Superman) + +static struct BurnInputInfo TwinhawkInputList[]= +{ + {"P1 Coin" , BIT_DIGITAL, TaitoInputPort2 + 0, "p1 coin" }, + {"P1 Start" , BIT_DIGITAL, TaitoInputPort0 + 7, "p1 start" }, + {"P1 Up" , BIT_DIGITAL, TaitoInputPort0 + 0, "p1 up" }, + {"P1 Down" , BIT_DIGITAL, TaitoInputPort0 + 1, "p1 down" }, + {"P1 Left" , BIT_DIGITAL, TaitoInputPort0 + 2, "p1 left" }, + {"P1 Right" , BIT_DIGITAL, TaitoInputPort0 + 3, "p1 right" }, + {"P1 Button 1" , BIT_DIGITAL, TaitoInputPort0 + 4, "p1 fire 1" }, + {"P1 Button 2" , BIT_DIGITAL, TaitoInputPort0 + 5, "p1 fire 2" }, + {"P1 Button 3" , BIT_DIGITAL, TaitoInputPort0 + 6, "p1 fire 3" }, + + {"P2 Coin" , BIT_DIGITAL, TaitoInputPort2 + 1, "p2 coin" }, + {"P2 Start" , BIT_DIGITAL, TaitoInputPort1 + 7, "p2 start" }, + {"P2 Up" , BIT_DIGITAL, TaitoInputPort1 + 0, "p2 up" }, + {"P2 Down" , BIT_DIGITAL, TaitoInputPort1 + 1, "p2 down" }, + {"P2 Left" , BIT_DIGITAL, TaitoInputPort1 + 2, "p2 left" }, + {"P2 Right" , BIT_DIGITAL, TaitoInputPort1 + 3, "p2 right" }, + {"P2 Button 1" , BIT_DIGITAL, TaitoInputPort1 + 4, "p2 fire 1" }, + {"P2 Button 2" , BIT_DIGITAL, TaitoInputPort1 + 5, "p2 fire 2" }, + {"P2 Button 3" , BIT_DIGITAL, TaitoInputPort1 + 6, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL, &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL, TaitoInputPort2 + 2, "service" }, + {"Tilt" , BIT_DIGITAL, TaitoInputPort2 + 3, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH, TaitoDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH, TaitoDip + 1 , "dip" }, +}; + +STDINPUTINFO(Twinhawk) + +static void TaitoXMakeInputs() +{ + TaitoInput[0] = TaitoInput[1] = TaitoInput[2] = 0xff; + + for (INT32 i = 0; i < 8; i++) { + TaitoInput[0] -= (TaitoInputPort0[i] & 1) << i; + TaitoInput[1] -= (TaitoInputPort1[i] & 1) << i; + TaitoInput[2] -= (TaitoInputPort2[i] & 1) << i; + + } +} + +static struct BurnDIPInfo BallbrosDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xdf, NULL }, + {0x16, 0xff, 0xff, 0x86, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x03, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0x0c, 0x04, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Medium" }, + {0x15, 0x01, 0x60, 0x20, "Hard" }, + {0x15, 0x01, 0x60, 0x00, "Hardest" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x16, 0x01, 0x02, 0x02, "Off" }, + {0x16, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x04, 0x00, "Off" }, + {0x16, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x16, 0x01, 0x20, 0x00, "English" }, + {0x16, 0x01, 0x20, 0x20, "Japanese" }, + + {0 , 0xfe, 0 , 2 , "Colour Change" }, + {0x16, 0x01, 0x40, 0x00, "Less" }, + {0x16, 0x01, 0x40, 0x40, "More" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Ballbros) + +static struct BurnDIPInfo GigandesDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xdf, NULL }, + {0x16, 0xff, 0xff, 0x98, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x03, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0x0c, 0x04, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Medium" }, + {0x15, 0x01, 0x60, 0x20, "Hard" }, + {0x15, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Debug Mode" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x16, 0x01, 0x02, 0x00, "Off" }, + {0x16, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x18, 0x18, "3" }, + {0x16, 0x01, 0x18, 0x10, "4" }, + {0x16, 0x01, 0x18, 0x08, "5" }, + {0x16, 0x01, 0x18, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Controls" }, + {0x16, 0x01, 0x20, 0x20, "Single" }, + {0x16, 0x01, 0x20, 0x00, "Dual" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x16, 0x01, 0x40, 0x00, "English" }, + {0x16, 0x01, 0x40, 0x40, "Japanese" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Gigandes) + +static struct BurnDIPInfo KyustrkrDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xdf, NULL }, + {0x16, 0xff, 0xff, 0x80, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x03, 0x01, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x03, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x03, 0x02, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0x0c, 0x04, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x0c, 0x08, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x15, 0x01, 0x60, 0x60, "Easy" }, + {0x15, 0x01, 0x60, 0x40, "Medium" }, + {0x15, 0x01, 0x60, 0x20, "Hard" }, + {0x15, 0x01, 0x60, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Debug Mode" }, + {0x15, 0x01, 0x80, 0x80, "Off" }, + {0x15, 0x01, 0x80, 0x00, "On" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x16, 0x01, 0x01, 0x01, "Off" }, + {0x16, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x16, 0x01, 0x02, 0x00, "Off" }, + {0x16, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x04, 0x04, "Off" }, + {0x16, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x18, 0x18, "3" }, + {0x16, 0x01, 0x18, 0x10, "4" }, + {0x16, 0x01, 0x18, 0x08, "5" }, + {0x16, 0x01, 0x18, 0x00, "6" }, + + {0 , 0xfe, 0 , 2 , "Controls" }, + {0x16, 0x01, 0x20, 0x20, "Single" }, + {0x16, 0x01, 0x20, 0x00, "Dual" }, + + {0 , 0xfe, 0 , 2 , "Language" }, + {0x16, 0x01, 0x40, 0x00, "English" }, + {0x16, 0x01, 0x40, 0x40, "Japanese" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Kyustrkr) + +static struct BurnDIPInfo SupermanDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x10, "4" }, + {0x14, 0x01, 0x30, 0x00, "5" }, +}; + +STDDIPINFO(Superman) + +static struct BurnDIPInfo SupermanuDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x13, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x13, 0x01, 0xc0, 0x00, "3 Coins 2 Credit" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 3 Credit" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "Same as Start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x10, "4" }, + {0x14, 0x01, 0x30, 0x00, "5" }, +}; + +STDDIPINFO(Supermanu) + +static struct BurnDIPInfo SupermanjDIPList[]= +{ + // Default Values + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x13, 0x01, 0x02, 0x02, "Off" }, + {0x13, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x13, 0x01, 0x04, 0x04, "Off" }, + {0x13, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x00, "Off" }, + {0x13, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x13, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x13, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x13, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x13, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x14, 0x01, 0x03, 0x02, "Easy" }, + {0x14, 0x01, 0x03, 0x03, "Medium" }, + {0x14, 0x01, 0x03, 0x01, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x30, "3" }, + {0x14, 0x01, 0x30, 0x10, "4" }, + {0x14, 0x01, 0x30, 0x00, "5" }, +}; + +STDDIPINFO(Supermanj) + + +static struct BurnDIPInfo TwinhawkDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x0c, "50k and every 150k" }, + {0x16, 0x01, 0x0c, 0x08, "70k and every 200k" }, + {0x16, 0x01, 0x0c, 0x04, "50k only" }, + {0x16, 0x01, 0x0c, 0x00, "100k only" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x00, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x10, "4" }, + {0x16, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Twinhawk) + +static struct BurnDIPInfo TwinhawkuDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xff, NULL }, + {0x16, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0x00, "4 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0x40, "3 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0x80, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x0c, "50k and every 150k" }, + {0x16, 0x01, 0x0c, 0x08, "70k and every 200k" }, + {0x16, 0x01, 0x0c, 0x04, "50k only" }, + {0x16, 0x01, 0x0c, 0x00, "100k only" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x00, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x10, "4" }, + {0x16, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Twinhawku) + +static struct BurnDIPInfo DaisenpuDIPList[]= +{ + // Default Values + {0x15, 0xff, 0xff, 0xfe, NULL }, + {0x16, 0xff, 0xff, 0x7f, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x15, 0x01, 0x01, 0x00, "Upright" }, + {0x15, 0x01, 0x01, 0x01, "Cocktail" }, + + {0 , 0xfe, 0 , 2 , "Flip Screen" }, + {0x15, 0x01, 0x02, 0x02, "Off" }, + {0x15, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x15, 0x01, 0x04, 0x04, "Off" }, + {0x15, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x00, "Off" }, + {0x15, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x15, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x15, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x15, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x15, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x16, 0x01, 0x03, 0x02, "Easy" }, + {0x16, 0x01, 0x03, 0x03, "Medium" }, + {0x16, 0x01, 0x03, 0x01, "Hard" }, + {0x16, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x08, "50k and every 150k" }, + {0x16, 0x01, 0x0c, 0x0c, "70k and every 200k" }, + {0x16, 0x01, 0x0c, 0x04, "100k only" }, + {0x16, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x16, 0x01, 0x30, 0x00, "2" }, + {0x16, 0x01, 0x30, 0x30, "3" }, + {0x16, 0x01, 0x30, 0x10, "4" }, + {0x16, 0x01, 0x30, 0x20, "5" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x16, 0x01, 0x80, 0x80, "Off" }, + {0x16, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Daisenpu) + +static struct BurnRomInfo BallbrosRomDesc[] = { + { "10a", 0x20000, 0x4af0e858, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "5a", 0x20000, 0x0b983a69, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "8d", 0x10000, 0xd1c515af, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "3", 0x20000, 0xec3e0537, BRF_GRA | TAITO_SPRITESA }, + { "2", 0x20000, 0xbb441717, BRF_GRA | TAITO_SPRITESA }, + { "1", 0x20000, 0x8196d624, BRF_GRA | TAITO_SPRITESA }, + { "0", 0x20000, 0x1cc584e5, BRF_GRA | TAITO_SPRITESA }, + + { "east-11", 0x80000, 0x92111f96, BRF_SND | TAITO_YM2610A }, + { "east-10", 0x80000, 0xca0ac419, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Ballbros) +STD_ROM_FN(Ballbros) + +static struct BurnRomInfo GigandesRomDesc[] = { + { "east_1.10a", 0x20000, 0xae74e4e5, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "east_3.5a", 0x20000, 0x8bcf2116, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "east_2.8a", 0x20000, 0xdd94b4d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "east_4.3a", 0x20000, 0xa647310a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "east_5.17d", 0x10000, 0xb24ab5f4, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "east_8.3f", 0x80000, 0x75eece28, BRF_GRA | TAITO_SPRITESA }, + { "east_7.3h", 0x80000, 0xb179a76a, BRF_GRA | TAITO_SPRITESA }, + { "east_9.3j", 0x80000, 0x5c5e6898, BRF_GRA | TAITO_SPRITESA }, + { "east_6.3k", 0x80000, 0x52db30e9, BRF_GRA | TAITO_SPRITESA }, + + { "east-11.16f", 0x80000, 0x92111f96, BRF_SND | TAITO_YM2610A }, + { "east-10.16e", 0x80000, 0xca0ac419, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Gigandes) +STD_ROM_FN(Gigandes) + +static struct BurnRomInfo GigandesaRomDesc[] = { + { "east-1.10a", 0x20000, 0x290c50e0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "east-3.5a", 0x20000, 0x9cef82af, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "east_2.8a", 0x20000, 0xdd94b4d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "east_4.3a", 0x20000, 0xa647310a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "east_5.17d", 0x10000, 0xb24ab5f4, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "east_8.3f", 0x80000, 0x75eece28, BRF_GRA | TAITO_SPRITESA }, + { "east_7.3h", 0x80000, 0xb179a76a, BRF_GRA | TAITO_SPRITESA }, + { "east_9.3j", 0x80000, 0x5c5e6898, BRF_GRA | TAITO_SPRITESA }, + { "east_6.3k", 0x80000, 0x52db30e9, BRF_GRA | TAITO_SPRITESA }, + + { "east-11.16f", 0x80000, 0x92111f96, BRF_SND | TAITO_YM2610A }, + { "east-10.16e", 0x80000, 0xca0ac419, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Gigandesa) +STD_ROM_FN(Gigandesa) + +static struct BurnRomInfo KyustrkrRomDesc[] = { + { "pe.9a", 0x20000, 0x082b5f96, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "po.4a", 0x20000, 0x0100361e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "ic.18d", 0x10000, 0x92cfb788, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "m-8-3.u3", 0x20000, 0x1c4084e6, BRF_GRA | TAITO_SPRITESA }, + { "m-8-2.u4", 0x20000, 0xada21c4d, BRF_GRA | TAITO_SPRITESA }, + { "m-8-1.u5", 0x20000, 0x9d95aad6, BRF_GRA | TAITO_SPRITESA }, + { "m-8-0.u6", 0x20000, 0x0dfb6ed3, BRF_GRA | TAITO_SPRITESA }, + + { "m-8-5.u2", 0x20000, 0xd9d90e0a, BRF_SND | TAITO_YM2610A }, + { "m-8-4.u1", 0x20000, 0xd3f6047a, BRF_SND | TAITO_YM2610B }, +}; + +STD_ROM_PICK(Kyustrkr) +STD_ROM_FN(Kyustrkr) + +static struct BurnRomInfo SupermanRomDesc[] = { + { "b61_09.a10", 0x20000, 0x640f1d58, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b61_07.a5", 0x20000, 0xfddb9953, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b61_08.a8", 0x20000, 0x79fc028e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b61_13.a3", 0x20000, 0x9f446a44, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b61_10.d18", 0x10000, 0x6efe79e8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b61-14.f1", 0x80000, 0x89368c3e, BRF_GRA | TAITO_SPRITESA }, + { "b61-15.h1", 0x80000, 0x910cc4f9, BRF_GRA | TAITO_SPRITESA }, + { "b61-16.j1", 0x80000, 0x3622ed2f, BRF_GRA | TAITO_SPRITESA }, + { "b61-17.k1", 0x80000, 0xc34f27e0, BRF_GRA | TAITO_SPRITESA }, + + { "b61-01.e18", 0x80000, 0x3cf99786, BRF_SND | TAITO_YM2610B }, + + { "b61_11.m11", 0x10000, 0x00000000, BRF_ESS | BRF_PRG | BRF_NODUMP }, +}; + +STD_ROM_PICK(Superman) +STD_ROM_FN(Superman) + +static struct BurnRomInfo SupermanuRomDesc[] = { + { "b61_09.a10", 0x20000, 0x640f1d58, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b61_07.a5", 0x20000, 0xfddb9953, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b61_08.a8", 0x20000, 0x79fc028e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b61_12.a3", 0x20000, 0x064d3bfe, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b61_10.d18", 0x10000, 0x6efe79e8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b61-14.f1", 0x80000, 0x89368c3e, BRF_GRA | TAITO_SPRITESA }, + { "b61-15.h1", 0x80000, 0x910cc4f9, BRF_GRA | TAITO_SPRITESA }, + { "b61-16.j1", 0x80000, 0x3622ed2f, BRF_GRA | TAITO_SPRITESA }, + { "b61-17.k1", 0x80000, 0xc34f27e0, BRF_GRA | TAITO_SPRITESA }, + + { "b61-01.e18", 0x80000, 0x3cf99786, BRF_SND | TAITO_YM2610B }, + + { "b61_11.m11", 0x10000, 0x00000000, BRF_ESS | BRF_PRG | BRF_NODUMP }, +}; + +STD_ROM_PICK(Supermanu) +STD_ROM_FN(Supermanu) + +static struct BurnRomInfo SupermanjRomDesc[] = { + { "b61_09.a10", 0x20000, 0x640f1d58, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b61_07.a5", 0x20000, 0xfddb9953, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b61_08.a8", 0x20000, 0x79fc028e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b61-06.a3", 0x20000, 0x714a0b68, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b61_10.d18", 0x10000, 0x6efe79e8, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b61-14.f1", 0x80000, 0x89368c3e, BRF_GRA | TAITO_SPRITESA }, + { "b61-15.h1", 0x80000, 0x910cc4f9, BRF_GRA | TAITO_SPRITESA }, + { "b61-16.j1", 0x80000, 0x3622ed2f, BRF_GRA | TAITO_SPRITESA }, + { "b61-17.k1", 0x80000, 0xc34f27e0, BRF_GRA | TAITO_SPRITESA }, + + { "b61-01.e18", 0x80000, 0x3cf99786, BRF_SND | TAITO_YM2610B }, + + { "b61_11.m11", 0x10000, 0x00000000, BRF_ESS | BRF_PRG | BRF_NODUMP }, +}; + +STD_ROM_PICK(Supermanj) +STD_ROM_FN(Supermanj) + +static struct BurnRomInfo TwinhawkRomDesc[] = { + { "b87-11.u7", 0x20000, 0xfc84a399, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b87-10.u5", 0x20000, 0x17181706, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b87-07.13e", 0x08000, 0xe2e0efa0, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b87-02.3h", 0x80000, 0x89ad43a0, BRF_GRA | TAITO_SPRITESA }, + { "b87-01.3f", 0x80000, 0x81e82ae1, BRF_GRA | TAITO_SPRITESA }, + { "b87-04.3k", 0x80000, 0x958434b6, BRF_GRA | TAITO_SPRITESA }, + { "b87-03.3j", 0x80000, 0xce155ae0, BRF_GRA | TAITO_SPRITESA }, + +}; + +STD_ROM_PICK(Twinhawk) +STD_ROM_FN(Twinhawk) + +static struct BurnRomInfo TwinhawkuRomDesc[] = { + { "b87-09.u7", 0x20000, 0x7e6267c7, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b87-08.u5", 0x20000, 0x31d9916f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b87-07.13e", 0x08000, 0xe2e0efa0, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b87-02.3h", 0x80000, 0x89ad43a0, BRF_GRA | TAITO_SPRITESA }, + { "b87-01.3f", 0x80000, 0x81e82ae1, BRF_GRA | TAITO_SPRITESA }, + { "b87-04.3k", 0x80000, 0x958434b6, BRF_GRA | TAITO_SPRITESA }, + { "b87-03.3j", 0x80000, 0xce155ae0, BRF_GRA | TAITO_SPRITESA }, + +}; + +STD_ROM_PICK(Twinhawku) +STD_ROM_FN(Twinhawku) + +static struct BurnRomInfo DaisenpuRomDesc[] = { + { "b87-06.u7", 0x20000, 0xcf236100, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b87-05.u5", 0x20000, 0x7f15edc7, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b87-07.13e", 0x08000, 0xe2e0efa0, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b87-02.3h", 0x80000, 0x89ad43a0, BRF_GRA | TAITO_SPRITESA }, + { "b87-01.3f", 0x80000, 0x81e82ae1, BRF_GRA | TAITO_SPRITESA }, + { "b87-04.3k", 0x80000, 0x958434b6, BRF_GRA | TAITO_SPRITESA }, + { "b87-03.3j", 0x80000, 0xce155ae0, BRF_GRA | TAITO_SPRITESA }, + +}; + +STD_ROM_PICK(Daisenpu) +STD_ROM_FN(Daisenpu) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += Taito68KRom1Size; + TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; + TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; + TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x004000; + TaitoZ80Ram1 = Next; Next += 0x002000; + TaitoPaletteRam = Next; Next += 0x001000; + TaitoSpriteRam = Next; Next += 0x000800; + TaitoSpriteRam2 = Next; Next += 0x004000; + + TaitoRamEnd = Next; + + TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; + TaitoPalette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32); + + TaitoMemEnd = Next; + + return 0; +} + +UINT8 __fastcall TaitoX68KReadByte(UINT32 a) +{ + if (TaitoIC_SupermanCChipInUse) { + if (a >= 0x900000 && a <= 0x9007ff) { + return SupermanCChipRamRead((a - 0x900000) >> 1, TaitoInput[0], TaitoInput[1], TaitoInput[2]); + } + } + + switch (a) { + case 0x500001: { + return TaitoDip[0] & 0x0f; + } + + case 0x500003: { + return (TaitoDip[0] & 0xf0) >> 4; + } + + case 0x500005: { + return TaitoDip[1] & 0x0f; + } + + case 0x500007: { + return (TaitoDip[1] & 0xf0) >> 4; + } + + case 0x800003: { + return TC0140SYTCommRead(); + } + + case 0x900001: { + return TaitoInput[0]; + } + + case 0x900003: { + return TaitoInput[1]; + } + + case 0x900005: { + return TaitoInput[2]; + } + + case 0x900803: { + if (TaitoIC_SupermanCChipInUse) return SupermanCChipCtrlRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall TaitoX68KWriteByte(UINT32 a, UINT8 d) +{ + if (TaitoIC_SupermanCChipInUse) { + if (a >= 0x900000 && a <= 0x9007ff) { + SupermanCChipRamWrite((a - 0x900000) >> 1, d); + return; + } + } + + switch (a) { + case 0x300000: + case 0x300001: { + //??? + return; + } + + case 0x400000: + case 0x400001: { + //nop + return; + } + + case 0x600000: + case 0x600001: { + //nop + return; + } + + case 0x700000: + case 0x700001: { + //nop + return; + } + + case 0x800001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x800003: { + TC0140SYTCommWrite(d); + return; + } + + case 0x900009: { + // coin write + return; + } + + case 0x900803: { + if (TaitoIC_SupermanCChipInUse) { + SupermanCChipCtrlWrite(); + return; + } + } + + case 0x900c01: { + if (TaitoIC_SupermanCChipInUse) { + SupermanCChipBankWrite(d); + return; + } + } + + case 0xc00000: + case 0xc00001: { + //??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall TaitoX68KReadWord(UINT32 a) +{ + switch (a) { + case 0x500000: { + return TaitoDip[0] & 0x0f; + } + + case 0x500002: { + return (TaitoDip[0] & 0xf0) >> 4; + } + + case 0x500004: { + return TaitoDip[1] & 0x0f; + } + + case 0x500006: { + return (TaitoDip[1] & 0xf0) >> 4; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +UINT8 __fastcall TaitoXZ80Read(UINT16 a) +{ + switch (a) { + case 0xe000: { + return BurnYM2610Read(0); + } + + case 0xe001: { + return BurnYM2610Read(1); + } + + case 0xe002: { + return BurnYM2610Read(2); + } + + case 0xe201: { + return TC0140SYTSlaveCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall TaitoXZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe000: { + BurnYM2610Write(0, d); + return; + } + + case 0xe001: { + BurnYM2610Write(1, d); + return; + } + + case 0xe002: { + BurnYM2610Write(2, d); + return; + } + + case 0xe003: { + BurnYM2610Write(3, d); + return; + } + + case 0xe200: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xe201: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xe400: + case 0xe401: + case 0xe402: + case 0xe403: { + //nop + return; + } + + case 0xe600: { + //??? + return; + } + + case 0xee00: { + //nop + return; + } + + case 0xf000: { + //nop + return; + } + + case 0xf200: { + TaitoZ80Bank = (d - 1) & 3; + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +UINT8 __fastcall TwinhawkZ80Read(UINT16 a) +{ + switch (a) { + case 0xe001: { + return BurnYM2151ReadStatus(); + } + + case 0xe201: { + return TC0140SYTSlaveCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall TwinhawkZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe000: { + BurnYM2151SelectRegister(d); + return; + } + + case 0xe001: { + BurnYM2151WriteRegister(d); + return; + } + + case 0xe200: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xe201: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xf200: { + TaitoZ80Bank = (d - 1) & 3; + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static void TaitoXFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 TaitoXSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 4000000; +} + +static double TaitoXGetTime() +{ + return (double)ZetTotalCycles() / 4000000; +} + +static void TaitoXYM2151IRQHandler(INT32 Irq) +{ + if (Irq) { + ZetSetIRQLine(0xff, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 SpritePlaneOffsets[4] = { 0x800008, 0x800000, 8, 0 }; +static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; +static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 256, 272, 288, 304, 320, 336, 352, 368 }; +static INT32 BallbrosPlaneOffsets[4] = { 0x300000, 0x200000, 0x100000, 0 }; +static INT32 BallbrosXOffsets[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; +static INT32 BallbrosYOffsets[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; + +static INT32 TaitoXInit(INT32 nSoundType) +{ + INT32 nLen; + + TaitoNum68Ks = 1; + TaitoNumZ80s = 1; + if (nSoundType == 1) { + TaitoNumYM2151 = 1; + } else { + TaitoNumYM2610 = 1; + } + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + if (TaitoLoadRoms(1)) return 1; + + TC0140SYTInit(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, Taito68KRom1Size - 1, SM_ROM); + SekMapMemory(TaitoPaletteRam , 0xb00000, 0xb00fff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0xd00000, 0xd007ff, SM_RAM); + SekMapMemory(TaitoSpriteRam2 , 0xe00000, 0xe03fff, SM_RAM); + SekMapMemory(Taito68KRam1 , 0xf00000, 0xf03fff, SM_RAM); + SekSetReadByteHandler(0, TaitoX68KReadByte); + SekSetWriteByteHandler(0, TaitoX68KWriteByte); + SekSetReadWordHandler(0, TaitoX68KReadWord); + SekClose(); + + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + if (nSoundType == 1) { + ZetSetReadHandler(TwinhawkZ80Read); + ZetSetWriteHandler(TwinhawkZ80Write); + } else { + ZetSetReadHandler(TaitoXZ80Read); + ZetSetWriteHandler(TaitoXZ80Write); + } + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); + ZetClose(); + + if (nSoundType == 1) { + BurnYM2151Init(4000000); + BurnYM2151SetIrqHandler(&TaitoXYM2151IRQHandler); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT); + BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT); + } else { + if (nSoundType == 2) { + BurnYM2610Init(8000000, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, NULL, TaitoXSynchroniseStream, TaitoXGetTime, 0); + } else { + BurnYM2610Init(8000000, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, &TaitoXFMIRQHandler, TaitoXSynchroniseStream, TaitoXGetTime, 0); + } + BurnTimerAttachZet(4000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + } + + GenericTilesInit(); + + nTaitoCyclesTotal[0] = (8000000) / 60; + nTaitoCyclesTotal[1] = (4000000) / 60; + + if (nScreenHeight == 224) TaitoYOffset = 16; + if (nScreenHeight == 240) TaitoYOffset = 8; + TaitoIrqLine = 2; + + TaitoDoReset(); + + return 0; +} + +static INT32 BallbrosInit() +{ + TaitoSpriteAModulo = 0x100; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = BallbrosPlaneOffsets; + TaitoSpriteAXOffsets = BallbrosXOffsets; + TaitoSpriteAYOffsets = BallbrosYOffsets; + TaitoNumSpriteA = 0x1000; + + return TaitoXInit(2); +} + +static INT32 GigandesInit() +{ + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x4000; + + return TaitoXInit(2); +} + +static INT32 SupermanInit() +{ + INT32 nRet; + + SupermanCChipInit(); + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x4000; + + nRet = TaitoXInit(0); + + TaitoIrqLine = 6; + + return nRet; +} + +static INT32 TwinhawkInit() +{ + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x4000; + + return TaitoXInit(1); +} + +static INT32 TaitoXExit() +{ + return TaitoExit(); +} + +static inline UINT8 pal5bit(UINT8 bits) +{ + bits &= 0x1f; + return (bits << 3) | (bits >> 2); +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 10); + g = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 5); + b = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); + + return BurnHighCol(r, g, b, 0); +} + +static void TaitoXCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x0800; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } +} + +static void TaitoXDrawBgSprites() +{ + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + UINT16 *SpriteRam2 = (UINT16*)TaitoSpriteRam2; + + INT32 Offs, Col, x, y, Code, Colour, xFlip, yFlip, sx, sy, yOffs; + + INT32 Ctrl = BURN_ENDIAN_SWAP_INT16(SpriteRam[0x300]); + INT32 Ctrl2 = BURN_ENDIAN_SWAP_INT16(SpriteRam[0x301]); + + INT32 Flip = Ctrl & 0x40; + INT32 NumCol = Ctrl2 & 0x000f; + + UINT16 *src = SpriteRam2 + (((Ctrl2 ^ (~Ctrl2 << 1)) & 0x40) ? 0x1000 : 0 ); + + INT32 Upper = (BURN_ENDIAN_SWAP_INT16(SpriteRam[0x302]) & 0xff) + (BURN_ENDIAN_SWAP_INT16(SpriteRam[0x303]) & 0xff) * 256; + INT32 Col0; + switch (Ctrl & 0x0f) { + case 0x01: Col0 = 0x4; break; + case 0x06: Col0 = 0x8; break; + + default: Col0 = 0x0; + } + + yOffs = Flip ? 1 : -1; + + if (NumCol == 1) NumCol = 16; + + for (Col = 0; Col < NumCol; Col++) { + x = BURN_ENDIAN_SWAP_INT16(SpriteRam[(Col * 0x20 + 0x08 + 0x400) / 2]) & 0xff; + y = BURN_ENDIAN_SWAP_INT16(SpriteRam[(Col * 0x20 + 0x00 + 0x400) / 2]) & 0xff; + + for (Offs = 0; Offs < 0x20; Offs++) { + Code = BURN_ENDIAN_SWAP_INT16(src[((Col + Col0) & 0x0f) * 0x20 + Offs + 0x400]); + Colour = BURN_ENDIAN_SWAP_INT16(src[((Col + Col0) & 0x0f) * 0x20 + Offs + 0x600]); + + xFlip = Code & 0x8000; + yFlip = Code & 0x4000; + + sx = x + (Offs & 1) * 16; + sy = -(y + yOffs) + (Offs / 2) * 16; + + if (Upper & (1 << Col)) sx += 256; + + if (Flip) { + sy = 0xf0 - sy; + xFlip = !xFlip; + yFlip = !yFlip; + } + + Colour = (Colour >> (16 - 5)) % 0x100; + Code &= (TaitoNumSpriteA - 1); + + sx = ((sx + 16) & 0x1ff) - 16; + sy = ((sy + 8) & 0xff) - 8; + + sy -= TaitoYOffset; + + if (sx > 16 && sx < (nScreenWidth - 16) && sy > 16 && sy < (nScreenHeight - 16)) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 4, 0, 0, TaitoSpritesA); + } + } + } + } + } +} + +static void TaitoXDrawSprites() +{ + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + UINT16 *SpriteRam2 = (UINT16*)TaitoSpriteRam2; + + INT32 Offset, Code, x, y, xFlip, yFlip, Colour; + INT32 Ctrl = BURN_ENDIAN_SWAP_INT16(SpriteRam[0x300]); + INT32 Ctrl2 = BURN_ENDIAN_SWAP_INT16(SpriteRam[0x301]); + INT32 Flip = Ctrl & 0x40; + UINT16 *src = SpriteRam2 + (((Ctrl2 ^ (~Ctrl2 << 1)) & 0x40) ? 0x1000 : 0); + + for (Offset = (0x400 - 2) / 2; Offset >= 0; Offset-- ) { + Code = BURN_ENDIAN_SWAP_INT16(src[Offset]); + x = BURN_ENDIAN_SWAP_INT16(src[Offset + 0x200]); + y = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]) & 0xff; + xFlip = Code & 0x8000; + yFlip = Code & 0x4000; + + Colour = (x >> (16 - 5) ) % 0x100; + + Code &= (TaitoNumSpriteA - 1); + + if (Flip) { + y = 0xf0 - y; + xFlip = !xFlip; + yFlip = !yFlip; + } + + y = 0xf0 - y; + x = ((x + 16) & 0x1ff) - 16; + y = ((y + 8) & 0xff) - 8; + + y -= TaitoYOffset - 2; + + if (x > 16 && x < (nScreenWidth - 16) && y > 16 && y < (nScreenHeight - 16)) { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } + } else { + if (xFlip) { + if (yFlip) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } else { + if (yFlip) { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); + } + } + } + } + +} + +static void TaitoXDraw() +{ + TaitoXCalcPalette(); + + for (INT32 i = 0; i < nScreenHeight * nScreenWidth; i++) { + pTransDraw[i] = 0x1f0; + } + + TaitoXDrawBgSprites(); + TaitoXDrawSprites(); + BurnTransferCopy(TaitoPalette); +} + +static INT32 TaitoXFrame() +{ + INT32 nInterleave = 10; + + if (TaitoReset) TaitoDoReset(); + + TaitoXMakeInputs(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + nCurrentCPU = 0; + SekOpen(nCurrentCPU); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == (nInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + + nCurrentCPU = 1; + ZetOpen(0); + BurnTimerUpdate(i * (nTaitoCyclesTotal[1] / nInterleave)); + ZetClose(); + } + + ZetOpen(0); + BurnTimerEndFrame(nTaitoCyclesTotal[1]); + if (pBurnSoundOut) { + BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + } + ZetClose(); + + if (pBurnDraw) TaitoXDraw(); + + return 0; +} + +static INT32 TwinhawkFrame() +{ + INT32 nInterleave = 10; + INT32 nSoundBufferPos = 0; + + if (TaitoReset) TaitoDoReset(); + + TaitoXMakeInputs(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = 0; + + SekNewFrame(); + ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == 9) SekSetIRQLine(2, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run Z80 + nCurrentCPU = 1; + ZetOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesSegment = ZetRun(nTaitoCyclesSegment); + nTaitoCyclesDone[nCurrentCPU] += nTaitoCyclesSegment; + ZetClose(); + + // Render sound segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + nSoundBufferPos += nSegmentLength; + } + } + + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + ZetOpen(0); + BurnYM2151Render(pSoundBuf, nSegmentLength); + ZetClose(); + } + } + + if (pBurnDraw) TaitoXDraw(); + + return 0; +} + +static INT32 TaitoXScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029683; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = TaitoRamStart; + ba.nLen = TaitoRamEnd-TaitoRamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + TaitoICScan(nAction); + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + ZetScan(nAction); + + if (TaitoNumYM2610) BurnYM2610Scan(nAction, pnMin); + if (TaitoNumYM2151) BurnYM2151Scan(nAction); + + SCAN_VAR(TaitoInput); + SCAN_VAR(TaitoZ80Bank); + SCAN_VAR(TaitoSoundLatch); + SCAN_VAR(nTaitoCyclesDone); + SCAN_VAR(nTaitoCyclesSegment); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetClose(); + } + + return 0; +} + +struct BurnDriver BurnDrvBallbros = { + "ballbros", NULL, NULL, NULL, "1992", + "Balloon Brothers\0", NULL, "East Technology", "Taito-X", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOX, GBF_PUZZLE, 0, + NULL, BallbrosRomInfo, BallbrosRomName, NULL, NULL, TwinhawkInputInfo, BallbrosDIPInfo, + BallbrosInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGigandes = { + "gigandes", NULL, NULL, NULL, "1989", + "Gigandes\0", NULL, "East Technology", "Taito-X", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOX, GBF_HORSHOOT, 0, + NULL, GigandesRomInfo, GigandesRomName, NULL, NULL, TwinhawkInputInfo, GigandesDIPInfo, + GigandesInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGigandesa = { + "gigandesa", "gigandes", NULL, NULL, "1989", + "Gigandes (earlier)\0", NULL, "East Technology", "Taito-X", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOX, GBF_HORSHOOT, 0, + NULL, GigandesaRomInfo, GigandesaRomName, NULL, NULL, TwinhawkInputInfo, GigandesDIPInfo, + GigandesInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvKyustrkr = { + "kyustrkr", NULL, NULL, NULL, "1989", + "Last Striker / Kyuukyoku no Striker\0", NULL, "East Technology", "Taito-X", + L"Last Striker\0Final \u7A76\u6975 \u306E Striker\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_TAITOX, GBF_SPORTSFOOTBALL, 0, + NULL, KyustrkrRomInfo, KyustrkrRomName, NULL, NULL, TwinhawkInputInfo, KyustrkrDIPInfo, + BallbrosInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSuperman = { + "superman", NULL, NULL, NULL, "1988", + "Superman (World)\0", NULL, "Taito Corporation", "Taito-X", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOX, GBF_SCRFIGHT, 0, + NULL, SupermanRomInfo, SupermanRomName, NULL, NULL, SupermanInputInfo, SupermanDIPInfo, + SupermanInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSupermanu = { + "supermanu", "superman", NULL, NULL, "1988", + "Superman (US)\0", NULL, "Taito Corporation", "Taito-X", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOX, GBF_SCRFIGHT, 0, + NULL, SupermanuRomInfo, SupermanuRomName, NULL, NULL, SupermanInputInfo, SupermanuDIPInfo, + SupermanInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSupermanj = { + "supermanj", "superman", NULL, NULL, "1988", + "Superman (Japan)\0", NULL, "Taito Corporation", "Taito-X", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOX, GBF_SCRFIGHT, 0, + NULL, SupermanjRomInfo, SupermanjRomName, NULL, NULL, SupermanInputInfo, SupermanjDIPInfo, + SupermanInit, TaitoXExit, TaitoXFrame, NULL, TaitoXScan, + NULL, 0x800, 384, 240, 4, 3 +}; + +struct BurnDriver BurnDrvTwinhawk = { + "twinhawk", NULL, NULL, NULL, "1989", + "Twin Hawk (World)\0", NULL, "Taito Corporation Japan", "Taito-X", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOX, GBF_VERSHOOT, 0, + NULL, TwinhawkRomInfo, TwinhawkRomName, NULL, NULL, TwinhawkInputInfo, TwinhawkDIPInfo, + TwinhawkInit, TaitoXExit, TwinhawkFrame, NULL, TaitoXScan, + NULL, 0x800, 224, 384, 3, 4 +}; + +struct BurnDriver BurnDrvTwinhawku = { + "twinhawku", "twinhawk", NULL, NULL, "1989", + "Twin Hawk (US)\0", NULL, "Taito America Corporation", "Taito-X", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOX, GBF_VERSHOOT, 0, + NULL, TwinhawkuRomInfo, TwinhawkuRomName, NULL, NULL, TwinhawkInputInfo, TwinhawkuDIPInfo, + TwinhawkInit, TaitoXExit, TwinhawkFrame, NULL, TaitoXScan, + NULL, 0x800, 224, 384, 3, 4 +}; + +struct BurnDriver BurnDrvDaisenpu = { + "daisenpu", "twinhawk", NULL, NULL, "1989", + "Daisenpu (Japan)\0", NULL, "Taito Corporation", "Taito-X", + L"\u5927\u65CB\u98A8 (Japan)\0Daisenpu\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_TAITOX, GBF_VERSHOOT, 0, + NULL, DaisenpuRomInfo, DaisenpuRomName, NULL, NULL, TwinhawkInputInfo, DaisenpuDIPInfo, + TwinhawkInit, TaitoXExit, TwinhawkFrame, NULL, TaitoXScan, + NULL, 0x800, 224, 384, 3, 4 +}; diff --git a/src/burn/drv/taito/d_taitoz.cpp b/src/burn/drv/taito/d_taitoz.cpp index 6834439d8..1d7d75cf7 100644 --- a/src/burn/drv/taito/d_taitoz.cpp +++ b/src/burn/drv/taito/d_taitoz.cpp @@ -1,6413 +1,6412 @@ -#include "tiles_generic.h" -#include "m68000_intf.h" -#include "z80_intf.h" -#include "taito.h" -#include "taito_ic.h" -#include "burn_ym2610.h" -#include "eeprom.h" -#include "burn_gun.h" - -static INT32 Sci; -static INT32 OldSteer; // Hack to centre the steering in SCI -static INT32 SciSpriteFrame; - -static double TaitoZYM2610Route1MasterVol; -static double TaitoZYM2610Route2MasterVol; - -static void AquajackDraw(); -static void BsharkDraw(); -static void ChasehqDraw(); -static void ContcircDraw(); -static void DblaxleDraw(); -static void EnforceDraw(); -static void RacingbDraw(); -static void SciDraw(); -static void SpacegunDraw(); - -static bool bUseAsm68KCoreOldValue = false; - -#define A(a, b, c, d) {a, b, (UINT8*)(c), d} - -static struct BurnInputInfo AquajackInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, - - {"Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 up" }, - {"Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 down" }, - {"Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p1 left" }, - {"Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p1 right" }, - {"Jump" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p1 fire 1" }, - {"Accelerate" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 fire 2" }, - {"Vulcan" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p1 fire 3" }, - {"Missile" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p1 fire 4" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Aquajack) - -static struct BurnInputInfo BsharkInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "p2 start" }, - - A("Crosshair X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), - A("Crosshair Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "p1 y-axis" ), - {"Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Bshark) - -static struct BurnInputInfo BsharkjjsInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "p2 start" }, - - {"Up" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 up" }, - {"Down" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p1 down" }, - {"Left" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p1 left" }, - {"Right" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 right" }, - {"Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Bsharkjjs) - -static struct BurnInputInfo ChasehqInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, - - A("Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), - {"Brake" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 1" }, - {"Accelerate" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p1 fire 2" }, - {"Turbo" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 fire 3" }, - {"Gear" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p1 fire 4" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Chasehq) - -static struct BurnInputInfo ContcircInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p2 coin" }, - - A("Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), - {"Brake" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p1 fire 1" }, - {"Accelerate" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 fire 2" }, - {"Gear" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p1 fire 3" }, - {"Brake 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p1 fire 4" }, - {"Brake 3" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p1 fire 5" }, - {"Accelerate 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 6" }, - {"Accelerate 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 fire 7" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Contcirc) - -static struct BurnInputInfo DblaxleInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p2 coin" }, - - A("Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), - {"Brake" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 1" }, - {"Accelerate" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p1 fire 2" }, - {"Nitro" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p1 fire 3" }, - {"Gear" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 4" }, - {"Reverse" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 fire 5" }, - {"Centre" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p1 fire 6" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "service" }, - {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Dblaxle) - -static struct BurnInputInfo EnforceInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p2 coin" }, - - {"Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 up" }, - {"Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 down" }, - {"Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 left" }, - {"Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p1 right" }, - {"Laser" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 fire 1" }, - {"Bomb" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Enforce) - -static struct BurnInputInfo NightstrInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "p2 start" }, - - A("Stick X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), - A("Stick Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "p1 y-axis" ), - {"Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p1 fire 1" }, - {"Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p1 fire 2" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Nightstr) - -static struct BurnInputInfo RacingbInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p2 coin" }, - - A("Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), - {"Brake" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 1" }, - {"Accelerate" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p1 fire 2" }, - {"Pit In" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p1 fire 3" }, - {"Gear" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 4" }, - {"Centre" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p1 fire 5" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "service" }, - {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, -}; - -STDINPUTINFO(Racingb) - -static struct BurnInputInfo SciInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, - - A("Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), - {"Brake" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 1" }, - {"Accelerate" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p1 fire 2" }, - {"Fire" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 fire 3" }, - {"Turbo" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 fire 4" }, - {"Gear" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p1 fire 5" }, - {"Centre" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p1 fire 6" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, - {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "tilt" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Sci) - -static struct BurnInputInfo SpacegunInputList[] = -{ - {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 coin" }, - {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 start" }, - {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p2 coin" }, - {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p2 start" }, - - A("P1 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "mouse x-axis" ), - A("P1 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "mouse y-axis" ), - {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "mouse button 1" }, - {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "mouse button 2" }, - {"P1 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 fire 1" }, - - A("P2 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort2 , "p2 x-axis" ), - A("P2 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort3 , "p2 y-axis" ), - {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "p2 fire 1" }, - {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 fire 2" }, - {"P2 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p2 fire 3" }, - - {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, - {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, - {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, - {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, -}; - -STDINPUTINFO(Spacegun) - -#undef A - -static void AquajackMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0xff; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] -= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] -= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; - - if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; - if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; - if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; - if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; - if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] -= 0x10; - if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] -= 0x20; - if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] -= 0x40; - if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] -= 0x80; -} - -static void BsharkMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0xff; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] -= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] -= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; - - if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; - if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; - if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; - if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] -= 0x08; - if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; - if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; - if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; - if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; -} - -static void ChasehqMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0xf3; - TC0220IOCInput[1] = 0xef; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; - - if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; - if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; - if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; - if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; - if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] |= 0x10; - if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] -= 0x20; - if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] -= 0x40; - if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] -= 0x80; -} - -static void ContcircMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0x13; - TC0220IOCInput[1] = 0x0f; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] |= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] |= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] |= 0x80; - - if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; - if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; - if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; - if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; - if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] |= 0x10; - if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] |= 0x20; - if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] |= 0x40; - if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] |= 0x80; -} - -static void DblaxleMakeInputs() -{ - // Reset Inputs - TC0510NIOInput[0] = 0xff; - TC0510NIOInput[1] = 0xff; - TC0510NIOInput[2] = 0xff; - - if (TC0510NIOInputPort0[0]) TC0510NIOInput[0] -= 0x01; - if (TC0510NIOInputPort0[1]) TC0510NIOInput[0] -= 0x02; - if (TC0510NIOInputPort0[2]) TC0510NIOInput[0] -= 0x04; - if (TC0510NIOInputPort0[3]) TC0510NIOInput[0] -= 0x08; - if (TC0510NIOInputPort0[4]) TC0510NIOInput[0] -= 0x10; - if (TC0510NIOInputPort0[5]) TC0510NIOInput[0] -= 0x20; - if (TC0510NIOInputPort0[6]) TC0510NIOInput[0] -= 0x40; - if (TC0510NIOInputPort0[7]) TC0510NIOInput[0] -= 0x80; - - if (TC0510NIOInputPort1[0]) TC0510NIOInput[1] -= 0x01; - if (TC0510NIOInputPort1[1]) TC0510NIOInput[1] -= 0x02; - if (TC0510NIOInputPort1[2]) TC0510NIOInput[1] -= 0x04; - if (TC0510NIOInputPort1[3]) TC0510NIOInput[1] -= 0x08; - if (TC0510NIOInputPort1[4]) TC0510NIOInput[1] -= 0x10; - if (TC0510NIOInputPort1[5]) TC0510NIOInput[1] -= 0x20; - if (TC0510NIOInputPort1[6]) TC0510NIOInput[1] -= 0x40; - if (TC0510NIOInputPort1[7]) TC0510NIOInput[1] -= 0x80; -} - -static void EnforceMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0xf3; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; - - if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; - if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; - if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; - if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; - if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] -= 0x10; - if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] -= 0x20; - if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] -= 0x40; - if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] -= 0x80; -} - -static void NightstrMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0xff; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] -= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] -= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; - - if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; - if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; - if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; - if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] -= 0x08; - if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; - if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; - if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; - if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; -} - -static void SciMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0xff; - TC0220IOCInput[1] = 0xef; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] -= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] -= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; - - if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; - if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; - if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; - if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; - if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] |= 0x10; - if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] -= 0x20; - if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] -= 0x40; - if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] -= 0x80; -} - -static void SpacegunMakeInputs() -{ - // Reset Inputs - TC0220IOCInput[0] = 0xff; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] -= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] -= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; - - if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; - if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; - if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; - if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] -= 0x08; - if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; - if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; - if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; - if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; - - BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); - BurnGunMakeInputs(1, (INT16)TaitoAnalogPort2, (INT16)TaitoAnalogPort3); -} - -static struct BurnDIPInfo AquajackDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x7f, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x80, 0x80, "Cockpit" }, - {0x0e, 0x01, 0x80, 0x00, "Upright" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0e, 0x01, 0x20, 0x20, "Off" }, - {0x0e, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0e, 0x01, 0x10, 0x00, "Off" }, - {0x0e, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0e, 0x01, 0x0c, 0x00, "4 Coins 1 Credit" }, - {0x0e, 0x01, 0x0c, 0x08, "3 Coins 1 Credit" }, - {0x0e, 0x01, 0x0c, 0x04, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0e, 0x01, 0x03, 0x03, "1 Coin 2 Credits" }, - {0x0e, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, - {0x0e, 0x01, 0x03, 0x02, "1 Coin 4 Credits" }, - {0x0e, 0x01, 0x03, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0f, 0x01, 0xc0, 0x40, "Easy" }, - {0x0f, 0x01, 0xc0, 0xc0, "Normal" }, - {0x0f, 0x01, 0xc0, 0x80, "Hard" }, - {0x0f, 0x01, 0xc0, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0f, 0x01, 0x30, 0x00, "30000" }, - {0x0f, 0x01, 0x30, 0x30, "50000" }, - {0x0f, 0x01, 0x30, 0x10, "80000" }, - {0x0f, 0x01, 0x30, 0x20, "100000" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x0c, 0x08, "1" }, - {0x0f, 0x01, 0x0c, 0x04, "2" }, - {0x0f, 0x01, 0x0c, 0x0c, "3" }, - {0x0f, 0x01, 0x0c, 0x00, "5" }, -}; - -STDDIPINFO(Aquajack) - -static struct BurnDIPInfo AquajackjDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0x7f, NULL }, - {0x0f, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x80, 0x80, "Cockpit" }, - {0x0e, 0x01, 0x80, 0x00, "Upright" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0e, 0x01, 0x20, 0x20, "Off" }, - {0x0e, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0e, 0x01, 0x10, 0x00, "Off" }, - {0x0e, 0x01, 0x10, 0x10, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0e, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, - {0x0e, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0e, 0x01, 0x03, 0x02, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, - {0x0e, 0x01, 0x03, 0x00, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0x03, 0x01, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0f, 0x01, 0xc0, 0x40, "Easy" }, - {0x0f, 0x01, 0xc0, 0xc0, "Normal" }, - {0x0f, 0x01, 0xc0, 0x80, "Hard" }, - {0x0f, 0x01, 0xc0, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Life" }, - {0x0f, 0x01, 0x30, 0x00, "30000" }, - {0x0f, 0x01, 0x30, 0x30, "50000" }, - {0x0f, 0x01, 0x30, 0x10, "80000" }, - {0x0f, 0x01, 0x30, 0x20, "100000" }, - - {0 , 0xfe, 0 , 4 , "Lives" }, - {0x0f, 0x01, 0x0c, 0x08, "1" }, - {0x0f, 0x01, 0x0c, 0x04, "2" }, - {0x0f, 0x01, 0x0c, 0x0c, "3" }, - {0x0f, 0x01, 0x0c, 0x00, "5" }, -}; - -STDDIPINFO(Aquajackj) - -static struct BurnDIPInfo BsharkDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xff, NULL }, - {0x0c, 0xff, 0xff, 0xf7, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Mirror Screen" }, - {0x0b, 0x01, 0x01, 0x01, "Off" }, - {0x0b, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x0b, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x0b, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x03, 0x02, "Easy" }, - {0x0c, 0x01, 0x03, 0x03, "Normal" }, - {0x0c, 0x01, 0x03, 0x01, "Hard" }, - {0x0c, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Speed of Sight" }, - {0x0c, 0x01, 0x0c, 0x0c, "Slow" }, - {0x0c, 0x01, 0x0c, 0x08, "Medium" }, - {0x0c, 0x01, 0x0c, 0x04, "Fast" }, - {0x0c, 0x01, 0x0c, 0x00, "Fastest" }, -}; - -STDDIPINFO(Bshark) - -static struct BurnDIPInfo BsharkjDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xff, NULL }, - {0x0c, 0xff, 0xff, 0xf7, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Mirror Screen" }, - {0x0b, 0x01, 0x01, 0x01, "Off" }, - {0x0b, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0b, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0b, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x03, 0x02, "Easy" }, - {0x0c, 0x01, 0x03, 0x03, "Normal" }, - {0x0c, 0x01, 0x03, 0x01, "Hard" }, - {0x0c, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Speed of Sight" }, - {0x0c, 0x01, 0x0c, 0x0c, "Slow" }, - {0x0c, 0x01, 0x0c, 0x08, "Medium" }, - {0x0c, 0x01, 0x0c, 0x04, "Fast" }, - {0x0c, 0x01, 0x0c, 0x00, "Fastest" }, -}; - -STDDIPINFO(Bsharkj) - -static struct BurnDIPInfo BsharkjjsDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0xff, NULL }, - {0x0e, 0xff, 0xff, 0xf7, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Mirror Screen" }, - {0x0d, 0x01, 0x01, 0x01, "Off" }, - {0x0d, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0d, 0x01, 0x04, 0x04, "Off" }, - {0x0d, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x08, 0x00, "Off" }, - {0x0d, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0d, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0d, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0d, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0d, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0e, 0x01, 0x03, 0x02, "Easy" }, - {0x0e, 0x01, 0x03, 0x03, "Normal" }, - {0x0e, 0x01, 0x03, 0x01, "Hard" }, - {0x0e, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Speed of Sight" }, - {0x0e, 0x01, 0x0c, 0x0c, "Slow" }, - {0x0e, 0x01, 0x0c, 0x08, "Medium" }, - {0x0e, 0x01, 0x0c, 0x04, "Fast" }, - {0x0e, 0x01, 0x0c, 0x00, "Fastest" }, -}; - -STDDIPINFO(Bsharkjjs) - -static struct BurnDIPInfo BsharkuDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xff, NULL }, - {0x0c, 0xff, 0xff, 0xf7, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Mirror Screen" }, - {0x0b, 0x01, 0x01, 0x01, "Off" }, - {0x0b, 0x01, 0x01, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x0b, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0xc0, 0xc0, "Same as Start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x03, 0x02, "Easy" }, - {0x0c, 0x01, 0x03, 0x03, "Normal" }, - {0x0c, 0x01, 0x03, 0x01, "Hard" }, - {0x0c, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Speed of Sight" }, - {0x0c, 0x01, 0x0c, 0x0c, "Slow" }, - {0x0c, 0x01, 0x0c, 0x08, "Medium" }, - {0x0c, 0x01, 0x0c, 0x04, "Fast" }, - {0x0c, 0x01, 0x0c, 0x00, "Fastest" }, -}; - -STDDIPINFO(Bsharku) - -static struct BurnDIPInfo ChasehqDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xff, NULL }, - {0x0c, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Cabinet" }, - {0x0b, 0x01, 0x03, 0x03, "Upright / Steering Lock" }, - {0x0b, 0x01, 0x03, 0x02, "Upright / No Steering Lock" }, - {0x0b, 0x01, 0x03, 0x01, "Full Throttle Convert, Cockpit" }, - {0x0b, 0x01, 0x03, 0x00, "Full Throttle Convert, Deluxe" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x0b, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x0b, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x03, 0x02, "Easy" }, - {0x0c, 0x01, 0x03, 0x03, "Normal" }, - {0x0c, 0x01, 0x03, 0x01, "Hard" }, - {0x0c, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Timer Setting" }, - {0x0c, 0x01, 0x0c, 0x08, "70 Seconds" }, - {0x0c, 0x01, 0x0c, 0x04, "65 Seconds" }, - {0x0c, 0x01, 0x0c, 0x0c, "60 Seconds" }, - {0x0c, 0x01, 0x0c, 0x00, "55 Seconds" }, - - {0 , 0xfe, 0 , 2 , "Turbos Stocked" }, - {0x0c, 0x01, 0x10, 0x10, "3" }, - {0x0c, 0x01, 0x10, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Discounted Continue Play" }, - {0x0c, 0x01, 0x20, 0x20, "Off" }, - {0x0c, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Damage Cleared at Continue" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0c, 0x01, 0x80, 0x00, "Off" }, - {0x0c, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Chasehq) - -static struct BurnDIPInfo ChasehqjDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xff, NULL }, - {0x0c, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 4 , "Cabinet" }, - {0x0b, 0x01, 0x03, 0x03, "Upright / Steering Lock" }, - {0x0b, 0x01, 0x03, 0x02, "Upright / No Steering Lock" }, - {0x0b, 0x01, 0x03, 0x01, "Full Throttle Convert, Cockpit" }, - {0x0b, 0x01, 0x03, 0x00, "Full Throttle Convert, Deluxe" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0b, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0b, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x03, 0x02, "Easy" }, - {0x0c, 0x01, 0x03, 0x03, "Normal" }, - {0x0c, 0x01, 0x03, 0x01, "Hard" }, - {0x0c, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Timer Setting" }, - {0x0c, 0x01, 0x0c, 0x08, "70 Seconds" }, - {0x0c, 0x01, 0x0c, 0x04, "65 Seconds" }, - {0x0c, 0x01, 0x0c, 0x0c, "60 Seconds" }, - {0x0c, 0x01, 0x0c, 0x00, "55 Seconds" }, - - {0 , 0xfe, 0 , 2 , "Turbos Stocked" }, - {0x0c, 0x01, 0x10, 0x10, "3" }, - {0x0c, 0x01, 0x10, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Discounted Continue Play" }, - {0x0c, 0x01, 0x20, 0x20, "Off" }, - {0x0c, 0x01, 0x20, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Damage Cleared at Continue" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0c, 0x01, 0x80, 0x00, "Off" }, - {0x0c, 0x01, 0x80, 0x80, "On" }, -}; - -STDDIPINFO(Chasehqj) - -static struct BurnDIPInfo ContcircDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0xff, NULL }, - {0x0f, 0xff, 0xff, 0xdf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x01, 0x01, "Upright" }, - {0x0e, 0x01, 0x01, 0x00, "Cockpit" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0e, 0x01, 0x04, 0x04, "Off" }, - {0x0e, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0e, 0x01, 0x08, 0x00, "Off" }, - {0x0e, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0e, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0e, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0e, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0e, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x0e, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x0e, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x0e, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Time Difficulty" }, - {0x0f, 0x01, 0x03, 0x02, "Easy" }, - {0x0f, 0x01, 0x03, 0x03, "Normal" }, - {0x0f, 0x01, 0x03, 0x01, "Hard" }, - {0x0f, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Opponent Difficulty" }, - {0x0f, 0x01, 0x0c, 0x08, "Easy" }, - {0x0f, 0x01, 0x0c, 0x0c, "Normal" }, - {0x0f, 0x01, 0x0c, 0x04, "Hard" }, - {0x0f, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Steering Wheel" }, - {0x0f, 0x01, 0x10, 0x10, "Free" }, - {0x0f, 0x01, 0x10, 0x00, "Locked" }, - - {0 , 0xfe, 0 , 2 , "Enable 3D Alternate Frames" }, - {0x0f, 0x01, 0x20, 0x00, "Off" }, - {0x0f, 0x01, 0x20, 0x20, "On" }, -}; - -STDDIPINFO(Contcirc) - -static struct BurnDIPInfo ContcircuDIPList[]= -{ - // Default Values - {0x0e, 0xff, 0xff, 0xff, NULL }, - {0x0f, 0xff, 0xff, 0xdf, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0e, 0x01, 0x01, 0x01, "Upright" }, - {0x0e, 0x01, 0x01, 0x00, "Cockpit" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0e, 0x01, 0x04, 0x04, "Off" }, - {0x0e, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0e, 0x01, 0x08, 0x00, "Off" }, - {0x0e, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0e, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0e, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0e, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0e, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0e, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0e, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Time Difficulty" }, - {0x0f, 0x01, 0x03, 0x02, "Easy" }, - {0x0f, 0x01, 0x03, 0x03, "Normal" }, - {0x0f, 0x01, 0x03, 0x01, "Hard" }, - {0x0f, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Opponent Difficulty" }, - {0x0f, 0x01, 0x0c, 0x08, "Easy" }, - {0x0f, 0x01, 0x0c, 0x0c, "Normal" }, - {0x0f, 0x01, 0x0c, 0x04, "Hard" }, - {0x0f, 0x01, 0x0c, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Steering Wheel" }, - {0x0f, 0x01, 0x10, 0x10, "Free" }, - {0x0f, 0x01, 0x10, 0x00, "Locked" }, - - {0 , 0xfe, 0 , 2 , "Enable 3D Alternate Frames" }, - {0x0f, 0x01, 0x20, 0x00, "Off" }, - {0x0f, 0x01, 0x20, 0x20, "On" }, -}; - -STDDIPINFO(Contcircu) - -static struct BurnDIPInfo DblaxleDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0xff, NULL }, - {0x0e, 0xff, 0xff, 0xfb, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Gear Shift" }, - {0x0d, 0x01, 0x02, 0x02, "Normal" }, - {0x0d, 0x01, 0x02, 0x00, "Inverted" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0d, 0x01, 0x04, 0x04, "Off" }, - {0x0d, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x08, 0x00, "Off" }, - {0x0d, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0d, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0d, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0d, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0d, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0e, 0x01, 0x03, 0x02, "Easy" }, - {0x0e, 0x01, 0x03, 0x03, "Normal" }, - {0x0e, 0x01, 0x03, 0x01, "Hard" }, - {0x0e, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Multi-machine hookup" }, - {0x0e, 0x01, 0x04, 0x00, "Off" }, - {0x0e, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Player Truck" }, - {0x0e, 0x01, 0x08, 0x08, "Red" }, - {0x0e, 0x01, 0x08, 0x00, "Blue" }, - - {0 , 0xfe, 0 , 2 , "Reverse" }, - {0x0e, 0x01, 0x10, 0x10, "Normal" }, - {0x0e, 0x01, 0x10, 0x00, "Inverted" }, -}; - -STDDIPINFO(Dblaxle) - -static struct BurnDIPInfo PwheelsjDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0xff, NULL }, - {0x0e, 0xff, 0xff, 0xfb, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Gear Shift" }, - {0x0d, 0x01, 0x02, 0x02, "Normal" }, - {0x0d, 0x01, 0x02, 0x00, "Inverted" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0d, 0x01, 0x04, 0x04, "Off" }, - {0x0d, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x08, 0x00, "Off" }, - {0x0d, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0d, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0d, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0d, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0d, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0e, 0x01, 0x03, 0x02, "Easy" }, - {0x0e, 0x01, 0x03, 0x03, "Normal" }, - {0x0e, 0x01, 0x03, 0x01, "Hard" }, - {0x0e, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Multi-machine hookup" }, - {0x0e, 0x01, 0x04, 0x00, "Off" }, - {0x0e, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2 , "Player Truck" }, - {0x0e, 0x01, 0x08, 0x08, "Red" }, - {0x0e, 0x01, 0x08, 0x00, "Blue" }, - - {0 , 0xfe, 0 , 2 , "Reverse" }, - {0x0e, 0x01, 0x10, 0x10, "Normal" }, - {0x0e, 0x01, 0x10, 0x00, "Inverted" }, -}; - -STDDIPINFO(Pwheelsj) - -static struct BurnDIPInfo EnforceDIPList[]= -{ - // Default Values - {0x0c, 0xff, 0xff, 0xff, NULL }, - {0x0d, 0xff, 0xff, 0xef, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0c, 0x01, 0x04, 0x04, "Off" }, - {0x0c, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0c, 0x01, 0x08, 0x00, "Off" }, - {0x0c, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0c, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0c, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0c, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0c, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0c, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0c, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0c, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0c, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Background Scenery" }, - {0x0d, 0x01, 0x10, 0x10, "Crazy Scolling" }, - {0x0d, 0x01, 0x10, 0x00, "Normal" }, -}; - -STDDIPINFO(Enforce) - -static struct BurnDIPInfo NightstrDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xfe, NULL }, - {0x0c, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x01, 0x01, "Cockpit" }, - {0x0b, 0x01, 0x01, 0x00, "Upright" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x0b, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x0b, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x03, 0x02, "Easy" }, - {0x0c, 0x01, 0x03, 0x03, "Normal" }, - {0x0c, 0x01, 0x03, 0x01, "Hard" }, - {0x0c, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Shields" }, - {0x0c, 0x01, 0x0c, 0x08, "3" }, - {0x0c, 0x01, 0x0c, 0x04, "2" }, - {0x0c, 0x01, 0x0c, 0x0c, "1" }, - {0x0c, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Shields" }, - {0x0c, 0x01, 0x30, 0x00, "3" }, - {0x0c, 0x01, 0x30, 0x10, "4" }, - {0x0c, 0x01, 0x30, 0x30, "5" }, - {0x0c, 0x01, 0x30, 0x20, "6" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Trigger Turbo" }, - {0x0c, 0x01, 0x80, 0x80, "7 shots / seconds" }, - {0x0c, 0x01, 0x80, 0x00, "10 shots / seconds" }, -}; - -STDDIPINFO(Nightstr) - -static struct BurnDIPInfo NightstrjDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xfe, NULL }, - {0x0c, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x01, 0x01, "Cockpit" }, - {0x0b, 0x01, 0x01, 0x00, "Upright" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0b, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0b, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x03, 0x02, "Easy" }, - {0x0c, 0x01, 0x03, 0x03, "Normal" }, - {0x0c, 0x01, 0x03, 0x01, "Hard" }, - {0x0c, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Shields" }, - {0x0c, 0x01, 0x0c, 0x08, "3" }, - {0x0c, 0x01, 0x0c, 0x04, "2" }, - {0x0c, 0x01, 0x0c, 0x0c, "1" }, - {0x0c, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Shields" }, - {0x0c, 0x01, 0x30, 0x00, "3" }, - {0x0c, 0x01, 0x30, 0x10, "4" }, - {0x0c, 0x01, 0x30, 0x30, "5" }, - {0x0c, 0x01, 0x30, 0x20, "6" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Trigger Turbo" }, - {0x0c, 0x01, 0x80, 0x80, "7 shots / seconds" }, - {0x0c, 0x01, 0x80, 0x00, "10 shots / seconds" }, -}; - -STDDIPINFO(Nightstrj) - - -static struct BurnDIPInfo NightstruDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xfe, NULL }, - {0x0c, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x01, 0x01, "Cockpit" }, - {0x0b, 0x01, 0x01, 0x00, "Upright" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x0b, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x0b, 0x01, 0xc0, 0xc0, "Same as Start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0c, 0x01, 0x03, 0x02, "Easy" }, - {0x0c, 0x01, 0x03, 0x03, "Normal" }, - {0x0c, 0x01, 0x03, 0x01, "Hard" }, - {0x0c, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Bonus Shields" }, - {0x0c, 0x01, 0x0c, 0x08, "3" }, - {0x0c, 0x01, 0x0c, 0x04, "2" }, - {0x0c, 0x01, 0x0c, 0x0c, "1" }, - {0x0c, 0x01, 0x0c, 0x00, "None" }, - - {0 , 0xfe, 0 , 4 , "Shields" }, - {0x0c, 0x01, 0x30, 0x00, "3" }, - {0x0c, 0x01, 0x30, 0x10, "4" }, - {0x0c, 0x01, 0x30, 0x30, "5" }, - {0x0c, 0x01, 0x30, 0x20, "6" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x0c, 0x01, 0x40, 0x00, "Off" }, - {0x0c, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Trigger Turbo" }, - {0x0c, 0x01, 0x80, 0x80, "7 shots / seconds" }, - {0x0c, 0x01, 0x80, 0x00, "10 shots / seconds" }, -}; - -STDDIPINFO(Nightstru) - -static struct BurnDIPInfo RacingbDIPList[]= -{ - // Default Values - {0x0b, 0xff, 0xff, 0xff, NULL }, - {0x0c, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0b, 0x01, 0x01, 0x00, "Type 0" }, - {0x0b, 0x01, 0x01, 0x01, "Type 1" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0b, 0x01, 0x04, 0x04, "Off" }, - {0x0b, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0b, 0x01, 0x08, 0x00, "Off" }, - {0x0b, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x0b, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x0b, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x0b, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 2 , "Steering Wheel Range" }, - {0x0c, 0x01, 0x04, 0x04, "Normal" }, - {0x0c, 0x01, 0x04, 0x00, "High" }, - - {0 , 0xfe, 0 , 2 , "Steering Wheel Type" }, - {0x0c, 0x01, 0x08, 0x00, "Free" }, - {0x0c, 0x01, 0x08, 0x08, "Locked" }, - - {0 , 0xfe, 0 , 2 , "Network" }, - {0x0c, 0x01, 0x10, 0x10, "Off" }, - {0x0c, 0x01, 0x10, 0x00, "On" }, - - {0 , 0xfe, 0 , 4 , "Player Car" }, - {0x0c, 0x01, 0x60, 0x60, "Red" }, - {0x0c, 0x01, 0x60, 0x40, "Blue" }, - {0x0c, 0x01, 0x60, 0x20, "Green" }, - {0x0c, 0x01, 0x60, 0x00, "Yellow" }, -}; - -STDDIPINFO(Racingb) - -static struct BurnDIPInfo SciDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0xfe, NULL }, - {0x0e, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x01, 0x01, "Cockpit" }, - {0x0d, 0x01, 0x01, 0x00, "Upright" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0d, 0x01, 0x04, 0x04, "Off" }, - {0x0d, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x08, 0x00, "Off" }, - {0x0d, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0d, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0d, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0d, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x0d, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x0d, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0e, 0x01, 0x03, 0x02, "Easy" }, - {0x0e, 0x01, 0x03, 0x03, "Normal" }, - {0x0e, 0x01, 0x03, 0x01, "Hard" }, - {0x0e, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Timer Setting" }, - {0x0e, 0x01, 0x0c, 0x08, "70 Seconds" }, - {0x0e, 0x01, 0x0c, 0x04, "65 Seconds" }, - {0x0e, 0x01, 0x0c, 0x0c, "60 Seconds" }, - {0x0e, 0x01, 0x0c, 0x00, "55 Seconds" }, - - {0 , 0xfe, 0 , 2 , "Turbos Stocked" }, - {0x0e, 0x01, 0x10, 0x10, "3" }, - {0x0e, 0x01, 0x10, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Steering Radius" }, - {0x0e, 0x01, 0x20, 0x00, "270 Degree" }, - {0x0e, 0x01, 0x20, 0x20, "360 Degree" }, - - {0 , 0xfe, 0 , 2 , "Damage Cleared at Continue" }, - {0x0e, 0x01, 0x40, 0x00, "Off" }, - {0x0e, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Siren Volume" }, - {0x0e, 0x01, 0x80, 0x80, "Normal" }, - {0x0e, 0x01, 0x80, 0x00, "Low" }, -}; - -STDDIPINFO(Sci) - -static struct BurnDIPInfo ScijDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0xfe, NULL }, - {0x0e, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x01, 0x01, "Cockpit" }, - {0x0d, 0x01, 0x01, 0x00, "Upright" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0d, 0x01, 0x04, 0x04, "Off" }, - {0x0d, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x08, 0x00, "Off" }, - {0x0d, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x0d, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - {0x0d, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, - {0x0d, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, - {0x0d, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0e, 0x01, 0x03, 0x02, "Easy" }, - {0x0e, 0x01, 0x03, 0x03, "Normal" }, - {0x0e, 0x01, 0x03, 0x01, "Hard" }, - {0x0e, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Timer Setting" }, - {0x0e, 0x01, 0x0c, 0x08, "70 Seconds" }, - {0x0e, 0x01, 0x0c, 0x04, "65 Seconds" }, - {0x0e, 0x01, 0x0c, 0x0c, "60 Seconds" }, - {0x0e, 0x01, 0x0c, 0x00, "55 Seconds" }, - - {0 , 0xfe, 0 , 2 , "Turbos Stocked" }, - {0x0e, 0x01, 0x10, 0x10, "3" }, - {0x0e, 0x01, 0x10, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Steering Radius" }, - {0x0e, 0x01, 0x20, 0x00, "270 Degree" }, - {0x0e, 0x01, 0x20, 0x20, "360 Degree" }, - - {0 , 0xfe, 0 , 2 , "Damage Cleared at Continue" }, - {0x0e, 0x01, 0x40, 0x00, "Off" }, - {0x0e, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Siren Volume" }, - {0x0e, 0x01, 0x80, 0x80, "Normal" }, - {0x0e, 0x01, 0x80, 0x00, "Low" }, -}; - -STDDIPINFO(Scij) - -static struct BurnDIPInfo SciuDIPList[]= -{ - // Default Values - {0x0d, 0xff, 0xff, 0xfe, NULL }, - {0x0e, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Cabinet" }, - {0x0d, 0x01, 0x01, 0x01, "Cockpit" }, - {0x0d, 0x01, 0x01, 0x00, "Upright" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x0d, 0x01, 0x04, 0x04, "Off" }, - {0x0d, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x0d, 0x01, 0x08, 0x00, "Off" }, - {0x0d, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coinage" }, - {0x0d, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x0d, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x0d, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Price to Continue" }, - {0x0d, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, - {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, - {0x0d, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, - {0x0d, 0x01, 0xc0, 0xc0, "Same as Start" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x0e, 0x01, 0x03, 0x02, "Easy" }, - {0x0e, 0x01, 0x03, 0x03, "Normal" }, - {0x0e, 0x01, 0x03, 0x01, "Hard" }, - {0x0e, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 4 , "Timer Setting" }, - {0x0e, 0x01, 0x0c, 0x08, "70 Seconds" }, - {0x0e, 0x01, 0x0c, 0x04, "65 Seconds" }, - {0x0e, 0x01, 0x0c, 0x0c, "60 Seconds" }, - {0x0e, 0x01, 0x0c, 0x00, "55 Seconds" }, - - {0 , 0xfe, 0 , 2 , "Turbos Stocked" }, - {0x0e, 0x01, 0x10, 0x10, "3" }, - {0x0e, 0x01, 0x10, 0x00, "5" }, - - {0 , 0xfe, 0 , 2 , "Steering Radius" }, - {0x0e, 0x01, 0x20, 0x00, "270 Degree" }, - {0x0e, 0x01, 0x20, 0x20, "360 Degree" }, - - {0 , 0xfe, 0 , 2 , "Damage Cleared at Continue" }, - {0x0e, 0x01, 0x40, 0x00, "Off" }, - {0x0e, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Siren Volume" }, - {0x0e, 0x01, 0x80, 0x80, "Normal" }, - {0x0e, 0x01, 0x80, 0x00, "Low" }, -}; - -STDDIPINFO(Sciu) - -static struct BurnDIPInfo SpacegunDIPList[]= -{ - // Default Values - {0x10, 0xff, 0xff, 0xff, NULL }, - {0x11, 0xff, 0xff, 0xff, NULL }, - - // Dip 1 - {0 , 0xfe, 0 , 2 , "Always have gunsight power up" }, - {0x10, 0x01, 0x02, 0x02, "Off" }, - {0x10, 0x01, 0x02, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Service Mode" }, - {0x10, 0x01, 0x04, 0x04, "Off" }, - {0x10, 0x01, 0x04, 0x00, "On" }, - - {0 , 0xfe, 0 , 2 , "Demo Sounds" }, - {0x10, 0x01, 0x08, 0x00, "Off" }, - {0x10, 0x01, 0x08, 0x08, "On" }, - - {0 , 0xfe, 0 , 4 , "Coin A" }, - {0x10, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, - {0x10, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, - {0x10, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, - {0x10, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - - {0 , 0xfe, 0 , 4 , "Coin B" }, - {0x10, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, - {0x10, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, - {0x10, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, - {0x10, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - - // Dip 2 - {0 , 0xfe, 0 , 4 , "Difficulty" }, - {0x11, 0x01, 0x03, 0x02, "Easy" }, - {0x11, 0x01, 0x03, 0x03, "Normal" }, - {0x11, 0x01, 0x03, 0x01, "Hard" }, - {0x11, 0x01, 0x03, 0x00, "Hardest" }, - - {0 , 0xfe, 0 , 2 , "Allow Continue" }, - {0x11, 0x01, 0x40, 0x00, "Off" }, - {0x11, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2 , "Disable Pedal" }, - {0x11, 0x01, 0x80, 0x80, "Off" }, - {0x11, 0x01, 0x80, 0x00, "On" }, -}; - -STDDIPINFO(Spacegun) - -static struct BurnRomInfo AquajackRomDesc[] = { - { "b77-22.ic31", 0x20000, 0x67400dde, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b77-26.ic17", 0x20000, 0xcd4d0969, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b77-24.ic69", 0x20000, 0x95e643ed, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b77-23.ic67", 0x20000, 0x395a7d1c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b77-20.ic54", 0x10000, 0x84ba54b7, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b77-05.ic105", 0x80000, 0x7238f0ff, BRF_GRA | TAITO_CHARS }, - - { "b77-04.ic16", 0x80000, 0xbed0be6c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b77-03.ic15", 0x80000, 0x9a3030a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b77-02.ic14", 0x80000, 0xdaea0d2e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b77-01.ic13", 0x80000, 0xcdab000d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b77-07.ic33", 0x80000, 0x7db1fc5e, BRF_GRA | TAITO_ROAD }, - - { "b77-06.ic39", 0x80000, 0xce2aed00, BRF_GRA | TAITO_SPRITEMAP }, - - { "b77-09.ic58", 0x80000, 0x948e5ad9, BRF_SND | TAITO_YM2610A }, - - { "b77-08.ic57", 0x80000, 0x119b9485, BRF_SND | TAITO_YM2610B }, - - { "b77-17.ic1", 0x00100, 0xfbf81f30, BRF_OPT }, - { "b77-18.ic37", 0x00100, 0x7b7d8ff4, BRF_OPT }, -}; - -STD_ROM_PICK(Aquajack) -STD_ROM_FN(Aquajack) - -static struct BurnRomInfo AquajackuRomDesc[] = { - { "b77-22.ic31", 0x20000, 0x67400dde, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b77-25.ic17", 0x20000, 0xba4a39ff, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b77-24.ic69", 0x20000, 0x95e643ed, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b77-23.ic67", 0x20000, 0x395a7d1c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b77-20.ic54", 0x10000, 0x84ba54b7, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b77-05.ic105", 0x80000, 0x7238f0ff, BRF_GRA | TAITO_CHARS }, - - { "b77-04.ic16", 0x80000, 0xbed0be6c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b77-03.ic15", 0x80000, 0x9a3030a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b77-02.ic14", 0x80000, 0xdaea0d2e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b77-01.ic13", 0x80000, 0xcdab000d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b77-07.ic33", 0x80000, 0x7db1fc5e, BRF_GRA | TAITO_ROAD }, - - { "b77-06.ic39", 0x80000, 0xce2aed00, BRF_GRA | TAITO_SPRITEMAP }, - - { "b77-09.ic58", 0x80000, 0x948e5ad9, BRF_SND | TAITO_YM2610A }, - - { "b77-08.ic57", 0x80000, 0x119b9485, BRF_SND | TAITO_YM2610B }, - - { "b77-17.ic1", 0x00100, 0xfbf81f30, BRF_OPT }, - { "b77-18.ic37", 0x00100, 0x7b7d8ff4, BRF_OPT }, -}; - -STD_ROM_PICK(Aquajacku) -STD_ROM_FN(Aquajacku) - -static struct BurnRomInfo AquajackjRomDesc[] = { - { "b77-22.ic31", 0x20000, 0x67400dde, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b77-21.ic17", 0x20000, 0x23436845, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b77-24.ic69", 0x20000, 0x95e643ed, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b77-23.ic67", 0x20000, 0x395a7d1c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b77-20.ic54", 0x10000, 0x84ba54b7, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b77-05.ic105", 0x80000, 0x7238f0ff, BRF_GRA | TAITO_CHARS }, - - { "b77-04.ic16", 0x80000, 0xbed0be6c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b77-03.ic15", 0x80000, 0x9a3030a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b77-02.ic14", 0x80000, 0xdaea0d2e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b77-01.ic13", 0x80000, 0xcdab000d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b77-07.ic33", 0x80000, 0x7db1fc5e, BRF_GRA | TAITO_ROAD }, - - { "b77-06.ic39", 0x80000, 0xce2aed00, BRF_GRA | TAITO_SPRITEMAP }, - - { "b77-09.ic58", 0x80000, 0x948e5ad9, BRF_SND | TAITO_YM2610A }, - - { "b77-08.ic57", 0x80000, 0x119b9485, BRF_SND | TAITO_YM2610B }, - - { "b77-17.ic1", 0x00100, 0xfbf81f30, BRF_OPT }, - { "b77-18.ic37", 0x00100, 0x7b7d8ff4, BRF_OPT }, -}; - -STD_ROM_PICK(Aquajackj) -STD_ROM_FN(Aquajackj) - -static struct BurnRomInfo BsharkRomDesc[] = { - { "c34_71.98", 0x20000, 0xdf1fa629, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_69.75", 0x20000, 0xa54c137a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_70.97", 0x20000, 0xd77d81e2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_68.74", 0x20000, 0x4e374ce2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c34_74.128", 0x20000, 0x6869fa99, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_72.112", 0x20000, 0xc09c0f91, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_75.129", 0x20000, 0x6ba65542, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_73.113", 0x20000, 0xf2fe62b5, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c34_05.3", 0x80000, 0x596b83da, BRF_GRA | TAITO_CHARS }, - - { "c34_04.17", 0x80000, 0x2446b0da, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_03.16", 0x80000, 0xa18eab78, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_02.15", 0x80000, 0x8488ba10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_01.14", 0x80000, 0x3ebe8c63, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c34_07.42", 0x80000, 0xedb07808, BRF_GRA | TAITO_ROAD }, - - { "c34_06.12", 0x80000, 0xd200b6eb, BRF_GRA | TAITO_SPRITEMAP }, - - { "c34_08.127", 0x80000, 0x89a30450, BRF_SND | TAITO_YM2610A }, - - { "c34_09.126", 0x80000, 0x39d12b50, BRF_SND | TAITO_YM2610B }, - - { "c34_18.22", 0x10000, 0x7245a6f6, BRF_OPT }, - { "c34_19.72", 0x00100, 0x2ee9c404, BRF_OPT }, - { "c34_20.89", 0x00100, 0xfbf81f30, BRF_OPT }, - { "c34_21.7", 0x00400, 0x10728853, BRF_OPT }, - { "c34_22.8", 0x00400, 0x643e8bfc, BRF_OPT }, -}; - -STD_ROM_PICK(Bshark) -STD_ROM_FN(Bshark) - -static struct BurnRomInfo BsharkjRomDesc[] = { - { "c34_71.98", 0x20000, 0xdf1fa629, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_69.75", 0x20000, 0xa54c137a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_70.97", 0x20000, 0xd77d81e2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_66.74", 0x20000, 0xa0392dce, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c34_74.128", 0x20000, 0x6869fa99, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_72.112", 0x20000, 0xc09c0f91, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_75.129", 0x20000, 0x6ba65542, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_73.113", 0x20000, 0xf2fe62b5, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c34_05.3", 0x80000, 0x596b83da, BRF_GRA | TAITO_CHARS }, - - { "c34_04.17", 0x80000, 0x2446b0da, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_03.16", 0x80000, 0xa18eab78, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_02.15", 0x80000, 0x8488ba10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_01.14", 0x80000, 0x3ebe8c63, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c34_07.42", 0x80000, 0xedb07808, BRF_GRA | TAITO_ROAD }, - - { "c34_06.12", 0x80000, 0xd200b6eb, BRF_GRA | TAITO_SPRITEMAP }, - - { "c34_08.127", 0x80000, 0x89a30450, BRF_SND | TAITO_YM2610A }, - - { "c34_09.126", 0x80000, 0x39d12b50, BRF_SND | TAITO_YM2610B }, - - { "c34_18.22", 0x10000, 0x7245a6f6, BRF_OPT }, - { "c34_19.72", 0x00100, 0x2ee9c404, BRF_OPT }, - { "c34_20.89", 0x00100, 0xfbf81f30, BRF_OPT }, - { "c34_21.7", 0x00400, 0x10728853, BRF_OPT }, - { "c34_22.8", 0x00400, 0x643e8bfc, BRF_OPT }, -}; - -STD_ROM_PICK(Bsharkj) -STD_ROM_FN(Bsharkj) - -static struct BurnRomInfo BsharkjjsRomDesc[] = { - { "c34_79.98", 0x20000, 0xbc3f2e93, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_77.75", 0x20000, 0x917916d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_78.97", 0x20000, 0xf2fcc880, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_76.74", 0x20000, 0xde97fac0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c34_82.128", 0x20000, 0x6869fa99, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_80.112", 0x20000, 0xe1783eb4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_83.129", 0x20000, 0xeec0b364, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_81.113", 0x20000, 0x23ce6bcf, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c34_05.3", 0x80000, 0x596b83da, BRF_GRA | TAITO_CHARS }, - - { "c34_04.17", 0x80000, 0x2446b0da, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_03.16", 0x80000, 0xa18eab78, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_02.15", 0x80000, 0x8488ba10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_01.14", 0x80000, 0x3ebe8c63, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c34_07.42", 0x80000, 0xedb07808, BRF_GRA | TAITO_ROAD }, - - { "c34_06.12", 0x80000, 0xd200b6eb, BRF_GRA | TAITO_SPRITEMAP }, - - { "c34_08.127", 0x80000, 0x89a30450, BRF_SND | TAITO_YM2610A }, - - { "c34_09.126", 0x80000, 0x39d12b50, BRF_SND | TAITO_YM2610B }, - - { "c34_18.22", 0x10000, 0x7245a6f6, BRF_OPT }, - { "c34_19.72", 0x00100, 0x2ee9c404, BRF_OPT }, - { "c34_20.89", 0x00100, 0xfbf81f30, BRF_OPT }, - { "c34_21.7", 0x00400, 0x10728853, BRF_OPT }, - { "c34_22.8", 0x00400, 0x643e8bfc, BRF_OPT }, -}; - -STD_ROM_PICK(Bsharkjjs) -STD_ROM_FN(Bsharkjjs) - -static struct BurnRomInfo BsharkuRomDesc[] = { - { "c34_71.98", 0x20000, 0xdf1fa629, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_69.75", 0x20000, 0xa54c137a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_70.97", 0x20000, 0xd77d81e2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c34_67.74", 0x20000, 0x39307c74, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c34_74.128", 0x20000, 0x6869fa99, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_72.112", 0x20000, 0xc09c0f91, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_75.129", 0x20000, 0x6ba65542, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c34_73.113", 0x20000, 0xf2fe62b5, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c34_05.3", 0x80000, 0x596b83da, BRF_GRA | TAITO_CHARS }, - - { "c34_04.17", 0x80000, 0x2446b0da, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_03.16", 0x80000, 0xa18eab78, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_02.15", 0x80000, 0x8488ba10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c34_01.14", 0x80000, 0x3ebe8c63, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c34_07.42", 0x80000, 0xedb07808, BRF_GRA | TAITO_ROAD }, - - { "c34_06.12", 0x80000, 0xd200b6eb, BRF_GRA | TAITO_SPRITEMAP }, - - { "c34_08.127", 0x80000, 0x89a30450, BRF_SND | TAITO_YM2610A }, - - { "c34_09.126", 0x80000, 0x39d12b50, BRF_SND | TAITO_YM2610B }, - - { "c34_18.22", 0x10000, 0x7245a6f6, BRF_OPT }, - { "c34_19.72", 0x00100, 0x2ee9c404, BRF_OPT }, - { "c34_20.89", 0x00100, 0xfbf81f30, BRF_OPT }, - { "c34_21.7", 0x00400, 0x10728853, BRF_OPT }, - { "c34_22.8", 0x00400, 0x643e8bfc, BRF_OPT }, -}; - -STD_ROM_PICK(Bsharku) -STD_ROM_FN(Bsharku) - -static struct BurnRomInfo ChasehqRomDesc[] = { - { "b52-130.36", 0x20000, 0x4e7beb46, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b52-136.29", 0x20000, 0x2f414df0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b52-131.37", 0x20000, 0xaa945d83, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b52-129.30", 0x20000, 0x0eaebc08, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b52-132.39", 0x10000, 0xa2f54789, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b52-133.55", 0x10000, 0x12232f95, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b52-137.51", 0x10000, 0x37abb74a, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b52-29.27", 0x80000, 0x8366d27c, BRF_GRA | TAITO_CHARS}, - - { "b52-34.5", 0x80000, 0x7d8dce36, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b52-35.7", 0x80000, 0x78eeec0d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b52-36.9", 0x80000, 0x61e89e91, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b52-37.11", 0x80000, 0xf02e47b9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b52-30.4", 0x80000, 0x1b8cc647, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b52-31.6", 0x80000, 0xf1998e20, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b52-32.8", 0x80000, 0x8620780c, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b52-33.10", 0x80000, 0xe6f4b8c4, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - - { "b52-28.4", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, - - { "b52-38.34", 0x80000, 0x5b5bf7f6, BRF_GRA | TAITO_SPRITEMAP }, - - { "b52-115.71", 0x80000, 0x4e117e93, BRF_SND | TAITO_YM2610A }, - { "b52-114.72", 0x80000, 0x3a73d6b1, BRF_SND | TAITO_YM2610A }, - { "b52-113.73", 0x80000, 0x2c6a3a05, BRF_SND | TAITO_YM2610A }, - - { "b52-116.70", 0x80000, 0xad46983c, BRF_SND | TAITO_YM2610B }, - - { "b52-01.7", 0x00100, 0x89719d17, BRF_OPT }, - { "b52-03.135", 0x00400, 0xa3f8490d, BRF_OPT }, - { "b52-06.24", 0x00100, 0xfbf81f30, BRF_OPT }, - { "b52-18.93", 0x00100, 0x60bdaf1a, BRF_OPT }, - { "b52-18a", 0x00100, 0x6271be0d, BRF_OPT }, - { "b52-49.68", 0x02000, 0x60dd2ed1, BRF_OPT }, - { "b52-50.66", 0x10000, 0xc189781c, BRF_OPT }, - { "b52-51.65", 0x10000, 0x30cc1f79, BRF_OPT }, - { "b52-126.136", 0x00400, 0xfa2f840e, BRF_OPT }, - { "b52-127.156", 0x00400, 0x77682a4f, BRF_OPT }, - - { "pal20l8b-b52-17.ic18", 0x00144, 0x4851316d, BRF_OPT }, - { "pal20l8b-b52-17.ic16", 0x00144, 0x4851316d, BRF_OPT }, - { "pal20l8b-b52-17.ic53", 0x00144, 0x4851316d, BRF_OPT }, - { "pal20l8b-b52-17.ic55", 0x00144, 0x4851316d, BRF_OPT }, - { "pal16l8b-b52-19.ic33", 0x00104, 0x3ba292dc, BRF_OPT }, - { "pal16l8b-b52-20.ic35", 0x00104, 0xbd39ad73, BRF_OPT }, - { "pal16l8b-b52-21.ic51", 0x00104, 0x2fe76aa4, BRF_OPT }, - { "pal20l8b-b52-25.ic123", 0x00144, 0x372b632d, BRF_OPT }, - { "pal20l8b-b52-26.ic15", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-26.ic18", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-26.ic52", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-26.ic54", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-27.ic64", 0x00144, 0x61c2ab26, BRF_OPT }, - { "pal20l8b-b52-118.ic20", 0x00144, 0x9c5fe4af, BRF_OPT }, - { "pal20l8b-b52-119.ic21", 0x00144, 0x8b8e2106, BRF_OPT }, - { "pal16l8b-b52-120.ic56", 0x00104, 0x3e7effa0, BRF_OPT }, - { "pal20l8b-b52-121.ic57", 0x00144, 0x7056fd1d, BRF_OPT }, - { "pal16l8b-b52-122.ic124", 0x00104, 0x04c0fb04, BRF_OPT }, - { "pal16l8b-b52-123.ic125", 0x00104, 0x3865d1c8, BRF_OPT }, - { "pal16l8b-b52-124.ic180", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "pal16l8b-b52-125.ic112", 0x00104, 0x7628c557, BRF_OPT }, -}; - -STD_ROM_PICK(Chasehq) -STD_ROM_FN(Chasehq) - -static struct BurnRomInfo ChasehqjRomDesc[] = { - { "b52-140.36", 0x20000, 0xc1298a4b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b52-139.29", 0x20000, 0x997f732e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b52-131.37", 0x20000, 0xaa945d83, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b52-129.30", 0x20000, 0x0eaebc08, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b52-132.39", 0x10000, 0xa2f54789, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b52-133.55", 0x10000, 0x12232f95, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b52-134.51", 0x10000, 0x91faac7f, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b52-29.27", 0x80000, 0x8366d27c, BRF_GRA | TAITO_CHARS }, - - { "b52-34.5", 0x80000, 0x7d8dce36, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b52-35.7", 0x80000, 0x78eeec0d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b52-36.9", 0x80000, 0x61e89e91, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b52-37.11", 0x80000, 0xf02e47b9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b52-30.4", 0x80000, 0x1b8cc647, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b52-31.6", 0x80000, 0xf1998e20, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b52-32.8", 0x80000, 0x8620780c, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b52-33.10", 0x80000, 0xe6f4b8c4, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - - { "b52-28.4", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, - - { "b52-38.34", 0x80000, 0x5b5bf7f6, BRF_GRA | TAITO_SPRITEMAP }, - - { "b52-41.71", 0x80000, 0x8204880c, BRF_SND | TAITO_YM2610A }, - { "b52-40.72", 0x80000, 0xf0551055, BRF_SND | TAITO_YM2610A }, - { "b52-39.73", 0x80000, 0xac9cbbd3, BRF_SND | TAITO_YM2610A }, - - { "b52-42.70", 0x80000, 0x6e617df1, BRF_SND | TAITO_YM2610B }, - - { "b52-01.7", 0x00100, 0x89719d17, BRF_OPT }, - { "b52-03.135", 0x00400, 0xa3f8490d, BRF_OPT }, - { "b52-06.24", 0x00100, 0xfbf81f30, BRF_OPT }, - { "b52-18.93", 0x00100, 0x60bdaf1a, BRF_OPT }, - { "b52-18a", 0x00100, 0x6271be0d, BRF_OPT }, - { "b52-49.68", 0x02000, 0x60dd2ed1, BRF_OPT }, - { "b52-50.66", 0x10000, 0xc189781c, BRF_OPT }, - { "b52-51.65", 0x10000, 0x30cc1f79, BRF_OPT }, - { "b52-126.136", 0x00400, 0xfa2f840e, BRF_OPT }, - { "b52-127.156", 0x00400, 0x77682a4f, BRF_OPT }, - - { "pal20l8b-b52-17.ic18", 0x00144, 0x4851316d, BRF_OPT }, - { "pal20l8b-b52-17.ic16", 0x00144, 0x4851316d, BRF_OPT }, - { "pal20l8b-b52-17.ic53", 0x00144, 0x4851316d, BRF_OPT }, - { "pal20l8b-b52-17.ic55", 0x00144, 0x4851316d, BRF_OPT }, - { "pal16l8b-b52-19.ic33", 0x00104, 0x3ba292dc, BRF_OPT }, - { "pal16l8b-b52-20.ic35", 0x00104, 0xbd39ad73, BRF_OPT }, - { "pal16l8b-b52-21.ic51", 0x00104, 0x2fe76aa4, BRF_OPT }, - { "pal20l8b-b52-25.ic123", 0x00144, 0x372b632d, BRF_OPT }, - { "pal20l8b-b52-26.ic15", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-26.ic18", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-26.ic52", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-26.ic54", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-27.ic64", 0x00144, 0x61c2ab26, BRF_OPT }, - { "pal20l8b-b52-118.ic20", 0x00144, 0x9c5fe4af, BRF_OPT }, - { "pal20l8b-b52-119.ic21", 0x00144, 0x8b8e2106, BRF_OPT }, - { "pal16l8b-b52-120.ic56", 0x00104, 0x3e7effa0, BRF_OPT }, - { "pal20l8b-b52-121.ic57", 0x00144, 0x7056fd1d, BRF_OPT }, - { "pal16l8b-b52-122.ic124", 0x00104, 0x04c0fb04, BRF_OPT }, - { "pal16l8b-b52-123.ic125", 0x00104, 0x3865d1c8, BRF_OPT }, - { "pal16l8b-b52-124.ic180", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "pal16l8b-b52-125.ic112", 0x00104, 0x7628c557, BRF_OPT }, -}; - -STD_ROM_PICK(Chasehqj) -STD_ROM_FN(Chasehqj) - -static struct BurnRomInfo ChasehquRomDesc[] = { - { "b52-138.36", 0x20000, 0x8b71fe51, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b52-135.29", 0x20000, 0x5ba56a7c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b52-131.37", 0x20000, 0xaa945d83, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b52-129.30", 0x20000, 0x0eaebc08, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b52-132.39", 0x10000, 0xa2f54789, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b52-133.55", 0x10000, 0x12232f95, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b52-137.51", 0x10000, 0x37abb74a, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b52-29.27", 0x80000, 0x8366d27c, BRF_GRA | TAITO_CHARS}, - - { "b52-34.5", 0x80000, 0x7d8dce36, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b52-35.7", 0x80000, 0x78eeec0d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b52-36.9", 0x80000, 0x61e89e91, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b52-37.11", 0x80000, 0xf02e47b9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b52-30.4", 0x80000, 0x1b8cc647, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b52-31.6", 0x80000, 0xf1998e20, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b52-32.8", 0x80000, 0x8620780c, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b52-33.10", 0x80000, 0xe6f4b8c4, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - - { "b52-28.4", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, - - { "b52-38.34", 0x80000, 0x5b5bf7f6, BRF_GRA | TAITO_SPRITEMAP }, - - { "b52-115.71", 0x80000, 0x4e117e93, BRF_SND | TAITO_YM2610A }, - { "b52-114.72", 0x80000, 0x3a73d6b1, BRF_SND | TAITO_YM2610A }, - { "b52-113.73", 0x80000, 0x2c6a3a05, BRF_SND | TAITO_YM2610A }, - - { "b52-116.70", 0x80000, 0xad46983c, BRF_SND | TAITO_YM2610B }, - - { "b52-01.7", 0x00100, 0x89719d17, BRF_OPT }, - { "b52-03.135", 0x00400, 0xa3f8490d, BRF_OPT }, - { "b52-06.24", 0x00100, 0xfbf81f30, BRF_OPT }, - { "b52-18.93", 0x00100, 0x60bdaf1a, BRF_OPT }, - { "b52-18a", 0x00100, 0x6271be0d, BRF_OPT }, - { "b52-49.68", 0x02000, 0x60dd2ed1, BRF_OPT }, - { "b52-50.66", 0x10000, 0xc189781c, BRF_OPT }, - { "b52-51.65", 0x10000, 0x30cc1f79, BRF_OPT }, - { "b52-126.136", 0x00400, 0xfa2f840e, BRF_OPT }, - { "b52-127.156", 0x00400, 0x77682a4f, BRF_OPT }, - - { "pal20l8b-b52-17.ic18", 0x00144, 0x4851316d, BRF_OPT }, - { "pal20l8b-b52-17.ic16", 0x00144, 0x4851316d, BRF_OPT }, - { "pal20l8b-b52-17.ic53", 0x00144, 0x4851316d, BRF_OPT }, - { "pal20l8b-b52-17.ic55", 0x00144, 0x4851316d, BRF_OPT }, - { "pal16l8b-b52-19.ic33", 0x00104, 0x3ba292dc, BRF_OPT }, - { "pal16l8b-b52-20.ic35", 0x00104, 0xbd39ad73, BRF_OPT }, - { "pal16l8b-b52-21.ic51", 0x00104, 0x2fe76aa4, BRF_OPT }, - { "pal20l8b-b52-25.ic123", 0x00144, 0x372b632d, BRF_OPT }, - { "pal20l8b-b52-26.ic15", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-26.ic18", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-26.ic52", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-26.ic54", 0x00144, 0xd94f2bc2, BRF_OPT }, - { "pal20l8b-b52-27.ic64", 0x00144, 0x61c2ab26, BRF_OPT }, - { "pal20l8b-b52-118.ic20", 0x00144, 0x9c5fe4af, BRF_OPT }, - { "pal20l8b-b52-119.ic21", 0x00144, 0x8b8e2106, BRF_OPT }, - { "pal16l8b-b52-120.ic56", 0x00104, 0x3e7effa0, BRF_OPT }, - { "pal20l8b-b52-121.ic57", 0x00144, 0x7056fd1d, BRF_OPT }, - { "pal16l8b-b52-122.ic124", 0x00104, 0x04c0fb04, BRF_OPT }, - { "pal16l8b-b52-123.ic125", 0x00104, 0x3865d1c8, BRF_OPT }, - { "pal16l8b-b52-124.ic180", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, - { "pal16l8b-b52-125.ic112", 0x00104, 0x7628c557, BRF_OPT }, -}; - -STD_ROM_PICK(Chasehqu) -STD_ROM_FN(Chasehqu) - -static struct BurnRomInfo ContcircRomDesc[] = { - { "ic25", 0x20000, 0xf5c92e42, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "ic26", 0x20000, 0xe7c1d1fa, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "ic35", 0x20000, 0x16522f2d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "cc_36.bin", 0x20000, 0xa1732ea5, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b33-30.11", 0x10000, 0xd8746234, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b33-02.57", 0x80000, 0xf6fb3ba2, BRF_GRA | TAITO_CHARS }, - - { "b33-06", 0x80000, 0x2cb40599, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b33-05", 0x80000, 0xbddf9eea, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b33-04", 0x80000, 0x8df866a2, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b33-03", 0x80000, 0x4f6c36d9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b33-01.3", 0x80000, 0xf11f2be8, BRF_GRA | TAITO_ROAD }, - - { "b33-07.64", 0x80000, 0x151e1f52, BRF_GRA | TAITO_SPRITEMAP }, - - { "b33-09.18", 0x80000, 0x1e6724b5, BRF_SND | TAITO_YM2610A }, - { "b33-10.17", 0x80000, 0xe9ce03ab, BRF_SND | TAITO_YM2610A }, - - { "b33-08.19", 0x80000, 0xcaa1c4c8, BRF_SND | TAITO_YM2610B }, - - { "b14-30.97", 0x10000, 0xdccb0c7f, BRF_OPT }, - { "b14-31.50", 0x02000, 0x5c6b013d, BRF_OPT }, - { "b33-17.16", 0x00100, 0x7b7d8ff4, BRF_OPT }, - { "b33-18.17", 0x00100, 0xfbf81f30, BRF_OPT }, -}; - -STD_ROM_PICK(Contcirc) -STD_ROM_FN(Contcirc) - -static struct BurnRomInfo ContcircuRomDesc[] = { - { "ic25", 0x20000, 0xf5c92e42, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "ic26", 0x20000, 0xe7c1d1fa, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "ic35", 0x20000, 0x16522f2d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "ic36", 0x20000, 0xd6741e33, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b33-30.11", 0x10000, 0xd8746234, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b33-02.57", 0x80000, 0xf6fb3ba2, BRF_GRA | TAITO_CHARS }, - - { "b33-06", 0x80000, 0x2cb40599, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b33-05", 0x80000, 0xbddf9eea, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b33-04", 0x80000, 0x8df866a2, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b33-03", 0x80000, 0x4f6c36d9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b33-01.3", 0x80000, 0xf11f2be8, BRF_GRA | TAITO_ROAD }, - - { "b33-07.64", 0x80000, 0x151e1f52, BRF_GRA | TAITO_SPRITEMAP }, - - { "b33-09.18", 0x80000, 0x1e6724b5, BRF_SND | TAITO_YM2610A }, - { "b33-10.17", 0x80000, 0xe9ce03ab, BRF_SND | TAITO_YM2610A }, - - { "b33-08.19", 0x80000, 0xcaa1c4c8, BRF_SND | TAITO_YM2610B }, - - { "b14-30.97", 0x10000, 0xdccb0c7f, BRF_OPT }, - { "b14-31.50", 0x02000, 0x5c6b013d, BRF_OPT }, - { "b33-17.16", 0x00100, 0x7b7d8ff4, BRF_OPT }, - { "b33-18.17", 0x00100, 0xfbf81f30, BRF_OPT }, -}; - -STD_ROM_PICK(Contcircu) -STD_ROM_FN(Contcircu) - -static struct BurnRomInfo ContcircuaRomDesc[] = { - { "b33-34.ic25", 0x20000, 0xe1e016c1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b33-33.ic26", 0x20000, 0xf539d44b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "21-2.ic35", 0x20000, 0x2723f9e3, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "31-1.ic36", 0x20000, 0x438431f7, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b33-30.11", 0x10000, 0xd8746234, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b33-02.57", 0x80000, 0xf6fb3ba2, BRF_GRA | TAITO_CHARS }, - - { "b33-06", 0x80000, 0x2cb40599, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b33-05", 0x80000, 0xbddf9eea, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b33-04", 0x80000, 0x8df866a2, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b33-03", 0x80000, 0x4f6c36d9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b33-01.3", 0x80000, 0xf11f2be8, BRF_GRA | TAITO_ROAD }, - - { "b33-07.64", 0x80000, 0x151e1f52, BRF_GRA | TAITO_SPRITEMAP }, - - { "b33-09.18", 0x80000, 0x1e6724b5, BRF_SND | TAITO_YM2610A }, - { "b33-10.17", 0x80000, 0xe9ce03ab, BRF_SND | TAITO_YM2610A }, - - { "b33-08.19", 0x80000, 0xcaa1c4c8, BRF_SND | TAITO_YM2610B }, - - { "b14-30.97", 0x10000, 0xdccb0c7f, BRF_OPT }, - { "b14-31.50", 0x02000, 0x5c6b013d, BRF_OPT }, - { "b33-17.16", 0x00100, 0x7b7d8ff4, BRF_OPT }, - { "b33-18.17", 0x00100, 0xfbf81f30, BRF_OPT }, -}; - -STD_ROM_PICK(Contcircua) -STD_ROM_FN(Contcircua) - -static struct BurnRomInfo DblaxleRomDesc[] = { - { "c78-41-1.2", 0x020000, 0xcf297fe4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c78-43-1.4", 0x020000, 0x38a8bad6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c78-42-1.3", 0x020000, 0x4124ab2b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c78-44-1.5", 0x020000, 0x50a55b6e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c78-30-1.35", 0x020000, 0x026aac18, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c78-31-1.36", 0x020000, 0x67ce23e8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c78-34.c42", 0x020000, 0xf2186943, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c78-10.12", 0x080000, 0x44b1897c, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "c78-11.11", 0x080000, 0x7db3d4a3, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "c78-08.25", 0x100000, 0x6c725211, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c78-07.33", 0x100000, 0x9da00d5b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c78-06.23", 0x100000, 0x8309e91b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c78-05.31", 0x100000, 0x90001f68, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c78-09.12", 0x080000, 0x0dbde6f5, BRF_GRA | TAITO_ROAD }, - - { "c78-04.3", 0x080000, 0xcc1aa37c, BRF_GRA | TAITO_SPRITEMAP }, - - { "c78-12.33", 0x100000, 0xb0267404, BRF_SND | TAITO_YM2610A }, - { "c78-13.46", 0x080000, 0x1b363aa2, BRF_SND | TAITO_YM2610A }, - - { "c78-14.31", 0x080000, 0x9cad4dfb, BRF_SND | TAITO_YM2610B }, - - { "c78-25.15", 0x010000, 0x7245a6f6, BRF_OPT }, - { "c78-15.22", 0x000100, 0xfbf81f30, BRF_OPT }, - { "c78-21.74", 0x000100, 0x2926bf27, BRF_OPT }, - { "c84-10.16", 0x000400, 0x643e8bfc, BRF_OPT }, - { "c84-11.17", 0x000400, 0x10728853, BRF_OPT }, -}; - -STD_ROM_PICK(Dblaxle) -STD_ROM_FN(Dblaxle) - -static struct BurnRomInfo PwheelsjRomDesc[] = { - { "c78-26-2.2", 0x020000, 0x25c8eb2e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c78-28-2.4", 0x020000, 0xa9500eb1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c78-27-2.3", 0x020000, 0x08d2cffb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c78-29-2.5", 0x020000, 0xe1608004, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c78-30-1.35", 0x020000, 0x026aac18, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c78-31-1.36", 0x020000, 0x67ce23e8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c78-32.42", 0x020000, 0x1494199c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c78-10.12", 0x080000, 0x44b1897c, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "c78-11.11", 0x080000, 0x7db3d4a3, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "c78-08.25", 0x100000, 0x6c725211, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c78-07.33", 0x100000, 0x9da00d5b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c78-06.23", 0x100000, 0x8309e91b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c78-05.31", 0x100000, 0x90001f68, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c78-09.12", 0x080000, 0x0dbde6f5, BRF_GRA | TAITO_ROAD }, - - { "c78-04.3", 0x080000, 0xcc1aa37c, BRF_GRA | TAITO_SPRITEMAP }, - - { "c78-01.33", 0x100000, 0x90ff1e72, BRF_SND | TAITO_YM2610A }, - { "c78-02.46", 0x080000, 0x8882d2b7, BRF_SND | TAITO_YM2610A }, - - { "c78-03.31", 0x080000, 0x9b926a2f, BRF_SND | TAITO_YM2610B }, - - { "c78-25.15", 0x010000, 0x7245a6f6, BRF_OPT }, - { "c78-15.22", 0x000100, 0xfbf81f30, BRF_OPT }, - { "c78-21.74", 0x000100, 0x2926bf27, BRF_OPT }, - { "c84-10.16", 0x000400, 0x643e8bfc, BRF_OPT }, - { "c84-11.17", 0x000400, 0x10728853, BRF_OPT }, -}; - -STD_ROM_PICK(Pwheelsj) -STD_ROM_FN(Pwheelsj) - -static struct BurnRomInfo EnforceRomDesc[] = { - { "b58-27.27", 0x20000, 0xa1aa0191, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b58-19.19", 0x20000, 0x40f43da3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b58-26.26", 0x20000, 0xe823c85c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b58-18.18", 0x20000, 0x65328a3e, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b58-32.41", 0x10000, 0xf3fd8eca, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b58-09.13", 0x80000, 0x9ffd5b31, BRF_GRA | TAITO_CHARS }, - - { "b58-04.7", 0x80000, 0x9482f08d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b58-03.6", 0x80000, 0x158bc440, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b58-02.2", 0x80000, 0x6a6e307c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b58-01.1", 0x80000, 0x01e9f0a8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b58-06.116", 0x80000, 0xb3495d70, BRF_GRA | TAITO_ROAD }, - - { "b58-05.71", 0x80000, 0xd1f4991b, BRF_GRA | TAITO_SPRITEMAP }, - - { "b58-07.11", 0x80000, 0xeeb5ba08, BRF_SND | TAITO_YM2610A }, - { "b58-08.12", 0x80000, 0x049243cf, BRF_SND | TAITO_YM2610A }, - - { "b58-10.14", 0x80000, 0xedce0cc1, BRF_SND | TAITO_YM2610B }, - - { "b58-26a.104", 0x10000, 0xdccb0c7f, BRF_OPT }, - { "b58-27.56", 0x02000, 0x5c6b013d, BRF_OPT }, - { "b58-23.52", 0x00100, 0x7b7d8ff4, BRF_OPT }, - { "b58-24.51", 0x00100, 0xfbf81f30, BRF_OPT }, - { "b58-25.75", 0x00100, 0xde547342, BRF_OPT }, -}; - -STD_ROM_PICK(Enforce) -STD_ROM_FN(Enforce) - -static struct BurnRomInfo NightstrRomDesc[] = { - { "b91-45.bin", 0x20000, 0x7ad63421, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b91-44.bin", 0x20000, 0x4bc30adf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b91-43.bin", 0x20000, 0x3e6f727a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b91-47.bin", 0x20000, 0x9f778e03, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b91-39.bin", 0x20000, 0x725b23ae, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b91-40.bin", 0x20000, 0x81fb364d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b91-41.bin", 0x20000, 0x2694bb42, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b91-11.bin", 0x80000, 0xfff8ce31, BRF_GRA | TAITO_CHARS }, - - { "b91-04.bin", 0x80000, 0x8ca1970d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b91-03.bin", 0x80000, 0xcd5fed39, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b91-02.bin", 0x80000, 0x457c64b8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b91-01.bin", 0x80000, 0x3731d94f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b91-08.bin", 0x80000, 0x66f35c34, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b91-07.bin", 0x80000, 0x4d8ec6cf, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b91-06.bin", 0x80000, 0xa34dc839, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b91-05.bin", 0x80000, 0x5e72ac90, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - - { "b91-10.bin", 0x80000, 0x1d8f05b4, BRF_GRA | TAITO_ROAD }, - - { "b91-09.bin", 0x80000, 0x5f247ca2, BRF_GRA | TAITO_SPRITEMAP }, - - { "b91-13.bin", 0x80000, 0x8c7bf0f5, BRF_SND | TAITO_YM2610A }, - { "b91-12.bin", 0x80000, 0xda77c7af, BRF_SND | TAITO_YM2610A }, - - { "b91-14.bin", 0x80000, 0x6bc314d3, BRF_SND | TAITO_YM2610B }, - - { "b91-26.bin", 0x00400, 0x77682a4f, BRF_OPT }, - { "b91-27.bin", 0x00400, 0xa3f8490d, BRF_OPT }, - { "b91-28.bin", 0x00400, 0xfa2f840e, BRF_OPT }, - { "b91-29.bin", 0x02000, 0xad685be8, BRF_OPT }, - { "b91-30.bin", 0x10000, 0x30cc1f79, BRF_OPT }, - { "b91-31.bin", 0x10000, 0xc189781c, BRF_OPT }, - { "b91-32.bin", 0x00100, 0xfbf81f30, BRF_OPT }, - { "b91-33.bin", 0x00100, 0x89719d17, BRF_OPT }, -}; - -STD_ROM_PICK(Nightstr) -STD_ROM_FN(Nightstr) - -static struct BurnRomInfo NightstrjRomDesc[] = { - { "b91-45.bin", 0x20000, 0x7ad63421, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b91-44.bin", 0x20000, 0x4bc30adf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b91-43.bin", 0x20000, 0x3e6f727a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b91-42.bin", 0x20000, 0x7179ef2f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b91-39.bin", 0x20000, 0x725b23ae, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b91-40.bin", 0x20000, 0x81fb364d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b91-41.bin", 0x20000, 0x2694bb42, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b91-11.bin", 0x80000, 0xfff8ce31, BRF_GRA | TAITO_CHARS }, - - { "b91-04.bin", 0x80000, 0x8ca1970d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b91-03.bin", 0x80000, 0xcd5fed39, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b91-02.bin", 0x80000, 0x457c64b8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b91-01.bin", 0x80000, 0x3731d94f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b91-08.bin", 0x80000, 0x66f35c34, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b91-07.bin", 0x80000, 0x4d8ec6cf, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b91-06.bin", 0x80000, 0xa34dc839, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b91-05.bin", 0x80000, 0x5e72ac90, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - - { "b91-10.bin", 0x80000, 0x1d8f05b4, BRF_GRA | TAITO_ROAD }, - - { "b91-09.bin", 0x80000, 0x5f247ca2, BRF_GRA | TAITO_SPRITEMAP }, - - { "b91-13.bin", 0x80000, 0x8c7bf0f5, BRF_SND | TAITO_YM2610A }, - { "b91-12.bin", 0x80000, 0xda77c7af, BRF_SND | TAITO_YM2610A }, - - { "b91-14.bin", 0x80000, 0x6bc314d3, BRF_SND | TAITO_YM2610B }, - - { "b91-26.bin", 0x00400, 0x77682a4f, BRF_OPT }, - { "b91-27.bin", 0x00400, 0xa3f8490d, BRF_OPT }, - { "b91-28.bin", 0x00400, 0xfa2f840e, BRF_OPT }, - { "b91-29.bin", 0x02000, 0xad685be8, BRF_OPT }, - { "b91-30.bin", 0x10000, 0x30cc1f79, BRF_OPT }, - { "b91-31.bin", 0x10000, 0xc189781c, BRF_OPT }, - { "b91-32.bin", 0x00100, 0xfbf81f30, BRF_OPT }, - { "b91-33.bin", 0x00100, 0x89719d17, BRF_OPT }, -}; - -STD_ROM_PICK(Nightstrj) -STD_ROM_FN(Nightstrj) - -static struct BurnRomInfo NightstruRomDesc[] = { - { "b91-45.bin", 0x20000, 0x7ad63421, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b91-44.bin", 0x20000, 0x4bc30adf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b91-43.bin", 0x20000, 0x3e6f727a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "b91-46.bin", 0x20000, 0xe870be95, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "b91-39.bin", 0x20000, 0x725b23ae, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "b91-40.bin", 0x20000, 0x81fb364d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "b91-41.bin", 0x20000, 0x2694bb42, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "b91-11.bin", 0x80000, 0xfff8ce31, BRF_GRA | TAITO_CHARS }, - - { "b91-04.bin", 0x80000, 0x8ca1970d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b91-03.bin", 0x80000, 0xcd5fed39, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b91-02.bin", 0x80000, 0x457c64b8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "b91-01.bin", 0x80000, 0x3731d94f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "b91-08.bin", 0x80000, 0x66f35c34, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b91-07.bin", 0x80000, 0x4d8ec6cf, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b91-06.bin", 0x80000, 0xa34dc839, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - { "b91-05.bin", 0x80000, 0x5e72ac90, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, - - { "b91-10.bin", 0x80000, 0x1d8f05b4, BRF_GRA | TAITO_ROAD }, - - { "b91-09.bin", 0x80000, 0x5f247ca2, BRF_GRA | TAITO_SPRITEMAP }, - - { "b91-13.bin", 0x80000, 0x8c7bf0f5, BRF_SND | TAITO_YM2610A }, - { "b91-12.bin", 0x80000, 0xda77c7af, BRF_SND | TAITO_YM2610A }, - - { "b91-14.bin", 0x80000, 0x6bc314d3, BRF_SND | TAITO_YM2610B }, - - { "b91-26.bin", 0x00400, 0x77682a4f, BRF_OPT }, - { "b91-27.bin", 0x00400, 0xa3f8490d, BRF_OPT }, - { "b91-28.bin", 0x00400, 0xfa2f840e, BRF_OPT }, - { "b91-29.bin", 0x02000, 0xad685be8, BRF_OPT }, - { "b91-30.bin", 0x10000, 0x30cc1f79, BRF_OPT }, - { "b91-31.bin", 0x10000, 0xc189781c, BRF_OPT }, - { "b91-32.bin", 0x00100, 0xfbf81f30, BRF_OPT }, - { "b91-33.bin", 0x00100, 0x89719d17, BRF_OPT }, -}; - -STD_ROM_PICK(Nightstru) -STD_ROM_FN(Nightstru) - -static struct BurnRomInfo RacingbRomDesc[] = { - { "c84-110.3", 0x020000, 0x119a8d3b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c84-111.5", 0x020000, 0x1f095692, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c84-104.2", 0x020000, 0x37077fc6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c84-103.4", 0x020000, 0x4ca1d1c2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c84-99.35", 0x020000, 0x24778f40, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c84-100.36", 0x020000, 0x2b99258a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c84-101.42", 0x020000, 0x9322106e, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c84-90.12", 0x080000, 0x83ee0e8d, BRF_GRA | TAITO_CHARS_BYTESWAP }, - { "c84-89.11", 0x080000, 0xaae43c87, BRF_GRA | TAITO_CHARS_BYTESWAP }, - - { "c84-92.25", 0x100000, 0x56e8fd55, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c84-94.33", 0x100000, 0x6117c19b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c84-91.23", 0x100000, 0xb1b0146c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c84-93.31", 0x100000, 0x8837bb4e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c84-84.12", 0x080000, 0x34dc486b, BRF_GRA | TAITO_ROAD }, - - { "c84-88.3", 0x080000, 0xedd1f49c, BRF_GRA | TAITO_SPRITEMAP }, - - { "c84-86.33", 0x100000, 0x98d9771e, BRF_SND | TAITO_YM2610A }, - { "c84-87.46", 0x080000, 0x9c1dd80c, BRF_SND | TAITO_YM2610A }, - - { "c84-85.31", 0x080000, 0x24cd838d, BRF_SND | TAITO_YM2610B }, - - { "c84-19.15", 0x010000, 0x7245a6f6, BRF_OPT }, - { "c84-07.22", 0x000100, 0x95a15c77, BRF_OPT }, - { "c84-09.74", 0x000100, 0x71217472, BRF_OPT }, - { "c84-10.16", 0x000400, 0x643e8bfc, BRF_OPT }, - { "c84-11.17", 0x000400, 0x10728853, BRF_OPT }, -}; - -STD_ROM_PICK(Racingb) -STD_ROM_FN(Racingb) - -static struct BurnRomInfo SciRomDesc[] = { - { "c09-37.43", 0x20000, 0x0fecea17, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-38.40", 0x20000, 0xe46ebd9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-42.38", 0x20000, 0xf4404f87, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-39.41", 0x20000, 0xde87bcb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c09-33.6", 0x10000, 0xcf4e6c5b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c09-32.5", 0x10000, 0xa4713719, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c09-34.31", 0x20000, 0xa21b3151, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c09-05.16", 0x80000, 0x890b38f0, BRF_GRA | TAITO_CHARS }, - - { "c09-04.52", 0x80000, 0x2cbb3c9b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-02.53", 0x80000, 0xa83a0389, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-03.54", 0x80000, 0xa31d0e80, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-01.55", 0x80000, 0x64bfea10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c09-07.15", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, - - { "c09-06.37", 0x80000, 0x12df6d7b, BRF_GRA | TAITO_SPRITEMAP }, - - { "c09-14.42", 0x80000, 0xad78bf46, BRF_SND | TAITO_YM2610A }, - { "c09-13.43", 0x80000, 0xd57c41d3, BRF_SND | TAITO_YM2610A }, - { "c09-12.44", 0x80000, 0x56c99fa5, BRF_SND | TAITO_YM2610A }, - - { "c09-15.29", 0x80000, 0xe63b9095, BRF_SND | TAITO_YM2610B }, - - { "c09-16.17", 0x10000, 0x7245a6f6, BRF_OPT }, - { "c09-20.71", 0x00100, 0xcd8ffd80, BRF_OPT }, - { "c09-23.14", 0x00100, 0xfbf81f30, BRF_OPT }, -}; - -STD_ROM_PICK(Sci) -STD_ROM_FN(Sci) - -static struct BurnRomInfo SciaRomDesc[] = { - { "c09-28.43", 0x20000, 0x630dbaad, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-30.40", 0x20000, 0x68b1a97d, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-36.38", 0x20000, 0x59e47cba, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-31.41", 0x20000, 0x962b1fbf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c09-33.6", 0x10000, 0xcf4e6c5b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c09-32.5", 0x10000, 0xa4713719, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c09-34.31", 0x20000, 0xa21b3151, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c09-05.16", 0x80000, 0x890b38f0, BRF_GRA | TAITO_CHARS }, - - { "c09-04.52", 0x80000, 0x2cbb3c9b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-02.53", 0x80000, 0xa83a0389, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-03.54", 0x80000, 0xa31d0e80, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-01.55", 0x80000, 0x64bfea10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c09-07.15", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, - - { "c09-06.37", 0x80000, 0x12df6d7b, BRF_GRA | TAITO_SPRITEMAP }, - - { "c09-14.42", 0x80000, 0xad78bf46, BRF_SND | TAITO_YM2610A }, - { "c09-13.43", 0x80000, 0xd57c41d3, BRF_SND | TAITO_YM2610A }, - { "c09-12.44", 0x80000, 0x56c99fa5, BRF_SND | TAITO_YM2610A }, - - { "c09-15.29", 0x80000, 0xe63b9095, BRF_SND | TAITO_YM2610B }, - - { "c09-16.17", 0x10000, 0x7245a6f6, BRF_OPT }, - { "c09-20.71", 0x00100, 0xcd8ffd80, BRF_OPT }, - { "c09-23.14", 0x00100, 0xfbf81f30, BRF_OPT }, -}; - -STD_ROM_PICK(Scia) -STD_ROM_FN(Scia) - -static struct BurnRomInfo ScijRomDesc[] = { - { "c09-37.43", 0x20000, 0x0fecea17, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-38.40", 0x20000, 0xe46ebd9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-40.38", 0x20000, 0x1a4e2eab, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-39.41", 0x20000, 0xde87bcb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c09-33.6", 0x10000, 0xcf4e6c5b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c09-32.5", 0x10000, 0xa4713719, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c09-27.31", 0x20000, 0xcd161dca, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c09-05.16", 0x80000, 0x890b38f0, BRF_GRA | TAITO_CHARS }, - - { "c09-04.52", 0x80000, 0x2cbb3c9b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-02.53", 0x80000, 0xa83a0389, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-03.54", 0x80000, 0xa31d0e80, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-01.55", 0x80000, 0x64bfea10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c09-07.15", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, - - { "c09-06.37", 0x80000, 0x12df6d7b, BRF_GRA | TAITO_SPRITEMAP }, - - { "c09-10.42", 0x80000, 0xad78bf46, BRF_SND | TAITO_YM2610A }, - { "c09-09.43", 0x80000, 0x6a655c00, BRF_SND | TAITO_YM2610A }, - { "c09-08.44", 0x80000, 0x7ddfc316, BRF_SND | TAITO_YM2610A }, - - { "c09-11.29", 0x80000, 0x6b1a11e1, BRF_SND | TAITO_YM2610B }, - - { "c09-16.17", 0x10000, 0x7245a6f6, BRF_OPT }, - { "c09-20.71", 0x00100, 0xcd8ffd80, BRF_OPT }, - { "c09-23.14", 0x00100, 0xfbf81f30, BRF_OPT }, -}; - -STD_ROM_PICK(Scij) -STD_ROM_FN(Scij) - -static struct BurnRomInfo SciuRomDesc[] = { - { "c09-43.43", 0x20000, 0x20a9343e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-44.40", 0x20000, 0x7524338a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-41.38", 0x20000, 0x83477f11, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c09-39.41", 0x20000, 0xde87bcb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c09-33.6", 0x10000, 0xcf4e6c5b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c09-32.5", 0x10000, 0xa4713719, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c09-34.31", 0x20000, 0xa21b3151, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c09-05.16", 0x80000, 0x890b38f0, BRF_GRA | TAITO_CHARS }, - - { "c09-04.52", 0x80000, 0x2cbb3c9b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-02.53", 0x80000, 0xa83a0389, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-03.54", 0x80000, 0xa31d0e80, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-01.55", 0x80000, 0x64bfea10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c09-07.15", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, - - { "c09-06.37", 0x80000, 0x12df6d7b, BRF_GRA | TAITO_SPRITEMAP }, - - { "c09-14.42", 0x80000, 0xad78bf46, BRF_SND | TAITO_YM2610A }, - { "c09-13.43", 0x80000, 0xd57c41d3, BRF_SND | TAITO_YM2610A }, - { "c09-12.44", 0x80000, 0x56c99fa5, BRF_SND | TAITO_YM2610A }, - - { "c09-15.29", 0x80000, 0xe63b9095, BRF_SND | TAITO_YM2610B }, - - { "c09-16.17", 0x10000, 0x7245a6f6, BRF_OPT }, - { "c09-20.71", 0x00100, 0xcd8ffd80, BRF_OPT }, - { "c09-23.14", 0x00100, 0xfbf81f30, BRF_OPT }, -}; - -STD_ROM_PICK(Sciu) -STD_ROM_FN(Sciu) - -static struct BurnRomInfo ScinegroRomDesc[] = { - { "ic37.37", 0x20000, 0x33fb159c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "ic40.38", 0x20000, 0x657df3f2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "ic38.42", 0x20000, 0x0a09b90b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "ic41.39", 0x20000, 0x43167b2a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c09-33.6", 0x10000, 0xcf4e6c5b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c09-32.5", 0x10000, 0xa4713719, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c09-27.31", 0x20000, 0xcd161dca, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - - { "c09-05.16", 0x80000, 0x890b38f0, BRF_GRA | TAITO_CHARS }, - - { "c09-04.52", 0x80000, 0x2cbb3c9b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-02.53", 0x80000, 0xa83a0389, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-03.54", 0x80000, 0xa31d0e80, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c09-01.55", 0x80000, 0x64bfea10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c09-07.15", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, - - { "c09-06.37", 0x80000, 0x12df6d7b, BRF_GRA | TAITO_SPRITEMAP }, - - { "c09-10.42", 0x80000, 0xad78bf46, BRF_SND | TAITO_YM2610A }, - { "c09-09.43", 0x80000, 0x6a655c00, BRF_SND | TAITO_YM2610A }, - { "c09-08.44", 0x80000, 0x7ddfc316, BRF_SND | TAITO_YM2610A }, - - { "c09-11.29", 0x80000, 0x6b1a11e1, BRF_SND | TAITO_YM2610B }, - - { "c09-16.17", 0x10000, 0x7245a6f6, BRF_OPT }, - { "c09-20.71", 0x00100, 0xcd8ffd80, BRF_OPT }, - { "c09-23.14", 0x00100, 0xfbf81f30, BRF_OPT }, -}; - -STD_ROM_PICK(Scinegro) -STD_ROM_FN(Scinegro) - -static struct BurnRomInfo SpacegunRomDesc[] = { - { "c57-18.62", 0x020000, 0x19d7d52e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c57-20.74", 0x020000, 0x2e58253f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c57-17.59", 0x020000, 0xe197edb8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "c57-22.73", 0x020000, 0x5855fde3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - - { "c57-15+.27", 0x020000, 0xb36eb8f1, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - { "c57-16+.29", 0x020000, 0xbfb5d1e7, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, - - { "c57-06.52", 0x080000, 0x4ebadd5b, BRF_GRA | TAITO_CHARS }, - - { "c57-01.25", 0x100000, 0xf901b04e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c57-02.24", 0x100000, 0x21ee4633, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c57-03.12", 0x100000, 0xfafca86f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "c57-04.11", 0x100000, 0xa9787090, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - - { "c57-05.36", 0x080000, 0x6a70eb2e, BRF_GRA | TAITO_SPRITEMAP }, - - { "c57-07.76", 0x080000, 0xad653dc1, BRF_SND | TAITO_YM2610A }, - - { "c57-08.75", 0x080000, 0x22593550, BRF_SND | TAITO_YM2610B }, - - { "pal16l8-c57-09.9", 0x000104, 0xea93161e, BRF_OPT }, - { "pal20l8-c57-10.47", 0x000144, 0x3ee56888, BRF_OPT }, - { "pal16l8-c57-11.48", 0x000104, 0x6bb4372e, BRF_OPT }, - { "pal20l8-c57-12.61", 0x000144, 0xdebddb13, BRF_OPT }, - { "pal16l8-c57-13.72", 0x000104, 0x1369f23e, BRF_OPT }, - { "pal16r4-c57-14.96", 0x000104, 0x75e1bf61, BRF_OPT }, - -}; - -STD_ROM_PICK(Spacegun) -STD_ROM_FN(Spacegun) - -static INT32 MemIndex() -{ - UINT8 *Next; Next = TaitoMem; - - Taito68KRom1 = Next; Next += Taito68KRom1Size; - Taito68KRom2 = Next; Next += Taito68KRom2Size; - TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; - TaitoSpriteMapRom = Next; Next += TaitoSpriteMapRomSize; - TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; - TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - - TaitoRamStart = Next; - - Taito68KRam1 = Next; Next += 0x10000; - Taito68KRam2 = Next; Next += 0x08000; - TaitoSharedRam = Next; Next += 0x10000; - TaitoZ80Ram1 = Next; Next += 0x02000; - TaitoSpriteRam = Next; Next += 0x04000; - TaitoPaletteRam = Next; Next += 0x02000; - - TaitoRamEnd = Next; - - TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; - TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; - TaitoSpritesB = Next; Next += TaitoNumSpriteB * TaitoSpriteBWidth * TaitoSpriteBHeight; - TaitoPalette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); - - TaitoMemEnd = Next; - - return 0; -} - -static INT32 TaitoZDoReset() -{ - TaitoDoReset(); - - SciSpriteFrame = 0; - OldSteer = 0; - - return 0; -} - -static void TaitoZCpuAReset(UINT16 d) -{ - TaitoCpuACtrl = d; - if (!(TaitoCpuACtrl & 1)) { - SekClose(); - SekOpen(1); - SekReset(); - SekClose(); - SekOpen(0); - } -} - -void __fastcall Aquajack68K1WriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0xa00000, 0xa0ffff) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -void __fastcall Aquajack68K1WriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0xa00000, 0xa0ffff) - TC0100SCN0CtrlWordWrite_Map(0xa20000) - - switch (a) { - case 0x200000: { - TaitoZCpuAReset(d); - return; - } - - case 0x300000: - case 0x300002: { - TC0110PCRStep1WordWrite(0, (a - 0x300000) >> 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Aquajack68K2ReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x200000) - - switch (a) { - case 0x300003: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); - } - } - - return 0; -} - -UINT16 __fastcall Aquajack68K2ReadWord(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x200000) - - switch (a) { - case 0x900000: - case 0x900002: - case 0x900004: - case 0x900006: { - // nop - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Aquajack68K2WriteWord(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x200000) - - switch (a) { - case 0x300000: { - TC0140SYTPortWrite(d & 0xff); - return; - } - - case 0x300002: { - TC0140SYTCommWrite(d & 0xff); - return; - } - - case 0x900000: - case 0x900002: - case 0x900004: - case 0x900006: { - // nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); - } - } -} - -static UINT8 BsharkStickRead(INT32 Offset) -{ - switch (Offset) { - case 0x00: { - INT32 Temp = (TaitoAnalogPort0 >> 4) & 0xfff; - Temp = 0xfff - Temp; - Temp += 1; - if (Temp == 0x1000) Temp = 0; - return Temp; - } - - case 0x01: { - return 0xff; - } - - case 0x02: { - return TaitoAnalogPort1 >> 4; - } - - case 0x03: { - return 0xff; - } - } - - return 0; -} - -UINT8 __fastcall Bshark68K1ReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x400000) - - switch (a) { - case 0x800001: - case 0x800003: - case 0x800005: - case 0x800007: { - return BsharkStickRead((a - 0x800000) >> 1); - } - - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Bshark68K1WriteByte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x400000) - TC0100SCN0ByteWrite_Map(0xd00000, 0xd0ffff) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -void __fastcall Bshark68K1WriteWord(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x400000) - TC0100SCN0WordWrite_Map(0xd00000, 0xd0ffff) - TC0100SCN0CtrlWordWrite_Map(0xd20000) - - switch (a) { - case 0x600000: { - TaitoZCpuAReset(d); - return; - } - - case 0x800000: - case 0x800002: - case 0x800004: - case 0x800006: { - nTaitoCyclesDone[0] += SekRun(10000); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT16 __fastcall Bshark68K2ReadWord(UINT32 a) -{ - switch (a) { - case 0x40000a: { - // ??? - return 0; - } - - case 0x600000: { - return BurnYM2610Read(0); - } - - case 0x600004: { - return BurnYM2610Read(2); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Bshark68K2WriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x400000: - case 0x400002: - case 0x400004: - case 0x400006: - case 0x400008: { - // nop - return; - } - - case 0x600000: { - BurnYM2610Write(0, d & 0xff); - return; - } - - case 0x600002: { - BurnYM2610Write(1, d & 0xff); - return; - } - - case 0x600004: { - BurnYM2610Write(2, d & 0xff); - return; - } - - case 0x600006: { - BurnYM2610Write(3, d & 0xff); - return; - } - - case 0x60000c: - case 0x60000e: { - // nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); - } - } -} - -static UINT8 ChasehqInputBypassRead() -{ - UINT8 Port = TC0220IOCPortRead(); - - INT32 Steer = (TaitoAnalogPort0 >> 4); - - switch (Port) { - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: { - return 0xff; - } - - case 0x0c: { - return Steer & 0xff; - } - - case 0x0d: { - return Steer >> 8; - } - - default: { - return TC0220IOCPortRegRead(); - } - } -} - -UINT8 __fastcall Chasehq68K1ReadByte(UINT32 a) -{ - switch (a) { - case 0x400001: { - return ChasehqInputBypassRead(); - } - - case 0x820003: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Chasehq68K1WriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0xc00000, 0xc0ffff) - - switch (a) { - case 0x400001: { - TC0220IOCHalfWordPortRegWrite(d); - return; - } - - case 0x400003: { - TC0220IOCHalfWordPortWrite(d); - return; - } - - case 0x800001: { - TaitoZCpuAReset(d); - return; - } - - case 0x820001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x820003: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Chasehq68K1ReadWord(UINT32 a) -{ - switch (a) { - case 0x400002: { - return TC0220IOCHalfWordPortRead(); - } - - case 0xa00002: { - return TC0110PCRWordRead(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Chasehq68K1WriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0xc00000, 0xc0ffff) - TC0100SCN0CtrlWordWrite_Map(0xc20000) - - switch (a) { - case 0x400000: { - TC0220IOCHalfWordPortRegWrite(d); - return; - } - - case 0x400002: { - TC0220IOCHalfWordPortWrite(d); - return; - } - - case 0xa00000: - case 0xa00002: { - TC0110PCRStep1WordWrite(0, (a - 0xa00000) >> 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -static UINT8 ContcircInputBypassRead() -{ - UINT8 Port = TC0220IOCPortRead(); - - INT32 Steer = (TaitoAnalogPort0 >> 4) & 0xfff; - Steer = 0xfff - Steer; - if (Steer == 0xfff) Steer = 0; - if (Steer > 0x5f && Steer < 0x80) Steer = 0x5f; - if (Steer > 0xf7f && Steer < 0xfa0) Steer = 0xfa0; - if (Steer > 0xf7f) Steer |= 0xf000; - - switch (Port) { - case 0x08: { - return Steer & 0xff; - } - - case 0x09: { - return Steer >> 8; - } - - default: { - return TC0220IOCPortRegRead(); - } - } -} - -void __fastcall Contcirc68K1WriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x200000, 0x20ffff) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -void __fastcall Contcirc68K1WriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x200000, 0x20ffff) - TC0100SCN0CtrlWordWrite_Map(0x220000) - - switch (a) { - case 0x090000: { - TaitoRoadPalBank = (d & 0xc0) >> 6; - TaitoZCpuAReset(d); - return; - } - - case 0x100000: - case 0x100002: { - TC0110PCRStep1RBSwapWordWrite(0, (a - 0x100000) >> 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Contcirc68K2ReadByte(UINT32 a) -{ - switch (a) { - case 0x100001: { - return ContcircInputBypassRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Contcirc68K2WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x100001: { - TC0220IOCHalfWordPortRegWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Contcirc68K2ReadWord(UINT32 a) -{ - switch (a) { - case 0x100000: { - return ContcircInputBypassRead(); - } - - case 0x100002: { - return TC0220IOCHalfWordPortRead(); - } - - case 0x200002: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Contcirc68K2WriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x100000: { - TC0220IOCHalfWordPortRegWrite(d); - return; - } - - case 0x100002: { - TC0220IOCHalfWordPortWrite(d); - return; - } - - case 0x200000: { - TC0140SYTPortWrite(d & 0xff); - return; - } - - case 0x200002: { - TC0140SYTCommWrite(d & 0xff); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); - } - } -} - -static UINT16 DblaxleSteerRead(INT32 Offset) -{ - int Steer = TaitoAnalogPort0 >> 5; - if (Steer > 0x3f) Steer |= 0xf800; - - switch (Offset) { - case 0x04: { - return Steer >> 8; - } - - case 0x05: { - return Steer & 0xff; - } - } - - return 0x00; -} - -UINT8 __fastcall Dblaxle68K1ReadByte(UINT32 a) -{ - TC0510NIOHalfWordSwapRead_Map(0x400000) - - switch (a) { - case 0x620003: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Dblaxle68K1WriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordSwapWrite_Map(0x400000) - - switch (a) { - case 0x600001: { - TaitoZCpuAReset(d); - return; - } - - case 0x620001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x620003: { - TC0140SYTCommWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Dblaxle68K1ReadWord(UINT32 a) -{ - TC0510NIOHalfWordSwapRead_Map(0x400000) - - switch (a) { - case 0x400018: - case 0x40001a: { - return DblaxleSteerRead((a - 0x400010) >> 1); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Dblaxle68K1WriteWord(UINT32 a, UINT16 d) -{ - TC0510NIOHalfWordSwapWrite_Map(0x400000) - TC0480SCPCtrlWordWrite_Map(0xa30000) - - switch (a) { - case 0xc08000: { - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -void __fastcall Enforce68K1WriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x600000, 0x60ffff) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Enforce68K1ReadWord(UINT32 a) -{ - switch (a) { - case 0x500002: { - return TC0110PCRWordRead(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Enforce68K1WriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x600000, 0x60ffff) - TC0100SCN0CtrlWordWrite_Map(0x620000) - - switch (a) { - case 0x200000: { - TaitoZCpuAReset(d); - return; - } - - case 0x500000: - case 0x500002: { - TC0110PCRStep1RBSwapWordWrite(0, (a - 0x500000) >> 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Enforce68K2ReadByte(UINT32 a) -{ - switch (a) { - case 0x300001: { - return TC0220IOCPortRegRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Enforce68K2WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x300001: { - TC0220IOCHalfWordPortRegWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Enforce68K2ReadWord(UINT32 a) -{ - switch (a) { - case 0x200002: { - return TC0140SYTCommRead(); - } - - case 0x300000: { - return TC0220IOCPortRegRead(); - } - - case 0x300002: { - return TC0220IOCHalfWordPortRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Enforce68K2WriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x200000: { - TC0140SYTPortWrite(d & 0xff); - return; - } - - case 0x200002: { - TC0140SYTCommWrite(d & 0xff); - return; - } - - case 0x300000: { - TC0220IOCHalfWordPortRegWrite(d); - return; - } - - case 0x300002: { - TC0220IOCHalfWordPortWrite(d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); - } - } -} - -static const UINT8 nightstr_stick[128]= -{ - 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7, - 0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7, - 0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf,0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7, - 0xe8,0x00,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25, - 0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,0x34,0x35, - 0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,0x40,0x41,0x42,0x43,0x44,0x45, - 0x46,0x47,0x48,0x49,0xb8 -}; - -static UINT8 NightstrStickRead(INT32 Offset) -{ - switch (Offset) { - case 0x00: { - UINT8 Temp = 0x7f + (TaitoAnalogPort0 >> 4); - if (Temp < 0x01) Temp = 0x01; - if (Temp > 0xfe) Temp = 0xfe; - return nightstr_stick[(Temp * 0x64) / 0x100]; - } - - case 0x01: { - UINT8 Temp = 0x7f - (TaitoAnalogPort1 >> 4); - if (Temp < 0x01) Temp = 0x01; - if (Temp > 0xfe) Temp = 0xfe; - return nightstr_stick[(Temp * 0x64) / 0x100]; - } - - case 0x02: { - return 0xff; - } - - case 0x03: { - return 0xff; - } - } - - return 0xff; -} - -UINT8 __fastcall Nightstr68K1ReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x400000) - - switch (a) { - case 0xe40001: - case 0xe40003: - case 0xe40005: - case 0xe40007: { - return NightstrStickRead((a - 0xe40000) >> 1); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Nightstr68K1WriteByte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x400000) - TC0100SCN0ByteWrite_Map(0xc00000, 0xc0ffff) - - switch (a) { - case 0xe00000: - case 0xe00008: - case 0xe00010: { - // nop - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Nightstr68K1ReadWord(UINT32 a) -{ - switch (a) { - case 0x820002: { - return TC0140SYTCommRead(); - } - - case 0xa00002: { - return TC0110PCRWordRead(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Nightstr68K1WriteWord(UINT32 a, UINT16 d) -{ - TC0220IOCHalfWordWrite_Map(0x400000) - TC0100SCN0WordWrite_Map(0xc00000, 0xc0ffff) - TC0100SCN0CtrlWordWrite_Map(0xc20000) - - switch (a) { - case 0x800000: { - TaitoZCpuAReset(d); - return; - } - - case 0x820000: { - TC0140SYTPortWrite(d & 0xff); - return; - } - - case 0x820002: { - TC0140SYTCommWrite(d & 0xff); - return; - } - - case 0xa00000: - case 0xa00002: { - TC0110PCRStep1WordWrite(0, (a - 0xa00000) >> 1, d); - return; - } - - case 0xe00000: - case 0xe00008: - case 0xe00010: { - // nop - return; - } - - case 0xe40000: - case 0xe40002: - case 0xe40004: - case 0xe40006: - case 0xe40008: - case 0xe4000a: - case 0xe4000c: - case 0xe4000e: { - nTaitoCyclesDone[0] += SekRun(10000); - SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Racingb68K1ReadByte(UINT32 a) -{ - TC0510NIOHalfWordSwapRead_Map(0x300000) - - switch (a) { - case 0x300019: - case 0x30001b: { - return DblaxleSteerRead((a - 0x300010) >> 1); - } - - case 0x520003: { - return TC0140SYTCommRead(); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Racingb68K1WriteByte(UINT32 a, UINT8 d) -{ - TC0510NIOHalfWordSwapWrite_Map(0x300000) - - switch (a) { - case 0x500002: { - TaitoZCpuAReset(d); - return; - } - - case 0x520001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x520003: { - TC0140SYTCommWrite(d); - return; - } - - case 0xb08000: { - SciSpriteFrame = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Racingb68K1ReadWord(UINT32 a) -{ - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Racingb68K1WriteWord(UINT32 a, UINT16 d) -{ - TC0510NIOHalfWordSwapWrite_Map(0x300000) - TC0480SCPCtrlWordWrite_Map(0x930000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -static UINT8 SciSteerRead(INT32 Offset) -{ - INT32 Steer = TaitoAnalogPort0 >> 4; - if (Steer > 0x5f && Steer < 0x80) Steer = 0x5f; - if (Steer > 0xf80 && Steer < 0xfa0) Steer = 0xfa0; - if ((OldSteer < Steer) && (Steer > 0xfc0)) Steer = 0; - OldSteer = Steer; - - switch (Offset) { - case 0x04: { - return Steer & 0xff; - } - - case 0x05: { - return (Steer & 0xff00) >> 8; - } - } - - return 0xff; -} - -UINT8 __fastcall Sci68K1ReadByte(UINT32 a) -{ - TC0220IOCHalfWordRead_Map(0x200000) - - switch (a) { - case 0x200019: - case 0x20001b: { - return SciSteerRead((a - 0x200010) >> 1); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Sci68K1WriteByte(UINT32 a, UINT8 d) -{ - TC0220IOCHalfWordWrite_Map(0x200000) - TC0100SCN0ByteWrite_Map(0xa00000, 0xa0ffff) - - switch (a) { - case 0x400001: { - TaitoZCpuAReset(d); - return; - } - - case 0x420001: { - TC0140SYTPortWrite(d); - return; - } - - case 0x420003: { - TC0140SYTCommWrite(d); - return; - } - - case 0xc08000: { - SciSpriteFrame = d; - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -void __fastcall Sci68K1WriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0xa00000, 0xa0ffff) - TC0100SCN0CtrlWordWrite_Map(0xa20000) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -static const UINT8 spacegun_default_eeprom[128]= -{ - 0x00,0x00,0x00,0xff,0x00,0x01,0x41,0x41,0x00,0x00,0x00,0xff,0x00,0x00,0xf0,0xf0, - 0x00,0x00,0x00,0xff,0x00,0x01,0x41,0x41,0x00,0x00,0x00,0xff,0x00,0x00,0xf0,0xf0, - 0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x01,0x40,0x00,0x00,0x00,0xf0,0x00, - 0x00,0x01,0x42,0x85,0x00,0x00,0xf1,0xe3,0x00,0x01,0x40,0x00,0x00,0x00,0xf0,0x00, - 0x00,0x01,0x42,0x85,0x00,0x00,0xf1,0xe3,0xcc,0xcb,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff -}; - -static const eeprom_interface spacegun_eeprom_intf = -{ - 6, /* address bits */ - 16, /* data bits */ - "0110", /* read command */ - "0101", /* write command */ - "0111", /* erase command */ - "0100000000", /* lock command */ - "0100111111", /* unlock command */ - 0, /* multi-read disabled */ - 1 /* reset delay */ -}; - -static UINT8 SpacegunInputBypassRead(INT32 Offset) -{ - switch (Offset) { - case 0x03: { - return (EEPROMRead() & 1) << 7; - } - - default: { - return TC0220IOCRead(Offset); - } - } - - return 0; -} - -static void SpacegunInputBypassWrite(INT32 Offset, UINT16 Data) -{ - switch (Offset) { - case 0x03: { - EEPROMWrite(Data & 0x20, Data & 0x10, Data & 0x40); - return; - } - - default: { - TC0220IOCWrite(Offset, Data & 0xff); - } - } -} - -void __fastcall Spacegun68K1WriteByte(UINT32 a, UINT8 d) -{ - TC0100SCN0ByteWrite_Map(0x900000, 0x90ffff) - - switch (a) { - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Spacegun68K1ReadWord(UINT32 a) -{ - switch (a) { - case 0xb00002: { - return TC0110PCRWordRead(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Spacegun68K1WriteWord(UINT32 a, UINT16 d) -{ - TC0100SCN0WordWrite_Map(0x900000, 0x90ffff) - TC0100SCN0CtrlWordWrite_Map(0x920000) - - switch (a) { - case 0xb00000: - case 0xb00002: { - TC0110PCRStep1RBSwapWordWrite(0, (a - 0xb00000) >> 1, d); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall Spacegun68K2ReadByte(UINT32 a) -{ - switch (a) { - case 0xc0000d: { - // nop - return 0; - } - - case 0xf00001: { - return ~BurnGunReturnX(0); - } - - case 0xf00003: { - return BurnGunReturnY(0); - } - - case 0xf00005: { - return ~BurnGunReturnX(1); - } - - case 0xf00007: { - return BurnGunReturnY(1); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Spacegun68K2WriteByte(UINT32 a, UINT8 d) -{ - switch (a) { - case 0x800008: { - SpacegunInputBypassWrite((a - 0x800000) >> 1, d); - return; - } - - case 0xc0000d: { - // nop - return; - } - - case 0xe00001: { - // ??? - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); - } - } -} - -UINT16 __fastcall Spacegun68K2ReadWord(UINT32 a) -{ - switch (a) { - case 0x800000: - case 0x800002: - case 0x800004: - case 0x800006: - case 0x800008: - case 0x80000a: - case 0x80000c: - case 0x80000e: { - return SpacegunInputBypassRead((a - 0x800000) >> 1); - } - - case 0xc00000: { - return BurnYM2610Read(0); - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); - } - } - - return 0; -} - -void __fastcall Spacegun68K2WriteWord(UINT32 a, UINT16 d) -{ - switch (a) { - case 0x800000: - case 0x800002: - case 0x800004: - case 0x800006: - case 0x800008: - case 0x80000a: - case 0x80000c: - case 0x80000e: { - SpacegunInputBypassWrite((a - 0x800000) >> 1, d); - return; - } - - case 0xc00000: { - BurnYM2610Write(0, d & 0xff); - return; - } - - case 0xc00002: { - BurnYM2610Write(1, d & 0xff); - return; - } - - case 0xc00004: { - BurnYM2610Write(2, d & 0xff); - return; - } - - case 0xc00006: { - BurnYM2610Write(3, d & 0xff); - return; - } - - case 0xc20000: - case 0xc20002: - case 0xc20004: - case 0xc20006: { - // ??? - return; - } - - case 0xf00000: - case 0xf00002: - case 0xf00004: - case 0xf00006: { - nTaitoCyclesDone[1] += SekRun(10000); - SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); - } - } -} - -UINT8 __fastcall TaitoZZ80Read(UINT16 a) -{ - switch (a) { - case 0xe000: { - return BurnYM2610Read(0); - } - - case 0xe001: { - return BurnYM2610Read(1); - } - - case 0xe002: { - return BurnYM2610Read(2); - } - - case 0xe200: { - // NOP - return 0; - } - - case 0xe201: { - return TC0140SYTSlaveCommRead(); - } - - case 0xea00: { - // NOP - return 0; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); - } - } - - return 0; -} - -void __fastcall TaitoZZ80Write(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xe000: { - BurnYM2610Write(0, d); - return; - } - - case 0xe001: { - BurnYM2610Write(1, d); - return; - } - - case 0xe002: { - BurnYM2610Write(2, d); - return; - } - - case 0xe003: { - BurnYM2610Write(3, d); - return; - } - - case 0xe200: { - TC0140SYTSlavePortWrite(d); - return; - } - - case 0xe201: { - TC0140SYTSlaveCommWrite(d); - return; - } - - case 0xe400: { - BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_1, TaitoZYM2610Route1MasterVol * d / 255.0); - return; - } - - case 0xe401: { - BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_1, TaitoZYM2610Route1MasterVol * d / 255.0); - return; - } - - case 0xe402: { - BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_2, TaitoZYM2610Route1MasterVol * d / 255.0); - return; - } - - case 0xe403: { - BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_2, TaitoZYM2610Route1MasterVol * d / 255.0); - return; - } - - case 0xe600: { - return; - } - - case 0xee00: { - return; - } - - case 0xf000: { - return; - } - - case 0xf200: { - TaitoZ80Bank = (d - 1) & 7; - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - return; - } - - default: { - bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); - } - } -} - -static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 CharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; -static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; -static INT32 DblaxleCharPlaneOffsets[4] = { 0, 1, 2, 3 }; -static INT32 DblaxleCharXOffsets[16] = { 4, 0, 20, 16, 12, 8, 28, 24, 36, 32, 52, 48, 44, 40, 60, 56 }; -static INT32 DblaxleCharYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; -static INT32 SpritePlaneOffsets[4] = { 0, 8, 16, 24 }; -static INT32 SpriteXOffsets[16] = { 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 }; -static INT32 SpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; -static INT32 Sprite16x8YOffsets[8] = { 0, 64, 128, 192, 256, 320, 384, 448 }; - -static void TaitoZFMIRQHandler(INT32, INT32 nStatus) -{ - if (nStatus & 1) { - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); - } else { - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - } -} - -static INT32 TaitoZSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / (16000000 / 4); -} - -static double TaitoZGetTime() -{ - return (double)ZetTotalCycles() / (16000000 / 4); -} - -static INT32 TaitoZ68KSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)SekTotalCycles() * nSoundRate / (nTaitoCyclesTotal[1] * 60); -} - -static double TaitoZ68KGetTime() -{ - return (double)SekTotalCycles() / (nTaitoCyclesTotal[1] * 60); -} - -static void TaitoZZ80Init() -{ - // Setup the Z80 emulation - ZetInit(0); - ZetOpen(0); - ZetSetReadHandler(TaitoZZ80Read); - ZetSetWriteHandler(TaitoZZ80Write); - ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); - ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); - ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); - ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); - ZetMemEnd(); - ZetClose(); - - TaitoNumZ80s = 1; -} - -static void SwitchToMusashi() -{ - if (bBurnUseASMCPUEmulation) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); -#endif - bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; - bBurnUseASMCPUEmulation = false; - } -} - -static INT32 AquajackInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 8; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = Sprite16x8YOffsets; - TaitoNumSpriteA = 0x8000; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); - TC0110PCRInit(1, 0x1000); - TC0150RODInit(TaitoRoadRomSize, 0); - TC0140SYTInit(); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x104000, 0x107fff, SM_RAM); - SekMapMemory(TC0150RODRam , 0x800000, 0x801fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0xa00000, 0xa0ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0xc40000, 0xc403ff, SM_RAM); - SekSetWriteByteHandler(0, Aquajack68K1WriteByte); - SekSetWriteWordHandler(0, Aquajack68K1WriteWord); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x104000, 0x107fff, SM_RAM); - SekSetReadWordHandler(0, Aquajack68K2ReadWord); - SekSetWriteWordHandler(0, Aquajack68K2WriteWord); - SekSetReadByteHandler(0, Aquajack68K2ReadByte); - SekClose(); - - TaitoZZ80Init(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); - BurnTimerAttachZet(16000000 / 4); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - TaitoZYM2610Route1MasterVol = 2.00; - TaitoZYM2610Route2MasterVol = 2.00; - bYM2610UseSeperateVolumes = 1; - - TaitoMakeInputsFunction = AquajackMakeInputs; - TaitoDrawFunction = AquajackDraw; - TaitoIrqLine = 4; - TaitoFrameInterleave = 500; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = 12000000 / 60; - nTaitoCyclesTotal[2] = (16000000 / 4) / 60; - - // Reset the driver - TaitoZDoReset(); - - return 0; -} - -static INT32 BsharkInit() -{ - INT32 nLen; - - Sci = 1; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 8; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = Sprite16x8YOffsets; - TaitoNumSpriteA = 0x8000; - - TaitoNum68Ks = 2; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 0, 8, 1, NULL); - TC0150RODInit(TaitoRoadRomSize, 1); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x110000, 0x113fff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0xa00000, 0xa01fff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0xc00000, 0xc00fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0xd00000, 0xd0ffff, SM_READ); - SekSetWriteWordHandler(0, Bshark68K1WriteWord); - SekSetReadByteHandler(0, Bshark68K1ReadByte); - SekSetWriteByteHandler(0, Bshark68K1WriteByte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x108000, 0x10bfff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x110000, 0x113fff, SM_RAM); - SekMapMemory(TC0150RODRam , 0x800000, 0x801fff, SM_RAM); - SekSetReadWordHandler(0, Bshark68K2ReadWord); - SekSetWriteWordHandler(0, Bshark68K2WriteWord); - SekClose(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, NULL, TaitoZ68KSynchroniseStream, TaitoZ68KGetTime, 0); - BurnTimerAttachSek(12000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - TaitoMakeInputsFunction = BsharkMakeInputs; - TaitoDrawFunction = BsharkDraw; - TaitoIrqLine = 4; - TaitoFrameInterleave = 100; - TaitoFlipScreenX = 1; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = 12000000 / 60; - - // Reset the driver - TaitoZDoReset(); - - return 0; -} - -static INT32 ChasehqInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x4000; - - TaitoSpriteBModulo = 0x400; - TaitoSpriteBNumPlanes = 4; - TaitoSpriteBWidth = 16; - TaitoSpriteBHeight = 16; - TaitoSpriteBPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteBXOffsets = SpriteXOffsets; - TaitoSpriteBYOffsets = SpriteYOffsets; - TaitoNumSpriteB = 0x4000; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); - TC0110PCRInit(1, 0x1000); - TC0150RODInit(TaitoRoadRomSize, 0); - TC0140SYTInit(); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x107fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x108000, 0x10bfff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0xc00000, 0xc0ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0xd00000, 0xd007ff, SM_RAM); - SekSetReadWordHandler(0, Chasehq68K1ReadWord); - SekSetWriteWordHandler(0, Chasehq68K1WriteWord); - SekSetReadByteHandler(0, Chasehq68K1ReadByte); - SekSetWriteByteHandler(0, Chasehq68K1WriteByte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x01ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x108000, 0x10bfff, SM_RAM); - SekMapMemory(TC0150RODRam , 0x800000, 0x801fff, SM_RAM); - SekClose(); - - TaitoZZ80Init(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); - BurnTimerAttachZet(16000000 / 4); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); - TaitoZYM2610Route1MasterVol = 1.00; - TaitoZYM2610Route2MasterVol = 1.00; - bYM2610UseSeperateVolumes = 1; - - TaitoMakeInputsFunction = ChasehqMakeInputs; - TaitoDrawFunction = ChasehqDraw; - TaitoIrqLine = 4; - TaitoFrameInterleave = 100; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = 12000000 / 60; - nTaitoCyclesTotal[2] = (16000000 / 4) / 60; - - // Reset the driver - TaitoZDoReset(); - - return 0; -} - -static INT32 ContcircInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 8; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = Sprite16x8YOffsets; - TaitoNumSpriteA = 0x8000; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 0, 16, 0, NULL); - TC0110PCRInit(1, 0x1000); - TC0150RODInit(TaitoRoadRomSize, 0); - TC0140SYTInit(); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x080000, 0x083fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x084000, 0x087fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x200000, 0x20ffff, SM_READ); - SekMapMemory(TC0150RODRam , 0x300000, 0x301fff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x400000, 0x4006ff, SM_RAM); - SekSetWriteByteHandler(0, Contcirc68K1WriteByte); - SekSetWriteWordHandler(0, Contcirc68K1WriteWord); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x080000, 0x083fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x084000, 0x087fff, SM_RAM); - SekSetReadWordHandler(0, Contcirc68K2ReadWord); - SekSetWriteWordHandler(0, Contcirc68K2WriteWord); - SekSetReadByteHandler(0, Contcirc68K2ReadByte); - SekSetWriteByteHandler(0, Contcirc68K2WriteByte); - SekClose(); - - TaitoZZ80Init(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); - BurnTimerAttachZet(16000000 / 4); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); - TaitoZYM2610Route1MasterVol = 2.00; - TaitoZYM2610Route2MasterVol = 2.00; - bYM2610UseSeperateVolumes = 1; - - TaitoMakeInputsFunction = ContcircMakeInputs; - TaitoDrawFunction = ContcircDraw; - TaitoIrqLine = 6; - TaitoFrameInterleave = 100; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = 12000000 / 60; - nTaitoCyclesTotal[2] = (16000000 / 4) / 60; - - // Reset the driver - TaitoZDoReset(); - - return 0; -} - -static INT32 DblaxleInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x400; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 16; - TaitoCharHeight = 16; - TaitoCharPlaneOffsets = DblaxleCharPlaneOffsets; - TaitoCharXOffsets = DblaxleCharXOffsets; - TaitoCharYOffsets = DblaxleCharYOffsets; - TaitoNumChar = 0x2000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 8; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = Sprite16x8YOffsets; - TaitoNumSpriteA = 0x10000; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - TC0150RODInit(TaitoRoadRomSize, 0); - TC0480SCPInit(TaitoNumChar, 0, 0x21, 8, 4, 0, 0); - TC0140SYTInit(); - TC0510NIOInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x200000, 0x203fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x210000, 0x21ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x800000, 0x801fff, SM_RAM); - SekMapMemory(TC0480SCPRam , 0x900000, 0x90ffff, SM_RAM); - SekMapMemory(TC0480SCPRam , 0xa00000, 0xa0ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0xc00000, 0xc03fff, SM_RAM); - SekSetReadWordHandler(0, Dblaxle68K1ReadWord); - SekSetWriteWordHandler(0, Dblaxle68K1WriteWord); - SekSetReadByteHandler(0, Dblaxle68K1ReadByte); - SekSetWriteByteHandler(0, Dblaxle68K1WriteByte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x110000, 0x11ffff, SM_RAM); - SekMapMemory(TC0150RODRam , 0x300000, 0x301fff, SM_RAM); - SekClose(); - - TaitoZZ80Init(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); - BurnTimerAttachZet(16000000 / 4); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - TaitoZYM2610Route1MasterVol = 8.00; - TaitoZYM2610Route2MasterVol = 8.00; - bYM2610UseSeperateVolumes = 1; - - TaitoMakeInputsFunction = DblaxleMakeInputs; - TaitoDrawFunction = DblaxleDraw; - TaitoIrqLine = 4; - TaitoFrameInterleave = 100; - - nTaitoCyclesTotal[0] = 16000000 / 60; - nTaitoCyclesTotal[1] = 16000000 / 60; - nTaitoCyclesTotal[2] = (16000000 / 4) / 60; - - GenericTilesInit(); - - // Reset the driver - TaitoZDoReset(); - - return 0; -} - -static INT32 EnforceInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 8; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = Sprite16x8YOffsets; - TaitoNumSpriteA = 0x8000; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 0, 16, 0, NULL); - TC0110PCRInit(1, 0x1000); - TC0150RODInit(TaitoRoadRomSize, 0); - TC0140SYTInit(); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x104000, 0x107fff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x300000, 0x3006ff, SM_RAM); - SekMapMemory(TC0150RODRam , 0x400000, 0x401fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x600000, 0x60ffff, SM_READ); - SekSetWriteByteHandler(0, Enforce68K1WriteByte); - SekSetReadWordHandler(0, Enforce68K1ReadWord); - SekSetWriteWordHandler(0, Enforce68K1WriteWord); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x104000, 0x107fff, SM_RAM); - SekSetReadWordHandler(0, Enforce68K2ReadWord); - SekSetWriteWordHandler(0, Enforce68K2WriteWord); - SekSetReadByteHandler(0, Enforce68K2ReadByte); - SekSetWriteByteHandler(0, Enforce68K2WriteByte); - SekClose(); - - TaitoZZ80Init(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); - BurnTimerAttachZet(16000000 / 4); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); - TaitoZYM2610Route1MasterVol = 20.00; - TaitoZYM2610Route2MasterVol = 20.00; - bYM2610UseSeperateVolumes = 1; - - TaitoMakeInputsFunction = EnforceMakeInputs; - TaitoDrawFunction = EnforceDraw; - TaitoIrqLine = 6; - TaitoFrameInterleave = 100; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = 12000000 / 60; - nTaitoCyclesTotal[2] = (16000000 / 4) / 60; - - // Reset the driver - TaitoZDoReset(); - - return 0; -} - -static INT32 NightstrInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x400; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 16; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = SpriteYOffsets; - TaitoNumSpriteA = 0x4000; - - TaitoSpriteBModulo = 0x400; - TaitoSpriteBNumPlanes = 4; - TaitoSpriteBWidth = 16; - TaitoSpriteBHeight = 16; - TaitoSpriteBPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteBXOffsets = SpriteXOffsets; - TaitoSpriteBYOffsets = SpriteYOffsets; - TaitoNumSpriteB = 0x4000; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); - TC0110PCRInit(1, 0x1000); - TC0150RODInit(TaitoRoadRomSize, 0); - TC0140SYTInit(); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x110000, 0x113fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0xc00000, 0xc0ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0xd00000, 0xd007ff, SM_RAM); - SekSetReadWordHandler(0, Nightstr68K1ReadWord); - SekSetWriteWordHandler(0, Nightstr68K1WriteWord); - SekSetReadByteHandler(0, Nightstr68K1ReadByte); - SekSetWriteByteHandler(0, Nightstr68K1WriteByte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x104000, 0x107fff, SM_RAM); - SekMapMemory(TC0150RODRam , 0x800000, 0x801fff, SM_RAM); - SekClose(); - - TaitoZZ80Init(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); - BurnTimerAttachZet(16000000 / 4); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); - TaitoZYM2610Route1MasterVol = 1.00; - TaitoZYM2610Route2MasterVol = 1.00; - bYM2610UseSeperateVolumes = 1; - - TaitoMakeInputsFunction = NightstrMakeInputs; - TaitoDrawFunction = ChasehqDraw; - TaitoIrqLine = 4; - TaitoFrameInterleave = 100; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = 12000000 / 60; - nTaitoCyclesTotal[2] = (16000000 / 4) / 60; - - // Reset the driver - TaitoZDoReset(); - - return 0; -} - -static INT32 RacingbInit() -{ - INT32 nLen; - - Sci = 1; - - TaitoCharModulo = 0x400; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 16; - TaitoCharHeight = 16; - TaitoCharPlaneOffsets = DblaxleCharPlaneOffsets; - TaitoCharXOffsets = DblaxleCharXOffsets; - TaitoCharYOffsets = DblaxleCharYOffsets; - TaitoNumChar = 0x2000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 8; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = Sprite16x8YOffsets; - TaitoNumSpriteA = 0x10000; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - TC0150RODInit(TaitoRoadRomSize, 0); - TC0480SCPInit(TaitoNumChar, 0, 0x1f, 8, 4, 0, 0); - TC0140SYTInit(); - TC0510NIOInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x103fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x110000, 0x11ffff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); - SekMapMemory(TC0480SCPRam , 0x900000, 0x90ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0xb00000, 0xb03fff, SM_RAM); - SekSetReadWordHandler(0, Racingb68K1ReadWord); - SekSetWriteWordHandler(0, Racingb68K1WriteWord); - SekSetReadByteHandler(0, Racingb68K1ReadByte); - SekSetWriteByteHandler(0, Racingb68K1WriteByte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x400000, 0x403fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x410000, 0x41ffff, SM_RAM); - SekMapMemory(TC0150RODRam , 0xa00000, 0xa01fff, SM_RAM); - SekClose(); - - TaitoZZ80Init(); - - BurnYM2610Init(32000000 / 4, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); - BurnTimerAttachZet(32000000 / 8); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - TaitoZYM2610Route1MasterVol = 8.00; - TaitoZYM2610Route2MasterVol = 8.00; - bYM2610UseSeperateVolumes = 1; - - TaitoMakeInputsFunction = DblaxleMakeInputs; - TaitoDrawFunction = RacingbDraw; - TaitoIrqLine = 4; - TaitoFrameInterleave = 100; - - nTaitoCyclesTotal[0] = 16000000 / 60; - nTaitoCyclesTotal[1] = 16000000 / 60; - nTaitoCyclesTotal[2] = (16000000 / 4) / 60; - - GenericTilesInit(); - - // Reset the driver - TaitoZDoReset(); - - return 0; -} - -static INT32 SciInit() -{ - INT32 nLen; - - Sci = 1; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 8; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = Sprite16x8YOffsets; - TaitoNumSpriteA = 0x8000; - - TaitoNum68Ks = 2; - TaitoNumZ80s = 1; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); - TC0150RODInit(TaitoRoadRomSize, 0); - TC0140SYTInit(); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x100000, 0x107fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x108000, 0x10bfff, SM_RAM); - SekMapMemory(TaitoPaletteRam , 0x800000, 0x801fff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0xa00000, 0xa0ffff, SM_READ); - SekMapMemory(TaitoSpriteRam , 0xc00000, 0xc03fff, SM_RAM); - SekSetWriteWordHandler(0, Sci68K1WriteWord); - SekSetReadByteHandler(0, Sci68K1ReadByte); - SekSetWriteByteHandler(0, Sci68K1WriteByte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x01ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x200000, 0x203fff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x208000, 0x20bfff, SM_RAM); - SekMapMemory(TC0150RODRam , 0xa00000, 0xa01fff, SM_RAM); - SekClose(); - - TaitoZZ80Init(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); - BurnTimerAttachZet(16000000 / 4); - BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); - TaitoZYM2610Route1MasterVol = 1.00; - TaitoZYM2610Route2MasterVol = 1.00; - bYM2610UseSeperateVolumes = 1; - - TaitoMakeInputsFunction = SciMakeInputs; - TaitoDrawFunction = SciDraw; - TaitoIrqLine = 4; - TaitoFrameInterleave = 100; - - nTaitoCyclesTotal[0] = 12000000 / 60; - nTaitoCyclesTotal[1] = 12000000 / 60; - nTaitoCyclesTotal[2] = (16000000 / 4) / 60; - - // Reset the driver - TaitoZDoReset(); - - return 0; -} - -static INT32 SpacegunInit() -{ - INT32 nLen; - - TaitoCharModulo = 0x100; - TaitoCharNumPlanes = 4; - TaitoCharWidth = 8; - TaitoCharHeight = 8; - TaitoCharPlaneOffsets = CharPlaneOffsets; - TaitoCharXOffsets = CharXOffsets; - TaitoCharYOffsets = CharYOffsets; - TaitoNumChar = 0x4000; - - TaitoSpriteAModulo = 0x200; - TaitoSpriteANumPlanes = 4; - TaitoSpriteAWidth = 16; - TaitoSpriteAHeight = 8; - TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; - TaitoSpriteAXOffsets = SpriteXOffsets; - TaitoSpriteAYOffsets = Sprite16x8YOffsets; - TaitoNumSpriteA = 0x10000; - - TaitoNum68Ks = 2; - TaitoNumYM2610 = 1; - - TaitoLoadRoms(0); - - // Allocate and Blank all required memory - TaitoMem = NULL; - MemIndex(); - nLen = TaitoMemEnd - (UINT8 *)0; - if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; - memset(TaitoMem, 0, nLen); - MemIndex(); - - GenericTilesInit(); - - TC0100SCNInit(0, TaitoNumChar, 4, 8, 1, NULL); - TC0110PCRInit(1, 0x1000); - TC0220IOCInit(); - - if (TaitoLoadRoms(1)) return 1; - - SwitchToMusashi(); - - // Setup the 68000 emulation - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); - SekMapMemory(Taito68KRam1 , 0x30c000, 0x30ffff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x310000, 0x31ffff, SM_RAM); - SekMapMemory(TaitoSpriteRam , 0x500000, 0x5005ff, SM_RAM); - SekMapMemory(TC0100SCNRam[0] , 0x900000, 0x90ffff, SM_READ); - SekSetReadWordHandler(0, Spacegun68K1ReadWord); - SekSetWriteWordHandler(0, Spacegun68K1WriteWord); - SekSetWriteByteHandler(0, Spacegun68K1WriteByte); - SekClose(); - - SekInit(1, 0x68000); - SekOpen(1); - SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); - SekMapMemory(Taito68KRam2 , 0x20c000, 0x20ffff, SM_RAM); - SekMapMemory(TaitoSharedRam , 0x210000, 0x21ffff, SM_RAM); - SekSetReadWordHandler(0, Spacegun68K2ReadWord); - SekSetWriteWordHandler(0, Spacegun68K2WriteWord); - SekSetReadByteHandler(0, Spacegun68K2ReadByte); - SekSetWriteByteHandler(0, Spacegun68K2WriteByte); - SekClose(); - - BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, NULL, TaitoZ68KSynchroniseStream, TaitoZ68KGetTime, 0); - BurnTimerAttachSek(16000000); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); - - EEPROMInit(&spacegun_eeprom_intf); - if (!EEPROMAvailable()) EEPROMFill(spacegun_default_eeprom, 0, 128); - - TaitoMakeInputsFunction = SpacegunMakeInputs; - TaitoDrawFunction = SpacegunDraw; - TaitoIrqLine = 4; - TaitoFrameInterleave = 100; - TaitoFlipScreenX = 1; - TaitoNumEEPROM = 1; - - nTaitoCyclesTotal[0] = 16000000 / 60; - nTaitoCyclesTotal[1] = 16000000 / 60; - - BurnGunInit(2, true); - - // Reset the driver - TaitoZDoReset(); - - return 0; -} - -static INT32 TaitoZExit() -{ - TaitoExit(); - - SciSpriteFrame = 0; - OldSteer = 0; - Sci = 0; - - // Switch back CPU core if needed - if (bUseAsm68KCoreOldValue) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); -#endif - bUseAsm68KCoreOldValue = false; - bBurnUseASMCPUEmulation = true; - } - - return 0; -} - -static inline UINT8 pal5bit(UINT8 bits) -{ - bits &= 0x1f; - return (bits << 3) | (bits >> 2); -} - -inline static UINT32 CalcCol(UINT16 nColour) -{ - INT32 r, g, b; - - r = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); - g = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 5); - b = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 10); - - return BurnHighCol(r, g, b, 0); -} - -static void TaitoZCalcPalette() -{ - INT32 i; - UINT16* ps; - UINT32* pd; - - for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x1000; i++, ps++, pd++) { - *pd = CalcCol(*ps); - } -} - -static void RenderSpriteZoom(INT32 Code, INT32 sx, INT32 sy, INT32 Colour, INT32 xFlip, INT32 yFlip, INT32 xScale, INT32 yScale, UINT8* pSource) -{ - // We can use sprite A for sizes, etc. as only Chase HQ uses sprite B and it has the same sizes and count - - UINT8 *SourceBase = pSource + ((Code % TaitoNumSpriteA) * TaitoSpriteAWidth * TaitoSpriteAHeight); - - INT32 SpriteScreenHeight = (yScale * TaitoSpriteAHeight + 0x8000) >> 16; - INT32 SpriteScreenWidth = (xScale * TaitoSpriteAWidth + 0x8000) >> 16; - - Colour = 0x10 * (Colour % 0x100); - - if (TaitoFlipScreenX) { - xFlip = !xFlip; - sx = 320 - sx - (xScale >> 12); - } - - if (SpriteScreenWidth && SpriteScreenHeight) { - INT32 dx = (TaitoSpriteAWidth << 16) / SpriteScreenWidth; - INT32 dy = (TaitoSpriteAHeight << 16) / SpriteScreenHeight; - - INT32 ex = sx + SpriteScreenWidth; - INT32 ey = sy + SpriteScreenHeight; - - INT32 xIndexBase; - INT32 yIndex; - - if (xFlip) { - xIndexBase = (SpriteScreenWidth - 1) * dx; - dx = -dx; - } else { - xIndexBase = 0; - } - - if (yFlip) { - yIndex = (SpriteScreenHeight - 1) * dy; - dy = -dy; - } else { - yIndex = 0; - } - - if (sx < 0) { - INT32 Pixels = 0 - sx; - sx += Pixels; - xIndexBase += Pixels * dx; - } - - if (sy < 0) { - INT32 Pixels = 0 - sy; - sy += Pixels; - yIndex += Pixels * dy; - } - - if (ex > nScreenWidth) { - INT32 Pixels = ex - nScreenWidth; - ex -= Pixels; - } - - if (ey > nScreenHeight) { - INT32 Pixels = ey - nScreenHeight; - ey -= Pixels; - } - - if (ex > sx) { - INT32 y; - - for (y = sy; y < ey; y++) { - UINT8 *Source = SourceBase + ((yIndex >> 16) * TaitoSpriteAWidth); - UINT16* pPixel = pTransDraw + (y * nScreenWidth); - - INT32 x, xIndex = xIndexBase; - for (x = sx; x < ex; x++) { - INT32 c = Source[xIndex >> 16]; - if (c != 0) { - pPixel[x] = c | Colour; - } - xIndex += dx; - } - - yIndex += dy; - } - } - } -} - -static void AquajackRenderSprites(INT32 PriorityDraw) -{ - UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - INT32 Offset, Data, Tile, Colour, xFlip, yFlip; - INT32 x, y, Priority, xCur, yCur; - INT32 xZoom, yZoom, zx, zy; - INT32 SpriteChunk, MapOffset, Code, j, k, px, py; - - for (Offset = 0x200 - 4; Offset >= 0; Offset -= 4) { - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); - Priority = (Data & 0x8000) >> 15; - - if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); - if (Priority != PriorityDraw) continue; - - xFlip = (Data & 0x4000) >> 14; - x = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); - yFlip = (Data & 0x8000) >> 15; - Tile = Data & 0x1fff; - if (!Tile) continue; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); - yZoom = (Data & 0x7e00) >> 9; - y = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); - Colour = (Data & 0xff00) >> 8; - xZoom = (Data & 0x3f); - - MapOffset = Tile << 5; - - xZoom += 1; - yZoom += 1; - - y += 3; - - if (x > 0x140) x -= 0x200; - if (y > 0x140) y -= 0x200; - - for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { - k = SpriteChunk % 4; - j = SpriteChunk / 4; - - px = xFlip ? (3 - k) : k; - py = yFlip ? (7 - j) : j; - - Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); - Code &= (TaitoNumSpriteA - 1); - - xCur = x + ((k * xZoom) / 4); - yCur = y + ((j * yZoom) / 8); - - zx = x + (((k + 1) * xZoom) / 4) - xCur; - zy = y + (((j + 1) * yZoom) / 8) - yCur; - - yCur -= 16; - - RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); - } - - - } -} - -static void BsharkRenderSprites(INT32 PriorityDraw, INT32 yOffset, INT32 SpriteRamSize) -{ - UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - INT32 Offset, Data, Tile, Colour, xFlip, yFlip; - INT32 x, y, Priority, xCur, yCur; - INT32 xZoom, yZoom, zx, zy; - INT32 SpriteChunk, MapOffset, Code, j, k, px, py; - - for (Offset = 0; Offset < SpriteRamSize - 4; Offset += 4) { - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); - Priority = (Data & 0x8000) >> 15; - - if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); - if (Priority != PriorityDraw) continue; - - Colour = (Data & 0x7f80) >> 7; - xZoom = (Data & 0x3f); - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); - Tile = Data & 0x1fff; - if (!Tile) continue; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); - yZoom = (Data & 0x7e00) >> 9; - y = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); - yFlip = (Data & 0x8000) >> 15; - xFlip = (Data & 0x4000) >> 14; - x = Data & 0x1ff; - - MapOffset = Tile << 5; - - xZoom += 1; - yZoom += 1; - - y += yOffset; - y += (64 - yZoom); - - if (x > 0x140) x -= 0x200; - if (y > 0x140) y -= 0x200; - - for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { - k = SpriteChunk % 4; - j = SpriteChunk / 4; - - px = xFlip ? (3 - k) : k; - py = yFlip ? (7 - j) : j; - - Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); - Code &= (TaitoNumSpriteA - 1); - - xCur = x + ((k * xZoom) / 4); - yCur = y + ((j * yZoom) / 8); - - zx = x + (((k + 1) * xZoom) / 4) - xCur; - zy = y + (((j + 1) * yZoom) / 8) - yCur; - - yCur -= 16; - - RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); - } - - } -} - -static void ChasehqRenderSprites(INT32 PriorityDraw) -{ - UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - INT32 Offset, Data, Tile, Colour, xFlip, yFlip; - INT32 x, y, Priority, xCur, yCur; - INT32 xZoom, yZoom, zx, zy; - INT32 SpriteChunk, MapOffset, Code, j, k, px, py; - - for (Offset = 0; Offset < 0x400; Offset += 4) { - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); - Priority = (Data & 0x8000) >> 15; - - if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); - if (Priority != PriorityDraw) continue; - - Colour = (Data & 0x7f80) >> 7; - xZoom = (Data & 0x7f); - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); - Tile = Data & 0x7ff; - if (!Tile) continue; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); - yZoom = (Data & 0xfe00) >> 9; - y = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); - yFlip = (Data & 0x8000) >> 15; - xFlip = (Data & 0x4000) >> 14; - x = Data & 0x1ff; - - xZoom += 1; - yZoom += 1; - - y += 7; - y += (128 - yZoom); - - if (x > 0x140) x -= 0x200; - if (y > 0x140) y -= 0x200; - - if ((xZoom - 1) & 0x40) { - MapOffset = Tile << 6; - - for (SpriteChunk = 0; SpriteChunk < 64; SpriteChunk++) { - j = SpriteChunk / 8; - k = SpriteChunk % 8; - - px = xFlip ? (7 - k) : k; - py = yFlip ? (7 - j) : j; - - Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 3)]); - Code &= (TaitoNumSpriteA - 1); - - xCur = x + ((k * xZoom) / 8); - yCur = y + ((j * yZoom) / 8); - - zx = x + (((k + 1) * xZoom) / 8) - xCur; - zy = y + (((j + 1) * yZoom) / 8) - yCur; - - yCur -= 16; - - RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 12, TaitoSpritesA); - } - } else if ((xZoom - 1) & 0x20) { - MapOffset = (Tile << 5) + 0x20000; - - for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { - j = SpriteChunk / 4; - k = SpriteChunk % 4; - - px = xFlip ? (3 - k) : k; - py = yFlip ? (7 - j) : j; - - Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); - Code &= (TaitoNumSpriteB - 1); - - xCur = x + ((k * xZoom) / 4); - yCur = y + ((j * yZoom) / 8); - - zx = x + (((k + 1) * xZoom) / 4) - xCur; - zy = y + (((j + 1) * yZoom) / 8) - yCur; - - yCur -= 16; - - RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 12, TaitoSpritesB); - } - } else if (!((xZoom - 1) & 0x60)) { - MapOffset = (Tile << 4) + 0x30000; - - for (SpriteChunk = 0; SpriteChunk < 16; SpriteChunk++) { - j = SpriteChunk / 2; - k = SpriteChunk % 2; - - px = xFlip ? (1 - k) : k; - py = yFlip ? (7 - j) : j; - - Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 1)]); - Code &= (TaitoNumSpriteB - 1); - - xCur = x + ((k * xZoom) / 2); - yCur = y + ((j * yZoom) / 8); - - zx = x + (((k + 1) * xZoom) / 2) - xCur; - zy = y + (((j + 1) * yZoom) / 8) - yCur; - - yCur -= 16; - - RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 12, TaitoSpritesB); - } - } - } -} - -static void ContcircRenderSprites(INT32 PriorityDraw, INT32 VisibleYOffset) -{ - UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - INT32 Offset, Data, Tile, Colour, xFlip, yFlip; - INT32 x, y, Priority, xCur, yCur; - INT32 xZoom, yZoom, zx, zy; - INT32 SpriteChunk, MapOffset, Code, j, k, px, py; - - for (Offset = 0x380 - 4; Offset >= 0; Offset -= 4) { - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); - Priority = (Data & 0x8000) >> 15; - - if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); - if (Priority != PriorityDraw) continue; - - xFlip = (Data & 0x4000) >> 14; - yFlip = (Data & 0x2000) >> 13; - x = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); - Tile = Data & 0x7ff; - if (!Tile) continue; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); - yZoom = (Data & 0xfe00) >> 9; - y = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); - Colour = (Data & 0xff00) >> 8; - xZoom = (Data & 0x7f); - - MapOffset = Tile << 7; - - xZoom += 1; - yZoom += 1; - - y += 5; - y += ( 128 - yZoom); - - if (x > 0x140) x -= 0x200; - if (y > 0x140) y -= 0x200; - - for (SpriteChunk = 0; SpriteChunk < 128; SpriteChunk++) { - k = SpriteChunk % 8; - j = SpriteChunk / 8; - - px = xFlip ? (7 - k) : k; - py = yFlip ? (15 - j) : j; - - Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 3)]); - Code &= (TaitoNumSpriteA - 1); - - xCur = x + ((k * xZoom) / 8); - yCur = y + ((j * yZoom) / 16); - - zx = x + (((k + 1) * xZoom) / 8) - xCur; - zy = y + (((j + 1) * yZoom) / 16) - yCur; - - yCur -= VisibleYOffset; - - RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); - } - } -} - -static void SciRenderSprites(INT32 PriorityDraw, INT32 yOffs) -{ - UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - INT32 Offset, StartOffs, Data, Tile, Colour, xFlip, yFlip; - INT32 x, y, Priority, xCur, yCur; - INT32 xZoom, yZoom, zx, zy; - INT32 SpriteChunk, MapOffset, Code, j, k, px, py; - - StartOffs = (SciSpriteFrame & 1) ? 0x800 : 0; - - for (Offset = StartOffs; Offset < StartOffs + 0x800; Offset += 4) { - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); - Priority = (Data & 0x8000) >> 15; - - if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); - if (Priority != PriorityDraw) continue; - - Colour = (Data & 0x7f80) >> 7; - xZoom = (Data & 0x3f); - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); - Tile = Data & 0x1fff; - if (!Tile) continue; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); - yZoom = (Data & 0x7e00) >> 9; - y = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); - yFlip = (Data & 0x8000) >> 15; - xFlip = (Data & 0x4000) >> 14; - x = Data & 0x1ff; - - MapOffset = Tile << 5; - - xZoom += 1; - yZoom += 1; - - y += yOffs; - y += (64 - yZoom); - - if (x > 0x140) x -= 0x200; - if (y > 0x140) y -= 0x200; - - for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { - k = SpriteChunk % 4; - j = SpriteChunk / 4; - - px = xFlip ? (3-k) : k; - py = yFlip ? (7-j) : j; - - Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); - Code &= (TaitoNumSpriteA - 1); - - xCur = x + ((k * xZoom) / 4); - yCur = y + ((j * yZoom) / 8); - - zx = x + (((k + 1) * xZoom) / 4) - xCur; - zy = y + (((j + 1) * yZoom) / 8) - yCur; - - yCur -= 16; - - RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); - } - } -} - -static void SpacegunRenderSprites(INT32 PriorityDraw) -{ - UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; - UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; - INT32 Offset, Data, Tile, Colour, xFlip, yFlip; - INT32 x, y, Priority, xCur, yCur; - INT32 xZoom, yZoom, zx, zy; - INT32 SpriteChunk, MapOffset, Code, j, k, px, py; - - for (Offset = 0x300 - 4; Offset >= 0; Offset -= 4) { - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); - Priority = (Data & 0x8000) >> 15; - - if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); - if (Priority != PriorityDraw) continue; - - xFlip = (Data & 0x4000) >> 14; - x = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); - yFlip = (Data & 0x8000) >> 15; - Tile = Data & 0x1fff; - if (!Tile) continue; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); - yZoom = (Data & 0xfe00) >> 9; - y = Data & 0x1ff; - - Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); - Colour = (Data & 0xff00) >> 8; - xZoom = (Data & 0x7f); - - MapOffset = Tile << 5; - - xZoom += 1; - yZoom += 1; - - y += 4; - - if (x > 0x140) x -= 0x200; - if (y > 0x140) y -= 0x200; - - for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { - k = SpriteChunk % 4; - j = SpriteChunk / 4; - - px = xFlip ? (3 - k) : k; - py = yFlip ? (7 - j) : j; - - Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); - Code &= (TaitoNumSpriteA - 1); - - xCur = x + ((k * xZoom) / 4); - yCur = y + ((j * yZoom) / 8); - - zx = x + (((k + 1) * xZoom) / 4) - xCur; - zy = y + (((j + 1) * yZoom) / 8) - yCur; - - yCur -= 16; - - RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); - } - - } -} - -static void AquajackDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - AquajackRenderSprites(1); - - TC0150RODDraw(-1, 0, 2, 1, 1, 2); - - AquajackRenderSprites(0); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TC0110PCRPalette); -} - -static void BsharkDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - TaitoZCalcPalette(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - BsharkRenderSprites(1, 8, 0x800); - - TC0150RODDraw(-1, 0xc0, 0, 1, 1, 2); - - BsharkRenderSprites(0, 8, 0x800); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TaitoPalette); -} - -static void ChasehqDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - ChasehqRenderSprites(1); - - TC0150RODDraw(-1, 0xc0, 0, 0, 1, 2); - - ChasehqRenderSprites(0); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TC0110PCRPalette); -} - -static void ContcircDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - ContcircRenderSprites(1, 24); - - TC0150RODDraw(-3 + 8, TaitoRoadPalBank << 6, 1, 0, 1, 2); - - ContcircRenderSprites(0, 24); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TC0110PCRPalette); -} - -static void EnforceDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - ContcircRenderSprites(1, 24); - - TC0150RODDraw(-3 + 8, 0xc0, 1, 0, 1, 2); - - ContcircRenderSprites(0, 24); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TC0110PCRPalette); -} - -static void DblaxleDraw() -{ - UINT8 Layer[4]; - UINT16 Priority = TC0480SCPGetBgPriority(); - - Layer[0] = (Priority & 0xf000) >> 12; - Layer[1] = (Priority & 0x0f00) >> 8; - Layer[2] = (Priority & 0x00f0) >> 4; - Layer[3] = (Priority & 0x000f) >> 0; - - BurnTransferClear(); - TaitoZCalcPalette(); - - TC0480SCPTilemapRender(Layer[0], 1, TaitoChars); - TC0480SCPTilemapRender(Layer[1], 0, TaitoChars); - TC0480SCPTilemapRender(Layer[2], 0, TaitoChars); - - BsharkRenderSprites(1, 7, 0x2000); - - TC0150RODDraw(-1, 0xc0, 0, 0, 1, 2); - - BsharkRenderSprites(0, 7, 0x2000); - - TC0480SCPTilemapRender(Layer[3], 0, TaitoChars); - - TC0480SCPRenderCharLayer(); - BurnTransferCopy(TaitoPalette); -} - -static void RacingbDraw() -{ - UINT8 Layer[4]; - UINT16 Priority = TC0480SCPGetBgPriority(); - - Layer[0] = (Priority & 0xf000) >> 12; - Layer[1] = (Priority & 0x0f00) >> 8; - Layer[2] = (Priority & 0x00f0) >> 4; - Layer[3] = (Priority & 0x000f) >> 0; - - BurnTransferClear(); - TaitoZCalcPalette(); - - TC0480SCPTilemapRender(Layer[0], 1, TaitoChars); - TC0480SCPTilemapRender(Layer[1], 0, TaitoChars); - SciRenderSprites(1, 7); - TC0480SCPTilemapRender(Layer[2], 0, TaitoChars); - TC0480SCPTilemapRender(Layer[3], 0, TaitoChars); - TC0150RODDraw(-1, 0xc0, 0, 0, 1, 2); - SciRenderSprites(0, 7); - TC0480SCPRenderCharLayer(); - BurnTransferCopy(TaitoPalette); -} - -static void SciDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - TaitoZCalcPalette(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - SciRenderSprites(1, 6); - - TC0150RODDraw(-1, 0xc0, 0, 0, 1, 2); - - SciRenderSprites(0, 6); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - - BurnTransferCopy(TaitoPalette); -} - -static void SpacegunDraw() -{ - INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; - - BurnTransferClear(); - - if (TC0100SCNBottomLayer(0)) { - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); - SpacegunRenderSprites(1); - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); - } else { - if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); - SpacegunRenderSprites(1); - if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); - } - - SpacegunRenderSprites(0); - - if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); - BurnTransferCopy(TC0110PCRPalette); - - for (INT32 i = 0; i < nBurnGunNumPlayers; i++) { - BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); - } -} - -static INT32 TaitoZFrame() -{ - INT32 nInterleave = TaitoFrameInterleave; - - if (TaitoReset) TaitoZDoReset(); - - TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = 0; - - SekNewFrame(); - if (TaitoNumZ80s) ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run 68000 #1 - nCurrentCPU = 0; - SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == 10 && Sci && ((GetCurrentFrame() & 1) == 0)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); - if (i == (TaitoFrameInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - - // Run 68000 #2 - if ((TaitoCpuACtrl & 0x01) && TaitoNumZ80s) { - nCurrentCPU = 1; - SekOpen(1); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == (TaitoFrameInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - } - - if (TaitoNumZ80s) { - ZetOpen(0); - BurnTimerUpdate(i * (nTaitoCyclesTotal[2] / nInterleave)); - ZetClose(); - } - } - - if (TaitoNumZ80s) { - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[2]); - if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - ZetClose(); - } else { - SekOpen(1); - if (TaitoCpuACtrl & 0x01) BurnTimerEndFrame(nTaitoCyclesTotal[1]); - if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); - if (TaitoCpuACtrl & 0x01) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); - SekClose(); - } - - if (pBurnDraw) TaitoDrawFunction(); - - return 0; -} - -static INT32 TaitoZScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029674; - } - - if (nAction & ACB_MEMORY_RAM) { - memset(&ba, 0, sizeof(ba)); - ba.Data = TaitoRamStart; - ba.nLen = TaitoRamEnd-TaitoRamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - } - - TaitoICScan(nAction); - - if (nAction & ACB_DRIVER_DATA) { - SekScan(nAction); - if (TaitoNumZ80s) ZetScan(nAction); - - BurnYM2610Scan(nAction, pnMin); - - BurnGunScan(); - - SCAN_VAR(TaitoAnalogPort0); - SCAN_VAR(TaitoAnalogPort1); - SCAN_VAR(TaitoAnalogPort2); - SCAN_VAR(TaitoAnalogPort3); - SCAN_VAR(TaitoInput); - SCAN_VAR(OldSteer); - SCAN_VAR(TaitoCpuACtrl); - SCAN_VAR(TaitoZ80Bank); - SCAN_VAR(SciSpriteFrame); - SCAN_VAR(TaitoRoadPalBank); - SCAN_VAR(nTaitoCyclesDone); - SCAN_VAR(nTaitoCyclesSegment); - } - - if (nAction & ACB_WRITE) { - if (TaitoNumZ80s) { - ZetOpen(0); - ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); - ZetClose(); - } - } - - return 0; -} - -struct BurnDriver BurnDrvAquajack = { - "aquajack", NULL, NULL, NULL, "1990", - "Aquajack (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_MISC, 0, - NULL, AquajackRomInfo, AquajackRomName, NULL, NULL, AquajackInputInfo, AquajackDIPInfo, - AquajackInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvAquajackj = { - "aquajackj", "aquajack", NULL, NULL, "1990", - "Aquajack (Japan)\0", NULL, "Taito Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_MISC, 0, - NULL, AquajackjRomInfo, AquajackjRomName, NULL, NULL, AquajackInputInfo, AquajackjDIPInfo, - AquajackInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvAquajacku = { - "aquajacku", "aquajack", NULL, NULL, "1990", - "Aquajack (US)\0", NULL, "Taito Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_MISC, 0, - NULL, AquajackuRomInfo, AquajackuRomName, NULL, NULL, AquajackInputInfo, AquajackjDIPInfo, - AquajackInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvBshark = { - "bshark", NULL, NULL, NULL, "1989", - "Battle Shark (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, - NULL, BsharkRomInfo, BsharkRomName, NULL, NULL, BsharkInputInfo, BsharkDIPInfo, - BsharkInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvBsharkj = { - "bsharkj", "bshark", NULL, NULL, "1989", - "Battle Shark (Japan)\0", NULL, "Taito Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, - NULL, BsharkjRomInfo, BsharkjRomName, NULL, NULL, BsharkInputInfo, BsharkjDIPInfo, - BsharkInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvBsharkjjs = { - "bsharkjjs", "bshark", NULL, NULL, "1989", - "Battle Shark (Japan, Joystick)\0", NULL, "Taito Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, - NULL, BsharkjjsRomInfo, BsharkjjsRomName, NULL, NULL, BsharkjjsInputInfo, BsharkjjsDIPInfo, - BsharkInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvBsharku = { - "bsharku", "bshark", NULL, NULL, "1989", - "Battle Shark (US)\0", NULL, "Taito America Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, - NULL, BsharkuRomInfo, BsharkuRomName, NULL, NULL, BsharkInputInfo, BsharkuDIPInfo, - BsharkInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvChasehq = { - "chasehq", NULL, NULL, NULL, "1988", - "Chase H.Q. (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, ChasehqRomInfo, ChasehqRomName, NULL, NULL, ChasehqInputInfo, ChasehqDIPInfo, - ChasehqInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvChasehqj = { - "chasehqj", "chasehq", NULL, NULL, "1988", - "Chase H.Q. (Japan)\0", NULL, "Taito Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, ChasehqjRomInfo, ChasehqjRomName, NULL, NULL, ChasehqInputInfo, ChasehqjDIPInfo, - ChasehqInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvChasehqu = { - "chasehqu", "chasehq", NULL, NULL, "1988", - "Chase H.Q. (US)\0", NULL, "Taito America Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, ChasehquRomInfo, ChasehquRomName, NULL, NULL, ChasehqInputInfo, ChasehqDIPInfo, - ChasehqInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvContcirc = { - "contcirc", NULL, NULL, NULL, "1987", - "Continental Circus (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, ContcircRomInfo, ContcircRomName, NULL, NULL, ContcircInputInfo, ContcircDIPInfo, - ContcircInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvContcircu = { - "contcircu", "contcirc", NULL, NULL, "1987", - "Continental Circus (US set 1)\0", NULL, "Taito America Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, ContcircuRomInfo, ContcircuRomName, NULL, NULL, ContcircInputInfo, ContcircuDIPInfo, - ContcircInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvContcircua = { - "contcircua", "contcirc", NULL, NULL, "1987", - "Continental Circus (US set 2)\0", NULL, "Taito America Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, ContcircuaRomInfo, ContcircuaRomName, NULL, NULL, ContcircInputInfo, ContcircuDIPInfo, - ContcircInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvDblaxle = { - "dblaxle", NULL, NULL, NULL, "1991", - "Double Axle (US)\0", NULL, "Taito America Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, DblaxleRomInfo, DblaxleRomName, NULL, NULL, DblaxleInputInfo, DblaxleDIPInfo, - DblaxleInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvPwheelsj = { - "pwheelsj", "dblaxle", NULL, NULL, "1991", - "Power Wheels (Japan)\0", NULL, "Taito Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, PwheelsjRomInfo, PwheelsjRomName, NULL, NULL, DblaxleInputInfo, PwheelsjDIPInfo, - DblaxleInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvEnforce = { - "enforce", NULL, NULL, NULL, "1988", - "Enforce (Japan)\0", NULL, "Taito Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, - NULL, EnforceRomInfo, EnforceRomName, NULL, NULL, EnforceInputInfo, EnforceDIPInfo, - EnforceInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 224, 4, 3 -}; - -struct BurnDriver BurnDrvNightstr = { - "nightstr", NULL, NULL, NULL, "1989", - "Night Striker (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_MISC, 0, - NULL, NightstrRomInfo, NightstrRomName, NULL, NULL, NightstrInputInfo, NightstrDIPInfo, - NightstrInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvNightstrj = { - "nightstrj", "nightstr", NULL, NULL, "1989", - "Night Striker (Japan)\0", NULL, "Taito Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_MISC, 0, - NULL, NightstrjRomInfo, NightstrjRomName, NULL, NULL, NightstrInputInfo, NightstrjDIPInfo, - NightstrInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvNightstru = { - "nightstru", "nightstr", NULL, NULL, "1989", - "Night Striker (US)\0", NULL, "Taito America Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, NightstruRomInfo, NightstruRomName, NULL, NULL, NightstrInputInfo, NightstruDIPInfo, - NightstrInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvRacingb = { - "racingb", NULL, NULL, NULL, "1991", - "Racing Beat (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, RacingbRomInfo, RacingbRomName, NULL, NULL, RacingbInputInfo, RacingbDIPInfo, - RacingbInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSci = { - "sci", NULL, NULL, NULL, "1989", - "Special Criminal Investigation (World set 1)\0", NULL, "Taito Corporation Japan", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, SciRomInfo, SciRomName, NULL, NULL, SciInputInfo, SciDIPInfo, - SciInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvScia = { - "scia", "sci", NULL, NULL, "1989", - "Special Criminal Investigation (World set 2)\0", NULL, "Taito Corporation Japan", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, SciaRomInfo, SciaRomName, NULL, NULL, SciInputInfo, SciDIPInfo, - SciInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvScij = { - "scij", "sci", NULL, NULL, "1989", - "Special Criminal Investigation (Japan)\0", NULL, "Taito Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, ScijRomInfo, ScijRomName, NULL, NULL, SciInputInfo, ScijDIPInfo, - SciInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSciu = { - "sciu", "sci", NULL, NULL, "1989", - "Special Criminal Investigation (US)\0", NULL, "Taito America Corporation", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, SciuRomInfo, SciuRomName, NULL, NULL, SciInputInfo, SciuDIPInfo, - SciInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvScinegro = { - "scinegro", "sci", NULL, NULL, "1989", - "Special Criminal Investigation (Negro bootleg)\0", NULL, "Negro", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, - NULL, ScinegroRomInfo, ScinegroRomName, NULL, NULL, SciInputInfo, SciDIPInfo, - SciInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvSpacegun = { - "spacegun", NULL, NULL, NULL, "1990", - "Space Gun (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, - NULL, SpacegunRomInfo, SpacegunRomName, NULL, NULL, SpacegunInputInfo, SpacegunDIPInfo, - SpacegunInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, - NULL, 0x1000, 320, 240, 4, 3 -}; +#include "tiles_generic.h" +#include "m68000_intf.h" +#include "z80_intf.h" +#include "taito.h" +#include "taito_ic.h" +#include "burn_ym2610.h" +#include "eeprom.h" +#include "burn_gun.h" + +static INT32 Sci; +static INT32 OldSteer; // Hack to centre the steering in SCI +static INT32 SciSpriteFrame; + +static double TaitoZYM2610Route1MasterVol; +static double TaitoZYM2610Route2MasterVol; + +static void AquajackDraw(); +static void BsharkDraw(); +static void ChasehqDraw(); +static void ContcircDraw(); +static void DblaxleDraw(); +static void EnforceDraw(); +static void RacingbDraw(); +static void SciDraw(); +static void SpacegunDraw(); + +static bool bUseAsm68KCoreOldValue = false; + +#define A(a, b, c, d) {a, b, (UINT8*)(c), d} + +static struct BurnInputInfo AquajackInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, + + {"Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 up" }, + {"Down" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 down" }, + {"Left" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p1 left" }, + {"Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p1 right" }, + {"Jump" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p1 fire 1" }, + {"Accelerate" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 fire 2" }, + {"Vulcan" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p1 fire 3" }, + {"Missile" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p1 fire 4" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Aquajack) + +static struct BurnInputInfo BsharkInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "p2 start" }, + + A("Crosshair X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), + A("Crosshair Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "p1 y-axis" ), + {"Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Bshark) + +static struct BurnInputInfo BsharkjjsInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "p2 start" }, + + {"Up" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "p1 up" }, + {"Down" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p1 down" }, + {"Left" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p1 left" }, + {"Right" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 right" }, + {"Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Bsharkjjs) + +static struct BurnInputInfo ChasehqInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, + + A("Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), + {"Brake" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 1" }, + {"Accelerate" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p1 fire 2" }, + {"Turbo" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 fire 3" }, + {"Gear" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p1 fire 4" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Chasehq) + +static struct BurnInputInfo ContcircInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p2 coin" }, + + A("Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), + {"Brake" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p1 fire 1" }, + {"Accelerate" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 fire 2" }, + {"Gear" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p1 fire 3" }, + {"Brake 2" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p1 fire 4" }, + {"Brake 3" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p1 fire 5" }, + {"Accelerate 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 6" }, + {"Accelerate 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 fire 7" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Contcirc) + +static struct BurnInputInfo DblaxleInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p2 coin" }, + + A("Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), + {"Brake" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 1" }, + {"Accelerate" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p1 fire 2" }, + {"Nitro" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p1 fire 3" }, + {"Gear" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 4" }, + {"Reverse" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p1 fire 5" }, + {"Centre" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p1 fire 6" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "service" }, + {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort1 + 1, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Dblaxle) + +static struct BurnInputInfo EnforceInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p2 coin" }, + + {"Up" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 up" }, + {"Down" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 down" }, + {"Left" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p1 left" }, + {"Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p1 right" }, + {"Laser" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 fire 1" }, + {"Bomb" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Enforce) + +static struct BurnInputInfo NightstrInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "p2 start" }, + + A("Stick X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), + A("Stick Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "p1 y-axis" ), + {"Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p1 fire 1" }, + {"Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p1 fire 2" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Nightstr) + +static struct BurnInputInfo RacingbInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0510NIOInputPort0 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0510NIOInputPort1 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p2 coin" }, + + A("Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), + {"Brake" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p1 fire 1" }, + {"Accelerate" , BIT_DIGITAL , TC0510NIOInputPort1 + 5, "p1 fire 2" }, + {"Pit In" , BIT_DIGITAL , TC0510NIOInputPort1 + 0, "p1 fire 3" }, + {"Gear" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "p1 fire 4" }, + {"Centre" , BIT_DIGITAL , TC0510NIOInputPort1 + 2, "p1 fire 5" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0510NIOInputPort0 + 4, "service" }, + {"Dip 1" , BIT_DIPSWITCH , TC0510NIODip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0510NIODip + 1 , "dip" }, +}; + +STDINPUTINFO(Racingb) + +static struct BurnInputInfo SciInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, + + A("Steering" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "p1 x-axis" ), + {"Brake" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p1 fire 1" }, + {"Accelerate" , BIT_DIGITAL , TC0220IOCInputPort1 + 5, "p1 fire 2" }, + {"Fire" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p1 fire 3" }, + {"Turbo" , BIT_DIGITAL , TC0220IOCInputPort1 + 0, "p1 fire 4" }, + {"Gear" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p1 fire 5" }, + {"Centre" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p1 fire 6" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, + {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort1 + 1, "tilt" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Sci) + +static struct BurnInputInfo SpacegunInputList[] = +{ + {"Coin 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p1 coin" }, + {"Start 1" , BIT_DIGITAL , TC0220IOCInputPort0 + 6, "p1 start" }, + {"Coin 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p2 coin" }, + {"Start 2" , BIT_DIGITAL , TC0220IOCInputPort0 + 7, "p2 start" }, + + A("P1 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort0 , "mouse x-axis" ), + A("P1 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort1 , "mouse y-axis" ), + {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "mouse button 1" }, + {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 2, "mouse button 2" }, + {"P1 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "p1 fire 1" }, + + A("P2 Gun X" , BIT_ANALOG_REL, &TaitoAnalogPort2 , "p2 x-axis" ), + A("P2 Gun Y" , BIT_ANALOG_REL, &TaitoAnalogPort3 , "p2 y-axis" ), + {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "p2 fire 1" }, + {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 fire 2" }, + {"P2 Fire 3" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "p2 fire 3" }, + + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, + {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 4, "service" }, + {"Dip 1" , BIT_DIPSWITCH , TC0220IOCDip + 0 , "dip" }, + {"Dip 2" , BIT_DIPSWITCH , TC0220IOCDip + 1 , "dip" }, +}; + +STDINPUTINFO(Spacegun) + +#undef A + +static void AquajackMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0xff; + TC0220IOCInput[1] = 0xff; + TC0220IOCInput[2] = 0xff; + + if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; + if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; + if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] -= 0x04; + if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] -= 0x08; + if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; + if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; + if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; + if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; + + if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; + if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; + if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; + if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; + if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] -= 0x10; + if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] -= 0x20; + if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] -= 0x40; + if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] -= 0x80; +} + +static void BsharkMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0xff; + TC0220IOCInput[1] = 0xff; + TC0220IOCInput[2] = 0xff; + + if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; + if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; + if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] -= 0x04; + if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] -= 0x08; + if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; + if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; + if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; + if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; + + if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; + if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; + if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; + if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] -= 0x08; + if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; + if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; + if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; + if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; +} + +static void ChasehqMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0xf3; + TC0220IOCInput[1] = 0xef; + TC0220IOCInput[2] = 0xff; + + if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; + if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; + if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; + if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; + if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; + if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; + if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; + if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; + + if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; + if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; + if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; + if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; + if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] |= 0x10; + if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] -= 0x20; + if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] -= 0x40; + if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] -= 0x80; +} + +static void ContcircMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0x13; + TC0220IOCInput[1] = 0x0f; + TC0220IOCInput[2] = 0xff; + + if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; + if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; + if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; + if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; + if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; + if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] |= 0x20; + if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] |= 0x40; + if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] |= 0x80; + + if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; + if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; + if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; + if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; + if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] |= 0x10; + if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] |= 0x20; + if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] |= 0x40; + if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] |= 0x80; +} + +static void DblaxleMakeInputs() +{ + // Reset Inputs + TC0510NIOInput[0] = 0xff; + TC0510NIOInput[1] = 0xff; + TC0510NIOInput[2] = 0xff; + + if (TC0510NIOInputPort0[0]) TC0510NIOInput[0] -= 0x01; + if (TC0510NIOInputPort0[1]) TC0510NIOInput[0] -= 0x02; + if (TC0510NIOInputPort0[2]) TC0510NIOInput[0] -= 0x04; + if (TC0510NIOInputPort0[3]) TC0510NIOInput[0] -= 0x08; + if (TC0510NIOInputPort0[4]) TC0510NIOInput[0] -= 0x10; + if (TC0510NIOInputPort0[5]) TC0510NIOInput[0] -= 0x20; + if (TC0510NIOInputPort0[6]) TC0510NIOInput[0] -= 0x40; + if (TC0510NIOInputPort0[7]) TC0510NIOInput[0] -= 0x80; + + if (TC0510NIOInputPort1[0]) TC0510NIOInput[1] -= 0x01; + if (TC0510NIOInputPort1[1]) TC0510NIOInput[1] -= 0x02; + if (TC0510NIOInputPort1[2]) TC0510NIOInput[1] -= 0x04; + if (TC0510NIOInputPort1[3]) TC0510NIOInput[1] -= 0x08; + if (TC0510NIOInputPort1[4]) TC0510NIOInput[1] -= 0x10; + if (TC0510NIOInputPort1[5]) TC0510NIOInput[1] -= 0x20; + if (TC0510NIOInputPort1[6]) TC0510NIOInput[1] -= 0x40; + if (TC0510NIOInputPort1[7]) TC0510NIOInput[1] -= 0x80; +} + +static void EnforceMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0xf3; + TC0220IOCInput[1] = 0xff; + TC0220IOCInput[2] = 0xff; + + if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; + if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; + if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; + if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; + if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; + if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; + if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; + if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; + + if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; + if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; + if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; + if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; + if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] -= 0x10; + if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] -= 0x20; + if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] -= 0x40; + if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] -= 0x80; +} + +static void NightstrMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0xff; + TC0220IOCInput[1] = 0xff; + TC0220IOCInput[2] = 0xff; + + if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; + if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; + if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] -= 0x04; + if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] -= 0x08; + if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; + if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; + if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; + if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; + + if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; + if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; + if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; + if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] -= 0x08; + if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; + if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; + if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; + if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; +} + +static void SciMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0xff; + TC0220IOCInput[1] = 0xef; + TC0220IOCInput[2] = 0xff; + + if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; + if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; + if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] -= 0x04; + if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] -= 0x08; + if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; + if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; + if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; + if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; + + if (TC0220IOCInputPort1[0]) TC0220IOCInput[1] -= 0x01; + if (TC0220IOCInputPort1[1]) TC0220IOCInput[1] -= 0x02; + if (TC0220IOCInputPort1[2]) TC0220IOCInput[1] -= 0x04; + if (TC0220IOCInputPort1[3]) TC0220IOCInput[1] -= 0x08; + if (TC0220IOCInputPort1[4]) TC0220IOCInput[1] |= 0x10; + if (TC0220IOCInputPort1[5]) TC0220IOCInput[1] -= 0x20; + if (TC0220IOCInputPort1[6]) TC0220IOCInput[1] -= 0x40; + if (TC0220IOCInputPort1[7]) TC0220IOCInput[1] -= 0x80; +} + +static void SpacegunMakeInputs() +{ + // Reset Inputs + TC0220IOCInput[0] = 0xff; + TC0220IOCInput[1] = 0xff; + TC0220IOCInput[2] = 0xff; + + if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] -= 0x01; + if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; + if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] -= 0x04; + if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] -= 0x08; + if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] -= 0x10; + if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; + if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; + if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; + + if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; + if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; + if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; + if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] -= 0x08; + if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; + if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; + if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; + if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; + + BurnGunMakeInputs(0, (INT16)TaitoAnalogPort0, (INT16)TaitoAnalogPort1); + BurnGunMakeInputs(1, (INT16)TaitoAnalogPort2, (INT16)TaitoAnalogPort3); +} + +static struct BurnDIPInfo AquajackDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x7f, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x80, 0x80, "Cockpit" }, + {0x0e, 0x01, 0x80, 0x00, "Upright" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0e, 0x01, 0x20, 0x20, "Off" }, + {0x0e, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0e, 0x01, 0x10, 0x00, "Off" }, + {0x0e, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0e, 0x01, 0x0c, 0x00, "4 Coins 1 Credit" }, + {0x0e, 0x01, 0x0c, 0x08, "3 Coins 1 Credit" }, + {0x0e, 0x01, 0x0c, 0x04, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0e, 0x01, 0x03, 0x03, "1 Coin 2 Credits" }, + {0x0e, 0x01, 0x03, 0x01, "1 Coin 3 Credits" }, + {0x0e, 0x01, 0x03, 0x02, "1 Coin 4 Credits" }, + {0x0e, 0x01, 0x03, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0f, 0x01, 0xc0, 0x40, "Easy" }, + {0x0f, 0x01, 0xc0, 0xc0, "Normal" }, + {0x0f, 0x01, 0xc0, 0x80, "Hard" }, + {0x0f, 0x01, 0xc0, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0f, 0x01, 0x30, 0x00, "30000" }, + {0x0f, 0x01, 0x30, 0x30, "50000" }, + {0x0f, 0x01, 0x30, 0x10, "80000" }, + {0x0f, 0x01, 0x30, 0x20, "100000" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x0c, 0x08, "1" }, + {0x0f, 0x01, 0x0c, 0x04, "2" }, + {0x0f, 0x01, 0x0c, 0x0c, "3" }, + {0x0f, 0x01, 0x0c, 0x00, "5" }, +}; + +STDDIPINFO(Aquajack) + +static struct BurnDIPInfo AquajackjDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0x7f, NULL }, + {0x0f, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x80, 0x80, "Cockpit" }, + {0x0e, 0x01, 0x80, 0x00, "Upright" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0e, 0x01, 0x20, 0x20, "Off" }, + {0x0e, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0e, 0x01, 0x10, 0x00, "Off" }, + {0x0e, 0x01, 0x10, 0x10, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0e, 0x01, 0x0c, 0x08, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0x0c, 0x0c, "1 Coin 1 Credit" }, + {0x0e, 0x01, 0x0c, 0x00, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0e, 0x01, 0x03, 0x02, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0x03, 0x03, "1 Coin 1 Credit" }, + {0x0e, 0x01, 0x03, 0x00, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0x03, 0x01, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0f, 0x01, 0xc0, 0x40, "Easy" }, + {0x0f, 0x01, 0xc0, 0xc0, "Normal" }, + {0x0f, 0x01, 0xc0, 0x80, "Hard" }, + {0x0f, 0x01, 0xc0, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Life" }, + {0x0f, 0x01, 0x30, 0x00, "30000" }, + {0x0f, 0x01, 0x30, 0x30, "50000" }, + {0x0f, 0x01, 0x30, 0x10, "80000" }, + {0x0f, 0x01, 0x30, 0x20, "100000" }, + + {0 , 0xfe, 0 , 4 , "Lives" }, + {0x0f, 0x01, 0x0c, 0x08, "1" }, + {0x0f, 0x01, 0x0c, 0x04, "2" }, + {0x0f, 0x01, 0x0c, 0x0c, "3" }, + {0x0f, 0x01, 0x0c, 0x00, "5" }, +}; + +STDDIPINFO(Aquajackj) + +static struct BurnDIPInfo BsharkDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xff, NULL }, + {0x0c, 0xff, 0xff, 0xf7, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Mirror Screen" }, + {0x0b, 0x01, 0x01, 0x01, "Off" }, + {0x0b, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x0b, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x0b, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x03, 0x02, "Easy" }, + {0x0c, 0x01, 0x03, 0x03, "Normal" }, + {0x0c, 0x01, 0x03, 0x01, "Hard" }, + {0x0c, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Speed of Sight" }, + {0x0c, 0x01, 0x0c, 0x0c, "Slow" }, + {0x0c, 0x01, 0x0c, 0x08, "Medium" }, + {0x0c, 0x01, 0x0c, 0x04, "Fast" }, + {0x0c, 0x01, 0x0c, 0x00, "Fastest" }, +}; + +STDDIPINFO(Bshark) + +static struct BurnDIPInfo BsharkjDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xff, NULL }, + {0x0c, 0xff, 0xff, 0xf7, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Mirror Screen" }, + {0x0b, 0x01, 0x01, 0x01, "Off" }, + {0x0b, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0b, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0b, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x03, 0x02, "Easy" }, + {0x0c, 0x01, 0x03, 0x03, "Normal" }, + {0x0c, 0x01, 0x03, 0x01, "Hard" }, + {0x0c, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Speed of Sight" }, + {0x0c, 0x01, 0x0c, 0x0c, "Slow" }, + {0x0c, 0x01, 0x0c, 0x08, "Medium" }, + {0x0c, 0x01, 0x0c, 0x04, "Fast" }, + {0x0c, 0x01, 0x0c, 0x00, "Fastest" }, +}; + +STDDIPINFO(Bsharkj) + +static struct BurnDIPInfo BsharkjjsDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0xff, NULL }, + {0x0e, 0xff, 0xff, 0xf7, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Mirror Screen" }, + {0x0d, 0x01, 0x01, 0x01, "Off" }, + {0x0d, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0d, 0x01, 0x04, 0x04, "Off" }, + {0x0d, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x08, 0x00, "Off" }, + {0x0d, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0d, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0d, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0d, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0d, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0e, 0x01, 0x03, 0x02, "Easy" }, + {0x0e, 0x01, 0x03, 0x03, "Normal" }, + {0x0e, 0x01, 0x03, 0x01, "Hard" }, + {0x0e, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Speed of Sight" }, + {0x0e, 0x01, 0x0c, 0x0c, "Slow" }, + {0x0e, 0x01, 0x0c, 0x08, "Medium" }, + {0x0e, 0x01, 0x0c, 0x04, "Fast" }, + {0x0e, 0x01, 0x0c, 0x00, "Fastest" }, +}; + +STDDIPINFO(Bsharkjjs) + +static struct BurnDIPInfo BsharkuDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xff, NULL }, + {0x0c, 0xff, 0xff, 0xf7, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Mirror Screen" }, + {0x0b, 0x01, 0x01, 0x01, "Off" }, + {0x0b, 0x01, 0x01, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x0b, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0xc0, 0xc0, "Same as Start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x03, 0x02, "Easy" }, + {0x0c, 0x01, 0x03, 0x03, "Normal" }, + {0x0c, 0x01, 0x03, 0x01, "Hard" }, + {0x0c, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Speed of Sight" }, + {0x0c, 0x01, 0x0c, 0x0c, "Slow" }, + {0x0c, 0x01, 0x0c, 0x08, "Medium" }, + {0x0c, 0x01, 0x0c, 0x04, "Fast" }, + {0x0c, 0x01, 0x0c, 0x00, "Fastest" }, +}; + +STDDIPINFO(Bsharku) + +static struct BurnDIPInfo ChasehqDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xff, NULL }, + {0x0c, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Cabinet" }, + {0x0b, 0x01, 0x03, 0x03, "Upright / Steering Lock" }, + {0x0b, 0x01, 0x03, 0x02, "Upright / No Steering Lock" }, + {0x0b, 0x01, 0x03, 0x01, "Full Throttle Convert, Cockpit" }, + {0x0b, 0x01, 0x03, 0x00, "Full Throttle Convert, Deluxe" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x0b, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x0b, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x03, 0x02, "Easy" }, + {0x0c, 0x01, 0x03, 0x03, "Normal" }, + {0x0c, 0x01, 0x03, 0x01, "Hard" }, + {0x0c, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Timer Setting" }, + {0x0c, 0x01, 0x0c, 0x08, "70 Seconds" }, + {0x0c, 0x01, 0x0c, 0x04, "65 Seconds" }, + {0x0c, 0x01, 0x0c, 0x0c, "60 Seconds" }, + {0x0c, 0x01, 0x0c, 0x00, "55 Seconds" }, + + {0 , 0xfe, 0 , 2 , "Turbos Stocked" }, + {0x0c, 0x01, 0x10, 0x10, "3" }, + {0x0c, 0x01, 0x10, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Discounted Continue Play" }, + {0x0c, 0x01, 0x20, 0x20, "Off" }, + {0x0c, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Damage Cleared at Continue" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0c, 0x01, 0x80, 0x00, "Off" }, + {0x0c, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Chasehq) + +static struct BurnDIPInfo ChasehqjDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xff, NULL }, + {0x0c, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 4 , "Cabinet" }, + {0x0b, 0x01, 0x03, 0x03, "Upright / Steering Lock" }, + {0x0b, 0x01, 0x03, 0x02, "Upright / No Steering Lock" }, + {0x0b, 0x01, 0x03, 0x01, "Full Throttle Convert, Cockpit" }, + {0x0b, 0x01, 0x03, 0x00, "Full Throttle Convert, Deluxe" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0b, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0b, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x03, 0x02, "Easy" }, + {0x0c, 0x01, 0x03, 0x03, "Normal" }, + {0x0c, 0x01, 0x03, 0x01, "Hard" }, + {0x0c, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Timer Setting" }, + {0x0c, 0x01, 0x0c, 0x08, "70 Seconds" }, + {0x0c, 0x01, 0x0c, 0x04, "65 Seconds" }, + {0x0c, 0x01, 0x0c, 0x0c, "60 Seconds" }, + {0x0c, 0x01, 0x0c, 0x00, "55 Seconds" }, + + {0 , 0xfe, 0 , 2 , "Turbos Stocked" }, + {0x0c, 0x01, 0x10, 0x10, "3" }, + {0x0c, 0x01, 0x10, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Discounted Continue Play" }, + {0x0c, 0x01, 0x20, 0x20, "Off" }, + {0x0c, 0x01, 0x20, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Damage Cleared at Continue" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0c, 0x01, 0x80, 0x00, "Off" }, + {0x0c, 0x01, 0x80, 0x80, "On" }, +}; + +STDDIPINFO(Chasehqj) + +static struct BurnDIPInfo ContcircDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0xff, NULL }, + {0x0f, 0xff, 0xff, 0xdf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x01, 0x01, "Upright" }, + {0x0e, 0x01, 0x01, 0x00, "Cockpit" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0e, 0x01, 0x04, 0x04, "Off" }, + {0x0e, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0e, 0x01, 0x08, 0x00, "Off" }, + {0x0e, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0e, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0e, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0e, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0e, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x0e, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x0e, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x0e, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Time Difficulty" }, + {0x0f, 0x01, 0x03, 0x02, "Easy" }, + {0x0f, 0x01, 0x03, 0x03, "Normal" }, + {0x0f, 0x01, 0x03, 0x01, "Hard" }, + {0x0f, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Opponent Difficulty" }, + {0x0f, 0x01, 0x0c, 0x08, "Easy" }, + {0x0f, 0x01, 0x0c, 0x0c, "Normal" }, + {0x0f, 0x01, 0x0c, 0x04, "Hard" }, + {0x0f, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Steering Wheel" }, + {0x0f, 0x01, 0x10, 0x10, "Free" }, + {0x0f, 0x01, 0x10, 0x00, "Locked" }, + + {0 , 0xfe, 0 , 2 , "Enable 3D Alternate Frames" }, + {0x0f, 0x01, 0x20, 0x00, "Off" }, + {0x0f, 0x01, 0x20, 0x20, "On" }, +}; + +STDDIPINFO(Contcirc) + +static struct BurnDIPInfo ContcircuDIPList[]= +{ + // Default Values + {0x0e, 0xff, 0xff, 0xff, NULL }, + {0x0f, 0xff, 0xff, 0xdf, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0e, 0x01, 0x01, 0x01, "Upright" }, + {0x0e, 0x01, 0x01, 0x00, "Cockpit" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0e, 0x01, 0x04, 0x04, "Off" }, + {0x0e, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0e, 0x01, 0x08, 0x00, "Off" }, + {0x0e, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0e, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0e, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0e, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0e, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0e, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0e, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Time Difficulty" }, + {0x0f, 0x01, 0x03, 0x02, "Easy" }, + {0x0f, 0x01, 0x03, 0x03, "Normal" }, + {0x0f, 0x01, 0x03, 0x01, "Hard" }, + {0x0f, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Opponent Difficulty" }, + {0x0f, 0x01, 0x0c, 0x08, "Easy" }, + {0x0f, 0x01, 0x0c, 0x0c, "Normal" }, + {0x0f, 0x01, 0x0c, 0x04, "Hard" }, + {0x0f, 0x01, 0x0c, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Steering Wheel" }, + {0x0f, 0x01, 0x10, 0x10, "Free" }, + {0x0f, 0x01, 0x10, 0x00, "Locked" }, + + {0 , 0xfe, 0 , 2 , "Enable 3D Alternate Frames" }, + {0x0f, 0x01, 0x20, 0x00, "Off" }, + {0x0f, 0x01, 0x20, 0x20, "On" }, +}; + +STDDIPINFO(Contcircu) + +static struct BurnDIPInfo DblaxleDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0xff, NULL }, + {0x0e, 0xff, 0xff, 0xfb, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Gear Shift" }, + {0x0d, 0x01, 0x02, 0x02, "Normal" }, + {0x0d, 0x01, 0x02, 0x00, "Inverted" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0d, 0x01, 0x04, 0x04, "Off" }, + {0x0d, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x08, 0x00, "Off" }, + {0x0d, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0d, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0d, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0d, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0d, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0e, 0x01, 0x03, 0x02, "Easy" }, + {0x0e, 0x01, 0x03, 0x03, "Normal" }, + {0x0e, 0x01, 0x03, 0x01, "Hard" }, + {0x0e, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Multi-machine hookup" }, + {0x0e, 0x01, 0x04, 0x00, "Off" }, + {0x0e, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Player Truck" }, + {0x0e, 0x01, 0x08, 0x08, "Red" }, + {0x0e, 0x01, 0x08, 0x00, "Blue" }, + + {0 , 0xfe, 0 , 2 , "Reverse" }, + {0x0e, 0x01, 0x10, 0x10, "Normal" }, + {0x0e, 0x01, 0x10, 0x00, "Inverted" }, +}; + +STDDIPINFO(Dblaxle) + +static struct BurnDIPInfo PwheelsjDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0xff, NULL }, + {0x0e, 0xff, 0xff, 0xfb, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Gear Shift" }, + {0x0d, 0x01, 0x02, 0x02, "Normal" }, + {0x0d, 0x01, 0x02, 0x00, "Inverted" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0d, 0x01, 0x04, 0x04, "Off" }, + {0x0d, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x08, 0x00, "Off" }, + {0x0d, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0d, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0d, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0d, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0d, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0e, 0x01, 0x03, 0x02, "Easy" }, + {0x0e, 0x01, 0x03, 0x03, "Normal" }, + {0x0e, 0x01, 0x03, 0x01, "Hard" }, + {0x0e, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Multi-machine hookup" }, + {0x0e, 0x01, 0x04, 0x00, "Off" }, + {0x0e, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2 , "Player Truck" }, + {0x0e, 0x01, 0x08, 0x08, "Red" }, + {0x0e, 0x01, 0x08, 0x00, "Blue" }, + + {0 , 0xfe, 0 , 2 , "Reverse" }, + {0x0e, 0x01, 0x10, 0x10, "Normal" }, + {0x0e, 0x01, 0x10, 0x00, "Inverted" }, +}; + +STDDIPINFO(Pwheelsj) + +static struct BurnDIPInfo EnforceDIPList[]= +{ + // Default Values + {0x0c, 0xff, 0xff, 0xff, NULL }, + {0x0d, 0xff, 0xff, 0xef, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0c, 0x01, 0x04, 0x04, "Off" }, + {0x0c, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0c, 0x01, 0x08, 0x00, "Off" }, + {0x0c, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0c, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0c, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0c, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0c, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0c, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0c, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0c, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0c, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Background Scenery" }, + {0x0d, 0x01, 0x10, 0x10, "Crazy Scolling" }, + {0x0d, 0x01, 0x10, 0x00, "Normal" }, +}; + +STDDIPINFO(Enforce) + +static struct BurnDIPInfo NightstrDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xfe, NULL }, + {0x0c, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x01, 0x01, "Cockpit" }, + {0x0b, 0x01, 0x01, 0x00, "Upright" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x0b, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x0b, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x03, 0x02, "Easy" }, + {0x0c, 0x01, 0x03, 0x03, "Normal" }, + {0x0c, 0x01, 0x03, 0x01, "Hard" }, + {0x0c, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Shields" }, + {0x0c, 0x01, 0x0c, 0x08, "3" }, + {0x0c, 0x01, 0x0c, 0x04, "2" }, + {0x0c, 0x01, 0x0c, 0x0c, "1" }, + {0x0c, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Shields" }, + {0x0c, 0x01, 0x30, 0x00, "3" }, + {0x0c, 0x01, 0x30, 0x10, "4" }, + {0x0c, 0x01, 0x30, 0x30, "5" }, + {0x0c, 0x01, 0x30, 0x20, "6" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Trigger Turbo" }, + {0x0c, 0x01, 0x80, 0x80, "7 shots / seconds" }, + {0x0c, 0x01, 0x80, 0x00, "10 shots / seconds" }, +}; + +STDDIPINFO(Nightstr) + +static struct BurnDIPInfo NightstrjDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xfe, NULL }, + {0x0c, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x01, 0x01, "Cockpit" }, + {0x0b, 0x01, 0x01, 0x00, "Upright" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0b, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0b, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x03, 0x02, "Easy" }, + {0x0c, 0x01, 0x03, 0x03, "Normal" }, + {0x0c, 0x01, 0x03, 0x01, "Hard" }, + {0x0c, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Shields" }, + {0x0c, 0x01, 0x0c, 0x08, "3" }, + {0x0c, 0x01, 0x0c, 0x04, "2" }, + {0x0c, 0x01, 0x0c, 0x0c, "1" }, + {0x0c, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Shields" }, + {0x0c, 0x01, 0x30, 0x00, "3" }, + {0x0c, 0x01, 0x30, 0x10, "4" }, + {0x0c, 0x01, 0x30, 0x30, "5" }, + {0x0c, 0x01, 0x30, 0x20, "6" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Trigger Turbo" }, + {0x0c, 0x01, 0x80, 0x80, "7 shots / seconds" }, + {0x0c, 0x01, 0x80, 0x00, "10 shots / seconds" }, +}; + +STDDIPINFO(Nightstrj) + + +static struct BurnDIPInfo NightstruDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xfe, NULL }, + {0x0c, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x01, 0x01, "Cockpit" }, + {0x0b, 0x01, 0x01, 0x00, "Upright" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x0b, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x0b, 0x01, 0xc0, 0xc0, "Same as Start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0c, 0x01, 0x03, 0x02, "Easy" }, + {0x0c, 0x01, 0x03, 0x03, "Normal" }, + {0x0c, 0x01, 0x03, 0x01, "Hard" }, + {0x0c, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Bonus Shields" }, + {0x0c, 0x01, 0x0c, 0x08, "3" }, + {0x0c, 0x01, 0x0c, 0x04, "2" }, + {0x0c, 0x01, 0x0c, 0x0c, "1" }, + {0x0c, 0x01, 0x0c, 0x00, "None" }, + + {0 , 0xfe, 0 , 4 , "Shields" }, + {0x0c, 0x01, 0x30, 0x00, "3" }, + {0x0c, 0x01, 0x30, 0x10, "4" }, + {0x0c, 0x01, 0x30, 0x30, "5" }, + {0x0c, 0x01, 0x30, 0x20, "6" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x0c, 0x01, 0x40, 0x00, "Off" }, + {0x0c, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Trigger Turbo" }, + {0x0c, 0x01, 0x80, 0x80, "7 shots / seconds" }, + {0x0c, 0x01, 0x80, 0x00, "10 shots / seconds" }, +}; + +STDDIPINFO(Nightstru) + +static struct BurnDIPInfo RacingbDIPList[]= +{ + // Default Values + {0x0b, 0xff, 0xff, 0xff, NULL }, + {0x0c, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0b, 0x01, 0x01, 0x00, "Type 0" }, + {0x0b, 0x01, 0x01, 0x01, "Type 1" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0b, 0x01, 0x04, 0x04, "Off" }, + {0x0b, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0b, 0x01, 0x08, 0x00, "Off" }, + {0x0b, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0b, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0b, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0b, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x0b, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x0b, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x0b, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 2 , "Steering Wheel Range" }, + {0x0c, 0x01, 0x04, 0x04, "Normal" }, + {0x0c, 0x01, 0x04, 0x00, "High" }, + + {0 , 0xfe, 0 , 2 , "Steering Wheel Type" }, + {0x0c, 0x01, 0x08, 0x00, "Free" }, + {0x0c, 0x01, 0x08, 0x08, "Locked" }, + + {0 , 0xfe, 0 , 2 , "Network" }, + {0x0c, 0x01, 0x10, 0x10, "Off" }, + {0x0c, 0x01, 0x10, 0x00, "On" }, + + {0 , 0xfe, 0 , 4 , "Player Car" }, + {0x0c, 0x01, 0x60, 0x60, "Red" }, + {0x0c, 0x01, 0x60, 0x40, "Blue" }, + {0x0c, 0x01, 0x60, 0x20, "Green" }, + {0x0c, 0x01, 0x60, 0x00, "Yellow" }, +}; + +STDDIPINFO(Racingb) + +static struct BurnDIPInfo SciDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0xfe, NULL }, + {0x0e, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x01, 0x01, "Cockpit" }, + {0x0d, 0x01, 0x01, 0x00, "Upright" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0d, 0x01, 0x04, 0x04, "Off" }, + {0x0d, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x08, 0x00, "Off" }, + {0x0d, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0d, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0d, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0d, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x0d, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x0d, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0e, 0x01, 0x03, 0x02, "Easy" }, + {0x0e, 0x01, 0x03, 0x03, "Normal" }, + {0x0e, 0x01, 0x03, 0x01, "Hard" }, + {0x0e, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Timer Setting" }, + {0x0e, 0x01, 0x0c, 0x08, "70 Seconds" }, + {0x0e, 0x01, 0x0c, 0x04, "65 Seconds" }, + {0x0e, 0x01, 0x0c, 0x0c, "60 Seconds" }, + {0x0e, 0x01, 0x0c, 0x00, "55 Seconds" }, + + {0 , 0xfe, 0 , 2 , "Turbos Stocked" }, + {0x0e, 0x01, 0x10, 0x10, "3" }, + {0x0e, 0x01, 0x10, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Steering Radius" }, + {0x0e, 0x01, 0x20, 0x00, "270 Degree" }, + {0x0e, 0x01, 0x20, 0x20, "360 Degree" }, + + {0 , 0xfe, 0 , 2 , "Damage Cleared at Continue" }, + {0x0e, 0x01, 0x40, 0x00, "Off" }, + {0x0e, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Siren Volume" }, + {0x0e, 0x01, 0x80, 0x80, "Normal" }, + {0x0e, 0x01, 0x80, 0x00, "Low" }, +}; + +STDDIPINFO(Sci) + +static struct BurnDIPInfo ScijDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0xfe, NULL }, + {0x0e, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x01, 0x01, "Cockpit" }, + {0x0d, 0x01, 0x01, 0x00, "Upright" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0d, 0x01, 0x04, 0x04, "Off" }, + {0x0d, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x08, 0x00, "Off" }, + {0x0d, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x0d, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + {0x0d, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, + {0x0d, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, + {0x0d, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0e, 0x01, 0x03, 0x02, "Easy" }, + {0x0e, 0x01, 0x03, 0x03, "Normal" }, + {0x0e, 0x01, 0x03, 0x01, "Hard" }, + {0x0e, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Timer Setting" }, + {0x0e, 0x01, 0x0c, 0x08, "70 Seconds" }, + {0x0e, 0x01, 0x0c, 0x04, "65 Seconds" }, + {0x0e, 0x01, 0x0c, 0x0c, "60 Seconds" }, + {0x0e, 0x01, 0x0c, 0x00, "55 Seconds" }, + + {0 , 0xfe, 0 , 2 , "Turbos Stocked" }, + {0x0e, 0x01, 0x10, 0x10, "3" }, + {0x0e, 0x01, 0x10, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Steering Radius" }, + {0x0e, 0x01, 0x20, 0x00, "270 Degree" }, + {0x0e, 0x01, 0x20, 0x20, "360 Degree" }, + + {0 , 0xfe, 0 , 2 , "Damage Cleared at Continue" }, + {0x0e, 0x01, 0x40, 0x00, "Off" }, + {0x0e, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Siren Volume" }, + {0x0e, 0x01, 0x80, 0x80, "Normal" }, + {0x0e, 0x01, 0x80, 0x00, "Low" }, +}; + +STDDIPINFO(Scij) + +static struct BurnDIPInfo SciuDIPList[]= +{ + // Default Values + {0x0d, 0xff, 0xff, 0xfe, NULL }, + {0x0e, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Cabinet" }, + {0x0d, 0x01, 0x01, 0x01, "Cockpit" }, + {0x0d, 0x01, 0x01, 0x00, "Upright" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x0d, 0x01, 0x04, 0x04, "Off" }, + {0x0d, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x0d, 0x01, 0x08, 0x00, "Off" }, + {0x0d, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coinage" }, + {0x0d, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x0d, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x0d, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Price to Continue" }, + {0x0d, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, + {0x0d, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, + {0x0d, 0x01, 0xc0, 0x80, "1 Coin 1 Credit" }, + {0x0d, 0x01, 0xc0, 0xc0, "Same as Start" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x0e, 0x01, 0x03, 0x02, "Easy" }, + {0x0e, 0x01, 0x03, 0x03, "Normal" }, + {0x0e, 0x01, 0x03, 0x01, "Hard" }, + {0x0e, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 4 , "Timer Setting" }, + {0x0e, 0x01, 0x0c, 0x08, "70 Seconds" }, + {0x0e, 0x01, 0x0c, 0x04, "65 Seconds" }, + {0x0e, 0x01, 0x0c, 0x0c, "60 Seconds" }, + {0x0e, 0x01, 0x0c, 0x00, "55 Seconds" }, + + {0 , 0xfe, 0 , 2 , "Turbos Stocked" }, + {0x0e, 0x01, 0x10, 0x10, "3" }, + {0x0e, 0x01, 0x10, 0x00, "5" }, + + {0 , 0xfe, 0 , 2 , "Steering Radius" }, + {0x0e, 0x01, 0x20, 0x00, "270 Degree" }, + {0x0e, 0x01, 0x20, 0x20, "360 Degree" }, + + {0 , 0xfe, 0 , 2 , "Damage Cleared at Continue" }, + {0x0e, 0x01, 0x40, 0x00, "Off" }, + {0x0e, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Siren Volume" }, + {0x0e, 0x01, 0x80, 0x80, "Normal" }, + {0x0e, 0x01, 0x80, 0x00, "Low" }, +}; + +STDDIPINFO(Sciu) + +static struct BurnDIPInfo SpacegunDIPList[]= +{ + // Default Values + {0x10, 0xff, 0xff, 0xff, NULL }, + {0x11, 0xff, 0xff, 0xff, NULL }, + + // Dip 1 + {0 , 0xfe, 0 , 2 , "Always have gunsight power up" }, + {0x10, 0x01, 0x02, 0x02, "Off" }, + {0x10, 0x01, 0x02, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Service Mode" }, + {0x10, 0x01, 0x04, 0x04, "Off" }, + {0x10, 0x01, 0x04, 0x00, "On" }, + + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, + {0x10, 0x01, 0x08, 0x00, "Off" }, + {0x10, 0x01, 0x08, 0x08, "On" }, + + {0 , 0xfe, 0 , 4 , "Coin A" }, + {0x10, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, + {0x10, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, + {0x10, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, + {0x10, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, + + {0 , 0xfe, 0 , 4 , "Coin B" }, + {0x10, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, + {0x10, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, + {0x10, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, + {0x10, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, + + // Dip 2 + {0 , 0xfe, 0 , 4 , "Difficulty" }, + {0x11, 0x01, 0x03, 0x02, "Easy" }, + {0x11, 0x01, 0x03, 0x03, "Normal" }, + {0x11, 0x01, 0x03, 0x01, "Hard" }, + {0x11, 0x01, 0x03, 0x00, "Hardest" }, + + {0 , 0xfe, 0 , 2 , "Allow Continue" }, + {0x11, 0x01, 0x40, 0x00, "Off" }, + {0x11, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2 , "Disable Pedal" }, + {0x11, 0x01, 0x80, 0x80, "Off" }, + {0x11, 0x01, 0x80, 0x00, "On" }, +}; + +STDDIPINFO(Spacegun) + +static struct BurnRomInfo AquajackRomDesc[] = { + { "b77-22.ic31", 0x20000, 0x67400dde, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b77-26.ic17", 0x20000, 0xcd4d0969, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b77-24.ic69", 0x20000, 0x95e643ed, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b77-23.ic67", 0x20000, 0x395a7d1c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b77-20.ic54", 0x10000, 0x84ba54b7, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b77-05.ic105", 0x80000, 0x7238f0ff, BRF_GRA | TAITO_CHARS }, + + { "b77-04.ic16", 0x80000, 0xbed0be6c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b77-03.ic15", 0x80000, 0x9a3030a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b77-02.ic14", 0x80000, 0xdaea0d2e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b77-01.ic13", 0x80000, 0xcdab000d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b77-07.ic33", 0x80000, 0x7db1fc5e, BRF_GRA | TAITO_ROAD }, + + { "b77-06.ic39", 0x80000, 0xce2aed00, BRF_GRA | TAITO_SPRITEMAP }, + + { "b77-09.ic58", 0x80000, 0x948e5ad9, BRF_SND | TAITO_YM2610A }, + + { "b77-08.ic57", 0x80000, 0x119b9485, BRF_SND | TAITO_YM2610B }, + + { "b77-17.ic1", 0x00100, 0xfbf81f30, BRF_OPT }, + { "b77-18.ic37", 0x00100, 0x7b7d8ff4, BRF_OPT }, +}; + +STD_ROM_PICK(Aquajack) +STD_ROM_FN(Aquajack) + +static struct BurnRomInfo AquajackuRomDesc[] = { + { "b77-22.ic31", 0x20000, 0x67400dde, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b77-25.ic17", 0x20000, 0xba4a39ff, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b77-24.ic69", 0x20000, 0x95e643ed, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b77-23.ic67", 0x20000, 0x395a7d1c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b77-20.ic54", 0x10000, 0x84ba54b7, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b77-05.ic105", 0x80000, 0x7238f0ff, BRF_GRA | TAITO_CHARS }, + + { "b77-04.ic16", 0x80000, 0xbed0be6c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b77-03.ic15", 0x80000, 0x9a3030a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b77-02.ic14", 0x80000, 0xdaea0d2e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b77-01.ic13", 0x80000, 0xcdab000d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b77-07.ic33", 0x80000, 0x7db1fc5e, BRF_GRA | TAITO_ROAD }, + + { "b77-06.ic39", 0x80000, 0xce2aed00, BRF_GRA | TAITO_SPRITEMAP }, + + { "b77-09.ic58", 0x80000, 0x948e5ad9, BRF_SND | TAITO_YM2610A }, + + { "b77-08.ic57", 0x80000, 0x119b9485, BRF_SND | TAITO_YM2610B }, + + { "b77-17.ic1", 0x00100, 0xfbf81f30, BRF_OPT }, + { "b77-18.ic37", 0x00100, 0x7b7d8ff4, BRF_OPT }, +}; + +STD_ROM_PICK(Aquajacku) +STD_ROM_FN(Aquajacku) + +static struct BurnRomInfo AquajackjRomDesc[] = { + { "b77-22.ic31", 0x20000, 0x67400dde, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b77-21.ic17", 0x20000, 0x23436845, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b77-24.ic69", 0x20000, 0x95e643ed, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b77-23.ic67", 0x20000, 0x395a7d1c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b77-20.ic54", 0x10000, 0x84ba54b7, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b77-05.ic105", 0x80000, 0x7238f0ff, BRF_GRA | TAITO_CHARS }, + + { "b77-04.ic16", 0x80000, 0xbed0be6c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b77-03.ic15", 0x80000, 0x9a3030a7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b77-02.ic14", 0x80000, 0xdaea0d2e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b77-01.ic13", 0x80000, 0xcdab000d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b77-07.ic33", 0x80000, 0x7db1fc5e, BRF_GRA | TAITO_ROAD }, + + { "b77-06.ic39", 0x80000, 0xce2aed00, BRF_GRA | TAITO_SPRITEMAP }, + + { "b77-09.ic58", 0x80000, 0x948e5ad9, BRF_SND | TAITO_YM2610A }, + + { "b77-08.ic57", 0x80000, 0x119b9485, BRF_SND | TAITO_YM2610B }, + + { "b77-17.ic1", 0x00100, 0xfbf81f30, BRF_OPT }, + { "b77-18.ic37", 0x00100, 0x7b7d8ff4, BRF_OPT }, +}; + +STD_ROM_PICK(Aquajackj) +STD_ROM_FN(Aquajackj) + +static struct BurnRomInfo BsharkRomDesc[] = { + { "c34_71.98", 0x20000, 0xdf1fa629, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_69.75", 0x20000, 0xa54c137a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_70.97", 0x20000, 0xd77d81e2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_68.74", 0x20000, 0x4e374ce2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c34_74.128", 0x20000, 0x6869fa99, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_72.112", 0x20000, 0xc09c0f91, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_75.129", 0x20000, 0x6ba65542, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_73.113", 0x20000, 0xf2fe62b5, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c34_05.3", 0x80000, 0x596b83da, BRF_GRA | TAITO_CHARS }, + + { "c34_04.17", 0x80000, 0x2446b0da, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_03.16", 0x80000, 0xa18eab78, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_02.15", 0x80000, 0x8488ba10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_01.14", 0x80000, 0x3ebe8c63, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c34_07.42", 0x80000, 0xedb07808, BRF_GRA | TAITO_ROAD }, + + { "c34_06.12", 0x80000, 0xd200b6eb, BRF_GRA | TAITO_SPRITEMAP }, + + { "c34_08.127", 0x80000, 0x89a30450, BRF_SND | TAITO_YM2610A }, + + { "c34_09.126", 0x80000, 0x39d12b50, BRF_SND | TAITO_YM2610B }, + + { "c34_18.22", 0x10000, 0x7245a6f6, BRF_OPT }, + { "c34_19.72", 0x00100, 0x2ee9c404, BRF_OPT }, + { "c34_20.89", 0x00100, 0xfbf81f30, BRF_OPT }, + { "c34_21.7", 0x00400, 0x10728853, BRF_OPT }, + { "c34_22.8", 0x00400, 0x643e8bfc, BRF_OPT }, +}; + +STD_ROM_PICK(Bshark) +STD_ROM_FN(Bshark) + +static struct BurnRomInfo BsharkjRomDesc[] = { + { "c34_71.98", 0x20000, 0xdf1fa629, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_69.75", 0x20000, 0xa54c137a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_70.97", 0x20000, 0xd77d81e2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_66.74", 0x20000, 0xa0392dce, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c34_74.128", 0x20000, 0x6869fa99, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_72.112", 0x20000, 0xc09c0f91, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_75.129", 0x20000, 0x6ba65542, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_73.113", 0x20000, 0xf2fe62b5, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c34_05.3", 0x80000, 0x596b83da, BRF_GRA | TAITO_CHARS }, + + { "c34_04.17", 0x80000, 0x2446b0da, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_03.16", 0x80000, 0xa18eab78, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_02.15", 0x80000, 0x8488ba10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_01.14", 0x80000, 0x3ebe8c63, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c34_07.42", 0x80000, 0xedb07808, BRF_GRA | TAITO_ROAD }, + + { "c34_06.12", 0x80000, 0xd200b6eb, BRF_GRA | TAITO_SPRITEMAP }, + + { "c34_08.127", 0x80000, 0x89a30450, BRF_SND | TAITO_YM2610A }, + + { "c34_09.126", 0x80000, 0x39d12b50, BRF_SND | TAITO_YM2610B }, + + { "c34_18.22", 0x10000, 0x7245a6f6, BRF_OPT }, + { "c34_19.72", 0x00100, 0x2ee9c404, BRF_OPT }, + { "c34_20.89", 0x00100, 0xfbf81f30, BRF_OPT }, + { "c34_21.7", 0x00400, 0x10728853, BRF_OPT }, + { "c34_22.8", 0x00400, 0x643e8bfc, BRF_OPT }, +}; + +STD_ROM_PICK(Bsharkj) +STD_ROM_FN(Bsharkj) + +static struct BurnRomInfo BsharkjjsRomDesc[] = { + { "c34_79.98", 0x20000, 0xbc3f2e93, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_77.75", 0x20000, 0x917916d0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_78.97", 0x20000, 0xf2fcc880, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_76.74", 0x20000, 0xde97fac0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c34_82.128", 0x20000, 0x6869fa99, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_80.112", 0x20000, 0xe1783eb4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_83.129", 0x20000, 0xeec0b364, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_81.113", 0x20000, 0x23ce6bcf, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c34_05.3", 0x80000, 0x596b83da, BRF_GRA | TAITO_CHARS }, + + { "c34_04.17", 0x80000, 0x2446b0da, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_03.16", 0x80000, 0xa18eab78, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_02.15", 0x80000, 0x8488ba10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_01.14", 0x80000, 0x3ebe8c63, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c34_07.42", 0x80000, 0xedb07808, BRF_GRA | TAITO_ROAD }, + + { "c34_06.12", 0x80000, 0xd200b6eb, BRF_GRA | TAITO_SPRITEMAP }, + + { "c34_08.127", 0x80000, 0x89a30450, BRF_SND | TAITO_YM2610A }, + + { "c34_09.126", 0x80000, 0x39d12b50, BRF_SND | TAITO_YM2610B }, + + { "c34_18.22", 0x10000, 0x7245a6f6, BRF_OPT }, + { "c34_19.72", 0x00100, 0x2ee9c404, BRF_OPT }, + { "c34_20.89", 0x00100, 0xfbf81f30, BRF_OPT }, + { "c34_21.7", 0x00400, 0x10728853, BRF_OPT }, + { "c34_22.8", 0x00400, 0x643e8bfc, BRF_OPT }, +}; + +STD_ROM_PICK(Bsharkjjs) +STD_ROM_FN(Bsharkjjs) + +static struct BurnRomInfo BsharkuRomDesc[] = { + { "c34_71.98", 0x20000, 0xdf1fa629, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_69.75", 0x20000, 0xa54c137a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_70.97", 0x20000, 0xd77d81e2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c34_67.74", 0x20000, 0x39307c74, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c34_74.128", 0x20000, 0x6869fa99, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_72.112", 0x20000, 0xc09c0f91, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_75.129", 0x20000, 0x6ba65542, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c34_73.113", 0x20000, 0xf2fe62b5, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c34_05.3", 0x80000, 0x596b83da, BRF_GRA | TAITO_CHARS }, + + { "c34_04.17", 0x80000, 0x2446b0da, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_03.16", 0x80000, 0xa18eab78, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_02.15", 0x80000, 0x8488ba10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c34_01.14", 0x80000, 0x3ebe8c63, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c34_07.42", 0x80000, 0xedb07808, BRF_GRA | TAITO_ROAD }, + + { "c34_06.12", 0x80000, 0xd200b6eb, BRF_GRA | TAITO_SPRITEMAP }, + + { "c34_08.127", 0x80000, 0x89a30450, BRF_SND | TAITO_YM2610A }, + + { "c34_09.126", 0x80000, 0x39d12b50, BRF_SND | TAITO_YM2610B }, + + { "c34_18.22", 0x10000, 0x7245a6f6, BRF_OPT }, + { "c34_19.72", 0x00100, 0x2ee9c404, BRF_OPT }, + { "c34_20.89", 0x00100, 0xfbf81f30, BRF_OPT }, + { "c34_21.7", 0x00400, 0x10728853, BRF_OPT }, + { "c34_22.8", 0x00400, 0x643e8bfc, BRF_OPT }, +}; + +STD_ROM_PICK(Bsharku) +STD_ROM_FN(Bsharku) + +static struct BurnRomInfo ChasehqRomDesc[] = { + { "b52-130.36", 0x20000, 0x4e7beb46, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b52-136.29", 0x20000, 0x2f414df0, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b52-131.37", 0x20000, 0xaa945d83, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b52-129.30", 0x20000, 0x0eaebc08, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b52-132.39", 0x10000, 0xa2f54789, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b52-133.55", 0x10000, 0x12232f95, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b52-137.51", 0x10000, 0x37abb74a, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b52-29.27", 0x80000, 0x8366d27c, BRF_GRA | TAITO_CHARS}, + + { "b52-34.5", 0x80000, 0x7d8dce36, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b52-35.7", 0x80000, 0x78eeec0d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b52-36.9", 0x80000, 0x61e89e91, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b52-37.11", 0x80000, 0xf02e47b9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b52-30.4", 0x80000, 0x1b8cc647, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b52-31.6", 0x80000, 0xf1998e20, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b52-32.8", 0x80000, 0x8620780c, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b52-33.10", 0x80000, 0xe6f4b8c4, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + + { "b52-28.4", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, + + { "b52-38.34", 0x80000, 0x5b5bf7f6, BRF_GRA | TAITO_SPRITEMAP }, + + { "b52-115.71", 0x80000, 0x4e117e93, BRF_SND | TAITO_YM2610A }, + { "b52-114.72", 0x80000, 0x3a73d6b1, BRF_SND | TAITO_YM2610A }, + { "b52-113.73", 0x80000, 0x2c6a3a05, BRF_SND | TAITO_YM2610A }, + + { "b52-116.70", 0x80000, 0xad46983c, BRF_SND | TAITO_YM2610B }, + + { "b52-01.7", 0x00100, 0x89719d17, BRF_OPT }, + { "b52-03.135", 0x00400, 0xa3f8490d, BRF_OPT }, + { "b52-06.24", 0x00100, 0xfbf81f30, BRF_OPT }, + { "b52-18.93", 0x00100, 0x60bdaf1a, BRF_OPT }, + { "b52-18a", 0x00100, 0x6271be0d, BRF_OPT }, + { "b52-49.68", 0x02000, 0x60dd2ed1, BRF_OPT }, + { "b52-50.66", 0x10000, 0xc189781c, BRF_OPT }, + { "b52-51.65", 0x10000, 0x30cc1f79, BRF_OPT }, + { "b52-126.136", 0x00400, 0xfa2f840e, BRF_OPT }, + { "b52-127.156", 0x00400, 0x77682a4f, BRF_OPT }, + + { "pal20l8b-b52-17.ic18", 0x00144, 0x4851316d, BRF_OPT }, + { "pal20l8b-b52-17.ic16", 0x00144, 0x4851316d, BRF_OPT }, + { "pal20l8b-b52-17.ic53", 0x00144, 0x4851316d, BRF_OPT }, + { "pal20l8b-b52-17.ic55", 0x00144, 0x4851316d, BRF_OPT }, + { "pal16l8b-b52-19.ic33", 0x00104, 0x3ba292dc, BRF_OPT }, + { "pal16l8b-b52-20.ic35", 0x00104, 0xbd39ad73, BRF_OPT }, + { "pal16l8b-b52-21.ic51", 0x00104, 0x2fe76aa4, BRF_OPT }, + { "pal20l8b-b52-25.ic123", 0x00144, 0x372b632d, BRF_OPT }, + { "pal20l8b-b52-26.ic15", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-26.ic18", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-26.ic52", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-26.ic54", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-27.ic64", 0x00144, 0x61c2ab26, BRF_OPT }, + { "pal20l8b-b52-118.ic20", 0x00144, 0x9c5fe4af, BRF_OPT }, + { "pal20l8b-b52-119.ic21", 0x00144, 0x8b8e2106, BRF_OPT }, + { "pal16l8b-b52-120.ic56", 0x00104, 0x3e7effa0, BRF_OPT }, + { "pal20l8b-b52-121.ic57", 0x00144, 0x7056fd1d, BRF_OPT }, + { "pal16l8b-b52-122.ic124", 0x00104, 0x04c0fb04, BRF_OPT }, + { "pal16l8b-b52-123.ic125", 0x00104, 0x3865d1c8, BRF_OPT }, + { "pal16l8b-b52-124.ic180", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "pal16l8b-b52-125.ic112", 0x00104, 0x7628c557, BRF_OPT }, +}; + +STD_ROM_PICK(Chasehq) +STD_ROM_FN(Chasehq) + +static struct BurnRomInfo ChasehqjRomDesc[] = { + { "b52-140.36", 0x20000, 0xc1298a4b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b52-139.29", 0x20000, 0x997f732e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b52-131.37", 0x20000, 0xaa945d83, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b52-129.30", 0x20000, 0x0eaebc08, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b52-132.39", 0x10000, 0xa2f54789, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b52-133.55", 0x10000, 0x12232f95, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b52-134.51", 0x10000, 0x91faac7f, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b52-29.27", 0x80000, 0x8366d27c, BRF_GRA | TAITO_CHARS }, + + { "b52-34.5", 0x80000, 0x7d8dce36, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b52-35.7", 0x80000, 0x78eeec0d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b52-36.9", 0x80000, 0x61e89e91, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b52-37.11", 0x80000, 0xf02e47b9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b52-30.4", 0x80000, 0x1b8cc647, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b52-31.6", 0x80000, 0xf1998e20, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b52-32.8", 0x80000, 0x8620780c, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b52-33.10", 0x80000, 0xe6f4b8c4, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + + { "b52-28.4", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, + + { "b52-38.34", 0x80000, 0x5b5bf7f6, BRF_GRA | TAITO_SPRITEMAP }, + + { "b52-41.71", 0x80000, 0x8204880c, BRF_SND | TAITO_YM2610A }, + { "b52-40.72", 0x80000, 0xf0551055, BRF_SND | TAITO_YM2610A }, + { "b52-39.73", 0x80000, 0xac9cbbd3, BRF_SND | TAITO_YM2610A }, + + { "b52-42.70", 0x80000, 0x6e617df1, BRF_SND | TAITO_YM2610B }, + + { "b52-01.7", 0x00100, 0x89719d17, BRF_OPT }, + { "b52-03.135", 0x00400, 0xa3f8490d, BRF_OPT }, + { "b52-06.24", 0x00100, 0xfbf81f30, BRF_OPT }, + { "b52-18.93", 0x00100, 0x60bdaf1a, BRF_OPT }, + { "b52-18a", 0x00100, 0x6271be0d, BRF_OPT }, + { "b52-49.68", 0x02000, 0x60dd2ed1, BRF_OPT }, + { "b52-50.66", 0x10000, 0xc189781c, BRF_OPT }, + { "b52-51.65", 0x10000, 0x30cc1f79, BRF_OPT }, + { "b52-126.136", 0x00400, 0xfa2f840e, BRF_OPT }, + { "b52-127.156", 0x00400, 0x77682a4f, BRF_OPT }, + + { "pal20l8b-b52-17.ic18", 0x00144, 0x4851316d, BRF_OPT }, + { "pal20l8b-b52-17.ic16", 0x00144, 0x4851316d, BRF_OPT }, + { "pal20l8b-b52-17.ic53", 0x00144, 0x4851316d, BRF_OPT }, + { "pal20l8b-b52-17.ic55", 0x00144, 0x4851316d, BRF_OPT }, + { "pal16l8b-b52-19.ic33", 0x00104, 0x3ba292dc, BRF_OPT }, + { "pal16l8b-b52-20.ic35", 0x00104, 0xbd39ad73, BRF_OPT }, + { "pal16l8b-b52-21.ic51", 0x00104, 0x2fe76aa4, BRF_OPT }, + { "pal20l8b-b52-25.ic123", 0x00144, 0x372b632d, BRF_OPT }, + { "pal20l8b-b52-26.ic15", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-26.ic18", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-26.ic52", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-26.ic54", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-27.ic64", 0x00144, 0x61c2ab26, BRF_OPT }, + { "pal20l8b-b52-118.ic20", 0x00144, 0x9c5fe4af, BRF_OPT }, + { "pal20l8b-b52-119.ic21", 0x00144, 0x8b8e2106, BRF_OPT }, + { "pal16l8b-b52-120.ic56", 0x00104, 0x3e7effa0, BRF_OPT }, + { "pal20l8b-b52-121.ic57", 0x00144, 0x7056fd1d, BRF_OPT }, + { "pal16l8b-b52-122.ic124", 0x00104, 0x04c0fb04, BRF_OPT }, + { "pal16l8b-b52-123.ic125", 0x00104, 0x3865d1c8, BRF_OPT }, + { "pal16l8b-b52-124.ic180", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "pal16l8b-b52-125.ic112", 0x00104, 0x7628c557, BRF_OPT }, +}; + +STD_ROM_PICK(Chasehqj) +STD_ROM_FN(Chasehqj) + +static struct BurnRomInfo ChasehquRomDesc[] = { + { "b52-138.36", 0x20000, 0x8b71fe51, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b52-135.29", 0x20000, 0x5ba56a7c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b52-131.37", 0x20000, 0xaa945d83, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b52-129.30", 0x20000, 0x0eaebc08, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b52-132.39", 0x10000, 0xa2f54789, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b52-133.55", 0x10000, 0x12232f95, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b52-137.51", 0x10000, 0x37abb74a, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b52-29.27", 0x80000, 0x8366d27c, BRF_GRA | TAITO_CHARS}, + + { "b52-34.5", 0x80000, 0x7d8dce36, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b52-35.7", 0x80000, 0x78eeec0d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b52-36.9", 0x80000, 0x61e89e91, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b52-37.11", 0x80000, 0xf02e47b9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b52-30.4", 0x80000, 0x1b8cc647, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b52-31.6", 0x80000, 0xf1998e20, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b52-32.8", 0x80000, 0x8620780c, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b52-33.10", 0x80000, 0xe6f4b8c4, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + + { "b52-28.4", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, + + { "b52-38.34", 0x80000, 0x5b5bf7f6, BRF_GRA | TAITO_SPRITEMAP }, + + { "b52-115.71", 0x80000, 0x4e117e93, BRF_SND | TAITO_YM2610A }, + { "b52-114.72", 0x80000, 0x3a73d6b1, BRF_SND | TAITO_YM2610A }, + { "b52-113.73", 0x80000, 0x2c6a3a05, BRF_SND | TAITO_YM2610A }, + + { "b52-116.70", 0x80000, 0xad46983c, BRF_SND | TAITO_YM2610B }, + + { "b52-01.7", 0x00100, 0x89719d17, BRF_OPT }, + { "b52-03.135", 0x00400, 0xa3f8490d, BRF_OPT }, + { "b52-06.24", 0x00100, 0xfbf81f30, BRF_OPT }, + { "b52-18.93", 0x00100, 0x60bdaf1a, BRF_OPT }, + { "b52-18a", 0x00100, 0x6271be0d, BRF_OPT }, + { "b52-49.68", 0x02000, 0x60dd2ed1, BRF_OPT }, + { "b52-50.66", 0x10000, 0xc189781c, BRF_OPT }, + { "b52-51.65", 0x10000, 0x30cc1f79, BRF_OPT }, + { "b52-126.136", 0x00400, 0xfa2f840e, BRF_OPT }, + { "b52-127.156", 0x00400, 0x77682a4f, BRF_OPT }, + + { "pal20l8b-b52-17.ic18", 0x00144, 0x4851316d, BRF_OPT }, + { "pal20l8b-b52-17.ic16", 0x00144, 0x4851316d, BRF_OPT }, + { "pal20l8b-b52-17.ic53", 0x00144, 0x4851316d, BRF_OPT }, + { "pal20l8b-b52-17.ic55", 0x00144, 0x4851316d, BRF_OPT }, + { "pal16l8b-b52-19.ic33", 0x00104, 0x3ba292dc, BRF_OPT }, + { "pal16l8b-b52-20.ic35", 0x00104, 0xbd39ad73, BRF_OPT }, + { "pal16l8b-b52-21.ic51", 0x00104, 0x2fe76aa4, BRF_OPT }, + { "pal20l8b-b52-25.ic123", 0x00144, 0x372b632d, BRF_OPT }, + { "pal20l8b-b52-26.ic15", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-26.ic18", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-26.ic52", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-26.ic54", 0x00144, 0xd94f2bc2, BRF_OPT }, + { "pal20l8b-b52-27.ic64", 0x00144, 0x61c2ab26, BRF_OPT }, + { "pal20l8b-b52-118.ic20", 0x00144, 0x9c5fe4af, BRF_OPT }, + { "pal20l8b-b52-119.ic21", 0x00144, 0x8b8e2106, BRF_OPT }, + { "pal16l8b-b52-120.ic56", 0x00104, 0x3e7effa0, BRF_OPT }, + { "pal20l8b-b52-121.ic57", 0x00144, 0x7056fd1d, BRF_OPT }, + { "pal16l8b-b52-122.ic124", 0x00104, 0x04c0fb04, BRF_OPT }, + { "pal16l8b-b52-123.ic125", 0x00104, 0x3865d1c8, BRF_OPT }, + { "pal16l8b-b52-124.ic180", 0x00104, 0x00000000, BRF_OPT | BRF_NODUMP }, + { "pal16l8b-b52-125.ic112", 0x00104, 0x7628c557, BRF_OPT }, +}; + +STD_ROM_PICK(Chasehqu) +STD_ROM_FN(Chasehqu) + +static struct BurnRomInfo ContcircRomDesc[] = { + { "ic25", 0x20000, 0xf5c92e42, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "ic26", 0x20000, 0xe7c1d1fa, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "ic35", 0x20000, 0x16522f2d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "cc_36.bin", 0x20000, 0xa1732ea5, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b33-30.11", 0x10000, 0xd8746234, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b33-02.57", 0x80000, 0xf6fb3ba2, BRF_GRA | TAITO_CHARS }, + + { "b33-06", 0x80000, 0x2cb40599, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b33-05", 0x80000, 0xbddf9eea, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b33-04", 0x80000, 0x8df866a2, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b33-03", 0x80000, 0x4f6c36d9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b33-01.3", 0x80000, 0xf11f2be8, BRF_GRA | TAITO_ROAD }, + + { "b33-07.64", 0x80000, 0x151e1f52, BRF_GRA | TAITO_SPRITEMAP }, + + { "b33-09.18", 0x80000, 0x1e6724b5, BRF_SND | TAITO_YM2610A }, + { "b33-10.17", 0x80000, 0xe9ce03ab, BRF_SND | TAITO_YM2610A }, + + { "b33-08.19", 0x80000, 0xcaa1c4c8, BRF_SND | TAITO_YM2610B }, + + { "b14-30.97", 0x10000, 0xdccb0c7f, BRF_OPT }, + { "b14-31.50", 0x02000, 0x5c6b013d, BRF_OPT }, + { "b33-17.16", 0x00100, 0x7b7d8ff4, BRF_OPT }, + { "b33-18.17", 0x00100, 0xfbf81f30, BRF_OPT }, +}; + +STD_ROM_PICK(Contcirc) +STD_ROM_FN(Contcirc) + +static struct BurnRomInfo ContcircuRomDesc[] = { + { "ic25", 0x20000, 0xf5c92e42, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "ic26", 0x20000, 0xe7c1d1fa, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "ic35", 0x20000, 0x16522f2d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "ic36", 0x20000, 0xd6741e33, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b33-30.11", 0x10000, 0xd8746234, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b33-02.57", 0x80000, 0xf6fb3ba2, BRF_GRA | TAITO_CHARS }, + + { "b33-06", 0x80000, 0x2cb40599, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b33-05", 0x80000, 0xbddf9eea, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b33-04", 0x80000, 0x8df866a2, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b33-03", 0x80000, 0x4f6c36d9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b33-01.3", 0x80000, 0xf11f2be8, BRF_GRA | TAITO_ROAD }, + + { "b33-07.64", 0x80000, 0x151e1f52, BRF_GRA | TAITO_SPRITEMAP }, + + { "b33-09.18", 0x80000, 0x1e6724b5, BRF_SND | TAITO_YM2610A }, + { "b33-10.17", 0x80000, 0xe9ce03ab, BRF_SND | TAITO_YM2610A }, + + { "b33-08.19", 0x80000, 0xcaa1c4c8, BRF_SND | TAITO_YM2610B }, + + { "b14-30.97", 0x10000, 0xdccb0c7f, BRF_OPT }, + { "b14-31.50", 0x02000, 0x5c6b013d, BRF_OPT }, + { "b33-17.16", 0x00100, 0x7b7d8ff4, BRF_OPT }, + { "b33-18.17", 0x00100, 0xfbf81f30, BRF_OPT }, +}; + +STD_ROM_PICK(Contcircu) +STD_ROM_FN(Contcircu) + +static struct BurnRomInfo ContcircuaRomDesc[] = { + { "b33-34.ic25", 0x20000, 0xe1e016c1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b33-33.ic26", 0x20000, 0xf539d44b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "21-2.ic35", 0x20000, 0x2723f9e3, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "31-1.ic36", 0x20000, 0x438431f7, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b33-30.11", 0x10000, 0xd8746234, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b33-02.57", 0x80000, 0xf6fb3ba2, BRF_GRA | TAITO_CHARS }, + + { "b33-06", 0x80000, 0x2cb40599, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b33-05", 0x80000, 0xbddf9eea, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b33-04", 0x80000, 0x8df866a2, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b33-03", 0x80000, 0x4f6c36d9, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b33-01.3", 0x80000, 0xf11f2be8, BRF_GRA | TAITO_ROAD }, + + { "b33-07.64", 0x80000, 0x151e1f52, BRF_GRA | TAITO_SPRITEMAP }, + + { "b33-09.18", 0x80000, 0x1e6724b5, BRF_SND | TAITO_YM2610A }, + { "b33-10.17", 0x80000, 0xe9ce03ab, BRF_SND | TAITO_YM2610A }, + + { "b33-08.19", 0x80000, 0xcaa1c4c8, BRF_SND | TAITO_YM2610B }, + + { "b14-30.97", 0x10000, 0xdccb0c7f, BRF_OPT }, + { "b14-31.50", 0x02000, 0x5c6b013d, BRF_OPT }, + { "b33-17.16", 0x00100, 0x7b7d8ff4, BRF_OPT }, + { "b33-18.17", 0x00100, 0xfbf81f30, BRF_OPT }, +}; + +STD_ROM_PICK(Contcircua) +STD_ROM_FN(Contcircua) + +static struct BurnRomInfo DblaxleRomDesc[] = { + { "c78-41-1.2", 0x020000, 0xcf297fe4, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c78-43-1.4", 0x020000, 0x38a8bad6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c78-42-1.3", 0x020000, 0x4124ab2b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c78-44-1.5", 0x020000, 0x50a55b6e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c78-30-1.35", 0x020000, 0x026aac18, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c78-31-1.36", 0x020000, 0x67ce23e8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c78-34.c42", 0x020000, 0xf2186943, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c78-10.12", 0x080000, 0x44b1897c, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "c78-11.11", 0x080000, 0x7db3d4a3, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "c78-08.25", 0x100000, 0x6c725211, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c78-07.33", 0x100000, 0x9da00d5b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c78-06.23", 0x100000, 0x8309e91b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c78-05.31", 0x100000, 0x90001f68, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c78-09.12", 0x080000, 0x0dbde6f5, BRF_GRA | TAITO_ROAD }, + + { "c78-04.3", 0x080000, 0xcc1aa37c, BRF_GRA | TAITO_SPRITEMAP }, + + { "c78-12.33", 0x100000, 0xb0267404, BRF_SND | TAITO_YM2610A }, + { "c78-13.46", 0x080000, 0x1b363aa2, BRF_SND | TAITO_YM2610A }, + + { "c78-14.31", 0x080000, 0x9cad4dfb, BRF_SND | TAITO_YM2610B }, + + { "c78-25.15", 0x010000, 0x7245a6f6, BRF_OPT }, + { "c78-15.22", 0x000100, 0xfbf81f30, BRF_OPT }, + { "c78-21.74", 0x000100, 0x2926bf27, BRF_OPT }, + { "c84-10.16", 0x000400, 0x643e8bfc, BRF_OPT }, + { "c84-11.17", 0x000400, 0x10728853, BRF_OPT }, +}; + +STD_ROM_PICK(Dblaxle) +STD_ROM_FN(Dblaxle) + +static struct BurnRomInfo PwheelsjRomDesc[] = { + { "c78-26-2.2", 0x020000, 0x25c8eb2e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c78-28-2.4", 0x020000, 0xa9500eb1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c78-27-2.3", 0x020000, 0x08d2cffb, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c78-29-2.5", 0x020000, 0xe1608004, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c78-30-1.35", 0x020000, 0x026aac18, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c78-31-1.36", 0x020000, 0x67ce23e8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c78-32.42", 0x020000, 0x1494199c, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c78-10.12", 0x080000, 0x44b1897c, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "c78-11.11", 0x080000, 0x7db3d4a3, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "c78-08.25", 0x100000, 0x6c725211, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c78-07.33", 0x100000, 0x9da00d5b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c78-06.23", 0x100000, 0x8309e91b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c78-05.31", 0x100000, 0x90001f68, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c78-09.12", 0x080000, 0x0dbde6f5, BRF_GRA | TAITO_ROAD }, + + { "c78-04.3", 0x080000, 0xcc1aa37c, BRF_GRA | TAITO_SPRITEMAP }, + + { "c78-01.33", 0x100000, 0x90ff1e72, BRF_SND | TAITO_YM2610A }, + { "c78-02.46", 0x080000, 0x8882d2b7, BRF_SND | TAITO_YM2610A }, + + { "c78-03.31", 0x080000, 0x9b926a2f, BRF_SND | TAITO_YM2610B }, + + { "c78-25.15", 0x010000, 0x7245a6f6, BRF_OPT }, + { "c78-15.22", 0x000100, 0xfbf81f30, BRF_OPT }, + { "c78-21.74", 0x000100, 0x2926bf27, BRF_OPT }, + { "c84-10.16", 0x000400, 0x643e8bfc, BRF_OPT }, + { "c84-11.17", 0x000400, 0x10728853, BRF_OPT }, +}; + +STD_ROM_PICK(Pwheelsj) +STD_ROM_FN(Pwheelsj) + +static struct BurnRomInfo EnforceRomDesc[] = { + { "b58-27.27", 0x20000, 0xa1aa0191, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b58-19.19", 0x20000, 0x40f43da3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b58-26.26", 0x20000, 0xe823c85c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b58-18.18", 0x20000, 0x65328a3e, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b58-32.41", 0x10000, 0xf3fd8eca, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b58-09.13", 0x80000, 0x9ffd5b31, BRF_GRA | TAITO_CHARS }, + + { "b58-04.7", 0x80000, 0x9482f08d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b58-03.6", 0x80000, 0x158bc440, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b58-02.2", 0x80000, 0x6a6e307c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b58-01.1", 0x80000, 0x01e9f0a8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b58-06.116", 0x80000, 0xb3495d70, BRF_GRA | TAITO_ROAD }, + + { "b58-05.71", 0x80000, 0xd1f4991b, BRF_GRA | TAITO_SPRITEMAP }, + + { "b58-07.11", 0x80000, 0xeeb5ba08, BRF_SND | TAITO_YM2610A }, + { "b58-08.12", 0x80000, 0x049243cf, BRF_SND | TAITO_YM2610A }, + + { "b58-10.14", 0x80000, 0xedce0cc1, BRF_SND | TAITO_YM2610B }, + + { "b58-26a.104", 0x10000, 0xdccb0c7f, BRF_OPT }, + { "b58-27.56", 0x02000, 0x5c6b013d, BRF_OPT }, + { "b58-23.52", 0x00100, 0x7b7d8ff4, BRF_OPT }, + { "b58-24.51", 0x00100, 0xfbf81f30, BRF_OPT }, + { "b58-25.75", 0x00100, 0xde547342, BRF_OPT }, +}; + +STD_ROM_PICK(Enforce) +STD_ROM_FN(Enforce) + +static struct BurnRomInfo NightstrRomDesc[] = { + { "b91-45.bin", 0x20000, 0x7ad63421, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b91-44.bin", 0x20000, 0x4bc30adf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b91-43.bin", 0x20000, 0x3e6f727a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b91-47.bin", 0x20000, 0x9f778e03, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b91-39.bin", 0x20000, 0x725b23ae, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b91-40.bin", 0x20000, 0x81fb364d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b91-41.bin", 0x20000, 0x2694bb42, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b91-11.bin", 0x80000, 0xfff8ce31, BRF_GRA | TAITO_CHARS }, + + { "b91-04.bin", 0x80000, 0x8ca1970d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b91-03.bin", 0x80000, 0xcd5fed39, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b91-02.bin", 0x80000, 0x457c64b8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b91-01.bin", 0x80000, 0x3731d94f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b91-08.bin", 0x80000, 0x66f35c34, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b91-07.bin", 0x80000, 0x4d8ec6cf, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b91-06.bin", 0x80000, 0xa34dc839, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b91-05.bin", 0x80000, 0x5e72ac90, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + + { "b91-10.bin", 0x80000, 0x1d8f05b4, BRF_GRA | TAITO_ROAD }, + + { "b91-09.bin", 0x80000, 0x5f247ca2, BRF_GRA | TAITO_SPRITEMAP }, + + { "b91-13.bin", 0x80000, 0x8c7bf0f5, BRF_SND | TAITO_YM2610A }, + { "b91-12.bin", 0x80000, 0xda77c7af, BRF_SND | TAITO_YM2610A }, + + { "b91-14.bin", 0x80000, 0x6bc314d3, BRF_SND | TAITO_YM2610B }, + + { "b91-26.bin", 0x00400, 0x77682a4f, BRF_OPT }, + { "b91-27.bin", 0x00400, 0xa3f8490d, BRF_OPT }, + { "b91-28.bin", 0x00400, 0xfa2f840e, BRF_OPT }, + { "b91-29.bin", 0x02000, 0xad685be8, BRF_OPT }, + { "b91-30.bin", 0x10000, 0x30cc1f79, BRF_OPT }, + { "b91-31.bin", 0x10000, 0xc189781c, BRF_OPT }, + { "b91-32.bin", 0x00100, 0xfbf81f30, BRF_OPT }, + { "b91-33.bin", 0x00100, 0x89719d17, BRF_OPT }, +}; + +STD_ROM_PICK(Nightstr) +STD_ROM_FN(Nightstr) + +static struct BurnRomInfo NightstrjRomDesc[] = { + { "b91-45.bin", 0x20000, 0x7ad63421, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b91-44.bin", 0x20000, 0x4bc30adf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b91-43.bin", 0x20000, 0x3e6f727a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b91-42.bin", 0x20000, 0x7179ef2f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b91-39.bin", 0x20000, 0x725b23ae, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b91-40.bin", 0x20000, 0x81fb364d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b91-41.bin", 0x20000, 0x2694bb42, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b91-11.bin", 0x80000, 0xfff8ce31, BRF_GRA | TAITO_CHARS }, + + { "b91-04.bin", 0x80000, 0x8ca1970d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b91-03.bin", 0x80000, 0xcd5fed39, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b91-02.bin", 0x80000, 0x457c64b8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b91-01.bin", 0x80000, 0x3731d94f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b91-08.bin", 0x80000, 0x66f35c34, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b91-07.bin", 0x80000, 0x4d8ec6cf, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b91-06.bin", 0x80000, 0xa34dc839, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b91-05.bin", 0x80000, 0x5e72ac90, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + + { "b91-10.bin", 0x80000, 0x1d8f05b4, BRF_GRA | TAITO_ROAD }, + + { "b91-09.bin", 0x80000, 0x5f247ca2, BRF_GRA | TAITO_SPRITEMAP }, + + { "b91-13.bin", 0x80000, 0x8c7bf0f5, BRF_SND | TAITO_YM2610A }, + { "b91-12.bin", 0x80000, 0xda77c7af, BRF_SND | TAITO_YM2610A }, + + { "b91-14.bin", 0x80000, 0x6bc314d3, BRF_SND | TAITO_YM2610B }, + + { "b91-26.bin", 0x00400, 0x77682a4f, BRF_OPT }, + { "b91-27.bin", 0x00400, 0xa3f8490d, BRF_OPT }, + { "b91-28.bin", 0x00400, 0xfa2f840e, BRF_OPT }, + { "b91-29.bin", 0x02000, 0xad685be8, BRF_OPT }, + { "b91-30.bin", 0x10000, 0x30cc1f79, BRF_OPT }, + { "b91-31.bin", 0x10000, 0xc189781c, BRF_OPT }, + { "b91-32.bin", 0x00100, 0xfbf81f30, BRF_OPT }, + { "b91-33.bin", 0x00100, 0x89719d17, BRF_OPT }, +}; + +STD_ROM_PICK(Nightstrj) +STD_ROM_FN(Nightstrj) + +static struct BurnRomInfo NightstruRomDesc[] = { + { "b91-45.bin", 0x20000, 0x7ad63421, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b91-44.bin", 0x20000, 0x4bc30adf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b91-43.bin", 0x20000, 0x3e6f727a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "b91-46.bin", 0x20000, 0xe870be95, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "b91-39.bin", 0x20000, 0x725b23ae, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "b91-40.bin", 0x20000, 0x81fb364d, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "b91-41.bin", 0x20000, 0x2694bb42, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "b91-11.bin", 0x80000, 0xfff8ce31, BRF_GRA | TAITO_CHARS }, + + { "b91-04.bin", 0x80000, 0x8ca1970d, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b91-03.bin", 0x80000, 0xcd5fed39, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b91-02.bin", 0x80000, 0x457c64b8, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "b91-01.bin", 0x80000, 0x3731d94f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "b91-08.bin", 0x80000, 0x66f35c34, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b91-07.bin", 0x80000, 0x4d8ec6cf, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b91-06.bin", 0x80000, 0xa34dc839, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + { "b91-05.bin", 0x80000, 0x5e72ac90, BRF_GRA | TAITO_SPRITESB_BYTESWAP32 }, + + { "b91-10.bin", 0x80000, 0x1d8f05b4, BRF_GRA | TAITO_ROAD }, + + { "b91-09.bin", 0x80000, 0x5f247ca2, BRF_GRA | TAITO_SPRITEMAP }, + + { "b91-13.bin", 0x80000, 0x8c7bf0f5, BRF_SND | TAITO_YM2610A }, + { "b91-12.bin", 0x80000, 0xda77c7af, BRF_SND | TAITO_YM2610A }, + + { "b91-14.bin", 0x80000, 0x6bc314d3, BRF_SND | TAITO_YM2610B }, + + { "b91-26.bin", 0x00400, 0x77682a4f, BRF_OPT }, + { "b91-27.bin", 0x00400, 0xa3f8490d, BRF_OPT }, + { "b91-28.bin", 0x00400, 0xfa2f840e, BRF_OPT }, + { "b91-29.bin", 0x02000, 0xad685be8, BRF_OPT }, + { "b91-30.bin", 0x10000, 0x30cc1f79, BRF_OPT }, + { "b91-31.bin", 0x10000, 0xc189781c, BRF_OPT }, + { "b91-32.bin", 0x00100, 0xfbf81f30, BRF_OPT }, + { "b91-33.bin", 0x00100, 0x89719d17, BRF_OPT }, +}; + +STD_ROM_PICK(Nightstru) +STD_ROM_FN(Nightstru) + +static struct BurnRomInfo RacingbRomDesc[] = { + { "c84-110.3", 0x020000, 0x119a8d3b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c84-111.5", 0x020000, 0x1f095692, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c84-104.2", 0x020000, 0x37077fc6, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c84-103.4", 0x020000, 0x4ca1d1c2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c84-99.35", 0x020000, 0x24778f40, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c84-100.36", 0x020000, 0x2b99258a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c84-101.42", 0x020000, 0x9322106e, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c84-90.12", 0x080000, 0x83ee0e8d, BRF_GRA | TAITO_CHARS_BYTESWAP }, + { "c84-89.11", 0x080000, 0xaae43c87, BRF_GRA | TAITO_CHARS_BYTESWAP }, + + { "c84-92.25", 0x100000, 0x56e8fd55, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c84-94.33", 0x100000, 0x6117c19b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c84-91.23", 0x100000, 0xb1b0146c, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c84-93.31", 0x100000, 0x8837bb4e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c84-84.12", 0x080000, 0x34dc486b, BRF_GRA | TAITO_ROAD }, + + { "c84-88.3", 0x080000, 0xedd1f49c, BRF_GRA | TAITO_SPRITEMAP }, + + { "c84-86.33", 0x100000, 0x98d9771e, BRF_SND | TAITO_YM2610A }, + { "c84-87.46", 0x080000, 0x9c1dd80c, BRF_SND | TAITO_YM2610A }, + + { "c84-85.31", 0x080000, 0x24cd838d, BRF_SND | TAITO_YM2610B }, + + { "c84-19.15", 0x010000, 0x7245a6f6, BRF_OPT }, + { "c84-07.22", 0x000100, 0x95a15c77, BRF_OPT }, + { "c84-09.74", 0x000100, 0x71217472, BRF_OPT }, + { "c84-10.16", 0x000400, 0x643e8bfc, BRF_OPT }, + { "c84-11.17", 0x000400, 0x10728853, BRF_OPT }, +}; + +STD_ROM_PICK(Racingb) +STD_ROM_FN(Racingb) + +static struct BurnRomInfo SciRomDesc[] = { + { "c09-37.43", 0x20000, 0x0fecea17, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-38.40", 0x20000, 0xe46ebd9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-42.38", 0x20000, 0xf4404f87, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-39.41", 0x20000, 0xde87bcb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c09-33.6", 0x10000, 0xcf4e6c5b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c09-32.5", 0x10000, 0xa4713719, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c09-34.31", 0x20000, 0xa21b3151, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c09-05.16", 0x80000, 0x890b38f0, BRF_GRA | TAITO_CHARS }, + + { "c09-04.52", 0x80000, 0x2cbb3c9b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-02.53", 0x80000, 0xa83a0389, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-03.54", 0x80000, 0xa31d0e80, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-01.55", 0x80000, 0x64bfea10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c09-07.15", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, + + { "c09-06.37", 0x80000, 0x12df6d7b, BRF_GRA | TAITO_SPRITEMAP }, + + { "c09-14.42", 0x80000, 0xad78bf46, BRF_SND | TAITO_YM2610A }, + { "c09-13.43", 0x80000, 0xd57c41d3, BRF_SND | TAITO_YM2610A }, + { "c09-12.44", 0x80000, 0x56c99fa5, BRF_SND | TAITO_YM2610A }, + + { "c09-15.29", 0x80000, 0xe63b9095, BRF_SND | TAITO_YM2610B }, + + { "c09-16.17", 0x10000, 0x7245a6f6, BRF_OPT }, + { "c09-20.71", 0x00100, 0xcd8ffd80, BRF_OPT }, + { "c09-23.14", 0x00100, 0xfbf81f30, BRF_OPT }, +}; + +STD_ROM_PICK(Sci) +STD_ROM_FN(Sci) + +static struct BurnRomInfo SciaRomDesc[] = { + { "c09-28.43", 0x20000, 0x630dbaad, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-30.40", 0x20000, 0x68b1a97d, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-36.38", 0x20000, 0x59e47cba, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-31.41", 0x20000, 0x962b1fbf, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c09-33.6", 0x10000, 0xcf4e6c5b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c09-32.5", 0x10000, 0xa4713719, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c09-34.31", 0x20000, 0xa21b3151, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c09-05.16", 0x80000, 0x890b38f0, BRF_GRA | TAITO_CHARS }, + + { "c09-04.52", 0x80000, 0x2cbb3c9b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-02.53", 0x80000, 0xa83a0389, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-03.54", 0x80000, 0xa31d0e80, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-01.55", 0x80000, 0x64bfea10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c09-07.15", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, + + { "c09-06.37", 0x80000, 0x12df6d7b, BRF_GRA | TAITO_SPRITEMAP }, + + { "c09-14.42", 0x80000, 0xad78bf46, BRF_SND | TAITO_YM2610A }, + { "c09-13.43", 0x80000, 0xd57c41d3, BRF_SND | TAITO_YM2610A }, + { "c09-12.44", 0x80000, 0x56c99fa5, BRF_SND | TAITO_YM2610A }, + + { "c09-15.29", 0x80000, 0xe63b9095, BRF_SND | TAITO_YM2610B }, + + { "c09-16.17", 0x10000, 0x7245a6f6, BRF_OPT }, + { "c09-20.71", 0x00100, 0xcd8ffd80, BRF_OPT }, + { "c09-23.14", 0x00100, 0xfbf81f30, BRF_OPT }, +}; + +STD_ROM_PICK(Scia) +STD_ROM_FN(Scia) + +static struct BurnRomInfo ScijRomDesc[] = { + { "c09-37.43", 0x20000, 0x0fecea17, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-38.40", 0x20000, 0xe46ebd9b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-40.38", 0x20000, 0x1a4e2eab, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-39.41", 0x20000, 0xde87bcb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c09-33.6", 0x10000, 0xcf4e6c5b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c09-32.5", 0x10000, 0xa4713719, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c09-27.31", 0x20000, 0xcd161dca, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c09-05.16", 0x80000, 0x890b38f0, BRF_GRA | TAITO_CHARS }, + + { "c09-04.52", 0x80000, 0x2cbb3c9b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-02.53", 0x80000, 0xa83a0389, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-03.54", 0x80000, 0xa31d0e80, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-01.55", 0x80000, 0x64bfea10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c09-07.15", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, + + { "c09-06.37", 0x80000, 0x12df6d7b, BRF_GRA | TAITO_SPRITEMAP }, + + { "c09-10.42", 0x80000, 0xad78bf46, BRF_SND | TAITO_YM2610A }, + { "c09-09.43", 0x80000, 0x6a655c00, BRF_SND | TAITO_YM2610A }, + { "c09-08.44", 0x80000, 0x7ddfc316, BRF_SND | TAITO_YM2610A }, + + { "c09-11.29", 0x80000, 0x6b1a11e1, BRF_SND | TAITO_YM2610B }, + + { "c09-16.17", 0x10000, 0x7245a6f6, BRF_OPT }, + { "c09-20.71", 0x00100, 0xcd8ffd80, BRF_OPT }, + { "c09-23.14", 0x00100, 0xfbf81f30, BRF_OPT }, +}; + +STD_ROM_PICK(Scij) +STD_ROM_FN(Scij) + +static struct BurnRomInfo SciuRomDesc[] = { + { "c09-43.43", 0x20000, 0x20a9343e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-44.40", 0x20000, 0x7524338a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-41.38", 0x20000, 0x83477f11, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c09-39.41", 0x20000, 0xde87bcb9, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c09-33.6", 0x10000, 0xcf4e6c5b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c09-32.5", 0x10000, 0xa4713719, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c09-34.31", 0x20000, 0xa21b3151, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c09-05.16", 0x80000, 0x890b38f0, BRF_GRA | TAITO_CHARS }, + + { "c09-04.52", 0x80000, 0x2cbb3c9b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-02.53", 0x80000, 0xa83a0389, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-03.54", 0x80000, 0xa31d0e80, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-01.55", 0x80000, 0x64bfea10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c09-07.15", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, + + { "c09-06.37", 0x80000, 0x12df6d7b, BRF_GRA | TAITO_SPRITEMAP }, + + { "c09-14.42", 0x80000, 0xad78bf46, BRF_SND | TAITO_YM2610A }, + { "c09-13.43", 0x80000, 0xd57c41d3, BRF_SND | TAITO_YM2610A }, + { "c09-12.44", 0x80000, 0x56c99fa5, BRF_SND | TAITO_YM2610A }, + + { "c09-15.29", 0x80000, 0xe63b9095, BRF_SND | TAITO_YM2610B }, + + { "c09-16.17", 0x10000, 0x7245a6f6, BRF_OPT }, + { "c09-20.71", 0x00100, 0xcd8ffd80, BRF_OPT }, + { "c09-23.14", 0x00100, 0xfbf81f30, BRF_OPT }, +}; + +STD_ROM_PICK(Sciu) +STD_ROM_FN(Sciu) + +static struct BurnRomInfo ScinegroRomDesc[] = { + { "ic37.37", 0x20000, 0x33fb159c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "ic40.38", 0x20000, 0x657df3f2, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "ic38.42", 0x20000, 0x0a09b90b, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "ic41.39", 0x20000, 0x43167b2a, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c09-33.6", 0x10000, 0xcf4e6c5b, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c09-32.5", 0x10000, 0xa4713719, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c09-27.31", 0x20000, 0xcd161dca, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, + + { "c09-05.16", 0x80000, 0x890b38f0, BRF_GRA | TAITO_CHARS }, + + { "c09-04.52", 0x80000, 0x2cbb3c9b, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-02.53", 0x80000, 0xa83a0389, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-03.54", 0x80000, 0xa31d0e80, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c09-01.55", 0x80000, 0x64bfea10, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c09-07.15", 0x80000, 0x963bc82b, BRF_GRA | TAITO_ROAD }, + + { "c09-06.37", 0x80000, 0x12df6d7b, BRF_GRA | TAITO_SPRITEMAP }, + + { "c09-10.42", 0x80000, 0xad78bf46, BRF_SND | TAITO_YM2610A }, + { "c09-09.43", 0x80000, 0x6a655c00, BRF_SND | TAITO_YM2610A }, + { "c09-08.44", 0x80000, 0x7ddfc316, BRF_SND | TAITO_YM2610A }, + + { "c09-11.29", 0x80000, 0x6b1a11e1, BRF_SND | TAITO_YM2610B }, + + { "c09-16.17", 0x10000, 0x7245a6f6, BRF_OPT }, + { "c09-20.71", 0x00100, 0xcd8ffd80, BRF_OPT }, + { "c09-23.14", 0x00100, 0xfbf81f30, BRF_OPT }, +}; + +STD_ROM_PICK(Scinegro) +STD_ROM_FN(Scinegro) + +static struct BurnRomInfo SpacegunRomDesc[] = { + { "c57-18.62", 0x020000, 0x19d7d52e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c57-20.74", 0x020000, 0x2e58253f, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c57-17.59", 0x020000, 0xe197edb8, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "c57-22.73", 0x020000, 0x5855fde3, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + + { "c57-15+.27", 0x020000, 0xb36eb8f1, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + { "c57-16+.29", 0x020000, 0xbfb5d1e7, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, + + { "c57-06.52", 0x080000, 0x4ebadd5b, BRF_GRA | TAITO_CHARS }, + + { "c57-01.25", 0x100000, 0xf901b04e, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c57-02.24", 0x100000, 0x21ee4633, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c57-03.12", 0x100000, 0xfafca86f, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "c57-04.11", 0x100000, 0xa9787090, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + + { "c57-05.36", 0x080000, 0x6a70eb2e, BRF_GRA | TAITO_SPRITEMAP }, + + { "c57-07.76", 0x080000, 0xad653dc1, BRF_SND | TAITO_YM2610A }, + + { "c57-08.75", 0x080000, 0x22593550, BRF_SND | TAITO_YM2610B }, + + { "pal16l8-c57-09.9", 0x000104, 0xea93161e, BRF_OPT }, + { "pal20l8-c57-10.47", 0x000144, 0x3ee56888, BRF_OPT }, + { "pal16l8-c57-11.48", 0x000104, 0x6bb4372e, BRF_OPT }, + { "pal20l8-c57-12.61", 0x000144, 0xdebddb13, BRF_OPT }, + { "pal16l8-c57-13.72", 0x000104, 0x1369f23e, BRF_OPT }, + { "pal16r4-c57-14.96", 0x000104, 0x75e1bf61, BRF_OPT }, + +}; + +STD_ROM_PICK(Spacegun) +STD_ROM_FN(Spacegun) + +static INT32 MemIndex() +{ + UINT8 *Next; Next = TaitoMem; + + Taito68KRom1 = Next; Next += Taito68KRom1Size; + Taito68KRom2 = Next; Next += Taito68KRom2Size; + TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; + TaitoSpriteMapRom = Next; Next += TaitoSpriteMapRomSize; + TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; + TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; + + TaitoRamStart = Next; + + Taito68KRam1 = Next; Next += 0x10000; + Taito68KRam2 = Next; Next += 0x08000; + TaitoSharedRam = Next; Next += 0x10000; + TaitoZ80Ram1 = Next; Next += 0x02000; + TaitoSpriteRam = Next; Next += 0x04000; + TaitoPaletteRam = Next; Next += 0x02000; + + TaitoRamEnd = Next; + + TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; + TaitoSpritesA = Next; Next += TaitoNumSpriteA * TaitoSpriteAWidth * TaitoSpriteAHeight; + TaitoSpritesB = Next; Next += TaitoNumSpriteB * TaitoSpriteBWidth * TaitoSpriteBHeight; + TaitoPalette = (UINT32*)Next; Next += 0x01000 * sizeof(UINT32); + + TaitoMemEnd = Next; + + return 0; +} + +static INT32 TaitoZDoReset() +{ + TaitoDoReset(); + + SciSpriteFrame = 0; + OldSteer = 0; + + return 0; +} + +static void TaitoZCpuAReset(UINT16 d) +{ + TaitoCpuACtrl = d; + if (!(TaitoCpuACtrl & 1)) { + SekClose(); + SekOpen(1); + SekReset(); + SekClose(); + SekOpen(0); + } +} + +void __fastcall Aquajack68K1WriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0xa00000, 0xa0ffff) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +void __fastcall Aquajack68K1WriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0xa00000, 0xa0ffff) + TC0100SCN0CtrlWordWrite_Map(0xa20000) + + switch (a) { + case 0x200000: { + TaitoZCpuAReset(d); + return; + } + + case 0x300000: + case 0x300002: { + TC0110PCRStep1WordWrite(0, (a - 0x300000) >> 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Aquajack68K2ReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x200000) + + switch (a) { + case 0x300003: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); + } + } + + return 0; +} + +UINT16 __fastcall Aquajack68K2ReadWord(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x200000) + + switch (a) { + case 0x900000: + case 0x900002: + case 0x900004: + case 0x900006: { + // nop + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Aquajack68K2WriteWord(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x200000) + + switch (a) { + case 0x300000: { + TC0140SYTPortWrite(d & 0xff); + return; + } + + case 0x300002: { + TC0140SYTCommWrite(d & 0xff); + return; + } + + case 0x900000: + case 0x900002: + case 0x900004: + case 0x900006: { + // nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); + } + } +} + +static UINT8 BsharkStickRead(INT32 Offset) +{ + switch (Offset) { + case 0x00: { + INT32 Temp = (TaitoAnalogPort0 >> 4) & 0xfff; + Temp = 0xfff - Temp; + Temp += 1; + if (Temp == 0x1000) Temp = 0; + return Temp; + } + + case 0x01: { + return 0xff; + } + + case 0x02: { + return TaitoAnalogPort1 >> 4; + } + + case 0x03: { + return 0xff; + } + } + + return 0; +} + +UINT8 __fastcall Bshark68K1ReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x400000) + + switch (a) { + case 0x800001: + case 0x800003: + case 0x800005: + case 0x800007: { + return BsharkStickRead((a - 0x800000) >> 1); + } + + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Bshark68K1WriteByte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x400000) + TC0100SCN0ByteWrite_Map(0xd00000, 0xd0ffff) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +void __fastcall Bshark68K1WriteWord(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x400000) + TC0100SCN0WordWrite_Map(0xd00000, 0xd0ffff) + TC0100SCN0CtrlWordWrite_Map(0xd20000) + + switch (a) { + case 0x600000: { + TaitoZCpuAReset(d); + return; + } + + case 0x800000: + case 0x800002: + case 0x800004: + case 0x800006: { + nTaitoCyclesDone[0] += SekRun(10000); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT16 __fastcall Bshark68K2ReadWord(UINT32 a) +{ + switch (a) { + case 0x40000a: { + // ??? + return 0; + } + + case 0x600000: { + return BurnYM2610Read(0); + } + + case 0x600004: { + return BurnYM2610Read(2); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Bshark68K2WriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x400000: + case 0x400002: + case 0x400004: + case 0x400006: + case 0x400008: { + // nop + return; + } + + case 0x600000: { + BurnYM2610Write(0, d & 0xff); + return; + } + + case 0x600002: { + BurnYM2610Write(1, d & 0xff); + return; + } + + case 0x600004: { + BurnYM2610Write(2, d & 0xff); + return; + } + + case 0x600006: { + BurnYM2610Write(3, d & 0xff); + return; + } + + case 0x60000c: + case 0x60000e: { + // nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); + } + } +} + +static UINT8 ChasehqInputBypassRead() +{ + UINT8 Port = TC0220IOCPortRead(); + + INT32 Steer = (TaitoAnalogPort0 >> 4); + + switch (Port) { + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: { + return 0xff; + } + + case 0x0c: { + return Steer & 0xff; + } + + case 0x0d: { + return Steer >> 8; + } + + default: { + return TC0220IOCPortRegRead(); + } + } +} + +UINT8 __fastcall Chasehq68K1ReadByte(UINT32 a) +{ + switch (a) { + case 0x400001: { + return ChasehqInputBypassRead(); + } + + case 0x820003: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Chasehq68K1WriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0xc00000, 0xc0ffff) + + switch (a) { + case 0x400001: { + TC0220IOCHalfWordPortRegWrite(d); + return; + } + + case 0x400003: { + TC0220IOCHalfWordPortWrite(d); + return; + } + + case 0x800001: { + TaitoZCpuAReset(d); + return; + } + + case 0x820001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x820003: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Chasehq68K1ReadWord(UINT32 a) +{ + switch (a) { + case 0x400002: { + return TC0220IOCHalfWordPortRead(); + } + + case 0xa00002: { + return TC0110PCRWordRead(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Chasehq68K1WriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0xc00000, 0xc0ffff) + TC0100SCN0CtrlWordWrite_Map(0xc20000) + + switch (a) { + case 0x400000: { + TC0220IOCHalfWordPortRegWrite(d); + return; + } + + case 0x400002: { + TC0220IOCHalfWordPortWrite(d); + return; + } + + case 0xa00000: + case 0xa00002: { + TC0110PCRStep1WordWrite(0, (a - 0xa00000) >> 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +static UINT8 ContcircInputBypassRead() +{ + UINT8 Port = TC0220IOCPortRead(); + + INT32 Steer = (TaitoAnalogPort0 >> 4) & 0xfff; + Steer = 0xfff - Steer; + if (Steer == 0xfff) Steer = 0; + if (Steer > 0x5f && Steer < 0x80) Steer = 0x5f; + if (Steer > 0xf7f && Steer < 0xfa0) Steer = 0xfa0; + if (Steer > 0xf7f) Steer |= 0xf000; + + switch (Port) { + case 0x08: { + return Steer & 0xff; + } + + case 0x09: { + return Steer >> 8; + } + + default: { + return TC0220IOCPortRegRead(); + } + } +} + +void __fastcall Contcirc68K1WriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x200000, 0x20ffff) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +void __fastcall Contcirc68K1WriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x200000, 0x20ffff) + TC0100SCN0CtrlWordWrite_Map(0x220000) + + switch (a) { + case 0x090000: { + TaitoRoadPalBank = (d & 0xc0) >> 6; + TaitoZCpuAReset(d); + return; + } + + case 0x100000: + case 0x100002: { + TC0110PCRStep1RBSwapWordWrite(0, (a - 0x100000) >> 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Contcirc68K2ReadByte(UINT32 a) +{ + switch (a) { + case 0x100001: { + return ContcircInputBypassRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Contcirc68K2WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x100001: { + TC0220IOCHalfWordPortRegWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Contcirc68K2ReadWord(UINT32 a) +{ + switch (a) { + case 0x100000: { + return ContcircInputBypassRead(); + } + + case 0x100002: { + return TC0220IOCHalfWordPortRead(); + } + + case 0x200002: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Contcirc68K2WriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x100000: { + TC0220IOCHalfWordPortRegWrite(d); + return; + } + + case 0x100002: { + TC0220IOCHalfWordPortWrite(d); + return; + } + + case 0x200000: { + TC0140SYTPortWrite(d & 0xff); + return; + } + + case 0x200002: { + TC0140SYTCommWrite(d & 0xff); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); + } + } +} + +static UINT16 DblaxleSteerRead(INT32 Offset) +{ + int Steer = TaitoAnalogPort0 >> 5; + if (Steer > 0x3f) Steer |= 0xf800; + + switch (Offset) { + case 0x04: { + return Steer >> 8; + } + + case 0x05: { + return Steer & 0xff; + } + } + + return 0x00; +} + +UINT8 __fastcall Dblaxle68K1ReadByte(UINT32 a) +{ + TC0510NIOHalfWordSwapRead_Map(0x400000) + + switch (a) { + case 0x620003: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Dblaxle68K1WriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordSwapWrite_Map(0x400000) + + switch (a) { + case 0x600001: { + TaitoZCpuAReset(d); + return; + } + + case 0x620001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x620003: { + TC0140SYTCommWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Dblaxle68K1ReadWord(UINT32 a) +{ + TC0510NIOHalfWordSwapRead_Map(0x400000) + + switch (a) { + case 0x400018: + case 0x40001a: { + return DblaxleSteerRead((a - 0x400010) >> 1); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Dblaxle68K1WriteWord(UINT32 a, UINT16 d) +{ + TC0510NIOHalfWordSwapWrite_Map(0x400000) + TC0480SCPCtrlWordWrite_Map(0xa30000) + + switch (a) { + case 0xc08000: { + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +void __fastcall Enforce68K1WriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x600000, 0x60ffff) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Enforce68K1ReadWord(UINT32 a) +{ + switch (a) { + case 0x500002: { + return TC0110PCRWordRead(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Enforce68K1WriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x600000, 0x60ffff) + TC0100SCN0CtrlWordWrite_Map(0x620000) + + switch (a) { + case 0x200000: { + TaitoZCpuAReset(d); + return; + } + + case 0x500000: + case 0x500002: { + TC0110PCRStep1RBSwapWordWrite(0, (a - 0x500000) >> 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Enforce68K2ReadByte(UINT32 a) +{ + switch (a) { + case 0x300001: { + return TC0220IOCPortRegRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Enforce68K2WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x300001: { + TC0220IOCHalfWordPortRegWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Enforce68K2ReadWord(UINT32 a) +{ + switch (a) { + case 0x200002: { + return TC0140SYTCommRead(); + } + + case 0x300000: { + return TC0220IOCPortRegRead(); + } + + case 0x300002: { + return TC0220IOCHalfWordPortRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Enforce68K2WriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x200000: { + TC0140SYTPortWrite(d & 0xff); + return; + } + + case 0x200002: { + TC0140SYTCommWrite(d & 0xff); + return; + } + + case 0x300000: { + TC0220IOCHalfWordPortRegWrite(d); + return; + } + + case 0x300002: { + TC0220IOCHalfWordPortWrite(d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); + } + } +} + +static const UINT8 nightstr_stick[128]= +{ + 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7, + 0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7, + 0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf,0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7, + 0xe8,0x00,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25, + 0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,0x34,0x35, + 0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,0x40,0x41,0x42,0x43,0x44,0x45, + 0x46,0x47,0x48,0x49,0xb8 +}; + +static UINT8 NightstrStickRead(INT32 Offset) +{ + switch (Offset) { + case 0x00: { + UINT8 Temp = 0x7f + (TaitoAnalogPort0 >> 4); + if (Temp < 0x01) Temp = 0x01; + if (Temp > 0xfe) Temp = 0xfe; + return nightstr_stick[(Temp * 0x64) / 0x100]; + } + + case 0x01: { + UINT8 Temp = 0x7f - (TaitoAnalogPort1 >> 4); + if (Temp < 0x01) Temp = 0x01; + if (Temp > 0xfe) Temp = 0xfe; + return nightstr_stick[(Temp * 0x64) / 0x100]; + } + + case 0x02: { + return 0xff; + } + + case 0x03: { + return 0xff; + } + } + + return 0xff; +} + +UINT8 __fastcall Nightstr68K1ReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x400000) + + switch (a) { + case 0xe40001: + case 0xe40003: + case 0xe40005: + case 0xe40007: { + return NightstrStickRead((a - 0xe40000) >> 1); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Nightstr68K1WriteByte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x400000) + TC0100SCN0ByteWrite_Map(0xc00000, 0xc0ffff) + + switch (a) { + case 0xe00000: + case 0xe00008: + case 0xe00010: { + // nop + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Nightstr68K1ReadWord(UINT32 a) +{ + switch (a) { + case 0x820002: { + return TC0140SYTCommRead(); + } + + case 0xa00002: { + return TC0110PCRWordRead(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Nightstr68K1WriteWord(UINT32 a, UINT16 d) +{ + TC0220IOCHalfWordWrite_Map(0x400000) + TC0100SCN0WordWrite_Map(0xc00000, 0xc0ffff) + TC0100SCN0CtrlWordWrite_Map(0xc20000) + + switch (a) { + case 0x800000: { + TaitoZCpuAReset(d); + return; + } + + case 0x820000: { + TC0140SYTPortWrite(d & 0xff); + return; + } + + case 0x820002: { + TC0140SYTCommWrite(d & 0xff); + return; + } + + case 0xa00000: + case 0xa00002: { + TC0110PCRStep1WordWrite(0, (a - 0xa00000) >> 1, d); + return; + } + + case 0xe00000: + case 0xe00008: + case 0xe00010: { + // nop + return; + } + + case 0xe40000: + case 0xe40002: + case 0xe40004: + case 0xe40006: + case 0xe40008: + case 0xe4000a: + case 0xe4000c: + case 0xe4000e: { + nTaitoCyclesDone[0] += SekRun(10000); + SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Racingb68K1ReadByte(UINT32 a) +{ + TC0510NIOHalfWordSwapRead_Map(0x300000) + + switch (a) { + case 0x300019: + case 0x30001b: { + return DblaxleSteerRead((a - 0x300010) >> 1); + } + + case 0x520003: { + return TC0140SYTCommRead(); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Racingb68K1WriteByte(UINT32 a, UINT8 d) +{ + TC0510NIOHalfWordSwapWrite_Map(0x300000) + + switch (a) { + case 0x500002: { + TaitoZCpuAReset(d); + return; + } + + case 0x520001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x520003: { + TC0140SYTCommWrite(d); + return; + } + + case 0xb08000: { + SciSpriteFrame = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Racingb68K1ReadWord(UINT32 a) +{ + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Racingb68K1WriteWord(UINT32 a, UINT16 d) +{ + TC0510NIOHalfWordSwapWrite_Map(0x300000) + TC0480SCPCtrlWordWrite_Map(0x930000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +static UINT8 SciSteerRead(INT32 Offset) +{ + INT32 Steer = TaitoAnalogPort0 >> 4; + if (Steer > 0x5f && Steer < 0x80) Steer = 0x5f; + if (Steer > 0xf80 && Steer < 0xfa0) Steer = 0xfa0; + if ((OldSteer < Steer) && (Steer > 0xfc0)) Steer = 0; + OldSteer = Steer; + + switch (Offset) { + case 0x04: { + return Steer & 0xff; + } + + case 0x05: { + return (Steer & 0xff00) >> 8; + } + } + + return 0xff; +} + +UINT8 __fastcall Sci68K1ReadByte(UINT32 a) +{ + TC0220IOCHalfWordRead_Map(0x200000) + + switch (a) { + case 0x200019: + case 0x20001b: { + return SciSteerRead((a - 0x200010) >> 1); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Sci68K1WriteByte(UINT32 a, UINT8 d) +{ + TC0220IOCHalfWordWrite_Map(0x200000) + TC0100SCN0ByteWrite_Map(0xa00000, 0xa0ffff) + + switch (a) { + case 0x400001: { + TaitoZCpuAReset(d); + return; + } + + case 0x420001: { + TC0140SYTPortWrite(d); + return; + } + + case 0x420003: { + TC0140SYTCommWrite(d); + return; + } + + case 0xc08000: { + SciSpriteFrame = d; + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +void __fastcall Sci68K1WriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0xa00000, 0xa0ffff) + TC0100SCN0CtrlWordWrite_Map(0xa20000) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +static const UINT8 spacegun_default_eeprom[128]= +{ + 0x00,0x00,0x00,0xff,0x00,0x01,0x41,0x41,0x00,0x00,0x00,0xff,0x00,0x00,0xf0,0xf0, + 0x00,0x00,0x00,0xff,0x00,0x01,0x41,0x41,0x00,0x00,0x00,0xff,0x00,0x00,0xf0,0xf0, + 0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x01,0x40,0x00,0x00,0x00,0xf0,0x00, + 0x00,0x01,0x42,0x85,0x00,0x00,0xf1,0xe3,0x00,0x01,0x40,0x00,0x00,0x00,0xf0,0x00, + 0x00,0x01,0x42,0x85,0x00,0x00,0xf1,0xe3,0xcc,0xcb,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff +}; + +static const eeprom_interface spacegun_eeprom_intf = +{ + 6, /* address bits */ + 16, /* data bits */ + "0110", /* read command */ + "0101", /* write command */ + "0111", /* erase command */ + "0100000000", /* lock command */ + "0100111111", /* unlock command */ + 0, /* multi-read disabled */ + 1 /* reset delay */ +}; + +static UINT8 SpacegunInputBypassRead(INT32 Offset) +{ + switch (Offset) { + case 0x03: { + return (EEPROMRead() & 1) << 7; + } + + default: { + return TC0220IOCRead(Offset); + } + } + + return 0; +} + +static void SpacegunInputBypassWrite(INT32 Offset, UINT16 Data) +{ + switch (Offset) { + case 0x03: { + EEPROMWrite(Data & 0x20, Data & 0x10, Data & 0x40); + return; + } + + default: { + TC0220IOCWrite(Offset, Data & 0xff); + } + } +} + +void __fastcall Spacegun68K1WriteByte(UINT32 a, UINT8 d) +{ + TC0100SCN0ByteWrite_Map(0x900000, 0x90ffff) + + switch (a) { + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Spacegun68K1ReadWord(UINT32 a) +{ + switch (a) { + case 0xb00002: { + return TC0110PCRWordRead(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Spacegun68K1WriteWord(UINT32 a, UINT16 d) +{ + TC0100SCN0WordWrite_Map(0x900000, 0x90ffff) + TC0100SCN0CtrlWordWrite_Map(0x920000) + + switch (a) { + case 0xb00000: + case 0xb00002: { + TC0110PCRStep1RBSwapWordWrite(0, (a - 0xb00000) >> 1, d); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall Spacegun68K2ReadByte(UINT32 a) +{ + switch (a) { + case 0xc0000d: { + // nop + return 0; + } + + case 0xf00001: { + return ~BurnGunReturnX(0); + } + + case 0xf00003: { + return BurnGunReturnY(0); + } + + case 0xf00005: { + return ~BurnGunReturnX(1); + } + + case 0xf00007: { + return BurnGunReturnY(1); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Spacegun68K2WriteByte(UINT32 a, UINT8 d) +{ + switch (a) { + case 0x800008: { + SpacegunInputBypassWrite((a - 0x800000) >> 1, d); + return; + } + + case 0xc0000d: { + // nop + return; + } + + case 0xe00001: { + // ??? + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write byte => %06X, %02X\n"), a, d); + } + } +} + +UINT16 __fastcall Spacegun68K2ReadWord(UINT32 a) +{ + switch (a) { + case 0x800000: + case 0x800002: + case 0x800004: + case 0x800006: + case 0x800008: + case 0x80000a: + case 0x80000c: + case 0x80000e: { + return SpacegunInputBypassRead((a - 0x800000) >> 1); + } + + case 0xc00000: { + return BurnYM2610Read(0); + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); + } + } + + return 0; +} + +void __fastcall Spacegun68K2WriteWord(UINT32 a, UINT16 d) +{ + switch (a) { + case 0x800000: + case 0x800002: + case 0x800004: + case 0x800006: + case 0x800008: + case 0x80000a: + case 0x80000c: + case 0x80000e: { + SpacegunInputBypassWrite((a - 0x800000) >> 1, d); + return; + } + + case 0xc00000: { + BurnYM2610Write(0, d & 0xff); + return; + } + + case 0xc00002: { + BurnYM2610Write(1, d & 0xff); + return; + } + + case 0xc00004: { + BurnYM2610Write(2, d & 0xff); + return; + } + + case 0xc00006: { + BurnYM2610Write(3, d & 0xff); + return; + } + + case 0xc20000: + case 0xc20002: + case 0xc20004: + case 0xc20006: { + // ??? + return; + } + + case 0xf00000: + case 0xf00002: + case 0xf00004: + case 0xf00006: { + nTaitoCyclesDone[1] += SekRun(10000); + SekSetIRQLine(5, SEK_IRQSTATUS_AUTO); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); + } + } +} + +UINT8 __fastcall TaitoZZ80Read(UINT16 a) +{ + switch (a) { + case 0xe000: { + return BurnYM2610Read(0); + } + + case 0xe001: { + return BurnYM2610Read(1); + } + + case 0xe002: { + return BurnYM2610Read(2); + } + + case 0xe200: { + // NOP + return 0; + } + + case 0xe201: { + return TC0140SYTSlaveCommRead(); + } + + case 0xea00: { + // NOP + return 0; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a); + } + } + + return 0; +} + +void __fastcall TaitoZZ80Write(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xe000: { + BurnYM2610Write(0, d); + return; + } + + case 0xe001: { + BurnYM2610Write(1, d); + return; + } + + case 0xe002: { + BurnYM2610Write(2, d); + return; + } + + case 0xe003: { + BurnYM2610Write(3, d); + return; + } + + case 0xe200: { + TC0140SYTSlavePortWrite(d); + return; + } + + case 0xe201: { + TC0140SYTSlaveCommWrite(d); + return; + } + + case 0xe400: { + BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_1, TaitoZYM2610Route1MasterVol * d / 255.0); + return; + } + + case 0xe401: { + BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_1, TaitoZYM2610Route1MasterVol * d / 255.0); + return; + } + + case 0xe402: { + BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_2, TaitoZYM2610Route1MasterVol * d / 255.0); + return; + } + + case 0xe403: { + BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_2, TaitoZYM2610Route1MasterVol * d / 255.0); + return; + } + + case 0xe600: { + return; + } + + case 0xee00: { + return; + } + + case 0xf000: { + return; + } + + case 0xf200: { + TaitoZ80Bank = (d - 1) & 7; + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + return; + } + + default: { + bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d); + } + } +} + +static INT32 CharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 CharXOffsets[8] = { 8, 12, 0, 4, 24, 28, 16, 20 }; +static INT32 CharYOffsets[8] = { 0, 32, 64, 96, 128, 160, 192, 224 }; +static INT32 DblaxleCharPlaneOffsets[4] = { 0, 1, 2, 3 }; +static INT32 DblaxleCharXOffsets[16] = { 4, 0, 20, 16, 12, 8, 28, 24, 36, 32, 52, 48, 44, 40, 60, 56 }; +static INT32 DblaxleCharYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; +static INT32 SpritePlaneOffsets[4] = { 0, 8, 16, 24 }; +static INT32 SpriteXOffsets[16] = { 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 }; +static INT32 SpriteYOffsets[16] = { 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960 }; +static INT32 Sprite16x8YOffsets[8] = { 0, 64, 128, 192, 256, 320, 384, 448 }; + +static void TaitoZFMIRQHandler(INT32, INT32 nStatus) +{ + if (nStatus & 1) { + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_ACK); + } else { + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + } +} + +static INT32 TaitoZSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / (16000000 / 4); +} + +static double TaitoZGetTime() +{ + return (double)ZetTotalCycles() / (16000000 / 4); +} + +static INT32 TaitoZ68KSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)SekTotalCycles() * nSoundRate / (nTaitoCyclesTotal[1] * 60); +} + +static double TaitoZ68KGetTime() +{ + return (double)SekTotalCycles() / (nTaitoCyclesTotal[1] * 60); +} + +static void TaitoZZ80Init() +{ + // Setup the Z80 emulation + ZetInit(0); + ZetOpen(0); + ZetSetReadHandler(TaitoZZ80Read); + ZetSetWriteHandler(TaitoZZ80Write); + ZetMapArea(0x0000, 0x3fff, 0, TaitoZ80Rom1 ); + ZetMapArea(0x0000, 0x3fff, 2, TaitoZ80Rom1 ); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 ); + ZetMapArea(0xc000, 0xdfff, 0, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); + ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); + ZetClose(); + + TaitoNumZ80s = 1; +} + +static void SwitchToMusashi() +{ + if (bBurnUseASMCPUEmulation) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); +#endif + bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; + bBurnUseASMCPUEmulation = false; + } +} + +static INT32 AquajackInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 8; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = Sprite16x8YOffsets; + TaitoNumSpriteA = 0x8000; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); + TC0110PCRInit(1, 0x1000); + TC0150RODInit(TaitoRoadRomSize, 0); + TC0140SYTInit(); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x104000, 0x107fff, SM_RAM); + SekMapMemory(TC0150RODRam , 0x800000, 0x801fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0xa00000, 0xa0ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0xc40000, 0xc403ff, SM_RAM); + SekSetWriteByteHandler(0, Aquajack68K1WriteByte); + SekSetWriteWordHandler(0, Aquajack68K1WriteWord); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x104000, 0x107fff, SM_RAM); + SekSetReadWordHandler(0, Aquajack68K2ReadWord); + SekSetWriteWordHandler(0, Aquajack68K2WriteWord); + SekSetReadByteHandler(0, Aquajack68K2ReadByte); + SekClose(); + + TaitoZZ80Init(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); + BurnTimerAttachZet(16000000 / 4); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + TaitoZYM2610Route1MasterVol = 2.00; + TaitoZYM2610Route2MasterVol = 2.00; + bYM2610UseSeperateVolumes = 1; + + TaitoMakeInputsFunction = AquajackMakeInputs; + TaitoDrawFunction = AquajackDraw; + TaitoIrqLine = 4; + TaitoFrameInterleave = 500; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = 12000000 / 60; + nTaitoCyclesTotal[2] = (16000000 / 4) / 60; + + // Reset the driver + TaitoZDoReset(); + + return 0; +} + +static INT32 BsharkInit() +{ + INT32 nLen; + + Sci = 1; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 8; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = Sprite16x8YOffsets; + TaitoNumSpriteA = 0x8000; + + TaitoNum68Ks = 2; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 0, 8, 1, NULL); + TC0150RODInit(TaitoRoadRomSize, 1); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x110000, 0x113fff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0xa00000, 0xa01fff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0xc00000, 0xc00fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0xd00000, 0xd0ffff, SM_READ); + SekSetWriteWordHandler(0, Bshark68K1WriteWord); + SekSetReadByteHandler(0, Bshark68K1ReadByte); + SekSetWriteByteHandler(0, Bshark68K1WriteByte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x108000, 0x10bfff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x110000, 0x113fff, SM_RAM); + SekMapMemory(TC0150RODRam , 0x800000, 0x801fff, SM_RAM); + SekSetReadWordHandler(0, Bshark68K2ReadWord); + SekSetWriteWordHandler(0, Bshark68K2WriteWord); + SekClose(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, NULL, TaitoZ68KSynchroniseStream, TaitoZ68KGetTime, 0); + BurnTimerAttachSek(12000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + TaitoMakeInputsFunction = BsharkMakeInputs; + TaitoDrawFunction = BsharkDraw; + TaitoIrqLine = 4; + TaitoFrameInterleave = 100; + TaitoFlipScreenX = 1; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = 12000000 / 60; + + // Reset the driver + TaitoZDoReset(); + + return 0; +} + +static INT32 ChasehqInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x4000; + + TaitoSpriteBModulo = 0x400; + TaitoSpriteBNumPlanes = 4; + TaitoSpriteBWidth = 16; + TaitoSpriteBHeight = 16; + TaitoSpriteBPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteBXOffsets = SpriteXOffsets; + TaitoSpriteBYOffsets = SpriteYOffsets; + TaitoNumSpriteB = 0x4000; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); + TC0110PCRInit(1, 0x1000); + TC0150RODInit(TaitoRoadRomSize, 0); + TC0140SYTInit(); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x107fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x108000, 0x10bfff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0xc00000, 0xc0ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0xd00000, 0xd007ff, SM_RAM); + SekSetReadWordHandler(0, Chasehq68K1ReadWord); + SekSetWriteWordHandler(0, Chasehq68K1WriteWord); + SekSetReadByteHandler(0, Chasehq68K1ReadByte); + SekSetWriteByteHandler(0, Chasehq68K1WriteByte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x01ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x108000, 0x10bfff, SM_RAM); + SekMapMemory(TC0150RODRam , 0x800000, 0x801fff, SM_RAM); + SekClose(); + + TaitoZZ80Init(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); + BurnTimerAttachZet(16000000 / 4); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); + TaitoZYM2610Route1MasterVol = 1.00; + TaitoZYM2610Route2MasterVol = 1.00; + bYM2610UseSeperateVolumes = 1; + + TaitoMakeInputsFunction = ChasehqMakeInputs; + TaitoDrawFunction = ChasehqDraw; + TaitoIrqLine = 4; + TaitoFrameInterleave = 100; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = 12000000 / 60; + nTaitoCyclesTotal[2] = (16000000 / 4) / 60; + + // Reset the driver + TaitoZDoReset(); + + return 0; +} + +static INT32 ContcircInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 8; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = Sprite16x8YOffsets; + TaitoNumSpriteA = 0x8000; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 0, 16, 0, NULL); + TC0110PCRInit(1, 0x1000); + TC0150RODInit(TaitoRoadRomSize, 0); + TC0140SYTInit(); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x080000, 0x083fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x084000, 0x087fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x200000, 0x20ffff, SM_READ); + SekMapMemory(TC0150RODRam , 0x300000, 0x301fff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x400000, 0x4006ff, SM_RAM); + SekSetWriteByteHandler(0, Contcirc68K1WriteByte); + SekSetWriteWordHandler(0, Contcirc68K1WriteWord); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x080000, 0x083fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x084000, 0x087fff, SM_RAM); + SekSetReadWordHandler(0, Contcirc68K2ReadWord); + SekSetWriteWordHandler(0, Contcirc68K2WriteWord); + SekSetReadByteHandler(0, Contcirc68K2ReadByte); + SekSetWriteByteHandler(0, Contcirc68K2WriteByte); + SekClose(); + + TaitoZZ80Init(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); + BurnTimerAttachZet(16000000 / 4); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); + TaitoZYM2610Route1MasterVol = 2.00; + TaitoZYM2610Route2MasterVol = 2.00; + bYM2610UseSeperateVolumes = 1; + + TaitoMakeInputsFunction = ContcircMakeInputs; + TaitoDrawFunction = ContcircDraw; + TaitoIrqLine = 6; + TaitoFrameInterleave = 100; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = 12000000 / 60; + nTaitoCyclesTotal[2] = (16000000 / 4) / 60; + + // Reset the driver + TaitoZDoReset(); + + return 0; +} + +static INT32 DblaxleInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x400; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 16; + TaitoCharHeight = 16; + TaitoCharPlaneOffsets = DblaxleCharPlaneOffsets; + TaitoCharXOffsets = DblaxleCharXOffsets; + TaitoCharYOffsets = DblaxleCharYOffsets; + TaitoNumChar = 0x2000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 8; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = Sprite16x8YOffsets; + TaitoNumSpriteA = 0x10000; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + TC0150RODInit(TaitoRoadRomSize, 0); + TC0480SCPInit(TaitoNumChar, 0, 0x21, 8, 4, 0, 0); + TC0140SYTInit(); + TC0510NIOInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x200000, 0x203fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x210000, 0x21ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x800000, 0x801fff, SM_RAM); + SekMapMemory(TC0480SCPRam , 0x900000, 0x90ffff, SM_RAM); + SekMapMemory(TC0480SCPRam , 0xa00000, 0xa0ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0xc00000, 0xc03fff, SM_RAM); + SekSetReadWordHandler(0, Dblaxle68K1ReadWord); + SekSetWriteWordHandler(0, Dblaxle68K1WriteWord); + SekSetReadByteHandler(0, Dblaxle68K1ReadByte); + SekSetWriteByteHandler(0, Dblaxle68K1WriteByte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x110000, 0x11ffff, SM_RAM); + SekMapMemory(TC0150RODRam , 0x300000, 0x301fff, SM_RAM); + SekClose(); + + TaitoZZ80Init(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); + BurnTimerAttachZet(16000000 / 4); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + TaitoZYM2610Route1MasterVol = 8.00; + TaitoZYM2610Route2MasterVol = 8.00; + bYM2610UseSeperateVolumes = 1; + + TaitoMakeInputsFunction = DblaxleMakeInputs; + TaitoDrawFunction = DblaxleDraw; + TaitoIrqLine = 4; + TaitoFrameInterleave = 100; + + nTaitoCyclesTotal[0] = 16000000 / 60; + nTaitoCyclesTotal[1] = 16000000 / 60; + nTaitoCyclesTotal[2] = (16000000 / 4) / 60; + + GenericTilesInit(); + + // Reset the driver + TaitoZDoReset(); + + return 0; +} + +static INT32 EnforceInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 8; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = Sprite16x8YOffsets; + TaitoNumSpriteA = 0x8000; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 0, 16, 0, NULL); + TC0110PCRInit(1, 0x1000); + TC0150RODInit(TaitoRoadRomSize, 0); + TC0140SYTInit(); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x104000, 0x107fff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x300000, 0x3006ff, SM_RAM); + SekMapMemory(TC0150RODRam , 0x400000, 0x401fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x600000, 0x60ffff, SM_READ); + SekSetWriteByteHandler(0, Enforce68K1WriteByte); + SekSetReadWordHandler(0, Enforce68K1ReadWord); + SekSetWriteWordHandler(0, Enforce68K1WriteWord); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x104000, 0x107fff, SM_RAM); + SekSetReadWordHandler(0, Enforce68K2ReadWord); + SekSetWriteWordHandler(0, Enforce68K2WriteWord); + SekSetReadByteHandler(0, Enforce68K2ReadByte); + SekSetWriteByteHandler(0, Enforce68K2WriteByte); + SekClose(); + + TaitoZZ80Init(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); + BurnTimerAttachZet(16000000 / 4); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); + TaitoZYM2610Route1MasterVol = 20.00; + TaitoZYM2610Route2MasterVol = 20.00; + bYM2610UseSeperateVolumes = 1; + + TaitoMakeInputsFunction = EnforceMakeInputs; + TaitoDrawFunction = EnforceDraw; + TaitoIrqLine = 6; + TaitoFrameInterleave = 100; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = 12000000 / 60; + nTaitoCyclesTotal[2] = (16000000 / 4) / 60; + + // Reset the driver + TaitoZDoReset(); + + return 0; +} + +static INT32 NightstrInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x400; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 16; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = SpriteYOffsets; + TaitoNumSpriteA = 0x4000; + + TaitoSpriteBModulo = 0x400; + TaitoSpriteBNumPlanes = 4; + TaitoSpriteBWidth = 16; + TaitoSpriteBHeight = 16; + TaitoSpriteBPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteBXOffsets = SpriteXOffsets; + TaitoSpriteBYOffsets = SpriteYOffsets; + TaitoNumSpriteB = 0x4000; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); + TC0110PCRInit(1, 0x1000); + TC0150RODInit(TaitoRoadRomSize, 0); + TC0140SYTInit(); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x10ffff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x110000, 0x113fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0xc00000, 0xc0ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0xd00000, 0xd007ff, SM_RAM); + SekSetReadWordHandler(0, Nightstr68K1ReadWord); + SekSetWriteWordHandler(0, Nightstr68K1WriteWord); + SekSetReadByteHandler(0, Nightstr68K1ReadByte); + SekSetWriteByteHandler(0, Nightstr68K1WriteByte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x104000, 0x107fff, SM_RAM); + SekMapMemory(TC0150RODRam , 0x800000, 0x801fff, SM_RAM); + SekClose(); + + TaitoZZ80Init(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); + BurnTimerAttachZet(16000000 / 4); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.20); + TaitoZYM2610Route1MasterVol = 1.00; + TaitoZYM2610Route2MasterVol = 1.00; + bYM2610UseSeperateVolumes = 1; + + TaitoMakeInputsFunction = NightstrMakeInputs; + TaitoDrawFunction = ChasehqDraw; + TaitoIrqLine = 4; + TaitoFrameInterleave = 100; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = 12000000 / 60; + nTaitoCyclesTotal[2] = (16000000 / 4) / 60; + + // Reset the driver + TaitoZDoReset(); + + return 0; +} + +static INT32 RacingbInit() +{ + INT32 nLen; + + Sci = 1; + + TaitoCharModulo = 0x400; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 16; + TaitoCharHeight = 16; + TaitoCharPlaneOffsets = DblaxleCharPlaneOffsets; + TaitoCharXOffsets = DblaxleCharXOffsets; + TaitoCharYOffsets = DblaxleCharYOffsets; + TaitoNumChar = 0x2000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 8; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = Sprite16x8YOffsets; + TaitoNumSpriteA = 0x10000; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + TC0150RODInit(TaitoRoadRomSize, 0); + TC0480SCPInit(TaitoNumChar, 0, 0x1f, 8, 4, 0, 0); + TC0140SYTInit(); + TC0510NIOInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x103fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x110000, 0x11ffff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x700000, 0x701fff, SM_RAM); + SekMapMemory(TC0480SCPRam , 0x900000, 0x90ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0xb00000, 0xb03fff, SM_RAM); + SekSetReadWordHandler(0, Racingb68K1ReadWord); + SekSetWriteWordHandler(0, Racingb68K1WriteWord); + SekSetReadByteHandler(0, Racingb68K1ReadByte); + SekSetWriteByteHandler(0, Racingb68K1WriteByte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x400000, 0x403fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x410000, 0x41ffff, SM_RAM); + SekMapMemory(TC0150RODRam , 0xa00000, 0xa01fff, SM_RAM); + SekClose(); + + TaitoZZ80Init(); + + BurnYM2610Init(32000000 / 4, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); + BurnTimerAttachZet(32000000 / 8); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + TaitoZYM2610Route1MasterVol = 8.00; + TaitoZYM2610Route2MasterVol = 8.00; + bYM2610UseSeperateVolumes = 1; + + TaitoMakeInputsFunction = DblaxleMakeInputs; + TaitoDrawFunction = RacingbDraw; + TaitoIrqLine = 4; + TaitoFrameInterleave = 100; + + nTaitoCyclesTotal[0] = 16000000 / 60; + nTaitoCyclesTotal[1] = 16000000 / 60; + nTaitoCyclesTotal[2] = (16000000 / 4) / 60; + + GenericTilesInit(); + + // Reset the driver + TaitoZDoReset(); + + return 0; +} + +static INT32 SciInit() +{ + INT32 nLen; + + Sci = 1; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 8; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = Sprite16x8YOffsets; + TaitoNumSpriteA = 0x8000; + + TaitoNum68Ks = 2; + TaitoNumZ80s = 1; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 0, 8, 0, NULL); + TC0150RODInit(TaitoRoadRomSize, 0); + TC0140SYTInit(); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x100000, 0x107fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x108000, 0x10bfff, SM_RAM); + SekMapMemory(TaitoPaletteRam , 0x800000, 0x801fff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0xa00000, 0xa0ffff, SM_READ); + SekMapMemory(TaitoSpriteRam , 0xc00000, 0xc03fff, SM_RAM); + SekSetWriteWordHandler(0, Sci68K1WriteWord); + SekSetReadByteHandler(0, Sci68K1ReadByte); + SekSetWriteByteHandler(0, Sci68K1WriteByte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x01ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x200000, 0x203fff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x208000, 0x20bfff, SM_RAM); + SekMapMemory(TC0150RODRam , 0xa00000, 0xa01fff, SM_RAM); + SekClose(); + + TaitoZZ80Init(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &TaitoZFMIRQHandler, TaitoZSynchroniseStream, TaitoZGetTime, 0); + BurnTimerAttachZet(16000000 / 4); + BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + BurnYM2610SetRightVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); + TaitoZYM2610Route1MasterVol = 1.00; + TaitoZYM2610Route2MasterVol = 1.00; + bYM2610UseSeperateVolumes = 1; + + TaitoMakeInputsFunction = SciMakeInputs; + TaitoDrawFunction = SciDraw; + TaitoIrqLine = 4; + TaitoFrameInterleave = 100; + + nTaitoCyclesTotal[0] = 12000000 / 60; + nTaitoCyclesTotal[1] = 12000000 / 60; + nTaitoCyclesTotal[2] = (16000000 / 4) / 60; + + // Reset the driver + TaitoZDoReset(); + + return 0; +} + +static INT32 SpacegunInit() +{ + INT32 nLen; + + TaitoCharModulo = 0x100; + TaitoCharNumPlanes = 4; + TaitoCharWidth = 8; + TaitoCharHeight = 8; + TaitoCharPlaneOffsets = CharPlaneOffsets; + TaitoCharXOffsets = CharXOffsets; + TaitoCharYOffsets = CharYOffsets; + TaitoNumChar = 0x4000; + + TaitoSpriteAModulo = 0x200; + TaitoSpriteANumPlanes = 4; + TaitoSpriteAWidth = 16; + TaitoSpriteAHeight = 8; + TaitoSpriteAPlaneOffsets = SpritePlaneOffsets; + TaitoSpriteAXOffsets = SpriteXOffsets; + TaitoSpriteAYOffsets = Sprite16x8YOffsets; + TaitoNumSpriteA = 0x10000; + + TaitoNum68Ks = 2; + TaitoNumYM2610 = 1; + + TaitoLoadRoms(0); + + // Allocate and Blank all required memory + TaitoMem = NULL; + MemIndex(); + nLen = TaitoMemEnd - (UINT8 *)0; + if ((TaitoMem = (UINT8 *)malloc(nLen)) == NULL) return 1; + memset(TaitoMem, 0, nLen); + MemIndex(); + + GenericTilesInit(); + + TC0100SCNInit(0, TaitoNumChar, 4, 8, 1, NULL); + TC0110PCRInit(1, 0x1000); + TC0220IOCInit(); + + if (TaitoLoadRoms(1)) return 1; + + SwitchToMusashi(); + + // Setup the 68000 emulation + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Taito68KRom1 , 0x000000, 0x07ffff, SM_ROM); + SekMapMemory(Taito68KRam1 , 0x30c000, 0x30ffff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x310000, 0x31ffff, SM_RAM); + SekMapMemory(TaitoSpriteRam , 0x500000, 0x5005ff, SM_RAM); + SekMapMemory(TC0100SCNRam[0] , 0x900000, 0x90ffff, SM_READ); + SekSetReadWordHandler(0, Spacegun68K1ReadWord); + SekSetWriteWordHandler(0, Spacegun68K1WriteWord); + SekSetWriteByteHandler(0, Spacegun68K1WriteByte); + SekClose(); + + SekInit(1, 0x68000); + SekOpen(1); + SekMapMemory(Taito68KRom2 , 0x000000, 0x03ffff, SM_ROM); + SekMapMemory(Taito68KRam2 , 0x20c000, 0x20ffff, SM_RAM); + SekMapMemory(TaitoSharedRam , 0x210000, 0x21ffff, SM_RAM); + SekSetReadWordHandler(0, Spacegun68K2ReadWord); + SekSetWriteWordHandler(0, Spacegun68K2WriteWord); + SekSetReadByteHandler(0, Spacegun68K2ReadByte); + SekSetWriteByteHandler(0, Spacegun68K2WriteByte); + SekClose(); + + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, NULL, TaitoZ68KSynchroniseStream, TaitoZ68KGetTime, 0); + BurnTimerAttachSek(16000000); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 0.25, BURN_SND_ROUTE_BOTH); + + EEPROMInit(&spacegun_eeprom_intf); + if (!EEPROMAvailable()) EEPROMFill(spacegun_default_eeprom, 0, 128); + + TaitoMakeInputsFunction = SpacegunMakeInputs; + TaitoDrawFunction = SpacegunDraw; + TaitoIrqLine = 4; + TaitoFrameInterleave = 100; + TaitoFlipScreenX = 1; + TaitoNumEEPROM = 1; + + nTaitoCyclesTotal[0] = 16000000 / 60; + nTaitoCyclesTotal[1] = 16000000 / 60; + + BurnGunInit(2, true); + + // Reset the driver + TaitoZDoReset(); + + return 0; +} + +static INT32 TaitoZExit() +{ + TaitoExit(); + + SciSpriteFrame = 0; + OldSteer = 0; + Sci = 0; + + // Switch back CPU core if needed + if (bUseAsm68KCoreOldValue) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); +#endif + bUseAsm68KCoreOldValue = false; + bBurnUseASMCPUEmulation = true; + } + + return 0; +} + +static inline UINT8 pal5bit(UINT8 bits) +{ + bits &= 0x1f; + return (bits << 3) | (bits >> 2); +} + +inline static UINT32 CalcCol(UINT16 nColour) +{ + INT32 r, g, b; + + r = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 0); + g = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 5); + b = pal5bit(BURN_ENDIAN_SWAP_INT16(nColour) >> 10); + + return BurnHighCol(r, g, b, 0); +} + +static void TaitoZCalcPalette() +{ + INT32 i; + UINT16* ps; + UINT32* pd; + + for (i = 0, ps = (UINT16*)TaitoPaletteRam, pd = TaitoPalette; i < 0x1000; i++, ps++, pd++) { + *pd = CalcCol(*ps); + } +} + +static void RenderSpriteZoom(INT32 Code, INT32 sx, INT32 sy, INT32 Colour, INT32 xFlip, INT32 yFlip, INT32 xScale, INT32 yScale, UINT8* pSource) +{ + // We can use sprite A for sizes, etc. as only Chase HQ uses sprite B and it has the same sizes and count + + UINT8 *SourceBase = pSource + ((Code % TaitoNumSpriteA) * TaitoSpriteAWidth * TaitoSpriteAHeight); + + INT32 SpriteScreenHeight = (yScale * TaitoSpriteAHeight + 0x8000) >> 16; + INT32 SpriteScreenWidth = (xScale * TaitoSpriteAWidth + 0x8000) >> 16; + + Colour = 0x10 * (Colour % 0x100); + + if (TaitoFlipScreenX) { + xFlip = !xFlip; + sx = 320 - sx - (xScale >> 12); + } + + if (SpriteScreenWidth && SpriteScreenHeight) { + INT32 dx = (TaitoSpriteAWidth << 16) / SpriteScreenWidth; + INT32 dy = (TaitoSpriteAHeight << 16) / SpriteScreenHeight; + + INT32 ex = sx + SpriteScreenWidth; + INT32 ey = sy + SpriteScreenHeight; + + INT32 xIndexBase; + INT32 yIndex; + + if (xFlip) { + xIndexBase = (SpriteScreenWidth - 1) * dx; + dx = -dx; + } else { + xIndexBase = 0; + } + + if (yFlip) { + yIndex = (SpriteScreenHeight - 1) * dy; + dy = -dy; + } else { + yIndex = 0; + } + + if (sx < 0) { + INT32 Pixels = 0 - sx; + sx += Pixels; + xIndexBase += Pixels * dx; + } + + if (sy < 0) { + INT32 Pixels = 0 - sy; + sy += Pixels; + yIndex += Pixels * dy; + } + + if (ex > nScreenWidth) { + INT32 Pixels = ex - nScreenWidth; + ex -= Pixels; + } + + if (ey > nScreenHeight) { + INT32 Pixels = ey - nScreenHeight; + ey -= Pixels; + } + + if (ex > sx) { + INT32 y; + + for (y = sy; y < ey; y++) { + UINT8 *Source = SourceBase + ((yIndex >> 16) * TaitoSpriteAWidth); + UINT16* pPixel = pTransDraw + (y * nScreenWidth); + + INT32 x, xIndex = xIndexBase; + for (x = sx; x < ex; x++) { + INT32 c = Source[xIndex >> 16]; + if (c != 0) { + pPixel[x] = c | Colour; + } + xIndex += dx; + } + + yIndex += dy; + } + } + } +} + +static void AquajackRenderSprites(INT32 PriorityDraw) +{ + UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + INT32 Offset, Data, Tile, Colour, xFlip, yFlip; + INT32 x, y, Priority, xCur, yCur; + INT32 xZoom, yZoom, zx, zy; + INT32 SpriteChunk, MapOffset, Code, j, k, px, py; + + for (Offset = 0x200 - 4; Offset >= 0; Offset -= 4) { + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); + Priority = (Data & 0x8000) >> 15; + + if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); + if (Priority != PriorityDraw) continue; + + xFlip = (Data & 0x4000) >> 14; + x = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); + yFlip = (Data & 0x8000) >> 15; + Tile = Data & 0x1fff; + if (!Tile) continue; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); + yZoom = (Data & 0x7e00) >> 9; + y = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); + Colour = (Data & 0xff00) >> 8; + xZoom = (Data & 0x3f); + + MapOffset = Tile << 5; + + xZoom += 1; + yZoom += 1; + + y += 3; + + if (x > 0x140) x -= 0x200; + if (y > 0x140) y -= 0x200; + + for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { + k = SpriteChunk % 4; + j = SpriteChunk / 4; + + px = xFlip ? (3 - k) : k; + py = yFlip ? (7 - j) : j; + + Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); + Code &= (TaitoNumSpriteA - 1); + + xCur = x + ((k * xZoom) / 4); + yCur = y + ((j * yZoom) / 8); + + zx = x + (((k + 1) * xZoom) / 4) - xCur; + zy = y + (((j + 1) * yZoom) / 8) - yCur; + + yCur -= 16; + + RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); + } + + + } +} + +static void BsharkRenderSprites(INT32 PriorityDraw, INT32 yOffset, INT32 SpriteRamSize) +{ + UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + INT32 Offset, Data, Tile, Colour, xFlip, yFlip; + INT32 x, y, Priority, xCur, yCur; + INT32 xZoom, yZoom, zx, zy; + INT32 SpriteChunk, MapOffset, Code, j, k, px, py; + + for (Offset = 0; Offset < SpriteRamSize - 4; Offset += 4) { + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); + Priority = (Data & 0x8000) >> 15; + + if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); + if (Priority != PriorityDraw) continue; + + Colour = (Data & 0x7f80) >> 7; + xZoom = (Data & 0x3f); + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); + Tile = Data & 0x1fff; + if (!Tile) continue; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); + yZoom = (Data & 0x7e00) >> 9; + y = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); + yFlip = (Data & 0x8000) >> 15; + xFlip = (Data & 0x4000) >> 14; + x = Data & 0x1ff; + + MapOffset = Tile << 5; + + xZoom += 1; + yZoom += 1; + + y += yOffset; + y += (64 - yZoom); + + if (x > 0x140) x -= 0x200; + if (y > 0x140) y -= 0x200; + + for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { + k = SpriteChunk % 4; + j = SpriteChunk / 4; + + px = xFlip ? (3 - k) : k; + py = yFlip ? (7 - j) : j; + + Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); + Code &= (TaitoNumSpriteA - 1); + + xCur = x + ((k * xZoom) / 4); + yCur = y + ((j * yZoom) / 8); + + zx = x + (((k + 1) * xZoom) / 4) - xCur; + zy = y + (((j + 1) * yZoom) / 8) - yCur; + + yCur -= 16; + + RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); + } + + } +} + +static void ChasehqRenderSprites(INT32 PriorityDraw) +{ + UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + INT32 Offset, Data, Tile, Colour, xFlip, yFlip; + INT32 x, y, Priority, xCur, yCur; + INT32 xZoom, yZoom, zx, zy; + INT32 SpriteChunk, MapOffset, Code, j, k, px, py; + + for (Offset = 0; Offset < 0x400; Offset += 4) { + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); + Priority = (Data & 0x8000) >> 15; + + if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); + if (Priority != PriorityDraw) continue; + + Colour = (Data & 0x7f80) >> 7; + xZoom = (Data & 0x7f); + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); + Tile = Data & 0x7ff; + if (!Tile) continue; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); + yZoom = (Data & 0xfe00) >> 9; + y = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); + yFlip = (Data & 0x8000) >> 15; + xFlip = (Data & 0x4000) >> 14; + x = Data & 0x1ff; + + xZoom += 1; + yZoom += 1; + + y += 7; + y += (128 - yZoom); + + if (x > 0x140) x -= 0x200; + if (y > 0x140) y -= 0x200; + + if ((xZoom - 1) & 0x40) { + MapOffset = Tile << 6; + + for (SpriteChunk = 0; SpriteChunk < 64; SpriteChunk++) { + j = SpriteChunk / 8; + k = SpriteChunk % 8; + + px = xFlip ? (7 - k) : k; + py = yFlip ? (7 - j) : j; + + Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 3)]); + Code &= (TaitoNumSpriteA - 1); + + xCur = x + ((k * xZoom) / 8); + yCur = y + ((j * yZoom) / 8); + + zx = x + (((k + 1) * xZoom) / 8) - xCur; + zy = y + (((j + 1) * yZoom) / 8) - yCur; + + yCur -= 16; + + RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 12, TaitoSpritesA); + } + } else if ((xZoom - 1) & 0x20) { + MapOffset = (Tile << 5) + 0x20000; + + for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { + j = SpriteChunk / 4; + k = SpriteChunk % 4; + + px = xFlip ? (3 - k) : k; + py = yFlip ? (7 - j) : j; + + Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); + Code &= (TaitoNumSpriteB - 1); + + xCur = x + ((k * xZoom) / 4); + yCur = y + ((j * yZoom) / 8); + + zx = x + (((k + 1) * xZoom) / 4) - xCur; + zy = y + (((j + 1) * yZoom) / 8) - yCur; + + yCur -= 16; + + RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 12, TaitoSpritesB); + } + } else if (!((xZoom - 1) & 0x60)) { + MapOffset = (Tile << 4) + 0x30000; + + for (SpriteChunk = 0; SpriteChunk < 16; SpriteChunk++) { + j = SpriteChunk / 2; + k = SpriteChunk % 2; + + px = xFlip ? (1 - k) : k; + py = yFlip ? (7 - j) : j; + + Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 1)]); + Code &= (TaitoNumSpriteB - 1); + + xCur = x + ((k * xZoom) / 2); + yCur = y + ((j * yZoom) / 8); + + zx = x + (((k + 1) * xZoom) / 2) - xCur; + zy = y + (((j + 1) * yZoom) / 8) - yCur; + + yCur -= 16; + + RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 12, TaitoSpritesB); + } + } + } +} + +static void ContcircRenderSprites(INT32 PriorityDraw, INT32 VisibleYOffset) +{ + UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + INT32 Offset, Data, Tile, Colour, xFlip, yFlip; + INT32 x, y, Priority, xCur, yCur; + INT32 xZoom, yZoom, zx, zy; + INT32 SpriteChunk, MapOffset, Code, j, k, px, py; + + for (Offset = 0x380 - 4; Offset >= 0; Offset -= 4) { + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); + Priority = (Data & 0x8000) >> 15; + + if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); + if (Priority != PriorityDraw) continue; + + xFlip = (Data & 0x4000) >> 14; + yFlip = (Data & 0x2000) >> 13; + x = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); + Tile = Data & 0x7ff; + if (!Tile) continue; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); + yZoom = (Data & 0xfe00) >> 9; + y = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); + Colour = (Data & 0xff00) >> 8; + xZoom = (Data & 0x7f); + + MapOffset = Tile << 7; + + xZoom += 1; + yZoom += 1; + + y += 5; + y += ( 128 - yZoom); + + if (x > 0x140) x -= 0x200; + if (y > 0x140) y -= 0x200; + + for (SpriteChunk = 0; SpriteChunk < 128; SpriteChunk++) { + k = SpriteChunk % 8; + j = SpriteChunk / 8; + + px = xFlip ? (7 - k) : k; + py = yFlip ? (15 - j) : j; + + Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 3)]); + Code &= (TaitoNumSpriteA - 1); + + xCur = x + ((k * xZoom) / 8); + yCur = y + ((j * yZoom) / 16); + + zx = x + (((k + 1) * xZoom) / 8) - xCur; + zy = y + (((j + 1) * yZoom) / 16) - yCur; + + yCur -= VisibleYOffset; + + RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); + } + } +} + +static void SciRenderSprites(INT32 PriorityDraw, INT32 yOffs) +{ + UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + INT32 Offset, StartOffs, Data, Tile, Colour, xFlip, yFlip; + INT32 x, y, Priority, xCur, yCur; + INT32 xZoom, yZoom, zx, zy; + INT32 SpriteChunk, MapOffset, Code, j, k, px, py; + + StartOffs = (SciSpriteFrame & 1) ? 0x800 : 0; + + for (Offset = StartOffs; Offset < StartOffs + 0x800; Offset += 4) { + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); + Priority = (Data & 0x8000) >> 15; + + if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); + if (Priority != PriorityDraw) continue; + + Colour = (Data & 0x7f80) >> 7; + xZoom = (Data & 0x3f); + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); + Tile = Data & 0x1fff; + if (!Tile) continue; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); + yZoom = (Data & 0x7e00) >> 9; + y = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); + yFlip = (Data & 0x8000) >> 15; + xFlip = (Data & 0x4000) >> 14; + x = Data & 0x1ff; + + MapOffset = Tile << 5; + + xZoom += 1; + yZoom += 1; + + y += yOffs; + y += (64 - yZoom); + + if (x > 0x140) x -= 0x200; + if (y > 0x140) y -= 0x200; + + for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { + k = SpriteChunk % 4; + j = SpriteChunk / 4; + + px = xFlip ? (3-k) : k; + py = yFlip ? (7-j) : j; + + Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); + Code &= (TaitoNumSpriteA - 1); + + xCur = x + ((k * xZoom) / 4); + yCur = y + ((j * yZoom) / 8); + + zx = x + (((k + 1) * xZoom) / 4) - xCur; + zy = y + (((j + 1) * yZoom) / 8) - yCur; + + yCur -= 16; + + RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); + } + } +} + +static void SpacegunRenderSprites(INT32 PriorityDraw) +{ + UINT16 *SpriteMap = (UINT16*)TaitoSpriteMapRom; + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; + INT32 Offset, Data, Tile, Colour, xFlip, yFlip; + INT32 x, y, Priority, xCur, yCur; + INT32 xZoom, yZoom, zx, zy; + INT32 SpriteChunk, MapOffset, Code, j, k, px, py; + + for (Offset = 0x300 - 4; Offset >= 0; Offset -= 4) { + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 1]); + Priority = (Data & 0x8000) >> 15; + + if (Priority != 0 && Priority != 1) bprintf(PRINT_NORMAL, _T("Unused Priority %x\n"), Priority); + if (Priority != PriorityDraw) continue; + + xFlip = (Data & 0x4000) >> 14; + x = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 3]); + yFlip = (Data & 0x8000) >> 15; + Tile = Data & 0x1fff; + if (!Tile) continue; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 0]); + yZoom = (Data & 0xfe00) >> 9; + y = Data & 0x1ff; + + Data = BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset + 2]); + Colour = (Data & 0xff00) >> 8; + xZoom = (Data & 0x7f); + + MapOffset = Tile << 5; + + xZoom += 1; + yZoom += 1; + + y += 4; + + if (x > 0x140) x -= 0x200; + if (y > 0x140) y -= 0x200; + + for (SpriteChunk = 0; SpriteChunk < 32; SpriteChunk++) { + k = SpriteChunk % 4; + j = SpriteChunk / 4; + + px = xFlip ? (3 - k) : k; + py = yFlip ? (7 - j) : j; + + Code = BURN_ENDIAN_SWAP_INT16(SpriteMap[MapOffset + px + (py << 2)]); + Code &= (TaitoNumSpriteA - 1); + + xCur = x + ((k * xZoom) / 4); + yCur = y + ((j * yZoom) / 8); + + zx = x + (((k + 1) * xZoom) / 4) - xCur; + zy = y + (((j + 1) * yZoom) / 8) - yCur; + + yCur -= 16; + + RenderSpriteZoom(Code, xCur, yCur, Colour, xFlip, yFlip, zx << 12, zy << 13, TaitoSpritesA); + } + + } +} + +static void AquajackDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + AquajackRenderSprites(1); + + TC0150RODDraw(-1, 0, 2, 1, 1, 2); + + AquajackRenderSprites(0); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TC0110PCRPalette); +} + +static void BsharkDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + TaitoZCalcPalette(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + BsharkRenderSprites(1, 8, 0x800); + + TC0150RODDraw(-1, 0xc0, 0, 1, 1, 2); + + BsharkRenderSprites(0, 8, 0x800); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TaitoPalette); +} + +static void ChasehqDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + ChasehqRenderSprites(1); + + TC0150RODDraw(-1, 0xc0, 0, 0, 1, 2); + + ChasehqRenderSprites(0); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TC0110PCRPalette); +} + +static void ContcircDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + ContcircRenderSprites(1, 24); + + TC0150RODDraw(-3 + 8, TaitoRoadPalBank << 6, 1, 0, 1, 2); + + ContcircRenderSprites(0, 24); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TC0110PCRPalette); +} + +static void EnforceDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + ContcircRenderSprites(1, 24); + + TC0150RODDraw(-3 + 8, 0xc0, 1, 0, 1, 2); + + ContcircRenderSprites(0, 24); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TC0110PCRPalette); +} + +static void DblaxleDraw() +{ + UINT8 Layer[4]; + UINT16 Priority = TC0480SCPGetBgPriority(); + + Layer[0] = (Priority & 0xf000) >> 12; + Layer[1] = (Priority & 0x0f00) >> 8; + Layer[2] = (Priority & 0x00f0) >> 4; + Layer[3] = (Priority & 0x000f) >> 0; + + BurnTransferClear(); + TaitoZCalcPalette(); + + TC0480SCPTilemapRender(Layer[0], 1, TaitoChars); + TC0480SCPTilemapRender(Layer[1], 0, TaitoChars); + TC0480SCPTilemapRender(Layer[2], 0, TaitoChars); + + BsharkRenderSprites(1, 7, 0x2000); + + TC0150RODDraw(-1, 0xc0, 0, 0, 1, 2); + + BsharkRenderSprites(0, 7, 0x2000); + + TC0480SCPTilemapRender(Layer[3], 0, TaitoChars); + + TC0480SCPRenderCharLayer(); + BurnTransferCopy(TaitoPalette); +} + +static void RacingbDraw() +{ + UINT8 Layer[4]; + UINT16 Priority = TC0480SCPGetBgPriority(); + + Layer[0] = (Priority & 0xf000) >> 12; + Layer[1] = (Priority & 0x0f00) >> 8; + Layer[2] = (Priority & 0x00f0) >> 4; + Layer[3] = (Priority & 0x000f) >> 0; + + BurnTransferClear(); + TaitoZCalcPalette(); + + TC0480SCPTilemapRender(Layer[0], 1, TaitoChars); + TC0480SCPTilemapRender(Layer[1], 0, TaitoChars); + SciRenderSprites(1, 7); + TC0480SCPTilemapRender(Layer[2], 0, TaitoChars); + TC0480SCPTilemapRender(Layer[3], 0, TaitoChars); + TC0150RODDraw(-1, 0xc0, 0, 0, 1, 2); + SciRenderSprites(0, 7); + TC0480SCPRenderCharLayer(); + BurnTransferCopy(TaitoPalette); +} + +static void SciDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + TaitoZCalcPalette(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + SciRenderSprites(1, 6); + + TC0150RODDraw(-1, 0xc0, 0, 0, 1, 2); + + SciRenderSprites(0, 6); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + + BurnTransferCopy(TaitoPalette); +} + +static void SpacegunDraw() +{ + INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; + + BurnTransferClear(); + + if (TC0100SCNBottomLayer(0)) { + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoChars); + SpacegunRenderSprites(1); + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoChars); + } else { + if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoChars); + SpacegunRenderSprites(1); + if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); + } + + SpacegunRenderSprites(0); + + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); + BurnTransferCopy(TC0110PCRPalette); + + for (INT32 i = 0; i < nBurnGunNumPlayers; i++) { + BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8); + } +} + +static INT32 TaitoZFrame() +{ + INT32 nInterleave = TaitoFrameInterleave; + + if (TaitoReset) TaitoZDoReset(); + + TaitoMakeInputsFunction(); + + nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = 0; + + SekNewFrame(); + if (TaitoNumZ80s) ZetNewFrame(); + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run 68000 #1 + nCurrentCPU = 0; + SekOpen(0); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == 10 && Sci && ((GetCurrentFrame() & 1) == 0)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO); + if (i == (TaitoFrameInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + + // Run 68000 #2 + if ((TaitoCpuACtrl & 0x01) && TaitoNumZ80s) { + nCurrentCPU = 1; + SekOpen(1); + nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; + nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; + nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + if (i == (TaitoFrameInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + } + + if (TaitoNumZ80s) { + ZetOpen(0); + BurnTimerUpdate(i * (nTaitoCyclesTotal[2] / nInterleave)); + ZetClose(); + } + } + + if (TaitoNumZ80s) { + ZetOpen(0); + BurnTimerEndFrame(nTaitoCyclesTotal[2]); + if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + ZetClose(); + } else { + SekOpen(1); + if (TaitoCpuACtrl & 0x01) BurnTimerEndFrame(nTaitoCyclesTotal[1]); + if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); + if (TaitoCpuACtrl & 0x01) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO); + SekClose(); + } + + if (pBurnDraw) TaitoDrawFunction(); + + return 0; +} + +static INT32 TaitoZScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029674; + } + + if (nAction & ACB_MEMORY_RAM) { + memset(&ba, 0, sizeof(ba)); + ba.Data = TaitoRamStart; + ba.nLen = TaitoRamEnd-TaitoRamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + } + + TaitoICScan(nAction); + + if (nAction & ACB_DRIVER_DATA) { + SekScan(nAction); + if (TaitoNumZ80s) ZetScan(nAction); + + BurnYM2610Scan(nAction, pnMin); + + BurnGunScan(); + + SCAN_VAR(TaitoAnalogPort0); + SCAN_VAR(TaitoAnalogPort1); + SCAN_VAR(TaitoAnalogPort2); + SCAN_VAR(TaitoAnalogPort3); + SCAN_VAR(TaitoInput); + SCAN_VAR(OldSteer); + SCAN_VAR(TaitoCpuACtrl); + SCAN_VAR(TaitoZ80Bank); + SCAN_VAR(SciSpriteFrame); + SCAN_VAR(TaitoRoadPalBank); + SCAN_VAR(nTaitoCyclesDone); + SCAN_VAR(nTaitoCyclesSegment); + } + + if (nAction & ACB_WRITE) { + if (TaitoNumZ80s) { + ZetOpen(0); + ZetMapArea(0x4000, 0x7fff, 0, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetMapArea(0x4000, 0x7fff, 2, TaitoZ80Rom1 + 0x4000 + (TaitoZ80Bank * 0x4000)); + ZetClose(); + } + } + + return 0; +} + +struct BurnDriver BurnDrvAquajack = { + "aquajack", NULL, NULL, NULL, "1990", + "Aquajack (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_MISC, 0, + NULL, AquajackRomInfo, AquajackRomName, NULL, NULL, AquajackInputInfo, AquajackDIPInfo, + AquajackInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvAquajackj = { + "aquajackj", "aquajack", NULL, NULL, "1990", + "Aquajack (Japan)\0", NULL, "Taito Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_MISC, 0, + NULL, AquajackjRomInfo, AquajackjRomName, NULL, NULL, AquajackInputInfo, AquajackjDIPInfo, + AquajackInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvAquajacku = { + "aquajacku", "aquajack", NULL, NULL, "1990", + "Aquajack (US)\0", NULL, "Taito Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_MISC, 0, + NULL, AquajackuRomInfo, AquajackuRomName, NULL, NULL, AquajackInputInfo, AquajackjDIPInfo, + AquajackInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvBshark = { + "bshark", NULL, NULL, NULL, "1989", + "Battle Shark (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, + NULL, BsharkRomInfo, BsharkRomName, NULL, NULL, BsharkInputInfo, BsharkDIPInfo, + BsharkInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvBsharkj = { + "bsharkj", "bshark", NULL, NULL, "1989", + "Battle Shark (Japan)\0", NULL, "Taito Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, + NULL, BsharkjRomInfo, BsharkjRomName, NULL, NULL, BsharkInputInfo, BsharkjDIPInfo, + BsharkInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvBsharkjjs = { + "bsharkjjs", "bshark", NULL, NULL, "1989", + "Battle Shark (Japan, Joystick)\0", NULL, "Taito Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, + NULL, BsharkjjsRomInfo, BsharkjjsRomName, NULL, NULL, BsharkjjsInputInfo, BsharkjjsDIPInfo, + BsharkInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvBsharku = { + "bsharku", "bshark", NULL, NULL, "1989", + "Battle Shark (US)\0", NULL, "Taito America Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, + NULL, BsharkuRomInfo, BsharkuRomName, NULL, NULL, BsharkInputInfo, BsharkuDIPInfo, + BsharkInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvChasehq = { + "chasehq", NULL, NULL, NULL, "1988", + "Chase H.Q. (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, ChasehqRomInfo, ChasehqRomName, NULL, NULL, ChasehqInputInfo, ChasehqDIPInfo, + ChasehqInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvChasehqj = { + "chasehqj", "chasehq", NULL, NULL, "1988", + "Chase H.Q. (Japan)\0", NULL, "Taito Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, ChasehqjRomInfo, ChasehqjRomName, NULL, NULL, ChasehqInputInfo, ChasehqjDIPInfo, + ChasehqInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvChasehqu = { + "chasehqu", "chasehq", NULL, NULL, "1988", + "Chase H.Q. (US)\0", NULL, "Taito America Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, ChasehquRomInfo, ChasehquRomName, NULL, NULL, ChasehqInputInfo, ChasehqDIPInfo, + ChasehqInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvContcirc = { + "contcirc", NULL, NULL, NULL, "1987", + "Continental Circus (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, ContcircRomInfo, ContcircRomName, NULL, NULL, ContcircInputInfo, ContcircDIPInfo, + ContcircInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvContcircu = { + "contcircu", "contcirc", NULL, NULL, "1987", + "Continental Circus (US set 1)\0", NULL, "Taito America Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, ContcircuRomInfo, ContcircuRomName, NULL, NULL, ContcircInputInfo, ContcircuDIPInfo, + ContcircInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvContcircua = { + "contcircua", "contcirc", NULL, NULL, "1987", + "Continental Circus (US set 2)\0", NULL, "Taito America Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, ContcircuaRomInfo, ContcircuaRomName, NULL, NULL, ContcircInputInfo, ContcircuDIPInfo, + ContcircInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvDblaxle = { + "dblaxle", NULL, NULL, NULL, "1991", + "Double Axle (US)\0", NULL, "Taito America Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, DblaxleRomInfo, DblaxleRomName, NULL, NULL, DblaxleInputInfo, DblaxleDIPInfo, + DblaxleInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvPwheelsj = { + "pwheelsj", "dblaxle", NULL, NULL, "1991", + "Power Wheels (Japan)\0", NULL, "Taito Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, PwheelsjRomInfo, PwheelsjRomName, NULL, NULL, DblaxleInputInfo, PwheelsjDIPInfo, + DblaxleInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvEnforce = { + "enforce", NULL, NULL, NULL, "1988", + "Enforce (Japan)\0", NULL, "Taito Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, + NULL, EnforceRomInfo, EnforceRomName, NULL, NULL, EnforceInputInfo, EnforceDIPInfo, + EnforceInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 224, 4, 3 +}; + +struct BurnDriver BurnDrvNightstr = { + "nightstr", NULL, NULL, NULL, "1989", + "Night Striker (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_MISC, 0, + NULL, NightstrRomInfo, NightstrRomName, NULL, NULL, NightstrInputInfo, NightstrDIPInfo, + NightstrInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvNightstrj = { + "nightstrj", "nightstr", NULL, NULL, "1989", + "Night Striker (Japan)\0", NULL, "Taito Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_MISC, 0, + NULL, NightstrjRomInfo, NightstrjRomName, NULL, NULL, NightstrInputInfo, NightstrjDIPInfo, + NightstrInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvNightstru = { + "nightstru", "nightstr", NULL, NULL, "1989", + "Night Striker (US)\0", NULL, "Taito America Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, NightstruRomInfo, NightstruRomName, NULL, NULL, NightstrInputInfo, NightstruDIPInfo, + NightstrInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvRacingb = { + "racingb", NULL, NULL, NULL, "1991", + "Racing Beat (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, RacingbRomInfo, RacingbRomName, NULL, NULL, RacingbInputInfo, RacingbDIPInfo, + RacingbInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSci = { + "sci", NULL, NULL, NULL, "1989", + "Special Criminal Investigation (World set 1)\0", NULL, "Taito Corporation Japan", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, SciRomInfo, SciRomName, NULL, NULL, SciInputInfo, SciDIPInfo, + SciInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvScia = { + "scia", "sci", NULL, NULL, "1989", + "Special Criminal Investigation (World set 2)\0", NULL, "Taito Corporation Japan", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, SciaRomInfo, SciaRomName, NULL, NULL, SciInputInfo, SciDIPInfo, + SciInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvScij = { + "scij", "sci", NULL, NULL, "1989", + "Special Criminal Investigation (Japan)\0", NULL, "Taito Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, ScijRomInfo, ScijRomName, NULL, NULL, SciInputInfo, ScijDIPInfo, + SciInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSciu = { + "sciu", "sci", NULL, NULL, "1989", + "Special Criminal Investigation (US)\0", NULL, "Taito America Corporation", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, SciuRomInfo, SciuRomName, NULL, NULL, SciInputInfo, SciuDIPInfo, + SciInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvScinegro = { + "scinegro", "sci", NULL, NULL, "1989", + "Special Criminal Investigation (Negro bootleg)\0", NULL, "Negro", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_TAITOZ, GBF_RACING, 0, + NULL, ScinegroRomInfo, ScinegroRomName, NULL, NULL, SciInputInfo, SciDIPInfo, + SciInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvSpacegun = { + "spacegun", NULL, NULL, NULL, "1990", + "Space Gun (World)\0", NULL, "Taito Corporation Japan", "Taito-Z", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_TAITOZ, GBF_SHOOT, 0, + NULL, SpacegunRomInfo, SpacegunRomName, NULL, NULL, SpacegunInputInfo, SpacegunDIPInfo, + SpacegunInit, TaitoZExit, TaitoZFrame, NULL, TaitoZScan, + NULL, 0x1000, 320, 240, 4, 3 +}; diff --git a/src/burn/drv/taito/d_tnzs.cpp b/src/burn/drv/taito/d_tnzs.cpp index e51b6b8a9..8b10e60a7 100644 --- a/src/burn/drv/taito/d_tnzs.cpp +++ b/src/burn/drv/taito/d_tnzs.cpp @@ -1,2804 +1,2799 @@ -// FB Alpha The NewZealand Story driver module -// Based on MAME driver by Chris Moore, Brad Oliver, Nicola Salmoria, and many others - -#include "tiles_generic.h" -#include "z80_intf.h" -#include "burn_ym2203.h" -#include "burn_ym2151.h" -#include "tnzs_prot.h" -#include "dac.h" - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *DrvZ80ROM0; -static UINT8 *DrvZ80ROM1; -static UINT8 *DrvZ80ROM2; -static UINT8 *DrvGfxROM; -static UINT8 *DrvColPROM; -static UINT8 *DrvSndROM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvShareRAM; -static UINT8 *DrvScrollRAM; -static UINT8 *DrvVidRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvZ80RAM0; -static UINT8 *DrvZ80RAM1; -static UINT8 *DrvZ80RAM2; -static UINT8 *DrvObjCtrl; - -static UINT32 *DrvPalette; -static UINT8 DrvRecalc; - -static UINT8 *coin_lockout; -static UINT8 *soundlatch; -static UINT8 *tnzs_bg_flag; - -static INT32 kageki_csport_sel; -static double kageki_sample_pos; -static INT32 kageki_sample_select; -static INT16 *kageki_sample_data[0x30]; -static INT32 kageki_sample_size[0x30]; -static double kageki_sample_gain; -static INT32 kageki_sample_output_dir; - -static INT32 cpu1_reset; -static INT32 tnzs_banks[3]; - -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvDips[2]; -static UINT8 DrvInputs[3]; -static UINT8 DrvReset; - -static UINT16 DrvAxis[2]; -static INT32 nAnalogAxis[2] = {0,0}; - -static INT16 *SampleBuffer = NULL; - -#define A(a, b, c, d) { a, b, (UINT8*)(c), d } - -static struct BurnInputInfo CommonInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 1, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Common) - -static struct BurnInputInfo InsectxInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 1, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Insectx) - -static struct BurnInputInfo Arknoid2InputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 6, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - - A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 x-axis" ), - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 4, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy1 + 3, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p2 fire 1" }, - - A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 1, "p2 x-axis" ), - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy2 + 5, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy2 + 7, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Arknoid2) - -static struct BurnInputInfo PlumppopInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 x-axis" ), - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 5, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 1, "p2 x-axis" ), - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 1, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Plumppop) - -static struct BurnInputInfo JpopnicsInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 x-axis" ), - - {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 6, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 1, "p2 x-axis" ), - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, -}; - -STDINPUTINFO(Jpopnics) - -static struct BurnDIPInfo ExtrmatnDIPList[]= -{ - {0x13, 0xff, 0xff, 0xff, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_COINAGE_JAPAN_OLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - {0 , 0xfe, 0 , 4, "Damage Multiplier" }, - {0x14, 0x01, 0xc0, 0xc0, "*1" }, - {0x14, 0x01, 0xc0, 0x80, "*1.5" }, - {0x14, 0x01, 0xc0, 0x40, "*2" }, - {0x14, 0x01, 0xc0, 0x00, "*3" }, -}; - -STDDIPINFO(Extrmatn) - -static struct BurnDIPInfo DrtoppelDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_DEMOSOUNDS_DIPSETTING(0x13) - - TNZS_COINAGE_WORLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "30k 100k 200k 100k+" }, - {0x14, 0x01, 0x0c, 0x00, "50k 100k 200k 200k+" }, - {0x14, 0x01, 0x0c, 0x04, "30k 100k" }, - {0x14, 0x01, 0x0c, 0x08, "30k only" }, - - TNZS_LIVES_DIPSETTING(0x14) -}; - -STDDIPINFO(Drtoppel) - -static struct BurnDIPInfo DrtoppluDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_DEMOSOUNDS_DIPSETTING(0x13) - - TNZS_COINAGE_JAPAN_OLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "30k 100k 200k 100k+" }, - {0x14, 0x01, 0x0c, 0x00, "50k 100k 200k 200k+" }, - {0x14, 0x01, 0x0c, 0x04, "30k 100k" }, - {0x14, 0x01, 0x0c, 0x08, "30k only" }, - - TNZS_LIVES_DIPSETTING(0x14) -}; - -STDDIPINFO(Drtopplu) - -static struct BurnDIPInfo ChukataiDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_DEMOSOUNDS_DIPSETTING(0x13) - - TNZS_COINAGE_WORLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "100k 300k 440k" }, - {0x14, 0x01, 0x0c, 0x00, "100k 300k 500k" }, - {0x14, 0x01, 0x0c, 0x0c, "100k 400k" }, - {0x14, 0x01, 0x0c, 0x04, "100k 500k" }, - - TNZS_LIVES_DIPSETTING(0x14) -}; - -STDDIPINFO(Chukatai) - -static struct BurnDIPInfo ChukatauDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_DEMOSOUNDS_DIPSETTING(0x13) - - TNZS_COINAGE_JAPAN_OLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "100k 300k 440k" }, - {0x14, 0x01, 0x0c, 0x00, "100k 300k 500k" }, - {0x14, 0x01, 0x0c, 0x0c, "100k 400k" }, - {0x14, 0x01, 0x0c, 0x04, "100k 500k" }, - - TNZS_LIVES_DIPSETTING(0x14) -}; - -STDDIPINFO(Chukatau) - -static struct BurnDIPInfo TnzsDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_COINAGE_WORLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x00, "50k 150k 150k+" }, - {0x14, 0x01, 0x0c, 0x0c, "70k 200k 200k+" }, - {0x14, 0x01, 0x0c, 0x04, "100k 250k 250k+" }, - {0x14, 0x01, 0x0c, 0x08, "200k 300k 300k+" }, - - TNZS_LIVES_DIPSETTING(0x14) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x14, 0x40) -}; - -STDDIPINFO(Tnzs) - -static struct BurnDIPInfo TnzsjDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_COINAGE_JAPAN_OLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x00, "50k 150k 150k+" }, - {0x14, 0x01, 0x0c, 0x0c, "70k 200k 200k+" }, - {0x14, 0x01, 0x0c, 0x04, "100k 250k 250k+" }, - {0x14, 0x01, 0x0c, 0x08, "200k 300k 300k+" }, - - TNZS_LIVES_DIPSETTING(0x14) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x14, 0x40) -}; - -STDDIPINFO(Tnzsj) - -static struct BurnDIPInfo TnzsjoDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - {0 , 0xfe, 0 , 4, "Invulnerability (Debug)" }, - {0x14, 0x01, 0x08, 0x08, "Off" }, - {0x14, 0x01, 0x08, 0x00, "On" }, - - TNZS_COINAGE_JAPAN_OLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x00, "50k 150k 150k+" }, - {0x14, 0x01, 0x0c, 0x0c, "70k 200k 200k+" }, - {0x14, 0x01, 0x0c, 0x04, "100k 250k 250k+" }, - {0x14, 0x01, 0x0c, 0x08, "200k 300k 300k+" }, - - TNZS_LIVES_DIPSETTING(0x14) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x14, 0x40) -}; - -STDDIPINFO(Tnzsjo) - -static struct BurnDIPInfo TnzsopDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_COINAGE_WORLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x00, "10k 100k 100k+" }, - {0x14, 0x01, 0x0c, 0x0c, "10k 150k 150k+" }, - {0x14, 0x01, 0x0c, 0x04, "10k 200k 200k+" }, - {0x14, 0x01, 0x0c, 0x08, "10k 300k 300k+" }, - - TNZS_LIVES_DIPSETTING(0x14) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x14, 0x40) -}; - -STDDIPINFO(Tnzsop) - -static struct BurnDIPInfo InsectxDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_DEMOSOUNDS_DIPSETTING(0x13) - - TNZS_COINAGE_WORLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x08, "100k 200k 300k 440k" }, - {0x14, 0x01, 0x0c, 0x0c, "100k 400k" }, - {0x14, 0x01, 0x0c, 0x04, "100k 500k" }, - {0x14, 0x01, 0x0c, 0x00, "150000 Only" }, - - TNZS_LIVES_DIPSETTING(0x14) -}; - -STDDIPINFO(Insectx) - -static struct BurnDIPInfo KagekiDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - // Cabinet type in Japan set only - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_DEMOSOUNDS_DIPSETTING(0x13) - - TNZS_COINAGE_JAPAN_OLD(0x13) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x14, 0x80) -}; - -STDDIPINFO(Kageki) - -static struct BurnDIPInfo Arknoid2DIPList[]= -{ - {0x0b, 0xff, 0xff, 0xfe, NULL }, - {0x0c, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x0b) - - TNZS_DEMOSOUNDS_DIPSETTING(0x0b) - - TNZS_COINAGE_WORLD(0x0b) - - TNZS_DIFFICULTY_DIPSETTING(0x0c) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x0c, 0x01, 0x0c, 0x00, "50k 150k" }, - {0x0c, 0x01, 0x0c, 0x0c, "100k 200k" }, - {0x0c, 0x01, 0x0c, 0x04, "50k Only" }, - {0x0c, 0x01, 0x0c, 0x08, "100k Only" }, - - TNZS_LIVES_DIPSETTING(0x0c) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x0c, 0x80) -}; - -STDDIPINFO(Arknoid2) - -static struct BurnDIPInfo Arknid2uDIPList[]= -{ - {0x0b, 0xff, 0xff, 0xfe, NULL }, - {0x0c, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x0b) - - TNZS_DEMOSOUNDS_DIPSETTING(0x0b) - - TNZS_COINAGE_JAPAN_OLD(0x0b) - - TNZS_DIFFICULTY_DIPSETTING(0x0c) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x0c, 0x01, 0x0c, 0x00, "50k 150k" }, - {0x0c, 0x01, 0x0c, 0x0c, "100k 200k" }, - {0x0c, 0x01, 0x0c, 0x04, "50k Only" }, - {0x0c, 0x01, 0x0c, 0x08, "100k Only" }, - - TNZS_LIVES_DIPSETTING(0x0c) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x0c, 0x80) -}; - -STDDIPINFO(Arknid2u) - -static struct BurnDIPInfo PlumppopDIPList[]= -{ - {0x0d, 0xff, 0xff, 0xff, NULL }, - {0x0e, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x0d) - - TNZS_DEMOSOUNDS_DIPSETTING(0x0d) - - TNZS_COINAGE_JAPAN_OLD(0x0d) - - TNZS_DIFFICULTY_DIPSETTING(0x0e) - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x0e, 0x01, 0x0c, 0x08, "50k 200k 150k+" }, - {0x0e, 0x01, 0x0c, 0x0c, "50k 250k 200k+" }, - {0x0e, 0x01, 0x0c, 0x04, "100k 300k 200k+" }, - {0x0e, 0x01, 0x0c, 0x00, "100k 400k 300k+" }, - - TNZS_LIVES_DIPSETTING(0x0e) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x0c, 0x80) -}; - -STDDIPINFO(Plumppop) - -static struct BurnDIPInfo JpopnicsDIPList[]= -{ - {0x0b, 0xff, 0xff, 0xff, NULL }, - {0x0c, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x0b) - - TNZS_DEMOSOUNDS_DIPSETTING(0x0b) - - TNZS_DIFFICULTY_DIPSETTING(0x0c) - - {0 , 0xfe, 0 , 0, "Bonus Life" }, - {0x0c, 0x01, 0x0c, 0x08, "50k 200k 150k+" }, - {0x0c, 0x01, 0x0c, 0x0c, "50k 250k 200k+" }, - {0x0c, 0x01, 0x0c, 0x04, "100k 300k 200k+" }, - {0x0c, 0x01, 0x0c, 0x00, "100k 400k 300k+" }, - - TNZS_LIVES_DIPSETTING(0x0c) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x0c, 0x80) -}; - -STDDIPINFO(Jpopnics) - -static struct BurnDIPInfo KabukizDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_DEMOSOUNDS_DIPSETTING(0x13) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x13, 0x80) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - TNZS_COINAGE_WORLD(0x14) -}; - -STDDIPINFO(Kabukiz) - -static struct BurnDIPInfo KabukizjDIPList[]= -{ - {0x13, 0xff, 0xff, 0xfe, NULL }, - {0x14, 0xff, 0xff, 0xff, NULL }, - - TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) - - TNZS_DEMOSOUNDS_DIPSETTING(0x13) - - TNZS_ALLOWCONTINUE_DIPSETTING(0x13, 0x80) - - TNZS_DIFFICULTY_DIPSETTING(0x14) - - TNZS_COINAGE_JAPAN_OLD(0x14) -}; - -STDDIPINFO(Kabukizj) - -void __fastcall bankswitch0(UINT8 data) -{ - // CPU #0 expects CPU #1 to be stopped while reset line is triggered. - if ((~data & 0x10) != cpu1_reset) { - INT32 cycles = ZetTotalCycles(); - ZetClose(); - ZetOpen(1); - cycles -= ZetTotalCycles(); - ZetIdle(cycles); - if (~data & 0x10) ZetReset(); - ZetClose(); - ZetOpen(0); - } - - cpu1_reset = ~data & 0x10; - - tnzs_banks[0] = data; - - INT32 bank = (data & 7) * 0x4000; - - // Low banks are RAM regions high ones are ROM. - if ((data & 6) == 0) { - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80RAM0 + bank); - ZetMapArea(0x8000, 0xbfff, 1, DrvZ80RAM0 + bank); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80RAM0 + bank); - } else { - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + 0x10000 + bank); - ZetMapArea(0x8000, 0xbfff, 1, DrvZ80ROM0 + 0x10000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + 0x10000 + bank); - } -} - -void __fastcall bankswitch1(UINT8 data) -{ - tnzs_banks[1] = data & ~0x04; - - if (data & 0x04) { - tnzs_mcu_reset(); - } - - *coin_lockout = ~data & 0x30; - - ZetMapArea(0x8000, 0x9fff, 0, DrvZ80ROM1 + 0x08000 + 0x2000 * (data & 3)); - ZetMapArea(0x8000, 0x9fff, 2, DrvZ80ROM1 + 0x08000 + 0x2000 * (data & 3)); -} - -void __fastcall tnzs_cpu0_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xf400: - *tnzs_bg_flag = data; - break; - - case 0xf600: - bankswitch0(data); - break; - } - - if ((address & 0xff00) == 0xf300) { - DrvObjCtrl[address & 3] = data; - return; - } -} - -UINT8 __fastcall tnzs_cpu0_read(UINT16 address) -{ - // This is a hack to keep tnzs & clones from freezing. The sub cpu - // writes back 0xff to shared ram as an acknowledge and the main - // cpu doesn't expect it so soon. This can be fixed by an extremely - // high sync, but this hack is much less costly. - if ((address & 0xf000) == 0xe000) { - if (address == 0xef10 && DrvShareRAM[0x0f10] == 0xff) { - return 0; - } - return DrvShareRAM[address & 0xfff]; - } - - return 0; -} - -void __fastcall tnzsb_cpu1_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xa000: - bankswitch1(data); - break; - - case 0xb004: - *soundlatch = data; - ZetClose(); - ZetOpen(2); - ZetSetVector(0xff); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - ZetClose(); - ZetOpen(1); - break; - } -} - -UINT8 __fastcall tnzsb_cpu1_read(UINT16 address) -{ - switch (address) - { - case 0xb002: - return DrvDips[0]; - - case 0xb003: - return DrvDips[1]; - - case 0xc000: - case 0xc001: - return DrvInputs[address & 1]; - - case 0xc002: - return DrvInputs[2] | *coin_lockout; - } - - if (address >= 0xf000 && address <= 0xf003) { - return DrvPalRAM[address & 0x0003]; - } - - return 0; -} - -void __fastcall tnzs_cpu1_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xa000: - bankswitch1(data); - break; - - case 0xb000: - if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { - BurnYM2151SelectRegister(data); - } else { - BurnYM2203Write(0, 0, data); - } - break; - - case 0xb001: - if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { - BurnYM2151WriteRegister(data); - } else { - BurnYM2203Write(0, 1, data); - } - break; - - case 0xc000: - case 0xc001: - tnzs_mcu_write(address, data); - break; - } -} - -UINT8 __fastcall tnzs_cpu1_read(UINT16 address) -{ - switch (address) - { - case 0xb000: - if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) - return 0; - return BurnYM2203Read(0, 0); - - case 0xb001: - if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) - return BurnYM2151ReadStatus(); - return BurnYM2203Read(0, 1); - - case 0xc000: - case 0xc001: - return tnzs_mcu_read(address); - - case 0xc002: - return DrvInputs[2]; - - case 0xc600: - return DrvDips[0]; - - case 0xc601: - return DrvDips[1]; - - case 0xf000: - return (~nAnalogAxis[0] >> 12) & 0xff; - - case 0xf001: - return (~nAnalogAxis[0] >> 20) & 0x0f; - - case 0xf002: - return (~nAnalogAxis[1] >> 12) & 0xff; - - case 0xf003: - return (~nAnalogAxis[1] >> 20) & 0x0f; - } - - return 0; -} - -void __fastcall tnzs_cpu2_out(UINT16 port, UINT8 data) -{ - switch (port & 0xff) - { - case 0x00: - BurnYM2203Write(0, 0, data); - break; - - case 0x01: - BurnYM2203Write(0, 1, data); - break; - } -} - -UINT8 __fastcall tnzs_cpu2_in(UINT16 port) -{ - switch (port & 0xff) - { - case 0x00: - return BurnYM2203Read(0, 0); - - case 0x02: - ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - return *soundlatch; - } - - return 0; -} - -static void kabukiz_sound_bankswitch(UINT32, UINT32 data) -{ - if (data != 0xff) { - tnzs_banks[2] = data; - - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM2 + 0x0000 + 0x4000 * (data & 0x07)); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM2 + 0x0000 + 0x4000 * (data & 0x07)); - } -} - -static void kabukiz_dac_write(UINT32, UINT32 data) -{ - if (data != 0xff) { - DACWrite(0, data); - } -} - -static UINT8 tnzs_ym2203_portA(UINT32 ) -{ - return DrvDips[0]; -} - -static UINT8 tnzs_ym2203_portB(UINT32 ) -{ - return DrvDips[1]; -} - -static UINT8 kageki_ym2203_portA(UINT32) -{ - INT32 dsw1 = DrvDips[0]; - INT32 dsw2 = DrvDips[1]; - UINT8 dsw = 0x0f; - - switch (kageki_csport_sel & 3) - { - case 0x00: - dsw = (((dsw2 & 0x10) >> 1) | ((dsw2 & 0x01) << 2) | ((dsw1 & 0x10) >> 3) | ((dsw1 & 0x01) >> 0)); - break; - - case 0x01: - dsw = (((dsw2 & 0x40) >> 3) | ((dsw2 & 0x04) >> 0) | ((dsw1 & 0x40) >> 5) | ((dsw1 & 0x04) >> 2)); - break; - - case 0x02: - dsw = (((dsw2 & 0x20) >> 2) | ((dsw2 & 0x02) << 1) | ((dsw1 & 0x20) >> 4) | ((dsw1 & 0x02) >> 1)); - break; - - case 0x03: - dsw = (((dsw2 & 0x80) >> 4) | ((dsw2 & 0x08) >> 1) | ((dsw1 & 0x80) >> 6) | ((dsw1 & 0x08) >> 3)); - break; - } - - return dsw; -} - -static void kageki_ym2203_write_portB(UINT32, UINT32 data) -{ - if (data > 0x3f) { - kageki_csport_sel = data; - } else { - if (data > 0x2f) { - kageki_sample_select = -1; - } else { - kageki_sample_select = data; - kageki_sample_pos = 0; - } - } -} - -inline static void DrvYM2203IRQHandler(INT32, INT32 nStatus) -{ - Z80SetIrqLine(Z80_INPUT_LINE_NMI, nStatus & 1); -} - -inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 6000000; -} - -inline static double DrvGetTime() -{ - return (double)ZetTotalCycles() / 6000000; -} - -static INT32 kabukizSyncDAC() -{ - return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (6000000.000 / (nBurnFPS / 100.000)))); -} - -static INT32 DrvDoReset() -{ - memset (AllRam, 0, RamEnd - AllRam); - memcpy (DrvPalRAM, DrvColPROM, 0x400); - - cpu1_reset = 0; - - for (INT32 i = 0; i < 3; i++) { - ZetOpen(i); - ZetReset(); - if (i == 0) bankswitch0(0x12); - if (i == 1) bankswitch1(0); - if (i == 2) kabukiz_sound_bankswitch(0, 0); - ZetClose(); - } - - tnzs_mcu_reset(); - - if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { - BurnYM2151Reset(); - } else { - BurnYM2203Reset(); - } - - DACReset(); - - kageki_sample_pos = 0; - kageki_sample_select = -1; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - DrvZ80ROM0 = Next; Next += 0x040000; - DrvZ80ROM1 = Next; Next += 0x020000; - DrvZ80ROM2 = Next; Next += 0x020000; - - DrvGfxROM = Next; Next += 0x400000; - - DrvColPROM = Next; Next += 0x000400; - - DrvSndROM = Next; Next += 0x010000; - - DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); - - SampleBuffer = (INT16*)Next; Next += nBurnSoundLen * 2 * sizeof(INT16); - - AllRam = Next; - - DrvObjCtrl = Next; Next += 0x000004; - - DrvPalRAM = Next; Next += 0x000400; - DrvSprRAM = Next; Next += 0x002000; - DrvShareRAM = Next; Next += 0x001000; - DrvScrollRAM = Next; Next += 0x000100; - DrvVidRAM = Next; Next += 0x000200; - - DrvZ80RAM0 = Next; Next += 0x008000; - DrvZ80RAM1 = Next; Next += 0x001000; - DrvZ80RAM2 = Next; Next += 0x002000; - - coin_lockout = Next; Next += 0x000001; - soundlatch = Next; Next += 0x000001; - tnzs_bg_flag = Next; Next += 0x000001; - - RamEnd = Next; - - MemEnd = Next; - - return 0; -} - -static void kageki_sample_init() -{ - UINT8 *src = DrvSndROM + 0x0090; - - for (INT32 i = 0; i < 0x2f; i++) - { - INT32 start = (src[(i * 2) + 1] << 8) + src[(i * 2)]; - UINT8 *scan = &src[start]; - INT32 size = 0; - - while (1) { - if (*scan++ == 0x00) { - break; - } else { - size++; - } - } - - kageki_sample_data[i] = (INT16*)BurnMalloc(size * sizeof(INT16)); - kageki_sample_size[i] = size; - - if (start < 0x100) start = size = 0; - - INT16 *dest = kageki_sample_data[i]; - scan = &src[start]; - for (INT32 n = 0; n < size; n++) - { - *dest++ = ((*scan++) ^ 0x80) << 8; - } - } - - kageki_sample_gain = 1.00; - kageki_sample_output_dir = BURN_SND_ROUTE_BOTH; -} - -void kageki_sample_set_route(double nVolume, INT32 nRouteDir) -{ - kageki_sample_gain = nVolume; - kageki_sample_output_dir = nRouteDir; -} - -static void kageki_sample_exit() -{ - for (INT32 i = 0; i < 0x30; i++) { - BurnFree (kageki_sample_data[i]); - } -} - -static INT32 tnzs_gfx_decode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x200000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM, 0x200000); - - static INT32 Plane[4] = { 0xc00000, 0x800000, 0x400000, 0x000000 }; - static INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; - static INT32 YOffs[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; - - GfxDecode(0x4000, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM); - - // the drawing routines allow for 0x4000 tiles, but some (most) games - // only have 0x2000. Mirroring the second half is cheaper and easier than - // masking the tile code. - if (memcmp (DrvGfxROM + 0x200000, DrvGfxROM + 0x300000, 0x100000) == 0) { - memcpy (DrvGfxROM + 0x200000, DrvGfxROM + 0x000000, 0x200000); - } - - BurnFree (tmp); - - return 0; -} - -static INT32 insectx_gfx_decode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); - if (tmp == NULL) { - return 1; - } - - memcpy (tmp, DrvGfxROM, 0x100000); - - static INT32 Plane[4] = { 0x000008, 0x000000, 0x400008, 0x400000 }; - static INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; - static INT32 YOffs[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 256, 272, 288, 304, 320, 336, 352, 368 }; - - GfxDecode(0x2000, 4, 16, 16, Plane, XOffs, YOffs, 0x200, tmp, DrvGfxROM); - - memcpy (DrvGfxROM + 0x200000, DrvGfxROM + 0x000000, 0x200000); - - BurnFree (tmp); - - return 0; -} - -static INT32 Type1Init(INT32 mcutype) -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - switch (mcutype) - { - case MCU_CHUKATAI: - { - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; - memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); - if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x020000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x080000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x0a0000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x100000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x120000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x180000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x1a0000, 11, 1)) return 1; - - if (tnzs_gfx_decode()) return 1; - } - break; - - case MCU_TNZS: - { - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; - memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x020000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x080000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x0a0000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x100000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x120000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x180000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x1a0000, 10, 1)) return 1; - - if (tnzs_gfx_decode()) return 1; - } - break; - - case MCU_DRTOPPEL: - { - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; - memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); - if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x020000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x080000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x0a0000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x100000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x120000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x180000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x1a0000, 11, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00001, 12, 2)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00000, 13, 2)) return 1; - - if (tnzs_gfx_decode()) return 1; - } - break; - - case MCU_EXTRMATN: - { - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; - memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); - if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x080000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x100000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x180000, 7, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00001, 8, 2)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00000, 9, 2)) return 1; - - if (tnzs_gfx_decode()) return 1; - } - break; - - case MCU_NONE_INSECTX: - { - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; - memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x000000, 2, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x080000, 3, 1)) return 1; - - insectx_gfx_decode(); - } - break; - - case MCU_ARKANOID: - { - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; - memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x080000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x100000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x180000, 6, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00001, 7, 2)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00000, 8, 2)) return 1; - - if (tnzs_gfx_decode()) return 1; - } - break; - - case MCU_PLUMPOP: - { - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; - memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); - if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x000000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x010000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x020000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x030000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x080000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x090000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x0a0000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x0b0000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x100000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x110000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x120000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x130000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x180000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x190000, 10, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x1a0000, 11, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x1b0000, 11, 1)) return 1; - - if (BurnLoadRom(DrvColPROM + 0x00001, 12, 2)) return 1; - if (BurnLoadRom(DrvColPROM + 0x00000, 13, 2)) return 1; - - if (tnzs_gfx_decode()) return 1; - } - break; - - case MCU_NONE_KAGEKI: - { - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; - memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); - if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x020000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x080000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x0a0000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x100000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x120000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x180000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x1a0000, 10, 1)) return 1; - - if (BurnLoadRom(DrvSndROM + 0x000000, 11, 1)) return 1; - - if (tnzs_gfx_decode()) return 1; - - kageki_sample_init(); - } - break; - - case MCU_NONE_JPOPNICS: - { - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; - memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 1, 1)) return 1; - - if (BurnLoadRom(DrvGfxROM + 0x000000, 2, 1)) return 1; - memcpy (DrvGfxROM + 0x020000, DrvGfxROM + 0x010000, 0x010000); - if (BurnLoadRom(DrvGfxROM + 0x080000, 3, 1)) return 1; - memcpy (DrvGfxROM + 0x0a0000, DrvGfxROM + 0x090000, 0x010000); - if (BurnLoadRom(DrvGfxROM + 0x100000, 4, 1)) return 1; - memcpy (DrvGfxROM + 0x120000, DrvGfxROM + 0x110000, 0x010000); - if (BurnLoadRom(DrvGfxROM + 0x180000, 5, 1)) return 1; - memcpy (DrvGfxROM + 0x1a0000, DrvGfxROM + 0x190000, 0x010000); - - if (tnzs_gfx_decode()) return 1; - } - break; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + 0x18000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + 0x18000); - ZetMapArea(0xc000, 0xdfff, 0, DrvSprRAM); - ZetMapArea(0xc000, 0xdfff, 1, DrvSprRAM); - ZetMapArea(0xe000, 0xeeff, 0, DrvShareRAM); - if (mcutype != MCU_TNZS) { - ZetMapArea(0xef00, 0xefff, 0, DrvShareRAM + 0x0f00); - } - ZetMapArea(0xe000, 0xefff, 1, DrvShareRAM); - ZetMapArea(0xe000, 0xefff, 2, DrvShareRAM); - ZetMapArea(0xf000, 0xf1ff, 0, DrvVidRAM); - ZetMapArea(0xf000, 0xf1ff, 1, DrvVidRAM); - ZetMapArea(0xf200, 0xf2ff, 1, DrvScrollRAM); - if (mcutype != MCU_DRTOPPEL) { - ZetMapArea(0xf800, 0xfbff, 0, DrvPalRAM); - ZetMapArea(0xf800, 0xfbff, 1, DrvPalRAM); - } - ZetSetWriteHandler(tnzs_cpu0_write); - ZetSetReadHandler(tnzs_cpu0_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x9fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x9fff, 2, DrvZ80ROM1); - ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM1); - ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM1); - ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM1); - ZetMapArea(0xe000, 0xefff, 0, DrvShareRAM); - ZetMapArea(0xe000, 0xefff, 1, DrvShareRAM); - ZetMapArea(0xe000, 0xefff, 2, DrvShareRAM); - ZetSetWriteHandler(tnzs_cpu1_write); - ZetSetReadHandler(tnzs_cpu1_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(2); // For common reset routine - - tnzs_mcu_init(mcutype); - - if (mcutype == MCU_NONE_JPOPNICS) { - BurnYM2151Init(3000000); // jpopnics - BurnYM2151SetAllRoutes(0.30, BURN_SND_ROUTE_BOTH); - } else { - BurnYM2203Init(1, 3000000, NULL, DrvSynchroniseStream, DrvGetTime, 0); - BurnYM2203SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); - - if (mcutype == MCU_NONE_KAGEKI) { - BurnYM2203SetPorts(0, &kageki_ym2203_portA, NULL, NULL, &kageki_ym2203_write_portB); - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.35, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); - } else { - BurnYM2203SetPorts(0, &tnzs_ym2203_portA, &tnzs_ym2203_portB, NULL, NULL); - } - } - - DACInit(0, 0, 1, kabukizSyncDAC); // kabukiz - DACSetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 Type2Init() -{ - AllMem = NULL; - MemIndex(); - INT32 nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; - memset(AllMem, 0, nLen); - MemIndex(); - - { - if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; - memcpy (DrvZ80ROM0, DrvZ80ROM0 + 0x10000, 0x08000); - - if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 1, 1)) return 1; - - if (BurnLoadRom(DrvZ80ROM2 + 0x00000, 2, 1)) return 1; - - if (strncmp(BurnDrvGetTextA(DRV_NAME), "kabukiz", 7) == 0) { - if (BurnLoadRom(DrvGfxROM + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x080000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x100000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x180000, 6, 1)) return 1; - } else { - if (BurnLoadRom(DrvGfxROM + 0x000000, 3, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x020000, 4, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x080000, 5, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x0a0000, 6, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x100000, 7, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x120000, 8, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x180000, 9, 1)) return 1; - if (BurnLoadRom(DrvGfxROM + 0x1a0000, 10, 1)) return 1; - } - - if (tnzs_gfx_decode()) return 1; - } - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); - ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + 0x18000); - ZetMapArea(0x8000, 0xbfff, 1, DrvZ80ROM0 + 0x18000); - ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + 0x18000); - ZetMapArea(0xc000, 0xdfff, 0, DrvSprRAM); - ZetMapArea(0xc000, 0xdfff, 1, DrvSprRAM); - ZetMapArea(0xc000, 0xdfff, 2, DrvSprRAM); - ZetMapArea(0xe000, 0xeeff, 0, DrvShareRAM); - if (strncmp(BurnDrvGetTextA(DRV_NAME), "kabukiz", 7) == 0) { - ZetMapArea(0xef00, 0xefff, 0, DrvShareRAM + 0x0f00); - } - ZetMapArea(0xe000, 0xefff, 1, DrvShareRAM); - ZetMapArea(0xe000, 0xefff, 2, DrvShareRAM); - ZetMapArea(0xf000, 0xf1ff, 0, DrvVidRAM); - ZetMapArea(0xf000, 0xf1ff, 1, DrvVidRAM); - ZetMapArea(0xf000, 0xf1ff, 2, DrvVidRAM); - ZetMapArea(0xf200, 0xf2ff, 0, DrvScrollRAM); - ZetMapArea(0xf200, 0xf2ff, 1, DrvScrollRAM); - ZetSetWriteHandler(tnzs_cpu0_write); - ZetSetReadHandler(tnzs_cpu0_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(1); - ZetOpen(1); - ZetMapArea(0x0000, 0x9fff, 0, DrvZ80ROM1); - ZetMapArea(0x0000, 0x9fff, 2, DrvZ80ROM1); - ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM1); - ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM1); - ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM1); - ZetMapArea(0xe000, 0xefff, 0, DrvShareRAM); - ZetMapArea(0xe000, 0xefff, 1, DrvShareRAM); - ZetMapArea(0xe000, 0xefff, 2, DrvShareRAM); - ZetMapArea(0xf000, 0xf3ff, 1, DrvPalRAM); // tnzsb - ZetMapArea(0xf800, 0xfbff, 1, DrvPalRAM); // kabukiz - ZetSetWriteHandler(tnzsb_cpu1_write); - ZetSetReadHandler(tnzsb_cpu1_read); - ZetMemEnd(); - ZetClose(); - - ZetInit(2); - ZetOpen(2); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM2 + 0x0000); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM2 + 0x0000); - ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM2); // tnzsb - ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM2); - ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM2); - ZetMapArea(0xe000, 0xffff, 0, DrvZ80RAM2); // kabukiz - ZetMapArea(0xe000, 0xffff, 1, DrvZ80RAM2); - ZetMapArea(0xe000, 0xffff, 2, DrvZ80RAM2); - ZetSetOutHandler(tnzs_cpu2_out); - ZetSetInHandler(tnzs_cpu2_in); - ZetMemEnd(); - ZetClose(); - - BurnYM2203Init(1, 3000000, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); - BurnYM2203SetPorts(0, NULL, NULL, &kabukiz_sound_bankswitch, &kabukiz_dac_write); - BurnTimerAttachZet(6000000); - BurnYM2203SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); - - if (strncmp(BurnDrvGetTextA(DRV_NAME), "kabukiz", 7) == 0 || strncmp(BurnDrvGetTextA(DRV_NAME), "tnzsb", 5) == 0) { - BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 2.00, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); - BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 1.00, BURN_SND_ROUTE_BOTH); - } - - DACInit(0, 0, 1, kabukizSyncDAC); // kabukiz - - GenericTilesInit(); - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - GenericTilesExit(); - - ZetExit(); - - if (tnzs_mcu_type() != MCU_NONE_JPOPNICS) BurnYM2203Exit(); - if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) BurnYM2151Exit(); - DACExit(); - - BurnFree (AllMem); - - if (tnzs_mcu_type() == MCU_NONE_KAGEKI) { - kageki_sample_exit(); - } - - tnzs_mcu_init(0); - - return 0; -} - -// Stolen from TMNT. Thanks to Barry. :) -static void kageki_sample_render(INT16 *pSoundBuf, INT32 nLength) -{ - memset(pSoundBuf, 0, nLength * sizeof(INT16) * 2); - if (kageki_sample_select == -1) return; - - double Addr = kageki_sample_pos; - double Step = (double)7000 / nBurnSoundRate; - - double size = kageki_sample_size[kageki_sample_select]; - INT16 *ptr = kageki_sample_data[kageki_sample_select]; - - for (INT32 i = 0; i < nLength; i += 2) { - if (Addr >= size) break; - INT16 Sample = ptr[(INT32)Addr]; - -// pSoundBuf[i ] = Sample; -// pSoundBuf[i + 1] = Sample; - INT16 nLeftSample = 0, nRightSample = 0; - - if ((kageki_sample_output_dir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { - nLeftSample += (INT32)(Sample * kageki_sample_gain); - } - if ((kageki_sample_output_dir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { - nRightSample += (INT32)(Sample * kageki_sample_gain); - } - - pSoundBuf[i + 0] += nLeftSample; - pSoundBuf[i + 1] += nRightSample; - - Addr += Step; - } - - kageki_sample_pos = Addr; - if (Addr >= size) kageki_sample_select = -1; -} - -static void draw_16x16(INT32 sx, INT32 sy, INT32 code, INT32 color, INT32 flipx, INT32 flipy, INT32 transp) -{ - if (transp) { - if (flipy) { - if (flipx) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM); - } else { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM); - } - } else { - if (flipx) { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM); - } - } - } else { - if (flipy) { - if (flipx) { - Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM); - } else { - Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM); - } - } else { - if (flipx) { - Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM); - } else { - Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM); - } - } - } -} - -static void draw_background(INT32 ctrl, INT32 flipscreen) -{ - INT32 scrollx, scrolly; - UINT8 *m = DrvSprRAM + 0x400; - - if ((ctrl ^ (ctrl << 1)) & 0x40) - { - m += 0x800; - } - - INT32 transpen = (*tnzs_bg_flag & 0x80) ^ 0x80; - - INT32 tot = DrvObjCtrl[1] & 0x1f; - if (tot == 1) tot = 16; - - UINT32 upperbits = DrvObjCtrl[2] | (DrvObjCtrl[3] << 8); - - for (INT32 column = 0; column < tot; column++) - { - scrollx = DrvScrollRAM[(column << 4) | 4] - ((upperbits & 0x01) << 8); - if (flipscreen) - scrolly = DrvScrollRAM[column << 4] + 1 - 256; - else - scrolly = -DrvScrollRAM[column << 4] + 1; - - for (INT32 y = 0; y < 16; y++) - { - for (INT32 x = 0; x < 2; x++) - { - INT32 i = ((column ^ 8) << 5) | (y << 1) | x; - - INT32 code = m[i + 0x0000] | ((m[i + 0x1000] & 0x3f) << 8); - INT32 color = m[i + 0x1200] >> 3; - INT32 flipx = m[i + 0x1000] & 0x80; - INT32 flipy = m[i + 0x1000] & 0x40; - INT32 sx = x << 4; - INT32 sy = y << 4; - if (flipscreen) - { - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - sy = (sy + scrolly) & 0xff; - sx += scrollx; - - if (sx >= nScreenWidth || sx < -15 || sy >= nScreenHeight + 16 || sy < 1) continue; - - draw_16x16(sx, sy - 16, code, color, flipx, flipy, transpen); - } - } - - upperbits >>= 1; - } -} - -static void draw_foreground(INT32 ctrl, INT32 flipscreen) -{ - UINT8 *char_pointer = DrvSprRAM + 0x0000; - UINT8 *x_pointer = DrvSprRAM + 0x0200; - UINT8 *y_pointer = DrvVidRAM + 0x0000; - UINT8 *ctrl_pointer = DrvSprRAM + 0x1000; - UINT8 *color_pointer = DrvSprRAM + 0x1200; - - if ((ctrl ^ (ctrl << 1)) & 0x40) - { - char_pointer += 0x800; - x_pointer += 0x800; - ctrl_pointer += 0x800; - color_pointer += 0x800; - } - - for (INT32 i = 0x1ff; i >= 0; i--) - { - INT32 code = char_pointer[i] + ((ctrl_pointer[i] & 0x3f) << 8); - INT32 color = (color_pointer[i] & 0xf8) >> 3; - INT32 sx = x_pointer[i] - ((color_pointer[i] & 1) << 8); - INT32 sy = 240 - y_pointer[i]; - INT32 flipx = ctrl_pointer[i] & 0x80; - INT32 flipy = ctrl_pointer[i] & 0x40; - if (flipscreen) - { - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - if ((sy == 0) && (code == 0)) sy += 240; - } - - if (sx >= nScreenWidth || sx < -15) continue; - - draw_16x16(sx, sy - 14, code, color, flipx, flipy, 1); - } -} - -static inline void DrvRecalcPalette() -{ - UINT8 r,g,b; - if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { - for (INT32 i = 0; i < 0x400; i+=2) { - UINT16 pal = (DrvPalRAM[i] << 8) | DrvPalRAM[i | 1]; - - r = (pal >> 4) & 0x0f; - g = (pal >> 12) & 0x0f; - b = (pal >> 8) & 0x0f; - - r |= r << 4; - g |= g << 4; - b |= b << 4; - - DrvPalette[i / 2] = BurnHighCol(r, g, b, 0); - } - } else { - for (INT32 i = 0; i < 0x400; i+=2) { - UINT16 pal = (DrvPalRAM[i | 1] << 8) | DrvPalRAM[i]; - - r = (pal >> 10) & 0x1f; - g = (pal >> 5) & 0x1f; - b = (pal >> 0) & 0x1f; - - r = (r << 3) | (r >> 2); - g = (g << 3) | (g >> 2); - b = (b << 3) | (b >> 2); - - DrvPalette[i / 2] = BurnHighCol(r, g, b, 0); - } - } -} - -static void sprite_buffer(INT32 ctrl) -{ - if (ctrl & 0x20) - { - if (ctrl & 0x40) { - memcpy (DrvSprRAM + 0x0000, DrvSprRAM + 0x0800, 0x0400); - memcpy (DrvSprRAM + 0x1000, DrvSprRAM + 0x1800, 0x0400); - } else { - memcpy (DrvSprRAM + 0x0800, DrvSprRAM + 0x0000, 0x0400); - memcpy (DrvSprRAM + 0x1800, DrvSprRAM + 0x1000, 0x0400); - } - - memcpy (DrvSprRAM + 0x0400, DrvSprRAM + 0x0c00, 0x0400); - memcpy (DrvSprRAM + 0x1400, DrvSprRAM + 0x1c00, 0x0400); - } -} - -static INT32 DrvDraw() -{ - DrvRecalcPalette(); - - INT32 flip = DrvObjCtrl[0] & 0x40; - INT32 ctrl = (DrvObjCtrl[1] & 0x60) ^ 0x20; - - for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { - pTransDraw[i] = 0x1f0; - } - - draw_background(ctrl, flip); - draw_foreground(ctrl, flip); - - BurnTransferCopy(DrvPalette); - - sprite_buffer(ctrl); - - return 0; -} - -static void assemble_inputs() -{ - tnzs_mcu_inputs = DrvInputs; - memset (DrvInputs, 0xff, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] ^= DrvJoy1[i] << i; - DrvInputs[1] ^= DrvJoy2[i] << i; - DrvInputs[2] ^= DrvJoy3[i] << i; - } - - nAnalogAxis[0] -= DrvAxis[0] << 7; - nAnalogAxis[1] -= DrvAxis[1] << 7; -} - -static INT32 DrvFrame() -{ - if (DrvReset) { - DrvDoReset(); - } - - ZetNewFrame(); - - assemble_inputs(); - - INT32 nInterleave = 100; - if (tnzs_mcu_type() == MCU_NONE_KAGEKI) nInterleave = nBurnSoundLen; - INT32 nSoundBufferPos = 0; - - INT32 nCyclesSegment; - INT32 nCyclesDone[3], nCyclesTotal[3]; - - nCyclesTotal[0] = 6000000 / 60; - nCyclesTotal[1] = 6000000 / 60; - nCyclesTotal[2] = 6000000 / 60; - - nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; - - INT32 irq_trigger[2] = { nInterleave - 2, nInterleave - 1 }; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - - // Run Z80 #0 - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - if (i == irq_trigger[0]) { - tnzs_mcu_interrupt(); - ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - } - if (i == irq_trigger[1]) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - // Run Z80 #1 - nCurrentCPU = 1; - ZetOpen(nCurrentCPU); - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (cpu1_reset == 0) { - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += nCyclesSegment; - } - if (i == irq_trigger[0]) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); - if (i == irq_trigger[1]) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); - ZetClose(); - - // Run Z80 #2 - if (tnzs_mcu_type() == MCU_NONE) - { - nCurrentCPU = 2; - ZetOpen(nCurrentCPU); - BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); - ZetClose(); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - INT16* pSoundBuf2 = SampleBuffer + (nSoundBufferPos << 1); - ZetOpen(2); - if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - kageki_sample_render(pSoundBuf2, nSegmentLength); - ZetClose(); - nSoundBufferPos += nSegmentLength; - } - } - - ZetOpen(2); - if (tnzs_mcu_type() == MCU_NONE) { - BurnTimerEndFrame(nCyclesTotal[2]); - } - - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - INT16* pSoundBuf2 = SampleBuffer + (nSoundBufferPos << 1); - if (nSegmentLength) { - if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - } - kageki_sample_render(pSoundBuf2, nSegmentLength); - } - } - - if (tnzs_mcu_type() != MCU_NONE_JPOPNICS) { - if (pBurnSoundOut) { - BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); - DACUpdate(pBurnSoundOut, nBurnSoundLen); - for (INT32 i = 0; i < nBurnSoundLen; i++) { - pBurnSoundOut[(i << 1) + 0] += SampleBuffer[(i << 1) + 0]; - pBurnSoundOut[(i << 1) + 1] += SampleBuffer[(i << 1) + 1]; - } - } - } - - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); - } - - return 0; -} - -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { - *pnMin = 0x029707; - } - - if (nAction & ACB_VOLATILE) { - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); - - BurnYM2203Scan(nAction, pnMin); - BurnYM2151Scan(nAction); - DACScan(nAction, pnMin); - - tnzs_mcu_scan(); - - SCAN_VAR(tnzs_banks[0]); - SCAN_VAR(tnzs_banks[1]); - SCAN_VAR(tnzs_banks[2]); - SCAN_VAR(cpu1_reset); - - SCAN_VAR(nAnalogAxis[0]); - SCAN_VAR(nAnalogAxis[1]); - - SCAN_VAR(kageki_csport_sel); - SCAN_VAR(kageki_sample_pos); - SCAN_VAR(kageki_sample_select); - } - - if (nAction & ACB_WRITE) { - ZetOpen(0); - bankswitch0(tnzs_banks[0]); - ZetClose(); - - ZetOpen(1); - bankswitch1(tnzs_banks[1]); - ZetClose(); - - ZetOpen(2); - kabukiz_sound_bankswitch(0,tnzs_banks[2]); - ZetClose(); - } - - return 0; -} - - -// Plump Pop (Japan) - -static struct BurnRomInfo plumppopRomDesc[] = { - { "a98-09.bin", 0x10000, 0x107f9e06, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "a98-10.bin", 0x10000, 0xdf6e6af2, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "a98-11.bin", 0x10000, 0xbc56775c, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "plmp8742.bin", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU - - { "a98-01.bin", 0x10000, 0xf3033dca, 4 | BRF_GRA }, // 4 Graphics - { "a98-02.bin", 0x10000, 0xf2d17b0c, 4 | BRF_GRA }, // 5 - { "a98-03.bin", 0x10000, 0x1a519b0a, 4 | BRF_GRA }, // 6 - { "a98-04.bin", 0x10000, 0xb64501a1, 4 | BRF_GRA }, // 7 - { "a98-05.bin", 0x10000, 0x45c36963, 4 | BRF_GRA }, // 8 - { "a98-06.bin", 0x10000, 0xe075341b, 4 | BRF_GRA }, // 9 - { "a98-07.bin", 0x10000, 0x8e16cd81, 4 | BRF_GRA }, // 10 - { "a98-08.bin", 0x10000, 0xbfa7609a, 4 | BRF_GRA }, // 11 - - { "a98-13.bpr", 0x00200, 0x7cde2da5, 5 | BRF_GRA }, // 12 Color PROMs - { "a98-12.bpr", 0x00200, 0x90dc9da7, 5 | BRF_GRA }, // 13 -}; - -STD_ROM_PICK(plumppop) -STD_ROM_FN(plumppop) - -static INT32 PlumppopInit() -{ - return Type1Init(MCU_PLUMPOP); -} - -struct BurnDriver BurnDrvPlumppop = { - "plumppop", NULL, NULL, NULL, "1987", - "Plump Pop (Japan)\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, plumppopRomInfo, plumppopRomName, NULL, NULL, PlumppopInputInfo, PlumppopDIPInfo, - PlumppopInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Extermination (World) - -static struct BurnRomInfo extrmatnRomDesc[] = { - { "b06-05.11c", 0x10000, 0x918e1fe3, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b06-06.9c", 0x10000, 0x8842e105, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b06-19.4e", 0x10000, 0x8de43ed9, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "extr8742.4f", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU - - { "b06-01.13a", 0x20000, 0xd2afbf7e, 4 | BRF_GRA }, // 4 Graphics - { "b06-02.10a", 0x20000, 0xe0c2757a, 4 | BRF_GRA }, // 5 - { "b06-03.7a", 0x20000, 0xee80ab9d, 4 | BRF_GRA }, // 6 - { "b06-04.4a", 0x20000, 0x3697ace4, 4 | BRF_GRA }, // 7 - - { "b06-09.15f", 0x00200, 0xf388b361, 5 | BRF_GRA }, // 8 Color PROMs - { "b06-08.17f", 0x00200, 0x10c9aac3, 5 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(extrmatn) -STD_ROM_FN(extrmatn) - -static INT32 ExtrmatnInit() -{ - return Type1Init(MCU_EXTRMATN); -} - -struct BurnDriver BurnDrvExtrmatn = { - "extrmatn", NULL, NULL, NULL, "1987", - "Extermination (World)\0", NULL, "Taito Corporation Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, extrmatnRomInfo, extrmatnRomName, NULL, NULL, CommonInputInfo, ExtrmatnDIPInfo, - ExtrmatnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Extermination (US) - -static struct BurnRomInfo extrmatuRomDesc[] = { - { "b06-20.11c", 0x10000, 0x04e3fc1f, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b06-21.9c", 0x10000, 0x1614d6a2, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b06-22.4e", 0x10000, 0x744f2c84, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "extr8742.4f", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU - - { "b06-01.13a", 0x20000, 0xd2afbf7e, 4 | BRF_GRA }, // 4 Graphics - { "b06-02.10a", 0x20000, 0xe0c2757a, 4 | BRF_GRA }, // 5 - { "b06-03.7a", 0x20000, 0xee80ab9d, 4 | BRF_GRA }, // 6 - { "b06-04.4a", 0x20000, 0x3697ace4, 4 | BRF_GRA }, // 7 - - { "b06-09.15f", 0x00200, 0xf388b361, 5 | BRF_GRA }, // 8 Color PROMs - { "b06-08.17f", 0x00200, 0x10c9aac3, 5 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(extrmatu) -STD_ROM_FN(extrmatu) - -struct BurnDriver BurnDrvExtrmatu = { - "extrmatnu", "extrmatn", NULL, NULL, "1987", - "Extermination (US)\0", NULL, "[Taito] World Games", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, extrmatuRomInfo, extrmatuRomName, NULL, NULL, CommonInputInfo, ExtrmatnDIPInfo, - ExtrmatnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Extermination (Japan) - -static struct BurnRomInfo extrmatjRomDesc[] = { - { "b06-05.11c", 0x10000, 0x918e1fe3, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b06-06.9c", 0x10000, 0x8842e105, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b06-07.4e", 0x10000, 0xb37fb8b3, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "extr8742.4f", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU - - { "b06-01.13a", 0x20000, 0xd2afbf7e, 4 | BRF_GRA }, // 4 Graphics - { "b06-02.10a", 0x20000, 0xe0c2757a, 4 | BRF_GRA }, // 5 - { "b06-03.7a", 0x20000, 0xee80ab9d, 4 | BRF_GRA }, // 6 - { "b06-04.4a", 0x20000, 0x3697ace4, 4 | BRF_GRA }, // 7 - - { "b06-09.15f", 0x00200, 0xf388b361, 5 | BRF_GRA }, // 8 Color PROMs - { "b06-08.17f", 0x00200, 0x10c9aac3, 5 | BRF_GRA }, // 9 -}; - -STD_ROM_PICK(extrmatj) -STD_ROM_FN(extrmatj) - -struct BurnDriver BurnDrvExtrmatj = { - "extrmatnj", "extrmatn", NULL, NULL, "1987", - "Extermination (Japan)\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, extrmatjRomInfo, extrmatjRomName, NULL, NULL, CommonInputInfo, ExtrmatnDIPInfo, - ExtrmatnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid - Revenge of DOH (World) - -static struct BurnRomInfo arknoid2RomDesc[] = { - { "b08_05.11c", 0x10000, 0x136edf9d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "b08_13.3e", 0x10000, 0xe8035ef1, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "ark28742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 2 I8742 MCU - - { "b08-01.13a", 0x20000, 0x2ccc86b4, 4 | BRF_GRA }, // 3 Graphics - { "b08-02.10a", 0x20000, 0x056a985f, 4 | BRF_GRA }, // 4 - { "b08-03.7a", 0x20000, 0x274a795f, 4 | BRF_GRA }, // 5 - { "b08-04.4a", 0x20000, 0x9754f703, 4 | BRF_GRA }, // 6 - - { "b08-08.15f", 0x00200, 0xa4f7ebd9, 5 | BRF_GRA }, // 7 Color PROMs - { "b08-07.16f", 0x00200, 0xea34d9f7, 5 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(arknoid2) -STD_ROM_FN(arknoid2) - -static INT32 Arknoid2Init() -{ - return Type1Init(MCU_ARKANOID); -} - -struct BurnDriver BurnDrvArknoid2 = { - "arknoid2", NULL, NULL, NULL, "1987", - "Arkanoid - Revenge of DOH (World)\0", NULL, "Taito Corporation Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, arknoid2RomInfo, arknoid2RomName, NULL, NULL, Arknoid2InputInfo, Arknoid2DIPInfo, - Arknoid2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid - Revenge of DOH (US) - -static struct BurnRomInfo arknid2uRomDesc[] = { - { "b08_11.11c", 0x10000, 0x99555231, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "b08_12.3e", 0x10000, 0xdc84e27d, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "ark28742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 2 I8742 MCU - - { "b08-01.13a", 0x20000, 0x2ccc86b4, 4 | BRF_GRA }, // 3 Graphics - { "b08-02.10a", 0x20000, 0x056a985f, 4 | BRF_GRA }, // 4 - { "b08-03.7a", 0x20000, 0x274a795f, 4 | BRF_GRA }, // 5 - { "b08-04.4a", 0x20000, 0x9754f703, 4 | BRF_GRA }, // 6 - - { "b08-08.15f", 0x00200, 0xa4f7ebd9, 5 | BRF_GRA }, // 7 Color PROMs - { "b08-07.16f", 0x00200, 0xea34d9f7, 5 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(arknid2u) -STD_ROM_FN(arknid2u) - -struct BurnDriver BurnDrvArknid2u = { - "arknoid2u", "arknoid2", NULL, NULL, "1987", - "Arkanoid - Revenge of DOH (US)\0", NULL, "Taito America Corporation (Romstar license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, arknid2uRomInfo, arknid2uRomName, NULL, NULL, Arknoid2InputInfo, Arknid2uDIPInfo, - Arknoid2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid - Revenge of DOH (Japan) - -static struct BurnRomInfo arknid2jRomDesc[] = { - { "b08_05.11c", 0x10000, 0x136edf9d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "b08_06.3e", 0x10000, 0xadfcd40c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "ark28742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 2 I8742 MCU - - { "b08-01.13a", 0x20000, 0x2ccc86b4, 4 | BRF_GRA }, // 3 Graphics - { "b08-02.10a", 0x20000, 0x056a985f, 4 | BRF_GRA }, // 4 - { "b08-03.7a", 0x20000, 0x274a795f, 4 | BRF_GRA }, // 5 - { "b08-04.4a", 0x20000, 0x9754f703, 4 | BRF_GRA }, // 6 - - { "b08-08.15f", 0x00200, 0xa4f7ebd9, 5 | BRF_GRA }, // 7 Color PROMs - { "b08-07.16f", 0x00200, 0xea34d9f7, 5 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(arknid2j) -STD_ROM_FN(arknid2j) - -struct BurnDriver BurnDrvArknid2j = { - "arknoid2j", "arknoid2", NULL, NULL, "1987", - "Arkanoid - Revenge of DOH (Japan)\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, arknid2jRomInfo, arknid2jRomName, NULL, NULL, Arknoid2InputInfo, Arknid2uDIPInfo, - Arknoid2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Arkanoid - Revenge of DOH (Japan bootleg) - -static struct BurnRomInfo arknid2bRomDesc[] = { - { "boot.11c", 0x10000, 0x3847dfb0, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "b08_13.3e", 0x10000, 0xe8035ef1, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "ark28742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 2 I8742 MCU - - { "b08-01.13a", 0x20000, 0x2ccc86b4, 4 | BRF_GRA }, // 3 Graphics - { "b08-02.10a", 0x20000, 0x056a985f, 4 | BRF_GRA }, // 4 - { "b08-03.7a", 0x20000, 0x274a795f, 4 | BRF_GRA }, // 5 - { "b08-04.4a", 0x20000, 0x9754f703, 4 | BRF_GRA }, // 6 - - { "b08-08.15f", 0x00200, 0xa4f7ebd9, 5 | BRF_GRA }, // 7 Color PROMs - { "b08-07.16f", 0x00200, 0xea34d9f7, 5 | BRF_GRA }, // 8 -}; - -STD_ROM_PICK(arknid2b) -STD_ROM_FN(arknid2b) - -struct BurnDriver BurnDrvArknid2b = { - "arknoid2b", "arknoid2", NULL, NULL, "1987", - "Arkanoid - Revenge of DOH (Japan bootleg)\0", NULL, "bootleg", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, arknid2bRomInfo, arknid2bRomName, NULL, NULL, Arknoid2InputInfo, Arknid2uDIPInfo, - Arknoid2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Dr. Toppel's Adventure (World) - -static struct BurnRomInfo drtoppelRomDesc[] = { - { "b19-09.11c", 0x10000, 0x3e654f82, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b19-10.9c", 0x10000, 0x7e72fd25, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b19-15.3e", 0x10000, 0x37a0d3fb, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "drt8742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU - - { "b19-01.13a", 0x20000, 0xa7e8a0c1, 4 | BRF_GRA }, // 4 Graphics - { "b19-02.12a", 0x20000, 0x790ae654, 4 | BRF_GRA }, // 5 - { "b19-03.10a", 0x20000, 0x495c4c5a, 4 | BRF_GRA }, // 6 - { "b19-04.8a", 0x20000, 0x647007a0, 4 | BRF_GRA }, // 7 - { "b19-05.7a", 0x20000, 0x49f2b1a5, 4 | BRF_GRA }, // 8 - { "b19-06.5a", 0x20000, 0x2d39f1d0, 4 | BRF_GRA }, // 9 - { "b19-07.4a", 0x20000, 0x8bb06f41, 4 | BRF_GRA }, // 10 - { "b19-08.2a", 0x20000, 0x3584b491, 4 | BRF_GRA }, // 11 - - { "b19-13.15f", 0x00200, 0x6a547980, 5 | BRF_GRA }, // 12 Color PROMs - { "b19-12.16f", 0x00200, 0x5754e9d8, 5 | BRF_GRA }, // 13 -}; - -STD_ROM_PICK(drtoppel) -STD_ROM_FN(drtoppel) - -static INT32 DrtoppelInit() -{ - return Type1Init(MCU_DRTOPPEL); -} - -struct BurnDriver BurnDrvDrtoppel = { - "drtoppel", NULL, NULL, NULL, "1987", - "Dr. Toppel's Adventure (World)\0", NULL, "Taito Corporation Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, drtoppelRomInfo, drtoppelRomName, NULL, NULL, CommonInputInfo, DrtoppelDIPInfo, - DrtoppelInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Dr. Toppel's Adventure (US) - -static struct BurnRomInfo drtoppluRomDesc[] = { - { "b19-09.11c", 0x10000, 0x3e654f82, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b19-10.9c", 0x10000, 0x7e72fd25, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b19-14.3e", 0x10000, 0x05565b22, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "drt8742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU - - { "b19-01.13a", 0x20000, 0xa7e8a0c1, 4 | BRF_GRA }, // 4 Graphics - { "b19-02.12a", 0x20000, 0x790ae654, 4 | BRF_GRA }, // 5 - { "b19-03.10a", 0x20000, 0x495c4c5a, 4 | BRF_GRA }, // 6 - { "b19-04.8a", 0x20000, 0x647007a0, 4 | BRF_GRA }, // 7 - { "b19-05.7a", 0x20000, 0x49f2b1a5, 4 | BRF_GRA }, // 8 - { "b19-06.5a", 0x20000, 0x2d39f1d0, 4 | BRF_GRA }, // 9 - { "b19-07.4a", 0x20000, 0x8bb06f41, 4 | BRF_GRA }, // 10 - { "b19-08.2a", 0x20000, 0x3584b491, 4 | BRF_GRA }, // 11 - - { "b19-13.15f", 0x00200, 0x6a547980, 5 | BRF_GRA }, // 12 Color PROMs - { "b19-12.16f", 0x00200, 0x5754e9d8, 5 | BRF_GRA }, // 13 -}; - -STD_ROM_PICK(drtopplu) -STD_ROM_FN(drtopplu) - -struct BurnDriver BurnDrvDrtopplu = { - "drtoppelu", "drtoppel", NULL, NULL, "1987", - "Dr. Toppel's Adventure (US)\0", NULL, "Taito America Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, drtoppluRomInfo, drtoppluRomName, NULL, NULL, CommonInputInfo, DrtoppluDIPInfo, - DrtoppelInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Dr. Toppel's Tankentai (Japan) - -static struct BurnRomInfo drtoppljRomDesc[] = { - { "b19-09.11c", 0x10000, 0x3e654f82, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b19-10.9c", 0x10000, 0x7e72fd25, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b19-11.3e", 0x10000, 0x524dc249, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "drt8742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU - - { "b19-01.13a", 0x20000, 0xa7e8a0c1, 4 | BRF_GRA }, // 4 Graphics - { "b19-02.12a", 0x20000, 0x790ae654, 4 | BRF_GRA }, // 5 - { "b19-03.10a", 0x20000, 0x495c4c5a, 4 | BRF_GRA }, // 6 - { "b19-04.8a", 0x20000, 0x647007a0, 4 | BRF_GRA }, // 7 - { "b19-05.7a", 0x20000, 0x49f2b1a5, 4 | BRF_GRA }, // 8 - { "b19-06.5a", 0x20000, 0x2d39f1d0, 4 | BRF_GRA }, // 9 - { "b19-07.4a", 0x20000, 0x8bb06f41, 4 | BRF_GRA }, // 10 - { "b19-08.2a", 0x20000, 0x3584b491, 4 | BRF_GRA }, // 11 - - { "b19-13.15f", 0x00200, 0x6a547980, 5 | BRF_GRA }, // 12 Color PROMs - { "b19-12.16f", 0x00200, 0x5754e9d8, 5 | BRF_GRA }, // 13 -}; - -STD_ROM_PICK(drtopplj) -STD_ROM_FN(drtopplj) - -struct BurnDriver BurnDrvDrtopplj = { - "drtoppelj", "drtoppel", NULL, NULL, "1987", - "Dr. Toppel's Tankentai (Japan)\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, drtoppljRomInfo, drtoppljRomName, NULL, NULL, CommonInputInfo, DrtoppluDIPInfo, - DrtoppelInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Kageki (US) - -static struct BurnRomInfo kagekiRomDesc[] = { - { "b35-16.11c", 0x10000, 0xa4e6fd58, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b35-10.9c", 0x10000, 0xb150457d, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b35-17.43e", 0x10000, 0xfdd9c246, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "b35-01.13a", 0x20000, 0x01d83a69, 4 | BRF_GRA }, // 3 Graphics - { "b35-02.12a", 0x20000, 0xd8af47ac, 4 | BRF_GRA }, // 4 - { "b35-03.10a", 0x20000, 0x3cb68797, 4 | BRF_GRA }, // 5 - { "b35-04.8a", 0x20000, 0x71c03f91, 4 | BRF_GRA }, // 6 - { "b35-05.7a", 0x20000, 0xa4e20c08, 4 | BRF_GRA }, // 7 - { "b35-06.5a", 0x20000, 0x3f8ab658, 4 | BRF_GRA }, // 8 - { "b35-07.4a", 0x20000, 0x1b4af049, 4 | BRF_GRA }, // 9 - { "b35-08.2a", 0x20000, 0xdeb2268c, 4 | BRF_GRA }, // 10 - - { "b35-15.98g", 0x10000, 0xe6212a0f, 6 | BRF_SND }, // 11 Samples -}; - -STD_ROM_PICK(kageki) -STD_ROM_FN(kageki) - -static INT32 KagekiInit() -{ - return Type1Init(MCU_NONE_KAGEKI); -} - -struct BurnDriver BurnDrvKageki = { - "kageki", NULL, NULL, NULL, "1988", - "Kageki (US)\0", "Imperfect Sound", "Taito America Corporation (Romstar license)", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, kagekiRomInfo, kagekiRomName, NULL, NULL, CommonInputInfo, KagekiDIPInfo, - KagekiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Kageki (Japan) - -static struct BurnRomInfo kagekijRomDesc[] = { - { "b35-09.11c", 0x10000, 0x829637d5, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b35-10.9c", 0x10000, 0xb150457d, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b35-11.43e", 0x10000, 0x64d093fc, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "b35-01.13a", 0x20000, 0x01d83a69, 4 | BRF_GRA }, // 3 Graphics - { "b35-02.12a", 0x20000, 0xd8af47ac, 4 | BRF_GRA }, // 4 - { "b35-03.10a", 0x20000, 0x3cb68797, 4 | BRF_GRA }, // 5 - { "b35-04.8a", 0x20000, 0x71c03f91, 4 | BRF_GRA }, // 6 - { "b35-05.7a", 0x20000, 0xa4e20c08, 4 | BRF_GRA }, // 7 - { "b35-06.5a", 0x20000, 0x3f8ab658, 4 | BRF_GRA }, // 8 - { "b35-07.4a", 0x20000, 0x1b4af049, 4 | BRF_GRA }, // 9 - { "b35-08.2a", 0x20000, 0xdeb2268c, 4 | BRF_GRA }, // 10 - - { "b35-12.98g", 0x10000, 0x184409f1, 6 | BRF_SND }, // 11 Samples -}; - -STD_ROM_PICK(kagekij) -STD_ROM_FN(kagekij) - -struct BurnDriver BurnDrvKagekij = { - "kagekij", "kageki", NULL, NULL, "1988", - "Kageki (Japan)\0", "Imperfect Sound", "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, kagekijRomInfo, kagekijRomName, NULL, NULL, CommonInputInfo, KagekiDIPInfo, - KagekiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Kageki (hack) - -static struct BurnRomInfo kagekihRomDesc[] = { - { "b35_16.11c", 0x10000, 0x1cf67603, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b35-10.9c", 0x10000, 0xb150457d, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b35-11.43e", 0x10000, 0x64d093fc, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "b35-01.13a", 0x20000, 0x01d83a69, 4 | BRF_GRA }, // 3 Graphics - { "b35-02.12a", 0x20000, 0xd8af47ac, 4 | BRF_GRA }, // 4 - { "b35-03.10a", 0x20000, 0x3cb68797, 4 | BRF_GRA }, // 5 - { "b35-04.8a", 0x20000, 0x71c03f91, 4 | BRF_GRA }, // 6 - { "b35-05.7a", 0x20000, 0xa4e20c08, 4 | BRF_GRA }, // 7 - { "b35-06.5a", 0x20000, 0x3f8ab658, 4 | BRF_GRA }, // 8 - { "b35-07.4a", 0x20000, 0x1b4af049, 4 | BRF_GRA }, // 9 - { "b35-08.2a", 0x20000, 0xdeb2268c, 4 | BRF_GRA }, // 10 - - { "b35-12.98g", 0x10000, 0x184409f1, 6 | BRF_SND }, // 11 Samples -}; - -STD_ROM_PICK(kagekih) -STD_ROM_FN(kagekih) - -struct BurnDriver BurnDrvKagekih = { - "kagekih", "kageki", NULL, NULL, "1992", - "Kageki (hack)\0", "Imperfect Sound", "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, kagekihRomInfo, kagekihRomName, NULL, NULL, CommonInputInfo, KagekiDIPInfo, - KagekiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 224, 256, 3, 4 -}; - - -// Chuka Taisen (World) - -static struct BurnRomInfo chukataiRomDesc[] = { - { "b44-10", 0x10000, 0x8c69e008, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b44-11", 0x10000, 0x32484094, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b44-12w", 0x10000, 0xe80ecdca, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "b44-8742.mcu", 0x00800, 0x7dff3f9f, 3 | BRF_PRG | BRF_OPT }, // 3 I8742 MCU - - { "b44-01.a13", 0x20000, 0xaae7b3d5, 4 | BRF_GRA }, // 4 Graphics - { "b44-02.a12", 0x20000, 0x7f0b9568, 4 | BRF_GRA }, // 5 - { "b44-03.a10", 0x20000, 0x5a54a3b9, 4 | BRF_GRA }, // 6 - { "b44-04.a08", 0x20000, 0x3c5f544b, 4 | BRF_GRA }, // 7 - { "b44-05.a07", 0x20000, 0xd1b7e314, 4 | BRF_GRA }, // 8 - { "b44-06.a05", 0x20000, 0x269978a8, 4 | BRF_GRA }, // 9 - { "b44-07.a04", 0x20000, 0x3e0e737e, 4 | BRF_GRA }, // 10 - { "b44-08.a02", 0x20000, 0x6cb1e8fc, 4 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(chukatai) -STD_ROM_FN(chukatai) - -static INT32 ChukataiInit() -{ - return Type1Init(MCU_CHUKATAI); -} - -struct BurnDriver BurnDrvChukatai = { - "chukatai", NULL, NULL, NULL, "1988", - "Chuka Taisen (World)\0", NULL, "Taito Corporation Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, chukataiRomInfo, chukataiRomName, NULL, NULL, CommonInputInfo, ChukataiDIPInfo, - ChukataiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Chuka Taisen (US) - -static struct BurnRomInfo chukatauRomDesc[] = { - { "b44-10", 0x10000, 0x8c69e008, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b44-11", 0x10000, 0x32484094, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b44-12u", 0x10000, 0x9f09fd5c, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "b44-8742.mcu", 0x00800, 0x7dff3f9f, 3 | BRF_PRG | BRF_OPT }, // 3 I8742 MCU - - { "b44-01.a13", 0x20000, 0xaae7b3d5, 4 | BRF_GRA }, // 4 Graphics - { "b44-02.a12", 0x20000, 0x7f0b9568, 4 | BRF_GRA }, // 5 - { "b44-03.a10", 0x20000, 0x5a54a3b9, 4 | BRF_GRA }, // 6 - { "b44-04.a08", 0x20000, 0x3c5f544b, 4 | BRF_GRA }, // 7 - { "b44-05.a07", 0x20000, 0xd1b7e314, 4 | BRF_GRA }, // 8 - { "b44-06.a05", 0x20000, 0x269978a8, 4 | BRF_GRA }, // 9 - { "b44-07.a04", 0x20000, 0x3e0e737e, 4 | BRF_GRA }, // 10 - { "b44-08.a02", 0x20000, 0x6cb1e8fc, 4 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(chukatau) -STD_ROM_FN(chukatau) - -struct BurnDriver BurnDrvChukatau = { - "chukataiu", "chukatai", NULL, NULL, "1988", - "Chuka Taisen (US)\0", NULL, "Taito America Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, chukatauRomInfo, chukatauRomName, NULL, NULL, CommonInputInfo, ChukatauDIPInfo, - ChukataiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Chuka Taisen (Japan) - -static struct BurnRomInfo chukatajRomDesc[] = { - { "b44-10", 0x10000, 0x8c69e008, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - { "b44-11", 0x10000, 0x32484094, 1 | BRF_PRG | BRF_ESS }, // 1 - - { "b44-12", 0x10000, 0x0600ace6, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code - - { "b44-8742.mcu", 0x00800, 0x7dff3f9f, 3 | BRF_PRG | BRF_OPT }, // 3 I8742 MCU - - { "b44-01.a13", 0x20000, 0xaae7b3d5, 4 | BRF_GRA }, // 4 Graphics - { "b44-02.a12", 0x20000, 0x7f0b9568, 4 | BRF_GRA }, // 5 - { "b44-03.a10", 0x20000, 0x5a54a3b9, 4 | BRF_GRA }, // 6 - { "b44-04.a08", 0x20000, 0x3c5f544b, 4 | BRF_GRA }, // 7 - { "b44-05.a07", 0x20000, 0xd1b7e314, 4 | BRF_GRA }, // 8 - { "b44-06.a05", 0x20000, 0x269978a8, 4 | BRF_GRA }, // 9 - { "b44-07.a04", 0x20000, 0x3e0e737e, 4 | BRF_GRA }, // 10 - { "b44-08.a02", 0x20000, 0x6cb1e8fc, 4 | BRF_GRA }, // 11 -}; - -STD_ROM_PICK(chukataj) -STD_ROM_FN(chukataj) - -struct BurnDriver BurnDrvChukataj = { - "chukataij", "chukatai", NULL, NULL, "1988", - "Chuka Taisen (Japan)\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, chukatajRomInfo, chukatajRomName, NULL, NULL, CommonInputInfo, ChukatauDIPInfo, - ChukataiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// The NewZealand Story (World, newer) - -static struct BurnRomInfo tnzsRomDesc[] = { - { "b53-24.1", 0x20000, 0xd66824c6, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "b53-25.3", 0x10000, 0xd6ac4e71, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "b53-26.34", 0x10000, 0xcfd5649c, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code - - { "b53-16.8", 0x20000, 0xc3519c2a, 4 | BRF_GRA }, // 3 Graphics - { "b53-17.7", 0x20000, 0x2bf199e8, 4 | BRF_GRA }, // 4 - { "b53-18.6", 0x20000, 0x92f35ed9, 4 | BRF_GRA }, // 5 - { "b53-19.5", 0x20000, 0xedbb9581, 4 | BRF_GRA }, // 6 - { "b53-22.4", 0x20000, 0x59d2aef6, 4 | BRF_GRA }, // 7 - { "b53-23.3", 0x20000, 0x74acfb9b, 4 | BRF_GRA }, // 8 - { "b53-20.2", 0x20000, 0x095d0dc0, 4 | BRF_GRA }, // 9 - { "b53-21.1", 0x20000, 0x9800c54d, 4 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(tnzs) -STD_ROM_FN(tnzs) - -struct BurnDriver BurnDrvtnzs = { - "tnzs", NULL, NULL, NULL, "1988", - "The NewZealand Story (World, newer)\0", NULL, "Taito Corporation Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, tnzsRomInfo, tnzsRomName, NULL, NULL, CommonInputInfo, TnzsDIPInfo, - Type2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// The NewZealand Story (Japan, newer) - -static struct BurnRomInfo tnzsjRomDesc[] = { - { "b53-24.1", 0x20000, 0xd66824c6, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "b53-27.u3", 0x10000, 0xb3415fc3, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "b53-26.34", 0x10000, 0xcfd5649c, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code - - { "b53-16.8", 0x20000, 0xc3519c2a, 4 | BRF_GRA }, // 3 Graphics - { "b53-17.7", 0x20000, 0x2bf199e8, 4 | BRF_GRA }, // 4 - { "b53-18.6", 0x20000, 0x92f35ed9, 4 | BRF_GRA }, // 5 - { "b53-19.5", 0x20000, 0xedbb9581, 4 | BRF_GRA }, // 6 - { "b53-22.4", 0x20000, 0x59d2aef6, 4 | BRF_GRA }, // 7 - { "b53-23.3", 0x20000, 0x74acfb9b, 4 | BRF_GRA }, // 8 - { "b53-20.2", 0x20000, 0x095d0dc0, 4 | BRF_GRA }, // 9 - { "b53-21.1", 0x20000, 0x9800c54d, 4 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(tnzsj) -STD_ROM_FN(tnzsj) - -struct BurnDriver BurnDrvtnzsj = { - "tnzsj", "tnzs", NULL, NULL, "1988", - "The NewZealand Story (Japan, new version, newer PCB)\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, - NULL, tnzsjRomInfo, tnzsjRomName, NULL, NULL, CommonInputInfo, TnzsjDIPInfo, - Type2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// The NewZealand Story (Japan, old version) (older PCB) - -static struct BurnRomInfo tnzsjoRomDesc[] = { - { "b53-10.32", 0x20000, 0xa73745c6, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "b53-11.38", 0x10000, 0x9784d443, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "b53-09.u46", 0x00800, 0xa4bfce19, 3 | BRF_PRG | BRF_OPT }, // 2 I8742 MCU - - { "b53-08.8", 0x20000, 0xc3519c2a, 4 | BRF_GRA }, // 3 Graphics - { "b53-07.7", 0x20000, 0x2bf199e8, 4 | BRF_GRA }, // 4 - { "b53-06.6", 0x20000, 0x92f35ed9, 4 | BRF_GRA }, // 5 - { "b53-05.5", 0x20000, 0xedbb9581, 4 | BRF_GRA }, // 6 - { "b53-04.4", 0x20000, 0x59d2aef6, 4 | BRF_GRA }, // 7 - { "b53-03.3", 0x20000, 0x74acfb9b, 4 | BRF_GRA }, // 8 - { "b53-02.2", 0x20000, 0x095d0dc0, 4 | BRF_GRA }, // 9 - { "b53-01.1", 0x20000, 0x9800c54d, 4 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(tnzsjo) -STD_ROM_FN(tnzsjo) - -static INT32 TnzsoInit() -{ - return Type1Init(MCU_TNZS); -} - -struct BurnDriver BurnDrvTnzsjo = { - "tnzsjo", "tnzs", NULL, NULL, "1988", - "The NewZealand Story (Japan, old version) (older PCB)\0", NULL, "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, tnzsjoRomInfo, tnzsjoRomName, NULL, NULL, CommonInputInfo, TnzsjoDIPInfo, - TnzsoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// The NewZealand Story (World, old version) (older PCB) - -static struct BurnRomInfo tnzsoRomDesc[] = { - { "u32", 0x20000, 0xedf3b39e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "u38", 0x10000, 0x60340d63, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "b53-06.u46", 0x00800, 0xa4bfce19, 3 | BRF_PRG | BRF_OPT }, // 2 I8742 MCU - - { "b53-08.8", 0x20000, 0xc3519c2a, 4 | BRF_GRA }, // 3 Graphics - { "b53-07.7", 0x20000, 0x2bf199e8, 4 | BRF_GRA }, // 4 - { "b53-06.6", 0x20000, 0x92f35ed9, 4 | BRF_GRA }, // 5 - { "b53-05.5", 0x20000, 0xedbb9581, 4 | BRF_GRA }, // 6 - { "b53-04.4", 0x20000, 0x59d2aef6, 4 | BRF_GRA }, // 7 - { "b53-03.3", 0x20000, 0x74acfb9b, 4 | BRF_GRA }, // 8 - { "b53-02.2", 0x20000, 0x095d0dc0, 4 | BRF_GRA }, // 9 - { "b53-01.1", 0x20000, 0x9800c54d, 4 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(tnzso) -STD_ROM_FN(tnzso) - -struct BurnDriver BurnDrvTnzso = { - "tnzso", "tnzs", NULL, NULL, "1988", - "The NewZealand Story (World, old version) (older PCB)\0", NULL, "Taito Corporation Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, tnzsoRomInfo, tnzsoRomName, NULL, NULL, CommonInputInfo, TnzsopDIPInfo, - TnzsoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// The NewZealand Story (World, prototype?) (older PCB) - -static struct BurnRomInfo tnzsopRomDesc[] = { - { "ns_c-11.rom", 0x20000, 0x3c1dae7b, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "ns_e-3.rom", 0x10000, 0xc7662e96, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "b53-09.u46", 0x00800, 0xa4bfce19, 3 | BRF_PRG | BRF_OPT }, // 2 I8742 MCU - - { "ns_a13.rom", 0x20000, 0x7e0bd5bb, 4 | BRF_GRA }, // 3 Graphics - { "ns_a12.rom", 0x20000, 0x95880726, 4 | BRF_GRA }, // 4 - { "ns_a10.rom", 0x20000, 0x2bc4c053, 4 | BRF_GRA }, // 5 - { "ns_a08.rom", 0x20000, 0x8ff8d88c, 4 | BRF_GRA }, // 6 - { "ns_a07.rom", 0x20000, 0x291bcaca, 4 | BRF_GRA }, // 7 - { "ns_a05.rom", 0x20000, 0x6e762e20, 4 | BRF_GRA }, // 8 - { "ns_a04.rom", 0x20000, 0xe1fd1b9d, 4 | BRF_GRA }, // 9 - { "ns_a02.rom", 0x20000, 0x2ab06bda, 4 | BRF_GRA }, // 10 -}; - -STD_ROM_PICK(tnzsop) -STD_ROM_FN(tnzsop) - -struct BurnDriver BurnDrvTnzsop = { - "tnzsop", "tnzs", NULL, NULL, "1988", - "The NewZealand Story (World, prototype?) (older PCB)\0", NULL, "Taito Corporation Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, tnzsopRomInfo, tnzsopRomName, NULL, NULL, CommonInputInfo, TnzsopDIPInfo, - TnzsoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Kabuki-Z (World) - -static struct BurnRomInfo kabukizRomDesc[] = { - { "b50-05.u1", 0x20000, 0x9cccb129, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "b50-08.1e", 0x10000, 0xcb92d34c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "b50-07.u34", 0x20000, 0xbf7fc2ed, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code - - { "b50-04.u35", 0x80000, 0x04829aa9, 4 | BRF_GRA }, // 3 Graphics - { "b50-03.u39", 0x80000, 0x31489a4c, 4 | BRF_GRA }, // 4 - { "b50-02.u43", 0x80000, 0x90b8a8e7, 4 | BRF_GRA }, // 5 - { "b50-01.u46", 0x80000, 0xf4277751, 4 | BRF_GRA }, // 6 -}; - -STD_ROM_PICK(kabukiz) -STD_ROM_FN(kabukiz) - -struct BurnDriverD BurnDrvKabukiz = { - "kabukiz", NULL, NULL, NULL, "1988", - "Kabuki-Z (World)\0", "Imperfect graphics", "Taito Corporation Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, kabukizRomInfo, kabukizRomName, NULL, NULL, CommonInputInfo, KabukizDIPInfo, - Type2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Kabuki-Z (Japan) - -static struct BurnRomInfo kabukizjRomDesc[] = { - { "b50-05.u1", 0x20000, 0x9cccb129, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "b50-06.u3", 0x10000, 0x45650aab, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "b50-07.u34", 0x20000, 0xbf7fc2ed, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code - - { "b50-04.u35", 0x80000, 0x04829aa9, 4 | BRF_GRA }, // 3 Graphics - { "b50-03.u39", 0x80000, 0x31489a4c, 4 | BRF_GRA }, // 4 - { "b50-02.u43", 0x80000, 0x90b8a8e7, 4 | BRF_GRA }, // 5 - { "b50-01.u46", 0x80000, 0xf4277751, 4 | BRF_GRA }, // 6 -}; - -STD_ROM_PICK(kabukizj) -STD_ROM_FN(kabukizj) - -struct BurnDriverD BurnDrvKabukizj = { - "kabukizj", "kabukiz", NULL, NULL, "1988", - "Kabuki-Z (Japan)\0", "Imperfect graphics", "Taito Corporation", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, kabukizjRomInfo, kabukizjRomName, NULL, NULL, CommonInputInfo, KabukizjDIPInfo, - Type2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Insector X (World) - -static struct BurnRomInfo insectxRomDesc[] = { - { "b97-03.u32", 0x20000, 0x18eef387, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "b97-07.u38", 0x10000, 0x324b28c9, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "b97-01.u1", 0x80000, 0xd00294b1, 4 | BRF_GRA }, // 2 Graphics - { "b97-02.u2", 0x80000, 0xdb5a7434, 4 | BRF_GRA }, // 3 -}; - -STD_ROM_PICK(insectx) -STD_ROM_FN(insectx) - -static INT32 InsectxInit() -{ - return Type1Init(MCU_NONE_INSECTX); -} - -struct BurnDriver BurnDrvInsectx = { - "insectx", NULL, NULL, NULL, "1989", - "Insector X (World)\0", NULL, "Taito Corporation Japan", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, insectxRomInfo, insectxRomName, NULL, NULL, InsectxInputInfo, InsectxDIPInfo, - InsectxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; - - -// Jumping Pop (Nics, Korean bootleg of Plump Pop) - -static struct BurnRomInfo jpopnicsRomDesc[] = { - { "u96cpu2", 0x20000, 0x649e951c, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code - - { "u124cpu1", 0x10000, 0x8453e8e4, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code - - { "u94gfx", 0x20000, 0xe49f2fdd, 4 | BRF_GRA }, // 2 Graphics - { "u93gfx", 0x20000, 0xa7791b5b, 4 | BRF_GRA }, // 3 - { "u92gfx", 0x20000, 0xb30caac7, 4 | BRF_GRA }, // 4 - { "u91gfx", 0x20000, 0x18ada5f2, 4 | BRF_GRA }, // 5 -}; - -STD_ROM_PICK(jpopnics) -STD_ROM_FN(jpopnics) - -static INT32 JpopnicsInit() -{ - return Type1Init(MCU_NONE_JPOPNICS); -} - -struct BurnDriver BurnDrvJpopnics = { - "jpopnics", NULL, NULL, NULL, "1992", - "Jumping Pop (Nics, Korean bootleg of Plump Pop)\0", "Imperfect graphics", "Nics", "Miscellaneous", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, - NULL, jpopnicsRomInfo, jpopnicsRomName, NULL, NULL, JpopnicsInputInfo, JpopnicsDIPInfo, - JpopnicsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, - 256, 224, 4, 3 -}; +// FB Alpha The NewZealand Story driver module +// Based on MAME driver by Chris Moore, Brad Oliver, Nicola Salmoria, and many others + +#include "tiles_generic.h" +#include "z80_intf.h" +#include "burn_ym2203.h" +#include "burn_ym2151.h" +#include "tnzs_prot.h" +#include "dac.h" + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *DrvZ80ROM0; +static UINT8 *DrvZ80ROM1; +static UINT8 *DrvZ80ROM2; +static UINT8 *DrvGfxROM; +static UINT8 *DrvColPROM; +static UINT8 *DrvSndROM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvShareRAM; +static UINT8 *DrvScrollRAM; +static UINT8 *DrvVidRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvZ80RAM0; +static UINT8 *DrvZ80RAM1; +static UINT8 *DrvZ80RAM2; +static UINT8 *DrvObjCtrl; + +static UINT32 *DrvPalette; +static UINT8 DrvRecalc; + +static UINT8 *coin_lockout; +static UINT8 *soundlatch; +static UINT8 *tnzs_bg_flag; + +static INT32 kageki_csport_sel; +static double kageki_sample_pos; +static INT32 kageki_sample_select; +static INT16 *kageki_sample_data[0x30]; +static INT32 kageki_sample_size[0x30]; +static double kageki_sample_gain; +static INT32 kageki_sample_output_dir; + +static INT32 cpu1_reset; +static INT32 tnzs_banks[3]; + +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvDips[2]; +static UINT8 DrvInputs[3]; +static UINT8 DrvReset; + +static UINT16 DrvAxis[2]; +static INT32 nAnalogAxis[2] = {0,0}; + +static INT16 *SampleBuffer = NULL; + +#define A(a, b, c, d) { a, b, (UINT8*)(c), d } + +static struct BurnInputInfo CommonInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 1, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Common) + +static struct BurnInputInfo InsectxInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 0, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 1, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 0, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 1, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 1, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Insectx) + +static struct BurnInputInfo Arknoid2InputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy2 + 6, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + + A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 x-axis" ), + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 4, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy1 + 3, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p2 fire 1" }, + + A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 1, "p2 x-axis" ), + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy2 + 5, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy2 + 7, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Arknoid2) + +static struct BurnInputInfo PlumppopInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 x-axis" ), + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 5, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 1, "p2 x-axis" ), + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 1, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Plumppop) + +static struct BurnInputInfo JpopnicsInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 6, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + A("P1 Right / left", BIT_ANALOG_REL, DrvAxis + 0, "p1 x-axis" ), + + {"P2 Coin", BIT_DIGITAL, DrvJoy2 + 6, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy2 + 7, "p2 start" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + A("P2 Right / left", BIT_ANALOG_REL, DrvAxis + 1, "p2 x-axis" ), + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, +}; + +STDINPUTINFO(Jpopnics) + +static struct BurnDIPInfo ExtrmatnDIPList[]= +{ + {0x13, 0xff, 0xff, 0xff, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_COINAGE_JAPAN_OLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + {0 , 0xfe, 0 , 4, "Damage Multiplier" }, + {0x14, 0x01, 0xc0, 0xc0, "*1" }, + {0x14, 0x01, 0xc0, 0x80, "*1.5" }, + {0x14, 0x01, 0xc0, 0x40, "*2" }, + {0x14, 0x01, 0xc0, 0x00, "*3" }, +}; + +STDDIPINFO(Extrmatn) + +static struct BurnDIPInfo DrtoppelDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_DEMOSOUNDS_DIPSETTING(0x13) + + TNZS_COINAGE_WORLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "30k 100k 200k 100k+" }, + {0x14, 0x01, 0x0c, 0x00, "50k 100k 200k 200k+" }, + {0x14, 0x01, 0x0c, 0x04, "30k 100k" }, + {0x14, 0x01, 0x0c, 0x08, "30k only" }, + + TNZS_LIVES_DIPSETTING(0x14) +}; + +STDDIPINFO(Drtoppel) + +static struct BurnDIPInfo DrtoppluDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_DEMOSOUNDS_DIPSETTING(0x13) + + TNZS_COINAGE_JAPAN_OLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "30k 100k 200k 100k+" }, + {0x14, 0x01, 0x0c, 0x00, "50k 100k 200k 200k+" }, + {0x14, 0x01, 0x0c, 0x04, "30k 100k" }, + {0x14, 0x01, 0x0c, 0x08, "30k only" }, + + TNZS_LIVES_DIPSETTING(0x14) +}; + +STDDIPINFO(Drtopplu) + +static struct BurnDIPInfo ChukataiDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_DEMOSOUNDS_DIPSETTING(0x13) + + TNZS_COINAGE_WORLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "100k 300k 440k" }, + {0x14, 0x01, 0x0c, 0x00, "100k 300k 500k" }, + {0x14, 0x01, 0x0c, 0x0c, "100k 400k" }, + {0x14, 0x01, 0x0c, 0x04, "100k 500k" }, + + TNZS_LIVES_DIPSETTING(0x14) +}; + +STDDIPINFO(Chukatai) + +static struct BurnDIPInfo ChukatauDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_DEMOSOUNDS_DIPSETTING(0x13) + + TNZS_COINAGE_JAPAN_OLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "100k 300k 440k" }, + {0x14, 0x01, 0x0c, 0x00, "100k 300k 500k" }, + {0x14, 0x01, 0x0c, 0x0c, "100k 400k" }, + {0x14, 0x01, 0x0c, 0x04, "100k 500k" }, + + TNZS_LIVES_DIPSETTING(0x14) +}; + +STDDIPINFO(Chukatau) + +static struct BurnDIPInfo TnzsDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_COINAGE_WORLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x00, "50k 150k 150k+" }, + {0x14, 0x01, 0x0c, 0x0c, "70k 200k 200k+" }, + {0x14, 0x01, 0x0c, 0x04, "100k 250k 250k+" }, + {0x14, 0x01, 0x0c, 0x08, "200k 300k 300k+" }, + + TNZS_LIVES_DIPSETTING(0x14) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x14, 0x40) +}; + +STDDIPINFO(Tnzs) + +static struct BurnDIPInfo TnzsjDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_COINAGE_JAPAN_OLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x00, "50k 150k 150k+" }, + {0x14, 0x01, 0x0c, 0x0c, "70k 200k 200k+" }, + {0x14, 0x01, 0x0c, 0x04, "100k 250k 250k+" }, + {0x14, 0x01, 0x0c, 0x08, "200k 300k 300k+" }, + + TNZS_LIVES_DIPSETTING(0x14) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x14, 0x40) +}; + +STDDIPINFO(Tnzsj) + +static struct BurnDIPInfo TnzsjoDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + {0 , 0xfe, 0 , 4, "Invulnerability (Debug)" }, + {0x14, 0x01, 0x08, 0x08, "Off" }, + {0x14, 0x01, 0x08, 0x00, "On" }, + + TNZS_COINAGE_JAPAN_OLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x00, "50k 150k 150k+" }, + {0x14, 0x01, 0x0c, 0x0c, "70k 200k 200k+" }, + {0x14, 0x01, 0x0c, 0x04, "100k 250k 250k+" }, + {0x14, 0x01, 0x0c, 0x08, "200k 300k 300k+" }, + + TNZS_LIVES_DIPSETTING(0x14) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x14, 0x40) +}; + +STDDIPINFO(Tnzsjo) + +static struct BurnDIPInfo TnzsopDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_COINAGE_WORLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x00, "10k 100k 100k+" }, + {0x14, 0x01, 0x0c, 0x0c, "10k 150k 150k+" }, + {0x14, 0x01, 0x0c, 0x04, "10k 200k 200k+" }, + {0x14, 0x01, 0x0c, 0x08, "10k 300k 300k+" }, + + TNZS_LIVES_DIPSETTING(0x14) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x14, 0x40) +}; + +STDDIPINFO(Tnzsop) + +static struct BurnDIPInfo InsectxDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_DEMOSOUNDS_DIPSETTING(0x13) + + TNZS_COINAGE_WORLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x08, "100k 200k 300k 440k" }, + {0x14, 0x01, 0x0c, 0x0c, "100k 400k" }, + {0x14, 0x01, 0x0c, 0x04, "100k 500k" }, + {0x14, 0x01, 0x0c, 0x00, "150000 Only" }, + + TNZS_LIVES_DIPSETTING(0x14) +}; + +STDDIPINFO(Insectx) + +static struct BurnDIPInfo KagekiDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + // Cabinet type in Japan set only + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_DEMOSOUNDS_DIPSETTING(0x13) + + TNZS_COINAGE_JAPAN_OLD(0x13) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x14, 0x80) +}; + +STDDIPINFO(Kageki) + +static struct BurnDIPInfo Arknoid2DIPList[]= +{ + {0x0b, 0xff, 0xff, 0xfe, NULL }, + {0x0c, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x0b) + + TNZS_DEMOSOUNDS_DIPSETTING(0x0b) + + TNZS_COINAGE_WORLD(0x0b) + + TNZS_DIFFICULTY_DIPSETTING(0x0c) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x0c, 0x01, 0x0c, 0x00, "50k 150k" }, + {0x0c, 0x01, 0x0c, 0x0c, "100k 200k" }, + {0x0c, 0x01, 0x0c, 0x04, "50k Only" }, + {0x0c, 0x01, 0x0c, 0x08, "100k Only" }, + + TNZS_LIVES_DIPSETTING(0x0c) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x0c, 0x80) +}; + +STDDIPINFO(Arknoid2) + +static struct BurnDIPInfo Arknid2uDIPList[]= +{ + {0x0b, 0xff, 0xff, 0xfe, NULL }, + {0x0c, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x0b) + + TNZS_DEMOSOUNDS_DIPSETTING(0x0b) + + TNZS_COINAGE_JAPAN_OLD(0x0b) + + TNZS_DIFFICULTY_DIPSETTING(0x0c) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x0c, 0x01, 0x0c, 0x00, "50k 150k" }, + {0x0c, 0x01, 0x0c, 0x0c, "100k 200k" }, + {0x0c, 0x01, 0x0c, 0x04, "50k Only" }, + {0x0c, 0x01, 0x0c, 0x08, "100k Only" }, + + TNZS_LIVES_DIPSETTING(0x0c) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x0c, 0x80) +}; + +STDDIPINFO(Arknid2u) + +static struct BurnDIPInfo PlumppopDIPList[]= +{ + {0x0d, 0xff, 0xff, 0xff, NULL }, + {0x0e, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x0d) + + TNZS_DEMOSOUNDS_DIPSETTING(0x0d) + + TNZS_COINAGE_JAPAN_OLD(0x0d) + + TNZS_DIFFICULTY_DIPSETTING(0x0e) + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x0e, 0x01, 0x0c, 0x08, "50k 200k 150k+" }, + {0x0e, 0x01, 0x0c, 0x0c, "50k 250k 200k+" }, + {0x0e, 0x01, 0x0c, 0x04, "100k 300k 200k+" }, + {0x0e, 0x01, 0x0c, 0x00, "100k 400k 300k+" }, + + TNZS_LIVES_DIPSETTING(0x0e) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x0c, 0x80) +}; + +STDDIPINFO(Plumppop) + +static struct BurnDIPInfo JpopnicsDIPList[]= +{ + {0x0b, 0xff, 0xff, 0xff, NULL }, + {0x0c, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x0b) + + TNZS_DEMOSOUNDS_DIPSETTING(0x0b) + + TNZS_DIFFICULTY_DIPSETTING(0x0c) + + {0 , 0xfe, 0 , 0, "Bonus Life" }, + {0x0c, 0x01, 0x0c, 0x08, "50k 200k 150k+" }, + {0x0c, 0x01, 0x0c, 0x0c, "50k 250k 200k+" }, + {0x0c, 0x01, 0x0c, 0x04, "100k 300k 200k+" }, + {0x0c, 0x01, 0x0c, 0x00, "100k 400k 300k+" }, + + TNZS_LIVES_DIPSETTING(0x0c) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x0c, 0x80) +}; + +STDDIPINFO(Jpopnics) + +static struct BurnDIPInfo KabukizDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_DEMOSOUNDS_DIPSETTING(0x13) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x13, 0x80) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + TNZS_COINAGE_WORLD(0x14) +}; + +STDDIPINFO(Kabukiz) + +static struct BurnDIPInfo KabukizjDIPList[]= +{ + {0x13, 0xff, 0xff, 0xfe, NULL }, + {0x14, 0xff, 0xff, 0xff, NULL }, + + TNZS_CABINET_FLIP_SERVICE_DIPSETTING(0x13) + + TNZS_DEMOSOUNDS_DIPSETTING(0x13) + + TNZS_ALLOWCONTINUE_DIPSETTING(0x13, 0x80) + + TNZS_DIFFICULTY_DIPSETTING(0x14) + + TNZS_COINAGE_JAPAN_OLD(0x14) +}; + +STDDIPINFO(Kabukizj) + +void __fastcall bankswitch0(UINT8 data) +{ + // CPU #0 expects CPU #1 to be stopped while reset line is triggered. + if ((~data & 0x10) != cpu1_reset) { + INT32 cycles = ZetTotalCycles(); + ZetClose(); + ZetOpen(1); + cycles -= ZetTotalCycles(); + ZetIdle(cycles); + if (~data & 0x10) ZetReset(); + ZetClose(); + ZetOpen(0); + } + + cpu1_reset = ~data & 0x10; + + tnzs_banks[0] = data; + + INT32 bank = (data & 7) * 0x4000; + + // Low banks are RAM regions high ones are ROM. + if ((data & 6) == 0) { + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80RAM0 + bank); + ZetMapArea(0x8000, 0xbfff, 1, DrvZ80RAM0 + bank); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80RAM0 + bank); + } else { + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + 0x10000 + bank); + ZetMapArea(0x8000, 0xbfff, 1, DrvZ80ROM0 + 0x10000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + 0x10000 + bank); + } +} + +void __fastcall bankswitch1(UINT8 data) +{ + tnzs_banks[1] = data & ~0x04; + + if (data & 0x04) { + tnzs_mcu_reset(); + } + + *coin_lockout = ~data & 0x30; + + ZetMapArea(0x8000, 0x9fff, 0, DrvZ80ROM1 + 0x08000 + 0x2000 * (data & 3)); + ZetMapArea(0x8000, 0x9fff, 2, DrvZ80ROM1 + 0x08000 + 0x2000 * (data & 3)); +} + +void __fastcall tnzs_cpu0_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xf400: + *tnzs_bg_flag = data; + break; + + case 0xf600: + bankswitch0(data); + break; + } + + if ((address & 0xff00) == 0xf300) { + DrvObjCtrl[address & 3] = data; + return; + } +} + +UINT8 __fastcall tnzs_cpu0_read(UINT16 address) +{ + // This is a hack to keep tnzs & clones from freezing. The sub cpu + // writes back 0xff to shared ram as an acknowledge and the main + // cpu doesn't expect it so soon. This can be fixed by an extremely + // high sync, but this hack is much less costly. + if ((address & 0xf000) == 0xe000) { + if (address == 0xef10 && DrvShareRAM[0x0f10] == 0xff) { + return 0; + } + return DrvShareRAM[address & 0xfff]; + } + + return 0; +} + +void __fastcall tnzsb_cpu1_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xa000: + bankswitch1(data); + break; + + case 0xb004: + *soundlatch = data; + ZetClose(); + ZetOpen(2); + ZetSetVector(0xff); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + ZetClose(); + ZetOpen(1); + break; + } +} + +UINT8 __fastcall tnzsb_cpu1_read(UINT16 address) +{ + switch (address) + { + case 0xb002: + return DrvDips[0]; + + case 0xb003: + return DrvDips[1]; + + case 0xc000: + case 0xc001: + return DrvInputs[address & 1]; + + case 0xc002: + return DrvInputs[2] | *coin_lockout; + } + + if (address >= 0xf000 && address <= 0xf003) { + return DrvPalRAM[address & 0x0003]; + } + + return 0; +} + +void __fastcall tnzs_cpu1_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xa000: + bankswitch1(data); + break; + + case 0xb000: + if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { + BurnYM2151SelectRegister(data); + } else { + BurnYM2203Write(0, 0, data); + } + break; + + case 0xb001: + if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { + BurnYM2151WriteRegister(data); + } else { + BurnYM2203Write(0, 1, data); + } + break; + + case 0xc000: + case 0xc001: + tnzs_mcu_write(address, data); + break; + } +} + +UINT8 __fastcall tnzs_cpu1_read(UINT16 address) +{ + switch (address) + { + case 0xb000: + if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) + return 0; + return BurnYM2203Read(0, 0); + + case 0xb001: + if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) + return BurnYM2151ReadStatus(); + return BurnYM2203Read(0, 1); + + case 0xc000: + case 0xc001: + return tnzs_mcu_read(address); + + case 0xc002: + return DrvInputs[2]; + + case 0xc600: + return DrvDips[0]; + + case 0xc601: + return DrvDips[1]; + + case 0xf000: + return (~nAnalogAxis[0] >> 12) & 0xff; + + case 0xf001: + return (~nAnalogAxis[0] >> 20) & 0x0f; + + case 0xf002: + return (~nAnalogAxis[1] >> 12) & 0xff; + + case 0xf003: + return (~nAnalogAxis[1] >> 20) & 0x0f; + } + + return 0; +} + +void __fastcall tnzs_cpu2_out(UINT16 port, UINT8 data) +{ + switch (port & 0xff) + { + case 0x00: + BurnYM2203Write(0, 0, data); + break; + + case 0x01: + BurnYM2203Write(0, 1, data); + break; + } +} + +UINT8 __fastcall tnzs_cpu2_in(UINT16 port) +{ + switch (port & 0xff) + { + case 0x00: + return BurnYM2203Read(0, 0); + + case 0x02: + ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + return *soundlatch; + } + + return 0; +} + +static void kabukiz_sound_bankswitch(UINT32, UINT32 data) +{ + if (data != 0xff) { + tnzs_banks[2] = data; + + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM2 + 0x0000 + 0x4000 * (data & 0x07)); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM2 + 0x0000 + 0x4000 * (data & 0x07)); + } +} + +static void kabukiz_dac_write(UINT32, UINT32 data) +{ + if (data != 0xff) { + DACWrite(0, data); + } +} + +static UINT8 tnzs_ym2203_portA(UINT32 ) +{ + return DrvDips[0]; +} + +static UINT8 tnzs_ym2203_portB(UINT32 ) +{ + return DrvDips[1]; +} + +static UINT8 kageki_ym2203_portA(UINT32) +{ + INT32 dsw1 = DrvDips[0]; + INT32 dsw2 = DrvDips[1]; + UINT8 dsw = 0x0f; + + switch (kageki_csport_sel & 3) + { + case 0x00: + dsw = (((dsw2 & 0x10) >> 1) | ((dsw2 & 0x01) << 2) | ((dsw1 & 0x10) >> 3) | ((dsw1 & 0x01) >> 0)); + break; + + case 0x01: + dsw = (((dsw2 & 0x40) >> 3) | ((dsw2 & 0x04) >> 0) | ((dsw1 & 0x40) >> 5) | ((dsw1 & 0x04) >> 2)); + break; + + case 0x02: + dsw = (((dsw2 & 0x20) >> 2) | ((dsw2 & 0x02) << 1) | ((dsw1 & 0x20) >> 4) | ((dsw1 & 0x02) >> 1)); + break; + + case 0x03: + dsw = (((dsw2 & 0x80) >> 4) | ((dsw2 & 0x08) >> 1) | ((dsw1 & 0x80) >> 6) | ((dsw1 & 0x08) >> 3)); + break; + } + + return dsw; +} + +static void kageki_ym2203_write_portB(UINT32, UINT32 data) +{ + if (data > 0x3f) { + kageki_csport_sel = data; + } else { + if (data > 0x2f) { + kageki_sample_select = -1; + } else { + kageki_sample_select = data; + kageki_sample_pos = 0; + } + } +} + +inline static void DrvYM2203IRQHandler(INT32, INT32 nStatus) +{ + Z80SetIrqLine(Z80_INPUT_LINE_NMI, nStatus & 1); +} + +inline static INT32 DrvSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 6000000; +} + +inline static double DrvGetTime() +{ + return (double)ZetTotalCycles() / 6000000; +} + +static INT32 kabukizSyncDAC() +{ + return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (6000000.000 / (nBurnFPS / 100.000)))); +} + +static INT32 DrvDoReset() +{ + memset (AllRam, 0, RamEnd - AllRam); + memcpy (DrvPalRAM, DrvColPROM, 0x400); + + cpu1_reset = 0; + + for (INT32 i = 0; i < 3; i++) { + ZetOpen(i); + ZetReset(); + if (i == 0) bankswitch0(0x12); + if (i == 1) bankswitch1(0); + if (i == 2) kabukiz_sound_bankswitch(0, 0); + ZetClose(); + } + + tnzs_mcu_reset(); + + if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { + BurnYM2151Reset(); + } else { + BurnYM2203Reset(); + } + + DACReset(); + + kageki_sample_pos = 0; + kageki_sample_select = -1; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + DrvZ80ROM0 = Next; Next += 0x040000; + DrvZ80ROM1 = Next; Next += 0x020000; + DrvZ80ROM2 = Next; Next += 0x020000; + + DrvGfxROM = Next; Next += 0x400000; + + DrvColPROM = Next; Next += 0x000400; + + DrvSndROM = Next; Next += 0x010000; + + DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32); + + SampleBuffer = (INT16*)Next; Next += nBurnSoundLen * 2 * sizeof(INT16); + + AllRam = Next; + + DrvObjCtrl = Next; Next += 0x000004; + + DrvPalRAM = Next; Next += 0x000400; + DrvSprRAM = Next; Next += 0x002000; + DrvShareRAM = Next; Next += 0x001000; + DrvScrollRAM = Next; Next += 0x000100; + DrvVidRAM = Next; Next += 0x000200; + + DrvZ80RAM0 = Next; Next += 0x008000; + DrvZ80RAM1 = Next; Next += 0x001000; + DrvZ80RAM2 = Next; Next += 0x002000; + + coin_lockout = Next; Next += 0x000001; + soundlatch = Next; Next += 0x000001; + tnzs_bg_flag = Next; Next += 0x000001; + + RamEnd = Next; + + MemEnd = Next; + + return 0; +} + +static void kageki_sample_init() +{ + UINT8 *src = DrvSndROM + 0x0090; + + for (INT32 i = 0; i < 0x2f; i++) + { + INT32 start = (src[(i * 2) + 1] << 8) + src[(i * 2)]; + UINT8 *scan = &src[start]; + INT32 size = 0; + + while (1) { + if (*scan++ == 0x00) { + break; + } else { + size++; + } + } + + kageki_sample_data[i] = (INT16*)BurnMalloc(size * sizeof(INT16)); + kageki_sample_size[i] = size; + + if (start < 0x100) start = size = 0; + + INT16 *dest = kageki_sample_data[i]; + scan = &src[start]; + for (INT32 n = 0; n < size; n++) + { + *dest++ = ((*scan++) ^ 0x80) << 8; + } + } + + kageki_sample_gain = 1.00; + kageki_sample_output_dir = BURN_SND_ROUTE_BOTH; +} + +void kageki_sample_set_route(double nVolume, INT32 nRouteDir) +{ + kageki_sample_gain = nVolume; + kageki_sample_output_dir = nRouteDir; +} + +static void kageki_sample_exit() +{ + for (INT32 i = 0; i < 0x30; i++) { + BurnFree (kageki_sample_data[i]); + } +} + +static INT32 tnzs_gfx_decode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x200000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM, 0x200000); + + static INT32 Plane[4] = { 0xc00000, 0x800000, 0x400000, 0x000000 }; + static INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 }; + static INT32 YOffs[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184 }; + + GfxDecode(0x4000, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM); + + // the drawing routines allow for 0x4000 tiles, but some (most) games + // only have 0x2000. Mirroring the second half is cheaper and easier than + // masking the tile code. + if (memcmp (DrvGfxROM + 0x200000, DrvGfxROM + 0x300000, 0x100000) == 0) { + memcpy (DrvGfxROM + 0x200000, DrvGfxROM + 0x000000, 0x200000); + } + + BurnFree (tmp); + + return 0; +} + +static INT32 insectx_gfx_decode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x100000); + if (tmp == NULL) { + return 1; + } + + memcpy (tmp, DrvGfxROM, 0x100000); + + static INT32 Plane[4] = { 0x000008, 0x000000, 0x400008, 0x400000 }; + static INT32 XOffs[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }; + static INT32 YOffs[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 256, 272, 288, 304, 320, 336, 352, 368 }; + + GfxDecode(0x2000, 4, 16, 16, Plane, XOffs, YOffs, 0x200, tmp, DrvGfxROM); + + memcpy (DrvGfxROM + 0x200000, DrvGfxROM + 0x000000, 0x200000); + + BurnFree (tmp); + + return 0; +} + +static INT32 Type1Init(INT32 mcutype) +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + switch (mcutype) + { + case MCU_CHUKATAI: + { + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; + memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); + if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x020000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x080000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x0a0000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x100000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x120000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x180000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x1a0000, 11, 1)) return 1; + + if (tnzs_gfx_decode()) return 1; + } + break; + + case MCU_TNZS: + { + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; + memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x020000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x080000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x0a0000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x100000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x120000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x180000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x1a0000, 10, 1)) return 1; + + if (tnzs_gfx_decode()) return 1; + } + break; + + case MCU_DRTOPPEL: + { + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; + memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); + if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x020000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x080000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x0a0000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x100000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x120000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x180000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x1a0000, 11, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00001, 12, 2)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00000, 13, 2)) return 1; + + if (tnzs_gfx_decode()) return 1; + } + break; + + case MCU_EXTRMATN: + { + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; + memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); + if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x080000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x100000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x180000, 7, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00001, 8, 2)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00000, 9, 2)) return 1; + + if (tnzs_gfx_decode()) return 1; + } + break; + + case MCU_NONE_INSECTX: + { + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; + memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x000000, 2, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x080000, 3, 1)) return 1; + + insectx_gfx_decode(); + } + break; + + case MCU_ARKANOID: + { + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; + memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x080000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x100000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x180000, 6, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00001, 7, 2)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00000, 8, 2)) return 1; + + if (tnzs_gfx_decode()) return 1; + } + break; + + case MCU_PLUMPOP: + { + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; + memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); + if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x000000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x010000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x020000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x030000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x080000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x090000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x0a0000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x0b0000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x100000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x110000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x120000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x130000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x180000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x190000, 10, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x1a0000, 11, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x1b0000, 11, 1)) return 1; + + if (BurnLoadRom(DrvColPROM + 0x00001, 12, 2)) return 1; + if (BurnLoadRom(DrvColPROM + 0x00000, 13, 2)) return 1; + + if (tnzs_gfx_decode()) return 1; + } + break; + + case MCU_NONE_KAGEKI: + { + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; + memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); + if (BurnLoadRom(DrvZ80ROM0 + 0x20000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 2, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x020000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x080000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x0a0000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x100000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x120000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x180000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x1a0000, 10, 1)) return 1; + + if (BurnLoadRom(DrvSndROM + 0x000000, 11, 1)) return 1; + + if (tnzs_gfx_decode()) return 1; + + kageki_sample_init(); + } + break; + + case MCU_NONE_JPOPNICS: + { + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; + memcpy (DrvZ80ROM0 + 0x00000, DrvZ80ROM0 + 0x10000, 0x08000); + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 1, 1)) return 1; + + if (BurnLoadRom(DrvGfxROM + 0x000000, 2, 1)) return 1; + memcpy (DrvGfxROM + 0x020000, DrvGfxROM + 0x010000, 0x010000); + if (BurnLoadRom(DrvGfxROM + 0x080000, 3, 1)) return 1; + memcpy (DrvGfxROM + 0x0a0000, DrvGfxROM + 0x090000, 0x010000); + if (BurnLoadRom(DrvGfxROM + 0x100000, 4, 1)) return 1; + memcpy (DrvGfxROM + 0x120000, DrvGfxROM + 0x110000, 0x010000); + if (BurnLoadRom(DrvGfxROM + 0x180000, 5, 1)) return 1; + memcpy (DrvGfxROM + 0x1a0000, DrvGfxROM + 0x190000, 0x010000); + + if (tnzs_gfx_decode()) return 1; + } + break; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + 0x18000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + 0x18000); + ZetMapArea(0xc000, 0xdfff, 0, DrvSprRAM); + ZetMapArea(0xc000, 0xdfff, 1, DrvSprRAM); + ZetMapArea(0xe000, 0xeeff, 0, DrvShareRAM); + if (mcutype != MCU_TNZS) { + ZetMapArea(0xef00, 0xefff, 0, DrvShareRAM + 0x0f00); + } + ZetMapArea(0xe000, 0xefff, 1, DrvShareRAM); + ZetMapArea(0xe000, 0xefff, 2, DrvShareRAM); + ZetMapArea(0xf000, 0xf1ff, 0, DrvVidRAM); + ZetMapArea(0xf000, 0xf1ff, 1, DrvVidRAM); + ZetMapArea(0xf200, 0xf2ff, 1, DrvScrollRAM); + if (mcutype != MCU_DRTOPPEL) { + ZetMapArea(0xf800, 0xfbff, 0, DrvPalRAM); + ZetMapArea(0xf800, 0xfbff, 1, DrvPalRAM); + } + ZetSetWriteHandler(tnzs_cpu0_write); + ZetSetReadHandler(tnzs_cpu0_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x9fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x9fff, 2, DrvZ80ROM1); + ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM1); + ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM1); + ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM1); + ZetMapArea(0xe000, 0xefff, 0, DrvShareRAM); + ZetMapArea(0xe000, 0xefff, 1, DrvShareRAM); + ZetMapArea(0xe000, 0xefff, 2, DrvShareRAM); + ZetSetWriteHandler(tnzs_cpu1_write); + ZetSetReadHandler(tnzs_cpu1_read); + ZetClose(); + + ZetInit(2); // For common reset routine + + tnzs_mcu_init(mcutype); + + if (mcutype == MCU_NONE_JPOPNICS) { + BurnYM2151Init(3000000); // jpopnics + BurnYM2151SetAllRoutes(0.30, BURN_SND_ROUTE_BOTH); + } else { + BurnYM2203Init(1, 3000000, NULL, DrvSynchroniseStream, DrvGetTime, 0); + BurnYM2203SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); + + if (mcutype == MCU_NONE_KAGEKI) { + BurnYM2203SetPorts(0, &kageki_ym2203_portA, NULL, NULL, &kageki_ym2203_write_portB); + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.35, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.15, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.15, BURN_SND_ROUTE_BOTH); + } else { + BurnYM2203SetPorts(0, &tnzs_ym2203_portA, &tnzs_ym2203_portB, NULL, NULL); + } + } + + DACInit(0, 0, 1, kabukizSyncDAC); // kabukiz + DACSetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 Type2Init() +{ + AllMem = NULL; + MemIndex(); + INT32 nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; + memset(AllMem, 0, nLen); + MemIndex(); + + { + if (BurnLoadRom(DrvZ80ROM0 + 0x10000, 0, 1)) return 1; + memcpy (DrvZ80ROM0, DrvZ80ROM0 + 0x10000, 0x08000); + + if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 1, 1)) return 1; + + if (BurnLoadRom(DrvZ80ROM2 + 0x00000, 2, 1)) return 1; + + if (strncmp(BurnDrvGetTextA(DRV_NAME), "kabukiz", 7) == 0) { + if (BurnLoadRom(DrvGfxROM + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x080000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x100000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x180000, 6, 1)) return 1; + } else { + if (BurnLoadRom(DrvGfxROM + 0x000000, 3, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x020000, 4, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x080000, 5, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x0a0000, 6, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x100000, 7, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x120000, 8, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x180000, 9, 1)) return 1; + if (BurnLoadRom(DrvGfxROM + 0x1a0000, 10, 1)) return 1; + } + + if (tnzs_gfx_decode()) return 1; + } + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); + ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM0 + 0x18000); + ZetMapArea(0x8000, 0xbfff, 1, DrvZ80ROM0 + 0x18000); + ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM0 + 0x18000); + ZetMapArea(0xc000, 0xdfff, 0, DrvSprRAM); + ZetMapArea(0xc000, 0xdfff, 1, DrvSprRAM); + ZetMapArea(0xc000, 0xdfff, 2, DrvSprRAM); + ZetMapArea(0xe000, 0xeeff, 0, DrvShareRAM); + if (strncmp(BurnDrvGetTextA(DRV_NAME), "kabukiz", 7) == 0) { + ZetMapArea(0xef00, 0xefff, 0, DrvShareRAM + 0x0f00); + } + ZetMapArea(0xe000, 0xefff, 1, DrvShareRAM); + ZetMapArea(0xe000, 0xefff, 2, DrvShareRAM); + ZetMapArea(0xf000, 0xf1ff, 0, DrvVidRAM); + ZetMapArea(0xf000, 0xf1ff, 1, DrvVidRAM); + ZetMapArea(0xf000, 0xf1ff, 2, DrvVidRAM); + ZetMapArea(0xf200, 0xf2ff, 0, DrvScrollRAM); + ZetMapArea(0xf200, 0xf2ff, 1, DrvScrollRAM); + ZetSetWriteHandler(tnzs_cpu0_write); + ZetSetReadHandler(tnzs_cpu0_read); + ZetClose(); + + ZetInit(1); + ZetOpen(1); + ZetMapArea(0x0000, 0x9fff, 0, DrvZ80ROM1); + ZetMapArea(0x0000, 0x9fff, 2, DrvZ80ROM1); + ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM1); + ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM1); + ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM1); + ZetMapArea(0xe000, 0xefff, 0, DrvShareRAM); + ZetMapArea(0xe000, 0xefff, 1, DrvShareRAM); + ZetMapArea(0xe000, 0xefff, 2, DrvShareRAM); + ZetMapArea(0xf000, 0xf3ff, 1, DrvPalRAM); // tnzsb + ZetMapArea(0xf800, 0xfbff, 1, DrvPalRAM); // kabukiz + ZetSetWriteHandler(tnzsb_cpu1_write); + ZetSetReadHandler(tnzsb_cpu1_read); + ZetClose(); + + ZetInit(2); + ZetOpen(2); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM2 + 0x0000); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM2 + 0x0000); + ZetMapArea(0xc000, 0xdfff, 0, DrvZ80RAM2); // tnzsb + ZetMapArea(0xc000, 0xdfff, 1, DrvZ80RAM2); + ZetMapArea(0xc000, 0xdfff, 2, DrvZ80RAM2); + ZetMapArea(0xe000, 0xffff, 0, DrvZ80RAM2); // kabukiz + ZetMapArea(0xe000, 0xffff, 1, DrvZ80RAM2); + ZetMapArea(0xe000, 0xffff, 2, DrvZ80RAM2); + ZetSetOutHandler(tnzs_cpu2_out); + ZetSetInHandler(tnzs_cpu2_in); + ZetClose(); + + BurnYM2203Init(1, 3000000, &DrvYM2203IRQHandler, DrvSynchroniseStream, DrvGetTime, 0); + BurnYM2203SetPorts(0, NULL, NULL, &kabukiz_sound_bankswitch, &kabukiz_dac_write); + BurnTimerAttachZet(6000000); + BurnYM2203SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH); + + if (strncmp(BurnDrvGetTextA(DRV_NAME), "kabukiz", 7) == 0 || strncmp(BurnDrvGetTextA(DRV_NAME), "tnzsb", 5) == 0) { + BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 2.00, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 1.00, BURN_SND_ROUTE_BOTH); + BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 1.00, BURN_SND_ROUTE_BOTH); + } + + DACInit(0, 0, 1, kabukizSyncDAC); // kabukiz + + GenericTilesInit(); + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + GenericTilesExit(); + + ZetExit(); + + if (tnzs_mcu_type() != MCU_NONE_JPOPNICS) BurnYM2203Exit(); + if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) BurnYM2151Exit(); + DACExit(); + + BurnFree (AllMem); + + if (tnzs_mcu_type() == MCU_NONE_KAGEKI) { + kageki_sample_exit(); + } + + tnzs_mcu_init(0); + + return 0; +} + +// Stolen from TMNT. Thanks to Barry. :) +static void kageki_sample_render(INT16 *pSoundBuf, INT32 nLength) +{ + memset(pSoundBuf, 0, nLength * sizeof(INT16) * 2); + if (kageki_sample_select == -1) return; + + double Addr = kageki_sample_pos; + double Step = (double)7000 / nBurnSoundRate; + + double size = kageki_sample_size[kageki_sample_select]; + INT16 *ptr = kageki_sample_data[kageki_sample_select]; + + for (INT32 i = 0; i < nLength; i += 2) { + if (Addr >= size) break; + INT16 Sample = ptr[(INT32)Addr]; + +// pSoundBuf[i ] = Sample; +// pSoundBuf[i + 1] = Sample; + INT16 nLeftSample = 0, nRightSample = 0; + + if ((kageki_sample_output_dir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) { + nLeftSample += (INT32)(Sample * kageki_sample_gain); + } + if ((kageki_sample_output_dir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) { + nRightSample += (INT32)(Sample * kageki_sample_gain); + } + + pSoundBuf[i + 0] += nLeftSample; + pSoundBuf[i + 1] += nRightSample; + + Addr += Step; + } + + kageki_sample_pos = Addr; + if (Addr >= size) kageki_sample_select = -1; +} + +static void draw_16x16(INT32 sx, INT32 sy, INT32 code, INT32 color, INT32 flipx, INT32 flipy, INT32 transp) +{ + if (transp) { + if (flipy) { + if (flipx) { + Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM); + } else { + Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM); + } + } else { + if (flipx) { + Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM); + } else { + Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM); + } + } + } else { + if (flipy) { + if (flipx) { + Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM); + } else { + Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM); + } + } else { + if (flipx) { + Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM); + } else { + Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM); + } + } + } +} + +static void draw_background(INT32 ctrl, INT32 flipscreen) +{ + INT32 scrollx, scrolly; + UINT8 *m = DrvSprRAM + 0x400; + + if ((ctrl ^ (ctrl << 1)) & 0x40) + { + m += 0x800; + } + + INT32 transpen = (*tnzs_bg_flag & 0x80) ^ 0x80; + + INT32 tot = DrvObjCtrl[1] & 0x1f; + if (tot == 1) tot = 16; + + UINT32 upperbits = DrvObjCtrl[2] | (DrvObjCtrl[3] << 8); + + for (INT32 column = 0; column < tot; column++) + { + scrollx = DrvScrollRAM[(column << 4) | 4] - ((upperbits & 0x01) << 8); + if (flipscreen) + scrolly = DrvScrollRAM[column << 4] + 1 - 256; + else + scrolly = -DrvScrollRAM[column << 4] + 1; + + for (INT32 y = 0; y < 16; y++) + { + for (INT32 x = 0; x < 2; x++) + { + INT32 i = ((column ^ 8) << 5) | (y << 1) | x; + + INT32 code = m[i + 0x0000] | ((m[i + 0x1000] & 0x3f) << 8); + INT32 color = m[i + 0x1200] >> 3; + INT32 flipx = m[i + 0x1000] & 0x80; + INT32 flipy = m[i + 0x1000] & 0x40; + INT32 sx = x << 4; + INT32 sy = y << 4; + if (flipscreen) + { + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + sy = (sy + scrolly) & 0xff; + sx += scrollx; + + if (sx >= nScreenWidth || sx < -15 || sy >= nScreenHeight + 16 || sy < 1) continue; + + draw_16x16(sx, sy - 16, code, color, flipx, flipy, transpen); + } + } + + upperbits >>= 1; + } +} + +static void draw_foreground(INT32 ctrl, INT32 flipscreen) +{ + UINT8 *char_pointer = DrvSprRAM + 0x0000; + UINT8 *x_pointer = DrvSprRAM + 0x0200; + UINT8 *y_pointer = DrvVidRAM + 0x0000; + UINT8 *ctrl_pointer = DrvSprRAM + 0x1000; + UINT8 *color_pointer = DrvSprRAM + 0x1200; + + if ((ctrl ^ (ctrl << 1)) & 0x40) + { + char_pointer += 0x800; + x_pointer += 0x800; + ctrl_pointer += 0x800; + color_pointer += 0x800; + } + + for (INT32 i = 0x1ff; i >= 0; i--) + { + INT32 code = char_pointer[i] + ((ctrl_pointer[i] & 0x3f) << 8); + INT32 color = (color_pointer[i] & 0xf8) >> 3; + INT32 sx = x_pointer[i] - ((color_pointer[i] & 1) << 8); + INT32 sy = 240 - y_pointer[i]; + INT32 flipx = ctrl_pointer[i] & 0x80; + INT32 flipy = ctrl_pointer[i] & 0x40; + if (flipscreen) + { + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + if ((sy == 0) && (code == 0)) sy += 240; + } + + if (sx >= nScreenWidth || sx < -15) continue; + + draw_16x16(sx, sy - 14, code, color, flipx, flipy, 1); + } +} + +static inline void DrvRecalcPalette() +{ + UINT8 r,g,b; + if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { + for (INT32 i = 0; i < 0x400; i+=2) { + UINT16 pal = (DrvPalRAM[i] << 8) | DrvPalRAM[i | 1]; + + r = (pal >> 4) & 0x0f; + g = (pal >> 12) & 0x0f; + b = (pal >> 8) & 0x0f; + + r |= r << 4; + g |= g << 4; + b |= b << 4; + + DrvPalette[i / 2] = BurnHighCol(r, g, b, 0); + } + } else { + for (INT32 i = 0; i < 0x400; i+=2) { + UINT16 pal = (DrvPalRAM[i | 1] << 8) | DrvPalRAM[i]; + + r = (pal >> 10) & 0x1f; + g = (pal >> 5) & 0x1f; + b = (pal >> 0) & 0x1f; + + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + DrvPalette[i / 2] = BurnHighCol(r, g, b, 0); + } + } +} + +static void sprite_buffer(INT32 ctrl) +{ + if (ctrl & 0x20) + { + if (ctrl & 0x40) { + memcpy (DrvSprRAM + 0x0000, DrvSprRAM + 0x0800, 0x0400); + memcpy (DrvSprRAM + 0x1000, DrvSprRAM + 0x1800, 0x0400); + } else { + memcpy (DrvSprRAM + 0x0800, DrvSprRAM + 0x0000, 0x0400); + memcpy (DrvSprRAM + 0x1800, DrvSprRAM + 0x1000, 0x0400); + } + + memcpy (DrvSprRAM + 0x0400, DrvSprRAM + 0x0c00, 0x0400); + memcpy (DrvSprRAM + 0x1400, DrvSprRAM + 0x1c00, 0x0400); + } +} + +static INT32 DrvDraw() +{ + DrvRecalcPalette(); + + INT32 flip = DrvObjCtrl[0] & 0x40; + INT32 ctrl = (DrvObjCtrl[1] & 0x60) ^ 0x20; + + for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { + pTransDraw[i] = 0x1f0; + } + + draw_background(ctrl, flip); + draw_foreground(ctrl, flip); + + BurnTransferCopy(DrvPalette); + + sprite_buffer(ctrl); + + return 0; +} + +static void assemble_inputs() +{ + tnzs_mcu_inputs = DrvInputs; + memset (DrvInputs, 0xff, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] ^= DrvJoy1[i] << i; + DrvInputs[1] ^= DrvJoy2[i] << i; + DrvInputs[2] ^= DrvJoy3[i] << i; + } + + nAnalogAxis[0] -= DrvAxis[0] << 7; + nAnalogAxis[1] -= DrvAxis[1] << 7; +} + +static INT32 DrvFrame() +{ + if (DrvReset) { + DrvDoReset(); + } + + ZetNewFrame(); + + assemble_inputs(); + + INT32 nInterleave = 100; + if (tnzs_mcu_type() == MCU_NONE_KAGEKI) nInterleave = nBurnSoundLen; + INT32 nSoundBufferPos = 0; + + INT32 nCyclesSegment; + INT32 nCyclesDone[3], nCyclesTotal[3]; + + nCyclesTotal[0] = 6000000 / 60; + nCyclesTotal[1] = 6000000 / 60; + nCyclesTotal[2] = 6000000 / 60; + + nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; + + INT32 irq_trigger[2] = { nInterleave - 2, nInterleave - 1 }; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU, nNext; + + // Run Z80 #0 + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + if (i == irq_trigger[0]) { + tnzs_mcu_interrupt(); + ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + } + if (i == irq_trigger[1]) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + // Run Z80 #1 + nCurrentCPU = 1; + ZetOpen(nCurrentCPU); + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (cpu1_reset == 0) { + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += nCyclesSegment; + } + if (i == irq_trigger[0]) ZetSetIRQLine(0, ZET_IRQSTATUS_ACK); + if (i == irq_trigger[1]) ZetSetIRQLine(0, ZET_IRQSTATUS_NONE); + ZetClose(); + + // Run Z80 #2 + if (tnzs_mcu_type() == MCU_NONE) + { + nCurrentCPU = 2; + ZetOpen(nCurrentCPU); + BurnTimerUpdate(i * (nCyclesTotal[nCurrentCPU] / nInterleave)); + ZetClose(); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + INT16* pSoundBuf2 = SampleBuffer + (nSoundBufferPos << 1); + ZetOpen(2); + if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + kageki_sample_render(pSoundBuf2, nSegmentLength); + ZetClose(); + nSoundBufferPos += nSegmentLength; + } + } + + ZetOpen(2); + if (tnzs_mcu_type() == MCU_NONE) { + BurnTimerEndFrame(nCyclesTotal[2]); + } + + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + INT16* pSoundBuf2 = SampleBuffer + (nSoundBufferPos << 1); + if (nSegmentLength) { + if (tnzs_mcu_type() == MCU_NONE_JPOPNICS) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + } + kageki_sample_render(pSoundBuf2, nSegmentLength); + } + } + + if (tnzs_mcu_type() != MCU_NONE_JPOPNICS) { + if (pBurnSoundOut) { + BurnYM2203Update(pBurnSoundOut, nBurnSoundLen); + DACUpdate(pBurnSoundOut, nBurnSoundLen); + for (INT32 i = 0; i < nBurnSoundLen; i++) { + pBurnSoundOut[(i << 1) + 0] += SampleBuffer[(i << 1) + 0]; + pBurnSoundOut[(i << 1) + 1] += SampleBuffer[(i << 1) + 1]; + } + } + } + + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); + } + + return 0; +} + +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { + *pnMin = 0x029707; + } + + if (nAction & ACB_VOLATILE) { + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); + + BurnYM2203Scan(nAction, pnMin); + BurnYM2151Scan(nAction); + DACScan(nAction, pnMin); + + tnzs_mcu_scan(); + + SCAN_VAR(tnzs_banks[0]); + SCAN_VAR(tnzs_banks[1]); + SCAN_VAR(tnzs_banks[2]); + SCAN_VAR(cpu1_reset); + + SCAN_VAR(nAnalogAxis[0]); + SCAN_VAR(nAnalogAxis[1]); + + SCAN_VAR(kageki_csport_sel); + SCAN_VAR(kageki_sample_pos); + SCAN_VAR(kageki_sample_select); + } + + if (nAction & ACB_WRITE) { + ZetOpen(0); + bankswitch0(tnzs_banks[0]); + ZetClose(); + + ZetOpen(1); + bankswitch1(tnzs_banks[1]); + ZetClose(); + + ZetOpen(2); + kabukiz_sound_bankswitch(0,tnzs_banks[2]); + ZetClose(); + } + + return 0; +} + + +// Plump Pop (Japan) + +static struct BurnRomInfo plumppopRomDesc[] = { + { "a98-09.bin", 0x10000, 0x107f9e06, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "a98-10.bin", 0x10000, 0xdf6e6af2, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "a98-11.bin", 0x10000, 0xbc56775c, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "plmp8742.bin", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU + + { "a98-01.bin", 0x10000, 0xf3033dca, 4 | BRF_GRA }, // 4 Graphics + { "a98-02.bin", 0x10000, 0xf2d17b0c, 4 | BRF_GRA }, // 5 + { "a98-03.bin", 0x10000, 0x1a519b0a, 4 | BRF_GRA }, // 6 + { "a98-04.bin", 0x10000, 0xb64501a1, 4 | BRF_GRA }, // 7 + { "a98-05.bin", 0x10000, 0x45c36963, 4 | BRF_GRA }, // 8 + { "a98-06.bin", 0x10000, 0xe075341b, 4 | BRF_GRA }, // 9 + { "a98-07.bin", 0x10000, 0x8e16cd81, 4 | BRF_GRA }, // 10 + { "a98-08.bin", 0x10000, 0xbfa7609a, 4 | BRF_GRA }, // 11 + + { "a98-13.bpr", 0x00200, 0x7cde2da5, 5 | BRF_GRA }, // 12 Color PROMs + { "a98-12.bpr", 0x00200, 0x90dc9da7, 5 | BRF_GRA }, // 13 +}; + +STD_ROM_PICK(plumppop) +STD_ROM_FN(plumppop) + +static INT32 PlumppopInit() +{ + return Type1Init(MCU_PLUMPOP); +} + +struct BurnDriver BurnDrvPlumppop = { + "plumppop", NULL, NULL, NULL, "1987", + "Plump Pop (Japan)\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, plumppopRomInfo, plumppopRomName, NULL, NULL, PlumppopInputInfo, PlumppopDIPInfo, + PlumppopInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Extermination (World) + +static struct BurnRomInfo extrmatnRomDesc[] = { + { "b06-05.11c", 0x10000, 0x918e1fe3, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b06-06.9c", 0x10000, 0x8842e105, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b06-19.4e", 0x10000, 0x8de43ed9, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "extr8742.4f", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU + + { "b06-01.13a", 0x20000, 0xd2afbf7e, 4 | BRF_GRA }, // 4 Graphics + { "b06-02.10a", 0x20000, 0xe0c2757a, 4 | BRF_GRA }, // 5 + { "b06-03.7a", 0x20000, 0xee80ab9d, 4 | BRF_GRA }, // 6 + { "b06-04.4a", 0x20000, 0x3697ace4, 4 | BRF_GRA }, // 7 + + { "b06-09.15f", 0x00200, 0xf388b361, 5 | BRF_GRA }, // 8 Color PROMs + { "b06-08.17f", 0x00200, 0x10c9aac3, 5 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(extrmatn) +STD_ROM_FN(extrmatn) + +static INT32 ExtrmatnInit() +{ + return Type1Init(MCU_EXTRMATN); +} + +struct BurnDriver BurnDrvExtrmatn = { + "extrmatn", NULL, NULL, NULL, "1987", + "Extermination (World)\0", NULL, "Taito Corporation Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, extrmatnRomInfo, extrmatnRomName, NULL, NULL, CommonInputInfo, ExtrmatnDIPInfo, + ExtrmatnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Extermination (US) + +static struct BurnRomInfo extrmatuRomDesc[] = { + { "b06-20.11c", 0x10000, 0x04e3fc1f, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b06-21.9c", 0x10000, 0x1614d6a2, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b06-22.4e", 0x10000, 0x744f2c84, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "extr8742.4f", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU + + { "b06-01.13a", 0x20000, 0xd2afbf7e, 4 | BRF_GRA }, // 4 Graphics + { "b06-02.10a", 0x20000, 0xe0c2757a, 4 | BRF_GRA }, // 5 + { "b06-03.7a", 0x20000, 0xee80ab9d, 4 | BRF_GRA }, // 6 + { "b06-04.4a", 0x20000, 0x3697ace4, 4 | BRF_GRA }, // 7 + + { "b06-09.15f", 0x00200, 0xf388b361, 5 | BRF_GRA }, // 8 Color PROMs + { "b06-08.17f", 0x00200, 0x10c9aac3, 5 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(extrmatu) +STD_ROM_FN(extrmatu) + +struct BurnDriver BurnDrvExtrmatu = { + "extrmatnu", "extrmatn", NULL, NULL, "1987", + "Extermination (US)\0", NULL, "[Taito] World Games", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, extrmatuRomInfo, extrmatuRomName, NULL, NULL, CommonInputInfo, ExtrmatnDIPInfo, + ExtrmatnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Extermination (Japan) + +static struct BurnRomInfo extrmatjRomDesc[] = { + { "b06-05.11c", 0x10000, 0x918e1fe3, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b06-06.9c", 0x10000, 0x8842e105, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b06-07.4e", 0x10000, 0xb37fb8b3, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "extr8742.4f", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU + + { "b06-01.13a", 0x20000, 0xd2afbf7e, 4 | BRF_GRA }, // 4 Graphics + { "b06-02.10a", 0x20000, 0xe0c2757a, 4 | BRF_GRA }, // 5 + { "b06-03.7a", 0x20000, 0xee80ab9d, 4 | BRF_GRA }, // 6 + { "b06-04.4a", 0x20000, 0x3697ace4, 4 | BRF_GRA }, // 7 + + { "b06-09.15f", 0x00200, 0xf388b361, 5 | BRF_GRA }, // 8 Color PROMs + { "b06-08.17f", 0x00200, 0x10c9aac3, 5 | BRF_GRA }, // 9 +}; + +STD_ROM_PICK(extrmatj) +STD_ROM_FN(extrmatj) + +struct BurnDriver BurnDrvExtrmatj = { + "extrmatnj", "extrmatn", NULL, NULL, "1987", + "Extermination (Japan)\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, extrmatjRomInfo, extrmatjRomName, NULL, NULL, CommonInputInfo, ExtrmatnDIPInfo, + ExtrmatnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid - Revenge of DOH (World) + +static struct BurnRomInfo arknoid2RomDesc[] = { + { "b08_05.11c", 0x10000, 0x136edf9d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "b08_13.3e", 0x10000, 0xe8035ef1, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "ark28742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 2 I8742 MCU + + { "b08-01.13a", 0x20000, 0x2ccc86b4, 4 | BRF_GRA }, // 3 Graphics + { "b08-02.10a", 0x20000, 0x056a985f, 4 | BRF_GRA }, // 4 + { "b08-03.7a", 0x20000, 0x274a795f, 4 | BRF_GRA }, // 5 + { "b08-04.4a", 0x20000, 0x9754f703, 4 | BRF_GRA }, // 6 + + { "b08-08.15f", 0x00200, 0xa4f7ebd9, 5 | BRF_GRA }, // 7 Color PROMs + { "b08-07.16f", 0x00200, 0xea34d9f7, 5 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(arknoid2) +STD_ROM_FN(arknoid2) + +static INT32 Arknoid2Init() +{ + return Type1Init(MCU_ARKANOID); +} + +struct BurnDriver BurnDrvArknoid2 = { + "arknoid2", NULL, NULL, NULL, "1987", + "Arkanoid - Revenge of DOH (World)\0", NULL, "Taito Corporation Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, arknoid2RomInfo, arknoid2RomName, NULL, NULL, Arknoid2InputInfo, Arknoid2DIPInfo, + Arknoid2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid - Revenge of DOH (US) + +static struct BurnRomInfo arknid2uRomDesc[] = { + { "b08_11.11c", 0x10000, 0x99555231, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "b08_12.3e", 0x10000, 0xdc84e27d, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "ark28742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 2 I8742 MCU + + { "b08-01.13a", 0x20000, 0x2ccc86b4, 4 | BRF_GRA }, // 3 Graphics + { "b08-02.10a", 0x20000, 0x056a985f, 4 | BRF_GRA }, // 4 + { "b08-03.7a", 0x20000, 0x274a795f, 4 | BRF_GRA }, // 5 + { "b08-04.4a", 0x20000, 0x9754f703, 4 | BRF_GRA }, // 6 + + { "b08-08.15f", 0x00200, 0xa4f7ebd9, 5 | BRF_GRA }, // 7 Color PROMs + { "b08-07.16f", 0x00200, 0xea34d9f7, 5 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(arknid2u) +STD_ROM_FN(arknid2u) + +struct BurnDriver BurnDrvArknid2u = { + "arknoid2u", "arknoid2", NULL, NULL, "1987", + "Arkanoid - Revenge of DOH (US)\0", NULL, "Taito America Corporation (Romstar license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, arknid2uRomInfo, arknid2uRomName, NULL, NULL, Arknoid2InputInfo, Arknid2uDIPInfo, + Arknoid2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid - Revenge of DOH (Japan) + +static struct BurnRomInfo arknid2jRomDesc[] = { + { "b08_05.11c", 0x10000, 0x136edf9d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "b08_06.3e", 0x10000, 0xadfcd40c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "ark28742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 2 I8742 MCU + + { "b08-01.13a", 0x20000, 0x2ccc86b4, 4 | BRF_GRA }, // 3 Graphics + { "b08-02.10a", 0x20000, 0x056a985f, 4 | BRF_GRA }, // 4 + { "b08-03.7a", 0x20000, 0x274a795f, 4 | BRF_GRA }, // 5 + { "b08-04.4a", 0x20000, 0x9754f703, 4 | BRF_GRA }, // 6 + + { "b08-08.15f", 0x00200, 0xa4f7ebd9, 5 | BRF_GRA }, // 7 Color PROMs + { "b08-07.16f", 0x00200, 0xea34d9f7, 5 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(arknid2j) +STD_ROM_FN(arknid2j) + +struct BurnDriver BurnDrvArknid2j = { + "arknoid2j", "arknoid2", NULL, NULL, "1987", + "Arkanoid - Revenge of DOH (Japan)\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, arknid2jRomInfo, arknid2jRomName, NULL, NULL, Arknoid2InputInfo, Arknid2uDIPInfo, + Arknoid2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Arkanoid - Revenge of DOH (Japan bootleg) + +static struct BurnRomInfo arknid2bRomDesc[] = { + { "boot.11c", 0x10000, 0x3847dfb0, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "b08_13.3e", 0x10000, 0xe8035ef1, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "ark28742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 2 I8742 MCU + + { "b08-01.13a", 0x20000, 0x2ccc86b4, 4 | BRF_GRA }, // 3 Graphics + { "b08-02.10a", 0x20000, 0x056a985f, 4 | BRF_GRA }, // 4 + { "b08-03.7a", 0x20000, 0x274a795f, 4 | BRF_GRA }, // 5 + { "b08-04.4a", 0x20000, 0x9754f703, 4 | BRF_GRA }, // 6 + + { "b08-08.15f", 0x00200, 0xa4f7ebd9, 5 | BRF_GRA }, // 7 Color PROMs + { "b08-07.16f", 0x00200, 0xea34d9f7, 5 | BRF_GRA }, // 8 +}; + +STD_ROM_PICK(arknid2b) +STD_ROM_FN(arknid2b) + +struct BurnDriver BurnDrvArknid2b = { + "arknoid2b", "arknoid2", NULL, NULL, "1987", + "Arkanoid - Revenge of DOH (Japan bootleg)\0", NULL, "bootleg", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, arknid2bRomInfo, arknid2bRomName, NULL, NULL, Arknoid2InputInfo, Arknid2uDIPInfo, + Arknoid2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Dr. Toppel's Adventure (World) + +static struct BurnRomInfo drtoppelRomDesc[] = { + { "b19-09.11c", 0x10000, 0x3e654f82, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b19-10.9c", 0x10000, 0x7e72fd25, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b19-15.3e", 0x10000, 0x37a0d3fb, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "drt8742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU + + { "b19-01.13a", 0x20000, 0xa7e8a0c1, 4 | BRF_GRA }, // 4 Graphics + { "b19-02.12a", 0x20000, 0x790ae654, 4 | BRF_GRA }, // 5 + { "b19-03.10a", 0x20000, 0x495c4c5a, 4 | BRF_GRA }, // 6 + { "b19-04.8a", 0x20000, 0x647007a0, 4 | BRF_GRA }, // 7 + { "b19-05.7a", 0x20000, 0x49f2b1a5, 4 | BRF_GRA }, // 8 + { "b19-06.5a", 0x20000, 0x2d39f1d0, 4 | BRF_GRA }, // 9 + { "b19-07.4a", 0x20000, 0x8bb06f41, 4 | BRF_GRA }, // 10 + { "b19-08.2a", 0x20000, 0x3584b491, 4 | BRF_GRA }, // 11 + + { "b19-13.15f", 0x00200, 0x6a547980, 5 | BRF_GRA }, // 12 Color PROMs + { "b19-12.16f", 0x00200, 0x5754e9d8, 5 | BRF_GRA }, // 13 +}; + +STD_ROM_PICK(drtoppel) +STD_ROM_FN(drtoppel) + +static INT32 DrtoppelInit() +{ + return Type1Init(MCU_DRTOPPEL); +} + +struct BurnDriver BurnDrvDrtoppel = { + "drtoppel", NULL, NULL, NULL, "1987", + "Dr. Toppel's Adventure (World)\0", NULL, "Taito Corporation Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, drtoppelRomInfo, drtoppelRomName, NULL, NULL, CommonInputInfo, DrtoppelDIPInfo, + DrtoppelInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Dr. Toppel's Adventure (US) + +static struct BurnRomInfo drtoppluRomDesc[] = { + { "b19-09.11c", 0x10000, 0x3e654f82, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b19-10.9c", 0x10000, 0x7e72fd25, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b19-14.3e", 0x10000, 0x05565b22, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "drt8742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU + + { "b19-01.13a", 0x20000, 0xa7e8a0c1, 4 | BRF_GRA }, // 4 Graphics + { "b19-02.12a", 0x20000, 0x790ae654, 4 | BRF_GRA }, // 5 + { "b19-03.10a", 0x20000, 0x495c4c5a, 4 | BRF_GRA }, // 6 + { "b19-04.8a", 0x20000, 0x647007a0, 4 | BRF_GRA }, // 7 + { "b19-05.7a", 0x20000, 0x49f2b1a5, 4 | BRF_GRA }, // 8 + { "b19-06.5a", 0x20000, 0x2d39f1d0, 4 | BRF_GRA }, // 9 + { "b19-07.4a", 0x20000, 0x8bb06f41, 4 | BRF_GRA }, // 10 + { "b19-08.2a", 0x20000, 0x3584b491, 4 | BRF_GRA }, // 11 + + { "b19-13.15f", 0x00200, 0x6a547980, 5 | BRF_GRA }, // 12 Color PROMs + { "b19-12.16f", 0x00200, 0x5754e9d8, 5 | BRF_GRA }, // 13 +}; + +STD_ROM_PICK(drtopplu) +STD_ROM_FN(drtopplu) + +struct BurnDriver BurnDrvDrtopplu = { + "drtoppelu", "drtoppel", NULL, NULL, "1987", + "Dr. Toppel's Adventure (US)\0", NULL, "Taito America Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, drtoppluRomInfo, drtoppluRomName, NULL, NULL, CommonInputInfo, DrtoppluDIPInfo, + DrtoppelInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Dr. Toppel's Tankentai (Japan) + +static struct BurnRomInfo drtoppljRomDesc[] = { + { "b19-09.11c", 0x10000, 0x3e654f82, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b19-10.9c", 0x10000, 0x7e72fd25, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b19-11.3e", 0x10000, 0x524dc249, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "drt8742.3g", 0x00800, 0x00000000, 3 | BRF_NODUMP }, // 3 I8742 MCU + + { "b19-01.13a", 0x20000, 0xa7e8a0c1, 4 | BRF_GRA }, // 4 Graphics + { "b19-02.12a", 0x20000, 0x790ae654, 4 | BRF_GRA }, // 5 + { "b19-03.10a", 0x20000, 0x495c4c5a, 4 | BRF_GRA }, // 6 + { "b19-04.8a", 0x20000, 0x647007a0, 4 | BRF_GRA }, // 7 + { "b19-05.7a", 0x20000, 0x49f2b1a5, 4 | BRF_GRA }, // 8 + { "b19-06.5a", 0x20000, 0x2d39f1d0, 4 | BRF_GRA }, // 9 + { "b19-07.4a", 0x20000, 0x8bb06f41, 4 | BRF_GRA }, // 10 + { "b19-08.2a", 0x20000, 0x3584b491, 4 | BRF_GRA }, // 11 + + { "b19-13.15f", 0x00200, 0x6a547980, 5 | BRF_GRA }, // 12 Color PROMs + { "b19-12.16f", 0x00200, 0x5754e9d8, 5 | BRF_GRA }, // 13 +}; + +STD_ROM_PICK(drtopplj) +STD_ROM_FN(drtopplj) + +struct BurnDriver BurnDrvDrtopplj = { + "drtoppelj", "drtoppel", NULL, NULL, "1987", + "Dr. Toppel's Tankentai (Japan)\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, drtoppljRomInfo, drtoppljRomName, NULL, NULL, CommonInputInfo, DrtoppluDIPInfo, + DrtoppelInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Kageki (US) + +static struct BurnRomInfo kagekiRomDesc[] = { + { "b35-16.11c", 0x10000, 0xa4e6fd58, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b35-10.9c", 0x10000, 0xb150457d, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b35-17.43e", 0x10000, 0xfdd9c246, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "b35-01.13a", 0x20000, 0x01d83a69, 4 | BRF_GRA }, // 3 Graphics + { "b35-02.12a", 0x20000, 0xd8af47ac, 4 | BRF_GRA }, // 4 + { "b35-03.10a", 0x20000, 0x3cb68797, 4 | BRF_GRA }, // 5 + { "b35-04.8a", 0x20000, 0x71c03f91, 4 | BRF_GRA }, // 6 + { "b35-05.7a", 0x20000, 0xa4e20c08, 4 | BRF_GRA }, // 7 + { "b35-06.5a", 0x20000, 0x3f8ab658, 4 | BRF_GRA }, // 8 + { "b35-07.4a", 0x20000, 0x1b4af049, 4 | BRF_GRA }, // 9 + { "b35-08.2a", 0x20000, 0xdeb2268c, 4 | BRF_GRA }, // 10 + + { "b35-15.98g", 0x10000, 0xe6212a0f, 6 | BRF_SND }, // 11 Samples +}; + +STD_ROM_PICK(kageki) +STD_ROM_FN(kageki) + +static INT32 KagekiInit() +{ + return Type1Init(MCU_NONE_KAGEKI); +} + +struct BurnDriver BurnDrvKageki = { + "kageki", NULL, NULL, NULL, "1988", + "Kageki (US)\0", "Imperfect Sound", "Taito America Corporation (Romstar license)", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, kagekiRomInfo, kagekiRomName, NULL, NULL, CommonInputInfo, KagekiDIPInfo, + KagekiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Kageki (Japan) + +static struct BurnRomInfo kagekijRomDesc[] = { + { "b35-09.11c", 0x10000, 0x829637d5, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b35-10.9c", 0x10000, 0xb150457d, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b35-11.43e", 0x10000, 0x64d093fc, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "b35-01.13a", 0x20000, 0x01d83a69, 4 | BRF_GRA }, // 3 Graphics + { "b35-02.12a", 0x20000, 0xd8af47ac, 4 | BRF_GRA }, // 4 + { "b35-03.10a", 0x20000, 0x3cb68797, 4 | BRF_GRA }, // 5 + { "b35-04.8a", 0x20000, 0x71c03f91, 4 | BRF_GRA }, // 6 + { "b35-05.7a", 0x20000, 0xa4e20c08, 4 | BRF_GRA }, // 7 + { "b35-06.5a", 0x20000, 0x3f8ab658, 4 | BRF_GRA }, // 8 + { "b35-07.4a", 0x20000, 0x1b4af049, 4 | BRF_GRA }, // 9 + { "b35-08.2a", 0x20000, 0xdeb2268c, 4 | BRF_GRA }, // 10 + + { "b35-12.98g", 0x10000, 0x184409f1, 6 | BRF_SND }, // 11 Samples +}; + +STD_ROM_PICK(kagekij) +STD_ROM_FN(kagekij) + +struct BurnDriver BurnDrvKagekij = { + "kagekij", "kageki", NULL, NULL, "1988", + "Kageki (Japan)\0", "Imperfect Sound", "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, kagekijRomInfo, kagekijRomName, NULL, NULL, CommonInputInfo, KagekiDIPInfo, + KagekiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Kageki (hack) + +static struct BurnRomInfo kagekihRomDesc[] = { + { "b35_16.11c", 0x10000, 0x1cf67603, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b35-10.9c", 0x10000, 0xb150457d, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b35-11.43e", 0x10000, 0x64d093fc, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "b35-01.13a", 0x20000, 0x01d83a69, 4 | BRF_GRA }, // 3 Graphics + { "b35-02.12a", 0x20000, 0xd8af47ac, 4 | BRF_GRA }, // 4 + { "b35-03.10a", 0x20000, 0x3cb68797, 4 | BRF_GRA }, // 5 + { "b35-04.8a", 0x20000, 0x71c03f91, 4 | BRF_GRA }, // 6 + { "b35-05.7a", 0x20000, 0xa4e20c08, 4 | BRF_GRA }, // 7 + { "b35-06.5a", 0x20000, 0x3f8ab658, 4 | BRF_GRA }, // 8 + { "b35-07.4a", 0x20000, 0x1b4af049, 4 | BRF_GRA }, // 9 + { "b35-08.2a", 0x20000, 0xdeb2268c, 4 | BRF_GRA }, // 10 + + { "b35-12.98g", 0x10000, 0x184409f1, 6 | BRF_SND }, // 11 Samples +}; + +STD_ROM_PICK(kagekih) +STD_ROM_FN(kagekih) + +struct BurnDriver BurnDrvKagekih = { + "kagekih", "kageki", NULL, NULL, "1992", + "Kageki (hack)\0", "Imperfect Sound", "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, kagekihRomInfo, kagekihRomName, NULL, NULL, CommonInputInfo, KagekiDIPInfo, + KagekiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 224, 256, 3, 4 +}; + + +// Chuka Taisen (World) + +static struct BurnRomInfo chukataiRomDesc[] = { + { "b44-10", 0x10000, 0x8c69e008, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b44-11", 0x10000, 0x32484094, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b44-12w", 0x10000, 0xe80ecdca, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "b44-8742.mcu", 0x00800, 0x7dff3f9f, 3 | BRF_PRG | BRF_OPT }, // 3 I8742 MCU + + { "b44-01.a13", 0x20000, 0xaae7b3d5, 4 | BRF_GRA }, // 4 Graphics + { "b44-02.a12", 0x20000, 0x7f0b9568, 4 | BRF_GRA }, // 5 + { "b44-03.a10", 0x20000, 0x5a54a3b9, 4 | BRF_GRA }, // 6 + { "b44-04.a08", 0x20000, 0x3c5f544b, 4 | BRF_GRA }, // 7 + { "b44-05.a07", 0x20000, 0xd1b7e314, 4 | BRF_GRA }, // 8 + { "b44-06.a05", 0x20000, 0x269978a8, 4 | BRF_GRA }, // 9 + { "b44-07.a04", 0x20000, 0x3e0e737e, 4 | BRF_GRA }, // 10 + { "b44-08.a02", 0x20000, 0x6cb1e8fc, 4 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(chukatai) +STD_ROM_FN(chukatai) + +static INT32 ChukataiInit() +{ + return Type1Init(MCU_CHUKATAI); +} + +struct BurnDriver BurnDrvChukatai = { + "chukatai", NULL, NULL, NULL, "1988", + "Chuka Taisen (World)\0", NULL, "Taito Corporation Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, chukataiRomInfo, chukataiRomName, NULL, NULL, CommonInputInfo, ChukataiDIPInfo, + ChukataiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Chuka Taisen (US) + +static struct BurnRomInfo chukatauRomDesc[] = { + { "b44-10", 0x10000, 0x8c69e008, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b44-11", 0x10000, 0x32484094, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b44-12u", 0x10000, 0x9f09fd5c, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "b44-8742.mcu", 0x00800, 0x7dff3f9f, 3 | BRF_PRG | BRF_OPT }, // 3 I8742 MCU + + { "b44-01.a13", 0x20000, 0xaae7b3d5, 4 | BRF_GRA }, // 4 Graphics + { "b44-02.a12", 0x20000, 0x7f0b9568, 4 | BRF_GRA }, // 5 + { "b44-03.a10", 0x20000, 0x5a54a3b9, 4 | BRF_GRA }, // 6 + { "b44-04.a08", 0x20000, 0x3c5f544b, 4 | BRF_GRA }, // 7 + { "b44-05.a07", 0x20000, 0xd1b7e314, 4 | BRF_GRA }, // 8 + { "b44-06.a05", 0x20000, 0x269978a8, 4 | BRF_GRA }, // 9 + { "b44-07.a04", 0x20000, 0x3e0e737e, 4 | BRF_GRA }, // 10 + { "b44-08.a02", 0x20000, 0x6cb1e8fc, 4 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(chukatau) +STD_ROM_FN(chukatau) + +struct BurnDriver BurnDrvChukatau = { + "chukataiu", "chukatai", NULL, NULL, "1988", + "Chuka Taisen (US)\0", NULL, "Taito America Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, chukatauRomInfo, chukatauRomName, NULL, NULL, CommonInputInfo, ChukatauDIPInfo, + ChukataiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Chuka Taisen (Japan) + +static struct BurnRomInfo chukatajRomDesc[] = { + { "b44-10", 0x10000, 0x8c69e008, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + { "b44-11", 0x10000, 0x32484094, 1 | BRF_PRG | BRF_ESS }, // 1 + + { "b44-12", 0x10000, 0x0600ace6, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 #1 Code + + { "b44-8742.mcu", 0x00800, 0x7dff3f9f, 3 | BRF_PRG | BRF_OPT }, // 3 I8742 MCU + + { "b44-01.a13", 0x20000, 0xaae7b3d5, 4 | BRF_GRA }, // 4 Graphics + { "b44-02.a12", 0x20000, 0x7f0b9568, 4 | BRF_GRA }, // 5 + { "b44-03.a10", 0x20000, 0x5a54a3b9, 4 | BRF_GRA }, // 6 + { "b44-04.a08", 0x20000, 0x3c5f544b, 4 | BRF_GRA }, // 7 + { "b44-05.a07", 0x20000, 0xd1b7e314, 4 | BRF_GRA }, // 8 + { "b44-06.a05", 0x20000, 0x269978a8, 4 | BRF_GRA }, // 9 + { "b44-07.a04", 0x20000, 0x3e0e737e, 4 | BRF_GRA }, // 10 + { "b44-08.a02", 0x20000, 0x6cb1e8fc, 4 | BRF_GRA }, // 11 +}; + +STD_ROM_PICK(chukataj) +STD_ROM_FN(chukataj) + +struct BurnDriver BurnDrvChukataj = { + "chukataij", "chukatai", NULL, NULL, "1988", + "Chuka Taisen (Japan)\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, chukatajRomInfo, chukatajRomName, NULL, NULL, CommonInputInfo, ChukatauDIPInfo, + ChukataiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// The NewZealand Story (World, newer) + +static struct BurnRomInfo tnzsRomDesc[] = { + { "b53-24.1", 0x20000, 0xd66824c6, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "b53-25.3", 0x10000, 0xd6ac4e71, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "b53-26.34", 0x10000, 0xcfd5649c, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code + + { "b53-16.8", 0x20000, 0xc3519c2a, 4 | BRF_GRA }, // 3 Graphics + { "b53-17.7", 0x20000, 0x2bf199e8, 4 | BRF_GRA }, // 4 + { "b53-18.6", 0x20000, 0x92f35ed9, 4 | BRF_GRA }, // 5 + { "b53-19.5", 0x20000, 0xedbb9581, 4 | BRF_GRA }, // 6 + { "b53-22.4", 0x20000, 0x59d2aef6, 4 | BRF_GRA }, // 7 + { "b53-23.3", 0x20000, 0x74acfb9b, 4 | BRF_GRA }, // 8 + { "b53-20.2", 0x20000, 0x095d0dc0, 4 | BRF_GRA }, // 9 + { "b53-21.1", 0x20000, 0x9800c54d, 4 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(tnzs) +STD_ROM_FN(tnzs) + +struct BurnDriver BurnDrvtnzs = { + "tnzs", NULL, NULL, NULL, "1988", + "The NewZealand Story (World, newer)\0", NULL, "Taito Corporation Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, tnzsRomInfo, tnzsRomName, NULL, NULL, CommonInputInfo, TnzsDIPInfo, + Type2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// The NewZealand Story (Japan, newer) + +static struct BurnRomInfo tnzsjRomDesc[] = { + { "b53-24.1", 0x20000, 0xd66824c6, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "b53-27.u3", 0x10000, 0xb3415fc3, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "b53-26.34", 0x10000, 0xcfd5649c, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code + + { "b53-16.8", 0x20000, 0xc3519c2a, 4 | BRF_GRA }, // 3 Graphics + { "b53-17.7", 0x20000, 0x2bf199e8, 4 | BRF_GRA }, // 4 + { "b53-18.6", 0x20000, 0x92f35ed9, 4 | BRF_GRA }, // 5 + { "b53-19.5", 0x20000, 0xedbb9581, 4 | BRF_GRA }, // 6 + { "b53-22.4", 0x20000, 0x59d2aef6, 4 | BRF_GRA }, // 7 + { "b53-23.3", 0x20000, 0x74acfb9b, 4 | BRF_GRA }, // 8 + { "b53-20.2", 0x20000, 0x095d0dc0, 4 | BRF_GRA }, // 9 + { "b53-21.1", 0x20000, 0x9800c54d, 4 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(tnzsj) +STD_ROM_FN(tnzsj) + +struct BurnDriver BurnDrvtnzsj = { + "tnzsj", "tnzs", NULL, NULL, "1988", + "The NewZealand Story (Japan, new version, newer PCB)\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0, + NULL, tnzsjRomInfo, tnzsjRomName, NULL, NULL, CommonInputInfo, TnzsjDIPInfo, + Type2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// The NewZealand Story (Japan, old version) (older PCB) + +static struct BurnRomInfo tnzsjoRomDesc[] = { + { "b53-10.32", 0x20000, 0xa73745c6, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "b53-11.38", 0x10000, 0x9784d443, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "b53-09.u46", 0x00800, 0xa4bfce19, 3 | BRF_PRG | BRF_OPT }, // 2 I8742 MCU + + { "b53-08.8", 0x20000, 0xc3519c2a, 4 | BRF_GRA }, // 3 Graphics + { "b53-07.7", 0x20000, 0x2bf199e8, 4 | BRF_GRA }, // 4 + { "b53-06.6", 0x20000, 0x92f35ed9, 4 | BRF_GRA }, // 5 + { "b53-05.5", 0x20000, 0xedbb9581, 4 | BRF_GRA }, // 6 + { "b53-04.4", 0x20000, 0x59d2aef6, 4 | BRF_GRA }, // 7 + { "b53-03.3", 0x20000, 0x74acfb9b, 4 | BRF_GRA }, // 8 + { "b53-02.2", 0x20000, 0x095d0dc0, 4 | BRF_GRA }, // 9 + { "b53-01.1", 0x20000, 0x9800c54d, 4 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(tnzsjo) +STD_ROM_FN(tnzsjo) + +static INT32 TnzsoInit() +{ + return Type1Init(MCU_TNZS); +} + +struct BurnDriver BurnDrvTnzsjo = { + "tnzsjo", "tnzs", NULL, NULL, "1988", + "The NewZealand Story (Japan, old version) (older PCB)\0", NULL, "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, tnzsjoRomInfo, tnzsjoRomName, NULL, NULL, CommonInputInfo, TnzsjoDIPInfo, + TnzsoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// The NewZealand Story (World, old version) (older PCB) + +static struct BurnRomInfo tnzsoRomDesc[] = { + { "u32", 0x20000, 0xedf3b39e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "u38", 0x10000, 0x60340d63, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "b53-06.u46", 0x00800, 0xa4bfce19, 3 | BRF_PRG | BRF_OPT }, // 2 I8742 MCU + + { "b53-08.8", 0x20000, 0xc3519c2a, 4 | BRF_GRA }, // 3 Graphics + { "b53-07.7", 0x20000, 0x2bf199e8, 4 | BRF_GRA }, // 4 + { "b53-06.6", 0x20000, 0x92f35ed9, 4 | BRF_GRA }, // 5 + { "b53-05.5", 0x20000, 0xedbb9581, 4 | BRF_GRA }, // 6 + { "b53-04.4", 0x20000, 0x59d2aef6, 4 | BRF_GRA }, // 7 + { "b53-03.3", 0x20000, 0x74acfb9b, 4 | BRF_GRA }, // 8 + { "b53-02.2", 0x20000, 0x095d0dc0, 4 | BRF_GRA }, // 9 + { "b53-01.1", 0x20000, 0x9800c54d, 4 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(tnzso) +STD_ROM_FN(tnzso) + +struct BurnDriver BurnDrvTnzso = { + "tnzso", "tnzs", NULL, NULL, "1988", + "The NewZealand Story (World, old version) (older PCB)\0", NULL, "Taito Corporation Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, tnzsoRomInfo, tnzsoRomName, NULL, NULL, CommonInputInfo, TnzsopDIPInfo, + TnzsoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// The NewZealand Story (World, prototype?) (older PCB) + +static struct BurnRomInfo tnzsopRomDesc[] = { + { "ns_c-11.rom", 0x20000, 0x3c1dae7b, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "ns_e-3.rom", 0x10000, 0xc7662e96, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "b53-09.u46", 0x00800, 0xa4bfce19, 3 | BRF_PRG | BRF_OPT }, // 2 I8742 MCU + + { "ns_a13.rom", 0x20000, 0x7e0bd5bb, 4 | BRF_GRA }, // 3 Graphics + { "ns_a12.rom", 0x20000, 0x95880726, 4 | BRF_GRA }, // 4 + { "ns_a10.rom", 0x20000, 0x2bc4c053, 4 | BRF_GRA }, // 5 + { "ns_a08.rom", 0x20000, 0x8ff8d88c, 4 | BRF_GRA }, // 6 + { "ns_a07.rom", 0x20000, 0x291bcaca, 4 | BRF_GRA }, // 7 + { "ns_a05.rom", 0x20000, 0x6e762e20, 4 | BRF_GRA }, // 8 + { "ns_a04.rom", 0x20000, 0xe1fd1b9d, 4 | BRF_GRA }, // 9 + { "ns_a02.rom", 0x20000, 0x2ab06bda, 4 | BRF_GRA }, // 10 +}; + +STD_ROM_PICK(tnzsop) +STD_ROM_FN(tnzsop) + +struct BurnDriver BurnDrvTnzsop = { + "tnzsop", "tnzs", NULL, NULL, "1988", + "The NewZealand Story (World, prototype?) (older PCB)\0", NULL, "Taito Corporation Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, tnzsopRomInfo, tnzsopRomName, NULL, NULL, CommonInputInfo, TnzsopDIPInfo, + TnzsoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Kabuki-Z (World) + +static struct BurnRomInfo kabukizRomDesc[] = { + { "b50-05.u1", 0x20000, 0x9cccb129, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "b50-08.1e", 0x10000, 0xcb92d34c, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "b50-07.u34", 0x20000, 0xbf7fc2ed, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code + + { "b50-04.u35", 0x80000, 0x04829aa9, 4 | BRF_GRA }, // 3 Graphics + { "b50-03.u39", 0x80000, 0x31489a4c, 4 | BRF_GRA }, // 4 + { "b50-02.u43", 0x80000, 0x90b8a8e7, 4 | BRF_GRA }, // 5 + { "b50-01.u46", 0x80000, 0xf4277751, 4 | BRF_GRA }, // 6 +}; + +STD_ROM_PICK(kabukiz) +STD_ROM_FN(kabukiz) + +struct BurnDriverD BurnDrvKabukiz = { + "kabukiz", NULL, NULL, NULL, "1988", + "Kabuki-Z (World)\0", "Imperfect graphics", "Taito Corporation Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, kabukizRomInfo, kabukizRomName, NULL, NULL, CommonInputInfo, KabukizDIPInfo, + Type2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Kabuki-Z (Japan) + +static struct BurnRomInfo kabukizjRomDesc[] = { + { "b50-05.u1", 0x20000, 0x9cccb129, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "b50-06.u3", 0x10000, 0x45650aab, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "b50-07.u34", 0x20000, 0xbf7fc2ed, 3 | BRF_PRG | BRF_ESS }, // 2 Z80 #2 Code + + { "b50-04.u35", 0x80000, 0x04829aa9, 4 | BRF_GRA }, // 3 Graphics + { "b50-03.u39", 0x80000, 0x31489a4c, 4 | BRF_GRA }, // 4 + { "b50-02.u43", 0x80000, 0x90b8a8e7, 4 | BRF_GRA }, // 5 + { "b50-01.u46", 0x80000, 0xf4277751, 4 | BRF_GRA }, // 6 +}; + +STD_ROM_PICK(kabukizj) +STD_ROM_FN(kabukizj) + +struct BurnDriverD BurnDrvKabukizj = { + "kabukizj", "kabukiz", NULL, NULL, "1988", + "Kabuki-Z (Japan)\0", "Imperfect graphics", "Taito Corporation", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, kabukizjRomInfo, kabukizjRomName, NULL, NULL, CommonInputInfo, KabukizjDIPInfo, + Type2Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Insector X (World) + +static struct BurnRomInfo insectxRomDesc[] = { + { "b97-03.u32", 0x20000, 0x18eef387, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "b97-07.u38", 0x10000, 0x324b28c9, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "b97-01.u1", 0x80000, 0xd00294b1, 4 | BRF_GRA }, // 2 Graphics + { "b97-02.u2", 0x80000, 0xdb5a7434, 4 | BRF_GRA }, // 3 +}; + +STD_ROM_PICK(insectx) +STD_ROM_FN(insectx) + +static INT32 InsectxInit() +{ + return Type1Init(MCU_NONE_INSECTX); +} + +struct BurnDriver BurnDrvInsectx = { + "insectx", NULL, NULL, NULL, "1989", + "Insector X (World)\0", NULL, "Taito Corporation Japan", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, insectxRomInfo, insectxRomName, NULL, NULL, InsectxInputInfo, InsectxDIPInfo, + InsectxInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; + + +// Jumping Pop (Nics, Korean bootleg of Plump Pop) + +static struct BurnRomInfo jpopnicsRomDesc[] = { + { "u96cpu2", 0x20000, 0x649e951c, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code + + { "u124cpu1", 0x10000, 0x8453e8e4, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 #1 Code + + { "u94gfx", 0x20000, 0xe49f2fdd, 4 | BRF_GRA }, // 2 Graphics + { "u93gfx", 0x20000, 0xa7791b5b, 4 | BRF_GRA }, // 3 + { "u92gfx", 0x20000, 0xb30caac7, 4 | BRF_GRA }, // 4 + { "u91gfx", 0x20000, 0x18ada5f2, 4 | BRF_GRA }, // 5 +}; + +STD_ROM_PICK(jpopnics) +STD_ROM_FN(jpopnics) + +static INT32 JpopnicsInit() +{ + return Type1Init(MCU_NONE_JPOPNICS); +} + +struct BurnDriver BurnDrvJpopnics = { + "jpopnics", NULL, NULL, NULL, "1992", + "Jumping Pop (Nics, Korean bootleg of Plump Pop)\0", "Imperfect graphics", "Nics", "Miscellaneous", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MISC, 0, + NULL, jpopnicsRomInfo, jpopnicsRomName, NULL, NULL, JpopnicsInputInfo, JpopnicsDIPInfo, + JpopnicsInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200, + 256, 224, 4, 3 +}; diff --git a/src/burn/drv/toaplan/d_batrider.cpp b/src/burn/drv/toaplan/d_batrider.cpp index aceff1d79..7805c7d50 100644 --- a/src/burn/drv/toaplan/d_batrider.cpp +++ b/src/burn/drv/toaplan/d_batrider.cpp @@ -1,1157 +1,1156 @@ -#include "toaplan.h" -// Batrider - -static UINT8 drvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 drvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 drvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 drvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static UINT8 drvRegion = 0; -static UINT8 drvReset = 0; -static UINT8 bDrawScreen; - -static UINT8 nIRQPending; -static bool bVBlank; - -static INT32 nData; - -static INT32 nCurrentBank; -static INT32 nTextROMStatus; - -static void Map68KTextROM(bool bMapTextROM); - -static struct BurnInputInfo batriderInputList[] = { - {"P1 Coin", BIT_DIGITAL, drvButton + 3, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, drvButton + 5, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, drvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, drvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, drvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, drvJoy1 + 3, "p1 right"}, - {"P1 Shoot 1", BIT_DIGITAL, drvJoy1 + 4, "p1 fire 1"}, - {"P1 Shoot 2", BIT_DIGITAL, drvJoy1 + 5, "p1 fire 2"}, - {"P1 Shoot 3", BIT_DIGITAL, drvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, drvButton + 4, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, drvButton + 6, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, drvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, drvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, drvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, drvJoy2 + 3, "p2 right"}, - {"P2 Shoot 1", BIT_DIGITAL, drvJoy2 + 4, "p2 fire 1"}, - {"P2 Shoot 2", BIT_DIGITAL, drvJoy2 + 5, "p2 fire 2"}, - {"P2 Shoot 3", BIT_DIGITAL, drvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &drvReset, "reset"}, - {"Test", BIT_DIGITAL, drvButton + 2, "diag"}, - {"Service", BIT_DIGITAL, drvButton + 0, "service"}, - {"Dip 1", BIT_DIPSWITCH, drvInput + 3, "dip"}, - {"Dip 2", BIT_DIPSWITCH, drvInput + 4, "dip"}, - {"Dip 3", BIT_DIPSWITCH, drvInput + 5, "dip"}, - {"Region", BIT_DIPSWITCH, &drvRegion , "dip"}, -}; - -STDINPUTINFO(batrider) - - -static struct BurnDIPInfo batriderDIPList[] = { - // Defaults - {0x15, 0xFF, 0xFF, 0x00, NULL}, - {0x16, 0xFF, 0xFF, 0x00, NULL}, - {0x17, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, "Test mode"}, - {0x15, 0x01, 0x01, 0x00, "Normal"}, - {0x15, 0x01, 0x01, 0x01, "Test"}, - // Normal - {0, 0xFE, 0, 2, "Starting coin"}, - {0x15, 0x82, 0x02, 0x00, "1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0x02, 0x02, "2 credits"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - // Free play - {0, 0xFE, 0, 2, "Stick mode"}, - {0x15, 0x02, 0x02, 0x00, "Normal"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x02, 0x02, 0x02, "Special"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - // Both - {0, 0xFE, 0, 8, "Coin 1"}, - {0x15, 0x01, 0x1C, 0x00, "1 coin 1 credit"}, - {0x15, 0x01, 0x1C, 0x04, "1 coin 2 credits"}, - {0x15, 0x01, 0x1C, 0x08, "1 coin 3 credits"}, - {0x15, 0x01, 0x1C, 0x0C, "1 coin 4 credits"}, - {0x15, 0x01, 0x1C, 0x10, "2 coins 1 credit"}, - {0x15, 0x01, 0x1C, 0x14, "3 coins 1 credit"}, - {0x15, 0x01, 0x1C, 0x18, "4 coins 1 credit"}, - {0x15, 0x01, 0x1C, 0x1C, "Free Play"}, - // 0x1C: Free play settings active - // Normal - {0, 0xFE, 0, 7, "Coin 2"}, - {0x15, 0x82, 0xE0, 0x00, "1 coin 1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0x20, "1 coin 2 credits"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0x40, "1 coin 3 credits"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0x60, "1 coin 4 credits"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0x80, "2 coins 1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0xA0, "3 coins 1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0xC0, "4 coins 1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0xE0, "1 coin 1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - // Free play - {0, 0xFE, 0, 2, "Hit score"}, - {0x15, 0x02, 0x20, 0x00, "Off"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x02, 0x20, 0x20, "On"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0, 0xFE, 0, 2, "Sound effect"}, - {0x15, 0x02, 0x40, 0x00, "Off"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x02, 0x40, 0x40, "On"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0, 0xFE, 0, 2, "Music"}, - {0x15, 0x02, 0x80, 0x00, "Off"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x02, 0x80, 0x80, "On"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - - // DIP 2 - {0, 0xFE, 0, 4, "Start rank"}, - {0x16, 0x01, 0x03, 0x00, "Normal"}, - {0x16, 0x01, 0x03, 0x01, "Easy"}, - {0x16, 0x01, 0x03, 0x02, "Hard"}, - {0x16, 0x01, 0x03, 0x03, "Very hard"}, - {0, 0xFE, 0, 4, "Timer rank"}, - {0x16, 0x01, 0x0C, 0x00, "Normal"}, - {0x16, 0x01, 0x0C, 0x04, "Low"}, - {0x16, 0x01, 0x0C, 0x08, "High"}, - {0x16, 0x01, 0x0C, 0x0C, "Highest"}, - {0, 0xFE, 0, 4, "Player counts"}, - {0x16, 0x01, 0x30, 0x00, "3"}, - {0x16, 0x01, 0x30, 0x10, "4"}, - {0x16, 0x01, 0x30, 0x20, "2"}, - {0x16, 0x01, 0x30, 0x30, "1"}, - {0, 0xFE, 0, 4, "Extra player"}, - {0x16, 0x01, 0xC0, 0x00, "1500000 each"}, - {0x16, 0x01, 0xC0, 0x40, "1000000 each"}, - {0x16, 0x01, 0xC0, 0x80, "2000000 each"}, - {0x16, 0x01, 0xC0, 0xC0, "No extra player"}, - - // DIP 3 - {0, 0xFE, 0, 2, "Screen flip"}, - {0x17, 0x01, 0x01, 0x00, "Off"}, - {0x17, 0x01, 0x01, 0x01, "On"}, - {0, 0xFE, 0, 2, "Demo sound"}, - {0x17, 0x01, 0x02, 0x00, "On"}, - {0x17, 0x01, 0x02, 0x02, "Off"}, - {0, 0xFE, 0, 2, "Stage edit"}, - {0x17, 0x01, 0x04, 0x00, "Disable"}, - {0x17, 0x01, 0x04, 0x04, "Enable"}, - {0, 0xFE, 0, 2, "Continue play"}, - {0x17, 0x01, 0x08, 0x00, "Enable"}, - {0x17, 0x01, 0x08, 0x08, "Disable"}, - {0, 0xFE, 0, 2, "Invincible"}, - {0x17, 0x01, 0x10, 0x00, "Off"}, - {0x17, 0x01, 0x10, 0x10, "On"}, - // Free play - {0, 0xFE, 0, 2, "Guest Players"}, - {0x17, 0x02, 0x20, 0x00, "Disable"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x17, 0x02, 0x20, 0x20, "Enable"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0, 0xFE, 0, 2, "Player select"}, - {0x17, 0x02, 0x40, 0x00, "Disable"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x17, 0x02, 0x40, 0x40, "Enable"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0, 0xFE, 0, 2, "Special Course"}, - {0x17, 0x02, 0x80, 0x00, "Disable"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x17, 0x02, 0x80, 0x80, "Enable"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - - // Region - {0, 0xFD, 0, 26, "Region"}, - {0x18, 0x01, 0x1F, 0x00, "Nippon"}, - {0x18, 0x01, 0x1F, 0x01, "U.S.A."}, - {0x18, 0x01, 0x1F, 0x02, "Europe"}, - {0x18, 0x01, 0x1F, 0x03, "Asia"}, - {0x18, 0x01, 0x1F, 0x04, "German"}, - {0x18, 0x01, 0x1F, 0x05, "Austria"}, - {0x18, 0x01, 0x1F, 0x06, "Belgium"}, - {0x18, 0x01, 0x1F, 0x07, "Denmark"}, - {0x18, 0x01, 0x1F, 0x08, "Finland"}, - {0x18, 0x01, 0x1F, 0x09, "France"}, - {0x18, 0x01, 0x1F, 0x0A, "Great Britain"}, - {0x18, 0x01, 0x1F, 0x0B, "Greece"}, - {0x18, 0x01, 0x1F, 0x0C, "Holland"}, - {0x18, 0x01, 0x1F, 0x0D, "Italy"}, - {0x18, 0x01, 0x1F, 0x0E, "Norway"}, - {0x18, 0x01, 0x1F, 0x0F, "Portugal"}, - {0x18, 0x01, 0x1F, 0x10, "Spain"}, - {0x18, 0x01, 0x1F, 0x11, "Sweden"}, - {0x18, 0x01, 0x1F, 0x12, "Switzerland"}, - {0x18, 0x01, 0x1F, 0x13, "Australia"}, - {0x18, 0x01, 0x1F, 0x14, "New Zealand"}, - {0x18, 0x01, 0x1F, 0x15, "Taiwan"}, - {0x18, 0x01, 0x1F, 0x16, "HongKong"}, - {0x18, 0x01, 0x1F, 0x17, "Korea"}, - {0x18, 0x01, 0x1F, 0x18, "China"}, - {0x18, 0x01, 0x1F, 0x19, "World"}, -}; - -static struct BurnDIPInfo batriderRegionDIPList[] = { - // Defaults - {0x18, 0xFF, 0xFF, 0x00, NULL}, -}; - -static struct BurnDIPInfo batridRegionDIPList[] = { - // Defaults - {0x18, 0xFF, 0xFF, 0x02, NULL}, -}; - -static struct BurnDIPInfo batriduRegionDIPList[] = { - // Defaults - {0x18, 0xFF, 0xFF, 0x01, NULL}, -}; - -static struct BurnDIPInfo batridcRegionDIPList[] = { - // Defaults - {0x18, 0xFF, 0xFF, 0x18, NULL}, -}; - -static struct BurnDIPInfo batridkRegionDIPList[] = { - // Defaults - {0x18, 0xFF, 0xFF, 0x17, NULL}, -}; - -static struct BurnDIPInfo batridtaRegionDIPList[] = { - // Defaults - {0x18, 0xFF, 0xFF, 0x15, NULL}, -}; - -STDDIPINFOEXT(batrider, batriderRegion, batrider) -STDDIPINFOEXT(batrid, batridRegion, batrider) -STDDIPINFOEXT(batridu, batriduRegion, batrider) -STDDIPINFOEXT(batridc, batridcRegion, batrider) -STDDIPINFOEXT(batridk, batridkRegion, batrider) -STDDIPINFOEXT(batridta, batridtaRegion, batrider) - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *Ram01, *Ram02, *RamPal; -UINT8 *RamShared; -static INT32 nColCount = 0x0800; - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x200000; // 68000 ROM - RomZ80 = Next; Next += 0x040000; // Z80 ROM - GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // Tile data - MSM6295ROM = Next; Next += 0x200000; // MSM6295 ADPCM data - RamStart = Next; - ExtraTRAM = Next; Next += 0x002000; // Extra text layer - Ram01 = Next; Next += 0x005000; // RAM + Extra text layer scroll/offset - ExtraTROM = Next; Next += 0x008000; // Extra text layer tile data - Ram02 = Next; Next += 0x008000; // CPU #0 work RAM - RamPal = Next; Next += 0x001000; // Palette - RamZ80 = Next; Next += 0x004000; // Z80 RAM - GP9001RAM[0]= Next; Next += 0x004000; - GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); - RamShared = Next; Next += 0x000008; // Shared data - RamEnd = Next; - ToaPalette = (UINT32*)Next; Next += nColCount * sizeof(UINT32); - MemEnd = Next; - - ExtraTSelect= Ram01; // Extra text layer scroll - ExtraTScroll= Ram01 + 0x000200; // Extra text layer offset - - return 0; -} - -static void drvZ80Bankswitch(INT32 nBank) -{ - nBank &= 0x0F; - if (nBank != nCurrentBank) { - UINT8* nStartAddress = RomZ80 + (nBank << 14); - ZetMapArea(0x8000, 0xBFFF, 0, nStartAddress); - ZetMapArea(0x8000, 0xBFFF, 2, nStartAddress); - - nCurrentBank = nBank; - } -} - -// Scan ram -static INT32 drvScan(INT32 nAction, INT32* pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029496; - } - if (nAction & ACB_VOLATILE) { // Scan volatile ram - - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); // Scan 68000 - ZetScan(nAction); // Scan Z80 - SCAN_VAR(nCurrentBank); - - MSM6295Scan(0, nAction); - MSM6295Scan(1, nAction); - BurnYM2151Scan(nAction); - - ToaScanGP9001(nAction, pnMin); - - SCAN_VAR(nIRQPending); - SCAN_VAR(nTextROMStatus); - - SCAN_VAR(drvInput); - - if (nAction & ACB_WRITE) { - INT32 n = nTextROMStatus; - nTextROMStatus = -1; - SekOpen(0); - Map68KTextROM(n); - SekClose(); - - n = nCurrentBank; - nCurrentBank = -1; - ZetOpen(0); - drvZ80Bankswitch(n); - ZetClose(); - } - } - - return 0; -} - -static INT32 LoadRoms() -{ - // Load 68000 ROMs - if (ToaLoadCode(Rom01, 0, 4)) { - return 1; - } - - // Load GP9001 tile data - ToaLoadGP9001Tiles(GP9001ROM[0], 4, 4, nGP9001ROMSize[0]); - - // Load the Z80 ROM - if (BurnLoadRom(RomZ80, 8, 1)) { - return 1; - } - - // Load MSM6295 ADPCM data - BurnLoadRom(MSM6295ROM + 0x000000, 9, 1); - BurnLoadRom(MSM6295ROM + 0x100000, 10, 1); - - return 0; -} - -UINT8 __fastcall batriderZIn(UINT16 nAddress) -{ - nAddress &= 0xFF; - - switch (nAddress) { - - // The sound commands sent by the 68000 are read from these locations - case 0x48: - return RamShared[0]; - case 0x4A: - return RamShared[1]; - - case 0x81: - return BurnYM2151ReadStatus(); - case 0x82: - return MSM6295ReadStatus(0); - case 0x84: - return MSM6295ReadStatus(1); - } - - return 0; -} - -void __fastcall batriderZOut(UINT16 nAddress, UINT8 nValue) -{ - nAddress &= 0xFF; - - switch (nAddress) { - - // The 68000 expects to read back the sound command it sent - case 0x40: - RamShared[4] = nValue; - break; - case 0x42: - RamShared[5] = nValue; - break; - - case 0x44: // ??? - case 0x46: // Acknowledge interrupt - break; - - case 0x80: - BurnYM2151SelectRegister(nValue); - break; - case 0x81: - BurnYM2151WriteRegister(nValue); - break; - - case 0x82: - MSM6295Command(0, nValue); - break; - case 0x84: - MSM6295Command(1, nValue); - break; - - case 0x88: { - drvZ80Bankswitch(nValue); - break; - - case 0xC0: - MSM6295SampleInfo[0][0] = MSM6295ROM + ((nValue & 0x0F) << 16); - MSM6295SampleData[0][0] = MSM6295ROM + ((nValue & 0x0F) << 16); - MSM6295SampleInfo[0][1] = MSM6295ROM + ((nValue & 0xF0) << 12) + 0x0100; - MSM6295SampleData[0][1] = MSM6295ROM + ((nValue & 0xF0) << 12); - break; - case 0xC2: - MSM6295SampleInfo[0][2] = MSM6295ROM + ((nValue & 0x0F) << 16) + 0x0200; - MSM6295SampleData[0][2] = MSM6295ROM + ((nValue & 0x0F) << 16); - MSM6295SampleInfo[0][3] = MSM6295ROM + ((nValue & 0xF0) << 12) + 0x0300; - MSM6295SampleData[0][3] = MSM6295ROM + ((nValue & 0xF0) << 12); - break; - case 0xC4: - MSM6295SampleInfo[1][0] = MSM6295ROM + 0x0100000 + ((nValue & 0x0F) << 16); - MSM6295SampleData[1][0] = MSM6295ROM + 0x0100000 + ((nValue & 0x0F) << 16); - MSM6295SampleInfo[1][1] = MSM6295ROM + 0x0100000 + ((nValue & 0xF0) << 12) + 0x0100; - MSM6295SampleData[1][1] = MSM6295ROM + 0x0100000 + ((nValue & 0xF0) << 12); - break; - case 0xC6: - MSM6295SampleInfo[1][2] = MSM6295ROM + 0x0100000 + ((nValue & 0x0F) << 16) + 0x0200; - MSM6295SampleData[1][2] = MSM6295ROM + 0x0100000 + ((nValue & 0x0F) << 16); - MSM6295SampleInfo[1][3] = MSM6295ROM + 0x0100000 + ((nValue & 0xF0) << 12) + 0x0300; - MSM6295SampleData[1][3] = MSM6295ROM + 0x0100000 + ((nValue & 0xF0) << 12); - break; - } - } -} - -static INT32 drvZInit() -{ - // Init the Z80 - ZetInit(0); - ZetOpen(0); - - ZetSetInHandler(batriderZIn); - ZetSetOutHandler(batriderZOut); - - // ROM bank 1 - ZetMapArea(0x0000, 0x7FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM - ZetMapArea(0x0000, 0x7FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM - // ROM bank 2 - ZetMapArea(0x8000, 0xBFFF, 0, RomZ80 + 0x8000); // Direct Read from ROM - ZetMapArea(0x8000, 0xBFFF, 2, RomZ80 + 0x8000); // - // RAM - ZetMapArea(0xC000, 0xDFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea(0xC000, 0xDFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea(0xC000, 0xDFFF, 2, RamZ80); // - - ZetMemEnd(); - ZetClose(); - - nCurrentBank = 2; - - return 0; -} - -UINT8 __fastcall batriderReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x500000: // Player 2 inputs - return drvInput[1]; - case 0x500001: // Player 1 inputs - return drvInput[0]; - case 0x500002: // Dipswitch 3 - return drvInput[5]; - case 0x500003: // Other inputs - return drvInput[2]; - case 0x500004: // Dipswitch 2 - return drvInput[4]; - case 0x500005: // Dipswitch 1 - return drvInput[3]; - - default: { -// printf("Attempt to read %06X (byte).\n", sekAddress); - - if ((sekAddress & 0x00F80000) == 0x00300000) { - return RomZ80[(sekAddress & 0x7FFFF) >> 1]; - } - } - } - - return 0; -} - -UINT16 __fastcall batriderReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x500006: - return ToaScanlineRegister(); - - // These addresses contain the response of the Z80 to the sound commands - case 0x500008: - return RamShared[4]; - case 0x50000A: - return RamShared[5]; - - case 0x50000C: - // This address echos the value written to 0x500060 - return nData; - - default: { -// printf("Attempt to read %06X (word).\n", sekAddress); - } - } - - return 0; -} - -void __fastcall batriderWriteByte(UINT32 sekAddress, UINT8) // UINT8 byteValue -{ - switch (sekAddress) { - - case 0x500011: // Coin control - break; - -// default: -// printf("Attempt to write %06X (byte) -> %04X.\n", sekAddress, byteValue); - } -} - -void __fastcall batriderWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - case 0x500020: { - RamShared[0] = wordValue; - - // The 68K program normally writes 0x500020/0x500022 as a single longword, - // except during the communications test. - if (wordValue == 0x55) { - ZetNmi(); - nCyclesDone[1] += ZetRun(0x1800); - } - break; - } - case 0x500022: - RamShared[1] = wordValue; - - // Sound commands are processed by the Z80 using an NMI - // So, trigger a Z80 NMI and execute it - ZetNmi(); - nCyclesDone[1] += ZetRun(0x1800); - break; - - case 0x500024: - // Writes to this address only occur in situations where the program sets - // 0x20FA19 (Ram02[0x7A18]) to 0xFF, and then sits in a loop waiting for it to become 0x00 - // Interrupt 4 does this (the same code is also conditionally called from interrupt 2) - - nIRQPending = 1; - SekSetIRQLine(4, SEK_IRQSTATUS_ACK); - break; - - case 0x500060: - // Bit 0 of the value written to this location must be echod at 0x50000C - nData = wordValue; - break; - - case 0x500080: - Map68KTextROM(false); - break; - - case 0x500082: // Acknowledge interrupt - SekSetIRQLine(0, SEK_IRQSTATUS_NONE); - nIRQPending = 0; - break; - - case 0x5000C0: - case 0x5000C1: - case 0x5000C2: - case 0x5000C3: - case 0x5000C4: - case 0x5000C5: - case 0x5000C6: - case 0x5000C7: - case 0x5000C8: - case 0x5000C9: - case 0x5000CA: - case 0x5000CB: - case 0x5000CC: - case 0x5000CD: - case 0x5000CE: - GP9001TileBank[(sekAddress & 0x0F) >> 1] = ((wordValue & 0x0F) << 15); - break; - -// default: -// printf("Attempt to write %06X (word) -> %04X.\n", sekAddress, wordValue); - } -} - -UINT16 __fastcall batriderReadWordGP9001(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x400008: - return ToaGP9001ReadRAM_Hi(0); - case 0x40000A: - return ToaGP9001ReadRAM_Lo(0); - - } - - return 0; -} - -void __fastcall batriderWriteWordGP9001(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - - case 0x400000: - ToaGP9001WriteRegister(wordValue); - break; - - case 0x400004: - ToaGP9001SelectRegister(wordValue); - break; - - case 0x400008: - case 0x40000A: - ToaGP9001WriteRAM(wordValue, 0); - break; - - case 0x40000C: // Set GP9001 VRAM address-pointer - ToaGP9001SetRAMPointer(wordValue); - break; - } -} - -UINT8 __fastcall batriderReadByteZ80ROM(UINT32 sekAddress) -{ - return RomZ80[(sekAddress & 0x7FFFF) >> 1]; -} - -UINT16 __fastcall batriderReadWordZ80ROM(UINT32 sekAddress) -{ - return RomZ80[(sekAddress & 0x7FFFF) >> 1]; -} - -static void Map68KTextROM(bool bMapTextROM) -{ - if (bMapTextROM) { - if (nTextROMStatus != 1) { - SekMapMemory(ExtraTROM, 0x200000, 0x207FFF, SM_RAM); // Extra text tile memory - - nTextROMStatus = 1; - } - } else { - if (nTextROMStatus != 0) { - SekMapMemory(ExtraTRAM, 0x200000, 0x201FFF, SM_RAM); // Extra text tilemap RAM - SekMapMemory(RamPal, 0x202000, 0x202FFF, SM_RAM); // Palette RAM - SekMapMemory(Ram01, 0x203000, 0x207FFF, SM_RAM); // Extra text Scroll & offset; RAM - - nTextROMStatus = 0; - } - } -} - -static INT32 drvDoReset() -{ - // Insert region code into 68K ROM, code by BisonSAS - UINT8 nRegion = drvRegion & 0x1F; - if (nRegion<=25) { - Rom01[0x00000^1]=(UINT8)(nRegion<<13) | (drvRegion & 0x1F); - } - - SekOpen(0); - - nIRQPending = 0; - SekSetIRQLine(0, SEK_IRQSTATUS_NONE); - - Map68KTextROM(true); - - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - MSM6295Reset(1); - BurnYM2151Reset(); - - return 0; -} - -static INT32 drvInit() -{ - INT32 nLen; - -#ifdef DRIVER_ROTATION - bToaRotateScreen = true; -#endif - - nGP9001ROMSize[0] = 0x01000000; - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8*)0; - if ((Mem = (UINT8*)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // Zero memory - MemIndex(); // Index the allocated memory - - if (LoadRoms()) { - return 1; - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x1FFFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram02, 0x208000, 0x20FFFF, SM_RAM); - - Map68KTextROM(true); - - SekSetReadWordHandler(0, batriderReadWord); - SekSetReadByteHandler(0, batriderReadByte); - SekSetWriteWordHandler(0, batriderWriteWord); - SekSetWriteByteHandler(0, batriderWriteByte); - - SekMapHandler(1, 0x400000, 0x400400, SM_RAM); // GP9001 addresses - - SekSetReadWordHandler(1, batriderReadWordGP9001); - SekSetWriteWordHandler(1, batriderWriteWordGP9001); - - SekMapHandler(2, 0x300000, 0x37FFFF, SM_ROM); // Z80 ROM - - SekSetReadByteHandler(2, batriderReadByteZ80ROM); - SekSetReadWordHandler(2, batriderReadWordZ80ROM); - - SekClose(); - } - - nSpriteYOffset = 0x0001; - - nLayer0XOffset = -0x01D6; - nLayer1XOffset = -0x01D8; - nLayer2XOffset = -0x01DA; - - ToaInitGP9001(); - - nExtraTXOffset = 0x2C; - ToaExtraTextInit(); - - drvZInit(); // Initialize Z80 - - BurnYM2151Init(32000000 / 8); - BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - - MSM6295Init(0, 32000000 / 10 / 132, 1); - MSM6295Init(1, 32000000 / 10 / 165, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); - - nToaPalLen = nColCount; - ToaPalSrc = RamPal; - ToaPalInit(); - - nTextROMStatus = -1; - bDrawScreen = true; - - drvDoReset(); // Reset machine - return 0; -} - -static INT32 drvExit() -{ - MSM6295Exit(0); - MSM6295Exit(1); - BurnYM2151Exit(); - - ToaPalExit(); - ToaExitGP9001(); - ToaExtraTextExit(); - ToaZExit(); // Z80 exit - SekExit(); // Deallocate 68000 - - BurnFree(Mem); - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 drvDraw() -{ - ToaClearScreen(0); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderGP9001(); // Render GP9001 graphics - ToaExtraTextLayer(); // Render extra text layer - } - - ToaPalUpdate(); // Update the palette - - return 0; -} - -static INT32 drvFrame() -{ - INT32 nInterleave = 8; - - if (drvReset) { // Reset machine - drvDoReset(); - } - - // Compile digital inputs - drvInput[0] = 0x00; // Buttons - drvInput[1] = 0x00; // Player 1 - drvInput[2] = 0x00; // Player 2 - for (INT32 i = 0; i < 8; i++) { - drvInput[0] |= (drvJoy1[i] & 1) << i; - drvInput[1] |= (drvJoy2[i] & 1) << i; - drvInput[2] |= (drvButton[i] & 1) << i; - } - ToaClearOpposites(&drvInput[0]); - ToaClearOpposites(&drvInput[1]); - - SekNewFrame(); - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = TOA_Z80_SPEED / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekOpen(0); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - INT32 nSoundBufferPos = 0; - - ZetOpen(0); - for (INT32 i = 1; i <= nInterleave; i++) { - INT32 nCurrentCPU; - INT32 nNext; - - // Run 68000 - - nCurrentCPU = 0; - nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; - - // Trigger VBlank interrupt - if (!bVBlank && nNext > nToaCyclesVBlankStart) { - if (nCyclesDone[nCurrentCPU] < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - } - - ToaBufferGP9001Sprites(); - if (pBurnDraw) { // Draw screen if needed - drvDraw(); - } - - nIRQPending = 1; - SekSetIRQLine(2, SEK_IRQSTATUS_ACK); - - bVBlank = true; - } - - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - - if ((i & 1) == 0) { - // Run Z80 - nCurrentCPU = 1; - nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - - // Render sound segment - if (pBurnSoundOut) { - INT32 nSegmentLength = (nBurnSoundLen * i / nInterleave) - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - } - - SekClose(); - - { - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - MSM6295Render(1, pSoundBuf, nSegmentLength); - } - } - } - - ZetClose(); - - return 0; -} - -// Rom information -static struct BurnRomInfo batridRomDesc[] = { - { "prg0_europe.u22", 0x080000, 0x91d3e975, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 - { "prg1b.u23", 0x080000, 0x8E70B492, BRF_ESS | BRF_PRG }, // 2 (odd) - { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 - - { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data - { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 - { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 - { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 - - { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data -}; - - -STD_ROM_PICK(batrid) -STD_ROM_FN(batrid) - -static struct BurnRomInfo batriduRomDesc[] = { - { "prg0_usa.u22", 0x080000, 0x2049d007, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 - { "prg1b.u23", 0x080000, 0x8E70B492, BRF_ESS | BRF_PRG }, // 2 (odd) - { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 - - { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data - { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 - { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 - { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 - - { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data -}; - - -STD_ROM_PICK(batridu) -STD_ROM_FN(batridu) - -static struct BurnRomInfo batridcRomDesc[] = { - { "prg0_china.u22", 0x080000, 0xc3b91f7e, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 - { "prg1b.u23", 0x080000, 0x8E70B492, BRF_ESS | BRF_PRG }, // 2 (odd) - { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 - - { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data - { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 - { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 - { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 - - { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data -}; - - -STD_ROM_PICK(batridc) -STD_ROM_FN(batridc) - -static struct BurnRomInfo batridjRomDesc[] = { - { "prg0b.u22", 0x080000, 0x4f3fc729, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 - { "prg1b.u23", 0x080000, 0x8E70B492, BRF_ESS | BRF_PRG }, // 2 (odd) - { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 - - { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data - { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 - { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 - { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 - - { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data -}; - - -STD_ROM_PICK(batridj) -STD_ROM_FN(batridj) - -static struct BurnRomInfo batridkRomDesc[] = { - { "prg0_korea.u22", 0x080000, 0xd9d8c907, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 - { "prg1b.u23", 0x080000, 0x8E70B492, BRF_ESS | BRF_PRG }, // 2 (odd) - { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 - - { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data - { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 - { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 - { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 - - { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data -}; - - -STD_ROM_PICK(batridk) -STD_ROM_FN(batridk) - -static struct BurnRomInfo batridjaRomDesc[] = { - { "prg0.bin", 0x080000, 0xf93ea27c, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 - { "prg1.u23", 0x080000, 0x8ae7f592, BRF_ESS | BRF_PRG }, // 2 (odd) - { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 - - { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data - { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 - { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 - { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 - - { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data -}; - - -STD_ROM_PICK(batridja) -STD_ROM_FN(batridja) - -static struct BurnRomInfo batridtaRomDesc[] = { - { "u22.bin", 0x080000, 0xb135820e, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 - { "prg1.u23", 0x080000, 0x8ae7f592, BRF_ESS | BRF_PRG }, // 2 (odd) - { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 - - { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data - { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 - { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 - { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 - - { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data - { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data -}; - - -STD_ROM_PICK(batridta) -STD_ROM_FN(batridta) - -struct BurnDriver BurnDrvBatrid = { - "batrider", NULL, NULL, NULL, "1998", - "Armed Police Batrider (Europe) (Fri Feb 13 1998)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, batridRomInfo, batridRomName, NULL, NULL, batriderInputInfo, batridDIPInfo, - drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBatridu = { - "batrideru", "batrider", NULL, NULL, "1998", - "Armed Police Batrider (U.S.A.) (Fri Feb 13 1998)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, batriduRomInfo, batriduRomName, NULL, NULL, batriderInputInfo, batriduDIPInfo, - drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBatridc = { - "batriderc", "batrider", NULL, NULL, "1998", - "Armed Police Batrider (China) (Fri Feb 13 1998)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, batridcRomInfo, batridcRomName, NULL, NULL, batriderInputInfo, batridcDIPInfo, - drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBatridj = { - "batriderj", "batrider", NULL, NULL, "1998", - "Armed Police Batrider - B Version (Japan) (Fri Feb 13 1998)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, batridjRomInfo, batridjRomName, NULL, NULL, batriderInputInfo, batriderDIPInfo, - drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBatridk = { - "batriderk", "batrider", NULL, NULL, "1998", - "Armed Police Batrider (Korea) (Fri Feb 13 1998)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, batridkRomInfo, batridkRomName, NULL, NULL, batriderInputInfo, batridkDIPInfo, - drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBatridja = { - "batriderja", "batrider", NULL, NULL, "1998", - "Armed Police Batrider - A Version (Japan) (Mon Dec 22 1997)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, batridjaRomInfo, batridjaRomName, NULL, NULL, batriderInputInfo, batriderDIPInfo, - drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBatridta = { - "batridert", "batrider", NULL, NULL, "1998", - "Armed Police Batrider - A Version (Taiwan) (Mon Dec 22 1997)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, batridtaRomInfo, batridtaRomName, NULL, NULL, batriderInputInfo, batridtaDIPInfo, - drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; +#include "toaplan.h" +// Batrider + +static UINT8 drvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 drvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 drvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 drvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static UINT8 drvRegion = 0; +static UINT8 drvReset = 0; +static UINT8 bDrawScreen; + +static UINT8 nIRQPending; +static bool bVBlank; + +static INT32 nData; + +static INT32 nCurrentBank; +static INT32 nTextROMStatus; + +static void Map68KTextROM(bool bMapTextROM); + +static struct BurnInputInfo batriderInputList[] = { + {"P1 Coin", BIT_DIGITAL, drvButton + 3, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, drvButton + 5, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, drvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, drvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, drvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, drvJoy1 + 3, "p1 right"}, + {"P1 Shoot 1", BIT_DIGITAL, drvJoy1 + 4, "p1 fire 1"}, + {"P1 Shoot 2", BIT_DIGITAL, drvJoy1 + 5, "p1 fire 2"}, + {"P1 Shoot 3", BIT_DIGITAL, drvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, drvButton + 4, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, drvButton + 6, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, drvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, drvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, drvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, drvJoy2 + 3, "p2 right"}, + {"P2 Shoot 1", BIT_DIGITAL, drvJoy2 + 4, "p2 fire 1"}, + {"P2 Shoot 2", BIT_DIGITAL, drvJoy2 + 5, "p2 fire 2"}, + {"P2 Shoot 3", BIT_DIGITAL, drvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &drvReset, "reset"}, + {"Test", BIT_DIGITAL, drvButton + 2, "diag"}, + {"Service", BIT_DIGITAL, drvButton + 0, "service"}, + {"Dip 1", BIT_DIPSWITCH, drvInput + 3, "dip"}, + {"Dip 2", BIT_DIPSWITCH, drvInput + 4, "dip"}, + {"Dip 3", BIT_DIPSWITCH, drvInput + 5, "dip"}, + {"Region", BIT_DIPSWITCH, &drvRegion , "dip"}, +}; + +STDINPUTINFO(batrider) + + +static struct BurnDIPInfo batriderDIPList[] = { + // Defaults + {0x15, 0xFF, 0xFF, 0x00, NULL}, + {0x16, 0xFF, 0xFF, 0x00, NULL}, + {0x17, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, "Test mode"}, + {0x15, 0x01, 0x01, 0x00, "Normal"}, + {0x15, 0x01, 0x01, 0x01, "Test"}, + // Normal + {0, 0xFE, 0, 2, "Starting coin"}, + {0x15, 0x82, 0x02, 0x00, "1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0x02, 0x02, "2 credits"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + // Free play + {0, 0xFE, 0, 2, "Stick mode"}, + {0x15, 0x02, 0x02, 0x00, "Normal"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x02, 0x02, 0x02, "Special"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + // Both + {0, 0xFE, 0, 8, "Coin 1"}, + {0x15, 0x01, 0x1C, 0x00, "1 coin 1 credit"}, + {0x15, 0x01, 0x1C, 0x04, "1 coin 2 credits"}, + {0x15, 0x01, 0x1C, 0x08, "1 coin 3 credits"}, + {0x15, 0x01, 0x1C, 0x0C, "1 coin 4 credits"}, + {0x15, 0x01, 0x1C, 0x10, "2 coins 1 credit"}, + {0x15, 0x01, 0x1C, 0x14, "3 coins 1 credit"}, + {0x15, 0x01, 0x1C, 0x18, "4 coins 1 credit"}, + {0x15, 0x01, 0x1C, 0x1C, "Free Play"}, + // 0x1C: Free play settings active + // Normal + {0, 0xFE, 0, 7, "Coin 2"}, + {0x15, 0x82, 0xE0, 0x00, "1 coin 1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0x20, "1 coin 2 credits"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0x40, "1 coin 3 credits"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0x60, "1 coin 4 credits"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0x80, "2 coins 1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0xA0, "3 coins 1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0xC0, "4 coins 1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0xE0, "1 coin 1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + // Free play + {0, 0xFE, 0, 2, "Hit score"}, + {0x15, 0x02, 0x20, 0x00, "Off"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x02, 0x20, 0x20, "On"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0, 0xFE, 0, 2, "Sound effect"}, + {0x15, 0x02, 0x40, 0x00, "Off"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x02, 0x40, 0x40, "On"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0, 0xFE, 0, 2, "Music"}, + {0x15, 0x02, 0x80, 0x00, "Off"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x02, 0x80, 0x80, "On"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + + // DIP 2 + {0, 0xFE, 0, 4, "Start rank"}, + {0x16, 0x01, 0x03, 0x00, "Normal"}, + {0x16, 0x01, 0x03, 0x01, "Easy"}, + {0x16, 0x01, 0x03, 0x02, "Hard"}, + {0x16, 0x01, 0x03, 0x03, "Very hard"}, + {0, 0xFE, 0, 4, "Timer rank"}, + {0x16, 0x01, 0x0C, 0x00, "Normal"}, + {0x16, 0x01, 0x0C, 0x04, "Low"}, + {0x16, 0x01, 0x0C, 0x08, "High"}, + {0x16, 0x01, 0x0C, 0x0C, "Highest"}, + {0, 0xFE, 0, 4, "Player counts"}, + {0x16, 0x01, 0x30, 0x00, "3"}, + {0x16, 0x01, 0x30, 0x10, "4"}, + {0x16, 0x01, 0x30, 0x20, "2"}, + {0x16, 0x01, 0x30, 0x30, "1"}, + {0, 0xFE, 0, 4, "Extra player"}, + {0x16, 0x01, 0xC0, 0x00, "1500000 each"}, + {0x16, 0x01, 0xC0, 0x40, "1000000 each"}, + {0x16, 0x01, 0xC0, 0x80, "2000000 each"}, + {0x16, 0x01, 0xC0, 0xC0, "No extra player"}, + + // DIP 3 + {0, 0xFE, 0, 2, "Screen flip"}, + {0x17, 0x01, 0x01, 0x00, "Off"}, + {0x17, 0x01, 0x01, 0x01, "On"}, + {0, 0xFE, 0, 2, "Demo sound"}, + {0x17, 0x01, 0x02, 0x00, "On"}, + {0x17, 0x01, 0x02, 0x02, "Off"}, + {0, 0xFE, 0, 2, "Stage edit"}, + {0x17, 0x01, 0x04, 0x00, "Disable"}, + {0x17, 0x01, 0x04, 0x04, "Enable"}, + {0, 0xFE, 0, 2, "Continue play"}, + {0x17, 0x01, 0x08, 0x00, "Enable"}, + {0x17, 0x01, 0x08, 0x08, "Disable"}, + {0, 0xFE, 0, 2, "Invincible"}, + {0x17, 0x01, 0x10, 0x00, "Off"}, + {0x17, 0x01, 0x10, 0x10, "On"}, + // Free play + {0, 0xFE, 0, 2, "Guest Players"}, + {0x17, 0x02, 0x20, 0x00, "Disable"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x17, 0x02, 0x20, 0x20, "Enable"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0, 0xFE, 0, 2, "Player select"}, + {0x17, 0x02, 0x40, 0x00, "Disable"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x17, 0x02, 0x40, 0x40, "Enable"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0, 0xFE, 0, 2, "Special Course"}, + {0x17, 0x02, 0x80, 0x00, "Disable"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x17, 0x02, 0x80, 0x80, "Enable"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + + // Region + {0, 0xFD, 0, 26, "Region"}, + {0x18, 0x01, 0x1F, 0x00, "Nippon"}, + {0x18, 0x01, 0x1F, 0x01, "U.S.A."}, + {0x18, 0x01, 0x1F, 0x02, "Europe"}, + {0x18, 0x01, 0x1F, 0x03, "Asia"}, + {0x18, 0x01, 0x1F, 0x04, "German"}, + {0x18, 0x01, 0x1F, 0x05, "Austria"}, + {0x18, 0x01, 0x1F, 0x06, "Belgium"}, + {0x18, 0x01, 0x1F, 0x07, "Denmark"}, + {0x18, 0x01, 0x1F, 0x08, "Finland"}, + {0x18, 0x01, 0x1F, 0x09, "France"}, + {0x18, 0x01, 0x1F, 0x0A, "Great Britain"}, + {0x18, 0x01, 0x1F, 0x0B, "Greece"}, + {0x18, 0x01, 0x1F, 0x0C, "Holland"}, + {0x18, 0x01, 0x1F, 0x0D, "Italy"}, + {0x18, 0x01, 0x1F, 0x0E, "Norway"}, + {0x18, 0x01, 0x1F, 0x0F, "Portugal"}, + {0x18, 0x01, 0x1F, 0x10, "Spain"}, + {0x18, 0x01, 0x1F, 0x11, "Sweden"}, + {0x18, 0x01, 0x1F, 0x12, "Switzerland"}, + {0x18, 0x01, 0x1F, 0x13, "Australia"}, + {0x18, 0x01, 0x1F, 0x14, "New Zealand"}, + {0x18, 0x01, 0x1F, 0x15, "Taiwan"}, + {0x18, 0x01, 0x1F, 0x16, "HongKong"}, + {0x18, 0x01, 0x1F, 0x17, "Korea"}, + {0x18, 0x01, 0x1F, 0x18, "China"}, + {0x18, 0x01, 0x1F, 0x19, "World"}, +}; + +static struct BurnDIPInfo batriderRegionDIPList[] = { + // Defaults + {0x18, 0xFF, 0xFF, 0x00, NULL}, +}; + +static struct BurnDIPInfo batridRegionDIPList[] = { + // Defaults + {0x18, 0xFF, 0xFF, 0x02, NULL}, +}; + +static struct BurnDIPInfo batriduRegionDIPList[] = { + // Defaults + {0x18, 0xFF, 0xFF, 0x01, NULL}, +}; + +static struct BurnDIPInfo batridcRegionDIPList[] = { + // Defaults + {0x18, 0xFF, 0xFF, 0x18, NULL}, +}; + +static struct BurnDIPInfo batridkRegionDIPList[] = { + // Defaults + {0x18, 0xFF, 0xFF, 0x17, NULL}, +}; + +static struct BurnDIPInfo batridtaRegionDIPList[] = { + // Defaults + {0x18, 0xFF, 0xFF, 0x15, NULL}, +}; + +STDDIPINFOEXT(batrider, batriderRegion, batrider) +STDDIPINFOEXT(batrid, batridRegion, batrider) +STDDIPINFOEXT(batridu, batriduRegion, batrider) +STDDIPINFOEXT(batridc, batridcRegion, batrider) +STDDIPINFOEXT(batridk, batridkRegion, batrider) +STDDIPINFOEXT(batridta, batridtaRegion, batrider) + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *Ram01, *Ram02, *RamPal; +UINT8 *RamShared; +static INT32 nColCount = 0x0800; + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x200000; // 68000 ROM + RomZ80 = Next; Next += 0x040000; // Z80 ROM + GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // Tile data + MSM6295ROM = Next; Next += 0x200000; // MSM6295 ADPCM data + RamStart = Next; + ExtraTRAM = Next; Next += 0x002000; // Extra text layer + Ram01 = Next; Next += 0x005000; // RAM + Extra text layer scroll/offset + ExtraTROM = Next; Next += 0x008000; // Extra text layer tile data + Ram02 = Next; Next += 0x008000; // CPU #0 work RAM + RamPal = Next; Next += 0x001000; // Palette + RamZ80 = Next; Next += 0x004000; // Z80 RAM + GP9001RAM[0]= Next; Next += 0x004000; + GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); + RamShared = Next; Next += 0x000008; // Shared data + RamEnd = Next; + ToaPalette = (UINT32*)Next; Next += nColCount * sizeof(UINT32); + MemEnd = Next; + + ExtraTSelect= Ram01; // Extra text layer scroll + ExtraTScroll= Ram01 + 0x000200; // Extra text layer offset + + return 0; +} + +static void drvZ80Bankswitch(INT32 nBank) +{ + nBank &= 0x0F; + if (nBank != nCurrentBank) { + UINT8* nStartAddress = RomZ80 + (nBank << 14); + ZetMapArea(0x8000, 0xBFFF, 0, nStartAddress); + ZetMapArea(0x8000, 0xBFFF, 2, nStartAddress); + + nCurrentBank = nBank; + } +} + +// Scan ram +static INT32 drvScan(INT32 nAction, INT32* pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029496; + } + if (nAction & ACB_VOLATILE) { // Scan volatile ram + + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); // Scan 68000 + ZetScan(nAction); // Scan Z80 + SCAN_VAR(nCurrentBank); + + MSM6295Scan(0, nAction); + MSM6295Scan(1, nAction); + BurnYM2151Scan(nAction); + + ToaScanGP9001(nAction, pnMin); + + SCAN_VAR(nIRQPending); + SCAN_VAR(nTextROMStatus); + + SCAN_VAR(drvInput); + + if (nAction & ACB_WRITE) { + INT32 n = nTextROMStatus; + nTextROMStatus = -1; + SekOpen(0); + Map68KTextROM(n); + SekClose(); + + n = nCurrentBank; + nCurrentBank = -1; + ZetOpen(0); + drvZ80Bankswitch(n); + ZetClose(); + } + } + + return 0; +} + +static INT32 LoadRoms() +{ + // Load 68000 ROMs + if (ToaLoadCode(Rom01, 0, 4)) { + return 1; + } + + // Load GP9001 tile data + ToaLoadGP9001Tiles(GP9001ROM[0], 4, 4, nGP9001ROMSize[0]); + + // Load the Z80 ROM + if (BurnLoadRom(RomZ80, 8, 1)) { + return 1; + } + + // Load MSM6295 ADPCM data + BurnLoadRom(MSM6295ROM + 0x000000, 9, 1); + BurnLoadRom(MSM6295ROM + 0x100000, 10, 1); + + return 0; +} + +UINT8 __fastcall batriderZIn(UINT16 nAddress) +{ + nAddress &= 0xFF; + + switch (nAddress) { + + // The sound commands sent by the 68000 are read from these locations + case 0x48: + return RamShared[0]; + case 0x4A: + return RamShared[1]; + + case 0x81: + return BurnYM2151ReadStatus(); + case 0x82: + return MSM6295ReadStatus(0); + case 0x84: + return MSM6295ReadStatus(1); + } + + return 0; +} + +void __fastcall batriderZOut(UINT16 nAddress, UINT8 nValue) +{ + nAddress &= 0xFF; + + switch (nAddress) { + + // The 68000 expects to read back the sound command it sent + case 0x40: + RamShared[4] = nValue; + break; + case 0x42: + RamShared[5] = nValue; + break; + + case 0x44: // ??? + case 0x46: // Acknowledge interrupt + break; + + case 0x80: + BurnYM2151SelectRegister(nValue); + break; + case 0x81: + BurnYM2151WriteRegister(nValue); + break; + + case 0x82: + MSM6295Command(0, nValue); + break; + case 0x84: + MSM6295Command(1, nValue); + break; + + case 0x88: { + drvZ80Bankswitch(nValue); + break; + + case 0xC0: + MSM6295SampleInfo[0][0] = MSM6295ROM + ((nValue & 0x0F) << 16); + MSM6295SampleData[0][0] = MSM6295ROM + ((nValue & 0x0F) << 16); + MSM6295SampleInfo[0][1] = MSM6295ROM + ((nValue & 0xF0) << 12) + 0x0100; + MSM6295SampleData[0][1] = MSM6295ROM + ((nValue & 0xF0) << 12); + break; + case 0xC2: + MSM6295SampleInfo[0][2] = MSM6295ROM + ((nValue & 0x0F) << 16) + 0x0200; + MSM6295SampleData[0][2] = MSM6295ROM + ((nValue & 0x0F) << 16); + MSM6295SampleInfo[0][3] = MSM6295ROM + ((nValue & 0xF0) << 12) + 0x0300; + MSM6295SampleData[0][3] = MSM6295ROM + ((nValue & 0xF0) << 12); + break; + case 0xC4: + MSM6295SampleInfo[1][0] = MSM6295ROM + 0x0100000 + ((nValue & 0x0F) << 16); + MSM6295SampleData[1][0] = MSM6295ROM + 0x0100000 + ((nValue & 0x0F) << 16); + MSM6295SampleInfo[1][1] = MSM6295ROM + 0x0100000 + ((nValue & 0xF0) << 12) + 0x0100; + MSM6295SampleData[1][1] = MSM6295ROM + 0x0100000 + ((nValue & 0xF0) << 12); + break; + case 0xC6: + MSM6295SampleInfo[1][2] = MSM6295ROM + 0x0100000 + ((nValue & 0x0F) << 16) + 0x0200; + MSM6295SampleData[1][2] = MSM6295ROM + 0x0100000 + ((nValue & 0x0F) << 16); + MSM6295SampleInfo[1][3] = MSM6295ROM + 0x0100000 + ((nValue & 0xF0) << 12) + 0x0300; + MSM6295SampleData[1][3] = MSM6295ROM + 0x0100000 + ((nValue & 0xF0) << 12); + break; + } + } +} + +static INT32 drvZInit() +{ + // Init the Z80 + ZetInit(0); + ZetOpen(0); + + ZetSetInHandler(batriderZIn); + ZetSetOutHandler(batriderZOut); + + // ROM bank 1 + ZetMapArea(0x0000, 0x7FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM + ZetMapArea(0x0000, 0x7FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM + // ROM bank 2 + ZetMapArea(0x8000, 0xBFFF, 0, RomZ80 + 0x8000); // Direct Read from ROM + ZetMapArea(0x8000, 0xBFFF, 2, RomZ80 + 0x8000); // + // RAM + ZetMapArea(0xC000, 0xDFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea(0xC000, 0xDFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea(0xC000, 0xDFFF, 2, RamZ80); // + + ZetClose(); + + nCurrentBank = 2; + + return 0; +} + +UINT8 __fastcall batriderReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x500000: // Player 2 inputs + return drvInput[1]; + case 0x500001: // Player 1 inputs + return drvInput[0]; + case 0x500002: // Dipswitch 3 + return drvInput[5]; + case 0x500003: // Other inputs + return drvInput[2]; + case 0x500004: // Dipswitch 2 + return drvInput[4]; + case 0x500005: // Dipswitch 1 + return drvInput[3]; + + default: { +// printf("Attempt to read %06X (byte).\n", sekAddress); + + if ((sekAddress & 0x00F80000) == 0x00300000) { + return RomZ80[(sekAddress & 0x7FFFF) >> 1]; + } + } + } + + return 0; +} + +UINT16 __fastcall batriderReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x500006: + return ToaScanlineRegister(); + + // These addresses contain the response of the Z80 to the sound commands + case 0x500008: + return RamShared[4]; + case 0x50000A: + return RamShared[5]; + + case 0x50000C: + // This address echos the value written to 0x500060 + return nData; + + default: { +// printf("Attempt to read %06X (word).\n", sekAddress); + } + } + + return 0; +} + +void __fastcall batriderWriteByte(UINT32 sekAddress, UINT8) // UINT8 byteValue +{ + switch (sekAddress) { + + case 0x500011: // Coin control + break; + +// default: +// printf("Attempt to write %06X (byte) -> %04X.\n", sekAddress, byteValue); + } +} + +void __fastcall batriderWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + case 0x500020: { + RamShared[0] = wordValue; + + // The 68K program normally writes 0x500020/0x500022 as a single longword, + // except during the communications test. + if (wordValue == 0x55) { + ZetNmi(); + nCyclesDone[1] += ZetRun(0x1800); + } + break; + } + case 0x500022: + RamShared[1] = wordValue; + + // Sound commands are processed by the Z80 using an NMI + // So, trigger a Z80 NMI and execute it + ZetNmi(); + nCyclesDone[1] += ZetRun(0x1800); + break; + + case 0x500024: + // Writes to this address only occur in situations where the program sets + // 0x20FA19 (Ram02[0x7A18]) to 0xFF, and then sits in a loop waiting for it to become 0x00 + // Interrupt 4 does this (the same code is also conditionally called from interrupt 2) + + nIRQPending = 1; + SekSetIRQLine(4, SEK_IRQSTATUS_ACK); + break; + + case 0x500060: + // Bit 0 of the value written to this location must be echod at 0x50000C + nData = wordValue; + break; + + case 0x500080: + Map68KTextROM(false); + break; + + case 0x500082: // Acknowledge interrupt + SekSetIRQLine(0, SEK_IRQSTATUS_NONE); + nIRQPending = 0; + break; + + case 0x5000C0: + case 0x5000C1: + case 0x5000C2: + case 0x5000C3: + case 0x5000C4: + case 0x5000C5: + case 0x5000C6: + case 0x5000C7: + case 0x5000C8: + case 0x5000C9: + case 0x5000CA: + case 0x5000CB: + case 0x5000CC: + case 0x5000CD: + case 0x5000CE: + GP9001TileBank[(sekAddress & 0x0F) >> 1] = ((wordValue & 0x0F) << 15); + break; + +// default: +// printf("Attempt to write %06X (word) -> %04X.\n", sekAddress, wordValue); + } +} + +UINT16 __fastcall batriderReadWordGP9001(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x400008: + return ToaGP9001ReadRAM_Hi(0); + case 0x40000A: + return ToaGP9001ReadRAM_Lo(0); + + } + + return 0; +} + +void __fastcall batriderWriteWordGP9001(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + + case 0x400000: + ToaGP9001WriteRegister(wordValue); + break; + + case 0x400004: + ToaGP9001SelectRegister(wordValue); + break; + + case 0x400008: + case 0x40000A: + ToaGP9001WriteRAM(wordValue, 0); + break; + + case 0x40000C: // Set GP9001 VRAM address-pointer + ToaGP9001SetRAMPointer(wordValue); + break; + } +} + +UINT8 __fastcall batriderReadByteZ80ROM(UINT32 sekAddress) +{ + return RomZ80[(sekAddress & 0x7FFFF) >> 1]; +} + +UINT16 __fastcall batriderReadWordZ80ROM(UINT32 sekAddress) +{ + return RomZ80[(sekAddress & 0x7FFFF) >> 1]; +} + +static void Map68KTextROM(bool bMapTextROM) +{ + if (bMapTextROM) { + if (nTextROMStatus != 1) { + SekMapMemory(ExtraTROM, 0x200000, 0x207FFF, SM_RAM); // Extra text tile memory + + nTextROMStatus = 1; + } + } else { + if (nTextROMStatus != 0) { + SekMapMemory(ExtraTRAM, 0x200000, 0x201FFF, SM_RAM); // Extra text tilemap RAM + SekMapMemory(RamPal, 0x202000, 0x202FFF, SM_RAM); // Palette RAM + SekMapMemory(Ram01, 0x203000, 0x207FFF, SM_RAM); // Extra text Scroll & offset; RAM + + nTextROMStatus = 0; + } + } +} + +static INT32 drvDoReset() +{ + // Insert region code into 68K ROM, code by BisonSAS + UINT8 nRegion = drvRegion & 0x1F; + if (nRegion<=25) { + Rom01[0x00000^1]=(UINT8)(nRegion<<13) | (drvRegion & 0x1F); + } + + SekOpen(0); + + nIRQPending = 0; + SekSetIRQLine(0, SEK_IRQSTATUS_NONE); + + Map68KTextROM(true); + + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + MSM6295Reset(1); + BurnYM2151Reset(); + + return 0; +} + +static INT32 drvInit() +{ + INT32 nLen; + +#ifdef DRIVER_ROTATION + bToaRotateScreen = true; +#endif + + nGP9001ROMSize[0] = 0x01000000; + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8*)0; + if ((Mem = (UINT8*)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // Zero memory + MemIndex(); // Index the allocated memory + + if (LoadRoms()) { + return 1; + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x1FFFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram02, 0x208000, 0x20FFFF, SM_RAM); + + Map68KTextROM(true); + + SekSetReadWordHandler(0, batriderReadWord); + SekSetReadByteHandler(0, batriderReadByte); + SekSetWriteWordHandler(0, batriderWriteWord); + SekSetWriteByteHandler(0, batriderWriteByte); + + SekMapHandler(1, 0x400000, 0x400400, SM_RAM); // GP9001 addresses + + SekSetReadWordHandler(1, batriderReadWordGP9001); + SekSetWriteWordHandler(1, batriderWriteWordGP9001); + + SekMapHandler(2, 0x300000, 0x37FFFF, SM_ROM); // Z80 ROM + + SekSetReadByteHandler(2, batriderReadByteZ80ROM); + SekSetReadWordHandler(2, batriderReadWordZ80ROM); + + SekClose(); + } + + nSpriteYOffset = 0x0001; + + nLayer0XOffset = -0x01D6; + nLayer1XOffset = -0x01D8; + nLayer2XOffset = -0x01DA; + + ToaInitGP9001(); + + nExtraTXOffset = 0x2C; + ToaExtraTextInit(); + + drvZInit(); // Initialize Z80 + + BurnYM2151Init(32000000 / 8); + BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + + MSM6295Init(0, 32000000 / 10 / 132, 1); + MSM6295Init(1, 32000000 / 10 / 165, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + MSM6295SetRoute(1, 1.00, BURN_SND_ROUTE_BOTH); + + nToaPalLen = nColCount; + ToaPalSrc = RamPal; + ToaPalInit(); + + nTextROMStatus = -1; + bDrawScreen = true; + + drvDoReset(); // Reset machine + return 0; +} + +static INT32 drvExit() +{ + MSM6295Exit(0); + MSM6295Exit(1); + BurnYM2151Exit(); + + ToaPalExit(); + ToaExitGP9001(); + ToaExtraTextExit(); + ToaZExit(); // Z80 exit + SekExit(); // Deallocate 68000 + + BurnFree(Mem); + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 drvDraw() +{ + ToaClearScreen(0); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderGP9001(); // Render GP9001 graphics + ToaExtraTextLayer(); // Render extra text layer + } + + ToaPalUpdate(); // Update the palette + + return 0; +} + +static INT32 drvFrame() +{ + INT32 nInterleave = 8; + + if (drvReset) { // Reset machine + drvDoReset(); + } + + // Compile digital inputs + drvInput[0] = 0x00; // Buttons + drvInput[1] = 0x00; // Player 1 + drvInput[2] = 0x00; // Player 2 + for (INT32 i = 0; i < 8; i++) { + drvInput[0] |= (drvJoy1[i] & 1) << i; + drvInput[1] |= (drvJoy2[i] & 1) << i; + drvInput[2] |= (drvButton[i] & 1) << i; + } + ToaClearOpposites(&drvInput[0]); + ToaClearOpposites(&drvInput[1]); + + SekNewFrame(); + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = TOA_Z80_SPEED / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekOpen(0); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + INT32 nSoundBufferPos = 0; + + ZetOpen(0); + for (INT32 i = 1; i <= nInterleave; i++) { + INT32 nCurrentCPU; + INT32 nNext; + + // Run 68000 + + nCurrentCPU = 0; + nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; + + // Trigger VBlank interrupt + if (!bVBlank && nNext > nToaCyclesVBlankStart) { + if (nCyclesDone[nCurrentCPU] < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + } + + ToaBufferGP9001Sprites(); + if (pBurnDraw) { // Draw screen if needed + drvDraw(); + } + + nIRQPending = 1; + SekSetIRQLine(2, SEK_IRQSTATUS_ACK); + + bVBlank = true; + } + + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + + if ((i & 1) == 0) { + // Run Z80 + nCurrentCPU = 1; + nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + + // Render sound segment + if (pBurnSoundOut) { + INT32 nSegmentLength = (nBurnSoundLen * i / nInterleave) - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + MSM6295Render(1, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + } + + SekClose(); + + { + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + MSM6295Render(1, pSoundBuf, nSegmentLength); + } + } + } + + ZetClose(); + + return 0; +} + +// Rom information +static struct BurnRomInfo batridRomDesc[] = { + { "prg0_europe.u22", 0x080000, 0x91d3e975, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 + { "prg1b.u23", 0x080000, 0x8E70B492, BRF_ESS | BRF_PRG }, // 2 (odd) + { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 + + { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data + { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 + { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 + { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 + + { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data + { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data +}; + + +STD_ROM_PICK(batrid) +STD_ROM_FN(batrid) + +static struct BurnRomInfo batriduRomDesc[] = { + { "prg0_usa.u22", 0x080000, 0x2049d007, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 + { "prg1b.u23", 0x080000, 0x8E70B492, BRF_ESS | BRF_PRG }, // 2 (odd) + { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 + + { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data + { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 + { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 + { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 + + { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data + { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data +}; + + +STD_ROM_PICK(batridu) +STD_ROM_FN(batridu) + +static struct BurnRomInfo batridcRomDesc[] = { + { "prg0_china.u22", 0x080000, 0xc3b91f7e, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 + { "prg1b.u23", 0x080000, 0x8E70B492, BRF_ESS | BRF_PRG }, // 2 (odd) + { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 + + { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data + { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 + { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 + { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 + + { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data + { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data +}; + + +STD_ROM_PICK(batridc) +STD_ROM_FN(batridc) + +static struct BurnRomInfo batridjRomDesc[] = { + { "prg0b.u22", 0x080000, 0x4f3fc729, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 + { "prg1b.u23", 0x080000, 0x8E70B492, BRF_ESS | BRF_PRG }, // 2 (odd) + { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 + + { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data + { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 + { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 + { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 + + { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data + { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data +}; + + +STD_ROM_PICK(batridj) +STD_ROM_FN(batridj) + +static struct BurnRomInfo batridkRomDesc[] = { + { "prg0_korea.u22", 0x080000, 0xd9d8c907, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 + { "prg1b.u23", 0x080000, 0x8E70B492, BRF_ESS | BRF_PRG }, // 2 (odd) + { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 + + { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data + { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 + { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 + { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 + + { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data + { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data +}; + + +STD_ROM_PICK(batridk) +STD_ROM_FN(batridk) + +static struct BurnRomInfo batridjaRomDesc[] = { + { "prg0.bin", 0x080000, 0xf93ea27c, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 + { "prg1.u23", 0x080000, 0x8ae7f592, BRF_ESS | BRF_PRG }, // 2 (odd) + { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 + + { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data + { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 + { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 + { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 + + { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data + { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data +}; + + +STD_ROM_PICK(batridja) +STD_ROM_FN(batridja) + +static struct BurnRomInfo batridtaRomDesc[] = { + { "u22.bin", 0x080000, 0xb135820e, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg2.u21", 0x080000, 0xBDAA5FBF, BRF_ESS | BRF_PRG }, // 1 + { "prg1.u23", 0x080000, 0x8ae7f592, BRF_ESS | BRF_PRG }, // 2 (odd) + { "prg3.u24", 0x080000, 0x7AA9F941, BRF_ESS | BRF_PRG }, // 3 + + { "rom-1.bin", 0x400000, 0x0DF69CA2, BRF_GRA }, // 4 GP9001 Tile data + { "rom-3.bin", 0x400000, 0x60167D38, BRF_GRA }, // 5 + { "rom-2.bin", 0x400000, 0x1BFEA593, BRF_GRA }, // 6 + { "rom-4.bin", 0x400000, 0xBEE03c94, BRF_GRA }, // 7 + + { "snd.u77", 0x040000, 0x56682696, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "rom-5.bin", 0x100000, 0x4274DAf6, BRF_SND }, // 9 MSM6295 #1 ADPCM data + { "rom-6.bin", 0x100000, 0x2A1C2426, BRF_SND }, // 10 MSM6295 #2 ADPCM data +}; + + +STD_ROM_PICK(batridta) +STD_ROM_FN(batridta) + +struct BurnDriver BurnDrvBatrid = { + "batrider", NULL, NULL, NULL, "1998", + "Armed Police Batrider (Europe) (Fri Feb 13 1998)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, batridRomInfo, batridRomName, NULL, NULL, batriderInputInfo, batridDIPInfo, + drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBatridu = { + "batrideru", "batrider", NULL, NULL, "1998", + "Armed Police Batrider (U.S.A.) (Fri Feb 13 1998)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, batriduRomInfo, batriduRomName, NULL, NULL, batriderInputInfo, batriduDIPInfo, + drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBatridc = { + "batriderc", "batrider", NULL, NULL, "1998", + "Armed Police Batrider (China) (Fri Feb 13 1998)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, batridcRomInfo, batridcRomName, NULL, NULL, batriderInputInfo, batridcDIPInfo, + drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBatridj = { + "batriderj", "batrider", NULL, NULL, "1998", + "Armed Police Batrider - B Version (Japan) (Fri Feb 13 1998)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, batridjRomInfo, batridjRomName, NULL, NULL, batriderInputInfo, batriderDIPInfo, + drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBatridk = { + "batriderk", "batrider", NULL, NULL, "1998", + "Armed Police Batrider (Korea) (Fri Feb 13 1998)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, batridkRomInfo, batridkRomName, NULL, NULL, batriderInputInfo, batridkDIPInfo, + drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBatridja = { + "batriderja", "batrider", NULL, NULL, "1998", + "Armed Police Batrider - A Version (Japan) (Mon Dec 22 1997)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, batridjaRomInfo, batridjaRomName, NULL, NULL, batriderInputInfo, batriderDIPInfo, + drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBatridta = { + "batridert", "batrider", NULL, NULL, "1998", + "Armed Police Batrider - A Version (Taiwan) (Mon Dec 22 1997)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, batridtaRomInfo, batridtaRomName, NULL, NULL, batriderInputInfo, batridtaDIPInfo, + drvInit, drvExit, drvFrame, drvDraw, drvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; diff --git a/src/burn/drv/toaplan/d_battleg.cpp b/src/burn/drv/toaplan/d_battleg.cpp index 220131c2d..9248904ec 100644 --- a/src/burn/drv/toaplan/d_battleg.cpp +++ b/src/burn/drv/toaplan/d_battleg.cpp @@ -1,1017 +1,1016 @@ -#include "toaplan.h" -// Battle Garegga - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static UINT8 nIRQPending; - -static INT32 nSoundCommand; - -// Z80 ROM bank -static INT32 nCurrentBank; - -INT32 Bgareggabl = 0; - -// Rom information -static struct BurnRomInfo bgareggaRomDesc[] = { - { "prg0.bin", 0x080000, 0xF80C2FC2, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg1.bin", 0x080000, 0x2CCFDD1E, BRF_ESS | BRF_PRG }, // 1 (odd) - - { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data - { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 - { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 - { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 - - { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data - - { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program - - { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(bgaregga) -STD_ROM_FN(bgaregga) - -static struct BurnRomInfo bgareghkRomDesc[] = { - { "prg_0.rom", 0x080000, 0x26E0019E, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg_1.rom", 0x080000, 0x2CCFDD1E, BRF_ESS | BRF_PRG }, // 1 (odd) - - { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data - { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 - { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 - { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 - - { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data - - { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program - - { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(bgareghk) -STD_ROM_FN(bgareghk) - -static struct BurnRomInfo bgaregnvRomDesc[] = { - { "prg_0.bin", 0x080000, 0x951ECC07, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg_1.bin", 0x080000, 0x729A60C6, BRF_ESS | BRF_PRG }, // 1 (odd) - - { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data - { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 - { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 - { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 - - { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data - - { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program - - { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(bgaregnv) -STD_ROM_FN(bgaregnv) - -static struct BurnRomInfo bgaregt2RomDesc[] = { - { "prg0", 0x080000, 0x84094099, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg1", 0x080000, 0x46f92fe4, BRF_ESS | BRF_PRG }, // 1 (odd) - - { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data - { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 - { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 - { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 - - { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data - - { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program - - { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(bgaregt2) -STD_ROM_FN(bgaregt2) - -static struct BurnRomInfo bgaregcnRomDesc[] = { - { "u123", 0x080000, 0x88A4E66A, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "u65", 0x080000, 0x5DEA32A3, BRF_ESS | BRF_PRG }, // 1 (odd) - - { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data - { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 - { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 - { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 - - { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data - - { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program - - { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(bgaregcn) -STD_ROM_FN(bgaregcn) - -static struct BurnRomInfo bgaregtwRomDesc[] = { - { "garegga_prg0.u123",0x080000, 0x235b7405, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "garegga_prg1.u65", 0x080000, 0xc29ccf6a, BRF_ESS | BRF_PRG }, // 1 (odd) - - { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data - { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 - { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 - { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 - - { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data - - { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program - - { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(bgaregtw) -STD_ROM_FN(bgaregtw) - - -static struct BurnRomInfo bgareggablRomDesc[] = { - { "xt-8m.bin", 0x100000, 0x4a6657cb, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - - { "6#-322", 0x400000, 0x37fe48ed, BRF_GRA }, // 1 GP9001 Tile data - { "5#-322", 0x400000, 0x5a06c031, BRF_GRA }, // 2 - - { "1#-256", 0x008000, 0x760dcd14, BRF_GRA }, // 3 Extra text layer tile data - - { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 4 Z80 program - - { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 5 MSM6295 ADPCM data - - { "2#-256", 0x008000, 0x456dd16e, BRF_GRA }, // 6 (looks like garbage) -}; - - -STD_ROM_PICK(bgareggabl) -STD_ROM_FN(bgareggabl) - -static struct BurnInputInfo battlegInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, -}; - -STDINPUTINFO(battleg) - -static struct BurnDIPInfo bgareggaDIPList[] = { - - // Defaults - {0x14, 0xFF, 0xFF, 0x00, NULL}, - {0x15, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, "Test mode"}, - {0x14, 0x01, 0x01, 0x00, "Normal"}, - {0x14, 0x01, 0x01, 0x01, "Test"}, - {0, 0xFE, 0, 2, "Starting coin"}, - {0x14, 0x01, 0x02, 0x00, "1 credit"}, - {0x14, 0x01, 0x02, 0x02, "2 credits"}, - {0, 0xFE, 0, 8, "Coin 1"}, - {0x14, 0x01, 0x1C, 0x00, "1 coin 1 credit"}, - {0x14, 0x01, 0x1C, 0x04, "1 coin 2 credits"}, - {0x14, 0x01, 0x1C, 0x08, "1 coin 3 credits"}, - {0x14, 0x01, 0x1C, 0x0C, "1 coin 3 credits"}, - {0x14, 0x01, 0x1C, 0x10, "2 coins 1 credit"}, - {0x14, 0x01, 0x1C, 0x14, "3 coins 1 credit"}, - {0x14, 0x01, 0x1C, 0x18, "4 coins 1 credit"}, - {0x14, 0x01, 0x1C, 0x1C, "Free Play"}, - // 0x1C: Free play settings active - // Normal - {0, 0xFE, 0, 7, "Coin 2"}, - {0x14, 0x82, 0xE0, 0x00, "1 coin 1 credit"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0x14, 0x82, 0xE0, 0x20, "1 coin 2 credits"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0x14, 0x82, 0xE0, 0x40, "1 coin 3 credits"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0x14, 0x82, 0xE0, 0x60, "1 coin 3 credits"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0x14, 0x82, 0xE0, 0x80, "2 coins 1 credit"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0x14, 0x82, 0xE0, 0xA0, "3 coins 1 credit"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0x14, 0x82, 0xE0, 0xC0, "4 coins 1 credit"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0x14, 0x82, 0xE0, 0x04, "1 coin 1 credit"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - // Free play - {0, 0xFE, 0, 2, "Stick mode"}, - {0x14, 0x02, 0x20, 0x00, "Special"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0x14, 0x02, 0x20, 0x20, "Normal"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0, 0xFE, 0, 2, "Effect"}, - {0x14, 0x02, 0x40, 0x00, "Off"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0x14, 0x02, 0x40, 0x40, "On"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0, 0xFE, 0, 2, "Music"}, - {0x14, 0x02, 0x80, 0x00, "Off"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - {0x14, 0x02, 0x80, 0x80, "On"}, - {0x14, 0x00, 0x1C, 0x1C, NULL}, - - // DIP 2 - {0, 0xFE, 0, 4, "Difficulty"}, - {0x15, 0x01, 0x03, 0x00, "Normal"}, - {0x15, 0x01, 0x03, 0x01, "Easy"}, - {0x15, 0x01, 0x03, 0x02, "Hard"}, - {0x15, 0x01, 0x03, 0x03, "Very hard"}, - {0, 0xFE, 0, 2, "Screen flip"}, - {0x15, 0x01, 0x04, 0x00, "Off"}, - {0x15, 0x01, 0x04, 0x04, "On"}, - {0, 0xFE, 0, 2, "Demo sound"}, - {0x15, 0x01, 0x08, 0x00, "On"}, - {0x15, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 8, "Player counts"}, - {0x15, 0x01, 0x70, 0x00, "3"}, - {0x15, 0x01, 0x70, 0x10, "4"}, - {0x15, 0x01, 0x70, 0x20, "2"}, - {0x15, 0x01, 0x70, 0x30, "1"}, - {0x15, 0x01, 0x70, 0x40, "5"}, - {0x15, 0x01, 0x70, 0x50, "6"}, - {0x15, 0x01, 0x70, 0x60, "Multiple"}, - {0x15, 0x01, 0x70, 0x70, "Invincible"}, - // Nippon and U.S.A. regions - {0, 0xFE, 0, 2, "Extra player"}, - {0x15, 0x02, 0x80, 0x00, "1000000 each"}, - {0x16, 0x00, 0x01, 0x00, NULL}, - {0x15, 0x02, 0x80, 0x80, "1000000 2000000"}, - {0x16, 0x00, 0x01, 0x00, NULL}, - // Europe/Denmark and Asia regions - {0, 0xFE, 0, 2, "Extra player"}, - {0x15, 0x02, 0x80, 0x80, "2000000 each"}, - {0x16, 0x00, 0x01, 0x01, NULL}, - {0x15, 0x02, 0x80, 0x00, "No extra"}, - {0x16, 0x00, 0x01, 0x01, NULL}, - - // DIP 3 - {0, 0xFE, 0, 2, "Continue play"}, - {0x16, 0x01, 0x04, 0x00, "On"}, - {0x16, 0x01, 0x04, 0x04, "Off"}, -}; - -static struct BurnDIPInfo bgaregcnRegionDIPList[] = { - // DIP 3 - {0, 0xFE, 0, 2, "Stage edit"}, - {0x16, 0x01, 0x08, 0x00, "Disable"}, - {0x16, 0x01, 0x08, 0x08, "Enable"}, - - // Region - {0x16, 0xFF, 0x0F, 0x01, NULL}, - {0, 0xFE, 0, 2, "Region"}, - {0x16, 0x01, 0x03, 0x01, "Denmark (German Tuning license)"}, - {0x16, 0x01, 0x03, 0x03, "China"}, - {0x16, 0x01, 0x03, 0x00, "Japan [illegal setting]"}, - {0x16, 0x01, 0x03, 0x02, "U.S.A. (Fabtek license) [illegal setting]"}, -}; - -static struct BurnDIPInfo bgareggaRegionDIPList[] = { - // DIP 3 - {0, 0xFE, 0, 2, "Stage edit"}, - {0x16, 0x01, 0x08, 0x00, "Disable"}, - {0x16, 0x01, 0x08, 0x08, "Enable"}, - - // Region - {0x16, 0xFF, 0x0F, 0x00, NULL}, - {0, 0xFE, 0, 4, "Region"}, - {0x16, 0x01, 0x03, 0x00, "Japan"}, - {0x16, 0x01, 0x03, 0x01, "Europe (German Tuning license"}, - {0x16, 0x01, 0x03, 0x02, "U.S.A. (Fabtek license)"}, - {0x16, 0x01, 0x03, 0x03, "Asia"}, -}; - -static struct BurnDIPInfo bgareghkRegionDIPList[] = { - // DIP 3 - {0, 0xFE, 0, 2, "Stage edit"}, - {0x16, 0x01, 0x08, 0x00, "Disable"}, - {0x16, 0x01, 0x08, 0x08, "Enable"}, - - // Region - {0x16, 0xFF, 0x0F, 0x01, NULL}, - {0, 0xFE, 0, 2, "Region"}, - {0x16, 0x01, 0x03, 0x01, "Austria (German Tuning license"}, - {0x16, 0x01, 0x03, 0x03, "Hong Kong (metrotainment license"}, - {0x16, 0x01, 0x03, 0x00, "Japan [illegal setting]"}, - {0x16, 0x01, 0x03, 0x02, "U.S.A. (Fabtek license) [illegal setting]"}, -}; - -static struct BurnDIPInfo bgaregtwRegionDIPList[] = { - // DIP 3 - {0, 0xFE, 0, 2, "Stage edit"}, - {0x16, 0x01, 0x08, 0x00, "Disable"}, - {0x16, 0x01, 0x08, 0x08, "Enable"}, - - // Region - {0x16, 0xFF, 0x0F, 0x01, NULL}, - {0, 0xFE, 0, 2, "Region"}, - {0x16, 0x01, 0x03, 0x01, "Germany (German Tuning license)"}, - {0x16, 0x01, 0x03, 0x03, "Taiwan (Liang Hwa license)"}, - {0x16, 0x01, 0x03, 0x00, "Japan [illegal setting]"}, - {0x16, 0x01, 0x03, 0x02, "U.S.A. (Fabtek license) [illegal setting]"}, -}; - -STDDIPINFOEXT(bgaregga, bgaregga, bgareggaRegion) -STDDIPINFOEXT(bgaregcn, bgaregga, bgaregcnRegion) -STDDIPINFOEXT(bgareghk, bgaregga, bgareghkRegion) -STDDIPINFOEXT(bgaregtw, bgaregga, bgaregtwRegion) - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *Ram01, *Ram02, *RamPal; - -static INT32 nColCount = 0x0800; -static INT32 nMSM6295ROMSize = 0x100000; - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x100000; // - RomZ80 = Next; Next += 0x020000; // Z80 ROM - GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data - ExtraTROM = Next; Next += 0x010000; // Extra Text layer tile data - MSM6295ROM = Next; Next += nMSM6295ROMSize; // ADPCM data - RamStart = Next; - Ram01 = Next; Next += 0x010000; // CPU #0 work RAM - Ram02 = Next; Next += 0x000800; // - ExtraTRAM = Next; Next += 0x002000; // Extra tile layer - ExtraTScroll= Next; Next += 0x001000; // - ExtraTSelect= Next; Next += 0x001000; // - RamPal = Next; Next += 0x001000; // palette - RamZ80 = Next; Next += 0x004000; // Z80 RAM - GP9001RAM[0]= Next; Next += 0x004000; - GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); - RamEnd = Next; - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -static void drvZ80Bankswitch(INT32 nBank) -{ - nBank &= 0x07; - if (nBank != nCurrentBank) { - UINT8* nStartAddress = RomZ80 + (nBank << 14); - ZetMapArea(0x8000, 0xBFFF, 0, nStartAddress); - ZetMapArea(0x8000, 0xBFFF, 2, nStartAddress); - - nCurrentBank = nBank; - } -} - -// Scan ram -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029497; - } - if (nAction & ACB_VOLATILE) { // Scan volatile data - - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); // scan 68000 states - ZetScan(nAction); // Scan Z80 - SCAN_VAR(nCurrentBank); - - MSM6295Scan(0, nAction); - BurnYM2151Scan(nAction); - - ToaScanGP9001(nAction, pnMin); - - SCAN_VAR(DrvInput); - SCAN_VAR(nSoundCommand); - SCAN_VAR(nIRQPending); - - if (nAction & ACB_WRITE) { - INT32 nBank = nCurrentBank; - nCurrentBank = -1; - drvZ80Bankswitch(nBank); - } - } - - return 0; -} - -static INT32 LoadRoms() -{ - // Load 68000 ROM - if (ToaLoadCode(Rom01, 0, 2)) { - return 1; - } - - // Load GP9001 tile data - ToaLoadGP9001Tiles(GP9001ROM[0], 2, 4, nGP9001ROMSize[0]); - - // Load Extra text layer tile data - BurnLoadRom(ExtraTROM, 6, 1); - - // Load the Z80 ROM - BurnLoadRom(RomZ80, 7, 1); - - // Load ADPCM data - BurnLoadRom(MSM6295ROM, 8, 1); - - return 0; -} - -static INT32 LoadRomsBl() -{ - // Load 68000 ROM - if (BurnLoadRom(Rom01, 0, 1)) { - return 1; - } - - // Load GP9001 tile data - ToaLoadGP9001Tiles(GP9001ROM[0], 1, 2, nGP9001ROMSize[0]); - - // Load Extra text layer tile data - BurnLoadRom(ExtraTROM, 3, 1); - - // Load the Z80 ROM - BurnLoadRom(RomZ80, 4, 1); - - // Load ADPCM data - BurnLoadRom(MSM6295ROM, 5, 1); - - return 0; -} - -UINT8 __fastcall battlegZ80Read(UINT16 nAddress) -{ -// printf("z80 read %4X\n", nAddress); - switch (nAddress) { - case 0xE001: - return BurnYM2151ReadStatus(); - - case 0xE004: - return MSM6295ReadStatus(0); - - case 0xE01C: - return nSoundCommand; - - case 0xE01D: - // Bit 0 enables/disables interrupt processing (0 = enabled) - return 0; - } - return 0; -} - -void __fastcall battlegZ80Write(UINT16 nAddress, UINT8 nValue) -{ -// printf("z80 wrote %4X with %2X\n", nAddress, nValue); - switch (nAddress) { - case 0xE000: - BurnYM2151SelectRegister(nValue); - break; - case 0xE001: - BurnYM2151WriteRegister(nValue); - break; - - case 0xE004: - MSM6295Command(0, nValue); - break; - - case 0xE006: - MSM6295SampleInfo[0][0] = MSM6295ROM + ((nValue & 0x0F) << 16); - MSM6295SampleData[0][0] = MSM6295ROM + ((nValue & 0x0F) << 16); - MSM6295SampleInfo[0][1] = MSM6295ROM + ((nValue & 0xF0) << 12) + 0x0100; - MSM6295SampleData[0][1] = MSM6295ROM + ((nValue & 0xF0) << 12); - break; - case 0xE008: - MSM6295SampleInfo[0][2] = MSM6295ROM + ((nValue & 0x0F) << 16) + 0x0200; - MSM6295SampleData[0][2] = MSM6295ROM + ((nValue & 0x0F) << 16); - MSM6295SampleInfo[0][3] = MSM6295ROM + ((nValue & 0xF0) << 12) + 0x0300; - MSM6295SampleData[0][3] = MSM6295ROM + ((nValue & 0xF0) << 12); - break; - - case 0xE00A: { - drvZ80Bankswitch(nValue); - break; - } - - case 0xE00C: - // Once a sound command is processed, it is written to this address - // printf("z80 wrote %4X -> %2X\n", nAddress, nValue); - break; - - } -} - -static INT32 DrvZ80Init() -{ - ZetInit(0); - ZetOpen(0); - - ZetSetReadHandler(battlegZ80Read); - ZetSetWriteHandler(battlegZ80Write); - - // ROM bank 1 - ZetMapArea (0x0000, 0x7FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM - ZetMapArea (0x0000, 0x7FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM - // ROM bank 2 - ZetMapArea (0x8000, 0xBFFF, 0, RomZ80 + 0x8000); // Direct Read from ROM - ZetMapArea (0x8000, 0xBFFF, 2, RomZ80 + 0x8000); // Direct Fetch from ROM - // RAM - ZetMapArea (0xC000, 0xDFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0xC000, 0xDFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0xC000, 0xDFFF, 2, RamZ80); // - // Ports - ZetMemCallback(0xE000, 0xE0FF, 0); // Read - ZetMemCallback(0xE000, 0xE0FF, 1); // Write - - ZetMemEnd(); - ZetClose(); - - nCurrentBank = 2; - - return 0; -} - -UINT8 __fastcall battlegReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x218021: // The 68K has access to the Z80 RAM - return RamZ80[0x10]; // Only these addresses are used, however - case 0x218023: // - return RamZ80[0x11]; // - - case 0x21C021: // Player 1 inputs - return DrvInput[0]; - case 0x21C025: // Player 2 inputs - return DrvInput[1]; - case 0x21C029: // Other inputs - return DrvInput[2]; - case 0x21C02D: // Dipswitch A - return DrvInput[3]; - case 0x21C031: // Dipswitch B - return DrvInput[4]; - case 0x21C035: // Dipswitch C - Territory - return DrvInput[5]; - -// default: -// printf("Attempt to read byte value of location %x\n", sekAddress); - } - return 0; -} - -UINT16 __fastcall battlegReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x21C03C: - return ToaScanlineRegister(); - - case 0x300004: - return ToaGP9001ReadRAM_Hi(0); - case 0x300006: - return ToaGP9001ReadRAM_Lo(0); - -// default: -// printf("Attempt to read word value of location %x\n", sekAddress); - } - return 0; -} - -void __fastcall battlegWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - - case 0x218021: // The 68K has access to the Z80 RAM - RamZ80[0x10] = byteValue; // Only these addresses are used, however - break; - - case 0x21C01D: // Coin control - break; - - case 0x600001: - nSoundCommand = byteValue; - - // Trigger Z80 interrupt, and allow the Z80 to process it - ZetRaiseIrq(255); - nCyclesDone[1] += ZetRun(0x0200); - break; - -// default: -// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } -} - -void __fastcall battlegWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - -// static int p; - - case 0x300000: // Set GP9001 VRAM address-pointer - ToaGP9001SetRAMPointer(wordValue); -// p = wordValue & 0x1FFF; - break; - - case 0x300004: -// if (p++ >= 0x1800) { -// static int s; -// if (s != SekCurrentScanline()) { -// s = SekCurrentScanline(); -// bprintf(PRINT_NORMAL, _T(" - sprite (%3i).\n"), s); -// } -// } - case 0x300006: -// p++; - ToaGP9001WriteRAM(wordValue, 0); - break; - - case 0x300008: - ToaGP9001SelectRegister(wordValue); - break; - - case 0x30000C: { - ToaGP9001WriteRegister(wordValue); - break; - } - -// default: -// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); - } -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - nIRQPending = 0; - SekSetIRQLine(0, SEK_IRQSTATUS_NONE); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM2151Reset(); - - return 0; -} - -static INT32 battlegInit() -{ - INT32 nLen; - -#ifdef DRIVER_ROTATION - bToaRotateScreen = true; -#endif - - nGP9001ROMSize[0] = 0x800000; - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (Bgareggabl) { - if (LoadRomsBl()) { - return 1; - } - } else { - if (LoadRoms()) { - return 1; - } - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x100000, 0x10FFFF, SM_RAM); - SekMapMemory(RamPal, 0x400000, 0x400FFF, SM_RAM); // Palette RAM - SekMapMemory(Ram02, 0x401000, 0x4017FF, SM_RAM); // Unused - SekMapMemory(ExtraTRAM, 0x500000, 0x501FFF, SM_RAM); - SekMapMemory(ExtraTSelect, 0x502000, 0x502FFF, SM_RAM); // 0x502000 - Scroll; 0x502200 - RAM - SekMapMemory(ExtraTScroll, 0x503000, 0x503FFF, SM_RAM); // 0x203000 - Offset; 0x503200 - RAM - - SekSetReadWordHandler(0, battlegReadWord); - SekSetReadByteHandler(0, battlegReadByte); - SekSetWriteWordHandler(0, battlegWriteWord); - SekSetWriteByteHandler(0, battlegWriteByte); - - SekClose(); - } - - nSpriteXOffset = 0x0024; - nSpriteYOffset = 0x0001; - - nLayer0XOffset = -0x01D6; - nLayer1XOffset = -0x01D8; - nLayer2XOffset = -0x01DA; - - ToaInitGP9001(); - - nExtraTXOffset = 0x2C; - ToaExtraTextInit(); - - if (Bgareggabl) nExtraTXOffset = 0; - - DrvZ80Init(); // Initialize Z80 - - BurnYM2151Init(32000000 / 8); - BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - MSM6295Init(0, 32000000 / 16 / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - nToaPalLen = nColCount; - ToaPalSrc = RamPal; - ToaPalInit(); - - bDrawScreen = true; - - // mar 2 1996 & apr 2 1996 ver: 0x0009AC - 0x0009B8 & 0x001F5E - 0x001F64 & 0x003A1C - 0x003A22 - // feb 2 1996 ver: 0x0009AC - 0x0009B8 & 0x001F2E - 0x001F34 & 0x0039EC - 0x0039F2 - - DrvDoReset(); // Reset machine - return 0; -} - -static INT32 BgareggablInit() -{ - Bgareggabl = 1; - - return battlegInit(); -} - -static INT32 DrvExit() -{ - MSM6295Exit(0); - BurnYM2151Exit(); - - ToaPalExit(); - ToaExitGP9001(); - ToaExtraTextExit(); - ToaZExit(); // Z80 exit - SekExit(); // Deallocate 68000s - - BurnFree(Mem); - - Bgareggabl = 0; - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderGP9001(); // Render GP9001 graphics - ToaExtraTextLayer(); // Render extra text layer - } - - ToaPalUpdate(); // Update the palette - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 8; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x00; // Buttons - DrvInput[1] = 0x00; // Player 1 - DrvInput[2] = 0x00; // Player 2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[2] |= (DrvButton[i] & 1) << i; - } - ToaClearOpposites(&DrvInput[0]); - ToaClearOpposites(&DrvInput[1]); - - SekNewFrame(); - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = TOA_Z80_SPEED / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekOpen(0); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - INT32 nSoundBufferPos = 0; - - ZetOpen(0); - for (INT32 i = 1; i <= nInterleave; i++) { - INT32 nCurrentCPU; - INT32 nNext; - - // Run 68000 - - nCurrentCPU = 0; - nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; - - // Trigger VBlank interrupt - if (!bVBlank && nNext > nToaCyclesVBlankStart) { - if (nCyclesDone[nCurrentCPU] < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - } - - nIRQPending = 1; - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - - ToaBufferGP9001Sprites(); - - if (pBurnDraw) { - DrvDraw(); // Draw screen if needed - } - - bVBlank = true; - } - - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - nIRQPending = 0; - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - - if ((i & 1) == 0) { - // Run Z80 - nCurrentCPU = 1; - nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - - // Render sound segment - if (pBurnSoundOut) { - INT32 nSegmentLength = (nBurnSoundLen * i / nInterleave) - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - } - - SekClose(); - - { - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - } - - ZetClose(); - - return 0; -} - -struct BurnDriver BurnDrvBgaregga = { - "bgaregga", NULL, NULL, NULL, "1996", - "Battle Garegga (World) (Sat Feb 3 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, bgareggaRomInfo, bgareggaRomName, NULL, NULL, battlegInputInfo, bgareggaDIPInfo, - battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBgaregcn = { - "bgareggacn", "bgaregga", NULL, NULL, "1996", - "Battle Garegga - Type 2 (China / Denmark?) (Tue Apr 2 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, bgaregcnRomInfo, bgaregcnRomName, NULL, NULL, battlegInputInfo, bgaregcnDIPInfo, - battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBgaregt2 = { - "bgareggat2", "bgaregga", NULL, NULL, "1996", - "Battle Garegga - Type 2 (World) (Sat Mar 2 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, bgaregt2RomInfo, bgaregt2RomName, NULL, NULL, battlegInputInfo, bgareggaDIPInfo, - battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBgaregnv = { - "bgaregganv", "bgaregga", NULL, NULL, "1996", - "Battle Garegga - New Version (Hong Kong / Austria?) (Sat Mar 2 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, bgaregnvRomInfo, bgaregnvRomName, NULL, NULL, battlegInputInfo, bgareghkDIPInfo, - battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBgareghk = { - "bgareggahk", "bgaregga", NULL, NULL, "1996", - "Battle Garegga (Hong Kong / Austria?) (Sat Feb 3 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, bgareghkRomInfo, bgareghkRomName, NULL, NULL, battlegInputInfo, bgareghkDIPInfo, - battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBgaregtw = { - "bgareggatw", "bgaregga", NULL, NULL, "1996", - "Battle Garegga (Taiwan / Germany) (Thu Feb 1 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, bgaregtwRomInfo, bgaregtwRomName, NULL, NULL, battlegInputInfo, bgaregtwDIPInfo, - battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBgareggabl = { - "bgareggabl", "bgaregga", NULL, NULL, "1996", - "1945 Part 2 (Battle Garaga hack)\0", NULL, "hack", "Toaplan GP9001 based", - L"1945 Part 2\0\uFF11\uFF19\uFF14\uFF15\u4E8C\u4EE3 (Battle Garrega Chinese hack)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW | BDF_HACK, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, bgareggablRomInfo, bgareggablRomName, NULL, NULL, battlegInputInfo, bgareggaDIPInfo, - BgareggablInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; +#include "toaplan.h" +// Battle Garegga + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static UINT8 nIRQPending; + +static INT32 nSoundCommand; + +// Z80 ROM bank +static INT32 nCurrentBank; + +INT32 Bgareggabl = 0; + +// Rom information +static struct BurnRomInfo bgareggaRomDesc[] = { + { "prg0.bin", 0x080000, 0xF80C2FC2, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg1.bin", 0x080000, 0x2CCFDD1E, BRF_ESS | BRF_PRG }, // 1 (odd) + + { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data + { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 + { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 + { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 + + { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data + + { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program + + { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(bgaregga) +STD_ROM_FN(bgaregga) + +static struct BurnRomInfo bgareghkRomDesc[] = { + { "prg_0.rom", 0x080000, 0x26E0019E, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg_1.rom", 0x080000, 0x2CCFDD1E, BRF_ESS | BRF_PRG }, // 1 (odd) + + { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data + { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 + { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 + { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 + + { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data + + { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program + + { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(bgareghk) +STD_ROM_FN(bgareghk) + +static struct BurnRomInfo bgaregnvRomDesc[] = { + { "prg_0.bin", 0x080000, 0x951ECC07, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg_1.bin", 0x080000, 0x729A60C6, BRF_ESS | BRF_PRG }, // 1 (odd) + + { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data + { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 + { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 + { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 + + { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data + + { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program + + { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(bgaregnv) +STD_ROM_FN(bgaregnv) + +static struct BurnRomInfo bgaregt2RomDesc[] = { + { "prg0", 0x080000, 0x84094099, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg1", 0x080000, 0x46f92fe4, BRF_ESS | BRF_PRG }, // 1 (odd) + + { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data + { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 + { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 + { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 + + { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data + + { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program + + { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(bgaregt2) +STD_ROM_FN(bgaregt2) + +static struct BurnRomInfo bgaregcnRomDesc[] = { + { "u123", 0x080000, 0x88A4E66A, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "u65", 0x080000, 0x5DEA32A3, BRF_ESS | BRF_PRG }, // 1 (odd) + + { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data + { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 + { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 + { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 + + { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data + + { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program + + { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(bgaregcn) +STD_ROM_FN(bgaregcn) + +static struct BurnRomInfo bgaregtwRomDesc[] = { + { "garegga_prg0.u123",0x080000, 0x235b7405, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "garegga_prg1.u65", 0x080000, 0xc29ccf6a, BRF_ESS | BRF_PRG }, // 1 (odd) + + { "rom4.bin", 0x200000, 0xB333D81F, BRF_GRA }, // 2 GP9001 Tile data + { "rom3.bin", 0x200000, 0x51B9EBFB, BRF_GRA }, // 3 + { "rom2.bin", 0x200000, 0xB330E5E2, BRF_GRA }, // 4 + { "rom1.bin", 0x200000, 0x7EAFDD70, BRF_GRA }, // 5 + + { "text.u81", 0x008000, 0xE67FD534, BRF_GRA }, // 6 Extra text layer tile data + + { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 7 Z80 program + + { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 8 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(bgaregtw) +STD_ROM_FN(bgaregtw) + + +static struct BurnRomInfo bgareggablRomDesc[] = { + { "xt-8m.bin", 0x100000, 0x4a6657cb, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + + { "6#-322", 0x400000, 0x37fe48ed, BRF_GRA }, // 1 GP9001 Tile data + { "5#-322", 0x400000, 0x5a06c031, BRF_GRA }, // 2 + + { "1#-256", 0x008000, 0x760dcd14, BRF_GRA }, // 3 Extra text layer tile data + + { "snd.bin", 0x020000, 0x68632952, BRF_ESS | BRF_PRG }, // 4 Z80 program + + { "rom5.bin", 0x100000, 0xF6D49863, BRF_SND }, // 5 MSM6295 ADPCM data + + { "2#-256", 0x008000, 0x456dd16e, BRF_GRA }, // 6 (looks like garbage) +}; + + +STD_ROM_PICK(bgareggabl) +STD_ROM_FN(bgareggabl) + +static struct BurnInputInfo battlegInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, +}; + +STDINPUTINFO(battleg) + +static struct BurnDIPInfo bgareggaDIPList[] = { + + // Defaults + {0x14, 0xFF, 0xFF, 0x00, NULL}, + {0x15, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, "Test mode"}, + {0x14, 0x01, 0x01, 0x00, "Normal"}, + {0x14, 0x01, 0x01, 0x01, "Test"}, + {0, 0xFE, 0, 2, "Starting coin"}, + {0x14, 0x01, 0x02, 0x00, "1 credit"}, + {0x14, 0x01, 0x02, 0x02, "2 credits"}, + {0, 0xFE, 0, 8, "Coin 1"}, + {0x14, 0x01, 0x1C, 0x00, "1 coin 1 credit"}, + {0x14, 0x01, 0x1C, 0x04, "1 coin 2 credits"}, + {0x14, 0x01, 0x1C, 0x08, "1 coin 3 credits"}, + {0x14, 0x01, 0x1C, 0x0C, "1 coin 3 credits"}, + {0x14, 0x01, 0x1C, 0x10, "2 coins 1 credit"}, + {0x14, 0x01, 0x1C, 0x14, "3 coins 1 credit"}, + {0x14, 0x01, 0x1C, 0x18, "4 coins 1 credit"}, + {0x14, 0x01, 0x1C, 0x1C, "Free Play"}, + // 0x1C: Free play settings active + // Normal + {0, 0xFE, 0, 7, "Coin 2"}, + {0x14, 0x82, 0xE0, 0x00, "1 coin 1 credit"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0x14, 0x82, 0xE0, 0x20, "1 coin 2 credits"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0x14, 0x82, 0xE0, 0x40, "1 coin 3 credits"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0x14, 0x82, 0xE0, 0x60, "1 coin 3 credits"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0x14, 0x82, 0xE0, 0x80, "2 coins 1 credit"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0x14, 0x82, 0xE0, 0xA0, "3 coins 1 credit"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0x14, 0x82, 0xE0, 0xC0, "4 coins 1 credit"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0x14, 0x82, 0xE0, 0x04, "1 coin 1 credit"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + // Free play + {0, 0xFE, 0, 2, "Stick mode"}, + {0x14, 0x02, 0x20, 0x00, "Special"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0x14, 0x02, 0x20, 0x20, "Normal"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0, 0xFE, 0, 2, "Effect"}, + {0x14, 0x02, 0x40, 0x00, "Off"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0x14, 0x02, 0x40, 0x40, "On"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0, 0xFE, 0, 2, "Music"}, + {0x14, 0x02, 0x80, 0x00, "Off"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + {0x14, 0x02, 0x80, 0x80, "On"}, + {0x14, 0x00, 0x1C, 0x1C, NULL}, + + // DIP 2 + {0, 0xFE, 0, 4, "Difficulty"}, + {0x15, 0x01, 0x03, 0x00, "Normal"}, + {0x15, 0x01, 0x03, 0x01, "Easy"}, + {0x15, 0x01, 0x03, 0x02, "Hard"}, + {0x15, 0x01, 0x03, 0x03, "Very hard"}, + {0, 0xFE, 0, 2, "Screen flip"}, + {0x15, 0x01, 0x04, 0x00, "Off"}, + {0x15, 0x01, 0x04, 0x04, "On"}, + {0, 0xFE, 0, 2, "Demo sound"}, + {0x15, 0x01, 0x08, 0x00, "On"}, + {0x15, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 8, "Player counts"}, + {0x15, 0x01, 0x70, 0x00, "3"}, + {0x15, 0x01, 0x70, 0x10, "4"}, + {0x15, 0x01, 0x70, 0x20, "2"}, + {0x15, 0x01, 0x70, 0x30, "1"}, + {0x15, 0x01, 0x70, 0x40, "5"}, + {0x15, 0x01, 0x70, 0x50, "6"}, + {0x15, 0x01, 0x70, 0x60, "Multiple"}, + {0x15, 0x01, 0x70, 0x70, "Invincible"}, + // Nippon and U.S.A. regions + {0, 0xFE, 0, 2, "Extra player"}, + {0x15, 0x02, 0x80, 0x00, "1000000 each"}, + {0x16, 0x00, 0x01, 0x00, NULL}, + {0x15, 0x02, 0x80, 0x80, "1000000 2000000"}, + {0x16, 0x00, 0x01, 0x00, NULL}, + // Europe/Denmark and Asia regions + {0, 0xFE, 0, 2, "Extra player"}, + {0x15, 0x02, 0x80, 0x80, "2000000 each"}, + {0x16, 0x00, 0x01, 0x01, NULL}, + {0x15, 0x02, 0x80, 0x00, "No extra"}, + {0x16, 0x00, 0x01, 0x01, NULL}, + + // DIP 3 + {0, 0xFE, 0, 2, "Continue play"}, + {0x16, 0x01, 0x04, 0x00, "On"}, + {0x16, 0x01, 0x04, 0x04, "Off"}, +}; + +static struct BurnDIPInfo bgaregcnRegionDIPList[] = { + // DIP 3 + {0, 0xFE, 0, 2, "Stage edit"}, + {0x16, 0x01, 0x08, 0x00, "Disable"}, + {0x16, 0x01, 0x08, 0x08, "Enable"}, + + // Region + {0x16, 0xFF, 0x0F, 0x01, NULL}, + {0, 0xFE, 0, 2, "Region"}, + {0x16, 0x01, 0x03, 0x01, "Denmark (German Tuning license)"}, + {0x16, 0x01, 0x03, 0x03, "China"}, + {0x16, 0x01, 0x03, 0x00, "Japan [illegal setting]"}, + {0x16, 0x01, 0x03, 0x02, "U.S.A. (Fabtek license) [illegal setting]"}, +}; + +static struct BurnDIPInfo bgareggaRegionDIPList[] = { + // DIP 3 + {0, 0xFE, 0, 2, "Stage edit"}, + {0x16, 0x01, 0x08, 0x00, "Disable"}, + {0x16, 0x01, 0x08, 0x08, "Enable"}, + + // Region + {0x16, 0xFF, 0x0F, 0x00, NULL}, + {0, 0xFE, 0, 4, "Region"}, + {0x16, 0x01, 0x03, 0x00, "Japan"}, + {0x16, 0x01, 0x03, 0x01, "Europe (German Tuning license"}, + {0x16, 0x01, 0x03, 0x02, "U.S.A. (Fabtek license)"}, + {0x16, 0x01, 0x03, 0x03, "Asia"}, +}; + +static struct BurnDIPInfo bgareghkRegionDIPList[] = { + // DIP 3 + {0, 0xFE, 0, 2, "Stage edit"}, + {0x16, 0x01, 0x08, 0x00, "Disable"}, + {0x16, 0x01, 0x08, 0x08, "Enable"}, + + // Region + {0x16, 0xFF, 0x0F, 0x01, NULL}, + {0, 0xFE, 0, 2, "Region"}, + {0x16, 0x01, 0x03, 0x01, "Austria (German Tuning license"}, + {0x16, 0x01, 0x03, 0x03, "Hong Kong (metrotainment license"}, + {0x16, 0x01, 0x03, 0x00, "Japan [illegal setting]"}, + {0x16, 0x01, 0x03, 0x02, "U.S.A. (Fabtek license) [illegal setting]"}, +}; + +static struct BurnDIPInfo bgaregtwRegionDIPList[] = { + // DIP 3 + {0, 0xFE, 0, 2, "Stage edit"}, + {0x16, 0x01, 0x08, 0x00, "Disable"}, + {0x16, 0x01, 0x08, 0x08, "Enable"}, + + // Region + {0x16, 0xFF, 0x0F, 0x01, NULL}, + {0, 0xFE, 0, 2, "Region"}, + {0x16, 0x01, 0x03, 0x01, "Germany (German Tuning license)"}, + {0x16, 0x01, 0x03, 0x03, "Taiwan (Liang Hwa license)"}, + {0x16, 0x01, 0x03, 0x00, "Japan [illegal setting]"}, + {0x16, 0x01, 0x03, 0x02, "U.S.A. (Fabtek license) [illegal setting]"}, +}; + +STDDIPINFOEXT(bgaregga, bgaregga, bgareggaRegion) +STDDIPINFOEXT(bgaregcn, bgaregga, bgaregcnRegion) +STDDIPINFOEXT(bgareghk, bgaregga, bgareghkRegion) +STDDIPINFOEXT(bgaregtw, bgaregga, bgaregtwRegion) + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *Ram01, *Ram02, *RamPal; + +static INT32 nColCount = 0x0800; +static INT32 nMSM6295ROMSize = 0x100000; + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x100000; // + RomZ80 = Next; Next += 0x020000; // Z80 ROM + GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data + ExtraTROM = Next; Next += 0x010000; // Extra Text layer tile data + MSM6295ROM = Next; Next += nMSM6295ROMSize; // ADPCM data + RamStart = Next; + Ram01 = Next; Next += 0x010000; // CPU #0 work RAM + Ram02 = Next; Next += 0x000800; // + ExtraTRAM = Next; Next += 0x002000; // Extra tile layer + ExtraTScroll= Next; Next += 0x001000; // + ExtraTSelect= Next; Next += 0x001000; // + RamPal = Next; Next += 0x001000; // palette + RamZ80 = Next; Next += 0x004000; // Z80 RAM + GP9001RAM[0]= Next; Next += 0x004000; + GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); + RamEnd = Next; + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +static void drvZ80Bankswitch(INT32 nBank) +{ + nBank &= 0x07; + if (nBank != nCurrentBank) { + UINT8* nStartAddress = RomZ80 + (nBank << 14); + ZetMapArea(0x8000, 0xBFFF, 0, nStartAddress); + ZetMapArea(0x8000, 0xBFFF, 2, nStartAddress); + + nCurrentBank = nBank; + } +} + +// Scan ram +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029497; + } + if (nAction & ACB_VOLATILE) { // Scan volatile data + + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); // scan 68000 states + ZetScan(nAction); // Scan Z80 + SCAN_VAR(nCurrentBank); + + MSM6295Scan(0, nAction); + BurnYM2151Scan(nAction); + + ToaScanGP9001(nAction, pnMin); + + SCAN_VAR(DrvInput); + SCAN_VAR(nSoundCommand); + SCAN_VAR(nIRQPending); + + if (nAction & ACB_WRITE) { + INT32 nBank = nCurrentBank; + nCurrentBank = -1; + drvZ80Bankswitch(nBank); + } + } + + return 0; +} + +static INT32 LoadRoms() +{ + // Load 68000 ROM + if (ToaLoadCode(Rom01, 0, 2)) { + return 1; + } + + // Load GP9001 tile data + ToaLoadGP9001Tiles(GP9001ROM[0], 2, 4, nGP9001ROMSize[0]); + + // Load Extra text layer tile data + BurnLoadRom(ExtraTROM, 6, 1); + + // Load the Z80 ROM + BurnLoadRom(RomZ80, 7, 1); + + // Load ADPCM data + BurnLoadRom(MSM6295ROM, 8, 1); + + return 0; +} + +static INT32 LoadRomsBl() +{ + // Load 68000 ROM + if (BurnLoadRom(Rom01, 0, 1)) { + return 1; + } + + // Load GP9001 tile data + ToaLoadGP9001Tiles(GP9001ROM[0], 1, 2, nGP9001ROMSize[0]); + + // Load Extra text layer tile data + BurnLoadRom(ExtraTROM, 3, 1); + + // Load the Z80 ROM + BurnLoadRom(RomZ80, 4, 1); + + // Load ADPCM data + BurnLoadRom(MSM6295ROM, 5, 1); + + return 0; +} + +UINT8 __fastcall battlegZ80Read(UINT16 nAddress) +{ +// printf("z80 read %4X\n", nAddress); + switch (nAddress) { + case 0xE001: + return BurnYM2151ReadStatus(); + + case 0xE004: + return MSM6295ReadStatus(0); + + case 0xE01C: + return nSoundCommand; + + case 0xE01D: + // Bit 0 enables/disables interrupt processing (0 = enabled) + return 0; + } + return 0; +} + +void __fastcall battlegZ80Write(UINT16 nAddress, UINT8 nValue) +{ +// printf("z80 wrote %4X with %2X\n", nAddress, nValue); + switch (nAddress) { + case 0xE000: + BurnYM2151SelectRegister(nValue); + break; + case 0xE001: + BurnYM2151WriteRegister(nValue); + break; + + case 0xE004: + MSM6295Command(0, nValue); + break; + + case 0xE006: + MSM6295SampleInfo[0][0] = MSM6295ROM + ((nValue & 0x0F) << 16); + MSM6295SampleData[0][0] = MSM6295ROM + ((nValue & 0x0F) << 16); + MSM6295SampleInfo[0][1] = MSM6295ROM + ((nValue & 0xF0) << 12) + 0x0100; + MSM6295SampleData[0][1] = MSM6295ROM + ((nValue & 0xF0) << 12); + break; + case 0xE008: + MSM6295SampleInfo[0][2] = MSM6295ROM + ((nValue & 0x0F) << 16) + 0x0200; + MSM6295SampleData[0][2] = MSM6295ROM + ((nValue & 0x0F) << 16); + MSM6295SampleInfo[0][3] = MSM6295ROM + ((nValue & 0xF0) << 12) + 0x0300; + MSM6295SampleData[0][3] = MSM6295ROM + ((nValue & 0xF0) << 12); + break; + + case 0xE00A: { + drvZ80Bankswitch(nValue); + break; + } + + case 0xE00C: + // Once a sound command is processed, it is written to this address + // printf("z80 wrote %4X -> %2X\n", nAddress, nValue); + break; + + } +} + +static INT32 DrvZ80Init() +{ + ZetInit(0); + ZetOpen(0); + + ZetSetReadHandler(battlegZ80Read); + ZetSetWriteHandler(battlegZ80Write); + + // ROM bank 1 + ZetMapArea (0x0000, 0x7FFF, 0, RomZ80 + 0x0000); // Direct Read from ROM + ZetMapArea (0x0000, 0x7FFF, 2, RomZ80 + 0x0000); // Direct Fetch from ROM + // ROM bank 2 + ZetMapArea (0x8000, 0xBFFF, 0, RomZ80 + 0x8000); // Direct Read from ROM + ZetMapArea (0x8000, 0xBFFF, 2, RomZ80 + 0x8000); // Direct Fetch from ROM + // RAM + ZetMapArea (0xC000, 0xDFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0xC000, 0xDFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0xC000, 0xDFFF, 2, RamZ80); // + // Ports + ZetMemCallback(0xE000, 0xE0FF, 0); // Read + ZetMemCallback(0xE000, 0xE0FF, 1); // Write + + ZetClose(); + + nCurrentBank = 2; + + return 0; +} + +UINT8 __fastcall battlegReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x218021: // The 68K has access to the Z80 RAM + return RamZ80[0x10]; // Only these addresses are used, however + case 0x218023: // + return RamZ80[0x11]; // + + case 0x21C021: // Player 1 inputs + return DrvInput[0]; + case 0x21C025: // Player 2 inputs + return DrvInput[1]; + case 0x21C029: // Other inputs + return DrvInput[2]; + case 0x21C02D: // Dipswitch A + return DrvInput[3]; + case 0x21C031: // Dipswitch B + return DrvInput[4]; + case 0x21C035: // Dipswitch C - Territory + return DrvInput[5]; + +// default: +// printf("Attempt to read byte value of location %x\n", sekAddress); + } + return 0; +} + +UINT16 __fastcall battlegReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x21C03C: + return ToaScanlineRegister(); + + case 0x300004: + return ToaGP9001ReadRAM_Hi(0); + case 0x300006: + return ToaGP9001ReadRAM_Lo(0); + +// default: +// printf("Attempt to read word value of location %x\n", sekAddress); + } + return 0; +} + +void __fastcall battlegWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + + case 0x218021: // The 68K has access to the Z80 RAM + RamZ80[0x10] = byteValue; // Only these addresses are used, however + break; + + case 0x21C01D: // Coin control + break; + + case 0x600001: + nSoundCommand = byteValue; + + // Trigger Z80 interrupt, and allow the Z80 to process it + ZetRaiseIrq(255); + nCyclesDone[1] += ZetRun(0x0200); + break; + +// default: +// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } +} + +void __fastcall battlegWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + +// static int p; + + case 0x300000: // Set GP9001 VRAM address-pointer + ToaGP9001SetRAMPointer(wordValue); +// p = wordValue & 0x1FFF; + break; + + case 0x300004: +// if (p++ >= 0x1800) { +// static int s; +// if (s != SekCurrentScanline()) { +// s = SekCurrentScanline(); +// bprintf(PRINT_NORMAL, _T(" - sprite (%3i).\n"), s); +// } +// } + case 0x300006: +// p++; + ToaGP9001WriteRAM(wordValue, 0); + break; + + case 0x300008: + ToaGP9001SelectRegister(wordValue); + break; + + case 0x30000C: { + ToaGP9001WriteRegister(wordValue); + break; + } + +// default: +// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); + } +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + nIRQPending = 0; + SekSetIRQLine(0, SEK_IRQSTATUS_NONE); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM2151Reset(); + + return 0; +} + +static INT32 battlegInit() +{ + INT32 nLen; + +#ifdef DRIVER_ROTATION + bToaRotateScreen = true; +#endif + + nGP9001ROMSize[0] = 0x800000; + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (Bgareggabl) { + if (LoadRomsBl()) { + return 1; + } + } else { + if (LoadRoms()) { + return 1; + } + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x100000, 0x10FFFF, SM_RAM); + SekMapMemory(RamPal, 0x400000, 0x400FFF, SM_RAM); // Palette RAM + SekMapMemory(Ram02, 0x401000, 0x4017FF, SM_RAM); // Unused + SekMapMemory(ExtraTRAM, 0x500000, 0x501FFF, SM_RAM); + SekMapMemory(ExtraTSelect, 0x502000, 0x502FFF, SM_RAM); // 0x502000 - Scroll; 0x502200 - RAM + SekMapMemory(ExtraTScroll, 0x503000, 0x503FFF, SM_RAM); // 0x203000 - Offset; 0x503200 - RAM + + SekSetReadWordHandler(0, battlegReadWord); + SekSetReadByteHandler(0, battlegReadByte); + SekSetWriteWordHandler(0, battlegWriteWord); + SekSetWriteByteHandler(0, battlegWriteByte); + + SekClose(); + } + + nSpriteXOffset = 0x0024; + nSpriteYOffset = 0x0001; + + nLayer0XOffset = -0x01D6; + nLayer1XOffset = -0x01D8; + nLayer2XOffset = -0x01DA; + + ToaInitGP9001(); + + nExtraTXOffset = 0x2C; + ToaExtraTextInit(); + + if (Bgareggabl) nExtraTXOffset = 0; + + DrvZ80Init(); // Initialize Z80 + + BurnYM2151Init(32000000 / 8); + BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + MSM6295Init(0, 32000000 / 16 / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + nToaPalLen = nColCount; + ToaPalSrc = RamPal; + ToaPalInit(); + + bDrawScreen = true; + + // mar 2 1996 & apr 2 1996 ver: 0x0009AC - 0x0009B8 & 0x001F5E - 0x001F64 & 0x003A1C - 0x003A22 + // feb 2 1996 ver: 0x0009AC - 0x0009B8 & 0x001F2E - 0x001F34 & 0x0039EC - 0x0039F2 + + DrvDoReset(); // Reset machine + return 0; +} + +static INT32 BgareggablInit() +{ + Bgareggabl = 1; + + return battlegInit(); +} + +static INT32 DrvExit() +{ + MSM6295Exit(0); + BurnYM2151Exit(); + + ToaPalExit(); + ToaExitGP9001(); + ToaExtraTextExit(); + ToaZExit(); // Z80 exit + SekExit(); // Deallocate 68000s + + BurnFree(Mem); + + Bgareggabl = 0; + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderGP9001(); // Render GP9001 graphics + ToaExtraTextLayer(); // Render extra text layer + } + + ToaPalUpdate(); // Update the palette + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 8; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x00; // Buttons + DrvInput[1] = 0x00; // Player 1 + DrvInput[2] = 0x00; // Player 2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[2] |= (DrvButton[i] & 1) << i; + } + ToaClearOpposites(&DrvInput[0]); + ToaClearOpposites(&DrvInput[1]); + + SekNewFrame(); + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = TOA_Z80_SPEED / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekOpen(0); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + INT32 nSoundBufferPos = 0; + + ZetOpen(0); + for (INT32 i = 1; i <= nInterleave; i++) { + INT32 nCurrentCPU; + INT32 nNext; + + // Run 68000 + + nCurrentCPU = 0; + nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; + + // Trigger VBlank interrupt + if (!bVBlank && nNext > nToaCyclesVBlankStart) { + if (nCyclesDone[nCurrentCPU] < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + } + + nIRQPending = 1; + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + + ToaBufferGP9001Sprites(); + + if (pBurnDraw) { + DrvDraw(); // Draw screen if needed + } + + bVBlank = true; + } + + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (!CheckSleep(nCurrentCPU)) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + nIRQPending = 0; + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + + if ((i & 1) == 0) { + // Run Z80 + nCurrentCPU = 1; + nNext = i * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + + // Render sound segment + if (pBurnSoundOut) { + INT32 nSegmentLength = (nBurnSoundLen * i / nInterleave) - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + } + + SekClose(); + + { + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + } + + ZetClose(); + + return 0; +} + +struct BurnDriver BurnDrvBgaregga = { + "bgaregga", NULL, NULL, NULL, "1996", + "Battle Garegga (World) (Sat Feb 3 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, bgareggaRomInfo, bgareggaRomName, NULL, NULL, battlegInputInfo, bgareggaDIPInfo, + battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBgaregcn = { + "bgareggacn", "bgaregga", NULL, NULL, "1996", + "Battle Garegga - Type 2 (China / Denmark?) (Tue Apr 2 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, bgaregcnRomInfo, bgaregcnRomName, NULL, NULL, battlegInputInfo, bgaregcnDIPInfo, + battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBgaregt2 = { + "bgareggat2", "bgaregga", NULL, NULL, "1996", + "Battle Garegga - Type 2 (World) (Sat Mar 2 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, bgaregt2RomInfo, bgaregt2RomName, NULL, NULL, battlegInputInfo, bgareggaDIPInfo, + battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBgaregnv = { + "bgaregganv", "bgaregga", NULL, NULL, "1996", + "Battle Garegga - New Version (Hong Kong / Austria?) (Sat Mar 2 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, bgaregnvRomInfo, bgaregnvRomName, NULL, NULL, battlegInputInfo, bgareghkDIPInfo, + battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBgareghk = { + "bgareggahk", "bgaregga", NULL, NULL, "1996", + "Battle Garegga (Hong Kong / Austria?) (Sat Feb 3 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, bgareghkRomInfo, bgareghkRomName, NULL, NULL, battlegInputInfo, bgareghkDIPInfo, + battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBgaregtw = { + "bgareggatw", "bgaregga", NULL, NULL, "1996", + "Battle Garegga (Taiwan / Germany) (Thu Feb 1 1996)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, bgaregtwRomInfo, bgaregtwRomName, NULL, NULL, battlegInputInfo, bgaregtwDIPInfo, + battlegInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBgareggabl = { + "bgareggabl", "bgaregga", NULL, NULL, "1996", + "1945 Part 2 (Battle Garaga hack)\0", NULL, "hack", "Toaplan GP9001 based", + L"1945 Part 2\0\uFF11\uFF19\uFF14\uFF15\u4E8C\u4EE3 (Battle Garrega Chinese hack)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW | BDF_HACK, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, bgareggablRomInfo, bgareggablRomName, NULL, NULL, battlegInputInfo, bgareggaDIPInfo, + BgareggablInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; diff --git a/src/burn/drv/toaplan/d_bbakraid.cpp b/src/burn/drv/toaplan/d_bbakraid.cpp index 5f5f03249..024543d3d 100644 --- a/src/burn/drv/toaplan/d_bbakraid.cpp +++ b/src/burn/drv/toaplan/d_bbakraid.cpp @@ -1,1068 +1,1067 @@ -#include "toaplan.h" -#include "ymz280b.h" -#include "eeprom.h" -#include "timer.h" - -// Battle Bakraid. - -// #define ADJUST_Z80_SPEED - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static UINT8 *DefaultEEPROM = NULL; - -static UINT8 DrvRegion = 0; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static UINT8 nIRQPending; - -static INT32 nSoundData[4]; -static UINT8 nSoundlatchAck; - -static INT32 Z80BusRQ = 0; - -static INT32 nCycles68KSync; - -static INT32 nTextROMStatus; - -static bool bUseAsm68KCoreOldValue = false; - -// Rom information -static struct BurnRomInfo bkraiduRomDesc[] = { - { "prg0u022_usa.bin", 0x080000, 0x95fb2ffd, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg2u021.bin", 0x080000, 0xFFBA8656, BRF_ESS | BRF_PRG }, // 1 - { "prg1u023.new", 0x080000, 0x4ae9aa64, BRF_ESS | BRF_PRG }, // 2 (odd) - { "prg3u024.bin", 0x080000, 0x834B8AD6, BRF_ESS | BRF_PRG }, // 3 - - { "gfxu0510.bin", 0x400000, 0x9CCA3446, BRF_GRA }, // 4 GP9001 Tile data - { "gfxu0512.bin", 0x400000, 0xA2A281D5, BRF_GRA }, // 5 - { "gfxu0511.bin", 0x400000, 0xE16472C0, BRF_GRA }, // 6 - { "gfxu0513.bin", 0x400000, 0x8BB635A0, BRF_GRA }, // 7 - - { "sndu0720.bin", 0x020000, 0xE62AB246, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "rom6.829", 0x400000, 0x8848B4A0, BRF_SND }, // 9 YMZ280B (AD)PCM data - { "rom7.830", 0x400000, 0xD6224267, BRF_SND }, // 10 - { "rom8.831", 0x400000, 0xA101DFB0, BRF_SND }, // 11 - - { "eeprom-bbakraid-new.bin", 0x00200, 0x35c9275a, BRF_PRG }, -}; - - -STD_ROM_PICK(bkraidu) -STD_ROM_FN(bkraidu) - -static struct BurnRomInfo bkraidjRomDesc[] = { - { "prg0u022.bin", 0x080000, 0x0DD59512, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg2u021.bin", 0x080000, 0xFFBA8656, BRF_ESS | BRF_PRG }, // 1 - { "prg1u023.bin", 0x080000, 0xFECDE223, BRF_ESS | BRF_PRG }, // 2 (odd) - { "prg3u024.bin", 0x080000, 0x834B8AD6, BRF_ESS | BRF_PRG }, // 3 - - { "gfxu0510.bin", 0x400000, 0x9CCA3446, BRF_GRA }, // 4 GP9001 Tile data - { "gfxu0512.bin", 0x400000, 0xA2A281D5, BRF_GRA }, // 5 - { "gfxu0511.bin", 0x400000, 0xE16472C0, BRF_GRA }, // 6 - { "gfxu0513.bin", 0x400000, 0x8BB635A0, BRF_GRA }, // 7 - - { "sndu0720.bin", 0x020000, 0xE62AB246, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "rom6.829", 0x400000, 0x8848B4A0, BRF_SND }, // 9 YMZ280B (AD)PCM data - { "rom7.830", 0x400000, 0xD6224267, BRF_SND }, // 10 - { "rom8.831", 0x400000, 0xA101DFB0, BRF_SND }, // 11 - - { "eeprom-bbakraid.bin", 0x00200, 0x7f97d347, BRF_PRG }, -}; - - -STD_ROM_PICK(bkraidj) -STD_ROM_FN(bkraidj) - -static struct BurnRomInfo bkraidujRomDesc[] = { - { "prg0u022.new", 0x080000, 0xFA8D38D3, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "prg2u021.bin", 0x080000, 0xFFBA8656, BRF_ESS | BRF_PRG }, // 1 - { "prg1u023.new", 0x080000, 0x4AE9AA64, BRF_ESS | BRF_PRG }, // 2 (odd) - { "prg3u024.bin", 0x080000, 0x834B8AD6, BRF_ESS | BRF_PRG }, // 3 - - { "gfxu0510.bin", 0x400000, 0x9CCA3446, BRF_GRA }, // 4 GP9001 Tile data - { "gfxu0512.bin", 0x400000, 0xA2A281D5, BRF_GRA }, // 5 - { "gfxu0511.bin", 0x400000, 0xE16472C0, BRF_GRA }, // 6 - { "gfxu0513.bin", 0x400000, 0x8BB635A0, BRF_GRA }, // 7 - - { "sndu0720.bin", 0x020000, 0xE62AB246, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "rom6.829", 0x400000, 0x8848B4A0, BRF_SND }, // 9 YMZ280B (AD)PCM data - { "rom7.830", 0x400000, 0xD6224267, BRF_SND }, // 10 - { "rom8.831", 0x400000, 0xA101DFB0, BRF_SND }, // 11 - - { "eeprom-bbakraid-new.bin", 0x00200, 0x35c9275a, BRF_PRG }, -}; - - -STD_ROM_PICK(bkraiduj) -STD_ROM_FN(bkraiduj) - -static struct BurnInputInfo bbakraidInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Shoot 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Shoot 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Shoot 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Shoot 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Shoot 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Shoot 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Test", BIT_DIGITAL, DrvButton + 2, "diag"}, - {"Service", BIT_DIGITAL, DrvButton + 0, "service"}, - {"Dip 1", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip 2", BIT_DIPSWITCH, DrvInput + 4, "dip"}, - {"Dip 3", BIT_DIPSWITCH, DrvInput + 5, "dip"}, - {"Region", BIT_DIPSWITCH, &DrvRegion , "dip"}, -}; - -STDINPUTINFO(bbakraid) - -static struct BurnDIPInfo bbakraidDIPList[] = { - - // Defaults - {0x15, 0xFF, 0xFF, 0x00, NULL}, - {0x16, 0xFF, 0xFF, 0x00, NULL}, - {0x17, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, "Test mode"}, - {0x15, 0x01, 0x01, 0x00, "Normal"}, - {0x15, 0x01, 0x01, 0x01, "Test"}, - // Normal - {0, 0xFE, 0, 2, "Starting coin"}, - {0x15, 0x82, 0x02, 0x00, "1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0x02, 0x02, "2 credits"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - // Free play - {0, 0xFE, 0, 2, "Stick mode"}, - {0x15, 0x02, 0x02, 0x00, "Normal"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x02, 0x02, 0x02, "Special"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - // Normal - {0, 0xFE, 0, 8, "Coin 1"}, - {0x15, 0x01, 0x1C, 0x00, "1 coin 1 credit"}, - {0x15, 0x01, 0x1C, 0x04, "1 coin 2 credits"}, - {0x15, 0x01, 0x1C, 0x08, "1 coin 3 credits"}, - {0x15, 0x01, 0x1C, 0x0C, "1 coin 4 credits"}, - {0x15, 0x01, 0x1C, 0x10, "2 coins 1 credit"}, - {0x15, 0x01, 0x1C, 0x14, "3 coins 1 credit"}, - {0x15, 0x01, 0x1C, 0x18, "4 coins 1 credit"}, - {0x15, 0x01, 0x1C, 0x1C, "Free Play"}, - // 0x1C: Free play settings active - // Normal - {0, 0xFE, 0, 7, "Coin 2"}, - {0x15, 0x82, 0xE0, 0x00, "1 coin 1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0x20, "1 coin 2 credits"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0x40, "1 coin 3 credits"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0x60, "1 coin 4 credits"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0x80, "2 coins 1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0xA0, "3 coins 1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0xC0, "4 coins 1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x82, 0xE0, 0x04, "1 coin 1 credit"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - // Free play - {0, 0xFE, 0, 2, "Hit score"}, - {0x15, 0x02, 0x20, 0x00, "Off"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x02, 0x20, 0x20, "On"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0, 0xFE, 0, 2, "Sound effect"}, - {0x15, 0x02, 0x40, 0x00, "Off"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x02, 0x40, 0x40, "On"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0, 0xFE, 0, 2, "Music"}, - {0x15, 0x02, 0x80, 0x00, "Off"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - {0x15, 0x02, 0x80, 0x80, "On"}, - {0x15, 0x00, 0x1C, 0x1C, NULL}, - - // DIP 2 - {0, 0xFE, 0, 4, "Start rank"}, - {0x16, 0x01, 0x03, 0x00, "Normal"}, - {0x16, 0x01, 0x03, 0x01, "Easy"}, - {0x16, 0x01, 0x03, 0x02, "Hard"}, - {0x16, 0x01, 0x03, 0x03, "Very hard"}, - {0, 0xFE, 0, 4, "Timer rank"}, - {0x16, 0x01, 0x0C, 0x00, "Normal"}, - {0x16, 0x01, 0x0C, 0x04, "Low"}, - {0x16, 0x01, 0x0C, 0x08, "High"}, - {0x16, 0x01, 0x0C, 0x0C, "Highest"}, - {0, 0xFE, 0, 4, "Player counts"}, - {0x16, 0x01, 0x30, 0x00, "3"}, - {0x16, 0x01, 0x30, 0x10, "4"}, - {0x16, 0x01, 0x30, 0x20, "2"}, - {0x16, 0x01, 0x30, 0x30, "1"}, - {0, 0xFE, 0, 4, "Extra player"}, - {0x16, 0x01, 0xC0, 0x00, "2000000 each"}, - {0x16, 0x01, 0xC0, 0x40, "3000000 each"}, - {0x16, 0x01, 0xC0, 0x80, "4000000 each"}, - {0x16, 0x01, 0xC0, 0xC0, "No extra player"}, - - // DIP 3 - {0, 0xFE, 0, 2, "Screen flip"}, - {0x17, 0x01, 0x01, 0x00, "Off"}, - {0x17, 0x01, 0x01, 0x01, "On"}, - {0, 0xFE, 0, 2, "Demo sound"}, - {0x17, 0x01, 0x02, 0x00, "On"}, - {0x17, 0x01, 0x02, 0x02, "Off"}, - {0, 0xFE, 0, 2, "Stage edit"}, - {0x17, 0x01, 0x04, 0x00, "Disable"}, - {0x17, 0x01, 0x04, 0x04, "Enable"}, - {0, 0xFE, 0, 2, "Continue play"}, - {0x17, 0x01, 0x08, 0x00, "Enable"}, - {0x17, 0x01, 0x08, 0x08, "Disable"}, - {0, 0xFE, 0, 2, "Invincible"}, - {0x17, 0x01, 0x10, 0x00, "Off"}, - {0x17, 0x01, 0x10, 0x10, "On"}, - {0, 0xFE, 0, 2, "Score ranking"}, - {0x17, 0x01, 0x20, 0x00, "Save"}, - {0x17, 0x01, 0x20, 0x20, "No save"}, -}; - -static struct BurnDIPInfo bbakraidRegionDIPList[] = { - - // Region - {0x18, 0xFF, 0xFF, 0x00, NULL}, - {0, 0xFD, 0, 26, "Region"}, - {0x18, 0x01, 0x1F, 0x00, "Nippon"}, - {0x18, 0x01, 0x1F, 0x01, "U.S.A."}, - {0x18, 0x01, 0x1F, 0x02, "Europe"}, - {0x18, 0x01, 0x1F, 0x03, "Asia"}, - {0x18, 0x01, 0x1F, 0x04, "German"}, - {0x18, 0x01, 0x1F, 0x05, "Austria"}, - {0x18, 0x01, 0x1F, 0x06, "Belgium"}, - {0x18, 0x01, 0x1F, 0x07, "Denmark"}, - {0x18, 0x01, 0x1F, 0x08, "Finland"}, - {0x18, 0x01, 0x1F, 0x09, "France"}, - {0x18, 0x01, 0x1F, 0x0A, "Great Britain"}, - {0x18, 0x01, 0x1F, 0x0B, "Greece"}, - {0x18, 0x01, 0x1F, 0x0C, "Holland"}, - {0x18, 0x01, 0x1F, 0x0D, "Italy"}, - {0x18, 0x01, 0x1F, 0x0E, "Norway"}, - {0x18, 0x01, 0x1F, 0x0F, "Portugal"}, - {0x18, 0x01, 0x1F, 0x10, "Spain"}, - {0x18, 0x01, 0x1F, 0x11, "Sweden"}, - {0x18, 0x01, 0x1F, 0x12, "Switzerland"}, - {0x18, 0x01, 0x1F, 0x13, "Australia"}, - {0x18, 0x01, 0x1F, 0x14, "New Zealand"}, - {0x18, 0x01, 0x1F, 0x15, "Taiwan"}, - {0x18, 0x01, 0x1F, 0x16, "HongKong"}, - {0x18, 0x01, 0x1F, 0x17, "Korea"}, - {0x18, 0x01, 0x1F, 0x18, "China"}, - {0x18, 0x01, 0x1F, 0x19, "World"}, -}; - -STDDIPINFOEXT(bbakraid, bbakraid, bbakraidRegion) - -static struct BurnDIPInfo bkraiduRegionDIPList[] = { - - // Region - {0x18, 0xFF, 0xFF, 0x01, NULL}, - {0, 0xFD, 0, 26, "Region"}, - {0x18, 0x01, 0x1F, 0x00, "Nippon"}, - {0x18, 0x01, 0x1F, 0x01, "U.S.A."}, - {0x18, 0x01, 0x1F, 0x02, "Europe"}, - {0x18, 0x01, 0x1F, 0x03, "Asia"}, - {0x18, 0x01, 0x1F, 0x04, "German"}, - {0x18, 0x01, 0x1F, 0x05, "Austria"}, - {0x18, 0x01, 0x1F, 0x06, "Belgium"}, - {0x18, 0x01, 0x1F, 0x07, "Denmark"}, - {0x18, 0x01, 0x1F, 0x08, "Finland"}, - {0x18, 0x01, 0x1F, 0x09, "France"}, - {0x18, 0x01, 0x1F, 0x0A, "Great Britain"}, - {0x18, 0x01, 0x1F, 0x0B, "Greece"}, - {0x18, 0x01, 0x1F, 0x0C, "Holland"}, - {0x18, 0x01, 0x1F, 0x0D, "Italy"}, - {0x18, 0x01, 0x1F, 0x0E, "Norway"}, - {0x18, 0x01, 0x1F, 0x0F, "Portugal"}, - {0x18, 0x01, 0x1F, 0x10, "Spain"}, - {0x18, 0x01, 0x1F, 0x11, "Sweden"}, - {0x18, 0x01, 0x1F, 0x12, "Switzerland"}, - {0x18, 0x01, 0x1F, 0x13, "Australia"}, - {0x18, 0x01, 0x1F, 0x14, "New Zealand"}, - {0x18, 0x01, 0x1F, 0x15, "Taiwan"}, - {0x18, 0x01, 0x1F, 0x16, "HongKong"}, - {0x18, 0x01, 0x1F, 0x17, "Korea"}, - {0x18, 0x01, 0x1F, 0x18, "China"}, - {0x18, 0x01, 0x1F, 0x19, "World"}, -}; - -STDDIPINFOEXT(bkraidu, bbakraid, bkraiduRegion) - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *Ram01, *Ram02, *RamPal; - -static INT32 nColCount = 0x0800; - -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x200000; // - RomZ80 = Next; Next += 0x020000; // Z80 ROM - GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data - YMZ280BROM = Next; Next += 0xC00000; - DefaultEEPROM = Next; Next += 0x000200; - RamStart = Next; - ExtraTROM = Next; Next += 0x008000; // Extra Text layer tile data - ExtraTRAM = Next; Next += 0x002000; // Extra tile layer - Ram01 = Next; Next += 0x005000; // RAM + Extra text layer scroll/offset - Ram02 = Next; Next += 0x008000; // - RamPal = Next; Next += 0x001000; // palette - RamZ80 = Next; Next += 0x004000; // Z80 RAM - GP9001RAM[0]= Next; Next += 0x004000; - GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); - RamEnd = Next; - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - MemEnd = Next; - - ExtraTSelect= Ram01; // Extra text layer scroll - ExtraTScroll= Ram01 + 0x000200; // Extra text layer offset - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029521; - } - - EEPROMScan(nAction, pnMin); // Scan EEPROM - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); // scan 68000 states - ZetScan(nAction); // Scan Z80 - - YMZ280BScan(); - BurnTimerScan(nAction, pnMin); - - ToaScanGP9001(nAction, pnMin); - - SCAN_VAR(DrvInput); - SCAN_VAR(nSoundData); - SCAN_VAR(Z80BusRQ); - SCAN_VAR(nIRQPending); - } - - return 0; -} - -static INT32 LoadRoms() -{ - // Load 68000 ROM - if (ToaLoadCode(Rom01, 0, 4)) { - return 1; - } - - // Load GP9001 tile data - ToaLoadGP9001Tiles(GP9001ROM[0], 4, 4, nGP9001ROMSize[0]); - - // Load the z80 Rom - BurnLoadRom(RomZ80, 8, 1); - - // Load YMZ280B (AD)PCM data - BurnLoadRom(YMZ280BROM + 0x000000, 9, 1); - BurnLoadRom(YMZ280BROM + 0x400000, 10, 1); - BurnLoadRom(YMZ280BROM + 0x800000, 11, 1); - - BurnLoadRom(DefaultEEPROM, 12, 1); - - return 0; -} - -static inline void bbakraidSynchroniseZ80(INT32 nExtraCycles) -{ -#ifdef ADJUST_Z80_SPEED - INT32 nCycles = SekTotalCycles() / 4 + nExtraCycles; -#else - INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]) + nExtraCycles; -#endif - - if (nCycles <= ZetTotalCycles()) { - return; - } - - nCycles68KSync = nCycles - nExtraCycles; - - BurnTimerUpdate(nCycles); -} - -static INT32 bbakraidTimerOver(INT32, INT32) -{ -// bprintf(PRINT_NORMAL, _T(" - IRQ -> 1.\n")); - ZetSetIRQLine(0xFF, ZET_IRQSTATUS_AUTO); - - return 0; -} - -UINT8 __fastcall bbakraidZIn(UINT16 nAddress) -{ - nAddress &= 0xFF; - switch (nAddress) { - case 0x48: - return nSoundData[0]; - case 0x4A: - return nSoundData[1]; - - case 0x81: - // YMZ280B status port. - return YMZ280BReadStatus(); - -// default: -// printf("Z80 read port #%02X\n", nAddress & 0xFF); - } - return 0; -} - -void __fastcall bbakraidZOut(UINT16 nAddress, UINT8 nValue) -{ - nAddress &= 0xFF; - switch (nAddress) { - case 0x40: - if (!(nSoundlatchAck & 1) && ZetTotalCycles() > nCycles68KSync) { - BurnTimerUpdateEnd(); - } - nSoundlatchAck |= 1; - nSoundData[2] = nValue; - break; - case 0x42: - if (!(nSoundlatchAck & 2) && ZetTotalCycles() > nCycles68KSync) { - BurnTimerUpdateEnd(); - } - nSoundlatchAck |= 2; - nSoundData[3] = nValue; - break; - -// case 0x44: // ??? -// case 0x46: // Acknowledge interrupt -// break; - - case 0x80: - // YMZ280B register select - YMZ280BSelectRegister(nValue); - break; - case 0x81: - // YMZ280B register write - YMZ280BWriteRegister(nValue); - break; - -// default: -// printf("Z80 wrote value %02X to port #%02x.\n", nValue, nAddress); - } -} - -static INT32 DrvZ80Init() -{ - // Init the Z80 - ZetInit(0); - ZetOpen(0); - - ZetSetInHandler(bbakraidZIn); - ZetSetOutHandler(bbakraidZOut); - - // ROM - ZetMapArea(0x0000, 0xBFFF, 0, RomZ80); // Direct Read from ROM - ZetMapArea(0x0000, 0xBFFF, 2, RomZ80); // Direct Fetch from ROM - // RAM - ZetMapArea(0xC000, 0xFFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea(0xC000, 0xFFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea(0xC000, 0xFFFF, 2, RamZ80); // - - ZetMemEnd(); - ZetClose(); - - return 0; -} - -static void Map68KTextROM(bool bMapTextROM) -{ - if (bMapTextROM) { - if (nTextROMStatus != 1) { - SekMapMemory(ExtraTROM, 0x200000, 0x207FFF, SM_RAM); // Extra text tile memory - - nTextROMStatus = 1; - } - } else { - if (nTextROMStatus != 0) { - SekMapMemory(ExtraTRAM, 0x200000, 0x201FFF, SM_RAM); // Extra text tilemap RAM - SekMapMemory(RamPal, 0x202000, 0x202FFF, SM_RAM); // Palette RAM - SekMapMemory(Ram01, 0x203000, 0x207FFF, SM_RAM); // Extra text Scroll & offset; RAM - - nTextROMStatus = 0; - } - } -} - -UINT8 __fastcall bbakraidReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x500000: // Player 2 Inputs - return DrvInput[1]; - case 0x500001: // Player 1 Inputs - return DrvInput[0]; - case 0x500002: // Other inputs - return DrvInput[5]; - case 0x500003: // Dipswitch 3 - return DrvInput[2]; - case 0x500004: // Dipswitch 2 - return DrvInput[4]; - case 0x500005: // Dipswitch 1 - return DrvInput[3]; - - // These addresses contain the response of the Z80 to the (sound) commands - case 0x500011: - return nSoundData[2]; - case 0x500013: - return nSoundData[3]; - - case 0x500019: - return ((EEPROMRead() & 0x01) << 4) | (Z80BusRQ >> 4); - - default: { -// printf("Attempt to read byte value of location %x\n", sekAddress); - } - } - - return 0; -} - -UINT16 __fastcall bbakraidReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - - // Video status register - case 0x500006: - return ToaScanlineRegister(); - - // These addresses contain the response of the Z80 to the (sound) commands - case 0x500010: -// bbakraidSynchroniseZ80(0); - if (!(nSoundlatchAck & 1)) { - bbakraidSynchroniseZ80(0x0100); - } - return nSoundData[2]; - case 0x500012: -// bbakraidSynchroniseZ80(0); - if (!(nSoundlatchAck & 2)) { - bbakraidSynchroniseZ80(0x0100); - } - return nSoundData[3]; - - case 0x500018: - return ((EEPROMRead() & 0x01) << 4) | (Z80BusRQ >> 4); - - default: { -// printf("Attempt to read word value of location %x\n", sekAddress); - } - } - - return 0; -} - -void __fastcall bbakraidWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - - case 0x500009: // Coin control - return; - - case 0x50001F: - Z80BusRQ = byteValue & 0x10; - EEPROMWrite(byteValue & 8, byteValue & 1, byteValue & 4); - return; - -// default: -// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } -} - -void __fastcall bbakraidWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - case 0x500014: - nSoundlatchAck &= ~1; - nSoundData[0] = wordValue; - return; - case 0x500016: - nSoundlatchAck &= ~2; - nSoundData[1] = wordValue; - return; - - // This register is always written to after writing (sound) commands for the Z80 - case 0x50001A: - bbakraidSynchroniseZ80(0); - ZetNmi(); - return; - - // Serial EEPROM command - case 0x50001E: - Z80BusRQ = wordValue & 0x10; - EEPROMWrite(wordValue & 8, wordValue & 1, wordValue & 4); - return; - - case 0x500080: - Map68KTextROM(false); - return; - - case 0x50001C: // ??? - return; - - case 0x500082: // Acknowledge interrupt - SekSetIRQLine(0, SEK_IRQSTATUS_NONE); - nIRQPending = 0; - return; - - case 0x5000C0: - case 0x5000C1: - case 0x5000C2: - case 0x5000C3: - case 0x5000C4: - case 0x5000C5: - case 0x5000C6: - case 0x5000C7: - case 0x5000C8: - case 0x5000C9: - case 0x5000CA: - case 0x5000CB: - case 0x5000CC: - case 0x5000CD: - case 0x5000CE: - GP9001TileBank[(sekAddress & 0x0F) >> 1] = ((wordValue & 0x0F) << 15); - return; - -// default: -// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); - } -} - -UINT16 __fastcall bbakraidReadWordGP9001(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x400008: - return ToaGP9001ReadRAM_Hi(0); - case 0x40000A: - return ToaGP9001ReadRAM_Lo(0); - - } - - return 0; -} - -void __fastcall bbakraidWriteWordGP9001(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - - case 0x400000: - ToaGP9001WriteRegister(wordValue); - break; - - case 0x400004: - ToaGP9001SelectRegister(wordValue); - break; - - case 0x400008: - case 0x40000A: - ToaGP9001WriteRAM(wordValue, 0); - break; - - case 0x40000C: // Set GP9001 VRAM address-pointer - ToaGP9001SetRAMPointer(wordValue); - break; - } -} - -UINT8 __fastcall bbakraidReadByteZ80ROM(UINT32 sekAddress) -{ - return RomZ80[(sekAddress & 0x7FFFF) >> 1]; -} - -UINT16 __fastcall bbakraidReadWordZ80ROM(UINT32 sekAddress) -{ - return RomZ80[(sekAddress & 0x7FFFF) >> 1]; -} - -static INT32 DrvDoReset() -{ - // Insert region code into 68K ROM, code by BisonSAS - UINT8 nRegion = DrvRegion & 0x1F; - if (nRegion<=25) { - Rom01[0x00000^1]=(UINT8)(nRegion<<13) | (DrvRegion & 0x1F); - } - - SekOpen(0); - nIRQPending = 0; - SekSetIRQLine(0, SEK_IRQSTATUS_NONE); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - EEPROMReset(); - - Z80BusRQ = 0; - - memset(nSoundData, 0, sizeof(nSoundData)); - nSoundlatchAck = 0; - - YMZ280BReset(); - - nCyclesDone[0] = nCyclesDone[1] = 0; - - BurnTimerReset(); - ZetOpen(0); - BurnTimerSetRetrig(0, 1.0 / 445.0); - ZetClose(); - - return 0; -} - -static const eeprom_interface eeprom_interface_93C66 = -{ - 9, // address bits - 8, // data bits - "*110", // read 110 aaaaaaaaa - "*101", // write 101 aaaaaaaaa dddddddd - "*111", // erase 111 aaaaaaaaa - "*10000xxxxxxx",// lock 100x 00xxxx - "*10011xxxxxxx",// unlock 100x 11xxxx - 0, - 0 -}; - -static INT32 bbakraidInit() -{ - INT32 nLen; - -#ifdef DRIVER_ROTATION - bToaRotateScreen = true; -#endif - - nGP9001ROMSize[0] = 0x1000000; - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - EEPROMInit(&eeprom_interface_93C66); - - // Make sure we use Musashi - if (bBurnUseASMCPUEmulation) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); -#endif - bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; - bBurnUseASMCPUEmulation = false; - } - -// if (strcmp("bbakraid", BurnDrvGetTextA(DRV_NAME)) == 0 || strcmp("bbakraidj", BurnDrvGetTextA(DRV_NAME)) == 0) { -// if (!EEPROMAvailable()) EEPROMFill(bbakraid_unlimited_nvram, 0, sizeof(bbakraid_unlimited_nvram)); -// } - - if (!EEPROMAvailable()) EEPROMFill(DefaultEEPROM, 0, 0x200); - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x1FFFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram02, 0x208000, 0x20FFFF, SM_RAM); - - Map68KTextROM(true); - - SekSetReadWordHandler(0, bbakraidReadWord); - SekSetReadByteHandler(0, bbakraidReadByte); - SekSetWriteWordHandler(0, bbakraidWriteWord); - SekSetWriteByteHandler(0, bbakraidWriteByte); - - SekMapHandler(1, 0x400000, 0x400400, SM_RAM); // GP9001 addresses - - SekSetReadWordHandler(1, bbakraidReadWordGP9001); - SekSetWriteWordHandler(1, bbakraidWriteWordGP9001); - - SekMapHandler(2, 0x300000, 0x37FFFF, SM_ROM); // Z80 ROM - - SekSetReadByteHandler(2, bbakraidReadByteZ80ROM); - SekSetReadWordHandler(2, bbakraidReadWordZ80ROM); - - SekClose(); - } - - nSpriteYOffset = 0x0001; - - nLayer0XOffset = -0x01D6; - nLayer1XOffset = -0x01D8; - nLayer2XOffset = -0x01DA; - - ToaInitGP9001(); - - nExtraTXOffset = 0x2C; - ToaExtraTextInit(); - - DrvZ80Init(); // Initialize Z80 - - YMZ280BInit(16934400, NULL); - YMZ280BSetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - - BurnTimerInit(bbakraidTimerOver, NULL); - BurnTimerAttachZet(TOA_Z80_SPEED); - - nToaPalLen = nColCount; - ToaPalSrc = RamPal; - ToaPalInit(); - - nTextROMStatus = -1; - bDrawScreen = true; - - DrvDoReset(); // Reset machine - - return 0; -} - -static INT32 DrvExit() -{ - ToaPalExit(); - BurnTimerExit(); - YMZ280BExit(); - ToaExitGP9001(); - ToaExtraTextExit(); - ToaZExit(); // Z80 exit - SekExit(); // Deallocate 68000s - - EEPROMExit(); - - if (bUseAsm68KCoreOldValue) { -#if 1 && defined FBA_DEBUG - bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); -#endif - bUseAsm68KCoreOldValue = false; - bBurnUseASMCPUEmulation = true; - } - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderGP9001(); // Render GP9001 graphics - ToaExtraTextLayer(); // Render extra text layer - } - - ToaPalUpdate(); // Update the palette - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 8; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x00; // Buttons - DrvInput[1] = 0x00; // Player 1 - DrvInput[2] = 0x00; // Player 2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[2] |= (DrvButton[i] & 1) << i; - } - ToaClearOpposites(&DrvInput[0]); - ToaClearOpposites(&DrvInput[1]); - - SekNewFrame(); - ZetNewFrame(); - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); -#ifdef ADJUST_Z80_SPEED - nCyclesTotal[1] = nCyclesTotal[0] / 4; -#else - nCyclesTotal[1] = TOA_Z80_SPEED / 60; -#endif - - SekOpen(0); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - INT32 nSoundBufferPos = 0; - - ZetOpen(0); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - for (INT32 i = 1; i <= nInterleave; i++) { - INT32 nNext; - - // Run 68000 - - nNext = i * nCyclesTotal[0] / nInterleave; - - // Trigger VBlank interrupt - if (!bVBlank && nNext > nToaCyclesVBlankStart) { - if (SekTotalCycles() < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); - if (!CheckSleep(0)) { - SekRun(nCyclesSegment); - } else { - SekIdle(nCyclesSegment); - } - } - - nIRQPending = 1; - SekSetIRQLine(3, SEK_IRQSTATUS_ACK); - - ToaBufferGP9001Sprites(); - - if (pBurnDraw) { // Draw screen if needed - DrvDraw(); - } - - bVBlank = true; - } - - nCyclesSegment = nNext - SekTotalCycles(); - if (!CheckSleep(0)) { // See if this CPU is busywaiting - SekRun(nCyclesSegment); - } else { - SekIdle(nCyclesSegment); - } - - if ((i & 1) == 0) { - // Render sound segment - if (pBurnSoundOut) { - INT32 nSegmentEnd = nBurnSoundLen * i / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - YMZ280BRender(pSoundBuf, nSegmentEnd - nSoundBufferPos); - nSoundBufferPos = nSegmentEnd; - } - } - } - - nCycles68KSync = SekTotalCycles(); - BurnTimerEndFrame(nCyclesTotal[1]); - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; - - SekClose(); - - { - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - YMZ280BRender(pSoundBuf, nSegmentLength); - } - } - } - - ZetClose(); - - return 0; -} - -struct BurnDriver BurnDrvBattleBkraidu = { - "bbakraid", NULL, NULL, NULL, "1999", - "Battle Bakraid - Unlimited Version (U.S.A.) (Tue Jun 8 1999)\0", NULL, "Eighting", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, bkraiduRomInfo, bkraiduRomName, NULL, NULL, bbakraidInputInfo, bkraiduDIPInfo, - bbakraidInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBattleBkraiduj = { - "bbakraidj", "bbakraid", NULL, NULL, "1999", - "Battle Bakraid - Unlimited Version (Japan) (Tue Jun 8 1999)\0", NULL, "Eighting", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, bkraidujRomInfo, bkraidujRomName, NULL, NULL, bbakraidInputInfo, bbakraidDIPInfo, - bbakraidInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvBattleBkraidj = { - "bbakraidja", "bbakraid", NULL, NULL, "1999", - "Battle Bakraid (Japan) (Wed Apr 7 1999)\0", NULL, "Eighting", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, bkraidjRomInfo, bkraidjRomName, NULL, NULL, bbakraidInputInfo, bbakraidDIPInfo, - bbakraidInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; +#include "toaplan.h" +#include "ymz280b.h" +#include "eeprom.h" +#include "timer.h" + +// Battle Bakraid. + +// #define ADJUST_Z80_SPEED + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static UINT8 *DefaultEEPROM = NULL; + +static UINT8 DrvRegion = 0; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static UINT8 nIRQPending; + +static INT32 nSoundData[4]; +static UINT8 nSoundlatchAck; + +static INT32 Z80BusRQ = 0; + +static INT32 nCycles68KSync; + +static INT32 nTextROMStatus; + +static bool bUseAsm68KCoreOldValue = false; + +// Rom information +static struct BurnRomInfo bkraiduRomDesc[] = { + { "prg0u022_usa.bin", 0x080000, 0x95fb2ffd, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg2u021.bin", 0x080000, 0xFFBA8656, BRF_ESS | BRF_PRG }, // 1 + { "prg1u023.new", 0x080000, 0x4ae9aa64, BRF_ESS | BRF_PRG }, // 2 (odd) + { "prg3u024.bin", 0x080000, 0x834B8AD6, BRF_ESS | BRF_PRG }, // 3 + + { "gfxu0510.bin", 0x400000, 0x9CCA3446, BRF_GRA }, // 4 GP9001 Tile data + { "gfxu0512.bin", 0x400000, 0xA2A281D5, BRF_GRA }, // 5 + { "gfxu0511.bin", 0x400000, 0xE16472C0, BRF_GRA }, // 6 + { "gfxu0513.bin", 0x400000, 0x8BB635A0, BRF_GRA }, // 7 + + { "sndu0720.bin", 0x020000, 0xE62AB246, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "rom6.829", 0x400000, 0x8848B4A0, BRF_SND }, // 9 YMZ280B (AD)PCM data + { "rom7.830", 0x400000, 0xD6224267, BRF_SND }, // 10 + { "rom8.831", 0x400000, 0xA101DFB0, BRF_SND }, // 11 + + { "eeprom-bbakraid-new.bin", 0x00200, 0x35c9275a, BRF_PRG }, +}; + + +STD_ROM_PICK(bkraidu) +STD_ROM_FN(bkraidu) + +static struct BurnRomInfo bkraidjRomDesc[] = { + { "prg0u022.bin", 0x080000, 0x0DD59512, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg2u021.bin", 0x080000, 0xFFBA8656, BRF_ESS | BRF_PRG }, // 1 + { "prg1u023.bin", 0x080000, 0xFECDE223, BRF_ESS | BRF_PRG }, // 2 (odd) + { "prg3u024.bin", 0x080000, 0x834B8AD6, BRF_ESS | BRF_PRG }, // 3 + + { "gfxu0510.bin", 0x400000, 0x9CCA3446, BRF_GRA }, // 4 GP9001 Tile data + { "gfxu0512.bin", 0x400000, 0xA2A281D5, BRF_GRA }, // 5 + { "gfxu0511.bin", 0x400000, 0xE16472C0, BRF_GRA }, // 6 + { "gfxu0513.bin", 0x400000, 0x8BB635A0, BRF_GRA }, // 7 + + { "sndu0720.bin", 0x020000, 0xE62AB246, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "rom6.829", 0x400000, 0x8848B4A0, BRF_SND }, // 9 YMZ280B (AD)PCM data + { "rom7.830", 0x400000, 0xD6224267, BRF_SND }, // 10 + { "rom8.831", 0x400000, 0xA101DFB0, BRF_SND }, // 11 + + { "eeprom-bbakraid.bin", 0x00200, 0x7f97d347, BRF_PRG }, +}; + + +STD_ROM_PICK(bkraidj) +STD_ROM_FN(bkraidj) + +static struct BurnRomInfo bkraidujRomDesc[] = { + { "prg0u022.new", 0x080000, 0xFA8D38D3, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "prg2u021.bin", 0x080000, 0xFFBA8656, BRF_ESS | BRF_PRG }, // 1 + { "prg1u023.new", 0x080000, 0x4AE9AA64, BRF_ESS | BRF_PRG }, // 2 (odd) + { "prg3u024.bin", 0x080000, 0x834B8AD6, BRF_ESS | BRF_PRG }, // 3 + + { "gfxu0510.bin", 0x400000, 0x9CCA3446, BRF_GRA }, // 4 GP9001 Tile data + { "gfxu0512.bin", 0x400000, 0xA2A281D5, BRF_GRA }, // 5 + { "gfxu0511.bin", 0x400000, 0xE16472C0, BRF_GRA }, // 6 + { "gfxu0513.bin", 0x400000, 0x8BB635A0, BRF_GRA }, // 7 + + { "sndu0720.bin", 0x020000, 0xE62AB246, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "rom6.829", 0x400000, 0x8848B4A0, BRF_SND }, // 9 YMZ280B (AD)PCM data + { "rom7.830", 0x400000, 0xD6224267, BRF_SND }, // 10 + { "rom8.831", 0x400000, 0xA101DFB0, BRF_SND }, // 11 + + { "eeprom-bbakraid-new.bin", 0x00200, 0x35c9275a, BRF_PRG }, +}; + + +STD_ROM_PICK(bkraiduj) +STD_ROM_FN(bkraiduj) + +static struct BurnInputInfo bbakraidInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Shoot 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Shoot 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Shoot 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Shoot 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Shoot 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Shoot 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Test", BIT_DIGITAL, DrvButton + 2, "diag"}, + {"Service", BIT_DIGITAL, DrvButton + 0, "service"}, + {"Dip 1", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip 2", BIT_DIPSWITCH, DrvInput + 4, "dip"}, + {"Dip 3", BIT_DIPSWITCH, DrvInput + 5, "dip"}, + {"Region", BIT_DIPSWITCH, &DrvRegion , "dip"}, +}; + +STDINPUTINFO(bbakraid) + +static struct BurnDIPInfo bbakraidDIPList[] = { + + // Defaults + {0x15, 0xFF, 0xFF, 0x00, NULL}, + {0x16, 0xFF, 0xFF, 0x00, NULL}, + {0x17, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, "Test mode"}, + {0x15, 0x01, 0x01, 0x00, "Normal"}, + {0x15, 0x01, 0x01, 0x01, "Test"}, + // Normal + {0, 0xFE, 0, 2, "Starting coin"}, + {0x15, 0x82, 0x02, 0x00, "1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0x02, 0x02, "2 credits"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + // Free play + {0, 0xFE, 0, 2, "Stick mode"}, + {0x15, 0x02, 0x02, 0x00, "Normal"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x02, 0x02, 0x02, "Special"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + // Normal + {0, 0xFE, 0, 8, "Coin 1"}, + {0x15, 0x01, 0x1C, 0x00, "1 coin 1 credit"}, + {0x15, 0x01, 0x1C, 0x04, "1 coin 2 credits"}, + {0x15, 0x01, 0x1C, 0x08, "1 coin 3 credits"}, + {0x15, 0x01, 0x1C, 0x0C, "1 coin 4 credits"}, + {0x15, 0x01, 0x1C, 0x10, "2 coins 1 credit"}, + {0x15, 0x01, 0x1C, 0x14, "3 coins 1 credit"}, + {0x15, 0x01, 0x1C, 0x18, "4 coins 1 credit"}, + {0x15, 0x01, 0x1C, 0x1C, "Free Play"}, + // 0x1C: Free play settings active + // Normal + {0, 0xFE, 0, 7, "Coin 2"}, + {0x15, 0x82, 0xE0, 0x00, "1 coin 1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0x20, "1 coin 2 credits"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0x40, "1 coin 3 credits"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0x60, "1 coin 4 credits"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0x80, "2 coins 1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0xA0, "3 coins 1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0xC0, "4 coins 1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x82, 0xE0, 0x04, "1 coin 1 credit"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + // Free play + {0, 0xFE, 0, 2, "Hit score"}, + {0x15, 0x02, 0x20, 0x00, "Off"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x02, 0x20, 0x20, "On"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0, 0xFE, 0, 2, "Sound effect"}, + {0x15, 0x02, 0x40, 0x00, "Off"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x02, 0x40, 0x40, "On"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0, 0xFE, 0, 2, "Music"}, + {0x15, 0x02, 0x80, 0x00, "Off"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + {0x15, 0x02, 0x80, 0x80, "On"}, + {0x15, 0x00, 0x1C, 0x1C, NULL}, + + // DIP 2 + {0, 0xFE, 0, 4, "Start rank"}, + {0x16, 0x01, 0x03, 0x00, "Normal"}, + {0x16, 0x01, 0x03, 0x01, "Easy"}, + {0x16, 0x01, 0x03, 0x02, "Hard"}, + {0x16, 0x01, 0x03, 0x03, "Very hard"}, + {0, 0xFE, 0, 4, "Timer rank"}, + {0x16, 0x01, 0x0C, 0x00, "Normal"}, + {0x16, 0x01, 0x0C, 0x04, "Low"}, + {0x16, 0x01, 0x0C, 0x08, "High"}, + {0x16, 0x01, 0x0C, 0x0C, "Highest"}, + {0, 0xFE, 0, 4, "Player counts"}, + {0x16, 0x01, 0x30, 0x00, "3"}, + {0x16, 0x01, 0x30, 0x10, "4"}, + {0x16, 0x01, 0x30, 0x20, "2"}, + {0x16, 0x01, 0x30, 0x30, "1"}, + {0, 0xFE, 0, 4, "Extra player"}, + {0x16, 0x01, 0xC0, 0x00, "2000000 each"}, + {0x16, 0x01, 0xC0, 0x40, "3000000 each"}, + {0x16, 0x01, 0xC0, 0x80, "4000000 each"}, + {0x16, 0x01, 0xC0, 0xC0, "No extra player"}, + + // DIP 3 + {0, 0xFE, 0, 2, "Screen flip"}, + {0x17, 0x01, 0x01, 0x00, "Off"}, + {0x17, 0x01, 0x01, 0x01, "On"}, + {0, 0xFE, 0, 2, "Demo sound"}, + {0x17, 0x01, 0x02, 0x00, "On"}, + {0x17, 0x01, 0x02, 0x02, "Off"}, + {0, 0xFE, 0, 2, "Stage edit"}, + {0x17, 0x01, 0x04, 0x00, "Disable"}, + {0x17, 0x01, 0x04, 0x04, "Enable"}, + {0, 0xFE, 0, 2, "Continue play"}, + {0x17, 0x01, 0x08, 0x00, "Enable"}, + {0x17, 0x01, 0x08, 0x08, "Disable"}, + {0, 0xFE, 0, 2, "Invincible"}, + {0x17, 0x01, 0x10, 0x00, "Off"}, + {0x17, 0x01, 0x10, 0x10, "On"}, + {0, 0xFE, 0, 2, "Score ranking"}, + {0x17, 0x01, 0x20, 0x00, "Save"}, + {0x17, 0x01, 0x20, 0x20, "No save"}, +}; + +static struct BurnDIPInfo bbakraidRegionDIPList[] = { + + // Region + {0x18, 0xFF, 0xFF, 0x00, NULL}, + {0, 0xFD, 0, 26, "Region"}, + {0x18, 0x01, 0x1F, 0x00, "Nippon"}, + {0x18, 0x01, 0x1F, 0x01, "U.S.A."}, + {0x18, 0x01, 0x1F, 0x02, "Europe"}, + {0x18, 0x01, 0x1F, 0x03, "Asia"}, + {0x18, 0x01, 0x1F, 0x04, "German"}, + {0x18, 0x01, 0x1F, 0x05, "Austria"}, + {0x18, 0x01, 0x1F, 0x06, "Belgium"}, + {0x18, 0x01, 0x1F, 0x07, "Denmark"}, + {0x18, 0x01, 0x1F, 0x08, "Finland"}, + {0x18, 0x01, 0x1F, 0x09, "France"}, + {0x18, 0x01, 0x1F, 0x0A, "Great Britain"}, + {0x18, 0x01, 0x1F, 0x0B, "Greece"}, + {0x18, 0x01, 0x1F, 0x0C, "Holland"}, + {0x18, 0x01, 0x1F, 0x0D, "Italy"}, + {0x18, 0x01, 0x1F, 0x0E, "Norway"}, + {0x18, 0x01, 0x1F, 0x0F, "Portugal"}, + {0x18, 0x01, 0x1F, 0x10, "Spain"}, + {0x18, 0x01, 0x1F, 0x11, "Sweden"}, + {0x18, 0x01, 0x1F, 0x12, "Switzerland"}, + {0x18, 0x01, 0x1F, 0x13, "Australia"}, + {0x18, 0x01, 0x1F, 0x14, "New Zealand"}, + {0x18, 0x01, 0x1F, 0x15, "Taiwan"}, + {0x18, 0x01, 0x1F, 0x16, "HongKong"}, + {0x18, 0x01, 0x1F, 0x17, "Korea"}, + {0x18, 0x01, 0x1F, 0x18, "China"}, + {0x18, 0x01, 0x1F, 0x19, "World"}, +}; + +STDDIPINFOEXT(bbakraid, bbakraid, bbakraidRegion) + +static struct BurnDIPInfo bkraiduRegionDIPList[] = { + + // Region + {0x18, 0xFF, 0xFF, 0x01, NULL}, + {0, 0xFD, 0, 26, "Region"}, + {0x18, 0x01, 0x1F, 0x00, "Nippon"}, + {0x18, 0x01, 0x1F, 0x01, "U.S.A."}, + {0x18, 0x01, 0x1F, 0x02, "Europe"}, + {0x18, 0x01, 0x1F, 0x03, "Asia"}, + {0x18, 0x01, 0x1F, 0x04, "German"}, + {0x18, 0x01, 0x1F, 0x05, "Austria"}, + {0x18, 0x01, 0x1F, 0x06, "Belgium"}, + {0x18, 0x01, 0x1F, 0x07, "Denmark"}, + {0x18, 0x01, 0x1F, 0x08, "Finland"}, + {0x18, 0x01, 0x1F, 0x09, "France"}, + {0x18, 0x01, 0x1F, 0x0A, "Great Britain"}, + {0x18, 0x01, 0x1F, 0x0B, "Greece"}, + {0x18, 0x01, 0x1F, 0x0C, "Holland"}, + {0x18, 0x01, 0x1F, 0x0D, "Italy"}, + {0x18, 0x01, 0x1F, 0x0E, "Norway"}, + {0x18, 0x01, 0x1F, 0x0F, "Portugal"}, + {0x18, 0x01, 0x1F, 0x10, "Spain"}, + {0x18, 0x01, 0x1F, 0x11, "Sweden"}, + {0x18, 0x01, 0x1F, 0x12, "Switzerland"}, + {0x18, 0x01, 0x1F, 0x13, "Australia"}, + {0x18, 0x01, 0x1F, 0x14, "New Zealand"}, + {0x18, 0x01, 0x1F, 0x15, "Taiwan"}, + {0x18, 0x01, 0x1F, 0x16, "HongKong"}, + {0x18, 0x01, 0x1F, 0x17, "Korea"}, + {0x18, 0x01, 0x1F, 0x18, "China"}, + {0x18, 0x01, 0x1F, 0x19, "World"}, +}; + +STDDIPINFOEXT(bkraidu, bbakraid, bkraiduRegion) + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *Ram01, *Ram02, *RamPal; + +static INT32 nColCount = 0x0800; + +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x200000; // + RomZ80 = Next; Next += 0x020000; // Z80 ROM + GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data + YMZ280BROM = Next; Next += 0xC00000; + DefaultEEPROM = Next; Next += 0x000200; + RamStart = Next; + ExtraTROM = Next; Next += 0x008000; // Extra Text layer tile data + ExtraTRAM = Next; Next += 0x002000; // Extra tile layer + Ram01 = Next; Next += 0x005000; // RAM + Extra text layer scroll/offset + Ram02 = Next; Next += 0x008000; // + RamPal = Next; Next += 0x001000; // palette + RamZ80 = Next; Next += 0x004000; // Z80 RAM + GP9001RAM[0]= Next; Next += 0x004000; + GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); + RamEnd = Next; + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + MemEnd = Next; + + ExtraTSelect= Ram01; // Extra text layer scroll + ExtraTScroll= Ram01 + 0x000200; // Extra text layer offset + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029521; + } + + EEPROMScan(nAction, pnMin); // Scan EEPROM + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); // scan 68000 states + ZetScan(nAction); // Scan Z80 + + YMZ280BScan(); + BurnTimerScan(nAction, pnMin); + + ToaScanGP9001(nAction, pnMin); + + SCAN_VAR(DrvInput); + SCAN_VAR(nSoundData); + SCAN_VAR(Z80BusRQ); + SCAN_VAR(nIRQPending); + } + + return 0; +} + +static INT32 LoadRoms() +{ + // Load 68000 ROM + if (ToaLoadCode(Rom01, 0, 4)) { + return 1; + } + + // Load GP9001 tile data + ToaLoadGP9001Tiles(GP9001ROM[0], 4, 4, nGP9001ROMSize[0]); + + // Load the z80 Rom + BurnLoadRom(RomZ80, 8, 1); + + // Load YMZ280B (AD)PCM data + BurnLoadRom(YMZ280BROM + 0x000000, 9, 1); + BurnLoadRom(YMZ280BROM + 0x400000, 10, 1); + BurnLoadRom(YMZ280BROM + 0x800000, 11, 1); + + BurnLoadRom(DefaultEEPROM, 12, 1); + + return 0; +} + +static inline void bbakraidSynchroniseZ80(INT32 nExtraCycles) +{ +#ifdef ADJUST_Z80_SPEED + INT32 nCycles = SekTotalCycles() / 4 + nExtraCycles; +#else + INT32 nCycles = ((INT64)SekTotalCycles() * nCyclesTotal[1] / nCyclesTotal[0]) + nExtraCycles; +#endif + + if (nCycles <= ZetTotalCycles()) { + return; + } + + nCycles68KSync = nCycles - nExtraCycles; + + BurnTimerUpdate(nCycles); +} + +static INT32 bbakraidTimerOver(INT32, INT32) +{ +// bprintf(PRINT_NORMAL, _T(" - IRQ -> 1.\n")); + ZetSetIRQLine(0xFF, ZET_IRQSTATUS_AUTO); + + return 0; +} + +UINT8 __fastcall bbakraidZIn(UINT16 nAddress) +{ + nAddress &= 0xFF; + switch (nAddress) { + case 0x48: + return nSoundData[0]; + case 0x4A: + return nSoundData[1]; + + case 0x81: + // YMZ280B status port. + return YMZ280BReadStatus(); + +// default: +// printf("Z80 read port #%02X\n", nAddress & 0xFF); + } + return 0; +} + +void __fastcall bbakraidZOut(UINT16 nAddress, UINT8 nValue) +{ + nAddress &= 0xFF; + switch (nAddress) { + case 0x40: + if (!(nSoundlatchAck & 1) && ZetTotalCycles() > nCycles68KSync) { + BurnTimerUpdateEnd(); + } + nSoundlatchAck |= 1; + nSoundData[2] = nValue; + break; + case 0x42: + if (!(nSoundlatchAck & 2) && ZetTotalCycles() > nCycles68KSync) { + BurnTimerUpdateEnd(); + } + nSoundlatchAck |= 2; + nSoundData[3] = nValue; + break; + +// case 0x44: // ??? +// case 0x46: // Acknowledge interrupt +// break; + + case 0x80: + // YMZ280B register select + YMZ280BSelectRegister(nValue); + break; + case 0x81: + // YMZ280B register write + YMZ280BWriteRegister(nValue); + break; + +// default: +// printf("Z80 wrote value %02X to port #%02x.\n", nValue, nAddress); + } +} + +static INT32 DrvZ80Init() +{ + // Init the Z80 + ZetInit(0); + ZetOpen(0); + + ZetSetInHandler(bbakraidZIn); + ZetSetOutHandler(bbakraidZOut); + + // ROM + ZetMapArea(0x0000, 0xBFFF, 0, RomZ80); // Direct Read from ROM + ZetMapArea(0x0000, 0xBFFF, 2, RomZ80); // Direct Fetch from ROM + // RAM + ZetMapArea(0xC000, 0xFFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea(0xC000, 0xFFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea(0xC000, 0xFFFF, 2, RamZ80); // + + ZetClose(); + + return 0; +} + +static void Map68KTextROM(bool bMapTextROM) +{ + if (bMapTextROM) { + if (nTextROMStatus != 1) { + SekMapMemory(ExtraTROM, 0x200000, 0x207FFF, SM_RAM); // Extra text tile memory + + nTextROMStatus = 1; + } + } else { + if (nTextROMStatus != 0) { + SekMapMemory(ExtraTRAM, 0x200000, 0x201FFF, SM_RAM); // Extra text tilemap RAM + SekMapMemory(RamPal, 0x202000, 0x202FFF, SM_RAM); // Palette RAM + SekMapMemory(Ram01, 0x203000, 0x207FFF, SM_RAM); // Extra text Scroll & offset; RAM + + nTextROMStatus = 0; + } + } +} + +UINT8 __fastcall bbakraidReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x500000: // Player 2 Inputs + return DrvInput[1]; + case 0x500001: // Player 1 Inputs + return DrvInput[0]; + case 0x500002: // Other inputs + return DrvInput[5]; + case 0x500003: // Dipswitch 3 + return DrvInput[2]; + case 0x500004: // Dipswitch 2 + return DrvInput[4]; + case 0x500005: // Dipswitch 1 + return DrvInput[3]; + + // These addresses contain the response of the Z80 to the (sound) commands + case 0x500011: + return nSoundData[2]; + case 0x500013: + return nSoundData[3]; + + case 0x500019: + return ((EEPROMRead() & 0x01) << 4) | (Z80BusRQ >> 4); + + default: { +// printf("Attempt to read byte value of location %x\n", sekAddress); + } + } + + return 0; +} + +UINT16 __fastcall bbakraidReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + + // Video status register + case 0x500006: + return ToaScanlineRegister(); + + // These addresses contain the response of the Z80 to the (sound) commands + case 0x500010: +// bbakraidSynchroniseZ80(0); + if (!(nSoundlatchAck & 1)) { + bbakraidSynchroniseZ80(0x0100); + } + return nSoundData[2]; + case 0x500012: +// bbakraidSynchroniseZ80(0); + if (!(nSoundlatchAck & 2)) { + bbakraidSynchroniseZ80(0x0100); + } + return nSoundData[3]; + + case 0x500018: + return ((EEPROMRead() & 0x01) << 4) | (Z80BusRQ >> 4); + + default: { +// printf("Attempt to read word value of location %x\n", sekAddress); + } + } + + return 0; +} + +void __fastcall bbakraidWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + + case 0x500009: // Coin control + return; + + case 0x50001F: + Z80BusRQ = byteValue & 0x10; + EEPROMWrite(byteValue & 8, byteValue & 1, byteValue & 4); + return; + +// default: +// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } +} + +void __fastcall bbakraidWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + case 0x500014: + nSoundlatchAck &= ~1; + nSoundData[0] = wordValue; + return; + case 0x500016: + nSoundlatchAck &= ~2; + nSoundData[1] = wordValue; + return; + + // This register is always written to after writing (sound) commands for the Z80 + case 0x50001A: + bbakraidSynchroniseZ80(0); + ZetNmi(); + return; + + // Serial EEPROM command + case 0x50001E: + Z80BusRQ = wordValue & 0x10; + EEPROMWrite(wordValue & 8, wordValue & 1, wordValue & 4); + return; + + case 0x500080: + Map68KTextROM(false); + return; + + case 0x50001C: // ??? + return; + + case 0x500082: // Acknowledge interrupt + SekSetIRQLine(0, SEK_IRQSTATUS_NONE); + nIRQPending = 0; + return; + + case 0x5000C0: + case 0x5000C1: + case 0x5000C2: + case 0x5000C3: + case 0x5000C4: + case 0x5000C5: + case 0x5000C6: + case 0x5000C7: + case 0x5000C8: + case 0x5000C9: + case 0x5000CA: + case 0x5000CB: + case 0x5000CC: + case 0x5000CD: + case 0x5000CE: + GP9001TileBank[(sekAddress & 0x0F) >> 1] = ((wordValue & 0x0F) << 15); + return; + +// default: +// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); + } +} + +UINT16 __fastcall bbakraidReadWordGP9001(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x400008: + return ToaGP9001ReadRAM_Hi(0); + case 0x40000A: + return ToaGP9001ReadRAM_Lo(0); + + } + + return 0; +} + +void __fastcall bbakraidWriteWordGP9001(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + + case 0x400000: + ToaGP9001WriteRegister(wordValue); + break; + + case 0x400004: + ToaGP9001SelectRegister(wordValue); + break; + + case 0x400008: + case 0x40000A: + ToaGP9001WriteRAM(wordValue, 0); + break; + + case 0x40000C: // Set GP9001 VRAM address-pointer + ToaGP9001SetRAMPointer(wordValue); + break; + } +} + +UINT8 __fastcall bbakraidReadByteZ80ROM(UINT32 sekAddress) +{ + return RomZ80[(sekAddress & 0x7FFFF) >> 1]; +} + +UINT16 __fastcall bbakraidReadWordZ80ROM(UINT32 sekAddress) +{ + return RomZ80[(sekAddress & 0x7FFFF) >> 1]; +} + +static INT32 DrvDoReset() +{ + // Insert region code into 68K ROM, code by BisonSAS + UINT8 nRegion = DrvRegion & 0x1F; + if (nRegion<=25) { + Rom01[0x00000^1]=(UINT8)(nRegion<<13) | (DrvRegion & 0x1F); + } + + SekOpen(0); + nIRQPending = 0; + SekSetIRQLine(0, SEK_IRQSTATUS_NONE); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + EEPROMReset(); + + Z80BusRQ = 0; + + memset(nSoundData, 0, sizeof(nSoundData)); + nSoundlatchAck = 0; + + YMZ280BReset(); + + nCyclesDone[0] = nCyclesDone[1] = 0; + + BurnTimerReset(); + ZetOpen(0); + BurnTimerSetRetrig(0, 1.0 / 445.0); + ZetClose(); + + return 0; +} + +static const eeprom_interface eeprom_interface_93C66 = +{ + 9, // address bits + 8, // data bits + "*110", // read 110 aaaaaaaaa + "*101", // write 101 aaaaaaaaa dddddddd + "*111", // erase 111 aaaaaaaaa + "*10000xxxxxxx",// lock 100x 00xxxx + "*10011xxxxxxx",// unlock 100x 11xxxx + 0, + 0 +}; + +static INT32 bbakraidInit() +{ + INT32 nLen; + +#ifdef DRIVER_ROTATION + bToaRotateScreen = true; +#endif + + nGP9001ROMSize[0] = 0x1000000; + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + EEPROMInit(&eeprom_interface_93C66); + + // Make sure we use Musashi + if (bBurnUseASMCPUEmulation) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching to Musashi 68000 core\n")); +#endif + bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; + bBurnUseASMCPUEmulation = false; + } + +// if (strcmp("bbakraid", BurnDrvGetTextA(DRV_NAME)) == 0 || strcmp("bbakraidj", BurnDrvGetTextA(DRV_NAME)) == 0) { +// if (!EEPROMAvailable()) EEPROMFill(bbakraid_unlimited_nvram, 0, sizeof(bbakraid_unlimited_nvram)); +// } + + if (!EEPROMAvailable()) EEPROMFill(DefaultEEPROM, 0, 0x200); + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x1FFFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram02, 0x208000, 0x20FFFF, SM_RAM); + + Map68KTextROM(true); + + SekSetReadWordHandler(0, bbakraidReadWord); + SekSetReadByteHandler(0, bbakraidReadByte); + SekSetWriteWordHandler(0, bbakraidWriteWord); + SekSetWriteByteHandler(0, bbakraidWriteByte); + + SekMapHandler(1, 0x400000, 0x400400, SM_RAM); // GP9001 addresses + + SekSetReadWordHandler(1, bbakraidReadWordGP9001); + SekSetWriteWordHandler(1, bbakraidWriteWordGP9001); + + SekMapHandler(2, 0x300000, 0x37FFFF, SM_ROM); // Z80 ROM + + SekSetReadByteHandler(2, bbakraidReadByteZ80ROM); + SekSetReadWordHandler(2, bbakraidReadWordZ80ROM); + + SekClose(); + } + + nSpriteYOffset = 0x0001; + + nLayer0XOffset = -0x01D6; + nLayer1XOffset = -0x01D8; + nLayer2XOffset = -0x01DA; + + ToaInitGP9001(); + + nExtraTXOffset = 0x2C; + ToaExtraTextInit(); + + DrvZ80Init(); // Initialize Z80 + + YMZ280BInit(16934400, NULL); + YMZ280BSetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + + BurnTimerInit(bbakraidTimerOver, NULL); + BurnTimerAttachZet(TOA_Z80_SPEED); + + nToaPalLen = nColCount; + ToaPalSrc = RamPal; + ToaPalInit(); + + nTextROMStatus = -1; + bDrawScreen = true; + + DrvDoReset(); // Reset machine + + return 0; +} + +static INT32 DrvExit() +{ + ToaPalExit(); + BurnTimerExit(); + YMZ280BExit(); + ToaExitGP9001(); + ToaExtraTextExit(); + ToaZExit(); // Z80 exit + SekExit(); // Deallocate 68000s + + EEPROMExit(); + + if (bUseAsm68KCoreOldValue) { +#if 1 && defined FBA_DEBUG + bprintf(PRINT_NORMAL, _T("Switching back to A68K core\n")); +#endif + bUseAsm68KCoreOldValue = false; + bBurnUseASMCPUEmulation = true; + } + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderGP9001(); // Render GP9001 graphics + ToaExtraTextLayer(); // Render extra text layer + } + + ToaPalUpdate(); // Update the palette + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 8; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x00; // Buttons + DrvInput[1] = 0x00; // Player 1 + DrvInput[2] = 0x00; // Player 2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[2] |= (DrvButton[i] & 1) << i; + } + ToaClearOpposites(&DrvInput[0]); + ToaClearOpposites(&DrvInput[1]); + + SekNewFrame(); + ZetNewFrame(); + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); +#ifdef ADJUST_Z80_SPEED + nCyclesTotal[1] = nCyclesTotal[0] / 4; +#else + nCyclesTotal[1] = TOA_Z80_SPEED / 60; +#endif + + SekOpen(0); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + INT32 nSoundBufferPos = 0; + + ZetOpen(0); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + for (INT32 i = 1; i <= nInterleave; i++) { + INT32 nNext; + + // Run 68000 + + nNext = i * nCyclesTotal[0] / nInterleave; + + // Trigger VBlank interrupt + if (!bVBlank && nNext > nToaCyclesVBlankStart) { + if (SekTotalCycles() < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); + if (!CheckSleep(0)) { + SekRun(nCyclesSegment); + } else { + SekIdle(nCyclesSegment); + } + } + + nIRQPending = 1; + SekSetIRQLine(3, SEK_IRQSTATUS_ACK); + + ToaBufferGP9001Sprites(); + + if (pBurnDraw) { // Draw screen if needed + DrvDraw(); + } + + bVBlank = true; + } + + nCyclesSegment = nNext - SekTotalCycles(); + if (!CheckSleep(0)) { // See if this CPU is busywaiting + SekRun(nCyclesSegment); + } else { + SekIdle(nCyclesSegment); + } + + if ((i & 1) == 0) { + // Render sound segment + if (pBurnSoundOut) { + INT32 nSegmentEnd = nBurnSoundLen * i / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + YMZ280BRender(pSoundBuf, nSegmentEnd - nSoundBufferPos); + nSoundBufferPos = nSegmentEnd; + } + } + } + + nCycles68KSync = SekTotalCycles(); + BurnTimerEndFrame(nCyclesTotal[1]); + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; + + SekClose(); + + { + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + YMZ280BRender(pSoundBuf, nSegmentLength); + } + } + } + + ZetClose(); + + return 0; +} + +struct BurnDriver BurnDrvBattleBkraidu = { + "bbakraid", NULL, NULL, NULL, "1999", + "Battle Bakraid - Unlimited Version (U.S.A.) (Tue Jun 8 1999)\0", NULL, "Eighting", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, bkraiduRomInfo, bkraiduRomName, NULL, NULL, bbakraidInputInfo, bkraiduDIPInfo, + bbakraidInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBattleBkraiduj = { + "bbakraidj", "bbakraid", NULL, NULL, "1999", + "Battle Bakraid - Unlimited Version (Japan) (Tue Jun 8 1999)\0", NULL, "Eighting", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, bkraidujRomInfo, bkraidujRomName, NULL, NULL, bbakraidInputInfo, bbakraidDIPInfo, + bbakraidInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvBattleBkraidj = { + "bbakraidja", "bbakraid", NULL, NULL, "1999", + "Battle Bakraid (Japan) (Wed Apr 7 1999)\0", NULL, "Eighting", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, bkraidjRomInfo, bkraidjRomName, NULL, NULL, bbakraidInputInfo, bbakraidDIPInfo, + bbakraidInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; diff --git a/src/burn/drv/toaplan/d_demonwld.cpp b/src/burn/drv/toaplan/d_demonwld.cpp index d42960ece..9590f9cb7 100644 --- a/src/burn/drv/toaplan/d_demonwld.cpp +++ b/src/burn/drv/toaplan/d_demonwld.cpp @@ -1,871 +1,870 @@ -#include "toaplan.h" - -#define REFRESHRATE 60 -#define VBLANK_LINES (32) - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvPalRAM; -static UINT8 *DrvPalRAM2; -static UINT8 *DrvShareRAM; - -static UINT8 DrvInputs[3]; -static UINT8 DrvDips[3]; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvReset; - -static INT32 nColCount = 0x0800; - -static UINT8 bDrawScreen; -static bool bVBlank; - -static bool bEnableInterrupts; - -static bool bUseAsm68KCoreOldValue = false; -static INT32 demonwld_hack; - -static struct BurnInputInfo DemonwldInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 5, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 6, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 1, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Demonwld) - -static struct BurnDIPInfo DemonwldDIPList[]= -{ - {0x15, 0xff, 0xff, 0x00, NULL }, - {0x16, 0xff, 0xff, 0x00, NULL }, - {0x17, 0xff, 0xff, 0x01, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x02, 0x00, "Off" }, - {0x15, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x08, "Off" }, - {0x15, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x15, 0x01, 0x30, 0x30, "4 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x20, "3 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x03, 0x01, "Easy" }, - {0x16, 0x01, 0x03, 0x00, "Medium" }, - {0x16, 0x01, 0x03, 0x02, "Hard" }, - {0x16, 0x01, 0x03, 0x03, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x00, "30K, every 100K" }, - {0x16, 0x01, 0x0c, 0x04, "50K and 100K" }, - {0x16, 0x01, 0x0c, 0x08, "100K only" }, - {0x16, 0x01, 0x0c, 0x0c, "None" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x30, 0x30, "1" }, - {0x16, 0x01, 0x30, 0x20, "2" }, - {0x16, 0x01, 0x30, 0x00, "3" }, - {0x16, 0x01, 0x30, 0x10, "5" }, - - {0 , 0xfe, 0 , 2, "Invulnerability" }, - {0x16, 0x01, 0x40, 0x00, "Off" }, - {0x16, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Unused" }, - {0x16, 0x01, 0x80, 0x00, "Off" }, - {0x16, 0x01, 0x80, 0x80, "On" }, - - {0 , 0xfe, 0 , 2, "Territory/Copyright" }, - {0x17, 0x01, 0x01, 0x01, "Toaplan" }, - {0x17, 0x01, 0x01, 0x00, "Japan/Taito Corp" }, -}; - -STDDIPINFO(Demonwld) - -static struct BurnDIPInfo Demonwl1DIPList[]= -{ - {0x15, 0xff, 0xff, 0x00, NULL }, - {0x16, 0xff, 0xff, 0x00, NULL }, - {0x17, 0xff, 0xff, 0x02, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x15, 0x01, 0x02, 0x00, "Off" }, - {0x15, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x15, 0x01, 0x08, 0x08, "Off" }, - {0x15, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x15, 0x01, 0x30, 0x30, "4 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x20, "3 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x15, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x15, 0x01, 0xc0, 0x00, "1 Coin 2 Credits" }, - {0x15, 0x01, 0xc0, 0x40, "1 Coin 3 Credits" }, - {0x15, 0x01, 0xc0, 0x80, "1 Coin 4 Credits" }, - {0x15, 0x01, 0xc0, 0xc0, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x16, 0x01, 0x03, 0x01, "Easy" }, - {0x16, 0x01, 0x03, 0x00, "Medium" }, - {0x16, 0x01, 0x03, 0x02, "Hard" }, - {0x16, 0x01, 0x03, 0x03, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x16, 0x01, 0x0c, 0x00, "30K, every 100K" }, - {0x16, 0x01, 0x0c, 0x04, "50K and 100K" }, - {0x16, 0x01, 0x0c, 0x08, "100K only" }, - {0x16, 0x01, 0x0c, 0x0c, "None" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x16, 0x01, 0x30, 0x30, "1" }, - {0x16, 0x01, 0x30, 0x20, "2" }, - {0x16, 0x01, 0x30, 0x00, "3" }, - {0x16, 0x01, 0x30, 0x10, "5" }, - - {0 , 0xfe, 0 , 2, "Invulnerability" }, - {0x16, 0x01, 0x40, 0x00, "Off" }, - {0x16, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Unused" }, - {0x16, 0x01, 0x80, 0x00, "Off" }, - {0x16, 0x01, 0x80, 0x80, "On" }, - - {0 , 0xfe, 0 , 4, "Territory/Copyright" }, - {0x17, 0x01, 0x03, 0x02, "World/Taito Japan" }, - {0x17, 0x01, 0x03, 0x03, "US/Toaplan" }, - {0x17, 0x01, 0x03, 0x01, "US/Taito America" }, - {0x17, 0x01, 0x03, 0x00, "Japan/Taito Corp" }, -}; - -STDDIPINFO(Demonwl1) - -void __fastcall demonwldWriteWord(UINT32 a, UINT16 d) -{ - switch (a) - { - case 0x400000: - return; // nop - - case 0x400002: - bEnableInterrupts = d & 0xff; - return; - - case 0x400008: - case 0x40000a: - case 0x40000c: - case 0x40000e: - // toaplan1_bcu_control_w - return; - - case 0x800000: - // toaplan1_bcu_flipscreen_w - return; - - case 0x800002: - ToaBCU2SetRAMPointer(d); - return; - - case 0x800004: - case 0x800006: - ToaBCU2WriteRAM(d); - return; - - case 0x800010: - case 0x800012: - case 0x800014: - case 0x800016: - case 0x800018: - case 0x80001a: - case 0x80001c: - case 0x80001e: - BCU2Reg[(a & 0x0f) >> 1] = d; - return; - - case 0xa00000: - return; // nop - - case 0xa00002: - ToaFCU2SetRAMPointer(d); - return; - - case 0xa00004: - ToaFCU2WriteRAM(d); - return; - - case 0xa00006: - ToaFCU2WriteRAMSize(d); - return; - - case 0xe00000: - nBCU2TileXOffset = d; - return; - - case 0xe00002: - nBCU2TileYOffset = d; - return; - - case 0xe00006: - // toaplan1_fcu_flipscreen_w - return; - - case 0xe00008: - if (d == 0) { - ZetReset(); - } - return; - - case 0xe0000a: - // dsp_ctrl_w - return; - } -} - -void __fastcall demonwldWriteByte(UINT32 , UINT8 ) -{ - return; -} - -UINT16 __fastcall demonwldReadWord(UINT32 a) -{ - switch (a) - { - case 0x800002: - return ToaBCU2GetRAMPointer(); - - case 0x800004: - return ToaBCU2ReadRAM_Hi(); - - case 0x800006: - return ToaBCU2ReadRAM_Lo(); - - case 0x800010: - case 0x800012: - case 0x800014: - case 0x800016: - case 0x800018: - case 0x80001a: - case 0x80001c: - case 0x80001e: - return BCU2Reg[(a & 0x0f) >> 1]; - - case 0xa00002: - return ToaFCU2GetRAMPointer(); - - case 0xa00004: - return ToaFCU2ReadRAM(); - - case 0xa00006: - return ToaFCU2ReadRAMSize(); - - case 0xe0000e: // hack - { - demonwld_hack++; - if (demonwld_hack & 4) - return 0x76; - else - return 0; - } - } - - return 0; -} - -UINT8 __fastcall demonwldReadByte(UINT32 a) -{ - switch (a) - { - case 0x400001: - case 0xa00001: - return ToaVBlankRegister(); - } - - return 0; -} - -void __fastcall demonwld_sound_write_port(UINT16 p, UINT8 d) -{ - switch (p & 0xff) - { - case 0x00: { - BurnYM3812Write(0, d); - return; - } - - case 0x01: { - BurnYM3812Write(1, d); - return; - } - - case 0x40: // toaplan1_coin_w - return; - } -} - -UINT8 __fastcall demonwld_sound_read_port(UINT16 p) -{ - switch (p & 0xff) - { - case 0x00: - case 0x01: - return BurnYM3812Read(p & 1); - - case 0x20: - return DrvDips[2]; - - case 0x60: - return DrvInputs[2]; - - case 0x80: - return DrvInputs[0]; - - case 0xa0: - return DrvDips[1]; - - case 0xc0: - return DrvInputs[1]; - - case 0xe0: - return DrvDips[0]; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - - bEnableInterrupts = false; - demonwld_hack = 0; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x040000 + 0x400; - DrvZ80ROM = Next; Next += 0x010000; - BCU2ROM = Next; Next += nBCU2ROMSize; - FCU2ROM = Next; Next += nFCU2ROMSize; - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x004000; - DrvPalRAM = Next; Next += 0x000800; - DrvPalRAM2 = Next; Next += 0x000800; - - RamZ80 = Next; - DrvShareRAM = Next; Next += 0x008000; - - BCU2RAM = Next; Next += 0x010000; - FCU2RAM = Next; Next += 0x000800; - FCU2RAMSize = Next; Next += 0x000080; - - RamEnd = Next; - - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static INT32 DrvInit() -{ - if (bBurnUseASMCPUEmulation) { - bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; - bBurnUseASMCPUEmulation = false; - } - - INT32 nLen; - -// bToaRotateScreen = true; - - BurnSetRefreshRate(REFRESHRATE); - - nBCU2ROMSize = 0x080000; - nFCU2ROMSize = 0x080000; - - // Find out how much memory is needed - AllMem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(AllMem, 0, nLen); - MemIndex(); - - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; - - ToaLoadTiles(BCU2ROM, 5, nBCU2ROMSize); - ToaLoadTiles(FCU2ROM, 9, nFCU2ROMSize); - - { - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x03FFFF, SM_ROM); - SekMapMemory(DrvPalRAM, 0x404000, 0x4047FF, SM_RAM); - SekMapMemory(DrvPalRAM2, 0x406000, 0x4067FF, SM_RAM); - SekMapMemory(Drv68KRAM, 0xc00000, 0xc03FFF, SM_RAM); - SekSetReadWordHandler(0, demonwldReadWord); - SekSetReadByteHandler(0, demonwldReadByte); - SekSetWriteWordHandler(0, demonwldWriteWord); - SekSetWriteByteHandler(0, demonwldWriteByte); - - SekMapHandler(1, 0x600000, 0x600FFF, SM_RAM); - SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); - SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); - SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); - SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0xffff, 0, DrvShareRAM); - ZetMapArea(0x8000, 0xffff, 1, DrvShareRAM); - ZetMapArea(0x8000, 0xffff, 2, DrvShareRAM); - ZetSetOutHandler(demonwld_sound_write_port); - ZetSetInHandler(demonwld_sound_read_port); - ZetMemEnd(); - ZetClose(); - } - - ToaInitBCU2(); - - nToaPalLen = nColCount; - ToaPalSrc = DrvPalRAM; - ToaPalSrc2 = DrvPalRAM2; - ToaPalInit(); - - ToaOpaquePriority = 2; - - BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); - BurnTimerAttachZetYM3812(28000000 / 8); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); - return 0; -} - -static INT32 DrvExit() -{ - BurnYM3812Exit(); - ToaPalExit(); - - ToaExitBCU2(); - ToaZExit(); - SekExit(); - - BurnFree(AllMem); - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0x120); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderBCU2(); - } - - ToaPalUpdate(); - ToaPal2Update(); - - if (bUseAsm68KCoreOldValue) { - bUseAsm68KCoreOldValue = false; - bBurnUseASMCPUEmulation = true; - } - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 4; - - if (DrvReset) { - DrvDoReset(); - } - - memset (DrvInputs, 0, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] |= (DrvJoy1[i] & 1) << i; - DrvInputs[1] |= (DrvJoy2[i] & 1) << i; - DrvInputs[2] |= (DrvJoy3[i] & 1) << i; - } - ToaClearOpposites(&DrvInputs[0]); - ToaClearOpposites(&DrvInputs[1]); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); - nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext; - - // Run 68000 - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - - // Trigger VBlank interrupt - if (nNext > nToaCyclesVBlankStart) { - if (SekTotalCycles() < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); - SekRun(nCyclesSegment); - } - - if (pBurnDraw) { - DrvDraw(); - } - - ToaBufferFCU2Sprites(); - - bVBlank = true; - if (bEnableInterrupts) { - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - } - - nCyclesSegment = nNext - SekTotalCycles(); - if (bVBlank || (!CheckSleep(0))) { - SekRun(nCyclesSegment); - } else { - SekIdle(nCyclesSegment); - } - - BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); - } - - nToa1Cycles68KSync = SekTotalCycles(); - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - -// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); - -// ToaBufferFCU2Sprites(); - - SekClose(); - ZetClose(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32* pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029707; - } - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM3812Scan(nAction, pnMin); - - SCAN_VAR(nCyclesDone); - SCAN_VAR(demonwld_hack); - } - - return 0; -} - -// Hack to bypass the missing sub-cpu. All games except the taito -// set check the crc and rather than dealing with that, I'm seperating -// the opcodes and data and just patching the opcodes. -// Taito set patches from MAME 0.36b10. -static void map_hack(INT32 hack_off) -{ - INT32 cpy_off = hack_off & ~0x3ff; - - memcpy (Drv68KROM + 0x40000, Drv68KROM + cpy_off, 0x400); - - hack_off -= cpy_off; - hack_off += 0x40000; - - *((UINT16*)(Drv68KROM + hack_off + 0)) = 0x4e71; - *((UINT16*)(Drv68KROM + hack_off + 8)) = 0x600a; - - SekOpen(0); - SekMapMemory(Drv68KROM + 0x40000, cpy_off, cpy_off + 0x3ff, SM_FETCH); - SekClose(); -} - - -// Demon's World / Horror Story (set 1) - -static struct BurnRomInfo demonwldRomDesc[] = { - { "o16-10.v2", 0x20000, 0xca8194f3, BRF_PRG | BRF_ESS }, // 0 CPU #0 code - { "o16-09.v2", 0x20000, 0x7baea7ba, BRF_PRG | BRF_ESS }, // 1 - - { "rom11.v2", 0x08000, 0xdbe08c85, BRF_PRG | BRF_ESS }, // 2 CPU #1 code - - { "dsp_21.bin", 0x00800, 0x2d135376, BRF_PRG | BRF_ESS }, // 3 MCU code - { "dsp_22.bin", 0x00800, 0x79389a71, BRF_PRG | BRF_ESS }, // 4 - - { "rom05", 0x20000, 0x6506c982, BRF_GRA }, // 5 Tile data - { "rom07", 0x20000, 0xa3a0d993, BRF_GRA }, // 6 - { "rom06", 0x20000, 0x4fc5e5f3, BRF_GRA }, // 7 - { "rom08", 0x20000, 0xeb53ab09, BRF_GRA }, // 8 - - { "rom01", 0x20000, 0x1b3724e9, BRF_GRA }, // 9 - { "rom02", 0x20000, 0x7b20a44d, BRF_GRA }, // 10 - { "rom03", 0x20000, 0x2cacdcd0, BRF_GRA }, // 11 - { "rom04", 0x20000, 0x76fd3201, BRF_GRA }, // 12 - - { "prom12.bpr", 0x00020, 0xbc88cced, BRF_GRA }, // 13 Sprite attribute PROM - { "prom13.bpr", 0x00020, 0xa1e17492, BRF_GRA }, // 14 -}; - -STD_ROM_PICK(demonwld) -STD_ROM_FN(demonwld) - -static INT32 demonwldInit() -{ - INT32 nRet = DrvInit(); - - if (nRet == 0) { - map_hack(0x1430); - } - - return nRet; -} - -struct BurnDriver BurnDrvDemonwld = { - "demonwld", NULL, NULL, NULL, "1990", - "Demon's World / Horror Story (set 1)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TOAPLAN_RAIZING, GBF_PLATFORM, 0, - NULL, demonwldRomInfo, demonwldRomName, NULL, NULL, DemonwldInputInfo, DemonwldDIPInfo, - demonwldInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 320, 240, 4, 3 -}; - - -// Demon's World / Horror Story (Taito license, set 2) - -static struct BurnRomInfo demonwld1RomDesc[] = { - { "o16-10.rom", 0x20000, 0x036ee46c, BRF_PRG | BRF_ESS }, // 0 CPU #0 code - { "o16-09.rom", 0x20000, 0xbed746e3, BRF_PRG | BRF_ESS }, // 1 - - { "rom11", 0x08000, 0x397eca1b, BRF_PRG | BRF_ESS }, // 2 CPU #1 code - - { "dsp_21.bin", 0x00800, 0x2d135376, BRF_PRG | BRF_ESS }, // 3 MCU code - { "dsp_22.bin", 0x00800, 0x79389a71, BRF_PRG | BRF_ESS }, // 4 - - { "rom05", 0x20000, 0x6506c982, BRF_GRA }, // 5 Tile data - { "rom07", 0x20000, 0xa3a0d993, BRF_GRA }, // 6 - { "rom06", 0x20000, 0x4fc5e5f3, BRF_GRA }, // 7 - { "rom08", 0x20000, 0xeb53ab09, BRF_GRA }, // 8 - - { "rom01", 0x20000, 0x1b3724e9, BRF_GRA }, // 9 - { "rom02", 0x20000, 0x7b20a44d, BRF_GRA }, // 10 - { "rom03", 0x20000, 0x2cacdcd0, BRF_GRA }, // 11 - { "rom04", 0x20000, 0x76fd3201, BRF_GRA }, // 12 - - { "prom12.bpr", 0x00020, 0xbc88cced, BRF_GRA }, // 13 Sprite attribute PROM - { "prom13.bpr", 0x00020, 0xa1e17492, BRF_GRA }, // 14 -}; - -STD_ROM_PICK(demonwld1) -STD_ROM_FN(demonwld1) - -static INT32 demonwld1Init() -{ - INT32 nRet = DrvInit(); - - if (nRet == 0) { - map_hack(0x181c); - } - - return nRet; -} - -struct BurnDriver BurnDrvDemonwld1 = { - "demonwld1", "demonwld", NULL, NULL, "1989", - "Demon's World / Horror Story (Taito license, set 2)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_PLATFORM, 0, - NULL, demonwld1RomInfo, demonwld1RomName, NULL, NULL, DemonwldInputInfo, Demonwl1DIPInfo, - demonwld1Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 320, 240, 4, 3 -}; - - -// Demon's World / Horror Story (set 3) - -static struct BurnRomInfo demonwld2RomDesc[] = { - { "o16-10-2.bin", 0x20000, 0x84ee5218, BRF_PRG | BRF_ESS }, // 0 CPU #0 code - { "o16-09-2.bin", 0x20000, 0xcf474cb2, BRF_PRG | BRF_ESS }, // 1 - - { "rom11", 0x08000, 0x397eca1b, BRF_PRG | BRF_ESS }, // 2 CPU #1 code - - { "dsp_21.bin", 0x00800, 0x2d135376, BRF_PRG | BRF_ESS }, // 3 MCU code - { "dsp_22.bin", 0x00800, 0x79389a71, BRF_PRG | BRF_ESS }, // 4 - - { "rom05", 0x20000, 0x6506c982, BRF_GRA }, // 5 Tile data - { "rom07", 0x20000, 0xa3a0d993, BRF_GRA }, // 6 - { "rom06", 0x20000, 0x4fc5e5f3, BRF_GRA }, // 7 - { "rom08", 0x20000, 0xeb53ab09, BRF_GRA }, // 8 - - { "rom01", 0x20000, 0x1b3724e9, BRF_GRA }, // 9 - { "rom02", 0x20000, 0x7b20a44d, BRF_GRA }, // 10 - { "rom03", 0x20000, 0x2cacdcd0, BRF_GRA }, // 11 - { "rom04", 0x20000, 0x76fd3201, BRF_GRA }, // 12 - - { "prom12.bpr", 0x00020, 0xbc88cced, BRF_GRA }, // 13 Sprite attribute PROM - { "prom13.bpr", 0x00020, 0xa1e17492, BRF_GRA }, // 14 -}; - -STD_ROM_PICK(demonwld2) -STD_ROM_FN(demonwld2) - -struct BurnDriver BurnDrvDemonwld2 = { - "demonwld2", "demonwld", NULL, NULL, "1989", - "Demon's World / Horror Story (set 3)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_PLATFORM, 0, - NULL, demonwld2RomInfo, demonwld2RomName, NULL, NULL, DemonwldInputInfo, Demonwl1DIPInfo, - demonwld1Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 320, 240, 4, 3 -}; - - -// Demon's World / Horror Story (set 4) - -static struct BurnRomInfo demonwld3RomDesc[] = { - { "o16-10.bin", 0x20000, 0x6f7468e0, BRF_PRG | BRF_ESS }, // 0 CPU #0 code - { "o16-09.bin", 0x20000, 0xa572f5f7, BRF_PRG | BRF_ESS }, // 1 - - { "rom11", 0x08000, 0x397eca1b, BRF_PRG | BRF_ESS }, // 2 CPU #1 code - - { "dsp_21.bin", 0x00800, 0x2d135376, BRF_PRG | BRF_ESS }, // 3 MCU code - { "dsp_22.bin", 0x00800, 0x79389a71, BRF_PRG | BRF_ESS }, // 4 - - { "rom05", 0x20000, 0x6506c982, BRF_GRA }, // 5 Tile data - { "rom07", 0x20000, 0xa3a0d993, BRF_GRA }, // 6 - { "rom06", 0x20000, 0x4fc5e5f3, BRF_GRA }, // 7 - { "rom08", 0x20000, 0xeb53ab09, BRF_GRA }, // 8 - - { "rom01", 0x20000, 0x1b3724e9, BRF_GRA }, // 9 - { "rom02", 0x20000, 0x7b20a44d, BRF_GRA }, // 10 - { "rom03", 0x20000, 0x2cacdcd0, BRF_GRA }, // 11 - { "rom04", 0x20000, 0x76fd3201, BRF_GRA }, // 12 - - { "prom12.bpr", 0x00020, 0xbc88cced, BRF_GRA }, // 13 Sprite attribute PROM - { "prom13.bpr", 0x00020, 0xa1e17492, BRF_GRA }, // 14 -}; - -STD_ROM_PICK(demonwld3) -STD_ROM_FN(demonwld3) - -static INT32 demonwld3Init() -{ - INT32 nRet = DrvInit(); - - if (nRet == 0) { - map_hack(0x1828); - } - - return nRet; -} - -struct BurnDriver BurnDrvDemonwld3 = { - "demonwld3", "demonwld", NULL, NULL, "1989", - "Demon's World / Horror Story (set 4)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_PLATFORM, 0, - NULL, demonwld3RomInfo, demonwld3RomName, NULL, NULL, DemonwldInputInfo, Demonwl1DIPInfo, - demonwld3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 320, 240, 4, 3 -}; +#include "toaplan.h" + +#define REFRESHRATE 60 +#define VBLANK_LINES (32) + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvPalRAM; +static UINT8 *DrvPalRAM2; +static UINT8 *DrvShareRAM; + +static UINT8 DrvInputs[3]; +static UINT8 DrvDips[3]; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvReset; + +static INT32 nColCount = 0x0800; + +static UINT8 bDrawScreen; +static bool bVBlank; + +static bool bEnableInterrupts; + +static bool bUseAsm68KCoreOldValue = false; +static INT32 demonwld_hack; + +static struct BurnInputInfo DemonwldInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 5, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 6, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 1, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Demonwld) + +static struct BurnDIPInfo DemonwldDIPList[]= +{ + {0x15, 0xff, 0xff, 0x00, NULL }, + {0x16, 0xff, 0xff, 0x00, NULL }, + {0x17, 0xff, 0xff, 0x01, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x02, 0x00, "Off" }, + {0x15, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x08, "Off" }, + {0x15, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x15, 0x01, 0x30, 0x30, "4 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x20, "3 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x03, 0x01, "Easy" }, + {0x16, 0x01, 0x03, 0x00, "Medium" }, + {0x16, 0x01, 0x03, 0x02, "Hard" }, + {0x16, 0x01, 0x03, 0x03, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x00, "30K, every 100K" }, + {0x16, 0x01, 0x0c, 0x04, "50K and 100K" }, + {0x16, 0x01, 0x0c, 0x08, "100K only" }, + {0x16, 0x01, 0x0c, 0x0c, "None" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x30, 0x30, "1" }, + {0x16, 0x01, 0x30, 0x20, "2" }, + {0x16, 0x01, 0x30, 0x00, "3" }, + {0x16, 0x01, 0x30, 0x10, "5" }, + + {0 , 0xfe, 0 , 2, "Invulnerability" }, + {0x16, 0x01, 0x40, 0x00, "Off" }, + {0x16, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Unused" }, + {0x16, 0x01, 0x80, 0x00, "Off" }, + {0x16, 0x01, 0x80, 0x80, "On" }, + + {0 , 0xfe, 0 , 2, "Territory/Copyright" }, + {0x17, 0x01, 0x01, 0x01, "Toaplan" }, + {0x17, 0x01, 0x01, 0x00, "Japan/Taito Corp" }, +}; + +STDDIPINFO(Demonwld) + +static struct BurnDIPInfo Demonwl1DIPList[]= +{ + {0x15, 0xff, 0xff, 0x00, NULL }, + {0x16, 0xff, 0xff, 0x00, NULL }, + {0x17, 0xff, 0xff, 0x02, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x15, 0x01, 0x02, 0x00, "Off" }, + {0x15, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x15, 0x01, 0x08, 0x08, "Off" }, + {0x15, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x15, 0x01, 0x30, 0x30, "4 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x20, "3 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x15, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x15, 0x01, 0xc0, 0x00, "1 Coin 2 Credits" }, + {0x15, 0x01, 0xc0, 0x40, "1 Coin 3 Credits" }, + {0x15, 0x01, 0xc0, 0x80, "1 Coin 4 Credits" }, + {0x15, 0x01, 0xc0, 0xc0, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x16, 0x01, 0x03, 0x01, "Easy" }, + {0x16, 0x01, 0x03, 0x00, "Medium" }, + {0x16, 0x01, 0x03, 0x02, "Hard" }, + {0x16, 0x01, 0x03, 0x03, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x16, 0x01, 0x0c, 0x00, "30K, every 100K" }, + {0x16, 0x01, 0x0c, 0x04, "50K and 100K" }, + {0x16, 0x01, 0x0c, 0x08, "100K only" }, + {0x16, 0x01, 0x0c, 0x0c, "None" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x16, 0x01, 0x30, 0x30, "1" }, + {0x16, 0x01, 0x30, 0x20, "2" }, + {0x16, 0x01, 0x30, 0x00, "3" }, + {0x16, 0x01, 0x30, 0x10, "5" }, + + {0 , 0xfe, 0 , 2, "Invulnerability" }, + {0x16, 0x01, 0x40, 0x00, "Off" }, + {0x16, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Unused" }, + {0x16, 0x01, 0x80, 0x00, "Off" }, + {0x16, 0x01, 0x80, 0x80, "On" }, + + {0 , 0xfe, 0 , 4, "Territory/Copyright" }, + {0x17, 0x01, 0x03, 0x02, "World/Taito Japan" }, + {0x17, 0x01, 0x03, 0x03, "US/Toaplan" }, + {0x17, 0x01, 0x03, 0x01, "US/Taito America" }, + {0x17, 0x01, 0x03, 0x00, "Japan/Taito Corp" }, +}; + +STDDIPINFO(Demonwl1) + +void __fastcall demonwldWriteWord(UINT32 a, UINT16 d) +{ + switch (a) + { + case 0x400000: + return; // nop + + case 0x400002: + bEnableInterrupts = d & 0xff; + return; + + case 0x400008: + case 0x40000a: + case 0x40000c: + case 0x40000e: + // toaplan1_bcu_control_w + return; + + case 0x800000: + // toaplan1_bcu_flipscreen_w + return; + + case 0x800002: + ToaBCU2SetRAMPointer(d); + return; + + case 0x800004: + case 0x800006: + ToaBCU2WriteRAM(d); + return; + + case 0x800010: + case 0x800012: + case 0x800014: + case 0x800016: + case 0x800018: + case 0x80001a: + case 0x80001c: + case 0x80001e: + BCU2Reg[(a & 0x0f) >> 1] = d; + return; + + case 0xa00000: + return; // nop + + case 0xa00002: + ToaFCU2SetRAMPointer(d); + return; + + case 0xa00004: + ToaFCU2WriteRAM(d); + return; + + case 0xa00006: + ToaFCU2WriteRAMSize(d); + return; + + case 0xe00000: + nBCU2TileXOffset = d; + return; + + case 0xe00002: + nBCU2TileYOffset = d; + return; + + case 0xe00006: + // toaplan1_fcu_flipscreen_w + return; + + case 0xe00008: + if (d == 0) { + ZetReset(); + } + return; + + case 0xe0000a: + // dsp_ctrl_w + return; + } +} + +void __fastcall demonwldWriteByte(UINT32 , UINT8 ) +{ + return; +} + +UINT16 __fastcall demonwldReadWord(UINT32 a) +{ + switch (a) + { + case 0x800002: + return ToaBCU2GetRAMPointer(); + + case 0x800004: + return ToaBCU2ReadRAM_Hi(); + + case 0x800006: + return ToaBCU2ReadRAM_Lo(); + + case 0x800010: + case 0x800012: + case 0x800014: + case 0x800016: + case 0x800018: + case 0x80001a: + case 0x80001c: + case 0x80001e: + return BCU2Reg[(a & 0x0f) >> 1]; + + case 0xa00002: + return ToaFCU2GetRAMPointer(); + + case 0xa00004: + return ToaFCU2ReadRAM(); + + case 0xa00006: + return ToaFCU2ReadRAMSize(); + + case 0xe0000e: // hack + { + demonwld_hack++; + if (demonwld_hack & 4) + return 0x76; + else + return 0; + } + } + + return 0; +} + +UINT8 __fastcall demonwldReadByte(UINT32 a) +{ + switch (a) + { + case 0x400001: + case 0xa00001: + return ToaVBlankRegister(); + } + + return 0; +} + +void __fastcall demonwld_sound_write_port(UINT16 p, UINT8 d) +{ + switch (p & 0xff) + { + case 0x00: { + BurnYM3812Write(0, d); + return; + } + + case 0x01: { + BurnYM3812Write(1, d); + return; + } + + case 0x40: // toaplan1_coin_w + return; + } +} + +UINT8 __fastcall demonwld_sound_read_port(UINT16 p) +{ + switch (p & 0xff) + { + case 0x00: + case 0x01: + return BurnYM3812Read(p & 1); + + case 0x20: + return DrvDips[2]; + + case 0x60: + return DrvInputs[2]; + + case 0x80: + return DrvInputs[0]; + + case 0xa0: + return DrvDips[1]; + + case 0xc0: + return DrvInputs[1]; + + case 0xe0: + return DrvDips[0]; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + + bEnableInterrupts = false; + demonwld_hack = 0; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x040000 + 0x400; + DrvZ80ROM = Next; Next += 0x010000; + BCU2ROM = Next; Next += nBCU2ROMSize; + FCU2ROM = Next; Next += nFCU2ROMSize; + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x004000; + DrvPalRAM = Next; Next += 0x000800; + DrvPalRAM2 = Next; Next += 0x000800; + + RamZ80 = Next; + DrvShareRAM = Next; Next += 0x008000; + + BCU2RAM = Next; Next += 0x010000; + FCU2RAM = Next; Next += 0x000800; + FCU2RAMSize = Next; Next += 0x000080; + + RamEnd = Next; + + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static INT32 DrvInit() +{ + if (bBurnUseASMCPUEmulation) { + bUseAsm68KCoreOldValue = bBurnUseASMCPUEmulation; + bBurnUseASMCPUEmulation = false; + } + + INT32 nLen; + +// bToaRotateScreen = true; + + BurnSetRefreshRate(REFRESHRATE); + + nBCU2ROMSize = 0x080000; + nFCU2ROMSize = 0x080000; + + // Find out how much memory is needed + AllMem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(AllMem, 0, nLen); + MemIndex(); + + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1; + + ToaLoadTiles(BCU2ROM, 5, nBCU2ROMSize); + ToaLoadTiles(FCU2ROM, 9, nFCU2ROMSize); + + { + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x03FFFF, SM_ROM); + SekMapMemory(DrvPalRAM, 0x404000, 0x4047FF, SM_RAM); + SekMapMemory(DrvPalRAM2, 0x406000, 0x4067FF, SM_RAM); + SekMapMemory(Drv68KRAM, 0xc00000, 0xc03FFF, SM_RAM); + SekSetReadWordHandler(0, demonwldReadWord); + SekSetReadByteHandler(0, demonwldReadByte); + SekSetWriteWordHandler(0, demonwldWriteWord); + SekSetWriteByteHandler(0, demonwldWriteByte); + + SekMapHandler(1, 0x600000, 0x600FFF, SM_RAM); + SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); + SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); + SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); + SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0xffff, 0, DrvShareRAM); + ZetMapArea(0x8000, 0xffff, 1, DrvShareRAM); + ZetMapArea(0x8000, 0xffff, 2, DrvShareRAM); + ZetSetOutHandler(demonwld_sound_write_port); + ZetSetInHandler(demonwld_sound_read_port); + ZetClose(); + } + + ToaInitBCU2(); + + nToaPalLen = nColCount; + ToaPalSrc = DrvPalRAM; + ToaPalSrc2 = DrvPalRAM2; + ToaPalInit(); + + ToaOpaquePriority = 2; + + BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); + BurnTimerAttachZetYM3812(28000000 / 8); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); + return 0; +} + +static INT32 DrvExit() +{ + BurnYM3812Exit(); + ToaPalExit(); + + ToaExitBCU2(); + ToaZExit(); + SekExit(); + + BurnFree(AllMem); + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0x120); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderBCU2(); + } + + ToaPalUpdate(); + ToaPal2Update(); + + if (bUseAsm68KCoreOldValue) { + bUseAsm68KCoreOldValue = false; + bBurnUseASMCPUEmulation = true; + } + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 4; + + if (DrvReset) { + DrvDoReset(); + } + + memset (DrvInputs, 0, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] |= (DrvJoy1[i] & 1) << i; + DrvInputs[1] |= (DrvJoy2[i] & 1) << i; + DrvInputs[2] |= (DrvJoy3[i] & 1) << i; + } + ToaClearOpposites(&DrvInputs[0]); + ToaClearOpposites(&DrvInputs[1]); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); + nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext; + + // Run 68000 + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + + // Trigger VBlank interrupt + if (nNext > nToaCyclesVBlankStart) { + if (SekTotalCycles() < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); + SekRun(nCyclesSegment); + } + + if (pBurnDraw) { + DrvDraw(); + } + + ToaBufferFCU2Sprites(); + + bVBlank = true; + if (bEnableInterrupts) { + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + } + + nCyclesSegment = nNext - SekTotalCycles(); + if (bVBlank || (!CheckSleep(0))) { + SekRun(nCyclesSegment); + } else { + SekIdle(nCyclesSegment); + } + + BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); + } + + nToa1Cycles68KSync = SekTotalCycles(); + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + +// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); + +// ToaBufferFCU2Sprites(); + + SekClose(); + ZetClose(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32* pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029707; + } + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM3812Scan(nAction, pnMin); + + SCAN_VAR(nCyclesDone); + SCAN_VAR(demonwld_hack); + } + + return 0; +} + +// Hack to bypass the missing sub-cpu. All games except the taito +// set check the crc and rather than dealing with that, I'm seperating +// the opcodes and data and just patching the opcodes. +// Taito set patches from MAME 0.36b10. +static void map_hack(INT32 hack_off) +{ + INT32 cpy_off = hack_off & ~0x3ff; + + memcpy (Drv68KROM + 0x40000, Drv68KROM + cpy_off, 0x400); + + hack_off -= cpy_off; + hack_off += 0x40000; + + *((UINT16*)(Drv68KROM + hack_off + 0)) = 0x4e71; + *((UINT16*)(Drv68KROM + hack_off + 8)) = 0x600a; + + SekOpen(0); + SekMapMemory(Drv68KROM + 0x40000, cpy_off, cpy_off + 0x3ff, SM_FETCH); + SekClose(); +} + + +// Demon's World / Horror Story (set 1) + +static struct BurnRomInfo demonwldRomDesc[] = { + { "o16-10.v2", 0x20000, 0xca8194f3, BRF_PRG | BRF_ESS }, // 0 CPU #0 code + { "o16-09.v2", 0x20000, 0x7baea7ba, BRF_PRG | BRF_ESS }, // 1 + + { "rom11.v2", 0x08000, 0xdbe08c85, BRF_PRG | BRF_ESS }, // 2 CPU #1 code + + { "dsp_21.bin", 0x00800, 0x2d135376, BRF_PRG | BRF_ESS }, // 3 MCU code + { "dsp_22.bin", 0x00800, 0x79389a71, BRF_PRG | BRF_ESS }, // 4 + + { "rom05", 0x20000, 0x6506c982, BRF_GRA }, // 5 Tile data + { "rom07", 0x20000, 0xa3a0d993, BRF_GRA }, // 6 + { "rom06", 0x20000, 0x4fc5e5f3, BRF_GRA }, // 7 + { "rom08", 0x20000, 0xeb53ab09, BRF_GRA }, // 8 + + { "rom01", 0x20000, 0x1b3724e9, BRF_GRA }, // 9 + { "rom02", 0x20000, 0x7b20a44d, BRF_GRA }, // 10 + { "rom03", 0x20000, 0x2cacdcd0, BRF_GRA }, // 11 + { "rom04", 0x20000, 0x76fd3201, BRF_GRA }, // 12 + + { "prom12.bpr", 0x00020, 0xbc88cced, BRF_GRA }, // 13 Sprite attribute PROM + { "prom13.bpr", 0x00020, 0xa1e17492, BRF_GRA }, // 14 +}; + +STD_ROM_PICK(demonwld) +STD_ROM_FN(demonwld) + +static INT32 demonwldInit() +{ + INT32 nRet = DrvInit(); + + if (nRet == 0) { + map_hack(0x1430); + } + + return nRet; +} + +struct BurnDriver BurnDrvDemonwld = { + "demonwld", NULL, NULL, NULL, "1990", + "Demon's World / Horror Story (set 1)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TOAPLAN_RAIZING, GBF_PLATFORM, 0, + NULL, demonwldRomInfo, demonwldRomName, NULL, NULL, DemonwldInputInfo, DemonwldDIPInfo, + demonwldInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 320, 240, 4, 3 +}; + + +// Demon's World / Horror Story (Taito license, set 2) + +static struct BurnRomInfo demonwld1RomDesc[] = { + { "o16-10.rom", 0x20000, 0x036ee46c, BRF_PRG | BRF_ESS }, // 0 CPU #0 code + { "o16-09.rom", 0x20000, 0xbed746e3, BRF_PRG | BRF_ESS }, // 1 + + { "rom11", 0x08000, 0x397eca1b, BRF_PRG | BRF_ESS }, // 2 CPU #1 code + + { "dsp_21.bin", 0x00800, 0x2d135376, BRF_PRG | BRF_ESS }, // 3 MCU code + { "dsp_22.bin", 0x00800, 0x79389a71, BRF_PRG | BRF_ESS }, // 4 + + { "rom05", 0x20000, 0x6506c982, BRF_GRA }, // 5 Tile data + { "rom07", 0x20000, 0xa3a0d993, BRF_GRA }, // 6 + { "rom06", 0x20000, 0x4fc5e5f3, BRF_GRA }, // 7 + { "rom08", 0x20000, 0xeb53ab09, BRF_GRA }, // 8 + + { "rom01", 0x20000, 0x1b3724e9, BRF_GRA }, // 9 + { "rom02", 0x20000, 0x7b20a44d, BRF_GRA }, // 10 + { "rom03", 0x20000, 0x2cacdcd0, BRF_GRA }, // 11 + { "rom04", 0x20000, 0x76fd3201, BRF_GRA }, // 12 + + { "prom12.bpr", 0x00020, 0xbc88cced, BRF_GRA }, // 13 Sprite attribute PROM + { "prom13.bpr", 0x00020, 0xa1e17492, BRF_GRA }, // 14 +}; + +STD_ROM_PICK(demonwld1) +STD_ROM_FN(demonwld1) + +static INT32 demonwld1Init() +{ + INT32 nRet = DrvInit(); + + if (nRet == 0) { + map_hack(0x181c); + } + + return nRet; +} + +struct BurnDriver BurnDrvDemonwld1 = { + "demonwld1", "demonwld", NULL, NULL, "1989", + "Demon's World / Horror Story (Taito license, set 2)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_PLATFORM, 0, + NULL, demonwld1RomInfo, demonwld1RomName, NULL, NULL, DemonwldInputInfo, Demonwl1DIPInfo, + demonwld1Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 320, 240, 4, 3 +}; + + +// Demon's World / Horror Story (set 3) + +static struct BurnRomInfo demonwld2RomDesc[] = { + { "o16-10-2.bin", 0x20000, 0x84ee5218, BRF_PRG | BRF_ESS }, // 0 CPU #0 code + { "o16-09-2.bin", 0x20000, 0xcf474cb2, BRF_PRG | BRF_ESS }, // 1 + + { "rom11", 0x08000, 0x397eca1b, BRF_PRG | BRF_ESS }, // 2 CPU #1 code + + { "dsp_21.bin", 0x00800, 0x2d135376, BRF_PRG | BRF_ESS }, // 3 MCU code + { "dsp_22.bin", 0x00800, 0x79389a71, BRF_PRG | BRF_ESS }, // 4 + + { "rom05", 0x20000, 0x6506c982, BRF_GRA }, // 5 Tile data + { "rom07", 0x20000, 0xa3a0d993, BRF_GRA }, // 6 + { "rom06", 0x20000, 0x4fc5e5f3, BRF_GRA }, // 7 + { "rom08", 0x20000, 0xeb53ab09, BRF_GRA }, // 8 + + { "rom01", 0x20000, 0x1b3724e9, BRF_GRA }, // 9 + { "rom02", 0x20000, 0x7b20a44d, BRF_GRA }, // 10 + { "rom03", 0x20000, 0x2cacdcd0, BRF_GRA }, // 11 + { "rom04", 0x20000, 0x76fd3201, BRF_GRA }, // 12 + + { "prom12.bpr", 0x00020, 0xbc88cced, BRF_GRA }, // 13 Sprite attribute PROM + { "prom13.bpr", 0x00020, 0xa1e17492, BRF_GRA }, // 14 +}; + +STD_ROM_PICK(demonwld2) +STD_ROM_FN(demonwld2) + +struct BurnDriver BurnDrvDemonwld2 = { + "demonwld2", "demonwld", NULL, NULL, "1989", + "Demon's World / Horror Story (set 3)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_PLATFORM, 0, + NULL, demonwld2RomInfo, demonwld2RomName, NULL, NULL, DemonwldInputInfo, Demonwl1DIPInfo, + demonwld1Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 320, 240, 4, 3 +}; + + +// Demon's World / Horror Story (set 4) + +static struct BurnRomInfo demonwld3RomDesc[] = { + { "o16-10.bin", 0x20000, 0x6f7468e0, BRF_PRG | BRF_ESS }, // 0 CPU #0 code + { "o16-09.bin", 0x20000, 0xa572f5f7, BRF_PRG | BRF_ESS }, // 1 + + { "rom11", 0x08000, 0x397eca1b, BRF_PRG | BRF_ESS }, // 2 CPU #1 code + + { "dsp_21.bin", 0x00800, 0x2d135376, BRF_PRG | BRF_ESS }, // 3 MCU code + { "dsp_22.bin", 0x00800, 0x79389a71, BRF_PRG | BRF_ESS }, // 4 + + { "rom05", 0x20000, 0x6506c982, BRF_GRA }, // 5 Tile data + { "rom07", 0x20000, 0xa3a0d993, BRF_GRA }, // 6 + { "rom06", 0x20000, 0x4fc5e5f3, BRF_GRA }, // 7 + { "rom08", 0x20000, 0xeb53ab09, BRF_GRA }, // 8 + + { "rom01", 0x20000, 0x1b3724e9, BRF_GRA }, // 9 + { "rom02", 0x20000, 0x7b20a44d, BRF_GRA }, // 10 + { "rom03", 0x20000, 0x2cacdcd0, BRF_GRA }, // 11 + { "rom04", 0x20000, 0x76fd3201, BRF_GRA }, // 12 + + { "prom12.bpr", 0x00020, 0xbc88cced, BRF_GRA }, // 13 Sprite attribute PROM + { "prom13.bpr", 0x00020, 0xa1e17492, BRF_GRA }, // 14 +}; + +STD_ROM_PICK(demonwld3) +STD_ROM_FN(demonwld3) + +static INT32 demonwld3Init() +{ + INT32 nRet = DrvInit(); + + if (nRet == 0) { + map_hack(0x1828); + } + + return nRet; +} + +struct BurnDriver BurnDrvDemonwld3 = { + "demonwld3", "demonwld", NULL, NULL, "1989", + "Demon's World / Horror Story (set 4)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_PLATFORM, 0, + NULL, demonwld3RomInfo, demonwld3RomName, NULL, NULL, DemonwldInputInfo, Demonwl1DIPInfo, + demonwld3Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/toaplan/d_hellfire.cpp b/src/burn/drv/toaplan/d_hellfire.cpp index 0af0a79d4..0996fa8de 100644 --- a/src/burn/drv/toaplan/d_hellfire.cpp +++ b/src/burn/drv/toaplan/d_hellfire.cpp @@ -1,827 +1,826 @@ -// Hell Fire - -#include "toaplan.h" - -#define REFRESHRATE 60 -#define VBLANK_LINES (32) - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static bool bEnableInterrupts; - -// Rom information -static struct BurnRomInfo hellfireRomDesc[] = { - { "b90_14.0", 0x020000, 0x101df9f5, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "b90_15.1", 0x020000, 0xe67fd452, BRF_ESS | BRF_PRG }, // 1 - - { "b90_04.3", 0x020000, 0xea6150fc, BRF_GRA }, // 6 - { "b90_05.4", 0x020000, 0xbb52c507, BRF_GRA }, // 7 - { "b90_06.5", 0x020000, 0xcf5b0252, BRF_GRA }, // 8 - { "b90_07.6", 0x020000, 0xb98af263, BRF_GRA }, // 9 - - { "b90_11.10", 0x020000, 0xc33e543c, BRF_GRA }, // 2 - { "b90_10.9", 0x020000, 0x35fd1092, BRF_GRA }, // 3 - { "b90_09.8", 0x020000, 0xcf01009e, BRF_GRA }, // 4 - { "b90_08.7", 0x020000, 0x3404a5e3, BRF_GRA }, // 5 - - { "b90_03.2", 0x008000, 0x4058fa67, BRF_ESS | BRF_PRG }, // 10 Z80 program - - { "13.3w", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM - { "12.6b", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? -}; - -STD_ROM_PICK(hellfire) -STD_ROM_FN(hellfire) - -static struct BurnRomInfo hellfir1RomDesc[] = { - { "b90_14x.0", 0x020000, 0xa3141ea5, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "b90_15x.1", 0x020000, 0xe864daf4, BRF_ESS | BRF_PRG }, // 1 - - { "b90_04.3", 0x020000, 0xea6150fc, BRF_GRA }, // 6 - { "b90_05.4", 0x020000, 0xbb52c507, BRF_GRA }, // 7 - { "b90_06.5", 0x020000, 0xcf5b0252, BRF_GRA }, // 8 - { "b90_07.6", 0x020000, 0xb98af263, BRF_GRA }, // 9 - - { "b90_11.10", 0x020000, 0xc33e543c, BRF_GRA }, // 2 - { "b90_10.9", 0x020000, 0x35fd1092, BRF_GRA }, // 3 - { "b90_09.8", 0x020000, 0xcf01009e, BRF_GRA }, // 4 - { "b90_08.7", 0x020000, 0x3404a5e3, BRF_GRA }, // 5 - - { "b90_03x.2", 0x008000, 0xf58c368f, BRF_ESS | BRF_PRG }, // 10 Z80 program - - { "13.3w", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM - { "12.6b", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? -}; - -STD_ROM_PICK(hellfir1) -STD_ROM_FN(hellfir1) - -static struct BurnRomInfo hellfir2RomDesc[] = { - { "b90_01.0", 0x020000, 0xc94acf53, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "b90_02.1", 0x020000, 0xd17f03c3, BRF_ESS | BRF_PRG }, // 1 - - { "b90_04.3", 0x020000, 0xea6150fc, BRF_GRA }, // 6 - { "b90_05.4", 0x020000, 0xbb52c507, BRF_GRA }, // 7 - { "b90_06.5", 0x020000, 0xcf5b0252, BRF_GRA }, // 8 - { "b90_07.6", 0x020000, 0xb98af263, BRF_GRA }, // 9 - - { "b90_11.10", 0x020000, 0xc33e543c, BRF_GRA }, // 2 - { "b90_10.9", 0x020000, 0x35fd1092, BRF_GRA }, // 3 - { "b90_09.8", 0x020000, 0xcf01009e, BRF_GRA }, // 4 - { "b90_08.7", 0x020000, 0x3404a5e3, BRF_GRA }, // 5 - - { "b90_03x.2", 0x008000, 0xf58c368f, BRF_ESS | BRF_PRG }, // 10 Z80 program - - { "13.3w", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM - { "12.6b", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? -}; - -STD_ROM_PICK(hellfir2) -STD_ROM_FN(hellfir2) - -static struct BurnRomInfo hellfir3RomDesc[] = { - { "b90_01.10m", 0x020000, 0x034966d3, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "b90_02.9m", 0x020000, 0x06dd24c7, BRF_ESS | BRF_PRG }, // 1 - - { "b90_04.3", 0x020000, 0xea6150fc, BRF_GRA }, // 6 - { "b90_05.4", 0x020000, 0xbb52c507, BRF_GRA }, // 7 - { "b90_06.5", 0x020000, 0xcf5b0252, BRF_GRA }, // 8 - { "b90_07.6", 0x020000, 0xb98af263, BRF_GRA }, // 9 - - { "b90_11.10", 0x020000, 0xc33e543c, BRF_GRA }, // 2 - { "b90_10.9", 0x020000, 0x35fd1092, BRF_GRA }, // 3 - { "b90_09.8", 0x020000, 0xcf01009e, BRF_GRA }, // 4 - { "b90_08.7", 0x020000, 0x3404a5e3, BRF_GRA }, // 5 - - { "b90_03.2", 0x008000, 0x4058fa67, BRF_ESS | BRF_PRG }, // 10 Z80 program - - { "13.3w", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM - { "12.6b", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? -}; - -STD_ROM_PICK(hellfir3) -STD_ROM_FN(hellfir3) - -static struct BurnInputInfo hellfireInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 2, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, -}; - -STDINPUTINFO(hellfire) - -static struct BurnDIPInfo hellfireDIPList[] = { - // Defaults - {0x12, 0xFF, 0xFF, 0x00, NULL}, - {0x13, 0xFF, 0xFF, 0x00, NULL}, - {0x14, 0xFF, 0xFF, 0x02, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x02, 0x00, "Normal screen"}, - {0x12, 0x01, 0x02, 0x02, "Invert screen"}, - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x04, 0x00, "Normal mode"}, - {0x12, 0x01, 0x04, 0x04, "Screen test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x12, 0x01, 0x08, 0x00, "On"}, - {0x12, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, - {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x12, 0x01, 0x30, 0x10, "2 coin 1 play"}, - {0x12, 0x01, 0x30, 0x20, "3 coin 1 play"}, - {0x12, 0x01, 0x30, 0x30, "4 coin 1 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x12, 0x01, 0xC0, 0x00, "1 coin 2 play"}, - {0x12, 0x01, 0xC0, 0x40, "1 coin 3 play"}, - {0x12, 0x01, 0xC0, 0x80, "1 coin 4 play"}, - {0x12, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, - - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x13, 0x01, 0x03, 0x00, "B"}, - {0x13, 0x01, 0x03, 0x01, "A"}, - {0x13, 0x01, 0x03, 0x02, "C"}, - {0x13, 0x01, 0x03, 0x03, "D"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x13, 0x01, 0x0C, 0x00, "70000, every 200000"}, - {0x13, 0x01, 0x0C, 0x04, "100000, every 250000"}, - {0x13, 0x01, 0x0C, 0x08, "100000 only"}, - {0x13, 0x01, 0x0C, 0x0C, "200000 only"}, - {0, 0xFE, 0, 4, "Hero counts"}, - {0x13, 0x01, 0x30, 0x30, "2"}, - {0x13, 0x01, 0x30, 0x00, "3"}, - {0x13, 0x01, 0x30, 0x20, "4"}, - {0x13, 0x01, 0x30, 0x10, "5"}, - {0, 0xFE, 0, 2, NULL}, - {0x13, 0x01, 0x40, 0x00, "Normal Game"}, - {0x13, 0x01, 0x40, 0x40, "No death & stop mode"}, - - // Region - {0, 0xFE, 0, 3, "Region"}, - {0x14, 0x01, 0x03, 0x00, "Japan"}, - {0x14, 0x01, 0x03, 0x01, "US"}, - {0x14, 0x01, 0x03, 0x02, "Europe"}, -}; - -STDDIPINFO(hellfire) - -static struct BurnDIPInfo hellfir1DIPList[] = { - // Defaults - {0x12, 0xFF, 0xFF, 0x01, NULL}, - {0x13, 0xFF, 0xFF, 0x00, NULL}, - {0x14, 0xFF, 0xFF, 0x02, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x01, 0x01, "Upright"}, - {0x12, 0x01, 0x01, 0x00, "Cocktail"}, - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x02, 0x00, "Normal screen"}, - {0x12, 0x01, 0x02, 0x02, "Invert screen"}, - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x04, 0x00, "Normal mode"}, - {0x12, 0x01, 0x04, 0x04, "Screen test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x12, 0x01, 0x08, 0x00, "On"}, - {0x12, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, - {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x12, 0x01, 0x30, 0x10, "2 coin 1 play"}, - {0x12, 0x01, 0x30, 0x20, "3 coin 1 play"}, - {0x12, 0x01, 0x30, 0x30, "4 coin 1 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x12, 0x01, 0xC0, 0x00, "1 coin 2 play"}, - {0x12, 0x01, 0xC0, 0x40, "1 coin 3 play"}, - {0x12, 0x01, 0xC0, 0x80, "1 coin 4 play"}, - {0x12, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, - - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x13, 0x01, 0x03, 0x00, "B"}, - {0x13, 0x01, 0x03, 0x01, "A"}, - {0x13, 0x01, 0x03, 0x02, "C"}, - {0x13, 0x01, 0x03, 0x03, "D"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x13, 0x01, 0x0C, 0x00, "70000, every 200000"}, - {0x13, 0x01, 0x0C, 0x04, "100000, every 250000"}, - {0x13, 0x01, 0x0C, 0x08, "100000 only"}, - {0x13, 0x01, 0x0C, 0x0C, "200000 only"}, - {0, 0xFE, 0, 4, "Hero counts"}, - {0x13, 0x01, 0x30, 0x30, "2"}, - {0x13, 0x01, 0x30, 0x00, "3"}, - {0x13, 0x01, 0x30, 0x20, "4"}, - {0x13, 0x01, 0x30, 0x10, "5"}, - {0, 0xFE, 0, 2, NULL}, - {0x13, 0x01, 0x40, 0x00, "Normal Game"}, - {0x13, 0x01, 0x40, 0x40, "No death & stop mode"}, - {0, 0xFE, 0, 2, "Allow Continue"}, - {0x13, 0x01, 0x80, 0x00, "Yes"}, - {0x13, 0x01, 0x80, 0x80, "No"}, - - // Region - {0, 0xFE, 0, 3, "Region"}, - {0x14, 0x01, 0x03, 0x00, "Japan"}, - {0x14, 0x01, 0x03, 0x01, "US"}, - {0x14, 0x01, 0x03, 0x02, "Europe"}, -}; - -STDDIPINFO(hellfir1) - -static INT32 __fastcall DrvResetCallback() -{ - // Reset instruction on 68000 - - ZetReset(); // Reset Z80 (CPU #1) - BurnYM3812Reset(); - return 0; -} - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *Ram01, *RamPal, *RamPal2; - -static INT32 nColCount = 0x0400; - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x040000; // - RomZ80 = Next; Next += 0x008000; // Z80 ROM - BCU2ROM = Next; Next += nBCU2ROMSize; // BCU-2 tile data - FCU2ROM = Next; Next += nFCU2ROMSize; // FCU-2 tile data - RamStart = Next; - Ram01 = Next; Next += 0x008000; // CPU #0 work RAM - RamPal = Next; Next += 0x001000; // palette - RamPal2 = Next; Next += 0x001000; // palette - RamZ80 = Next; Next += 0x008000; // Z80 RAM - BCU2RAM = Next; Next += 0x010000; - FCU2RAM = Next; Next += 0x000800; - FCU2RAMSize = Next; Next += 0x000080; - RamEnd = Next; - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32* pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029402; - } - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); // scan 68000 states - ZetScan(nAction); // Scan Z80 - - BurnYM3812Scan(nAction, pnMin); - - SCAN_VAR(DrvInput); - SCAN_VAR(nCyclesDone); - } - - return 0; -} - -static INT32 LoadRoms() -{ - // Load 68000 ROM - ToaLoadCode(Rom01, 0, 2); - - // Load BCU-2 tile data - ToaLoadTiles(BCU2ROM, 2, nBCU2ROMSize); - - // Load FCU-2 tile data - ToaLoadTiles(FCU2ROM, 6, nFCU2ROMSize); - - // Load the Z80 ROM - BurnLoadRom(RomZ80, 10, 1); - - return 0; -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall hellfireZ80In(UINT16 nAddress) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x70: - return BurnYM3812Read(0); - case 0x00: // DIP A - return DrvInput[2]; - case 0x10: // DIP B - return DrvInput[3]; - case 0x60: // Sysytem inputs - return DrvInput[4] | (ToaVBlankRegister() << 7); - case 0x40: // Player 1 - return DrvInput[0]; - case 0x50: // Player 2 - return DrvInput[1]; - case 0x20: // Region - return DrvInput[5]; - - } - -// bprintf(PRINT_NORMAL, _T("z80 read %4X\n"), nAddress); - - return 0; -} - -void __fastcall hellfireZ80Out(UINT16 nAddress, UINT8 nValue) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x70: - BurnYM3812Write(0, nValue); - break; - case 0x71: - BurnYM3812Write(1, nValue); - break; - - case 0x30: // Coin counter - break; - -// default: -// bprintf(PRINT_NORMAL, _T("Z80 attempted to write address %04X with value %02X.\n"), nAddress, nValue); - } -} - -static INT32 DrvZ80Init() -{ - // Init the Z80 - ZetInit(0); - ZetOpen(0); - - ZetSetInHandler(hellfireZ80In); - ZetSetOutHandler(hellfireZ80Out); - - // ROM - ZetMapArea (0x0000, 0x7FFF, 0, RomZ80); // Direct Read from ROM - ZetMapArea (0x0000, 0x7FFF, 2, RomZ80); // Direct Fetch from ROM - // RAM - ZetMapArea (0x8000, 0xFFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0x8000, 0xFFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0x8000, 0xFFFF, 2, RamZ80); // - - ZetMemEnd(); - - ZetClose(); - - return 0; -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall hellfireReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x080001: - case 0x140001: - return ToaVBlankRegister(); - - default: { -// bprintf(PRINT_NORMAL, _T("Read Byte %06X.\n"), sekAddress); - } - } - - return 0; -} - -UINT16 __fastcall hellfireReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x140002: - return ToaFCU2GetRAMPointer(); - case 0x140004: - return ToaFCU2ReadRAM(); - case 0x140006: - return ToaFCU2ReadRAMSize(); - - case 0x100002: - return ToaBCU2GetRAMPointer(); - case 0x100004: - return ToaBCU2ReadRAM_Hi(); - case 0x100006: - return ToaBCU2ReadRAM_Lo(); - - case 0x100010: - case 0x100011: - case 0x100012: - case 0x100013: - case 0x100014: - case 0x100015: - case 0x100016: - case 0x100017: - case 0x100018: - case 0x100019: - case 0x10001A: - case 0x10001B: - case 0x10001C: - case 0x10001D: - case 0x10001E: - case 0x10001F: - return BCU2Reg[(sekAddress & 15) >> 1]; - - case 0x080000: - case 0x140000: - return ToaVBlankRegister(); - - default: { -// bprintf(PRINT_NORMAL, _T("Read Word %06X.\n"), sekAddress); - } - } - - return 0; -} - -void __fastcall hellfireWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - - case 0x080003: - bEnableInterrupts = byteValue; - break; - - case 0x140006: - ToaFCU2WriteRAMSize(byteValue); - break; - - default: { -// bprintf(PRINT_NORMAL, _T("Write byte %06X, %02X.\n"), sekAddress, byteValue); - } - } -} - -void __fastcall hellfireWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - - case 0x140002: // FCU-2 set VRAM address-pointer - ToaFCU2SetRAMPointer(wordValue); - break; - case 0x140004: - ToaFCU2WriteRAM(wordValue); - break; - case 0x140006: - ToaFCU2WriteRAMSize(wordValue); - break; - - case 0x100000: // BCU-2 flip - break; - case 0x100002: // BCU-2 set VRAM address-pointer - ToaBCU2SetRAMPointer(wordValue); - break; - case 0x100004: - ToaBCU2WriteRAM(wordValue); - break; - case 0x100006: - ToaBCU2WriteRAM(wordValue); - break; - - case 0x100010: - case 0x100011: - case 0x100012: - case 0x100013: - case 0x100014: - case 0x100015: - case 0x100016: - case 0x100017: - case 0x100018: - case 0x100019: - case 0x10001A: - case 0x10001B: - case 0x10001C: - case 0x10001D: - case 0x10001E: - case 0x10001F: - BCU2Reg[(sekAddress & 15) >> 1] = wordValue; - break; - - case 0x080002: - bEnableInterrupts = (wordValue & 0xFF); - break; - - case 0x180000: - nBCU2TileXOffset = wordValue; - break; - case 0x180002: - nBCU2TileYOffset = wordValue; - break; - - case 0x180006: // FCU-2 flip - break; - - case 0x180008: - if (wordValue == 0) DrvResetCallback(); - break; - - default: { -// bprintf(PRINT_NORMAL, _T("Write word %06X, %04X.\n"), sekAddress, wordValue); - } - } -} - -// ---------------------------------------------------------------------------- - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - - bEnableInterrupts = false; - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - Hellfire = 1; - -#ifdef DRIVER_ROTATION - bToaRotateScreen = true; -#endif - - BurnSetRefreshRate(REFRESHRATE); - - nBCU2ROMSize = 0x080000; - nFCU2ROMSize = 0x080000; - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x03FFFF, SM_ROM); // 68K ROM - SekMapMemory(Ram01, 0x040000, 0x047FFF, SM_RAM); // 68K RAM - SekMapMemory(RamPal, 0x084000, 0x0847FF, SM_RAM); // BCU-2 palette RAM - SekMapMemory(RamPal2, 0x086000, 0x0867FF, SM_RAM); // FCU-2 palette RAM - - SekSetReadWordHandler(0, hellfireReadWord); - SekSetReadByteHandler(0, hellfireReadByte); - SekSetWriteWordHandler(0, hellfireWriteWord); - SekSetWriteByteHandler(0, hellfireWriteByte); - - SekMapHandler(1, 0x0c0000, 0x0c0FFF, SM_RAM); // Z80 RAM - - SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); - SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); - SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); - SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); - - SekClose(); - } - - ToaInitBCU2(); - - DrvZ80Init(); // Initialize Z80 - - nToaPalLen = nColCount; - ToaPalSrc = RamPal; - ToaPalSrc2 = RamPal2; - ToaPalInit(); - - BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); - BurnTimerAttachZetYM3812(28000000 / 8); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - return 0; -} - -static INT32 DrvExit() -{ - BurnYM3812Exit(); - ToaPalExit(); - - ToaExitBCU2(); - ToaZExit(); // Z80 exit - SekExit(); // Deallocate 68000s - - BurnFree(Mem); - - Hellfire = 0; - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0x120); -// BurnClearScreen(); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderBCU2(); // Render BCU2 graphics - } - - ToaPalUpdate(); // Update the palette - ToaPal2Update(); - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 4; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x00; // Buttons - DrvInput[1] = 0x00; // Player 1 - DrvInput[4] = 0x00; // Player 2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[4] |= (DrvButton[i] & 1) << i; - } - ToaClearOpposites(&DrvInput[0]); - ToaClearOpposites(&DrvInput[1]); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); - nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext; - - // Run 68000 - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - - // Trigger VBlank interrupt - if (nNext > nToaCyclesVBlankStart) { - if (SekTotalCycles() < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); - SekRun(nCyclesSegment); - } - - if (pBurnDraw) { - DrvDraw(); // Draw screen if needed - } - - ToaBufferFCU2Sprites(); - - bVBlank = true; - if (bEnableInterrupts) { - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - } - - nCyclesSegment = nNext - SekTotalCycles(); - if (bVBlank || (!CheckSleep(0))) { // See if this CPU is busywaiting - SekRun(nCyclesSegment); - } else { - SekIdle(nCyclesSegment); - } - - BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); - } - - nToa1Cycles68KSync = SekTotalCycles(); - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; - -// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); - - ZetClose(); - SekClose(); - -// ToaBufferFCU2Sprites(); - - return 0; -} - -struct BurnDriver BurnDrvHellfire = { - "hellfire", NULL, NULL, NULL, "1989", - "Hellfire (2P Ver.)\0", NULL, "Toaplan (Taito License)", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, - NULL, hellfireRomInfo, hellfireRomName, NULL, NULL, hellfireInputInfo, hellfireDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvHellfir1 = { - "hellfire1", "hellfire", NULL, NULL, "1989", - "Hellfire (1P Ver.)\0", NULL, "Toaplan (Taito License)", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, - NULL, hellfir1RomInfo, hellfir1RomName, NULL, NULL, hellfireInputInfo, hellfir1DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvHellfir2 = { - "hellfire2", "hellfire", NULL, NULL, "1989", - "Hellfire (2P Ver., first edition)\0", NULL, "Toaplan (Taito License)", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, - NULL, hellfir2RomInfo, hellfir2RomName, NULL, NULL, hellfireInputInfo, hellfireDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvHellfir3 = { - "hellfire3", "hellfire", NULL, NULL, "1989", - "Hellfire (1P Ver., alt)\0", NULL, "Toaplan (Taito License)", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, - NULL, hellfir3RomInfo, hellfir3RomName, NULL, NULL, hellfireInputInfo, hellfireDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 320, 240, 4, 3 -}; +// Hell Fire + +#include "toaplan.h" + +#define REFRESHRATE 60 +#define VBLANK_LINES (32) + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static bool bEnableInterrupts; + +// Rom information +static struct BurnRomInfo hellfireRomDesc[] = { + { "b90_14.0", 0x020000, 0x101df9f5, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "b90_15.1", 0x020000, 0xe67fd452, BRF_ESS | BRF_PRG }, // 1 + + { "b90_04.3", 0x020000, 0xea6150fc, BRF_GRA }, // 6 + { "b90_05.4", 0x020000, 0xbb52c507, BRF_GRA }, // 7 + { "b90_06.5", 0x020000, 0xcf5b0252, BRF_GRA }, // 8 + { "b90_07.6", 0x020000, 0xb98af263, BRF_GRA }, // 9 + + { "b90_11.10", 0x020000, 0xc33e543c, BRF_GRA }, // 2 + { "b90_10.9", 0x020000, 0x35fd1092, BRF_GRA }, // 3 + { "b90_09.8", 0x020000, 0xcf01009e, BRF_GRA }, // 4 + { "b90_08.7", 0x020000, 0x3404a5e3, BRF_GRA }, // 5 + + { "b90_03.2", 0x008000, 0x4058fa67, BRF_ESS | BRF_PRG }, // 10 Z80 program + + { "13.3w", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM + { "12.6b", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? +}; + +STD_ROM_PICK(hellfire) +STD_ROM_FN(hellfire) + +static struct BurnRomInfo hellfir1RomDesc[] = { + { "b90_14x.0", 0x020000, 0xa3141ea5, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "b90_15x.1", 0x020000, 0xe864daf4, BRF_ESS | BRF_PRG }, // 1 + + { "b90_04.3", 0x020000, 0xea6150fc, BRF_GRA }, // 6 + { "b90_05.4", 0x020000, 0xbb52c507, BRF_GRA }, // 7 + { "b90_06.5", 0x020000, 0xcf5b0252, BRF_GRA }, // 8 + { "b90_07.6", 0x020000, 0xb98af263, BRF_GRA }, // 9 + + { "b90_11.10", 0x020000, 0xc33e543c, BRF_GRA }, // 2 + { "b90_10.9", 0x020000, 0x35fd1092, BRF_GRA }, // 3 + { "b90_09.8", 0x020000, 0xcf01009e, BRF_GRA }, // 4 + { "b90_08.7", 0x020000, 0x3404a5e3, BRF_GRA }, // 5 + + { "b90_03x.2", 0x008000, 0xf58c368f, BRF_ESS | BRF_PRG }, // 10 Z80 program + + { "13.3w", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM + { "12.6b", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? +}; + +STD_ROM_PICK(hellfir1) +STD_ROM_FN(hellfir1) + +static struct BurnRomInfo hellfir2RomDesc[] = { + { "b90_01.0", 0x020000, 0xc94acf53, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "b90_02.1", 0x020000, 0xd17f03c3, BRF_ESS | BRF_PRG }, // 1 + + { "b90_04.3", 0x020000, 0xea6150fc, BRF_GRA }, // 6 + { "b90_05.4", 0x020000, 0xbb52c507, BRF_GRA }, // 7 + { "b90_06.5", 0x020000, 0xcf5b0252, BRF_GRA }, // 8 + { "b90_07.6", 0x020000, 0xb98af263, BRF_GRA }, // 9 + + { "b90_11.10", 0x020000, 0xc33e543c, BRF_GRA }, // 2 + { "b90_10.9", 0x020000, 0x35fd1092, BRF_GRA }, // 3 + { "b90_09.8", 0x020000, 0xcf01009e, BRF_GRA }, // 4 + { "b90_08.7", 0x020000, 0x3404a5e3, BRF_GRA }, // 5 + + { "b90_03x.2", 0x008000, 0xf58c368f, BRF_ESS | BRF_PRG }, // 10 Z80 program + + { "13.3w", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM + { "12.6b", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? +}; + +STD_ROM_PICK(hellfir2) +STD_ROM_FN(hellfir2) + +static struct BurnRomInfo hellfir3RomDesc[] = { + { "b90_01.10m", 0x020000, 0x034966d3, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "b90_02.9m", 0x020000, 0x06dd24c7, BRF_ESS | BRF_PRG }, // 1 + + { "b90_04.3", 0x020000, 0xea6150fc, BRF_GRA }, // 6 + { "b90_05.4", 0x020000, 0xbb52c507, BRF_GRA }, // 7 + { "b90_06.5", 0x020000, 0xcf5b0252, BRF_GRA }, // 8 + { "b90_07.6", 0x020000, 0xb98af263, BRF_GRA }, // 9 + + { "b90_11.10", 0x020000, 0xc33e543c, BRF_GRA }, // 2 + { "b90_10.9", 0x020000, 0x35fd1092, BRF_GRA }, // 3 + { "b90_09.8", 0x020000, 0xcf01009e, BRF_GRA }, // 4 + { "b90_08.7", 0x020000, 0x3404a5e3, BRF_GRA }, // 5 + + { "b90_03.2", 0x008000, 0x4058fa67, BRF_ESS | BRF_PRG }, // 10 Z80 program + + { "13.3w", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM + { "12.6b", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? +}; + +STD_ROM_PICK(hellfir3) +STD_ROM_FN(hellfir3) + +static struct BurnInputInfo hellfireInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 2, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, +}; + +STDINPUTINFO(hellfire) + +static struct BurnDIPInfo hellfireDIPList[] = { + // Defaults + {0x12, 0xFF, 0xFF, 0x00, NULL}, + {0x13, 0xFF, 0xFF, 0x00, NULL}, + {0x14, 0xFF, 0xFF, 0x02, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x02, 0x00, "Normal screen"}, + {0x12, 0x01, 0x02, 0x02, "Invert screen"}, + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x04, 0x00, "Normal mode"}, + {0x12, 0x01, 0x04, 0x04, "Screen test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x12, 0x01, 0x08, 0x00, "On"}, + {0x12, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, + {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x12, 0x01, 0x30, 0x10, "2 coin 1 play"}, + {0x12, 0x01, 0x30, 0x20, "3 coin 1 play"}, + {0x12, 0x01, 0x30, 0x30, "4 coin 1 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x12, 0x01, 0xC0, 0x00, "1 coin 2 play"}, + {0x12, 0x01, 0xC0, 0x40, "1 coin 3 play"}, + {0x12, 0x01, 0xC0, 0x80, "1 coin 4 play"}, + {0x12, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, + + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x13, 0x01, 0x03, 0x00, "B"}, + {0x13, 0x01, 0x03, 0x01, "A"}, + {0x13, 0x01, 0x03, 0x02, "C"}, + {0x13, 0x01, 0x03, 0x03, "D"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x13, 0x01, 0x0C, 0x00, "70000, every 200000"}, + {0x13, 0x01, 0x0C, 0x04, "100000, every 250000"}, + {0x13, 0x01, 0x0C, 0x08, "100000 only"}, + {0x13, 0x01, 0x0C, 0x0C, "200000 only"}, + {0, 0xFE, 0, 4, "Hero counts"}, + {0x13, 0x01, 0x30, 0x30, "2"}, + {0x13, 0x01, 0x30, 0x00, "3"}, + {0x13, 0x01, 0x30, 0x20, "4"}, + {0x13, 0x01, 0x30, 0x10, "5"}, + {0, 0xFE, 0, 2, NULL}, + {0x13, 0x01, 0x40, 0x00, "Normal Game"}, + {0x13, 0x01, 0x40, 0x40, "No death & stop mode"}, + + // Region + {0, 0xFE, 0, 3, "Region"}, + {0x14, 0x01, 0x03, 0x00, "Japan"}, + {0x14, 0x01, 0x03, 0x01, "US"}, + {0x14, 0x01, 0x03, 0x02, "Europe"}, +}; + +STDDIPINFO(hellfire) + +static struct BurnDIPInfo hellfir1DIPList[] = { + // Defaults + {0x12, 0xFF, 0xFF, 0x01, NULL}, + {0x13, 0xFF, 0xFF, 0x00, NULL}, + {0x14, 0xFF, 0xFF, 0x02, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x01, 0x01, "Upright"}, + {0x12, 0x01, 0x01, 0x00, "Cocktail"}, + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x02, 0x00, "Normal screen"}, + {0x12, 0x01, 0x02, 0x02, "Invert screen"}, + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x04, 0x00, "Normal mode"}, + {0x12, 0x01, 0x04, 0x04, "Screen test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x12, 0x01, 0x08, 0x00, "On"}, + {0x12, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, + {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x12, 0x01, 0x30, 0x10, "2 coin 1 play"}, + {0x12, 0x01, 0x30, 0x20, "3 coin 1 play"}, + {0x12, 0x01, 0x30, 0x30, "4 coin 1 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x12, 0x01, 0xC0, 0x00, "1 coin 2 play"}, + {0x12, 0x01, 0xC0, 0x40, "1 coin 3 play"}, + {0x12, 0x01, 0xC0, 0x80, "1 coin 4 play"}, + {0x12, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, + + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x13, 0x01, 0x03, 0x00, "B"}, + {0x13, 0x01, 0x03, 0x01, "A"}, + {0x13, 0x01, 0x03, 0x02, "C"}, + {0x13, 0x01, 0x03, 0x03, "D"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x13, 0x01, 0x0C, 0x00, "70000, every 200000"}, + {0x13, 0x01, 0x0C, 0x04, "100000, every 250000"}, + {0x13, 0x01, 0x0C, 0x08, "100000 only"}, + {0x13, 0x01, 0x0C, 0x0C, "200000 only"}, + {0, 0xFE, 0, 4, "Hero counts"}, + {0x13, 0x01, 0x30, 0x30, "2"}, + {0x13, 0x01, 0x30, 0x00, "3"}, + {0x13, 0x01, 0x30, 0x20, "4"}, + {0x13, 0x01, 0x30, 0x10, "5"}, + {0, 0xFE, 0, 2, NULL}, + {0x13, 0x01, 0x40, 0x00, "Normal Game"}, + {0x13, 0x01, 0x40, 0x40, "No death & stop mode"}, + {0, 0xFE, 0, 2, "Allow Continue"}, + {0x13, 0x01, 0x80, 0x00, "Yes"}, + {0x13, 0x01, 0x80, 0x80, "No"}, + + // Region + {0, 0xFE, 0, 3, "Region"}, + {0x14, 0x01, 0x03, 0x00, "Japan"}, + {0x14, 0x01, 0x03, 0x01, "US"}, + {0x14, 0x01, 0x03, 0x02, "Europe"}, +}; + +STDDIPINFO(hellfir1) + +static INT32 __fastcall DrvResetCallback() +{ + // Reset instruction on 68000 + + ZetReset(); // Reset Z80 (CPU #1) + BurnYM3812Reset(); + return 0; +} + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *Ram01, *RamPal, *RamPal2; + +static INT32 nColCount = 0x0400; + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x040000; // + RomZ80 = Next; Next += 0x008000; // Z80 ROM + BCU2ROM = Next; Next += nBCU2ROMSize; // BCU-2 tile data + FCU2ROM = Next; Next += nFCU2ROMSize; // FCU-2 tile data + RamStart = Next; + Ram01 = Next; Next += 0x008000; // CPU #0 work RAM + RamPal = Next; Next += 0x001000; // palette + RamPal2 = Next; Next += 0x001000; // palette + RamZ80 = Next; Next += 0x008000; // Z80 RAM + BCU2RAM = Next; Next += 0x010000; + FCU2RAM = Next; Next += 0x000800; + FCU2RAMSize = Next; Next += 0x000080; + RamEnd = Next; + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32* pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029402; + } + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); // scan 68000 states + ZetScan(nAction); // Scan Z80 + + BurnYM3812Scan(nAction, pnMin); + + SCAN_VAR(DrvInput); + SCAN_VAR(nCyclesDone); + } + + return 0; +} + +static INT32 LoadRoms() +{ + // Load 68000 ROM + ToaLoadCode(Rom01, 0, 2); + + // Load BCU-2 tile data + ToaLoadTiles(BCU2ROM, 2, nBCU2ROMSize); + + // Load FCU-2 tile data + ToaLoadTiles(FCU2ROM, 6, nFCU2ROMSize); + + // Load the Z80 ROM + BurnLoadRom(RomZ80, 10, 1); + + return 0; +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall hellfireZ80In(UINT16 nAddress) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x70: + return BurnYM3812Read(0); + case 0x00: // DIP A + return DrvInput[2]; + case 0x10: // DIP B + return DrvInput[3]; + case 0x60: // Sysytem inputs + return DrvInput[4] | (ToaVBlankRegister() << 7); + case 0x40: // Player 1 + return DrvInput[0]; + case 0x50: // Player 2 + return DrvInput[1]; + case 0x20: // Region + return DrvInput[5]; + + } + +// bprintf(PRINT_NORMAL, _T("z80 read %4X\n"), nAddress); + + return 0; +} + +void __fastcall hellfireZ80Out(UINT16 nAddress, UINT8 nValue) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x70: + BurnYM3812Write(0, nValue); + break; + case 0x71: + BurnYM3812Write(1, nValue); + break; + + case 0x30: // Coin counter + break; + +// default: +// bprintf(PRINT_NORMAL, _T("Z80 attempted to write address %04X with value %02X.\n"), nAddress, nValue); + } +} + +static INT32 DrvZ80Init() +{ + // Init the Z80 + ZetInit(0); + ZetOpen(0); + + ZetSetInHandler(hellfireZ80In); + ZetSetOutHandler(hellfireZ80Out); + + // ROM + ZetMapArea (0x0000, 0x7FFF, 0, RomZ80); // Direct Read from ROM + ZetMapArea (0x0000, 0x7FFF, 2, RomZ80); // Direct Fetch from ROM + // RAM + ZetMapArea (0x8000, 0xFFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0x8000, 0xFFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0x8000, 0xFFFF, 2, RamZ80); // + + + ZetClose(); + + return 0; +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall hellfireReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x080001: + case 0x140001: + return ToaVBlankRegister(); + + default: { +// bprintf(PRINT_NORMAL, _T("Read Byte %06X.\n"), sekAddress); + } + } + + return 0; +} + +UINT16 __fastcall hellfireReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x140002: + return ToaFCU2GetRAMPointer(); + case 0x140004: + return ToaFCU2ReadRAM(); + case 0x140006: + return ToaFCU2ReadRAMSize(); + + case 0x100002: + return ToaBCU2GetRAMPointer(); + case 0x100004: + return ToaBCU2ReadRAM_Hi(); + case 0x100006: + return ToaBCU2ReadRAM_Lo(); + + case 0x100010: + case 0x100011: + case 0x100012: + case 0x100013: + case 0x100014: + case 0x100015: + case 0x100016: + case 0x100017: + case 0x100018: + case 0x100019: + case 0x10001A: + case 0x10001B: + case 0x10001C: + case 0x10001D: + case 0x10001E: + case 0x10001F: + return BCU2Reg[(sekAddress & 15) >> 1]; + + case 0x080000: + case 0x140000: + return ToaVBlankRegister(); + + default: { +// bprintf(PRINT_NORMAL, _T("Read Word %06X.\n"), sekAddress); + } + } + + return 0; +} + +void __fastcall hellfireWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + + case 0x080003: + bEnableInterrupts = byteValue; + break; + + case 0x140006: + ToaFCU2WriteRAMSize(byteValue); + break; + + default: { +// bprintf(PRINT_NORMAL, _T("Write byte %06X, %02X.\n"), sekAddress, byteValue); + } + } +} + +void __fastcall hellfireWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + + case 0x140002: // FCU-2 set VRAM address-pointer + ToaFCU2SetRAMPointer(wordValue); + break; + case 0x140004: + ToaFCU2WriteRAM(wordValue); + break; + case 0x140006: + ToaFCU2WriteRAMSize(wordValue); + break; + + case 0x100000: // BCU-2 flip + break; + case 0x100002: // BCU-2 set VRAM address-pointer + ToaBCU2SetRAMPointer(wordValue); + break; + case 0x100004: + ToaBCU2WriteRAM(wordValue); + break; + case 0x100006: + ToaBCU2WriteRAM(wordValue); + break; + + case 0x100010: + case 0x100011: + case 0x100012: + case 0x100013: + case 0x100014: + case 0x100015: + case 0x100016: + case 0x100017: + case 0x100018: + case 0x100019: + case 0x10001A: + case 0x10001B: + case 0x10001C: + case 0x10001D: + case 0x10001E: + case 0x10001F: + BCU2Reg[(sekAddress & 15) >> 1] = wordValue; + break; + + case 0x080002: + bEnableInterrupts = (wordValue & 0xFF); + break; + + case 0x180000: + nBCU2TileXOffset = wordValue; + break; + case 0x180002: + nBCU2TileYOffset = wordValue; + break; + + case 0x180006: // FCU-2 flip + break; + + case 0x180008: + if (wordValue == 0) DrvResetCallback(); + break; + + default: { +// bprintf(PRINT_NORMAL, _T("Write word %06X, %04X.\n"), sekAddress, wordValue); + } + } +} + +// ---------------------------------------------------------------------------- + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + + bEnableInterrupts = false; + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + Hellfire = 1; + +#ifdef DRIVER_ROTATION + bToaRotateScreen = true; +#endif + + BurnSetRefreshRate(REFRESHRATE); + + nBCU2ROMSize = 0x080000; + nFCU2ROMSize = 0x080000; + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x03FFFF, SM_ROM); // 68K ROM + SekMapMemory(Ram01, 0x040000, 0x047FFF, SM_RAM); // 68K RAM + SekMapMemory(RamPal, 0x084000, 0x0847FF, SM_RAM); // BCU-2 palette RAM + SekMapMemory(RamPal2, 0x086000, 0x0867FF, SM_RAM); // FCU-2 palette RAM + + SekSetReadWordHandler(0, hellfireReadWord); + SekSetReadByteHandler(0, hellfireReadByte); + SekSetWriteWordHandler(0, hellfireWriteWord); + SekSetWriteByteHandler(0, hellfireWriteByte); + + SekMapHandler(1, 0x0c0000, 0x0c0FFF, SM_RAM); // Z80 RAM + + SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); + SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); + SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); + SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); + + SekClose(); + } + + ToaInitBCU2(); + + DrvZ80Init(); // Initialize Z80 + + nToaPalLen = nColCount; + ToaPalSrc = RamPal; + ToaPalSrc2 = RamPal2; + ToaPalInit(); + + BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); + BurnTimerAttachZetYM3812(28000000 / 8); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + return 0; +} + +static INT32 DrvExit() +{ + BurnYM3812Exit(); + ToaPalExit(); + + ToaExitBCU2(); + ToaZExit(); // Z80 exit + SekExit(); // Deallocate 68000s + + BurnFree(Mem); + + Hellfire = 0; + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0x120); +// BurnClearScreen(); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderBCU2(); // Render BCU2 graphics + } + + ToaPalUpdate(); // Update the palette + ToaPal2Update(); + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 4; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x00; // Buttons + DrvInput[1] = 0x00; // Player 1 + DrvInput[4] = 0x00; // Player 2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[4] |= (DrvButton[i] & 1) << i; + } + ToaClearOpposites(&DrvInput[0]); + ToaClearOpposites(&DrvInput[1]); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); + nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext; + + // Run 68000 + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + + // Trigger VBlank interrupt + if (nNext > nToaCyclesVBlankStart) { + if (SekTotalCycles() < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); + SekRun(nCyclesSegment); + } + + if (pBurnDraw) { + DrvDraw(); // Draw screen if needed + } + + ToaBufferFCU2Sprites(); + + bVBlank = true; + if (bEnableInterrupts) { + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + } + + nCyclesSegment = nNext - SekTotalCycles(); + if (bVBlank || (!CheckSleep(0))) { // See if this CPU is busywaiting + SekRun(nCyclesSegment); + } else { + SekIdle(nCyclesSegment); + } + + BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); + } + + nToa1Cycles68KSync = SekTotalCycles(); + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; + +// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); + + ZetClose(); + SekClose(); + +// ToaBufferFCU2Sprites(); + + return 0; +} + +struct BurnDriver BurnDrvHellfire = { + "hellfire", NULL, NULL, NULL, "1989", + "Hellfire (2P Ver.)\0", NULL, "Toaplan (Taito License)", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, + NULL, hellfireRomInfo, hellfireRomName, NULL, NULL, hellfireInputInfo, hellfireDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvHellfir1 = { + "hellfire1", "hellfire", NULL, NULL, "1989", + "Hellfire (1P Ver.)\0", NULL, "Toaplan (Taito License)", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, + NULL, hellfir1RomInfo, hellfir1RomName, NULL, NULL, hellfireInputInfo, hellfir1DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvHellfir2 = { + "hellfire2", "hellfire", NULL, NULL, "1989", + "Hellfire (2P Ver., first edition)\0", NULL, "Toaplan (Taito License)", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, + NULL, hellfir2RomInfo, hellfir2RomName, NULL, NULL, hellfireInputInfo, hellfireDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvHellfir3 = { + "hellfire3", "hellfire", NULL, NULL, "1989", + "Hellfire (1P Ver., alt)\0", NULL, "Toaplan (Taito License)", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, + NULL, hellfir3RomInfo, hellfir3RomName, NULL, NULL, hellfireInputInfo, hellfireDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/toaplan/d_mahoudai.cpp b/src/burn/drv/toaplan/d_mahoudai.cpp index 9ad58c87e..c82cc4ec2 100644 --- a/src/burn/drv/toaplan/d_mahoudai.cpp +++ b/src/burn/drv/toaplan/d_mahoudai.cpp @@ -1,695 +1,694 @@ -#include "toaplan.h" -// Mahou Daisakusen - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -// Rom information -static struct BurnRomInfo mahoudaiRomDesc[] = { - { "ra_ma_01_01.u65", 0x080000, 0x970CCC5C, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - - { "ra-ma01-rom2.u2", 0x100000, 0x54E2BD95, BRF_GRA }, // 1 GP9001 Tile data - { "ra-ma01-rom3.u1", 0x100000, 0x21CD378F, BRF_GRA }, // 2 - - { "ra_ma_01_05.u81", 0x008000, 0xC00D1E80, BRF_GRA }, // 3 Extra text layer tile data - - { "ra-ma-01_02.u66", 0x010000, 0xEABFA46D, BRF_ESS | BRF_PRG }, // 4 Z80 program - - { "ra-ma01-rom1.u57", 0x040000, 0x6EDB2AB8, BRF_SND }, // 5 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(mahoudai) -STD_ROM_FN(mahoudai) - -static struct BurnRomInfo sstrikerRomDesc[] = { - { "ra-ma_01_01.u65", 0x080000, 0x708FD51D, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - - { "ra-ma01-rom2.u2", 0x100000, 0x54E2BD95, BRF_GRA }, // 1 GP9001 Tile data - { "ra-ma01-rom3.u1", 0x100000, 0x21CD378F, BRF_GRA }, // 2 - - { "ra-ma-01_05.u81", 0x008000, 0x88B58841, BRF_GRA }, // 3 Extra text layer tile data - - { "ra-ma-01_02.u66", 0x010000, 0xEABFA46D, BRF_ESS | BRF_PRG }, // 4 Z80 program - - { "ra-ma01-rom1.u57", 0x040000, 0x6EDB2AB8, BRF_SND }, // 5 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(sstriker) -STD_ROM_FN(sstriker) - -static struct BurnRomInfo sstrikraRomDesc[] = { - { "ra-ma-01_01.u65", 0x080000, 0x92259F84, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - - { "ra-ma01-rom2.u2", 0x100000, 0x54E2BD95, BRF_GRA }, // 1 GP9001 Tile data - { "ra-ma01-rom3.u1", 0x100000, 0x21CD378F, BRF_GRA }, // 2 - - { "ra-ma-01_05.u81", 0x008000, 0x88B58841, BRF_GRA }, // 3 Extra text layer tile data - - { "ra-ma-01_02.u66", 0x010000, 0xEABFA46D, BRF_ESS | BRF_PRG }, // 4 Z80 program - - { "ra-ma01-rom1.u57", 0x040000, 0x6EDB2AB8, BRF_SND }, // 5 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(sstrikra) -STD_ROM_FN(sstrikra) - -static struct BurnInputInfo mahoudaiInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, -}; - -STDINPUTINFO(mahoudai) - -static struct BurnDIPInfo mahoudaiDIPList[] = { - // Defaults - {0x14, 0xFF, 0xFF, 0x00, NULL}, - {0x15, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x01, 0x00, "Coin play"}, - {0x14, 0x01, 0x01, 0x01, "Free play"}, - {0, 0xFE, 0, 2, "Screen"}, - {0x14, 0x01, 0x02, 0x00, "Normal"}, - {0x14, 0x01, 0x02, 0x02, "Invert"}, - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x04, 0x00, "Normal mode"}, - {0x14, 0x01, 0x04, 0x04, "Test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x14, 0x01, 0x08, 0x00, "On"}, - {0x14, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, - {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0x30, 0x10, "1 coin 2 plays"}, - {0x14, 0x01, 0x30, 0x20, "2 coins 1 play"}, - {0x14, 0x01, 0x30, 0x30, "2 coins 3 plays"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0xC0, 0x40, "1 coin 2 plays"}, - {0x14, 0x01, 0xC0, 0x80, "2 coins 1 play"}, - {0x14, 0x01, 0xC0, 0xC0, "2 coins 3 plays"}, - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x15, 0x01, 0x03, 0x00, "B (normal)"}, - {0x15, 0x01, 0x03, 0x01, "A (easy)"}, - {0x15, 0x01, 0x03, 0x02, "C (hard)"}, - {0x15, 0x01, 0x03, 0x03, "D (more hard)"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, - {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, - {0x15, 0x01, 0x0C, 0x08, "200000 only"}, - {0x15, 0x01, 0x0C, 0x0C, "No extend"}, - {0, 0xFE, 0, 4, "Number of heroes"}, - {0x15, 0x01, 0x30, 0x00, "3"}, - {0x15, 0x01, 0x30, 0x10, "5"}, - {0x15, 0x01, 0x30, 0x20, "2"}, - {0x15, 0x01, 0x30, 0x30, "1"}, - {0, 0xFE, 0, 2, "No death & stop mode"}, - {0x15, 0x01, 0x40, 0x00, "Off"}, - {0x15, 0x01, 0x40, 0x40, "On"}, - {0, 0xFE, 0, 2, NULL}, - {0x15, 0x01, 0x80, 0x00, "Continue play"}, - {0x15, 0x01, 0x80, 0x80, "Continue impossible"}, -}; - -static struct BurnDIPInfo mahoudaiRegionDIPList[] = { - // Defaults - {0x16, 0xFF, 0x0E, 0x00, NULL}, - - // Region - {0, 0xFE, 0, 1, "Region"}, - {0x16, 0x01, 0x0E, 0x00, "Japan"}, - {0x16, 0x01, 0x0E, 0x02, "U.S.A."}, - {0x16, 0x01, 0x0E, 0x04, "Europe"}, - {0x16, 0x01, 0x0E, 0x06, "South East Asia"}, - {0x16, 0x01, 0x0E, 0x08, "China"}, - {0x16, 0x01, 0x0E, 0x0A, "Korea"}, - {0x16, 0x01, 0x0E, 0x0C, "Hong Kong"}, - {0x16, 0x01, 0x0E, 0x0E, "Taiwan"}, -}; - -static struct BurnDIPInfo sstrikerRegionDIPList[] = { - // Defaults - {0x16, 0xFF, 0x0E, 0x04, NULL}, - - // Region - {0, 0xFE, 0, 7, "Region"}, - {0x16, 0x01, 0x0E, 0x02, "U.S.A."}, - {0x16, 0x01, 0x0E, 0x04, "Europe"}, - {0x16, 0x01, 0x0E, 0x06, "South East Asia"}, - {0x16, 0x01, 0x0E, 0x08, "China"}, - {0x16, 0x01, 0x0E, 0x0A, "Korea"}, - {0x16, 0x01, 0x0E, 0x0C, "Hong Kong"}, - {0x16, 0x01, 0x0E, 0x0E, "Taiwan"}, - {0x16, 0x01, 0x0E, 0x00, "Japan"}, -}; - -STDDIPINFOEXT(mahoudai, mahoudai, mahoudaiRegion) -STDDIPINFOEXT(sstriker, mahoudai, sstrikerRegion) - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *Ram01, *Ram02, *RamPal; - -static INT32 nColCount = 0x0800; -static INT32 nRomADPCMSize = 0x040000; - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x080000; // - RomZ80 = Next; Next += 0x010000; // Z80 ROM - GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data - ExtraTROM = Next; Next += 0x008000; // Extra Text layer tile data - MSM6295ROM = Next; Next += nRomADPCMSize; // ADPCM data - RamStart = Next; - Ram01 = Next; Next += 0x010000; // CPU #0 work RAM - Ram02 = Next; Next += 0x000800; // - ExtraTRAM = Next; Next += 0x002000; // Extra tile layer - ExtraTScroll= Next; Next += 0x001000; // - ExtraTSelect= Next; Next += 0x001000; // - RamPal = Next; Next += 0x001000; // palette - RamZ80 = Next; Next += 0x004000; // Z80 RAM - GP9001RAM[0]= Next; Next += 0x004000; - GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); - RamEnd = Next; - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32* pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029497; - } - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); // scan 68000 states - ZetScan(nAction); // Scan Z80 - - MSM6295Scan(0, nAction); - BurnYM2151Scan(nAction); - - ToaScanGP9001(nAction, pnMin); - - SCAN_VAR(DrvInput); - } - - return 0; -} - -static INT32 LoadRoms() -{ - // Load 68000 ROM - BurnLoadRom(Rom01, 0, 1); - - // Load GP9001 tile data - ToaLoadGP9001Tiles(GP9001ROM[0], 1, 2, nGP9001ROMSize[0]); - - // Load Extra text layer tile data - BurnLoadRom(ExtraTROM, 3, 1); - - // Load the Z80 ROM - BurnLoadRom(RomZ80, 4, 1); - - // Load MSM6295 ADPCM data - BurnLoadRom(MSM6295ROM, 5, 1); - - return 0; -} - -UINT8 __fastcall mahoudaiZ80Read(UINT16 nAddress) -{ -// bprintf(PRINT_NORMAL, "z80 read %4X\n", nAddress); - if (nAddress == 0xE001) { - return BurnYM2151ReadStatus(); - } - if (nAddress == 0xE004) { - return MSM6295ReadStatus(0); - } - return 0; -} - -void __fastcall mahoudaiZ80Write(UINT16 nAddress, UINT8 nValue) -{ -// bprintf(PRINT_NORMAL, "Z80 attempted to write address %04X with value %02X.\n", nAddress, nValue); - - switch (nAddress) { - case 0xE000: - BurnYM2151SelectRegister(nValue); - break; - case 0xE001: - BurnYM2151WriteRegister(nValue); - break; - case 0xE004: - MSM6295Command(0, nValue); -// bprintf(PRINT_NORMAL, "OKI M6295 command %02X sent\n", nValue); - break; - } -} - -static INT32 DrvZ80Init() -{ - // Init the Z80 - ZetInit(0); - ZetOpen(0); - - ZetSetReadHandler(mahoudaiZ80Read); - ZetSetWriteHandler(mahoudaiZ80Write); - - // ROM - ZetMapArea (0x0000, 0xBFFF, 0, RomZ80); // Direct Read from ROM - ZetMapArea (0x0000, 0xBFFF, 2, RomZ80); // Direct Fetch from ROM - // RAM - ZetMapArea (0xC000, 0xDFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0xC000, 0xDFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0xC000, 0xDFFF, 2, RamZ80); // - // Callbacks - ZetMemCallback(0xE000, 0xE0FF, 0); // Read - ZetMemCallback(0xE000, 0xE0FF, 1); // Write - - ZetMemEnd(); - ZetClose(); - - return 0; -} - -UINT8 __fastcall mahoudaiReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x21C021: // Player 1 inputs - return DrvInput[0]; - case 0x21C025: // Player 2 inputs - return DrvInput[1]; - case 0x21C029: // Other inputs - return DrvInput[2]; - case 0x21C02D: // Dipswitch A - return DrvInput[3]; - case 0x21C031: // Dipswitch B - return DrvInput[4]; - case 0x21C035: // Dipswitch C - Territory - return DrvInput[5]; - - case 0x30000D: - return ToaVBlankRegister(); - - default: { - if ((sekAddress & 0x00FFC000) == 0x00218000) { - return RamZ80[(sekAddress & 0x3FFF) >> 1]; - } - -// bprintf(PRINT_NORMAL, "Attempt to read byte value of location %x\n", sekAddress); - } - } - return 0; -} - -UINT16 __fastcall mahoudaiReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x21C020: // Player 1 inputs - return DrvInput[0]; - case 0x21C024: // Player 2 inputs - return DrvInput[1]; - case 0x21C028: // Other inputs - return DrvInput[2]; - case 0x21C02C: // Dipswitch A - return DrvInput[3]; - case 0x21C030: // Dipswitch B - return DrvInput[4]; - case 0x21C034: // Dipswitch C - Territory - return DrvInput[5]; - - case 0x21C03C: - return ToaScanlineRegister(); - - case 0x300004: - return ToaGP9001ReadRAM_Hi(0); - case 0x300006: - return ToaGP9001ReadRAM_Lo(0); - - case 0x30000C: - return ToaVBlankRegister(); - - default: { - if ((sekAddress & 0x00FFC000) == 0x00218000) { - return RamZ80[(sekAddress & 0x3FFF) >> 1]; - } - -// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); - } - } - return 0; -} - -void __fastcall mahoudaiWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ -// switch (sekAddress) { - -// default: { -// bprintf(PRINT_NORMAL, "Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - - if ((sekAddress & 0x00FFC000) == 0x00218000) { - RamZ80[(sekAddress & 0x3FFF) >> 1] = byteValue; - } -// } -// } -} - -void __fastcall mahoudaiWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - - case 0x300000: // Set GP9001 VRAM address-pointer - ToaGP9001SetRAMPointer(wordValue); - break; - - case 0x300004: - ToaGP9001WriteRAM(wordValue, 0); - break; - case 0x300006: - ToaGP9001WriteRAM(wordValue, 0); - break; - - case 0x300008: - ToaGP9001SelectRegister(wordValue); - break; - - case 0x30000C: - ToaGP9001WriteRegister(wordValue); - break; - - default: { -// bprintf(PRINT_NORMAL, "Attempt to write word value %x to location %x\n", wordValue, sekAddress); - - if ((sekAddress & 0x00FFC000) == 0x00218000) { - RamZ80[(sekAddress & 0x3FFF) >> 1] = wordValue; - } - } - } -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM2151Reset(); - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - -#ifdef DRIVER_ROTATION - bToaRotateScreen = true; -#endif - - nGP9001ROMSize[0] = 0x200000; - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x100000, 0x10FFFF, SM_RAM); - SekMapMemory(RamPal, 0x400000, 0x400FFF, SM_RAM); // Palette RAM - SekMapMemory(Ram02, 0x401000, 0x4017FF, SM_RAM); // Unused - SekMapMemory(ExtraTRAM, 0x500000, 0x502FFF, SM_RAM); - SekMapMemory(ExtraTSelect, 0x502000, 0x502FFF, SM_RAM); // 0x502000 - Scroll; 0x502200 - RAM - SekMapMemory(ExtraTScroll, 0x503000, 0x503FFF, SM_RAM); // 0x203000 - Offset; 0x503200 - RAM - - SekSetReadWordHandler(0, mahoudaiReadWord); - SekSetReadByteHandler(0, mahoudaiReadByte); - SekSetWriteWordHandler(0, mahoudaiWriteWord); - SekSetWriteByteHandler(0, mahoudaiWriteByte); - - SekClose(); - } - - nSpritePriority = 1; - ToaInitGP9001(); - - ToaExtraTextInit(); - - DrvZ80Init(); // Initialize Z80 - - nToaPalLen = nColCount; - ToaPalSrc = RamPal; - ToaPalInit(); - - BurnYM2151Init(27000000 / 8); - BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - MSM6295Init(0, 32000000 / 32 / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - return 0; -} - -static INT32 DrvExit() -{ - MSM6295Exit(0); - BurnYM2151Exit(); - - ToaPalExit(); - - ToaExitGP9001(); - ToaExtraTextExit(); - ToaZExit(); // Z80 exit - SekExit(); // Deallocate 68000s - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderGP9001(); // Render GP9001 graphics - ToaExtraTextLayer(); // Render extra text layer - } - - ToaPalUpdate(); // Update the palette - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 4; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x00; // Buttons - DrvInput[1] = 0x00; // Player 1 - DrvInput[2] = 0x00; // Player 2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[2] |= (DrvButton[i] & 1) << i; - } - ToaClearOpposites(&DrvInput[0]); - ToaClearOpposites(&DrvInput[1]); - - SekNewFrame(); - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = TOA_Z80_SPEED / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekOpen(0); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - INT32 nSoundBufferPos = 0; - - ZetOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU; - INT32 nNext; - - // Run 68000 - - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - - // Trigger VBlank interrupt - if (nNext > nToaCyclesVBlankStart) { - if (nCyclesDone[nCurrentCPU] < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } - - ToaBufferGP9001Sprites(); - - bVBlank = true; - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (bVBlank || (!CheckSleep(nCurrentCPU))) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - - // Run Z80 - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - - { - // Render sound segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - } - - { - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - } - - SekClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); // Draw screen if needed - } - - return 0; -} - -struct BurnDriver BurnDrvMahouDai = { - "mahoudai", "sstriker", NULL, NULL, "1993", - "Mahou Daisakusen (Japan)\0", NULL, "Raizing", "Toaplan GP9001 based", - L"\u9B54\u6CD5\u5927\u4F5C\u6226\0Mahou Daisakusen (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, mahoudaiRomInfo, mahoudaiRomName, NULL, NULL, mahoudaiInputInfo, mahoudaiDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvSStriker = { - "sstriker", NULL, NULL, NULL, "1993", - "Sorcer Striker (World)\0", NULL, "Raizing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, sstrikerRomInfo, sstrikerRomName, NULL, NULL, mahoudaiInputInfo, sstrikerDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvSStrikrA = { - "sstrikera", "sstriker", NULL, NULL, "1993", - "Sorcer Striker (World, alt)\0", NULL, "Raizing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, sstrikraRomInfo, sstrikraRomName, NULL, NULL, mahoudaiInputInfo, sstrikerDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - +#include "toaplan.h" +// Mahou Daisakusen + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +// Rom information +static struct BurnRomInfo mahoudaiRomDesc[] = { + { "ra_ma_01_01.u65", 0x080000, 0x970CCC5C, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + + { "ra-ma01-rom2.u2", 0x100000, 0x54E2BD95, BRF_GRA }, // 1 GP9001 Tile data + { "ra-ma01-rom3.u1", 0x100000, 0x21CD378F, BRF_GRA }, // 2 + + { "ra_ma_01_05.u81", 0x008000, 0xC00D1E80, BRF_GRA }, // 3 Extra text layer tile data + + { "ra-ma-01_02.u66", 0x010000, 0xEABFA46D, BRF_ESS | BRF_PRG }, // 4 Z80 program + + { "ra-ma01-rom1.u57", 0x040000, 0x6EDB2AB8, BRF_SND }, // 5 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(mahoudai) +STD_ROM_FN(mahoudai) + +static struct BurnRomInfo sstrikerRomDesc[] = { + { "ra-ma_01_01.u65", 0x080000, 0x708FD51D, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + + { "ra-ma01-rom2.u2", 0x100000, 0x54E2BD95, BRF_GRA }, // 1 GP9001 Tile data + { "ra-ma01-rom3.u1", 0x100000, 0x21CD378F, BRF_GRA }, // 2 + + { "ra-ma-01_05.u81", 0x008000, 0x88B58841, BRF_GRA }, // 3 Extra text layer tile data + + { "ra-ma-01_02.u66", 0x010000, 0xEABFA46D, BRF_ESS | BRF_PRG }, // 4 Z80 program + + { "ra-ma01-rom1.u57", 0x040000, 0x6EDB2AB8, BRF_SND }, // 5 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(sstriker) +STD_ROM_FN(sstriker) + +static struct BurnRomInfo sstrikraRomDesc[] = { + { "ra-ma-01_01.u65", 0x080000, 0x92259F84, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + + { "ra-ma01-rom2.u2", 0x100000, 0x54E2BD95, BRF_GRA }, // 1 GP9001 Tile data + { "ra-ma01-rom3.u1", 0x100000, 0x21CD378F, BRF_GRA }, // 2 + + { "ra-ma-01_05.u81", 0x008000, 0x88B58841, BRF_GRA }, // 3 Extra text layer tile data + + { "ra-ma-01_02.u66", 0x010000, 0xEABFA46D, BRF_ESS | BRF_PRG }, // 4 Z80 program + + { "ra-ma01-rom1.u57", 0x040000, 0x6EDB2AB8, BRF_SND }, // 5 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(sstrikra) +STD_ROM_FN(sstrikra) + +static struct BurnInputInfo mahoudaiInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, +}; + +STDINPUTINFO(mahoudai) + +static struct BurnDIPInfo mahoudaiDIPList[] = { + // Defaults + {0x14, 0xFF, 0xFF, 0x00, NULL}, + {0x15, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x01, 0x00, "Coin play"}, + {0x14, 0x01, 0x01, 0x01, "Free play"}, + {0, 0xFE, 0, 2, "Screen"}, + {0x14, 0x01, 0x02, 0x00, "Normal"}, + {0x14, 0x01, 0x02, 0x02, "Invert"}, + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x04, 0x00, "Normal mode"}, + {0x14, 0x01, 0x04, 0x04, "Test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x14, 0x01, 0x08, 0x00, "On"}, + {0x14, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, + {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0x30, 0x10, "1 coin 2 plays"}, + {0x14, 0x01, 0x30, 0x20, "2 coins 1 play"}, + {0x14, 0x01, 0x30, 0x30, "2 coins 3 plays"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0xC0, 0x40, "1 coin 2 plays"}, + {0x14, 0x01, 0xC0, 0x80, "2 coins 1 play"}, + {0x14, 0x01, 0xC0, 0xC0, "2 coins 3 plays"}, + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x15, 0x01, 0x03, 0x00, "B (normal)"}, + {0x15, 0x01, 0x03, 0x01, "A (easy)"}, + {0x15, 0x01, 0x03, 0x02, "C (hard)"}, + {0x15, 0x01, 0x03, 0x03, "D (more hard)"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, + {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, + {0x15, 0x01, 0x0C, 0x08, "200000 only"}, + {0x15, 0x01, 0x0C, 0x0C, "No extend"}, + {0, 0xFE, 0, 4, "Number of heroes"}, + {0x15, 0x01, 0x30, 0x00, "3"}, + {0x15, 0x01, 0x30, 0x10, "5"}, + {0x15, 0x01, 0x30, 0x20, "2"}, + {0x15, 0x01, 0x30, 0x30, "1"}, + {0, 0xFE, 0, 2, "No death & stop mode"}, + {0x15, 0x01, 0x40, 0x00, "Off"}, + {0x15, 0x01, 0x40, 0x40, "On"}, + {0, 0xFE, 0, 2, NULL}, + {0x15, 0x01, 0x80, 0x00, "Continue play"}, + {0x15, 0x01, 0x80, 0x80, "Continue impossible"}, +}; + +static struct BurnDIPInfo mahoudaiRegionDIPList[] = { + // Defaults + {0x16, 0xFF, 0x0E, 0x00, NULL}, + + // Region + {0, 0xFE, 0, 1, "Region"}, + {0x16, 0x01, 0x0E, 0x00, "Japan"}, + {0x16, 0x01, 0x0E, 0x02, "U.S.A."}, + {0x16, 0x01, 0x0E, 0x04, "Europe"}, + {0x16, 0x01, 0x0E, 0x06, "South East Asia"}, + {0x16, 0x01, 0x0E, 0x08, "China"}, + {0x16, 0x01, 0x0E, 0x0A, "Korea"}, + {0x16, 0x01, 0x0E, 0x0C, "Hong Kong"}, + {0x16, 0x01, 0x0E, 0x0E, "Taiwan"}, +}; + +static struct BurnDIPInfo sstrikerRegionDIPList[] = { + // Defaults + {0x16, 0xFF, 0x0E, 0x04, NULL}, + + // Region + {0, 0xFE, 0, 7, "Region"}, + {0x16, 0x01, 0x0E, 0x02, "U.S.A."}, + {0x16, 0x01, 0x0E, 0x04, "Europe"}, + {0x16, 0x01, 0x0E, 0x06, "South East Asia"}, + {0x16, 0x01, 0x0E, 0x08, "China"}, + {0x16, 0x01, 0x0E, 0x0A, "Korea"}, + {0x16, 0x01, 0x0E, 0x0C, "Hong Kong"}, + {0x16, 0x01, 0x0E, 0x0E, "Taiwan"}, + {0x16, 0x01, 0x0E, 0x00, "Japan"}, +}; + +STDDIPINFOEXT(mahoudai, mahoudai, mahoudaiRegion) +STDDIPINFOEXT(sstriker, mahoudai, sstrikerRegion) + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *Ram01, *Ram02, *RamPal; + +static INT32 nColCount = 0x0800; +static INT32 nRomADPCMSize = 0x040000; + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x080000; // + RomZ80 = Next; Next += 0x010000; // Z80 ROM + GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data + ExtraTROM = Next; Next += 0x008000; // Extra Text layer tile data + MSM6295ROM = Next; Next += nRomADPCMSize; // ADPCM data + RamStart = Next; + Ram01 = Next; Next += 0x010000; // CPU #0 work RAM + Ram02 = Next; Next += 0x000800; // + ExtraTRAM = Next; Next += 0x002000; // Extra tile layer + ExtraTScroll= Next; Next += 0x001000; // + ExtraTSelect= Next; Next += 0x001000; // + RamPal = Next; Next += 0x001000; // palette + RamZ80 = Next; Next += 0x004000; // Z80 RAM + GP9001RAM[0]= Next; Next += 0x004000; + GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); + RamEnd = Next; + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32* pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029497; + } + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); // scan 68000 states + ZetScan(nAction); // Scan Z80 + + MSM6295Scan(0, nAction); + BurnYM2151Scan(nAction); + + ToaScanGP9001(nAction, pnMin); + + SCAN_VAR(DrvInput); + } + + return 0; +} + +static INT32 LoadRoms() +{ + // Load 68000 ROM + BurnLoadRom(Rom01, 0, 1); + + // Load GP9001 tile data + ToaLoadGP9001Tiles(GP9001ROM[0], 1, 2, nGP9001ROMSize[0]); + + // Load Extra text layer tile data + BurnLoadRom(ExtraTROM, 3, 1); + + // Load the Z80 ROM + BurnLoadRom(RomZ80, 4, 1); + + // Load MSM6295 ADPCM data + BurnLoadRom(MSM6295ROM, 5, 1); + + return 0; +} + +UINT8 __fastcall mahoudaiZ80Read(UINT16 nAddress) +{ +// bprintf(PRINT_NORMAL, "z80 read %4X\n", nAddress); + if (nAddress == 0xE001) { + return BurnYM2151ReadStatus(); + } + if (nAddress == 0xE004) { + return MSM6295ReadStatus(0); + } + return 0; +} + +void __fastcall mahoudaiZ80Write(UINT16 nAddress, UINT8 nValue) +{ +// bprintf(PRINT_NORMAL, "Z80 attempted to write address %04X with value %02X.\n", nAddress, nValue); + + switch (nAddress) { + case 0xE000: + BurnYM2151SelectRegister(nValue); + break; + case 0xE001: + BurnYM2151WriteRegister(nValue); + break; + case 0xE004: + MSM6295Command(0, nValue); +// bprintf(PRINT_NORMAL, "OKI M6295 command %02X sent\n", nValue); + break; + } +} + +static INT32 DrvZ80Init() +{ + // Init the Z80 + ZetInit(0); + ZetOpen(0); + + ZetSetReadHandler(mahoudaiZ80Read); + ZetSetWriteHandler(mahoudaiZ80Write); + + // ROM + ZetMapArea (0x0000, 0xBFFF, 0, RomZ80); // Direct Read from ROM + ZetMapArea (0x0000, 0xBFFF, 2, RomZ80); // Direct Fetch from ROM + // RAM + ZetMapArea (0xC000, 0xDFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0xC000, 0xDFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0xC000, 0xDFFF, 2, RamZ80); // + // Callbacks + ZetMemCallback(0xE000, 0xE0FF, 0); // Read + ZetMemCallback(0xE000, 0xE0FF, 1); // Write + + ZetClose(); + + return 0; +} + +UINT8 __fastcall mahoudaiReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x21C021: // Player 1 inputs + return DrvInput[0]; + case 0x21C025: // Player 2 inputs + return DrvInput[1]; + case 0x21C029: // Other inputs + return DrvInput[2]; + case 0x21C02D: // Dipswitch A + return DrvInput[3]; + case 0x21C031: // Dipswitch B + return DrvInput[4]; + case 0x21C035: // Dipswitch C - Territory + return DrvInput[5]; + + case 0x30000D: + return ToaVBlankRegister(); + + default: { + if ((sekAddress & 0x00FFC000) == 0x00218000) { + return RamZ80[(sekAddress & 0x3FFF) >> 1]; + } + +// bprintf(PRINT_NORMAL, "Attempt to read byte value of location %x\n", sekAddress); + } + } + return 0; +} + +UINT16 __fastcall mahoudaiReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x21C020: // Player 1 inputs + return DrvInput[0]; + case 0x21C024: // Player 2 inputs + return DrvInput[1]; + case 0x21C028: // Other inputs + return DrvInput[2]; + case 0x21C02C: // Dipswitch A + return DrvInput[3]; + case 0x21C030: // Dipswitch B + return DrvInput[4]; + case 0x21C034: // Dipswitch C - Territory + return DrvInput[5]; + + case 0x21C03C: + return ToaScanlineRegister(); + + case 0x300004: + return ToaGP9001ReadRAM_Hi(0); + case 0x300006: + return ToaGP9001ReadRAM_Lo(0); + + case 0x30000C: + return ToaVBlankRegister(); + + default: { + if ((sekAddress & 0x00FFC000) == 0x00218000) { + return RamZ80[(sekAddress & 0x3FFF) >> 1]; + } + +// bprintf(PRINT_NORMAL, "Attempt to read word value of location %x\n", sekAddress); + } + } + return 0; +} + +void __fastcall mahoudaiWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ +// switch (sekAddress) { + +// default: { +// bprintf(PRINT_NORMAL, "Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + + if ((sekAddress & 0x00FFC000) == 0x00218000) { + RamZ80[(sekAddress & 0x3FFF) >> 1] = byteValue; + } +// } +// } +} + +void __fastcall mahoudaiWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + + case 0x300000: // Set GP9001 VRAM address-pointer + ToaGP9001SetRAMPointer(wordValue); + break; + + case 0x300004: + ToaGP9001WriteRAM(wordValue, 0); + break; + case 0x300006: + ToaGP9001WriteRAM(wordValue, 0); + break; + + case 0x300008: + ToaGP9001SelectRegister(wordValue); + break; + + case 0x30000C: + ToaGP9001WriteRegister(wordValue); + break; + + default: { +// bprintf(PRINT_NORMAL, "Attempt to write word value %x to location %x\n", wordValue, sekAddress); + + if ((sekAddress & 0x00FFC000) == 0x00218000) { + RamZ80[(sekAddress & 0x3FFF) >> 1] = wordValue; + } + } + } +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM2151Reset(); + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + +#ifdef DRIVER_ROTATION + bToaRotateScreen = true; +#endif + + nGP9001ROMSize[0] = 0x200000; + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x07FFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x100000, 0x10FFFF, SM_RAM); + SekMapMemory(RamPal, 0x400000, 0x400FFF, SM_RAM); // Palette RAM + SekMapMemory(Ram02, 0x401000, 0x4017FF, SM_RAM); // Unused + SekMapMemory(ExtraTRAM, 0x500000, 0x502FFF, SM_RAM); + SekMapMemory(ExtraTSelect, 0x502000, 0x502FFF, SM_RAM); // 0x502000 - Scroll; 0x502200 - RAM + SekMapMemory(ExtraTScroll, 0x503000, 0x503FFF, SM_RAM); // 0x203000 - Offset; 0x503200 - RAM + + SekSetReadWordHandler(0, mahoudaiReadWord); + SekSetReadByteHandler(0, mahoudaiReadByte); + SekSetWriteWordHandler(0, mahoudaiWriteWord); + SekSetWriteByteHandler(0, mahoudaiWriteByte); + + SekClose(); + } + + nSpritePriority = 1; + ToaInitGP9001(); + + ToaExtraTextInit(); + + DrvZ80Init(); // Initialize Z80 + + nToaPalLen = nColCount; + ToaPalSrc = RamPal; + ToaPalInit(); + + BurnYM2151Init(27000000 / 8); + BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + MSM6295Init(0, 32000000 / 32 / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + return 0; +} + +static INT32 DrvExit() +{ + MSM6295Exit(0); + BurnYM2151Exit(); + + ToaPalExit(); + + ToaExitGP9001(); + ToaExtraTextExit(); + ToaZExit(); // Z80 exit + SekExit(); // Deallocate 68000s + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderGP9001(); // Render GP9001 graphics + ToaExtraTextLayer(); // Render extra text layer + } + + ToaPalUpdate(); // Update the palette + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 4; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x00; // Buttons + DrvInput[1] = 0x00; // Player 1 + DrvInput[2] = 0x00; // Player 2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[2] |= (DrvButton[i] & 1) << i; + } + ToaClearOpposites(&DrvInput[0]); + ToaClearOpposites(&DrvInput[1]); + + SekNewFrame(); + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = TOA_Z80_SPEED / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekOpen(0); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + INT32 nSoundBufferPos = 0; + + ZetOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU; + INT32 nNext; + + // Run 68000 + + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + + // Trigger VBlank interrupt + if (nNext > nToaCyclesVBlankStart) { + if (nCyclesDone[nCurrentCPU] < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } + + ToaBufferGP9001Sprites(); + + bVBlank = true; + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (bVBlank || (!CheckSleep(nCurrentCPU))) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + + // Run Z80 + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + + { + // Render sound segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + } + + { + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + } + + SekClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); // Draw screen if needed + } + + return 0; +} + +struct BurnDriver BurnDrvMahouDai = { + "mahoudai", "sstriker", NULL, NULL, "1993", + "Mahou Daisakusen (Japan)\0", NULL, "Raizing", "Toaplan GP9001 based", + L"\u9B54\u6CD5\u5927\u4F5C\u6226\0Mahou Daisakusen (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, mahoudaiRomInfo, mahoudaiRomName, NULL, NULL, mahoudaiInputInfo, mahoudaiDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvSStriker = { + "sstriker", NULL, NULL, NULL, "1993", + "Sorcer Striker (World)\0", NULL, "Raizing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, sstrikerRomInfo, sstrikerRomName, NULL, NULL, mahoudaiInputInfo, sstrikerDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvSStrikrA = { + "sstrikera", "sstriker", NULL, NULL, "1993", + "Sorcer Striker (World, alt)\0", NULL, "Raizing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, sstrikraRomInfo, sstrikraRomName, NULL, NULL, mahoudaiInputInfo, sstrikerDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + diff --git a/src/burn/drv/toaplan/d_outzone.cpp b/src/burn/drv/toaplan/d_outzone.cpp index 8cd9a5682..61419c472 100644 --- a/src/burn/drv/toaplan/d_outzone.cpp +++ b/src/burn/drv/toaplan/d_outzone.cpp @@ -1,1016 +1,1015 @@ -// Out Zone - -#include "toaplan.h" - -#define REFRESHRATE ((28000000.0 / 4.0) / (450.0 * 282.0)) -#define VBLANK_LINES (32) - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static bool bEnableInterrupts; - -// Rom information -static struct BurnRomInfo outzoneRomDesc[] = { - { "tp018_7.bin", 0x020000, 0x0c2ac02d, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "tp018_8.bin", 0x020000, 0xca7e48aa, BRF_ESS | BRF_PRG }, // 1 - - { "rom5.bin", 0x080000, 0xC64EC7B6, BRF_GRA }, // 2 Tile data - { "rom6.bin", 0x080000, 0x64B6C5AC, BRF_GRA }, // 3 - - { "rom2.bin", 0x020000, 0x6BB72D16, BRF_GRA }, // 4 - { "rom1.bin", 0x020000, 0x0934782D, BRF_GRA }, // 5 - { "rom3.bin", 0x020000, 0xEC903C07, BRF_GRA }, // 6 - { "rom4.bin", 0x020000, 0x50CBF1A8, BRF_GRA }, // 7 - - { "rom9.bin", 0x008000, 0x73D8E235, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "tp018_10.bpr", 0x000020, 0xBC88CCED, BRF_SND }, // 9 Sprite attribute PROM - { "tp018_11.bpr", 0x000020, 0xA1E17492, BRF_SND }, // 10 ??? -}; - - -STD_ROM_PICK(outzone) -STD_ROM_FN(outzone) - -static struct BurnRomInfo outzonebRomDesc[] = { - { "rom7.bin", 0x020000, 0x936E25D8, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "rom8.bin", 0x020000, 0xD19B3ECF, BRF_ESS | BRF_PRG }, // 1 - - { "rom5.bin", 0x080000, 0xC64EC7B6, BRF_GRA }, // 2 Tile data - { "rom6.bin", 0x080000, 0x64B6C5AC, BRF_GRA }, // 3 - - { "rom2.bin", 0x020000, 0x6BB72D16, BRF_GRA }, // 4 - { "rom1.bin", 0x020000, 0x0934782D, BRF_GRA }, // 5 - { "rom3.bin", 0x020000, 0xEC903C07, BRF_GRA }, // 6 - { "rom4.bin", 0x020000, 0x50CBF1A8, BRF_GRA }, // 7 - - { "rom9.bin", 0x008000, 0x73D8E235, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "tp018_10.bpr", 0x000020, 0xBC88CCED, BRF_SND }, // 9 Sprite attribute PROM - { "tp018_11.bpr", 0x000020, 0xA1E17492, BRF_SND }, // 10 ??? -}; - - -STD_ROM_PICK(outzoneb) -STD_ROM_FN(outzoneb) - -static struct BurnRomInfo outzoneaRomDesc[] = { - { "18.bin", 0x020000, 0x31A171BB, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "19.bin", 0x020000, 0x804ECFD1, BRF_ESS | BRF_PRG }, // 1 - - { "rom5.bin", 0x080000, 0xC64EC7B6, BRF_GRA }, // 2 Tile data - { "rom6.bin", 0x080000, 0x64B6C5AC, BRF_GRA }, // 3 - - { "rom2.bin", 0x020000, 0x6BB72D16, BRF_GRA }, // 4 - { "rom1.bin", 0x020000, 0x0934782D, BRF_GRA }, // 5 - { "rom3.bin", 0x020000, 0xEC903C07, BRF_GRA }, // 6 - { "rom4.bin", 0x020000, 0x50CBF1A8, BRF_GRA }, // 7 - - { "rom9.bin", 0x008000, 0x73D8E235, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "tp018_10.bpr", 0x000020, 0xBC88CCED, BRF_SND }, // 9 Sprite attribute PROM - { "tp018_11.bpr", 0x000020, 0xA1E17492, BRF_SND }, // 10 ??? -}; - - -STD_ROM_PICK(outzonea) -STD_ROM_FN(outzonea) - -static struct BurnRomInfo outzonecRomDesc[] = { - { "prg1.bin", 0x020000, 0x127a38d7, BRF_ESS | BRF_PRG }, // 1 - { "prg2.bin", 0x020000, 0x9704db16, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - - { "rom5.bin", 0x080000, 0xC64EC7B6, BRF_GRA }, // 2 Tile data - { "rom6.bin", 0x080000, 0x64B6C5AC, BRF_GRA }, // 3 - - { "rom2.bin", 0x020000, 0x6BB72D16, BRF_GRA }, // 4 - { "rom1.bin", 0x020000, 0x0934782D, BRF_GRA }, // 5 - { "rom3.bin", 0x020000, 0xEC903C07, BRF_GRA }, // 6 - { "rom4.bin", 0x020000, 0x50CBF1A8, BRF_GRA }, // 7 - - { "rom9.bin", 0x008000, 0x73D8E235, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "tp018_10.bpr", 0x000020, 0xBC88CCED, BRF_SND }, // 9 Sprite attribute PROM - { "tp018_11.bpr", 0x000020, 0xA1E17492, BRF_SND }, // 10 ??? -}; - - -STD_ROM_PICK(outzonec) -STD_ROM_FN(outzonec) - -static struct BurnRomInfo outzonedRomDesc[] = { - { "tp07.bin", 0x020000, 0xa85a1d48, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "tp08.bin", 0x020000, 0xd8cc44af, BRF_ESS | BRF_PRG }, // 1 - - { "rom5.bin", 0x080000, 0xC64EC7B6, BRF_GRA }, // 2 Tile data - { "rom6.bin", 0x080000, 0x64B6C5AC, BRF_GRA }, // 3 - - { "rom2.bin", 0x020000, 0x6BB72D16, BRF_GRA }, // 4 - { "rom1.bin", 0x020000, 0x0934782D, BRF_GRA }, // 5 - { "rom3.bin", 0x020000, 0xEC903C07, BRF_GRA }, // 6 - { "rom4.bin", 0x020000, 0x50CBF1A8, BRF_GRA }, // 7 - - { "tp09.bin", 0x008000, 0xdd56041f, BRF_ESS | BRF_PRG }, // 8 Z80 program - - { "tp018_10.bpr", 0x000020, 0xBC88CCED, BRF_SND }, // 9 Sprite attribute PROM - { "tp018_11.bpr", 0x000020, 0xA1E17492, BRF_SND }, // 10 ??? -}; - - -STD_ROM_PICK(outzoned) -STD_ROM_FN(outzoned) - -static struct BurnInputInfo outzoneInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 2, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, -}; - -STDINPUTINFO(outzone) - -static struct BurnDIPInfo outzoneDIPList[] = { - // Defaults - {0x14, 0xFF, 0xFF, 0x00, NULL}, - {0x15, 0xFF, 0xFF, 0x00, NULL}, - {0x16, 0xFF, 0xFF, 0x02, NULL}, - // DIP 1 - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x02, 0x00, "Normal screen"}, - {0x14, 0x01, 0x02, 0x02, "Invert screen"}, - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x04, 0x00, "Normal mode"}, - {0x14, 0x01, 0x04, 0x04, "Screen test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x14, 0x01, 0x08, 0x00, "On"}, - {0x14, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, -#if 1 - // Coinage for Europe - {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0x30, 0x10, "2 coin 1 play"}, - {0x14, 0x01, 0x30, 0x20, "3 coin 1 play"}, - {0x14, 0x01, 0x30, 0x30, "4 coin 1 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0xC0, 0x40, "1 coin 3 play"}, - {0x14, 0x01, 0xC0, 0x80, "1 coin 4 play"}, - {0x14, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, -#else - // Coinage for Japan - {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0x30, 0x10, "1 coin 2 play"}, - {0x14, 0x01, 0x30, 0x20, "2 coin 1 play"}, - {0x14, 0x01, 0x30, 0x30, "3 coin 2 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0xC0, 0x40, "1 coin 2 play"}, - {0x14, 0x01, 0xC0, 0x80, "2 coin 1 play"}, - {0x14, 0x01, 0xC0, 0xC0, "3 coin 2 play"}, -#endif - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x15, 0x01, 0x03, 0x00, "B"}, - {0x15, 0x01, 0x03, 0x01, "A"}, - {0x15, 0x01, 0x03, 0x02, "C"}, - {0x15, 0x01, 0x03, 0x03, "D"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, - {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, - {0x15, 0x01, 0x0C, 0x08, "300000 only"}, - {0x15, 0x01, 0x0C, 0x0C, "No extend"}, - {0, 0xFE, 0, 4, "Number of heros"}, - {0x15, 0x01, 0x30, 0x00, "3"}, - {0x15, 0x01, 0x30, 0x10, "5"}, - {0x15, 0x01, 0x30, 0x20, "2"}, - {0x15, 0x01, 0x30, 0x30, "1"}, - {0, 0xFE, 0, 2, "No death & stop mode"}, - {0x15, 0x01, 0x40, 0x00, "Off"}, - {0x15, 0x01, 0x40, 0x40, "On"}, - - // Region - {0, 0xFE, 0, 9, "Region"}, - {0x16, 0x01, 0x0F, 0x00, "Japan"}, - {0x16, 0x01, 0x0F, 0x01, "U.S.A."}, - {0x16, 0x01, 0x0F, 0x02, "Europe"}, - {0x16, 0x01, 0x0F, 0x03, "Hong Kong"}, - {0x16, 0x01, 0x0F, 0x04, "Korea"}, - {0x16, 0x01, 0x0F, 0x05, "Taiwan"}, - {0x16, 0x01, 0x0F, 0x06, "Taiwan (Spacy License)"}, - {0x16, 0x01, 0x0F, 0x07, "US (Romstar License)"}, - {0x16, 0x01, 0x0F, 0x08, "Hong Kong (Honest Trading License)"}, - -}; - -STDDIPINFO(outzone) - -static struct BurnDIPInfo outzonebDIPList[] = { - // Defaults - {0x14, 0xFF, 0xFF, 0x00, NULL}, - {0x15, 0xFF, 0xFF, 0x00, NULL}, - {0x16, 0xFF, 0xFF, 0x02, NULL}, - // DIP 1 - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x02, 0x00, "Normal screen"}, - {0x14, 0x01, 0x02, 0x02, "Invert screen"}, - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x04, 0x00, "Normal mode"}, - {0x14, 0x01, 0x04, 0x04, "Screen test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x14, 0x01, 0x08, 0x00, "On"}, - {0x14, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, -#if 1 - // Coinage for Europe - {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0x30, 0x10, "2 coin 1 play"}, - {0x14, 0x01, 0x30, 0x20, "3 coin 1 play"}, - {0x14, 0x01, 0x30, 0x30, "4 coin 1 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0xC0, 0x40, "1 coin 3 play"}, - {0x14, 0x01, 0xC0, 0x80, "1 coin 4 play"}, - {0x14, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, -#else - // Coinage for Japan - {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0x30, 0x10, "1 coin 2 play"}, - {0x14, 0x01, 0x30, 0x20, "2 coin 1 play"}, - {0x14, 0x01, 0x30, 0x30, "3 coin 2 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0xC0, 0x40, "1 coin 2 play"}, - {0x14, 0x01, 0xC0, 0x80, "2 coin 1 play"}, - {0x14, 0x01, 0xC0, 0xC0, "3 coin 2 play"}, -#endif - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x15, 0x01, 0x03, 0x00, "B"}, - {0x15, 0x01, 0x03, 0x01, "A"}, - {0x15, 0x01, 0x03, 0x02, "C"}, - {0x15, 0x01, 0x03, 0x03, "D"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, - {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, - {0x15, 0x01, 0x0C, 0x08, "300000 only"}, - {0x15, 0x01, 0x0C, 0x0C, "No extend"}, - {0, 0xFE, 0, 4, "Number of heros"}, - {0x15, 0x01, 0x30, 0x00, "3"}, - {0x15, 0x01, 0x30, 0x10, "5"}, - {0x15, 0x01, 0x30, 0x20, "2"}, - {0x15, 0x01, 0x30, 0x30, "1"}, - {0, 0xFE, 0, 2, "No death & stop mode"}, - {0x15, 0x01, 0x40, 0x00, "Off"}, - {0x15, 0x01, 0x40, 0x40, "On"}, - - // Region - {0, 0xFE, 0, 8, "Region"}, - {0x16, 0x01, 0x0F, 0x00, "Japan"}, - {0x16, 0x01, 0x0F, 0x01, "U.S.A."}, - {0x16, 0x01, 0x0F, 0x02, "Europe"}, - {0x16, 0x01, 0x0F, 0x03, "Hong Kong"}, - {0x16, 0x01, 0x0F, 0x04, "Korea"}, - {0x16, 0x01, 0x0F, 0x05, "Taiwan"}, - {0x16, 0x01, 0x0F, 0x06, "No Warning screen"}, - {0x16, 0x01, 0x0F, 0x07, "No Warning screen"}, - - -}; - -STDDIPINFO(outzoneb) - -static struct BurnDIPInfo outzonecDIPList[] = { - // Defaults - {0x14, 0xFF, 0xFF, 0x00, NULL}, - {0x15, 0xFF, 0xFF, 0x00, NULL}, - {0x16, 0xFF, 0xFF, 0x02, NULL}, - // DIP 1 - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x02, 0x00, "Normal screen"}, - {0x14, 0x01, 0x02, 0x02, "Invert screen"}, - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x04, 0x00, "Normal mode"}, - {0x14, 0x01, 0x04, 0x04, "Screen test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x14, 0x01, 0x08, 0x00, "On"}, - {0x14, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, -#if 1 - // Coinage for Europe - {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0x30, 0x10, "2 coin 1 play"}, - {0x14, 0x01, 0x30, 0x20, "3 coin 1 play"}, - {0x14, 0x01, 0x30, 0x30, "4 coin 1 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0xC0, 0x40, "1 coin 3 play"}, - {0x14, 0x01, 0xC0, 0x80, "1 coin 4 play"}, - {0x14, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, -#else - // Coinage for Japan - {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0x30, 0x10, "1 coin 2 play"}, - {0x14, 0x01, 0x30, 0x20, "2 coin 1 play"}, - {0x14, 0x01, 0x30, 0x30, "3 coin 2 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0xC0, 0x40, "1 coin 2 play"}, - {0x14, 0x01, 0xC0, 0x80, "2 coin 1 play"}, - {0x14, 0x01, 0xC0, 0xC0, "3 coin 2 play"}, -#endif - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x15, 0x01, 0x03, 0x00, "B"}, - {0x15, 0x01, 0x03, 0x01, "A"}, - {0x15, 0x01, 0x03, 0x02, "C"}, - {0x15, 0x01, 0x03, 0x03, "D"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, - {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, - {0x15, 0x01, 0x0C, 0x08, "300000 only"}, - {0x15, 0x01, 0x0C, 0x0C, "No extend"}, - {0, 0xFE, 0, 4, "Number of heros"}, - {0x15, 0x01, 0x30, 0x00, "3"}, - {0x15, 0x01, 0x30, 0x10, "5"}, - {0x15, 0x01, 0x30, 0x20, "2"}, - {0x15, 0x01, 0x30, 0x30, "1"}, - {0, 0xFE, 0, 2, "No death & stop mode"}, - {0x15, 0x01, 0x40, 0x00, "Off"}, - {0x15, 0x01, 0x40, 0x40, "On"}, - - // Region - {0, 0xFE, 0, 9, "Region"}, - {0x16, 0x01, 0x0F, 0x00, "Japan"}, - {0x16, 0x01, 0x0F, 0x01, "U.S.A."}, - {0x16, 0x01, 0x0F, 0x02, "Europe"}, - {0x16, 0x01, 0x0F, 0x03, "Hong Kong"}, - {0x16, 0x01, 0x0F, 0x04, "Korea"}, - {0x16, 0x01, 0x0F, 0x05, "Taiwan"}, - {0x16, 0x01, 0x0F, 0x06, "Taiwan (Spacy Co License)"}, - {0x16, 0x01, 0x0F, 0x07, "US (Romstar License)"}, - {0x16, 0x01, 0x0F, 0x08, "Hong Kong & China (Honest Trading License)"}, - -}; - -STDDIPINFO(outzonec) - -static struct BurnDIPInfo outzonedDIPList[] = { - // Defaults - {0x14, 0xFF, 0xFF, 0x00, NULL}, - {0x15, 0xFF, 0xFF, 0x00, NULL}, - {0x16, 0xFF, 0xFF, 0x02, NULL}, - // DIP 1 - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x02, 0x00, "Normal screen"}, - {0x14, 0x01, 0x02, 0x02, "Invert screen"}, - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x04, 0x00, "Normal mode"}, - {0x14, 0x01, 0x04, 0x04, "Screen test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x14, 0x01, 0x08, 0x00, "On"}, - {0x14, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, -#if 1 - // Coinage for Europe - {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0x30, 0x10, "2 coin 1 play"}, - {0x14, 0x01, 0x30, 0x20, "3 coin 1 play"}, - {0x14, 0x01, 0x30, 0x30, "4 coin 1 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x14, 0x01, 0xC0, 0x00, "1 coin 2 play"}, - {0x14, 0x01, 0xC0, 0x40, "1 coin 3 play"}, - {0x14, 0x01, 0xC0, 0x80, "1 coin 4 play"}, - {0x14, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, -#else - // Coinage for Japan - {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0x30, 0x10, "1 coin 2 play"}, - {0x14, 0x01, 0x30, 0x20, "2 coin 1 play"}, - {0x14, 0x01, 0x30, 0x30, "3 coin 2 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0xC0, 0x40, "1 coin 2 play"}, - {0x14, 0x01, 0xC0, 0x80, "2 coin 1 play"}, - {0x14, 0x01, 0xC0, 0xC0, "3 coin 2 play"}, -#endif - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x15, 0x01, 0x03, 0x00, "B"}, - {0x15, 0x01, 0x03, 0x01, "A"}, - {0x15, 0x01, 0x03, 0x02, "C"}, - {0x15, 0x01, 0x03, 0x03, "D"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, - {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, - {0x15, 0x01, 0x0C, 0x08, "300000 only"}, - {0x15, 0x01, 0x0C, 0x0C, "No extend"}, - {0, 0xFE, 0, 4, "Number of heros"}, - {0x15, 0x01, 0x30, 0x00, "3"}, - {0x15, 0x01, 0x30, 0x10, "5"}, - {0x15, 0x01, 0x30, 0x20, "2"}, - {0x15, 0x01, 0x30, 0x30, "1"}, - {0, 0xFE, 0, 2, "No death & stop mode"}, - {0x15, 0x01, 0x40, 0x00, "Off"}, - {0x15, 0x01, 0x40, 0x40, "On"}, - - // Region - {0, 0xFE, 0, 9, "Region"}, - {0x16, 0x01, 0x0F, 0x00, "Japan"}, - {0x16, 0x01, 0x0F, 0x01, "U.S.A."}, - {0x16, 0x01, 0x0F, 0x02, "Europe"}, - {0x16, 0x01, 0x0F, 0x03, "Hong Kong"}, - {0x16, 0x01, 0x0F, 0x04, "Korea"}, - {0x16, 0x01, 0x0F, 0x05, "Taiwan"}, - {0x16, 0x01, 0x0F, 0x06, "Taiwan (Spacy Co License)"}, - {0x16, 0x01, 0x0F, 0x07, "US (Romstar License)"}, - {0x16, 0x01, 0x0F, 0x08, "Hong Kong & China (Honest Trading License)"}, - -}; - -STDDIPINFO(outzoned) - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *Ram01, *RamPal, *RamPal2; - -static INT32 nColCount = 0x0400; - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x040000; // - RomZ80 = Next; Next += 0x008000; // Z80 ROM - BCU2ROM = Next; Next += nBCU2ROMSize; // BCU-2 tile data - FCU2ROM = Next; Next += nFCU2ROMSize; // FCU-2 tile data - RamStart = Next; - Ram01 = Next; Next += 0x004000; // CPU #0 work RAM - RamPal = Next; Next += 0x001000; // palette - RamPal2 = Next; Next += 0x001000; // palette - RamZ80 = Next; Next += 0x008000; // Z80 RAM - BCU2RAM = Next; Next += 0x010000; - FCU2RAM = Next; Next += 0x000800; - FCU2RAMSize = Next; Next += 0x000080; - RamEnd = Next; - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32* pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029402; - } - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); // scan 68000 states - ZetScan(nAction); // Scan Z80 - - BurnYM3812Scan(nAction, pnMin); - - SCAN_VAR(DrvInput); - SCAN_VAR(nCyclesDone); - } - - return 0; -} - -static INT32 LoadRoms() -{ - // Load 68000 ROM - ToaLoadCode(Rom01, 0, 2); - - // Load BCU-2 tile data - ToaLoadGP9001Tiles(BCU2ROM, 2, 2, nBCU2ROMSize); - - // Load FCU-2 tile data - ToaLoadTiles(FCU2ROM, 4, nFCU2ROMSize); - - // Load the Z80 ROM - BurnLoadRom(RomZ80, 8, 1); - - return 0; -} - -UINT8 __fastcall outzoneZ80In(UINT16 nAddress) -{ -// bprintf(PRINT_NORMAL, _T("z80 read %4X\n"), nAddress); - - nAddress &= 0xFF; - - switch (nAddress) { - case 0x00: - return BurnYM3812Read(0); - case 0x08: // DIP A - return DrvInput[2]; - case 0x0C: // DIP B - return DrvInput[3]; - case 0x10: // Sysytem inputs - return DrvInput[4] | (ToaVBlankRegister() << 7); - case 0x14: // Player 1 - return DrvInput[0]; - case 0x18: // Player 2 - return DrvInput[1]; - case 0x1C: // Region - return DrvInput[5]; - - } - - return 0; -} - -void __fastcall outzoneZ80Out(UINT16 nAddress, UINT8 nValue) -{ -// bprintf(PRINT_NORMAL, _T("Z80 attempted to write address %04X with value %02X.\n"), nAddress, nValue); - - nAddress &= 0xFF; - - switch (nAddress) { - case 0x00: - BurnYM3812Write(0, nValue); - break; - case 0x01: - BurnYM3812Write(1, nValue); - break; - - case 0x04: // Coin counter - break; - } -} - -static INT32 DrvZ80Init() -{ - // Init the Z80 - ZetInit(0); - ZetOpen(0); - - ZetSetInHandler(outzoneZ80In); - ZetSetOutHandler(outzoneZ80Out); - - // ROM - ZetMapArea (0x0000, 0x7FFF, 0, RomZ80); // Direct Read from ROM - ZetMapArea (0x0000, 0x7FFF, 2, RomZ80); // Direct Fetch from ROM - // RAM - ZetMapArea (0x8000, 0xFFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0x8000, 0xFFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0x8000, 0xFFFF, 2, RamZ80); // - - ZetMemEnd(); - - ZetClose(); - - return 0; -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall outzoneReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x100001: - case 0x300001: - return ToaVBlankRegister(); - - default: { -// printf("Attempt to read byte value of location %x\n", sekAddress); - } - } - - return 0; -} - -UINT16 __fastcall outzoneReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x100002: - return ToaFCU2GetRAMPointer(); - case 0x100004: - return ToaFCU2ReadRAM(); - case 0x100006: - return ToaFCU2ReadRAMSize(); - - case 0x200002: - return ToaBCU2GetRAMPointer(); - case 0x200004: - return ToaBCU2ReadRAM_Hi(); - case 0x200006: - return ToaBCU2ReadRAM_Lo(); - - case 0x200010: - case 0x200011: - case 0x200012: - case 0x200013: - case 0x200014: - case 0x200015: - case 0x200016: - case 0x200017: - case 0x200018: - case 0x200019: - case 0x20001A: - case 0x20001B: - case 0x20001C: - case 0x20001D: - case 0x20001E: - case 0x20001F: - return BCU2Reg[(sekAddress & 15) >> 1]; - - case 0x100000: - case 0x300000: - return ToaVBlankRegister(); - - default: { -// printf("Attempt to read word value of location %x\n", sekAddress); - } - } - - return 0; -} - -void __fastcall outzoneWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - - case 0x300003: - bEnableInterrupts = byteValue; - break; - - case 0x100006: - ToaFCU2WriteRAMSize(byteValue); - break; - - default: { -// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } - } -} - -void __fastcall outzoneWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - - case 0x100002: // FCU-2 set VRAM address-pointer - ToaFCU2SetRAMPointer(wordValue); - break; - case 0x100004: - ToaFCU2WriteRAM(wordValue); - break; - case 0x100006: - ToaFCU2WriteRAMSize(wordValue); - break; - - case 0x200000: // BCU-2 flip - break; - case 0x200002: // BCU-2 set VRAM address-pointer - ToaBCU2SetRAMPointer(wordValue); - break; - case 0x200004: - ToaBCU2WriteRAM(wordValue); - break; - case 0x200006: - ToaBCU2WriteRAM(wordValue); - break; - - case 0x200010: - case 0x200011: - case 0x200012: - case 0x200013: - case 0x200014: - case 0x200015: - case 0x200016: - case 0x200017: - case 0x200018: - case 0x200019: - case 0x20001A: - case 0x20001B: - case 0x20001C: - case 0x20001D: - case 0x20001E: - case 0x20001F: - BCU2Reg[(sekAddress & 15) >> 1] = wordValue; - break; - - case 0x300002: - bEnableInterrupts = (wordValue & 0xFF); - break; - - case 0x340000: - nBCU2TileXOffset = wordValue; - break; - case 0x340002: - nBCU2TileYOffset = wordValue; - break; - - case 0x340006: // FCU-2 flip - break; - - default: { -// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); - } - } -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - - bEnableInterrupts = false; - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - -#ifdef DRIVER_ROTATION - bToaRotateScreen = true; -#endif - - BurnSetRefreshRate(REFRESHRATE); - - nBCU2ROMSize = 0x100000; - nFCU2ROMSize = 0x080000; - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x03FFFF, SM_ROM); // 68K ROM - SekMapMemory(Ram01, 0x240000, 0x243FFF, SM_RAM); // 68K RAM - SekMapMemory(RamPal, 0x304000, 0x3047FF, SM_RAM); // BCU-2 palette RAM - SekMapMemory(RamPal2, 0x306000, 0x3067FF, SM_RAM); // FCU-2 palette RAM - - SekSetReadWordHandler(0, outzoneReadWord); - SekSetReadByteHandler(0, outzoneReadByte); - SekSetWriteWordHandler(0, outzoneWriteWord); - SekSetWriteByteHandler(0, outzoneWriteByte); - - SekMapHandler(1, 0x140000, 0x140FFF, SM_RAM); // Z80 RAM - - SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); - SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); - SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); - SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); - - SekClose(); - } - - ToaInitBCU2(); - - DrvZ80Init(); // Initialize Z80 - - nToaPalLen = nColCount; - ToaPalSrc = RamPal; - ToaPalSrc2 = RamPal2; - ToaPalInit(); - - BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); - BurnTimerAttachZetYM3812(28000000 / 8); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - return 0; -} - -static INT32 DrvExit() -{ - BurnYM3812Exit(); - ToaPalExit(); - - ToaExitBCU2(); - ToaZExit(); // Z80 exit - SekExit(); // Deallocate 68000s - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0x120); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderBCU2(); // Render BCU2 graphics - } - - ToaPalUpdate(); // Update the palette - ToaPal2Update(); - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 4; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x00; // Buttons - DrvInput[1] = 0x00; // Player 1 - DrvInput[4] = 0x00; // Player 2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[4] |= (DrvButton[i] & 1) << i; - } - ToaClearOpposites(&DrvInput[0]); - ToaClearOpposites(&DrvInput[1]); - - SekOpen(0); - ZetOpen(0); - - SekNewFrame(); - ZetNewFrame(); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); - nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext; - - // Run 68000 - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - - // Trigger VBlank interrupt - if (nNext > nToaCyclesVBlankStart) { - if (SekTotalCycles() < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); - SekRun(nCyclesSegment); - } - - if (pBurnDraw) { - DrvDraw(); // Draw screen if needed - } - - ToaBufferFCU2Sprites(); - - bVBlank = true; - if (bEnableInterrupts) { - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - } - - nCyclesSegment = nNext - SekTotalCycles(); - if (bVBlank || (!CheckSleep(0))) { // See if this CPU is busywaiting - SekRun(nCyclesSegment); - } else { - SekIdle(nCyclesSegment); - } - - BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); - } - - nToa1Cycles68KSync = SekTotalCycles(); - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; - -// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); - - ZetClose(); - SekClose(); - -// ToaBufferFCU2Sprites(); - - return 0; -} - -struct BurnDriver BurnDrvOutZone = { - "outzone", NULL, NULL, NULL, "1990", - "Out Zone (set 1)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, outzoneRomInfo, outzoneRomName, NULL, NULL, outzoneInputInfo, outzoneDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvOutZonea = { - "outzonea", "outzone", NULL, NULL, "1990", - "Out Zone (set 2)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, outzoneaRomInfo, outzoneaRomName, NULL, NULL, outzoneInputInfo, outzoneDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvOutZoneb = { - "outzoneb", "outzone", NULL, NULL, "1990", - "Out Zone (set 3, prototype?)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, outzonebRomInfo, outzonebRomName, NULL, NULL, outzoneInputInfo, outzonebDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvOutZonec = { - "outzonec", "outzone", NULL, NULL, "1990", - "Out Zone (set 4)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, outzonecRomInfo, outzonecRomName, NULL, NULL, outzoneInputInfo, outzonecDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvOutZoned = { - "outzoned", "outzone", NULL, NULL, "1990", - "Out Zone (set 5)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, outzonedRomInfo, outzonedRomName, NULL, NULL, outzoneInputInfo, outzonedDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 240, 320, 3, 4 -}; +// Out Zone + +#include "toaplan.h" + +#define REFRESHRATE ((28000000.0 / 4.0) / (450.0 * 282.0)) +#define VBLANK_LINES (32) + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static bool bEnableInterrupts; + +// Rom information +static struct BurnRomInfo outzoneRomDesc[] = { + { "tp018_7.bin", 0x020000, 0x0c2ac02d, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "tp018_8.bin", 0x020000, 0xca7e48aa, BRF_ESS | BRF_PRG }, // 1 + + { "rom5.bin", 0x080000, 0xC64EC7B6, BRF_GRA }, // 2 Tile data + { "rom6.bin", 0x080000, 0x64B6C5AC, BRF_GRA }, // 3 + + { "rom2.bin", 0x020000, 0x6BB72D16, BRF_GRA }, // 4 + { "rom1.bin", 0x020000, 0x0934782D, BRF_GRA }, // 5 + { "rom3.bin", 0x020000, 0xEC903C07, BRF_GRA }, // 6 + { "rom4.bin", 0x020000, 0x50CBF1A8, BRF_GRA }, // 7 + + { "rom9.bin", 0x008000, 0x73D8E235, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "tp018_10.bpr", 0x000020, 0xBC88CCED, BRF_SND }, // 9 Sprite attribute PROM + { "tp018_11.bpr", 0x000020, 0xA1E17492, BRF_SND }, // 10 ??? +}; + + +STD_ROM_PICK(outzone) +STD_ROM_FN(outzone) + +static struct BurnRomInfo outzonebRomDesc[] = { + { "rom7.bin", 0x020000, 0x936E25D8, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "rom8.bin", 0x020000, 0xD19B3ECF, BRF_ESS | BRF_PRG }, // 1 + + { "rom5.bin", 0x080000, 0xC64EC7B6, BRF_GRA }, // 2 Tile data + { "rom6.bin", 0x080000, 0x64B6C5AC, BRF_GRA }, // 3 + + { "rom2.bin", 0x020000, 0x6BB72D16, BRF_GRA }, // 4 + { "rom1.bin", 0x020000, 0x0934782D, BRF_GRA }, // 5 + { "rom3.bin", 0x020000, 0xEC903C07, BRF_GRA }, // 6 + { "rom4.bin", 0x020000, 0x50CBF1A8, BRF_GRA }, // 7 + + { "rom9.bin", 0x008000, 0x73D8E235, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "tp018_10.bpr", 0x000020, 0xBC88CCED, BRF_SND }, // 9 Sprite attribute PROM + { "tp018_11.bpr", 0x000020, 0xA1E17492, BRF_SND }, // 10 ??? +}; + + +STD_ROM_PICK(outzoneb) +STD_ROM_FN(outzoneb) + +static struct BurnRomInfo outzoneaRomDesc[] = { + { "18.bin", 0x020000, 0x31A171BB, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "19.bin", 0x020000, 0x804ECFD1, BRF_ESS | BRF_PRG }, // 1 + + { "rom5.bin", 0x080000, 0xC64EC7B6, BRF_GRA }, // 2 Tile data + { "rom6.bin", 0x080000, 0x64B6C5AC, BRF_GRA }, // 3 + + { "rom2.bin", 0x020000, 0x6BB72D16, BRF_GRA }, // 4 + { "rom1.bin", 0x020000, 0x0934782D, BRF_GRA }, // 5 + { "rom3.bin", 0x020000, 0xEC903C07, BRF_GRA }, // 6 + { "rom4.bin", 0x020000, 0x50CBF1A8, BRF_GRA }, // 7 + + { "rom9.bin", 0x008000, 0x73D8E235, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "tp018_10.bpr", 0x000020, 0xBC88CCED, BRF_SND }, // 9 Sprite attribute PROM + { "tp018_11.bpr", 0x000020, 0xA1E17492, BRF_SND }, // 10 ??? +}; + + +STD_ROM_PICK(outzonea) +STD_ROM_FN(outzonea) + +static struct BurnRomInfo outzonecRomDesc[] = { + { "prg1.bin", 0x020000, 0x127a38d7, BRF_ESS | BRF_PRG }, // 1 + { "prg2.bin", 0x020000, 0x9704db16, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + + { "rom5.bin", 0x080000, 0xC64EC7B6, BRF_GRA }, // 2 Tile data + { "rom6.bin", 0x080000, 0x64B6C5AC, BRF_GRA }, // 3 + + { "rom2.bin", 0x020000, 0x6BB72D16, BRF_GRA }, // 4 + { "rom1.bin", 0x020000, 0x0934782D, BRF_GRA }, // 5 + { "rom3.bin", 0x020000, 0xEC903C07, BRF_GRA }, // 6 + { "rom4.bin", 0x020000, 0x50CBF1A8, BRF_GRA }, // 7 + + { "rom9.bin", 0x008000, 0x73D8E235, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "tp018_10.bpr", 0x000020, 0xBC88CCED, BRF_SND }, // 9 Sprite attribute PROM + { "tp018_11.bpr", 0x000020, 0xA1E17492, BRF_SND }, // 10 ??? +}; + + +STD_ROM_PICK(outzonec) +STD_ROM_FN(outzonec) + +static struct BurnRomInfo outzonedRomDesc[] = { + { "tp07.bin", 0x020000, 0xa85a1d48, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "tp08.bin", 0x020000, 0xd8cc44af, BRF_ESS | BRF_PRG }, // 1 + + { "rom5.bin", 0x080000, 0xC64EC7B6, BRF_GRA }, // 2 Tile data + { "rom6.bin", 0x080000, 0x64B6C5AC, BRF_GRA }, // 3 + + { "rom2.bin", 0x020000, 0x6BB72D16, BRF_GRA }, // 4 + { "rom1.bin", 0x020000, 0x0934782D, BRF_GRA }, // 5 + { "rom3.bin", 0x020000, 0xEC903C07, BRF_GRA }, // 6 + { "rom4.bin", 0x020000, 0x50CBF1A8, BRF_GRA }, // 7 + + { "tp09.bin", 0x008000, 0xdd56041f, BRF_ESS | BRF_PRG }, // 8 Z80 program + + { "tp018_10.bpr", 0x000020, 0xBC88CCED, BRF_SND }, // 9 Sprite attribute PROM + { "tp018_11.bpr", 0x000020, 0xA1E17492, BRF_SND }, // 10 ??? +}; + + +STD_ROM_PICK(outzoned) +STD_ROM_FN(outzoned) + +static struct BurnInputInfo outzoneInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 2, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, +}; + +STDINPUTINFO(outzone) + +static struct BurnDIPInfo outzoneDIPList[] = { + // Defaults + {0x14, 0xFF, 0xFF, 0x00, NULL}, + {0x15, 0xFF, 0xFF, 0x00, NULL}, + {0x16, 0xFF, 0xFF, 0x02, NULL}, + // DIP 1 + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x02, 0x00, "Normal screen"}, + {0x14, 0x01, 0x02, 0x02, "Invert screen"}, + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x04, 0x00, "Normal mode"}, + {0x14, 0x01, 0x04, 0x04, "Screen test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x14, 0x01, 0x08, 0x00, "On"}, + {0x14, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, +#if 1 + // Coinage for Europe + {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0x30, 0x10, "2 coin 1 play"}, + {0x14, 0x01, 0x30, 0x20, "3 coin 1 play"}, + {0x14, 0x01, 0x30, 0x30, "4 coin 1 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0xC0, 0x40, "1 coin 3 play"}, + {0x14, 0x01, 0xC0, 0x80, "1 coin 4 play"}, + {0x14, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, +#else + // Coinage for Japan + {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0x30, 0x10, "1 coin 2 play"}, + {0x14, 0x01, 0x30, 0x20, "2 coin 1 play"}, + {0x14, 0x01, 0x30, 0x30, "3 coin 2 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0xC0, 0x40, "1 coin 2 play"}, + {0x14, 0x01, 0xC0, 0x80, "2 coin 1 play"}, + {0x14, 0x01, 0xC0, 0xC0, "3 coin 2 play"}, +#endif + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x15, 0x01, 0x03, 0x00, "B"}, + {0x15, 0x01, 0x03, 0x01, "A"}, + {0x15, 0x01, 0x03, 0x02, "C"}, + {0x15, 0x01, 0x03, 0x03, "D"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, + {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, + {0x15, 0x01, 0x0C, 0x08, "300000 only"}, + {0x15, 0x01, 0x0C, 0x0C, "No extend"}, + {0, 0xFE, 0, 4, "Number of heros"}, + {0x15, 0x01, 0x30, 0x00, "3"}, + {0x15, 0x01, 0x30, 0x10, "5"}, + {0x15, 0x01, 0x30, 0x20, "2"}, + {0x15, 0x01, 0x30, 0x30, "1"}, + {0, 0xFE, 0, 2, "No death & stop mode"}, + {0x15, 0x01, 0x40, 0x00, "Off"}, + {0x15, 0x01, 0x40, 0x40, "On"}, + + // Region + {0, 0xFE, 0, 9, "Region"}, + {0x16, 0x01, 0x0F, 0x00, "Japan"}, + {0x16, 0x01, 0x0F, 0x01, "U.S.A."}, + {0x16, 0x01, 0x0F, 0x02, "Europe"}, + {0x16, 0x01, 0x0F, 0x03, "Hong Kong"}, + {0x16, 0x01, 0x0F, 0x04, "Korea"}, + {0x16, 0x01, 0x0F, 0x05, "Taiwan"}, + {0x16, 0x01, 0x0F, 0x06, "Taiwan (Spacy License)"}, + {0x16, 0x01, 0x0F, 0x07, "US (Romstar License)"}, + {0x16, 0x01, 0x0F, 0x08, "Hong Kong (Honest Trading License)"}, + +}; + +STDDIPINFO(outzone) + +static struct BurnDIPInfo outzonebDIPList[] = { + // Defaults + {0x14, 0xFF, 0xFF, 0x00, NULL}, + {0x15, 0xFF, 0xFF, 0x00, NULL}, + {0x16, 0xFF, 0xFF, 0x02, NULL}, + // DIP 1 + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x02, 0x00, "Normal screen"}, + {0x14, 0x01, 0x02, 0x02, "Invert screen"}, + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x04, 0x00, "Normal mode"}, + {0x14, 0x01, 0x04, 0x04, "Screen test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x14, 0x01, 0x08, 0x00, "On"}, + {0x14, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, +#if 1 + // Coinage for Europe + {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0x30, 0x10, "2 coin 1 play"}, + {0x14, 0x01, 0x30, 0x20, "3 coin 1 play"}, + {0x14, 0x01, 0x30, 0x30, "4 coin 1 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0xC0, 0x40, "1 coin 3 play"}, + {0x14, 0x01, 0xC0, 0x80, "1 coin 4 play"}, + {0x14, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, +#else + // Coinage for Japan + {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0x30, 0x10, "1 coin 2 play"}, + {0x14, 0x01, 0x30, 0x20, "2 coin 1 play"}, + {0x14, 0x01, 0x30, 0x30, "3 coin 2 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0xC0, 0x40, "1 coin 2 play"}, + {0x14, 0x01, 0xC0, 0x80, "2 coin 1 play"}, + {0x14, 0x01, 0xC0, 0xC0, "3 coin 2 play"}, +#endif + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x15, 0x01, 0x03, 0x00, "B"}, + {0x15, 0x01, 0x03, 0x01, "A"}, + {0x15, 0x01, 0x03, 0x02, "C"}, + {0x15, 0x01, 0x03, 0x03, "D"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, + {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, + {0x15, 0x01, 0x0C, 0x08, "300000 only"}, + {0x15, 0x01, 0x0C, 0x0C, "No extend"}, + {0, 0xFE, 0, 4, "Number of heros"}, + {0x15, 0x01, 0x30, 0x00, "3"}, + {0x15, 0x01, 0x30, 0x10, "5"}, + {0x15, 0x01, 0x30, 0x20, "2"}, + {0x15, 0x01, 0x30, 0x30, "1"}, + {0, 0xFE, 0, 2, "No death & stop mode"}, + {0x15, 0x01, 0x40, 0x00, "Off"}, + {0x15, 0x01, 0x40, 0x40, "On"}, + + // Region + {0, 0xFE, 0, 8, "Region"}, + {0x16, 0x01, 0x0F, 0x00, "Japan"}, + {0x16, 0x01, 0x0F, 0x01, "U.S.A."}, + {0x16, 0x01, 0x0F, 0x02, "Europe"}, + {0x16, 0x01, 0x0F, 0x03, "Hong Kong"}, + {0x16, 0x01, 0x0F, 0x04, "Korea"}, + {0x16, 0x01, 0x0F, 0x05, "Taiwan"}, + {0x16, 0x01, 0x0F, 0x06, "No Warning screen"}, + {0x16, 0x01, 0x0F, 0x07, "No Warning screen"}, + + +}; + +STDDIPINFO(outzoneb) + +static struct BurnDIPInfo outzonecDIPList[] = { + // Defaults + {0x14, 0xFF, 0xFF, 0x00, NULL}, + {0x15, 0xFF, 0xFF, 0x00, NULL}, + {0x16, 0xFF, 0xFF, 0x02, NULL}, + // DIP 1 + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x02, 0x00, "Normal screen"}, + {0x14, 0x01, 0x02, 0x02, "Invert screen"}, + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x04, 0x00, "Normal mode"}, + {0x14, 0x01, 0x04, 0x04, "Screen test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x14, 0x01, 0x08, 0x00, "On"}, + {0x14, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, +#if 1 + // Coinage for Europe + {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0x30, 0x10, "2 coin 1 play"}, + {0x14, 0x01, 0x30, 0x20, "3 coin 1 play"}, + {0x14, 0x01, 0x30, 0x30, "4 coin 1 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0xC0, 0x40, "1 coin 3 play"}, + {0x14, 0x01, 0xC0, 0x80, "1 coin 4 play"}, + {0x14, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, +#else + // Coinage for Japan + {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0x30, 0x10, "1 coin 2 play"}, + {0x14, 0x01, 0x30, 0x20, "2 coin 1 play"}, + {0x14, 0x01, 0x30, 0x30, "3 coin 2 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0xC0, 0x40, "1 coin 2 play"}, + {0x14, 0x01, 0xC0, 0x80, "2 coin 1 play"}, + {0x14, 0x01, 0xC0, 0xC0, "3 coin 2 play"}, +#endif + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x15, 0x01, 0x03, 0x00, "B"}, + {0x15, 0x01, 0x03, 0x01, "A"}, + {0x15, 0x01, 0x03, 0x02, "C"}, + {0x15, 0x01, 0x03, 0x03, "D"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, + {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, + {0x15, 0x01, 0x0C, 0x08, "300000 only"}, + {0x15, 0x01, 0x0C, 0x0C, "No extend"}, + {0, 0xFE, 0, 4, "Number of heros"}, + {0x15, 0x01, 0x30, 0x00, "3"}, + {0x15, 0x01, 0x30, 0x10, "5"}, + {0x15, 0x01, 0x30, 0x20, "2"}, + {0x15, 0x01, 0x30, 0x30, "1"}, + {0, 0xFE, 0, 2, "No death & stop mode"}, + {0x15, 0x01, 0x40, 0x00, "Off"}, + {0x15, 0x01, 0x40, 0x40, "On"}, + + // Region + {0, 0xFE, 0, 9, "Region"}, + {0x16, 0x01, 0x0F, 0x00, "Japan"}, + {0x16, 0x01, 0x0F, 0x01, "U.S.A."}, + {0x16, 0x01, 0x0F, 0x02, "Europe"}, + {0x16, 0x01, 0x0F, 0x03, "Hong Kong"}, + {0x16, 0x01, 0x0F, 0x04, "Korea"}, + {0x16, 0x01, 0x0F, 0x05, "Taiwan"}, + {0x16, 0x01, 0x0F, 0x06, "Taiwan (Spacy Co License)"}, + {0x16, 0x01, 0x0F, 0x07, "US (Romstar License)"}, + {0x16, 0x01, 0x0F, 0x08, "Hong Kong & China (Honest Trading License)"}, + +}; + +STDDIPINFO(outzonec) + +static struct BurnDIPInfo outzonedDIPList[] = { + // Defaults + {0x14, 0xFF, 0xFF, 0x00, NULL}, + {0x15, 0xFF, 0xFF, 0x00, NULL}, + {0x16, 0xFF, 0xFF, 0x02, NULL}, + // DIP 1 + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x02, 0x00, "Normal screen"}, + {0x14, 0x01, 0x02, 0x02, "Invert screen"}, + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x04, 0x00, "Normal mode"}, + {0x14, 0x01, 0x04, 0x04, "Screen test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x14, 0x01, 0x08, 0x00, "On"}, + {0x14, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, +#if 1 + // Coinage for Europe + {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0x30, 0x10, "2 coin 1 play"}, + {0x14, 0x01, 0x30, 0x20, "3 coin 1 play"}, + {0x14, 0x01, 0x30, 0x30, "4 coin 1 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x14, 0x01, 0xC0, 0x00, "1 coin 2 play"}, + {0x14, 0x01, 0xC0, 0x40, "1 coin 3 play"}, + {0x14, 0x01, 0xC0, 0x80, "1 coin 4 play"}, + {0x14, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, +#else + // Coinage for Japan + {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0x30, 0x10, "1 coin 2 play"}, + {0x14, 0x01, 0x30, 0x20, "2 coin 1 play"}, + {0x14, 0x01, 0x30, 0x30, "3 coin 2 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0xC0, 0x40, "1 coin 2 play"}, + {0x14, 0x01, 0xC0, 0x80, "2 coin 1 play"}, + {0x14, 0x01, 0xC0, 0xC0, "3 coin 2 play"}, +#endif + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x15, 0x01, 0x03, 0x00, "B"}, + {0x15, 0x01, 0x03, 0x01, "A"}, + {0x15, 0x01, 0x03, 0x02, "C"}, + {0x15, 0x01, 0x03, 0x03, "D"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, + {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, + {0x15, 0x01, 0x0C, 0x08, "300000 only"}, + {0x15, 0x01, 0x0C, 0x0C, "No extend"}, + {0, 0xFE, 0, 4, "Number of heros"}, + {0x15, 0x01, 0x30, 0x00, "3"}, + {0x15, 0x01, 0x30, 0x10, "5"}, + {0x15, 0x01, 0x30, 0x20, "2"}, + {0x15, 0x01, 0x30, 0x30, "1"}, + {0, 0xFE, 0, 2, "No death & stop mode"}, + {0x15, 0x01, 0x40, 0x00, "Off"}, + {0x15, 0x01, 0x40, 0x40, "On"}, + + // Region + {0, 0xFE, 0, 9, "Region"}, + {0x16, 0x01, 0x0F, 0x00, "Japan"}, + {0x16, 0x01, 0x0F, 0x01, "U.S.A."}, + {0x16, 0x01, 0x0F, 0x02, "Europe"}, + {0x16, 0x01, 0x0F, 0x03, "Hong Kong"}, + {0x16, 0x01, 0x0F, 0x04, "Korea"}, + {0x16, 0x01, 0x0F, 0x05, "Taiwan"}, + {0x16, 0x01, 0x0F, 0x06, "Taiwan (Spacy Co License)"}, + {0x16, 0x01, 0x0F, 0x07, "US (Romstar License)"}, + {0x16, 0x01, 0x0F, 0x08, "Hong Kong & China (Honest Trading License)"}, + +}; + +STDDIPINFO(outzoned) + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *Ram01, *RamPal, *RamPal2; + +static INT32 nColCount = 0x0400; + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x040000; // + RomZ80 = Next; Next += 0x008000; // Z80 ROM + BCU2ROM = Next; Next += nBCU2ROMSize; // BCU-2 tile data + FCU2ROM = Next; Next += nFCU2ROMSize; // FCU-2 tile data + RamStart = Next; + Ram01 = Next; Next += 0x004000; // CPU #0 work RAM + RamPal = Next; Next += 0x001000; // palette + RamPal2 = Next; Next += 0x001000; // palette + RamZ80 = Next; Next += 0x008000; // Z80 RAM + BCU2RAM = Next; Next += 0x010000; + FCU2RAM = Next; Next += 0x000800; + FCU2RAMSize = Next; Next += 0x000080; + RamEnd = Next; + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32* pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029402; + } + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); // scan 68000 states + ZetScan(nAction); // Scan Z80 + + BurnYM3812Scan(nAction, pnMin); + + SCAN_VAR(DrvInput); + SCAN_VAR(nCyclesDone); + } + + return 0; +} + +static INT32 LoadRoms() +{ + // Load 68000 ROM + ToaLoadCode(Rom01, 0, 2); + + // Load BCU-2 tile data + ToaLoadGP9001Tiles(BCU2ROM, 2, 2, nBCU2ROMSize); + + // Load FCU-2 tile data + ToaLoadTiles(FCU2ROM, 4, nFCU2ROMSize); + + // Load the Z80 ROM + BurnLoadRom(RomZ80, 8, 1); + + return 0; +} + +UINT8 __fastcall outzoneZ80In(UINT16 nAddress) +{ +// bprintf(PRINT_NORMAL, _T("z80 read %4X\n"), nAddress); + + nAddress &= 0xFF; + + switch (nAddress) { + case 0x00: + return BurnYM3812Read(0); + case 0x08: // DIP A + return DrvInput[2]; + case 0x0C: // DIP B + return DrvInput[3]; + case 0x10: // Sysytem inputs + return DrvInput[4] | (ToaVBlankRegister() << 7); + case 0x14: // Player 1 + return DrvInput[0]; + case 0x18: // Player 2 + return DrvInput[1]; + case 0x1C: // Region + return DrvInput[5]; + + } + + return 0; +} + +void __fastcall outzoneZ80Out(UINT16 nAddress, UINT8 nValue) +{ +// bprintf(PRINT_NORMAL, _T("Z80 attempted to write address %04X with value %02X.\n"), nAddress, nValue); + + nAddress &= 0xFF; + + switch (nAddress) { + case 0x00: + BurnYM3812Write(0, nValue); + break; + case 0x01: + BurnYM3812Write(1, nValue); + break; + + case 0x04: // Coin counter + break; + } +} + +static INT32 DrvZ80Init() +{ + // Init the Z80 + ZetInit(0); + ZetOpen(0); + + ZetSetInHandler(outzoneZ80In); + ZetSetOutHandler(outzoneZ80Out); + + // ROM + ZetMapArea (0x0000, 0x7FFF, 0, RomZ80); // Direct Read from ROM + ZetMapArea (0x0000, 0x7FFF, 2, RomZ80); // Direct Fetch from ROM + // RAM + ZetMapArea (0x8000, 0xFFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0x8000, 0xFFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0x8000, 0xFFFF, 2, RamZ80); // + + + ZetClose(); + + return 0; +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall outzoneReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x100001: + case 0x300001: + return ToaVBlankRegister(); + + default: { +// printf("Attempt to read byte value of location %x\n", sekAddress); + } + } + + return 0; +} + +UINT16 __fastcall outzoneReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x100002: + return ToaFCU2GetRAMPointer(); + case 0x100004: + return ToaFCU2ReadRAM(); + case 0x100006: + return ToaFCU2ReadRAMSize(); + + case 0x200002: + return ToaBCU2GetRAMPointer(); + case 0x200004: + return ToaBCU2ReadRAM_Hi(); + case 0x200006: + return ToaBCU2ReadRAM_Lo(); + + case 0x200010: + case 0x200011: + case 0x200012: + case 0x200013: + case 0x200014: + case 0x200015: + case 0x200016: + case 0x200017: + case 0x200018: + case 0x200019: + case 0x20001A: + case 0x20001B: + case 0x20001C: + case 0x20001D: + case 0x20001E: + case 0x20001F: + return BCU2Reg[(sekAddress & 15) >> 1]; + + case 0x100000: + case 0x300000: + return ToaVBlankRegister(); + + default: { +// printf("Attempt to read word value of location %x\n", sekAddress); + } + } + + return 0; +} + +void __fastcall outzoneWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + + case 0x300003: + bEnableInterrupts = byteValue; + break; + + case 0x100006: + ToaFCU2WriteRAMSize(byteValue); + break; + + default: { +// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } + } +} + +void __fastcall outzoneWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + + case 0x100002: // FCU-2 set VRAM address-pointer + ToaFCU2SetRAMPointer(wordValue); + break; + case 0x100004: + ToaFCU2WriteRAM(wordValue); + break; + case 0x100006: + ToaFCU2WriteRAMSize(wordValue); + break; + + case 0x200000: // BCU-2 flip + break; + case 0x200002: // BCU-2 set VRAM address-pointer + ToaBCU2SetRAMPointer(wordValue); + break; + case 0x200004: + ToaBCU2WriteRAM(wordValue); + break; + case 0x200006: + ToaBCU2WriteRAM(wordValue); + break; + + case 0x200010: + case 0x200011: + case 0x200012: + case 0x200013: + case 0x200014: + case 0x200015: + case 0x200016: + case 0x200017: + case 0x200018: + case 0x200019: + case 0x20001A: + case 0x20001B: + case 0x20001C: + case 0x20001D: + case 0x20001E: + case 0x20001F: + BCU2Reg[(sekAddress & 15) >> 1] = wordValue; + break; + + case 0x300002: + bEnableInterrupts = (wordValue & 0xFF); + break; + + case 0x340000: + nBCU2TileXOffset = wordValue; + break; + case 0x340002: + nBCU2TileYOffset = wordValue; + break; + + case 0x340006: // FCU-2 flip + break; + + default: { +// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); + } + } +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + + bEnableInterrupts = false; + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + +#ifdef DRIVER_ROTATION + bToaRotateScreen = true; +#endif + + BurnSetRefreshRate(REFRESHRATE); + + nBCU2ROMSize = 0x100000; + nFCU2ROMSize = 0x080000; + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x03FFFF, SM_ROM); // 68K ROM + SekMapMemory(Ram01, 0x240000, 0x243FFF, SM_RAM); // 68K RAM + SekMapMemory(RamPal, 0x304000, 0x3047FF, SM_RAM); // BCU-2 palette RAM + SekMapMemory(RamPal2, 0x306000, 0x3067FF, SM_RAM); // FCU-2 palette RAM + + SekSetReadWordHandler(0, outzoneReadWord); + SekSetReadByteHandler(0, outzoneReadByte); + SekSetWriteWordHandler(0, outzoneWriteWord); + SekSetWriteByteHandler(0, outzoneWriteByte); + + SekMapHandler(1, 0x140000, 0x140FFF, SM_RAM); // Z80 RAM + + SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); + SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); + SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); + SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); + + SekClose(); + } + + ToaInitBCU2(); + + DrvZ80Init(); // Initialize Z80 + + nToaPalLen = nColCount; + ToaPalSrc = RamPal; + ToaPalSrc2 = RamPal2; + ToaPalInit(); + + BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); + BurnTimerAttachZetYM3812(28000000 / 8); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + return 0; +} + +static INT32 DrvExit() +{ + BurnYM3812Exit(); + ToaPalExit(); + + ToaExitBCU2(); + ToaZExit(); // Z80 exit + SekExit(); // Deallocate 68000s + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0x120); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderBCU2(); // Render BCU2 graphics + } + + ToaPalUpdate(); // Update the palette + ToaPal2Update(); + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 4; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x00; // Buttons + DrvInput[1] = 0x00; // Player 1 + DrvInput[4] = 0x00; // Player 2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[4] |= (DrvButton[i] & 1) << i; + } + ToaClearOpposites(&DrvInput[0]); + ToaClearOpposites(&DrvInput[1]); + + SekOpen(0); + ZetOpen(0); + + SekNewFrame(); + ZetNewFrame(); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); + nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext; + + // Run 68000 + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + + // Trigger VBlank interrupt + if (nNext > nToaCyclesVBlankStart) { + if (SekTotalCycles() < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); + SekRun(nCyclesSegment); + } + + if (pBurnDraw) { + DrvDraw(); // Draw screen if needed + } + + ToaBufferFCU2Sprites(); + + bVBlank = true; + if (bEnableInterrupts) { + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + } + + nCyclesSegment = nNext - SekTotalCycles(); + if (bVBlank || (!CheckSleep(0))) { // See if this CPU is busywaiting + SekRun(nCyclesSegment); + } else { + SekIdle(nCyclesSegment); + } + + BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); + } + + nToa1Cycles68KSync = SekTotalCycles(); + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; + +// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); + + ZetClose(); + SekClose(); + +// ToaBufferFCU2Sprites(); + + return 0; +} + +struct BurnDriver BurnDrvOutZone = { + "outzone", NULL, NULL, NULL, "1990", + "Out Zone (set 1)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, outzoneRomInfo, outzoneRomName, NULL, NULL, outzoneInputInfo, outzoneDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvOutZonea = { + "outzonea", "outzone", NULL, NULL, "1990", + "Out Zone (set 2)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, outzoneaRomInfo, outzoneaRomName, NULL, NULL, outzoneInputInfo, outzoneDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvOutZoneb = { + "outzoneb", "outzone", NULL, NULL, "1990", + "Out Zone (set 3, prototype?)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, outzonebRomInfo, outzonebRomName, NULL, NULL, outzoneInputInfo, outzonebDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvOutZonec = { + "outzonec", "outzone", NULL, NULL, "1990", + "Out Zone (set 4)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, outzonecRomInfo, outzonecRomName, NULL, NULL, outzoneInputInfo, outzonecDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvOutZoned = { + "outzoned", "outzone", NULL, NULL, "1990", + "Out Zone (set 5)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, outzonedRomInfo, outzonedRomName, NULL, NULL, outzoneInputInfo, outzonedDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 240, 320, 3, 4 +}; diff --git a/src/burn/drv/toaplan/d_pipibibs.cpp b/src/burn/drv/toaplan/d_pipibibs.cpp index 3b090d5c7..9eb79b6b7 100644 --- a/src/burn/drv/toaplan/d_pipibibs.cpp +++ b/src/burn/drv/toaplan/d_pipibibs.cpp @@ -1,617 +1,616 @@ -#include "toaplan.h" -// Pipi & Bibis / Whoopee!! - -#define REFRESHRATE 60 -#define VBLANK_LINES (32) - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static struct BurnInputInfo PipibibsInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Service", BIT_DIGITAL, DrvButton + 0, "service"}, - {"Tilt", BIT_DIGITAL, DrvButton + 1, "tilt"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, -}; - -STDINPUTINFO(Pipibibs) - -static struct BurnDIPInfo PipibibsDIPList[]= -{ - {0x13, 0xff, 0xff, 0x00, NULL }, - {0x14, 0xff, 0xff, 0x00, NULL }, - {0x15, 0xff, 0xff, 0xf6, NULL }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Service Mode" }, - {0x13, 0x01, 0x04, 0x00, "Off" }, - {0x13, 0x01, 0x04, 0x04, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 7, "Coin A" }, - {0x13, 0x01, 0x30, 0x30, "4 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "3 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x10, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 8, "Coin B" }, - {0x13, 0x01, 0xc0, 0x80, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 2 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 3 Credits" }, - {0x13, 0x01, 0xc0, 0x80, "1 Coin 4 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "1 Coin 6 Credits" }, - - {0 , 0xfe, 0 , 0, "Difficulty" }, - {0x14, 0x01, 0x03, 0x03, "Hardest" }, - {0x14, 0x01, 0x03, 0x02, "Hard" }, - {0x14, 0x01, 0x03, 0x00, "Normal" }, - {0x14, 0x01, 0x03, 0x01, "Easy" }, - - {0 , 0xfe, 0 , 4, "Bonus Life" }, - {0x14, 0x01, 0x0c, 0x0c, "None" }, - {0x14, 0x01, 0x0c, 0x08, "200k only" }, - {0x14, 0x01, 0x0c, 0x00, "200k and every 300k" }, - {0x14, 0x01, 0x0c, 0x04, "150k and every 200k" }, - - {0 , 0xfe, 0 , 4, "Lives" }, - {0x14, 0x01, 0x30, 0x30, "1" }, - {0x14, 0x01, 0x30, 0x20, "2" }, - {0x14, 0x01, 0x30, 0x00, "3" }, - {0x14, 0x01, 0x30, 0x10, "5" }, - - {0 , 0xfe, 0 , 4, "Invulnerability" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Region" }, - {0x15, 0x01, 0x07, 0x06, "Europe" }, - {0x15, 0x01, 0x07, 0x07, "Europe (Nova Apparate GMBH & Co)" }, - {0x15, 0x01, 0x07, 0x04, "USA" }, - {0x15, 0x01, 0x07, 0x05, "USA (Romstar)" }, - {0x15, 0x01, 0x07, 0x00, "Japan" }, - {0x15, 0x01, 0x07, 0x01, "Asia" }, - {0x15, 0x01, 0x07, 0x02, "Hong Kong (Honest Trading Co.)" }, - {0x15, 0x01, 0x07, 0x03, "Taiwan" }, - - {0 , 0xfe, 0 , 0, "Nudity" }, - {0x15, 0x01, 0x08, 0x08, "Low" }, - {0x15, 0x01, 0x08, 0x00, "High, but censored" }, -}; - -STDDIPINFO(Pipibibs) - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *Ram01, *RamPal; - -static INT32 nColCount = 0x0800; - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x040000; // 68000 ROM - RomZ80 = Next; Next += 0x010000; // Z80 ROM - GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data - RamStart = Next; - Ram01 = Next; Next += 0x003000; // CPU #0 work RAM - RamZ80 = Next; Next += 0x001000; - RamPal = Next; Next += 0x001000; // palette - GP9001RAM[0]= Next; Next += 0x008000; // Double size, as the game tests too much memory during POST - GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); - RamEnd = Next; - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x020997; - } - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); // scan 68000 states - ZetScan(nAction); - - BurnYM3812Scan(nAction, pnMin); - - ToaScanGP9001(nAction, pnMin); - } - - return 0; -} - -static INT32 LoadRoms() -{ - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "pipibibsp")) { - // Load 68000 ROM - ToaLoadCode(Rom01, 0, 2); - - // Load GP9001 tile data - ToaLoadGP9001Tiles(GP9001ROM[0], 2, 4, nGP9001ROMSize[0]); - - BurnLoadRom(RomZ80, 6, 1); - } else { - // Load 68000 ROM - ToaLoadCode(Rom01, 0, 2); - - // Load GP9001 tile data - ToaLoadGP9001Tiles(GP9001ROM[0], 2, 2, nGP9001ROMSize[0]); - - BurnLoadRom(RomZ80, 4, 1); - } - - return 0; -} - -UINT8 __fastcall pipibibsReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x19c031: // Player 1 inputs - return DrvInput[0]; - case 0x19c035: // Player 2 inputs - return DrvInput[1]; - case 0x19c02d: // Other inputs - return DrvInput[2]; - - case 0x19c021: // Dipswitch 1 - return DrvInput[3]; - case 0x19c025: // Dipswitch 2 - return DrvInput[4]; - case 0x19c029: // Dipswitch 3 - Territory - return DrvInput[5]&0x0f; - - case 0x14000D: // VBlank - return ToaVBlankRegister(); - -// default: -// printf("Attempt to read byte value of location %x\n", sekAddress); - } - - return 0; -} - -UINT16 __fastcall pipibibsReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x19c030: // Player 1 inputs - return DrvInput[0]; - case 0x19c034: // Player 2 inputs - return DrvInput[1]; - case 0x19c02c: // Other inputs - return DrvInput[2]; - - case 0x19c020: // Dipswitch 1 - return DrvInput[3]; - case 0x19c024: // Dipswitch 2 - return DrvInput[4]; - case 0x19c028: // Dipswitch 3 - Territory - return DrvInput[5]&0x0f; - - case 0x140004: - return ToaGP9001ReadRAM_Hi(0); - case 0x140006: - return ToaGP9001ReadRAM_Lo(0); - - case 0x14000C: - return ToaVBlankRegister(); - -// default: -// printf("Attempt to read word value of location %x\n", sekAddress); - } - - return 0; -} - -void __fastcall pipibibsWriteByte(UINT32 /*sekAddress*/, UINT8 /*byteValue*/) -{ -// switch (sekAddress) { -// default: -// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); -// } -} - -void __fastcall pipibibsWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - - case 0x140000: // Set GP9001 VRAM address-pointer - ToaGP9001SetRAMPointer(wordValue); - break; - - case 0x140004: - ToaGP9001WriteRAM(wordValue, 0); - break; - case 0x140006: - ToaGP9001WriteRAM(wordValue, 0); - break; - - case 0x140008: - ToaGP9001SelectRegister(wordValue); - break; - - case 0x14000C: - ToaGP9001WriteRegister(wordValue); - break; - -// default: -// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); - } -} - -void __fastcall pipibibs_sound_write(UINT16 address, UINT8 data) -{ - switch (address) - { - case 0xe000: - BurnYM3812Write(0, data); - return; - - case 0xe001: - BurnYM3812Write(1, data); - return; - } -} - -UINT8 __fastcall pipibibs_sound_read(UINT16 address) -{ - switch (address) - { - case 0xe000: - case 0xe001: - return BurnYM3812Read(0); - } - - return 0; -} - -inline static INT32 pipibibsSynchroniseStream(INT32 nSoundRate) -{ - return (INT64)ZetTotalCycles() * nSoundRate / 3375000; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - -#ifdef DRIVER_ROTATION - bToaRotateScreen = false; -#endif - - BurnSetRefreshRate(REFRESHRATE); - - nGP9001ROMSize[0] = 0x200000; - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - SekMapMemory(Rom01, 0x000000, 0x03FFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x080000, 0x082FFF, SM_RAM); - SekMapMemory(RamPal, 0x0c0000, 0x0c0FFF, SM_RAM); // Palette RAM - SekSetReadWordHandler(0, pipibibsReadWord); - SekSetReadByteHandler(0, pipibibsReadByte); - SekSetWriteWordHandler(0, pipibibsWriteWord); - SekSetWriteByteHandler(0, pipibibsWriteByte); - - SekMapHandler(1, 0x190000, 0x190FFF, SM_RAM); - SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); - SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); - SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); - SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, RomZ80); - ZetMapArea(0x0000, 0x7fff, 2, RomZ80); - ZetMapArea(0x8000, 0x87ff, 0, RamZ80); - ZetMapArea(0x8000, 0x87ff, 1, RamZ80); - ZetMapArea(0x8000, 0x87ff, 2, RamZ80); - ZetSetWriteHandler(pipibibs_sound_write); - ZetSetReadHandler(pipibibs_sound_read); - ZetMemEnd(); - ZetClose(); - } - - nToa1Cycles68KSync = 0; - BurnYM3812Init(3375000, &toaplan1FMIRQHandler, pipibibsSynchroniseStream, 0); - BurnTimerAttachZetYM3812(3375000); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - nSpriteYOffset = 0x0001; - - nLayer0XOffset = -0x01D6; - nLayer1XOffset = -0x01D8; - nLayer2XOffset = -0x01DA; - - ToaInitGP9001(); - - nToaPalLen = nColCount; - ToaPalSrc = RamPal; - ToaPalInit(); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - return 0; -} - -static INT32 DrvExit() -{ - ToaPalExit(); - - BurnYM3812Exit(); - ToaExitGP9001(); - SekExit(); // Deallocate 68000s - ZetExit(); - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderGP9001(); // Render GP9001 graphics - } - - ToaPalUpdate(); // Update the palette - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 4; - - if (DrvReset) { - DrvDoReset(); - } - - memset (DrvInput, 0, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[2] |= (DrvButton[i] & 1) << i; - } - ToaClearOpposites(&DrvInput[0]); - ToaClearOpposites(&DrvInput[1]); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); - nCyclesTotal[1] = (INT32)(27000000.0 / 8 / REFRESHRATE); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext; - - // Run 68000 - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - - // Trigger VBlank interrupt - if (nNext > nToaCyclesVBlankStart) { - if (SekTotalCycles() < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); - SekRun(nCyclesSegment); - } - - if (pBurnDraw) { - DrvDraw(); - } - - ToaBufferGP9001Sprites(); - - bVBlank = true; - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - - nCyclesSegment = nNext - SekTotalCycles(); - if (bVBlank || (!CheckSleep(0))) { - SekRun(nCyclesSegment); - } else { - SekIdle(nCyclesSegment); - } - - BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); - } - - nToa1Cycles68KSync = SekTotalCycles(); - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - if (pBurnSoundOut) { - BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - } - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - -// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); - -// ToaBufferFCU2Sprites(); - - SekClose(); - ZetClose(); - - return 0; -} - - -// Pipi & Bibis / Whoopee!! (Z80 sound cpu, set 1) - -static struct BurnRomInfo pipibibsRomDesc[] = { - { "tp025-1.bin", 0x020000, 0xb2ea8659, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "tp025-2.bin", 0x020000, 0xdc53b939, BRF_ESS | BRF_PRG }, // 1 - - { "tp025-4.bin", 0x100000, 0xab97f744, BRF_GRA }, // 2 GP9001 Tile data - { "tp025-3.bin", 0x100000, 0x7b16101e, BRF_GRA }, // 3 - - { "tp025-5.bin", 0x008000, 0xbf8ffde5, BRF_ESS | BRF_PRG }, // 4 CPU #1 code -}; - -STD_ROM_PICK(pipibibs) -STD_ROM_FN(pipibibs) - -struct BurnDriver BurnDrvPipibibs = { - "pipibibs", NULL, NULL, NULL, "1991", - "Pipi & Bibis / Whoopee!! (Z80 sound cpu, set 1)\0", NULL, "Toaplan", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TOAPLAN_68K_Zx80, GBF_PLATFORM, 0, - NULL, pipibibsRomInfo, pipibibsRomName, NULL, NULL, PipibibsInputInfo, PipibibsDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 320, 240, 4, 3 -}; - - -// Pipi & Bibis / Whoopee!! (Z80 sound cpu, set 2) - -static struct BurnRomInfo pipibibsaRomDesc[] = { - { "tp025-1.alt.bin", 0x020000, 0x3e522d98, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "tp025-2.alt.bin", 0x020000, 0x48370485, BRF_ESS | BRF_PRG }, // 1 - - { "tp025-4.bin", 0x100000, 0xab97f744, BRF_GRA }, // 2 GP9001 Tile data - { "tp025-3.bin", 0x100000, 0x7b16101e, BRF_GRA }, // 3 - - { "tp025-5.bin", 0x008000, 0xbf8ffde5, BRF_ESS | BRF_PRG }, // 4 CPU #1 code -}; - -STD_ROM_PICK(pipibibsa) -STD_ROM_FN(pipibibsa) - -struct BurnDriver BurnDrvPipibibsa = { - "pipibibsa", "pipibibs", NULL, NULL, "1991", - "Pipi & Bibis / Whoopee!! (Z80 sound cpu, set 2)\0", NULL, "Toaplan", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_68K_Zx80, GBF_PLATFORM, 0, - NULL, pipibibsaRomInfo, pipibibsaRomName, NULL, NULL, PipibibsInputInfo, PipibibsDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 320, 240, 4, 3 -}; - - -// Pipi & Bibis / Whoopee!! (prototype) - -static struct BurnRomInfo pipibibspRomDesc[] = { - { "pip_cpu_e", 0x020000, 0xae3205bd, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "pip_cpu_o", 0x020000, 0x241669a9, BRF_ESS | BRF_PRG }, // 1 - - { "cg_01_l", 0x080000, 0x21d1ef46, BRF_GRA }, // 2 GP9001 Tile data - { "cg_01_h", 0x080000, 0xd5726328, BRF_GRA }, // 3 - { "cg_23_l", 0x080000, 0x114d41d0, BRF_GRA }, // 4 - { "cg_23_h", 0x080000, 0xe0468152, BRF_GRA }, // 5 - - { "pip_snd", 0x008000, 0x8ebf183b, BRF_ESS | BRF_PRG }, // 6 CPU #1 code -}; - -STD_ROM_PICK(pipibibsp) -STD_ROM_FN(pipibibsp) - -struct BurnDriver BurnDrvPipibibsp = { - "pipibibsp", "pipibibs", NULL, NULL, "1991", - "Pipi & Bibis / Whoopee!! (prototype)\0", NULL, "Toaplan", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_PROTOTYPE, 2, HARDWARE_TOAPLAN_68K_Zx80, GBF_PLATFORM, 0, - NULL, pipibibspRomInfo, pipibibspRomName, NULL, NULL, PipibibsInputInfo, PipibibsDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 320, 240, 4, 3 -}; +#include "toaplan.h" +// Pipi & Bibis / Whoopee!! + +#define REFRESHRATE 60 +#define VBLANK_LINES (32) + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static struct BurnInputInfo PipibibsInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Service", BIT_DIGITAL, DrvButton + 0, "service"}, + {"Tilt", BIT_DIGITAL, DrvButton + 1, "tilt"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, +}; + +STDINPUTINFO(Pipibibs) + +static struct BurnDIPInfo PipibibsDIPList[]= +{ + {0x13, 0xff, 0xff, 0x00, NULL }, + {0x14, 0xff, 0xff, 0x00, NULL }, + {0x15, 0xff, 0xff, 0xf6, NULL }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Service Mode" }, + {0x13, 0x01, 0x04, 0x00, "Off" }, + {0x13, 0x01, 0x04, 0x04, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 7, "Coin A" }, + {0x13, 0x01, 0x30, 0x30, "4 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "3 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x10, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 8, "Coin B" }, + {0x13, 0x01, 0xc0, 0x80, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 2 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 3 Credits" }, + {0x13, 0x01, 0xc0, 0x80, "1 Coin 4 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "1 Coin 6 Credits" }, + + {0 , 0xfe, 0 , 0, "Difficulty" }, + {0x14, 0x01, 0x03, 0x03, "Hardest" }, + {0x14, 0x01, 0x03, 0x02, "Hard" }, + {0x14, 0x01, 0x03, 0x00, "Normal" }, + {0x14, 0x01, 0x03, 0x01, "Easy" }, + + {0 , 0xfe, 0 , 4, "Bonus Life" }, + {0x14, 0x01, 0x0c, 0x0c, "None" }, + {0x14, 0x01, 0x0c, 0x08, "200k only" }, + {0x14, 0x01, 0x0c, 0x00, "200k and every 300k" }, + {0x14, 0x01, 0x0c, 0x04, "150k and every 200k" }, + + {0 , 0xfe, 0 , 4, "Lives" }, + {0x14, 0x01, 0x30, 0x30, "1" }, + {0x14, 0x01, 0x30, 0x20, "2" }, + {0x14, 0x01, 0x30, 0x00, "3" }, + {0x14, 0x01, 0x30, 0x10, "5" }, + + {0 , 0xfe, 0 , 4, "Invulnerability" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Region" }, + {0x15, 0x01, 0x07, 0x06, "Europe" }, + {0x15, 0x01, 0x07, 0x07, "Europe (Nova Apparate GMBH & Co)" }, + {0x15, 0x01, 0x07, 0x04, "USA" }, + {0x15, 0x01, 0x07, 0x05, "USA (Romstar)" }, + {0x15, 0x01, 0x07, 0x00, "Japan" }, + {0x15, 0x01, 0x07, 0x01, "Asia" }, + {0x15, 0x01, 0x07, 0x02, "Hong Kong (Honest Trading Co.)" }, + {0x15, 0x01, 0x07, 0x03, "Taiwan" }, + + {0 , 0xfe, 0 , 0, "Nudity" }, + {0x15, 0x01, 0x08, 0x08, "Low" }, + {0x15, 0x01, 0x08, 0x00, "High, but censored" }, +}; + +STDDIPINFO(Pipibibs) + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *Ram01, *RamPal; + +static INT32 nColCount = 0x0800; + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x040000; // 68000 ROM + RomZ80 = Next; Next += 0x010000; // Z80 ROM + GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data + RamStart = Next; + Ram01 = Next; Next += 0x003000; // CPU #0 work RAM + RamZ80 = Next; Next += 0x001000; + RamPal = Next; Next += 0x001000; // palette + GP9001RAM[0]= Next; Next += 0x008000; // Double size, as the game tests too much memory during POST + GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); + RamEnd = Next; + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x020997; + } + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); // scan 68000 states + ZetScan(nAction); + + BurnYM3812Scan(nAction, pnMin); + + ToaScanGP9001(nAction, pnMin); + } + + return 0; +} + +static INT32 LoadRoms() +{ + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "pipibibsp")) { + // Load 68000 ROM + ToaLoadCode(Rom01, 0, 2); + + // Load GP9001 tile data + ToaLoadGP9001Tiles(GP9001ROM[0], 2, 4, nGP9001ROMSize[0]); + + BurnLoadRom(RomZ80, 6, 1); + } else { + // Load 68000 ROM + ToaLoadCode(Rom01, 0, 2); + + // Load GP9001 tile data + ToaLoadGP9001Tiles(GP9001ROM[0], 2, 2, nGP9001ROMSize[0]); + + BurnLoadRom(RomZ80, 4, 1); + } + + return 0; +} + +UINT8 __fastcall pipibibsReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x19c031: // Player 1 inputs + return DrvInput[0]; + case 0x19c035: // Player 2 inputs + return DrvInput[1]; + case 0x19c02d: // Other inputs + return DrvInput[2]; + + case 0x19c021: // Dipswitch 1 + return DrvInput[3]; + case 0x19c025: // Dipswitch 2 + return DrvInput[4]; + case 0x19c029: // Dipswitch 3 - Territory + return DrvInput[5]&0x0f; + + case 0x14000D: // VBlank + return ToaVBlankRegister(); + +// default: +// printf("Attempt to read byte value of location %x\n", sekAddress); + } + + return 0; +} + +UINT16 __fastcall pipibibsReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x19c030: // Player 1 inputs + return DrvInput[0]; + case 0x19c034: // Player 2 inputs + return DrvInput[1]; + case 0x19c02c: // Other inputs + return DrvInput[2]; + + case 0x19c020: // Dipswitch 1 + return DrvInput[3]; + case 0x19c024: // Dipswitch 2 + return DrvInput[4]; + case 0x19c028: // Dipswitch 3 - Territory + return DrvInput[5]&0x0f; + + case 0x140004: + return ToaGP9001ReadRAM_Hi(0); + case 0x140006: + return ToaGP9001ReadRAM_Lo(0); + + case 0x14000C: + return ToaVBlankRegister(); + +// default: +// printf("Attempt to read word value of location %x\n", sekAddress); + } + + return 0; +} + +void __fastcall pipibibsWriteByte(UINT32 /*sekAddress*/, UINT8 /*byteValue*/) +{ +// switch (sekAddress) { +// default: +// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); +// } +} + +void __fastcall pipibibsWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + + case 0x140000: // Set GP9001 VRAM address-pointer + ToaGP9001SetRAMPointer(wordValue); + break; + + case 0x140004: + ToaGP9001WriteRAM(wordValue, 0); + break; + case 0x140006: + ToaGP9001WriteRAM(wordValue, 0); + break; + + case 0x140008: + ToaGP9001SelectRegister(wordValue); + break; + + case 0x14000C: + ToaGP9001WriteRegister(wordValue); + break; + +// default: +// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); + } +} + +void __fastcall pipibibs_sound_write(UINT16 address, UINT8 data) +{ + switch (address) + { + case 0xe000: + BurnYM3812Write(0, data); + return; + + case 0xe001: + BurnYM3812Write(1, data); + return; + } +} + +UINT8 __fastcall pipibibs_sound_read(UINT16 address) +{ + switch (address) + { + case 0xe000: + case 0xe001: + return BurnYM3812Read(0); + } + + return 0; +} + +inline static INT32 pipibibsSynchroniseStream(INT32 nSoundRate) +{ + return (INT64)ZetTotalCycles() * nSoundRate / 3375000; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + +#ifdef DRIVER_ROTATION + bToaRotateScreen = false; +#endif + + BurnSetRefreshRate(REFRESHRATE); + + nGP9001ROMSize[0] = 0x200000; + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + SekMapMemory(Rom01, 0x000000, 0x03FFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x080000, 0x082FFF, SM_RAM); + SekMapMemory(RamPal, 0x0c0000, 0x0c0FFF, SM_RAM); // Palette RAM + SekSetReadWordHandler(0, pipibibsReadWord); + SekSetReadByteHandler(0, pipibibsReadByte); + SekSetWriteWordHandler(0, pipibibsWriteWord); + SekSetWriteByteHandler(0, pipibibsWriteByte); + + SekMapHandler(1, 0x190000, 0x190FFF, SM_RAM); + SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); + SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); + SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); + SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, RomZ80); + ZetMapArea(0x0000, 0x7fff, 2, RomZ80); + ZetMapArea(0x8000, 0x87ff, 0, RamZ80); + ZetMapArea(0x8000, 0x87ff, 1, RamZ80); + ZetMapArea(0x8000, 0x87ff, 2, RamZ80); + ZetSetWriteHandler(pipibibs_sound_write); + ZetSetReadHandler(pipibibs_sound_read); + ZetClose(); + } + + nToa1Cycles68KSync = 0; + BurnYM3812Init(3375000, &toaplan1FMIRQHandler, pipibibsSynchroniseStream, 0); + BurnTimerAttachZetYM3812(3375000); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + nSpriteYOffset = 0x0001; + + nLayer0XOffset = -0x01D6; + nLayer1XOffset = -0x01D8; + nLayer2XOffset = -0x01DA; + + ToaInitGP9001(); + + nToaPalLen = nColCount; + ToaPalSrc = RamPal; + ToaPalInit(); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + return 0; +} + +static INT32 DrvExit() +{ + ToaPalExit(); + + BurnYM3812Exit(); + ToaExitGP9001(); + SekExit(); // Deallocate 68000s + ZetExit(); + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderGP9001(); // Render GP9001 graphics + } + + ToaPalUpdate(); // Update the palette + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 4; + + if (DrvReset) { + DrvDoReset(); + } + + memset (DrvInput, 0, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[2] |= (DrvButton[i] & 1) << i; + } + ToaClearOpposites(&DrvInput[0]); + ToaClearOpposites(&DrvInput[1]); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); + nCyclesTotal[1] = (INT32)(27000000.0 / 8 / REFRESHRATE); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext; + + // Run 68000 + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + + // Trigger VBlank interrupt + if (nNext > nToaCyclesVBlankStart) { + if (SekTotalCycles() < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); + SekRun(nCyclesSegment); + } + + if (pBurnDraw) { + DrvDraw(); + } + + ToaBufferGP9001Sprites(); + + bVBlank = true; + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + + nCyclesSegment = nNext - SekTotalCycles(); + if (bVBlank || (!CheckSleep(0))) { + SekRun(nCyclesSegment); + } else { + SekIdle(nCyclesSegment); + } + + BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); + } + + nToa1Cycles68KSync = SekTotalCycles(); + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + if (pBurnSoundOut) { + BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + } + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + +// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); + +// ToaBufferFCU2Sprites(); + + SekClose(); + ZetClose(); + + return 0; +} + + +// Pipi & Bibis / Whoopee!! (Z80 sound cpu, set 1) + +static struct BurnRomInfo pipibibsRomDesc[] = { + { "tp025-1.bin", 0x020000, 0xb2ea8659, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "tp025-2.bin", 0x020000, 0xdc53b939, BRF_ESS | BRF_PRG }, // 1 + + { "tp025-4.bin", 0x100000, 0xab97f744, BRF_GRA }, // 2 GP9001 Tile data + { "tp025-3.bin", 0x100000, 0x7b16101e, BRF_GRA }, // 3 + + { "tp025-5.bin", 0x008000, 0xbf8ffde5, BRF_ESS | BRF_PRG }, // 4 CPU #1 code +}; + +STD_ROM_PICK(pipibibs) +STD_ROM_FN(pipibibs) + +struct BurnDriver BurnDrvPipibibs = { + "pipibibs", NULL, NULL, NULL, "1991", + "Pipi & Bibis / Whoopee!! (Z80 sound cpu, set 1)\0", NULL, "Toaplan", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TOAPLAN_68K_Zx80, GBF_PLATFORM, 0, + NULL, pipibibsRomInfo, pipibibsRomName, NULL, NULL, PipibibsInputInfo, PipibibsDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 320, 240, 4, 3 +}; + + +// Pipi & Bibis / Whoopee!! (Z80 sound cpu, set 2) + +static struct BurnRomInfo pipibibsaRomDesc[] = { + { "tp025-1.alt.bin", 0x020000, 0x3e522d98, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "tp025-2.alt.bin", 0x020000, 0x48370485, BRF_ESS | BRF_PRG }, // 1 + + { "tp025-4.bin", 0x100000, 0xab97f744, BRF_GRA }, // 2 GP9001 Tile data + { "tp025-3.bin", 0x100000, 0x7b16101e, BRF_GRA }, // 3 + + { "tp025-5.bin", 0x008000, 0xbf8ffde5, BRF_ESS | BRF_PRG }, // 4 CPU #1 code +}; + +STD_ROM_PICK(pipibibsa) +STD_ROM_FN(pipibibsa) + +struct BurnDriver BurnDrvPipibibsa = { + "pipibibsa", "pipibibs", NULL, NULL, "1991", + "Pipi & Bibis / Whoopee!! (Z80 sound cpu, set 2)\0", NULL, "Toaplan", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_68K_Zx80, GBF_PLATFORM, 0, + NULL, pipibibsaRomInfo, pipibibsaRomName, NULL, NULL, PipibibsInputInfo, PipibibsDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 320, 240, 4, 3 +}; + + +// Pipi & Bibis / Whoopee!! (prototype) + +static struct BurnRomInfo pipibibspRomDesc[] = { + { "pip_cpu_e", 0x020000, 0xae3205bd, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "pip_cpu_o", 0x020000, 0x241669a9, BRF_ESS | BRF_PRG }, // 1 + + { "cg_01_l", 0x080000, 0x21d1ef46, BRF_GRA }, // 2 GP9001 Tile data + { "cg_01_h", 0x080000, 0xd5726328, BRF_GRA }, // 3 + { "cg_23_l", 0x080000, 0x114d41d0, BRF_GRA }, // 4 + { "cg_23_h", 0x080000, 0xe0468152, BRF_GRA }, // 5 + + { "pip_snd", 0x008000, 0x8ebf183b, BRF_ESS | BRF_PRG }, // 6 CPU #1 code +}; + +STD_ROM_PICK(pipibibsp) +STD_ROM_FN(pipibibsp) + +struct BurnDriver BurnDrvPipibibsp = { + "pipibibsp", "pipibibs", NULL, NULL, "1991", + "Pipi & Bibis / Whoopee!! (prototype)\0", NULL, "Toaplan", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_PROTOTYPE, 2, HARDWARE_TOAPLAN_68K_Zx80, GBF_PLATFORM, 0, + NULL, pipibibspRomInfo, pipibibspRomName, NULL, NULL, PipibibsInputInfo, PipibibsDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 320, 240, 4, 3 +}; diff --git a/src/burn/drv/toaplan/d_rallybik.cpp b/src/burn/drv/toaplan/d_rallybik.cpp index 09ee972cc..f4208c594 100644 --- a/src/burn/drv/toaplan/d_rallybik.cpp +++ b/src/burn/drv/toaplan/d_rallybik.cpp @@ -1,616 +1,615 @@ -#include "toaplan.h" - -#define REFRESHRATE 55.14 -#define VBLANK_LINES (32) - -static UINT8 *AllMem; -static UINT8 *MemEnd; -static UINT8 *AllRam; -static UINT8 *RamEnd; -static UINT8 *Drv68KROM; -static UINT8 *DrvZ80ROM; -static UINT8 *Drv68KRAM; -static UINT8 *DrvSprRAM; -static UINT8 *DrvSprBuf; -static UINT8 *DrvPalRAM; -static UINT8 *DrvPalRAM2; -static UINT8 *DrvShareRAM; - -static UINT8 DrvInputs[3]; -static UINT8 DrvDips[3]; -static UINT8 DrvJoy1[8]; -static UINT8 DrvJoy2[8]; -static UINT8 DrvJoy3[8]; -static UINT8 DrvReset; - -static INT32 nColCount = 0x0800; - -static UINT8 bDrawScreen; -static bool bVBlank; - -static bool bEnableInterrupts; - -static struct BurnInputInfo RallybikInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p1 coin" }, - {"P1 Start", BIT_DIGITAL, DrvJoy3 + 5, "p1 start" }, - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, - - {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p2 coin" }, - {"P2 Start", BIT_DIGITAL, DrvJoy3 + 6, "p2 start" }, - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, - {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, - {"Tilt", BIT_DIGITAL, DrvJoy3 + 1, "tilt" }, - {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, - {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, - {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, -}; - -STDINPUTINFO(Rallybik) - -static struct BurnDIPInfo RallybikDIPList[]= -{ - {0x13, 0xff, 0xff, 0x01, NULL }, - {0x14, 0xff, 0xff, 0x20, NULL }, - {0x15, 0xff, 0xff, 0x00, NULL }, - - {0 , 0xfe, 0 , 2, "Cabinet" }, - {0x13, 0x01, 0x01, 0x01, "Upright" }, - {0x13, 0x01, 0x01, 0x00, "Cocktail" }, - - {0 , 0xfe, 0 , 2, "Flip Screen" }, - {0x13, 0x01, 0x02, 0x00, "Off" }, - {0x13, 0x01, 0x02, 0x02, "On" }, - - {0 , 0xfe, 0 , 2, "Demo Sounds" }, - {0x13, 0x01, 0x08, 0x08, "Off" }, - {0x13, 0x01, 0x08, 0x00, "On" }, - - {0 , 0xfe, 0 , 4, "Coin A" }, - {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, - {0x13, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, - {0x13, 0x01, 0x30, 0x30, "2 Coins 3 Credits" }, - {0x13, 0x01, 0x30, 0x10, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Coin B" }, - {0x13, 0x01, 0xc0, 0x80, "2 Coins 1 Credits" }, - {0x13, 0x01, 0xc0, 0x00, "1 Coin 1 Credits" }, - {0x13, 0x01, 0xc0, 0xc0, "2 Coins 3 Credits" }, - {0x13, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" }, - - {0 , 0xfe, 0 , 4, "Difficulty" }, - {0x14, 0x01, 0x03, 0x01, "Easy" }, - {0x14, 0x01, 0x03, 0x00, "Medium" }, - {0x14, 0x01, 0x03, 0x02, "Hard" }, - {0x14, 0x01, 0x03, 0x03, "Hardest" }, - - {0 , 0xfe, 0 , 4, "Territory/Copyright" }, - {0x14, 0x01, 0x30, 0x20, "World/Taito Corp Japan" }, - {0x14, 0x01, 0x30, 0x10, "USA/Taito America" }, - {0x14, 0x01, 0x30, 0x00, "Japan/Taito Corp" }, - {0x14, 0x01, 0x30, 0x30, "USA/Taito America (Romstar)" }, - - {0 , 0xfe, 0 , 2, "Dip Switch Display" }, - {0x14, 0x01, 0x40, 0x00, "Off" }, - {0x14, 0x01, 0x40, 0x40, "On" }, - - {0 , 0xfe, 0 , 2, "Allow Continue" }, - {0x14, 0x01, 0x80, 0x80, "No" }, - {0x14, 0x01, 0x80, 0x00, "Yes" }, -}; - -STDDIPINFO(Rallybik) - -void __fastcall rallybikWriteWord(UINT32 a, UINT16 d) -{ - switch (a) - { - case 0x100000: - // rallybik_bcu_flipscreen_w - return; - - case 0x100002: - ToaBCU2SetRAMPointer(d); - return; - - case 0x100004: - case 0x100006: - ToaBCU2WriteRAM(d); - return; - - case 0x100010: - case 0x100012: - case 0x100014: - case 0x100016: - case 0x100018: - case 0x10001a: - case 0x10001c: - case 0x10001e: - BCU2Reg[(a & 0x0f) >> 1] = d; - return; - - case 0x140002: - bEnableInterrupts = d & 0xff; - return; - - case 0x140008: - case 0x14000a: - case 0x14000c: - case 0x14000e: - // toaplan1_bcu_control_w - return; - - case 0x1c0000: - nBCU2TileXOffset = d; - return; - - case 0x1c0002: - nBCU2TileYOffset = d; - return; - - case 0x1c8000: - if (d == 0) { - ZetReset(); - } - return; - } -} - -void __fastcall rallybikWriteByte(UINT32 , UINT8 ) -{ - return; -} - -UINT16 __fastcall rallybikReadWord(UINT32 a) -{ - switch (a) - { - case 0x100002: - return ToaBCU2GetRAMPointer(); - - case 0x100004: // ok? - { - INT32 data = ToaBCU2ReadRAM_Hi(); - data |= ((data & 0xf000) >> 4) | ((data & 0x0030) << 2); - return data; - } - - case 0x100006: - return ToaBCU2ReadRAM_Lo(); - - case 0x100010: - case 0x100012: - case 0x100014: - case 0x100016: - case 0x100018: - case 0x10001a: - case 0x10001c: - case 0x10001e: - return BCU2Reg[(a & 0x0f) >> 1]; - } - - return 0; -} - -UINT8 __fastcall rallybikReadByte(UINT32 a) -{ - switch (a) - { - case 0x140001: - return ToaVBlankRegister(); - } - - return 0; -} - -void __fastcall rallybik_sound_write_port(UINT16 p, UINT8 d) -{ - switch (p & 0xff) - { - case 0x30: // toaplan1_coin_w - return; - - case 0x60: - BurnYM3812Write(0, d); - return; - - case 0x61: - BurnYM3812Write(1, d); - return; - } -} - -UINT8 __fastcall rallybik_sound_read_port(UINT16 p) -{ - switch (p & 0xff) - { - case 0x00: - return DrvInputs[0]; - - case 0x10: - return DrvInputs[1]; - - case 0x20: - return DrvInputs[2]; - - case 0x40: - return DrvDips[0]; - - case 0x50: - return DrvDips[1]; - - case 0x60: - case 0x61: - return BurnYM3812Read(p & 1); - - case 0x70: - return DrvDips[2]; - } - - return 0; -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - - bEnableInterrupts = false; - - return 0; -} - -static INT32 MemIndex() -{ - UINT8 *Next; Next = AllMem; - - Drv68KROM = Next; Next += 0x080000; - DrvZ80ROM = Next; Next += 0x010000; - BCU2ROM = Next; Next += nBCU2ROMSize; - FCU2ROM = Next; Next += nFCU2ROMSize; - - AllRam = Next; - - Drv68KRAM = Next; Next += 0x004000; - DrvPalRAM = Next; Next += 0x000800; - DrvPalRAM2 = Next; Next += 0x000800; - - RamZ80 = Next; - DrvShareRAM = Next; Next += 0x008000; - - DrvSprRAM = Next; Next += 0x001000; - - BCU2RAM = Next; Next += 0x010000; - DrvSprBuf = Next; - FCU2RAM = Next; Next += 0x001000; - FCU2RAMSize = Next; Next += 0x000080; - - RamEnd = Next; - - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - - MemEnd = Next; - - return 0; -} - -static void DrvSpriteDecode() -{ - UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); - if (tmp == NULL) { - return; - } - - memcpy (tmp, FCU2ROM, 0x40000); - memset (FCU2ROM, 0, 0x80000); - - for (INT32 i = 0; i < (0x40000 / 4) * 8; i++) { - for (INT32 j = 0; j < 4; j++) { - FCU2ROM[i] |= ((tmp[(j * 0x10000) + (i/8)] >> (~i & 7)) & 1) << (3 - j); - } - } - - BurnFree (tmp); -} - -static INT32 DrvInit() -{ - INT32 nLen; - - Rallybik = 1; - -// bToaRotateScreen = true; - - BurnSetRefreshRate(REFRESHRATE); - - nBCU2ROMSize = 0x080000; - nFCU2ROMSize = 0x080000; - - // Find out how much memory is needed - AllMem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(AllMem, 0, nLen); - MemIndex(); - - if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x040001, 2, 2)) return 1; - if (BurnLoadRom(Drv68KROM + 0x040000, 3, 2)) return 1; - - if (BurnLoadRom(DrvZ80ROM, 4, 1)) return 1; - - ToaLoadTiles(BCU2ROM, 5, nBCU2ROMSize); -// ToaLoadTiles(FCU2ROM, 9, nFCU2ROMSize); - - if (BurnLoadRom(FCU2ROM + 0x000000, 9, 1)) return 1; - if (BurnLoadRom(FCU2ROM + 0x010000, 10, 1)) return 1; - if (BurnLoadRom(FCU2ROM + 0x020000, 11, 1)) return 1; - if (BurnLoadRom(FCU2ROM + 0x030000, 12, 1)) return 1; - - DrvSpriteDecode(); - - { - SekInit(0, 0x68000); - SekOpen(0); - SekMapMemory(Drv68KROM, 0x000000, 0x00FFFF, SM_ROM); - SekMapMemory(Drv68KROM + 0x40000, 0x040000, 0x07FFFF, SM_ROM); - SekMapMemory(Drv68KRAM, 0x080000, 0x083FFF, SM_RAM); - SekMapMemory(DrvSprRAM, 0x0c0000, 0x0C0FFF, SM_RAM); - SekMapMemory(DrvPalRAM, 0x144000, 0x1447FF, SM_RAM); - SekMapMemory(DrvPalRAM2, 0x146000, 0x1467FF, SM_RAM); - SekSetReadWordHandler(0, rallybikReadWord); - SekSetReadByteHandler(0, rallybikReadByte); - SekSetWriteWordHandler(0, rallybikWriteWord); - SekSetWriteByteHandler(0, rallybikWriteByte); - - SekMapHandler(1, 0x180000, 0x180FFF, SM_RAM); - SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); - SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); - SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); - SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); - SekClose(); - - ZetInit(0); - ZetOpen(0); - ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); - ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); - ZetMapArea(0x8000, 0xffff, 0, DrvShareRAM); - ZetMapArea(0x8000, 0xffff, 1, DrvShareRAM); - ZetMapArea(0x8000, 0xffff, 2, DrvShareRAM); - ZetSetOutHandler(rallybik_sound_write_port); - ZetSetInHandler(rallybik_sound_read_port); - ZetMemEnd(); - ZetClose(); - } - - nLayer0XOffset = 0x0d + 6; - nLayer1XOffset = 0x0d + 4; - nLayer2XOffset = 0x0d + 2; - nLayer3XOffset = 0x0d + 0; - nLayer0YOffset = nLayer1YOffset = nLayer2YOffset = nLayer3YOffset = 0x111; - - ToaInitBCU2(); - - ToaOpaquePriority = 0; - - nToaPalLen = nColCount; - ToaPalSrc = DrvPalRAM; - ToaPalSrc2 = DrvPalRAM2; - ToaPalInit(); - - BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); - BurnTimerAttachZetYM3812(28000000 / 8); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); - - return 0; -} - -static INT32 DrvExit() -{ - BurnYM3812Exit(); - ToaPalExit(); - - ToaExitBCU2(); - ToaZExit(); - SekExit(); - - BurnFree(AllMem); - - Rallybik = 0; - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0x120); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderBCU2(); - } - - ToaPalUpdate(); - ToaPal2Update(); - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 4; - - if (DrvReset) { - DrvDoReset(); - } - - memset (DrvInputs, 0, 3); - for (INT32 i = 0; i < 8; i++) { - DrvInputs[0] |= (DrvJoy1[i] & 1) << i; - DrvInputs[1] |= (DrvJoy2[i] & 1) << i; - DrvInputs[2] |= (DrvJoy3[i] & 1) << i; - } - ToaClearOpposites(&DrvInputs[0]); - ToaClearOpposites(&DrvInputs[1]); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); - nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext; - - // Run 68000 - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - - // Trigger VBlank interrupt - if (nNext > nToaCyclesVBlankStart) { - if (SekTotalCycles() < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); - SekRun(nCyclesSegment); - } - - if (pBurnDraw) { - DrvDraw(); - } - - memcpy (DrvSprBuf, DrvSprRAM, 0x1000); - - bVBlank = true; - if (bEnableInterrupts) { - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - } - - nCyclesSegment = nNext - SekTotalCycles(); - if (bVBlank || (!CheckSleep(0))) { - SekRun(nCyclesSegment); - } else { - SekIdle(nCyclesSegment); - } - - BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); - } - - nToa1Cycles68KSync = SekTotalCycles(); - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - - SekClose(); - ZetClose(); - - return 0; -} - -static INT32 DrvScan(INT32 nAction, INT32* pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { - *pnMin = 0x029707; - } - if (nAction & ACB_VOLATILE) { - memset(&ba, 0, sizeof(ba)); - ba.Data = AllRam; - ba.nLen = RamEnd - AllRam; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); - ZetScan(nAction); - - BurnYM3812Scan(nAction, pnMin); - - SCAN_VAR(nCyclesDone); - } - - return 0; -} - - -// Rally Bike / Dash Yarou - -static struct BurnRomInfo rallybikRomDesc[] = { - { "b45-02.rom", 0x08000, 0x383386d7, BRF_PRG | BRF_ESS }, // 0 CPU #0 code - { "b45-01.rom", 0x08000, 0x7602f6a7, BRF_PRG | BRF_ESS }, // 1 - { "b45-04.rom", 0x20000, 0xe9b005b1, BRF_PRG | BRF_ESS }, // 2 - { "b45-03.rom", 0x20000, 0x555344ce, BRF_PRG | BRF_ESS }, // 3 - - { "b45-05.rom", 0x04000, 0x10814601, BRF_PRG | BRF_ESS }, // 4 CPU #1 code - - { "b45-09.bin", 0x20000, 0x1dc7b010, BRF_GRA }, // 5 Tile data - { "b45-08.bin", 0x20000, 0xfab661ba, BRF_GRA }, // 6 - { "b45-07.bin", 0x20000, 0xcd3748b4, BRF_GRA }, // 7 - { "b45-06.bin", 0x20000, 0x144b085c, BRF_GRA }, // 8 - - { "b45-11.rom", 0x10000, 0x0d56e8bb, BRF_GRA }, // 9 - { "b45-10.rom", 0x10000, 0xdbb7c57e, BRF_GRA }, // 10 - { "b45-12.rom", 0x10000, 0xcf5aae4e, BRF_GRA }, // 11 - { "b45-13.rom", 0x10000, 0x1683b07c, BRF_GRA }, // 12 - - { "b45-15.bpr", 0x00100, 0x24e7d62f, BRF_OPT }, // 13 - { "b45-16.bpr", 0x00100, 0xa50cef09, BRF_OPT }, // 14 - { "b45-14.bpr", 0x00020, 0xf72482db, BRF_OPT }, // 15 - { "b45-17.bpr", 0x00020, 0xbc88cced, BRF_OPT }, // 16 Sprite attribute PROM? -}; - -STD_ROM_PICK(rallybik) -STD_ROM_FN(rallybik) - -struct BurnDriver BurnDrvRallybik = { - "rallybik", NULL, NULL, NULL, "1988", - "Rally Bike / Dash Yarou\0", NULL, "[Toaplan] Taito Corporation", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, rallybikRomInfo, rallybikRomName, NULL, NULL, RallybikInputInfo, RallybikDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; +#include "toaplan.h" + +#define REFRESHRATE 55.14 +#define VBLANK_LINES (32) + +static UINT8 *AllMem; +static UINT8 *MemEnd; +static UINT8 *AllRam; +static UINT8 *RamEnd; +static UINT8 *Drv68KROM; +static UINT8 *DrvZ80ROM; +static UINT8 *Drv68KRAM; +static UINT8 *DrvSprRAM; +static UINT8 *DrvSprBuf; +static UINT8 *DrvPalRAM; +static UINT8 *DrvPalRAM2; +static UINT8 *DrvShareRAM; + +static UINT8 DrvInputs[3]; +static UINT8 DrvDips[3]; +static UINT8 DrvJoy1[8]; +static UINT8 DrvJoy2[8]; +static UINT8 DrvJoy3[8]; +static UINT8 DrvReset; + +static INT32 nColCount = 0x0800; + +static UINT8 bDrawScreen; +static bool bVBlank; + +static bool bEnableInterrupts; + +static struct BurnInputInfo RallybikInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p1 coin" }, + {"P1 Start", BIT_DIGITAL, DrvJoy3 + 5, "p1 start" }, + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" }, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" }, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" }, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" }, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" }, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" }, + + {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 4, "p2 coin" }, + {"P2 Start", BIT_DIGITAL, DrvJoy3 + 6, "p2 start" }, + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" }, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" }, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" }, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" }, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" }, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" }, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset" }, + {"Service", BIT_DIGITAL, DrvJoy3 + 0, "service" }, + {"Tilt", BIT_DIGITAL, DrvJoy3 + 1, "tilt" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" }, + {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" }, + {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" }, +}; + +STDINPUTINFO(Rallybik) + +static struct BurnDIPInfo RallybikDIPList[]= +{ + {0x13, 0xff, 0xff, 0x01, NULL }, + {0x14, 0xff, 0xff, 0x20, NULL }, + {0x15, 0xff, 0xff, 0x00, NULL }, + + {0 , 0xfe, 0 , 2, "Cabinet" }, + {0x13, 0x01, 0x01, 0x01, "Upright" }, + {0x13, 0x01, 0x01, 0x00, "Cocktail" }, + + {0 , 0xfe, 0 , 2, "Flip Screen" }, + {0x13, 0x01, 0x02, 0x00, "Off" }, + {0x13, 0x01, 0x02, 0x02, "On" }, + + {0 , 0xfe, 0 , 2, "Demo Sounds" }, + {0x13, 0x01, 0x08, 0x08, "Off" }, + {0x13, 0x01, 0x08, 0x00, "On" }, + + {0 , 0xfe, 0 , 4, "Coin A" }, + {0x13, 0x01, 0x30, 0x20, "2 Coins 1 Credits" }, + {0x13, 0x01, 0x30, 0x00, "1 Coin 1 Credits" }, + {0x13, 0x01, 0x30, 0x30, "2 Coins 3 Credits" }, + {0x13, 0x01, 0x30, 0x10, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Coin B" }, + {0x13, 0x01, 0xc0, 0x80, "2 Coins 1 Credits" }, + {0x13, 0x01, 0xc0, 0x00, "1 Coin 1 Credits" }, + {0x13, 0x01, 0xc0, 0xc0, "2 Coins 3 Credits" }, + {0x13, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" }, + + {0 , 0xfe, 0 , 4, "Difficulty" }, + {0x14, 0x01, 0x03, 0x01, "Easy" }, + {0x14, 0x01, 0x03, 0x00, "Medium" }, + {0x14, 0x01, 0x03, 0x02, "Hard" }, + {0x14, 0x01, 0x03, 0x03, "Hardest" }, + + {0 , 0xfe, 0 , 4, "Territory/Copyright" }, + {0x14, 0x01, 0x30, 0x20, "World/Taito Corp Japan" }, + {0x14, 0x01, 0x30, 0x10, "USA/Taito America" }, + {0x14, 0x01, 0x30, 0x00, "Japan/Taito Corp" }, + {0x14, 0x01, 0x30, 0x30, "USA/Taito America (Romstar)" }, + + {0 , 0xfe, 0 , 2, "Dip Switch Display" }, + {0x14, 0x01, 0x40, 0x00, "Off" }, + {0x14, 0x01, 0x40, 0x40, "On" }, + + {0 , 0xfe, 0 , 2, "Allow Continue" }, + {0x14, 0x01, 0x80, 0x80, "No" }, + {0x14, 0x01, 0x80, 0x00, "Yes" }, +}; + +STDDIPINFO(Rallybik) + +void __fastcall rallybikWriteWord(UINT32 a, UINT16 d) +{ + switch (a) + { + case 0x100000: + // rallybik_bcu_flipscreen_w + return; + + case 0x100002: + ToaBCU2SetRAMPointer(d); + return; + + case 0x100004: + case 0x100006: + ToaBCU2WriteRAM(d); + return; + + case 0x100010: + case 0x100012: + case 0x100014: + case 0x100016: + case 0x100018: + case 0x10001a: + case 0x10001c: + case 0x10001e: + BCU2Reg[(a & 0x0f) >> 1] = d; + return; + + case 0x140002: + bEnableInterrupts = d & 0xff; + return; + + case 0x140008: + case 0x14000a: + case 0x14000c: + case 0x14000e: + // toaplan1_bcu_control_w + return; + + case 0x1c0000: + nBCU2TileXOffset = d; + return; + + case 0x1c0002: + nBCU2TileYOffset = d; + return; + + case 0x1c8000: + if (d == 0) { + ZetReset(); + } + return; + } +} + +void __fastcall rallybikWriteByte(UINT32 , UINT8 ) +{ + return; +} + +UINT16 __fastcall rallybikReadWord(UINT32 a) +{ + switch (a) + { + case 0x100002: + return ToaBCU2GetRAMPointer(); + + case 0x100004: // ok? + { + INT32 data = ToaBCU2ReadRAM_Hi(); + data |= ((data & 0xf000) >> 4) | ((data & 0x0030) << 2); + return data; + } + + case 0x100006: + return ToaBCU2ReadRAM_Lo(); + + case 0x100010: + case 0x100012: + case 0x100014: + case 0x100016: + case 0x100018: + case 0x10001a: + case 0x10001c: + case 0x10001e: + return BCU2Reg[(a & 0x0f) >> 1]; + } + + return 0; +} + +UINT8 __fastcall rallybikReadByte(UINT32 a) +{ + switch (a) + { + case 0x140001: + return ToaVBlankRegister(); + } + + return 0; +} + +void __fastcall rallybik_sound_write_port(UINT16 p, UINT8 d) +{ + switch (p & 0xff) + { + case 0x30: // toaplan1_coin_w + return; + + case 0x60: + BurnYM3812Write(0, d); + return; + + case 0x61: + BurnYM3812Write(1, d); + return; + } +} + +UINT8 __fastcall rallybik_sound_read_port(UINT16 p) +{ + switch (p & 0xff) + { + case 0x00: + return DrvInputs[0]; + + case 0x10: + return DrvInputs[1]; + + case 0x20: + return DrvInputs[2]; + + case 0x40: + return DrvDips[0]; + + case 0x50: + return DrvDips[1]; + + case 0x60: + case 0x61: + return BurnYM3812Read(p & 1); + + case 0x70: + return DrvDips[2]; + } + + return 0; +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + + bEnableInterrupts = false; + + return 0; +} + +static INT32 MemIndex() +{ + UINT8 *Next; Next = AllMem; + + Drv68KROM = Next; Next += 0x080000; + DrvZ80ROM = Next; Next += 0x010000; + BCU2ROM = Next; Next += nBCU2ROMSize; + FCU2ROM = Next; Next += nFCU2ROMSize; + + AllRam = Next; + + Drv68KRAM = Next; Next += 0x004000; + DrvPalRAM = Next; Next += 0x000800; + DrvPalRAM2 = Next; Next += 0x000800; + + RamZ80 = Next; + DrvShareRAM = Next; Next += 0x008000; + + DrvSprRAM = Next; Next += 0x001000; + + BCU2RAM = Next; Next += 0x010000; + DrvSprBuf = Next; + FCU2RAM = Next; Next += 0x001000; + FCU2RAMSize = Next; Next += 0x000080; + + RamEnd = Next; + + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + + MemEnd = Next; + + return 0; +} + +static void DrvSpriteDecode() +{ + UINT8 *tmp = (UINT8*)BurnMalloc(0x40000); + if (tmp == NULL) { + return; + } + + memcpy (tmp, FCU2ROM, 0x40000); + memset (FCU2ROM, 0, 0x80000); + + for (INT32 i = 0; i < (0x40000 / 4) * 8; i++) { + for (INT32 j = 0; j < 4; j++) { + FCU2ROM[i] |= ((tmp[(j * 0x10000) + (i/8)] >> (~i & 7)) & 1) << (3 - j); + } + } + + BurnFree (tmp); +} + +static INT32 DrvInit() +{ + INT32 nLen; + + Rallybik = 1; + +// bToaRotateScreen = true; + + BurnSetRefreshRate(REFRESHRATE); + + nBCU2ROMSize = 0x080000; + nFCU2ROMSize = 0x080000; + + // Find out how much memory is needed + AllMem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(AllMem, 0, nLen); + MemIndex(); + + if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x040001, 2, 2)) return 1; + if (BurnLoadRom(Drv68KROM + 0x040000, 3, 2)) return 1; + + if (BurnLoadRom(DrvZ80ROM, 4, 1)) return 1; + + ToaLoadTiles(BCU2ROM, 5, nBCU2ROMSize); +// ToaLoadTiles(FCU2ROM, 9, nFCU2ROMSize); + + if (BurnLoadRom(FCU2ROM + 0x000000, 9, 1)) return 1; + if (BurnLoadRom(FCU2ROM + 0x010000, 10, 1)) return 1; + if (BurnLoadRom(FCU2ROM + 0x020000, 11, 1)) return 1; + if (BurnLoadRom(FCU2ROM + 0x030000, 12, 1)) return 1; + + DrvSpriteDecode(); + + { + SekInit(0, 0x68000); + SekOpen(0); + SekMapMemory(Drv68KROM, 0x000000, 0x00FFFF, SM_ROM); + SekMapMemory(Drv68KROM + 0x40000, 0x040000, 0x07FFFF, SM_ROM); + SekMapMemory(Drv68KRAM, 0x080000, 0x083FFF, SM_RAM); + SekMapMemory(DrvSprRAM, 0x0c0000, 0x0C0FFF, SM_RAM); + SekMapMemory(DrvPalRAM, 0x144000, 0x1447FF, SM_RAM); + SekMapMemory(DrvPalRAM2, 0x146000, 0x1467FF, SM_RAM); + SekSetReadWordHandler(0, rallybikReadWord); + SekSetReadByteHandler(0, rallybikReadByte); + SekSetWriteWordHandler(0, rallybikWriteWord); + SekSetWriteByteHandler(0, rallybikWriteByte); + + SekMapHandler(1, 0x180000, 0x180FFF, SM_RAM); + SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); + SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); + SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); + SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); + SekClose(); + + ZetInit(0); + ZetOpen(0); + ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM); + ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM); + ZetMapArea(0x8000, 0xffff, 0, DrvShareRAM); + ZetMapArea(0x8000, 0xffff, 1, DrvShareRAM); + ZetMapArea(0x8000, 0xffff, 2, DrvShareRAM); + ZetSetOutHandler(rallybik_sound_write_port); + ZetSetInHandler(rallybik_sound_read_port); + ZetClose(); + } + + nLayer0XOffset = 0x0d + 6; + nLayer1XOffset = 0x0d + 4; + nLayer2XOffset = 0x0d + 2; + nLayer3XOffset = 0x0d + 0; + nLayer0YOffset = nLayer1YOffset = nLayer2YOffset = nLayer3YOffset = 0x111; + + ToaInitBCU2(); + + ToaOpaquePriority = 0; + + nToaPalLen = nColCount; + ToaPalSrc = DrvPalRAM; + ToaPalSrc2 = DrvPalRAM2; + ToaPalInit(); + + BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); + BurnTimerAttachZetYM3812(28000000 / 8); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); + + return 0; +} + +static INT32 DrvExit() +{ + BurnYM3812Exit(); + ToaPalExit(); + + ToaExitBCU2(); + ToaZExit(); + SekExit(); + + BurnFree(AllMem); + + Rallybik = 0; + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0x120); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderBCU2(); + } + + ToaPalUpdate(); + ToaPal2Update(); + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 4; + + if (DrvReset) { + DrvDoReset(); + } + + memset (DrvInputs, 0, 3); + for (INT32 i = 0; i < 8; i++) { + DrvInputs[0] |= (DrvJoy1[i] & 1) << i; + DrvInputs[1] |= (DrvJoy2[i] & 1) << i; + DrvInputs[2] |= (DrvJoy3[i] & 1) << i; + } + ToaClearOpposites(&DrvInputs[0]); + ToaClearOpposites(&DrvInputs[1]); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); + nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext; + + // Run 68000 + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + + // Trigger VBlank interrupt + if (nNext > nToaCyclesVBlankStart) { + if (SekTotalCycles() < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); + SekRun(nCyclesSegment); + } + + if (pBurnDraw) { + DrvDraw(); + } + + memcpy (DrvSprBuf, DrvSprRAM, 0x1000); + + bVBlank = true; + if (bEnableInterrupts) { + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + } + + nCyclesSegment = nNext - SekTotalCycles(); + if (bVBlank || (!CheckSleep(0))) { + SekRun(nCyclesSegment); + } else { + SekIdle(nCyclesSegment); + } + + BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); + } + + nToa1Cycles68KSync = SekTotalCycles(); + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + + SekClose(); + ZetClose(); + + return 0; +} + +static INT32 DrvScan(INT32 nAction, INT32* pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { + *pnMin = 0x029707; + } + if (nAction & ACB_VOLATILE) { + memset(&ba, 0, sizeof(ba)); + ba.Data = AllRam; + ba.nLen = RamEnd - AllRam; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); + ZetScan(nAction); + + BurnYM3812Scan(nAction, pnMin); + + SCAN_VAR(nCyclesDone); + } + + return 0; +} + + +// Rally Bike / Dash Yarou + +static struct BurnRomInfo rallybikRomDesc[] = { + { "b45-02.rom", 0x08000, 0x383386d7, BRF_PRG | BRF_ESS }, // 0 CPU #0 code + { "b45-01.rom", 0x08000, 0x7602f6a7, BRF_PRG | BRF_ESS }, // 1 + { "b45-04.rom", 0x20000, 0xe9b005b1, BRF_PRG | BRF_ESS }, // 2 + { "b45-03.rom", 0x20000, 0x555344ce, BRF_PRG | BRF_ESS }, // 3 + + { "b45-05.rom", 0x04000, 0x10814601, BRF_PRG | BRF_ESS }, // 4 CPU #1 code + + { "b45-09.bin", 0x20000, 0x1dc7b010, BRF_GRA }, // 5 Tile data + { "b45-08.bin", 0x20000, 0xfab661ba, BRF_GRA }, // 6 + { "b45-07.bin", 0x20000, 0xcd3748b4, BRF_GRA }, // 7 + { "b45-06.bin", 0x20000, 0x144b085c, BRF_GRA }, // 8 + + { "b45-11.rom", 0x10000, 0x0d56e8bb, BRF_GRA }, // 9 + { "b45-10.rom", 0x10000, 0xdbb7c57e, BRF_GRA }, // 10 + { "b45-12.rom", 0x10000, 0xcf5aae4e, BRF_GRA }, // 11 + { "b45-13.rom", 0x10000, 0x1683b07c, BRF_GRA }, // 12 + + { "b45-15.bpr", 0x00100, 0x24e7d62f, BRF_OPT }, // 13 + { "b45-16.bpr", 0x00100, 0xa50cef09, BRF_OPT }, // 14 + { "b45-14.bpr", 0x00020, 0xf72482db, BRF_OPT }, // 15 + { "b45-17.bpr", 0x00020, 0xbc88cced, BRF_OPT }, // 16 Sprite attribute PROM? +}; + +STD_ROM_PICK(rallybik) +STD_ROM_FN(rallybik) + +struct BurnDriver BurnDrvRallybik = { + "rallybik", NULL, NULL, NULL, "1988", + "Rally Bike / Dash Yarou\0", NULL, "[Toaplan] Taito Corporation", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, rallybikRomInfo, rallybikRomName, NULL, NULL, RallybikInputInfo, RallybikDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; diff --git a/src/burn/drv/toaplan/d_shippumd.cpp b/src/burn/drv/toaplan/d_shippumd.cpp index e9fc837c3..7a20eb475 100644 --- a/src/burn/drv/toaplan/d_shippumd.cpp +++ b/src/burn/drv/toaplan/d_shippumd.cpp @@ -1,703 +1,702 @@ -#include "toaplan.h" -// Shippu Mahou Daisakusen - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -// Rom information -static struct BurnRomInfo shippumdRomDesc[] = { - { "ma02rom1.bin", 0x080000, 0xA678B149, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "ma02rom0.bin", 0x080000, 0xF226A212, BRF_ESS | BRF_PRG }, // 1 (odd) - - { "ma02rom3.bin", 0x200000, 0x0E797142, BRF_GRA }, // 2 GP9001 Tile data - { "ma02rom4.bin", 0x200000, 0x72A6FA53, BRF_GRA }, // 3 - - { "ma02rom5.bin", 0x008000, 0x116AE559, BRF_GRA }, // 4 Extra text layer tile data - - { "ma02rom2.bin", 0x010000, 0xDDE8A57E, BRF_ESS | BRF_PRG }, // 5 Z80 program - - { "ma02rom6.bin", 0x080000, 0x199E7CAE, BRF_SND }, // 6 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(shippumd) -STD_ROM_FN(shippumd) - -static struct BurnRomInfo kingdmgpRomDesc[] = { - { "ma02rom1.bin", 0x080000, 0xA678B149, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) - { "ma02rom0.bin", 0x080000, 0xF226A212, BRF_ESS | BRF_PRG }, // 1 (odd) - - { "ma02rom3.bin", 0x200000, 0x0E797142, BRF_GRA }, // 2 GP9001 Tile data - { "ma02rom4.bin", 0x200000, 0x72A6FA53, BRF_GRA }, // 3 - - { "ma02rom5.eng", 0x008000, 0x8C28460B, BRF_GRA }, // 4 Extra text layer tile data - - { "ma02rom2.bin", 0x010000, 0xDDE8A57E, BRF_ESS | BRF_PRG }, // 5 Z80 program - - { "ma02rom6.bin", 0x080000, 0x199E7CAE, BRF_SND }, // 6 MSM6295 ADPCM data -}; - - -STD_ROM_PICK(kingdmgp) -STD_ROM_FN(kingdmgp) - -static struct BurnInputInfo shippumdInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, -}; - -STDINPUTINFO(shippumd) - -static struct BurnDIPInfo shippumdDIPList[] = { - // Defaults - {0x14, 0xFF, 0xFF, 0x00, NULL}, - {0x15, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x01, 0x00, "Coin play"}, - {0x14, 0x01, 0x01, 0x01, "Free play"}, - {0, 0xFE, 0, 2, "Screen"}, - {0x14, 0x01, 0x02, 0x00, "Normal"}, - {0x14, 0x01, 0x02, 0x02, "Invert"}, - {0, 0xFE, 0, 2, NULL}, - {0x14, 0x01, 0x04, 0x00, "Normal mode"}, - {0x14, 0x01, 0x04, 0x04, "Test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x14, 0x01, 0x08, 0x00, "On"}, - {0x14, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, - {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0x30, 0x10, "1 coin 2 plays"}, - {0x14, 0x01, 0x30, 0x20, "2 coins 1 play"}, - {0x14, 0x01, 0x30, 0x30, "2 coins 3 plays"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, - {0x14, 0x01, 0xC0, 0x40, "1 coin 2 plays"}, - {0x14, 0x01, 0xC0, 0x80, "2 coins 1 play"}, - {0x14, 0x01, 0xC0, 0xC0, "2 coins 3 plays"}, - - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x15, 0x01, 0x03, 0x00, "B (normal)"}, - {0x15, 0x01, 0x03, 0x01, "A (easy)"}, - {0x15, 0x01, 0x03, 0x02, "C (hard)"}, - {0x15, 0x01, 0x03, 0x03, "D (more hard)"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, - {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, - {0x15, 0x01, 0x0C, 0x08, "200000 only"}, - {0x15, 0x01, 0x0C, 0x0C, "No extend"}, - {0, 0xFE, 0, 4, "Number of heroes"}, - {0x15, 0x01, 0x30, 0x00, "3"}, - {0x15, 0x01, 0x30, 0x10, "5"}, - {0x15, 0x01, 0x30, 0x20, "2"}, - {0x15, 0x01, 0x30, 0x30, "1"}, - {0, 0xFE, 0, 2, "No death & stop mode"}, - {0x15, 0x01, 0x40, 0x00, "Off"}, - {0x15, 0x01, 0x40, 0x40, "On"}, - {0, 0xFE, 0, 2, NULL}, - {0x15, 0x01, 0x80, 0x00, "Continue play"}, - {0x15, 0x01, 0x80, 0x80, "Continue impossible"}, -}; - -static struct BurnDIPInfo shippumdRegionDIPList[] = { - // Defaults - {0x16, 0xFF, 0x0E, 0x00, NULL}, - - // Region - {0, 0xFE, 0, 1, "Region"}, - {0x16, 0x01, 0x0E, 0x00, "Japan"}, - {0x16, 0x01, 0x0E, 0x02, "U.S.A."}, - {0x16, 0x01, 0x0E, 0x04, "Europe"}, - {0x16, 0x01, 0x0E, 0x06, "South East Asia"}, - {0x16, 0x01, 0x0E, 0x08, "China"}, - {0x16, 0x01, 0x0E, 0x0A, "Korea"}, - {0x16, 0x01, 0x0E, 0x0C, "Hong Kong"}, - {0x16, 0x01, 0x0E, 0x0E, "Taiwan"}, -}; - -static struct BurnDIPInfo kingdmgpRegionDIPList[] = { - // Defaults - {0x16, 0xFF, 0x0E, 0x04, NULL}, - - // Region - {0, 0xFE, 0, 7, "Region"}, - {0x16, 0x01, 0x0E, 0x02, "U.S.A."}, - {0x16, 0x01, 0x0E, 0x04, "Europe"}, - {0x16, 0x01, 0x0E, 0x06, "South East Asia"}, - {0x16, 0x01, 0x0E, 0x08, "China"}, - {0x16, 0x01, 0x0E, 0x0A, "Korea"}, - {0x16, 0x01, 0x0E, 0x0C, "Hong Kong"}, - {0x16, 0x01, 0x0E, 0x0E, "Taiwan"}, - {0x16, 0x01, 0x0E, 0x00, "Japan"}, -}; - -STDDIPINFOEXT(shippumd, shippumd, shippumdRegion) -STDDIPINFOEXT(kingdmgp, shippumd, kingdmgpRegion) - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *Ram01, *Ram02, *RamPal; - -static INT32 nColCount = 0x0800; - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x100000; // - RomZ80 = Next; Next += 0x010000; // Z80 ROM - GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data - ExtraTROM = Next; Next += 0x008000; // Extra Text layer tile data - MSM6295ROM = Next; Next += 0x080000; - RamStart = Next; - Ram01 = Next; Next += 0x010000; // CPU #0 work RAM - Ram02 = Next; Next += 0x000800; // - ExtraTRAM = Next; Next += 0x002000; // Extra tile layer - ExtraTScroll= Next; Next += 0x001000; // - ExtraTSelect= Next; Next += 0x001000; // - RamPal = Next; Next += 0x001000; // palette - RamZ80 = Next; Next += 0x004000; // Z80 RAM - GP9001RAM[0]= Next; Next += 0x004000; - GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); - RamEnd = Next; - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction,INT32 *pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029497; - } - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - SekScan(nAction); // Scan 68000 - ZetScan(nAction); // Scan Z80 - - MSM6295Scan(0, nAction); - BurnYM2151Scan(nAction); - - ToaScanGP9001(nAction, pnMin); - - SCAN_VAR(DrvInput); - } - - return 0; -} - -static INT32 LoadRoms() -{ - // Load 68000 ROM - if (ToaLoadCode(Rom01, 0, 2)) { - return 1; - } - - // Load GP9001 tile data - ToaLoadGP9001Tiles(GP9001ROM[0], 2, 2, nGP9001ROMSize[0]); - - // Load Extra text layer tile data - BurnLoadRom(ExtraTROM, 4, 1); - - // Load Z80 ROM - BurnLoadRom(RomZ80, 5, 1); - - // Load MSM6295 ADPCM data - BurnLoadRom(MSM6295ROM, 6, 1); - - return 0; -} - -UINT8 __fastcall shippumdZ80Read(UINT16 nAddress) -{ - if (nAddress == 0xE001) { - return BurnYM2151ReadStatus(); - } - if (nAddress == 0xE004) { - return MSM6295ReadStatus(0); - } - return 0; -} - -void __fastcall shippumdZ80Write(UINT16 nAddress, UINT8 nValue) -{ - switch (nAddress) { - case 0xE000: - BurnYM2151SelectRegister(nValue); - break; - case 0xE001: - BurnYM2151WriteRegister(nValue); - break; - case 0xE004: - MSM6295Command(0, nValue); - break; - } -} - -static INT32 DrvZ80Init() -{ - // Init the Z80 - ZetInit(0); - ZetOpen(0); - - ZetSetReadHandler(shippumdZ80Read); - ZetSetWriteHandler(shippumdZ80Write); - - // ROM - ZetMapArea (0x0000, 0xFFFF, 0, RomZ80); // Direct Read from ROM - ZetMapArea (0x0000, 0xFFFF, 2, RomZ80); // Direct Fetch from ROM - // RAM - ZetMapArea (0xC000, 0xDFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0xC000, 0xDFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0xC000, 0xDFFF, 2, RamZ80); // - // Callbacks - ZetMemCallback(0xE000, 0xE0FF, 0); // Read - ZetMemCallback(0xE000, 0xE0FF, 1); // Write - - ZetMemEnd(); - ZetClose(); - - return 0; -} - -UINT8 __fastcall shippumdReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x21C021: // Player 1 inputs - return DrvInput[0]; - case 0x21C025: // Player 2 inputs - return DrvInput[1]; - case 0x21C029: // Other inputs - return DrvInput[2]; - case 0x21C02D: // Dipswitch A - return DrvInput[3]; - case 0x21C031: // Dipswitch B - return DrvInput[4]; - case 0x21C035: // Dipswitch C - Territory - return DrvInput[5]; - - case 0x30000D: - return ToaVBlankRegister(); - - default: { -// printf("Attempt to read byte value of location %x\n", sekAddress); - - if ((sekAddress & 0x00FFC000) == 0x00218000) { - return RamZ80[(sekAddress & 0x3FFF) >> 1]; - } - } - } - return 0; -} - -UINT16 __fastcall shippumdReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x21C020: // Player 1 inputs - return DrvInput[0]; - case 0x21C024: // Player 2 inputs - return DrvInput[1]; - case 0x21C028: // Other inputs - return DrvInput[2]; - case 0x21C02C: // Dipswitch A - return DrvInput[3]; - case 0x21C030: // Dipswitch B - return DrvInput[4]; - case 0x21C034: // Dipswitch C - Territory - return DrvInput[5]; - - case 0x21C03C: - return ToaScanlineRegister(); - - case 0x300004: - return ToaGP9001ReadRAM_Hi(0); - case 0x300006: - return ToaGP9001ReadRAM_Lo(0); - - case 0x30000C: - return ToaVBlankRegister(); - - default: { - if ((sekAddress & 0x00FFC000) == 0x00218000) { - return RamZ80[(sekAddress & 0x3FFF) >> 1]; - } - -// printf("Attempt to read word value of location %x\n", sekAddress); - } - } - return 0; -} - -void __fastcall shippumdWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - case 0x21C01D: { - INT32 nBankOffset; - if (byteValue & 0x10) { - nBankOffset = 0x40000; - } else { - nBankOffset = 0x00000; - } - MSM6295SampleInfo[0][0] = MSM6295ROM + nBankOffset; - MSM6295SampleData[0][0] = MSM6295ROM + nBankOffset; - MSM6295SampleInfo[0][1] = MSM6295ROM + nBankOffset + 0x0100; - MSM6295SampleData[0][1] = MSM6295ROM + nBankOffset + 0x10000; - MSM6295SampleInfo[0][2] = MSM6295ROM + nBankOffset + 0x0200; - MSM6295SampleData[0][2] = MSM6295ROM + nBankOffset + 0x20000; - MSM6295SampleInfo[0][3] = MSM6295ROM + nBankOffset + 0x0300; - MSM6295SampleData[0][3] = MSM6295ROM + nBankOffset + 0x30000; - break; - } - - default: { - if ((sekAddress & 0x00FFC000) == 0x00218000) { - RamZ80[(sekAddress & 0x3FFF) >> 1] = byteValue; - } - -// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); - } - } -} - -void __fastcall shippumdWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - - case 0x21C01C: { - INT32 nBankOffset; - if (wordValue & 0x10) { - nBankOffset = 0x40000; - } else { - nBankOffset = 0x00000; - } - MSM6295SampleInfo[0][0] = MSM6295ROM + nBankOffset; - MSM6295SampleData[0][0] = MSM6295ROM + nBankOffset; - MSM6295SampleInfo[0][1] = MSM6295ROM + nBankOffset + 0x0100; - MSM6295SampleData[0][1] = MSM6295ROM + nBankOffset + 0x10000; - MSM6295SampleInfo[0][2] = MSM6295ROM + nBankOffset + 0x0200; - MSM6295SampleData[0][2] = MSM6295ROM + nBankOffset + 0x20000; - MSM6295SampleInfo[0][3] = MSM6295ROM + nBankOffset + 0x0300; - MSM6295SampleData[0][3] = MSM6295ROM + nBankOffset + 0x30000; - break; - } - - case 0x300000: // Set GP9001 VRAM address-pointer - ToaGP9001SetRAMPointer(wordValue); - break; - - case 0x300004: - case 0x300006: - ToaGP9001WriteRAM(wordValue, 0); - break; - - case 0x300008: - ToaGP9001SelectRegister(wordValue); - break; - - case 0x30000C: - ToaGP9001WriteRegister(wordValue); - break; - - default: { -// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); - - if ((sekAddress & 0x00FFC000) == 0x00218000) { - RamZ80[(sekAddress & 0x3FFF) >> 1] = wordValue; - } - } - } -} - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - - ZetOpen(0); - ZetReset(); - ZetClose(); - - MSM6295Reset(0); - BurnYM2151Reset(); - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - -#ifdef DRIVER_ROTATION - bToaRotateScreen = true; -#endif - - nGP9001ROMSize[0] = 0x400000; - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM - SekMapMemory(Ram01, 0x100000, 0x10FFFF, SM_RAM); - SekMapMemory(RamPal, 0x400000, 0x400FFF, SM_RAM); // Palette RAM - SekMapMemory(Ram02, 0x401000, 0x4017FF, SM_RAM); // Unused - SekMapMemory(ExtraTRAM, 0x500000, 0x502FFF, SM_RAM); - SekMapMemory(ExtraTSelect, 0x502000, 0x502FFF, SM_RAM); // 0x502000 - Scroll; 0x502200 - RAM - SekMapMemory(ExtraTScroll, 0x503000, 0x503FFF, SM_RAM); // 0x203000 - Offset; 0x503200 - RAM - - SekSetReadWordHandler(0, shippumdReadWord); - SekSetReadByteHandler(0, shippumdReadByte); - SekSetWriteWordHandler(0, shippumdWriteWord); - SekSetWriteByteHandler(0, shippumdWriteByte); - - SekClose(); - } - - nLayer0XOffset = -0x01D6; - nLayer1XOffset = -0x01D8; - nLayer2XOffset = -0x01DA; - ToaInitGP9001(); - - nExtraTXOffset = 0x2C; - ToaExtraTextInit(); - - DrvZ80Init(); // Initialize Z80 - - nToaPalLen = nColCount; - ToaPalSrc = RamPal; - ToaPalInit(); - - BurnYM2151Init(27000000 / 8); - BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); - MSM6295Init(0, 32000000 / 32 / 132, 1); - MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - return 0; -} - -static INT32 DrvExit() -{ - MSM6295Exit(0); - BurnYM2151Exit(); - - ToaPalExit(); - - ToaExitGP9001(); - ToaExtraTextExit(); - ToaZExit(); // Z80 exit - SekExit(); // Deallocate 68000s - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderGP9001(); // Render GP9001 graphics - ToaExtraTextLayer(); // Render extra text layer - } - - ToaPalUpdate(); // Update the palette - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 4; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x00; // Buttons - DrvInput[1] = 0x00; // Player 1 - DrvInput[2] = 0x00; // Player 2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[2] |= (DrvButton[i] & 1) << i; - } - ToaClearOpposites(&DrvInput[0]); - ToaClearOpposites(&DrvInput[1]); - - SekNewFrame(); - - nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); - nCyclesTotal[1] = TOA_Z80_SPEED / 60; - nCyclesDone[0] = nCyclesDone[1] = 0; - - SekOpen(0); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - INT32 nSoundBufferPos = 0; - - ZetOpen(0); - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU; - INT32 nNext; - - // Run 68000 - - nCurrentCPU = 0; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - - // Trigger VBlank interrupt - if (nNext > nToaCyclesVBlankStart) { - if (nCyclesDone[nCurrentCPU] < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } - - ToaBufferGP9001Sprites(); - - bVBlank = true; - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (bVBlank || (!CheckSleep(nCurrentCPU))) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); - } - - // Run Z80 - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - - { - // Render sound segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - nSoundBufferPos += nSegmentLength; - } - } - } - - { - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - BurnYM2151Render(pSoundBuf, nSegmentLength); - MSM6295Render(0, pSoundBuf, nSegmentLength); - } - } - } - - SekClose(); - ZetClose(); - - if (pBurnDraw) { - DrvDraw(); // Draw screen if needed - } - - return 0; -} - -struct BurnDriver BurnDrvShippuMD = { - "shippumd", "kingdmgp", NULL, NULL, "1994", - "Shippu Mahou Daisakusen - kingdom grandprix\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - L"\u75BE\u98A8\u9B54\u6CD5\u5927\u4F5C\u6226 - kingdom grandprix (Japan)\0Shippu Mahou Daisakusen (Japan)\0", NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, shippumdRomInfo, shippumdRomName, NULL, NULL, shippumdInputInfo, shippumdDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; - -struct BurnDriver BurnDrvKingdmGP = { - "kingdmgp", NULL, NULL, NULL, "1994", - "Kingdom Grandprix (World)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, kingdmgpRomInfo, kingdmgpRomName, NULL, NULL, shippumdInputInfo, kingdmgpDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, - 240, 320, 3, 4 -}; +#include "toaplan.h" +// Shippu Mahou Daisakusen + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +// Rom information +static struct BurnRomInfo shippumdRomDesc[] = { + { "ma02rom1.bin", 0x080000, 0xA678B149, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "ma02rom0.bin", 0x080000, 0xF226A212, BRF_ESS | BRF_PRG }, // 1 (odd) + + { "ma02rom3.bin", 0x200000, 0x0E797142, BRF_GRA }, // 2 GP9001 Tile data + { "ma02rom4.bin", 0x200000, 0x72A6FA53, BRF_GRA }, // 3 + + { "ma02rom5.bin", 0x008000, 0x116AE559, BRF_GRA }, // 4 Extra text layer tile data + + { "ma02rom2.bin", 0x010000, 0xDDE8A57E, BRF_ESS | BRF_PRG }, // 5 Z80 program + + { "ma02rom6.bin", 0x080000, 0x199E7CAE, BRF_SND }, // 6 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(shippumd) +STD_ROM_FN(shippumd) + +static struct BurnRomInfo kingdmgpRomDesc[] = { + { "ma02rom1.bin", 0x080000, 0xA678B149, BRF_ESS | BRF_PRG }, // 0 CPU #0 code (even) + { "ma02rom0.bin", 0x080000, 0xF226A212, BRF_ESS | BRF_PRG }, // 1 (odd) + + { "ma02rom3.bin", 0x200000, 0x0E797142, BRF_GRA }, // 2 GP9001 Tile data + { "ma02rom4.bin", 0x200000, 0x72A6FA53, BRF_GRA }, // 3 + + { "ma02rom5.eng", 0x008000, 0x8C28460B, BRF_GRA }, // 4 Extra text layer tile data + + { "ma02rom2.bin", 0x010000, 0xDDE8A57E, BRF_ESS | BRF_PRG }, // 5 Z80 program + + { "ma02rom6.bin", 0x080000, 0x199E7CAE, BRF_SND }, // 6 MSM6295 ADPCM data +}; + + +STD_ROM_PICK(kingdmgp) +STD_ROM_FN(kingdmgp) + +static struct BurnInputInfo shippumdInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + {"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 3"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + {"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 3"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 4, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, +}; + +STDINPUTINFO(shippumd) + +static struct BurnDIPInfo shippumdDIPList[] = { + // Defaults + {0x14, 0xFF, 0xFF, 0x00, NULL}, + {0x15, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x01, 0x00, "Coin play"}, + {0x14, 0x01, 0x01, 0x01, "Free play"}, + {0, 0xFE, 0, 2, "Screen"}, + {0x14, 0x01, 0x02, 0x00, "Normal"}, + {0x14, 0x01, 0x02, 0x02, "Invert"}, + {0, 0xFE, 0, 2, NULL}, + {0x14, 0x01, 0x04, 0x00, "Normal mode"}, + {0x14, 0x01, 0x04, 0x04, "Test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x14, 0x01, 0x08, 0x00, "On"}, + {0x14, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, + {0x14, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0x30, 0x10, "1 coin 2 plays"}, + {0x14, 0x01, 0x30, 0x20, "2 coins 1 play"}, + {0x14, 0x01, 0x30, 0x30, "2 coins 3 plays"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x14, 0x01, 0xC0, 0x00, "1 coin 1 play"}, + {0x14, 0x01, 0xC0, 0x40, "1 coin 2 plays"}, + {0x14, 0x01, 0xC0, 0x80, "2 coins 1 play"}, + {0x14, 0x01, 0xC0, 0xC0, "2 coins 3 plays"}, + + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x15, 0x01, 0x03, 0x00, "B (normal)"}, + {0x15, 0x01, 0x03, 0x01, "A (easy)"}, + {0x15, 0x01, 0x03, 0x02, "C (hard)"}, + {0x15, 0x01, 0x03, 0x03, "D (more hard)"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x15, 0x01, 0x0C, 0x00, "300000 pts every"}, + {0x15, 0x01, 0x0C, 0x04, "200000 & 500000 pts"}, + {0x15, 0x01, 0x0C, 0x08, "200000 only"}, + {0x15, 0x01, 0x0C, 0x0C, "No extend"}, + {0, 0xFE, 0, 4, "Number of heroes"}, + {0x15, 0x01, 0x30, 0x00, "3"}, + {0x15, 0x01, 0x30, 0x10, "5"}, + {0x15, 0x01, 0x30, 0x20, "2"}, + {0x15, 0x01, 0x30, 0x30, "1"}, + {0, 0xFE, 0, 2, "No death & stop mode"}, + {0x15, 0x01, 0x40, 0x00, "Off"}, + {0x15, 0x01, 0x40, 0x40, "On"}, + {0, 0xFE, 0, 2, NULL}, + {0x15, 0x01, 0x80, 0x00, "Continue play"}, + {0x15, 0x01, 0x80, 0x80, "Continue impossible"}, +}; + +static struct BurnDIPInfo shippumdRegionDIPList[] = { + // Defaults + {0x16, 0xFF, 0x0E, 0x00, NULL}, + + // Region + {0, 0xFE, 0, 1, "Region"}, + {0x16, 0x01, 0x0E, 0x00, "Japan"}, + {0x16, 0x01, 0x0E, 0x02, "U.S.A."}, + {0x16, 0x01, 0x0E, 0x04, "Europe"}, + {0x16, 0x01, 0x0E, 0x06, "South East Asia"}, + {0x16, 0x01, 0x0E, 0x08, "China"}, + {0x16, 0x01, 0x0E, 0x0A, "Korea"}, + {0x16, 0x01, 0x0E, 0x0C, "Hong Kong"}, + {0x16, 0x01, 0x0E, 0x0E, "Taiwan"}, +}; + +static struct BurnDIPInfo kingdmgpRegionDIPList[] = { + // Defaults + {0x16, 0xFF, 0x0E, 0x04, NULL}, + + // Region + {0, 0xFE, 0, 7, "Region"}, + {0x16, 0x01, 0x0E, 0x02, "U.S.A."}, + {0x16, 0x01, 0x0E, 0x04, "Europe"}, + {0x16, 0x01, 0x0E, 0x06, "South East Asia"}, + {0x16, 0x01, 0x0E, 0x08, "China"}, + {0x16, 0x01, 0x0E, 0x0A, "Korea"}, + {0x16, 0x01, 0x0E, 0x0C, "Hong Kong"}, + {0x16, 0x01, 0x0E, 0x0E, "Taiwan"}, + {0x16, 0x01, 0x0E, 0x00, "Japan"}, +}; + +STDDIPINFOEXT(shippumd, shippumd, shippumdRegion) +STDDIPINFOEXT(kingdmgp, shippumd, kingdmgpRegion) + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *Ram01, *Ram02, *RamPal; + +static INT32 nColCount = 0x0800; + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x100000; // + RomZ80 = Next; Next += 0x010000; // Z80 ROM + GP9001ROM[0]= Next; Next += nGP9001ROMSize[0]; // GP9001 tile data + ExtraTROM = Next; Next += 0x008000; // Extra Text layer tile data + MSM6295ROM = Next; Next += 0x080000; + RamStart = Next; + Ram01 = Next; Next += 0x010000; // CPU #0 work RAM + Ram02 = Next; Next += 0x000800; // + ExtraTRAM = Next; Next += 0x002000; // Extra tile layer + ExtraTScroll= Next; Next += 0x001000; // + ExtraTSelect= Next; Next += 0x001000; // + RamPal = Next; Next += 0x001000; // palette + RamZ80 = Next; Next += 0x004000; // Z80 RAM + GP9001RAM[0]= Next; Next += 0x004000; + GP9001Reg[0]= (UINT16*)Next; Next += 0x0100 * sizeof(UINT16); + RamEnd = Next; + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction,INT32 *pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029497; + } + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + SekScan(nAction); // Scan 68000 + ZetScan(nAction); // Scan Z80 + + MSM6295Scan(0, nAction); + BurnYM2151Scan(nAction); + + ToaScanGP9001(nAction, pnMin); + + SCAN_VAR(DrvInput); + } + + return 0; +} + +static INT32 LoadRoms() +{ + // Load 68000 ROM + if (ToaLoadCode(Rom01, 0, 2)) { + return 1; + } + + // Load GP9001 tile data + ToaLoadGP9001Tiles(GP9001ROM[0], 2, 2, nGP9001ROMSize[0]); + + // Load Extra text layer tile data + BurnLoadRom(ExtraTROM, 4, 1); + + // Load Z80 ROM + BurnLoadRom(RomZ80, 5, 1); + + // Load MSM6295 ADPCM data + BurnLoadRom(MSM6295ROM, 6, 1); + + return 0; +} + +UINT8 __fastcall shippumdZ80Read(UINT16 nAddress) +{ + if (nAddress == 0xE001) { + return BurnYM2151ReadStatus(); + } + if (nAddress == 0xE004) { + return MSM6295ReadStatus(0); + } + return 0; +} + +void __fastcall shippumdZ80Write(UINT16 nAddress, UINT8 nValue) +{ + switch (nAddress) { + case 0xE000: + BurnYM2151SelectRegister(nValue); + break; + case 0xE001: + BurnYM2151WriteRegister(nValue); + break; + case 0xE004: + MSM6295Command(0, nValue); + break; + } +} + +static INT32 DrvZ80Init() +{ + // Init the Z80 + ZetInit(0); + ZetOpen(0); + + ZetSetReadHandler(shippumdZ80Read); + ZetSetWriteHandler(shippumdZ80Write); + + // ROM + ZetMapArea (0x0000, 0xFFFF, 0, RomZ80); // Direct Read from ROM + ZetMapArea (0x0000, 0xFFFF, 2, RomZ80); // Direct Fetch from ROM + // RAM + ZetMapArea (0xC000, 0xDFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0xC000, 0xDFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0xC000, 0xDFFF, 2, RamZ80); // + // Callbacks + ZetMemCallback(0xE000, 0xE0FF, 0); // Read + ZetMemCallback(0xE000, 0xE0FF, 1); // Write + + ZetClose(); + + return 0; +} + +UINT8 __fastcall shippumdReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x21C021: // Player 1 inputs + return DrvInput[0]; + case 0x21C025: // Player 2 inputs + return DrvInput[1]; + case 0x21C029: // Other inputs + return DrvInput[2]; + case 0x21C02D: // Dipswitch A + return DrvInput[3]; + case 0x21C031: // Dipswitch B + return DrvInput[4]; + case 0x21C035: // Dipswitch C - Territory + return DrvInput[5]; + + case 0x30000D: + return ToaVBlankRegister(); + + default: { +// printf("Attempt to read byte value of location %x\n", sekAddress); + + if ((sekAddress & 0x00FFC000) == 0x00218000) { + return RamZ80[(sekAddress & 0x3FFF) >> 1]; + } + } + } + return 0; +} + +UINT16 __fastcall shippumdReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x21C020: // Player 1 inputs + return DrvInput[0]; + case 0x21C024: // Player 2 inputs + return DrvInput[1]; + case 0x21C028: // Other inputs + return DrvInput[2]; + case 0x21C02C: // Dipswitch A + return DrvInput[3]; + case 0x21C030: // Dipswitch B + return DrvInput[4]; + case 0x21C034: // Dipswitch C - Territory + return DrvInput[5]; + + case 0x21C03C: + return ToaScanlineRegister(); + + case 0x300004: + return ToaGP9001ReadRAM_Hi(0); + case 0x300006: + return ToaGP9001ReadRAM_Lo(0); + + case 0x30000C: + return ToaVBlankRegister(); + + default: { + if ((sekAddress & 0x00FFC000) == 0x00218000) { + return RamZ80[(sekAddress & 0x3FFF) >> 1]; + } + +// printf("Attempt to read word value of location %x\n", sekAddress); + } + } + return 0; +} + +void __fastcall shippumdWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + case 0x21C01D: { + INT32 nBankOffset; + if (byteValue & 0x10) { + nBankOffset = 0x40000; + } else { + nBankOffset = 0x00000; + } + MSM6295SampleInfo[0][0] = MSM6295ROM + nBankOffset; + MSM6295SampleData[0][0] = MSM6295ROM + nBankOffset; + MSM6295SampleInfo[0][1] = MSM6295ROM + nBankOffset + 0x0100; + MSM6295SampleData[0][1] = MSM6295ROM + nBankOffset + 0x10000; + MSM6295SampleInfo[0][2] = MSM6295ROM + nBankOffset + 0x0200; + MSM6295SampleData[0][2] = MSM6295ROM + nBankOffset + 0x20000; + MSM6295SampleInfo[0][3] = MSM6295ROM + nBankOffset + 0x0300; + MSM6295SampleData[0][3] = MSM6295ROM + nBankOffset + 0x30000; + break; + } + + default: { + if ((sekAddress & 0x00FFC000) == 0x00218000) { + RamZ80[(sekAddress & 0x3FFF) >> 1] = byteValue; + } + +// printf("Attempt to write byte value %x to location %x\n", byteValue, sekAddress); + } + } +} + +void __fastcall shippumdWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + + case 0x21C01C: { + INT32 nBankOffset; + if (wordValue & 0x10) { + nBankOffset = 0x40000; + } else { + nBankOffset = 0x00000; + } + MSM6295SampleInfo[0][0] = MSM6295ROM + nBankOffset; + MSM6295SampleData[0][0] = MSM6295ROM + nBankOffset; + MSM6295SampleInfo[0][1] = MSM6295ROM + nBankOffset + 0x0100; + MSM6295SampleData[0][1] = MSM6295ROM + nBankOffset + 0x10000; + MSM6295SampleInfo[0][2] = MSM6295ROM + nBankOffset + 0x0200; + MSM6295SampleData[0][2] = MSM6295ROM + nBankOffset + 0x20000; + MSM6295SampleInfo[0][3] = MSM6295ROM + nBankOffset + 0x0300; + MSM6295SampleData[0][3] = MSM6295ROM + nBankOffset + 0x30000; + break; + } + + case 0x300000: // Set GP9001 VRAM address-pointer + ToaGP9001SetRAMPointer(wordValue); + break; + + case 0x300004: + case 0x300006: + ToaGP9001WriteRAM(wordValue, 0); + break; + + case 0x300008: + ToaGP9001SelectRegister(wordValue); + break; + + case 0x30000C: + ToaGP9001WriteRegister(wordValue); + break; + + default: { +// printf("Attempt to write word value %x to location %x\n", wordValue, sekAddress); + + if ((sekAddress & 0x00FFC000) == 0x00218000) { + RamZ80[(sekAddress & 0x3FFF) >> 1] = wordValue; + } + } + } +} + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + + ZetOpen(0); + ZetReset(); + ZetClose(); + + MSM6295Reset(0); + BurnYM2151Reset(); + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + +#ifdef DRIVER_ROTATION + bToaRotateScreen = true; +#endif + + nGP9001ROMSize[0] = 0x400000; + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x0FFFFF, SM_ROM); // CPU 0 ROM + SekMapMemory(Ram01, 0x100000, 0x10FFFF, SM_RAM); + SekMapMemory(RamPal, 0x400000, 0x400FFF, SM_RAM); // Palette RAM + SekMapMemory(Ram02, 0x401000, 0x4017FF, SM_RAM); // Unused + SekMapMemory(ExtraTRAM, 0x500000, 0x502FFF, SM_RAM); + SekMapMemory(ExtraTSelect, 0x502000, 0x502FFF, SM_RAM); // 0x502000 - Scroll; 0x502200 - RAM + SekMapMemory(ExtraTScroll, 0x503000, 0x503FFF, SM_RAM); // 0x203000 - Offset; 0x503200 - RAM + + SekSetReadWordHandler(0, shippumdReadWord); + SekSetReadByteHandler(0, shippumdReadByte); + SekSetWriteWordHandler(0, shippumdWriteWord); + SekSetWriteByteHandler(0, shippumdWriteByte); + + SekClose(); + } + + nLayer0XOffset = -0x01D6; + nLayer1XOffset = -0x01D8; + nLayer2XOffset = -0x01DA; + ToaInitGP9001(); + + nExtraTXOffset = 0x2C; + ToaExtraTextInit(); + + DrvZ80Init(); // Initialize Z80 + + nToaPalLen = nColCount; + ToaPalSrc = RamPal; + ToaPalInit(); + + BurnYM2151Init(27000000 / 8); + BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH); + MSM6295Init(0, 32000000 / 32 / 132, 1); + MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + return 0; +} + +static INT32 DrvExit() +{ + MSM6295Exit(0); + BurnYM2151Exit(); + + ToaPalExit(); + + ToaExitGP9001(); + ToaExtraTextExit(); + ToaZExit(); // Z80 exit + SekExit(); // Deallocate 68000s + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderGP9001(); // Render GP9001 graphics + ToaExtraTextLayer(); // Render extra text layer + } + + ToaPalUpdate(); // Update the palette + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 4; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x00; // Buttons + DrvInput[1] = 0x00; // Player 1 + DrvInput[2] = 0x00; // Player 2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[2] |= (DrvButton[i] & 1) << i; + } + ToaClearOpposites(&DrvInput[0]); + ToaClearOpposites(&DrvInput[1]); + + SekNewFrame(); + + nCyclesTotal[0] = (INT32)((INT64)16000000 * nBurnCPUSpeedAdjust / (0x0100 * 60)); + nCyclesTotal[1] = TOA_Z80_SPEED / 60; + nCyclesDone[0] = nCyclesDone[1] = 0; + + SekOpen(0); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + INT32 nSoundBufferPos = 0; + + ZetOpen(0); + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU; + INT32 nNext; + + // Run 68000 + + nCurrentCPU = 0; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + + // Trigger VBlank interrupt + if (nNext > nToaCyclesVBlankStart) { + if (nCyclesDone[nCurrentCPU] < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } + + ToaBufferGP9001Sprites(); + + bVBlank = true; + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (bVBlank || (!CheckSleep(nCurrentCPU))) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += SekIdle(nCyclesSegment); + } + + // Run Z80 + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + + { + // Render sound segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + nSoundBufferPos += nSegmentLength; + } + } + } + + { + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + BurnYM2151Render(pSoundBuf, nSegmentLength); + MSM6295Render(0, pSoundBuf, nSegmentLength); + } + } + } + + SekClose(); + ZetClose(); + + if (pBurnDraw) { + DrvDraw(); // Draw screen if needed + } + + return 0; +} + +struct BurnDriver BurnDrvShippuMD = { + "shippumd", "kingdmgp", NULL, NULL, "1994", + "Shippu Mahou Daisakusen - kingdom grandprix\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + L"\u75BE\u98A8\u9B54\u6CD5\u5927\u4F5C\u6226 - kingdom grandprix (Japan)\0Shippu Mahou Daisakusen (Japan)\0", NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, shippumdRomInfo, shippumdRomName, NULL, NULL, shippumdInputInfo, shippumdDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; + +struct BurnDriver BurnDrvKingdmGP = { + "kingdmgp", NULL, NULL, NULL, "1994", + "Kingdom Grandprix (World)\0", NULL, "Raizing / 8ing", "Toaplan GP9001 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, kingdmgpRomInfo, kingdmgpRomName, NULL, NULL, shippumdInputInfo, kingdmgpDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x800, + 240, 320, 3, 4 +}; diff --git a/src/burn/drv/toaplan/d_tigerheli.cpp b/src/burn/drv/toaplan/d_tigerheli.cpp index 72f179469..a3d6bfb1e 100644 --- a/src/burn/drv/toaplan/d_tigerheli.cpp +++ b/src/burn/drv/toaplan/d_tigerheli.cpp @@ -1,2895 +1,2893 @@ -// Tiger Heli, Get Star / Guardian, & Slap Fight - -#include "burnint.h" -#include "z80_intf.h" -#include "taito_m68705.h" -#include "bitswap.h" -#include "driver.h" -extern "C" { - #include "ay8910.h" -} - -static INT32 nWhichGame; - -static bool bInterruptEnable; -static bool bSoundCPUEnable; -static bool bSoundNMIEnable; - -static INT32 nStatusIndex; -static INT32 nProtectIndex; - -static UINT8 getstar_e803_r(); -static void getstar_e803_w(); - -// --------------------------------------------------------------------------- -// Inputs - -static UINT8 tigerhInput[4] = {0,0,0,0}; -static UINT8 tigerhInpJoy1[8]; -static UINT8 tigerhInpMisc[8]; -static UINT8 tigerhReset = 0; - -// Dip Switch and Input Definitions -static struct BurnInputInfo tigerhInputList[] = { - {"P1 Coin", BIT_DIGITAL, tigerhInpMisc + 6, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, tigerhInpMisc + 4, "p1 start"}, - {"P1 Up", BIT_DIGITAL, tigerhInpJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, tigerhInpJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, tigerhInpJoy1 + 3, "p1 left"}, - {"P1 Right", BIT_DIGITAL, tigerhInpJoy1 + 2, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, tigerhInpMisc + 1, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, tigerhInpMisc + 0, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, tigerhInpMisc + 7, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, tigerhInpMisc + 5, "p2 start"}, - {"P2 Up", BIT_DIGITAL, tigerhInpJoy1 + 4, "p2 up"}, - {"P2 Down", BIT_DIGITAL, tigerhInpJoy1 + 5, "p2 down"}, - {"P2 Left", BIT_DIGITAL, tigerhInpJoy1 + 7, "p2 left"}, - {"P2 Right", BIT_DIGITAL, tigerhInpJoy1 + 6, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, tigerhInpMisc + 3, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, tigerhInpMisc + 2, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &tigerhReset, "reset"}, - - {"Dip A", BIT_DIPSWITCH, tigerhInput + 2, "dip"}, - {"Dip B", BIT_DIPSWITCH, tigerhInput + 3, "dip"}, -}; - -STDINPUTINFO(tigerh) - -static struct BurnInputInfo getstarInputList[] = { - {"P1 Coin", BIT_DIGITAL, tigerhInpMisc + 6, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, tigerhInpMisc + 4, "p1 start"}, - {"P1 Up", BIT_DIGITAL, tigerhInpJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, tigerhInpJoy1 + 2, "p1 down"}, - {"P1 Left", BIT_DIGITAL, tigerhInpJoy1 + 3, "p1 left"}, - {"P1 Right", BIT_DIGITAL, tigerhInpJoy1 + 1, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, tigerhInpMisc + 1, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, tigerhInpMisc + 0, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, tigerhInpMisc + 7, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, tigerhInpMisc + 5, "p2 start"}, - {"P2 Up", BIT_DIGITAL, tigerhInpJoy1 + 4, "p2 up"}, - {"P2 Down", BIT_DIGITAL, tigerhInpJoy1 + 6, "p2 down"}, - {"P2 Left", BIT_DIGITAL, tigerhInpJoy1 + 7, "p2 left"}, - {"P2 Right", BIT_DIGITAL, tigerhInpJoy1 + 5, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, tigerhInpMisc + 3, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, tigerhInpMisc + 2, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &tigerhReset, "reset"}, - - {"Dip A", BIT_DIPSWITCH, tigerhInput + 2, "dip"}, - {"Dip B", BIT_DIPSWITCH, tigerhInput + 3, "dip"}, -}; - -STDINPUTINFO(getstar) - -static struct BurnDIPInfo tigerhDIPList[] = { - // Defaults - {0x11, 0xFF, 0xFF, 0x10, NULL}, - {0x12, 0xFF, 0xFF, 0x00, NULL}, - - // DIP A - {0, 0xFE, 0, 2, "Hero speed"}, - {0x11, 0x01, 0x80, 0x00, "Normal"}, - {0x11, 0x01, 0x80, 0x80, "Fast"}, - {0, 0xFE, 0, 2, NULL}, - {0x11, 0x01, 0x40, 0x00, "Normal game"}, - {0x11, 0x01, 0x40, 0x40, "DIP switch test"}, - {0, 0xFE, 0, 2, NULL}, - {0x11, 0x01, 0x20, 0x00, "Normal screen"}, - {0x11, 0x01, 0x20, 0x20, "Invert screen"}, - {0, 0xFE, 0, 2, "Cabinet"}, - {0x11, 0x01, 0x10, 0x10, "Upright"}, - {0x11, 0x01, 0x10, 0x00, "Table"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x11, 0x01, 0x08, 0x00, "On"}, - {0x11, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 7, "Coinage"}, - {0x11, 0x01, 0x07, 0x00, "1 coin 1 credit"}, - {0x11, 0x01, 0x07, 0x01, "1 coin 2 credits"}, - {0x11, 0x01, 0x07, 0x02, "1 coin 3 credits"}, - {0x11, 0x01, 0x07, 0x03, "2 coins 1 credit"}, - {0x11, 0x01, 0x07, 0x04, "2 coins 3 credits"}, - {0x11, 0x01, 0x07, 0x05, "3 coins 1 credit"}, - {0x11, 0x01, 0x07, 0x07, "Free play"}, - {0x11, 0x01, 0x07, 0x06, "3 coins 1 credit"}, - - // DIP B - {0, 0xFE, 0, 2, "Extend"}, - {0x12, 0x01, 0x10, 0x00, "20000 & 80000"}, - {0x12, 0x01, 0x10, 0x10, "50000 & 120000"}, - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x12, 0x01, 0x0C, 0x00, "0"}, - {0x12, 0x01, 0x0C, 0x04, "1"}, - {0x12, 0x01, 0x0C, 0x08, "2"}, - {0x12, 0x01, 0x0C, 0x0C, "3"}, - {0, 0xFE, 0, 4, "Number of heroes"}, - {0x12, 0x01, 0x03, 0x00, "3"}, - {0x12, 0x01, 0x03, 0x01, "5"}, - {0x12, 0x01, 0x03, 0x02, "1"}, - {0x12, 0x01, 0x03, 0x03, "2"}, -}; - -STDDIPINFO(tigerh) - -static struct BurnDIPInfo getstarDIPList[] = { - // Defaults - {0x11, 0xFF, 0xFF, 0x10, NULL}, - - // DIP A - {0, 0xFE, 0, 2, NULL}, - {0x11, 0x01, 0x40, 0x00, "Normal game"}, - {0x11, 0x01, 0x40, 0x40, "DIP switch test"}, - {0, 0xFE, 0, 2, NULL}, - {0x11, 0x01, 0x20, 0x00, "Normal screen"}, - {0x11, 0x01, 0x20, 0x20, "Invert screen"}, - {0, 0xFE, 0, 2, "Cabinet"}, - {0x11, 0x01, 0x10, 0x10, "Upright"}, - {0x11, 0x01, 0x10, 0x00, "Table"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x11, 0x01, 0x08, 0x00, "On"}, - {0x11, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 7, "Coinage"}, - {0x11, 0x01, 0x07, 0x00, "1 coin 1 credit"}, - {0x11, 0x01, 0x07, 0x01, "1 coin 2 credits"}, - {0x11, 0x01, 0x07, 0x02, "1 coin 3 credits"}, - {0x11, 0x01, 0x07, 0x03, "2 coins 1 credit"}, - {0x11, 0x01, 0x07, 0x04, "2 coins 3 credits"}, - {0x11, 0x01, 0x07, 0x05, "3 coins 1 credit"}, - {0x11, 0x01, 0x07, 0x07, "Free play"}, - {0x11, 0x01, 0x07, 0x06, "3 coins 1 credit"}, - - // DIP B - {0, 0xFE, 0, 2, "Extend"}, - {0x12, 0x01, 0x10, 0x00, "30000 & 100000"}, - {0x12, 0x01, 0x10, 0x10, "50000 & 150000"}, - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x12, 0x01, 0x0C, 0x00, "0"}, - {0x12, 0x01, 0x0C, 0x04, "1"}, - {0x12, 0x01, 0x0C, 0x08, "2"}, - {0x12, 0x01, 0x0C, 0x0C, "3"}, -}; - -static struct BurnDIPInfo getstarHeroesDIPList[] = -{ - // Defaults - {0x12, 0xFF, 0xFF, 0x00, NULL}, - - // DIP B - {0, 0xFE, 0, 4, "Number of heroes"}, - {0x12, 0x01, 0x03, 0x02, "1"}, - {0x12, 0x01, 0x03, 0x03, "2"}, - {0x12, 0x01, 0x03, 0x00, "3"}, - {0x12, 0x01, 0x03, 0x01, "5"}, -}; - -static struct BurnDIPInfo getstarb2HeroesDIPList[] = -{ - // Defaults - {0x12, 0xFF, 0xFF, 0x01, NULL}, - - // DIP B - {0, 0xFE, 0, 4, "Number of heroes"}, - {0x12, 0x01, 0x03, 0x01, "3"}, - {0x12, 0x01, 0x03, 0x02, "4"}, - {0x12, 0x01, 0x03, 0x03, "5"}, - {0x12, 0x01, 0x03, 0x00, "240 (cheat)"}, -}; - -STDDIPINFOEXT(getstar, getstar, getstarHeroes) -STDDIPINFOEXT(getstarb2, getstar, getstarb2Heroes) - -static struct BurnDIPInfo slapfighDIPList[] = { - // Defaults - {0x11, 0xFF, 0xFF, 0x80, NULL}, - {0x12, 0xFF, 0xFF, 0x00, NULL}, - - // DIP A - {0, 0xFE, 0, 2, NULL}, - {0x11, 0x01, 0x80, 0x80, "Up-right type"}, - {0x11, 0x01, 0x80, 0x00, "Table type"}, - {0, 0xFE, 0, 2, NULL}, - {0x11, 0x01, 0x40, 0x00, "Normal screen"}, - {0x11, 0x01, 0x40, 0x40, "Invert screen"}, - {0, 0xFE, 0, 2, NULL}, - {0x11, 0x01, 0x20, 0x00, "Normal game"}, - {0x11, 0x01, 0x20, 0x20, "Screen test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x11, 0x01, 0x10, 0x00, "On"}, - {0x11, 0x01, 0x10, 0x10, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, - {0x11, 0x01, 0x0C, 0x00, "1 coin 1 play"}, - {0x11, 0x01, 0x0C, 0x08, "1 coin 2 plays"}, - {0x11, 0x01, 0x0C, 0x04, "2 coins 1 play"}, - {0x11, 0x01, 0x0C, 0x0C, "2 coins 3 plays"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x11, 0x01, 0x03, 0x00, "1 coin 1 play"}, - {0x11, 0x01, 0x03, 0x02, "1 coin 2 plays"}, - {0x11, 0x01, 0x03, 0x01, "2 coins 1 play"}, - {0x11, 0x01, 0x03, 0x03, "2 coins 3 plays"}, - - // DIP B - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x12, 0x01, 0xC0, 0x00, "B"}, - {0x12, 0x01, 0xC0, 0x80, "A"}, - {0x12, 0x01, 0xC0, 0x40, "C"}, - {0x12, 0x01, 0xC0, 0xC0, "D"}, - {0, 0xFE, 0, 4, "Extend"}, - {0x12, 0x01, 0x30, 0x00, "30000, 100000"}, - {0x12, 0x01, 0x30, 0x20, "50000, 200000"}, - {0x12, 0x01, 0x30, 0x10, "50000 only"}, - {0x12, 0x01, 0x30, 0x30, "100000 only"}, - {0, 0xFE, 0, 4, "Fighter counts"}, - {0x12, 0x01, 0x0C, 0x00, "3"}, - {0x12, 0x01, 0x0C, 0x08, "5"}, - {0x12, 0x01, 0x0C, 0x04, "1"}, - {0x12, 0x01, 0x0C, 0x0C, "2"}, - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x02, 0x00, "Normal game"}, - {0x12, 0x01, 0x02, 0x02, "DIP-switch display"}, -}; - -STDDIPINFO(slapfigh) - -// --------------------------------------------------------------------------- - -static UINT8 *Mem, *MemEnd, *RamStart, *RamEnd; - -static UINT8 *Rom01, *Rom02, *Rom03; -static UINT8 *TigerHeliTileROM, *TigerHeliSpriteROM, *TigerHeliTextROM; - -static UINT8 *Ram01, *RamShared, *Ram03; -static UINT8 *TigerHeliTileRAM, *TigerHeliSpriteRAM, *TigerHeliSpriteBuf, *TigerHeliTextRAM; - -static UINT8* TigerHeliPaletteROM; -static UINT32* TigerHeliPalette; - -static INT16* pFMBuffer; -static INT16* pAY8910Buffer[6]; - -static INT32 use_mcu = 0; - -static INT32 MemIndex() -{ - UINT8* Next; Next = Mem; - Rom01 = Next; Next += 0x012000; // Z80 main program - Rom02 = Next; Next += 0x002000; // Z80 sound program - Rom03 = Next; Next += 0x000800; // m68705 mcu program - TigerHeliTextROM = Next; Next += 0x010000; - TigerHeliSpriteROM = Next; Next += 0x040000; - TigerHeliTileROM = Next; Next += 0x040000; - RamStart = Next; - Ram01 = Next; Next += 0x000800; // Z80 main work RAM - RamShared = Next; Next += 0x000800; // Shared RAM - TigerHeliTextRAM = Next; Next += 0x001000; - TigerHeliSpriteRAM = Next; Next += 0x000800; - TigerHeliSpriteBuf = Next; Next += 0x000800; - TigerHeliTileRAM = Next; Next += 0x001000; - Ram03 = Next; Next += 0x000080; - RamEnd = Next; - pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); - TigerHeliPaletteROM = Next; Next += 0x000300; - TigerHeliPalette = (UINT32*)Next; Next += 0x000100 * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -// --------------------------------------------------------------------------- -// Graphics - -static INT32 nTigerHeliTileXPosLo, nTigerHeliTileXPosHi, nTigerHeliTileYPosLo; -static INT32 nTigerHeliTileMask; - -static UINT8* pTileData; - -static INT32 nTileNumber; -static INT32 nTilePalette; - -static UINT16* pTileRow; -static UINT16* pTile; - -static INT32 nTileXPos, nTileYPos; - -// --------------------------------------------------------------------------- -// Palette - -static UINT8 tigerhRecalcPalette = 0; - -static void TigerHeliPaletteInit() -{ - for (INT32 i = 0; i < 0x0100; i++) { - INT32 r, g, b; - - r = TigerHeliPaletteROM[i + 0x0000]; // Red - r |= r << 4; - g = TigerHeliPaletteROM[i + 0x0100]; // Green - g |= g << 4; - b = TigerHeliPaletteROM[i + 0x0200]; // Blue - b |= b << 4; - - TigerHeliPalette[i] = BurnHighCol(r, g, b, 0); - } - - return; -} - -static void TigerHeliPaletteUpdate() -{ - if (tigerhRecalcPalette) { - tigerhRecalcPalette = 0; - - TigerHeliPaletteInit(); - } -} - -// --------------------------------------------------------------------------- -// Text layer - -static UINT8* TigerHeliTextAttrib = NULL; - -static void TigerHeliTextExit() -{ - BurnFree(TigerHeliTextAttrib); -} - -static INT32 TigerHeliTextInit() -{ - if ((TigerHeliTextAttrib = (UINT8*)BurnMalloc(0x0400)) == NULL) { - return 1; - } - - for (INT32 i = 0; i < 0x0400; i++) { - bool bEmpty = true; - - for (INT32 j = 0; j < 64; j++) { - if (TigerHeliTextROM[(i << 6) + j]) { - bEmpty = false; - break; - } - } - - if (bEmpty) { - TigerHeliTextAttrib[i] = 0; - } else { - TigerHeliTextAttrib[i] = 1; - } - } - - return 0; -} - -#define PLOTPIXEL(x) if (pTileData[x]) { pPixel[x] = nPalette + pTileData[x]; } - -static void TigerHeliRenderTextTile() -{ - UINT16 nPalette = nTilePalette << 2; - pTileData = TigerHeliTextROM + (nTileNumber << 6); - - UINT16* pPixel = pTile; - - for (INT32 y = 0; y < 8; y++, pPixel += 280, pTileData += 8) { - - if ((nTileYPos + y) >= 240) { - break; - } - if ((nTileYPos + y) < 0) { - continue; - } - - PLOTPIXEL(0); - PLOTPIXEL(1); - PLOTPIXEL(2); - PLOTPIXEL(3); - PLOTPIXEL(4); - PLOTPIXEL(5); - PLOTPIXEL(6); - PLOTPIXEL(7); - } -} - -#undef PLOTPIXEL - -static void TigerHeliTextRender() -{ - UINT8* pTextRAM; - - if ((nBurnLayer & 2) == 0) { - return; - } - - switch (nWhichGame) { - case 0: // Tiger Heli - nTileYPos = -15; - break; - case 1: // Get Star - nTileYPos = -15; - break; - case 2: // Slap Fight - nTileYPos = -16; - break; - } - pTileRow = pTransDraw + nTileYPos * 280; - - for (INT32 y = 0; y < 32; y++, nTileYPos += 8, pTileRow += (280 << 3)) { - if (nTileYPos <= -8 || nTileYPos >= 240 ) { - continue; - } - pTextRAM = TigerHeliTextRAM + (y << 6); - pTile = pTileRow; - for (INT32 x = 1; x < 36; x++, pTile += 8) { - nTileNumber = pTextRAM[x] | (pTextRAM[0x0800 + x] << 8); - nTilePalette = nTileNumber >> 10; - nTileNumber &= 0x03FF; - - if (TigerHeliTextAttrib[nTileNumber]) { - TigerHeliRenderTextTile(); - } - } - } - - return; -} - -// --------------------------------------------------------------------------- -// Tile layer - -#define PLOTPIXEL(x) pPixel[x] = nPalette + pTileData[x]; -#define CLIPPIXEL(a,b) if ((nTileXPos + a) >= 0 && (nTileXPos + a) < 280) { b; } - -static void TigerHeliRenderTileNoClip() -{ - UINT8 nPalette = nTilePalette << 4; - pTileData = TigerHeliTileROM + (nTileNumber << 6); - - UINT16* pPixel = pTile; - - for (INT32 y = 0; y < 8; y++, pPixel += 280, pTileData += 8) { - PLOTPIXEL(0); - PLOTPIXEL(1); - PLOTPIXEL(2); - PLOTPIXEL(3); - PLOTPIXEL(4); - PLOTPIXEL(5); - PLOTPIXEL(6); - PLOTPIXEL(7); - } -} - -static void TigerHeliRenderTileClip() -{ - UINT8 nPalette = nTilePalette << 4; - pTileData = TigerHeliTileROM + (nTileNumber << 6); - - UINT16* pPixel = pTile; - - for (INT32 y = 0; y < 8; y++, pPixel += 280, pTileData += 8) { - - if ((nTileYPos + y) >= 240) { - break; - } - if ((nTileYPos + y) < 0) { - continue; - } - - CLIPPIXEL(0, PLOTPIXEL(0)); - CLIPPIXEL(1, PLOTPIXEL(1)); - CLIPPIXEL(2, PLOTPIXEL(2)); - CLIPPIXEL(3, PLOTPIXEL(3)); - CLIPPIXEL(4, PLOTPIXEL(4)); - CLIPPIXEL(5, PLOTPIXEL(5)); - CLIPPIXEL(6, PLOTPIXEL(6)); - CLIPPIXEL(7, PLOTPIXEL(7)); - } -} - -#undef CLIPPIXEL -#undef PLOTPIXEL - -static void TigerHeliTileRender() -{ - UINT8* pTileRAM; - - if ((nBurnLayer & 3) == 0) { - BurnTransferClear(); - return; - } - - INT32 nTigerHeliTileXPos = nTigerHeliTileXPosLo + (nTigerHeliTileXPosHi << 8); - INT32 nTigerHeliTileYPos = nTigerHeliTileYPosLo; - - switch (nWhichGame) { - case 0: // Tiger Heli - nTigerHeliTileYPos -= 1; - break; - case 1: // Get Star - nTigerHeliTileYPos -= 1; - break; - case 2: // Slap Fight - nTigerHeliTileYPos += 1; - break; - } - - INT32 nXPos = -nTigerHeliTileXPos & 7; - nTileYPos = -nTigerHeliTileYPos & 7; - - if (nTigerHeliTileXPos & 7) { - nXPos -= 8; - } - if (nTigerHeliTileYPos & 7) { - nTileYPos -= 8; - } - - pTileRow = pTransDraw; - pTileRow -= (nTigerHeliTileXPos & 7); - pTileRow -= (nTigerHeliTileYPos & 7) * 280; - - for (INT32 y = 2; y < 33; y++, nTileYPos += 8, pTileRow += (280 << 3)) { - pTileRAM = TigerHeliTileRAM + (((y + (nTigerHeliTileYPos >> 3)) << 6) & 0x07C0); - pTile = pTileRow; - nTileXPos = nXPos; - for (INT32 x = 1; x < 37; x++, nTileXPos += 8, pTile += 8) { - INT32 x2 = (x + ((nTigerHeliTileXPos >> 3) & 0x3F)); - nTileNumber = pTileRAM[x2] | (pTileRAM[0x0800 + x2] << 8); - nTilePalette = nTileNumber >> 12; - nTileNumber &= nTigerHeliTileMask; - - if (nTileXPos < 0 || nTileXPos > 272 || nTileYPos < 0 || nTileYPos > 232) { - TigerHeliRenderTileClip(); - } else { - TigerHeliRenderTileNoClip(); - } - } - } - - return; -} - -// --------------------------------------------------------------------------- -// Sprites - -static INT32 nSpriteXPos, nSpriteYPos, nSpriteNumber, nSpritePalette; - -static INT32 nTigerHeliSpriteMask; - -#define PLOTPIXEL(a) if (pSpriteData[a]) { pPixel[a] = nPalette + pSpriteData[a]; } -#define CLIPPIXEL(a,b) if ((nSpriteXPos + a) >= 0 && (nSpriteXPos + a) < 280) { b; } - -static void TigerHeliRenderSpriteNoClip() -{ - UINT8 nPalette = nSpritePalette << 4; - UINT8* pSpriteData = TigerHeliSpriteROM + (nSpriteNumber << 8); - - UINT16* pPixel = pTransDraw + nSpriteXPos + nSpriteYPos * 280; - - for (INT32 y = 0; y < 16; y++, pPixel += 280, pSpriteData += 16) { - PLOTPIXEL( 0); - PLOTPIXEL( 1); - PLOTPIXEL( 2); - PLOTPIXEL( 3); - PLOTPIXEL( 4); - PLOTPIXEL( 5); - PLOTPIXEL( 6); - PLOTPIXEL( 7); - PLOTPIXEL( 8); - PLOTPIXEL( 9); - PLOTPIXEL(10); - PLOTPIXEL(11); - PLOTPIXEL(12); - PLOTPIXEL(13); - PLOTPIXEL(14); - PLOTPIXEL(15); - } -} - -static void TigerHeliRenderSpriteClip() -{ - UINT8 nPalette = nSpritePalette << 4; - UINT8* pSpriteData = TigerHeliSpriteROM + (nSpriteNumber << 8); - - UINT16* pPixel = pTransDraw + nSpriteXPos + nSpriteYPos * 280; - - for (INT32 y = 0; y < 16; y++, pPixel += 280, pSpriteData += 16) { - - if ((nSpriteYPos + y) < 0 || (nSpriteYPos + y) >= 240) { - continue; - } - - CLIPPIXEL( 0, PLOTPIXEL( 0)); - CLIPPIXEL( 1, PLOTPIXEL( 1)); - CLIPPIXEL( 2, PLOTPIXEL( 2)); - CLIPPIXEL( 3, PLOTPIXEL( 3)); - CLIPPIXEL( 4, PLOTPIXEL( 4)); - CLIPPIXEL( 5, PLOTPIXEL( 5)); - CLIPPIXEL( 6, PLOTPIXEL( 6)); - CLIPPIXEL( 7, PLOTPIXEL( 7)); - CLIPPIXEL( 8, PLOTPIXEL( 8)); - CLIPPIXEL( 9, PLOTPIXEL( 9)); - CLIPPIXEL(10, PLOTPIXEL(10)); - CLIPPIXEL(11, PLOTPIXEL(11)); - CLIPPIXEL(12, PLOTPIXEL(12)); - CLIPPIXEL(13, PLOTPIXEL(13)); - CLIPPIXEL(14, PLOTPIXEL(14)); - CLIPPIXEL(15, PLOTPIXEL(15)); - } -} - -#undef CLIPPIXEL -#undef PLOTPIXEL - -static void TigerHeliSpriteRender() -{ - UINT8* pSpriteRAM = TigerHeliSpriteBuf; - INT32 nSpriteYOffset = 0; - - if ((nBurnLayer & 1) == 0) { - return; - } - - switch (nWhichGame) { - case 0: // Tiger Heli - nSpriteYOffset = -16; - break; - case 1: // Get Star - nSpriteYOffset = -16; - break; - case 2: // Slap Fight - nSpriteYOffset = -17; - break; - } - - for (INT32 i = 0; i < 0x0800; i += 4) { - nSpriteNumber = pSpriteRAM[i + 0x00] | ((pSpriteRAM[i + 0x02] & 0xC0) << 2); - nSpriteNumber &= nTigerHeliSpriteMask; - nSpritePalette = (pSpriteRAM[i + 0x02] >> 1) & 0x0F; - nSpriteXPos = (pSpriteRAM[i + 0x01] | ((pSpriteRAM[i + 0x02] & 0x01) << 8)) - 21; - nSpriteYPos = pSpriteRAM[i + 0x03] + nSpriteYOffset; - - if (nSpriteXPos > -16 && nSpriteXPos < 280 && nSpriteYPos > -16 && nSpriteYPos < 240) { - if (nSpriteXPos >= 0 && nSpriteXPos <= 264 && nSpriteYPos >= 0 && nSpriteYPos <= 224) { - TigerHeliRenderSpriteNoClip(); - } else { - TigerHeliRenderSpriteClip(); - } - } - } - - return; -} - -static void TigerHeliBufferSprites() -{ - memcpy(TigerHeliSpriteBuf, TigerHeliSpriteRAM, 0x0800); -} - -// --------------------------------------------------------------------------- - - -static inline void sync_mcu() -{ - INT32 cycles = (ZetTotalCycles() / 2) - m6805TotalCycles(); - if (cycles > 0) { - // bprintf (0, _T("mcu %d\n"), cycles); - m6805Run(cycles); - } -} - -UINT8 __fastcall tigerhReadCPU0(UINT16 a) -{ - if (a >= 0xc800 && a <= 0xcfff) { - if (ZetPc(-1) == 0x6d34) return 0xff; - return RamShared[a - 0xc800]; - } - - switch (a) { - case 0xE803: { - if (use_mcu) { - sync_mcu(); - return standard_taito_mcu_read(); - } - - if (nWhichGame == 1) return getstar_e803_r(); - - UINT8 nProtectSequence[3] = { 0, 1, (0 + 5) ^ 0x56 }; - - //if (nProtectIndex == 3) { - // nProtectIndex = 0; - //} - -// bprintf(PRINT_NORMAL, "Protection read (%02X) PC: %04X.\n", nProtectSequence[nProtectIndex], ZetPc(-1)); - //return nProtectSequence[nProtectIndex++]; - - UINT8 val = nProtectSequence[nProtectIndex]; - nProtectIndex = (nProtectIndex + 1) % 3; - return val; - } - -// default: -// bprintf(PRINT_NORMAL, _T("Attempt by CPU0 to read address %04X.\n"), a); - } - - return 0; -} - -UINT8 __fastcall tigerhReadCPU0_tigerhb1(UINT16 a) -{ - if (a >= 0xc800 && a <= 0xcfff) { - if (ZetPc(-1) == 0x6d34) return 0xff; - return RamShared[a - 0xc800]; - } - - switch (a) { - case 0xE803: { - return 0x83; - } - } - - return 0; -} - - -void __fastcall tigerhWriteCPU0(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xE800: - nTigerHeliTileXPosLo = d; - break; - case 0xE801: - nTigerHeliTileXPosHi = d; - break; - case 0xE802: - nTigerHeliTileYPosLo = d; - break; - - case 0xe803: - if (use_mcu) { - sync_mcu(); - from_main = d; - main_sent = 1; - if (nWhichGame == 0) mcu_sent = 0; - m68705SetIrqLine(0, 1 /*ASSERT_LINE*/); - } - if (nWhichGame == 1) getstar_e803_w(); - break; - -// default: -// bprintf(PRINT_NORMAL, "Attempt by CPU0 to write address %04X -> %02X.\n", a, d); - } -} - -void __fastcall tigerhWriteCPU0_slapbtuk(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xE800: - nTigerHeliTileXPosHi = d; - break; - case 0xE802: - nTigerHeliTileYPosLo = d; - break; - case 0xE803: - nTigerHeliTileXPosLo = d; - break; -// default: -// bprintf(PRINT_NORMAL, "Attempt by CPU0 to write address %04X -> %02X.\n", a, d); - } -} - -UINT8 __fastcall tigerhInCPU0(UINT16 a) -{ - a &= 0xFF; - - switch (a) { - case 0x00: { - - UINT8 nStatusSequence[3] = { 0xC7, 0x55, 0x00 }; - - //if (nStatusIndex == 3) { - // nStatusIndex = 0; - //} - -// bprintf(PRINT_NORMAL, "Status read (%02X) PC: %04X.\n", nStatusSequence[nStatusIndex], ZetPc(-1)); - //return nStatusSequence[nStatusIndex++]; - - UINT8 nStatus = nStatusSequence[nStatusIndex]; - nStatusIndex++; - if (nStatusIndex > 2) nStatusIndex = 0; - - if (use_mcu) { - sync_mcu(); - nStatus &= 0xf9; - if (!main_sent) nStatus |= 0x02; - if (!mcu_sent) nStatus |= 0x04; - } - - return nStatus; - - } - -// default: -// bprintf(PRINT_NORMAL, "Attempt by CPU0 to read port %02X.\n", a); - } - - return 0; -} - -UINT8 __fastcall tigerhInCPU0_gtstarba(UINT16 a) -{ - a &= 0xFF; - - switch (a) { - case 0x00: { - if (ZetPc(-1) == 0x6d1e) return 0; - if (ZetPc(-1) == 0x6d24) return 6; - if (ZetPc(-1) == 0x6d2c) return 2; - if (ZetPc(-1) == 0x6d34) return 4; - return 0; - } - -// default: -// bprintf(PRINT_NORMAL, "Attempt by CPU0 to read port %02X.\n", a); - } - - return 0; -} - -void __fastcall tigerhOutCPU0(UINT16 a, UINT8 /* d */) -{ - a &= 0xFF; - - switch (a) { - case 0x00: // Assert reset line on sound CPU -// bprintf(PRINT_NORMAL, "Sound CPU disabled.\n"); - - if (bSoundCPUEnable) { - ZetClose(); - ZetOpen(1); - ZetReset(); - ZetClose(); - ZetOpen(0); - - bSoundCPUEnable = false; - } - - break; - case 0x01: // Release reset line on sound CPU -// bprintf(PRINT_NORMAL, "Sound CPU enabled.\n"); - - bSoundCPUEnable = true; - break; - -// case 0x03: -// break; - -// case 0x05: -// bprintf(PRINT_NORMAL, "Sound NMI triggered.\n"); -/* - if (bSoundNMIEnable) { - ZetClose(); - ZetOpen(1); - ZetNmi(); - ZetClose(); - ZetOpen(0); - } -*/ -// break; - - case 0x06: // Disable interrupts -// bprintf(PRINT_NORMAL, "Interrupts disabled.\n"); - - bInterruptEnable = false; - ZetLowerIrq(); - break; - case 0x07: // Enable interrupts -// bprintf(PRINT_NORMAL, "Interrupts enabled.\n"); - - bInterruptEnable = true; - break; - - case 0x08: -// bprintf(PRINT_NORMAL, "ROM bank 0 selected.\n"); - - // ROM bank 0 selected - ZetMapArea(0x8000, 0xBFFF, 0, Rom01 + 0x8000); - ZetMapArea(0x8000, 0xBFFF, 2, Rom01 + 0x8000); - break; - case 0x09: -// bprintf(PRINT_NORMAL, "ROM bank 1 selected.\n"); - - // ROM bank 1 selected - ZetMapArea(0x8000, 0xBFFF, 0, Rom01 + 0xC000); - ZetMapArea(0x8000, 0xBFFF, 2, Rom01 + 0xC000); - break; - -// default: -// bprintf(PRINT_NORMAL, "Attempt by CPU0 to write port %02X -> %02X.\n", a, d); - } -} - -UINT8 __fastcall tigerhReadCPU1(UINT16 a) -{ - switch (a) { - case 0xA081: -// bprintf(PRINT_NORMAL, "AY8910 0 read (%02X).\n", AY8910Read(0)); - return AY8910Read(0); - case 0xA091: -// bprintf(PRINT_NORMAL, "AY8910 1 read (%02X).\n", AY8910Read(1)); - return AY8910Read(1); - -// default: -// bprintf(PRINT_NORMAL, "Attempt by CPU1 to read address %04X.\n", a); - } - - return 0; -} - -void __fastcall tigerhWriteCPU1(UINT16 a, UINT8 d) -{ - switch (a) { - case 0xA080: -// bprintf(PRINT_NORMAL, "AY8910 0 Register select (%02X).\n", d); - AY8910Write(0, 0, d); - break; - case 0xA082: -// bprintf(PRINT_NORMAL, "AY8910 0 Register Write (%02X).\n", d); - AY8910Write(0, 1, d); - break; - case 0xA090: -// bprintf(PRINT_NORMAL, "AY8910 1 Register select (%02X).\n", d); - AY8910Write(1, 0, d); - break; - case 0xA092: -// bprintf(PRINT_NORMAL, "AY8910 1 Register Write (%02X).\n", d); - AY8910Write(1, 1, d); - break; - - case 0xA0E0: -// bprintf(PRINT_NORMAL, "Sound NMI enabled.\n"); - bSoundNMIEnable = true; - break; - -// default: -// bprintf(PRINT_NORMAL, "Attempt by CPU1 to write address %04X -> %02X.\n", a, d); - } -} - -UINT8 __fastcall tigerhInCPU1(UINT16 /* a */) -{ -// bprintf(PRINT_NORMAL, "Attempt by CPU1 to read port %02X.\n", a); - - return 0; -} - -void __fastcall tigerhOutCPU1(UINT16 /* a */, UINT8 /* d */) -{ -// bprintf(PRINT_NORMAL, _T("Attempt by CPU1 to write port %02X -> %02X.\n"), a, d); -} - -static UINT8 tigerhReadPort0(UINT32) -{ - return ~tigerhInput[0]; -} -static UINT8 tigerhReadPort1(UINT32) -{ - return ~tigerhInput[1]; -} -static UINT8 tigerhReadPort2(UINT32) -{ - return ~tigerhInput[2]; -} -static UINT8 tigerhReadPort3(UINT32) -{ - return ~tigerhInput[3]; -} - -//---------------------------------------------------------------------------- -// MCU Handling - -void tigerh_m68705_portA_write(UINT8 *data) -{ - from_mcu = *data; - mcu_sent = 1; -} - -void tigerh_m68705_portC_read() -{ - portC_in = 0; - if (!main_sent) portC_in |= 0x01; - if ( mcu_sent) portC_in |= 0x02; -} - -static m68705_interface tigerh_m68705_interface = { - tigerh_m68705_portA_write, standard_m68705_portB_out, NULL, - NULL, NULL, NULL, - NULL, NULL, tigerh_m68705_portC_read -}; - -void slapfigh_m68705_portA_write(UINT8 *data) -{ - from_mcu = *data; -} - -void slapfigh_m68705_portB_out(UINT8 *data) -{ - if ((ddrB & 0x02) && (~*data & 0x02) && (portB_out & 0x02)) - { - portA_in = from_main; - if (main_sent) - m68705SetIrqLine(0, 0 /*CLEAR_LINE*/); - main_sent = 0; - } - if ((ddrB & 0x04) && (*data & 0x04) && (~portB_out & 0x04)) - { - from_mcu = portA_out; - mcu_sent = 1; - } - - if ((ddrB & 0x08) && (~*data & 0x08) && (portB_out & 0x08)) - { - nTigerHeliTileXPosLo = portA_out; - } - if ((ddrB & 0x10) && (~*data & 0x10) && (portB_out & 0x10)) - { - nTigerHeliTileXPosHi = portA_out; - } -} - -void slapfigh_m68705_portC_read() -{ - portC_in = 0; - if (main_sent) portC_in |= 0x01; - if (!mcu_sent) portC_in |= 0x02; -} - -static m68705_interface slapfigh_m68705_interface = { - slapfigh_m68705_portA_write, slapfigh_m68705_portB_out, NULL, - NULL, NULL, NULL, - NULL, NULL, slapfigh_m68705_portC_read -}; - -//---------------------------------------------------------------------------- -// Get Star MCU Simulation - -#define GETSTAR 1 -#define GETSTARJ 2 -#define GETSTARB1 3 -#define GETSTARB2 4 - -static UINT8 GetStarType = 0; - -static UINT8 GSa = 0; -static UINT8 GSd = 0; -static UINT8 GSe = 0; -static UINT8 GSCommand = 0; - -#define GS_SAVE_REGS GSa = ZetBc(-1) >> 0; \ - GSd = ZetDe(-1) >> 8; \ - GSe = ZetDe(-1) >> 0; - -#define GS_RESET_REGS GSa = 0; \ - GSd = 0; \ - GSe = 0; - -static UINT8 getstar_e803_r() -{ - UINT16 tmp = 0; /* needed for values computed on 16 bits */ - UINT8 getstar_val = 0; - UINT8 phase_lookup_table[] = {0x00, 0x01, 0x03, 0xff, 0xff, 0x02, 0x05, 0xff, 0xff, 0x05}; /* table at 0x0e05 in 'gtstarb1' */ - UINT8 lives_lookup_table[] = {0x03, 0x05, 0x01, 0x02}; /* table at 0x0e62 in 'gtstarb1' */ - UINT8 lgsb2_lookup_table[] = {0x00, 0x03, 0x04, 0x05}; /* fake tanle for "test mode" in 'gtstarb2' */ - - switch (GetStarType) { - case GETSTAR: - case GETSTARJ: { - switch (GSCommand) { - case 0x20: /* continue play */ - getstar_val = ((GSa & 0x30) == 0x30) ? 0x20 : 0x80; - break; - case 0x21: /* lose life */ - getstar_val = (GSa << 1) | (GSa >> 7); - break; - case 0x22: /* starting difficulty */ - getstar_val = ((GSa & 0x0c) >> 2) + 1; - break; - case 0x23: /* starting lives */ - getstar_val = lives_lookup_table[GSa]; - break; - case 0x24: /* game phase */ - getstar_val = phase_lookup_table[((GSa & 0x18) >> 1) | (GSa & 0x03)]; - break; - case 0x25: /* players inputs */ - getstar_val = BITSWAP08(GSa, 3, 2, 1, 0, 7, 5, 6, 4); - break; - case 0x26: /* background (1st read) */ - tmp = 0x8800 + (0x001f * GSa); - getstar_val = (tmp & 0x00ff) >> 0; - GSCommand |= 0x80; /* to allow a second consecutive read */ - break; - case 0xa6: /* background (2nd read) */ - tmp = 0x8800 + (0x001f * GSa); - getstar_val = (tmp & 0xff00) >> 8; - break; - case 0x29: /* unknown effect */ - getstar_val = 0x00; - break; - case 0x2a: /* change player (if 2 players game) */ - getstar_val = (GSa ^ 0x40); - break; - case 0x37: /* foreground (1st read) */ - tmp = ((0xd0 + ((GSe >> 2) & 0x0f)) << 8) | (0x40 * (GSe & 03) + GSd); - getstar_val = (tmp & 0x00ff) >> 0; - GSCommand |= 0x80; /* to allow a second consecutive read */ - break; - case 0xb7: /* foreground (2nd read) */ - tmp = ((0xd0 + ((GSe >> 2) & 0x0f)) << 8) | (0x40 * (GSe & 03) + GSd); - getstar_val = (tmp & 0xff00) >> 8; - break; - case 0x38: /* laser position (1st read) */ - tmp = 0xf740 - (((GSe >> 4) << 8) | ((GSe & 0x08) ? 0x80 : 0x00)) + (0x02 + (GSd >> 2)); - getstar_val = (tmp & 0x00ff) >> 0; - GSCommand |= 0x80; /* to allow a second consecutive read */ - break; - case 0xb8: /* laser position (2nd read) */ - tmp = 0xf740 - (((GSe >> 4) << 8) | ((GSe & 0x08) ? 0x80 : 0x00)) + (0x02 + (GSd >> 2)); - getstar_val = (tmp & 0xff00) >> 8; - break; - case 0x73: /* avoid "BAD HW" message */ - getstar_val = 0x76; - break; - } - } - - case GETSTARB1: { - /* value isn't computed by the bootleg but we want to please the "test mode" */ - if (ZetPc(-1) == 0x6b04) return (lives_lookup_table[GSa]); - break; - } - - case GETSTARB2: { - /* - 056B: 21 03 E8 ld hl,$E803 - 056E: 7E ld a,(hl) - 056F: BE cp (hl) - 0570: 28 FD jr z,$056F - 0572: C6 05 add a,$05 - 0574: EE 56 xor $56 - 0576: BE cp (hl) - 0577: C2 6E 05 jp nz,$056E - */ - if (ZetPc(-1) == 0x056e) return (getstar_val); - if (ZetPc(-1) == 0x0570) return (getstar_val+1); - if (ZetPc(-1) == 0x0577) return ((getstar_val+0x05) ^ 0x56); - /* value isn't computed by the bootleg but we want to please the "test mode" */ - if (ZetPc(-1) == 0x6b04) return (lgsb2_lookup_table[GSa]); - break; - } - } - - return getstar_val; -} - -static void getstar_e803_w() -{ - switch (GetStarType) { - case GETSTAR: { - /* unknown effect - not read back */ - if (ZetPc(-1) == 0x00bf) - { - GSCommand = 0x00; - GS_RESET_REGS - } - /* players inputs */ - if (ZetPc(-1) == 0x0560) - { - GSCommand = 0x25; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x056d) - { - GSCommand = 0x25; - GS_SAVE_REGS - } - /* lose life */ - if (ZetPc(-1) == 0x0a0a) - { - GSCommand = 0x21; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0a17) - { - GSCommand = 0x21; - GS_SAVE_REGS - } - /* unknown effect */ - if (ZetPc(-1) == 0x0a51) - { - GSCommand = 0x29; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0a6e) - { - GSCommand = 0x29; - GS_SAVE_REGS - } - /* continue play */ - if (ZetPc(-1) == 0x0ae3) - { - GSCommand = 0x20; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0af0) - { - GSCommand = 0x20; - GS_SAVE_REGS - } - /* unknown effect - not read back */ - if (ZetPc(-1) == 0x0b62) - { - GSCommand = 0x00; /* 0x1f */ - GS_RESET_REGS - } - /* change player (if 2 players game) */ - if (ZetPc(-1) == 0x0bab) - { - GSCommand = 0x2a; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0bb8) - { - GSCommand = 0x2a; - GS_SAVE_REGS - } - /* game phase */ - if (ZetPc(-1) == 0x0d37) - { - GSCommand = 0x24; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0d44) - { - GSCommand = 0x24; - GS_SAVE_REGS - } - /* starting lives */ - if (ZetPc(-1) == 0x0d79) - { - GSCommand = 0x23; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0d8a) - { - GSCommand = 0x23; - GS_SAVE_REGS - } - /* starting difficulty */ - if (ZetPc(-1) == 0x0dc1) - { - GSCommand = 0x22; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0dd0) - { - GSCommand = 0x22; - GS_SAVE_REGS - } - /* starting lives (again) */ - if (ZetPc(-1) == 0x1011) - { - GSCommand = 0x23; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x101e) - { - GSCommand = 0x23; - GS_SAVE_REGS - } - /* hardware test */ - if (ZetPc(-1) == 0x107a) - { - GSCommand = 0x73; - GS_RESET_REGS - } - /* game phase (again) */ - if (ZetPc(-1) == 0x10c6) - { - GSCommand = 0x24; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x10d3) - { - GSCommand = 0x24; - GS_SAVE_REGS - } - /* background */ - if (ZetPc(-1) == 0x1910) - { - GSCommand = 0x26; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x191d) - { - GSCommand = 0x26; - GS_SAVE_REGS - } - /* foreground */ - if (ZetPc(-1) == 0x19d5) - { - GSCommand = 0x37; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x19e4) - { - GSCommand = 0x37; - GS_SAVE_REGS - } - if (ZetPc(-1) == 0x19f1) - { - GSCommand = 0x37; - /* do NOT update the registers because there are 2 writes before 2 reads ! */ - } - /* laser position */ - if (ZetPc(-1) == 0x26af) - { - GSCommand = 0x38; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x26be) - { - GSCommand = 0x38; - GS_SAVE_REGS - } - if (ZetPc(-1) == 0x26cb) - { - GSCommand = 0x38; - /* do NOT update the registers because there are 2 writes before 2 reads ! */ - } - /* starting lives (for "test mode") */ - if (ZetPc(-1) == 0x6a27) - { - GSCommand = 0x23; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x6a38) - { - GSCommand = 0x23; - GS_SAVE_REGS - } - break; - } - - case GETSTARJ: { - /* unknown effect - not read back */ - if (ZetPc(-1) == 0x00bf) - { - GSCommand = 0x00; - GS_RESET_REGS - } - /* players inputs */ - if (ZetPc(-1) == 0x0560) - { - GSCommand = 0x25; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x056d) - { - GSCommand = 0x25; - GS_SAVE_REGS - } - /* lose life */ - if (ZetPc(-1) == 0x0ad5) - { - GSCommand = 0x21; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0ae2) - { - GSCommand = 0x21; - GS_SAVE_REGS - } - /* unknown effect */ - if (ZetPc(-1) == 0x0b1c) - { - GSCommand = 0x29; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0b29) - { - GSCommand = 0x29; - GS_SAVE_REGS - } - /* continue play */ - if (ZetPc(-1) == 0x0bae) - { - GSCommand = 0x20; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0bbb) - { - GSCommand = 0x20; - GS_SAVE_REGS - } - /* unknown effect - not read back */ - if (ZetPc(-1) == 0x0c2d) - { - GSCommand = 0x00; /* 0x1f */ - GS_RESET_REGS - } - /* change player (if 2 players game) */ - if (ZetPc(-1) == 0x0c76) - { - GSCommand = 0x2a; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0c83) - { - GSCommand = 0x2a; - GS_SAVE_REGS - } - /* game phase */ - if (ZetPc(-1) == 0x0e02) - { - GSCommand = 0x24; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0e0f) - { - GSCommand = 0x24; - GS_SAVE_REGS - } - /* starting lives */ - if (ZetPc(-1) == 0x0e44) - { - GSCommand = 0x23; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0e55) - { - GSCommand = 0x23; - GS_SAVE_REGS - } - /* starting difficulty */ - if (ZetPc(-1) == 0x0e8c) - { - GSCommand = 0x22; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x0e9b) - { - GSCommand = 0x22; - GS_SAVE_REGS - } - /* starting lives (again) */ - if (ZetPc(-1) == 0x10d6) - { - GSCommand = 0x23; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x10e3) - { - GSCommand = 0x23; - GS_SAVE_REGS - } - /* hardware test */ - if (ZetPc(-1) == 0x113f) - { - GSCommand = 0x73; - GS_RESET_REGS - } - /* game phase (again) */ - if (ZetPc(-1) == 0x118b) - { - GSCommand = 0x24; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x1198) - { - GSCommand = 0x24; - GS_SAVE_REGS - } - /* background */ - if (ZetPc(-1) == 0x19f8) - { - GSCommand = 0x26; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x1a05) - { - GSCommand = 0x26; - GS_SAVE_REGS - } - /* foreground */ - if (ZetPc(-1) == 0x1abd) - { - GSCommand = 0x37; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x1acc) - { - GSCommand = 0x37; - GS_SAVE_REGS - } - if (ZetPc(-1) == 0x1ad9) - { - GSCommand = 0x37; - /* do NOT update the registers because there are 2 writes before 2 reads ! */ - } - /* laser position */ - if (ZetPc(-1) == 0x2792) - { - GSCommand = 0x38; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x27a1) - { - GSCommand = 0x38; - GS_SAVE_REGS - } - if (ZetPc(-1) == 0x27ae) - { - GSCommand = 0x38; - /* do NOT update the registers because there are 2 writes before 2 reads ! */ - } - /* starting lives (for "test mode") */ - if (ZetPc(-1) == 0x6ae2) - { - GSCommand = 0x23; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x6af3) - { - GSCommand = 0x23; - GS_SAVE_REGS - } - break; - } - - case GETSTARB1: { - /* "Test mode" doesn't compute the lives value : - 6ADA: 3E 23 ld a,$23 - 6ADC: CD 52 11 call $1152 - 6ADF: 32 03 E8 ld ($E803),a - 6AE2: DB 00 in a,($00) - 6AE4: CB 4F bit 1,a - 6AE6: 28 FA jr z,$6AE2 - 6AE8: 3A 0A C8 ld a,($C80A) - 6AEB: E6 03 and $03 - 6AED: CD 52 11 call $1152 - 6AF0: 32 03 E8 ld ($E803),a - 6AF3: DB 00 in a,($00) - 6AF5: CB 57 bit 2,a - 6AF7: 20 FA jr nz,$6AF3 - 6AF9: 00 nop - 6AFA: 00 nop - 6AFB: 00 nop - 6AFC: 00 nop - 6AFD: 00 nop - 6AFE: 00 nop - 6AFF: 00 nop - 6B00: 00 nop - 6B01: 3A 03 E8 ld a,($E803) - We save the regs though to hack it in 'getstar_e803_r' read handler. - */ - if (ZetPc(-1) == 0x6ae2) - { - GSCommand = 0x00; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x6af3) - { - GSCommand = 0x00; - GS_SAVE_REGS - } - break; - } - - case GETSTARB2: { - /* "Test mode" doesn't compute the lives value : - 6ADA: 3E 23 ld a,$23 - 6ADC: CD 52 11 call $1152 - 6ADF: 32 03 E8 ld ($E803),a - 6AE2: DB 00 in a,($00) - 6AE4: CB 4F bit 1,a - 6AE6: 00 nop - 6AE7: 00 nop - 6AE8: 3A 0A C8 ld a,($C80A) - 6AEB: E6 03 and $03 - 6AED: CD 52 11 call $1152 - 6AF0: 32 03 E8 ld ($E803),a - 6AF3: DB 00 in a,($00) - 6AF5: CB 57 bit 2,a - 6AF7: 00 nop - 6AF8: 00 nop - 6AF9: 00 nop - 6AFA: 00 nop - 6AFB: 00 nop - 6AFC: 00 nop - 6AFD: 00 nop - 6AFE: 00 nop - 6AFF: 00 nop - 6B00: 00 nop - 6B01: 3A 03 E8 ld a,($E803) - We save the regs though to hack it in 'getstar_e803_r' read handler. - */ - if (ZetPc(-1) == 0x6ae2) - { - GSCommand = 0x00; - GS_RESET_REGS - } - if (ZetPc(-1) == 0x6af3) - { - GSCommand = 0x00; - GS_SAVE_REGS - } - break; - } - } -} - -// --------------------------------------------------------------------------- - -static INT32 tigerhLoadROMs() -{ - INT32 nRomOffset = 0; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb2")) nRomOffset = 1; - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb3")) nRomOffset = 2; - - // Z80 main program - switch (nWhichGame) { - case 0: // Tiger Heli - if (BurnLoadRom(Rom01 + 0x0000, 0, 1)) { - return 1; - } - if (BurnLoadRom(Rom01 + 0x4000, 1, 1)) { - return 1; - } - if (BurnLoadRom(Rom01 + 0x8000, 2, 1)) { - return 1; - } - break; - case 1: // Get Star - if (BurnLoadRom(Rom01 + 0x0000, 0, 1)) { - return 1; - } - if (BurnLoadRom(Rom01 + 0x4000, 1, 1)) { - return 1; - } - if (BurnLoadRom(Rom01 + 0x8000, 2, 1)) { - return 1; - } - break; - case 2: { // Slap Fight - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb2")) { - if (BurnLoadRom(Rom01 + 0x0000, 0, 1)) { - return 1; - } - if (BurnLoadRom(Rom01 + 0x4000, 1, 1)) { - return 1; - } - if (BurnLoadRom(Rom01 + 0x8000, 2, 1)) { - return 1; - } - break; - } else { - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb3")) { - if (BurnLoadRom(Rom01 + 0x0000, 0, 1)) { - return 1; - } - if (BurnLoadRom(Rom01 + 0x4000, 1, 1)) { - return 1; - } - if (BurnLoadRom(Rom01 + 0x10000, 2, 1)) { - return 1; - } - if (BurnLoadRom(Rom01 + 0x8000, 3, 1)) { - return 1; - } - break; - } else { - if (BurnLoadRom(Rom01 + 0x0000, 0, 1)) { - return 1; - } - if (BurnLoadRom(Rom01 + 0x8000, 1, 1)) { - return 1; - } - break; - } - } - } - } - - // Sprites - { - INT32 nRet = 0, nBaseROM = 0; - switch (nWhichGame) { - case 0: // Tiger Heli - nBaseROM = 3; - break; - case 1: // Get Star - nBaseROM = 3; - break; - case 2: // Slap Fight - nBaseROM = 2 + nRomOffset; - break; - } - - INT32 nSize; - - { - struct BurnRomInfo ri; - - ri.nType = 0; - ri.nLen = 0; - - BurnDrvGetRomInfo(&ri, nBaseROM); - - nSize = ri.nLen; - } - - UINT8* pTemp = (UINT8*)BurnMalloc(nSize * 4); - - for (INT32 i = 0; i < 4; i++) { - nRet |= BurnLoadRom(pTemp + nSize * i, nBaseROM + i, 1); - } - - for (INT32 i = 0; i < nSize; i++) { - for (INT32 j = 0; j < 8; j++) { - TigerHeliSpriteROM[(i << 3) + j] = ((pTemp[i + nSize * 0] >> (7 - j)) & 1) << 3; - TigerHeliSpriteROM[(i << 3) + j] |= ((pTemp[i + nSize * 1] >> (7 - j)) & 1) << 2; - TigerHeliSpriteROM[(i << 3) + j] |= ((pTemp[i + nSize * 2] >> (7 - j)) & 1) << 1; - TigerHeliSpriteROM[(i << 3) + j] |= ((pTemp[i + nSize * 3] >> (7 - j)) & 1) << 0; - } - } - - BurnFree(pTemp); - - nTigerHeliSpriteMask = (nSize >> 5) - 1; - - if (nRet) { - return 1; - } - } - - // Text layer - { - INT32 nBaseROM = 0; - switch (nWhichGame) { - case 0: // Tiger Heli - nBaseROM = 7; - break; - case 1: // Get Star - nBaseROM = 7; - break; - case 2: // Slap Fight - nBaseROM = 6 + nRomOffset; - break; - } - - UINT8* pTemp = (UINT8*)BurnMalloc(0x4000); - - if (BurnLoadRom(pTemp + 0x0000, nBaseROM + 0, 1)) { - return 1; - } - if (BurnLoadRom(pTemp + 0x2000, nBaseROM + 1, 1)) { - return 1; - } - - for (INT32 i = 0; i < 0x02000; i++) { - for (INT32 j = 0; j < 8; j++) { - TigerHeliTextROM[(i << 3) + j] = ((pTemp[i + 0x0000] >> (7 - j)) & 1) << 1; - TigerHeliTextROM[(i << 3) + j] |= ((pTemp[i + 0x2000] >> (7 - j)) & 1) << 0; - } - } - - BurnFree(pTemp); - } - - // Tile layer - { - INT32 nRet = 0, nBaseROM = 0; - switch (nWhichGame) { - case 0: // Tiger Heli - nBaseROM = 9; - break; - case 1: // Get Star - nBaseROM = 9; - break; - case 2: // Slap Fight - nBaseROM = 8 + nRomOffset; - break; - } - - INT32 nSize; - - { - struct BurnRomInfo ri; - - ri.nType = 0; - ri.nLen = 0; - - BurnDrvGetRomInfo(&ri, nBaseROM); - - nSize = ri.nLen; - } - - UINT8* pTemp = (UINT8*)BurnMalloc(nSize * 4); - - for (INT32 i = 0; i < 4; i++) { - nRet |= BurnLoadRom(pTemp + nSize * i, nBaseROM + i, 1); - } - - for (INT32 i = 0; i < nSize; i++) { - for (INT32 j = 0; j < 8; j++) { - TigerHeliTileROM[(i << 3) + j] = ((pTemp[i + nSize * 0] >> (7 - j)) & 1) << 3; - TigerHeliTileROM[(i << 3) + j] |= ((pTemp[i + nSize * 1] >> (7 - j)) & 1) << 2; - TigerHeliTileROM[(i << 3) + j] |= ((pTemp[i + nSize * 2] >> (7 - j)) & 1) << 1; - TigerHeliTileROM[(i << 3) + j] |= ((pTemp[i + nSize * 3] >> (7 - j)) & 1) << 0; - } - } - - BurnFree(pTemp); - - nTigerHeliTileMask = (nSize >> 3) - 1; - - if (nRet) { - return 1; - } - } - - // Colour PROMs - { - INT32 nBaseROM = 0; - switch (nWhichGame) { - case 0: // Tiger Heli - nBaseROM = 13; - break; - case 1: // Get Star - nBaseROM = 13; - break; - case 2: // Slap Fight - nBaseROM = 12 + nRomOffset; - break; - } - - if (BurnLoadRom(TigerHeliPaletteROM + 0x0000, nBaseROM + 0, 1)) { - return 1; - } - if (BurnLoadRom(TigerHeliPaletteROM + 0x0100, nBaseROM + 1, 1)) { - return 1; - } - if (BurnLoadRom(TigerHeliPaletteROM + 0x0200, nBaseROM + 2, 1)) { - return 1; - } - } - - // Z80 program - { - INT32 nBaseROM = 0; - switch (nWhichGame) { - case 0: // Tiger Heli - nBaseROM = 16; - break; - case 1: // Get Star - nBaseROM = 16; - break; - case 2: // Slap Fight - nBaseROM = 15 + nRomOffset; - break; - } - - if (BurnLoadRom(Rom02, nBaseROM, 1)) { - return 1; - } - } - - // MCU program - { - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "tigerh") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhj") == 0) { - if (BurnLoadRom(Rom03, 17, 1)) { - return 1; - } - - use_mcu = 1; - } - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "alcon") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "slapfigh") == 0) { - if (BurnLoadRom(Rom03, 16, 1)) { - return 1; - } - - use_mcu = 1; - } - - } - - return 0; -} - -static INT32 tigerhExit() -{ - BurnTransferExit(); - - TigerHeliTextExit(); - - ZetExit(); - AY8910Exit(0); - AY8910Exit(1); - - if (use_mcu) { - use_mcu = 0; - m67805_taito_exit(); - } - - // Deallocate all used memory - BurnFree(Mem); - - GetStarType = 0; - - return 0; -} - -static void tigerhDoReset() -{ - bInterruptEnable = false; - bSoundNMIEnable = false; - bSoundCPUEnable = true; - - nStatusIndex = 0; - nProtectIndex = 0; - - ZetOpen(0); - ZetReset(); - ZetClose(); - - ZetOpen(1); - ZetReset(); - ZetClose(); - - if (use_mcu) { - m67805_taito_reset(); - } - - return; -} - -static INT32 tigerhInit() -{ - INT32 nLen; - - nWhichGame = -1; - - if (strcmp(BurnDrvGetTextA(DRV_NAME), "tigerh") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhj") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhb1") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhb2") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhb3") == 0) { - nWhichGame = 0; - } - if (strcmp(BurnDrvGetTextA(DRV_NAME), "getstar") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "getstarj") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb1") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb2") == 0) { - nWhichGame = 1; - if (strcmp(BurnDrvGetTextA(DRV_NAME), "getstar") == 0) GetStarType = GETSTAR; - if (strcmp(BurnDrvGetTextA(DRV_NAME), "getstarj") == 0) GetStarType = GETSTARJ; - if (strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb1") == 0) GetStarType = GETSTARB1; - if (strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb2") == 0) GetStarType = GETSTARB2; - } - if (strcmp(BurnDrvGetTextA(DRV_NAME), "alcon") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "slapfigh") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb1") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb2") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb3") == 0) { - nWhichGame = 2; - } - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8*)0; - if ((Mem = (UINT8*)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (tigerhLoadROMs()) { - return 1; - } - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb1")) Rom01[0x6d56] = 0xc3; - - { - ZetInit(0); - - // Main CPU setup - ZetOpen(0); - - // Program ROM - ZetMapArea(0x0000, 0x7FFF, 0, Rom01); - ZetMapArea(0x0000, 0x7FFF, 2, Rom01); - // Banked ROM - ZetMapArea(0x8000, 0xBFFF, 0, Rom01 + 0x8000); - ZetMapArea(0x8000, 0xBFFF, 2, Rom01 + 0x8000); - - // Work RAM - ZetMapArea(0xC000, 0xC7FF, 0, Ram01); - ZetMapArea(0xC000, 0xC7FF, 1, Ram01); - ZetMapArea(0xC000, 0xC7FF, 2, Ram01); - - // Shared RAM - if (strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb1")) { - ZetMapArea(0xC800, 0xCFFF, 0, RamShared); - } - ZetMapArea(0xC800, 0xCFFF, 1, RamShared); - ZetMapArea(0xC800, 0xCFFF, 2, RamShared); - - // Tile RAM - ZetMapArea(0xD000, 0xDFFF, 0, TigerHeliTileRAM); - ZetMapArea(0xD000, 0xDFFF, 1, TigerHeliTileRAM); - ZetMapArea(0xD000, 0xDFFF, 2, TigerHeliTileRAM); - // Sprite RAM - ZetMapArea(0xE000, 0xE7FF, 0, TigerHeliSpriteRAM); - ZetMapArea(0xE000, 0xE7FF, 1, TigerHeliSpriteRAM); - ZetMapArea(0xE000, 0xE7FF, 2, TigerHeliSpriteRAM); - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb2") || !strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb3")) { - ZetMapArea(0xec00, 0xeFFF, 0, Rom01 + 0x10c00); - ZetMapArea(0xec00, 0xeFFF, 2, Rom01 + 0x10c00); - } - - // Text RAM - ZetMapArea(0xF000, 0xFFFF, 0, TigerHeliTextRAM); - ZetMapArea(0xF000, 0xFFFF, 1, TigerHeliTextRAM); - ZetMapArea(0xF000, 0xFFFF, 2, TigerHeliTextRAM); - - ZetMemEnd(); - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhb1")) { - ZetSetReadHandler(tigerhReadCPU0_tigerhb1); - } else { - ZetSetReadHandler(tigerhReadCPU0); - } - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb2") || !strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb3")) { - ZetSetWriteHandler(tigerhWriteCPU0_slapbtuk); - } else { - ZetSetWriteHandler(tigerhWriteCPU0); - } - - if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb1")) { - ZetSetInHandler(tigerhInCPU0_gtstarba); - } else { - ZetSetInHandler(tigerhInCPU0); - } - - ZetSetOutHandler(tigerhOutCPU0); - - ZetClose(); - - ZetInit(1); - - // Sound CPU setup - ZetOpen(1); - - // Program ROM - ZetMapArea(0x0000, 0x1FFF, 0, Rom02); - ZetMapArea(0x0000, 0x1FFF, 2, Rom02); - - // Work RAM - ZetMapArea(0xC800, 0xCFFF, 0, RamShared); - ZetMapArea(0xC800, 0xCFFF, 1, RamShared); - ZetMapArea(0xC800, 0xCFFF, 2, RamShared); - - ZetMemEnd(); - - ZetSetReadHandler(tigerhReadCPU1); - ZetSetWriteHandler(tigerhWriteCPU1); - ZetSetInHandler(tigerhInCPU1); - ZetSetOutHandler(tigerhOutCPU1); - - ZetClose(); - - if (use_mcu) { - if (nWhichGame == 0) m67805_taito_init(Rom03, Ram03, &tigerh_m68705_interface); - if (nWhichGame == 2) m67805_taito_init(Rom03, Ram03, &slapfigh_m68705_interface); - } - } - - pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; - pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; - pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; - pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; - pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; - pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; - - AY8910Init(0, 1500000, nBurnSoundRate, &tigerhReadPort0, &tigerhReadPort1, NULL, NULL); - AY8910Init(1, 1500000, nBurnSoundRate, &tigerhReadPort2, &tigerhReadPort3, NULL, NULL); - AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); - AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); - - TigerHeliTextInit(); - TigerHeliPaletteInit(); - - BurnTransferInit(); - - tigerhDoReset(); - - return 0; -} - -static INT32 tigerhScan(INT32 nAction, INT32* pnMin) -{ - struct BurnArea ba; - - if (pnMin) { // Return minimum compatible version - *pnMin = 0x029521; - } - - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd-RamStart; - ba.szName = "All Ram"; - BurnAcb(&ba); - - ZetScan(nAction); // Scan Z80 - - // Scan critical driver variables - SCAN_VAR(bInterruptEnable); - SCAN_VAR(bSoundCPUEnable); - SCAN_VAR(bSoundNMIEnable); - SCAN_VAR(nStatusIndex); - SCAN_VAR(nProtectIndex); - SCAN_VAR(tigerhInput); - } - - return 0; -} - -static void tigerhDraw() -{ - TigerHeliPaletteUpdate(); - - TigerHeliTileRender(); - TigerHeliSpriteRender(); - TigerHeliTextRender(); - - BurnTransferCopy(TigerHeliPalette); - - return; -} - -static inline INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 tigerhFrame() -{ - INT32 nCyclesTotal[3], nCyclesDone[3]; - - if (tigerhReset) { // Reset machine - tigerhDoReset(); - } - - ZetNewFrame(); - if (use_mcu) m6805NewFrame(); - - // Compile digital inputs - tigerhInput[0] = 0x00; - tigerhInput[1] = 0x00; - for (INT32 i = 0; i < 8; i++) { - tigerhInput[0] |= (tigerhInpJoy1[i] & 1) << i; - if (nWhichGame == 0 && i < 4) { - tigerhInput[1] |= (tigerhInpMisc[i] & 1) << (i ^ 1); - } else { - tigerhInput[1] |= (tigerhInpMisc[i] & 1) << i; - } - } - - if ((tigerhInput[0] & 0x03) == 0x03) { - tigerhInput[0] &= ~0x03; - } - if ((tigerhInput[0] & 0x0C) == 0x0C) { - tigerhInput[0] &= ~0x0C; - } - if ((tigerhInput[0] & 0x30) == 0x30) { - tigerhInput[0] &= ~0x30; - } - if ((tigerhInput[0] & 0xC0) == 0xC0) { - tigerhInput[0] &= ~0xC0; - } - - if (nWhichGame == 1) { - tigerhInput[0] = (tigerhInput[0] & 0x99) | ((tigerhInput[0] << 1) & 0x44) | ((tigerhInput[0] >> 1) & 0x22); - } - - nCyclesTotal[0] = nCyclesTotal[1] = 6000000 / 60; - nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; - nCyclesTotal[2] = 3000000 / 60; - - const INT32 nVBlankCycles = 248 * 6000000 / 60 / 262; - const INT32 nInterleave = 12; - - INT32 nSoundBufferPos = 0; - INT32 nSoundNMIMask = 0; - switch (nWhichGame) { - case 0: - nSoundNMIMask = 1; - break; - case 1: - nSoundNMIMask = 3; - break; - case 2: - nSoundNMIMask = 3; - break; - } - - bool bVBlank = false; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU; - INT32 nNext, nCyclesSegment; - - nCurrentCPU = 0; - ZetOpen(nCurrentCPU); - - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - - if (nNext > nVBlankCycles && !bVBlank) { - nCyclesDone[nCurrentCPU] += ZetRun(nNext - nVBlankCycles); - - if (pBurnDraw != NULL) { - tigerhDraw(); // Draw screen if needed - } - - TigerHeliBufferSprites(); - - bVBlank = true; - - if (bInterruptEnable) { - ZetRaiseIrq(0xFF); -#if 0 - ZetClose(); - ZetOpen(1); - ZetRaiseIrq(0xFF); - ZetClose(); - ZetOpen(0); -#endif - } - } - - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - if (bVBlank || (!CheckSleep(nCurrentCPU))) { // See if this CPU is busywaiting - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - } else { - nCyclesDone[nCurrentCPU] += nCyclesSegment; - } - - ZetClose(); - - if (use_mcu) { - m6805Open(0); - nCyclesSegment = (nCyclesTotal[2] * (i + 1)) / nInterleave; - nCyclesSegment -= m6805TotalCycles(); - if (nCyclesSegment > 0) { - nCyclesDone[2] += m6805Run(nCyclesSegment); - } - m6805Close(); - } - - nCurrentCPU = 1; - nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; - nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; - - if (bSoundCPUEnable) { - ZetOpen(nCurrentCPU); - - if ((i & nSoundNMIMask) == 0) { - if (bSoundNMIEnable) { - ZetNmi(); - } - } - - nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); - ZetClose(); - } else { - nCyclesDone[nCurrentCPU] += nCyclesSegment; - } - - { - // Render sound segment - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen / nInterleave; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - nSoundBufferPos += nSegmentLength; - } - } - } - - { - // Make sure the buffer is entirely filled. - if (pBurnSoundOut) { - INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; - INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); - if (nSegmentLength) { - AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); - } - } - } - - return 0; -} - -// --------------------------------------------------------------------------- -// Rom information - -static struct BurnRomInfo tigerhRomDesc[] = { - { "0.4", 0x004000, 0x4BE73246, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "1.4", 0x004000, 0xAAD04867, BRF_ESS | BRF_PRG }, // 1 - { "2.4", 0x004000, 0x4843F15C, BRF_ESS | BRF_PRG }, // 2 - - { "a47_13.8j", 0x004000, 0x739A7E7E, BRF_GRA }, // 3 Sprite data - { "a47_12.6j", 0x004000, 0xC064ECDB, BRF_GRA }, // 4 - { "a47_11.8h", 0x004000, 0x744FAE9B, BRF_GRA }, // 5 - { "a47_10.6h", 0x004000, 0xE1CF844E, BRF_GRA }, // 6 - - { "a47_05.6f", 0x002000, 0xC5325B49, BRF_GRA }, // 7 Text layer - { "a47_04.6g", 0x002000, 0xCD59628E, BRF_GRA }, // 8 - - { "a47_09.4m", 0x004000, 0x31FAE8A8, BRF_GRA }, // 9 Background layer - { "a47_08.6m", 0x004000, 0xE539AF2B, BRF_GRA }, // 10 - { "a47_07.6n", 0x004000, 0x02FDD429, BRF_GRA }, // 11 - { "a47_06.6p", 0x004000, 0x11FBCC8C, BRF_GRA }, // 12 - - { "82s129.12q", 0x000100, 0x2C69350D, BRF_GRA }, // 13 - { "82s129.12m", 0x000100, 0x7142E972, BRF_GRA }, // 14 - { "82s129.12n", 0x000100, 0x25F273F2, BRF_GRA }, // 15 - - { "a47_03.12d", 0x002000, 0xD105260F, BRF_ESS | BRF_PRG }, // 16 - - { "a47_14.6a", 0x000800, 0x4042489F, BRF_ESS | BRF_PRG }, // 17 MCU - - { "pal16r4a.2e", 260, 0x00000000, BRF_NODUMP }, -}; - - -STD_ROM_PICK(tigerh) -STD_ROM_FN(tigerh) - -static struct BurnRomInfo tigerhjRomDesc[] = { - { "a47_00.8p", 0x004000, 0xcbdbe3cc, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "a47_01.8n", 0x004000, 0x65df2152, BRF_ESS | BRF_PRG }, // 1 - { "a47_02.8k", 0x004000, 0x633D324B, BRF_ESS | BRF_PRG }, // 2 - - { "a47_13.8j", 0x004000, 0x739A7E7E, BRF_GRA }, // 3 Sprite data - { "a47_12.6j", 0x004000, 0xC064ECDB, BRF_GRA }, // 4 - { "a47_11.8h", 0x004000, 0x744FAE9B, BRF_GRA }, // 5 - { "a47_10.6h", 0x004000, 0xE1CF844E, BRF_GRA }, // 6 - - { "a47_05.6f", 0x002000, 0xC5325B49, BRF_GRA }, // 7 Text layer - { "a47_04.6g", 0x002000, 0xCD59628E, BRF_GRA }, // 8 - - { "a47_09.4m", 0x004000, 0x31FAE8A8, BRF_GRA }, // 9 Background layer - { "a47_08.6m", 0x004000, 0xE539AF2B, BRF_GRA }, // 10 - { "a47_07.6n", 0x004000, 0x02FDD429, BRF_GRA }, // 11 - { "a47_06.6p", 0x004000, 0x11FBCC8C, BRF_GRA }, // 12 - - { "82s129.12q", 0x000100, 0x2C69350D, BRF_GRA }, // 13 - { "82s129.12m", 0x000100, 0x7142E972, BRF_GRA }, // 14 - { "82s129.12n", 0x000100, 0x25F273F2, BRF_GRA }, // 15 - - { "a47_03.12d", 0x002000, 0xD105260F, BRF_ESS | BRF_PRG }, // 16 - - { "a47_14.6a", 0x000800, 0x4042489F, BRF_ESS | BRF_PRG }, // 17 MCU -}; - - -STD_ROM_PICK(tigerhj) -STD_ROM_FN(tigerhj) - -static struct BurnRomInfo tigerhb1RomDesc[] = { - { "b0.5", 0x004000, 0x6ae7e13c, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "a47_01.8n", 0x004000, 0x65df2152, BRF_ESS | BRF_PRG }, // 1 - { "a47_02.8k", 0x004000, 0x633D324B, BRF_ESS | BRF_PRG }, // 2 - - { "a47_13.8j", 0x004000, 0x739A7E7E, BRF_GRA }, // 3 Sprite data - { "a47_12.6j", 0x004000, 0xC064ECDB, BRF_GRA }, // 4 - { "a47_11.8h", 0x004000, 0x744FAE9B, BRF_GRA }, // 5 - { "a47_10.6h", 0x004000, 0xE1CF844E, BRF_GRA }, // 6 - - { "a47_05.6f", 0x002000, 0xC5325B49, BRF_GRA }, // 7 Text layer - { "a47_04.6g", 0x002000, 0xCD59628E, BRF_GRA }, // 8 - - { "a47_09.4m", 0x004000, 0x31FAE8A8, BRF_GRA }, // 9 Background layer - { "a47_08.6m", 0x004000, 0xE539AF2B, BRF_GRA }, // 10 - { "a47_07.6n", 0x004000, 0x02FDD429, BRF_GRA }, // 11 - { "a47_06.6p", 0x004000, 0x11FBCC8C, BRF_GRA }, // 12 - - { "82s129.12q", 0x000100, 0x2C69350D, BRF_GRA }, // 13 - { "82s129.12m", 0x000100, 0x7142E972, BRF_GRA }, // 14 - { "82s129.12n", 0x000100, 0x25F273F2, BRF_GRA }, // 15 - - { "a47_03.12d", 0x002000, 0xD105260F, BRF_ESS | BRF_PRG }, // 16 -}; - - -STD_ROM_PICK(tigerhb1) -STD_ROM_FN(tigerhb1) - -static struct BurnRomInfo tigerhb2RomDesc[] = { - { "rom00_09.bin", 0x004000, 0xef738c68, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "a47_01.8n", 0x004000, 0x65df2152, BRF_ESS | BRF_PRG }, // 1 - { "rom02_07.bin", 0x004000, 0x36e250b9, BRF_ESS | BRF_PRG }, // 2 - - { "a47_13.8j", 0x004000, 0x739A7E7E, BRF_GRA }, // 3 Sprite data - { "a47_12.6j", 0x004000, 0xC064ECDB, BRF_GRA }, // 4 - { "a47_11.8h", 0x004000, 0x744FAE9B, BRF_GRA }, // 5 - { "a47_10.6h", 0x004000, 0xE1CF844E, BRF_GRA }, // 6 - - { "a47_05.6f", 0x002000, 0xC5325B49, BRF_GRA }, // 7 Text layer - { "a47_04.6g", 0x002000, 0xCD59628E, BRF_GRA }, // 8 - - { "a47_09.4m", 0x004000, 0x31FAE8A8, BRF_GRA }, // 9 Background layer - { "a47_08.6m", 0x004000, 0xE539AF2B, BRF_GRA }, // 10 - { "a47_07.6n", 0x004000, 0x02FDD429, BRF_GRA }, // 11 - { "a47_06.6p", 0x004000, 0x11FBCC8C, BRF_GRA }, // 12 - - { "82s129.12q", 0x000100, 0x2C69350D, BRF_GRA }, // 13 - { "82s129.12m", 0x000100, 0x7142E972, BRF_GRA }, // 14 - { "82s129.12n", 0x000100, 0x25F273F2, BRF_GRA }, // 15 - - { "a47_03.12d", 0x002000, 0xD105260F, BRF_ESS | BRF_PRG }, // 16 -}; - - -STD_ROM_PICK(tigerhb2) -STD_ROM_FN(tigerhb2) - -static struct BurnRomInfo tigerhb3RomDesc[] = { - { "14", 0x004000, 0xCA59DD73, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "13", 0x004000, 0x38BD54DB, BRF_ESS | BRF_PRG }, // 1 - { "a47_02.8k", 0x004000, 0x633D324B, BRF_ESS | BRF_PRG }, // 2 - - { "a47_13.8j", 0x004000, 0x739A7E7E, BRF_GRA }, // 3 Sprite data - { "a47_12.6j", 0x004000, 0xC064ECDB, BRF_GRA }, // 4 - { "a47_11.8h", 0x004000, 0x744FAE9B, BRF_GRA }, // 5 - { "a47_10.6h", 0x004000, 0xE1CF844E, BRF_GRA }, // 6 - - { "a47_05.6f", 0x002000, 0xC5325B49, BRF_GRA }, // 7 Text layer - { "a47_04.6g", 0x002000, 0xCD59628E, BRF_GRA }, // 8 - - { "a47_09.4m", 0x004000, 0x31FAE8A8, BRF_GRA }, // 9 Background layer - { "a47_08.6m", 0x004000, 0xE539AF2B, BRF_GRA }, // 10 - { "a47_07.6n", 0x004000, 0x02FDD429, BRF_GRA }, // 11 - { "a47_06.6p", 0x004000, 0x11FBCC8C, BRF_GRA }, // 12 - - { "82s129.12q", 0x000100, 0x2C69350D, BRF_GRA }, // 13 - { "82s129.12m", 0x000100, 0x7142E972, BRF_GRA }, // 14 - { "82s129.12n", 0x000100, 0x25F273F2, BRF_GRA }, // 15 - - { "a47_03.12d", 0x002000, 0xD105260F, BRF_ESS | BRF_PRG }, // 16 -}; - - -STD_ROM_PICK(tigerhb3) -STD_ROM_FN(tigerhb3) - -static struct BurnRomInfo getstarRomDesc[] = { - { "a68_00-1", 0x004000, 0x6A8BDC6C, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "a68_01-1", 0x004000, 0xEBE8DB3C, BRF_ESS | BRF_PRG }, // 1 - { "a68_02-1", 0x008000, 0x343E8415, BRF_ESS | BRF_PRG }, // 2 - - { "a68-13", 0x008000, 0x643FB282, BRF_GRA }, // 3 Sprite data - { "a68-12", 0x008000, 0x11F74E32, BRF_GRA }, // 4 - { "a68-11", 0x008000, 0xF24158CF, BRF_GRA }, // 5 - { "a68-10", 0x008000, 0x83161Ed0, BRF_GRA }, // 6 - - { "a68_05-1", 0x002000, 0x06F60107, BRF_GRA }, // 7 Text layer - { "a68_04-1", 0x002000, 0x1FC8F277, BRF_GRA }, // 8 - - { "a68_09", 0x008000, 0xA293CC2E, BRF_GRA }, // 9 Background layer - { "a68_08", 0x008000, 0x37662375, BRF_GRA }, // 10 - { "a68_07", 0x008000, 0xCF1A964C, BRF_GRA }, // 11 - { "a68_06", 0x008000, 0x05F9EB9A, BRF_GRA }, // 12 - - { "rom21", 0x000100, 0xD6360B4D, BRF_GRA }, // 13 - { "rom20", 0x000100, 0x4CA01887, BRF_GRA }, // 14 - { "rom19", 0x000100, 0x513224F0, BRF_GRA }, // 15 - - { "a68-03", 0x002000, 0x18DAA44C, BRF_ESS | BRF_PRG }, // 16 - - { "a68_14", 0x000800, 0x00000000, BRF_NODUMP | BRF_OPT | BRF_PRG }, // 17 MCU ROM -}; - - -STD_ROM_PICK(getstar) -STD_ROM_FN(getstar) - -static struct BurnRomInfo getstarjRomDesc[] = { - { "a68_00.bin", 0x004000, 0xad1a0143, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "a68_01.bin", 0x004000, 0x3426eb7c, BRF_ESS | BRF_PRG }, // 1 - { "a68_02.bin", 0x008000, 0x3567da17, BRF_ESS | BRF_PRG }, // 2 - - { "a68-13", 0x008000, 0x643FB282, BRF_GRA }, // 3 Sprite data - { "a68-12", 0x008000, 0x11F74E32, BRF_GRA }, // 4 - { "a68-11", 0x008000, 0xF24158CF, BRF_GRA }, // 5 - { "a68-10", 0x008000, 0x83161Ed0, BRF_GRA }, // 6 - - { "a68_05.bin", 0x002000, 0xe3d409e7, BRF_GRA }, // 7 Text layer - { "a68_04.bin", 0x002000, 0x6e5ac9d4, BRF_GRA }, // 8 - - { "a68_09", 0x008000, 0xA293CC2E, BRF_GRA }, // 9 Background layer - { "a68_08", 0x008000, 0x37662375, BRF_GRA }, // 10 - { "a68_07", 0x008000, 0xCF1A964C, BRF_GRA }, // 11 - { "a68_06", 0x008000, 0x05F9EB9A, BRF_GRA }, // 12 - - { "rom21", 0x000100, 0xD6360B4D, BRF_GRA }, // 13 - { "rom20", 0x000100, 0x4CA01887, BRF_GRA }, // 14 - { "rom19", 0x000100, 0x513224F0, BRF_GRA }, // 15 - - { "a68-03", 0x002000, 0x18DAA44C, BRF_ESS | BRF_PRG }, // 16 - - { "68705.bin", 0x000800, 0x00000000, BRF_NODUMP | BRF_OPT | BRF_PRG }, // 17 MCU ROM -}; - - -STD_ROM_PICK(getstarj) -STD_ROM_FN(getstarj) - -static struct BurnRomInfo gtstarb2RomDesc[] = { - { "gs_14.rom", 0x004000, 0x1A57A920, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "gs_13.rom", 0x004000, 0x805F8E77, BRF_ESS | BRF_PRG }, // 1 - { "a68_02.bin", 0x008000, 0x3567DA17, BRF_ESS | BRF_PRG }, // 2 - - { "a68-13", 0x008000, 0x643FB282, BRF_GRA }, // 3 Sprite data - { "a68-12", 0x008000, 0x11F74E32, BRF_GRA }, // 4 - { "a68-11", 0x008000, 0xF24158CF, BRF_GRA }, // 5 - { "a68-10", 0x008000, 0x83161Ed0, BRF_GRA }, // 6 - - { "a68_05.bin", 0x002000, 0xE3D409E7, BRF_GRA }, // 7 Text layer - { "a68_04.bin", 0x002000, 0x6E5AC9D4, BRF_GRA }, // 8 - - { "a68_09", 0x008000, 0xA293CC2E, BRF_GRA }, // 9 Background layer - { "a68_08", 0x008000, 0x37662375, BRF_GRA }, // 10 - { "a68_07", 0x008000, 0xCF1A964C, BRF_GRA }, // 11 - { "a68_06", 0x008000, 0x05F9EB9A, BRF_GRA }, // 12 - - { "rom21", 0x000100, 0xD6360B4D, BRF_GRA }, // 13 - { "rom20", 0x000100, 0x4CA01887, BRF_GRA }, // 14 - { "rom19", 0x000100, 0x513224F0, BRF_GRA }, // 15 - - { "a68-03", 0x002000, 0x18DAA44C, BRF_ESS | BRF_PRG }, // 16 -}; - - -STD_ROM_PICK(gtstarb2) -STD_ROM_FN(gtstarb2) - -static struct BurnRomInfo gtstarb1RomDesc[] = { - { "gs_rb_1.bin", 0x004000, 0x9afad7e0, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "gs_rb_2.bin", 0x004000, 0x5feb0a60, BRF_ESS | BRF_PRG }, // 1 - { "gs_rb_3.bin", 0x008000, 0xe3cfb1ba, BRF_ESS | BRF_PRG }, // 2 - - { "a68-13", 0x008000, 0x643FB282, BRF_GRA }, // 3 Sprite data - { "a68-12", 0x008000, 0x11F74E32, BRF_GRA }, // 4 - { "a68-11", 0x008000, 0xF24158CF, BRF_GRA }, // 5 - { "a68-10", 0x008000, 0x83161Ed0, BRF_GRA }, // 6 - - { "a68_05.bin", 0x002000, 0xE3D409E7, BRF_GRA }, // 7 Text layer - { "a68_04.bin", 0x002000, 0x6E5AC9D4, BRF_GRA }, // 8 - - { "a68_09", 0x008000, 0xA293CC2E, BRF_GRA }, // 9 Background layer - { "a68_08", 0x008000, 0x37662375, BRF_GRA }, // 10 - { "a68_07", 0x008000, 0xCF1A964C, BRF_GRA }, // 11 - { "a68_06", 0x008000, 0x05F9EB9A, BRF_GRA }, // 12 - - { "rom21", 0x000100, 0xD6360B4D, BRF_GRA }, // 13 - { "rom20", 0x000100, 0x4CA01887, BRF_GRA }, // 14 - { "rom19", 0x000100, 0x513224F0, BRF_GRA }, // 15 - - { "a68-03", 0x002000, 0x18DAA44C, BRF_ESS | BRF_PRG }, // 16 -}; - - -STD_ROM_PICK(gtstarb1) -STD_ROM_FN(gtstarb1) - -static struct BurnRomInfo alconRomDesc[] = { - { "a77_00-1.8p", 0x008000, 0x2ba82d60, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "a77_01-1.8n", 0x008000, 0x18bb2f12, BRF_ESS | BRF_PRG }, // 1 - - { "a77_12.8j", 0x008000, 0x8545d397, BRF_GRA }, // 2 Sprite data - { "a77_11.7j", 0x008000, 0xb1b7b925, BRF_GRA }, // 3 - { "a77_10.8h", 0x008000, 0x422d946b, BRF_GRA }, // 4 - { "a77_09.7h", 0x008000, 0x587113ae, BRF_GRA }, // 5 - - { "a77_04-1.6f", 0x002000, 0x31003483, BRF_GRA }, // 6 Text layer - { "a77_03-1.6g", 0x002000, 0x404152c0, BRF_GRA }, // 7 - - { "a77_08.6k", 0x008000, 0xB6358305, BRF_GRA }, // 8 Background layer - { "a77_07.6m", 0x008000, 0xE92D9D60, BRF_GRA }, // 9 - { "a77_06.6n", 0x008000, 0x5FAEEEA3, BRF_GRA }, // 10 - { "a77_05.6p", 0x008000, 0x974E2EA9, BRF_GRA }, // 11 - - { "21_82s129.12q",0x000100, 0xA0EFAF99, BRF_GRA }, // 12 - { "20_82s129.12m",0x000100, 0xA56D57E5, BRF_GRA }, // 13 - { "19_82s129.12n",0x000100, 0x5CBF9FBF, BRF_GRA }, // 14 - - { "a77_02.12d", 0x002000, 0x87F4705A, BRF_ESS | BRF_PRG }, // 15 - - { "a77_13.6a", 0x000800, 0xa70c81d9, BRF_ESS | BRF_PRG }, // 16 MCU ROM -}; - - -STD_ROM_PICK(alcon) -STD_ROM_FN(alcon) - -static struct BurnRomInfo slapfighRomDesc[] = { - { "a77_00.8p", 0x008000, 0x674C0E0F, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "a77_01.8n", 0x008000, 0x3C42E4A7, BRF_ESS | BRF_PRG }, // 1 - - { "a77_12.8j", 0x008000, 0x8545d397, BRF_GRA }, // 2 Sprite data - { "a77_11.7j", 0x008000, 0xb1b7b925, BRF_GRA }, // 3 - { "a77_10.8h", 0x008000, 0x422d946b, BRF_GRA }, // 4 - { "a77_09.7h", 0x008000, 0x587113ae, BRF_GRA }, // 5 - - { "a77_04.6f", 0x002000, 0x2AC7B943, BRF_GRA }, // 6 Text layer - { "a77_03.6g", 0x002000, 0x33CADC93, BRF_GRA }, // 7 - - { "a77_08.6k", 0x008000, 0xB6358305, BRF_GRA }, // 8 Background layer - { "a77_07.6m", 0x008000, 0xE92D9D60, BRF_GRA }, // 9 - { "a77_06.6n", 0x008000, 0x5FAEEEA3, BRF_GRA }, // 10 - { "a77_05.6p", 0x008000, 0x974E2EA9, BRF_GRA }, // 11 - - { "21_82s129.12q",0x000100, 0xA0EFAF99, BRF_GRA }, // 12 - { "20_82s129.12m",0x000100, 0xA56D57E5, BRF_GRA }, // 13 - { "19_82s129.12n",0x000100, 0x5CBF9FBF, BRF_GRA }, // 14 - - { "a77_02.12d", 0x002000, 0x87F4705A, BRF_ESS | BRF_PRG }, // 15 - - { "a77_13.6a", 0x000800, 0xa70c81d9, BRF_ESS | BRF_PRG }, // 16 MCU ROM -}; - - -STD_ROM_PICK(slapfigh) -STD_ROM_FN(slapfigh) - -static struct BurnRomInfo slapbtjpRomDesc[] = { - { "sf_r19jb.bin", 0x008000, 0x9A7AC8B3, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "sf_rh.bin", 0x008000, 0x3C42E4A7, BRF_ESS | BRF_PRG }, // 1 - - { "sf_r03.bin", 0x008000, 0x8545D397, BRF_GRA }, // 2 Sprite data - { "sf_r01.bin", 0x008000, 0xB1B7B925, BRF_GRA }, // 3 - { "sf_r04.bin", 0x008000, 0x422D946B, BRF_GRA }, // 4 - { "sf_r02.bin", 0x008000, 0x587113AE, BRF_GRA }, // 5 - - { "sf_r11.bin", 0x002000, 0x2AC7B943, BRF_GRA }, // 6 Text layer - { "sf_r10.bin", 0x002000, 0x33CADC93, BRF_GRA }, // 7 - - { "sf_r06.bin", 0x008000, 0xB6358305, BRF_GRA }, // 8 Background layer - { "sf_r09.bin", 0x008000, 0xE92D9D60, BRF_GRA }, // 9 - { "sf_r08.bin", 0x008000, 0x5FAEEEA3, BRF_GRA }, // 10 - { "sf_r07.bin", 0x008000, 0x974E2EA9, BRF_GRA }, // 11 - - { "sf_col21.bin", 0x000100, 0xA0EFAF99, BRF_GRA }, // 12 - { "sf_col20.bin", 0x000100, 0xA56D57E5, BRF_GRA }, // 13 - { "sf_col19.bin", 0x000100, 0x5CBF9FBF, BRF_GRA }, // 14 - - { "sf_r05.bin", 0x002000, 0x87F4705A, BRF_ESS | BRF_PRG }, // 15 -}; - - -STD_ROM_PICK(slapbtjp) -STD_ROM_FN(slapbtjp) - -static struct BurnRomInfo slapbtukRomDesc[] = { - { "sf_r19eb.bin", 0x004000, 0x2efe47af, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "sf_r20eb.bin", 0x004000, 0xf42c7951, BRF_ESS | BRF_PRG }, // 1 - { "sf_rh.bin", 0x008000, 0x3C42E4A7, BRF_ESS | BRF_PRG }, // 1 - - { "sf_r03.bin", 0x008000, 0x8545D397, BRF_GRA }, // 2 Sprite data - { "sf_r01.bin", 0x008000, 0xB1B7B925, BRF_GRA }, // 3 - { "sf_r04.bin", 0x008000, 0x422D946B, BRF_GRA }, // 4 - { "sf_r02.bin", 0x008000, 0x587113AE, BRF_GRA }, // 5 - - { "sf_r11.bin", 0x002000, 0x2AC7B943, BRF_GRA }, // 6 Text layer - { "sf_r10.bin", 0x002000, 0x33CADC93, BRF_GRA }, // 7 - - { "sf_r06.bin", 0x008000, 0xB6358305, BRF_GRA }, // 8 Background layer - { "sf_r09.bin", 0x008000, 0xE92D9D60, BRF_GRA }, // 9 - { "sf_r08.bin", 0x008000, 0x5FAEEEA3, BRF_GRA }, // 10 - { "sf_r07.bin", 0x008000, 0x974E2EA9, BRF_GRA }, // 11 - - { "sf_col21.bin", 0x000100, 0xA0EFAF99, BRF_GRA }, // 12 - { "sf_col20.bin", 0x000100, 0xA56D57E5, BRF_GRA }, // 13 - { "sf_col19.bin", 0x000100, 0x5CBF9FBF, BRF_GRA }, // 14 - - { "sf_r05.bin", 0x002000, 0x87F4705A, BRF_ESS | BRF_PRG }, // 15 -}; - - -STD_ROM_PICK(slapbtuk) -STD_ROM_FN(slapbtuk) - -static struct BurnRomInfo slapfgtrRomDesc[] = { - { "k1-10.u90", 0x004000, 0x2efe47af, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "k1-09.u89", 0x004000, 0x17c187c5, BRF_ESS | BRF_PRG }, // 1 - { "k1-08.u88", 0x002000, 0x945af97f, BRF_ESS | BRF_PRG }, // 1 - { "k1-07.u87", 0x008000, 0x3C42E4A7, BRF_ESS | BRF_PRG }, // 1 - - { "k1-15.u60", 0x008000, 0x8545D397, BRF_GRA }, // 2 Sprite data - { "k1-13.u50", 0x008000, 0xB1B7B925, BRF_GRA }, // 3 - { "k1-14.u59", 0x008000, 0x422D946B, BRF_GRA }, // 4 - { "k1-12.u49", 0x008000, 0x587113AE, BRF_GRA }, // 5 - - { "k1-02.u57" , 0x002000, 0x2AC7B943, BRF_GRA }, // 6 Text layer - { "k1-03.u58", 0x002000, 0x33CADC93, BRF_GRA }, // 7 - - { "k1-01.u49" , 0x008000, 0xB6358305, BRF_GRA }, // 8 Background layer - { "k1-04.u62", 0x008000, 0xE92D9D60, BRF_GRA }, // 9 - { "k1-05.u63", 0x008000, 0x5FAEEEA3, BRF_GRA }, // 10 - { "k1-06.u64", 0x008000, 0x974E2EA9, BRF_GRA }, // 11 - - { "sf_col21.bin", 0x000100, 0xA0EFAF99, BRF_GRA }, // 12 - { "sf_col20.bin", 0x000100, 0xA56D57E5, BRF_GRA }, // 13 - { "sf_col19.bin", 0x000100, 0x5CBF9FBF, BRF_GRA }, // 14 - - { "k1-11.u89", 0x002000, 0x87F4705A, BRF_ESS | BRF_PRG }, // 15 -}; - - -STD_ROM_PICK(slapfgtr) -STD_ROM_FN(slapfgtr) - -struct BurnDriver BurnDrvTigerH = { - "tigerh", NULL, NULL, NULL, "1985", - "Tiger Heli (US)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, - NULL, tigerhRomInfo, tigerhRomName, NULL, NULL, tigerhInputInfo, tigerhDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 240, 280, 3, 4 -}; - -struct BurnDriver BurnDrvTigerhJ = { - "tigerhj", "tigerh", NULL, NULL, "1985", - "Tiger Heli (Japan)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, - NULL, tigerhjRomInfo, tigerhjRomName, NULL, NULL, tigerhInputInfo, tigerhDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 240, 280, 3, 4 -}; - -struct BurnDriver BurnDrvTigerHB1 = { - "tigerhb1", "tigerh", NULL, NULL, "1985", - "Tiger Heli (bootleg, set 1)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, - NULL, tigerhb1RomInfo, tigerhb1RomName, NULL, NULL, tigerhInputInfo, tigerhDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 240, 280, 3, 4 -}; - -struct BurnDriver BurnDrvTigerHB2 = { - "tigerhb2", "tigerh", NULL, NULL, "1985", - "Tiger Heli (bootleg, set 2)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, - NULL, tigerhb2RomInfo, tigerhb2RomName, NULL, NULL, tigerhInputInfo, tigerhDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 240, 280, 3, 4 -}; - -struct BurnDriver BurnDrvTigerHB3 = { - "tigerhb3", "tigerh", NULL, NULL, "1985", - "Tiger Heli (bootleg, set 3)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, - NULL, tigerhb3RomInfo, tigerhb3RomName, NULL, NULL, tigerhInputInfo, tigerhDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 240, 280, 3, 4 -}; - -struct BurnDriver BurnDrvGetStar = { - "getstar", NULL, NULL, NULL, "1986", - "Guardian\0", NULL, "Toaplan / Taito America Corporation (Kitkorp license)", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TOAPLAN_MISC, GBF_SCRFIGHT, 0, - NULL, getstarRomInfo, getstarRomName, NULL, NULL, getstarInputInfo, getstarDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 280, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGetStarj = { - "getstarj", "getstar", NULL, NULL, "1986", - "Get Star (Japan)\0", NULL, "Toaplan / Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_MISC, GBF_SCRFIGHT, 0, - NULL, getstarjRomInfo, getstarjRomName, NULL, NULL, getstarInputInfo, getstarDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 280, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGetStarb2 = { - "gtstarb2", "getstar", NULL, NULL, "1986", - "Get Star (bootleg, set 2)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TOAPLAN_MISC, GBF_SCRFIGHT, 0, - NULL, gtstarb2RomInfo, gtstarb2RomName, NULL, NULL, tigerhInputInfo, getstarb2DIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 280, 240, 4, 3 -}; - -struct BurnDriver BurnDrvGetStarb1 = { - "gtstarb1", "getstar", NULL, NULL, "1986", - "Get Star (bootleg, set 1)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TOAPLAN_MISC, GBF_SCRFIGHT, 0, - NULL, gtstarb1RomInfo, gtstarb1RomName, NULL, NULL, getstarInputInfo, getstarDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 280, 240, 4, 3 -}; - -struct BurnDriver BurnDrvAlcon = { - "alcon", NULL, NULL, NULL, "1986", - "Alcon (US)\0", NULL, "Taito America Corp.", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, - NULL, alconRomInfo, alconRomName, NULL, NULL, tigerhInputInfo, slapfighDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 240, 280, 3, 4 -}; - -struct BurnDriver BurnDrvSlapFigh = { - "slapfigh", "alcon", NULL, NULL, "1986", - "Slap Fight (Japan set 1)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, - NULL, slapfighRomInfo, slapfighRomName, NULL, NULL, tigerhInputInfo, slapfighDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 240, 280, 3, 4 -}; - -struct BurnDriver BurnDrvSlapBtJP = { - "slapfighb1", "alcon", NULL, NULL, "1986", - "Slap Fight (bootleg set 1)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, - NULL, slapbtjpRomInfo, slapbtjpRomName, NULL, NULL, tigerhInputInfo, slapfighDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 240, 280, 3, 4 -}; - -struct BurnDriver BurnDrvSlapBtUK = { - "slapfighb2", "alcon", NULL, NULL, "1986", - "Slap Fight (bootleg set 2)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, - NULL, slapbtukRomInfo, slapbtukRomName, NULL, NULL, tigerhInputInfo, slapfighDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 240, 280, 3, 4 -}; - -struct BurnDriver BurnDrvSlapFghtr = { - "slapfighb3", "alcon", NULL, NULL, "1986", - "Slap Fight (bootleg set 3)\0", NULL, "Taito", "Early Toaplan", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, - NULL, slapfgtrRomInfo, slapfgtrRomName, NULL, NULL, tigerhInputInfo, slapfighDIPInfo, - tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, - 240, 280, 3, 4 -}; +// Tiger Heli, Get Star / Guardian, & Slap Fight + +#include "burnint.h" +#include "z80_intf.h" +#include "taito_m68705.h" +#include "bitswap.h" +#include "driver.h" +extern "C" { + #include "ay8910.h" +} + +static INT32 nWhichGame; + +static bool bInterruptEnable; +static bool bSoundCPUEnable; +static bool bSoundNMIEnable; + +static INT32 nStatusIndex; +static INT32 nProtectIndex; + +static UINT8 getstar_e803_r(); +static void getstar_e803_w(); + +// --------------------------------------------------------------------------- +// Inputs + +static UINT8 tigerhInput[4] = {0,0,0,0}; +static UINT8 tigerhInpJoy1[8]; +static UINT8 tigerhInpMisc[8]; +static UINT8 tigerhReset = 0; + +// Dip Switch and Input Definitions +static struct BurnInputInfo tigerhInputList[] = { + {"P1 Coin", BIT_DIGITAL, tigerhInpMisc + 6, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, tigerhInpMisc + 4, "p1 start"}, + {"P1 Up", BIT_DIGITAL, tigerhInpJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, tigerhInpJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, tigerhInpJoy1 + 3, "p1 left"}, + {"P1 Right", BIT_DIGITAL, tigerhInpJoy1 + 2, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, tigerhInpMisc + 1, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, tigerhInpMisc + 0, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, tigerhInpMisc + 7, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, tigerhInpMisc + 5, "p2 start"}, + {"P2 Up", BIT_DIGITAL, tigerhInpJoy1 + 4, "p2 up"}, + {"P2 Down", BIT_DIGITAL, tigerhInpJoy1 + 5, "p2 down"}, + {"P2 Left", BIT_DIGITAL, tigerhInpJoy1 + 7, "p2 left"}, + {"P2 Right", BIT_DIGITAL, tigerhInpJoy1 + 6, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, tigerhInpMisc + 3, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, tigerhInpMisc + 2, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &tigerhReset, "reset"}, + + {"Dip A", BIT_DIPSWITCH, tigerhInput + 2, "dip"}, + {"Dip B", BIT_DIPSWITCH, tigerhInput + 3, "dip"}, +}; + +STDINPUTINFO(tigerh) + +static struct BurnInputInfo getstarInputList[] = { + {"P1 Coin", BIT_DIGITAL, tigerhInpMisc + 6, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, tigerhInpMisc + 4, "p1 start"}, + {"P1 Up", BIT_DIGITAL, tigerhInpJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, tigerhInpJoy1 + 2, "p1 down"}, + {"P1 Left", BIT_DIGITAL, tigerhInpJoy1 + 3, "p1 left"}, + {"P1 Right", BIT_DIGITAL, tigerhInpJoy1 + 1, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, tigerhInpMisc + 1, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, tigerhInpMisc + 0, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, tigerhInpMisc + 7, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, tigerhInpMisc + 5, "p2 start"}, + {"P2 Up", BIT_DIGITAL, tigerhInpJoy1 + 4, "p2 up"}, + {"P2 Down", BIT_DIGITAL, tigerhInpJoy1 + 6, "p2 down"}, + {"P2 Left", BIT_DIGITAL, tigerhInpJoy1 + 7, "p2 left"}, + {"P2 Right", BIT_DIGITAL, tigerhInpJoy1 + 5, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, tigerhInpMisc + 3, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, tigerhInpMisc + 2, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &tigerhReset, "reset"}, + + {"Dip A", BIT_DIPSWITCH, tigerhInput + 2, "dip"}, + {"Dip B", BIT_DIPSWITCH, tigerhInput + 3, "dip"}, +}; + +STDINPUTINFO(getstar) + +static struct BurnDIPInfo tigerhDIPList[] = { + // Defaults + {0x11, 0xFF, 0xFF, 0x10, NULL}, + {0x12, 0xFF, 0xFF, 0x00, NULL}, + + // DIP A + {0, 0xFE, 0, 2, "Hero speed"}, + {0x11, 0x01, 0x80, 0x00, "Normal"}, + {0x11, 0x01, 0x80, 0x80, "Fast"}, + {0, 0xFE, 0, 2, NULL}, + {0x11, 0x01, 0x40, 0x00, "Normal game"}, + {0x11, 0x01, 0x40, 0x40, "DIP switch test"}, + {0, 0xFE, 0, 2, NULL}, + {0x11, 0x01, 0x20, 0x00, "Normal screen"}, + {0x11, 0x01, 0x20, 0x20, "Invert screen"}, + {0, 0xFE, 0, 2, "Cabinet"}, + {0x11, 0x01, 0x10, 0x10, "Upright"}, + {0x11, 0x01, 0x10, 0x00, "Table"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x11, 0x01, 0x08, 0x00, "On"}, + {0x11, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 7, "Coinage"}, + {0x11, 0x01, 0x07, 0x00, "1 coin 1 credit"}, + {0x11, 0x01, 0x07, 0x01, "1 coin 2 credits"}, + {0x11, 0x01, 0x07, 0x02, "1 coin 3 credits"}, + {0x11, 0x01, 0x07, 0x03, "2 coins 1 credit"}, + {0x11, 0x01, 0x07, 0x04, "2 coins 3 credits"}, + {0x11, 0x01, 0x07, 0x05, "3 coins 1 credit"}, + {0x11, 0x01, 0x07, 0x07, "Free play"}, + {0x11, 0x01, 0x07, 0x06, "3 coins 1 credit"}, + + // DIP B + {0, 0xFE, 0, 2, "Extend"}, + {0x12, 0x01, 0x10, 0x00, "20000 & 80000"}, + {0x12, 0x01, 0x10, 0x10, "50000 & 120000"}, + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x12, 0x01, 0x0C, 0x00, "0"}, + {0x12, 0x01, 0x0C, 0x04, "1"}, + {0x12, 0x01, 0x0C, 0x08, "2"}, + {0x12, 0x01, 0x0C, 0x0C, "3"}, + {0, 0xFE, 0, 4, "Number of heroes"}, + {0x12, 0x01, 0x03, 0x00, "3"}, + {0x12, 0x01, 0x03, 0x01, "5"}, + {0x12, 0x01, 0x03, 0x02, "1"}, + {0x12, 0x01, 0x03, 0x03, "2"}, +}; + +STDDIPINFO(tigerh) + +static struct BurnDIPInfo getstarDIPList[] = { + // Defaults + {0x11, 0xFF, 0xFF, 0x10, NULL}, + + // DIP A + {0, 0xFE, 0, 2, NULL}, + {0x11, 0x01, 0x40, 0x00, "Normal game"}, + {0x11, 0x01, 0x40, 0x40, "DIP switch test"}, + {0, 0xFE, 0, 2, NULL}, + {0x11, 0x01, 0x20, 0x00, "Normal screen"}, + {0x11, 0x01, 0x20, 0x20, "Invert screen"}, + {0, 0xFE, 0, 2, "Cabinet"}, + {0x11, 0x01, 0x10, 0x10, "Upright"}, + {0x11, 0x01, 0x10, 0x00, "Table"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x11, 0x01, 0x08, 0x00, "On"}, + {0x11, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 7, "Coinage"}, + {0x11, 0x01, 0x07, 0x00, "1 coin 1 credit"}, + {0x11, 0x01, 0x07, 0x01, "1 coin 2 credits"}, + {0x11, 0x01, 0x07, 0x02, "1 coin 3 credits"}, + {0x11, 0x01, 0x07, 0x03, "2 coins 1 credit"}, + {0x11, 0x01, 0x07, 0x04, "2 coins 3 credits"}, + {0x11, 0x01, 0x07, 0x05, "3 coins 1 credit"}, + {0x11, 0x01, 0x07, 0x07, "Free play"}, + {0x11, 0x01, 0x07, 0x06, "3 coins 1 credit"}, + + // DIP B + {0, 0xFE, 0, 2, "Extend"}, + {0x12, 0x01, 0x10, 0x00, "30000 & 100000"}, + {0x12, 0x01, 0x10, 0x10, "50000 & 150000"}, + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x12, 0x01, 0x0C, 0x00, "0"}, + {0x12, 0x01, 0x0C, 0x04, "1"}, + {0x12, 0x01, 0x0C, 0x08, "2"}, + {0x12, 0x01, 0x0C, 0x0C, "3"}, +}; + +static struct BurnDIPInfo getstarHeroesDIPList[] = +{ + // Defaults + {0x12, 0xFF, 0xFF, 0x00, NULL}, + + // DIP B + {0, 0xFE, 0, 4, "Number of heroes"}, + {0x12, 0x01, 0x03, 0x02, "1"}, + {0x12, 0x01, 0x03, 0x03, "2"}, + {0x12, 0x01, 0x03, 0x00, "3"}, + {0x12, 0x01, 0x03, 0x01, "5"}, +}; + +static struct BurnDIPInfo getstarb2HeroesDIPList[] = +{ + // Defaults + {0x12, 0xFF, 0xFF, 0x01, NULL}, + + // DIP B + {0, 0xFE, 0, 4, "Number of heroes"}, + {0x12, 0x01, 0x03, 0x01, "3"}, + {0x12, 0x01, 0x03, 0x02, "4"}, + {0x12, 0x01, 0x03, 0x03, "5"}, + {0x12, 0x01, 0x03, 0x00, "240 (cheat)"}, +}; + +STDDIPINFOEXT(getstar, getstar, getstarHeroes) +STDDIPINFOEXT(getstarb2, getstar, getstarb2Heroes) + +static struct BurnDIPInfo slapfighDIPList[] = { + // Defaults + {0x11, 0xFF, 0xFF, 0x80, NULL}, + {0x12, 0xFF, 0xFF, 0x00, NULL}, + + // DIP A + {0, 0xFE, 0, 2, NULL}, + {0x11, 0x01, 0x80, 0x80, "Up-right type"}, + {0x11, 0x01, 0x80, 0x00, "Table type"}, + {0, 0xFE, 0, 2, NULL}, + {0x11, 0x01, 0x40, 0x00, "Normal screen"}, + {0x11, 0x01, 0x40, 0x40, "Invert screen"}, + {0, 0xFE, 0, 2, NULL}, + {0x11, 0x01, 0x20, 0x00, "Normal game"}, + {0x11, 0x01, 0x20, 0x20, "Screen test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x11, 0x01, 0x10, 0x00, "On"}, + {0x11, 0x01, 0x10, 0x10, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, + {0x11, 0x01, 0x0C, 0x00, "1 coin 1 play"}, + {0x11, 0x01, 0x0C, 0x08, "1 coin 2 plays"}, + {0x11, 0x01, 0x0C, 0x04, "2 coins 1 play"}, + {0x11, 0x01, 0x0C, 0x0C, "2 coins 3 plays"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x11, 0x01, 0x03, 0x00, "1 coin 1 play"}, + {0x11, 0x01, 0x03, 0x02, "1 coin 2 plays"}, + {0x11, 0x01, 0x03, 0x01, "2 coins 1 play"}, + {0x11, 0x01, 0x03, 0x03, "2 coins 3 plays"}, + + // DIP B + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x12, 0x01, 0xC0, 0x00, "B"}, + {0x12, 0x01, 0xC0, 0x80, "A"}, + {0x12, 0x01, 0xC0, 0x40, "C"}, + {0x12, 0x01, 0xC0, 0xC0, "D"}, + {0, 0xFE, 0, 4, "Extend"}, + {0x12, 0x01, 0x30, 0x00, "30000, 100000"}, + {0x12, 0x01, 0x30, 0x20, "50000, 200000"}, + {0x12, 0x01, 0x30, 0x10, "50000 only"}, + {0x12, 0x01, 0x30, 0x30, "100000 only"}, + {0, 0xFE, 0, 4, "Fighter counts"}, + {0x12, 0x01, 0x0C, 0x00, "3"}, + {0x12, 0x01, 0x0C, 0x08, "5"}, + {0x12, 0x01, 0x0C, 0x04, "1"}, + {0x12, 0x01, 0x0C, 0x0C, "2"}, + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x02, 0x00, "Normal game"}, + {0x12, 0x01, 0x02, 0x02, "DIP-switch display"}, +}; + +STDDIPINFO(slapfigh) + +// --------------------------------------------------------------------------- + +static UINT8 *Mem, *MemEnd, *RamStart, *RamEnd; + +static UINT8 *Rom01, *Rom02, *Rom03; +static UINT8 *TigerHeliTileROM, *TigerHeliSpriteROM, *TigerHeliTextROM; + +static UINT8 *Ram01, *RamShared, *Ram03; +static UINT8 *TigerHeliTileRAM, *TigerHeliSpriteRAM, *TigerHeliSpriteBuf, *TigerHeliTextRAM; + +static UINT8* TigerHeliPaletteROM; +static UINT32* TigerHeliPalette; + +static INT16* pFMBuffer; +static INT16* pAY8910Buffer[6]; + +static INT32 use_mcu = 0; + +static INT32 MemIndex() +{ + UINT8* Next; Next = Mem; + Rom01 = Next; Next += 0x012000; // Z80 main program + Rom02 = Next; Next += 0x002000; // Z80 sound program + Rom03 = Next; Next += 0x000800; // m68705 mcu program + TigerHeliTextROM = Next; Next += 0x010000; + TigerHeliSpriteROM = Next; Next += 0x040000; + TigerHeliTileROM = Next; Next += 0x040000; + RamStart = Next; + Ram01 = Next; Next += 0x000800; // Z80 main work RAM + RamShared = Next; Next += 0x000800; // Shared RAM + TigerHeliTextRAM = Next; Next += 0x001000; + TigerHeliSpriteRAM = Next; Next += 0x000800; + TigerHeliSpriteBuf = Next; Next += 0x000800; + TigerHeliTileRAM = Next; Next += 0x001000; + Ram03 = Next; Next += 0x000080; + RamEnd = Next; + pFMBuffer = (INT16*)Next; Next += nBurnSoundLen * 6 * sizeof(INT16); + TigerHeliPaletteROM = Next; Next += 0x000300; + TigerHeliPalette = (UINT32*)Next; Next += 0x000100 * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +// --------------------------------------------------------------------------- +// Graphics + +static INT32 nTigerHeliTileXPosLo, nTigerHeliTileXPosHi, nTigerHeliTileYPosLo; +static INT32 nTigerHeliTileMask; + +static UINT8* pTileData; + +static INT32 nTileNumber; +static INT32 nTilePalette; + +static UINT16* pTileRow; +static UINT16* pTile; + +static INT32 nTileXPos, nTileYPos; + +// --------------------------------------------------------------------------- +// Palette + +static UINT8 tigerhRecalcPalette = 0; + +static void TigerHeliPaletteInit() +{ + for (INT32 i = 0; i < 0x0100; i++) { + INT32 r, g, b; + + r = TigerHeliPaletteROM[i + 0x0000]; // Red + r |= r << 4; + g = TigerHeliPaletteROM[i + 0x0100]; // Green + g |= g << 4; + b = TigerHeliPaletteROM[i + 0x0200]; // Blue + b |= b << 4; + + TigerHeliPalette[i] = BurnHighCol(r, g, b, 0); + } + + return; +} + +static void TigerHeliPaletteUpdate() +{ + if (tigerhRecalcPalette) { + tigerhRecalcPalette = 0; + + TigerHeliPaletteInit(); + } +} + +// --------------------------------------------------------------------------- +// Text layer + +static UINT8* TigerHeliTextAttrib = NULL; + +static void TigerHeliTextExit() +{ + BurnFree(TigerHeliTextAttrib); +} + +static INT32 TigerHeliTextInit() +{ + if ((TigerHeliTextAttrib = (UINT8*)BurnMalloc(0x0400)) == NULL) { + return 1; + } + + for (INT32 i = 0; i < 0x0400; i++) { + bool bEmpty = true; + + for (INT32 j = 0; j < 64; j++) { + if (TigerHeliTextROM[(i << 6) + j]) { + bEmpty = false; + break; + } + } + + if (bEmpty) { + TigerHeliTextAttrib[i] = 0; + } else { + TigerHeliTextAttrib[i] = 1; + } + } + + return 0; +} + +#define PLOTPIXEL(x) if (pTileData[x]) { pPixel[x] = nPalette + pTileData[x]; } + +static void TigerHeliRenderTextTile() +{ + UINT16 nPalette = nTilePalette << 2; + pTileData = TigerHeliTextROM + (nTileNumber << 6); + + UINT16* pPixel = pTile; + + for (INT32 y = 0; y < 8; y++, pPixel += 280, pTileData += 8) { + + if ((nTileYPos + y) >= 240) { + break; + } + if ((nTileYPos + y) < 0) { + continue; + } + + PLOTPIXEL(0); + PLOTPIXEL(1); + PLOTPIXEL(2); + PLOTPIXEL(3); + PLOTPIXEL(4); + PLOTPIXEL(5); + PLOTPIXEL(6); + PLOTPIXEL(7); + } +} + +#undef PLOTPIXEL + +static void TigerHeliTextRender() +{ + UINT8* pTextRAM; + + if ((nBurnLayer & 2) == 0) { + return; + } + + switch (nWhichGame) { + case 0: // Tiger Heli + nTileYPos = -15; + break; + case 1: // Get Star + nTileYPos = -15; + break; + case 2: // Slap Fight + nTileYPos = -16; + break; + } + pTileRow = pTransDraw + nTileYPos * 280; + + for (INT32 y = 0; y < 32; y++, nTileYPos += 8, pTileRow += (280 << 3)) { + if (nTileYPos <= -8 || nTileYPos >= 240 ) { + continue; + } + pTextRAM = TigerHeliTextRAM + (y << 6); + pTile = pTileRow; + for (INT32 x = 1; x < 36; x++, pTile += 8) { + nTileNumber = pTextRAM[x] | (pTextRAM[0x0800 + x] << 8); + nTilePalette = nTileNumber >> 10; + nTileNumber &= 0x03FF; + + if (TigerHeliTextAttrib[nTileNumber]) { + TigerHeliRenderTextTile(); + } + } + } + + return; +} + +// --------------------------------------------------------------------------- +// Tile layer + +#define PLOTPIXEL(x) pPixel[x] = nPalette + pTileData[x]; +#define CLIPPIXEL(a,b) if ((nTileXPos + a) >= 0 && (nTileXPos + a) < 280) { b; } + +static void TigerHeliRenderTileNoClip() +{ + UINT8 nPalette = nTilePalette << 4; + pTileData = TigerHeliTileROM + (nTileNumber << 6); + + UINT16* pPixel = pTile; + + for (INT32 y = 0; y < 8; y++, pPixel += 280, pTileData += 8) { + PLOTPIXEL(0); + PLOTPIXEL(1); + PLOTPIXEL(2); + PLOTPIXEL(3); + PLOTPIXEL(4); + PLOTPIXEL(5); + PLOTPIXEL(6); + PLOTPIXEL(7); + } +} + +static void TigerHeliRenderTileClip() +{ + UINT8 nPalette = nTilePalette << 4; + pTileData = TigerHeliTileROM + (nTileNumber << 6); + + UINT16* pPixel = pTile; + + for (INT32 y = 0; y < 8; y++, pPixel += 280, pTileData += 8) { + + if ((nTileYPos + y) >= 240) { + break; + } + if ((nTileYPos + y) < 0) { + continue; + } + + CLIPPIXEL(0, PLOTPIXEL(0)); + CLIPPIXEL(1, PLOTPIXEL(1)); + CLIPPIXEL(2, PLOTPIXEL(2)); + CLIPPIXEL(3, PLOTPIXEL(3)); + CLIPPIXEL(4, PLOTPIXEL(4)); + CLIPPIXEL(5, PLOTPIXEL(5)); + CLIPPIXEL(6, PLOTPIXEL(6)); + CLIPPIXEL(7, PLOTPIXEL(7)); + } +} + +#undef CLIPPIXEL +#undef PLOTPIXEL + +static void TigerHeliTileRender() +{ + UINT8* pTileRAM; + + if ((nBurnLayer & 3) == 0) { + BurnTransferClear(); + return; + } + + INT32 nTigerHeliTileXPos = nTigerHeliTileXPosLo + (nTigerHeliTileXPosHi << 8); + INT32 nTigerHeliTileYPos = nTigerHeliTileYPosLo; + + switch (nWhichGame) { + case 0: // Tiger Heli + nTigerHeliTileYPos -= 1; + break; + case 1: // Get Star + nTigerHeliTileYPos -= 1; + break; + case 2: // Slap Fight + nTigerHeliTileYPos += 1; + break; + } + + INT32 nXPos = -nTigerHeliTileXPos & 7; + nTileYPos = -nTigerHeliTileYPos & 7; + + if (nTigerHeliTileXPos & 7) { + nXPos -= 8; + } + if (nTigerHeliTileYPos & 7) { + nTileYPos -= 8; + } + + pTileRow = pTransDraw; + pTileRow -= (nTigerHeliTileXPos & 7); + pTileRow -= (nTigerHeliTileYPos & 7) * 280; + + for (INT32 y = 2; y < 33; y++, nTileYPos += 8, pTileRow += (280 << 3)) { + pTileRAM = TigerHeliTileRAM + (((y + (nTigerHeliTileYPos >> 3)) << 6) & 0x07C0); + pTile = pTileRow; + nTileXPos = nXPos; + for (INT32 x = 1; x < 37; x++, nTileXPos += 8, pTile += 8) { + INT32 x2 = (x + ((nTigerHeliTileXPos >> 3) & 0x3F)); + nTileNumber = pTileRAM[x2] | (pTileRAM[0x0800 + x2] << 8); + nTilePalette = nTileNumber >> 12; + nTileNumber &= nTigerHeliTileMask; + + if (nTileXPos < 0 || nTileXPos > 272 || nTileYPos < 0 || nTileYPos > 232) { + TigerHeliRenderTileClip(); + } else { + TigerHeliRenderTileNoClip(); + } + } + } + + return; +} + +// --------------------------------------------------------------------------- +// Sprites + +static INT32 nSpriteXPos, nSpriteYPos, nSpriteNumber, nSpritePalette; + +static INT32 nTigerHeliSpriteMask; + +#define PLOTPIXEL(a) if (pSpriteData[a]) { pPixel[a] = nPalette + pSpriteData[a]; } +#define CLIPPIXEL(a,b) if ((nSpriteXPos + a) >= 0 && (nSpriteXPos + a) < 280) { b; } + +static void TigerHeliRenderSpriteNoClip() +{ + UINT8 nPalette = nSpritePalette << 4; + UINT8* pSpriteData = TigerHeliSpriteROM + (nSpriteNumber << 8); + + UINT16* pPixel = pTransDraw + nSpriteXPos + nSpriteYPos * 280; + + for (INT32 y = 0; y < 16; y++, pPixel += 280, pSpriteData += 16) { + PLOTPIXEL( 0); + PLOTPIXEL( 1); + PLOTPIXEL( 2); + PLOTPIXEL( 3); + PLOTPIXEL( 4); + PLOTPIXEL( 5); + PLOTPIXEL( 6); + PLOTPIXEL( 7); + PLOTPIXEL( 8); + PLOTPIXEL( 9); + PLOTPIXEL(10); + PLOTPIXEL(11); + PLOTPIXEL(12); + PLOTPIXEL(13); + PLOTPIXEL(14); + PLOTPIXEL(15); + } +} + +static void TigerHeliRenderSpriteClip() +{ + UINT8 nPalette = nSpritePalette << 4; + UINT8* pSpriteData = TigerHeliSpriteROM + (nSpriteNumber << 8); + + UINT16* pPixel = pTransDraw + nSpriteXPos + nSpriteYPos * 280; + + for (INT32 y = 0; y < 16; y++, pPixel += 280, pSpriteData += 16) { + + if ((nSpriteYPos + y) < 0 || (nSpriteYPos + y) >= 240) { + continue; + } + + CLIPPIXEL( 0, PLOTPIXEL( 0)); + CLIPPIXEL( 1, PLOTPIXEL( 1)); + CLIPPIXEL( 2, PLOTPIXEL( 2)); + CLIPPIXEL( 3, PLOTPIXEL( 3)); + CLIPPIXEL( 4, PLOTPIXEL( 4)); + CLIPPIXEL( 5, PLOTPIXEL( 5)); + CLIPPIXEL( 6, PLOTPIXEL( 6)); + CLIPPIXEL( 7, PLOTPIXEL( 7)); + CLIPPIXEL( 8, PLOTPIXEL( 8)); + CLIPPIXEL( 9, PLOTPIXEL( 9)); + CLIPPIXEL(10, PLOTPIXEL(10)); + CLIPPIXEL(11, PLOTPIXEL(11)); + CLIPPIXEL(12, PLOTPIXEL(12)); + CLIPPIXEL(13, PLOTPIXEL(13)); + CLIPPIXEL(14, PLOTPIXEL(14)); + CLIPPIXEL(15, PLOTPIXEL(15)); + } +} + +#undef CLIPPIXEL +#undef PLOTPIXEL + +static void TigerHeliSpriteRender() +{ + UINT8* pSpriteRAM = TigerHeliSpriteBuf; + INT32 nSpriteYOffset = 0; + + if ((nBurnLayer & 1) == 0) { + return; + } + + switch (nWhichGame) { + case 0: // Tiger Heli + nSpriteYOffset = -16; + break; + case 1: // Get Star + nSpriteYOffset = -16; + break; + case 2: // Slap Fight + nSpriteYOffset = -17; + break; + } + + for (INT32 i = 0; i < 0x0800; i += 4) { + nSpriteNumber = pSpriteRAM[i + 0x00] | ((pSpriteRAM[i + 0x02] & 0xC0) << 2); + nSpriteNumber &= nTigerHeliSpriteMask; + nSpritePalette = (pSpriteRAM[i + 0x02] >> 1) & 0x0F; + nSpriteXPos = (pSpriteRAM[i + 0x01] | ((pSpriteRAM[i + 0x02] & 0x01) << 8)) - 21; + nSpriteYPos = pSpriteRAM[i + 0x03] + nSpriteYOffset; + + if (nSpriteXPos > -16 && nSpriteXPos < 280 && nSpriteYPos > -16 && nSpriteYPos < 240) { + if (nSpriteXPos >= 0 && nSpriteXPos <= 264 && nSpriteYPos >= 0 && nSpriteYPos <= 224) { + TigerHeliRenderSpriteNoClip(); + } else { + TigerHeliRenderSpriteClip(); + } + } + } + + return; +} + +static void TigerHeliBufferSprites() +{ + memcpy(TigerHeliSpriteBuf, TigerHeliSpriteRAM, 0x0800); +} + +// --------------------------------------------------------------------------- + + +static inline void sync_mcu() +{ + INT32 cycles = (ZetTotalCycles() / 2) - m6805TotalCycles(); + if (cycles > 0) { + // bprintf (0, _T("mcu %d\n"), cycles); + m6805Run(cycles); + } +} + +UINT8 __fastcall tigerhReadCPU0(UINT16 a) +{ + if (a >= 0xc800 && a <= 0xcfff) { + if (ZetPc(-1) == 0x6d34) return 0xff; + return RamShared[a - 0xc800]; + } + + switch (a) { + case 0xE803: { + if (use_mcu) { + sync_mcu(); + return standard_taito_mcu_read(); + } + + if (nWhichGame == 1) return getstar_e803_r(); + + UINT8 nProtectSequence[3] = { 0, 1, (0 + 5) ^ 0x56 }; + + //if (nProtectIndex == 3) { + // nProtectIndex = 0; + //} + +// bprintf(PRINT_NORMAL, "Protection read (%02X) PC: %04X.\n", nProtectSequence[nProtectIndex], ZetPc(-1)); + //return nProtectSequence[nProtectIndex++]; + + UINT8 val = nProtectSequence[nProtectIndex]; + nProtectIndex = (nProtectIndex + 1) % 3; + return val; + } + +// default: +// bprintf(PRINT_NORMAL, _T("Attempt by CPU0 to read address %04X.\n"), a); + } + + return 0; +} + +UINT8 __fastcall tigerhReadCPU0_tigerhb1(UINT16 a) +{ + if (a >= 0xc800 && a <= 0xcfff) { + if (ZetPc(-1) == 0x6d34) return 0xff; + return RamShared[a - 0xc800]; + } + + switch (a) { + case 0xE803: { + return 0x83; + } + } + + return 0; +} + + +void __fastcall tigerhWriteCPU0(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xE800: + nTigerHeliTileXPosLo = d; + break; + case 0xE801: + nTigerHeliTileXPosHi = d; + break; + case 0xE802: + nTigerHeliTileYPosLo = d; + break; + + case 0xe803: + if (use_mcu) { + sync_mcu(); + from_main = d; + main_sent = 1; + if (nWhichGame == 0) mcu_sent = 0; + m68705SetIrqLine(0, 1 /*ASSERT_LINE*/); + } + if (nWhichGame == 1) getstar_e803_w(); + break; + +// default: +// bprintf(PRINT_NORMAL, "Attempt by CPU0 to write address %04X -> %02X.\n", a, d); + } +} + +void __fastcall tigerhWriteCPU0_slapbtuk(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xE800: + nTigerHeliTileXPosHi = d; + break; + case 0xE802: + nTigerHeliTileYPosLo = d; + break; + case 0xE803: + nTigerHeliTileXPosLo = d; + break; +// default: +// bprintf(PRINT_NORMAL, "Attempt by CPU0 to write address %04X -> %02X.\n", a, d); + } +} + +UINT8 __fastcall tigerhInCPU0(UINT16 a) +{ + a &= 0xFF; + + switch (a) { + case 0x00: { + + UINT8 nStatusSequence[3] = { 0xC7, 0x55, 0x00 }; + + //if (nStatusIndex == 3) { + // nStatusIndex = 0; + //} + +// bprintf(PRINT_NORMAL, "Status read (%02X) PC: %04X.\n", nStatusSequence[nStatusIndex], ZetPc(-1)); + //return nStatusSequence[nStatusIndex++]; + + UINT8 nStatus = nStatusSequence[nStatusIndex]; + nStatusIndex++; + if (nStatusIndex > 2) nStatusIndex = 0; + + if (use_mcu) { + sync_mcu(); + nStatus &= 0xf9; + if (!main_sent) nStatus |= 0x02; + if (!mcu_sent) nStatus |= 0x04; + } + + return nStatus; + + } + +// default: +// bprintf(PRINT_NORMAL, "Attempt by CPU0 to read port %02X.\n", a); + } + + return 0; +} + +UINT8 __fastcall tigerhInCPU0_gtstarba(UINT16 a) +{ + a &= 0xFF; + + switch (a) { + case 0x00: { + if (ZetPc(-1) == 0x6d1e) return 0; + if (ZetPc(-1) == 0x6d24) return 6; + if (ZetPc(-1) == 0x6d2c) return 2; + if (ZetPc(-1) == 0x6d34) return 4; + return 0; + } + +// default: +// bprintf(PRINT_NORMAL, "Attempt by CPU0 to read port %02X.\n", a); + } + + return 0; +} + +void __fastcall tigerhOutCPU0(UINT16 a, UINT8 /* d */) +{ + a &= 0xFF; + + switch (a) { + case 0x00: // Assert reset line on sound CPU +// bprintf(PRINT_NORMAL, "Sound CPU disabled.\n"); + + if (bSoundCPUEnable) { + ZetClose(); + ZetOpen(1); + ZetReset(); + ZetClose(); + ZetOpen(0); + + bSoundCPUEnable = false; + } + + break; + case 0x01: // Release reset line on sound CPU +// bprintf(PRINT_NORMAL, "Sound CPU enabled.\n"); + + bSoundCPUEnable = true; + break; + +// case 0x03: +// break; + +// case 0x05: +// bprintf(PRINT_NORMAL, "Sound NMI triggered.\n"); +/* + if (bSoundNMIEnable) { + ZetClose(); + ZetOpen(1); + ZetNmi(); + ZetClose(); + ZetOpen(0); + } +*/ +// break; + + case 0x06: // Disable interrupts +// bprintf(PRINT_NORMAL, "Interrupts disabled.\n"); + + bInterruptEnable = false; + ZetLowerIrq(); + break; + case 0x07: // Enable interrupts +// bprintf(PRINT_NORMAL, "Interrupts enabled.\n"); + + bInterruptEnable = true; + break; + + case 0x08: +// bprintf(PRINT_NORMAL, "ROM bank 0 selected.\n"); + + // ROM bank 0 selected + ZetMapArea(0x8000, 0xBFFF, 0, Rom01 + 0x8000); + ZetMapArea(0x8000, 0xBFFF, 2, Rom01 + 0x8000); + break; + case 0x09: +// bprintf(PRINT_NORMAL, "ROM bank 1 selected.\n"); + + // ROM bank 1 selected + ZetMapArea(0x8000, 0xBFFF, 0, Rom01 + 0xC000); + ZetMapArea(0x8000, 0xBFFF, 2, Rom01 + 0xC000); + break; + +// default: +// bprintf(PRINT_NORMAL, "Attempt by CPU0 to write port %02X -> %02X.\n", a, d); + } +} + +UINT8 __fastcall tigerhReadCPU1(UINT16 a) +{ + switch (a) { + case 0xA081: +// bprintf(PRINT_NORMAL, "AY8910 0 read (%02X).\n", AY8910Read(0)); + return AY8910Read(0); + case 0xA091: +// bprintf(PRINT_NORMAL, "AY8910 1 read (%02X).\n", AY8910Read(1)); + return AY8910Read(1); + +// default: +// bprintf(PRINT_NORMAL, "Attempt by CPU1 to read address %04X.\n", a); + } + + return 0; +} + +void __fastcall tigerhWriteCPU1(UINT16 a, UINT8 d) +{ + switch (a) { + case 0xA080: +// bprintf(PRINT_NORMAL, "AY8910 0 Register select (%02X).\n", d); + AY8910Write(0, 0, d); + break; + case 0xA082: +// bprintf(PRINT_NORMAL, "AY8910 0 Register Write (%02X).\n", d); + AY8910Write(0, 1, d); + break; + case 0xA090: +// bprintf(PRINT_NORMAL, "AY8910 1 Register select (%02X).\n", d); + AY8910Write(1, 0, d); + break; + case 0xA092: +// bprintf(PRINT_NORMAL, "AY8910 1 Register Write (%02X).\n", d); + AY8910Write(1, 1, d); + break; + + case 0xA0E0: +// bprintf(PRINT_NORMAL, "Sound NMI enabled.\n"); + bSoundNMIEnable = true; + break; + +// default: +// bprintf(PRINT_NORMAL, "Attempt by CPU1 to write address %04X -> %02X.\n", a, d); + } +} + +UINT8 __fastcall tigerhInCPU1(UINT16 /* a */) +{ +// bprintf(PRINT_NORMAL, "Attempt by CPU1 to read port %02X.\n", a); + + return 0; +} + +void __fastcall tigerhOutCPU1(UINT16 /* a */, UINT8 /* d */) +{ +// bprintf(PRINT_NORMAL, _T("Attempt by CPU1 to write port %02X -> %02X.\n"), a, d); +} + +static UINT8 tigerhReadPort0(UINT32) +{ + return ~tigerhInput[0]; +} +static UINT8 tigerhReadPort1(UINT32) +{ + return ~tigerhInput[1]; +} +static UINT8 tigerhReadPort2(UINT32) +{ + return ~tigerhInput[2]; +} +static UINT8 tigerhReadPort3(UINT32) +{ + return ~tigerhInput[3]; +} + +//---------------------------------------------------------------------------- +// MCU Handling + +void tigerh_m68705_portA_write(UINT8 *data) +{ + from_mcu = *data; + mcu_sent = 1; +} + +void tigerh_m68705_portC_read() +{ + portC_in = 0; + if (!main_sent) portC_in |= 0x01; + if ( mcu_sent) portC_in |= 0x02; +} + +static m68705_interface tigerh_m68705_interface = { + tigerh_m68705_portA_write, standard_m68705_portB_out, NULL, + NULL, NULL, NULL, + NULL, NULL, tigerh_m68705_portC_read +}; + +void slapfigh_m68705_portA_write(UINT8 *data) +{ + from_mcu = *data; +} + +void slapfigh_m68705_portB_out(UINT8 *data) +{ + if ((ddrB & 0x02) && (~*data & 0x02) && (portB_out & 0x02)) + { + portA_in = from_main; + if (main_sent) + m68705SetIrqLine(0, 0 /*CLEAR_LINE*/); + main_sent = 0; + } + if ((ddrB & 0x04) && (*data & 0x04) && (~portB_out & 0x04)) + { + from_mcu = portA_out; + mcu_sent = 1; + } + + if ((ddrB & 0x08) && (~*data & 0x08) && (portB_out & 0x08)) + { + nTigerHeliTileXPosLo = portA_out; + } + if ((ddrB & 0x10) && (~*data & 0x10) && (portB_out & 0x10)) + { + nTigerHeliTileXPosHi = portA_out; + } +} + +void slapfigh_m68705_portC_read() +{ + portC_in = 0; + if (main_sent) portC_in |= 0x01; + if (!mcu_sent) portC_in |= 0x02; +} + +static m68705_interface slapfigh_m68705_interface = { + slapfigh_m68705_portA_write, slapfigh_m68705_portB_out, NULL, + NULL, NULL, NULL, + NULL, NULL, slapfigh_m68705_portC_read +}; + +//---------------------------------------------------------------------------- +// Get Star MCU Simulation + +#define GETSTAR 1 +#define GETSTARJ 2 +#define GETSTARB1 3 +#define GETSTARB2 4 + +static UINT8 GetStarType = 0; + +static UINT8 GSa = 0; +static UINT8 GSd = 0; +static UINT8 GSe = 0; +static UINT8 GSCommand = 0; + +#define GS_SAVE_REGS GSa = ZetBc(-1) >> 0; \ + GSd = ZetDe(-1) >> 8; \ + GSe = ZetDe(-1) >> 0; + +#define GS_RESET_REGS GSa = 0; \ + GSd = 0; \ + GSe = 0; + +static UINT8 getstar_e803_r() +{ + UINT16 tmp = 0; /* needed for values computed on 16 bits */ + UINT8 getstar_val = 0; + UINT8 phase_lookup_table[] = {0x00, 0x01, 0x03, 0xff, 0xff, 0x02, 0x05, 0xff, 0xff, 0x05}; /* table at 0x0e05 in 'gtstarb1' */ + UINT8 lives_lookup_table[] = {0x03, 0x05, 0x01, 0x02}; /* table at 0x0e62 in 'gtstarb1' */ + UINT8 lgsb2_lookup_table[] = {0x00, 0x03, 0x04, 0x05}; /* fake tanle for "test mode" in 'gtstarb2' */ + + switch (GetStarType) { + case GETSTAR: + case GETSTARJ: { + switch (GSCommand) { + case 0x20: /* continue play */ + getstar_val = ((GSa & 0x30) == 0x30) ? 0x20 : 0x80; + break; + case 0x21: /* lose life */ + getstar_val = (GSa << 1) | (GSa >> 7); + break; + case 0x22: /* starting difficulty */ + getstar_val = ((GSa & 0x0c) >> 2) + 1; + break; + case 0x23: /* starting lives */ + getstar_val = lives_lookup_table[GSa]; + break; + case 0x24: /* game phase */ + getstar_val = phase_lookup_table[((GSa & 0x18) >> 1) | (GSa & 0x03)]; + break; + case 0x25: /* players inputs */ + getstar_val = BITSWAP08(GSa, 3, 2, 1, 0, 7, 5, 6, 4); + break; + case 0x26: /* background (1st read) */ + tmp = 0x8800 + (0x001f * GSa); + getstar_val = (tmp & 0x00ff) >> 0; + GSCommand |= 0x80; /* to allow a second consecutive read */ + break; + case 0xa6: /* background (2nd read) */ + tmp = 0x8800 + (0x001f * GSa); + getstar_val = (tmp & 0xff00) >> 8; + break; + case 0x29: /* unknown effect */ + getstar_val = 0x00; + break; + case 0x2a: /* change player (if 2 players game) */ + getstar_val = (GSa ^ 0x40); + break; + case 0x37: /* foreground (1st read) */ + tmp = ((0xd0 + ((GSe >> 2) & 0x0f)) << 8) | (0x40 * (GSe & 03) + GSd); + getstar_val = (tmp & 0x00ff) >> 0; + GSCommand |= 0x80; /* to allow a second consecutive read */ + break; + case 0xb7: /* foreground (2nd read) */ + tmp = ((0xd0 + ((GSe >> 2) & 0x0f)) << 8) | (0x40 * (GSe & 03) + GSd); + getstar_val = (tmp & 0xff00) >> 8; + break; + case 0x38: /* laser position (1st read) */ + tmp = 0xf740 - (((GSe >> 4) << 8) | ((GSe & 0x08) ? 0x80 : 0x00)) + (0x02 + (GSd >> 2)); + getstar_val = (tmp & 0x00ff) >> 0; + GSCommand |= 0x80; /* to allow a second consecutive read */ + break; + case 0xb8: /* laser position (2nd read) */ + tmp = 0xf740 - (((GSe >> 4) << 8) | ((GSe & 0x08) ? 0x80 : 0x00)) + (0x02 + (GSd >> 2)); + getstar_val = (tmp & 0xff00) >> 8; + break; + case 0x73: /* avoid "BAD HW" message */ + getstar_val = 0x76; + break; + } + } + + case GETSTARB1: { + /* value isn't computed by the bootleg but we want to please the "test mode" */ + if (ZetPc(-1) == 0x6b04) return (lives_lookup_table[GSa]); + break; + } + + case GETSTARB2: { + /* + 056B: 21 03 E8 ld hl,$E803 + 056E: 7E ld a,(hl) + 056F: BE cp (hl) + 0570: 28 FD jr z,$056F + 0572: C6 05 add a,$05 + 0574: EE 56 xor $56 + 0576: BE cp (hl) + 0577: C2 6E 05 jp nz,$056E + */ + if (ZetPc(-1) == 0x056e) return (getstar_val); + if (ZetPc(-1) == 0x0570) return (getstar_val+1); + if (ZetPc(-1) == 0x0577) return ((getstar_val+0x05) ^ 0x56); + /* value isn't computed by the bootleg but we want to please the "test mode" */ + if (ZetPc(-1) == 0x6b04) return (lgsb2_lookup_table[GSa]); + break; + } + } + + return getstar_val; +} + +static void getstar_e803_w() +{ + switch (GetStarType) { + case GETSTAR: { + /* unknown effect - not read back */ + if (ZetPc(-1) == 0x00bf) + { + GSCommand = 0x00; + GS_RESET_REGS + } + /* players inputs */ + if (ZetPc(-1) == 0x0560) + { + GSCommand = 0x25; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x056d) + { + GSCommand = 0x25; + GS_SAVE_REGS + } + /* lose life */ + if (ZetPc(-1) == 0x0a0a) + { + GSCommand = 0x21; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0a17) + { + GSCommand = 0x21; + GS_SAVE_REGS + } + /* unknown effect */ + if (ZetPc(-1) == 0x0a51) + { + GSCommand = 0x29; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0a6e) + { + GSCommand = 0x29; + GS_SAVE_REGS + } + /* continue play */ + if (ZetPc(-1) == 0x0ae3) + { + GSCommand = 0x20; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0af0) + { + GSCommand = 0x20; + GS_SAVE_REGS + } + /* unknown effect - not read back */ + if (ZetPc(-1) == 0x0b62) + { + GSCommand = 0x00; /* 0x1f */ + GS_RESET_REGS + } + /* change player (if 2 players game) */ + if (ZetPc(-1) == 0x0bab) + { + GSCommand = 0x2a; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0bb8) + { + GSCommand = 0x2a; + GS_SAVE_REGS + } + /* game phase */ + if (ZetPc(-1) == 0x0d37) + { + GSCommand = 0x24; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0d44) + { + GSCommand = 0x24; + GS_SAVE_REGS + } + /* starting lives */ + if (ZetPc(-1) == 0x0d79) + { + GSCommand = 0x23; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0d8a) + { + GSCommand = 0x23; + GS_SAVE_REGS + } + /* starting difficulty */ + if (ZetPc(-1) == 0x0dc1) + { + GSCommand = 0x22; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0dd0) + { + GSCommand = 0x22; + GS_SAVE_REGS + } + /* starting lives (again) */ + if (ZetPc(-1) == 0x1011) + { + GSCommand = 0x23; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x101e) + { + GSCommand = 0x23; + GS_SAVE_REGS + } + /* hardware test */ + if (ZetPc(-1) == 0x107a) + { + GSCommand = 0x73; + GS_RESET_REGS + } + /* game phase (again) */ + if (ZetPc(-1) == 0x10c6) + { + GSCommand = 0x24; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x10d3) + { + GSCommand = 0x24; + GS_SAVE_REGS + } + /* background */ + if (ZetPc(-1) == 0x1910) + { + GSCommand = 0x26; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x191d) + { + GSCommand = 0x26; + GS_SAVE_REGS + } + /* foreground */ + if (ZetPc(-1) == 0x19d5) + { + GSCommand = 0x37; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x19e4) + { + GSCommand = 0x37; + GS_SAVE_REGS + } + if (ZetPc(-1) == 0x19f1) + { + GSCommand = 0x37; + /* do NOT update the registers because there are 2 writes before 2 reads ! */ + } + /* laser position */ + if (ZetPc(-1) == 0x26af) + { + GSCommand = 0x38; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x26be) + { + GSCommand = 0x38; + GS_SAVE_REGS + } + if (ZetPc(-1) == 0x26cb) + { + GSCommand = 0x38; + /* do NOT update the registers because there are 2 writes before 2 reads ! */ + } + /* starting lives (for "test mode") */ + if (ZetPc(-1) == 0x6a27) + { + GSCommand = 0x23; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x6a38) + { + GSCommand = 0x23; + GS_SAVE_REGS + } + break; + } + + case GETSTARJ: { + /* unknown effect - not read back */ + if (ZetPc(-1) == 0x00bf) + { + GSCommand = 0x00; + GS_RESET_REGS + } + /* players inputs */ + if (ZetPc(-1) == 0x0560) + { + GSCommand = 0x25; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x056d) + { + GSCommand = 0x25; + GS_SAVE_REGS + } + /* lose life */ + if (ZetPc(-1) == 0x0ad5) + { + GSCommand = 0x21; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0ae2) + { + GSCommand = 0x21; + GS_SAVE_REGS + } + /* unknown effect */ + if (ZetPc(-1) == 0x0b1c) + { + GSCommand = 0x29; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0b29) + { + GSCommand = 0x29; + GS_SAVE_REGS + } + /* continue play */ + if (ZetPc(-1) == 0x0bae) + { + GSCommand = 0x20; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0bbb) + { + GSCommand = 0x20; + GS_SAVE_REGS + } + /* unknown effect - not read back */ + if (ZetPc(-1) == 0x0c2d) + { + GSCommand = 0x00; /* 0x1f */ + GS_RESET_REGS + } + /* change player (if 2 players game) */ + if (ZetPc(-1) == 0x0c76) + { + GSCommand = 0x2a; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0c83) + { + GSCommand = 0x2a; + GS_SAVE_REGS + } + /* game phase */ + if (ZetPc(-1) == 0x0e02) + { + GSCommand = 0x24; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0e0f) + { + GSCommand = 0x24; + GS_SAVE_REGS + } + /* starting lives */ + if (ZetPc(-1) == 0x0e44) + { + GSCommand = 0x23; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0e55) + { + GSCommand = 0x23; + GS_SAVE_REGS + } + /* starting difficulty */ + if (ZetPc(-1) == 0x0e8c) + { + GSCommand = 0x22; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x0e9b) + { + GSCommand = 0x22; + GS_SAVE_REGS + } + /* starting lives (again) */ + if (ZetPc(-1) == 0x10d6) + { + GSCommand = 0x23; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x10e3) + { + GSCommand = 0x23; + GS_SAVE_REGS + } + /* hardware test */ + if (ZetPc(-1) == 0x113f) + { + GSCommand = 0x73; + GS_RESET_REGS + } + /* game phase (again) */ + if (ZetPc(-1) == 0x118b) + { + GSCommand = 0x24; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x1198) + { + GSCommand = 0x24; + GS_SAVE_REGS + } + /* background */ + if (ZetPc(-1) == 0x19f8) + { + GSCommand = 0x26; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x1a05) + { + GSCommand = 0x26; + GS_SAVE_REGS + } + /* foreground */ + if (ZetPc(-1) == 0x1abd) + { + GSCommand = 0x37; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x1acc) + { + GSCommand = 0x37; + GS_SAVE_REGS + } + if (ZetPc(-1) == 0x1ad9) + { + GSCommand = 0x37; + /* do NOT update the registers because there are 2 writes before 2 reads ! */ + } + /* laser position */ + if (ZetPc(-1) == 0x2792) + { + GSCommand = 0x38; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x27a1) + { + GSCommand = 0x38; + GS_SAVE_REGS + } + if (ZetPc(-1) == 0x27ae) + { + GSCommand = 0x38; + /* do NOT update the registers because there are 2 writes before 2 reads ! */ + } + /* starting lives (for "test mode") */ + if (ZetPc(-1) == 0x6ae2) + { + GSCommand = 0x23; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x6af3) + { + GSCommand = 0x23; + GS_SAVE_REGS + } + break; + } + + case GETSTARB1: { + /* "Test mode" doesn't compute the lives value : + 6ADA: 3E 23 ld a,$23 + 6ADC: CD 52 11 call $1152 + 6ADF: 32 03 E8 ld ($E803),a + 6AE2: DB 00 in a,($00) + 6AE4: CB 4F bit 1,a + 6AE6: 28 FA jr z,$6AE2 + 6AE8: 3A 0A C8 ld a,($C80A) + 6AEB: E6 03 and $03 + 6AED: CD 52 11 call $1152 + 6AF0: 32 03 E8 ld ($E803),a + 6AF3: DB 00 in a,($00) + 6AF5: CB 57 bit 2,a + 6AF7: 20 FA jr nz,$6AF3 + 6AF9: 00 nop + 6AFA: 00 nop + 6AFB: 00 nop + 6AFC: 00 nop + 6AFD: 00 nop + 6AFE: 00 nop + 6AFF: 00 nop + 6B00: 00 nop + 6B01: 3A 03 E8 ld a,($E803) + We save the regs though to hack it in 'getstar_e803_r' read handler. + */ + if (ZetPc(-1) == 0x6ae2) + { + GSCommand = 0x00; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x6af3) + { + GSCommand = 0x00; + GS_SAVE_REGS + } + break; + } + + case GETSTARB2: { + /* "Test mode" doesn't compute the lives value : + 6ADA: 3E 23 ld a,$23 + 6ADC: CD 52 11 call $1152 + 6ADF: 32 03 E8 ld ($E803),a + 6AE2: DB 00 in a,($00) + 6AE4: CB 4F bit 1,a + 6AE6: 00 nop + 6AE7: 00 nop + 6AE8: 3A 0A C8 ld a,($C80A) + 6AEB: E6 03 and $03 + 6AED: CD 52 11 call $1152 + 6AF0: 32 03 E8 ld ($E803),a + 6AF3: DB 00 in a,($00) + 6AF5: CB 57 bit 2,a + 6AF7: 00 nop + 6AF8: 00 nop + 6AF9: 00 nop + 6AFA: 00 nop + 6AFB: 00 nop + 6AFC: 00 nop + 6AFD: 00 nop + 6AFE: 00 nop + 6AFF: 00 nop + 6B00: 00 nop + 6B01: 3A 03 E8 ld a,($E803) + We save the regs though to hack it in 'getstar_e803_r' read handler. + */ + if (ZetPc(-1) == 0x6ae2) + { + GSCommand = 0x00; + GS_RESET_REGS + } + if (ZetPc(-1) == 0x6af3) + { + GSCommand = 0x00; + GS_SAVE_REGS + } + break; + } + } +} + +// --------------------------------------------------------------------------- + +static INT32 tigerhLoadROMs() +{ + INT32 nRomOffset = 0; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb2")) nRomOffset = 1; + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb3")) nRomOffset = 2; + + // Z80 main program + switch (nWhichGame) { + case 0: // Tiger Heli + if (BurnLoadRom(Rom01 + 0x0000, 0, 1)) { + return 1; + } + if (BurnLoadRom(Rom01 + 0x4000, 1, 1)) { + return 1; + } + if (BurnLoadRom(Rom01 + 0x8000, 2, 1)) { + return 1; + } + break; + case 1: // Get Star + if (BurnLoadRom(Rom01 + 0x0000, 0, 1)) { + return 1; + } + if (BurnLoadRom(Rom01 + 0x4000, 1, 1)) { + return 1; + } + if (BurnLoadRom(Rom01 + 0x8000, 2, 1)) { + return 1; + } + break; + case 2: { // Slap Fight + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb2")) { + if (BurnLoadRom(Rom01 + 0x0000, 0, 1)) { + return 1; + } + if (BurnLoadRom(Rom01 + 0x4000, 1, 1)) { + return 1; + } + if (BurnLoadRom(Rom01 + 0x8000, 2, 1)) { + return 1; + } + break; + } else { + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb3")) { + if (BurnLoadRom(Rom01 + 0x0000, 0, 1)) { + return 1; + } + if (BurnLoadRom(Rom01 + 0x4000, 1, 1)) { + return 1; + } + if (BurnLoadRom(Rom01 + 0x10000, 2, 1)) { + return 1; + } + if (BurnLoadRom(Rom01 + 0x8000, 3, 1)) { + return 1; + } + break; + } else { + if (BurnLoadRom(Rom01 + 0x0000, 0, 1)) { + return 1; + } + if (BurnLoadRom(Rom01 + 0x8000, 1, 1)) { + return 1; + } + break; + } + } + } + } + + // Sprites + { + INT32 nRet = 0, nBaseROM = 0; + switch (nWhichGame) { + case 0: // Tiger Heli + nBaseROM = 3; + break; + case 1: // Get Star + nBaseROM = 3; + break; + case 2: // Slap Fight + nBaseROM = 2 + nRomOffset; + break; + } + + INT32 nSize; + + { + struct BurnRomInfo ri; + + ri.nType = 0; + ri.nLen = 0; + + BurnDrvGetRomInfo(&ri, nBaseROM); + + nSize = ri.nLen; + } + + UINT8* pTemp = (UINT8*)BurnMalloc(nSize * 4); + + for (INT32 i = 0; i < 4; i++) { + nRet |= BurnLoadRom(pTemp + nSize * i, nBaseROM + i, 1); + } + + for (INT32 i = 0; i < nSize; i++) { + for (INT32 j = 0; j < 8; j++) { + TigerHeliSpriteROM[(i << 3) + j] = ((pTemp[i + nSize * 0] >> (7 - j)) & 1) << 3; + TigerHeliSpriteROM[(i << 3) + j] |= ((pTemp[i + nSize * 1] >> (7 - j)) & 1) << 2; + TigerHeliSpriteROM[(i << 3) + j] |= ((pTemp[i + nSize * 2] >> (7 - j)) & 1) << 1; + TigerHeliSpriteROM[(i << 3) + j] |= ((pTemp[i + nSize * 3] >> (7 - j)) & 1) << 0; + } + } + + BurnFree(pTemp); + + nTigerHeliSpriteMask = (nSize >> 5) - 1; + + if (nRet) { + return 1; + } + } + + // Text layer + { + INT32 nBaseROM = 0; + switch (nWhichGame) { + case 0: // Tiger Heli + nBaseROM = 7; + break; + case 1: // Get Star + nBaseROM = 7; + break; + case 2: // Slap Fight + nBaseROM = 6 + nRomOffset; + break; + } + + UINT8* pTemp = (UINT8*)BurnMalloc(0x4000); + + if (BurnLoadRom(pTemp + 0x0000, nBaseROM + 0, 1)) { + return 1; + } + if (BurnLoadRom(pTemp + 0x2000, nBaseROM + 1, 1)) { + return 1; + } + + for (INT32 i = 0; i < 0x02000; i++) { + for (INT32 j = 0; j < 8; j++) { + TigerHeliTextROM[(i << 3) + j] = ((pTemp[i + 0x0000] >> (7 - j)) & 1) << 1; + TigerHeliTextROM[(i << 3) + j] |= ((pTemp[i + 0x2000] >> (7 - j)) & 1) << 0; + } + } + + BurnFree(pTemp); + } + + // Tile layer + { + INT32 nRet = 0, nBaseROM = 0; + switch (nWhichGame) { + case 0: // Tiger Heli + nBaseROM = 9; + break; + case 1: // Get Star + nBaseROM = 9; + break; + case 2: // Slap Fight + nBaseROM = 8 + nRomOffset; + break; + } + + INT32 nSize; + + { + struct BurnRomInfo ri; + + ri.nType = 0; + ri.nLen = 0; + + BurnDrvGetRomInfo(&ri, nBaseROM); + + nSize = ri.nLen; + } + + UINT8* pTemp = (UINT8*)BurnMalloc(nSize * 4); + + for (INT32 i = 0; i < 4; i++) { + nRet |= BurnLoadRom(pTemp + nSize * i, nBaseROM + i, 1); + } + + for (INT32 i = 0; i < nSize; i++) { + for (INT32 j = 0; j < 8; j++) { + TigerHeliTileROM[(i << 3) + j] = ((pTemp[i + nSize * 0] >> (7 - j)) & 1) << 3; + TigerHeliTileROM[(i << 3) + j] |= ((pTemp[i + nSize * 1] >> (7 - j)) & 1) << 2; + TigerHeliTileROM[(i << 3) + j] |= ((pTemp[i + nSize * 2] >> (7 - j)) & 1) << 1; + TigerHeliTileROM[(i << 3) + j] |= ((pTemp[i + nSize * 3] >> (7 - j)) & 1) << 0; + } + } + + BurnFree(pTemp); + + nTigerHeliTileMask = (nSize >> 3) - 1; + + if (nRet) { + return 1; + } + } + + // Colour PROMs + { + INT32 nBaseROM = 0; + switch (nWhichGame) { + case 0: // Tiger Heli + nBaseROM = 13; + break; + case 1: // Get Star + nBaseROM = 13; + break; + case 2: // Slap Fight + nBaseROM = 12 + nRomOffset; + break; + } + + if (BurnLoadRom(TigerHeliPaletteROM + 0x0000, nBaseROM + 0, 1)) { + return 1; + } + if (BurnLoadRom(TigerHeliPaletteROM + 0x0100, nBaseROM + 1, 1)) { + return 1; + } + if (BurnLoadRom(TigerHeliPaletteROM + 0x0200, nBaseROM + 2, 1)) { + return 1; + } + } + + // Z80 program + { + INT32 nBaseROM = 0; + switch (nWhichGame) { + case 0: // Tiger Heli + nBaseROM = 16; + break; + case 1: // Get Star + nBaseROM = 16; + break; + case 2: // Slap Fight + nBaseROM = 15 + nRomOffset; + break; + } + + if (BurnLoadRom(Rom02, nBaseROM, 1)) { + return 1; + } + } + + // MCU program + { + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "tigerh") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhj") == 0) { + if (BurnLoadRom(Rom03, 17, 1)) { + return 1; + } + + use_mcu = 1; + } + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "alcon") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "slapfigh") == 0) { + if (BurnLoadRom(Rom03, 16, 1)) { + return 1; + } + + use_mcu = 1; + } + + } + + return 0; +} + +static INT32 tigerhExit() +{ + BurnTransferExit(); + + TigerHeliTextExit(); + + ZetExit(); + AY8910Exit(0); + AY8910Exit(1); + + if (use_mcu) { + use_mcu = 0; + m67805_taito_exit(); + } + + // Deallocate all used memory + BurnFree(Mem); + + GetStarType = 0; + + return 0; +} + +static void tigerhDoReset() +{ + bInterruptEnable = false; + bSoundNMIEnable = false; + bSoundCPUEnable = true; + + nStatusIndex = 0; + nProtectIndex = 0; + + ZetOpen(0); + ZetReset(); + ZetClose(); + + ZetOpen(1); + ZetReset(); + ZetClose(); + + if (use_mcu) { + m67805_taito_reset(); + } + + return; +} + +static INT32 tigerhInit() +{ + INT32 nLen; + + nWhichGame = -1; + + if (strcmp(BurnDrvGetTextA(DRV_NAME), "tigerh") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhj") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhb1") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhb2") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhb3") == 0) { + nWhichGame = 0; + } + if (strcmp(BurnDrvGetTextA(DRV_NAME), "getstar") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "getstarj") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb1") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb2") == 0) { + nWhichGame = 1; + if (strcmp(BurnDrvGetTextA(DRV_NAME), "getstar") == 0) GetStarType = GETSTAR; + if (strcmp(BurnDrvGetTextA(DRV_NAME), "getstarj") == 0) GetStarType = GETSTARJ; + if (strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb1") == 0) GetStarType = GETSTARB1; + if (strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb2") == 0) GetStarType = GETSTARB2; + } + if (strcmp(BurnDrvGetTextA(DRV_NAME), "alcon") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "slapfigh") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb1") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb2") == 0 || strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb3") == 0) { + nWhichGame = 2; + } + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8*)0; + if ((Mem = (UINT8*)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (tigerhLoadROMs()) { + return 1; + } + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb1")) Rom01[0x6d56] = 0xc3; + + { + ZetInit(0); + + // Main CPU setup + ZetOpen(0); + + // Program ROM + ZetMapArea(0x0000, 0x7FFF, 0, Rom01); + ZetMapArea(0x0000, 0x7FFF, 2, Rom01); + // Banked ROM + ZetMapArea(0x8000, 0xBFFF, 0, Rom01 + 0x8000); + ZetMapArea(0x8000, 0xBFFF, 2, Rom01 + 0x8000); + + // Work RAM + ZetMapArea(0xC000, 0xC7FF, 0, Ram01); + ZetMapArea(0xC000, 0xC7FF, 1, Ram01); + ZetMapArea(0xC000, 0xC7FF, 2, Ram01); + + // Shared RAM + if (strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb1")) { + ZetMapArea(0xC800, 0xCFFF, 0, RamShared); + } + ZetMapArea(0xC800, 0xCFFF, 1, RamShared); + ZetMapArea(0xC800, 0xCFFF, 2, RamShared); + + // Tile RAM + ZetMapArea(0xD000, 0xDFFF, 0, TigerHeliTileRAM); + ZetMapArea(0xD000, 0xDFFF, 1, TigerHeliTileRAM); + ZetMapArea(0xD000, 0xDFFF, 2, TigerHeliTileRAM); + // Sprite RAM + ZetMapArea(0xE000, 0xE7FF, 0, TigerHeliSpriteRAM); + ZetMapArea(0xE000, 0xE7FF, 1, TigerHeliSpriteRAM); + ZetMapArea(0xE000, 0xE7FF, 2, TigerHeliSpriteRAM); + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb2") || !strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb3")) { + ZetMapArea(0xec00, 0xeFFF, 0, Rom01 + 0x10c00); + ZetMapArea(0xec00, 0xeFFF, 2, Rom01 + 0x10c00); + } + + // Text RAM + ZetMapArea(0xF000, 0xFFFF, 0, TigerHeliTextRAM); + ZetMapArea(0xF000, 0xFFFF, 1, TigerHeliTextRAM); + ZetMapArea(0xF000, 0xFFFF, 2, TigerHeliTextRAM); + + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "tigerhb1")) { + ZetSetReadHandler(tigerhReadCPU0_tigerhb1); + } else { + ZetSetReadHandler(tigerhReadCPU0); + } + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb2") || !strcmp(BurnDrvGetTextA(DRV_NAME), "slapfighb3")) { + ZetSetWriteHandler(tigerhWriteCPU0_slapbtuk); + } else { + ZetSetWriteHandler(tigerhWriteCPU0); + } + + if (!strcmp(BurnDrvGetTextA(DRV_NAME), "gtstarb1")) { + ZetSetInHandler(tigerhInCPU0_gtstarba); + } else { + ZetSetInHandler(tigerhInCPU0); + } + + ZetSetOutHandler(tigerhOutCPU0); + + ZetClose(); + + ZetInit(1); + + // Sound CPU setup + ZetOpen(1); + + // Program ROM + ZetMapArea(0x0000, 0x1FFF, 0, Rom02); + ZetMapArea(0x0000, 0x1FFF, 2, Rom02); + + // Work RAM + ZetMapArea(0xC800, 0xCFFF, 0, RamShared); + ZetMapArea(0xC800, 0xCFFF, 1, RamShared); + ZetMapArea(0xC800, 0xCFFF, 2, RamShared); + + + ZetSetReadHandler(tigerhReadCPU1); + ZetSetWriteHandler(tigerhWriteCPU1); + ZetSetInHandler(tigerhInCPU1); + ZetSetOutHandler(tigerhOutCPU1); + + ZetClose(); + + if (use_mcu) { + if (nWhichGame == 0) m67805_taito_init(Rom03, Ram03, &tigerh_m68705_interface); + if (nWhichGame == 2) m67805_taito_init(Rom03, Ram03, &slapfigh_m68705_interface); + } + } + + pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0; + pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1; + pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2; + pAY8910Buffer[3] = pFMBuffer + nBurnSoundLen * 3; + pAY8910Buffer[4] = pFMBuffer + nBurnSoundLen * 4; + pAY8910Buffer[5] = pFMBuffer + nBurnSoundLen * 5; + + AY8910Init(0, 1500000, nBurnSoundRate, &tigerhReadPort0, &tigerhReadPort1, NULL, NULL); + AY8910Init(1, 1500000, nBurnSoundRate, &tigerhReadPort2, &tigerhReadPort3, NULL, NULL); + AY8910SetAllRoutes(0, 0.25, BURN_SND_ROUTE_BOTH); + AY8910SetAllRoutes(1, 0.25, BURN_SND_ROUTE_BOTH); + + TigerHeliTextInit(); + TigerHeliPaletteInit(); + + BurnTransferInit(); + + tigerhDoReset(); + + return 0; +} + +static INT32 tigerhScan(INT32 nAction, INT32* pnMin) +{ + struct BurnArea ba; + + if (pnMin) { // Return minimum compatible version + *pnMin = 0x029521; + } + + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd-RamStart; + ba.szName = "All Ram"; + BurnAcb(&ba); + + ZetScan(nAction); // Scan Z80 + + // Scan critical driver variables + SCAN_VAR(bInterruptEnable); + SCAN_VAR(bSoundCPUEnable); + SCAN_VAR(bSoundNMIEnable); + SCAN_VAR(nStatusIndex); + SCAN_VAR(nProtectIndex); + SCAN_VAR(tigerhInput); + } + + return 0; +} + +static void tigerhDraw() +{ + TigerHeliPaletteUpdate(); + + TigerHeliTileRender(); + TigerHeliSpriteRender(); + TigerHeliTextRender(); + + BurnTransferCopy(TigerHeliPalette); + + return; +} + +static inline INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 tigerhFrame() +{ + INT32 nCyclesTotal[3], nCyclesDone[3]; + + if (tigerhReset) { // Reset machine + tigerhDoReset(); + } + + ZetNewFrame(); + if (use_mcu) m6805NewFrame(); + + // Compile digital inputs + tigerhInput[0] = 0x00; + tigerhInput[1] = 0x00; + for (INT32 i = 0; i < 8; i++) { + tigerhInput[0] |= (tigerhInpJoy1[i] & 1) << i; + if (nWhichGame == 0 && i < 4) { + tigerhInput[1] |= (tigerhInpMisc[i] & 1) << (i ^ 1); + } else { + tigerhInput[1] |= (tigerhInpMisc[i] & 1) << i; + } + } + + if ((tigerhInput[0] & 0x03) == 0x03) { + tigerhInput[0] &= ~0x03; + } + if ((tigerhInput[0] & 0x0C) == 0x0C) { + tigerhInput[0] &= ~0x0C; + } + if ((tigerhInput[0] & 0x30) == 0x30) { + tigerhInput[0] &= ~0x30; + } + if ((tigerhInput[0] & 0xC0) == 0xC0) { + tigerhInput[0] &= ~0xC0; + } + + if (nWhichGame == 1) { + tigerhInput[0] = (tigerhInput[0] & 0x99) | ((tigerhInput[0] << 1) & 0x44) | ((tigerhInput[0] >> 1) & 0x22); + } + + nCyclesTotal[0] = nCyclesTotal[1] = 6000000 / 60; + nCyclesDone[0] = nCyclesDone[1] = nCyclesDone[2] = 0; + nCyclesTotal[2] = 3000000 / 60; + + const INT32 nVBlankCycles = 248 * 6000000 / 60 / 262; + const INT32 nInterleave = 12; + + INT32 nSoundBufferPos = 0; + INT32 nSoundNMIMask = 0; + switch (nWhichGame) { + case 0: + nSoundNMIMask = 1; + break; + case 1: + nSoundNMIMask = 3; + break; + case 2: + nSoundNMIMask = 3; + break; + } + + bool bVBlank = false; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nCurrentCPU; + INT32 nNext, nCyclesSegment; + + nCurrentCPU = 0; + ZetOpen(nCurrentCPU); + + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + + if (nNext > nVBlankCycles && !bVBlank) { + nCyclesDone[nCurrentCPU] += ZetRun(nNext - nVBlankCycles); + + if (pBurnDraw != NULL) { + tigerhDraw(); // Draw screen if needed + } + + TigerHeliBufferSprites(); + + bVBlank = true; + + if (bInterruptEnable) { + ZetRaiseIrq(0xFF); +#if 0 + ZetClose(); + ZetOpen(1); + ZetRaiseIrq(0xFF); + ZetClose(); + ZetOpen(0); +#endif + } + } + + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + if (bVBlank || (!CheckSleep(nCurrentCPU))) { // See if this CPU is busywaiting + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + } else { + nCyclesDone[nCurrentCPU] += nCyclesSegment; + } + + ZetClose(); + + if (use_mcu) { + m6805Open(0); + nCyclesSegment = (nCyclesTotal[2] * (i + 1)) / nInterleave; + nCyclesSegment -= m6805TotalCycles(); + if (nCyclesSegment > 0) { + nCyclesDone[2] += m6805Run(nCyclesSegment); + } + m6805Close(); + } + + nCurrentCPU = 1; + nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave; + nCyclesSegment = nNext - nCyclesDone[nCurrentCPU]; + + if (bSoundCPUEnable) { + ZetOpen(nCurrentCPU); + + if ((i & nSoundNMIMask) == 0) { + if (bSoundNMIEnable) { + ZetNmi(); + } + } + + nCyclesDone[nCurrentCPU] += ZetRun(nCyclesSegment); + ZetClose(); + } else { + nCyclesDone[nCurrentCPU] += nCyclesSegment; + } + + { + // Render sound segment + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen / nInterleave; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + nSoundBufferPos += nSegmentLength; + } + } + } + + { + // Make sure the buffer is entirely filled. + if (pBurnSoundOut) { + INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; + INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); + if (nSegmentLength) { + AY8910Render(&pAY8910Buffer[0], pSoundBuf, nSegmentLength, 0); + } + } + } + + return 0; +} + +// --------------------------------------------------------------------------- +// Rom information + +static struct BurnRomInfo tigerhRomDesc[] = { + { "0.4", 0x004000, 0x4BE73246, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "1.4", 0x004000, 0xAAD04867, BRF_ESS | BRF_PRG }, // 1 + { "2.4", 0x004000, 0x4843F15C, BRF_ESS | BRF_PRG }, // 2 + + { "a47_13.8j", 0x004000, 0x739A7E7E, BRF_GRA }, // 3 Sprite data + { "a47_12.6j", 0x004000, 0xC064ECDB, BRF_GRA }, // 4 + { "a47_11.8h", 0x004000, 0x744FAE9B, BRF_GRA }, // 5 + { "a47_10.6h", 0x004000, 0xE1CF844E, BRF_GRA }, // 6 + + { "a47_05.6f", 0x002000, 0xC5325B49, BRF_GRA }, // 7 Text layer + { "a47_04.6g", 0x002000, 0xCD59628E, BRF_GRA }, // 8 + + { "a47_09.4m", 0x004000, 0x31FAE8A8, BRF_GRA }, // 9 Background layer + { "a47_08.6m", 0x004000, 0xE539AF2B, BRF_GRA }, // 10 + { "a47_07.6n", 0x004000, 0x02FDD429, BRF_GRA }, // 11 + { "a47_06.6p", 0x004000, 0x11FBCC8C, BRF_GRA }, // 12 + + { "82s129.12q", 0x000100, 0x2C69350D, BRF_GRA }, // 13 + { "82s129.12m", 0x000100, 0x7142E972, BRF_GRA }, // 14 + { "82s129.12n", 0x000100, 0x25F273F2, BRF_GRA }, // 15 + + { "a47_03.12d", 0x002000, 0xD105260F, BRF_ESS | BRF_PRG }, // 16 + + { "a47_14.6a", 0x000800, 0x4042489F, BRF_ESS | BRF_PRG }, // 17 MCU + + { "pal16r4a.2e", 260, 0x00000000, BRF_NODUMP }, +}; + + +STD_ROM_PICK(tigerh) +STD_ROM_FN(tigerh) + +static struct BurnRomInfo tigerhjRomDesc[] = { + { "a47_00.8p", 0x004000, 0xcbdbe3cc, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "a47_01.8n", 0x004000, 0x65df2152, BRF_ESS | BRF_PRG }, // 1 + { "a47_02.8k", 0x004000, 0x633D324B, BRF_ESS | BRF_PRG }, // 2 + + { "a47_13.8j", 0x004000, 0x739A7E7E, BRF_GRA }, // 3 Sprite data + { "a47_12.6j", 0x004000, 0xC064ECDB, BRF_GRA }, // 4 + { "a47_11.8h", 0x004000, 0x744FAE9B, BRF_GRA }, // 5 + { "a47_10.6h", 0x004000, 0xE1CF844E, BRF_GRA }, // 6 + + { "a47_05.6f", 0x002000, 0xC5325B49, BRF_GRA }, // 7 Text layer + { "a47_04.6g", 0x002000, 0xCD59628E, BRF_GRA }, // 8 + + { "a47_09.4m", 0x004000, 0x31FAE8A8, BRF_GRA }, // 9 Background layer + { "a47_08.6m", 0x004000, 0xE539AF2B, BRF_GRA }, // 10 + { "a47_07.6n", 0x004000, 0x02FDD429, BRF_GRA }, // 11 + { "a47_06.6p", 0x004000, 0x11FBCC8C, BRF_GRA }, // 12 + + { "82s129.12q", 0x000100, 0x2C69350D, BRF_GRA }, // 13 + { "82s129.12m", 0x000100, 0x7142E972, BRF_GRA }, // 14 + { "82s129.12n", 0x000100, 0x25F273F2, BRF_GRA }, // 15 + + { "a47_03.12d", 0x002000, 0xD105260F, BRF_ESS | BRF_PRG }, // 16 + + { "a47_14.6a", 0x000800, 0x4042489F, BRF_ESS | BRF_PRG }, // 17 MCU +}; + + +STD_ROM_PICK(tigerhj) +STD_ROM_FN(tigerhj) + +static struct BurnRomInfo tigerhb1RomDesc[] = { + { "b0.5", 0x004000, 0x6ae7e13c, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "a47_01.8n", 0x004000, 0x65df2152, BRF_ESS | BRF_PRG }, // 1 + { "a47_02.8k", 0x004000, 0x633D324B, BRF_ESS | BRF_PRG }, // 2 + + { "a47_13.8j", 0x004000, 0x739A7E7E, BRF_GRA }, // 3 Sprite data + { "a47_12.6j", 0x004000, 0xC064ECDB, BRF_GRA }, // 4 + { "a47_11.8h", 0x004000, 0x744FAE9B, BRF_GRA }, // 5 + { "a47_10.6h", 0x004000, 0xE1CF844E, BRF_GRA }, // 6 + + { "a47_05.6f", 0x002000, 0xC5325B49, BRF_GRA }, // 7 Text layer + { "a47_04.6g", 0x002000, 0xCD59628E, BRF_GRA }, // 8 + + { "a47_09.4m", 0x004000, 0x31FAE8A8, BRF_GRA }, // 9 Background layer + { "a47_08.6m", 0x004000, 0xE539AF2B, BRF_GRA }, // 10 + { "a47_07.6n", 0x004000, 0x02FDD429, BRF_GRA }, // 11 + { "a47_06.6p", 0x004000, 0x11FBCC8C, BRF_GRA }, // 12 + + { "82s129.12q", 0x000100, 0x2C69350D, BRF_GRA }, // 13 + { "82s129.12m", 0x000100, 0x7142E972, BRF_GRA }, // 14 + { "82s129.12n", 0x000100, 0x25F273F2, BRF_GRA }, // 15 + + { "a47_03.12d", 0x002000, 0xD105260F, BRF_ESS | BRF_PRG }, // 16 +}; + + +STD_ROM_PICK(tigerhb1) +STD_ROM_FN(tigerhb1) + +static struct BurnRomInfo tigerhb2RomDesc[] = { + { "rom00_09.bin", 0x004000, 0xef738c68, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "a47_01.8n", 0x004000, 0x65df2152, BRF_ESS | BRF_PRG }, // 1 + { "rom02_07.bin", 0x004000, 0x36e250b9, BRF_ESS | BRF_PRG }, // 2 + + { "a47_13.8j", 0x004000, 0x739A7E7E, BRF_GRA }, // 3 Sprite data + { "a47_12.6j", 0x004000, 0xC064ECDB, BRF_GRA }, // 4 + { "a47_11.8h", 0x004000, 0x744FAE9B, BRF_GRA }, // 5 + { "a47_10.6h", 0x004000, 0xE1CF844E, BRF_GRA }, // 6 + + { "a47_05.6f", 0x002000, 0xC5325B49, BRF_GRA }, // 7 Text layer + { "a47_04.6g", 0x002000, 0xCD59628E, BRF_GRA }, // 8 + + { "a47_09.4m", 0x004000, 0x31FAE8A8, BRF_GRA }, // 9 Background layer + { "a47_08.6m", 0x004000, 0xE539AF2B, BRF_GRA }, // 10 + { "a47_07.6n", 0x004000, 0x02FDD429, BRF_GRA }, // 11 + { "a47_06.6p", 0x004000, 0x11FBCC8C, BRF_GRA }, // 12 + + { "82s129.12q", 0x000100, 0x2C69350D, BRF_GRA }, // 13 + { "82s129.12m", 0x000100, 0x7142E972, BRF_GRA }, // 14 + { "82s129.12n", 0x000100, 0x25F273F2, BRF_GRA }, // 15 + + { "a47_03.12d", 0x002000, 0xD105260F, BRF_ESS | BRF_PRG }, // 16 +}; + + +STD_ROM_PICK(tigerhb2) +STD_ROM_FN(tigerhb2) + +static struct BurnRomInfo tigerhb3RomDesc[] = { + { "14", 0x004000, 0xCA59DD73, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "13", 0x004000, 0x38BD54DB, BRF_ESS | BRF_PRG }, // 1 + { "a47_02.8k", 0x004000, 0x633D324B, BRF_ESS | BRF_PRG }, // 2 + + { "a47_13.8j", 0x004000, 0x739A7E7E, BRF_GRA }, // 3 Sprite data + { "a47_12.6j", 0x004000, 0xC064ECDB, BRF_GRA }, // 4 + { "a47_11.8h", 0x004000, 0x744FAE9B, BRF_GRA }, // 5 + { "a47_10.6h", 0x004000, 0xE1CF844E, BRF_GRA }, // 6 + + { "a47_05.6f", 0x002000, 0xC5325B49, BRF_GRA }, // 7 Text layer + { "a47_04.6g", 0x002000, 0xCD59628E, BRF_GRA }, // 8 + + { "a47_09.4m", 0x004000, 0x31FAE8A8, BRF_GRA }, // 9 Background layer + { "a47_08.6m", 0x004000, 0xE539AF2B, BRF_GRA }, // 10 + { "a47_07.6n", 0x004000, 0x02FDD429, BRF_GRA }, // 11 + { "a47_06.6p", 0x004000, 0x11FBCC8C, BRF_GRA }, // 12 + + { "82s129.12q", 0x000100, 0x2C69350D, BRF_GRA }, // 13 + { "82s129.12m", 0x000100, 0x7142E972, BRF_GRA }, // 14 + { "82s129.12n", 0x000100, 0x25F273F2, BRF_GRA }, // 15 + + { "a47_03.12d", 0x002000, 0xD105260F, BRF_ESS | BRF_PRG }, // 16 +}; + + +STD_ROM_PICK(tigerhb3) +STD_ROM_FN(tigerhb3) + +static struct BurnRomInfo getstarRomDesc[] = { + { "a68_00-1", 0x004000, 0x6A8BDC6C, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "a68_01-1", 0x004000, 0xEBE8DB3C, BRF_ESS | BRF_PRG }, // 1 + { "a68_02-1", 0x008000, 0x343E8415, BRF_ESS | BRF_PRG }, // 2 + + { "a68-13", 0x008000, 0x643FB282, BRF_GRA }, // 3 Sprite data + { "a68-12", 0x008000, 0x11F74E32, BRF_GRA }, // 4 + { "a68-11", 0x008000, 0xF24158CF, BRF_GRA }, // 5 + { "a68-10", 0x008000, 0x83161Ed0, BRF_GRA }, // 6 + + { "a68_05-1", 0x002000, 0x06F60107, BRF_GRA }, // 7 Text layer + { "a68_04-1", 0x002000, 0x1FC8F277, BRF_GRA }, // 8 + + { "a68_09", 0x008000, 0xA293CC2E, BRF_GRA }, // 9 Background layer + { "a68_08", 0x008000, 0x37662375, BRF_GRA }, // 10 + { "a68_07", 0x008000, 0xCF1A964C, BRF_GRA }, // 11 + { "a68_06", 0x008000, 0x05F9EB9A, BRF_GRA }, // 12 + + { "rom21", 0x000100, 0xD6360B4D, BRF_GRA }, // 13 + { "rom20", 0x000100, 0x4CA01887, BRF_GRA }, // 14 + { "rom19", 0x000100, 0x513224F0, BRF_GRA }, // 15 + + { "a68-03", 0x002000, 0x18DAA44C, BRF_ESS | BRF_PRG }, // 16 + + { "a68_14", 0x000800, 0x00000000, BRF_NODUMP | BRF_OPT | BRF_PRG }, // 17 MCU ROM +}; + + +STD_ROM_PICK(getstar) +STD_ROM_FN(getstar) + +static struct BurnRomInfo getstarjRomDesc[] = { + { "a68_00.bin", 0x004000, 0xad1a0143, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "a68_01.bin", 0x004000, 0x3426eb7c, BRF_ESS | BRF_PRG }, // 1 + { "a68_02.bin", 0x008000, 0x3567da17, BRF_ESS | BRF_PRG }, // 2 + + { "a68-13", 0x008000, 0x643FB282, BRF_GRA }, // 3 Sprite data + { "a68-12", 0x008000, 0x11F74E32, BRF_GRA }, // 4 + { "a68-11", 0x008000, 0xF24158CF, BRF_GRA }, // 5 + { "a68-10", 0x008000, 0x83161Ed0, BRF_GRA }, // 6 + + { "a68_05.bin", 0x002000, 0xe3d409e7, BRF_GRA }, // 7 Text layer + { "a68_04.bin", 0x002000, 0x6e5ac9d4, BRF_GRA }, // 8 + + { "a68_09", 0x008000, 0xA293CC2E, BRF_GRA }, // 9 Background layer + { "a68_08", 0x008000, 0x37662375, BRF_GRA }, // 10 + { "a68_07", 0x008000, 0xCF1A964C, BRF_GRA }, // 11 + { "a68_06", 0x008000, 0x05F9EB9A, BRF_GRA }, // 12 + + { "rom21", 0x000100, 0xD6360B4D, BRF_GRA }, // 13 + { "rom20", 0x000100, 0x4CA01887, BRF_GRA }, // 14 + { "rom19", 0x000100, 0x513224F0, BRF_GRA }, // 15 + + { "a68-03", 0x002000, 0x18DAA44C, BRF_ESS | BRF_PRG }, // 16 + + { "68705.bin", 0x000800, 0x00000000, BRF_NODUMP | BRF_OPT | BRF_PRG }, // 17 MCU ROM +}; + + +STD_ROM_PICK(getstarj) +STD_ROM_FN(getstarj) + +static struct BurnRomInfo gtstarb2RomDesc[] = { + { "gs_14.rom", 0x004000, 0x1A57A920, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "gs_13.rom", 0x004000, 0x805F8E77, BRF_ESS | BRF_PRG }, // 1 + { "a68_02.bin", 0x008000, 0x3567DA17, BRF_ESS | BRF_PRG }, // 2 + + { "a68-13", 0x008000, 0x643FB282, BRF_GRA }, // 3 Sprite data + { "a68-12", 0x008000, 0x11F74E32, BRF_GRA }, // 4 + { "a68-11", 0x008000, 0xF24158CF, BRF_GRA }, // 5 + { "a68-10", 0x008000, 0x83161Ed0, BRF_GRA }, // 6 + + { "a68_05.bin", 0x002000, 0xE3D409E7, BRF_GRA }, // 7 Text layer + { "a68_04.bin", 0x002000, 0x6E5AC9D4, BRF_GRA }, // 8 + + { "a68_09", 0x008000, 0xA293CC2E, BRF_GRA }, // 9 Background layer + { "a68_08", 0x008000, 0x37662375, BRF_GRA }, // 10 + { "a68_07", 0x008000, 0xCF1A964C, BRF_GRA }, // 11 + { "a68_06", 0x008000, 0x05F9EB9A, BRF_GRA }, // 12 + + { "rom21", 0x000100, 0xD6360B4D, BRF_GRA }, // 13 + { "rom20", 0x000100, 0x4CA01887, BRF_GRA }, // 14 + { "rom19", 0x000100, 0x513224F0, BRF_GRA }, // 15 + + { "a68-03", 0x002000, 0x18DAA44C, BRF_ESS | BRF_PRG }, // 16 +}; + + +STD_ROM_PICK(gtstarb2) +STD_ROM_FN(gtstarb2) + +static struct BurnRomInfo gtstarb1RomDesc[] = { + { "gs_rb_1.bin", 0x004000, 0x9afad7e0, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "gs_rb_2.bin", 0x004000, 0x5feb0a60, BRF_ESS | BRF_PRG }, // 1 + { "gs_rb_3.bin", 0x008000, 0xe3cfb1ba, BRF_ESS | BRF_PRG }, // 2 + + { "a68-13", 0x008000, 0x643FB282, BRF_GRA }, // 3 Sprite data + { "a68-12", 0x008000, 0x11F74E32, BRF_GRA }, // 4 + { "a68-11", 0x008000, 0xF24158CF, BRF_GRA }, // 5 + { "a68-10", 0x008000, 0x83161Ed0, BRF_GRA }, // 6 + + { "a68_05.bin", 0x002000, 0xE3D409E7, BRF_GRA }, // 7 Text layer + { "a68_04.bin", 0x002000, 0x6E5AC9D4, BRF_GRA }, // 8 + + { "a68_09", 0x008000, 0xA293CC2E, BRF_GRA }, // 9 Background layer + { "a68_08", 0x008000, 0x37662375, BRF_GRA }, // 10 + { "a68_07", 0x008000, 0xCF1A964C, BRF_GRA }, // 11 + { "a68_06", 0x008000, 0x05F9EB9A, BRF_GRA }, // 12 + + { "rom21", 0x000100, 0xD6360B4D, BRF_GRA }, // 13 + { "rom20", 0x000100, 0x4CA01887, BRF_GRA }, // 14 + { "rom19", 0x000100, 0x513224F0, BRF_GRA }, // 15 + + { "a68-03", 0x002000, 0x18DAA44C, BRF_ESS | BRF_PRG }, // 16 +}; + + +STD_ROM_PICK(gtstarb1) +STD_ROM_FN(gtstarb1) + +static struct BurnRomInfo alconRomDesc[] = { + { "a77_00-1.8p", 0x008000, 0x2ba82d60, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "a77_01-1.8n", 0x008000, 0x18bb2f12, BRF_ESS | BRF_PRG }, // 1 + + { "a77_12.8j", 0x008000, 0x8545d397, BRF_GRA }, // 2 Sprite data + { "a77_11.7j", 0x008000, 0xb1b7b925, BRF_GRA }, // 3 + { "a77_10.8h", 0x008000, 0x422d946b, BRF_GRA }, // 4 + { "a77_09.7h", 0x008000, 0x587113ae, BRF_GRA }, // 5 + + { "a77_04-1.6f", 0x002000, 0x31003483, BRF_GRA }, // 6 Text layer + { "a77_03-1.6g", 0x002000, 0x404152c0, BRF_GRA }, // 7 + + { "a77_08.6k", 0x008000, 0xB6358305, BRF_GRA }, // 8 Background layer + { "a77_07.6m", 0x008000, 0xE92D9D60, BRF_GRA }, // 9 + { "a77_06.6n", 0x008000, 0x5FAEEEA3, BRF_GRA }, // 10 + { "a77_05.6p", 0x008000, 0x974E2EA9, BRF_GRA }, // 11 + + { "21_82s129.12q",0x000100, 0xA0EFAF99, BRF_GRA }, // 12 + { "20_82s129.12m",0x000100, 0xA56D57E5, BRF_GRA }, // 13 + { "19_82s129.12n",0x000100, 0x5CBF9FBF, BRF_GRA }, // 14 + + { "a77_02.12d", 0x002000, 0x87F4705A, BRF_ESS | BRF_PRG }, // 15 + + { "a77_13.6a", 0x000800, 0xa70c81d9, BRF_ESS | BRF_PRG }, // 16 MCU ROM +}; + + +STD_ROM_PICK(alcon) +STD_ROM_FN(alcon) + +static struct BurnRomInfo slapfighRomDesc[] = { + { "a77_00.8p", 0x008000, 0x674C0E0F, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "a77_01.8n", 0x008000, 0x3C42E4A7, BRF_ESS | BRF_PRG }, // 1 + + { "a77_12.8j", 0x008000, 0x8545d397, BRF_GRA }, // 2 Sprite data + { "a77_11.7j", 0x008000, 0xb1b7b925, BRF_GRA }, // 3 + { "a77_10.8h", 0x008000, 0x422d946b, BRF_GRA }, // 4 + { "a77_09.7h", 0x008000, 0x587113ae, BRF_GRA }, // 5 + + { "a77_04.6f", 0x002000, 0x2AC7B943, BRF_GRA }, // 6 Text layer + { "a77_03.6g", 0x002000, 0x33CADC93, BRF_GRA }, // 7 + + { "a77_08.6k", 0x008000, 0xB6358305, BRF_GRA }, // 8 Background layer + { "a77_07.6m", 0x008000, 0xE92D9D60, BRF_GRA }, // 9 + { "a77_06.6n", 0x008000, 0x5FAEEEA3, BRF_GRA }, // 10 + { "a77_05.6p", 0x008000, 0x974E2EA9, BRF_GRA }, // 11 + + { "21_82s129.12q",0x000100, 0xA0EFAF99, BRF_GRA }, // 12 + { "20_82s129.12m",0x000100, 0xA56D57E5, BRF_GRA }, // 13 + { "19_82s129.12n",0x000100, 0x5CBF9FBF, BRF_GRA }, // 14 + + { "a77_02.12d", 0x002000, 0x87F4705A, BRF_ESS | BRF_PRG }, // 15 + + { "a77_13.6a", 0x000800, 0xa70c81d9, BRF_ESS | BRF_PRG }, // 16 MCU ROM +}; + + +STD_ROM_PICK(slapfigh) +STD_ROM_FN(slapfigh) + +static struct BurnRomInfo slapbtjpRomDesc[] = { + { "sf_r19jb.bin", 0x008000, 0x9A7AC8B3, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "sf_rh.bin", 0x008000, 0x3C42E4A7, BRF_ESS | BRF_PRG }, // 1 + + { "sf_r03.bin", 0x008000, 0x8545D397, BRF_GRA }, // 2 Sprite data + { "sf_r01.bin", 0x008000, 0xB1B7B925, BRF_GRA }, // 3 + { "sf_r04.bin", 0x008000, 0x422D946B, BRF_GRA }, // 4 + { "sf_r02.bin", 0x008000, 0x587113AE, BRF_GRA }, // 5 + + { "sf_r11.bin", 0x002000, 0x2AC7B943, BRF_GRA }, // 6 Text layer + { "sf_r10.bin", 0x002000, 0x33CADC93, BRF_GRA }, // 7 + + { "sf_r06.bin", 0x008000, 0xB6358305, BRF_GRA }, // 8 Background layer + { "sf_r09.bin", 0x008000, 0xE92D9D60, BRF_GRA }, // 9 + { "sf_r08.bin", 0x008000, 0x5FAEEEA3, BRF_GRA }, // 10 + { "sf_r07.bin", 0x008000, 0x974E2EA9, BRF_GRA }, // 11 + + { "sf_col21.bin", 0x000100, 0xA0EFAF99, BRF_GRA }, // 12 + { "sf_col20.bin", 0x000100, 0xA56D57E5, BRF_GRA }, // 13 + { "sf_col19.bin", 0x000100, 0x5CBF9FBF, BRF_GRA }, // 14 + + { "sf_r05.bin", 0x002000, 0x87F4705A, BRF_ESS | BRF_PRG }, // 15 +}; + + +STD_ROM_PICK(slapbtjp) +STD_ROM_FN(slapbtjp) + +static struct BurnRomInfo slapbtukRomDesc[] = { + { "sf_r19eb.bin", 0x004000, 0x2efe47af, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "sf_r20eb.bin", 0x004000, 0xf42c7951, BRF_ESS | BRF_PRG }, // 1 + { "sf_rh.bin", 0x008000, 0x3C42E4A7, BRF_ESS | BRF_PRG }, // 1 + + { "sf_r03.bin", 0x008000, 0x8545D397, BRF_GRA }, // 2 Sprite data + { "sf_r01.bin", 0x008000, 0xB1B7B925, BRF_GRA }, // 3 + { "sf_r04.bin", 0x008000, 0x422D946B, BRF_GRA }, // 4 + { "sf_r02.bin", 0x008000, 0x587113AE, BRF_GRA }, // 5 + + { "sf_r11.bin", 0x002000, 0x2AC7B943, BRF_GRA }, // 6 Text layer + { "sf_r10.bin", 0x002000, 0x33CADC93, BRF_GRA }, // 7 + + { "sf_r06.bin", 0x008000, 0xB6358305, BRF_GRA }, // 8 Background layer + { "sf_r09.bin", 0x008000, 0xE92D9D60, BRF_GRA }, // 9 + { "sf_r08.bin", 0x008000, 0x5FAEEEA3, BRF_GRA }, // 10 + { "sf_r07.bin", 0x008000, 0x974E2EA9, BRF_GRA }, // 11 + + { "sf_col21.bin", 0x000100, 0xA0EFAF99, BRF_GRA }, // 12 + { "sf_col20.bin", 0x000100, 0xA56D57E5, BRF_GRA }, // 13 + { "sf_col19.bin", 0x000100, 0x5CBF9FBF, BRF_GRA }, // 14 + + { "sf_r05.bin", 0x002000, 0x87F4705A, BRF_ESS | BRF_PRG }, // 15 +}; + + +STD_ROM_PICK(slapbtuk) +STD_ROM_FN(slapbtuk) + +static struct BurnRomInfo slapfgtrRomDesc[] = { + { "k1-10.u90", 0x004000, 0x2efe47af, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "k1-09.u89", 0x004000, 0x17c187c5, BRF_ESS | BRF_PRG }, // 1 + { "k1-08.u88", 0x002000, 0x945af97f, BRF_ESS | BRF_PRG }, // 1 + { "k1-07.u87", 0x008000, 0x3C42E4A7, BRF_ESS | BRF_PRG }, // 1 + + { "k1-15.u60", 0x008000, 0x8545D397, BRF_GRA }, // 2 Sprite data + { "k1-13.u50", 0x008000, 0xB1B7B925, BRF_GRA }, // 3 + { "k1-14.u59", 0x008000, 0x422D946B, BRF_GRA }, // 4 + { "k1-12.u49", 0x008000, 0x587113AE, BRF_GRA }, // 5 + + { "k1-02.u57" , 0x002000, 0x2AC7B943, BRF_GRA }, // 6 Text layer + { "k1-03.u58", 0x002000, 0x33CADC93, BRF_GRA }, // 7 + + { "k1-01.u49" , 0x008000, 0xB6358305, BRF_GRA }, // 8 Background layer + { "k1-04.u62", 0x008000, 0xE92D9D60, BRF_GRA }, // 9 + { "k1-05.u63", 0x008000, 0x5FAEEEA3, BRF_GRA }, // 10 + { "k1-06.u64", 0x008000, 0x974E2EA9, BRF_GRA }, // 11 + + { "sf_col21.bin", 0x000100, 0xA0EFAF99, BRF_GRA }, // 12 + { "sf_col20.bin", 0x000100, 0xA56D57E5, BRF_GRA }, // 13 + { "sf_col19.bin", 0x000100, 0x5CBF9FBF, BRF_GRA }, // 14 + + { "k1-11.u89", 0x002000, 0x87F4705A, BRF_ESS | BRF_PRG }, // 15 +}; + + +STD_ROM_PICK(slapfgtr) +STD_ROM_FN(slapfgtr) + +struct BurnDriver BurnDrvTigerH = { + "tigerh", NULL, NULL, NULL, "1985", + "Tiger Heli (US)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, + NULL, tigerhRomInfo, tigerhRomName, NULL, NULL, tigerhInputInfo, tigerhDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 240, 280, 3, 4 +}; + +struct BurnDriver BurnDrvTigerhJ = { + "tigerhj", "tigerh", NULL, NULL, "1985", + "Tiger Heli (Japan)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, + NULL, tigerhjRomInfo, tigerhjRomName, NULL, NULL, tigerhInputInfo, tigerhDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 240, 280, 3, 4 +}; + +struct BurnDriver BurnDrvTigerHB1 = { + "tigerhb1", "tigerh", NULL, NULL, "1985", + "Tiger Heli (bootleg, set 1)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, + NULL, tigerhb1RomInfo, tigerhb1RomName, NULL, NULL, tigerhInputInfo, tigerhDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 240, 280, 3, 4 +}; + +struct BurnDriver BurnDrvTigerHB2 = { + "tigerhb2", "tigerh", NULL, NULL, "1985", + "Tiger Heli (bootleg, set 2)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, + NULL, tigerhb2RomInfo, tigerhb2RomName, NULL, NULL, tigerhInputInfo, tigerhDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 240, 280, 3, 4 +}; + +struct BurnDriver BurnDrvTigerHB3 = { + "tigerhb3", "tigerh", NULL, NULL, "1985", + "Tiger Heli (bootleg, set 3)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, + NULL, tigerhb3RomInfo, tigerhb3RomName, NULL, NULL, tigerhInputInfo, tigerhDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 240, 280, 3, 4 +}; + +struct BurnDriver BurnDrvGetStar = { + "getstar", NULL, NULL, NULL, "1986", + "Guardian\0", NULL, "Toaplan / Taito America Corporation (Kitkorp license)", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TOAPLAN_MISC, GBF_SCRFIGHT, 0, + NULL, getstarRomInfo, getstarRomName, NULL, NULL, getstarInputInfo, getstarDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 280, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGetStarj = { + "getstarj", "getstar", NULL, NULL, "1986", + "Get Star (Japan)\0", NULL, "Toaplan / Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_MISC, GBF_SCRFIGHT, 0, + NULL, getstarjRomInfo, getstarjRomName, NULL, NULL, getstarInputInfo, getstarDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 280, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGetStarb2 = { + "gtstarb2", "getstar", NULL, NULL, "1986", + "Get Star (bootleg, set 2)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TOAPLAN_MISC, GBF_SCRFIGHT, 0, + NULL, gtstarb2RomInfo, gtstarb2RomName, NULL, NULL, tigerhInputInfo, getstarb2DIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 280, 240, 4, 3 +}; + +struct BurnDriver BurnDrvGetStarb1 = { + "gtstarb1", "getstar", NULL, NULL, "1986", + "Get Star (bootleg, set 1)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TOAPLAN_MISC, GBF_SCRFIGHT, 0, + NULL, gtstarb1RomInfo, gtstarb1RomName, NULL, NULL, getstarInputInfo, getstarDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 280, 240, 4, 3 +}; + +struct BurnDriver BurnDrvAlcon = { + "alcon", NULL, NULL, NULL, "1986", + "Alcon (US)\0", NULL, "Taito America Corp.", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, + NULL, alconRomInfo, alconRomName, NULL, NULL, tigerhInputInfo, slapfighDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 240, 280, 3, 4 +}; + +struct BurnDriver BurnDrvSlapFigh = { + "slapfigh", "alcon", NULL, NULL, "1986", + "Slap Fight (Japan set 1)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_CLONE, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, + NULL, slapfighRomInfo, slapfighRomName, NULL, NULL, tigerhInputInfo, slapfighDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 240, 280, 3, 4 +}; + +struct BurnDriver BurnDrvSlapBtJP = { + "slapfighb1", "alcon", NULL, NULL, "1986", + "Slap Fight (bootleg set 1)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, + NULL, slapbtjpRomInfo, slapbtjpRomName, NULL, NULL, tigerhInputInfo, slapfighDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 240, 280, 3, 4 +}; + +struct BurnDriver BurnDrvSlapBtUK = { + "slapfighb2", "alcon", NULL, NULL, "1986", + "Slap Fight (bootleg set 2)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, + NULL, slapbtukRomInfo, slapbtukRomName, NULL, NULL, tigerhInputInfo, slapfighDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 240, 280, 3, 4 +}; + +struct BurnDriver BurnDrvSlapFghtr = { + "slapfighb3", "alcon", NULL, NULL, "1986", + "Slap Fight (bootleg set 3)\0", NULL, "Taito", "Early Toaplan", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TOAPLAN_MISC, GBF_VERSHOOT, 0, + NULL, slapfgtrRomInfo, slapfgtrRomName, NULL, NULL, tigerhInputInfo, slapfighDIPInfo, + tigerhInit, tigerhExit, tigerhFrame, NULL, tigerhScan, &tigerhRecalcPalette, 0x100, + 240, 280, 3, 4 +}; diff --git a/src/burn/drv/toaplan/d_truxton.cpp b/src/burn/drv/toaplan/d_truxton.cpp index febe65c50..765ef1442 100644 --- a/src/burn/drv/toaplan/d_truxton.cpp +++ b/src/burn/drv/toaplan/d_truxton.cpp @@ -1,682 +1,681 @@ -// Truxton - -#include "toaplan.h" - -#define REFRESHRATE ((28000000.0 / 4.0) / (450.0 * 270.0)) -#define VBLANK_LINES (32) - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static bool bEnableInterrupts; - -// Rom information -static struct BurnRomInfo truxtonRomDesc[] = { - { "b65_11.bin", 0x020000, 0x1a62379a, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "b65_10.bin", 0x020000, 0xaff5195d, BRF_ESS | BRF_PRG }, // 1 - - { "b65_08.bin", 0x020000, 0xd2315b37, BRF_GRA }, // 2 Tile data - { "b65_07.bin", 0x020000, 0xfb83252a, BRF_GRA }, // 3 - { "b65_06.bin", 0x020000, 0x36cedcbe, BRF_GRA }, // 4 - { "b65_05.bin", 0x020000, 0x81cd95f1, BRF_GRA }, // 5 - - { "b65_04.bin", 0x020000, 0x8c6ff461, BRF_GRA }, // 6 - { "b65_03.bin", 0x020000, 0x58b1350b, BRF_GRA }, // 7 - { "b65_02.bin", 0x020000, 0x1dd55161, BRF_GRA }, // 8 - { "b65_01.bin", 0x020000, 0xe974937f, BRF_GRA }, // 9 - - { "b65_09.bin", 0x008000, 0xf1c0f410, BRF_ESS | BRF_PRG }, // 10 Z80 program - - { "b65_12.bpr", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM - { "b65_13.bpr", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? -}; - -STD_ROM_PICK(truxton) -STD_ROM_FN(truxton) - -static struct BurnInputInfo truxtonInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 2, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, -}; - -STDINPUTINFO(truxton) - -static struct BurnDIPInfo truxtonDIPList[] = { - // Defaults - {0x12, 0xFF, 0xFF, 0x01, NULL}, - {0x13, 0xFF, 0xFF, 0x00, NULL}, - {0x14, 0xFF, 0xFF, 0x02, NULL}, - - // DIP 1 - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x01, 0x01, "Upright"}, - {0x12, 0x01, 0x01, 0x00, "Cocktail"}, - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x02, 0x00, "Normal screen"}, - {0x12, 0x01, 0x02, 0x02, "Invert screen"}, - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x04, 0x00, "Normal mode"}, - {0x12, 0x01, 0x04, 0x04, "Screen test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x12, 0x01, 0x08, 0x00, "On"}, - {0x12, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, -#if 1 - // Coinage for Europe - {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x12, 0x01, 0x30, 0x10, "1 coin 2 play"}, - {0x12, 0x01, 0x30, 0x20, "2 coin 1 play"}, - {0x12, 0x01, 0x30, 0x30, "2 coin 3 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x12, 0x01, 0xC0, 0x00, "1 coin 1 play"}, - {0x12, 0x01, 0xC0, 0x40, "1 coin 2 play"}, - {0x12, 0x01, 0xC0, 0x80, "2 coin 1 play"}, - {0x12, 0x01, 0xC0, 0xC0, "2 coin 3 play"}, -#else - // Coinage for Japan - {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x12, 0x01, 0x30, 0x10, "2 coin 1 play"}, - {0x12, 0x01, 0x30, 0x20, "3 coin 1 play"}, - {0x12, 0x01, 0x30, 0x30, "4 coin 1 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x12, 0x01, 0xC0, 0x00, "1 coin 2 play"}, - {0x12, 0x01, 0xC0, 0x40, "1 coin 3 play"}, - {0x12, 0x01, 0xC0, 0x80, "1 coin 4 play"}, - {0x12, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, -#endif - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x13, 0x01, 0x03, 0x00, "B"}, - {0x13, 0x01, 0x03, 0x01, "A"}, - {0x13, 0x01, 0x03, 0x02, "C"}, - {0x13, 0x01, 0x03, 0x03, "D"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x13, 0x01, 0x0C, 0x00, "70000, every 200000"}, - {0x13, 0x01, 0x0C, 0x04, "50000, every 150000"}, - {0x13, 0x01, 0x0C, 0x08, "100000 only"}, - {0x13, 0x01, 0x0C, 0x0C, "No extend"}, - {0, 0xFE, 0, 4, "Number of heros"}, - {0x13, 0x01, 0x30, 0x30, "2"}, - {0x13, 0x01, 0x30, 0x00, "3"}, - {0x13, 0x01, 0x30, 0x20, "4"}, - {0x13, 0x01, 0x30, 0x10, "5"}, - {0, 0xFE, 0, 2, "Dip Switch Display"}, - {0x13, 0x01, 0x40, 0x00, "Off"}, - {0x13, 0x01, 0x40, 0x40, "On"}, - {0, 0xFE, 0, 2, "Allow Continue"}, - {0x13, 0x01, 0x80, 0x00, "Yes"}, - {0x13, 0x01, 0x80, 0x80, "No"}, - - // Region - {0, 0xFE, 0, 5, "Region"}, - {0x14, 0x01, 0x07, 0x00, "Japan/Taito Corp"}, - {0x14, 0x01, 0x07, 0x01, "US/Romstar"}, - {0x14, 0x01, 0x07, 0x02, "World/Taito Corp"}, - {0x14, 0x01, 0x07, 0x04, "US/Taito America"}, - {0x14, 0x01, 0x07, 0x06, "World/Taito America"}, -}; - -STDDIPINFO(truxton) - -static INT32 __fastcall DrvResetCallback() -{ - // Reset instruction on 68000 - - ZetReset(); // Reset Z80 (CPU #1) - BurnYM3812Reset(); - return 0; -} - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *Ram01, *RamPal, *RamPal2; - -static INT32 nColCount = 0x0400; - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x040000; // - RomZ80 = Next; Next += 0x008000; // Z80 ROM - BCU2ROM = Next; Next += nBCU2ROMSize; // BCU-2 tile data - FCU2ROM = Next; Next += nFCU2ROMSize; // FCU-2 tile data - RamStart = Next; - Ram01 = Next; Next += 0x004000; // CPU #0 work RAM - RamPal = Next; Next += 0x001000; // palette - RamPal2 = Next; Next += 0x001000; // palette - RamZ80 = Next; Next += 0x008000; // Z80 RAM - BCU2RAM = Next; Next += 0x010000; - FCU2RAM = Next; Next += 0x000800; - FCU2RAMSize = Next; Next += 0x000080; - RamEnd = Next; - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32* pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029402; - } - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); // scan 68000 states - ZetScan(nAction); // Scan Z80 - - BurnYM3812Scan(nAction, pnMin); - - SCAN_VAR(DrvInput); - SCAN_VAR(nCyclesDone); - } - - return 0; -} - -static INT32 LoadRoms() -{ - // Load 68000 ROM - ToaLoadCode(Rom01, 0, 2); - - // Load BCU-2 tile data - ToaLoadTiles(BCU2ROM, 2, nBCU2ROMSize); - - // Load FCU-2 tile data - ToaLoadTiles(FCU2ROM, 6, nFCU2ROMSize); - - // Load the Z80 ROM - BurnLoadRom(RomZ80, 10, 1); - - return 0; -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall truxtonZ80In(UINT16 nAddress) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x60: - return BurnYM3812Read(0); - case 0x40: // DIP A - return DrvInput[2]; - case 0x50: // DIP B - return DrvInput[3]; - case 0x20: // Sysytem inputs - return DrvInput[4] | (ToaVBlankRegister() << 7); - case 0x00: // Player 1 - return DrvInput[0]; - case 0x10: // Player 2 - return DrvInput[1]; - case 0x70: // Region - return DrvInput[5]; - - } - -// bprintf(PRINT_NORMAL, _T("z80 read %4X\n"), nAddress); - - return 0; -} - -void __fastcall truxtonZ80Out(UINT16 nAddress, UINT8 nValue) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0x60: - BurnYM3812Write(0, nValue); - break; - case 0x61: - BurnYM3812Write(1, nValue); - break; - - case 0x30: // Coin counter - break; - -// default: -// bprintf(PRINT_NORMAL, _T("Z80 attempted to write address %04X with value %02X.\n"), nAddress, nValue); - } -} - -static INT32 DrvZ80Init() -{ - // Init the Z80 - ZetInit(0); - ZetOpen(0); - - ZetSetInHandler(truxtonZ80In); - ZetSetOutHandler(truxtonZ80Out); - - // ROM - ZetMapArea (0x0000, 0x7FFF, 0, RomZ80); // Direct Read from ROM - ZetMapArea (0x0000, 0x7FFF, 2, RomZ80); // Direct Fetch from ROM - // RAM - ZetMapArea (0x8000, 0xFFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0x8000, 0xFFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0x8000, 0xFFFF, 2, RamZ80); // - - ZetMemEnd(); - - ZetClose(); - - return 0; -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall truxtonReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x0c0001: - case 0x140001: - return ToaVBlankRegister(); - - default: { -// bprintf(PRINT_NORMAL, _T("Read Byte %06X.\n"), sekAddress); - } - } - - return 0; -} - -UINT16 __fastcall truxtonReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x0c0002: - return ToaFCU2GetRAMPointer(); - case 0x0c0004: - return ToaFCU2ReadRAM(); - case 0x0c0006: - return ToaFCU2ReadRAMSize(); - - case 0x100002: - return ToaBCU2GetRAMPointer(); - case 0x100004: - return ToaBCU2ReadRAM_Hi(); - case 0x100006: - return ToaBCU2ReadRAM_Lo(); - - case 0x100010: - case 0x100011: - case 0x100012: - case 0x100013: - case 0x100014: - case 0x100015: - case 0x100016: - case 0x100017: - case 0x100018: - case 0x100019: - case 0x10001A: - case 0x10001B: - case 0x10001C: - case 0x10001D: - case 0x10001E: - case 0x10001F: - return BCU2Reg[(sekAddress & 15) >> 1]; - - case 0x0c0000: - case 0x140000: - return ToaVBlankRegister(); - - default: { -// bprintf(PRINT_NORMAL, _T("Read Word %06X.\n"), sekAddress); - } - } - - return 0; -} - -void __fastcall truxtonWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - - case 0x140003: - bEnableInterrupts = byteValue; - break; - - case 0x0c0006: - ToaFCU2WriteRAMSize(byteValue); - break; - - default: { -// bprintf(PRINT_NORMAL, _T("Write byte %06X, %02X.\n"), sekAddress, byteValue); - } - } -} - -void __fastcall truxtonWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - - case 0x0c0002: // FCU-2 set VRAM address-pointer - ToaFCU2SetRAMPointer(wordValue); - break; - case 0x0c0004: - ToaFCU2WriteRAM(wordValue); - break; - case 0x0c0006: - ToaFCU2WriteRAMSize(wordValue); - break; - - case 0x100000: // BCU-2 flip - break; - case 0x100002: // BCU-2 set VRAM address-pointer - ToaBCU2SetRAMPointer(wordValue); - break; - case 0x100004: - ToaBCU2WriteRAM(wordValue); - break; - case 0x100006: - ToaBCU2WriteRAM(wordValue); - break; - - case 0x100010: - case 0x100011: - case 0x100012: - case 0x100013: - case 0x100014: - case 0x100015: - case 0x100016: - case 0x100017: - case 0x100018: - case 0x100019: - case 0x10001A: - case 0x10001B: - case 0x10001C: - case 0x10001D: - case 0x10001E: - case 0x10001F: - BCU2Reg[(sekAddress & 15) >> 1] = wordValue; - break; - - case 0x140002: - bEnableInterrupts = (wordValue & 0xFF); - break; - - case 0x1c0000: - nBCU2TileXOffset = wordValue; - break; - case 0x1c0002: - nBCU2TileYOffset = wordValue; - break; - - case 0x1c0006: // FCU-2 flip - break; - - case 0x1d0000: - if (wordValue == 0) DrvResetCallback(); - break; - - default: { -// bprintf(PRINT_NORMAL, _T("Write word %06X, %04X.\n"), sekAddress, wordValue); - } - } -} - -// ---------------------------------------------------------------------------- - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - - bEnableInterrupts = false; - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - -#ifdef DRIVER_ROTATION - bToaRotateScreen = true; -#endif - - BurnSetRefreshRate(REFRESHRATE); - - nBCU2ROMSize = 0x080000; - nFCU2ROMSize = 0x080000; - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x03FFFF, SM_ROM); // 68K ROM - SekMapMemory(Ram01, 0x080000, 0x083FFF, SM_RAM); // 68K RAM - SekMapMemory(RamPal, 0x144000, 0x1447FF, SM_RAM); // BCU-2 palette RAM - SekMapMemory(RamPal2, 0x146000, 0x1467FF, SM_RAM); // FCU-2 palette RAM - - SekSetReadWordHandler(0, truxtonReadWord); - SekSetReadByteHandler(0, truxtonReadByte); - SekSetWriteWordHandler(0, truxtonWriteWord); - SekSetWriteByteHandler(0, truxtonWriteByte); - - SekMapHandler(1, 0x180000, 0x180FFF, SM_RAM); // Z80 RAM - - SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); - SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); - SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); - SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); - - SekClose(); - } - - ToaInitBCU2(); - - DrvZ80Init(); // Initialize Z80 - - nToaPalLen = nColCount; - ToaPalSrc = RamPal; - ToaPalSrc2 = RamPal2; - ToaPalInit(); - - BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); - BurnTimerAttachZetYM3812(28000000 / 8); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - return 0; -} - -static INT32 DrvExit() -{ - BurnYM3812Exit(); - ToaPalExit(); - - ToaExitBCU2(); - ToaZExit(); // Z80 exit - SekExit(); // Deallocate 68000s - - BurnFree(Mem); - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0x120); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderBCU2(); // Render BCU2 graphics - } - - ToaPalUpdate(); // Update the palette - ToaPal2Update(); - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 4; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x00; // Buttons - DrvInput[1] = 0x00; // Player 1 - DrvInput[4] = 0x00; // Player 2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[4] |= (DrvButton[i] & 1) << i; - } - ToaClearOpposites(&DrvInput[0]); - ToaClearOpposites(&DrvInput[1]); - - SekNewFrame(); - ZetNewFrame(); - - SekOpen(0); - ZetOpen(0); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); - nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext; - - // Run 68000 - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - - // Trigger VBlank interrupt - if (nNext > nToaCyclesVBlankStart) { - if (SekTotalCycles() < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); - SekRun(nCyclesSegment); - } - - if (pBurnDraw) { - DrvDraw(); // Draw screen if needed - } - - ToaBufferFCU2Sprites(); - - bVBlank = true; - if (bEnableInterrupts) { - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - } - - nCyclesSegment = nNext - SekTotalCycles(); - if (bVBlank || (!CheckSleep(0))) { // See if this CPU is busywaiting - SekRun(nCyclesSegment); - } else { - SekIdle(nCyclesSegment); - } - - BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); - } - - nToa1Cycles68KSync = SekTotalCycles(); - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; - -// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); - - ZetClose(); - SekClose(); - -// ToaBufferFCU2Sprites(); - - return 0; -} - -struct BurnDriver BurnDrvTruxton = { - "truxton", NULL, NULL, NULL, "1988", - "Truxton\0Tatsujin\0", NULL, "[Toaplan] Taito Corporation", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, - NULL, truxtonRomInfo, truxtonRomName, NULL, NULL, truxtonInputInfo, truxtonDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 240, 320, 3, 4 -}; +// Truxton + +#include "toaplan.h" + +#define REFRESHRATE ((28000000.0 / 4.0) / (450.0 * 270.0)) +#define VBLANK_LINES (32) + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static bool bEnableInterrupts; + +// Rom information +static struct BurnRomInfo truxtonRomDesc[] = { + { "b65_11.bin", 0x020000, 0x1a62379a, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "b65_10.bin", 0x020000, 0xaff5195d, BRF_ESS | BRF_PRG }, // 1 + + { "b65_08.bin", 0x020000, 0xd2315b37, BRF_GRA }, // 2 Tile data + { "b65_07.bin", 0x020000, 0xfb83252a, BRF_GRA }, // 3 + { "b65_06.bin", 0x020000, 0x36cedcbe, BRF_GRA }, // 4 + { "b65_05.bin", 0x020000, 0x81cd95f1, BRF_GRA }, // 5 + + { "b65_04.bin", 0x020000, 0x8c6ff461, BRF_GRA }, // 6 + { "b65_03.bin", 0x020000, 0x58b1350b, BRF_GRA }, // 7 + { "b65_02.bin", 0x020000, 0x1dd55161, BRF_GRA }, // 8 + { "b65_01.bin", 0x020000, 0xe974937f, BRF_GRA }, // 9 + + { "b65_09.bin", 0x008000, 0xf1c0f410, BRF_ESS | BRF_PRG }, // 10 Z80 program + + { "b65_12.bpr", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM + { "b65_13.bpr", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? +}; + +STD_ROM_PICK(truxton) +STD_ROM_FN(truxton) + +static struct BurnInputInfo truxtonInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 2, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, +}; + +STDINPUTINFO(truxton) + +static struct BurnDIPInfo truxtonDIPList[] = { + // Defaults + {0x12, 0xFF, 0xFF, 0x01, NULL}, + {0x13, 0xFF, 0xFF, 0x00, NULL}, + {0x14, 0xFF, 0xFF, 0x02, NULL}, + + // DIP 1 + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x01, 0x01, "Upright"}, + {0x12, 0x01, 0x01, 0x00, "Cocktail"}, + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x02, 0x00, "Normal screen"}, + {0x12, 0x01, 0x02, 0x02, "Invert screen"}, + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x04, 0x00, "Normal mode"}, + {0x12, 0x01, 0x04, 0x04, "Screen test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x12, 0x01, 0x08, 0x00, "On"}, + {0x12, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, +#if 1 + // Coinage for Europe + {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x12, 0x01, 0x30, 0x10, "1 coin 2 play"}, + {0x12, 0x01, 0x30, 0x20, "2 coin 1 play"}, + {0x12, 0x01, 0x30, 0x30, "2 coin 3 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x12, 0x01, 0xC0, 0x00, "1 coin 1 play"}, + {0x12, 0x01, 0xC0, 0x40, "1 coin 2 play"}, + {0x12, 0x01, 0xC0, 0x80, "2 coin 1 play"}, + {0x12, 0x01, 0xC0, 0xC0, "2 coin 3 play"}, +#else + // Coinage for Japan + {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x12, 0x01, 0x30, 0x10, "2 coin 1 play"}, + {0x12, 0x01, 0x30, 0x20, "3 coin 1 play"}, + {0x12, 0x01, 0x30, 0x30, "4 coin 1 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x12, 0x01, 0xC0, 0x00, "1 coin 2 play"}, + {0x12, 0x01, 0xC0, 0x40, "1 coin 3 play"}, + {0x12, 0x01, 0xC0, 0x80, "1 coin 4 play"}, + {0x12, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, +#endif + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x13, 0x01, 0x03, 0x00, "B"}, + {0x13, 0x01, 0x03, 0x01, "A"}, + {0x13, 0x01, 0x03, 0x02, "C"}, + {0x13, 0x01, 0x03, 0x03, "D"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x13, 0x01, 0x0C, 0x00, "70000, every 200000"}, + {0x13, 0x01, 0x0C, 0x04, "50000, every 150000"}, + {0x13, 0x01, 0x0C, 0x08, "100000 only"}, + {0x13, 0x01, 0x0C, 0x0C, "No extend"}, + {0, 0xFE, 0, 4, "Number of heros"}, + {0x13, 0x01, 0x30, 0x30, "2"}, + {0x13, 0x01, 0x30, 0x00, "3"}, + {0x13, 0x01, 0x30, 0x20, "4"}, + {0x13, 0x01, 0x30, 0x10, "5"}, + {0, 0xFE, 0, 2, "Dip Switch Display"}, + {0x13, 0x01, 0x40, 0x00, "Off"}, + {0x13, 0x01, 0x40, 0x40, "On"}, + {0, 0xFE, 0, 2, "Allow Continue"}, + {0x13, 0x01, 0x80, 0x00, "Yes"}, + {0x13, 0x01, 0x80, 0x80, "No"}, + + // Region + {0, 0xFE, 0, 5, "Region"}, + {0x14, 0x01, 0x07, 0x00, "Japan/Taito Corp"}, + {0x14, 0x01, 0x07, 0x01, "US/Romstar"}, + {0x14, 0x01, 0x07, 0x02, "World/Taito Corp"}, + {0x14, 0x01, 0x07, 0x04, "US/Taito America"}, + {0x14, 0x01, 0x07, 0x06, "World/Taito America"}, +}; + +STDDIPINFO(truxton) + +static INT32 __fastcall DrvResetCallback() +{ + // Reset instruction on 68000 + + ZetReset(); // Reset Z80 (CPU #1) + BurnYM3812Reset(); + return 0; +} + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *Ram01, *RamPal, *RamPal2; + +static INT32 nColCount = 0x0400; + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x040000; // + RomZ80 = Next; Next += 0x008000; // Z80 ROM + BCU2ROM = Next; Next += nBCU2ROMSize; // BCU-2 tile data + FCU2ROM = Next; Next += nFCU2ROMSize; // FCU-2 tile data + RamStart = Next; + Ram01 = Next; Next += 0x004000; // CPU #0 work RAM + RamPal = Next; Next += 0x001000; // palette + RamPal2 = Next; Next += 0x001000; // palette + RamZ80 = Next; Next += 0x008000; // Z80 RAM + BCU2RAM = Next; Next += 0x010000; + FCU2RAM = Next; Next += 0x000800; + FCU2RAMSize = Next; Next += 0x000080; + RamEnd = Next; + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32* pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029402; + } + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); // scan 68000 states + ZetScan(nAction); // Scan Z80 + + BurnYM3812Scan(nAction, pnMin); + + SCAN_VAR(DrvInput); + SCAN_VAR(nCyclesDone); + } + + return 0; +} + +static INT32 LoadRoms() +{ + // Load 68000 ROM + ToaLoadCode(Rom01, 0, 2); + + // Load BCU-2 tile data + ToaLoadTiles(BCU2ROM, 2, nBCU2ROMSize); + + // Load FCU-2 tile data + ToaLoadTiles(FCU2ROM, 6, nFCU2ROMSize); + + // Load the Z80 ROM + BurnLoadRom(RomZ80, 10, 1); + + return 0; +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall truxtonZ80In(UINT16 nAddress) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x60: + return BurnYM3812Read(0); + case 0x40: // DIP A + return DrvInput[2]; + case 0x50: // DIP B + return DrvInput[3]; + case 0x20: // Sysytem inputs + return DrvInput[4] | (ToaVBlankRegister() << 7); + case 0x00: // Player 1 + return DrvInput[0]; + case 0x10: // Player 2 + return DrvInput[1]; + case 0x70: // Region + return DrvInput[5]; + + } + +// bprintf(PRINT_NORMAL, _T("z80 read %4X\n"), nAddress); + + return 0; +} + +void __fastcall truxtonZ80Out(UINT16 nAddress, UINT8 nValue) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0x60: + BurnYM3812Write(0, nValue); + break; + case 0x61: + BurnYM3812Write(1, nValue); + break; + + case 0x30: // Coin counter + break; + +// default: +// bprintf(PRINT_NORMAL, _T("Z80 attempted to write address %04X with value %02X.\n"), nAddress, nValue); + } +} + +static INT32 DrvZ80Init() +{ + // Init the Z80 + ZetInit(0); + ZetOpen(0); + + ZetSetInHandler(truxtonZ80In); + ZetSetOutHandler(truxtonZ80Out); + + // ROM + ZetMapArea (0x0000, 0x7FFF, 0, RomZ80); // Direct Read from ROM + ZetMapArea (0x0000, 0x7FFF, 2, RomZ80); // Direct Fetch from ROM + // RAM + ZetMapArea (0x8000, 0xFFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0x8000, 0xFFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0x8000, 0xFFFF, 2, RamZ80); // + + + ZetClose(); + + return 0; +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall truxtonReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x0c0001: + case 0x140001: + return ToaVBlankRegister(); + + default: { +// bprintf(PRINT_NORMAL, _T("Read Byte %06X.\n"), sekAddress); + } + } + + return 0; +} + +UINT16 __fastcall truxtonReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x0c0002: + return ToaFCU2GetRAMPointer(); + case 0x0c0004: + return ToaFCU2ReadRAM(); + case 0x0c0006: + return ToaFCU2ReadRAMSize(); + + case 0x100002: + return ToaBCU2GetRAMPointer(); + case 0x100004: + return ToaBCU2ReadRAM_Hi(); + case 0x100006: + return ToaBCU2ReadRAM_Lo(); + + case 0x100010: + case 0x100011: + case 0x100012: + case 0x100013: + case 0x100014: + case 0x100015: + case 0x100016: + case 0x100017: + case 0x100018: + case 0x100019: + case 0x10001A: + case 0x10001B: + case 0x10001C: + case 0x10001D: + case 0x10001E: + case 0x10001F: + return BCU2Reg[(sekAddress & 15) >> 1]; + + case 0x0c0000: + case 0x140000: + return ToaVBlankRegister(); + + default: { +// bprintf(PRINT_NORMAL, _T("Read Word %06X.\n"), sekAddress); + } + } + + return 0; +} + +void __fastcall truxtonWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + + case 0x140003: + bEnableInterrupts = byteValue; + break; + + case 0x0c0006: + ToaFCU2WriteRAMSize(byteValue); + break; + + default: { +// bprintf(PRINT_NORMAL, _T("Write byte %06X, %02X.\n"), sekAddress, byteValue); + } + } +} + +void __fastcall truxtonWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + + case 0x0c0002: // FCU-2 set VRAM address-pointer + ToaFCU2SetRAMPointer(wordValue); + break; + case 0x0c0004: + ToaFCU2WriteRAM(wordValue); + break; + case 0x0c0006: + ToaFCU2WriteRAMSize(wordValue); + break; + + case 0x100000: // BCU-2 flip + break; + case 0x100002: // BCU-2 set VRAM address-pointer + ToaBCU2SetRAMPointer(wordValue); + break; + case 0x100004: + ToaBCU2WriteRAM(wordValue); + break; + case 0x100006: + ToaBCU2WriteRAM(wordValue); + break; + + case 0x100010: + case 0x100011: + case 0x100012: + case 0x100013: + case 0x100014: + case 0x100015: + case 0x100016: + case 0x100017: + case 0x100018: + case 0x100019: + case 0x10001A: + case 0x10001B: + case 0x10001C: + case 0x10001D: + case 0x10001E: + case 0x10001F: + BCU2Reg[(sekAddress & 15) >> 1] = wordValue; + break; + + case 0x140002: + bEnableInterrupts = (wordValue & 0xFF); + break; + + case 0x1c0000: + nBCU2TileXOffset = wordValue; + break; + case 0x1c0002: + nBCU2TileYOffset = wordValue; + break; + + case 0x1c0006: // FCU-2 flip + break; + + case 0x1d0000: + if (wordValue == 0) DrvResetCallback(); + break; + + default: { +// bprintf(PRINT_NORMAL, _T("Write word %06X, %04X.\n"), sekAddress, wordValue); + } + } +} + +// ---------------------------------------------------------------------------- + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + + bEnableInterrupts = false; + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + +#ifdef DRIVER_ROTATION + bToaRotateScreen = true; +#endif + + BurnSetRefreshRate(REFRESHRATE); + + nBCU2ROMSize = 0x080000; + nFCU2ROMSize = 0x080000; + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x03FFFF, SM_ROM); // 68K ROM + SekMapMemory(Ram01, 0x080000, 0x083FFF, SM_RAM); // 68K RAM + SekMapMemory(RamPal, 0x144000, 0x1447FF, SM_RAM); // BCU-2 palette RAM + SekMapMemory(RamPal2, 0x146000, 0x1467FF, SM_RAM); // FCU-2 palette RAM + + SekSetReadWordHandler(0, truxtonReadWord); + SekSetReadByteHandler(0, truxtonReadByte); + SekSetWriteWordHandler(0, truxtonWriteWord); + SekSetWriteByteHandler(0, truxtonWriteByte); + + SekMapHandler(1, 0x180000, 0x180FFF, SM_RAM); // Z80 RAM + + SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); + SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); + SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); + SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); + + SekClose(); + } + + ToaInitBCU2(); + + DrvZ80Init(); // Initialize Z80 + + nToaPalLen = nColCount; + ToaPalSrc = RamPal; + ToaPalSrc2 = RamPal2; + ToaPalInit(); + + BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); + BurnTimerAttachZetYM3812(28000000 / 8); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + return 0; +} + +static INT32 DrvExit() +{ + BurnYM3812Exit(); + ToaPalExit(); + + ToaExitBCU2(); + ToaZExit(); // Z80 exit + SekExit(); // Deallocate 68000s + + BurnFree(Mem); + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0x120); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderBCU2(); // Render BCU2 graphics + } + + ToaPalUpdate(); // Update the palette + ToaPal2Update(); + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 4; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x00; // Buttons + DrvInput[1] = 0x00; // Player 1 + DrvInput[4] = 0x00; // Player 2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[4] |= (DrvButton[i] & 1) << i; + } + ToaClearOpposites(&DrvInput[0]); + ToaClearOpposites(&DrvInput[1]); + + SekNewFrame(); + ZetNewFrame(); + + SekOpen(0); + ZetOpen(0); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); + nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext; + + // Run 68000 + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + + // Trigger VBlank interrupt + if (nNext > nToaCyclesVBlankStart) { + if (SekTotalCycles() < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); + SekRun(nCyclesSegment); + } + + if (pBurnDraw) { + DrvDraw(); // Draw screen if needed + } + + ToaBufferFCU2Sprites(); + + bVBlank = true; + if (bEnableInterrupts) { + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + } + + nCyclesSegment = nNext - SekTotalCycles(); + if (bVBlank || (!CheckSleep(0))) { // See if this CPU is busywaiting + SekRun(nCyclesSegment); + } else { + SekIdle(nCyclesSegment); + } + + BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); + } + + nToa1Cycles68KSync = SekTotalCycles(); + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; + +// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); + + ZetClose(); + SekClose(); + +// ToaBufferFCU2Sprites(); + + return 0; +} + +struct BurnDriver BurnDrvTruxton = { + "truxton", NULL, NULL, NULL, "1988", + "Truxton\0Tatsujin\0", NULL, "[Toaplan] Taito Corporation", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | TOA_ROTATE_GRAPHICS_CCW, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0, + NULL, truxtonRomInfo, truxtonRomName, NULL, NULL, truxtonInputInfo, truxtonDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 240, 320, 3, 4 +}; diff --git a/src/burn/drv/toaplan/d_zerowing.cpp b/src/burn/drv/toaplan/d_zerowing.cpp index 6b74a317f..ad4e36f64 100644 --- a/src/burn/drv/toaplan/d_zerowing.cpp +++ b/src/burn/drv/toaplan/d_zerowing.cpp @@ -1,755 +1,754 @@ -// Zero Wing - -#include "toaplan.h" - -#define REFRESHRATE 60 -#define VBLANK_LINES (32) - -static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static UINT8 DrvReset = 0; -static UINT8 bDrawScreen; -static bool bVBlank; - -static bool bEnableInterrupts; - -// Rom information -static struct BurnRomInfo zerowingRomDesc[] = { - { "o15-11.rom", 0x008000, 0x6ff2b9a0, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "o15-12.rom", 0x008000, 0x9773e60b, BRF_ESS | BRF_PRG }, // 1 - { "o15-09.rom", 0x020000, 0x13764e95, BRF_ESS | BRF_PRG }, // 1 - { "o15-10.rom", 0x020000, 0x351ba71a, BRF_ESS | BRF_PRG }, // 1 - - { "o15-05.rom", 0x020000, 0x4e5dd246, BRF_GRA }, // 6 - { "o15-06.rom", 0x020000, 0xc8c6d428, BRF_GRA }, // 7 - { "o15-07.rom", 0x020000, 0xefc40e99, BRF_GRA }, // 8 - { "o15-08.rom", 0x020000, 0x1b019eab, BRF_GRA }, // 9 - - { "o15-03.rom", 0x020000, 0x7f245fd3, BRF_GRA }, // 2 - { "o15-04.rom", 0x020000, 0x0b1a1289, BRF_GRA }, // 3 - { "o15-01.rom", 0x020000, 0x70570e43, BRF_GRA }, // 4 - { "o15-02.rom", 0x020000, 0x724b487f, BRF_GRA }, // 5 - - { "o15-13.rom", 0x008000, 0xe7b72383, BRF_ESS | BRF_PRG }, // 10 Z80 program - - { "tp015_14.bpr", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM - { "tp015_15.bpr", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? -}; - - -STD_ROM_PICK(zerowing) -STD_ROM_FN(zerowing) - -static struct BurnRomInfo zerowng2RomDesc[] = { - { "o15-11iiw.bin",0x008000, 0x38b0bb5b, BRF_ESS | BRF_PRG }, // 0 CPU #0 code - { "o15-12iiw.bin",0x008000, 0x74c91e6f, BRF_ESS | BRF_PRG }, // 1 - { "o15-09.rom", 0x020000, 0x13764e95, BRF_ESS | BRF_PRG }, // 1 - { "o15-10.rom", 0x020000, 0x351ba71a, BRF_ESS | BRF_PRG }, // 1 - - { "o15-05.rom", 0x020000, 0x4e5dd246, BRF_GRA }, // 6 - { "o15-06.rom", 0x020000, 0xc8c6d428, BRF_GRA }, // 7 - { "o15-07.rom", 0x020000, 0xefc40e99, BRF_GRA }, // 8 - { "o15-08.rom", 0x020000, 0x1b019eab, BRF_GRA }, // 9 - - { "o15-03.rom", 0x020000, 0x7f245fd3, BRF_GRA }, // 2 - { "o15-04.rom", 0x020000, 0x0b1a1289, BRF_GRA }, // 3 - { "o15-01.rom", 0x020000, 0x70570e43, BRF_GRA }, // 4 - { "o15-02.rom", 0x020000, 0x724b487f, BRF_GRA }, // 5 - - { "o15-13.rom", 0x008000, 0xe7b72383, BRF_ESS | BRF_PRG }, // 10 Z80 program - - { "tp015_14.bpr", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM - { "tp015_15.bpr", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? -}; - - -STD_ROM_PICK(zerowng2) -STD_ROM_FN(zerowng2) - -static struct BurnInputInfo zerowingInputList[] = { - {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, - {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, - - {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, - {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, - {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, - {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, - {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, - {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, - - {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, - {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, - - {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, - {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, - {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, - {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, - {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, - {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, - - {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, - {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, - {"Dip A", BIT_DIPSWITCH, DrvInput + 2, "dip"}, - {"Dip B", BIT_DIPSWITCH, DrvInput + 3, "dip"}, - {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, -}; - -STDINPUTINFO(zerowing) - -static struct BurnDIPInfo zerowingDIPList[] = { - // Defaults - {0x12, 0xFF, 0xFF, 0x01, NULL}, - {0x13, 0xFF, 0xFF, 0x00, NULL}, - {0x14, 0xFF, 0xFF, 0x02, NULL}, - - // DIP 1 - {0x12, 0x01, 0x01, 0x01, "Upright"}, - {0x12, 0x01, 0x01, 0x00, "Cocktail"}, - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x02, 0x00, "Normal screen"}, - {0x12, 0x01, 0x02, 0x02, "Invert screen"}, - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x04, 0x00, "Normal mode"}, - {0x12, 0x01, 0x04, 0x04, "Screen test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x12, 0x01, 0x08, 0x00, "On"}, - {0x12, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, - {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x12, 0x01, 0x30, 0x10, "2 coin 1 play"}, - {0x12, 0x01, 0x30, 0x20, "3 coin 1 play"}, - {0x12, 0x01, 0x30, 0x30, "4 coin 1 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x12, 0x01, 0xC0, 0x00, "1 coin 2 play"}, - {0x12, 0x01, 0xC0, 0x40, "1 coin 3 play"}, - {0x12, 0x01, 0xC0, 0x80, "1 coin 4 play"}, - {0x12, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, - - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x13, 0x01, 0x03, 0x00, "B"}, - {0x13, 0x01, 0x03, 0x01, "A"}, - {0x13, 0x01, 0x03, 0x02, "C"}, - {0x13, 0x01, 0x03, 0x03, "D"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x13, 0x01, 0x0C, 0x00, "200000, every 500000"}, - {0x13, 0x01, 0x0C, 0x04, "500000, every 1000000"}, - {0x13, 0x01, 0x0C, 0x08, "500000 only"}, - {0x13, 0x01, 0x0C, 0x0C, "Never"}, - {0, 0xFE, 0, 4, "Hero counts"}, - {0x13, 0x01, 0x30, 0x30, "2"}, - {0x13, 0x01, 0x30, 0x00, "3"}, - {0x13, 0x01, 0x30, 0x20, "4"}, - {0x13, 0x01, 0x30, 0x10, "5"}, - {0, 0xFE, 0, 2, NULL}, - {0x13, 0x01, 0x40, 0x00, "Normal Game"}, - {0x13, 0x01, 0x40, 0x40, "No death & stop mode"}, - {0, 0xFE, 0, 2, "Allow Continue"}, - {0x13, 0x01, 0x80, 0x00, "Yes"}, - {0x13, 0x01, 0x80, 0x80, "No"}, - - // Region - {0, 0xFE, 0, 3, "Region"}, - {0x14, 0x01, 0x03, 0x00, "Japan"}, - {0x14, 0x01, 0x03, 0x01, "US"}, - {0x14, 0x01, 0x03, 0x02, "Europe"}, -}; - -STDDIPINFO(zerowing) - -static struct BurnDIPInfo zerowng2DIPList[] = { - // Defaults - {0x12, 0xFF, 0xFF, 0x01, NULL}, - {0x13, 0xFF, 0xFF, 0x00, NULL}, - {0x14, 0xFF, 0xFF, 0x00, NULL}, - - // DIP 1 - {0x12, 0x01, 0x01, 0x01, "Upright"}, - {0x12, 0x01, 0x01, 0x00, "Cocktail"}, - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x02, 0x00, "Normal screen"}, - {0x12, 0x01, 0x02, 0x02, "Invert screen"}, - {0, 0xFE, 0, 2, NULL}, - {0x12, 0x01, 0x04, 0x00, "Normal mode"}, - {0x12, 0x01, 0x04, 0x04, "Screen test mode"}, - {0, 0xFE, 0, 2, "Advertise sound"}, - {0x12, 0x01, 0x08, 0x00, "On"}, - {0x12, 0x01, 0x08, 0x08, "Off"}, - {0, 0xFE, 0, 4, "Coin A"}, - {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, - {0x12, 0x01, 0x30, 0x10, "2 coin 1 play"}, - {0x12, 0x01, 0x30, 0x20, "3 coin 1 play"}, - {0x12, 0x01, 0x30, 0x30, "4 coin 1 play"}, - {0, 0xFE, 0, 4, "Coin B"}, - {0x12, 0x01, 0xC0, 0x00, "1 coin 2 play"}, - {0x12, 0x01, 0xC0, 0x40, "1 coin 3 play"}, - {0x12, 0x01, 0xC0, 0x80, "1 coin 4 play"}, - {0x12, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, - - // DIP 2 - {0, 0xFE, 0, 4, "Game difficulty"}, - {0x13, 0x01, 0x03, 0x00, "B"}, - {0x13, 0x01, 0x03, 0x01, "A"}, - {0x13, 0x01, 0x03, 0x02, "C"}, - {0x13, 0x01, 0x03, 0x03, "D"}, - {0, 0xFE, 0, 4, "Extend bonus"}, - {0x13, 0x01, 0x0C, 0x00, "200000, every 500000"}, - {0x13, 0x01, 0x0C, 0x04, "500000, every 1000000"}, - {0x13, 0x01, 0x0C, 0x08, "500000 only"}, - {0x13, 0x01, 0x0C, 0x0C, "Never"}, - {0, 0xFE, 0, 4, "Hero counts"}, - {0x13, 0x01, 0x30, 0x30, "2"}, - {0x13, 0x01, 0x30, 0x00, "3"}, - {0x13, 0x01, 0x30, 0x20, "4"}, - {0x13, 0x01, 0x30, 0x10, "5"}, - {0, 0xFE, 0, 2, NULL}, - {0x13, 0x01, 0x40, 0x00, "Normal Game"}, - {0x13, 0x01, 0x40, 0x40, "No death & stop mode"}, - {0, 0xFE, 0, 2, "Allow Continue"}, - {0x13, 0x01, 0x80, 0x00, "Yes"}, - {0x13, 0x01, 0x80, 0x80, "No"}, -}; - -STDDIPINFO(zerowng2) - -static UINT8 *Mem = NULL, *MemEnd = NULL; -static UINT8 *RamStart, *RamEnd; -static UINT8 *Rom01; -static UINT8 *Ram01, *RamPal, *RamPal2; - -static INT32 nColCount = 0x0400; - -// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), -// and then afterwards to set up all the pointers -static INT32 MemIndex() -{ - UINT8 *Next; Next = Mem; - Rom01 = Next; Next += 0x080000; // - RomZ80 = Next; Next += 0x008000; // Z80 ROM - BCU2ROM = Next; Next += nBCU2ROMSize; // BCU-2 tile data - FCU2ROM = Next; Next += nFCU2ROMSize; // FCU-2 tile data - RamStart = Next; - Ram01 = Next; Next += 0x008000; // CPU #0 work RAM - RamPal = Next; Next += 0x001000; // palette - RamPal2 = Next; Next += 0x001000; // palette - RamZ80 = Next; Next += 0x008000; // Z80 RAM - BCU2RAM = Next; Next += 0x010000; - FCU2RAM = Next; Next += 0x000800; - FCU2RAMSize = Next; Next += 0x000080; - RamEnd = Next; - ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); - MemEnd = Next; - - return 0; -} - -// Scan ram -static INT32 DrvScan(INT32 nAction, INT32* pnMin) -{ - struct BurnArea ba; - - if (pnMin != NULL) { // Return minimum compatible version - *pnMin = 0x029402; - } - if (nAction & ACB_VOLATILE) { // Scan volatile ram - memset(&ba, 0, sizeof(ba)); - ba.Data = RamStart; - ba.nLen = RamEnd - RamStart; - ba.szName = "RAM"; - BurnAcb(&ba); - - SekScan(nAction); // scan 68000 states - ZetScan(nAction); // Scan Z80 - - BurnYM3812Scan(nAction, pnMin); - - SCAN_VAR(DrvInput); - SCAN_VAR(nCyclesDone); - } - - return 0; -} - -static INT32 LoadRoms() -{ - // Load 68000 ROM - ToaLoadCode(Rom01, 0, 2); - BurnLoadRom(Rom01 + 0x40001, 2, 2); - BurnLoadRom(Rom01 + 0x40000, 3, 2); - - // Load BCU-2 tile data - ToaLoadTiles(BCU2ROM, 4, nBCU2ROMSize); - - // Load FCU-2 tile data - ToaLoadTiles(FCU2ROM, 8, nFCU2ROMSize); - - // Load the Z80 ROM - BurnLoadRom(RomZ80, 12, 1); - - return 0; -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall zerowingZ80In(UINT16 nAddress) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0xa8: - return BurnYM3812Read(0); - case 0x20: // DIP A - return DrvInput[2]; - case 0x28: // DIP B - return DrvInput[3]; - case 0x80: // Sysytem inputs - return DrvInput[4] | (ToaVBlankRegister() << 7); - case 0x00: // Player 1 - return DrvInput[0]; - case 0x08: // Player 2 - return DrvInput[1]; - case 0x88: // Region - return DrvInput[5]; - - } - -// bprintf(PRINT_NORMAL, _T("z80 read %4X\n"), nAddress); - - return 0; -} - -void __fastcall zerowingZ80Out(UINT16 nAddress, UINT8 nValue) -{ - nAddress &= 0xFF; - - switch (nAddress) { - case 0xa8: - BurnYM3812Write(0, nValue); - break; - case 0xa9: - BurnYM3812Write(1, nValue); - break; - - case 0xa0: // Coin counter - break; - -// default: -// bprintf(PRINT_NORMAL, _T("Z80 attempted to write address %04X with value %02X.\n"), nAddress, nValue); - } -} - -static INT32 DrvZ80Init() -{ - // Init the Z80 - ZetInit(0); - ZetOpen(0); - - ZetSetInHandler(zerowingZ80In); - ZetSetOutHandler(zerowingZ80Out); - - // ROM - ZetMapArea (0x0000, 0x7FFF, 0, RomZ80); // Direct Read from ROM - ZetMapArea (0x0000, 0x7FFF, 2, RomZ80); // Direct Fetch from ROM - // RAM - ZetMapArea (0x8000, 0xFFFF, 0, RamZ80); // Direct Read from RAM - ZetMapArea (0x8000, 0xFFFF, 1, RamZ80); // Direct Write to RAM - ZetMapArea (0x8000, 0xFFFF, 2, RamZ80); // - - ZetMemEnd(); - - ZetClose(); - - return 0; -} - -// ---------------------------------------------------------------------------- - -UINT8 __fastcall zerowingReadByte(UINT32 sekAddress) -{ - switch (sekAddress) { - case 0x400001: - case 0x4c0001: - return ToaVBlankRegister(); - - default: { -// bprintf(PRINT_NORMAL, _T("Read Byte %06X.\n"), sekAddress); - } - } - - return 0; -} - -UINT16 __fastcall zerowingReadWord(UINT32 sekAddress) -{ - switch (sekAddress) { - - case 0x4c0002: - return ToaFCU2GetRAMPointer(); - case 0x4c0004: - return ToaFCU2ReadRAM(); - case 0x4c0006: - return ToaFCU2ReadRAMSize(); - - case 0x480002: - return ToaBCU2GetRAMPointer(); - case 0x480004: - return ToaBCU2ReadRAM_Hi(); - case 0x480006: - return ToaBCU2ReadRAM_Lo(); - - case 0x480010: - case 0x480011: - case 0x480012: - case 0x480013: - case 0x480014: - case 0x480015: - case 0x480016: - case 0x480017: - case 0x480018: - case 0x480019: - case 0x48001A: - case 0x48001B: - case 0x48001C: - case 0x48001D: - case 0x48001E: - case 0x48001F: - return BCU2Reg[(sekAddress & 15) >> 1]; - - case 0x400000: - case 0x4c0000: - return ToaVBlankRegister(); - - default: { -// bprintf(PRINT_NORMAL, _T("Read Word %06X.\n"), sekAddress); - } - } - - return 0; -} - -void __fastcall zerowingWriteByte(UINT32 sekAddress, UINT8 byteValue) -{ - switch (sekAddress) { - - case 0x400003: - bEnableInterrupts = byteValue; - break; - - case 0x4c0006: - ToaFCU2WriteRAMSize(byteValue); - break; - - default: { -// bprintf(PRINT_NORMAL, _T("Write byte %06X, %02X.\n"), sekAddress, byteValue); - } - } -} - -void __fastcall zerowingWriteWord(UINT32 sekAddress, UINT16 wordValue) -{ - switch (sekAddress) { - - case 0x4c0002: // FCU-2 set VRAM address-pointer - ToaFCU2SetRAMPointer(wordValue); - break; - case 0x4c0004: - ToaFCU2WriteRAM(wordValue); - break; - case 0x4c0006: - ToaFCU2WriteRAMSize(wordValue); - break; - - case 0x480000: // BCU-2 flip - break; - case 0x480002: // BCU-2 set VRAM address-pointer - ToaBCU2SetRAMPointer(wordValue); - break; - case 0x480004: - ToaBCU2WriteRAM(wordValue); - break; - case 0x480006: - ToaBCU2WriteRAM(wordValue); - break; - - case 0x480010: - case 0x480011: - case 0x480012: - case 0x480013: - case 0x480014: - case 0x480015: - case 0x480016: - case 0x480017: - case 0x480018: - case 0x480019: - case 0x48001A: - case 0x48001B: - case 0x48001C: - case 0x48001D: - case 0x48001E: - case 0x48001F: - BCU2Reg[(sekAddress & 15) >> 1] = wordValue; - break; - - case 0x400002: - bEnableInterrupts = (wordValue & 0xFF); - break; - - case 0x0c0000: - nBCU2TileXOffset = wordValue; - break; - case 0x0c0002: - nBCU2TileYOffset = wordValue; - break; - - case 0x0c0006: // FCU-2 flip - break; - - default: { -// bprintf(PRINT_NORMAL, _T("Write word %06X, %04X.\n"), sekAddress, wordValue); - } - } -} - -// ---------------------------------------------------------------------------- - -static INT32 DrvDoReset() -{ - SekOpen(0); - SekReset(); - SekClose(); - ZetOpen(0); - ZetReset(); - ZetClose(); - - BurnYM3812Reset(); - - bEnableInterrupts = false; - - return 0; -} - -static INT32 DrvInit() -{ - INT32 nLen; - - Hellfire = 1; - -#ifdef DRIVER_ROTATION - bToaRotateScreen = true; -#endif - - BurnSetRefreshRate(REFRESHRATE); - - nBCU2ROMSize = 0x080000; - nFCU2ROMSize = 0x080000; - - // Find out how much memory is needed - Mem = NULL; - MemIndex(); - nLen = MemEnd - (UINT8 *)0; - if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { - return 1; - } - memset(Mem, 0, nLen); // blank all memory - MemIndex(); // Index the allocated memory - - // Load the roms into memory - if (LoadRoms()) { - return 1; - } - - { - SekInit(0, 0x68000); // Allocate 68000 - SekOpen(0); - - // Map 68000 memory: - SekMapMemory(Rom01, 0x000000, 0x00FFFF, SM_ROM); // 68K ROM - SekMapMemory(Rom01 + 0x040000, 0x040000, 0x07FFFF, SM_ROM); // 68K ROM - SekMapMemory(Ram01, 0x080000, 0x087FFF, SM_RAM); // 68K RAM - SekMapMemory(RamPal, 0x404000, 0x4047FF, SM_RAM); // BCU-2 palette RAM - SekMapMemory(RamPal2, 0x406000, 0x4067FF, SM_RAM); // FCU-2 palette RAM - - SekSetReadWordHandler(0, zerowingReadWord); - SekSetReadByteHandler(0, zerowingReadByte); - SekSetWriteWordHandler(0, zerowingWriteWord); - SekSetWriteByteHandler(0, zerowingWriteByte); - - SekMapHandler(1, 0x440000, 0x440FFF, SM_RAM); // Z80 RAM - - SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); - SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); - SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); - SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); - - SekClose(); - } - - ToaInitBCU2(); - - DrvZ80Init(); // Initialize Z80 - - nToaPalLen = nColCount; - ToaPalSrc = RamPal; - ToaPalSrc2 = RamPal2; - ToaPalInit(); - - BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); - BurnTimerAttachZetYM3812(28000000 / 8); - BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); - - bDrawScreen = true; - - DrvDoReset(); // Reset machine - return 0; -} - -static INT32 DrvExit() -{ - BurnYM3812Exit(); - ToaPalExit(); - - ToaExitBCU2(); - ToaZExit(); // Z80 exit - SekExit(); // Deallocate 68000s - - BurnFree(Mem); - - Hellfire = 0; - - return 0; -} - -static INT32 DrvDraw() -{ - ToaClearScreen(0x120); -// BurnClearScreen(); - - if (bDrawScreen) { - ToaGetBitmap(); - ToaRenderBCU2(); // Render BCU2 graphics - } - - ToaPalUpdate(); // Update the palette - ToaPal2Update(); - - return 0; -} - -inline static INT32 CheckSleep(INT32) -{ - return 0; -} - -static INT32 DrvFrame() -{ - INT32 nInterleave = 4; - - if (DrvReset) { // Reset machine - DrvDoReset(); - } - - // Compile digital inputs - DrvInput[0] = 0x00; // Buttons - DrvInput[1] = 0x00; // Player 1 - DrvInput[4] = 0x00; // Player 2 - for (INT32 i = 0; i < 8; i++) { - DrvInput[0] |= (DrvJoy1[i] & 1) << i; - DrvInput[1] |= (DrvJoy2[i] & 1) << i; - DrvInput[4] |= (DrvButton[i] & 1) << i; - } - ToaClearOpposites(&DrvInput[0]); - ToaClearOpposites(&DrvInput[1]); - - SekOpen(0); - ZetOpen(0); - - SekNewFrame(); - ZetNewFrame(); - - SekIdle(nCyclesDone[0]); - ZetIdle(nCyclesDone[1]); - - nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); - nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); - - SekSetCyclesScanline(nCyclesTotal[0] / 262); - nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); - nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); - bVBlank = false; - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nNext; - - // Run 68000 - - nNext = (i + 1) * nCyclesTotal[0] / nInterleave; - - // Trigger VBlank interrupt - if (nNext > nToaCyclesVBlankStart) { - if (SekTotalCycles() < nToaCyclesVBlankStart) { - nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); - SekRun(nCyclesSegment); - } - - if (pBurnDraw) { - DrvDraw(); // Draw screen if needed - } - - ToaBufferFCU2Sprites(); - - bVBlank = true; - if (bEnableInterrupts) { - SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); - } - } - - nCyclesSegment = nNext - SekTotalCycles(); - if (bVBlank || (!CheckSleep(0))) { // See if this CPU is busywaiting - SekRun(nCyclesSegment); - } else { - SekIdle(nCyclesSegment); - } - - BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); - } - - nToa1Cycles68KSync = SekTotalCycles(); - BurnTimerEndFrameYM3812(nCyclesTotal[1]); - if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); - - nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; - nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; - -// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); - - ZetClose(); - SekClose(); - -// ToaBufferFCU2Sprites(); - - return 0; -} - -struct BurnDriver BurnDrvZerowing = { - "zerowing", NULL, NULL, NULL, "1989", - "Zero Wing\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, - NULL, zerowingRomInfo, zerowingRomName, NULL, NULL, zerowingInputInfo, zerowingDIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 320, 240, 4, 3 -}; - -struct BurnDriver BurnDrvZerowng2 = { - "zerowing2", "zerowing", NULL, NULL, "1989", - "Zero Wing (2 player simultaneous ver.)\0", NULL, "[Toaplan] Williams Electronics Games, Inc", "Toaplan BCU-2 / FCU-2 based", - NULL, NULL, NULL, NULL, - BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, - NULL, zerowng2RomInfo, zerowng2RomName, NULL, NULL, zerowingInputInfo, zerowng2DIPInfo, - DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, - 320, 240, 4, 3 -}; +// Zero Wing + +#include "toaplan.h" + +#define REFRESHRATE 60 +#define VBLANK_LINES (32) + +static UINT8 DrvButton[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static UINT8 DrvInput[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static UINT8 DrvReset = 0; +static UINT8 bDrawScreen; +static bool bVBlank; + +static bool bEnableInterrupts; + +// Rom information +static struct BurnRomInfo zerowingRomDesc[] = { + { "o15-11.rom", 0x008000, 0x6ff2b9a0, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "o15-12.rom", 0x008000, 0x9773e60b, BRF_ESS | BRF_PRG }, // 1 + { "o15-09.rom", 0x020000, 0x13764e95, BRF_ESS | BRF_PRG }, // 1 + { "o15-10.rom", 0x020000, 0x351ba71a, BRF_ESS | BRF_PRG }, // 1 + + { "o15-05.rom", 0x020000, 0x4e5dd246, BRF_GRA }, // 6 + { "o15-06.rom", 0x020000, 0xc8c6d428, BRF_GRA }, // 7 + { "o15-07.rom", 0x020000, 0xefc40e99, BRF_GRA }, // 8 + { "o15-08.rom", 0x020000, 0x1b019eab, BRF_GRA }, // 9 + + { "o15-03.rom", 0x020000, 0x7f245fd3, BRF_GRA }, // 2 + { "o15-04.rom", 0x020000, 0x0b1a1289, BRF_GRA }, // 3 + { "o15-01.rom", 0x020000, 0x70570e43, BRF_GRA }, // 4 + { "o15-02.rom", 0x020000, 0x724b487f, BRF_GRA }, // 5 + + { "o15-13.rom", 0x008000, 0xe7b72383, BRF_ESS | BRF_PRG }, // 10 Z80 program + + { "tp015_14.bpr", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM + { "tp015_15.bpr", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? +}; + + +STD_ROM_PICK(zerowing) +STD_ROM_FN(zerowing) + +static struct BurnRomInfo zerowng2RomDesc[] = { + { "o15-11iiw.bin",0x008000, 0x38b0bb5b, BRF_ESS | BRF_PRG }, // 0 CPU #0 code + { "o15-12iiw.bin",0x008000, 0x74c91e6f, BRF_ESS | BRF_PRG }, // 1 + { "o15-09.rom", 0x020000, 0x13764e95, BRF_ESS | BRF_PRG }, // 1 + { "o15-10.rom", 0x020000, 0x351ba71a, BRF_ESS | BRF_PRG }, // 1 + + { "o15-05.rom", 0x020000, 0x4e5dd246, BRF_GRA }, // 6 + { "o15-06.rom", 0x020000, 0xc8c6d428, BRF_GRA }, // 7 + { "o15-07.rom", 0x020000, 0xefc40e99, BRF_GRA }, // 8 + { "o15-08.rom", 0x020000, 0x1b019eab, BRF_GRA }, // 9 + + { "o15-03.rom", 0x020000, 0x7f245fd3, BRF_GRA }, // 2 + { "o15-04.rom", 0x020000, 0x0b1a1289, BRF_GRA }, // 3 + { "o15-01.rom", 0x020000, 0x70570e43, BRF_GRA }, // 4 + { "o15-02.rom", 0x020000, 0x724b487f, BRF_GRA }, // 5 + + { "o15-13.rom", 0x008000, 0xe7b72383, BRF_ESS | BRF_PRG }, // 10 Z80 program + + { "tp015_14.bpr", 0x000020, 0xbc88cced, BRF_SND }, // 11 Sprite attribute PROM + { "tp015_15.bpr", 0x000020, 0xa1e17492, BRF_SND }, // 12 ??? +}; + + +STD_ROM_PICK(zerowng2) +STD_ROM_FN(zerowng2) + +static struct BurnInputInfo zerowingInputList[] = { + {"P1 Coin", BIT_DIGITAL, DrvButton + 3, "p1 coin"}, + {"P1 Start", BIT_DIGITAL, DrvButton + 5, "p1 start"}, + + {"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up"}, + {"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down"}, + {"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left"}, + {"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right"}, + {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"}, + {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2"}, + + {"P2 Coin", BIT_DIGITAL, DrvButton + 4, "p2 coin"}, + {"P2 Start", BIT_DIGITAL, DrvButton + 6, "p2 start"}, + + {"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up"}, + {"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down"}, + {"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left"}, + {"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right"}, + {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"}, + {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2"}, + + {"Reset", BIT_DIGITAL, &DrvReset, "reset"}, + {"Diagnostics", BIT_DIGITAL, DrvButton + 0, "diag"}, + {"Dip A", BIT_DIPSWITCH, DrvInput + 2, "dip"}, + {"Dip B", BIT_DIPSWITCH, DrvInput + 3, "dip"}, + {"Dip C", BIT_DIPSWITCH, DrvInput + 5, "dip"}, +}; + +STDINPUTINFO(zerowing) + +static struct BurnDIPInfo zerowingDIPList[] = { + // Defaults + {0x12, 0xFF, 0xFF, 0x01, NULL}, + {0x13, 0xFF, 0xFF, 0x00, NULL}, + {0x14, 0xFF, 0xFF, 0x02, NULL}, + + // DIP 1 + {0x12, 0x01, 0x01, 0x01, "Upright"}, + {0x12, 0x01, 0x01, 0x00, "Cocktail"}, + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x02, 0x00, "Normal screen"}, + {0x12, 0x01, 0x02, 0x02, "Invert screen"}, + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x04, 0x00, "Normal mode"}, + {0x12, 0x01, 0x04, 0x04, "Screen test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x12, 0x01, 0x08, 0x00, "On"}, + {0x12, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, + {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x12, 0x01, 0x30, 0x10, "2 coin 1 play"}, + {0x12, 0x01, 0x30, 0x20, "3 coin 1 play"}, + {0x12, 0x01, 0x30, 0x30, "4 coin 1 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x12, 0x01, 0xC0, 0x00, "1 coin 2 play"}, + {0x12, 0x01, 0xC0, 0x40, "1 coin 3 play"}, + {0x12, 0x01, 0xC0, 0x80, "1 coin 4 play"}, + {0x12, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, + + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x13, 0x01, 0x03, 0x00, "B"}, + {0x13, 0x01, 0x03, 0x01, "A"}, + {0x13, 0x01, 0x03, 0x02, "C"}, + {0x13, 0x01, 0x03, 0x03, "D"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x13, 0x01, 0x0C, 0x00, "200000, every 500000"}, + {0x13, 0x01, 0x0C, 0x04, "500000, every 1000000"}, + {0x13, 0x01, 0x0C, 0x08, "500000 only"}, + {0x13, 0x01, 0x0C, 0x0C, "Never"}, + {0, 0xFE, 0, 4, "Hero counts"}, + {0x13, 0x01, 0x30, 0x30, "2"}, + {0x13, 0x01, 0x30, 0x00, "3"}, + {0x13, 0x01, 0x30, 0x20, "4"}, + {0x13, 0x01, 0x30, 0x10, "5"}, + {0, 0xFE, 0, 2, NULL}, + {0x13, 0x01, 0x40, 0x00, "Normal Game"}, + {0x13, 0x01, 0x40, 0x40, "No death & stop mode"}, + {0, 0xFE, 0, 2, "Allow Continue"}, + {0x13, 0x01, 0x80, 0x00, "Yes"}, + {0x13, 0x01, 0x80, 0x80, "No"}, + + // Region + {0, 0xFE, 0, 3, "Region"}, + {0x14, 0x01, 0x03, 0x00, "Japan"}, + {0x14, 0x01, 0x03, 0x01, "US"}, + {0x14, 0x01, 0x03, 0x02, "Europe"}, +}; + +STDDIPINFO(zerowing) + +static struct BurnDIPInfo zerowng2DIPList[] = { + // Defaults + {0x12, 0xFF, 0xFF, 0x01, NULL}, + {0x13, 0xFF, 0xFF, 0x00, NULL}, + {0x14, 0xFF, 0xFF, 0x00, NULL}, + + // DIP 1 + {0x12, 0x01, 0x01, 0x01, "Upright"}, + {0x12, 0x01, 0x01, 0x00, "Cocktail"}, + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x02, 0x00, "Normal screen"}, + {0x12, 0x01, 0x02, 0x02, "Invert screen"}, + {0, 0xFE, 0, 2, NULL}, + {0x12, 0x01, 0x04, 0x00, "Normal mode"}, + {0x12, 0x01, 0x04, 0x04, "Screen test mode"}, + {0, 0xFE, 0, 2, "Advertise sound"}, + {0x12, 0x01, 0x08, 0x00, "On"}, + {0x12, 0x01, 0x08, 0x08, "Off"}, + {0, 0xFE, 0, 4, "Coin A"}, + {0x12, 0x01, 0x30, 0x00, "1 coin 1 play"}, + {0x12, 0x01, 0x30, 0x10, "2 coin 1 play"}, + {0x12, 0x01, 0x30, 0x20, "3 coin 1 play"}, + {0x12, 0x01, 0x30, 0x30, "4 coin 1 play"}, + {0, 0xFE, 0, 4, "Coin B"}, + {0x12, 0x01, 0xC0, 0x00, "1 coin 2 play"}, + {0x12, 0x01, 0xC0, 0x40, "1 coin 3 play"}, + {0x12, 0x01, 0xC0, 0x80, "1 coin 4 play"}, + {0x12, 0x01, 0xC0, 0xC0, "1 coin 6 play"}, + + // DIP 2 + {0, 0xFE, 0, 4, "Game difficulty"}, + {0x13, 0x01, 0x03, 0x00, "B"}, + {0x13, 0x01, 0x03, 0x01, "A"}, + {0x13, 0x01, 0x03, 0x02, "C"}, + {0x13, 0x01, 0x03, 0x03, "D"}, + {0, 0xFE, 0, 4, "Extend bonus"}, + {0x13, 0x01, 0x0C, 0x00, "200000, every 500000"}, + {0x13, 0x01, 0x0C, 0x04, "500000, every 1000000"}, + {0x13, 0x01, 0x0C, 0x08, "500000 only"}, + {0x13, 0x01, 0x0C, 0x0C, "Never"}, + {0, 0xFE, 0, 4, "Hero counts"}, + {0x13, 0x01, 0x30, 0x30, "2"}, + {0x13, 0x01, 0x30, 0x00, "3"}, + {0x13, 0x01, 0x30, 0x20, "4"}, + {0x13, 0x01, 0x30, 0x10, "5"}, + {0, 0xFE, 0, 2, NULL}, + {0x13, 0x01, 0x40, 0x00, "Normal Game"}, + {0x13, 0x01, 0x40, 0x40, "No death & stop mode"}, + {0, 0xFE, 0, 2, "Allow Continue"}, + {0x13, 0x01, 0x80, 0x00, "Yes"}, + {0x13, 0x01, 0x80, 0x80, "No"}, +}; + +STDDIPINFO(zerowng2) + +static UINT8 *Mem = NULL, *MemEnd = NULL; +static UINT8 *RamStart, *RamEnd; +static UINT8 *Rom01; +static UINT8 *Ram01, *RamPal, *RamPal2; + +static INT32 nColCount = 0x0400; + +// This routine is called first to determine how much memory is needed (MemEnd-(UINT8 *)0), +// and then afterwards to set up all the pointers +static INT32 MemIndex() +{ + UINT8 *Next; Next = Mem; + Rom01 = Next; Next += 0x080000; // + RomZ80 = Next; Next += 0x008000; // Z80 ROM + BCU2ROM = Next; Next += nBCU2ROMSize; // BCU-2 tile data + FCU2ROM = Next; Next += nFCU2ROMSize; // FCU-2 tile data + RamStart = Next; + Ram01 = Next; Next += 0x008000; // CPU #0 work RAM + RamPal = Next; Next += 0x001000; // palette + RamPal2 = Next; Next += 0x001000; // palette + RamZ80 = Next; Next += 0x008000; // Z80 RAM + BCU2RAM = Next; Next += 0x010000; + FCU2RAM = Next; Next += 0x000800; + FCU2RAMSize = Next; Next += 0x000080; + RamEnd = Next; + ToaPalette = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + ToaPalette2 = (UINT32 *)Next; Next += nColCount * sizeof(UINT32); + MemEnd = Next; + + return 0; +} + +// Scan ram +static INT32 DrvScan(INT32 nAction, INT32* pnMin) +{ + struct BurnArea ba; + + if (pnMin != NULL) { // Return minimum compatible version + *pnMin = 0x029402; + } + if (nAction & ACB_VOLATILE) { // Scan volatile ram + memset(&ba, 0, sizeof(ba)); + ba.Data = RamStart; + ba.nLen = RamEnd - RamStart; + ba.szName = "RAM"; + BurnAcb(&ba); + + SekScan(nAction); // scan 68000 states + ZetScan(nAction); // Scan Z80 + + BurnYM3812Scan(nAction, pnMin); + + SCAN_VAR(DrvInput); + SCAN_VAR(nCyclesDone); + } + + return 0; +} + +static INT32 LoadRoms() +{ + // Load 68000 ROM + ToaLoadCode(Rom01, 0, 2); + BurnLoadRom(Rom01 + 0x40001, 2, 2); + BurnLoadRom(Rom01 + 0x40000, 3, 2); + + // Load BCU-2 tile data + ToaLoadTiles(BCU2ROM, 4, nBCU2ROMSize); + + // Load FCU-2 tile data + ToaLoadTiles(FCU2ROM, 8, nFCU2ROMSize); + + // Load the Z80 ROM + BurnLoadRom(RomZ80, 12, 1); + + return 0; +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall zerowingZ80In(UINT16 nAddress) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0xa8: + return BurnYM3812Read(0); + case 0x20: // DIP A + return DrvInput[2]; + case 0x28: // DIP B + return DrvInput[3]; + case 0x80: // Sysytem inputs + return DrvInput[4] | (ToaVBlankRegister() << 7); + case 0x00: // Player 1 + return DrvInput[0]; + case 0x08: // Player 2 + return DrvInput[1]; + case 0x88: // Region + return DrvInput[5]; + + } + +// bprintf(PRINT_NORMAL, _T("z80 read %4X\n"), nAddress); + + return 0; +} + +void __fastcall zerowingZ80Out(UINT16 nAddress, UINT8 nValue) +{ + nAddress &= 0xFF; + + switch (nAddress) { + case 0xa8: + BurnYM3812Write(0, nValue); + break; + case 0xa9: + BurnYM3812Write(1, nValue); + break; + + case 0xa0: // Coin counter + break; + +// default: +// bprintf(PRINT_NORMAL, _T("Z80 attempted to write address %04X with value %02X.\n"), nAddress, nValue); + } +} + +static INT32 DrvZ80Init() +{ + // Init the Z80 + ZetInit(0); + ZetOpen(0); + + ZetSetInHandler(zerowingZ80In); + ZetSetOutHandler(zerowingZ80Out); + + // ROM + ZetMapArea (0x0000, 0x7FFF, 0, RomZ80); // Direct Read from ROM + ZetMapArea (0x0000, 0x7FFF, 2, RomZ80); // Direct Fetch from ROM + // RAM + ZetMapArea (0x8000, 0xFFFF, 0, RamZ80); // Direct Read from RAM + ZetMapArea (0x8000, 0xFFFF, 1, RamZ80); // Direct Write to RAM + ZetMapArea (0x8000, 0xFFFF, 2, RamZ80); // + + + ZetClose(); + + return 0; +} + +// ---------------------------------------------------------------------------- + +UINT8 __fastcall zerowingReadByte(UINT32 sekAddress) +{ + switch (sekAddress) { + case 0x400001: + case 0x4c0001: + return ToaVBlankRegister(); + + default: { +// bprintf(PRINT_NORMAL, _T("Read Byte %06X.\n"), sekAddress); + } + } + + return 0; +} + +UINT16 __fastcall zerowingReadWord(UINT32 sekAddress) +{ + switch (sekAddress) { + + case 0x4c0002: + return ToaFCU2GetRAMPointer(); + case 0x4c0004: + return ToaFCU2ReadRAM(); + case 0x4c0006: + return ToaFCU2ReadRAMSize(); + + case 0x480002: + return ToaBCU2GetRAMPointer(); + case 0x480004: + return ToaBCU2ReadRAM_Hi(); + case 0x480006: + return ToaBCU2ReadRAM_Lo(); + + case 0x480010: + case 0x480011: + case 0x480012: + case 0x480013: + case 0x480014: + case 0x480015: + case 0x480016: + case 0x480017: + case 0x480018: + case 0x480019: + case 0x48001A: + case 0x48001B: + case 0x48001C: + case 0x48001D: + case 0x48001E: + case 0x48001F: + return BCU2Reg[(sekAddress & 15) >> 1]; + + case 0x400000: + case 0x4c0000: + return ToaVBlankRegister(); + + default: { +// bprintf(PRINT_NORMAL, _T("Read Word %06X.\n"), sekAddress); + } + } + + return 0; +} + +void __fastcall zerowingWriteByte(UINT32 sekAddress, UINT8 byteValue) +{ + switch (sekAddress) { + + case 0x400003: + bEnableInterrupts = byteValue; + break; + + case 0x4c0006: + ToaFCU2WriteRAMSize(byteValue); + break; + + default: { +// bprintf(PRINT_NORMAL, _T("Write byte %06X, %02X.\n"), sekAddress, byteValue); + } + } +} + +void __fastcall zerowingWriteWord(UINT32 sekAddress, UINT16 wordValue) +{ + switch (sekAddress) { + + case 0x4c0002: // FCU-2 set VRAM address-pointer + ToaFCU2SetRAMPointer(wordValue); + break; + case 0x4c0004: + ToaFCU2WriteRAM(wordValue); + break; + case 0x4c0006: + ToaFCU2WriteRAMSize(wordValue); + break; + + case 0x480000: // BCU-2 flip + break; + case 0x480002: // BCU-2 set VRAM address-pointer + ToaBCU2SetRAMPointer(wordValue); + break; + case 0x480004: + ToaBCU2WriteRAM(wordValue); + break; + case 0x480006: + ToaBCU2WriteRAM(wordValue); + break; + + case 0x480010: + case 0x480011: + case 0x480012: + case 0x480013: + case 0x480014: + case 0x480015: + case 0x480016: + case 0x480017: + case 0x480018: + case 0x480019: + case 0x48001A: + case 0x48001B: + case 0x48001C: + case 0x48001D: + case 0x48001E: + case 0x48001F: + BCU2Reg[(sekAddress & 15) >> 1] = wordValue; + break; + + case 0x400002: + bEnableInterrupts = (wordValue & 0xFF); + break; + + case 0x0c0000: + nBCU2TileXOffset = wordValue; + break; + case 0x0c0002: + nBCU2TileYOffset = wordValue; + break; + + case 0x0c0006: // FCU-2 flip + break; + + default: { +// bprintf(PRINT_NORMAL, _T("Write word %06X, %04X.\n"), sekAddress, wordValue); + } + } +} + +// ---------------------------------------------------------------------------- + +static INT32 DrvDoReset() +{ + SekOpen(0); + SekReset(); + SekClose(); + ZetOpen(0); + ZetReset(); + ZetClose(); + + BurnYM3812Reset(); + + bEnableInterrupts = false; + + return 0; +} + +static INT32 DrvInit() +{ + INT32 nLen; + + Hellfire = 1; + +#ifdef DRIVER_ROTATION + bToaRotateScreen = true; +#endif + + BurnSetRefreshRate(REFRESHRATE); + + nBCU2ROMSize = 0x080000; + nFCU2ROMSize = 0x080000; + + // Find out how much memory is needed + Mem = NULL; + MemIndex(); + nLen = MemEnd - (UINT8 *)0; + if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) { + return 1; + } + memset(Mem, 0, nLen); // blank all memory + MemIndex(); // Index the allocated memory + + // Load the roms into memory + if (LoadRoms()) { + return 1; + } + + { + SekInit(0, 0x68000); // Allocate 68000 + SekOpen(0); + + // Map 68000 memory: + SekMapMemory(Rom01, 0x000000, 0x00FFFF, SM_ROM); // 68K ROM + SekMapMemory(Rom01 + 0x040000, 0x040000, 0x07FFFF, SM_ROM); // 68K ROM + SekMapMemory(Ram01, 0x080000, 0x087FFF, SM_RAM); // 68K RAM + SekMapMemory(RamPal, 0x404000, 0x4047FF, SM_RAM); // BCU-2 palette RAM + SekMapMemory(RamPal2, 0x406000, 0x4067FF, SM_RAM); // FCU-2 palette RAM + + SekSetReadWordHandler(0, zerowingReadWord); + SekSetReadByteHandler(0, zerowingReadByte); + SekSetWriteWordHandler(0, zerowingWriteWord); + SekSetWriteByteHandler(0, zerowingWriteByte); + + SekMapHandler(1, 0x440000, 0x440FFF, SM_RAM); // Z80 RAM + + SekSetReadByteHandler(1, toaplan1ReadByteZ80RAM); + SekSetReadWordHandler(1, toaplan1ReadWordZ80RAM); + SekSetWriteByteHandler(1, toaplan1WriteByteZ80RAM); + SekSetWriteWordHandler(1, toaplan1WriteWordZ80RAM); + + SekClose(); + } + + ToaInitBCU2(); + + DrvZ80Init(); // Initialize Z80 + + nToaPalLen = nColCount; + ToaPalSrc = RamPal; + ToaPalSrc2 = RamPal2; + ToaPalInit(); + + BurnYM3812Init(28000000 / 8, &toaplan1FMIRQHandler, &toaplan1SynchroniseStream, 0); + BurnTimerAttachZetYM3812(28000000 / 8); + BurnYM3812SetRoute(BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); + + bDrawScreen = true; + + DrvDoReset(); // Reset machine + return 0; +} + +static INT32 DrvExit() +{ + BurnYM3812Exit(); + ToaPalExit(); + + ToaExitBCU2(); + ToaZExit(); // Z80 exit + SekExit(); // Deallocate 68000s + + BurnFree(Mem); + + Hellfire = 0; + + return 0; +} + +static INT32 DrvDraw() +{ + ToaClearScreen(0x120); +// BurnClearScreen(); + + if (bDrawScreen) { + ToaGetBitmap(); + ToaRenderBCU2(); // Render BCU2 graphics + } + + ToaPalUpdate(); // Update the palette + ToaPal2Update(); + + return 0; +} + +inline static INT32 CheckSleep(INT32) +{ + return 0; +} + +static INT32 DrvFrame() +{ + INT32 nInterleave = 4; + + if (DrvReset) { // Reset machine + DrvDoReset(); + } + + // Compile digital inputs + DrvInput[0] = 0x00; // Buttons + DrvInput[1] = 0x00; // Player 1 + DrvInput[4] = 0x00; // Player 2 + for (INT32 i = 0; i < 8; i++) { + DrvInput[0] |= (DrvJoy1[i] & 1) << i; + DrvInput[1] |= (DrvJoy2[i] & 1) << i; + DrvInput[4] |= (DrvButton[i] & 1) << i; + } + ToaClearOpposites(&DrvInput[0]); + ToaClearOpposites(&DrvInput[1]); + + SekOpen(0); + ZetOpen(0); + + SekNewFrame(); + ZetNewFrame(); + + SekIdle(nCyclesDone[0]); + ZetIdle(nCyclesDone[1]); + + nCyclesTotal[0] = (INT32)((INT64)10000000 * nBurnCPUSpeedAdjust / (0x0100 * REFRESHRATE)); + nCyclesTotal[1] = INT32(28000000.0 / 8 / REFRESHRATE); + + SekSetCyclesScanline(nCyclesTotal[0] / 262); + nToaCyclesDisplayStart = nCyclesTotal[0] - ((nCyclesTotal[0] * (TOA_VBLANK_LINES + 240)) / 262); + nToaCyclesVBlankStart = nCyclesTotal[0] - ((nCyclesTotal[0] * TOA_VBLANK_LINES) / 262); + bVBlank = false; + + for (INT32 i = 0; i < nInterleave; i++) { + INT32 nNext; + + // Run 68000 + + nNext = (i + 1) * nCyclesTotal[0] / nInterleave; + + // Trigger VBlank interrupt + if (nNext > nToaCyclesVBlankStart) { + if (SekTotalCycles() < nToaCyclesVBlankStart) { + nCyclesSegment = nToaCyclesVBlankStart - SekTotalCycles(); + SekRun(nCyclesSegment); + } + + if (pBurnDraw) { + DrvDraw(); // Draw screen if needed + } + + ToaBufferFCU2Sprites(); + + bVBlank = true; + if (bEnableInterrupts) { + SekSetIRQLine(4, SEK_IRQSTATUS_AUTO); + } + } + + nCyclesSegment = nNext - SekTotalCycles(); + if (bVBlank || (!CheckSleep(0))) { // See if this CPU is busywaiting + SekRun(nCyclesSegment); + } else { + SekIdle(nCyclesSegment); + } + + BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave)); + } + + nToa1Cycles68KSync = SekTotalCycles(); + BurnTimerEndFrameYM3812(nCyclesTotal[1]); + if (pBurnSoundOut) BurnYM3812Update(pBurnSoundOut, nBurnSoundLen); + + nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0]; + nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1]; + +// bprintf(PRINT_NORMAL, _T(" %i\n"), nCyclesDone[0]); + + ZetClose(); + SekClose(); + +// ToaBufferFCU2Sprites(); + + return 0; +} + +struct BurnDriver BurnDrvZerowing = { + "zerowing", NULL, NULL, NULL, "1989", + "Zero Wing\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, + NULL, zerowingRomInfo, zerowingRomName, NULL, NULL, zerowingInputInfo, zerowingDIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 320, 240, 4, 3 +}; + +struct BurnDriver BurnDrvZerowng2 = { + "zerowing2", "zerowing", NULL, NULL, "1989", + "Zero Wing (2 player simultaneous ver.)\0", NULL, "[Toaplan] Williams Electronics Games, Inc", "Toaplan BCU-2 / FCU-2 based", + NULL, NULL, NULL, NULL, + BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TOAPLAN_RAIZING, GBF_HORSHOOT, 0, + NULL, zerowng2RomInfo, zerowng2RomName, NULL, NULL, zerowingInputInfo, zerowng2DIPInfo, + DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &ToaRecalcPalette, 0x400, + 320, 240, 4, 3 +}; diff --git a/src/cpu/z80_intf.cpp b/src/cpu/z80_intf.cpp index 62cf7f632..d02034220 100644 --- a/src/cpu/z80_intf.cpp +++ b/src/cpu/z80_intf.cpp @@ -1,704 +1,694 @@ -// Z80 (Zed Eight-Ty) Interface -#include "burnint.h" -#include "z80_intf.h" - -#define MAX_Z80 8 -static struct ZetExt * ZetCPUContext[MAX_Z80] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - -typedef UINT8 (__fastcall *pZetInHandler)(UINT16 a); -typedef void (__fastcall *pZetOutHandler)(UINT16 a, UINT8 d); -typedef UINT8 (__fastcall *pZetReadHandler)(UINT16 a); -typedef void (__fastcall *pZetWriteHandler)(UINT16 a, UINT8 d); - -struct ZetExt { - Z80_Regs reg; - - UINT8* pZetMemMap[0x100 * 4]; - - pZetInHandler ZetIn; - pZetOutHandler ZetOut; - pZetReadHandler ZetRead; - pZetWriteHandler ZetWrite; - - UINT8 BusReq; -}; - -static INT32 nZetCyclesDone[MAX_Z80]; -static INT32 nZetCyclesTotal; -static INT32 nZ80ICount[MAX_Z80]; -static UINT32 Z80EA[MAX_Z80]; - -static INT32 nOpenedCPU = -1; -static INT32 nCPUCount = 0; -INT32 nHasZet = -1; - -UINT8 __fastcall ZetDummyReadHandler(UINT16) { return 0; } -void __fastcall ZetDummyWriteHandler(UINT16, UINT8) { } -UINT8 __fastcall ZetDummyInHandler(UINT16) { return 0; } -void __fastcall ZetDummyOutHandler(UINT16, UINT8) { } - -UINT8 __fastcall ZetReadIO(UINT32 a) -{ - return ZetCPUContext[nOpenedCPU]->ZetIn(a); -} - -void __fastcall ZetWriteIO(UINT32 a, UINT8 d) -{ - ZetCPUContext[nOpenedCPU]->ZetOut(a, d); -} - -UINT8 __fastcall ZetReadProg(UINT32 a) -{ - // check mem map - UINT8 * pr = ZetCPUContext[nOpenedCPU]->pZetMemMap[0x000 | (a >> 8)]; - if (pr != NULL) { - return pr[a & 0xff]; - } - - // check handler - if (ZetCPUContext[nOpenedCPU]->ZetRead != NULL) { - return ZetCPUContext[nOpenedCPU]->ZetRead(a); - } - - return 0; -} - -void __fastcall ZetWriteProg(UINT32 a, UINT8 d) -{ - // check mem map - UINT8 * pr = ZetCPUContext[nOpenedCPU]->pZetMemMap[0x100 | (a >> 8)]; - if (pr != NULL) { - pr[a & 0xff] = d; - return; - } - - // check handler - if (ZetCPUContext[nOpenedCPU]->ZetWrite != NULL) { - ZetCPUContext[nOpenedCPU]->ZetWrite(a, d); - return; - } -} - -UINT8 __fastcall ZetReadOp(UINT32 a) -{ - // check mem map - UINT8 * pr = ZetCPUContext[nOpenedCPU]->pZetMemMap[0x200 | (a >> 8)]; - if (pr != NULL) { - return pr[a & 0xff]; - } - - // check read handler - if (ZetCPUContext[nOpenedCPU]->ZetRead != NULL) { - return ZetCPUContext[nOpenedCPU]->ZetRead(a); - } - - return 0; -} - -UINT8 __fastcall ZetReadOpArg(UINT32 a) -{ - // check mem map - UINT8 * pr = ZetCPUContext[nOpenedCPU]->pZetMemMap[0x300 | (a >> 8)]; - if (pr != NULL) { - return pr[a & 0xff]; - } - - // check read handler - if (ZetCPUContext[nOpenedCPU]->ZetRead != NULL) { - return ZetCPUContext[nOpenedCPU]->ZetRead(a); - } - - return 0; -} - -void ZetSetReadHandler(UINT8 (__fastcall *pHandler)(UINT16)) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetReadHandler called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetReadHandler called when no CPU open\n")); -#endif - - ZetCPUContext[nOpenedCPU]->ZetRead = pHandler; -} - -void ZetSetWriteHandler(void (__fastcall *pHandler)(UINT16, UINT8)) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetWriteHandler called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetWriteHandler called when no CPU open\n")); -#endif - - ZetCPUContext[nOpenedCPU]->ZetWrite = pHandler; -} - -void ZetSetInHandler(UINT8 (__fastcall *pHandler)(UINT16)) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetInHandler called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetInHandler called when no CPU open\n")); -#endif - - ZetCPUContext[nOpenedCPU]->ZetIn = pHandler; -} - -void ZetSetOutHandler(void (__fastcall *pHandler)(UINT16, UINT8)) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetOutHandler called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetOutHandler called when no CPU open\n")); -#endif - - ZetCPUContext[nOpenedCPU]->ZetOut = pHandler; -} - -void ZetNewFrame() -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetNewFrame called without init\n")); -#endif - - for (INT32 i = 0; i < nCPUCount; i++) { - nZetCyclesDone[i] = 0; - } - nZetCyclesTotal = 0; -} - -static void ZetCheatWriteROM(UINT32 a, UINT8 d) -{ - ZetWriteRom(a, d); -} - -static UINT8 ZetCheatRead(UINT32 a) -{ - return ZetReadByte(a); -} - -static cpu_core_config ZetCheatCpuConfig = -{ - ZetOpen, - ZetClose, - ZetCheatRead, - ZetCheatWriteROM, - ZetGetActive, - ZetTotalCycles, - ZetNewFrame, - ZetRun, - ZetRunEnd, - ZetReset, - (1<<16), // 0x10000 - 0 -}; - -INT32 ZetInit(INT32 nCPU) -{ - DebugCPU_ZetInitted = 1; - - nOpenedCPU = -1; - - ZetCPUContext[nCPU] = (struct ZetExt*)BurnMalloc(sizeof(ZetExt)); - memset (ZetCPUContext[nCPU], 0, sizeof(ZetExt)); - - if (nCPU == 0) { // not safe! - Z80Init(); - } - - { - ZetCPUContext[nCPU]->ZetIn = ZetDummyInHandler; - ZetCPUContext[nCPU]->ZetOut = ZetDummyOutHandler; - ZetCPUContext[nCPU]->ZetRead = ZetDummyReadHandler; - ZetCPUContext[nCPU]->ZetWrite = ZetDummyWriteHandler; - ZetCPUContext[nCPU]->BusReq = 0; - // TODO: Z80Init() will set IX IY F regs with default value, so get them ... - Z80GetContext(&ZetCPUContext[nCPU]->reg); - - nZetCyclesDone[nCPU] = 0; - nZ80ICount[nCPU] = 0; - - for (INT32 j = 0; j < (0x0100 * 4); j++) { - ZetCPUContext[nCPU]->pZetMemMap[j] = NULL; - } - } - - nZetCyclesTotal = 0; - - Z80SetIOReadHandler(ZetReadIO); - Z80SetIOWriteHandler(ZetWriteIO); - Z80SetProgramReadHandler(ZetReadProg); - Z80SetProgramWriteHandler(ZetWriteProg); - Z80SetCPUOpReadHandler(ZetReadOp); - Z80SetCPUOpArgReadHandler(ZetReadOpArg); - - nCPUCount = (nCPU+1) % MAX_Z80; - - nHasZet = nCPU+1; - - CpuCheatRegister(nCPU, &ZetCheatCpuConfig); - - return 0; -} - -#if 0 -INT32 ZetInit(INT32 nCount) -{ - DebugCPU_ZetInitted = 1; - - nOpenedCPU = -1; - - ZetCPUContext = (struct ZetExt *) malloc(nCount * sizeof(ZetExt)); - if (ZetCPUContext == NULL) return 1; - memset(ZetCPUContext, 0, nCount * sizeof(ZetExt)); - - Z80Init(); - - for (INT32 i = 0; i < nCount; i++) { - ZetCPUContext[i].ZetIn = ZetDummyInHandler; - ZetCPUContext[i].ZetOut = ZetDummyOutHandler; - ZetCPUContext[i].ZetRead = ZetDummyReadHandler; - ZetCPUContext[i].ZetWrite = ZetDummyWriteHandler; - ZetCPUContext[i].BusReq = 0; - // TODO: Z80Init() will set IX IY F regs with default value, so get them ... - Z80GetContext(&ZetCPUContext[i].reg); - - nZetCyclesDone[i] = 0; - nZ80ICount[i] = 0; - - for (INT32 j = 0; j < (0x0100 * 4); j++) { - ZetCPUContext[i].pZetMemMap[j] = NULL; - } - } - - nZetCyclesTotal = 0; - - Z80SetIOReadHandler(ZetReadIO); - Z80SetIOWriteHandler(ZetWriteIO); - Z80SetProgramReadHandler(ZetReadProg); - Z80SetProgramWriteHandler(ZetWriteProg); - Z80SetCPUOpReadHandler(ZetReadOp); - Z80SetCPUOpArgReadHandler(ZetReadOpArg); - - nCPUCount = nCount % MAX_Z80; - - nHasZet = nCount; - - for (INT32 i = 0; i < nCount; i++) - CpuCheatRegister(0x0004, i); - - return 0; -} -#endif - -UINT8 ZetReadByte(UINT16 address) -{ - if (nOpenedCPU < 0) return 0; - - return ZetReadProg(address); -} - -void ZetWriteByte(UINT16 address, UINT8 data) -{ - if (nOpenedCPU < 0) return; - - ZetWriteProg(address, data); -} - -void ZetWriteRom(UINT16 address, UINT8 data) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetWriteRom called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetWriteRom called when no CPU open\n")); -#endif - - if (nOpenedCPU < 0) return; - - if (ZetCPUContext[nOpenedCPU]->pZetMemMap[0x200 | (address >> 8)] != NULL) { - ZetCPUContext[nOpenedCPU]->pZetMemMap[0x200 | (address >> 8)][address] = data; - } - - if (ZetCPUContext[nOpenedCPU]->pZetMemMap[0x300 | (address >> 8)] != NULL) { - ZetCPUContext[nOpenedCPU]->pZetMemMap[0x300 | (address >> 8)][address] = data; - } - - ZetWriteProg(address, data); -} - -void ZetClose() -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetClose called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetClose called when no CPU open\n")); -#endif - - Z80GetContext(&ZetCPUContext[nOpenedCPU]->reg); - nZetCyclesDone[nOpenedCPU] = nZetCyclesTotal; - nZ80ICount[nOpenedCPU] = z80_ICount; - Z80EA[nOpenedCPU] = EA; - - nOpenedCPU = -1; -} - -void ZetOpen(INT32 nCPU) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetOpen called without init\n")); - if (nCPU >= nCPUCount) bprintf(PRINT_ERROR, _T("ZetOpen called with invalid index %x\n"), nCPU); - if (nOpenedCPU != -1) bprintf(PRINT_ERROR, _T("ZetOpen called when CPU already open with index %x\n"), nCPU); - if (ZetCPUContext[nCPU] == NULL) bprintf (PRINT_ERROR, _T("ZetOpen called for uninitialized cpu %x\n"), nCPU); -#endif - - Z80SetContext(&ZetCPUContext[nCPU]->reg); - nZetCyclesTotal = nZetCyclesDone[nCPU]; - z80_ICount = nZ80ICount[nCPU]; - EA = Z80EA[nCPU]; - - nOpenedCPU = nCPU; -} - -INT32 ZetGetActive() -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetGetActive called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetGetActive called when no CPU open\n")); -#endif - - return nOpenedCPU; -} - -INT32 ZetRun(INT32 nCycles) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetRun called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetRun called when no CPU open\n")); -#endif - - if (nCycles <= 0) return 0; - - if (ZetCPUContext[nOpenedCPU]->BusReq) { - nZetCyclesTotal += nCycles; - return nCycles; - } - - nCycles = Z80Execute(nCycles); - - nZetCyclesTotal += nCycles; - - return nCycles; -} - -void ZetRunAdjust(INT32 /*nCycles*/) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetRunAdjust called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetRunAdjust called when no CPU open\n")); -#endif -} - -void ZetRunEnd() -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetRunEnd called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetRunEnd called when no CPU open\n")); -#endif -} - -// This function will make an area callback ZetRead/ZetWrite -INT32 ZetMemCallback(INT32 nStart, INT32 nEnd, INT32 nMode) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMemCallback called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMemCallback called when no CPU open\n")); -#endif - - UINT8 cStart = (nStart >> 8); - UINT8 **pMemMap = ZetCPUContext[nOpenedCPU]->pZetMemMap; - - for (UINT16 i = cStart; i <= (nEnd >> 8); i++) { - switch (nMode) { - case 0: - pMemMap[0 + i] = NULL; - break; - case 1: - pMemMap[0x100 + i] = NULL; - break; - case 2: - pMemMap[0x200 + i] = NULL; - pMemMap[0x300 + i] = NULL; - break; - } - } - - return 0; -} - -INT32 ZetMemEnd() -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMemEnd called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMemEnd called when no CPU open\n")); -#endif - - return 0; -} - -void ZetExit() -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetExit called without init\n")); -#endif - - Z80Exit(); - - for (INT32 i = 0; i < MAX_Z80; i++) { - if (ZetCPUContext[i]) { - BurnFree (ZetCPUContext[i]); - } - } - - nCPUCount = 0; - nHasZet = -1; - - DebugCPU_ZetInitted = 0; -} - - -INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMapArea called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMapArea called when no CPU open\n")); -#endif - - UINT8 cStart = (nStart >> 8); - UINT8 **pMemMap = ZetCPUContext[nOpenedCPU]->pZetMemMap; - - for (UINT16 i = cStart; i <= (nEnd >> 8); i++) { - switch (nMode) { - case 0: { - pMemMap[0 + i] = Mem + ((i - cStart) << 8); - break; - } - - case 1: { - pMemMap[0x100 + i] = Mem + ((i - cStart) << 8); - break; - } - - case 2: { - pMemMap[0x200 + i] = Mem + ((i - cStart) << 8); - pMemMap[0x300 + i] = Mem + ((i - cStart) << 8); - break; - } - } - } - - return 0; -} - -INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem01, UINT8 *Mem02) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMapArea called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMapArea called when no CPU open\n")); -#endif - - UINT8 cStart = (nStart >> 8); - UINT8 **pMemMap = ZetCPUContext[nOpenedCPU]->pZetMemMap; - - if (nMode != 2) { - return 1; - } - - for (UINT16 i = cStart; i <= (nEnd >> 8); i++) { - pMemMap[0x200 + i] = Mem01 + ((i - cStart) << 8); - pMemMap[0x300 + i] = Mem02 + ((i - cStart) << 8); - } - - return 0; -} - -void ZetReset() -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetReset called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetReset called when no CPU open\n")); -#endif - - Z80Reset(); -} - -INT32 ZetPc(INT32 n) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetPc called without init\n")); - if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetPc called when no CPU open\n")); -#endif - - if (n < 0) { - return ActiveZ80GetPC(); - } else { - return ZetCPUContext[n]->reg.pc.w.l; - } -} - -INT32 ZetBc(INT32 n) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetBc called without init\n")); - if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetBc called when no CPU open\n")); -#endif - - if (n < 0) { - return ActiveZ80GetBC(); - } else { - return ZetCPUContext[n]->reg.bc.w.l; - } -} - -INT32 ZetDe(INT32 n) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetDe called without init\n")); - if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetDe called when no CPU open\n")); -#endif - - if (n < 0) { - return ActiveZ80GetDE(); - } else { - return ZetCPUContext[n]->reg.de.w.l; - } -} - -INT32 ZetHL(INT32 n) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetHL called without init\n")); - if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetHL called when no CPU open\n")); -#endif - - if (n < 0) { - return ActiveZ80GetHL(); - } else { - return ZetCPUContext[n]->reg.hl.w.l; - } -} - -INT32 ZetScan(INT32 nAction) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetScan called without init\n")); -#endif - - if ((nAction & ACB_DRIVER_DATA) == 0) { - return 0; - } - - char szText[] = "Z80 #0"; - - for (INT32 i = 0; i < nCPUCount; i++) { - szText[5] = '1' + i; - - ScanVar(&ZetCPUContext[i]->reg, sizeof(Z80_Regs), szText); - SCAN_VAR(Z80EA[i]); - SCAN_VAR(nZ80ICount[i]); - SCAN_VAR(nZetCyclesDone[i]); - } - - SCAN_VAR(nZetCyclesTotal); - - return 0; -} - -void ZetSetIRQLine(const INT32 line, const INT32 status) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetIRQLine called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetIRQLine called when no CPU open\n")); -#endif - - switch ( status ) { - case ZET_IRQSTATUS_NONE: - Z80SetIrqLine(0, 0); - break; - case ZET_IRQSTATUS_ACK: - Z80SetIrqLine(line, 1); - break; - case ZET_IRQSTATUS_AUTO: - Z80SetIrqLine(line, 1); - Z80Execute(0); - Z80SetIrqLine(0, 0); - Z80Execute(0); - break; - } -} - -void ZetSetVector(INT32 vector) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetVector called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetVector called when no CPU open\n")); -#endif - - Z80Vector = vector; -} - -INT32 ZetNmi() -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetNmi called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetNmi called when no CPU open\n")); -#endif - - Z80SetIrqLine(Z80_INPUT_LINE_NMI, 1); - Z80Execute(0); - Z80SetIrqLine(Z80_INPUT_LINE_NMI, 0); - Z80Execute(0); - INT32 nCycles = 12; - nZetCyclesTotal += nCycles; - - return nCycles; -} - -INT32 ZetIdle(INT32 nCycles) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetIdle called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetIdle called when no CPU open\n")); -#endif - - nZetCyclesTotal += nCycles; - - return nCycles; -} - -INT32 ZetSegmentCycles() -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSegmentCycles called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSegmentCycles called when no CPU open\n")); -#endif - - return z80TotalCycles(); -} - -INT32 ZetTotalCycles() -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetTotalCycles called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetTotalCycles called when no CPU open\n")); -#endif - - return nZetCyclesTotal + z80TotalCycles(); -} - -void ZetSetBUSREQLine(INT32 nStatus) -{ -#if defined FBA_DEBUG - if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetBUSREQLine called without init\n")); - if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetBUSREQLine called when no CPU open\n")); -#endif - - if (nOpenedCPU < 0) return; - - ZetCPUContext[nOpenedCPU]->BusReq = nStatus; -} - -#undef MAX_Z80 +// Z80 (Zed Eight-Ty) Interface +#include "burnint.h" +#include "z80_intf.h" + +#define MAX_Z80 8 +static struct ZetExt * ZetCPUContext[MAX_Z80] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; + +typedef UINT8 (__fastcall *pZetInHandler)(UINT16 a); +typedef void (__fastcall *pZetOutHandler)(UINT16 a, UINT8 d); +typedef UINT8 (__fastcall *pZetReadHandler)(UINT16 a); +typedef void (__fastcall *pZetWriteHandler)(UINT16 a, UINT8 d); + +struct ZetExt { + Z80_Regs reg; + + UINT8* pZetMemMap[0x100 * 4]; + + pZetInHandler ZetIn; + pZetOutHandler ZetOut; + pZetReadHandler ZetRead; + pZetWriteHandler ZetWrite; + + UINT8 BusReq; +}; + +static INT32 nZetCyclesDone[MAX_Z80]; +static INT32 nZetCyclesTotal; +static INT32 nZ80ICount[MAX_Z80]; +static UINT32 Z80EA[MAX_Z80]; + +static INT32 nOpenedCPU = -1; +static INT32 nCPUCount = 0; +INT32 nHasZet = -1; + +UINT8 __fastcall ZetDummyReadHandler(UINT16) { return 0; } +void __fastcall ZetDummyWriteHandler(UINT16, UINT8) { } +UINT8 __fastcall ZetDummyInHandler(UINT16) { return 0; } +void __fastcall ZetDummyOutHandler(UINT16, UINT8) { } + +UINT8 __fastcall ZetReadIO(UINT32 a) +{ + return ZetCPUContext[nOpenedCPU]->ZetIn(a); +} + +void __fastcall ZetWriteIO(UINT32 a, UINT8 d) +{ + ZetCPUContext[nOpenedCPU]->ZetOut(a, d); +} + +UINT8 __fastcall ZetReadProg(UINT32 a) +{ + // check mem map + UINT8 * pr = ZetCPUContext[nOpenedCPU]->pZetMemMap[0x000 | (a >> 8)]; + if (pr != NULL) { + return pr[a & 0xff]; + } + + // check handler + if (ZetCPUContext[nOpenedCPU]->ZetRead != NULL) { + return ZetCPUContext[nOpenedCPU]->ZetRead(a); + } + + return 0; +} + +void __fastcall ZetWriteProg(UINT32 a, UINT8 d) +{ + // check mem map + UINT8 * pr = ZetCPUContext[nOpenedCPU]->pZetMemMap[0x100 | (a >> 8)]; + if (pr != NULL) { + pr[a & 0xff] = d; + return; + } + + // check handler + if (ZetCPUContext[nOpenedCPU]->ZetWrite != NULL) { + ZetCPUContext[nOpenedCPU]->ZetWrite(a, d); + return; + } +} + +UINT8 __fastcall ZetReadOp(UINT32 a) +{ + // check mem map + UINT8 * pr = ZetCPUContext[nOpenedCPU]->pZetMemMap[0x200 | (a >> 8)]; + if (pr != NULL) { + return pr[a & 0xff]; + } + + // check read handler + if (ZetCPUContext[nOpenedCPU]->ZetRead != NULL) { + return ZetCPUContext[nOpenedCPU]->ZetRead(a); + } + + return 0; +} + +UINT8 __fastcall ZetReadOpArg(UINT32 a) +{ + // check mem map + UINT8 * pr = ZetCPUContext[nOpenedCPU]->pZetMemMap[0x300 | (a >> 8)]; + if (pr != NULL) { + return pr[a & 0xff]; + } + + // check read handler + if (ZetCPUContext[nOpenedCPU]->ZetRead != NULL) { + return ZetCPUContext[nOpenedCPU]->ZetRead(a); + } + + return 0; +} + +void ZetSetReadHandler(UINT8 (__fastcall *pHandler)(UINT16)) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetReadHandler called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetReadHandler called when no CPU open\n")); +#endif + + ZetCPUContext[nOpenedCPU]->ZetRead = pHandler; +} + +void ZetSetWriteHandler(void (__fastcall *pHandler)(UINT16, UINT8)) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetWriteHandler called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetWriteHandler called when no CPU open\n")); +#endif + + ZetCPUContext[nOpenedCPU]->ZetWrite = pHandler; +} + +void ZetSetInHandler(UINT8 (__fastcall *pHandler)(UINT16)) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetInHandler called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetInHandler called when no CPU open\n")); +#endif + + ZetCPUContext[nOpenedCPU]->ZetIn = pHandler; +} + +void ZetSetOutHandler(void (__fastcall *pHandler)(UINT16, UINT8)) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetOutHandler called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetOutHandler called when no CPU open\n")); +#endif + + ZetCPUContext[nOpenedCPU]->ZetOut = pHandler; +} + +void ZetNewFrame() +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetNewFrame called without init\n")); +#endif + + for (INT32 i = 0; i < nCPUCount; i++) { + nZetCyclesDone[i] = 0; + } + nZetCyclesTotal = 0; +} + +static void ZetCheatWriteROM(UINT32 a, UINT8 d) +{ + ZetWriteRom(a, d); +} + +static UINT8 ZetCheatRead(UINT32 a) +{ + return ZetReadByte(a); +} + +static cpu_core_config ZetCheatCpuConfig = +{ + ZetOpen, + ZetClose, + ZetCheatRead, + ZetCheatWriteROM, + ZetGetActive, + ZetTotalCycles, + ZetNewFrame, + ZetRun, + ZetRunEnd, + ZetReset, + (1<<16), // 0x10000 + 0 +}; + +INT32 ZetInit(INT32 nCPU) +{ + DebugCPU_ZetInitted = 1; + + nOpenedCPU = -1; + + ZetCPUContext[nCPU] = (struct ZetExt*)BurnMalloc(sizeof(ZetExt)); + memset (ZetCPUContext[nCPU], 0, sizeof(ZetExt)); + + if (nCPU == 0) { // not safe! + Z80Init(); + } + + { + ZetCPUContext[nCPU]->ZetIn = ZetDummyInHandler; + ZetCPUContext[nCPU]->ZetOut = ZetDummyOutHandler; + ZetCPUContext[nCPU]->ZetRead = ZetDummyReadHandler; + ZetCPUContext[nCPU]->ZetWrite = ZetDummyWriteHandler; + ZetCPUContext[nCPU]->BusReq = 0; + // TODO: Z80Init() will set IX IY F regs with default value, so get them ... + Z80GetContext(&ZetCPUContext[nCPU]->reg); + + nZetCyclesDone[nCPU] = 0; + nZ80ICount[nCPU] = 0; + + for (INT32 j = 0; j < (0x0100 * 4); j++) { + ZetCPUContext[nCPU]->pZetMemMap[j] = NULL; + } + } + + nZetCyclesTotal = 0; + + Z80SetIOReadHandler(ZetReadIO); + Z80SetIOWriteHandler(ZetWriteIO); + Z80SetProgramReadHandler(ZetReadProg); + Z80SetProgramWriteHandler(ZetWriteProg); + Z80SetCPUOpReadHandler(ZetReadOp); + Z80SetCPUOpArgReadHandler(ZetReadOpArg); + + nCPUCount = (nCPU+1) % MAX_Z80; + + nHasZet = nCPU+1; + + CpuCheatRegister(nCPU, &ZetCheatCpuConfig); + + return 0; +} + +#if 0 +INT32 ZetInit(INT32 nCount) +{ + DebugCPU_ZetInitted = 1; + + nOpenedCPU = -1; + + ZetCPUContext = (struct ZetExt *) malloc(nCount * sizeof(ZetExt)); + if (ZetCPUContext == NULL) return 1; + memset(ZetCPUContext, 0, nCount * sizeof(ZetExt)); + + Z80Init(); + + for (INT32 i = 0; i < nCount; i++) { + ZetCPUContext[i].ZetIn = ZetDummyInHandler; + ZetCPUContext[i].ZetOut = ZetDummyOutHandler; + ZetCPUContext[i].ZetRead = ZetDummyReadHandler; + ZetCPUContext[i].ZetWrite = ZetDummyWriteHandler; + ZetCPUContext[i].BusReq = 0; + // TODO: Z80Init() will set IX IY F regs with default value, so get them ... + Z80GetContext(&ZetCPUContext[i].reg); + + nZetCyclesDone[i] = 0; + nZ80ICount[i] = 0; + + for (INT32 j = 0; j < (0x0100 * 4); j++) { + ZetCPUContext[i].pZetMemMap[j] = NULL; + } + } + + nZetCyclesTotal = 0; + + Z80SetIOReadHandler(ZetReadIO); + Z80SetIOWriteHandler(ZetWriteIO); + Z80SetProgramReadHandler(ZetReadProg); + Z80SetProgramWriteHandler(ZetWriteProg); + Z80SetCPUOpReadHandler(ZetReadOp); + Z80SetCPUOpArgReadHandler(ZetReadOpArg); + + nCPUCount = nCount % MAX_Z80; + + nHasZet = nCount; + + for (INT32 i = 0; i < nCount; i++) + CpuCheatRegister(0x0004, i); + + return 0; +} +#endif + +UINT8 ZetReadByte(UINT16 address) +{ + if (nOpenedCPU < 0) return 0; + + return ZetReadProg(address); +} + +void ZetWriteByte(UINT16 address, UINT8 data) +{ + if (nOpenedCPU < 0) return; + + ZetWriteProg(address, data); +} + +void ZetWriteRom(UINT16 address, UINT8 data) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetWriteRom called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetWriteRom called when no CPU open\n")); +#endif + + if (nOpenedCPU < 0) return; + + if (ZetCPUContext[nOpenedCPU]->pZetMemMap[0x200 | (address >> 8)] != NULL) { + ZetCPUContext[nOpenedCPU]->pZetMemMap[0x200 | (address >> 8)][address] = data; + } + + if (ZetCPUContext[nOpenedCPU]->pZetMemMap[0x300 | (address >> 8)] != NULL) { + ZetCPUContext[nOpenedCPU]->pZetMemMap[0x300 | (address >> 8)][address] = data; + } + + ZetWriteProg(address, data); +} + +void ZetClose() +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetClose called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetClose called when no CPU open\n")); +#endif + + Z80GetContext(&ZetCPUContext[nOpenedCPU]->reg); + nZetCyclesDone[nOpenedCPU] = nZetCyclesTotal; + nZ80ICount[nOpenedCPU] = z80_ICount; + Z80EA[nOpenedCPU] = EA; + + nOpenedCPU = -1; +} + +void ZetOpen(INT32 nCPU) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetOpen called without init\n")); + if (nCPU >= nCPUCount) bprintf(PRINT_ERROR, _T("ZetOpen called with invalid index %x\n"), nCPU); + if (nOpenedCPU != -1) bprintf(PRINT_ERROR, _T("ZetOpen called when CPU already open with index %x\n"), nCPU); + if (ZetCPUContext[nCPU] == NULL) bprintf (PRINT_ERROR, _T("ZetOpen called for uninitialized cpu %x\n"), nCPU); +#endif + + Z80SetContext(&ZetCPUContext[nCPU]->reg); + nZetCyclesTotal = nZetCyclesDone[nCPU]; + z80_ICount = nZ80ICount[nCPU]; + EA = Z80EA[nCPU]; + + nOpenedCPU = nCPU; +} + +INT32 ZetGetActive() +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetGetActive called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetGetActive called when no CPU open\n")); +#endif + + return nOpenedCPU; +} + +INT32 ZetRun(INT32 nCycles) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetRun called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetRun called when no CPU open\n")); +#endif + + if (nCycles <= 0) return 0; + + if (ZetCPUContext[nOpenedCPU]->BusReq) { + nZetCyclesTotal += nCycles; + return nCycles; + } + + nCycles = Z80Execute(nCycles); + + nZetCyclesTotal += nCycles; + + return nCycles; +} + +void ZetRunAdjust(INT32 /*nCycles*/) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetRunAdjust called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetRunAdjust called when no CPU open\n")); +#endif +} + +void ZetRunEnd() +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetRunEnd called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetRunEnd called when no CPU open\n")); +#endif +} + +// This function will make an area callback ZetRead/ZetWrite +INT32 ZetMemCallback(INT32 nStart, INT32 nEnd, INT32 nMode) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMemCallback called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMemCallback called when no CPU open\n")); +#endif + + UINT8 cStart = (nStart >> 8); + UINT8 **pMemMap = ZetCPUContext[nOpenedCPU]->pZetMemMap; + + for (UINT16 i = cStart; i <= (nEnd >> 8); i++) { + switch (nMode) { + case 0: + pMemMap[0 + i] = NULL; + break; + case 1: + pMemMap[0x100 + i] = NULL; + break; + case 2: + pMemMap[0x200 + i] = NULL; + pMemMap[0x300 + i] = NULL; + break; + } + } + + return 0; +} + +void ZetExit() +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetExit called without init\n")); +#endif + + Z80Exit(); + + for (INT32 i = 0; i < MAX_Z80; i++) { + if (ZetCPUContext[i]) { + BurnFree (ZetCPUContext[i]); + } + } + + nCPUCount = 0; + nHasZet = -1; + + DebugCPU_ZetInitted = 0; +} + + +INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMapArea called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMapArea called when no CPU open\n")); +#endif + + UINT8 cStart = (nStart >> 8); + UINT8 **pMemMap = ZetCPUContext[nOpenedCPU]->pZetMemMap; + + for (UINT16 i = cStart; i <= (nEnd >> 8); i++) { + switch (nMode) { + case 0: { + pMemMap[0 + i] = Mem + ((i - cStart) << 8); + break; + } + + case 1: { + pMemMap[0x100 + i] = Mem + ((i - cStart) << 8); + break; + } + + case 2: { + pMemMap[0x200 + i] = Mem + ((i - cStart) << 8); + pMemMap[0x300 + i] = Mem + ((i - cStart) << 8); + break; + } + } + } + + return 0; +} + +INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem01, UINT8 *Mem02) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMapArea called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMapArea called when no CPU open\n")); +#endif + + UINT8 cStart = (nStart >> 8); + UINT8 **pMemMap = ZetCPUContext[nOpenedCPU]->pZetMemMap; + + if (nMode != 2) { + return 1; + } + + for (UINT16 i = cStart; i <= (nEnd >> 8); i++) { + pMemMap[0x200 + i] = Mem01 + ((i - cStart) << 8); + pMemMap[0x300 + i] = Mem02 + ((i - cStart) << 8); + } + + return 0; +} + +void ZetReset() +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetReset called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetReset called when no CPU open\n")); +#endif + + Z80Reset(); +} + +INT32 ZetPc(INT32 n) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetPc called without init\n")); + if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetPc called when no CPU open\n")); +#endif + + if (n < 0) { + return ActiveZ80GetPC(); + } else { + return ZetCPUContext[n]->reg.pc.w.l; + } +} + +INT32 ZetBc(INT32 n) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetBc called without init\n")); + if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetBc called when no CPU open\n")); +#endif + + if (n < 0) { + return ActiveZ80GetBC(); + } else { + return ZetCPUContext[n]->reg.bc.w.l; + } +} + +INT32 ZetDe(INT32 n) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetDe called without init\n")); + if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetDe called when no CPU open\n")); +#endif + + if (n < 0) { + return ActiveZ80GetDE(); + } else { + return ZetCPUContext[n]->reg.de.w.l; + } +} + +INT32 ZetHL(INT32 n) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetHL called without init\n")); + if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetHL called when no CPU open\n")); +#endif + + if (n < 0) { + return ActiveZ80GetHL(); + } else { + return ZetCPUContext[n]->reg.hl.w.l; + } +} + +INT32 ZetScan(INT32 nAction) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetScan called without init\n")); +#endif + + if ((nAction & ACB_DRIVER_DATA) == 0) { + return 0; + } + + char szText[] = "Z80 #0"; + + for (INT32 i = 0; i < nCPUCount; i++) { + szText[5] = '1' + i; + + ScanVar(&ZetCPUContext[i]->reg, sizeof(Z80_Regs), szText); + SCAN_VAR(Z80EA[i]); + SCAN_VAR(nZ80ICount[i]); + SCAN_VAR(nZetCyclesDone[i]); + } + + SCAN_VAR(nZetCyclesTotal); + + return 0; +} + +void ZetSetIRQLine(const INT32 line, const INT32 status) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetIRQLine called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetIRQLine called when no CPU open\n")); +#endif + + switch ( status ) { + case ZET_IRQSTATUS_NONE: + Z80SetIrqLine(0, 0); + break; + case ZET_IRQSTATUS_ACK: + Z80SetIrqLine(line, 1); + break; + case ZET_IRQSTATUS_AUTO: + Z80SetIrqLine(line, 1); + Z80Execute(0); + Z80SetIrqLine(0, 0); + Z80Execute(0); + break; + } +} + +void ZetSetVector(INT32 vector) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetVector called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetVector called when no CPU open\n")); +#endif + + Z80Vector = vector; +} + +INT32 ZetNmi() +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetNmi called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetNmi called when no CPU open\n")); +#endif + + Z80SetIrqLine(Z80_INPUT_LINE_NMI, 1); + Z80Execute(0); + Z80SetIrqLine(Z80_INPUT_LINE_NMI, 0); + Z80Execute(0); + INT32 nCycles = 12; + nZetCyclesTotal += nCycles; + + return nCycles; +} + +INT32 ZetIdle(INT32 nCycles) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetIdle called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetIdle called when no CPU open\n")); +#endif + + nZetCyclesTotal += nCycles; + + return nCycles; +} + +INT32 ZetSegmentCycles() +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSegmentCycles called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSegmentCycles called when no CPU open\n")); +#endif + + return z80TotalCycles(); +} + +INT32 ZetTotalCycles() +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetTotalCycles called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetTotalCycles called when no CPU open\n")); +#endif + + return nZetCyclesTotal + z80TotalCycles(); +} + +void ZetSetBUSREQLine(INT32 nStatus) +{ +#if defined FBA_DEBUG + if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetBUSREQLine called without init\n")); + if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetBUSREQLine called when no CPU open\n")); +#endif + + if (nOpenedCPU < 0) return; + + ZetCPUContext[nOpenedCPU]->BusReq = nStatus; +} + +#undef MAX_Z80 diff --git a/src/cpu/z80_intf.h b/src/cpu/z80_intf.h index 89f7ba214..e8843a86f 100644 --- a/src/cpu/z80_intf.h +++ b/src/cpu/z80_intf.h @@ -1,51 +1,50 @@ -// Z80 (Zed Eight-Ty) Interface - -#ifndef FASTCALL - #undef __fastcall - #define __fastcall -#endif - -#include "z80.h" - -extern INT32 nHasZet; -void ZetWriteByte(UINT16 address, UINT8 data); -UINT8 ZetReadByte(UINT16 address); -void ZetWriteRom(UINT16 address, UINT8 data); -INT32 ZetInit(INT32 nCount); -void ZetExit(); -void ZetNewFrame(); -void ZetOpen(INT32 nCPU); -void ZetClose(); -INT32 ZetGetActive(); -INT32 ZetMemCallback(INT32 nStart,INT32 nEnd,INT32 nMode); -INT32 ZetMemEnd(); -INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem); -INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem01, UINT8 *Mem02); -void ZetReset(); -INT32 ZetPc(INT32 n); -INT32 ZetBc(INT32 n); -INT32 ZetDe(INT32 n); -INT32 ZetHL(INT32 n); -INT32 ZetScan(INT32 nAction); -INT32 ZetRun(INT32 nCycles); -void ZetRunEnd(); -void ZetSetIRQLine(const INT32 line, const INT32 status); -void ZetSetVector(INT32 vector); -INT32 ZetNmi(); -INT32 ZetIdle(INT32 nCycles); -INT32 ZetSegmentCycles(); -INT32 ZetTotalCycles(); - -#define ZET_IRQSTATUS_NONE 0 -#define ZET_IRQSTATUS_ACK 1 -#define ZET_IRQSTATUS_AUTO 2 - -#define ZetRaiseIrq(n) ZetSetIRQLine(n, ZET_IRQSTATUS_AUTO) -#define ZetLowerIrq() ZetSetIRQLine(0, Z80_CLEAR_LINE) - -void ZetSetReadHandler(UINT8 (__fastcall *pHandler)(UINT16)); -void ZetSetWriteHandler(void (__fastcall *pHandler)(UINT16, UINT8)); -void ZetSetInHandler(UINT8 (__fastcall *pHandler)(UINT16)); -void ZetSetOutHandler(void (__fastcall *pHandler)(UINT16, UINT8)); - -void ZetSetBUSREQLine(INT32 nStatus); +// Z80 (Zed Eight-Ty) Interface + +#ifndef FASTCALL + #undef __fastcall + #define __fastcall +#endif + +#include "z80.h" + +extern INT32 nHasZet; +void ZetWriteByte(UINT16 address, UINT8 data); +UINT8 ZetReadByte(UINT16 address); +void ZetWriteRom(UINT16 address, UINT8 data); +INT32 ZetInit(INT32 nCount); +void ZetExit(); +void ZetNewFrame(); +void ZetOpen(INT32 nCPU); +void ZetClose(); +INT32 ZetGetActive(); +INT32 ZetMemCallback(INT32 nStart,INT32 nEnd,INT32 nMode); +INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem); +INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem01, UINT8 *Mem02); +void ZetReset(); +INT32 ZetPc(INT32 n); +INT32 ZetBc(INT32 n); +INT32 ZetDe(INT32 n); +INT32 ZetHL(INT32 n); +INT32 ZetScan(INT32 nAction); +INT32 ZetRun(INT32 nCycles); +void ZetRunEnd(); +void ZetSetIRQLine(const INT32 line, const INT32 status); +void ZetSetVector(INT32 vector); +INT32 ZetNmi(); +INT32 ZetIdle(INT32 nCycles); +INT32 ZetSegmentCycles(); +INT32 ZetTotalCycles(); + +#define ZET_IRQSTATUS_NONE 0 +#define ZET_IRQSTATUS_ACK 1 +#define ZET_IRQSTATUS_AUTO 2 + +#define ZetRaiseIrq(n) ZetSetIRQLine(n, ZET_IRQSTATUS_AUTO) +#define ZetLowerIrq() ZetSetIRQLine(0, Z80_CLEAR_LINE) + +void ZetSetReadHandler(UINT8 (__fastcall *pHandler)(UINT16)); +void ZetSetWriteHandler(void (__fastcall *pHandler)(UINT16, UINT8)); +void ZetSetInHandler(UINT8 (__fastcall *pHandler)(UINT16)); +void ZetSetOutHandler(void (__fastcall *pHandler)(UINT16, UINT8)); + +void ZetSetBUSREQLine(INT32 nStatus);